From e58ae4d63d78f20bc038215c454dc4494f5901ae Mon Sep 17 00:00:00 2001 From: Andrea Amorese Date: Thu, 18 Nov 2021 11:36:03 +0100 Subject: [PATCH] Built motion from commit 9a7b0d36.|2.5.35 --- apidoc/api_project.js | 2 +- apidoc/api_project.json | 2 +- server/api/action/action.attributes.js | 2 +- server/api/action/action.controller.js | 2 +- server/api/action/action.model.js | 2 +- server/api/action/action.rpc.js | 2 +- server/api/action/index.js | 2 +- .../analyticCustomReport.attributes.js | 2 +- .../analyticCustomReport.controller.js | 2 +- .../analyticCustomReport.model.js | 2 +- .../analyticCustomReport.rpc.js | 2 +- server/api/analyticCustomReport/index.js | 2 +- .../analyticDefaultReport.attributes.js | 2 +- .../analyticDefaultReport.controller.js | 2 +- .../analyticDefaultReport.model.js | 2 +- .../analyticDefaultReport.rpc.js | 2 +- server/api/analyticDefaultReport/index.js | 2 +- .../analyticExtractedReport.attributes.js | 2 +- .../analyticExtractedReport.controller.js | 2 +- .../analyticExtractedReport.model.js | 2 +- .../analyticExtractedReport.rpc.js | 2 +- server/api/analyticExtractedReport/index.js | 2 +- .../analyticFieldReport.attributes.js | 2 +- .../analyticFieldReport.controller.js | 2 +- .../analyticFieldReport.model.js | 2 +- .../analyticFieldReport/analyticFieldReport.rpc.js | 2 +- server/api/analyticFieldReport/index.js | 2 +- .../analyticMetric/analyticMetric.attributes.js | 2 +- .../analyticMetric/analyticMetric.controller.js | 2 +- server/api/analyticMetric/analyticMetric.model.js | 2 +- server/api/analyticMetric/analyticMetric.rpc.js | 2 +- server/api/analyticMetric/index.js | 2 +- .../analyticTreeReport.attributes.js | 2 +- .../analyticTreeReport.controller.js | 2 +- .../analyticTreeReport/analyticTreeReport.model.js | 2 +- .../analyticTreeReport/analyticTreeReport.rpc.js | 2 +- server/api/analyticTreeReport/index.js | 2 +- server/api/attachment/attachment.attributes.js | 2 +- server/api/attachment/attachment.controller.js | 2 +- server/api/attachment/attachment.model.js | 2 +- server/api/attachment/attachment.rpc.js | 2 +- server/api/attachment/index.js | 2 +- server/api/authGoogle/authGoogle.controller.js | 2 +- server/api/authGoogle/index.js | 2 +- server/api/authLocal/authLocal.controller.js | 2 +- server/api/authLocal/index.js | 2 +- server/api/automation/automation.attributes.js | 2 +- server/api/automation/automation.controller.js | 2 +- server/api/automation/automation.model.js | 2 +- server/api/automation/automation.rpc.js | 2 +- server/api/automation/index.js | 2 +- server/api/campaign/campaign.attributes.js | 2 +- server/api/campaign/campaign.controller.js | 2 +- server/api/campaign/campaign.model.js | 2 +- server/api/campaign/campaign.rpc.js | 2 +- server/api/campaign/index.js | 2 +- server/api/cannedAnswer/cannedAnswer.attributes.js | 2 +- server/api/cannedAnswer/cannedAnswer.controller.js | 2 +- server/api/cannedAnswer/cannedAnswer.model.js | 2 +- server/api/cannedAnswer/cannedAnswer.rpc.js | 2 +- server/api/cannedAnswer/index.js | 2 +- server/api/cdr/cdr.attributes.js | 2 +- server/api/cdr/cdr.controller.js | 2 +- server/api/cdr/cdr.model.js | 2 +- server/api/cdr/cdr.rpc.js | 2 +- server/api/cdr/index.js | 2 +- .../chatApplication/chatApplication.attributes.js | 2 +- .../chatApplication/chatApplication.controller.js | 2 +- .../api/chatApplication/chatApplication.model.js | 2 +- server/api/chatApplication/chatApplication.rpc.js | 2 +- server/api/chatApplication/index.js | 2 +- server/api/chatGroup/chatGroup.attributes.js | 2 +- server/api/chatGroup/chatGroup.controller.js | 2 +- server/api/chatGroup/chatGroup.events.js | 2 +- server/api/chatGroup/chatGroup.model.js | 2 +- server/api/chatGroup/chatGroup.rpc.js | 2 +- server/api/chatGroup/chatGroup.socket.js | 2 +- server/api/chatGroup/index.js | 2 +- .../chatInteraction/chatInteraction.attributes.js | 2 +- .../chatInteraction/chatInteraction.controller.js | 2 +- .../api/chatInteraction/chatInteraction.events.js | 2 +- .../api/chatInteraction/chatInteraction.model.js | 2 +- server/api/chatInteraction/chatInteraction.rpc.js | 2 +- .../api/chatInteraction/chatInteraction.socket.js | 2 +- server/api/chatInteraction/index.js | 2 +- .../chatInternalMessage.attributes.js | 2 +- .../chatInternalMessage.controller.js | 2 +- .../chatInternalMessage.events.js | 2 +- .../chatInternalMessage.model.js | 2 +- .../chatInternalMessage/chatInternalMessage.rpc.js | 2 +- .../chatInternalMessage.socket.js | 2 +- server/api/chatInternalMessage/index.js | 2 +- server/api/chatMessage/chatMessage.attributes.js | 2 +- server/api/chatMessage/chatMessage.controller.js | 2 +- server/api/chatMessage/chatMessage.events.js | 2 +- server/api/chatMessage/chatMessage.model.js | 2 +- server/api/chatMessage/chatMessage.rpc.js | 2 +- server/api/chatMessage/chatMessage.socket.js | 2 +- server/api/chatMessage/index.js | 2 +- .../chatOfflineMessage.attributes.js | 2 +- .../chatOfflineMessage.controller.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.model.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.rpc.js | 2 +- server/api/chatOfflineMessage/index.js | 2 +- .../chatProactiveAction.attributes.js | 2 +- .../chatProactiveAction.controller.js | 2 +- .../chatProactiveAction.model.js | 2 +- .../chatProactiveAction/chatProactiveAction.rpc.js | 2 +- server/api/chatProactiveAction/index.js | 2 +- server/api/chatQueue/chatQueue.attributes.js | 2 +- server/api/chatQueue/chatQueue.controller.js | 2 +- server/api/chatQueue/chatQueue.events.js | 2 +- server/api/chatQueue/chatQueue.model.js | 2 +- server/api/chatQueue/chatQueue.rpc.js | 2 +- server/api/chatQueue/chatQueue.socket.js | 2 +- server/api/chatQueue/index.js | 2 +- .../chatQueueReport/chatQueueReport.attributes.js | 2 +- .../chatQueueReport/chatQueueReport.controller.js | 2 +- .../api/chatQueueReport/chatQueueReport.model.js | 2 +- server/api/chatQueueReport/chatQueueReport.rpc.js | 2 +- server/api/chatQueueReport/index.js | 2 +- .../chatTransferReport.attributes.js | 2 +- .../chatTransferReport.controller.js | 2 +- .../chatTransferReport/chatTransferReport.model.js | 2 +- .../chatTransferReport/chatTransferReport.rpc.js | 2 +- server/api/chatTransferReport/index.js | 2 +- server/api/chatWebsite/chatWebsite.attributes.js | 2 +- server/api/chatWebsite/chatWebsite.controller.js | 2 +- server/api/chatWebsite/chatWebsite.events.js | 2 +- server/api/chatWebsite/chatWebsite.model.js | 2 +- server/api/chatWebsite/chatWebsite.rpc.js | 2 +- server/api/chatWebsite/chatWebsite.socket.js | 2 +- server/api/chatWebsite/index.js | 2 +- .../api/cloudProvider/cloudProvider.attributes.js | 2 +- .../api/cloudProvider/cloudProvider.controller.js | 2 +- server/api/cloudProvider/cloudProvider.model.js | 2 +- server/api/cloudProvider/cloudProvider.rpc.js | 2 +- server/api/cloudProvider/index.js | 2 +- server/api/cmCompany/cmCompany.attributes.js | 2 +- server/api/cmCompany/cmCompany.controller.js | 2 +- server/api/cmCompany/cmCompany.model.js | 2 +- server/api/cmCompany/cmCompany.rpc.js | 2 +- server/api/cmCompany/index.js | 2 +- server/api/cmContact/cmContact.attributes.js | 2 +- server/api/cmContact/cmContact.controller.js | 2 +- server/api/cmContact/cmContact.events.js | 2 +- server/api/cmContact/cmContact.model.js | 2 +- server/api/cmContact/cmContact.rpc.js | 2 +- server/api/cmContact/cmContact.socket.js | 2 +- server/api/cmContact/index.js | 2 +- .../api/cmCustomField/cmCustomField.attributes.js | 2 +- .../api/cmCustomField/cmCustomField.controller.js | 2 +- server/api/cmCustomField/cmCustomField.model.js | 2 +- server/api/cmCustomField/cmCustomField.rpc.js | 2 +- server/api/cmCustomField/index.js | 2 +- server/api/cmHopper/cmHopper.attributes.js | 2 +- server/api/cmHopper/cmHopper.controller.js | 2 +- server/api/cmHopper/cmHopper.model.js | 2 +- server/api/cmHopper/cmHopper.rpc.js | 2 +- server/api/cmHopper/index.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.attributes.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.controller.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.model.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.rpc.js | 2 +- server/api/cmHopperBlack/index.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.attributes.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.controller.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.model.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.rpc.js | 2 +- server/api/cmHopperFinal/index.js | 2 +- .../cmHopperHistory/cmHopperHistory.attributes.js | 2 +- .../cmHopperHistory/cmHopperHistory.controller.js | 2 +- .../api/cmHopperHistory/cmHopperHistory.model.js | 2 +- server/api/cmHopperHistory/cmHopperHistory.rpc.js | 2 +- server/api/cmHopperHistory/index.js | 2 +- server/api/cmList/cmList.attributes.js | 2 +- server/api/cmList/cmList.controller.js | 2 +- server/api/cmList/cmList.events.js | 2 +- server/api/cmList/cmList.model.js | 2 +- server/api/cmList/cmList.rpc.js | 2 +- server/api/cmList/cmList.socket.js | 2 +- server/api/cmList/index.js | 2 +- server/api/condition/condition.attributes.js | 2 +- server/api/condition/condition.controller.js | 2 +- server/api/condition/condition.model.js | 2 +- server/api/condition/condition.rpc.js | 2 +- server/api/condition/index.js | 2 +- server/api/dashboard/dashboard.attributes.js | 2 +- server/api/dashboard/dashboard.controller.js | 2 +- server/api/dashboard/dashboard.events.js | 2 +- server/api/dashboard/dashboard.model.js | 2 +- server/api/dashboard/dashboard.rpc.js | 2 +- server/api/dashboard/dashboard.socket.js | 2 +- server/api/dashboard/index.js | 2 +- .../api/dashboardItem/dashboardItem.attributes.js | 2 +- .../api/dashboardItem/dashboardItem.controller.js | 2 +- server/api/dashboardItem/dashboardItem.events.js | 2 +- server/api/dashboardItem/dashboardItem.model.js | 2 +- server/api/dashboardItem/dashboardItem.rpc.js | 2 +- server/api/dashboardItem/dashboardItem.socket.js | 2 +- server/api/dashboardItem/index.js | 2 +- server/api/disposition/disposition.attributes.js | 2 +- server/api/disposition/disposition.controller.js | 2 +- server/api/disposition/disposition.model.js | 2 +- server/api/disposition/disposition.rpc.js | 2 +- server/api/disposition/index.js | 2 +- server/api/faxAccount/faxAccount.attributes.js | 2 +- server/api/faxAccount/faxAccount.controller.js | 2 +- server/api/faxAccount/faxAccount.events.js | 2 +- server/api/faxAccount/faxAccount.model.js | 2 +- server/api/faxAccount/faxAccount.rpc.js | 2 +- server/api/faxAccount/faxAccount.socket.js | 2 +- server/api/faxAccount/index.js | 2 +- .../faxApplication/faxApplication.attributes.js | 2 +- .../faxApplication/faxApplication.controller.js | 2 +- server/api/faxApplication/faxApplication.model.js | 2 +- server/api/faxApplication/faxApplication.rpc.js | 2 +- server/api/faxApplication/index.js | 2 +- .../faxInteraction/faxInteraction.attributes.js | 2 +- .../faxInteraction/faxInteraction.controller.js | 2 +- server/api/faxInteraction/faxInteraction.events.js | 2 +- server/api/faxInteraction/faxInteraction.model.js | 2 +- server/api/faxInteraction/faxInteraction.rpc.js | 2 +- server/api/faxInteraction/faxInteraction.socket.js | 2 +- server/api/faxInteraction/index.js | 2 +- server/api/faxMessage/faxMessage.attributes.js | 2 +- server/api/faxMessage/faxMessage.controller.js | 2 +- server/api/faxMessage/faxMessage.events.js | 2 +- server/api/faxMessage/faxMessage.model.js | 2 +- server/api/faxMessage/faxMessage.rpc.js | 2 +- server/api/faxMessage/faxMessage.socket.js | 2 +- server/api/faxMessage/index.js | 2 +- server/api/faxQueue/faxQueue.attributes.js | 2 +- server/api/faxQueue/faxQueue.controller.js | 2 +- server/api/faxQueue/faxQueue.events.js | 2 +- server/api/faxQueue/faxQueue.model.js | 2 +- server/api/faxQueue/faxQueue.rpc.js | 2 +- server/api/faxQueue/faxQueue.socket.js | 2 +- server/api/faxQueue/index.js | 2 +- .../faxQueueReport/faxQueueReport.attributes.js | 2 +- .../faxQueueReport/faxQueueReport.controller.js | 2 +- server/api/faxQueueReport/faxQueueReport.model.js | 2 +- server/api/faxQueueReport/faxQueueReport.rpc.js | 2 +- server/api/faxQueueReport/index.js | 2 +- .../faxTransferReport.attributes.js | 2 +- .../faxTransferReport.controller.js | 2 +- .../faxTransferReport/faxTransferReport.model.js | 2 +- .../api/faxTransferReport/faxTransferReport.rpc.js | 2 +- server/api/faxTransferReport/index.js | 2 +- server/api/intDeskAccount/index.js | 2 +- .../intDeskAccount/intDeskAccount.attributes.js | 2 +- .../intDeskAccount/intDeskAccount.controller.js | 2 +- server/api/intDeskAccount/intDeskAccount.model.js | 2 +- server/api/intDeskAccount/intDeskAccount.rpc.js | 2 +- server/api/intDeskConfiguration/index.js | 2 +- .../intDeskConfiguration.attributes.js | 2 +- .../intDeskConfiguration.controller.js | 2 +- .../intDeskConfiguration.model.js | 2 +- .../intDeskConfiguration.rpc.js | 2 +- server/api/intDeskField/index.js | 2 +- server/api/intDeskField/intDeskField.attributes.js | 2 +- server/api/intDeskField/intDeskField.controller.js | 2 +- server/api/intDeskField/intDeskField.model.js | 2 +- server/api/intDeskField/intDeskField.rpc.js | 2 +- server/api/intDynamics365Account/index.js | 2 +- .../intDynamics365Account.attributes.js | 2 +- .../intDynamics365Account.controller.js | 2 +- .../intDynamics365Account.model.js | 2 +- .../intDynamics365Account.rpc.js | 2 +- server/api/intDynamics365Configuration/index.js | 2 +- .../intDynamics365Configuration.attributes.js | 2 +- .../intDynamics365Configuration.controller.js | 2 +- .../intDynamics365Configuration.model.js | 2 +- .../intDynamics365Configuration.rpc.js | 2 +- server/api/intDynamics365Field/index.js | 2 +- .../intDynamics365Field.attributes.js | 2 +- .../intDynamics365Field.controller.js | 2 +- .../intDynamics365Field.model.js | 2 +- .../intDynamics365Field/intDynamics365Field.rpc.js | 2 +- server/api/intFreshdeskAccount/index.js | 2 +- .../intFreshdeskAccount.attributes.js | 2 +- .../intFreshdeskAccount.controller.js | 2 +- .../intFreshdeskAccount.model.js | 2 +- .../intFreshdeskAccount/intFreshdeskAccount.rpc.js | 2 +- server/api/intFreshdeskConfiguration/index.js | 2 +- .../intFreshdeskConfiguration.attributes.js | 2 +- .../intFreshdeskConfiguration.controller.js | 2 +- .../intFreshdeskConfiguration.model.js | 2 +- .../intFreshdeskConfiguration.rpc.js | 2 +- server/api/intFreshdeskField/index.js | 2 +- .../intFreshdeskField.attributes.js | 2 +- .../intFreshdeskField.controller.js | 2 +- .../intFreshdeskField/intFreshdeskField.model.js | 2 +- .../api/intFreshdeskField/intFreshdeskField.rpc.js | 2 +- server/api/intFreshsalesAccount/index.js | 2 +- .../intFreshsalesAccount.attributes.js | 2 +- .../intFreshsalesAccount.controller.js | 2 +- .../intFreshsalesAccount.model.js | 2 +- .../intFreshsalesAccount.rpc.js | 2 +- server/api/intFreshsalesConfiguration/index.js | 2 +- .../intFreshsalesConfiguration.attributes.js | 2 +- .../intFreshsalesConfiguration.controller.js | 2 +- .../intFreshsalesConfiguration.model.js | 2 +- .../intFreshsalesConfiguration.rpc.js | 2 +- server/api/intFreshsalesField/index.js | 2 +- .../intFreshsalesField.attributes.js | 2 +- .../intFreshsalesField.controller.js | 2 +- .../intFreshsalesField/intFreshsalesField.model.js | 2 +- .../intFreshsalesField/intFreshsalesField.rpc.js | 2 +- server/api/intSalesforceAccount/index.js | 2 +- .../intSalesforceAccount.attributes.js | 2 +- .../intSalesforceAccount.controller.js | 2 +- .../intSalesforceAccount.model.js | 2 +- .../intSalesforceAccount.rpc.js | 2 +- server/api/intSalesforceConfiguration/index.js | 2 +- .../intSalesforceConfiguration.attributes.js | 2 +- .../intSalesforceConfiguration.controller.js | 2 +- .../intSalesforceConfiguration.model.js | 2 +- .../intSalesforceConfiguration.rpc.js | 2 +- server/api/intSalesforceField/index.js | 2 +- .../intSalesforceField.attributes.js | 2 +- .../intSalesforceField.controller.js | 2 +- .../intSalesforceField/intSalesforceField.model.js | 2 +- .../intSalesforceField/intSalesforceField.rpc.js | 2 +- server/api/intServicenowAccount/index.js | 2 +- .../intServicenowAccount.attributes.js | 2 +- .../intServicenowAccount.controller.js | 2 +- .../intServicenowAccount.model.js | 2 +- .../intServicenowAccount.rpc.js | 2 +- server/api/intServicenowConfiguration/index.js | 2 +- .../intServicenowConfiguration.attributes.js | 2 +- .../intServicenowConfiguration.controller.js | 2 +- .../intServicenowConfiguration.model.js | 2 +- .../intServicenowConfiguration.rpc.js | 2 +- server/api/intServicenowField/index.js | 2 +- .../intServicenowField.attributes.js | 2 +- .../intServicenowField.controller.js | 2 +- .../intServicenowField/intServicenowField.model.js | 2 +- .../intServicenowField/intServicenowField.rpc.js | 2 +- server/api/intSugarcrmAccount/index.js | 2 +- .../intSugarcrmAccount.attributes.js | 2 +- .../intSugarcrmAccount.controller.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.model.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.rpc.js | 2 +- server/api/intSugarcrmConfiguration/index.js | 2 +- .../intSugarcrmConfiguration.attributes.js | 2 +- .../intSugarcrmConfiguration.controller.js | 2 +- .../intSugarcrmConfiguration.model.js | 2 +- .../intSugarcrmConfiguration.rpc.js | 2 +- server/api/intSugarcrmField/index.js | 2 +- .../intSugarcrmField.attributes.js | 2 +- .../intSugarcrmField.controller.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.model.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.rpc.js | 2 +- server/api/intVtigerAccount/index.js | 2 +- .../intVtigerAccount.attributes.js | 2 +- .../intVtigerAccount.controller.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.model.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.rpc.js | 2 +- server/api/intVtigerConfiguration/index.js | 2 +- .../intVtigerConfiguration.attributes.js | 2 +- .../intVtigerConfiguration.controller.js | 2 +- .../intVtigerConfiguration.model.js | 2 +- .../intVtigerConfiguration.rpc.js | 2 +- server/api/intVtigerField/index.js | 2 +- .../intVtigerField/intVtigerField.attributes.js | 2 +- .../intVtigerField/intVtigerField.controller.js | 2 +- server/api/intVtigerField/intVtigerField.model.js | 2 +- server/api/intVtigerField/intVtigerField.rpc.js | 2 +- server/api/intZendeskAccount/index.js | 2 +- .../intZendeskAccount.attributes.js | 2 +- .../intZendeskAccount.controller.js | 2 +- .../intZendeskAccount/intZendeskAccount.model.js | 2 +- .../api/intZendeskAccount/intZendeskAccount.rpc.js | 2 +- server/api/intZendeskConfiguration/index.js | 2 +- .../intZendeskConfiguration.attributes.js | 2 +- .../intZendeskConfiguration.controller.js | 2 +- .../intZendeskConfiguration.model.js | 2 +- .../intZendeskConfiguration.rpc.js | 2 +- server/api/intZendeskField/index.js | 2 +- .../intZendeskField/intZendeskField.attributes.js | 2 +- .../intZendeskField/intZendeskField.controller.js | 2 +- .../api/intZendeskField/intZendeskField.model.js | 2 +- server/api/intZendeskField/intZendeskField.rpc.js | 2 +- server/api/intZohoAccount/index.js | 2 +- .../intZohoAccount/intZohoAccount.attributes.js | 2 +- .../intZohoAccount/intZohoAccount.controller.js | 2 +- server/api/intZohoAccount/intZohoAccount.model.js | 2 +- server/api/intZohoAccount/intZohoAccount.rpc.js | 2 +- server/api/intZohoConfiguration/index.js | 2 +- .../intZohoConfiguration.attributes.js | 2 +- .../intZohoConfiguration.controller.js | 2 +- .../intZohoConfiguration.model.js | 2 +- .../intZohoConfiguration.rpc.js | 2 +- server/api/intZohoField/index.js | 2 +- server/api/intZohoField/intZohoField.attributes.js | 2 +- server/api/intZohoField/intZohoField.controller.js | 2 +- server/api/intZohoField/intZohoField.model.js | 2 +- server/api/intZohoField/intZohoField.rpc.js | 2 +- server/api/integration/index.js | 2 +- server/api/integration/integration.attributes.js | 2 +- server/api/integration/integration.controller.js | 2 +- server/api/integration/integration.model.js | 2 +- server/api/integration/integration.rpc.js | 2 +- server/api/integrationReport/index.js | 2 +- .../integrationReport.attributes.js | 2 +- .../integrationReport.controller.js | 2 +- .../integrationReport/integrationReport.model.js | 2 +- .../api/integrationReport/integrationReport.rpc.js | 2 +- server/api/interval/index.js | 2 +- server/api/interval/interval.attributes.js | 2 +- server/api/interval/interval.controller.js | 2 +- server/api/interval/interval.model.js | 2 +- server/api/interval/interval.rpc.js | 2 +- server/api/jira/index.js | 2 +- server/api/jira/jira.controller.js | 2 +- server/api/jscriptyAnswerReport/index.js | 2 +- .../jscriptyAnswerReport.attributes.js | 2 +- .../jscriptyAnswerReport.controller.js | 2 +- .../jscriptyAnswerReport.model.js | 2 +- .../jscriptyAnswerReport.rpc.js | 2 +- server/api/jscriptyProject/index.js | 2 +- .../jscriptyProject/jscriptyProject.attributes.js | 2 +- .../jscriptyProject/jscriptyProject.controller.js | 2 +- .../api/jscriptyProject/jscriptyProject.model.js | 2 +- server/api/jscriptyProject/jscriptyProject.rpc.js | 2 +- server/api/jscriptyQuestionReport/index.js | 2 +- .../jscriptyQuestionReport.attributes.js | 2 +- .../jscriptyQuestionReport.controller.js | 2 +- .../jscriptyQuestionReport.model.js | 2 +- .../jscriptyQuestionReport.rpc.js | 2 +- server/api/jscriptySessionReport/index.js | 2 +- .../jscriptySessionReport.attributes.js | 2 +- .../jscriptySessionReport.controller.js | 2 +- .../jscriptySessionReport.model.js | 2 +- .../jscriptySessionReport.rpc.js | 2 +- server/api/license/index.js | 2 +- server/api/license/license.attributes.js | 2 +- server/api/license/license.controller.js | 2 +- server/api/license/license.model.js | 2 +- server/api/license/license.rpc.js | 2 +- server/api/mailAccount/index.js | 2 +- server/api/mailAccount/mailAccount.attributes.js | 2 +- server/api/mailAccount/mailAccount.controller.js | 2 +- server/api/mailAccount/mailAccount.events.js | 2 +- server/api/mailAccount/mailAccount.model.js | 2 +- server/api/mailAccount/mailAccount.rpc.js | 2 +- server/api/mailAccount/mailAccount.socket.js | 2 +- server/api/mailApplication/index.js | 2 +- .../mailApplication/mailApplication.attributes.js | 2 +- .../mailApplication/mailApplication.controller.js | 2 +- .../api/mailApplication/mailApplication.model.js | 2 +- server/api/mailApplication/mailApplication.rpc.js | 2 +- server/api/mailInteraction/index.js | 2 +- .../mailInteraction/mailInteraction.attributes.js | 2 +- .../mailInteraction/mailInteraction.controller.js | 2 +- .../api/mailInteraction/mailInteraction.events.js | 2 +- .../api/mailInteraction/mailInteraction.model.js | 2 +- server/api/mailInteraction/mailInteraction.rpc.js | 2 +- .../api/mailInteraction/mailInteraction.socket.js | 2 +- server/api/mailMessage/index.js | 2 +- server/api/mailMessage/mailMessage.attributes.js | 2 +- server/api/mailMessage/mailMessage.controller.js | 2 +- server/api/mailMessage/mailMessage.events.js | 2 +- server/api/mailMessage/mailMessage.model.js | 2 +- server/api/mailMessage/mailMessage.rpc.js | 2 +- server/api/mailMessage/mailMessage.socket.js | 2 +- server/api/mailQueue/index.js | 2 +- server/api/mailQueue/mailQueue.attributes.js | 2 +- server/api/mailQueue/mailQueue.controller.js | 2 +- server/api/mailQueue/mailQueue.events.js | 2 +- server/api/mailQueue/mailQueue.model.js | 2 +- server/api/mailQueue/mailQueue.rpc.js | 2 +- server/api/mailQueue/mailQueue.socket.js | 2 +- server/api/mailQueueReport/index.js | 2 +- .../mailQueueReport/mailQueueReport.attributes.js | 2 +- .../mailQueueReport/mailQueueReport.controller.js | 2 +- .../api/mailQueueReport/mailQueueReport.model.js | 2 +- server/api/mailQueueReport/mailQueueReport.rpc.js | 2 +- server/api/mailServerIn/index.js | 2 +- server/api/mailServerIn/mailServerIn.attributes.js | 2 +- server/api/mailServerIn/mailServerIn.model.js | 2 +- server/api/mailServerIn/mailServerIn.rpc.js | 2 +- server/api/mailServerOut/index.js | 2 +- .../api/mailServerOut/mailServerOut.attributes.js | 2 +- .../api/mailServerOut/mailServerOut.controller.js | 2 +- server/api/mailServerOut/mailServerOut.model.js | 2 +- server/api/mailServerOut/mailServerOut.rpc.js | 2 +- server/api/mailSubstatus/index.js | 2 +- .../api/mailSubstatus/mailSubstatus.attributes.js | 2 +- .../api/mailSubstatus/mailSubstatus.controller.js | 2 +- server/api/mailSubstatus/mailSubstatus.model.js | 2 +- server/api/mailSubstatus/mailSubstatus.rpc.js | 2 +- server/api/mailTransferReport/index.js | 2 +- .../mailTransferReport.attributes.js | 2 +- .../mailTransferReport.controller.js | 2 +- .../mailTransferReport/mailTransferReport.model.js | 2 +- .../mailTransferReport/mailTransferReport.rpc.js | 2 +- server/api/memberReport/index.js | 2 +- server/api/memberReport/memberReport.attributes.js | 2 +- server/api/memberReport/memberReport.controller.js | 2 +- server/api/memberReport/memberReport.model.js | 2 +- server/api/memberReport/memberReport.rpc.js | 2 +- server/api/migration/index.js | 2 +- server/api/migration/migration.attributes.js | 2 +- server/api/migration/migration.controller.js | 2 +- server/api/migration/migration.model.js | 2 +- server/api/migration/migration.rpc.js | 2 +- server/api/network/index.js | 2 +- server/api/network/network.attributes.js | 2 +- server/api/network/network.controller.js | 2 +- server/api/network/network.model.js | 2 +- server/api/network/network.rpc.js | 2 +- server/api/openchannelAccount/index.js | 2 +- .../openchannelAccount.attributes.js | 2 +- .../openchannelAccount.controller.js | 2 +- .../openchannelAccount.events.js | 2 +- .../openchannelAccount/openchannelAccount.model.js | 2 +- .../openchannelAccount/openchannelAccount.rpc.js | 2 +- .../openchannelAccount.socket.js | 2 +- server/api/openchannelApplication/index.js | 2 +- .../openchannelApplication.attributes.js | 2 +- .../openchannelApplication.controller.js | 2 +- .../openchannelApplication.model.js | 2 +- .../openchannelApplication.rpc.js | 2 +- server/api/openchannelInteraction/index.js | 2 +- .../openchannelInteraction.attributes.js | 2 +- .../openchannelInteraction.controller.js | 2 +- .../openchannelInteraction.events.js | 2 +- .../openchannelInteraction.model.js | 2 +- .../openchannelInteraction.rpc.js | 2 +- .../openchannelInteraction.socket.js | 2 +- server/api/openchannelMessage/index.js | 2 +- .../openchannelMessage.attributes.js | 2 +- .../openchannelMessage.controller.js | 2 +- .../openchannelMessage.events.js | 2 +- .../openchannelMessage/openchannelMessage.model.js | 2 +- .../openchannelMessage/openchannelMessage.rpc.js | 2 +- .../openchannelMessage.socket.js | 2 +- server/api/openchannelQueue/index.js | 2 +- .../openchannelQueue.attributes.js | 2 +- .../openchannelQueue.controller.js | 2 +- .../openchannelQueue/openchannelQueue.events.js | 2 +- .../api/openchannelQueue/openchannelQueue.model.js | 2 +- .../api/openchannelQueue/openchannelQueue.rpc.js | 2 +- .../openchannelQueue/openchannelQueue.socket.js | 2 +- server/api/openchannelQueueReport/index.js | 2 +- .../openchannelQueueReport.attributes.js | 2 +- .../openchannelQueueReport.controller.js | 2 +- .../openchannelQueueReport.model.js | 2 +- .../openchannelQueueReport.rpc.js | 2 +- server/api/openchannelTransferReport/index.js | 2 +- .../openchannelTransferReport.attributes.js | 2 +- .../openchannelTransferReport.controller.js | 2 +- .../openchannelTransferReport.model.js | 2 +- .../openchannelTransferReport.rpc.js | 2 +- server/api/pause/index.js | 2 +- server/api/pause/pause.attributes.js | 2 +- server/api/pause/pause.controller.js | 2 +- server/api/pause/pause.model.js | 2 +- server/api/pause/pause.rpc.js | 2 +- server/api/plugin/index.js | 2 +- server/api/plugin/plugin.attributes.js | 2 +- server/api/plugin/plugin.controller.js | 2 +- server/api/plugin/plugin.events.js | 2 +- server/api/plugin/plugin.model.js | 2 +- server/api/plugin/plugin.rpc.js | 2 +- server/api/plugin/plugin.socket.js | 2 +- server/api/pm2/index.js | 2 +- server/api/pm2/pm2.controller.js | 2 +- server/api/realtime/index.js | 2 +- server/api/realtime/realtime.controller.js | 2 +- server/api/reportAgentPreview/index.js | 2 +- .../reportAgentPreview.attributes.js | 2 +- .../reportAgentPreview/reportAgentPreview.model.js | 2 +- .../reportAgentPreview/reportAgentPreview.rpc.js | 2 +- server/api/rpc/index.js | 2 +- server/api/rpc/rpc.controller.js | 2 +- server/api/schedule/index.js | 2 +- server/api/schedule/schedule.attributes.js | 2 +- server/api/schedule/schedule.controller.js | 2 +- server/api/schedule/schedule.model.js | 2 +- server/api/schedule/schedule.rpc.js | 2 +- server/api/screenRecording/index.js | 2 +- .../screenRecording/screenRecording.attributes.js | 2 +- .../screenRecording/screenRecording.controller.js | 2 +- .../api/screenRecording/screenRecording.model.js | 2 +- server/api/screenRecording/screenRecording.rpc.js | 2 +- server/api/setting/index.js | 2 +- server/api/setting/setting.attributes.js | 2 +- server/api/setting/setting.controller.js | 2 +- server/api/setting/setting.model.js | 2 +- server/api/setting/setting.rpc.js | 2 +- server/api/smsAccount/index.js | 2 +- server/api/smsAccount/smsAccount.attributes.js | 2 +- server/api/smsAccount/smsAccount.controller.js | 2 +- server/api/smsAccount/smsAccount.events.js | 2 +- server/api/smsAccount/smsAccount.model.js | 2 +- server/api/smsAccount/smsAccount.rpc.js | 2 +- server/api/smsAccount/smsAccount.socket.js | 2 +- server/api/smsApplication/index.js | 2 +- .../smsApplication/smsApplication.attributes.js | 2 +- .../smsApplication/smsApplication.controller.js | 2 +- server/api/smsApplication/smsApplication.model.js | 2 +- server/api/smsApplication/smsApplication.rpc.js | 2 +- server/api/smsInteraction/index.js | 2 +- .../smsInteraction/smsInteraction.attributes.js | 2 +- .../smsInteraction/smsInteraction.controller.js | 2 +- server/api/smsInteraction/smsInteraction.events.js | 2 +- server/api/smsInteraction/smsInteraction.model.js | 2 +- server/api/smsInteraction/smsInteraction.rpc.js | 2 +- server/api/smsInteraction/smsInteraction.socket.js | 2 +- server/api/smsMessage/index.js | 2 +- server/api/smsMessage/smsMessage.attributes.js | 2 +- server/api/smsMessage/smsMessage.controller.js | 2 +- server/api/smsMessage/smsMessage.events.js | 2 +- server/api/smsMessage/smsMessage.model.js | 2 +- server/api/smsMessage/smsMessage.rpc.js | 2 +- server/api/smsMessage/smsMessage.socket.js | 2 +- server/api/smsQueue/index.js | 2 +- server/api/smsQueue/smsQueue.attributes.js | 2 +- server/api/smsQueue/smsQueue.controller.js | 2 +- server/api/smsQueue/smsQueue.events.js | 2 +- server/api/smsQueue/smsQueue.model.js | 2 +- server/api/smsQueue/smsQueue.rpc.js | 2 +- server/api/smsQueue/smsQueue.socket.js | 2 +- server/api/smsQueueReport/index.js | 2 +- .../smsQueueReport/smsQueueReport.attributes.js | 2 +- .../smsQueueReport/smsQueueReport.controller.js | 2 +- server/api/smsQueueReport/smsQueueReport.model.js | 2 +- server/api/smsQueueReport/smsQueueReport.rpc.js | 2 +- server/api/smsTransferReport/index.js | 2 +- .../smsTransferReport.attributes.js | 2 +- .../smsTransferReport.controller.js | 2 +- .../smsTransferReport/smsTransferReport.model.js | 2 +- .../api/smsTransferReport/smsTransferReport.rpc.js | 2 +- server/api/sound/index.js | 2 +- server/api/sound/sound.attributes.js | 2 +- server/api/sound/sound.controller.js | 2 +- server/api/sound/sound.model.js | 2 +- server/api/sound/sound.rpc.js | 2 +- server/api/squareMessage/index.js | 2 +- .../api/squareMessage/squareMessage.attributes.js | 2 +- .../api/squareMessage/squareMessage.controller.js | 2 +- server/api/squareMessage/squareMessage.model.js | 2 +- server/api/squareMessage/squareMessage.rpc.js | 2 +- server/api/squareOdbc/index.js | 2 +- server/api/squareOdbc/squareOdbc.attributes.js | 2 +- server/api/squareOdbc/squareOdbc.controller.js | 2 +- server/api/squareOdbc/squareOdbc.model.js | 2 +- server/api/squareOdbc/squareOdbc.rpc.js | 2 +- server/api/squareProject/index.js | 2 +- .../api/squareProject/squareProject.attributes.js | 2 +- .../api/squareProject/squareProject.controller.js | 2 +- server/api/squareProject/squareProject.events.js | 2 +- server/api/squareProject/squareProject.model.js | 2 +- server/api/squareProject/squareProject.rpc.js | 2 +- server/api/squareProject/squareProject.socket.js | 2 +- server/api/squareRecording/index.js | 2 +- .../squareRecording/squareRecording.attributes.js | 2 +- .../squareRecording/squareRecording.controller.js | 2 +- .../api/squareRecording/squareRecording.model.js | 2 +- server/api/squareRecording/squareRecording.rpc.js | 2 +- server/api/squareReport/index.js | 2 +- server/api/squareReport/squareReport.attributes.js | 2 +- server/api/squareReport/squareReport.controller.js | 2 +- server/api/squareReport/squareReport.model.js | 2 +- server/api/squareReport/squareReport.rpc.js | 2 +- server/api/squareReportDetail/index.js | 2 +- .../squareReportDetail.attributes.js | 2 +- .../squareReportDetail.controller.js | 2 +- .../squareReportDetail/squareReportDetail.model.js | 2 +- .../squareReportDetail/squareReportDetail.rpc.js | 2 +- server/api/system/index.js | 2 +- server/api/system/system.controller.js | 2 +- server/api/tag/index.js | 2 +- server/api/tag/tag.attributes.js | 2 +- server/api/tag/tag.controller.js | 2 +- server/api/tag/tag.model.js | 2 +- server/api/tag/tag.rpc.js | 2 +- server/api/team/index.js | 2 +- server/api/team/team.attributes.js | 2 +- server/api/team/team.controller.js | 2 +- server/api/team/team.events.js | 2 +- server/api/team/team.model.js | 2 +- server/api/team/team.rpc.js | 2 +- server/api/team/team.socket.js | 2 +- .../teamVoicePrefix/teamVoicePrefix.attributes.js | 2 +- .../api/teamVoicePrefix/teamVoicePrefix.model.js | 2 +- server/api/teamVoiceQueue/index.js | 2 +- .../teamVoiceQueue/teamVoiceQueue.attributes.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.model.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.rpc.js | 2 +- server/api/template/index.js | 2 +- server/api/template/template.attributes.js | 2 +- server/api/template/template.controller.js | 2 +- server/api/template/template.model.js | 2 +- server/api/template/template.rpc.js | 2 +- server/api/trigger/index.js | 2 +- server/api/trigger/trigger.attributes.js | 2 +- server/api/trigger/trigger.controller.js | 2 +- server/api/trigger/trigger.model.js | 2 +- server/api/trigger/trigger.rpc.js | 2 +- server/api/trunk/index.js | 2 +- server/api/trunk/trunk.attributes.js | 2 +- server/api/trunk/trunk.controller.js | 2 +- server/api/trunk/trunk.model.js | 2 +- server/api/trunk/trunk.rpc.js | 2 +- server/api/user/index.js | 2 +- server/api/user/user.attributes.js | 2 +- server/api/user/user.controller.js | 2 +- server/api/user/user.events.js | 2 +- server/api/user/user.model.js | 2 +- server/api/user/user.rpc.js | 2 +- server/api/user/user.socket.js | 2 +- server/api/userChatQueue/index.js | 2 +- .../api/userChatQueue/userChatQueue.attributes.js | 2 +- server/api/userChatQueue/userChatQueue.model.js | 2 +- server/api/userChatQueue/userChatQueue.rpc.js | 2 +- server/api/userFaxQueue/index.js | 2 +- server/api/userFaxQueue/userFaxQueue.attributes.js | 2 +- server/api/userFaxQueue/userFaxQueue.model.js | 2 +- server/api/userFaxQueue/userFaxQueue.rpc.js | 2 +- server/api/userMailQueue/index.js | 2 +- .../api/userMailQueue/userMailQueue.attributes.js | 2 +- server/api/userMailQueue/userMailQueue.model.js | 2 +- server/api/userMailQueue/userMailQueue.rpc.js | 2 +- server/api/userNotification/index.js | 2 +- .../userNotification.attributes.js | 2 +- .../userNotification.controller.js | 2 +- .../userNotification/userNotification.events.js | 2 +- .../api/userNotification/userNotification.model.js | 2 +- .../api/userNotification/userNotification.rpc.js | 2 +- .../userNotification/userNotification.socket.js | 2 +- server/api/userOpenchannelQueue/index.js | 2 +- .../userOpenchannelQueue.attributes.js | 2 +- .../userOpenchannelQueue.model.js | 2 +- .../userOpenchannelQueue.rpc.js | 2 +- server/api/userProfile/index.js | 2 +- server/api/userProfile/userProfile.attributes.js | 2 +- server/api/userProfile/userProfile.controller.js | 2 +- server/api/userProfile/userProfile.events.js | 2 +- server/api/userProfile/userProfile.model.js | 2 +- server/api/userProfile/userProfile.rpc.js | 2 +- server/api/userProfile/userProfile.socket.js | 2 +- server/api/userProfileResource/index.js | 2 +- .../userProfileResource.attributes.js | 2 +- .../userProfileResource.controller.js | 2 +- .../userProfileResource.model.js | 2 +- .../userProfileResource/userProfileResource.rpc.js | 2 +- server/api/userProfileSection/index.js | 2 +- .../userProfileSection.attributes.js | 2 +- .../userProfileSection.controller.js | 2 +- .../userProfileSection/userProfileSection.model.js | 2 +- .../userProfileSection/userProfileSection.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- .../userVoicePrefix/userVoicePrefix.attributes.js | 2 +- .../api/userVoicePrefix/userVoicePrefix.model.js | 2 +- server/api/userVoiceQueue/index.js | 2 +- .../userVoiceQueue/userVoiceQueue.attributes.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.model.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.rpc.js | 2 +- server/api/userVoiceQueueRt/index.js | 2 +- .../userVoiceQueueRt.attributes.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.events.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.model.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.rpc.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.socket.js | 2 +- server/api/userWhatsappQueue/index.js | 2 +- .../userWhatsappQueue.attributes.js | 2 +- .../userWhatsappQueue/userWhatsappQueue.model.js | 2 +- .../api/userWhatsappQueue/userWhatsappQueue.rpc.js | 2 +- server/api/variable/index.js | 2 +- server/api/variable/variable.attributes.js | 2 +- server/api/variable/variable.controller.js | 2 +- server/api/variable/variable.model.js | 2 +- server/api/variable/variable.rpc.js | 2 +- server/api/version/index.js | 2 +- server/api/version/version.controller.js | 2 +- server/api/voiceAgentReport/index.js | 2 +- .../voiceAgentReport.attributes.js | 2 +- .../voiceAgentReport.controller.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.model.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.rpc.js | 2 +- server/api/voiceCallReport/index.js | 2 +- .../voiceCallReport/voiceCallReport.attributes.js | 2 +- .../voiceCallReport/voiceCallReport.controller.js | 2 +- .../api/voiceCallReport/voiceCallReport.model.js | 2 +- server/api/voiceCallReport/voiceCallReport.rpc.js | 2 +- server/api/voiceChanSpy/index.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.attributes.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.controller.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.model.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.rpc.js | 2 +- server/api/voiceContext/index.js | 2 +- server/api/voiceContext/voiceContext.attributes.js | 2 +- server/api/voiceContext/voiceContext.controller.js | 2 +- server/api/voiceContext/voiceContext.model.js | 2 +- server/api/voiceContext/voiceContext.rpc.js | 2 +- server/api/voiceDialReport/index.js | 2 +- .../voiceDialReport/voiceDialReport.attributes.js | 2 +- .../voiceDialReport/voiceDialReport.controller.js | 2 +- .../api/voiceDialReport/voiceDialReport.model.js | 2 +- server/api/voiceDialReport/voiceDialReport.rpc.js | 2 +- server/api/voiceExtension/index.js | 2 +- .../voiceExtension/voiceExtension.attributes.js | 2 +- .../voiceExtension/voiceExtension.controller.js | 2 +- server/api/voiceExtension/voiceExtension.events.js | 2 +- server/api/voiceExtension/voiceExtension.model.js | 2 +- server/api/voiceExtension/voiceExtension.rpc.js | 2 +- server/api/voiceExtension/voiceExtension.socket.js | 2 +- server/api/voiceMail/index.js | 2 +- server/api/voiceMail/voiceMail.attributes.js | 2 +- server/api/voiceMail/voiceMail.controller.js | 2 +- server/api/voiceMail/voiceMail.model.js | 2 +- server/api/voiceMail/voiceMail.rpc.js | 2 +- server/api/voiceMailMessage/index.js | 2 +- .../voiceMailMessage.attributes.js | 2 +- .../voiceMailMessage.controller.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.model.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.rpc.js | 2 +- server/api/voiceMusicOnHold/index.js | 2 +- .../voiceMusicOnHold.attributes.js | 2 +- .../voiceMusicOnHold.controller.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.model.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.rpc.js | 2 +- server/api/voicePrefix/index.js | 2 +- server/api/voicePrefix/voicePrefix.attributes.js | 2 +- server/api/voicePrefix/voicePrefix.controller.js | 2 +- server/api/voicePrefix/voicePrefix.events.js | 2 +- server/api/voicePrefix/voicePrefix.model.js | 2 +- server/api/voicePrefix/voicePrefix.rpc.js | 2 +- server/api/voicePrefix/voicePrefix.socket.js | 2 +- server/api/voiceQueue/index.js | 2 +- server/api/voiceQueue/voiceQueue.attributes.js | 2 +- server/api/voiceQueue/voiceQueue.controller.js | 2 +- server/api/voiceQueue/voiceQueue.events.js | 2 +- server/api/voiceQueue/voiceQueue.model.js | 2 +- server/api/voiceQueue/voiceQueue.rpc.js | 2 +- server/api/voiceQueue/voiceQueue.socket.js | 2 +- server/api/voiceQueueReport/index.js | 2 +- .../voiceQueueReport.attributes.js | 2 +- .../voiceQueueReport.controller.js | 2 +- .../voiceQueueReport/voiceQueueReport.events.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.model.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.rpc.js | 2 +- .../voiceQueueReport/voiceQueueReport.socket.js | 2 +- server/api/voiceQueuesLog/index.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.attributes.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.controller.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.model.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.rpc.js | 2 +- server/api/voiceRecording/index.js | 2 +- .../voiceRecording/voiceRecording.attributes.js | 2 +- .../voiceRecording/voiceRecording.controller.js | 2 +- server/api/voiceRecording/voiceRecording.model.js | 2 +- server/api/voiceRecording/voiceRecording.rpc.js | 2 +- server/api/voiceTransferReport/index.js | 2 +- .../voiceTransferReport.attributes.js | 2 +- .../voiceTransferReport.controller.js | 2 +- .../voiceTransferReport.model.js | 2 +- .../voiceTransferReport/voiceTransferReport.rpc.js | 2 +- server/api/webbar/index.js | 2 +- server/api/webbar/webbar.controller.js | 2 +- server/api/whatsappAccount/index.js | 2 +- .../whatsappAccount/whatsappAccount.attributes.js | 2 +- .../whatsappAccount/whatsappAccount.controller.js | 2 +- .../api/whatsappAccount/whatsappAccount.events.js | 2 +- .../api/whatsappAccount/whatsappAccount.model.js | 2 +- server/api/whatsappAccount/whatsappAccount.rpc.js | 2 +- .../api/whatsappAccount/whatsappAccount.socket.js | 2 +- server/api/whatsappApplication/index.js | 2 +- .../whatsappApplication.attributes.js | 2 +- .../whatsappApplication.controller.js | 2 +- .../whatsappApplication.model.js | 2 +- .../whatsappApplication/whatsappApplication.rpc.js | 2 +- server/api/whatsappInteraction/index.js | 2 +- .../whatsappInteraction.attributes.js | 2 +- .../whatsappInteraction.controller.js | 2 +- .../whatsappInteraction.events.js | 2 +- .../whatsappInteraction.model.js | 2 +- .../whatsappInteraction/whatsappInteraction.rpc.js | 2 +- .../whatsappInteraction.socket.js | 2 +- server/api/whatsappMessage/index.js | 2 +- .../whatsappMessage/whatsappMessage.attributes.js | 2 +- .../whatsappMessage/whatsappMessage.controller.js | 2 +- .../api/whatsappMessage/whatsappMessage.events.js | 2 +- .../api/whatsappMessage/whatsappMessage.model.js | 2 +- server/api/whatsappMessage/whatsappMessage.rpc.js | 2 +- .../api/whatsappMessage/whatsappMessage.socket.js | 2 +- server/api/whatsappQueue/index.js | 2 +- .../api/whatsappQueue/whatsappQueue.attributes.js | 2 +- .../api/whatsappQueue/whatsappQueue.controller.js | 2 +- server/api/whatsappQueue/whatsappQueue.events.js | 2 +- server/api/whatsappQueue/whatsappQueue.model.js | 2 +- server/api/whatsappQueue/whatsappQueue.rpc.js | 2 +- server/api/whatsappQueue/whatsappQueue.socket.js | 2 +- server/api/whatsappQueueReport/index.js | 2 +- .../whatsappQueueReport.attributes.js | 2 +- .../whatsappQueueReport.controller.js | 2 +- .../whatsappQueueReport.model.js | 2 +- .../whatsappQueueReport/whatsappQueueReport.rpc.js | 2 +- server/api/whatsappTransferReport/index.js | 2 +- .../whatsappTransferReport.attributes.js | 2 +- .../whatsappTransferReport.controller.js | 2 +- .../whatsappTransferReport.model.js | 2 +- .../whatsappTransferReport.rpc.js | 2 +- server/app.js | 2 +- server/components/auth/service.js | 2 +- server/components/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/integrations/configuration.js | 2 +- server/components/interaction/service.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.js | 2 +- server/config/express.js | 2 +- server/config/license/hardware.js | 2 +- server/config/license/index.js | 2 +- server/config/license/util.js | 2 +- server/config/local.env.js | 2 +- server/config/logger.js | 2 +- server/config/pm2/config.js | 2 +- server/config/pm2/index.js | 2 +- server/config/schedule/chat.js | 2 +- server/config/schedule/index.js | 2 +- server/config/schedule/transcribe.js | 2 +- server/config/schedule/whatsapp.js | 2 +- server/config/seedContact.js | 2 +- server/config/seedUsers.js | 2 +- server/config/socketio.js | 2 +- server/config/triggers/index.js | 2 +- server/config/utils.js | 2 +- server/errors/index.js | 2 +- server/mysqldb/index.js | 2 +- server/routes.js | 2 +- server/rpc/index.js | 2 +- server/services/agi/channel.js | 2 +- server/services/agi/error.js | 2 +- server/services/agi/graph/index.js | 2 +- server/services/agi/index.js | 2 +- server/services/agi/mailRpc/index.js | 2 +- server/services/agi/reply.js | 2 +- server/services/agi/rpc/index.js | 2 +- server/services/agi/scripts/aws/index.js | 2 +- server/services/agi/scripts/aws/lex/index.js | 2 +- server/services/agi/scripts/aws/lex/lib/api.js | 2 +- server/services/agi/scripts/aws/polly/index.js | 2 +- server/services/agi/scripts/aws/polly/lib/api.js | 2 +- server/services/agi/scripts/google/asr/index.js | 2 +- server/services/agi/scripts/google/asr/lib/api.js | 2 +- server/services/agi/scripts/google/index.js | 2 +- server/services/agi/scripts/index.js | 2 +- server/services/agi/scripts/sestek/index.js | 2 +- server/services/agi/scripts/sestek/nda/index.js | 2 +- server/services/agi/scripts/tilde/asr/index.js | 2 +- server/services/agi/scripts/tilde/asr/lib/api.js | 2 +- server/services/agi/scripts/tilde/index.js | 2 +- server/services/agi/server.js | 2 +- server/services/agi/vertices.js | 2 +- server/services/ami/acw/index.js | 2 +- server/services/ami/ami.js | 2 +- server/services/ami/client.js | 2 +- server/services/ami/dialer/action.js | 2 +- server/services/ami/dialer/agentComplete.js | 2 +- server/services/ami/dialer/final.js | 2 +- server/services/ami/dialer/hangup.js | 2 +- server/services/ami/dialer/history.js | 2 +- server/services/ami/dialer/index.js | 2 +- server/services/ami/dialer/queueCallerAbandon.js | 2 +- server/services/ami/fax/action.js | 2 +- server/services/ami/fax/index.js | 2 +- server/services/ami/fax/rpcDb.js | 2 +- server/services/ami/fax/util/gs.js | 2 +- server/services/ami/fax/util/util.js | 2 +- server/services/ami/index.js | 2 +- server/services/ami/model/agent.js | 2 +- server/services/ami/model/campaign.js | 2 +- server/services/ami/model/channel.js | 2 +- server/services/ami/model/deskAccount.js | 2 +- server/services/ami/model/dynamics365Account.js | 2 +- server/services/ami/model/faxAccount.js | 2 +- server/services/ami/model/freshdeskAccount.js | 2 +- server/services/ami/model/freshsalesAccount.js | 2 +- server/services/ami/model/queueReport.js | 2 +- server/services/ami/model/salesforceAccount.js | 2 +- server/services/ami/model/servicenowAccount.js | 2 +- server/services/ami/model/sugarcrmAccount.js | 2 +- server/services/ami/model/telephone.js | 2 +- server/services/ami/model/template.js | 2 +- server/services/ami/model/trigger.js | 2 +- server/services/ami/model/trunk.js | 2 +- server/services/ami/model/voiceExtension.js | 2 +- server/services/ami/model/voiceQueue.js | 2 +- server/services/ami/model/vtigerAccount.js | 2 +- server/services/ami/model/zendeskAccount.js | 2 +- server/services/ami/model/zohoAccount.js | 2 +- server/services/ami/preview/action.js | 2 +- server/services/ami/preview/index.js | 2 +- server/services/ami/preview/rpcDb.js | 2 +- server/services/ami/preview/util/util.js | 2 +- server/services/ami/properties.js | 2 +- server/services/ami/realtime/index.js | 2 +- server/services/ami/report/index.js | 2 +- server/services/ami/report/userReport.js | 2 +- server/services/ami/report/voiceAgentReport.js | 2 +- server/services/ami/report/voiceCallReport.js | 2 +- server/services/ami/report/voiceDialReport.js | 2 +- server/services/ami/report/voiceQueueReport.js | 2 +- server/services/ami/rpc/agentReportPreview.js | 2 +- server/services/ami/rpc/attachment.js | 2 +- server/services/ami/rpc/campaign.js | 2 +- server/services/ami/rpc/cmContact.js | 2 +- server/services/ami/rpc/cmHopper.js | 2 +- server/services/ami/rpc/cmHopperBlack.js | 2 +- server/services/ami/rpc/cmHopperFinal.js | 2 +- server/services/ami/rpc/cmHopperHistory.js | 2 +- server/services/ami/rpc/faxAccount.js | 2 +- server/services/ami/rpc/faxMessage.js | 2 +- server/services/ami/rpc/integrations/desk.js | 2 +- .../services/ami/rpc/integrations/dynamics365.js | 2 +- server/services/ami/rpc/integrations/freshdesk.js | 2 +- server/services/ami/rpc/integrations/freshsales.js | 2 +- server/services/ami/rpc/integrations/salesforce.js | 2 +- server/services/ami/rpc/integrations/servicenow.js | 2 +- server/services/ami/rpc/integrations/sugarcrm.js | 2 +- server/services/ami/rpc/integrations/vtiger.js | 2 +- server/services/ami/rpc/integrations/zendesk.js | 2 +- server/services/ami/rpc/integrations/zoho.js | 2 +- server/services/ami/rpc/memberReport.js | 2 +- server/services/ami/rpc/setting.js | 2 +- server/services/ami/rpc/template.js | 2 +- server/services/ami/rpc/trigger.js | 2 +- server/services/ami/rpc/trunk.js | 2 +- server/services/ami/rpc/user.js | 2 +- server/services/ami/rpc/voiceAgentReport.js | 2 +- server/services/ami/rpc/voiceCallReport.js | 2 +- server/services/ami/rpc/voiceDialReport.js | 2 +- server/services/ami/rpc/voiceExtension.js | 2 +- server/services/ami/rpc/voiceQueue.js | 2 +- server/services/ami/rpc/voiceQueueReport.js | 2 +- server/services/ami/rpc/voiceQueueRt.js | 2 +- server/services/ami/rpc/voiceRecording.js | 2 +- server/services/ami/rpc/voiceTransferReport.js | 2 +- server/services/ami/server/index.js | 2 +- server/services/ami/trigger/cmContact/index.js | 2 +- server/services/ami/trigger/index.js | 2 +- server/services/ami/trigger/integration/desk.js | 2 +- .../ami/trigger/integration/dynamics365.js | 2 +- .../services/ami/trigger/integration/freshdesk.js | 2 +- .../services/ami/trigger/integration/freshsales.js | 2 +- server/services/ami/trigger/integration/index.js | 2 +- .../services/ami/trigger/integration/salesforce.js | 2 +- .../services/ami/trigger/integration/servicenow.js | 2 +- .../services/ami/trigger/integration/sugarcrm.js | 2 +- server/services/ami/trigger/integration/util.js | 2 +- server/services/ami/trigger/integration/vtiger.js | 2 +- server/services/ami/trigger/integration/zendesk.js | 2 +- server/services/ami/trigger/integration/zoho.js | 2 +- server/services/ami/trigger/script/index.js | 2 +- server/services/ami/trigger/urlforward/index.js | 2 +- server/services/email/client.js | 2 +- server/services/email/index.js | 2 +- server/services/email/lib/email.js | 2 +- server/services/email/lib/imap.js | 2 +- server/services/email/lib/smtp.js | 2 +- server/services/email/lib/utils.js | 2 +- server/services/email/model/mailAccount.js | 2 +- server/services/email/realtime/index.js | 2 +- server/services/email/rpc/mailAccount.js | 2 +- server/services/email/rpc/setting.js | 2 +- server/services/email/server/index.js | 2 +- server/services/express/index.js | 2 +- server/services/routing/client.js | 2 +- server/services/routing/index.js | 2 +- server/services/routing/lib/rule-engine.js | 2 +- server/services/routing/mailRpc/index.js | 2 +- server/services/routing/model/agent.js | 2 +- server/services/routing/model/chatQueue.js | 2 +- server/services/routing/model/faxQueue.js | 2 +- server/services/routing/model/interval.js | 2 +- server/services/routing/model/mailQueue.js | 2 +- server/services/routing/model/openchannelQueue.js | 2 +- server/services/routing/model/smsQueue.js | 2 +- server/services/routing/model/whatsappQueue.js | 2 +- server/services/routing/realtime/index.js | 2 +- server/services/routing/rpc/chatInteraction.js | 2 +- server/services/routing/rpc/chatMessage.js | 2 +- server/services/routing/rpc/chatQueue.js | 2 +- server/services/routing/rpc/chatQueueReport.js | 2 +- server/services/routing/rpc/faxInteraction.js | 2 +- server/services/routing/rpc/faxMessage.js | 2 +- server/services/routing/rpc/faxQueue.js | 2 +- server/services/routing/rpc/faxQueueReport.js | 2 +- server/services/routing/rpc/interval.js | 2 +- server/services/routing/rpc/mailInteraction.js | 2 +- server/services/routing/rpc/mailMessage.js | 2 +- server/services/routing/rpc/mailQueue.js | 2 +- server/services/routing/rpc/mailQueueReport.js | 2 +- .../services/routing/rpc/openchannelInteraction.js | 2 +- server/services/routing/rpc/openchannelMessage.js | 2 +- server/services/routing/rpc/openchannelQueue.js | 2 +- .../services/routing/rpc/openchannelQueueReport.js | 2 +- server/services/routing/rpc/smsInteraction.js | 2 +- server/services/routing/rpc/smsMessage.js | 2 +- server/services/routing/rpc/smsQueue.js | 2 +- server/services/routing/rpc/smsQueueReport.js | 2 +- server/services/routing/rpc/user.js | 2 +- server/services/routing/rpc/whatsappInteraction.js | 2 +- server/services/routing/rpc/whatsappMessage.js | 2 +- server/services/routing/rpc/whatsappQueue.js | 2 +- server/services/routing/rpc/whatsappQueueReport.js | 2 +- .../services/routing/server/applications/agent.js | 2 +- .../routing/server/applications/amazonlex.js | 2 +- .../routing/server/applications/autoreply.js | 2 +- .../services/routing/server/applications/close.js | 2 +- .../routing/server/applications/dialogflow.js | 2 +- .../routing/server/applications/dialogflowV2.js | 2 +- .../services/routing/server/applications/gotoif.js | 2 +- .../services/routing/server/applications/gotop.js | 2 +- .../routing/server/applications/message.js | 2 +- .../services/routing/server/applications/noop.js | 2 +- .../services/routing/server/applications/queue.js | 2 +- .../routing/server/applications/strategy/agent.js | 2 +- .../server/applications/strategy/beepall.js | 2 +- .../routing/server/applications/strategy/index.js | 2 +- .../server/applications/strategy/rrmemory.js | 2 +- .../routing/server/applications/strategy/util.js | 2 +- .../services/routing/server/applications/system.js | 2 +- server/services/routing/server/applications/tag.js | 2 +- .../services/routing/server/applications/utils.js | 2 +- server/services/routing/server/index.js | 2 +- server/services/routing/server/interval.js | 2 +- server/services/xdr/agents.controller.js | 2 +- server/services/xdr/calls.controller.js | 2 +- server/services/xdr/core.controller.js | 2 +- server/services/xdr/dials.controller.js | 2 +- server/services/xdr/index.js | 2 +- server/services/xdr/members.controller.js | 2 +- server/services/xdr/queues.controller.js | 2 +- server/services/xdr/recordings.controller.js | 2 +- server/services/xdr/transfers.controller.js | 2 +- server/services/xdr/utils.js | 2 +- 1151 files changed, 1151 insertions(+), 1151 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 442bc53..f426408 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-11-18T10:01:35.597Z", + "time": "2021-11-18T10:19:34.421Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 3f968c2..aef026d 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-18T10:01:35.597Z", + "time": "2021-11-18T10:19:34.421Z", "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 8548018..a6d102c 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 _0x1335=['integration','motionbar','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager'];(function(_0x246c78,_0xf4afb9){var _0x3c24fe=function(_0x413dac){while(--_0x413dac){_0x246c78['push'](_0x246c78['shift']());}};_0x3c24fe(++_0xf4afb9);}(_0x1335,0x19c));var _0x5133=function(_0x26728f,_0x3271c3){_0x26728f=_0x26728f-0x0;var _0x4a7ece=_0x1335[_0x26728f];return _0x4a7ece;};'use strict';var Sequelize=require(_0x5133('0x0'));module[_0x5133('0x1')]={'name':{'type':Sequelize[_0x5133('0x2')],'get':function(_0x558871){return this[_0x5133('0x3')]('action');}},'action':{'type':Sequelize[_0x5133('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x5133('0x5'),_0x5133('0x6'),_0x5133('0x7'),'jscripty',_0x5133('0x8'),_0x5133('0x9'),_0x5133('0xa'),'script']],'msg':_0x5133('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x5133('0x4')](0x1000),'comment':_0x5133('0xc')},'data2':{'type':Sequelize[_0x5133('0x4')](0x1000),'comment':_0x5133('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x5133('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x5133('0xf')},'data5':{'type':Sequelize[_0x5133('0x4')](0x1000),'comments':_0x5133('0x10')},'data6':{'type':Sequelize[_0x5133('0x4')],'comments':_0x5133('0x11')},'data7':{'type':Sequelize['TEXT'],'comments':_0x5133('0x12')}}; \ No newline at end of file +var _0xfd48=['exports','VIRTUAL','getDataValue','action','contactManager','motionbar','jscripty','urlForward','browser','bot','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]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[body]'];(function(_0x4f85c5,_0x517e60){var _0x46fc5b=function(_0x23381a){while(--_0x23381a){_0x4f85c5['push'](_0x4f85c5['shift']());}};_0x46fc5b(++_0x517e60);}(_0xfd48,0x168));var _0x8fd4=function(_0x359684,_0x5b7f9a){_0x359684=_0x359684-0x0;var _0xc0aa53=_0xfd48[_0x359684];return _0xc0aa53;};'use strict';var Sequelize=require('sequelize');module[_0x8fd4('0x0')]={'name':{'type':Sequelize[_0x8fd4('0x1')],'get':function(_0x40a088){return this[_0x8fd4('0x2')](_0x8fd4('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x8fd4('0x4'),'integration',_0x8fd4('0x5'),_0x8fd4('0x6'),_0x8fd4('0x7'),_0x8fd4('0x8'),_0x8fd4('0x9'),'script']],'msg':_0x8fd4('0xa')}},'comment':_0x8fd4('0xa')},'data1':{'type':Sequelize[_0x8fd4('0xb')](0x1000),'comment':_0x8fd4('0xc')},'data2':{'type':Sequelize[_0x8fd4('0xb')](0x1000),'comment':_0x8fd4('0xd')},'data3':{'type':Sequelize[_0x8fd4('0xb')](0x1000),'comment':_0x8fd4('0xe')},'data4':{'type':Sequelize[_0x8fd4('0xb')](0x1000),'comments':_0x8fd4('0xf')},'data5':{'type':Sequelize[_0x8fd4('0xb')](0x1000),'comments':_0x8fd4('0x10')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':_0x8fd4('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index a222c80..043eabb 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 _0xa905=['desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','error','name','send','body','Action','find','catch','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x29ffcd,_0x1c064b){var _0x379fad=function(_0x56d4a0){while(--_0x56d4a0){_0x29ffcd['push'](_0x29ffcd['shift']());}};_0x379fad(++_0x1c064b);}(_0xa905,0x14d));var _0x5a90=function(_0x312fa0,_0x4190bf){_0x312fa0=_0x312fa0-0x0;var _0x53b926=_0xa905[_0x312fa0];return _0x53b926;};'use strict';var emlformat=require(_0x5a90('0x0'));var rimraf=require(_0x5a90('0x1'));var zipdir=require(_0x5a90('0x2'));var jsonpatch=require(_0x5a90('0x3'));var rp=require(_0x5a90('0x4'));var moment=require(_0x5a90('0x5'));var BPromise=require(_0x5a90('0x6'));var Mustache=require('mustache');var util=require(_0x5a90('0x7'));var path=require(_0x5a90('0x8'));var sox=require(_0x5a90('0x9'));var csv=require(_0x5a90('0xa'));var ejs=require(_0x5a90('0xb'));var fs=require('fs');var fs_extra=require(_0x5a90('0xc'));var _=require(_0x5a90('0xd'));var squel=require(_0x5a90('0xe'));var crypto=require(_0x5a90('0xf'));var jsforce=require(_0x5a90('0x10'));var deskjs=require(_0x5a90('0x11'));var toCsv=require(_0x5a90('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5a90('0x12'));var authService=require(_0x5a90('0x13'));var qs=require(_0x5a90('0x14'));var as=require(_0x5a90('0x15'));var hardwareService=require(_0x5a90('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x5a90('0x17'));var config=require(_0x5a90('0x18'));var licenseUtil=require(_0x5a90('0x19'));var db=require(_0x5a90('0x1a'))['db'];function respondWithStatusCode(_0x12937b,_0x4c16c2){_0x4c16c2=_0x4c16c2||0xcc;return function(_0x2e2269){if(_0x2e2269){return _0x12937b[_0x5a90('0x1b')](_0x4c16c2);}return _0x12937b[_0x5a90('0x1c')](_0x4c16c2)[_0x5a90('0x1d')]();};}function respondWithResult(_0x556a2b,_0x3ff6b7){_0x3ff6b7=_0x3ff6b7||0xc8;return function(_0x454353){if(_0x454353){return _0x556a2b[_0x5a90('0x1c')](_0x3ff6b7)[_0x5a90('0x1e')](_0x454353);}};}function respondWithFilteredResult(_0x16940b,_0x35a209){return function(_0x1e1f7d){if(_0x1e1f7d){var _0x2b8833=typeof _0x35a209['offset']===_0x5a90('0x1f')&&typeof _0x35a209[_0x5a90('0x20')]===_0x5a90('0x1f');var _0x510f16=_0x1e1f7d[_0x5a90('0x21')];var _0x2e95e8=_0x2b8833?0x0:_0x35a209[_0x5a90('0x22')];var _0xd87d50=_0x2b8833?_0x1e1f7d[_0x5a90('0x21')]:_0x35a209[_0x5a90('0x22')]+_0x35a209['limit'];var _0x1ef751;if(_0xd87d50>=_0x510f16){_0xd87d50=_0x510f16;_0x1ef751=0xc8;}else{_0x1ef751=0xce;}_0x16940b[_0x5a90('0x1c')](_0x1ef751);return _0x16940b['set'](_0x5a90('0x23'),_0x2e95e8+'-'+_0xd87d50+'/'+_0x510f16)[_0x5a90('0x1e')](_0x1e1f7d);}return null;};}function patchUpdates(_0x38e326){return function(_0x4d981c){try{jsonpatch[_0x5a90('0x24')](_0x4d981c,_0x38e326,!![]);}catch(_0x26156d){return BPromise[_0x5a90('0x25')](_0x26156d);}return _0x4d981c[_0x5a90('0x26')]();};}function saveUpdates(_0x1dc4e4,_0x1c0905){return function(_0x40a721){if(_0x40a721){return _0x40a721[_0x5a90('0x27')](_0x1dc4e4)[_0x5a90('0x28')](function(_0x6791cf){return _0x6791cf;});}return null;};}function removeEntity(_0x26a90e,_0x3a0c92){return function(_0x308a92){if(_0x308a92){return _0x308a92['destroy']()[_0x5a90('0x28')](function(){_0x26a90e[_0x5a90('0x1c')](0xcc)[_0x5a90('0x1d')]();});}};}function handleEntityNotFound(_0x5f0f73,_0x3c2c43){return function(_0x2aee47){if(!_0x2aee47){_0x5f0f73[_0x5a90('0x1b')](0x194);}return _0x2aee47;};}function handleError(_0x3d195c,_0x52d4f1){_0x52d4f1=_0x52d4f1||0x1f4;return function(_0x1095e0){logger[_0x5a90('0x29')](_0x1095e0['stack']);if(_0x1095e0[_0x5a90('0x2a')]){delete _0x1095e0[_0x5a90('0x2a')];}_0x3d195c['status'](_0x52d4f1)[_0x5a90('0x2b')](_0x1095e0);};}exports['update']=function(_0x1d019f,_0xf49347){if(_0x1d019f[_0x5a90('0x2c')]['id']){delete _0x1d019f[_0x5a90('0x2c')]['id'];}return db[_0x5a90('0x2d')][_0x5a90('0x2e')]({'where':{'id':_0x1d019f['params']['id']}})[_0x5a90('0x28')](handleEntityNotFound(_0xf49347,null))[_0x5a90('0x28')](saveUpdates(_0x1d019f['body'],null))[_0x5a90('0x28')](respondWithResult(_0xf49347,null))[_0x5a90('0x2f')](handleError(_0xf49347,null));};exports[_0x5a90('0x30')]=function(_0x38bdc4,_0x4b1cc0){return db[_0x5a90('0x2d')]['find']({'where':{'id':_0x38bdc4[_0x5a90('0x31')]['id']}})['then'](handleEntityNotFound(_0x4b1cc0,null))[_0x5a90('0x28')](removeEntity(_0x4b1cc0,null))['catch'](handleError(_0x4b1cc0,null));}; \ No newline at end of file +var _0xbcdd=['then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xbcdd,0xfb));var _0xdbcd=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0xbcdd[_0x39caaa];return _0x9b9c7d;};'use strict';var emlformat=require(_0xdbcd('0x0'));var rimraf=require(_0xdbcd('0x1'));var zipdir=require(_0xdbcd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbcd('0x3'));var moment=require(_0xdbcd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdbcd('0x5'));var util=require('util');var path=require(_0xdbcd('0x6'));var sox=require(_0xdbcd('0x7'));var csv=require(_0xdbcd('0x8'));var ejs=require(_0xdbcd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdbcd('0xa'));var squel=require(_0xdbcd('0xb'));var crypto=require(_0xdbcd('0xc'));var jsforce=require(_0xdbcd('0xd'));var deskjs=require(_0xdbcd('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbcd('0xf'));var Papa=require(_0xdbcd('0x10'));var Redis=require(_0xdbcd('0x11'));var authService=require(_0xdbcd('0x12'));var qs=require(_0xdbcd('0x13'));var as=require(_0xdbcd('0x14'));var hardwareService=require(_0xdbcd('0x15'));var logger=require('../../config/logger')(_0xdbcd('0x16'));var utils=require(_0xdbcd('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdbcd('0x18'))['db'];function respondWithStatusCode(_0x5de907,_0x401482){_0x401482=_0x401482||0xcc;return function(_0x10d518){if(_0x10d518){return _0x5de907[_0xdbcd('0x19')](_0x401482);}return _0x5de907[_0xdbcd('0x1a')](_0x401482)[_0xdbcd('0x1b')]();};}function respondWithResult(_0xf513c3,_0x42f94a){_0x42f94a=_0x42f94a||0xc8;return function(_0x505f7f){if(_0x505f7f){return _0xf513c3['status'](_0x42f94a)[_0xdbcd('0x1c')](_0x505f7f);}};}function respondWithFilteredResult(_0x3b0154,_0x5b9798){return function(_0x50ec05){if(_0x50ec05){var _0x70330f=typeof _0x5b9798[_0xdbcd('0x1d')]==='undefined'&&typeof _0x5b9798[_0xdbcd('0x1e')]==='undefined';var _0x33ce99=_0x50ec05[_0xdbcd('0x1f')];var _0x19d44c=_0x70330f?0x0:_0x5b9798[_0xdbcd('0x1d')];var _0x5796aa=_0x70330f?_0x50ec05[_0xdbcd('0x1f')]:_0x5b9798[_0xdbcd('0x1d')]+_0x5b9798[_0xdbcd('0x1e')];var _0x4ca59a;if(_0x5796aa>=_0x33ce99){_0x5796aa=_0x33ce99;_0x4ca59a=0xc8;}else{_0x4ca59a=0xce;}_0x3b0154['status'](_0x4ca59a);return _0x3b0154[_0xdbcd('0x20')]('Content-Range',_0x19d44c+'-'+_0x5796aa+'/'+_0x33ce99)['json'](_0x50ec05);}return null;};}function patchUpdates(_0x448e9b){return function(_0x4ee4d5){try{jsonpatch[_0xdbcd('0x21')](_0x4ee4d5,_0x448e9b,!![]);}catch(_0x3592c5){return BPromise[_0xdbcd('0x22')](_0x3592c5);}return _0x4ee4d5[_0xdbcd('0x23')]();};}function saveUpdates(_0x3075a2,_0x58fca4){return function(_0x821135){if(_0x821135){return _0x821135[_0xdbcd('0x24')](_0x3075a2)[_0xdbcd('0x25')](function(_0x2d96fc){return _0x2d96fc;});}return null;};}function removeEntity(_0x26e4e6,_0x165193){return function(_0x4dc132){if(_0x4dc132){return _0x4dc132[_0xdbcd('0x26')]()[_0xdbcd('0x25')](function(){_0x26e4e6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ef5e9,_0x5b6361){return function(_0x42c5ae){if(!_0x42c5ae){_0x3ef5e9[_0xdbcd('0x19')](0x194);}return _0x42c5ae;};}function handleError(_0x134a5,_0xb3ac17){_0xb3ac17=_0xb3ac17||0x1f4;return function(_0x28e18e){logger[_0xdbcd('0x27')](_0x28e18e[_0xdbcd('0x28')]);if(_0x28e18e['name']){delete _0x28e18e[_0xdbcd('0x29')];}_0x134a5[_0xdbcd('0x1a')](_0xb3ac17)[_0xdbcd('0x2a')](_0x28e18e);};}exports[_0xdbcd('0x24')]=function(_0x3cefc3,_0x5c8517){if(_0x3cefc3[_0xdbcd('0x2b')]['id']){delete _0x3cefc3[_0xdbcd('0x2b')]['id'];}return db[_0xdbcd('0x2c')][_0xdbcd('0x2d')]({'where':{'id':_0x3cefc3[_0xdbcd('0x2e')]['id']}})['then'](handleEntityNotFound(_0x5c8517,null))['then'](saveUpdates(_0x3cefc3[_0xdbcd('0x2b')],null))['then'](respondWithResult(_0x5c8517,null))[_0xdbcd('0x2f')](handleError(_0x5c8517,null));};exports[_0xdbcd('0x26')]=function(_0x2c18db,_0x3f046d){return db[_0xdbcd('0x2c')][_0xdbcd('0x2d')]({'where':{'id':_0x2c18db[_0xdbcd('0x2e')]['id']}})['then'](handleEntityNotFound(_0x3f046d,null))[_0xdbcd('0x25')](removeEntity(_0x3f046d,null))[_0xdbcd('0x2f')](handleError(_0x3f046d,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index ea72d86..1a43d18 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 _0xd36f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0xd36f,0x1a4));var _0xfd36=function(_0x30688d,_0x251a4e){_0x30688d=_0x30688d-0x0;var _0x2fb7ca=_0xd36f[_0x30688d];return _0x2fb7ca;};'use strict';var _=require(_0xfd36('0x0'));var util=require(_0xfd36('0x1'));var logger=require(_0xfd36('0x2'))(_0xfd36('0x3'));var moment=require(_0xfd36('0x4'));var BPromise=require(_0xfd36('0x5'));var rp=require(_0xfd36('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd36('0x7'));var config=require(_0xfd36('0x8'));var attributes=require(_0xfd36('0x9'));module[_0xfd36('0xa')]=function(_0x4e67e7,_0x1abaa8){return _0x4e67e7[_0xfd36('0xb')](_0xfd36('0xc'),attributes,{'tableName':_0xfd36('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11e9=['request-promise','path','exports','Action','util','api','bluebird'];(function(_0x4c2f17,_0x5c6821){var _0x20919e=function(_0x31eef7){while(--_0x31eef7){_0x4c2f17['push'](_0x4c2f17['shift']());}};_0x20919e(++_0x5c6821);}(_0x11e9,0x169));var _0x911e=function(_0x40752a,_0x28de97){_0x40752a=_0x40752a-0x0;var _0x28fc25=_0x11e9[_0x40752a];return _0x28fc25;};'use strict';var _=require('lodash');var util=require(_0x911e('0x0'));var logger=require('../../config/logger')(_0x911e('0x1'));var moment=require('moment');var BPromise=require(_0x911e('0x2'));var rp=require(_0x911e('0x3'));var fs=require('fs');var path=require(_0x911e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0x911e('0x5')]=function(_0x47feaa,_0x1f73e8){return _0x47feaa['define'](_0x911e('0x6'),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 f7629b8..dc26815 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x33335e,_0x188610){var _0x52a0ba=function(_0x14bcf2){while(--_0x14bcf2){_0x33335e['push'](_0x33335e['shift']());}};_0x52a0ba(++_0x188610);}(_0xabce,0x103));var _0xeabc=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xabce[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +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(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x1cb9,0x14e));var _0x91cb=function(_0x23e23a,_0x95e35f){_0x23e23a=_0x23e23a-0x0;var _0x57b50c=_0x1cb9[_0x23e23a];return _0x57b50c;};'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 7ffda87..8fa7c48 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 _0x237c=['/:id','isAuthenticated','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','./action.controller','put'];(function(_0x1bfd43,_0x2b9d99){var _0x13fbc9=function(_0xb3fda){while(--_0xb3fda){_0x1bfd43['push'](_0x1bfd43['shift']());}};_0x13fbc9(++_0x2b9d99);}(_0x237c,0x94));var _0xc237=function(_0x48d2ea,_0x158ac3){_0x48d2ea=_0x48d2ea-0x0;var _0x18a8d5=_0x237c[_0x48d2ea];return _0x18a8d5;};'use strict';var multer=require(_0xc237('0x0'));var util=require('util');var path=require(_0xc237('0x1'));var timeout=require('connect-timeout');var express=require(_0xc237('0x2'));var router=express[_0xc237('0x3')]();var fs_extra=require(_0xc237('0x4'));var auth=require(_0xc237('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc237('0x6'));router[_0xc237('0x7')](_0xc237('0x8'),auth[_0xc237('0x9')](),controller[_0xc237('0xa')]);router[_0xc237('0xb')](_0xc237('0x8'),auth[_0xc237('0x9')](),controller[_0xc237('0xc')]);module['exports']=router; \ No newline at end of file +var _0x4e64=['../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3afa67,_0x3dc4a8){var _0x32d1da=function(_0x5943b2){while(--_0x5943b2){_0x3afa67['push'](_0x3afa67['shift']());}};_0x32d1da(++_0x3dc4a8);}(_0x4e64,0x12b));var _0x44e6=function(_0x55e2f4,_0x715c55){_0x55e2f4=_0x55e2f4-0x0;var _0x53e0f3=_0x4e64[_0x55e2f4];return _0x53e0f3;};'use strict';var multer=require(_0x44e6('0x0'));var util=require(_0x44e6('0x1'));var path=require(_0x44e6('0x2'));var timeout=require(_0x44e6('0x3'));var express=require(_0x44e6('0x4'));var router=express[_0x44e6('0x5')]();var fs_extra=require(_0x44e6('0x6'));var auth=require(_0x44e6('0x7'));var interaction=require(_0x44e6('0x8'));var config=require(_0x44e6('0x9'));var controller=require(_0x44e6('0xa'));router[_0x44e6('0xb')](_0x44e6('0xc'),auth[_0x44e6('0xd')](),controller[_0x44e6('0xe')]);router[_0x44e6('0xf')](_0x44e6('0xc'),auth[_0x44e6('0xd')](),controller['destroy']);module[_0x44e6('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 33dcc87..d9855a9 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 _0x5496=['TEXT','sequelize','exports','STRING'];(function(_0x25f895,_0x2539da){var _0x4fcfe2=function(_0x1ce114){while(--_0x1ce114){_0x25f895['push'](_0x25f895['shift']());}};_0x4fcfe2(++_0x2539da);}(_0x5496,0x175));var _0x6549=function(_0x590228,_0xb6c815){_0x590228=_0x590228-0x0;var _0x5bef73=_0x5496[_0x590228];return _0x5bef73;};'use strict';var Sequelize=require(_0x6549('0x0'));module[_0x6549('0x1')]={'name':{'type':Sequelize[_0x6549('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6549('0x2')]},'parent':{'type':Sequelize[_0x6549('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x6549('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5d58=['TEXT','STRING'];(function(_0x19d896,_0x78d074){var _0x538e49=function(_0x5449c6){while(--_0x5449c6){_0x19d896['push'](_0x19d896['shift']());}};_0x538e49(++_0x78d074);}(_0x5d58,0x187));var _0x85d5=function(_0x11cda2,_0x2124e5){_0x11cda2=_0x11cda2-0x0;var _0x4dfd78=_0x5d58[_0x11cda2];return _0x4dfd78;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x85d5('0x0')]},'conditions':{'type':Sequelize[_0x85d5('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 2e307b5..cf782f2 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 _0x7905=['COUNT(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','metric','function','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','select','from','MetricId','groupBy','table','fullPath','%s-%s.%s','randomstring','generate','output','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','MIN(%s)','AVG(%s)','SEC_TO_TIME(%s)','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','json','offset','undefined','limit','set','reject','save','destroy','then','get','CustomReports','UserProfileResource','error','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','AnalyticCustomReport','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join'];(function(_0x47fd57,_0x49920a){var _0x2af1fb=function(_0xc834ba){while(--_0xc834ba){_0x47fd57['push'](_0x47fd57['shift']());}};_0x2af1fb(++_0x49920a);}(_0x7905,0xf1));var _0x5790=function(_0x10ddbf,_0x553f5d){_0x10ddbf=_0x10ddbf-0x0;var _0x1fd81e=_0x7905[_0x10ddbf];return _0x1fd81e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5790('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5790('0x1'));var rp=require(_0x5790('0x2'));var moment=require(_0x5790('0x3'));var BPromise=require(_0x5790('0x4'));var Mustache=require(_0x5790('0x5'));var util=require(_0x5790('0x6'));var path=require(_0x5790('0x7'));var sox=require('sox');var csv=require(_0x5790('0x8'));var ejs=require(_0x5790('0x9'));var fs=require('fs');var fs_extra=require(_0x5790('0xa'));var _=require(_0x5790('0xb'));var squel=require(_0x5790('0xc'));var crypto=require(_0x5790('0xd'));var jsforce=require(_0x5790('0xe'));var deskjs=require(_0x5790('0xf'));var toCsv=require(_0x5790('0x8'));var querystring=require(_0x5790('0x10'));var Papa=require(_0x5790('0x11'));var Redis=require('ioredis');var authService=require(_0x5790('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5790('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5790('0x14'));var config=require(_0x5790('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5790('0x16'))['db'];var dbH=require('../../mysqldb')[_0x5790('0x17')];function respondWithStatusCode(_0x1782c7,_0x51aca8){_0x51aca8=_0x51aca8||0xcc;return function(_0xa605c6){if(_0xa605c6){return _0x1782c7[_0x5790('0x18')](_0x51aca8);}return _0x1782c7['status'](_0x51aca8)[_0x5790('0x19')]();};}function respondWithResult(_0x37dc51,_0x3178ab){_0x3178ab=_0x3178ab||0xc8;return function(_0x3f832b){if(_0x3f832b){return _0x37dc51[_0x5790('0x1a')](_0x3178ab)[_0x5790('0x1b')](_0x3f832b);}};}function respondWithFilteredResult(_0x46d1ca,_0x28776c){return function(_0xb43e24){if(_0xb43e24){var _0x4cfcc9=typeof _0x28776c[_0x5790('0x1c')]===_0x5790('0x1d')&&typeof _0x28776c[_0x5790('0x1e')]===_0x5790('0x1d');var _0x41f35d=_0xb43e24['count'];var _0x2c31c9=_0x4cfcc9?0x0:_0x28776c[_0x5790('0x1c')];var _0x2e1353=_0x4cfcc9?_0xb43e24['count']:_0x28776c[_0x5790('0x1c')]+_0x28776c[_0x5790('0x1e')];var _0xac6ff;if(_0x2e1353>=_0x41f35d){_0x2e1353=_0x41f35d;_0xac6ff=0xc8;}else{_0xac6ff=0xce;}_0x46d1ca[_0x5790('0x1a')](_0xac6ff);return _0x46d1ca[_0x5790('0x1f')]('Content-Range',_0x2c31c9+'-'+_0x2e1353+'/'+_0x41f35d)['json'](_0xb43e24);}return null;};}function patchUpdates(_0x1d509c){return function(_0x324f4e){try{jsonpatch['apply'](_0x324f4e,_0x1d509c,!![]);}catch(_0x2904a8){return BPromise[_0x5790('0x20')](_0x2904a8);}return _0x324f4e[_0x5790('0x21')]();};}function saveUpdates(_0xc057d2,_0x54325c){return function(_0x29d1be){if(_0x29d1be){return _0x29d1be['update'](_0xc057d2)['then'](function(_0x910b00){return _0x910b00;});}return null;};}function removeEntity(_0x17735e,_0x5053cc){return function(_0x3b1160){if(_0x3b1160){return _0x3b1160[_0x5790('0x22')]()[_0x5790('0x23')](function(){var _0x58fc69=_0x3b1160[_0x5790('0x24')]({'plain':!![]});var _0x1d19bb=_0x5790('0x25');return db[_0x5790('0x26')][_0x5790('0x22')]({'where':{'type':_0x1d19bb,'resourceId':_0x58fc69['id']}})[_0x5790('0x23')](function(){return _0x3b1160;});})[_0x5790('0x23')](function(){_0x17735e[_0x5790('0x1a')](0xcc)[_0x5790('0x19')]();});}};}function handleEntityNotFound(_0x342524,_0x6a3f48){return function(_0x3e1bc1){if(!_0x3e1bc1){_0x342524[_0x5790('0x18')](0x194);}return _0x3e1bc1;};}function handleError(_0x1f2edd,_0x54000d){_0x54000d=_0x54000d||0x1f4;return function(_0x31dcf1){logger[_0x5790('0x27')](_0x31dcf1['stack']);if(_0x31dcf1[_0x5790('0x28')]){delete _0x31dcf1[_0x5790('0x28')];}_0x1f2edd['status'](_0x54000d)['send'](_0x31dcf1);};}exports[_0x5790('0x29')]=function(_0x2dbdfa,_0x38748){var _0x4be8f4={},_0x456a87={},_0x5113b6={'count':0x0,'rows':[]};var _0x4d6293=_[_0x5790('0x2a')](db['AnalyticCustomReport']['rawAttributes'],function(_0x310512){return{'name':_0x310512[_0x5790('0x2b')],'type':_0x310512[_0x5790('0x2c')][_0x5790('0x2d')]};});_0x456a87[_0x5790('0x2e')]=_['map'](_0x4d6293,_0x5790('0x28'));_0x456a87[_0x5790('0x2f')]=_['keys'](_0x2dbdfa['query']);_0x456a87[_0x5790('0x30')]=_[_0x5790('0x31')](_0x456a87[_0x5790('0x2e')],_0x456a87[_0x5790('0x2f')]);_0x4be8f4[_0x5790('0x32')]=_['intersection'](_0x456a87[_0x5790('0x2e')],qs[_0x5790('0x33')](_0x2dbdfa[_0x5790('0x2f')][_0x5790('0x33')]));_0x4be8f4[_0x5790('0x32')]=_0x4be8f4[_0x5790('0x32')][_0x5790('0x34')]?_0x4be8f4[_0x5790('0x32')]:_0x456a87['model'];if(!_0x2dbdfa[_0x5790('0x2f')][_0x5790('0x35')](_0x5790('0x36'))){_0x4be8f4[_0x5790('0x1e')]=qs['limit'](_0x2dbdfa[_0x5790('0x2f')][_0x5790('0x1e')]);_0x4be8f4[_0x5790('0x1c')]=qs['offset'](_0x2dbdfa['query'][_0x5790('0x1c')]);}_0x4be8f4[_0x5790('0x37')]=qs[_0x5790('0x38')](_0x2dbdfa[_0x5790('0x2f')][_0x5790('0x38')]);_0x4be8f4[_0x5790('0x39')]=qs[_0x5790('0x30')](_[_0x5790('0x3a')](_0x2dbdfa[_0x5790('0x2f')],_0x456a87[_0x5790('0x30')]),_0x4d6293);if(_0x2dbdfa[_0x5790('0x2f')][_0x5790('0x3b')]){_0x4be8f4[_0x5790('0x39')]=_['merge'](_0x4be8f4[_0x5790('0x39')],{'$or':_['map'](_0x4d6293,function(_0x399318){if(_0x399318[_0x5790('0x2c')]!==_0x5790('0x3c')){var _0x35c422={};_0x35c422[_0x399318[_0x5790('0x28')]]={'$like':'%'+_0x2dbdfa['query']['filter']+'%'};return _0x35c422;}})});}_0x4be8f4=_[_0x5790('0x3d')]({},_0x4be8f4,_0x2dbdfa['options']);var _0x4d6092={'where':_0x4be8f4[_0x5790('0x39')]};return db['AnalyticCustomReport']['count'](_0x4d6092)[_0x5790('0x23')](function(_0x1d4a02){_0x5113b6[_0x5790('0x3e')]=_0x1d4a02;if(_0x2dbdfa[_0x5790('0x2f')][_0x5790('0x3f')]){_0x4be8f4[_0x5790('0x40')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x5790('0x41')](_0x4be8f4);})['then'](function(_0x5a2298){_0x5113b6[_0x5790('0x42')]=_0x5a2298;return _0x5113b6;})[_0x5790('0x23')](respondWithFilteredResult(_0x38748,_0x4be8f4))[_0x5790('0x43')](handleError(_0x38748,null));};exports[_0x5790('0x44')]=function(_0x20e7f6,_0x17cf16){var _0x570507={'raw':![],'where':{'id':_0x20e7f6[_0x5790('0x45')]['id']}},_0xaff9f9={};_0xaff9f9['model']=_[_0x5790('0x46')](db[_0x5790('0x47')]['rawAttributes']);_0xaff9f9['query']=_['keys'](_0x20e7f6['query']);_0xaff9f9[_0x5790('0x30')]=_[_0x5790('0x31')](_0xaff9f9['model'],_0xaff9f9[_0x5790('0x2f')]);_0x570507[_0x5790('0x32')]=_['intersection'](_0xaff9f9[_0x5790('0x2e')],qs[_0x5790('0x33')](_0x20e7f6[_0x5790('0x2f')][_0x5790('0x33')]));_0x570507[_0x5790('0x32')]=_0x570507['attributes'][_0x5790('0x34')]?_0x570507[_0x5790('0x32')]:_0xaff9f9[_0x5790('0x2e')];if(_0x20e7f6['query'][_0x5790('0x3f')]){_0x570507[_0x5790('0x40')]=[{'all':!![]}];}_0x570507=_[_0x5790('0x3d')]({},_0x570507,_0x20e7f6[_0x5790('0x48')]);return db['AnalyticCustomReport']['find'](_0x570507)[_0x5790('0x23')](handleEntityNotFound(_0x17cf16,null))[_0x5790('0x23')](respondWithResult(_0x17cf16,null))[_0x5790('0x43')](handleError(_0x17cf16,null));};exports['create']=function(_0x2f6f46,_0x34e612){return db[_0x5790('0x47')][_0x5790('0x49')](_0x2f6f46[_0x5790('0x4a')],{})[_0x5790('0x23')](function(_0x21ec98){var _0x42466b=_0x2f6f46[_0x5790('0x4b')][_0x5790('0x24')]({'plain':!![]});if(!_0x42466b)throw new Error(_0x5790('0x4c'));if(_0x42466b[_0x5790('0x4d')]===_0x5790('0x4b')){var _0x239590=_0x21ec98[_0x5790('0x24')]({'plain':!![]});var _0x4e8142='Reports';return db[_0x5790('0x4e')][_0x5790('0x4f')]({'where':{'name':_0x4e8142,'userProfileId':_0x42466b[_0x5790('0x50')]},'raw':!![]})[_0x5790('0x23')](function(_0x1ad59d){if(_0x1ad59d&&_0x1ad59d[_0x5790('0x51')]===0x0){return db[_0x5790('0x26')][_0x5790('0x49')]({'name':_0x239590['name'],'resourceId':_0x239590['id'],'type':_0x5790('0x25'),'sectionId':_0x1ad59d['id']},{})[_0x5790('0x23')](function(){return _0x21ec98;});}else{return _0x21ec98;}})[_0x5790('0x43')](function(_0x27d45d){logger[_0x5790('0x27')](_0x5790('0x52'),_0x27d45d);throw _0x27d45d;});}return _0x21ec98;})[_0x5790('0x23')](respondWithResult(_0x34e612,0xc9))['catch'](handleError(_0x34e612,null));};exports['update']=function(_0x47db98,_0x5b2389){if(_0x47db98[_0x5790('0x4a')]['id']){delete _0x47db98[_0x5790('0x4a')]['id'];}return db[_0x5790('0x47')]['find']({'where':{'id':_0x47db98[_0x5790('0x45')]['id']}})[_0x5790('0x23')](handleEntityNotFound(_0x5b2389,null))[_0x5790('0x23')](saveUpdates(_0x47db98[_0x5790('0x4a')],null))[_0x5790('0x23')](respondWithResult(_0x5b2389,null))[_0x5790('0x43')](handleError(_0x5b2389,null));};exports[_0x5790('0x22')]=function(_0x4d9aa8,_0x4ccf81){return db[_0x5790('0x47')][_0x5790('0x4f')]({'where':{'id':_0x4d9aa8[_0x5790('0x45')]['id']}})[_0x5790('0x23')](handleEntityNotFound(_0x4ccf81,null))[_0x5790('0x23')](removeEntity(_0x4ccf81,null))[_0x5790('0x43')](handleError(_0x4ccf81,null));};exports['preview']=function(_0x23a7b3,_0x212fdc){var _0x2d9fc5=0xa;var _0x497bd4=[_0x5790('0x53'),_0x5790('0x54'),_0x5790('0x55'),_0x5790('0x56')];var _0x54d3e1={'SUM':'SUM(%s)','COUNT':_0x5790('0x57'),'COUNT DISTINCT':_0x5790('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5790('0x59'),'GROUP_CONCAT ASC':_0x5790('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1f4575={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5790('0x5b'),'HOUR':_0x5790('0x5c'),'ROUND':_0x5790('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1259d6=function(_0x1a5772){return!_[_0x5790('0x5e')]([_0x5790('0x5f'),_0x5790('0x60'),_0x5790('0x61'),_0x5790('0x62')],_0x1a5772);};var _0x545016=function(_0x4a1d7d){if(!_0x4a1d7d||!_0x4a1d7d[_0x5790('0x63')][_0x5790('0x34')]){return'';}for(var _0xe1880f='(',_0x3f2979=0x0;_0x3f2979<_0x4a1d7d[_0x5790('0x63')]['length'];_0x3f2979+=0x1){_0x3f2979>0x0&&(_0xe1880f+='\x20'+_0x4a1d7d[_0x5790('0x64')]+'\x20');_0xe1880f+=_0x4a1d7d[_0x5790('0x63')][_0x3f2979][_0x5790('0x65')]?_0x545016(_0x4a1d7d[_0x5790('0x63')][_0x3f2979][_0x5790('0x65')]):_0x4a1d7d[_0x5790('0x63')][_0x3f2979][_0x5790('0x66')]+'\x20'+_0x4a1d7d[_0x5790('0x63')][_0x3f2979]['condition']+(_0x1259d6(_0x4a1d7d[_0x5790('0x63')][_0x3f2979][_0x5790('0x67')])?'\x20'+_0x4a1d7d[_0x5790('0x63')][_0x3f2979][_0x5790('0x68')]:'');}return _0xe1880f+')';};var _0x1f3d31={'where':{'id':_0x23a7b3[_0x5790('0x45')]['id']}},_0x421864,_0xc83fe4,_0x291f17,_0x3125af,_0x331c0f;_0x1f3d31=_[_0x5790('0x3d')]({},_0x1f3d31,_0x23a7b3[_0x5790('0x48')]);return db[_0x5790('0x47')][_0x5790('0x4f')](_0x1f3d31)[_0x5790('0x23')](function(_0x26db28){if(_0x26db28){_0x421864=_0x26db28;return _0x26db28[_0x5790('0x69')]();}return null;})[_0x5790('0x23')](function(_0x4559be){if(_0x4559be){if(!_0x4559be['length']){throw new db[(_0x5790('0x6a'))][(_0x5790('0x6b'))](_0x5790('0x6c'),0x193);}_0xc83fe4=_0x4559be;return db[_0x5790('0x6d')][_0x5790('0x41')]({'raw':!![]});}return null;})[_0x5790('0x23')](function(_0x322e24){if(_0x322e24){_0x291f17=_[_0x5790('0x6e')](_0x322e24,'id');var _0x4ba58d;var _0x784ee9=squel['select']();_0x784ee9['from'](_0x421864['table']);for(var _0x417e31=0x0;_0x417e31<_0xc83fe4[_0x5790('0x34')];_0x417e31+=0x1){_0x4ba58d=_0xc83fe4[_0x417e31]['MetricId']?_0x291f17[_0xc83fe4[_0x417e31]['MetricId']][_0x5790('0x6f')]:_0xc83fe4[_0x417e31][_0x5790('0x66')];_0x4ba58d=_0xc83fe4[_0x417e31][_0x5790('0x70')]?_[_0x5790('0x71')](_0x54d3e1[_0xc83fe4[_0x417e31][_0x5790('0x70')]],'%s',_0x4ba58d):_0x4ba58d;_0x4ba58d=_0xc83fe4[_0x417e31][_0x5790('0x72')]?_[_0x5790('0x71')](_0x1f4575[_0xc83fe4[_0x417e31][_0x5790('0x72')]],'%s',_0x4ba58d):_0x4ba58d;if(_0xc83fe4[_0x417e31]['groupBy']){_0x784ee9[_0x5790('0x65')](_0x4ba58d);}_0xc83fe4[_0x417e31][_0x5790('0x73')]&&_0x784ee9[_0x5790('0x37')](_0x4ba58d,_0xc83fe4[_0x417e31][_0x5790('0x73')]===_0x5790('0x74')?![]:!![]);_0x784ee9[_0x5790('0x66')](_0x4ba58d,_0xc83fe4[_0x417e31][_0x5790('0x75')]||_0x4ba58d);}if(_0x421864[_0x5790('0x76')]){_0x421864['joins']=JSON[_0x5790('0x77')](_0x421864[_0x5790('0x76')]);for(var _0x8d7acb=0x0;_0x8d7acb<_0x421864[_0x5790('0x76')][_0x5790('0x34')];_0x8d7acb+=0x1){if(_0x421864['joins'][_0x8d7acb][_0x5790('0x2c')]&&_['includes'](_0x497bd4,_0x421864[_0x5790('0x76')][_0x8d7acb][_0x5790('0x2c')])&&_0x421864[_0x5790('0x76')][_0x8d7acb][_0x5790('0x78')]&&_0x421864[_0x5790('0x76')][_0x8d7acb][_0x5790('0x79')]&&_0x421864[_0x5790('0x76')][_0x8d7acb][_0x5790('0x7a')]){_0x784ee9[_0x421864[_0x5790('0x76')][_0x8d7acb]['type']](_0x421864[_0x5790('0x76')][_0x8d7acb][_0x5790('0x79')],null,util['format'](_0x5790('0x7b'),_0x421864['table'],_0x421864[_0x5790('0x76')][_0x8d7acb][_0x5790('0x78')],_0x421864[_0x5790('0x76')][_0x8d7acb][_0x5790('0x79')],_0x421864[_0x5790('0x76')][_0x8d7acb]['foreignKey']));}}}if(_0x421864[_0x5790('0x7c')]){_0x421864[_0x5790('0x7c')]=JSON[_0x5790('0x77')](_0x421864[_0x5790('0x7c')]);_0x784ee9[_0x5790('0x39')](_0x545016(_0x421864[_0x5790('0x7c')][_0x5790('0x65')]));}_0x331c0f=_0x784ee9[_0x5790('0x7d')]();_0x784ee9[_0x5790('0x1e')](_0x2d9fc5);_0x784ee9[_0x5790('0x1c')](0x0);logger[_0x5790('0x7e')](_0x5790('0x7f'),_0x784ee9[_0x5790('0x80')]());return dbH[_0x5790('0x81')]['query'](_0x784ee9['toString'](),{'type':dbH[_0x5790('0x81')][_0x5790('0x82')][_0x5790('0x83')]});}})[_0x5790('0x23')](respondWithResult(_0x212fdc,null))[_0x5790('0x43')](handleError(_0x212fdc,null));};function runReport(_0x535c7e,_0x47cfb9,_0x5443a5){var _0x284252=_0x47cfb9[_0x5790('0x28')];var _0x3cfdb1=0xa;var _0x28a35d=['join',_0x5790('0x54'),'right_join','cross_join'];var _0x3fb581={'SUM':_0x5790('0x84'),'COUNT':_0x5790('0x57'),'COUNT DISTINCT':_0x5790('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5790('0x59'),'GROUP_CONCAT ASC':_0x5790('0x5a'),'GROUP_CONCAT DESC':_0x5790('0x85')};var _0x4c8d21={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5790('0x5b'),'HOUR':_0x5790('0x5c'),'ROUND':_0x5790('0x5d'),'UNIX_TIMESTAMP':_0x5790('0x86')};var _0x17295e=function(_0x29662f){return!_['includes']([_0x5790('0x5f'),_0x5790('0x60'),_0x5790('0x61'),'IS\x20NOT\x20EMPTY'],_0x29662f);};var _0x41d848=function(_0x36ce7b){if(!_0x36ce7b||!_0x36ce7b['rules'][_0x5790('0x34')]){return'';}for(var _0x31d9c5='(',_0x553caa=0x0;_0x553caa<_0x36ce7b['rules'][_0x5790('0x34')];_0x553caa+=0x1){_0x553caa>0x0&&(_0x31d9c5+='\x20'+_0x36ce7b[_0x5790('0x64')]+'\x20');_0x31d9c5+=_0x36ce7b[_0x5790('0x63')][_0x553caa]['group']?_0x41d848(_0x36ce7b[_0x5790('0x63')][_0x553caa][_0x5790('0x65')]):_0x36ce7b[_0x5790('0x63')][_0x553caa]['field']+'\x20'+_0x36ce7b[_0x5790('0x63')][_0x553caa][_0x5790('0x67')]+(_0x17295e(_0x36ce7b['rules'][_0x553caa]['condition'])?'\x20'+_0x36ce7b[_0x5790('0x63')][_0x553caa][_0x5790('0x68')]:'');}return _0x31d9c5+')';};var _0x38fa3c={'where':{'id':_0x535c7e['id']}},_0x5dd16c,_0x1c5069,_0x5bb5e4,_0xdce048,_0x31c096;_0x38fa3c=_[_0x5790('0x3d')]({},_0x38fa3c,_0x5443a5);return db['AnalyticCustomReport'][_0x5790('0x4f')](_0x38fa3c)[_0x5790('0x23')](function(_0x2bcee7){if(_0x2bcee7){_0x5dd16c=_0x2bcee7;return _0x2bcee7['getFields']();}return null;})[_0x5790('0x23')](function(_0x55bad7){if(_0x55bad7){if(!_0x55bad7[_0x5790('0x34')]){throw new db[(_0x5790('0x6a'))][(_0x5790('0x6b'))](_0x5790('0x6c'),0x193);}_0x1c5069=_0x55bad7;return db[_0x5790('0x6d')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x271ef3){if(_0x271ef3){_0x5bb5e4=_[_0x5790('0x6e')](_0x271ef3,'id');var _0x3ba158;var _0x170a26=squel[_0x5790('0x87')]();_0x170a26[_0x5790('0x88')](_0x5dd16c['table']);for(var _0xa070c8=0x0;_0xa070c8<_0x1c5069[_0x5790('0x34')];_0xa070c8+=0x1){_0x3ba158=_0x1c5069[_0xa070c8][_0x5790('0x89')]?_0x5bb5e4[_0x1c5069[_0xa070c8]['MetricId']][_0x5790('0x6f')]:_0x1c5069[_0xa070c8][_0x5790('0x66')];_0x3ba158=_0x1c5069[_0xa070c8]['function']?_[_0x5790('0x71')](_0x3fb581[_0x1c5069[_0xa070c8][_0x5790('0x70')]],'%s',_0x3ba158):_0x3ba158;_0x3ba158=_0x1c5069[_0xa070c8][_0x5790('0x72')]?_['replace'](_0x4c8d21[_0x1c5069[_0xa070c8][_0x5790('0x72')]],'%s',_0x3ba158):_0x3ba158;if(_0x1c5069[_0xa070c8][_0x5790('0x8a')]){_0x170a26['group'](_0x3ba158);}_0x1c5069[_0xa070c8][_0x5790('0x73')]&&_0x170a26[_0x5790('0x37')](_0x3ba158,_0x1c5069[_0xa070c8][_0x5790('0x73')]===_0x5790('0x74')?![]:!![]);_0x170a26[_0x5790('0x66')](_0x3ba158,_0x1c5069[_0xa070c8][_0x5790('0x75')]||_0x3ba158);}if(_0x5dd16c[_0x5790('0x76')]){_0x5dd16c[_0x5790('0x76')]=JSON[_0x5790('0x77')](_0x5dd16c[_0x5790('0x76')]);for(var _0xb7ffd7=0x0;_0xb7ffd7<_0x5dd16c['joins'][_0x5790('0x34')];_0xb7ffd7+=0x1){if(_0x5dd16c[_0x5790('0x76')][_0xb7ffd7][_0x5790('0x2c')]&&_[_0x5790('0x5e')](_0x28a35d,_0x5dd16c[_0x5790('0x76')][_0xb7ffd7][_0x5790('0x2c')])&&_0x5dd16c[_0x5790('0x76')][_0xb7ffd7][_0x5790('0x78')]&&_0x5dd16c['joins'][_0xb7ffd7]['foreignTable']&&_0x5dd16c['joins'][_0xb7ffd7][_0x5790('0x7a')]){_0x170a26[_0x5dd16c[_0x5790('0x76')][_0xb7ffd7][_0x5790('0x2c')]](_0x5dd16c[_0x5790('0x76')][_0xb7ffd7]['foreignTable'],null,util[_0x5790('0x72')](_0x5790('0x7b'),_0x5dd16c[_0x5790('0x8b')],_0x5dd16c[_0x5790('0x76')][_0xb7ffd7]['parentKey'],_0x5dd16c['joins'][_0xb7ffd7][_0x5790('0x79')],_0x5dd16c['joins'][_0xb7ffd7][_0x5790('0x7a')]));}}}if(_0x5dd16c[_0x5790('0x7c')]){_0x5dd16c['conditions']=JSON[_0x5790('0x77')](_0x5dd16c['conditions']);_0x170a26[_0x5790('0x39')](_0x41d848(_0x5dd16c[_0x5790('0x7c')][_0x5790('0x65')]));}_0x31c096=_0x170a26[_0x5790('0x7d')]();_0x170a26[_0x5790('0x1e')](_0x3cfdb1);_0x170a26[_0x5790('0x1c')](0x0);return;}})[_0x5790('0x23')](function(){if(_0x47cfb9['output']==='web'){return null;}var _0xfae991=_[_0x5790('0x3d')](_0x47cfb9,{'name':_0x47cfb9[_0x5790('0x8c')]||_0x47cfb9[_0x5790('0x28')]||_0x5dd16c['name'],'basename':_0x284252,'savename':util[_0x5790('0x72')](_0x5790('0x8d'),_0x47cfb9['name']||_0x5dd16c[_0x5790('0x28')],require(_0x5790('0x8e'))[_0x5790('0x8f')](0x4),_0x47cfb9[_0x5790('0x90')]||'csv'),'reportId':_0x5dd16c['id'],'reportType':_0x5790('0x91')});return db[_0x5790('0x92')][_0x5790('0x49')](_0xfae991,{'raw':!![]});})[_0x5790('0x23')](function(_0x655559){if(_0x5dd16c[_0x5790('0x8b')]==='cdr'){_0x31c096['where'](_0x5dd16c[_0x5790('0x8b')]+_0x5790('0x93'),_0x47cfb9['startDate'],_0x47cfb9[_0x5790('0x94')]);}else{_0x31c096[_0x5790('0x39')](_0x5dd16c[_0x5790('0x8b')]+_0x5790('0x95'),_0x47cfb9['startDate'],_0x47cfb9[_0x5790('0x94')]);}if(_0x655559){logger[_0x5790('0x96')](_0x5790('0x97'),_0x31c096[_0x5790('0x80')]());require(_0x5790('0x98'))[_0x5790('0x99')](path[_0x5790('0x53')](__dirname,_0x5790('0x9a'),_0x655559[_0x5790('0x90')]),[_0x655559['id'],_0x31c096[_0x5790('0x80')](),path[_0x5790('0x53')](__dirname,_0x5790('0x9b'),_0x655559[_0x5790('0x9c')]),_0x284252]);return _0x655559;}else{var _0x349c63=squel['select']();_0x349c63[_0x5790('0x88')]('('+_0x31c096[_0x5790('0x80')]()+')',_0x5790('0x9d'));_0x349c63[_0x5790('0x66')](_0x5790('0x9e'),_0x5790('0x3e'));_0x31c096[_0x5790('0x1e')](_0x47cfb9[_0x5790('0x1e')]||_0x3cfdb1);_0x31c096['offset'](_0x47cfb9[_0x5790('0x1c')]||0x0);return dbH[_0x5790('0x81')][_0x5790('0x2f')](_0x349c63[_0x5790('0x80')](),{'type':dbH[_0x5790('0x81')][_0x5790('0x82')][_0x5790('0x83')]})['then'](function(_0x239afd){if(!_0x239afd['length']){_0xdce048=0x0;}else{_0xdce048=_0x239afd[0x0]['count']||0x0;}return dbH[_0x5790('0x81')]['query'](_0x31c096[_0x5790('0x80')](),{'type':dbH[_0x5790('0x81')][_0x5790('0x82')][_0x5790('0x83')]});})[_0x5790('0x23')](function(_0x3b9a0d){return{'rows':_0x3b9a0d||[],'count':_0xdce048};});}});}exports[_0x5790('0x9f')]=function(_0x1fd2e6,_0x156e0f){return runReport(_0x1fd2e6[_0x5790('0x45')],_0x1fd2e6[_0x5790('0x2f')],_0x1fd2e6[_0x5790('0x48')])[_0x5790('0x23')](respondWithResult(_0x156e0f,null))[_0x5790('0x43')](handleError(_0x156e0f,null));};exports[_0x5790('0xa0')]=runReport;exports[_0x5790('0x2f')]=function(_0x4473a4,_0x39c689){var _0x78d0bf=0xa;var _0x44fdf1=[_0x5790('0x53'),'left_join',_0x5790('0x55'),_0x5790('0x56')];var _0x3b5e8b={'SUM':_0x5790('0x84'),'COUNT':_0x5790('0x57'),'COUNT DISTINCT':_0x5790('0x58'),'MAX':'MAX(%s)','MIN':_0x5790('0xa1'),'AVG':_0x5790('0xa2'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5790('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x31986d={'SEC_TO_TIME':_0x5790('0xa3'),'DATE':_0x5790('0x5b'),'HOUR':_0x5790('0x5c'),'ROUND':_0x5790('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x11f7ce=function(_0x498233){return!_[_0x5790('0x5e')]([_0x5790('0x5f'),_0x5790('0x60'),_0x5790('0x61'),_0x5790('0x62')],_0x498233);};var _0x35802a=function(_0xaa4c72){if(!_0xaa4c72||!_0xaa4c72[_0x5790('0x63')][_0x5790('0x34')]){return'';}for(var _0x2c9491='(',_0x557def=0x0;_0x557def<_0xaa4c72['rules'][_0x5790('0x34')];_0x557def+=0x1){_0x557def>0x0&&(_0x2c9491+='\x20'+_0xaa4c72[_0x5790('0x64')]+'\x20');_0x2c9491+=_0xaa4c72['rules'][_0x557def][_0x5790('0x65')]?_0x35802a(_0xaa4c72[_0x5790('0x63')][_0x557def]['group']):_0xaa4c72['rules'][_0x557def][_0x5790('0x66')]+'\x20'+_0xaa4c72[_0x5790('0x63')][_0x557def][_0x5790('0x67')]+(_0x11f7ce(_0xaa4c72[_0x5790('0x63')][_0x557def][_0x5790('0x67')])?'\x20'+_0xaa4c72[_0x5790('0x63')][_0x557def]['value']:'');}return _0x2c9491+')';};var _0x57873c={'where':{'id':_0x4473a4[_0x5790('0x45')]['id']}},_0x3777aa,_0x3b763b,_0x2904d5,_0x48c33c,_0x41c559;_0x57873c=_[_0x5790('0x3d')]({},_0x57873c,_0x4473a4[_0x5790('0x48')]);return db[_0x5790('0x47')]['find'](_0x57873c)['then'](function(_0x1bd772){if(_0x1bd772){_0x3777aa=_0x1bd772;return _0x1bd772[_0x5790('0x69')]();}return null;})['then'](function(_0x26b0b9){if(_0x26b0b9){if(!_0x26b0b9['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x5790('0x6c'),0x193);}_0x3b763b=_0x26b0b9;return db[_0x5790('0x6d')][_0x5790('0x41')]({'raw':!![]});}return null;})[_0x5790('0x23')](function(_0xdd21e0){if(_0xdd21e0){_0x2904d5=_[_0x5790('0x6e')](_0xdd21e0,'id');var _0xbb60e;var _0x899a89=squel[_0x5790('0x87')]();_0x899a89['from'](_0x3777aa[_0x5790('0x8b')]);for(var _0x342a24=0x0;_0x342a24<_0x3b763b['length'];_0x342a24+=0x1){_0xbb60e=_0x3b763b[_0x342a24][_0x5790('0x89')]?_0x2904d5[_0x3b763b[_0x342a24][_0x5790('0x89')]][_0x5790('0x6f')]:_0x3b763b[_0x342a24]['field'];_0xbb60e=_0x3b763b[_0x342a24][_0x5790('0x70')]?_[_0x5790('0x71')](_0x3b5e8b[_0x3b763b[_0x342a24][_0x5790('0x70')]],'%s',_0xbb60e):_0xbb60e;_0xbb60e=_0x3b763b[_0x342a24][_0x5790('0x72')]?_[_0x5790('0x71')](_0x31986d[_0x3b763b[_0x342a24][_0x5790('0x72')]],'%s',_0xbb60e):_0xbb60e;if(_0x3b763b[_0x342a24][_0x5790('0x8a')]){_0x899a89['group'](_0xbb60e);}_0x3b763b[_0x342a24][_0x5790('0x73')]&&_0x899a89['order'](_0xbb60e,_0x3b763b[_0x342a24][_0x5790('0x73')]===_0x5790('0x74')?![]:!![]);_0x899a89[_0x5790('0x66')](_0xbb60e,_0x3b763b[_0x342a24][_0x5790('0x75')]||_0xbb60e);}if(_0x3777aa[_0x5790('0x76')]){_0x3777aa[_0x5790('0x76')]=JSON[_0x5790('0x77')](_0x3777aa[_0x5790('0x76')]);for(var _0xd3446b=0x0;_0xd3446b<_0x3777aa[_0x5790('0x76')][_0x5790('0x34')];_0xd3446b+=0x1){if(_0x3777aa[_0x5790('0x76')][_0xd3446b]['type']&&_['includes'](_0x44fdf1,_0x3777aa[_0x5790('0x76')][_0xd3446b]['type'])&&_0x3777aa[_0x5790('0x76')][_0xd3446b][_0x5790('0x78')]&&_0x3777aa[_0x5790('0x76')][_0xd3446b][_0x5790('0x79')]&&_0x3777aa[_0x5790('0x76')][_0xd3446b][_0x5790('0x7a')]){_0x899a89[_0x3777aa[_0x5790('0x76')][_0xd3446b][_0x5790('0x2c')]](_0x3777aa[_0x5790('0x76')][_0xd3446b][_0x5790('0x79')],null,util[_0x5790('0x72')](_0x5790('0x7b'),_0x3777aa[_0x5790('0x8b')],_0x3777aa['joins'][_0xd3446b][_0x5790('0x78')],_0x3777aa[_0x5790('0x76')][_0xd3446b][_0x5790('0x79')],_0x3777aa[_0x5790('0x76')][_0xd3446b][_0x5790('0x7a')]));}}}if(_0x3777aa['conditions']){_0x3777aa[_0x5790('0x7c')]=JSON[_0x5790('0x77')](_0x3777aa[_0x5790('0x7c')]);_0x899a89[_0x5790('0x39')](_0x35802a(_0x3777aa['conditions'][_0x5790('0x65')]));}_0x41c559=_0x899a89[_0x5790('0x7d')]();_0x899a89[_0x5790('0x1e')](_0x78d0bf);_0x899a89[_0x5790('0x1c')](0x0);logger[_0x5790('0x7e')]('Limited\x20Query:',_0x899a89['toString']());return dbH[_0x5790('0x81')]['query'](_0x899a89['toString'](),{'type':dbH[_0x5790('0x81')][_0x5790('0x82')][_0x5790('0x83')]});}})['then'](function(){return{'sql':_0x41c559['toString']()};})[_0x5790('0x23')](respondWithResult(_0x39c689,null))[_0x5790('0x43')](handleError(_0x39c689,null));}; \ No newline at end of file +var _0x697e=['value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','cross_join','SUM(%s)','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','IS\x20NOT\x20NULL','operator','Please\x20insert\x20at\x20least\x20one\x20field','replace','clone','output','web','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','runReport','UNIX_TIMESTAMP(%s)','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','CustomReports','error','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','join','left_join','right_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition'];(function(_0x488de5,_0x12b79c){var _0x2be753=function(_0x183b7f){while(--_0x183b7f){_0x488de5['push'](_0x488de5['shift']());}};_0x2be753(++_0x12b79c);}(_0x697e,0xe4));var _0xe697=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x697e[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe697('0x0'));var zipdir=require(_0xe697('0x1'));var jsonpatch=require(_0xe697('0x2'));var rp=require(_0xe697('0x3'));var moment=require(_0xe697('0x4'));var BPromise=require(_0xe697('0x5'));var Mustache=require(_0xe697('0x6'));var util=require(_0xe697('0x7'));var path=require(_0xe697('0x8'));var sox=require('sox');var csv=require(_0xe697('0x9'));var ejs=require(_0xe697('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe697('0xb'));var squel=require('squel');var crypto=require(_0xe697('0xc'));var jsforce=require(_0xe697('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe697('0x9'));var querystring=require(_0xe697('0xe'));var Papa=require(_0xe697('0xf'));var Redis=require(_0xe697('0x10'));var authService=require(_0xe697('0x11'));var qs=require(_0xe697('0x12'));var as=require(_0xe697('0x13'));var hardwareService=require(_0xe697('0x14'));var logger=require(_0xe697('0x15'))(_0xe697('0x16'));var utils=require(_0xe697('0x17'));var config=require(_0xe697('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe697('0x19'))['db'];var dbH=require(_0xe697('0x19'))[_0xe697('0x1a')];function respondWithStatusCode(_0x2dd32a,_0x69c810){_0x69c810=_0x69c810||0xcc;return function(_0x19ff29){if(_0x19ff29){return _0x2dd32a[_0xe697('0x1b')](_0x69c810);}return _0x2dd32a[_0xe697('0x1c')](_0x69c810)[_0xe697('0x1d')]();};}function respondWithResult(_0x598b31,_0x81fabf){_0x81fabf=_0x81fabf||0xc8;return function(_0x565a6b){if(_0x565a6b){return _0x598b31[_0xe697('0x1c')](_0x81fabf)[_0xe697('0x1e')](_0x565a6b);}};}function respondWithFilteredResult(_0x5738e7,_0x4eb137){return function(_0xec84d3){if(_0xec84d3){var _0x49d8b4=typeof _0x4eb137[_0xe697('0x1f')]===_0xe697('0x20')&&typeof _0x4eb137['limit']===_0xe697('0x20');var _0x2473a7=_0xec84d3[_0xe697('0x21')];var _0x1f0307=_0x49d8b4?0x0:_0x4eb137[_0xe697('0x1f')];var _0x17b988=_0x49d8b4?_0xec84d3[_0xe697('0x21')]:_0x4eb137['offset']+_0x4eb137['limit'];var _0x43a0e0;if(_0x17b988>=_0x2473a7){_0x17b988=_0x2473a7;_0x43a0e0=0xc8;}else{_0x43a0e0=0xce;}_0x5738e7[_0xe697('0x1c')](_0x43a0e0);return _0x5738e7[_0xe697('0x22')](_0xe697('0x23'),_0x1f0307+'-'+_0x17b988+'/'+_0x2473a7)['json'](_0xec84d3);}return null;};}function patchUpdates(_0x4a858b){return function(_0x5aeb5a){try{jsonpatch[_0xe697('0x24')](_0x5aeb5a,_0x4a858b,!![]);}catch(_0x1927e4){return BPromise[_0xe697('0x25')](_0x1927e4);}return _0x5aeb5a[_0xe697('0x26')]();};}function saveUpdates(_0x4150d1,_0x5b6dca){return function(_0x356ef4){if(_0x356ef4){return _0x356ef4['update'](_0x4150d1)[_0xe697('0x27')](function(_0xba473e){return _0xba473e;});}return null;};}function removeEntity(_0x2a3868,_0x2f6175){return function(_0x5e03e9){if(_0x5e03e9){return _0x5e03e9[_0xe697('0x28')]()['then'](function(){var _0x438ff5=_0x5e03e9['get']({'plain':!![]});var _0x532c5e=_0xe697('0x29');return db['UserProfileResource'][_0xe697('0x28')]({'where':{'type':_0x532c5e,'resourceId':_0x438ff5['id']}})[_0xe697('0x27')](function(){return _0x5e03e9;});})['then'](function(){_0x2a3868[_0xe697('0x1c')](0xcc)[_0xe697('0x1d')]();});}};}function handleEntityNotFound(_0x115a7e,_0x7ecb78){return function(_0x59fb4a){if(!_0x59fb4a){_0x115a7e[_0xe697('0x1b')](0x194);}return _0x59fb4a;};}function handleError(_0x4a4749,_0x4ec17e){_0x4ec17e=_0x4ec17e||0x1f4;return function(_0x2d6f49){logger[_0xe697('0x2a')](_0x2d6f49['stack']);if(_0x2d6f49['name']){delete _0x2d6f49[_0xe697('0x2b')];}_0x4a4749['status'](_0x4ec17e)[_0xe697('0x2c')](_0x2d6f49);};}exports[_0xe697('0x2d')]=function(_0x2c3275,_0x497b97){var _0x7a5f83={},_0x9dd700={},_0x47db2e={'count':0x0,'rows':[]};var _0xc0f994=_[_0xe697('0x2e')](db[_0xe697('0x2f')][_0xe697('0x30')],function(_0x512124){return{'name':_0x512124[_0xe697('0x31')],'type':_0x512124[_0xe697('0x32')][_0xe697('0x33')]};});_0x9dd700['model']=_[_0xe697('0x2e')](_0xc0f994,_0xe697('0x2b'));_0x9dd700[_0xe697('0x34')]=_[_0xe697('0x35')](_0x2c3275[_0xe697('0x34')]);_0x9dd700[_0xe697('0x36')]=_[_0xe697('0x37')](_0x9dd700[_0xe697('0x38')],_0x9dd700[_0xe697('0x34')]);_0x7a5f83['attributes']=_[_0xe697('0x37')](_0x9dd700[_0xe697('0x38')],qs[_0xe697('0x39')](_0x2c3275['query']['fields']));_0x7a5f83[_0xe697('0x3a')]=_0x7a5f83[_0xe697('0x3a')][_0xe697('0x3b')]?_0x7a5f83['attributes']:_0x9dd700[_0xe697('0x38')];if(!_0x2c3275['query']['hasOwnProperty']('nolimit')){_0x7a5f83[_0xe697('0x3c')]=qs['limit'](_0x2c3275[_0xe697('0x34')][_0xe697('0x3c')]);_0x7a5f83[_0xe697('0x1f')]=qs[_0xe697('0x1f')](_0x2c3275[_0xe697('0x34')]['offset']);}_0x7a5f83[_0xe697('0x3d')]=qs[_0xe697('0x3e')](_0x2c3275[_0xe697('0x34')][_0xe697('0x3e')]);_0x7a5f83[_0xe697('0x3f')]=qs[_0xe697('0x36')](_[_0xe697('0x40')](_0x2c3275[_0xe697('0x34')],_0x9dd700[_0xe697('0x36')]),_0xc0f994);if(_0x2c3275[_0xe697('0x34')][_0xe697('0x41')]){_0x7a5f83[_0xe697('0x3f')]=_['merge'](_0x7a5f83[_0xe697('0x3f')],{'$or':_[_0xe697('0x2e')](_0xc0f994,function(_0x425e77){if(_0x425e77[_0xe697('0x32')]!==_0xe697('0x42')){var _0x654af7={};_0x654af7[_0x425e77['name']]={'$like':'%'+_0x2c3275[_0xe697('0x34')]['filter']+'%'};return _0x654af7;}})});}_0x7a5f83=_[_0xe697('0x43')]({},_0x7a5f83,_0x2c3275[_0xe697('0x44')]);var _0x21846c={'where':_0x7a5f83[_0xe697('0x3f')]};return db['AnalyticCustomReport'][_0xe697('0x21')](_0x21846c)[_0xe697('0x27')](function(_0x2940c4){_0x47db2e['count']=_0x2940c4;if(_0x2c3275['query'][_0xe697('0x45')]){_0x7a5f83[_0xe697('0x46')]=[{'all':!![]}];}return db[_0xe697('0x2f')][_0xe697('0x47')](_0x7a5f83);})['then'](function(_0x3e2e25){_0x47db2e[_0xe697('0x48')]=_0x3e2e25;return _0x47db2e;})[_0xe697('0x27')](respondWithFilteredResult(_0x497b97,_0x7a5f83))[_0xe697('0x49')](handleError(_0x497b97,null));};exports[_0xe697('0x4a')]=function(_0xf424af,_0x51affb){var _0x8eb562={'raw':![],'where':{'id':_0xf424af[_0xe697('0x4b')]['id']}},_0x33b907={};_0x33b907['model']=_['keys'](db[_0xe697('0x2f')][_0xe697('0x30')]);_0x33b907[_0xe697('0x34')]=_[_0xe697('0x35')](_0xf424af[_0xe697('0x34')]);_0x33b907['filters']=_['intersection'](_0x33b907[_0xe697('0x38')],_0x33b907[_0xe697('0x34')]);_0x8eb562[_0xe697('0x3a')]=_[_0xe697('0x37')](_0x33b907[_0xe697('0x38')],qs['fields'](_0xf424af['query']['fields']));_0x8eb562[_0xe697('0x3a')]=_0x8eb562[_0xe697('0x3a')]['length']?_0x8eb562[_0xe697('0x3a')]:_0x33b907[_0xe697('0x38')];if(_0xf424af['query'][_0xe697('0x45')]){_0x8eb562[_0xe697('0x46')]=[{'all':!![]}];}_0x8eb562=_['merge']({},_0x8eb562,_0xf424af[_0xe697('0x44')]);return db[_0xe697('0x2f')][_0xe697('0x4c')](_0x8eb562)[_0xe697('0x27')](handleEntityNotFound(_0x51affb,null))['then'](respondWithResult(_0x51affb,null))[_0xe697('0x49')](handleError(_0x51affb,null));};exports[_0xe697('0x4d')]=function(_0x1d903b,_0x5698b6){return db[_0xe697('0x2f')]['create'](_0x1d903b[_0xe697('0x4e')],{})['then'](function(_0x5dc76d){var _0x228a57=_0x1d903b[_0xe697('0x4f')][_0xe697('0x50')]({'plain':!![]});if(!_0x228a57)throw new Error(_0xe697('0x51'));if(_0x228a57[_0xe697('0x52')]===_0xe697('0x4f')){var _0xe1db1=_0x5dc76d['get']({'plain':!![]});var _0x4c0365=_0xe697('0x53');return db[_0xe697('0x54')][_0xe697('0x4c')]({'where':{'name':_0x4c0365,'userProfileId':_0x228a57[_0xe697('0x55')]},'raw':!![]})['then'](function(_0x169a52){if(_0x169a52&&_0x169a52[_0xe697('0x56')]===0x0){return db['UserProfileResource'][_0xe697('0x4d')]({'name':_0xe1db1[_0xe697('0x2b')],'resourceId':_0xe1db1['id'],'type':_0xe697('0x29'),'sectionId':_0x169a52['id']},{})[_0xe697('0x27')](function(){return _0x5dc76d;});}else{return _0x5dc76d;}})[_0xe697('0x49')](function(_0x302481){logger[_0xe697('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x302481);throw _0x302481;});}return _0x5dc76d;})[_0xe697('0x27')](respondWithResult(_0x5698b6,0xc9))[_0xe697('0x49')](handleError(_0x5698b6,null));};exports['update']=function(_0x2a3d6b,_0x65c359){if(_0x2a3d6b[_0xe697('0x4e')]['id']){delete _0x2a3d6b[_0xe697('0x4e')]['id'];}return db[_0xe697('0x2f')][_0xe697('0x4c')]({'where':{'id':_0x2a3d6b[_0xe697('0x4b')]['id']}})[_0xe697('0x27')](handleEntityNotFound(_0x65c359,null))['then'](saveUpdates(_0x2a3d6b[_0xe697('0x4e')],null))['then'](respondWithResult(_0x65c359,null))[_0xe697('0x49')](handleError(_0x65c359,null));};exports[_0xe697('0x28')]=function(_0x194bc8,_0x455ab6){return db[_0xe697('0x2f')][_0xe697('0x4c')]({'where':{'id':_0x194bc8['params']['id']}})[_0xe697('0x27')](handleEntityNotFound(_0x455ab6,null))[_0xe697('0x27')](removeEntity(_0x455ab6,null))[_0xe697('0x49')](handleError(_0x455ab6,null));};exports['preview']=function(_0x5184cc,_0x4b0d22){var _0x1146dd=0xa;var _0x5d90f4=[_0xe697('0x57'),_0xe697('0x58'),_0xe697('0x59'),'cross_join'];var _0x15ff42={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xe697('0x5a'),'MAX':'MAX(%s)','MIN':_0xe697('0x5b'),'AVG':_0xe697('0x5c'),'GROUP_CONCAT':_0xe697('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xe697('0x5e')};var _0x3075ee={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe697('0x5f'),'HOUR':_0xe697('0x60'),'ROUND':_0xe697('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x516848=function(_0x54868){return!_[_0xe697('0x62')]([_0xe697('0x63'),'IS\x20NOT\x20NULL',_0xe697('0x64'),_0xe697('0x65')],_0x54868);};var _0x17c5da=function(_0x2b204d){if(!_0x2b204d||!_0x2b204d['rules'][_0xe697('0x3b')]){return'';}for(var _0x11fcb4='(',_0x41d08d=0x0;_0x41d08d<_0x2b204d['rules'][_0xe697('0x3b')];_0x41d08d+=0x1){_0x41d08d>0x0&&(_0x11fcb4+='\x20'+_0x2b204d['operator']+'\x20');_0x11fcb4+=_0x2b204d[_0xe697('0x66')][_0x41d08d][_0xe697('0x67')]?_0x17c5da(_0x2b204d[_0xe697('0x66')][_0x41d08d][_0xe697('0x67')]):_0x2b204d[_0xe697('0x66')][_0x41d08d][_0xe697('0x68')]+'\x20'+_0x2b204d[_0xe697('0x66')][_0x41d08d][_0xe697('0x69')]+(_0x516848(_0x2b204d[_0xe697('0x66')][_0x41d08d][_0xe697('0x69')])?'\x20'+_0x2b204d[_0xe697('0x66')][_0x41d08d][_0xe697('0x6a')]:'');}return _0x11fcb4+')';};var _0x23ac5d={'where':{'id':_0x5184cc[_0xe697('0x4b')]['id']}},_0x476a65,_0x1ad3b7,_0x29a086,_0x39d43c,_0x2ef190;_0x23ac5d=_['merge']({},_0x23ac5d,_0x5184cc[_0xe697('0x44')]);return db['AnalyticCustomReport'][_0xe697('0x4c')](_0x23ac5d)['then'](function(_0x14fdda){if(_0x14fdda){_0x476a65=_0x14fdda;return _0x14fdda[_0xe697('0x6b')]();}return null;})[_0xe697('0x27')](function(_0x5b3d3f){if(_0x5b3d3f){if(!_0x5b3d3f[_0xe697('0x3b')]){throw new db[(_0xe697('0x6c'))][(_0xe697('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1ad3b7=_0x5b3d3f;return db[_0xe697('0x6e')]['findAll']({'raw':!![]});}return null;})[_0xe697('0x27')](function(_0x539029){if(_0x539029){_0x29a086=_[_0xe697('0x6f')](_0x539029,'id');var _0x2f98fe;var _0x9b7964=squel[_0xe697('0x70')]();_0x9b7964[_0xe697('0x71')](_0x476a65[_0xe697('0x72')]);for(var _0x2d3544=0x0;_0x2d3544<_0x1ad3b7[_0xe697('0x3b')];_0x2d3544+=0x1){_0x2f98fe=_0x1ad3b7[_0x2d3544][_0xe697('0x73')]?_0x29a086[_0x1ad3b7[_0x2d3544][_0xe697('0x73')]][_0xe697('0x74')]:_0x1ad3b7[_0x2d3544]['field'];_0x2f98fe=_0x1ad3b7[_0x2d3544][_0xe697('0x75')]?_['replace'](_0x15ff42[_0x1ad3b7[_0x2d3544]['function']],'%s',_0x2f98fe):_0x2f98fe;_0x2f98fe=_0x1ad3b7[_0x2d3544][_0xe697('0x76')]?_['replace'](_0x3075ee[_0x1ad3b7[_0x2d3544][_0xe697('0x76')]],'%s',_0x2f98fe):_0x2f98fe;if(_0x1ad3b7[_0x2d3544][_0xe697('0x77')]){_0x9b7964['group'](_0x2f98fe);}_0x1ad3b7[_0x2d3544]['orderBy']&&_0x9b7964[_0xe697('0x3d')](_0x2f98fe,_0x1ad3b7[_0x2d3544][_0xe697('0x78')]===_0xe697('0x79')?![]:!![]);_0x9b7964[_0xe697('0x68')](_0x2f98fe,_0x1ad3b7[_0x2d3544][_0xe697('0x7a')]||_0x2f98fe);}if(_0x476a65[_0xe697('0x7b')]){_0x476a65[_0xe697('0x7b')]=JSON[_0xe697('0x7c')](_0x476a65[_0xe697('0x7b')]);for(var _0x21aaef=0x0;_0x21aaef<_0x476a65[_0xe697('0x7b')][_0xe697('0x3b')];_0x21aaef+=0x1){if(_0x476a65['joins'][_0x21aaef][_0xe697('0x32')]&&_[_0xe697('0x62')](_0x5d90f4,_0x476a65['joins'][_0x21aaef][_0xe697('0x32')])&&_0x476a65['joins'][_0x21aaef][_0xe697('0x7d')]&&_0x476a65[_0xe697('0x7b')][_0x21aaef][_0xe697('0x7e')]&&_0x476a65[_0xe697('0x7b')][_0x21aaef][_0xe697('0x7f')]){_0x9b7964[_0x476a65[_0xe697('0x7b')][_0x21aaef][_0xe697('0x32')]](_0x476a65[_0xe697('0x7b')][_0x21aaef][_0xe697('0x7e')],null,util[_0xe697('0x76')](_0xe697('0x80'),_0x476a65[_0xe697('0x72')],_0x476a65['joins'][_0x21aaef]['parentKey'],_0x476a65['joins'][_0x21aaef][_0xe697('0x7e')],_0x476a65['joins'][_0x21aaef][_0xe697('0x7f')]));}}}if(_0x476a65[_0xe697('0x81')]){_0x476a65[_0xe697('0x81')]=JSON[_0xe697('0x7c')](_0x476a65[_0xe697('0x81')]);_0x9b7964['where'](_0x17c5da(_0x476a65[_0xe697('0x81')][_0xe697('0x67')]));}_0x2ef190=_0x9b7964['clone']();_0x9b7964[_0xe697('0x3c')](_0x1146dd);_0x9b7964['offset'](0x0);logger[_0xe697('0x82')](_0xe697('0x83'),_0x9b7964['toString']());return dbH[_0xe697('0x84')][_0xe697('0x34')](_0x9b7964[_0xe697('0x85')](),{'type':dbH[_0xe697('0x84')][_0xe697('0x86')][_0xe697('0x87')]});}})[_0xe697('0x27')](respondWithResult(_0x4b0d22,null))[_0xe697('0x49')](handleError(_0x4b0d22,null));};function runReport(_0x4e956c,_0x3462f3,_0x49db15){var _0x54281b=_0x3462f3[_0xe697('0x2b')];var _0x3065fd=0xa;var _0xdacac8=[_0xe697('0x57'),_0xe697('0x58'),_0xe697('0x59'),_0xe697('0x88')];var _0x56884d={'SUM':_0xe697('0x89'),'COUNT':_0xe697('0x8a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xe697('0x5b'),'AVG':_0xe697('0x5c'),'GROUP_CONCAT':_0xe697('0x5d'),'GROUP_CONCAT ASC':_0xe697('0x8b'),'GROUP_CONCAT DESC':_0xe697('0x5e')};var _0x154146={'SEC_TO_TIME':_0xe697('0x8c'),'DATE':_0xe697('0x5f'),'HOUR':_0xe697('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x458707=function(_0x22ae46){return!_[_0xe697('0x62')](['IS\x20NULL',_0xe697('0x8d'),_0xe697('0x64'),_0xe697('0x65')],_0x22ae46);};var _0x3f9a2a=function(_0x1476bd){if(!_0x1476bd||!_0x1476bd[_0xe697('0x66')][_0xe697('0x3b')]){return'';}for(var _0x134d91='(',_0x3bac68=0x0;_0x3bac68<_0x1476bd[_0xe697('0x66')][_0xe697('0x3b')];_0x3bac68+=0x1){_0x3bac68>0x0&&(_0x134d91+='\x20'+_0x1476bd[_0xe697('0x8e')]+'\x20');_0x134d91+=_0x1476bd[_0xe697('0x66')][_0x3bac68][_0xe697('0x67')]?_0x3f9a2a(_0x1476bd[_0xe697('0x66')][_0x3bac68][_0xe697('0x67')]):_0x1476bd[_0xe697('0x66')][_0x3bac68][_0xe697('0x68')]+'\x20'+_0x1476bd['rules'][_0x3bac68][_0xe697('0x69')]+(_0x458707(_0x1476bd['rules'][_0x3bac68][_0xe697('0x69')])?'\x20'+_0x1476bd[_0xe697('0x66')][_0x3bac68][_0xe697('0x6a')]:'');}return _0x134d91+')';};var _0x11eeec={'where':{'id':_0x4e956c['id']}},_0x21633e,_0x6df532,_0x2f5392,_0x5a80d9,_0x2d63b2;_0x11eeec=_['merge']({},_0x11eeec,_0x49db15);return db[_0xe697('0x2f')][_0xe697('0x4c')](_0x11eeec)[_0xe697('0x27')](function(_0x225915){if(_0x225915){_0x21633e=_0x225915;return _0x225915[_0xe697('0x6b')]();}return null;})[_0xe697('0x27')](function(_0x26a241){if(_0x26a241){if(!_0x26a241[_0xe697('0x3b')]){throw new db[(_0xe697('0x6c'))][(_0xe697('0x6d'))](_0xe697('0x8f'),0x193);}_0x6df532=_0x26a241;return db[_0xe697('0x6e')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x143c13){if(_0x143c13){_0x2f5392=_[_0xe697('0x6f')](_0x143c13,'id');var _0x46c78f;var _0x1756e0=squel[_0xe697('0x70')]();_0x1756e0['from'](_0x21633e[_0xe697('0x72')]);for(var _0x2b2e23=0x0;_0x2b2e23<_0x6df532[_0xe697('0x3b')];_0x2b2e23+=0x1){_0x46c78f=_0x6df532[_0x2b2e23][_0xe697('0x73')]?_0x2f5392[_0x6df532[_0x2b2e23]['MetricId']][_0xe697('0x74')]:_0x6df532[_0x2b2e23][_0xe697('0x68')];_0x46c78f=_0x6df532[_0x2b2e23][_0xe697('0x75')]?_[_0xe697('0x90')](_0x56884d[_0x6df532[_0x2b2e23][_0xe697('0x75')]],'%s',_0x46c78f):_0x46c78f;_0x46c78f=_0x6df532[_0x2b2e23][_0xe697('0x76')]?_[_0xe697('0x90')](_0x154146[_0x6df532[_0x2b2e23][_0xe697('0x76')]],'%s',_0x46c78f):_0x46c78f;if(_0x6df532[_0x2b2e23]['groupBy']){_0x1756e0[_0xe697('0x67')](_0x46c78f);}_0x6df532[_0x2b2e23]['orderBy']&&_0x1756e0[_0xe697('0x3d')](_0x46c78f,_0x6df532[_0x2b2e23][_0xe697('0x78')]===_0xe697('0x79')?![]:!![]);_0x1756e0[_0xe697('0x68')](_0x46c78f,_0x6df532[_0x2b2e23][_0xe697('0x7a')]||_0x46c78f);}if(_0x21633e[_0xe697('0x7b')]){_0x21633e[_0xe697('0x7b')]=JSON[_0xe697('0x7c')](_0x21633e['joins']);for(var _0x5932fb=0x0;_0x5932fb<_0x21633e[_0xe697('0x7b')][_0xe697('0x3b')];_0x5932fb+=0x1){if(_0x21633e[_0xe697('0x7b')][_0x5932fb][_0xe697('0x32')]&&_[_0xe697('0x62')](_0xdacac8,_0x21633e[_0xe697('0x7b')][_0x5932fb]['type'])&&_0x21633e['joins'][_0x5932fb]['parentKey']&&_0x21633e['joins'][_0x5932fb]['foreignTable']&&_0x21633e[_0xe697('0x7b')][_0x5932fb]['foreignKey']){_0x1756e0[_0x21633e[_0xe697('0x7b')][_0x5932fb][_0xe697('0x32')]](_0x21633e[_0xe697('0x7b')][_0x5932fb][_0xe697('0x7e')],null,util['format'](_0xe697('0x80'),_0x21633e[_0xe697('0x72')],_0x21633e['joins'][_0x5932fb]['parentKey'],_0x21633e[_0xe697('0x7b')][_0x5932fb][_0xe697('0x7e')],_0x21633e[_0xe697('0x7b')][_0x5932fb][_0xe697('0x7f')]));}}}if(_0x21633e['conditions']){_0x21633e['conditions']=JSON[_0xe697('0x7c')](_0x21633e['conditions']);_0x1756e0[_0xe697('0x3f')](_0x3f9a2a(_0x21633e[_0xe697('0x81')]['group']));}_0x2d63b2=_0x1756e0[_0xe697('0x91')]();_0x1756e0[_0xe697('0x3c')](_0x3065fd);_0x1756e0[_0xe697('0x1f')](0x0);return;}})[_0xe697('0x27')](function(){if(_0x3462f3[_0xe697('0x92')]===_0xe697('0x93')){return null;}var _0x1ba5c4=_[_0xe697('0x43')](_0x3462f3,{'name':_0x3462f3[_0xe697('0x94')]||_0x3462f3[_0xe697('0x2b')]||_0x21633e[_0xe697('0x2b')],'basename':_0x54281b,'savename':util['format'](_0xe697('0x95'),_0x3462f3[_0xe697('0x2b')]||_0x21633e[_0xe697('0x2b')],require(_0xe697('0x96'))['generate'](0x4),_0x3462f3[_0xe697('0x92')]||_0xe697('0x97')),'reportId':_0x21633e['id'],'reportType':_0xe697('0x98')});return db[_0xe697('0x99')][_0xe697('0x4d')](_0x1ba5c4,{'raw':!![]});})[_0xe697('0x27')](function(_0x4aef4){if(_0x21633e[_0xe697('0x72')]===_0xe697('0x9a')){_0x2d63b2['where'](_0x21633e[_0xe697('0x72')]+_0xe697('0x9b'),_0x3462f3['startDate'],_0x3462f3[_0xe697('0x9c')]);}else{_0x2d63b2[_0xe697('0x3f')](_0x21633e['table']+_0xe697('0x9d'),_0x3462f3[_0xe697('0x9e')],_0x3462f3['endDate']);}if(_0x4aef4){logger[_0xe697('0x9f')](_0xe697('0xa0'),_0x2d63b2[_0xe697('0x85')]());require(_0xe697('0xa1'))[_0xe697('0xa2')](path[_0xe697('0x57')](__dirname,'../../components/export/',_0x4aef4[_0xe697('0x92')]),[_0x4aef4['id'],_0x2d63b2[_0xe697('0x85')](),path[_0xe697('0x57')](__dirname,_0xe697('0xa3'),_0x4aef4[_0xe697('0xa4')]),_0x54281b]);return _0x4aef4;}else{var _0x2bd15b=squel[_0xe697('0x70')]();_0x2bd15b[_0xe697('0x71')]('('+_0x2d63b2[_0xe697('0x85')]()+')','countTable');_0x2bd15b[_0xe697('0x68')]('COUNT(*)',_0xe697('0x21'));_0x2d63b2['limit'](_0x3462f3[_0xe697('0x3c')]||_0x3065fd);_0x2d63b2[_0xe697('0x1f')](_0x3462f3['offset']||0x0);return dbH['sequelize'][_0xe697('0x34')](_0x2bd15b['toString'](),{'type':dbH['sequelize'][_0xe697('0x86')]['SELECT']})[_0xe697('0x27')](function(_0x41c0e3){if(!_0x41c0e3['length']){_0x5a80d9=0x0;}else{_0x5a80d9=_0x41c0e3[0x0][_0xe697('0x21')]||0x0;}return dbH[_0xe697('0x84')][_0xe697('0x34')](_0x2d63b2[_0xe697('0x85')](),{'type':dbH[_0xe697('0x84')]['QueryTypes'][_0xe697('0x87')]});})[_0xe697('0x27')](function(_0x441a52){return{'rows':_0x441a52||[],'count':_0x5a80d9};});}});}exports['run']=function(_0x2aae42,_0x29be13){return runReport(_0x2aae42[_0xe697('0x4b')],_0x2aae42[_0xe697('0x34')],_0x2aae42[_0xe697('0x44')])[_0xe697('0x27')](respondWithResult(_0x29be13,null))[_0xe697('0x49')](handleError(_0x29be13,null));};exports[_0xe697('0xa5')]=runReport;exports[_0xe697('0x34')]=function(_0x3d7fd2,_0x46004e){var _0x45e7b7=0xa;var _0x59d1fd=[_0xe697('0x57'),_0xe697('0x58'),_0xe697('0x59'),'cross_join'];var _0x59b83f={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xe697('0x5a'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xe697('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe697('0x8b'),'GROUP_CONCAT DESC':_0xe697('0x5e')};var _0x4598e3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe697('0x5f'),'HOUR':_0xe697('0x60'),'ROUND':_0xe697('0x61'),'UNIX_TIMESTAMP':_0xe697('0xa6')};var _0x124dc6=function(_0x23f3c0){return!_[_0xe697('0x62')]([_0xe697('0x63'),_0xe697('0x8d'),_0xe697('0x64'),_0xe697('0x65')],_0x23f3c0);};var _0x5ec00a=function(_0x1be2bd){if(!_0x1be2bd||!_0x1be2bd[_0xe697('0x66')][_0xe697('0x3b')]){return'';}for(var _0x185a99='(',_0x1ecf61=0x0;_0x1ecf61<_0x1be2bd[_0xe697('0x66')]['length'];_0x1ecf61+=0x1){_0x1ecf61>0x0&&(_0x185a99+='\x20'+_0x1be2bd[_0xe697('0x8e')]+'\x20');_0x185a99+=_0x1be2bd[_0xe697('0x66')][_0x1ecf61]['group']?_0x5ec00a(_0x1be2bd['rules'][_0x1ecf61][_0xe697('0x67')]):_0x1be2bd[_0xe697('0x66')][_0x1ecf61][_0xe697('0x68')]+'\x20'+_0x1be2bd[_0xe697('0x66')][_0x1ecf61][_0xe697('0x69')]+(_0x124dc6(_0x1be2bd[_0xe697('0x66')][_0x1ecf61][_0xe697('0x69')])?'\x20'+_0x1be2bd[_0xe697('0x66')][_0x1ecf61][_0xe697('0x6a')]:'');}return _0x185a99+')';};var _0x58feb9={'where':{'id':_0x3d7fd2[_0xe697('0x4b')]['id']}},_0x4ef691,_0x30e126,_0x25fd4e,_0x2859f0,_0x24ca63;_0x58feb9=_[_0xe697('0x43')]({},_0x58feb9,_0x3d7fd2[_0xe697('0x44')]);return db[_0xe697('0x2f')][_0xe697('0x4c')](_0x58feb9)[_0xe697('0x27')](function(_0x5c2955){if(_0x5c2955){_0x4ef691=_0x5c2955;return _0x5c2955[_0xe697('0x6b')]();}return null;})[_0xe697('0x27')](function(_0x2febd1){if(_0x2febd1){if(!_0x2febd1[_0xe697('0x3b')]){throw new db[(_0xe697('0x6c'))][(_0xe697('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x30e126=_0x2febd1;return db[_0xe697('0x6e')][_0xe697('0x47')]({'raw':!![]});}return null;})[_0xe697('0x27')](function(_0x441e1c){if(_0x441e1c){_0x25fd4e=_[_0xe697('0x6f')](_0x441e1c,'id');var _0x5da63a;var _0x36290e=squel[_0xe697('0x70')]();_0x36290e[_0xe697('0x71')](_0x4ef691['table']);for(var _0x3a2cc6=0x0;_0x3a2cc6<_0x30e126['length'];_0x3a2cc6+=0x1){_0x5da63a=_0x30e126[_0x3a2cc6][_0xe697('0x73')]?_0x25fd4e[_0x30e126[_0x3a2cc6][_0xe697('0x73')]][_0xe697('0x74')]:_0x30e126[_0x3a2cc6][_0xe697('0x68')];_0x5da63a=_0x30e126[_0x3a2cc6]['function']?_[_0xe697('0x90')](_0x59b83f[_0x30e126[_0x3a2cc6][_0xe697('0x75')]],'%s',_0x5da63a):_0x5da63a;_0x5da63a=_0x30e126[_0x3a2cc6][_0xe697('0x76')]?_[_0xe697('0x90')](_0x4598e3[_0x30e126[_0x3a2cc6][_0xe697('0x76')]],'%s',_0x5da63a):_0x5da63a;if(_0x30e126[_0x3a2cc6][_0xe697('0x77')]){_0x36290e[_0xe697('0x67')](_0x5da63a);}_0x30e126[_0x3a2cc6]['orderBy']&&_0x36290e[_0xe697('0x3d')](_0x5da63a,_0x30e126[_0x3a2cc6]['orderBy']==='DESC'?![]:!![]);_0x36290e[_0xe697('0x68')](_0x5da63a,_0x30e126[_0x3a2cc6][_0xe697('0x7a')]||_0x5da63a);}if(_0x4ef691['joins']){_0x4ef691[_0xe697('0x7b')]=JSON[_0xe697('0x7c')](_0x4ef691[_0xe697('0x7b')]);for(var _0x40d994=0x0;_0x40d994<_0x4ef691[_0xe697('0x7b')]['length'];_0x40d994+=0x1){if(_0x4ef691[_0xe697('0x7b')][_0x40d994][_0xe697('0x32')]&&_[_0xe697('0x62')](_0x59d1fd,_0x4ef691[_0xe697('0x7b')][_0x40d994][_0xe697('0x32')])&&_0x4ef691['joins'][_0x40d994]['parentKey']&&_0x4ef691[_0xe697('0x7b')][_0x40d994][_0xe697('0x7e')]&&_0x4ef691[_0xe697('0x7b')][_0x40d994]['foreignKey']){_0x36290e[_0x4ef691[_0xe697('0x7b')][_0x40d994][_0xe697('0x32')]](_0x4ef691['joins'][_0x40d994][_0xe697('0x7e')],null,util[_0xe697('0x76')](_0xe697('0x80'),_0x4ef691[_0xe697('0x72')],_0x4ef691[_0xe697('0x7b')][_0x40d994][_0xe697('0x7d')],_0x4ef691[_0xe697('0x7b')][_0x40d994][_0xe697('0x7e')],_0x4ef691[_0xe697('0x7b')][_0x40d994][_0xe697('0x7f')]));}}}if(_0x4ef691[_0xe697('0x81')]){_0x4ef691[_0xe697('0x81')]=JSON[_0xe697('0x7c')](_0x4ef691[_0xe697('0x81')]);_0x36290e[_0xe697('0x3f')](_0x5ec00a(_0x4ef691[_0xe697('0x81')][_0xe697('0x67')]));}_0x24ca63=_0x36290e[_0xe697('0x91')]();_0x36290e[_0xe697('0x3c')](_0x45e7b7);_0x36290e[_0xe697('0x1f')](0x0);logger[_0xe697('0x82')](_0xe697('0x83'),_0x36290e[_0xe697('0x85')]());return dbH[_0xe697('0x84')][_0xe697('0x34')](_0x36290e[_0xe697('0x85')](),{'type':dbH[_0xe697('0x84')][_0xe697('0x86')][_0xe697('0x87')]});}})[_0xe697('0x27')](function(){return{'sql':_0x24ca63[_0xe697('0x85')]()};})['then'](respondWithResult(_0x46004e,null))[_0xe697('0x49')](handleError(_0x46004e,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 85a6ebe..8703b82 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 _0x03fc=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x574e92,_0x5c61e8){var _0x32207c=function(_0x333c8e){while(--_0x333c8e){_0x574e92['push'](_0x574e92['shift']());}};_0x32207c(++_0x5c61e8);}(_0x03fc,0x1b7));var _0xc03f=function(_0x21b14f,_0x3ed9b9){_0x21b14f=_0x21b14f-0x0;var _0x4c0fd0=_0x03fc[_0x21b14f];return _0x4c0fd0;};'use strict';var _=require(_0xc03f('0x0'));var util=require('util');var logger=require(_0xc03f('0x1'))(_0xc03f('0x2'));var moment=require(_0xc03f('0x3'));var BPromise=require(_0xc03f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc03f('0x5'));var rimraf=require('rimraf');var config=require(_0xc03f('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0xc03f('0x7')]=function(_0x3b23cc,_0x7bf33){return _0x3b23cc[_0xc03f('0x8')](_0xc03f('0x9'),attributes,{'tableName':_0xc03f('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7557=['request-promise','path','rimraf','../../config/environment','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','bluebird'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x7557,0x167));var _0x7755=function(_0xa41fd3,_0x55742e){_0xa41fd3=_0xa41fd3-0x0;var _0x46f2d3=_0x7557[_0xa41fd3];return _0x46f2d3;};'use strict';var _=require(_0x7755('0x0'));var util=require(_0x7755('0x1'));var logger=require(_0x7755('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7755('0x3'));var rp=require(_0x7755('0x4'));var fs=require('fs');var path=require(_0x7755('0x5'));var rimraf=require(_0x7755('0x6'));var config=require(_0x7755('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x7755('0x8')]=function(_0x4a59fd,_0x3ddfa4){return _0x4a59fd['define'](_0x7755('0x9'),attributes,{'tableName':_0x7755('0xa'),'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 c350c75..703d8b9 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 _0x8eaf=['request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x8eaf,0x80));var _0xf8ea=function(_0x32aac9,_0x5eb63d){_0x32aac9=_0x32aac9-0x0;var _0x51bafd=_0x8eaf[_0x32aac9];return _0x51bafd;};'use strict';var _=require(_0xf8ea('0x0'));var util=require(_0xf8ea('0x1'));var moment=require(_0xf8ea('0x2'));var BPromise=require(_0xf8ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8ea('0x5'));var logger=require(_0xf8ea('0x6'))('rpc');var config=require(_0xf8ea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf8ea('0x8')][_0xf8ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x596eb1,_0x27b4bd,_0x173d67){return new BPromise(function(_0x379f04,_0x17fe4d){return client[_0xf8ea('0xa')](_0x596eb1,_0x173d67)[_0xf8ea('0xb')](function(_0x55d452){logger[_0xf8ea('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x27b4bd,_0xf8ea('0xd'));logger[_0xf8ea('0xe')](_0xf8ea('0xf'),_0x27b4bd,_0xf8ea('0xd'),JSON[_0xf8ea('0x10')](_0x55d452));if(_0x55d452[_0xf8ea('0x11')]){if(_0x55d452[_0xf8ea('0x11')][_0xf8ea('0x12')]===0x1f4){logger[_0xf8ea('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x27b4bd,_0x55d452[_0xf8ea('0x11')]['message']);return _0x17fe4d(_0x55d452['error'][_0xf8ea('0x13')]);}logger[_0xf8ea('0x11')](_0xf8ea('0x14'),_0x27b4bd,_0x55d452[_0xf8ea('0x11')][_0xf8ea('0x13')]);return _0x379f04(_0x55d452['error'][_0xf8ea('0x13')]);}else{logger['info'](_0xf8ea('0x14'),_0x27b4bd,_0xf8ea('0xd'));_0x379f04(_0x55d452[_0xf8ea('0x15')][_0xf8ea('0x13')]);}})[_0xf8ea('0x16')](function(_0x4dd8c6){logger[_0xf8ea('0x11')](_0xf8ea('0x14'),_0x27b4bd,_0x4dd8c6);_0x17fe4d(_0x4dd8c6);});});} \ No newline at end of file +var _0x5caa=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0x5caa,0x181));var _0xa5ca=function(_0x3d00db,_0x3692b3){_0x3d00db=_0x3d00db-0x0;var _0x41f115=_0x5caa[_0x3d00db];return _0x41f115;};'use strict';var _=require(_0xa5ca('0x0'));var util=require('util');var moment=require(_0xa5ca('0x1'));var BPromise=require(_0xa5ca('0x2'));var rs=require(_0xa5ca('0x3'));var fs=require('fs');var Redis=require(_0xa5ca('0x4'));var db=require(_0xa5ca('0x5'))['db'];var utils=require(_0xa5ca('0x6'));var logger=require(_0xa5ca('0x7'))('rpc');var config=require(_0xa5ca('0x8'));var jayson=require(_0xa5ca('0x9'));var client=jayson[_0xa5ca('0xa')][_0xa5ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194f75,_0x2cfcd4,_0x43e3fb){return new BPromise(function(_0x536924,_0x36ddfe){return client[_0xa5ca('0xc')](_0x194f75,_0x43e3fb)[_0xa5ca('0xd')](function(_0x57d976){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x2cfcd4,_0xa5ca('0xe'));logger['debug'](_0xa5ca('0xf'),_0x2cfcd4,_0xa5ca('0xe'),JSON[_0xa5ca('0x10')](_0x57d976));if(_0x57d976[_0xa5ca('0x11')]){if(_0x57d976[_0xa5ca('0x11')][_0xa5ca('0x12')]===0x1f4){logger[_0xa5ca('0x11')](_0xa5ca('0x13'),_0x2cfcd4,_0x57d976[_0xa5ca('0x11')]['message']);return _0x36ddfe(_0x57d976[_0xa5ca('0x11')][_0xa5ca('0x14')]);}logger[_0xa5ca('0x11')](_0xa5ca('0x13'),_0x2cfcd4,_0x57d976['error'][_0xa5ca('0x14')]);return _0x536924(_0x57d976['error'][_0xa5ca('0x14')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x2cfcd4,'request\x20sent');_0x536924(_0x57d976[_0xa5ca('0x15')][_0xa5ca('0x14')]);}})[_0xa5ca('0x16')](function(_0xb3f5f7){logger[_0xa5ca('0x11')](_0xa5ca('0x13'),_0x2cfcd4,_0xb3f5f7);_0x36ddfe(_0xb3f5f7);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 2ac634e..bab0b34 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 _0x36c8=['Router','../../components/auth/service','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','/:id/run','query','create','put','update','delete','exports','multer','util','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36c8,0x1ad));var _0x836c=function(_0x25a23f,_0x41d099){_0x25a23f=_0x25a23f-0x0;var _0x18643c=_0x36c8[_0x25a23f];return _0x18643c;};'use strict';var multer=require(_0x836c('0x0'));var util=require(_0x836c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x836c('0x2'));var router=express[_0x836c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x836c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x836c('0x5'));router[_0x836c('0x6')]('/',auth[_0x836c('0x7')](),controller['index']);router['get'](_0x836c('0x8'),auth[_0x836c('0x7')](),controller[_0x836c('0x9')]);router[_0x836c('0x6')](_0x836c('0xa'),auth['isAuthenticated'](),controller['preview']);router[_0x836c('0x6')](_0x836c('0xb'),auth['isAuthenticated'](),controller['run']);router['get']('/:id/query',auth[_0x836c('0x7')](),controller[_0x836c('0xc')]);router['post']('/',auth[_0x836c('0x7')](),controller[_0x836c('0xd')]);router[_0x836c('0xe')](_0x836c('0x8'),auth[_0x836c('0x7')](),controller[_0x836c('0xf')]);router[_0x836c('0x10')](_0x836c('0x8'),auth[_0x836c('0x7')](),controller['destroy']);module[_0x836c('0x11')]=router; \ No newline at end of file +var _0x5d85=['show','/:id/preview','/:id/run','run','/:id/query','query','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','index','get','/:id','isAuthenticated'];(function(_0x14a4d0,_0x4c7068){var _0x18c8ab=function(_0x10bd3b){while(--_0x10bd3b){_0x14a4d0['push'](_0x14a4d0['shift']());}};_0x18c8ab(++_0x4c7068);}(_0x5d85,0x191));var _0x55d8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5d85[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x55d8('0x0'));var util=require(_0x55d8('0x1'));var path=require(_0x55d8('0x2'));var timeout=require(_0x55d8('0x3'));var express=require(_0x55d8('0x4'));var router=express[_0x55d8('0x5')]();var fs_extra=require(_0x55d8('0x6'));var auth=require(_0x55d8('0x7'));var interaction=require(_0x55d8('0x8'));var config=require(_0x55d8('0x9'));var controller=require(_0x55d8('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x55d8('0xb')]);router[_0x55d8('0xc')](_0x55d8('0xd'),auth[_0x55d8('0xe')](),controller[_0x55d8('0xf')]);router['get'](_0x55d8('0x10'),auth['isAuthenticated'](),controller['preview']);router[_0x55d8('0xc')](_0x55d8('0x11'),auth['isAuthenticated'](),controller[_0x55d8('0x12')]);router[_0x55d8('0xc')](_0x55d8('0x13'),auth[_0x55d8('0xe')](),controller[_0x55d8('0x14')]);router['post']('/',auth[_0x55d8('0xe')](),controller[_0x55d8('0x15')]);router[_0x55d8('0x16')](_0x55d8('0xd'),auth[_0x55d8('0xe')](),controller[_0x55d8('0x17')]);router[_0x55d8('0x18')]('/:id',auth[_0x55d8('0xe')](),controller[_0x55d8('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 5f2d1bd..34aff26 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 _0x9957=['exports','STRING','TEXT','sequelize'];(function(_0x4ad095,_0x5f4d18){var _0x168ddf=function(_0x3600af){while(--_0x3600af){_0x4ad095['push'](_0x4ad095['shift']());}};_0x168ddf(++_0x5f4d18);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7995('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x7995('0x2')]},'conditions':{'type':Sequelize[_0x7995('0x3')]},'joins':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0x18c61b,_0x129781){var _0x1ffb5c=function(_0x2447ff){while(--_0x2447ff){_0x18c61b['push'](_0x18c61b['shift']());}};_0x1ffb5c(++_0x129781);}(_0xeda8,0x104));var _0x8eda=function(_0x3b8ffc,_0x44dc0e){_0x3b8ffc=_0x3b8ffc-0x0;var _0x1e3489=_0xeda8[_0x3b8ffc];return _0x1e3489;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 2dcf098..8dcab31 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 _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x4bf564,_0x72673f){var _0x158b46=function(_0x45106c){while(--_0x45106c){_0x4bf564['push'](_0x4bf564['shift']());}};_0x158b46(++_0x72673f);}(_0x4975,0x86));var _0x5497=function(_0x3beb14,_0x5035fe){_0x3beb14=_0x3beb14-0x0;var _0x38e7f5=_0x4975[_0x3beb14];return _0x38e7f5;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));}; \ No newline at end of file +var _0x4819=['keyBy','table','metric','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','from','countTable','COUNT(*)','SELECT','run','cross_join','COUNT(DISTINCT\x20%s)','debug','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','AnalyticDefaultReport','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','body','preview','join','left_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','MetricId','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20NULL','IS\x20EMPTY','operator','condition'];(function(_0x1508e9,_0x5dfaec){var _0x5a0bf5=function(_0x1e2a64){while(--_0x1e2a64){_0x1508e9['push'](_0x1508e9['shift']());}};_0x5a0bf5(++_0x5dfaec);}(_0x4819,0xcd));var _0x9481=function(_0x17db61,_0x364236){_0x17db61=_0x17db61-0x0;var _0x7ac96b=_0x4819[_0x17db61];return _0x7ac96b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];var dbH=require(_0x9481('0x19'))['dbH'];function respondWithStatusCode(_0x5aac02,_0xce6fa2){_0xce6fa2=_0xce6fa2||0xcc;return function(_0x150276){if(_0x150276){return _0x5aac02[_0x9481('0x1a')](_0xce6fa2);}return _0x5aac02[_0x9481('0x1b')](_0xce6fa2)[_0x9481('0x1c')]();};}function respondWithResult(_0xc7a0b5,_0x3fb97f){_0x3fb97f=_0x3fb97f||0xc8;return function(_0x495b30){if(_0x495b30){return _0xc7a0b5[_0x9481('0x1b')](_0x3fb97f)[_0x9481('0x1d')](_0x495b30);}};}function respondWithFilteredResult(_0x5b1fe6,_0x2266d5){return function(_0x518150){if(_0x518150){var _0x34108d=typeof _0x2266d5[_0x9481('0x1e')]===_0x9481('0x1f')&&typeof _0x2266d5[_0x9481('0x20')]==='undefined';var _0x5eda66=_0x518150[_0x9481('0x21')];var _0x50a559=_0x34108d?0x0:_0x2266d5['offset'];var _0x26671c=_0x34108d?_0x518150[_0x9481('0x21')]:_0x2266d5[_0x9481('0x1e')]+_0x2266d5[_0x9481('0x20')];var _0x7000e7;if(_0x26671c>=_0x5eda66){_0x26671c=_0x5eda66;_0x7000e7=0xc8;}else{_0x7000e7=0xce;}_0x5b1fe6[_0x9481('0x1b')](_0x7000e7);return _0x5b1fe6['set'](_0x9481('0x22'),_0x50a559+'-'+_0x26671c+'/'+_0x5eda66)[_0x9481('0x1d')](_0x518150);}return null;};}function patchUpdates(_0x45f9df){return function(_0x615e02){try{jsonpatch[_0x9481('0x23')](_0x615e02,_0x45f9df,!![]);}catch(_0x56da97){return BPromise[_0x9481('0x24')](_0x56da97);}return _0x615e02[_0x9481('0x25')]();};}function saveUpdates(_0x572599,_0x2bcf37){return function(_0xd1cd1a){if(_0xd1cd1a){return _0xd1cd1a[_0x9481('0x26')](_0x572599)[_0x9481('0x27')](function(_0x2dc02e){return _0x2dc02e;});}return null;};}function removeEntity(_0x49ecfa,_0x91e3d9){return function(_0x22f0b5){if(_0x22f0b5){return _0x22f0b5['destroy']()['then'](function(){var _0x12b0c3=_0x22f0b5[_0x9481('0x28')]({'plain':!![]});var _0x550fce=_0x9481('0x29');return db[_0x9481('0x2a')][_0x9481('0x2b')]({'where':{'type':_0x550fce,'resourceId':_0x12b0c3['id']}})[_0x9481('0x27')](function(){return _0x22f0b5;});})['then'](function(){_0x49ecfa[_0x9481('0x1b')](0xcc)[_0x9481('0x1c')]();});}};}function handleEntityNotFound(_0x3c2585,_0x587706){return function(_0x1791b2){if(!_0x1791b2){_0x3c2585['sendStatus'](0x194);}return _0x1791b2;};}function handleError(_0x2e1eff,_0xe153ab){_0xe153ab=_0xe153ab||0x1f4;return function(_0x22ab26){logger[_0x9481('0x2c')](_0x22ab26[_0x9481('0x2d')]);if(_0x22ab26['name']){delete _0x22ab26[_0x9481('0x2e')];}_0x2e1eff[_0x9481('0x1b')](_0xe153ab)[_0x9481('0x2f')](_0x22ab26);};}exports['index']=function(_0x56752e,_0x1addc8){var _0x427c25={},_0x42df68={},_0x2b33f8={'count':0x0,'rows':[]};var _0x5d9926=_['map'](db['AnalyticDefaultReport'][_0x9481('0x30')],function(_0x5d6c65){return{'name':_0x5d6c65[_0x9481('0x31')],'type':_0x5d6c65['type'][_0x9481('0x32')]};});_0x42df68[_0x9481('0x33')]=_[_0x9481('0x34')](_0x5d9926,_0x9481('0x2e'));_0x42df68[_0x9481('0x35')]=_['keys'](_0x56752e[_0x9481('0x35')]);_0x42df68[_0x9481('0x36')]=_[_0x9481('0x37')](_0x42df68['model'],_0x42df68[_0x9481('0x35')]);_0x427c25[_0x9481('0x38')]=_[_0x9481('0x37')](_0x42df68[_0x9481('0x33')],qs[_0x9481('0x39')](_0x56752e[_0x9481('0x35')]['fields']));_0x427c25[_0x9481('0x38')]=_0x427c25['attributes'][_0x9481('0x3a')]?_0x427c25[_0x9481('0x38')]:_0x42df68[_0x9481('0x33')];if(!_0x56752e[_0x9481('0x35')][_0x9481('0x3b')](_0x9481('0x3c'))){_0x427c25['limit']=qs[_0x9481('0x20')](_0x56752e[_0x9481('0x35')]['limit']);_0x427c25['offset']=qs[_0x9481('0x1e')](_0x56752e['query'][_0x9481('0x1e')]);}_0x427c25[_0x9481('0x3d')]=qs[_0x9481('0x3e')](_0x56752e[_0x9481('0x35')]['sort']);_0x427c25[_0x9481('0x3f')]=qs['filters'](_[_0x9481('0x40')](_0x56752e['query'],_0x42df68[_0x9481('0x36')]),_0x5d9926);if(_0x56752e['query'][_0x9481('0x41')]){_0x427c25[_0x9481('0x3f')]=_[_0x9481('0x42')](_0x427c25[_0x9481('0x3f')],{'$or':_[_0x9481('0x34')](_0x5d9926,function(_0x3b7998){if(_0x3b7998[_0x9481('0x43')]!=='VIRTUAL'){var _0x464080={};_0x464080[_0x3b7998[_0x9481('0x2e')]]={'$like':'%'+_0x56752e[_0x9481('0x35')][_0x9481('0x41')]+'%'};return _0x464080;}})});}_0x427c25=_[_0x9481('0x42')]({},_0x427c25,_0x56752e[_0x9481('0x44')]);var _0x2e4241={'where':_0x427c25['where']};return db[_0x9481('0x45')][_0x9481('0x21')](_0x2e4241)['then'](function(_0x704e81){_0x2b33f8[_0x9481('0x21')]=_0x704e81;if(_0x56752e[_0x9481('0x35')][_0x9481('0x46')]){_0x427c25[_0x9481('0x47')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x9481('0x48')](_0x427c25);})['then'](function(_0x23811a){_0x2b33f8[_0x9481('0x49')]=_0x23811a;return _0x2b33f8;})['then'](respondWithFilteredResult(_0x1addc8,_0x427c25))['catch'](handleError(_0x1addc8,null));};exports[_0x9481('0x4a')]=function(_0x1d0df0,_0x42b19a){var _0x4c4caf={'raw':!![],'where':{'id':_0x1d0df0[_0x9481('0x4b')]['id']}},_0x4402f6={};_0x4402f6['model']=_['keys'](db[_0x9481('0x45')]['rawAttributes']);_0x4402f6[_0x9481('0x35')]=_[_0x9481('0x4c')](_0x1d0df0[_0x9481('0x35')]);_0x4402f6[_0x9481('0x36')]=_[_0x9481('0x37')](_0x4402f6['model'],_0x4402f6[_0x9481('0x35')]);_0x4c4caf[_0x9481('0x38')]=_['intersection'](_0x4402f6[_0x9481('0x33')],qs[_0x9481('0x39')](_0x1d0df0[_0x9481('0x35')][_0x9481('0x39')]));_0x4c4caf[_0x9481('0x38')]=_0x4c4caf[_0x9481('0x38')][_0x9481('0x3a')]?_0x4c4caf[_0x9481('0x38')]:_0x4402f6[_0x9481('0x33')];if(_0x1d0df0['query'][_0x9481('0x46')]){_0x4c4caf['include']=[{'all':!![]}];}_0x4c4caf=_['merge']({},_0x4c4caf,_0x1d0df0[_0x9481('0x44')]);return db['AnalyticDefaultReport'][_0x9481('0x4d')](_0x4c4caf)[_0x9481('0x27')](handleEntityNotFound(_0x42b19a,null))['then'](respondWithResult(_0x42b19a,null))[_0x9481('0x4e')](handleError(_0x42b19a,null));};exports[_0x9481('0x4f')]=function(_0x2f3413,_0x13b674){return db[_0x9481('0x45')][_0x9481('0x4f')](_0x2f3413['body'],{})['then'](function(_0x424b22){var _0x44d7e0=_0x2f3413[_0x9481('0x50')][_0x9481('0x28')]({'plain':!![]});if(!_0x44d7e0)throw new Error(_0x9481('0x51'));if(_0x44d7e0[_0x9481('0x52')]===_0x9481('0x50')){var _0x3d2250=_0x424b22['get']({'plain':!![]});var _0x3972c1=_0x9481('0x53');return db[_0x9481('0x54')][_0x9481('0x4d')]({'where':{'name':_0x3972c1,'userProfileId':_0x44d7e0[_0x9481('0x55')]},'raw':!![]})['then'](function(_0x4c3048){if(_0x4c3048&&_0x4c3048[_0x9481('0x56')]===0x0){return db[_0x9481('0x2a')][_0x9481('0x4f')]({'name':_0x3d2250['name'],'resourceId':_0x3d2250['id'],'type':'DefaultReports','sectionId':_0x4c3048['id']},{})['then'](function(){return _0x424b22;});}else{return _0x424b22;}})['catch'](function(_0x538507){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x538507);throw _0x538507;});}return _0x424b22;})[_0x9481('0x27')](respondWithResult(_0x13b674,0xc9))[_0x9481('0x4e')](handleError(_0x13b674,null));};exports['update']=function(_0xd8351c,_0x5f210c){if(_0xd8351c[_0x9481('0x57')]['id']){delete _0xd8351c[_0x9481('0x57')]['id'];}return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0xd8351c[_0x9481('0x4b')]['id']}})[_0x9481('0x27')](handleEntityNotFound(_0x5f210c,null))[_0x9481('0x27')](saveUpdates(_0xd8351c['body'],null))[_0x9481('0x27')](respondWithResult(_0x5f210c,null))[_0x9481('0x4e')](handleError(_0x5f210c,null));};exports['destroy']=function(_0x16416a,_0x1240dc){return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0x16416a[_0x9481('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1240dc,null))[_0x9481('0x27')](removeEntity(_0x1240dc,null))[_0x9481('0x4e')](handleError(_0x1240dc,null));};exports[_0x9481('0x58')]=function(_0x3fc0f9,_0x559dd2){var _0x3ac428=0xa;var _0x2927f5=[_0x9481('0x59'),_0x9481('0x5a'),'right_join','cross_join'];var _0x5b4234={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x589b16={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x239676=function(_0x205b96){return!_['includes'](['IS\x20NULL',_0x9481('0x67'),'IS\x20EMPTY',_0x9481('0x68')],_0x205b96);};var _0x59637f=function(_0x9af916){if(!_0x9af916||!_0x9af916[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x492464='(',_0x28d331=0x0;_0x28d331<_0x9af916[_0x9481('0x69')]['length'];_0x28d331+=0x1){_0x28d331>0x0&&(_0x492464+='\x20'+_0x9af916['operator']+'\x20');_0x492464+=_0x9af916['rules'][_0x28d331]['group']?_0x59637f(_0x9af916[_0x9481('0x69')][_0x28d331]['group']):_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6a')]+'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331]['condition']+(_0x239676(_0x9af916[_0x9481('0x69')][_0x28d331]['condition'])?'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6b')]:'');}return _0x492464+')';};var _0x3c267b={'where':{'id':_0x3fc0f9[_0x9481('0x4b')]['id']}},_0x4f157d,_0x2f20b4,_0x40fed2,_0x4ff016,_0x321972;_0x3c267b=_[_0x9481('0x42')]({},_0x3c267b,_0x3fc0f9[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x3c267b)[_0x9481('0x27')](function(_0x32ebde){if(_0x32ebde){_0x4f157d=_0x32ebde;return _0x32ebde[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x237d9b){if(_0x237d9b){if(!_0x237d9b[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x2f20b4=_0x237d9b;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})['then'](function(_0x1e05f8){if(_0x1e05f8){_0x40fed2=_['keyBy'](_0x1e05f8,'id');var _0x47bf37;var _0x1a7892=squel['select']();_0x1a7892['from'](_0x4f157d['table']);for(var _0x1b1967=0x0;_0x1b1967<_0x2f20b4[_0x9481('0x3a')];_0x1b1967+=0x1){_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x71')]?_0x40fed2[_0x2f20b4[_0x1b1967][_0x9481('0x71')]]['metric']:_0x2f20b4[_0x1b1967][_0x9481('0x6a')];_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x72')]?_[_0x9481('0x73')](_0x5b4234[_0x2f20b4[_0x1b1967][_0x9481('0x72')]],'%s',_0x47bf37):_0x47bf37;_0x47bf37=_0x2f20b4[_0x1b1967]['format']?_['replace'](_0x589b16[_0x2f20b4[_0x1b1967][_0x9481('0x74')]],'%s',_0x47bf37):_0x47bf37;if(_0x2f20b4[_0x1b1967][_0x9481('0x75')]){_0x1a7892[_0x9481('0x76')](_0x47bf37);}_0x2f20b4[_0x1b1967][_0x9481('0x77')]&&_0x1a7892[_0x9481('0x3d')](_0x47bf37,_0x2f20b4[_0x1b1967]['orderBy']===_0x9481('0x78')?![]:!![]);_0x1a7892[_0x9481('0x6a')](_0x47bf37,_0x2f20b4[_0x1b1967][_0x9481('0x79')]||_0x47bf37);}if(_0x4f157d[_0x9481('0x7a')]){_0x4f157d[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x4f157d[_0x9481('0x7a')]);for(var _0x42a6d2=0x0;_0x42a6d2<_0x4f157d[_0x9481('0x7a')][_0x9481('0x3a')];_0x42a6d2+=0x1){if(_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2927f5,_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')])&&_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7d')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7e')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7f')]){_0x1a7892[_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]](_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x4f157d['table'],_0x4f157d[_0x9481('0x7a')][_0x42a6d2]['parentKey'],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7f')]));}}}if(_0x4f157d[_0x9481('0x80')]){_0x4f157d[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x4f157d['conditions']);_0x1a7892[_0x9481('0x3f')](_0x59637f(_0x4f157d['conditions'][_0x9481('0x76')]));}_0x321972=_0x1a7892[_0x9481('0x81')]();_0x1a7892[_0x9481('0x20')](_0x3ac428);_0x1a7892['offset'](0x0);logger['debug']('Limited\x20Query:',_0x1a7892[_0x9481('0x82')]());return dbH['sequelize']['query'](_0x1a7892[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')]['SELECT']});}})[_0x9481('0x27')](respondWithResult(_0x559dd2,null))[_0x9481('0x4e')](handleError(_0x559dd2,null));};function runReport(_0x545457,_0x226932,_0x3c8241){var _0x1ea93a=_0x226932[_0x9481('0x2e')];var _0x5f4be2=0xa;var _0x2e585d=['join',_0x9481('0x5a'),_0x9481('0x85'),'cross_join'];var _0x1c82a1={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x9481('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x55b428={'SEC_TO_TIME':_0x9481('0x86'),'DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9481('0x66')};var _0x31e097=function(_0x339a30){return!_[_0x9481('0x7c')]([_0x9481('0x87'),_0x9481('0x67'),_0x9481('0x88'),_0x9481('0x68')],_0x339a30);};var _0x22e787=function(_0x31b70b){if(!_0x31b70b||!_0x31b70b['rules'][_0x9481('0x3a')]){return'';}for(var _0x5c430e='(',_0x4f55b5=0x0;_0x4f55b5<_0x31b70b['rules'][_0x9481('0x3a')];_0x4f55b5+=0x1){_0x4f55b5>0x0&&(_0x5c430e+='\x20'+_0x31b70b[_0x9481('0x89')]+'\x20');_0x5c430e+=_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x76')]?_0x22e787(_0x31b70b[_0x9481('0x69')][_0x4f55b5]['group']):_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6a')]+'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')]+(_0x31e097(_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')])?'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6b')]:'');}return _0x5c430e+')';};var _0x28d924={'where':{'id':_0x545457['id']}},_0x426d56,_0x5808c8,_0x27be69,_0x1d49ba,_0x458a6f;_0x28d924=_[_0x9481('0x42')]({},_0x28d924,_0x3c8241);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x28d924)[_0x9481('0x27')](function(_0x1173e9){if(_0x1173e9){_0x426d56=_0x1173e9;return _0x1173e9[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x5557d7){if(_0x5557d7){if(!_0x5557d7[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x5808c8=_0x5557d7;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x3ae3e2){if(_0x3ae3e2){_0x27be69=_[_0x9481('0x8b')](_0x3ae3e2,'id');var _0x538fe0;var _0x44e2c2=squel['select']();_0x44e2c2['from'](_0x426d56[_0x9481('0x8c')]);for(var _0x382455=0x0;_0x382455<_0x5808c8[_0x9481('0x3a')];_0x382455+=0x1){_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x71')]?_0x27be69[_0x5808c8[_0x382455][_0x9481('0x71')]][_0x9481('0x8d')]:_0x5808c8[_0x382455]['field'];_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x72')]?_['replace'](_0x1c82a1[_0x5808c8[_0x382455][_0x9481('0x72')]],'%s',_0x538fe0):_0x538fe0;_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x74')]?_[_0x9481('0x73')](_0x55b428[_0x5808c8[_0x382455]['format']],'%s',_0x538fe0):_0x538fe0;if(_0x5808c8[_0x382455]['groupBy']){_0x44e2c2[_0x9481('0x76')](_0x538fe0);}_0x5808c8[_0x382455][_0x9481('0x77')]&&_0x44e2c2[_0x9481('0x3d')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x44e2c2[_0x9481('0x6a')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x79')]||_0x538fe0);}if(_0x426d56[_0x9481('0x7a')]){_0x426d56[_0x9481('0x7a')]=JSON['parse'](_0x426d56[_0x9481('0x7a')]);for(var _0xd64114=0x0;_0xd64114<_0x426d56['joins'][_0x9481('0x3a')];_0xd64114+=0x1){if(_0x426d56['joins'][_0xd64114][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2e585d,_0x426d56['joins'][_0xd64114][_0x9481('0x43')])&&_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')]&&_0x426d56['joins'][_0xd64114][_0x9481('0x7e')]&&_0x426d56[_0x9481('0x7a')][_0xd64114]['foreignKey']){_0x44e2c2[_0x426d56[_0x9481('0x7a')][_0xd64114]['type']](_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x426d56['table'],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7f')]));}}}if(_0x426d56['conditions']){_0x426d56[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x426d56[_0x9481('0x80')]);_0x44e2c2[_0x9481('0x3f')](_0x22e787(_0x426d56[_0x9481('0x80')][_0x9481('0x76')]));}_0x458a6f=_0x44e2c2[_0x9481('0x81')]();_0x44e2c2['limit'](_0x5f4be2);_0x44e2c2[_0x9481('0x1e')](0x0);return;}})[_0x9481('0x27')](function(){if(_0x226932[_0x9481('0x8e')]===_0x9481('0x8f')){return null;}var _0x4e5a8d=_[_0x9481('0x42')](_0x226932,{'name':_0x226932[_0x9481('0x90')]||_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],'basename':_0x1ea93a,'savename':util['format'](_0x9481('0x91'),_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],require(_0x9481('0x92'))[_0x9481('0x93')](0x4),_0x226932[_0x9481('0x8e')]||_0x9481('0x94')),'reportId':_0x426d56['id'],'reportType':_0x9481('0x95')});return db[_0x9481('0x96')][_0x9481('0x4f')](_0x4e5a8d,{'raw':!![]});})[_0x9481('0x27')](function(_0x5930d6){if(_0x426d56[_0x9481('0x8c')]==='cdr'){_0x458a6f[_0x9481('0x3f')](_0x426d56[_0x9481('0x8c')]+_0x9481('0x97'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}else{_0x458a6f['where'](_0x426d56[_0x9481('0x8c')]+_0x9481('0x9a'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}if(_0x5930d6){logger[_0x9481('0x9b')](_0x9481('0x9c'),_0x458a6f['toString']());require(_0x9481('0x9d'))[_0x9481('0x9e')](path[_0x9481('0x59')](__dirname,_0x9481('0x9f'),_0x5930d6[_0x9481('0x8e')]),[_0x5930d6['id'],_0x458a6f[_0x9481('0x82')](),path[_0x9481('0x59')](__dirname,_0x9481('0xa0'),_0x5930d6[_0x9481('0xa1')]),_0x1ea93a]);return _0x5930d6;}else{var _0x26a666=squel[_0x9481('0xa2')]();_0x26a666[_0x9481('0xa3')]('('+_0x458a6f['toString']()+')',_0x9481('0xa4'));_0x26a666[_0x9481('0x6a')](_0x9481('0xa5'),_0x9481('0x21'));_0x458a6f[_0x9481('0x20')](_0x226932[_0x9481('0x20')]||_0x5f4be2);_0x458a6f[_0x9481('0x1e')](_0x226932[_0x9481('0x1e')]||0x0);return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x26a666[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]})[_0x9481('0x27')](function(_0xcf83d2){if(!_0xcf83d2[_0x9481('0x3a')]){_0x1d49ba=0x0;}else{_0x1d49ba=_0xcf83d2[0x0][_0x9481('0x21')]||0x0;}return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x458a6f['toString'](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});})[_0x9481('0x27')](function(_0x4553fc){return{'rows':_0x4553fc||[],'count':_0x1d49ba};});}});}exports[_0x9481('0xa7')]=function(_0x55c4ab,_0x57928a){return runReport(_0x55c4ab[_0x9481('0x4b')],_0x55c4ab[_0x9481('0x35')],_0x55c4ab[_0x9481('0x44')])[_0x9481('0x27')](respondWithResult(_0x57928a,null))['catch'](handleError(_0x57928a,null));};exports['runReport']=runReport;exports['query']=function(_0x52b980,_0x5792b1){var _0x3a199b=0xa;var _0x4b779b=[_0x9481('0x59'),_0x9481('0x5a'),_0x9481('0x85'),_0x9481('0xa8')];var _0x55a65f={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':_0x9481('0xa9'),'MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x583490={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':'HOUR(%s)','ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x1e40fe=function(_0x26c87b){return!_[_0x9481('0x7c')](['IS\x20NULL',_0x9481('0x67'),_0x9481('0x88'),'IS\x20NOT\x20EMPTY'],_0x26c87b);};var _0x4ea411=function(_0x1cdca0){if(!_0x1cdca0||!_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x15c53f='(',_0x7ee854=0x0;_0x7ee854<_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')];_0x7ee854+=0x1){_0x7ee854>0x0&&(_0x15c53f+='\x20'+_0x1cdca0[_0x9481('0x89')]+'\x20');_0x15c53f+=_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x76')]?_0x4ea411(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x76')]):_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x6a')]+'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x8a')]+(_0x1e40fe(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x8a')])?'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854]['value']:'');}return _0x15c53f+')';};var _0x49a6db={'where':{'id':_0x52b980['params']['id']}},_0x224b16,_0x83543f,_0x58c043,_0x97a67a,_0xe157e4;_0x49a6db=_[_0x9481('0x42')]({},_0x49a6db,_0x52b980[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x49a6db)['then'](function(_0x1a1058){if(_0x1a1058){_0x224b16=_0x1a1058;return _0x1a1058['getFields']();}return null;})[_0x9481('0x27')](function(_0x206661){if(_0x206661){if(!_0x206661[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x83543f=_0x206661;return db['AnalyticMetric'][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x40cdf9){if(_0x40cdf9){_0x58c043=_['keyBy'](_0x40cdf9,'id');var _0x5467fe;var _0x440d88=squel['select']();_0x440d88[_0x9481('0xa3')](_0x224b16['table']);for(var _0x2a0367=0x0;_0x2a0367<_0x83543f[_0x9481('0x3a')];_0x2a0367+=0x1){_0x5467fe=_0x83543f[_0x2a0367]['MetricId']?_0x58c043[_0x83543f[_0x2a0367][_0x9481('0x71')]][_0x9481('0x8d')]:_0x83543f[_0x2a0367][_0x9481('0x6a')];_0x5467fe=_0x83543f[_0x2a0367]['function']?_[_0x9481('0x73')](_0x55a65f[_0x83543f[_0x2a0367][_0x9481('0x72')]],'%s',_0x5467fe):_0x5467fe;_0x5467fe=_0x83543f[_0x2a0367][_0x9481('0x74')]?_[_0x9481('0x73')](_0x583490[_0x83543f[_0x2a0367][_0x9481('0x74')]],'%s',_0x5467fe):_0x5467fe;if(_0x83543f[_0x2a0367][_0x9481('0x75')]){_0x440d88[_0x9481('0x76')](_0x5467fe);}_0x83543f[_0x2a0367]['orderBy']&&_0x440d88[_0x9481('0x3d')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x440d88[_0x9481('0x6a')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x79')]||_0x5467fe);}if(_0x224b16['joins']){_0x224b16[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x7a')]);for(var _0x527ef6=0x0;_0x527ef6<_0x224b16['joins'][_0x9481('0x3a')];_0x527ef6+=0x1){if(_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x4b779b,_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')])&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7d')]&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')]&&_0x224b16['joins'][_0x527ef6][_0x9481('0x7f')]){_0x440d88[_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]](_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x224b16[_0x9481('0x8c')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['parentKey'],_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['foreignKey']));}}}if(_0x224b16[_0x9481('0x80')]){_0x224b16[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x80')]);_0x440d88['where'](_0x4ea411(_0x224b16[_0x9481('0x80')][_0x9481('0x76')]));}_0xe157e4=_0x440d88[_0x9481('0x81')]();_0x440d88[_0x9481('0x20')](_0x3a199b);_0x440d88['offset'](0x0);logger[_0x9481('0xaa')](_0x9481('0xab'),_0x440d88[_0x9481('0x82')]());return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x440d88[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});}})[_0x9481('0x27')](function(){return{'sql':_0xe157e4['toString']()};})[_0x9481('0x27')](respondWithResult(_0x5792b1,null))[_0x9481('0x4e')](handleError(_0x5792b1,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 8d7d29f..6762643 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 _0xb1b1=['moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api'];(function(_0x184ec8,_0xf0c34e){var _0x4ed9af=function(_0x4731e7){while(--_0x4731e7){_0x184ec8['push'](_0x184ec8['shift']());}};_0x4ed9af(++_0xf0c34e);}(_0xb1b1,0xa5));var _0x1b1b=function(_0x574ca8,_0x4d3709){_0x574ca8=_0x574ca8-0x0;var _0x37545d=_0xb1b1[_0x574ca8];return _0x37545d;};'use strict';var _=require(_0x1b1b('0x0'));var util=require(_0x1b1b('0x1'));var logger=require(_0x1b1b('0x2'))(_0x1b1b('0x3'));var moment=require(_0x1b1b('0x4'));var BPromise=require(_0x1b1b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b1b('0x6'));var rimraf=require(_0x1b1b('0x7'));var config=require(_0x1b1b('0x8'));var attributes=require(_0x1b1b('0x9'));module['exports']=function(_0x5a2545,_0x38b6fa){return _0x5a2545[_0x1b1b('0xa')](_0x1b1b('0xb'),attributes,{'tableName':_0x1b1b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ec6=['api','moment','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger'];(function(_0x14c36a,_0x312762){var _0x396f70=function(_0x9f0d39){while(--_0x9f0d39){_0x14c36a['push'](_0x14c36a['shift']());}};_0x396f70(++_0x312762);}(_0x4ec6,0x1ab));var _0x64ec=function(_0xdd2162,_0x40d338){_0xdd2162=_0xdd2162-0x0;var _0x428d83=_0x4ec6[_0xdd2162];return _0x428d83;};'use strict';var _=require('lodash');var util=require(_0x64ec('0x0'));var logger=require(_0x64ec('0x1'))(_0x64ec('0x2'));var moment=require(_0x64ec('0x3'));var BPromise=require(_0x64ec('0x4'));var rp=require(_0x64ec('0x5'));var fs=require('fs');var path=require(_0x64ec('0x6'));var rimraf=require(_0x64ec('0x7'));var config=require('../../config/environment');var attributes=require(_0x64ec('0x8'));module['exports']=function(_0x3be8e4,_0x4e8ca4){return _0x3be8e4['define'](_0x64ec('0x9'),attributes,{'tableName':_0x64ec('0xa'),'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 1e61775..7ee6771 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 _0x7a56=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4b8fc7,_0x5022fc){var _0x249f4a=function(_0x1b25d4){while(--_0x1b25d4){_0x4b8fc7['push'](_0x4b8fc7['shift']());}};_0x249f4a(++_0x5022fc);}(_0x7a56,0x1a6));var _0x67a5=function(_0x9f4c61,_0x249fcc){_0x9f4c61=_0x9f4c61-0x0;var _0x32166f=_0x7a56[_0x9f4c61];return _0x32166f;};'use strict';var _=require(_0x67a5('0x0'));var util=require('util');var moment=require(_0x67a5('0x1'));var BPromise=require(_0x67a5('0x2'));var rs=require(_0x67a5('0x3'));var fs=require('fs');var Redis=require(_0x67a5('0x4'));var db=require(_0x67a5('0x5'))['db'];var utils=require(_0x67a5('0x6'));var logger=require('../../config/logger')(_0x67a5('0x7'));var config=require(_0x67a5('0x8'));var jayson=require(_0x67a5('0x9'));var client=jayson['client'][_0x67a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16b4aa,_0x4c85f1,_0x19aab4){return new BPromise(function(_0x274f8a,_0x28b73d){return client[_0x67a5('0xb')](_0x16b4aa,_0x19aab4)[_0x67a5('0xc')](function(_0x3e357f){logger[_0x67a5('0xd')](_0x67a5('0xe'),_0x4c85f1,_0x67a5('0xf'));logger[_0x67a5('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x4c85f1,_0x67a5('0xf'),JSON[_0x67a5('0x11')](_0x3e357f));if(_0x3e357f[_0x67a5('0x12')]){if(_0x3e357f[_0x67a5('0x12')]['code']===0x1f4){logger[_0x67a5('0x12')](_0x67a5('0xe'),_0x4c85f1,_0x3e357f[_0x67a5('0x12')][_0x67a5('0x13')]);return _0x28b73d(_0x3e357f['error'][_0x67a5('0x13')]);}logger['error'](_0x67a5('0xe'),_0x4c85f1,_0x3e357f[_0x67a5('0x12')][_0x67a5('0x13')]);return _0x274f8a(_0x3e357f[_0x67a5('0x12')][_0x67a5('0x13')]);}else{logger[_0x67a5('0xd')](_0x67a5('0xe'),_0x4c85f1,_0x67a5('0xf'));_0x274f8a(_0x3e357f[_0x67a5('0x14')]['message']);}})['catch'](function(_0x4fae74){logger['error'](_0x67a5('0xe'),_0x4c85f1,_0x4fae74);_0x28b73d(_0x4fae74);});});} \ No newline at end of file +var _0x859d=['lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5b97a3,_0xdd8f3c){var _0x2f3472=function(_0x208b6b){while(--_0x208b6b){_0x5b97a3['push'](_0x5b97a3['shift']());}};_0x2f3472(++_0xdd8f3c);}(_0x859d,0x160));var _0xd859=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x859d[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0xd859('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd859('0x1'));var fs=require('fs');var Redis=require(_0xd859('0x2'));var db=require(_0xd859('0x3'))['db'];var utils=require(_0xd859('0x4'));var logger=require(_0xd859('0x5'))('rpc');var config=require(_0xd859('0x6'));var jayson=require(_0xd859('0x7'));var client=jayson[_0xd859('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34ec67,_0x4ecbdf,_0x2348e2){return new BPromise(function(_0x25cf6b,_0x10c885){return client[_0xd859('0x9')](_0x34ec67,_0x2348e2)[_0xd859('0xa')](function(_0x503367){logger[_0xd859('0xb')](_0xd859('0xc'),_0x4ecbdf,_0xd859('0xd'));logger[_0xd859('0xe')](_0xd859('0xf'),_0x4ecbdf,_0xd859('0xd'),JSON[_0xd859('0x10')](_0x503367));if(_0x503367[_0xd859('0x11')]){if(_0x503367['error'][_0xd859('0x12')]===0x1f4){logger[_0xd859('0x11')](_0xd859('0xc'),_0x4ecbdf,_0x503367[_0xd859('0x11')]['message']);return _0x10c885(_0x503367['error'][_0xd859('0x13')]);}logger[_0xd859('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4ecbdf,_0x503367['error']['message']);return _0x25cf6b(_0x503367[_0xd859('0x11')]['message']);}else{logger[_0xd859('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4ecbdf,_0xd859('0xd'));_0x25cf6b(_0x503367[_0xd859('0x14')][_0xd859('0x13')]);}})[_0xd859('0x15')](function(_0x2efc9a){logger['error'](_0xd859('0xc'),_0x4ecbdf,_0x2efc9a);_0x10c885(_0x2efc9a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 6a5a3b7..3e06f4b 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 _0x8de8=['show','/:id/run','run','/:id/query','query','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','isAuthenticated'];(function(_0x4f51f9,_0x5d5613){var _0x533984=function(_0x578319){while(--_0x578319){_0x4f51f9['push'](_0x4f51f9['shift']());}};_0x533984(++_0x5d5613);}(_0x8de8,0x19d));var _0x88de=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8de8[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x88de('0x0'));var util=require('util');var path=require(_0x88de('0x1'));var timeout=require(_0x88de('0x2'));var express=require(_0x88de('0x3'));var router=express['Router']();var fs_extra=require(_0x88de('0x4'));var auth=require(_0x88de('0x5'));var interaction=require(_0x88de('0x6'));var config=require(_0x88de('0x7'));var controller=require(_0x88de('0x8'));router[_0x88de('0x9')]('/',auth['isAuthenticated'](),controller[_0x88de('0xa')]);router[_0x88de('0x9')]('/:id',auth[_0x88de('0xb')](),controller[_0x88de('0xc')]);router[_0x88de('0x9')]('/:id/preview',auth[_0x88de('0xb')](),controller['preview']);router[_0x88de('0x9')](_0x88de('0xd'),auth['isAuthenticated'](),controller[_0x88de('0xe')]);router[_0x88de('0x9')](_0x88de('0xf'),auth[_0x88de('0xb')](),controller[_0x88de('0x10')]);router[_0x88de('0x11')]('/',auth[_0x88de('0xb')](),controller[_0x88de('0x12')]);router[_0x88de('0x13')](_0x88de('0x14'),auth[_0x88de('0xb')](),controller[_0x88de('0x15')]);router[_0x88de('0x16')](_0x88de('0x14'),auth[_0x88de('0xb')](),controller[_0x88de('0x17')]);module[_0x88de('0x18')]=router; \ No newline at end of file +var _0x1805=['preview','/:id/query','post','create','put','update','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview'];(function(_0x235499,_0x5cbe87){var _0x11f7e5=function(_0x540a78){while(--_0x540a78){_0x235499['push'](_0x235499['shift']());}};_0x11f7e5(++_0x5cbe87);}(_0x1805,0x1bf));var _0x5180=function(_0x5718e8,_0x1f861f){_0x5718e8=_0x5718e8-0x0;var _0xd7a6ae=_0x1805[_0x5718e8];return _0xd7a6ae;};'use strict';var multer=require('multer');var util=require(_0x5180('0x0'));var path=require(_0x5180('0x1'));var timeout=require(_0x5180('0x2'));var express=require('express');var router=express[_0x5180('0x3')]();var fs_extra=require(_0x5180('0x4'));var auth=require(_0x5180('0x5'));var interaction=require(_0x5180('0x6'));var config=require(_0x5180('0x7'));var controller=require(_0x5180('0x8'));router[_0x5180('0x9')]('/',auth[_0x5180('0xa')](),controller[_0x5180('0xb')]);router[_0x5180('0x9')](_0x5180('0xc'),auth[_0x5180('0xa')](),controller[_0x5180('0xd')]);router['get'](_0x5180('0xe'),auth[_0x5180('0xa')](),controller[_0x5180('0xf')]);router[_0x5180('0x9')]('/:id/run',auth[_0x5180('0xa')](),controller['run']);router[_0x5180('0x9')](_0x5180('0x10'),auth[_0x5180('0xa')](),controller['query']);router[_0x5180('0x11')]('/',auth[_0x5180('0xa')](),controller[_0x5180('0x12')]);router[_0x5180('0x13')](_0x5180('0xc'),auth[_0x5180('0xa')](),controller[_0x5180('0x14')]);router['delete'](_0x5180('0xc'),auth[_0x5180('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 4e7580c..e6d689c 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 _0x5b77=['csv','DATE','Loading','manual','UNSIGNED','moment','STRING','ENUM','pdf'];(function(_0xa35521,_0x57e641){var _0x163a84=function(_0x3dffb8){while(--_0x3dffb8){_0xa35521['push'](_0xa35521['shift']());}};_0x163a84(++_0x57e641);}(_0x5b77,0x16d));var _0x75b7=function(_0x5e66ee,_0x253816){_0x5e66ee=_0x5e66ee-0x0;var _0x2ee916=_0x5b77[_0x5e66ee];return _0x2ee916;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x75b7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x75b7('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x75b7('0x2')]('csv',_0x75b7('0x3'),'xlsx'),'allowNull':![],'defaultValue':_0x75b7('0x4')},'savename':{'type':Sequelize[_0x75b7('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x75b7('0x5')]},'endDate':{'type':Sequelize[_0x75b7('0x5')]},'status':{'type':Sequelize[_0x75b7('0x1')],'defaultValue':_0x75b7('0x6')},'type':{'type':Sequelize['ENUM']('manual','scheduled'),'allowNull':![],'defaultValue':_0x75b7('0x7')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x75b7('0x8')]},'reportType':{'type':Sequelize[_0x75b7('0x1')]}}; \ No newline at end of file +var _0xf5cc=['UNSIGNED','sequelize','exports','STRING','ENUM','pdf','csv','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x5cc276,_0x147a8a){var _0x4604a0=function(_0x63d9a1){while(--_0x63d9a1){_0x5cc276['push'](_0x5cc276['shift']());}};_0x4604a0(++_0x147a8a);}(_0xf5cc,0x91));var _0xcf5c=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0xf5cc[_0xe39824];return _0x4bc31e;};'use strict';var Sequelize=require(_0xcf5c('0x0'));var moment=require('moment');module[_0xcf5c('0x1')]={'name':{'type':Sequelize[_0xcf5c('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xcf5c('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xcf5c('0x3')]('csv',_0xcf5c('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0xcf5c('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xcf5c('0x6')]},'endDate':{'type':Sequelize[_0xcf5c('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xcf5c('0x7')},'type':{'type':Sequelize[_0xcf5c('0x3')](_0xcf5c('0x8'),_0xcf5c('0x9')),'allowNull':![],'defaultValue':_0xcf5c('0x8')},'reportId':{'type':Sequelize[_0xcf5c('0xa')](0xb)[_0xcf5c('0xb')]},'reportType':{'type':Sequelize[_0xcf5c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 71ab1dd..60e585c 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 _0x02d4=['undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','length','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','basename','existsSync','join','root','server/files/reports','savename','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json'];(function(_0xf5d574,_0x116b8e){var _0x352179=function(_0x2e469a){while(--_0x2e469a){_0xf5d574['push'](_0xf5d574['shift']());}};_0x352179(++_0x116b8e);}(_0x02d4,0x10c));var _0x402d=function(_0xfe4643,_0x319959){_0xfe4643=_0xfe4643-0x0;var _0x22f100=_0x02d4[_0xfe4643];return _0x22f100;};'use strict';var emlformat=require(_0x402d('0x0'));var rimraf=require(_0x402d('0x1'));var zipdir=require(_0x402d('0x2'));var jsonpatch=require(_0x402d('0x3'));var rp=require(_0x402d('0x4'));var moment=require(_0x402d('0x5'));var BPromise=require(_0x402d('0x6'));var Mustache=require(_0x402d('0x7'));var util=require(_0x402d('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x402d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x402d('0xa'));var _=require(_0x402d('0xb'));var squel=require('squel');var crypto=require(_0x402d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x402d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x402d('0xe'));var Papa=require('papaparse');var Redis=require(_0x402d('0xf'));var authService=require(_0x402d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x402d('0x11'));var hardwareService=require(_0x402d('0x12'));var logger=require('../../config/logger')(_0x402d('0x13'));var utils=require('../../config/utils');var config=require(_0x402d('0x14'));var licenseUtil=require(_0x402d('0x15'));var db=require(_0x402d('0x16'))['db'];function respondWithStatusCode(_0x33f121,_0x42a821){_0x42a821=_0x42a821||0xcc;return function(_0x1bec0b){if(_0x1bec0b){return _0x33f121['sendStatus'](_0x42a821);}return _0x33f121[_0x402d('0x17')](_0x42a821)[_0x402d('0x18')]();};}function respondWithResult(_0x34b3e4,_0x1fec7a){_0x1fec7a=_0x1fec7a||0xc8;return function(_0x4411a9){if(_0x4411a9){return _0x34b3e4[_0x402d('0x17')](_0x1fec7a)[_0x402d('0x19')](_0x4411a9);}};}function respondWithFilteredResult(_0x238b47,_0x49c57b){return function(_0x4ef506){if(_0x4ef506){var _0x196580=typeof _0x49c57b['offset']===_0x402d('0x1a')&&typeof _0x49c57b[_0x402d('0x1b')]===_0x402d('0x1a');var _0x32539f=_0x4ef506[_0x402d('0x1c')];var _0x37ffaf=_0x196580?0x0:_0x49c57b[_0x402d('0x1d')];var _0x3753a9=_0x196580?_0x4ef506[_0x402d('0x1c')]:_0x49c57b[_0x402d('0x1d')]+_0x49c57b[_0x402d('0x1b')];var _0x52c9fc;if(_0x3753a9>=_0x32539f){_0x3753a9=_0x32539f;_0x52c9fc=0xc8;}else{_0x52c9fc=0xce;}_0x238b47['status'](_0x52c9fc);return _0x238b47[_0x402d('0x1e')](_0x402d('0x1f'),_0x37ffaf+'-'+_0x3753a9+'/'+_0x32539f)[_0x402d('0x19')](_0x4ef506);}return null;};}function patchUpdates(_0x51a135){return function(_0x45df72){try{jsonpatch[_0x402d('0x20')](_0x45df72,_0x51a135,!![]);}catch(_0x5ebd2e){return BPromise[_0x402d('0x21')](_0x5ebd2e);}return _0x45df72['save']();};}function saveUpdates(_0x5b473d,_0x565de2){return function(_0x4759cd){if(_0x4759cd){return _0x4759cd['update'](_0x5b473d)[_0x402d('0x22')](function(_0x5b8172){return _0x5b8172;});}return null;};}function removeEntity(_0x33d322,_0x202c74){return function(_0x3148d8){if(_0x3148d8){return _0x3148d8[_0x402d('0x23')]()['then'](function(){var _0x3ab49c=_0x3148d8[_0x402d('0x24')]({'plain':!![]});var _0x57847e=_0x402d('0x25');return db[_0x402d('0x26')][_0x402d('0x23')]({'where':{'type':_0x57847e,'resourceId':_0x3ab49c['id']}})['then'](function(){return _0x3148d8;});})[_0x402d('0x22')](function(){_0x33d322[_0x402d('0x17')](0xcc)[_0x402d('0x18')]();});}};}function handleEntityNotFound(_0x9c7ba5,_0x1b6dae){return function(_0x41ba4f){if(!_0x41ba4f){_0x9c7ba5[_0x402d('0x27')](0x194);}return _0x41ba4f;};}function handleError(_0x57b51d,_0x31c999){_0x31c999=_0x31c999||0x1f4;return function(_0x4002d2){logger['error'](_0x4002d2['stack']);if(_0x4002d2[_0x402d('0x28')]){delete _0x4002d2[_0x402d('0x28')];}_0x57b51d['status'](_0x31c999)[_0x402d('0x29')](_0x4002d2);};}exports['index']=function(_0x2f405e,_0x27813b){var _0x2b895d={},_0x422362={},_0x212831={'count':0x0,'rows':[]};var _0x313cdb=_[_0x402d('0x2a')](db[_0x402d('0x2b')][_0x402d('0x2c')],function(_0x4dda71){return{'name':_0x4dda71[_0x402d('0x2d')],'type':_0x4dda71[_0x402d('0x2e')][_0x402d('0x2f')]};});_0x422362[_0x402d('0x30')]=_[_0x402d('0x2a')](_0x313cdb,'name');_0x422362[_0x402d('0x31')]=_['keys'](_0x2f405e[_0x402d('0x31')]);_0x422362['filters']=_['intersection'](_0x422362['model'],_0x422362['query']);_0x2b895d[_0x402d('0x32')]=_[_0x402d('0x33')](_0x422362[_0x402d('0x30')],qs[_0x402d('0x34')](_0x2f405e[_0x402d('0x31')][_0x402d('0x34')]));_0x2b895d['attributes']=_0x2b895d[_0x402d('0x32')]['length']?_0x2b895d[_0x402d('0x32')]:_0x422362[_0x402d('0x30')];if(!_0x2f405e[_0x402d('0x31')][_0x402d('0x35')](_0x402d('0x36'))){_0x2b895d[_0x402d('0x1b')]=qs[_0x402d('0x1b')](_0x2f405e[_0x402d('0x31')]['limit']);_0x2b895d[_0x402d('0x1d')]=qs[_0x402d('0x1d')](_0x2f405e[_0x402d('0x31')][_0x402d('0x1d')]);}_0x2b895d[_0x402d('0x37')]=qs[_0x402d('0x38')](_0x2f405e['query'][_0x402d('0x38')]);_0x2b895d['where']=qs['filters'](_[_0x402d('0x39')](_0x2f405e['query'],_0x422362[_0x402d('0x3a')]),_0x313cdb);if(_0x2f405e[_0x402d('0x31')][_0x402d('0x3b')]){_0x2b895d[_0x402d('0x3c')]=_[_0x402d('0x3d')](_0x2b895d['where'],{'$or':_[_0x402d('0x2a')](_0x313cdb,function(_0x439845){if(_0x439845[_0x402d('0x2e')]!==_0x402d('0x3e')){var _0x22fcd5={};_0x22fcd5[_0x439845['name']]={'$like':'%'+_0x2f405e[_0x402d('0x31')][_0x402d('0x3b')]+'%'};return _0x22fcd5;}})});}_0x2b895d=_['merge']({},_0x2b895d,_0x2f405e['options']);var _0x3cda2c={'where':_0x2b895d[_0x402d('0x3c')]};return db[_0x402d('0x2b')][_0x402d('0x1c')](_0x3cda2c)[_0x402d('0x22')](function(_0xd49cc9){_0x212831[_0x402d('0x1c')]=_0xd49cc9;if(_0x2f405e[_0x402d('0x31')][_0x402d('0x3f')]){_0x2b895d[_0x402d('0x40')]=[{'all':!![]}];}return db[_0x402d('0x2b')][_0x402d('0x41')](_0x2b895d);})[_0x402d('0x22')](function(_0x520b9f){_0x212831[_0x402d('0x42')]=_0x520b9f;return _0x212831;})[_0x402d('0x22')](respondWithFilteredResult(_0x27813b,_0x2b895d))['catch'](handleError(_0x27813b,null));};exports[_0x402d('0x43')]=function(_0x2ef6ae,_0x5165a5){var _0x504252={'raw':!![],'where':{'id':_0x2ef6ae[_0x402d('0x44')]['id']}},_0x4e1db9={};_0x4e1db9[_0x402d('0x30')]=_[_0x402d('0x45')](db[_0x402d('0x2b')]['rawAttributes']);_0x4e1db9[_0x402d('0x31')]=_[_0x402d('0x45')](_0x2ef6ae[_0x402d('0x31')]);_0x4e1db9[_0x402d('0x3a')]=_[_0x402d('0x33')](_0x4e1db9[_0x402d('0x30')],_0x4e1db9[_0x402d('0x31')]);_0x504252[_0x402d('0x32')]=_[_0x402d('0x33')](_0x4e1db9[_0x402d('0x30')],qs[_0x402d('0x34')](_0x2ef6ae[_0x402d('0x31')]['fields']));_0x504252[_0x402d('0x32')]=_0x504252[_0x402d('0x32')][_0x402d('0x46')]?_0x504252['attributes']:_0x4e1db9['model'];if(_0x2ef6ae[_0x402d('0x31')][_0x402d('0x3f')]){_0x504252[_0x402d('0x40')]=[{'all':!![]}];}_0x504252=_['merge']({},_0x504252,_0x2ef6ae[_0x402d('0x47')]);return db[_0x402d('0x2b')][_0x402d('0x48')](_0x504252)[_0x402d('0x22')](handleEntityNotFound(_0x5165a5,null))[_0x402d('0x22')](respondWithResult(_0x5165a5,null))[_0x402d('0x49')](handleError(_0x5165a5,null));};exports[_0x402d('0x4a')]=function(_0x2370ca,_0x1af4cc){return db[_0x402d('0x2b')][_0x402d('0x4a')](_0x2370ca[_0x402d('0x4b')],{})[_0x402d('0x22')](function(_0x575906){var _0x376016=_0x2370ca['user'][_0x402d('0x24')]({'plain':!![]});if(!_0x376016)throw new Error(_0x402d('0x4c'));if(_0x376016[_0x402d('0x4d')]===_0x402d('0x4e')){var _0xbed40b=_0x575906[_0x402d('0x24')]({'plain':!![]});var _0x444294=_0x402d('0x25');return db['UserProfileSection'][_0x402d('0x48')]({'where':{'name':_0x444294,'userProfileId':_0x376016[_0x402d('0x4f')]},'raw':!![]})[_0x402d('0x22')](function(_0x11e18e){if(_0x11e18e&&_0x11e18e[_0x402d('0x50')]===0x0){return db[_0x402d('0x26')][_0x402d('0x4a')]({'name':_0xbed40b[_0x402d('0x28')],'resourceId':_0xbed40b['id'],'type':_0x11e18e[_0x402d('0x28')],'sectionId':_0x11e18e['id']},{})[_0x402d('0x22')](function(){return _0x575906;});}else{return _0x575906;}})[_0x402d('0x49')](function(_0x157d59){logger[_0x402d('0x51')](_0x402d('0x52'),_0x157d59);throw _0x157d59;});}return _0x575906;})['then'](respondWithResult(_0x1af4cc,0xc9))[_0x402d('0x49')](handleError(_0x1af4cc,null));};exports[_0x402d('0x53')]=function(_0x5b8074,_0x1d84d0){if(_0x5b8074[_0x402d('0x4b')]['id']){delete _0x5b8074[_0x402d('0x4b')]['id'];}return db['AnalyticExtractedReport'][_0x402d('0x48')]({'where':{'id':_0x5b8074[_0x402d('0x44')]['id']}})[_0x402d('0x22')](handleEntityNotFound(_0x1d84d0,null))['then'](saveUpdates(_0x5b8074['body'],null))[_0x402d('0x22')](respondWithResult(_0x1d84d0,null))[_0x402d('0x49')](handleError(_0x1d84d0,null));};exports[_0x402d('0x23')]=function(_0x3be87a,_0x293206){return db['AnalyticExtractedReport'][_0x402d('0x48')]({'where':{'id':_0x3be87a[_0x402d('0x44')]['id']}})[_0x402d('0x22')](handleEntityNotFound(_0x293206,null))['then'](removeEntity(_0x293206,null))[_0x402d('0x49')](handleError(_0x293206,null));};exports['download']=function(_0x19f682,_0x1fc4f1,_0x57eae9){return db[_0x402d('0x2b')][_0x402d('0x48')]({'where':{'id':_0x19f682[_0x402d('0x44')]['id']},'attributes':[_0x402d('0x28'),_0x402d('0x54'),'savename','output'],'raw':!![]})[_0x402d('0x22')](handleEntityNotFound(_0x1fc4f1,null))[_0x402d('0x22')](function(_0x5314ee){if(_0x5314ee){if(!fs[_0x402d('0x55')](path[_0x402d('0x56')](config[_0x402d('0x57')],_0x402d('0x58'),_0x5314ee[_0x402d('0x59')]))){throw new db['Sequelize'][(_0x402d('0x5a'))](_0x402d('0x5b'));}if(_0x19f682[_0x402d('0x31')][_0x402d('0x5c')]){return _0x1fc4f1[_0x402d('0x27')](0xc8);}return _0x1fc4f1[_0x402d('0x5d')](path[_0x402d('0x56')](config[_0x402d('0x57')],'server/files/reports',_0x5314ee[_0x402d('0x59')]),util[_0x402d('0x5e')](_0x402d('0x5f'),_0x5314ee[_0x402d('0x54')]||_0x5314ee['name'],_0x5314ee[_0x402d('0x60')][_0x402d('0x61')]()));}})[_0x402d('0x49')](handleError(_0x1fc4f1,null));}; \ No newline at end of file +var _0xf25b=['user','UserProfileSection','userProfileId','autoAssociation','body','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','options','findAll','rows','catch','show','params','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x510fba,_0x3238c8){var _0x1ba091=function(_0x228f30){while(--_0x228f30){_0x510fba['push'](_0x510fba['shift']());}};_0x1ba091(++_0x3238c8);}(_0xf25b,0xd6));var _0xbf25=function(_0x1138b7,_0x32a90a){_0x1138b7=_0x1138b7-0x0;var _0x5505bf=_0xf25b[_0x1138b7];return _0x5505bf;};'use strict';var emlformat=require(_0xbf25('0x0'));var rimraf=require(_0xbf25('0x1'));var zipdir=require(_0xbf25('0x2'));var jsonpatch=require(_0xbf25('0x3'));var rp=require(_0xbf25('0x4'));var moment=require(_0xbf25('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbf25('0x6'));var util=require('util');var path=require(_0xbf25('0x7'));var sox=require(_0xbf25('0x8'));var csv=require('to-csv');var ejs=require(_0xbf25('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf25('0xa'));var squel=require(_0xbf25('0xb'));var crypto=require(_0xbf25('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbf25('0xd'));var toCsv=require(_0xbf25('0xe'));var querystring=require(_0xbf25('0xf'));var Papa=require(_0xbf25('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbf25('0x11'));var as=require(_0xbf25('0x12'));var hardwareService=require(_0xbf25('0x13'));var logger=require(_0xbf25('0x14'))(_0xbf25('0x15'));var utils=require(_0xbf25('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbf25('0x17'));var db=require(_0xbf25('0x18'))['db'];function respondWithStatusCode(_0x1a928e,_0x51d389){_0x51d389=_0x51d389||0xcc;return function(_0x1f0309){if(_0x1f0309){return _0x1a928e[_0xbf25('0x19')](_0x51d389);}return _0x1a928e[_0xbf25('0x1a')](_0x51d389)[_0xbf25('0x1b')]();};}function respondWithResult(_0xde77e3,_0xf331da){_0xf331da=_0xf331da||0xc8;return function(_0x5089dd){if(_0x5089dd){return _0xde77e3['status'](_0xf331da)[_0xbf25('0x1c')](_0x5089dd);}};}function respondWithFilteredResult(_0x4da93c,_0x11d166){return function(_0x4697ff){if(_0x4697ff){var _0x2b8ce1=typeof _0x11d166[_0xbf25('0x1d')]===_0xbf25('0x1e')&&typeof _0x11d166[_0xbf25('0x1f')]==='undefined';var _0xa7f8ea=_0x4697ff['count'];var _0x5506ba=_0x2b8ce1?0x0:_0x11d166['offset'];var _0x496768=_0x2b8ce1?_0x4697ff[_0xbf25('0x20')]:_0x11d166[_0xbf25('0x1d')]+_0x11d166[_0xbf25('0x1f')];var _0x36b8a9;if(_0x496768>=_0xa7f8ea){_0x496768=_0xa7f8ea;_0x36b8a9=0xc8;}else{_0x36b8a9=0xce;}_0x4da93c[_0xbf25('0x1a')](_0x36b8a9);return _0x4da93c['set']('Content-Range',_0x5506ba+'-'+_0x496768+'/'+_0xa7f8ea)[_0xbf25('0x1c')](_0x4697ff);}return null;};}function patchUpdates(_0x5cb47e){return function(_0x3be18a){try{jsonpatch[_0xbf25('0x21')](_0x3be18a,_0x5cb47e,!![]);}catch(_0xe6f64b){return BPromise[_0xbf25('0x22')](_0xe6f64b);}return _0x3be18a['save']();};}function saveUpdates(_0x457f4d,_0x1abf2d){return function(_0x213b87){if(_0x213b87){return _0x213b87[_0xbf25('0x23')](_0x457f4d)[_0xbf25('0x24')](function(_0x28885e){return _0x28885e;});}return null;};}function removeEntity(_0xbe3523,_0x2364ed){return function(_0x30c3d0){if(_0x30c3d0){return _0x30c3d0[_0xbf25('0x25')]()['then'](function(){var _0x4326eb=_0x30c3d0[_0xbf25('0x26')]({'plain':!![]});var _0x31e23b=_0xbf25('0x27');return db[_0xbf25('0x28')][_0xbf25('0x25')]({'where':{'type':_0x31e23b,'resourceId':_0x4326eb['id']}})[_0xbf25('0x24')](function(){return _0x30c3d0;});})[_0xbf25('0x24')](function(){_0xbe3523[_0xbf25('0x1a')](0xcc)[_0xbf25('0x1b')]();});}};}function handleEntityNotFound(_0x38bba4,_0x22b94a){return function(_0x6a635c){if(!_0x6a635c){_0x38bba4[_0xbf25('0x19')](0x194);}return _0x6a635c;};}function handleError(_0x326660,_0x227664){_0x227664=_0x227664||0x1f4;return function(_0x5abaae){logger[_0xbf25('0x29')](_0x5abaae[_0xbf25('0x2a')]);if(_0x5abaae[_0xbf25('0x2b')]){delete _0x5abaae[_0xbf25('0x2b')];}_0x326660['status'](_0x227664)[_0xbf25('0x2c')](_0x5abaae);};}exports['index']=function(_0x56cfd8,_0x574f58){var _0x5ec770={},_0x5200a9={},_0x47b489={'count':0x0,'rows':[]};var _0x2ee63b=_[_0xbf25('0x2d')](db[_0xbf25('0x2e')][_0xbf25('0x2f')],function(_0x547922){return{'name':_0x547922[_0xbf25('0x30')],'type':_0x547922[_0xbf25('0x31')]['key']};});_0x5200a9[_0xbf25('0x32')]=_[_0xbf25('0x2d')](_0x2ee63b,_0xbf25('0x2b'));_0x5200a9['query']=_[_0xbf25('0x33')](_0x56cfd8['query']);_0x5200a9[_0xbf25('0x34')]=_[_0xbf25('0x35')](_0x5200a9[_0xbf25('0x32')],_0x5200a9[_0xbf25('0x36')]);_0x5ec770['attributes']=_[_0xbf25('0x35')](_0x5200a9[_0xbf25('0x32')],qs[_0xbf25('0x37')](_0x56cfd8[_0xbf25('0x36')]['fields']));_0x5ec770[_0xbf25('0x38')]=_0x5ec770[_0xbf25('0x38')][_0xbf25('0x39')]?_0x5ec770[_0xbf25('0x38')]:_0x5200a9['model'];if(!_0x56cfd8['query'][_0xbf25('0x3a')]('nolimit')){_0x5ec770[_0xbf25('0x1f')]=qs[_0xbf25('0x1f')](_0x56cfd8['query']['limit']);_0x5ec770[_0xbf25('0x1d')]=qs[_0xbf25('0x1d')](_0x56cfd8[_0xbf25('0x36')]['offset']);}_0x5ec770[_0xbf25('0x3b')]=qs[_0xbf25('0x3c')](_0x56cfd8[_0xbf25('0x36')][_0xbf25('0x3c')]);_0x5ec770['where']=qs['filters'](_[_0xbf25('0x3d')](_0x56cfd8[_0xbf25('0x36')],_0x5200a9[_0xbf25('0x34')]),_0x2ee63b);if(_0x56cfd8[_0xbf25('0x36')]['filter']){_0x5ec770[_0xbf25('0x3e')]=_['merge'](_0x5ec770[_0xbf25('0x3e')],{'$or':_[_0xbf25('0x2d')](_0x2ee63b,function(_0x470bce){if(_0x470bce['type']!==_0xbf25('0x3f')){var _0x4af67a={};_0x4af67a[_0x470bce[_0xbf25('0x2b')]]={'$like':'%'+_0x56cfd8['query'][_0xbf25('0x40')]+'%'};return _0x4af67a;}})});}_0x5ec770=_[_0xbf25('0x41')]({},_0x5ec770,_0x56cfd8[_0xbf25('0x42')]);var _0x3442c8={'where':_0x5ec770['where']};return db[_0xbf25('0x2e')][_0xbf25('0x20')](_0x3442c8)['then'](function(_0x1027e8){_0x47b489['count']=_0x1027e8;if(_0x56cfd8[_0xbf25('0x36')]['includeAll']){_0x5ec770['include']=[{'all':!![]}];}return db[_0xbf25('0x2e')][_0xbf25('0x43')](_0x5ec770);})['then'](function(_0x5064c2){_0x47b489[_0xbf25('0x44')]=_0x5064c2;return _0x47b489;})[_0xbf25('0x24')](respondWithFilteredResult(_0x574f58,_0x5ec770))[_0xbf25('0x45')](handleError(_0x574f58,null));};exports[_0xbf25('0x46')]=function(_0x3de74e,_0x239836){var _0x464954={'raw':!![],'where':{'id':_0x3de74e[_0xbf25('0x47')]['id']}},_0x4c4b35={};_0x4c4b35[_0xbf25('0x32')]=_['keys'](db[_0xbf25('0x2e')][_0xbf25('0x2f')]);_0x4c4b35[_0xbf25('0x36')]=_[_0xbf25('0x33')](_0x3de74e[_0xbf25('0x36')]);_0x4c4b35['filters']=_[_0xbf25('0x35')](_0x4c4b35[_0xbf25('0x32')],_0x4c4b35[_0xbf25('0x36')]);_0x464954[_0xbf25('0x38')]=_[_0xbf25('0x35')](_0x4c4b35['model'],qs['fields'](_0x3de74e['query']['fields']));_0x464954[_0xbf25('0x38')]=_0x464954[_0xbf25('0x38')][_0xbf25('0x39')]?_0x464954[_0xbf25('0x38')]:_0x4c4b35[_0xbf25('0x32')];if(_0x3de74e[_0xbf25('0x36')]['includeAll']){_0x464954[_0xbf25('0x48')]=[{'all':!![]}];}_0x464954=_['merge']({},_0x464954,_0x3de74e[_0xbf25('0x42')]);return db[_0xbf25('0x2e')][_0xbf25('0x49')](_0x464954)[_0xbf25('0x24')](handleEntityNotFound(_0x239836,null))[_0xbf25('0x24')](respondWithResult(_0x239836,null))[_0xbf25('0x45')](handleError(_0x239836,null));};exports[_0xbf25('0x4a')]=function(_0x5a933b,_0x3bd760){return db[_0xbf25('0x2e')][_0xbf25('0x4a')](_0x5a933b['body'],{})[_0xbf25('0x24')](function(_0x5828dd){var _0x47388d=_0x5a933b['user'][_0xbf25('0x26')]({'plain':!![]});if(!_0x47388d)throw new Error(_0xbf25('0x4b'));if(_0x47388d[_0xbf25('0x4c')]===_0xbf25('0x4d')){var _0x5b6511=_0x5828dd[_0xbf25('0x26')]({'plain':!![]});var _0x167c42=_0xbf25('0x27');return db[_0xbf25('0x4e')][_0xbf25('0x49')]({'where':{'name':_0x167c42,'userProfileId':_0x47388d[_0xbf25('0x4f')]},'raw':!![]})[_0xbf25('0x24')](function(_0x113e56){if(_0x113e56&&_0x113e56[_0xbf25('0x50')]===0x0){return db[_0xbf25('0x28')][_0xbf25('0x4a')]({'name':_0x5b6511['name'],'resourceId':_0x5b6511['id'],'type':_0x113e56[_0xbf25('0x2b')],'sectionId':_0x113e56['id']},{})[_0xbf25('0x24')](function(){return _0x5828dd;});}else{return _0x5828dd;}})[_0xbf25('0x45')](function(_0x260c2b){logger[_0xbf25('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x260c2b);throw _0x260c2b;});}return _0x5828dd;})['then'](respondWithResult(_0x3bd760,0xc9))[_0xbf25('0x45')](handleError(_0x3bd760,null));};exports['update']=function(_0x54a39b,_0x4968ab){if(_0x54a39b['body']['id']){delete _0x54a39b[_0xbf25('0x51')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x54a39b[_0xbf25('0x47')]['id']}})[_0xbf25('0x24')](handleEntityNotFound(_0x4968ab,null))[_0xbf25('0x24')](saveUpdates(_0x54a39b[_0xbf25('0x51')],null))[_0xbf25('0x24')](respondWithResult(_0x4968ab,null))[_0xbf25('0x45')](handleError(_0x4968ab,null));};exports['destroy']=function(_0x27d080,_0x1c8680){return db[_0xbf25('0x2e')]['find']({'where':{'id':_0x27d080['params']['id']}})[_0xbf25('0x24')](handleEntityNotFound(_0x1c8680,null))[_0xbf25('0x24')](removeEntity(_0x1c8680,null))[_0xbf25('0x45')](handleError(_0x1c8680,null));};exports['download']=function(_0x394866,_0x35fc87,_0x245ed7){return db[_0xbf25('0x2e')][_0xbf25('0x49')]({'where':{'id':_0x394866['params']['id']},'attributes':['name',_0xbf25('0x52'),_0xbf25('0x53'),_0xbf25('0x54')],'raw':!![]})[_0xbf25('0x24')](handleEntityNotFound(_0x35fc87,null))[_0xbf25('0x24')](function(_0x4edc7d){if(_0x4edc7d){if(!fs[_0xbf25('0x55')](path[_0xbf25('0x56')](config[_0xbf25('0x57')],_0xbf25('0x58'),_0x4edc7d[_0xbf25('0x53')]))){throw new db[(_0xbf25('0x59'))][(_0xbf25('0x5a'))](_0xbf25('0x5b'));}if(_0x394866['query'][_0xbf25('0x5c')]){return _0x35fc87[_0xbf25('0x19')](0xc8);}return _0x35fc87[_0xbf25('0x5d')](path[_0xbf25('0x56')](config[_0xbf25('0x57')],'server/files/reports',_0x4edc7d[_0xbf25('0x53')]),util[_0xbf25('0x5e')](_0xbf25('0x5f'),_0x4edc7d[_0xbf25('0x52')]||_0x4edc7d['name'],_0x4edc7d['output'][_0xbf25('0x60')]()));}})[_0xbf25('0x45')](handleError(_0x35fc87,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 6b9369b..588cde7 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 _0x47e4=['rimraf','../../config/environment','exports','define','AnalyticExtractedReport','util','api','moment','bluebird','path'];(function(_0x55458d,_0x2518d9){var _0x7adcf0=function(_0x57baf7){while(--_0x57baf7){_0x55458d['push'](_0x55458d['shift']());}};_0x7adcf0(++_0x2518d9);}(_0x47e4,0x131));var _0x447e=function(_0x407654,_0x275ae3){_0x407654=_0x407654-0x0;var _0x521dbd=_0x47e4[_0x407654];return _0x521dbd;};'use strict';var _=require('lodash');var util=require(_0x447e('0x0'));var logger=require('../../config/logger')(_0x447e('0x1'));var moment=require(_0x447e('0x2'));var BPromise=require(_0x447e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x447e('0x4'));var rimraf=require(_0x447e('0x5'));var config=require(_0x447e('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0x447e('0x7')]=function(_0x5b80d0,_0x175ec4){return _0x5b80d0[_0x447e('0x8')](_0x447e('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffba=['analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0xffba,0x12d));var _0xaffb=function(_0x15258e,_0x3cb2df){_0x15258e=_0x15258e-0x0;var _0x33731e=_0xffba[_0x15258e];return _0x33731e;};'use strict';var _=require(_0xaffb('0x0'));var util=require(_0xaffb('0x1'));var logger=require(_0xaffb('0x2'))('api');var moment=require(_0xaffb('0x3'));var BPromise=require(_0xaffb('0x4'));var rp=require(_0xaffb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaffb('0x6'));var config=require(_0xaffb('0x7'));var attributes=require(_0xaffb('0x8'));module['exports']=function(_0x440045,_0x598c72){return _0x440045[_0xaffb('0x9')](_0xaffb('0xa'),attributes,{'tableName':_0xaffb('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 d061081..f687104 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 _0xe98d=['ioredis','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','bluebird'];(function(_0x1f69bc,_0xaffd71){var _0x1ac3c5=function(_0x3cd005){while(--_0x3cd005){_0x1f69bc['push'](_0x1f69bc['shift']());}};_0x1ac3c5(++_0xaffd71);}(_0xe98d,0x1d9));var _0xde98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe98d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde98('0x0'));var util=require(_0xde98('0x1'));var moment=require('moment');var BPromise=require(_0xde98('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde98('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xde98('0x4'));var client=jayson[_0xde98('0x5')][_0xde98('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5d694e,_0x5bfa36,_0xa1faeb){return new BPromise(function(_0x29af38,_0x34b771){return client['request'](_0x5d694e,_0xa1faeb)[_0xde98('0x7')](function(_0x43396a){logger[_0xde98('0x8')](_0xde98('0x9'),_0x5bfa36,'request\x20sent');logger[_0xde98('0xa')](_0xde98('0xb'),_0x5bfa36,_0xde98('0xc'),JSON['stringify'](_0x43396a));if(_0x43396a[_0xde98('0xd')]){if(_0x43396a[_0xde98('0xd')][_0xde98('0xe')]===0x1f4){logger[_0xde98('0xd')](_0xde98('0x9'),_0x5bfa36,_0x43396a['error'][_0xde98('0xf')]);return _0x34b771(_0x43396a[_0xde98('0xd')][_0xde98('0xf')]);}logger[_0xde98('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5bfa36,_0x43396a[_0xde98('0xd')]['message']);return _0x29af38(_0x43396a[_0xde98('0xd')][_0xde98('0xf')]);}else{logger['info'](_0xde98('0x9'),_0x5bfa36,_0xde98('0xc'));_0x29af38(_0x43396a['result'][_0xde98('0xf')]);}})[_0xde98('0x10')](function(_0x4f3199){logger[_0xde98('0xd')](_0xde98('0x9'),_0x5bfa36,_0x4f3199);_0x34b771(_0x4f3199);});});} \ No newline at end of file +var _0xf1fd=['lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticExtractedReport,\x20%s,\x20%s','result','catch'];(function(_0x5c528b,_0xfb69d3){var _0xfee9c5=function(_0x527ff1){while(--_0x527ff1){_0x5c528b['push'](_0x5c528b['shift']());}};_0xfee9c5(++_0xfb69d3);}(_0xf1fd,0x1e4));var _0xdf1f=function(_0x46e064,_0x2ed17b){_0x46e064=_0x46e064-0x0;var _0x49340e=_0xf1fd[_0x46e064];return _0x49340e;};'use strict';var _=require(_0xdf1f('0x0'));var util=require(_0xdf1f('0x1'));var moment=require('moment');var BPromise=require(_0xdf1f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf1f('0x3'))['db'];var utils=require(_0xdf1f('0x4'));var logger=require(_0xdf1f('0x5'))(_0xdf1f('0x6'));var config=require(_0xdf1f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdf1f('0x8')][_0xdf1f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4748b3,_0x42eff0,_0x1eaca0){return new BPromise(function(_0xde00c9,_0x5ba304){return client[_0xdf1f('0xa')](_0x4748b3,_0x1eaca0)[_0xdf1f('0xb')](function(_0x3d3102){logger[_0xdf1f('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x42eff0,_0xdf1f('0xd'));logger[_0xdf1f('0xe')](_0xdf1f('0xf'),_0x42eff0,_0xdf1f('0xd'),JSON[_0xdf1f('0x10')](_0x3d3102));if(_0x3d3102[_0xdf1f('0x11')]){if(_0x3d3102[_0xdf1f('0x11')]['code']===0x1f4){logger[_0xdf1f('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x42eff0,_0x3d3102[_0xdf1f('0x11')]['message']);return _0x5ba304(_0x3d3102[_0xdf1f('0x11')][_0xdf1f('0x12')]);}logger[_0xdf1f('0x11')](_0xdf1f('0x13'),_0x42eff0,_0x3d3102[_0xdf1f('0x11')]['message']);return _0xde00c9(_0x3d3102[_0xdf1f('0x11')][_0xdf1f('0x12')]);}else{logger[_0xdf1f('0xc')](_0xdf1f('0x13'),_0x42eff0,'request\x20sent');_0xde00c9(_0x3d3102[_0xdf1f('0x14')][_0xdf1f('0x12')]);}})[_0xdf1f('0x15')](function(_0x29a9b2){logger[_0xdf1f('0x11')](_0xdf1f('0x13'),_0x42eff0,_0x29a9b2);_0x5ba304(_0x29a9b2);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d05538b..56c91f0 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 _0x10ea=['../../components/interaction/service','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','put','update','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service'];(function(_0x5bff0,_0x20716d){var _0x3ead2e=function(_0x14f592){while(--_0x14f592){_0x5bff0['push'](_0x5bff0['shift']());}};_0x3ead2e(++_0x20716d);}(_0x10ea,0x1d6));var _0xa10e=function(_0x4fdc46,_0x2a3759){_0x4fdc46=_0x4fdc46-0x0;var _0x2c178a=_0x10ea[_0x4fdc46];return _0x2c178a;};'use strict';var multer=require(_0xa10e('0x0'));var util=require('util');var path=require(_0xa10e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa10e('0x2')]();var fs_extra=require(_0xa10e('0x3'));var auth=require(_0xa10e('0x4'));var interaction=require(_0xa10e('0x5'));var config=require('../../config/environment');var controller=require(_0xa10e('0x6'));router[_0xa10e('0x7')]('/',auth['isAuthenticated'](),controller[_0xa10e('0x8')]);router[_0xa10e('0x7')](_0xa10e('0x9'),auth[_0xa10e('0xa')](),controller[_0xa10e('0xb')]);router[_0xa10e('0x7')](_0xa10e('0xc'),auth[_0xa10e('0xa')](),controller[_0xa10e('0xd')]);router[_0xa10e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa10e('0xf')]('/:id',auth[_0xa10e('0xa')](),controller[_0xa10e('0x10')]);router['delete'](_0xa10e('0x9'),auth['isAuthenticated'](),controller[_0xa10e('0x11')]);module[_0xa10e('0x12')]=router; \ No newline at end of file +var _0xd72a=['post','put','delete','destroy','multer','util','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download'];(function(_0x58f19a,_0x563605){var _0x583d60=function(_0x571bbf){while(--_0x571bbf){_0x58f19a['push'](_0x58f19a['shift']());}};_0x583d60(++_0x563605);}(_0xd72a,0x8c));var _0xad72=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xd72a[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0xad72('0x0'));var util=require(_0xad72('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xad72('0x2'));var auth=require(_0xad72('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xad72('0x4'));var controller=require(_0xad72('0x5'));router[_0xad72('0x6')]('/',auth[_0xad72('0x7')](),controller[_0xad72('0x8')]);router[_0xad72('0x6')](_0xad72('0x9'),auth[_0xad72('0x7')](),controller[_0xad72('0xa')]);router[_0xad72('0x6')](_0xad72('0xb'),auth[_0xad72('0x7')](),controller[_0xad72('0xc')]);router[_0xad72('0xd')]('/',auth[_0xad72('0x7')](),controller['create']);router[_0xad72('0xe')](_0xad72('0x9'),auth[_0xad72('0x7')](),controller['update']);router[_0xad72('0xf')]('/:id',auth[_0xad72('0x7')](),controller[_0xad72('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index e5c1ef3..1e01776 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 _0xa0ce=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x1890a8,_0x42a2b2){var _0x420c6d=function(_0x2baa82){while(--_0x2baa82){_0x1890a8['push'](_0x1890a8['shift']());}};_0x420c6d(++_0x42a2b2);}(_0xa0ce,0x119));var _0xea0c=function(_0x1f25c3,_0x456922){_0x1f25c3=_0x1f25c3-0x0;var _0x41be15=_0xa0ce[_0x1f25c3];return _0x41be15;};'use strict';var Sequelize=require(_0xea0c('0x0'));module[_0xea0c('0x1')]={'field':{'type':Sequelize[_0xea0c('0x2')]},'alias':{'type':Sequelize[_0xea0c('0x3')]},'function':{'type':Sequelize[_0xea0c('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xea0c('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xea0c('0x3')]},'custom':{'type':Sequelize[_0xea0c('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xfd8a=['STRING','BOOLEAN','exports'];(function(_0x50aa77,_0x1a574d){var _0x32df06=function(_0x704d40){while(--_0x704d40){_0x50aa77['push'](_0x50aa77['shift']());}};_0x32df06(++_0x1a574d);}(_0xfd8a,0x80));var _0xafd8=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0xfd8a[_0x5db657];return _0x2d6e70;};'use strict';var Sequelize=require('sequelize');module[_0xafd8('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xafd8('0x1')]},'function':{'type':Sequelize[_0xafd8('0x1')]},'format':{'type':Sequelize[_0xafd8('0x1')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xafd8('0x1')]},'custom':{'type':Sequelize[_0xafd8('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 774b562..64f6868 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 _0x11fc=['stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','AnalyticFieldReport','rawAttributes','find','create','bulkCreate','body','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','params','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','destroy'];(function(_0x50f4e1,_0x487c31){var _0x464661=function(_0x1ef8b6){while(--_0x1ef8b6){_0x50f4e1['push'](_0x50f4e1['shift']());}};_0x464661(++_0x487c31);}(_0x11fc,0x187));var _0xc11f=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x11fc[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc11f('0x0'));var zipdir=require(_0xc11f('0x1'));var jsonpatch=require(_0xc11f('0x2'));var rp=require(_0xc11f('0x3'));var moment=require('moment');var BPromise=require(_0xc11f('0x4'));var Mustache=require(_0xc11f('0x5'));var util=require(_0xc11f('0x6'));var path=require(_0xc11f('0x7'));var sox=require(_0xc11f('0x8'));var csv=require(_0xc11f('0x9'));var ejs=require(_0xc11f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc11f('0xb'));var squel=require(_0xc11f('0xc'));var crypto=require('crypto');var jsforce=require(_0xc11f('0xd'));var deskjs=require(_0xc11f('0xe'));var toCsv=require(_0xc11f('0x9'));var querystring=require(_0xc11f('0xf'));var Papa=require(_0xc11f('0x10'));var Redis=require(_0xc11f('0x11'));var authService=require(_0xc11f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc11f('0x13'));var hardwareService=require(_0xc11f('0x14'));var logger=require(_0xc11f('0x15'))(_0xc11f('0x16'));var utils=require(_0xc11f('0x17'));var config=require(_0xc11f('0x18'));var licenseUtil=require(_0xc11f('0x19'));var db=require(_0xc11f('0x1a'))['db'];function respondWithStatusCode(_0x4b6c6f,_0x6054bc){_0x6054bc=_0x6054bc||0xcc;return function(_0x348a09){if(_0x348a09){return _0x4b6c6f[_0xc11f('0x1b')](_0x6054bc);}return _0x4b6c6f[_0xc11f('0x1c')](_0x6054bc)[_0xc11f('0x1d')]();};}function respondWithResult(_0x3277bc,_0x465ca0){_0x465ca0=_0x465ca0||0xc8;return function(_0x52c3c4){if(_0x52c3c4){return _0x3277bc[_0xc11f('0x1c')](_0x465ca0)[_0xc11f('0x1e')](_0x52c3c4);}};}function respondWithFilteredResult(_0x893f97,_0x89a7fa){return function(_0x5540c8){if(_0x5540c8){var _0x1c6ded=typeof _0x89a7fa[_0xc11f('0x1f')]==='undefined'&&typeof _0x89a7fa[_0xc11f('0x20')]===_0xc11f('0x21');var _0x58b50c=_0x5540c8[_0xc11f('0x22')];var _0x32951a=_0x1c6ded?0x0:_0x89a7fa[_0xc11f('0x1f')];var _0x1b0d43=_0x1c6ded?_0x5540c8[_0xc11f('0x22')]:_0x89a7fa['offset']+_0x89a7fa[_0xc11f('0x20')];var _0x14470b;if(_0x1b0d43>=_0x58b50c){_0x1b0d43=_0x58b50c;_0x14470b=0xc8;}else{_0x14470b=0xce;}_0x893f97['status'](_0x14470b);return _0x893f97['set'](_0xc11f('0x23'),_0x32951a+'-'+_0x1b0d43+'/'+_0x58b50c)[_0xc11f('0x1e')](_0x5540c8);}return null;};}function patchUpdates(_0x32dd76){return function(_0x2935ef){try{jsonpatch['apply'](_0x2935ef,_0x32dd76,!![]);}catch(_0x313775){return BPromise[_0xc11f('0x24')](_0x313775);}return _0x2935ef['save']();};}function saveUpdates(_0x1b9c69,_0x35e316){return function(_0x202dfe){if(_0x202dfe){return _0x202dfe[_0xc11f('0x25')](_0x1b9c69)['then'](function(_0x1b76a8){return _0x1b76a8;});}return null;};}function removeEntity(_0x427d50,_0xf11ed4){return function(_0x47511e){if(_0x47511e){return _0x47511e[_0xc11f('0x26')]()['then'](function(){_0x427d50[_0xc11f('0x1c')](0xcc)[_0xc11f('0x1d')]();});}};}function handleEntityNotFound(_0xb732b3,_0x51520c){return function(_0x51bb5c){if(!_0x51bb5c){_0xb732b3[_0xc11f('0x1b')](0x194);}return _0x51bb5c;};}function handleError(_0x59aca7,_0x1da2e9){_0x1da2e9=_0x1da2e9||0x1f4;return function(_0x763d3b){logger['error'](_0x763d3b[_0xc11f('0x27')]);if(_0x763d3b[_0xc11f('0x28')]){delete _0x763d3b[_0xc11f('0x28')];}_0x59aca7[_0xc11f('0x1c')](_0x1da2e9)[_0xc11f('0x29')](_0x763d3b);};}exports[_0xc11f('0x2a')]=function(_0x583f63,_0x433717){var _0x245ee8={},_0x23cc6e={},_0xd1db78={'count':0x0,'rows':[]};var _0x2cd5f7=_[_0xc11f('0x2b')](db['AnalyticFieldReport']['rawAttributes'],function(_0xf246a6){return{'name':_0xf246a6[_0xc11f('0x2c')],'type':_0xf246a6[_0xc11f('0x2d')][_0xc11f('0x2e')]};});_0x23cc6e[_0xc11f('0x2f')]=_[_0xc11f('0x2b')](_0x2cd5f7,_0xc11f('0x28'));_0x23cc6e[_0xc11f('0x30')]=_[_0xc11f('0x31')](_0x583f63[_0xc11f('0x30')]);_0x23cc6e[_0xc11f('0x32')]=_[_0xc11f('0x33')](_0x23cc6e[_0xc11f('0x2f')],_0x23cc6e[_0xc11f('0x30')]);_0x245ee8[_0xc11f('0x34')]=_[_0xc11f('0x33')](_0x23cc6e['model'],qs['fields'](_0x583f63[_0xc11f('0x30')][_0xc11f('0x35')]));_0x245ee8[_0xc11f('0x34')]=_0x245ee8['attributes'][_0xc11f('0x36')]?_0x245ee8[_0xc11f('0x34')]:_0x23cc6e['model'];if(!_0x583f63[_0xc11f('0x30')][_0xc11f('0x37')](_0xc11f('0x38'))){_0x245ee8[_0xc11f('0x20')]=qs[_0xc11f('0x20')](_0x583f63[_0xc11f('0x30')][_0xc11f('0x20')]);_0x245ee8['offset']=qs[_0xc11f('0x1f')](_0x583f63[_0xc11f('0x30')][_0xc11f('0x1f')]);}_0x245ee8[_0xc11f('0x39')]=qs[_0xc11f('0x3a')](_0x583f63[_0xc11f('0x30')]['sort']);_0x245ee8[_0xc11f('0x3b')]=qs[_0xc11f('0x32')](_[_0xc11f('0x3c')](_0x583f63['query'],_0x23cc6e[_0xc11f('0x32')]),_0x2cd5f7);if(_0x583f63[_0xc11f('0x30')][_0xc11f('0x3d')]){_0x245ee8[_0xc11f('0x3b')]=_[_0xc11f('0x3e')](_0x245ee8[_0xc11f('0x3b')],{'$or':_['map'](_0x2cd5f7,function(_0x14b9db){if(_0x14b9db[_0xc11f('0x2d')]!==_0xc11f('0x3f')){var _0x2de0d1={};_0x2de0d1[_0x14b9db[_0xc11f('0x28')]]={'$like':'%'+_0x583f63[_0xc11f('0x30')]['filter']+'%'};return _0x2de0d1;}})});}_0x245ee8=_[_0xc11f('0x3e')]({},_0x245ee8,_0x583f63[_0xc11f('0x40')]);var _0x4b8976={'where':_0x245ee8[_0xc11f('0x3b')]};return db['AnalyticFieldReport'][_0xc11f('0x22')](_0x4b8976)[_0xc11f('0x41')](function(_0x4c476b){_0xd1db78[_0xc11f('0x22')]=_0x4c476b;if(_0x583f63[_0xc11f('0x30')][_0xc11f('0x42')]){_0x245ee8[_0xc11f('0x43')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xc11f('0x44')](_0x245ee8);})[_0xc11f('0x41')](function(_0x203915){_0xd1db78['rows']=_0x203915;return _0xd1db78;})[_0xc11f('0x41')](respondWithFilteredResult(_0x433717,_0x245ee8))[_0xc11f('0x45')](handleError(_0x433717,null));};exports[_0xc11f('0x46')]=function(_0x2a2113,_0x3faa29){var _0x287551={'raw':![],'where':{'id':_0x2a2113['params']['id']}},_0x10d6c2={};_0x10d6c2[_0xc11f('0x2f')]=_['keys'](db[_0xc11f('0x47')][_0xc11f('0x48')]);_0x10d6c2[_0xc11f('0x30')]=_[_0xc11f('0x31')](_0x2a2113[_0xc11f('0x30')]);_0x10d6c2[_0xc11f('0x32')]=_[_0xc11f('0x33')](_0x10d6c2[_0xc11f('0x2f')],_0x10d6c2[_0xc11f('0x30')]);_0x287551[_0xc11f('0x34')]=_['intersection'](_0x10d6c2[_0xc11f('0x2f')],qs[_0xc11f('0x35')](_0x2a2113[_0xc11f('0x30')][_0xc11f('0x35')]));_0x287551['attributes']=_0x287551[_0xc11f('0x34')]['length']?_0x287551[_0xc11f('0x34')]:_0x10d6c2[_0xc11f('0x2f')];if(_0x2a2113[_0xc11f('0x30')][_0xc11f('0x42')]){_0x287551[_0xc11f('0x43')]=[{'all':!![]}];}_0x287551=_['merge']({},_0x287551,_0x2a2113[_0xc11f('0x40')]);return db[_0xc11f('0x47')][_0xc11f('0x49')](_0x287551)[_0xc11f('0x41')](handleEntityNotFound(_0x3faa29,null))[_0xc11f('0x41')](respondWithResult(_0x3faa29,null))[_0xc11f('0x45')](handleError(_0x3faa29,null));};exports['create']=function(_0x5ba790,_0x1360db){return db[_0xc11f('0x47')][_0xc11f('0x4a')](_0x5ba790['body'],{})[_0xc11f('0x41')](respondWithResult(_0x1360db,0xc9))[_0xc11f('0x45')](handleError(_0x1360db,null));};exports[_0xc11f('0x4b')]=function(_0x486a8b,_0x4a3c93){return db[_0xc11f('0x47')][_0xc11f('0x4b')](_0x486a8b[_0xc11f('0x4c')],{'raw':![],'individualHooks':!![]})[_0xc11f('0x41')](respondWithResult(_0x4a3c93,0xc9))[_0xc11f('0x45')](handleError(_0x4a3c93,null));};exports[_0xc11f('0x25')]=function(_0x51e753,_0x861223){if(_0x51e753[_0xc11f('0x4c')]['id']){delete _0x51e753['body']['id'];}return db[_0xc11f('0x47')][_0xc11f('0x49')]({'where':{'id':_0x51e753['params']['id']}})['then'](handleEntityNotFound(_0x861223,null))['then'](saveUpdates(_0x51e753[_0xc11f('0x4c')],null))[_0xc11f('0x41')](respondWithResult(_0x861223,null))[_0xc11f('0x45')](handleError(_0x861223,null));};exports[_0xc11f('0x26')]=function(_0x3d4d0b,_0x43fd74){return db['AnalyticFieldReport'][_0xc11f('0x49')]({'where':{'id':_0x3d4d0b['params']['id']}})['then'](handleEntityNotFound(_0x43fd74,null))[_0xc11f('0x41')](removeEntity(_0x43fd74,null))[_0xc11f('0x45')](handleError(_0x43fd74,null));};exports[_0xc11f('0x4d')]=function(_0x368538,_0x558283){return db['AnalyticFieldReport'][_0xc11f('0x26')]({'where':{'id':_0x368538[_0xc11f('0x30')][_0xc11f('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0xc11f('0x41')](respondWithResult(_0x558283,0xcc))['catch'](handleError(_0x558283,null));};exports[_0xc11f('0x4f')]=function(_0x5e8339,_0x90f389,_0x141060){return db[_0xc11f('0x50')][_0xc11f('0x51')]({'where':{'id':_0x5e8339['params']['id']}})[_0xc11f('0x41')](handleEntityNotFound(_0x90f389,null))[_0xc11f('0x41')](function(_0x1e3344){if(_0x1e3344){return db[_0xc11f('0x52')][_0xc11f('0x53')](function(_0xd2fd31){return db[_0xc11f('0x47')][_0xc11f('0x26')]({'where':{'CustomReportId':_0x5e8339[_0xc11f('0x54')]['id']},'transaction':_0xd2fd31})[_0xc11f('0x41')](function(_0x2b9c8f){var _0x2ee3e8=_[_0xc11f('0x2b')](_0x5e8339[_0xc11f('0x4c')],function(_0x2b3508){delete _0x2b3508['id'];_0x2b3508[_0xc11f('0x55')]=_0x5e8339['params']['id'];return _0x2b3508;});return db[_0xc11f('0x47')][_0xc11f('0x4b')](_0x2ee3e8,{'transaction':_0xd2fd31});});})['then'](function(){return db[_0xc11f('0x47')][_0xc11f('0x44')]({'where':{'CustomReportId':_0x5e8339[_0xc11f('0x54')]['id']}});});}})[_0xc11f('0x41')](respondWithResult(_0x90f389,null))[_0xc11f('0x45')](handleError(_0x90f389,null));}; \ No newline at end of file +var _0x4094=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','model','map','keys','query','filters','intersection','fields','attributes','order','sort','pick','where','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','create','bulkCreate','body','find','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3bf8d1,_0x3ca6aa){var _0x4098a6=function(_0x431085){while(--_0x431085){_0x3bf8d1['push'](_0x3bf8d1['shift']());}};_0x4098a6(++_0x3ca6aa);}(_0x4094,0x174));var _0x4409=function(_0xd1e00,_0x473f3e){_0xd1e00=_0xd1e00-0x0;var _0x231430=_0x4094[_0xd1e00];return _0x231430;};'use strict';var emlformat=require(_0x4409('0x0'));var rimraf=require(_0x4409('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4409('0x2'));var moment=require(_0x4409('0x3'));var BPromise=require(_0x4409('0x4'));var Mustache=require(_0x4409('0x5'));var util=require(_0x4409('0x6'));var path=require(_0x4409('0x7'));var sox=require(_0x4409('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4409('0x9'));var _=require(_0x4409('0xa'));var squel=require(_0x4409('0xb'));var crypto=require(_0x4409('0xc'));var jsforce=require(_0x4409('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4409('0xe'));var Papa=require(_0x4409('0xf'));var Redis=require(_0x4409('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4409('0x11'));var hardwareService=require(_0x4409('0x12'));var logger=require('../../config/logger')(_0x4409('0x13'));var utils=require('../../config/utils');var config=require(_0x4409('0x14'));var licenseUtil=require(_0x4409('0x15'));var db=require(_0x4409('0x16'))['db'];function respondWithStatusCode(_0x1e65fc,_0x59e36e){_0x59e36e=_0x59e36e||0xcc;return function(_0x1a5e26){if(_0x1a5e26){return _0x1e65fc[_0x4409('0x17')](_0x59e36e);}return _0x1e65fc[_0x4409('0x18')](_0x59e36e)[_0x4409('0x19')]();};}function respondWithResult(_0xe58267,_0x12736c){_0x12736c=_0x12736c||0xc8;return function(_0x4474f9){if(_0x4474f9){return _0xe58267[_0x4409('0x18')](_0x12736c)[_0x4409('0x1a')](_0x4474f9);}};}function respondWithFilteredResult(_0x5eb71e,_0x9e31a3){return function(_0x43888d){if(_0x43888d){var _0x429e99=typeof _0x9e31a3[_0x4409('0x1b')]===_0x4409('0x1c')&&typeof _0x9e31a3['limit']==='undefined';var _0xd8594d=_0x43888d[_0x4409('0x1d')];var _0x6b893f=_0x429e99?0x0:_0x9e31a3[_0x4409('0x1b')];var _0x24acf7=_0x429e99?_0x43888d['count']:_0x9e31a3[_0x4409('0x1b')]+_0x9e31a3[_0x4409('0x1e')];var _0x3f70da;if(_0x24acf7>=_0xd8594d){_0x24acf7=_0xd8594d;_0x3f70da=0xc8;}else{_0x3f70da=0xce;}_0x5eb71e['status'](_0x3f70da);return _0x5eb71e[_0x4409('0x1f')](_0x4409('0x20'),_0x6b893f+'-'+_0x24acf7+'/'+_0xd8594d)[_0x4409('0x1a')](_0x43888d);}return null;};}function patchUpdates(_0x3d8481){return function(_0x2e4c4f){try{jsonpatch[_0x4409('0x21')](_0x2e4c4f,_0x3d8481,!![]);}catch(_0x547dcf){return BPromise['reject'](_0x547dcf);}return _0x2e4c4f[_0x4409('0x22')]();};}function saveUpdates(_0x921ae3,_0x25908a){return function(_0x1160d7){if(_0x1160d7){return _0x1160d7[_0x4409('0x23')](_0x921ae3)['then'](function(_0x404131){return _0x404131;});}return null;};}function removeEntity(_0x206f1a,_0x1dc713){return function(_0x5a6343){if(_0x5a6343){return _0x5a6343['destroy']()[_0x4409('0x24')](function(){_0x206f1a['status'](0xcc)[_0x4409('0x19')]();});}};}function handleEntityNotFound(_0x5acb31,_0x130d6c){return function(_0x2eae7f){if(!_0x2eae7f){_0x5acb31[_0x4409('0x17')](0x194);}return _0x2eae7f;};}function handleError(_0x4a0803,_0x2890b1){_0x2890b1=_0x2890b1||0x1f4;return function(_0x559fe3){logger[_0x4409('0x25')](_0x559fe3[_0x4409('0x26')]);if(_0x559fe3['name']){delete _0x559fe3[_0x4409('0x27')];}_0x4a0803['status'](_0x2890b1)[_0x4409('0x28')](_0x559fe3);};}exports[_0x4409('0x29')]=function(_0x5a3857,_0x105676){var _0x52b072={},_0x19f800={},_0x5142cc={'count':0x0,'rows':[]};var _0x327315=_['map'](db[_0x4409('0x2a')][_0x4409('0x2b')],function(_0x140ad8){return{'name':_0x140ad8['fieldName'],'type':_0x140ad8['type']['key']};});_0x19f800[_0x4409('0x2c')]=_[_0x4409('0x2d')](_0x327315,_0x4409('0x27'));_0x19f800['query']=_[_0x4409('0x2e')](_0x5a3857[_0x4409('0x2f')]);_0x19f800[_0x4409('0x30')]=_['intersection'](_0x19f800[_0x4409('0x2c')],_0x19f800[_0x4409('0x2f')]);_0x52b072['attributes']=_[_0x4409('0x31')](_0x19f800[_0x4409('0x2c')],qs[_0x4409('0x32')](_0x5a3857[_0x4409('0x2f')][_0x4409('0x32')]));_0x52b072['attributes']=_0x52b072['attributes']['length']?_0x52b072[_0x4409('0x33')]:_0x19f800[_0x4409('0x2c')];if(!_0x5a3857['query']['hasOwnProperty']('nolimit')){_0x52b072[_0x4409('0x1e')]=qs[_0x4409('0x1e')](_0x5a3857[_0x4409('0x2f')][_0x4409('0x1e')]);_0x52b072[_0x4409('0x1b')]=qs[_0x4409('0x1b')](_0x5a3857['query']['offset']);}_0x52b072[_0x4409('0x34')]=qs[_0x4409('0x35')](_0x5a3857[_0x4409('0x2f')]['sort']);_0x52b072['where']=qs[_0x4409('0x30')](_[_0x4409('0x36')](_0x5a3857['query'],_0x19f800[_0x4409('0x30')]),_0x327315);if(_0x5a3857[_0x4409('0x2f')]['filter']){_0x52b072[_0x4409('0x37')]=_[_0x4409('0x38')](_0x52b072[_0x4409('0x37')],{'$or':_[_0x4409('0x2d')](_0x327315,function(_0x1810b7){if(_0x1810b7[_0x4409('0x39')]!=='VIRTUAL'){var _0x46104a={};_0x46104a[_0x1810b7[_0x4409('0x27')]]={'$like':'%'+_0x5a3857[_0x4409('0x2f')][_0x4409('0x3a')]+'%'};return _0x46104a;}})});}_0x52b072=_[_0x4409('0x38')]({},_0x52b072,_0x5a3857[_0x4409('0x3b')]);var _0x2d2ead={'where':_0x52b072[_0x4409('0x37')]};return db[_0x4409('0x2a')]['count'](_0x2d2ead)['then'](function(_0x128eaf){_0x5142cc[_0x4409('0x1d')]=_0x128eaf;if(_0x5a3857['query'][_0x4409('0x3c')]){_0x52b072[_0x4409('0x3d')]=[{'all':!![]}];}return db[_0x4409('0x2a')][_0x4409('0x3e')](_0x52b072);})[_0x4409('0x24')](function(_0x26e50a){_0x5142cc[_0x4409('0x3f')]=_0x26e50a;return _0x5142cc;})[_0x4409('0x24')](respondWithFilteredResult(_0x105676,_0x52b072))[_0x4409('0x40')](handleError(_0x105676,null));};exports[_0x4409('0x41')]=function(_0x52c8d7,_0x195cd2){var _0x48c614={'raw':![],'where':{'id':_0x52c8d7[_0x4409('0x42')]['id']}},_0x3f8a64={};_0x3f8a64['model']=_[_0x4409('0x2e')](db['AnalyticFieldReport']['rawAttributes']);_0x3f8a64['query']=_[_0x4409('0x2e')](_0x52c8d7[_0x4409('0x2f')]);_0x3f8a64[_0x4409('0x30')]=_[_0x4409('0x31')](_0x3f8a64[_0x4409('0x2c')],_0x3f8a64[_0x4409('0x2f')]);_0x48c614[_0x4409('0x33')]=_['intersection'](_0x3f8a64[_0x4409('0x2c')],qs[_0x4409('0x32')](_0x52c8d7['query']['fields']));_0x48c614[_0x4409('0x33')]=_0x48c614[_0x4409('0x33')]['length']?_0x48c614[_0x4409('0x33')]:_0x3f8a64[_0x4409('0x2c')];if(_0x52c8d7[_0x4409('0x2f')][_0x4409('0x3c')]){_0x48c614['include']=[{'all':!![]}];}_0x48c614=_[_0x4409('0x38')]({},_0x48c614,_0x52c8d7[_0x4409('0x3b')]);return db[_0x4409('0x2a')]['find'](_0x48c614)[_0x4409('0x24')](handleEntityNotFound(_0x195cd2,null))[_0x4409('0x24')](respondWithResult(_0x195cd2,null))[_0x4409('0x40')](handleError(_0x195cd2,null));};exports['create']=function(_0x36585b,_0x17db96){return db[_0x4409('0x2a')][_0x4409('0x43')](_0x36585b['body'],{})[_0x4409('0x24')](respondWithResult(_0x17db96,0xc9))['catch'](handleError(_0x17db96,null));};exports[_0x4409('0x44')]=function(_0x4c13e5,_0xe98364){return db[_0x4409('0x2a')]['bulkCreate'](_0x4c13e5[_0x4409('0x45')],{'raw':![],'individualHooks':!![]})[_0x4409('0x24')](respondWithResult(_0xe98364,0xc9))['catch'](handleError(_0xe98364,null));};exports[_0x4409('0x23')]=function(_0x14aa72,_0xfe0f1d){if(_0x14aa72['body']['id']){delete _0x14aa72['body']['id'];}return db[_0x4409('0x2a')][_0x4409('0x46')]({'where':{'id':_0x14aa72[_0x4409('0x42')]['id']}})[_0x4409('0x24')](handleEntityNotFound(_0xfe0f1d,null))['then'](saveUpdates(_0x14aa72[_0x4409('0x45')],null))['then'](respondWithResult(_0xfe0f1d,null))[_0x4409('0x40')](handleError(_0xfe0f1d,null));};exports[_0x4409('0x47')]=function(_0x1d4ed9,_0x288239){return db[_0x4409('0x2a')]['find']({'where':{'id':_0x1d4ed9[_0x4409('0x42')]['id']}})[_0x4409('0x24')](handleEntityNotFound(_0x288239,null))[_0x4409('0x24')](removeEntity(_0x288239,null))[_0x4409('0x40')](handleError(_0x288239,null));};exports[_0x4409('0x48')]=function(_0x67bcd,_0xd2629e){return db['AnalyticFieldReport'][_0x4409('0x47')]({'where':{'id':_0x67bcd['query'][_0x4409('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0x4409('0x24')](respondWithResult(_0xd2629e,0xcc))['catch'](handleError(_0xd2629e,null));};exports[_0x4409('0x4a')]=function(_0x2580ba,_0x3784b7,_0xbb17b7){return db[_0x4409('0x4b')][_0x4409('0x4c')]({'where':{'id':_0x2580ba[_0x4409('0x42')]['id']}})[_0x4409('0x24')](handleEntityNotFound(_0x3784b7,null))[_0x4409('0x24')](function(_0x419260){if(_0x419260){return db['sequelize'][_0x4409('0x4d')](function(_0x5f32d9){return db[_0x4409('0x2a')]['destroy']({'where':{'CustomReportId':_0x2580ba['params']['id']},'transaction':_0x5f32d9})['then'](function(_0x5e279e){var _0x261250=_[_0x4409('0x2d')](_0x2580ba[_0x4409('0x45')],function(_0xa72055){delete _0xa72055['id'];_0xa72055[_0x4409('0x4e')]=_0x2580ba['params']['id'];return _0xa72055;});return db[_0x4409('0x2a')][_0x4409('0x44')](_0x261250,{'transaction':_0x5f32d9});});})[_0x4409('0x24')](function(){return db[_0x4409('0x2a')][_0x4409('0x3e')]({'where':{'CustomReportId':_0x2580ba[_0x4409('0x42')]['id']}});});}})['then'](respondWithResult(_0x3784b7,null))[_0x4409('0x40')](handleError(_0x3784b7,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 9eae5cc..5d38938 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 _0x03d2=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0x03d2,0x1c7));var _0x203d=function(_0x411862,_0x5aea8c){_0x411862=_0x411862-0x0;var _0x22195a=_0x03d2[_0x411862];return _0x22195a;};'use strict';var _=require(_0x203d('0x0'));var util=require(_0x203d('0x1'));var logger=require(_0x203d('0x2'))(_0x203d('0x3'));var moment=require(_0x203d('0x4'));var BPromise=require(_0x203d('0x5'));var rp=require(_0x203d('0x6'));var fs=require('fs');var path=require(_0x203d('0x7'));var rimraf=require('rimraf');var config=require(_0x203d('0x8'));var attributes=require(_0x203d('0x9'));module['exports']=function(_0x4b089d,_0x5e3141){return _0x4b089d['define'](_0x203d('0xa'),attributes,{'tableName':_0x203d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79d4=['api','moment','bluebird','path','../../config/environment','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x3d33fb,_0x5c577a){var _0x5cafdb=function(_0x1be7ee){while(--_0x1be7ee){_0x3d33fb['push'](_0x3d33fb['shift']());}};_0x5cafdb(++_0x5c577a);}(_0x79d4,0xf2));var _0x479d=function(_0x2def61,_0x1ec064){_0x2def61=_0x2def61-0x0;var _0x3292e0=_0x79d4[_0x2def61];return _0x3292e0;};'use strict';var _=require(_0x479d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x479d('0x1'));var moment=require(_0x479d('0x2'));var BPromise=require(_0x479d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x479d('0x4'));var rimraf=require('rimraf');var config=require(_0x479d('0x5'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x370ba9,_0x4b9baa){return _0x370ba9[_0x479d('0x6')](_0x479d('0x7'),attributes,{'tableName':_0x479d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 1eb37c0..f6f9bad 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 _0xb8f0=['util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0xb8f0,0x1af));var _0x0b8f=function(_0x38980b,_0x3a0faa){_0x38980b=_0x38980b-0x0;var _0x26a661=_0xb8f0[_0x38980b];return _0x26a661;};'use strict';var _=require(_0x0b8f('0x0'));var util=require(_0x0b8f('0x1'));var moment=require('moment');var BPromise=require(_0x0b8f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0b8f('0x3'));var logger=require(_0x0b8f('0x4'))(_0x0b8f('0x5'));var config=require(_0x0b8f('0x6'));var jayson=require(_0x0b8f('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x58d1b9,_0x40510f,_0x3db35e){return new BPromise(function(_0x36b067,_0x25642d){return client['request'](_0x58d1b9,_0x3db35e)['then'](function(_0x559ecc){logger[_0x0b8f('0x8')](_0x0b8f('0x9'),_0x40510f,_0x0b8f('0xa'));logger[_0x0b8f('0xb')](_0x0b8f('0xc'),_0x40510f,_0x0b8f('0xa'),JSON[_0x0b8f('0xd')](_0x559ecc));if(_0x559ecc[_0x0b8f('0xe')]){if(_0x559ecc[_0x0b8f('0xe')][_0x0b8f('0xf')]===0x1f4){logger[_0x0b8f('0xe')](_0x0b8f('0x9'),_0x40510f,_0x559ecc['error'][_0x0b8f('0x10')]);return _0x25642d(_0x559ecc[_0x0b8f('0xe')][_0x0b8f('0x10')]);}logger[_0x0b8f('0xe')](_0x0b8f('0x9'),_0x40510f,_0x559ecc['error'][_0x0b8f('0x10')]);return _0x36b067(_0x559ecc['error'][_0x0b8f('0x10')]);}else{logger['info'](_0x0b8f('0x9'),_0x40510f,_0x0b8f('0xa'));_0x36b067(_0x559ecc[_0x0b8f('0x11')][_0x0b8f('0x10')]);}})['catch'](function(_0x5c54d1){logger[_0x0b8f('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x40510f,_0x5c54d1);_0x25642d(_0x5c54d1);});});} \ No newline at end of file +var _0x3e5c=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment'];(function(_0x2964cf,_0x4708d4){var _0x17ff4b=function(_0x1fdc54){while(--_0x1fdc54){_0x2964cf['push'](_0x2964cf['shift']());}};_0x17ff4b(++_0x4708d4);}(_0x3e5c,0x19b));var _0xc3e5=function(_0x2d4ce5,_0x4aa00d){_0x2d4ce5=_0x2d4ce5-0x0;var _0x243120=_0x3e5c[_0x2d4ce5];return _0x243120;};'use strict';var _=require(_0xc3e5('0x0'));var util=require(_0xc3e5('0x1'));var moment=require(_0xc3e5('0x2'));var BPromise=require(_0xc3e5('0x3'));var rs=require(_0xc3e5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3e5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc3e5('0x6'))(_0xc3e5('0x7'));var config=require(_0xc3e5('0x8'));var jayson=require(_0xc3e5('0x9'));var client=jayson[_0xc3e5('0xa')][_0xc3e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe33ee9,_0x3f2b2a,_0x35ad72){return new BPromise(function(_0x21d6e0,_0x200972){return client[_0xc3e5('0xc')](_0xe33ee9,_0x35ad72)[_0xc3e5('0xd')](function(_0x4ac825){logger[_0xc3e5('0xe')](_0xc3e5('0xf'),_0x3f2b2a,_0xc3e5('0x10'));logger[_0xc3e5('0x11')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x3f2b2a,_0xc3e5('0x10'),JSON[_0xc3e5('0x12')](_0x4ac825));if(_0x4ac825[_0xc3e5('0x13')]){if(_0x4ac825[_0xc3e5('0x13')][_0xc3e5('0x14')]===0x1f4){logger[_0xc3e5('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3f2b2a,_0x4ac825['error'][_0xc3e5('0x15')]);return _0x200972(_0x4ac825[_0xc3e5('0x13')][_0xc3e5('0x15')]);}logger[_0xc3e5('0x13')](_0xc3e5('0xf'),_0x3f2b2a,_0x4ac825['error'][_0xc3e5('0x15')]);return _0x21d6e0(_0x4ac825[_0xc3e5('0x13')][_0xc3e5('0x15')]);}else{logger[_0xc3e5('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3f2b2a,_0xc3e5('0x10'));_0x21d6e0(_0x4ac825[_0xc3e5('0x16')][_0xc3e5('0x15')]);}})['catch'](function(_0x1dfb03){logger[_0xc3e5('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3f2b2a,_0x1dfb03);_0x200972(_0x1dfb03);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 1997c7c..b4626fb 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(_0x3ed4e7,_0x4b9caf){var _0x4933cf=function(_0x30bc3f){while(--_0x30bc3f){_0x3ed4e7['push'](_0x3ed4e7['shift']());}};_0x4933cf(++_0x4b9caf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x30ffc1,_0x556cd6){var _0x586b40=function(_0x2b0bed){while(--_0x2b0bed){_0x30ffc1['push'](_0x30ffc1['shift']());}};_0x586b40(++_0x556cd6);}(_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['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 ba9fa71..e70aec2 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 _0x6c76=['sequelize','exports','STRING','TEXT'];(function(_0x6dc565,_0x5503bd){var _0x2c2583=function(_0x46c813){while(--_0x46c813){_0x6dc565['push'](_0x6dc565['shift']());}};_0x2c2583(++_0x5503bd);}(_0x6c76,0x184));var _0x66c7=function(_0x1f1a46,_0x500d95){_0x1f1a46=_0x1f1a46-0x0;var _0x483b2a=_0x6c76[_0x1f1a46];return _0x483b2a;};'use strict';var Sequelize=require(_0x66c7('0x0'));module[_0x66c7('0x1')]={'name':{'type':Sequelize[_0x66c7('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x66c7('0x2')]},'metric':{'type':Sequelize[_0x66c7('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xefe3=['STRING','TEXT','sequelize'];(function(_0xc7045d,_0x29b4f1){var _0x4dbd5d=function(_0x3fe744){while(--_0x3fe744){_0xc7045d['push'](_0xc7045d['shift']());}};_0x4dbd5d(++_0x29b4f1);}(_0xefe3,0xf5));var _0x3efe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xefe3[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3efe('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x3efe('0x1')]},'metric':{'type':Sequelize[_0x3efe('0x2')]},'description':{'type':Sequelize[_0x3efe('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 731a39f..0732178 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 _0x5fc3=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body'];(function(_0x3101e4,_0x288e9f){var _0x47b990=function(_0x46b62a){while(--_0x46b62a){_0x3101e4['push'](_0x3101e4['shift']());}};_0x47b990(++_0x288e9f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x5fc3[_0x231e16];return _0x570a7c;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['AnalyticMetric'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':!![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['AnalyticMetric'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));}; \ No newline at end of file +var _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0xb17508,_0x323537){var _0x70c57a=function(_0x53afbc){while(--_0x53afbc){_0xb17508['push'](_0xb17508['shift']());}};_0x70c57a(++_0x323537);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x1a27f3,_0x1c082d){_0x1a27f3=_0x1a27f3-0x0;var _0x3ce222=_0xf2ca[_0x1a27f3];return _0x3ce222;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 8e18d2d..3e2c843 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 _0x624c=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','util'];(function(_0x46e331,_0x4d880a){var _0x295a22=function(_0x246e61){while(--_0x246e61){_0x46e331['push'](_0x46e331['shift']());}};_0x295a22(++_0x4d880a);}(_0x624c,0x1ee));var _0xc624=function(_0x59db6d,_0x17d6d3){_0x59db6d=_0x59db6d-0x0;var _0x487659=_0x624c[_0x59db6d];return _0x487659;};'use strict';var _=require('lodash');var util=require(_0xc624('0x0'));var logger=require(_0xc624('0x1'))(_0xc624('0x2'));var moment=require(_0xc624('0x3'));var BPromise=require(_0xc624('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc624('0x5'));var rimraf=require('rimraf');var config=require(_0xc624('0x6'));var attributes=require('./analyticMetric.attributes');module[_0xc624('0x7')]=function(_0x2d1db7,_0x39759e){return _0x2d1db7[_0xc624('0x8')](_0xc624('0x9'),attributes,{'tableName':_0xc624('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeff8=['rimraf','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','lodash','util','api','moment','bluebird','path'];(function(_0x3f7e8d,_0xbddf){var _0x57e87c=function(_0x262e7d){while(--_0x262e7d){_0x3f7e8d['push'](_0x3f7e8d['shift']());}};_0x57e87c(++_0xbddf);}(_0xeff8,0x186));var _0x8eff=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xeff8[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'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 67ac389..fd3021c 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 _0xd51f=['rpc','../../config/environment','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x46f2a2,_0x59b5a4){var _0x1ea996=function(_0x90ce2e){while(--_0x90ce2e){_0x46f2a2['push'](_0x46f2a2['shift']());}};_0x1ea996(++_0x59b5a4);}(_0xd51f,0x1f2));var _0xfd51=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xd51f[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xfd51('0x0'));var util=require(_0xfd51('0x1'));var moment=require('moment');var BPromise=require(_0xfd51('0x2'));var rs=require(_0xfd51('0x3'));var fs=require('fs');var Redis=require(_0xfd51('0x4'));var db=require(_0xfd51('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfd51('0x6'));var config=require(_0xfd51('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfd51('0x8')][_0xfd51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xee989a,_0x132de0,_0x55987f){return new BPromise(function(_0x26a444,_0x37d4d5){return client[_0xfd51('0xa')](_0xee989a,_0x55987f)[_0xfd51('0xb')](function(_0x4627d){logger[_0xfd51('0xc')](_0xfd51('0xd'),_0x132de0,_0xfd51('0xe'));logger['debug'](_0xfd51('0xf'),_0x132de0,_0xfd51('0xe'),JSON[_0xfd51('0x10')](_0x4627d));if(_0x4627d[_0xfd51('0x11')]){if(_0x4627d[_0xfd51('0x11')]['code']===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x132de0,_0x4627d[_0xfd51('0x11')][_0xfd51('0x12')]);return _0x37d4d5(_0x4627d[_0xfd51('0x11')]['message']);}logger[_0xfd51('0x11')](_0xfd51('0xd'),_0x132de0,_0x4627d[_0xfd51('0x11')][_0xfd51('0x12')]);return _0x26a444(_0x4627d[_0xfd51('0x11')][_0xfd51('0x12')]);}else{logger[_0xfd51('0xc')](_0xfd51('0xd'),_0x132de0,_0xfd51('0xe'));_0x26a444(_0x4627d[_0xfd51('0x13')][_0xfd51('0x12')]);}})[_0xfd51('0x14')](function(_0x604996){logger[_0xfd51('0x11')](_0xfd51('0xd'),_0x132de0,_0x604996);_0x37d4d5(_0x604996);});});} \ No newline at end of file +var _0x2dfb=['catch','moment','randomstring','../../config/utils','../../config/logger','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x2dfb,0x121));var _0xb2df=function(_0x34df9a,_0x14e0db){_0x34df9a=_0x34df9a-0x0;var _0x33b4e7=_0x2dfb[_0x34df9a];return _0x33b4e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb2df('0x0'));var BPromise=require('bluebird');var rs=require(_0xb2df('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb2df('0x2'));var logger=require(_0xb2df('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb2df('0x4')][_0xb2df('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x163397,_0x39c795,_0xe5aa99){return new BPromise(function(_0x5aabf8,_0x4b0e98){return client['request'](_0x163397,_0xe5aa99)[_0xb2df('0x6')](function(_0x1c1309){logger[_0xb2df('0x7')](_0xb2df('0x8'),_0x39c795,_0xb2df('0x9'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x39c795,_0xb2df('0x9'),JSON[_0xb2df('0xa')](_0x1c1309));if(_0x1c1309[_0xb2df('0xb')]){if(_0x1c1309['error'][_0xb2df('0xc')]===0x1f4){logger['error'](_0xb2df('0x8'),_0x39c795,_0x1c1309[_0xb2df('0xb')]['message']);return _0x4b0e98(_0x1c1309[_0xb2df('0xb')]['message']);}logger[_0xb2df('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x39c795,_0x1c1309[_0xb2df('0xb')][_0xb2df('0xd')]);return _0x5aabf8(_0x1c1309[_0xb2df('0xb')]['message']);}else{logger['info'](_0xb2df('0x8'),_0x39c795,'request\x20sent');_0x5aabf8(_0x1c1309[_0xb2df('0xe')][_0xb2df('0xd')]);}})[_0xb2df('0xf')](function(_0x318c3b){logger[_0xb2df('0xb')](_0xb2df('0x8'),_0x39c795,_0x318c3b);_0x4b0e98(_0x318c3b);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index b839c47..6b416af 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 _0x4cfd=['/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index'];(function(_0x5cbf88,_0x4d503a){var _0x332089=function(_0x1ef8fb){while(--_0x1ef8fb){_0x5cbf88['push'](_0x5cbf88['shift']());}};_0x332089(++_0x4d503a);}(_0x4cfd,0x170));var _0xd4cf=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0x4cfd[_0x7d62cb];return _0x3a6266;};'use strict';var multer=require(_0xd4cf('0x0'));var util=require(_0xd4cf('0x1'));var path=require('path');var timeout=require(_0xd4cf('0x2'));var express=require(_0xd4cf('0x3'));var router=express[_0xd4cf('0x4')]();var fs_extra=require(_0xd4cf('0x5'));var auth=require(_0xd4cf('0x6'));var interaction=require(_0xd4cf('0x7'));var config=require('../../config/environment');var controller=require(_0xd4cf('0x8'));router[_0xd4cf('0x9')]('/',auth[_0xd4cf('0xa')](),controller[_0xd4cf('0xb')]);router[_0xd4cf('0x9')](_0xd4cf('0xc'),auth['isAuthenticated'](),controller[_0xd4cf('0xd')]);router[_0xd4cf('0xe')]('/',auth[_0xd4cf('0xa')](),controller[_0xd4cf('0xf')]);router[_0xd4cf('0x10')](_0xd4cf('0xc'),auth[_0xd4cf('0xa')](),controller['update']);router[_0xd4cf('0x11')](_0xd4cf('0xc'),auth[_0xd4cf('0xa')](),controller[_0xd4cf('0x12')]);module[_0xd4cf('0x13')]=router; \ No newline at end of file +var _0xb39f=['get','/:id','post','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xb39f,0x1e6));var _0xfb39=function(_0x1fa0f3,_0x2d3c19){_0x1fa0f3=_0x1fa0f3-0x0;var _0x48fd5f=_0xb39f[_0x1fa0f3];return _0x48fd5f;};'use strict';var multer=require(_0xfb39('0x0'));var util=require(_0xfb39('0x1'));var path=require(_0xfb39('0x2'));var timeout=require(_0xfb39('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfb39('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfb39('0x5'));var controller=require(_0xfb39('0x6'));router['get']('/',auth[_0xfb39('0x7')](),controller[_0xfb39('0x8')]);router[_0xfb39('0x9')](_0xfb39('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xfb39('0xb')]('/',auth[_0xfb39('0x7')](),controller['create']);router['put']('/:id',auth[_0xfb39('0x7')](),controller[_0xfb39('0xc')]);router[_0xfb39('0xd')](_0xfb39('0xa'),auth[_0xfb39('0x7')](),controller['destroy']);module[_0xfb39('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 44b1e7f..07cbc74 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 _0x490b=['sequelize','exports','TEXT'];(function(_0x1138c4,_0x841d33){var _0x200cc1=function(_0x2f6d85){while(--_0x2f6d85){_0x1138c4['push'](_0x1138c4['shift']());}};_0x200cc1(++_0x841d33);}(_0x490b,0xff));var _0xb490=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0x490b[_0x2675da];return _0x5e6153;};'use strict';var Sequelize=require(_0xb490('0x0'));module[_0xb490('0x1')]={'tree':{'type':Sequelize[_0xb490('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb394=['sequelize','exports'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xb394,0x1be));var _0x4b39=function(_0x1566a5,_0x429920){_0x1566a5=_0x1566a5-0x0;var _0x98f4b4=_0xb394[_0x1566a5];return _0x98f4b4;};'use strict';var Sequelize=require(_0x4b39('0x0'));module[_0x4b39('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 929e423..b2052c2 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 _0x8060=['map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','AnalyticTreeReport','includeAll','findAll','rows','catch','show','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','update','then','destroy','error','stack','name'];(function(_0x22a233,_0x7e7da0){var _0x5b5c60=function(_0x265ec8){while(--_0x265ec8){_0x22a233['push'](_0x22a233['shift']());}};_0x5b5c60(++_0x7e7da0);}(_0x8060,0x6e));var _0x0806=function(_0x372ee1,_0x45c637){_0x372ee1=_0x372ee1-0x0;var _0x31ea06=_0x8060[_0x372ee1];return _0x31ea06;};'use strict';var emlformat=require(_0x0806('0x0'));var rimraf=require(_0x0806('0x1'));var zipdir=require(_0x0806('0x2'));var jsonpatch=require(_0x0806('0x3'));var rp=require(_0x0806('0x4'));var moment=require(_0x0806('0x5'));var BPromise=require(_0x0806('0x6'));var Mustache=require('mustache');var util=require(_0x0806('0x7'));var path=require(_0x0806('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0806('0x9'));var fs=require('fs');var fs_extra=require(_0x0806('0xa'));var _=require('lodash');var squel=require(_0x0806('0xb'));var crypto=require(_0x0806('0xc'));var jsforce=require(_0x0806('0xd'));var deskjs=require(_0x0806('0xe'));var toCsv=require(_0x0806('0xf'));var querystring=require('querystring');var Papa=require(_0x0806('0x10'));var Redis=require('ioredis');var authService=require(_0x0806('0x11'));var qs=require(_0x0806('0x12'));var as=require(_0x0806('0x13'));var hardwareService=require(_0x0806('0x14'));var logger=require('../../config/logger')(_0x0806('0x15'));var utils=require(_0x0806('0x16'));var config=require(_0x0806('0x17'));var licenseUtil=require(_0x0806('0x18'));var db=require(_0x0806('0x19'))['db'];function respondWithStatusCode(_0x462fe3,_0x261638){_0x261638=_0x261638||0xcc;return function(_0x356c2d){if(_0x356c2d){return _0x462fe3[_0x0806('0x1a')](_0x261638);}return _0x462fe3[_0x0806('0x1b')](_0x261638)[_0x0806('0x1c')]();};}function respondWithResult(_0x17e5e8,_0x2ff96e){_0x2ff96e=_0x2ff96e||0xc8;return function(_0x3233e5){if(_0x3233e5){return _0x17e5e8['status'](_0x2ff96e)[_0x0806('0x1d')](_0x3233e5);}};}function respondWithFilteredResult(_0x513a72,_0x1607f7){return function(_0x4fa40f){if(_0x4fa40f){var _0x1430ee=typeof _0x1607f7['offset']===_0x0806('0x1e')&&typeof _0x1607f7['limit']==='undefined';var _0x11a217=_0x4fa40f[_0x0806('0x1f')];var _0xd60af3=_0x1430ee?0x0:_0x1607f7[_0x0806('0x20')];var _0x405b3e=_0x1430ee?_0x4fa40f['count']:_0x1607f7[_0x0806('0x20')]+_0x1607f7[_0x0806('0x21')];var _0x3f9e43;if(_0x405b3e>=_0x11a217){_0x405b3e=_0x11a217;_0x3f9e43=0xc8;}else{_0x3f9e43=0xce;}_0x513a72[_0x0806('0x1b')](_0x3f9e43);return _0x513a72[_0x0806('0x22')]('Content-Range',_0xd60af3+'-'+_0x405b3e+'/'+_0x11a217)[_0x0806('0x1d')](_0x4fa40f);}return null;};}function patchUpdates(_0x330c7e){return function(_0x5b236b){try{jsonpatch['apply'](_0x5b236b,_0x330c7e,!![]);}catch(_0x155b5c){return BPromise[_0x0806('0x23')](_0x155b5c);}return _0x5b236b['save']();};}function saveUpdates(_0x19a3cc,_0x51a333){return function(_0x50d214){if(_0x50d214){return _0x50d214[_0x0806('0x24')](_0x19a3cc)[_0x0806('0x25')](function(_0x5a2e61){return _0x5a2e61;});}return null;};}function removeEntity(_0x5097c9,_0x175771){return function(_0x1e34e2){if(_0x1e34e2){return _0x1e34e2[_0x0806('0x26')]()['then'](function(){_0x5097c9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22d3b9,_0x298f1b){return function(_0x6ff3ab){if(!_0x6ff3ab){_0x22d3b9[_0x0806('0x1a')](0x194);}return _0x6ff3ab;};}function handleError(_0xa479ae,_0x468c2e){_0x468c2e=_0x468c2e||0x1f4;return function(_0x2b72ea){logger[_0x0806('0x27')](_0x2b72ea[_0x0806('0x28')]);if(_0x2b72ea[_0x0806('0x29')]){delete _0x2b72ea[_0x0806('0x29')];}_0xa479ae[_0x0806('0x1b')](_0x468c2e)['send'](_0x2b72ea);};}exports['index']=function(_0x48de05,_0x11653b){var _0x4da820={},_0x175f69={},_0x17d6f2={'count':0x0,'rows':[]};var _0xf249e6=_[_0x0806('0x2a')](db['AnalyticTreeReport'][_0x0806('0x2b')],function(_0x368163){return{'name':_0x368163[_0x0806('0x2c')],'type':_0x368163[_0x0806('0x2d')][_0x0806('0x2e')]};});_0x175f69['model']=_[_0x0806('0x2a')](_0xf249e6,'name');_0x175f69['query']=_[_0x0806('0x2f')](_0x48de05[_0x0806('0x30')]);_0x175f69[_0x0806('0x31')]=_[_0x0806('0x32')](_0x175f69[_0x0806('0x33')],_0x175f69[_0x0806('0x30')]);_0x4da820[_0x0806('0x34')]=_[_0x0806('0x32')](_0x175f69[_0x0806('0x33')],qs[_0x0806('0x35')](_0x48de05[_0x0806('0x30')]['fields']));_0x4da820['attributes']=_0x4da820['attributes'][_0x0806('0x36')]?_0x4da820[_0x0806('0x34')]:_0x175f69[_0x0806('0x33')];if(!_0x48de05[_0x0806('0x30')][_0x0806('0x37')](_0x0806('0x38'))){_0x4da820[_0x0806('0x21')]=qs[_0x0806('0x21')](_0x48de05[_0x0806('0x30')][_0x0806('0x21')]);_0x4da820[_0x0806('0x20')]=qs[_0x0806('0x20')](_0x48de05[_0x0806('0x30')]['offset']);}_0x4da820[_0x0806('0x39')]=qs['sort'](_0x48de05[_0x0806('0x30')][_0x0806('0x3a')]);_0x4da820[_0x0806('0x3b')]=qs['filters'](_[_0x0806('0x3c')](_0x48de05['query'],_0x175f69['filters']),_0xf249e6);if(_0x48de05[_0x0806('0x30')][_0x0806('0x3d')]){_0x4da820['where']=_['merge'](_0x4da820[_0x0806('0x3b')],{'$or':_['map'](_0xf249e6,function(_0x303822){if(_0x303822['type']!==_0x0806('0x3e')){var _0x33f10e={};_0x33f10e[_0x303822[_0x0806('0x29')]]={'$like':'%'+_0x48de05[_0x0806('0x30')][_0x0806('0x3d')]+'%'};return _0x33f10e;}})});}_0x4da820=_[_0x0806('0x3f')]({},_0x4da820,_0x48de05[_0x0806('0x40')]);var _0x3e702a={'where':_0x4da820[_0x0806('0x3b')]};return db[_0x0806('0x41')][_0x0806('0x1f')](_0x3e702a)[_0x0806('0x25')](function(_0x5264c7){_0x17d6f2[_0x0806('0x1f')]=_0x5264c7;if(_0x48de05[_0x0806('0x30')][_0x0806('0x42')]){_0x4da820['include']=[{'all':!![]}];}return db[_0x0806('0x41')][_0x0806('0x43')](_0x4da820);})[_0x0806('0x25')](function(_0x299b71){_0x17d6f2[_0x0806('0x44')]=_0x299b71;return _0x17d6f2;})[_0x0806('0x25')](respondWithFilteredResult(_0x11653b,_0x4da820))[_0x0806('0x45')](handleError(_0x11653b,null));};exports[_0x0806('0x46')]=function(_0x139a0f,_0x3b0bce){var _0x2c51f6={'raw':!![],'where':{'id':_0x139a0f['params']['id']}},_0x20bb95={};_0x20bb95[_0x0806('0x33')]=_[_0x0806('0x2f')](db[_0x0806('0x41')][_0x0806('0x2b')]);_0x20bb95[_0x0806('0x30')]=_[_0x0806('0x2f')](_0x139a0f['query']);_0x20bb95[_0x0806('0x31')]=_[_0x0806('0x32')](_0x20bb95['model'],_0x20bb95[_0x0806('0x30')]);_0x2c51f6[_0x0806('0x34')]=_['intersection'](_0x20bb95['model'],qs[_0x0806('0x35')](_0x139a0f[_0x0806('0x30')][_0x0806('0x35')]));_0x2c51f6['attributes']=_0x2c51f6[_0x0806('0x34')][_0x0806('0x36')]?_0x2c51f6[_0x0806('0x34')]:_0x20bb95[_0x0806('0x33')];if(_0x139a0f['query'][_0x0806('0x42')]){_0x2c51f6[_0x0806('0x47')]=[{'all':!![]}];}_0x2c51f6=_[_0x0806('0x3f')]({},_0x2c51f6,_0x139a0f[_0x0806('0x40')]);return db[_0x0806('0x41')][_0x0806('0x48')](_0x2c51f6)[_0x0806('0x25')](handleEntityNotFound(_0x3b0bce,null))[_0x0806('0x25')](respondWithResult(_0x3b0bce,null))[_0x0806('0x45')](handleError(_0x3b0bce,null));};exports[_0x0806('0x49')]=function(_0x179649,_0x540cf2){return db[_0x0806('0x41')][_0x0806('0x49')](_0x179649[_0x0806('0x4a')],{})['then'](respondWithResult(_0x540cf2,0xc9))[_0x0806('0x45')](handleError(_0x540cf2,null));};exports['update']=function(_0x1c9e3e,_0x1dc0c3){if(_0x1c9e3e[_0x0806('0x4a')]['id']){delete _0x1c9e3e['body']['id'];}return db[_0x0806('0x41')]['find']({'where':{'id':_0x1c9e3e['params']['id']}})[_0x0806('0x25')](handleEntityNotFound(_0x1dc0c3,null))['then'](saveUpdates(_0x1c9e3e[_0x0806('0x4a')],null))[_0x0806('0x25')](respondWithResult(_0x1dc0c3,null))[_0x0806('0x45')](handleError(_0x1dc0c3,null));};exports['destroy']=function(_0x389370,_0x3e0d0d){return db[_0x0806('0x41')][_0x0806('0x48')]({'where':{'id':_0x389370[_0x0806('0x4b')]['id']}})[_0x0806('0x25')](handleEntityNotFound(_0x3e0d0d,null))[_0x0806('0x25')](removeEntity(_0x3e0d0d,null))[_0x0806('0x45')](handleError(_0x3e0d0d,null));}; \ No newline at end of file +var _0x5c6b=['name','send','index','AnalyticTreeReport','rawAttributes','type','key','model','map','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','eml-format','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/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack'];(function(_0x5d9a6d,_0x5c2d3c){var _0x2a72a4=function(_0x30b355){while(--_0x30b355){_0x5d9a6d['push'](_0x5d9a6d['shift']());}};_0x2a72a4(++_0x5c2d3c);}(_0x5c6b,0x1a5));var _0xb5c6=function(_0x3c5a41,_0x39473c){_0x3c5a41=_0x3c5a41-0x0;var _0x58156f=_0x5c6b[_0x3c5a41];return _0x58156f;};'use strict';var emlformat=require(_0xb5c6('0x0'));var rimraf=require(_0xb5c6('0x1'));var zipdir=require(_0xb5c6('0x2'));var jsonpatch=require(_0xb5c6('0x3'));var rp=require(_0xb5c6('0x4'));var moment=require(_0xb5c6('0x5'));var BPromise=require(_0xb5c6('0x6'));var Mustache=require('mustache');var util=require(_0xb5c6('0x7'));var path=require(_0xb5c6('0x8'));var sox=require(_0xb5c6('0x9'));var csv=require(_0xb5c6('0xa'));var ejs=require(_0xb5c6('0xb'));var fs=require('fs');var fs_extra=require(_0xb5c6('0xc'));var _=require(_0xb5c6('0xd'));var squel=require(_0xb5c6('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb5c6('0xa'));var querystring=require('querystring');var Papa=require(_0xb5c6('0xf'));var Redis=require(_0xb5c6('0x10'));var authService=require(_0xb5c6('0x11'));var qs=require(_0xb5c6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5c6('0x13'));var logger=require(_0xb5c6('0x14'))('api');var utils=require(_0xb5c6('0x15'));var config=require(_0xb5c6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb5c6('0x17'))['db'];function respondWithStatusCode(_0x42599,_0x20f159){_0x20f159=_0x20f159||0xcc;return function(_0x3f9691){if(_0x3f9691){return _0x42599[_0xb5c6('0x18')](_0x20f159);}return _0x42599[_0xb5c6('0x19')](_0x20f159)[_0xb5c6('0x1a')]();};}function respondWithResult(_0x17347b,_0x453d2f){_0x453d2f=_0x453d2f||0xc8;return function(_0x178f1e){if(_0x178f1e){return _0x17347b['status'](_0x453d2f)['json'](_0x178f1e);}};}function respondWithFilteredResult(_0x44ea19,_0x2216ea){return function(_0x187844){if(_0x187844){var _0x3c5b42=typeof _0x2216ea[_0xb5c6('0x1b')]==='undefined'&&typeof _0x2216ea['limit']===_0xb5c6('0x1c');var _0x58343d=_0x187844[_0xb5c6('0x1d')];var _0x59ab6c=_0x3c5b42?0x0:_0x2216ea[_0xb5c6('0x1b')];var _0x371634=_0x3c5b42?_0x187844[_0xb5c6('0x1d')]:_0x2216ea['offset']+_0x2216ea['limit'];var _0x3fc86b;if(_0x371634>=_0x58343d){_0x371634=_0x58343d;_0x3fc86b=0xc8;}else{_0x3fc86b=0xce;}_0x44ea19['status'](_0x3fc86b);return _0x44ea19[_0xb5c6('0x1e')](_0xb5c6('0x1f'),_0x59ab6c+'-'+_0x371634+'/'+_0x58343d)[_0xb5c6('0x20')](_0x187844);}return null;};}function patchUpdates(_0x16d785){return function(_0x29790f){try{jsonpatch[_0xb5c6('0x21')](_0x29790f,_0x16d785,!![]);}catch(_0x3c272c){return BPromise[_0xb5c6('0x22')](_0x3c272c);}return _0x29790f[_0xb5c6('0x23')]();};}function saveUpdates(_0x5de510,_0x1aa144){return function(_0xdf924d){if(_0xdf924d){return _0xdf924d[_0xb5c6('0x24')](_0x5de510)[_0xb5c6('0x25')](function(_0x172dad){return _0x172dad;});}return null;};}function removeEntity(_0xa4f4cc,_0x357cc3){return function(_0x44b3d6){if(_0x44b3d6){return _0x44b3d6[_0xb5c6('0x26')]()[_0xb5c6('0x25')](function(){_0xa4f4cc[_0xb5c6('0x19')](0xcc)[_0xb5c6('0x1a')]();});}};}function handleEntityNotFound(_0x31c250,_0xc87363){return function(_0xf52f93){if(!_0xf52f93){_0x31c250['sendStatus'](0x194);}return _0xf52f93;};}function handleError(_0x1e40ee,_0x5ccd82){_0x5ccd82=_0x5ccd82||0x1f4;return function(_0x2c75ea){logger[_0xb5c6('0x27')](_0x2c75ea[_0xb5c6('0x28')]);if(_0x2c75ea['name']){delete _0x2c75ea[_0xb5c6('0x29')];}_0x1e40ee[_0xb5c6('0x19')](_0x5ccd82)[_0xb5c6('0x2a')](_0x2c75ea);};}exports[_0xb5c6('0x2b')]=function(_0xcc8ebb,_0x702b2e){var _0x1f74ef={},_0x133c97={},_0x4a7bb3={'count':0x0,'rows':[]};var _0x2f19d3=_['map'](db[_0xb5c6('0x2c')][_0xb5c6('0x2d')],function(_0x3463f6){return{'name':_0x3463f6['fieldName'],'type':_0x3463f6[_0xb5c6('0x2e')][_0xb5c6('0x2f')]};});_0x133c97[_0xb5c6('0x30')]=_[_0xb5c6('0x31')](_0x2f19d3,_0xb5c6('0x29'));_0x133c97['query']=_[_0xb5c6('0x32')](_0xcc8ebb['query']);_0x133c97['filters']=_[_0xb5c6('0x33')](_0x133c97[_0xb5c6('0x30')],_0x133c97['query']);_0x1f74ef[_0xb5c6('0x34')]=_['intersection'](_0x133c97['model'],qs[_0xb5c6('0x35')](_0xcc8ebb[_0xb5c6('0x36')][_0xb5c6('0x35')]));_0x1f74ef['attributes']=_0x1f74ef[_0xb5c6('0x34')][_0xb5c6('0x37')]?_0x1f74ef[_0xb5c6('0x34')]:_0x133c97[_0xb5c6('0x30')];if(!_0xcc8ebb[_0xb5c6('0x36')][_0xb5c6('0x38')](_0xb5c6('0x39'))){_0x1f74ef['limit']=qs[_0xb5c6('0x3a')](_0xcc8ebb['query'][_0xb5c6('0x3a')]);_0x1f74ef[_0xb5c6('0x1b')]=qs['offset'](_0xcc8ebb[_0xb5c6('0x36')][_0xb5c6('0x1b')]);}_0x1f74ef[_0xb5c6('0x3b')]=qs[_0xb5c6('0x3c')](_0xcc8ebb[_0xb5c6('0x36')]['sort']);_0x1f74ef['where']=qs[_0xb5c6('0x3d')](_[_0xb5c6('0x3e')](_0xcc8ebb[_0xb5c6('0x36')],_0x133c97[_0xb5c6('0x3d')]),_0x2f19d3);if(_0xcc8ebb[_0xb5c6('0x36')][_0xb5c6('0x3f')]){_0x1f74ef[_0xb5c6('0x40')]=_[_0xb5c6('0x41')](_0x1f74ef[_0xb5c6('0x40')],{'$or':_['map'](_0x2f19d3,function(_0x57533f){if(_0x57533f[_0xb5c6('0x2e')]!==_0xb5c6('0x42')){var _0x4472f3={};_0x4472f3[_0x57533f[_0xb5c6('0x29')]]={'$like':'%'+_0xcc8ebb[_0xb5c6('0x36')][_0xb5c6('0x3f')]+'%'};return _0x4472f3;}})});}_0x1f74ef=_[_0xb5c6('0x41')]({},_0x1f74ef,_0xcc8ebb[_0xb5c6('0x43')]);var _0x4ff1a1={'where':_0x1f74ef[_0xb5c6('0x40')]};return db['AnalyticTreeReport'][_0xb5c6('0x1d')](_0x4ff1a1)[_0xb5c6('0x25')](function(_0x2d9c00){_0x4a7bb3[_0xb5c6('0x1d')]=_0x2d9c00;if(_0xcc8ebb['query']['includeAll']){_0x1f74ef[_0xb5c6('0x44')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xb5c6('0x45')](_0x1f74ef);})[_0xb5c6('0x25')](function(_0x25b8aa){_0x4a7bb3[_0xb5c6('0x46')]=_0x25b8aa;return _0x4a7bb3;})[_0xb5c6('0x25')](respondWithFilteredResult(_0x702b2e,_0x1f74ef))[_0xb5c6('0x47')](handleError(_0x702b2e,null));};exports[_0xb5c6('0x48')]=function(_0x4a5749,_0x13dee4){var _0x27a0b4={'raw':!![],'where':{'id':_0x4a5749[_0xb5c6('0x49')]['id']}},_0x1466c1={};_0x1466c1['model']=_['keys'](db[_0xb5c6('0x2c')][_0xb5c6('0x2d')]);_0x1466c1['query']=_[_0xb5c6('0x32')](_0x4a5749[_0xb5c6('0x36')]);_0x1466c1[_0xb5c6('0x3d')]=_[_0xb5c6('0x33')](_0x1466c1[_0xb5c6('0x30')],_0x1466c1[_0xb5c6('0x36')]);_0x27a0b4[_0xb5c6('0x34')]=_[_0xb5c6('0x33')](_0x1466c1[_0xb5c6('0x30')],qs[_0xb5c6('0x35')](_0x4a5749[_0xb5c6('0x36')][_0xb5c6('0x35')]));_0x27a0b4[_0xb5c6('0x34')]=_0x27a0b4[_0xb5c6('0x34')][_0xb5c6('0x37')]?_0x27a0b4[_0xb5c6('0x34')]:_0x1466c1[_0xb5c6('0x30')];if(_0x4a5749[_0xb5c6('0x36')]['includeAll']){_0x27a0b4['include']=[{'all':!![]}];}_0x27a0b4=_[_0xb5c6('0x41')]({},_0x27a0b4,_0x4a5749[_0xb5c6('0x43')]);return db[_0xb5c6('0x2c')][_0xb5c6('0x4a')](_0x27a0b4)['then'](handleEntityNotFound(_0x13dee4,null))['then'](respondWithResult(_0x13dee4,null))[_0xb5c6('0x47')](handleError(_0x13dee4,null));};exports[_0xb5c6('0x4b')]=function(_0x5d1528,_0xb3455a){return db[_0xb5c6('0x2c')][_0xb5c6('0x4b')](_0x5d1528[_0xb5c6('0x4c')],{})[_0xb5c6('0x25')](respondWithResult(_0xb3455a,0xc9))[_0xb5c6('0x47')](handleError(_0xb3455a,null));};exports['update']=function(_0x3cfc0a,_0x25d31d){if(_0x3cfc0a[_0xb5c6('0x4c')]['id']){delete _0x3cfc0a[_0xb5c6('0x4c')]['id'];}return db['AnalyticTreeReport'][_0xb5c6('0x4a')]({'where':{'id':_0x3cfc0a['params']['id']}})[_0xb5c6('0x25')](handleEntityNotFound(_0x25d31d,null))[_0xb5c6('0x25')](saveUpdates(_0x3cfc0a[_0xb5c6('0x4c')],null))[_0xb5c6('0x25')](respondWithResult(_0x25d31d,null))[_0xb5c6('0x47')](handleError(_0x25d31d,null));};exports[_0xb5c6('0x26')]=function(_0x2a3523,_0x2fd284){return db[_0xb5c6('0x2c')][_0xb5c6('0x4a')]({'where':{'id':_0x2a3523[_0xb5c6('0x49')]['id']}})['then'](handleEntityNotFound(_0x2fd284,null))[_0xb5c6('0x25')](removeEntity(_0x2fd284,null))[_0xb5c6('0x47')](handleError(_0x2fd284,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index cf4ae4b..ac076ff 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 _0xf4cf=['analytics_report_trees','util','../../config/logger','moment','bluebird','path','rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf4cf,0x14b));var _0xff4c=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xf4cf[_0x403c20];return _0x2b271a;};'use strict';var _=require('lodash');var util=require(_0xff4c('0x0'));var logger=require(_0xff4c('0x1'))('api');var moment=require(_0xff4c('0x2'));var BPromise=require(_0xff4c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff4c('0x4'));var rimraf=require(_0xff4c('0x5'));var config=require('../../config/environment');var attributes=require(_0xff4c('0x6'));module[_0xff4c('0x7')]=function(_0x27dd0a,_0x4da85f){return _0x27dd0a[_0xff4c('0x8')](_0xff4c('0x9'),attributes,{'tableName':_0xff4c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb324=['exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','api','bluebird','request-promise','../../config/environment','./analyticTreeReport.attributes'];(function(_0x20928f,_0x29aac5){var _0x2c0da7=function(_0x58f0af){while(--_0x58f0af){_0x20928f['push'](_0x20928f['shift']());}};_0x2c0da7(++_0x29aac5);}(_0xb324,0x19b));var _0x4b32=function(_0x5e5aab,_0x2e183f){_0x5e5aab=_0x5e5aab-0x0;var _0x16c527=_0xb324[_0x5e5aab];return _0x16c527;};'use strict';var _=require(_0x4b32('0x0'));var util=require(_0x4b32('0x1'));var logger=require('../../config/logger')(_0x4b32('0x2'));var moment=require('moment');var BPromise=require(_0x4b32('0x3'));var rp=require(_0x4b32('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4b32('0x5'));var attributes=require(_0x4b32('0x6'));module[_0x4b32('0x7')]=function(_0x11bd4c,_0x68dec9){return _0x11bd4c[_0x4b32('0x8')](_0x4b32('0x9'),attributes,{'tableName':_0x4b32('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 8d03d92..2557504 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x47af00,_0x301522){var _0x19808c=function(_0x25802d){while(--_0x25802d){_0x47af00['push'](_0x47af00['shift']());}};_0x19808c(++_0x301522);}(_0xdb28,0x106));var _0x8db2=function(_0x34084e,_0x29d638){_0x34084e=_0x34084e-0x0;var _0x4216f6=_0xdb28[_0x34084e];return _0x4216f6;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x31e802,_0x468675){var _0x465cc1=function(_0xd3b254){while(--_0xd3b254){_0x31e802['push'](_0x31e802['shift']());}};_0x465cc1(++_0x468675);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'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')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 4f44e45..ce9f575 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 _0x4bd8=['/:id','isAuthenticated','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0x2a0e22,_0x1407f3){var _0x3b24fd=function(_0x515286){while(--_0x515286){_0x2a0e22['push'](_0x2a0e22['shift']());}};_0x3b24fd(++_0x1407f3);}(_0x4bd8,0x15e));var _0x84bd=function(_0x23358d,_0x35951e){_0x23358d=_0x23358d-0x0;var _0x3f10d1=_0x4bd8[_0x23358d];return _0x3f10d1;};'use strict';var multer=require(_0x84bd('0x0'));var util=require(_0x84bd('0x1'));var path=require(_0x84bd('0x2'));var timeout=require(_0x84bd('0x3'));var express=require(_0x84bd('0x4'));var router=express[_0x84bd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x84bd('0x6'));var interaction=require(_0x84bd('0x7'));var config=require(_0x84bd('0x8'));var controller=require(_0x84bd('0x9'));router[_0x84bd('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x84bd('0xa')](_0x84bd('0xb'),auth[_0x84bd('0xc')](),controller[_0x84bd('0xd')]);router[_0x84bd('0xe')]('/',auth[_0x84bd('0xc')](),controller[_0x84bd('0xf')]);router['put'](_0x84bd('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x84bd('0x10')](_0x84bd('0xb'),auth[_0x84bd('0xc')](),controller[_0x84bd('0x11')]);module[_0x84bd('0x12')]=router; \ No newline at end of file +var _0x1045=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x42ac41,_0xc9fc87){var _0x275666=function(_0x450f17){while(--_0x450f17){_0x42ac41['push'](_0x42ac41['shift']());}};_0x275666(++_0xc9fc87);}(_0x1045,0x71));var _0x5104=function(_0x3d8088,_0x59af8b){_0x3d8088=_0x3d8088-0x0;var _0x1705a6=_0x1045[_0x3d8088];return _0x1705a6;};'use strict';var multer=require(_0x5104('0x0'));var util=require(_0x5104('0x1'));var path=require(_0x5104('0x2'));var timeout=require(_0x5104('0x3'));var express=require(_0x5104('0x4'));var router=express[_0x5104('0x5')]();var fs_extra=require(_0x5104('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5104('0x7'));var config=require(_0x5104('0x8'));var controller=require('./analyticTreeReport.controller');router[_0x5104('0x9')]('/',auth[_0x5104('0xa')](),controller[_0x5104('0xb')]);router[_0x5104('0x9')](_0x5104('0xc'),auth['isAuthenticated'](),controller[_0x5104('0xd')]);router[_0x5104('0xe')]('/',auth[_0x5104('0xa')](),controller[_0x5104('0xf')]);router[_0x5104('0x10')](_0x5104('0xc'),auth[_0x5104('0xa')](),controller[_0x5104('0x11')]);router[_0x5104('0x12')](_0x5104('0xc'),auth[_0x5104('0xa')](),controller[_0x5104('0x13')]);module[_0x5104('0x14')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 7e11894..676d512 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 _0x5b7f=['exports','STRING','sequelize'];(function(_0x3e9688,_0x5c5633){var _0x43a2e2=function(_0x555459){while(--_0x555459){_0x3e9688['push'](_0x3e9688['shift']());}};_0x43a2e2(++_0x5c5633);}(_0x5b7f,0x8c));var _0xf5b7=function(_0x523daf,_0x4d821c){_0x523daf=_0x523daf-0x0;var _0x3fb759=_0x5b7f[_0x523daf];return _0x3fb759;};'use strict';var Sequelize=require(_0xf5b7('0x0'));module[_0xf5b7('0x1')]={'name':{'type':Sequelize[_0xf5b7('0x2')]},'basename':{'type':Sequelize[_0xf5b7('0x2')]},'type':{'type':Sequelize[_0xf5b7('0x2')]}}; \ No newline at end of file +var _0x2137=['exports','STRING','sequelize'];(function(_0x422bb1,_0x41eb73){var _0xfe5f30=function(_0x1314ca){while(--_0x1314ca){_0x422bb1['push'](_0x422bb1['shift']());}};_0xfe5f30(++_0x41eb73);}(_0x2137,0x134));var _0x7213=function(_0x30a565,_0x1337bf){_0x30a565=_0x30a565-0x0;var _0x388956=_0x2137[_0x30a565];return _0x388956;};'use strict';var Sequelize=require(_0x7213('0x0'));module[_0x7213('0x1')]={'name':{'type':Sequelize[_0x7213('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 3be5f7a..2de2c9a 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 _0x0997=['../../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','apply','save','update','then','destroy','error','stack','name','send','index','map','Attachment','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','include','find','clone','length','get','omit','createdAt','body','updatedAt','create','file','originalname','basename','filename','mimetype','download','findOne','join','server/files/attachments/','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x30397a,_0x3b62d9){var _0x169a8f=function(_0x440cd1){while(--_0x440cd1){_0x30397a['push'](_0x30397a['shift']());}};_0x169a8f(++_0x3b62d9);}(_0x0997,0x151));var _0x7099=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0997[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x7099('0x0'));var rimraf=require(_0x7099('0x1'));var zipdir=require(_0x7099('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7099('0x3'));var moment=require(_0x7099('0x4'));var BPromise=require(_0x7099('0x5'));var Mustache=require(_0x7099('0x6'));var util=require('util');var path=require(_0x7099('0x7'));var sox=require(_0x7099('0x8'));var csv=require('to-csv');var ejs=require(_0x7099('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7099('0xa'));var squel=require(_0x7099('0xb'));var crypto=require(_0x7099('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7099('0xd'));var toCsv=require(_0x7099('0xe'));var querystring=require(_0x7099('0xf'));var Papa=require(_0x7099('0x10'));var Redis=require(_0x7099('0x11'));var authService=require(_0x7099('0x12'));var qs=require(_0x7099('0x13'));var as=require(_0x7099('0x14'));var hardwareService=require(_0x7099('0x15'));var logger=require(_0x7099('0x16'))(_0x7099('0x17'));var utils=require(_0x7099('0x18'));var config=require(_0x7099('0x19'));var licenseUtil=require(_0x7099('0x1a'));var db=require(_0x7099('0x1b'))['db'];function respondWithStatusCode(_0x1959dd,_0x2c5da1){_0x2c5da1=_0x2c5da1||0xcc;return function(_0x16a0a7){if(_0x16a0a7){return _0x1959dd[_0x7099('0x1c')](_0x2c5da1);}return _0x1959dd[_0x7099('0x1d')](_0x2c5da1)['end']();};}function respondWithResult(_0x5b9383,_0x400035){_0x400035=_0x400035||0xc8;return function(_0x4670ff){if(_0x4670ff){return _0x5b9383[_0x7099('0x1d')](_0x400035)[_0x7099('0x1e')](_0x4670ff);}};}function respondWithFilteredResult(_0x5c504b,_0x46fdaf){return function(_0x1efe8e){if(_0x1efe8e){var _0x14c66b=typeof _0x46fdaf[_0x7099('0x1f')]===_0x7099('0x20')&&typeof _0x46fdaf[_0x7099('0x21')]==='undefined';var _0x50ef5d=_0x1efe8e[_0x7099('0x22')];var _0x11815e=_0x14c66b?0x0:_0x46fdaf[_0x7099('0x1f')];var _0xc7aa0f=_0x14c66b?_0x1efe8e[_0x7099('0x22')]:_0x46fdaf[_0x7099('0x1f')]+_0x46fdaf['limit'];var _0x17e67f;if(_0xc7aa0f>=_0x50ef5d){_0xc7aa0f=_0x50ef5d;_0x17e67f=0xc8;}else{_0x17e67f=0xce;}_0x5c504b[_0x7099('0x1d')](_0x17e67f);return _0x5c504b['set']('Content-Range',_0x11815e+'-'+_0xc7aa0f+'/'+_0x50ef5d)[_0x7099('0x1e')](_0x1efe8e);}return null;};}function patchUpdates(_0x27a67e){return function(_0x50216f){try{jsonpatch[_0x7099('0x23')](_0x50216f,_0x27a67e,!![]);}catch(_0x5c4798){return BPromise['reject'](_0x5c4798);}return _0x50216f[_0x7099('0x24')]();};}function saveUpdates(_0x11dc75,_0x150800){return function(_0x1c28a9){if(_0x1c28a9){return _0x1c28a9[_0x7099('0x25')](_0x11dc75)[_0x7099('0x26')](function(_0xcd784c){return _0xcd784c;});}return null;};}function removeEntity(_0x36919c,_0x189412){return function(_0x6314ad){if(_0x6314ad){return _0x6314ad[_0x7099('0x27')]()[_0x7099('0x26')](function(){_0x36919c[_0x7099('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x562c92,_0x4c1f6d){return function(_0x5217d2){if(!_0x5217d2){_0x562c92[_0x7099('0x1c')](0x194);}return _0x5217d2;};}function handleError(_0x1578ee,_0x37b6d4){_0x37b6d4=_0x37b6d4||0x1f4;return function(_0x3ce5d9){logger[_0x7099('0x28')](_0x3ce5d9[_0x7099('0x29')]);if(_0x3ce5d9[_0x7099('0x2a')]){delete _0x3ce5d9[_0x7099('0x2a')];}_0x1578ee[_0x7099('0x1d')](_0x37b6d4)[_0x7099('0x2b')](_0x3ce5d9);};}exports[_0x7099('0x2c')]=function(_0x6f3002,_0x4906ad){var _0x45d208={},_0x381a32={},_0x38490e={'count':0x0,'rows':[]};var _0x21c7f1=_[_0x7099('0x2d')](db[_0x7099('0x2e')]['rawAttributes'],function(_0x909f0){return{'name':_0x909f0['fieldName'],'type':_0x909f0[_0x7099('0x2f')][_0x7099('0x30')]};});_0x381a32[_0x7099('0x31')]=_['map'](_0x21c7f1,'name');_0x381a32[_0x7099('0x32')]=_[_0x7099('0x33')](_0x6f3002[_0x7099('0x32')]);_0x381a32[_0x7099('0x34')]=_[_0x7099('0x35')](_0x381a32[_0x7099('0x31')],_0x381a32[_0x7099('0x32')]);_0x45d208[_0x7099('0x36')]=_[_0x7099('0x35')](_0x381a32[_0x7099('0x31')],qs[_0x7099('0x37')](_0x6f3002['query']['fields']));_0x45d208[_0x7099('0x36')]=_0x45d208[_0x7099('0x36')]['length']?_0x45d208[_0x7099('0x36')]:_0x381a32[_0x7099('0x31')];if(!_0x6f3002[_0x7099('0x32')][_0x7099('0x38')](_0x7099('0x39'))){_0x45d208[_0x7099('0x21')]=qs[_0x7099('0x21')](_0x6f3002[_0x7099('0x32')][_0x7099('0x21')]);_0x45d208[_0x7099('0x1f')]=qs['offset'](_0x6f3002['query'][_0x7099('0x1f')]);}_0x45d208[_0x7099('0x3a')]=qs[_0x7099('0x3b')](_0x6f3002[_0x7099('0x32')]['sort']);_0x45d208[_0x7099('0x3c')]=qs['filters'](_['pick'](_0x6f3002[_0x7099('0x32')],_0x381a32['filters']),_0x21c7f1);if(_0x6f3002[_0x7099('0x32')][_0x7099('0x3d')]){_0x45d208[_0x7099('0x3c')]=_['merge'](_0x45d208[_0x7099('0x3c')],{'$or':_['map'](_0x21c7f1,function(_0x5b5f5c){if(_0x5b5f5c['type']!==_0x7099('0x3e')){var _0x40776f={};_0x40776f[_0x5b5f5c['name']]={'$like':'%'+_0x6f3002[_0x7099('0x32')][_0x7099('0x3d')]+'%'};return _0x40776f;}})});}_0x45d208=_[_0x7099('0x3f')]({},_0x45d208,_0x6f3002[_0x7099('0x40')]);var _0x5aa67a={'where':_0x45d208[_0x7099('0x3c')]};return db[_0x7099('0x2e')][_0x7099('0x22')](_0x5aa67a)[_0x7099('0x26')](function(_0x4d1186){_0x38490e[_0x7099('0x22')]=_0x4d1186;if(_0x6f3002[_0x7099('0x32')][_0x7099('0x41')]){_0x45d208['include']=[{'all':!![]}];}return db[_0x7099('0x2e')][_0x7099('0x42')](_0x45d208);})[_0x7099('0x26')](function(_0x1ad1c2){_0x38490e['rows']=_0x1ad1c2;return _0x38490e;})[_0x7099('0x26')](respondWithFilteredResult(_0x4906ad,_0x45d208))[_0x7099('0x43')](handleError(_0x4906ad,null));};exports[_0x7099('0x44')]=function(_0x2a42b0,_0x328977){var _0x575afc={'raw':!![],'where':{'id':_0x2a42b0[_0x7099('0x45')]['id']}},_0x1020b4={};_0x1020b4[_0x7099('0x31')]=_[_0x7099('0x33')](db[_0x7099('0x2e')]['rawAttributes']);_0x1020b4[_0x7099('0x32')]=_['keys'](_0x2a42b0[_0x7099('0x32')]);_0x1020b4['filters']=_[_0x7099('0x35')](_0x1020b4[_0x7099('0x31')],_0x1020b4[_0x7099('0x32')]);_0x575afc['attributes']=_[_0x7099('0x35')](_0x1020b4[_0x7099('0x31')],qs[_0x7099('0x37')](_0x2a42b0[_0x7099('0x32')][_0x7099('0x37')]));_0x575afc[_0x7099('0x36')]=_0x575afc[_0x7099('0x36')]['length']?_0x575afc[_0x7099('0x36')]:_0x1020b4[_0x7099('0x31')];if(_0x2a42b0[_0x7099('0x32')]['includeAll']){_0x575afc[_0x7099('0x46')]=[{'all':!![]}];}_0x575afc=_['merge']({},_0x575afc,_0x2a42b0[_0x7099('0x40')]);return db['Attachment'][_0x7099('0x47')](_0x575afc)[_0x7099('0x26')](handleEntityNotFound(_0x328977,null))[_0x7099('0x26')](respondWithResult(_0x328977,null))[_0x7099('0x43')](handleError(_0x328977,null));};exports[_0x7099('0x48')]=function(_0x13d81e,_0x68b7ad){var _0x51ddbe={'where':{'id':_0x13d81e[_0x7099('0x45')]['id']}},_0x35d19e={};_0x35d19e[_0x7099('0x31')]=_[_0x7099('0x33')](db[_0x7099('0x2e')]['rawAttributes']);_0x51ddbe[_0x7099('0x36')]=_[_0x7099('0x35')](_0x35d19e[_0x7099('0x31')],qs[_0x7099('0x37')](_0x13d81e[_0x7099('0x32')]['fields']));_0x51ddbe[_0x7099('0x36')]=_0x51ddbe[_0x7099('0x36')][_0x7099('0x49')]?_0x51ddbe[_0x7099('0x36')]:_0x35d19e[_0x7099('0x31')];if(_0x13d81e[_0x7099('0x32')][_0x7099('0x41')]){_0x51ddbe[_0x7099('0x46')]=[{'all':!![]}];}_0x51ddbe=_['merge']({},_0x51ddbe,_0x13d81e[_0x7099('0x40')]);return db['Attachment'][_0x7099('0x47')](_0x51ddbe)[_0x7099('0x26')](handleEntityNotFound(_0x68b7ad,null))[_0x7099('0x26')](function(_0x47e2ea){if(_0x47e2ea){var _0xc8549c=_0x47e2ea[_0x7099('0x4a')]({'plain':!![]});_0xc8549c=qs[_0x7099('0x4b')](_0xc8549c,['id',_0x7099('0x4c'),'updatedAt']);_0x13d81e[_0x7099('0x4d')]=_[_0x7099('0x4b')](_0x13d81e[_0x7099('0x4d')],['id',_0x7099('0x4c'),_0x7099('0x4e')]);return db['Attachment'][_0x7099('0x4f')](_[_0x7099('0x3f')](_0xc8549c,_0x13d81e['body']),{'include':_0x13d81e[_0x7099('0x32')][_0x7099('0x41')]?[{'all':!![]}]:undefined});}})[_0x7099('0x26')](respondWithResult(_0x68b7ad,0xc9))['catch'](handleError(_0x68b7ad,null));};exports[_0x7099('0x25')]=function(_0xb9d5cc,_0x2f6319){if(_0xb9d5cc[_0x7099('0x4d')]['id']){delete _0xb9d5cc['body']['id'];}return db[_0x7099('0x2e')]['find']({'where':{'id':_0xb9d5cc[_0x7099('0x45')]['id']}})[_0x7099('0x26')](handleEntityNotFound(_0x2f6319,null))[_0x7099('0x26')](saveUpdates(_0xb9d5cc[_0x7099('0x4d')],null))[_0x7099('0x26')](respondWithResult(_0x2f6319,null))[_0x7099('0x43')](handleError(_0x2f6319,null));};exports[_0x7099('0x27')]=function(_0x42ab0d,_0x49389b){return db[_0x7099('0x2e')][_0x7099('0x47')]({'where':{'id':_0x42ab0d[_0x7099('0x45')]['id']}})[_0x7099('0x26')](handleEntityNotFound(_0x49389b,null))[_0x7099('0x26')](removeEntity(_0x49389b,null))[_0x7099('0x43')](handleError(_0x49389b,null));};exports[_0x7099('0x4f')]=function(_0x54c05f,_0x27eefc,_0x5bbc8b){_0x54c05f[_0x7099('0x4d')][_0x7099('0x2a')]=_0x54c05f[_0x7099('0x50')][_0x7099('0x51')];_0x54c05f[_0x7099('0x4d')][_0x7099('0x52')]=_0x54c05f[_0x7099('0x50')][_0x7099('0x53')];_0x54c05f[_0x7099('0x4d')]['type']=_0x54c05f[_0x7099('0x50')][_0x7099('0x54')];return db[_0x7099('0x2e')][_0x7099('0x4f')](_0x54c05f[_0x7099('0x4d')])[_0x7099('0x26')](respondWithResult(_0x27eefc,0xc9))[_0x7099('0x43')](handleError(_0x27eefc,null));};exports[_0x7099('0x55')]=function(_0x5d6581,_0x1cb82c,_0x2fc3d2){return db[_0x7099('0x2e')][_0x7099('0x56')]({'where':{'id':_0x5d6581[_0x7099('0x45')]['id']},'raw':!![]})[_0x7099('0x26')](handleEntityNotFound(_0x1cb82c,null))['then'](function(_0x3535c7){if(_0x3535c7){var _0x3a60b3=_0x3535c7['ChatOfflineMessageId']!==null;var _0xe2918a=path[_0x7099('0x57')](config['root'],_0x7099('0x58'));if(_0x3a60b3){_0xe2918a=path[_0x7099('0x57')](_0xe2918a,'offline-chat/');}var _0x5c36f6=path[_0x7099('0x57')](_0xe2918a,_0x3535c7[_0x7099('0x52')]);return _0x1cb82c['download'](_0x5c36f6);}})[_0x7099('0x43')](handleError(_0x1cb82c,null));}; \ No newline at end of file +var _0x5ddc=['reject','update','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','catch','show','params','length','find','clone','includeAll','merge','createdAt','body','omit','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','root','join','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0x5ddc,0x140));var _0xc5dd=function(_0x30058b,_0x1b0da5){_0x30058b=_0x30058b-0x0;var _0x43f735=_0x5ddc[_0x30058b];return _0x43f735;};'use strict';var emlformat=require(_0xc5dd('0x0'));var rimraf=require(_0xc5dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5dd('0x2'));var rp=require(_0xc5dd('0x3'));var moment=require(_0xc5dd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc5dd('0x5'));var util=require(_0xc5dd('0x6'));var path=require(_0xc5dd('0x7'));var sox=require(_0xc5dd('0x8'));var csv=require(_0xc5dd('0x9'));var ejs=require(_0xc5dd('0xa'));var fs=require('fs');var fs_extra=require(_0xc5dd('0xb'));var _=require(_0xc5dd('0xc'));var squel=require(_0xc5dd('0xd'));var crypto=require(_0xc5dd('0xe'));var jsforce=require(_0xc5dd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc5dd('0x9'));var querystring=require(_0xc5dd('0x10'));var Papa=require(_0xc5dd('0x11'));var Redis=require('ioredis');var authService=require(_0xc5dd('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc5dd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc5dd('0x14'))(_0xc5dd('0x15'));var utils=require('../../config/utils');var config=require(_0xc5dd('0x16'));var licenseUtil=require(_0xc5dd('0x17'));var db=require(_0xc5dd('0x18'))['db'];function respondWithStatusCode(_0x1cc66a,_0x632fcd){_0x632fcd=_0x632fcd||0xcc;return function(_0x113a22){if(_0x113a22){return _0x1cc66a[_0xc5dd('0x19')](_0x632fcd);}return _0x1cc66a[_0xc5dd('0x1a')](_0x632fcd)[_0xc5dd('0x1b')]();};}function respondWithResult(_0x21fb08,_0xe7885d){_0xe7885d=_0xe7885d||0xc8;return function(_0x4bc761){if(_0x4bc761){return _0x21fb08['status'](_0xe7885d)['json'](_0x4bc761);}};}function respondWithFilteredResult(_0x233f10,_0x28237a){return function(_0x264a84){if(_0x264a84){var _0x116f17=typeof _0x28237a['offset']===_0xc5dd('0x1c')&&typeof _0x28237a[_0xc5dd('0x1d')]===_0xc5dd('0x1c');var _0x1ba399=_0x264a84[_0xc5dd('0x1e')];var _0x1a55e1=_0x116f17?0x0:_0x28237a[_0xc5dd('0x1f')];var _0x51f7e4=_0x116f17?_0x264a84[_0xc5dd('0x1e')]:_0x28237a['offset']+_0x28237a[_0xc5dd('0x1d')];var _0x10dc32;if(_0x51f7e4>=_0x1ba399){_0x51f7e4=_0x1ba399;_0x10dc32=0xc8;}else{_0x10dc32=0xce;}_0x233f10[_0xc5dd('0x1a')](_0x10dc32);return _0x233f10[_0xc5dd('0x20')](_0xc5dd('0x21'),_0x1a55e1+'-'+_0x51f7e4+'/'+_0x1ba399)[_0xc5dd('0x22')](_0x264a84);}return null;};}function patchUpdates(_0x3612ad){return function(_0x37a4ca){try{jsonpatch[_0xc5dd('0x23')](_0x37a4ca,_0x3612ad,!![]);}catch(_0x46bee7){return BPromise[_0xc5dd('0x24')](_0x46bee7);}return _0x37a4ca['save']();};}function saveUpdates(_0x173903,_0xed063b){return function(_0x194970){if(_0x194970){return _0x194970[_0xc5dd('0x25')](_0x173903)[_0xc5dd('0x26')](function(_0x35ef17){return _0x35ef17;});}return null;};}function removeEntity(_0x4751ba,_0x296ac6){return function(_0x4906bb){if(_0x4906bb){return _0x4906bb[_0xc5dd('0x27')]()['then'](function(){_0x4751ba[_0xc5dd('0x1a')](0xcc)[_0xc5dd('0x1b')]();});}};}function handleEntityNotFound(_0x56dc7e,_0x290f70){return function(_0xff5ff){if(!_0xff5ff){_0x56dc7e['sendStatus'](0x194);}return _0xff5ff;};}function handleError(_0x2eb89f,_0x5d2ef9){_0x5d2ef9=_0x5d2ef9||0x1f4;return function(_0x23ed3d){logger[_0xc5dd('0x28')](_0x23ed3d[_0xc5dd('0x29')]);if(_0x23ed3d[_0xc5dd('0x2a')]){delete _0x23ed3d[_0xc5dd('0x2a')];}_0x2eb89f[_0xc5dd('0x1a')](_0x5d2ef9)[_0xc5dd('0x2b')](_0x23ed3d);};}exports[_0xc5dd('0x2c')]=function(_0x4a3472,_0x3e46ab){var _0x1926ee={},_0x4a2483={},_0x1209b3={'count':0x0,'rows':[]};var _0x3abe0c=_[_0xc5dd('0x2d')](db[_0xc5dd('0x2e')][_0xc5dd('0x2f')],function(_0x119e68){return{'name':_0x119e68[_0xc5dd('0x30')],'type':_0x119e68[_0xc5dd('0x31')][_0xc5dd('0x32')]};});_0x4a2483[_0xc5dd('0x33')]=_[_0xc5dd('0x2d')](_0x3abe0c,_0xc5dd('0x2a'));_0x4a2483[_0xc5dd('0x34')]=_[_0xc5dd('0x35')](_0x4a3472[_0xc5dd('0x34')]);_0x4a2483[_0xc5dd('0x36')]=_[_0xc5dd('0x37')](_0x4a2483['model'],_0x4a2483[_0xc5dd('0x34')]);_0x1926ee['attributes']=_[_0xc5dd('0x37')](_0x4a2483[_0xc5dd('0x33')],qs[_0xc5dd('0x38')](_0x4a3472[_0xc5dd('0x34')][_0xc5dd('0x38')]));_0x1926ee[_0xc5dd('0x39')]=_0x1926ee[_0xc5dd('0x39')]['length']?_0x1926ee[_0xc5dd('0x39')]:_0x4a2483[_0xc5dd('0x33')];if(!_0x4a3472[_0xc5dd('0x34')][_0xc5dd('0x3a')]('nolimit')){_0x1926ee['limit']=qs[_0xc5dd('0x1d')](_0x4a3472['query'][_0xc5dd('0x1d')]);_0x1926ee['offset']=qs['offset'](_0x4a3472['query'][_0xc5dd('0x1f')]);}_0x1926ee[_0xc5dd('0x3b')]=qs[_0xc5dd('0x3c')](_0x4a3472[_0xc5dd('0x34')]['sort']);_0x1926ee[_0xc5dd('0x3d')]=qs['filters'](_[_0xc5dd('0x3e')](_0x4a3472['query'],_0x4a2483[_0xc5dd('0x36')]),_0x3abe0c);if(_0x4a3472[_0xc5dd('0x34')][_0xc5dd('0x3f')]){_0x1926ee[_0xc5dd('0x3d')]=_['merge'](_0x1926ee['where'],{'$or':_[_0xc5dd('0x2d')](_0x3abe0c,function(_0x4c3965){if(_0x4c3965[_0xc5dd('0x31')]!==_0xc5dd('0x40')){var _0x5be16d={};_0x5be16d[_0x4c3965['name']]={'$like':'%'+_0x4a3472[_0xc5dd('0x34')]['filter']+'%'};return _0x5be16d;}})});}_0x1926ee=_['merge']({},_0x1926ee,_0x4a3472[_0xc5dd('0x41')]);var _0x6e4163={'where':_0x1926ee['where']};return db[_0xc5dd('0x2e')][_0xc5dd('0x1e')](_0x6e4163)['then'](function(_0x3ce419){_0x1209b3['count']=_0x3ce419;if(_0x4a3472[_0xc5dd('0x34')]['includeAll']){_0x1926ee[_0xc5dd('0x42')]=[{'all':!![]}];}return db[_0xc5dd('0x2e')]['findAll'](_0x1926ee);})[_0xc5dd('0x26')](function(_0x398f18){_0x1209b3['rows']=_0x398f18;return _0x1209b3;})['then'](respondWithFilteredResult(_0x3e46ab,_0x1926ee))[_0xc5dd('0x43')](handleError(_0x3e46ab,null));};exports[_0xc5dd('0x44')]=function(_0x32dad6,_0x5f181d){var _0x35bfaf={'raw':!![],'where':{'id':_0x32dad6[_0xc5dd('0x45')]['id']}},_0x24733e={};_0x24733e[_0xc5dd('0x33')]=_[_0xc5dd('0x35')](db[_0xc5dd('0x2e')][_0xc5dd('0x2f')]);_0x24733e['query']=_['keys'](_0x32dad6['query']);_0x24733e[_0xc5dd('0x36')]=_['intersection'](_0x24733e[_0xc5dd('0x33')],_0x24733e[_0xc5dd('0x34')]);_0x35bfaf[_0xc5dd('0x39')]=_[_0xc5dd('0x37')](_0x24733e[_0xc5dd('0x33')],qs['fields'](_0x32dad6[_0xc5dd('0x34')][_0xc5dd('0x38')]));_0x35bfaf[_0xc5dd('0x39')]=_0x35bfaf['attributes'][_0xc5dd('0x46')]?_0x35bfaf[_0xc5dd('0x39')]:_0x24733e[_0xc5dd('0x33')];if(_0x32dad6[_0xc5dd('0x34')]['includeAll']){_0x35bfaf['include']=[{'all':!![]}];}_0x35bfaf=_['merge']({},_0x35bfaf,_0x32dad6[_0xc5dd('0x41')]);return db[_0xc5dd('0x2e')][_0xc5dd('0x47')](_0x35bfaf)[_0xc5dd('0x26')](handleEntityNotFound(_0x5f181d,null))['then'](respondWithResult(_0x5f181d,null))[_0xc5dd('0x43')](handleError(_0x5f181d,null));};exports[_0xc5dd('0x48')]=function(_0x4e657d,_0x11e046){var _0x4713b5={'where':{'id':_0x4e657d[_0xc5dd('0x45')]['id']}},_0x52d3ed={};_0x52d3ed[_0xc5dd('0x33')]=_[_0xc5dd('0x35')](db[_0xc5dd('0x2e')][_0xc5dd('0x2f')]);_0x4713b5[_0xc5dd('0x39')]=_['intersection'](_0x52d3ed[_0xc5dd('0x33')],qs[_0xc5dd('0x38')](_0x4e657d[_0xc5dd('0x34')][_0xc5dd('0x38')]));_0x4713b5[_0xc5dd('0x39')]=_0x4713b5['attributes'][_0xc5dd('0x46')]?_0x4713b5[_0xc5dd('0x39')]:_0x52d3ed[_0xc5dd('0x33')];if(_0x4e657d[_0xc5dd('0x34')][_0xc5dd('0x49')]){_0x4713b5[_0xc5dd('0x42')]=[{'all':!![]}];}_0x4713b5=_[_0xc5dd('0x4a')]({},_0x4713b5,_0x4e657d[_0xc5dd('0x41')]);return db['Attachment'][_0xc5dd('0x47')](_0x4713b5)[_0xc5dd('0x26')](handleEntityNotFound(_0x11e046,null))[_0xc5dd('0x26')](function(_0x5e7155){if(_0x5e7155){var _0x5bec58=_0x5e7155['get']({'plain':!![]});_0x5bec58=qs['omit'](_0x5bec58,['id',_0xc5dd('0x4b'),'updatedAt']);_0x4e657d[_0xc5dd('0x4c')]=_[_0xc5dd('0x4d')](_0x4e657d[_0xc5dd('0x4c')],['id','createdAt','updatedAt']);return db[_0xc5dd('0x2e')][_0xc5dd('0x4e')](_['merge'](_0x5bec58,_0x4e657d['body']),{'include':_0x4e657d['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0xc5dd('0x26')](respondWithResult(_0x11e046,0xc9))[_0xc5dd('0x43')](handleError(_0x11e046,null));};exports[_0xc5dd('0x25')]=function(_0x474215,_0x41fe8a){if(_0x474215[_0xc5dd('0x4c')]['id']){delete _0x474215[_0xc5dd('0x4c')]['id'];}return db[_0xc5dd('0x2e')][_0xc5dd('0x47')]({'where':{'id':_0x474215[_0xc5dd('0x45')]['id']}})['then'](handleEntityNotFound(_0x41fe8a,null))['then'](saveUpdates(_0x474215[_0xc5dd('0x4c')],null))[_0xc5dd('0x26')](respondWithResult(_0x41fe8a,null))[_0xc5dd('0x43')](handleError(_0x41fe8a,null));};exports[_0xc5dd('0x27')]=function(_0x3cc8c0,_0x55d3e8){return db[_0xc5dd('0x2e')][_0xc5dd('0x47')]({'where':{'id':_0x3cc8c0[_0xc5dd('0x45')]['id']}})[_0xc5dd('0x26')](handleEntityNotFound(_0x55d3e8,null))['then'](removeEntity(_0x55d3e8,null))[_0xc5dd('0x43')](handleError(_0x55d3e8,null));};exports['create']=function(_0x17c1c7,_0x1f00d9,_0x2a7752){_0x17c1c7[_0xc5dd('0x4c')][_0xc5dd('0x2a')]=_0x17c1c7[_0xc5dd('0x4f')][_0xc5dd('0x50')];_0x17c1c7['body'][_0xc5dd('0x51')]=_0x17c1c7[_0xc5dd('0x4f')][_0xc5dd('0x52')];_0x17c1c7[_0xc5dd('0x4c')][_0xc5dd('0x31')]=_0x17c1c7[_0xc5dd('0x4f')][_0xc5dd('0x53')];return db['Attachment'][_0xc5dd('0x4e')](_0x17c1c7[_0xc5dd('0x4c')])[_0xc5dd('0x26')](respondWithResult(_0x1f00d9,0xc9))[_0xc5dd('0x43')](handleError(_0x1f00d9,null));};exports[_0xc5dd('0x54')]=function(_0x1165f9,_0x5d35de,_0x53963b){return db[_0xc5dd('0x2e')][_0xc5dd('0x55')]({'where':{'id':_0x1165f9[_0xc5dd('0x45')]['id']},'raw':!![]})[_0xc5dd('0x26')](handleEntityNotFound(_0x5d35de,null))[_0xc5dd('0x26')](function(_0x4c59f9){if(_0x4c59f9){var _0x551748=_0x4c59f9[_0xc5dd('0x56')]!==null;var _0x17d9d7=path['join'](config[_0xc5dd('0x57')],'server/files/attachments/');if(_0x551748){_0x17d9d7=path[_0xc5dd('0x58')](_0x17d9d7,'offline-chat/');}var _0x339eb0=path[_0xc5dd('0x58')](_0x17d9d7,_0x4c59f9[_0xc5dd('0x51')]);return _0x5d35de[_0xc5dd('0x54')](_0x339eb0);}})['catch'](handleError(_0x5d35de,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 9c2ac48..458349e 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 _0x64a6=['attachments','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./attachment.attributes','exports','define'];(function(_0xf6c391,_0x1c7537){var _0x1f6ace=function(_0x387c7b){while(--_0x387c7b){_0xf6c391['push'](_0xf6c391['shift']());}};_0x1f6ace(++_0x1c7537);}(_0x64a6,0x1da));var _0x664a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x64a6[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x664a('0x0'));var util=require(_0x664a('0x1'));var logger=require(_0x664a('0x2'))(_0x664a('0x3'));var moment=require(_0x664a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x664a('0x5'));var config=require(_0x664a('0x6'));var attributes=require(_0x664a('0x7'));module[_0x664a('0x8')]=function(_0x3a4ce6,_0x3b3d35){return _0x3a4ce6[_0x664a('0x9')]('Attachment',attributes,{'tableName':_0x664a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a61=['Attachment','attachments','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x400b43,_0x55da4e){var _0x3c330f=function(_0x5bbd52){while(--_0x5bbd52){_0x400b43['push'](_0x400b43['shift']());}};_0x3c330f(++_0x55da4e);}(_0x5a61,0x1f1));var _0x15a6=function(_0x4bcbc2,_0x46cbff){_0x4bcbc2=_0x4bcbc2-0x0;var _0xe5b888=_0x5a61[_0x4bcbc2];return _0xe5b888;};'use strict';var _=require(_0x15a6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x15a6('0x1'));var BPromise=require(_0x15a6('0x2'));var rp=require(_0x15a6('0x3'));var fs=require('fs');var path=require(_0x15a6('0x4'));var rimraf=require(_0x15a6('0x5'));var config=require(_0x15a6('0x6'));var attributes=require('./attachment.attributes');module[_0x15a6('0x7')]=function(_0x22419c,_0x8e9f6){return _0x22419c[_0x15a6('0x8')](_0x15a6('0x9'),attributes,{'tableName':_0x15a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 60e65dd..8f93b29 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 _0x6c76=['request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','CreateAttachment','debug','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','info','Attachment,\x20%s,\x20%s'];(function(_0x3c549d,_0x1e8903){var _0xd134db=function(_0x512656){while(--_0x512656){_0x3c549d['push'](_0x3c549d['shift']());}};_0xd134db(++_0x1e8903);}(_0x6c76,0x184));var _0x66c7=function(_0x26df51,_0x534482){_0x26df51=_0x26df51-0x0;var _0x99842c=_0x6c76[_0x26df51];return _0x99842c;};'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});function respondWithRpcPromise(_0x23408c,_0x4dffcd,_0x4fa6ce){return new BPromise(function(_0x208d06,_0x2b0065){return client[_0x66c7('0x9')](_0x23408c,_0x4fa6ce)['then'](function(_0x20c010){logger[_0x66c7('0xa')](_0x66c7('0xb'),_0x4dffcd,_0x66c7('0xc'));logger['debug'](_0x66c7('0xd'),_0x4dffcd,_0x66c7('0xc'),JSON[_0x66c7('0xe')](_0x20c010));if(_0x20c010[_0x66c7('0xf')]){if(_0x20c010[_0x66c7('0xf')][_0x66c7('0x10')]===0x1f4){logger[_0x66c7('0xf')]('Attachment,\x20%s,\x20%s',_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x2b0065(_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);}logger[_0x66c7('0xf')](_0x66c7('0xb'),_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x208d06(_0x20c010[_0x66c7('0xf')]['message']);}else{logger[_0x66c7('0xa')]('Attachment,\x20%s,\x20%s',_0x4dffcd,_0x66c7('0xc'));_0x208d06(_0x20c010[_0x66c7('0x12')][_0x66c7('0x11')]);}})[_0x66c7('0x13')](function(_0x22b262){logger['error']('Attachment,\x20%s,\x20%s',_0x4dffcd,_0x22b262);_0x2b0065(_0x22b262);});});}exports['CreateAttachment']=function(_0x5129f6){var _0x8ad572=this;return new Promise(function(_0x19f29d,_0x47a299){return db['Attachment'][_0x66c7('0x14')](_0x5129f6[_0x66c7('0x15')],{'raw':_0x5129f6[_0x66c7('0x16')]?_0x5129f6[_0x66c7('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1853b2){logger[_0x66c7('0xa')](_0x66c7('0x17'),_0x5129f6);logger[_0x66c7('0x18')](_0x66c7('0x17'),_0x5129f6,JSON[_0x66c7('0xe')](_0x1853b2));_0x19f29d(_0x1853b2);})['catch'](function(_0x4ddbd2){logger[_0x66c7('0xf')]('CreateAttachment',_0x4ddbd2[_0x66c7('0x11')],_0x5129f6);_0x47a299(_0x8ad572[_0x66c7('0xf')](0x1f4,_0x4ddbd2[_0x66c7('0x11')]));});});}; \ No newline at end of file +var _0xc788=['catch','CreateAttachment','body','options','raw','debug','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','error','message','Attachment,\x20%s,\x20%s','result'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xc788,0xc4));var _0x8c78=function(_0x568cf0,_0x1a44cb){_0x568cf0=_0x568cf0-0x0;var _0x360f81=_0xc788[_0x568cf0];return _0x360f81;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var moment=require(_0x8c78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c78('0x3'));var db=require(_0x8c78('0x4'))['db'];var utils=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c78('0x8'));var client=jayson[_0x8c78('0x9')][_0x8c78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ac27f,_0x205cc1,_0x4d54a5){return new BPromise(function(_0x247188,_0x299d9d){return client[_0x8c78('0xb')](_0x1ac27f,_0x4d54a5)[_0x8c78('0xc')](function(_0xdb0c17){logger[_0x8c78('0xd')]('Attachment,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));logger['debug'](_0x8c78('0xf'),_0x205cc1,_0x8c78('0xe'),JSON['stringify'](_0xdb0c17));if(_0xdb0c17[_0x8c78('0x10')]){if(_0xdb0c17[_0x8c78('0x10')]['code']===0x1f4){logger[_0x8c78('0x10')]('Attachment,\x20%s,\x20%s',_0x205cc1,_0xdb0c17['error'][_0x8c78('0x11')]);return _0x299d9d(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);return _0x247188(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}else{logger[_0x8c78('0xd')]('Attachment,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));_0x247188(_0xdb0c17[_0x8c78('0x13')]['message']);}})[_0x8c78('0x14')](function(_0x554464){logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0x554464);_0x299d9d(_0x554464);});});}exports[_0x8c78('0x15')]=function(_0x461eff){var _0x54eafa=this;return new Promise(function(_0x4f7bf9,_0x339d04){return db['Attachment']['create'](_0x461eff[_0x8c78('0x16')],{'raw':_0x461eff['options']?_0x461eff[_0x8c78('0x17')][_0x8c78('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x6c9a12){logger['info'](_0x8c78('0x15'),_0x461eff);logger[_0x8c78('0x19')]('CreateAttachment',_0x461eff,JSON[_0x8c78('0x1a')](_0x6c9a12));_0x4f7bf9(_0x6c9a12);})[_0x8c78('0x14')](function(_0x499603){logger[_0x8c78('0x10')](_0x8c78('0x15'),_0x499603[_0x8c78('0x11')],_0x461eff);_0x339d04(_0x54eafa[_0x8c78('0x10')](0x1f4,_0x499603[_0x8c78('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 118bc11..0fe5395 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x1e48bc,_0x5700f5){_0x1e48bc=_0x1e48bc-0x0;var _0x5ba90d=_0xdb28[_0x1e48bc];return _0x5ba90d;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +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(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index f21dce6..dfcb3b7 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 _0x83c8=['Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','google','/login','profile','email','callback','clientID','secret','callbackURL','Setting','findOne','then','find','map','emails','value','admin','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','minutes','getLicense','catch','lodash','passport'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x83c8,0x196));var _0x883c=function(_0xbb9b40,_0x51b63a){_0xbb9b40=_0xbb9b40-0x0;var _0x4cd1b3=_0x83c8[_0xbb9b40];return _0x4cd1b3;};'use strict';var _=require(_0x883c('0x0'));var passport=require(_0x883c('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0x883c('0x2')];var moment=require(_0x883c('0x3'));var db=require(_0x883c('0x4'))['db'];var config=require(_0x883c('0x5'));var signToken=require(_0x883c('0x6'))[_0x883c('0x7')];var utils=require(_0x883c('0x8'));exports['login']=passport['authenticate'](_0x883c('0x9'),{'failureRedirect':_0x883c('0xa'),'scope':[_0x883c('0xb'),_0x883c('0xc')],'session':![]});exports[_0x883c('0xd')]=passport['authenticate'](_0x883c('0x9'),{'failureRedirect':_0x883c('0xa'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config['google']?config[_0x883c('0x9')][_0x883c('0xe')]:'id','clientSecret':config[_0x883c('0x9')]?config[_0x883c('0x9')]['clientSecret']:_0x883c('0xf'),'callbackURL':config['google']?config['google'][_0x883c('0x10')]:''},function(_0x2a2777,_0x2e73f0,_0x1f3806,_0x5e8979){var _0x4fefe5,_0x344476;return db[_0x883c('0x11')][_0x883c('0x12')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x883c('0x13')](function(_0x23aadc){_0x4fefe5=_0x23aadc;return db['User'][_0x883c('0x14')]({'where':{'email':_[_0x883c('0x15')](_0x1f3806[_0x883c('0x16')],_0x883c('0x17')),'role':{'$or':[_0x883c('0x18'),'user','agent']}}});})[_0x883c('0x13')](function(_0xc33e84){_0x344476=_0xc33e84;if(_0x344476){if(_0x344476[_0x883c('0x19')]){return _0x5e8979(_0x883c('0x1a'));}else if(_0x4fefe5[_0x883c('0x1b')]>0x0){if(_0x344476[_0x883c('0x1c')]){if(moment(_0x344476[_0x883c('0x1d')])[_0x883c('0x1e')](_0x4fefe5[_0x883c('0x1b')],_0x883c('0x1f'))>moment()){return _0x5e8979(_0x883c('0x1a'));}else{return utils['clearBlockUser'](_0x344476,0x0,![],null)[_0x883c('0x13')](function(){return utils[_0x883c('0x20')](_0x344476);})[_0x883c('0x13')](function(){return _0x5e8979(null,_0x344476);});}}else{return utils[_0x883c('0x20')](_0x344476)[_0x883c('0x13')](function(){return _0x5e8979(null,_0x344476);});}}else{return utils[_0x883c('0x20')](_0x344476)[_0x883c('0x13')](function(){return _0x5e8979(null,_0x344476);});}}return _0x5e8979(_0x883c('0x1a'));})[_0x883c('0x21')](function(_0x3f389c){_0x5e8979(_0x3f389c);});})); \ No newline at end of file +var _0xfa15=['getLicense','lodash','passport','../../mysqldb','../../components/auth/service','../../config/utils','login','authenticate','/login','profile','email','google','use','clientID','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','map','emails','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes'];(function(_0x4a9f71,_0x1db1ce){var _0x1134cd=function(_0x3e456d){while(--_0x3e456d){_0x4a9f71['push'](_0x4a9f71['shift']());}};_0x1134cd(++_0x1db1ce);}(_0xfa15,0xa6));var _0x5fa1=function(_0x13485b,_0x29fb3e){_0x13485b=_0x13485b-0x0;var _0x4ae5e8=_0xfa15[_0x13485b];return _0x4ae5e8;};'use strict';var _=require(_0x5fa1('0x0'));var passport=require(_0x5fa1('0x1'));var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require('moment');var db=require(_0x5fa1('0x2'))['db'];var config=require('../../config/environment');var signToken=require(_0x5fa1('0x3'))['signToken'];var utils=require(_0x5fa1('0x4'));exports[_0x5fa1('0x5')]=passport[_0x5fa1('0x6')]('google',{'failureRedirect':_0x5fa1('0x7'),'scope':[_0x5fa1('0x8'),_0x5fa1('0x9')],'session':![]});exports['callback']=passport[_0x5fa1('0x6')](_0x5fa1('0xa'),{'failureRedirect':'/login','session':![]});passport[_0x5fa1('0xb')](new GoogleStrategy({'clientID':config['google']?config['google'][_0x5fa1('0xc')]:'id','clientSecret':config[_0x5fa1('0xa')]?config['google']['clientSecret']:_0x5fa1('0xd'),'callbackURL':config[_0x5fa1('0xa')]?config[_0x5fa1('0xa')][_0x5fa1('0xe')]:''},function(_0x40eba5,_0x2cb3ea,_0x22fcc4,_0x207902){var _0x1f010c,_0x3af1eb;return db[_0x5fa1('0xf')][_0x5fa1('0x10')]({'where':{'id':0x1},'attributes':[_0x5fa1('0x11'),_0x5fa1('0x12')],'raw':!![]})[_0x5fa1('0x13')](function(_0x379d1e){_0x1f010c=_0x379d1e;return db['User']['find']({'where':{'email':_[_0x5fa1('0x14')](_0x22fcc4[_0x5fa1('0x15')],_0x5fa1('0x16')),'role':{'$or':[_0x5fa1('0x17'),_0x5fa1('0x18'),_0x5fa1('0x19')]}}});})[_0x5fa1('0x13')](function(_0x3ef4ab){_0x3af1eb=_0x3ef4ab;if(_0x3af1eb){if(_0x3af1eb[_0x5fa1('0x1a')]){return _0x207902(_0x5fa1('0x1b'));}else if(_0x1f010c[_0x5fa1('0x12')]>0x0){if(_0x3af1eb[_0x5fa1('0x1c')]){if(moment(_0x3af1eb[_0x5fa1('0x1d')])[_0x5fa1('0x1e')](_0x1f010c[_0x5fa1('0x12')],_0x5fa1('0x1f'))>moment()){return _0x207902('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils['clearBlockUser'](_0x3af1eb,0x0,![],null)['then'](function(){return utils['getLicense'](_0x3af1eb);})[_0x5fa1('0x13')](function(){return _0x207902(null,_0x3af1eb);});}}else{return utils[_0x5fa1('0x20')](_0x3af1eb)[_0x5fa1('0x13')](function(){return _0x207902(null,_0x3af1eb);});}}else{return utils[_0x5fa1('0x20')](_0x3af1eb)[_0x5fa1('0x13')](function(){return _0x207902(null,_0x3af1eb);});}}return _0x207902(_0x5fa1('0x1b'));})['catch'](function(_0x13e4ef){_0x207902(_0x13e4ef);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 0520ffe..c55aedc 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 _0x7b04=['Router','./authGoogle.controller','../../components/auth/service','get','login','/callback','isMiddleware','setTokenCookie','exports','passport'];(function(_0x28c959,_0x1b5063){var _0x1815ef=function(_0x7af2be){while(--_0x7af2be){_0x28c959['push'](_0x28c959['shift']());}};_0x1815ef(++_0x1b5063);}(_0x7b04,0x12b));var _0x47b0=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x7b04[_0x2235bf];return _0x4c3a64;};'use strict';var express=require('express');var passport=require(_0x47b0('0x0'));var router=express[_0x47b0('0x1')]();var controller=require(_0x47b0('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x47b0('0x3'));router[_0x47b0('0x4')]('/',controller[_0x47b0('0x5')]);router[_0x47b0('0x4')](_0x47b0('0x6'),controller['callback'],authService[_0x47b0('0x7')],userController[_0x47b0('0x5')],authService[_0x47b0('0x8')]);module[_0x47b0('0x9')]=router; \ No newline at end of file +var _0x8756=['setTokenCookie','exports','express','passport','Router','../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware','login'];(function(_0x394eda,_0x2b141a){var _0x3338d1=function(_0x3d3d96){while(--_0x3d3d96){_0x394eda['push'](_0x394eda['shift']());}};_0x3338d1(++_0x2b141a);}(_0x8756,0xc2));var _0x6875=function(_0x134258,_0x44296d){_0x134258=_0x134258-0x0;var _0x4fa42f=_0x8756[_0x134258];return _0x4fa42f;};'use strict';var express=require(_0x6875('0x0'));var passport=require(_0x6875('0x1'));var router=express[_0x6875('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x6875('0x3'));var authService=require(_0x6875('0x4'));router[_0x6875('0x5')]('/',controller['login']);router[_0x6875('0x5')](_0x6875('0x6'),controller[_0x6875('0x7')],authService[_0x6875('0x8')],userController[_0x6875('0x9')],authService[_0x6875('0xa')]);module[_0x6875('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 260fa3d..c0e1f42 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 _0xfc03=['login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','resetPasswordExpires','save','use','util','passport-local','Strategy','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','role','disabled','blocked','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','add','clearBlockUser','blockedAt','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','error','status','send'];(function(_0x2520ab,_0x3c456a){var _0x597c0d=function(_0x5a225c){while(--_0x5a225c){_0x2520ab['push'](_0x2520ab['shift']());}};_0x597c0d(++_0x3c456a);}(_0xfc03,0x16f));var _0x3fc0=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xfc03[_0x2e4e19];return _0x9ba20b;};'use strict';var util=require(_0x3fc0('0x0'));var passport=require('passport');var LocalStrategy=require(_0x3fc0('0x1'))[_0x3fc0('0x2')];var jayson=require('jayson/promise');var _=require(_0x3fc0('0x3'));var rs=require('randomstring');var moment=require(_0x3fc0('0x4'));var db=require(_0x3fc0('0x5'))['db'];var authService=require(_0x3fc0('0x6'));var utils=require(_0x3fc0('0x7'));var client=jayson[_0x3fc0('0x8')][_0x3fc0('0x9')]({'port':0x232b});function localAuthenticate(_0x2b4ef6,_0xeeb912,_0x55eac5,_0x2fb1a6){var _0x5f52b5,_0x1369ac;return db[_0x3fc0('0xa')][_0x3fc0('0xb')]({'where':{'id':0x1},'attributes':[_0x3fc0('0xc'),'blockDuration'],'raw':!![]})[_0x3fc0('0xd')](function(_0x929f8f){_0x5f52b5=_0x929f8f;return _0x2b4ef6[_0x3fc0('0xb')]({'attributes':['id',_0x3fc0('0xe'),_0x3fc0('0xf'),'salt',_0x3fc0('0x10'),_0x3fc0('0x11'),_0x3fc0('0x12'),'blockedAt',_0x3fc0('0x13')],'where':{'name':_0xeeb912,'role':{'$or':['admin',_0x3fc0('0x14'),_0x3fc0('0x15')]}}});})['then'](function(_0x3fe564){if(!_0x3fe564||_0x3fe564&&_0x3fe564[_0x3fc0('0xe')]!==_0xeeb912){throw new Error(_0x3fc0('0x16'));}else{_0x1369ac=_0x3fe564;return _0x1369ac;}})['then'](function(){_0x1369ac[_0x3fc0('0x17')](_0x55eac5,function(_0x3ac8c3,_0x367ce1){var _0x27619a=_0x1369ac['loginAttempts']+0x1;if(_0x3ac8c3){return _0x2fb1a6(_0x3ac8c3);}else if(!_0x367ce1){if(_0x1369ac[_0x3fc0('0x11')]){return _0x2fb1a6(null,![],{'message':_0x3fc0('0x16')});}else if(_0x5f52b5[_0x3fc0('0xc')]>0x0){if(_0x1369ac['blocked']){if(_0x5f52b5[_0x3fc0('0x18')]>0x0){if(moment(_0x1369ac['blockedAt'])[_0x3fc0('0x19')](_0x5f52b5[_0x3fc0('0x18')],'minutes')>moment()){return _0x2fb1a6(null,![],{'message':_0x3fc0('0x16')});}else{return utils[_0x3fc0('0x1a')](_0x1369ac,_0x27619a,![],null)[_0x3fc0('0xd')](function(){return _0x2fb1a6(null,![],{'message':_0x3fc0('0x16')});});}}else{return _0x2fb1a6(null,![],{'message':_0x3fc0('0x16')});}}else{if(_0x27619a>=_0x5f52b5[_0x3fc0('0xc')]){return utils[_0x3fc0('0x1a')](_0x1369ac,0x0,!![],moment())[_0x3fc0('0xd')](function(){return _0x2fb1a6(null,![],{'message':_0x3fc0('0x16')});});}else{return utils['clearBlockUser'](_0x1369ac,_0x27619a,![],null)[_0x3fc0('0xd')](function(){return _0x2fb1a6(null,![],{'message':_0x3fc0('0x16')});});}}}else{return _0x2fb1a6(null,![],{'message':_0x3fc0('0x16')});}}else{if(_0x1369ac[_0x3fc0('0x11')]){return _0x2fb1a6(null,![],{'message':_0x3fc0('0x16')});}else if(_0x5f52b5[_0x3fc0('0xc')]>0x0){if(_0x1369ac['blocked']){if(_0x5f52b5[_0x3fc0('0x18')]>0x0){if(moment(_0x1369ac[_0x3fc0('0x1b')])[_0x3fc0('0x19')](_0x5f52b5[_0x3fc0('0x18')],_0x3fc0('0x1c'))>moment()){return _0x2fb1a6(null,![],{'message':_0x3fc0('0x16')});}else{return utils[_0x3fc0('0x1a')](_0x1369ac,0x0,![],null)[_0x3fc0('0xd')](function(){return utils[_0x3fc0('0x1d')](_0x1369ac);})[_0x3fc0('0xd')](function(){return _0x2fb1a6(null,_0x1369ac);});}}else{return _0x2fb1a6(null,![],{'message':_0x3fc0('0x16')});}}else{return utils[_0x3fc0('0x1a')](_0x1369ac,0x0,![],null)[_0x3fc0('0xd')](function(){return utils[_0x3fc0('0x1d')](_0x1369ac);})[_0x3fc0('0xd')](function(){return _0x2fb1a6(null,_0x1369ac);})[_0x3fc0('0x1e')](function(_0x4f5111){return _0x2fb1a6(null,![],_0x4f5111);});}}else{if(_0x1369ac[_0x3fc0('0x12')]){return _0x2fb1a6(null,![],{'message':_0x3fc0('0x16')});}else{return utils[_0x3fc0('0x1d')](_0x1369ac)[_0x3fc0('0xd')](function(){return _0x2fb1a6(null,_0x1369ac);});}}}});})['catch'](function(_0x134317){return _0x2fb1a6(null,![],_0x134317);});}function sendServiceMail(_0x197dfa){return db[_0x3fc0('0x1f')][_0x3fc0('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0x3fc0('0x21')],'include':[{'model':db[_0x3fc0('0x22')],'as':_0x3fc0('0x23')}]})[_0x3fc0('0xd')](function(_0x29aa32){if(!_0x29aa32){throw new Error(_0x3fc0('0x24'));}var _0x485f0c={'tls':{'rejectUnauthorized':![]}};if(_0x29aa32[_0x3fc0('0x23')][_0x3fc0('0x25')]){_0x485f0c[_0x3fc0('0x25')]=_0x29aa32[_0x3fc0('0x23')][_0x3fc0('0x25')];}else{_0x485f0c[_0x3fc0('0x26')]=_0x29aa32[_0x3fc0('0x23')][_0x3fc0('0x26')];_0x485f0c['port']=_0x29aa32['Smtp'][_0x3fc0('0x27')];_0x485f0c['secure']=_0x29aa32[_0x3fc0('0x23')][_0x3fc0('0x28')];}if(_0x29aa32[_0x3fc0('0x23')][_0x3fc0('0x29')]){_0x485f0c[_0x3fc0('0x2a')]={'user':_0x29aa32['Smtp']['user'],'pass':_0x29aa32[_0x3fc0('0x23')][_0x3fc0('0x2b')]};}var _0x151492={'account':_0x485f0c,'message':_[_0x3fc0('0x2c')]({'from':util[_0x3fc0('0x2d')]('\x22%s\x22\x20<%s>',_0x29aa32[_0x3fc0('0xe')],_0x29aa32[_0x3fc0('0x21')]||_0x29aa32[_0x3fc0('0x23')]['user'])},_0x197dfa)};return client[_0x3fc0('0x2e')](_0x3fc0('0x2f'),_0x151492);})[_0x3fc0('0xd')](function(_0x2eee6e){if(_0x2eee6e['error']){throw new Error(util[_0x3fc0('0x2d')](_0x3fc0('0x30'),_0x2eee6e['error'][_0x3fc0('0x31')]||JSON['stringify'](_0x2eee6e[_0x3fc0('0x32')])));}return!![];});}function handleError(_0x193f74,_0xc97121,_0x2db02e){return _0x193f74[_0x3fc0('0x33')](_0xc97121||0x1f4)[_0x3fc0('0x34')]({'message':_0x2db02e?_0x2db02e[_0x3fc0('0x31')]||_0x2db02e:''});}exports[_0x3fc0('0x35')]=function(_0x5bb04d,_0x2e479f,_0x41b4b3){passport['authenticate'](_0x3fc0('0x36'),function(_0x145442,_0x2af7c6,_0x28b4d5){var _0x21de4c=_0x145442||_0x28b4d5;if(_0x21de4c){return handleError(_0x2e479f,0x191,_0x21de4c);}if(!_0x2af7c6){return handleError(_0x2e479f,0x194,{'message':_0x3fc0('0x37')});}else{var _0x5176fb={'payload':{'id':_0x2af7c6['id'],'role':_0x2af7c6['role']},'options':{'expiresIn':0x15180}};return authService[_0x3fc0('0x38')](_0x5176fb)[_0x3fc0('0xd')](function(_0x35310e){_0x2e479f[_0x3fc0('0x39')]({'id':_0x2af7c6['id'],'token':_0x35310e,'statusCall':'','isAlreadyLogged':_0x2af7c6[_0x3fc0('0x3a')]});});}})(_0x5bb04d,_0x2e479f,_0x41b4b3);};exports['forgot']=function(_0x53b45e,_0x5c87af,_0x1bc6ad){if(!_0x53b45e[_0x3fc0('0x3b')][_0x3fc0('0x21')]){return handleError(_0x5c87af,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x5e3d79=rs[_0x3fc0('0x3c')]();_0x53b45e[_0x3fc0('0x3b')][_0x3fc0('0x21')]=_0x53b45e[_0x3fc0('0x3b')]['email']['trim']()[_0x3fc0('0x3d')]();var _0x2a45dc;return db['Setting'][_0x3fc0('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x3fc0('0x18')],'raw':!![]})[_0x3fc0('0xd')](function(_0x33af75){_0x2a45dc=_0x33af75;return db[_0x3fc0('0x3e')][_0x3fc0('0x20')]({'where':{'email':_0x53b45e[_0x3fc0('0x3b')][_0x3fc0('0x21')]}});})[_0x3fc0('0xd')](function(_0x508137){if(!_0x508137){throw new Error(_0x3fc0('0x3f'));}if(_0x508137['disabled']){throw new Error(_0x3fc0('0x40'));}if(_0x508137[_0x3fc0('0x12')]){if(moment(_0x508137[_0x3fc0('0x1b')])[_0x3fc0('0x19')](_0x2a45dc[_0x3fc0('0x18')],'minutes')>moment()){throw new Error(_0x3fc0('0x41'));}else{_0x508137[_0x3fc0('0x12')]=![];_0x508137[_0x3fc0('0x1b')]=null;}}_0x508137[_0x3fc0('0x42')]=_0x5e3d79;_0x508137['resetPasswordExpires']=Date[_0x3fc0('0x43')]()+0x36ee80;return _0x508137['save']();})[_0x3fc0('0xd')](function(){return sendServiceMail({'to':_0x53b45e[_0x3fc0('0x3b')][_0x3fc0('0x21')],'subject':_0x3fc0('0x44'),'text':_0x3fc0('0x45')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x3fc0('0x46')+_0x53b45e[_0x3fc0('0x47')][_0x3fc0('0x26')]+'/reset/'+_0x5e3d79+'\x0a\x0a'+_0x3fc0('0x48')});})[_0x3fc0('0xd')](function(){_0x5c87af['status'](0xc8)[_0x3fc0('0x34')]({'message':_0x3fc0('0x49')});})[_0x3fc0('0x1e')](function(_0x51489b){return handleError(_0x5c87af,0x1f4,_0x51489b);});};exports['reset']=function(_0x3a35ac,_0xa3de5a,_0xb70836){return db['User'][_0x3fc0('0x20')]({'where':{'resetPasswordToken':_0x3a35ac['params'][_0x3fc0('0x4a')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x5be8cc){if(!_0x5be8cc){throw new Error(_0x3fc0('0x4b'));}return db[_0x3fc0('0xa')][_0x3fc0('0xb')]({'attributes':['id',_0x3fc0('0x4c'),_0x3fc0('0x4d'),_0x3fc0('0x4e')]})['then'](function(_0x2cf279){if(_0x2cf279[_0x3fc0('0x4c')])authService['validatePasswordPattern'](_0x3a35ac['body'][_0x3fc0('0xf')]);if(!_0x2cf279[_0x3fc0('0x4d')]||!_0x5be8cc[_0x3fc0('0x4f')])return _0x5be8cc;authService[_0x3fc0('0x50')](_0x3a35ac[_0x3fc0('0x3b')][_0x3fc0('0xf')],_0x5be8cc[_0x3fc0('0x4f')],_0x2cf279[_0x3fc0('0x4e')]);return _0x5be8cc;})[_0x3fc0('0xd')](function(){_0x5be8cc[_0x3fc0('0xf')]=_0x3a35ac[_0x3fc0('0x3b')][_0x3fc0('0xf')];_0x5be8cc['resetPasswordToken']=null;_0x5be8cc[_0x3fc0('0x51')]=null;return _0x5be8cc[_0x3fc0('0x52')]();});})[_0x3fc0('0xd')](function(){_0xa3de5a[_0x3fc0('0x33')](0xc8)[_0x3fc0('0x34')]({'message':'Password\x20reset!'});})[_0x3fc0('0x1e')](function(_0x57b6d0){return handleError(_0xa3de5a,0x1f4,_0x57b6d0);});};passport[_0x3fc0('0x53')](new LocalStrategy({'usernameField':_0x3fc0('0xe'),'passwordField':_0x3fc0('0xf')},function(_0x10c05b,_0x519973,_0x1656c7){return localAuthenticate(db[_0x3fc0('0x3e')],_0x10c05b,_0x519973,_0x1656c7);})); \ No newline at end of file +var _0x8e0d=['auth','pass','merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','User','find','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','resetPasswordExpires','send','Password\x20reset!','use','util','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','http','Setting','findOne','allowedLoginAttempts','then','salt','role','disabled','loginAttempts','user','name','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blockedAt','add','minutes','clearBlockUser','blocked','getLicense','catch','MailAccount','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication'];(function(_0x2fa393,_0x57e26d){var _0x15a4fb=function(_0x2a8eb9){while(--_0x2a8eb9){_0x2fa393['push'](_0x2fa393['shift']());}};_0x15a4fb(++_0x57e26d);}(_0x8e0d,0x82));var _0xd8e0=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0x8e0d[_0x531d15];return _0x271a18;};'use strict';var util=require(_0xd8e0('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0xd8e0('0x1')];var jayson=require(_0xd8e0('0x2'));var _=require('lodash');var rs=require(_0xd8e0('0x3'));var moment=require(_0xd8e0('0x4'));var db=require(_0xd8e0('0x5'))['db'];var authService=require(_0xd8e0('0x6'));var utils=require('../../config/utils');var client=jayson['client'][_0xd8e0('0x7')]({'port':0x232b});function localAuthenticate(_0x33ff41,_0x42d42b,_0x1e4616,_0x5e9735){var _0xd0c45c,_0x144a8a;return db[_0xd8e0('0x8')][_0xd8e0('0x9')]({'where':{'id':0x1},'attributes':[_0xd8e0('0xa'),'blockDuration'],'raw':!![]})[_0xd8e0('0xb')](function(_0x565f45){_0xd0c45c=_0x565f45;return _0x33ff41[_0xd8e0('0x9')]({'attributes':['id','name','password',_0xd8e0('0xc'),_0xd8e0('0xd'),_0xd8e0('0xe'),'blocked','blockedAt',_0xd8e0('0xf')],'where':{'name':_0x42d42b,'role':{'$or':['admin',_0xd8e0('0x10'),'agent']}}});})['then'](function(_0x496593){if(!_0x496593||_0x496593&&_0x496593[_0xd8e0('0x11')]!==_0x42d42b){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x144a8a=_0x496593;return _0x144a8a;}})[_0xd8e0('0xb')](function(){_0x144a8a[_0xd8e0('0x12')](_0x1e4616,function(_0x2f0004,_0x14e38b){var _0x2689d3=_0x144a8a[_0xd8e0('0xf')]+0x1;if(_0x2f0004){return _0x5e9735(_0x2f0004);}else if(!_0x14e38b){if(_0x144a8a[_0xd8e0('0xe')]){return _0x5e9735(null,![],{'message':_0xd8e0('0x13')});}else if(_0xd0c45c[_0xd8e0('0xa')]>0x0){if(_0x144a8a['blocked']){if(_0xd0c45c[_0xd8e0('0x14')]>0x0){if(moment(_0x144a8a[_0xd8e0('0x15')])[_0xd8e0('0x16')](_0xd0c45c[_0xd8e0('0x14')],_0xd8e0('0x17'))>moment()){return _0x5e9735(null,![],{'message':_0xd8e0('0x13')});}else{return utils[_0xd8e0('0x18')](_0x144a8a,_0x2689d3,![],null)[_0xd8e0('0xb')](function(){return _0x5e9735(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x5e9735(null,![],{'message':_0xd8e0('0x13')});}}else{if(_0x2689d3>=_0xd0c45c[_0xd8e0('0xa')]){return utils['clearBlockUser'](_0x144a8a,0x0,!![],moment())[_0xd8e0('0xb')](function(){return _0x5e9735(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x144a8a,_0x2689d3,![],null)['then'](function(){return _0x5e9735(null,![],{'message':_0xd8e0('0x13')});});}}}else{return _0x5e9735(null,![],{'message':_0xd8e0('0x13')});}}else{if(_0x144a8a['disabled']){return _0x5e9735(null,![],{'message':_0xd8e0('0x13')});}else if(_0xd0c45c[_0xd8e0('0xa')]>0x0){if(_0x144a8a[_0xd8e0('0x19')]){if(_0xd0c45c[_0xd8e0('0x14')]>0x0){if(moment(_0x144a8a[_0xd8e0('0x15')])[_0xd8e0('0x16')](_0xd0c45c['blockDuration'],_0xd8e0('0x17'))>moment()){return _0x5e9735(null,![],{'message':_0xd8e0('0x13')});}else{return utils['clearBlockUser'](_0x144a8a,0x0,![],null)['then'](function(){return utils['getLicense'](_0x144a8a);})[_0xd8e0('0xb')](function(){return _0x5e9735(null,_0x144a8a);});}}else{return _0x5e9735(null,![],{'message':_0xd8e0('0x13')});}}else{return utils[_0xd8e0('0x18')](_0x144a8a,0x0,![],null)[_0xd8e0('0xb')](function(){return utils[_0xd8e0('0x1a')](_0x144a8a);})['then'](function(){return _0x5e9735(null,_0x144a8a);})['catch'](function(_0x1a29c7){return _0x5e9735(null,![],_0x1a29c7);});}}else{if(_0x144a8a[_0xd8e0('0x19')]){return _0x5e9735(null,![],{'message':_0xd8e0('0x13')});}else{return utils[_0xd8e0('0x1a')](_0x144a8a)['then'](function(){return _0x5e9735(null,_0x144a8a);});}}}});})[_0xd8e0('0x1b')](function(_0x3da15f){return _0x5e9735(null,![],_0x3da15f);});}function sendServiceMail(_0xd60219){return db[_0xd8e0('0x1c')]['find']({'where':{'service':!![]},'attributes':['id',_0xd8e0('0x11'),_0xd8e0('0x1d')],'include':[{'model':db[_0xd8e0('0x1e')],'as':_0xd8e0('0x1f')}]})[_0xd8e0('0xb')](function(_0x345bf3){if(!_0x345bf3){throw new Error(_0xd8e0('0x20'));}var _0x559d97={'tls':{'rejectUnauthorized':![]}};if(_0x345bf3[_0xd8e0('0x1f')][_0xd8e0('0x21')]){_0x559d97[_0xd8e0('0x21')]=_0x345bf3[_0xd8e0('0x1f')][_0xd8e0('0x21')];}else{_0x559d97[_0xd8e0('0x22')]=_0x345bf3[_0xd8e0('0x1f')][_0xd8e0('0x22')];_0x559d97[_0xd8e0('0x23')]=_0x345bf3[_0xd8e0('0x1f')][_0xd8e0('0x23')];_0x559d97['secure']=_0x345bf3[_0xd8e0('0x1f')][_0xd8e0('0x24')];}if(_0x345bf3[_0xd8e0('0x1f')][_0xd8e0('0x25')]){_0x559d97[_0xd8e0('0x26')]={'user':_0x345bf3[_0xd8e0('0x1f')]['user'],'pass':_0x345bf3[_0xd8e0('0x1f')][_0xd8e0('0x27')]};}var _0x4637e8={'account':_0x559d97,'message':_[_0xd8e0('0x28')]({'from':util[_0xd8e0('0x29')](_0xd8e0('0x2a'),_0x345bf3['name'],_0x345bf3[_0xd8e0('0x1d')]||_0x345bf3[_0xd8e0('0x1f')][_0xd8e0('0x10')])},_0xd60219)};return client['request'](_0xd8e0('0x2b'),_0x4637e8);})['then'](function(_0x1dd7ca){if(_0x1dd7ca[_0xd8e0('0x2c')]){throw new Error(util[_0xd8e0('0x29')](_0xd8e0('0x2d'),_0x1dd7ca[_0xd8e0('0x2c')][_0xd8e0('0x2e')]||JSON['stringify'](_0x1dd7ca[_0xd8e0('0x2c')])));}return!![];});}function handleError(_0x14884f,_0x171a9e,_0x1dd227){return _0x14884f[_0xd8e0('0x2f')](_0x171a9e||0x1f4)['send']({'message':_0x1dd227?_0x1dd227[_0xd8e0('0x2e')]||_0x1dd227:''});}exports[_0xd8e0('0x30')]=function(_0x1f6041,_0x37acd4,_0x221d4b){passport[_0xd8e0('0x12')](_0xd8e0('0x31'),function(_0x298a6e,_0x1c9c45,_0x4b3d02){var _0xbee321=_0x298a6e||_0x4b3d02;if(_0xbee321){return handleError(_0x37acd4,0x191,_0xbee321);}if(!_0x1c9c45){return handleError(_0x37acd4,0x194,{'message':_0xd8e0('0x32')});}else{var _0x19b066={'payload':{'id':_0x1c9c45['id'],'role':_0x1c9c45[_0xd8e0('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0xd8e0('0x33')](_0x19b066)[_0xd8e0('0xb')](function(_0x2a9b44){_0x37acd4['json']({'id':_0x1c9c45['id'],'token':_0x2a9b44,'statusCall':'','isAlreadyLogged':_0x1c9c45[_0xd8e0('0x34')]});});}})(_0x1f6041,_0x37acd4,_0x221d4b);};exports[_0xd8e0('0x35')]=function(_0x5f6426,_0x286035,_0x1cac75){if(!_0x5f6426[_0xd8e0('0x36')]['email']){return handleError(_0x286035,0x1f4,{'message':_0xd8e0('0x37')});}var _0x3f0f31=rs['generate']();_0x5f6426[_0xd8e0('0x36')][_0xd8e0('0x1d')]=_0x5f6426[_0xd8e0('0x36')][_0xd8e0('0x1d')][_0xd8e0('0x38')]()[_0xd8e0('0x39')]();var _0x41ec9c;return db[_0xd8e0('0x8')][_0xd8e0('0x9')]({'where':{'id':0x1},'attributes':[_0xd8e0('0xa'),_0xd8e0('0x14')],'raw':!![]})[_0xd8e0('0xb')](function(_0x1f5ebb){_0x41ec9c=_0x1f5ebb;return db['User']['find']({'where':{'email':_0x5f6426[_0xd8e0('0x36')]['email']}});})[_0xd8e0('0xb')](function(_0x41eae2){if(!_0x41eae2){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x41eae2[_0xd8e0('0xe')]){throw new Error(_0xd8e0('0x3a'));}if(_0x41eae2[_0xd8e0('0x19')]){if(moment(_0x41eae2[_0xd8e0('0x15')])[_0xd8e0('0x16')](_0x41ec9c['blockDuration'],_0xd8e0('0x17'))>moment()){throw new Error(_0xd8e0('0x3b'));}else{_0x41eae2[_0xd8e0('0x19')]=![];_0x41eae2['blockedAt']=null;}}_0x41eae2['resetPasswordToken']=_0x3f0f31;_0x41eae2['resetPasswordExpires']=Date[_0xd8e0('0x3c')]()+0x36ee80;return _0x41eae2[_0xd8e0('0x3d')]();})[_0xd8e0('0xb')](function(){return sendServiceMail({'to':_0x5f6426[_0xd8e0('0x36')][_0xd8e0('0x1d')],'subject':_0xd8e0('0x3e'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xd8e0('0x3f')+_0xd8e0('0x40')+_0x5f6426[_0xd8e0('0x41')][_0xd8e0('0x22')]+_0xd8e0('0x42')+_0x3f0f31+'\x0a\x0a'+_0xd8e0('0x43')});})[_0xd8e0('0xb')](function(){_0x286035[_0xd8e0('0x2f')](0xc8)['send']({'message':_0xd8e0('0x44')});})[_0xd8e0('0x1b')](function(_0x4b8a78){return handleError(_0x286035,0x1f4,_0x4b8a78);});};exports['reset']=function(_0x3cec45,_0x33ce72,_0x4615be){return db[_0xd8e0('0x45')][_0xd8e0('0x46')]({'where':{'resetPasswordToken':_0x3cec45[_0xd8e0('0x47')][_0xd8e0('0x48')],'resetPasswordExpires':{'$gt':Date[_0xd8e0('0x3c')]()}}})[_0xd8e0('0xb')](function(_0x593c8f){if(!_0x593c8f){throw new Error(_0xd8e0('0x49'));}return db[_0xd8e0('0x8')][_0xd8e0('0x9')]({'attributes':['id','securePassword',_0xd8e0('0x4a'),_0xd8e0('0x4b')]})[_0xd8e0('0xb')](function(_0x252be7){if(_0x252be7['securePassword'])authService[_0xd8e0('0x4c')](_0x3cec45[_0xd8e0('0x36')][_0xd8e0('0x4d')]);if(!_0x252be7[_0xd8e0('0x4a')]||!_0x593c8f[_0xd8e0('0x4e')])return _0x593c8f;authService[_0xd8e0('0x4f')](_0x3cec45[_0xd8e0('0x36')][_0xd8e0('0x4d')],_0x593c8f[_0xd8e0('0x4e')],_0x252be7['passwordHistoryLimit']);return _0x593c8f;})[_0xd8e0('0xb')](function(){_0x593c8f['password']=_0x3cec45[_0xd8e0('0x36')]['password'];_0x593c8f['resetPasswordToken']=null;_0x593c8f[_0xd8e0('0x50')]=null;return _0x593c8f[_0xd8e0('0x3d')]();});})[_0xd8e0('0xb')](function(){_0x33ce72[_0xd8e0('0x2f')](0xc8)[_0xd8e0('0x51')]({'message':_0xd8e0('0x52')});})[_0xd8e0('0x1b')](function(_0x48fa01){return handleError(_0x33ce72,0x1f4,_0x48fa01);});};passport[_0xd8e0('0x53')](new LocalStrategy({'usernameField':_0xd8e0('0x11'),'passwordField':_0xd8e0('0x4d')},function(_0x2e80ed,_0x4967dd,_0x16ddb6){return localAuthenticate(db[_0xd8e0('0x45')],_0x2e80ed,_0x4967dd,_0x16ddb6);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 3d6e39e..01583ba 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 _0x65c4=['login','forgot','reset','exports','express','Router','./authLocal.controller','post'];(function(_0x11d08,_0x4abde1){var _0x160786=function(_0x5cc6df){while(--_0x5cc6df){_0x11d08['push'](_0x11d08['shift']());}};_0x160786(++_0x4abde1);}(_0x65c4,0x15c));var _0x465c=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0x65c4[_0x3b90ab];return _0x206e92;};'use strict';var express=require(_0x465c('0x0'));var router=express[_0x465c('0x1')]();var controller=require(_0x465c('0x2'));router[_0x465c('0x3')]('/',controller[_0x465c('0x4')]);router[_0x465c('0x3')]('/forgot',controller[_0x465c('0x5')]);router[_0x465c('0x3')]('/reset/:token',controller[_0x465c('0x6')]);module[_0x465c('0x7')]=router; \ No newline at end of file +var _0x1f80=['reset','exports','express','Router','post','forgot','/reset/:token'];(function(_0x4c49d2,_0x2b18b7){var _0x1d653b=function(_0x302ce3){while(--_0x302ce3){_0x4c49d2['push'](_0x4c49d2['shift']());}};_0x1d653b(++_0x2b18b7);}(_0x1f80,0x1bb));var _0x01f8=function(_0x1c2845,_0x2bd014){_0x1c2845=_0x1c2845-0x0;var _0x17bb6f=_0x1f80[_0x1c2845];return _0x17bb6f;};'use strict';var express=require(_0x01f8('0x0'));var router=express[_0x01f8('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller['login']);router[_0x01f8('0x2')]('/forgot',controller[_0x01f8('0x3')]);router[_0x01f8('0x2')](_0x01f8('0x4'),controller[_0x01f8('0x5')]);module[_0x01f8('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 ff32ddc..0b152ff 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 _0xfe1f=['sequelize','STRING','INTEGER'];(function(_0x3c3809,_0x501175){var _0x3fb31e=function(_0x3fd215){while(--_0x3fd215){_0x3c3809['push'](_0x3c3809['shift']());}};_0x3fb31e(++_0x501175);}(_0xfe1f,0x159));var _0xffe1=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0xfe1f[_0x2d8434];return _0x26b9e4;};'use strict';var Sequelize=require(_0xffe1('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xffe1('0x1')]},'description':{'type':Sequelize[_0xffe1('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xffe1('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0xb7a4=['STRING','INTEGER','sequelize'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb7a4,0x14c));var _0x4b7a=function(_0x19bdc4,_0x52632d){_0x19bdc4=_0x19bdc4-0x0;var _0x361650=_0xb7a4[_0x19bdc4];return _0x361650;};'use strict';var Sequelize=require(_0x4b7a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x4b7a('0x1')]},'description':{'type':Sequelize[_0x4b7a('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x4b7a('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 9b1d533..733f22e 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 _0x3880=['filter','where','merge','VIRTUAL','options','includeAll','include','Automation','rows','catch','show','rawAttributes','length','find','create','body','update','params','addConditions','Condition','ids','omit','getConditions','findOne','nolimit','addActions','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x3880,0x71));var _0x0388=function(_0x27bf68,_0x2028b1){_0x27bf68=_0x27bf68-0x0;var _0x471506=_0x3880[_0x27bf68];return _0x471506;};'use strict';var emlformat=require(_0x0388('0x0'));var rimraf=require(_0x0388('0x1'));var zipdir=require(_0x0388('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0388('0x3'));var moment=require(_0x0388('0x4'));var BPromise=require(_0x0388('0x5'));var Mustache=require(_0x0388('0x6'));var util=require(_0x0388('0x7'));var path=require(_0x0388('0x8'));var sox=require(_0x0388('0x9'));var csv=require(_0x0388('0xa'));var ejs=require(_0x0388('0xb'));var fs=require('fs');var fs_extra=require(_0x0388('0xc'));var _=require(_0x0388('0xd'));var squel=require('squel');var crypto=require(_0x0388('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0388('0xf'));var toCsv=require(_0x0388('0xa'));var querystring=require(_0x0388('0x10'));var Papa=require(_0x0388('0x11'));var Redis=require('ioredis');var authService=require(_0x0388('0x12'));var qs=require(_0x0388('0x13'));var as=require(_0x0388('0x14'));var hardwareService=require(_0x0388('0x15'));var logger=require('../../config/logger')(_0x0388('0x16'));var utils=require('../../config/utils');var config=require(_0x0388('0x17'));var licenseUtil=require(_0x0388('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x374dae,_0x3d80da){_0x3d80da=_0x3d80da||0xcc;return function(_0x8565e6){if(_0x8565e6){return _0x374dae['sendStatus'](_0x3d80da);}return _0x374dae[_0x0388('0x19')](_0x3d80da)[_0x0388('0x1a')]();};}function respondWithResult(_0x4026b5,_0x21856d){_0x21856d=_0x21856d||0xc8;return function(_0x54505f){if(_0x54505f){return _0x4026b5['status'](_0x21856d)[_0x0388('0x1b')](_0x54505f);}};}function respondWithFilteredResult(_0x1598c2,_0x48a550){return function(_0x2da4b0){if(_0x2da4b0){var _0x1d5f6b=typeof _0x48a550['offset']===_0x0388('0x1c')&&typeof _0x48a550[_0x0388('0x1d')]==='undefined';var _0x576860=_0x2da4b0[_0x0388('0x1e')];var _0x4a494a=_0x1d5f6b?0x0:_0x48a550[_0x0388('0x1f')];var _0x251945=_0x1d5f6b?_0x2da4b0[_0x0388('0x1e')]:_0x48a550[_0x0388('0x1f')]+_0x48a550[_0x0388('0x1d')];var _0x27b21f;if(_0x251945>=_0x576860){_0x251945=_0x576860;_0x27b21f=0xc8;}else{_0x27b21f=0xce;}_0x1598c2[_0x0388('0x19')](_0x27b21f);return _0x1598c2[_0x0388('0x20')]('Content-Range',_0x4a494a+'-'+_0x251945+'/'+_0x576860)[_0x0388('0x1b')](_0x2da4b0);}return null;};}function patchUpdates(_0x3d99a3){return function(_0x40fde8){try{jsonpatch[_0x0388('0x21')](_0x40fde8,_0x3d99a3,!![]);}catch(_0x3f949d){return BPromise[_0x0388('0x22')](_0x3f949d);}return _0x40fde8[_0x0388('0x23')]();};}function saveUpdates(_0x533e9c,_0x22e5b7){return function(_0x17fcaa){if(_0x17fcaa){return _0x17fcaa['update'](_0x533e9c)[_0x0388('0x24')](function(_0x3d22ff){return _0x3d22ff;});}return null;};}function removeEntity(_0xa49445,_0x1991ee){return function(_0x47f064){if(_0x47f064){return _0x47f064[_0x0388('0x25')]()[_0x0388('0x24')](function(){_0xa49445[_0x0388('0x19')](0xcc)[_0x0388('0x1a')]();});}};}function handleEntityNotFound(_0x4bd5a0,_0x58c79b){return function(_0x2f4980){if(!_0x2f4980){_0x4bd5a0[_0x0388('0x26')](0x194);}return _0x2f4980;};}function handleError(_0x3c4ebe,_0x223c03){_0x223c03=_0x223c03||0x1f4;return function(_0x396136){logger[_0x0388('0x27')](_0x396136[_0x0388('0x28')]);if(_0x396136['name']){delete _0x396136[_0x0388('0x29')];}_0x3c4ebe['status'](_0x223c03)[_0x0388('0x2a')](_0x396136);};}exports['index']=function(_0x278925,_0x39219f){var _0x5caea3={},_0x46d2a3={},_0x469575={'count':0x0,'rows':[]};var _0x279ff0=_[_0x0388('0x2b')](db['Automation']['rawAttributes'],function(_0x100ad3){return{'name':_0x100ad3[_0x0388('0x2c')],'type':_0x100ad3[_0x0388('0x2d')]['key']};});_0x46d2a3[_0x0388('0x2e')]=_['map'](_0x279ff0,'name');_0x46d2a3[_0x0388('0x2f')]=_[_0x0388('0x30')](_0x278925[_0x0388('0x2f')]);_0x46d2a3[_0x0388('0x31')]=_[_0x0388('0x32')](_0x46d2a3[_0x0388('0x2e')],_0x46d2a3[_0x0388('0x2f')]);_0x5caea3['attributes']=_[_0x0388('0x32')](_0x46d2a3[_0x0388('0x2e')],qs[_0x0388('0x33')](_0x278925[_0x0388('0x2f')]['fields']));_0x5caea3[_0x0388('0x34')]=_0x5caea3[_0x0388('0x34')]['length']?_0x5caea3[_0x0388('0x34')]:_0x46d2a3[_0x0388('0x2e')];if(!_0x278925['query'][_0x0388('0x35')]('nolimit')){_0x5caea3[_0x0388('0x1d')]=qs[_0x0388('0x1d')](_0x278925[_0x0388('0x2f')][_0x0388('0x1d')]);_0x5caea3[_0x0388('0x1f')]=qs[_0x0388('0x1f')](_0x278925['query']['offset']);}_0x5caea3[_0x0388('0x36')]=qs[_0x0388('0x37')](_0x278925[_0x0388('0x2f')][_0x0388('0x37')]);_0x5caea3['where']=qs['filters'](_[_0x0388('0x38')](_0x278925[_0x0388('0x2f')],_0x46d2a3['filters']),_0x279ff0);if(_0x278925['query'][_0x0388('0x39')]){_0x5caea3[_0x0388('0x3a')]=_[_0x0388('0x3b')](_0x5caea3['where'],{'$or':_['map'](_0x279ff0,function(_0x5f4b32){if(_0x5f4b32[_0x0388('0x2d')]!==_0x0388('0x3c')){var _0x335fe0={};_0x335fe0[_0x5f4b32[_0x0388('0x29')]]={'$like':'%'+_0x278925[_0x0388('0x2f')]['filter']+'%'};return _0x335fe0;}})});}_0x5caea3=_[_0x0388('0x3b')]({},_0x5caea3,_0x278925[_0x0388('0x3d')]);var _0x1b1dd1={'where':_0x5caea3[_0x0388('0x3a')]};return db['Automation']['count'](_0x1b1dd1)[_0x0388('0x24')](function(_0x50a9cd){_0x469575['count']=_0x50a9cd;if(_0x278925[_0x0388('0x2f')][_0x0388('0x3e')]){_0x5caea3[_0x0388('0x3f')]=[{'all':!![]}];}return db[_0x0388('0x40')]['findAll'](_0x5caea3);})[_0x0388('0x24')](function(_0xece33){_0x469575[_0x0388('0x41')]=_0xece33;return _0x469575;})['then'](respondWithFilteredResult(_0x39219f,_0x5caea3))[_0x0388('0x42')](handleError(_0x39219f,null));};exports[_0x0388('0x43')]=function(_0x4dbadb,_0x3cfb19){var _0x2ce763={'raw':![],'where':{'id':_0x4dbadb['params']['id']}},_0x1f365e={};_0x1f365e[_0x0388('0x2e')]=_[_0x0388('0x30')](db[_0x0388('0x40')][_0x0388('0x44')]);_0x1f365e[_0x0388('0x2f')]=_[_0x0388('0x30')](_0x4dbadb[_0x0388('0x2f')]);_0x1f365e['filters']=_[_0x0388('0x32')](_0x1f365e[_0x0388('0x2e')],_0x1f365e['query']);_0x2ce763[_0x0388('0x34')]=_[_0x0388('0x32')](_0x1f365e[_0x0388('0x2e')],qs[_0x0388('0x33')](_0x4dbadb[_0x0388('0x2f')][_0x0388('0x33')]));_0x2ce763[_0x0388('0x34')]=_0x2ce763['attributes'][_0x0388('0x45')]?_0x2ce763[_0x0388('0x34')]:_0x1f365e[_0x0388('0x2e')];if(_0x4dbadb[_0x0388('0x2f')][_0x0388('0x3e')]){_0x2ce763['include']=[{'all':!![]}];}_0x2ce763=_[_0x0388('0x3b')]({},_0x2ce763,_0x4dbadb[_0x0388('0x3d')]);return db[_0x0388('0x40')][_0x0388('0x46')](_0x2ce763)['then'](handleEntityNotFound(_0x3cfb19,null))['then'](respondWithResult(_0x3cfb19,null))[_0x0388('0x42')](handleError(_0x3cfb19,null));};exports['create']=function(_0x2eed41,_0x4ec7b2){return db[_0x0388('0x40')][_0x0388('0x47')](_0x2eed41[_0x0388('0x48')],{})[_0x0388('0x24')](respondWithResult(_0x4ec7b2,0xc9))[_0x0388('0x42')](handleError(_0x4ec7b2,null));};exports[_0x0388('0x49')]=function(_0x30dec6,_0x444135){if(_0x30dec6['body']['id']){delete _0x30dec6['body']['id'];}return db['Automation'][_0x0388('0x46')]({'where':{'id':_0x30dec6[_0x0388('0x4a')]['id']}})['then'](handleEntityNotFound(_0x444135,null))[_0x0388('0x24')](saveUpdates(_0x30dec6['body'],null))[_0x0388('0x24')](respondWithResult(_0x444135,null))[_0x0388('0x42')](handleError(_0x444135,null));};exports[_0x0388('0x25')]=function(_0xdaa9a2,_0x196e8b){return db[_0x0388('0x40')]['find']({'where':{'id':_0xdaa9a2['params']['id']}})[_0x0388('0x24')](handleEntityNotFound(_0x196e8b,null))[_0x0388('0x24')](removeEntity(_0x196e8b,null))[_0x0388('0x42')](handleError(_0x196e8b,null));};exports[_0x0388('0x4b')]=function(_0xb8933a,_0xb09ef4,_0x13e8b3){return db[_0x0388('0x4c')]['find']({'where':{'id':_0xb8933a['params']['id']}})['then'](handleEntityNotFound(_0xb09ef4,null))[_0x0388('0x24')](function(_0x160fe2){if(_0x160fe2){return _0x160fe2[_0x0388('0x4b')](_0xb8933a[_0x0388('0x48')][_0x0388('0x4d')],_[_0x0388('0x4e')](_0xb8933a[_0x0388('0x48')],['ids','id'])||{});}})['then'](respondWithResult(_0xb09ef4,null))[_0x0388('0x42')](handleError(_0xb09ef4,null));};exports[_0x0388('0x4f')]=function(_0xeb321e,_0x224a9c,_0x5b83f6){var _0x2bfb31={};var _0x4d3ada={};var _0x5c4f99;var _0x538535;return db[_0x0388('0x40')][_0x0388('0x50')]({'where':{'id':_0xeb321e[_0x0388('0x4a')]['id']}})['then'](handleEntityNotFound(_0x224a9c,null))[_0x0388('0x24')](function(_0xa708f9){if(_0xa708f9){_0x5c4f99=_0xa708f9;_0x4d3ada[_0x0388('0x2e')]=_[_0x0388('0x30')](db[_0x0388('0x4c')][_0x0388('0x44')]);_0x4d3ada[_0x0388('0x2f')]=_[_0x0388('0x30')](_0xeb321e[_0x0388('0x2f')]);_0x4d3ada['filters']=_[_0x0388('0x32')](_0x4d3ada[_0x0388('0x2e')],_0x4d3ada[_0x0388('0x2f')]);_0x2bfb31[_0x0388('0x34')]=_['intersection'](_0x4d3ada[_0x0388('0x2e')],qs['fields'](_0xeb321e[_0x0388('0x2f')][_0x0388('0x33')]));_0x2bfb31[_0x0388('0x34')]=_0x2bfb31[_0x0388('0x34')][_0x0388('0x45')]?_0x2bfb31['attributes']:_0x4d3ada[_0x0388('0x2e')];_0x2bfb31['order']=qs['sort'](_0xeb321e[_0x0388('0x2f')]['sort']);_0x2bfb31['where']=qs[_0x0388('0x31')](_[_0x0388('0x38')](_0xeb321e[_0x0388('0x2f')],_0x4d3ada[_0x0388('0x31')]));if(_0xeb321e[_0x0388('0x2f')][_0x0388('0x39')]){_0x2bfb31[_0x0388('0x3a')]=_['merge'](_0x2bfb31['where'],{'$or':_[_0x0388('0x2b')](_0x2bfb31[_0x0388('0x34')],function(_0x4b214a){var _0xb2b25={};_0xb2b25[_0x4b214a]={'$like':'%'+_0xeb321e[_0x0388('0x2f')]['filter']+'%'};return _0xb2b25;})});}_0x2bfb31=_[_0x0388('0x3b')]({},_0x2bfb31,_0xeb321e[_0x0388('0x3d')]);return _0x5c4f99[_0x0388('0x4f')](_0x2bfb31);}})['then'](function(_0x3441e9){if(_0x3441e9){_0x538535=_0x3441e9[_0x0388('0x45')];if(!_0xeb321e[_0x0388('0x2f')][_0x0388('0x35')](_0x0388('0x51'))){_0x2bfb31[_0x0388('0x1d')]=qs[_0x0388('0x1d')](_0xeb321e[_0x0388('0x2f')][_0x0388('0x1d')]);_0x2bfb31['offset']=qs[_0x0388('0x1f')](_0xeb321e[_0x0388('0x2f')][_0x0388('0x1f')]);}return _0x5c4f99[_0x0388('0x4f')](_0x2bfb31);}})[_0x0388('0x24')](function(_0xf34a8f){if(_0xf34a8f){return _0xf34a8f?{'count':_0x538535,'rows':_0xf34a8f}:null;}})[_0x0388('0x24')](respondWithResult(_0x224a9c,null))[_0x0388('0x42')](handleError(_0x224a9c,null));};exports[_0x0388('0x52')]=function(_0x54f310,_0x4ae35a,_0xa0a4b2){return db[_0x0388('0x53')][_0x0388('0x46')]({'where':{'id':_0x54f310['params']['id']}})[_0x0388('0x24')](handleEntityNotFound(_0x4ae35a,null))['then'](function(_0x2ab634){if(_0x2ab634){return _0x2ab634[_0x0388('0x52')](_0x54f310[_0x0388('0x48')][_0x0388('0x4d')],_[_0x0388('0x4e')](_0x54f310['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x4ae35a,null))[_0x0388('0x42')](handleError(_0x4ae35a,null));};exports[_0x0388('0x54')]=function(_0x2c02dd,_0x292ee6,_0x4072a9){var _0x42f27e={};var _0x5c5bd9={};var _0x30ceb3;var _0x396e0f;return db[_0x0388('0x40')]['findOne']({'where':{'id':_0x2c02dd[_0x0388('0x4a')]['id']}})['then'](handleEntityNotFound(_0x292ee6,null))[_0x0388('0x24')](function(_0x4374cb){if(_0x4374cb){_0x30ceb3=_0x4374cb;_0x5c5bd9[_0x0388('0x2e')]=_[_0x0388('0x30')](db[_0x0388('0x53')][_0x0388('0x44')]);_0x5c5bd9[_0x0388('0x2f')]=_[_0x0388('0x30')](_0x2c02dd[_0x0388('0x2f')]);_0x5c5bd9[_0x0388('0x31')]=_['intersection'](_0x5c5bd9[_0x0388('0x2e')],_0x5c5bd9[_0x0388('0x2f')]);_0x42f27e['attributes']=_[_0x0388('0x32')](_0x5c5bd9['model'],qs[_0x0388('0x33')](_0x2c02dd[_0x0388('0x2f')][_0x0388('0x33')]));_0x42f27e[_0x0388('0x34')]=_0x42f27e[_0x0388('0x34')][_0x0388('0x45')]?_0x42f27e[_0x0388('0x34')]:_0x5c5bd9['model'];_0x42f27e[_0x0388('0x36')]=qs['sort'](_0x2c02dd[_0x0388('0x2f')][_0x0388('0x37')]);_0x42f27e[_0x0388('0x3a')]=qs['filters'](_[_0x0388('0x38')](_0x2c02dd[_0x0388('0x2f')],_0x5c5bd9[_0x0388('0x31')]));if(_0x2c02dd[_0x0388('0x2f')][_0x0388('0x39')]){_0x42f27e[_0x0388('0x3a')]=_[_0x0388('0x3b')](_0x42f27e[_0x0388('0x3a')],{'$or':_[_0x0388('0x2b')](_0x42f27e['attributes'],function(_0x3c030a){var _0xdd34ba={};_0xdd34ba[_0x3c030a]={'$like':'%'+_0x2c02dd[_0x0388('0x2f')][_0x0388('0x39')]+'%'};return _0xdd34ba;})});}_0x42f27e=_[_0x0388('0x3b')]({},_0x42f27e,_0x2c02dd[_0x0388('0x3d')]);return _0x30ceb3['getActions'](_0x42f27e);}})[_0x0388('0x24')](function(_0x30084){if(_0x30084){_0x396e0f=_0x30084[_0x0388('0x45')];if(!_0x2c02dd[_0x0388('0x2f')][_0x0388('0x35')](_0x0388('0x51'))){_0x42f27e[_0x0388('0x1d')]=qs[_0x0388('0x1d')](_0x2c02dd[_0x0388('0x2f')][_0x0388('0x1d')]);_0x42f27e[_0x0388('0x1f')]=qs['offset'](_0x2c02dd['query'][_0x0388('0x1f')]);}return _0x30ceb3[_0x0388('0x54')](_0x42f27e);}})[_0x0388('0x24')](function(_0x36bafc){if(_0x36bafc){return _0x36bafc?{'count':_0x396e0f,'rows':_0x36bafc}:null;}})['then'](respondWithResult(_0x292ee6,null))[_0x0388('0x42')](handleError(_0x292ee6,null));}; \ No newline at end of file +var _0x21cc=['nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','Automation','findAll','catch','show','params','rawAttributes','length','include','find','create','body','Condition','ids','getConditions','findOne','hasOwnProperty','addActions','Action','omit','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x52098f,_0x4005c7){var _0x538435=function(_0xde643c){while(--_0xde643c){_0x52098f['push'](_0x52098f['shift']());}};_0x538435(++_0x4005c7);}(_0x21cc,0x72));var _0xc21c=function(_0x2fba78,_0x251be3){_0x2fba78=_0x2fba78-0x0;var _0x375ef5=_0x21cc[_0x2fba78];return _0x375ef5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc21c('0x0'));var zipdir=require(_0xc21c('0x1'));var jsonpatch=require(_0xc21c('0x2'));var rp=require(_0xc21c('0x3'));var moment=require(_0xc21c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc21c('0x5'));var util=require(_0xc21c('0x6'));var path=require(_0xc21c('0x7'));var sox=require(_0xc21c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc21c('0x9'));var _=require(_0xc21c('0xa'));var squel=require(_0xc21c('0xb'));var crypto=require(_0xc21c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc21c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc21c('0xe'));var Papa=require(_0xc21c('0xf'));var Redis=require(_0xc21c('0x10'));var authService=require(_0xc21c('0x11'));var qs=require(_0xc21c('0x12'));var as=require(_0xc21c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc21c('0x14'))(_0xc21c('0x15'));var utils=require(_0xc21c('0x16'));var config=require(_0xc21c('0x17'));var licenseUtil=require(_0xc21c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6ed913,_0x56b4f6){_0x56b4f6=_0x56b4f6||0xcc;return function(_0x316b41){if(_0x316b41){return _0x6ed913[_0xc21c('0x19')](_0x56b4f6);}return _0x6ed913[_0xc21c('0x1a')](_0x56b4f6)[_0xc21c('0x1b')]();};}function respondWithResult(_0x599779,_0x490280){_0x490280=_0x490280||0xc8;return function(_0x43f797){if(_0x43f797){return _0x599779[_0xc21c('0x1a')](_0x490280)['json'](_0x43f797);}};}function respondWithFilteredResult(_0x3509a8,_0x26e386){return function(_0x45f386){if(_0x45f386){var _0x2ebccd=typeof _0x26e386['offset']==='undefined'&&typeof _0x26e386[_0xc21c('0x1c')]==='undefined';var _0x53891c=_0x45f386['count'];var _0x1d97df=_0x2ebccd?0x0:_0x26e386[_0xc21c('0x1d')];var _0x4816c3=_0x2ebccd?_0x45f386[_0xc21c('0x1e')]:_0x26e386[_0xc21c('0x1d')]+_0x26e386[_0xc21c('0x1c')];var _0x43ed0a;if(_0x4816c3>=_0x53891c){_0x4816c3=_0x53891c;_0x43ed0a=0xc8;}else{_0x43ed0a=0xce;}_0x3509a8['status'](_0x43ed0a);return _0x3509a8[_0xc21c('0x1f')](_0xc21c('0x20'),_0x1d97df+'-'+_0x4816c3+'/'+_0x53891c)[_0xc21c('0x21')](_0x45f386);}return null;};}function patchUpdates(_0x22d06a){return function(_0x131691){try{jsonpatch[_0xc21c('0x22')](_0x131691,_0x22d06a,!![]);}catch(_0x1976f6){return BPromise[_0xc21c('0x23')](_0x1976f6);}return _0x131691[_0xc21c('0x24')]();};}function saveUpdates(_0x52b108,_0x38dce2){return function(_0x4d4991){if(_0x4d4991){return _0x4d4991[_0xc21c('0x25')](_0x52b108)[_0xc21c('0x26')](function(_0x472fed){return _0x472fed;});}return null;};}function removeEntity(_0x547605,_0x49a591){return function(_0x350b98){if(_0x350b98){return _0x350b98[_0xc21c('0x27')]()[_0xc21c('0x26')](function(){_0x547605['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47fab9,_0x356f26){return function(_0x379482){if(!_0x379482){_0x47fab9[_0xc21c('0x19')](0x194);}return _0x379482;};}function handleError(_0x100bfb,_0x567f5c){_0x567f5c=_0x567f5c||0x1f4;return function(_0x211d6a){logger[_0xc21c('0x28')](_0x211d6a[_0xc21c('0x29')]);if(_0x211d6a[_0xc21c('0x2a')]){delete _0x211d6a[_0xc21c('0x2a')];}_0x100bfb['status'](_0x567f5c)[_0xc21c('0x2b')](_0x211d6a);};}exports[_0xc21c('0x2c')]=function(_0x37b7fb,_0x4b4cc3){var _0x2f509d={},_0x479889={},_0x2c879d={'count':0x0,'rows':[]};var _0x4c4b08=_[_0xc21c('0x2d')](db['Automation']['rawAttributes'],function(_0x21b099){return{'name':_0x21b099[_0xc21c('0x2e')],'type':_0x21b099[_0xc21c('0x2f')][_0xc21c('0x30')]};});_0x479889[_0xc21c('0x31')]=_['map'](_0x4c4b08,_0xc21c('0x2a'));_0x479889[_0xc21c('0x32')]=_[_0xc21c('0x33')](_0x37b7fb[_0xc21c('0x32')]);_0x479889[_0xc21c('0x34')]=_[_0xc21c('0x35')](_0x479889['model'],_0x479889[_0xc21c('0x32')]);_0x2f509d[_0xc21c('0x36')]=_['intersection'](_0x479889[_0xc21c('0x31')],qs['fields'](_0x37b7fb[_0xc21c('0x32')][_0xc21c('0x37')]));_0x2f509d[_0xc21c('0x36')]=_0x2f509d[_0xc21c('0x36')]['length']?_0x2f509d[_0xc21c('0x36')]:_0x479889['model'];if(!_0x37b7fb[_0xc21c('0x32')]['hasOwnProperty'](_0xc21c('0x38'))){_0x2f509d['limit']=qs[_0xc21c('0x1c')](_0x37b7fb[_0xc21c('0x32')]['limit']);_0x2f509d[_0xc21c('0x1d')]=qs[_0xc21c('0x1d')](_0x37b7fb[_0xc21c('0x32')][_0xc21c('0x1d')]);}_0x2f509d[_0xc21c('0x39')]=qs[_0xc21c('0x3a')](_0x37b7fb[_0xc21c('0x32')][_0xc21c('0x3a')]);_0x2f509d['where']=qs['filters'](_[_0xc21c('0x3b')](_0x37b7fb[_0xc21c('0x32')],_0x479889[_0xc21c('0x34')]),_0x4c4b08);if(_0x37b7fb['query'][_0xc21c('0x3c')]){_0x2f509d[_0xc21c('0x3d')]=_['merge'](_0x2f509d['where'],{'$or':_['map'](_0x4c4b08,function(_0x80ab6f){if(_0x80ab6f['type']!==_0xc21c('0x3e')){var _0x2cfb41={};_0x2cfb41[_0x80ab6f[_0xc21c('0x2a')]]={'$like':'%'+_0x37b7fb[_0xc21c('0x32')][_0xc21c('0x3c')]+'%'};return _0x2cfb41;}})});}_0x2f509d=_[_0xc21c('0x3f')]({},_0x2f509d,_0x37b7fb[_0xc21c('0x40')]);var _0x4f6127={'where':_0x2f509d['where']};return db[_0xc21c('0x41')]['count'](_0x4f6127)[_0xc21c('0x26')](function(_0x328a7e){_0x2c879d['count']=_0x328a7e;if(_0x37b7fb[_0xc21c('0x32')]['includeAll']){_0x2f509d['include']=[{'all':!![]}];}return db[_0xc21c('0x41')][_0xc21c('0x42')](_0x2f509d);})[_0xc21c('0x26')](function(_0x4ed109){_0x2c879d['rows']=_0x4ed109;return _0x2c879d;})[_0xc21c('0x26')](respondWithFilteredResult(_0x4b4cc3,_0x2f509d))[_0xc21c('0x43')](handleError(_0x4b4cc3,null));};exports[_0xc21c('0x44')]=function(_0x576d85,_0x261521){var _0x1c0d34={'raw':![],'where':{'id':_0x576d85[_0xc21c('0x45')]['id']}},_0x27f5c4={};_0x27f5c4[_0xc21c('0x31')]=_[_0xc21c('0x33')](db[_0xc21c('0x41')][_0xc21c('0x46')]);_0x27f5c4[_0xc21c('0x32')]=_[_0xc21c('0x33')](_0x576d85[_0xc21c('0x32')]);_0x27f5c4['filters']=_[_0xc21c('0x35')](_0x27f5c4['model'],_0x27f5c4[_0xc21c('0x32')]);_0x1c0d34[_0xc21c('0x36')]=_[_0xc21c('0x35')](_0x27f5c4[_0xc21c('0x31')],qs['fields'](_0x576d85[_0xc21c('0x32')][_0xc21c('0x37')]));_0x1c0d34['attributes']=_0x1c0d34['attributes'][_0xc21c('0x47')]?_0x1c0d34[_0xc21c('0x36')]:_0x27f5c4[_0xc21c('0x31')];if(_0x576d85[_0xc21c('0x32')]['includeAll']){_0x1c0d34[_0xc21c('0x48')]=[{'all':!![]}];}_0x1c0d34=_['merge']({},_0x1c0d34,_0x576d85[_0xc21c('0x40')]);return db['Automation'][_0xc21c('0x49')](_0x1c0d34)[_0xc21c('0x26')](handleEntityNotFound(_0x261521,null))[_0xc21c('0x26')](respondWithResult(_0x261521,null))['catch'](handleError(_0x261521,null));};exports[_0xc21c('0x4a')]=function(_0x49bc70,_0x51a21e){return db[_0xc21c('0x41')][_0xc21c('0x4a')](_0x49bc70[_0xc21c('0x4b')],{})[_0xc21c('0x26')](respondWithResult(_0x51a21e,0xc9))[_0xc21c('0x43')](handleError(_0x51a21e,null));};exports[_0xc21c('0x25')]=function(_0x3097c1,_0x1dd507){if(_0x3097c1['body']['id']){delete _0x3097c1['body']['id'];}return db[_0xc21c('0x41')][_0xc21c('0x49')]({'where':{'id':_0x3097c1['params']['id']}})[_0xc21c('0x26')](handleEntityNotFound(_0x1dd507,null))[_0xc21c('0x26')](saveUpdates(_0x3097c1[_0xc21c('0x4b')],null))[_0xc21c('0x26')](respondWithResult(_0x1dd507,null))['catch'](handleError(_0x1dd507,null));};exports[_0xc21c('0x27')]=function(_0x2dbb48,_0x1d4c8e){return db[_0xc21c('0x41')][_0xc21c('0x49')]({'where':{'id':_0x2dbb48[_0xc21c('0x45')]['id']}})[_0xc21c('0x26')](handleEntityNotFound(_0x1d4c8e,null))['then'](removeEntity(_0x1d4c8e,null))[_0xc21c('0x43')](handleError(_0x1d4c8e,null));};exports['addConditions']=function(_0x593994,_0x3d2e3b,_0x5a9e69){return db[_0xc21c('0x4c')][_0xc21c('0x49')]({'where':{'id':_0x593994[_0xc21c('0x45')]['id']}})[_0xc21c('0x26')](handleEntityNotFound(_0x3d2e3b,null))[_0xc21c('0x26')](function(_0x58ab09){if(_0x58ab09){return _0x58ab09['addConditions'](_0x593994[_0xc21c('0x4b')][_0xc21c('0x4d')],_['omit'](_0x593994[_0xc21c('0x4b')],['ids','id'])||{});}})['then'](respondWithResult(_0x3d2e3b,null))[_0xc21c('0x43')](handleError(_0x3d2e3b,null));};exports[_0xc21c('0x4e')]=function(_0x22665a,_0xf17713,_0x16a91d){var _0x1e4d3a={};var _0xbeed8b={};var _0x4d8897;var _0x2fcbf5;return db[_0xc21c('0x41')][_0xc21c('0x4f')]({'where':{'id':_0x22665a[_0xc21c('0x45')]['id']}})['then'](handleEntityNotFound(_0xf17713,null))[_0xc21c('0x26')](function(_0x14cd6f){if(_0x14cd6f){_0x4d8897=_0x14cd6f;_0xbeed8b['model']=_[_0xc21c('0x33')](db[_0xc21c('0x4c')][_0xc21c('0x46')]);_0xbeed8b[_0xc21c('0x32')]=_[_0xc21c('0x33')](_0x22665a['query']);_0xbeed8b[_0xc21c('0x34')]=_[_0xc21c('0x35')](_0xbeed8b['model'],_0xbeed8b[_0xc21c('0x32')]);_0x1e4d3a[_0xc21c('0x36')]=_['intersection'](_0xbeed8b[_0xc21c('0x31')],qs[_0xc21c('0x37')](_0x22665a[_0xc21c('0x32')][_0xc21c('0x37')]));_0x1e4d3a['attributes']=_0x1e4d3a[_0xc21c('0x36')][_0xc21c('0x47')]?_0x1e4d3a[_0xc21c('0x36')]:_0xbeed8b[_0xc21c('0x31')];_0x1e4d3a[_0xc21c('0x39')]=qs['sort'](_0x22665a['query'][_0xc21c('0x3a')]);_0x1e4d3a[_0xc21c('0x3d')]=qs[_0xc21c('0x34')](_['pick'](_0x22665a[_0xc21c('0x32')],_0xbeed8b[_0xc21c('0x34')]));if(_0x22665a[_0xc21c('0x32')]['filter']){_0x1e4d3a[_0xc21c('0x3d')]=_['merge'](_0x1e4d3a['where'],{'$or':_[_0xc21c('0x2d')](_0x1e4d3a[_0xc21c('0x36')],function(_0x2d5c56){var _0x384055={};_0x384055[_0x2d5c56]={'$like':'%'+_0x22665a['query']['filter']+'%'};return _0x384055;})});}_0x1e4d3a=_[_0xc21c('0x3f')]({},_0x1e4d3a,_0x22665a[_0xc21c('0x40')]);return _0x4d8897['getConditions'](_0x1e4d3a);}})[_0xc21c('0x26')](function(_0x4bcf70){if(_0x4bcf70){_0x2fcbf5=_0x4bcf70['length'];if(!_0x22665a[_0xc21c('0x32')][_0xc21c('0x50')](_0xc21c('0x38'))){_0x1e4d3a[_0xc21c('0x1c')]=qs['limit'](_0x22665a[_0xc21c('0x32')][_0xc21c('0x1c')]);_0x1e4d3a[_0xc21c('0x1d')]=qs[_0xc21c('0x1d')](_0x22665a[_0xc21c('0x32')]['offset']);}return _0x4d8897[_0xc21c('0x4e')](_0x1e4d3a);}})['then'](function(_0x48f663){if(_0x48f663){return _0x48f663?{'count':_0x2fcbf5,'rows':_0x48f663}:null;}})[_0xc21c('0x26')](respondWithResult(_0xf17713,null))['catch'](handleError(_0xf17713,null));};exports[_0xc21c('0x51')]=function(_0x48ec7e,_0x4a6994,_0x125ec5){return db[_0xc21c('0x52')][_0xc21c('0x49')]({'where':{'id':_0x48ec7e[_0xc21c('0x45')]['id']}})[_0xc21c('0x26')](handleEntityNotFound(_0x4a6994,null))[_0xc21c('0x26')](function(_0x129c1f){if(_0x129c1f){return _0x129c1f['addActions'](_0x48ec7e[_0xc21c('0x4b')]['ids'],_[_0xc21c('0x53')](_0x48ec7e[_0xc21c('0x4b')],[_0xc21c('0x4d'),'id'])||{});}})[_0xc21c('0x26')](respondWithResult(_0x4a6994,null))[_0xc21c('0x43')](handleError(_0x4a6994,null));};exports[_0xc21c('0x54')]=function(_0x615a75,_0x457147,_0x53eed2){var _0x7fece2={};var _0x400547={};var _0x4977b9;var _0x2639a4;return db[_0xc21c('0x41')][_0xc21c('0x4f')]({'where':{'id':_0x615a75[_0xc21c('0x45')]['id']}})['then'](handleEntityNotFound(_0x457147,null))[_0xc21c('0x26')](function(_0x5176b3){if(_0x5176b3){_0x4977b9=_0x5176b3;_0x400547['model']=_[_0xc21c('0x33')](db['Action'][_0xc21c('0x46')]);_0x400547['query']=_[_0xc21c('0x33')](_0x615a75[_0xc21c('0x32')]);_0x400547[_0xc21c('0x34')]=_[_0xc21c('0x35')](_0x400547[_0xc21c('0x31')],_0x400547[_0xc21c('0x32')]);_0x7fece2[_0xc21c('0x36')]=_[_0xc21c('0x35')](_0x400547[_0xc21c('0x31')],qs[_0xc21c('0x37')](_0x615a75[_0xc21c('0x32')][_0xc21c('0x37')]));_0x7fece2[_0xc21c('0x36')]=_0x7fece2[_0xc21c('0x36')][_0xc21c('0x47')]?_0x7fece2[_0xc21c('0x36')]:_0x400547[_0xc21c('0x31')];_0x7fece2[_0xc21c('0x39')]=qs[_0xc21c('0x3a')](_0x615a75[_0xc21c('0x32')][_0xc21c('0x3a')]);_0x7fece2[_0xc21c('0x3d')]=qs[_0xc21c('0x34')](_['pick'](_0x615a75[_0xc21c('0x32')],_0x400547[_0xc21c('0x34')]));if(_0x615a75[_0xc21c('0x32')]['filter']){_0x7fece2['where']=_[_0xc21c('0x3f')](_0x7fece2['where'],{'$or':_[_0xc21c('0x2d')](_0x7fece2['attributes'],function(_0x1351f8){var _0x4d0472={};_0x4d0472[_0x1351f8]={'$like':'%'+_0x615a75[_0xc21c('0x32')][_0xc21c('0x3c')]+'%'};return _0x4d0472;})});}_0x7fece2=_[_0xc21c('0x3f')]({},_0x7fece2,_0x615a75['options']);return _0x4977b9[_0xc21c('0x54')](_0x7fece2);}})[_0xc21c('0x26')](function(_0x3ef0e5){if(_0x3ef0e5){_0x2639a4=_0x3ef0e5[_0xc21c('0x47')];if(!_0x615a75[_0xc21c('0x32')][_0xc21c('0x50')](_0xc21c('0x38'))){_0x7fece2[_0xc21c('0x1c')]=qs[_0xc21c('0x1c')](_0x615a75['query'][_0xc21c('0x1c')]);_0x7fece2[_0xc21c('0x1d')]=qs[_0xc21c('0x1d')](_0x615a75[_0xc21c('0x32')][_0xc21c('0x1d')]);}return _0x4977b9['getActions'](_0x7fece2);}})[_0xc21c('0x26')](function(_0x3e95a9){if(_0x3e95a9){return _0x3e95a9?{'count':_0x2639a4,'rows':_0x3e95a9}:null;}})['then'](respondWithResult(_0x457147,null))[_0xc21c('0x43')](handleError(_0x457147,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 6438964..a9a7cd7 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 _0x7d48=['../../config/environment','./automation.attributes','exports','Automation','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x270aba,_0x13305c){var _0x44dda3=function(_0x428d28){while(--_0x428d28){_0x270aba['push'](_0x270aba['shift']());}};_0x44dda3(++_0x13305c);}(_0x7d48,0xdc));var _0x87d4=function(_0x32a669,_0x3f7a07){_0x32a669=_0x32a669-0x0;var _0x124a57=_0x7d48[_0x32a669];return _0x124a57;};'use strict';var _=require(_0x87d4('0x0'));var util=require(_0x87d4('0x1'));var logger=require(_0x87d4('0x2'))(_0x87d4('0x3'));var moment=require(_0x87d4('0x4'));var BPromise=require(_0x87d4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87d4('0x6'));var rimraf=require(_0x87d4('0x7'));var config=require(_0x87d4('0x8'));var attributes=require(_0x87d4('0x9'));module[_0x87d4('0xa')]=function(_0x50abb1,_0x57cc0a){return _0x50abb1['define'](_0x87d4('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d46=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Automation','tools_automations','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d46,0x1e0));var _0x60d4=function(_0x1280fc,_0x46e1ca){_0x1280fc=_0x1280fc-0x0;var _0x1eab1f=_0x0d46[_0x1280fc];return _0x1eab1f;};'use strict';var _=require(_0x60d4('0x0'));var util=require(_0x60d4('0x1'));var logger=require(_0x60d4('0x2'))(_0x60d4('0x3'));var moment=require(_0x60d4('0x4'));var BPromise=require(_0x60d4('0x5'));var rp=require(_0x60d4('0x6'));var fs=require('fs');var path=require(_0x60d4('0x7'));var rimraf=require(_0x60d4('0x8'));var config=require(_0x60d4('0x9'));var attributes=require('./automation.attributes');module['exports']=function(_0x2a8f2b,_0x31dfcf){return _0x2a8f2b[_0x60d4('0xa')](_0x60d4('0xb'),attributes,{'tableName':_0x60d4('0xc'),'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 b00f10b..4da4fda 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 _0xa9fc=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','Automation,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa9fc,0x19f));var _0xca9f=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0xa9fc[_0x33554b];return _0x256954;};'use strict';var _=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var moment=require(_0xca9f('0x2'));var BPromise=require(_0xca9f('0x3'));var rs=require(_0xca9f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca9f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xca9f('0x6'))(_0xca9f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xca9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48f9ca,_0x39963d,_0x61b1b6){return new BPromise(function(_0x400980,_0xf7ebb1){return client[_0xca9f('0x9')](_0x48f9ca,_0x61b1b6)[_0xca9f('0xa')](function(_0x4713f0){logger[_0xca9f('0xb')]('Automation,\x20%s,\x20%s',_0x39963d,_0xca9f('0xc'));logger[_0xca9f('0xd')](_0xca9f('0xe'),_0x39963d,_0xca9f('0xc'),JSON['stringify'](_0x4713f0));if(_0x4713f0[_0xca9f('0xf')]){if(_0x4713f0[_0xca9f('0xf')]['code']===0x1f4){logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x39963d,_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);return _0xf7ebb1(_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);}logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x39963d,_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);return _0x400980(_0x4713f0['error']['message']);}else{logger[_0xca9f('0xb')]('Automation,\x20%s,\x20%s',_0x39963d,'request\x20sent');_0x400980(_0x4713f0[_0xca9f('0x12')][_0xca9f('0x11')]);}})['catch'](function(_0x4afedf){logger['error'](_0xca9f('0x10'),_0x39963d,_0x4afedf);_0xf7ebb1(_0x4afedf);});});} \ No newline at end of file +var _0x8383=['stringify','error','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c222b,_0x5d2eb7){var _0xd9fdbb=function(_0x3aa0d2){while(--_0x3aa0d2){_0x3c222b['push'](_0x3c222b['shift']());}};_0xd9fdbb(++_0x5d2eb7);}(_0x8383,0x98));var _0x3838=function(_0x5ca1c2,_0x2cecf5){_0x5ca1c2=_0x5ca1c2-0x0;var _0x5b5fde=_0x8383[_0x5ca1c2];return _0x5b5fde;};'use strict';var _=require(_0x3838('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3838('0x1'));var rs=require(_0x3838('0x2'));var fs=require('fs');var Redis=require(_0x3838('0x3'));var db=require(_0x3838('0x4'))['db'];var utils=require(_0x3838('0x5'));var logger=require(_0x3838('0x6'))(_0x3838('0x7'));var config=require(_0x3838('0x8'));var jayson=require(_0x3838('0x9'));var client=jayson[_0x3838('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x239750,_0x235001,_0x4cf52b){return new BPromise(function(_0x2abbda,_0x5e2e42){return client[_0x3838('0xb')](_0x239750,_0x4cf52b)[_0x3838('0xc')](function(_0x340c39){logger['info'](_0x3838('0xd'),_0x235001,_0x3838('0xe'));logger[_0x3838('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x235001,_0x3838('0xe'),JSON[_0x3838('0x10')](_0x340c39));if(_0x340c39[_0x3838('0x11')]){if(_0x340c39[_0x3838('0x11')]['code']===0x1f4){logger[_0x3838('0x11')](_0x3838('0xd'),_0x235001,_0x340c39[_0x3838('0x11')]['message']);return _0x5e2e42(_0x340c39[_0x3838('0x11')]['message']);}logger[_0x3838('0x11')](_0x3838('0xd'),_0x235001,_0x340c39[_0x3838('0x11')][_0x3838('0x12')]);return _0x2abbda(_0x340c39[_0x3838('0x11')]['message']);}else{logger[_0x3838('0x13')](_0x3838('0xd'),_0x235001,_0x3838('0xe'));_0x2abbda(_0x340c39[_0x3838('0x14')][_0x3838('0x12')]);}})['catch'](function(_0x464fd9){logger[_0x3838('0x11')](_0x3838('0xd'),_0x235001,_0x464fd9);_0x5e2e42(_0x464fd9);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 623d43e..5f17dc4 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 _0xeea0=['post','/:id/conditions','addConditions','addActions','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','getConditions','/:id/actions'];(function(_0x375b8a,_0x56ddf6){var _0x304c8f=function(_0xfb6d09){while(--_0xfb6d09){_0x375b8a['push'](_0x375b8a['shift']());}};_0x304c8f(++_0x56ddf6);}(_0xeea0,0x91));var _0x0eea=function(_0xf3d64b,_0x1e1155){_0xf3d64b=_0xf3d64b-0x0;var _0x4cfdf1=_0xeea0[_0xf3d64b];return _0x4cfdf1;};'use strict';var multer=require(_0x0eea('0x0'));var util=require(_0x0eea('0x1'));var path=require(_0x0eea('0x2'));var timeout=require(_0x0eea('0x3'));var express=require(_0x0eea('0x4'));var router=express['Router']();var fs_extra=require(_0x0eea('0x5'));var auth=require(_0x0eea('0x6'));var interaction=require(_0x0eea('0x7'));var config=require(_0x0eea('0x8'));var controller=require(_0x0eea('0x9'));router[_0x0eea('0xa')]('/',auth[_0x0eea('0xb')](),controller['index']);router[_0x0eea('0xa')](_0x0eea('0xc'),auth[_0x0eea('0xb')](),controller[_0x0eea('0xd')]);router[_0x0eea('0xa')]('/:id/conditions',auth[_0x0eea('0xb')](),controller[_0x0eea('0xe')]);router[_0x0eea('0xa')](_0x0eea('0xf'),auth['isAuthenticated'](),controller['getActions']);router[_0x0eea('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0eea('0x10')](_0x0eea('0x11'),auth['isAuthenticated'](),controller[_0x0eea('0x12')]);router['post'](_0x0eea('0xf'),auth['isAuthenticated'](),controller[_0x0eea('0x13')]);router['put']('/:id',auth[_0x0eea('0xb')](),controller[_0x0eea('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0eea('0x15')]);module[_0x0eea('0x16')]=router; \ No newline at end of file +var _0x455d=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','getConditions','getActions','create','post','addConditions','addActions','put','update','delete','/:id','destroy','exports'];(function(_0x3ad219,_0x25d74c){var _0x475d37=function(_0x146238){while(--_0x146238){_0x3ad219['push'](_0x3ad219['shift']());}};_0x475d37(++_0x25d74c);}(_0x455d,0x190));var _0xd455=function(_0x2050cc,_0x328036){_0x2050cc=_0x2050cc-0x0;var _0x236dd1=_0x455d[_0x2050cc];return _0x236dd1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd455('0x0'));var timeout=require(_0xd455('0x1'));var express=require(_0xd455('0x2'));var router=express['Router']();var fs_extra=require(_0xd455('0x3'));var auth=require(_0xd455('0x4'));var interaction=require(_0xd455('0x5'));var config=require(_0xd455('0x6'));var controller=require(_0xd455('0x7'));router[_0xd455('0x8')]('/',auth[_0xd455('0x9')](),controller[_0xd455('0xa')]);router[_0xd455('0x8')]('/:id',auth[_0xd455('0x9')](),controller[_0xd455('0xb')]);router['get'](_0xd455('0xc'),auth[_0xd455('0x9')](),controller[_0xd455('0xd')]);router[_0xd455('0x8')]('/:id/actions',auth[_0xd455('0x9')](),controller[_0xd455('0xe')]);router['post']('/',auth[_0xd455('0x9')](),controller[_0xd455('0xf')]);router[_0xd455('0x10')](_0xd455('0xc'),auth[_0xd455('0x9')](),controller[_0xd455('0x11')]);router['post']('/:id/actions',auth[_0xd455('0x9')](),controller[_0xd455('0x12')]);router[_0xd455('0x13')]('/:id',auth[_0xd455('0x9')](),controller[_0xd455('0x14')]);router[_0xd455('0x15')](_0xd455('0x16'),auth[_0xd455('0x9')](),controller[_0xd455('0x17')]);module[_0xd455('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e71848f..162ea20 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 _0x7a3d=['#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','INTEGER','UNSIGNED','Max\x20200\x20calls.','#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,*,*,*','never','onlyIfOpen','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x3d4cf7,_0x445fba){var _0x34d183=function(_0x4abd59){while(--_0x4abd59){_0x3d4cf7['push'](_0x3d4cf7['shift']());}};_0x34d183(++_0x445fba);}(_0x7a3d,0x1d1));var _0xd7a3=function(_0x579ac5,_0x40ef64){_0x579ac5=_0x579ac5-0x0;var _0x4eec60=_0x7a3d[_0x579ac5];return _0x4eec60;};'use strict';var Sequelize=require('sequelize');module[_0xd7a3('0x0')]={'name':{'type':Sequelize[_0xd7a3('0x1')],'unique':_0xd7a3('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd7a3('0x3')](_0xd7a3('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xd7a3('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xd7a3('0x5')](0x4)[_0xd7a3('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd7a3('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd7a3('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd7a3('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xd7a3('0x5')](0x3)[_0xd7a3('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xd7a3('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7a3('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd7a3('0x5')](0x5)[_0xd7a3('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xd7a3('0x5')](0x3)[_0xd7a3('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7a3('0x9')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7a3('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd7a3('0x5')](0x3)[_0xd7a3('0x6')],'defaultValue':0x3,'comment':_0xd7a3('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7a3('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd7a3('0x5')](0x3)[_0xd7a3('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd7a3('0xd')},'dialTimezone':{'type':Sequelize[_0xd7a3('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xd7a3('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xd7a3('0x3')]('always',_0xd7a3('0xf'),_0xd7a3('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xd7a3('0x11')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xd7a3('0x5')](0x9)[_0xd7a3('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd7a3('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xd7a3('0x5')](0x9)[_0xd7a3('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd7a3('0x5')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd7a3('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd7a3('0x5')](0x9)[_0xd7a3('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd7a3('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0xd7a3('0x5')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd7a3('0x5')](0x9)[_0xd7a3('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd7a3('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xd7a3('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd7a3('0x5')](0x5)[_0xd7a3('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd7a3('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd7a3('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd7a3('0x17')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC','ASC'),'defaultValue':_0xd7a3('0x18')},'dialPrefix':{'type':Sequelize[_0xd7a3('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd7a3('0x5')](0x3)[_0xd7a3('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd7a3('0x19')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xd7a3('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd7a3('0x5')](0x3)[_0xd7a3('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7a3('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7a3('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0xd7a3('0x5')](0x3)[_0xd7a3('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7a3('0x1c')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd7a3('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7a3('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd7a3('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd7a3('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd7a3('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xd7a3('0x5')](0x3)[_0xd7a3('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xd7a3('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7a3('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd7a3('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd7a3('0x5')](0x5)[_0xd7a3('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd7a3('0x20')}}; \ No newline at end of file +var _0xae08=['Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','never','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)'];(function(_0x31a8a7,_0xb6e543){var _0x74b669=function(_0x42e763){while(--_0x42e763){_0x31a8a7['push'](_0x31a8a7['shift']());}};_0x74b669(++_0xb6e543);}(_0xae08,0x115));var _0x8ae0=function(_0x36e360,_0x5e5a7d){_0x36e360=_0x36e360-0x0;var _0x1f240c=_0xae08[_0x36e360];return _0x1f240c;};'use strict';var Sequelize=require('sequelize');module[_0x8ae0('0x0')]={'name':{'type':Sequelize[_0x8ae0('0x1')],'unique':_0x8ae0('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8ae0('0x3')](_0x8ae0('0x4')),'allowNull':![],'defaultValue':_0x8ae0('0x4')},'description':{'type':Sequelize[_0x8ae0('0x1')]},'active':{'type':Sequelize[_0x8ae0('0x5')],'defaultValue':0x0,'comment':_0x8ae0('0x6')},'limitCalls':{'type':Sequelize[_0x8ae0('0x7')](0x4)[_0x8ae0('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8ae0('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8ae0('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8ae0('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x8ae0('0x7')](0x3)[_0x8ae0('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x8ae0('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8ae0('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8ae0('0x7')](0x5)[_0x8ae0('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8ae0('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8ae0('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8ae0('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8ae0('0x7')](0x5)[_0x8ae0('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8ae0('0x8')],'defaultValue':0x3,'comment':_0x8ae0('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8ae0('0x7')](0x5)[_0x8ae0('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8ae0('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8ae0('0x7')](0x3)[_0x8ae0('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[_0x8ae0('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x8ae0('0x3')]('always',_0x8ae0('0xf'),'onlyIfOpen'),'defaultValue':_0x8ae0('0x10')},'dialAMDActive':{'type':Sequelize[_0x8ae0('0x5')],'defaultValue':0x0,'comment':_0x8ae0('0x11')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8ae0('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8ae0('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x8ae0('0x7')](0x9)[_0x8ae0('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8ae0('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8ae0('0x7')](0x9)[_0x8ae0('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8ae0('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8ae0('0x7')](0x9)[_0x8ae0('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8ae0('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x8ae0('0x7')](0x9)[_0x8ae0('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8ae0('0x7')](0x9)[_0x8ae0('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8ae0('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8ae0('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8ae0('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8ae0('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8ae0('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8ae0('0x7')](0x9)[_0x8ae0('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8ae0('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8ae0('0x3')](_0x8ae0('0x1a'),'ASC'),'defaultValue':_0x8ae0('0x1a')},'dialPrefix':{'type':Sequelize[_0x8ae0('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8ae0('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8ae0('0x1b')},'dialCutDigit':{'type':Sequelize[_0x8ae0('0x7')](0x3)[_0x8ae0('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8ae0('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8ae0('0x7')](0x3)[_0x8ae0('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8ae0('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8ae0('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x8ae0('0x7')](0x3)[_0x8ae0('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8ae0('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x8ae0('0x7')](0x5)[_0x8ae0('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8ae0('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8ae0('0x7')](0x3)[_0x8ae0('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8ae0('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x8ae0('0x7')](0x3)[_0x8ae0('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8ae0('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8ae0('0x7')](0x5)[_0x8ae0('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8ae0('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8ae0('0x7')](0x5)[_0x8ae0('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8ae0('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 545a4d3..44cde43 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 _0x4115=['query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','catch','show','length','includeAll','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','getHoppers','findOne','pick','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','phone','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','CampaignId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','into','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','IvrCampaigns','UserProfileResource','end','error','stack','name','send','index','map','Campaign','rawAttributes','type','key','model'];(function(_0x530245,_0x1541ab){var _0x22506d=function(_0x395400){while(--_0x395400){_0x530245['push'](_0x530245['shift']());}};_0x22506d(++_0x1541ab);}(_0x4115,0x16c));var _0x5411=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x4115[_0xb24a3e];return _0x4038d7;};'use strict';var emlformat=require(_0x5411('0x0'));var rimraf=require(_0x5411('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5411('0x2'));var rp=require(_0x5411('0x3'));var moment=require(_0x5411('0x4'));var BPromise=require(_0x5411('0x5'));var Mustache=require('mustache');var util=require(_0x5411('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5411('0x7'));var ejs=require(_0x5411('0x8'));var fs=require('fs');var fs_extra=require(_0x5411('0x9'));var _=require(_0x5411('0xa'));var squel=require(_0x5411('0xb'));var crypto=require(_0x5411('0xc'));var jsforce=require(_0x5411('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5411('0x7'));var querystring=require(_0x5411('0xe'));var Papa=require(_0x5411('0xf'));var Redis=require(_0x5411('0x10'));var authService=require(_0x5411('0x11'));var qs=require(_0x5411('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5411('0x13'));var logger=require(_0x5411('0x14'))(_0x5411('0x15'));var utils=require(_0x5411('0x16'));var config=require(_0x5411('0x17'));var licenseUtil=require(_0x5411('0x18'));var db=require(_0x5411('0x19'))['db'];function respondWithStatusCode(_0x34d4a5,_0x260555){_0x260555=_0x260555||0xcc;return function(_0x3a2759){if(_0x3a2759){return _0x34d4a5[_0x5411('0x1a')](_0x260555);}return _0x34d4a5[_0x5411('0x1b')](_0x260555)['end']();};}function respondWithResult(_0x526b4a,_0x1fc594){_0x1fc594=_0x1fc594||0xc8;return function(_0x5b91ac){if(_0x5b91ac){return _0x526b4a['status'](_0x1fc594)['json'](_0x5b91ac);}};}function respondWithFilteredResult(_0x177eec,_0x49aa38){return function(_0x404db4){if(_0x404db4){var _0x12fbae=typeof _0x49aa38[_0x5411('0x1c')]===_0x5411('0x1d')&&typeof _0x49aa38[_0x5411('0x1e')]===_0x5411('0x1d');var _0x1bc74a=_0x404db4[_0x5411('0x1f')];var _0x588180=_0x12fbae?0x0:_0x49aa38[_0x5411('0x1c')];var _0x1e99a0=_0x12fbae?_0x404db4[_0x5411('0x1f')]:_0x49aa38[_0x5411('0x1c')]+_0x49aa38['limit'];var _0x425230;if(_0x1e99a0>=_0x1bc74a){_0x1e99a0=_0x1bc74a;_0x425230=0xc8;}else{_0x425230=0xce;}_0x177eec[_0x5411('0x1b')](_0x425230);return _0x177eec[_0x5411('0x20')](_0x5411('0x21'),_0x588180+'-'+_0x1e99a0+'/'+_0x1bc74a)[_0x5411('0x22')](_0x404db4);}return null;};}function patchUpdates(_0x9a36e2){return function(_0x383af0){try{jsonpatch['apply'](_0x383af0,_0x9a36e2,!![]);}catch(_0x49c2de){return BPromise[_0x5411('0x23')](_0x49c2de);}return _0x383af0['save']();};}function saveUpdates(_0x43a0b5,_0x2dd672){return function(_0x250605){if(_0x250605){return _0x250605[_0x5411('0x24')](_0x43a0b5)[_0x5411('0x25')](function(_0x1d7e8d){return _0x1d7e8d;});}return null;};}function removeEntity(_0x5d57e7,_0xd596ad){return function(_0x303895){if(_0x303895){return _0x303895[_0x5411('0x26')]()[_0x5411('0x25')](function(){var _0x32eac5=_0x303895['get']({'plain':!![]});var _0x46fe38=_0x5411('0x27');return db[_0x5411('0x28')][_0x5411('0x26')]({'where':{'type':_0x46fe38,'resourceId':_0x32eac5['id']}})[_0x5411('0x25')](function(){return _0x303895;});})['then'](function(){_0x5d57e7['status'](0xcc)[_0x5411('0x29')]();});}};}function handleEntityNotFound(_0x1281ee,_0x502f78){return function(_0x1a4761){if(!_0x1a4761){_0x1281ee[_0x5411('0x1a')](0x194);}return _0x1a4761;};}function handleError(_0x2d0505,_0x22d86a){_0x22d86a=_0x22d86a||0x1f4;return function(_0x2e47f5){logger[_0x5411('0x2a')](_0x2e47f5[_0x5411('0x2b')]);if(_0x2e47f5[_0x5411('0x2c')]){delete _0x2e47f5[_0x5411('0x2c')];}_0x2d0505[_0x5411('0x1b')](_0x22d86a)[_0x5411('0x2d')](_0x2e47f5);};}exports[_0x5411('0x2e')]=function(_0x259871,_0x15fa41){var _0x39de76={},_0x13c72d={},_0x35f20c={'count':0x0,'rows':[]};var _0x1435de=_[_0x5411('0x2f')](db[_0x5411('0x30')][_0x5411('0x31')],function(_0x298b59){return{'name':_0x298b59['fieldName'],'type':_0x298b59[_0x5411('0x32')][_0x5411('0x33')]};});_0x13c72d[_0x5411('0x34')]=_[_0x5411('0x2f')](_0x1435de,_0x5411('0x2c'));_0x13c72d[_0x5411('0x35')]=_[_0x5411('0x36')](_0x259871[_0x5411('0x35')]);_0x13c72d['filters']=_['intersection'](_0x13c72d['model'],_0x13c72d[_0x5411('0x35')]);_0x39de76[_0x5411('0x37')]=_[_0x5411('0x38')](_0x13c72d['model'],qs[_0x5411('0x39')](_0x259871['query'][_0x5411('0x39')]));_0x39de76[_0x5411('0x37')]=_0x39de76[_0x5411('0x37')]['length']?_0x39de76[_0x5411('0x37')]:_0x13c72d[_0x5411('0x34')];if(!_0x259871[_0x5411('0x35')][_0x5411('0x3a')](_0x5411('0x3b'))){_0x39de76[_0x5411('0x1e')]=qs[_0x5411('0x1e')](_0x259871[_0x5411('0x35')][_0x5411('0x1e')]);_0x39de76[_0x5411('0x1c')]=qs[_0x5411('0x1c')](_0x259871[_0x5411('0x35')]['offset']);}_0x39de76[_0x5411('0x3c')]=qs[_0x5411('0x3d')](_0x259871['query'][_0x5411('0x3d')]);_0x39de76[_0x5411('0x3e')]=qs[_0x5411('0x3f')](_['pick'](_0x259871['query'],_0x13c72d[_0x5411('0x3f')]),_0x1435de);if(_0x259871[_0x5411('0x35')][_0x5411('0x40')]){_0x39de76[_0x5411('0x3e')]=_['merge'](_0x39de76['where'],{'$or':_[_0x5411('0x2f')](_0x1435de,function(_0x3df57c){if(_0x3df57c[_0x5411('0x32')]!==_0x5411('0x41')){var _0x42237d={};_0x42237d[_0x3df57c[_0x5411('0x2c')]]={'$like':'%'+_0x259871['query'][_0x5411('0x40')]+'%'};return _0x42237d;}})});}_0x39de76=_[_0x5411('0x42')]({},_0x39de76,_0x259871[_0x5411('0x43')]);var _0x7fbe7f={'where':_0x39de76['where']};return db[_0x5411('0x30')][_0x5411('0x1f')](_0x7fbe7f)['then'](function(_0x1d6210){_0x35f20c['count']=_0x1d6210;if(_0x259871[_0x5411('0x35')]['includeAll']){_0x39de76[_0x5411('0x44')]=[{'all':!![]}];}return db[_0x5411('0x30')][_0x5411('0x45')](_0x39de76);})[_0x5411('0x25')](function(_0x214fc8){_0x35f20c['rows']=_0x214fc8;return _0x35f20c;})[_0x5411('0x25')](respondWithFilteredResult(_0x15fa41,_0x39de76))[_0x5411('0x46')](handleError(_0x15fa41,null));};exports[_0x5411('0x47')]=function(_0x2ed8fd,_0x4ed315){var _0x2e32f3={'raw':![],'where':{'id':_0x2ed8fd['params']['id']}},_0x29d3a3={};_0x29d3a3[_0x5411('0x34')]=_['keys'](db[_0x5411('0x30')]['rawAttributes']);_0x29d3a3[_0x5411('0x35')]=_[_0x5411('0x36')](_0x2ed8fd[_0x5411('0x35')]);_0x29d3a3[_0x5411('0x3f')]=_[_0x5411('0x38')](_0x29d3a3[_0x5411('0x34')],_0x29d3a3[_0x5411('0x35')]);_0x2e32f3['attributes']=_[_0x5411('0x38')](_0x29d3a3['model'],qs['fields'](_0x2ed8fd[_0x5411('0x35')][_0x5411('0x39')]));_0x2e32f3[_0x5411('0x37')]=_0x2e32f3[_0x5411('0x37')][_0x5411('0x48')]?_0x2e32f3['attributes']:_0x29d3a3[_0x5411('0x34')];if(_0x2ed8fd[_0x5411('0x35')][_0x5411('0x49')]){_0x2e32f3[_0x5411('0x44')]=[{'all':!![]}];}_0x2e32f3=_['merge']({},_0x2e32f3,_0x2ed8fd[_0x5411('0x43')]);return db[_0x5411('0x30')][_0x5411('0x4a')](_0x2e32f3)[_0x5411('0x25')](handleEntityNotFound(_0x4ed315,null))[_0x5411('0x25')](respondWithResult(_0x4ed315,null))[_0x5411('0x46')](handleError(_0x4ed315,null));};exports[_0x5411('0x4b')]=function(_0x14d6ed,_0x336897){return db[_0x5411('0x30')][_0x5411('0x4b')](_0x14d6ed[_0x5411('0x4c')],{})[_0x5411('0x25')](function(_0x143355){var _0xffd844=_0x14d6ed['user'][_0x5411('0x4d')]({'plain':!![]});if(!_0xffd844)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xffd844[_0x5411('0x4e')]===_0x5411('0x4f')){var _0x4ffb4a=_0x143355[_0x5411('0x4d')]({'plain':!![]});var _0x1493c6=_0x5411('0x27');return db[_0x5411('0x50')][_0x5411('0x4a')]({'where':{'name':_0x1493c6,'userProfileId':_0xffd844[_0x5411('0x51')]},'raw':!![]})[_0x5411('0x25')](function(_0x313f53){if(_0x313f53&&_0x313f53[_0x5411('0x52')]===0x0){return db[_0x5411('0x28')][_0x5411('0x4b')]({'name':_0x4ffb4a[_0x5411('0x2c')],'resourceId':_0x4ffb4a['id'],'type':_0x313f53[_0x5411('0x2c')],'sectionId':_0x313f53['id']},{})[_0x5411('0x25')](function(){return _0x143355;});}else{return _0x143355;}})[_0x5411('0x46')](function(_0x4151c8){logger[_0x5411('0x2a')](_0x5411('0x53'),_0x4151c8);throw _0x4151c8;});}return _0x143355;})[_0x5411('0x25')](respondWithResult(_0x336897,0xc9))['catch'](handleError(_0x336897,null));};exports[_0x5411('0x54')]=function(_0xdccae8,_0x452a8c){var _0x1f5f70={'where':{'id':_0xdccae8[_0x5411('0x55')]['id']}},_0x123ab0={};_0x123ab0['model']=_['keys'](db[_0x5411('0x30')]['rawAttributes']);_0x1f5f70[_0x5411('0x37')]=_['intersection'](_0x123ab0[_0x5411('0x34')],qs[_0x5411('0x39')](_0xdccae8['query'][_0x5411('0x39')]));_0x1f5f70[_0x5411('0x37')]=_0x1f5f70[_0x5411('0x37')]['length']?_0x1f5f70[_0x5411('0x37')]:_0x123ab0[_0x5411('0x34')];if(_0xdccae8[_0x5411('0x35')]['includeAll']){_0x1f5f70[_0x5411('0x44')]=[{'all':!![]}];}_0x1f5f70=_['merge']({},_0x1f5f70,_0xdccae8[_0x5411('0x43')]);return db[_0x5411('0x30')][_0x5411('0x4a')](_0x1f5f70)['then'](handleEntityNotFound(_0x452a8c,null))[_0x5411('0x25')](function(_0x3f5aaf){if(_0x3f5aaf){var _0x360b6c=_0x3f5aaf[_0x5411('0x4d')]({'plain':!![]});_0x360b6c=qs[_0x5411('0x56')](_0x360b6c,['id','createdAt',_0x5411('0x57')]);_0xdccae8['body']=_[_0x5411('0x56')](_0xdccae8[_0x5411('0x4c')],['id',_0x5411('0x58'),_0x5411('0x57')]);return db[_0x5411('0x30')][_0x5411('0x4b')](_['merge'](_0x360b6c,_0xdccae8[_0x5411('0x4c')]),{'include':_0xdccae8[_0x5411('0x35')][_0x5411('0x49')]?[{'all':!![]}]:undefined})[_0x5411('0x25')](function(_0x1280dd){var _0x16bd7b=_0xdccae8[_0x5411('0x4f')]['get']({'plain':!![]});if(!_0x16bd7b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16bd7b[_0x5411('0x4e')]===_0x5411('0x4f')){var _0x30e035=_0x1280dd['get']({'plain':!![]});var _0x33b32c=_0x5411('0x27');return db[_0x5411('0x50')][_0x5411('0x4a')]({'where':{'name':_0x33b32c,'userProfileId':_0x16bd7b['userProfileId']},'raw':!![]})['then'](function(_0x2e424f){if(_0x2e424f&&_0x2e424f[_0x5411('0x52')]===0x0){return db[_0x5411('0x28')][_0x5411('0x4b')]({'name':_0x30e035[_0x5411('0x2c')],'resourceId':_0x30e035['id'],'type':_0x2e424f['name'],'sectionId':_0x2e424f['id']},{})[_0x5411('0x25')](function(){return _0x1280dd;});}else{return _0x1280dd;}})[_0x5411('0x46')](function(_0xa2a7ef){logger['error'](_0x5411('0x53'),_0xa2a7ef);throw _0xa2a7ef;});}return _0x1280dd;});}})[_0x5411('0x25')](respondWithResult(_0x452a8c,0xc9))['catch'](handleError(_0x452a8c,null));};exports[_0x5411('0x24')]=function(_0x4ff3d8,_0x3d1215){if(_0x4ff3d8['body']['id']){delete _0x4ff3d8[_0x5411('0x4c')]['id'];}return db[_0x5411('0x30')][_0x5411('0x4a')]({'where':{'id':_0x4ff3d8[_0x5411('0x55')]['id']}})[_0x5411('0x25')](handleEntityNotFound(_0x3d1215,null))[_0x5411('0x25')](saveUpdates(_0x4ff3d8[_0x5411('0x4c')],null))[_0x5411('0x25')](respondWithResult(_0x3d1215,null))[_0x5411('0x46')](handleError(_0x3d1215,null));};exports[_0x5411('0x26')]=function(_0x1bb35f,_0x50f3c0){return db[_0x5411('0x30')][_0x5411('0x4a')]({'where':{'id':_0x1bb35f['params']['id']}})['then'](handleEntityNotFound(_0x50f3c0,null))['then'](removeEntity(_0x50f3c0,null))['catch'](handleError(_0x50f3c0,null));};exports[_0x5411('0x59')]=function(_0x39e899,_0x4251bb,_0x51b791){var _0x4e3276={'raw':!![],'where':{}};var _0x48a29c={};var _0x36b3c6={'count':0x0,'rows':[]};return db[_0x5411('0x30')][_0x5411('0x5a')]({'where':{'id':_0x39e899[_0x5411('0x55')]['id']}})[_0x5411('0x25')](handleEntityNotFound(_0x4251bb,null))[_0x5411('0x25')](function(_0x30fd1a){if(_0x30fd1a){_0x48a29c[_0x5411('0x34')]=_[_0x5411('0x36')](db['CmHopper'][_0x5411('0x31')]);_0x48a29c[_0x5411('0x35')]=_[_0x5411('0x36')](_0x39e899[_0x5411('0x35')]);_0x48a29c['filters']=_[_0x5411('0x38')](_0x48a29c[_0x5411('0x34')],_0x48a29c[_0x5411('0x35')]);_0x4e3276[_0x5411('0x37')]=_[_0x5411('0x38')](_0x48a29c['model'],qs['fields'](_0x39e899['query'][_0x5411('0x39')]));_0x4e3276[_0x5411('0x37')]=_0x4e3276[_0x5411('0x37')][_0x5411('0x48')]?_0x4e3276[_0x5411('0x37')]:_0x48a29c[_0x5411('0x34')];if(!_0x39e899[_0x5411('0x35')]['hasOwnProperty']('nolimit')){_0x4e3276[_0x5411('0x1e')]=qs['limit'](_0x39e899[_0x5411('0x35')][_0x5411('0x1e')]);_0x4e3276['offset']=qs['offset'](_0x39e899[_0x5411('0x35')][_0x5411('0x1c')]);}_0x4e3276[_0x5411('0x3c')]=qs[_0x5411('0x3d')](_0x39e899[_0x5411('0x35')][_0x5411('0x3d')]);_0x4e3276['where']=qs['filters'](_[_0x5411('0x5b')](_0x39e899[_0x5411('0x35')],_0x48a29c[_0x5411('0x3f')]));_0x4e3276[_0x5411('0x3e')][_0x5411('0x5c')]=_0x30fd1a['id'];if(_0x39e899[_0x5411('0x35')][_0x5411('0x40')]){_0x4e3276[_0x5411('0x3e')]=_[_0x5411('0x42')](_0x4e3276[_0x5411('0x3e')],{'$or':_[_0x5411('0x2f')](_0x4e3276['attributes'],function(_0x265c94){var _0x5ab848={};_0x5ab848[_0x265c94]={'$like':'%'+_0x39e899[_0x5411('0x35')][_0x5411('0x40')]+'%'};return _0x5ab848;})});}_0x4e3276=_[_0x5411('0x42')]({},_0x4e3276,_0x39e899[_0x5411('0x43')]);return db[_0x5411('0x5d')][_0x5411('0x1f')]({'where':_0x4e3276[_0x5411('0x3e')]})[_0x5411('0x25')](function(_0x40a89c){_0x36b3c6[_0x5411('0x1f')]=_0x40a89c;if(_0x39e899[_0x5411('0x35')][_0x5411('0x49')]){_0x4e3276[_0x5411('0x44')]=[{'all':!![]}];}return db[_0x5411('0x5d')][_0x5411('0x45')](_0x4e3276);})[_0x5411('0x25')](function(_0x3cb3ad){_0x36b3c6['rows']=_0x3cb3ad;return _0x36b3c6;});}})['then'](respondWithFilteredResult(_0x4251bb,_0x4e3276))[_0x5411('0x46')](handleError(_0x4251bb,null));};exports[_0x5411('0x5e')]=function(_0x99bfb,_0x2fc3b9,_0x496751){var _0x2ddcb8={'raw':!![],'where':{}};var _0x5af668={};var _0x2af265={'count':0x0,'rows':[]};return db[_0x5411('0x30')][_0x5411('0x5a')]({'where':{'id':_0x99bfb[_0x5411('0x55')]['id']}})[_0x5411('0x25')](handleEntityNotFound(_0x2fc3b9,null))[_0x5411('0x25')](function(_0x3dd0fe){if(_0x3dd0fe){_0x5af668[_0x5411('0x34')]=_[_0x5411('0x36')](db[_0x5411('0x5f')][_0x5411('0x31')]);_0x5af668['query']=_[_0x5411('0x36')](_0x99bfb[_0x5411('0x35')]);_0x5af668['filters']=_[_0x5411('0x38')](_0x5af668[_0x5411('0x34')],_0x5af668['query']);_0x2ddcb8[_0x5411('0x37')]=_['intersection'](_0x5af668[_0x5411('0x34')],qs['fields'](_0x99bfb[_0x5411('0x35')][_0x5411('0x39')]));_0x2ddcb8['attributes']=_0x2ddcb8[_0x5411('0x37')]['length']?_0x2ddcb8[_0x5411('0x37')]:_0x5af668['model'];if(!_0x99bfb['query'][_0x5411('0x3a')](_0x5411('0x3b'))){_0x2ddcb8['limit']=qs['limit'](_0x99bfb[_0x5411('0x35')][_0x5411('0x1e')]);_0x2ddcb8[_0x5411('0x1c')]=qs[_0x5411('0x1c')](_0x99bfb[_0x5411('0x35')][_0x5411('0x1c')]);}_0x2ddcb8[_0x5411('0x3c')]=qs[_0x5411('0x3d')](_0x99bfb[_0x5411('0x35')]['sort']);_0x2ddcb8[_0x5411('0x3e')]=qs[_0x5411('0x3f')](_[_0x5411('0x5b')](_0x99bfb[_0x5411('0x35')],_0x5af668['filters']));_0x2ddcb8[_0x5411('0x3e')][_0x5411('0x5c')]=_0x3dd0fe['id'];if(_0x99bfb['query'][_0x5411('0x40')]){_0x2ddcb8[_0x5411('0x3e')]=_['merge'](_0x2ddcb8['where'],{'$or':_[_0x5411('0x2f')](_0x2ddcb8[_0x5411('0x37')],function(_0x8d2356){var _0x2c5f8c={};_0x2c5f8c[_0x8d2356]={'$like':'%'+_0x99bfb[_0x5411('0x35')][_0x5411('0x40')]+'%'};return _0x2c5f8c;})});}_0x2ddcb8=_[_0x5411('0x42')]({},_0x2ddcb8,_0x99bfb[_0x5411('0x43')]);return db[_0x5411('0x5f')][_0x5411('0x1f')]({'where':_0x2ddcb8[_0x5411('0x3e')]})[_0x5411('0x25')](function(_0x2256ef){_0x2af265['count']=_0x2256ef;if(_0x99bfb[_0x5411('0x35')][_0x5411('0x49')]){_0x2ddcb8[_0x5411('0x44')]=[{'all':!![]}];}return db[_0x5411('0x5f')][_0x5411('0x45')](_0x2ddcb8);})[_0x5411('0x25')](function(_0x1df7f2){_0x2af265[_0x5411('0x60')]=_0x1df7f2;return _0x2af265;});}})[_0x5411('0x25')](respondWithFilteredResult(_0x2fc3b9,_0x2ddcb8))[_0x5411('0x46')](handleError(_0x2fc3b9,null));};exports[_0x5411('0x61')]=function(_0x3531bb,_0x10b40d,_0x150eac){var _0x4de7b4={'raw':!![],'where':{}};var _0x90c52b={};var _0x435db8={'count':0x0,'rows':[]};return db[_0x5411('0x30')][_0x5411('0x5a')]({'where':{'id':_0x3531bb[_0x5411('0x55')]['id']}})[_0x5411('0x25')](handleEntityNotFound(_0x10b40d,null))[_0x5411('0x25')](function(_0xc0dea0){if(_0xc0dea0){_0x90c52b['model']=_[_0x5411('0x36')](db['CmHopperFinal'][_0x5411('0x31')]);_0x90c52b[_0x5411('0x35')]=_[_0x5411('0x36')](_0x3531bb['query']);_0x90c52b['filters']=_[_0x5411('0x38')](_0x90c52b[_0x5411('0x34')],_0x90c52b['query']);_0x4de7b4[_0x5411('0x37')]=_[_0x5411('0x38')](_0x90c52b[_0x5411('0x34')],qs[_0x5411('0x39')](_0x3531bb[_0x5411('0x35')]['fields']));_0x4de7b4[_0x5411('0x37')]=_0x4de7b4[_0x5411('0x37')]['length']?_0x4de7b4['attributes']:_0x90c52b['model'];if(!_0x3531bb['query'][_0x5411('0x3a')](_0x5411('0x3b'))){_0x4de7b4[_0x5411('0x1e')]=qs[_0x5411('0x1e')](_0x3531bb['query'][_0x5411('0x1e')]);_0x4de7b4['offset']=qs[_0x5411('0x1c')](_0x3531bb[_0x5411('0x35')][_0x5411('0x1c')]);}_0x4de7b4[_0x5411('0x3c')]=qs['sort'](_0x3531bb[_0x5411('0x35')][_0x5411('0x3d')]);_0x4de7b4['where']=qs[_0x5411('0x3f')](_[_0x5411('0x5b')](_0x3531bb[_0x5411('0x35')],_0x90c52b[_0x5411('0x3f')]));_0x4de7b4['where']['CampaignId']=_0xc0dea0['id'];if(_0x3531bb[_0x5411('0x35')][_0x5411('0x40')]){_0x4de7b4[_0x5411('0x3e')]=_[_0x5411('0x42')](_0x4de7b4[_0x5411('0x3e')],{'$or':_['map'](_0x4de7b4[_0x5411('0x37')],function(_0x2f918c){var _0x21e3cb={};_0x21e3cb[_0x2f918c]={'$like':'%'+_0x3531bb[_0x5411('0x35')]['filter']+'%'};return _0x21e3cb;})});}_0x4de7b4=_[_0x5411('0x42')]({},_0x4de7b4,_0x3531bb['options']);return db[_0x5411('0x62')][_0x5411('0x1f')]({'where':_0x4de7b4[_0x5411('0x3e')]})[_0x5411('0x25')](function(_0x19ce19){_0x435db8[_0x5411('0x1f')]=_0x19ce19;if(_0x3531bb['query'][_0x5411('0x49')]){_0x4de7b4[_0x5411('0x44')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x4de7b4);})[_0x5411('0x25')](function(_0x430d9e){_0x435db8[_0x5411('0x60')]=_0x430d9e;return _0x435db8;});}})[_0x5411('0x25')](respondWithFilteredResult(_0x10b40d,_0x4de7b4))[_0x5411('0x46')](handleError(_0x10b40d,null));};exports['getHopperBlacks']=function(_0x196d5a,_0xe0f988,_0x8a638e){var _0xaa86aa={'raw':!![],'where':{}};var _0x3c710b={};var _0x21a494={'count':0x0,'rows':[]};return db[_0x5411('0x30')]['findOne']({'where':{'id':_0x196d5a[_0x5411('0x55')]['id']}})[_0x5411('0x25')](handleEntityNotFound(_0xe0f988,null))[_0x5411('0x25')](function(_0x3878b9){if(_0x3878b9){_0x3c710b['model']=_['keys'](db[_0x5411('0x63')][_0x5411('0x31')]);_0x3c710b[_0x5411('0x35')]=_['keys'](_0x196d5a['query']);_0x3c710b['filters']=_[_0x5411('0x38')](_0x3c710b[_0x5411('0x34')],_0x3c710b[_0x5411('0x35')]);_0xaa86aa[_0x5411('0x37')]=_[_0x5411('0x38')](_0x3c710b['model'],qs[_0x5411('0x39')](_0x196d5a[_0x5411('0x35')][_0x5411('0x39')]));_0xaa86aa['attributes']=_0xaa86aa['attributes'][_0x5411('0x48')]?_0xaa86aa[_0x5411('0x37')]:_0x3c710b['model'];if(!_0x196d5a['query'][_0x5411('0x3a')](_0x5411('0x3b'))){_0xaa86aa[_0x5411('0x1e')]=qs[_0x5411('0x1e')](_0x196d5a[_0x5411('0x35')][_0x5411('0x1e')]);_0xaa86aa['offset']=qs[_0x5411('0x1c')](_0x196d5a[_0x5411('0x35')][_0x5411('0x1c')]);}_0xaa86aa['order']=qs['sort'](_0x196d5a[_0x5411('0x35')][_0x5411('0x3d')]);_0xaa86aa[_0x5411('0x3e')]=qs[_0x5411('0x3f')](_[_0x5411('0x5b')](_0x196d5a[_0x5411('0x35')],_0x3c710b[_0x5411('0x3f')]));_0xaa86aa[_0x5411('0x3e')]['CampaignId']=_0x3878b9['id'];if(_0x196d5a[_0x5411('0x35')][_0x5411('0x40')]){_0xaa86aa['where']=_[_0x5411('0x42')](_0xaa86aa[_0x5411('0x3e')],{'$or':_['map'](_0xaa86aa[_0x5411('0x37')],function(_0xbed050){var _0x31b8fb={};_0x31b8fb[_0xbed050]={'$like':'%'+_0x196d5a[_0x5411('0x35')][_0x5411('0x40')]+'%'};return _0x31b8fb;})});}_0xaa86aa=_[_0x5411('0x42')]({},_0xaa86aa,_0x196d5a[_0x5411('0x43')]);return db[_0x5411('0x63')]['count']({'where':_0xaa86aa[_0x5411('0x3e')]})[_0x5411('0x25')](function(_0x50551a){_0x21a494['count']=_0x50551a;if(_0x196d5a['query'][_0x5411('0x49')]){_0xaa86aa['include']=[{'all':!![]}];}return db[_0x5411('0x63')]['findAll'](_0xaa86aa);})[_0x5411('0x25')](function(_0x2b73f9){_0x21a494['rows']=_0x2b73f9;return _0x21a494;});}})[_0x5411('0x25')](respondWithFilteredResult(_0xe0f988,_0xaa86aa))[_0x5411('0x46')](handleError(_0xe0f988,null));};exports[_0x5411('0x64')]=function(_0x10c67d,_0x5aae5e,_0x38c6fc){var _0x464825={};var _0x23a9cb={};var _0x73b1c3;var _0x566a17;return db['Campaign'][_0x5411('0x5a')]({'where':{'id':_0x10c67d[_0x5411('0x55')]['id']}})[_0x5411('0x25')](handleEntityNotFound(_0x5aae5e,null))['then'](function(_0x73bb44){if(_0x73bb44){_0x73b1c3=_0x73bb44;_0x23a9cb['model']=_[_0x5411('0x36')](db[_0x5411('0x65')][_0x5411('0x31')]);_0x23a9cb[_0x5411('0x35')]=_[_0x5411('0x36')](_0x10c67d[_0x5411('0x35')]);_0x23a9cb[_0x5411('0x3f')]=_[_0x5411('0x38')](_0x23a9cb['model'],_0x23a9cb[_0x5411('0x35')]);_0x464825[_0x5411('0x37')]=_[_0x5411('0x38')](_0x23a9cb['model'],qs[_0x5411('0x39')](_0x10c67d['query'][_0x5411('0x39')]));_0x464825[_0x5411('0x37')]=_0x464825[_0x5411('0x37')][_0x5411('0x48')]?_0x464825[_0x5411('0x37')]:_0x23a9cb['model'];_0x464825['order']=qs['sort'](_0x10c67d[_0x5411('0x35')][_0x5411('0x3d')]);_0x464825[_0x5411('0x3e')]=qs['filters'](_[_0x5411('0x5b')](_0x10c67d[_0x5411('0x35')],_0x23a9cb['filters']));if(_0x10c67d[_0x5411('0x35')]['filter']){_0x464825[_0x5411('0x3e')]=_[_0x5411('0x42')](_0x464825['where'],{'$or':_[_0x5411('0x2f')](_0x464825[_0x5411('0x37')],function(_0x39a841){var _0x4e7192={};_0x4e7192[_0x39a841]={'$like':'%'+_0x10c67d[_0x5411('0x35')][_0x5411('0x40')]+'%'};return _0x4e7192;})});}_0x464825=_[_0x5411('0x42')]({},_0x464825,_0x10c67d[_0x5411('0x43')]);return _0x73b1c3[_0x5411('0x64')](_0x464825);}})[_0x5411('0x25')](function(_0x1d2ff9){if(_0x1d2ff9){_0x566a17=_0x1d2ff9['length'];if(!_0x10c67d[_0x5411('0x35')]['hasOwnProperty'](_0x5411('0x3b'))){_0x464825[_0x5411('0x1e')]=qs[_0x5411('0x1e')](_0x10c67d[_0x5411('0x35')][_0x5411('0x1e')]);_0x464825[_0x5411('0x1c')]=qs[_0x5411('0x1c')](_0x10c67d[_0x5411('0x35')][_0x5411('0x1c')]);}return _0x73b1c3['getLists'](_0x464825);}})['then'](function(_0x5a421f){if(_0x5a421f){return _0x5a421f?{'count':_0x566a17,'rows':_0x5a421f}:null;}})[_0x5411('0x25')](respondWithResult(_0x5aae5e,null))[_0x5411('0x46')](handleError(_0x5aae5e,null));};exports[_0x5411('0x66')]=function(_0x3684c5,_0x139ddf,_0xce6c9){var _0x125230,_0x3e197f;return db['Campaign']['find']({'where':{'id':_0x3684c5['params']['id']}})[_0x5411('0x25')](handleEntityNotFound(_0x139ddf,null))[_0x5411('0x25')](function(_0x4f5306){if(_0x4f5306){_0x3e197f=_0x4f5306;return _0x4f5306['addLists'](_0x3684c5[_0x5411('0x4c')][_0x5411('0x67')],_[_0x5411('0x56')](_0x3684c5[_0x5411('0x4c')],[_0x5411('0x67'),'id'])||{});}return null;})[_0x5411('0x68')](function(_0x415fe9){var _0x2597e8;_0x125230=_0x415fe9||[];var _0x4da8a8=[];if(_0x415fe9){for(var _0x40843c=0x0;_0x40843c<_0x415fe9[_0x5411('0x48')];_0x40843c+=0x1){var _0x1fcb27=_0x415fe9[_0x40843c][_0x5411('0x4d')]({'plain':!![]});_0x3e197f[_0x5411('0x69')]=_0x3684c5['body'][_0x5411('0x69')]?_0x3684c5[_0x5411('0x4c')]['dialCheckDuplicateType']:_0x3e197f[_0x5411('0x69')];switch(_0x3e197f[_0x5411('0x69')]){case _0x5411('0x6a'):_0x2597e8=squel[_0x5411('0x6b')]()['into'](_0x5411('0x6c'))[_0x5411('0x6d')](['phone',_0x5411('0x6e'),_0x5411('0x6f'),_0x5411('0x70'),'CampaignId',_0x5411('0x58'),_0x5411('0x57')],squel[_0x5411('0x71')]()[_0x5411('0x72')](_0x5411('0x73'),_0x5411('0x73'))[_0x5411('0x72')]('NOW()',_0x5411('0x6e'))['field']('id',_0x5411('0x6f'))[_0x5411('0x72')](_0x1fcb27[_0x5411('0x74')][_0x5411('0x75')](),_0x5411('0x70'))['field'](_0x3684c5[_0x5411('0x55')]['id']['toString'](),_0x5411('0x5c'))[_0x5411('0x72')](_0x5411('0x76'),'createdAt')['field'](_0x5411('0x76'),_0x5411('0x57'))[_0x5411('0x77')](_0x5411('0x78'))[_0x5411('0x3e')](_0x5411('0x79'))[_0x5411('0x3e')](_0x5411('0x7a'),_0x1fcb27[_0x5411('0x74')][_0x5411('0x75')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x5411('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x5411('0x72')](_0x5411('0x7b'))['from'](_0x5411('0x7c'))[_0x5411('0x3e')]('CampaignId\x20=\x20?',_0x3684c5[_0x5411('0x55')]['id']['toString']()))[_0x5411('0x3e')](_0x5411('0x7d'),squel[_0x5411('0x71')]()[_0x5411('0x72')](_0x5411('0x7e'))[_0x5411('0x77')]('cm_hopper')[_0x5411('0x3e')]('CampaignId\x20=\x20?',_0x3684c5['params']['id'][_0x5411('0x75')]())))[_0x5411('0x75')]();break;case _0x5411('0x7f'):_0x2597e8=squel[_0x5411('0x6b')]()['into'](_0x5411('0x6c'))[_0x5411('0x6d')]([_0x5411('0x73'),_0x5411('0x6e'),_0x5411('0x6f'),_0x5411('0x70'),_0x5411('0x5c'),_0x5411('0x58'),'updatedAt'],squel[_0x5411('0x71')]()['field'](_0x5411('0x73'),_0x5411('0x73'))['field'](_0x5411('0x76'),_0x5411('0x6e'))[_0x5411('0x72')]('id',_0x5411('0x6f'))[_0x5411('0x72')](_0x1fcb27[_0x5411('0x74')][_0x5411('0x75')](),'ListId')['field'](_0x3684c5[_0x5411('0x55')]['id'][_0x5411('0x75')](),_0x5411('0x5c'))[_0x5411('0x72')]('NOW()','createdAt')['field']('NOW()',_0x5411('0x57'))['from']('cm_contacts')['where'](_0x5411('0x79'))[_0x5411('0x3e')]('ListId\x20=\x20?',_0x1fcb27['CmListId']['toString']())['where'](_0x5411('0x80'))[_0x5411('0x3e')](_0x5411('0x7d'),squel[_0x5411('0x71')]()[_0x5411('0x72')](_0x5411('0x7e'))[_0x5411('0x77')](_0x5411('0x6c'))[_0x5411('0x3e')](_0x5411('0x81'),_0x3684c5['params']['id'][_0x5411('0x75')]())))[_0x5411('0x75')]();break;default:_0x2597e8=squel[_0x5411('0x6b')]()['into'](_0x5411('0x6c'))['fromQuery'](['phone',_0x5411('0x6e'),_0x5411('0x6f'),_0x5411('0x70'),_0x5411('0x5c'),_0x5411('0x58'),_0x5411('0x57')],squel[_0x5411('0x71')]()[_0x5411('0x72')](_0x5411('0x73'),_0x5411('0x73'))[_0x5411('0x72')](_0x5411('0x76'),'scheduledAt')['field']('id',_0x5411('0x6f'))[_0x5411('0x72')](_0x1fcb27[_0x5411('0x74')][_0x5411('0x75')](),_0x5411('0x70'))['field'](_0x3684c5['params']['id'][_0x5411('0x75')](),_0x5411('0x5c'))[_0x5411('0x72')]('NOW()',_0x5411('0x58'))[_0x5411('0x72')](_0x5411('0x76'),_0x5411('0x57'))[_0x5411('0x77')](_0x5411('0x78'))['where'](_0x5411('0x79'))['where'](_0x5411('0x7a'),_0x1fcb27['CmListId'][_0x5411('0x75')]())[_0x5411('0x3e')](_0x5411('0x80')))[_0x5411('0x75')]();}_0x4da8a8[_0x5411('0x82')](db[_0x5411('0x83')][_0x5411('0x35')](_0x2597e8));}return BPromise[_0x5411('0x84')](_0x4da8a8);}})['then'](function(){return _0x125230;})['then'](respondWithResult(_0x139ddf,null))['catch'](handleError(_0x139ddf,null));};exports[_0x5411('0x85')]=function(_0x4d2066,_0x4adb97,_0x341403){return db[_0x5411('0x30')][_0x5411('0x4a')]({'where':{'id':_0x4d2066[_0x5411('0x55')]['id']}})['then'](handleEntityNotFound(_0x4adb97,null))['then'](function(_0x4d7e9b){if(_0x4d7e9b){return _0x4d7e9b[_0x5411('0x85')](_0x4d2066[_0x5411('0x35')]['ids']);}})[_0x5411('0x25')](function(_0x1202e6){if(_0x1202e6){return db['CmHopper'][_0x5411('0x26')]({'where':{'ListId':_0x4d2066[_0x5411('0x35')][_0x5411('0x67')],'CampaignId':_0x4d2066[_0x5411('0x55')]['id']}})[_0x5411('0x25')](function(){return _0x1202e6;});}})[_0x5411('0x25')](respondWithStatusCode(_0x4adb97,null))[_0x5411('0x46')](handleError(_0x4adb97,null));};exports[_0x5411('0x86')]=function(_0xd15b2,_0x1c0cfe,_0x5da68d){var _0x4c0ef7={};var _0x47a26b={};var _0x504e1b;var _0x2579b9;return db['Campaign'][_0x5411('0x5a')]({'where':{'id':_0xd15b2[_0x5411('0x55')]['id']}})[_0x5411('0x25')](handleEntityNotFound(_0x1c0cfe,null))[_0x5411('0x25')](function(_0x38615c){if(_0x38615c){_0x504e1b=_0x38615c;_0x47a26b[_0x5411('0x34')]=_['keys'](db[_0x5411('0x65')]['rawAttributes']);_0x47a26b['query']=_['keys'](_0xd15b2[_0x5411('0x35')]);_0x47a26b['filters']=_['intersection'](_0x47a26b[_0x5411('0x34')],_0x47a26b[_0x5411('0x35')]);_0x4c0ef7[_0x5411('0x37')]=_[_0x5411('0x38')](_0x47a26b['model'],qs[_0x5411('0x39')](_0xd15b2[_0x5411('0x35')][_0x5411('0x39')]));_0x4c0ef7['attributes']=_0x4c0ef7[_0x5411('0x37')][_0x5411('0x48')]?_0x4c0ef7['attributes']:_0x47a26b[_0x5411('0x34')];_0x4c0ef7['order']=qs[_0x5411('0x3d')](_0xd15b2['query'][_0x5411('0x3d')]);_0x4c0ef7[_0x5411('0x3e')]=qs[_0x5411('0x3f')](_[_0x5411('0x5b')](_0xd15b2['query'],_0x47a26b[_0x5411('0x3f')]));if(_0xd15b2[_0x5411('0x35')][_0x5411('0x40')]){_0x4c0ef7[_0x5411('0x3e')]=_[_0x5411('0x42')](_0x4c0ef7[_0x5411('0x3e')],{'$or':_['map'](_0x4c0ef7[_0x5411('0x37')],function(_0x532ecd){var _0x1b2a63={};_0x1b2a63[_0x532ecd]={'$like':'%'+_0xd15b2[_0x5411('0x35')][_0x5411('0x40')]+'%'};return _0x1b2a63;})});}_0x4c0ef7=_[_0x5411('0x42')]({},_0x4c0ef7,_0xd15b2[_0x5411('0x43')]);return _0x504e1b[_0x5411('0x86')](_0x4c0ef7);}})[_0x5411('0x25')](function(_0x106aa4){if(_0x106aa4){_0x2579b9=_0x106aa4['length'];if(!_0xd15b2[_0x5411('0x35')][_0x5411('0x3a')]('nolimit')){_0x4c0ef7['limit']=qs[_0x5411('0x1e')](_0xd15b2[_0x5411('0x35')]['limit']);_0x4c0ef7[_0x5411('0x1c')]=qs[_0x5411('0x1c')](_0xd15b2['query']['offset']);}return _0x504e1b[_0x5411('0x86')](_0x4c0ef7);}})['then'](function(_0xc784c5){if(_0xc784c5){return _0xc784c5?{'count':_0x2579b9,'rows':_0xc784c5}:null;}})[_0x5411('0x25')](respondWithResult(_0x1c0cfe,null))[_0x5411('0x46')](handleError(_0x1c0cfe,null));};exports[_0x5411('0x87')]=function(_0x139e89,_0x4780fe,_0x5c2cc9){var _0x25772d,_0x501eb4;return db[_0x5411('0x30')]['find']({'where':{'id':_0x139e89[_0x5411('0x55')]['id']}})[_0x5411('0x25')](handleEntityNotFound(_0x4780fe,null))['then'](function(_0x55cde3){if(_0x55cde3){_0x501eb4=_0x55cde3;return _0x55cde3['addBlackLists'](_0x139e89['body']['ids'],_[_0x5411('0x56')](_0x139e89[_0x5411('0x4c')],[_0x5411('0x67'),'id'])||{});}return null;})['spread'](function(_0x41cea5){var _0x12cdaa;_0x25772d=_0x41cea5||[];var _0x115deb=[];if(_0x41cea5){for(var _0x41b1bd=0x0;_0x41b1bd<_0x41cea5[_0x5411('0x48')];_0x41b1bd+=0x1){var _0x2c896b=_0x41cea5[_0x41b1bd][_0x5411('0x4d')]({'plain':!![]});_0x12cdaa=squel[_0x5411('0x6b')]()[_0x5411('0x88')](_0x5411('0x89'))[_0x5411('0x6d')](['phone',_0x5411('0x6f'),_0x5411('0x70'),_0x5411('0x5c'),'createdAt',_0x5411('0x57')],squel[_0x5411('0x71')]()[_0x5411('0x72')](_0x5411('0x73'),_0x5411('0x73'))[_0x5411('0x72')]('id','ContactId')[_0x5411('0x72')](_0x2c896b[_0x5411('0x74')][_0x5411('0x75')](),_0x5411('0x70'))[_0x5411('0x72')](_0x139e89['params']['id'][_0x5411('0x75')](),'CampaignId')['field'](_0x5411('0x76'),_0x5411('0x58'))[_0x5411('0x72')](_0x5411('0x76'),_0x5411('0x57'))[_0x5411('0x77')](_0x5411('0x78'))[_0x5411('0x3e')](_0x5411('0x79'))[_0x5411('0x3e')]('ListId\x20=\x20?',_0x2c896b['CmListId'][_0x5411('0x75')]())[_0x5411('0x3e')](_0x5411('0x80')))[_0x5411('0x75')]();_0x115deb[_0x5411('0x82')](db[_0x5411('0x83')][_0x5411('0x35')](_0x12cdaa));}return BPromise['all'](_0x115deb);}})['then'](function(){return _0x25772d;})[_0x5411('0x25')](respondWithResult(_0x4780fe,null))[_0x5411('0x46')](handleError(_0x4780fe,null));};exports['removeBlackLists']=function(_0x532995,_0x3a1b66,_0x4dbf23){return db['Campaign'][_0x5411('0x4a')]({'where':{'id':_0x532995['params']['id']}})[_0x5411('0x25')](handleEntityNotFound(_0x3a1b66,null))['then'](function(_0xa5c3f3){if(_0xa5c3f3){return _0xa5c3f3[_0x5411('0x8a')](_0x532995[_0x5411('0x35')]['ids']);}})['then'](function(_0x21af33){if(_0x21af33){return db[_0x5411('0x63')][_0x5411('0x26')]({'where':{'ListId':_0x532995[_0x5411('0x35')]['ids'],'CampaignId':_0x532995['params']['id']}})[_0x5411('0x25')](function(){return _0x21af33;});}})[_0x5411('0x25')](respondWithStatusCode(_0x3a1b66,null))['catch'](handleError(_0x3a1b66,null));}; \ No newline at end of file +var _0xcbcd=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Campaign','includeAll','include','findAll','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','createdAt','getHoppers','CmHopper','hasOwnProperty','CampaignId','rows','findOne','CmHopperHistory','CmHopperFinal','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ContactId','select','field','NOW()','scheduledAt','CmListId','toString','ListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cm_contacts','deletedAt\x20IS\x20NULL','push','sequelize','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x38ee82,_0x5d04b6){var _0x57203f=function(_0x1bee3f){while(--_0x1bee3f){_0x38ee82['push'](_0x38ee82['shift']());}};_0x57203f(++_0x5d04b6);}(_0xcbcd,0x177));var _0xdcbc=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0xcbcd[_0x10dbf6];return _0x452147;};'use strict';var emlformat=require(_0xdcbc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcbc('0x1'));var jsonpatch=require(_0xdcbc('0x2'));var rp=require(_0xdcbc('0x3'));var moment=require(_0xdcbc('0x4'));var BPromise=require(_0xdcbc('0x5'));var Mustache=require(_0xdcbc('0x6'));var util=require(_0xdcbc('0x7'));var path=require(_0xdcbc('0x8'));var sox=require('sox');var csv=require(_0xdcbc('0x9'));var ejs=require(_0xdcbc('0xa'));var fs=require('fs');var fs_extra=require(_0xdcbc('0xb'));var _=require(_0xdcbc('0xc'));var squel=require('squel');var crypto=require(_0xdcbc('0xd'));var jsforce=require(_0xdcbc('0xe'));var deskjs=require(_0xdcbc('0xf'));var toCsv=require(_0xdcbc('0x9'));var querystring=require('querystring');var Papa=require(_0xdcbc('0x10'));var Redis=require('ioredis');var authService=require(_0xdcbc('0x11'));var qs=require(_0xdcbc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdcbc('0x13'));var logger=require(_0xdcbc('0x14'))(_0xdcbc('0x15'));var utils=require('../../config/utils');var config=require(_0xdcbc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdcbc('0x17'))['db'];function respondWithStatusCode(_0x56ce97,_0x2730e2){_0x2730e2=_0x2730e2||0xcc;return function(_0x42c23b){if(_0x42c23b){return _0x56ce97[_0xdcbc('0x18')](_0x2730e2);}return _0x56ce97[_0xdcbc('0x19')](_0x2730e2)[_0xdcbc('0x1a')]();};}function respondWithResult(_0x281434,_0x522f6d){_0x522f6d=_0x522f6d||0xc8;return function(_0x512ac5){if(_0x512ac5){return _0x281434[_0xdcbc('0x19')](_0x522f6d)[_0xdcbc('0x1b')](_0x512ac5);}};}function respondWithFilteredResult(_0xfea6c,_0x322596){return function(_0x2c4be4){if(_0x2c4be4){var _0x258b1f=typeof _0x322596[_0xdcbc('0x1c')]===_0xdcbc('0x1d')&&typeof _0x322596[_0xdcbc('0x1e')]===_0xdcbc('0x1d');var _0x4e8efb=_0x2c4be4[_0xdcbc('0x1f')];var _0x1cc97c=_0x258b1f?0x0:_0x322596[_0xdcbc('0x1c')];var _0x26940f=_0x258b1f?_0x2c4be4['count']:_0x322596['offset']+_0x322596[_0xdcbc('0x1e')];var _0x2ba435;if(_0x26940f>=_0x4e8efb){_0x26940f=_0x4e8efb;_0x2ba435=0xc8;}else{_0x2ba435=0xce;}_0xfea6c[_0xdcbc('0x19')](_0x2ba435);return _0xfea6c[_0xdcbc('0x20')](_0xdcbc('0x21'),_0x1cc97c+'-'+_0x26940f+'/'+_0x4e8efb)[_0xdcbc('0x1b')](_0x2c4be4);}return null;};}function patchUpdates(_0x44eb4c){return function(_0x168e81){try{jsonpatch[_0xdcbc('0x22')](_0x168e81,_0x44eb4c,!![]);}catch(_0x3f0b7e){return BPromise[_0xdcbc('0x23')](_0x3f0b7e);}return _0x168e81['save']();};}function saveUpdates(_0x575443,_0x1668c5){return function(_0x165acb){if(_0x165acb){return _0x165acb[_0xdcbc('0x24')](_0x575443)[_0xdcbc('0x25')](function(_0x5e1a3f){return _0x5e1a3f;});}return null;};}function removeEntity(_0x388e52,_0x3ebc41){return function(_0x289bff){if(_0x289bff){return _0x289bff[_0xdcbc('0x26')]()[_0xdcbc('0x25')](function(){var _0x5d2634=_0x289bff[_0xdcbc('0x27')]({'plain':!![]});var _0x20d21c=_0xdcbc('0x28');return db[_0xdcbc('0x29')][_0xdcbc('0x26')]({'where':{'type':_0x20d21c,'resourceId':_0x5d2634['id']}})['then'](function(){return _0x289bff;});})[_0xdcbc('0x25')](function(){_0x388e52['status'](0xcc)[_0xdcbc('0x1a')]();});}};}function handleEntityNotFound(_0x3c1889,_0x33c3d9){return function(_0x3cd993){if(!_0x3cd993){_0x3c1889[_0xdcbc('0x18')](0x194);}return _0x3cd993;};}function handleError(_0x50b355,_0x2dfed8){_0x2dfed8=_0x2dfed8||0x1f4;return function(_0x2bdbec){logger[_0xdcbc('0x2a')](_0x2bdbec['stack']);if(_0x2bdbec[_0xdcbc('0x2b')]){delete _0x2bdbec[_0xdcbc('0x2b')];}_0x50b355[_0xdcbc('0x19')](_0x2dfed8)[_0xdcbc('0x2c')](_0x2bdbec);};}exports[_0xdcbc('0x2d')]=function(_0x170fdd,_0x4adf9a){var _0x59bb5b={},_0x27a68e={},_0x403532={'count':0x0,'rows':[]};var _0xd4643e=_[_0xdcbc('0x2e')](db['Campaign'][_0xdcbc('0x2f')],function(_0x4a2c11){return{'name':_0x4a2c11['fieldName'],'type':_0x4a2c11[_0xdcbc('0x30')][_0xdcbc('0x31')]};});_0x27a68e['model']=_[_0xdcbc('0x2e')](_0xd4643e,_0xdcbc('0x2b'));_0x27a68e[_0xdcbc('0x32')]=_[_0xdcbc('0x33')](_0x170fdd['query']);_0x27a68e[_0xdcbc('0x34')]=_[_0xdcbc('0x35')](_0x27a68e['model'],_0x27a68e['query']);_0x59bb5b[_0xdcbc('0x36')]=_[_0xdcbc('0x35')](_0x27a68e[_0xdcbc('0x37')],qs[_0xdcbc('0x38')](_0x170fdd[_0xdcbc('0x32')][_0xdcbc('0x38')]));_0x59bb5b[_0xdcbc('0x36')]=_0x59bb5b[_0xdcbc('0x36')][_0xdcbc('0x39')]?_0x59bb5b[_0xdcbc('0x36')]:_0x27a68e[_0xdcbc('0x37')];if(!_0x170fdd[_0xdcbc('0x32')]['hasOwnProperty'](_0xdcbc('0x3a'))){_0x59bb5b[_0xdcbc('0x1e')]=qs[_0xdcbc('0x1e')](_0x170fdd[_0xdcbc('0x32')][_0xdcbc('0x1e')]);_0x59bb5b[_0xdcbc('0x1c')]=qs[_0xdcbc('0x1c')](_0x170fdd[_0xdcbc('0x32')][_0xdcbc('0x1c')]);}_0x59bb5b[_0xdcbc('0x3b')]=qs['sort'](_0x170fdd[_0xdcbc('0x32')][_0xdcbc('0x3c')]);_0x59bb5b[_0xdcbc('0x3d')]=qs[_0xdcbc('0x34')](_[_0xdcbc('0x3e')](_0x170fdd[_0xdcbc('0x32')],_0x27a68e[_0xdcbc('0x34')]),_0xd4643e);if(_0x170fdd[_0xdcbc('0x32')]['filter']){_0x59bb5b['where']=_[_0xdcbc('0x3f')](_0x59bb5b[_0xdcbc('0x3d')],{'$or':_[_0xdcbc('0x2e')](_0xd4643e,function(_0x1335d9){if(_0x1335d9[_0xdcbc('0x30')]!==_0xdcbc('0x40')){var _0x5b6850={};_0x5b6850[_0x1335d9['name']]={'$like':'%'+_0x170fdd[_0xdcbc('0x32')][_0xdcbc('0x41')]+'%'};return _0x5b6850;}})});}_0x59bb5b=_[_0xdcbc('0x3f')]({},_0x59bb5b,_0x170fdd[_0xdcbc('0x42')]);var _0x4e4627={'where':_0x59bb5b['where']};return db[_0xdcbc('0x43')][_0xdcbc('0x1f')](_0x4e4627)['then'](function(_0x547c03){_0x403532[_0xdcbc('0x1f')]=_0x547c03;if(_0x170fdd[_0xdcbc('0x32')][_0xdcbc('0x44')]){_0x59bb5b[_0xdcbc('0x45')]=[{'all':!![]}];}return db[_0xdcbc('0x43')][_0xdcbc('0x46')](_0x59bb5b);})['then'](function(_0x32ea4d){_0x403532['rows']=_0x32ea4d;return _0x403532;})['then'](respondWithFilteredResult(_0x4adf9a,_0x59bb5b))['catch'](handleError(_0x4adf9a,null));};exports[_0xdcbc('0x47')]=function(_0xc6252c,_0x50592c){var _0x4cd939={'raw':![],'where':{'id':_0xc6252c[_0xdcbc('0x48')]['id']}},_0xc129b={};_0xc129b['model']=_['keys'](db[_0xdcbc('0x43')][_0xdcbc('0x2f')]);_0xc129b['query']=_[_0xdcbc('0x33')](_0xc6252c[_0xdcbc('0x32')]);_0xc129b[_0xdcbc('0x34')]=_[_0xdcbc('0x35')](_0xc129b[_0xdcbc('0x37')],_0xc129b[_0xdcbc('0x32')]);_0x4cd939[_0xdcbc('0x36')]=_['intersection'](_0xc129b['model'],qs[_0xdcbc('0x38')](_0xc6252c[_0xdcbc('0x32')]['fields']));_0x4cd939[_0xdcbc('0x36')]=_0x4cd939[_0xdcbc('0x36')][_0xdcbc('0x39')]?_0x4cd939[_0xdcbc('0x36')]:_0xc129b[_0xdcbc('0x37')];if(_0xc6252c[_0xdcbc('0x32')]['includeAll']){_0x4cd939[_0xdcbc('0x45')]=[{'all':!![]}];}_0x4cd939=_[_0xdcbc('0x3f')]({},_0x4cd939,_0xc6252c[_0xdcbc('0x42')]);return db[_0xdcbc('0x43')][_0xdcbc('0x49')](_0x4cd939)['then'](handleEntityNotFound(_0x50592c,null))[_0xdcbc('0x25')](respondWithResult(_0x50592c,null))['catch'](handleError(_0x50592c,null));};exports['create']=function(_0xe56adb,_0x3ceb23){return db[_0xdcbc('0x43')][_0xdcbc('0x4a')](_0xe56adb[_0xdcbc('0x4b')],{})[_0xdcbc('0x25')](function(_0x3f1e60){var _0x2aa6f0=_0xe56adb[_0xdcbc('0x4c')]['get']({'plain':!![]});if(!_0x2aa6f0)throw new Error(_0xdcbc('0x4d'));if(_0x2aa6f0[_0xdcbc('0x4e')]===_0xdcbc('0x4c')){var _0xa8ae64=_0x3f1e60[_0xdcbc('0x27')]({'plain':!![]});var _0x3a268c=_0xdcbc('0x28');return db[_0xdcbc('0x4f')]['find']({'where':{'name':_0x3a268c,'userProfileId':_0x2aa6f0[_0xdcbc('0x50')]},'raw':!![]})[_0xdcbc('0x25')](function(_0x437d8a){if(_0x437d8a&&_0x437d8a[_0xdcbc('0x51')]===0x0){return db[_0xdcbc('0x29')]['create']({'name':_0xa8ae64[_0xdcbc('0x2b')],'resourceId':_0xa8ae64['id'],'type':_0x437d8a[_0xdcbc('0x2b')],'sectionId':_0x437d8a['id']},{})[_0xdcbc('0x25')](function(){return _0x3f1e60;});}else{return _0x3f1e60;}})[_0xdcbc('0x52')](function(_0x2d7af4){logger['error'](_0xdcbc('0x53'),_0x2d7af4);throw _0x2d7af4;});}return _0x3f1e60;})[_0xdcbc('0x25')](respondWithResult(_0x3ceb23,0xc9))[_0xdcbc('0x52')](handleError(_0x3ceb23,null));};exports[_0xdcbc('0x54')]=function(_0x305462,_0x73ba08){var _0x51c028={'where':{'id':_0x305462[_0xdcbc('0x48')]['id']}},_0x104fa8={};_0x104fa8[_0xdcbc('0x37')]=_[_0xdcbc('0x33')](db[_0xdcbc('0x43')][_0xdcbc('0x2f')]);_0x51c028['attributes']=_[_0xdcbc('0x35')](_0x104fa8[_0xdcbc('0x37')],qs[_0xdcbc('0x38')](_0x305462[_0xdcbc('0x32')][_0xdcbc('0x38')]));_0x51c028[_0xdcbc('0x36')]=_0x51c028['attributes'][_0xdcbc('0x39')]?_0x51c028[_0xdcbc('0x36')]:_0x104fa8[_0xdcbc('0x37')];if(_0x305462[_0xdcbc('0x32')]['includeAll']){_0x51c028[_0xdcbc('0x45')]=[{'all':!![]}];}_0x51c028=_['merge']({},_0x51c028,_0x305462[_0xdcbc('0x42')]);return db[_0xdcbc('0x43')][_0xdcbc('0x49')](_0x51c028)['then'](handleEntityNotFound(_0x73ba08,null))[_0xdcbc('0x25')](function(_0x9721d6){if(_0x9721d6){var _0x13c790=_0x9721d6[_0xdcbc('0x27')]({'plain':!![]});_0x13c790=qs['omit'](_0x13c790,['id','createdAt',_0xdcbc('0x55')]);_0x305462['body']=_[_0xdcbc('0x56')](_0x305462['body'],['id',_0xdcbc('0x57'),'updatedAt']);return db[_0xdcbc('0x43')]['create'](_[_0xdcbc('0x3f')](_0x13c790,_0x305462[_0xdcbc('0x4b')]),{'include':_0x305462['query']['includeAll']?[{'all':!![]}]:undefined})[_0xdcbc('0x25')](function(_0x6c7fca){var _0x20fefb=_0x305462[_0xdcbc('0x4c')][_0xdcbc('0x27')]({'plain':!![]});if(!_0x20fefb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20fefb['role']==='user'){var _0x5c1eab=_0x6c7fca[_0xdcbc('0x27')]({'plain':!![]});var _0x376bcf=_0xdcbc('0x28');return db[_0xdcbc('0x4f')][_0xdcbc('0x49')]({'where':{'name':_0x376bcf,'userProfileId':_0x20fefb['userProfileId']},'raw':!![]})[_0xdcbc('0x25')](function(_0x3eaa6c){if(_0x3eaa6c&&_0x3eaa6c[_0xdcbc('0x51')]===0x0){return db[_0xdcbc('0x29')]['create']({'name':_0x5c1eab[_0xdcbc('0x2b')],'resourceId':_0x5c1eab['id'],'type':_0x3eaa6c[_0xdcbc('0x2b')],'sectionId':_0x3eaa6c['id']},{})['then'](function(){return _0x6c7fca;});}else{return _0x6c7fca;}})[_0xdcbc('0x52')](function(_0x308f83){logger[_0xdcbc('0x2a')](_0xdcbc('0x53'),_0x308f83);throw _0x308f83;});}return _0x6c7fca;});}})['then'](respondWithResult(_0x73ba08,0xc9))['catch'](handleError(_0x73ba08,null));};exports[_0xdcbc('0x24')]=function(_0x434e30,_0x5d5a17){if(_0x434e30[_0xdcbc('0x4b')]['id']){delete _0x434e30[_0xdcbc('0x4b')]['id'];}return db['Campaign'][_0xdcbc('0x49')]({'where':{'id':_0x434e30['params']['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x5d5a17,null))[_0xdcbc('0x25')](saveUpdates(_0x434e30[_0xdcbc('0x4b')],null))['then'](respondWithResult(_0x5d5a17,null))[_0xdcbc('0x52')](handleError(_0x5d5a17,null));};exports[_0xdcbc('0x26')]=function(_0x2d11e4,_0x4aac97){return db[_0xdcbc('0x43')]['find']({'where':{'id':_0x2d11e4[_0xdcbc('0x48')]['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x4aac97,null))[_0xdcbc('0x25')](removeEntity(_0x4aac97,null))[_0xdcbc('0x52')](handleError(_0x4aac97,null));};exports[_0xdcbc('0x58')]=function(_0x65ed54,_0x440a2c,_0xf858d4){var _0x2f407b={'raw':!![],'where':{}};var _0x384378={};var _0x34527c={'count':0x0,'rows':[]};return db[_0xdcbc('0x43')]['findOne']({'where':{'id':_0x65ed54[_0xdcbc('0x48')]['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x440a2c,null))[_0xdcbc('0x25')](function(_0x3b15c7){if(_0x3b15c7){_0x384378['model']=_[_0xdcbc('0x33')](db[_0xdcbc('0x59')]['rawAttributes']);_0x384378['query']=_[_0xdcbc('0x33')](_0x65ed54[_0xdcbc('0x32')]);_0x384378[_0xdcbc('0x34')]=_[_0xdcbc('0x35')](_0x384378[_0xdcbc('0x37')],_0x384378[_0xdcbc('0x32')]);_0x2f407b[_0xdcbc('0x36')]=_[_0xdcbc('0x35')](_0x384378[_0xdcbc('0x37')],qs[_0xdcbc('0x38')](_0x65ed54[_0xdcbc('0x32')]['fields']));_0x2f407b['attributes']=_0x2f407b[_0xdcbc('0x36')][_0xdcbc('0x39')]?_0x2f407b[_0xdcbc('0x36')]:_0x384378[_0xdcbc('0x37')];if(!_0x65ed54['query'][_0xdcbc('0x5a')](_0xdcbc('0x3a'))){_0x2f407b[_0xdcbc('0x1e')]=qs[_0xdcbc('0x1e')](_0x65ed54[_0xdcbc('0x32')][_0xdcbc('0x1e')]);_0x2f407b[_0xdcbc('0x1c')]=qs[_0xdcbc('0x1c')](_0x65ed54[_0xdcbc('0x32')][_0xdcbc('0x1c')]);}_0x2f407b[_0xdcbc('0x3b')]=qs['sort'](_0x65ed54[_0xdcbc('0x32')]['sort']);_0x2f407b[_0xdcbc('0x3d')]=qs['filters'](_['pick'](_0x65ed54[_0xdcbc('0x32')],_0x384378['filters']));_0x2f407b[_0xdcbc('0x3d')][_0xdcbc('0x5b')]=_0x3b15c7['id'];if(_0x65ed54[_0xdcbc('0x32')][_0xdcbc('0x41')]){_0x2f407b[_0xdcbc('0x3d')]=_[_0xdcbc('0x3f')](_0x2f407b[_0xdcbc('0x3d')],{'$or':_[_0xdcbc('0x2e')](_0x2f407b[_0xdcbc('0x36')],function(_0x1c7401){var _0x30f616={};_0x30f616[_0x1c7401]={'$like':'%'+_0x65ed54['query'][_0xdcbc('0x41')]+'%'};return _0x30f616;})});}_0x2f407b=_[_0xdcbc('0x3f')]({},_0x2f407b,_0x65ed54['options']);return db[_0xdcbc('0x59')][_0xdcbc('0x1f')]({'where':_0x2f407b[_0xdcbc('0x3d')]})[_0xdcbc('0x25')](function(_0x36337e){_0x34527c[_0xdcbc('0x1f')]=_0x36337e;if(_0x65ed54[_0xdcbc('0x32')][_0xdcbc('0x44')]){_0x2f407b[_0xdcbc('0x45')]=[{'all':!![]}];}return db['CmHopper'][_0xdcbc('0x46')](_0x2f407b);})['then'](function(_0x54e980){_0x34527c[_0xdcbc('0x5c')]=_0x54e980;return _0x34527c;});}})[_0xdcbc('0x25')](respondWithFilteredResult(_0x440a2c,_0x2f407b))[_0xdcbc('0x52')](handleError(_0x440a2c,null));};exports['getHopperHistories']=function(_0x5e3cb3,_0x1bbeef,_0x3eecee){var _0x38a08b={'raw':!![],'where':{}};var _0x254945={};var _0x25c976={'count':0x0,'rows':[]};return db[_0xdcbc('0x43')][_0xdcbc('0x5d')]({'where':{'id':_0x5e3cb3[_0xdcbc('0x48')]['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x1bbeef,null))[_0xdcbc('0x25')](function(_0x53b62b){if(_0x53b62b){_0x254945[_0xdcbc('0x37')]=_[_0xdcbc('0x33')](db[_0xdcbc('0x5e')][_0xdcbc('0x2f')]);_0x254945[_0xdcbc('0x32')]=_['keys'](_0x5e3cb3[_0xdcbc('0x32')]);_0x254945[_0xdcbc('0x34')]=_[_0xdcbc('0x35')](_0x254945['model'],_0x254945[_0xdcbc('0x32')]);_0x38a08b[_0xdcbc('0x36')]=_['intersection'](_0x254945[_0xdcbc('0x37')],qs[_0xdcbc('0x38')](_0x5e3cb3[_0xdcbc('0x32')]['fields']));_0x38a08b[_0xdcbc('0x36')]=_0x38a08b[_0xdcbc('0x36')][_0xdcbc('0x39')]?_0x38a08b[_0xdcbc('0x36')]:_0x254945['model'];if(!_0x5e3cb3[_0xdcbc('0x32')][_0xdcbc('0x5a')](_0xdcbc('0x3a'))){_0x38a08b[_0xdcbc('0x1e')]=qs['limit'](_0x5e3cb3[_0xdcbc('0x32')][_0xdcbc('0x1e')]);_0x38a08b['offset']=qs['offset'](_0x5e3cb3[_0xdcbc('0x32')]['offset']);}_0x38a08b[_0xdcbc('0x3b')]=qs[_0xdcbc('0x3c')](_0x5e3cb3[_0xdcbc('0x32')]['sort']);_0x38a08b[_0xdcbc('0x3d')]=qs[_0xdcbc('0x34')](_[_0xdcbc('0x3e')](_0x5e3cb3[_0xdcbc('0x32')],_0x254945[_0xdcbc('0x34')]));_0x38a08b[_0xdcbc('0x3d')][_0xdcbc('0x5b')]=_0x53b62b['id'];if(_0x5e3cb3['query'][_0xdcbc('0x41')]){_0x38a08b[_0xdcbc('0x3d')]=_[_0xdcbc('0x3f')](_0x38a08b[_0xdcbc('0x3d')],{'$or':_[_0xdcbc('0x2e')](_0x38a08b[_0xdcbc('0x36')],function(_0x3865d4){var _0x42ebb4={};_0x42ebb4[_0x3865d4]={'$like':'%'+_0x5e3cb3['query'][_0xdcbc('0x41')]+'%'};return _0x42ebb4;})});}_0x38a08b=_[_0xdcbc('0x3f')]({},_0x38a08b,_0x5e3cb3['options']);return db['CmHopperHistory'][_0xdcbc('0x1f')]({'where':_0x38a08b['where']})[_0xdcbc('0x25')](function(_0x3acf17){_0x25c976[_0xdcbc('0x1f')]=_0x3acf17;if(_0x5e3cb3['query'][_0xdcbc('0x44')]){_0x38a08b['include']=[{'all':!![]}];}return db[_0xdcbc('0x5e')][_0xdcbc('0x46')](_0x38a08b);})['then'](function(_0x11a9e6){_0x25c976['rows']=_0x11a9e6;return _0x25c976;});}})[_0xdcbc('0x25')](respondWithFilteredResult(_0x1bbeef,_0x38a08b))['catch'](handleError(_0x1bbeef,null));};exports['getHopperFinals']=function(_0x321950,_0x232a69,_0xe4201){var _0x394da6={'raw':!![],'where':{}};var _0x49d306={};var _0x31abae={'count':0x0,'rows':[]};return db['Campaign'][_0xdcbc('0x5d')]({'where':{'id':_0x321950[_0xdcbc('0x48')]['id']}})['then'](handleEntityNotFound(_0x232a69,null))[_0xdcbc('0x25')](function(_0x486e5a){if(_0x486e5a){_0x49d306['model']=_['keys'](db[_0xdcbc('0x5f')][_0xdcbc('0x2f')]);_0x49d306['query']=_[_0xdcbc('0x33')](_0x321950['query']);_0x49d306[_0xdcbc('0x34')]=_['intersection'](_0x49d306[_0xdcbc('0x37')],_0x49d306['query']);_0x394da6[_0xdcbc('0x36')]=_[_0xdcbc('0x35')](_0x49d306[_0xdcbc('0x37')],qs[_0xdcbc('0x38')](_0x321950[_0xdcbc('0x32')][_0xdcbc('0x38')]));_0x394da6[_0xdcbc('0x36')]=_0x394da6[_0xdcbc('0x36')]['length']?_0x394da6[_0xdcbc('0x36')]:_0x49d306[_0xdcbc('0x37')];if(!_0x321950[_0xdcbc('0x32')][_0xdcbc('0x5a')]('nolimit')){_0x394da6[_0xdcbc('0x1e')]=qs[_0xdcbc('0x1e')](_0x321950[_0xdcbc('0x32')][_0xdcbc('0x1e')]);_0x394da6[_0xdcbc('0x1c')]=qs[_0xdcbc('0x1c')](_0x321950['query'][_0xdcbc('0x1c')]);}_0x394da6[_0xdcbc('0x3b')]=qs[_0xdcbc('0x3c')](_0x321950['query'][_0xdcbc('0x3c')]);_0x394da6['where']=qs[_0xdcbc('0x34')](_[_0xdcbc('0x3e')](_0x321950[_0xdcbc('0x32')],_0x49d306[_0xdcbc('0x34')]));_0x394da6[_0xdcbc('0x3d')][_0xdcbc('0x5b')]=_0x486e5a['id'];if(_0x321950['query'][_0xdcbc('0x41')]){_0x394da6['where']=_['merge'](_0x394da6['where'],{'$or':_['map'](_0x394da6[_0xdcbc('0x36')],function(_0x32935a){var _0x31fb1f={};_0x31fb1f[_0x32935a]={'$like':'%'+_0x321950['query'][_0xdcbc('0x41')]+'%'};return _0x31fb1f;})});}_0x394da6=_[_0xdcbc('0x3f')]({},_0x394da6,_0x321950[_0xdcbc('0x42')]);return db[_0xdcbc('0x5f')][_0xdcbc('0x1f')]({'where':_0x394da6[_0xdcbc('0x3d')]})['then'](function(_0x476db7){_0x31abae[_0xdcbc('0x1f')]=_0x476db7;if(_0x321950[_0xdcbc('0x32')][_0xdcbc('0x44')]){_0x394da6[_0xdcbc('0x45')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xdcbc('0x46')](_0x394da6);})[_0xdcbc('0x25')](function(_0x2225af){_0x31abae[_0xdcbc('0x5c')]=_0x2225af;return _0x31abae;});}})[_0xdcbc('0x25')](respondWithFilteredResult(_0x232a69,_0x394da6))[_0xdcbc('0x52')](handleError(_0x232a69,null));};exports['getHopperBlacks']=function(_0x30243d,_0x5031f1,_0x13a0fa){var _0x583782={'raw':!![],'where':{}};var _0x11f950={};var _0x2bf08d={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x30243d[_0xdcbc('0x48')]['id']}})['then'](handleEntityNotFound(_0x5031f1,null))['then'](function(_0x39ef55){if(_0x39ef55){_0x11f950[_0xdcbc('0x37')]=_[_0xdcbc('0x33')](db[_0xdcbc('0x60')][_0xdcbc('0x2f')]);_0x11f950[_0xdcbc('0x32')]=_[_0xdcbc('0x33')](_0x30243d[_0xdcbc('0x32')]);_0x11f950[_0xdcbc('0x34')]=_[_0xdcbc('0x35')](_0x11f950[_0xdcbc('0x37')],_0x11f950[_0xdcbc('0x32')]);_0x583782[_0xdcbc('0x36')]=_[_0xdcbc('0x35')](_0x11f950[_0xdcbc('0x37')],qs[_0xdcbc('0x38')](_0x30243d[_0xdcbc('0x32')]['fields']));_0x583782[_0xdcbc('0x36')]=_0x583782[_0xdcbc('0x36')]['length']?_0x583782['attributes']:_0x11f950[_0xdcbc('0x37')];if(!_0x30243d['query'][_0xdcbc('0x5a')](_0xdcbc('0x3a'))){_0x583782[_0xdcbc('0x1e')]=qs[_0xdcbc('0x1e')](_0x30243d[_0xdcbc('0x32')][_0xdcbc('0x1e')]);_0x583782[_0xdcbc('0x1c')]=qs[_0xdcbc('0x1c')](_0x30243d[_0xdcbc('0x32')][_0xdcbc('0x1c')]);}_0x583782[_0xdcbc('0x3b')]=qs['sort'](_0x30243d[_0xdcbc('0x32')][_0xdcbc('0x3c')]);_0x583782[_0xdcbc('0x3d')]=qs[_0xdcbc('0x34')](_[_0xdcbc('0x3e')](_0x30243d[_0xdcbc('0x32')],_0x11f950[_0xdcbc('0x34')]));_0x583782[_0xdcbc('0x3d')][_0xdcbc('0x5b')]=_0x39ef55['id'];if(_0x30243d['query']['filter']){_0x583782[_0xdcbc('0x3d')]=_[_0xdcbc('0x3f')](_0x583782[_0xdcbc('0x3d')],{'$or':_[_0xdcbc('0x2e')](_0x583782[_0xdcbc('0x36')],function(_0x25dcd1){var _0x200dde={};_0x200dde[_0x25dcd1]={'$like':'%'+_0x30243d[_0xdcbc('0x32')]['filter']+'%'};return _0x200dde;})});}_0x583782=_[_0xdcbc('0x3f')]({},_0x583782,_0x30243d[_0xdcbc('0x42')]);return db[_0xdcbc('0x60')][_0xdcbc('0x1f')]({'where':_0x583782[_0xdcbc('0x3d')]})[_0xdcbc('0x25')](function(_0x52ab7e){_0x2bf08d[_0xdcbc('0x1f')]=_0x52ab7e;if(_0x30243d[_0xdcbc('0x32')][_0xdcbc('0x44')]){_0x583782[_0xdcbc('0x45')]=[{'all':!![]}];}return db[_0xdcbc('0x60')][_0xdcbc('0x46')](_0x583782);})[_0xdcbc('0x25')](function(_0x2bdf96){_0x2bf08d[_0xdcbc('0x5c')]=_0x2bdf96;return _0x2bf08d;});}})[_0xdcbc('0x25')](respondWithFilteredResult(_0x5031f1,_0x583782))[_0xdcbc('0x52')](handleError(_0x5031f1,null));};exports[_0xdcbc('0x61')]=function(_0x4c80ba,_0x2bdcde,_0x1a055d){var _0x583ae5={};var _0x2fd432={};var _0x42e5ad;var _0x3c1e90;return db[_0xdcbc('0x43')][_0xdcbc('0x5d')]({'where':{'id':_0x4c80ba[_0xdcbc('0x48')]['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x2bdcde,null))[_0xdcbc('0x25')](function(_0x348d0a){if(_0x348d0a){_0x42e5ad=_0x348d0a;_0x2fd432['model']=_['keys'](db['CmList'][_0xdcbc('0x2f')]);_0x2fd432[_0xdcbc('0x32')]=_['keys'](_0x4c80ba[_0xdcbc('0x32')]);_0x2fd432[_0xdcbc('0x34')]=_[_0xdcbc('0x35')](_0x2fd432[_0xdcbc('0x37')],_0x2fd432[_0xdcbc('0x32')]);_0x583ae5[_0xdcbc('0x36')]=_[_0xdcbc('0x35')](_0x2fd432['model'],qs[_0xdcbc('0x38')](_0x4c80ba[_0xdcbc('0x32')][_0xdcbc('0x38')]));_0x583ae5[_0xdcbc('0x36')]=_0x583ae5['attributes'][_0xdcbc('0x39')]?_0x583ae5[_0xdcbc('0x36')]:_0x2fd432['model'];_0x583ae5[_0xdcbc('0x3b')]=qs[_0xdcbc('0x3c')](_0x4c80ba[_0xdcbc('0x32')][_0xdcbc('0x3c')]);_0x583ae5[_0xdcbc('0x3d')]=qs[_0xdcbc('0x34')](_[_0xdcbc('0x3e')](_0x4c80ba[_0xdcbc('0x32')],_0x2fd432[_0xdcbc('0x34')]));if(_0x4c80ba[_0xdcbc('0x32')][_0xdcbc('0x41')]){_0x583ae5['where']=_['merge'](_0x583ae5['where'],{'$or':_['map'](_0x583ae5[_0xdcbc('0x36')],function(_0x435cb1){var _0x1a6740={};_0x1a6740[_0x435cb1]={'$like':'%'+_0x4c80ba[_0xdcbc('0x32')][_0xdcbc('0x41')]+'%'};return _0x1a6740;})});}_0x583ae5=_[_0xdcbc('0x3f')]({},_0x583ae5,_0x4c80ba[_0xdcbc('0x42')]);return _0x42e5ad[_0xdcbc('0x61')](_0x583ae5);}})['then'](function(_0x197bb1){if(_0x197bb1){_0x3c1e90=_0x197bb1[_0xdcbc('0x39')];if(!_0x4c80ba[_0xdcbc('0x32')][_0xdcbc('0x5a')](_0xdcbc('0x3a'))){_0x583ae5[_0xdcbc('0x1e')]=qs[_0xdcbc('0x1e')](_0x4c80ba[_0xdcbc('0x32')][_0xdcbc('0x1e')]);_0x583ae5['offset']=qs['offset'](_0x4c80ba['query'][_0xdcbc('0x1c')]);}return _0x42e5ad[_0xdcbc('0x61')](_0x583ae5);}})[_0xdcbc('0x25')](function(_0x52e25f){if(_0x52e25f){return _0x52e25f?{'count':_0x3c1e90,'rows':_0x52e25f}:null;}})[_0xdcbc('0x25')](respondWithResult(_0x2bdcde,null))[_0xdcbc('0x52')](handleError(_0x2bdcde,null));};exports[_0xdcbc('0x62')]=function(_0x3ec13b,_0x16fff8,_0x5f2584){var _0x3c6cef,_0x4b2f78;return db[_0xdcbc('0x43')]['find']({'where':{'id':_0x3ec13b[_0xdcbc('0x48')]['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x16fff8,null))['then'](function(_0x15235f){if(_0x15235f){_0x4b2f78=_0x15235f;return _0x15235f[_0xdcbc('0x62')](_0x3ec13b[_0xdcbc('0x4b')][_0xdcbc('0x63')],_[_0xdcbc('0x56')](_0x3ec13b[_0xdcbc('0x4b')],[_0xdcbc('0x63'),'id'])||{});}return null;})['spread'](function(_0x39de01){var _0x1bd124;_0x3c6cef=_0x39de01||[];var _0x5c1150=[];if(_0x39de01){for(var _0x188f8c=0x0;_0x188f8c<_0x39de01[_0xdcbc('0x39')];_0x188f8c+=0x1){var _0x353faf=_0x39de01[_0x188f8c][_0xdcbc('0x27')]({'plain':!![]});_0x4b2f78['dialCheckDuplicateType']=_0x3ec13b['body'][_0xdcbc('0x64')]?_0x3ec13b['body']['dialCheckDuplicateType']:_0x4b2f78[_0xdcbc('0x64')];switch(_0x4b2f78[_0xdcbc('0x64')]){case _0xdcbc('0x65'):_0x1bd124=squel[_0xdcbc('0x66')]()[_0xdcbc('0x67')](_0xdcbc('0x68'))['fromQuery']([_0xdcbc('0x69'),'scheduledAt',_0xdcbc('0x6a'),'ListId',_0xdcbc('0x5b'),'createdAt','updatedAt'],squel[_0xdcbc('0x6b')]()[_0xdcbc('0x6c')](_0xdcbc('0x69'),_0xdcbc('0x69'))[_0xdcbc('0x6c')](_0xdcbc('0x6d'),_0xdcbc('0x6e'))[_0xdcbc('0x6c')]('id','ContactId')[_0xdcbc('0x6c')](_0x353faf[_0xdcbc('0x6f')][_0xdcbc('0x70')](),_0xdcbc('0x71'))[_0xdcbc('0x6c')](_0x3ec13b['params']['id'][_0xdcbc('0x70')](),_0xdcbc('0x5b'))[_0xdcbc('0x6c')]('NOW()',_0xdcbc('0x57'))[_0xdcbc('0x6c')]('NOW()',_0xdcbc('0x55'))[_0xdcbc('0x72')]('cm_contacts')[_0xdcbc('0x3d')]('deletedAt\x20IS\x20NULL')['where'](_0xdcbc('0x73'),_0x353faf[_0xdcbc('0x6f')]['toString']())[_0xdcbc('0x3d')](_0xdcbc('0x74'))['where'](_0xdcbc('0x75'),squel[_0xdcbc('0x6b')]()[_0xdcbc('0x6c')]('COALESCE(calleridnum,\x27\x27)')[_0xdcbc('0x72')](_0xdcbc('0x76'))[_0xdcbc('0x3d')](_0xdcbc('0x77'),_0x3ec13b[_0xdcbc('0x48')]['id'][_0xdcbc('0x70')]()))[_0xdcbc('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0xdcbc('0x6b')]()[_0xdcbc('0x6c')](_0xdcbc('0x78'))[_0xdcbc('0x72')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0x3ec13b[_0xdcbc('0x48')]['id'][_0xdcbc('0x70')]())))[_0xdcbc('0x70')]();break;case _0xdcbc('0x79'):_0x1bd124=squel[_0xdcbc('0x66')]()['into'](_0xdcbc('0x68'))[_0xdcbc('0x7a')]([_0xdcbc('0x69'),_0xdcbc('0x6e'),_0xdcbc('0x6a'),_0xdcbc('0x71'),_0xdcbc('0x5b'),_0xdcbc('0x57'),'updatedAt'],squel[_0xdcbc('0x6b')]()[_0xdcbc('0x6c')](_0xdcbc('0x69'),'phone')[_0xdcbc('0x6c')](_0xdcbc('0x6d'),_0xdcbc('0x6e'))[_0xdcbc('0x6c')]('id','ContactId')[_0xdcbc('0x6c')](_0x353faf[_0xdcbc('0x6f')][_0xdcbc('0x70')](),_0xdcbc('0x71'))[_0xdcbc('0x6c')](_0x3ec13b[_0xdcbc('0x48')]['id'][_0xdcbc('0x70')](),_0xdcbc('0x5b'))[_0xdcbc('0x6c')](_0xdcbc('0x6d'),_0xdcbc('0x57'))[_0xdcbc('0x6c')]('NOW()',_0xdcbc('0x55'))[_0xdcbc('0x72')](_0xdcbc('0x7b'))[_0xdcbc('0x3d')](_0xdcbc('0x7c'))[_0xdcbc('0x3d')](_0xdcbc('0x73'),_0x353faf[_0xdcbc('0x6f')][_0xdcbc('0x70')]())[_0xdcbc('0x3d')](_0xdcbc('0x74'))['where'](_0xdcbc('0x75'),squel[_0xdcbc('0x6b')]()['field'](_0xdcbc('0x78'))[_0xdcbc('0x72')](_0xdcbc('0x68'))[_0xdcbc('0x3d')](_0xdcbc('0x77'),_0x3ec13b['params']['id'][_0xdcbc('0x70')]())))[_0xdcbc('0x70')]();break;default:_0x1bd124=squel[_0xdcbc('0x66')]()[_0xdcbc('0x67')](_0xdcbc('0x68'))['fromQuery']([_0xdcbc('0x69'),_0xdcbc('0x6e'),'ContactId',_0xdcbc('0x71'),'CampaignId',_0xdcbc('0x57'),'updatedAt'],squel[_0xdcbc('0x6b')]()[_0xdcbc('0x6c')](_0xdcbc('0x69'),_0xdcbc('0x69'))[_0xdcbc('0x6c')](_0xdcbc('0x6d'),_0xdcbc('0x6e'))[_0xdcbc('0x6c')]('id','ContactId')[_0xdcbc('0x6c')](_0x353faf['CmListId']['toString'](),_0xdcbc('0x71'))[_0xdcbc('0x6c')](_0x3ec13b[_0xdcbc('0x48')]['id'][_0xdcbc('0x70')](),_0xdcbc('0x5b'))[_0xdcbc('0x6c')]('NOW()',_0xdcbc('0x57'))[_0xdcbc('0x6c')]('NOW()',_0xdcbc('0x55'))['from'](_0xdcbc('0x7b'))[_0xdcbc('0x3d')](_0xdcbc('0x7c'))[_0xdcbc('0x3d')](_0xdcbc('0x73'),_0x353faf[_0xdcbc('0x6f')][_0xdcbc('0x70')]())['where'](_0xdcbc('0x74')))[_0xdcbc('0x70')]();}_0x5c1150[_0xdcbc('0x7d')](db[_0xdcbc('0x7e')][_0xdcbc('0x32')](_0x1bd124));}return BPromise['all'](_0x5c1150);}})[_0xdcbc('0x25')](function(){return _0x3c6cef;})[_0xdcbc('0x25')](respondWithResult(_0x16fff8,null))['catch'](handleError(_0x16fff8,null));};exports[_0xdcbc('0x7f')]=function(_0x40eb54,_0x3bb03c,_0x5bb8f4){return db[_0xdcbc('0x43')][_0xdcbc('0x49')]({'where':{'id':_0x40eb54['params']['id']}})['then'](handleEntityNotFound(_0x3bb03c,null))[_0xdcbc('0x25')](function(_0x595abb){if(_0x595abb){return _0x595abb['removeLists'](_0x40eb54['query']['ids']);}})[_0xdcbc('0x25')](function(_0x92775c){if(_0x92775c){return db['CmHopper']['destroy']({'where':{'ListId':_0x40eb54[_0xdcbc('0x32')][_0xdcbc('0x63')],'CampaignId':_0x40eb54[_0xdcbc('0x48')]['id']}})[_0xdcbc('0x25')](function(){return _0x92775c;});}})[_0xdcbc('0x25')](respondWithStatusCode(_0x3bb03c,null))[_0xdcbc('0x52')](handleError(_0x3bb03c,null));};exports[_0xdcbc('0x80')]=function(_0xc62e9,_0x527873,_0x501dac){var _0x24e7ac={};var _0x8ae55b={};var _0x174f6e;var _0x202536;return db[_0xdcbc('0x43')][_0xdcbc('0x5d')]({'where':{'id':_0xc62e9[_0xdcbc('0x48')]['id']}})['then'](handleEntityNotFound(_0x527873,null))[_0xdcbc('0x25')](function(_0x3badff){if(_0x3badff){_0x174f6e=_0x3badff;_0x8ae55b[_0xdcbc('0x37')]=_[_0xdcbc('0x33')](db['CmList'][_0xdcbc('0x2f')]);_0x8ae55b[_0xdcbc('0x32')]=_[_0xdcbc('0x33')](_0xc62e9[_0xdcbc('0x32')]);_0x8ae55b['filters']=_[_0xdcbc('0x35')](_0x8ae55b[_0xdcbc('0x37')],_0x8ae55b[_0xdcbc('0x32')]);_0x24e7ac[_0xdcbc('0x36')]=_[_0xdcbc('0x35')](_0x8ae55b[_0xdcbc('0x37')],qs[_0xdcbc('0x38')](_0xc62e9[_0xdcbc('0x32')]['fields']));_0x24e7ac[_0xdcbc('0x36')]=_0x24e7ac[_0xdcbc('0x36')]['length']?_0x24e7ac['attributes']:_0x8ae55b[_0xdcbc('0x37')];_0x24e7ac[_0xdcbc('0x3b')]=qs['sort'](_0xc62e9['query'][_0xdcbc('0x3c')]);_0x24e7ac[_0xdcbc('0x3d')]=qs[_0xdcbc('0x34')](_[_0xdcbc('0x3e')](_0xc62e9[_0xdcbc('0x32')],_0x8ae55b[_0xdcbc('0x34')]));if(_0xc62e9[_0xdcbc('0x32')][_0xdcbc('0x41')]){_0x24e7ac['where']=_[_0xdcbc('0x3f')](_0x24e7ac[_0xdcbc('0x3d')],{'$or':_[_0xdcbc('0x2e')](_0x24e7ac[_0xdcbc('0x36')],function(_0x242a8a){var _0x47e531={};_0x47e531[_0x242a8a]={'$like':'%'+_0xc62e9[_0xdcbc('0x32')][_0xdcbc('0x41')]+'%'};return _0x47e531;})});}_0x24e7ac=_[_0xdcbc('0x3f')]({},_0x24e7ac,_0xc62e9['options']);return _0x174f6e[_0xdcbc('0x80')](_0x24e7ac);}})['then'](function(_0x35000d){if(_0x35000d){_0x202536=_0x35000d[_0xdcbc('0x39')];if(!_0xc62e9['query'][_0xdcbc('0x5a')](_0xdcbc('0x3a'))){_0x24e7ac[_0xdcbc('0x1e')]=qs[_0xdcbc('0x1e')](_0xc62e9[_0xdcbc('0x32')][_0xdcbc('0x1e')]);_0x24e7ac[_0xdcbc('0x1c')]=qs[_0xdcbc('0x1c')](_0xc62e9[_0xdcbc('0x32')][_0xdcbc('0x1c')]);}return _0x174f6e[_0xdcbc('0x80')](_0x24e7ac);}})['then'](function(_0x84e98){if(_0x84e98){return _0x84e98?{'count':_0x202536,'rows':_0x84e98}:null;}})[_0xdcbc('0x25')](respondWithResult(_0x527873,null))[_0xdcbc('0x52')](handleError(_0x527873,null));};exports[_0xdcbc('0x81')]=function(_0x79c9,_0x4b4d0b,_0x47388b){var _0x426966,_0x3b92bb;return db['Campaign'][_0xdcbc('0x49')]({'where':{'id':_0x79c9[_0xdcbc('0x48')]['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x4b4d0b,null))['then'](function(_0x345d8b){if(_0x345d8b){_0x3b92bb=_0x345d8b;return _0x345d8b[_0xdcbc('0x81')](_0x79c9[_0xdcbc('0x4b')][_0xdcbc('0x63')],_['omit'](_0x79c9[_0xdcbc('0x4b')],[_0xdcbc('0x63'),'id'])||{});}return null;})[_0xdcbc('0x82')](function(_0x418337){var _0xa49ae3;_0x426966=_0x418337||[];var _0x52ab71=[];if(_0x418337){for(var _0x2b2e6f=0x0;_0x2b2e6f<_0x418337[_0xdcbc('0x39')];_0x2b2e6f+=0x1){var _0x4dd24e=_0x418337[_0x2b2e6f]['get']({'plain':!![]});_0xa49ae3=squel[_0xdcbc('0x66')]()[_0xdcbc('0x67')](_0xdcbc('0x83'))[_0xdcbc('0x7a')]([_0xdcbc('0x69'),_0xdcbc('0x6a'),_0xdcbc('0x71'),'CampaignId','createdAt',_0xdcbc('0x55')],squel[_0xdcbc('0x6b')]()[_0xdcbc('0x6c')](_0xdcbc('0x69'),_0xdcbc('0x69'))[_0xdcbc('0x6c')]('id','ContactId')[_0xdcbc('0x6c')](_0x4dd24e['CmListId'][_0xdcbc('0x70')](),_0xdcbc('0x71'))[_0xdcbc('0x6c')](_0x79c9[_0xdcbc('0x48')]['id'][_0xdcbc('0x70')](),_0xdcbc('0x5b'))[_0xdcbc('0x6c')](_0xdcbc('0x6d'),_0xdcbc('0x57'))[_0xdcbc('0x6c')](_0xdcbc('0x6d'),'updatedAt')[_0xdcbc('0x72')](_0xdcbc('0x7b'))['where']('deletedAt\x20IS\x20NULL')[_0xdcbc('0x3d')](_0xdcbc('0x73'),_0x4dd24e[_0xdcbc('0x6f')][_0xdcbc('0x70')]())[_0xdcbc('0x3d')](_0xdcbc('0x74')))[_0xdcbc('0x70')]();_0x52ab71[_0xdcbc('0x7d')](db['sequelize'][_0xdcbc('0x32')](_0xa49ae3));}return BPromise[_0xdcbc('0x84')](_0x52ab71);}})[_0xdcbc('0x25')](function(){return _0x426966;})[_0xdcbc('0x25')](respondWithResult(_0x4b4d0b,null))[_0xdcbc('0x52')](handleError(_0x4b4d0b,null));};exports['removeBlackLists']=function(_0x55ba9c,_0x46ca94,_0x5894c7){return db['Campaign'][_0xdcbc('0x49')]({'where':{'id':_0x55ba9c[_0xdcbc('0x48')]['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x46ca94,null))[_0xdcbc('0x25')](function(_0xfc9ffd){if(_0xfc9ffd){return _0xfc9ffd['removeBlackLists'](_0x55ba9c[_0xdcbc('0x32')][_0xdcbc('0x63')]);}})[_0xdcbc('0x25')](function(_0x53ce39){if(_0x53ce39){return db[_0xdcbc('0x60')][_0xdcbc('0x26')]({'where':{'ListId':_0x55ba9c[_0xdcbc('0x32')][_0xdcbc('0x63')],'CampaignId':_0x55ba9c[_0xdcbc('0x48')]['id']}})['then'](function(){return _0x53ce39;});}})['then'](respondWithStatusCode(_0x46ca94,null))['catch'](handleError(_0x46ca94,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 822fd9a..306b443 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x266e80,_0xc5183a){var _0x26cbaa=function(_0x59c43a){while(--_0x59c43a){_0x266e80['push'](_0x266e80['shift']());}};_0x26cbaa(++_0xc5183a);}(_0x7a54,0x106));var _0x47a5=function(_0x719ced,_0x4c6cc7){_0x719ced=_0x719ced-0x0;var _0xa11cae=_0x7a54[_0x719ced];return _0xa11cae;};'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 ccbf5da..54de199 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 _0x9bde=['model','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','Campaign,\x20%s,\x20%s','result','catch','GetCampaign','Campaign','options','raw','where','attributes','limit','map','include'];(function(_0x363140,_0x1c56ca){var _0x28d4aa=function(_0x24e9ff){while(--_0x24e9ff){_0x363140['push'](_0x363140['shift']());}};_0x28d4aa(++_0x1c56ca);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3f4356,_0x24f8bd){_0x3f4356=_0x3f4356-0x0;var _0x1ab6ff=_0x9bde[_0x3f4356];return _0x1ab6ff;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('Campaign,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('Campaign,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('Campaign,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('Campaign,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});}exports[_0xe9bd('0x16')]=function(_0x3bae08){var _0x34ba2b=this;return new Promise(function(_0x330733,_0x5cf674){return db[_0xe9bd('0x17')]['findAll']({'raw':_0x3bae08[_0xe9bd('0x18')]?_0x3bae08['options'][_0xe9bd('0x19')]===undefined?!![]:![]:!![],'where':_0x3bae08[_0xe9bd('0x18')]?_0x3bae08[_0xe9bd('0x18')][_0xe9bd('0x1a')]||null:null,'attributes':_0x3bae08[_0xe9bd('0x18')]?_0x3bae08[_0xe9bd('0x18')][_0xe9bd('0x1b')]||null:null,'limit':_0x3bae08['options']?_0x3bae08[_0xe9bd('0x18')][_0xe9bd('0x1c')]||null:null,'include':_0x3bae08['options']?_0x3bae08[_0xe9bd('0x18')]['include']?_[_0xe9bd('0x1d')](_0x3bae08[_0xe9bd('0x18')][_0xe9bd('0x1e')],function(_0xf02209){return{'model':db[_0xf02209['model']],'as':_0xf02209['as'],'attributes':_0xf02209[_0xe9bd('0x1b')],'include':_0xf02209[_0xe9bd('0x1e')]?_[_0xe9bd('0x1d')](_0xf02209[_0xe9bd('0x1e')],function(_0x2641be){return{'model':db[_0x2641be[_0xe9bd('0x1f')]],'as':_0x2641be['as'],'attributes':_0x2641be[_0xe9bd('0x1b')],'include':_0x2641be[_0xe9bd('0x1e')]?_[_0xe9bd('0x1d')](_0x2641be['include'],function(_0x3c211a){return{'model':db[_0x3c211a[_0xe9bd('0x1f')]],'as':_0x3c211a['as'],'attributes':_0x3c211a['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9bd('0xb')](function(_0xc25248){logger[_0xe9bd('0xc')](_0xe9bd('0x16'),_0x3bae08);logger[_0xe9bd('0xd')](_0xe9bd('0x16'),_0x3bae08,JSON['stringify'](_0xc25248));_0x330733(_0xc25248);})['catch'](function(_0x1de54c){logger['error'](_0xe9bd('0x16'),_0x1de54c[_0xe9bd('0x12')],_0x3bae08);_0x5cf674(_0x34ba2b[_0xe9bd('0x10')](0x1f4,_0x1de54c[_0xe9bd('0x12')]));});});}; \ No newline at end of file +var _0x48ea=['attributes','limit','include','model','map','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug','error','code','message','result','catch','GetCampaign','Campaign','findAll','options'];(function(_0x168765,_0x534f44){var _0x3ee3a0=function(_0x274d2d){while(--_0x274d2d){_0x168765['push'](_0x168765['shift']());}};_0x3ee3a0(++_0x534f44);}(_0x48ea,0x9c));var _0xa48e=function(_0x32f1f6,_0x1b2b61){_0x32f1f6=_0x32f1f6-0x0;var _0x3da847=_0x48ea[_0x32f1f6];return _0x3da847;};'use strict';var _=require(_0xa48e('0x0'));var util=require('util');var moment=require(_0xa48e('0x1'));var BPromise=require(_0xa48e('0x2'));var rs=require(_0xa48e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa48e('0x4'));var logger=require('../../config/logger')(_0xa48e('0x5'));var config=require(_0xa48e('0x6'));var jayson=require(_0xa48e('0x7'));var client=jayson[_0xa48e('0x8')][_0xa48e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x405033,_0x5213e5,_0x143004){return new BPromise(function(_0x3bdc25,_0x170ffc){return client[_0xa48e('0xa')](_0x405033,_0x143004)[_0xa48e('0xb')](function(_0x3ad947){logger[_0xa48e('0xc')](_0xa48e('0xd'),_0x5213e5,'request\x20sent');logger[_0xa48e('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x5213e5,'request\x20sent',JSON['stringify'](_0x3ad947));if(_0x3ad947[_0xa48e('0xf')]){if(_0x3ad947[_0xa48e('0xf')][_0xa48e('0x10')]===0x1f4){logger[_0xa48e('0xf')]('Campaign,\x20%s,\x20%s',_0x5213e5,_0x3ad947[_0xa48e('0xf')][_0xa48e('0x11')]);return _0x170ffc(_0x3ad947[_0xa48e('0xf')][_0xa48e('0x11')]);}logger[_0xa48e('0xf')](_0xa48e('0xd'),_0x5213e5,_0x3ad947[_0xa48e('0xf')]['message']);return _0x3bdc25(_0x3ad947[_0xa48e('0xf')][_0xa48e('0x11')]);}else{logger[_0xa48e('0xc')](_0xa48e('0xd'),_0x5213e5,'request\x20sent');_0x3bdc25(_0x3ad947[_0xa48e('0x12')][_0xa48e('0x11')]);}})[_0xa48e('0x13')](function(_0x28c15c){logger[_0xa48e('0xf')](_0xa48e('0xd'),_0x5213e5,_0x28c15c);_0x170ffc(_0x28c15c);});});}exports[_0xa48e('0x14')]=function(_0x1f1cbc){var _0x320d22=this;return new Promise(function(_0x1baea5,_0xfc65bf){return db[_0xa48e('0x15')][_0xa48e('0x16')]({'raw':_0x1f1cbc[_0xa48e('0x17')]?_0x1f1cbc[_0xa48e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1f1cbc['options']?_0x1f1cbc[_0xa48e('0x17')]['where']||null:null,'attributes':_0x1f1cbc[_0xa48e('0x17')]?_0x1f1cbc[_0xa48e('0x17')][_0xa48e('0x18')]||null:null,'limit':_0x1f1cbc[_0xa48e('0x17')]?_0x1f1cbc[_0xa48e('0x17')][_0xa48e('0x19')]||null:null,'include':_0x1f1cbc[_0xa48e('0x17')]?_0x1f1cbc['options'][_0xa48e('0x1a')]?_['map'](_0x1f1cbc['options']['include'],function(_0x1adb5d){return{'model':db[_0x1adb5d[_0xa48e('0x1b')]],'as':_0x1adb5d['as'],'attributes':_0x1adb5d[_0xa48e('0x18')],'include':_0x1adb5d[_0xa48e('0x1a')]?_[_0xa48e('0x1c')](_0x1adb5d[_0xa48e('0x1a')],function(_0x45689b){return{'model':db[_0x45689b[_0xa48e('0x1b')]],'as':_0x45689b['as'],'attributes':_0x45689b[_0xa48e('0x18')],'include':_0x45689b[_0xa48e('0x1a')]?_[_0xa48e('0x1c')](_0x45689b['include'],function(_0x239b15){return{'model':db[_0x239b15[_0xa48e('0x1b')]],'as':_0x239b15['as'],'attributes':_0x239b15[_0xa48e('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b04f1){logger[_0xa48e('0xc')](_0xa48e('0x14'),_0x1f1cbc);logger[_0xa48e('0xe')]('GetCampaign',_0x1f1cbc,JSON[_0xa48e('0x1d')](_0x1b04f1));_0x1baea5(_0x1b04f1);})['catch'](function(_0x1dffc6){logger[_0xa48e('0xf')](_0xa48e('0x14'),_0x1dffc6[_0xa48e('0x11')],_0x1f1cbc);_0xfc65bf(_0x320d22[_0xa48e('0xf')](0x1f4,_0x1dffc6[_0xa48e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 056a48e..d22856c 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 _0x167e=['getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists'];(function(_0x30c6e0,_0x4b3605){var _0x2ea8bd=function(_0x58a2d9){while(--_0x58a2d9){_0x30c6e0['push'](_0x30c6e0['shift']());}};_0x2ea8bd(++_0x4b3605);}(_0x167e,0xa3));var _0xe167=function(_0x39cc31,_0x5293ef){_0x39cc31=_0x39cc31-0x0;var _0x5e90de=_0x167e[_0x39cc31];return _0x5e90de;};'use strict';var multer=require(_0xe167('0x0'));var util=require(_0xe167('0x1'));var path=require(_0xe167('0x2'));var timeout=require(_0xe167('0x3'));var express=require(_0xe167('0x4'));var router=express[_0xe167('0x5')]();var fs_extra=require(_0xe167('0x6'));var auth=require(_0xe167('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe167('0x8'));var controller=require('./campaign.controller');router[_0xe167('0x9')]('/',auth[_0xe167('0xa')](),controller[_0xe167('0xb')]);router[_0xe167('0x9')](_0xe167('0xc'),auth['isAuthenticated'](),controller[_0xe167('0xd')]);router['get'](_0xe167('0xe'),auth[_0xe167('0xa')](),controller[_0xe167('0xf')]);router[_0xe167('0x9')](_0xe167('0x10'),auth[_0xe167('0xa')](),controller[_0xe167('0x11')]);router[_0xe167('0x9')]('/:id/hopper_finals',auth[_0xe167('0xa')](),controller[_0xe167('0x12')]);router['get'](_0xe167('0x13'),auth[_0xe167('0xa')](),controller[_0xe167('0x14')]);router[_0xe167('0x9')](_0xe167('0x15'),auth[_0xe167('0xa')](),controller[_0xe167('0x16')]);router[_0xe167('0x9')](_0xe167('0x17'),auth['isAuthenticated'](),controller[_0xe167('0x18')]);router[_0xe167('0x19')]('/',auth[_0xe167('0xa')](),controller[_0xe167('0x1a')]);router['post'](_0xe167('0x1b'),auth[_0xe167('0xa')](),controller[_0xe167('0x1c')]);router[_0xe167('0x19')](_0xe167('0x15'),auth['isAuthenticated'](),controller[_0xe167('0x1d')]);router[_0xe167('0x19')](_0xe167('0x17'),auth[_0xe167('0xa')](),controller[_0xe167('0x1e')]);router[_0xe167('0x1f')]('/:id',auth[_0xe167('0xa')](),controller[_0xe167('0x20')]);router[_0xe167('0x21')](_0xe167('0xc'),auth[_0xe167('0xa')](),controller['destroy']);router[_0xe167('0x21')](_0xe167('0x15'),auth[_0xe167('0xa')](),controller[_0xe167('0x22')]);router[_0xe167('0x21')]('/:id/blacklists',auth[_0xe167('0xa')](),controller[_0xe167('0x23')]);module[_0xe167('0x24')]=router; \ No newline at end of file +var _0x4711=['show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','put','/:id','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index'];(function(_0x5a055d,_0x461b6d){var _0x545ed1=function(_0x216b12){while(--_0x216b12){_0x5a055d['push'](_0x5a055d['shift']());}};_0x545ed1(++_0x461b6d);}(_0x4711,0x10c));var _0x1471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4711[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1471('0x0'));var util=require(_0x1471('0x1'));var path=require(_0x1471('0x2'));var timeout=require(_0x1471('0x3'));var express=require(_0x1471('0x4'));var router=express[_0x1471('0x5')]();var fs_extra=require(_0x1471('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1471('0x7'));var config=require('../../config/environment');var controller=require(_0x1471('0x8'));router[_0x1471('0x9')]('/',auth[_0x1471('0xa')](),controller[_0x1471('0xb')]);router[_0x1471('0x9')]('/:id',auth[_0x1471('0xa')](),controller[_0x1471('0xc')]);router[_0x1471('0x9')](_0x1471('0xd'),auth[_0x1471('0xa')](),controller['getHoppers']);router['get'](_0x1471('0xe'),auth[_0x1471('0xa')](),controller[_0x1471('0xf')]);router[_0x1471('0x9')](_0x1471('0x10'),auth[_0x1471('0xa')](),controller[_0x1471('0x11')]);router[_0x1471('0x9')]('/:id/hopper_black',auth[_0x1471('0xa')](),controller[_0x1471('0x12')]);router[_0x1471('0x9')](_0x1471('0x13'),auth[_0x1471('0xa')](),controller['getLists']);router[_0x1471('0x9')](_0x1471('0x14'),auth[_0x1471('0xa')](),controller['getBlackLists']);router[_0x1471('0x15')]('/',auth[_0x1471('0xa')](),controller[_0x1471('0x16')]);router[_0x1471('0x15')](_0x1471('0x17'),auth[_0x1471('0xa')](),controller[_0x1471('0x18')]);router[_0x1471('0x15')](_0x1471('0x13'),auth[_0x1471('0xa')](),controller[_0x1471('0x19')]);router['post'](_0x1471('0x14'),auth[_0x1471('0xa')](),controller[_0x1471('0x1a')]);router[_0x1471('0x1b')](_0x1471('0x1c'),auth[_0x1471('0xa')](),controller[_0x1471('0x1d')]);router[_0x1471('0x1e')]('/:id',auth[_0x1471('0xa')](),controller[_0x1471('0x1f')]);router[_0x1471('0x1e')](_0x1471('0x13'),auth[_0x1471('0xa')](),controller[_0x1471('0x20')]);router[_0x1471('0x1e')](_0x1471('0x14'),auth[_0x1471('0xa')](),controller[_0x1471('0x21')]);module[_0x1471('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index d5aa11f..b7b20d4 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 _0x1b08=['sequelize','TEXT','STRING','VIRTUAL','getDataValue','key'];(function(_0x44044a,_0x3a0097){var _0x43bb6e=function(_0x1afe12){while(--_0x1afe12){_0x44044a['push'](_0x44044a['shift']());}};_0x43bb6e(++_0x3a0097);}(_0x1b08,0xc0));var _0x81b0=function(_0x19c483,_0x3b63fc){_0x19c483=_0x19c483-0x0;var _0x47ae32=_0x1b08[_0x19c483];return _0x47ae32;};'use strict';var Sequelize=require(_0x81b0('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x81b0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x81b0('0x2')]},'name':{'type':Sequelize[_0x81b0('0x3')],'get':function(){return this[_0x81b0('0x4')](_0x81b0('0x5'));}}}; \ No newline at end of file +var _0x839d=['key','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x874477,_0xff3645){var _0x285674=function(_0x3cd0c6){while(--_0x3cd0c6){_0x874477['push'](_0x874477['shift']());}};_0x285674(++_0xff3645);}(_0x839d,0x11b));var _0xd839=function(_0x1af170,_0x24cb12){_0x1af170=_0x1af170-0x0;var _0x3681e6=_0x839d[_0x1af170];return _0x3681e6;};'use strict';var Sequelize=require('sequelize');module[_0xd839('0x0')]={'key':{'type':Sequelize[_0xd839('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xd839('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd839('0x1')]},'name':{'type':Sequelize[_0xd839('0x3')],'get':function(){return this[_0xd839('0x4')](_0xd839('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index da2fe29..7f59657 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 _0xadfa=['get','UserProfileResource','end','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','merge','CannedAnswer','include','rows','catch','includeAll','options','find','body','params','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CannedAnswers','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then'];(function(_0x49cb77,_0x2ce90c){var _0x28a5e5=function(_0xef518c){while(--_0xef518c){_0x49cb77['push'](_0x49cb77['shift']());}};_0x28a5e5(++_0x2ce90c);}(_0xadfa,0x87));var _0xaadf=function(_0x235a44,_0x52ebf7){_0x235a44=_0x235a44-0x0;var _0x14a6b6=_0xadfa[_0x235a44];return _0x14a6b6;};'use strict';var emlformat=require(_0xaadf('0x0'));var rimraf=require(_0xaadf('0x1'));var zipdir=require(_0xaadf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaadf('0x3'));var moment=require(_0xaadf('0x4'));var BPromise=require(_0xaadf('0x5'));var Mustache=require(_0xaadf('0x6'));var util=require(_0xaadf('0x7'));var path=require(_0xaadf('0x8'));var sox=require(_0xaadf('0x9'));var csv=require(_0xaadf('0xa'));var ejs=require(_0xaadf('0xb'));var fs=require('fs');var fs_extra=require(_0xaadf('0xc'));var _=require(_0xaadf('0xd'));var squel=require(_0xaadf('0xe'));var crypto=require('crypto');var jsforce=require(_0xaadf('0xf'));var deskjs=require(_0xaadf('0x10'));var toCsv=require(_0xaadf('0xa'));var querystring=require(_0xaadf('0x11'));var Papa=require(_0xaadf('0x12'));var Redis=require(_0xaadf('0x13'));var authService=require(_0xaadf('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xaadf('0x15'));var hardwareService=require(_0xaadf('0x16'));var logger=require(_0xaadf('0x17'))(_0xaadf('0x18'));var utils=require('../../config/utils');var config=require(_0xaadf('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xaadf('0x1a'))['db'];function respondWithStatusCode(_0x14d92b,_0x55ef9e){_0x55ef9e=_0x55ef9e||0xcc;return function(_0x2ab868){if(_0x2ab868){return _0x14d92b[_0xaadf('0x1b')](_0x55ef9e);}return _0x14d92b['status'](_0x55ef9e)['end']();};}function respondWithResult(_0x419f15,_0x490918){_0x490918=_0x490918||0xc8;return function(_0x171196){if(_0x171196){return _0x419f15[_0xaadf('0x1c')](_0x490918)['json'](_0x171196);}};}function respondWithFilteredResult(_0x37c19b,_0x16da48){return function(_0x2e1654){if(_0x2e1654){var _0x18aa69=typeof _0x16da48[_0xaadf('0x1d')]===_0xaadf('0x1e')&&typeof _0x16da48[_0xaadf('0x1f')]===_0xaadf('0x1e');var _0x234727=_0x2e1654['count'];var _0x326666=_0x18aa69?0x0:_0x16da48[_0xaadf('0x1d')];var _0x4bee7c=_0x18aa69?_0x2e1654[_0xaadf('0x20')]:_0x16da48[_0xaadf('0x1d')]+_0x16da48[_0xaadf('0x1f')];var _0xe88fc7;if(_0x4bee7c>=_0x234727){_0x4bee7c=_0x234727;_0xe88fc7=0xc8;}else{_0xe88fc7=0xce;}_0x37c19b[_0xaadf('0x1c')](_0xe88fc7);return _0x37c19b[_0xaadf('0x21')](_0xaadf('0x22'),_0x326666+'-'+_0x4bee7c+'/'+_0x234727)[_0xaadf('0x23')](_0x2e1654);}return null;};}function patchUpdates(_0x25b3c7){return function(_0x10138e){try{jsonpatch['apply'](_0x10138e,_0x25b3c7,!![]);}catch(_0x4dafcb){return BPromise[_0xaadf('0x24')](_0x4dafcb);}return _0x10138e[_0xaadf('0x25')]();};}function saveUpdates(_0x3ff748,_0x11b6ab){return function(_0x5f11c0){if(_0x5f11c0){return _0x5f11c0[_0xaadf('0x26')](_0x3ff748)['then'](function(_0x33954a){return _0x33954a;});}return null;};}function removeEntity(_0x40ef44,_0x483f3d){return function(_0x374661){if(_0x374661){return _0x374661[_0xaadf('0x27')]()[_0xaadf('0x28')](function(){var _0x3c0719=_0x374661[_0xaadf('0x29')]({'plain':!![]});var _0x5a94a3='CannedAnswers';return db[_0xaadf('0x2a')]['destroy']({'where':{'type':_0x5a94a3,'resourceId':_0x3c0719['id']}})[_0xaadf('0x28')](function(){return _0x374661;});})[_0xaadf('0x28')](function(){_0x40ef44[_0xaadf('0x1c')](0xcc)[_0xaadf('0x2b')]();});}};}function handleEntityNotFound(_0x56931c,_0x5a1461){return function(_0xd2f9b0){if(!_0xd2f9b0){_0x56931c['sendStatus'](0x194);}return _0xd2f9b0;};}function handleError(_0x3f356e,_0x21c53e){_0x21c53e=_0x21c53e||0x1f4;return function(_0x227056){logger[_0xaadf('0x2c')](_0x227056[_0xaadf('0x2d')]);if(_0x227056[_0xaadf('0x2e')]){delete _0x227056['name'];}_0x3f356e[_0xaadf('0x1c')](_0x21c53e)[_0xaadf('0x2f')](_0x227056);};}exports['index']=function(_0xeee17,_0x14670f){var _0x1abc81={},_0x50e872={},_0x41b53f={'count':0x0,'rows':[]};var _0x4c58fa=_[_0xaadf('0x30')](db['CannedAnswer'][_0xaadf('0x31')],function(_0x532602){return{'name':_0x532602[_0xaadf('0x32')],'type':_0x532602[_0xaadf('0x33')]['key']};});_0x50e872['model']=_['map'](_0x4c58fa,_0xaadf('0x2e'));_0x50e872[_0xaadf('0x34')]=_[_0xaadf('0x35')](_0xeee17[_0xaadf('0x34')]);_0x50e872[_0xaadf('0x36')]=_[_0xaadf('0x37')](_0x50e872['model'],_0x50e872['query']);_0x1abc81['attributes']=_[_0xaadf('0x37')](_0x50e872[_0xaadf('0x38')],qs[_0xaadf('0x39')](_0xeee17[_0xaadf('0x34')][_0xaadf('0x39')]));_0x1abc81['attributes']=_0x1abc81[_0xaadf('0x3a')][_0xaadf('0x3b')]?_0x1abc81[_0xaadf('0x3a')]:_0x50e872[_0xaadf('0x38')];if(!_0xeee17['query']['hasOwnProperty']('nolimit')){_0x1abc81[_0xaadf('0x1f')]=qs[_0xaadf('0x1f')](_0xeee17[_0xaadf('0x34')]['limit']);_0x1abc81[_0xaadf('0x1d')]=qs['offset'](_0xeee17[_0xaadf('0x34')][_0xaadf('0x1d')]);}_0x1abc81[_0xaadf('0x3c')]=qs[_0xaadf('0x3d')](_0xeee17[_0xaadf('0x34')][_0xaadf('0x3d')]);_0x1abc81[_0xaadf('0x3e')]=qs['filters'](_[_0xaadf('0x3f')](_0xeee17[_0xaadf('0x34')],_0x50e872[_0xaadf('0x36')]),_0x4c58fa);if(_0xeee17[_0xaadf('0x34')][_0xaadf('0x40')]){_0x1abc81['where']=_[_0xaadf('0x41')](_0x1abc81['where'],{'$or':[{'key':{'$like':'%'+_0xeee17[_0xaadf('0x34')][_0xaadf('0x40')]+'%'}},{'value':{'$like':'%'+_0xeee17[_0xaadf('0x34')][_0xaadf('0x40')]+'%'}}]});}_0x1abc81=_[_0xaadf('0x41')]({},_0x1abc81,_0xeee17['options']);var _0x48133c={'where':_0x1abc81[_0xaadf('0x3e')]};return db[_0xaadf('0x42')][_0xaadf('0x20')](_0x48133c)['then'](function(_0xe566a0){_0x41b53f['count']=_0xe566a0;if(_0xeee17[_0xaadf('0x34')]['includeAll']){_0x1abc81[_0xaadf('0x43')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1abc81);})[_0xaadf('0x28')](function(_0x13ecf4){_0x41b53f[_0xaadf('0x44')]=_0x13ecf4;return _0x41b53f;})['then'](respondWithFilteredResult(_0x14670f,_0x1abc81))[_0xaadf('0x45')](handleError(_0x14670f,null));};exports['show']=function(_0x41d2fb,_0x2bb7aa){var _0x14f2f8={'raw':!![],'where':{'id':_0x41d2fb['params']['id']}},_0x55c03a={};_0x55c03a[_0xaadf('0x38')]=_[_0xaadf('0x35')](db[_0xaadf('0x42')]['rawAttributes']);_0x55c03a[_0xaadf('0x34')]=_[_0xaadf('0x35')](_0x41d2fb['query']);_0x55c03a[_0xaadf('0x36')]=_['intersection'](_0x55c03a[_0xaadf('0x38')],_0x55c03a[_0xaadf('0x34')]);_0x14f2f8['attributes']=_[_0xaadf('0x37')](_0x55c03a[_0xaadf('0x38')],qs[_0xaadf('0x39')](_0x41d2fb[_0xaadf('0x34')][_0xaadf('0x39')]));_0x14f2f8[_0xaadf('0x3a')]=_0x14f2f8[_0xaadf('0x3a')]['length']?_0x14f2f8['attributes']:_0x55c03a[_0xaadf('0x38')];if(_0x41d2fb[_0xaadf('0x34')][_0xaadf('0x46')]){_0x14f2f8[_0xaadf('0x43')]=[{'all':!![]}];}_0x14f2f8=_['merge']({},_0x14f2f8,_0x41d2fb[_0xaadf('0x47')]);return db['CannedAnswer'][_0xaadf('0x48')](_0x14f2f8)[_0xaadf('0x28')](handleEntityNotFound(_0x2bb7aa,null))['then'](respondWithResult(_0x2bb7aa,null))[_0xaadf('0x45')](handleError(_0x2bb7aa,null));};exports[_0xaadf('0x26')]=function(_0x25afe0,_0x174956){if(_0x25afe0['body']['id']){delete _0x25afe0[_0xaadf('0x49')]['id'];}return db[_0xaadf('0x42')][_0xaadf('0x48')]({'where':{'id':_0x25afe0['params']['id']}})[_0xaadf('0x28')](handleEntityNotFound(_0x174956,null))[_0xaadf('0x28')](saveUpdates(_0x25afe0[_0xaadf('0x49')],null))[_0xaadf('0x28')](respondWithResult(_0x174956,null))[_0xaadf('0x45')](handleError(_0x174956,null));};exports[_0xaadf('0x27')]=function(_0x5d61b6,_0x54205e){return db[_0xaadf('0x42')][_0xaadf('0x48')]({'where':{'id':_0x5d61b6[_0xaadf('0x4a')]['id']}})[_0xaadf('0x28')](handleEntityNotFound(_0x54205e,null))[_0xaadf('0x28')](removeEntity(_0x54205e,null))['catch'](handleError(_0x54205e,null));};exports[_0xaadf('0x4b')]=function(_0x679fc6,_0x18326e){var _0x14ee5a={'key':_0x679fc6[_0xaadf('0x49')][_0xaadf('0x4c')]};if(_0x679fc6[_0xaadf('0x49')][_0xaadf('0x4d')]){_0x14ee5a['MailAccountId']=_0x679fc6[_0xaadf('0x49')][_0xaadf('0x4d')];}else if(_0x679fc6[_0xaadf('0x49')]['SmsAccountId']){_0x14ee5a[_0xaadf('0x4e')]=_0x679fc6['body'][_0xaadf('0x4e')];}else if(_0x679fc6[_0xaadf('0x49')]['OpenchannelAccountId']){_0x14ee5a[_0xaadf('0x4f')]=_0x679fc6['body'][_0xaadf('0x4f')];}else if(_0x679fc6['body'][_0xaadf('0x50')]){_0x14ee5a[_0xaadf('0x50')]=_0x679fc6[_0xaadf('0x49')][_0xaadf('0x50')];}return db[_0xaadf('0x42')][_0xaadf('0x48')]({'where':_0x14ee5a})[_0xaadf('0x28')](function(_0x4da836){if(_0x4da836){throw new db[(_0xaadf('0x51'))][(_0xaadf('0x52'))](_0xaadf('0x53'));}return db['CannedAnswer'][_0xaadf('0x4b')](_0x679fc6[_0xaadf('0x49')]);})[_0xaadf('0x28')](function(_0x3b6764){var _0x498c45=_0x679fc6[_0xaadf('0x54')]['get']({'plain':!![]});if(!_0x498c45)throw new Error(_0xaadf('0x55'));if(_0x498c45['role']===_0xaadf('0x54')){var _0x52b188=_0x3b6764['get']({'plain':!![]});return db['UserProfileSection'][_0xaadf('0x48')]({'where':{'name':_0xaadf('0x56'),'userProfileId':_0x498c45['userProfileId']},'raw':!![]})[_0xaadf('0x28')](function(_0x2898ba){if(_0x2898ba&&_0x2898ba['autoAssociation']===0x0){return db[_0xaadf('0x2a')][_0xaadf('0x4b')]({'name':_0x52b188[_0xaadf('0x2e')],'resourceId':_0x52b188['id'],'type':_0x2898ba[_0xaadf('0x2e')],'sectionId':_0x2898ba['id']},{})['then'](function(){return _0x3b6764;});}else{return _0x3b6764;}})['catch'](function(_0x39469c){logger[_0xaadf('0x2c')](_0xaadf('0x57'),_0x39469c);throw _0x39469c;});}return _0x3b6764;})[_0xaadf('0x28')](respondWithResult(_0x18326e,0xc9))[_0xaadf('0x45')](handleError(_0x18326e,null));}; \ No newline at end of file +var _0x87c3=['destroy','error','stack','name','send','map','CannedAnswer','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','includeAll','include','findAll','keys','find','body','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','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','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','CannedAnswers','UserProfileResource'];(function(_0x2486d8,_0x44f313){var _0x9a9e84=function(_0xd4e334){while(--_0xd4e334){_0x2486d8['push'](_0x2486d8['shift']());}};_0x9a9e84(++_0x44f313);}(_0x87c3,0x84));var _0x387c=function(_0x106d68,_0xc75926){_0x106d68=_0x106d68-0x0;var _0x9d93ef=_0x87c3[_0x106d68];return _0x9d93ef;};'use strict';var emlformat=require(_0x387c('0x0'));var rimraf=require(_0x387c('0x1'));var zipdir=require(_0x387c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x387c('0x3'));var moment=require(_0x387c('0x4'));var BPromise=require(_0x387c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x387c('0x6'));var sox=require(_0x387c('0x7'));var csv=require(_0x387c('0x8'));var ejs=require(_0x387c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x387c('0xa'));var crypto=require('crypto');var jsforce=require(_0x387c('0xb'));var deskjs=require(_0x387c('0xc'));var toCsv=require(_0x387c('0x8'));var querystring=require(_0x387c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x387c('0xe'));var qs=require(_0x387c('0xf'));var as=require(_0x387c('0x10'));var hardwareService=require(_0x387c('0x11'));var logger=require(_0x387c('0x12'))('api');var utils=require(_0x387c('0x13'));var config=require(_0x387c('0x14'));var licenseUtil=require(_0x387c('0x15'));var db=require(_0x387c('0x16'))['db'];function respondWithStatusCode(_0x11a7f4,_0x3f2d0d){_0x3f2d0d=_0x3f2d0d||0xcc;return function(_0x5bd07e){if(_0x5bd07e){return _0x11a7f4[_0x387c('0x17')](_0x3f2d0d);}return _0x11a7f4[_0x387c('0x18')](_0x3f2d0d)[_0x387c('0x19')]();};}function respondWithResult(_0x1a84cf,_0x42030f){_0x42030f=_0x42030f||0xc8;return function(_0x2bda19){if(_0x2bda19){return _0x1a84cf[_0x387c('0x18')](_0x42030f)['json'](_0x2bda19);}};}function respondWithFilteredResult(_0x8417af,_0x38538c){return function(_0x286a22){if(_0x286a22){var _0x1a7750=typeof _0x38538c['offset']===_0x387c('0x1a')&&typeof _0x38538c[_0x387c('0x1b')]===_0x387c('0x1a');var _0x4b4214=_0x286a22['count'];var _0x34367a=_0x1a7750?0x0:_0x38538c[_0x387c('0x1c')];var _0x2b7852=_0x1a7750?_0x286a22[_0x387c('0x1d')]:_0x38538c[_0x387c('0x1c')]+_0x38538c[_0x387c('0x1b')];var _0x303010;if(_0x2b7852>=_0x4b4214){_0x2b7852=_0x4b4214;_0x303010=0xc8;}else{_0x303010=0xce;}_0x8417af[_0x387c('0x18')](_0x303010);return _0x8417af[_0x387c('0x1e')](_0x387c('0x1f'),_0x34367a+'-'+_0x2b7852+'/'+_0x4b4214)[_0x387c('0x20')](_0x286a22);}return null;};}function patchUpdates(_0x59e898){return function(_0x595fce){try{jsonpatch[_0x387c('0x21')](_0x595fce,_0x59e898,!![]);}catch(_0x16271a){return BPromise[_0x387c('0x22')](_0x16271a);}return _0x595fce[_0x387c('0x23')]();};}function saveUpdates(_0x2791e1,_0x497053){return function(_0x5c191d){if(_0x5c191d){return _0x5c191d[_0x387c('0x24')](_0x2791e1)[_0x387c('0x25')](function(_0x5a4cec){return _0x5a4cec;});}return null;};}function removeEntity(_0x13db08,_0x3977c5){return function(_0xe516d4){if(_0xe516d4){return _0xe516d4['destroy']()['then'](function(){var _0x29267c=_0xe516d4['get']({'plain':!![]});var _0x52647c=_0x387c('0x26');return db[_0x387c('0x27')][_0x387c('0x28')]({'where':{'type':_0x52647c,'resourceId':_0x29267c['id']}})[_0x387c('0x25')](function(){return _0xe516d4;});})[_0x387c('0x25')](function(){_0x13db08[_0x387c('0x18')](0xcc)[_0x387c('0x19')]();});}};}function handleEntityNotFound(_0x14f446,_0x43044){return function(_0x139f89){if(!_0x139f89){_0x14f446[_0x387c('0x17')](0x194);}return _0x139f89;};}function handleError(_0x442366,_0x5a8300){_0x5a8300=_0x5a8300||0x1f4;return function(_0x2b04a3){logger[_0x387c('0x29')](_0x2b04a3[_0x387c('0x2a')]);if(_0x2b04a3['name']){delete _0x2b04a3[_0x387c('0x2b')];}_0x442366[_0x387c('0x18')](_0x5a8300)[_0x387c('0x2c')](_0x2b04a3);};}exports['index']=function(_0x2785fa,_0x69c5cd){var _0x15bb1c={},_0x401a7d={},_0x562830={'count':0x0,'rows':[]};var _0x17d6ca=_[_0x387c('0x2d')](db[_0x387c('0x2e')][_0x387c('0x2f')],function(_0xe37bf7){return{'name':_0xe37bf7['fieldName'],'type':_0xe37bf7[_0x387c('0x30')][_0x387c('0x31')]};});_0x401a7d[_0x387c('0x32')]=_['map'](_0x17d6ca,'name');_0x401a7d[_0x387c('0x33')]=_['keys'](_0x2785fa[_0x387c('0x33')]);_0x401a7d['filters']=_[_0x387c('0x34')](_0x401a7d[_0x387c('0x32')],_0x401a7d[_0x387c('0x33')]);_0x15bb1c['attributes']=_[_0x387c('0x34')](_0x401a7d[_0x387c('0x32')],qs[_0x387c('0x35')](_0x2785fa[_0x387c('0x33')][_0x387c('0x35')]));_0x15bb1c[_0x387c('0x36')]=_0x15bb1c['attributes'][_0x387c('0x37')]?_0x15bb1c[_0x387c('0x36')]:_0x401a7d['model'];if(!_0x2785fa[_0x387c('0x33')][_0x387c('0x38')](_0x387c('0x39'))){_0x15bb1c[_0x387c('0x1b')]=qs['limit'](_0x2785fa[_0x387c('0x33')][_0x387c('0x1b')]);_0x15bb1c[_0x387c('0x1c')]=qs['offset'](_0x2785fa[_0x387c('0x33')][_0x387c('0x1c')]);}_0x15bb1c[_0x387c('0x3a')]=qs[_0x387c('0x3b')](_0x2785fa[_0x387c('0x33')][_0x387c('0x3b')]);_0x15bb1c['where']=qs[_0x387c('0x3c')](_['pick'](_0x2785fa['query'],_0x401a7d[_0x387c('0x3c')]),_0x17d6ca);if(_0x2785fa['query'][_0x387c('0x3d')]){_0x15bb1c[_0x387c('0x3e')]=_[_0x387c('0x3f')](_0x15bb1c[_0x387c('0x3e')],{'$or':[{'key':{'$like':'%'+_0x2785fa[_0x387c('0x33')][_0x387c('0x3d')]+'%'}},{'value':{'$like':'%'+_0x2785fa[_0x387c('0x33')]['filter']+'%'}}]});}_0x15bb1c=_[_0x387c('0x3f')]({},_0x15bb1c,_0x2785fa[_0x387c('0x40')]);var _0x39a194={'where':_0x15bb1c['where']};return db['CannedAnswer'][_0x387c('0x1d')](_0x39a194)[_0x387c('0x25')](function(_0x4fe9aa){_0x562830[_0x387c('0x1d')]=_0x4fe9aa;if(_0x2785fa[_0x387c('0x33')][_0x387c('0x41')]){_0x15bb1c[_0x387c('0x42')]=[{'all':!![]}];}return db[_0x387c('0x2e')][_0x387c('0x43')](_0x15bb1c);})[_0x387c('0x25')](function(_0x4b5b81){_0x562830['rows']=_0x4b5b81;return _0x562830;})[_0x387c('0x25')](respondWithFilteredResult(_0x69c5cd,_0x15bb1c))['catch'](handleError(_0x69c5cd,null));};exports['show']=function(_0x35d3a6,_0x5313fb){var _0x12ac98={'raw':!![],'where':{'id':_0x35d3a6['params']['id']}},_0x2fcc46={};_0x2fcc46['model']=_[_0x387c('0x44')](db['CannedAnswer'][_0x387c('0x2f')]);_0x2fcc46[_0x387c('0x33')]=_[_0x387c('0x44')](_0x35d3a6[_0x387c('0x33')]);_0x2fcc46[_0x387c('0x3c')]=_['intersection'](_0x2fcc46['model'],_0x2fcc46[_0x387c('0x33')]);_0x12ac98['attributes']=_[_0x387c('0x34')](_0x2fcc46[_0x387c('0x32')],qs[_0x387c('0x35')](_0x35d3a6[_0x387c('0x33')][_0x387c('0x35')]));_0x12ac98[_0x387c('0x36')]=_0x12ac98[_0x387c('0x36')][_0x387c('0x37')]?_0x12ac98[_0x387c('0x36')]:_0x2fcc46[_0x387c('0x32')];if(_0x35d3a6[_0x387c('0x33')][_0x387c('0x41')]){_0x12ac98[_0x387c('0x42')]=[{'all':!![]}];}_0x12ac98=_[_0x387c('0x3f')]({},_0x12ac98,_0x35d3a6[_0x387c('0x40')]);return db[_0x387c('0x2e')][_0x387c('0x45')](_0x12ac98)[_0x387c('0x25')](handleEntityNotFound(_0x5313fb,null))[_0x387c('0x25')](respondWithResult(_0x5313fb,null))['catch'](handleError(_0x5313fb,null));};exports[_0x387c('0x24')]=function(_0x3d2a26,_0xe30aa5){if(_0x3d2a26[_0x387c('0x46')]['id']){delete _0x3d2a26[_0x387c('0x46')]['id'];}return db[_0x387c('0x2e')]['find']({'where':{'id':_0x3d2a26['params']['id']}})[_0x387c('0x25')](handleEntityNotFound(_0xe30aa5,null))[_0x387c('0x25')](saveUpdates(_0x3d2a26[_0x387c('0x46')],null))['then'](respondWithResult(_0xe30aa5,null))[_0x387c('0x47')](handleError(_0xe30aa5,null));};exports[_0x387c('0x28')]=function(_0x1ff952,_0x46c4b9){return db['CannedAnswer'][_0x387c('0x45')]({'where':{'id':_0x1ff952['params']['id']}})[_0x387c('0x25')](handleEntityNotFound(_0x46c4b9,null))[_0x387c('0x25')](removeEntity(_0x46c4b9,null))[_0x387c('0x47')](handleError(_0x46c4b9,null));};exports[_0x387c('0x48')]=function(_0x1aeb70,_0x5edbe8){var _0x27e008={'key':_0x1aeb70['body'][_0x387c('0x31')]};if(_0x1aeb70['body'][_0x387c('0x49')]){_0x27e008[_0x387c('0x49')]=_0x1aeb70[_0x387c('0x46')][_0x387c('0x49')];}else if(_0x1aeb70[_0x387c('0x46')][_0x387c('0x4a')]){_0x27e008[_0x387c('0x4a')]=_0x1aeb70[_0x387c('0x46')][_0x387c('0x4a')];}else if(_0x1aeb70['body'][_0x387c('0x4b')]){_0x27e008[_0x387c('0x4b')]=_0x1aeb70[_0x387c('0x46')][_0x387c('0x4b')];}else if(_0x1aeb70[_0x387c('0x46')][_0x387c('0x4c')]){_0x27e008['ChatWebsiteId']=_0x1aeb70[_0x387c('0x46')][_0x387c('0x4c')];}return db[_0x387c('0x2e')][_0x387c('0x45')]({'where':_0x27e008})[_0x387c('0x25')](function(_0x28d584){if(_0x28d584){throw new db[(_0x387c('0x4d'))][(_0x387c('0x4e'))](_0x387c('0x4f'));}return db[_0x387c('0x2e')][_0x387c('0x48')](_0x1aeb70[_0x387c('0x46')]);})[_0x387c('0x25')](function(_0x590402){var _0x4082bf=_0x1aeb70[_0x387c('0x50')][_0x387c('0x51')]({'plain':!![]});if(!_0x4082bf)throw new Error(_0x387c('0x52'));if(_0x4082bf[_0x387c('0x53')]===_0x387c('0x50')){var _0x1df545=_0x590402[_0x387c('0x51')]({'plain':!![]});return db[_0x387c('0x54')]['find']({'where':{'name':_0x387c('0x26'),'userProfileId':_0x4082bf['userProfileId']},'raw':!![]})[_0x387c('0x25')](function(_0x44ca0c){if(_0x44ca0c&&_0x44ca0c[_0x387c('0x55')]===0x0){return db[_0x387c('0x27')]['create']({'name':_0x1df545[_0x387c('0x2b')],'resourceId':_0x1df545['id'],'type':_0x44ca0c[_0x387c('0x2b')],'sectionId':_0x44ca0c['id']},{})['then'](function(){return _0x590402;});}else{return _0x590402;}})[_0x387c('0x47')](function(_0x45bad4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45bad4);throw _0x45bad4;});}return _0x590402;})[_0x387c('0x25')](respondWithResult(_0x5edbe8,0xc9))[_0x387c('0x47')](handleError(_0x5edbe8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 05a1d5b..fcbcf83 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 _0x90b2=['utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers'];(function(_0x1b9e81,_0x34b1b7){var _0x10b4fa=function(_0x1d4991){while(--_0x1d4991){_0x1b9e81['push'](_0x1b9e81['shift']());}};_0x10b4fa(++_0x34b1b7);}(_0x90b2,0x14c));var _0x290b=function(_0x247083,_0x3849ed){_0x247083=_0x247083-0x0;var _0x1576e4=_0x90b2[_0x247083];return _0x1576e4;};'use strict';var _=require(_0x290b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x290b('0x1'));var BPromise=require(_0x290b('0x2'));var rp=require(_0x290b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x290b('0x4'));var attributes=require(_0x290b('0x5'));module[_0x290b('0x6')]=function(_0x41cfa4,_0xc2eb63){return _0x41cfa4[_0x290b('0x7')]('CannedAnswer',attributes,{'tableName':_0x290b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x290b('0x9'),'collate':_0x290b('0xa')});}; \ No newline at end of file +var _0x0ff9=['path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x14fa3f,_0x1fcb19){var _0x40c7e7=function(_0xda4c2c){while(--_0xda4c2c){_0x14fa3f['push'](_0x14fa3f['shift']());}};_0x40c7e7(++_0x1fcb19);}(_0x0ff9,0x11a));var _0x90ff=function(_0x43f996,_0x1cc493){_0x43f996=_0x43f996-0x0;var _0x30edef=_0x0ff9[_0x43f996];return _0x30edef;};'use strict';var _=require(_0x90ff('0x0'));var util=require(_0x90ff('0x1'));var logger=require(_0x90ff('0x2'))(_0x90ff('0x3'));var moment=require(_0x90ff('0x4'));var BPromise=require(_0x90ff('0x5'));var rp=require(_0x90ff('0x6'));var fs=require('fs');var path=require(_0x90ff('0x7'));var rimraf=require(_0x90ff('0x8'));var config=require(_0x90ff('0x9'));var attributes=require(_0x90ff('0xa'));module[_0x90ff('0xb')]=function(_0x2c7bc7,_0x5ab9b9){return _0x2c7bc7[_0x90ff('0xc')](_0x90ff('0xd'),attributes,{'tableName':_0x90ff('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x90ff('0xf'),'collate':_0x90ff('0x10')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index ef6aedd..299e623 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(_0x57d886,_0xb9cc17){var _0x5a99e6=function(_0x3ff971){while(--_0x3ff971){_0x57d886['push'](_0x57d886['shift']());}};_0x5a99e6(++_0xb9cc17);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x37b9fa,_0x156d8b){var _0x21861d=function(_0x2c37a8){while(--_0x2c37a8){_0x37b9fa['push'](_0x37b9fa['shift']());}};_0x21861d(++_0x156d8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 41704cb..41dc697 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 _0xfb3f=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy'];(function(_0x5cebe1,_0x520ec8){var _0x57a4fd=function(_0x5ec8f1){while(--_0x5ec8f1){_0x5cebe1['push'](_0x5cebe1['shift']());}};_0x57a4fd(++_0x520ec8);}(_0xfb3f,0x1e7));var _0xffb3=function(_0x4a3558,_0x35546d){_0x4a3558=_0x4a3558-0x0;var _0x381242=_0xfb3f[_0x4a3558];return _0x381242;};'use strict';var multer=require(_0xffb3('0x0'));var util=require(_0xffb3('0x1'));var path=require('path');var timeout=require(_0xffb3('0x2'));var express=require('express');var router=express[_0xffb3('0x3')]();var fs_extra=require(_0xffb3('0x4'));var auth=require(_0xffb3('0x5'));var interaction=require(_0xffb3('0x6'));var config=require('../../config/environment');var controller=require(_0xffb3('0x7'));router[_0xffb3('0x8')]('/',auth[_0xffb3('0x9')](),controller[_0xffb3('0xa')]);router[_0xffb3('0x8')](_0xffb3('0xb'),auth['isAuthenticated'](),controller[_0xffb3('0xc')]);router['post']('/',auth[_0xffb3('0x9')](),controller['create']);router[_0xffb3('0xd')]('/:id',auth[_0xffb3('0x9')](),controller[_0xffb3('0xe')]);router[_0xffb3('0xf')]('/:id',auth[_0xffb3('0x9')](),controller[_0xffb3('0x10')]);module[_0xffb3('0x11')]=router; \ No newline at end of file +var _0x66eb=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x4c3693,_0x5c240c){var _0xf36eb3=function(_0x39d294){while(--_0x39d294){_0x4c3693['push'](_0x4c3693['shift']());}};_0xf36eb3(++_0x5c240c);}(_0x66eb,0x130));var _0xb66e=function(_0x2351c4,_0x1dca54){_0x2351c4=_0x2351c4-0x0;var _0x1dd3f8=_0x66eb[_0x2351c4];return _0x1dd3f8;};'use strict';var multer=require(_0xb66e('0x0'));var util=require(_0xb66e('0x1'));var path=require('path');var timeout=require(_0xb66e('0x2'));var express=require(_0xb66e('0x3'));var router=express['Router']();var fs_extra=require(_0xb66e('0x4'));var auth=require(_0xb66e('0x5'));var interaction=require(_0xb66e('0x6'));var config=require(_0xb66e('0x7'));var controller=require(_0xb66e('0x8'));router[_0xb66e('0x9')]('/',auth[_0xb66e('0xa')](),controller['index']);router[_0xb66e('0x9')]('/:id',auth[_0xb66e('0xa')](),controller[_0xb66e('0xb')]);router['post']('/',auth[_0xb66e('0xa')](),controller[_0xb66e('0xc')]);router[_0xb66e('0xd')](_0xb66e('0xe'),auth[_0xb66e('0xa')](),controller[_0xb66e('0xf')]);router[_0xb66e('0x10')]('/:id',auth[_0xb66e('0xa')](),controller[_0xb66e('0x11')]);module[_0xb66e('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 2282910..e712f9f 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 _0x9189=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x45f4e9,_0x5246fd){var _0x559d8f=function(_0x591e11){while(--_0x591e11){_0x45f4e9['push'](_0x45f4e9['shift']());}};_0x559d8f(++_0x5246fd);}(_0x9189,0x1b0));var _0x9918=function(_0x579e02,_0x5621b6){_0x579e02=_0x579e02-0x0;var _0x554db9=_0x9189[_0x579e02];return _0x554db9;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x9918('0x0')],'allowNull':![],'defaultValue':_0x9918('0x1')},'clid':{'type':Sequelize[_0x9918('0x2')]},'src':{'type':Sequelize[_0x9918('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x9918('0x2')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x9918('0x2')]},'lastdata':{'type':Sequelize[_0x9918('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9918('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9918('0x2')]},'amaflags':{'type':Sequelize[_0x9918('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x9918('0x2')]},'sequence':{'type':Sequelize[_0x9918('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9918('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xac7a=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xac7a,0x128));var _0xaac7=function(_0x177f71,_0x514ab9){_0x177f71=_0x177f71-0x0;var _0x57b964=_0xac7a[_0x177f71];return _0x57b964;};'use strict';var Sequelize=require(_0xaac7('0x0'));module[_0xaac7('0x1')]={'calldate':{'type':Sequelize[_0xaac7('0x2')],'allowNull':![],'defaultValue':_0xaac7('0x3')},'clid':{'type':Sequelize[_0xaac7('0x4')]},'src':{'type':Sequelize[_0xaac7('0x4')]},'dst':{'type':Sequelize[_0xaac7('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaac7('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xaac7('0x4')]},'lastdata':{'type':Sequelize[_0xaac7('0x4')]},'duration':{'type':Sequelize[_0xaac7('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xaac7('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xaac7('0x4')]},'amaflags':{'type':Sequelize[_0xaac7('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xaac7('0x4')]},'userfield':{'type':Sequelize[_0xaac7('0x4')]},'uniqueid':{'type':Sequelize[_0xaac7('0x4')]},'linkedid':{'type':Sequelize[_0xaac7('0x4')]},'sequence':{'type':Sequelize[_0xaac7('0x4')]},'peeraccount':{'type':Sequelize[_0xaac7('0x4')]},'type':{'type':Sequelize[_0xaac7('0x4')]},'tag':{'type':Sequelize[_0xaac7('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 49b3b06..813cef5 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 _0xee14=['params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','Cdr','includeAll','include','findAll','rows','catch','find','create','body'];(function(_0x469ae9,_0x24b390){var _0x4364a5=function(_0x38e0a0){while(--_0x38e0a0){_0x469ae9['push'](_0x469ae9['shift']());}};_0x4364a5(++_0x24b390);}(_0xee14,0x13a));var _0x4ee1=function(_0x294022,_0x32f1e2){_0x294022=_0x294022-0x0;var _0xfd20d=_0xee14[_0x294022];return _0xfd20d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ee1('0x0'));var jsonpatch=require(_0x4ee1('0x1'));var rp=require(_0x4ee1('0x2'));var moment=require(_0x4ee1('0x3'));var BPromise=require(_0x4ee1('0x4'));var Mustache=require(_0x4ee1('0x5'));var util=require(_0x4ee1('0x6'));var path=require(_0x4ee1('0x7'));var sox=require(_0x4ee1('0x8'));var csv=require('to-csv');var ejs=require(_0x4ee1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0xf'));var querystring=require('querystring');var Papa=require(_0x4ee1('0x10'));var Redis=require(_0x4ee1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x12'));var as=require(_0x4ee1('0x13'));var hardwareService=require(_0x4ee1('0x14'));var logger=require(_0x4ee1('0x15'))('api');var utils=require(_0x4ee1('0x16'));var config=require(_0x4ee1('0x17'));var licenseUtil=require(_0x4ee1('0x18'));var db=require(_0x4ee1('0x19'))['db'];function respondWithStatusCode(_0x2f864e,_0x174427){_0x174427=_0x174427||0xcc;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0x1a')](_0x174427);}return _0x2f864e[_0x4ee1('0x1b')](_0x174427)[_0x4ee1('0x1c')]();};}function respondWithResult(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0xc8;return function(_0x1c342a){if(_0x1c342a){return _0x24a915[_0x4ee1('0x1b')](_0x46d2c2)[_0x4ee1('0x1d')](_0x1c342a);}};}function respondWithFilteredResult(_0xb7eafd,_0x4e3490){return function(_0x2f9194){if(_0x2f9194){var _0x38008f=typeof _0x4e3490[_0x4ee1('0x1e')]===_0x4ee1('0x1f')&&typeof _0x4e3490[_0x4ee1('0x20')]===_0x4ee1('0x1f');var _0x2eff91=_0x2f9194[_0x4ee1('0x21')];var _0x360056=_0x38008f?0x0:_0x4e3490[_0x4ee1('0x1e')];var _0x274de5=_0x38008f?_0x2f9194['count']:_0x4e3490[_0x4ee1('0x1e')]+_0x4e3490[_0x4ee1('0x20')];var _0x173388;if(_0x274de5>=_0x2eff91){_0x274de5=_0x2eff91;_0x173388=0xc8;}else{_0x173388=0xce;}_0xb7eafd[_0x4ee1('0x1b')](_0x173388);return _0xb7eafd[_0x4ee1('0x22')](_0x4ee1('0x23'),_0x360056+'-'+_0x274de5+'/'+_0x2eff91)['json'](_0x2f9194);}return null;};}function patchUpdates(_0x8a631f){return function(_0x333e96){try{jsonpatch[_0x4ee1('0x24')](_0x333e96,_0x8a631f,!![]);}catch(_0x3f0d59){return BPromise[_0x4ee1('0x25')](_0x3f0d59);}return _0x333e96[_0x4ee1('0x26')]();};}function saveUpdates(_0x328f21,_0x40fd98){return function(_0x1dc1a8){if(_0x1dc1a8){return _0x1dc1a8[_0x4ee1('0x27')](_0x328f21)['then'](function(_0x53d43f){return _0x53d43f;});}return null;};}function removeEntity(_0x14110c,_0x459e2e){return function(_0xaf87e7){if(_0xaf87e7){return _0xaf87e7[_0x4ee1('0x28')]()[_0x4ee1('0x29')](function(){_0x14110c[_0x4ee1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc0b5,_0x442c71){return function(_0x28b7e1){if(!_0x28b7e1){_0x5cc0b5['sendStatus'](0x194);}return _0x28b7e1;};}function handleError(_0x35900d,_0x213db8){_0x213db8=_0x213db8||0x1f4;return function(_0x36654c){logger[_0x4ee1('0x2a')](_0x36654c[_0x4ee1('0x2b')]);if(_0x36654c[_0x4ee1('0x2c')]){delete _0x36654c[_0x4ee1('0x2c')];}_0x35900d['status'](_0x213db8)[_0x4ee1('0x2d')](_0x36654c);};}exports['index']=function(_0x4746c2,_0x4ec408){var _0x3dc870={},_0x1d91be={},_0x59a34e={'count':0x0,'rows':[]};var _0x13944c=_[_0x4ee1('0x2e')](db['Cdr'][_0x4ee1('0x2f')],function(_0x5b3792){return{'name':_0x5b3792[_0x4ee1('0x30')],'type':_0x5b3792[_0x4ee1('0x31')][_0x4ee1('0x32')]};});_0x1d91be[_0x4ee1('0x33')]=_[_0x4ee1('0x2e')](_0x13944c,'name');_0x1d91be[_0x4ee1('0x34')]=_[_0x4ee1('0x35')](_0x4746c2[_0x4ee1('0x34')]);_0x1d91be[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x1d91be[_0x4ee1('0x33')],_0x1d91be['query']);_0x3dc870['attributes']=_[_0x4ee1('0x37')](_0x1d91be[_0x4ee1('0x33')],qs[_0x4ee1('0x38')](_0x4746c2['query'][_0x4ee1('0x38')]));_0x3dc870[_0x4ee1('0x39')]=_0x3dc870[_0x4ee1('0x39')][_0x4ee1('0x3a')]?_0x3dc870[_0x4ee1('0x39')]:_0x1d91be[_0x4ee1('0x33')];if(!_0x4746c2[_0x4ee1('0x34')][_0x4ee1('0x3b')](_0x4ee1('0x3c'))){_0x3dc870[_0x4ee1('0x20')]=qs[_0x4ee1('0x20')](_0x4746c2[_0x4ee1('0x34')][_0x4ee1('0x20')]);_0x3dc870['offset']=qs[_0x4ee1('0x1e')](_0x4746c2[_0x4ee1('0x34')][_0x4ee1('0x1e')]);}_0x3dc870['order']=qs['sort'](_0x4746c2[_0x4ee1('0x34')][_0x4ee1('0x3d')]);_0x3dc870[_0x4ee1('0x3e')]=qs[_0x4ee1('0x36')](_['pick'](_0x4746c2[_0x4ee1('0x34')],_0x1d91be[_0x4ee1('0x36')]),_0x13944c);if(_0x4746c2[_0x4ee1('0x34')][_0x4ee1('0x3f')]){_0x3dc870[_0x4ee1('0x3e')]=_[_0x4ee1('0x40')](_0x3dc870[_0x4ee1('0x3e')],{'$or':_[_0x4ee1('0x2e')](_0x13944c,function(_0x59b5cc){if(_0x59b5cc[_0x4ee1('0x31')]!==_0x4ee1('0x41')){var _0x345003={};_0x345003[_0x59b5cc[_0x4ee1('0x2c')]]={'$like':'%'+_0x4746c2[_0x4ee1('0x34')][_0x4ee1('0x3f')]+'%'};return _0x345003;}})});}_0x3dc870=_['merge']({},_0x3dc870,_0x4746c2[_0x4ee1('0x42')]);var _0x37176a={'where':_0x3dc870[_0x4ee1('0x3e')]};return db[_0x4ee1('0x43')][_0x4ee1('0x21')](_0x37176a)[_0x4ee1('0x29')](function(_0x3f0d8b){_0x59a34e[_0x4ee1('0x21')]=_0x3f0d8b;if(_0x4746c2[_0x4ee1('0x34')][_0x4ee1('0x44')]){_0x3dc870[_0x4ee1('0x45')]=[{'all':!![]}];}return db[_0x4ee1('0x43')][_0x4ee1('0x46')](_0x3dc870);})['then'](function(_0x3b3bed){_0x59a34e[_0x4ee1('0x47')]=_0x3b3bed;return _0x59a34e;})['then'](respondWithFilteredResult(_0x4ec408,_0x3dc870))[_0x4ee1('0x48')](handleError(_0x4ec408,null));};exports['show']=function(_0x174167,_0x52ebc0){var _0x14c333={'raw':!![],'where':{'id':_0x174167['params']['id']}},_0xc7580c={};_0xc7580c[_0x4ee1('0x33')]=_[_0x4ee1('0x35')](db[_0x4ee1('0x43')][_0x4ee1('0x2f')]);_0xc7580c['query']=_[_0x4ee1('0x35')](_0x174167[_0x4ee1('0x34')]);_0xc7580c[_0x4ee1('0x36')]=_['intersection'](_0xc7580c['model'],_0xc7580c[_0x4ee1('0x34')]);_0x14c333[_0x4ee1('0x39')]=_[_0x4ee1('0x37')](_0xc7580c[_0x4ee1('0x33')],qs[_0x4ee1('0x38')](_0x174167['query']['fields']));_0x14c333[_0x4ee1('0x39')]=_0x14c333[_0x4ee1('0x39')][_0x4ee1('0x3a')]?_0x14c333[_0x4ee1('0x39')]:_0xc7580c['model'];if(_0x174167[_0x4ee1('0x34')][_0x4ee1('0x44')]){_0x14c333['include']=[{'all':!![]}];}_0x14c333=_[_0x4ee1('0x40')]({},_0x14c333,_0x174167[_0x4ee1('0x42')]);return db[_0x4ee1('0x43')][_0x4ee1('0x49')](_0x14c333)[_0x4ee1('0x29')](handleEntityNotFound(_0x52ebc0,null))[_0x4ee1('0x29')](respondWithResult(_0x52ebc0,null))[_0x4ee1('0x48')](handleError(_0x52ebc0,null));};exports[_0x4ee1('0x4a')]=function(_0x390051,_0x4ebb28){return db['Cdr'][_0x4ee1('0x4a')](_0x390051[_0x4ee1('0x4b')],{})[_0x4ee1('0x29')](respondWithResult(_0x4ebb28,0xc9))[_0x4ee1('0x48')](handleError(_0x4ebb28,null));};exports['update']=function(_0x35edf5,_0x3c66d1){if(_0x35edf5[_0x4ee1('0x4b')]['id']){delete _0x35edf5[_0x4ee1('0x4b')]['id'];}return db[_0x4ee1('0x43')]['find']({'where':{'id':_0x35edf5[_0x4ee1('0x4c')]['id']}})[_0x4ee1('0x29')](handleEntityNotFound(_0x3c66d1,null))[_0x4ee1('0x29')](saveUpdates(_0x35edf5['body'],null))[_0x4ee1('0x29')](respondWithResult(_0x3c66d1,null))['catch'](handleError(_0x3c66d1,null));};exports[_0x4ee1('0x28')]=function(_0x5a1114,_0x30a1cd){return db['Cdr'][_0x4ee1('0x49')]({'where':{'id':_0x5a1114['params']['id']}})[_0x4ee1('0x29')](handleEntityNotFound(_0x30a1cd,null))[_0x4ee1('0x29')](removeEntity(_0x30a1cd,null))[_0x4ee1('0x48')](handleError(_0x30a1cd,null));};exports['describe']=function(_0x3368ed,_0x4118d7){return db[_0x4ee1('0x43')][_0x4ee1('0x4d')]()[_0x4ee1('0x29')](respondWithResult(_0x4118d7,null))[_0x4ee1('0x48')](handleError(_0x4118d7,null));}; \ No newline at end of file +var _0x4074=['params','rawAttributes','intersection','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','error','stack','name','index','fieldName','type','key','model','map','query','keys','attributes','fields','length','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','Cdr','then','includeAll','findAll','rows','show'];(function(_0x32bed1,_0x3885b5){var _0xdac392=function(_0x4d2971){while(--_0x4d2971){_0x32bed1['push'](_0x32bed1['shift']());}};_0xdac392(++_0x3885b5);}(_0x4074,0xf0));var _0x4407=function(_0x1a24cc,_0xdb8313){_0x1a24cc=_0x1a24cc-0x0;var _0x5ceb20=_0x4074[_0x1a24cc];return _0x5ceb20;};'use strict';var emlformat=require(_0x4407('0x0'));var rimraf=require(_0x4407('0x1'));var zipdir=require(_0x4407('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4407('0x3'));var moment=require(_0x4407('0x4'));var BPromise=require(_0x4407('0x5'));var Mustache=require(_0x4407('0x6'));var util=require(_0x4407('0x7'));var path=require(_0x4407('0x8'));var sox=require(_0x4407('0x9'));var csv=require(_0x4407('0xa'));var ejs=require(_0x4407('0xb'));var fs=require('fs');var fs_extra=require(_0x4407('0xc'));var _=require('lodash');var squel=require(_0x4407('0xd'));var crypto=require('crypto');var jsforce=require(_0x4407('0xe'));var deskjs=require(_0x4407('0xf'));var toCsv=require(_0x4407('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4407('0x10'));var qs=require(_0x4407('0x11'));var as=require(_0x4407('0x12'));var hardwareService=require(_0x4407('0x13'));var logger=require(_0x4407('0x14'))(_0x4407('0x15'));var utils=require(_0x4407('0x16'));var config=require(_0x4407('0x17'));var licenseUtil=require(_0x4407('0x18'));var db=require(_0x4407('0x19'))['db'];function respondWithStatusCode(_0x14f398,_0x5d0c41){_0x5d0c41=_0x5d0c41||0xcc;return function(_0x3f8f23){if(_0x3f8f23){return _0x14f398[_0x4407('0x1a')](_0x5d0c41);}return _0x14f398['status'](_0x5d0c41)[_0x4407('0x1b')]();};}function respondWithResult(_0x4c62b9,_0x1d2ec8){_0x1d2ec8=_0x1d2ec8||0xc8;return function(_0x27724a){if(_0x27724a){return _0x4c62b9[_0x4407('0x1c')](_0x1d2ec8)[_0x4407('0x1d')](_0x27724a);}};}function respondWithFilteredResult(_0x1840dd,_0x417e19){return function(_0x1c5a0c){if(_0x1c5a0c){var _0x2e709f=typeof _0x417e19['offset']===_0x4407('0x1e')&&typeof _0x417e19[_0x4407('0x1f')]===_0x4407('0x1e');var _0x367d55=_0x1c5a0c[_0x4407('0x20')];var _0x5b50b7=_0x2e709f?0x0:_0x417e19[_0x4407('0x21')];var _0x54caa1=_0x2e709f?_0x1c5a0c[_0x4407('0x20')]:_0x417e19[_0x4407('0x21')]+_0x417e19[_0x4407('0x1f')];var _0x2db8b2;if(_0x54caa1>=_0x367d55){_0x54caa1=_0x367d55;_0x2db8b2=0xc8;}else{_0x2db8b2=0xce;}_0x1840dd[_0x4407('0x1c')](_0x2db8b2);return _0x1840dd['set'](_0x4407('0x22'),_0x5b50b7+'-'+_0x54caa1+'/'+_0x367d55)['json'](_0x1c5a0c);}return null;};}function patchUpdates(_0x36a948){return function(_0x28bb2c){try{jsonpatch[_0x4407('0x23')](_0x28bb2c,_0x36a948,!![]);}catch(_0x445fe6){return BPromise['reject'](_0x445fe6);}return _0x28bb2c[_0x4407('0x24')]();};}function saveUpdates(_0x1fa9f1,_0x137f8e){return function(_0x2c880a){if(_0x2c880a){return _0x2c880a[_0x4407('0x25')](_0x1fa9f1)['then'](function(_0xa7265d){return _0xa7265d;});}return null;};}function removeEntity(_0x16272f,_0x5e214c){return function(_0x21b048){if(_0x21b048){return _0x21b048[_0x4407('0x26')]()['then'](function(){_0x16272f[_0x4407('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309274,_0x5386f4){return function(_0x40fb1e){if(!_0x40fb1e){_0x309274['sendStatus'](0x194);}return _0x40fb1e;};}function handleError(_0x374754,_0x4bf227){_0x4bf227=_0x4bf227||0x1f4;return function(_0x57ba27){logger[_0x4407('0x27')](_0x57ba27[_0x4407('0x28')]);if(_0x57ba27[_0x4407('0x29')]){delete _0x57ba27['name'];}_0x374754['status'](_0x4bf227)['send'](_0x57ba27);};}exports[_0x4407('0x2a')]=function(_0x2feb6b,_0x1f9828){var _0x84a8a={},_0x1d6b3d={},_0x37fba1={'count':0x0,'rows':[]};var _0x182bd9=_['map'](db['Cdr']['rawAttributes'],function(_0x28e99e){return{'name':_0x28e99e[_0x4407('0x2b')],'type':_0x28e99e[_0x4407('0x2c')][_0x4407('0x2d')]};});_0x1d6b3d[_0x4407('0x2e')]=_[_0x4407('0x2f')](_0x182bd9,_0x4407('0x29'));_0x1d6b3d[_0x4407('0x30')]=_[_0x4407('0x31')](_0x2feb6b[_0x4407('0x30')]);_0x1d6b3d['filters']=_['intersection'](_0x1d6b3d[_0x4407('0x2e')],_0x1d6b3d[_0x4407('0x30')]);_0x84a8a[_0x4407('0x32')]=_['intersection'](_0x1d6b3d[_0x4407('0x2e')],qs[_0x4407('0x33')](_0x2feb6b[_0x4407('0x30')][_0x4407('0x33')]));_0x84a8a[_0x4407('0x32')]=_0x84a8a['attributes'][_0x4407('0x34')]?_0x84a8a['attributes']:_0x1d6b3d[_0x4407('0x2e')];if(!_0x2feb6b['query']['hasOwnProperty'](_0x4407('0x35'))){_0x84a8a[_0x4407('0x1f')]=qs[_0x4407('0x1f')](_0x2feb6b[_0x4407('0x30')][_0x4407('0x1f')]);_0x84a8a[_0x4407('0x21')]=qs[_0x4407('0x21')](_0x2feb6b['query'][_0x4407('0x21')]);}_0x84a8a[_0x4407('0x36')]=qs[_0x4407('0x37')](_0x2feb6b[_0x4407('0x30')][_0x4407('0x37')]);_0x84a8a['where']=qs[_0x4407('0x38')](_['pick'](_0x2feb6b[_0x4407('0x30')],_0x1d6b3d[_0x4407('0x38')]),_0x182bd9);if(_0x2feb6b[_0x4407('0x30')][_0x4407('0x39')]){_0x84a8a['where']=_[_0x4407('0x3a')](_0x84a8a[_0x4407('0x3b')],{'$or':_[_0x4407('0x2f')](_0x182bd9,function(_0x1bf4e2){if(_0x1bf4e2[_0x4407('0x2c')]!==_0x4407('0x3c')){var _0x30de66={};_0x30de66[_0x1bf4e2[_0x4407('0x29')]]={'$like':'%'+_0x2feb6b[_0x4407('0x30')]['filter']+'%'};return _0x30de66;}})});}_0x84a8a=_['merge']({},_0x84a8a,_0x2feb6b[_0x4407('0x3d')]);var _0xc47d0e={'where':_0x84a8a[_0x4407('0x3b')]};return db[_0x4407('0x3e')]['count'](_0xc47d0e)[_0x4407('0x3f')](function(_0x2cb65e){_0x37fba1[_0x4407('0x20')]=_0x2cb65e;if(_0x2feb6b['query'][_0x4407('0x40')]){_0x84a8a['include']=[{'all':!![]}];}return db['Cdr'][_0x4407('0x41')](_0x84a8a);})[_0x4407('0x3f')](function(_0x234fa5){_0x37fba1[_0x4407('0x42')]=_0x234fa5;return _0x37fba1;})[_0x4407('0x3f')](respondWithFilteredResult(_0x1f9828,_0x84a8a))['catch'](handleError(_0x1f9828,null));};exports[_0x4407('0x43')]=function(_0xf79768,_0x819b8b){var _0x15ba7b={'raw':!![],'where':{'id':_0xf79768[_0x4407('0x44')]['id']}},_0x5b41cf={};_0x5b41cf[_0x4407('0x2e')]=_[_0x4407('0x31')](db[_0x4407('0x3e')][_0x4407('0x45')]);_0x5b41cf['query']=_[_0x4407('0x31')](_0xf79768['query']);_0x5b41cf['filters']=_[_0x4407('0x46')](_0x5b41cf[_0x4407('0x2e')],_0x5b41cf['query']);_0x15ba7b[_0x4407('0x32')]=_[_0x4407('0x46')](_0x5b41cf[_0x4407('0x2e')],qs[_0x4407('0x33')](_0xf79768['query'][_0x4407('0x33')]));_0x15ba7b[_0x4407('0x32')]=_0x15ba7b[_0x4407('0x32')][_0x4407('0x34')]?_0x15ba7b[_0x4407('0x32')]:_0x5b41cf['model'];if(_0xf79768[_0x4407('0x30')][_0x4407('0x40')]){_0x15ba7b[_0x4407('0x47')]=[{'all':!![]}];}_0x15ba7b=_[_0x4407('0x3a')]({},_0x15ba7b,_0xf79768[_0x4407('0x3d')]);return db['Cdr'][_0x4407('0x48')](_0x15ba7b)[_0x4407('0x3f')](handleEntityNotFound(_0x819b8b,null))[_0x4407('0x3f')](respondWithResult(_0x819b8b,null))[_0x4407('0x49')](handleError(_0x819b8b,null));};exports['create']=function(_0x18ff16,_0x2b18b8){return db['Cdr'][_0x4407('0x4a')](_0x18ff16[_0x4407('0x4b')],{})['then'](respondWithResult(_0x2b18b8,0xc9))[_0x4407('0x49')](handleError(_0x2b18b8,null));};exports[_0x4407('0x25')]=function(_0x5ea36,_0x4fbc1f){if(_0x5ea36[_0x4407('0x4b')]['id']){delete _0x5ea36['body']['id'];}return db['Cdr'][_0x4407('0x48')]({'where':{'id':_0x5ea36[_0x4407('0x44')]['id']}})['then'](handleEntityNotFound(_0x4fbc1f,null))[_0x4407('0x3f')](saveUpdates(_0x5ea36[_0x4407('0x4b')],null))[_0x4407('0x3f')](respondWithResult(_0x4fbc1f,null))[_0x4407('0x49')](handleError(_0x4fbc1f,null));};exports[_0x4407('0x26')]=function(_0x5a2c2b,_0x39865e){return db[_0x4407('0x3e')][_0x4407('0x48')]({'where':{'id':_0x5a2c2b[_0x4407('0x44')]['id']}})[_0x4407('0x3f')](handleEntityNotFound(_0x39865e,null))[_0x4407('0x3f')](removeEntity(_0x39865e,null))[_0x4407('0x49')](handleError(_0x39865e,null));};exports[_0x4407('0x4c')]=function(_0xd1dd66,_0x55f0ef){return db[_0x4407('0x3e')]['describe']()[_0x4407('0x3f')](respondWithResult(_0x55f0ef,null))[_0x4407('0x49')](handleError(_0x55f0ef,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index b61a762..f7e67f8 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(_0x23db91,_0x46a816){var _0x5edde8=function(_0x6da8b7){while(--_0x6da8b7){_0x23db91['push'](_0x23db91['shift']());}};_0x5edde8(++_0x46a816);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0xce5bb5,_0x4c2a4c){var _0x5e4830=function(_0x5c5297){while(--_0x5c5297){_0xce5bb5['push'](_0xce5bb5['shift']());}};_0x5e4830(++_0x4c2a4c);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 0cef3c0..5a8e633 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 _0xc943=['Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc943,0x17e));var _0x3c94=function(_0x350258,_0x4e0a50){_0x350258=_0x350258-0x0;var _0x3714b3=_0xc943[_0x350258];return _0x3714b3;};'use strict';var _=require(_0x3c94('0x0'));var util=require(_0x3c94('0x1'));var moment=require('moment');var BPromise=require(_0x3c94('0x2'));var rs=require(_0x3c94('0x3'));var fs=require('fs');var Redis=require(_0x3c94('0x4'));var db=require(_0x3c94('0x5'))['db'];var utils=require(_0x3c94('0x6'));var logger=require(_0x3c94('0x7'))(_0x3c94('0x8'));var config=require('../../config/environment');var jayson=require(_0x3c94('0x9'));var client=jayson[_0x3c94('0xa')][_0x3c94('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x448fac,_0x3209f9,_0x10d56e){return new BPromise(function(_0x300b6f,_0x132c49){return client[_0x3c94('0xc')](_0x448fac,_0x10d56e)['then'](function(_0x4c7515){logger[_0x3c94('0xd')](_0x3c94('0xe'),_0x3209f9,_0x3c94('0xf'));logger[_0x3c94('0x10')](_0x3c94('0x11'),_0x3209f9,_0x3c94('0xf'),JSON[_0x3c94('0x12')](_0x4c7515));if(_0x4c7515['error']){if(_0x4c7515[_0x3c94('0x13')]['code']===0x1f4){logger['error'](_0x3c94('0xe'),_0x3209f9,_0x4c7515['error'][_0x3c94('0x14')]);return _0x132c49(_0x4c7515['error'][_0x3c94('0x14')]);}logger[_0x3c94('0x13')]('Cdr,\x20%s,\x20%s',_0x3209f9,_0x4c7515[_0x3c94('0x13')][_0x3c94('0x14')]);return _0x300b6f(_0x4c7515[_0x3c94('0x13')]['message']);}else{logger[_0x3c94('0xd')]('Cdr,\x20%s,\x20%s',_0x3209f9,_0x3c94('0xf'));_0x300b6f(_0x4c7515[_0x3c94('0x15')]['message']);}})['catch'](function(_0x25c94e){logger['error'](_0x3c94('0xe'),_0x3209f9,_0x25c94e);_0x132c49(_0x25c94e);});});} \ No newline at end of file +var _0x461a=['stringify','code','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','Cdr,\x20%s,\x20%s','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4995b5,_0x45b4eb){var _0x22050d=function(_0x2172c1){while(--_0x2172c1){_0x4995b5['push'](_0x4995b5['shift']());}};_0x22050d(++_0x45b4eb);}(_0x461a,0x1e6));var _0xa461=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x461a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa461('0x0'));var util=require(_0xa461('0x1'));var moment=require(_0xa461('0x2'));var BPromise=require(_0xa461('0x3'));var rs=require(_0xa461('0x4'));var fs=require('fs');var Redis=require(_0xa461('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa461('0x6'))(_0xa461('0x7'));var config=require(_0xa461('0x8'));var jayson=require(_0xa461('0x9'));var client=jayson['client'][_0xa461('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15e31d,_0x1ad8d7,_0x19f7a8){return new BPromise(function(_0x2118f9,_0x239066){return client['request'](_0x15e31d,_0x19f7a8)['then'](function(_0xe66eaf){logger['info'](_0xa461('0xb'),_0x1ad8d7,'request\x20sent');logger['debug'](_0xa461('0xc'),_0x1ad8d7,_0xa461('0xd'),JSON[_0xa461('0xe')](_0xe66eaf));if(_0xe66eaf['error']){if(_0xe66eaf['error'][_0xa461('0xf')]===0x1f4){logger[_0xa461('0x10')](_0xa461('0xb'),_0x1ad8d7,_0xe66eaf[_0xa461('0x10')][_0xa461('0x11')]);return _0x239066(_0xe66eaf[_0xa461('0x10')][_0xa461('0x11')]);}logger[_0xa461('0x10')]('Cdr,\x20%s,\x20%s',_0x1ad8d7,_0xe66eaf[_0xa461('0x10')]['message']);return _0x2118f9(_0xe66eaf[_0xa461('0x10')][_0xa461('0x11')]);}else{logger[_0xa461('0x12')](_0xa461('0xb'),_0x1ad8d7,_0xa461('0xd'));_0x2118f9(_0xe66eaf['result']['message']);}})[_0xa461('0x13')](function(_0x1ebc9c){logger[_0xa461('0x10')](_0xa461('0xb'),_0x1ad8d7,_0x1ebc9c);_0x239066(_0x1ebc9c);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 3d0fb75..46cbe88 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x1e46a5,_0x5b094e){var _0x35a2cf=function(_0x5e7c65){while(--_0x5e7c65){_0x1e46a5['push'](_0x1e46a5['shift']());}};_0x35a2cf(++_0x5b094e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 9b77582..98ac32d 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 _0x883b=['INTEGER','STRING','TEXT','*,*,*,*','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x883b,0x15d));var _0xb883=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x883b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xb883('0x0')]={'priority':{'type':Sequelize[_0xb883('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb883('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb883('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb883('0x2')],'defaultValue':_0xb883('0x4')}}; \ No newline at end of file +var _0x1f16=['noop','*,*,*,*','exports','INTEGER','STRING'];(function(_0x4acfcd,_0xabaa4e){var _0x1974fc=function(_0x244739){while(--_0x244739){_0x4acfcd['push'](_0x4acfcd['shift']());}};_0x1974fc(++_0xabaa4e);}(_0x1f16,0x115));var _0x61f1=function(_0xdbaf7f,_0x2ffdf7){_0xdbaf7f=_0xdbaf7f-0x0;var _0x2b296b=_0x1f16[_0xdbaf7f];return _0x2b296b;};'use strict';var Sequelize=require('sequelize');module[_0x61f1('0x0')]={'priority':{'type':Sequelize[_0x61f1('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x61f1('0x2')],'allowNull':![],'defaultValue':_0x61f1('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x61f1('0x2')]},'interval':{'type':Sequelize[_0x61f1('0x2')],'defaultValue':_0x61f1('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 5f12c03..a85654d 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 _0xf45e=['end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','show','params','keys','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','merge','ChatApplication','find','catch','body','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'];(function(_0x2ddf2d,_0x53e9b3){var _0x30e9be=function(_0x25690d){while(--_0x25690d){_0x2ddf2d['push'](_0x2ddf2d['shift']());}};_0x30e9be(++_0x53e9b3);}(_0xf45e,0x115));var _0xef45=function(_0x41c943,_0x8f932c){_0x41c943=_0x41c943-0x0;var _0xba6d65=_0xf45e[_0x41c943];return _0xba6d65;};'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={'raw':!![],'where':{'id':_0x2f72ef[_0xef45('0x2d')]['id']}},_0x5782d0={};_0x5782d0['model']=_[_0xef45('0x2e')](db['ChatApplication'][_0xef45('0x2f')]);_0x5782d0['query']=_['keys'](_0x2f72ef[_0xef45('0x30')]);_0x5782d0[_0xef45('0x31')]=_[_0xef45('0x32')](_0x5782d0[_0xef45('0x33')],_0x5782d0[_0xef45('0x30')]);_0x15ad38['attributes']=_['intersection'](_0x5782d0['model'],qs[_0xef45('0x34')](_0x2f72ef[_0xef45('0x30')][_0xef45('0x34')]));_0x15ad38[_0xef45('0x35')]=_0x15ad38[_0xef45('0x35')][_0xef45('0x36')]?_0x15ad38[_0xef45('0x35')]:_0x5782d0['model'];if(_0x2f72ef['query'][_0xef45('0x37')]){_0x15ad38['include']=[{'all':!![]}];}_0x15ad38=_[_0xef45('0x38')]({},_0x15ad38,_0x2f72ef['options']);return db[_0xef45('0x39')][_0xef45('0x3a')](_0x15ad38)[_0xef45('0x29')](handleEntityNotFound(_0x217e8d,null))[_0xef45('0x29')](respondWithResult(_0x217e8d,null))[_0xef45('0x3b')](handleError(_0x217e8d,null));};exports['update']=function(_0x372689,_0x331fdb){if(_0x372689[_0xef45('0x3c')]['id']){delete _0x372689['body']['id'];}return db['ChatApplication'][_0xef45('0x3a')]({'where':{'id':_0x372689[_0xef45('0x2d')]['id']}})['then'](handleEntityNotFound(_0x331fdb,null))[_0xef45('0x29')](saveUpdates(_0x372689['body'],null))['then'](respondWithResult(_0x331fdb,null))[_0xef45('0x3b')](handleError(_0x331fdb,null));};exports[_0xef45('0x28')]=function(_0x2688c9,_0x573caf){return db[_0xef45('0x39')][_0xef45('0x3a')]({'where':{'id':_0x2688c9[_0xef45('0x2d')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x573caf,null))['then'](removeEntity(_0x573caf,null))['catch'](handleError(_0x573caf,null));}; \ No newline at end of file +var _0x2b84=['apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','ChatApplication','rawAttributes','query','keys','filters','intersection','fields','attributes','include','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set'];(function(_0x510001,_0x4d5f91){var _0x3f603d=function(_0x1684c9){while(--_0x1684c9){_0x510001['push'](_0x510001['shift']());}};_0x3f603d(++_0x4d5f91);}(_0x2b84,0x105));var _0x42b8=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x2b84[_0x46aff0];return _0x9d78cf;};'use strict';var emlformat=require(_0x42b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x42b8('0x1'));var jsonpatch=require(_0x42b8('0x2'));var rp=require(_0x42b8('0x3'));var moment=require(_0x42b8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x42b8('0x5'));var util=require(_0x42b8('0x6'));var path=require(_0x42b8('0x7'));var sox=require(_0x42b8('0x8'));var csv=require(_0x42b8('0x9'));var ejs=require(_0x42b8('0xa'));var fs=require('fs');var fs_extra=require(_0x42b8('0xb'));var _=require(_0x42b8('0xc'));var squel=require('squel');var crypto=require(_0x42b8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x42b8('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x42b8('0xf'));var Redis=require(_0x42b8('0x10'));var authService=require(_0x42b8('0x11'));var qs=require(_0x42b8('0x12'));var as=require(_0x42b8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x42b8('0x14'))(_0x42b8('0x15'));var utils=require(_0x42b8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x42b8('0x17'));var db=require(_0x42b8('0x18'))['db'];function respondWithStatusCode(_0x2c3e6c,_0x48dbba){_0x48dbba=_0x48dbba||0xcc;return function(_0x374d84){if(_0x374d84){return _0x2c3e6c[_0x42b8('0x19')](_0x48dbba);}return _0x2c3e6c['status'](_0x48dbba)[_0x42b8('0x1a')]();};}function respondWithResult(_0x4611e6,_0x3bd4e3){_0x3bd4e3=_0x3bd4e3||0xc8;return function(_0xe8c8fd){if(_0xe8c8fd){return _0x4611e6[_0x42b8('0x1b')](_0x3bd4e3)[_0x42b8('0x1c')](_0xe8c8fd);}};}function respondWithFilteredResult(_0x1638f5,_0x49e6be){return function(_0x4ea974){if(_0x4ea974){var _0x276222=typeof _0x49e6be[_0x42b8('0x1d')]===_0x42b8('0x1e')&&typeof _0x49e6be['limit']===_0x42b8('0x1e');var _0x4201f4=_0x4ea974['count'];var _0x2359a5=_0x276222?0x0:_0x49e6be[_0x42b8('0x1d')];var _0x21a5f0=_0x276222?_0x4ea974[_0x42b8('0x1f')]:_0x49e6be[_0x42b8('0x1d')]+_0x49e6be[_0x42b8('0x20')];var _0x17e10b;if(_0x21a5f0>=_0x4201f4){_0x21a5f0=_0x4201f4;_0x17e10b=0xc8;}else{_0x17e10b=0xce;}_0x1638f5[_0x42b8('0x1b')](_0x17e10b);return _0x1638f5[_0x42b8('0x21')]('Content-Range',_0x2359a5+'-'+_0x21a5f0+'/'+_0x4201f4)[_0x42b8('0x1c')](_0x4ea974);}return null;};}function patchUpdates(_0x33236b){return function(_0x561568){try{jsonpatch[_0x42b8('0x22')](_0x561568,_0x33236b,!![]);}catch(_0x1af649){return BPromise[_0x42b8('0x23')](_0x1af649);}return _0x561568[_0x42b8('0x24')]();};}function saveUpdates(_0x453079,_0x2be6c8){return function(_0x7bf526){if(_0x7bf526){return _0x7bf526[_0x42b8('0x25')](_0x453079)[_0x42b8('0x26')](function(_0x361d7a){return _0x361d7a;});}return null;};}function removeEntity(_0x23b015,_0x1c4908){return function(_0x41f708){if(_0x41f708){return _0x41f708[_0x42b8('0x27')]()[_0x42b8('0x26')](function(){_0x23b015['status'](0xcc)[_0x42b8('0x1a')]();});}};}function handleEntityNotFound(_0x316c98,_0x7eca17){return function(_0x146c5d){if(!_0x146c5d){_0x316c98[_0x42b8('0x19')](0x194);}return _0x146c5d;};}function handleError(_0xfa0a81,_0x296470){_0x296470=_0x296470||0x1f4;return function(_0x3ea491){logger[_0x42b8('0x28')](_0x3ea491[_0x42b8('0x29')]);if(_0x3ea491[_0x42b8('0x2a')]){delete _0x3ea491['name'];}_0xfa0a81['status'](_0x296470)[_0x42b8('0x2b')](_0x3ea491);};}exports[_0x42b8('0x2c')]=function(_0x3ef9e3,_0x5a11ba){var _0x559e98={'raw':!![],'where':{'id':_0x3ef9e3[_0x42b8('0x2d')]['id']}},_0x12d16d={};_0x12d16d[_0x42b8('0x2e')]=_['keys'](db[_0x42b8('0x2f')][_0x42b8('0x30')]);_0x12d16d[_0x42b8('0x31')]=_[_0x42b8('0x32')](_0x3ef9e3[_0x42b8('0x31')]);_0x12d16d[_0x42b8('0x33')]=_[_0x42b8('0x34')](_0x12d16d[_0x42b8('0x2e')],_0x12d16d[_0x42b8('0x31')]);_0x559e98['attributes']=_[_0x42b8('0x34')](_0x12d16d[_0x42b8('0x2e')],qs[_0x42b8('0x35')](_0x3ef9e3[_0x42b8('0x31')][_0x42b8('0x35')]));_0x559e98[_0x42b8('0x36')]=_0x559e98[_0x42b8('0x36')]['length']?_0x559e98[_0x42b8('0x36')]:_0x12d16d[_0x42b8('0x2e')];if(_0x3ef9e3[_0x42b8('0x31')]['includeAll']){_0x559e98[_0x42b8('0x37')]=[{'all':!![]}];}_0x559e98=_['merge']({},_0x559e98,_0x3ef9e3['options']);return db['ChatApplication'][_0x42b8('0x38')](_0x559e98)[_0x42b8('0x26')](handleEntityNotFound(_0x5a11ba,null))[_0x42b8('0x26')](respondWithResult(_0x5a11ba,null))[_0x42b8('0x39')](handleError(_0x5a11ba,null));};exports[_0x42b8('0x25')]=function(_0xcde2c,_0x2dd365){if(_0xcde2c[_0x42b8('0x3a')]['id']){delete _0xcde2c[_0x42b8('0x3a')]['id'];}return db[_0x42b8('0x2f')][_0x42b8('0x38')]({'where':{'id':_0xcde2c['params']['id']}})[_0x42b8('0x26')](handleEntityNotFound(_0x2dd365,null))[_0x42b8('0x26')](saveUpdates(_0xcde2c['body'],null))['then'](respondWithResult(_0x2dd365,null))[_0x42b8('0x39')](handleError(_0x2dd365,null));};exports[_0x42b8('0x27')]=function(_0x471903,_0x11a083){return db[_0x42b8('0x2f')][_0x42b8('0x38')]({'where':{'id':_0x471903['params']['id']}})['then'](handleEntityNotFound(_0x11a083,null))[_0x42b8('0x26')](removeEntity(_0x11a083,null))[_0x42b8('0x39')](handleError(_0x11a083,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 3ea8a1d..3dbc2cb 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 _0xfaba=['api','bluebird','rimraf','./chatApplication.attributes','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x4c6137,_0x50e16b){var _0x13276f=function(_0x97b535){while(--_0x97b535){_0x4c6137['push'](_0x4c6137['shift']());}};_0x13276f(++_0x50e16b);}(_0xfaba,0xa2));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xafab('0x0'));var util=require(_0xafab('0x1'));var logger=require(_0xafab('0x2'))(_0xafab('0x3'));var moment=require('moment');var BPromise=require(_0xafab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xafab('0x5'));var config=require('../../config/environment');var attributes=require(_0xafab('0x6'));module['exports']=function(_0x180e83,_0x5154e0){return _0x180e83[_0xafab('0x7')](_0xafab('0x8'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xafab('0x9'),'collate':_0xafab('0xa')});}; \ No newline at end of file +var _0xece1=['define','ChatApplication','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x123091,_0xaa9248){var _0x236430=function(_0x45054f){while(--_0x45054f){_0x123091['push'](_0x123091['shift']());}};_0x236430(++_0xaa9248);}(_0xece1,0x8a));var _0x1ece=function(_0x27a0bf,_0x261918){_0x27a0bf=_0x27a0bf-0x0;var _0x33249f=_0xece1[_0x27a0bf];return _0x33249f;};'use strict';var _=require(_0x1ece('0x0'));var util=require(_0x1ece('0x1'));var logger=require(_0x1ece('0x2'))(_0x1ece('0x3'));var moment=require(_0x1ece('0x4'));var BPromise=require(_0x1ece('0x5'));var rp=require(_0x1ece('0x6'));var fs=require('fs');var path=require(_0x1ece('0x7'));var rimraf=require(_0x1ece('0x8'));var config=require(_0x1ece('0x9'));var attributes=require(_0x1ece('0xa'));module[_0x1ece('0xb')]=function(_0xfe0b6c,_0x5a65b6){return _0xfe0b6c[_0x1ece('0xc')](_0x1ece('0xd'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1ece('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 7122531..710d3d8 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 _0x0ab8=['ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ChatApplication,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','debug'];(function(_0x14361d,_0x4aa821){var _0x518d84=function(_0x5a9e49){while(--_0x5a9e49){_0x14361d['push'](_0x14361d['shift']());}};_0x518d84(++_0x4aa821);}(_0x0ab8,0x13c));var _0x80ab=function(_0x21710c,_0x294bb1){_0x21710c=_0x21710c-0x0;var _0x3c0a23=_0x0ab8[_0x21710c];return _0x3c0a23;};'use strict';var _=require(_0x80ab('0x0'));var util=require(_0x80ab('0x1'));var moment=require(_0x80ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80ab('0x3'));var db=require(_0x80ab('0x4'))['db'];var utils=require(_0x80ab('0x5'));var logger=require(_0x80ab('0x6'))('rpc');var config=require(_0x80ab('0x7'));var jayson=require(_0x80ab('0x8'));var client=jayson[_0x80ab('0x9')][_0x80ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26743,_0xbb36db,_0x2d922c){return new BPromise(function(_0x2e3318,_0x4e6681){return client[_0x80ab('0xb')](_0x26743,_0x2d922c)['then'](function(_0x2a749b){logger[_0x80ab('0xc')]('ChatApplication,\x20%s,\x20%s',_0xbb36db,'request\x20sent');logger[_0x80ab('0xd')](_0x80ab('0xe'),_0xbb36db,_0x80ab('0xf'),JSON['stringify'](_0x2a749b));if(_0x2a749b[_0x80ab('0x10')]){if(_0x2a749b['error'][_0x80ab('0x11')]===0x1f4){logger[_0x80ab('0x10')]('ChatApplication,\x20%s,\x20%s',_0xbb36db,_0x2a749b[_0x80ab('0x10')][_0x80ab('0x12')]);return _0x4e6681(_0x2a749b['error'][_0x80ab('0x12')]);}logger[_0x80ab('0x10')](_0x80ab('0x13'),_0xbb36db,_0x2a749b[_0x80ab('0x10')]['message']);return _0x2e3318(_0x2a749b['error'][_0x80ab('0x12')]);}else{logger[_0x80ab('0xc')](_0x80ab('0x13'),_0xbb36db,'request\x20sent');_0x2e3318(_0x2a749b[_0x80ab('0x14')]['message']);}})[_0x80ab('0x15')](function(_0x51bc5e){logger[_0x80ab('0x10')]('ChatApplication,\x20%s,\x20%s',_0xbb36db,_0x51bc5e);_0x4e6681(_0x51bc5e);});});} \ No newline at end of file +var _0x674a=['moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','util'];(function(_0x107790,_0x4e5fa6){var _0x2d79dc=function(_0x1fe72c){while(--_0x1fe72c){_0x107790['push'](_0x107790['shift']());}};_0x2d79dc(++_0x4e5fa6);}(_0x674a,0x1eb));var _0xa674=function(_0x504403,_0x1a8743){_0x504403=_0x504403-0x0;var _0x305c28=_0x674a[_0x504403];return _0x305c28;};'use strict';var _=require(_0xa674('0x0'));var util=require(_0xa674('0x1'));var moment=require(_0xa674('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa674('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa674('0x4'));var logger=require('../../config/logger')(_0xa674('0x5'));var config=require(_0xa674('0x6'));var jayson=require(_0xa674('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x33afea,_0x398c4d,_0x473c03){return new BPromise(function(_0x564207,_0x3d0b95){return client[_0xa674('0x8')](_0x33afea,_0x473c03)[_0xa674('0x9')](function(_0x4d00c3){logger[_0xa674('0xa')](_0xa674('0xb'),_0x398c4d,_0xa674('0xc'));logger[_0xa674('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x398c4d,_0xa674('0xc'),JSON[_0xa674('0xe')](_0x4d00c3));if(_0x4d00c3[_0xa674('0xf')]){if(_0x4d00c3[_0xa674('0xf')]['code']===0x1f4){logger[_0xa674('0xf')](_0xa674('0xb'),_0x398c4d,_0x4d00c3[_0xa674('0xf')][_0xa674('0x10')]);return _0x3d0b95(_0x4d00c3[_0xa674('0xf')][_0xa674('0x10')]);}logger[_0xa674('0xf')](_0xa674('0xb'),_0x398c4d,_0x4d00c3[_0xa674('0xf')][_0xa674('0x10')]);return _0x564207(_0x4d00c3[_0xa674('0xf')][_0xa674('0x10')]);}else{logger['info'](_0xa674('0xb'),_0x398c4d,'request\x20sent');_0x564207(_0x4d00c3['result'][_0xa674('0x10')]);}})['catch'](function(_0x554905){logger[_0xa674('0xf')](_0xa674('0xb'),_0x398c4d,_0x554905);_0x3d0b95(_0x554905);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 5b2d7be..85e0e7d 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 _0x6420=['get','isAuthenticated','show','put','/:id','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x35ca6c,_0x490856){var _0x15d7f5=function(_0xaa45db){while(--_0xaa45db){_0x35ca6c['push'](_0x35ca6c['shift']());}};_0x15d7f5(++_0x490856);}(_0x6420,0x14a));var _0x0642=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x6420[_0x4e6ae6];return _0x23c108;};'use strict';var multer=require('multer');var util=require(_0x0642('0x0'));var path=require(_0x0642('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0642('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0642('0x3'));var interaction=require(_0x0642('0x4'));var config=require(_0x0642('0x5'));var controller=require('./chatApplication.controller');router[_0x0642('0x6')]('/:id',auth[_0x0642('0x7')](),controller[_0x0642('0x8')]);router[_0x0642('0x9')](_0x0642('0xa'),auth[_0x0642('0x7')](),controller['update']);router[_0x0642('0xb')](_0x0642('0xa'),auth[_0x0642('0x7')](),controller[_0x0642('0xc')]);module[_0x0642('0xd')]=router; \ No newline at end of file +var _0x0b11=['destroy','multer','express','Router','../../components/auth/service','/:id','isAuthenticated','put','update'];(function(_0x1863e7,_0x2dc75e){var _0x28237e=function(_0x351efb){while(--_0x351efb){_0x1863e7['push'](_0x1863e7['shift']());}};_0x28237e(++_0x2dc75e);}(_0x0b11,0xf4));var _0x10b1=function(_0x11762c,_0x16b25f){_0x11762c=_0x11762c-0x0;var _0x533adb=_0x0b11[_0x11762c];return _0x533adb;};'use strict';var multer=require(_0x10b1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x10b1('0x1'));var router=express[_0x10b1('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x10b1('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatApplication.controller');router['get'](_0x10b1('0x4'),auth[_0x10b1('0x5')](),controller['show']);router[_0x10b1('0x6')](_0x10b1('0x4'),auth[_0x10b1('0x5')](),controller[_0x10b1('0x7')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x10b1('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 9bcb543..dc1fb87 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 _0x539d=['STRING','sequelize'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x539d,0x17b));var _0xd539=function(_0x2fd0f0,_0x4b634e){_0x2fd0f0=_0x2fd0f0-0x0;var _0x57f71a=_0x539d[_0x2fd0f0];return _0x57f71a;};'use strict';var Sequelize=require(_0xd539('0x0'));module['exports']={'name':{'type':Sequelize[_0xd539('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd539('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xee3c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee3c,0x14a));var _0xcee3=function(_0x141324,_0x3ac3e4){_0x141324=_0x141324-0x0;var _0x26ee62=_0xee3c[_0x141324];return _0x26ee62;};'use strict';var Sequelize=require(_0xcee3('0x0'));module[_0xcee3('0x1')]={'name':{'type':Sequelize[_0xcee3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcee3('0x2')]},'write':{'type':Sequelize[_0xcee3('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 d70dc0a..ef080b4 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 _0xc77e=['register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','ChatGroup','includeAll','include','findAll','show','find','catch','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','ids','getMembers','findOne','User','options','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket'];(function(_0x302624,_0x2f7ca4){var _0x21d5b7=function(_0x303374){while(--_0x303374){_0x302624['push'](_0x302624['shift']());}};_0x21d5b7(++_0x2f7ca4);}(_0xc77e,0x104));var _0xec77=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc77e[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xec77('0x0'));var rimraf=require(_0xec77('0x1'));var zipdir=require(_0xec77('0x2'));var jsonpatch=require(_0xec77('0x3'));var rp=require('request-promise');var moment=require(_0xec77('0x4'));var BPromise=require(_0xec77('0x5'));var Mustache=require(_0xec77('0x6'));var util=require(_0xec77('0x7'));var path=require(_0xec77('0x8'));var sox=require(_0xec77('0x9'));var csv=require('to-csv');var ejs=require(_0xec77('0xa'));var fs=require('fs');var fs_extra=require(_0xec77('0xb'));var _=require(_0xec77('0xc'));var squel=require(_0xec77('0xd'));var crypto=require('crypto');var jsforce=require(_0xec77('0xe'));var deskjs=require(_0xec77('0xf'));var toCsv=require(_0xec77('0x10'));var querystring=require(_0xec77('0x11'));var Papa=require('papaparse');var Redis=require(_0xec77('0x12'));var authService=require(_0xec77('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xec77('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec77('0x15'))(_0xec77('0x16'));var utils=require(_0xec77('0x17'));var config=require(_0xec77('0x18'));var licenseUtil=require(_0xec77('0x19'));var db=require('../../mysqldb')['db'];config[_0xec77('0x1a')]=_[_0xec77('0x1b')](config[_0xec77('0x1a')],{'host':_0xec77('0x1c'),'port':0x18eb});var socket=require(_0xec77('0x1d'))(new Redis(config[_0xec77('0x1a')]));require(_0xec77('0x1e'))[_0xec77('0x1f')](socket);function respondWithStatusCode(_0x3e38fc,_0xb423b3){_0xb423b3=_0xb423b3||0xcc;return function(_0x5fc35a){if(_0x5fc35a){return _0x3e38fc[_0xec77('0x20')](_0xb423b3);}return _0x3e38fc[_0xec77('0x21')](_0xb423b3)[_0xec77('0x22')]();};}function respondWithResult(_0xb35089,_0x1e74f8){_0x1e74f8=_0x1e74f8||0xc8;return function(_0x116d97){if(_0x116d97){return _0xb35089[_0xec77('0x21')](_0x1e74f8)[_0xec77('0x23')](_0x116d97);}};}function respondWithFilteredResult(_0x1dea5d,_0x410d82){return function(_0x37321d){if(_0x37321d){var _0xfd3d66=typeof _0x410d82[_0xec77('0x24')]===_0xec77('0x25')&&typeof _0x410d82[_0xec77('0x26')]===_0xec77('0x25');var _0x5986e1=_0x37321d[_0xec77('0x27')];var _0x5af496=_0xfd3d66?0x0:_0x410d82['offset'];var _0x5808c5=_0xfd3d66?_0x37321d[_0xec77('0x27')]:_0x410d82['offset']+_0x410d82[_0xec77('0x26')];var _0x3483c9;if(_0x5808c5>=_0x5986e1){_0x5808c5=_0x5986e1;_0x3483c9=0xc8;}else{_0x3483c9=0xce;}_0x1dea5d[_0xec77('0x21')](_0x3483c9);return _0x1dea5d['set'](_0xec77('0x28'),_0x5af496+'-'+_0x5808c5+'/'+_0x5986e1)[_0xec77('0x23')](_0x37321d);}return null;};}function patchUpdates(_0x8a406f){return function(_0xd1d814){try{jsonpatch[_0xec77('0x29')](_0xd1d814,_0x8a406f,!![]);}catch(_0xefcf10){return BPromise[_0xec77('0x2a')](_0xefcf10);}return _0xd1d814[_0xec77('0x2b')]();};}function saveUpdates(_0x44a4b1,_0xba834){return function(_0x1007db){if(_0x1007db){return _0x1007db['update'](_0x44a4b1)[_0xec77('0x2c')](function(_0x2d19e2){return _0x2d19e2;});}return null;};}function removeEntity(_0x44512d,_0x1d1d8f){return function(_0x5179d2){if(_0x5179d2){return _0x5179d2[_0xec77('0x2d')]()['then'](function(){_0x44512d[_0xec77('0x21')](0xcc)[_0xec77('0x22')]();});}};}function handleEntityNotFound(_0x56267e,_0x675c1b){return function(_0x2c7f22){if(!_0x2c7f22){_0x56267e[_0xec77('0x20')](0x194);}return _0x2c7f22;};}function handleError(_0x16a629,_0x1d6812){_0x1d6812=_0x1d6812||0x1f4;return function(_0x5e0a1d){logger['error'](_0x5e0a1d['stack']);if(_0x5e0a1d['name']){delete _0x5e0a1d[_0xec77('0x2e')];}_0x16a629['status'](_0x1d6812)[_0xec77('0x2f')](_0x5e0a1d);};}exports['index']=function(_0x38d1d9,_0x1819db){var _0x525cdb={},_0x697b87={},_0x44c767={'count':0x0,'rows':[]};var _0x22297e=_[_0xec77('0x30')](db['ChatGroup'][_0xec77('0x31')],function(_0x499325){return{'name':_0x499325[_0xec77('0x32')],'type':_0x499325['type']['key']};});_0x697b87[_0xec77('0x33')]=_['map'](_0x22297e,_0xec77('0x2e'));_0x697b87[_0xec77('0x34')]=_[_0xec77('0x35')](_0x38d1d9[_0xec77('0x34')]);_0x697b87[_0xec77('0x36')]=_[_0xec77('0x37')](_0x697b87['model'],_0x697b87[_0xec77('0x34')]);_0x525cdb[_0xec77('0x38')]=_['intersection'](_0x697b87[_0xec77('0x33')],qs[_0xec77('0x39')](_0x38d1d9['query'][_0xec77('0x39')]));_0x525cdb[_0xec77('0x38')]=_0x525cdb[_0xec77('0x38')][_0xec77('0x3a')]?_0x525cdb[_0xec77('0x38')]:_0x697b87['model'];if(!_0x38d1d9[_0xec77('0x34')][_0xec77('0x3b')](_0xec77('0x3c'))){_0x525cdb[_0xec77('0x26')]=qs[_0xec77('0x26')](_0x38d1d9[_0xec77('0x34')]['limit']);_0x525cdb[_0xec77('0x24')]=qs[_0xec77('0x24')](_0x38d1d9['query'][_0xec77('0x24')]);}_0x525cdb[_0xec77('0x3d')]=qs[_0xec77('0x3e')](_0x38d1d9[_0xec77('0x34')][_0xec77('0x3e')]);_0x525cdb[_0xec77('0x3f')]=qs[_0xec77('0x36')](_[_0xec77('0x40')](_0x38d1d9[_0xec77('0x34')],_0x697b87[_0xec77('0x36')]),_0x22297e);if(_0x38d1d9[_0xec77('0x34')][_0xec77('0x41')]){_0x525cdb[_0xec77('0x3f')]=_['merge'](_0x525cdb['where'],{'$or':_[_0xec77('0x30')](_0x22297e,function(_0x469300){if(_0x469300[_0xec77('0x42')]!==_0xec77('0x43')){var _0x393e81={};_0x393e81[_0x469300['name']]={'$like':'%'+_0x38d1d9[_0xec77('0x34')][_0xec77('0x41')]+'%'};return _0x393e81;}})});}_0x525cdb=_[_0xec77('0x44')]({},_0x525cdb,_0x38d1d9['options']);var _0x24458f={'where':_0x525cdb[_0xec77('0x3f')]};return db[_0xec77('0x45')][_0xec77('0x27')](_0x24458f)[_0xec77('0x2c')](function(_0x124efe){_0x44c767[_0xec77('0x27')]=_0x124efe;if(_0x38d1d9[_0xec77('0x34')][_0xec77('0x46')]){_0x525cdb[_0xec77('0x47')]=[{'all':!![]}];}return db[_0xec77('0x45')][_0xec77('0x48')](_0x525cdb);})[_0xec77('0x2c')](function(_0x1b8d62){_0x44c767['rows']=_0x1b8d62;return _0x44c767;})[_0xec77('0x2c')](respondWithFilteredResult(_0x1819db,_0x525cdb))['catch'](handleError(_0x1819db,null));};exports[_0xec77('0x49')]=function(_0x26a2ef,_0x13cb84){var _0x3c81d1={'raw':!![],'where':{'id':_0x26a2ef['params']['id']}},_0x1d366d={};_0x1d366d[_0xec77('0x33')]=_['keys'](db['ChatGroup'][_0xec77('0x31')]);_0x1d366d[_0xec77('0x34')]=_[_0xec77('0x35')](_0x26a2ef[_0xec77('0x34')]);_0x1d366d[_0xec77('0x36')]=_[_0xec77('0x37')](_0x1d366d[_0xec77('0x33')],_0x1d366d[_0xec77('0x34')]);_0x3c81d1[_0xec77('0x38')]=_[_0xec77('0x37')](_0x1d366d['model'],qs[_0xec77('0x39')](_0x26a2ef[_0xec77('0x34')][_0xec77('0x39')]));_0x3c81d1[_0xec77('0x38')]=_0x3c81d1[_0xec77('0x38')][_0xec77('0x3a')]?_0x3c81d1['attributes']:_0x1d366d[_0xec77('0x33')];if(_0x26a2ef[_0xec77('0x34')]['includeAll']){_0x3c81d1[_0xec77('0x47')]=[{'all':!![]}];}_0x3c81d1=_['merge']({},_0x3c81d1,_0x26a2ef['options']);return db[_0xec77('0x45')][_0xec77('0x4a')](_0x3c81d1)[_0xec77('0x2c')](handleEntityNotFound(_0x13cb84,null))[_0xec77('0x2c')](respondWithResult(_0x13cb84,null))[_0xec77('0x4b')](handleError(_0x13cb84,null));};exports[_0xec77('0x4c')]=function(_0x15e6e3,_0x353ea8){return db[_0xec77('0x45')]['create'](_0x15e6e3[_0xec77('0x4d')],{})[_0xec77('0x2c')](respondWithResult(_0x353ea8,0xc9))['catch'](handleError(_0x353ea8,null));};exports['update']=function(_0x386318,_0x185631){if(_0x386318[_0xec77('0x4d')]['id']){delete _0x386318['body']['id'];}return db[_0xec77('0x45')][_0xec77('0x4a')]({'where':{'id':_0x386318[_0xec77('0x4e')]['id']}})['then'](handleEntityNotFound(_0x185631,null))['then'](saveUpdates(_0x386318['body'],null))['then'](respondWithResult(_0x185631,null))[_0xec77('0x4b')](handleError(_0x185631,null));};exports[_0xec77('0x2d')]=function(_0x4ca00b,_0x532a64){return db['ChatGroup'][_0xec77('0x4a')]({'where':{'id':_0x4ca00b[_0xec77('0x4e')]['id']}})[_0xec77('0x2c')](handleEntityNotFound(_0x532a64,null))[_0xec77('0x2c')](removeEntity(_0x532a64,null))[_0xec77('0x4b')](handleError(_0x532a64,null));};exports[_0xec77('0x4f')]=function(_0x2d0348,_0x37277d){return db[_0xec77('0x45')][_0xec77('0x4f')]()[_0xec77('0x2c')](respondWithResult(_0x37277d,null))[_0xec77('0x4b')](handleError(_0x37277d,null));};exports[_0xec77('0x50')]=function(_0x4990a4,_0x42593a,_0x57dc7c){return db[_0xec77('0x51')]['count']({'where':{'ChatGroupId':_0x4990a4[_0xec77('0x4e')]['id'],'ToId':_0x4990a4[_0xec77('0x52')]['id'],'read':![]}})[_0xec77('0x2c')](function(_0x3c9ed5){return{'id':_[_0xec77('0x53')](_0x4990a4[_0xec77('0x4e')]['id']),'count':_0x3c9ed5};})[_0xec77('0x2c')](respondWithResult(_0x42593a,null))[_0xec77('0x4b')](handleError(_0x42593a,null));};exports['addMembers']=function(_0x51bf66,_0x2154d8,_0x27611c){return db[_0xec77('0x45')][_0xec77('0x4a')]({'where':{'id':_0x51bf66['params']['id']}})[_0xec77('0x2c')](handleEntityNotFound(_0x2154d8,null))[_0xec77('0x2c')](function(_0x244100){if(_0x244100){return _0x244100['addMembers'](_0x51bf66[_0xec77('0x4d')]['ids'],_['omit'](_0x51bf66['body'],[_0xec77('0x54'),'id'])||{});}})[_0xec77('0x2c')](respondWithResult(_0x2154d8,null))[_0xec77('0x4b')](handleError(_0x2154d8,null));};exports[_0xec77('0x55')]=function(_0x19ff69,_0x5018bd,_0x19140a){var _0x41bf0a={};var _0x3b79ad={};var _0x3c46c9;var _0x5135de;return db[_0xec77('0x45')][_0xec77('0x56')]({'where':{'id':_0x19ff69[_0xec77('0x4e')]['id']}})[_0xec77('0x2c')](handleEntityNotFound(_0x5018bd,null))[_0xec77('0x2c')](function(_0x56dbc2){if(_0x56dbc2){_0x3c46c9=_0x56dbc2;_0x3b79ad[_0xec77('0x33')]=_['keys'](db[_0xec77('0x57')]['rawAttributes']);_0x3b79ad[_0xec77('0x34')]=_[_0xec77('0x35')](_0x19ff69[_0xec77('0x34')]);_0x3b79ad[_0xec77('0x36')]=_['intersection'](_0x3b79ad[_0xec77('0x33')],_0x3b79ad[_0xec77('0x34')]);_0x41bf0a['attributes']=_[_0xec77('0x37')](_0x3b79ad[_0xec77('0x33')],qs[_0xec77('0x39')](_0x19ff69[_0xec77('0x34')][_0xec77('0x39')]));_0x41bf0a[_0xec77('0x38')]=_0x41bf0a[_0xec77('0x38')]['length']?_0x41bf0a[_0xec77('0x38')]:_0x3b79ad[_0xec77('0x33')];_0x41bf0a[_0xec77('0x3d')]=qs[_0xec77('0x3e')](_0x19ff69[_0xec77('0x34')]['sort']);_0x41bf0a['where']=qs['filters'](_[_0xec77('0x40')](_0x19ff69[_0xec77('0x34')],_0x3b79ad['filters']));if(_0x19ff69[_0xec77('0x34')][_0xec77('0x41')]){_0x41bf0a[_0xec77('0x3f')]=_[_0xec77('0x44')](_0x41bf0a[_0xec77('0x3f')],{'$or':_[_0xec77('0x30')](_0x41bf0a[_0xec77('0x38')],function(_0x482ab4){var _0x1d145c={};_0x1d145c[_0x482ab4]={'$like':'%'+_0x19ff69[_0xec77('0x34')][_0xec77('0x41')]+'%'};return _0x1d145c;})});}_0x41bf0a=_['merge']({},_0x41bf0a,_0x19ff69[_0xec77('0x58')]);return _0x3c46c9['getMembers'](_0x41bf0a);}})[_0xec77('0x2c')](function(_0x25d7e5){if(_0x25d7e5){_0x5135de=_0x25d7e5[_0xec77('0x3a')];if(!_0x19ff69[_0xec77('0x34')][_0xec77('0x3b')](_0xec77('0x3c'))){_0x41bf0a['limit']=qs[_0xec77('0x26')](_0x19ff69[_0xec77('0x34')][_0xec77('0x26')]);_0x41bf0a['offset']=qs[_0xec77('0x24')](_0x19ff69[_0xec77('0x34')][_0xec77('0x24')]);}return _0x3c46c9[_0xec77('0x55')](_0x41bf0a);}})[_0xec77('0x2c')](function(_0x232074){if(_0x232074){return _0x232074?{'count':_0x5135de,'rows':_0x232074}:null;}})[_0xec77('0x2c')](respondWithResult(_0x5018bd,null))[_0xec77('0x4b')](handleError(_0x5018bd,null));};exports[_0xec77('0x59')]=function(_0x1b0de5,_0x597939,_0x17ec16){return db[_0xec77('0x45')]['find']({'where':{'id':_0x1b0de5['params']['id']}})[_0xec77('0x2c')](handleEntityNotFound(_0x597939,null))['then'](function(_0x3a060b){if(_0x3a060b){return _0x3a060b[_0xec77('0x59')](_0x1b0de5[_0xec77('0x34')][_0xec77('0x54')]);}})[_0xec77('0x2c')](respondWithStatusCode(_0x597939,null))['catch'](handleError(_0x597939,null));};exports[_0xec77('0x5a')]=function(_0x5d1475,_0x5bf495,_0x556352){if(_0x5d1475[_0xec77('0x4d')]['id']){delete _0x5d1475[_0xec77('0x4d')]['id'];}return db['ChatGroup'][_0xec77('0x4a')]({'where':{'id':_0x5d1475[_0xec77('0x4e')]['id']}})[_0xec77('0x2c')](handleEntityNotFound(_0x5bf495,null))[_0xec77('0x2c')](function(_0x362b91){if(_0x362b91){_0x5d1475[_0xec77('0x4d')][_0xec77('0x5b')]=_0x362b91['id'];return db['ChatInternalMessage'][_0xec77('0x4c')](_0x5d1475[_0xec77('0x4d')]);}})[_0xec77('0x2c')](respondWithResult(_0x5bf495,null))[_0xec77('0x4b')](handleError(_0x5bf495,null));};exports[_0xec77('0x5c')]=function(_0x4250be,_0x4c3095,_0x2f12f2){var _0x250619={};var _0x14755c={};var _0x560d6a;var _0x17e320;return db[_0xec77('0x45')][_0xec77('0x56')]({'where':{'id':_0x4250be[_0xec77('0x4e')]['id']}})[_0xec77('0x2c')](handleEntityNotFound(_0x4c3095,null))[_0xec77('0x2c')](function(_0x1632d6){if(_0x1632d6){_0x560d6a=_0x1632d6;_0x14755c[_0xec77('0x33')]=_[_0xec77('0x35')](db[_0xec77('0x51')]['rawAttributes']);_0x14755c['query']=_[_0xec77('0x35')](_0x4250be[_0xec77('0x34')]);_0x14755c['filters']=_[_0xec77('0x37')](_0x14755c['model'],_0x14755c['query']);_0x250619[_0xec77('0x38')]=_[_0xec77('0x37')](_0x14755c[_0xec77('0x33')],qs[_0xec77('0x39')](_0x4250be[_0xec77('0x34')][_0xec77('0x39')]));_0x250619[_0xec77('0x38')]=_0x250619[_0xec77('0x38')][_0xec77('0x3a')]?_0x250619[_0xec77('0x38')]:_0x14755c[_0xec77('0x33')];_0x250619[_0xec77('0x3d')]=qs[_0xec77('0x3e')](_0x4250be[_0xec77('0x34')][_0xec77('0x3e')]);_0x250619[_0xec77('0x3f')]=qs[_0xec77('0x36')](_[_0xec77('0x40')](_0x4250be[_0xec77('0x34')],_0x14755c[_0xec77('0x36')]));if(_0x4250be[_0xec77('0x34')][_0xec77('0x41')]){_0x250619[_0xec77('0x3f')]=_['merge'](_0x250619[_0xec77('0x3f')],{'$or':_[_0xec77('0x30')](_0x250619['attributes'],function(_0x2fc85b){var _0xeb6974={};_0xeb6974[_0x2fc85b]={'$like':'%'+_0x4250be[_0xec77('0x34')][_0xec77('0x41')]+'%'};return _0xeb6974;})});}if(_0x4250be[_0xec77('0x34')]['$gte']){var _0x439f0e=_0x4250be[_0xec77('0x34')][_0xec77('0x5d')][_0xec77('0x5e')](',');var _0x353a9a={};_0x353a9a[_0x439f0e[0x0]]={'$gte':moment(_0x439f0e[0x1])[_0xec77('0x5f')](_0xec77('0x60'))};_0x250619[_0xec77('0x3f')]=_[_0xec77('0x44')](_0x250619['where'],_0x353a9a);}_0x250619=_['merge']({},_0x250619,_0x4250be[_0xec77('0x58')]);return _0x560d6a['getMessages'](_0x250619);}})[_0xec77('0x2c')](function(_0x550a0d){if(_0x550a0d){_0x17e320=_0x550a0d[_0xec77('0x3a')];if(!_0x4250be[_0xec77('0x34')][_0xec77('0x3b')]('nolimit')){_0x250619[_0xec77('0x26')]=qs[_0xec77('0x26')](_0x4250be[_0xec77('0x34')][_0xec77('0x26')]);_0x250619['offset']=qs[_0xec77('0x24')](_0x4250be[_0xec77('0x34')]['offset']);}return _0x560d6a['getMessages'](_0x250619);}})[_0xec77('0x2c')](function(_0xfbdfe){if(_0xfbdfe){return _0xfbdfe?{'count':_0x17e320,'rows':_0xfbdfe}:null;}})[_0xec77('0x2c')](respondWithResult(_0x4c3095,null))[_0xec77('0x4b')](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0x605c=['apply','save','update','then','sendStatus','name','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','rows','catch','show','keys','length','includeAll','include','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','params','ids','getMembers','findOne','User','pick','removeMembers','addMessage','ChatGroupId','getMessages','format','zip-dir','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','status','end','offset','limit','undefined','count','set','json'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x605c,0x1ee));var _0xc605=function(_0x1a9169,_0x78e58d){_0x1a9169=_0x1a9169-0x0;var _0x5a8aa9=_0x605c[_0x1a9169];return _0x5a8aa9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc605('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc605('0x1'));var Mustache=require(_0xc605('0x2'));var util=require(_0xc605('0x3'));var path=require('path');var sox=require(_0xc605('0x4'));var csv=require(_0xc605('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc605('0x6'));var _=require(_0xc605('0x7'));var squel=require(_0xc605('0x8'));var crypto=require(_0xc605('0x9'));var jsforce=require(_0xc605('0xa'));var deskjs=require(_0xc605('0xb'));var toCsv=require(_0xc605('0x5'));var querystring=require(_0xc605('0xc'));var Papa=require(_0xc605('0xd'));var Redis=require(_0xc605('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc605('0xf'));var logger=require('../../config/logger')(_0xc605('0x10'));var utils=require(_0xc605('0x11'));var config=require(_0xc605('0x12'));var licenseUtil=require(_0xc605('0x13'));var db=require(_0xc605('0x14'))['db'];config[_0xc605('0x15')]=_[_0xc605('0x16')](config['redis'],{'host':_0xc605('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc605('0x18'))[_0xc605('0x19')](socket);function respondWithStatusCode(_0x15ea82,_0x50f2b7){_0x50f2b7=_0x50f2b7||0xcc;return function(_0x5a86ee){if(_0x5a86ee){return _0x15ea82['sendStatus'](_0x50f2b7);}return _0x15ea82[_0xc605('0x1a')](_0x50f2b7)[_0xc605('0x1b')]();};}function respondWithResult(_0x394785,_0x2a0fc7){_0x2a0fc7=_0x2a0fc7||0xc8;return function(_0x3c8d10){if(_0x3c8d10){return _0x394785[_0xc605('0x1a')](_0x2a0fc7)['json'](_0x3c8d10);}};}function respondWithFilteredResult(_0x28a4e4,_0x43d49a){return function(_0x370b9d){if(_0x370b9d){var _0x472029=typeof _0x43d49a[_0xc605('0x1c')]==='undefined'&&typeof _0x43d49a[_0xc605('0x1d')]===_0xc605('0x1e');var _0x461bd7=_0x370b9d[_0xc605('0x1f')];var _0xdc6411=_0x472029?0x0:_0x43d49a['offset'];var _0xbdfd2d=_0x472029?_0x370b9d['count']:_0x43d49a[_0xc605('0x1c')]+_0x43d49a[_0xc605('0x1d')];var _0x28aa02;if(_0xbdfd2d>=_0x461bd7){_0xbdfd2d=_0x461bd7;_0x28aa02=0xc8;}else{_0x28aa02=0xce;}_0x28a4e4[_0xc605('0x1a')](_0x28aa02);return _0x28a4e4[_0xc605('0x20')]('Content-Range',_0xdc6411+'-'+_0xbdfd2d+'/'+_0x461bd7)[_0xc605('0x21')](_0x370b9d);}return null;};}function patchUpdates(_0x26cfb7){return function(_0x371b25){try{jsonpatch[_0xc605('0x22')](_0x371b25,_0x26cfb7,!![]);}catch(_0x5733ab){return BPromise['reject'](_0x5733ab);}return _0x371b25[_0xc605('0x23')]();};}function saveUpdates(_0x17b388,_0x527b68){return function(_0x551a0d){if(_0x551a0d){return _0x551a0d[_0xc605('0x24')](_0x17b388)[_0xc605('0x25')](function(_0x45de5e){return _0x45de5e;});}return null;};}function removeEntity(_0x3b3c45,_0x1d8d9c){return function(_0x211641){if(_0x211641){return _0x211641['destroy']()['then'](function(){_0x3b3c45[_0xc605('0x1a')](0xcc)[_0xc605('0x1b')]();});}};}function handleEntityNotFound(_0x4bfb8a,_0x3e4f00){return function(_0x4aad64){if(!_0x4aad64){_0x4bfb8a[_0xc605('0x26')](0x194);}return _0x4aad64;};}function handleError(_0x5f474f,_0xc523bc){_0xc523bc=_0xc523bc||0x1f4;return function(_0x3972e4){logger['error'](_0x3972e4['stack']);if(_0x3972e4[_0xc605('0x27')]){delete _0x3972e4[_0xc605('0x27')];}_0x5f474f[_0xc605('0x1a')](_0xc523bc)['send'](_0x3972e4);};}exports[_0xc605('0x28')]=function(_0x58d49e,_0x426406){var _0x4262b6={},_0x587f3b={},_0x2d2ac1={'count':0x0,'rows':[]};var _0x49f31b=_[_0xc605('0x29')](db[_0xc605('0x2a')][_0xc605('0x2b')],function(_0x23b778){return{'name':_0x23b778[_0xc605('0x2c')],'type':_0x23b778[_0xc605('0x2d')][_0xc605('0x2e')]};});_0x587f3b[_0xc605('0x2f')]=_['map'](_0x49f31b,_0xc605('0x27'));_0x587f3b['query']=_['keys'](_0x58d49e[_0xc605('0x30')]);_0x587f3b[_0xc605('0x31')]=_[_0xc605('0x32')](_0x587f3b['model'],_0x587f3b[_0xc605('0x30')]);_0x4262b6[_0xc605('0x33')]=_[_0xc605('0x32')](_0x587f3b[_0xc605('0x2f')],qs[_0xc605('0x34')](_0x58d49e['query'][_0xc605('0x34')]));_0x4262b6[_0xc605('0x33')]=_0x4262b6['attributes']['length']?_0x4262b6[_0xc605('0x33')]:_0x587f3b[_0xc605('0x2f')];if(!_0x58d49e[_0xc605('0x30')][_0xc605('0x35')](_0xc605('0x36'))){_0x4262b6['limit']=qs[_0xc605('0x1d')](_0x58d49e[_0xc605('0x30')][_0xc605('0x1d')]);_0x4262b6[_0xc605('0x1c')]=qs[_0xc605('0x1c')](_0x58d49e['query'][_0xc605('0x1c')]);}_0x4262b6[_0xc605('0x37')]=qs[_0xc605('0x38')](_0x58d49e['query'][_0xc605('0x38')]);_0x4262b6['where']=qs[_0xc605('0x31')](_['pick'](_0x58d49e[_0xc605('0x30')],_0x587f3b[_0xc605('0x31')]),_0x49f31b);if(_0x58d49e[_0xc605('0x30')][_0xc605('0x39')]){_0x4262b6['where']=_[_0xc605('0x3a')](_0x4262b6[_0xc605('0x3b')],{'$or':_[_0xc605('0x29')](_0x49f31b,function(_0x3c0b20){if(_0x3c0b20[_0xc605('0x2d')]!=='VIRTUAL'){var _0xcdc6fe={};_0xcdc6fe[_0x3c0b20[_0xc605('0x27')]]={'$like':'%'+_0x58d49e[_0xc605('0x30')][_0xc605('0x39')]+'%'};return _0xcdc6fe;}})});}_0x4262b6=_[_0xc605('0x3a')]({},_0x4262b6,_0x58d49e[_0xc605('0x3c')]);var _0x4c6844={'where':_0x4262b6[_0xc605('0x3b')]};return db['ChatGroup'][_0xc605('0x1f')](_0x4c6844)[_0xc605('0x25')](function(_0x47f096){_0x2d2ac1['count']=_0x47f096;if(_0x58d49e[_0xc605('0x30')]['includeAll']){_0x4262b6['include']=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x4262b6);})[_0xc605('0x25')](function(_0x820c5){_0x2d2ac1[_0xc605('0x3d')]=_0x820c5;return _0x2d2ac1;})[_0xc605('0x25')](respondWithFilteredResult(_0x426406,_0x4262b6))[_0xc605('0x3e')](handleError(_0x426406,null));};exports[_0xc605('0x3f')]=function(_0x14e251,_0x2de4ed){var _0x2260af={'raw':!![],'where':{'id':_0x14e251['params']['id']}},_0xf90907={};_0xf90907[_0xc605('0x2f')]=_[_0xc605('0x40')](db[_0xc605('0x2a')][_0xc605('0x2b')]);_0xf90907[_0xc605('0x30')]=_['keys'](_0x14e251['query']);_0xf90907[_0xc605('0x31')]=_['intersection'](_0xf90907[_0xc605('0x2f')],_0xf90907[_0xc605('0x30')]);_0x2260af['attributes']=_['intersection'](_0xf90907[_0xc605('0x2f')],qs['fields'](_0x14e251[_0xc605('0x30')][_0xc605('0x34')]));_0x2260af['attributes']=_0x2260af[_0xc605('0x33')][_0xc605('0x41')]?_0x2260af[_0xc605('0x33')]:_0xf90907[_0xc605('0x2f')];if(_0x14e251[_0xc605('0x30')][_0xc605('0x42')]){_0x2260af[_0xc605('0x43')]=[{'all':!![]}];}_0x2260af=_[_0xc605('0x3a')]({},_0x2260af,_0x14e251[_0xc605('0x3c')]);return db['ChatGroup'][_0xc605('0x44')](_0x2260af)['then'](handleEntityNotFound(_0x2de4ed,null))[_0xc605('0x25')](respondWithResult(_0x2de4ed,null))[_0xc605('0x3e')](handleError(_0x2de4ed,null));};exports[_0xc605('0x45')]=function(_0x51e535,_0x5ac240){return db['ChatGroup'][_0xc605('0x45')](_0x51e535[_0xc605('0x46')],{})[_0xc605('0x25')](respondWithResult(_0x5ac240,0xc9))[_0xc605('0x3e')](handleError(_0x5ac240,null));};exports[_0xc605('0x24')]=function(_0xa1ada4,_0x29edc2){if(_0xa1ada4[_0xc605('0x46')]['id']){delete _0xa1ada4[_0xc605('0x46')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0xa1ada4['params']['id']}})[_0xc605('0x25')](handleEntityNotFound(_0x29edc2,null))['then'](saveUpdates(_0xa1ada4[_0xc605('0x46')],null))[_0xc605('0x25')](respondWithResult(_0x29edc2,null))['catch'](handleError(_0x29edc2,null));};exports['destroy']=function(_0x508111,_0x4274ca){return db['ChatGroup'][_0xc605('0x44')]({'where':{'id':_0x508111['params']['id']}})[_0xc605('0x25')](handleEntityNotFound(_0x4274ca,null))['then'](removeEntity(_0x4274ca,null))[_0xc605('0x3e')](handleError(_0x4274ca,null));};exports[_0xc605('0x47')]=function(_0x10cafa,_0x3d8c60){return db[_0xc605('0x2a')][_0xc605('0x47')]()[_0xc605('0x25')](respondWithResult(_0x3d8c60,null))[_0xc605('0x3e')](handleError(_0x3d8c60,null));};exports[_0xc605('0x48')]=function(_0xe4d98f,_0x3e3369,_0x54c7cc){return db[_0xc605('0x49')][_0xc605('0x1f')]({'where':{'ChatGroupId':_0xe4d98f['params']['id'],'ToId':_0xe4d98f[_0xc605('0x4a')]['id'],'read':![]}})[_0xc605('0x25')](function(_0x2ea952){return{'id':_[_0xc605('0x4b')](_0xe4d98f['params']['id']),'count':_0x2ea952};})[_0xc605('0x25')](respondWithResult(_0x3e3369,null))['catch'](handleError(_0x3e3369,null));};exports[_0xc605('0x4c')]=function(_0x25d05f,_0x8367a8,_0x266b2a){return db[_0xc605('0x2a')]['find']({'where':{'id':_0x25d05f[_0xc605('0x4d')]['id']}})[_0xc605('0x25')](handleEntityNotFound(_0x8367a8,null))[_0xc605('0x25')](function(_0x452222){if(_0x452222){return _0x452222[_0xc605('0x4c')](_0x25d05f[_0xc605('0x46')]['ids'],_['omit'](_0x25d05f[_0xc605('0x46')],[_0xc605('0x4e'),'id'])||{});}})[_0xc605('0x25')](respondWithResult(_0x8367a8,null))['catch'](handleError(_0x8367a8,null));};exports[_0xc605('0x4f')]=function(_0x505a20,_0x5a2897,_0x27b7c3){var _0x4ccfb9={};var _0x51cdba={};var _0x2954da;var _0x75b35c;return db[_0xc605('0x2a')][_0xc605('0x50')]({'where':{'id':_0x505a20[_0xc605('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5a2897,null))[_0xc605('0x25')](function(_0x2be285){if(_0x2be285){_0x2954da=_0x2be285;_0x51cdba[_0xc605('0x2f')]=_[_0xc605('0x40')](db[_0xc605('0x51')][_0xc605('0x2b')]);_0x51cdba['query']=_[_0xc605('0x40')](_0x505a20[_0xc605('0x30')]);_0x51cdba[_0xc605('0x31')]=_['intersection'](_0x51cdba[_0xc605('0x2f')],_0x51cdba[_0xc605('0x30')]);_0x4ccfb9['attributes']=_[_0xc605('0x32')](_0x51cdba[_0xc605('0x2f')],qs['fields'](_0x505a20[_0xc605('0x30')][_0xc605('0x34')]));_0x4ccfb9[_0xc605('0x33')]=_0x4ccfb9[_0xc605('0x33')]['length']?_0x4ccfb9['attributes']:_0x51cdba['model'];_0x4ccfb9[_0xc605('0x37')]=qs[_0xc605('0x38')](_0x505a20['query']['sort']);_0x4ccfb9[_0xc605('0x3b')]=qs[_0xc605('0x31')](_[_0xc605('0x52')](_0x505a20['query'],_0x51cdba[_0xc605('0x31')]));if(_0x505a20[_0xc605('0x30')][_0xc605('0x39')]){_0x4ccfb9[_0xc605('0x3b')]=_[_0xc605('0x3a')](_0x4ccfb9['where'],{'$or':_[_0xc605('0x29')](_0x4ccfb9['attributes'],function(_0x2f91ec){var _0x168040={};_0x168040[_0x2f91ec]={'$like':'%'+_0x505a20['query'][_0xc605('0x39')]+'%'};return _0x168040;})});}_0x4ccfb9=_['merge']({},_0x4ccfb9,_0x505a20['options']);return _0x2954da[_0xc605('0x4f')](_0x4ccfb9);}})['then'](function(_0x3ce06a){if(_0x3ce06a){_0x75b35c=_0x3ce06a['length'];if(!_0x505a20[_0xc605('0x30')][_0xc605('0x35')](_0xc605('0x36'))){_0x4ccfb9[_0xc605('0x1d')]=qs[_0xc605('0x1d')](_0x505a20[_0xc605('0x30')][_0xc605('0x1d')]);_0x4ccfb9[_0xc605('0x1c')]=qs[_0xc605('0x1c')](_0x505a20[_0xc605('0x30')][_0xc605('0x1c')]);}return _0x2954da[_0xc605('0x4f')](_0x4ccfb9);}})[_0xc605('0x25')](function(_0x11c841){if(_0x11c841){return _0x11c841?{'count':_0x75b35c,'rows':_0x11c841}:null;}})[_0xc605('0x25')](respondWithResult(_0x5a2897,null))[_0xc605('0x3e')](handleError(_0x5a2897,null));};exports[_0xc605('0x53')]=function(_0x4d51fa,_0x476394,_0x4c0547){return db['ChatGroup'][_0xc605('0x44')]({'where':{'id':_0x4d51fa[_0xc605('0x4d')]['id']}})[_0xc605('0x25')](handleEntityNotFound(_0x476394,null))[_0xc605('0x25')](function(_0x4ab5ca){if(_0x4ab5ca){return _0x4ab5ca[_0xc605('0x53')](_0x4d51fa[_0xc605('0x30')]['ids']);}})[_0xc605('0x25')](respondWithStatusCode(_0x476394,null))[_0xc605('0x3e')](handleError(_0x476394,null));};exports[_0xc605('0x54')]=function(_0x540efc,_0x178192,_0x4cde82){if(_0x540efc[_0xc605('0x46')]['id']){delete _0x540efc[_0xc605('0x46')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x540efc[_0xc605('0x4d')]['id']}})[_0xc605('0x25')](handleEntityNotFound(_0x178192,null))[_0xc605('0x25')](function(_0x1e6b43){if(_0x1e6b43){_0x540efc[_0xc605('0x46')][_0xc605('0x55')]=_0x1e6b43['id'];return db[_0xc605('0x49')][_0xc605('0x45')](_0x540efc['body']);}})[_0xc605('0x25')](respondWithResult(_0x178192,null))[_0xc605('0x3e')](handleError(_0x178192,null));};exports[_0xc605('0x56')]=function(_0x5847ca,_0x417272,_0x136fa1){var _0x1fe228={};var _0x182e84={};var _0x92f7e;var _0x84622d;return db[_0xc605('0x2a')]['findOne']({'where':{'id':_0x5847ca['params']['id']}})[_0xc605('0x25')](handleEntityNotFound(_0x417272,null))['then'](function(_0x160ed2){if(_0x160ed2){_0x92f7e=_0x160ed2;_0x182e84[_0xc605('0x2f')]=_[_0xc605('0x40')](db['ChatInternalMessage']['rawAttributes']);_0x182e84[_0xc605('0x30')]=_[_0xc605('0x40')](_0x5847ca['query']);_0x182e84[_0xc605('0x31')]=_[_0xc605('0x32')](_0x182e84['model'],_0x182e84[_0xc605('0x30')]);_0x1fe228['attributes']=_[_0xc605('0x32')](_0x182e84[_0xc605('0x2f')],qs['fields'](_0x5847ca[_0xc605('0x30')][_0xc605('0x34')]));_0x1fe228[_0xc605('0x33')]=_0x1fe228[_0xc605('0x33')]['length']?_0x1fe228[_0xc605('0x33')]:_0x182e84[_0xc605('0x2f')];_0x1fe228['order']=qs[_0xc605('0x38')](_0x5847ca['query']['sort']);_0x1fe228[_0xc605('0x3b')]=qs['filters'](_[_0xc605('0x52')](_0x5847ca['query'],_0x182e84[_0xc605('0x31')]));if(_0x5847ca[_0xc605('0x30')][_0xc605('0x39')]){_0x1fe228['where']=_[_0xc605('0x3a')](_0x1fe228[_0xc605('0x3b')],{'$or':_[_0xc605('0x29')](_0x1fe228[_0xc605('0x33')],function(_0x34bed2){var _0x4836a6={};_0x4836a6[_0x34bed2]={'$like':'%'+_0x5847ca[_0xc605('0x30')][_0xc605('0x39')]+'%'};return _0x4836a6;})});}if(_0x5847ca[_0xc605('0x30')]['$gte']){var _0x5927e9=_0x5847ca[_0xc605('0x30')]['$gte']['split'](',');var _0x3b82c3={};_0x3b82c3[_0x5927e9[0x0]]={'$gte':moment(_0x5927e9[0x1])[_0xc605('0x57')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1fe228[_0xc605('0x3b')]=_[_0xc605('0x3a')](_0x1fe228[_0xc605('0x3b')],_0x3b82c3);}_0x1fe228=_[_0xc605('0x3a')]({},_0x1fe228,_0x5847ca[_0xc605('0x3c')]);return _0x92f7e[_0xc605('0x56')](_0x1fe228);}})[_0xc605('0x25')](function(_0x27dbfe){if(_0x27dbfe){_0x84622d=_0x27dbfe[_0xc605('0x41')];if(!_0x5847ca['query']['hasOwnProperty'](_0xc605('0x36'))){_0x1fe228[_0xc605('0x1d')]=qs['limit'](_0x5847ca[_0xc605('0x30')]['limit']);_0x1fe228[_0xc605('0x1c')]=qs[_0xc605('0x1c')](_0x5847ca[_0xc605('0x30')][_0xc605('0x1c')]);}return _0x92f7e[_0xc605('0x56')](_0x1fe228);}})[_0xc605('0x25')](function(_0x11e65a){if(_0x11e65a){return _0x11e65a?{'count':_0x84622d,'rows':_0x11e65a}:null;}})[_0xc605('0x25')](respondWithResult(_0x417272,null))[_0xc605('0x3e')](handleError(_0x417272,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index d636e2b..66e9318 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 _0x7d8a=['ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x7d8a[_0x28aea5];return _0x6a55f9;};'use strict';var EventEmitter=require(_0xa7d8('0x0'));var ChatGroup=require(_0xa7d8('0x1'))['db'][_0xa7d8('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xa7d8('0x3')](0x0);var events={'afterCreate':_0xa7d8('0x4'),'afterUpdate':_0xa7d8('0x5'),'afterDestroy':_0xa7d8('0x6')};function emitEvent(_0x2b5af1){return function(_0x14a7d3,_0x199cdd,_0x1162e1){ChatGroupEvents[_0xa7d8('0x7')](_0x2b5af1+':'+_0x14a7d3['id'],_0x14a7d3);ChatGroupEvents[_0xa7d8('0x7')](_0x2b5af1,_0x14a7d3);_0x1162e1(null);};}for(var e in events){if(events[_0xa7d8('0x8')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xa7d8('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0x8ad3=['setMaxListeners','save','emit','exports','events','ChatGroup'];(function(_0x1e8bce,_0x4bf67d){var _0x4b0dec=function(_0x3bcc62){while(--_0x3bcc62){_0x1e8bce['push'](_0x1e8bce['shift']());}};_0x4b0dec(++_0x4bf67d);}(_0x8ad3,0xe8));var _0x38ad=function(_0xd2483f,_0x36b9ab){_0xd2483f=_0xd2483f-0x0;var _0x5d54d6=_0x8ad3[_0xd2483f];return _0x5d54d6;};'use strict';var EventEmitter=require(_0x38ad('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x38ad('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x38ad('0x2')](0x0);var events={'afterCreate':_0x38ad('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4e5176){return function(_0x55948b,_0x4ce30a,_0x8ae01a){ChatGroupEvents['emit'](_0x4e5176+':'+_0x55948b['id'],_0x55948b);ChatGroupEvents[_0x38ad('0x4')](_0x4e5176,_0x55948b);_0x8ae01a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x38ad('0x5')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 1e495c5..b578c13 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 _0x1ec7=['ChatGroup','chat_groups','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes'];(function(_0x957be3,_0x1aab43){var _0x4aa9d8=function(_0x5c5682){while(--_0x5c5682){_0x957be3['push'](_0x957be3['shift']());}};_0x4aa9d8(++_0x1aab43);}(_0x1ec7,0x70));var _0x71ec=function(_0x2b22f5,_0x289a6b){_0x2b22f5=_0x2b22f5-0x0;var _0x4bcb28=_0x1ec7[_0x2b22f5];return _0x4bcb28;};'use strict';var _=require('lodash');var util=require(_0x71ec('0x0'));var logger=require('../../config/logger')(_0x71ec('0x1'));var moment=require(_0x71ec('0x2'));var BPromise=require(_0x71ec('0x3'));var rp=require(_0x71ec('0x4'));var fs=require('fs');var path=require(_0x71ec('0x5'));var rimraf=require(_0x71ec('0x6'));var config=require(_0x71ec('0x7'));var attributes=require(_0x71ec('0x8'));module['exports']=function(_0x1558ef,_0x5641c6){return _0x1558ef['define'](_0x71ec('0x9'),attributes,{'tableName':_0x71ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8784=['ChatGroup','chat_groups','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x8784,0x183));var _0x4878=function(_0x217ff6,_0x36f75d){_0x217ff6=_0x217ff6-0x0;var _0x417c93=_0x8784[_0x217ff6];return _0x417c93;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4878('0x0'))(_0x4878('0x1'));var moment=require('moment');var BPromise=require(_0x4878('0x2'));var rp=require(_0x4878('0x3'));var fs=require('fs');var path=require(_0x4878('0x4'));var rimraf=require(_0x4878('0x5'));var config=require(_0x4878('0x6'));var attributes=require(_0x4878('0x7'));module[_0x4878('0x8')]=function(_0x2c435d,_0x591fee){return _0x2c435d['define'](_0x4878('0x9'),attributes,{'tableName':_0x4878('0xa'),'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 388ecd5..308bc37 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 _0x6aa7=['client','redis','defaults','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3bb85a,_0x47c79c){var _0x21bd4b=function(_0x4694d6){while(--_0x4694d6){_0x3bb85a['push'](_0x3bb85a['shift']());}};_0x21bd4b(++_0x47c79c);}(_0x6aa7,0x178));var _0x76aa=function(_0x1c4ea0,_0x4c6785){_0x1c4ea0=_0x1c4ea0-0x0;var _0x41463a=_0x6aa7[_0x1c4ea0];return _0x41463a;};'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});config[_0x76aa('0x9')]=_[_0x76aa('0xa')](config[_0x76aa('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x76aa('0xb'))(new Redis(config[_0x76aa('0x9')]));require(_0x76aa('0xc'))['register'](socket);function respondWithRpcPromise(_0xcd99aa,_0x25856d,_0x41643a){return new BPromise(function(_0x16cb50,_0x37f1ab){return client[_0x76aa('0xd')](_0xcd99aa,_0x41643a)[_0x76aa('0xe')](function(_0x8dc35c){logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,'request\x20sent');logger[_0x76aa('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x25856d,_0x76aa('0x12'),JSON[_0x76aa('0x13')](_0x8dc35c));if(_0x8dc35c[_0x76aa('0x14')]){if(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x15')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x25856d,_0x8dc35c[_0x76aa('0x14')]['message']);return _0x37f1ab(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x16')]);}logger['error'](_0x76aa('0x10'),_0x25856d,_0x8dc35c['error'][_0x76aa('0x16')]);return _0x16cb50(_0x8dc35c['error'][_0x76aa('0x16')]);}else{logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,_0x76aa('0x12'));_0x16cb50(_0x8dc35c[_0x76aa('0x17')][_0x76aa('0x16')]);}})['catch'](function(_0x5d6202){logger[_0x76aa('0x14')](_0x76aa('0x10'),_0x25856d,_0x5d6202);_0x37f1ab(_0x5d6202);});});} \ No newline at end of file +var _0xb1a3=['catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x3b029,_0x4aa690){var _0xe70d34=function(_0x5e93ec){while(--_0x5e93ec){_0x3b029['push'](_0x3b029['shift']());}};_0xe70d34(++_0x4aa690);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0xb1a3[_0x3f5dca];return _0x5b833a;};'use strict';var _=require(_0x3b1a('0x0'));var util=require(_0x3b1a('0x1'));var moment=require(_0x3b1a('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b1a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3b1a('0x4'));var logger=require(_0x3b1a('0x5'))(_0x3b1a('0x6'));var config=require(_0x3b1a('0x7'));var jayson=require(_0x3b1a('0x8'));var client=jayson[_0x3b1a('0x9')][_0x3b1a('0xa')]({'port':0x232a});config['redis']=_[_0x3b1a('0xb')](config[_0x3b1a('0xc')],{'host':_0x3b1a('0xd'),'port':0x18eb});var socket=require(_0x3b1a('0xe'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x3b1a('0xf')](socket);function respondWithRpcPromise(_0x1e6925,_0x4cd175,_0x260128){return new BPromise(function(_0x553d63,_0xc6d255){return client['request'](_0x1e6925,_0x260128)[_0x3b1a('0x10')](function(_0x261800){logger[_0x3b1a('0x11')](_0x3b1a('0x12'),_0x4cd175,_0x3b1a('0x13'));logger[_0x3b1a('0x14')](_0x3b1a('0x15'),_0x4cd175,_0x3b1a('0x13'),JSON[_0x3b1a('0x16')](_0x261800));if(_0x261800['error']){if(_0x261800['error'][_0x3b1a('0x17')]===0x1f4){logger[_0x3b1a('0x18')](_0x3b1a('0x12'),_0x4cd175,_0x261800[_0x3b1a('0x18')]['message']);return _0xc6d255(_0x261800[_0x3b1a('0x18')][_0x3b1a('0x19')]);}logger['error'](_0x3b1a('0x12'),_0x4cd175,_0x261800[_0x3b1a('0x18')][_0x3b1a('0x19')]);return _0x553d63(_0x261800[_0x3b1a('0x18')][_0x3b1a('0x19')]);}else{logger[_0x3b1a('0x11')](_0x3b1a('0x12'),_0x4cd175,_0x3b1a('0x13'));_0x553d63(_0x261800['result'][_0x3b1a('0x19')]);}})[_0x3b1a('0x1a')](function(_0x569bc4){logger[_0x3b1a('0x18')]('ChatGroup,\x20%s,\x20%s',_0x4cd175,_0x569bc4);_0xc6d255(_0x569bc4);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 5b141a5..6356107 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 _0x692a=['register','length','chatGroup:','./chatGroup.events','save','remove','update','removeListener'];(function(_0x311b9c,_0x275f1e){var _0x5d54a2=function(_0x468219){while(--_0x468219){_0x311b9c['push'](_0x311b9c['shift']());}};_0x5d54a2(++_0x275f1e);}(_0x692a,0x93));var _0xa692=function(_0x7564d5,_0x28a02a){_0x7564d5=_0x7564d5-0x0;var _0x4f2c7f=_0x692a[_0x7564d5];return _0x4f2c7f;};'use strict';var ChatGroupEvents=require(_0xa692('0x0'));var events=[_0xa692('0x1'),_0xa692('0x2'),_0xa692('0x3')];function createListener(_0x3cb976,_0x11faff){return function(_0x2cd941){_0x11faff['emit'](_0x3cb976,_0x2cd941);};}function removeListener(_0x50f1a7,_0x32b030){return function(){ChatGroupEvents[_0xa692('0x4')](_0x50f1a7,_0x32b030);};}exports[_0xa692('0x5')]=function(_0x5ece00){for(var _0x10b8a9=0x0,_0x59cd65=events[_0xa692('0x6')];_0x10b8a9<_0x59cd65;_0x10b8a9++){var _0x3295fb=events[_0x10b8a9];var _0x3de0c8=createListener(_0xa692('0x7')+_0x3295fb,_0x5ece00);ChatGroupEvents['on'](_0x3295fb,_0x3de0c8);}}; \ No newline at end of file +var _0x71d2=['chatGroup:','./chatGroup.events','save','remove','emit','removeListener','length'];(function(_0x43e0cc,_0xc5c862){var _0x4d7d9e=function(_0x535d4e){while(--_0x535d4e){_0x43e0cc['push'](_0x43e0cc['shift']());}};_0x4d7d9e(++_0xc5c862);}(_0x71d2,0x94));var _0x271d=function(_0x50887c,_0x53cd76){_0x50887c=_0x50887c-0x0;var _0x5fd1b7=_0x71d2[_0x50887c];return _0x5fd1b7;};'use strict';var ChatGroupEvents=require(_0x271d('0x0'));var events=[_0x271d('0x1'),_0x271d('0x2'),'update'];function createListener(_0x3d0776,_0x343026){return function(_0x47e325){_0x343026[_0x271d('0x3')](_0x3d0776,_0x47e325);};}function removeListener(_0x1062d5,_0x4b6700){return function(){ChatGroupEvents[_0x271d('0x4')](_0x1062d5,_0x4b6700);};}exports['register']=function(_0x291e32){for(var _0x325b7f=0x0,_0x1c3c76=events[_0x271d('0x5')];_0x325b7f<_0x1c3c76;_0x325b7f++){var _0x38c9e6=events[_0x325b7f];var _0x42acae=createListener(_0x271d('0x6')+_0x38c9e6,_0x291e32);ChatGroupEvents['on'](_0x38c9e6,_0x42acae);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 020ae62..eb49029 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 _0x26c2=['/:id/messages','addMessage','put','/:id','update','delete','destroy','removeMembers','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','isAuthenticated','show','/:id/unread','/:id/members','getMembers','getMessages','post'];(function(_0x562031,_0x1e5f67){var _0x332a34=function(_0x233822){while(--_0x233822){_0x562031['push'](_0x562031['shift']());}};_0x332a34(++_0x1e5f67);}(_0x26c2,0x117));var _0x226c=function(_0x3abc14,_0x48c685){_0x3abc14=_0x3abc14-0x0;var _0x5a861c=_0x26c2[_0x3abc14];return _0x5a861c;};'use strict';var multer=require(_0x226c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x226c('0x1'));var router=express[_0x226c('0x2')]();var fs_extra=require(_0x226c('0x3'));var auth=require(_0x226c('0x4'));var interaction=require(_0x226c('0x5'));var config=require(_0x226c('0x6'));var controller=require('./chatGroup.controller');router[_0x226c('0x7')]('/',auth['isAuthenticated'](),controller[_0x226c('0x8')]);router['get'](_0x226c('0x9'),auth['isAuthenticated'](),controller[_0x226c('0xa')]);router['get']('/:id',auth[_0x226c('0xb')](),controller[_0x226c('0xc')]);router[_0x226c('0x7')](_0x226c('0xd'),auth[_0x226c('0xb')](),controller['getUnread']);router[_0x226c('0x7')](_0x226c('0xe'),auth[_0x226c('0xb')](),controller[_0x226c('0xf')]);router[_0x226c('0x7')]('/:id/messages',auth[_0x226c('0xb')](),controller[_0x226c('0x10')]);router[_0x226c('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x226c('0xe'),auth[_0x226c('0xb')](),controller['addMembers']);router['post'](_0x226c('0x12'),auth['isAuthenticated'](),controller[_0x226c('0x13')]);router[_0x226c('0x14')](_0x226c('0x15'),auth[_0x226c('0xb')](),controller[_0x226c('0x16')]);router[_0x226c('0x17')](_0x226c('0x15'),auth[_0x226c('0xb')](),controller[_0x226c('0x18')]);router[_0x226c('0x17')](_0x226c('0xe'),auth[_0x226c('0xb')](),controller[_0x226c('0x19')]);module[_0x226c('0x1a')]=router; \ No newline at end of file +var _0x3645=['post','create','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','getUnread','/:id/members','getMembers'];(function(_0xff5684,_0xfe6e00){var _0x41e374=function(_0x145196){while(--_0x145196){_0xff5684['push'](_0xff5684['shift']());}};_0x41e374(++_0xfe6e00);}(_0x3645,0x104));var _0x5364=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x3645[_0x81dcac];return _0xc7803b;};'use strict';var multer=require(_0x5364('0x0'));var util=require('util');var path=require(_0x5364('0x1'));var timeout=require(_0x5364('0x2'));var express=require('express');var router=express[_0x5364('0x3')]();var fs_extra=require(_0x5364('0x4'));var auth=require(_0x5364('0x5'));var interaction=require(_0x5364('0x6'));var config=require(_0x5364('0x7'));var controller=require('./chatGroup.controller');router[_0x5364('0x8')]('/',auth[_0x5364('0x9')](),controller['index']);router[_0x5364('0x8')](_0x5364('0xa'),auth[_0x5364('0x9')](),controller['describe']);router['get'](_0x5364('0xb'),auth[_0x5364('0x9')](),controller['show']);router[_0x5364('0x8')]('/:id/unread',auth[_0x5364('0x9')](),controller[_0x5364('0xc')]);router[_0x5364('0x8')](_0x5364('0xd'),auth[_0x5364('0x9')](),controller[_0x5364('0xe')]);router[_0x5364('0x8')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x5364('0xf')]('/',auth[_0x5364('0x9')](),controller[_0x5364('0x10')]);router[_0x5364('0xf')]('/:id/members',auth['isAuthenticated'](),controller[_0x5364('0x11')]);router[_0x5364('0xf')]('/:id/messages',auth[_0x5364('0x9')](),controller[_0x5364('0x12')]);router[_0x5364('0x13')](_0x5364('0xb'),auth[_0x5364('0x9')](),controller[_0x5364('0x14')]);router[_0x5364('0x15')](_0x5364('0xb'),auth[_0x5364('0x9')](),controller[_0x5364('0x16')]);router[_0x5364('0x15')](_0x5364('0xd'),auth[_0x5364('0x9')](),controller[_0x5364('0x17')]);module[_0x5364('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 8e5a10e..6d739dd 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 _0xe9e8=['exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','long','DATE','out','sequelize'];(function(_0x4a16df,_0x557a6b){var _0x5c1239=function(_0x1b5f93){while(--_0x1b5f93){_0x4a16df['push'](_0x4a16df['shift']());}};_0x5c1239(++_0x557a6b);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x260bc6,_0x3c5c74){_0x260bc6=_0x260bc6-0x0;var _0x155261=_0xe9e8[_0x260bc6];return _0x155261;};'use strict';var Sequelize=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]={'closed':{'type':Sequelize[_0x8e9e('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8e9e('0x3')]},'ratingType':{'type':Sequelize[_0x8e9e('0x4')](_0x8e9e('0x5'),_0x8e9e('0x6')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x8e9e('0x7')]},'pathTranscript':{'type':Sequelize[_0x8e9e('0x7')]},'mailTranscript':{'type':Sequelize[_0x8e9e('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8e9e('0x8')]},'secondDisposition':{'type':Sequelize[_0x8e9e('0x8')]},'thirdDisposition':{'type':Sequelize[_0x8e9e('0x8')]},'note':{'type':Sequelize[_0x8e9e('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x8e9e('0x8')]},'osName':{'type':Sequelize[_0x8e9e('0x8')]},'osVersion':{'type':Sequelize[_0x8e9e('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x8e9e('0x8')]},'deviceType':{'type':Sequelize[_0x8e9e('0x8')]},'referer':{'type':Sequelize[_0x8e9e('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x8e9e('0x7')](_0x8e9e('0x9'))},'read1stAt':{'type':Sequelize[_0x8e9e('0xa')]},'lastMsgAt':{'type':Sequelize[_0x8e9e('0xa')]},'lastMsgDirection':{'type':Sequelize[_0x8e9e('0x4')]('in',_0x8e9e('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8e9e('0x8')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x8e9e('0x7')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7334=['out','sequelize','exports','BOOLEAN','star','TEXT','STRING','DATE','long'];(function(_0x33d598,_0x1ad580){var _0x4dcfcc=function(_0x25583a){while(--_0x25583a){_0x33d598['push'](_0x33d598['shift']());}};_0x4dcfcc(++_0x1ad580);}(_0x7334,0x184));var _0x4733=function(_0x3e961c,_0x5483c6){_0x3e961c=_0x3e961c-0x0;var _0x44c13d=_0x7334[_0x3e961c];return _0x44c13d;};'use strict';var Sequelize=require(_0x4733('0x0'));module[_0x4733('0x1')]={'closed':{'type':Sequelize[_0x4733('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x4733('0x3'),'thumb'),'defaultValue':_0x4733('0x3')},'ratingMessage':{'type':Sequelize[_0x4733('0x4')]},'pathTranscript':{'type':Sequelize[_0x4733('0x4')]},'mailTranscript':{'type':Sequelize[_0x4733('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x4733('0x6')]},'disposition':{'type':Sequelize[_0x4733('0x5')]},'secondDisposition':{'type':Sequelize[_0x4733('0x5')]},'thirdDisposition':{'type':Sequelize[_0x4733('0x5')]},'note':{'type':Sequelize[_0x4733('0x5')]},'browserName':{'type':Sequelize[_0x4733('0x5')]},'browserVersion':{'type':Sequelize[_0x4733('0x5')]},'osName':{'type':Sequelize[_0x4733('0x5')]},'osVersion':{'type':Sequelize[_0x4733('0x5')]},'deviceModel':{'type':Sequelize[_0x4733('0x5')]},'deviceVendor':{'type':Sequelize[_0x4733('0x5')]},'deviceType':{'type':Sequelize[_0x4733('0x5')]},'referer':{'type':Sequelize[_0x4733('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x4733('0x4')](_0x4733('0x7'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x4733('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4733('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x4733('0x5')]},'customerPort':{'type':Sequelize[_0x4733('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x4733('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x4733('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 60a9b0a..75c25a6 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 _0xd7d1=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','ChatInteractionId','all','rows','show','params','includeAll','include','create','destroy','describe','createVidaooSession','findOne','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','update','disposition','file','basename','filename','Attachment','attachmentDownload','closed','json','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','close','mailTranscript','root','transcript-%s.txt','now','pathTranscript','Messages','format','agentAlias','System','customer','%s%d','Visitor','agentIdentifier','website_alias','agent_fullname','direction','secret','appendFileSync','MailAccount','Smtp','service','host','secure','auth','pass','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','alias','findAll','addTags','setTags','ids','omit','spread','emit','chatInteractionTags:save','removeTags','download','unix','tmp','server','files','attachments','transcript-%d-%s.zip','lastName','ChatWebsite','get','mkdirSync','Chat','Account','Owner','N.A.','browserName','osName','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatInteraction.socket','register','jayson/promise','client','http','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','limit','undefined','count','offset','set','apply','reject','save','stack','name','send','contact','agent','interaction','account','map','fullname','TagIds','forEach','Tags','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','select','field','color','tools_tags','u.fullname','from','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','buildExpression','body','some','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','contactName','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x23fc57,_0xadec1e){_0x23fc57=_0x23fc57-0x0;var _0x1cea8d=_0xd7d1[_0x23fc57];return _0x1cea8d;};'use strict';var emlformat=require(_0x1d7d('0x0'));var rimraf=require(_0x1d7d('0x1'));var zipdir=require(_0x1d7d('0x2'));var jsonpatch=require(_0x1d7d('0x3'));var rp=require(_0x1d7d('0x4'));var moment=require(_0x1d7d('0x5'));var BPromise=require(_0x1d7d('0x6'));var Mustache=require(_0x1d7d('0x7'));var util=require(_0x1d7d('0x8'));var path=require(_0x1d7d('0x9'));var sox=require(_0x1d7d('0xa'));var csv=require(_0x1d7d('0xb'));var ejs=require(_0x1d7d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xb'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x1d7d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d7d('0x18'))(_0x1d7d('0x19'));var utils=require(_0x1d7d('0x1a'));var config=require(_0x1d7d('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x1d7d('0x1c'))['db'];config['redis']=_['defaults'](config[_0x1d7d('0x1d')],{'host':_0x1d7d('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1d7d('0x1f'))[_0x1d7d('0x20')](socket);var jayson=require(_0x1d7d('0x21'));var client=jayson[_0x1d7d('0x22')][_0x1d7d('0x23')]({'port':0x232b});var client9004=jayson['client'][_0x1d7d('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x1de6cc,_0x51cbca,_0xb90a8c,_0x162c3a){return new BPromise(function(_0x3c3417,_0x47826a){var _0x40db4d=_0x162c3a||client;return _0x40db4d['request'](_0x1de6cc,_0xb90a8c)[_0x1d7d('0x24')](function(_0x191024){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x51cbca,_0x1d7d('0x25'));logger[_0x1d7d('0x26')](_0x1d7d('0x27'),_0x51cbca,_0x1d7d('0x25'),JSON[_0x1d7d('0x28')](_0x191024));if(_0x191024[_0x1d7d('0x29')]){if(_0x191024['error'][_0x1d7d('0x2a')]===0x1f4){logger[_0x1d7d('0x29')](_0x1d7d('0x2b'),_0x51cbca,_0x191024['error'][_0x1d7d('0x2c')]);return _0x47826a(_0x191024[_0x1d7d('0x29')]['message']);}logger['error'](_0x1d7d('0x2b'),_0x51cbca,_0x191024[_0x1d7d('0x29')][_0x1d7d('0x2c')]);return _0x3c3417(_0x191024['error'][_0x1d7d('0x2c')]);}else{logger[_0x1d7d('0x2d')](_0x1d7d('0x2b'),_0x51cbca,_0x1d7d('0x25'));_0x3c3417(_0x191024['result'][_0x1d7d('0x2c')]);}})[_0x1d7d('0x2e')](function(_0x5c8257){logger['error'](_0x1d7d('0x2b'),_0x51cbca,_0x5c8257);_0x47826a(_0x5c8257);});});}function respondWithStatusCode(_0x52c618,_0x38c323){_0x38c323=_0x38c323||0xcc;return function(_0x2d4de4){if(_0x2d4de4){return _0x52c618[_0x1d7d('0x2f')](_0x38c323);}return _0x52c618[_0x1d7d('0x30')](_0x38c323)[_0x1d7d('0x31')]();};}function respondWithResult(_0x59f827,_0x1c2616){_0x1c2616=_0x1c2616||0xc8;return function(_0x98c1ad){if(_0x98c1ad){return _0x59f827[_0x1d7d('0x30')](_0x1c2616)['json'](_0x98c1ad);}};}function respondWithFilteredResult(_0x78adbe,_0x1a935a){return function(_0x23ad85){if(_0x23ad85){var _0x482367=typeof _0x1a935a['offset']==='undefined'&&typeof _0x1a935a[_0x1d7d('0x32')]===_0x1d7d('0x33');var _0x559f19=_0x23ad85[_0x1d7d('0x34')];var _0x3e4136=_0x482367?0x0:_0x1a935a[_0x1d7d('0x35')];var _0x3336ab=_0x482367?_0x23ad85[_0x1d7d('0x34')]:_0x1a935a[_0x1d7d('0x35')]+_0x1a935a[_0x1d7d('0x32')];var _0x803dc9;if(_0x3336ab>=_0x559f19){_0x3336ab=_0x559f19;_0x803dc9=0xc8;}else{_0x803dc9=0xce;}_0x78adbe[_0x1d7d('0x30')](_0x803dc9);return _0x78adbe[_0x1d7d('0x36')]('Content-Range',_0x3e4136+'-'+_0x3336ab+'/'+_0x559f19)['json'](_0x23ad85);}return null;};}function patchUpdates(_0x2e4402){return function(_0x2266a6){try{jsonpatch[_0x1d7d('0x37')](_0x2266a6,_0x2e4402,!![]);}catch(_0x40318f){return BPromise[_0x1d7d('0x38')](_0x40318f);}return _0x2266a6[_0x1d7d('0x39')]();};}function saveUpdates(_0x1aee3c,_0x40aca9){return function(_0x2fa3f4){if(_0x2fa3f4){return _0x2fa3f4['update'](_0x1aee3c)[_0x1d7d('0x24')](function(_0xf9d3e4){return _0xf9d3e4;});}return null;};}function removeEntity(_0x13a974,_0x30fb9a){return function(_0x4cc364){if(_0x4cc364){return _0x4cc364['destroy']()[_0x1d7d('0x24')](function(){_0x13a974[_0x1d7d('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x103c77,_0x3fea2e){return function(_0x568092){if(!_0x568092){_0x103c77['sendStatus'](0x194);}return _0x568092;};}function handleError(_0x26f81c,_0xc77f24){_0xc77f24=_0xc77f24||0x1f4;return function(_0x406f57){logger[_0x1d7d('0x29')](_0x406f57[_0x1d7d('0x3a')]);if(_0x406f57[_0x1d7d('0x3b')]){delete _0x406f57[_0x1d7d('0x3b')];}_0x26f81c[_0x1d7d('0x30')](_0xc77f24)[_0x1d7d('0x3c')](_0x406f57);};}function getMustacheRender(_0x318b9a,_0x4fcdcc){return Mustache['render'](_0x318b9a,_['merge'](_0x4fcdcc['body'],{'contact':_0x4fcdcc[_0x1d7d('0x3d')],'message':_0x4fcdcc['message'],'agent':_0x4fcdcc[_0x1d7d('0x3e')],'interaction':_0x4fcdcc[_0x1d7d('0x3f')],'account':_0x4fcdcc[_0x1d7d('0x40')]}))||'';}function getInteractionUsers(_0x515199,_0x5a4052){return new BPromise(function(_0x16a4e0,_0x153979){try{if(_0x5a4052[_0x515199['id']]){_0x515199['Users']=_[_0x1d7d('0x41')](_0x5a4052[_0x515199['id']],function(_0xa53806){return{'id':_0xa53806['id'],'fullname':_0xa53806[_0x1d7d('0x42')]};});}}catch(_0x2100f6){_0x153979(_0x2100f6);}_0x16a4e0(_0x515199);});}function getInteractionTags(_0x5eef0a,_0x1db8e8){return new BPromise(function(_0x42c229,_0x4239fa){try{if(_0x5eef0a[_0x1d7d('0x43')]){_0x5eef0a['Tags']=[];_0x5eef0a[_0x1d7d('0x43')]['split'](',')[_0x1d7d('0x44')](function(_0x31b850){_0x5eef0a[_0x1d7d('0x45')][_0x1d7d('0x46')](_0x1db8e8[_0x31b850]);});}delete _0x5eef0a[_0x1d7d('0x43')];}catch(_0x4becec){_0x4239fa(_0x4becec);}_0x42c229(_0x5eef0a);});}function updateChatInteraction(_0x59b8e7,_0x33582a,_0xe57fa5){return new BPromise(function(_0x1637fc,_0x4bed84){return getInteractionUsers(_0x59b8e7,_0xe57fa5)['then'](function(_0x12f397){return getInteractionTags(_0x12f397,_0x33582a);})['then'](function(_0x86e7bc){_0x1637fc(_0x86e7bc);})[_0x1d7d('0x2e')](function(_0x1d1064){_0x4bed84(_0x1d1064);});});}exports[_0x1d7d('0x47')]=function(_0x1e2ea8,_0x370e8d){var _0x72f5d7={},_0x51cb15={},_0x3ccd44={'count':0x0,'rows':[]};var _0x8b0c22=_['map'](db[_0x1d7d('0x48')][_0x1d7d('0x49')],function(_0x40599b){return{'name':_0x40599b[_0x1d7d('0x4a')],'type':_0x40599b[_0x1d7d('0x4b')][_0x1d7d('0x4c')]};});_0x51cb15[_0x1d7d('0x4d')]=_[_0x1d7d('0x41')](_0x8b0c22,_0x1d7d('0x3b'));_0x51cb15[_0x1d7d('0x4e')]=_[_0x1d7d('0x4f')](_0x1e2ea8[_0x1d7d('0x4e')]);_0x51cb15['filters']=_[_0x1d7d('0x50')](_0x51cb15['model'],_0x51cb15[_0x1d7d('0x4e')]);_0x72f5d7['attributes']=_[_0x1d7d('0x50')](_0x51cb15[_0x1d7d('0x4d')],qs[_0x1d7d('0x51')](_0x1e2ea8[_0x1d7d('0x4e')]['fields']));_0x72f5d7[_0x1d7d('0x52')]=_0x72f5d7['attributes']['length']?_0x72f5d7[_0x1d7d('0x52')]:_0x51cb15['model'];if(!_0x1e2ea8['query'][_0x1d7d('0x53')](_0x1d7d('0x54'))){_0x72f5d7['limit']=qs[_0x1d7d('0x32')](_0x1e2ea8[_0x1d7d('0x4e')]['limit']);_0x72f5d7[_0x1d7d('0x35')]=qs[_0x1d7d('0x35')](_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x35')]);}_0x72f5d7['order']=qs['sort'](_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x55')]);_0x72f5d7[_0x1d7d('0x56')]=qs[_0x1d7d('0x57')](_[_0x1d7d('0x58')](_0x1e2ea8['query'],_0x51cb15[_0x1d7d('0x57')]),_0x8b0c22);var _0x24e0b7=[];var _0x344b66=squel[_0x1d7d('0x59')]()[_0x1d7d('0x5a')]('id')[_0x1d7d('0x5a')](_0x1d7d('0x3b'))[_0x1d7d('0x5a')](_0x1d7d('0x5b'))['from'](_0x1d7d('0x5c'));var _0x41ad41=squel[_0x1d7d('0x59')]()['field']('u.id')[_0x1d7d('0x5a')](_0x1d7d('0x5d'))[_0x1d7d('0x5a')]('ui.ChatInteractionId')[_0x1d7d('0x5e')](_0x1d7d('0x5f'),'ui')['left_join'](_0x1d7d('0x60'),'u',_0x1d7d('0x61'));var _0x3fc216=squel[_0x1d7d('0x59')]()['from'](_0x1d7d('0x62'),'i')[_0x1d7d('0x63')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x1d7d('0x63')](_0x1d7d('0x60'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x1d7d('0x64'),'a',_0x1d7d('0x65'))[_0x1d7d('0x63')](_0x1d7d('0x66'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x1d7d('0x63')]('chat_interaction_has_tags','it',_0x1d7d('0x67'))[_0x1d7d('0x63')](_0x1d7d('0x5c'),'t',_0x1d7d('0x68'));var _0x5a4bd7=squel[_0x1d7d('0x69')]();var _0x1ea966=[];var _0x193135=squel[_0x1d7d('0x69')]();var _0x28ec14;if(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x6a')]){_0x28ec14=as[_0x1d7d('0x6b')](_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x6a')]);var _0x44a187=_0x28ec14[_0x1d7d('0x6c')];for(var _0x301a67=0x0;_0x301a67<_0x28ec14[_0x1d7d('0x6d')][_0x1d7d('0x6e')];_0x301a67++){var _0x520d3c=_0x28ec14[_0x1d7d('0x6d')][_0x301a67];var _0x566d27='i';var _0x1c9fe7=_[_0x1d7d('0x6f')](_0x8b0c22,[_0x1d7d('0x3b'),_0x520d3c[_0x1d7d('0x5a')]]);if(!_0x1c9fe7){switch(_0x520d3c[_0x1d7d('0x5a')]){case _0x1d7d('0x70'):if(_0x520d3c['value']==0x1){_0x3fc216[_0x1d7d('0x71')]('`'+_0x520d3c[_0x1d7d('0x5a')]+'`\x20=\x200');}else{_0x3fc216[_0x1d7d('0x71')]('`'+_0x520d3c['field']+_0x1d7d('0x72'));}break;case _0x1d7d('0x73'):if(_0x520d3c[_0x1d7d('0x74')]===_0x1d7d('0x75')){if(_0x520d3c[_0x1d7d('0x76')][_0x1d7d('0x77')]('\x20')['length']>0x1){_0x5a4bd7[_0x44a187](_0x1d7d('0x78'),qs[_0x1d7d('0x79')](_0x520d3c['value']),null);}else{var _0x3289c2='%'+_0x520d3c[_0x1d7d('0x76')]+'%';_0x5a4bd7[_0x44a187](_0x1d7d('0x7a'),_0x3289c2,_0x3289c2,_0x3289c2);}}else{_0x1c9fe7=_['find'](_0x8b0c22,[_0x1d7d('0x3b'),_0x1d7d('0x7b')]);_0x520d3c[_0x1d7d('0x5a')]=_0x1d7d('0x7b');_0x2e26d4=as['buildExpression'](_0x566d27,_0x1c9fe7[_0x1d7d('0x4b')],_0x520d3c);_0x5a4bd7[_0x44a187](_0x2e26d4[_0x1d7d('0x7c')],_0x2e26d4[_0x1d7d('0x76')][_0x1d7d('0x7d')],_0x2e26d4[_0x1d7d('0x76')]['end']);}break;case _0x1d7d('0x7e'):var _0x10dea3=_0x520d3c['value'][_0x1d7d('0x77')](',')[_0x1d7d('0x41')](function(_0x17c174){return Number(_0x17c174);});_0x10dea3[_0x1d7d('0x44')](function(_0x47d27e){_0x193135['or'](_0x1d7d('0x7f'),'%,'+_0x47d27e+',%');});_0x1ea966=_['union'](_0x1ea966,_0x10dea3);break;case _0x1d7d('0x80'):if(_0x520d3c[_0x1d7d('0x74')]===_0x1d7d('0x75')){_0x5a4bd7[_0x44a187]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x520d3c[_0x1d7d('0x76')]+'%',null);}else{_0x1c9fe7=_[_0x1d7d('0x6f')](_0x8b0c22,[_0x1d7d('0x3b'),'UserId']);_0x520d3c[_0x1d7d('0x5a')]='UserId';_0x2e26d4=as[_0x1d7d('0x81')](_0x566d27,_0x1c9fe7[_0x1d7d('0x4b')],_0x520d3c);_0x5a4bd7[_0x44a187](_0x2e26d4[_0x1d7d('0x7c')],_0x2e26d4[_0x1d7d('0x76')][_0x1d7d('0x7d')],_0x2e26d4[_0x1d7d('0x76')][_0x1d7d('0x31')]);}break;case _0x1d7d('0x82'):_0x2e26d4=as[_0x1d7d('0x81')]('me',null,_0x520d3c);_0x5a4bd7[_0x44a187](_0x2e26d4[_0x1d7d('0x7c')],_0x2e26d4[_0x1d7d('0x76')]['start'],_0x2e26d4['value'][_0x1d7d('0x31')]);break;}}else{var _0x2e26d4=as[_0x1d7d('0x81')](_0x566d27,_0x1c9fe7['type'],_0x520d3c);_0x5a4bd7[_0x44a187](_0x2e26d4[_0x1d7d('0x7c')],_0x2e26d4['value'][_0x1d7d('0x7d')],_0x2e26d4[_0x1d7d('0x76')]['end']);}}}else{var _0x1f55a2=_(_0x1e2ea8[_0x1d7d('0x4e')])['keys']()[_0x1d7d('0x41')](function(_0x40ee1f){return _[_0x1d7d('0x83')](_0x8b0c22,['name',_0x40ee1f])?_0x40ee1f:undefined;})['compact']()[_0x1d7d('0x76')]();if(!_[_0x1d7d('0x84')](_0x1f55a2)){_0x1f55a2['forEach'](function(_0x33430c){if(_0x33430c===_0x1d7d('0x85')){_0x3fc216[_0x1d7d('0x56')](_0x1d7d('0x86'),[]['concat'](_0x1e2ea8[_0x1d7d('0x4e')][_0x33430c]));}else if(_0x33430c===_0x1d7d('0x87')){var _0x22cdd1=JSON[_0x1d7d('0x88')](_0x1e2ea8[_0x1d7d('0x4e')][_0x33430c])[_0x1d7d('0x89')];var _0x42a83c=JSON[_0x1d7d('0x88')](_0x1e2ea8[_0x1d7d('0x4e')][_0x33430c])[_0x1d7d('0x8a')];_0x3fc216[_0x1d7d('0x56')](_0x1d7d('0x8b'),_0x22cdd1,_0x42a83c);}else{if(_0x1e2ea8[_0x1d7d('0x4e')][_0x33430c]==='null'){_0x3fc216[_0x1d7d('0x56')]('i.'+_0x33430c+_0x1d7d('0x8c'));}else{_0x3fc216['where']('i.'+_0x33430c+_0x1d7d('0x8d'),_0x1e2ea8[_0x1d7d('0x4e')][_0x33430c]);}}});}if(_0x1e2ea8['query']['read']){if(_0x1e2ea8['query'][_0x1d7d('0x8e')]==0x1){_0x3fc216[_0x1d7d('0x71')](_0x1d7d('0x8f'));}else{_0x3fc216[_0x1d7d('0x71')]('`unreadMessages`\x20>\x200');}}if(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x90')]){_0x1ea966=_[_0x1d7d('0x91')](_0x1e2ea8[_0x1d7d('0x4e')]['tag'])?_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x90')]:new Array(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x90')]);_0x1ea966[_0x1d7d('0x44')](function(_0x2a7229){_0x193135['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2a7229+',%');});}if(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x92')]){var _0x57aba7=_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x92')][_0x1d7d('0x93')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x1d7d('0x94')](_0x57aba7)){_0x5a4bd7['or']('i.id\x20LIKE\x20?',_0x57aba7+'%');}else{_0x5a4bd7['or'](_0x1d7d('0x95'),qs[_0x1d7d('0x79')](_0x57aba7))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x57aba7+'%');}}}_0x3fc216[_0x1d7d('0x56')](_0x5a4bd7);_0x3fc216[_0x1d7d('0x96')](_0x1d7d('0x97'));var _0xc3c42f={'type':db[_0x1d7d('0x98')][_0x1d7d('0x99')][_0x1d7d('0x9a')],'raw':!![]};var _0x155e88=_0x3fc216[_0x1d7d('0x9b')]();_0x155e88[_0x1d7d('0x5a')](_0x1d7d('0x97'));_0x155e88[_0x1d7d('0x5a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x72f5d7[_0x1d7d('0x9c')]){_0x72f5d7[_0x1d7d('0x9c')][_0x1d7d('0x44')](function(_0x395818){var _0x247289=_0x395818[0x0]===_0x1d7d('0x9d')?_0x395818[0x0]:'i.'+_0x395818[0x0];_0x3fc216[_0x1d7d('0x9c')](_0x247289,_0x395818[0x1]===_0x1d7d('0x9e')?![]:!![]);});}if(!_[_0x1d7d('0x84')](_0x1ea966)){_0x3fc216[_0x1d7d('0x71')](_0x193135);_0x155e88[_0x1d7d('0x56')](_0x1d7d('0x9f'),_0x1ea966);}BPromise['resolve']()[_0x1d7d('0x24')](function(){if(!_0x28ec14){if(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x85')])return;_0x155e88[_0x1d7d('0x56')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x3fc216[_0x1d7d('0x56')](_0x1d7d('0xa0'));return;}if(_0x1e2ea8[_0x1d7d('0xa1')][_0x1d7d('0xa2')]!=='agent')return;return _0x1e2ea8['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x10925b){if(_[_0x1d7d('0x84')](_0x10925b)){_0x155e88['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x3fc216[_0x1d7d('0x56')](_0x1d7d('0xa3'));}else{_0x155e88[_0x1d7d('0x56')](_0x1d7d('0x86'),_[_0x1d7d('0x41')](_0x10925b,'id'));_0x3fc216[_0x1d7d('0x56')](_0x1d7d('0x86'),_[_0x1d7d('0x41')](_0x10925b,'id'));}});})[_0x1d7d('0x24')](function(){if(_0x1e2ea8[_0x1d7d('0xa1')]['role']===_0x1d7d('0x3e')&&!_0x28ec14&&!_0x1e2ea8['query'][_0x1d7d('0x85')])return[];return db[_0x1d7d('0xa4')][_0x1d7d('0x4e')](_0x155e88['toString'](),_0xc3c42f);})[_0x1d7d('0x24')](function(_0x40464c){_0x3ccd44[_0x1d7d('0x34')]=_0x40464c[_0x1d7d('0x6e')];if(_0x3ccd44[_0x1d7d('0x34')]===0x0)return[];return db[_0x1d7d('0xa4')][_0x1d7d('0x4e')](_0x344b66[_0x1d7d('0xa5')](),_0xc3c42f)[_0x1d7d('0x24')](function(_0x74e3fe){_0x24e0b7=_[_0x1d7d('0xa6')](_0x74e3fe,'id');_0xc3c42f=_[_0x1d7d('0xa7')](_0xc3c42f,{'model':db[_0x1d7d('0x48')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x51')]){_0x72f5d7[_0x1d7d('0x52')][_0x1d7d('0x44')](function(_0x2aac19){_0x3fc216[_0x1d7d('0x5a')]('i.'+_0x2aac19);});}else{_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xa8'),_0x1d7d('0x70'));_0x3fc216[_0x1d7d('0x5a')]('a.key',_0x1d7d('0xa9'));_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xaa'),'Account.mandatoryDisposition');_0x3fc216[_0x1d7d('0x5a')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x3fc216['field']('i.*');_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xab'),_0x1d7d('0xac'));_0x3fc216['field'](_0x1d7d('0xad'),'Contact.lastName');_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xae'),_0x1d7d('0xaf'));_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xb0'),_0x1d7d('0xb1'));_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xb2'),_0x1d7d('0xb3'));_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xb4'),'Contact.fax');_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xb5'),_0x1d7d('0xb6'));_0x3fc216['field'](_0x1d7d('0xb7'),_0x1d7d('0xb8'));_0x3fc216[_0x1d7d('0x5a')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x72f5d7[_0x1d7d('0x32')])_0x3fc216['limit'](_0x72f5d7[_0x1d7d('0x32')]);if(_0x72f5d7[_0x1d7d('0x35')])_0x3fc216['offset'](_0x72f5d7[_0x1d7d('0x35')]);return db[_0x1d7d('0xa4')]['query'](_0x3fc216[_0x1d7d('0xa5')](),_0xc3c42f);})[_0x1d7d('0x24')](function(_0x45b5e2){if(_0x45b5e2[_0x1d7d('0x6e')]>0x0)_0x41ad41['where']('ui.ChatInteractionId\x20IN\x20?',_[_0x1d7d('0x41')](_0x45b5e2,'id'));return db[_0x1d7d('0xa4')][_0x1d7d('0x4e')](_0x41ad41[_0x1d7d('0xa5')](),_0xc3c42f)[_0x1d7d('0x24')](function(_0xa5c005){var _0x1af86a=_[_0x1d7d('0xb9')](_0xa5c005,_0x1d7d('0xba'));var _0x434500=[];_0x45b5e2[_0x1d7d('0x44')](function(_0x26781c){_0x434500[_0x1d7d('0x46')](updateChatInteraction(_0x26781c,_0x24e0b7,_0x1af86a));});return BPromise[_0x1d7d('0xbb')](_0x434500);});});})[_0x1d7d('0x24')](function(_0x39924a){_0x3ccd44[_0x1d7d('0xbc')]=_0x39924a;return _0x3ccd44;})[_0x1d7d('0x24')](respondWithFilteredResult(_0x370e8d,_0x72f5d7))['catch'](handleError(_0x370e8d,null));};exports[_0x1d7d('0xbd')]=function(_0x45e83d,_0x16ce51){var _0x20b99d={'raw':![],'where':{'id':_0x45e83d[_0x1d7d('0xbe')]['id']}},_0x5ca824={};_0x5ca824[_0x1d7d('0x4d')]=_[_0x1d7d('0x4f')](db[_0x1d7d('0x48')]['rawAttributes']);_0x5ca824[_0x1d7d('0x4e')]=_['keys'](_0x45e83d[_0x1d7d('0x4e')]);_0x5ca824[_0x1d7d('0x57')]=_[_0x1d7d('0x50')](_0x5ca824['model'],_0x5ca824[_0x1d7d('0x4e')]);_0x20b99d['attributes']=_[_0x1d7d('0x50')](_0x5ca824[_0x1d7d('0x4d')],qs[_0x1d7d('0x51')](_0x45e83d[_0x1d7d('0x4e')]['fields']));_0x20b99d[_0x1d7d('0x52')]=_0x20b99d['attributes'][_0x1d7d('0x6e')]?_0x20b99d[_0x1d7d('0x52')]:_0x5ca824['model'];if(_0x45e83d[_0x1d7d('0x4e')][_0x1d7d('0xbf')]){_0x20b99d[_0x1d7d('0xc0')]=[{'all':!![]}];}_0x20b99d=_[_0x1d7d('0xa7')]({},_0x20b99d,_0x45e83d['options']);return db['ChatInteraction']['find'](_0x20b99d)[_0x1d7d('0x24')](handleEntityNotFound(_0x16ce51,null))[_0x1d7d('0x24')](respondWithResult(_0x16ce51,null))[_0x1d7d('0x2e')](handleError(_0x16ce51,null));};exports[_0x1d7d('0xc1')]=function(_0x458f92,_0x55ea3b){return db[_0x1d7d('0x48')][_0x1d7d('0xc1')](_0x458f92[_0x1d7d('0x82')],{})[_0x1d7d('0x24')](respondWithResult(_0x55ea3b,0xc9))['catch'](handleError(_0x55ea3b,null));};exports['update']=function(_0xbde512,_0x21995f){if(_0xbde512[_0x1d7d('0x82')]['id']){delete _0xbde512[_0x1d7d('0x82')]['id'];}return db[_0x1d7d('0x48')][_0x1d7d('0x6f')]({'where':{'id':_0xbde512['params']['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x21995f,null))['then'](saveUpdates(_0xbde512[_0x1d7d('0x82')],null))[_0x1d7d('0x24')](respondWithResult(_0x21995f,null))['catch'](handleError(_0x21995f,null));};exports[_0x1d7d('0xc2')]=function(_0x5a754a,_0x13566e){return db[_0x1d7d('0x48')][_0x1d7d('0x6f')]({'where':{'id':_0x5a754a[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x13566e,null))['then'](removeEntity(_0x13566e,null))[_0x1d7d('0x2e')](handleError(_0x13566e,null));};exports['describe']=function(_0x303d6f,_0x5bf0de){return db['ChatInteraction'][_0x1d7d('0xc3')]()[_0x1d7d('0x24')](respondWithResult(_0x5bf0de,null))[_0x1d7d('0x2e')](handleError(_0x5bf0de,null));};exports[_0x1d7d('0xc4')]=function(_0x8ce169,_0x3f119f){var _0x14d3fb=_0x8ce169[_0x1d7d('0xbe')]['id'];var _0x3d5fff;var _0x3b7543;var _0x3e94d6;return db[_0x1d7d('0x48')]['findOne']({'where':{'id':_0x14d3fb}})['then'](function(_0x1f2d68){_0x3d5fff=_0x1f2d68;return db['ChatWebsite'][_0x1d7d('0xc5')]({'where':{'id':_0x1f2d68['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0x1d7d('0xc6'),_0x1d7d('0xc7'),_0x1d7d('0xc8'),_0x1d7d('0xc9')],'raw':!![]});})[_0x1d7d('0x24')](function(_0xd919b1){if(_0xd919b1&&_0xd919b1[_0x1d7d('0xca')]&&_0xd919b1[_0x1d7d('0xc6')]){_0x3b7543=_0xd919b1;var _0x5690c={'interaction':{'id':_0x14d3fb},'agent':{'id':_0x8ce169['user']['id'],'name':_0x8ce169['user'][_0x1d7d('0x3b')],'fullname':_0x8ce169['user'][_0x1d7d('0x42')],'email':_0x8ce169[_0x1d7d('0xa1')][_0x1d7d('0xcb')]},'contact':_0x8ce169[_0x1d7d('0x82')][_0x1d7d('0x3d')],'account':_0x8ce169[_0x1d7d('0x82')][_0x1d7d('0x40')]};var _0x3774f8={'rejectUnauthorized':![],'method':_0x1d7d('0xcc'),'url':_0x1d7d('0xcd'),'headers':{'X-APIKEY':_0xd919b1[_0x1d7d('0xca')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x8ce169[_0x1d7d('0xa1')]['email']],'buttons':null,'topic':_0x3b7543['vidaooTopic'],'note':_[_0x1d7d('0xce')](_0x3b7543[_0x1d7d('0xc8')])?null:getMustacheRender(_0x3b7543[_0x1d7d('0xc8')],_0x5690c),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x3b7543[_0x1d7d('0xc9')])){var _0x470f5e=getMustacheRender(_0x3b7543['vidaooMetadata'],_0x5690c);var _0x1f0d9f=JSON['parse'](_0x470f5e);_0x3774f8[_0x1d7d('0x82')]['metadata']=_0x1f0d9f;}}catch(_0x1f50d4){throw new db[(_0x1d7d('0x98'))][(_0x1d7d('0xcf'))](_0x1d7d('0xd0'));}return rp(_0x3774f8);}else{throw new db[(_0x1d7d('0x98'))][(_0x1d7d('0xcf'))](_0x1d7d('0xd1'));}})[_0x1d7d('0x24')](function(_0x4f1602){_0x3e94d6=_0x4f1602;if(_0x3e94d6['id']){var _0x202d85={'body':_0x3e94d6[_0x1d7d('0xd2')],'ChatWebsiteId':_0x3b7543['id'],'ChatInteractionId':_0x3d5fff['id'],'direction':_0x1d7d('0xd3'),'UserId':_0x8ce169[_0x1d7d('0xa1')]['id']};return db[_0x1d7d('0xd4')][_0x1d7d('0xc1')](_0x202d85,{});}else{throw new db['Sequelize'][(_0x1d7d('0xcf'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x1d7d('0x24')](function(){return _0x3d5fff[_0x1d7d('0xd5')]({'vidaooSessionId':_0x3e94d6['id']});})['then'](respondWithResult(_0x3f119f,null))[_0x1d7d('0x2e')](handleError(_0x3f119f,null));};exports[_0x1d7d('0xd6')]=function(_0x3e7f3c,_0x454679){if(_0x3e7f3c['body']['id']){delete _0x3e7f3c[_0x1d7d('0x82')]['id'];}return db[_0x1d7d('0x48')]['find']({'where':{'id':_0x3e7f3c['params']['id']},'include':[{'model':db[_0x1d7d('0xd7')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x454679,null))['then'](saveUpdates(_0x3e7f3c[_0x1d7d('0x82')],null))['then'](respondWithResult(_0x454679,null))[_0x1d7d('0x2e')](handleError(_0x454679,null));};exports[_0x1d7d('0xd8')]=function(_0x4abfb1,_0x4caa84,_0x561f33){if(_0x4abfb1[_0x1d7d('0x82')]['id']){delete _0x4abfb1[_0x1d7d('0x82')]['id'];}return db[_0x1d7d('0x48')]['find']({'where':{'id':_0x4abfb1[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](function(_0x54616b){if(!_0x54616b){logger['error'](_0x1d7d('0xd9'),'abandon',0x194,'entity\x20not\x20found');_0x4caa84[_0x1d7d('0x2f')](0x194);}else{if(_0x54616b[_0x1d7d('0xda')]){throw new db[(_0x1d7d('0x98'))][(_0x1d7d('0xcf'))](_0x1d7d('0xdb'));}}return _0x54616b;})[_0x1d7d('0x24')](function(_0x19427f){if(_0x19427f){return _0x19427f[_0x1d7d('0xdc')]({'closed':_0x4abfb1['body']['closed'],'disposition':_0x4abfb1[_0x1d7d('0x82')][_0x1d7d('0xdd')]})[_0x1d7d('0x24')](function(_0x4d8a36){return _0x4d8a36;});}})[_0x1d7d('0x24')](function(_0x216585){return respondWithRpcPromise('AbandonInteraction',_0x1d7d('0xd8'),_0x4abfb1[_0x1d7d('0x82')],client9004);})[_0x1d7d('0x24')](respondWithResult(_0x4caa84,null))['catch'](handleError(_0x4caa84,null));};exports['attachmentUpload']=function(_0x854f68,_0x205d6f,_0x149415){_0x854f68[_0x1d7d('0x82')][_0x1d7d('0x3b')]=_0x854f68[_0x1d7d('0xde')]['originalname'];_0x854f68[_0x1d7d('0x82')][_0x1d7d('0xdf')]=_0x854f68['file'][_0x1d7d('0xe0')];_0x854f68[_0x1d7d('0x82')]['type']=_0x854f68['file']['mimetype'];return db[_0x1d7d('0xe1')][_0x1d7d('0xc1')](_0x854f68[_0x1d7d('0x82')])[_0x1d7d('0x24')](respondWithResult(_0x205d6f,0xc9))[_0x1d7d('0x2e')](handleError(_0x205d6f,null));};exports[_0x1d7d('0xe2')]=function(_0x3e358c,_0x2eae3c,_0x3838ef){return db[_0x1d7d('0x48')][_0x1d7d('0xc5')]({'where':{'id':_0x3e358c[_0x1d7d('0xbe')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2eae3c,null))['then'](function(_0x545b09){if(_0x545b09){if(_0x545b09[_0x1d7d('0xe3')]){return _0x2eae3c[_0x1d7d('0x30')](0x193)[_0x1d7d('0xe4')]({'status':0x193,'message':_0x1d7d('0xe5')});}return db[_0x1d7d('0xe1')][_0x1d7d('0xc5')]({'where':{'id':_0x3e358c[_0x1d7d('0x4e')][_0x1d7d('0xe6')]},'raw':!![]})['then'](handleEntityNotFound(_0x2eae3c,null));}})['then'](function(_0x549144){if(_0x549144){var _0x2a4feb=_0x549144[_0x1d7d('0xe7')]!==null;var _0x4df896=path[_0x1d7d('0xe8')](config['root'],_0x1d7d('0xe9'));if(_0x2a4feb){_0x4df896=path[_0x1d7d('0xe8')](_0x4df896,_0x1d7d('0xea'));}var _0x37eb97=path[_0x1d7d('0xe8')](_0x4df896,_0x549144[_0x1d7d('0xdf')]);return _0x2eae3c['download'](_0x37eb97);}})[_0x1d7d('0x2e')](handleError(_0x2eae3c,null));};exports[_0x1d7d('0xeb')]=function(_0x185697,_0x4d5753){var _0x55929b=null;var _0x43ce7f=null;var _0x2b0486=null;var _0x337c32=null;if(_0x185697['body']['id']){delete _0x185697[_0x1d7d('0x82')]['id'];}if(_0x185697['body'][_0x1d7d('0xec')]){_0x337c32=path[_0x1d7d('0xe8')](config[_0x1d7d('0xed')],'server/files/chat/upload/',util['format'](_0x1d7d('0xee'),Date[_0x1d7d('0xef')]()));_0x185697[_0x1d7d('0x82')][_0x1d7d('0xf0')]=_0x337c32;}return db[_0x1d7d('0x48')][_0x1d7d('0x6f')]({'where':{'id':_0x185697[_0x1d7d('0xbe')]['id']},'include':[{'model':db[_0x1d7d('0xd4')],'as':_0x1d7d('0xf1'),'include':[{'model':db[_0x1d7d('0x80')],'as':_0x1d7d('0x80')}]}]})['then'](handleEntityNotFound(_0x4d5753,null))[_0x1d7d('0x24')](saveUpdates(_0x185697[_0x1d7d('0x82')],null))[_0x1d7d('0x24')](function(_0x551a56){if(_0x551a56){_0x55929b=_0x551a56;return db['ChatWebsite'][_0x1d7d('0x6f')]({'where':{'id':_0x55929b['ChatWebsiteId']}});}})[_0x1d7d('0x24')](function(_0x1d47d9){if(_0x1d47d9){_0x2b0486=_0x1d47d9;return db[_0x1d7d('0xd7')]['find']({'where':{'id':_0x55929b[_0x1d7d('0x7b')]}});}})['then'](function(_0x5c0be4){if(_0x5c0be4){_0x43ce7f=_0x5c0be4;if(_0x337c32){var _0x46b9e5=null;for(var _0x385e15=0x1;_0x385e15<_0x55929b['Messages'][_0x1d7d('0x6e')];++_0x385e15){_0x46b9e5=_0x55929b[_0x1d7d('0xf1')][_0x385e15];var _0x20543c=_0x46b9e5[_0x1d7d('0xda')]?util[_0x1d7d('0xf2')]('%s%d',_0x2b0486[_0x1d7d('0xf3')],_0x46b9e5['UserId']):_0x1d7d('0xf4');var _0x474f68=_0x185697['body'][_0x1d7d('0xf5')]||util[_0x1d7d('0xf2')](_0x1d7d('0xf6'),_0x1d7d('0xf7'),_0x46b9e5[_0x1d7d('0x7b')]);switch(_0x2b0486[_0x1d7d('0xf8')]){case _0x1d7d('0xf9'):_0x20543c=_0x46b9e5[_0x1d7d('0xda')]?util[_0x1d7d('0xf2')](_0x1d7d('0xf6'),_0x2b0486[_0x1d7d('0xf3')],_0x46b9e5[_0x1d7d('0xda')]):_0x1d7d('0xf4');break;case'agent_alias':_0x20543c=_0x46b9e5['UserId']?_0x46b9e5[_0x1d7d('0x80')]['alias']||_0x46b9e5['User'][_0x1d7d('0x42')]:'System';break;case _0x1d7d('0xfa'):_0x20543c=_0x46b9e5[_0x1d7d('0xda')]?_0x46b9e5[_0x1d7d('0x80')]['fullname']:_0x1d7d('0xf4');break;default:_0x20543c=_0x46b9e5[_0x1d7d('0xda')]?util[_0x1d7d('0xf2')](_0x1d7d('0xf6'),_0x2b0486[_0x1d7d('0xf3')],_0x46b9e5[_0x1d7d('0xda')]):_0x1d7d('0xf4');}var _0x353bb1=util[_0x1d7d('0xf2')]('[%s]\x20%s:\x20%s\x0a',moment(_0x46b9e5[_0x1d7d('0x87')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x46b9e5[_0x1d7d('0xfb')]==='in'?_0x474f68:_0x20543c,_0x46b9e5['body']);if(!_0x46b9e5[_0x1d7d('0xfc')]){fs[_0x1d7d('0xfd')](_0x337c32,_0x353bb1);}}return db[_0x1d7d('0xfe')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x1d7d('0xff'),'raw':!![]}]});}}})[_0x1d7d('0x24')](function(_0x5c2113){if(_0x5c2113&&_0x5c2113[_0x1d7d('0xff')]&&_0x185697[_0x1d7d('0x82')]){var _0x129d4b={'tls':{'rejectUnauthorized':![]}};if(_0x5c2113['Smtp']['service']){_0x129d4b[_0x1d7d('0x100')]=_0x5c2113[_0x1d7d('0xff')][_0x1d7d('0x100')];}else{_0x129d4b['host']=_0x5c2113[_0x1d7d('0xff')][_0x1d7d('0x101')];_0x129d4b['port']=_0x5c2113['Smtp']['port'];_0x129d4b[_0x1d7d('0x102')]=_0x5c2113[_0x1d7d('0xff')][_0x1d7d('0x102')];}if(_0x5c2113['Smtp']['authentication']){_0x129d4b[_0x1d7d('0x103')]={'user':_0x5c2113[_0x1d7d('0xff')]['user'],'pass':_0x5c2113['Smtp'][_0x1d7d('0x104')]};}return respondWithRpcPromise(_0x1d7d('0x105'),'sendMail',{'account':_0x129d4b,'message':{'from':util[_0x1d7d('0xf2')]('\x22%s\x22\x20<%s>',_0x5c2113[_0x1d7d('0x3b')],_0x5c2113[_0x1d7d('0xcb')]||_0x5c2113[_0x1d7d('0xff')][_0x1d7d('0xa1')]),'to':_0x185697[_0x1d7d('0x82')][_0x1d7d('0xec')],'subject':_0x1d7d('0x106'),'text':util[_0x1d7d('0xf2')](_0x1d7d('0x107'),_0x185697[_0x1d7d('0x82')][_0x1d7d('0xec')]),'attachments':[{'path':_0x337c32}]}})['then'](function(){return _0x55929b;})[_0x1d7d('0x2e')](function(_0x18c505){console[_0x1d7d('0x29')](_0x18c505);});}else{return _0x55929b;}})['then'](respondWithStatusCode(_0x4d5753,0xc8))['catch'](handleError(_0x4d5753,null));};exports[_0x1d7d('0x108')]=function(_0x1b41b5,_0x5b79bd,_0xb87340){return db[_0x1d7d('0xd4')][_0x1d7d('0x6f')]({'where':{'id':_0x1b41b5[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x5b79bd,null))[_0x1d7d('0x24')](function(_0x537520){if(_0x537520){return _0x537520[_0x1d7d('0x108')](_0x1b41b5['body']['ids'],_['omit'](_0x1b41b5[_0x1d7d('0x82')],['ids','id'])||{});}})[_0x1d7d('0x24')](respondWithResult(_0x5b79bd,null))[_0x1d7d('0x2e')](handleError(_0x5b79bd,null));};exports['getMessages']=function(_0x1ce79d,_0x7dbbc9,_0x286ddd){var _0x1484b1={'raw':![],'where':{}};var _0x5be0c4={};var _0x50be17={'count':0x0,'rows':[]};return db[_0x1d7d('0x48')][_0x1d7d('0xc5')]({'where':{'id':_0x1ce79d[_0x1d7d('0xbe')]['id']}})['then'](handleEntityNotFound(_0x7dbbc9,null))['then'](function(_0x81fadf){if(_0x81fadf){_0x5be0c4['model']=_[_0x1d7d('0x4f')](db[_0x1d7d('0xd4')][_0x1d7d('0x49')]);_0x5be0c4[_0x1d7d('0x4e')]=_['keys'](_0x1ce79d[_0x1d7d('0x4e')]);_0x5be0c4['filters']=_[_0x1d7d('0x50')](_0x5be0c4[_0x1d7d('0x4d')],_0x5be0c4[_0x1d7d('0x4e')]);_0x1484b1['attributes']=_[_0x1d7d('0x50')](_0x5be0c4[_0x1d7d('0x4d')],qs['fields'](_0x1ce79d[_0x1d7d('0x4e')][_0x1d7d('0x51')]));_0x1484b1[_0x1d7d('0x52')]=_0x1484b1[_0x1d7d('0x52')]['length']?_0x1484b1[_0x1d7d('0x52')]:_0x5be0c4[_0x1d7d('0x4d')];if(!_0x1ce79d[_0x1d7d('0x4e')]['hasOwnProperty']('nolimit')){_0x1484b1[_0x1d7d('0x32')]=qs['limit'](_0x1ce79d[_0x1d7d('0x4e')][_0x1d7d('0x32')]);_0x1484b1[_0x1d7d('0x35')]=qs['offset'](_0x1ce79d[_0x1d7d('0x4e')]['offset']);}_0x1484b1[_0x1d7d('0x9c')]=qs['sort'](_0x1ce79d[_0x1d7d('0x4e')]['sort']);_0x1484b1['where']=qs[_0x1d7d('0x57')](_[_0x1d7d('0x58')](_0x1ce79d[_0x1d7d('0x4e')],_0x5be0c4[_0x1d7d('0x57')]));_0x1484b1[_0x1d7d('0x56')]['ChatInteractionId']=_0x81fadf['id'];if(_0x1ce79d[_0x1d7d('0x4e')][_0x1d7d('0x92')]){_0x1484b1[_0x1d7d('0x56')]=_['merge'](_0x1484b1[_0x1d7d('0x56')],{'$or':_['map'](_0x1484b1['attributes'],function(_0x19ee24){var _0x3cdad2={};_0x3cdad2[_0x19ee24]={'$like':'%'+_0x1ce79d['query'][_0x1d7d('0x92')]+'%'};return _0x3cdad2;})});}if(_0x1ce79d[_0x1d7d('0x4e')][_0x1d7d('0x89')]){var _0x24984d=_0x1ce79d[_0x1d7d('0x4e')]['$gte'][_0x1d7d('0x77')](',');var _0x5a2144={};_0x5a2144[_0x24984d[0x0]]={'$gte':moment(_0x24984d[0x1])[_0x1d7d('0xf2')](_0x1d7d('0x109'))};_0x1484b1[_0x1d7d('0x56')]=_['merge'](_0x1484b1['where'],_0x5a2144);}_0x1484b1=_['merge']({},_0x1484b1,_0x1ce79d['options']);return db['ChatMessage'][_0x1d7d('0x34')]({'where':_0x1484b1[_0x1d7d('0x56')]})[_0x1d7d('0x24')](function(_0x1e83dc){_0x50be17[_0x1d7d('0x34')]=_0x1e83dc;if(_0x1ce79d['query']['includeAll']){_0x1484b1[_0x1d7d('0xc0')]=[{'all':!![]}];}return db[_0x1d7d('0xd4')]['findAll'](_0x1484b1);})[_0x1d7d('0x24')](function(_0x2d0232){_0x50be17[_0x1d7d('0xbc')]=_0x2d0232;return _0x50be17;});}})['then'](respondWithFilteredResult(_0x7dbbc9,_0x1484b1))[_0x1d7d('0x2e')](handleError(_0x7dbbc9,null));};exports[_0x1d7d('0x10a')]=function(_0xb42210,_0x3844b6,_0x1181b6){var _0x530493={'where':{}},_0x53cdb8={},_0x960917={'count':0x0,'rows':[]};return db[_0x1d7d('0x48')][_0x1d7d('0xc5')]({'where':{'id':_0xb42210[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x3844b6,null))['then'](function(_0x339603){if(_0x339603){_0x53cdb8[_0x1d7d('0x4d')]=_['keys'](db['ChatMessage'][_0x1d7d('0x49')]);_0x53cdb8['query']=_[_0x1d7d('0x4f')](_0xb42210[_0x1d7d('0x4e')]);_0x53cdb8[_0x1d7d('0x57')]=_[_0x1d7d('0x50')](_0x53cdb8[_0x1d7d('0x4d')],_0x53cdb8[_0x1d7d('0x4e')]);_0x530493[_0x1d7d('0x52')]=_['intersection'](_0x53cdb8[_0x1d7d('0x4d')],qs[_0x1d7d('0x51')](_0xb42210[_0x1d7d('0x4e')]['fields']));_0x530493[_0x1d7d('0x52')]=_0x530493[_0x1d7d('0x52')]['length']?_0x530493[_0x1d7d('0x52')]:_0x53cdb8['model'];if(!_0xb42210[_0x1d7d('0x4e')][_0x1d7d('0x53')](_0x1d7d('0x54'))){_0x530493[_0x1d7d('0x32')]=qs[_0x1d7d('0x32')](_0xb42210['query'][_0x1d7d('0x32')]);_0x530493[_0x1d7d('0x35')]=qs['offset'](_0xb42210['query'][_0x1d7d('0x35')]);}_0x530493[_0x1d7d('0x9c')]=qs['sort'](_0xb42210[_0x1d7d('0x4e')][_0x1d7d('0x55')]);_0x530493[_0x1d7d('0x56')]=qs[_0x1d7d('0x57')](_['pick'](_0xb42210['query'],_0x53cdb8[_0x1d7d('0x57')]));_0x530493[_0x1d7d('0x56')][_0x1d7d('0xba')]=_0x339603['id'];if(_0xb42210[_0x1d7d('0x4e')][_0x1d7d('0x92')]){_0x530493[_0x1d7d('0x56')]=_[_0x1d7d('0xa7')](_0x530493[_0x1d7d('0x56')],{'$or':_[_0x1d7d('0x41')](_0x530493[_0x1d7d('0x52')],function(_0x3dfeb8){var _0x4726cb={};_0x4726cb[_0x3dfeb8]={'$like':'%'+_0xb42210[_0x1d7d('0x4e')][_0x1d7d('0x92')]+'%'};return _0x4726cb;})});}_0x530493[_0x1d7d('0x56')][_0x1d7d('0xfc')]=![];if(_0xb42210[_0x1d7d('0x4e')]['id']){_0x530493['where']['id']={'$gt':_0xb42210[_0x1d7d('0x4e')]['id']};}_0x530493=_['merge']({},_0x530493,_0xb42210['options']);return db[_0x1d7d('0xd4')][_0x1d7d('0x34')]({'where':_0x530493[_0x1d7d('0x56')]})[_0x1d7d('0x24')](function(_0x1e2b03){_0x960917['count']=_0x1e2b03;_0x530493[_0x1d7d('0xc0')]=[];if(_0xb42210[_0x1d7d('0x4e')]['includeAgent']){_0x530493[_0x1d7d('0xc0')]['push']({'model':db[_0x1d7d('0x80')],'as':_0x1d7d('0x80'),'attributes':['id',_0x1d7d('0x42'),_0x1d7d('0x10b')]});}if(_0xb42210[_0x1d7d('0x4e')]['includeAll']){_0x530493[_0x1d7d('0xc0')]=[{'all':!![]}];}return db[_0x1d7d('0xd4')][_0x1d7d('0x10c')](_0x530493);})[_0x1d7d('0x24')](function(_0x2d1258){_0x960917[_0x1d7d('0xbc')]=_0x2d1258;return _0x960917;});}})[_0x1d7d('0x24')](respondWithFilteredResult(_0x3844b6,_0x530493))[_0x1d7d('0x2e')](handleError(_0x3844b6,null));};exports[_0x1d7d('0x10d')]=function(_0x34b43f,_0x14a937,_0x291f26){return db['ChatInteraction'][_0x1d7d('0x6f')]({'where':{'id':_0x34b43f[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x14a937,null))['then'](function(_0x59b044){if(_0x59b044){return _0x59b044[_0x1d7d('0x10e')](_0x34b43f['body'][_0x1d7d('0x10f')],_[_0x1d7d('0x110')](_0x34b43f[_0x1d7d('0x82')],[_0x1d7d('0x10f'),'id'])||{})[_0x1d7d('0x111')](function(){return db[_0x1d7d('0x7e')]['findAll']({'attributes':['id',_0x1d7d('0x3b'),'color'],'where':{'id':_0x34b43f['body'][_0x1d7d('0x10f')]}});})[_0x1d7d('0x24')](function(_0x5b1ae1){socket[_0x1d7d('0x112')](_0x1d7d('0x113'),{'id':Number(_0x34b43f['params']['id']),'tags':_0x5b1ae1||[]});return{'id':Number(_0x34b43f[_0x1d7d('0xbe')]['id']),'tags':_0x5b1ae1||[]};});}})['then'](respondWithResult(_0x14a937,null))[_0x1d7d('0x2e')](handleError(_0x14a937,null));};exports[_0x1d7d('0x114')]=function(_0x7c3bd8,_0x552481,_0x2c91d5){return db['ChatInteraction'][_0x1d7d('0x6f')]({'where':{'id':_0x7c3bd8[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x552481,null))[_0x1d7d('0x24')](function(_0xf5e9f8){if(_0xf5e9f8){return _0xf5e9f8['removeTags'](_0x7c3bd8['query'][_0x1d7d('0x10f')]);}})[_0x1d7d('0x24')](respondWithStatusCode(_0x552481,null))['catch'](handleError(_0x552481,null));};exports[_0x1d7d('0x115')]=function(_0x210be0,_0x5f1b69){var _0x44c5ac=moment()[_0x1d7d('0x116')]()['toString']();var _0x39cae3=path[_0x1d7d('0xe8')](config[_0x1d7d('0xed')],'server','files',_0x1d7d('0x117'));var _0x1eec70=path[_0x1d7d('0xe8')](config[_0x1d7d('0xed')],_0x1d7d('0x118'),_0x1d7d('0x119'),_0x1d7d('0x11a'));var _0x3ded4b=path['join'](_0x39cae3,_0x44c5ac);var _0xe65d48=util[_0x1d7d('0xf2')](_0x1d7d('0x11b'),_0x210be0[_0x1d7d('0xbe')]['id'],_0x44c5ac);var _0x3b440c=path['join'](_0x39cae3,_0xe65d48);var _0x473472=[];_0x473472[_0x1d7d('0x46')]({'model':db[_0x1d7d('0x80')],'as':_0x1d7d('0x80'),'attributes':['id',_0x1d7d('0x42')],'raw':!![]});_0x473472[_0x1d7d('0x46')]({'model':db[_0x1d7d('0xd7')],'as':_0x1d7d('0x73'),'attributes':['id','firstName',_0x1d7d('0x11c')],'raw':!![]});if(_0x210be0[_0x1d7d('0x4e')][_0x1d7d('0x11a')]){_0x473472[_0x1d7d('0x46')]({'model':db['Attachment'],'as':_0x1d7d('0xe1'),'raw':!![]});}var _0x2aab28=[{'model':db[_0x1d7d('0xd4')],'as':_0x1d7d('0xf1'),'attributes':['id','body',_0x1d7d('0x87'),_0x1d7d('0xfb'),'secret',_0x1d7d('0x8e')],'include':_0x473472}];_0x2aab28['push']({'model':db[_0x1d7d('0x11d')],'as':'Account','attributes':['id','name']});_0x2aab28[_0x1d7d('0x46')]({'model':db[_0x1d7d('0x80')],'as':'Owner','attributes':['id','fullname']});return db[_0x1d7d('0x48')]['find']({'where':{'id':_0x210be0[_0x1d7d('0xbe')]['id']},'include':_0x2aab28})[_0x1d7d('0x24')](handleEntityNotFound(_0x5f1b69,null))[_0x1d7d('0x24')](function(_0x4e8473){if(_0x4e8473){var _0x194822=_0x4e8473[_0x1d7d('0x11e')]({'plain':!![]});fs[_0x1d7d('0x11f')](_0x3ded4b);var _0x3e93bb={'channel':_0x1d7d('0x120'),'account':_0x194822[_0x1d7d('0x121')]['name'],'agent':_0x194822['Owner']?_0x194822[_0x1d7d('0x122')][_0x1d7d('0x42')]:_0x1d7d('0x123'),'createdAt':moment(_0x194822[_0x1d7d('0x87')])[_0x1d7d('0xf2')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x194822[_0x1d7d('0xe3')]?moment(_0x194822['closedAt'])['format'](_0x1d7d('0x109'))[_0x1d7d('0xa5')]():'','disposition':_0x194822[_0x1d7d('0xdd')],'chatInfo':{'browser':_0x194822[_0x1d7d('0x124')],'os':_0x194822[_0x1d7d('0x125')],'referer':_0x194822['referer'],'customerIp':_0x194822[_0x1d7d('0x126')],'customerPort':_0x194822[_0x1d7d('0x127')]?_0x194822[_0x1d7d('0x127')]:_0x1d7d('0x123')},'messages':_(_0x194822[_0x1d7d('0xf1')])[_0x1d7d('0x128')]()['filter']({'secret':![]})[_0x1d7d('0x41')](function(_0x6ea91f){if(_0x6ea91f[_0x1d7d('0xe1')]){var _0x2b3cbd=path[_0x1d7d('0xe8')](_0x1eec70,_0x6ea91f[_0x1d7d('0xe1')][_0x1d7d('0xdf')]);if(fs['existsSync'](_0x2b3cbd)){fs[_0x1d7d('0x129')](_0x2b3cbd)[_0x1d7d('0x12a')](fs[_0x1d7d('0x12b')](path[_0x1d7d('0xe8')](_0x3ded4b,_0x6ea91f[_0x1d7d('0xe1')]['basename'])));}}return{'date':moment(_0x6ea91f[_0x1d7d('0x87')])[_0x1d7d('0xf2')](_0x1d7d('0x109'))[_0x1d7d('0xa5')](),'sender':_0x6ea91f['direction']==='out'?_0x6ea91f[_0x1d7d('0x80')]?_0x6ea91f[_0x1d7d('0x80')][_0x1d7d('0x42')]:_0x1d7d('0xf4'):_0x6ea91f[_0x1d7d('0x73')]['firstName']+(_0x6ea91f[_0x1d7d('0x73')][_0x1d7d('0x11c')]?'\x20'+_0x6ea91f[_0x1d7d('0x73')]['lastName']:''),'body':_0x6ea91f[_0x1d7d('0xe1')]?_0x6ea91f[_0x1d7d('0xe1')][_0x1d7d('0xdf')]:_0x6ea91f[_0x1d7d('0x82')],'direction':_0x6ea91f['direction']===_0x1d7d('0xd3')?'A':'C','secret':_0x6ea91f[_0x1d7d('0xfc')],'read':_0x6ea91f[_0x1d7d('0x8e')],'attachment':_0x6ea91f['Attachment']};})[_0x1d7d('0x76')]()};return ejs[_0x1d7d('0x12c')](path[_0x1d7d('0xe8')](config[_0x1d7d('0xed')],'server','views',_0x1d7d('0x12d')),{'interaction':_0x3e93bb})[_0x1d7d('0x24')](function(_0x43f4cb){var _0x21d65a=path[_0x1d7d('0xe8')](_0x3ded4b,'transcript-'+_0x194822['id']+'-'+_0x44c5ac+_0x1d7d('0x12e'));var _0x4d0682={'path':_0x21d65a,'channel':_0x1d7d('0x120'),'interactionId':_0x194822['id']};return pdf[_0x1d7d('0x12f')](_0x43f4cb,_0x4d0682);})['then'](function(){return new BPromise(function(_0x29f93c,_0x582183){zipdir(_0x3ded4b,{'saveTo':_0x3b440c},function(_0x12250e,_0x19127b){if(_0x12250e)return _0x582183(_0x12250e);return _0x29f93c(_0x19127b);});})['then'](function(){return new BPromise(function(_0x35f2d1,_0x588610){rimraf(_0x3ded4b,function(_0x35f18d){if(_0x35f18d)_0x588610(_0x35f18d);return _0x35f2d1();});});})[_0x1d7d('0x24')](function(){return _0x5f1b69[_0x1d7d('0x115')](_0x3b440c,_0xe65d48,function(_0x10263c){if(_0x10263c){console['log']('err',_0x10263c);}else{fs[_0x1d7d('0x130')](_0x3b440c);}});});});}else{return _0x5f1b69[_0x1d7d('0x2f')](0xc8);}})[_0x1d7d('0x2e')](handleError(_0x5f1b69,null));}; \ No newline at end of file +var _0x14a0=['t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ChatInteractionId','rows','show','params','intersection','includeAll','include','options','create','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','customUpdate','CmContact','Contact','abandon','closed','disposition','AbandonInteraction','file','originalname','basename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','download','server/files/chat/upload/','transcript-%s.txt','now','ChatMessage','Messages','format','agentAlias','System','customer','agentIdentifier','%s%d','agent_alias','alias','agent_fullname','createdAt','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','addTags','omit','spread','chatInteractionTags:save','removeTags','files','server','attachments','firstName','lastName','Account','get','Chat','Owner','N.A.','closedAt','osName','referer','customerPort','existsSync','createReadStream','pipe','out','views','transcript-','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','merge','contact','agent','interaction','account','Users','map','fullname','Tags','TagIds','split','forEach','push','ChatInteraction','rawAttributes','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','select','color','tools_tags','field','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','length','getFullTextValue','ContactId','buildExpression','text','start','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','isEmpty','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','DESC'];(function(_0x5844c3,_0x13fc8c){var _0x3a4d56=function(_0x24328e){while(--_0x24328e){_0x5844c3['push'](_0x5844c3['shift']());}};_0x3a4d56(++_0x13fc8c);}(_0x14a0,0x8e));var _0x014a=function(_0x555dd8,_0x494deb){_0x555dd8=_0x555dd8-0x0;var _0x168163=_0x14a0[_0x555dd8];return _0x168163;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x014a('0xf'));var logger=require(_0x014a('0x10'))('api');var utils=require(_0x014a('0x11'));var config=require(_0x014a('0x12'));var licenseUtil=require(_0x014a('0x13'));var db=require(_0x014a('0x14'))['db'];config[_0x014a('0x15')]=_[_0x014a('0x16')](config[_0x014a('0x15')],{'host':_0x014a('0x17'),'port':0x18eb});var socket=require(_0x014a('0x18'))(new Redis(config[_0x014a('0x15')]));require(_0x014a('0x19'))[_0x014a('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x014a('0x1b')][_0x014a('0x1c')]({'port':0x232b});var client9004=jayson['client'][_0x014a('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x128c46,_0x59a4ea,_0x16e6fc,_0x17e4be){return new BPromise(function(_0x20f148,_0x12da95){var _0x2c26ac=_0x17e4be||client;return _0x2c26ac[_0x014a('0x1d')](_0x128c46,_0x16e6fc)[_0x014a('0x1e')](function(_0x263b07){logger[_0x014a('0x1f')](_0x014a('0x20'),_0x59a4ea,_0x014a('0x21'));logger[_0x014a('0x22')](_0x014a('0x23'),_0x59a4ea,_0x014a('0x21'),JSON['stringify'](_0x263b07));if(_0x263b07[_0x014a('0x24')]){if(_0x263b07[_0x014a('0x24')][_0x014a('0x25')]===0x1f4){logger[_0x014a('0x24')](_0x014a('0x20'),_0x59a4ea,_0x263b07[_0x014a('0x24')][_0x014a('0x26')]);return _0x12da95(_0x263b07[_0x014a('0x24')][_0x014a('0x26')]);}logger['error'](_0x014a('0x20'),_0x59a4ea,_0x263b07['error'][_0x014a('0x26')]);return _0x20f148(_0x263b07[_0x014a('0x24')][_0x014a('0x26')]);}else{logger[_0x014a('0x1f')](_0x014a('0x20'),_0x59a4ea,_0x014a('0x21'));_0x20f148(_0x263b07[_0x014a('0x27')][_0x014a('0x26')]);}})[_0x014a('0x28')](function(_0x4c2627){logger[_0x014a('0x24')]('ChatInteraction,\x20%s,\x20%s',_0x59a4ea,_0x4c2627);_0x12da95(_0x4c2627);});});}function respondWithStatusCode(_0x39a432,_0x28701e){_0x28701e=_0x28701e||0xcc;return function(_0x4f1c44){if(_0x4f1c44){return _0x39a432['sendStatus'](_0x28701e);}return _0x39a432[_0x014a('0x29')](_0x28701e)[_0x014a('0x2a')]();};}function respondWithResult(_0x143346,_0x5ed71b){_0x5ed71b=_0x5ed71b||0xc8;return function(_0x183f19){if(_0x183f19){return _0x143346[_0x014a('0x29')](_0x5ed71b)['json'](_0x183f19);}};}function respondWithFilteredResult(_0x31dc95,_0x2560a6){return function(_0x496040){if(_0x496040){var _0x4f9c1c=typeof _0x2560a6[_0x014a('0x2b')]===_0x014a('0x2c')&&typeof _0x2560a6[_0x014a('0x2d')]===_0x014a('0x2c');var _0x4ea00c=_0x496040[_0x014a('0x2e')];var _0x147e7e=_0x4f9c1c?0x0:_0x2560a6[_0x014a('0x2b')];var _0x402d3b=_0x4f9c1c?_0x496040[_0x014a('0x2e')]:_0x2560a6[_0x014a('0x2b')]+_0x2560a6[_0x014a('0x2d')];var _0x1dae8e;if(_0x402d3b>=_0x4ea00c){_0x402d3b=_0x4ea00c;_0x1dae8e=0xc8;}else{_0x1dae8e=0xce;}_0x31dc95[_0x014a('0x29')](_0x1dae8e);return _0x31dc95[_0x014a('0x2f')](_0x014a('0x30'),_0x147e7e+'-'+_0x402d3b+'/'+_0x4ea00c)['json'](_0x496040);}return null;};}function patchUpdates(_0x105d4a){return function(_0x41ead8){try{jsonpatch[_0x014a('0x31')](_0x41ead8,_0x105d4a,!![]);}catch(_0x457883){return BPromise[_0x014a('0x32')](_0x457883);}return _0x41ead8[_0x014a('0x33')]();};}function saveUpdates(_0x211d18,_0x4dd025){return function(_0x116a24){if(_0x116a24){return _0x116a24[_0x014a('0x34')](_0x211d18)['then'](function(_0x415f83){return _0x415f83;});}return null;};}function removeEntity(_0x12de94,_0x40738f){return function(_0x467032){if(_0x467032){return _0x467032[_0x014a('0x35')]()[_0x014a('0x1e')](function(){_0x12de94[_0x014a('0x29')](0xcc)[_0x014a('0x2a')]();});}};}function handleEntityNotFound(_0x5e37e4,_0x19cee1){return function(_0x1dfe6e){if(!_0x1dfe6e){_0x5e37e4[_0x014a('0x36')](0x194);}return _0x1dfe6e;};}function handleError(_0x1f31c8,_0x5127f3){_0x5127f3=_0x5127f3||0x1f4;return function(_0x427c7a){logger[_0x014a('0x24')](_0x427c7a[_0x014a('0x37')]);if(_0x427c7a[_0x014a('0x38')]){delete _0x427c7a[_0x014a('0x38')];}_0x1f31c8[_0x014a('0x29')](_0x5127f3)[_0x014a('0x39')](_0x427c7a);};}function getMustacheRender(_0x36187b,_0x1ec350){return Mustache['render'](_0x36187b,_[_0x014a('0x3a')](_0x1ec350['body'],{'contact':_0x1ec350[_0x014a('0x3b')],'message':_0x1ec350[_0x014a('0x26')],'agent':_0x1ec350[_0x014a('0x3c')],'interaction':_0x1ec350[_0x014a('0x3d')],'account':_0x1ec350[_0x014a('0x3e')]}))||'';}function getInteractionUsers(_0x55126d,_0x1c6f6f){return new BPromise(function(_0x3f4a61,_0x51dca8){try{if(_0x1c6f6f[_0x55126d['id']]){_0x55126d[_0x014a('0x3f')]=_[_0x014a('0x40')](_0x1c6f6f[_0x55126d['id']],function(_0x3e5ecf){return{'id':_0x3e5ecf['id'],'fullname':_0x3e5ecf[_0x014a('0x41')]};});}}catch(_0x3788d6){_0x51dca8(_0x3788d6);}_0x3f4a61(_0x55126d);});}function getInteractionTags(_0x313eb8,_0x17b1b6){return new BPromise(function(_0x764fbe,_0x2beddc){try{if(_0x313eb8['TagIds']){_0x313eb8[_0x014a('0x42')]=[];_0x313eb8[_0x014a('0x43')][_0x014a('0x44')](',')[_0x014a('0x45')](function(_0x5f1a91){_0x313eb8[_0x014a('0x42')][_0x014a('0x46')](_0x17b1b6[_0x5f1a91]);});}delete _0x313eb8[_0x014a('0x43')];}catch(_0x1355dd){_0x2beddc(_0x1355dd);}_0x764fbe(_0x313eb8);});}function updateChatInteraction(_0x1dc647,_0x430a56,_0x5f2969){return new BPromise(function(_0x361866,_0x2830e1){return getInteractionUsers(_0x1dc647,_0x5f2969)['then'](function(_0xc086b3){return getInteractionTags(_0xc086b3,_0x430a56);})[_0x014a('0x1e')](function(_0x2c45f1){_0x361866(_0x2c45f1);})['catch'](function(_0x5bcf8){_0x2830e1(_0x5bcf8);});});}exports['index']=function(_0x5ab5e8,_0x67b30f){var _0x29c9ca={},_0x5aa496={},_0x1557ad={'count':0x0,'rows':[]};var _0x11c0d5=_[_0x014a('0x40')](db[_0x014a('0x47')][_0x014a('0x48')],function(_0xbaf8c6){return{'name':_0xbaf8c6['fieldName'],'type':_0xbaf8c6[_0x014a('0x49')][_0x014a('0x4a')]};});_0x5aa496[_0x014a('0x4b')]=_['map'](_0x11c0d5,'name');_0x5aa496[_0x014a('0x4c')]=_['keys'](_0x5ab5e8['query']);_0x5aa496[_0x014a('0x4d')]=_['intersection'](_0x5aa496[_0x014a('0x4b')],_0x5aa496[_0x014a('0x4c')]);_0x29c9ca[_0x014a('0x4e')]=_['intersection'](_0x5aa496[_0x014a('0x4b')],qs[_0x014a('0x4f')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x4f')]));_0x29c9ca[_0x014a('0x4e')]=_0x29c9ca[_0x014a('0x4e')]['length']?_0x29c9ca[_0x014a('0x4e')]:_0x5aa496[_0x014a('0x4b')];if(!_0x5ab5e8['query'][_0x014a('0x50')](_0x014a('0x51'))){_0x29c9ca[_0x014a('0x2d')]=qs[_0x014a('0x2d')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x2d')]);_0x29c9ca[_0x014a('0x2b')]=qs[_0x014a('0x2b')](_0x5ab5e8['query'][_0x014a('0x2b')]);}_0x29c9ca[_0x014a('0x52')]=qs[_0x014a('0x53')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x53')]);_0x29c9ca['where']=qs[_0x014a('0x4d')](_['pick'](_0x5ab5e8[_0x014a('0x4c')],_0x5aa496[_0x014a('0x4d')]),_0x11c0d5);var _0x40e02b=[];var _0x479dc0=squel[_0x014a('0x54')]()['field']('id')['field']('name')['field'](_0x014a('0x55'))['from'](_0x014a('0x56'));var _0x5b5318=squel['select']()[_0x014a('0x57')]('u.id')[_0x014a('0x57')](_0x014a('0x58'))[_0x014a('0x57')](_0x014a('0x59'))[_0x014a('0x5a')](_0x014a('0x5b'),'ui')[_0x014a('0x5c')](_0x014a('0x5d'),'u',_0x014a('0x5e'));var _0x3fc9ab=squel['select']()['from'](_0x014a('0x5f'),'i')[_0x014a('0x5c')](_0x014a('0x60'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x014a('0x5d'),'o','o.id\x20=\x20i.UserId')[_0x014a('0x5c')](_0x014a('0x61'),'a',_0x014a('0x62'))[_0x014a('0x5c')]('chat_messages','me',_0x014a('0x63'))[_0x014a('0x5c')](_0x014a('0x64'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x014a('0x5c')]('tools_tags','t',_0x014a('0x65'));var _0x47074f=squel[_0x014a('0x66')]();var _0x24d433=[];var _0xd0334a=squel[_0x014a('0x66')]();var _0x4e9260;if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x67')]){_0x4e9260=as[_0x014a('0x68')](_0x5ab5e8['query'][_0x014a('0x67')]);var _0x17f9d7=_0x4e9260[_0x014a('0x69')];for(var _0xa4fd8d=0x0;_0xa4fd8d<_0x4e9260[_0x014a('0x6a')]['length'];_0xa4fd8d++){var _0x8ac9cd=_0x4e9260[_0x014a('0x6a')][_0xa4fd8d];var _0x63c341='i';var _0x37a7b8=_[_0x014a('0x6b')](_0x11c0d5,[_0x014a('0x38'),_0x8ac9cd[_0x014a('0x57')]]);if(!_0x37a7b8){switch(_0x8ac9cd[_0x014a('0x57')]){case _0x014a('0x6c'):if(_0x8ac9cd[_0x014a('0x6d')]==0x1){_0x3fc9ab[_0x014a('0x6e')]('`'+_0x8ac9cd[_0x014a('0x57')]+'`\x20=\x200');}else{_0x3fc9ab[_0x014a('0x6e')]('`'+_0x8ac9cd['field']+'`\x20>\x200');}break;case'Contact':if(_0x8ac9cd['operator']==='$substring'){if(_0x8ac9cd[_0x014a('0x6d')][_0x014a('0x44')]('\x20')[_0x014a('0x6f')]>0x1){_0x47074f[_0x17f9d7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x014a('0x70')](_0x8ac9cd[_0x014a('0x6d')]),null);}else{var _0x3071c8='%'+_0x8ac9cd[_0x014a('0x6d')]+'%';_0x47074f[_0x17f9d7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3071c8,_0x3071c8,_0x3071c8);}}else{_0x37a7b8=_['find'](_0x11c0d5,[_0x014a('0x38'),_0x014a('0x71')]);_0x8ac9cd[_0x014a('0x57')]=_0x014a('0x71');_0x58e087=as[_0x014a('0x72')](_0x63c341,_0x37a7b8[_0x014a('0x49')],_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087[_0x014a('0x73')],_0x58e087[_0x014a('0x6d')][_0x014a('0x74')],_0x58e087[_0x014a('0x6d')][_0x014a('0x2a')]);}break;case'Tag':var _0x2d87e3=_0x8ac9cd[_0x014a('0x6d')]['split'](',')[_0x014a('0x40')](function(_0x3e39c9){return Number(_0x3e39c9);});_0x2d87e3['forEach'](function(_0x14f2e2){_0xd0334a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x14f2e2+',%');});_0x24d433=_[_0x014a('0x75')](_0x24d433,_0x2d87e3);break;case _0x014a('0x76'):if(_0x8ac9cd[_0x014a('0x77')]===_0x014a('0x78')){_0x47074f[_0x17f9d7](_0x014a('0x79'),'%'+_0x8ac9cd['value']+'%',null);}else{_0x37a7b8=_[_0x014a('0x6b')](_0x11c0d5,[_0x014a('0x38'),_0x014a('0x7a')]);_0x8ac9cd[_0x014a('0x57')]=_0x014a('0x7a');_0x58e087=as['buildExpression'](_0x63c341,_0x37a7b8[_0x014a('0x49')],_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087[_0x014a('0x73')],_0x58e087[_0x014a('0x6d')]['start'],_0x58e087[_0x014a('0x6d')]['end']);}break;case _0x014a('0x7b'):_0x58e087=as[_0x014a('0x72')]('me',null,_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087[_0x014a('0x73')],_0x58e087[_0x014a('0x6d')][_0x014a('0x74')],_0x58e087[_0x014a('0x6d')][_0x014a('0x2a')]);break;}}else{var _0x58e087=as['buildExpression'](_0x63c341,_0x37a7b8[_0x014a('0x49')],_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087['text'],_0x58e087[_0x014a('0x6d')]['start'],_0x58e087[_0x014a('0x6d')][_0x014a('0x2a')]);}}}else{var _0x55bca3=_(_0x5ab5e8['query'])[_0x014a('0x7c')]()[_0x014a('0x40')](function(_0x5f391d){return _[_0x014a('0x7d')](_0x11c0d5,[_0x014a('0x38'),_0x5f391d])?_0x5f391d:undefined;})['compact']()['value']();if(!_[_0x014a('0x7e')](_0x55bca3)){_0x55bca3[_0x014a('0x45')](function(_0x1ee130){if(_0x1ee130===_0x014a('0x7f')){_0x3fc9ab[_0x014a('0x80')](_0x014a('0x81'),[]['concat'](_0x5ab5e8[_0x014a('0x4c')][_0x1ee130]));}else if(_0x1ee130==='createdAt'){var _0x5a8351=JSON[_0x014a('0x82')](_0x5ab5e8[_0x014a('0x4c')][_0x1ee130])['$gte'];var _0x27e363=JSON[_0x014a('0x82')](_0x5ab5e8[_0x014a('0x4c')][_0x1ee130])[_0x014a('0x83')];_0x3fc9ab[_0x014a('0x80')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5a8351,_0x27e363);}else{if(_0x5ab5e8[_0x014a('0x4c')][_0x1ee130]===_0x014a('0x84')){_0x3fc9ab[_0x014a('0x80')]('i.'+_0x1ee130+_0x014a('0x85'));}else{_0x3fc9ab['where']('i.'+_0x1ee130+_0x014a('0x86'),_0x5ab5e8['query'][_0x1ee130]);}}});}if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x87')]){if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x87')]==0x1){_0x3fc9ab[_0x014a('0x6e')](_0x014a('0x88'));}else{_0x3fc9ab['having'](_0x014a('0x89'));}}if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8a')]){_0x24d433=_[_0x014a('0x8b')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8a')])?_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8a')]:new Array(_0x5ab5e8['query'][_0x014a('0x8a')]);_0x24d433[_0x014a('0x45')](function(_0x3c2a39){_0xd0334a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c2a39+',%');});}if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8c')]){var _0x1cdfa5=_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8c')][_0x014a('0x8d')]('\x5c','\x5c\x5c')[_0x014a('0x8d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1cdfa5)){_0x47074f['or']('i.id\x20LIKE\x20?',_0x1cdfa5+'%');}else{_0x47074f['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1cdfa5))['or'](_0x014a('0x8e'),_0x1cdfa5+'%');}}}_0x3fc9ab[_0x014a('0x80')](_0x47074f);_0x3fc9ab[_0x014a('0x8f')](_0x014a('0x90'));var _0xe1b5ed={'type':db[_0x014a('0x91')][_0x014a('0x92')]['SELECT'],'raw':!![]};var _0x24ffb0=_0x3fc9ab[_0x014a('0x93')]();_0x24ffb0[_0x014a('0x57')](_0x014a('0x90'));_0x24ffb0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x014a('0x6c'));if(_0x29c9ca[_0x014a('0x52')]){_0x29c9ca['order']['forEach'](function(_0x9aa04b){var _0x5bcaf9=_0x9aa04b[0x0]==='contactName'?_0x9aa04b[0x0]:'i.'+_0x9aa04b[0x0];_0x3fc9ab[_0x014a('0x52')](_0x5bcaf9,_0x9aa04b[0x1]===_0x014a('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x24d433)){_0x3fc9ab[_0x014a('0x6e')](_0xd0334a);_0x24ffb0[_0x014a('0x80')](_0x014a('0x95'),_0x24d433);}BPromise[_0x014a('0x96')]()[_0x014a('0x1e')](function(){if(!_0x4e9260){if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x7f')])return;_0x24ffb0[_0x014a('0x80')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x3fc9ab['where'](_0x014a('0x97'));return;}if(_0x5ab5e8['user']['role']!=='agent')return;return _0x5ab5e8[_0x014a('0x98')][_0x014a('0x99')]({'attributes':['id'],'raw':!![]})[_0x014a('0x1e')](function(_0x55408f){if(_[_0x014a('0x7e')](_0x55408f)){_0x24ffb0[_0x014a('0x80')](_0x014a('0x9a'));_0x3fc9ab[_0x014a('0x80')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x24ffb0[_0x014a('0x80')](_0x014a('0x81'),_[_0x014a('0x40')](_0x55408f,'id'));_0x3fc9ab['where'](_0x014a('0x81'),_[_0x014a('0x40')](_0x55408f,'id'));}});})['then'](function(){if(_0x5ab5e8[_0x014a('0x98')][_0x014a('0x9b')]===_0x014a('0x3c')&&!_0x4e9260&&!_0x5ab5e8['query'][_0x014a('0x7f')])return[];return db[_0x014a('0x9c')]['query'](_0x24ffb0[_0x014a('0x9d')](),_0xe1b5ed);})[_0x014a('0x1e')](function(_0x317df3){_0x1557ad[_0x014a('0x2e')]=_0x317df3[_0x014a('0x6f')];if(_0x1557ad[_0x014a('0x2e')]===0x0)return[];return db[_0x014a('0x9c')][_0x014a('0x4c')](_0x479dc0['toString'](),_0xe1b5ed)[_0x014a('0x1e')](function(_0x1806d0){_0x40e02b=_['keyBy'](_0x1806d0,'id');_0xe1b5ed=_['merge'](_0xe1b5ed,{'model':db[_0x014a('0x47')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5ab5e8[_0x014a('0x4c')]['fields']){_0x29c9ca[_0x014a('0x4e')][_0x014a('0x45')](function(_0x216b27){_0x3fc9ab['field']('i.'+_0x216b27);});}else{_0x3fc9ab[_0x014a('0x57')](_0x014a('0x9e'),'unreadMessages');_0x3fc9ab['field'](_0x014a('0x9f'),'Account.key');_0x3fc9ab[_0x014a('0x57')]('a.mandatoryDisposition',_0x014a('0xa0'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa1'),_0x014a('0xa2'));_0x3fc9ab[_0x014a('0x57')]('i.*');_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa3'),_0x014a('0xa4'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa5'),_0x014a('0xa6'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa7'),'Contact.email');_0x3fc9ab[_0x014a('0x57')]('c.phone',_0x014a('0xa8'));_0x3fc9ab['field']('c.mobile','Contact.mobile');_0x3fc9ab['field'](_0x014a('0xa9'),_0x014a('0xaa'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xab'),_0x014a('0xac'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xad'),_0x014a('0xae'));_0x3fc9ab['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x014a('0x43'));}if(_0x29c9ca[_0x014a('0x2d')])_0x3fc9ab[_0x014a('0x2d')](_0x29c9ca[_0x014a('0x2d')]);if(_0x29c9ca[_0x014a('0x2b')])_0x3fc9ab[_0x014a('0x2b')](_0x29c9ca[_0x014a('0x2b')]);return db[_0x014a('0x9c')]['query'](_0x3fc9ab[_0x014a('0x9d')](),_0xe1b5ed);})[_0x014a('0x1e')](function(_0x3a2752){if(_0x3a2752[_0x014a('0x6f')]>0x0)_0x5b5318[_0x014a('0x80')]('ui.ChatInteractionId\x20IN\x20?',_[_0x014a('0x40')](_0x3a2752,'id'));return db[_0x014a('0x9c')][_0x014a('0x4c')](_0x5b5318[_0x014a('0x9d')](),_0xe1b5ed)[_0x014a('0x1e')](function(_0x567357){var _0x3036e4=_['groupBy'](_0x567357,_0x014a('0xaf'));var _0x5a83ab=[];_0x3a2752['forEach'](function(_0x1667c8){_0x5a83ab[_0x014a('0x46')](updateChatInteraction(_0x1667c8,_0x40e02b,_0x3036e4));});return BPromise['all'](_0x5a83ab);});});})[_0x014a('0x1e')](function(_0x3199b9){_0x1557ad[_0x014a('0xb0')]=_0x3199b9;return _0x1557ad;})['then'](respondWithFilteredResult(_0x67b30f,_0x29c9ca))[_0x014a('0x28')](handleError(_0x67b30f,null));};exports[_0x014a('0xb1')]=function(_0x2feb8a,_0x336bcf){var _0x2f7969={'raw':![],'where':{'id':_0x2feb8a[_0x014a('0xb2')]['id']}},_0x263212={};_0x263212[_0x014a('0x4b')]=_[_0x014a('0x7c')](db['ChatInteraction']['rawAttributes']);_0x263212[_0x014a('0x4c')]=_[_0x014a('0x7c')](_0x2feb8a[_0x014a('0x4c')]);_0x263212['filters']=_[_0x014a('0xb3')](_0x263212[_0x014a('0x4b')],_0x263212[_0x014a('0x4c')]);_0x2f7969[_0x014a('0x4e')]=_[_0x014a('0xb3')](_0x263212[_0x014a('0x4b')],qs['fields'](_0x2feb8a[_0x014a('0x4c')][_0x014a('0x4f')]));_0x2f7969[_0x014a('0x4e')]=_0x2f7969[_0x014a('0x4e')]['length']?_0x2f7969[_0x014a('0x4e')]:_0x263212[_0x014a('0x4b')];if(_0x2feb8a[_0x014a('0x4c')][_0x014a('0xb4')]){_0x2f7969[_0x014a('0xb5')]=[{'all':!![]}];}_0x2f7969=_['merge']({},_0x2f7969,_0x2feb8a[_0x014a('0xb6')]);return db['ChatInteraction']['find'](_0x2f7969)[_0x014a('0x1e')](handleEntityNotFound(_0x336bcf,null))[_0x014a('0x1e')](respondWithResult(_0x336bcf,null))[_0x014a('0x28')](handleError(_0x336bcf,null));};exports[_0x014a('0xb7')]=function(_0x3646b8,_0x243fd9){return db[_0x014a('0x47')][_0x014a('0xb7')](_0x3646b8[_0x014a('0x7b')],{})[_0x014a('0x1e')](respondWithResult(_0x243fd9,0xc9))[_0x014a('0x28')](handleError(_0x243fd9,null));};exports[_0x014a('0x34')]=function(_0x383bd8,_0x175c12){if(_0x383bd8[_0x014a('0x7b')]['id']){delete _0x383bd8[_0x014a('0x7b')]['id'];}return db['ChatInteraction'][_0x014a('0x6b')]({'where':{'id':_0x383bd8[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x175c12,null))['then'](saveUpdates(_0x383bd8[_0x014a('0x7b')],null))[_0x014a('0x1e')](respondWithResult(_0x175c12,null))[_0x014a('0x28')](handleError(_0x175c12,null));};exports[_0x014a('0x35')]=function(_0x116631,_0xbfd7f8){return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x116631[_0x014a('0xb2')]['id']}})['then'](handleEntityNotFound(_0xbfd7f8,null))[_0x014a('0x1e')](removeEntity(_0xbfd7f8,null))[_0x014a('0x28')](handleError(_0xbfd7f8,null));};exports[_0x014a('0xb8')]=function(_0x11aab3,_0x4f91f1){return db[_0x014a('0x47')]['describe']()['then'](respondWithResult(_0x4f91f1,null))[_0x014a('0x28')](handleError(_0x4f91f1,null));};exports['createVidaooSession']=function(_0x2de457,_0x2ca658){var _0x4ee77b=_0x2de457[_0x014a('0xb2')]['id'];var _0x4e75e4;var _0x172210;var _0x8cc35d;return db['ChatInteraction'][_0x014a('0xb9')]({'where':{'id':_0x4ee77b}})[_0x014a('0x1e')](function(_0x50a129){_0x4e75e4=_0x50a129;return db[_0x014a('0xba')][_0x014a('0xb9')]({'where':{'id':_0x50a129[_0x014a('0x7f')]},'attributes':['id',_0x014a('0xbb'),_0x014a('0xbc'),_0x014a('0xbd'),_0x014a('0xbe'),_0x014a('0xbf')],'raw':!![]});})[_0x014a('0x1e')](function(_0x38df6c){if(_0x38df6c&&_0x38df6c[_0x014a('0xbb')]&&_0x38df6c[_0x014a('0xbc')]){_0x172210=_0x38df6c;var _0x4e0c1a={'interaction':{'id':_0x4ee77b},'agent':{'id':_0x2de457[_0x014a('0x98')]['id'],'name':_0x2de457[_0x014a('0x98')][_0x014a('0x38')],'fullname':_0x2de457[_0x014a('0x98')][_0x014a('0x41')],'email':_0x2de457[_0x014a('0x98')][_0x014a('0xc0')]},'contact':_0x2de457[_0x014a('0x7b')]['contact'],'account':_0x2de457[_0x014a('0x7b')][_0x014a('0x3e')]};var _0x2b3dc0={'rejectUnauthorized':![],'method':_0x014a('0xc1'),'url':_0x014a('0xc2'),'headers':{'X-APIKEY':_0x38df6c[_0x014a('0xbb')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2de457['user'][_0x014a('0xc0')]],'buttons':null,'topic':_0x172210[_0x014a('0xbd')],'note':_[_0x014a('0xc3')](_0x172210['vidaooNote'])?null:getMustacheRender(_0x172210['vidaooNote'],_0x4e0c1a),'metadata':null},'redirect':_0x014a('0xc4'),'json':!![]};try{if(!_[_0x014a('0xc3')](_0x172210[_0x014a('0xbf')])){var _0x31e65e=getMustacheRender(_0x172210[_0x014a('0xbf')],_0x4e0c1a);var _0x537353=JSON[_0x014a('0x82')](_0x31e65e);_0x2b3dc0[_0x014a('0x7b')][_0x014a('0xc5')]=_0x537353;}}catch(_0x5dd7a5){throw new db[(_0x014a('0x91'))][(_0x014a('0xc6'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x2b3dc0);}else{throw new db[(_0x014a('0x91'))]['ValidationError'](_0x014a('0xc7'));}})['then'](function(_0x57d852){_0x8cc35d=_0x57d852;if(_0x8cc35d['id']){var _0x581c3a={'body':_0x8cc35d[_0x014a('0xc8')],'ChatWebsiteId':_0x172210['id'],'ChatInteractionId':_0x4e75e4['id'],'direction':'out','UserId':_0x2de457[_0x014a('0x98')]['id']};return db['ChatMessage'][_0x014a('0xb7')](_0x581c3a,{});}else{throw new db[(_0x014a('0x91'))][(_0x014a('0xc6'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x014a('0x1e')](function(){return _0x4e75e4['updateAttributes']({'vidaooSessionId':_0x8cc35d['id']});})[_0x014a('0x1e')](respondWithResult(_0x2ca658,null))[_0x014a('0x28')](handleError(_0x2ca658,null));};exports[_0x014a('0xc9')]=function(_0x533371,_0x57b53b){if(_0x533371[_0x014a('0x7b')]['id']){delete _0x533371[_0x014a('0x7b')]['id'];}return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x533371[_0x014a('0xb2')]['id']},'include':[{'model':db[_0x014a('0xca')],'as':_0x014a('0xcb')}]})[_0x014a('0x1e')](handleEntityNotFound(_0x57b53b,null))[_0x014a('0x1e')](saveUpdates(_0x533371[_0x014a('0x7b')],null))[_0x014a('0x1e')](respondWithResult(_0x57b53b,null))[_0x014a('0x28')](handleError(_0x57b53b,null));};exports[_0x014a('0xcc')]=function(_0x4adbd2,_0x55a4bb,_0x38807c){if(_0x4adbd2[_0x014a('0x7b')]['id']){delete _0x4adbd2['body']['id'];}return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x4adbd2['params']['id']}})['then'](function(_0xf01aa6){if(!_0xf01aa6){logger[_0x014a('0x24')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x014a('0xcc'),0x194,'entity\x20not\x20found');_0x55a4bb[_0x014a('0x36')](0x194);}else{if(_0xf01aa6[_0x014a('0x7a')]){throw new db[(_0x014a('0x91'))][(_0x014a('0xc6'))]('Interaction\x20already\x20assigned');}}return _0xf01aa6;})['then'](function(_0x5db9d1){if(_0x5db9d1){return _0x5db9d1['update']({'closed':_0x4adbd2[_0x014a('0x7b')][_0x014a('0xcd')],'disposition':_0x4adbd2[_0x014a('0x7b')][_0x014a('0xce')]})[_0x014a('0x1e')](function(_0x3e19c0){return _0x3e19c0;});}})[_0x014a('0x1e')](function(_0x3546e7){return respondWithRpcPromise(_0x014a('0xcf'),_0x014a('0xcc'),_0x4adbd2[_0x014a('0x7b')],client9004);})['then'](respondWithResult(_0x55a4bb,null))['catch'](handleError(_0x55a4bb,null));};exports['attachmentUpload']=function(_0x190839,_0x28f011,_0x4da4a1){_0x190839[_0x014a('0x7b')][_0x014a('0x38')]=_0x190839[_0x014a('0xd0')][_0x014a('0xd1')];_0x190839['body'][_0x014a('0xd2')]=_0x190839[_0x014a('0xd0')]['filename'];_0x190839[_0x014a('0x7b')][_0x014a('0x49')]=_0x190839['file'][_0x014a('0xd3')];return db[_0x014a('0xd4')][_0x014a('0xb7')](_0x190839[_0x014a('0x7b')])[_0x014a('0x1e')](respondWithResult(_0x28f011,0xc9))[_0x014a('0x28')](handleError(_0x28f011,null));};exports[_0x014a('0xd5')]=function(_0xd50ab0,_0x4cee0b,_0x129deb){return db[_0x014a('0x47')][_0x014a('0xb9')]({'where':{'id':_0xd50ab0[_0x014a('0xb2')]['id']},'raw':!![]})[_0x014a('0x1e')](handleEntityNotFound(_0x4cee0b,null))[_0x014a('0x1e')](function(_0x2573bd){if(_0x2573bd){if(_0x2573bd[_0x014a('0xcd')]){return _0x4cee0b[_0x014a('0x29')](0x193)['json']({'status':0x193,'message':_0x014a('0xd6')});}return db['Attachment'][_0x014a('0xb9')]({'where':{'id':_0xd50ab0[_0x014a('0x4c')][_0x014a('0xd7')]},'raw':!![]})['then'](handleEntityNotFound(_0x4cee0b,null));}})['then'](function(_0x293ee3){if(_0x293ee3){var _0x4ce807=_0x293ee3['ChatOfflineMessageId']!==null;var _0x5c002b=path[_0x014a('0xd8')](config[_0x014a('0xd9')],_0x014a('0xda'));if(_0x4ce807){_0x5c002b=path['join'](_0x5c002b,_0x014a('0xdb'));}var _0x19a2ed=path['join'](_0x5c002b,_0x293ee3[_0x014a('0xd2')]);return _0x4cee0b[_0x014a('0xdc')](_0x19a2ed);}})[_0x014a('0x28')](handleError(_0x4cee0b,null));};exports['close']=function(_0x5b82f2,_0x2b622f){var _0x24e9d7=null;var _0x344adb=null;var _0x1441ed=null;var _0x34b528=null;if(_0x5b82f2[_0x014a('0x7b')]['id']){delete _0x5b82f2['body']['id'];}if(_0x5b82f2['body']['mailTranscript']){_0x34b528=path[_0x014a('0xd8')](config[_0x014a('0xd9')],_0x014a('0xdd'),util['format'](_0x014a('0xde'),Date[_0x014a('0xdf')]()));_0x5b82f2[_0x014a('0x7b')]['pathTranscript']=_0x34b528;}return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x5b82f2[_0x014a('0xb2')]['id']},'include':[{'model':db[_0x014a('0xe0')],'as':'Messages','include':[{'model':db[_0x014a('0x76')],'as':'User'}]}]})[_0x014a('0x1e')](handleEntityNotFound(_0x2b622f,null))[_0x014a('0x1e')](saveUpdates(_0x5b82f2[_0x014a('0x7b')],null))['then'](function(_0xdd63f){if(_0xdd63f){_0x24e9d7=_0xdd63f;return db[_0x014a('0xba')][_0x014a('0x6b')]({'where':{'id':_0x24e9d7[_0x014a('0x7f')]}});}})[_0x014a('0x1e')](function(_0x49a1eb){if(_0x49a1eb){_0x1441ed=_0x49a1eb;return db[_0x014a('0xca')][_0x014a('0x6b')]({'where':{'id':_0x24e9d7[_0x014a('0x71')]}});}})[_0x014a('0x1e')](function(_0x2432ac){if(_0x2432ac){_0x344adb=_0x2432ac;if(_0x34b528){var _0xb91589=null;for(var _0x53260c=0x1;_0x53260c<_0x24e9d7[_0x014a('0xe1')][_0x014a('0x6f')];++_0x53260c){_0xb91589=_0x24e9d7['Messages'][_0x53260c];var _0x1b5b25=_0xb91589['UserId']?util[_0x014a('0xe2')]('%s%d',_0x1441ed[_0x014a('0xe3')],_0xb91589[_0x014a('0x7a')]):_0x014a('0xe4');var _0x10b3c5=_0x5b82f2[_0x014a('0x7b')][_0x014a('0xe5')]||util[_0x014a('0xe2')]('%s%d','Visitor',_0xb91589[_0x014a('0x71')]);switch(_0x1441ed[_0x014a('0xe6')]){case'website_alias':_0x1b5b25=_0xb91589[_0x014a('0x7a')]?util[_0x014a('0xe2')](_0x014a('0xe7'),_0x1441ed[_0x014a('0xe3')],_0xb91589[_0x014a('0x7a')]):'System';break;case _0x014a('0xe8'):_0x1b5b25=_0xb91589[_0x014a('0x7a')]?_0xb91589[_0x014a('0x76')][_0x014a('0xe9')]||_0xb91589['User'][_0x014a('0x41')]:'System';break;case _0x014a('0xea'):_0x1b5b25=_0xb91589[_0x014a('0x7a')]?_0xb91589[_0x014a('0x76')][_0x014a('0x41')]:_0x014a('0xe4');break;default:_0x1b5b25=_0xb91589[_0x014a('0x7a')]?util[_0x014a('0xe2')]('%s%d',_0x1441ed[_0x014a('0xe3')],_0xb91589[_0x014a('0x7a')]):_0x014a('0xe4');}var _0x343b5e=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0xb91589[_0x014a('0xeb')])[_0x014a('0xe2')]('MM/DD/YYYY\x20HH:mm:ss'),_0xb91589[_0x014a('0xec')]==='in'?_0x10b3c5:_0x1b5b25,_0xb91589[_0x014a('0x7b')]);if(!_0xb91589[_0x014a('0xed')]){fs[_0x014a('0xee')](_0x34b528,_0x343b5e);}}return db[_0x014a('0xef')][_0x014a('0xb9')]({'where':{'service':!![]},'include':[{'model':db[_0x014a('0xf0')],'as':_0x014a('0xf1'),'raw':!![]}]});}}})[_0x014a('0x1e')](function(_0x4ad0c6){if(_0x4ad0c6&&_0x4ad0c6[_0x014a('0xf1')]&&_0x5b82f2['body']){var _0x5f8d5b={'tls':{'rejectUnauthorized':![]}};if(_0x4ad0c6[_0x014a('0xf1')]['service']){_0x5f8d5b[_0x014a('0xf2')]=_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf2')];}else{_0x5f8d5b[_0x014a('0xf3')]=_0x4ad0c6[_0x014a('0xf1')]['host'];_0x5f8d5b[_0x014a('0xf4')]=_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf4')];_0x5f8d5b[_0x014a('0xf5')]=_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf5')];}if(_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf6')]){_0x5f8d5b['auth']={'user':_0x4ad0c6[_0x014a('0xf1')]['user'],'pass':_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf7')]};}return respondWithRpcPromise(_0x014a('0xf8'),_0x014a('0xf9'),{'account':_0x5f8d5b,'message':{'from':util[_0x014a('0xe2')](_0x014a('0xfa'),_0x4ad0c6['name'],_0x4ad0c6[_0x014a('0xc0')]||_0x4ad0c6['Smtp'][_0x014a('0x98')]),'to':_0x5b82f2[_0x014a('0x7b')][_0x014a('0xfb')],'subject':_0x014a('0xfc'),'text':util[_0x014a('0xe2')](_0x014a('0xfd'),_0x5b82f2[_0x014a('0x7b')][_0x014a('0xfb')]),'attachments':[{'path':_0x34b528}]}})['then'](function(){return _0x24e9d7;})['catch'](function(_0xac886c){console[_0x014a('0x24')](_0xac886c);});}else{return _0x24e9d7;}})[_0x014a('0x1e')](respondWithStatusCode(_0x2b622f,0xc8))[_0x014a('0x28')](handleError(_0x2b622f,null));};exports[_0x014a('0xfe')]=function(_0x30aa7b,_0x451579,_0x3858a1){return db[_0x014a('0xe0')][_0x014a('0x6b')]({'where':{'id':_0x30aa7b[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x451579,null))[_0x014a('0x1e')](function(_0x57bd30){if(_0x57bd30){return _0x57bd30[_0x014a('0xfe')](_0x30aa7b[_0x014a('0x7b')][_0x014a('0xff')],_['omit'](_0x30aa7b[_0x014a('0x7b')],[_0x014a('0xff'),'id'])||{});}})[_0x014a('0x1e')](respondWithResult(_0x451579,null))[_0x014a('0x28')](handleError(_0x451579,null));};exports[_0x014a('0x100')]=function(_0x36c94d,_0x44cb05,_0x30a903){var _0x3bb1f={'raw':![],'where':{}};var _0x4775a4={};var _0x13ec10={'count':0x0,'rows':[]};return db[_0x014a('0x47')]['findOne']({'where':{'id':_0x36c94d['params']['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x44cb05,null))[_0x014a('0x1e')](function(_0x4a361b){if(_0x4a361b){_0x4775a4[_0x014a('0x4b')]=_[_0x014a('0x7c')](db[_0x014a('0xe0')][_0x014a('0x48')]);_0x4775a4[_0x014a('0x4c')]=_[_0x014a('0x7c')](_0x36c94d[_0x014a('0x4c')]);_0x4775a4[_0x014a('0x4d')]=_['intersection'](_0x4775a4[_0x014a('0x4b')],_0x4775a4[_0x014a('0x4c')]);_0x3bb1f[_0x014a('0x4e')]=_[_0x014a('0xb3')](_0x4775a4['model'],qs[_0x014a('0x4f')](_0x36c94d[_0x014a('0x4c')][_0x014a('0x4f')]));_0x3bb1f['attributes']=_0x3bb1f[_0x014a('0x4e')][_0x014a('0x6f')]?_0x3bb1f['attributes']:_0x4775a4[_0x014a('0x4b')];if(!_0x36c94d[_0x014a('0x4c')][_0x014a('0x50')]('nolimit')){_0x3bb1f[_0x014a('0x2d')]=qs[_0x014a('0x2d')](_0x36c94d[_0x014a('0x4c')]['limit']);_0x3bb1f[_0x014a('0x2b')]=qs['offset'](_0x36c94d[_0x014a('0x4c')]['offset']);}_0x3bb1f[_0x014a('0x52')]=qs[_0x014a('0x53')](_0x36c94d['query'][_0x014a('0x53')]);_0x3bb1f['where']=qs[_0x014a('0x4d')](_[_0x014a('0x101')](_0x36c94d[_0x014a('0x4c')],_0x4775a4[_0x014a('0x4d')]));_0x3bb1f[_0x014a('0x80')]['ChatInteractionId']=_0x4a361b['id'];if(_0x36c94d[_0x014a('0x4c')][_0x014a('0x8c')]){_0x3bb1f[_0x014a('0x80')]=_['merge'](_0x3bb1f[_0x014a('0x80')],{'$or':_[_0x014a('0x40')](_0x3bb1f['attributes'],function(_0x565da5){var _0x309858={};_0x309858[_0x565da5]={'$like':'%'+_0x36c94d[_0x014a('0x4c')]['filter']+'%'};return _0x309858;})});}if(_0x36c94d[_0x014a('0x4c')]['$gte']){var _0x56bfaf=_0x36c94d[_0x014a('0x4c')][_0x014a('0x102')]['split'](',');var _0x5f14e4={};_0x5f14e4[_0x56bfaf[0x0]]={'$gte':moment(_0x56bfaf[0x1])['format'](_0x014a('0x103'))};_0x3bb1f[_0x014a('0x80')]=_[_0x014a('0x3a')](_0x3bb1f['where'],_0x5f14e4);}_0x3bb1f=_['merge']({},_0x3bb1f,_0x36c94d[_0x014a('0xb6')]);return db['ChatMessage'][_0x014a('0x2e')]({'where':_0x3bb1f[_0x014a('0x80')]})['then'](function(_0x4acfe9){_0x13ec10[_0x014a('0x2e')]=_0x4acfe9;if(_0x36c94d[_0x014a('0x4c')]['includeAll']){_0x3bb1f[_0x014a('0xb5')]=[{'all':!![]}];}return db['ChatMessage'][_0x014a('0x104')](_0x3bb1f);})['then'](function(_0x8c21a7){_0x13ec10[_0x014a('0xb0')]=_0x8c21a7;return _0x13ec10;});}})[_0x014a('0x1e')](respondWithFilteredResult(_0x44cb05,_0x3bb1f))[_0x014a('0x28')](handleError(_0x44cb05,null));};exports[_0x014a('0x105')]=function(_0x260f79,_0x68de07,_0x4126a3){var _0x4f1f23={'where':{}},_0x1ef9b0={},_0x11d0e9={'count':0x0,'rows':[]};return db[_0x014a('0x47')][_0x014a('0xb9')]({'where':{'id':_0x260f79[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x68de07,null))[_0x014a('0x1e')](function(_0x4f7960){if(_0x4f7960){_0x1ef9b0['model']=_[_0x014a('0x7c')](db[_0x014a('0xe0')][_0x014a('0x48')]);_0x1ef9b0[_0x014a('0x4c')]=_[_0x014a('0x7c')](_0x260f79[_0x014a('0x4c')]);_0x1ef9b0[_0x014a('0x4d')]=_[_0x014a('0xb3')](_0x1ef9b0[_0x014a('0x4b')],_0x1ef9b0[_0x014a('0x4c')]);_0x4f1f23[_0x014a('0x4e')]=_['intersection'](_0x1ef9b0[_0x014a('0x4b')],qs[_0x014a('0x4f')](_0x260f79[_0x014a('0x4c')][_0x014a('0x4f')]));_0x4f1f23[_0x014a('0x4e')]=_0x4f1f23[_0x014a('0x4e')][_0x014a('0x6f')]?_0x4f1f23['attributes']:_0x1ef9b0['model'];if(!_0x260f79[_0x014a('0x4c')][_0x014a('0x50')](_0x014a('0x51'))){_0x4f1f23[_0x014a('0x2d')]=qs[_0x014a('0x2d')](_0x260f79['query'][_0x014a('0x2d')]);_0x4f1f23[_0x014a('0x2b')]=qs['offset'](_0x260f79[_0x014a('0x4c')][_0x014a('0x2b')]);}_0x4f1f23[_0x014a('0x52')]=qs['sort'](_0x260f79[_0x014a('0x4c')][_0x014a('0x53')]);_0x4f1f23[_0x014a('0x80')]=qs['filters'](_[_0x014a('0x101')](_0x260f79[_0x014a('0x4c')],_0x1ef9b0['filters']));_0x4f1f23[_0x014a('0x80')][_0x014a('0xaf')]=_0x4f7960['id'];if(_0x260f79[_0x014a('0x4c')]['filter']){_0x4f1f23[_0x014a('0x80')]=_['merge'](_0x4f1f23['where'],{'$or':_['map'](_0x4f1f23['attributes'],function(_0xf3e4fb){var _0x126084={};_0x126084[_0xf3e4fb]={'$like':'%'+_0x260f79[_0x014a('0x4c')][_0x014a('0x8c')]+'%'};return _0x126084;})});}_0x4f1f23[_0x014a('0x80')][_0x014a('0xed')]=![];if(_0x260f79[_0x014a('0x4c')]['id']){_0x4f1f23['where']['id']={'$gt':_0x260f79[_0x014a('0x4c')]['id']};}_0x4f1f23=_['merge']({},_0x4f1f23,_0x260f79[_0x014a('0xb6')]);return db[_0x014a('0xe0')][_0x014a('0x2e')]({'where':_0x4f1f23['where']})[_0x014a('0x1e')](function(_0x58421d){_0x11d0e9['count']=_0x58421d;_0x4f1f23[_0x014a('0xb5')]=[];if(_0x260f79[_0x014a('0x4c')][_0x014a('0x106')]){_0x4f1f23['include']['push']({'model':db[_0x014a('0x76')],'as':_0x014a('0x76'),'attributes':['id',_0x014a('0x41'),_0x014a('0xe9')]});}if(_0x260f79[_0x014a('0x4c')][_0x014a('0xb4')]){_0x4f1f23['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4f1f23);})[_0x014a('0x1e')](function(_0x40a47f){_0x11d0e9[_0x014a('0xb0')]=_0x40a47f;return _0x11d0e9;});}})['then'](respondWithFilteredResult(_0x68de07,_0x4f1f23))[_0x014a('0x28')](handleError(_0x68de07,null));};exports[_0x014a('0x107')]=function(_0x8a099,_0x81208d,_0x320be9){return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x8a099[_0x014a('0xb2')]['id']}})['then'](handleEntityNotFound(_0x81208d,null))[_0x014a('0x1e')](function(_0x46a2c5){if(_0x46a2c5){return _0x46a2c5['setTags'](_0x8a099[_0x014a('0x7b')][_0x014a('0xff')],_[_0x014a('0x108')](_0x8a099['body'],[_0x014a('0xff'),'id'])||{})[_0x014a('0x109')](function(){return db['Tag'][_0x014a('0x104')]({'attributes':['id','name',_0x014a('0x55')],'where':{'id':_0x8a099[_0x014a('0x7b')][_0x014a('0xff')]}});})[_0x014a('0x1e')](function(_0x4f56a9){socket['emit'](_0x014a('0x10a'),{'id':Number(_0x8a099[_0x014a('0xb2')]['id']),'tags':_0x4f56a9||[]});return{'id':Number(_0x8a099[_0x014a('0xb2')]['id']),'tags':_0x4f56a9||[]};});}})[_0x014a('0x1e')](respondWithResult(_0x81208d,null))[_0x014a('0x28')](handleError(_0x81208d,null));};exports[_0x014a('0x10b')]=function(_0x32ba5d,_0x120047,_0x570898){return db['ChatInteraction']['find']({'where':{'id':_0x32ba5d[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x120047,null))[_0x014a('0x1e')](function(_0x47cd44){if(_0x47cd44){return _0x47cd44[_0x014a('0x10b')](_0x32ba5d[_0x014a('0x4c')][_0x014a('0xff')]);}})['then'](respondWithStatusCode(_0x120047,null))[_0x014a('0x28')](handleError(_0x120047,null));};exports['download']=function(_0x546af7,_0x4c492f){var _0x331ba9=moment()['unix']()[_0x014a('0x9d')]();var _0x3e7923=path['join'](config[_0x014a('0xd9')],'server',_0x014a('0x10c'),'tmp');var _0x387e49=path[_0x014a('0xd8')](config[_0x014a('0xd9')],_0x014a('0x10d'),_0x014a('0x10c'),_0x014a('0x10e'));var _0x1c5606=path['join'](_0x3e7923,_0x331ba9);var _0x4b4336=util[_0x014a('0xe2')]('transcript-%d-%s.zip',_0x546af7[_0x014a('0xb2')]['id'],_0x331ba9);var _0x1b3f4d=path[_0x014a('0xd8')](_0x3e7923,_0x4b4336);var _0x5f58bd=[];_0x5f58bd[_0x014a('0x46')]({'model':db[_0x014a('0x76')],'as':'User','attributes':['id',_0x014a('0x41')],'raw':!![]});_0x5f58bd[_0x014a('0x46')]({'model':db[_0x014a('0xca')],'as':_0x014a('0xcb'),'attributes':['id',_0x014a('0x10f'),_0x014a('0x110')],'raw':!![]});if(_0x546af7[_0x014a('0x4c')]['attachments']){_0x5f58bd[_0x014a('0x46')]({'model':db[_0x014a('0xd4')],'as':'Attachment','raw':!![]});}var _0x5104b1=[{'model':db[_0x014a('0xe0')],'as':_0x014a('0xe1'),'attributes':['id',_0x014a('0x7b'),_0x014a('0xeb'),'direction',_0x014a('0xed'),_0x014a('0x87')],'include':_0x5f58bd}];_0x5104b1[_0x014a('0x46')]({'model':db[_0x014a('0xba')],'as':_0x014a('0x111'),'attributes':['id',_0x014a('0x38')]});_0x5104b1['push']({'model':db['User'],'as':'Owner','attributes':['id',_0x014a('0x41')]});return db['ChatInteraction'][_0x014a('0x6b')]({'where':{'id':_0x546af7[_0x014a('0xb2')]['id']},'include':_0x5104b1})[_0x014a('0x1e')](handleEntityNotFound(_0x4c492f,null))['then'](function(_0x501d05){if(_0x501d05){var _0x48c669=_0x501d05[_0x014a('0x112')]({'plain':!![]});fs['mkdirSync'](_0x1c5606);var _0x5d4bae={'channel':_0x014a('0x113'),'account':_0x48c669[_0x014a('0x111')][_0x014a('0x38')],'agent':_0x48c669[_0x014a('0x114')]?_0x48c669[_0x014a('0x114')][_0x014a('0x41')]:_0x014a('0x115'),'createdAt':moment(_0x48c669[_0x014a('0xeb')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x48c669['closed']?moment(_0x48c669[_0x014a('0x116')])[_0x014a('0xe2')](_0x014a('0x103'))[_0x014a('0x9d')]():'','disposition':_0x48c669[_0x014a('0xce')],'chatInfo':{'browser':_0x48c669['browserName'],'os':_0x48c669[_0x014a('0x117')],'referer':_0x48c669[_0x014a('0x118')],'customerIp':_0x48c669['customerIp'],'customerPort':_0x48c669[_0x014a('0x119')]?_0x48c669[_0x014a('0x119')]:_0x014a('0x115')},'messages':_(_0x48c669[_0x014a('0xe1')])['tail']()[_0x014a('0x8c')]({'secret':![]})[_0x014a('0x40')](function(_0x5afb91){if(_0x5afb91[_0x014a('0xd4')]){var _0x172440=path[_0x014a('0xd8')](_0x387e49,_0x5afb91[_0x014a('0xd4')][_0x014a('0xd2')]);if(fs[_0x014a('0x11a')](_0x172440)){fs[_0x014a('0x11b')](_0x172440)[_0x014a('0x11c')](fs['createWriteStream'](path[_0x014a('0xd8')](_0x1c5606,_0x5afb91[_0x014a('0xd4')][_0x014a('0xd2')])));}}return{'date':moment(_0x5afb91['createdAt'])['format'](_0x014a('0x103'))[_0x014a('0x9d')](),'sender':_0x5afb91[_0x014a('0xec')]==='out'?_0x5afb91[_0x014a('0x76')]?_0x5afb91[_0x014a('0x76')][_0x014a('0x41')]:_0x014a('0xe4'):_0x5afb91[_0x014a('0xcb')][_0x014a('0x10f')]+(_0x5afb91[_0x014a('0xcb')][_0x014a('0x110')]?'\x20'+_0x5afb91[_0x014a('0xcb')][_0x014a('0x110')]:''),'body':_0x5afb91[_0x014a('0xd4')]?_0x5afb91[_0x014a('0xd4')][_0x014a('0xd2')]:_0x5afb91[_0x014a('0x7b')],'direction':_0x5afb91[_0x014a('0xec')]===_0x014a('0x11d')?'A':'C','secret':_0x5afb91[_0x014a('0xed')],'read':_0x5afb91['read'],'attachment':_0x5afb91[_0x014a('0xd4')]};})[_0x014a('0x6d')]()};return ejs['renderFile'](path['join'](config['root'],_0x014a('0x10d'),_0x014a('0x11e'),'downloadInteraction.ejs'),{'interaction':_0x5d4bae})['then'](function(_0x374e3d){var _0x2d9178=path['join'](_0x1c5606,_0x014a('0x11f')+_0x48c669['id']+'-'+_0x331ba9+'.pdf');var _0x30c604={'path':_0x2d9178,'channel':'Chat','interactionId':_0x48c669['id']};return pdf['createPdfFromHTML'](_0x374e3d,_0x30c604);})[_0x014a('0x1e')](function(){return new BPromise(function(_0x321a17,_0x2f20e7){zipdir(_0x1c5606,{'saveTo':_0x1b3f4d},function(_0x18edd1,_0xcad1af){if(_0x18edd1)return _0x2f20e7(_0x18edd1);return _0x321a17(_0xcad1af);});})['then'](function(){return new BPromise(function(_0x42cd23,_0x82d77b){rimraf(_0x1c5606,function(_0x48bcec){if(_0x48bcec)_0x82d77b(_0x48bcec);return _0x42cd23();});});})[_0x014a('0x1e')](function(){return _0x4c492f[_0x014a('0xdc')](_0x1b3f4d,_0x4b4336,function(_0x1d8179){if(_0x1d8179){console[_0x014a('0x120')](_0x014a('0x121'),_0x1d8179);}else{fs[_0x014a('0x122')](_0x1b3f4d);}});});});}else{return _0x4c492f[_0x014a('0x36')](0xc8);}})['catch'](handleError(_0x4c492f,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 96719d0..193d83b 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 _0x16df=['getUsers','then','Users','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','ChatMessage','setMaxListeners','save','remove'];(function(_0x5e4124,_0x303347){var _0x98fe64=function(_0x33e1e4){while(--_0x33e1e4){_0x5e4124['push'](_0x5e4124['shift']());}};_0x98fe64(++_0x303347);}(_0x16df,0x1cb));var _0xf16d=function(_0x1f551f,_0x4d6518){_0x1f551f=_0x1f551f-0x0;var _0x51b208=_0x16df[_0x1f551f];return _0x51b208;};'use strict';var EventEmitter=require(_0xf16d('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0xf16d('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xf16d('0x2')](0x0);var events={'afterCreate':_0xf16d('0x3'),'afterUpdate':'update','afterDestroy':_0xf16d('0x4')};function emitEvent(_0x181367){return function(_0x3b71e1,_0x3dbdaa,_0x3472c4){_0x3b71e1[_0xf16d('0x5')]({'attributes':['id'],'raw':!![]})[_0xf16d('0x6')](function(_0xc14870){_0x3b71e1['setDataValue'](_0xf16d('0x7'),_0xc14870[_0xf16d('0x8')](function(_0x5eebb6){return{'id':_0x5eebb6['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x3b71e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x13e2d3){_0x3b71e1[_0xf16d('0x9')](_0xf16d('0xa'),_0x13e2d3[_0xf16d('0xb')]);ChatInteractionEvents['emit'](_0x181367+':'+_0x3b71e1['id'],_0x3b71e1);ChatInteractionEvents[_0xf16d('0xc')](_0x181367,_0x3b71e1);_0x3472c4(null);})[_0xf16d('0xd')](_0x3472c4(null));};}for(var e in events){if(events[_0xf16d('0xe')](e)){var event=events[e];ChatInteraction[_0xf16d('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x016e=['../../mysqldb','setMaxListeners','then','Users','setDataValue','unreadMessages','emit','exports'];(function(_0x23c45a,_0x3f81c4){var _0x3f7932=function(_0x284b62){while(--_0x284b62){_0x23c45a['push'](_0x23c45a['shift']());}};_0x3f7932(++_0x3f81c4);}(_0x016e,0x100));var _0xe016=function(_0x594dc7,_0x269225){_0x594dc7=_0x594dc7-0x0;var _0x2e287d=_0x016e[_0x594dc7];return _0x2e287d;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xe016('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0xe016('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xe016('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x490787){return function(_0x5a0769,_0x375417,_0x38c81e){_0x5a0769['getUsers']({'attributes':['id'],'raw':!![]})[_0xe016('0x2')](function(_0x8ef383){_0x5a0769['setDataValue'](_0xe016('0x3'),_0x8ef383['map'](function(_0x26ee16){return{'id':_0x26ee16['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x5a0769['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x329bac){_0x5a0769[_0xe016('0x4')](_0xe016('0x5'),_0x329bac['length']);ChatInteractionEvents[_0xe016('0x6')](_0x490787+':'+_0x5a0769['id'],_0x5a0769);ChatInteractionEvents[_0xe016('0x6')](_0x490787,_0x5a0769);_0x38c81e(null);})['catch'](_0x38c81e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xe016('0x7')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 72a3d7b..4076b3d 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 _0xbd32=['../../config/environment','exports','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3490a4,_0x11bc5b){var _0x5504c4=function(_0x400b68){while(--_0x400b68){_0x3490a4['push'](_0x3490a4['shift']());}};_0x5504c4(++_0x11bc5b);}(_0xbd32,0x1d5));var _0x2bd3=function(_0x2a9f7c,_0x367208){_0x2a9f7c=_0x2a9f7c-0x0;var _0x466a1f=_0xbd32[_0x2a9f7c];return _0x466a1f;};'use strict';var _=require(_0x2bd3('0x0'));var util=require(_0x2bd3('0x1'));var logger=require(_0x2bd3('0x2'))(_0x2bd3('0x3'));var moment=require(_0x2bd3('0x4'));var BPromise=require(_0x2bd3('0x5'));var rp=require(_0x2bd3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2bd3('0x7'));var attributes=require('./chatInteraction.attributes');module[_0x2bd3('0x8')]=function(_0x19e092,_0x21522b){return _0x19e092[_0x2bd3('0x9')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb10d1c,_0xac0e0f,_0x52baba){if(_0xb10d1c[_0x2bd3('0xa')](_0x2bd3('0xb'))){_0xb10d1c[_0x2bd3('0xc')]=moment()[_0x2bd3('0xd')](_0x2bd3('0xe'));}_0x52baba(null,_0xb10d1c);}},'charset':_0x2bd3('0xf'),'collate':_0x2bd3('0x10')});}; \ No newline at end of file +var _0xed99=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','api','moment','bluebird','request-promise','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closed','closedAt'];(function(_0x1a1667,_0x2224b1){var _0x45a134=function(_0x362be7){while(--_0x362be7){_0x1a1667['push'](_0x1a1667['shift']());}};_0x45a134(++_0x2224b1);}(_0xed99,0x1e3));var _0x9ed9=function(_0x2c6b7c,_0x25e121){_0x2c6b7c=_0x2c6b7c-0x0;var _0x371c91=_0xed99[_0x2c6b7c];return _0x371c91;};'use strict';var _=require('lodash');var util=require(_0x9ed9('0x0'));var logger=require('../../config/logger')(_0x9ed9('0x1'));var moment=require(_0x9ed9('0x2'));var BPromise=require(_0x9ed9('0x3'));var rp=require(_0x9ed9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9ed9('0x5'));var attributes=require(_0x9ed9('0x6'));module['exports']=function(_0xa82ce0,_0x43e988){return _0xa82ce0[_0x9ed9('0x7')](_0x9ed9('0x8'),attributes,{'tableName':_0x9ed9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c911a,_0x2444c7,_0x4ffcd2){if(_0x3c911a[_0x9ed9('0xa')](_0x9ed9('0xb'))){_0x3c911a[_0x9ed9('0xc')]=moment()[_0x9ed9('0xd')](_0x9ed9('0xe'));}_0x4ffcd2(null,_0x3c911a);}},'charset':_0x9ed9('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 b474d33..3d3463c 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 _0x7a88=['code','ChatInteraction,\x20%s,\x20%s','message','result','catch','update','body','options','raw','where','attributes','then','info','UpdateChatInteraction','debug','stringify','AddTagsToChatInteraction','ChatInteraction','addTags','omit','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x7a88,0x1d9));var _0x87a8=function(_0x92b4dc,_0x20f18a){_0x92b4dc=_0x92b4dc-0x0;var _0xe68d92=_0x7a88[_0x92b4dc];return _0xe68d92;};'use strict';var _=require(_0x87a8('0x0'));var util=require(_0x87a8('0x1'));var moment=require(_0x87a8('0x2'));var BPromise=require('bluebird');var rs=require(_0x87a8('0x3'));var fs=require('fs');var Redis=require(_0x87a8('0x4'));var db=require(_0x87a8('0x5'))['db'];var utils=require(_0x87a8('0x6'));var logger=require(_0x87a8('0x7'))(_0x87a8('0x8'));var config=require(_0x87a8('0x9'));var jayson=require(_0x87a8('0xa'));var client=jayson[_0x87a8('0xb')][_0x87a8('0xc')]({'port':0x232a});config['redis']=_[_0x87a8('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x87a8('0xe'))(new Redis(config[_0x87a8('0xf')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x437fdd,_0x5672be,_0x437a09){return new BPromise(function(_0x435fa5,_0x415e35){return client['request'](_0x437fdd,_0x437a09)['then'](function(_0x49cc5f){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5672be,_0x87a8('0x10'));logger['debug'](_0x87a8('0x11'),_0x5672be,'request\x20sent',JSON['stringify'](_0x49cc5f));if(_0x49cc5f[_0x87a8('0x12')]){if(_0x49cc5f[_0x87a8('0x12')][_0x87a8('0x13')]===0x1f4){logger[_0x87a8('0x12')](_0x87a8('0x14'),_0x5672be,_0x49cc5f[_0x87a8('0x12')]['message']);return _0x415e35(_0x49cc5f[_0x87a8('0x12')][_0x87a8('0x15')]);}logger[_0x87a8('0x12')](_0x87a8('0x14'),_0x5672be,_0x49cc5f[_0x87a8('0x12')][_0x87a8('0x15')]);return _0x435fa5(_0x49cc5f[_0x87a8('0x12')]['message']);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5672be,_0x87a8('0x10'));_0x435fa5(_0x49cc5f[_0x87a8('0x16')]['message']);}})[_0x87a8('0x17')](function(_0x107a9a){logger['error'](_0x87a8('0x14'),_0x5672be,_0x107a9a);_0x415e35(_0x107a9a);});});}exports['UpdateChatInteraction']=function(_0x4050e0){var _0x40431a=this;return new Promise(function(_0x2987a8,_0x233a30){return db['ChatInteraction'][_0x87a8('0x18')](_0x4050e0[_0x87a8('0x19')],{'raw':_0x4050e0[_0x87a8('0x1a')]?_0x4050e0[_0x87a8('0x1a')][_0x87a8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4050e0[_0x87a8('0x1a')]?_0x4050e0['options'][_0x87a8('0x1c')]||null:null,'attributes':_0x4050e0['options']?_0x4050e0[_0x87a8('0x1a')][_0x87a8('0x1d')]||null:null,'limit':_0x4050e0[_0x87a8('0x1a')]?_0x4050e0[_0x87a8('0x1a')]['limit']||null:null})[_0x87a8('0x1e')](function(_0x2ebb46){logger[_0x87a8('0x1f')](_0x87a8('0x20'),_0x4050e0);logger[_0x87a8('0x21')](_0x87a8('0x20'),_0x4050e0,JSON[_0x87a8('0x22')](_0x2ebb46));_0x2987a8(_0x2ebb46);})[_0x87a8('0x17')](function(_0x1a07d3){logger[_0x87a8('0x12')](_0x87a8('0x20'),_0x1a07d3[_0x87a8('0x15')],_0x4050e0);_0x233a30(_0x40431a[_0x87a8('0x12')](0x1f4,_0x1a07d3[_0x87a8('0x15')]));});});};exports[_0x87a8('0x23')]=function(_0x4a7e7f){return new Promise(function(_0x2ec171,_0x56dc56){return db[_0x87a8('0x24')]['find']({'where':_0x4a7e7f['options']?_0x4a7e7f['options'][_0x87a8('0x1c')]||null:null})['then'](function(_0x130600){if(_0x130600){return _0x130600[_0x87a8('0x25')](_0x4a7e7f[_0x87a8('0x19')]['ids'],_[_0x87a8('0x26')](_0x4a7e7f[_0x87a8('0x19')],[_0x87a8('0x27'),'id'])||{});}})['spread'](function(_0x5580dd){logger['info']('AddTags',_0x4a7e7f);logger[_0x87a8('0x21')]('AddTags',_0x4a7e7f,JSON[_0x87a8('0x22')](_0x5580dd));_0x2ec171(_0x5580dd);})['catch'](function(_0x1c0913){logger['error'](_0x87a8('0x28'),_0x1c0913[_0x87a8('0x15')],_0x4a7e7f);_0x56dc56(_this[_0x87a8('0x12')](0x1f4,_0x1c0913['message']));});});}; \ No newline at end of file +var _0x1f0a=['socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ChatInteraction','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','find','ids','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x15b653,_0x1a71d0){var _0x48f628=function(_0x109087){while(--_0x109087){_0x15b653['push'](_0x15b653['shift']());}};_0x48f628(++_0x1a71d0);}(_0x1f0a,0xdc));var _0xa1f0=function(_0xe3c18c,_0x4628bb){_0xe3c18c=_0xe3c18c-0x0;var _0x50ccd0=_0x1f0a[_0xe3c18c];return _0x50ccd0;};'use strict';var _=require(_0xa1f0('0x0'));var util=require(_0xa1f0('0x1'));var moment=require('moment');var BPromise=require(_0xa1f0('0x2'));var rs=require(_0xa1f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1f0('0x4'))['db'];var utils=require(_0xa1f0('0x5'));var logger=require(_0xa1f0('0x6'))(_0xa1f0('0x7'));var config=require(_0xa1f0('0x8'));var jayson=require(_0xa1f0('0x9'));var client=jayson[_0xa1f0('0xa')][_0xa1f0('0xb')]({'port':0x232a});config[_0xa1f0('0xc')]=_['defaults'](config['redis'],{'host':_0xa1f0('0xd'),'port':0x18eb});var socket=require(_0xa1f0('0xe'))(new Redis(config[_0xa1f0('0xc')]));require(_0xa1f0('0xf'))['register'](socket);function respondWithRpcPromise(_0x53390e,_0x447751,_0x2d5a4a){return new BPromise(function(_0x4c9c58,_0x13a960){return client[_0xa1f0('0x10')](_0x53390e,_0x2d5a4a)[_0xa1f0('0x11')](function(_0x250faf){logger[_0xa1f0('0x12')](_0xa1f0('0x13'),_0x447751,_0xa1f0('0x14'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x447751,_0xa1f0('0x14'),JSON[_0xa1f0('0x15')](_0x250faf));if(_0x250faf[_0xa1f0('0x16')]){if(_0x250faf['error']['code']===0x1f4){logger['error'](_0xa1f0('0x13'),_0x447751,_0x250faf[_0xa1f0('0x16')][_0xa1f0('0x17')]);return _0x13a960(_0x250faf[_0xa1f0('0x16')][_0xa1f0('0x17')]);}logger[_0xa1f0('0x16')](_0xa1f0('0x13'),_0x447751,_0x250faf[_0xa1f0('0x16')][_0xa1f0('0x17')]);return _0x4c9c58(_0x250faf[_0xa1f0('0x16')][_0xa1f0('0x17')]);}else{logger[_0xa1f0('0x12')](_0xa1f0('0x13'),_0x447751,_0xa1f0('0x14'));_0x4c9c58(_0x250faf[_0xa1f0('0x18')][_0xa1f0('0x17')]);}})[_0xa1f0('0x19')](function(_0x3bca77){logger[_0xa1f0('0x16')](_0xa1f0('0x13'),_0x447751,_0x3bca77);_0x13a960(_0x3bca77);});});}exports['UpdateChatInteraction']=function(_0x712456){var _0x471817=this;return new Promise(function(_0x3977ef,_0x44e9ad){return db[_0xa1f0('0x1a')][_0xa1f0('0x1b')](_0x712456[_0xa1f0('0x1c')],{'raw':_0x712456['options']?_0x712456[_0xa1f0('0x1d')][_0xa1f0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x712456[_0xa1f0('0x1d')]?_0x712456[_0xa1f0('0x1d')][_0xa1f0('0x1f')]||null:null,'attributes':_0x712456['options']?_0x712456['options'][_0xa1f0('0x20')]||null:null,'limit':_0x712456[_0xa1f0('0x1d')]?_0x712456[_0xa1f0('0x1d')][_0xa1f0('0x21')]||null:null})['then'](function(_0x7aaa14){logger[_0xa1f0('0x12')](_0xa1f0('0x22'),_0x712456);logger['debug'](_0xa1f0('0x22'),_0x712456,JSON[_0xa1f0('0x15')](_0x7aaa14));_0x3977ef(_0x7aaa14);})['catch'](function(_0x5e2b88){logger[_0xa1f0('0x16')]('UpdateChatInteraction',_0x5e2b88['message'],_0x712456);_0x44e9ad(_0x471817[_0xa1f0('0x16')](0x1f4,_0x5e2b88[_0xa1f0('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0x3bcd92){return new Promise(function(_0x4d0dc2,_0x15bb0f){return db[_0xa1f0('0x1a')][_0xa1f0('0x23')]({'where':_0x3bcd92['options']?_0x3bcd92[_0xa1f0('0x1d')][_0xa1f0('0x1f')]||null:null})[_0xa1f0('0x11')](function(_0x2e2933){if(_0x2e2933){return _0x2e2933['addTags'](_0x3bcd92[_0xa1f0('0x1c')][_0xa1f0('0x24')],_['omit'](_0x3bcd92['body'],[_0xa1f0('0x24'),'id'])||{});}})[_0xa1f0('0x25')](function(_0x1ebba2){logger[_0xa1f0('0x12')](_0xa1f0('0x26'),_0x3bcd92);logger['debug'](_0xa1f0('0x26'),_0x3bcd92,JSON[_0xa1f0('0x15')](_0x1ebba2));_0x4d0dc2(_0x1ebba2);})[_0xa1f0('0x19')](function(_0x5ae79b){logger[_0xa1f0('0x16')]('AddTags',_0x5ae79b[_0xa1f0('0x17')],_0x3bcd92);_0x15bb0f(_this[_0xa1f0('0x16')](0x1f4,_0x5ae79b[_0xa1f0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 1ba4449..d064e70 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 _0x3f04=['register','chatInteraction:','./chatInteraction.events','save','remove','emit','removeListener'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x3f04,0xd4));var _0x43f0=function(_0x3e8384,_0x1a7869){_0x3e8384=_0x3e8384-0x0;var _0xddc3eb=_0x3f04[_0x3e8384];return _0xddc3eb;};'use strict';var ChatInteractionEvents=require(_0x43f0('0x0'));var events=[_0x43f0('0x1'),_0x43f0('0x2'),'update'];function createListener(_0x56082c,_0x6f7e8c){return function(_0x312665){_0x6f7e8c[_0x43f0('0x3')](_0x56082c,_0x312665);};}function removeListener(_0x51bd36,_0x2ccd3c){return function(){ChatInteractionEvents[_0x43f0('0x4')](_0x51bd36,_0x2ccd3c);};}exports[_0x43f0('0x5')]=function(_0x253b37){for(var _0x2420dc=0x0,_0x526c77=events['length'];_0x2420dc<_0x526c77;_0x2420dc++){var _0xcd0dd=events[_0x2420dc];var _0x158860=createListener(_0x43f0('0x6')+_0xcd0dd,_0x253b37);ChatInteractionEvents['on'](_0xcd0dd,_0x158860);}}; \ No newline at end of file +var _0x09b2=['register','length','chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener'];(function(_0x212337,_0x171d35){var _0x37be7d=function(_0x4fac79){while(--_0x4fac79){_0x212337['push'](_0x212337['shift']());}};_0x37be7d(++_0x171d35);}(_0x09b2,0x150));var _0x209b=function(_0x10dc60,_0x2fcce1){_0x10dc60=_0x10dc60-0x0;var _0x47dec5=_0x09b2[_0x10dc60];return _0x47dec5;};'use strict';var ChatInteractionEvents=require(_0x209b('0x0'));var events=[_0x209b('0x1'),_0x209b('0x2'),_0x209b('0x3')];function createListener(_0x5ac987,_0x33ae6d){return function(_0x20bcc5){_0x33ae6d[_0x209b('0x4')](_0x5ac987,_0x20bcc5);};}function removeListener(_0x2e7bf8,_0x3f3ffa){return function(){ChatInteractionEvents[_0x209b('0x5')](_0x2e7bf8,_0x3f3ffa);};}exports[_0x209b('0x6')]=function(_0x3a8835){for(var _0x48d409=0x0,_0x2701a7=events[_0x209b('0x7')];_0x48d409<_0x2701a7;_0x48d409++){var _0x58803=events[_0x48d409];var _0x57fb0f=createListener(_0x209b('0x8')+_0x58803,_0x3a8835);ChatInteractionEvents['on'](_0x58803,_0x57fb0f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 5202be3..4585661 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 _0xcd22=['download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMyMessages'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xcd22,0x18c));var _0x2cd2=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0xcd22[_0x4d67b8];return _0x55af3b;};'use strict';var multer=require(_0x2cd2('0x0'));var util=require('util');var path=require(_0x2cd2('0x1'));var timeout=require(_0x2cd2('0x2'));var express=require(_0x2cd2('0x3'));var router=express[_0x2cd2('0x4')]();var fs_extra=require(_0x2cd2('0x5'));var auth=require(_0x2cd2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2cd2('0x7'));var controller=require(_0x2cd2('0x8'));router[_0x2cd2('0x9')]('/',auth[_0x2cd2('0xa')](),controller[_0x2cd2('0xb')]);router[_0x2cd2('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x2cd2('0xc')]);router[_0x2cd2('0x9')](_0x2cd2('0xd'),auth[_0x2cd2('0xe')](),controller[_0x2cd2('0xf')]);router[_0x2cd2('0x9')](_0x2cd2('0x10'),auth[_0x2cd2('0xe')](),controller[_0x2cd2('0x11')]);router[_0x2cd2('0x9')](_0x2cd2('0x12'),auth['isAuthenticated'](),controller['getMessages']);router[_0x2cd2('0x9')]('/:id/my_messages',auth[_0x2cd2('0xe')](),controller[_0x2cd2('0x13')]);router['get']('/:id/download',auth[_0x2cd2('0xa')](),controller[_0x2cd2('0x14')]);router[_0x2cd2('0x15')]('/',auth[_0x2cd2('0xa')](),controller[_0x2cd2('0x16')]);router[_0x2cd2('0x15')](_0x2cd2('0x17'),auth[_0x2cd2('0xa')](),controller[_0x2cd2('0x18')]);var upload=multer({'storage':multer[_0x2cd2('0x19')]({'destination':function(_0x35bf5f,_0x293f8d,_0x1bfc07){_0x1bfc07(null,path[_0x2cd2('0x1a')](config['root'],_0x2cd2('0x1b')));},'filename':function(_0x5c58e3,_0x1e318d,_0x235b7e){_0x235b7e(null,util[_0x2cd2('0x1c')](_0x2cd2('0x1d'),Date[_0x2cd2('0x1e')](),_0x1e318d[_0x2cd2('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2cd2('0x15')](_0x2cd2('0x20'),upload[_0x2cd2('0x21')](_0x2cd2('0x22')),controller['attachmentUpload']);router[_0x2cd2('0x15')](_0x2cd2('0x12'),auth[_0x2cd2('0xe')](),controller[_0x2cd2('0x23')]);router[_0x2cd2('0x15')](_0x2cd2('0x24'),auth[_0x2cd2('0xa')](),interaction['tracked'](_0x2cd2('0x25'),_0x2cd2('0x26')),controller[_0x2cd2('0x27')]);router[_0x2cd2('0x28')](_0x2cd2('0xd'),auth['isAuthenticated'](),interaction[_0x2cd2('0x29')](_0x2cd2('0x25'),_0x2cd2('0x2a')),controller['update']);router[_0x2cd2('0x28')](_0x2cd2('0x2b'),controller[_0x2cd2('0x2c')]);router['put'](_0x2cd2('0x2d'),auth[_0x2cd2('0xe')](),controller[_0x2cd2('0x2e')]);router['put'](_0x2cd2('0x2f'),controller['close']);router[_0x2cd2('0x30')](_0x2cd2('0xd'),auth[_0x2cd2('0xa')](),interaction['tracked']('chat',_0x2cd2('0x31')),controller[_0x2cd2('0x32')]);router['delete']('/:id/tags',auth[_0x2cd2('0xa')](),controller['removeTags']);module[_0x2cd2('0x33')]=router; \ No newline at end of file +var _0x32ac=['tracked','chat','chatinteraction:addtags','put','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','join','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage'];(function(_0x3b3a82,_0x53b5e0){var _0x267063=function(_0x5aaf3d){while(--_0x5aaf3d){_0x3b3a82['push'](_0x3b3a82['shift']());}};_0x267063(++_0x53b5e0);}(_0x32ac,0xd8));var _0xc32a=function(_0x5078af,_0x51ac71){_0x5078af=_0x5078af-0x0;var _0x5a180f=_0x32ac[_0x5078af];return _0x5a180f;};'use strict';var multer=require(_0xc32a('0x0'));var util=require(_0xc32a('0x1'));var path=require(_0xc32a('0x2'));var timeout=require(_0xc32a('0x3'));var express=require('express');var router=express[_0xc32a('0x4')]();var fs_extra=require(_0xc32a('0x5'));var auth=require(_0xc32a('0x6'));var interaction=require(_0xc32a('0x7'));var config=require(_0xc32a('0x8'));var controller=require(_0xc32a('0x9'));router['get']('/',auth[_0xc32a('0xa')](),controller[_0xc32a('0xb')]);router[_0xc32a('0xc')](_0xc32a('0xd'),auth[_0xc32a('0xa')](),controller[_0xc32a('0xe')]);router['get'](_0xc32a('0xf'),auth[_0xc32a('0x10')](),controller[_0xc32a('0x11')]);router['get']('/:id/attachment_download',auth[_0xc32a('0x10')](),controller[_0xc32a('0x12')]);router[_0xc32a('0xc')](_0xc32a('0x13'),auth[_0xc32a('0xa')](),controller[_0xc32a('0x14')]);router[_0xc32a('0xc')](_0xc32a('0x15'),auth[_0xc32a('0x10')](),controller[_0xc32a('0x16')]);router['get'](_0xc32a('0x17'),auth['isAuthenticated'](),controller[_0xc32a('0x18')]);router[_0xc32a('0x19')]('/',auth[_0xc32a('0xa')](),controller[_0xc32a('0x1a')]);router[_0xc32a('0x19')](_0xc32a('0x1b'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2682c2,_0x524456,_0x87ae48){_0x87ae48(null,path[_0xc32a('0x1c')](config['root'],_0xc32a('0x1d')));},'filename':function(_0x988d9c,_0x3c981d,_0x535ffc){_0x535ffc(null,util[_0xc32a('0x1e')]('%s-%s',Date[_0xc32a('0x1f')](),_0x3c981d[_0xc32a('0x20')][_0xc32a('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xc32a('0x22'),upload[_0xc32a('0x23')](_0xc32a('0x24')),controller[_0xc32a('0x25')]);router['post'](_0xc32a('0x13'),auth[_0xc32a('0x10')](),controller[_0xc32a('0x26')]);router[_0xc32a('0x19')]('/:id/tags',auth[_0xc32a('0xa')](),interaction[_0xc32a('0x27')](_0xc32a('0x28'),_0xc32a('0x29')),controller['addTags']);router[_0xc32a('0x2a')]('/:id',auth[_0xc32a('0xa')](),interaction['tracked'](_0xc32a('0x28'),'chatinteraction:update'),controller['update']);router[_0xc32a('0x2a')]('/:id/custom_update',controller[_0xc32a('0x2b')]);router['put'](_0xc32a('0x2c'),auth[_0xc32a('0x10')](),controller[_0xc32a('0x2d')]);router[_0xc32a('0x2a')](_0xc32a('0x2e'),controller[_0xc32a('0x2f')]);router[_0xc32a('0x30')](_0xc32a('0xf'),auth[_0xc32a('0xa')](),interaction['tracked'](_0xc32a('0x28'),'chatinteraction:destroy'),controller[_0xc32a('0x31')]);router[_0xc32a('0x30')]('/:id/tags',auth[_0xc32a('0xa')](),controller['removeTags']);module[_0xc32a('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 6ccefda..33f33f6 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 _0x2d2b=['BOOLEAN','INTEGER','sequelize','TEXT'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x2d2b,0x82));var _0xb2d2=function(_0xb51b1,_0x11c8b8){_0xb51b1=_0xb51b1-0x0;var _0x3bbf58=_0x2d2b[_0xb51b1];return _0x3bbf58;};'use strict';var Sequelize=require(_0xb2d2('0x0'));module['exports']={'body':{'type':Sequelize[_0xb2d2('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb2d2('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb2d2('0x3')]}}; \ No newline at end of file +var _0x750e=['exports','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x15f236,_0x59a12b){var _0x3645c0=function(_0x574879){while(--_0x574879){_0x15f236['push'](_0x15f236['shift']());}};_0x3645c0(++_0x59a12b);}(_0x750e,0x108));var _0xe750=function(_0x4b5b9b,_0x363731){_0x4b5b9b=_0x4b5b9b-0x0;var _0x1ae607=_0x750e[_0x4b5b9b];return _0x1ae607;};'use strict';var Sequelize=require(_0xe750('0x0'));module[_0xe750('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe750('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe750('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe750('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index ab3eda1..b66276b 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 _0x47c7=['to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','map','ChatInternalMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','destroy','describe','get','messages','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','role','UserProfileSection','userProfileId','autoAssociation','push','FromId','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox'];(function(_0x3dbf54,_0x5dc6c9){var _0x3cd01f=function(_0x1ebff8){while(--_0x1ebff8){_0x3dbf54['push'](_0x3dbf54['shift']());}};_0x3cd01f(++_0x5dc6c9);}(_0x47c7,0xc2));var _0x747c=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x47c7[_0x5627e1];return _0x2f013f;};'use strict';var emlformat=require(_0x747c('0x0'));var rimraf=require(_0x747c('0x1'));var zipdir=require(_0x747c('0x2'));var jsonpatch=require(_0x747c('0x3'));var rp=require('request-promise');var moment=require(_0x747c('0x4'));var BPromise=require(_0x747c('0x5'));var Mustache=require(_0x747c('0x6'));var util=require('util');var path=require('path');var sox=require(_0x747c('0x7'));var csv=require(_0x747c('0x8'));var ejs=require(_0x747c('0x9'));var fs=require('fs');var fs_extra=require(_0x747c('0xa'));var _=require(_0x747c('0xb'));var squel=require('squel');var crypto=require(_0x747c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x747c('0xd'));var toCsv=require(_0x747c('0x8'));var querystring=require(_0x747c('0xe'));var Papa=require('papaparse');var Redis=require(_0x747c('0xf'));var authService=require(_0x747c('0x10'));var qs=require(_0x747c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x747c('0x12'))('api');var utils=require(_0x747c('0x13'));var config=require(_0x747c('0x14'));var licenseUtil=require(_0x747c('0x15'));var db=require(_0x747c('0x16'))['db'];config[_0x747c('0x17')]=_['defaults'](config[_0x747c('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x747c('0x18'))(new Redis(config[_0x747c('0x17')]));require('./chatInternalMessage.socket')[_0x747c('0x19')](socket);function respondWithStatusCode(_0x11aa4d,_0x5c61dc){_0x5c61dc=_0x5c61dc||0xcc;return function(_0x4d4d4f){if(_0x4d4d4f){return _0x11aa4d[_0x747c('0x1a')](_0x5c61dc);}return _0x11aa4d[_0x747c('0x1b')](_0x5c61dc)[_0x747c('0x1c')]();};}function respondWithResult(_0x5eb4c0,_0x4aba3d){_0x4aba3d=_0x4aba3d||0xc8;return function(_0x550cef){if(_0x550cef){return _0x5eb4c0['status'](_0x4aba3d)[_0x747c('0x1d')](_0x550cef);}};}function respondWithFilteredResult(_0x240e6e,_0x4dbc24){return function(_0x509564){if(_0x509564){var _0x5d36dd=typeof _0x4dbc24[_0x747c('0x1e')]===_0x747c('0x1f')&&typeof _0x4dbc24[_0x747c('0x20')]===_0x747c('0x1f');var _0xcf5fcb=_0x509564[_0x747c('0x21')];var _0x25bc85=_0x5d36dd?0x0:_0x4dbc24[_0x747c('0x1e')];var _0x382fb9=_0x5d36dd?_0x509564[_0x747c('0x21')]:_0x4dbc24['offset']+_0x4dbc24[_0x747c('0x20')];var _0x2a2369;if(_0x382fb9>=_0xcf5fcb){_0x382fb9=_0xcf5fcb;_0x2a2369=0xc8;}else{_0x2a2369=0xce;}_0x240e6e[_0x747c('0x1b')](_0x2a2369);return _0x240e6e[_0x747c('0x22')](_0x747c('0x23'),_0x25bc85+'-'+_0x382fb9+'/'+_0xcf5fcb)[_0x747c('0x1d')](_0x509564);}return null;};}function patchUpdates(_0x3fb0d5){return function(_0x5be6e8){try{jsonpatch[_0x747c('0x24')](_0x5be6e8,_0x3fb0d5,!![]);}catch(_0x1ecda0){return BPromise['reject'](_0x1ecda0);}return _0x5be6e8[_0x747c('0x25')]();};}function saveUpdates(_0x5245a6,_0x34d992){return function(_0x137fcc){if(_0x137fcc){return _0x137fcc[_0x747c('0x26')](_0x5245a6)[_0x747c('0x27')](function(_0x411d93){return _0x411d93;});}return null;};}function removeEntity(_0x2182a9,_0x56a6d7){return function(_0x1c3c49){if(_0x1c3c49){return _0x1c3c49['destroy']()[_0x747c('0x27')](function(){_0x2182a9['status'](0xcc)[_0x747c('0x1c')]();});}};}function handleEntityNotFound(_0x2dbf2c,_0x5e2f33){return function(_0x451cde){if(!_0x451cde){_0x2dbf2c[_0x747c('0x1a')](0x194);}return _0x451cde;};}function handleError(_0x43a544,_0x12d3f0){_0x12d3f0=_0x12d3f0||0x1f4;return function(_0x3b2b4b){logger[_0x747c('0x28')](_0x3b2b4b[_0x747c('0x29')]);if(_0x3b2b4b[_0x747c('0x2a')]){delete _0x3b2b4b[_0x747c('0x2a')];}_0x43a544[_0x747c('0x1b')](_0x12d3f0)['send'](_0x3b2b4b);};}exports['index']=function(_0x2ef85f,_0x3d07cf){var _0x5b5966={},_0x20da09={},_0xfa56d8={'count':0x0,'rows':[]};var _0x50d6be=_[_0x747c('0x2b')](db[_0x747c('0x2c')][_0x747c('0x2d')],function(_0x11ed70){return{'name':_0x11ed70[_0x747c('0x2e')],'type':_0x11ed70[_0x747c('0x2f')]['key']};});_0x20da09[_0x747c('0x30')]=_[_0x747c('0x2b')](_0x50d6be,'name');_0x20da09['query']=_[_0x747c('0x31')](_0x2ef85f[_0x747c('0x32')]);_0x20da09[_0x747c('0x33')]=_[_0x747c('0x34')](_0x20da09[_0x747c('0x30')],_0x20da09[_0x747c('0x32')]);_0x5b5966['attributes']=_[_0x747c('0x34')](_0x20da09[_0x747c('0x30')],qs[_0x747c('0x35')](_0x2ef85f[_0x747c('0x32')][_0x747c('0x35')]));_0x5b5966[_0x747c('0x36')]=_0x5b5966[_0x747c('0x36')][_0x747c('0x37')]?_0x5b5966[_0x747c('0x36')]:_0x20da09[_0x747c('0x30')];if(!_0x2ef85f[_0x747c('0x32')]['hasOwnProperty']('nolimit')){_0x5b5966[_0x747c('0x20')]=qs[_0x747c('0x20')](_0x2ef85f['query'][_0x747c('0x20')]);_0x5b5966[_0x747c('0x1e')]=qs['offset'](_0x2ef85f['query'][_0x747c('0x1e')]);}_0x5b5966['order']=qs['sort'](_0x2ef85f['query'][_0x747c('0x38')]);_0x5b5966[_0x747c('0x39')]=qs[_0x747c('0x33')](_['pick'](_0x2ef85f[_0x747c('0x32')],_0x20da09[_0x747c('0x33')]),_0x50d6be);if(_0x2ef85f[_0x747c('0x32')][_0x747c('0x3a')]){_0x5b5966[_0x747c('0x39')]=_['merge'](_0x5b5966['where'],{'$or':_['map'](_0x50d6be,function(_0x2827b8){if(_0x2827b8[_0x747c('0x2f')]!==_0x747c('0x3b')){var _0x1a4d0f={};_0x1a4d0f[_0x2827b8[_0x747c('0x2a')]]={'$like':'%'+_0x2ef85f[_0x747c('0x32')][_0x747c('0x3a')]+'%'};return _0x1a4d0f;}})});}_0x5b5966=_[_0x747c('0x3c')]({},_0x5b5966,_0x2ef85f[_0x747c('0x3d')]);var _0x213f38={'where':_0x5b5966[_0x747c('0x39')]};return db[_0x747c('0x2c')][_0x747c('0x21')](_0x213f38)[_0x747c('0x27')](function(_0xa662c0){_0xfa56d8[_0x747c('0x21')]=_0xa662c0;if(_0x2ef85f[_0x747c('0x32')]['includeAll']){_0x5b5966[_0x747c('0x3e')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x747c('0x3f')](_0x5b5966);})[_0x747c('0x27')](function(_0x5b4411){_0xfa56d8[_0x747c('0x40')]=_0x5b4411;return _0xfa56d8;})[_0x747c('0x27')](respondWithFilteredResult(_0x3d07cf,_0x5b5966))[_0x747c('0x41')](handleError(_0x3d07cf,null));};exports['show']=function(_0x25f84b,_0x20e65d){var _0x33ce9f={'raw':!![],'where':{'id':_0x25f84b[_0x747c('0x42')]['id']}},_0x250aab={};_0x250aab[_0x747c('0x30')]=_[_0x747c('0x31')](db[_0x747c('0x2c')][_0x747c('0x2d')]);_0x250aab[_0x747c('0x32')]=_[_0x747c('0x31')](_0x25f84b[_0x747c('0x32')]);_0x250aab[_0x747c('0x33')]=_[_0x747c('0x34')](_0x250aab['model'],_0x250aab[_0x747c('0x32')]);_0x33ce9f[_0x747c('0x36')]=_[_0x747c('0x34')](_0x250aab[_0x747c('0x30')],qs[_0x747c('0x35')](_0x25f84b[_0x747c('0x32')]['fields']));_0x33ce9f[_0x747c('0x36')]=_0x33ce9f[_0x747c('0x36')]['length']?_0x33ce9f['attributes']:_0x250aab[_0x747c('0x30')];if(_0x25f84b[_0x747c('0x32')][_0x747c('0x43')]){_0x33ce9f['include']=[{'all':!![]}];}_0x33ce9f=_[_0x747c('0x3c')]({},_0x33ce9f,_0x25f84b[_0x747c('0x3d')]);return db[_0x747c('0x2c')][_0x747c('0x44')](_0x33ce9f)['then'](handleEntityNotFound(_0x20e65d,null))['then'](respondWithResult(_0x20e65d,null))[_0x747c('0x41')](handleError(_0x20e65d,null));};exports[_0x747c('0x45')]=function(_0x3f509b,_0x1513d2){return db[_0x747c('0x2c')]['create'](_0x3f509b[_0x747c('0x46')],{})['then'](respondWithResult(_0x1513d2,0xc9))[_0x747c('0x41')](handleError(_0x1513d2,null));};exports['update']=function(_0x469d5f,_0x5ebdd9){if(_0x469d5f[_0x747c('0x46')]['id']){delete _0x469d5f['body']['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x469d5f['params']['id']}})[_0x747c('0x27')](handleEntityNotFound(_0x5ebdd9,null))['then'](saveUpdates(_0x469d5f['body'],null))[_0x747c('0x27')](respondWithResult(_0x5ebdd9,null))[_0x747c('0x41')](handleError(_0x5ebdd9,null));};exports[_0x747c('0x47')]=function(_0x31ea3,_0x3faa4c){return db[_0x747c('0x2c')]['find']({'where':{'id':_0x31ea3[_0x747c('0x42')]['id']}})[_0x747c('0x27')](handleEntityNotFound(_0x3faa4c,null))[_0x747c('0x27')](removeEntity(_0x3faa4c,null))[_0x747c('0x41')](handleError(_0x3faa4c,null));};exports['describe']=function(_0x2a41ae,_0x4399cc){return db[_0x747c('0x2c')][_0x747c('0x48')]()['then'](respondWithResult(_0x4399cc,null))[_0x747c('0x41')](handleError(_0x4399cc,null));};function wrapUser(_0x4242ac){return function(_0x4514fc){var _0x3a6f6f=_0x4242ac[_0x747c('0x49')]({'plain':!![]});_0x3a6f6f[_0x747c('0x4a')]=[];if(_0x4514fc){_0x3a6f6f['lastMessageAt']=_0x4514fc[_0x747c('0x4b')];_0x3a6f6f[_0x747c('0x4c')]=_0x4514fc;}else{_0x3a6f6f['lastMessageAt']=moment(0x0)[_0x747c('0x4d')](_0x747c('0x4e'));_0x3a6f6f['lastMessage']={};}return _0x3a6f6f;};}exports[_0x747c('0x4f')]=function(_0x573f03,_0x52f54a,_0x5ec490){var _0x2f7c39=[];return db[_0x747c('0x50')][_0x747c('0x3f')]({'where':{'role':[_0x747c('0x51'),_0x747c('0x52'),_0x747c('0x53')]},'attributes':['id','fullname',_0x747c('0x2a'),'role',_0x747c('0x54'),_0x747c('0x55'),_0x747c('0x56'),_0x747c('0x57'),_0x747c('0x58'),'showWebBar'],'order':qs['sort'](_0x747c('0x59')),'include':[{'model':db[_0x747c('0x5a')],'as':_0x747c('0x5b'),'attributes':['id','name',_0x747c('0x2f')],'through':{'attributes':[]}}]})['then'](function(_0x115a11){if(_0x115a11){var _0x17e4fd=_0x573f03['user'][_0x747c('0x49')]({'plain':!![]});if(!_0x17e4fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17e4fd[_0x747c('0x5c')]===_0x747c('0x53')){return db[_0x747c('0x5d')][_0x747c('0x44')]({'where':{'name':'Agents','userProfileId':_0x17e4fd[_0x747c('0x5e')]},'raw':!![]})['then'](function(_0x2abca2){if(_0x2abca2){if(_0x2abca2[_0x747c('0x5f')]===0x0){return db['UserProfileResource'][_0x747c('0x3f')]({'where':{'sectionId':_0x2abca2['id']},'raw':!![]})['then'](function(_0x423675){var _0x1ab706=[];if(_['isEmpty'](_0x423675)){_0x1ab706=_[_0x747c('0x3a')](_0x115a11,function(_0x5552d1){if(_0x5552d1[_0x747c('0x5c')]!==_0x747c('0x51')){return _0x5552d1;}});return _0x1ab706;}else{for(var _0xf5f73b=0x0;_0xf5f73b<_0x115a11[_0x747c('0x37')];_0xf5f73b++){var _0x44a561=_0x115a11[_0xf5f73b];if(_0x44a561['role']===_0x747c('0x51')){var _0x3b7562=_['find'](_0x423675,function(_0x52d835){return _0x52d835['resourceId']===_0x44a561['id'];});if(_0x3b7562)_0x1ab706[_0x747c('0x60')](_0x44a561);}else{_0x1ab706[_0x747c('0x60')](_0x44a561);}}return _0x1ab706;}});}else{return _0x115a11;}}else{var _0x55b5a6=_['filter'](_0x115a11,function(_0x14774a){if(_0x14774a[_0x747c('0x5c')]!==_0x747c('0x51')){return _0x14774a;}});return _0x55b5a6;}});}else{return _0x115a11;}}})[_0x747c('0x27')](function(_0x378f74){var _0x39064c=[];if(_0x378f74){_0x2f7c39=_0x378f74;for(var _0x377ac9=0x0;_0x377ac9<_0x378f74['length'];_0x377ac9+=0x1){_0x2f7c39[_0x377ac9][_0x747c('0x4a')]=[];_0x39064c[_0x747c('0x60')](db['ChatInternalMessage'][_0x747c('0x44')]({'where':{'FromId':[_0x573f03[_0x747c('0x53')]['id'],_0x378f74[_0x377ac9]['id']],'ToId':[_0x573f03['user']['id'],_0x378f74[_0x377ac9]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x747c('0x61'),_0x747c('0x62'),_0x747c('0x63'),_0x747c('0x46')],'order':qs[_0x747c('0x38')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x747c('0x27')](wrapUser(_0x378f74[_0x377ac9])));}return BPromise[_0x747c('0x64')](_0x39064c);}return[];})['then'](function(_0x4e8ce9){return{'rows':_0x4e8ce9,'count':_0x4e8ce9[_0x747c('0x37')]};})[_0x747c('0x27')](respondWithResult(_0x52f54a,null))[_0x747c('0x41')](handleError(_0x52f54a,null));}; \ No newline at end of file +var _0xf438=['include','rows','show','params','length','find','catch','create','body','describe','get','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','agent','fullname','userpic','internal','online','lastLoginAt','-online','VoiceQueue','VoiceQueues','user','UserProfileSection','Agents','autoAssociation','UserProfileResource','findAll','isEmpty','role','resourceId','push','messages','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','limit','undefined','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','map','ChatInternalMessage','rawAttributes','type','key','query','keys','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll'];(function(_0x424e80,_0x2044fd){var _0x3569c3=function(_0x56e5e5){while(--_0x56e5e5){_0x424e80['push'](_0x424e80['shift']());}};_0x3569c3(++_0x2044fd);}(_0xf438,0x102));var _0x8f43=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xf438[_0x3b0731];return _0x4204d7;};'use strict';var emlformat=require(_0x8f43('0x0'));var rimraf=require(_0x8f43('0x1'));var zipdir=require(_0x8f43('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8f43('0x3'));var moment=require('moment');var BPromise=require(_0x8f43('0x4'));var Mustache=require(_0x8f43('0x5'));var util=require(_0x8f43('0x6'));var path=require(_0x8f43('0x7'));var sox=require(_0x8f43('0x8'));var csv=require(_0x8f43('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f43('0xa'));var _=require(_0x8f43('0xb'));var squel=require(_0x8f43('0xc'));var crypto=require('crypto');var jsforce=require(_0x8f43('0xd'));var deskjs=require(_0x8f43('0xe'));var toCsv=require(_0x8f43('0x9'));var querystring=require(_0x8f43('0xf'));var Papa=require(_0x8f43('0x10'));var Redis=require('ioredis');var authService=require(_0x8f43('0x11'));var qs=require(_0x8f43('0x12'));var as=require(_0x8f43('0x13'));var hardwareService=require(_0x8f43('0x14'));var logger=require('../../config/logger')(_0x8f43('0x15'));var utils=require(_0x8f43('0x16'));var config=require(_0x8f43('0x17'));var licenseUtil=require(_0x8f43('0x18'));var db=require(_0x8f43('0x19'))['db'];config['redis']=_[_0x8f43('0x1a')](config[_0x8f43('0x1b')],{'host':_0x8f43('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f43('0x1b')]));require(_0x8f43('0x1d'))[_0x8f43('0x1e')](socket);function respondWithStatusCode(_0x1c9dc4,_0xf4bb66){_0xf4bb66=_0xf4bb66||0xcc;return function(_0x5a8068){if(_0x5a8068){return _0x1c9dc4[_0x8f43('0x1f')](_0xf4bb66);}return _0x1c9dc4[_0x8f43('0x20')](_0xf4bb66)[_0x8f43('0x21')]();};}function respondWithResult(_0x325f21,_0x1c629a){_0x1c629a=_0x1c629a||0xc8;return function(_0x5cced7){if(_0x5cced7){return _0x325f21[_0x8f43('0x20')](_0x1c629a)['json'](_0x5cced7);}};}function respondWithFilteredResult(_0x26671a,_0x47f094){return function(_0x5ae9a9){if(_0x5ae9a9){var _0x322e4e=typeof _0x47f094['offset']==='undefined'&&typeof _0x47f094[_0x8f43('0x22')]===_0x8f43('0x23');var _0x4b8418=_0x5ae9a9['count'];var _0x474889=_0x322e4e?0x0:_0x47f094[_0x8f43('0x24')];var _0x17c9b2=_0x322e4e?_0x5ae9a9[_0x8f43('0x25')]:_0x47f094[_0x8f43('0x24')]+_0x47f094[_0x8f43('0x22')];var _0x110d0c;if(_0x17c9b2>=_0x4b8418){_0x17c9b2=_0x4b8418;_0x110d0c=0xc8;}else{_0x110d0c=0xce;}_0x26671a[_0x8f43('0x20')](_0x110d0c);return _0x26671a[_0x8f43('0x26')](_0x8f43('0x27'),_0x474889+'-'+_0x17c9b2+'/'+_0x4b8418)[_0x8f43('0x28')](_0x5ae9a9);}return null;};}function patchUpdates(_0xb73a49){return function(_0x15b77f){try{jsonpatch[_0x8f43('0x29')](_0x15b77f,_0xb73a49,!![]);}catch(_0x41d69f){return BPromise[_0x8f43('0x2a')](_0x41d69f);}return _0x15b77f[_0x8f43('0x2b')]();};}function saveUpdates(_0x3a0f5e,_0x33e690){return function(_0x38943c){if(_0x38943c){return _0x38943c[_0x8f43('0x2c')](_0x3a0f5e)[_0x8f43('0x2d')](function(_0x1440b6){return _0x1440b6;});}return null;};}function removeEntity(_0x26b5b5,_0x18ce84){return function(_0x4babf1){if(_0x4babf1){return _0x4babf1[_0x8f43('0x2e')]()[_0x8f43('0x2d')](function(){_0x26b5b5[_0x8f43('0x20')](0xcc)[_0x8f43('0x21')]();});}};}function handleEntityNotFound(_0x27608f,_0x3f8eee){return function(_0x38b87e){if(!_0x38b87e){_0x27608f[_0x8f43('0x1f')](0x194);}return _0x38b87e;};}function handleError(_0x526e1f,_0x458f91){_0x458f91=_0x458f91||0x1f4;return function(_0xcb38a0){logger['error'](_0xcb38a0[_0x8f43('0x2f')]);if(_0xcb38a0[_0x8f43('0x30')]){delete _0xcb38a0['name'];}_0x526e1f['status'](_0x458f91)[_0x8f43('0x31')](_0xcb38a0);};}exports['index']=function(_0x28401d,_0x46a525){var _0x1c836b={},_0x391b6f={},_0x14512e={'count':0x0,'rows':[]};var _0x44896a=_[_0x8f43('0x32')](db[_0x8f43('0x33')][_0x8f43('0x34')],function(_0x51ef14){return{'name':_0x51ef14['fieldName'],'type':_0x51ef14[_0x8f43('0x35')][_0x8f43('0x36')]};});_0x391b6f['model']=_['map'](_0x44896a,_0x8f43('0x30'));_0x391b6f[_0x8f43('0x37')]=_[_0x8f43('0x38')](_0x28401d[_0x8f43('0x37')]);_0x391b6f['filters']=_['intersection'](_0x391b6f['model'],_0x391b6f['query']);_0x1c836b['attributes']=_[_0x8f43('0x39')](_0x391b6f['model'],qs['fields'](_0x28401d[_0x8f43('0x37')][_0x8f43('0x3a')]));_0x1c836b[_0x8f43('0x3b')]=_0x1c836b[_0x8f43('0x3b')]['length']?_0x1c836b[_0x8f43('0x3b')]:_0x391b6f[_0x8f43('0x3c')];if(!_0x28401d[_0x8f43('0x37')][_0x8f43('0x3d')](_0x8f43('0x3e'))){_0x1c836b['limit']=qs[_0x8f43('0x22')](_0x28401d[_0x8f43('0x37')][_0x8f43('0x22')]);_0x1c836b[_0x8f43('0x24')]=qs['offset'](_0x28401d[_0x8f43('0x37')][_0x8f43('0x24')]);}_0x1c836b[_0x8f43('0x3f')]=qs[_0x8f43('0x40')](_0x28401d[_0x8f43('0x37')]['sort']);_0x1c836b[_0x8f43('0x41')]=qs[_0x8f43('0x42')](_['pick'](_0x28401d[_0x8f43('0x37')],_0x391b6f['filters']),_0x44896a);if(_0x28401d['query'][_0x8f43('0x43')]){_0x1c836b['where']=_['merge'](_0x1c836b[_0x8f43('0x41')],{'$or':_[_0x8f43('0x32')](_0x44896a,function(_0x596df3){if(_0x596df3[_0x8f43('0x35')]!==_0x8f43('0x44')){var _0x475e58={};_0x475e58[_0x596df3['name']]={'$like':'%'+_0x28401d[_0x8f43('0x37')][_0x8f43('0x43')]+'%'};return _0x475e58;}})});}_0x1c836b=_[_0x8f43('0x45')]({},_0x1c836b,_0x28401d[_0x8f43('0x46')]);var _0x536f6d={'where':_0x1c836b['where']};return db[_0x8f43('0x33')]['count'](_0x536f6d)[_0x8f43('0x2d')](function(_0x231488){_0x14512e[_0x8f43('0x25')]=_0x231488;if(_0x28401d[_0x8f43('0x37')][_0x8f43('0x47')]){_0x1c836b[_0x8f43('0x48')]=[{'all':!![]}];}return db[_0x8f43('0x33')]['findAll'](_0x1c836b);})['then'](function(_0x260410){_0x14512e[_0x8f43('0x49')]=_0x260410;return _0x14512e;})[_0x8f43('0x2d')](respondWithFilteredResult(_0x46a525,_0x1c836b))['catch'](handleError(_0x46a525,null));};exports[_0x8f43('0x4a')]=function(_0x214650,_0x46cafc){var _0x14fa12={'raw':!![],'where':{'id':_0x214650[_0x8f43('0x4b')]['id']}},_0x336fcb={};_0x336fcb['model']=_[_0x8f43('0x38')](db[_0x8f43('0x33')][_0x8f43('0x34')]);_0x336fcb[_0x8f43('0x37')]=_[_0x8f43('0x38')](_0x214650[_0x8f43('0x37')]);_0x336fcb['filters']=_[_0x8f43('0x39')](_0x336fcb[_0x8f43('0x3c')],_0x336fcb[_0x8f43('0x37')]);_0x14fa12[_0x8f43('0x3b')]=_[_0x8f43('0x39')](_0x336fcb[_0x8f43('0x3c')],qs['fields'](_0x214650[_0x8f43('0x37')][_0x8f43('0x3a')]));_0x14fa12[_0x8f43('0x3b')]=_0x14fa12[_0x8f43('0x3b')][_0x8f43('0x4c')]?_0x14fa12['attributes']:_0x336fcb[_0x8f43('0x3c')];if(_0x214650[_0x8f43('0x37')][_0x8f43('0x47')]){_0x14fa12[_0x8f43('0x48')]=[{'all':!![]}];}_0x14fa12=_[_0x8f43('0x45')]({},_0x14fa12,_0x214650[_0x8f43('0x46')]);return db[_0x8f43('0x33')][_0x8f43('0x4d')](_0x14fa12)[_0x8f43('0x2d')](handleEntityNotFound(_0x46cafc,null))[_0x8f43('0x2d')](respondWithResult(_0x46cafc,null))[_0x8f43('0x4e')](handleError(_0x46cafc,null));};exports[_0x8f43('0x4f')]=function(_0x273d79,_0x7f5b42){return db[_0x8f43('0x33')][_0x8f43('0x4f')](_0x273d79[_0x8f43('0x50')],{})['then'](respondWithResult(_0x7f5b42,0xc9))[_0x8f43('0x4e')](handleError(_0x7f5b42,null));};exports[_0x8f43('0x2c')]=function(_0x3ab66f,_0x47a516){if(_0x3ab66f['body']['id']){delete _0x3ab66f['body']['id'];}return db[_0x8f43('0x33')][_0x8f43('0x4d')]({'where':{'id':_0x3ab66f['params']['id']}})[_0x8f43('0x2d')](handleEntityNotFound(_0x47a516,null))[_0x8f43('0x2d')](saveUpdates(_0x3ab66f[_0x8f43('0x50')],null))['then'](respondWithResult(_0x47a516,null))[_0x8f43('0x4e')](handleError(_0x47a516,null));};exports[_0x8f43('0x2e')]=function(_0x7a6ffa,_0x236570){return db[_0x8f43('0x33')][_0x8f43('0x4d')]({'where':{'id':_0x7a6ffa[_0x8f43('0x4b')]['id']}})[_0x8f43('0x2d')](handleEntityNotFound(_0x236570,null))[_0x8f43('0x2d')](removeEntity(_0x236570,null))['catch'](handleError(_0x236570,null));};exports[_0x8f43('0x51')]=function(_0x37f9ca,_0x51c808){return db[_0x8f43('0x33')][_0x8f43('0x51')]()['then'](respondWithResult(_0x51c808,null))[_0x8f43('0x4e')](handleError(_0x51c808,null));};function wrapUser(_0x5d593d){return function(_0x1eae21){var _0x546d8e=_0x5d593d[_0x8f43('0x52')]({'plain':!![]});_0x546d8e['messages']=[];if(_0x1eae21){_0x546d8e['lastMessageAt']=_0x1eae21[_0x8f43('0x53')];_0x546d8e['lastMessage']=_0x1eae21;}else{_0x546d8e['lastMessageAt']=moment(0x0)[_0x8f43('0x54')](_0x8f43('0x55'));_0x546d8e['lastMessage']={};}return _0x546d8e;};}exports['getUsers']=function(_0x21b98a,_0x217c27,_0x1dd3e9){var _0x559b00=[];return db['User']['findAll']({'where':{'role':[_0x8f43('0x56'),'admin','user']},'attributes':['id',_0x8f43('0x57'),_0x8f43('0x30'),'role',_0x8f43('0x58'),_0x8f43('0x59'),_0x8f43('0x5a'),_0x8f43('0x5b'),'allowmessenger','showWebBar'],'order':qs[_0x8f43('0x40')](_0x8f43('0x5c')),'include':[{'model':db[_0x8f43('0x5d')],'as':_0x8f43('0x5e'),'attributes':['id','name',_0x8f43('0x35')],'through':{'attributes':[]}}]})[_0x8f43('0x2d')](function(_0x15ba99){if(_0x15ba99){var _0x543f06=_0x21b98a[_0x8f43('0x5f')]['get']({'plain':!![]});if(!_0x543f06)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x543f06['role']===_0x8f43('0x5f')){return db[_0x8f43('0x60')][_0x8f43('0x4d')]({'where':{'name':_0x8f43('0x61'),'userProfileId':_0x543f06['userProfileId']},'raw':!![]})[_0x8f43('0x2d')](function(_0x3a1a1a){if(_0x3a1a1a){if(_0x3a1a1a[_0x8f43('0x62')]===0x0){return db[_0x8f43('0x63')][_0x8f43('0x64')]({'where':{'sectionId':_0x3a1a1a['id']},'raw':!![]})[_0x8f43('0x2d')](function(_0x5a96e9){var _0x1bb732=[];if(_[_0x8f43('0x65')](_0x5a96e9)){_0x1bb732=_[_0x8f43('0x43')](_0x15ba99,function(_0xb97bb7){if(_0xb97bb7[_0x8f43('0x66')]!==_0x8f43('0x56')){return _0xb97bb7;}});return _0x1bb732;}else{for(var _0x2b354e=0x0;_0x2b354e<_0x15ba99['length'];_0x2b354e++){var _0x32c6f0=_0x15ba99[_0x2b354e];if(_0x32c6f0[_0x8f43('0x66')]===_0x8f43('0x56')){var _0x287094=_['find'](_0x5a96e9,function(_0x320fa1){return _0x320fa1[_0x8f43('0x67')]===_0x32c6f0['id'];});if(_0x287094)_0x1bb732[_0x8f43('0x68')](_0x32c6f0);}else{_0x1bb732[_0x8f43('0x68')](_0x32c6f0);}}return _0x1bb732;}});}else{return _0x15ba99;}}else{var _0x1ca6e7=_[_0x8f43('0x43')](_0x15ba99,function(_0x26ee09){if(_0x26ee09[_0x8f43('0x66')]!=='agent'){return _0x26ee09;}});return _0x1ca6e7;}});}else{return _0x15ba99;}}})[_0x8f43('0x2d')](function(_0x596d2f){var _0x3f1cbe=[];if(_0x596d2f){_0x559b00=_0x596d2f;for(var _0xae17a3=0x0;_0xae17a3<_0x596d2f['length'];_0xae17a3+=0x1){_0x559b00[_0xae17a3][_0x8f43('0x69')]=[];_0x3f1cbe[_0x8f43('0x68')](db[_0x8f43('0x33')][_0x8f43('0x4d')]({'where':{'FromId':[_0x21b98a[_0x8f43('0x5f')]['id'],_0x596d2f[_0xae17a3]['id']],'ToId':[_0x21b98a[_0x8f43('0x5f')]['id'],_0x596d2f[_0xae17a3]['id']],'ChatGroupId':null},'attributes':['id',_0x8f43('0x53'),'FromId',_0x8f43('0x6a'),_0x8f43('0x6b'),_0x8f43('0x50')],'order':qs[_0x8f43('0x40')](_0x8f43('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x8f43('0x2d')](wrapUser(_0x596d2f[_0xae17a3])));}return BPromise[_0x8f43('0x6d')](_0x3f1cbe);}return[];})[_0x8f43('0x2d')](function(_0x4a64c7){return{'rows':_0x4a64c7,'count':_0x4a64c7[_0x8f43('0x4c')]};})[_0x8f43('0x2d')](respondWithResult(_0x217c27,null))[_0x8f43('0x4e')](handleError(_0x217c27,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 1a4b7e0..0ac0f53 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 _0x9285=['save','emit','hasOwnProperty','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x9285,0x1a0));var _0x5928=function(_0x5c7781,_0x39f165){_0x5c7781=_0x5c7781-0x0;var _0x393ca4=_0x9285[_0x5c7781];return _0x393ca4;};'use strict';var EventEmitter=require(_0x5928('0x0'));var ChatInternalMessage=require(_0x5928('0x1'))['db'][_0x5928('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x5928('0x3')](0x0);var events={'afterCreate':_0x5928('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2eb264){return function(_0xd98591,_0x2c69fa,_0x1885af){ChatInternalMessageEvents[_0x5928('0x5')](_0x2eb264+':'+_0xd98591['id'],_0xd98591);ChatInternalMessageEvents[_0x5928('0x5')](_0x2eb264,_0xd98591);_0x1885af(null);};}for(var e in events){if(events[_0x5928('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x1c5e=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0x1c5e,0x141));var _0xe1c5=function(_0xf1f37e,_0x159a20){_0xf1f37e=_0xf1f37e-0x0;var _0x2e3a6d=_0x1c5e[_0xf1f37e];return _0x2e3a6d;};'use strict';var EventEmitter=require(_0xe1c5('0x0'));var ChatInternalMessage=require(_0xe1c5('0x1'))['db'][_0xe1c5('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe1c5('0x3'),'afterUpdate':'update','afterDestroy':_0xe1c5('0x4')};function emitEvent(_0x2aded1){return function(_0x1dfbf5,_0xd3fa19,_0x456481){ChatInternalMessageEvents['emit'](_0x2aded1+':'+_0x1dfbf5['id'],_0x1dfbf5);ChatInternalMessageEvents[_0xe1c5('0x5')](_0x2aded1,_0x1dfbf5);_0x456481(null);};}for(var e in events){if(events[_0xe1c5('0x6')](e)){var event=events[e];ChatInternalMessage[_0xe1c5('0x7')](e,emitEvent(event));}}module[_0xe1c5('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 1743505..cd1c6d5 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 _0x985a=['bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util','moment'];(function(_0x25122d,_0x12606e){var _0x3e33c7=function(_0x36f9b4){while(--_0x36f9b4){_0x25122d['push'](_0x25122d['shift']());}};_0x3e33c7(++_0x12606e);}(_0x985a,0x14e));var _0xa985=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x985a[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xa985('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa985('0x1'));var BPromise=require(_0xa985('0x2'));var rp=require(_0xa985('0x3'));var fs=require('fs');var path=require(_0xa985('0x4'));var rimraf=require(_0xa985('0x5'));var config=require(_0xa985('0x6'));var attributes=require(_0xa985('0x7'));module[_0xa985('0x8')]=function(_0x32e190,_0x14053a){return _0x32e190['define'](_0xa985('0x9'),attributes,{'tableName':_0xa985('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa985('0xb')});}; \ No newline at end of file +var _0x2020=['../../config/environment','exports','define','chat_internal_messages','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x2020,0x1cd));var _0x0202=function(_0x421c9b,_0x43b13f){_0x421c9b=_0x421c9b-0x0;var _0x190389=_0x2020[_0x421c9b];return _0x190389;};'use strict';var _=require(_0x0202('0x0'));var util=require('util');var logger=require(_0x0202('0x1'))('api');var moment=require(_0x0202('0x2'));var BPromise=require(_0x0202('0x3'));var rp=require(_0x0202('0x4'));var fs=require('fs');var path=require(_0x0202('0x5'));var rimraf=require(_0x0202('0x6'));var config=require(_0x0202('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x0202('0x8')]=function(_0x4f1fd2,_0x44fb9a){return _0x4f1fd2[_0x0202('0x9')]('ChatInternalMessage',attributes,{'tableName':_0x0202('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0202('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 2ac85f5..2708a7f 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 _0x56e7=['defaults','localhost','./chatInternalMessage.socket','register','request','info','debug','request\x20sent','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x57a170,_0x47bcbf){var _0x2a4147=function(_0x2f0aef){while(--_0x2f0aef){_0x57a170['push'](_0x57a170['shift']());}};_0x2a4147(++_0x47bcbf);}(_0x56e7,0x7b));var _0x756e=function(_0x2094d0,_0x56c2b6){_0x2094d0=_0x2094d0-0x0;var _0x2c1e4c=_0x56e7[_0x2094d0];return _0x2c1e4c;};'use strict';var _=require('lodash');var util=require(_0x756e('0x0'));var moment=require(_0x756e('0x1'));var BPromise=require('bluebird');var rs=require(_0x756e('0x2'));var fs=require('fs');var Redis=require(_0x756e('0x3'));var db=require(_0x756e('0x4'))['db'];var utils=require(_0x756e('0x5'));var logger=require(_0x756e('0x6'))(_0x756e('0x7'));var config=require(_0x756e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x756e('0x9')][_0x756e('0xa')]({'port':0x232a});config[_0x756e('0xb')]=_[_0x756e('0xc')](config['redis'],{'host':_0x756e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x756e('0xb')]));require(_0x756e('0xe'))[_0x756e('0xf')](socket);function respondWithRpcPromise(_0x4738dc,_0x4adf8f,_0x5d5b90){return new BPromise(function(_0x324d36,_0x2be615){return client[_0x756e('0x10')](_0x4738dc,_0x5d5b90)['then'](function(_0x330076){logger[_0x756e('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x4adf8f,'request\x20sent');logger[_0x756e('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x4adf8f,_0x756e('0x13'),JSON[_0x756e('0x14')](_0x330076));if(_0x330076[_0x756e('0x15')]){if(_0x330076[_0x756e('0x15')][_0x756e('0x16')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x4adf8f,_0x330076[_0x756e('0x15')][_0x756e('0x17')]);return _0x2be615(_0x330076[_0x756e('0x15')]['message']);}logger['error'](_0x756e('0x18'),_0x4adf8f,_0x330076[_0x756e('0x15')][_0x756e('0x17')]);return _0x324d36(_0x330076[_0x756e('0x15')][_0x756e('0x17')]);}else{logger[_0x756e('0x11')](_0x756e('0x18'),_0x4adf8f,_0x756e('0x13'));_0x324d36(_0x330076[_0x756e('0x19')]['message']);}})[_0x756e('0x1a')](function(_0x47c3c4){logger['error'](_0x756e('0x18'),_0x4adf8f,_0x47c3c4);_0x2be615(_0x47c3c4);});});} \ No newline at end of file +var _0x3b5f=['defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x3b5f,0x1bf));var _0xf3b5=function(_0x35778f,_0x57eb18){_0x35778f=_0x35778f-0x0;var _0x13d10b=_0x3b5f[_0x35778f];return _0x13d10b;};'use strict';var _=require(_0xf3b5('0x0'));var util=require(_0xf3b5('0x1'));var moment=require(_0xf3b5('0x2'));var BPromise=require(_0xf3b5('0x3'));var rs=require(_0xf3b5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf3b5('0x5'));var logger=require(_0xf3b5('0x6'))(_0xf3b5('0x7'));var config=require(_0xf3b5('0x8'));var jayson=require(_0xf3b5('0x9'));var client=jayson[_0xf3b5('0xa')]['http']({'port':0x232a});config[_0xf3b5('0xb')]=_[_0xf3b5('0xc')](config[_0xf3b5('0xb')],{'host':_0xf3b5('0xd'),'port':0x18eb});var socket=require(_0xf3b5('0xe'))(new Redis(config['redis']));require(_0xf3b5('0xf'))[_0xf3b5('0x10')](socket);function respondWithRpcPromise(_0x1d1a02,_0x8113b8,_0x40be5a){return new BPromise(function(_0x2d5083,_0x15bc1a){return client[_0xf3b5('0x11')](_0x1d1a02,_0x40be5a)[_0xf3b5('0x12')](function(_0x5460da){logger[_0xf3b5('0x13')](_0xf3b5('0x14'),_0x8113b8,_0xf3b5('0x15'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x8113b8,_0xf3b5('0x15'),JSON[_0xf3b5('0x16')](_0x5460da));if(_0x5460da[_0xf3b5('0x17')]){if(_0x5460da[_0xf3b5('0x17')][_0xf3b5('0x18')]===0x1f4){logger[_0xf3b5('0x17')](_0xf3b5('0x14'),_0x8113b8,_0x5460da[_0xf3b5('0x17')]['message']);return _0x15bc1a(_0x5460da[_0xf3b5('0x17')][_0xf3b5('0x19')]);}logger['error'](_0xf3b5('0x14'),_0x8113b8,_0x5460da['error'][_0xf3b5('0x19')]);return _0x2d5083(_0x5460da['error'][_0xf3b5('0x19')]);}else{logger['info'](_0xf3b5('0x14'),_0x8113b8,'request\x20sent');_0x2d5083(_0x5460da['result'][_0xf3b5('0x19')]);}})[_0xf3b5('0x1a')](function(_0x32ac29){logger[_0xf3b5('0x17')](_0xf3b5('0x14'),_0x8113b8,_0x32ac29);_0x15bc1a(_0x32ac29);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 6a0f5d6..075e353 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 _0xcfcb=['removeListener','register','length','chatInternalMessage:','save','remove'];(function(_0x3b9b57,_0x40744a){var _0x26e311=function(_0xffe41d){while(--_0xffe41d){_0x3b9b57['push'](_0x3b9b57['shift']());}};_0x26e311(++_0x40744a);}(_0xcfcb,0xb2));var _0xbcfc=function(_0x23651b,_0x5741ae){_0x23651b=_0x23651b-0x0;var _0xd5c714=_0xcfcb[_0x23651b];return _0xd5c714;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xbcfc('0x0'),_0xbcfc('0x1'),'update'];function createListener(_0x390ba9,_0x27af00){return function(_0x2a7606){_0x27af00['emit'](_0x390ba9,_0x2a7606);};}function removeListener(_0x2a9912,_0x58f000){return function(){ChatInternalMessageEvents[_0xbcfc('0x2')](_0x2a9912,_0x58f000);};}exports[_0xbcfc('0x3')]=function(_0x1d8d24){for(var _0x219215=0x0,_0x11fd19=events[_0xbcfc('0x4')];_0x219215<_0x11fd19;_0x219215++){var _0x455d3e=events[_0x219215];var _0x50e9d6=createListener(_0xbcfc('0x5')+_0x455d3e,_0x1d8d24);ChatInternalMessageEvents['on'](_0x455d3e,_0x50e9d6);}}; \ No newline at end of file +var _0x317a=['save','remove','update','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x261cb0,_0x37dc6c){var _0x7f0e1=function(_0x13688b){while(--_0x13688b){_0x261cb0['push'](_0x261cb0['shift']());}};_0x7f0e1(++_0x37dc6c);}(_0x317a,0x117));var _0xa317=function(_0x3ebaf0,_0x2e47af){_0x3ebaf0=_0x3ebaf0-0x0;var _0x4abc4f=_0x317a[_0x3ebaf0];return _0x4abc4f;};'use strict';var ChatInternalMessageEvents=require(_0xa317('0x0'));var events=[_0xa317('0x1'),_0xa317('0x2'),_0xa317('0x3')];function createListener(_0x10b9ff,_0x5f5bf5){return function(_0x5a2c20){_0x5f5bf5['emit'](_0x10b9ff,_0x5a2c20);};}function removeListener(_0x59f812,_0x2d44be){return function(){ChatInternalMessageEvents['removeListener'](_0x59f812,_0x2d44be);};}exports[_0xa317('0x4')]=function(_0x4761f9){for(var _0x23e3b0=0x0,_0x6d4875=events[_0xa317('0x5')];_0x23e3b0<_0x6d4875;_0x23e3b0++){var _0x4af570=events[_0x23e3b0];var _0x1b2a23=createListener(_0xa317('0x6')+_0x4af570,_0x4761f9);ChatInternalMessageEvents['on'](_0x4af570,_0x1b2a23);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 6c00f4a..4d3c09d 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 _0x9a9d=['describe','getUsers','show','create','update','destroy','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','get','/describe'];(function(_0x25b459,_0x347064){var _0x4da043=function(_0x408140){while(--_0x408140){_0x25b459['push'](_0x25b459['shift']());}};_0x4da043(++_0x347064);}(_0x9a9d,0x19e));var _0xd9a9=function(_0x5c2433,_0x51613d){_0x5c2433=_0x5c2433-0x0;var _0x2fd8d7=_0x9a9d[_0x5c2433];return _0x2fd8d7;};'use strict';var multer=require('multer');var util=require(_0xd9a9('0x0'));var path=require(_0xd9a9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd9a9('0x2'));var router=express['Router']();var fs_extra=require(_0xd9a9('0x3'));var auth=require(_0xd9a9('0x4'));var interaction=require(_0xd9a9('0x5'));var config=require(_0xd9a9('0x6'));var controller=require(_0xd9a9('0x7'));router['get']('/',auth[_0xd9a9('0x8')](),controller['index']);router[_0xd9a9('0x9')](_0xd9a9('0xa'),auth[_0xd9a9('0x8')](),controller[_0xd9a9('0xb')]);router[_0xd9a9('0x9')]('/users',auth[_0xd9a9('0x8')](),controller[_0xd9a9('0xc')]);router[_0xd9a9('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd9a9('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd9a9('0xe')]);router['put']('/:id',controller[_0xd9a9('0xf')]);router['delete']('/:id',auth[_0xd9a9('0x8')](),controller[_0xd9a9('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8e62=['index','/describe','describe','/users','getUsers','/:id','show','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0x8e62,0x171));var _0x28e6=function(_0x5df532,_0x14cbbe){_0x5df532=_0x5df532-0x0;var _0x143974=_0x8e62[_0x5df532];return _0x143974;};'use strict';var multer=require('multer');var util=require(_0x28e6('0x0'));var path=require('path');var timeout=require(_0x28e6('0x1'));var express=require('express');var router=express[_0x28e6('0x2')]();var fs_extra=require(_0x28e6('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x28e6('0x4'));var config=require(_0x28e6('0x5'));var controller=require(_0x28e6('0x6'));router[_0x28e6('0x7')]('/',auth[_0x28e6('0x8')](),controller[_0x28e6('0x9')]);router[_0x28e6('0x7')](_0x28e6('0xa'),auth[_0x28e6('0x8')](),controller[_0x28e6('0xb')]);router[_0x28e6('0x7')](_0x28e6('0xc'),auth['isAuthenticated'](),controller[_0x28e6('0xd')]);router[_0x28e6('0x7')](_0x28e6('0xe'),auth[_0x28e6('0x8')](),controller[_0x28e6('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x28e6('0x10')](_0x28e6('0xe'),controller[_0x28e6('0x11')]);router[_0x28e6('0x12')](_0x28e6('0xe'),auth[_0x28e6('0x8')](),controller[_0x28e6('0x13')]);module[_0x28e6('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 4b69391..28dc109 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 _0xce3a=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x141aae,_0x4e9b4e){var _0x392ee3=function(_0x56692c){while(--_0x56692c){_0x141aae['push'](_0x141aae['shift']());}};_0x392ee3(++_0x4e9b4e);}(_0xce3a,0x194));var _0xace3=function(_0x2a4424,_0x425915){_0x2a4424=_0x2a4424-0x0;var _0x4361ee=_0xce3a[_0x2a4424];return _0x4361ee;};'use strict';var Sequelize=require(_0xace3('0x0'));module[_0xace3('0x1')]={'body':{'type':Sequelize[_0xace3('0x2')](_0xace3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xace3('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xace3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xace3('0x5')]('in',_0xace3('0x6')),'defaultValue':_0xace3('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xace3('0x7')]},'providerName':{'type':Sequelize[_0xace3('0x8')]},'providerResponse':{'type':Sequelize[_0xace3('0x2')]}}; \ No newline at end of file +var _0x7916=['out','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3c78e7,_0x19a615){var _0x46c763=function(_0x5484a1){while(--_0x5484a1){_0x3c78e7['push'](_0x3c78e7['shift']());}};_0x46c763(++_0x19a615);}(_0x7916,0x128));var _0x6791=function(_0x4b04e7,_0x3b680b){_0x4b04e7=_0x4b04e7-0x0;var _0x2b41a3=_0x7916[_0x4b04e7];return _0x2b41a3;};'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/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 3aa16d5..94084b6 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 _0xa262=['motionChannel','EventManager','formData','../../config/logger','ChatInteraction','ChatInteractionId','role','rejectMessage','ContactId','SELECT','contact','parse','rimraf','zip-dir','fast-json-patch','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','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','name','index','ChatMessage','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','merge','includeAll','include','rows','show','rawAttributes','options','find','create','body','params','describe','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','interface','SIP/%s','channel'];(function(_0x47e2df,_0x3691ca){var _0x272689=function(_0x181657){while(--_0x181657){_0x47e2df['push'](_0x47e2df['shift']());}};_0x272689(++_0x3691ca);}(_0xa262,0x8c));var _0x2a26=function(_0x5a7644,_0x1dd1ac){_0x5a7644=_0x5a7644-0x0;var _0x203fe3=_0xa262[_0x5a7644];return _0x203fe3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2a26('0x0'));var zipdir=require(_0x2a26('0x1'));var jsonpatch=require(_0x2a26('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2a26('0x3'));var path=require(_0x2a26('0x4'));var sox=require('sox');var csv=require(_0x2a26('0x5'));var ejs=require(_0x2a26('0x6'));var fs=require('fs');var fs_extra=require(_0x2a26('0x7'));var _=require(_0x2a26('0x8'));var squel=require(_0x2a26('0x9'));var crypto=require(_0x2a26('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2a26('0xb'));var toCsv=require(_0x2a26('0x5'));var querystring=require(_0x2a26('0xc'));var Papa=require(_0x2a26('0xd'));var Redis=require(_0x2a26('0xe'));var authService=require(_0x2a26('0xf'));var qs=require(_0x2a26('0x10'));var as=require(_0x2a26('0x11'));var hardwareService=require(_0x2a26('0x12'));var logger=require('../../config/logger')(_0x2a26('0x13'));var utils=require(_0x2a26('0x14'));var config=require(_0x2a26('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2a26('0x16')]=_[_0x2a26('0x17')](config[_0x2a26('0x16')],{'host':_0x2a26('0x18'),'port':0x18eb});var socket=require(_0x2a26('0x19'))(new Redis(config[_0x2a26('0x16')]));require('./chatMessage.socket')[_0x2a26('0x1a')](socket);var jayson=require(_0x2a26('0x1b'));var client=jayson[_0x2a26('0x1c')][_0x2a26('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2211db,_0x47df05,_0x116dcd,_0x2044b2){return new BPromise(function(_0x170a82,_0xbac4ca){var _0x42cd3d=_0x2044b2||client;return _0x42cd3d[_0x2a26('0x1e')](_0x2211db,_0x116dcd)[_0x2a26('0x1f')](function(_0x53dcf2){logger[_0x2a26('0x20')](_0x2a26('0x21'),_0x47df05,_0x2a26('0x22'));logger[_0x2a26('0x23')](_0x2a26('0x24'),_0x47df05,_0x2a26('0x22'),JSON['stringify'](_0x53dcf2));if(_0x53dcf2[_0x2a26('0x25')]){if(_0x53dcf2[_0x2a26('0x25')][_0x2a26('0x26')]===0x1f4){logger['error'](_0x2a26('0x21'),_0x47df05,_0x53dcf2['error'][_0x2a26('0x27')]);return _0xbac4ca(_0x53dcf2[_0x2a26('0x25')]['message']);}logger[_0x2a26('0x25')](_0x2a26('0x21'),_0x47df05,_0x53dcf2['error'][_0x2a26('0x27')]);return _0x170a82(_0x53dcf2[_0x2a26('0x25')][_0x2a26('0x27')]);}else{logger[_0x2a26('0x20')](_0x2a26('0x21'),_0x47df05,_0x2a26('0x22'));_0x170a82(_0x53dcf2[_0x2a26('0x28')][_0x2a26('0x27')]);}})[_0x2a26('0x29')](function(_0xb36c9){logger[_0x2a26('0x25')](_0x2a26('0x21'),_0x47df05,_0xb36c9);_0xbac4ca(_0xb36c9);});});}function respondWithStatusCode(_0x5315b0,_0xce47f6){_0xce47f6=_0xce47f6||0xcc;return function(_0x370cdd){if(_0x370cdd){return _0x5315b0[_0x2a26('0x2a')](_0xce47f6);}return _0x5315b0[_0x2a26('0x2b')](_0xce47f6)[_0x2a26('0x2c')]();};}function respondWithResult(_0x1220b1,_0x566eb9){_0x566eb9=_0x566eb9||0xc8;return function(_0x35fabc){if(_0x35fabc){return _0x1220b1[_0x2a26('0x2b')](_0x566eb9)[_0x2a26('0x2d')](_0x35fabc);}};}function respondWithFilteredResult(_0x364942,_0x305bb1){return function(_0x31b1c0){if(_0x31b1c0){var _0x304eed=typeof _0x305bb1['offset']===_0x2a26('0x2e')&&typeof _0x305bb1[_0x2a26('0x2f')]===_0x2a26('0x2e');var _0x5c08a1=_0x31b1c0[_0x2a26('0x30')];var _0x5a8b5d=_0x304eed?0x0:_0x305bb1['offset'];var _0xb6332a=_0x304eed?_0x31b1c0['count']:_0x305bb1[_0x2a26('0x31')]+_0x305bb1['limit'];var _0x31bbcd;if(_0xb6332a>=_0x5c08a1){_0xb6332a=_0x5c08a1;_0x31bbcd=0xc8;}else{_0x31bbcd=0xce;}_0x364942[_0x2a26('0x2b')](_0x31bbcd);return _0x364942[_0x2a26('0x32')](_0x2a26('0x33'),_0x5a8b5d+'-'+_0xb6332a+'/'+_0x5c08a1)[_0x2a26('0x2d')](_0x31b1c0);}return null;};}function patchUpdates(_0x532b57){return function(_0x2c2c41){try{jsonpatch['apply'](_0x2c2c41,_0x532b57,!![]);}catch(_0x112f04){return BPromise[_0x2a26('0x34')](_0x112f04);}return _0x2c2c41[_0x2a26('0x35')]();};}function saveUpdates(_0x47ddb6,_0x3e1ee9){return function(_0x4cdf0a){if(_0x4cdf0a){return _0x4cdf0a[_0x2a26('0x36')](_0x47ddb6)[_0x2a26('0x1f')](function(_0x55448c){return _0x55448c;});}return null;};}function removeEntity(_0x3cdd1d,_0x5b1c27){return function(_0x285283){if(_0x285283){return _0x285283[_0x2a26('0x37')]()['then'](function(){_0x3cdd1d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35d58f,_0x5b7f51){return function(_0x5bc46a){if(!_0x5bc46a){_0x35d58f[_0x2a26('0x2a')](0x194);}return _0x5bc46a;};}function handleError(_0x45b4d1,_0x30ce7b){_0x30ce7b=_0x30ce7b||0x1f4;return function(_0x419352){logger['error'](_0x419352['stack']);if(_0x419352[_0x2a26('0x38')]){delete _0x419352[_0x2a26('0x38')];}_0x45b4d1[_0x2a26('0x2b')](_0x30ce7b)['send'](_0x419352);};}exports[_0x2a26('0x39')]=function(_0x3e0dfa,_0x4d4eca){var _0x38e994={},_0x147d3={},_0x31deeb={'count':0x0,'rows':[]};var _0x15d8f3=_['map'](db[_0x2a26('0x3a')]['rawAttributes'],function(_0x4d0bc0){return{'name':_0x4d0bc0[_0x2a26('0x3b')],'type':_0x4d0bc0['type'][_0x2a26('0x3c')]};});_0x147d3[_0x2a26('0x3d')]=_['map'](_0x15d8f3,_0x2a26('0x38'));_0x147d3[_0x2a26('0x3e')]=_[_0x2a26('0x3f')](_0x3e0dfa['query']);_0x147d3[_0x2a26('0x40')]=_[_0x2a26('0x41')](_0x147d3[_0x2a26('0x3d')],_0x147d3[_0x2a26('0x3e')]);_0x38e994[_0x2a26('0x42')]=_[_0x2a26('0x41')](_0x147d3[_0x2a26('0x3d')],qs[_0x2a26('0x43')](_0x3e0dfa[_0x2a26('0x3e')]['fields']));_0x38e994['attributes']=_0x38e994[_0x2a26('0x42')]['length']?_0x38e994[_0x2a26('0x42')]:_0x147d3[_0x2a26('0x3d')];if(!_0x3e0dfa[_0x2a26('0x3e')][_0x2a26('0x44')](_0x2a26('0x45'))){_0x38e994['limit']=qs[_0x2a26('0x2f')](_0x3e0dfa[_0x2a26('0x3e')][_0x2a26('0x2f')]);_0x38e994['offset']=qs[_0x2a26('0x31')](_0x3e0dfa[_0x2a26('0x3e')][_0x2a26('0x31')]);}_0x38e994[_0x2a26('0x46')]=qs['sort'](_0x3e0dfa['query'][_0x2a26('0x47')]);_0x38e994[_0x2a26('0x48')]=qs[_0x2a26('0x40')](_[_0x2a26('0x49')](_0x3e0dfa[_0x2a26('0x3e')],_0x147d3['filters']),_0x15d8f3);if(_0x3e0dfa[_0x2a26('0x3e')][_0x2a26('0x4a')]){_0x38e994[_0x2a26('0x48')]=_['merge'](_0x38e994[_0x2a26('0x48')],{'$or':_[_0x2a26('0x4b')](_0x15d8f3,function(_0x1d8610){if(_0x1d8610['type']!=='VIRTUAL'){var _0x2e075b={};_0x2e075b[_0x1d8610[_0x2a26('0x38')]]={'$like':'%'+_0x3e0dfa[_0x2a26('0x3e')][_0x2a26('0x4a')]+'%'};return _0x2e075b;}})});}_0x38e994=_[_0x2a26('0x4c')]({},_0x38e994,_0x3e0dfa['options']);var _0x4da64f={'where':_0x38e994[_0x2a26('0x48')]};return db[_0x2a26('0x3a')]['count'](_0x4da64f)[_0x2a26('0x1f')](function(_0x124ba7){_0x31deeb[_0x2a26('0x30')]=_0x124ba7;if(_0x3e0dfa['query'][_0x2a26('0x4d')]){_0x38e994[_0x2a26('0x4e')]=[{'all':!![]}];}return db[_0x2a26('0x3a')]['findAll'](_0x38e994);})[_0x2a26('0x1f')](function(_0x256f64){_0x31deeb[_0x2a26('0x4f')]=_0x256f64;return _0x31deeb;})['then'](respondWithFilteredResult(_0x4d4eca,_0x38e994))['catch'](handleError(_0x4d4eca,null));};exports[_0x2a26('0x50')]=function(_0x336920,_0x53bd73){var _0x4282be={'raw':!![],'where':{'id':_0x336920['params']['id']}},_0x1f653f={};_0x1f653f[_0x2a26('0x3d')]=_['keys'](db[_0x2a26('0x3a')][_0x2a26('0x51')]);_0x1f653f[_0x2a26('0x3e')]=_[_0x2a26('0x3f')](_0x336920[_0x2a26('0x3e')]);_0x1f653f[_0x2a26('0x40')]=_['intersection'](_0x1f653f[_0x2a26('0x3d')],_0x1f653f[_0x2a26('0x3e')]);_0x4282be[_0x2a26('0x42')]=_['intersection'](_0x1f653f[_0x2a26('0x3d')],qs[_0x2a26('0x43')](_0x336920['query'][_0x2a26('0x43')]));_0x4282be['attributes']=_0x4282be[_0x2a26('0x42')]['length']?_0x4282be['attributes']:_0x1f653f[_0x2a26('0x3d')];if(_0x336920[_0x2a26('0x3e')][_0x2a26('0x4d')]){_0x4282be[_0x2a26('0x4e')]=[{'all':!![]}];}_0x4282be=_[_0x2a26('0x4c')]({},_0x4282be,_0x336920[_0x2a26('0x52')]);return db[_0x2a26('0x3a')][_0x2a26('0x53')](_0x4282be)[_0x2a26('0x1f')](handleEntityNotFound(_0x53bd73,null))[_0x2a26('0x1f')](respondWithResult(_0x53bd73,null))['catch'](handleError(_0x53bd73,null));};exports['create']=function(_0x3773a8,_0x5d10d6){return db['ChatMessage'][_0x2a26('0x54')](_0x3773a8[_0x2a26('0x55')],{})[_0x2a26('0x1f')](respondWithResult(_0x5d10d6,0xc9))[_0x2a26('0x29')](handleError(_0x5d10d6,null));};exports['update']=function(_0x255f96,_0x1f9599){if(_0x255f96[_0x2a26('0x55')]['id']){delete _0x255f96['body']['id'];}return db['ChatMessage'][_0x2a26('0x53')]({'where':{'id':_0x255f96['params']['id']}})[_0x2a26('0x1f')](handleEntityNotFound(_0x1f9599,null))[_0x2a26('0x1f')](saveUpdates(_0x255f96['body'],null))[_0x2a26('0x1f')](respondWithResult(_0x1f9599,null))[_0x2a26('0x29')](handleError(_0x1f9599,null));};exports[_0x2a26('0x37')]=function(_0x5a1d1b,_0x2ca34d){return db[_0x2a26('0x3a')][_0x2a26('0x53')]({'where':{'id':_0x5a1d1b[_0x2a26('0x56')]['id']}})[_0x2a26('0x1f')](handleEntityNotFound(_0x2ca34d,null))[_0x2a26('0x1f')](removeEntity(_0x2ca34d,null))[_0x2a26('0x29')](handleError(_0x2ca34d,null));};exports[_0x2a26('0x57')]=function(_0x1c6f34,_0x43c0c1){return db[_0x2a26('0x3a')]['describe']()[_0x2a26('0x1f')](respondWithResult(_0x43c0c1,null))['catch'](handleError(_0x43c0c1,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x2a26('0x58')]=function(_0x309d27,_0x37bf54,_0x561d77){var _0x34a5ad={'agent':{},'channel':_0x2a26('0x59')};if(_0x309d27['body']['id']){delete _0x309d27['body']['id'];}_0x309d27[_0x2a26('0x55')][_0x2a26('0x5a')]=!![];_0x309d27[_0x2a26('0x55')]['readAt']=moment()[_0x2a26('0x5b')](_0x2a26('0x5c'));_0x309d27[_0x2a26('0x55')][_0x2a26('0x5d')]=_0x309d27[_0x2a26('0x55')][_0x2a26('0x5d')]||_0x309d27[_0x2a26('0x5e')]['id'];_0x34a5ad[_0x2a26('0x5f')]['id']=_0x309d27[_0x2a26('0x55')][_0x2a26('0x5d')];return db[_0x2a26('0x3a')]['find']({'where':{'id':_0x309d27[_0x2a26('0x56')]['id'],'UserId':null}})[_0x2a26('0x1f')](handleEntityNotFound(_0x37bf54,null))[_0x2a26('0x1f')](saveUpdates(_0x309d27[_0x2a26('0x55')],null))[_0x2a26('0x1f')](function(_0x3ca62a){if(_0x3ca62a){_0x34a5ad[_0x2a26('0x27')]=_0x3ca62a[_0x2a26('0x60')]({'plain':!![]});return db['ChatInteraction'][_0x2a26('0x53')]({'where':{'id':_0x3ca62a['ChatInteractionId']}});}return null;})[_0x2a26('0x1f')](handleEntityNotFound(_0x37bf54,null))[_0x2a26('0x1f')](function(_0x502f87){if(_0x502f87){return _0x502f87['update']({'UserId':_0x309d27[_0x2a26('0x55')][_0x2a26('0x5d')],'read1stAt':_[_0x2a26('0x61')](_0x502f87[_0x2a26('0x62')])?moment()['format'](_0x2a26('0x5c')):undefined});}return null;})[_0x2a26('0x1f')](function(_0x2cc738){if(_0x2cc738){_0x34a5ad['interaction']=_0x2cc738[_0x2a26('0x60')]({'plain':!![]});interaction_log['info'](_0x2a26('0x63'),_0x309d27[_0x2a26('0x5e')]['id'],_0x309d27['user']['name'],_0x309d27['user']['role'],_0x34a5ad[_0x2a26('0x64')]['id'],_0x309d27['body']?JSON[_0x2a26('0x65')](_0x309d27[_0x2a26('0x55')]):_0x2a26('0x66'));return respondWithRpcPromise(_0x2a26('0x67'),'acceptMessage',_0x34a5ad);}return null;})[_0x2a26('0x1f')](function(_0x260efa){var _0x4a7560=_0x2a26('0x68')+_0x260efa[_0x2a26('0x27')]['ContactId'];return db[_0x2a26('0x69')][_0x2a26('0x3e')](_0x4a7560,{'type':db[_0x2a26('0x6a')][_0x2a26('0x6b')]['SELECT'],'raw':!![]})[_0x2a26('0x1f')](function(_0xe12ba2){return _0xe12ba2;});})[_0x2a26('0x1f')](function(_0x56b00a){if(_0x56b00a){_0x34a5ad[_0x2a26('0x27')]['contact']=_0x56b00a[0x0];if(!_0x309d27[_0x2a26('0x55')][_0x2a26('0x5d')])return;return db[_0x2a26('0x6c')]['find']({'where':{'id':_0x309d27[_0x2a26('0x55')]['UserId'],'role':_0x2a26('0x5f')},'attributes':['id',_0x2a26('0x38'),_0x2a26('0x6d'),_0x2a26('0x6e'),_0x2a26('0x6f')],'raw':!![]});}return null;})[_0x2a26('0x1f')](function(_0x4e63c8){if(!_0x4e63c8)return null;_0x34a5ad['message']['agent']=_0x4e63c8;return _0x34a5ad;})[_0x2a26('0x1f')](function(_0x94c687){if(_0x94c687){if(_0x309d27[_0x2a26('0x55')][_0x2a26('0x70')]){_0x34a5ad[_0x2a26('0x27')][_0x2a26('0x71')]=util['format'](_0x2a26('0x72'),_0x309d27['user'][_0x2a26('0x38')]);_0x34a5ad[_0x2a26('0x27')][_0x2a26('0x73')]=_0x34a5ad[_0x2a26('0x73')];_0x34a5ad[_0x2a26('0x27')][_0x2a26('0x74')]=_0x34a5ad[_0x2a26('0x73')];_0x34a5ad['message']['event']='accept';return respondWithRpcPromise(_0x2a26('0x75'),_0x2a26('0x75'),{'event':'acceptmessage','message':_[_0x2a26('0x4c')](_0x34a5ad[_0x2a26('0x27')],JSON['parse'](_0x34a5ad['interaction'][_0x2a26('0x76')]))},client9002)[_0x2a26('0x1f')](function(){return _0x34a5ad;});}return _0x34a5ad;}return null;})[_0x2a26('0x1f')](respondWithResult(_0x37bf54,null))[_0x2a26('0x29')](handleError(_0x37bf54,null));};var interaction_log=require(_0x2a26('0x77'))('chat-interactions');exports[_0x2a26('0x34')]=function(_0x3f0200,_0x12a11b,_0x5ec636){var _0x49503a={'agent':{},'channel':'chat'};if(_0x3f0200['body']['id']){delete _0x3f0200[_0x2a26('0x55')]['id'];}_0x3f0200[_0x2a26('0x55')][_0x2a26('0x5d')]=_0x3f0200['body'][_0x2a26('0x5d')]||_0x3f0200[_0x2a26('0x5e')]['id'];_0x49503a[_0x2a26('0x5f')]['id']=_0x3f0200['body'][_0x2a26('0x5d')];return db[_0x2a26('0x3a')][_0x2a26('0x53')]({'where':{'id':_0x3f0200['params']['id'],'UserId':null}})[_0x2a26('0x1f')](handleEntityNotFound(_0x12a11b,null))[_0x2a26('0x1f')](function(_0x39a391){if(_0x39a391){_0x49503a[_0x2a26('0x27')]=_0x39a391['get']({'plain':!![]});return db[_0x2a26('0x78')][_0x2a26('0x53')]({'where':{'id':_0x39a391[_0x2a26('0x79')]}});}return null;})[_0x2a26('0x1f')](handleEntityNotFound(_0x12a11b,null))[_0x2a26('0x1f')](function(_0x2d833f){if(_0x2d833f){_0x49503a[_0x2a26('0x64')]=_0x2d833f[_0x2a26('0x60')]({'plain':!![]});interaction_log[_0x2a26('0x20')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3f0200['user']['id'],_0x3f0200[_0x2a26('0x5e')]['name'],_0x3f0200[_0x2a26('0x5e')][_0x2a26('0x7a')],_0x49503a['interaction']['id'],_0x3f0200[_0x2a26('0x55')]?JSON[_0x2a26('0x65')](_0x3f0200['body']):'null');return respondWithRpcPromise('RejectMessage',_0x2a26('0x7b'),_0x49503a);}return null;})[_0x2a26('0x1f')](function(_0x563895){var _0x55c97c=_0x2a26('0x68')+_0x563895['message'][_0x2a26('0x7c')];return db[_0x2a26('0x69')]['query'](_0x55c97c,{'type':db[_0x2a26('0x6a')][_0x2a26('0x6b')][_0x2a26('0x7d')],'raw':!![]})[_0x2a26('0x1f')](function(_0x51c6db){return _0x51c6db;});})[_0x2a26('0x1f')](function(_0x450b9a){if(_0x450b9a){_0x49503a[_0x2a26('0x27')][_0x2a26('0x7e')]=_0x450b9a[0x0];if(!_0x3f0200[_0x2a26('0x55')][_0x2a26('0x5d')])return;return db[_0x2a26('0x6c')][_0x2a26('0x53')]({'where':{'id':_0x3f0200['body'][_0x2a26('0x5d')],'role':'agent'},'attributes':['id',_0x2a26('0x38'),_0x2a26('0x6d'),_0x2a26('0x6e'),_0x2a26('0x6f')],'raw':!![]});}return null;})[_0x2a26('0x1f')](function(_0x30aa24){if(!_0x30aa24)return null;_0x49503a['message'][_0x2a26('0x5f')]=_0x30aa24;return _0x49503a;})[_0x2a26('0x1f')](function(_0x3a1357){if(_0x3a1357){_0x3a1357[_0x2a26('0x27')][_0x2a26('0x71')]=util[_0x2a26('0x5b')](_0x2a26('0x72'),_0x3f0200[_0x2a26('0x5e')][_0x2a26('0x38')]);_0x3a1357[_0x2a26('0x27')][_0x2a26('0x73')]=_0x49503a[_0x2a26('0x73')];_0x3a1357[_0x2a26('0x27')][_0x2a26('0x74')]=_0x49503a['channel'];_0x3a1357['message']['event']=_0x2a26('0x34');respondWithRpcPromise(_0x2a26('0x75'),_0x2a26('0x75'),{'event':'rejectmessage','message':_[_0x2a26('0x4c')](_0x49503a[_0x2a26('0x27')],JSON[_0x2a26('0x7f')](_0x49503a['interaction']['formData']))},client9002);return _0x49503a;}return null;})[_0x2a26('0x1f')](respondWithResult(_0x12a11b,null))[_0x2a26('0x29')](handleError(_0x12a11b,null));}; \ No newline at end of file +var _0x5c84=['http','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','stack','name','send','index','map','ChatMessage','fieldName','type','model','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','destroy','describe','accept','chat','read','readAt','UserId','user','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','agent','fullname','email','internal','manual','interface','format','SIP/%s','channel','EventManager','acceptmessage','parse','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','SELECT','contact','motionChannel','rejectmessage','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./chatMessage.socket','register','client'];(function(_0x1d0dc3,_0x350fda){var _0x57d44b=function(_0x467a52){while(--_0x467a52){_0x1d0dc3['push'](_0x1d0dc3['shift']());}};_0x57d44b(++_0x350fda);}(_0x5c84,0x1ec));var _0x45c8=function(_0x137ca4,_0x328c3d){_0x137ca4=_0x137ca4-0x0;var _0x13223f=_0x5c84[_0x137ca4];return _0x13223f;};'use strict';var emlformat=require(_0x45c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x45c8('0x1'));var jsonpatch=require(_0x45c8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x45c8('0x3'));var Mustache=require(_0x45c8('0x4'));var util=require(_0x45c8('0x5'));var path=require(_0x45c8('0x6'));var sox=require(_0x45c8('0x7'));var csv=require('to-csv');var ejs=require(_0x45c8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x45c8('0x9'));var squel=require(_0x45c8('0xa'));var crypto=require(_0x45c8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x45c8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x45c8('0xd'));var Papa=require(_0x45c8('0xe'));var Redis=require(_0x45c8('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x45c8('0x10'));var hardwareService=require(_0x45c8('0x11'));var logger=require(_0x45c8('0x12'))(_0x45c8('0x13'));var utils=require(_0x45c8('0x14'));var config=require(_0x45c8('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x45c8('0x16')](config[_0x45c8('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x45c8('0x18'))(new Redis(config[_0x45c8('0x17')]));require(_0x45c8('0x19'))[_0x45c8('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x45c8('0x1b')][_0x45c8('0x1c')]({'port':0x232c});var client9002=jayson[_0x45c8('0x1b')][_0x45c8('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x518d6d,_0x4ae0fe,_0x5859d6,_0x32d163){return new BPromise(function(_0x44998e,_0x2b6971){var _0xec19c4=_0x32d163||client;return _0xec19c4['request'](_0x518d6d,_0x5859d6)[_0x45c8('0x1d')](function(_0x26d227){logger['info'](_0x45c8('0x1e'),_0x4ae0fe,_0x45c8('0x1f'));logger[_0x45c8('0x20')](_0x45c8('0x21'),_0x4ae0fe,_0x45c8('0x1f'),JSON[_0x45c8('0x22')](_0x26d227));if(_0x26d227['error']){if(_0x26d227[_0x45c8('0x23')][_0x45c8('0x24')]===0x1f4){logger[_0x45c8('0x23')](_0x45c8('0x1e'),_0x4ae0fe,_0x26d227[_0x45c8('0x23')]['message']);return _0x2b6971(_0x26d227[_0x45c8('0x23')][_0x45c8('0x25')]);}logger[_0x45c8('0x23')](_0x45c8('0x1e'),_0x4ae0fe,_0x26d227[_0x45c8('0x23')]['message']);return _0x44998e(_0x26d227['error'][_0x45c8('0x25')]);}else{logger[_0x45c8('0x26')](_0x45c8('0x1e'),_0x4ae0fe,'request\x20sent');_0x44998e(_0x26d227['result'][_0x45c8('0x25')]);}})['catch'](function(_0x4ff838){logger[_0x45c8('0x23')](_0x45c8('0x1e'),_0x4ae0fe,_0x4ff838);_0x2b6971(_0x4ff838);});});}function respondWithStatusCode(_0x3d7cfb,_0x12ba2a){_0x12ba2a=_0x12ba2a||0xcc;return function(_0x6ad881){if(_0x6ad881){return _0x3d7cfb[_0x45c8('0x27')](_0x12ba2a);}return _0x3d7cfb[_0x45c8('0x28')](_0x12ba2a)[_0x45c8('0x29')]();};}function respondWithResult(_0x58bffa,_0x4c861b){_0x4c861b=_0x4c861b||0xc8;return function(_0x5a298b){if(_0x5a298b){return _0x58bffa[_0x45c8('0x28')](_0x4c861b)[_0x45c8('0x2a')](_0x5a298b);}};}function respondWithFilteredResult(_0x5ed15c,_0x936741){return function(_0xa28acf){if(_0xa28acf){var _0x12aa5f=typeof _0x936741[_0x45c8('0x2b')]==='undefined'&&typeof _0x936741['limit']==='undefined';var _0xdda1bd=_0xa28acf['count'];var _0x433b2b=_0x12aa5f?0x0:_0x936741['offset'];var _0x3ae69c=_0x12aa5f?_0xa28acf['count']:_0x936741[_0x45c8('0x2b')]+_0x936741['limit'];var _0x218e6a;if(_0x3ae69c>=_0xdda1bd){_0x3ae69c=_0xdda1bd;_0x218e6a=0xc8;}else{_0x218e6a=0xce;}_0x5ed15c[_0x45c8('0x28')](_0x218e6a);return _0x5ed15c['set'](_0x45c8('0x2c'),_0x433b2b+'-'+_0x3ae69c+'/'+_0xdda1bd)[_0x45c8('0x2a')](_0xa28acf);}return null;};}function patchUpdates(_0x14cbe2){return function(_0x203e88){try{jsonpatch[_0x45c8('0x2d')](_0x203e88,_0x14cbe2,!![]);}catch(_0x16374c){return BPromise[_0x45c8('0x2e')](_0x16374c);}return _0x203e88[_0x45c8('0x2f')]();};}function saveUpdates(_0x43322e,_0x51391d){return function(_0x3dcedd){if(_0x3dcedd){return _0x3dcedd[_0x45c8('0x30')](_0x43322e)[_0x45c8('0x1d')](function(_0x23bc34){return _0x23bc34;});}return null;};}function removeEntity(_0x404378,_0x4139d4){return function(_0x322ed4){if(_0x322ed4){return _0x322ed4['destroy']()[_0x45c8('0x1d')](function(){_0x404378[_0x45c8('0x28')](0xcc)[_0x45c8('0x29')]();});}};}function handleEntityNotFound(_0x5472ca,_0x2c3a9e){return function(_0x1f9820){if(!_0x1f9820){_0x5472ca[_0x45c8('0x27')](0x194);}return _0x1f9820;};}function handleError(_0x3d1334,_0x51ddbb){_0x51ddbb=_0x51ddbb||0x1f4;return function(_0x2d5701){logger[_0x45c8('0x23')](_0x2d5701[_0x45c8('0x31')]);if(_0x2d5701['name']){delete _0x2d5701[_0x45c8('0x32')];}_0x3d1334[_0x45c8('0x28')](_0x51ddbb)[_0x45c8('0x33')](_0x2d5701);};}exports[_0x45c8('0x34')]=function(_0x470490,_0x3b81e6){var _0x461a1e={},_0x5e4974={},_0xa5327a={'count':0x0,'rows':[]};var _0x2469a8=_[_0x45c8('0x35')](db[_0x45c8('0x36')]['rawAttributes'],function(_0x4ef8b3){return{'name':_0x4ef8b3[_0x45c8('0x37')],'type':_0x4ef8b3[_0x45c8('0x38')]['key']};});_0x5e4974[_0x45c8('0x39')]=_[_0x45c8('0x35')](_0x2469a8,_0x45c8('0x32'));_0x5e4974[_0x45c8('0x3a')]=_[_0x45c8('0x3b')](_0x470490['query']);_0x5e4974['filters']=_[_0x45c8('0x3c')](_0x5e4974[_0x45c8('0x39')],_0x5e4974[_0x45c8('0x3a')]);_0x461a1e[_0x45c8('0x3d')]=_[_0x45c8('0x3c')](_0x5e4974[_0x45c8('0x39')],qs[_0x45c8('0x3e')](_0x470490[_0x45c8('0x3a')][_0x45c8('0x3e')]));_0x461a1e['attributes']=_0x461a1e[_0x45c8('0x3d')]['length']?_0x461a1e[_0x45c8('0x3d')]:_0x5e4974['model'];if(!_0x470490[_0x45c8('0x3a')]['hasOwnProperty'](_0x45c8('0x3f'))){_0x461a1e[_0x45c8('0x40')]=qs[_0x45c8('0x40')](_0x470490[_0x45c8('0x3a')][_0x45c8('0x40')]);_0x461a1e[_0x45c8('0x2b')]=qs['offset'](_0x470490['query']['offset']);}_0x461a1e[_0x45c8('0x41')]=qs[_0x45c8('0x42')](_0x470490['query'][_0x45c8('0x42')]);_0x461a1e[_0x45c8('0x43')]=qs[_0x45c8('0x44')](_[_0x45c8('0x45')](_0x470490['query'],_0x5e4974['filters']),_0x2469a8);if(_0x470490[_0x45c8('0x3a')][_0x45c8('0x46')]){_0x461a1e[_0x45c8('0x43')]=_[_0x45c8('0x47')](_0x461a1e[_0x45c8('0x43')],{'$or':_[_0x45c8('0x35')](_0x2469a8,function(_0x3c1d4f){if(_0x3c1d4f[_0x45c8('0x38')]!=='VIRTUAL'){var _0x5153d4={};_0x5153d4[_0x3c1d4f[_0x45c8('0x32')]]={'$like':'%'+_0x470490['query']['filter']+'%'};return _0x5153d4;}})});}_0x461a1e=_['merge']({},_0x461a1e,_0x470490['options']);var _0x9ad7f3={'where':_0x461a1e[_0x45c8('0x43')]};return db[_0x45c8('0x36')][_0x45c8('0x48')](_0x9ad7f3)['then'](function(_0x5623ac){_0xa5327a[_0x45c8('0x48')]=_0x5623ac;if(_0x470490[_0x45c8('0x3a')][_0x45c8('0x49')]){_0x461a1e[_0x45c8('0x4a')]=[{'all':!![]}];}return db['ChatMessage'][_0x45c8('0x4b')](_0x461a1e);})['then'](function(_0x55600e){_0xa5327a[_0x45c8('0x4c')]=_0x55600e;return _0xa5327a;})[_0x45c8('0x1d')](respondWithFilteredResult(_0x3b81e6,_0x461a1e))[_0x45c8('0x4d')](handleError(_0x3b81e6,null));};exports[_0x45c8('0x4e')]=function(_0x3cba60,_0x4050b8){var _0xbac25f={'raw':!![],'where':{'id':_0x3cba60[_0x45c8('0x4f')]['id']}},_0x59f908={};_0x59f908[_0x45c8('0x39')]=_[_0x45c8('0x3b')](db[_0x45c8('0x36')][_0x45c8('0x50')]);_0x59f908['query']=_[_0x45c8('0x3b')](_0x3cba60[_0x45c8('0x3a')]);_0x59f908[_0x45c8('0x44')]=_[_0x45c8('0x3c')](_0x59f908[_0x45c8('0x39')],_0x59f908[_0x45c8('0x3a')]);_0xbac25f['attributes']=_[_0x45c8('0x3c')](_0x59f908['model'],qs[_0x45c8('0x3e')](_0x3cba60['query']['fields']));_0xbac25f[_0x45c8('0x3d')]=_0xbac25f[_0x45c8('0x3d')][_0x45c8('0x51')]?_0xbac25f['attributes']:_0x59f908[_0x45c8('0x39')];if(_0x3cba60[_0x45c8('0x3a')][_0x45c8('0x49')]){_0xbac25f[_0x45c8('0x4a')]=[{'all':!![]}];}_0xbac25f=_['merge']({},_0xbac25f,_0x3cba60['options']);return db[_0x45c8('0x36')][_0x45c8('0x52')](_0xbac25f)[_0x45c8('0x1d')](handleEntityNotFound(_0x4050b8,null))[_0x45c8('0x1d')](respondWithResult(_0x4050b8,null))[_0x45c8('0x4d')](handleError(_0x4050b8,null));};exports[_0x45c8('0x53')]=function(_0x209e21,_0x3df2c5){return db[_0x45c8('0x36')]['create'](_0x209e21[_0x45c8('0x54')],{})[_0x45c8('0x1d')](respondWithResult(_0x3df2c5,0xc9))[_0x45c8('0x4d')](handleError(_0x3df2c5,null));};exports[_0x45c8('0x30')]=function(_0x5cb703,_0x5f4f71){if(_0x5cb703[_0x45c8('0x54')]['id']){delete _0x5cb703[_0x45c8('0x54')]['id'];}return db['ChatMessage'][_0x45c8('0x52')]({'where':{'id':_0x5cb703['params']['id']}})[_0x45c8('0x1d')](handleEntityNotFound(_0x5f4f71,null))['then'](saveUpdates(_0x5cb703[_0x45c8('0x54')],null))[_0x45c8('0x1d')](respondWithResult(_0x5f4f71,null))[_0x45c8('0x4d')](handleError(_0x5f4f71,null));};exports[_0x45c8('0x55')]=function(_0x6c57d5,_0x119377){return db[_0x45c8('0x36')]['find']({'where':{'id':_0x6c57d5[_0x45c8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x119377,null))[_0x45c8('0x1d')](removeEntity(_0x119377,null))[_0x45c8('0x4d')](handleError(_0x119377,null));};exports[_0x45c8('0x56')]=function(_0x14a12b,_0x4348e4){return db['ChatMessage']['describe']()[_0x45c8('0x1d')](respondWithResult(_0x4348e4,null))[_0x45c8('0x4d')](handleError(_0x4348e4,null));};var interaction_log=require(_0x45c8('0x12'))('chat-interactions');exports[_0x45c8('0x57')]=function(_0x3cd442,_0x35f551,_0x51f2d3){var _0xb5c4e0={'agent':{},'channel':_0x45c8('0x58')};if(_0x3cd442[_0x45c8('0x54')]['id']){delete _0x3cd442[_0x45c8('0x54')]['id'];}_0x3cd442[_0x45c8('0x54')][_0x45c8('0x59')]=!![];_0x3cd442[_0x45c8('0x54')][_0x45c8('0x5a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3cd442[_0x45c8('0x54')]['UserId']=_0x3cd442[_0x45c8('0x54')][_0x45c8('0x5b')]||_0x3cd442[_0x45c8('0x5c')]['id'];_0xb5c4e0['agent']['id']=_0x3cd442[_0x45c8('0x54')]['UserId'];return db['ChatMessage'][_0x45c8('0x52')]({'where':{'id':_0x3cd442[_0x45c8('0x4f')]['id'],'UserId':null}})[_0x45c8('0x1d')](handleEntityNotFound(_0x35f551,null))[_0x45c8('0x1d')](saveUpdates(_0x3cd442[_0x45c8('0x54')],null))[_0x45c8('0x1d')](function(_0x2890ee){if(_0x2890ee){_0xb5c4e0['message']=_0x2890ee[_0x45c8('0x5d')]({'plain':!![]});return db[_0x45c8('0x5e')][_0x45c8('0x52')]({'where':{'id':_0x2890ee[_0x45c8('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x35f551,null))['then'](function(_0x56b42b){if(_0x56b42b){return _0x56b42b[_0x45c8('0x30')]({'UserId':_0x3cd442['body'][_0x45c8('0x5b')],'read1stAt':_[_0x45c8('0x60')](_0x56b42b[_0x45c8('0x61')])?moment()['format'](_0x45c8('0x62')):undefined});}return null;})[_0x45c8('0x1d')](function(_0x1d6851){if(_0x1d6851){_0xb5c4e0[_0x45c8('0x63')]=_0x1d6851[_0x45c8('0x5d')]({'plain':!![]});interaction_log[_0x45c8('0x26')](_0x45c8('0x64'),_0x3cd442[_0x45c8('0x5c')]['id'],_0x3cd442[_0x45c8('0x5c')][_0x45c8('0x32')],_0x3cd442[_0x45c8('0x5c')]['role'],_0xb5c4e0[_0x45c8('0x63')]['id'],_0x3cd442[_0x45c8('0x54')]?JSON[_0x45c8('0x22')](_0x3cd442[_0x45c8('0x54')]):_0x45c8('0x65'));return respondWithRpcPromise(_0x45c8('0x66'),_0x45c8('0x67'),_0xb5c4e0);}return null;})['then'](function(_0x13bdb9){var _0x1e369f=_0x45c8('0x68')+_0x13bdb9[_0x45c8('0x25')][_0x45c8('0x69')];return db['sequelize'][_0x45c8('0x3a')](_0x1e369f,{'type':db[_0x45c8('0x6a')][_0x45c8('0x6b')]['SELECT'],'raw':!![]})[_0x45c8('0x1d')](function(_0x1e184f){return _0x1e184f;});})[_0x45c8('0x1d')](function(_0x15a8bc){if(_0x15a8bc){_0xb5c4e0['message']['contact']=_0x15a8bc[0x0];if(!_0x3cd442[_0x45c8('0x54')][_0x45c8('0x5b')])return;return db['User']['find']({'where':{'id':_0x3cd442[_0x45c8('0x54')][_0x45c8('0x5b')],'role':_0x45c8('0x6c')},'attributes':['id','name',_0x45c8('0x6d'),_0x45c8('0x6e'),_0x45c8('0x6f')],'raw':!![]});}return null;})['then'](function(_0x4f5a88){if(!_0x4f5a88)return null;_0xb5c4e0['message'][_0x45c8('0x6c')]=_0x4f5a88;return _0xb5c4e0;})[_0x45c8('0x1d')](function(_0x1baf8c){if(_0x1baf8c){if(_0x3cd442[_0x45c8('0x54')][_0x45c8('0x70')]){_0xb5c4e0[_0x45c8('0x25')][_0x45c8('0x71')]=util[_0x45c8('0x72')](_0x45c8('0x73'),_0x3cd442['user'][_0x45c8('0x32')]);_0xb5c4e0[_0x45c8('0x25')]['channel']=_0xb5c4e0[_0x45c8('0x74')];_0xb5c4e0[_0x45c8('0x25')]['motionChannel']=_0xb5c4e0['channel'];_0xb5c4e0[_0x45c8('0x25')]['event']=_0x45c8('0x57');return respondWithRpcPromise(_0x45c8('0x75'),_0x45c8('0x75'),{'event':_0x45c8('0x76'),'message':_['merge'](_0xb5c4e0[_0x45c8('0x25')],JSON[_0x45c8('0x77')](_0xb5c4e0[_0x45c8('0x63')][_0x45c8('0x78')]))},client9002)[_0x45c8('0x1d')](function(){return _0xb5c4e0;});}return _0xb5c4e0;}return null;})[_0x45c8('0x1d')](respondWithResult(_0x35f551,null))[_0x45c8('0x4d')](handleError(_0x35f551,null));};var interaction_log=require('../../config/logger')(_0x45c8('0x79'));exports[_0x45c8('0x2e')]=function(_0x392a08,_0x2fd384,_0x1bb324){var _0x13043c={'agent':{},'channel':_0x45c8('0x58')};if(_0x392a08[_0x45c8('0x54')]['id']){delete _0x392a08['body']['id'];}_0x392a08[_0x45c8('0x54')][_0x45c8('0x5b')]=_0x392a08['body'][_0x45c8('0x5b')]||_0x392a08[_0x45c8('0x5c')]['id'];_0x13043c[_0x45c8('0x6c')]['id']=_0x392a08[_0x45c8('0x54')]['UserId'];return db[_0x45c8('0x36')][_0x45c8('0x52')]({'where':{'id':_0x392a08[_0x45c8('0x4f')]['id'],'UserId':null}})[_0x45c8('0x1d')](handleEntityNotFound(_0x2fd384,null))[_0x45c8('0x1d')](function(_0x2f95f8){if(_0x2f95f8){_0x13043c['message']=_0x2f95f8['get']({'plain':!![]});return db[_0x45c8('0x5e')][_0x45c8('0x52')]({'where':{'id':_0x2f95f8[_0x45c8('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x2fd384,null))[_0x45c8('0x1d')](function(_0x1d368f){if(_0x1d368f){_0x13043c[_0x45c8('0x63')]=_0x1d368f[_0x45c8('0x5d')]({'plain':!![]});interaction_log[_0x45c8('0x26')](_0x45c8('0x7a'),_0x392a08[_0x45c8('0x5c')]['id'],_0x392a08[_0x45c8('0x5c')][_0x45c8('0x32')],_0x392a08[_0x45c8('0x5c')]['role'],_0x13043c[_0x45c8('0x63')]['id'],_0x392a08['body']?JSON['stringify'](_0x392a08[_0x45c8('0x54')]):_0x45c8('0x65'));return respondWithRpcPromise(_0x45c8('0x7b'),_0x45c8('0x7c'),_0x13043c);}return null;})['then'](function(_0x8bc46e){var _0x31d2a3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x8bc46e[_0x45c8('0x25')][_0x45c8('0x69')];return db[_0x45c8('0x7d')][_0x45c8('0x3a')](_0x31d2a3,{'type':db['Sequelize'][_0x45c8('0x6b')][_0x45c8('0x7e')],'raw':!![]})[_0x45c8('0x1d')](function(_0x5ee2c9){return _0x5ee2c9;});})[_0x45c8('0x1d')](function(_0xfbe54){if(_0xfbe54){_0x13043c[_0x45c8('0x25')][_0x45c8('0x7f')]=_0xfbe54[0x0];if(!_0x392a08['body'][_0x45c8('0x5b')])return;return db['User'][_0x45c8('0x52')]({'where':{'id':_0x392a08['body'][_0x45c8('0x5b')],'role':_0x45c8('0x6c')},'attributes':['id','name','fullname',_0x45c8('0x6e'),_0x45c8('0x6f')],'raw':!![]});}return null;})[_0x45c8('0x1d')](function(_0x1453c0){if(!_0x1453c0)return null;_0x13043c[_0x45c8('0x25')]['agent']=_0x1453c0;return _0x13043c;})[_0x45c8('0x1d')](function(_0x2d3c41){if(_0x2d3c41){_0x2d3c41['message']['interface']=util[_0x45c8('0x72')](_0x45c8('0x73'),_0x392a08[_0x45c8('0x5c')]['name']);_0x2d3c41[_0x45c8('0x25')]['channel']=_0x13043c['channel'];_0x2d3c41[_0x45c8('0x25')][_0x45c8('0x80')]=_0x13043c[_0x45c8('0x74')];_0x2d3c41['message']['event']=_0x45c8('0x2e');respondWithRpcPromise(_0x45c8('0x75'),'EventManager',{'event':_0x45c8('0x81'),'message':_[_0x45c8('0x47')](_0x13043c[_0x45c8('0x25')],JSON[_0x45c8('0x77')](_0x13043c[_0x45c8('0x63')][_0x45c8('0x78')]))},client9002);return _0x13043c;}return null;})[_0x45c8('0x1d')](respondWithResult(_0x2fd384,null))['catch'](handleError(_0x2fd384,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 29e4778..7c54fd7 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 _0xe551=['../../mysqldb','setMaxListeners','update','emit','hook','exports','events'];(function(_0x5c08b0,_0x4e7ac1){var _0xdecb64=function(_0x4896d8){while(--_0x4896d8){_0x5c08b0['push'](_0x5c08b0['shift']());}};_0xdecb64(++_0x4e7ac1);}(_0xe551,0x1c6));var _0x1e55=function(_0x468a6c,_0x3300bd){_0x468a6c=_0x468a6c-0x0;var _0xd45630=_0xe551[_0x468a6c];return _0xd45630;};'use strict';var EventEmitter=require(_0x1e55('0x0'));var ChatMessage=require(_0x1e55('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1e55('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1e55('0x3'),'afterDestroy':'remove'};function emitEvent(_0x47b1c3){return function(_0x158918,_0x13b7f9,_0x590001){ChatMessageEvents[_0x1e55('0x4')](_0x47b1c3+':'+_0x158918['id'],_0x158918);ChatMessageEvents[_0x1e55('0x4')](_0x47b1c3,_0x158918);_0x590001(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x1e55('0x5')](e,emitEvent(event));}}module[_0x1e55('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x7acd=['emit','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','save','update','remove'];(function(_0x5b0aef,_0x2d7d6f){var _0x14e3d2=function(_0x3947aa){while(--_0x3947aa){_0x5b0aef['push'](_0x5b0aef['shift']());}};_0x14e3d2(++_0x2d7d6f);}(_0x7acd,0x12c));var _0xd7ac=function(_0x11b240,_0xcd8bcf){_0x11b240=_0x11b240-0x0;var _0x35db6b=_0x7acd[_0x11b240];return _0x35db6b;};'use strict';var EventEmitter=require(_0xd7ac('0x0'));var ChatMessage=require(_0xd7ac('0x1'))['db'][_0xd7ac('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd7ac('0x3'),'afterUpdate':_0xd7ac('0x4'),'afterDestroy':_0xd7ac('0x5')};function emitEvent(_0x93d375){return function(_0x1ed461,_0x13e88c,_0x17d958){ChatMessageEvents[_0xd7ac('0x6')](_0x93d375+':'+_0x1ed461['id'],_0x1ed461);ChatMessageEvents['emit'](_0x93d375,_0x1ed461);_0x17d958(null);};}for(var e in events){if(events[_0xd7ac('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xd7ac('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 8053667..07e29c8 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 _0xed05=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','fti_chat_messages','models','direction','toLowerCase','secret','isNil','UserId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x4cb500,_0x1c2845){var _0x35263c=function(_0x3a78cc){while(--_0x3a78cc){_0x4cb500['push'](_0x4cb500['shift']());}};_0x35263c(++_0x1c2845);}(_0xed05,0xcd));var _0x5ed0=function(_0x1716fb,_0xe6dcff){_0x1716fb=_0x1716fb-0x0;var _0x196932=_0xed05[_0x1716fb];return _0x196932;};'use strict';var _=require(_0x5ed0('0x0'));var util=require(_0x5ed0('0x1'));var logger=require(_0x5ed0('0x2'))(_0x5ed0('0x3'));var moment=require(_0x5ed0('0x4'));var BPromise=require(_0x5ed0('0x5'));var rp=require(_0x5ed0('0x6'));var fs=require('fs');var path=require(_0x5ed0('0x7'));var rimraf=require(_0x5ed0('0x8'));var config=require(_0x5ed0('0x9'));var attributes=require(_0x5ed0('0xa'));module[_0x5ed0('0xb')]=function(_0x5b9994,_0x4712b3){return _0x5b9994['define'](_0x5ed0('0xc'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x5ed0('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3aee4c,_0x36d4e2,_0x5a1295){var _0x18f1be=_0x5b9994[_0x5ed0('0xe')];var _0x36ee24=_0x3aee4c['get']({'plain':!![]});if(_0x36ee24[_0x5ed0('0xf')][_0x5ed0('0x10')]()==='in'||_0x36ee24[_0x5ed0('0xf')][_0x5ed0('0x10')]()==='out'&&!_0x36ee24[_0x5ed0('0x11')]&&!_[_0x5ed0('0x12')](_0x36ee24[_0x5ed0('0x13')])){_0x18f1be['ChatInteraction']['findOne']({'where':{'id':_0x36ee24['ChatInteractionId']}})[_0x5ed0('0x14')](function(_0x454192){if(_0x454192){_0x454192[_0x5ed0('0x15')]({'lastMsgAt':_0x36ee24['createdAt'],'lastMsgDirection':_0x36ee24[_0x5ed0('0xf')][_0x5ed0('0x10')]()});}})[_0x5ed0('0x16')](function(_0x56cadd){console[_0x5ed0('0x17')](_0x56cadd);});}_0x5a1295();}},'charset':_0x5ed0('0x18'),'collate':_0x5ed0('0x19')});}; \ No newline at end of file +var _0xb879=['bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment'];(function(_0x2cd9f6,_0x450d32){var _0x35182a=function(_0x9943b1){while(--_0x9943b1){_0x2cd9f6['push'](_0x2cd9f6['shift']());}};_0x35182a(++_0x450d32);}(_0xb879,0x1e1));var _0x9b87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb879[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9b87('0x0'));var logger=require('../../config/logger')(_0x9b87('0x1'));var moment=require(_0x9b87('0x2'));var BPromise=require(_0x9b87('0x3'));var rp=require(_0x9b87('0x4'));var fs=require('fs');var path=require(_0x9b87('0x5'));var rimraf=require(_0x9b87('0x6'));var config=require(_0x9b87('0x7'));var attributes=require(_0x9b87('0x8'));module['exports']=function(_0x5472a8,_0x551383){return _0x5472a8['define']('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x9b87('0x9'),'fields':[_0x9b87('0xa')],'type':_0x9b87('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d83d2,_0xdc7751,_0x3f4379){var _0x5bb989=_0x5472a8[_0x9b87('0xc')];var _0x147b83=_0x1d83d2['get']({'plain':!![]});if(_0x147b83[_0x9b87('0xd')][_0x9b87('0xe')]()==='in'||_0x147b83[_0x9b87('0xd')][_0x9b87('0xe')]()===_0x9b87('0xf')&&!_0x147b83[_0x9b87('0x10')]&&!_[_0x9b87('0x11')](_0x147b83['UserId'])){_0x5bb989['ChatInteraction']['findOne']({'where':{'id':_0x147b83['ChatInteractionId']}})['then'](function(_0x5401c9){if(_0x5401c9){_0x5401c9['update']({'lastMsgAt':_0x147b83[_0x9b87('0x12')],'lastMsgDirection':_0x147b83[_0x9b87('0xd')][_0x9b87('0xe')]()});}})['catch'](function(_0x352342){console[_0x9b87('0x13')](_0x352342);});}_0x3f4379();}},'charset':_0x9b87('0x14'),'collate':_0x9b87('0x15')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 39c182b..4f7b727 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 _0xc03a=['result','catch','ChatMessage','body','options','raw','CreateChatMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3a6eb9,_0x2355df){var _0x16add3=function(_0x3324b2){while(--_0x3324b2){_0x3a6eb9['push'](_0x3a6eb9['shift']());}};_0x16add3(++_0x2355df);}(_0xc03a,0x1e3));var _0xac03=function(_0x30fb19,_0x42e71e){_0x30fb19=_0x30fb19-0x0;var _0x2f2695=_0xc03a[_0x30fb19];return _0x2f2695;};'use strict';var _=require(_0xac03('0x0'));var util=require(_0xac03('0x1'));var moment=require(_0xac03('0x2'));var BPromise=require('bluebird');var rs=require(_0xac03('0x3'));var fs=require('fs');var Redis=require(_0xac03('0x4'));var db=require(_0xac03('0x5'))['db'];var utils=require(_0xac03('0x6'));var logger=require(_0xac03('0x7'))(_0xac03('0x8'));var config=require(_0xac03('0x9'));var jayson=require(_0xac03('0xa'));var client=jayson[_0xac03('0xb')][_0xac03('0xc')]({'port':0x232a});config[_0xac03('0xd')]=_['defaults'](config[_0xac03('0xd')],{'host':_0xac03('0xe'),'port':0x18eb});var socket=require(_0xac03('0xf'))(new Redis(config[_0xac03('0xd')]));require('./chatMessage.socket')[_0xac03('0x10')](socket);function respondWithRpcPromise(_0x2cb197,_0x323771,_0x61fb5c){return new BPromise(function(_0x2dfcb4,_0x2c13f4){return client[_0xac03('0x11')](_0x2cb197,_0x61fb5c)[_0xac03('0x12')](function(_0x25c7a0){logger[_0xac03('0x13')](_0xac03('0x14'),_0x323771,_0xac03('0x15'));logger[_0xac03('0x16')](_0xac03('0x17'),_0x323771,'request\x20sent',JSON[_0xac03('0x18')](_0x25c7a0));if(_0x25c7a0['error']){if(_0x25c7a0[_0xac03('0x19')]['code']===0x1f4){logger['error'](_0xac03('0x14'),_0x323771,_0x25c7a0['error'][_0xac03('0x1a')]);return _0x2c13f4(_0x25c7a0[_0xac03('0x19')][_0xac03('0x1a')]);}logger['error'](_0xac03('0x14'),_0x323771,_0x25c7a0[_0xac03('0x19')][_0xac03('0x1a')]);return _0x2dfcb4(_0x25c7a0['error'][_0xac03('0x1a')]);}else{logger[_0xac03('0x13')](_0xac03('0x14'),_0x323771,_0xac03('0x15'));_0x2dfcb4(_0x25c7a0[_0xac03('0x1b')]['message']);}})[_0xac03('0x1c')](function(_0xe05c4c){logger[_0xac03('0x19')](_0xac03('0x14'),_0x323771,_0xe05c4c);_0x2c13f4(_0xe05c4c);});});}exports['CreateChatMessage']=function(_0x486f23){var _0x38de5f=this;return new Promise(function(_0x5e6e77,_0x2a830b){return db[_0xac03('0x1d')]['create'](_0x486f23[_0xac03('0x1e')],{'raw':_0x486f23[_0xac03('0x1f')]?_0x486f23['options'][_0xac03('0x20')]===undefined?!![]:![]:!![]})[_0xac03('0x12')](function(_0x4d0c65){logger[_0xac03('0x13')](_0xac03('0x21'),_0x486f23);logger[_0xac03('0x16')]('CreateChatMessage',_0x486f23,JSON[_0xac03('0x18')](_0x4d0c65));_0x5e6e77(_0x4d0c65);})['catch'](function(_0x2cdba8){logger['error'](_0xac03('0x21'),_0x2cdba8[_0xac03('0x1a')],_0x486f23);_0x2a830b(_0x38de5f['error'](0x1f4,_0x2cdba8[_0xac03('0x1a')]));});});}; \ No newline at end of file +var _0xdbb9=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ChatMessage','options','raw','CreateChatMessage'];(function(_0x5f132e,_0x3432c2){var _0x1efc2a=function(_0x47ca58){while(--_0x47ca58){_0x5f132e['push'](_0x5f132e['shift']());}};_0x1efc2a(++_0x3432c2);}(_0xdbb9,0xf9));var _0x9dbb=function(_0xd58b1a,_0xf139f4){_0xd58b1a=_0xd58b1a-0x0;var _0x2832d5=_0xdbb9[_0xd58b1a];return _0x2832d5;};'use strict';var _=require('lodash');var util=require(_0x9dbb('0x0'));var moment=require(_0x9dbb('0x1'));var BPromise=require(_0x9dbb('0x2'));var rs=require(_0x9dbb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9dbb('0x4'))['db'];var utils=require(_0x9dbb('0x5'));var logger=require(_0x9dbb('0x6'))(_0x9dbb('0x7'));var config=require(_0x9dbb('0x8'));var jayson=require(_0x9dbb('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x9dbb('0xa')](config[_0x9dbb('0xb')],{'host':_0x9dbb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9dbb('0xd'))[_0x9dbb('0xe')](socket);function respondWithRpcPromise(_0x37f00d,_0x502a4c,_0x40bc14){return new BPromise(function(_0x22f3b0,_0x5b9290){return client[_0x9dbb('0xf')](_0x37f00d,_0x40bc14)['then'](function(_0x435a9c){logger[_0x9dbb('0x10')](_0x9dbb('0x11'),_0x502a4c,_0x9dbb('0x12'));logger[_0x9dbb('0x13')](_0x9dbb('0x14'),_0x502a4c,_0x9dbb('0x12'),JSON[_0x9dbb('0x15')](_0x435a9c));if(_0x435a9c[_0x9dbb('0x16')]){if(_0x435a9c[_0x9dbb('0x16')][_0x9dbb('0x17')]===0x1f4){logger[_0x9dbb('0x16')](_0x9dbb('0x11'),_0x502a4c,_0x435a9c[_0x9dbb('0x16')][_0x9dbb('0x18')]);return _0x5b9290(_0x435a9c[_0x9dbb('0x16')]['message']);}logger[_0x9dbb('0x16')](_0x9dbb('0x11'),_0x502a4c,_0x435a9c[_0x9dbb('0x16')][_0x9dbb('0x18')]);return _0x22f3b0(_0x435a9c[_0x9dbb('0x16')]['message']);}else{logger[_0x9dbb('0x10')](_0x9dbb('0x11'),_0x502a4c,_0x9dbb('0x12'));_0x22f3b0(_0x435a9c[_0x9dbb('0x19')][_0x9dbb('0x18')]);}})['catch'](function(_0x3dfd6c){logger['error'](_0x9dbb('0x11'),_0x502a4c,_0x3dfd6c);_0x5b9290(_0x3dfd6c);});});}exports['CreateChatMessage']=function(_0x5b0cde){var _0x5d8250=this;return new Promise(function(_0x259cb6,_0x192eb5){return db[_0x9dbb('0x1a')]['create'](_0x5b0cde['body'],{'raw':_0x5b0cde['options']?_0x5b0cde[_0x9dbb('0x1b')][_0x9dbb('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4a07ef){logger['info'](_0x9dbb('0x1d'),_0x5b0cde);logger[_0x9dbb('0x13')](_0x9dbb('0x1d'),_0x5b0cde,JSON['stringify'](_0x4a07ef));_0x259cb6(_0x4a07ef);})[_0x9dbb('0x1e')](function(_0x130d84){logger[_0x9dbb('0x16')](_0x9dbb('0x1d'),_0x130d84[_0x9dbb('0x18')],_0x5b0cde);_0x192eb5(_0x5d8250[_0x9dbb('0x16')](0x1f4,_0x130d84[_0x9dbb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index d8d263e..da7057e 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 _0x8a8b=['update','removeListener','register','chatMessage:','./chatMessage.events'];(function(_0x4bf0f2,_0x3aa38b){var _0x7b0d6e=function(_0x57b762){while(--_0x57b762){_0x4bf0f2['push'](_0x4bf0f2['shift']());}};_0x7b0d6e(++_0x3aa38b);}(_0x8a8b,0xae));var _0xb8a8=function(_0x318e7d,_0x488b03){_0x318e7d=_0x318e7d-0x0;var _0x34c556=_0x8a8b[_0x318e7d];return _0x34c556;};'use strict';var ChatMessageEvents=require(_0xb8a8('0x0'));var events=['save','remove',_0xb8a8('0x1')];function createListener(_0x308da3,_0x4f56d4){return function(_0x13bc8b){_0x4f56d4['emit'](_0x308da3,_0x13bc8b);};}function removeListener(_0xca9854,_0x4fe301){return function(){ChatMessageEvents[_0xb8a8('0x2')](_0xca9854,_0x4fe301);};}exports[_0xb8a8('0x3')]=function(_0xcca5ca){for(var _0x578e1b=0x0,_0x37e48d=events['length'];_0x578e1b<_0x37e48d;_0x578e1b++){var _0x32d542=events[_0x578e1b];var _0x4c46e9=createListener(_0xb8a8('0x4')+_0x32d542,_0xcca5ca);ChatMessageEvents['on'](_0x32d542,_0x4c46e9);}}; \ No newline at end of file +var _0x2123=['./chatMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3ac5ce,_0x51a92a){var _0x455386=function(_0x2b0fb6){while(--_0x2b0fb6){_0x3ac5ce['push'](_0x3ac5ce['shift']());}};_0x455386(++_0x51a92a);}(_0x2123,0x190));var _0x3212=function(_0x49dbe9,_0x52d2da){_0x49dbe9=_0x49dbe9-0x0;var _0x13c5bb=_0x2123[_0x49dbe9];return _0x13c5bb;};'use strict';var ChatMessageEvents=require(_0x3212('0x0'));var events=[_0x3212('0x1'),_0x3212('0x2'),_0x3212('0x3')];function createListener(_0x7158b8,_0x2ff863){return function(_0x8c047){_0x2ff863[_0x3212('0x4')](_0x7158b8,_0x8c047);};}function removeListener(_0x304f80,_0x6ca653){return function(){ChatMessageEvents[_0x3212('0x5')](_0x304f80,_0x6ca653);};}exports[_0x3212('0x6')]=function(_0x5d9d36){for(var _0x3859e4=0x0,_0x2b1302=events[_0x3212('0x7')];_0x3859e4<_0x2b1302;_0x3859e4++){var _0x4b35e9=events[_0x3859e4];var _0x3e17a3=createListener('chatMessage:'+_0x4b35e9,_0x5d9d36);ChatMessageEvents['on'](_0x4b35e9,_0x3e17a3);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index ebb7f01..ce416ba 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 _0xca5b=['chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','index','get','isAuthenticated','describe','/:id','show','tracked','chat'];(function(_0x3d7e4d,_0x972ff8){var _0x52fc1c=function(_0x1d9b2d){while(--_0x1d9b2d){_0x3d7e4d['push'](_0x3d7e4d['shift']());}};_0x52fc1c(++_0x972ff8);}(_0xca5b,0xca));var _0xbca5=function(_0x5545f7,_0x570414){_0x5545f7=_0x5545f7-0x0;var _0x52a979=_0xca5b[_0x5545f7];return _0x52a979;};'use strict';var multer=require(_0xbca5('0x0'));var util=require(_0xbca5('0x1'));var path=require(_0xbca5('0x2'));var timeout=require('connect-timeout');var express=require(_0xbca5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbca5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbca5('0x5'));var controller=require('./chatMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbca5('0x6')]);router[_0xbca5('0x7')]('/describe',auth[_0xbca5('0x8')](),controller[_0xbca5('0x9')]);router['get'](_0xbca5('0xa'),auth[_0xbca5('0x8')](),controller[_0xbca5('0xb')]);router['post']('/',auth[_0xbca5('0x8')](),interaction[_0xbca5('0xc')](_0xbca5('0xd'),_0xbca5('0xe')),controller[_0xbca5('0xf')]);router[_0xbca5('0x10')](_0xbca5('0xa'),controller[_0xbca5('0x11')]);router[_0xbca5('0x10')](_0xbca5('0x12'),auth['isAuthenticated'](),controller[_0xbca5('0x13')]);router['put'](_0xbca5('0x14'),auth[_0xbca5('0x8')](),controller[_0xbca5('0x15')]);router['delete'](_0xbca5('0xa'),auth[_0xbca5('0x8')](),controller[_0xbca5('0x16')]);module[_0xbca5('0x17')]=router; \ No newline at end of file +var _0x3740=['describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','/:id/reject','delete','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x1e9b13,_0x78c34b){var _0x27254f=function(_0x3aa64d){while(--_0x3aa64d){_0x1e9b13['push'](_0x1e9b13['shift']());}};_0x27254f(++_0x78c34b);}(_0x3740,0x1be));var _0x0374=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0x3740[_0x41382c];return _0x4da35b;};'use strict';var multer=require(_0x0374('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0374('0x1'));var express=require(_0x0374('0x2'));var router=express['Router']();var fs_extra=require(_0x0374('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0374('0x4'));var config=require('../../config/environment');var controller=require(_0x0374('0x5'));router[_0x0374('0x6')]('/',auth[_0x0374('0x7')](),controller[_0x0374('0x8')]);router[_0x0374('0x6')](_0x0374('0x9'),auth[_0x0374('0x7')](),controller[_0x0374('0xa')]);router[_0x0374('0x6')](_0x0374('0xb'),auth[_0x0374('0x7')](),controller[_0x0374('0xc')]);router[_0x0374('0xd')]('/',auth[_0x0374('0x7')](),interaction[_0x0374('0xe')](_0x0374('0xf'),_0x0374('0x10')),controller[_0x0374('0x11')]);router[_0x0374('0x12')](_0x0374('0xb'),controller[_0x0374('0x13')]);router[_0x0374('0x12')](_0x0374('0x14'),auth[_0x0374('0x7')](),controller['accept']);router[_0x0374('0x12')](_0x0374('0x15'),auth['isAuthenticated'](),controller['reject']);router[_0x0374('0x16')](_0x0374('0xb'),auth[_0x0374('0x7')](),controller['destroy']);module[_0x0374('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 43e53b3..a79baea 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 _0xe6b8=['exports','medium','sequelize'];(function(_0x940767,_0x1db6f0){var _0x383f30=function(_0x5d2048){while(--_0x5d2048){_0x940767['push'](_0x940767['shift']());}};_0x383f30(++_0x1db6f0);}(_0xe6b8,0x140));var _0x8e6b=function(_0x15e7b3,_0x39008d){_0x15e7b3=_0x15e7b3-0x0;var _0x53d9b5=_0xe6b8[_0x15e7b3];return _0x53d9b5;};'use strict';var Sequelize=require(_0x8e6b('0x0'));module[_0x8e6b('0x1')]={'body':{'type':Sequelize['TEXT'](_0x8e6b('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x4dd2=['medium','exports','TEXT'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x4dd2,0xf1));var _0x24dd=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0x4dd2[_0x4bc4c8];return _0x3bb121;};'use strict';var Sequelize=require('sequelize');module[_0x24dd('0x0')]={'body':{'type':Sequelize[_0x24dd('0x1')](_0x24dd('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index aa3a96a..d21e299 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x5eab2d,_0xe39035){var _0x21a8cd=function(_0x178eb9){while(--_0x178eb9){_0x5eab2d['push'](_0x5eab2d['shift']());}};_0x21a8cd(++_0xe39035);}(_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['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x7a54,0x106));var _0x47a5=function(_0x254099,_0x8117ce){_0x254099=_0x254099-0x0;var _0x5b60ee=_0x7a54[_0x254099];return _0x5b60ee;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2fa61fc..e410d25 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 _0x21b8=['request-promise','path','./chatOfflineMessage.attributes','ChatOfflineMessage','utf8mb4','lodash','util','api','bluebird'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0x21b8,0x176));var _0x821b=function(_0x20085e,_0x1aaa2c){_0x20085e=_0x20085e-0x0;var _0x334a97=_0x21b8[_0x20085e];return _0x334a97;};'use strict';var _=require(_0x821b('0x0'));var util=require(_0x821b('0x1'));var logger=require('../../config/logger')(_0x821b('0x2'));var moment=require('moment');var BPromise=require(_0x821b('0x3'));var rp=require(_0x821b('0x4'));var fs=require('fs');var path=require(_0x821b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x821b('0x6'));module['exports']=function(_0x3b0c07,_0x48cf38){return _0x3b0c07['define'](_0x821b('0x7'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x821b('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc49f=['path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x4508e8,_0x154547){var _0x11d273=function(_0x381f23){while(--_0x381f23){_0x4508e8['push'](_0x4508e8['shift']());}};_0x11d273(++_0x154547);}(_0xc49f,0x1d7));var _0xfc49=function(_0x3caa85,_0x516248){_0x3caa85=_0x3caa85-0x0;var _0x59bdf3=_0xc49f[_0x3caa85];return _0x59bdf3;};'use strict';var _=require(_0xfc49('0x0'));var util=require('util');var logger=require(_0xfc49('0x1'))(_0xfc49('0x2'));var moment=require('moment');var BPromise=require(_0xfc49('0x3'));var rp=require(_0xfc49('0x4'));var fs=require('fs');var path=require(_0xfc49('0x5'));var rimraf=require(_0xfc49('0x6'));var config=require(_0xfc49('0x7'));var attributes=require(_0xfc49('0x8'));module[_0xfc49('0x9')]=function(_0x5c3636,_0x397dae){return _0x5c3636[_0xfc49('0xa')](_0xfc49('0xb'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfc49('0xc'),'collate':_0xfc49('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 6c65c6d..f995228 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 _0xfd27=['../../config/environment','jayson/promise','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x4191af,_0x5783da){var _0x27bebf=function(_0x355be7){while(--_0x355be7){_0x4191af['push'](_0x4191af['shift']());}};_0x27bebf(++_0x5783da);}(_0xfd27,0x1cf));var _0x7fd2=function(_0x4a32e7,_0x1a8572){_0x4a32e7=_0x4a32e7-0x0;var _0x4b9700=_0xfd27[_0x4a32e7];return _0x4b9700;};'use strict';var _=require(_0x7fd2('0x0'));var util=require('util');var moment=require(_0x7fd2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fd2('0x2'));var db=require(_0x7fd2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7fd2('0x4'))('rpc');var config=require(_0x7fd2('0x5'));var jayson=require(_0x7fd2('0x6'));var client=jayson[_0x7fd2('0x7')][_0x7fd2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ef3b1,_0x26dc02,_0x3e3878){return new BPromise(function(_0x42eb3e,_0x1f4c5d){return client[_0x7fd2('0x9')](_0x4ef3b1,_0x3e3878)['then'](function(_0x4befd0){logger['info'](_0x7fd2('0xa'),_0x26dc02,_0x7fd2('0xb'));logger['debug'](_0x7fd2('0xc'),_0x26dc02,'request\x20sent',JSON[_0x7fd2('0xd')](_0x4befd0));if(_0x4befd0[_0x7fd2('0xe')]){if(_0x4befd0[_0x7fd2('0xe')]['code']===0x1f4){logger[_0x7fd2('0xe')](_0x7fd2('0xa'),_0x26dc02,_0x4befd0['error'][_0x7fd2('0xf')]);return _0x1f4c5d(_0x4befd0[_0x7fd2('0xe')][_0x7fd2('0xf')]);}logger[_0x7fd2('0xe')](_0x7fd2('0xa'),_0x26dc02,_0x4befd0[_0x7fd2('0xe')][_0x7fd2('0xf')]);return _0x42eb3e(_0x4befd0[_0x7fd2('0xe')][_0x7fd2('0xf')]);}else{logger[_0x7fd2('0x10')](_0x7fd2('0xa'),_0x26dc02,_0x7fd2('0xb'));_0x42eb3e(_0x4befd0[_0x7fd2('0x11')][_0x7fd2('0xf')]);}})['catch'](function(_0x54b7f9){logger[_0x7fd2('0xe')](_0x7fd2('0xa'),_0x26dc02,_0x54b7f9);_0x1f4c5d(_0x54b7f9);});});} \ No newline at end of file +var _0xb719=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x137c34,_0x2ebd98){var _0x145d9b=function(_0x1b7701){while(--_0x1b7701){_0x137c34['push'](_0x137c34['shift']());}};_0x145d9b(++_0x2ebd98);}(_0xb719,0x1f4));var _0x9b71=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0xb719[_0x38622b];return _0x2c1a7a;};'use strict';var _=require(_0x9b71('0x0'));var util=require(_0x9b71('0x1'));var moment=require(_0x9b71('0x2'));var BPromise=require(_0x9b71('0x3'));var rs=require(_0x9b71('0x4'));var fs=require('fs');var Redis=require(_0x9b71('0x5'));var db=require(_0x9b71('0x6'))['db'];var utils=require(_0x9b71('0x7'));var logger=require('../../config/logger')(_0x9b71('0x8'));var config=require(_0x9b71('0x9'));var jayson=require(_0x9b71('0xa'));var client=jayson['client'][_0x9b71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39e280,_0x2d9fcb,_0x4cd350){return new BPromise(function(_0x5e3951,_0x2a4d12){return client[_0x9b71('0xc')](_0x39e280,_0x4cd350)[_0x9b71('0xd')](function(_0x18bc6c){logger[_0x9b71('0xe')](_0x9b71('0xf'),_0x2d9fcb,_0x9b71('0x10'));logger[_0x9b71('0x11')](_0x9b71('0x12'),_0x2d9fcb,'request\x20sent',JSON[_0x9b71('0x13')](_0x18bc6c));if(_0x18bc6c[_0x9b71('0x14')]){if(_0x18bc6c[_0x9b71('0x14')][_0x9b71('0x15')]===0x1f4){logger[_0x9b71('0x14')](_0x9b71('0xf'),_0x2d9fcb,_0x18bc6c[_0x9b71('0x14')][_0x9b71('0x16')]);return _0x2a4d12(_0x18bc6c[_0x9b71('0x14')]['message']);}logger[_0x9b71('0x14')](_0x9b71('0xf'),_0x2d9fcb,_0x18bc6c[_0x9b71('0x14')]['message']);return _0x5e3951(_0x18bc6c[_0x9b71('0x14')]['message']);}else{logger[_0x9b71('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2d9fcb,_0x9b71('0x10'));_0x5e3951(_0x18bc6c[_0x9b71('0x17')][_0x9b71('0x16')]);}})[_0x9b71('0x18')](function(_0x10b0cc){logger['error'](_0x9b71('0xf'),_0x2d9fcb,_0x10b0cc);_0x2a4d12(_0x10b0cc);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index d8dcdbe..25c5734 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 _0xc921=['util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x50ad33,_0x368a00){var _0x125443=function(_0x38296a){while(--_0x38296a){_0x50ad33['push'](_0x50ad33['shift']());}};_0x125443(++_0x368a00);}(_0xc921,0x125));var _0x1c92=function(_0x1795df,_0xcb261e){_0x1795df=_0x1795df-0x0;var _0x3f13c0=_0xc921[_0x1795df];return _0x3f13c0;};'use strict';var multer=require(_0x1c92('0x0'));var util=require(_0x1c92('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1c92('0x2')]();var fs_extra=require(_0x1c92('0x3'));var auth=require(_0x1c92('0x4'));var interaction=require(_0x1c92('0x5'));var config=require('../../config/environment');var controller=require(_0x1c92('0x6'));router[_0x1c92('0x7')]('/',auth[_0x1c92('0x8')](),controller[_0x1c92('0x9')]);router['get'](_0x1c92('0xa'),auth[_0x1c92('0x8')](),controller[_0x1c92('0xb')]);router[_0x1c92('0x7')](_0x1c92('0xc'),auth[_0x1c92('0x8')](),controller[_0x1c92('0xd')]);router[_0x1c92('0xe')]('/',auth['isAuthenticated'](),controller[_0x1c92('0xf')]);router[_0x1c92('0x10')]('/:id',auth[_0x1c92('0x8')](),controller[_0x1c92('0x11')]);router[_0x1c92('0x12')]('/:id',auth[_0x1c92('0x8')](),controller[_0x1c92('0x13')]);module[_0x1c92('0x14')]=router; \ No newline at end of file +var _0x8b1c=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','put','update','delete','/:id','destroy'];(function(_0x2c81b5,_0x1e6869){var _0x57c97f=function(_0x359537){while(--_0x359537){_0x2c81b5['push'](_0x2c81b5['shift']());}};_0x57c97f(++_0x1e6869);}(_0x8b1c,0xc7));var _0xc8b1=function(_0x12bf4c,_0x5cf024){_0x12bf4c=_0x12bf4c-0x0;var _0x3afed8=_0x8b1c[_0x12bf4c];return _0x3afed8;};'use strict';var multer=require(_0xc8b1('0x0'));var util=require(_0xc8b1('0x1'));var path=require(_0xc8b1('0x2'));var timeout=require('connect-timeout');var express=require(_0xc8b1('0x3'));var router=express[_0xc8b1('0x4')]();var fs_extra=require(_0xc8b1('0x5'));var auth=require(_0xc8b1('0x6'));var interaction=require(_0xc8b1('0x7'));var config=require(_0xc8b1('0x8'));var controller=require('./chatOfflineMessage.controller');router[_0xc8b1('0x9')]('/',auth['isAuthenticated'](),controller[_0xc8b1('0xa')]);router[_0xc8b1('0x9')](_0xc8b1('0xb'),auth[_0xc8b1('0xc')](),controller[_0xc8b1('0xd')]);router[_0xc8b1('0x9')]('/:id',auth[_0xc8b1('0xc')](),controller[_0xc8b1('0xe')]);router[_0xc8b1('0xf')]('/',auth[_0xc8b1('0xc')](),controller['create']);router[_0xc8b1('0x10')]('/:id',auth[_0xc8b1('0xc')](),controller[_0xc8b1('0x11')]);router[_0xc8b1('0x12')](_0xc8b1('0x13'),auth['isAuthenticated'](),controller[_0xc8b1('0x14')]);module[_0xc8b1('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 3fb5eba..065c0c9 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 _0x5144=['exports','STRING','mouseOver','timeout','INTEGER','sequelize'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x5144,0x12b));var _0x4514=function(_0x2cb3aa,_0x3e1442){_0x2cb3aa=_0x2cb3aa-0x0;var _0x7df597=_0x5144[_0x2cb3aa];return _0x7df597;};'use strict';var Sequelize=require(_0x4514('0x0'));module[_0x4514('0x1')]={'name':{'type':Sequelize[_0x4514('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4514('0x3'),_0x4514('0x4')),'defaultValue':_0x4514('0x3')},'selector':{'type':Sequelize[_0x4514('0x2')]},'timeout':{'type':Sequelize[_0x4514('0x5')]}}; \ No newline at end of file +var _0xb0ef=['timeout','mouseOver','sequelize','STRING','ENUM'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xb0ef,0x7f));var _0xfb0e=function(_0x631c4,_0x592943){_0x631c4=_0x631c4-0x0;var _0xa5ba19=_0xb0ef[_0x631c4];return _0xa5ba19;};'use strict';var Sequelize=require(_0xfb0e('0x0'));module['exports']={'name':{'type':Sequelize[_0xfb0e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xfb0e('0x2')]('mouseOver',_0xfb0e('0x3')),'defaultValue':_0xfb0e('0x4')},'selector':{'type':Sequelize[_0xfb0e('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 84e7e1f..33b3c7c 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 _0xaa7c=['find','catch','create','body','eml-format','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x5d1b9c,_0x242953){_0x5d1b9c=_0x5d1b9c-0x0;var _0x3b95e7=_0xaa7c[_0x5d1b9c];return _0x3b95e7;};'use strict';var emlformat=require(_0xcaa7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcaa7('0x1'));var BPromise=require(_0xcaa7('0x2'));var Mustache=require('mustache');var util=require(_0xcaa7('0x3'));var path=require(_0xcaa7('0x4'));var sox=require(_0xcaa7('0x5'));var csv=require(_0xcaa7('0x6'));var ejs=require(_0xcaa7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcaa7('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcaa7('0x9'));var deskjs=require(_0xcaa7('0xa'));var toCsv=require(_0xcaa7('0x6'));var querystring=require('querystring');var Papa=require(_0xcaa7('0xb'));var Redis=require(_0xcaa7('0xc'));var authService=require(_0xcaa7('0xd'));var qs=require(_0xcaa7('0xe'));var as=require(_0xcaa7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcaa7('0x10'))(_0xcaa7('0x11'));var utils=require(_0xcaa7('0x12'));var config=require(_0xcaa7('0x13'));var licenseUtil=require(_0xcaa7('0x14'));var db=require(_0xcaa7('0x15'))['db'];function respondWithStatusCode(_0x563f57,_0x24d3b0){_0x24d3b0=_0x24d3b0||0xcc;return function(_0x128cfb){if(_0x128cfb){return _0x563f57[_0xcaa7('0x16')](_0x24d3b0);}return _0x563f57[_0xcaa7('0x17')](_0x24d3b0)[_0xcaa7('0x18')]();};}function respondWithResult(_0x2eb4ff,_0x299490){_0x299490=_0x299490||0xc8;return function(_0x4a1d5a){if(_0x4a1d5a){return _0x2eb4ff['status'](_0x299490)[_0xcaa7('0x19')](_0x4a1d5a);}};}function respondWithFilteredResult(_0x1c1286,_0x1155fb){return function(_0x1b2c4f){if(_0x1b2c4f){var _0x49a218=typeof _0x1155fb[_0xcaa7('0x1a')]===_0xcaa7('0x1b')&&typeof _0x1155fb[_0xcaa7('0x1c')]===_0xcaa7('0x1b');var _0x46d9b4=_0x1b2c4f[_0xcaa7('0x1d')];var _0x20ede0=_0x49a218?0x0:_0x1155fb['offset'];var _0x53e1cb=_0x49a218?_0x1b2c4f[_0xcaa7('0x1d')]:_0x1155fb[_0xcaa7('0x1a')]+_0x1155fb[_0xcaa7('0x1c')];var _0x3bc53b;if(_0x53e1cb>=_0x46d9b4){_0x53e1cb=_0x46d9b4;_0x3bc53b=0xc8;}else{_0x3bc53b=0xce;}_0x1c1286[_0xcaa7('0x17')](_0x3bc53b);return _0x1c1286[_0xcaa7('0x1e')](_0xcaa7('0x1f'),_0x20ede0+'-'+_0x53e1cb+'/'+_0x46d9b4)['json'](_0x1b2c4f);}return null;};}function patchUpdates(_0x89e8a0){return function(_0x3650ac){try{jsonpatch[_0xcaa7('0x20')](_0x3650ac,_0x89e8a0,!![]);}catch(_0x11cbbf){return BPromise[_0xcaa7('0x21')](_0x11cbbf);}return _0x3650ac[_0xcaa7('0x22')]();};}function saveUpdates(_0x3119d5,_0x4259b7){return function(_0x2a9a79){if(_0x2a9a79){return _0x2a9a79[_0xcaa7('0x23')](_0x3119d5)[_0xcaa7('0x24')](function(_0x140c5a){return _0x140c5a;});}return null;};}function removeEntity(_0x24a18c,_0x56ee3a){return function(_0x97a507){if(_0x97a507){return _0x97a507[_0xcaa7('0x25')]()['then'](function(){_0x24a18c[_0xcaa7('0x17')](0xcc)[_0xcaa7('0x18')]();});}};}function handleEntityNotFound(_0x146e6f,_0x10b638){return function(_0x58384f){if(!_0x58384f){_0x146e6f['sendStatus'](0x194);}return _0x58384f;};}function handleError(_0x3c0b15,_0x3e1f78){_0x3e1f78=_0x3e1f78||0x1f4;return function(_0x3369f2){logger[_0xcaa7('0x26')](_0x3369f2[_0xcaa7('0x27')]);if(_0x3369f2['name']){delete _0x3369f2[_0xcaa7('0x28')];}_0x3c0b15['status'](_0x3e1f78)['send'](_0x3369f2);};}exports[_0xcaa7('0x29')]=function(_0x492362,_0x34a30d){var _0x623f17={'raw':!![],'where':{'id':_0x492362[_0xcaa7('0x2a')]['id']}},_0x748bda={};_0x748bda[_0xcaa7('0x2b')]=_[_0xcaa7('0x2c')](db[_0xcaa7('0x2d')][_0xcaa7('0x2e')]);_0x748bda['query']=_[_0xcaa7('0x2c')](_0x492362[_0xcaa7('0x2f')]);_0x748bda[_0xcaa7('0x30')]=_[_0xcaa7('0x31')](_0x748bda[_0xcaa7('0x2b')],_0x748bda['query']);_0x623f17[_0xcaa7('0x32')]=_[_0xcaa7('0x31')](_0x748bda[_0xcaa7('0x2b')],qs[_0xcaa7('0x33')](_0x492362[_0xcaa7('0x2f')]['fields']));_0x623f17[_0xcaa7('0x32')]=_0x623f17['attributes'][_0xcaa7('0x34')]?_0x623f17[_0xcaa7('0x32')]:_0x748bda[_0xcaa7('0x2b')];if(_0x492362['query'][_0xcaa7('0x35')]){_0x623f17[_0xcaa7('0x36')]=[{'all':!![]}];}_0x623f17=_[_0xcaa7('0x37')]({},_0x623f17,_0x492362[_0xcaa7('0x38')]);return db[_0xcaa7('0x2d')][_0xcaa7('0x39')](_0x623f17)['then'](handleEntityNotFound(_0x34a30d,null))[_0xcaa7('0x24')](respondWithResult(_0x34a30d,null))[_0xcaa7('0x3a')](handleError(_0x34a30d,null));};exports['create']=function(_0x455f6e,_0x43b8de){return db[_0xcaa7('0x2d')][_0xcaa7('0x3b')](_0x455f6e['body'],{})[_0xcaa7('0x24')](respondWithResult(_0x43b8de,0xc9))[_0xcaa7('0x3a')](handleError(_0x43b8de,null));};exports[_0xcaa7('0x23')]=function(_0x25bc49,_0x321e12){if(_0x25bc49[_0xcaa7('0x3c')]['id']){delete _0x25bc49[_0xcaa7('0x3c')]['id'];}return db[_0xcaa7('0x2d')][_0xcaa7('0x39')]({'where':{'id':_0x25bc49[_0xcaa7('0x2a')]['id']}})[_0xcaa7('0x24')](handleEntityNotFound(_0x321e12,null))[_0xcaa7('0x24')](saveUpdates(_0x25bc49['body'],null))[_0xcaa7('0x24')](respondWithResult(_0x321e12,null))[_0xcaa7('0x3a')](handleError(_0x321e12,null));};exports[_0xcaa7('0x25')]=function(_0x2e4262,_0x5f1028){return db['ChatProactiveAction'][_0xcaa7('0x39')]({'where':{'id':_0x2e4262[_0xcaa7('0x2a')]['id']}})[_0xcaa7('0x24')](handleEntityNotFound(_0x5f1028,null))['then'](removeEntity(_0x5f1028,null))[_0xcaa7('0x3a')](handleError(_0x5f1028,null));}; \ No newline at end of file +var _0x9a6b=['find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','apply','reject','update','destroy','error','stack','name','send','params','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','then','create','body','catch'];(function(_0x2f0b82,_0xa07e26){var _0x5d6fb1=function(_0x178f3f){while(--_0x178f3f){_0x2f0b82['push'](_0x2f0b82['shift']());}};_0x5d6fb1(++_0xa07e26);}(_0x9a6b,0x77));var _0xb9a6=function(_0x27ff4e,_0xf0b05a){_0x27ff4e=_0x27ff4e-0x0;var _0xfe567d=_0x9a6b[_0x27ff4e];return _0xfe567d;};'use strict';var emlformat=require(_0xb9a6('0x0'));var rimraf=require(_0xb9a6('0x1'));var zipdir=require(_0xb9a6('0x2'));var jsonpatch=require(_0xb9a6('0x3'));var rp=require(_0xb9a6('0x4'));var moment=require(_0xb9a6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb9a6('0x6'));var util=require('util');var path=require(_0xb9a6('0x7'));var sox=require(_0xb9a6('0x8'));var csv=require(_0xb9a6('0x9'));var ejs=require(_0xb9a6('0xa'));var fs=require('fs');var fs_extra=require(_0xb9a6('0xb'));var _=require(_0xb9a6('0xc'));var squel=require(_0xb9a6('0xd'));var crypto=require(_0xb9a6('0xe'));var jsforce=require(_0xb9a6('0xf'));var deskjs=require(_0xb9a6('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb9a6('0x11'));var Papa=require(_0xb9a6('0x12'));var Redis=require('ioredis');var authService=require(_0xb9a6('0x13'));var qs=require(_0xb9a6('0x14'));var as=require(_0xb9a6('0x15'));var hardwareService=require(_0xb9a6('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb9a6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb9a6('0x18'))['db'];function respondWithStatusCode(_0x57b620,_0x3f4ce1){_0x3f4ce1=_0x3f4ce1||0xcc;return function(_0x21a637){if(_0x21a637){return _0x57b620[_0xb9a6('0x19')](_0x3f4ce1);}return _0x57b620[_0xb9a6('0x1a')](_0x3f4ce1)[_0xb9a6('0x1b')]();};}function respondWithResult(_0x6cbcc4,_0x3e140e){_0x3e140e=_0x3e140e||0xc8;return function(_0x158d6c){if(_0x158d6c){return _0x6cbcc4[_0xb9a6('0x1a')](_0x3e140e)['json'](_0x158d6c);}};}function respondWithFilteredResult(_0x463f33,_0x136d5d){return function(_0x414f37){if(_0x414f37){var _0x3342d2=typeof _0x136d5d['offset']===_0xb9a6('0x1c')&&typeof _0x136d5d[_0xb9a6('0x1d')]===_0xb9a6('0x1c');var _0x5b3395=_0x414f37[_0xb9a6('0x1e')];var _0x3b9a3b=_0x3342d2?0x0:_0x136d5d[_0xb9a6('0x1f')];var _0x1843e2=_0x3342d2?_0x414f37[_0xb9a6('0x1e')]:_0x136d5d['offset']+_0x136d5d[_0xb9a6('0x1d')];var _0x28e01a;if(_0x1843e2>=_0x5b3395){_0x1843e2=_0x5b3395;_0x28e01a=0xc8;}else{_0x28e01a=0xce;}_0x463f33[_0xb9a6('0x1a')](_0x28e01a);return _0x463f33[_0xb9a6('0x20')]('Content-Range',_0x3b9a3b+'-'+_0x1843e2+'/'+_0x5b3395)['json'](_0x414f37);}return null;};}function patchUpdates(_0x1cb89e){return function(_0x449b39){try{jsonpatch[_0xb9a6('0x21')](_0x449b39,_0x1cb89e,!![]);}catch(_0x49c74b){return BPromise[_0xb9a6('0x22')](_0x49c74b);}return _0x449b39['save']();};}function saveUpdates(_0xc15e48,_0x36c6c1){return function(_0x50d3d4){if(_0x50d3d4){return _0x50d3d4[_0xb9a6('0x23')](_0xc15e48)['then'](function(_0x526721){return _0x526721;});}return null;};}function removeEntity(_0x3bc642,_0x1b838a){return function(_0x73dee3){if(_0x73dee3){return _0x73dee3[_0xb9a6('0x24')]()['then'](function(){_0x3bc642[_0xb9a6('0x1a')](0xcc)[_0xb9a6('0x1b')]();});}};}function handleEntityNotFound(_0x373f62,_0x1d36e3){return function(_0x4b0be8){if(!_0x4b0be8){_0x373f62[_0xb9a6('0x19')](0x194);}return _0x4b0be8;};}function handleError(_0x3896c1,_0x3ebdcd){_0x3ebdcd=_0x3ebdcd||0x1f4;return function(_0x427890){logger[_0xb9a6('0x25')](_0x427890[_0xb9a6('0x26')]);if(_0x427890[_0xb9a6('0x27')]){delete _0x427890['name'];}_0x3896c1[_0xb9a6('0x1a')](_0x3ebdcd)[_0xb9a6('0x28')](_0x427890);};}exports['show']=function(_0x429830,_0x4c2abb){var _0x1fdb38={'raw':!![],'where':{'id':_0x429830[_0xb9a6('0x29')]['id']}},_0x5d75ce={};_0x5d75ce[_0xb9a6('0x2a')]=_['keys'](db[_0xb9a6('0x2b')][_0xb9a6('0x2c')]);_0x5d75ce[_0xb9a6('0x2d')]=_[_0xb9a6('0x2e')](_0x429830[_0xb9a6('0x2d')]);_0x5d75ce[_0xb9a6('0x2f')]=_[_0xb9a6('0x30')](_0x5d75ce['model'],_0x5d75ce[_0xb9a6('0x2d')]);_0x1fdb38[_0xb9a6('0x31')]=_[_0xb9a6('0x30')](_0x5d75ce[_0xb9a6('0x2a')],qs['fields'](_0x429830[_0xb9a6('0x2d')][_0xb9a6('0x32')]));_0x1fdb38['attributes']=_0x1fdb38[_0xb9a6('0x31')][_0xb9a6('0x33')]?_0x1fdb38[_0xb9a6('0x31')]:_0x5d75ce[_0xb9a6('0x2a')];if(_0x429830[_0xb9a6('0x2d')][_0xb9a6('0x34')]){_0x1fdb38[_0xb9a6('0x35')]=[{'all':!![]}];}_0x1fdb38=_['merge']({},_0x1fdb38,_0x429830['options']);return db['ChatProactiveAction']['find'](_0x1fdb38)['then'](handleEntityNotFound(_0x4c2abb,null))[_0xb9a6('0x36')](respondWithResult(_0x4c2abb,null))['catch'](handleError(_0x4c2abb,null));};exports[_0xb9a6('0x37')]=function(_0x56945d,_0x287329){return db[_0xb9a6('0x2b')][_0xb9a6('0x37')](_0x56945d[_0xb9a6('0x38')],{})[_0xb9a6('0x36')](respondWithResult(_0x287329,0xc9))[_0xb9a6('0x39')](handleError(_0x287329,null));};exports[_0xb9a6('0x23')]=function(_0xc96b8,_0x1e2835){if(_0xc96b8[_0xb9a6('0x38')]['id']){delete _0xc96b8[_0xb9a6('0x38')]['id'];}return db[_0xb9a6('0x2b')][_0xb9a6('0x3a')]({'where':{'id':_0xc96b8[_0xb9a6('0x29')]['id']}})[_0xb9a6('0x36')](handleEntityNotFound(_0x1e2835,null))[_0xb9a6('0x36')](saveUpdates(_0xc96b8[_0xb9a6('0x38')],null))['then'](respondWithResult(_0x1e2835,null))[_0xb9a6('0x39')](handleError(_0x1e2835,null));};exports[_0xb9a6('0x24')]=function(_0xdc704f,_0x5a8bf2){return db[_0xb9a6('0x2b')][_0xb9a6('0x3a')]({'where':{'id':_0xdc704f[_0xb9a6('0x29')]['id']}})[_0xb9a6('0x36')](handleEntityNotFound(_0x5a8bf2,null))[_0xb9a6('0x36')](removeEntity(_0x5a8bf2,null))[_0xb9a6('0x39')](handleError(_0x5a8bf2,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 25085a8..08f0bd6 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 _0x8a90=['ChatProactiveAction','chat_proactive_actions','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x3c26e8,_0x2c3478){var _0x26d412=function(_0xf4d7ca){while(--_0xf4d7ca){_0x3c26e8['push'](_0x3c26e8['shift']());}};_0x26d412(++_0x2c3478);}(_0x8a90,0x1a2));var _0x08a9=function(_0x5218c0,_0x2591df){_0x5218c0=_0x5218c0-0x0;var _0xc5dba=_0x8a90[_0x5218c0];return _0xc5dba;};'use strict';var _=require('lodash');var util=require(_0x08a9('0x0'));var logger=require('../../config/logger')(_0x08a9('0x1'));var moment=require(_0x08a9('0x2'));var BPromise=require(_0x08a9('0x3'));var rp=require(_0x08a9('0x4'));var fs=require('fs');var path=require(_0x08a9('0x5'));var rimraf=require(_0x08a9('0x6'));var config=require(_0x08a9('0x7'));var attributes=require(_0x08a9('0x8'));module[_0x08a9('0x9')]=function(_0x9733e9,_0x17d9b4){return _0x9733e9[_0x08a9('0xa')](_0x08a9('0xb'),attributes,{'tableName':_0x08a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea9e=['request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','util','../../config/logger','moment','bluebird'];(function(_0x1366fd,_0x193698){var _0x4b2c7c=function(_0x1eb56b){while(--_0x1eb56b){_0x1366fd['push'](_0x1366fd['shift']());}};_0x4b2c7c(++_0x193698);}(_0xea9e,0x151));var _0xeea9=function(_0x2d8bfc,_0x2be61d){_0x2d8bfc=_0x2d8bfc-0x0;var _0x1f68b8=_0xea9e[_0x2d8bfc];return _0x1f68b8;};'use strict';var _=require('lodash');var util=require(_0xeea9('0x0'));var logger=require(_0xeea9('0x1'))('api');var moment=require(_0xeea9('0x2'));var BPromise=require(_0xeea9('0x3'));var rp=require(_0xeea9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeea9('0x5'));var config=require(_0xeea9('0x6'));var attributes=require(_0xeea9('0x7'));module[_0xeea9('0x8')]=function(_0xb8ea86,_0x3db553){return _0xb8ea86[_0xeea9('0x9')]('ChatProactiveAction',attributes,{'tableName':_0xeea9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 5b22066..73060be 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 _0x708b=['error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x171e04,_0x37a737){var _0x17ca0f=function(_0x1a6327){while(--_0x1a6327){_0x171e04['push'](_0x171e04['shift']());}};_0x17ca0f(++_0x37a737);}(_0x708b,0xa6));var _0xb708=function(_0xe231ae,_0x4cc8c0){_0xe231ae=_0xe231ae-0x0;var _0x216dc9=_0x708b[_0xe231ae];return _0x216dc9;};'use strict';var _=require(_0xb708('0x0'));var util=require('util');var moment=require(_0xb708('0x1'));var BPromise=require(_0xb708('0x2'));var rs=require(_0xb708('0x3'));var fs=require('fs');var Redis=require(_0xb708('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb708('0x5'));var logger=require(_0xb708('0x6'))('rpc');var config=require(_0xb708('0x7'));var jayson=require(_0xb708('0x8'));var client=jayson[_0xb708('0x9')][_0xb708('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35fd0c,_0x10ddcd,_0x384854){return new BPromise(function(_0x4d4fdc,_0x1e0d3b){return client[_0xb708('0xb')](_0x35fd0c,_0x384854)['then'](function(_0x5670d3){logger['info'](_0xb708('0xc'),_0x10ddcd,_0xb708('0xd'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x10ddcd,_0xb708('0xd'),JSON['stringify'](_0x5670d3));if(_0x5670d3['error']){if(_0x5670d3[_0xb708('0xe')][_0xb708('0xf')]===0x1f4){logger[_0xb708('0xe')](_0xb708('0xc'),_0x10ddcd,_0x5670d3[_0xb708('0xe')][_0xb708('0x10')]);return _0x1e0d3b(_0x5670d3[_0xb708('0xe')]['message']);}logger[_0xb708('0xe')](_0xb708('0xc'),_0x10ddcd,_0x5670d3[_0xb708('0xe')]['message']);return _0x4d4fdc(_0x5670d3['error'][_0xb708('0x10')]);}else{logger['info'](_0xb708('0xc'),_0x10ddcd,'request\x20sent');_0x4d4fdc(_0x5670d3['result']['message']);}})[_0xb708('0x11')](function(_0x1ac715){logger[_0xb708('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x10ddcd,_0x1ac715);_0x1e0d3b(_0x1ac715);});});} \ No newline at end of file +var _0x8750=['message','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8750,0x14c));var _0x0875=function(_0x50cdae,_0x160da3){_0x50cdae=_0x50cdae-0x0;var _0x195454=_0x8750[_0x50cdae];return _0x195454;};'use strict';var _=require(_0x0875('0x0'));var util=require('util');var moment=require(_0x0875('0x1'));var BPromise=require(_0x0875('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0875('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0875('0x4'));var logger=require(_0x0875('0x5'))(_0x0875('0x6'));var config=require(_0x0875('0x7'));var jayson=require(_0x0875('0x8'));var client=jayson[_0x0875('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x562cb8,_0x2bbaba,_0x3ae6c7){return new BPromise(function(_0x3fcd20,_0x30f229){return client[_0x0875('0xa')](_0x562cb8,_0x3ae6c7)[_0x0875('0xb')](function(_0xf126d3){logger[_0x0875('0xc')](_0x0875('0xd'),_0x2bbaba,_0x0875('0xe'));logger[_0x0875('0xf')](_0x0875('0x10'),_0x2bbaba,'request\x20sent',JSON[_0x0875('0x11')](_0xf126d3));if(_0xf126d3[_0x0875('0x12')]){if(_0xf126d3[_0x0875('0x12')][_0x0875('0x13')]===0x1f4){logger[_0x0875('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x2bbaba,_0xf126d3['error']['message']);return _0x30f229(_0xf126d3[_0x0875('0x12')][_0x0875('0x14')]);}logger[_0x0875('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x2bbaba,_0xf126d3[_0x0875('0x12')]['message']);return _0x3fcd20(_0xf126d3['error'][_0x0875('0x14')]);}else{logger[_0x0875('0xc')](_0x0875('0xd'),_0x2bbaba,'request\x20sent');_0x3fcd20(_0xf126d3[_0x0875('0x15')][_0x0875('0x14')]);}})['catch'](function(_0x371ee5){logger[_0x0875('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x2bbaba,_0x371ee5);_0x30f229(_0x371ee5);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index f9cd86c..cb2ab96 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(_0x293954,_0xd94ca4){var _0x5cea29=function(_0x12b251){while(--_0x12b251){_0x293954['push'](_0x293954['shift']());}};_0x5cea29(++_0xd94ca4);}(_0xeda8,0x104));var _0x8eda=function(_0xf6b530,_0x5c1d3c){_0xf6b530=_0xf6b530-0x0;var _0x3e38a1=_0xeda8[_0xf6b530];return _0x3e38a1;};'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 _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xabce,0x103));var _0xeabc=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xabce[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 856ef8a..a67d5ac 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 _0x6c86=['exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x558be8,_0x105e9a){var _0xe82f86=function(_0x37d240){while(--_0x37d240){_0x558be8['push'](_0x558be8['shift']());}};_0xe82f86(++_0x105e9a);}(_0x6c86,0x15f));var _0x66c8=function(_0x4aeb7a,_0x34b7ea){_0x4aeb7a=_0x4aeb7a-0x0;var _0x5df071=_0x6c86[_0x4aeb7a];return _0x5df071;};'use strict';var Sequelize=require(_0x66c8('0x0'));module[_0x66c8('0x1')]={'name':{'type':Sequelize[_0x66c8('0x2')],'unique':_0x66c8('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x66c8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x66c8('0x5')](_0x66c8('0x6'),'beepall',_0x66c8('0x7'))}}; \ No newline at end of file +var _0xc11a=['beepall','roundrobin','sequelize','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x442dcb,_0x179c35){var _0x593554=function(_0x244b57){while(--_0x244b57){_0x442dcb['push'](_0x442dcb['shift']());}};_0x593554(++_0x179c35);}(_0xc11a,0x11a));var _0xac11=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc11a[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xac11('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xac11('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xac11('0x2')]},'timeout':{'type':Sequelize[_0xac11('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xac11('0x4')](_0xac11('0x5'),_0xac11('0x6'),_0xac11('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index dbcdd0c..634bcc7 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 _0x7328=['includes','compact','value','removeTeams','isEmpty','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','ChatQueues','UserProfileResource','destroy','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','type','filter','merge','include','ChatQueue','findAll','rows','params','keys','intersection','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','order','ChatQueueId','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','getTeams','nolimit','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','Team','select','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every'];(function(_0xaf34bc,_0xb3d3ce){var _0x318c36=function(_0x3073b4){while(--_0x3073b4){_0xaf34bc['push'](_0xaf34bc['shift']());}};_0x318c36(++_0xb3d3ce);}(_0x7328,0xa5));var _0x8732=function(_0x44d132,_0x542053){_0x44d132=_0x44d132-0x0;var _0x13e1b7=_0x7328[_0x44d132];return _0x13e1b7;};'use strict';var emlformat=require(_0x8732('0x0'));var rimraf=require(_0x8732('0x1'));var zipdir=require(_0x8732('0x2'));var jsonpatch=require(_0x8732('0x3'));var rp=require(_0x8732('0x4'));var moment=require(_0x8732('0x5'));var BPromise=require(_0x8732('0x6'));var Mustache=require('mustache');var util=require(_0x8732('0x7'));var path=require(_0x8732('0x8'));var sox=require('sox');var csv=require(_0x8732('0x9'));var ejs=require(_0x8732('0xa'));var fs=require('fs');var fs_extra=require(_0x8732('0xb'));var _=require(_0x8732('0xc'));var squel=require(_0x8732('0xd'));var crypto=require(_0x8732('0xe'));var jsforce=require(_0x8732('0xf'));var deskjs=require(_0x8732('0x10'));var toCsv=require(_0x8732('0x9'));var querystring=require(_0x8732('0x11'));var Papa=require(_0x8732('0x12'));var Redis=require(_0x8732('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8732('0x14'));var as=require(_0x8732('0x15'));var hardwareService=require(_0x8732('0x16'));var logger=require(_0x8732('0x17'))(_0x8732('0x18'));var utils=require('../../config/utils');var config=require(_0x8732('0x19'));var licenseUtil=require(_0x8732('0x1a'));var db=require(_0x8732('0x1b'))['db'];config['redis']=_[_0x8732('0x1c')](config[_0x8732('0x1d')],{'host':_0x8732('0x1e'),'port':0x18eb});var socket=require(_0x8732('0x1f'))(new Redis(config['redis']));require(_0x8732('0x20'))[_0x8732('0x21')](socket);var jayson=require(_0x8732('0x22'));var client=jayson[_0x8732('0x23')][_0x8732('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x28a32e,_0x245208,_0x1642fd,_0x5a1563){return new BPromise(function(_0x57b09a,_0x41c440){var _0x343f97=_0x5a1563||client;return _0x343f97[_0x8732('0x25')](_0x28a32e,_0x1642fd)['then'](function(_0x5d3592){logger[_0x8732('0x26')]('ChatQueue,\x20%s,\x20%s',_0x245208,_0x8732('0x27'));logger[_0x8732('0x28')](_0x8732('0x29'),_0x245208,_0x8732('0x27'),JSON[_0x8732('0x2a')](_0x5d3592));if(_0x5d3592[_0x8732('0x2b')]){if(_0x5d3592['error']['code']===0x1f4){logger['error'](_0x8732('0x2c'),_0x245208,_0x5d3592['error'][_0x8732('0x2d')]);return _0x41c440(_0x5d3592[_0x8732('0x2b')][_0x8732('0x2d')]);}logger[_0x8732('0x2b')](_0x8732('0x2c'),_0x245208,_0x5d3592[_0x8732('0x2b')][_0x8732('0x2d')]);return _0x57b09a(_0x5d3592[_0x8732('0x2b')][_0x8732('0x2d')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x245208,_0x8732('0x27'));_0x57b09a(_0x5d3592[_0x8732('0x2e')][_0x8732('0x2d')]);}})[_0x8732('0x2f')](function(_0x3d5fe9){logger[_0x8732('0x2b')](_0x8732('0x2c'),_0x245208,_0x3d5fe9);_0x41c440(_0x3d5fe9);});});}function respondWithStatusCode(_0x271a55,_0xcd6b75){_0xcd6b75=_0xcd6b75||0xcc;return function(_0x910ecd){if(_0x910ecd){return _0x271a55[_0x8732('0x30')](_0xcd6b75);}return _0x271a55['status'](_0xcd6b75)[_0x8732('0x31')]();};}function respondWithResult(_0x3edbde,_0x4b3be0){_0x4b3be0=_0x4b3be0||0xc8;return function(_0x1d5ffe){if(_0x1d5ffe){return _0x3edbde[_0x8732('0x32')](_0x4b3be0)['json'](_0x1d5ffe);}};}function respondWithFilteredResult(_0x17d9b2,_0x5e3d19){return function(_0xba1c28){if(_0xba1c28){var _0x3315ba=typeof _0x5e3d19[_0x8732('0x33')]==='undefined'&&typeof _0x5e3d19[_0x8732('0x34')]===_0x8732('0x35');var _0x359a8e=_0xba1c28['count'];var _0x13cfb8=_0x3315ba?0x0:_0x5e3d19['offset'];var _0x2bec53=_0x3315ba?_0xba1c28[_0x8732('0x36')]:_0x5e3d19[_0x8732('0x33')]+_0x5e3d19[_0x8732('0x34')];var _0x5d11b0;if(_0x2bec53>=_0x359a8e){_0x2bec53=_0x359a8e;_0x5d11b0=0xc8;}else{_0x5d11b0=0xce;}_0x17d9b2[_0x8732('0x32')](_0x5d11b0);return _0x17d9b2[_0x8732('0x37')](_0x8732('0x38'),_0x13cfb8+'-'+_0x2bec53+'/'+_0x359a8e)[_0x8732('0x39')](_0xba1c28);}return null;};}function patchUpdates(_0x19579f){return function(_0x3c3eb9){try{jsonpatch[_0x8732('0x3a')](_0x3c3eb9,_0x19579f,!![]);}catch(_0x2d6404){return BPromise[_0x8732('0x3b')](_0x2d6404);}return _0x3c3eb9[_0x8732('0x3c')]();};}function saveUpdates(_0x4b354f,_0x490e35){return function(_0xf1e715){if(_0xf1e715){return _0xf1e715[_0x8732('0x3d')](_0x4b354f)[_0x8732('0x3e')](function(_0x442b3d){return _0x442b3d;});}return null;};}function removeEntity(_0x52d90d,_0x4d0247){return function(_0x3185f1){if(_0x3185f1){return _0x3185f1['destroy']()['then'](function(){var _0x23d796=_0x3185f1['get']({'plain':!![]});var _0x3343ef=_0x8732('0x3f');return db[_0x8732('0x40')][_0x8732('0x41')]({'where':{'type':_0x3343ef,'resourceId':_0x23d796['id']}})[_0x8732('0x3e')](function(){return _0x3185f1;});})[_0x8732('0x3e')](function(){_0x52d90d[_0x8732('0x32')](0xcc)[_0x8732('0x31')]();});}};}function handleEntityNotFound(_0x5039c4,_0x3cca8d){return function(_0x53d363){if(!_0x53d363){_0x5039c4[_0x8732('0x30')](0x194);}return _0x53d363;};}function handleError(_0x263fd2,_0x26712f){_0x26712f=_0x26712f||0x1f4;return function(_0x90bc37){logger[_0x8732('0x2b')](_0x90bc37[_0x8732('0x42')]);if(_0x90bc37[_0x8732('0x43')]){delete _0x90bc37[_0x8732('0x43')];}_0x263fd2[_0x8732('0x32')](_0x26712f)['send'](_0x90bc37);};}exports[_0x8732('0x44')]=function(_0x561fb3,_0x2f20bc){var _0x511e25={},_0x5a7d7c={},_0x5e5ab5={'count':0x0,'rows':[]};var _0x4ad0c2=_[_0x8732('0x45')](db['ChatQueue'][_0x8732('0x46')],function(_0x124119){return{'name':_0x124119[_0x8732('0x47')],'type':_0x124119['type'][_0x8732('0x48')]};});_0x5a7d7c[_0x8732('0x49')]=_[_0x8732('0x45')](_0x4ad0c2,_0x8732('0x43'));_0x5a7d7c[_0x8732('0x4a')]=_['keys'](_0x561fb3[_0x8732('0x4a')]);_0x5a7d7c[_0x8732('0x4b')]=_['intersection'](_0x5a7d7c['model'],_0x5a7d7c[_0x8732('0x4a')]);_0x511e25[_0x8732('0x4c')]=_['intersection'](_0x5a7d7c[_0x8732('0x49')],qs[_0x8732('0x4d')](_0x561fb3[_0x8732('0x4a')]['fields']));_0x511e25[_0x8732('0x4c')]=_0x511e25[_0x8732('0x4c')][_0x8732('0x4e')]?_0x511e25[_0x8732('0x4c')]:_0x5a7d7c[_0x8732('0x49')];if(!_0x561fb3[_0x8732('0x4a')][_0x8732('0x4f')]('nolimit')){_0x511e25['limit']=qs[_0x8732('0x34')](_0x561fb3[_0x8732('0x4a')][_0x8732('0x34')]);_0x511e25['offset']=qs[_0x8732('0x33')](_0x561fb3[_0x8732('0x4a')][_0x8732('0x33')]);}_0x511e25['order']=qs[_0x8732('0x50')](_0x561fb3[_0x8732('0x4a')][_0x8732('0x50')]);_0x511e25[_0x8732('0x51')]=qs[_0x8732('0x4b')](_[_0x8732('0x52')](_0x561fb3[_0x8732('0x4a')],_0x5a7d7c[_0x8732('0x4b')]),_0x4ad0c2);if(_0x561fb3[_0x8732('0x4a')]['filter']){_0x511e25[_0x8732('0x51')]=_['merge'](_0x511e25[_0x8732('0x51')],{'$or':_['map'](_0x4ad0c2,function(_0x4985f6){if(_0x4985f6[_0x8732('0x53')]!=='VIRTUAL'){var _0x538fc4={};_0x538fc4[_0x4985f6[_0x8732('0x43')]]={'$like':'%'+_0x561fb3[_0x8732('0x4a')][_0x8732('0x54')]+'%'};return _0x538fc4;}})});}_0x511e25=_[_0x8732('0x55')]({},_0x511e25,_0x561fb3['options']);var _0xf868d={'where':_0x511e25[_0x8732('0x51')]};return db['ChatQueue'][_0x8732('0x36')](_0xf868d)[_0x8732('0x3e')](function(_0x3a4f92){_0x5e5ab5['count']=_0x3a4f92;if(_0x561fb3['query']['includeAll']){_0x511e25[_0x8732('0x56')]=[{'all':!![]}];}return db[_0x8732('0x57')][_0x8732('0x58')](_0x511e25);})['then'](function(_0x30e19f){_0x5e5ab5[_0x8732('0x59')]=_0x30e19f;return _0x5e5ab5;})[_0x8732('0x3e')](respondWithFilteredResult(_0x2f20bc,_0x511e25))[_0x8732('0x2f')](handleError(_0x2f20bc,null));};exports['show']=function(_0x4d6879,_0x1a3497){var _0x5ab82a={'raw':!![],'where':{'id':_0x4d6879[_0x8732('0x5a')]['id']}},_0x262580={};_0x262580['model']=_[_0x8732('0x5b')](db[_0x8732('0x57')][_0x8732('0x46')]);_0x262580[_0x8732('0x4a')]=_[_0x8732('0x5b')](_0x4d6879['query']);_0x262580[_0x8732('0x4b')]=_['intersection'](_0x262580[_0x8732('0x49')],_0x262580[_0x8732('0x4a')]);_0x5ab82a[_0x8732('0x4c')]=_[_0x8732('0x5c')](_0x262580[_0x8732('0x49')],qs[_0x8732('0x4d')](_0x4d6879[_0x8732('0x4a')][_0x8732('0x4d')]));_0x5ab82a[_0x8732('0x4c')]=_0x5ab82a['attributes'][_0x8732('0x4e')]?_0x5ab82a['attributes']:_0x262580['model'];if(_0x4d6879[_0x8732('0x4a')]['includeAll']){_0x5ab82a['include']=[{'all':!![]}];}_0x5ab82a=_[_0x8732('0x55')]({},_0x5ab82a,_0x4d6879[_0x8732('0x5d')]);return db[_0x8732('0x57')]['find'](_0x5ab82a)['then'](handleEntityNotFound(_0x1a3497,null))['then'](respondWithResult(_0x1a3497,null))['catch'](handleError(_0x1a3497,null));};exports[_0x8732('0x5e')]=function(_0x2bd11a,_0x3d22d5){return db['ChatQueue'][_0x8732('0x5e')](_0x2bd11a[_0x8732('0x5f')],{})[_0x8732('0x3e')](function(_0x23a1a7){var _0x45276e=_0x2bd11a[_0x8732('0x60')][_0x8732('0x61')]({'plain':!![]});if(!_0x45276e)throw new Error(_0x8732('0x62'));if(_0x45276e[_0x8732('0x63')]===_0x8732('0x60')){var _0x339e76=_0x23a1a7[_0x8732('0x61')]({'plain':!![]});var _0x62b9b3=_0x8732('0x3f');return db[_0x8732('0x64')][_0x8732('0x65')]({'where':{'name':_0x62b9b3,'userProfileId':_0x45276e[_0x8732('0x66')]},'raw':!![]})[_0x8732('0x3e')](function(_0xb1bce4){if(_0xb1bce4&&_0xb1bce4[_0x8732('0x67')]===0x0){return db[_0x8732('0x40')][_0x8732('0x5e')]({'name':_0x339e76[_0x8732('0x43')],'resourceId':_0x339e76['id'],'type':_0xb1bce4[_0x8732('0x43')],'sectionId':_0xb1bce4['id']},{})[_0x8732('0x3e')](function(){return _0x23a1a7;});}else{return _0x23a1a7;}})[_0x8732('0x2f')](function(_0x4d652c){logger[_0x8732('0x2b')](_0x8732('0x68'),_0x4d652c);throw _0x4d652c;});}return _0x23a1a7;})['then'](respondWithResult(_0x3d22d5,0xc9))[_0x8732('0x2f')](handleError(_0x3d22d5,null));};exports[_0x8732('0x3d')]=function(_0x933873,_0x567ed0){if(_0x933873[_0x8732('0x5f')]['id']){delete _0x933873[_0x8732('0x5f')]['id'];}return db[_0x8732('0x57')]['find']({'where':{'id':_0x933873[_0x8732('0x5a')]['id']}})[_0x8732('0x3e')](handleEntityNotFound(_0x567ed0,null))[_0x8732('0x3e')](saveUpdates(_0x933873[_0x8732('0x5f')],null))['then'](respondWithResult(_0x567ed0,null))['catch'](handleError(_0x567ed0,null));};exports[_0x8732('0x41')]=function(_0x242b2f,_0x57087a){return db[_0x8732('0x57')][_0x8732('0x65')]({'where':{'id':_0x242b2f[_0x8732('0x5a')]['id']}})[_0x8732('0x3e')](handleEntityNotFound(_0x57087a,null))[_0x8732('0x3e')](removeEntity(_0x57087a,null))[_0x8732('0x2f')](handleError(_0x57087a,null));};exports[_0x8732('0x69')]=function(_0x3a1c8b,_0x362549){return db['ChatQueue'][_0x8732('0x69')]()['then'](respondWithResult(_0x362549,null))[_0x8732('0x2f')](handleError(_0x362549,null));};exports[_0x8732('0x6a')]=function(_0x122f2e,_0x1892c4,_0x48aee6){var _0x307c0d={'raw':!![],'where':{}},_0x16c65d={},_0x2c984d;return db['ChatQueue'][_0x8732('0x6b')]({'where':{'id':_0x122f2e['params']['id']}})[_0x8732('0x3e')](handleEntityNotFound(_0x1892c4,null))[_0x8732('0x3e')](function(_0x13e0a7){if(_0x13e0a7){_0x2c984d=_0x13e0a7[_0x8732('0x61')]({'plain':!![]});_0x16c65d[_0x8732('0x49')]=_[_0x8732('0x5b')](db[_0x8732('0x6c')][_0x8732('0x46')]);_0x16c65d['query']=_[_0x8732('0x5b')](_0x122f2e['query']);_0x16c65d['filters']=_['intersection'](_0x16c65d[_0x8732('0x49')],_0x16c65d['query']);_0x307c0d[_0x8732('0x4c')]=_[_0x8732('0x5c')](_0x16c65d['model'],qs[_0x8732('0x4d')](_0x122f2e[_0x8732('0x4a')][_0x8732('0x4d')]));_0x307c0d[_0x8732('0x4c')]=_0x307c0d['attributes']['length']?_0x307c0d['attributes']:_0x16c65d[_0x8732('0x49')];if(!_0x122f2e['query'][_0x8732('0x4f')]('nolimit')){_0x307c0d[_0x8732('0x34')]=qs['limit'](_0x122f2e['query'][_0x8732('0x34')]);_0x307c0d[_0x8732('0x33')]=qs[_0x8732('0x33')](_0x122f2e[_0x8732('0x4a')][_0x8732('0x33')]);}_0x307c0d[_0x8732('0x6d')]=qs[_0x8732('0x50')](_0x122f2e[_0x8732('0x4a')][_0x8732('0x50')]);_0x307c0d[_0x8732('0x51')]=qs[_0x8732('0x4b')](_['pick'](_0x122f2e[_0x8732('0x4a')],_0x16c65d[_0x8732('0x4b')]));_0x307c0d['where'][_0x8732('0x6e')]=_0x13e0a7['id'];if(_0x122f2e[_0x8732('0x4a')][_0x8732('0x54')]){_0x307c0d[_0x8732('0x51')]=_[_0x8732('0x55')](_0x307c0d[_0x8732('0x51')],{'$or':_['map'](_0x307c0d[_0x8732('0x4c')],function(_0x549dd7){var _0x26627e={};_0x26627e[_0x549dd7]={'$like':'%'+_0x122f2e[_0x8732('0x4a')][_0x8732('0x54')]+'%'};return _0x26627e;})});}_0x307c0d=_[_0x8732('0x55')]({},_0x307c0d,_0x122f2e['options']);return db[_0x8732('0x6c')][_0x8732('0x58')](_0x307c0d);}})[_0x8732('0x3e')](function(_0x2ae8c4){if(_0x2ae8c4){return db['User'][_0x8732('0x6f')]({'where':{'id':_[_0x8732('0x45')](_0x2ae8c4,_0x8732('0x70')),'role':'agent'},'attributes':['id',_0x8732('0x43'),'chatPause',_0x8732('0x71'),_0x8732('0x72')]});}})[_0x8732('0x3e')](function(_0xec96b3){if(_0xec96b3){return{'count':_0xec96b3[_0x8732('0x36')],'rows':_[_0x8732('0x45')](_0xec96b3[_0x8732('0x59')],function(_0x85374a){return{'membername':_0x85374a['name'],'UserId':_0x85374a['id'],'queue_name':_0x2c984d[_0x8732('0x43')],'ChatQueueId':_0x2c984d['id'],'interface':util[_0x8732('0x73')](_0x8732('0x74'),_0x8732('0x75'),_0x85374a[_0x8732('0x43')]),'penalty':0x0,'paused':_0x85374a['chatPause'],'createdAt':_0x85374a[_0x8732('0x72')],'updatedAt':_0x85374a[_0x8732('0x71')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8732('0x3e')](respondWithFilteredResult(_0x1892c4,_0x307c0d))[_0x8732('0x2f')](handleError(_0x1892c4,null));};exports[_0x8732('0x76')]=function(_0x107332,_0x4caa3e,_0x3439a5){var _0x2f9617={};var _0x57e65e={};var _0x7d12fc;var _0x233806;return db[_0x8732('0x57')][_0x8732('0x6b')]({'where':{'id':_0x107332[_0x8732('0x5a')]['id']}})[_0x8732('0x3e')](handleEntityNotFound(_0x4caa3e,null))['then'](function(_0x12969b){if(_0x12969b){_0x7d12fc=_0x12969b;_0x57e65e['model']=_[_0x8732('0x5b')](db['Team']['rawAttributes']);_0x57e65e[_0x8732('0x4a')]=_[_0x8732('0x5b')](_0x107332[_0x8732('0x4a')]);_0x57e65e[_0x8732('0x4b')]=_[_0x8732('0x5c')](_0x57e65e[_0x8732('0x49')],_0x57e65e[_0x8732('0x4a')]);_0x2f9617['attributes']=_[_0x8732('0x5c')](_0x57e65e['model'],qs['fields'](_0x107332[_0x8732('0x4a')][_0x8732('0x4d')]));_0x2f9617['attributes']=_0x2f9617['attributes'][_0x8732('0x4e')]?_0x2f9617[_0x8732('0x4c')]:_0x57e65e[_0x8732('0x49')];_0x2f9617[_0x8732('0x6d')]=qs[_0x8732('0x50')](_0x107332[_0x8732('0x4a')][_0x8732('0x50')]);_0x2f9617[_0x8732('0x51')]=qs[_0x8732('0x4b')](_[_0x8732('0x52')](_0x107332[_0x8732('0x4a')],_0x57e65e['filters']));if(_0x107332[_0x8732('0x4a')][_0x8732('0x54')]){_0x2f9617[_0x8732('0x51')]=_['merge'](_0x2f9617[_0x8732('0x51')],{'$or':_['map'](_0x2f9617[_0x8732('0x4c')],function(_0x2e8e38){var _0xaef19b={};_0xaef19b[_0x2e8e38]={'$like':'%'+_0x107332[_0x8732('0x4a')]['filter']+'%'};return _0xaef19b;})});}_0x2f9617=_[_0x8732('0x55')]({},_0x2f9617,_0x107332['options']);return _0x7d12fc[_0x8732('0x76')](_0x2f9617);}})['then'](function(_0x2da448){if(_0x2da448){_0x233806=_0x2da448[_0x8732('0x4e')];if(!_0x107332[_0x8732('0x4a')][_0x8732('0x4f')](_0x8732('0x77'))){_0x2f9617['limit']=qs[_0x8732('0x34')](_0x107332[_0x8732('0x4a')][_0x8732('0x34')]);_0x2f9617[_0x8732('0x33')]=qs['offset'](_0x107332[_0x8732('0x4a')][_0x8732('0x33')]);}return _0x7d12fc['getTeams'](_0x2f9617);}})[_0x8732('0x3e')](function(_0x3fb253){if(_0x3fb253){return _0x3fb253?{'count':_0x233806,'rows':_0x3fb253}:null;}})[_0x8732('0x3e')](respondWithResult(_0x4caa3e,null))[_0x8732('0x2f')](handleError(_0x4caa3e,null));};exports['addTeams']=function(_0x6996a3,_0x40c068,_0x4af391){var _0x3347fb=_0x6996a3[_0x8732('0x5f')][_0x8732('0x78')];return db['Team'][_0x8732('0x58')]({'where':{'id':_0x3347fb},'attributes':['id'],'include':[{'model':db[_0x8732('0x79')],'as':_0x8732('0x7a'),'attributes':['id',_0x8732('0x43'),_0x8732('0x7b'),_0x8732('0x7c'),_0x8732('0x7d')],'raw':!![]}]})[_0x8732('0x3e')](function(_0xad9638){if(_0xad9638){var _0x5666b1=_[_0x8732('0x7e')](_0xad9638,function(_0x583d87){var _0x15b131=_0x583d87[_0x8732('0x61')]({'plain':!![]});return _0x15b131[_0x8732('0x7a')];});return db[_0x8732('0x57')][_0x8732('0x65')]({'where':{'id':_0x6996a3[_0x8732('0x5a')]['id']}})[_0x8732('0x3e')](function(_0x3e6e57){return db[_0x8732('0x7f')][_0x8732('0x80')](function(_0x348407){return _0x3e6e57[_0x8732('0x81')](_0x3347fb,{'transaction':_0x348407})['then'](function(){return BPromise[_0x8732('0x82')](_0x5666b1,function(_0x3474e6){return db[_0x8732('0x6c')][_0x8732('0x83')]({'where':{'UserId':_0x3474e6['id'],'ChatQueueId':_0x6996a3[_0x8732('0x5a')]['id']},'transaction':_0x348407});});})['then'](function(){_0x5666b1[_0x8732('0x84')](function(_0x40f263){socket[_0x8732('0x85')](_0x8732('0x86'),{'UserId':_0x40f263['id'],'ChatQueueId':_0x3e6e57['id']});});});});});}})[_0x8732('0x3e')](respondWithStatusCode(_0x40c068,null))['catch'](handleError(_0x40c068,null));};exports['removeTeams']=function(_0x55f4ea,_0x5a0758,_0x2bf995){return db[_0x8732('0x87')][_0x8732('0x58')]({'where':{'id':_0x55f4ea[_0x8732('0x4a')][_0x8732('0x78')]},'attributes':['id'],'include':[{'model':db[_0x8732('0x79')],'as':_0x8732('0x7a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0758,null))[_0x8732('0x3e')](function(_0x25f81a){var _0x1b0e2b=_['map'](_0x25f81a,'id');var _0x35f264=[];var _0x388dd0=[];var _0x29417d=squel[_0x8732('0x88')]();_0x29417d[_0x8732('0x89')](_0x8732('0x8a'))[_0x8732('0x8b')](_0x8732('0x8c'),'tq')[_0x8732('0x8d')]('user_has_teams','ut',_0x8732('0x8e'))[_0x8732('0x51')](_0x8732('0x8f'),_0x55f4ea['params']['id']);for(var _0x55d4a0=0x0;_0x55d4a0<_0x25f81a['length'];_0x55d4a0+=0x1){let _0x477a1e=_0x25f81a[_0x55d4a0];for(var _0x58c397=0x0;_0x58c397<_0x477a1e['Agents'][_0x8732('0x4e')];_0x58c397+=0x1){let _0x3c15db=_0x477a1e[_0x8732('0x7a')][_0x58c397];var _0x1b9a6d=_0x29417d[_0x8732('0x90')]();_0x1b9a6d[_0x8732('0x51')](_0x8732('0x91'),_0x3c15db['id']);_0x388dd0[_0x8732('0x92')](db[_0x8732('0x7f')][_0x8732('0x4a')](_0x1b9a6d[_0x8732('0x93')](),{'type':db[_0x8732('0x7f')]['QueryTypes']['SELECT']})[_0x8732('0x3e')](function(_0x4915eb){if(_0x4915eb[_0x8732('0x4e')]===0x1){return _0x3c15db['id'];}else{var _0x3a27fe=_[_0x8732('0x94')](_[_0x8732('0x45')](_0x4915eb,'TeamId'),function(_0x2b2e52){return _[_0x8732('0x95')](_0x1b0e2b,_0x2b2e52);});if(_0x3a27fe){return _0x3c15db['id'];}}}));}}return BPromise['all'](_0x388dd0)['then'](function(_0x258ad7){_0x35f264=_(_0x35f264)['union'](_0x258ad7)[_0x8732('0x96')]()[_0x8732('0x97')]();return db[_0x8732('0x57')]['find']({'where':{'id':_0x55f4ea[_0x8732('0x5a')]['id']}})[_0x8732('0x3e')](function(_0x4684f1){return db[_0x8732('0x7f')][_0x8732('0x80')](function(_0x5933a3){return _0x4684f1[_0x8732('0x98')](_0x55f4ea[_0x8732('0x4a')][_0x8732('0x78')],{'transaction':_0x5933a3})[_0x8732('0x3e')](function(){if(!_[_0x8732('0x99')](_0x35f264)){return _0x4684f1['removeAgents'](_0x35f264,{'transaction':_0x5933a3});}})[_0x8732('0x3e')](function(){_0x35f264[_0x8732('0x84')](function(_0x35133f){socket[_0x8732('0x85')]('userChatQueue:remove',{'UserId':_0x35133f,'ChatQueueId':_0x4684f1['id']});});});});});});})[_0x8732('0x3e')](respondWithStatusCode(_0x5a0758,null))['catch'](handleError(_0x5a0758,null));};exports[_0x8732('0x9a')]=function(_0xe1df05,_0x32121f,_0xba9908){return db[_0x8732('0x57')][_0x8732('0x65')]({'where':{'id':_0xe1df05[_0x8732('0x5a')]['id']}})[_0x8732('0x3e')](handleEntityNotFound(_0x32121f,null))[_0x8732('0x3e')](function(_0x203936){if(_0x203936){return _0x203936[_0x8732('0x9a')](_0xe1df05[_0x8732('0x5f')][_0x8732('0x78')],_[_0x8732('0x9b')](_0xe1df05[_0x8732('0x5f')],[_0x8732('0x78'),'id'])||{})['spread'](function(_0x2e0b34){for(var _0x1a4b37=0x0;_0x1a4b37<_0xe1df05[_0x8732('0x5f')]['ids'][_0x8732('0x4e')];_0x1a4b37+=0x1){socket[_0x8732('0x85')](_0x8732('0x86'),{'UserId':Number(_0xe1df05['body'][_0x8732('0x78')][_0x1a4b37]),'ChatQueueId':Number(_0xe1df05[_0x8732('0x5a')]['id'])});}return _0x2e0b34;});}})[_0x8732('0x3e')](respondWithResult(_0x32121f,null))[_0x8732('0x2f')](handleError(_0x32121f,null));};exports['removeAgents']=function(_0x524bd5,_0x1f2e79,_0x555341){return db[_0x8732('0x57')][_0x8732('0x65')]({'where':{'id':_0x524bd5[_0x8732('0x5a')]['id']}})[_0x8732('0x3e')](handleEntityNotFound(_0x1f2e79,null))[_0x8732('0x3e')](function(_0x41edb3){if(_0x41edb3){return _0x41edb3['removeAgents'](_0x524bd5[_0x8732('0x4a')]['ids'])['then'](function(){if(_['isArray'](_0x524bd5['query']['ids'])){for(var _0x49c847=0x0;_0x49c847<_0x524bd5['query'][_0x8732('0x78')][_0x8732('0x4e')];_0x49c847+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x524bd5[_0x8732('0x4a')][_0x8732('0x78')][_0x49c847]),'ChatQueueId':Number(_0x524bd5[_0x8732('0x5a')]['id'])});}}else{socket[_0x8732('0x85')]('userChatQueue:remove',{'UserId':Number(_0x524bd5['query'][_0x8732('0x78')]),'ChatQueueId':Number(_0x524bd5[_0x8732('0x5a')]['id'])});}});}})[_0x8732('0x3e')](respondWithStatusCode(_0x1f2e79,null))['catch'](handleError(_0x1f2e79,null));};exports[_0x8732('0x9c')]=function(_0x31c038,_0x6cc12d,_0x544e47){var _0x1567cd={};var _0x31ac4e={};var _0x7f821a;var _0x24573f;return db['ChatQueue'][_0x8732('0x6b')]({'where':{'id':_0x31c038[_0x8732('0x5a')]['id']}})[_0x8732('0x3e')](handleEntityNotFound(_0x6cc12d,null))[_0x8732('0x3e')](function(_0x35be46){if(_0x35be46){_0x7f821a=_0x35be46;_0x31ac4e[_0x8732('0x49')]=_[_0x8732('0x5b')](db[_0x8732('0x79')][_0x8732('0x46')]);_0x31ac4e[_0x8732('0x4a')]=_[_0x8732('0x5b')](_0x31c038[_0x8732('0x4a')]);_0x31ac4e[_0x8732('0x4b')]=_[_0x8732('0x5c')](_0x31ac4e[_0x8732('0x49')],_0x31ac4e[_0x8732('0x4a')]);_0x1567cd[_0x8732('0x4c')]=_[_0x8732('0x5c')](_0x31ac4e[_0x8732('0x49')],qs['fields'](_0x31c038['query'][_0x8732('0x4d')]));_0x1567cd['attributes']=_0x1567cd[_0x8732('0x4c')]['length']?_0x1567cd[_0x8732('0x4c')]:_0x31ac4e[_0x8732('0x49')];_0x1567cd['order']=qs[_0x8732('0x50')](_0x31c038['query']['sort']);_0x1567cd[_0x8732('0x51')]=qs[_0x8732('0x4b')](_[_0x8732('0x52')](_0x31c038[_0x8732('0x4a')],_0x31ac4e[_0x8732('0x4b')]));if(_0x31c038[_0x8732('0x4a')][_0x8732('0x54')]){_0x1567cd[_0x8732('0x51')]=_[_0x8732('0x55')](_0x1567cd[_0x8732('0x51')],{'$or':_[_0x8732('0x45')](_0x1567cd[_0x8732('0x4c')],function(_0x7df400){var _0x657bca={};_0x657bca[_0x7df400]={'$like':'%'+_0x31c038['query'][_0x8732('0x54')]+'%'};return _0x657bca;})});}_0x1567cd=_[_0x8732('0x55')]({},_0x1567cd,_0x31c038['options']);return _0x7f821a[_0x8732('0x9c')](_0x1567cd);}})['then'](function(_0x1fb14a){if(_0x1fb14a){_0x24573f=_0x1fb14a[_0x8732('0x4e')];if(!_0x31c038[_0x8732('0x4a')][_0x8732('0x4f')]('nolimit')){_0x1567cd[_0x8732('0x34')]=qs['limit'](_0x31c038[_0x8732('0x4a')]['limit']);_0x1567cd[_0x8732('0x33')]=qs[_0x8732('0x33')](_0x31c038[_0x8732('0x4a')][_0x8732('0x33')]);}return _0x7f821a[_0x8732('0x9c')](_0x1567cd);}})['then'](function(_0xb43ac3){if(_0xb43ac3){return _0xb43ac3?{'count':_0x24573f,'rows':_0xb43ac3}:null;}})[_0x8732('0x3e')](respondWithResult(_0x6cc12d,null))[_0x8732('0x2f')](handleError(_0x6cc12d,null));}; \ No newline at end of file +var _0x90de=['moment','util','ejs','fs-extra','lodash','squel','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','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','save','then','get','ChatQueues','destroy','stack','name','send','map','fieldName','key','query','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','ChatQueue','includeAll','findAll','rows','params','model','keys','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','pick','ChatQueueId','User','findAndCountAll','agent','chatPause','updatedAt','format','%s/%s','SIP','getTeams','rawAttributes','addTeams','ids','Agents','online','voicePause','flatMap','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x90de,0x94));var _0xe90d=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0x90de[_0xb0de07];return _0x4633d8;};'use strict';var emlformat=require(_0xe90d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe90d('0x1'));var jsonpatch=require(_0xe90d('0x2'));var rp=require(_0xe90d('0x3'));var moment=require(_0xe90d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe90d('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe90d('0x6'));var fs=require('fs');var fs_extra=require(_0xe90d('0x7'));var _=require(_0xe90d('0x8'));var squel=require(_0xe90d('0x9'));var crypto=require('crypto');var jsforce=require(_0xe90d('0xa'));var deskjs=require(_0xe90d('0xb'));var toCsv=require(_0xe90d('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe90d('0xd'));var authService=require(_0xe90d('0xe'));var qs=require(_0xe90d('0xf'));var as=require(_0xe90d('0x10'));var hardwareService=require(_0xe90d('0x11'));var logger=require(_0xe90d('0x12'))(_0xe90d('0x13'));var utils=require(_0xe90d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe90d('0x15'));var db=require(_0xe90d('0x16'))['db'];config[_0xe90d('0x17')]=_[_0xe90d('0x18')](config[_0xe90d('0x17')],{'host':_0xe90d('0x19'),'port':0x18eb});var socket=require(_0xe90d('0x1a'))(new Redis(config[_0xe90d('0x17')]));require(_0xe90d('0x1b'))[_0xe90d('0x1c')](socket);var jayson=require(_0xe90d('0x1d'));var client=jayson['client'][_0xe90d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x25cf4d,_0x52131b,_0x406e7e,_0x31cc0a){return new BPromise(function(_0x148a41,_0x421ebb){var _0x468e70=_0x31cc0a||client;return _0x468e70[_0xe90d('0x1f')](_0x25cf4d,_0x406e7e)['then'](function(_0x15ca80){logger['info'](_0xe90d('0x20'),_0x52131b,_0xe90d('0x21'));logger[_0xe90d('0x22')](_0xe90d('0x23'),_0x52131b,_0xe90d('0x21'),JSON[_0xe90d('0x24')](_0x15ca80));if(_0x15ca80[_0xe90d('0x25')]){if(_0x15ca80[_0xe90d('0x25')][_0xe90d('0x26')]===0x1f4){logger[_0xe90d('0x25')](_0xe90d('0x20'),_0x52131b,_0x15ca80['error'][_0xe90d('0x27')]);return _0x421ebb(_0x15ca80['error']['message']);}logger[_0xe90d('0x25')](_0xe90d('0x20'),_0x52131b,_0x15ca80['error'][_0xe90d('0x27')]);return _0x148a41(_0x15ca80[_0xe90d('0x25')]['message']);}else{logger[_0xe90d('0x28')](_0xe90d('0x20'),_0x52131b,_0xe90d('0x21'));_0x148a41(_0x15ca80[_0xe90d('0x29')][_0xe90d('0x27')]);}})[_0xe90d('0x2a')](function(_0x5ba6d5){logger[_0xe90d('0x25')](_0xe90d('0x20'),_0x52131b,_0x5ba6d5);_0x421ebb(_0x5ba6d5);});});}function respondWithStatusCode(_0x5758b8,_0x48ab7b){_0x48ab7b=_0x48ab7b||0xcc;return function(_0x23348d){if(_0x23348d){return _0x5758b8[_0xe90d('0x2b')](_0x48ab7b);}return _0x5758b8[_0xe90d('0x2c')](_0x48ab7b)[_0xe90d('0x2d')]();};}function respondWithResult(_0x309fdc,_0x4bd233){_0x4bd233=_0x4bd233||0xc8;return function(_0x2af6b0){if(_0x2af6b0){return _0x309fdc[_0xe90d('0x2c')](_0x4bd233)['json'](_0x2af6b0);}};}function respondWithFilteredResult(_0x5c649e,_0x56bb6a){return function(_0x4aff82){if(_0x4aff82){var _0x1323f6=typeof _0x56bb6a[_0xe90d('0x2e')]==='undefined'&&typeof _0x56bb6a['limit']===_0xe90d('0x2f');var _0x410ad5=_0x4aff82[_0xe90d('0x30')];var _0x2fae1c=_0x1323f6?0x0:_0x56bb6a[_0xe90d('0x2e')];var _0x3310d9=_0x1323f6?_0x4aff82[_0xe90d('0x30')]:_0x56bb6a[_0xe90d('0x2e')]+_0x56bb6a[_0xe90d('0x31')];var _0x183e59;if(_0x3310d9>=_0x410ad5){_0x3310d9=_0x410ad5;_0x183e59=0xc8;}else{_0x183e59=0xce;}_0x5c649e['status'](_0x183e59);return _0x5c649e[_0xe90d('0x32')]('Content-Range',_0x2fae1c+'-'+_0x3310d9+'/'+_0x410ad5)[_0xe90d('0x33')](_0x4aff82);}return null;};}function patchUpdates(_0x1a7e36){return function(_0x5aaf7a){try{jsonpatch[_0xe90d('0x34')](_0x5aaf7a,_0x1a7e36,!![]);}catch(_0x5688dc){return BPromise['reject'](_0x5688dc);}return _0x5aaf7a[_0xe90d('0x35')]();};}function saveUpdates(_0x1349ac,_0x5c86ab){return function(_0x14cf1c){if(_0x14cf1c){return _0x14cf1c['update'](_0x1349ac)['then'](function(_0x3b9b31){return _0x3b9b31;});}return null;};}function removeEntity(_0x5b438f,_0x2b32b6){return function(_0x305db4){if(_0x305db4){return _0x305db4['destroy']()[_0xe90d('0x36')](function(){var _0x380ce1=_0x305db4[_0xe90d('0x37')]({'plain':!![]});var _0x238ed5=_0xe90d('0x38');return db['UserProfileResource'][_0xe90d('0x39')]({'where':{'type':_0x238ed5,'resourceId':_0x380ce1['id']}})[_0xe90d('0x36')](function(){return _0x305db4;});})[_0xe90d('0x36')](function(){_0x5b438f['status'](0xcc)[_0xe90d('0x2d')]();});}};}function handleEntityNotFound(_0x4d89bd,_0x1bf2e0){return function(_0x4bc75f){if(!_0x4bc75f){_0x4d89bd[_0xe90d('0x2b')](0x194);}return _0x4bc75f;};}function handleError(_0x3b0744,_0x1fea12){_0x1fea12=_0x1fea12||0x1f4;return function(_0x5bccfd){logger[_0xe90d('0x25')](_0x5bccfd[_0xe90d('0x3a')]);if(_0x5bccfd[_0xe90d('0x3b')]){delete _0x5bccfd[_0xe90d('0x3b')];}_0x3b0744['status'](_0x1fea12)[_0xe90d('0x3c')](_0x5bccfd);};}exports['index']=function(_0x742db6,_0x148483){var _0x2aaa25={},_0x237abb={},_0x1f37b7={'count':0x0,'rows':[]};var _0x19828b=_[_0xe90d('0x3d')](db['ChatQueue']['rawAttributes'],function(_0x5ccddd){return{'name':_0x5ccddd[_0xe90d('0x3e')],'type':_0x5ccddd['type'][_0xe90d('0x3f')]};});_0x237abb['model']=_[_0xe90d('0x3d')](_0x19828b,_0xe90d('0x3b'));_0x237abb[_0xe90d('0x40')]=_['keys'](_0x742db6[_0xe90d('0x40')]);_0x237abb['filters']=_[_0xe90d('0x41')](_0x237abb['model'],_0x237abb[_0xe90d('0x40')]);_0x2aaa25[_0xe90d('0x42')]=_[_0xe90d('0x41')](_0x237abb['model'],qs['fields'](_0x742db6[_0xe90d('0x40')][_0xe90d('0x43')]));_0x2aaa25['attributes']=_0x2aaa25[_0xe90d('0x42')]['length']?_0x2aaa25[_0xe90d('0x42')]:_0x237abb['model'];if(!_0x742db6[_0xe90d('0x40')]['hasOwnProperty'](_0xe90d('0x44'))){_0x2aaa25[_0xe90d('0x31')]=qs[_0xe90d('0x31')](_0x742db6[_0xe90d('0x40')][_0xe90d('0x31')]);_0x2aaa25[_0xe90d('0x2e')]=qs[_0xe90d('0x2e')](_0x742db6[_0xe90d('0x40')][_0xe90d('0x2e')]);}_0x2aaa25[_0xe90d('0x45')]=qs[_0xe90d('0x46')](_0x742db6['query'][_0xe90d('0x46')]);_0x2aaa25[_0xe90d('0x47')]=qs[_0xe90d('0x48')](_['pick'](_0x742db6[_0xe90d('0x40')],_0x237abb[_0xe90d('0x48')]),_0x19828b);if(_0x742db6[_0xe90d('0x40')][_0xe90d('0x49')]){_0x2aaa25['where']=_['merge'](_0x2aaa25['where'],{'$or':_['map'](_0x19828b,function(_0x508aa7){if(_0x508aa7['type']!==_0xe90d('0x4a')){var _0x50e4c5={};_0x50e4c5[_0x508aa7[_0xe90d('0x3b')]]={'$like':'%'+_0x742db6[_0xe90d('0x40')][_0xe90d('0x49')]+'%'};return _0x50e4c5;}})});}_0x2aaa25=_[_0xe90d('0x4b')]({},_0x2aaa25,_0x742db6[_0xe90d('0x4c')]);var _0xd0063f={'where':_0x2aaa25['where']};return db[_0xe90d('0x4d')][_0xe90d('0x30')](_0xd0063f)[_0xe90d('0x36')](function(_0x524213){_0x1f37b7[_0xe90d('0x30')]=_0x524213;if(_0x742db6[_0xe90d('0x40')][_0xe90d('0x4e')]){_0x2aaa25['include']=[{'all':!![]}];}return db[_0xe90d('0x4d')][_0xe90d('0x4f')](_0x2aaa25);})[_0xe90d('0x36')](function(_0x5bcc22){_0x1f37b7[_0xe90d('0x50')]=_0x5bcc22;return _0x1f37b7;})['then'](respondWithFilteredResult(_0x148483,_0x2aaa25))[_0xe90d('0x2a')](handleError(_0x148483,null));};exports['show']=function(_0x43f844,_0x2cdd3a){var _0x153c04={'raw':!![],'where':{'id':_0x43f844[_0xe90d('0x51')]['id']}},_0x133bfb={};_0x133bfb[_0xe90d('0x52')]=_[_0xe90d('0x53')](db[_0xe90d('0x4d')]['rawAttributes']);_0x133bfb['query']=_['keys'](_0x43f844[_0xe90d('0x40')]);_0x133bfb['filters']=_[_0xe90d('0x41')](_0x133bfb['model'],_0x133bfb[_0xe90d('0x40')]);_0x153c04[_0xe90d('0x42')]=_['intersection'](_0x133bfb[_0xe90d('0x52')],qs[_0xe90d('0x43')](_0x43f844['query'][_0xe90d('0x43')]));_0x153c04[_0xe90d('0x42')]=_0x153c04['attributes'][_0xe90d('0x54')]?_0x153c04['attributes']:_0x133bfb[_0xe90d('0x52')];if(_0x43f844[_0xe90d('0x40')][_0xe90d('0x4e')]){_0x153c04[_0xe90d('0x55')]=[{'all':!![]}];}_0x153c04=_[_0xe90d('0x4b')]({},_0x153c04,_0x43f844[_0xe90d('0x4c')]);return db[_0xe90d('0x4d')][_0xe90d('0x56')](_0x153c04)[_0xe90d('0x36')](handleEntityNotFound(_0x2cdd3a,null))[_0xe90d('0x36')](respondWithResult(_0x2cdd3a,null))[_0xe90d('0x2a')](handleError(_0x2cdd3a,null));};exports[_0xe90d('0x57')]=function(_0x15fd59,_0x5bd3ec){return db[_0xe90d('0x4d')][_0xe90d('0x57')](_0x15fd59[_0xe90d('0x58')],{})[_0xe90d('0x36')](function(_0x1aa5ae){var _0xe9f4e5=_0x15fd59['user'][_0xe90d('0x37')]({'plain':!![]});if(!_0xe9f4e5)throw new Error(_0xe90d('0x59'));if(_0xe9f4e5['role']===_0xe90d('0x5a')){var _0x5c30ca=_0x1aa5ae[_0xe90d('0x37')]({'plain':!![]});var _0x377689='ChatQueues';return db[_0xe90d('0x5b')][_0xe90d('0x56')]({'where':{'name':_0x377689,'userProfileId':_0xe9f4e5[_0xe90d('0x5c')]},'raw':!![]})[_0xe90d('0x36')](function(_0x52597a){if(_0x52597a&&_0x52597a[_0xe90d('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0x5c30ca['name'],'resourceId':_0x5c30ca['id'],'type':_0x52597a[_0xe90d('0x3b')],'sectionId':_0x52597a['id']},{})[_0xe90d('0x36')](function(){return _0x1aa5ae;});}else{return _0x1aa5ae;}})['catch'](function(_0x5399b7){logger['error'](_0xe90d('0x5e'),_0x5399b7);throw _0x5399b7;});}return _0x1aa5ae;})[_0xe90d('0x36')](respondWithResult(_0x5bd3ec,0xc9))[_0xe90d('0x2a')](handleError(_0x5bd3ec,null));};exports[_0xe90d('0x5f')]=function(_0x5ed07a,_0x2f69e9){if(_0x5ed07a[_0xe90d('0x58')]['id']){delete _0x5ed07a['body']['id'];}return db['ChatQueue'][_0xe90d('0x56')]({'where':{'id':_0x5ed07a['params']['id']}})[_0xe90d('0x36')](handleEntityNotFound(_0x2f69e9,null))[_0xe90d('0x36')](saveUpdates(_0x5ed07a['body'],null))[_0xe90d('0x36')](respondWithResult(_0x2f69e9,null))[_0xe90d('0x2a')](handleError(_0x2f69e9,null));};exports[_0xe90d('0x39')]=function(_0x48a044,_0x29aeb3){return db[_0xe90d('0x4d')][_0xe90d('0x56')]({'where':{'id':_0x48a044[_0xe90d('0x51')]['id']}})[_0xe90d('0x36')](handleEntityNotFound(_0x29aeb3,null))[_0xe90d('0x36')](removeEntity(_0x29aeb3,null))[_0xe90d('0x2a')](handleError(_0x29aeb3,null));};exports[_0xe90d('0x60')]=function(_0x52b59e,_0x3fb2d5){return db[_0xe90d('0x4d')][_0xe90d('0x60')]()['then'](respondWithResult(_0x3fb2d5,null))['catch'](handleError(_0x3fb2d5,null));};exports[_0xe90d('0x61')]=function(_0x55d448,_0x31b7c6,_0x39c214){var _0x17c0d1={'raw':!![],'where':{}},_0x36366e={},_0x28e138;return db[_0xe90d('0x4d')][_0xe90d('0x62')]({'where':{'id':_0x55d448[_0xe90d('0x51')]['id']}})[_0xe90d('0x36')](handleEntityNotFound(_0x31b7c6,null))[_0xe90d('0x36')](function(_0x18fa2e){if(_0x18fa2e){_0x28e138=_0x18fa2e[_0xe90d('0x37')]({'plain':!![]});_0x36366e[_0xe90d('0x52')]=_[_0xe90d('0x53')](db[_0xe90d('0x63')]['rawAttributes']);_0x36366e[_0xe90d('0x40')]=_[_0xe90d('0x53')](_0x55d448[_0xe90d('0x40')]);_0x36366e[_0xe90d('0x48')]=_[_0xe90d('0x41')](_0x36366e[_0xe90d('0x52')],_0x36366e[_0xe90d('0x40')]);_0x17c0d1[_0xe90d('0x42')]=_[_0xe90d('0x41')](_0x36366e[_0xe90d('0x52')],qs[_0xe90d('0x43')](_0x55d448['query']['fields']));_0x17c0d1[_0xe90d('0x42')]=_0x17c0d1[_0xe90d('0x42')][_0xe90d('0x54')]?_0x17c0d1[_0xe90d('0x42')]:_0x36366e[_0xe90d('0x52')];if(!_0x55d448[_0xe90d('0x40')][_0xe90d('0x64')](_0xe90d('0x44'))){_0x17c0d1[_0xe90d('0x31')]=qs['limit'](_0x55d448['query']['limit']);_0x17c0d1[_0xe90d('0x2e')]=qs[_0xe90d('0x2e')](_0x55d448['query'][_0xe90d('0x2e')]);}_0x17c0d1[_0xe90d('0x45')]=qs[_0xe90d('0x46')](_0x55d448[_0xe90d('0x40')][_0xe90d('0x46')]);_0x17c0d1[_0xe90d('0x47')]=qs['filters'](_[_0xe90d('0x65')](_0x55d448[_0xe90d('0x40')],_0x36366e[_0xe90d('0x48')]));_0x17c0d1['where'][_0xe90d('0x66')]=_0x18fa2e['id'];if(_0x55d448['query'][_0xe90d('0x49')]){_0x17c0d1[_0xe90d('0x47')]=_['merge'](_0x17c0d1[_0xe90d('0x47')],{'$or':_[_0xe90d('0x3d')](_0x17c0d1[_0xe90d('0x42')],function(_0x430a15){var _0x52928b={};_0x52928b[_0x430a15]={'$like':'%'+_0x55d448['query'][_0xe90d('0x49')]+'%'};return _0x52928b;})});}_0x17c0d1=_[_0xe90d('0x4b')]({},_0x17c0d1,_0x55d448['options']);return db[_0xe90d('0x63')][_0xe90d('0x4f')](_0x17c0d1);}})[_0xe90d('0x36')](function(_0x3d364e){if(_0x3d364e){return db[_0xe90d('0x67')][_0xe90d('0x68')]({'where':{'id':_['map'](_0x3d364e,'UserId'),'role':_0xe90d('0x69')},'attributes':['id','name',_0xe90d('0x6a'),_0xe90d('0x6b'),'createdAt']});}})[_0xe90d('0x36')](function(_0x3e62e7){if(_0x3e62e7){return{'count':_0x3e62e7[_0xe90d('0x30')],'rows':_[_0xe90d('0x3d')](_0x3e62e7[_0xe90d('0x50')],function(_0x36e456){return{'membername':_0x36e456[_0xe90d('0x3b')],'UserId':_0x36e456['id'],'queue_name':_0x28e138[_0xe90d('0x3b')],'ChatQueueId':_0x28e138['id'],'interface':util[_0xe90d('0x6c')](_0xe90d('0x6d'),_0xe90d('0x6e'),_0x36e456[_0xe90d('0x3b')]),'penalty':0x0,'paused':_0x36e456[_0xe90d('0x6a')],'createdAt':_0x36e456['createdAt'],'updatedAt':_0x36e456['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe90d('0x36')](respondWithFilteredResult(_0x31b7c6,_0x17c0d1))['catch'](handleError(_0x31b7c6,null));};exports[_0xe90d('0x6f')]=function(_0x40e72f,_0x1a74ae,_0x4e1fba){var _0xb7e23a={};var _0x1ef47b={};var _0x333421;var _0x3a0f95;return db[_0xe90d('0x4d')]['findOne']({'where':{'id':_0x40e72f['params']['id']}})[_0xe90d('0x36')](handleEntityNotFound(_0x1a74ae,null))[_0xe90d('0x36')](function(_0x3f05eb){if(_0x3f05eb){_0x333421=_0x3f05eb;_0x1ef47b[_0xe90d('0x52')]=_[_0xe90d('0x53')](db['Team'][_0xe90d('0x70')]);_0x1ef47b[_0xe90d('0x40')]=_[_0xe90d('0x53')](_0x40e72f[_0xe90d('0x40')]);_0x1ef47b['filters']=_[_0xe90d('0x41')](_0x1ef47b['model'],_0x1ef47b[_0xe90d('0x40')]);_0xb7e23a[_0xe90d('0x42')]=_[_0xe90d('0x41')](_0x1ef47b[_0xe90d('0x52')],qs['fields'](_0x40e72f[_0xe90d('0x40')][_0xe90d('0x43')]));_0xb7e23a[_0xe90d('0x42')]=_0xb7e23a['attributes'][_0xe90d('0x54')]?_0xb7e23a[_0xe90d('0x42')]:_0x1ef47b[_0xe90d('0x52')];_0xb7e23a['order']=qs[_0xe90d('0x46')](_0x40e72f['query'][_0xe90d('0x46')]);_0xb7e23a[_0xe90d('0x47')]=qs[_0xe90d('0x48')](_[_0xe90d('0x65')](_0x40e72f[_0xe90d('0x40')],_0x1ef47b[_0xe90d('0x48')]));if(_0x40e72f[_0xe90d('0x40')][_0xe90d('0x49')]){_0xb7e23a[_0xe90d('0x47')]=_[_0xe90d('0x4b')](_0xb7e23a[_0xe90d('0x47')],{'$or':_[_0xe90d('0x3d')](_0xb7e23a[_0xe90d('0x42')],function(_0x566982){var _0x2b5c91={};_0x2b5c91[_0x566982]={'$like':'%'+_0x40e72f[_0xe90d('0x40')]['filter']+'%'};return _0x2b5c91;})});}_0xb7e23a=_[_0xe90d('0x4b')]({},_0xb7e23a,_0x40e72f[_0xe90d('0x4c')]);return _0x333421[_0xe90d('0x6f')](_0xb7e23a);}})[_0xe90d('0x36')](function(_0x3cf91a){if(_0x3cf91a){_0x3a0f95=_0x3cf91a[_0xe90d('0x54')];if(!_0x40e72f[_0xe90d('0x40')][_0xe90d('0x64')](_0xe90d('0x44'))){_0xb7e23a['limit']=qs[_0xe90d('0x31')](_0x40e72f[_0xe90d('0x40')][_0xe90d('0x31')]);_0xb7e23a[_0xe90d('0x2e')]=qs['offset'](_0x40e72f[_0xe90d('0x40')][_0xe90d('0x2e')]);}return _0x333421['getTeams'](_0xb7e23a);}})['then'](function(_0x36a9e1){if(_0x36a9e1){return _0x36a9e1?{'count':_0x3a0f95,'rows':_0x36a9e1}:null;}})['then'](respondWithResult(_0x1a74ae,null))[_0xe90d('0x2a')](handleError(_0x1a74ae,null));};exports[_0xe90d('0x71')]=function(_0x1d5f71,_0x1418c5,_0x2e62a7){var _0x5ace3e=_0x1d5f71[_0xe90d('0x58')][_0xe90d('0x72')];return db['Team'][_0xe90d('0x4f')]({'where':{'id':_0x5ace3e},'attributes':['id'],'include':[{'model':db[_0xe90d('0x67')],'as':_0xe90d('0x73'),'attributes':['id',_0xe90d('0x3b'),_0xe90d('0x74'),_0xe90d('0x75'),'interface'],'raw':!![]}]})[_0xe90d('0x36')](function(_0x52aff0){if(_0x52aff0){var _0x21809c=_[_0xe90d('0x76')](_0x52aff0,function(_0x5c9cdc){var _0x3e778e=_0x5c9cdc[_0xe90d('0x37')]({'plain':!![]});return _0x3e778e[_0xe90d('0x73')];});return db[_0xe90d('0x4d')]['find']({'where':{'id':_0x1d5f71[_0xe90d('0x51')]['id']}})[_0xe90d('0x36')](function(_0x469e28){return db['sequelize']['transaction'](function(_0x4fde0e){return _0x469e28['addTeams'](_0x5ace3e,{'transaction':_0x4fde0e})[_0xe90d('0x36')](function(){return BPromise['each'](_0x21809c,function(_0x3064e4){return db[_0xe90d('0x63')][_0xe90d('0x77')]({'where':{'UserId':_0x3064e4['id'],'ChatQueueId':_0x1d5f71[_0xe90d('0x51')]['id']},'transaction':_0x4fde0e});});})['then'](function(){_0x21809c[_0xe90d('0x78')](function(_0x4527de){socket[_0xe90d('0x79')](_0xe90d('0x7a'),{'UserId':_0x4527de['id'],'ChatQueueId':_0x469e28['id']});});});});});}})[_0xe90d('0x36')](respondWithStatusCode(_0x1418c5,null))[_0xe90d('0x2a')](handleError(_0x1418c5,null));};exports[_0xe90d('0x7b')]=function(_0x1e1f5e,_0x4e0a4c,_0x18c1a3){return db[_0xe90d('0x7c')][_0xe90d('0x4f')]({'where':{'id':_0x1e1f5e[_0xe90d('0x40')][_0xe90d('0x72')]},'attributes':['id'],'include':[{'model':db[_0xe90d('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe90d('0x36')](handleEntityNotFound(_0x4e0a4c,null))[_0xe90d('0x36')](function(_0x2c4f96){var _0x3a85ca=_[_0xe90d('0x3d')](_0x2c4f96,'id');var _0x4ce357=[];var _0x1db97e=[];var _0x1b4264=squel['select']();_0x1b4264[_0xe90d('0x7d')](_0xe90d('0x7e'))[_0xe90d('0x7f')](_0xe90d('0x80'),'tq')['join'](_0xe90d('0x81'),'ut',_0xe90d('0x82'))[_0xe90d('0x47')](_0xe90d('0x83'),_0x1e1f5e[_0xe90d('0x51')]['id']);for(var _0x473c46=0x0;_0x473c46<_0x2c4f96[_0xe90d('0x54')];_0x473c46+=0x1){let _0x2161d2=_0x2c4f96[_0x473c46];for(var _0x1ce42f=0x0;_0x1ce42f<_0x2161d2[_0xe90d('0x73')][_0xe90d('0x54')];_0x1ce42f+=0x1){let _0x2d410f=_0x2161d2[_0xe90d('0x73')][_0x1ce42f];var _0x49d381=_0x1b4264['clone']();_0x49d381[_0xe90d('0x47')]('ut.UserId\x20=\x20?',_0x2d410f['id']);_0x1db97e[_0xe90d('0x84')](db[_0xe90d('0x85')]['query'](_0x49d381[_0xe90d('0x86')](),{'type':db[_0xe90d('0x85')]['QueryTypes'][_0xe90d('0x87')]})[_0xe90d('0x36')](function(_0x45d940){if(_0x45d940['length']===0x1){return _0x2d410f['id'];}else{var _0x128463=_[_0xe90d('0x88')](_[_0xe90d('0x3d')](_0x45d940,_0xe90d('0x89')),function(_0x2bea34){return _[_0xe90d('0x8a')](_0x3a85ca,_0x2bea34);});if(_0x128463){return _0x2d410f['id'];}}}));}}return BPromise[_0xe90d('0x8b')](_0x1db97e)[_0xe90d('0x36')](function(_0x551f00){_0x4ce357=_(_0x4ce357)[_0xe90d('0x8c')](_0x551f00)[_0xe90d('0x8d')]()[_0xe90d('0x8e')]();return db[_0xe90d('0x4d')]['find']({'where':{'id':_0x1e1f5e[_0xe90d('0x51')]['id']}})['then'](function(_0x2a9362){return db[_0xe90d('0x85')][_0xe90d('0x8f')](function(_0x53dac6){return _0x2a9362[_0xe90d('0x7b')](_0x1e1f5e[_0xe90d('0x40')][_0xe90d('0x72')],{'transaction':_0x53dac6})['then'](function(){if(!_[_0xe90d('0x90')](_0x4ce357)){return _0x2a9362[_0xe90d('0x91')](_0x4ce357,{'transaction':_0x53dac6});}})['then'](function(){_0x4ce357[_0xe90d('0x78')](function(_0x566dc2){socket[_0xe90d('0x79')](_0xe90d('0x92'),{'UserId':_0x566dc2,'ChatQueueId':_0x2a9362['id']});});});});});});})['then'](respondWithStatusCode(_0x4e0a4c,null))[_0xe90d('0x2a')](handleError(_0x4e0a4c,null));};exports[_0xe90d('0x93')]=function(_0x43a535,_0x3cd39a,_0x233e8c){return db['ChatQueue'][_0xe90d('0x56')]({'where':{'id':_0x43a535[_0xe90d('0x51')]['id']}})[_0xe90d('0x36')](handleEntityNotFound(_0x3cd39a,null))[_0xe90d('0x36')](function(_0x3a8e8f){if(_0x3a8e8f){return _0x3a8e8f[_0xe90d('0x93')](_0x43a535[_0xe90d('0x58')]['ids'],_[_0xe90d('0x94')](_0x43a535['body'],['ids','id'])||{})[_0xe90d('0x95')](function(_0xec2c7e){for(var _0x1155fa=0x0;_0x1155fa<_0x43a535['body'][_0xe90d('0x72')][_0xe90d('0x54')];_0x1155fa+=0x1){socket[_0xe90d('0x79')](_0xe90d('0x7a'),{'UserId':Number(_0x43a535['body']['ids'][_0x1155fa]),'ChatQueueId':Number(_0x43a535['params']['id'])});}return _0xec2c7e;});}})[_0xe90d('0x36')](respondWithResult(_0x3cd39a,null))['catch'](handleError(_0x3cd39a,null));};exports['removeAgents']=function(_0x1f58df,_0x4e917e,_0x588683){return db[_0xe90d('0x4d')][_0xe90d('0x56')]({'where':{'id':_0x1f58df[_0xe90d('0x51')]['id']}})[_0xe90d('0x36')](handleEntityNotFound(_0x4e917e,null))[_0xe90d('0x36')](function(_0x43ca74){if(_0x43ca74){return _0x43ca74['removeAgents'](_0x1f58df['query']['ids'])[_0xe90d('0x36')](function(){if(_[_0xe90d('0x96')](_0x1f58df[_0xe90d('0x40')][_0xe90d('0x72')])){for(var _0x287643=0x0;_0x287643<_0x1f58df[_0xe90d('0x40')][_0xe90d('0x72')][_0xe90d('0x54')];_0x287643+=0x1){socket[_0xe90d('0x79')](_0xe90d('0x92'),{'UserId':Number(_0x1f58df[_0xe90d('0x40')][_0xe90d('0x72')][_0x287643]),'ChatQueueId':Number(_0x1f58df['params']['id'])});}}else{socket[_0xe90d('0x79')]('userChatQueue:remove',{'UserId':Number(_0x1f58df[_0xe90d('0x40')][_0xe90d('0x72')]),'ChatQueueId':Number(_0x1f58df[_0xe90d('0x51')]['id'])});}});}})[_0xe90d('0x36')](respondWithStatusCode(_0x4e917e,null))['catch'](handleError(_0x4e917e,null));};exports[_0xe90d('0x97')]=function(_0x1a9870,_0x281581,_0x19947b){var _0x2185ca={};var _0x5acf62={};var _0x10f0d3;var _0x49dd5d;return db[_0xe90d('0x4d')][_0xe90d('0x62')]({'where':{'id':_0x1a9870[_0xe90d('0x51')]['id']}})[_0xe90d('0x36')](handleEntityNotFound(_0x281581,null))[_0xe90d('0x36')](function(_0x1836ae){if(_0x1836ae){_0x10f0d3=_0x1836ae;_0x5acf62[_0xe90d('0x52')]=_[_0xe90d('0x53')](db[_0xe90d('0x67')][_0xe90d('0x70')]);_0x5acf62[_0xe90d('0x40')]=_[_0xe90d('0x53')](_0x1a9870['query']);_0x5acf62[_0xe90d('0x48')]=_[_0xe90d('0x41')](_0x5acf62['model'],_0x5acf62[_0xe90d('0x40')]);_0x2185ca['attributes']=_[_0xe90d('0x41')](_0x5acf62[_0xe90d('0x52')],qs[_0xe90d('0x43')](_0x1a9870['query'][_0xe90d('0x43')]));_0x2185ca[_0xe90d('0x42')]=_0x2185ca[_0xe90d('0x42')][_0xe90d('0x54')]?_0x2185ca[_0xe90d('0x42')]:_0x5acf62[_0xe90d('0x52')];_0x2185ca[_0xe90d('0x45')]=qs[_0xe90d('0x46')](_0x1a9870[_0xe90d('0x40')]['sort']);_0x2185ca['where']=qs[_0xe90d('0x48')](_['pick'](_0x1a9870[_0xe90d('0x40')],_0x5acf62[_0xe90d('0x48')]));if(_0x1a9870[_0xe90d('0x40')][_0xe90d('0x49')]){_0x2185ca[_0xe90d('0x47')]=_[_0xe90d('0x4b')](_0x2185ca[_0xe90d('0x47')],{'$or':_[_0xe90d('0x3d')](_0x2185ca[_0xe90d('0x42')],function(_0x171dc9){var _0x77e66b={};_0x77e66b[_0x171dc9]={'$like':'%'+_0x1a9870[_0xe90d('0x40')][_0xe90d('0x49')]+'%'};return _0x77e66b;})});}_0x2185ca=_[_0xe90d('0x4b')]({},_0x2185ca,_0x1a9870[_0xe90d('0x4c')]);return _0x10f0d3[_0xe90d('0x97')](_0x2185ca);}})['then'](function(_0x2586d9){if(_0x2586d9){_0x49dd5d=_0x2586d9[_0xe90d('0x54')];if(!_0x1a9870[_0xe90d('0x40')][_0xe90d('0x64')]('nolimit')){_0x2185ca[_0xe90d('0x31')]=qs[_0xe90d('0x31')](_0x1a9870[_0xe90d('0x40')][_0xe90d('0x31')]);_0x2185ca['offset']=qs['offset'](_0x1a9870[_0xe90d('0x40')][_0xe90d('0x2e')]);}return _0x10f0d3['getAgents'](_0x2185ca);}})[_0xe90d('0x36')](function(_0x3f931a){if(_0x3f931a){return _0x3f931a?{'count':_0x49dd5d,'rows':_0x3f931a}:null;}})[_0xe90d('0x36')](respondWithResult(_0x281581,null))[_0xe90d('0x2a')](handleError(_0x281581,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 01144d8..1679d0f 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 _0x095b=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x095b,0x15c));var _0xb095=function(_0x3e4f32,_0x42e124){_0x3e4f32=_0x3e4f32-0x0;var _0x56b8be=_0x095b[_0x3e4f32];return _0x56b8be;};'use strict';var EventEmitter=require(_0xb095('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xb095('0x1')](0x0);var events={'afterCreate':_0xb095('0x2'),'afterUpdate':_0xb095('0x3'),'afterDestroy':_0xb095('0x4')};function emitEvent(_0x4116f1){return function(_0x216e89,_0x27156d,_0x3f526e){ChatQueueEvents[_0xb095('0x5')](_0x4116f1+':'+_0x216e89['id'],_0x216e89);ChatQueueEvents[_0xb095('0x5')](_0x4116f1,_0x216e89);_0x3f526e(null);};}for(var e in events){if(events[_0xb095('0x6')](e)){var event=events[e];ChatQueue[_0xb095('0x7')](e,emitEvent(event));}}module[_0xb095('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xb6b5=['ChatQueue','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0xad39fd,_0x4c2a11){var _0x4cf584=function(_0x4aeace){while(--_0x4aeace){_0xad39fd['push'](_0xad39fd['shift']());}};_0x4cf584(++_0x4c2a11);}(_0xb6b5,0xaf));var _0x5b6b=function(_0x4b185e,_0x31c299){_0x4b185e=_0x4b185e-0x0;var _0x558b84=_0xb6b5[_0x4b185e];return _0x558b84;};'use strict';var EventEmitter=require(_0x5b6b('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x5b6b('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5b6b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b6b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x180244){return function(_0x2602e9,_0x37b1e1,_0x3a3b29){ChatQueueEvents[_0x5b6b('0x4')](_0x180244+':'+_0x2602e9['id'],_0x2602e9);ChatQueueEvents[_0x5b6b('0x4')](_0x180244,_0x2602e9);_0x3a3b29(null);};}for(var e in events){if(events[_0x5b6b('0x5')](e)){var event=events[e];ChatQueue[_0x5b6b('0x6')](e,emitEvent(event));}}module[_0x5b6b('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index c78af95..bb08ffa 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 _0xb99c=['exports','define','chat_queues','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x2cbbc1,_0x2a97c2){var _0x6644a8=function(_0x4d75d4){while(--_0x4d75d4){_0x2cbbc1['push'](_0x2cbbc1['shift']());}};_0x6644a8(++_0x2a97c2);}(_0xb99c,0x1b0));var _0xcb99=function(_0x101504,_0x4598b0){_0x101504=_0x101504-0x0;var _0x1b7547=_0xb99c[_0x101504];return _0x1b7547;};'use strict';var _=require(_0xcb99('0x0'));var util=require(_0xcb99('0x1'));var logger=require(_0xcb99('0x2'))(_0xcb99('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb99('0x4'));var rimraf=require(_0xcb99('0x5'));var config=require(_0xcb99('0x6'));var attributes=require(_0xcb99('0x7'));module[_0xcb99('0x8')]=function(_0x446747,_0x41d380){return _0x446747[_0xcb99('0x9')]('ChatQueue',attributes,{'tableName':_0xcb99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0003=['../../config/logger','moment','rimraf','../../config/environment','define','chat_queues','lodash'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0x0003,0x148));var _0x3000=function(_0x2311bf,_0x4edd75){_0x2311bf=_0x2311bf-0x0;var _0x1e49b3=_0x0003[_0x2311bf];return _0x1e49b3;};'use strict';var _=require(_0x3000('0x0'));var util=require('util');var logger=require(_0x3000('0x1'))('api');var moment=require(_0x3000('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3000('0x3'));var config=require(_0x3000('0x4'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x7b8026,_0x129e50){return _0x7b8026[_0x3000('0x5')]('ChatQueue',attributes,{'tableName':_0x3000('0x6'),'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 de496bd..1a68966 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 _0xf3f9=['info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetChatQueue','findAll','options','where','limit','map','include','model','ShowChatQueue','ChatQueue','find','attributes','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','socket.io-emitter','./chatQueue.socket','request','then'];(function(_0x5c7fa4,_0x310ea2){var _0x280569=function(_0x1b8cbf){while(--_0x1b8cbf){_0x5c7fa4['push'](_0x5c7fa4['shift']());}};_0x280569(++_0x310ea2);}(_0xf3f9,0x1de));var _0x9f3f=function(_0x4f8282,_0x3543ee){_0x4f8282=_0x4f8282-0x0;var _0x2ced9e=_0xf3f9[_0x4f8282];return _0x2ced9e;};'use strict';var _=require(_0x9f3f('0x0'));var util=require(_0x9f3f('0x1'));var moment=require('moment');var BPromise=require(_0x9f3f('0x2'));var rs=require(_0x9f3f('0x3'));var fs=require('fs');var Redis=require(_0x9f3f('0x4'));var db=require(_0x9f3f('0x5'))['db'];var utils=require(_0x9f3f('0x6'));var logger=require(_0x9f3f('0x7'))(_0x9f3f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9f3f('0x9')]['http']({'port':0x232a});config[_0x9f3f('0xa')]=_['defaults'](config[_0x9f3f('0xa')],{'host':_0x9f3f('0xb'),'port':0x18eb});var socket=require(_0x9f3f('0xc'))(new Redis(config['redis']));require(_0x9f3f('0xd'))['register'](socket);function respondWithRpcPromise(_0x5d8a08,_0x5add2e,_0x52806e){return new BPromise(function(_0x435966,_0x3cd7a8){return client[_0x9f3f('0xe')](_0x5d8a08,_0x52806e)[_0x9f3f('0xf')](function(_0xd63ce8){logger[_0x9f3f('0x10')](_0x9f3f('0x11'),_0x5add2e,_0x9f3f('0x12'));logger[_0x9f3f('0x13')](_0x9f3f('0x14'),_0x5add2e,_0x9f3f('0x12'),JSON[_0x9f3f('0x15')](_0xd63ce8));if(_0xd63ce8['error']){if(_0xd63ce8[_0x9f3f('0x16')][_0x9f3f('0x17')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x5add2e,_0xd63ce8[_0x9f3f('0x16')][_0x9f3f('0x18')]);return _0x3cd7a8(_0xd63ce8[_0x9f3f('0x16')][_0x9f3f('0x18')]);}logger[_0x9f3f('0x16')](_0x9f3f('0x11'),_0x5add2e,_0xd63ce8['error'][_0x9f3f('0x18')]);return _0x435966(_0xd63ce8[_0x9f3f('0x16')][_0x9f3f('0x18')]);}else{logger[_0x9f3f('0x10')](_0x9f3f('0x11'),_0x5add2e,_0x9f3f('0x12'));_0x435966(_0xd63ce8['result'][_0x9f3f('0x18')]);}})['catch'](function(_0x1b8706){logger[_0x9f3f('0x16')]('ChatQueue,\x20%s,\x20%s',_0x5add2e,_0x1b8706);_0x3cd7a8(_0x1b8706);});});}exports[_0x9f3f('0x19')]=function(_0x8363f){var _0x420511=this;return new Promise(function(_0x43d9e6,_0x4ac7c0){return db['ChatQueue'][_0x9f3f('0x1a')]({'raw':_0x8363f['options']?_0x8363f[_0x9f3f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x8363f['options']?_0x8363f[_0x9f3f('0x1b')][_0x9f3f('0x1c')]||null:null,'attributes':_0x8363f['options']?_0x8363f[_0x9f3f('0x1b')]['attributes']||null:null,'limit':_0x8363f['options']?_0x8363f[_0x9f3f('0x1b')][_0x9f3f('0x1d')]||null:null,'include':_0x8363f[_0x9f3f('0x1b')]?_0x8363f[_0x9f3f('0x1b')]['include']?_[_0x9f3f('0x1e')](_0x8363f['options'][_0x9f3f('0x1f')],function(_0x1ef969){return{'model':db[_0x1ef969[_0x9f3f('0x20')]],'as':_0x1ef969['as'],'attributes':_0x1ef969['attributes'],'include':_0x1ef969[_0x9f3f('0x1f')]?_[_0x9f3f('0x1e')](_0x1ef969[_0x9f3f('0x1f')],function(_0x829555){return{'model':db[_0x829555[_0x9f3f('0x20')]],'as':_0x829555['as'],'attributes':_0x829555['attributes'],'include':_0x829555['include']?_[_0x9f3f('0x1e')](_0x829555['include'],function(_0x3b43c7){return{'model':db[_0x3b43c7[_0x9f3f('0x20')]],'as':_0x3b43c7['as'],'attributes':_0x3b43c7['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f3f('0xf')](function(_0x571c96){logger['info']('GetChatQueue',_0x8363f);logger['debug'](_0x9f3f('0x19'),_0x8363f,JSON[_0x9f3f('0x15')](_0x571c96));_0x43d9e6(_0x571c96);})['catch'](function(_0x3a5be4){logger[_0x9f3f('0x16')](_0x9f3f('0x19'),_0x3a5be4[_0x9f3f('0x18')],_0x8363f);_0x4ac7c0(_0x420511[_0x9f3f('0x16')](0x1f4,_0x3a5be4['message']));});});};exports[_0x9f3f('0x21')]=function(_0x239924){var _0x377a0=this;return new Promise(function(_0x416ccc,_0x979f84){return db[_0x9f3f('0x22')][_0x9f3f('0x23')]({'raw':_0x239924[_0x9f3f('0x1b')]?_0x239924[_0x9f3f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x239924[_0x9f3f('0x1b')]?_0x239924[_0x9f3f('0x1b')][_0x9f3f('0x1c')]||null:null,'attributes':_0x239924[_0x9f3f('0x1b')]?_0x239924[_0x9f3f('0x1b')][_0x9f3f('0x24')]||null:null,'include':_0x239924[_0x9f3f('0x1b')]?_0x239924[_0x9f3f('0x1b')][_0x9f3f('0x1f')]?_['map'](_0x239924['options'][_0x9f3f('0x1f')],function(_0x1e49ab){return{'model':db[_0x1e49ab[_0x9f3f('0x20')]],'as':_0x1e49ab['as'],'attributes':_0x1e49ab[_0x9f3f('0x24')],'include':_0x1e49ab[_0x9f3f('0x1f')]?_[_0x9f3f('0x1e')](_0x1e49ab[_0x9f3f('0x1f')],function(_0x10cb48){return{'model':db[_0x10cb48[_0x9f3f('0x20')]],'as':_0x10cb48['as'],'attributes':_0x10cb48[_0x9f3f('0x24')],'include':_0x10cb48['include']?_[_0x9f3f('0x1e')](_0x10cb48[_0x9f3f('0x1f')],function(_0x5b434c){return{'model':db[_0x5b434c['model']],'as':_0x5b434c['as'],'attributes':_0x5b434c[_0x9f3f('0x24')]};}):[]};}):[]};}):[]:[]})[_0x9f3f('0xf')](function(_0x1a393d){logger[_0x9f3f('0x10')](_0x9f3f('0x21'),_0x239924);logger[_0x9f3f('0x13')]('ShowChatQueue',_0x239924,JSON[_0x9f3f('0x15')](_0x1a393d));_0x416ccc(_0x1a393d);})[_0x9f3f('0x25')](function(_0x3674bf){logger[_0x9f3f('0x16')](_0x9f3f('0x21'),_0x3674bf[_0x9f3f('0x18')],_0x239924);_0x979f84(_0x377a0[_0x9f3f('0x16')](0x1f4,_0x3674bf[_0x9f3f('0x18')]));});});}; \ No newline at end of file +var _0xa521=['request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','attributes','limit','include','model','map','GetChatQueue','find','where','ShowChatQueue','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','then','info','ChatQueue,\x20%s,\x20%s'];(function(_0xc18699,_0x242329){var _0x2ffa32=function(_0x1af89d){while(--_0x1af89d){_0xc18699['push'](_0xc18699['shift']());}};_0x2ffa32(++_0x242329);}(_0xa521,0xeb));var _0x1a52=function(_0x49361a,_0x9c19d2){_0x49361a=_0x49361a-0x0;var _0x3db465=_0xa521[_0x49361a];return _0x3db465;};'use strict';var _=require(_0x1a52('0x0'));var util=require(_0x1a52('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1a52('0x2'));var fs=require('fs');var Redis=require(_0x1a52('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a52('0x4'));var logger=require(_0x1a52('0x5'))(_0x1a52('0x6'));var config=require(_0x1a52('0x7'));var jayson=require(_0x1a52('0x8'));var client=jayson[_0x1a52('0x9')][_0x1a52('0xa')]({'port':0x232a});config[_0x1a52('0xb')]=_[_0x1a52('0xc')](config[_0x1a52('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0x1a52('0xd')](socket);function respondWithRpcPromise(_0x577463,_0x22dd37,_0x459066){return new BPromise(function(_0x234fbb,_0x3ecef9){return client['request'](_0x577463,_0x459066)[_0x1a52('0xe')](function(_0x4de7eb){logger[_0x1a52('0xf')](_0x1a52('0x10'),_0x22dd37,_0x1a52('0x11'));logger[_0x1a52('0x12')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x22dd37,_0x1a52('0x11'),JSON[_0x1a52('0x13')](_0x4de7eb));if(_0x4de7eb[_0x1a52('0x14')]){if(_0x4de7eb[_0x1a52('0x14')][_0x1a52('0x15')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x22dd37,_0x4de7eb['error']['message']);return _0x3ecef9(_0x4de7eb[_0x1a52('0x14')][_0x1a52('0x16')]);}logger[_0x1a52('0x14')](_0x1a52('0x10'),_0x22dd37,_0x4de7eb['error'][_0x1a52('0x16')]);return _0x234fbb(_0x4de7eb[_0x1a52('0x14')][_0x1a52('0x16')]);}else{logger[_0x1a52('0xf')](_0x1a52('0x10'),_0x22dd37,_0x1a52('0x11'));_0x234fbb(_0x4de7eb[_0x1a52('0x17')][_0x1a52('0x16')]);}})[_0x1a52('0x18')](function(_0x4392ff){logger[_0x1a52('0x14')]('ChatQueue,\x20%s,\x20%s',_0x22dd37,_0x4392ff);_0x3ecef9(_0x4392ff);});});}exports['GetChatQueue']=function(_0x28cb98){var _0x26334a=this;return new Promise(function(_0x104e97,_0x59db0a){return db['ChatQueue'][_0x1a52('0x19')]({'raw':_0x28cb98[_0x1a52('0x1a')]?_0x28cb98[_0x1a52('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x28cb98['options']?_0x28cb98[_0x1a52('0x1a')]['where']||null:null,'attributes':_0x28cb98[_0x1a52('0x1a')]?_0x28cb98[_0x1a52('0x1a')][_0x1a52('0x1b')]||null:null,'limit':_0x28cb98[_0x1a52('0x1a')]?_0x28cb98[_0x1a52('0x1a')][_0x1a52('0x1c')]||null:null,'include':_0x28cb98[_0x1a52('0x1a')]?_0x28cb98['options'][_0x1a52('0x1d')]?_['map'](_0x28cb98[_0x1a52('0x1a')][_0x1a52('0x1d')],function(_0x499a0){return{'model':db[_0x499a0[_0x1a52('0x1e')]],'as':_0x499a0['as'],'attributes':_0x499a0[_0x1a52('0x1b')],'include':_0x499a0[_0x1a52('0x1d')]?_['map'](_0x499a0[_0x1a52('0x1d')],function(_0x1fd2b5){return{'model':db[_0x1fd2b5[_0x1a52('0x1e')]],'as':_0x1fd2b5['as'],'attributes':_0x1fd2b5[_0x1a52('0x1b')],'include':_0x1fd2b5['include']?_[_0x1a52('0x1f')](_0x1fd2b5[_0x1a52('0x1d')],function(_0x2ea2ff){return{'model':db[_0x2ea2ff['model']],'as':_0x2ea2ff['as'],'attributes':_0x2ea2ff[_0x1a52('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c28e6){logger['info'](_0x1a52('0x20'),_0x28cb98);logger[_0x1a52('0x12')]('GetChatQueue',_0x28cb98,JSON['stringify'](_0x4c28e6));_0x104e97(_0x4c28e6);})[_0x1a52('0x18')](function(_0x4f5f9f){logger[_0x1a52('0x14')](_0x1a52('0x20'),_0x4f5f9f[_0x1a52('0x16')],_0x28cb98);_0x59db0a(_0x26334a[_0x1a52('0x14')](0x1f4,_0x4f5f9f[_0x1a52('0x16')]));});});};exports['ShowChatQueue']=function(_0x2c16de){var _0x369de0=this;return new Promise(function(_0x1dcc62,_0x22f58c){return db['ChatQueue'][_0x1a52('0x21')]({'raw':_0x2c16de[_0x1a52('0x1a')]?_0x2c16de['options']['raw']===undefined?!![]:![]:!![],'where':_0x2c16de[_0x1a52('0x1a')]?_0x2c16de[_0x1a52('0x1a')][_0x1a52('0x22')]||null:null,'attributes':_0x2c16de[_0x1a52('0x1a')]?_0x2c16de[_0x1a52('0x1a')][_0x1a52('0x1b')]||null:null,'include':_0x2c16de[_0x1a52('0x1a')]?_0x2c16de[_0x1a52('0x1a')][_0x1a52('0x1d')]?_[_0x1a52('0x1f')](_0x2c16de['options'][_0x1a52('0x1d')],function(_0x1a899f){return{'model':db[_0x1a899f['model']],'as':_0x1a899f['as'],'attributes':_0x1a899f[_0x1a52('0x1b')],'include':_0x1a899f[_0x1a52('0x1d')]?_['map'](_0x1a899f['include'],function(_0x5e5748){return{'model':db[_0x5e5748[_0x1a52('0x1e')]],'as':_0x5e5748['as'],'attributes':_0x5e5748[_0x1a52('0x1b')],'include':_0x5e5748['include']?_[_0x1a52('0x1f')](_0x5e5748[_0x1a52('0x1d')],function(_0x41d88b){return{'model':db[_0x41d88b[_0x1a52('0x1e')]],'as':_0x41d88b['as'],'attributes':_0x41d88b[_0x1a52('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x257347){logger[_0x1a52('0xf')]('ShowChatQueue',_0x2c16de);logger[_0x1a52('0x12')](_0x1a52('0x23'),_0x2c16de,JSON[_0x1a52('0x13')](_0x257347));_0x1dcc62(_0x257347);})[_0x1a52('0x18')](function(_0x4fcc15){logger[_0x1a52('0x14')](_0x1a52('0x23'),_0x4fcc15[_0x1a52('0x16')],_0x2c16de);_0x22f58c(_0x369de0[_0x1a52('0x14')](0x1f4,_0x4fcc15[_0x1a52('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 46dbdc9..5bb6523 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 _0xa37e=['chatQueue:','remove','update','emit','removeListener','register'];(function(_0x784064,_0x46982d){var _0x17c3e5=function(_0x249d02){while(--_0x249d02){_0x784064['push'](_0x784064['shift']());}};_0x17c3e5(++_0x46982d);}(_0xa37e,0x97));var _0xea37=function(_0x119293,_0x3ab79c){_0x119293=_0x119293-0x0;var _0x3a9661=_0xa37e[_0x119293];return _0x3a9661;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0xea37('0x0'),_0xea37('0x1')];function createListener(_0x204a22,_0x475c71){return function(_0x5430aa){_0x475c71[_0xea37('0x2')](_0x204a22,_0x5430aa);};}function removeListener(_0x537c5a,_0x360ed5){return function(){ChatQueueEvents[_0xea37('0x3')](_0x537c5a,_0x360ed5);};}exports[_0xea37('0x4')]=function(_0x4d380b){for(var _0x57135b=0x0,_0x36c489=events['length'];_0x57135b<_0x36c489;_0x57135b++){var _0x4ae081=events[_0x57135b];var _0x2c2890=createListener(_0xea37('0x5')+_0x4ae081,_0x4d380b);ChatQueueEvents['on'](_0x4ae081,_0x2c2890);}}; \ No newline at end of file +var _0x5178=['remove','update','register','length','save'];(function(_0x649401,_0x43480a){var _0xaea28f=function(_0x5550c5){while(--_0x5550c5){_0x649401['push'](_0x649401['shift']());}};_0xaea28f(++_0x43480a);}(_0x5178,0x171));var _0x8517=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5178[_0x2dafbe];return _0x58a45a;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x8517('0x0'),_0x8517('0x1'),_0x8517('0x2')];function createListener(_0x2dc28f,_0x38d5b3){return function(_0x5e0a44){_0x38d5b3['emit'](_0x2dc28f,_0x5e0a44);};}function removeListener(_0x3ed6a5,_0x221184){return function(){ChatQueueEvents['removeListener'](_0x3ed6a5,_0x221184);};}exports[_0x8517('0x3')]=function(_0x58ed7e){for(var _0x13ba05=0x0,_0x45498e=events[_0x8517('0x4')];_0x13ba05<_0x45498e;_0x13ba05++){var _0x10f918=events[_0x13ba05];var _0x25146d=createListener('chatQueue:'+_0x10f918,_0x58ed7e);ChatQueueEvents['on'](_0x10f918,_0x25146d);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index bf8d6d2..7b93dc5 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x43efc1,_0x2f1605){var _0x56aa9d=function(_0x540db6){while(--_0x540db6){_0x43efc1['push'](_0x43efc1['shift']());}};_0x56aa9d(++_0x2f1605);}(_0xe14b,0x93));var _0xbe14=function(_0x535d75,_0x4bae1d){_0x535d75=_0x535d75-0x0;var _0x517a0f=_0xe14b[_0x535d75];return _0x517a0f;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xfd04b0,_0x431a5a){var _0x520b04=function(_0x465438){while(--_0x465438){_0xfd04b0['push'](_0xfd04b0['shift']());}};_0x520b04(++_0x431a5a);}(_0x008c,0x188));var _0xc008=function(_0x56e027,_0x496a98){_0x56e027=_0x56e027-0x0;var _0x33ffc4=_0x008c[_0x56e027];return _0x33ffc4;};'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 e55cdcf..7f6107e 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 _0x2c40=['DATE','sequelize','exports','STRING'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x2c40,0xfd));var _0x02c4=function(_0x412b89,_0x1a57a7){_0x412b89=_0x412b89-0x0;var _0x164aac=_0x2c40[_0x412b89];return _0x164aac;};'use strict';var moment=require('moment');var Sequelize=require(_0x02c4('0x0'));module[_0x02c4('0x1')]={'uniqueid':{'type':Sequelize[_0x02c4('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x02c4('0x2')]},'joinAt':{'type':Sequelize[_0x02c4('0x3')]},'leaveAt':{'type':Sequelize[_0x02c4('0x3')]},'acceptAt':{'type':Sequelize[_0x02c4('0x3')]},'exitAt':{'type':Sequelize[_0x02c4('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0f9f=['sequelize','exports','STRING','DATE','moment'];(function(_0x2b9e64,_0x405a2d){var _0x452cbe=function(_0x121721){while(--_0x121721){_0x2b9e64['push'](_0x2b9e64['shift']());}};_0x452cbe(++_0x405a2d);}(_0x0f9f,0xae));var _0xf0f9=function(_0x2b60bd,_0x49418d){_0x2b60bd=_0x2b60bd-0x0;var _0x3d9523=_0x0f9f[_0x2b60bd];return _0x3d9523;};'use strict';var moment=require(_0xf0f9('0x0'));var Sequelize=require(_0xf0f9('0x1'));module[_0xf0f9('0x2')]={'uniqueid':{'type':Sequelize[_0xf0f9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf0f9('0x3')]},'joinAt':{'type':Sequelize[_0xf0f9('0x4')]},'leaveAt':{'type':Sequelize[_0xf0f9('0x4')]},'acceptAt':{'type':Sequelize[_0xf0f9('0x4')]},'exitAt':{'type':Sequelize[_0xf0f9('0x4')]},'reason':{'type':Sequelize[_0xf0f9('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 7ef8673..d6cd3c3 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 _0x7e02=['destroy','end','error','stack','name','map','ChatQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','options','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','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','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','apply','then'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x7e02,0x71));var _0x27e0=function(_0x543865,_0x502676){_0x543865=_0x543865-0x0;var _0x1d3e67=_0x7e02[_0x543865];return _0x1d3e67;};'use strict';var emlformat=require(_0x27e0('0x0'));var rimraf=require(_0x27e0('0x1'));var zipdir=require(_0x27e0('0x2'));var jsonpatch=require(_0x27e0('0x3'));var rp=require(_0x27e0('0x4'));var moment=require(_0x27e0('0x5'));var BPromise=require(_0x27e0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x27e0('0x7'));var sox=require('sox');var csv=require(_0x27e0('0x8'));var ejs=require(_0x27e0('0x9'));var fs=require('fs');var fs_extra=require(_0x27e0('0xa'));var _=require(_0x27e0('0xb'));var squel=require(_0x27e0('0xc'));var crypto=require(_0x27e0('0xd'));var jsforce=require(_0x27e0('0xe'));var deskjs=require(_0x27e0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27e0('0x10'));var Papa=require('papaparse');var Redis=require(_0x27e0('0x11'));var authService=require(_0x27e0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x27e0('0x13'));var hardwareService=require(_0x27e0('0x14'));var logger=require(_0x27e0('0x15'))(_0x27e0('0x16'));var utils=require(_0x27e0('0x17'));var config=require(_0x27e0('0x18'));var licenseUtil=require(_0x27e0('0x19'));var db=require(_0x27e0('0x1a'))['db'];function respondWithStatusCode(_0x31ef33,_0x492c65){_0x492c65=_0x492c65||0xcc;return function(_0x156bea){if(_0x156bea){return _0x31ef33[_0x27e0('0x1b')](_0x492c65);}return _0x31ef33[_0x27e0('0x1c')](_0x492c65)['end']();};}function respondWithResult(_0x39fb61,_0x3a67ab){_0x3a67ab=_0x3a67ab||0xc8;return function(_0x473128){if(_0x473128){return _0x39fb61['status'](_0x3a67ab)[_0x27e0('0x1d')](_0x473128);}};}function respondWithFilteredResult(_0x220128,_0x1f7532){return function(_0xf326e2){if(_0xf326e2){var _0x5b1b6e=typeof _0x1f7532['offset']===_0x27e0('0x1e')&&typeof _0x1f7532[_0x27e0('0x1f')]===_0x27e0('0x1e');var _0x2111e=_0xf326e2['count'];var _0x32597b=_0x5b1b6e?0x0:_0x1f7532[_0x27e0('0x20')];var _0x12a91f=_0x5b1b6e?_0xf326e2[_0x27e0('0x21')]:_0x1f7532[_0x27e0('0x20')]+_0x1f7532[_0x27e0('0x1f')];var _0x4d9edc;if(_0x12a91f>=_0x2111e){_0x12a91f=_0x2111e;_0x4d9edc=0xc8;}else{_0x4d9edc=0xce;}_0x220128[_0x27e0('0x1c')](_0x4d9edc);return _0x220128[_0x27e0('0x22')]('Content-Range',_0x32597b+'-'+_0x12a91f+'/'+_0x2111e)[_0x27e0('0x1d')](_0xf326e2);}return null;};}function patchUpdates(_0x23df66){return function(_0x32c2ff){try{jsonpatch[_0x27e0('0x23')](_0x32c2ff,_0x23df66,!![]);}catch(_0x408d95){return BPromise['reject'](_0x408d95);}return _0x32c2ff['save']();};}function saveUpdates(_0x57897e,_0x1ef3aa){return function(_0x11f4ca){if(_0x11f4ca){return _0x11f4ca['update'](_0x57897e)[_0x27e0('0x24')](function(_0xee6318){return _0xee6318;});}return null;};}function removeEntity(_0x32503e,_0x6f83ee){return function(_0xd857c2){if(_0xd857c2){return _0xd857c2[_0x27e0('0x25')]()[_0x27e0('0x24')](function(){_0x32503e[_0x27e0('0x1c')](0xcc)[_0x27e0('0x26')]();});}};}function handleEntityNotFound(_0x3068c4,_0x1e5060){return function(_0x27dc43){if(!_0x27dc43){_0x3068c4[_0x27e0('0x1b')](0x194);}return _0x27dc43;};}function handleError(_0x3d4691,_0xab503d){_0xab503d=_0xab503d||0x1f4;return function(_0x581ec9){logger[_0x27e0('0x27')](_0x581ec9[_0x27e0('0x28')]);if(_0x581ec9[_0x27e0('0x29')]){delete _0x581ec9[_0x27e0('0x29')];}_0x3d4691[_0x27e0('0x1c')](_0xab503d)['send'](_0x581ec9);};}exports['index']=function(_0x29114d,_0x3e2c4b){var _0x141c40={},_0x304fe6={},_0x57bcc1={'count':0x0,'rows':[]};var _0x4f5ea2=_[_0x27e0('0x2a')](db[_0x27e0('0x2b')]['rawAttributes'],function(_0x55d752){return{'name':_0x55d752['fieldName'],'type':_0x55d752[_0x27e0('0x2c')][_0x27e0('0x2d')]};});_0x304fe6[_0x27e0('0x2e')]=_[_0x27e0('0x2a')](_0x4f5ea2,'name');_0x304fe6[_0x27e0('0x2f')]=_[_0x27e0('0x30')](_0x29114d[_0x27e0('0x2f')]);_0x304fe6[_0x27e0('0x31')]=_[_0x27e0('0x32')](_0x304fe6[_0x27e0('0x2e')],_0x304fe6[_0x27e0('0x2f')]);_0x141c40[_0x27e0('0x33')]=_[_0x27e0('0x32')](_0x304fe6[_0x27e0('0x2e')],qs['fields'](_0x29114d[_0x27e0('0x2f')][_0x27e0('0x34')]));_0x141c40['attributes']=_0x141c40['attributes'][_0x27e0('0x35')]?_0x141c40[_0x27e0('0x33')]:_0x304fe6[_0x27e0('0x2e')];if(!_0x29114d['query'][_0x27e0('0x36')](_0x27e0('0x37'))){_0x141c40['limit']=qs[_0x27e0('0x1f')](_0x29114d[_0x27e0('0x2f')]['limit']);_0x141c40[_0x27e0('0x20')]=qs[_0x27e0('0x20')](_0x29114d['query'][_0x27e0('0x20')]);}_0x141c40[_0x27e0('0x38')]=qs['sort'](_0x29114d['query'][_0x27e0('0x39')]);_0x141c40[_0x27e0('0x3a')]=qs[_0x27e0('0x31')](_[_0x27e0('0x3b')](_0x29114d['query'],_0x304fe6[_0x27e0('0x31')]),_0x4f5ea2);if(_0x29114d['query'][_0x27e0('0x3c')]){_0x141c40[_0x27e0('0x3a')]=_[_0x27e0('0x3d')](_0x141c40['where'],{'$or':_[_0x27e0('0x2a')](_0x4f5ea2,function(_0x213540){if(_0x213540['type']!=='VIRTUAL'){var _0x2763ec={};_0x2763ec[_0x213540[_0x27e0('0x29')]]={'$like':'%'+_0x29114d[_0x27e0('0x2f')][_0x27e0('0x3c')]+'%'};return _0x2763ec;}})});}_0x141c40=_['merge']({},_0x141c40,_0x29114d['options']);var _0x5f5b65={'where':_0x141c40[_0x27e0('0x3a')]};return db[_0x27e0('0x2b')]['count'](_0x5f5b65)['then'](function(_0x4a6856){_0x57bcc1[_0x27e0('0x21')]=_0x4a6856;if(_0x29114d[_0x27e0('0x2f')][_0x27e0('0x3e')]){_0x141c40[_0x27e0('0x3f')]=[{'all':!![]}];}return db[_0x27e0('0x2b')][_0x27e0('0x40')](_0x141c40);})[_0x27e0('0x24')](function(_0x3f81ba){_0x57bcc1[_0x27e0('0x41')]=_0x3f81ba;return _0x57bcc1;})[_0x27e0('0x24')](respondWithFilteredResult(_0x3e2c4b,_0x141c40))[_0x27e0('0x42')](handleError(_0x3e2c4b,null));};exports[_0x27e0('0x43')]=function(_0x4227c0,_0x6c37db){var _0x2f6005={'raw':!![],'where':{'id':_0x4227c0['params']['id']}},_0x535260={};_0x535260[_0x27e0('0x2e')]=_[_0x27e0('0x30')](db['ChatQueueReport']['rawAttributes']);_0x535260['query']=_[_0x27e0('0x30')](_0x4227c0[_0x27e0('0x2f')]);_0x535260['filters']=_['intersection'](_0x535260[_0x27e0('0x2e')],_0x535260[_0x27e0('0x2f')]);_0x2f6005[_0x27e0('0x33')]=_[_0x27e0('0x32')](_0x535260[_0x27e0('0x2e')],qs[_0x27e0('0x34')](_0x4227c0[_0x27e0('0x2f')][_0x27e0('0x34')]));_0x2f6005[_0x27e0('0x33')]=_0x2f6005[_0x27e0('0x33')][_0x27e0('0x35')]?_0x2f6005[_0x27e0('0x33')]:_0x535260[_0x27e0('0x2e')];if(_0x4227c0[_0x27e0('0x2f')][_0x27e0('0x3e')]){_0x2f6005[_0x27e0('0x3f')]=[{'all':!![]}];}_0x2f6005=_[_0x27e0('0x3d')]({},_0x2f6005,_0x4227c0[_0x27e0('0x44')]);return db[_0x27e0('0x2b')][_0x27e0('0x45')](_0x2f6005)[_0x27e0('0x24')](handleEntityNotFound(_0x6c37db,null))[_0x27e0('0x24')](respondWithResult(_0x6c37db,null))[_0x27e0('0x42')](handleError(_0x6c37db,null));};exports[_0x27e0('0x46')]=function(_0x24058f,_0x22cd05){return db[_0x27e0('0x2b')][_0x27e0('0x46')](_0x24058f['body'],{})['then'](respondWithResult(_0x22cd05,0xc9))[_0x27e0('0x42')](handleError(_0x22cd05,null));};exports[_0x27e0('0x47')]=function(_0x5322c9,_0x58aef9){if(_0x5322c9[_0x27e0('0x48')]['id']){delete _0x5322c9[_0x27e0('0x48')]['id'];}return db[_0x27e0('0x2b')][_0x27e0('0x45')]({'where':{'id':_0x5322c9[_0x27e0('0x49')]['id']}})[_0x27e0('0x24')](handleEntityNotFound(_0x58aef9,null))[_0x27e0('0x24')](saveUpdates(_0x5322c9['body'],null))['then'](respondWithResult(_0x58aef9,null))[_0x27e0('0x42')](handleError(_0x58aef9,null));};exports[_0x27e0('0x25')]=function(_0xca08c,_0x29241d){return db[_0x27e0('0x2b')][_0x27e0('0x45')]({'where':{'id':_0xca08c['params']['id']}})['then'](handleEntityNotFound(_0x29241d,null))[_0x27e0('0x24')](removeEntity(_0x29241d,null))[_0x27e0('0x42')](handleError(_0x29241d,null));};exports[_0x27e0('0x4a')]=function(_0x315f2f,_0x4d7f5a){return db['ChatQueueReport'][_0x27e0('0x4a')]()[_0x27e0('0x24')](respondWithResult(_0x4d7f5a,null))['catch'](handleError(_0x4d7f5a,null));}; \ No newline at end of file +var _0xaf1b=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','ChatQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','intersection','includeAll','include','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset'];(function(_0x18cabd,_0x44aafe){var _0x274e86=function(_0x13b9a9){while(--_0x13b9a9){_0x18cabd['push'](_0x18cabd['shift']());}};_0x274e86(++_0x44aafe);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x460ef9,_0x4c2880){_0x460ef9=_0x460ef9-0x0;var _0x3ceebd=_0xaf1b[_0x460ef9];return _0x3ceebd;};'use strict';var emlformat=require(_0xbaf1('0x0'));var rimraf=require(_0xbaf1('0x1'));var zipdir=require(_0xbaf1('0x2'));var jsonpatch=require(_0xbaf1('0x3'));var rp=require(_0xbaf1('0x4'));var moment=require(_0xbaf1('0x5'));var BPromise=require(_0xbaf1('0x6'));var Mustache=require(_0xbaf1('0x7'));var util=require(_0xbaf1('0x8'));var path=require(_0xbaf1('0x9'));var sox=require(_0xbaf1('0xa'));var csv=require(_0xbaf1('0xb'));var ejs=require(_0xbaf1('0xc'));var fs=require('fs');var fs_extra=require(_0xbaf1('0xd'));var _=require('lodash');var squel=require(_0xbaf1('0xe'));var crypto=require('crypto');var jsforce=require(_0xbaf1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbaf1('0xb'));var querystring=require(_0xbaf1('0x10'));var Papa=require(_0xbaf1('0x11'));var Redis=require('ioredis');var authService=require(_0xbaf1('0x12'));var qs=require(_0xbaf1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbaf1('0x14'));var logger=require('../../config/logger')(_0xbaf1('0x15'));var utils=require(_0xbaf1('0x16'));var config=require(_0xbaf1('0x17'));var licenseUtil=require(_0xbaf1('0x18'));var db=require(_0xbaf1('0x19'))['db'];function respondWithStatusCode(_0x36ec1c,_0x50de02){_0x50de02=_0x50de02||0xcc;return function(_0x493f3f){if(_0x493f3f){return _0x36ec1c[_0xbaf1('0x1a')](_0x50de02);}return _0x36ec1c[_0xbaf1('0x1b')](_0x50de02)[_0xbaf1('0x1c')]();};}function respondWithResult(_0xb6f7d8,_0x1d94da){_0x1d94da=_0x1d94da||0xc8;return function(_0x1097d6){if(_0x1097d6){return _0xb6f7d8[_0xbaf1('0x1b')](_0x1d94da)['json'](_0x1097d6);}};}function respondWithFilteredResult(_0x32981b,_0x173cb6){return function(_0xb9ac72){if(_0xb9ac72){var _0x342c11=typeof _0x173cb6[_0xbaf1('0x1d')]===_0xbaf1('0x1e')&&typeof _0x173cb6[_0xbaf1('0x1f')]===_0xbaf1('0x1e');var _0x58d217=_0xb9ac72[_0xbaf1('0x20')];var _0x4f4527=_0x342c11?0x0:_0x173cb6[_0xbaf1('0x1d')];var _0x3b13b2=_0x342c11?_0xb9ac72[_0xbaf1('0x20')]:_0x173cb6[_0xbaf1('0x1d')]+_0x173cb6['limit'];var _0x43291c;if(_0x3b13b2>=_0x58d217){_0x3b13b2=_0x58d217;_0x43291c=0xc8;}else{_0x43291c=0xce;}_0x32981b['status'](_0x43291c);return _0x32981b[_0xbaf1('0x21')](_0xbaf1('0x22'),_0x4f4527+'-'+_0x3b13b2+'/'+_0x58d217)['json'](_0xb9ac72);}return null;};}function patchUpdates(_0xd579de){return function(_0x33c524){try{jsonpatch[_0xbaf1('0x23')](_0x33c524,_0xd579de,!![]);}catch(_0x19f4d8){return BPromise[_0xbaf1('0x24')](_0x19f4d8);}return _0x33c524[_0xbaf1('0x25')]();};}function saveUpdates(_0x5b9f50,_0x487d25){return function(_0x3cb56b){if(_0x3cb56b){return _0x3cb56b[_0xbaf1('0x26')](_0x5b9f50)[_0xbaf1('0x27')](function(_0x496344){return _0x496344;});}return null;};}function removeEntity(_0x2e71ce,_0xefc243){return function(_0x40a0fa){if(_0x40a0fa){return _0x40a0fa['destroy']()[_0xbaf1('0x27')](function(){_0x2e71ce['status'](0xcc)[_0xbaf1('0x1c')]();});}};}function handleEntityNotFound(_0x181c9d,_0xae3b42){return function(_0x2afb55){if(!_0x2afb55){_0x181c9d[_0xbaf1('0x1a')](0x194);}return _0x2afb55;};}function handleError(_0x480835,_0x5d13d4){_0x5d13d4=_0x5d13d4||0x1f4;return function(_0x1cfbcd){logger[_0xbaf1('0x28')](_0x1cfbcd[_0xbaf1('0x29')]);if(_0x1cfbcd[_0xbaf1('0x2a')]){delete _0x1cfbcd['name'];}_0x480835[_0xbaf1('0x1b')](_0x5d13d4)['send'](_0x1cfbcd);};}exports[_0xbaf1('0x2b')]=function(_0x23d96a,_0x35fdc){var _0x17f2ea={},_0x2ccd80={},_0x3abb17={'count':0x0,'rows':[]};var _0x32bb6f=_['map'](db[_0xbaf1('0x2c')][_0xbaf1('0x2d')],function(_0x1a523d){return{'name':_0x1a523d[_0xbaf1('0x2e')],'type':_0x1a523d[_0xbaf1('0x2f')][_0xbaf1('0x30')]};});_0x2ccd80[_0xbaf1('0x31')]=_[_0xbaf1('0x32')](_0x32bb6f,'name');_0x2ccd80[_0xbaf1('0x33')]=_[_0xbaf1('0x34')](_0x23d96a[_0xbaf1('0x33')]);_0x2ccd80[_0xbaf1('0x35')]=_['intersection'](_0x2ccd80[_0xbaf1('0x31')],_0x2ccd80['query']);_0x17f2ea[_0xbaf1('0x36')]=_['intersection'](_0x2ccd80[_0xbaf1('0x31')],qs[_0xbaf1('0x37')](_0x23d96a[_0xbaf1('0x33')][_0xbaf1('0x37')]));_0x17f2ea['attributes']=_0x17f2ea[_0xbaf1('0x36')][_0xbaf1('0x38')]?_0x17f2ea[_0xbaf1('0x36')]:_0x2ccd80[_0xbaf1('0x31')];if(!_0x23d96a[_0xbaf1('0x33')][_0xbaf1('0x39')](_0xbaf1('0x3a'))){_0x17f2ea['limit']=qs[_0xbaf1('0x1f')](_0x23d96a[_0xbaf1('0x33')][_0xbaf1('0x1f')]);_0x17f2ea[_0xbaf1('0x1d')]=qs[_0xbaf1('0x1d')](_0x23d96a[_0xbaf1('0x33')][_0xbaf1('0x1d')]);}_0x17f2ea['order']=qs[_0xbaf1('0x3b')](_0x23d96a['query'][_0xbaf1('0x3b')]);_0x17f2ea[_0xbaf1('0x3c')]=qs[_0xbaf1('0x35')](_[_0xbaf1('0x3d')](_0x23d96a[_0xbaf1('0x33')],_0x2ccd80[_0xbaf1('0x35')]),_0x32bb6f);if(_0x23d96a[_0xbaf1('0x33')][_0xbaf1('0x3e')]){_0x17f2ea[_0xbaf1('0x3c')]=_['merge'](_0x17f2ea['where'],{'$or':_['map'](_0x32bb6f,function(_0x3e45aa){if(_0x3e45aa[_0xbaf1('0x2f')]!=='VIRTUAL'){var _0x2adc26={};_0x2adc26[_0x3e45aa[_0xbaf1('0x2a')]]={'$like':'%'+_0x23d96a[_0xbaf1('0x33')]['filter']+'%'};return _0x2adc26;}})});}_0x17f2ea=_[_0xbaf1('0x3f')]({},_0x17f2ea,_0x23d96a[_0xbaf1('0x40')]);var _0x3d2302={'where':_0x17f2ea['where']};return db[_0xbaf1('0x2c')][_0xbaf1('0x20')](_0x3d2302)['then'](function(_0x520ae2){_0x3abb17[_0xbaf1('0x20')]=_0x520ae2;if(_0x23d96a['query']['includeAll']){_0x17f2ea['include']=[{'all':!![]}];}return db[_0xbaf1('0x2c')][_0xbaf1('0x41')](_0x17f2ea);})[_0xbaf1('0x27')](function(_0x27c821){_0x3abb17[_0xbaf1('0x42')]=_0x27c821;return _0x3abb17;})[_0xbaf1('0x27')](respondWithFilteredResult(_0x35fdc,_0x17f2ea))[_0xbaf1('0x43')](handleError(_0x35fdc,null));};exports[_0xbaf1('0x44')]=function(_0x481722,_0x45f0b5){var _0x3d2785={'raw':!![],'where':{'id':_0x481722[_0xbaf1('0x45')]['id']}},_0x3d0793={};_0x3d0793['model']=_[_0xbaf1('0x34')](db['ChatQueueReport'][_0xbaf1('0x2d')]);_0x3d0793[_0xbaf1('0x33')]=_[_0xbaf1('0x34')](_0x481722['query']);_0x3d0793[_0xbaf1('0x35')]=_[_0xbaf1('0x46')](_0x3d0793[_0xbaf1('0x31')],_0x3d0793['query']);_0x3d2785[_0xbaf1('0x36')]=_['intersection'](_0x3d0793['model'],qs['fields'](_0x481722[_0xbaf1('0x33')][_0xbaf1('0x37')]));_0x3d2785[_0xbaf1('0x36')]=_0x3d2785[_0xbaf1('0x36')][_0xbaf1('0x38')]?_0x3d2785[_0xbaf1('0x36')]:_0x3d0793['model'];if(_0x481722[_0xbaf1('0x33')][_0xbaf1('0x47')]){_0x3d2785[_0xbaf1('0x48')]=[{'all':!![]}];}_0x3d2785=_[_0xbaf1('0x3f')]({},_0x3d2785,_0x481722[_0xbaf1('0x40')]);return db[_0xbaf1('0x2c')]['find'](_0x3d2785)[_0xbaf1('0x27')](handleEntityNotFound(_0x45f0b5,null))['then'](respondWithResult(_0x45f0b5,null))['catch'](handleError(_0x45f0b5,null));};exports[_0xbaf1('0x49')]=function(_0x12a9a1,_0x20328e){return db[_0xbaf1('0x2c')][_0xbaf1('0x49')](_0x12a9a1['body'],{})[_0xbaf1('0x27')](respondWithResult(_0x20328e,0xc9))['catch'](handleError(_0x20328e,null));};exports[_0xbaf1('0x26')]=function(_0x3f3b0d,_0xce46bc){if(_0x3f3b0d[_0xbaf1('0x4a')]['id']){delete _0x3f3b0d[_0xbaf1('0x4a')]['id'];}return db[_0xbaf1('0x2c')][_0xbaf1('0x4b')]({'where':{'id':_0x3f3b0d[_0xbaf1('0x45')]['id']}})[_0xbaf1('0x27')](handleEntityNotFound(_0xce46bc,null))[_0xbaf1('0x27')](saveUpdates(_0x3f3b0d[_0xbaf1('0x4a')],null))[_0xbaf1('0x27')](respondWithResult(_0xce46bc,null))[_0xbaf1('0x43')](handleError(_0xce46bc,null));};exports[_0xbaf1('0x4c')]=function(_0x364309,_0xad3fd3){return db['ChatQueueReport'][_0xbaf1('0x4b')]({'where':{'id':_0x364309[_0xbaf1('0x45')]['id']}})[_0xbaf1('0x27')](handleEntityNotFound(_0xad3fd3,null))[_0xbaf1('0x27')](removeEntity(_0xad3fd3,null))[_0xbaf1('0x43')](handleError(_0xad3fd3,null));};exports[_0xbaf1('0x4d')]=function(_0x3962b5,_0x312fd0){return db[_0xbaf1('0x2c')][_0xbaf1('0x4d')]()[_0xbaf1('0x27')](respondWithResult(_0x312fd0,null))['catch'](handleError(_0x312fd0,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 9d6f7f4..712fa62 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b6804,_0x301b24){_0x4b6804=_0x4b6804-0x0;var _0x11b4f1=_0xb10b[_0x4b6804];return _0x11b4f1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x3f31d6,_0x2c1ba9){var _0x464e22=function(_0x428b1f){while(--_0x428b1f){_0x3f31d6['push'](_0x3f31d6['shift']());}};_0x464e22(++_0x2c1ba9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));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 diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index eb08665..d362775 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 _0xce61=['options','then','CreateChatQueueReport','catch','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create','body'];(function(_0x12fe32,_0x1d5358){var _0x1701f5=function(_0x236080){while(--_0x236080){_0x12fe32['push'](_0x12fe32['shift']());}};_0x1701f5(++_0x1d5358);}(_0xce61,0x66));var _0x1ce6=function(_0x5b681b,_0x456997){_0x5b681b=_0x5b681b-0x0;var _0x1c27fd=_0xce61[_0x5b681b];return _0x1c27fd;};'use strict';var _=require(_0x1ce6('0x0'));var util=require('util');var moment=require(_0x1ce6('0x1'));var BPromise=require(_0x1ce6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ce6('0x3'));var db=require(_0x1ce6('0x4'))['db'];var utils=require(_0x1ce6('0x5'));var logger=require(_0x1ce6('0x6'))(_0x1ce6('0x7'));var config=require('../../config/environment');var jayson=require(_0x1ce6('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ad729,_0x4a701b,_0x646c87){return new BPromise(function(_0x4ab23d,_0x17cf98){return client[_0x1ce6('0x9')](_0x3ad729,_0x646c87)['then'](function(_0x18a3ce){logger[_0x1ce6('0xa')](_0x1ce6('0xb'),_0x4a701b,_0x1ce6('0xc'));logger[_0x1ce6('0xd')](_0x1ce6('0xe'),_0x4a701b,'request\x20sent',JSON[_0x1ce6('0xf')](_0x18a3ce));if(_0x18a3ce[_0x1ce6('0x10')]){if(_0x18a3ce[_0x1ce6('0x10')][_0x1ce6('0x11')]===0x1f4){logger['error'](_0x1ce6('0xb'),_0x4a701b,_0x18a3ce[_0x1ce6('0x10')][_0x1ce6('0x12')]);return _0x17cf98(_0x18a3ce[_0x1ce6('0x10')]['message']);}logger[_0x1ce6('0x10')](_0x1ce6('0xb'),_0x4a701b,_0x18a3ce[_0x1ce6('0x10')][_0x1ce6('0x12')]);return _0x4ab23d(_0x18a3ce['error']['message']);}else{logger[_0x1ce6('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0x4a701b,_0x1ce6('0xc'));_0x4ab23d(_0x18a3ce[_0x1ce6('0x13')]['message']);}})['catch'](function(_0x5d3387){logger['error'](_0x1ce6('0xb'),_0x4a701b,_0x5d3387);_0x17cf98(_0x5d3387);});});}exports['CreateChatQueueReport']=function(_0x1d0f74){var _0x320315=this;return new Promise(function(_0x31ca7f,_0x212ce5){return db['ChatQueueReport'][_0x1ce6('0x14')](_0x1d0f74[_0x1ce6('0x15')],{'raw':_0x1d0f74[_0x1ce6('0x16')]?_0x1d0f74[_0x1ce6('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x1ce6('0x17')](function(_0x380dfd){logger[_0x1ce6('0xa')](_0x1ce6('0x18'),_0x1d0f74);logger['debug'](_0x1ce6('0x18'),_0x1d0f74,JSON[_0x1ce6('0xf')](_0x380dfd));_0x31ca7f(_0x380dfd);})[_0x1ce6('0x19')](function(_0x1f63af){logger[_0x1ce6('0x10')](_0x1ce6('0x18'),_0x1f63af[_0x1ce6('0x12')],_0x1d0f74);_0x212ce5(_0x320315[_0x1ce6('0x10')](0x1f4,_0x1f63af[_0x1ce6('0x12')]));});});};exports[_0x1ce6('0x1a')]=function(_0x152305){var _0x199baf=this;return new Promise(function(_0x17f187,_0x5a081a){return db[_0x1ce6('0x1b')][_0x1ce6('0x1c')](_0x152305[_0x1ce6('0x15')],{'raw':_0x152305[_0x1ce6('0x16')]?_0x152305['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x152305['options']?_0x152305[_0x1ce6('0x16')][_0x1ce6('0x1d')]||null:null,'attributes':_0x152305[_0x1ce6('0x16')]?_0x152305[_0x1ce6('0x16')][_0x1ce6('0x1e')]||null:null,'limit':_0x152305[_0x1ce6('0x16')]?_0x152305['options']['limit']||null:null})[_0x1ce6('0x17')](function(_0x543bc3){logger[_0x1ce6('0xa')](_0x1ce6('0x1a'),_0x152305);logger['debug'](_0x1ce6('0x1a'),_0x152305,JSON[_0x1ce6('0xf')](_0x543bc3));_0x17f187(_0x543bc3);})[_0x1ce6('0x19')](function(_0x5e3277){logger['error'](_0x1ce6('0x1a'),_0x5e3277[_0x1ce6('0x12')],_0x152305);_0x5a081a(_0x199baf[_0x1ce6('0x10')](0x1f4,_0x5e3277['message']));});});}; \ No newline at end of file +var _0xf7fc=['client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','UpdateChatQueueReport','update','attributes','limit','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x3c8cc6,_0x5b9b70){var _0xb68361=function(_0x7edb08){while(--_0x7edb08){_0x3c8cc6['push'](_0x3c8cc6['shift']());}};_0xb68361(++_0x5b9b70);}(_0xf7fc,0x1bb));var _0xcf7f=function(_0x1631be,_0x1942b6){_0x1631be=_0x1631be-0x0;var _0x2f5bc2=_0xf7fc[_0x1631be];return _0x2f5bc2;};'use strict';var _=require(_0xcf7f('0x0'));var util=require(_0xcf7f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcf7f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf7f('0x3'))['db'];var utils=require(_0xcf7f('0x4'));var logger=require(_0xcf7f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcf7f('0x6'));var client=jayson[_0xcf7f('0x7')][_0xcf7f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c15c2,_0x1fd64b,_0x5646eb){return new BPromise(function(_0x386f6a,_0xca16cb){return client[_0xcf7f('0x9')](_0x4c15c2,_0x5646eb)[_0xcf7f('0xa')](function(_0x2d78e9){logger['info'](_0xcf7f('0xb'),_0x1fd64b,_0xcf7f('0xc'));logger[_0xcf7f('0xd')](_0xcf7f('0xe'),_0x1fd64b,_0xcf7f('0xc'),JSON[_0xcf7f('0xf')](_0x2d78e9));if(_0x2d78e9[_0xcf7f('0x10')]){if(_0x2d78e9['error'][_0xcf7f('0x11')]===0x1f4){logger[_0xcf7f('0x10')](_0xcf7f('0xb'),_0x1fd64b,_0x2d78e9[_0xcf7f('0x10')][_0xcf7f('0x12')]);return _0xca16cb(_0x2d78e9[_0xcf7f('0x10')][_0xcf7f('0x12')]);}logger['error'](_0xcf7f('0xb'),_0x1fd64b,_0x2d78e9[_0xcf7f('0x10')][_0xcf7f('0x12')]);return _0x386f6a(_0x2d78e9['error'][_0xcf7f('0x12')]);}else{logger[_0xcf7f('0x13')](_0xcf7f('0xb'),_0x1fd64b,'request\x20sent');_0x386f6a(_0x2d78e9['result'][_0xcf7f('0x12')]);}})[_0xcf7f('0x14')](function(_0x44db4c){logger[_0xcf7f('0x10')](_0xcf7f('0xb'),_0x1fd64b,_0x44db4c);_0xca16cb(_0x44db4c);});});}exports[_0xcf7f('0x15')]=function(_0x395450){var _0x2cda2b=this;return new Promise(function(_0x5e0a77,_0x204958){return db[_0xcf7f('0x16')][_0xcf7f('0x17')](_0x395450['body'],{'raw':_0x395450[_0xcf7f('0x18')]?_0x395450[_0xcf7f('0x18')][_0xcf7f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3bccc3){logger[_0xcf7f('0x13')]('CreateChatQueueReport',_0x395450);logger[_0xcf7f('0xd')](_0xcf7f('0x15'),_0x395450,JSON[_0xcf7f('0xf')](_0x3bccc3));_0x5e0a77(_0x3bccc3);})[_0xcf7f('0x14')](function(_0x52a7c4){logger[_0xcf7f('0x10')](_0xcf7f('0x15'),_0x52a7c4[_0xcf7f('0x12')],_0x395450);_0x204958(_0x2cda2b['error'](0x1f4,_0x52a7c4['message']));});});};exports[_0xcf7f('0x1a')]=function(_0x2948c4){var _0x5f6dfc=this;return new Promise(function(_0x40a3e9,_0x5f3756){return db['ChatQueueReport'][_0xcf7f('0x1b')](_0x2948c4['body'],{'raw':_0x2948c4[_0xcf7f('0x18')]?_0x2948c4[_0xcf7f('0x18')][_0xcf7f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2948c4[_0xcf7f('0x18')]?_0x2948c4[_0xcf7f('0x18')]['where']||null:null,'attributes':_0x2948c4[_0xcf7f('0x18')]?_0x2948c4['options'][_0xcf7f('0x1c')]||null:null,'limit':_0x2948c4['options']?_0x2948c4[_0xcf7f('0x18')][_0xcf7f('0x1d')]||null:null})[_0xcf7f('0xa')](function(_0x43bc34){logger[_0xcf7f('0x13')](_0xcf7f('0x1a'),_0x2948c4);logger[_0xcf7f('0xd')]('UpdateChatQueueReport',_0x2948c4,JSON['stringify'](_0x43bc34));_0x40a3e9(_0x43bc34);})[_0xcf7f('0x14')](function(_0x143123){logger[_0xcf7f('0x10')](_0xcf7f('0x1a'),_0x143123['message'],_0x2948c4);_0x5f3756(_0x5f6dfc['error'](0x1f4,_0x143123[_0xcf7f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 672bfda..850b79d 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 _0x540e=['put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/describe','post','create'];(function(_0x250f95,_0x5a5728){var _0x4ada97=function(_0x392edc){while(--_0x392edc){_0x250f95['push'](_0x250f95['shift']());}};_0x4ada97(++_0x5a5728);}(_0x540e,0x1d9));var _0xe540=function(_0x111142,_0x16d9de){_0x111142=_0x111142-0x0;var _0x3a2b0b=_0x540e[_0x111142];return _0x3a2b0b;};'use strict';var multer=require(_0xe540('0x0'));var util=require(_0xe540('0x1'));var path=require(_0xe540('0x2'));var timeout=require(_0xe540('0x3'));var express=require(_0xe540('0x4'));var router=express['Router']();var fs_extra=require(_0xe540('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe540('0x6'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0xe540('0x7')](),controller[_0xe540('0x8')]);router[_0xe540('0x9')](_0xe540('0xa'),auth[_0xe540('0x7')](),controller['describe']);router['get']('/:id',auth[_0xe540('0x7')](),controller['show']);router[_0xe540('0xb')]('/',auth[_0xe540('0x7')](),controller[_0xe540('0xc')]);router[_0xe540('0xd')](_0xe540('0xe'),auth[_0xe540('0x7')](),controller[_0xe540('0xf')]);router[_0xe540('0x10')](_0xe540('0xe'),auth[_0xe540('0x7')](),controller[_0xe540('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8991=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','exports','util','express'];(function(_0x196e93,_0x1f6a92){var _0x114bfd=function(_0x245ce8){while(--_0x245ce8){_0x196e93['push'](_0x196e93['shift']());}};_0x114bfd(++_0x1f6a92);}(_0x8991,0x108));var _0x1899=function(_0x5ec777,_0xde237d){_0x5ec777=_0x5ec777-0x0;var _0x3846e3=_0x8991[_0x5ec777];return _0x3846e3;};'use strict';var multer=require('multer');var util=require(_0x1899('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1899('0x1'));var router=express[_0x1899('0x2')]();var fs_extra=require(_0x1899('0x3'));var auth=require(_0x1899('0x4'));var interaction=require(_0x1899('0x5'));var config=require(_0x1899('0x6'));var controller=require(_0x1899('0x7'));router[_0x1899('0x8')]('/',auth[_0x1899('0x9')](),controller['index']);router[_0x1899('0x8')](_0x1899('0xa'),auth[_0x1899('0x9')](),controller[_0x1899('0xb')]);router['get'](_0x1899('0xc'),auth[_0x1899('0x9')](),controller[_0x1899('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1899('0xe')]);router[_0x1899('0xf')](_0x1899('0xc'),auth[_0x1899('0x9')](),controller[_0x1899('0x10')]);router[_0x1899('0x11')](_0x1899('0xc'),auth[_0x1899('0x9')](),controller['destroy']);module[_0x1899('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 11aa568..da2b603 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x12a8d7,_0x49cf11){var _0xcc468d=function(_0x3b06c2){while(--_0x3b06c2){_0x12a8d7['push'](_0x12a8d7['shift']());}};_0xcc468d(++_0x49cf11);}(_0xedd9,0xfc));var _0x9edd=function(_0x4abe69,_0x337b12){_0x4abe69=_0x4abe69-0x0;var _0x1e7e3b=_0xedd9[_0x4abe69];return _0x1e7e3b;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x59e5ae,_0x47d22d){var _0x5b0713=function(_0x35bfc1){while(--_0x35bfc1){_0x59e5ae['push'](_0x59e5ae['shift']());}};_0x5b0713(++_0x47d22d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1d930e,_0x20d8b8){_0x1d930e=_0x1d930e-0x0;var _0x5bbd66=_0xcb91[_0x1d930e];return _0x5bbd66;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 2864114..d8b3a4c 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 _0xccbd=['rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','show','params','keys','merge','options','catch','create','body','find','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','stack','name','send','map','ChatTransferReport'];(function(_0x5b2aed,_0x5b2ed1){var _0xfdf600=function(_0x2a1ea3){while(--_0x2a1ea3){_0x5b2aed['push'](_0x5b2aed['shift']());}};_0xfdf600(++_0x5b2ed1);}(_0xccbd,0xb2));var _0xdccb=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xccbd[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0xdccb('0x0'));var rimraf=require(_0xdccb('0x1'));var zipdir=require(_0xdccb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdccb('0x3'));var BPromise=require(_0xdccb('0x4'));var Mustache=require('mustache');var util=require(_0xdccb('0x5'));var path=require(_0xdccb('0x6'));var sox=require(_0xdccb('0x7'));var csv=require(_0xdccb('0x8'));var ejs=require(_0xdccb('0x9'));var fs=require('fs');var fs_extra=require(_0xdccb('0xa'));var _=require(_0xdccb('0xb'));var squel=require(_0xdccb('0xc'));var crypto=require(_0xdccb('0xd'));var jsforce=require(_0xdccb('0xe'));var deskjs=require(_0xdccb('0xf'));var toCsv=require(_0xdccb('0x8'));var querystring=require('querystring');var Papa=require(_0xdccb('0x10'));var Redis=require(_0xdccb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdccb('0x12'));var as=require(_0xdccb('0x13'));var hardwareService=require(_0xdccb('0x14'));var logger=require('../../config/logger')(_0xdccb('0x15'));var utils=require(_0xdccb('0x16'));var config=require(_0xdccb('0x17'));var licenseUtil=require(_0xdccb('0x18'));var db=require(_0xdccb('0x19'))['db'];function respondWithStatusCode(_0x3a506d,_0x426fe0){_0x426fe0=_0x426fe0||0xcc;return function(_0x5b42c9){if(_0x5b42c9){return _0x3a506d[_0xdccb('0x1a')](_0x426fe0);}return _0x3a506d[_0xdccb('0x1b')](_0x426fe0)[_0xdccb('0x1c')]();};}function respondWithResult(_0x3865df,_0x24551b){_0x24551b=_0x24551b||0xc8;return function(_0x4d8a5e){if(_0x4d8a5e){return _0x3865df[_0xdccb('0x1b')](_0x24551b)[_0xdccb('0x1d')](_0x4d8a5e);}};}function respondWithFilteredResult(_0x21b231,_0x2fdd61){return function(_0x30d531){if(_0x30d531){var _0x2836bb=typeof _0x2fdd61[_0xdccb('0x1e')]===_0xdccb('0x1f')&&typeof _0x2fdd61[_0xdccb('0x20')]===_0xdccb('0x1f');var _0x4a110e=_0x30d531[_0xdccb('0x21')];var _0x519a35=_0x2836bb?0x0:_0x2fdd61[_0xdccb('0x1e')];var _0x383c77=_0x2836bb?_0x30d531[_0xdccb('0x21')]:_0x2fdd61[_0xdccb('0x1e')]+_0x2fdd61[_0xdccb('0x20')];var _0x5a6531;if(_0x383c77>=_0x4a110e){_0x383c77=_0x4a110e;_0x5a6531=0xc8;}else{_0x5a6531=0xce;}_0x21b231['status'](_0x5a6531);return _0x21b231['set'](_0xdccb('0x22'),_0x519a35+'-'+_0x383c77+'/'+_0x4a110e)[_0xdccb('0x1d')](_0x30d531);}return null;};}function patchUpdates(_0x318bce){return function(_0x5c8ada){try{jsonpatch[_0xdccb('0x23')](_0x5c8ada,_0x318bce,!![]);}catch(_0x558ea1){return BPromise['reject'](_0x558ea1);}return _0x5c8ada['save']();};}function saveUpdates(_0x3d6747,_0xdfa0ad){return function(_0x24cbca){if(_0x24cbca){return _0x24cbca[_0xdccb('0x24')](_0x3d6747)[_0xdccb('0x25')](function(_0x5c13dd){return _0x5c13dd;});}return null;};}function removeEntity(_0xa25d1d,_0x375c5c){return function(_0x3dd864){if(_0x3dd864){return _0x3dd864[_0xdccb('0x26')]()[_0xdccb('0x25')](function(){_0xa25d1d['status'](0xcc)[_0xdccb('0x1c')]();});}};}function handleEntityNotFound(_0x1e897e,_0x231c60){return function(_0x11077f){if(!_0x11077f){_0x1e897e['sendStatus'](0x194);}return _0x11077f;};}function handleError(_0x28cfc9,_0x25d661){_0x25d661=_0x25d661||0x1f4;return function(_0x230293){logger['error'](_0x230293[_0xdccb('0x27')]);if(_0x230293['name']){delete _0x230293[_0xdccb('0x28')];}_0x28cfc9['status'](_0x25d661)[_0xdccb('0x29')](_0x230293);};}exports['index']=function(_0x3f51fa,_0x5dd0d3){var _0x139f32={},_0x2fc157={},_0x21703c={'count':0x0,'rows':[]};var _0x5ec6f8=_[_0xdccb('0x2a')](db[_0xdccb('0x2b')][_0xdccb('0x2c')],function(_0x37d8c5){return{'name':_0x37d8c5['fieldName'],'type':_0x37d8c5[_0xdccb('0x2d')][_0xdccb('0x2e')]};});_0x2fc157[_0xdccb('0x2f')]=_['map'](_0x5ec6f8,_0xdccb('0x28'));_0x2fc157[_0xdccb('0x30')]=_['keys'](_0x3f51fa[_0xdccb('0x30')]);_0x2fc157[_0xdccb('0x31')]=_[_0xdccb('0x32')](_0x2fc157['model'],_0x2fc157[_0xdccb('0x30')]);_0x139f32[_0xdccb('0x33')]=_[_0xdccb('0x32')](_0x2fc157['model'],qs[_0xdccb('0x34')](_0x3f51fa[_0xdccb('0x30')][_0xdccb('0x34')]));_0x139f32[_0xdccb('0x33')]=_0x139f32[_0xdccb('0x33')][_0xdccb('0x35')]?_0x139f32['attributes']:_0x2fc157[_0xdccb('0x2f')];if(!_0x3f51fa['query'][_0xdccb('0x36')](_0xdccb('0x37'))){_0x139f32['limit']=qs['limit'](_0x3f51fa['query'][_0xdccb('0x20')]);_0x139f32[_0xdccb('0x1e')]=qs[_0xdccb('0x1e')](_0x3f51fa[_0xdccb('0x30')][_0xdccb('0x1e')]);}_0x139f32[_0xdccb('0x38')]=qs[_0xdccb('0x39')](_0x3f51fa[_0xdccb('0x30')][_0xdccb('0x39')]);_0x139f32[_0xdccb('0x3a')]=qs[_0xdccb('0x31')](_[_0xdccb('0x3b')](_0x3f51fa[_0xdccb('0x30')],_0x2fc157[_0xdccb('0x31')]),_0x5ec6f8);if(_0x3f51fa['query'][_0xdccb('0x3c')]){_0x139f32['where']=_['merge'](_0x139f32[_0xdccb('0x3a')],{'$or':_['map'](_0x5ec6f8,function(_0x212a5a){if(_0x212a5a[_0xdccb('0x2d')]!=='VIRTUAL'){var _0x1ba313={};_0x1ba313[_0x212a5a['name']]={'$like':'%'+_0x3f51fa[_0xdccb('0x30')][_0xdccb('0x3c')]+'%'};return _0x1ba313;}})});}_0x139f32=_['merge']({},_0x139f32,_0x3f51fa['options']);var _0x1ba058={'where':_0x139f32[_0xdccb('0x3a')]};return db['ChatTransferReport'][_0xdccb('0x21')](_0x1ba058)[_0xdccb('0x25')](function(_0x10dca7){_0x21703c[_0xdccb('0x21')]=_0x10dca7;if(_0x3f51fa[_0xdccb('0x30')][_0xdccb('0x3d')]){_0x139f32[_0xdccb('0x3e')]=[{'all':!![]}];}return db[_0xdccb('0x2b')][_0xdccb('0x3f')](_0x139f32);})['then'](function(_0x4d8ea4){_0x21703c['rows']=_0x4d8ea4;return _0x21703c;})[_0xdccb('0x25')](respondWithFilteredResult(_0x5dd0d3,_0x139f32))['catch'](handleError(_0x5dd0d3,null));};exports[_0xdccb('0x40')]=function(_0x40225b,_0x351581){var _0x4de8c6={'raw':!![],'where':{'id':_0x40225b[_0xdccb('0x41')]['id']}},_0x2edd7a={};_0x2edd7a[_0xdccb('0x2f')]=_[_0xdccb('0x42')](db[_0xdccb('0x2b')]['rawAttributes']);_0x2edd7a['query']=_[_0xdccb('0x42')](_0x40225b[_0xdccb('0x30')]);_0x2edd7a[_0xdccb('0x31')]=_[_0xdccb('0x32')](_0x2edd7a[_0xdccb('0x2f')],_0x2edd7a[_0xdccb('0x30')]);_0x4de8c6[_0xdccb('0x33')]=_[_0xdccb('0x32')](_0x2edd7a[_0xdccb('0x2f')],qs[_0xdccb('0x34')](_0x40225b[_0xdccb('0x30')]['fields']));_0x4de8c6[_0xdccb('0x33')]=_0x4de8c6[_0xdccb('0x33')][_0xdccb('0x35')]?_0x4de8c6[_0xdccb('0x33')]:_0x2edd7a[_0xdccb('0x2f')];if(_0x40225b[_0xdccb('0x30')][_0xdccb('0x3d')]){_0x4de8c6[_0xdccb('0x3e')]=[{'all':!![]}];}_0x4de8c6=_[_0xdccb('0x43')]({},_0x4de8c6,_0x40225b[_0xdccb('0x44')]);return db[_0xdccb('0x2b')]['find'](_0x4de8c6)[_0xdccb('0x25')](handleEntityNotFound(_0x351581,null))['then'](respondWithResult(_0x351581,null))[_0xdccb('0x45')](handleError(_0x351581,null));};exports[_0xdccb('0x46')]=function(_0x2dfbc5,_0x48f64e){return db[_0xdccb('0x2b')][_0xdccb('0x46')](_0x2dfbc5[_0xdccb('0x47')],{})[_0xdccb('0x25')](respondWithResult(_0x48f64e,0xc9))['catch'](handleError(_0x48f64e,null));};exports[_0xdccb('0x24')]=function(_0x488788,_0x515047){if(_0x488788[_0xdccb('0x47')]['id']){delete _0x488788[_0xdccb('0x47')]['id'];}return db['ChatTransferReport'][_0xdccb('0x48')]({'where':{'id':_0x488788[_0xdccb('0x41')]['id']}})[_0xdccb('0x25')](handleEntityNotFound(_0x515047,null))[_0xdccb('0x25')](saveUpdates(_0x488788[_0xdccb('0x47')],null))[_0xdccb('0x25')](respondWithResult(_0x515047,null))[_0xdccb('0x45')](handleError(_0x515047,null));};exports[_0xdccb('0x26')]=function(_0x19d785,_0x237417){return db[_0xdccb('0x2b')][_0xdccb('0x48')]({'where':{'id':_0x19d785[_0xdccb('0x41')]['id']}})['then'](handleEntityNotFound(_0x237417,null))['then'](removeEntity(_0x237417,null))[_0xdccb('0x45')](handleError(_0x237417,null));};exports[_0xdccb('0x49')]=function(_0x512ec0,_0x16c110){return db[_0xdccb('0x2b')]['describe']()['then'](respondWithResult(_0x16c110,null))['catch'](handleError(_0x16c110,null));}; \ No newline at end of file +var _0x35b9=['order','sort','where','pick','filter','merge','include','catch','show','params','length','includeAll','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','ChatTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty'];(function(_0x5ec453,_0x30b0ba){var _0x25548f=function(_0x387b62){while(--_0x387b62){_0x5ec453['push'](_0x5ec453['shift']());}};_0x25548f(++_0x30b0ba);}(_0x35b9,0xa7));var _0x935b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x35b9[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x935b('0x0'));var rimraf=require(_0x935b('0x1'));var zipdir=require(_0x935b('0x2'));var jsonpatch=require(_0x935b('0x3'));var rp=require('request-promise');var moment=require(_0x935b('0x4'));var BPromise=require(_0x935b('0x5'));var Mustache=require(_0x935b('0x6'));var util=require(_0x935b('0x7'));var path=require(_0x935b('0x8'));var sox=require(_0x935b('0x9'));var csv=require(_0x935b('0xa'));var ejs=require(_0x935b('0xb'));var fs=require('fs');var fs_extra=require(_0x935b('0xc'));var _=require('lodash');var squel=require(_0x935b('0xd'));var crypto=require('crypto');var jsforce=require(_0x935b('0xe'));var deskjs=require(_0x935b('0xf'));var toCsv=require(_0x935b('0xa'));var querystring=require('querystring');var Papa=require(_0x935b('0x10'));var Redis=require(_0x935b('0x11'));var authService=require(_0x935b('0x12'));var qs=require(_0x935b('0x13'));var as=require(_0x935b('0x14'));var hardwareService=require(_0x935b('0x15'));var logger=require(_0x935b('0x16'))(_0x935b('0x17'));var utils=require('../../config/utils');var config=require(_0x935b('0x18'));var licenseUtil=require(_0x935b('0x19'));var db=require(_0x935b('0x1a'))['db'];function respondWithStatusCode(_0x20ce67,_0x2199b0){_0x2199b0=_0x2199b0||0xcc;return function(_0x11a354){if(_0x11a354){return _0x20ce67[_0x935b('0x1b')](_0x2199b0);}return _0x20ce67['status'](_0x2199b0)['end']();};}function respondWithResult(_0x431ae4,_0x2b4a0b){_0x2b4a0b=_0x2b4a0b||0xc8;return function(_0x324233){if(_0x324233){return _0x431ae4[_0x935b('0x1c')](_0x2b4a0b)[_0x935b('0x1d')](_0x324233);}};}function respondWithFilteredResult(_0x3e9431,_0x5075a5){return function(_0x1fc1c9){if(_0x1fc1c9){var _0x3deeef=typeof _0x5075a5[_0x935b('0x1e')]===_0x935b('0x1f')&&typeof _0x5075a5[_0x935b('0x20')]===_0x935b('0x1f');var _0x16ba3e=_0x1fc1c9['count'];var _0xaef55e=_0x3deeef?0x0:_0x5075a5[_0x935b('0x1e')];var _0x2a58dc=_0x3deeef?_0x1fc1c9[_0x935b('0x21')]:_0x5075a5[_0x935b('0x1e')]+_0x5075a5[_0x935b('0x20')];var _0x44321d;if(_0x2a58dc>=_0x16ba3e){_0x2a58dc=_0x16ba3e;_0x44321d=0xc8;}else{_0x44321d=0xce;}_0x3e9431[_0x935b('0x1c')](_0x44321d);return _0x3e9431['set'](_0x935b('0x22'),_0xaef55e+'-'+_0x2a58dc+'/'+_0x16ba3e)['json'](_0x1fc1c9);}return null;};}function patchUpdates(_0x280740){return function(_0x38926e){try{jsonpatch[_0x935b('0x23')](_0x38926e,_0x280740,!![]);}catch(_0x321e9b){return BPromise[_0x935b('0x24')](_0x321e9b);}return _0x38926e[_0x935b('0x25')]();};}function saveUpdates(_0x19b005,_0x59f955){return function(_0x5c1b0e){if(_0x5c1b0e){return _0x5c1b0e['update'](_0x19b005)[_0x935b('0x26')](function(_0x56b0fd){return _0x56b0fd;});}return null;};}function removeEntity(_0x5f31e0,_0x325421){return function(_0x1dff57){if(_0x1dff57){return _0x1dff57[_0x935b('0x27')]()[_0x935b('0x26')](function(){_0x5f31e0[_0x935b('0x1c')](0xcc)[_0x935b('0x28')]();});}};}function handleEntityNotFound(_0x5aa0bb,_0x5ef10a){return function(_0x2b3673){if(!_0x2b3673){_0x5aa0bb['sendStatus'](0x194);}return _0x2b3673;};}function handleError(_0x230c6f,_0x104e23){_0x104e23=_0x104e23||0x1f4;return function(_0x3bcc25){logger[_0x935b('0x29')](_0x3bcc25[_0x935b('0x2a')]);if(_0x3bcc25[_0x935b('0x2b')]){delete _0x3bcc25[_0x935b('0x2b')];}_0x230c6f[_0x935b('0x1c')](_0x104e23)[_0x935b('0x2c')](_0x3bcc25);};}exports[_0x935b('0x2d')]=function(_0x293083,_0x14b38a){var _0xca7d34={},_0x374cd4={},_0x3e0041={'count':0x0,'rows':[]};var _0x50920d=_['map'](db[_0x935b('0x2e')][_0x935b('0x2f')],function(_0x19d0bf){return{'name':_0x19d0bf['fieldName'],'type':_0x19d0bf[_0x935b('0x30')][_0x935b('0x31')]};});_0x374cd4['model']=_['map'](_0x50920d,_0x935b('0x2b'));_0x374cd4[_0x935b('0x32')]=_[_0x935b('0x33')](_0x293083[_0x935b('0x32')]);_0x374cd4[_0x935b('0x34')]=_[_0x935b('0x35')](_0x374cd4[_0x935b('0x36')],_0x374cd4['query']);_0xca7d34[_0x935b('0x37')]=_[_0x935b('0x35')](_0x374cd4['model'],qs[_0x935b('0x38')](_0x293083[_0x935b('0x32')][_0x935b('0x38')]));_0xca7d34['attributes']=_0xca7d34[_0x935b('0x37')]['length']?_0xca7d34[_0x935b('0x37')]:_0x374cd4[_0x935b('0x36')];if(!_0x293083[_0x935b('0x32')][_0x935b('0x39')]('nolimit')){_0xca7d34['limit']=qs[_0x935b('0x20')](_0x293083[_0x935b('0x32')][_0x935b('0x20')]);_0xca7d34['offset']=qs['offset'](_0x293083['query']['offset']);}_0xca7d34[_0x935b('0x3a')]=qs[_0x935b('0x3b')](_0x293083[_0x935b('0x32')][_0x935b('0x3b')]);_0xca7d34[_0x935b('0x3c')]=qs[_0x935b('0x34')](_[_0x935b('0x3d')](_0x293083[_0x935b('0x32')],_0x374cd4[_0x935b('0x34')]),_0x50920d);if(_0x293083['query'][_0x935b('0x3e')]){_0xca7d34[_0x935b('0x3c')]=_[_0x935b('0x3f')](_0xca7d34[_0x935b('0x3c')],{'$or':_['map'](_0x50920d,function(_0x42603c){if(_0x42603c[_0x935b('0x30')]!=='VIRTUAL'){var _0x2a53a3={};_0x2a53a3[_0x42603c[_0x935b('0x2b')]]={'$like':'%'+_0x293083[_0x935b('0x32')][_0x935b('0x3e')]+'%'};return _0x2a53a3;}})});}_0xca7d34=_[_0x935b('0x3f')]({},_0xca7d34,_0x293083['options']);var _0x159874={'where':_0xca7d34['where']};return db['ChatTransferReport']['count'](_0x159874)[_0x935b('0x26')](function(_0x26b40e){_0x3e0041[_0x935b('0x21')]=_0x26b40e;if(_0x293083[_0x935b('0x32')]['includeAll']){_0xca7d34[_0x935b('0x40')]=[{'all':!![]}];}return db[_0x935b('0x2e')]['findAll'](_0xca7d34);})[_0x935b('0x26')](function(_0x2a5721){_0x3e0041['rows']=_0x2a5721;return _0x3e0041;})[_0x935b('0x26')](respondWithFilteredResult(_0x14b38a,_0xca7d34))[_0x935b('0x41')](handleError(_0x14b38a,null));};exports[_0x935b('0x42')]=function(_0x34e89d,_0x2d4ae9){var _0x57e0a9={'raw':!![],'where':{'id':_0x34e89d[_0x935b('0x43')]['id']}},_0x1f2fc9={};_0x1f2fc9['model']=_['keys'](db[_0x935b('0x2e')][_0x935b('0x2f')]);_0x1f2fc9[_0x935b('0x32')]=_[_0x935b('0x33')](_0x34e89d[_0x935b('0x32')]);_0x1f2fc9['filters']=_[_0x935b('0x35')](_0x1f2fc9[_0x935b('0x36')],_0x1f2fc9[_0x935b('0x32')]);_0x57e0a9['attributes']=_[_0x935b('0x35')](_0x1f2fc9[_0x935b('0x36')],qs['fields'](_0x34e89d['query'][_0x935b('0x38')]));_0x57e0a9[_0x935b('0x37')]=_0x57e0a9[_0x935b('0x37')][_0x935b('0x44')]?_0x57e0a9[_0x935b('0x37')]:_0x1f2fc9[_0x935b('0x36')];if(_0x34e89d[_0x935b('0x32')][_0x935b('0x45')]){_0x57e0a9['include']=[{'all':!![]}];}_0x57e0a9=_['merge']({},_0x57e0a9,_0x34e89d['options']);return db[_0x935b('0x2e')]['find'](_0x57e0a9)['then'](handleEntityNotFound(_0x2d4ae9,null))[_0x935b('0x26')](respondWithResult(_0x2d4ae9,null))[_0x935b('0x41')](handleError(_0x2d4ae9,null));};exports[_0x935b('0x46')]=function(_0x77246a,_0x95856a){return db['ChatTransferReport']['create'](_0x77246a[_0x935b('0x47')],{})[_0x935b('0x26')](respondWithResult(_0x95856a,0xc9))[_0x935b('0x41')](handleError(_0x95856a,null));};exports[_0x935b('0x48')]=function(_0x2b1df4,_0x2f0d61){if(_0x2b1df4['body']['id']){delete _0x2b1df4[_0x935b('0x47')]['id'];}return db['ChatTransferReport'][_0x935b('0x49')]({'where':{'id':_0x2b1df4[_0x935b('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f0d61,null))[_0x935b('0x26')](saveUpdates(_0x2b1df4['body'],null))[_0x935b('0x26')](respondWithResult(_0x2f0d61,null))[_0x935b('0x41')](handleError(_0x2f0d61,null));};exports[_0x935b('0x27')]=function(_0x2f090c,_0x5c95fc){return db[_0x935b('0x2e')][_0x935b('0x49')]({'where':{'id':_0x2f090c[_0x935b('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c95fc,null))['then'](removeEntity(_0x5c95fc,null))[_0x935b('0x41')](handleError(_0x5c95fc,null));};exports[_0x935b('0x4a')]=function(_0x17cead,_0x415c47){return db['ChatTransferReport'][_0x935b('0x4a')]()[_0x935b('0x26')](respondWithResult(_0x415c47,null))[_0x935b('0x41')](handleError(_0x415c47,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 2480374..d30c610 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 _0xa5f5=['./chatTransferReport.attributes','define','ChatTransferReport','uniqueid','../../config/logger','bluebird','request-promise','../../config/environment'];(function(_0x4dd0c5,_0x19b624){var _0x53e6c4=function(_0x143ffc){while(--_0x143ffc){_0x4dd0c5['push'](_0x4dd0c5['shift']());}};_0x53e6c4(++_0x19b624);}(_0xa5f5,0x154));var _0x5a5f=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xa5f5[_0x5cb1af];return _0x8d7940;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5a5f('0x0'))('api');var moment=require('moment');var BPromise=require(_0x5a5f('0x1'));var rp=require(_0x5a5f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5a5f('0x3'));var attributes=require(_0x5a5f('0x4'));module['exports']=function(_0x22010c,_0x190ebe){return _0x22010c[_0x5a5f('0x5')](_0x5a5f('0x6'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x5a5f('0x7'),'fields':[_0x5a5f('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd9f=['bluebird','request-promise','rimraf','../../config/environment','exports','define','report_chat_transfer','uniqueid','lodash','moment'];(function(_0x4d2218,_0x552fcd){var _0x32e51d=function(_0x9b2265){while(--_0x9b2265){_0x4d2218['push'](_0x4d2218['shift']());}};_0x32e51d(++_0x552fcd);}(_0xcd9f,0x152));var _0xfcd9=function(_0x4c3025,_0x556f28){_0x4c3025=_0x4c3025-0x0;var _0x31fb41=_0xcd9f[_0x4c3025];return _0x31fb41;};'use strict';var _=require(_0xfcd9('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfcd9('0x1'));var BPromise=require(_0xfcd9('0x2'));var rp=require(_0xfcd9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcd9('0x4'));var config=require(_0xfcd9('0x5'));var attributes=require('./chatTransferReport.attributes');module[_0xfcd9('0x6')]=function(_0x7d4b6,_0x4614ba){return _0x7d4b6[_0xfcd9('0x7')]('ChatTransferReport',attributes,{'tableName':_0xfcd9('0x8'),'paranoid':![],'indexes':[{'name':_0xfcd9('0x9'),'fields':[_0xfcd9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index c36db65..61c4a5d 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 _0xd343=['stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x712490,_0x52a6dc){var _0x36e214=function(_0x26f784){while(--_0x26f784){_0x712490['push'](_0x712490['shift']());}};_0x36e214(++_0x52a6dc);}(_0xd343,0x16b));var _0x3d34=function(_0x5d170e,_0x360717){_0x5d170e=_0x5d170e-0x0;var _0x21c0de=_0xd343[_0x5d170e];return _0x21c0de;};'use strict';var _=require('lodash');var util=require(_0x3d34('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3d34('0x1'));var fs=require('fs');var Redis=require(_0x3d34('0x2'));var db=require(_0x3d34('0x3'))['db'];var utils=require(_0x3d34('0x4'));var logger=require(_0x3d34('0x5'))(_0x3d34('0x6'));var config=require(_0x3d34('0x7'));var jayson=require(_0x3d34('0x8'));var client=jayson['client'][_0x3d34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x476c06,_0x35cf11,_0x4ae13c){return new BPromise(function(_0x4739f2,_0x16a858){return client['request'](_0x476c06,_0x4ae13c)[_0x3d34('0xa')](function(_0x533d34){logger[_0x3d34('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x35cf11,_0x3d34('0xc'));logger[_0x3d34('0xd')](_0x3d34('0xe'),_0x35cf11,'request\x20sent',JSON[_0x3d34('0xf')](_0x533d34));if(_0x533d34[_0x3d34('0x10')]){if(_0x533d34[_0x3d34('0x10')][_0x3d34('0x11')]===0x1f4){logger[_0x3d34('0x10')](_0x3d34('0x12'),_0x35cf11,_0x533d34[_0x3d34('0x10')][_0x3d34('0x13')]);return _0x16a858(_0x533d34['error'][_0x3d34('0x13')]);}logger['error'](_0x3d34('0x12'),_0x35cf11,_0x533d34[_0x3d34('0x10')][_0x3d34('0x13')]);return _0x4739f2(_0x533d34['error']['message']);}else{logger[_0x3d34('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x35cf11,_0x3d34('0xc'));_0x4739f2(_0x533d34['result']['message']);}})[_0x3d34('0x14')](function(_0x2d2543){logger[_0x3d34('0x10')](_0x3d34('0x12'),_0x35cf11,_0x2d2543);_0x16a858(_0x2d2543);});});} \ No newline at end of file +var _0xac1b=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0xd2e2fd,_0x4241ea){var _0x5eb092=function(_0x393e86){while(--_0x393e86){_0xd2e2fd['push'](_0xd2e2fd['shift']());}};_0x5eb092(++_0x4241ea);}(_0xac1b,0x79));var _0xbac1=function(_0x109f42,_0x44c1ff){_0x109f42=_0x109f42-0x0;var _0x3ccdd4=_0xac1b[_0x109f42];return _0x3ccdd4;};'use strict';var _=require(_0xbac1('0x0'));var util=require(_0xbac1('0x1'));var moment=require(_0xbac1('0x2'));var BPromise=require(_0xbac1('0x3'));var rs=require(_0xbac1('0x4'));var fs=require('fs');var Redis=require(_0xbac1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbac1('0x6'));var logger=require(_0xbac1('0x7'))(_0xbac1('0x8'));var config=require(_0xbac1('0x9'));var jayson=require(_0xbac1('0xa'));var client=jayson[_0xbac1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x278c10,_0x5ad6b1,_0x12fe42){return new BPromise(function(_0x23d917,_0x1d3b95){return client[_0xbac1('0xc')](_0x278c10,_0x12fe42)['then'](function(_0x28c251){logger['info'](_0xbac1('0xd'),_0x5ad6b1,_0xbac1('0xe'));logger[_0xbac1('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x5ad6b1,_0xbac1('0xe'),JSON[_0xbac1('0x10')](_0x28c251));if(_0x28c251[_0xbac1('0x11')]){if(_0x28c251[_0xbac1('0x11')][_0xbac1('0x12')]===0x1f4){logger[_0xbac1('0x11')](_0xbac1('0xd'),_0x5ad6b1,_0x28c251[_0xbac1('0x11')]['message']);return _0x1d3b95(_0x28c251[_0xbac1('0x11')][_0xbac1('0x13')]);}logger['error'](_0xbac1('0xd'),_0x5ad6b1,_0x28c251['error'][_0xbac1('0x13')]);return _0x23d917(_0x28c251[_0xbac1('0x11')][_0xbac1('0x13')]);}else{logger[_0xbac1('0x14')](_0xbac1('0xd'),_0x5ad6b1,'request\x20sent');_0x23d917(_0x28c251[_0xbac1('0x15')][_0xbac1('0x13')]);}})[_0xbac1('0x16')](function(_0x1242ad){logger[_0xbac1('0x11')](_0xbac1('0xd'),_0x5ad6b1,_0x1242ad);_0x1d3b95(_0x1242ad);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 9035f9c..c5c0fbd 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 _0x27c2=['get','/describe','/:id','show','post','create','put','update','delete','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0xdba291,_0x2b1d39){var _0x2d7c10=function(_0x127e7c){while(--_0x127e7c){_0xdba291['push'](_0xdba291['shift']());}};_0x2d7c10(++_0x2b1d39);}(_0x27c2,0xc7));var _0x227c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x27c2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x227c('0x0'));var path=require(_0x227c('0x1'));var timeout=require('connect-timeout');var express=require(_0x227c('0x2'));var router=express[_0x227c('0x3')]();var fs_extra=require(_0x227c('0x4'));var auth=require(_0x227c('0x5'));var interaction=require(_0x227c('0x6'));var config=require(_0x227c('0x7'));var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x227c('0x8')](),controller[_0x227c('0x9')]);router[_0x227c('0xa')](_0x227c('0xb'),auth[_0x227c('0x8')](),controller['describe']);router[_0x227c('0xa')](_0x227c('0xc'),auth[_0x227c('0x8')](),controller[_0x227c('0xd')]);router[_0x227c('0xe')]('/',auth['isAuthenticated'](),controller[_0x227c('0xf')]);router[_0x227c('0x10')](_0x227c('0xc'),auth['isAuthenticated'](),controller[_0x227c('0x11')]);router[_0x227c('0x12')](_0x227c('0xc'),auth[_0x227c('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xff15=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatTransferReport.controller','index','get','/describe','describe','/:id','isAuthenticated','show','create'];(function(_0x2e566c,_0x13523e){var _0x551203=function(_0x555426){while(--_0x555426){_0x2e566c['push'](_0x2e566c['shift']());}};_0x551203(++_0x13523e);}(_0xff15,0x130));var _0x5ff1=function(_0x86c6cb,_0x30bb53){_0x86c6cb=_0x86c6cb-0x0;var _0x1b1592=_0xff15[_0x86c6cb];return _0x1b1592;};'use strict';var multer=require('multer');var util=require(_0x5ff1('0x0'));var path=require(_0x5ff1('0x1'));var timeout=require(_0x5ff1('0x2'));var express=require(_0x5ff1('0x3'));var router=express[_0x5ff1('0x4')]();var fs_extra=require(_0x5ff1('0x5'));var auth=require(_0x5ff1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5ff1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5ff1('0x8')]);router[_0x5ff1('0x9')](_0x5ff1('0xa'),auth['isAuthenticated'](),controller[_0x5ff1('0xb')]);router[_0x5ff1('0x9')](_0x5ff1('0xc'),auth[_0x5ff1('0xd')](),controller[_0x5ff1('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5ff1('0xf')]);router['put']('/:id',auth[_0x5ff1('0xd')](),controller[_0x5ff1('0x10')]);router[_0x5ff1('0x11')](_0x5ff1('0xc'),auth[_0x5ff1('0xd')](),controller[_0x5ff1('0x12')]);module[_0x5ff1('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 587da79..5c3cd74 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 _0x5cde=['alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right'];(function(_0x2a302a,_0x3670c4){var _0x283f7f=function(_0x4afe0c){while(--_0x4afe0c){_0x2a302a['push'](_0x2a302a['shift']());}};_0x283f7f(++_0x3670c4);}(_0x5cde,0x75));var _0xe5cd=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x5cde[_0x125ff8];return _0x2d9ef;};'use strict';var Sequelize=require(_0xe5cd('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xe5cd('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe5cd('0x2')},'description':{'type':Sequelize[_0xe5cd('0x1')]},'mapKey':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0x3')},'mapKeyOffline':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0x3')},'key':{'type':Sequelize[_0xe5cd('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xe5cd('0x4')},'customerAlias':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xe5cd('0x1')],'allowNull':![],'defaultValue':_0xe5cd('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xe5cd('0x1')],'allowNull':![],'defaultValue':_0xe5cd('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xe5cd('0x1')],'allowNull':![],'defaultValue':_0xe5cd('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xe5cd('0x8')]('rounded',_0xe5cd('0x9')),'defaultValue':_0xe5cd('0xa')},'header_online':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xe5cd('0xc')},'offline_chat_button':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0xd')},'header_offline':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0xe')},'download_transcript':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xe5cd('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xe5cd('0x11')]},'closingQuestion':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe5cd('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xe5cd('0x15')},'placeholderMessage':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0x16')},'closingMessage':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0x17')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0x18')},'conditionAgreement':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xe5cd('0x19')},'ratingType':{'type':Sequelize[_0xe5cd('0x8')](_0xe5cd('0x1a'),'thumb'),'defaultValue':_0xe5cd('0x1a')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xe5cd('0x11')],'defaultValue':function(){return JSON[_0xe5cd('0x1b')]({'items':[{'type':_0xe5cd('0x1c'),'variable':null,'config':{'placeholder':_0xe5cd('0x1d'),'type':_0xe5cd('0x1e'),'required':!![]},'props':{'title':_0xe5cd('0x1d'),'helpText':''}},{'type':_0xe5cd('0x1c'),'props':{'title':_0xe5cd('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xe5cd('0x3'),'type':_0xe5cd('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xe5cd('0x1f')](_0xe5cd('0x20'))?JSON[_0xe5cd('0x21')](this[_0xe5cd('0x1f')](_0xe5cd('0x20'))):{};},'set':function(_0x125fe7){return this[_0xe5cd('0x22')](_0xe5cd('0x20'),JSON[_0xe5cd('0x1b')](_0x125fe7));}},'offlineForm':{'type':Sequelize[_0xe5cd('0x11')],'defaultValue':function(){return JSON[_0xe5cd('0x1b')]({'items':[{'type':_0xe5cd('0x1c'),'props':{'title':_0xe5cd('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xe5cd('0x3')},'variable':null},{'type':_0xe5cd('0x23'),'config':{'placeholder':_0xe5cd('0x24')},'props':{'title':_0xe5cd('0x24'),'helpText':_0xe5cd('0x25')}}],'fromKey':0x0});},'get':function(){return this[_0xe5cd('0x1f')]('offlineForm')?JSON[_0xe5cd('0x21')](this[_0xe5cd('0x1f')](_0xe5cd('0x26'))):{};},'set':function(_0x494e98){return this['setDataValue'](_0xe5cd('0x26'),JSON['stringify'](_0x494e98));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xe5cd('0x27')]();}},'autoclose':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xe5cd('0x1')]},'forwardOffline':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xe5cd('0x1')]},'waitingTitle':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0x28')},'offlineMessageSubject':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xe5cd('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0x2a')},'skipUnmanaged':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0x18')},'sendUnmanaged':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xe5cd('0x1')]},'notificationTemplate':{'type':Sequelize[_0xe5cd('0x11')],'defaultValue':function(){return _0xe5cd('0x2b');}},'notificationSound':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xe5cd('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0x2c')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0x2d')},'defaultTitle':{'type':Sequelize[_0xe5cd('0x1')]},'customerAvatar':{'type':Sequelize[_0xe5cd('0x11')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xe5cd('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xe5cd('0x1')],'allowNull':![],'defaultValue':_0xe5cd('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe5cd('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe5cd('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xe5cd('0x1')],'defaultValue':_0xe5cd('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe5cd('0xf')],'comment':_0xe5cd('0x30')},'mandatoryDisposition':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![],'comment':_0xe5cd('0x31'),'set':function(_0x5089e5){if(!_0x5089e5)this[_0xe5cd('0x22')](_0xe5cd('0x32'),null);this[_0xe5cd('0x22')](_0xe5cd('0x33'),_0x5089e5);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xe5cd('0x1')]},'vidaooTopic':{'type':Sequelize[_0xe5cd('0x1')],'allowNull':![],'defaultValue':_0xe5cd('0x34')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xe5cd('0x35');}},'vidaooMetadata':{'type':Sequelize[_0xe5cd('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xe5cd('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xe5cd('0x11')]}}; \ No newline at end of file +var _0xd78d=['Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Skip','BOOLEAN','Feedback','star','thumb','stringify','input','text','getDataValue','parse','onlineForm','setDataValue','TEXT','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}}','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','address','STRING','email','Agent','#011F6A','#ffffff','ENUM','squared','rounded','Chat','Send'];(function(_0xf4cf6f,_0x182f69){var _0x6d55f7=function(_0x57b6b1){while(--_0x57b6b1){_0xf4cf6f['push'](_0xf4cf6f['shift']());}};_0x6d55f7(++_0x182f69);}(_0xd78d,0x1d3));var _0xdd78=function(_0x2caaa3,_0xdd6bac){_0x2caaa3=_0x2caaa3-0x0;var _0x25148e=_0xd78d[_0x2caaa3];return _0x25148e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xdd78('0x0'));module[_0xdd78('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdd78('0x2')},'description':{'type':Sequelize[_0xdd78('0x3')]},'mapKey':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xdd78('0x4')},'key':{'type':Sequelize[_0xdd78('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0x5')},'customerAlias':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdd78('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xdd78('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xdd78('0x3')],'allowNull':![],'defaultValue':_0xdd78('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xdd78('0x8')]('rounded',_0xdd78('0x9')),'defaultValue':_0xdd78('0xa')},'header_online':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0xb')},'offline_chat_button':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0xc')},'header_offline':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xdd78('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0x12')},'noteTitle':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xdd78('0x13')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xdd78('0x14')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xdd78('0x14')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0x15')},'ratingType':{'type':Sequelize[_0xdd78('0x8')](_0xdd78('0x16'),_0xdd78('0x17')),'defaultValue':_0xdd78('0x16')},'ratingStarsNumber':{'type':Sequelize[_0xdd78('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xdd78('0x18')]({'items':[{'type':_0xdd78('0x19'),'variable':null,'config':{'placeholder':'name','type':_0xdd78('0x1a'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xdd78('0x19'),'props':{'title':_0xdd78('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xdd78('0x4'),'type':_0xdd78('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xdd78('0x1b')]('onlineForm')?JSON[_0xdd78('0x1c')](this[_0xdd78('0x1b')](_0xdd78('0x1d'))):{};},'set':function(_0x195ed1){return this[_0xdd78('0x1e')](_0xdd78('0x1d'),JSON['stringify'](_0x195ed1));}},'offlineForm':{'type':Sequelize[_0xdd78('0x1f')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0xdd78('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xdd78('0x4'),'type':_0xdd78('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0xdd78('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0xdd78('0x1b')](_0xdd78('0x21'))?JSON[_0xdd78('0x1c')](this[_0xdd78('0x1b')](_0xdd78('0x21'))):{};},'set':function(_0x4716a7){return this[_0xdd78('0x1e')]('offlineForm',JSON['stringify'](_0x4716a7));}},'token':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':function(){return rs[_0xdd78('0x22')]();}},'autoclose':{'type':Sequelize[_0xdd78('0x14')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xdd78('0x14')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xdd78('0x3')]},'forwardOffline':{'type':Sequelize[_0xdd78('0x14')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xdd78('0x3')]},'waitingTitle':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0x23')},'waitingMessage':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0x24')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0x25')},'skipUnmanaged':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0x13')},'sendUnmanaged':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0xc')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xdd78('0x14')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xdd78('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdd78('0x26');}},'notificationSound':{'type':Sequelize[_0xdd78('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdd78('0x14')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xdd78('0x14')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xdd78('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xdd78('0xe')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xdd78('0x27')},'defaultTitle':{'type':Sequelize[_0xdd78('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xdd78('0x14')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xdd78('0x3')],'allowNull':![],'defaultValue':_0xdd78('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xdd78('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdd78('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdd78('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':_0xdd78('0x29')},'systemAvatar':{'type':Sequelize[_0xdd78('0x1f')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xdd78('0x2a')},'mandatoryDisposition':{'type':Sequelize[_0xdd78('0x14')],'defaultValue':![],'comment':_0xdd78('0x2b'),'set':function(_0x33f969){if(!_0x33f969)this[_0xdd78('0x1e')](_0xdd78('0x2c'),null);this[_0xdd78('0x1e')](_0xdd78('0x2d'),_0x33f969);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xdd78('0x3')]},'vidaooTopic':{'type':Sequelize[_0xdd78('0x3')],'allowNull':![],'defaultValue':_0xdd78('0x2e')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xdd78('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0xdd78('0x1f')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xdd78('0x14')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index bf1937a..c731744 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 _0x5d01=['mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','list','applications','orderBy','priority','asc','account','ListId','contact','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','vendor','%s\x20%s\x20%s','device','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','forcedOwnership','Start','startRouting','notify','offline','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','originalname','mimetype','server','files','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','subjectOffline','mapValues','email','Chat','NotifyMailAccount','remove','addInteraction','omit','getInteractions','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','color_button','backgroundColor','addApplications','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','Pause','map','ChatWebsite','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','hasOwnProperty','nolimit','pick','options','removeDispositions','ids','CannedAnswer','findOne','removeAnswers','filename','addAvatar','agentAvatar','file','customerAvatar','addSystemAvatar','getLogo','join','root','sitepic','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','headers','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','from','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x5d01,0x1c9));var _0x15d0=function(_0x427c91,_0x5b8eba){_0x427c91=_0x427c91-0x0;var _0x17380a=_0x5d01[_0x427c91];return _0x17380a;};'use strict';var emlformat=require(_0x15d0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x15d0('0x1'));var rp=require(_0x15d0('0x2'));var moment=require(_0x15d0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x15d0('0x4'));var path=require(_0x15d0('0x5'));var sox=require('sox');var csv=require(_0x15d0('0x6'));var ejs=require(_0x15d0('0x7'));var fs=require('fs');var fs_extra=require(_0x15d0('0x8'));var _=require(_0x15d0('0x9'));var squel=require(_0x15d0('0xa'));var crypto=require('crypto');var jsforce=require(_0x15d0('0xb'));var deskjs=require(_0x15d0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x15d0('0xd'));var Papa=require(_0x15d0('0xe'));var Redis=require(_0x15d0('0xf'));var authService=require(_0x15d0('0x10'));var qs=require(_0x15d0('0x11'));var as=require(_0x15d0('0x12'));var hardwareService=require(_0x15d0('0x13'));var logger=require(_0x15d0('0x14'))('api');var utils=require(_0x15d0('0x15'));var config=require(_0x15d0('0x16'));var licenseUtil=require(_0x15d0('0x17'));var db=require('../../mysqldb')['db'];config[_0x15d0('0x18')]=_[_0x15d0('0x19')](config[_0x15d0('0x18')],{'host':_0x15d0('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x15d0('0x18')]));require(_0x15d0('0x1b'))[_0x15d0('0x1c')](socket);var jayson=require(_0x15d0('0x1d'));var client=jayson[_0x15d0('0x1e')][_0x15d0('0x1f')]({'port':0x232c});var client9002=jayson[_0x15d0('0x1e')]['http']({'port':0x232a});var client9003=jayson[_0x15d0('0x1e')][_0x15d0('0x1f')]({'port':0x232b});var client9001=jayson[_0x15d0('0x1e')][_0x15d0('0x1f')]({'port':0x2329});function respondWithRpcPromise(_0x565f57,_0x4aa1f4,_0x973c25,_0x11e195){return new BPromise(function(_0x18d14b,_0x41cad7){var _0x2f35a2=_0x11e195||client;return _0x2f35a2[_0x15d0('0x20')](_0x565f57,_0x973c25)[_0x15d0('0x21')](function(_0x1337b1){logger[_0x15d0('0x22')](_0x15d0('0x23'),_0x4aa1f4,_0x15d0('0x24'));logger['debug'](_0x15d0('0x25'),_0x4aa1f4,_0x15d0('0x24'),JSON[_0x15d0('0x26')](_0x1337b1));if(_0x1337b1[_0x15d0('0x27')]){if(_0x1337b1['error']['code']===0x1f4){logger[_0x15d0('0x27')](_0x15d0('0x23'),_0x4aa1f4,_0x1337b1[_0x15d0('0x27')]['message']);return _0x41cad7(_0x1337b1[_0x15d0('0x27')][_0x15d0('0x28')]);}logger[_0x15d0('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x4aa1f4,_0x1337b1[_0x15d0('0x27')][_0x15d0('0x28')]);return _0x18d14b(_0x1337b1[_0x15d0('0x27')][_0x15d0('0x28')]);}else{logger[_0x15d0('0x22')](_0x15d0('0x23'),_0x4aa1f4,_0x15d0('0x24'));_0x18d14b(_0x1337b1['result'][_0x15d0('0x28')]);}})['catch'](function(_0x220a36){logger[_0x15d0('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x4aa1f4,_0x220a36);_0x41cad7(_0x220a36);});});}function respondWithStatusCode(_0x24d5cc,_0x4a4027){_0x4a4027=_0x4a4027||0xcc;return function(_0x19fbbb){if(_0x19fbbb){return _0x24d5cc[_0x15d0('0x29')](_0x4a4027);}return _0x24d5cc['status'](_0x4a4027)[_0x15d0('0x2a')]();};}function respondWithResult(_0x3c7af6,_0x53da7a){_0x53da7a=_0x53da7a||0xc8;return function(_0x4309ce){if(_0x4309ce){return _0x3c7af6['status'](_0x53da7a)[_0x15d0('0x2b')](_0x4309ce);}};}function respondWithFilteredResult(_0x692159,_0x70dc82){return function(_0x5dd72f){if(_0x5dd72f){var _0x421cc5=typeof _0x70dc82[_0x15d0('0x2c')]===_0x15d0('0x2d')&&typeof _0x70dc82[_0x15d0('0x2e')]===_0x15d0('0x2d');var _0x177127=_0x5dd72f[_0x15d0('0x2f')];var _0x64ab77=_0x421cc5?0x0:_0x70dc82[_0x15d0('0x2c')];var _0xca49fc=_0x421cc5?_0x5dd72f[_0x15d0('0x2f')]:_0x70dc82[_0x15d0('0x2c')]+_0x70dc82['limit'];var _0x28585a;if(_0xca49fc>=_0x177127){_0xca49fc=_0x177127;_0x28585a=0xc8;}else{_0x28585a=0xce;}_0x692159[_0x15d0('0x30')](_0x28585a);return _0x692159[_0x15d0('0x31')](_0x15d0('0x32'),_0x64ab77+'-'+_0xca49fc+'/'+_0x177127)[_0x15d0('0x2b')](_0x5dd72f);}return null;};}function patchUpdates(_0x3cae45){return function(_0x3fc0bd){try{jsonpatch['apply'](_0x3fc0bd,_0x3cae45,!![]);}catch(_0x4d05f5){return BPromise[_0x15d0('0x33')](_0x4d05f5);}return _0x3fc0bd[_0x15d0('0x34')]();};}function saveUpdates(_0x32f015,_0xb54189){return function(_0x285f71){if(_0x285f71){return _0x285f71[_0x15d0('0x35')](_0x32f015)[_0x15d0('0x21')](function(_0xbd1259){return _0xbd1259;});}return null;};}function removeEntity(_0x5b5cdb,_0x558afd){return function(_0x441fda){if(_0x441fda){return _0x441fda['destroy']()[_0x15d0('0x21')](function(){var _0x53424e=_0x441fda[_0x15d0('0x36')]({'plain':!![]});var _0x45ad42=_0x15d0('0x37');return db[_0x15d0('0x38')][_0x15d0('0x39')]({'where':{'type':_0x45ad42,'resourceId':_0x53424e['id']}})['then'](function(){return _0x441fda;});})[_0x15d0('0x21')](function(){_0x5b5cdb[_0x15d0('0x30')](0xcc)[_0x15d0('0x2a')]();});}};}function handleEntityNotFound(_0x478cf6,_0x30b6ea){return function(_0x150171){if(!_0x150171){_0x478cf6[_0x15d0('0x29')](0x194);}return _0x150171;};}function handleError(_0x37b5a3,_0x33cb09){_0x33cb09=_0x33cb09||0x1f4;return function(_0x4e3667){logger['error'](_0x4e3667[_0x15d0('0x3a')]);if(_0x4e3667[_0x15d0('0x3b')]){delete _0x4e3667['name'];}_0x37b5a3[_0x15d0('0x30')](_0x33cb09)[_0x15d0('0x3c')](_0x4e3667);};}exports['index']=function(_0x337701,_0x442d68){var _0x5e9e8c={'include':[{'model':db[_0x15d0('0x3d')],'as':'mandatoryDispositionPause'}]},_0x165c61={},_0x1c5d98={'count':0x0,'rows':[]};var _0x246f60=_[_0x15d0('0x3e')](db[_0x15d0('0x3f')][_0x15d0('0x40')],function(_0xe4204){return{'name':_0xe4204['fieldName'],'type':_0xe4204[_0x15d0('0x41')]['key']};});_0x165c61[_0x15d0('0x42')]=_[_0x15d0('0x3e')](_0x246f60,_0x15d0('0x3b'));_0x165c61['query']=_[_0x15d0('0x43')](_0x337701[_0x15d0('0x44')]);_0x165c61[_0x15d0('0x45')]=_[_0x15d0('0x46')](_0x165c61[_0x15d0('0x42')],_0x165c61[_0x15d0('0x44')]);_0x5e9e8c[_0x15d0('0x47')]=_[_0x15d0('0x46')](_0x165c61[_0x15d0('0x42')],qs[_0x15d0('0x48')](_0x337701[_0x15d0('0x44')][_0x15d0('0x48')]));_0x5e9e8c[_0x15d0('0x47')]=_0x5e9e8c['attributes']['length']?_0x5e9e8c[_0x15d0('0x47')]:_0x165c61[_0x15d0('0x42')];if(!_0x337701[_0x15d0('0x44')]['hasOwnProperty']('nolimit')){_0x5e9e8c['limit']=qs[_0x15d0('0x2e')](_0x337701[_0x15d0('0x44')][_0x15d0('0x2e')]);_0x5e9e8c[_0x15d0('0x2c')]=qs['offset'](_0x337701['query']['offset']);}_0x5e9e8c[_0x15d0('0x49')]=qs[_0x15d0('0x4a')](_0x337701['query'][_0x15d0('0x4a')]);_0x5e9e8c[_0x15d0('0x4b')]=qs[_0x15d0('0x45')](_['pick'](_0x337701['query'],_0x165c61['filters']),_0x246f60);if(_0x337701[_0x15d0('0x44')][_0x15d0('0x4c')]){_0x5e9e8c['where']=_[_0x15d0('0x4d')](_0x5e9e8c[_0x15d0('0x4b')],{'$or':_[_0x15d0('0x3e')](_0x246f60,function(_0x5effd6){if(_0x5effd6[_0x15d0('0x41')]!==_0x15d0('0x4e')){var _0x3e123c={};_0x3e123c[_0x5effd6[_0x15d0('0x3b')]]={'$like':'%'+_0x337701[_0x15d0('0x44')][_0x15d0('0x4c')]+'%'};return _0x3e123c;}})});}_0x5e9e8c=_[_0x15d0('0x4d')]({},_0x5e9e8c,_0x337701['options']);var _0x66bd41={'where':_0x5e9e8c[_0x15d0('0x4b')]};return db['ChatWebsite'][_0x15d0('0x2f')](_0x66bd41)['then'](function(_0x5da588){_0x1c5d98[_0x15d0('0x2f')]=_0x5da588;if(_0x337701[_0x15d0('0x44')][_0x15d0('0x4f')]){_0x5e9e8c[_0x15d0('0x50')]=[{'all':!![]}];}return db['ChatWebsite'][_0x15d0('0x51')](_0x5e9e8c);})[_0x15d0('0x21')](function(_0x32150c){_0x1c5d98[_0x15d0('0x52')]=_0x32150c;return _0x1c5d98;})[_0x15d0('0x21')](respondWithFilteredResult(_0x442d68,_0x5e9e8c))[_0x15d0('0x53')](handleError(_0x442d68,null));};exports[_0x15d0('0x54')]=function(_0x2fee93,_0x56edd){var _0x441453={'raw':![],'where':{'id':_0x2fee93[_0x15d0('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x15d0('0x56')}]},_0x353700={};_0x353700[_0x15d0('0x42')]=_[_0x15d0('0x43')](db[_0x15d0('0x3f')][_0x15d0('0x40')]);_0x353700[_0x15d0('0x44')]=_['keys'](_0x2fee93[_0x15d0('0x44')]);_0x353700[_0x15d0('0x45')]=_['intersection'](_0x353700[_0x15d0('0x42')],_0x353700[_0x15d0('0x44')]);_0x441453[_0x15d0('0x47')]=_[_0x15d0('0x46')](_0x353700[_0x15d0('0x42')],qs['fields'](_0x2fee93[_0x15d0('0x44')][_0x15d0('0x48')]));_0x441453[_0x15d0('0x47')]=_0x441453[_0x15d0('0x47')][_0x15d0('0x57')]?_0x441453['attributes']:_0x353700[_0x15d0('0x42')];if(_0x2fee93[_0x15d0('0x44')][_0x15d0('0x4f')]){_0x441453[_0x15d0('0x50')]=[{'all':!![]}];}_0x441453=_['merge']({},_0x441453,_0x2fee93['options']);return db[_0x15d0('0x3f')]['find'](_0x441453)['then'](handleEntityNotFound(_0x56edd,null))[_0x15d0('0x21')](respondWithResult(_0x56edd,null))['catch'](handleError(_0x56edd,null));};exports['create']=function(_0x2bb609,_0x386b24){return db[_0x15d0('0x3f')][_0x15d0('0x58')](_0x2bb609[_0x15d0('0x59')],{})['then'](function(_0x3dd0e9){var _0x40aecb=_0x2bb609[_0x15d0('0x5a')][_0x15d0('0x36')]({'plain':!![]});if(!_0x40aecb)throw new Error(_0x15d0('0x5b'));if(_0x40aecb[_0x15d0('0x5c')]===_0x15d0('0x5a')){var _0x303061=_0x3dd0e9[_0x15d0('0x36')]({'plain':!![]});var _0x45503f='ChatWebsites';return db['UserProfileSection'][_0x15d0('0x5d')]({'where':{'name':_0x45503f,'userProfileId':_0x40aecb[_0x15d0('0x5e')]},'raw':!![]})[_0x15d0('0x21')](function(_0x2f26e1){if(_0x2f26e1&&_0x2f26e1[_0x15d0('0x5f')]===0x0){return db[_0x15d0('0x38')][_0x15d0('0x58')]({'name':_0x303061[_0x15d0('0x3b')],'resourceId':_0x303061['id'],'type':_0x2f26e1[_0x15d0('0x3b')],'sectionId':_0x2f26e1['id']},{})[_0x15d0('0x21')](function(){return _0x3dd0e9;});}else{return _0x3dd0e9;}})[_0x15d0('0x53')](function(_0x5247a5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5247a5);throw _0x5247a5;});}return _0x3dd0e9;})[_0x15d0('0x21')](respondWithResult(_0x386b24,0xc9))[_0x15d0('0x53')](handleError(_0x386b24,null));};exports[_0x15d0('0x35')]=function(_0x4015e4,_0x3b3be9){if(_0x4015e4[_0x15d0('0x59')]['id']){delete _0x4015e4['body']['id'];}return db[_0x15d0('0x3f')][_0x15d0('0x5d')]({'where':{'id':_0x4015e4[_0x15d0('0x55')]['id']},'include':[{'model':db[_0x15d0('0x3d')],'as':_0x15d0('0x56')}]})[_0x15d0('0x21')](handleEntityNotFound(_0x3b3be9,null))['then'](saveUpdates(_0x4015e4['body'],null))[_0x15d0('0x21')](respondWithResult(_0x3b3be9,null))[_0x15d0('0x53')](handleError(_0x3b3be9,null));};exports[_0x15d0('0x39')]=function(_0x5059db,_0x4ec9b9){return db[_0x15d0('0x3f')][_0x15d0('0x5d')]({'where':{'id':_0x5059db[_0x15d0('0x55')]['id']}})['then'](handleEntityNotFound(_0x4ec9b9,null))['then'](removeEntity(_0x4ec9b9,null))['catch'](handleError(_0x4ec9b9,null));};exports[_0x15d0('0x60')]=function(_0xd27127,_0x5cf543){return db[_0x15d0('0x3f')][_0x15d0('0x60')]()[_0x15d0('0x21')](respondWithResult(_0x5cf543,null))['catch'](handleError(_0x5cf543,null));};exports[_0x15d0('0x61')]=function(_0xab7dda,_0xc0bc73,_0x388b6e){if(_0xab7dda[_0x15d0('0x59')]['id']){delete _0xab7dda[_0x15d0('0x59')]['id'];}return db[_0x15d0('0x3f')]['find']({'where':{'id':_0xab7dda[_0x15d0('0x55')]['id']}})[_0x15d0('0x21')](handleEntityNotFound(_0xc0bc73,null))[_0x15d0('0x21')](function(_0x5d0671){if(_0x5d0671){_0xab7dda[_0x15d0('0x59')][_0x15d0('0x62')]=_0x5d0671['id'];return db[_0x15d0('0x63')][_0x15d0('0x58')](_0xab7dda[_0x15d0('0x59')]);}})[_0x15d0('0x21')](respondWithResult(_0xc0bc73,null))['catch'](handleError(_0xc0bc73,null));};exports[_0x15d0('0x64')]=function(_0x1c93cf,_0x1df92d,_0x18a977){var _0x238867={'raw':![],'where':{}};var _0x168496={};var _0x43853f={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1c93cf[_0x15d0('0x55')]['id']}})['then'](handleEntityNotFound(_0x1df92d,null))['then'](function(_0x26cf58){if(_0x26cf58){_0x168496[_0x15d0('0x42')]=_[_0x15d0('0x43')](db[_0x15d0('0x63')][_0x15d0('0x40')]);_0x168496[_0x15d0('0x44')]=_[_0x15d0('0x43')](_0x1c93cf[_0x15d0('0x44')]);_0x168496[_0x15d0('0x45')]=_[_0x15d0('0x46')](_0x168496['model'],_0x168496[_0x15d0('0x44')]);_0x238867[_0x15d0('0x47')]=_[_0x15d0('0x46')](_0x168496[_0x15d0('0x42')],qs[_0x15d0('0x48')](_0x1c93cf[_0x15d0('0x44')]['fields']));_0x238867[_0x15d0('0x47')]=_0x238867['attributes'][_0x15d0('0x57')]?_0x238867[_0x15d0('0x47')]:_0x168496['model'];if(!_0x1c93cf['query'][_0x15d0('0x65')](_0x15d0('0x66'))){_0x238867[_0x15d0('0x2e')]=qs['limit'](_0x1c93cf[_0x15d0('0x44')]['limit']);_0x238867[_0x15d0('0x2c')]=qs['offset'](_0x1c93cf[_0x15d0('0x44')][_0x15d0('0x2c')]);}_0x238867[_0x15d0('0x49')]=qs[_0x15d0('0x4a')](_0x1c93cf[_0x15d0('0x44')]['sort']);_0x238867[_0x15d0('0x4b')]=qs[_0x15d0('0x45')](_[_0x15d0('0x67')](_0x1c93cf['query'],_0x168496['filters']));_0x238867[_0x15d0('0x4b')][_0x15d0('0x62')]=_0x26cf58['id'];if(_0x1c93cf[_0x15d0('0x44')]['filter']){_0x238867['where']=_[_0x15d0('0x4d')](_0x238867[_0x15d0('0x4b')],{'$or':_[_0x15d0('0x3e')](_0x238867[_0x15d0('0x47')],function(_0x2c9a11){var _0x2b56a2={};_0x2b56a2[_0x2c9a11]={'$like':'%'+_0x1c93cf[_0x15d0('0x44')][_0x15d0('0x4c')]+'%'};return _0x2b56a2;})});}_0x238867=_[_0x15d0('0x4d')]({},_0x238867,_0x1c93cf[_0x15d0('0x68')]);return db[_0x15d0('0x63')][_0x15d0('0x2f')]({'where':_0x238867[_0x15d0('0x4b')]})['then'](function(_0x599450){_0x43853f[_0x15d0('0x2f')]=_0x599450;if(_0x1c93cf[_0x15d0('0x44')][_0x15d0('0x4f')]){_0x238867['include']=[{'all':!![]}];}return db[_0x15d0('0x63')][_0x15d0('0x51')](_0x238867);})['then'](function(_0xcf2739){_0x43853f[_0x15d0('0x52')]=_0xcf2739;return _0x43853f;});}})[_0x15d0('0x21')](respondWithFilteredResult(_0x1df92d,_0x238867))[_0x15d0('0x53')](handleError(_0x1df92d,null));};exports[_0x15d0('0x69')]=function(_0x38f03e,_0x1f8d4e,_0x2f55e0){return db['ChatWebsite'][_0x15d0('0x5d')]({'where':{'id':_0x38f03e[_0x15d0('0x55')]['id']}})['then'](handleEntityNotFound(_0x1f8d4e,null))[_0x15d0('0x21')](function(_0x3855c2){if(_0x3855c2){return _0x3855c2[_0x15d0('0x69')](_0x38f03e[_0x15d0('0x44')][_0x15d0('0x6a')]);}})['then'](respondWithStatusCode(_0x1f8d4e,null))[_0x15d0('0x53')](handleError(_0x1f8d4e,null));};exports['addAnswer']=function(_0x32cf10,_0x22fb2e,_0x1e7f71){if(_0x32cf10[_0x15d0('0x59')]['id']){delete _0x32cf10[_0x15d0('0x59')]['id'];}return db[_0x15d0('0x3f')][_0x15d0('0x5d')]({'where':{'id':_0x32cf10['params']['id']}})[_0x15d0('0x21')](handleEntityNotFound(_0x22fb2e,null))[_0x15d0('0x21')](function(_0x272eba){if(_0x272eba){_0x32cf10[_0x15d0('0x59')][_0x15d0('0x62')]=_0x272eba['id'];return db[_0x15d0('0x6b')]['create'](_0x32cf10[_0x15d0('0x59')]);}})['then'](respondWithResult(_0x22fb2e,null))[_0x15d0('0x53')](handleError(_0x22fb2e,null));};exports['getAnswers']=function(_0x4db7ed,_0xe245e3,_0x31e723){var _0xf48074={'raw':![],'where':{}};var _0x472d9f={};var _0xb634e6={'count':0x0,'rows':[]};return db[_0x15d0('0x3f')][_0x15d0('0x6c')]({'where':{'id':_0x4db7ed[_0x15d0('0x55')]['id']}})['then'](handleEntityNotFound(_0xe245e3,null))[_0x15d0('0x21')](function(_0x378138){if(_0x378138){_0x472d9f[_0x15d0('0x42')]=_[_0x15d0('0x43')](db['CannedAnswer'][_0x15d0('0x40')]);_0x472d9f[_0x15d0('0x44')]=_[_0x15d0('0x43')](_0x4db7ed['query']);_0x472d9f[_0x15d0('0x45')]=_[_0x15d0('0x46')](_0x472d9f['model'],_0x472d9f[_0x15d0('0x44')]);_0xf48074['attributes']=_[_0x15d0('0x46')](_0x472d9f[_0x15d0('0x42')],qs['fields'](_0x4db7ed[_0x15d0('0x44')][_0x15d0('0x48')]));_0xf48074[_0x15d0('0x47')]=_0xf48074['attributes']['length']?_0xf48074['attributes']:_0x472d9f['model'];if(!_0x4db7ed[_0x15d0('0x44')][_0x15d0('0x65')](_0x15d0('0x66'))){_0xf48074['limit']=qs[_0x15d0('0x2e')](_0x4db7ed[_0x15d0('0x44')][_0x15d0('0x2e')]);_0xf48074[_0x15d0('0x2c')]=qs['offset'](_0x4db7ed[_0x15d0('0x44')]['offset']);}_0xf48074[_0x15d0('0x49')]=qs[_0x15d0('0x4a')](_0x4db7ed[_0x15d0('0x44')][_0x15d0('0x4a')]);_0xf48074[_0x15d0('0x4b')]=qs['filters'](_['pick'](_0x4db7ed['query'],_0x472d9f[_0x15d0('0x45')]));_0xf48074[_0x15d0('0x4b')][_0x15d0('0x62')]=_0x378138['id'];if(_0x4db7ed[_0x15d0('0x44')][_0x15d0('0x4c')]){_0xf48074[_0x15d0('0x4b')]=_['merge'](_0xf48074[_0x15d0('0x4b')],{'$or':_[_0x15d0('0x3e')](_0xf48074['attributes'],function(_0x6f5d27){var _0x388aa3={};_0x388aa3[_0x6f5d27]={'$like':'%'+_0x4db7ed[_0x15d0('0x44')][_0x15d0('0x4c')]+'%'};return _0x388aa3;})});}_0xf48074=_[_0x15d0('0x4d')]({},_0xf48074,_0x4db7ed[_0x15d0('0x68')]);return db[_0x15d0('0x6b')][_0x15d0('0x2f')]({'where':_0xf48074[_0x15d0('0x4b')]})['then'](function(_0x57aa71){_0xb634e6[_0x15d0('0x2f')]=_0x57aa71;if(_0x4db7ed['query'][_0x15d0('0x4f')]){_0xf48074['include']=[{'all':!![]}];}return db[_0x15d0('0x6b')][_0x15d0('0x51')](_0xf48074);})['then'](function(_0xefdc5b){_0xb634e6['rows']=_0xefdc5b;return _0xb634e6;});}})[_0x15d0('0x21')](respondWithFilteredResult(_0xe245e3,_0xf48074))['catch'](handleError(_0xe245e3,null));};exports[_0x15d0('0x6d')]=function(_0x11e88b,_0x20dcc6,_0x36fba2){return db[_0x15d0('0x3f')][_0x15d0('0x5d')]({'where':{'id':_0x11e88b[_0x15d0('0x55')]['id']}})['then'](handleEntityNotFound(_0x20dcc6,null))[_0x15d0('0x21')](function(_0x41184b){if(_0x41184b){return _0x41184b[_0x15d0('0x6d')](_0x11e88b['query'][_0x15d0('0x6a')]);}})[_0x15d0('0x21')](respondWithStatusCode(_0x20dcc6,null))['catch'](handleError(_0x20dcc6,null));};exports['addLogo']=function(_0x5542e8,_0x2ed6e9,_0x57a394){_0x5542e8[_0x15d0('0x59')]['sitepic']=_0x5542e8['file'][_0x15d0('0x6e')];return db[_0x15d0('0x3f')][_0x15d0('0x5d')]({'where':{'id':_0x5542e8[_0x15d0('0x55')]['id']}})['then'](handleEntityNotFound(_0x2ed6e9,null))[_0x15d0('0x21')](saveUpdates(_0x5542e8[_0x15d0('0x59')],null))['then'](respondWithResult(_0x2ed6e9,null))[_0x15d0('0x53')](handleError(_0x2ed6e9,null));};exports[_0x15d0('0x6f')]=function(_0x9bcf00,_0x1650a9,_0xd13368){_0x9bcf00['body'][_0x15d0('0x70')]=_0x9bcf00[_0x15d0('0x71')][_0x15d0('0x6e')];return db[_0x15d0('0x3f')][_0x15d0('0x5d')]({'where':{'id':_0x9bcf00[_0x15d0('0x55')]['id']}})[_0x15d0('0x21')](handleEntityNotFound(_0x1650a9,null))[_0x15d0('0x21')](saveUpdates(_0x9bcf00[_0x15d0('0x59')],null))['then'](respondWithResult(_0x1650a9,null))[_0x15d0('0x53')](handleError(_0x1650a9,null));};exports['addCustomerAvatar']=function(_0xfa283a,_0x58d968,_0x548949){_0xfa283a['body'][_0x15d0('0x72')]=_0xfa283a[_0x15d0('0x71')][_0x15d0('0x6e')];return db[_0x15d0('0x3f')]['find']({'where':{'id':_0xfa283a[_0x15d0('0x55')]['id']}})[_0x15d0('0x21')](handleEntityNotFound(_0x58d968,null))[_0x15d0('0x21')](saveUpdates(_0xfa283a['body'],null))[_0x15d0('0x21')](respondWithResult(_0x58d968,null))[_0x15d0('0x53')](handleError(_0x58d968,null));};exports[_0x15d0('0x73')]=function(_0x10ea5b,_0x1ec7f5,_0x21d170){_0x10ea5b['body']['systemAvatar']=_0x10ea5b[_0x15d0('0x71')][_0x15d0('0x6e')];return db[_0x15d0('0x3f')][_0x15d0('0x5d')]({'where':{'id':_0x10ea5b['params']['id']}})[_0x15d0('0x21')](handleEntityNotFound(_0x1ec7f5,null))[_0x15d0('0x21')](saveUpdates(_0x10ea5b[_0x15d0('0x59')],null))['then'](respondWithResult(_0x1ec7f5,null))[_0x15d0('0x53')](handleError(_0x1ec7f5,null));};exports[_0x15d0('0x74')]=function(_0x5b5950,_0x14839c,_0xa3e3ce){var _0x261c84=path[_0x15d0('0x75')](config[_0x15d0('0x76')],'server/files/images/logos/default_logo.svg');var _0xade6dc={'where':{'id':_0x5b5950['params']['id']},'attributes':['id',_0x15d0('0x77')],'raw':!![]};var _0x3bbead=![];return require('../../config/license/util')[_0x15d0('0x78')]()['then'](function(_0x4f0a6d){if(_0x4f0a6d){_0x3bbead=_0x4f0a6d[_0x15d0('0x79')];}})[_0x15d0('0x21')](function(){return db[_0x15d0('0x3f')]['find'](_0xade6dc);})[_0x15d0('0x21')](handleEntityNotFound(_0x14839c,null))[_0x15d0('0x21')](function(_0x196914){if(_0x196914){if(!_[_0x15d0('0x7a')](_0x196914[_0x15d0('0x77')])){if(fs[_0x15d0('0x7b')](path[_0x15d0('0x75')](config[_0x15d0('0x76')],_0x15d0('0x7c'),_0x196914[_0x15d0('0x77')]))&&_0x3bbead){_0x261c84=path['join'](config['root'],_0x15d0('0x7c'),_0x196914[_0x15d0('0x77')]);}}return _0x14839c[_0x15d0('0x7d')](_0x261c84);}})[_0x15d0('0x53')](handleError(_0x14839c,null));};exports[_0x15d0('0x7e')]=function(_0x5076a1,_0x50b463,_0x3c7b5d){var _0x3c33bd=path[_0x15d0('0x75')](config[_0x15d0('0x76')],'server/files/images/avatars/default_avatar.png');var _0x47882f={'where':{'id':_0x5076a1[_0x15d0('0x55')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x15d0('0x3f')][_0x15d0('0x5d')](_0x47882f)[_0x15d0('0x21')](handleEntityNotFound(_0x50b463,null))[_0x15d0('0x21')](function(_0x52a46f){if(_0x52a46f){if(!_[_0x15d0('0x7a')](_0x52a46f[_0x15d0('0x70')])){if(fs['existsSync'](path[_0x15d0('0x75')](config[_0x15d0('0x76')],_0x15d0('0x7f'),_0x52a46f[_0x15d0('0x70')]))){_0x3c33bd=path[_0x15d0('0x75')](config[_0x15d0('0x76')],_0x15d0('0x7f'),_0x52a46f['agentAvatar']);}}return _0x50b463['download'](_0x3c33bd);}})[_0x15d0('0x53')](handleError(_0x50b463,null));};exports['getCustomerAvatar']=function(_0x4cac2a,_0x3d9378,_0xf623a0){var _0x508445=path['join'](config[_0x15d0('0x76')],_0x15d0('0x80'));var _0x5f296d={'where':{'id':_0x4cac2a[_0x15d0('0x55')]['id']},'attributes':['id','customerAvatar',_0x15d0('0x81')],'raw':!![]};return db[_0x15d0('0x3f')][_0x15d0('0x5d')](_0x5f296d)[_0x15d0('0x21')](handleEntityNotFound(_0x3d9378,null))[_0x15d0('0x21')](function(_0x8c248c){if(_0x8c248c){if(!_[_0x15d0('0x7a')](_0x8c248c[_0x15d0('0x72')])){if(fs[_0x15d0('0x7b')](path[_0x15d0('0x75')](config[_0x15d0('0x76')],'server/files/images/avatars/',_0x8c248c[_0x15d0('0x72')]))&&_0x8c248c[_0x15d0('0x81')]){_0x508445=path[_0x15d0('0x75')](config[_0x15d0('0x76')],_0x15d0('0x7f'),_0x8c248c[_0x15d0('0x72')]);}}return _0x3d9378[_0x15d0('0x7d')](_0x508445);}})[_0x15d0('0x53')](handleError(_0x3d9378,null));};exports[_0x15d0('0x82')]=function(_0x27ca9d,_0x2684a1,_0x316dbc){var _0x59c517=path[_0x15d0('0x75')](config[_0x15d0('0x76')],_0x15d0('0x83'));var _0xb7bf54={'where':{'id':_0x27ca9d['params']['id']},'attributes':['id',_0x15d0('0x84')],'raw':!![]};return db[_0x15d0('0x3f')][_0x15d0('0x5d')](_0xb7bf54)['then'](handleEntityNotFound(_0x2684a1,null))[_0x15d0('0x21')](function(_0x3912e1){if(_0x3912e1){if(!_[_0x15d0('0x7a')](_0x3912e1['systemAvatar'])){if(fs[_0x15d0('0x7b')](path[_0x15d0('0x75')](config[_0x15d0('0x76')],_0x15d0('0x7f'),_0x3912e1[_0x15d0('0x84')]))){_0x59c517=path[_0x15d0('0x75')](config[_0x15d0('0x76')],_0x15d0('0x7f'),_0x3912e1['systemAvatar']);}}return _0x2684a1[_0x15d0('0x7d')](_0x59c517);}})[_0x15d0('0x53')](handleError(_0x2684a1,null));};exports['notify']=function(_0x50ab02,_0x32aa22,_0x11ba5c){var _0x441a33=require(_0x15d0('0x85'));var _0x533d74=new _0x441a33();var _0x3cb908=_0x533d74['setUA'](_0x50ab02[_0x15d0('0x86')][_0x15d0('0x87')])[_0x15d0('0x88')]();var _0x2ce51c={'body':_0x50ab02['body'],'channel':_0x15d0('0x89')};var _0x36a68f=[];var _0x12bb14=[];var _0x16971e={};var _0x20fd26=![];return db[_0x15d0('0x8a')][_0x15d0('0x60')]()[_0x15d0('0x21')](function(_0x5c1fe0){if(!_0x5c1fe0){throw new db['Sequelize'][(_0x15d0('0x8b'))](_0x15d0('0x8c'));}_0x36a68f=_[_0x15d0('0x8d')](_['keys'](_0x5c1fe0),['createdAt',_0x15d0('0x8e')]);_0x12bb14=_[_0x15d0('0x8d')](_[_0x15d0('0x43')](_0x5c1fe0),[_0x15d0('0x8f'),_0x15d0('0x8e'),_0x15d0('0x90'),'ListId']);if(_0x50ab02[_0x15d0('0x59')]['id']){delete _0x50ab02[_0x15d0('0x59')]['id'];}if(_[_0x15d0('0x7a')](_0x50ab02[_0x15d0('0x59')][_0x15d0('0x91')])){throw new db['Sequelize'][(_0x15d0('0x8b'))](_0x15d0('0x92'));}if(_[_0x15d0('0x7a')](_0x50ab02[_0x15d0('0x59')][_0x15d0('0x59')])||_0x50ab02['body'][_0x15d0('0x59')]===''){throw new db[(_0x15d0('0x93'))][(_0x15d0('0x8b'))](_0x15d0('0x94'));}if(_[_0x15d0('0x7a')](_0x50ab02['body'][_0x15d0('0x95')])){throw new db[(_0x15d0('0x93'))][(_0x15d0('0x8b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x12bb14);}if(!_[_0x15d0('0x96')](_0x12bb14,_0x50ab02[_0x15d0('0x59')][_0x15d0('0x95')])){throw new db['Sequelize']['ValidationError'](_0x15d0('0x97')+_0x12bb14);}_0x16971e[_0x50ab02[_0x15d0('0x59')][_0x15d0('0x95')]]=_0x50ab02['body'][_0x15d0('0x91')];})[_0x15d0('0x21')](function(){return db[_0x15d0('0x3f')][_0x15d0('0x5d')]({'where':{'id':_0x50ab02[_0x15d0('0x55')]['id']},'include':[{'model':db[_0x15d0('0x98')],'as':_0x15d0('0x99'),'include':[{'model':db['CmContact'],'as':_0x15d0('0x9a'),'where':_0x16971e,'limit':0x1,'order':[['updatedAt',_0x15d0('0x9b')]]}]},{'model':db[_0x15d0('0x9c')],'as':_0x15d0('0x9d')}]});})[_0x15d0('0x21')](handleEntityNotFound(_0x32aa22,null))[_0x15d0('0x21')](function(_0x2a3ff4){if(_0x2a3ff4&&_0x2a3ff4['List']){_0x2ce51c['account']=_0x2a3ff4;_0x2ce51c['applications']=_0x2a3ff4[_0x15d0('0x9d')];_0x2ce51c[_0x15d0('0x9e')]=_0x2a3ff4['List'];_0x2ce51c[_0x15d0('0x9f')]=_[_0x15d0('0xa0')](_0x2ce51c[_0x15d0('0x9f')],[_0x15d0('0xa1')],[_0x15d0('0xa2')]);if(_0x2ce51c[_0x15d0('0xa3')][_0x15d0('0x9d')]){delete _0x2ce51c['account'][_0x15d0('0x9d')];}if(_0x2ce51c[_0x15d0('0xa3')][_0x15d0('0x99')]&&_0x2ce51c[_0x15d0('0xa3')][_0x15d0('0x99')][_0x15d0('0x9a')][_0x15d0('0x57')]){return _0x2ce51c[_0x15d0('0xa3')][_0x15d0('0x99')][_0x15d0('0x9a')][0x0];}var _0x41eace=_[_0x15d0('0x19')](_0x50ab02['body'],{'firstName':_0x50ab02['body']['from'],'ListId':_0x2a3ff4[_0x15d0('0xa4')]});_0x41eace[_0x50ab02[_0x15d0('0x59')][_0x15d0('0x95')]]=_0x50ab02[_0x15d0('0x59')][_0x15d0('0x91')];return db[_0x15d0('0x8a')][_0x15d0('0x58')](_0x41eace,{'fields':_0x36a68f,'raw':!![]});}})[_0x15d0('0x21')](handleEntityNotFound(_0x32aa22,null))[_0x15d0('0x21')](function(_0x1660c3){_0x2ce51c[_0x15d0('0xa5')]=_0x1660c3;var _0x5d5450=_0x50ab02[_0x15d0('0x59')]['customerIp'];if(_0x50ab02[_0x15d0('0x86')][_0x15d0('0xa6')]){_0x5d5450=_0x50ab02['headers'][_0x15d0('0xa6')];}else if(_0x50ab02[_0x15d0('0x86')][_0x15d0('0xa7')]){_0x5d5450=_['first'](_0x50ab02[_0x15d0('0x86')][_0x15d0('0xa7')][_0x15d0('0xa8')](','));}if(_0x1660c3){var _0x27e597={'ContactId':_0x1660c3['id'],'ChatWebsiteId':_0x50ab02[_0x15d0('0x55')]['id'],'from':(_0x1660c3[_0x15d0('0xa9')]||'')+'\x20'+(_0x1660c3[_0x15d0('0xaa')]||''),'customerIp':_0x5d5450,'customerPort':_0x50ab02[_0x15d0('0x86')][_0x15d0('0xab')]?_0x50ab02[_0x15d0('0x86')]['x-real-port']:null,'referer':_0x50ab02[_0x15d0('0x59')][_0x15d0('0xac')],'browserName':_0x3cb908[_0x15d0('0xad')]['name']&&_0x3cb908[_0x15d0('0xad')][_0x15d0('0xae')]?util[_0x15d0('0xaf')](_0x15d0('0xb0'),_0x3cb908[_0x15d0('0xad')][_0x15d0('0x3b')],_0x3cb908[_0x15d0('0xad')]['version']):_0x15d0('0xb1'),'browserVersion':_0x3cb908[_0x15d0('0xad')][_0x15d0('0xae')]||_0x15d0('0xb1'),'osName':util[_0x15d0('0xaf')](_0x15d0('0xb0'),_0x3cb908['os'][_0x15d0('0x3b')],_0x3cb908['os'][_0x15d0('0xae')]),'osVersion':_0x3cb908['os']['version'],'deviceModel':_0x3cb908['device'][_0x15d0('0x42')]&&_0x3cb908['device'][_0x15d0('0xb2')]?util[_0x15d0('0xaf')](_0x15d0('0xb3'),_0x3cb908[_0x15d0('0xb4')]['model'],_0x3cb908[_0x15d0('0xb4')][_0x15d0('0xb2')],_0x3cb908[_0x15d0('0xb4')][_0x15d0('0x41')]):null,'deviceVendor':_0x3cb908[_0x15d0('0xb4')][_0x15d0('0xb2')],'deviceType':_0x3cb908[_0x15d0('0xb4')]['type'],'formData':JSON[_0x15d0('0x26')](_0x50ab02[_0x15d0('0x59')])};var _0x2fea08={'ChatWebsiteId':_0x50ab02[_0x15d0('0x55')]['id'],'closed':![]};if(_0x50ab02[_0x15d0('0x59')][_0x15d0('0xb5')]){_0x2fea08[_0x15d0('0xb5')]=_0x50ab02[_0x15d0('0x59')][_0x15d0('0xb5')];return db[_0x15d0('0xb6')][_0x15d0('0x5d')]({'where':_0x2fea08})[_0x15d0('0x21')](function(_0x287c51){if(_0x287c51){return[_0x287c51,![]];}_0x27e597['threadId']=_0x50ab02[_0x15d0('0x59')][_0x15d0('0xb5')];_0x27e597[_0x15d0('0xb7')]=_0x50ab02['body'][_0x15d0('0xb7')];return db[_0x15d0('0xb6')][_0x15d0('0x58')](_0x27e597)[_0x15d0('0x21')](function(_0x1e40a9){return[_0x1e40a9,!![]];});});}_0x2fea08[_0x15d0('0xb8')]=_0x1660c3['id'];if(_0x50ab02[_0x15d0('0x59')][_0x15d0('0xb9')]&&_0x50ab02[_0x15d0('0x59')][_0x15d0('0xb9')]['id']){_0x2fea08['id']=_0x50ab02['body']['interaction']['id'];return db[_0x15d0('0xb6')][_0x15d0('0x5d')]({'where':_0x2fea08})[_0x15d0('0x21')](function(_0x70b37b){if(_0x70b37b){return[_0x70b37b,![]];}return db[_0x15d0('0xb6')]['create'](_0x27e597)[_0x15d0('0x21')](function(_0x15183e){return[_0x15183e,!![]];});});}return db[_0x15d0('0xb6')][_0x15d0('0x58')](_0x27e597)[_0x15d0('0x21')](function(_0x30a0b1){return[_0x30a0b1,!![]];});}})[_0x15d0('0xba')](function(_0xb6880d,_0x308952){if(_0xb6880d){_0x20fd26=_0x308952;if(!_0x308952){var _0x5220bc={'from':(_0x2ce51c[_0x15d0('0xa5')][_0x15d0('0xa9')]||'')+'\x20'+(_0x2ce51c[_0x15d0('0xa5')][_0x15d0('0xaa')]||'')};if(_0x50ab02['body'][_0x15d0('0xb5')]&&_0x50ab02[_0x15d0('0x59')]['messageId']&&_0x50ab02['body'][_0x15d0('0xb5')]!=_0x50ab02['body'][_0x15d0('0xbb')]){_0x5220bc['threadId']=_0x50ab02['body'][_0x15d0('0xbb')];}return _0xb6880d[_0x15d0('0x35')](_0x5220bc);}else{return _0xb6880d;}}})['then'](function(_0x27e3ea){_0x2ce51c[_0x15d0('0xb9')]=_0x27e3ea[_0x15d0('0x36')]({'plain':!![]});_0x2ce51c['interaction']['created']=_0x20fd26;if(_0x2ce51c[_0x15d0('0xb9')][_0x15d0('0xbc')]){if(_0x2ce51c[_0x15d0('0xa3')][_0x15d0('0xbd')]){_0x2ce51c[_0x15d0('0x9f')][_0x15d0('0xbe')]({'id':0x0,'priority':_0x2ce51c[_0x15d0('0x9f')][_0x15d0('0x57')]+0x1,'app':'close','appdata':_0x15d0('0xbf'),'interval':_0x15d0('0xc0')});}}return db[_0x15d0('0xc1')][_0x15d0('0x58')]({'body':_0x50ab02[_0x15d0('0x59')][_0x15d0('0x59')],'ChatWebsiteId':_0x50ab02[_0x15d0('0x55')]['id'],'ChatInteractionId':_0x27e3ea['id'],'direction':'in','ContactId':_0x2ce51c[_0x15d0('0xa5')]['id'],'AttachmentId':_0x50ab02[_0x15d0('0x59')][_0x15d0('0xc2')]});})[_0x15d0('0x21')](function(_0xb33614){_0x2ce51c['message']=_0xb33614;if(_0x2ce51c[_0x15d0('0xb9')][_0x15d0('0xc3')]){return db[_0x15d0('0xc4')][_0x15d0('0x5d')]({'attributes':['id',_0x15d0('0x3b')],'where':{'id':_0x2ce51c[_0x15d0('0xb9')][_0x15d0('0xc3')]}})[_0x15d0('0x21')](function(_0x1736d3){if(_0x1736d3){_0x2ce51c[_0x15d0('0x9f')][_0x15d0('0xc5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1736d3[_0x15d0('0x3b')]+','+(_0x2ce51c[_0x15d0('0xa3')]['waitForTheAssignedAgent']||0xa),'interval':_0x15d0('0xc0')});_0x2ce51c[_0x15d0('0xc6')]=!![];}return respondWithRpcPromise(_0x15d0('0xc7'),_0x15d0('0xc8'),_0x2ce51c);});}return respondWithRpcPromise(_0x15d0('0xc7'),'startRouting',_0x2ce51c);})['then'](function(_0x30318b){respondWithRpcPromise('EventManager','EventManager',{'event':_0x15d0('0xc9'),'message':_0x30318b},client9002);return _0x30318b;})[_0x15d0('0x21')](respondWithResult(_0x32aa22,null))[_0x15d0('0x53')](handleError(_0x32aa22,null));};exports[_0x15d0('0xca')]=function(_0x349db5,_0x14f621,_0x535367){var _0x3331c2,_0x2ebc83,_0x4a9f6c;var _0x4045aa=[];var _0x4f83fe=[];var _0x5432c4={};var _0x109749=_0x349db5['files']||[];var _0x390376=[];var _0x32d17e;return db[_0x15d0('0x8a')][_0x15d0('0x60')]()[_0x15d0('0x21')](function(_0x10347a){if(!_0x10347a){throw new db[(_0x15d0('0x93'))][(_0x15d0('0x8b'))]('no\x20available\x20attributes');}_0x4f83fe=_[_0x15d0('0x8d')](_[_0x15d0('0x43')](_0x10347a),[_0x15d0('0x8f'),_0x15d0('0x8e')]);_0x4045aa=_[_0x15d0('0x8d')](_['keys'](_0x10347a),[_0x15d0('0x8f'),_0x15d0('0x8e'),_0x15d0('0x90'),'ListId']);if(_0x349db5[_0x15d0('0x59')]['id']){delete _0x349db5[_0x15d0('0x59')]['id'];}if(_[_0x15d0('0x7a')](_0x349db5[_0x15d0('0x59')]['from'])){throw _0x14f621[_0x15d0('0x30')](0x1f4)[_0x15d0('0x3c')](new db[(_0x15d0('0x93'))][(_0x15d0('0x8b'))](_0x15d0('0x92')));}if(_['isNil'](_0x349db5[_0x15d0('0x59')][_0x15d0('0x59')])||_0x349db5[_0x15d0('0x59')]['body']===''){throw _0x14f621['status'](0x1f4)['send'](new db[(_0x15d0('0x93'))][(_0x15d0('0x8b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x349db5[_0x15d0('0x59')]['mapKeyOffline'])){throw _0x14f621[_0x15d0('0x30')](0x1f4)[_0x15d0('0x3c')](new db[(_0x15d0('0x93'))][(_0x15d0('0x8b'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4045aa));}if(!_[_0x15d0('0x96')](_0x4045aa,_0x349db5[_0x15d0('0x59')][_0x15d0('0xcb')])){throw _0x14f621['status'](0x1f4)['send'](new db[(_0x15d0('0x93'))]['ValidationError'](_0x15d0('0xcc')+_0x4045aa));}_0x5432c4[_0x349db5['body']['mapKeyOffline']]=_0x349db5['body'][_0x15d0('0x91')];})['then'](function(){return db[_0x15d0('0x3f')]['find']({'where':{'id':_0x349db5[_0x15d0('0x55')]['id']},'include':[{'model':db[_0x15d0('0x98')],'as':_0x15d0('0x99')},{'model':db[_0x15d0('0xcd')],'as':_0x15d0('0xcd')}]});})['then'](handleEntityNotFound(_0x14f621,null))['then'](function(_0xac37b3){if(_0xac37b3&&_0xac37b3[_0x15d0('0x99')]){_0x2ebc83=_0xac37b3;var _0xd046f6=_[_0x15d0('0x19')](_0x349db5[_0x15d0('0x59')],{'firstName':_0x349db5[_0x15d0('0x59')]['from'],'phone':_0x349db5[_0x15d0('0x59')]['from'],'ListId':_0xac37b3[_0x15d0('0xa4')]});_0xd046f6[_0x349db5['body'][_0x15d0('0xcb')]]=_0x349db5[_0x15d0('0x59')][_0x15d0('0x91')];return db[_0x15d0('0x8a')][_0x15d0('0xce')]({'where':_0x5432c4,'defaults':_0xd046f6});}})[_0x15d0('0xba')](function(_0x4f6f9d){if(_0x4f6f9d){_0x4a9f6c=_0x4f6f9d;var _0x457159=fs[_0x15d0('0xcf')](path[_0x15d0('0x75')](config[_0x15d0('0x76')],_0x15d0('0xd0')),_0x15d0('0xd1'));var _0x4f52d4=ejs[_0x15d0('0xd2')](_0x457159,{'body':_[_0x15d0('0xd3')](_0x349db5[_0x15d0('0x59')][_0x15d0('0x59')]),'bodyTitle':_0x2ebc83['offlineMessageBody']});return db['ChatOfflineMessage']['create']({'body':_0x4f52d4,'ContactId':_0x4f6f9d['id'],'ChatWebsiteId':_0x2ebc83['id']});}})[_0x15d0('0x21')](function(_0x11203d){_0x32d17e=_0x11203d;if(_0x109749[_0x15d0('0x57')]){var _0x1207af=_0x109749[_0x15d0('0x3e')](function(_0xc1ed45){return{'name':_0xc1ed45[_0x15d0('0xd4')],'basename':_0xc1ed45[_0x15d0('0x6e')],'type':_0xc1ed45[_0x15d0('0xd5')],'ChatOfflineMessageId':_0x11203d['id']};});_0x390376=_0x1207af[_0x15d0('0x3e')](_0xd33610=>{var _0x2792d3={'filename':_0xd33610[_0x15d0('0x3b')],'path':path[_0x15d0('0x75')](config[_0x15d0('0x76')],_0x15d0('0xd6'),_0x15d0('0xd7'),_0x15d0('0xd8'),_0x15d0('0xd9'),_0xd33610[_0x15d0('0xda')])};return _0x2792d3;});if(!_0x2ebc83[_0x15d0('0xdb')]){return db[_0x15d0('0xdc')][_0x15d0('0xdd')](function(_0x34f369){return db[_0x15d0('0xde')][_0x15d0('0xdf')](_0x1207af,{'transaction':_0x34f369});});}}})[_0x15d0('0x21')](function(){if(_0x32d17e){_0x3331c2=_0x32d17e;return db[_0x15d0('0xcd')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0x15d0('0xe0')],'as':_0x15d0('0xe1'),'raw':!![]}]});}})[_0x15d0('0x21')](function(_0x37817f){if(_0x37817f&&_0x37817f[_0x15d0('0xe1')]&&_0x2ebc83[_0x15d0('0xe2')]&&_0x2ebc83[_0x15d0('0xe3')]){var _0x698d81={'tls':{'rejectUnauthorized':![]}};if(_0x37817f[_0x15d0('0xe1')][_0x15d0('0xe4')]){_0x698d81[_0x15d0('0xe4')]=_0x37817f[_0x15d0('0xe1')]['service'];}else{_0x698d81[_0x15d0('0xe5')]=_0x37817f[_0x15d0('0xe1')][_0x15d0('0xe5')];_0x698d81['port']=_0x37817f[_0x15d0('0xe1')]['port'];_0x698d81[_0x15d0('0xe6')]=_0x37817f['Smtp'][_0x15d0('0xe6')];}if(_0x37817f['Smtp']['authentication']){_0x698d81[_0x15d0('0xe7')]={'user':_0x37817f[_0x15d0('0xe1')][_0x15d0('0x5a')],'pass':_0x37817f[_0x15d0('0xe1')][_0x15d0('0xe8')]};}return respondWithRpcPromise(_0x15d0('0xe9'),_0x15d0('0xea'),{'account':_0x698d81,'message':{'from':util[_0x15d0('0xaf')](_0x15d0('0xeb'),_0x37817f[_0x15d0('0x3b')],_0x37817f['email']||_0x37817f[_0x15d0('0xe1')][_0x15d0('0x5a')]),'to':_0x2ebc83['forwardOfflineAddress'],'subject':_0x2ebc83[_0x15d0('0xec')],'html':_0x3331c2[_0x15d0('0x59')],'attachments':_0x390376}},client9003)['then'](function(){return _0x3331c2;})[_0x15d0('0x53')](function(_0x3e2bae){console[_0x15d0('0x27')](_0x3e2bae);});}})['then'](function(){if(_0x2ebc83&&_0x2ebc83[_0x15d0('0xdb')]&&_0x2ebc83['MailAccountId']){var _0x4ff277=[];if(_0x109749[_0x15d0('0x57')]){_0x4ff277=_0x109749[_0x15d0('0x3e')](function(_0x18269e){return{'name':_0x18269e[_0x15d0('0xd4')],'basename':_0x18269e['filename'],'type':_0x18269e[_0x15d0('0xd5')],'ChatOfflineMessageId':_0x32d17e['id']};});}var _0x5cc7ba;if(!_[_0x15d0('0x7a')](_0x2ebc83[_0x15d0('0xed')])){var _0x28b8c2=_[_0x15d0('0x3e')](_0x349db5['body'],function(_0x41964c){return _0x41964c;});var _0x27449e=_['toPairsIn'](_0x28b8c2)[0x0];var _0x47e76b=_[_0x15d0('0xee')](_0x27449e,function(_0x27f013){return _0x27f013;});_0x5cc7ba=_0x47e76b[0x1][_0x2ebc83[_0x15d0('0xed')]];}var _0x72b30c={'from':_0x4a9f6c[_0x15d0('0xef')],'firstName':_0x4a9f6c['firstName'],'lastName':_0x4a9f6c[_0x15d0('0xaa')],'mapKey':'email','message':{'from':_0x4a9f6c[_0x15d0('0xef')],'to':_0x2ebc83[_0x15d0('0xcd')][_0x15d0('0xef')],'cc':'','subject':_[_0x15d0('0x7a')](_0x5cc7ba)?_0x2ebc83[_0x15d0('0xec')]:_0x5cc7ba,'messageId':'','sentAt':new Date(),'attach':_0x4ff277[_0x15d0('0x57')],'attachments':_0x4ff277,'originChannel':_0x15d0('0xf0'),'ChatWebsiteId':_0x2ebc83['id'],'ChatOfflineMessageId':_0x3331c2['id'],'originTo':_0x2ebc83[_0x15d0('0xcd')]['email']},'body':_0x3331c2[_0x15d0('0x59')]};var _0x4314c4={'account':{'id':_0x2ebc83['MailAccountId']},'body':_0x72b30c,'log':_0x15d0('0xf1')};return respondWithRpcPromise(_0x15d0('0xf1'),'notifyMail',_0x4314c4,client9001)[_0x15d0('0x21')](function(){return _0x3331c2;})[_0x15d0('0x53')](function(_0x371e8e){console[_0x15d0('0x27')](_0x371e8e);});}return;})[_0x15d0('0x21')](function(){if(_0x3331c2){return _0x3331c2;}})[_0x15d0('0x21')](respondWithResult(_0x14f621,null))[_0x15d0('0x53')](function(_0x47b8db){console[_0x15d0('0x27')](_0x15d0('0x53'),_0x47b8db);for(var _0x4a8f2d of _0x109749){var _0x4868fa=path[_0x15d0('0x75')](config[_0x15d0('0x76')],_0x15d0('0xd6'),_0x15d0('0xd7'),_0x15d0('0xd8'),_0x15d0('0xd9'),_0x4a8f2d['filename']);fs_extra[_0x15d0('0xf2')](_0x4868fa)[_0x15d0('0x53')](function(_0x3b8d13){console[_0x15d0('0x27')]('Could\x20not\x20remove\x20attachment\x20file',_0x4868fa,_0x3b8d13);});}});};exports[_0x15d0('0xf3')]=function(_0x1a5052,_0x2335e3,_0x5830cc){return db[_0x15d0('0xb6')]['find']({'where':{'id':_0x1a5052[_0x15d0('0x55')]['id']}})[_0x15d0('0x21')](handleEntityNotFound(_0x2335e3,null))[_0x15d0('0x21')](function(_0x4c38fd){if(_0x4c38fd){return _0x4c38fd[_0x15d0('0xf3')](_0x1a5052[_0x15d0('0x59')][_0x15d0('0x6a')],_[_0x15d0('0xf4')](_0x1a5052[_0x15d0('0x59')],[_0x15d0('0x6a'),'id'])||{});}})[_0x15d0('0x21')](respondWithResult(_0x2335e3,null))['catch'](handleError(_0x2335e3,null));};exports[_0x15d0('0xf5')]=function(_0x4463d4,_0x30657b,_0xde8992){var _0x1fb215={'raw':![],'where':{}};var _0x5035bd={};var _0x5f2d09={'count':0x0,'rows':[]};return db[_0x15d0('0x3f')][_0x15d0('0x6c')]({'where':{'id':_0x4463d4[_0x15d0('0x55')]['id']}})[_0x15d0('0x21')](handleEntityNotFound(_0x30657b,null))[_0x15d0('0x21')](function(_0x5bbb5a){if(_0x5bbb5a){_0x5035bd[_0x15d0('0x42')]=_[_0x15d0('0x43')](db[_0x15d0('0xb6')]['rawAttributes']);_0x5035bd[_0x15d0('0x44')]=_[_0x15d0('0x43')](_0x4463d4[_0x15d0('0x44')]);_0x5035bd[_0x15d0('0x45')]=_[_0x15d0('0x46')](_0x5035bd[_0x15d0('0x42')],_0x5035bd[_0x15d0('0x44')]);_0x1fb215[_0x15d0('0x47')]=_['intersection'](_0x5035bd[_0x15d0('0x42')],qs['fields'](_0x4463d4[_0x15d0('0x44')][_0x15d0('0x48')]));_0x1fb215[_0x15d0('0x47')]=_0x1fb215[_0x15d0('0x47')]['length']?_0x1fb215['attributes']:_0x5035bd[_0x15d0('0x42')];if(!_0x4463d4[_0x15d0('0x44')][_0x15d0('0x65')](_0x15d0('0x66'))){_0x1fb215[_0x15d0('0x2e')]=qs[_0x15d0('0x2e')](_0x4463d4[_0x15d0('0x44')][_0x15d0('0x2e')]);_0x1fb215[_0x15d0('0x2c')]=qs[_0x15d0('0x2c')](_0x4463d4['query'][_0x15d0('0x2c')]);}_0x1fb215[_0x15d0('0x49')]=qs[_0x15d0('0x4a')](_0x4463d4[_0x15d0('0x44')][_0x15d0('0x4a')]);_0x1fb215[_0x15d0('0x4b')]=qs[_0x15d0('0x45')](_[_0x15d0('0x67')](_0x4463d4[_0x15d0('0x44')],_0x5035bd['filters']));_0x1fb215[_0x15d0('0x4b')][_0x15d0('0x62')]=_0x5bbb5a['id'];if(_0x4463d4[_0x15d0('0x44')][_0x15d0('0x4c')]){_0x1fb215[_0x15d0('0x4b')]=_[_0x15d0('0x4d')](_0x1fb215['where'],{'$or':_['map'](_0x1fb215['attributes'],function(_0x307603){var _0x3c7b7d={};_0x3c7b7d[_0x307603]={'$like':'%'+_0x4463d4[_0x15d0('0x44')][_0x15d0('0x4c')]+'%'};return _0x3c7b7d;})});}_0x1fb215=_[_0x15d0('0x4d')]({},_0x1fb215,_0x4463d4[_0x15d0('0x68')]);return db[_0x15d0('0xb6')][_0x15d0('0x2f')]({'where':_0x1fb215['where']})[_0x15d0('0x21')](function(_0x57b066){_0x5f2d09[_0x15d0('0x2f')]=_0x57b066;if(_0x4463d4['query'][_0x15d0('0x4f')]){_0x1fb215[_0x15d0('0x50')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x15d0('0xc4')],'as':'Owner','attributes':[_0x15d0('0x3b'),_0x15d0('0xf6'),_0x15d0('0xf7')],'required':![]},{'model':db[_0x15d0('0xf8')],'as':_0x15d0('0xf9'),'attributes':['id','name',_0x15d0('0xfa')],'where':_0x4463d4['query'][_0x15d0('0xfb')]?{'id':_0x4463d4['query'][_0x15d0('0xfb')]}:undefined,'required':_0x4463d4[_0x15d0('0x44')][_0x15d0('0xfb')]?!![]:![]}];}return db['ChatInteraction'][_0x15d0('0x51')](_0x1fb215);})[_0x15d0('0x21')](function(_0x2a2349){_0x5f2d09['rows']=_0x2a2349;return _0x5f2d09;});}})[_0x15d0('0x21')](respondWithFilteredResult(_0x30657b,_0x1fb215))[_0x15d0('0x53')](handleError(_0x30657b,null));};function iftimePromise(_0x5ddc52,_0x2188ee){return respondWithRpcPromise(_0x15d0('0xfc'),_0x15d0('0xfd'),{'command':_0x2188ee[_0x15d0('0xfe')]?util['format'](_0x15d0('0xff'),_0x5ddc52[_0x15d0('0x100')],_0x2188ee[_0x15d0('0xfe')]):util['format'](_0x15d0('0x101'),_0x5ddc52[_0x15d0('0x100')])},client9002)['then'](function(_0x47dbf9){var _0x4c63c5=_0x47dbf9&&_0x47dbf9[_0x15d0('0x102')](_0x15d0('0x103'))>=0x0?!![]:![];logger[_0x15d0('0x22')](_0x15d0('0x104'),_0x2188ee['id'],_0x5ddc52['id'],_0x5ddc52[_0x15d0('0x100')],_0x4c63c5?_0x15d0('0x105'):_0x15d0('0x106'),_0x2188ee[_0x15d0('0xfe')]?_0x2188ee[_0x15d0('0xfe')]:'No\x20timezone');return _0x4c63c5;})[_0x15d0('0x53')](function(_0x4037e6){logger[_0x15d0('0x27')](_0x15d0('0x104'),_0x2188ee['id'],_0x5ddc52['id'],_0x5ddc52['interval'],util['inspect'](_0x4037e6,{'showHidden':![],'depth':null}),_0x2188ee[_0x15d0('0xfe')]?_0x2188ee[_0x15d0('0xfe')]:_0x15d0('0x107'));return![];});}exports[_0x15d0('0xfd')]=function(_0x3178cc,_0x35379f,_0x309970){var _0x55415c=0x0;var _0x1cbdee=0x0;var _0x17e5c2=![];var _0x2f78bd;var _0x482976;return db[_0x15d0('0x3f')][_0x15d0('0x5d')]({'where':{'id':_0x3178cc['params']['id']},'include':[{'model':db[_0x15d0('0x108')],'as':_0x15d0('0x108'),'include':[{'model':db[_0x15d0('0x108')],'as':'Intervals','attributes':['id',_0x15d0('0x100')],'raw':!![]}]}]})[_0x15d0('0x21')](handleEntityNotFound(_0x35379f,null))[_0x15d0('0x21')](function(_0x5e0fef){if(_0x5e0fef){_0x2f78bd=_0x5e0fef;return _0x5e0fef[_0x15d0('0x109')]({'raw':!![]});}})['then'](function(_0x1e6416){if(_0x2f78bd){if(_0x1e6416){_0x482976=_0x1e6416;}}return require(_0x15d0('0x17'))['getLicense']();})[_0x15d0('0x21')](function(_0x467803){if(_0x467803){_0x1cbdee=_0x467803[_0x15d0('0x10a')];_0x17e5c2=_0x467803[_0x15d0('0x79')];}})[_0x15d0('0x21')](function(){return db[_0x15d0('0xb6')][_0x15d0('0x2f')]({'where':{'closed':![]}});})[_0x15d0('0x21')](function(_0x232ea7){_0x55415c=_0x232ea7;if(_0x1cbdee&&_0x232ea7>_0x1cbdee){return db[_0x15d0('0x10b')][_0x15d0('0x6c')]({'where':{'id':0x1}})[_0x15d0('0x21')](function(_0x5ebe21){if(_0x5ebe21){_0x5ebe21[_0x15d0('0x10c')](_0x15d0('0x10d'));}});}})[_0x15d0('0x21')](function(){if(_0x2f78bd[_0x15d0('0x108')]&&_0x2f78bd[_0x15d0('0x108')]['Intervals']){var _0x32843d=[];for(var _0xc8f1ab=0x0;_0xc8f1ab<_0x2f78bd[_0x15d0('0x108')]['Intervals'][_0x15d0('0x57')];_0xc8f1ab++){var _0x265c3f=_0x2f78bd['Interval'][_0x15d0('0x10e')][_0xc8f1ab][_0x15d0('0x36')]({'plain':!![]});_0x32843d[_0x15d0('0xbe')](iftimePromise(_0x265c3f,_0x2f78bd));}return BPromise[_0x15d0('0x10f')](_0x32843d)[_0x15d0('0x21')](function(_0x170347){return _[_0x15d0('0x110')](_0x170347);});}else{return!![];}})['then'](function(_0x30a499){var _0x5f636f=fs[_0x15d0('0xcf')](path[_0x15d0('0x75')](config[_0x15d0('0x76')],_0x15d0('0x111')),_0x15d0('0xd1'));var _0x3180cb={'remote':_0x2f78bd[_0x15d0('0x112')],'query':querystring['stringify'](_[_0x15d0('0x4d')](_0x2f78bd[_0x15d0('0x36')]({'plain':!![]}),{'customerIp':_0x3178cc['headers'][_0x15d0('0xa7')]||_0x3178cc['headers'][_0x15d0('0x113')]||_0x3178cc[_0x15d0('0x114')][_0x15d0('0x115')]||_0x3178cc['ip'],'referer':_0x3178cc['headers'][_0x15d0('0xac')],'openedInteractions':_0x55415c,'maxInteractions':_0x1cbdee,'virtual':_0x17e5c2[_0x15d0('0x10a')],'online':_0x30a499,'custom':_0x17e5c2}))['replace'](/'/g,'\x5c\x27')};_0x35379f['send'](ejs[_0x15d0('0xd2')](Mustache[_0x15d0('0xd2')](_0x5f636f,_0x3180cb),{'proactiveActions':_0x482976,'alignment':_0x2f78bd[_0x15d0('0x116')],'verticalAlignment':_0x2f78bd[_0x15d0('0x117')],'div_color':_0x2f78bd[_0x15d0('0xfa')],'text_color':_0x2f78bd['textColor'],'button_color':_0x2f78bd[_0x15d0('0x118')],'background_color':_0x2f78bd[_0x15d0('0x119')]}));})[_0x15d0('0x53')](handleError(_0x35379f,null));};exports[_0x15d0('0x11a')]=function(_0x37751b,_0x2ae257,_0xb53e12){return db[_0x15d0('0x3f')][_0x15d0('0x6c')]({'where':{'id':_0x37751b[_0x15d0('0x55')]['id']}})[_0x15d0('0x21')](handleEntityNotFound(_0x2ae257,null))[_0x15d0('0x21')](function(_0xff4848){if(_0xff4848){return db['sequelize'][_0x15d0('0xdd')](function(_0x5eb2f0){return db[_0x15d0('0x9c')]['destroy']({'where':{'ChatWebsiteId':_0x37751b[_0x15d0('0x55')]['id']},'transaction':_0x5eb2f0})[_0x15d0('0x21')](function(_0x85046b){var _0x34157a=_[_0x15d0('0x3e')](_0x37751b[_0x15d0('0x59')],function(_0x2b6909){_0x2b6909['ChatWebsiteId']=_0x37751b[_0x15d0('0x55')]['id'];return _0x2b6909;});return db[_0x15d0('0x9c')][_0x15d0('0xdf')](_0x34157a,{'transaction':_0x5eb2f0});});})['then'](function(){return db[_0x15d0('0x9c')][_0x15d0('0x11b')]({'where':{'ChatWebsiteId':_0x37751b[_0x15d0('0x55')]['id']},'order':_0x15d0('0xa1')});});}})[_0x15d0('0x21')](respondWithResult(_0x2ae257,null))[_0x15d0('0x53')](handleError(_0x2ae257,null));};exports['getApplications']=function(_0x48d78e,_0x297541,_0x55bd99){var _0x7c8b66={};var _0x5ef14c={};var _0x16a8e4;var _0x221aa2;return db[_0x15d0('0x3f')][_0x15d0('0x6c')]({'where':{'id':_0x48d78e[_0x15d0('0x55')]['id']}})[_0x15d0('0x21')](handleEntityNotFound(_0x297541,null))[_0x15d0('0x21')](function(_0x3eec07){if(_0x3eec07){_0x16a8e4=_0x3eec07;_0x5ef14c['model']=_[_0x15d0('0x43')](db[_0x15d0('0x9c')][_0x15d0('0x40')]);_0x5ef14c[_0x15d0('0x44')]=_[_0x15d0('0x43')](_0x48d78e['query']);_0x5ef14c[_0x15d0('0x45')]=_[_0x15d0('0x46')](_0x5ef14c[_0x15d0('0x42')],_0x5ef14c[_0x15d0('0x44')]);_0x7c8b66['attributes']=_[_0x15d0('0x46')](_0x5ef14c[_0x15d0('0x42')],qs[_0x15d0('0x48')](_0x48d78e[_0x15d0('0x44')]['fields']));_0x7c8b66[_0x15d0('0x47')]=_0x7c8b66[_0x15d0('0x47')][_0x15d0('0x57')]?_0x7c8b66['attributes']:_0x5ef14c['model'];_0x7c8b66[_0x15d0('0x49')]=qs[_0x15d0('0x4a')](_0x48d78e[_0x15d0('0x44')][_0x15d0('0x4a')]);_0x7c8b66[_0x15d0('0x4b')]=qs[_0x15d0('0x45')](_[_0x15d0('0x67')](_0x48d78e['query'],_0x5ef14c[_0x15d0('0x45')]));if(_0x48d78e[_0x15d0('0x44')]['filter']){_0x7c8b66['where']=_[_0x15d0('0x4d')](_0x7c8b66[_0x15d0('0x4b')],{'$or':_[_0x15d0('0x3e')](_0x7c8b66[_0x15d0('0x47')],function(_0x519b82){var _0x4ff612={};_0x4ff612[_0x519b82]={'$like':'%'+_0x48d78e[_0x15d0('0x44')][_0x15d0('0x4c')]+'%'};return _0x4ff612;})});}_0x7c8b66=_['merge']({},_0x7c8b66,_0x48d78e[_0x15d0('0x68')]);return _0x16a8e4[_0x15d0('0x11c')](_0x7c8b66);}})[_0x15d0('0x21')](function(_0x530454){if(_0x530454){_0x221aa2=_0x530454[_0x15d0('0x57')];if(!_0x48d78e[_0x15d0('0x44')][_0x15d0('0x65')](_0x15d0('0x66'))){_0x7c8b66[_0x15d0('0x2e')]=qs['limit'](_0x48d78e[_0x15d0('0x44')][_0x15d0('0x2e')]);_0x7c8b66[_0x15d0('0x2c')]=qs[_0x15d0('0x2c')](_0x48d78e[_0x15d0('0x44')][_0x15d0('0x2c')]);}return _0x16a8e4[_0x15d0('0x11c')](_0x7c8b66);}})['then'](function(_0x209425){if(_0x209425){return _0x209425?{'count':_0x221aa2,'rows':_0x209425}:null;}})[_0x15d0('0x21')](respondWithResult(_0x297541,null))['catch'](handleError(_0x297541,null));};exports[_0x15d0('0x11d')]=function(_0x389f19,_0x1cefd2,_0x4f0ee6){return db['chatProactiveAction'][_0x15d0('0x5d')]({'where':{'id':_0x389f19[_0x15d0('0x55')]['id']}})[_0x15d0('0x21')](handleEntityNotFound(_0x1cefd2,null))[_0x15d0('0x21')](function(_0x4672e5){if(_0x4672e5){return _0x4672e5[_0x15d0('0x11d')](_0x389f19[_0x15d0('0x59')][_0x15d0('0x6a')],_['omit'](_0x389f19[_0x15d0('0x59')],['ids','id'])||{});}})[_0x15d0('0x21')](respondWithResult(_0x1cefd2,null))[_0x15d0('0x53')](handleError(_0x1cefd2,null));};exports[_0x15d0('0x109')]=function(_0x303e92,_0xf622a9,_0x4b5605){var _0x2baec5={};var _0x11fd17={};var _0xf21fb;var _0x56f859;return db[_0x15d0('0x3f')][_0x15d0('0x6c')]({'where':{'id':_0x303e92['params']['id']}})[_0x15d0('0x21')](handleEntityNotFound(_0xf622a9,null))[_0x15d0('0x21')](function(_0x23a3c8){if(_0x23a3c8){_0xf21fb=_0x23a3c8;_0x11fd17[_0x15d0('0x42')]=_[_0x15d0('0x43')](db[_0x15d0('0x11e')][_0x15d0('0x40')]);_0x11fd17['query']=_['keys'](_0x303e92[_0x15d0('0x44')]);_0x11fd17['filters']=_[_0x15d0('0x46')](_0x11fd17[_0x15d0('0x42')],_0x11fd17['query']);_0x2baec5[_0x15d0('0x47')]=_[_0x15d0('0x46')](_0x11fd17[_0x15d0('0x42')],qs['fields'](_0x303e92[_0x15d0('0x44')][_0x15d0('0x48')]));_0x2baec5[_0x15d0('0x47')]=_0x2baec5['attributes'][_0x15d0('0x57')]?_0x2baec5[_0x15d0('0x47')]:_0x11fd17[_0x15d0('0x42')];_0x2baec5[_0x15d0('0x49')]=qs['sort'](_0x303e92[_0x15d0('0x44')][_0x15d0('0x4a')]);_0x2baec5['where']=qs[_0x15d0('0x45')](_[_0x15d0('0x67')](_0x303e92[_0x15d0('0x44')],_0x11fd17[_0x15d0('0x45')]));if(_0x303e92[_0x15d0('0x44')]['filter']){_0x2baec5[_0x15d0('0x4b')]=_[_0x15d0('0x4d')](_0x2baec5[_0x15d0('0x4b')],{'$or':_[_0x15d0('0x3e')](_0x2baec5[_0x15d0('0x47')],function(_0xdd1db3){var _0x12810b={};_0x12810b[_0xdd1db3]={'$like':'%'+_0x303e92[_0x15d0('0x44')][_0x15d0('0x4c')]+'%'};return _0x12810b;})});}_0x2baec5=_[_0x15d0('0x4d')]({},_0x2baec5,_0x303e92[_0x15d0('0x68')]);return _0xf21fb[_0x15d0('0x109')](_0x2baec5);}})[_0x15d0('0x21')](function(_0x11438f){if(_0x11438f){_0x56f859=_0x11438f[_0x15d0('0x57')];if(!_0x303e92[_0x15d0('0x44')][_0x15d0('0x65')](_0x15d0('0x66'))){_0x2baec5[_0x15d0('0x2e')]=qs[_0x15d0('0x2e')](_0x303e92[_0x15d0('0x44')][_0x15d0('0x2e')]);_0x2baec5['offset']=qs[_0x15d0('0x2c')](_0x303e92[_0x15d0('0x44')]['offset']);}return _0xf21fb[_0x15d0('0x109')](_0x2baec5);}})['then'](function(_0x366684){if(_0x366684){return _0x366684?{'count':_0x56f859,'rows':_0x366684}:null;}})[_0x15d0('0x21')](respondWithResult(_0xf622a9,null))[_0x15d0('0x53')](handleError(_0xf622a9,null));};exports[_0x15d0('0x11f')]=function(_0xe5df5c,_0x286ecc,_0x4e796c){var _0x2d8875=_0xe5df5c[_0x15d0('0x44')][_0x15d0('0x120')]==='false'?_0x15d0('0x121'):_0x15d0('0x122');return db['ChatWebsite'][_0x15d0('0x5d')]({'attributes':['id',_0x2d8875],'where':{'id':_0xe5df5c['params']['id']}})[_0x15d0('0x21')](handleEntityNotFound(_0x286ecc,null))['then'](function(_0x2564d7){if(_0x2564d7){var _0x4b4da3=_0x2564d7[_0x2d8875];var _0x20643f=_0x4b4da3&&_0x4b4da3[_0x15d0('0x123')]?_0x4b4da3['items']:[];_0x286ecc[_0x15d0('0x3c')]({'fromKey':_['isNil'](_0x4b4da3[_0x15d0('0x124')])?undefined:_0x4b4da3[_0x15d0('0x124')],'count':_0x20643f[_0x15d0('0x57')],'rows':_0x20643f});}})[_0x15d0('0x53')](handleError(_0x286ecc,null));};exports[_0x15d0('0x125')]=function(_0x2db774,_0x337a74,_0x11767a){var _0x392605={'raw':![],'where':{}};var _0x326c35={};var _0x2ab443={'count':0x0,'rows':[]};return db[_0x15d0('0x3f')][_0x15d0('0x6c')]({'where':{'id':_0x2db774[_0x15d0('0x55')]['id']}})[_0x15d0('0x21')](handleEntityNotFound(_0x337a74,null))[_0x15d0('0x21')](function(_0x19c1cd){if(_0x19c1cd){_0x326c35[_0x15d0('0x42')]=_[_0x15d0('0x43')](db[_0x15d0('0x126')][_0x15d0('0x40')]);_0x326c35[_0x15d0('0x44')]=_['keys'](_0x2db774['query']);_0x326c35['filters']=_[_0x15d0('0x46')](_0x326c35['model'],_0x326c35['query']);_0x392605[_0x15d0('0x47')]=_[_0x15d0('0x46')](_0x326c35[_0x15d0('0x42')],qs[_0x15d0('0x48')](_0x2db774[_0x15d0('0x44')][_0x15d0('0x48')]));_0x392605[_0x15d0('0x47')]=_0x392605[_0x15d0('0x47')]['length']?_0x392605[_0x15d0('0x47')]:_0x326c35[_0x15d0('0x42')];if(!_0x2db774[_0x15d0('0x44')][_0x15d0('0x65')](_0x15d0('0x66'))){_0x392605[_0x15d0('0x2e')]=qs[_0x15d0('0x2e')](_0x2db774['query'][_0x15d0('0x2e')]);_0x392605[_0x15d0('0x2c')]=qs[_0x15d0('0x2c')](_0x2db774[_0x15d0('0x44')][_0x15d0('0x2c')]);}_0x392605[_0x15d0('0x49')]=qs[_0x15d0('0x4a')](_0x2db774[_0x15d0('0x44')]['sort']);_0x392605[_0x15d0('0x4b')]=qs[_0x15d0('0x45')](_['pick'](_0x2db774[_0x15d0('0x44')],_0x326c35[_0x15d0('0x45')]));_0x392605[_0x15d0('0x4b')][_0x15d0('0x62')]=_0x19c1cd['id'];if(_0x2db774[_0x15d0('0x44')][_0x15d0('0x4c')]){_0x392605['where']=_[_0x15d0('0x4d')](_0x392605[_0x15d0('0x4b')],{'$or':_[_0x15d0('0x3e')](_0x392605[_0x15d0('0x47')],function(_0x4b2092){var _0x1303e8={};_0x1303e8[_0x4b2092]={'$like':'%'+_0x2db774[_0x15d0('0x44')][_0x15d0('0x4c')]+'%'};return _0x1303e8;})});}_0x392605=_[_0x15d0('0x4d')]({},_0x392605,_0x2db774['options']);return db['ChatOfflineMessage'][_0x15d0('0x2f')]({'where':_0x392605[_0x15d0('0x4b')]})[_0x15d0('0x21')](function(_0xe119e1){_0x2ab443[_0x15d0('0x2f')]=_0xe119e1;if(_0x2db774[_0x15d0('0x44')]['includeAll']){_0x392605[_0x15d0('0x50')]=[{'all':!![]}];}else{_0x392605[_0x15d0('0x50')]=[{'model':db[_0x15d0('0x8a')],'as':_0x15d0('0x127'),'required':![]},{'model':db[_0x15d0('0xde')],'as':_0x15d0('0x128'),'required':![]}];}return db['ChatOfflineMessage'][_0x15d0('0x51')](_0x392605);})[_0x15d0('0x21')](function(_0x556c98){_0x2ab443[_0x15d0('0x52')]=_0x556c98;return _0x2ab443;});}})[_0x15d0('0x21')](respondWithFilteredResult(_0x337a74,_0x392605))['catch'](handleError(_0x337a74,null));};exports['addAgents']=function(_0x5ac754,_0x5985e2,_0x4ed6e2){return db[_0x15d0('0x3f')]['find']({'where':{'id':_0x5ac754[_0x15d0('0x55')]['id']}})['then'](handleEntityNotFound(_0x5985e2,null))[_0x15d0('0x21')](function(_0x4ba6ec){if(_0x4ba6ec){return _0x4ba6ec[_0x15d0('0x129')](_0x5ac754[_0x15d0('0x59')]['ids'],_[_0x15d0('0xf4')](_0x5ac754[_0x15d0('0x59')],[_0x15d0('0x6a'),'id'])||{})[_0x15d0('0xba')](function(_0x58756e){for(var _0x8cb3d=0x0;_0x8cb3d<_0x5ac754[_0x15d0('0x59')][_0x15d0('0x6a')][_0x15d0('0x57')];_0x8cb3d+=0x1){socket[_0x15d0('0x12a')]('userChatWebsite:save',{'UserId':Number(_0x5ac754[_0x15d0('0x59')]['ids'][_0x8cb3d]),'ChatWebsiteId':Number(_0x5ac754[_0x15d0('0x55')]['id'])});}return _0x58756e;});}})[_0x15d0('0x21')](respondWithResult(_0x5985e2,null))[_0x15d0('0x53')](handleError(_0x5985e2,null));};exports[_0x15d0('0x12b')]=function(_0x4d2c3b,_0xf2260e,_0x2de0f7){return db[_0x15d0('0x3f')]['find']({'where':{'id':_0x4d2c3b['params']['id']}})[_0x15d0('0x21')](handleEntityNotFound(_0xf2260e,null))['then'](function(_0xa533c4){if(_0xa533c4){return _0xa533c4['removeAgents'](_0x4d2c3b[_0x15d0('0x44')][_0x15d0('0x6a')])[_0x15d0('0x21')](function(){if(_[_0x15d0('0x12c')](_0x4d2c3b['query']['ids'])){for(var _0x49195f=0x0;_0x49195f<_0x4d2c3b[_0x15d0('0x44')]['ids'][_0x15d0('0x57')];_0x49195f+=0x1){socket[_0x15d0('0x12a')]('userChatWebsite:remove',{'UserId':Number(_0x4d2c3b[_0x15d0('0x44')][_0x15d0('0x6a')][_0x49195f]),'ChatWebsiteId':Number(_0x4d2c3b['params']['id'])});}}else{socket[_0x15d0('0x12a')](_0x15d0('0x12d'),{'UserId':Number(_0x4d2c3b['query']['ids']),'ChatWebsiteId':Number(_0x4d2c3b[_0x15d0('0x55')]['id'])});}});}})[_0x15d0('0x21')](respondWithStatusCode(_0xf2260e,null))[_0x15d0('0x53')](handleError(_0xf2260e,null));};exports[_0x15d0('0x12e')]=function(_0x53e72c,_0x3b222f,_0x46b1fe){var _0x480111={};var _0x423d7a={};var _0x187a7f;var _0x1e290b;return db[_0x15d0('0x3f')][_0x15d0('0x6c')]({'where':{'id':_0x53e72c['params']['id']}})[_0x15d0('0x21')](handleEntityNotFound(_0x3b222f,null))[_0x15d0('0x21')](function(_0x1c4930){if(_0x1c4930){_0x187a7f=_0x1c4930;_0x423d7a['model']=_['keys'](db[_0x15d0('0xc4')]['rawAttributes']);_0x423d7a[_0x15d0('0x44')]=_['keys'](_0x53e72c[_0x15d0('0x44')]);_0x423d7a[_0x15d0('0x45')]=_['intersection'](_0x423d7a['model'],_0x423d7a['query']);_0x480111[_0x15d0('0x47')]=_[_0x15d0('0x46')](_0x423d7a['model'],qs[_0x15d0('0x48')](_0x53e72c[_0x15d0('0x44')][_0x15d0('0x48')]));_0x480111[_0x15d0('0x47')]=_0x480111[_0x15d0('0x47')]['length']?_0x480111[_0x15d0('0x47')]:_0x423d7a[_0x15d0('0x42')];_0x480111[_0x15d0('0x49')]=qs[_0x15d0('0x4a')](_0x53e72c[_0x15d0('0x44')][_0x15d0('0x4a')]);_0x480111[_0x15d0('0x4b')]=qs['filters'](_[_0x15d0('0x67')](_0x53e72c[_0x15d0('0x44')],_0x423d7a[_0x15d0('0x45')]));if(_0x53e72c[_0x15d0('0x44')][_0x15d0('0x4c')]){_0x480111[_0x15d0('0x4b')]=_[_0x15d0('0x4d')](_0x480111[_0x15d0('0x4b')],{'$or':_[_0x15d0('0x3e')](_0x480111[_0x15d0('0x47')],function(_0x487626){var _0x2d05b1={};_0x2d05b1[_0x487626]={'$like':'%'+_0x53e72c[_0x15d0('0x44')][_0x15d0('0x4c')]+'%'};return _0x2d05b1;})});}_0x480111=_[_0x15d0('0x4d')]({},_0x480111,_0x53e72c[_0x15d0('0x68')]);return _0x187a7f[_0x15d0('0x12e')](_0x480111);}})[_0x15d0('0x21')](function(_0x208a95){if(_0x208a95){_0x1e290b=_0x208a95[_0x15d0('0x57')];if(!_0x53e72c[_0x15d0('0x44')][_0x15d0('0x65')](_0x15d0('0x66'))){_0x480111[_0x15d0('0x2e')]=qs['limit'](_0x53e72c[_0x15d0('0x44')][_0x15d0('0x2e')]);_0x480111[_0x15d0('0x2c')]=qs[_0x15d0('0x2c')](_0x53e72c[_0x15d0('0x44')]['offset']);}return _0x187a7f[_0x15d0('0x12e')](_0x480111);}})[_0x15d0('0x21')](function(_0x5434f0){if(_0x5434f0){return _0x5434f0?{'count':_0x1e290b,'rows':_0x5434f0}:null;}})['then'](respondWithResult(_0x3b222f,null))[_0x15d0('0x53')](handleError(_0x3b222f,null));}; \ No newline at end of file +var _0xbf20=['from','CmList','List','DESC','ChatApplication','Applications','account','applications','orderBy','priority','Contacts','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','contact','messageId','created','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','utf8','render','toPairs','offlineMessageBody','originalname','mimetype','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailAccount','Smtp','forwardOffline','forwardOfflineAddress','host','port','secure','authentication','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','toPairsIn','email','NotifyMailAccount','server','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','Command','getSnippet','iftime\x20%s,%s','timezone','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','Interval','getProactiveActions','virtual','License','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','remoteAddress','replace','verticalAlignment','color_button','backgroundColor','addApplications','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','offlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','end','status','offset','undefined','count','limit','json','save','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','Pause','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ChatWebsite','includeAll','findAll','params','mandatoryDispositionPause','length','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','join','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','download','customerAvatar','showCustomerAvatar','isNil','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey'];(function(_0x410afc,_0x5b751d){var _0x2a18b5=function(_0x1b350e){while(--_0x1b350e){_0x410afc['push'](_0x410afc['shift']());}};_0x2a18b5(++_0x5b751d);}(_0xbf20,0x90));var _0x0bf2=function(_0x3e6f49,_0x350a4f){_0x3e6f49=_0x3e6f49-0x0;var _0x5aac64=_0xbf20[_0x3e6f49];return _0x5aac64;};'use strict';var emlformat=require(_0x0bf2('0x0'));var rimraf=require(_0x0bf2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0bf2('0x2'));var rp=require(_0x0bf2('0x3'));var moment=require(_0x0bf2('0x4'));var BPromise=require(_0x0bf2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0bf2('0x6'));var csv=require(_0x0bf2('0x7'));var ejs=require(_0x0bf2('0x8'));var fs=require('fs');var fs_extra=require(_0x0bf2('0x9'));var _=require(_0x0bf2('0xa'));var squel=require(_0x0bf2('0xb'));var crypto=require(_0x0bf2('0xc'));var jsforce=require(_0x0bf2('0xd'));var deskjs=require(_0x0bf2('0xe'));var toCsv=require(_0x0bf2('0x7'));var querystring=require(_0x0bf2('0xf'));var Papa=require(_0x0bf2('0x10'));var Redis=require('ioredis');var authService=require(_0x0bf2('0x11'));var qs=require(_0x0bf2('0x12'));var as=require(_0x0bf2('0x13'));var hardwareService=require(_0x0bf2('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x0bf2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0bf2('0x16'))['db'];config[_0x0bf2('0x17')]=_['defaults'](config[_0x0bf2('0x17')],{'host':_0x0bf2('0x18'),'port':0x18eb});var socket=require(_0x0bf2('0x19'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x0bf2('0x1a')](socket);var jayson=require(_0x0bf2('0x1b'));var client=jayson[_0x0bf2('0x1c')][_0x0bf2('0x1d')]({'port':0x232c});var client9002=jayson[_0x0bf2('0x1c')][_0x0bf2('0x1d')]({'port':0x232a});var client9003=jayson[_0x0bf2('0x1c')][_0x0bf2('0x1d')]({'port':0x232b});var client9001=jayson[_0x0bf2('0x1c')][_0x0bf2('0x1d')]({'port':0x2329});function respondWithRpcPromise(_0x3eb635,_0x4701ac,_0x31dd52,_0x57d2aa){return new BPromise(function(_0x30e8f1,_0x379b2e){var _0x1dfad0=_0x57d2aa||client;return _0x1dfad0[_0x0bf2('0x1e')](_0x3eb635,_0x31dd52)[_0x0bf2('0x1f')](function(_0x6e7c9c){logger['info'](_0x0bf2('0x20'),_0x4701ac,_0x0bf2('0x21'));logger[_0x0bf2('0x22')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4701ac,_0x0bf2('0x21'),JSON[_0x0bf2('0x23')](_0x6e7c9c));if(_0x6e7c9c[_0x0bf2('0x24')]){if(_0x6e7c9c[_0x0bf2('0x24')][_0x0bf2('0x25')]===0x1f4){logger[_0x0bf2('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x4701ac,_0x6e7c9c[_0x0bf2('0x24')][_0x0bf2('0x26')]);return _0x379b2e(_0x6e7c9c[_0x0bf2('0x24')][_0x0bf2('0x26')]);}logger[_0x0bf2('0x24')](_0x0bf2('0x20'),_0x4701ac,_0x6e7c9c[_0x0bf2('0x24')]['message']);return _0x30e8f1(_0x6e7c9c[_0x0bf2('0x24')]['message']);}else{logger[_0x0bf2('0x27')](_0x0bf2('0x20'),_0x4701ac,'request\x20sent');_0x30e8f1(_0x6e7c9c[_0x0bf2('0x28')][_0x0bf2('0x26')]);}})[_0x0bf2('0x29')](function(_0x18bd95){logger[_0x0bf2('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x4701ac,_0x18bd95);_0x379b2e(_0x18bd95);});});}function respondWithStatusCode(_0x558496,_0x358801){_0x358801=_0x358801||0xcc;return function(_0x3ea8bf){if(_0x3ea8bf){return _0x558496[_0x0bf2('0x2a')](_0x358801);}return _0x558496['status'](_0x358801)[_0x0bf2('0x2b')]();};}function respondWithResult(_0x48bb18,_0x394488){_0x394488=_0x394488||0xc8;return function(_0xcb39d1){if(_0xcb39d1){return _0x48bb18[_0x0bf2('0x2c')](_0x394488)['json'](_0xcb39d1);}};}function respondWithFilteredResult(_0x8ff2ec,_0x21f1b6){return function(_0xeb1478){if(_0xeb1478){var _0x5686e7=typeof _0x21f1b6[_0x0bf2('0x2d')]===_0x0bf2('0x2e')&&typeof _0x21f1b6['limit']===_0x0bf2('0x2e');var _0x22d62b=_0xeb1478['count'];var _0x429757=_0x5686e7?0x0:_0x21f1b6['offset'];var _0xbcf66e=_0x5686e7?_0xeb1478[_0x0bf2('0x2f')]:_0x21f1b6[_0x0bf2('0x2d')]+_0x21f1b6[_0x0bf2('0x30')];var _0x3825a6;if(_0xbcf66e>=_0x22d62b){_0xbcf66e=_0x22d62b;_0x3825a6=0xc8;}else{_0x3825a6=0xce;}_0x8ff2ec[_0x0bf2('0x2c')](_0x3825a6);return _0x8ff2ec['set']('Content-Range',_0x429757+'-'+_0xbcf66e+'/'+_0x22d62b)[_0x0bf2('0x31')](_0xeb1478);}return null;};}function patchUpdates(_0x1dbb09){return function(_0x21496f){try{jsonpatch['apply'](_0x21496f,_0x1dbb09,!![]);}catch(_0x8a9b39){return BPromise['reject'](_0x8a9b39);}return _0x21496f[_0x0bf2('0x32')]();};}function saveUpdates(_0x4b3b1e,_0x26cdf6){return function(_0x2f6332){if(_0x2f6332){return _0x2f6332['update'](_0x4b3b1e)[_0x0bf2('0x1f')](function(_0x550bfe){return _0x550bfe;});}return null;};}function removeEntity(_0x2cee48,_0x10c372){return function(_0x261017){if(_0x261017){return _0x261017['destroy']()[_0x0bf2('0x1f')](function(){var _0x5d9765=_0x261017[_0x0bf2('0x33')]({'plain':!![]});var _0x47d2a3=_0x0bf2('0x34');return db[_0x0bf2('0x35')][_0x0bf2('0x36')]({'where':{'type':_0x47d2a3,'resourceId':_0x5d9765['id']}})[_0x0bf2('0x1f')](function(){return _0x261017;});})[_0x0bf2('0x1f')](function(){_0x2cee48[_0x0bf2('0x2c')](0xcc)[_0x0bf2('0x2b')]();});}};}function handleEntityNotFound(_0x40f4b8,_0xdcbee9){return function(_0x480dba){if(!_0x480dba){_0x40f4b8[_0x0bf2('0x2a')](0x194);}return _0x480dba;};}function handleError(_0x98eb7,_0x40b7f0){_0x40b7f0=_0x40b7f0||0x1f4;return function(_0x17bad5){logger[_0x0bf2('0x24')](_0x17bad5[_0x0bf2('0x37')]);if(_0x17bad5[_0x0bf2('0x38')]){delete _0x17bad5[_0x0bf2('0x38')];}_0x98eb7['status'](_0x40b7f0)[_0x0bf2('0x39')](_0x17bad5);};}exports['index']=function(_0x305e8b,_0x4d0c76){var _0x362c0d={'include':[{'model':db[_0x0bf2('0x3a')],'as':'mandatoryDispositionPause'}]},_0x6a1902={},_0x2e2517={'count':0x0,'rows':[]};var _0x5ac1b1=_[_0x0bf2('0x3b')](db['ChatWebsite'][_0x0bf2('0x3c')],function(_0x565dac){return{'name':_0x565dac[_0x0bf2('0x3d')],'type':_0x565dac[_0x0bf2('0x3e')][_0x0bf2('0x3f')]};});_0x6a1902[_0x0bf2('0x40')]=_[_0x0bf2('0x3b')](_0x5ac1b1,'name');_0x6a1902['query']=_[_0x0bf2('0x41')](_0x305e8b[_0x0bf2('0x42')]);_0x6a1902[_0x0bf2('0x43')]=_[_0x0bf2('0x44')](_0x6a1902['model'],_0x6a1902[_0x0bf2('0x42')]);_0x362c0d[_0x0bf2('0x45')]=_[_0x0bf2('0x44')](_0x6a1902[_0x0bf2('0x40')],qs['fields'](_0x305e8b['query'][_0x0bf2('0x46')]));_0x362c0d[_0x0bf2('0x45')]=_0x362c0d[_0x0bf2('0x45')]['length']?_0x362c0d[_0x0bf2('0x45')]:_0x6a1902[_0x0bf2('0x40')];if(!_0x305e8b[_0x0bf2('0x42')][_0x0bf2('0x47')](_0x0bf2('0x48'))){_0x362c0d[_0x0bf2('0x30')]=qs[_0x0bf2('0x30')](_0x305e8b[_0x0bf2('0x42')][_0x0bf2('0x30')]);_0x362c0d['offset']=qs[_0x0bf2('0x2d')](_0x305e8b[_0x0bf2('0x42')][_0x0bf2('0x2d')]);}_0x362c0d[_0x0bf2('0x49')]=qs[_0x0bf2('0x4a')](_0x305e8b['query'][_0x0bf2('0x4a')]);_0x362c0d[_0x0bf2('0x4b')]=qs['filters'](_[_0x0bf2('0x4c')](_0x305e8b[_0x0bf2('0x42')],_0x6a1902['filters']),_0x5ac1b1);if(_0x305e8b[_0x0bf2('0x42')][_0x0bf2('0x4d')]){_0x362c0d[_0x0bf2('0x4b')]=_[_0x0bf2('0x4e')](_0x362c0d[_0x0bf2('0x4b')],{'$or':_[_0x0bf2('0x3b')](_0x5ac1b1,function(_0x471ec9){if(_0x471ec9['type']!=='VIRTUAL'){var _0x253b0c={};_0x253b0c[_0x471ec9['name']]={'$like':'%'+_0x305e8b[_0x0bf2('0x42')][_0x0bf2('0x4d')]+'%'};return _0x253b0c;}})});}_0x362c0d=_[_0x0bf2('0x4e')]({},_0x362c0d,_0x305e8b[_0x0bf2('0x4f')]);var _0x44b719={'where':_0x362c0d['where']};return db[_0x0bf2('0x50')]['count'](_0x44b719)['then'](function(_0x15d724){_0x2e2517[_0x0bf2('0x2f')]=_0x15d724;if(_0x305e8b['query'][_0x0bf2('0x51')]){_0x362c0d['include']=[{'all':!![]}];}return db[_0x0bf2('0x50')][_0x0bf2('0x52')](_0x362c0d);})[_0x0bf2('0x1f')](function(_0x2b2d2d){_0x2e2517['rows']=_0x2b2d2d;return _0x2e2517;})[_0x0bf2('0x1f')](respondWithFilteredResult(_0x4d0c76,_0x362c0d))[_0x0bf2('0x29')](handleError(_0x4d0c76,null));};exports['show']=function(_0x246b0b,_0x539241){var _0x2fb57d={'raw':![],'where':{'id':_0x246b0b[_0x0bf2('0x53')]['id']},'include':[{'model':db[_0x0bf2('0x3a')],'as':_0x0bf2('0x54')}]},_0x2591da={};_0x2591da['model']=_[_0x0bf2('0x41')](db[_0x0bf2('0x50')][_0x0bf2('0x3c')]);_0x2591da[_0x0bf2('0x42')]=_['keys'](_0x246b0b[_0x0bf2('0x42')]);_0x2591da[_0x0bf2('0x43')]=_[_0x0bf2('0x44')](_0x2591da[_0x0bf2('0x40')],_0x2591da['query']);_0x2fb57d[_0x0bf2('0x45')]=_[_0x0bf2('0x44')](_0x2591da['model'],qs[_0x0bf2('0x46')](_0x246b0b[_0x0bf2('0x42')][_0x0bf2('0x46')]));_0x2fb57d[_0x0bf2('0x45')]=_0x2fb57d[_0x0bf2('0x45')][_0x0bf2('0x55')]?_0x2fb57d[_0x0bf2('0x45')]:_0x2591da['model'];if(_0x246b0b[_0x0bf2('0x42')][_0x0bf2('0x51')]){_0x2fb57d[_0x0bf2('0x56')]=[{'all':!![]}];}_0x2fb57d=_[_0x0bf2('0x4e')]({},_0x2fb57d,_0x246b0b['options']);return db[_0x0bf2('0x50')][_0x0bf2('0x57')](_0x2fb57d)['then'](handleEntityNotFound(_0x539241,null))[_0x0bf2('0x1f')](respondWithResult(_0x539241,null))[_0x0bf2('0x29')](handleError(_0x539241,null));};exports[_0x0bf2('0x58')]=function(_0x5e1605,_0x2f8720){return db['ChatWebsite'][_0x0bf2('0x58')](_0x5e1605['body'],{})['then'](function(_0x2f0695){var _0x5d8d6d=_0x5e1605[_0x0bf2('0x59')][_0x0bf2('0x33')]({'plain':!![]});if(!_0x5d8d6d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d8d6d[_0x0bf2('0x5a')]===_0x0bf2('0x59')){var _0x588855=_0x2f0695['get']({'plain':!![]});var _0x106aad='ChatWebsites';return db[_0x0bf2('0x5b')]['find']({'where':{'name':_0x106aad,'userProfileId':_0x5d8d6d[_0x0bf2('0x5c')]},'raw':!![]})[_0x0bf2('0x1f')](function(_0x517ef6){if(_0x517ef6&&_0x517ef6[_0x0bf2('0x5d')]===0x0){return db[_0x0bf2('0x35')][_0x0bf2('0x58')]({'name':_0x588855[_0x0bf2('0x38')],'resourceId':_0x588855['id'],'type':_0x517ef6[_0x0bf2('0x38')],'sectionId':_0x517ef6['id']},{})[_0x0bf2('0x1f')](function(){return _0x2f0695;});}else{return _0x2f0695;}})[_0x0bf2('0x29')](function(_0x5e61fc){logger[_0x0bf2('0x24')](_0x0bf2('0x5e'),_0x5e61fc);throw _0x5e61fc;});}return _0x2f0695;})[_0x0bf2('0x1f')](respondWithResult(_0x2f8720,0xc9))[_0x0bf2('0x29')](handleError(_0x2f8720,null));};exports[_0x0bf2('0x5f')]=function(_0x77cc3c,_0x1fea49){if(_0x77cc3c[_0x0bf2('0x60')]['id']){delete _0x77cc3c[_0x0bf2('0x60')]['id'];}return db[_0x0bf2('0x50')]['find']({'where':{'id':_0x77cc3c[_0x0bf2('0x53')]['id']},'include':[{'model':db[_0x0bf2('0x3a')],'as':'mandatoryDispositionPause'}]})[_0x0bf2('0x1f')](handleEntityNotFound(_0x1fea49,null))[_0x0bf2('0x1f')](saveUpdates(_0x77cc3c[_0x0bf2('0x60')],null))[_0x0bf2('0x1f')](respondWithResult(_0x1fea49,null))['catch'](handleError(_0x1fea49,null));};exports['destroy']=function(_0xb13b04,_0xa4d907){return db['ChatWebsite']['find']({'where':{'id':_0xb13b04[_0x0bf2('0x53')]['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0xa4d907,null))[_0x0bf2('0x1f')](removeEntity(_0xa4d907,null))[_0x0bf2('0x29')](handleError(_0xa4d907,null));};exports[_0x0bf2('0x61')]=function(_0x722b95,_0x30e43c){return db[_0x0bf2('0x50')][_0x0bf2('0x61')]()[_0x0bf2('0x1f')](respondWithResult(_0x30e43c,null))['catch'](handleError(_0x30e43c,null));};exports[_0x0bf2('0x62')]=function(_0x5ca89,_0x821c40,_0x86a048){if(_0x5ca89['body']['id']){delete _0x5ca89[_0x0bf2('0x60')]['id'];}return db[_0x0bf2('0x50')][_0x0bf2('0x57')]({'where':{'id':_0x5ca89[_0x0bf2('0x53')]['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x821c40,null))['then'](function(_0x281b73){if(_0x281b73){_0x5ca89[_0x0bf2('0x60')][_0x0bf2('0x63')]=_0x281b73['id'];return db[_0x0bf2('0x64')][_0x0bf2('0x58')](_0x5ca89['body']);}})['then'](respondWithResult(_0x821c40,null))[_0x0bf2('0x29')](handleError(_0x821c40,null));};exports[_0x0bf2('0x65')]=function(_0x3bf900,_0x798a58,_0xc73e8d){var _0x358f0f={'raw':![],'where':{}};var _0x435ef3={};var _0x4d7f17={'count':0x0,'rows':[]};return db[_0x0bf2('0x50')][_0x0bf2('0x66')]({'where':{'id':_0x3bf900[_0x0bf2('0x53')]['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x798a58,null))[_0x0bf2('0x1f')](function(_0x3cd5d1){if(_0x3cd5d1){_0x435ef3[_0x0bf2('0x40')]=_[_0x0bf2('0x41')](db[_0x0bf2('0x64')][_0x0bf2('0x3c')]);_0x435ef3[_0x0bf2('0x42')]=_[_0x0bf2('0x41')](_0x3bf900[_0x0bf2('0x42')]);_0x435ef3[_0x0bf2('0x43')]=_['intersection'](_0x435ef3[_0x0bf2('0x40')],_0x435ef3['query']);_0x358f0f[_0x0bf2('0x45')]=_['intersection'](_0x435ef3[_0x0bf2('0x40')],qs[_0x0bf2('0x46')](_0x3bf900[_0x0bf2('0x42')][_0x0bf2('0x46')]));_0x358f0f[_0x0bf2('0x45')]=_0x358f0f[_0x0bf2('0x45')][_0x0bf2('0x55')]?_0x358f0f[_0x0bf2('0x45')]:_0x435ef3[_0x0bf2('0x40')];if(!_0x3bf900[_0x0bf2('0x42')][_0x0bf2('0x47')]('nolimit')){_0x358f0f[_0x0bf2('0x30')]=qs['limit'](_0x3bf900[_0x0bf2('0x42')][_0x0bf2('0x30')]);_0x358f0f[_0x0bf2('0x2d')]=qs[_0x0bf2('0x2d')](_0x3bf900[_0x0bf2('0x42')]['offset']);}_0x358f0f[_0x0bf2('0x49')]=qs[_0x0bf2('0x4a')](_0x3bf900[_0x0bf2('0x42')]['sort']);_0x358f0f[_0x0bf2('0x4b')]=qs[_0x0bf2('0x43')](_[_0x0bf2('0x4c')](_0x3bf900['query'],_0x435ef3[_0x0bf2('0x43')]));_0x358f0f[_0x0bf2('0x4b')][_0x0bf2('0x63')]=_0x3cd5d1['id'];if(_0x3bf900[_0x0bf2('0x42')][_0x0bf2('0x4d')]){_0x358f0f[_0x0bf2('0x4b')]=_[_0x0bf2('0x4e')](_0x358f0f[_0x0bf2('0x4b')],{'$or':_[_0x0bf2('0x3b')](_0x358f0f[_0x0bf2('0x45')],function(_0x140cda){var _0x3bab46={};_0x3bab46[_0x140cda]={'$like':'%'+_0x3bf900[_0x0bf2('0x42')]['filter']+'%'};return _0x3bab46;})});}_0x358f0f=_[_0x0bf2('0x4e')]({},_0x358f0f,_0x3bf900[_0x0bf2('0x4f')]);return db['Disposition'][_0x0bf2('0x2f')]({'where':_0x358f0f[_0x0bf2('0x4b')]})[_0x0bf2('0x1f')](function(_0x41a745){_0x4d7f17[_0x0bf2('0x2f')]=_0x41a745;if(_0x3bf900[_0x0bf2('0x42')][_0x0bf2('0x51')]){_0x358f0f[_0x0bf2('0x56')]=[{'all':!![]}];}return db[_0x0bf2('0x64')][_0x0bf2('0x52')](_0x358f0f);})[_0x0bf2('0x1f')](function(_0x1d01fa){_0x4d7f17[_0x0bf2('0x67')]=_0x1d01fa;return _0x4d7f17;});}})[_0x0bf2('0x1f')](respondWithFilteredResult(_0x798a58,_0x358f0f))[_0x0bf2('0x29')](handleError(_0x798a58,null));};exports[_0x0bf2('0x68')]=function(_0x30fe63,_0x143aa0,_0x109dbb){return db[_0x0bf2('0x50')][_0x0bf2('0x57')]({'where':{'id':_0x30fe63[_0x0bf2('0x53')]['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x143aa0,null))[_0x0bf2('0x1f')](function(_0x2c3942){if(_0x2c3942){return _0x2c3942['removeDispositions'](_0x30fe63['query'][_0x0bf2('0x69')]);}})[_0x0bf2('0x1f')](respondWithStatusCode(_0x143aa0,null))[_0x0bf2('0x29')](handleError(_0x143aa0,null));};exports[_0x0bf2('0x6a')]=function(_0x26e0dc,_0x57bc8f,_0x2f5273){if(_0x26e0dc['body']['id']){delete _0x26e0dc[_0x0bf2('0x60')]['id'];}return db['ChatWebsite'][_0x0bf2('0x57')]({'where':{'id':_0x26e0dc[_0x0bf2('0x53')]['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x57bc8f,null))[_0x0bf2('0x1f')](function(_0x47bb22){if(_0x47bb22){_0x26e0dc[_0x0bf2('0x60')]['ChatWebsiteId']=_0x47bb22['id'];return db[_0x0bf2('0x6b')][_0x0bf2('0x58')](_0x26e0dc[_0x0bf2('0x60')]);}})['then'](respondWithResult(_0x57bc8f,null))[_0x0bf2('0x29')](handleError(_0x57bc8f,null));};exports[_0x0bf2('0x6c')]=function(_0x36957b,_0x47f24c,_0x32a950){var _0x588a32={'raw':![],'where':{}};var _0x42f269={};var _0x474b57={'count':0x0,'rows':[]};return db[_0x0bf2('0x50')][_0x0bf2('0x66')]({'where':{'id':_0x36957b[_0x0bf2('0x53')]['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x47f24c,null))[_0x0bf2('0x1f')](function(_0x27c937){if(_0x27c937){_0x42f269[_0x0bf2('0x40')]=_[_0x0bf2('0x41')](db['CannedAnswer'][_0x0bf2('0x3c')]);_0x42f269[_0x0bf2('0x42')]=_[_0x0bf2('0x41')](_0x36957b[_0x0bf2('0x42')]);_0x42f269[_0x0bf2('0x43')]=_[_0x0bf2('0x44')](_0x42f269[_0x0bf2('0x40')],_0x42f269[_0x0bf2('0x42')]);_0x588a32['attributes']=_[_0x0bf2('0x44')](_0x42f269[_0x0bf2('0x40')],qs[_0x0bf2('0x46')](_0x36957b[_0x0bf2('0x42')][_0x0bf2('0x46')]));_0x588a32[_0x0bf2('0x45')]=_0x588a32[_0x0bf2('0x45')]['length']?_0x588a32[_0x0bf2('0x45')]:_0x42f269['model'];if(!_0x36957b[_0x0bf2('0x42')][_0x0bf2('0x47')](_0x0bf2('0x48'))){_0x588a32[_0x0bf2('0x30')]=qs['limit'](_0x36957b[_0x0bf2('0x42')]['limit']);_0x588a32['offset']=qs[_0x0bf2('0x2d')](_0x36957b[_0x0bf2('0x42')][_0x0bf2('0x2d')]);}_0x588a32['order']=qs[_0x0bf2('0x4a')](_0x36957b[_0x0bf2('0x42')][_0x0bf2('0x4a')]);_0x588a32['where']=qs['filters'](_[_0x0bf2('0x4c')](_0x36957b[_0x0bf2('0x42')],_0x42f269['filters']));_0x588a32[_0x0bf2('0x4b')][_0x0bf2('0x63')]=_0x27c937['id'];if(_0x36957b['query']['filter']){_0x588a32[_0x0bf2('0x4b')]=_[_0x0bf2('0x4e')](_0x588a32[_0x0bf2('0x4b')],{'$or':_['map'](_0x588a32['attributes'],function(_0x559931){var _0x79e081={};_0x79e081[_0x559931]={'$like':'%'+_0x36957b[_0x0bf2('0x42')][_0x0bf2('0x4d')]+'%'};return _0x79e081;})});}_0x588a32=_[_0x0bf2('0x4e')]({},_0x588a32,_0x36957b[_0x0bf2('0x4f')]);return db[_0x0bf2('0x6b')][_0x0bf2('0x2f')]({'where':_0x588a32[_0x0bf2('0x4b')]})[_0x0bf2('0x1f')](function(_0x61b53d){_0x474b57[_0x0bf2('0x2f')]=_0x61b53d;if(_0x36957b['query'][_0x0bf2('0x51')]){_0x588a32[_0x0bf2('0x56')]=[{'all':!![]}];}return db[_0x0bf2('0x6b')]['findAll'](_0x588a32);})[_0x0bf2('0x1f')](function(_0x3e38e4){_0x474b57[_0x0bf2('0x67')]=_0x3e38e4;return _0x474b57;});}})[_0x0bf2('0x1f')](respondWithFilteredResult(_0x47f24c,_0x588a32))[_0x0bf2('0x29')](handleError(_0x47f24c,null));};exports[_0x0bf2('0x6d')]=function(_0x428d8a,_0x55b5d9,_0x3d6cd1){return db[_0x0bf2('0x50')]['find']({'where':{'id':_0x428d8a[_0x0bf2('0x53')]['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x55b5d9,null))[_0x0bf2('0x1f')](function(_0x5e5d0c){if(_0x5e5d0c){return _0x5e5d0c['removeAnswers'](_0x428d8a[_0x0bf2('0x42')][_0x0bf2('0x69')]);}})[_0x0bf2('0x1f')](respondWithStatusCode(_0x55b5d9,null))[_0x0bf2('0x29')](handleError(_0x55b5d9,null));};exports[_0x0bf2('0x6e')]=function(_0x2c3da3,_0x27f3c3,_0x27f57c){_0x2c3da3[_0x0bf2('0x60')][_0x0bf2('0x6f')]=_0x2c3da3[_0x0bf2('0x70')][_0x0bf2('0x71')];return db[_0x0bf2('0x50')][_0x0bf2('0x57')]({'where':{'id':_0x2c3da3[_0x0bf2('0x53')]['id']}})['then'](handleEntityNotFound(_0x27f3c3,null))[_0x0bf2('0x1f')](saveUpdates(_0x2c3da3[_0x0bf2('0x60')],null))[_0x0bf2('0x1f')](respondWithResult(_0x27f3c3,null))[_0x0bf2('0x29')](handleError(_0x27f3c3,null));};exports[_0x0bf2('0x72')]=function(_0x458633,_0x2ca2d0,_0x5d1c4e){_0x458633['body']['agentAvatar']=_0x458633['file'][_0x0bf2('0x71')];return db[_0x0bf2('0x50')]['find']({'where':{'id':_0x458633[_0x0bf2('0x53')]['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x2ca2d0,null))[_0x0bf2('0x1f')](saveUpdates(_0x458633['body'],null))['then'](respondWithResult(_0x2ca2d0,null))[_0x0bf2('0x29')](handleError(_0x2ca2d0,null));};exports['addCustomerAvatar']=function(_0x5035bd,_0x340479,_0x584726){_0x5035bd['body']['customerAvatar']=_0x5035bd[_0x0bf2('0x70')][_0x0bf2('0x71')];return db['ChatWebsite'][_0x0bf2('0x57')]({'where':{'id':_0x5035bd[_0x0bf2('0x53')]['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x340479,null))[_0x0bf2('0x1f')](saveUpdates(_0x5035bd[_0x0bf2('0x60')],null))[_0x0bf2('0x1f')](respondWithResult(_0x340479,null))[_0x0bf2('0x29')](handleError(_0x340479,null));};exports['addSystemAvatar']=function(_0x17c22a,_0x39d70e,_0x553d18){_0x17c22a[_0x0bf2('0x60')][_0x0bf2('0x73')]=_0x17c22a['file'][_0x0bf2('0x71')];return db['ChatWebsite']['find']({'where':{'id':_0x17c22a['params']['id']}})['then'](handleEntityNotFound(_0x39d70e,null))['then'](saveUpdates(_0x17c22a[_0x0bf2('0x60')],null))['then'](respondWithResult(_0x39d70e,null))['catch'](handleError(_0x39d70e,null));};exports[_0x0bf2('0x74')]=function(_0x11aabf,_0x22bdcb,_0x245b19){var _0xc4951e=path['join'](config[_0x0bf2('0x75')],_0x0bf2('0x76'));var _0x2f0258={'where':{'id':_0x11aabf[_0x0bf2('0x53')]['id']},'attributes':['id',_0x0bf2('0x6f')],'raw':!![]};var _0x165b5a=![];return require(_0x0bf2('0x77'))['getLicense']()[_0x0bf2('0x1f')](function(_0x1e6fa5){if(_0x1e6fa5){_0x165b5a=_0x1e6fa5[_0x0bf2('0x78')];}})['then'](function(){return db[_0x0bf2('0x50')][_0x0bf2('0x57')](_0x2f0258);})[_0x0bf2('0x1f')](handleEntityNotFound(_0x22bdcb,null))[_0x0bf2('0x1f')](function(_0x24eee4){if(_0x24eee4){if(!_['isNil'](_0x24eee4['sitepic'])){if(fs['existsSync'](path[_0x0bf2('0x79')](config[_0x0bf2('0x75')],_0x0bf2('0x7a'),_0x24eee4['sitepic']))&&_0x165b5a){_0xc4951e=path[_0x0bf2('0x79')](config[_0x0bf2('0x75')],_0x0bf2('0x7a'),_0x24eee4['sitepic']);}}return _0x22bdcb['download'](_0xc4951e);}})[_0x0bf2('0x29')](handleError(_0x22bdcb,null));};exports[_0x0bf2('0x7b')]=function(_0x4425ae,_0x4e7a38,_0x2d2558){var _0x4b51fa=path[_0x0bf2('0x79')](config[_0x0bf2('0x75')],_0x0bf2('0x7c'));var _0x4c362c={'where':{'id':_0x4425ae[_0x0bf2('0x53')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x0bf2('0x50')][_0x0bf2('0x57')](_0x4c362c)[_0x0bf2('0x1f')](handleEntityNotFound(_0x4e7a38,null))[_0x0bf2('0x1f')](function(_0x2d8639){if(_0x2d8639){if(!_['isNil'](_0x2d8639[_0x0bf2('0x7d')])){if(fs[_0x0bf2('0x7e')](path['join'](config['root'],_0x0bf2('0x7f'),_0x2d8639[_0x0bf2('0x7d')]))){_0x4b51fa=path[_0x0bf2('0x79')](config[_0x0bf2('0x75')],'server/files/images/avatars/',_0x2d8639['agentAvatar']);}}return _0x4e7a38[_0x0bf2('0x80')](_0x4b51fa);}})[_0x0bf2('0x29')](handleError(_0x4e7a38,null));};exports['getCustomerAvatar']=function(_0x1182c4,_0x17a812,_0x4649fc){var _0x5f2fbd=path['join'](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x415f65={'where':{'id':_0x1182c4[_0x0bf2('0x53')]['id']},'attributes':['id',_0x0bf2('0x81'),_0x0bf2('0x82')],'raw':!![]};return db['ChatWebsite'][_0x0bf2('0x57')](_0x415f65)[_0x0bf2('0x1f')](handleEntityNotFound(_0x17a812,null))['then'](function(_0x4c6f7d){if(_0x4c6f7d){if(!_[_0x0bf2('0x83')](_0x4c6f7d['customerAvatar'])){if(fs['existsSync'](path[_0x0bf2('0x79')](config[_0x0bf2('0x75')],_0x0bf2('0x7f'),_0x4c6f7d[_0x0bf2('0x81')]))&&_0x4c6f7d[_0x0bf2('0x82')]){_0x5f2fbd=path[_0x0bf2('0x79')](config[_0x0bf2('0x75')],_0x0bf2('0x7f'),_0x4c6f7d[_0x0bf2('0x81')]);}}return _0x17a812[_0x0bf2('0x80')](_0x5f2fbd);}})[_0x0bf2('0x29')](handleError(_0x17a812,null));};exports[_0x0bf2('0x84')]=function(_0x5b37af,_0x52a022,_0x5f70ff){var _0x13e9f8=path[_0x0bf2('0x79')](config[_0x0bf2('0x75')],_0x0bf2('0x85'));var _0x58cfd3={'where':{'id':_0x5b37af[_0x0bf2('0x53')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x0bf2('0x50')][_0x0bf2('0x57')](_0x58cfd3)[_0x0bf2('0x1f')](handleEntityNotFound(_0x52a022,null))['then'](function(_0x1653f3){if(_0x1653f3){if(!_[_0x0bf2('0x83')](_0x1653f3['systemAvatar'])){if(fs[_0x0bf2('0x7e')](path[_0x0bf2('0x79')](config['root'],_0x0bf2('0x7f'),_0x1653f3[_0x0bf2('0x73')]))){_0x13e9f8=path[_0x0bf2('0x79')](config[_0x0bf2('0x75')],'server/files/images/avatars/',_0x1653f3[_0x0bf2('0x73')]);}}return _0x52a022[_0x0bf2('0x80')](_0x13e9f8);}})[_0x0bf2('0x29')](handleError(_0x52a022,null));};exports[_0x0bf2('0x86')]=function(_0x2aa850,_0x342758,_0x3b958e){var _0x1d039a=require(_0x0bf2('0x87'));var _0x4cdf13=new _0x1d039a();var _0x27739c=_0x4cdf13[_0x0bf2('0x88')](_0x2aa850[_0x0bf2('0x89')][_0x0bf2('0x8a')])[_0x0bf2('0x8b')]();var _0x967df7={'body':_0x2aa850['body'],'channel':_0x0bf2('0x8c')};var _0xeef12d=[];var _0x8ea6da=[];var _0x157e73={};var _0x4d0ad7=![];return db[_0x0bf2('0x8d')][_0x0bf2('0x61')]()[_0x0bf2('0x1f')](function(_0x69accc){if(!_0x69accc){throw new db['Sequelize'][(_0x0bf2('0x8e'))](_0x0bf2('0x8f'));}_0xeef12d=_[_0x0bf2('0x90')](_['keys'](_0x69accc),['createdAt',_0x0bf2('0x91')]);_0x8ea6da=_[_0x0bf2('0x90')](_[_0x0bf2('0x41')](_0x69accc),[_0x0bf2('0x92'),_0x0bf2('0x91'),_0x0bf2('0x93'),_0x0bf2('0x94')]);if(_0x2aa850[_0x0bf2('0x60')]['id']){delete _0x2aa850[_0x0bf2('0x60')]['id'];}if(_[_0x0bf2('0x83')](_0x2aa850['body']['from'])){throw new db['Sequelize'][(_0x0bf2('0x8e'))](_0x0bf2('0x95'));}if(_[_0x0bf2('0x83')](_0x2aa850[_0x0bf2('0x60')]['body'])||_0x2aa850[_0x0bf2('0x60')][_0x0bf2('0x60')]===''){throw new db[(_0x0bf2('0x96'))][(_0x0bf2('0x8e'))](_0x0bf2('0x97'));}if(_['isNil'](_0x2aa850[_0x0bf2('0x60')]['mapKey'])){throw new db['Sequelize'][(_0x0bf2('0x8e'))](_0x0bf2('0x98')+_0x8ea6da);}if(!_[_0x0bf2('0x99')](_0x8ea6da,_0x2aa850[_0x0bf2('0x60')]['mapKey'])){throw new db[(_0x0bf2('0x96'))][(_0x0bf2('0x8e'))](_0x0bf2('0x9a')+_0x8ea6da);}_0x157e73[_0x2aa850['body'][_0x0bf2('0x9b')]]=_0x2aa850[_0x0bf2('0x60')][_0x0bf2('0x9c')];})[_0x0bf2('0x1f')](function(){return db['ChatWebsite'][_0x0bf2('0x57')]({'where':{'id':_0x2aa850[_0x0bf2('0x53')]['id']},'include':[{'model':db[_0x0bf2('0x9d')],'as':_0x0bf2('0x9e'),'include':[{'model':db[_0x0bf2('0x8d')],'as':'Contacts','where':_0x157e73,'limit':0x1,'order':[[_0x0bf2('0x91'),_0x0bf2('0x9f')]]}]},{'model':db[_0x0bf2('0xa0')],'as':_0x0bf2('0xa1')}]});})[_0x0bf2('0x1f')](handleEntityNotFound(_0x342758,null))[_0x0bf2('0x1f')](function(_0x143565){if(_0x143565&&_0x143565['List']){_0x967df7[_0x0bf2('0xa2')]=_0x143565;_0x967df7['applications']=_0x143565[_0x0bf2('0xa1')];_0x967df7['list']=_0x143565['List'];_0x967df7[_0x0bf2('0xa3')]=_[_0x0bf2('0xa4')](_0x967df7[_0x0bf2('0xa3')],[_0x0bf2('0xa5')],['asc']);if(_0x967df7['account'][_0x0bf2('0xa1')]){delete _0x967df7[_0x0bf2('0xa2')][_0x0bf2('0xa1')];}if(_0x967df7['account'][_0x0bf2('0x9e')]&&_0x967df7[_0x0bf2('0xa2')][_0x0bf2('0x9e')][_0x0bf2('0xa6')][_0x0bf2('0x55')]){return _0x967df7[_0x0bf2('0xa2')][_0x0bf2('0x9e')]['Contacts'][0x0];}var _0x53544f=_['defaults'](_0x2aa850['body'],{'firstName':_0x2aa850[_0x0bf2('0x60')][_0x0bf2('0x9c')],'ListId':_0x143565[_0x0bf2('0x94')]});_0x53544f[_0x2aa850[_0x0bf2('0x60')][_0x0bf2('0x9b')]]=_0x2aa850[_0x0bf2('0x60')]['from'];return db[_0x0bf2('0x8d')][_0x0bf2('0x58')](_0x53544f,{'fields':_0xeef12d,'raw':!![]});}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x342758,null))[_0x0bf2('0x1f')](function(_0xf68333){_0x967df7['contact']=_0xf68333;var _0x4efa64=_0x2aa850['body'][_0x0bf2('0xa7')];if(_0x2aa850[_0x0bf2('0x89')]['cf-connecting-ip']){_0x4efa64=_0x2aa850[_0x0bf2('0x89')][_0x0bf2('0xa8')];}else if(_0x2aa850[_0x0bf2('0x89')][_0x0bf2('0xa9')]){_0x4efa64=_[_0x0bf2('0xaa')](_0x2aa850['headers']['x-forwarded-for'][_0x0bf2('0xab')](','));}if(_0xf68333){var _0x1725af={'ContactId':_0xf68333['id'],'ChatWebsiteId':_0x2aa850['params']['id'],'from':(_0xf68333[_0x0bf2('0xac')]||'')+'\x20'+(_0xf68333[_0x0bf2('0xad')]||''),'customerIp':_0x4efa64,'customerPort':_0x2aa850['headers'][_0x0bf2('0xae')]?_0x2aa850[_0x0bf2('0x89')][_0x0bf2('0xae')]:null,'referer':_0x2aa850['body'][_0x0bf2('0xaf')],'browserName':_0x27739c[_0x0bf2('0xb0')]['name']&&_0x27739c[_0x0bf2('0xb0')][_0x0bf2('0xb1')]?util[_0x0bf2('0xb2')](_0x0bf2('0xb3'),_0x27739c[_0x0bf2('0xb0')][_0x0bf2('0x38')],_0x27739c['browser']['version']):_0x0bf2('0xb4'),'browserVersion':_0x27739c[_0x0bf2('0xb0')][_0x0bf2('0xb1')]||_0x0bf2('0xb4'),'osName':util['format'](_0x0bf2('0xb3'),_0x27739c['os']['name'],_0x27739c['os']['version']),'osVersion':_0x27739c['os'][_0x0bf2('0xb1')],'deviceModel':_0x27739c[_0x0bf2('0xb5')][_0x0bf2('0x40')]&&_0x27739c['device'][_0x0bf2('0xb6')]?util[_0x0bf2('0xb2')]('%s\x20%s\x20%s',_0x27739c[_0x0bf2('0xb5')][_0x0bf2('0x40')],_0x27739c[_0x0bf2('0xb5')][_0x0bf2('0xb6')],_0x27739c['device'][_0x0bf2('0x3e')]):null,'deviceVendor':_0x27739c['device']['vendor'],'deviceType':_0x27739c[_0x0bf2('0xb5')][_0x0bf2('0x3e')],'formData':JSON['stringify'](_0x2aa850['body'])};var _0x2b3d46={'ChatWebsiteId':_0x2aa850[_0x0bf2('0x53')]['id'],'closed':![]};if(_0x2aa850[_0x0bf2('0x60')][_0x0bf2('0xb7')]){_0x2b3d46[_0x0bf2('0xb7')]=_0x2aa850[_0x0bf2('0x60')][_0x0bf2('0xb7')];return db[_0x0bf2('0xb8')]['find']({'where':_0x2b3d46})[_0x0bf2('0x1f')](function(_0x2bc535){if(_0x2bc535){return[_0x2bc535,![]];}_0x1725af[_0x0bf2('0xb7')]=_0x2aa850[_0x0bf2('0x60')]['threadId'];_0x1725af['externalUrl']=_0x2aa850[_0x0bf2('0x60')][_0x0bf2('0xb9')];return db['ChatInteraction']['create'](_0x1725af)['then'](function(_0x4c435d){return[_0x4c435d,!![]];});});}_0x2b3d46['ContactId']=_0xf68333['id'];if(_0x2aa850[_0x0bf2('0x60')][_0x0bf2('0xba')]&&_0x2aa850[_0x0bf2('0x60')][_0x0bf2('0xba')]['id']){_0x2b3d46['id']=_0x2aa850[_0x0bf2('0x60')][_0x0bf2('0xba')]['id'];return db[_0x0bf2('0xb8')][_0x0bf2('0x57')]({'where':_0x2b3d46})[_0x0bf2('0x1f')](function(_0x5c8106){if(_0x5c8106){return[_0x5c8106,![]];}return db[_0x0bf2('0xb8')]['create'](_0x1725af)[_0x0bf2('0x1f')](function(_0x2ca33e){return[_0x2ca33e,!![]];});});}return db[_0x0bf2('0xb8')][_0x0bf2('0x58')](_0x1725af)[_0x0bf2('0x1f')](function(_0x227efd){return[_0x227efd,!![]];});}})[_0x0bf2('0xbb')](function(_0x2bb55d,_0x254ef3){if(_0x2bb55d){_0x4d0ad7=_0x254ef3;if(!_0x254ef3){var _0x3ce36f={'from':(_0x967df7[_0x0bf2('0xbc')][_0x0bf2('0xac')]||'')+'\x20'+(_0x967df7[_0x0bf2('0xbc')]['lastName']||'')};if(_0x2aa850[_0x0bf2('0x60')][_0x0bf2('0xb7')]&&_0x2aa850[_0x0bf2('0x60')][_0x0bf2('0xbd')]&&_0x2aa850['body']['threadId']!=_0x2aa850['body'][_0x0bf2('0xbd')]){_0x3ce36f[_0x0bf2('0xb7')]=_0x2aa850['body']['messageId'];}return _0x2bb55d[_0x0bf2('0x5f')](_0x3ce36f);}else{return _0x2bb55d;}}})[_0x0bf2('0x1f')](function(_0x5217a6){_0x967df7[_0x0bf2('0xba')]=_0x5217a6['get']({'plain':!![]});_0x967df7[_0x0bf2('0xba')][_0x0bf2('0xbe')]=_0x4d0ad7;if(_0x967df7[_0x0bf2('0xba')][_0x0bf2('0xbe')]){if(_0x967df7['account']['autoclose']){_0x967df7[_0x0bf2('0xa3')][_0x0bf2('0xbf')]({'id':0x0,'priority':_0x967df7[_0x0bf2('0xa3')][_0x0bf2('0x55')]+0x1,'app':'close','appdata':_0x0bf2('0xc0'),'interval':_0x0bf2('0xc1')});}}return db[_0x0bf2('0xc2')]['create']({'body':_0x2aa850[_0x0bf2('0x60')][_0x0bf2('0x60')],'ChatWebsiteId':_0x2aa850[_0x0bf2('0x53')]['id'],'ChatInteractionId':_0x5217a6['id'],'direction':'in','ContactId':_0x967df7['contact']['id'],'AttachmentId':_0x2aa850[_0x0bf2('0x60')][_0x0bf2('0xc3')]});})[_0x0bf2('0x1f')](function(_0x3640e8){_0x967df7[_0x0bf2('0x26')]=_0x3640e8;if(_0x967df7['interaction'][_0x0bf2('0xc4')]){return db[_0x0bf2('0xc5')][_0x0bf2('0x57')]({'attributes':['id',_0x0bf2('0x38')],'where':{'id':_0x967df7[_0x0bf2('0xba')][_0x0bf2('0xc4')]}})[_0x0bf2('0x1f')](function(_0x49039d){if(_0x49039d){_0x967df7[_0x0bf2('0xa3')][_0x0bf2('0xc6')]({'id':0x0,'priority':0x0,'app':_0x0bf2('0xc7'),'appdata':_0x49039d[_0x0bf2('0x38')]+','+(_0x967df7[_0x0bf2('0xa2')][_0x0bf2('0xc8')]||0xa),'interval':'*,*,*,*'});_0x967df7[_0x0bf2('0xc9')]=!![];}return respondWithRpcPromise(_0x0bf2('0xca'),_0x0bf2('0xcb'),_0x967df7);});}return respondWithRpcPromise(_0x0bf2('0xca'),_0x0bf2('0xcb'),_0x967df7);})['then'](function(_0x3a7c04){respondWithRpcPromise(_0x0bf2('0xcc'),_0x0bf2('0xcc'),{'event':_0x0bf2('0x86'),'message':_0x3a7c04},client9002);return _0x3a7c04;})[_0x0bf2('0x1f')](respondWithResult(_0x342758,null))[_0x0bf2('0x29')](handleError(_0x342758,null));};exports[_0x0bf2('0xcd')]=function(_0x2848c9,_0x3fbc20,_0x516fa4){var _0x4894db,_0x5e5375,_0x132d15;var _0x1dfdbf=[];var _0x33a66c=[];var _0x2cfce6={};var _0x299ad1=_0x2848c9[_0x0bf2('0xce')]||[];var _0x3d6eb5=[];var _0x31f679;return db[_0x0bf2('0x8d')][_0x0bf2('0x61')]()[_0x0bf2('0x1f')](function(_0x43186a){if(!_0x43186a){throw new db['Sequelize'][(_0x0bf2('0x8e'))]('no\x20available\x20attributes');}_0x33a66c=_[_0x0bf2('0x90')](_[_0x0bf2('0x41')](_0x43186a),[_0x0bf2('0x92'),_0x0bf2('0x91')]);_0x1dfdbf=_[_0x0bf2('0x90')](_[_0x0bf2('0x41')](_0x43186a),['createdAt',_0x0bf2('0x91'),_0x0bf2('0x93'),_0x0bf2('0x94')]);if(_0x2848c9[_0x0bf2('0x60')]['id']){delete _0x2848c9[_0x0bf2('0x60')]['id'];}if(_[_0x0bf2('0x83')](_0x2848c9['body'][_0x0bf2('0x9c')])){throw _0x3fbc20['status'](0x1f4)[_0x0bf2('0x39')](new db[(_0x0bf2('0x96'))][(_0x0bf2('0x8e'))](_0x0bf2('0x95')));}if(_[_0x0bf2('0x83')](_0x2848c9[_0x0bf2('0x60')]['body'])||_0x2848c9[_0x0bf2('0x60')][_0x0bf2('0x60')]===''){throw _0x3fbc20[_0x0bf2('0x2c')](0x1f4)[_0x0bf2('0x39')](new db[(_0x0bf2('0x96'))][(_0x0bf2('0x8e'))](_0x0bf2('0x97')));}if(_[_0x0bf2('0x83')](_0x2848c9['body'][_0x0bf2('0xcf')])){throw _0x3fbc20['status'](0x1f4)[_0x0bf2('0x39')](new db['Sequelize'][(_0x0bf2('0x8e'))](_0x0bf2('0xd0')+_0x1dfdbf));}if(!_[_0x0bf2('0x99')](_0x1dfdbf,_0x2848c9[_0x0bf2('0x60')]['mapKeyOffline'])){throw _0x3fbc20[_0x0bf2('0x2c')](0x1f4)[_0x0bf2('0x39')](new db['Sequelize']['ValidationError'](_0x0bf2('0xd1')+_0x1dfdbf));}_0x2cfce6[_0x2848c9[_0x0bf2('0x60')][_0x0bf2('0xcf')]]=_0x2848c9[_0x0bf2('0x60')][_0x0bf2('0x9c')];})[_0x0bf2('0x1f')](function(){return db[_0x0bf2('0x50')][_0x0bf2('0x57')]({'where':{'id':_0x2848c9[_0x0bf2('0x53')]['id']},'include':[{'model':db[_0x0bf2('0x9d')],'as':_0x0bf2('0x9e')},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0x0bf2('0x1f')](handleEntityNotFound(_0x3fbc20,null))[_0x0bf2('0x1f')](function(_0x3c9863){if(_0x3c9863&&_0x3c9863['List']){_0x5e5375=_0x3c9863;var _0x439a78=_['defaults'](_0x2848c9['body'],{'firstName':_0x2848c9[_0x0bf2('0x60')]['from'],'phone':_0x2848c9[_0x0bf2('0x60')][_0x0bf2('0x9c')],'ListId':_0x3c9863['ListId']});_0x439a78[_0x2848c9[_0x0bf2('0x60')]['mapKeyOffline']]=_0x2848c9[_0x0bf2('0x60')]['from'];return db[_0x0bf2('0x8d')][_0x0bf2('0xd2')]({'where':_0x2cfce6,'defaults':_0x439a78});}})['spread'](function(_0x224d51){if(_0x224d51){_0x132d15=_0x224d51;var _0xbed889=fs[_0x0bf2('0xd3')](path[_0x0bf2('0x79')](config[_0x0bf2('0x75')],'server/files/templates/chatOfflineMessage.ejs'),_0x0bf2('0xd4'));var _0x26228b=ejs[_0x0bf2('0xd5')](_0xbed889,{'body':_[_0x0bf2('0xd6')](_0x2848c9['body'][_0x0bf2('0x60')]),'bodyTitle':_0x5e5375[_0x0bf2('0xd7')]});return db['ChatOfflineMessage'][_0x0bf2('0x58')]({'body':_0x26228b,'ContactId':_0x224d51['id'],'ChatWebsiteId':_0x5e5375['id']});}})[_0x0bf2('0x1f')](function(_0x1677f){_0x31f679=_0x1677f;if(_0x299ad1[_0x0bf2('0x55')]){var _0x22cdca=_0x299ad1[_0x0bf2('0x3b')](function(_0x374947){return{'name':_0x374947[_0x0bf2('0xd8')],'basename':_0x374947[_0x0bf2('0x71')],'type':_0x374947[_0x0bf2('0xd9')],'ChatOfflineMessageId':_0x1677f['id']};});_0x3d6eb5=_0x22cdca[_0x0bf2('0x3b')](_0x5a98ce=>{var _0x57ad22={'filename':_0x5a98ce[_0x0bf2('0x38')],'path':path[_0x0bf2('0x79')](config[_0x0bf2('0x75')],'server','files','attachments','offline-chat',_0x5a98ce[_0x0bf2('0xda')])};return _0x57ad22;});if(!_0x5e5375[_0x0bf2('0xdb')]){return db[_0x0bf2('0xdc')][_0x0bf2('0xdd')](function(_0x26de74){return db[_0x0bf2('0xde')][_0x0bf2('0xdf')](_0x22cdca,{'transaction':_0x26de74});});}}})[_0x0bf2('0x1f')](function(){if(_0x31f679){_0x4894db=_0x31f679;return db[_0x0bf2('0xe0')]['findOne']({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})[_0x0bf2('0x1f')](function(_0xe97fbd){if(_0xe97fbd&&_0xe97fbd[_0x0bf2('0xe1')]&&_0x5e5375[_0x0bf2('0xe2')]&&_0x5e5375[_0x0bf2('0xe3')]){var _0x41bc29={'tls':{'rejectUnauthorized':![]}};if(_0xe97fbd[_0x0bf2('0xe1')]['service']){_0x41bc29['service']=_0xe97fbd['Smtp']['service'];}else{_0x41bc29[_0x0bf2('0xe4')]=_0xe97fbd[_0x0bf2('0xe1')][_0x0bf2('0xe4')];_0x41bc29[_0x0bf2('0xe5')]=_0xe97fbd[_0x0bf2('0xe1')]['port'];_0x41bc29[_0x0bf2('0xe6')]=_0xe97fbd[_0x0bf2('0xe1')][_0x0bf2('0xe6')];}if(_0xe97fbd[_0x0bf2('0xe1')][_0x0bf2('0xe7')]){_0x41bc29['auth']={'user':_0xe97fbd[_0x0bf2('0xe1')][_0x0bf2('0x59')],'pass':_0xe97fbd[_0x0bf2('0xe1')]['pass']};}return respondWithRpcPromise(_0x0bf2('0xe8'),_0x0bf2('0xe9'),{'account':_0x41bc29,'message':{'from':util[_0x0bf2('0xb2')](_0x0bf2('0xea'),_0xe97fbd[_0x0bf2('0x38')],_0xe97fbd['email']||_0xe97fbd['Smtp'][_0x0bf2('0x59')]),'to':_0x5e5375[_0x0bf2('0xe3')],'subject':_0x5e5375[_0x0bf2('0xeb')],'html':_0x4894db[_0x0bf2('0x60')],'attachments':_0x3d6eb5}},client9003)[_0x0bf2('0x1f')](function(){return _0x4894db;})[_0x0bf2('0x29')](function(_0x1db9e9){console[_0x0bf2('0x24')](_0x1db9e9);});}})[_0x0bf2('0x1f')](function(){if(_0x5e5375&&_0x5e5375[_0x0bf2('0xdb')]&&_0x5e5375[_0x0bf2('0xec')]){var _0x1a3720=[];if(_0x299ad1[_0x0bf2('0x55')]){_0x1a3720=_0x299ad1[_0x0bf2('0x3b')](function(_0x2740ae){return{'name':_0x2740ae[_0x0bf2('0xd8')],'basename':_0x2740ae[_0x0bf2('0x71')],'type':_0x2740ae[_0x0bf2('0xd9')],'ChatOfflineMessageId':_0x31f679['id']};});}var _0x11e5ce;if(!_[_0x0bf2('0x83')](_0x5e5375['subjectOffline'])){var _0x2a2664=_[_0x0bf2('0x3b')](_0x2848c9['body'],function(_0x57af53){return _0x57af53;});var _0x3f1aef=_[_0x0bf2('0xed')](_0x2a2664)[0x0];var _0x5cc0a4=_['mapValues'](_0x3f1aef,function(_0x1cfebb){return _0x1cfebb;});_0x11e5ce=_0x5cc0a4[0x1][_0x5e5375['subjectOffline']];}var _0xa9337f={'from':_0x132d15[_0x0bf2('0xee')],'firstName':_0x132d15['firstName'],'lastName':_0x132d15[_0x0bf2('0xad')],'mapKey':'email','message':{'from':_0x132d15['email'],'to':_0x5e5375[_0x0bf2('0xe0')]['email'],'cc':'','subject':_[_0x0bf2('0x83')](_0x11e5ce)?_0x5e5375[_0x0bf2('0xeb')]:_0x11e5ce,'messageId':'','sentAt':new Date(),'attach':_0x1a3720[_0x0bf2('0x55')],'attachments':_0x1a3720,'originChannel':'Chat','ChatWebsiteId':_0x5e5375['id'],'ChatOfflineMessageId':_0x4894db['id'],'originTo':_0x5e5375[_0x0bf2('0xe0')][_0x0bf2('0xee')]},'body':_0x4894db[_0x0bf2('0x60')]};var _0x36a55c={'account':{'id':_0x5e5375[_0x0bf2('0xec')]},'body':_0xa9337f,'log':_0x0bf2('0xef')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x36a55c,client9001)[_0x0bf2('0x1f')](function(){return _0x4894db;})[_0x0bf2('0x29')](function(_0xc197c){console[_0x0bf2('0x24')](_0xc197c);});}return;})[_0x0bf2('0x1f')](function(){if(_0x4894db){return _0x4894db;}})[_0x0bf2('0x1f')](respondWithResult(_0x3fbc20,null))[_0x0bf2('0x29')](function(_0x56daab){console[_0x0bf2('0x24')](_0x0bf2('0x29'),_0x56daab);for(var _0x371548 of _0x299ad1){var _0x58cf4c=path[_0x0bf2('0x79')](config[_0x0bf2('0x75')],_0x0bf2('0xf0'),'files',_0x0bf2('0xf1'),'offline-chat',_0x371548[_0x0bf2('0x71')]);fs_extra[_0x0bf2('0xf2')](_0x58cf4c)['catch'](function(_0x24e191){console['error'](_0x0bf2('0xf3'),_0x58cf4c,_0x24e191);});}});};exports[_0x0bf2('0xf4')]=function(_0x3e880c,_0x5e4ddb,_0x2e637a){return db['ChatInteraction']['find']({'where':{'id':_0x3e880c[_0x0bf2('0x53')]['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x5e4ddb,null))[_0x0bf2('0x1f')](function(_0x2b9585){if(_0x2b9585){return _0x2b9585['addInteraction'](_0x3e880c[_0x0bf2('0x60')]['ids'],_[_0x0bf2('0xf5')](_0x3e880c[_0x0bf2('0x60')],['ids','id'])||{});}})['then'](respondWithResult(_0x5e4ddb,null))['catch'](handleError(_0x5e4ddb,null));};exports[_0x0bf2('0xf6')]=function(_0x2458a7,_0x1a5ed2,_0x5eff50){var _0x53952b={'raw':![],'where':{}};var _0x2d13d9={};var _0x3290c5={'count':0x0,'rows':[]};return db[_0x0bf2('0x50')][_0x0bf2('0x66')]({'where':{'id':_0x2458a7[_0x0bf2('0x53')]['id']}})['then'](handleEntityNotFound(_0x1a5ed2,null))[_0x0bf2('0x1f')](function(_0x58a662){if(_0x58a662){_0x2d13d9[_0x0bf2('0x40')]=_[_0x0bf2('0x41')](db['ChatInteraction'][_0x0bf2('0x3c')]);_0x2d13d9[_0x0bf2('0x42')]=_[_0x0bf2('0x41')](_0x2458a7[_0x0bf2('0x42')]);_0x2d13d9['filters']=_[_0x0bf2('0x44')](_0x2d13d9['model'],_0x2d13d9[_0x0bf2('0x42')]);_0x53952b['attributes']=_[_0x0bf2('0x44')](_0x2d13d9[_0x0bf2('0x40')],qs[_0x0bf2('0x46')](_0x2458a7['query'][_0x0bf2('0x46')]));_0x53952b[_0x0bf2('0x45')]=_0x53952b['attributes']['length']?_0x53952b[_0x0bf2('0x45')]:_0x2d13d9[_0x0bf2('0x40')];if(!_0x2458a7[_0x0bf2('0x42')][_0x0bf2('0x47')](_0x0bf2('0x48'))){_0x53952b[_0x0bf2('0x30')]=qs['limit'](_0x2458a7['query'][_0x0bf2('0x30')]);_0x53952b[_0x0bf2('0x2d')]=qs[_0x0bf2('0x2d')](_0x2458a7[_0x0bf2('0x42')][_0x0bf2('0x2d')]);}_0x53952b[_0x0bf2('0x49')]=qs[_0x0bf2('0x4a')](_0x2458a7['query'][_0x0bf2('0x4a')]);_0x53952b['where']=qs['filters'](_['pick'](_0x2458a7[_0x0bf2('0x42')],_0x2d13d9[_0x0bf2('0x43')]));_0x53952b[_0x0bf2('0x4b')]['ChatWebsiteId']=_0x58a662['id'];if(_0x2458a7['query'][_0x0bf2('0x4d')]){_0x53952b[_0x0bf2('0x4b')]=_[_0x0bf2('0x4e')](_0x53952b['where'],{'$or':_[_0x0bf2('0x3b')](_0x53952b['attributes'],function(_0x4b44e8){var _0x39bc5d={};_0x39bc5d[_0x4b44e8]={'$like':'%'+_0x2458a7['query'][_0x0bf2('0x4d')]+'%'};return _0x39bc5d;})});}_0x53952b=_[_0x0bf2('0x4e')]({},_0x53952b,_0x2458a7[_0x0bf2('0x4f')]);return db[_0x0bf2('0xb8')][_0x0bf2('0x2f')]({'where':_0x53952b[_0x0bf2('0x4b')]})['then'](function(_0x25c6d7){_0x3290c5[_0x0bf2('0x2f')]=_0x25c6d7;if(_0x2458a7[_0x0bf2('0x42')]['includeAll']){_0x53952b[_0x0bf2('0x56')]=[{'model':db[_0x0bf2('0x8d')],'as':_0x0bf2('0xf7'),'required':![]},{'model':db['User'],'as':_0x0bf2('0xf8'),'attributes':[_0x0bf2('0x38'),_0x0bf2('0xf9'),_0x0bf2('0xfa')],'required':![]},{'model':db[_0x0bf2('0xfb')],'as':'Tags','attributes':['id',_0x0bf2('0x38'),_0x0bf2('0xfc')],'where':_0x2458a7[_0x0bf2('0x42')][_0x0bf2('0xfd')]?{'id':_0x2458a7[_0x0bf2('0x42')]['tag']}:undefined,'required':_0x2458a7[_0x0bf2('0x42')][_0x0bf2('0xfd')]?!![]:![]}];}return db[_0x0bf2('0xb8')][_0x0bf2('0x52')](_0x53952b);})['then'](function(_0x5e273d){_0x3290c5['rows']=_0x5e273d;return _0x3290c5;});}})[_0x0bf2('0x1f')](respondWithFilteredResult(_0x1a5ed2,_0x53952b))[_0x0bf2('0x29')](handleError(_0x1a5ed2,null));};function iftimePromise(_0x56d010,_0x48cc86){return respondWithRpcPromise(_0x0bf2('0xfe'),_0x0bf2('0xff'),{'command':_0x48cc86['timezone']?util[_0x0bf2('0xb2')](_0x0bf2('0x100'),_0x56d010['interval'],_0x48cc86[_0x0bf2('0x101')]):util[_0x0bf2('0xb2')]('iftime\x20%s',_0x56d010[_0x0bf2('0x102')])},client9002)[_0x0bf2('0x1f')](function(_0x3f12bd){var _0x2aed61=_0x3f12bd&&_0x3f12bd[_0x0bf2('0x103')](_0x0bf2('0x104'))>=0x0?!![]:![];logger[_0x0bf2('0x27')](_0x0bf2('0x105'),_0x48cc86['id'],_0x56d010['id'],_0x56d010[_0x0bf2('0x102')],_0x2aed61?_0x0bf2('0x106'):'OFFLINE',_0x48cc86['timezone']?_0x48cc86[_0x0bf2('0x101')]:'No\x20timezone');return _0x2aed61;})['catch'](function(_0x3b11be){logger[_0x0bf2('0x24')](_0x0bf2('0x105'),_0x48cc86['id'],_0x56d010['id'],_0x56d010[_0x0bf2('0x102')],util['inspect'](_0x3b11be,{'showHidden':![],'depth':null}),_0x48cc86[_0x0bf2('0x101')]?_0x48cc86[_0x0bf2('0x101')]:_0x0bf2('0x107'));return![];});}exports[_0x0bf2('0xff')]=function(_0x319c1b,_0x552558,_0x43c8e9){var _0x5bea47=0x0;var _0x4175d7=0x0;var _0x15981e=![];var _0x43f381;var _0x260525;return db[_0x0bf2('0x50')][_0x0bf2('0x57')]({'where':{'id':_0x319c1b[_0x0bf2('0x53')]['id']},'include':[{'model':db[_0x0bf2('0x108')],'as':_0x0bf2('0x108'),'include':[{'model':db[_0x0bf2('0x108')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0x0bf2('0x1f')](handleEntityNotFound(_0x552558,null))['then'](function(_0x8a9d52){if(_0x8a9d52){_0x43f381=_0x8a9d52;return _0x8a9d52[_0x0bf2('0x109')]({'raw':!![]});}})[_0x0bf2('0x1f')](function(_0x4c4351){if(_0x43f381){if(_0x4c4351){_0x260525=_0x4c4351;}}return require(_0x0bf2('0x77'))['getLicense']();})['then'](function(_0x29fea8){if(_0x29fea8){_0x4175d7=_0x29fea8[_0x0bf2('0x10a')];_0x15981e=_0x29fea8[_0x0bf2('0x78')];}})[_0x0bf2('0x1f')](function(){return db[_0x0bf2('0xb8')][_0x0bf2('0x2f')]({'where':{'closed':![]}});})[_0x0bf2('0x1f')](function(_0x51caf8){_0x5bea47=_0x51caf8;if(_0x4175d7&&_0x51caf8>_0x4175d7){return db[_0x0bf2('0x10b')]['findOne']({'where':{'id':0x1}})[_0x0bf2('0x1f')](function(_0x4dae06){if(_0x4dae06){_0x4dae06['increment'](_0x0bf2('0x10c'));}});}})[_0x0bf2('0x1f')](function(){if(_0x43f381[_0x0bf2('0x108')]&&_0x43f381['Interval'][_0x0bf2('0x10d')]){var _0x6df579=[];for(var _0x3df50f=0x0;_0x3df50f<_0x43f381[_0x0bf2('0x108')][_0x0bf2('0x10d')]['length'];_0x3df50f++){var _0x5c7344=_0x43f381[_0x0bf2('0x108')]['Intervals'][_0x3df50f][_0x0bf2('0x33')]({'plain':!![]});_0x6df579[_0x0bf2('0xbf')](iftimePromise(_0x5c7344,_0x43f381));}return BPromise[_0x0bf2('0x10e')](_0x6df579)[_0x0bf2('0x1f')](function(_0x31817b){return _[_0x0bf2('0x10f')](_0x31817b);});}else{return!![];}})[_0x0bf2('0x1f')](function(_0x219413){var _0x399fe1=fs[_0x0bf2('0xd3')](path[_0x0bf2('0x79')](config[_0x0bf2('0x75')],_0x0bf2('0x110')),_0x0bf2('0xd4'));var _0x49123f={'remote':_0x43f381[_0x0bf2('0x111')],'query':querystring[_0x0bf2('0x23')](_[_0x0bf2('0x4e')](_0x43f381[_0x0bf2('0x33')]({'plain':!![]}),{'customerIp':_0x319c1b[_0x0bf2('0x89')]['x-forwarded-for']||_0x319c1b[_0x0bf2('0x89')][_0x0bf2('0x112')]||_0x319c1b['connection'][_0x0bf2('0x113')]||_0x319c1b['ip'],'referer':_0x319c1b[_0x0bf2('0x89')][_0x0bf2('0xaf')],'openedInteractions':_0x5bea47,'maxInteractions':_0x4175d7,'virtual':_0x15981e['virtual'],'online':_0x219413,'custom':_0x15981e}))[_0x0bf2('0x114')](/'/g,'\x5c\x27')};_0x552558['send'](ejs[_0x0bf2('0xd5')](Mustache[_0x0bf2('0xd5')](_0x399fe1,_0x49123f),{'proactiveActions':_0x260525,'alignment':_0x43f381['alignment'],'verticalAlignment':_0x43f381[_0x0bf2('0x115')],'div_color':_0x43f381[_0x0bf2('0xfc')],'text_color':_0x43f381['textColor'],'button_color':_0x43f381[_0x0bf2('0x116')],'background_color':_0x43f381[_0x0bf2('0x117')]}));})[_0x0bf2('0x29')](handleError(_0x552558,null));};exports[_0x0bf2('0x118')]=function(_0x5accc5,_0x158f26,_0x35dea0){return db[_0x0bf2('0x50')]['findOne']({'where':{'id':_0x5accc5['params']['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x158f26,null))[_0x0bf2('0x1f')](function(_0x292253){if(_0x292253){return db[_0x0bf2('0xdc')][_0x0bf2('0xdd')](function(_0x1ce837){return db['ChatApplication'][_0x0bf2('0x36')]({'where':{'ChatWebsiteId':_0x5accc5['params']['id']},'transaction':_0x1ce837})[_0x0bf2('0x1f')](function(_0x23f4a5){var _0x454c50=_[_0x0bf2('0x3b')](_0x5accc5[_0x0bf2('0x60')],function(_0x2e5bac){_0x2e5bac[_0x0bf2('0x63')]=_0x5accc5[_0x0bf2('0x53')]['id'];return _0x2e5bac;});return db[_0x0bf2('0xa0')][_0x0bf2('0xdf')](_0x454c50,{'transaction':_0x1ce837});});})[_0x0bf2('0x1f')](function(){return db['ChatApplication'][_0x0bf2('0x119')]({'where':{'ChatWebsiteId':_0x5accc5[_0x0bf2('0x53')]['id']},'order':'priority'});});}})[_0x0bf2('0x1f')](respondWithResult(_0x158f26,null))[_0x0bf2('0x29')](handleError(_0x158f26,null));};exports[_0x0bf2('0x11a')]=function(_0x1e1017,_0x456d5d,_0x41e590){var _0x1e583a={};var _0x17c4f3={};var _0x5b25e3;var _0x531f27;return db[_0x0bf2('0x50')][_0x0bf2('0x66')]({'where':{'id':_0x1e1017['params']['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x456d5d,null))[_0x0bf2('0x1f')](function(_0x28033f){if(_0x28033f){_0x5b25e3=_0x28033f;_0x17c4f3['model']=_['keys'](db[_0x0bf2('0xa0')][_0x0bf2('0x3c')]);_0x17c4f3['query']=_[_0x0bf2('0x41')](_0x1e1017[_0x0bf2('0x42')]);_0x17c4f3[_0x0bf2('0x43')]=_[_0x0bf2('0x44')](_0x17c4f3[_0x0bf2('0x40')],_0x17c4f3[_0x0bf2('0x42')]);_0x1e583a[_0x0bf2('0x45')]=_[_0x0bf2('0x44')](_0x17c4f3['model'],qs[_0x0bf2('0x46')](_0x1e1017[_0x0bf2('0x42')][_0x0bf2('0x46')]));_0x1e583a['attributes']=_0x1e583a['attributes'][_0x0bf2('0x55')]?_0x1e583a[_0x0bf2('0x45')]:_0x17c4f3[_0x0bf2('0x40')];_0x1e583a[_0x0bf2('0x49')]=qs[_0x0bf2('0x4a')](_0x1e1017['query'][_0x0bf2('0x4a')]);_0x1e583a['where']=qs[_0x0bf2('0x43')](_[_0x0bf2('0x4c')](_0x1e1017[_0x0bf2('0x42')],_0x17c4f3['filters']));if(_0x1e1017[_0x0bf2('0x42')][_0x0bf2('0x4d')]){_0x1e583a['where']=_[_0x0bf2('0x4e')](_0x1e583a[_0x0bf2('0x4b')],{'$or':_['map'](_0x1e583a[_0x0bf2('0x45')],function(_0xb67f95){var _0x26d63f={};_0x26d63f[_0xb67f95]={'$like':'%'+_0x1e1017[_0x0bf2('0x42')][_0x0bf2('0x4d')]+'%'};return _0x26d63f;})});}_0x1e583a=_['merge']({},_0x1e583a,_0x1e1017[_0x0bf2('0x4f')]);return _0x5b25e3['getApplications'](_0x1e583a);}})['then'](function(_0x2511d9){if(_0x2511d9){_0x531f27=_0x2511d9['length'];if(!_0x1e1017[_0x0bf2('0x42')][_0x0bf2('0x47')]('nolimit')){_0x1e583a[_0x0bf2('0x30')]=qs[_0x0bf2('0x30')](_0x1e1017['query'][_0x0bf2('0x30')]);_0x1e583a[_0x0bf2('0x2d')]=qs[_0x0bf2('0x2d')](_0x1e1017['query'][_0x0bf2('0x2d')]);}return _0x5b25e3[_0x0bf2('0x11a')](_0x1e583a);}})[_0x0bf2('0x1f')](function(_0x19f14a){if(_0x19f14a){return _0x19f14a?{'count':_0x531f27,'rows':_0x19f14a}:null;}})[_0x0bf2('0x1f')](respondWithResult(_0x456d5d,null))[_0x0bf2('0x29')](handleError(_0x456d5d,null));};exports[_0x0bf2('0x11b')]=function(_0x46254c,_0x36214c,_0x47b51b){return db[_0x0bf2('0x11c')][_0x0bf2('0x57')]({'where':{'id':_0x46254c[_0x0bf2('0x53')]['id']}})['then'](handleEntityNotFound(_0x36214c,null))[_0x0bf2('0x1f')](function(_0x330c4b){if(_0x330c4b){return _0x330c4b[_0x0bf2('0x11b')](_0x46254c[_0x0bf2('0x60')][_0x0bf2('0x69')],_[_0x0bf2('0xf5')](_0x46254c[_0x0bf2('0x60')],[_0x0bf2('0x69'),'id'])||{});}})[_0x0bf2('0x1f')](respondWithResult(_0x36214c,null))[_0x0bf2('0x29')](handleError(_0x36214c,null));};exports[_0x0bf2('0x109')]=function(_0x5e2583,_0x3bbefd,_0xffeb8a){var _0x2d888b={};var _0xc0e839={};var _0x3c8ba1;var _0x1b2e1c;return db['ChatWebsite'][_0x0bf2('0x66')]({'where':{'id':_0x5e2583[_0x0bf2('0x53')]['id']}})['then'](handleEntityNotFound(_0x3bbefd,null))[_0x0bf2('0x1f')](function(_0x56096b){if(_0x56096b){_0x3c8ba1=_0x56096b;_0xc0e839['model']=_[_0x0bf2('0x41')](db[_0x0bf2('0x11d')][_0x0bf2('0x3c')]);_0xc0e839[_0x0bf2('0x42')]=_[_0x0bf2('0x41')](_0x5e2583[_0x0bf2('0x42')]);_0xc0e839[_0x0bf2('0x43')]=_[_0x0bf2('0x44')](_0xc0e839['model'],_0xc0e839[_0x0bf2('0x42')]);_0x2d888b[_0x0bf2('0x45')]=_[_0x0bf2('0x44')](_0xc0e839['model'],qs[_0x0bf2('0x46')](_0x5e2583[_0x0bf2('0x42')][_0x0bf2('0x46')]));_0x2d888b[_0x0bf2('0x45')]=_0x2d888b['attributes'][_0x0bf2('0x55')]?_0x2d888b[_0x0bf2('0x45')]:_0xc0e839['model'];_0x2d888b[_0x0bf2('0x49')]=qs[_0x0bf2('0x4a')](_0x5e2583[_0x0bf2('0x42')][_0x0bf2('0x4a')]);_0x2d888b['where']=qs[_0x0bf2('0x43')](_[_0x0bf2('0x4c')](_0x5e2583['query'],_0xc0e839['filters']));if(_0x5e2583[_0x0bf2('0x42')]['filter']){_0x2d888b[_0x0bf2('0x4b')]=_[_0x0bf2('0x4e')](_0x2d888b[_0x0bf2('0x4b')],{'$or':_[_0x0bf2('0x3b')](_0x2d888b[_0x0bf2('0x45')],function(_0xfcba63){var _0x564592={};_0x564592[_0xfcba63]={'$like':'%'+_0x5e2583['query'][_0x0bf2('0x4d')]+'%'};return _0x564592;})});}_0x2d888b=_[_0x0bf2('0x4e')]({},_0x2d888b,_0x5e2583[_0x0bf2('0x4f')]);return _0x3c8ba1[_0x0bf2('0x109')](_0x2d888b);}})[_0x0bf2('0x1f')](function(_0x498dbe){if(_0x498dbe){_0x1b2e1c=_0x498dbe[_0x0bf2('0x55')];if(!_0x5e2583[_0x0bf2('0x42')][_0x0bf2('0x47')]('nolimit')){_0x2d888b[_0x0bf2('0x30')]=qs[_0x0bf2('0x30')](_0x5e2583[_0x0bf2('0x42')]['limit']);_0x2d888b[_0x0bf2('0x2d')]=qs[_0x0bf2('0x2d')](_0x5e2583['query'][_0x0bf2('0x2d')]);}return _0x3c8ba1[_0x0bf2('0x109')](_0x2d888b);}})[_0x0bf2('0x1f')](function(_0x14d5a3){if(_0x14d5a3){return _0x14d5a3?{'count':_0x1b2e1c,'rows':_0x14d5a3}:null;}})[_0x0bf2('0x1f')](respondWithResult(_0x3bbefd,null))[_0x0bf2('0x29')](handleError(_0x3bbefd,null));};exports[_0x0bf2('0x11e')]=function(_0x2f3b55,_0x560b26,_0x4707ee){var _0x57edc9=_0x2f3b55['query']['online']==='false'?_0x0bf2('0x11f'):'onlineForm';return db[_0x0bf2('0x50')][_0x0bf2('0x57')]({'attributes':['id',_0x57edc9],'where':{'id':_0x2f3b55[_0x0bf2('0x53')]['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x560b26,null))[_0x0bf2('0x1f')](function(_0xc19d04){if(_0xc19d04){var _0x37aa58=_0xc19d04[_0x57edc9];var _0x2234ab=_0x37aa58&&_0x37aa58[_0x0bf2('0x120')]?_0x37aa58[_0x0bf2('0x120')]:[];_0x560b26[_0x0bf2('0x39')]({'fromKey':_[_0x0bf2('0x83')](_0x37aa58[_0x0bf2('0x121')])?undefined:_0x37aa58['fromKey'],'count':_0x2234ab[_0x0bf2('0x55')],'rows':_0x2234ab});}})[_0x0bf2('0x29')](handleError(_0x560b26,null));};exports[_0x0bf2('0x122')]=function(_0x397d06,_0x52a21b,_0x3cbe2e){var _0x1e3331={'raw':![],'where':{}};var _0xffd1ad={};var _0x27cfce={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0bf2('0x66')]({'where':{'id':_0x397d06[_0x0bf2('0x53')]['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x52a21b,null))[_0x0bf2('0x1f')](function(_0x1a1e69){if(_0x1a1e69){_0xffd1ad[_0x0bf2('0x40')]=_[_0x0bf2('0x41')](db[_0x0bf2('0x123')]['rawAttributes']);_0xffd1ad[_0x0bf2('0x42')]=_[_0x0bf2('0x41')](_0x397d06['query']);_0xffd1ad[_0x0bf2('0x43')]=_['intersection'](_0xffd1ad[_0x0bf2('0x40')],_0xffd1ad[_0x0bf2('0x42')]);_0x1e3331[_0x0bf2('0x45')]=_[_0x0bf2('0x44')](_0xffd1ad[_0x0bf2('0x40')],qs[_0x0bf2('0x46')](_0x397d06['query'][_0x0bf2('0x46')]));_0x1e3331['attributes']=_0x1e3331[_0x0bf2('0x45')][_0x0bf2('0x55')]?_0x1e3331[_0x0bf2('0x45')]:_0xffd1ad[_0x0bf2('0x40')];if(!_0x397d06['query'][_0x0bf2('0x47')](_0x0bf2('0x48'))){_0x1e3331[_0x0bf2('0x30')]=qs[_0x0bf2('0x30')](_0x397d06['query'][_0x0bf2('0x30')]);_0x1e3331['offset']=qs['offset'](_0x397d06[_0x0bf2('0x42')][_0x0bf2('0x2d')]);}_0x1e3331[_0x0bf2('0x49')]=qs[_0x0bf2('0x4a')](_0x397d06[_0x0bf2('0x42')][_0x0bf2('0x4a')]);_0x1e3331['where']=qs['filters'](_['pick'](_0x397d06[_0x0bf2('0x42')],_0xffd1ad[_0x0bf2('0x43')]));_0x1e3331[_0x0bf2('0x4b')]['ChatWebsiteId']=_0x1a1e69['id'];if(_0x397d06['query'][_0x0bf2('0x4d')]){_0x1e3331[_0x0bf2('0x4b')]=_[_0x0bf2('0x4e')](_0x1e3331[_0x0bf2('0x4b')],{'$or':_['map'](_0x1e3331[_0x0bf2('0x45')],function(_0x47e521){var _0x2f7358={};_0x2f7358[_0x47e521]={'$like':'%'+_0x397d06[_0x0bf2('0x42')]['filter']+'%'};return _0x2f7358;})});}_0x1e3331=_[_0x0bf2('0x4e')]({},_0x1e3331,_0x397d06['options']);return db[_0x0bf2('0x123')][_0x0bf2('0x2f')]({'where':_0x1e3331[_0x0bf2('0x4b')]})[_0x0bf2('0x1f')](function(_0x3273d9){_0x27cfce['count']=_0x3273d9;if(_0x397d06[_0x0bf2('0x42')][_0x0bf2('0x51')]){_0x1e3331[_0x0bf2('0x56')]=[{'all':!![]}];}else{_0x1e3331[_0x0bf2('0x56')]=[{'model':db[_0x0bf2('0x8d')],'as':'Contact','required':![]},{'model':db[_0x0bf2('0xde')],'as':_0x0bf2('0x124'),'required':![]}];}return db[_0x0bf2('0x123')][_0x0bf2('0x52')](_0x1e3331);})[_0x0bf2('0x1f')](function(_0x4dd4f7){_0x27cfce[_0x0bf2('0x67')]=_0x4dd4f7;return _0x27cfce;});}})['then'](respondWithFilteredResult(_0x52a21b,_0x1e3331))[_0x0bf2('0x29')](handleError(_0x52a21b,null));};exports[_0x0bf2('0x125')]=function(_0x2687eb,_0x5d0c67,_0x2438bc){return db[_0x0bf2('0x50')][_0x0bf2('0x57')]({'where':{'id':_0x2687eb[_0x0bf2('0x53')]['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x5d0c67,null))[_0x0bf2('0x1f')](function(_0x5a1ad0){if(_0x5a1ad0){return _0x5a1ad0[_0x0bf2('0x125')](_0x2687eb[_0x0bf2('0x60')]['ids'],_[_0x0bf2('0xf5')](_0x2687eb[_0x0bf2('0x60')],[_0x0bf2('0x69'),'id'])||{})['spread'](function(_0x5ef1c0){for(var _0x4e2648=0x0;_0x4e2648<_0x2687eb[_0x0bf2('0x60')]['ids'][_0x0bf2('0x55')];_0x4e2648+=0x1){socket[_0x0bf2('0x126')](_0x0bf2('0x127'),{'UserId':Number(_0x2687eb[_0x0bf2('0x60')][_0x0bf2('0x69')][_0x4e2648]),'ChatWebsiteId':Number(_0x2687eb['params']['id'])});}return _0x5ef1c0;});}})[_0x0bf2('0x1f')](respondWithResult(_0x5d0c67,null))[_0x0bf2('0x29')](handleError(_0x5d0c67,null));};exports[_0x0bf2('0x128')]=function(_0x35b745,_0x482949,_0x5e818b){return db[_0x0bf2('0x50')][_0x0bf2('0x57')]({'where':{'id':_0x35b745[_0x0bf2('0x53')]['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x482949,null))[_0x0bf2('0x1f')](function(_0x288456){if(_0x288456){return _0x288456[_0x0bf2('0x128')](_0x35b745['query'][_0x0bf2('0x69')])[_0x0bf2('0x1f')](function(){if(_[_0x0bf2('0x129')](_0x35b745[_0x0bf2('0x42')][_0x0bf2('0x69')])){for(var _0xa38633=0x0;_0xa38633<_0x35b745['query'][_0x0bf2('0x69')][_0x0bf2('0x55')];_0xa38633+=0x1){socket['emit'](_0x0bf2('0x12a'),{'UserId':Number(_0x35b745[_0x0bf2('0x42')][_0x0bf2('0x69')][_0xa38633]),'ChatWebsiteId':Number(_0x35b745[_0x0bf2('0x53')]['id'])});}}else{socket[_0x0bf2('0x126')](_0x0bf2('0x12a'),{'UserId':Number(_0x35b745['query']['ids']),'ChatWebsiteId':Number(_0x35b745[_0x0bf2('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x482949,null))[_0x0bf2('0x29')](handleError(_0x482949,null));};exports[_0x0bf2('0x12b')]=function(_0x42dcf0,_0x5798f8,_0x4ad0cb){var _0x44cb5d={};var _0x5ee078={};var _0x347633;var _0x2bb45e;return db[_0x0bf2('0x50')][_0x0bf2('0x66')]({'where':{'id':_0x42dcf0[_0x0bf2('0x53')]['id']}})[_0x0bf2('0x1f')](handleEntityNotFound(_0x5798f8,null))[_0x0bf2('0x1f')](function(_0x3c9749){if(_0x3c9749){_0x347633=_0x3c9749;_0x5ee078[_0x0bf2('0x40')]=_[_0x0bf2('0x41')](db[_0x0bf2('0xc5')][_0x0bf2('0x3c')]);_0x5ee078['query']=_[_0x0bf2('0x41')](_0x42dcf0[_0x0bf2('0x42')]);_0x5ee078[_0x0bf2('0x43')]=_['intersection'](_0x5ee078[_0x0bf2('0x40')],_0x5ee078[_0x0bf2('0x42')]);_0x44cb5d[_0x0bf2('0x45')]=_[_0x0bf2('0x44')](_0x5ee078[_0x0bf2('0x40')],qs[_0x0bf2('0x46')](_0x42dcf0[_0x0bf2('0x42')][_0x0bf2('0x46')]));_0x44cb5d['attributes']=_0x44cb5d['attributes'][_0x0bf2('0x55')]?_0x44cb5d[_0x0bf2('0x45')]:_0x5ee078[_0x0bf2('0x40')];_0x44cb5d[_0x0bf2('0x49')]=qs[_0x0bf2('0x4a')](_0x42dcf0[_0x0bf2('0x42')][_0x0bf2('0x4a')]);_0x44cb5d['where']=qs[_0x0bf2('0x43')](_[_0x0bf2('0x4c')](_0x42dcf0[_0x0bf2('0x42')],_0x5ee078[_0x0bf2('0x43')]));if(_0x42dcf0['query']['filter']){_0x44cb5d['where']=_['merge'](_0x44cb5d[_0x0bf2('0x4b')],{'$or':_['map'](_0x44cb5d[_0x0bf2('0x45')],function(_0x27c0e3){var _0x17e7f9={};_0x17e7f9[_0x27c0e3]={'$like':'%'+_0x42dcf0[_0x0bf2('0x42')][_0x0bf2('0x4d')]+'%'};return _0x17e7f9;})});}_0x44cb5d=_['merge']({},_0x44cb5d,_0x42dcf0[_0x0bf2('0x4f')]);return _0x347633['getAgents'](_0x44cb5d);}})[_0x0bf2('0x1f')](function(_0x5ea9cb){if(_0x5ea9cb){_0x2bb45e=_0x5ea9cb[_0x0bf2('0x55')];if(!_0x42dcf0['query']['hasOwnProperty'](_0x0bf2('0x48'))){_0x44cb5d[_0x0bf2('0x30')]=qs[_0x0bf2('0x30')](_0x42dcf0[_0x0bf2('0x42')][_0x0bf2('0x30')]);_0x44cb5d[_0x0bf2('0x2d')]=qs[_0x0bf2('0x2d')](_0x42dcf0[_0x0bf2('0x42')][_0x0bf2('0x2d')]);}return _0x347633[_0x0bf2('0x12b')](_0x44cb5d);}})[_0x0bf2('0x1f')](function(_0x35b482){if(_0x35b482){return _0x35b482?{'count':_0x2bb45e,'rows':_0x35b482}:null;}})[_0x0bf2('0x1f')](respondWithResult(_0x5798f8,null))[_0x0bf2('0x29')](handleError(_0x5798f8,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 6e51d6d..952a01d 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 _0xb1a3=['ChatWebsite','save','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x4647c6,_0x49366b){var _0x3c40ad=function(_0x547fbe){while(--_0x547fbe){_0x4647c6['push'](_0x4647c6['shift']());}};_0x3c40ad(++_0x49366b);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0xb1a3[_0x3a0c4f];return _0x247049;};'use strict';var EventEmitter=require(_0x3b1a('0x0'));var ChatWebsite=require(_0x3b1a('0x1'))['db'][_0x3b1a('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3b1a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x41fe6c){return function(_0x77489e,_0xd2c9e1,_0x3fcfd5){ChatWebsiteEvents[_0x3b1a('0x4')](_0x41fe6c+':'+_0x77489e['id'],_0x77489e);ChatWebsiteEvents[_0x3b1a('0x4')](_0x41fe6c,_0x77489e);_0x3fcfd5(null);};}for(var e in events){if(events[_0x3b1a('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x3b1a('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite'];(function(_0x3261db,_0x5ca0a){var _0x8c0bf3=function(_0x523f98){while(--_0x523f98){_0x3261db['push'](_0x3261db['shift']());}};_0x8c0bf3(++_0x5ca0a);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x7995('0x0'));var ChatWebsite=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){ChatWebsiteEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);ChatWebsiteEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];ChatWebsite[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 864f630..b1a1fe1 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 _0xf353=['../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','api','moment','bluebird','path','rimraf'];(function(_0x5eba1d,_0x36f115){var _0x2ea36c=function(_0x21f50d){while(--_0x21f50d){_0x5eba1d['push'](_0x5eba1d['shift']());}};_0x2ea36c(++_0x36f115);}(_0xf353,0xea));var _0x3f35=function(_0x34f930,_0x597cb0){_0x34f930=_0x34f930-0x0;var _0x55b287=_0xf353[_0x34f930];return _0x55b287;};'use strict';var _=require(_0x3f35('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3f35('0x1'));var moment=require(_0x3f35('0x2'));var BPromise=require(_0x3f35('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f35('0x4'));var rimraf=require(_0x3f35('0x5'));var config=require(_0x3f35('0x6'));var attributes=require(_0x3f35('0x7'));module[_0x3f35('0x8')]=function(_0xae62b2,_0x17c6e5){return _0xae62b2[_0x3f35('0x9')](_0x3f35('0xa'),attributes,{'tableName':_0x3f35('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ac7=['util','../../config/logger','moment','path','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash'];(function(_0x2974f5,_0xd6967c){var _0x4583bf=function(_0x4b9dc3){while(--_0x4b9dc3){_0x2974f5['push'](_0x2974f5['shift']());}};_0x4583bf(++_0xd6967c);}(_0x5ac7,0x83));var _0x75ac=function(_0x303083,_0x41dc54){_0x303083=_0x303083-0x0;var _0x1c5f83=_0x5ac7[_0x303083];return _0x1c5f83;};'use strict';var _=require(_0x75ac('0x0'));var util=require(_0x75ac('0x1'));var logger=require(_0x75ac('0x2'))('api');var moment=require(_0x75ac('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x75ac('0x4'));var rimraf=require('rimraf');var config=require(_0x75ac('0x5'));var attributes=require(_0x75ac('0x6'));module[_0x75ac('0x7')]=function(_0x48de1e,_0x15e72f){return _0x48de1e[_0x75ac('0x8')](_0x75ac('0x9'),attributes,{'tableName':_0x75ac('0xa'),'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 2a52dc5..9ffa290 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 _0x9981=['../../config/logger','rpc','jayson/promise','client','http','redis','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x19313e,_0x2f81fe){var _0x3c699c=function(_0x245499){while(--_0x245499){_0x19313e['push'](_0x19313e['shift']());}};_0x3c699c(++_0x2f81fe);}(_0x9981,0x1b8));var _0x1998=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x9981[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0x1998('0x0'));var util=require(_0x1998('0x1'));var moment=require(_0x1998('0x2'));var BPromise=require(_0x1998('0x3'));var rs=require(_0x1998('0x4'));var fs=require('fs');var Redis=require(_0x1998('0x5'));var db=require(_0x1998('0x6'))['db'];var utils=require(_0x1998('0x7'));var logger=require(_0x1998('0x8'))(_0x1998('0x9'));var config=require('../../config/environment');var jayson=require(_0x1998('0xa'));var client=jayson[_0x1998('0xb')][_0x1998('0xc')]({'port':0x232a});config[_0x1998('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1998('0xd')]));require('./chatWebsite.socket')[_0x1998('0xe')](socket);function respondWithRpcPromise(_0x4d3c56,_0x4ff2c8,_0x42c233){return new BPromise(function(_0x1c46ab,_0x3a797c){return client[_0x1998('0xf')](_0x4d3c56,_0x42c233)[_0x1998('0x10')](function(_0x1bf054){logger[_0x1998('0x11')](_0x1998('0x12'),_0x4ff2c8,_0x1998('0x13'));logger[_0x1998('0x14')](_0x1998('0x15'),_0x4ff2c8,'request\x20sent',JSON[_0x1998('0x16')](_0x1bf054));if(_0x1bf054[_0x1998('0x17')]){if(_0x1bf054[_0x1998('0x17')][_0x1998('0x18')]===0x1f4){logger[_0x1998('0x17')](_0x1998('0x12'),_0x4ff2c8,_0x1bf054['error'][_0x1998('0x19')]);return _0x3a797c(_0x1bf054[_0x1998('0x17')][_0x1998('0x19')]);}logger[_0x1998('0x17')](_0x1998('0x12'),_0x4ff2c8,_0x1bf054['error'][_0x1998('0x19')]);return _0x1c46ab(_0x1bf054['error'][_0x1998('0x19')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x4ff2c8,_0x1998('0x13'));_0x1c46ab(_0x1bf054[_0x1998('0x1a')]['message']);}})[_0x1998('0x1b')](function(_0x5ea4b4){logger[_0x1998('0x17')](_0x1998('0x12'),_0x4ff2c8,_0x5ea4b4);_0x3a797c(_0x5ea4b4);});});} \ No newline at end of file +var _0x0783=['lodash','util','moment','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x5a4fce,_0x5a3521){var _0x563ab3=function(_0x1f7fdc){while(--_0x1f7fdc){_0x5a4fce['push'](_0x5a4fce['shift']());}};_0x563ab3(++_0x5a3521);}(_0x0783,0xd8));var _0x3078=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0783[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3078('0x0'));var util=require(_0x3078('0x1'));var moment=require(_0x3078('0x2'));var BPromise=require('bluebird');var rs=require(_0x3078('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3078('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3078('0x5'));var jayson=require(_0x3078('0x6'));var client=jayson[_0x3078('0x7')][_0x3078('0x8')]({'port':0x232a});config[_0x3078('0x9')]=_[_0x3078('0xa')](config[_0x3078('0x9')],{'host':_0x3078('0xb'),'port':0x18eb});var socket=require(_0x3078('0xc'))(new Redis(config['redis']));require(_0x3078('0xd'))['register'](socket);function respondWithRpcPromise(_0x171ea3,_0x2adc32,_0x216b85){return new BPromise(function(_0x148db8,_0x4cdfe5){return client[_0x3078('0xe')](_0x171ea3,_0x216b85)['then'](function(_0x22165){logger[_0x3078('0xf')](_0x3078('0x10'),_0x2adc32,_0x3078('0x11'));logger[_0x3078('0x12')](_0x3078('0x13'),_0x2adc32,'request\x20sent',JSON['stringify'](_0x22165));if(_0x22165[_0x3078('0x14')]){if(_0x22165[_0x3078('0x14')][_0x3078('0x15')]===0x1f4){logger[_0x3078('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x2adc32,_0x22165[_0x3078('0x14')][_0x3078('0x16')]);return _0x4cdfe5(_0x22165[_0x3078('0x14')]['message']);}logger[_0x3078('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x2adc32,_0x22165[_0x3078('0x14')][_0x3078('0x16')]);return _0x148db8(_0x22165[_0x3078('0x14')][_0x3078('0x16')]);}else{logger[_0x3078('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x2adc32,_0x3078('0x11'));_0x148db8(_0x22165['result']['message']);}})[_0x3078('0x17')](function(_0x1ed2cf){logger[_0x3078('0x14')](_0x3078('0x10'),_0x2adc32,_0x1ed2cf);_0x4cdfe5(_0x1ed2cf);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index aee4047..1c2fcb7 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 _0x88c8=['./chatWebsite.events','save','remove','update','emit','removeListener','register','chatWebsite:'];(function(_0x17e423,_0x3146b2){var _0x24b2a7=function(_0x49212a){while(--_0x49212a){_0x17e423['push'](_0x17e423['shift']());}};_0x24b2a7(++_0x3146b2);}(_0x88c8,0x1d8));var _0x888c=function(_0xa7ca56,_0x1f2781){_0xa7ca56=_0xa7ca56-0x0;var _0x123b80=_0x88c8[_0xa7ca56];return _0x123b80;};'use strict';var ChatWebsiteEvents=require(_0x888c('0x0'));var events=[_0x888c('0x1'),_0x888c('0x2'),_0x888c('0x3')];function createListener(_0x3b9b56,_0x55cdfd){return function(_0x425384){_0x55cdfd[_0x888c('0x4')](_0x3b9b56,_0x425384);};}function removeListener(_0x94f106,_0x31d63f){return function(){ChatWebsiteEvents[_0x888c('0x5')](_0x94f106,_0x31d63f);};}exports[_0x888c('0x6')]=function(_0x58bc37){for(var _0x16733e=0x0,_0x30cf97=events['length'];_0x16733e<_0x30cf97;_0x16733e++){var _0x540fd3=events[_0x16733e];var _0x83a019=createListener(_0x888c('0x7')+_0x540fd3,_0x58bc37);ChatWebsiteEvents['on'](_0x540fd3,_0x83a019);}}; \ No newline at end of file +var _0x5efe=['chatWebsite:','./chatWebsite.events','save','remove','emit','removeListener','register'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x5efe,0x112));var _0xe5ef=function(_0x2b4cdd,_0x56e9aa){_0x2b4cdd=_0x2b4cdd-0x0;var _0x4553f5=_0x5efe[_0x2b4cdd];return _0x4553f5;};'use strict';var ChatWebsiteEvents=require(_0xe5ef('0x0'));var events=[_0xe5ef('0x1'),_0xe5ef('0x2'),'update'];function createListener(_0x11d231,_0xf0975e){return function(_0x5245ec){_0xf0975e[_0xe5ef('0x3')](_0x11d231,_0x5245ec);};}function removeListener(_0x101d9c,_0x4ed335){return function(){ChatWebsiteEvents[_0xe5ef('0x4')](_0x101d9c,_0x4ed335);};}exports[_0xe5ef('0x5')]=function(_0x28c327){for(var _0x555f76=0x0,_0x4c010d=events['length'];_0x555f76<_0x4c010d;_0x555f76++){var _0x4ac7e2=events[_0x555f76];var _0x4a2c6b=createListener(_0xe5ef('0x6')+_0x4ac7e2,_0x28c327);ChatWebsiteEvents['on'](_0x4ac7e2,_0x4a2c6b);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7aafb4c..70e73ce 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 _0xe799=['join','root','server/files/images/logos/','format','%s-%s','originalname','file','addLogo','server/files/images/avatars/','now','addAvatar','addCustomerAvatar','single','addSystemAvatar','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any','offline','addInteraction','addApplications','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage'];(function(_0x12ba85,_0x51e159){var _0x55bb6d=function(_0x297dbf){while(--_0x297dbf){_0x12ba85['push'](_0x12ba85['shift']());}};_0x55bb6d(++_0x51e159);}(_0xe799,0xb0));var _0x9e79=function(_0x5f4b2c,_0x55e7dc){_0x5f4b2c=_0x5f4b2c-0x0;var _0x32bb14=_0xe799[_0x5f4b2c];return _0x32bb14;};'use strict';var multer=require(_0x9e79('0x0'));var util=require(_0x9e79('0x1'));var path=require(_0x9e79('0x2'));var timeout=require(_0x9e79('0x3'));var express=require(_0x9e79('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9e79('0x5'));var interaction=require(_0x9e79('0x6'));var config=require(_0x9e79('0x7'));var controller=require('./chatWebsite.controller');router[_0x9e79('0x8')]('/',auth[_0x9e79('0x9')](),controller[_0x9e79('0xa')]);router['get'](_0x9e79('0xb'),auth[_0x9e79('0x9')](),controller[_0x9e79('0xc')]);router['get'](_0x9e79('0xd'),auth[_0x9e79('0x9')](),controller[_0x9e79('0xe')]);router[_0x9e79('0x8')](_0x9e79('0xf'),auth[_0x9e79('0x9')](),controller[_0x9e79('0x10')]);router[_0x9e79('0x8')](_0x9e79('0x11'),auth[_0x9e79('0x9')](),controller[_0x9e79('0x12')]);router[_0x9e79('0x8')](_0x9e79('0x13'),controller[_0x9e79('0x14')]);router[_0x9e79('0x8')](_0x9e79('0x15'),controller['getAvatar']);router[_0x9e79('0x8')](_0x9e79('0x16'),controller['getCustomerAvatar']);router[_0x9e79('0x8')](_0x9e79('0x17'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0x9e79('0x9')](),controller[_0x9e79('0x18')]);router[_0x9e79('0x8')](_0x9e79('0x19'),controller[_0x9e79('0x1a')]);router['get'](_0x9e79('0x1b'),auth[_0x9e79('0x9')](),controller[_0x9e79('0x1c')]);router['get'](_0x9e79('0x1d'),auth[_0x9e79('0x9')](),controller[_0x9e79('0x1e')]);router[_0x9e79('0x8')](_0x9e79('0x1f'),controller[_0x9e79('0x20')]);router[_0x9e79('0x8')]('/:id/offline_messages',auth[_0x9e79('0x9')](),controller[_0x9e79('0x21')]);router[_0x9e79('0x8')](_0x9e79('0x22'),auth[_0x9e79('0x9')](),controller[_0x9e79('0x23')]);router[_0x9e79('0x24')]('/',auth['isAuthenticated'](),controller[_0x9e79('0x25')]);router[_0x9e79('0x24')](_0x9e79('0xf'),auth['isAuthenticated'](),controller[_0x9e79('0x26')]);router[_0x9e79('0x24')](_0x9e79('0x11'),auth[_0x9e79('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x9e79('0x27')]({'destination':function(_0x575d18,_0x2d6f07,_0x599ea8){_0x599ea8(null,path[_0x9e79('0x28')](config[_0x9e79('0x29')],_0x9e79('0x2a')));},'filename':function(_0x1a002b,_0x44529b,_0x5b487c){_0x5b487c(null,util[_0x9e79('0x2b')](_0x9e79('0x2c'),Date['now'](),_0x44529b[_0x9e79('0x2d')]));}})});router[_0x9e79('0x24')](_0x9e79('0x13'),upload['single'](_0x9e79('0x2e')),controller[_0x9e79('0x2f')]);var upload=multer({'storage':multer[_0x9e79('0x27')]({'destination':function(_0x4586e8,_0x356bdd,_0x64cca2){_0x64cca2(null,path[_0x9e79('0x28')](config[_0x9e79('0x29')],_0x9e79('0x30')));},'filename':function(_0x5644a7,_0x1c6d09,_0x1a67e9){_0x1a67e9(null,util[_0x9e79('0x2b')]('%s-%s',Date[_0x9e79('0x31')](),_0x1c6d09[_0x9e79('0x2d')]));}})});router[_0x9e79('0x24')](_0x9e79('0x15'),upload['single'](_0x9e79('0x2e')),controller[_0x9e79('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x34a71a,_0x20095d,_0x5796f1){_0x5796f1(null,path[_0x9e79('0x28')](config[_0x9e79('0x29')],_0x9e79('0x30')));},'filename':function(_0x3bde19,_0x3f1161,_0x1af7f6){_0x1af7f6(null,util['format'](_0x9e79('0x2c'),Date[_0x9e79('0x31')](),_0x3f1161['originalname']));}})});router['post'](_0x9e79('0x16'),upload['single'](_0x9e79('0x2e')),controller[_0x9e79('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2cdc41,_0x28a634,_0x28c103){_0x28c103(null,path[_0x9e79('0x28')](config['root'],_0x9e79('0x30')));},'filename':function(_0x3c4835,_0x50d091,_0x4c067a){_0x4c067a(null,util[_0x9e79('0x2b')]('%s-%s',Date[_0x9e79('0x31')](),_0x50d091['originalname']));}})});router['post'](_0x9e79('0x17'),upload[_0x9e79('0x34')]('file'),controller[_0x9e79('0x35')]);router[_0x9e79('0x24')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x9e79('0x27')]({'destination':function(_0x45da77,_0x32928a,_0x2636b9){const _0x4e5ea2=path[_0x9e79('0x28')](config['root'],_0x9e79('0x36'),_0x9e79('0x37'),_0x9e79('0x38'));fs_extra[_0x9e79('0x39')](_0x4e5ea2,function(){_0x2636b9(null,_0x4e5ea2);});},'filename':function(_0x46fdf0,_0x13bbfc,_0x497e6e){const _0x54486e=_0x13bbfc[_0x9e79('0x2d')][_0x9e79('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4be577=path['extname'](_0x54486e);const _0x55539d=Date[_0x9e79('0x31')]()+'-'+_0x54486e[_0x9e79('0x3a')](_0x4be577,'')+_0x4be577;_0x497e6e(null,_0x55539d);}})});router[_0x9e79('0x24')](_0x9e79('0x3b'),offlineUploadMulter[_0x9e79('0x3c')](),controller[_0x9e79('0x3d')]);router['post']('/:id/interactions',auth[_0x9e79('0x9')](),controller[_0x9e79('0x3e')]);router[_0x9e79('0x24')](_0x9e79('0x1b'),auth['isAuthenticated'](),controller[_0x9e79('0x3f')]);router[_0x9e79('0x24')](_0x9e79('0x1d'),auth[_0x9e79('0x9')](),controller['addProactiveActions']);router[_0x9e79('0x24')](_0x9e79('0x22'),auth['isAuthenticated'](),controller[_0x9e79('0x40')]);router[_0x9e79('0x41')](_0x9e79('0xd'),auth[_0x9e79('0x9')](),controller[_0x9e79('0x42')]);router[_0x9e79('0x43')](_0x9e79('0xd'),auth[_0x9e79('0x9')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x9e79('0x9')](),controller[_0x9e79('0x44')]);router[_0x9e79('0x43')](_0x9e79('0x11'),auth[_0x9e79('0x9')](),controller[_0x9e79('0x45')]);router[_0x9e79('0x43')](_0x9e79('0x22'),auth['isAuthenticated'](),controller[_0x9e79('0x46')]);module[_0x9e79('0x47')]=router; \ No newline at end of file +var _0xf18c=['/:id/users','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','addLogo','server/files/images/avatars/','file','addAvatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','extname','/:id/offline','any','/:id/interactions'];(function(_0x4eed89,_0x108efd){var _0x1d6ded=function(_0x18a0bd){while(--_0x18a0bd){_0x4eed89['push'](_0x4eed89['shift']());}};_0x1d6ded(++_0x108efd);}(_0xf18c,0x1ad));var _0xcf18=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xf18c[_0x4fde08];return _0x12e725;};'use strict';var multer=require(_0xcf18('0x0'));var util=require(_0xcf18('0x1'));var path=require(_0xcf18('0x2'));var timeout=require(_0xcf18('0x3'));var express=require(_0xcf18('0x4'));var router=express[_0xcf18('0x5')]();var fs_extra=require(_0xcf18('0x6'));var auth=require(_0xcf18('0x7'));var interaction=require(_0xcf18('0x8'));var config=require(_0xcf18('0x9'));var controller=require('./chatWebsite.controller');router[_0xcf18('0xa')]('/',auth[_0xcf18('0xb')](),controller[_0xcf18('0xc')]);router[_0xcf18('0xa')](_0xcf18('0xd'),auth[_0xcf18('0xb')](),controller[_0xcf18('0xe')]);router[_0xcf18('0xa')](_0xcf18('0xf'),auth[_0xcf18('0xb')](),controller['show']);router['get'](_0xcf18('0x10'),auth[_0xcf18('0xb')](),controller[_0xcf18('0x11')]);router[_0xcf18('0xa')](_0xcf18('0x12'),auth[_0xcf18('0xb')](),controller['getAnswers']);router[_0xcf18('0xa')](_0xcf18('0x13'),controller[_0xcf18('0x14')]);router[_0xcf18('0xa')](_0xcf18('0x15'),controller[_0xcf18('0x16')]);router[_0xcf18('0xa')](_0xcf18('0x17'),controller[_0xcf18('0x18')]);router[_0xcf18('0xa')](_0xcf18('0x19'),controller[_0xcf18('0x1a')]);router['get']('/:id/interactions',auth[_0xcf18('0xb')](),controller[_0xcf18('0x1b')]);router['get']('/:id/snippet',controller[_0xcf18('0x1c')]);router['get'](_0xcf18('0x1d'),auth[_0xcf18('0xb')](),controller['getApplications']);router['get'](_0xcf18('0x1e'),auth['isAuthenticated'](),controller[_0xcf18('0x1f')]);router[_0xcf18('0xa')]('/:id/fields',controller[_0xcf18('0x20')]);router[_0xcf18('0xa')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0xcf18('0x21')]);router[_0xcf18('0xa')]('/:id/users',auth[_0xcf18('0xb')](),controller['getAgents']);router[_0xcf18('0x22')]('/',auth['isAuthenticated'](),controller[_0xcf18('0x23')]);router[_0xcf18('0x22')](_0xcf18('0x10'),auth[_0xcf18('0xb')](),controller[_0xcf18('0x24')]);router['post'](_0xcf18('0x12'),auth[_0xcf18('0xb')](),controller[_0xcf18('0x25')]);var upload=multer({'storage':multer[_0xcf18('0x26')]({'destination':function(_0x244449,_0x4287bc,_0x42dac3){_0x42dac3(null,path[_0xcf18('0x27')](config[_0xcf18('0x28')],_0xcf18('0x29')));},'filename':function(_0x3652d9,_0x868a85,_0x2faae8){_0x2faae8(null,util[_0xcf18('0x2a')](_0xcf18('0x2b'),Date[_0xcf18('0x2c')](),_0x868a85[_0xcf18('0x2d')]));}})});router[_0xcf18('0x22')](_0xcf18('0x13'),upload[_0xcf18('0x2e')]('file'),controller[_0xcf18('0x2f')]);var upload=multer({'storage':multer[_0xcf18('0x26')]({'destination':function(_0x56d56b,_0x546fce,_0x50fd1d){_0x50fd1d(null,path[_0xcf18('0x27')](config[_0xcf18('0x28')],_0xcf18('0x30')));},'filename':function(_0x3cf20f,_0x3c12af,_0x2e196c){_0x2e196c(null,util['format'](_0xcf18('0x2b'),Date[_0xcf18('0x2c')](),_0x3c12af['originalname']));}})});router['post'](_0xcf18('0x15'),upload[_0xcf18('0x2e')](_0xcf18('0x31')),controller[_0xcf18('0x32')]);var upload=multer({'storage':multer[_0xcf18('0x26')]({'destination':function(_0x130af1,_0x4dff8e,_0x52efc2){_0x52efc2(null,path['join'](config['root'],_0xcf18('0x30')));},'filename':function(_0x5624bc,_0xb4681,_0x40d51d){_0x40d51d(null,util[_0xcf18('0x2a')]('%s-%s',Date['now'](),_0xb4681[_0xcf18('0x2d')]));}})});router[_0xcf18('0x22')](_0xcf18('0x17'),upload[_0xcf18('0x2e')](_0xcf18('0x31')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xcf18('0x26')]({'destination':function(_0x18b68c,_0x20d368,_0xde8dfb){_0xde8dfb(null,path[_0xcf18('0x27')](config[_0xcf18('0x28')],_0xcf18('0x30')));},'filename':function(_0x46c7d9,_0x39a8ec,_0x433bfd){_0x433bfd(null,util[_0xcf18('0x2a')]('%s-%s',Date[_0xcf18('0x2c')](),_0x39a8ec[_0xcf18('0x2d')]));}})});router['post'](_0xcf18('0x19'),upload[_0xcf18('0x2e')](_0xcf18('0x31')),controller[_0xcf18('0x33')]);router[_0xcf18('0x22')](_0xcf18('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x14fbd1,_0x41a63a,_0x2c6c67){const _0x3edda0=path[_0xcf18('0x27')](config[_0xcf18('0x28')],_0xcf18('0x35'),_0xcf18('0x36'),_0xcf18('0x37'));fs_extra[_0xcf18('0x38')](_0x3edda0,function(){_0x2c6c67(null,_0x3edda0);});},'filename':function(_0x56ee0b,_0x24e799,_0x861a61){const _0x2cbc89=_0x24e799['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3e6fa8=path[_0xcf18('0x39')](_0x2cbc89);const _0xdff487=Date['now']()+'-'+_0x2cbc89['replace'](_0x3e6fa8,'')+_0x3e6fa8;_0x861a61(null,_0xdff487);}})});router[_0xcf18('0x22')](_0xcf18('0x3a'),offlineUploadMulter[_0xcf18('0x3b')](),controller['offline']);router[_0xcf18('0x22')](_0xcf18('0x3c'),auth[_0xcf18('0xb')](),controller['addInteraction']);router[_0xcf18('0x22')](_0xcf18('0x1d'),auth['isAuthenticated'](),controller['addApplications']);router[_0xcf18('0x22')](_0xcf18('0x1e'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0xcf18('0x22')](_0xcf18('0x3d'),auth[_0xcf18('0xb')](),controller[_0xcf18('0x3e')]);router[_0xcf18('0x3f')]('/:id',auth[_0xcf18('0xb')](),controller[_0xcf18('0x40')]);router[_0xcf18('0x41')](_0xcf18('0xf'),auth[_0xcf18('0xb')](),controller[_0xcf18('0x42')]);router['delete'](_0xcf18('0x10'),auth[_0xcf18('0xb')](),controller['removeDispositions']);router[_0xcf18('0x41')](_0xcf18('0x12'),auth['isAuthenticated'](),controller[_0xcf18('0x43')]);router[_0xcf18('0x41')](_0xcf18('0x3d'),auth[_0xcf18('0xb')](),controller[_0xcf18('0x44')]);module[_0xcf18('0x45')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index fa8ee85..7642e83 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 _0xa899=['Google','sequelize','exports','STRING','AmazonAWS'];(function(_0x39d481,_0x468019){var _0x510b49=function(_0x3f57d9){while(--_0x3f57d9){_0x39d481['push'](_0x39d481['shift']());}};_0x510b49(++_0x468019);}(_0xa899,0x155));var _0x9a89=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xa899[_0x3b5ad9];return _0x611ae9;};'use strict';var Sequelize=require(_0x9a89('0x0'));module[_0x9a89('0x1')]={'name':{'type':Sequelize[_0x9a89('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x9a89('0x3'),_0x9a89('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x9a89('0x2')]},'data2':{'type':Sequelize[_0x9a89('0x2')]}}; \ No newline at end of file +var _0x022a=['STRING','ENUM','AmazonAWS','Google','sequelize','exports'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x022a,0x1f0));var _0xa022=function(_0x13594e,_0x6f0ed0){_0x13594e=_0x13594e-0x0;var _0x1a4f42=_0x022a[_0x13594e];return _0x1a4f42;};'use strict';var Sequelize=require(_0xa022('0x0'));module[_0xa022('0x1')]={'name':{'type':Sequelize[_0xa022('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xa022('0x3')](_0xa022('0x4'),_0xa022('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xa022('0x2')]},'data2':{'type':Sequelize[_0xa022('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index a1b1df8..8251bad 100644 --- a/server/api/cloudProvider/cloudProvider.controller.js +++ b/server/api/cloudProvider/cloudProvider.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['error','stack','name','send','index','CloudProvider','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus'];(function(_0x36a0fd,_0x397ff4){var _0x53de2a=function(_0x3dc646){while(--_0x3dc646){_0x36a0fd['push'](_0x36a0fd['shift']());}};_0x53de2a(++_0x397ff4);}(_0xdb28,0x106));var _0x8db2=function(_0x48e8ec,_0x1ddeb6){_0x48e8ec=_0x48e8ec-0x0;var _0x589de1=_0xdb28[_0x48e8ec];return _0x589de1;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));}; \ No newline at end of file +var _0x2032=['body','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','CloudProvider','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','rows','show','params','keys','rawAttributes','includeAll','find','catch'];(function(_0x2361bc,_0xe667fa){var _0x14df19=function(_0x2ecd47){while(--_0x2ecd47){_0x2361bc['push'](_0x2361bc['shift']());}};_0x14df19(++_0xe667fa);}(_0x2032,0xd9));var _0x2203=function(_0x1572f3,_0x523dba){_0x1572f3=_0x1572f3-0x0;var _0x3104a6=_0x2032[_0x1572f3];return _0x3104a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'all':!![]}];}return db[_0x2203('0x2c')]['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x446209){_0x34b8ba[_0x2203('0x3f')]=_0x446209;return _0x34b8ba;})['then'](respondWithFilteredResult(_0x1df508,_0x9c53f))['catch'](handleError(_0x1df508,null));};exports[_0x2203('0x40')]=function(_0x3739f6,_0x368444){var _0x1e09f3={'raw':!![],'where':{'id':_0x3739f6[_0x2203('0x41')]['id']}},_0x372709={};_0x372709['model']=_[_0x2203('0x42')](db[_0x2203('0x2c')][_0x2203('0x43')]);_0x372709[_0x2203('0x30')]=_[_0x2203('0x42')](_0x3739f6[_0x2203('0x30')]);_0x372709[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x372709[_0x2203('0x31')],_0x372709[_0x2203('0x30')]);_0x1e09f3['attributes']=_[_0x2203('0x33')](_0x372709[_0x2203('0x31')],qs[_0x2203('0x34')](_0x3739f6[_0x2203('0x30')]['fields']));_0x1e09f3['attributes']=_0x1e09f3[_0x2203('0x32')]['length']?_0x1e09f3[_0x2203('0x32')]:_0x372709[_0x2203('0x31')];if(_0x3739f6[_0x2203('0x30')][_0x2203('0x44')]){_0x1e09f3['include']=[{'all':!![]}];}_0x1e09f3=_[_0x2203('0x3c')]({},_0x1e09f3,_0x3739f6[_0x2203('0x3e')]);return db['CloudProvider'][_0x2203('0x45')](_0x1e09f3)[_0x2203('0x23')](handleEntityNotFound(_0x368444,null))[_0x2203('0x23')](respondWithResult(_0x368444,null))[_0x2203('0x46')](handleError(_0x368444,null));};exports['create']=function(_0x4c1a29,_0x21b8ab){return db['CloudProvider']['create'](_0x4c1a29[_0x2203('0x47')],{})[_0x2203('0x23')](respondWithResult(_0x21b8ab,0xc9))[_0x2203('0x46')](handleError(_0x21b8ab,null));};exports['update']=function(_0x4c1496,_0x131aec){if(_0x4c1496[_0x2203('0x47')]['id']){delete _0x4c1496[_0x2203('0x47')]['id'];}return db[_0x2203('0x2c')][_0x2203('0x45')]({'where':{'id':_0x4c1496[_0x2203('0x41')]['id']}})['then'](handleEntityNotFound(_0x131aec,null))[_0x2203('0x23')](saveUpdates(_0x4c1496['body'],null))[_0x2203('0x23')](respondWithResult(_0x131aec,null))[_0x2203('0x46')](handleError(_0x131aec,null));};exports[_0x2203('0x24')]=function(_0x1e49dd,_0x58b9bb){return db['CloudProvider'][_0x2203('0x45')]({'where':{'id':_0x1e49dd[_0x2203('0x41')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x58b9bb,null))[_0x2203('0x23')](removeEntity(_0x58b9bb,null))['catch'](handleError(_0x58b9bb,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index ce2c411..7651c89 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 _0x4bec=['rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x4bec,0x124));var _0xc4be=function(_0x11fdbc,_0x39596b){_0x11fdbc=_0x11fdbc-0x0;var _0x4d2e0a=_0x4bec[_0x11fdbc];return _0x4d2e0a;};'use strict';var _=require(_0xc4be('0x0'));var util=require(_0xc4be('0x1'));var logger=require(_0xc4be('0x2'))(_0xc4be('0x3'));var moment=require('moment');var BPromise=require(_0xc4be('0x4'));var rp=require(_0xc4be('0x5'));var fs=require('fs');var path=require(_0xc4be('0x6'));var rimraf=require(_0xc4be('0x7'));var config=require(_0xc4be('0x8'));var attributes=require(_0xc4be('0x9'));module['exports']=function(_0x495a5c,_0x300a60){return _0x495a5c[_0xc4be('0xa')](_0xc4be('0xb'),attributes,{'tableName':_0xc4be('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4e2=['moment','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','util','../../config/logger','api'];(function(_0x2f6233,_0x90172){var _0x1c9c36=function(_0x3ac680){while(--_0x3ac680){_0x2f6233['push'](_0x2f6233['shift']());}};_0x1c9c36(++_0x90172);}(_0xa4e2,0xe0));var _0x2a4e=function(_0xdf485c,_0x4e1eb4){_0xdf485c=_0xdf485c-0x0;var _0x27aad1=_0xa4e2[_0xdf485c];return _0x27aad1;};'use strict';var _=require(_0x2a4e('0x0'));var util=require(_0x2a4e('0x1'));var logger=require(_0x2a4e('0x2'))(_0x2a4e('0x3'));var moment=require(_0x2a4e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a4e('0x5'));var rimraf=require(_0x2a4e('0x6'));var config=require(_0x2a4e('0x7'));var attributes=require(_0x2a4e('0x8'));module[_0x2a4e('0x9')]=function(_0x5e2a1f,_0x15f436){return _0x5e2a1f['define'](_0x2a4e('0xa'),attributes,{'tableName':_0x2a4e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 8b29be5..2cb60b0 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 _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x36b3ed,_0x1d9ce6){var _0x41ff06=function(_0x4fcf44){while(--_0x4fcf44){_0x36b3ed['push'](_0x36b3ed['shift']());}};_0x41ff06(++_0x1d9ce6);}(_0x7880,0x1f4));var _0x0788=function(_0x15fdff,_0x40d5b2){_0x15fdff=_0x15fdff-0x0;var _0x5450ed=_0x7880[_0x15fdff];return _0x5450ed;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file +var _0x0b0e=['CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug'];(function(_0x586fa2,_0x1a45bc){var _0x515be9=function(_0x4e90d5){while(--_0x4e90d5){_0x586fa2['push'](_0x586fa2['shift']());}};_0x515be9(++_0x1a45bc);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x0b0e[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('CloudProvider,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index b5640ba..149fc8d 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 _0xfefc=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','create','put','/:id','update'];(function(_0x324f55,_0x2e6ca4){var _0x284952=function(_0x36ceae){while(--_0x36ceae){_0x324f55['push'](_0x324f55['shift']());}};_0x284952(++_0x2e6ca4);}(_0xfefc,0xfa));var _0xcfef=function(_0x5e501a,_0x33a574){_0x5e501a=_0x5e501a-0x0;var _0x43d2e9=_0xfefc[_0x5e501a];return _0x43d2e9;};'use strict';var multer=require(_0xcfef('0x0'));var util=require(_0xcfef('0x1'));var path=require(_0xcfef('0x2'));var timeout=require(_0xcfef('0x3'));var express=require(_0xcfef('0x4'));var router=express['Router']();var fs_extra=require(_0xcfef('0x5'));var auth=require(_0xcfef('0x6'));var interaction=require(_0xcfef('0x7'));var config=require(_0xcfef('0x8'));var controller=require('./cloudProvider.controller');router[_0xcfef('0x9')]('/',auth['isAuthenticated'](),controller[_0xcfef('0xa')]);router[_0xcfef('0x9')]('/:id',auth[_0xcfef('0xb')](),controller['show']);router['post']('/',auth[_0xcfef('0xb')](),controller[_0xcfef('0xc')]);router[_0xcfef('0xd')](_0xcfef('0xe'),auth[_0xcfef('0xb')](),controller[_0xcfef('0xf')]);router[_0xcfef('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xcfef('0x11')]);module[_0xcfef('0x12')]=router; \ No newline at end of file +var _0xe2ab=['post','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','isAuthenticated','get','show'];(function(_0x166b02,_0x3bedb3){var _0xa70dab=function(_0x12e92a){while(--_0x12e92a){_0x166b02['push'](_0x166b02['shift']());}};_0xa70dab(++_0x3bedb3);}(_0xe2ab,0xc4));var _0xbe2a=function(_0x38ca12,_0x2cbbec){_0x38ca12=_0x38ca12-0x0;var _0x2f6936=_0xe2ab[_0x38ca12];return _0x2f6936;};'use strict';var multer=require(_0xbe2a('0x0'));var util=require(_0xbe2a('0x1'));var path=require(_0xbe2a('0x2'));var timeout=require(_0xbe2a('0x3'));var express=require(_0xbe2a('0x4'));var router=express[_0xbe2a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbe2a('0x6'));var interaction=require(_0xbe2a('0x7'));var config=require(_0xbe2a('0x8'));var controller=require(_0xbe2a('0x9'));router['get']('/',auth[_0xbe2a('0xa')](),controller['index']);router[_0xbe2a('0xb')]('/:id',auth[_0xbe2a('0xa')](),controller[_0xbe2a('0xc')]);router[_0xbe2a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbe2a('0xe')](_0xbe2a('0xf'),auth['isAuthenticated'](),controller[_0xbe2a('0x10')]);router[_0xbe2a('0x11')](_0xbe2a('0xf'),auth[_0xbe2a('0xa')](),controller[_0xbe2a('0x12')]);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 8ff905a..e42a11d 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 _0xf9ec=['sequelize','exports','STRING','name'];(function(_0x56b2d5,_0x1d3dd5){var _0x54b7fe=function(_0x25aa59){while(--_0x25aa59){_0x56b2d5['push'](_0x56b2d5['shift']());}};_0x54b7fe(++_0x1d3dd5);}(_0xf9ec,0x128));var _0xcf9e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf9ec[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xcf9e('0x0'));module[_0xcf9e('0x1')]={'name':{'type':Sequelize[_0xcf9e('0x2')],'unique':_0xcf9e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xcf9e('0x2')]},'companyId':{'type':Sequelize[_0xcf9e('0x2')]},'website':{'type':Sequelize[_0xcf9e('0x2')]},'phone':{'type':Sequelize[_0xcf9e('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcf9e('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xcf9e('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xcf9e('0x2')]},'email':{'type':Sequelize[_0xcf9e('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xcf9e('0x2')]},'sStreet':{'type':Sequelize[_0xcf9e('0x2')]},'sPostalCode':{'type':Sequelize[_0xcf9e('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xcf9e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x253b=['exports','name','STRING','sequelize'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x253b,0xfb));var _0xb253=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x253b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb253('0x0'));module[_0xb253('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb253('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb253('0x3')]},'companyId':{'type':Sequelize[_0xb253('0x3')]},'website':{'type':Sequelize[_0xb253('0x3')]},'phone':{'type':Sequelize[_0xb253('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb253('0x3')]},'street':{'type':Sequelize[_0xb253('0x3')]},'postalCode':{'type':Sequelize[_0xb253('0x3')]},'city':{'type':Sequelize[_0xb253('0x3')]},'country':{'type':Sequelize[_0xb253('0x3')]},'email':{'type':Sequelize[_0xb253('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb253('0x3')]},'sStreet':{'type':Sequelize[_0xb253('0x3')]},'sPostalCode':{'type':Sequelize[_0xb253('0x3')]},'sCity':{'type':Sequelize[_0xb253('0x3')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb253('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 775b580..52df501 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 _0x8b55=['role','Companies','UserProfileSection','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','addContacts','ids','omit','getContacts','findOne','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','filter','options','includeAll','include','rows','catch','params','rawAttributes','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8b55,0xc0));var _0x58b5=function(_0x28ad73,_0xae98cf){_0x28ad73=_0x28ad73-0x0;var _0x363f16=_0x8b55[_0x28ad73];return _0x363f16;};'use strict';var emlformat=require(_0x58b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x58b5('0x1'));var jsonpatch=require(_0x58b5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x58b5('0x3'));var Mustache=require(_0x58b5('0x4'));var util=require(_0x58b5('0x5'));var path=require(_0x58b5('0x6'));var sox=require(_0x58b5('0x7'));var csv=require(_0x58b5('0x8'));var ejs=require(_0x58b5('0x9'));var fs=require('fs');var fs_extra=require(_0x58b5('0xa'));var _=require(_0x58b5('0xb'));var squel=require(_0x58b5('0xc'));var crypto=require(_0x58b5('0xd'));var jsforce=require(_0x58b5('0xe'));var deskjs=require(_0x58b5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x58b5('0x10'));var Redis=require(_0x58b5('0x11'));var authService=require(_0x58b5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x58b5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x58b5('0x14'))(_0x58b5('0x15'));var utils=require(_0x58b5('0x16'));var config=require(_0x58b5('0x17'));var licenseUtil=require(_0x58b5('0x18'));var db=require(_0x58b5('0x19'))['db'];function respondWithStatusCode(_0x5a5fdf,_0x280bb4){_0x280bb4=_0x280bb4||0xcc;return function(_0x2abd3f){if(_0x2abd3f){return _0x5a5fdf[_0x58b5('0x1a')](_0x280bb4);}return _0x5a5fdf['status'](_0x280bb4)[_0x58b5('0x1b')]();};}function respondWithResult(_0x248742,_0x52481f){_0x52481f=_0x52481f||0xc8;return function(_0x4e6ac3){if(_0x4e6ac3){return _0x248742[_0x58b5('0x1c')](_0x52481f)[_0x58b5('0x1d')](_0x4e6ac3);}};}function respondWithFilteredResult(_0x915c6a,_0x27c1fa){return function(_0x21b3a4){if(_0x21b3a4){var _0x1c6815=typeof _0x27c1fa['offset']===_0x58b5('0x1e')&&typeof _0x27c1fa['limit']===_0x58b5('0x1e');var _0x1deb59=_0x21b3a4[_0x58b5('0x1f')];var _0x594dcb=_0x1c6815?0x0:_0x27c1fa['offset'];var _0x3d7f68=_0x1c6815?_0x21b3a4[_0x58b5('0x1f')]:_0x27c1fa[_0x58b5('0x20')]+_0x27c1fa[_0x58b5('0x21')];var _0x16ddb5;if(_0x3d7f68>=_0x1deb59){_0x3d7f68=_0x1deb59;_0x16ddb5=0xc8;}else{_0x16ddb5=0xce;}_0x915c6a[_0x58b5('0x1c')](_0x16ddb5);return _0x915c6a[_0x58b5('0x22')](_0x58b5('0x23'),_0x594dcb+'-'+_0x3d7f68+'/'+_0x1deb59)['json'](_0x21b3a4);}return null;};}function patchUpdates(_0x48b139){return function(_0x4e4630){try{jsonpatch[_0x58b5('0x24')](_0x4e4630,_0x48b139,!![]);}catch(_0x2401e2){return BPromise[_0x58b5('0x25')](_0x2401e2);}return _0x4e4630[_0x58b5('0x26')]();};}function saveUpdates(_0x1ca921,_0x2a191a){return function(_0x101514){if(_0x101514){return _0x101514[_0x58b5('0x27')](_0x1ca921)[_0x58b5('0x28')](function(_0x2382dc){return _0x2382dc;});}return null;};}function removeEntity(_0x4b7064,_0x10de29){return function(_0x9558e6){if(_0x9558e6){return _0x9558e6[_0x58b5('0x29')]()['then'](function(){var _0xaf66c8=_0x9558e6['get']({'plain':!![]});var _0x4ab02c='Companies';return db['UserProfileResource'][_0x58b5('0x29')]({'where':{'type':_0x4ab02c,'resourceId':_0xaf66c8['id']}})[_0x58b5('0x28')](function(){return _0x9558e6;});})[_0x58b5('0x28')](function(){_0x4b7064[_0x58b5('0x1c')](0xcc)[_0x58b5('0x1b')]();});}};}function handleEntityNotFound(_0x3957d9,_0x5d2ee7){return function(_0x4ebd1e){if(!_0x4ebd1e){_0x3957d9[_0x58b5('0x1a')](0x194);}return _0x4ebd1e;};}function handleError(_0x416598,_0xc3daf2){_0xc3daf2=_0xc3daf2||0x1f4;return function(_0x2a7f39){logger['error'](_0x2a7f39[_0x58b5('0x2a')]);if(_0x2a7f39[_0x58b5('0x2b')]){delete _0x2a7f39[_0x58b5('0x2b')];}_0x416598[_0x58b5('0x1c')](_0xc3daf2)[_0x58b5('0x2c')](_0x2a7f39);};}exports['index']=function(_0x1108ee,_0x5814af){var _0x45e27e={},_0x73c21e={},_0x41cebb={'count':0x0,'rows':[]};return db[_0x58b5('0x2d')][_0x58b5('0x2e')]()[_0x58b5('0x28')](function(_0x49ef2b){_0x73c21e[_0x58b5('0x2f')]=_[_0x58b5('0x30')](_0x49ef2b);_0x73c21e['query']=_[_0x58b5('0x30')](_0x1108ee[_0x58b5('0x31')]);_0x73c21e[_0x58b5('0x32')]=_[_0x58b5('0x33')](_0x73c21e[_0x58b5('0x2f')],_0x73c21e['query']);_0x45e27e['attributes']=_[_0x58b5('0x33')](_0x73c21e['model'],qs['fields'](_0x1108ee[_0x58b5('0x31')][_0x58b5('0x34')]));_0x45e27e[_0x58b5('0x35')]=_0x45e27e[_0x58b5('0x35')][_0x58b5('0x36')]?_0x45e27e[_0x58b5('0x35')]:_0x73c21e[_0x58b5('0x2f')];if(!_0x1108ee['query'][_0x58b5('0x37')](_0x58b5('0x38'))){_0x45e27e[_0x58b5('0x21')]=qs['limit'](_0x1108ee[_0x58b5('0x31')]['limit']);_0x45e27e[_0x58b5('0x20')]=qs['offset'](_0x1108ee['query']['offset']);}_0x45e27e['order']=qs[_0x58b5('0x39')](_0x1108ee[_0x58b5('0x31')]['sort']);_0x45e27e[_0x58b5('0x3a')]=qs[_0x58b5('0x32')](_[_0x58b5('0x3b')](_0x1108ee[_0x58b5('0x31')],_0x73c21e[_0x58b5('0x32')]),_0x49ef2b);if(_0x1108ee['query']['filter']){_0x45e27e[_0x58b5('0x3a')]=_[_0x58b5('0x3c')](_0x45e27e['where'],{'$or':_[_0x58b5('0x3d')](_0x45e27e[_0x58b5('0x35')],function(_0x1ec094){var _0x47d74a={};_0x47d74a[_0x1ec094]={'$like':'%'+_0x1108ee[_0x58b5('0x31')][_0x58b5('0x3e')]+'%'};return _0x47d74a;})});}_0x45e27e=_[_0x58b5('0x3c')]({},_0x45e27e,_0x1108ee[_0x58b5('0x3f')]);var _0x1b2d67={'where':_0x45e27e[_0x58b5('0x3a')]};return db[_0x58b5('0x2d')][_0x58b5('0x1f')](_0x1b2d67)[_0x58b5('0x28')](function(_0x24d5e5){_0x41cebb[_0x58b5('0x1f')]=_0x24d5e5;if(_0x1108ee[_0x58b5('0x31')][_0x58b5('0x40')]){_0x45e27e[_0x58b5('0x41')]=[{'all':!![]}];}return db[_0x58b5('0x2d')]['findAll'](_0x45e27e);})[_0x58b5('0x28')](function(_0x55b0b2){_0x41cebb[_0x58b5('0x42')]=_0x55b0b2;return _0x41cebb;})['then'](respondWithFilteredResult(_0x5814af,_0x45e27e))['catch'](handleError(_0x5814af,null));})[_0x58b5('0x43')](handleError(_0x5814af,null));};exports['show']=function(_0x5907e8,_0xa59262){var _0x18d0cd={'raw':![],'where':{'id':_0x5907e8[_0x58b5('0x44')]['id']}},_0x3f1836={};_0x3f1836[_0x58b5('0x2f')]=_['keys'](db['CmCompany'][_0x58b5('0x45')]);_0x3f1836['query']=_[_0x58b5('0x30')](_0x5907e8[_0x58b5('0x31')]);_0x3f1836['filters']=_[_0x58b5('0x33')](_0x3f1836[_0x58b5('0x2f')],_0x3f1836[_0x58b5('0x31')]);_0x18d0cd[_0x58b5('0x35')]=_[_0x58b5('0x33')](_0x3f1836['model'],qs[_0x58b5('0x34')](_0x5907e8[_0x58b5('0x31')][_0x58b5('0x34')]));_0x18d0cd[_0x58b5('0x35')]=_0x18d0cd[_0x58b5('0x35')][_0x58b5('0x36')]?_0x18d0cd['attributes']:_0x3f1836['model'];if(_0x5907e8[_0x58b5('0x31')]['includeAll']){_0x18d0cd[_0x58b5('0x41')]=[{'all':!![]}];}_0x18d0cd=_[_0x58b5('0x3c')]({},_0x18d0cd,_0x5907e8[_0x58b5('0x3f')]);return db[_0x58b5('0x2d')][_0x58b5('0x46')](_0x18d0cd)[_0x58b5('0x28')](handleEntityNotFound(_0xa59262,null))[_0x58b5('0x28')](respondWithResult(_0xa59262,null))[_0x58b5('0x43')](handleError(_0xa59262,null));};exports['create']=function(_0x4c9f7c,_0xf16e38){return db[_0x58b5('0x2d')]['create'](_0x4c9f7c[_0x58b5('0x47')],{})[_0x58b5('0x28')](function(_0x32cbb9){var _0xcea5e2=_0x4c9f7c[_0x58b5('0x48')][_0x58b5('0x49')]({'plain':!![]});if(!_0xcea5e2)throw new Error(_0x58b5('0x4a'));if(_0xcea5e2[_0x58b5('0x4b')]===_0x58b5('0x48')){var _0x5796c5=_0x32cbb9[_0x58b5('0x49')]({'plain':!![]});var _0x2841be=_0x58b5('0x4c');return db[_0x58b5('0x4d')]['find']({'where':{'name':_0x2841be,'userProfileId':_0xcea5e2['userProfileId']},'raw':!![]})['then'](function(_0x5dfc87){if(_0x5dfc87&&_0x5dfc87[_0x58b5('0x4e')]===0x0){return db[_0x58b5('0x4f')][_0x58b5('0x50')]({'name':_0x5796c5[_0x58b5('0x2b')],'resourceId':_0x5796c5['id'],'type':_0x5dfc87[_0x58b5('0x2b')],'sectionId':_0x5dfc87['id']},{})['then'](function(){return _0x32cbb9;});}else{return _0x32cbb9;}})[_0x58b5('0x43')](function(_0x22587b){logger[_0x58b5('0x51')](_0x58b5('0x52'),_0x22587b);throw _0x22587b;});}return _0x32cbb9;})[_0x58b5('0x28')](respondWithResult(_0xf16e38,0xc9))['catch'](handleError(_0xf16e38,null));};exports['update']=function(_0x3ce07a,_0x24caa4){if(_0x3ce07a[_0x58b5('0x47')]['id']){delete _0x3ce07a[_0x58b5('0x47')]['id'];}return db['CmCompany'][_0x58b5('0x46')]({'where':{'id':_0x3ce07a[_0x58b5('0x44')]['id']}})['then'](handleEntityNotFound(_0x24caa4,null))['then'](saveUpdates(_0x3ce07a[_0x58b5('0x47')],null))[_0x58b5('0x28')](respondWithResult(_0x24caa4,null))[_0x58b5('0x43')](handleError(_0x24caa4,null));};exports[_0x58b5('0x29')]=function(_0x33ac1b,_0x1bc276){return db['CmCompany'][_0x58b5('0x46')]({'where':{'id':_0x33ac1b[_0x58b5('0x44')]['id']}})[_0x58b5('0x28')](handleEntityNotFound(_0x1bc276,null))['then'](removeEntity(_0x1bc276,null))[_0x58b5('0x43')](handleError(_0x1bc276,null));};exports[_0x58b5('0x2e')]=function(_0x23ce0b,_0x2b2ae7){return db['CmCompany'][_0x58b5('0x2e')]()[_0x58b5('0x28')](respondWithResult(_0x2b2ae7,null))[_0x58b5('0x43')](handleError(_0x2b2ae7,null));};exports['addContacts']=function(_0x2c942a,_0x205030,_0x5dcb64){return db[_0x58b5('0x53')][_0x58b5('0x46')]({'where':{'id':_0x2c942a[_0x58b5('0x44')]['id']}})[_0x58b5('0x28')](handleEntityNotFound(_0x205030,null))[_0x58b5('0x28')](function(_0x250e9e){if(_0x250e9e){return _0x250e9e[_0x58b5('0x54')](_0x2c942a['body'][_0x58b5('0x55')],_[_0x58b5('0x56')](_0x2c942a[_0x58b5('0x47')],[_0x58b5('0x55'),'id'])||{});}})[_0x58b5('0x28')](respondWithResult(_0x205030,null))[_0x58b5('0x43')](handleError(_0x205030,null));};exports[_0x58b5('0x57')]=function(_0xb162cd,_0x394ba6,_0x1030b1){var _0x3d0898={};var _0x2764e1={};var _0x29c7af;var _0x5eeb1d;return db['CmCompany'][_0x58b5('0x58')]({'where':{'id':_0xb162cd[_0x58b5('0x44')]['id']}})[_0x58b5('0x28')](handleEntityNotFound(_0x394ba6,null))[_0x58b5('0x28')](function(_0x5455bb){if(_0x5455bb){_0x29c7af=_0x5455bb;_0x2764e1[_0x58b5('0x2f')]=_[_0x58b5('0x30')](db['CmContact'][_0x58b5('0x45')]);_0x2764e1[_0x58b5('0x31')]=_[_0x58b5('0x30')](_0xb162cd[_0x58b5('0x31')]);_0x2764e1[_0x58b5('0x32')]=_[_0x58b5('0x33')](_0x2764e1[_0x58b5('0x2f')],_0x2764e1[_0x58b5('0x31')]);_0x3d0898[_0x58b5('0x35')]=_[_0x58b5('0x33')](_0x2764e1[_0x58b5('0x2f')],qs[_0x58b5('0x34')](_0xb162cd[_0x58b5('0x31')][_0x58b5('0x34')]));_0x3d0898['attributes']=_0x3d0898[_0x58b5('0x35')][_0x58b5('0x36')]?_0x3d0898[_0x58b5('0x35')]:_0x2764e1['model'];_0x3d0898['order']=qs['sort'](_0xb162cd[_0x58b5('0x31')]['sort']);_0x3d0898[_0x58b5('0x3a')]=qs['filters'](_['pick'](_0xb162cd[_0x58b5('0x31')],_0x2764e1['filters']));if(_0xb162cd[_0x58b5('0x31')][_0x58b5('0x3e')]){_0x3d0898[_0x58b5('0x3a')]=_[_0x58b5('0x3c')](_0x3d0898['where'],{'$or':_[_0x58b5('0x3d')](_0x3d0898['attributes'],function(_0x7b09cf){var _0x47e9d0={};_0x47e9d0[_0x7b09cf]={'$like':'%'+_0xb162cd[_0x58b5('0x31')][_0x58b5('0x3e')]+'%'};return _0x47e9d0;})});}_0x3d0898=_[_0x58b5('0x3c')]({},_0x3d0898,_0xb162cd[_0x58b5('0x3f')]);return _0x29c7af[_0x58b5('0x57')](_0x3d0898);}})[_0x58b5('0x28')](function(_0x2ac028){if(_0x2ac028){_0x5eeb1d=_0x2ac028[_0x58b5('0x36')];if(!_0xb162cd[_0x58b5('0x31')][_0x58b5('0x37')](_0x58b5('0x38'))){_0x3d0898['limit']=qs[_0x58b5('0x21')](_0xb162cd[_0x58b5('0x31')]['limit']);_0x3d0898[_0x58b5('0x20')]=qs[_0x58b5('0x20')](_0xb162cd[_0x58b5('0x31')]['offset']);}return _0x29c7af[_0x58b5('0x57')](_0x3d0898);}})['then'](function(_0x2e37a1){if(_0x2e37a1){return _0x2e37a1?{'count':_0x5eeb1d,'rows':_0x2e37a1}:null;}})['then'](respondWithResult(_0x394ba6,null))[_0x58b5('0x43')](handleError(_0x394ba6,null));}; \ No newline at end of file +var _0x7f87=['include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Companies','userProfileId','autoAssociation','error','addContacts','ids','getContacts','findOne','CmContact','order','sort','hasOwnProperty','nolimit','rimraf','request-promise','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','where','pick','filter','merge','map','options','includeAll'];(function(_0x392f67,_0x773cc4){var _0x5810d6=function(_0x1da556){while(--_0x1da556){_0x392f67['push'](_0x392f67['shift']());}};_0x5810d6(++_0x773cc4);}(_0x7f87,0x1f3));var _0x77f8=function(_0x4504e3,_0x5ad201){_0x4504e3=_0x4504e3-0x0;var _0x14ff39=_0x7f87[_0x4504e3];return _0x14ff39;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x77f8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77f8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x77f8('0x2'));var path=require(_0x77f8('0x3'));var sox=require('sox');var csv=require(_0x77f8('0x4'));var ejs=require(_0x77f8('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77f8('0x6'));var squel=require('squel');var crypto=require(_0x77f8('0x7'));var jsforce=require(_0x77f8('0x8'));var deskjs=require(_0x77f8('0x9'));var toCsv=require(_0x77f8('0x4'));var querystring=require(_0x77f8('0xa'));var Papa=require(_0x77f8('0xb'));var Redis=require('ioredis');var authService=require(_0x77f8('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x77f8('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x77f8('0xe'))('api');var utils=require('../../config/utils');var config=require(_0x77f8('0xf'));var licenseUtil=require(_0x77f8('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f6e76,_0x226aba){_0x226aba=_0x226aba||0xcc;return function(_0x1177a1){if(_0x1177a1){return _0x1f6e76[_0x77f8('0x11')](_0x226aba);}return _0x1f6e76['status'](_0x226aba)[_0x77f8('0x12')]();};}function respondWithResult(_0x4af0cb,_0x5ee51e){_0x5ee51e=_0x5ee51e||0xc8;return function(_0x523275){if(_0x523275){return _0x4af0cb['status'](_0x5ee51e)[_0x77f8('0x13')](_0x523275);}};}function respondWithFilteredResult(_0x459250,_0xbb7ab1){return function(_0x505e62){if(_0x505e62){var _0x4078de=typeof _0xbb7ab1['offset']===_0x77f8('0x14')&&typeof _0xbb7ab1[_0x77f8('0x15')]===_0x77f8('0x14');var _0xdb21a5=_0x505e62[_0x77f8('0x16')];var _0x5b9978=_0x4078de?0x0:_0xbb7ab1[_0x77f8('0x17')];var _0x41d888=_0x4078de?_0x505e62['count']:_0xbb7ab1['offset']+_0xbb7ab1[_0x77f8('0x15')];var _0x2e3e6d;if(_0x41d888>=_0xdb21a5){_0x41d888=_0xdb21a5;_0x2e3e6d=0xc8;}else{_0x2e3e6d=0xce;}_0x459250[_0x77f8('0x18')](_0x2e3e6d);return _0x459250[_0x77f8('0x19')](_0x77f8('0x1a'),_0x5b9978+'-'+_0x41d888+'/'+_0xdb21a5)[_0x77f8('0x13')](_0x505e62);}return null;};}function patchUpdates(_0x3430bf){return function(_0x4863c){try{jsonpatch[_0x77f8('0x1b')](_0x4863c,_0x3430bf,!![]);}catch(_0x3da338){return BPromise[_0x77f8('0x1c')](_0x3da338);}return _0x4863c[_0x77f8('0x1d')]();};}function saveUpdates(_0xa85a6d,_0x20dacf){return function(_0x35c7ca){if(_0x35c7ca){return _0x35c7ca[_0x77f8('0x1e')](_0xa85a6d)[_0x77f8('0x1f')](function(_0x318747){return _0x318747;});}return null;};}function removeEntity(_0x4e01d5,_0x17e8ed){return function(_0x23d56b){if(_0x23d56b){return _0x23d56b[_0x77f8('0x20')]()[_0x77f8('0x1f')](function(){var _0xbde72e=_0x23d56b['get']({'plain':!![]});var _0x22ce6f='Companies';return db[_0x77f8('0x21')][_0x77f8('0x20')]({'where':{'type':_0x22ce6f,'resourceId':_0xbde72e['id']}})['then'](function(){return _0x23d56b;});})[_0x77f8('0x1f')](function(){_0x4e01d5[_0x77f8('0x18')](0xcc)[_0x77f8('0x12')]();});}};}function handleEntityNotFound(_0x317692,_0x508bef){return function(_0x1f2ad2){if(!_0x1f2ad2){_0x317692['sendStatus'](0x194);}return _0x1f2ad2;};}function handleError(_0x5270a2,_0x5a5821){_0x5a5821=_0x5a5821||0x1f4;return function(_0x4fd59f){logger['error'](_0x4fd59f[_0x77f8('0x22')]);if(_0x4fd59f[_0x77f8('0x23')]){delete _0x4fd59f[_0x77f8('0x23')];}_0x5270a2[_0x77f8('0x18')](_0x5a5821)['send'](_0x4fd59f);};}exports[_0x77f8('0x24')]=function(_0x8ba89d,_0x4f15cc){var _0x5da118={},_0x1f1dcb={},_0x2c9ae7={'count':0x0,'rows':[]};return db[_0x77f8('0x25')][_0x77f8('0x26')]()[_0x77f8('0x1f')](function(_0x44d9c8){_0x1f1dcb[_0x77f8('0x27')]=_[_0x77f8('0x28')](_0x44d9c8);_0x1f1dcb[_0x77f8('0x29')]=_[_0x77f8('0x28')](_0x8ba89d[_0x77f8('0x29')]);_0x1f1dcb[_0x77f8('0x2a')]=_[_0x77f8('0x2b')](_0x1f1dcb['model'],_0x1f1dcb[_0x77f8('0x29')]);_0x5da118[_0x77f8('0x2c')]=_[_0x77f8('0x2b')](_0x1f1dcb['model'],qs[_0x77f8('0x2d')](_0x8ba89d[_0x77f8('0x29')][_0x77f8('0x2d')]));_0x5da118[_0x77f8('0x2c')]=_0x5da118[_0x77f8('0x2c')][_0x77f8('0x2e')]?_0x5da118['attributes']:_0x1f1dcb[_0x77f8('0x27')];if(!_0x8ba89d[_0x77f8('0x29')]['hasOwnProperty']('nolimit')){_0x5da118[_0x77f8('0x15')]=qs[_0x77f8('0x15')](_0x8ba89d[_0x77f8('0x29')][_0x77f8('0x15')]);_0x5da118[_0x77f8('0x17')]=qs[_0x77f8('0x17')](_0x8ba89d[_0x77f8('0x29')][_0x77f8('0x17')]);}_0x5da118['order']=qs['sort'](_0x8ba89d[_0x77f8('0x29')]['sort']);_0x5da118[_0x77f8('0x2f')]=qs[_0x77f8('0x2a')](_[_0x77f8('0x30')](_0x8ba89d[_0x77f8('0x29')],_0x1f1dcb[_0x77f8('0x2a')]),_0x44d9c8);if(_0x8ba89d[_0x77f8('0x29')][_0x77f8('0x31')]){_0x5da118[_0x77f8('0x2f')]=_[_0x77f8('0x32')](_0x5da118[_0x77f8('0x2f')],{'$or':_[_0x77f8('0x33')](_0x5da118[_0x77f8('0x2c')],function(_0x3a12fd){var _0x55c93a={};_0x55c93a[_0x3a12fd]={'$like':'%'+_0x8ba89d[_0x77f8('0x29')][_0x77f8('0x31')]+'%'};return _0x55c93a;})});}_0x5da118=_['merge']({},_0x5da118,_0x8ba89d[_0x77f8('0x34')]);var _0x5933b0={'where':_0x5da118[_0x77f8('0x2f')]};return db['CmCompany'][_0x77f8('0x16')](_0x5933b0)[_0x77f8('0x1f')](function(_0x53c66a){_0x2c9ae7[_0x77f8('0x16')]=_0x53c66a;if(_0x8ba89d[_0x77f8('0x29')][_0x77f8('0x35')]){_0x5da118[_0x77f8('0x36')]=[{'all':!![]}];}return db[_0x77f8('0x25')][_0x77f8('0x37')](_0x5da118);})[_0x77f8('0x1f')](function(_0x39869f){_0x2c9ae7[_0x77f8('0x38')]=_0x39869f;return _0x2c9ae7;})['then'](respondWithFilteredResult(_0x4f15cc,_0x5da118))[_0x77f8('0x39')](handleError(_0x4f15cc,null));})[_0x77f8('0x39')](handleError(_0x4f15cc,null));};exports[_0x77f8('0x3a')]=function(_0x65546b,_0x30de1f){var _0x98a4fd={'raw':![],'where':{'id':_0x65546b[_0x77f8('0x3b')]['id']}},_0x1d5076={};_0x1d5076[_0x77f8('0x27')]=_[_0x77f8('0x28')](db[_0x77f8('0x25')][_0x77f8('0x3c')]);_0x1d5076['query']=_[_0x77f8('0x28')](_0x65546b[_0x77f8('0x29')]);_0x1d5076[_0x77f8('0x2a')]=_['intersection'](_0x1d5076[_0x77f8('0x27')],_0x1d5076['query']);_0x98a4fd[_0x77f8('0x2c')]=_[_0x77f8('0x2b')](_0x1d5076[_0x77f8('0x27')],qs['fields'](_0x65546b[_0x77f8('0x29')][_0x77f8('0x2d')]));_0x98a4fd[_0x77f8('0x2c')]=_0x98a4fd[_0x77f8('0x2c')]['length']?_0x98a4fd[_0x77f8('0x2c')]:_0x1d5076[_0x77f8('0x27')];if(_0x65546b['query']['includeAll']){_0x98a4fd[_0x77f8('0x36')]=[{'all':!![]}];}_0x98a4fd=_[_0x77f8('0x32')]({},_0x98a4fd,_0x65546b['options']);return db['CmCompany'][_0x77f8('0x3d')](_0x98a4fd)[_0x77f8('0x1f')](handleEntityNotFound(_0x30de1f,null))['then'](respondWithResult(_0x30de1f,null))[_0x77f8('0x39')](handleError(_0x30de1f,null));};exports[_0x77f8('0x3e')]=function(_0xb84599,_0x14146a){return db['CmCompany']['create'](_0xb84599[_0x77f8('0x3f')],{})[_0x77f8('0x1f')](function(_0x6387fe){var _0x317e1a=_0xb84599[_0x77f8('0x40')][_0x77f8('0x41')]({'plain':!![]});if(!_0x317e1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x317e1a['role']===_0x77f8('0x40')){var _0x3e5bba=_0x6387fe[_0x77f8('0x41')]({'plain':!![]});var _0x5ef171=_0x77f8('0x42');return db['UserProfileSection']['find']({'where':{'name':_0x5ef171,'userProfileId':_0x317e1a[_0x77f8('0x43')]},'raw':!![]})['then'](function(_0x2b63c2){if(_0x2b63c2&&_0x2b63c2[_0x77f8('0x44')]===0x0){return db[_0x77f8('0x21')][_0x77f8('0x3e')]({'name':_0x3e5bba['name'],'resourceId':_0x3e5bba['id'],'type':_0x2b63c2[_0x77f8('0x23')],'sectionId':_0x2b63c2['id']},{})[_0x77f8('0x1f')](function(){return _0x6387fe;});}else{return _0x6387fe;}})[_0x77f8('0x39')](function(_0x25a6a9){logger[_0x77f8('0x45')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25a6a9);throw _0x25a6a9;});}return _0x6387fe;})['then'](respondWithResult(_0x14146a,0xc9))[_0x77f8('0x39')](handleError(_0x14146a,null));};exports['update']=function(_0x2f1f52,_0x3ad6cb){if(_0x2f1f52[_0x77f8('0x3f')]['id']){delete _0x2f1f52[_0x77f8('0x3f')]['id'];}return db['CmCompany'][_0x77f8('0x3d')]({'where':{'id':_0x2f1f52[_0x77f8('0x3b')]['id']}})[_0x77f8('0x1f')](handleEntityNotFound(_0x3ad6cb,null))['then'](saveUpdates(_0x2f1f52['body'],null))[_0x77f8('0x1f')](respondWithResult(_0x3ad6cb,null))[_0x77f8('0x39')](handleError(_0x3ad6cb,null));};exports[_0x77f8('0x20')]=function(_0x3fcdc0,_0x529af1){return db[_0x77f8('0x25')][_0x77f8('0x3d')]({'where':{'id':_0x3fcdc0[_0x77f8('0x3b')]['id']}})[_0x77f8('0x1f')](handleEntityNotFound(_0x529af1,null))[_0x77f8('0x1f')](removeEntity(_0x529af1,null))[_0x77f8('0x39')](handleError(_0x529af1,null));};exports[_0x77f8('0x26')]=function(_0x8166ce,_0x12c0d0){return db[_0x77f8('0x25')][_0x77f8('0x26')]()['then'](respondWithResult(_0x12c0d0,null))[_0x77f8('0x39')](handleError(_0x12c0d0,null));};exports[_0x77f8('0x46')]=function(_0x56c31f,_0xc9559,_0x1a2e12){return db['CmContact']['find']({'where':{'id':_0x56c31f['params']['id']}})[_0x77f8('0x1f')](handleEntityNotFound(_0xc9559,null))[_0x77f8('0x1f')](function(_0x416030){if(_0x416030){return _0x416030['addContacts'](_0x56c31f[_0x77f8('0x3f')][_0x77f8('0x47')],_['omit'](_0x56c31f[_0x77f8('0x3f')],[_0x77f8('0x47'),'id'])||{});}})[_0x77f8('0x1f')](respondWithResult(_0xc9559,null))[_0x77f8('0x39')](handleError(_0xc9559,null));};exports[_0x77f8('0x48')]=function(_0x2db575,_0x32fb34,_0x58e6ba){var _0x22a455={};var _0x464cb5={};var _0x556ea3;var _0x2f1299;return db[_0x77f8('0x25')][_0x77f8('0x49')]({'where':{'id':_0x2db575[_0x77f8('0x3b')]['id']}})[_0x77f8('0x1f')](handleEntityNotFound(_0x32fb34,null))[_0x77f8('0x1f')](function(_0x48736f){if(_0x48736f){_0x556ea3=_0x48736f;_0x464cb5[_0x77f8('0x27')]=_[_0x77f8('0x28')](db[_0x77f8('0x4a')][_0x77f8('0x3c')]);_0x464cb5[_0x77f8('0x29')]=_[_0x77f8('0x28')](_0x2db575[_0x77f8('0x29')]);_0x464cb5[_0x77f8('0x2a')]=_['intersection'](_0x464cb5['model'],_0x464cb5['query']);_0x22a455[_0x77f8('0x2c')]=_[_0x77f8('0x2b')](_0x464cb5[_0x77f8('0x27')],qs['fields'](_0x2db575[_0x77f8('0x29')][_0x77f8('0x2d')]));_0x22a455[_0x77f8('0x2c')]=_0x22a455['attributes'][_0x77f8('0x2e')]?_0x22a455[_0x77f8('0x2c')]:_0x464cb5[_0x77f8('0x27')];_0x22a455[_0x77f8('0x4b')]=qs[_0x77f8('0x4c')](_0x2db575[_0x77f8('0x29')]['sort']);_0x22a455[_0x77f8('0x2f')]=qs[_0x77f8('0x2a')](_[_0x77f8('0x30')](_0x2db575[_0x77f8('0x29')],_0x464cb5['filters']));if(_0x2db575['query'][_0x77f8('0x31')]){_0x22a455['where']=_[_0x77f8('0x32')](_0x22a455[_0x77f8('0x2f')],{'$or':_['map'](_0x22a455[_0x77f8('0x2c')],function(_0x5ede8e){var _0x4ce8c2={};_0x4ce8c2[_0x5ede8e]={'$like':'%'+_0x2db575[_0x77f8('0x29')][_0x77f8('0x31')]+'%'};return _0x4ce8c2;})});}_0x22a455=_['merge']({},_0x22a455,_0x2db575['options']);return _0x556ea3[_0x77f8('0x48')](_0x22a455);}})[_0x77f8('0x1f')](function(_0x4733a2){if(_0x4733a2){_0x2f1299=_0x4733a2[_0x77f8('0x2e')];if(!_0x2db575['query'][_0x77f8('0x4d')](_0x77f8('0x4e'))){_0x22a455[_0x77f8('0x15')]=qs[_0x77f8('0x15')](_0x2db575[_0x77f8('0x29')][_0x77f8('0x15')]);_0x22a455['offset']=qs[_0x77f8('0x17')](_0x2db575[_0x77f8('0x29')]['offset']);}return _0x556ea3[_0x77f8('0x48')](_0x22a455);}})[_0x77f8('0x1f')](function(_0x4fbd7e){if(_0x4fbd7e){return _0x4fbd7e?{'count':_0x2f1299,'rows':_0x4fbd7e}:null;}})[_0x77f8('0x1f')](respondWithResult(_0x32fb34,null))['catch'](handleError(_0x32fb34,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 82cc662..b764309 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 _0x5d7c=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x5d7c,0x1a1));var _0xc5d7=function(_0x7f971b,_0x32f797){_0x7f971b=_0x7f971b-0x0;var _0x16405f=_0x5d7c[_0x7f971b];return _0x16405f;};'use strict';var _=require(_0xc5d7('0x0'));var util=require(_0xc5d7('0x1'));var logger=require(_0xc5d7('0x2'))(_0xc5d7('0x3'));var moment=require('moment');var BPromise=require(_0xc5d7('0x4'));var rp=require(_0xc5d7('0x5'));var fs=require('fs');var path=require(_0xc5d7('0x6'));var rimraf=require(_0xc5d7('0x7'));var config=require(_0xc5d7('0x8'));var attributes=require('./cmCompany.attributes');module[_0xc5d7('0x9')]=function(_0xb5ca62,_0x2c14a6){return _0xb5ca62['define'](_0xc5d7('0xa'),attributes,{'tableName':_0xc5d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb37=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','lodash'];(function(_0x41dccc,_0x26f668){var _0xf1c161=function(_0xf36089){while(--_0xf36089){_0x41dccc['push'](_0x41dccc['shift']());}};_0xf1c161(++_0x26f668);}(_0xbb37,0xe6));var _0x7bb3=function(_0x29ed63,_0x3255c5){_0x29ed63=_0x29ed63-0x0;var _0x5e86c6=_0xbb37[_0x29ed63];return _0x5e86c6;};'use strict';var _=require(_0x7bb3('0x0'));var util=require('util');var logger=require(_0x7bb3('0x1'))('api');var moment=require(_0x7bb3('0x2'));var BPromise=require(_0x7bb3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bb3('0x4'));var rimraf=require(_0x7bb3('0x5'));var config=require(_0x7bb3('0x6'));var attributes=require(_0x7bb3('0x7'));module[_0x7bb3('0x8')]=function(_0x9f3353,_0x494b98){return _0x9f3353[_0x7bb3('0x9')](_0x7bb3('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 771fd56..e91b391 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 _0x2dc4=['result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x2dc4,0xb2));var _0x42dc=function(_0x238738,_0xeae3b6){_0x238738=_0x238738-0x0;var _0x46d76f=_0x2dc4[_0x238738];return _0x46d76f;};'use strict';var _=require(_0x42dc('0x0'));var util=require(_0x42dc('0x1'));var moment=require(_0x42dc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42dc('0x3'));var db=require(_0x42dc('0x4'))['db'];var utils=require(_0x42dc('0x5'));var logger=require(_0x42dc('0x6'))(_0x42dc('0x7'));var config=require('../../config/environment');var jayson=require(_0x42dc('0x8'));var client=jayson[_0x42dc('0x9')][_0x42dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38207b,_0x1e944b,_0xc5e862){return new BPromise(function(_0x229a4f,_0x5b1572){return client[_0x42dc('0xb')](_0x38207b,_0xc5e862)['then'](function(_0x200581){logger['info'](_0x42dc('0xc'),_0x1e944b,_0x42dc('0xd'));logger[_0x42dc('0xe')](_0x42dc('0xf'),_0x1e944b,'request\x20sent',JSON['stringify'](_0x200581));if(_0x200581[_0x42dc('0x10')]){if(_0x200581[_0x42dc('0x10')][_0x42dc('0x11')]===0x1f4){logger[_0x42dc('0x10')](_0x42dc('0xc'),_0x1e944b,_0x200581[_0x42dc('0x10')][_0x42dc('0x12')]);return _0x5b1572(_0x200581['error'][_0x42dc('0x12')]);}logger[_0x42dc('0x10')]('CmCompany,\x20%s,\x20%s',_0x1e944b,_0x200581[_0x42dc('0x10')][_0x42dc('0x12')]);return _0x229a4f(_0x200581[_0x42dc('0x10')][_0x42dc('0x12')]);}else{logger[_0x42dc('0x13')](_0x42dc('0xc'),_0x1e944b,_0x42dc('0xd'));_0x229a4f(_0x200581[_0x42dc('0x14')][_0x42dc('0x12')]);}})[_0x42dc('0x15')](function(_0x7f1a61){logger[_0x42dc('0x10')](_0x42dc('0xc'),_0x1e944b,_0x7f1a61);_0x5b1572(_0x7f1a61);});});} \ No newline at end of file +var _0x1c8c=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1c8c,0x100));var _0xc1c8=function(_0x16ceb5,_0x24dbf0){_0x16ceb5=_0x16ceb5-0x0;var _0x2ecd40=_0x1c8c[_0x16ceb5];return _0x2ecd40;};'use strict';var _=require(_0xc1c8('0x0'));var util=require(_0xc1c8('0x1'));var moment=require(_0xc1c8('0x2'));var BPromise=require(_0xc1c8('0x3'));var rs=require(_0xc1c8('0x4'));var fs=require('fs');var Redis=require(_0xc1c8('0x5'));var db=require(_0xc1c8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1c8('0x7'))(_0xc1c8('0x8'));var config=require('../../config/environment');var jayson=require(_0xc1c8('0x9'));var client=jayson[_0xc1c8('0xa')][_0xc1c8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1638c3,_0x18fdb8,_0x4291c3){return new BPromise(function(_0x29fe48,_0x32ec57){return client[_0xc1c8('0xc')](_0x1638c3,_0x4291c3)[_0xc1c8('0xd')](function(_0x243dc9){logger['info'](_0xc1c8('0xe'),_0x18fdb8,_0xc1c8('0xf'));logger[_0xc1c8('0x10')](_0xc1c8('0x11'),_0x18fdb8,_0xc1c8('0xf'),JSON[_0xc1c8('0x12')](_0x243dc9));if(_0x243dc9[_0xc1c8('0x13')]){if(_0x243dc9[_0xc1c8('0x13')][_0xc1c8('0x14')]===0x1f4){logger['error'](_0xc1c8('0xe'),_0x18fdb8,_0x243dc9['error']['message']);return _0x32ec57(_0x243dc9[_0xc1c8('0x13')][_0xc1c8('0x15')]);}logger[_0xc1c8('0x13')]('CmCompany,\x20%s,\x20%s',_0x18fdb8,_0x243dc9[_0xc1c8('0x13')][_0xc1c8('0x15')]);return _0x29fe48(_0x243dc9[_0xc1c8('0x13')][_0xc1c8('0x15')]);}else{logger[_0xc1c8('0x16')](_0xc1c8('0xe'),_0x18fdb8,_0xc1c8('0xf'));_0x29fe48(_0x243dc9[_0xc1c8('0x17')][_0xc1c8('0x15')]);}})[_0xc1c8('0x18')](function(_0xa8e10a){logger[_0xc1c8('0x13')](_0xc1c8('0xe'),_0x18fdb8,_0xa8e10a);_0x32ec57(_0xa8e10a);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 757d428..48f21fa 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 _0xcd6f=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xcd6f,0x1be));var _0xfcd6=function(_0x103316,_0x4b7261){_0x103316=_0x103316-0x0;var _0x55eaf3=_0xcd6f[_0x103316];return _0x55eaf3;};'use strict';var multer=require(_0xfcd6('0x0'));var util=require(_0xfcd6('0x1'));var path=require(_0xfcd6('0x2'));var timeout=require(_0xfcd6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfcd6('0x4'));var interaction=require(_0xfcd6('0x5'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0xfcd6('0x6')]('/',auth[_0xfcd6('0x7')](),controller[_0xfcd6('0x8')]);router[_0xfcd6('0x6')](_0xfcd6('0x9'),auth['isAuthenticated'](),controller[_0xfcd6('0xa')]);router[_0xfcd6('0x6')](_0xfcd6('0xb'),auth['isAuthenticated'](),controller[_0xfcd6('0xc')]);router[_0xfcd6('0x6')](_0xfcd6('0xd'),auth[_0xfcd6('0x7')](),controller[_0xfcd6('0xe')]);router[_0xfcd6('0xf')]('/',auth['isAuthenticated'](),controller[_0xfcd6('0x10')]);router[_0xfcd6('0xf')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0xfcd6('0x11')](_0xfcd6('0xb'),auth[_0xfcd6('0x7')](),controller[_0xfcd6('0x12')]);router[_0xfcd6('0x13')](_0xfcd6('0xb'),auth[_0xfcd6('0x7')](),controller[_0xfcd6('0x14')]);module[_0xfcd6('0x15')]=router; \ No newline at end of file +var _0xd4ee=['describe','show','/:id/contacts','getContacts','create','addContacts','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe'];(function(_0x80935e,_0x95043b){var _0x21693e=function(_0x168c05){while(--_0x168c05){_0x80935e['push'](_0x80935e['shift']());}};_0x21693e(++_0x95043b);}(_0xd4ee,0x1e6));var _0xed4e=function(_0x4434d7,_0x20ac5a){_0x4434d7=_0x4434d7-0x0;var _0x3bd620=_0xd4ee[_0x4434d7];return _0x3bd620;};'use strict';var multer=require(_0xed4e('0x0'));var util=require(_0xed4e('0x1'));var path=require(_0xed4e('0x2'));var timeout=require(_0xed4e('0x3'));var express=require(_0xed4e('0x4'));var router=express[_0xed4e('0x5')]();var fs_extra=require(_0xed4e('0x6'));var auth=require(_0xed4e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xed4e('0x8'));var controller=require(_0xed4e('0x9'));router[_0xed4e('0xa')]('/',auth[_0xed4e('0xb')](),controller[_0xed4e('0xc')]);router['get'](_0xed4e('0xd'),auth[_0xed4e('0xb')](),controller[_0xed4e('0xe')]);router['get']('/:id',auth[_0xed4e('0xb')](),controller[_0xed4e('0xf')]);router[_0xed4e('0xa')](_0xed4e('0x10'),auth['isAuthenticated'](),controller[_0xed4e('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xed4e('0x12')]);router['post'](_0xed4e('0x10'),auth[_0xed4e('0xb')](),controller[_0xed4e('0x13')]);router[_0xed4e('0x14')](_0xed4e('0x15'),auth[_0xed4e('0xb')](),controller['update']);router[_0xed4e('0x16')](_0xed4e('0x15'),auth[_0xed4e('0xb')](),controller[_0xed4e('0x17')]);module[_0xed4e('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 50705a4..05ffaed 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 _0x757a=['STRING','TEXT','INTEGER','UNSIGNED','DATE','sequelize','exports'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x757a,0xde));var _0xa757=function(_0x3319d6,_0x115301){_0x3319d6=_0x3319d6-0x0;var _0x586e19=_0x757a[_0x3319d6];return _0x586e19;};'use strict';var _=require('lodash');var Sequelize=require(_0xa757('0x0'));module[_0xa757('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xa757('0x2')]},'city':{'type':Sequelize[_0xa757('0x2')]},'country':{'type':Sequelize[_0xa757('0x2')]},'dateOfBirth':{'type':Sequelize[_0xa757('0x2')]},'description':{'type':Sequelize[_0xa757('0x3')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa757('0x2')]},'email':{'type':Sequelize[_0xa757('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xa757('0x2')]},'fb_data':{'type':Sequelize[_0xa757('0x2')]},'twitter':{'type':Sequelize[_0xa757('0x2')]},'skype':{'type':Sequelize[_0xa757('0x2')]},'teams':{'type':Sequelize[_0xa757('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xa757('0x2')]},'wechat':{'type':Sequelize[_0xa757('0x2')]},'telegram':{'type':Sequelize[_0xa757('0x2')]},'UserId':{'type':Sequelize[_0xa757('0x4')]},'priority':{'type':Sequelize[_0xa757('0x4')](0x2)[_0xa757('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa757('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbaf0=['DATE','NOW','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x4ab871,_0x19eb0a){var _0x27d796=function(_0x20119b){while(--_0x20119b){_0x4ab871['push'](_0x4ab871['shift']());}};_0x27d796(++_0x19eb0a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var Sequelize=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'firstName':{'type':Sequelize[_0x0baf('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0baf('0x2')]},'street':{'type':Sequelize[_0x0baf('0x2')]},'postalCode':{'type':Sequelize[_0x0baf('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0baf('0x2')]},'dateOfBirth':{'type':Sequelize[_0x0baf('0x2')]},'description':{'type':Sequelize[_0x0baf('0x3')]},'phone':{'type':Sequelize[_0x0baf('0x2')]},'mobile':{'type':Sequelize[_0x0baf('0x2')]},'fax':{'type':Sequelize[_0x0baf('0x2')]},'email':{'type':Sequelize[_0x0baf('0x2')]},'url':{'type':Sequelize[_0x0baf('0x2')]},'facebook':{'type':Sequelize[_0x0baf('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x0baf('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x0baf('0x2')]},'viber':{'type':Sequelize[_0x0baf('0x2')]},'line':{'type':Sequelize[_0x0baf('0x2')]},'wechat':{'type':Sequelize[_0x0baf('0x2')]},'telegram':{'type':Sequelize[_0x0baf('0x2')]},'UserId':{'type':Sequelize[_0x0baf('0x4')]},'priority':{'type':Sequelize[_0x0baf('0x4')](0x2)[_0x0baf('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':Sequelize[_0x0baf('0x7')]},'dialTimezone':{'type':Sequelize[_0x0baf('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 9504cf9..50794ce 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 _0x4e2f=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','CmContact','describe','keys','startsWith','cf_','push','CmCustomField','trimStart','all','length','fieldType','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','type','text','start','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','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','DESC','having','t.id\x20IN\x20?','resolve','user','agent','some','c.ListId\x20IS\x20NULL','role','toString','sequelize','keyBy','merge','c.firstName','c.mobile','c.fax','c.email','c.ListId','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','tags','findAll','columnName','displayName','alias','custom','body','get','mergeWith','join','info','[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','SmsMessage','FaxInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','timezones','utcOffset','each','duplicates','findOrCreate','spread','error','show','params','$and','omit','format','dialTimezone','pickBy','cf_%d','table','id\x20=\x20?','toParam','values','phone','CmHopper','getTags','findOne','rawAttributes','filters','setTags','ids','getHoppers','ContactId','options','includeAll','include','getHopperHistories','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','createReadStream','file','parse','meta','import','binding','No\x20phone\x20column\x20specified','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','pid','getJourney','mail','sms','openchannel','fax','whatsapp','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','starttime','endtime','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','findAndCountAll','fullname','chat','Account','note','thirdDisposition','Owner','customerPort','deviceModel','osName','ratingType','ratingValue','referer','substatus','externalUrl','threadId','flatten','sortBy','reverse','slice','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x59543b,_0x364e20){var _0x32ec92=function(_0x287728){while(--_0x287728){_0x59543b['push'](_0x59543b['shift']());}};_0x32ec92(++_0x364e20);}(_0x4e2f,0x11f));var _0xf4e2=function(_0x5b24b9,_0x11e150){_0x5b24b9=_0x5b24b9-0x0;var _0x4f4e4f=_0x4e2f[_0x5b24b9];return _0x4f4e4f;};'use strict';var emlformat=require(_0xf4e2('0x0'));var rimraf=require(_0xf4e2('0x1'));var zipdir=require(_0xf4e2('0x2'));var jsonpatch=require(_0xf4e2('0x3'));var rp=require(_0xf4e2('0x4'));var moment=require(_0xf4e2('0x5'));var BPromise=require(_0xf4e2('0x6'));var Mustache=require(_0xf4e2('0x7'));var util=require(_0xf4e2('0x8'));var path=require(_0xf4e2('0x9'));var sox=require(_0xf4e2('0xa'));var csv=require(_0xf4e2('0xb'));var ejs=require(_0xf4e2('0xc'));var fs=require('fs');var fs_extra=require(_0xf4e2('0xd'));var _=require(_0xf4e2('0xe'));var squel=require(_0xf4e2('0xf'));var crypto=require('crypto');var jsforce=require(_0xf4e2('0x10'));var deskjs=require(_0xf4e2('0x11'));var toCsv=require(_0xf4e2('0xb'));var querystring=require(_0xf4e2('0x12'));var Papa=require(_0xf4e2('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf4e2('0x14'));var as=require(_0xf4e2('0x15'));var hardwareService=require(_0xf4e2('0x16'));var logger=require(_0xf4e2('0x17'))('api');var utils=require(_0xf4e2('0x18'));var config=require(_0xf4e2('0x19'));var shared=require(_0xf4e2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf4e2('0x1b'))['db'];config[_0xf4e2('0x1c')]=_[_0xf4e2('0x1d')](config[_0xf4e2('0x1c')],{'host':_0xf4e2('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmContact.socket')[_0xf4e2('0x1f')](socket);function respondWithStatusCode(_0x1b782d,_0x50ae55){_0x50ae55=_0x50ae55||0xcc;return function(_0x31dba7){if(_0x31dba7){return _0x1b782d[_0xf4e2('0x20')](_0x50ae55);}return _0x1b782d[_0xf4e2('0x21')](_0x50ae55)[_0xf4e2('0x22')]();};}function respondWithResult(_0x168ac4,_0xf8b2e0){_0xf8b2e0=_0xf8b2e0||0xc8;return function(_0x488196){if(_0x488196){return _0x168ac4[_0xf4e2('0x21')](_0xf8b2e0)[_0xf4e2('0x23')](_0x488196);}};}function respondWithFilteredResult(_0x2f4a89,_0x10d4f3){return function(_0x2f172c){if(_0x2f172c){var _0x2a065f=typeof _0x10d4f3[_0xf4e2('0x24')]==='undefined'&&typeof _0x10d4f3['limit']===_0xf4e2('0x25');var _0x187a1e=_0x2f172c['count'];var _0x244ca5=_0x2a065f?0x0:_0x10d4f3['offset'];var _0x121e5d=_0x2a065f?_0x2f172c[_0xf4e2('0x26')]:_0x10d4f3[_0xf4e2('0x24')]+_0x10d4f3[_0xf4e2('0x27')];var _0x1f4dd0;if(_0x121e5d>=_0x187a1e){_0x121e5d=_0x187a1e;_0x1f4dd0=0xc8;}else{_0x1f4dd0=0xce;}_0x2f4a89[_0xf4e2('0x21')](_0x1f4dd0);return _0x2f4a89[_0xf4e2('0x28')](_0xf4e2('0x29'),_0x244ca5+'-'+_0x121e5d+'/'+_0x187a1e)[_0xf4e2('0x23')](_0x2f172c);}return null;};}function patchUpdates(_0x4eb870){return function(_0x20ccb5){try{jsonpatch['apply'](_0x20ccb5,_0x4eb870,!![]);}catch(_0x4414fb){return BPromise[_0xf4e2('0x2a')](_0x4414fb);}return _0x20ccb5[_0xf4e2('0x2b')]();};}function saveUpdates(_0xeee80e,_0x58f667){return function(_0x4184af){if(_0x4184af){return _0x4184af[_0xf4e2('0x2c')](_0xeee80e)[_0xf4e2('0x2d')](function(_0x3aef86){return _0x3aef86;});}return null;};}function removeEntity(_0x387c2d,_0x3443c1){return function(_0x3c5ae1){if(_0x3c5ae1){return _0x3c5ae1[_0xf4e2('0x2e')]()['then'](function(){_0x387c2d[_0xf4e2('0x21')](0xcc)[_0xf4e2('0x22')]();});}};}function handleEntityNotFound(_0x4c89a3,_0x34de55){return function(_0x22af92){if(!_0x22af92){_0x4c89a3[_0xf4e2('0x20')](0x194);}return _0x22af92;};}function handleError(_0x325999,_0x38d4de){_0x38d4de=_0x38d4de||0x1f4;return function(_0x5a1298){logger['error'](_0x5a1298[_0xf4e2('0x2f')]);if(_0x5a1298[_0xf4e2('0x30')]){delete _0x5a1298['name'];}_0x325999[_0xf4e2('0x21')](_0x38d4de)[_0xf4e2('0x31')](_0x5a1298);};}exports[_0xf4e2('0x32')]=function(_0x40dcb4,_0x5b4863){var _0x6f7825={},_0x113376={},_0x16ea63={'count':0x0,'rows':[]};return db[_0xf4e2('0x33')][_0xf4e2('0x34')]()[_0xf4e2('0x2d')](function(_0x231ae0){var _0x307984=[];for(var _0x3573b9=0x0;_0x3573b90x1){_0x678937['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf4e2('0x76')](_0x38eaac),null);}else{if(qs[_0xf4e2('0x77')](_0x38eaac)){_0x678937['or'](_0xf4e2('0x78'),_0x38eaac+'%');_0x678937['or'](_0xf4e2('0x79'),_0x38eaac+'%');_0x678937['or'](_0xf4e2('0x7a'),_0x38eaac+'%');_0x678937['or'](_0xf4e2('0x7b'),_0x38eaac+'%');}else if(qs[_0xf4e2('0x7c')](_0x38eaac)){_0x678937['or'](_0xf4e2('0x7d'),_0x38eaac+'%');}else{_0x678937['or'](_0xf4e2('0x7e'),'%'+_0x38eaac+'%');_0x678937['or'](_0xf4e2('0x7f'),'%'+_0x38eaac+'%');_0x678937['or'](_0xf4e2('0x7d'),'%'+_0x38eaac+'%');}}}}_0x316079[_0xf4e2('0x47')](_0x678937);_0x316079[_0xf4e2('0x80')](_0xf4e2('0x81'));var _0x2d1b3e={'type':db[_0xf4e2('0x82')][_0xf4e2('0x83')][_0xf4e2('0x84')],'raw':!![]};var _0x25aa75=_0x316079[_0xf4e2('0x85')]()['field'](_0xf4e2('0x81'));if(_0x6f7825['order']){_0x6f7825[_0xf4e2('0x45')][_0xf4e2('0x5c')](function(_0x4b58d4){_0x316079[_0xf4e2('0x45')]('c.'+_0x4b58d4[0x0],_0x4b58d4[0x1]===_0xf4e2('0x86')?![]:!![]);});}if(!_[_0xf4e2('0x6d')](_0x540f18)){_0x316079[_0xf4e2('0x87')](_0x4c20ef);_0x25aa75[_0xf4e2('0x47')](_0xf4e2('0x88'),_0x540f18);}BPromise[_0xf4e2('0x89')]()[_0xf4e2('0x2d')](function(){if(!_0x2cdf23)return;if(_0x40dcb4[_0xf4e2('0x8a')]['role']!==_0xf4e2('0x8b'))return;if(!_[_0xf4e2('0x8c')](_0x2cdf23[_0xf4e2('0x56')],['field','User'])){return _0x40dcb4['user']['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x33f51c){if(_[_0xf4e2('0x6d')](_0x33f51c)){_0x25aa75['where'](_0xf4e2('0x8d'));_0x316079[_0xf4e2('0x47')](_0xf4e2('0x8d'));}else{_0x25aa75[_0xf4e2('0x47')](_0xf4e2('0x6f'),_[_0xf4e2('0x5b')](_0x33f51c,'id'));_0x316079[_0xf4e2('0x47')](_0xf4e2('0x6f'),_[_0xf4e2('0x5b')](_0x33f51c,'id'));}});}})[_0xf4e2('0x2d')](function(){if(_0x40dcb4['user'][_0xf4e2('0x8e')]==='agent'&&!_0x2cdf23&&!_0x40dcb4[_0xf4e2('0x3f')][_0xf4e2('0x6e')])return[];return db['sequelize'][_0xf4e2('0x3f')](_0x25aa75[_0xf4e2('0x8f')](),_0x2d1b3e);})[_0xf4e2('0x2d')](function(_0x25408c){_0x16ea63[_0xf4e2('0x26')]=_0x25408c['length'];if(_0x16ea63[_0xf4e2('0x26')]===0x0)return[];return db[_0xf4e2('0x90')]['query'](_0x5ef21f[_0xf4e2('0x8f')](),_0x2d1b3e)[_0xf4e2('0x2d')](function(_0x29f5b7){_0x367560=_[_0xf4e2('0x91')](_0x29f5b7,'id');_0x2d1b3e=_[_0xf4e2('0x92')](_0x2d1b3e,{'model':db[_0xf4e2('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40dcb4['query'][_0xf4e2('0x42')]){_0x6f7825['attributes'][_0xf4e2('0x5c')](function(_0x53d1d5){_0x316079[_0xf4e2('0x4a')]('c.'+_0x53d1d5);});}else{_0x316079[_0xf4e2('0x4a')](_0xf4e2('0x81'));_0x316079[_0xf4e2('0x4a')](_0xf4e2('0x93'));_0x316079[_0xf4e2('0x4a')]('c.lastName');_0x316079['field']('c.phone');_0x316079['field'](_0xf4e2('0x94'));_0x316079['field'](_0xf4e2('0x95'));_0x316079[_0xf4e2('0x4a')](_0xf4e2('0x96'));_0x316079[_0xf4e2('0x4a')](_0xf4e2('0x97'));_0x316079[_0xf4e2('0x4a')]('c.createdAt');_0x316079[_0xf4e2('0x4a')]('c.deletedAt');_0x316079['field'](_0xf4e2('0x98'));_0x316079[_0xf4e2('0x4a')](_0xf4e2('0x99'),_0xf4e2('0x9a'));}if(_0x6f7825[_0xf4e2('0x27')])_0x316079['limit'](_0x6f7825[_0xf4e2('0x27')]);if(_0x6f7825['offset'])_0x316079[_0xf4e2('0x24')](_0x6f7825[_0xf4e2('0x24')]);return db[_0xf4e2('0x90')][_0xf4e2('0x3f')](_0x316079['toString'](),_0x2d1b3e);});})[_0xf4e2('0x2d')](function(_0x4f308f){_0x4f308f[_0xf4e2('0x5c')](function(_0x271e06){if(_0x271e06['TagIds']){_0x271e06['Tags']=[];_0x271e06[_0xf4e2('0x9a')][_0xf4e2('0x5a')](',')['forEach'](function(_0x4946e8){_0x271e06[_0xf4e2('0x9b')][_0xf4e2('0x38')](_0x367560[_0x4946e8]);});}delete _0x271e06['TagIds'];});_0x16ea63[_0xf4e2('0x9c')]=_0x4f308f;return _0x16ea63;})[_0xf4e2('0x2d')](respondWithFilteredResult(_0x5b4863,_0x6f7825));})['catch'](handleError(_0x5b4863,null));};exports[_0xf4e2('0x2e')]=function(_0x44441b,_0x4b8a6c){return db[_0xf4e2('0x33')][_0xf4e2('0x57')]({'where':{'id':_0x44441b['params']['id']}})[_0xf4e2('0x2d')](handleEntityNotFound(_0x4b8a6c,null))['then'](removeEntity(_0x4b8a6c,null))[_0xf4e2('0x9d')](handleError(_0x4b8a6c,null));};exports[_0xf4e2('0x34')]=function(_0x2c8860,_0x2ea92b){return db[_0xf4e2('0x33')][_0xf4e2('0x34')]()[_0xf4e2('0x2d')](function(_0x532e19){delete _0x532e19[_0xf4e2('0x9e')];for(var _0x5a66b0=0x0;_0x5a66b0=_0x5529db){_0x40cf5e=_0x5529db;_0x214c54=0xc8;}else{_0x214c54=0xce;}_0x9b9cf8[_0x5a3f('0x1e')](_0x214c54);return _0x9b9cf8[_0x5a3f('0x24')](_0x5a3f('0x25'),_0x26c0b0+'-'+_0x40cf5e+'/'+_0x5529db)[_0x5a3f('0x20')](_0xe9925e);}return null;};}function patchUpdates(_0x33027a){return function(_0x9c081c){try{jsonpatch[_0x5a3f('0x26')](_0x9c081c,_0x33027a,!![]);}catch(_0x37dbc1){return BPromise['reject'](_0x37dbc1);}return _0x9c081c[_0x5a3f('0x27')]();};}function saveUpdates(_0x30202e,_0x1c86b6){return function(_0x5cbc16){if(_0x5cbc16){return _0x5cbc16[_0x5a3f('0x28')](_0x30202e)[_0x5a3f('0x29')](function(_0x94bf77){return _0x94bf77;});}return null;};}function removeEntity(_0xf03011,_0x22e74c){return function(_0x38b24d){if(_0x38b24d){return _0x38b24d[_0x5a3f('0x2a')]()['then'](function(){_0xf03011[_0x5a3f('0x1e')](0xcc)[_0x5a3f('0x1f')]();});}};}function handleEntityNotFound(_0x23a172,_0x2a145d){return function(_0x29ccfe){if(!_0x29ccfe){_0x23a172[_0x5a3f('0x1d')](0x194);}return _0x29ccfe;};}function handleError(_0x1dfcaf,_0x1afd9f){_0x1afd9f=_0x1afd9f||0x1f4;return function(_0x1003e4){logger[_0x5a3f('0x2b')](_0x1003e4[_0x5a3f('0x2c')]);if(_0x1003e4[_0x5a3f('0x2d')]){delete _0x1003e4[_0x5a3f('0x2d')];}_0x1dfcaf[_0x5a3f('0x1e')](_0x1afd9f)[_0x5a3f('0x2e')](_0x1003e4);};}exports['index']=function(_0x290ec1,_0x1cc228){var _0xaeb95a={},_0x2f6802={},_0x538593={'count':0x0,'rows':[]};return db[_0x5a3f('0x2f')][_0x5a3f('0x30')]()[_0x5a3f('0x29')](function(_0x4a2c6c){var _0x34f15e=[];for(var _0x12b162=0x0;_0x12b1620x1){_0x77f8c3['or'](_0x5a3f('0x74'),qs[_0x5a3f('0x75')](_0x6ec084),null);}else{if(qs[_0x5a3f('0x76')](_0x6ec084)){_0x77f8c3['or'](_0x5a3f('0x77'),_0x6ec084+'%');_0x77f8c3['or'](_0x5a3f('0x78'),_0x6ec084+'%');_0x77f8c3['or'](_0x5a3f('0x79'),_0x6ec084+'%');_0x77f8c3['or'](_0x5a3f('0x7a'),_0x6ec084+'%');}else if(qs[_0x5a3f('0x7b')](_0x6ec084)){_0x77f8c3['or'](_0x5a3f('0x7c'),_0x6ec084+'%');}else{_0x77f8c3['or']('c.firstName\x20LIKE\x20?','%'+_0x6ec084+'%');_0x77f8c3['or'](_0x5a3f('0x7d'),'%'+_0x6ec084+'%');_0x77f8c3['or'](_0x5a3f('0x7c'),'%'+_0x6ec084+'%');}}}}_0x35f772[_0x5a3f('0x6c')](_0x77f8c3);_0x35f772['group'](_0x5a3f('0x7e'));var _0x57fa83={'type':db[_0x5a3f('0x7f')]['QueryTypes'][_0x5a3f('0x80')],'raw':!![]};var _0x590912=_0x35f772[_0x5a3f('0x81')]()[_0x5a3f('0x46')]('c.id');if(_0xaeb95a[_0x5a3f('0x43')]){_0xaeb95a[_0x5a3f('0x43')][_0x5a3f('0x5b')](function(_0x361982){_0x35f772[_0x5a3f('0x43')]('c.'+_0x361982[0x0],_0x361982[0x1]===_0x5a3f('0x82')?![]:!![]);});}if(!_[_0x5a3f('0x83')](_0x5ef697)){_0x35f772[_0x5a3f('0x84')](_0x27a69b);_0x590912['where'](_0x5a3f('0x85'),_0x5ef697);}BPromise['resolve']()['then'](function(){if(!_0x4b6cbd)return;if(_0x290ec1[_0x5a3f('0x86')][_0x5a3f('0x87')]!=='agent')return;if(!_[_0x5a3f('0x88')](_0x4b6cbd['conditions'],[_0x5a3f('0x46'),_0x5a3f('0x5e')])){return _0x290ec1[_0x5a3f('0x86')][_0x5a3f('0x89')]({'attributes':['id'],'raw':!![]})[_0x5a3f('0x29')](function(_0x993c21){if(_['isEmpty'](_0x993c21)){_0x590912[_0x5a3f('0x6c')](_0x5a3f('0x8a'));_0x35f772[_0x5a3f('0x6c')]('c.ListId\x20IS\x20NULL');}else{_0x590912[_0x5a3f('0x6c')](_0x5a3f('0x6d'),_[_0x5a3f('0x5a')](_0x993c21,'id'));_0x35f772['where']('c.ListId\x20IN\x20?',_[_0x5a3f('0x5a')](_0x993c21,'id'));}});}})[_0x5a3f('0x29')](function(){if(_0x290ec1[_0x5a3f('0x86')]['role']==='agent'&&!_0x4b6cbd&&!_0x290ec1['query'][_0x5a3f('0x6b')])return[];return db[_0x5a3f('0x8b')][_0x5a3f('0x3c')](_0x590912[_0x5a3f('0x8c')](),_0x57fa83);})[_0x5a3f('0x29')](function(_0x46227c){_0x538593['count']=_0x46227c[_0x5a3f('0x32')];if(_0x538593[_0x5a3f('0x8d')]===0x0)return[];return db['sequelize'][_0x5a3f('0x3c')](_0x4ee538['toString'](),_0x57fa83)['then'](function(_0x2ba0da){_0x2e1ada=_[_0x5a3f('0x8e')](_0x2ba0da,'id');_0x57fa83=_[_0x5a3f('0x8f')](_0x57fa83,{'model':db[_0x5a3f('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x290ec1[_0x5a3f('0x3c')][_0x5a3f('0x40')]){_0xaeb95a['attributes'][_0x5a3f('0x5b')](function(_0x325adf){_0x35f772[_0x5a3f('0x46')]('c.'+_0x325adf);});}else{_0x35f772[_0x5a3f('0x46')]('c.id');_0x35f772[_0x5a3f('0x46')](_0x5a3f('0x90'));_0x35f772[_0x5a3f('0x46')]('c.lastName');_0x35f772[_0x5a3f('0x46')](_0x5a3f('0x91'));_0x35f772[_0x5a3f('0x46')]('c.mobile');_0x35f772['field']('c.fax');_0x35f772[_0x5a3f('0x46')](_0x5a3f('0x92'));_0x35f772['field'](_0x5a3f('0x93'));_0x35f772['field']('c.createdAt');_0x35f772[_0x5a3f('0x46')]('c.deletedAt');_0x35f772[_0x5a3f('0x46')](_0x5a3f('0x94'));_0x35f772[_0x5a3f('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5a3f('0x95'));}if(_0xaeb95a[_0x5a3f('0x23')])_0x35f772[_0x5a3f('0x23')](_0xaeb95a[_0x5a3f('0x23')]);if(_0xaeb95a[_0x5a3f('0x21')])_0x35f772[_0x5a3f('0x21')](_0xaeb95a[_0x5a3f('0x21')]);return db[_0x5a3f('0x8b')][_0x5a3f('0x3c')](_0x35f772[_0x5a3f('0x8c')](),_0x57fa83);});})[_0x5a3f('0x29')](function(_0x4b297e){_0x4b297e[_0x5a3f('0x5b')](function(_0x568ced){if(_0x568ced[_0x5a3f('0x95')]){_0x568ced['Tags']=[];_0x568ced[_0x5a3f('0x95')][_0x5a3f('0x59')](',')[_0x5a3f('0x5b')](function(_0x160746){_0x568ced['Tags'][_0x5a3f('0x35')](_0x2e1ada[_0x160746]);});}delete _0x568ced['TagIds'];});_0x538593[_0x5a3f('0x96')]=_0x4b297e;return _0x538593;})[_0x5a3f('0x29')](respondWithFilteredResult(_0x1cc228,_0xaeb95a));})[_0x5a3f('0x97')](handleError(_0x1cc228,null));};exports['destroy']=function(_0xcdcdd0,_0x35fdd9){return db[_0x5a3f('0x2f')][_0x5a3f('0x57')]({'where':{'id':_0xcdcdd0['params']['id']}})['then'](handleEntityNotFound(_0x35fdd9,null))[_0x5a3f('0x29')](removeEntity(_0x35fdd9,null))[_0x5a3f('0x97')](handleError(_0x35fdd9,null));};exports['describe']=function(_0xf501c0,_0x2ec880){return db['CmContact'][_0x5a3f('0x30')]()[_0x5a3f('0x29')](function(_0x5c75e5){delete _0x5c75e5[_0x5a3f('0x98')];for(var _0x1ba408=0x0;_0x1ba408{}\s\\|]/g,'-');_0xc5e554(null,util[_0x8eef('0x1f')](_0x8eef('0x20'),path['basename'](_0x1e6c5f[_0x8eef('0x1d')],path[_0x8eef('0x21')](_0x1e6c5f[_0x8eef('0x1d')])),Date['now'](),path[_0x8eef('0x21')](_0x1e6c5f[_0x8eef('0x1d')])));}})});router['post'](_0x8eef('0x22'),upload[_0x8eef('0x23')](_0x8eef('0x24')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x8eef('0x1c')]({'destination':function(_0x400b4c,_0x5c79d3,_0x37e856){_0x37e856(null,path[_0x8eef('0x25')](config[_0x8eef('0x26')],_0x8eef('0x27')));},'filename':function(_0xcfb1a1,_0x4d8546,_0x1261d4){_0x4d8546[_0x8eef('0x1d')]=_0x4d8546['originalname'][_0x8eef('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1261d4(null,util[_0x8eef('0x1f')](_0x8eef('0x20'),path[_0x8eef('0x28')](_0x4d8546[_0x8eef('0x1d')],path[_0x8eef('0x21')](_0x4d8546['originalname'])),Date[_0x8eef('0x29')](),path['extname'](_0x4d8546['originalname'])));}})});router[_0x8eef('0x18')]('/upload',upload['single'](_0x8eef('0x24')),controller['upload']);router[_0x8eef('0x18')]('/upload/:id',auth[_0x8eef('0x9')](),controller['import']);router[_0x8eef('0x2a')]('/:id',auth[_0x8eef('0x9')](),controller[_0x8eef('0x2b')]);router[_0x8eef('0x2c')]('/:id',auth[_0x8eef('0x9')](),controller[_0x8eef('0x2d')]);module[_0x8eef('0x2e')]=router; \ No newline at end of file +var _0xa7d8=['Router','../../components/interaction/service','../../config/environment','./cmContact.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/tags','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getJscriptySessions','/:id/journey','post','/merge','merge','create','bulkCreate','diskStorage','join','server/files/tmp','originalname','replace','format','%s-%s%s','extname','now','/csv','single','file','root','basename','/upload','/upload/:id','import','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x382a6a,_0x184324){var _0x2f7b6b=function(_0x4cc0b7){while(--_0x4cc0b7){_0x382a6a['push'](_0x382a6a['shift']());}};_0x2f7b6b(++_0x184324);}(_0xa7d8,0xbb));var _0x8a7d=function(_0x3758c5,_0x2fb7ee){_0x3758c5=_0x3758c5-0x0;var _0x277ee9=_0xa7d8[_0x3758c5];return _0x277ee9;};'use strict';var multer=require(_0x8a7d('0x0'));var util=require(_0x8a7d('0x1'));var path=require(_0x8a7d('0x2'));var timeout=require(_0x8a7d('0x3'));var express=require(_0x8a7d('0x4'));var router=express[_0x8a7d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8a7d('0x6'));var config=require(_0x8a7d('0x7'));var controller=require(_0x8a7d('0x8'));router['get']('/',auth[_0x8a7d('0x9')](),controller[_0x8a7d('0xa')]);router[_0x8a7d('0xb')](_0x8a7d('0xc'),auth[_0x8a7d('0x9')](),controller[_0x8a7d('0xd')]);router[_0x8a7d('0xb')](_0x8a7d('0xe'),auth[_0x8a7d('0x9')](),controller[_0x8a7d('0xf')]);router[_0x8a7d('0xb')](_0x8a7d('0x10'),auth[_0x8a7d('0x9')](),controller['getTags']);router['get']('/:id/hoppers',auth[_0x8a7d('0x9')](),controller[_0x8a7d('0x11')]);router[_0x8a7d('0xb')](_0x8a7d('0x12'),auth[_0x8a7d('0x9')](),controller['getHopperHistories']);router['get'](_0x8a7d('0x13'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x8a7d('0xb')]('/:id/jscripty_sessions',auth[_0x8a7d('0x9')](),controller[_0x8a7d('0x14')]);router['get'](_0x8a7d('0x15'),auth[_0x8a7d('0x9')](),controller['getJourney']);router[_0x8a7d('0x16')](_0x8a7d('0x17'),auth['isAuthenticated'](),controller[_0x8a7d('0x18')]);router[_0x8a7d('0x16')]('/',auth[_0x8a7d('0x9')](),controller[_0x8a7d('0x19')]);router[_0x8a7d('0x16')]('/create_many',auth[_0x8a7d('0x9')](),controller[_0x8a7d('0x1a')]);router[_0x8a7d('0x16')](_0x8a7d('0x10'),auth[_0x8a7d('0x9')](),controller['setTags']);var upload=multer({'storage':multer[_0x8a7d('0x1b')]({'destination':function(_0x18f66c,_0x2b0103,_0x575894){_0x575894(null,path[_0x8a7d('0x1c')](config['root'],_0x8a7d('0x1d')));},'filename':function(_0x3b413a,_0x25b484,_0x4a9082){_0x25b484[_0x8a7d('0x1e')]=_0x25b484[_0x8a7d('0x1e')][_0x8a7d('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4a9082(null,util[_0x8a7d('0x20')](_0x8a7d('0x21'),path['basename'](_0x25b484[_0x8a7d('0x1e')],path[_0x8a7d('0x22')](_0x25b484[_0x8a7d('0x1e')])),Date[_0x8a7d('0x23')](),path[_0x8a7d('0x22')](_0x25b484[_0x8a7d('0x1e')])));}})});router[_0x8a7d('0x16')](_0x8a7d('0x24'),upload[_0x8a7d('0x25')](_0x8a7d('0x26')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x8a7d('0x1b')]({'destination':function(_0x1725fa,_0x23f497,_0x1b8c81){_0x1b8c81(null,path[_0x8a7d('0x1c')](config[_0x8a7d('0x27')],_0x8a7d('0x1d')));},'filename':function(_0x2507b7,_0x24d718,_0x21029f){_0x24d718['originalname']=_0x24d718[_0x8a7d('0x1e')][_0x8a7d('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x21029f(null,util[_0x8a7d('0x20')](_0x8a7d('0x21'),path[_0x8a7d('0x28')](_0x24d718[_0x8a7d('0x1e')],path[_0x8a7d('0x22')](_0x24d718[_0x8a7d('0x1e')])),Date[_0x8a7d('0x23')](),path[_0x8a7d('0x22')](_0x24d718[_0x8a7d('0x1e')])));}})});router[_0x8a7d('0x16')](_0x8a7d('0x29'),upload[_0x8a7d('0x25')](_0x8a7d('0x26')),controller['upload']);router[_0x8a7d('0x16')](_0x8a7d('0x2a'),auth[_0x8a7d('0x9')](),controller[_0x8a7d('0x2b')]);router['put'](_0x8a7d('0xe'),auth[_0x8a7d('0x9')](),controller[_0x8a7d('0x2c')]);router[_0x8a7d('0x2d')]('/:id',auth[_0x8a7d('0x9')](),controller[_0x8a7d('0x2e')]);module[_0x8a7d('0x2f')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index eda3375..9131979 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 _0x80d0=['alias','STRING','setDataValue','getDataValue','name','TEXT','long','type','select','parse','isArray','values','stringify','BOOLEAN','voice','lodash','exports'];(function(_0x98b7de,_0x19e558){var _0x5127a1=function(_0x3de529){while(--_0x3de529){_0x98b7de['push'](_0x98b7de['shift']());}};_0x5127a1(++_0x19e558);}(_0x80d0,0x64));var _0x080d=function(_0x3cf473,_0x590b7a){_0x3cf473=_0x3cf473-0x0;var _0xe5ae76=_0x80d0[_0x3cf473];return _0xe5ae76;};'use strict';var Sequelize=require('sequelize');var _=require(_0x080d('0x0'));module[_0x080d('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5aeae6){return this['getDataValue'](_0x080d('0x2'));}},'alias':{'type':Sequelize[_0x080d('0x3')],'allowNull':![],'set':function(_0x2a0ace){this[_0x080d('0x4')]('alias',_0x2a0ace?_0x2a0ace:this[_0x080d('0x5')](_0x080d('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x080d('0x7')](_0x080d('0x8')),'get':function(){if(this[_0x080d('0x5')](_0x080d('0x9'))===_0x080d('0xa')){return JSON[_0x080d('0xb')](this[_0x080d('0x5')]('values'));}else{return this[_0x080d('0x5')]('values');}},'set':function(_0x2e266b){if(Array[_0x080d('0xc')](_0x2e266b)){this[_0x080d('0x4')](_0x080d('0xd'),JSON[_0x080d('0xe')](_0x2e266b));}else{this['setDataValue']('values',_0x2e266b);}}},'required':{'type':Sequelize[_0x080d('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x080d('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x080d('0x10'))}}; \ No newline at end of file +var _0xa2a3=['ENUM','voice','sequelize','lodash','alias','STRING','setDataValue','getDataValue','TEXT','type','select','parse','values','stringify','BOOLEAN'];(function(_0x5b3e86,_0x1bdd3a){var _0x5170f6=function(_0xff5c99){while(--_0xff5c99){_0x5b3e86['push'](_0x5b3e86['shift']());}};_0x5170f6(++_0x1bdd3a);}(_0xa2a3,0x89));var _0x3a2a=function(_0x349080,_0x485b71){_0x349080=_0x349080-0x0;var _0x1ef849=_0xa2a3[_0x349080];return _0x1ef849;};'use strict';var Sequelize=require(_0x3a2a('0x0'));var _=require(_0x3a2a('0x1'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2cd7eb){return this['getDataValue'](_0x3a2a('0x2'));}},'alias':{'type':Sequelize[_0x3a2a('0x3')],'allowNull':![],'set':function(_0x143e20){this[_0x3a2a('0x4')](_0x3a2a('0x2'),_0x143e20?_0x143e20:this[_0x3a2a('0x5')]('name'));}},'type':{'type':Sequelize[_0x3a2a('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x3a2a('0x6')]('long'),'get':function(){if(this['getDataValue'](_0x3a2a('0x7'))===_0x3a2a('0x8')){return JSON[_0x3a2a('0x9')](this['getDataValue'](_0x3a2a('0xa')));}else{return this['getDataValue'](_0x3a2a('0xa'));}},'set':function(_0x1abc08){if(Array['isArray'](_0x1abc08)){this[_0x3a2a('0x4')](_0x3a2a('0xa'),JSON[_0x3a2a('0xb')](_0x1abc08));}else{this[_0x3a2a('0x4')](_0x3a2a('0xa'),_0x1abc08);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x3a2a('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x3a2a('0xd')](_0x3a2a('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index f32c8bd..69a25ce 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 _0xe57b=['set','Content-Range','json','apply','reject','save','then','destroy','stack','type','key','model','differenceBy','map','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','CmCustomField','findAll','rows','catch','params','include','options','find','update','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x3ae17d,_0x3394e1){var _0x1ddc96=function(_0x79ed47){while(--_0x79ed47){_0x3ae17d['push'](_0x3ae17d['shift']());}};_0x1ddc96(++_0x3394e1);}(_0xe57b,0x13b));var _0xbe57=function(_0x3e1563,_0x468b91){_0x3e1563=_0x3e1563-0x0;var _0x18ce06=_0xe57b[_0x3e1563];return _0x18ce06;};'use strict';var emlformat=require(_0xbe57('0x0'));var rimraf=require(_0xbe57('0x1'));var zipdir=require(_0xbe57('0x2'));var jsonpatch=require(_0xbe57('0x3'));var rp=require(_0xbe57('0x4'));var moment=require(_0xbe57('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbe57('0x6'));var util=require(_0xbe57('0x7'));var path=require('path');var sox=require(_0xbe57('0x8'));var csv=require(_0xbe57('0x9'));var ejs=require(_0xbe57('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe57('0xb'));var squel=require(_0xbe57('0xc'));var crypto=require(_0xbe57('0xd'));var jsforce=require(_0xbe57('0xe'));var deskjs=require(_0xbe57('0xf'));var toCsv=require(_0xbe57('0x9'));var querystring=require('querystring');var Papa=require(_0xbe57('0x10'));var Redis=require('ioredis');var authService=require(_0xbe57('0x11'));var qs=require(_0xbe57('0x12'));var as=require(_0xbe57('0x13'));var hardwareService=require(_0xbe57('0x14'));var logger=require(_0xbe57('0x15'))(_0xbe57('0x16'));var utils=require(_0xbe57('0x17'));var config=require(_0xbe57('0x18'));var licenseUtil=require(_0xbe57('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13a1cc,_0x512a8d){_0x512a8d=_0x512a8d||0xcc;return function(_0x3ec3fd){if(_0x3ec3fd){return _0x13a1cc[_0xbe57('0x1a')](_0x512a8d);}return _0x13a1cc[_0xbe57('0x1b')](_0x512a8d)[_0xbe57('0x1c')]();};}function respondWithResult(_0x5dd87e,_0x7c045a){_0x7c045a=_0x7c045a||0xc8;return function(_0x4eb14a){if(_0x4eb14a){return _0x5dd87e[_0xbe57('0x1b')](_0x7c045a)['json'](_0x4eb14a);}};}function respondWithFilteredResult(_0x56ef9c,_0x548eca){return function(_0x276a2c){if(_0x276a2c){var _0x42f01f=typeof _0x548eca[_0xbe57('0x1d')]===_0xbe57('0x1e')&&typeof _0x548eca[_0xbe57('0x1f')]===_0xbe57('0x1e');var _0x3d9013=_0x276a2c[_0xbe57('0x20')];var _0x1d4cc2=_0x42f01f?0x0:_0x548eca[_0xbe57('0x1d')];var _0xef9633=_0x42f01f?_0x276a2c[_0xbe57('0x20')]:_0x548eca[_0xbe57('0x1d')]+_0x548eca[_0xbe57('0x1f')];var _0x4db103;if(_0xef9633>=_0x3d9013){_0xef9633=_0x3d9013;_0x4db103=0xc8;}else{_0x4db103=0xce;}_0x56ef9c['status'](_0x4db103);return _0x56ef9c[_0xbe57('0x21')](_0xbe57('0x22'),_0x1d4cc2+'-'+_0xef9633+'/'+_0x3d9013)[_0xbe57('0x23')](_0x276a2c);}return null;};}function patchUpdates(_0x1f5092){return function(_0x38d3c2){try{jsonpatch[_0xbe57('0x24')](_0x38d3c2,_0x1f5092,!![]);}catch(_0x21a9e7){return BPromise[_0xbe57('0x25')](_0x21a9e7);}return _0x38d3c2[_0xbe57('0x26')]();};}function saveUpdates(_0x29e743,_0x42f7ab){return function(_0x57fbf5){if(_0x57fbf5){return _0x57fbf5['update'](_0x29e743)[_0xbe57('0x27')](function(_0x25ee2e){return _0x25ee2e;});}return null;};}function removeEntity(_0x312974,_0x14d0f7){return function(_0xa1a2f7){if(_0xa1a2f7){return _0xa1a2f7[_0xbe57('0x28')]()['then'](function(){_0x312974[_0xbe57('0x1b')](0xcc)[_0xbe57('0x1c')]();});}};}function handleEntityNotFound(_0x463faf,_0x31132f){return function(_0x4d004d){if(!_0x4d004d){_0x463faf['sendStatus'](0x194);}return _0x4d004d;};}function handleError(_0x32c1c1,_0x30f254){_0x30f254=_0x30f254||0x1f4;return function(_0x4bdd6e){logger['error'](_0x4bdd6e[_0xbe57('0x29')]);if(_0x4bdd6e['name']){delete _0x4bdd6e['name'];}_0x32c1c1[_0xbe57('0x1b')](_0x30f254)['send'](_0x4bdd6e);};}exports['index']=function(_0x4c14c3,_0xfdcb0b){var _0x49b910={},_0x5b8fc1={},_0x33886c={'count':0x0,'rows':[]};var _0x30b0f6=_['map'](db['CmCustomField']['rawAttributes'],function(_0x5eb628){return{'name':_0x5eb628['fieldName'],'type':_0x5eb628[_0xbe57('0x2a')][_0xbe57('0x2b')]};});_0x5b8fc1[_0xbe57('0x2c')]=_[_0xbe57('0x2d')](_[_0xbe57('0x2e')](_0x30b0f6,_0xbe57('0x2f')),[_0xbe57('0x2f')]);_0x5b8fc1[_0xbe57('0x30')]=_[_0xbe57('0x31')](_0x4c14c3['query']);_0x5b8fc1[_0xbe57('0x32')]=_['intersection'](_0x5b8fc1[_0xbe57('0x2c')],_0x5b8fc1[_0xbe57('0x30')]);_0x49b910[_0xbe57('0x33')]=_[_0xbe57('0x34')](_0x5b8fc1[_0xbe57('0x2c')],qs[_0xbe57('0x35')](_0x4c14c3[_0xbe57('0x30')][_0xbe57('0x35')]));_0x49b910['attributes']=_0x49b910[_0xbe57('0x33')][_0xbe57('0x36')]?_0x49b910[_0xbe57('0x33')]:_0x5b8fc1['model'];if(!_0x4c14c3[_0xbe57('0x30')][_0xbe57('0x37')](_0xbe57('0x38'))){_0x49b910[_0xbe57('0x1f')]=qs[_0xbe57('0x1f')](_0x4c14c3[_0xbe57('0x30')][_0xbe57('0x1f')]);_0x49b910[_0xbe57('0x1d')]=qs[_0xbe57('0x1d')](_0x4c14c3[_0xbe57('0x30')][_0xbe57('0x1d')]);}_0x49b910[_0xbe57('0x39')]=qs[_0xbe57('0x3a')](_0x4c14c3[_0xbe57('0x30')]['sort']);_0x49b910[_0xbe57('0x3b')]=qs[_0xbe57('0x32')](_['pick'](_0x4c14c3[_0xbe57('0x30')],_0x5b8fc1[_0xbe57('0x32')]),_0x30b0f6);if(_0x4c14c3[_0xbe57('0x30')][_0xbe57('0x3c')]){_0x49b910['where']=_[_0xbe57('0x3d')](_0x49b910['where'],{'$or':_[_0xbe57('0x2e')](_0x30b0f6,function(_0x4520e7){if(_0x4520e7[_0xbe57('0x2a')]!=='VIRTUAL'){var _0x3ec8f7={};_0x3ec8f7[_0x4520e7[_0xbe57('0x2f')]]={'$like':'%'+_0x4c14c3['query']['filter']+'%'};return _0x3ec8f7;}})});}_0x49b910=_[_0xbe57('0x3d')]({},_0x49b910,_0x4c14c3['options']);var _0x570e30={'where':_0x49b910[_0xbe57('0x3b')]};return db[_0xbe57('0x3e')]['count'](_0x570e30)[_0xbe57('0x27')](function(_0x308be8){_0x33886c['count']=_0x308be8;if(_0x4c14c3[_0xbe57('0x30')]['includeAll']){_0x49b910['include']=[{'all':!![]}];}return db[_0xbe57('0x3e')][_0xbe57('0x3f')](_0x49b910);})['then'](function(_0x5b13db){_0x33886c[_0xbe57('0x40')]=_0x5b13db;return _0x33886c;})[_0xbe57('0x27')](respondWithFilteredResult(_0xfdcb0b,_0x49b910))[_0xbe57('0x41')](handleError(_0xfdcb0b,null));};exports['show']=function(_0x4668eb,_0x18456c){var _0x3cac59={'raw':!![],'where':{'id':_0x4668eb[_0xbe57('0x42')]['id']}},_0x41a97f={};_0x41a97f[_0xbe57('0x2c')]=_['keys'](db[_0xbe57('0x3e')]['rawAttributes']);_0x41a97f[_0xbe57('0x30')]=_['keys'](_0x4668eb[_0xbe57('0x30')]);_0x41a97f[_0xbe57('0x32')]=_['intersection'](_0x41a97f[_0xbe57('0x2c')],_0x41a97f[_0xbe57('0x30')]);_0x3cac59[_0xbe57('0x33')]=_['intersection'](_0x41a97f[_0xbe57('0x2c')],qs[_0xbe57('0x35')](_0x4668eb[_0xbe57('0x30')][_0xbe57('0x35')]));_0x3cac59[_0xbe57('0x33')]=_0x3cac59[_0xbe57('0x33')][_0xbe57('0x36')]?_0x3cac59[_0xbe57('0x33')]:_0x41a97f[_0xbe57('0x2c')];if(_0x4668eb['query']['includeAll']){_0x3cac59[_0xbe57('0x43')]=[{'all':!![]}];}_0x3cac59=_['merge']({},_0x3cac59,_0x4668eb[_0xbe57('0x44')]);return db[_0xbe57('0x3e')][_0xbe57('0x45')](_0x3cac59)[_0xbe57('0x27')](handleEntityNotFound(_0x18456c,null))['then'](respondWithResult(_0x18456c,null))['catch'](handleError(_0x18456c,null));};exports[_0xbe57('0x46')]=function(_0x38985,_0x81bce){if(_0x38985[_0xbe57('0x47')]['id']){delete _0x38985[_0xbe57('0x47')]['id'];}return db[_0xbe57('0x3e')][_0xbe57('0x45')]({'where':{'id':_0x38985[_0xbe57('0x42')]['id']}})['then'](handleEntityNotFound(_0x81bce,null))[_0xbe57('0x27')](saveUpdates(_0x38985[_0xbe57('0x47')],null))[_0xbe57('0x27')](respondWithResult(_0x81bce,null))[_0xbe57('0x41')](handleError(_0x81bce,null));};exports['destroy']=function(_0x97b698,_0x27917f){return db[_0xbe57('0x3e')][_0xbe57('0x45')]({'where':{'id':_0x97b698[_0xbe57('0x42')]['id']}})[_0xbe57('0x27')](handleEntityNotFound(_0x27917f,null))['then'](removeEntity(_0x27917f,null))[_0xbe57('0x41')](handleError(_0x27917f,null));};exports[_0xbe57('0x48')]=function(_0x2b81ad,_0x362f17){var _0x294a41;return db[_0xbe57('0x49')][_0xbe57('0x4a')](function(_0x3beeb8){return db[_0xbe57('0x3e')][_0xbe57('0x48')](_0x2b81ad['body'],{'transaction':_0x3beeb8})[_0xbe57('0x27')](function(_0x3548e6){_0x294a41=_0x3548e6;var _0xf3a1df={'type':db[_0xbe57('0x4b')][_0xbe57('0x4c')],'transaction':_0x3beeb8};switch(_0x2b81ad['body'][_0xbe57('0x2a')]){case _0xbe57('0x4d'):_0xf3a1df[_0xbe57('0x2a')]=db[_0xbe57('0x4b')][_0xbe57('0x4c')];break;case _0xbe57('0x4e'):_0xf3a1df[_0xbe57('0x2a')]=db[_0xbe57('0x4b')][_0xbe57('0x4f')];break;case _0xbe57('0x50'):_0xf3a1df[_0xbe57('0x2a')]=db[_0xbe57('0x4b')][_0xbe57('0x51')];_0xf3a1df[_0xbe57('0x52')]=![];break;default:}return db['sequelize'][_0xbe57('0x53')]['addColumn'](_0xbe57('0x54'),util[_0xbe57('0x55')](_0xbe57('0x56'),_0x294a41['id']),_0xf3a1df);})[_0xbe57('0x27')](function(){return _0x294a41;});})[_0xbe57('0x27')](respondWithResult(_0x362f17,0xc9))[_0xbe57('0x41')](handleError(_0x362f17,null));}; \ No newline at end of file +var _0x46d5=['filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','body','find','destroy','sequelize','transaction','create','Sequelize','TEXT','text','number','INTEGER','defaultValue','queryInterface','addColumn','cm_contacts','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','CmCustomField','fieldName','type','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0xb9db36,_0x4356b3){var _0x40f4b9=function(_0x3fcb9d){while(--_0x3fcb9d){_0xb9db36['push'](_0xb9db36['shift']());}};_0x40f4b9(++_0x4356b3);}(_0x46d5,0x1dc));var _0x546d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x46d5[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x546d('0x0'));var zipdir=require(_0x546d('0x1'));var jsonpatch=require(_0x546d('0x2'));var rp=require(_0x546d('0x3'));var moment=require(_0x546d('0x4'));var BPromise=require(_0x546d('0x5'));var Mustache=require(_0x546d('0x6'));var util=require('util');var path=require(_0x546d('0x7'));var sox=require(_0x546d('0x8'));var csv=require(_0x546d('0x9'));var ejs=require(_0x546d('0xa'));var fs=require('fs');var fs_extra=require(_0x546d('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x546d('0xc'));var jsforce=require(_0x546d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x546d('0xe'));var Papa=require(_0x546d('0xf'));var Redis=require('ioredis');var authService=require(_0x546d('0x10'));var qs=require(_0x546d('0x11'));var as=require(_0x546d('0x12'));var hardwareService=require(_0x546d('0x13'));var logger=require('../../config/logger')(_0x546d('0x14'));var utils=require(_0x546d('0x15'));var config=require(_0x546d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x546d('0x17'))['db'];function respondWithStatusCode(_0x5326a5,_0xdd9884){_0xdd9884=_0xdd9884||0xcc;return function(_0x22cc0d){if(_0x22cc0d){return _0x5326a5[_0x546d('0x18')](_0xdd9884);}return _0x5326a5[_0x546d('0x19')](_0xdd9884)[_0x546d('0x1a')]();};}function respondWithResult(_0x2b8a9c,_0x49732c){_0x49732c=_0x49732c||0xc8;return function(_0xb621a1){if(_0xb621a1){return _0x2b8a9c['status'](_0x49732c)[_0x546d('0x1b')](_0xb621a1);}};}function respondWithFilteredResult(_0x739c87,_0x1dbacf){return function(_0x7bcead){if(_0x7bcead){var _0x3fffa1=typeof _0x1dbacf[_0x546d('0x1c')]==='undefined'&&typeof _0x1dbacf[_0x546d('0x1d')]===_0x546d('0x1e');var _0x35c76e=_0x7bcead[_0x546d('0x1f')];var _0x4f23d3=_0x3fffa1?0x0:_0x1dbacf['offset'];var _0x5b7bc9=_0x3fffa1?_0x7bcead['count']:_0x1dbacf[_0x546d('0x1c')]+_0x1dbacf['limit'];var _0x4fd13b;if(_0x5b7bc9>=_0x35c76e){_0x5b7bc9=_0x35c76e;_0x4fd13b=0xc8;}else{_0x4fd13b=0xce;}_0x739c87[_0x546d('0x19')](_0x4fd13b);return _0x739c87[_0x546d('0x20')](_0x546d('0x21'),_0x4f23d3+'-'+_0x5b7bc9+'/'+_0x35c76e)[_0x546d('0x1b')](_0x7bcead);}return null;};}function patchUpdates(_0x178fc8){return function(_0x4b5134){try{jsonpatch[_0x546d('0x22')](_0x4b5134,_0x178fc8,!![]);}catch(_0x332ead){return BPromise[_0x546d('0x23')](_0x332ead);}return _0x4b5134[_0x546d('0x24')]();};}function saveUpdates(_0x287178,_0x134547){return function(_0x55f02a){if(_0x55f02a){return _0x55f02a[_0x546d('0x25')](_0x287178)[_0x546d('0x26')](function(_0x530243){return _0x530243;});}return null;};}function removeEntity(_0x4e50a2,_0x3f6828){return function(_0x3cddc5){if(_0x3cddc5){return _0x3cddc5['destroy']()[_0x546d('0x26')](function(){_0x4e50a2['status'](0xcc)[_0x546d('0x1a')]();});}};}function handleEntityNotFound(_0x1f862c,_0x9da2db){return function(_0x58814d){if(!_0x58814d){_0x1f862c[_0x546d('0x18')](0x194);}return _0x58814d;};}function handleError(_0x1ad504,_0x68d2){_0x68d2=_0x68d2||0x1f4;return function(_0x50b473){logger[_0x546d('0x27')](_0x50b473[_0x546d('0x28')]);if(_0x50b473['name']){delete _0x50b473[_0x546d('0x29')];}_0x1ad504[_0x546d('0x19')](_0x68d2)[_0x546d('0x2a')](_0x50b473);};}exports[_0x546d('0x2b')]=function(_0x56bdaf,_0x2c0d55){var _0x3625b4={},_0x631f57={},_0x4f6730={'count':0x0,'rows':[]};var _0x16dbea=_[_0x546d('0x2c')](db[_0x546d('0x2d')]['rawAttributes'],function(_0x2cd374){return{'name':_0x2cd374[_0x546d('0x2e')],'type':_0x2cd374[_0x546d('0x2f')]['key']};});_0x631f57[_0x546d('0x30')]=_[_0x546d('0x31')](_[_0x546d('0x2c')](_0x16dbea,_0x546d('0x29')),[_0x546d('0x29')]);_0x631f57[_0x546d('0x32')]=_[_0x546d('0x33')](_0x56bdaf[_0x546d('0x32')]);_0x631f57[_0x546d('0x34')]=_['intersection'](_0x631f57[_0x546d('0x30')],_0x631f57['query']);_0x3625b4[_0x546d('0x35')]=_[_0x546d('0x36')](_0x631f57['model'],qs[_0x546d('0x37')](_0x56bdaf[_0x546d('0x32')][_0x546d('0x37')]));_0x3625b4['attributes']=_0x3625b4['attributes'][_0x546d('0x38')]?_0x3625b4['attributes']:_0x631f57['model'];if(!_0x56bdaf[_0x546d('0x32')][_0x546d('0x39')](_0x546d('0x3a'))){_0x3625b4[_0x546d('0x1d')]=qs[_0x546d('0x1d')](_0x56bdaf[_0x546d('0x32')][_0x546d('0x1d')]);_0x3625b4['offset']=qs[_0x546d('0x1c')](_0x56bdaf['query']['offset']);}_0x3625b4[_0x546d('0x3b')]=qs[_0x546d('0x3c')](_0x56bdaf[_0x546d('0x32')][_0x546d('0x3c')]);_0x3625b4[_0x546d('0x3d')]=qs[_0x546d('0x34')](_[_0x546d('0x3e')](_0x56bdaf[_0x546d('0x32')],_0x631f57[_0x546d('0x34')]),_0x16dbea);if(_0x56bdaf['query']['filter']){_0x3625b4['where']=_[_0x546d('0x3f')](_0x3625b4['where'],{'$or':_[_0x546d('0x2c')](_0x16dbea,function(_0x5a52a7){if(_0x5a52a7[_0x546d('0x2f')]!=='VIRTUAL'){var _0xebac8={};_0xebac8[_0x5a52a7[_0x546d('0x29')]]={'$like':'%'+_0x56bdaf['query'][_0x546d('0x40')]+'%'};return _0xebac8;}})});}_0x3625b4=_['merge']({},_0x3625b4,_0x56bdaf[_0x546d('0x41')]);var _0x442899={'where':_0x3625b4[_0x546d('0x3d')]};return db['CmCustomField'][_0x546d('0x1f')](_0x442899)[_0x546d('0x26')](function(_0x930fec){_0x4f6730['count']=_0x930fec;if(_0x56bdaf[_0x546d('0x32')][_0x546d('0x42')]){_0x3625b4[_0x546d('0x43')]=[{'all':!![]}];}return db[_0x546d('0x2d')][_0x546d('0x44')](_0x3625b4);})[_0x546d('0x26')](function(_0x46e216){_0x4f6730[_0x546d('0x45')]=_0x46e216;return _0x4f6730;})[_0x546d('0x26')](respondWithFilteredResult(_0x2c0d55,_0x3625b4))['catch'](handleError(_0x2c0d55,null));};exports[_0x546d('0x46')]=function(_0x317eed,_0x4c3615){var _0x224a84={'raw':!![],'where':{'id':_0x317eed[_0x546d('0x47')]['id']}},_0x316626={};_0x316626['model']=_['keys'](db[_0x546d('0x2d')][_0x546d('0x48')]);_0x316626[_0x546d('0x32')]=_['keys'](_0x317eed['query']);_0x316626[_0x546d('0x34')]=_[_0x546d('0x36')](_0x316626[_0x546d('0x30')],_0x316626[_0x546d('0x32')]);_0x224a84[_0x546d('0x35')]=_[_0x546d('0x36')](_0x316626[_0x546d('0x30')],qs[_0x546d('0x37')](_0x317eed[_0x546d('0x32')]['fields']));_0x224a84['attributes']=_0x224a84['attributes']['length']?_0x224a84[_0x546d('0x35')]:_0x316626[_0x546d('0x30')];if(_0x317eed[_0x546d('0x32')][_0x546d('0x42')]){_0x224a84['include']=[{'all':!![]}];}_0x224a84=_[_0x546d('0x3f')]({},_0x224a84,_0x317eed[_0x546d('0x41')]);return db[_0x546d('0x2d')]['find'](_0x224a84)['then'](handleEntityNotFound(_0x4c3615,null))[_0x546d('0x26')](respondWithResult(_0x4c3615,null))[_0x546d('0x49')](handleError(_0x4c3615,null));};exports['update']=function(_0x352c26,_0x3327d9){if(_0x352c26[_0x546d('0x4a')]['id']){delete _0x352c26[_0x546d('0x4a')]['id'];}return db[_0x546d('0x2d')][_0x546d('0x4b')]({'where':{'id':_0x352c26[_0x546d('0x47')]['id']}})[_0x546d('0x26')](handleEntityNotFound(_0x3327d9,null))['then'](saveUpdates(_0x352c26[_0x546d('0x4a')],null))[_0x546d('0x26')](respondWithResult(_0x3327d9,null))[_0x546d('0x49')](handleError(_0x3327d9,null));};exports[_0x546d('0x4c')]=function(_0x199a68,_0x57b626){return db['CmCustomField'][_0x546d('0x4b')]({'where':{'id':_0x199a68['params']['id']}})[_0x546d('0x26')](handleEntityNotFound(_0x57b626,null))['then'](removeEntity(_0x57b626,null))[_0x546d('0x49')](handleError(_0x57b626,null));};exports['create']=function(_0x28cba7,_0x359f92){var _0x8a0ebe;return db[_0x546d('0x4d')][_0x546d('0x4e')](function(_0x169270){return db[_0x546d('0x2d')][_0x546d('0x4f')](_0x28cba7['body'],{'transaction':_0x169270})[_0x546d('0x26')](function(_0x524c6c){_0x8a0ebe=_0x524c6c;var _0x5ba507={'type':db[_0x546d('0x50')][_0x546d('0x51')],'transaction':_0x169270};switch(_0x28cba7[_0x546d('0x4a')]['type']){case _0x546d('0x52'):_0x5ba507[_0x546d('0x2f')]=db[_0x546d('0x50')][_0x546d('0x51')];break;case _0x546d('0x53'):_0x5ba507[_0x546d('0x2f')]=db['Sequelize'][_0x546d('0x54')];break;case'switch':_0x5ba507[_0x546d('0x2f')]=db[_0x546d('0x50')]['BOOLEAN'];_0x5ba507[_0x546d('0x55')]=![];break;default:}return db['sequelize'][_0x546d('0x56')][_0x546d('0x57')](_0x546d('0x58'),util[_0x546d('0x59')]('cf_%d',_0x8a0ebe['id']),_0x5ba507);})[_0x546d('0x26')](function(){return _0x8a0ebe;});})[_0x546d('0x26')](respondWithResult(_0x359f92,0xc9))[_0x546d('0x49')](handleError(_0x359f92,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index fd2287b..95e83d0 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 _0xb7ae=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','util'];(function(_0x2c68fb,_0x5029ce){var _0x162ecc=function(_0x1de82a){while(--_0x1de82a){_0x2c68fb['push'](_0x2c68fb['shift']());}};_0x162ecc(++_0x5029ce);}(_0xb7ae,0x16a));var _0xeb7a=function(_0x13ae2e,_0x5b1530){_0x13ae2e=_0x13ae2e-0x0;var _0x248d7c=_0xb7ae[_0x13ae2e];return _0x248d7c;};'use strict';var _=require(_0xeb7a('0x0'));var util=require(_0xeb7a('0x1'));var logger=require(_0xeb7a('0x2'))(_0xeb7a('0x3'));var moment=require(_0xeb7a('0x4'));var BPromise=require(_0xeb7a('0x5'));var rp=require(_0xeb7a('0x6'));var fs=require('fs');var path=require(_0xeb7a('0x7'));var rimraf=require(_0xeb7a('0x8'));var config=require(_0xeb7a('0x9'));var attributes=require('./cmCustomField.attributes');module[_0xeb7a('0xa')]=function(_0x24e6bf,_0x404282){return _0x24e6bf[_0xeb7a('0xb')](_0xeb7a('0xc'),attributes,{'tableName':_0xeb7a('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5a7=['path','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5bb7e5,_0x4e06b0){var _0x459901=function(_0x557169){while(--_0x557169){_0x5bb7e5['push'](_0x5bb7e5['shift']());}};_0x459901(++_0x4e06b0);}(_0xb5a7,0x1f4));var _0x7b5a=function(_0x6940c3,_0x487780){_0x6940c3=_0x6940c3-0x0;var _0x30ffad=_0xb5a7[_0x6940c3];return _0x30ffad;};'use strict';var _=require(_0x7b5a('0x0'));var util=require(_0x7b5a('0x1'));var logger=require(_0x7b5a('0x2'))(_0x7b5a('0x3'));var moment=require(_0x7b5a('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b5a('0x5'));var fs=require('fs');var path=require(_0x7b5a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7b5a('0x7'));module['exports']=function(_0x569f29,_0x532da4){return _0x569f29[_0x7b5a('0x8')](_0x7b5a('0x9'),attributes,{'tableName':_0x7b5a('0xa'),'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 4c95caa..9ab7753 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 _0x0e6c=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment'];(function(_0x3a84b7,_0x46f63a){var _0x41544a=function(_0x49f789){while(--_0x49f789){_0x3a84b7['push'](_0x3a84b7['shift']());}};_0x41544a(++_0x46f63a);}(_0x0e6c,0x6b));var _0xc0e6=function(_0x3f234d,_0x2a0bfd){_0x3f234d=_0x3f234d-0x0;var _0x199a34=_0x0e6c[_0x3f234d];return _0x199a34;};'use strict';var _=require(_0xc0e6('0x0'));var util=require(_0xc0e6('0x1'));var moment=require(_0xc0e6('0x2'));var BPromise=require(_0xc0e6('0x3'));var rs=require(_0xc0e6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc0e6('0x5'))['db'];var utils=require(_0xc0e6('0x6'));var logger=require(_0xc0e6('0x7'))(_0xc0e6('0x8'));var config=require(_0xc0e6('0x9'));var jayson=require(_0xc0e6('0xa'));var client=jayson['client'][_0xc0e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x317e93,_0x4df75a,_0x39639d){return new BPromise(function(_0x50a5e4,_0x2d97df){return client['request'](_0x317e93,_0x39639d)['then'](function(_0x19d6ba){logger[_0xc0e6('0xc')](_0xc0e6('0xd'),_0x4df75a,'request\x20sent');logger[_0xc0e6('0xe')](_0xc0e6('0xf'),_0x4df75a,'request\x20sent',JSON[_0xc0e6('0x10')](_0x19d6ba));if(_0x19d6ba[_0xc0e6('0x11')]){if(_0x19d6ba[_0xc0e6('0x11')][_0xc0e6('0x12')]===0x1f4){logger[_0xc0e6('0x11')](_0xc0e6('0xd'),_0x4df75a,_0x19d6ba[_0xc0e6('0x11')][_0xc0e6('0x13')]);return _0x2d97df(_0x19d6ba[_0xc0e6('0x11')][_0xc0e6('0x13')]);}logger[_0xc0e6('0x11')](_0xc0e6('0xd'),_0x4df75a,_0x19d6ba[_0xc0e6('0x11')]['message']);return _0x50a5e4(_0x19d6ba[_0xc0e6('0x11')][_0xc0e6('0x13')]);}else{logger[_0xc0e6('0xc')](_0xc0e6('0xd'),_0x4df75a,_0xc0e6('0x14'));_0x50a5e4(_0x19d6ba['result']['message']);}})[_0xc0e6('0x15')](function(_0x3f62be){logger[_0xc0e6('0x11')](_0xc0e6('0xd'),_0x4df75a,_0x3f62be);_0x2d97df(_0x3f62be);});});} \ No newline at end of file +var _0x32eb=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x59f400,_0x53ca57){var _0x594298=function(_0x3daedc){while(--_0x3daedc){_0x59f400['push'](_0x59f400['shift']());}};_0x594298(++_0x53ca57);}(_0x32eb,0x18a));var _0xb32e=function(_0x1e03a6,_0xf0349){_0x1e03a6=_0x1e03a6-0x0;var _0x295b64=_0x32eb[_0x1e03a6];return _0x295b64;};'use strict';var _=require('lodash');var util=require(_0xb32e('0x0'));var moment=require(_0xb32e('0x1'));var BPromise=require(_0xb32e('0x2'));var rs=require(_0xb32e('0x3'));var fs=require('fs');var Redis=require(_0xb32e('0x4'));var db=require(_0xb32e('0x5'))['db'];var utils=require(_0xb32e('0x6'));var logger=require(_0xb32e('0x7'))('rpc');var config=require(_0xb32e('0x8'));var jayson=require(_0xb32e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x454837,_0x4d082c,_0x305131){return new BPromise(function(_0x2f0b75,_0x55e392){return client['request'](_0x454837,_0x305131)['then'](function(_0x385ec8){logger[_0xb32e('0xa')](_0xb32e('0xb'),_0x4d082c,_0xb32e('0xc'));logger[_0xb32e('0xd')](_0xb32e('0xe'),_0x4d082c,_0xb32e('0xc'),JSON[_0xb32e('0xf')](_0x385ec8));if(_0x385ec8[_0xb32e('0x10')]){if(_0x385ec8[_0xb32e('0x10')][_0xb32e('0x11')]===0x1f4){logger[_0xb32e('0x10')](_0xb32e('0xb'),_0x4d082c,_0x385ec8[_0xb32e('0x10')]['message']);return _0x55e392(_0x385ec8[_0xb32e('0x10')][_0xb32e('0x12')]);}logger[_0xb32e('0x10')](_0xb32e('0xb'),_0x4d082c,_0x385ec8[_0xb32e('0x10')][_0xb32e('0x12')]);return _0x2f0b75(_0x385ec8[_0xb32e('0x10')]['message']);}else{logger['info'](_0xb32e('0xb'),_0x4d082c,_0xb32e('0xc'));_0x2f0b75(_0x385ec8[_0xb32e('0x13')][_0xb32e('0x12')]);}})[_0xb32e('0x14')](function(_0x4c85e2){logger[_0xb32e('0x10')](_0xb32e('0xb'),_0x4d082c,_0x4c85e2);_0x55e392(_0x4c85e2);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 645e749..7f9004e 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 _0x6bac=['multer','path','connect-timeout','express','Router','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','create','destroy','exports'];(function(_0x8c8176,_0x5360a1){var _0x4dc47b=function(_0x1a7f65){while(--_0x1a7f65){_0x8c8176['push'](_0x8c8176['shift']());}};_0x4dc47b(++_0x5360a1);}(_0x6bac,0xa5));var _0xc6ba=function(_0x20cdab,_0x4a72f5){_0x20cdab=_0x20cdab-0x0;var _0x16585e=_0x6bac[_0x20cdab];return _0x16585e;};'use strict';var multer=require(_0xc6ba('0x0'));var util=require('util');var path=require(_0xc6ba('0x1'));var timeout=require(_0xc6ba('0x2'));var express=require(_0xc6ba('0x3'));var router=express[_0xc6ba('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc6ba('0x5'));var controller=require(_0xc6ba('0x6'));router['get']('/',auth[_0xc6ba('0x7')](),controller[_0xc6ba('0x8')]);router[_0xc6ba('0x9')](_0xc6ba('0xa'),auth[_0xc6ba('0x7')](),controller[_0xc6ba('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc6ba('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xc6ba('0xa'),auth[_0xc6ba('0x7')](),controller[_0xc6ba('0xd')]);module[_0xc6ba('0xe')]=router; \ No newline at end of file +var _0xecb2=['show','post','put','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','/:id','isAuthenticated'];(function(_0x746739,_0x289561){var _0x4b7447=function(_0x3435f2){while(--_0x3435f2){_0x746739['push'](_0x746739['shift']());}};_0x4b7447(++_0x289561);}(_0xecb2,0xf6));var _0x2ecb=function(_0x53bc54,_0xa30b93){_0x53bc54=_0x53bc54-0x0;var _0x1c75c9=_0xecb2[_0x53bc54];return _0x1c75c9;};'use strict';var multer=require(_0x2ecb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2ecb('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2ecb('0x2'));var auth=require(_0x2ecb('0x3'));var interaction=require(_0x2ecb('0x4'));var config=require(_0x2ecb('0x5'));var controller=require(_0x2ecb('0x6'));router[_0x2ecb('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2ecb('0x8'),auth[_0x2ecb('0x9')](),controller[_0x2ecb('0xa')]);router[_0x2ecb('0xb')]('/',auth[_0x2ecb('0x9')](),controller['create']);router[_0x2ecb('0xc')](_0x2ecb('0x8'),auth[_0x2ecb('0x9')](),controller['update']);router[_0x2ecb('0xd')](_0x2ecb('0x8'),auth[_0x2ecb('0x9')](),controller[_0x2ecb('0xe')]);module[_0x2ecb('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 a6939f0..7268c19 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 _0x05d3=['moment','sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue'];(function(_0x3d218c,_0x5aec4e){var _0x5826a8=function(_0x96277f){while(--_0x96277f){_0x3d218c['push'](_0x3d218c['shift']());}};_0x5826a8(++_0x5aec4e);}(_0x05d3,0x8f));var _0x305d=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x05d3[_0x211632];return _0x5a1da1;};'use strict';var moment=require(_0x305d('0x0'));var Sequelize=require(_0x305d('0x1'));module[_0x305d('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x305d('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x305d('0x4')],'defaultValue':moment()[_0x305d('0x5')](_0x305d('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x305d('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x305d('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x305d('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x305d('0x4')]},'priority':{'type':Sequelize[_0x305d('0x7')](0x2)[_0x305d('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x305d('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x305d('0x7')],'unique':_0x305d('0xa')},'ListId':{'type':Sequelize[_0x305d('0x7')],'unique':_0x305d('0xa')},'UserId':{'type':Sequelize[_0x305d('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x305d('0x7')],'unique':_0x305d('0xa')},'CampaignId':{'type':Sequelize[_0x305d('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x305d('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x305d('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x305d('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x305d('0x8')]}}; \ No newline at end of file +var _0xc6d0=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc6d0,0x1af));var _0x0c6d=function(_0xfe419d,_0x289a55){_0xfe419d=_0xfe419d-0x0;var _0x59bd90=_0xc6d0[_0xfe419d];return _0x59bd90;};'use strict';var moment=require(_0x0c6d('0x0'));var Sequelize=require(_0x0c6d('0x1'));module[_0x0c6d('0x2')]={'phone':{'type':Sequelize[_0x0c6d('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x0c6d('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x0c6d('0x5')],'defaultValue':moment()[_0x0c6d('0x6')](_0x0c6d('0x7'))},'countbusyretry':{'type':Sequelize[_0x0c6d('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0c6d('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0c6d('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x0c6d('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0c6d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0c6d('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x0c6d('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x0c6d('0x8')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x0c6d('0x8')],'unique':_0x0c6d('0x9')},'CampaignId':{'type':Sequelize[_0x0c6d('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x0c6d('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0c6d('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0c6d('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0c6d('0x8')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x0c6d('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index f9de6cb..1bc11cd 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 _0x1932=['omit','createdAt','updatedAt','state','deleted','campaign','membername','user','UserId','deletedat','format','calleridnum','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','getVoiceQueues','outbound','preview','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','dialOrderByScheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','CmCompany','Company','CmList','List','Queue','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','concat','$and','$or','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','attributes','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','CmHopper','findAll','rows','show','params','length','catch','create','body','update','find','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign'];(function(_0x3fd3a3,_0x36c863){var _0xa3e4d5=function(_0x1fd03b){while(--_0x1fd03b){_0x3fd3a3['push'](_0x3fd3a3['shift']());}};_0xa3e4d5(++_0x36c863);}(_0x1932,0xd1));var _0x2193=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x1932[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2193('0x0'));var zipdir=require(_0x2193('0x1'));var jsonpatch=require(_0x2193('0x2'));var rp=require(_0x2193('0x3'));var moment=require('moment');var BPromise=require(_0x2193('0x4'));var Mustache=require(_0x2193('0x5'));var util=require(_0x2193('0x6'));var path=require(_0x2193('0x7'));var sox=require('sox');var csv=require(_0x2193('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2193('0x9'));var _=require(_0x2193('0xa'));var squel=require(_0x2193('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2193('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2193('0xd'));var Papa=require(_0x2193('0xe'));var Redis=require(_0x2193('0xf'));var authService=require(_0x2193('0x10'));var qs=require(_0x2193('0x11'));var as=require(_0x2193('0x12'));var hardwareService=require(_0x2193('0x13'));var logger=require(_0x2193('0x14'))(_0x2193('0x15'));var utils=require(_0x2193('0x16'));var config=require('../../config/environment');var shared=require(_0x2193('0x17'));var licenseUtil=require(_0x2193('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbdfa43,_0x1d3a0d){_0x1d3a0d=_0x1d3a0d||0xcc;return function(_0x5f5ddd){if(_0x5f5ddd){return _0xbdfa43[_0x2193('0x19')](_0x1d3a0d);}return _0xbdfa43[_0x2193('0x1a')](_0x1d3a0d)[_0x2193('0x1b')]();};}function respondWithResult(_0x396197,_0x4b34ab){_0x4b34ab=_0x4b34ab||0xc8;return function(_0x4d852a){if(_0x4d852a){return _0x396197[_0x2193('0x1a')](_0x4b34ab)[_0x2193('0x1c')](_0x4d852a);}};}function respondWithFilteredResult(_0x47af1d,_0x12a308){return function(_0x88bd44){if(_0x88bd44){var _0x3316cf=typeof _0x12a308[_0x2193('0x1d')]===_0x2193('0x1e')&&typeof _0x12a308[_0x2193('0x1f')]==='undefined';var _0xa6f6d1=_0x88bd44['count'];var _0x5bb7ab=_0x3316cf?0x0:_0x12a308[_0x2193('0x1d')];var _0xbbe793=_0x3316cf?_0x88bd44[_0x2193('0x20')]:_0x12a308[_0x2193('0x1d')]+_0x12a308[_0x2193('0x1f')];var _0x2f670a;if(_0xbbe793>=_0xa6f6d1){_0xbbe793=_0xa6f6d1;_0x2f670a=0xc8;}else{_0x2f670a=0xce;}_0x47af1d[_0x2193('0x1a')](_0x2f670a);return _0x47af1d[_0x2193('0x21')](_0x2193('0x22'),_0x5bb7ab+'-'+_0xbbe793+'/'+_0xa6f6d1)['json'](_0x88bd44);}return null;};}function patchUpdates(_0xa63a2a){return function(_0x1103d6){try{jsonpatch[_0x2193('0x23')](_0x1103d6,_0xa63a2a,!![]);}catch(_0x5386a8){return BPromise[_0x2193('0x24')](_0x5386a8);}return _0x1103d6['save']();};}function saveUpdates(_0x53a12e,_0x52d172){return function(_0x573634){if(_0x573634){return _0x573634['update'](_0x53a12e)[_0x2193('0x25')](function(_0x338c40){return _0x338c40;});}return null;};}function removeEntity(_0x414303,_0x364c99){return function(_0x43d290){if(_0x43d290){return _0x43d290[_0x2193('0x26')]()['then'](function(){_0x414303[_0x2193('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x380f20,_0x27d571){return function(_0x227c58){if(!_0x227c58){_0x380f20[_0x2193('0x19')](0x194);}return _0x227c58;};}function handleError(_0xedf007,_0x2c7a25){_0x2c7a25=_0x2c7a25||0x1f4;return function(_0x5ef3b1){logger[_0x2193('0x27')](_0x5ef3b1[_0x2193('0x28')]);if(_0x5ef3b1[_0x2193('0x29')]){delete _0x5ef3b1[_0x2193('0x29')];}_0xedf007[_0x2193('0x1a')](_0x2c7a25)['send'](_0x5ef3b1);};}exports[_0x2193('0x2a')]=function(_0x18a9a4,_0x16f60a){var _0x28bb9a={},_0x30f29e={},_0x1ceb13={'count':0x0,'rows':[]};var _0x509d22=_[_0x2193('0x2b')](db['CmHopper'][_0x2193('0x2c')],function(_0x440c77){return{'name':_0x440c77[_0x2193('0x2d')],'type':_0x440c77['type'][_0x2193('0x2e')]};});_0x30f29e[_0x2193('0x2f')]=_[_0x2193('0x2b')](_0x509d22,_0x2193('0x29'));_0x30f29e[_0x2193('0x30')]=_[_0x2193('0x31')](_0x18a9a4[_0x2193('0x30')]);_0x30f29e[_0x2193('0x32')]=_[_0x2193('0x33')](_0x30f29e['model'],_0x30f29e[_0x2193('0x30')]);_0x30f29e[_0x2193('0x32')]=_[_0x2193('0x34')](_0x30f29e[_0x2193('0x32')],[_0x2193('0x35'),_0x2193('0x36'),'$gt','$gte',_0x2193('0x37'),_0x2193('0x38'),_0x2193('0x39'),'$eq',_0x2193('0x3a'),_0x2193('0x3b'),_0x2193('0x3c'),_0x2193('0x3d'),_0x2193('0x3e'),_0x2193('0x3f'),_0x2193('0x40'),_0x2193('0x41'),_0x2193('0x42'),_0x2193('0x3f'),_0x2193('0x43'),_0x2193('0x44'),'$contained','$any']);_0x28bb9a[_0x2193('0x45')]=_[_0x2193('0x33')](_0x30f29e['model'],qs['fields'](_0x18a9a4['query'][_0x2193('0x46')]));_0x28bb9a['attributes']=_0x28bb9a['attributes']['length']?_0x28bb9a[_0x2193('0x45')]:_0x30f29e[_0x2193('0x2f')];if(!_0x18a9a4['query'][_0x2193('0x47')]('nolimit')){_0x28bb9a[_0x2193('0x1f')]=qs[_0x2193('0x1f')](_0x18a9a4[_0x2193('0x30')]['limit']);_0x28bb9a['offset']=qs[_0x2193('0x1d')](_0x18a9a4[_0x2193('0x30')][_0x2193('0x1d')]);}_0x28bb9a[_0x2193('0x48')]=qs[_0x2193('0x49')](_0x18a9a4[_0x2193('0x30')][_0x2193('0x49')]);_0x28bb9a[_0x2193('0x4a')]=qs['filters'](_[_0x2193('0x4b')](_0x18a9a4[_0x2193('0x30')],_0x30f29e['filters']),_0x509d22);if(_0x18a9a4[_0x2193('0x30')]['filter']){_0x28bb9a[_0x2193('0x4a')]=_['merge'](_0x28bb9a['where'],{'$or':_['map'](_0x509d22,function(_0x31751f){if(_0x31751f['type']!==_0x2193('0x4c')){var _0x575305={};_0x575305[_0x31751f[_0x2193('0x29')]]={'$like':'%'+_0x18a9a4[_0x2193('0x30')]['filter']+'%'};return _0x575305;}})});}_0x28bb9a=_[_0x2193('0x4d')]({},_0x28bb9a,_0x18a9a4[_0x2193('0x4e')]);var _0x2fde95={'where':_0x28bb9a[_0x2193('0x4a')]};return db['CmHopper']['count'](_0x2fde95)[_0x2193('0x25')](function(_0xfee362){_0x1ceb13[_0x2193('0x20')]=_0xfee362;if(_0x18a9a4[_0x2193('0x30')][_0x2193('0x4f')]){_0x28bb9a[_0x2193('0x50')]=[{'all':!![]}];}return db[_0x2193('0x51')][_0x2193('0x52')](_0x28bb9a);})[_0x2193('0x25')](function(_0x4c038b){_0x1ceb13[_0x2193('0x53')]=_0x4c038b;return _0x1ceb13;})[_0x2193('0x25')](respondWithFilteredResult(_0x16f60a,_0x28bb9a))['catch'](handleError(_0x16f60a,null));};exports[_0x2193('0x54')]=function(_0x41e659,_0x17ec39){var _0x27d30b={'raw':!![],'where':{'id':_0x41e659[_0x2193('0x55')]['id']}},_0x1afc30={};_0x1afc30[_0x2193('0x2f')]=_['keys'](db['CmHopper'][_0x2193('0x2c')]);_0x1afc30[_0x2193('0x30')]=_[_0x2193('0x31')](_0x41e659[_0x2193('0x30')]);_0x1afc30[_0x2193('0x32')]=_['intersection'](_0x1afc30['model'],_0x1afc30[_0x2193('0x30')]);_0x27d30b['attributes']=_[_0x2193('0x33')](_0x1afc30['model'],qs['fields'](_0x41e659[_0x2193('0x30')][_0x2193('0x46')]));_0x27d30b[_0x2193('0x45')]=_0x27d30b[_0x2193('0x45')][_0x2193('0x56')]?_0x27d30b[_0x2193('0x45')]:_0x1afc30[_0x2193('0x2f')];if(_0x41e659[_0x2193('0x30')][_0x2193('0x4f')]){_0x27d30b[_0x2193('0x50')]=[{'all':!![]}];}_0x27d30b=_[_0x2193('0x4d')]({},_0x27d30b,_0x41e659['options']);return db[_0x2193('0x51')]['find'](_0x27d30b)[_0x2193('0x25')](handleEntityNotFound(_0x17ec39,null))['then'](respondWithResult(_0x17ec39,null))[_0x2193('0x57')](handleError(_0x17ec39,null));};exports[_0x2193('0x58')]=function(_0x11482c,_0x4c61ad){return db[_0x2193('0x51')][_0x2193('0x58')](_0x11482c[_0x2193('0x59')],{})[_0x2193('0x25')](respondWithResult(_0x4c61ad,0xc9))[_0x2193('0x57')](handleError(_0x4c61ad,null));};exports[_0x2193('0x5a')]=function(_0x48c0a9,_0x35f93d){if(_0x48c0a9[_0x2193('0x59')]['id']){delete _0x48c0a9[_0x2193('0x59')]['id'];}return db[_0x2193('0x51')][_0x2193('0x5b')]({'where':{'id':_0x48c0a9[_0x2193('0x55')]['id']}})[_0x2193('0x25')](handleEntityNotFound(_0x35f93d,null))[_0x2193('0x25')](saveUpdates(_0x48c0a9['body'],null))[_0x2193('0x25')](respondWithResult(_0x35f93d,null))[_0x2193('0x57')](handleError(_0x35f93d,null));};exports[_0x2193('0x5c')]=function(_0x2e0547,_0x13eff7){return db['CmHopper']['describe']()[_0x2193('0x25')](respondWithResult(_0x13eff7,null))[_0x2193('0x57')](handleError(_0x13eff7,null));};exports[_0x2193('0x26')]=function(_0x5a30f5,_0x31452c){var _0x3322ad;return db[_0x2193('0x51')]['find']({'where':{'id':_0x5a30f5[_0x2193('0x55')]['id']}})[_0x2193('0x25')](handleEntityNotFound(_0x31452c,null))['then'](function(_0xebd9fa){if(_0xebd9fa){return _0xebd9fa[_0x2193('0x26')]()['then'](function(_0x3baa52){return _0x3baa52;});}})[_0x2193('0x25')](function(_0x4a9f35){_0x3322ad=_0x4a9f35;if(_0x4a9f35){if(_0x4a9f35[_0x2193('0x5d')]||_0x4a9f35[_0x2193('0x5e')]){return db[_0x4a9f35[_0x2193('0x5d')]?_0x2193('0x5f'):_0x2193('0x60')][_0x2193('0x5b')]({'where':{'id':_0x4a9f35[_0x2193('0x5d')]?_0x4a9f35[_0x2193('0x5d')]:_0x4a9f35[_0x2193('0x5e')]},'attributes':['id',_0x2193('0x29')],'raw':!![]});}}})[_0x2193('0x25')](function(_0x2d6841){var _0x59a494={};if(_0x2d6841){_['merge'](_0x59a494,_[_0x2193('0x61')](_0x3322ad['dataValues'],[_0x2193('0x62'),_0x2193('0x63'),'id']));_0x59a494[_0x2193('0x64')]=0x15;_0x59a494['statedesc']=_0x2193('0x65');_0x59a494[_0x2193('0x66')]=_0x2d6841[_0x2193('0x29')];_0x59a494[_0x2193('0x67')]=_0x5a30f5[_0x2193('0x68')][_0x2193('0x29')];_0x59a494[_0x2193('0x69')]=_0x5a30f5[_0x2193('0x68')]['id'];_0x59a494[_0x2193('0x65')]=!![];_0x59a494[_0x2193('0x6a')]=moment()[_0x2193('0x6b')]('YYYY-MM-DD\x20HH:mm:ss');_0x59a494[_0x2193('0x6c')]=_0x3322ad['phone'];_0x59a494['campaigntype']=_0x3322ad['VoiceQueueId']?_0x2193('0x6d'):_0x2193('0x6e');return db['CmContact']['find']({'where':{'id':_0x59a494[_0x2193('0x6f')]},'attributes':[_0x2193('0x70'),_0x2193('0x71')]})[_0x2193('0x25')](function(_0x19d40a){if(!_[_0x2193('0x72')](_0x31452c)&&!_['isNil'](_0x19d40a[_0x2193('0x70')])){_0x59a494[_0x2193('0x73')]=_0x19d40a[_0x2193('0x70')];if(!_[_0x2193('0x72')](_0x19d40a[_0x2193('0x71')])){_0x59a494[_0x2193('0x73')]+='\x20'+_0x19d40a[_0x2193('0x71')];}}})[_0x2193('0x74')](function(){return db[_0x2193('0x75')]['create'](_0x59a494);});}})[_0x2193('0x25')](function(){return _0x31452c[_0x2193('0x1a')](0xcc)[_0x2193('0x1b')]();})[_0x2193('0x57')](handleError(_0x31452c,null));};exports[_0x2193('0x76')]=function(_0x1df7ec,_0x20850a,_0x58f760){var _0x50392e=[];return db[_0x2193('0x77')][_0x2193('0x5c')]()[_0x2193('0x25')](function(_0x1ec845){_0x50392e=_[_0x2193('0x31')](_0x1ec845);return _0x1df7ec['user'][_0x2193('0x78')]({'where':{'type':_0x2193('0x79'),'dialActive':!![],'dialMethod':_0x2193('0x7a')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x2193('0x25')](function(_0x43eb75){if(_0x43eb75&&_0x43eb75[_0x2193('0x56')]){return db[_0x2193('0x7b')][_0x2193('0x7c')](function(_0x32acd2){var _0xc21972={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2193('0x6b')](_0x2193('0x7d'))},'VoiceQueueId':{'$in':_[_0x2193('0x2b')](_0x43eb75,'id')},'$or':[{'UserId':null},{'UserId':_0x1df7ec[_0x2193('0x68')]['id']}]};var _0x1e1325=[];if(_0x1df7ec['body'][_0x2193('0x7e')]&&_0x1df7ec[_0x2193('0x59')]['direction']===_0x2193('0x7f')){if(!_[_0x2193('0x80')](_0x1df7ec[_0x2193('0x59')][_0x2193('0x81')])){_0xc21972['id']={'$in':_0x1df7ec[_0x2193('0x59')][_0x2193('0x81')]};}_0x1e1325=[['priority',_0x2193('0x82')],[_0x2193('0x83'),_0x43eb75[0x0][_0x2193('0x84')]==='ASC'?_0x2193('0x85'):'ASC'],db[_0x2193('0x7b')]['literal'](_0x2193('0x86')),['id',_0x2193('0x85')]];}else{if(!_[_0x2193('0x80')](_0x1df7ec[_0x2193('0x59')][_0x2193('0x81')])){_0xc21972['id']={'$notIn':_0x1df7ec['body']['hopperIds']};}_0x1e1325=[[_0x2193('0x87'),_0x2193('0x85')],[_0x2193('0x83'),_0x43eb75[0x0]['dialOrderByScheduledAt']],db[_0x2193('0x7b')][_0x2193('0x88')](_0x2193('0x89')),['id',_0x2193('0x82')]];}return db[_0x2193('0x51')][_0x2193('0x8a')]({'attributes':['id',_0x2193('0x8b')],'where':_0xc21972,'order':_0x1e1325,'transaction':_0x32acd2,'lock':_0x32acd2['LOCK'][_0x2193('0x8c')],'include':[{'model':db[_0x2193('0x77')],'as':'Contact','attributes':_0x50392e,'include':[{'model':db[_0x2193('0x8d')],'as':_0x2193('0x8e'),'attributes':['id',_0x2193('0x29')]}]},{'model':db[_0x2193('0x8f')],'as':_0x2193('0x90'),'attributes':['id',_0x2193('0x29')]},{'model':db['VoiceQueue'],'as':_0x2193('0x91'),'attributes':['id',_0x2193('0x29'),'dialActive']}]})[_0x2193('0x25')](function(_0x87e060){if(_0x87e060){return _0x87e060['update']({'UserId':_0x1df7ec[_0x2193('0x68')]['id']},{'transaction':_0x32acd2});}});});}})[_0x2193('0x25')](handleEntityNotFound(_0x20850a,null))[_0x2193('0x25')](respondWithResult(_0x20850a,null))[_0x2193('0x57')](handleError(_0x20850a,null));};exports[_0x2193('0x92')]=function(_0x585819,_0x36f9d0,_0x274e3b){return _0x585819[_0x2193('0x68')]['getVoiceQueues']({'where':{'type':_0x2193('0x79'),'dialActive':!![],'dialMethod':_0x2193('0x7a')},'attributes':['id'],'raw':!![]})[_0x2193('0x25')](function(_0x30aea1){if(_0x30aea1&&_0x30aea1[_0x2193('0x56')]){return db[_0x2193('0x51')][_0x2193('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2193('0x6b')](_0x2193('0x7d'))},'VoiceQueueId':{'$in':_[_0x2193('0x2b')](_0x30aea1,'id')},'$or':[{'UserId':null},{'UserId':_0x585819[_0x2193('0x68')]['id']}]}});}return 0x0;})[_0x2193('0x25')](function(_0x22dd89){if(!_[_0x2193('0x72')](_0x22dd89)&&_['isNumber'](_0x22dd89)){return _0x36f9d0[_0x2193('0x1a')](0xc8)[_0x2193('0x1c')]({'contacts':_0x22dd89});}else{logger[_0x2193('0x27')](_0x2193('0x93'),'getOpenContacts',0x194,_0x2193('0x94'));_0x36f9d0[_0x2193('0x19')](0x194);}})['catch'](handleError(_0x36f9d0,null));};exports[_0x2193('0x95')]=function(_0x21cb55,_0x4a06bd,_0x3899b8){var _0x48cdda=shared[_0x2193('0x96')];var _0x2f1cc9=[];_[_0x2193('0x2b')](_0x48cdda,function(_0x5fd791){_0x2f1cc9[_0x2193('0x97')]({'id':_0x5fd791[_0x2193('0x29')],'name':_0x5fd791[_0x2193('0x29')],'utcOffset':_0x5fd791[_0x2193('0x98')]});});return _0x4a06bd['status'](0xc8)[_0x2193('0x1c')]({'tz':_0x2f1cc9});};exports['getTimezone']=function(_0x254ded,_0x44623c,_0x160f2a){var _0x30159f=shared['timezones'];var _0x1c78f8={};if(!_[_0x2193('0x72')](_0x30159f[_0x254ded['body']['id']]))_0x1c78f8=_0x30159f[_0x254ded['body']['id']];return _0x44623c[_0x2193('0x1a')](0xc8)[_0x2193('0x1c')](_0x1c78f8);}; \ No newline at end of file +var _0xdeed=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','stack','name','send','index','rawAttributes','type','key','map','query','keys','filters','model','concat','$and','$or','$gt','$gte','$lt','$not','$between','$notBetween','$in','$notIn','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','attributes','intersection','length','order','sort','where','pick','filter','VIRTUAL','merge','options','CmHopper','include','findAll','rows','params','fields','includeAll','find','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','update','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox'];(function(_0x25afd4,_0x40d7ad){var _0x16da5f=function(_0x554e0e){while(--_0x554e0e){_0x25afd4['push'](_0x25afd4['shift']());}};_0x16da5f(++_0x40d7ad);}(_0xdeed,0x1c9));var _0xddee=function(_0x1b9707,_0x20f811){_0x1b9707=_0x1b9707-0x0;var _0x1f1fc9=_0xdeed[_0x1b9707];return _0x1f1fc9;};'use strict';var emlformat=require(_0xddee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xddee('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xddee('0x2'));var BPromise=require(_0xddee('0x3'));var Mustache=require(_0xddee('0x4'));var util=require(_0xddee('0x5'));var path=require(_0xddee('0x6'));var sox=require(_0xddee('0x7'));var csv=require('to-csv');var ejs=require(_0xddee('0x8'));var fs=require('fs');var fs_extra=require(_0xddee('0x9'));var _=require(_0xddee('0xa'));var squel=require(_0xddee('0xb'));var crypto=require(_0xddee('0xc'));var jsforce=require(_0xddee('0xd'));var deskjs=require(_0xddee('0xe'));var toCsv=require(_0xddee('0xf'));var querystring=require(_0xddee('0x10'));var Papa=require('papaparse');var Redis=require(_0xddee('0x11'));var authService=require(_0xddee('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xddee('0x13'));var hardwareService=require(_0xddee('0x14'));var logger=require(_0xddee('0x15'))(_0xddee('0x16'));var utils=require(_0xddee('0x17'));var config=require(_0xddee('0x18'));var shared=require(_0xddee('0x18'));var licenseUtil=require(_0xddee('0x19'));var db=require(_0xddee('0x1a'))['db'];function respondWithStatusCode(_0x5bcdab,_0x287170){_0x287170=_0x287170||0xcc;return function(_0x3fb638){if(_0x3fb638){return _0x5bcdab[_0xddee('0x1b')](_0x287170);}return _0x5bcdab['status'](_0x287170)[_0xddee('0x1c')]();};}function respondWithResult(_0x1c05da,_0x270c7d){_0x270c7d=_0x270c7d||0xc8;return function(_0x4c8451){if(_0x4c8451){return _0x1c05da[_0xddee('0x1d')](_0x270c7d)[_0xddee('0x1e')](_0x4c8451);}};}function respondWithFilteredResult(_0x33f606,_0x45d8e2){return function(_0x9f2412){if(_0x9f2412){var _0x45ef0c=typeof _0x45d8e2[_0xddee('0x1f')]===_0xddee('0x20')&&typeof _0x45d8e2[_0xddee('0x21')]===_0xddee('0x20');var _0x12ef38=_0x9f2412[_0xddee('0x22')];var _0x191154=_0x45ef0c?0x0:_0x45d8e2[_0xddee('0x1f')];var _0x2ad1de=_0x45ef0c?_0x9f2412['count']:_0x45d8e2[_0xddee('0x1f')]+_0x45d8e2['limit'];var _0x40dfac;if(_0x2ad1de>=_0x12ef38){_0x2ad1de=_0x12ef38;_0x40dfac=0xc8;}else{_0x40dfac=0xce;}_0x33f606[_0xddee('0x1d')](_0x40dfac);return _0x33f606['set'](_0xddee('0x23'),_0x191154+'-'+_0x2ad1de+'/'+_0x12ef38)['json'](_0x9f2412);}return null;};}function patchUpdates(_0x42e67c){return function(_0x589683){try{jsonpatch['apply'](_0x589683,_0x42e67c,!![]);}catch(_0xa9ac6f){return BPromise[_0xddee('0x24')](_0xa9ac6f);}return _0x589683[_0xddee('0x25')]();};}function saveUpdates(_0x5498bd,_0xe89259){return function(_0x1148af){if(_0x1148af){return _0x1148af['update'](_0x5498bd)['then'](function(_0x40f7eb){return _0x40f7eb;});}return null;};}function removeEntity(_0x1c8dd8,_0x395f3a){return function(_0x417fc0){if(_0x417fc0){return _0x417fc0['destroy']()[_0xddee('0x26')](function(){_0x1c8dd8[_0xddee('0x1d')](0xcc)[_0xddee('0x1c')]();});}};}function handleEntityNotFound(_0x142633,_0x422c45){return function(_0x3e965f){if(!_0x3e965f){_0x142633[_0xddee('0x1b')](0x194);}return _0x3e965f;};}function handleError(_0x3c8fce,_0x535aaf){_0x535aaf=_0x535aaf||0x1f4;return function(_0x5eee7c){logger['error'](_0x5eee7c[_0xddee('0x27')]);if(_0x5eee7c[_0xddee('0x28')]){delete _0x5eee7c[_0xddee('0x28')];}_0x3c8fce[_0xddee('0x1d')](_0x535aaf)[_0xddee('0x29')](_0x5eee7c);};}exports[_0xddee('0x2a')]=function(_0x1d6903,_0x35aed5){var _0x3dafb6={},_0x8c764f={},_0x34512d={'count':0x0,'rows':[]};var _0x502825=_['map'](db['CmHopper'][_0xddee('0x2b')],function(_0x35deea){return{'name':_0x35deea['fieldName'],'type':_0x35deea[_0xddee('0x2c')][_0xddee('0x2d')]};});_0x8c764f['model']=_[_0xddee('0x2e')](_0x502825,_0xddee('0x28'));_0x8c764f[_0xddee('0x2f')]=_[_0xddee('0x30')](_0x1d6903[_0xddee('0x2f')]);_0x8c764f[_0xddee('0x31')]=_['intersection'](_0x8c764f[_0xddee('0x32')],_0x8c764f[_0xddee('0x2f')]);_0x8c764f[_0xddee('0x31')]=_[_0xddee('0x33')](_0x8c764f[_0xddee('0x31')],[_0xddee('0x34'),_0xddee('0x35'),_0xddee('0x36'),_0xddee('0x37'),_0xddee('0x38'),'$lte','$ne','$eq',_0xddee('0x39'),_0xddee('0x3a'),_0xddee('0x3b'),_0xddee('0x3c'),_0xddee('0x3d'),'$like','$notLike',_0xddee('0x3e'),_0xddee('0x3f'),_0xddee('0x40'),_0xddee('0x41'),_0xddee('0x42'),_0xddee('0x43'),_0xddee('0x44')]);_0x3dafb6[_0xddee('0x45')]=_[_0xddee('0x46')](_0x8c764f[_0xddee('0x32')],qs['fields'](_0x1d6903[_0xddee('0x2f')]['fields']));_0x3dafb6['attributes']=_0x3dafb6['attributes'][_0xddee('0x47')]?_0x3dafb6[_0xddee('0x45')]:_0x8c764f['model'];if(!_0x1d6903['query']['hasOwnProperty']('nolimit')){_0x3dafb6[_0xddee('0x21')]=qs[_0xddee('0x21')](_0x1d6903[_0xddee('0x2f')][_0xddee('0x21')]);_0x3dafb6['offset']=qs['offset'](_0x1d6903['query'][_0xddee('0x1f')]);}_0x3dafb6[_0xddee('0x48')]=qs[_0xddee('0x49')](_0x1d6903['query'][_0xddee('0x49')]);_0x3dafb6[_0xddee('0x4a')]=qs[_0xddee('0x31')](_[_0xddee('0x4b')](_0x1d6903[_0xddee('0x2f')],_0x8c764f['filters']),_0x502825);if(_0x1d6903[_0xddee('0x2f')][_0xddee('0x4c')]){_0x3dafb6[_0xddee('0x4a')]=_['merge'](_0x3dafb6['where'],{'$or':_[_0xddee('0x2e')](_0x502825,function(_0x146612){if(_0x146612[_0xddee('0x2c')]!==_0xddee('0x4d')){var _0x366bae={};_0x366bae[_0x146612['name']]={'$like':'%'+_0x1d6903[_0xddee('0x2f')][_0xddee('0x4c')]+'%'};return _0x366bae;}})});}_0x3dafb6=_[_0xddee('0x4e')]({},_0x3dafb6,_0x1d6903[_0xddee('0x4f')]);var _0x116463={'where':_0x3dafb6[_0xddee('0x4a')]};return db[_0xddee('0x50')][_0xddee('0x22')](_0x116463)[_0xddee('0x26')](function(_0x2ca97c){_0x34512d[_0xddee('0x22')]=_0x2ca97c;if(_0x1d6903[_0xddee('0x2f')]['includeAll']){_0x3dafb6[_0xddee('0x51')]=[{'all':!![]}];}return db['CmHopper'][_0xddee('0x52')](_0x3dafb6);})[_0xddee('0x26')](function(_0x5a7e05){_0x34512d[_0xddee('0x53')]=_0x5a7e05;return _0x34512d;})[_0xddee('0x26')](respondWithFilteredResult(_0x35aed5,_0x3dafb6))['catch'](handleError(_0x35aed5,null));};exports['show']=function(_0x110b27,_0x5d8eb6){var _0x156a98={'raw':!![],'where':{'id':_0x110b27[_0xddee('0x54')]['id']}},_0x3c33e3={};_0x3c33e3['model']=_[_0xddee('0x30')](db['CmHopper']['rawAttributes']);_0x3c33e3['query']=_[_0xddee('0x30')](_0x110b27[_0xddee('0x2f')]);_0x3c33e3['filters']=_[_0xddee('0x46')](_0x3c33e3['model'],_0x3c33e3['query']);_0x156a98[_0xddee('0x45')]=_['intersection'](_0x3c33e3[_0xddee('0x32')],qs[_0xddee('0x55')](_0x110b27[_0xddee('0x2f')][_0xddee('0x55')]));_0x156a98[_0xddee('0x45')]=_0x156a98[_0xddee('0x45')][_0xddee('0x47')]?_0x156a98[_0xddee('0x45')]:_0x3c33e3[_0xddee('0x32')];if(_0x110b27[_0xddee('0x2f')][_0xddee('0x56')]){_0x156a98[_0xddee('0x51')]=[{'all':!![]}];}_0x156a98=_['merge']({},_0x156a98,_0x110b27[_0xddee('0x4f')]);return db[_0xddee('0x50')][_0xddee('0x57')](_0x156a98)[_0xddee('0x26')](handleEntityNotFound(_0x5d8eb6,null))['then'](respondWithResult(_0x5d8eb6,null))[_0xddee('0x58')](handleError(_0x5d8eb6,null));};exports[_0xddee('0x59')]=function(_0x369609,_0x31ea15){return db[_0xddee('0x50')][_0xddee('0x59')](_0x369609[_0xddee('0x5a')],{})[_0xddee('0x26')](respondWithResult(_0x31ea15,0xc9))['catch'](handleError(_0x31ea15,null));};exports['update']=function(_0x16aeda,_0x29bc58){if(_0x16aeda['body']['id']){delete _0x16aeda[_0xddee('0x5a')]['id'];}return db[_0xddee('0x50')][_0xddee('0x57')]({'where':{'id':_0x16aeda['params']['id']}})[_0xddee('0x26')](handleEntityNotFound(_0x29bc58,null))[_0xddee('0x26')](saveUpdates(_0x16aeda[_0xddee('0x5a')],null))[_0xddee('0x26')](respondWithResult(_0x29bc58,null))['catch'](handleError(_0x29bc58,null));};exports['describe']=function(_0x1e2277,_0x1a1752){return db[_0xddee('0x50')][_0xddee('0x5b')]()[_0xddee('0x26')](respondWithResult(_0x1a1752,null))['catch'](handleError(_0x1a1752,null));};exports[_0xddee('0x5c')]=function(_0xb8fa15,_0x3a46e8){var _0x4e833e;return db[_0xddee('0x50')][_0xddee('0x57')]({'where':{'id':_0xb8fa15[_0xddee('0x54')]['id']}})[_0xddee('0x26')](handleEntityNotFound(_0x3a46e8,null))['then'](function(_0x40fe7a){if(_0x40fe7a){return _0x40fe7a['destroy']()['then'](function(_0x1b4559){return _0x1b4559;});}})[_0xddee('0x26')](function(_0x474c0d){_0x4e833e=_0x474c0d;if(_0x474c0d){if(_0x474c0d[_0xddee('0x5d')]||_0x474c0d[_0xddee('0x5e')]){return db[_0x474c0d['VoiceQueueId']?_0xddee('0x5f'):_0xddee('0x60')]['find']({'where':{'id':_0x474c0d[_0xddee('0x5d')]?_0x474c0d[_0xddee('0x5d')]:_0x474c0d[_0xddee('0x5e')]},'attributes':['id',_0xddee('0x28')],'raw':!![]});}}})['then'](function(_0x17b436){var _0x4c3e58={};if(_0x17b436){_['merge'](_0x4c3e58,_[_0xddee('0x61')](_0x4e833e['dataValues'],[_0xddee('0x62'),'updatedAt','id']));_0x4c3e58['state']=0x15;_0x4c3e58['statedesc']=_0xddee('0x63');_0x4c3e58[_0xddee('0x64')]=_0x17b436[_0xddee('0x28')];_0x4c3e58[_0xddee('0x65')]=_0xb8fa15[_0xddee('0x66')][_0xddee('0x28')];_0x4c3e58[_0xddee('0x67')]=_0xb8fa15['user']['id'];_0x4c3e58[_0xddee('0x63')]=!![];_0x4c3e58[_0xddee('0x68')]=moment()['format'](_0xddee('0x69'));_0x4c3e58[_0xddee('0x6a')]=_0x4e833e['phone'];_0x4c3e58['campaigntype']=_0x4e833e[_0xddee('0x5d')]?_0xddee('0x6b'):_0xddee('0x6c');return db['CmContact'][_0xddee('0x57')]({'where':{'id':_0x4c3e58[_0xddee('0x6d')]},'attributes':[_0xddee('0x6e'),_0xddee('0x6f')]})['then'](function(_0x5a892d){if(!_[_0xddee('0x70')](_0x3a46e8)&&!_[_0xddee('0x70')](_0x5a892d[_0xddee('0x6e')])){_0x4c3e58[_0xddee('0x71')]=_0x5a892d[_0xddee('0x6e')];if(!_[_0xddee('0x70')](_0x5a892d['lastName'])){_0x4c3e58[_0xddee('0x71')]+='\x20'+_0x5a892d[_0xddee('0x6f')];}}})[_0xddee('0x72')](function(){return db[_0xddee('0x73')][_0xddee('0x59')](_0x4c3e58);});}})[_0xddee('0x26')](function(){return _0x3a46e8[_0xddee('0x1d')](0xcc)[_0xddee('0x1c')]();})[_0xddee('0x58')](handleError(_0x3a46e8,null));};exports[_0xddee('0x74')]=function(_0x22dcca,_0x29847b,_0x3374c7){var _0x236922=[];return db[_0xddee('0x75')][_0xddee('0x5b')]()[_0xddee('0x26')](function(_0x29688e){_0x236922=_['keys'](_0x29688e);return _0x22dcca[_0xddee('0x66')][_0xddee('0x76')]({'where':{'type':_0xddee('0x77'),'dialActive':!![],'dialMethod':_0xddee('0x78')},'attributes':['id',_0xddee('0x79')],'raw':!![]});})['then'](function(_0x3e522e){if(_0x3e522e&&_0x3e522e[_0xddee('0x47')]){return db[_0xddee('0x7a')][_0xddee('0x7b')](function(_0x80e2c5){var _0x377ca2={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xddee('0x7c')](_0xddee('0x69'))},'VoiceQueueId':{'$in':_[_0xddee('0x2e')](_0x3e522e,'id')},'$or':[{'UserId':null},{'UserId':_0x22dcca['user']['id']}]};var _0x2fd398=[];if(_0x22dcca[_0xddee('0x5a')][_0xddee('0x7d')]&&_0x22dcca['body'][_0xddee('0x7d')]===_0xddee('0x7e')){if(!_[_0xddee('0x7f')](_0x22dcca[_0xddee('0x5a')][_0xddee('0x80')])){_0x377ca2['id']={'$in':_0x22dcca[_0xddee('0x5a')][_0xddee('0x80')]};}_0x2fd398=[[_0xddee('0x81'),_0xddee('0x82')],[_0xddee('0x83'),_0x3e522e[0x0][_0xddee('0x79')]==='ASC'?_0xddee('0x84'):_0xddee('0x82')],db[_0xddee('0x7a')][_0xddee('0x85')](_0xddee('0x86')),['id',_0xddee('0x84')]];}else{if(!_[_0xddee('0x7f')](_0x22dcca[_0xddee('0x5a')][_0xddee('0x80')])){_0x377ca2['id']={'$notIn':_0x22dcca[_0xddee('0x5a')][_0xddee('0x80')]};}_0x2fd398=[[_0xddee('0x81'),_0xddee('0x84')],[_0xddee('0x83'),_0x3e522e[0x0][_0xddee('0x79')]],db[_0xddee('0x7a')][_0xddee('0x85')](_0xddee('0x87')),['id','ASC']];}return db['CmHopper'][_0xddee('0x88')]({'attributes':['id','scheduledat'],'where':_0x377ca2,'order':_0x2fd398,'transaction':_0x80e2c5,'lock':_0x80e2c5['LOCK'][_0xddee('0x89')],'include':[{'model':db[_0xddee('0x75')],'as':_0xddee('0x8a'),'attributes':_0x236922,'include':[{'model':db[_0xddee('0x8b')],'as':_0xddee('0x8c'),'attributes':['id',_0xddee('0x28')]}]},{'model':db[_0xddee('0x8d')],'as':_0xddee('0x8e'),'attributes':['id','name']},{'model':db[_0xddee('0x5f')],'as':_0xddee('0x8f'),'attributes':['id',_0xddee('0x28'),_0xddee('0x90')]}]})[_0xddee('0x26')](function(_0x275cea){if(_0x275cea){return _0x275cea[_0xddee('0x91')]({'UserId':_0x22dcca[_0xddee('0x66')]['id']},{'transaction':_0x80e2c5});}});});}})['then'](handleEntityNotFound(_0x29847b,null))[_0xddee('0x26')](respondWithResult(_0x29847b,null))['catch'](handleError(_0x29847b,null));};exports[_0xddee('0x92')]=function(_0x9db6df,_0x468903,_0x3c48bf){return _0x9db6df[_0xddee('0x66')][_0xddee('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xddee('0x26')](function(_0x5a0632){if(_0x5a0632&&_0x5a0632[_0xddee('0x47')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xddee('0x7c')](_0xddee('0x69'))},'VoiceQueueId':{'$in':_['map'](_0x5a0632,'id')},'$or':[{'UserId':null},{'UserId':_0x9db6df[_0xddee('0x66')]['id']}]}});}return 0x0;})[_0xddee('0x26')](function(_0x1c5a19){if(!_[_0xddee('0x70')](_0x1c5a19)&&_[_0xddee('0x93')](_0x1c5a19)){return _0x468903[_0xddee('0x1d')](0xc8)[_0xddee('0x1e')]({'contacts':_0x1c5a19});}else{logger['error'](_0xddee('0x94'),'getOpenContacts',0x194,_0xddee('0x95'));_0x468903[_0xddee('0x1b')](0x194);}})['catch'](handleError(_0x468903,null));};exports[_0xddee('0x96')]=function(_0x39bb16,_0x1a8619,_0x4b6972){var _0x789d26=shared[_0xddee('0x97')];var _0x118e6a=[];_['map'](_0x789d26,function(_0x3b1005){_0x118e6a[_0xddee('0x98')]({'id':_0x3b1005[_0xddee('0x28')],'name':_0x3b1005['name'],'utcOffset':_0x3b1005[_0xddee('0x99')]});});return _0x1a8619[_0xddee('0x1d')](0xc8)['json']({'tz':_0x118e6a});};exports[_0xddee('0x9a')]=function(_0x25523d,_0x3fb924,_0xa73f6e){var _0x26b3fd=shared[_0xddee('0x97')];var _0x4ef0ec={};if(!_[_0xddee('0x70')](_0x26b3fd[_0x25523d[_0xddee('0x5a')]['id']]))_0x4ef0ec=_0x26b3fd[_0x25523d[_0xddee('0x5a')]['id']];return _0x3fb924[_0xddee('0x1d')](0xc8)['json'](_0x4ef0ec);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 9fc76b9..8d46a50 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 _0xacf4=['define','CmHopper','cm_hopper','scheduledat','phone','priority','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports'];(function(_0x6d3491,_0x2d2ce6){var _0x186351=function(_0x171b59){while(--_0x171b59){_0x6d3491['push'](_0x6d3491['shift']());}};_0x186351(++_0x2d2ce6);}(_0xacf4,0xe7));var _0x4acf=function(_0x4c08f8,_0x17f81e){_0x4c08f8=_0x4c08f8-0x0;var _0x5e8b4f=_0xacf4[_0x4c08f8];return _0x5e8b4f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[{'name':_0x4acf('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x4acf('0xd')]},{'name':'priority','fields':[_0x4acf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone'];(function(_0x558b01,_0x29ad59){var _0x372d59=function(_0x59a4e8){while(--_0x59a4e8){_0x558b01['push'](_0x558b01['shift']());}};_0x372d59(++_0x29ad59);}(_0x6d38,0x1ef));var _0x86d3=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x6d38[_0x173441];return _0x2423a8;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x86d3('0x9')]},{'name':_0x86d3('0xa'),'fields':[_0x86d3('0xa')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index e6fae91..ad8a3ac 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 _0x9e63=['create','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','UserId','LOCK','length','all','GetCmHopperPreview','keys','findOne','DESC','getContactByPhone','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetCmHopper','CmHopper','options','raw','where','include','map','model','attributes','find','ShowCmHopper','stringify','CreateCmHopper','body','UpdateCmHopper','update','limit','DestroyCmHopper','GetContactDialer','CmContact','findAll','order','UPDATE','Contact','User','Agent','name','voicePause','push','includes','sequelize','transaction','CmHopperFinal'];(function(_0x28ddb2,_0x323602){var _0x5e3c8d=function(_0x5ee188){while(--_0x5ee188){_0x28ddb2['push'](_0x28ddb2['shift']());}};_0x5e3c8d(++_0x323602);}(_0x9e63,0x65));var _0x39e6=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x9e63[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x39e6('0x0'));var util=require(_0x39e6('0x1'));var moment=require(_0x39e6('0x2'));var BPromise=require('bluebird');var rs=require(_0x39e6('0x3'));var fs=require('fs');var Redis=require(_0x39e6('0x4'));var db=require(_0x39e6('0x5'))['db'];var utils=require(_0x39e6('0x6'));var logger=require(_0x39e6('0x7'))(_0x39e6('0x8'));var config=require(_0x39e6('0x9'));var jayson=require(_0x39e6('0xa'));var client=jayson['client'][_0x39e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c2224,_0x3f2fa2,_0x554392){return new BPromise(function(_0x21938f,_0xddc291){return client['request'](_0x3c2224,_0x554392)[_0x39e6('0xc')](function(_0x4ee158){logger['info'](_0x39e6('0xd'),_0x3f2fa2,_0x39e6('0xe'));logger[_0x39e6('0xf')](_0x39e6('0x10'),_0x3f2fa2,_0x39e6('0xe'),JSON['stringify'](_0x4ee158));if(_0x4ee158['error']){if(_0x4ee158[_0x39e6('0x11')][_0x39e6('0x12')]===0x1f4){logger[_0x39e6('0x11')](_0x39e6('0xd'),_0x3f2fa2,_0x4ee158[_0x39e6('0x11')]['message']);return _0xddc291(_0x4ee158[_0x39e6('0x11')][_0x39e6('0x13')]);}logger[_0x39e6('0x11')](_0x39e6('0xd'),_0x3f2fa2,_0x4ee158['error']['message']);return _0x21938f(_0x4ee158[_0x39e6('0x11')][_0x39e6('0x13')]);}else{logger[_0x39e6('0x14')](_0x39e6('0xd'),_0x3f2fa2,_0x39e6('0xe'));_0x21938f(_0x4ee158['result'][_0x39e6('0x13')]);}})[_0x39e6('0x15')](function(_0x32ad13){logger[_0x39e6('0x11')](_0x39e6('0xd'),_0x3f2fa2,_0x32ad13);_0xddc291(_0x32ad13);});});}exports[_0x39e6('0x16')]=function(_0x1a3adf){var _0x512279=this;return new Promise(function(_0x24a61c,_0x3e6c74){return db[_0x39e6('0x17')]['findAll']({'raw':_0x1a3adf['options']?_0x1a3adf[_0x39e6('0x18')][_0x39e6('0x19')]===undefined?!![]:![]:!![],'where':_0x1a3adf[_0x39e6('0x18')]?_0x1a3adf[_0x39e6('0x18')][_0x39e6('0x1a')]||null:null,'attributes':_0x1a3adf['options']?_0x1a3adf[_0x39e6('0x18')]['attributes']||null:null,'limit':_0x1a3adf[_0x39e6('0x18')]?_0x1a3adf[_0x39e6('0x18')]['limit']||null:null,'include':_0x1a3adf[_0x39e6('0x18')]?_0x1a3adf[_0x39e6('0x18')][_0x39e6('0x1b')]?_[_0x39e6('0x1c')](_0x1a3adf[_0x39e6('0x18')][_0x39e6('0x1b')],function(_0x183f33){return{'model':db[_0x183f33[_0x39e6('0x1d')]],'as':_0x183f33['as'],'attributes':_0x183f33[_0x39e6('0x1e')],'include':_0x183f33[_0x39e6('0x1b')]?_[_0x39e6('0x1c')](_0x183f33[_0x39e6('0x1b')],function(_0x3dce4d){return{'model':db[_0x3dce4d['model']],'as':_0x3dce4d['as'],'attributes':_0x3dce4d[_0x39e6('0x1e')],'include':_0x3dce4d['include']?_['map'](_0x3dce4d[_0x39e6('0x1b')],function(_0x22b820){return{'model':db[_0x22b820[_0x39e6('0x1d')]],'as':_0x22b820['as'],'attributes':_0x22b820[_0x39e6('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39de88){logger[_0x39e6('0x14')]('GetCmHopper',_0x1a3adf);logger[_0x39e6('0xf')](_0x39e6('0x16'),_0x1a3adf,JSON['stringify'](_0x39de88));_0x24a61c(_0x39de88);})[_0x39e6('0x15')](function(_0x2117d0){logger[_0x39e6('0x11')](_0x39e6('0x16'),_0x2117d0[_0x39e6('0x13')],_0x1a3adf);_0x3e6c74(_0x512279['error'](0x1f4,_0x2117d0[_0x39e6('0x13')]));});});};exports['ShowCmHopper']=function(_0x355ad9){var _0x14c4d3=this;return new Promise(function(_0x3db607,_0x3c01e9){return db[_0x39e6('0x17')][_0x39e6('0x1f')]({'raw':_0x355ad9[_0x39e6('0x18')]?_0x355ad9[_0x39e6('0x18')][_0x39e6('0x19')]===undefined?!![]:![]:!![],'where':_0x355ad9[_0x39e6('0x18')]?_0x355ad9[_0x39e6('0x18')][_0x39e6('0x1a')]||null:null,'attributes':_0x355ad9[_0x39e6('0x18')]?_0x355ad9[_0x39e6('0x18')][_0x39e6('0x1e')]||null:null,'include':_0x355ad9[_0x39e6('0x18')]?_0x355ad9['options'][_0x39e6('0x1b')]?_[_0x39e6('0x1c')](_0x355ad9[_0x39e6('0x18')]['include'],function(_0x11b0c3){return{'model':db[_0x11b0c3[_0x39e6('0x1d')]],'as':_0x11b0c3['as'],'attributes':_0x11b0c3[_0x39e6('0x1e')],'include':_0x11b0c3['include']?_[_0x39e6('0x1c')](_0x11b0c3['include'],function(_0x15d6db){return{'model':db[_0x15d6db[_0x39e6('0x1d')]],'as':_0x15d6db['as'],'attributes':_0x15d6db[_0x39e6('0x1e')],'include':_0x15d6db['include']?_[_0x39e6('0x1c')](_0x15d6db[_0x39e6('0x1b')],function(_0x45c327){return{'model':db[_0x45c327[_0x39e6('0x1d')]],'as':_0x45c327['as'],'attributes':_0x45c327['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xbe8b5){logger[_0x39e6('0x14')](_0x39e6('0x20'),_0x355ad9);logger[_0x39e6('0xf')](_0x39e6('0x20'),_0x355ad9,JSON[_0x39e6('0x21')](_0xbe8b5));_0x3db607(_0xbe8b5);})[_0x39e6('0x15')](function(_0x4e0a01){logger[_0x39e6('0x11')]('ShowCmHopper',_0x4e0a01['message'],_0x355ad9);_0x3c01e9(_0x14c4d3[_0x39e6('0x11')](0x1f4,_0x4e0a01[_0x39e6('0x13')]));});});};exports[_0x39e6('0x22')]=function(_0x46ede2){var _0x1f92b2=this;return new Promise(function(_0x380663,_0x3811ad){return db[_0x39e6('0x17')]['create'](_0x46ede2[_0x39e6('0x23')],{'raw':_0x46ede2[_0x39e6('0x18')]?_0x46ede2[_0x39e6('0x18')][_0x39e6('0x19')]===undefined?!![]:![]:!![]})[_0x39e6('0xc')](function(_0x52d536){logger['info'](_0x39e6('0x22'),_0x46ede2);logger[_0x39e6('0xf')]('CreateCmHopper',_0x46ede2,JSON[_0x39e6('0x21')](_0x52d536));_0x380663(_0x52d536);})[_0x39e6('0x15')](function(_0x5a440c){logger['error'](_0x39e6('0x22'),_0x5a440c[_0x39e6('0x13')],_0x46ede2);_0x3811ad(_0x1f92b2['error'](0x1f4,_0x5a440c[_0x39e6('0x13')]));});});};exports[_0x39e6('0x24')]=function(_0x40f93b){var _0x2f3021=this;return new Promise(function(_0x3f8b5f,_0x3bdd55){return db[_0x39e6('0x17')][_0x39e6('0x25')](_0x40f93b['body'],{'raw':_0x40f93b[_0x39e6('0x18')]?_0x40f93b[_0x39e6('0x18')][_0x39e6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40f93b['options']?_0x40f93b['options'][_0x39e6('0x1a')]||null:null,'attributes':_0x40f93b[_0x39e6('0x18')]?_0x40f93b[_0x39e6('0x18')][_0x39e6('0x1e')]||null:null,'limit':_0x40f93b[_0x39e6('0x18')]?_0x40f93b[_0x39e6('0x18')][_0x39e6('0x26')]||null:null})['then'](function(_0x59a8a5){logger['info'](_0x39e6('0x24'),_0x40f93b);logger['debug'](_0x39e6('0x24'),_0x40f93b,JSON[_0x39e6('0x21')](_0x59a8a5));_0x3f8b5f(_0x59a8a5);})[_0x39e6('0x15')](function(_0x8ad15c){logger[_0x39e6('0x11')](_0x39e6('0x24'),_0x8ad15c[_0x39e6('0x13')],_0x40f93b);_0x3bdd55(_0x2f3021[_0x39e6('0x11')](0x1f4,_0x8ad15c[_0x39e6('0x13')]));});});};exports[_0x39e6('0x27')]=function(_0x5b4a77){var _0x30e78d=this;return new Promise(function(_0x446acd,_0x2f451c){return db[_0x39e6('0x17')]['destroy']({'where':_0x5b4a77['options']?_0x5b4a77[_0x39e6('0x18')]['where']||null:null})[_0x39e6('0xc')](function(_0x7de620){logger['info'](_0x39e6('0x27'),_0x5b4a77);logger[_0x39e6('0xf')](_0x39e6('0x27'),_0x5b4a77,JSON[_0x39e6('0x21')](_0x7de620));_0x446acd(_0x7de620);})[_0x39e6('0x15')](function(_0x39ff77){logger[_0x39e6('0x11')](_0x39e6('0x27'),_0x39ff77[_0x39e6('0x13')],_0x5b4a77);_0x2f451c(_0x30e78d[_0x39e6('0x11')](0x1f4,_0x39ff77[_0x39e6('0x13')]));});});};exports[_0x39e6('0x28')]=function(_0xb468b9){var _0xadbdf8=this;return new Promise(function(_0x13e478,_0x12ee54){return db[_0x39e6('0x29')]['describe']()[_0x39e6('0xc')](function(_0x549aa9){return db['sequelize']['transaction'](function(_0x28e645){return db[_0x39e6('0x17')][_0x39e6('0x2a')]({'where':_0xb468b9['options']?_0xb468b9['options'][_0x39e6('0x1a')]||null:null,'attributes':_0xb468b9['options']?_0xb468b9[_0x39e6('0x18')][_0x39e6('0x1e')]||null:null,'limit':_0xb468b9[_0x39e6('0x18')]?_0xb468b9['options'][_0x39e6('0x26')]||null:null,'order':_0xb468b9[_0x39e6('0x18')]?_0xb468b9['options'][_0x39e6('0x2b')]||null:null,'transaction':_0x28e645,'lock':_0x28e645['LOCK'][_0x39e6('0x2c')],'include':[{'model':db[_0x39e6('0x29')],'as':_0x39e6('0x2d'),'attributes':_['keys'](_0x549aa9)},{'model':db[_0x39e6('0x2e')],'as':_0x39e6('0x2f'),'attributes':['id',_0x39e6('0x30'),_0x39e6('0x31')]}]})['then'](function(_0xf7732c){var _0x26d733=[];var _0x34c885=[];for(var _0x529020=0x0;_0x529020<_0xf7732c['length'];_0x529020+=0x1){var _0x4c13a1=_0xf7732c[_0x529020]['UserId'];if(_0x4c13a1===null){_0x26d733[_0x39e6('0x32')](_0xf7732c[_0x529020][_0x39e6('0x25')](_0xb468b9[_0x39e6('0x23')],{'transaction':_0x28e645}));}else if(!_0x34c885[_0x39e6('0x33')](_0x4c13a1)){_0x34c885[_0x39e6('0x32')](_0x4c13a1);_0x26d733[_0x39e6('0x32')](_0xf7732c[_0x529020][_0x39e6('0x25')](_0xb468b9[_0x39e6('0x23')],{'transaction':_0x28e645}));}}return BPromise['all'](_0x26d733);});})[_0x39e6('0xc')](function(_0x5aae65){logger[_0x39e6('0x14')](_0x39e6('0x28'),_0xb468b9);logger[_0x39e6('0xf')](_0x39e6('0x28'),_0xb468b9,JSON[_0x39e6('0x21')](_0x5aae65));_0x13e478(_0x5aae65);})['catch'](function(_0x5ad7d5){logger[_0x39e6('0x11')](_0x39e6('0x28'),_0x5ad7d5[_0x39e6('0x13')],_0xb468b9);_0x12ee54(_0xadbdf8['error'](0x1f4,_0x5ad7d5[_0x39e6('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x1d4cf5){var _0x2015a8=this;return new Promise(function(_0x9abcb,_0x85f516){return db[_0x39e6('0x34')][_0x39e6('0x35')](function(_0x3554b0){return db[_0x39e6('0x36')][_0x39e6('0x37')](_0x1d4cf5[_0x39e6('0x23')],{'raw':_0x1d4cf5[_0x39e6('0x18')]?_0x1d4cf5[_0x39e6('0x18')]['raw']===undefined?!![]:![]:!![],'transaction':_0x3554b0})[_0x39e6('0xc')](function(){return db[_0x39e6('0x17')][_0x39e6('0x38')]({'where':_0x1d4cf5[_0x39e6('0x18')]?_0x1d4cf5[_0x39e6('0x18')][_0x39e6('0x1a')]||null:null,'transaction':_0x3554b0});});})[_0x39e6('0xc')](function(_0x479d16){logger['info'](_0x39e6('0x39'),_0x1d4cf5);logger[_0x39e6('0xf')](_0x39e6('0x39'),_0x1d4cf5,JSON['stringify'](_0x479d16));_0x9abcb(_0x479d16);})[_0x39e6('0x15')](function(_0x2d8863){logger[_0x39e6('0x11')](_0x39e6('0x39'),_0x2d8863[_0x39e6('0x13')],_0x1d4cf5);_0x85f516(_0x2015a8[_0x39e6('0x11')](0x1f4,_0x2d8863['message']));});});};exports[_0x39e6('0x3a')]=function(_0x23dfc9){var _0x1acced=this;return new Promise(function(_0x122d29,_0x15007e){return db[_0x39e6('0x17')]['findAll']({'raw':_0x23dfc9[_0x39e6('0x18')]?_0x23dfc9[_0x39e6('0x18')][_0x39e6('0x19')]===undefined?!![]:![]:!![],'where':_0x23dfc9[_0x39e6('0x18')]?_0x23dfc9[_0x39e6('0x18')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x39e6('0x3b'),db[_0x39e6('0x34')]['fn']('IF',db[_0x39e6('0x34')][_0x39e6('0x3c')](_0x39e6('0x3d')+util[_0x39e6('0x3e')](_0x39e6('0x3f'),moment()[_0x39e6('0x3e')](_0x39e6('0x40')))+_0x39e6('0x41')))),_0x39e6('0x42')]]})[_0x39e6('0xc')](function(_0x5d9a2f){logger[_0x39e6('0x14')](_0x39e6('0x3a'),_0x23dfc9);logger[_0x39e6('0xf')](_0x39e6('0x3a'),_0x23dfc9,JSON[_0x39e6('0x21')](_0x5d9a2f));_0x122d29(_0x5d9a2f);})[_0x39e6('0x15')](function(_0x4f7ab0){logger[_0x39e6('0x11')](_0x39e6('0x3a'),_0x4f7ab0[_0x39e6('0x13')],_0x23dfc9);_0x15007e(_0x1acced[_0x39e6('0x11')](0x1f4,_0x4f7ab0['message']));});});};exports[_0x39e6('0x43')]=function(_0x14114c){var _0x508bce=this;return new Promise(function(_0x5f4069,_0x13b076){return db[_0x39e6('0x29')][_0x39e6('0x44')]()[_0x39e6('0xc')](function(_0x5e73bf){return db[_0x39e6('0x34')][_0x39e6('0x35')](function(_0x343189){return db[_0x39e6('0x17')][_0x39e6('0x2a')]({'where':_0x14114c['options']?_0x14114c[_0x39e6('0x18')][_0x39e6('0x1a')]||null:null,'attributes':_0x14114c[_0x39e6('0x18')]?_0x14114c[_0x39e6('0x18')][_0x39e6('0x1e')]||null:null,'limit':0x1,'order':_0x14114c[_0x39e6('0x18')]?_0x14114c[_0x39e6('0x18')][_0x39e6('0x2b')]||null:null,'group':db[_0x39e6('0x17')][_0x39e6('0x45')],'transaction':_0x343189,'lock':_0x343189[_0x39e6('0x46')][_0x39e6('0x2c')],'include':_0x14114c[_0x39e6('0x18')]?_0x14114c['options'][_0x39e6('0x1b')]?_[_0x39e6('0x1c')](_0x14114c[_0x39e6('0x18')][_0x39e6('0x1b')],function(_0x23e452){return{'model':db[_0x23e452['model']],'as':_0x23e452['as'],'attributes':_0x23e452[_0x39e6('0x1e')],'include':_0x23e452[_0x39e6('0x1b')]?_[_0x39e6('0x1c')](_0x23e452['include'],function(_0x3a6d0f){return{'model':db[_0x3a6d0f[_0x39e6('0x1d')]],'as':_0x3a6d0f['as'],'attributes':_0x3a6d0f[_0x39e6('0x1e')],'include':_0x3a6d0f['include']?_[_0x39e6('0x1c')](_0x3a6d0f[_0x39e6('0x1b')],function(_0x34b1e5){return{'model':db[_0x34b1e5[_0x39e6('0x1d')]],'as':_0x34b1e5['as'],'attributes':_0x34b1e5[_0x39e6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x39e6('0xc')](function(_0x11753c){var _0x229430=[];for(var _0x4ef23a=0x0;_0x4ef23a<_0x11753c[_0x39e6('0x47')];_0x4ef23a+=0x1){_0x229430[_0x39e6('0x32')](_0x11753c[_0x4ef23a][_0x39e6('0x25')](_0x14114c[_0x39e6('0x23')],{'transaction':_0x343189}));}return BPromise[_0x39e6('0x48')](_0x229430);});})[_0x39e6('0xc')](function(_0xc926ee){logger[_0x39e6('0x14')](_0x39e6('0x43'),_0x14114c);logger[_0x39e6('0xf')](_0x39e6('0x43'),_0x14114c,JSON['stringify'](_0xc926ee));_0x5f4069(_0xc926ee);})['catch'](function(_0x5424ff){logger[_0x39e6('0x11')](_0x39e6('0x43'),_0x5424ff[_0x39e6('0x13')],_0x14114c);_0x13b076(_0x508bce['error'](0x1f4,_0x5424ff[_0x39e6('0x13')]));});});});};exports[_0x39e6('0x49')]=function(_0x2d8ff9){var _0x31b78f=this;return new Promise(function(_0x3cb54b,_0x3c09e9){db[_0x39e6('0x29')][_0x39e6('0x44')]()[_0x39e6('0xc')](function(_0x512e9e){return db[_0x39e6('0x17')]['findAll']({'raw':_0x2d8ff9[_0x39e6('0x18')]?_0x2d8ff9[_0x39e6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2d8ff9[_0x39e6('0x18')]?_0x2d8ff9['options'][_0x39e6('0x1a')]||null:null,'attributes':_0x2d8ff9[_0x39e6('0x18')]?_0x2d8ff9[_0x39e6('0x18')][_0x39e6('0x1e')]||null:null,'limit':_0x2d8ff9[_0x39e6('0x18')]?_0x2d8ff9['options']['limit']||null:null,'include':_0x2d8ff9['options']?_0x2d8ff9[_0x39e6('0x18')][_0x39e6('0x1b')]?_[_0x39e6('0x1c')](_0x2d8ff9[_0x39e6('0x18')][_0x39e6('0x1b')],function(_0x724011){return{'model':db[_0x724011[_0x39e6('0x1d')]],'as':_0x724011['as'],'attributes':_0x724011['as']==='Contact'?_[_0x39e6('0x4a')](_0x512e9e):_0x724011[_0x39e6('0x1e')],'include':_0x724011[_0x39e6('0x1b')]?_[_0x39e6('0x1c')](_0x724011['include'],function(_0x2a4958){return{'model':db[_0x2a4958[_0x39e6('0x1d')]],'as':_0x2a4958['as'],'attributes':_0x2a4958['attributes'],'include':_0x2a4958[_0x39e6('0x1b')]?_[_0x39e6('0x1c')](_0x2a4958[_0x39e6('0x1b')],function(_0x5b3853){return{'model':db[_0x5b3853[_0x39e6('0x1d')]],'as':_0x5b3853['as'],'attributes':_0x5b3853[_0x39e6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x39e6('0xc')](function(_0x4cb13a){logger['info'](_0x39e6('0x16'),_0x2d8ff9);logger[_0x39e6('0xf')](_0x39e6('0x16'),_0x2d8ff9,JSON[_0x39e6('0x21')](_0x4cb13a));_0x3cb54b(_0x4cb13a);})['catch'](function(_0x1ac1a9){logger['error']('GetCmHopper',_0x1ac1a9[_0x39e6('0x13')],_0x2d8ff9);_0x3c09e9(_0x31b78f[_0x39e6('0x11')](0x1f4,_0x1ac1a9[_0x39e6('0x13')]));});});});};exports['GetContactByPhone']=function(_0x25af8b){_this=this;return new Promise(function(_0x2fa31a,_0x391822){return db['CmContact'][_0x39e6('0x4b')]({'raw':!![],'where':{'phone':_0x25af8b[_0x39e6('0x18')][_0x39e6('0x1a')]['phone']},'attributes':['id','dialTimezone'],'order':[['id',_0x39e6('0x4c')]]})['then'](function(_0x1872e3){logger[_0x39e6('0x14')](_0x39e6('0x4d'),_0x25af8b);logger[_0x39e6('0xf')](_0x39e6('0x4d'),_0x25af8b,JSON[_0x39e6('0x21')](_0x1872e3));_0x2fa31a(_0x1872e3);})[_0x39e6('0x15')](function(_0x27ad81){logger['error'](_0x39e6('0x4d'),_0x27ad81['message'],_0x25af8b);_0x391822(_this[_0x39e6('0x11')](0x1f4,_0x27ad81['message']));});});}; \ No newline at end of file +var _0x110e=['order','LOCK','UPDATE','keys','Agent','name','length','UserId','push','includes','GetContactDialer','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','describe','model','all','GetCmHopperPreview','Contact','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','then','info','request\x20sent','debug','stringify','error','message','CmHopper,\x20%s,\x20%s','result','findAll','options','raw','where','attributes','limit','include','map','GetCmHopper','ShowCmHopper','CmHopper','find','catch','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','CmContact','transaction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x110e,0x68));var _0xe110=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x110e[_0x42bdad];return _0x122626;};'use strict';var _=require(_0xe110('0x0'));var util=require(_0xe110('0x1'));var moment=require('moment');var BPromise=require(_0xe110('0x2'));var rs=require(_0xe110('0x3'));var fs=require('fs');var Redis=require(_0xe110('0x4'));var db=require(_0xe110('0x5'))['db'];var utils=require(_0xe110('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe110('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dd83c,_0x1ebbac,_0x2b69c5){return new BPromise(function(_0x23c5ae,_0x44050a){return client[_0xe110('0x8')](_0x3dd83c,_0x2b69c5)[_0xe110('0x9')](function(_0x3c194a){logger[_0xe110('0xa')]('CmHopper,\x20%s,\x20%s',_0x1ebbac,_0xe110('0xb'));logger[_0xe110('0xc')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x1ebbac,_0xe110('0xb'),JSON[_0xe110('0xd')](_0x3c194a));if(_0x3c194a[_0xe110('0xe')]){if(_0x3c194a[_0xe110('0xe')]['code']===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x1ebbac,_0x3c194a[_0xe110('0xe')][_0xe110('0xf')]);return _0x44050a(_0x3c194a['error']['message']);}logger['error'](_0xe110('0x10'),_0x1ebbac,_0x3c194a[_0xe110('0xe')]['message']);return _0x23c5ae(_0x3c194a['error'][_0xe110('0xf')]);}else{logger['info'](_0xe110('0x10'),_0x1ebbac,_0xe110('0xb'));_0x23c5ae(_0x3c194a[_0xe110('0x11')][_0xe110('0xf')]);}})['catch'](function(_0xa23c0c){logger[_0xe110('0xe')]('CmHopper,\x20%s,\x20%s',_0x1ebbac,_0xa23c0c);_0x44050a(_0xa23c0c);});});}exports['GetCmHopper']=function(_0x683cb9){var _0x5bebda=this;return new Promise(function(_0x3575c4,_0x176eef){return db['CmHopper'][_0xe110('0x12')]({'raw':_0x683cb9[_0xe110('0x13')]?_0x683cb9[_0xe110('0x13')][_0xe110('0x14')]===undefined?!![]:![]:!![],'where':_0x683cb9[_0xe110('0x13')]?_0x683cb9['options'][_0xe110('0x15')]||null:null,'attributes':_0x683cb9[_0xe110('0x13')]?_0x683cb9['options'][_0xe110('0x16')]||null:null,'limit':_0x683cb9[_0xe110('0x13')]?_0x683cb9[_0xe110('0x13')][_0xe110('0x17')]||null:null,'include':_0x683cb9[_0xe110('0x13')]?_0x683cb9[_0xe110('0x13')][_0xe110('0x18')]?_[_0xe110('0x19')](_0x683cb9[_0xe110('0x13')][_0xe110('0x18')],function(_0x2cef74){return{'model':db[_0x2cef74['model']],'as':_0x2cef74['as'],'attributes':_0x2cef74[_0xe110('0x16')],'include':_0x2cef74[_0xe110('0x18')]?_[_0xe110('0x19')](_0x2cef74[_0xe110('0x18')],function(_0x374ccf){return{'model':db[_0x374ccf['model']],'as':_0x374ccf['as'],'attributes':_0x374ccf['attributes'],'include':_0x374ccf[_0xe110('0x18')]?_['map'](_0x374ccf[_0xe110('0x18')],function(_0x578464){return{'model':db[_0x578464['model']],'as':_0x578464['as'],'attributes':_0x578464['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ec248){logger['info'](_0xe110('0x1a'),_0x683cb9);logger[_0xe110('0xc')]('GetCmHopper',_0x683cb9,JSON['stringify'](_0x3ec248));_0x3575c4(_0x3ec248);})['catch'](function(_0x5b76ce){logger['error'](_0xe110('0x1a'),_0x5b76ce[_0xe110('0xf')],_0x683cb9);_0x176eef(_0x5bebda[_0xe110('0xe')](0x1f4,_0x5b76ce[_0xe110('0xf')]));});});};exports[_0xe110('0x1b')]=function(_0x480eb6){var _0x45a3f9=this;return new Promise(function(_0x53e1d3,_0x1da4b4){return db[_0xe110('0x1c')][_0xe110('0x1d')]({'raw':_0x480eb6['options']?_0x480eb6[_0xe110('0x13')][_0xe110('0x14')]===undefined?!![]:![]:!![],'where':_0x480eb6[_0xe110('0x13')]?_0x480eb6['options']['where']||null:null,'attributes':_0x480eb6['options']?_0x480eb6[_0xe110('0x13')][_0xe110('0x16')]||null:null,'include':_0x480eb6[_0xe110('0x13')]?_0x480eb6[_0xe110('0x13')][_0xe110('0x18')]?_[_0xe110('0x19')](_0x480eb6[_0xe110('0x13')][_0xe110('0x18')],function(_0x1b0ed8){return{'model':db[_0x1b0ed8['model']],'as':_0x1b0ed8['as'],'attributes':_0x1b0ed8[_0xe110('0x16')],'include':_0x1b0ed8['include']?_[_0xe110('0x19')](_0x1b0ed8['include'],function(_0x2b7a15){return{'model':db[_0x2b7a15['model']],'as':_0x2b7a15['as'],'attributes':_0x2b7a15['attributes'],'include':_0x2b7a15[_0xe110('0x18')]?_[_0xe110('0x19')](_0x2b7a15[_0xe110('0x18')],function(_0x57c8b3){return{'model':db[_0x57c8b3['model']],'as':_0x57c8b3['as'],'attributes':_0x57c8b3[_0xe110('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe110('0x9')](function(_0x50a07b){logger[_0xe110('0xa')](_0xe110('0x1b'),_0x480eb6);logger[_0xe110('0xc')](_0xe110('0x1b'),_0x480eb6,JSON[_0xe110('0xd')](_0x50a07b));_0x53e1d3(_0x50a07b);})[_0xe110('0x1e')](function(_0x295ecf){logger[_0xe110('0xe')](_0xe110('0x1b'),_0x295ecf[_0xe110('0xf')],_0x480eb6);_0x1da4b4(_0x45a3f9['error'](0x1f4,_0x295ecf[_0xe110('0xf')]));});});};exports[_0xe110('0x1f')]=function(_0x44543b){var _0x273cb3=this;return new Promise(function(_0x17b421,_0x38889a){return db[_0xe110('0x1c')][_0xe110('0x20')](_0x44543b[_0xe110('0x21')],{'raw':_0x44543b[_0xe110('0x13')]?_0x44543b[_0xe110('0x13')][_0xe110('0x14')]===undefined?!![]:![]:!![]})[_0xe110('0x9')](function(_0x589535){logger[_0xe110('0xa')](_0xe110('0x1f'),_0x44543b);logger[_0xe110('0xc')](_0xe110('0x1f'),_0x44543b,JSON['stringify'](_0x589535));_0x17b421(_0x589535);})[_0xe110('0x1e')](function(_0x232dd0){logger['error']('CreateCmHopper',_0x232dd0[_0xe110('0xf')],_0x44543b);_0x38889a(_0x273cb3['error'](0x1f4,_0x232dd0[_0xe110('0xf')]));});});};exports[_0xe110('0x22')]=function(_0x3ec60d){var _0x2e4bf2=this;return new Promise(function(_0x2e2a21,_0x55425c){return db[_0xe110('0x1c')][_0xe110('0x23')](_0x3ec60d[_0xe110('0x21')],{'raw':_0x3ec60d['options']?_0x3ec60d[_0xe110('0x13')][_0xe110('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ec60d['options']?_0x3ec60d[_0xe110('0x13')][_0xe110('0x15')]||null:null,'attributes':_0x3ec60d[_0xe110('0x13')]?_0x3ec60d['options'][_0xe110('0x16')]||null:null,'limit':_0x3ec60d[_0xe110('0x13')]?_0x3ec60d['options'][_0xe110('0x17')]||null:null})['then'](function(_0x5ec52d){logger[_0xe110('0xa')]('UpdateCmHopper',_0x3ec60d);logger[_0xe110('0xc')]('UpdateCmHopper',_0x3ec60d,JSON['stringify'](_0x5ec52d));_0x2e2a21(_0x5ec52d);})[_0xe110('0x1e')](function(_0x48196c){logger['error']('UpdateCmHopper',_0x48196c[_0xe110('0xf')],_0x3ec60d);_0x55425c(_0x2e4bf2[_0xe110('0xe')](0x1f4,_0x48196c[_0xe110('0xf')]));});});};exports[_0xe110('0x24')]=function(_0x1be128){var _0x58d75a=this;return new Promise(function(_0x16e891,_0x33ee76){return db['CmHopper'][_0xe110('0x25')]({'where':_0x1be128['options']?_0x1be128[_0xe110('0x13')][_0xe110('0x15')]||null:null})[_0xe110('0x9')](function(_0x34f0b2){logger[_0xe110('0xa')](_0xe110('0x24'),_0x1be128);logger[_0xe110('0xc')](_0xe110('0x24'),_0x1be128,JSON[_0xe110('0xd')](_0x34f0b2));_0x16e891(_0x34f0b2);})[_0xe110('0x1e')](function(_0x567c4a){logger['error']('DestroyCmHopper',_0x567c4a[_0xe110('0xf')],_0x1be128);_0x33ee76(_0x58d75a[_0xe110('0xe')](0x1f4,_0x567c4a['message']));});});};exports['GetContactDialer']=function(_0x3915bc){var _0x541eab=this;return new Promise(function(_0x26eb00,_0x6f0e33){return db[_0xe110('0x26')]['describe']()[_0xe110('0x9')](function(_0x5a0a4d){return db['sequelize'][_0xe110('0x27')](function(_0x319417){return db[_0xe110('0x1c')]['findAll']({'where':_0x3915bc[_0xe110('0x13')]?_0x3915bc[_0xe110('0x13')][_0xe110('0x15')]||null:null,'attributes':_0x3915bc[_0xe110('0x13')]?_0x3915bc['options'][_0xe110('0x16')]||null:null,'limit':_0x3915bc['options']?_0x3915bc[_0xe110('0x13')][_0xe110('0x17')]||null:null,'order':_0x3915bc[_0xe110('0x13')]?_0x3915bc[_0xe110('0x13')][_0xe110('0x28')]||null:null,'transaction':_0x319417,'lock':_0x319417[_0xe110('0x29')][_0xe110('0x2a')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0xe110('0x2b')](_0x5a0a4d)},{'model':db['User'],'as':_0xe110('0x2c'),'attributes':['id',_0xe110('0x2d'),'voicePause']}]})['then'](function(_0x337690){var _0x18d3ed=[];var _0x2b7c06=[];for(var _0x1fc0a5=0x0;_0x1fc0a5<_0x337690[_0xe110('0x2e')];_0x1fc0a5+=0x1){var _0x4670b1=_0x337690[_0x1fc0a5][_0xe110('0x2f')];if(_0x4670b1===null){_0x18d3ed[_0xe110('0x30')](_0x337690[_0x1fc0a5][_0xe110('0x23')](_0x3915bc[_0xe110('0x21')],{'transaction':_0x319417}));}else if(!_0x2b7c06[_0xe110('0x31')](_0x4670b1)){_0x2b7c06[_0xe110('0x30')](_0x4670b1);_0x18d3ed[_0xe110('0x30')](_0x337690[_0x1fc0a5]['update'](_0x3915bc[_0xe110('0x21')],{'transaction':_0x319417}));}}return BPromise['all'](_0x18d3ed);});})[_0xe110('0x9')](function(_0x301678){logger['info']('GetContactDialer',_0x3915bc);logger[_0xe110('0xc')]('GetContactDialer',_0x3915bc,JSON[_0xe110('0xd')](_0x301678));_0x26eb00(_0x301678);})[_0xe110('0x1e')](function(_0x583106){logger['error'](_0xe110('0x32'),_0x583106['message'],_0x3915bc);_0x6f0e33(_0x541eab[_0xe110('0xe')](0x1f4,_0x583106[_0xe110('0xf')]));});});});};exports[_0xe110('0x33')]=function(_0xc4a6e1){var _0x23c190=this;return new Promise(function(_0x2e4ddc,_0x4362a0){return db[_0xe110('0x34')][_0xe110('0x27')](function(_0x4dc308){return db[_0xe110('0x35')][_0xe110('0x20')](_0xc4a6e1[_0xe110('0x21')],{'raw':_0xc4a6e1[_0xe110('0x13')]?_0xc4a6e1['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x4dc308})[_0xe110('0x9')](function(){return db[_0xe110('0x1c')][_0xe110('0x25')]({'where':_0xc4a6e1['options']?_0xc4a6e1[_0xe110('0x13')][_0xe110('0x15')]||null:null,'transaction':_0x4dc308});});})['then'](function(_0x3c8981){logger[_0xe110('0xa')]('MoveContactManagedDialer',_0xc4a6e1);logger['debug'](_0xe110('0x33'),_0xc4a6e1,JSON['stringify'](_0x3c8981));_0x2e4ddc(_0x3c8981);})[_0xe110('0x1e')](function(_0xb0561e){logger[_0xe110('0xe')](_0xe110('0x33'),_0xb0561e[_0xe110('0xf')],_0xc4a6e1);_0x4362a0(_0x23c190[_0xe110('0xe')](0x1f4,_0xb0561e[_0xe110('0xf')]));});});};exports[_0xe110('0x36')]=function(_0x591561){var _0x3ded64=this;return new Promise(function(_0x4c7dc9,_0x38a1fe){return db['CmHopper'][_0xe110('0x12')]({'raw':_0x591561['options']?_0x591561['options'][_0xe110('0x14')]===undefined?!![]:![]:!![],'where':_0x591561[_0xe110('0x13')]?_0x591561[_0xe110('0x13')][_0xe110('0x15')]||null:null,'attributes':[[db[_0xe110('0x34')]['fn']('COUNT',db[_0xe110('0x34')]['fn']('IF',db[_0xe110('0x34')][_0xe110('0x37')]('`scheduledat`\x20>=\x20'+util[_0xe110('0x38')](_0xe110('0x39'),moment()[_0xe110('0x38')](_0xe110('0x3a')))+_0xe110('0x3b')))),'contactsRescheduled']]})[_0xe110('0x9')](function(_0x36c6e4){logger[_0xe110('0xa')](_0xe110('0x36'),_0x591561);logger[_0xe110('0xc')]('CountReScheduled',_0x591561,JSON['stringify'](_0x36c6e4));_0x4c7dc9(_0x36c6e4);})[_0xe110('0x1e')](function(_0x4234d9){logger['error']('CountReScheduled',_0x4234d9['message'],_0x591561);_0x38a1fe(_0x3ded64[_0xe110('0xe')](0x1f4,_0x4234d9[_0xe110('0xf')]));});});};exports[_0xe110('0x3c')]=function(_0x249ca9){var _0xcdf324=this;return new Promise(function(_0x2c6143,_0x5234d7){return db['CmContact'][_0xe110('0x3d')]()[_0xe110('0x9')](function(_0x38176d){return db[_0xe110('0x34')][_0xe110('0x27')](function(_0x1fdca4){return db['CmHopper'][_0xe110('0x12')]({'where':_0x249ca9[_0xe110('0x13')]?_0x249ca9['options'][_0xe110('0x15')]||null:null,'attributes':_0x249ca9['options']?_0x249ca9[_0xe110('0x13')][_0xe110('0x16')]||null:null,'limit':0x1,'order':_0x249ca9['options']?_0x249ca9[_0xe110('0x13')]['order']||null:null,'group':db[_0xe110('0x1c')][_0xe110('0x2f')],'transaction':_0x1fdca4,'lock':_0x1fdca4[_0xe110('0x29')][_0xe110('0x2a')],'include':_0x249ca9[_0xe110('0x13')]?_0x249ca9[_0xe110('0x13')]['include']?_[_0xe110('0x19')](_0x249ca9[_0xe110('0x13')]['include'],function(_0x45f987){return{'model':db[_0x45f987[_0xe110('0x3e')]],'as':_0x45f987['as'],'attributes':_0x45f987[_0xe110('0x16')],'include':_0x45f987['include']?_[_0xe110('0x19')](_0x45f987['include'],function(_0x41a81c){return{'model':db[_0x41a81c[_0xe110('0x3e')]],'as':_0x41a81c['as'],'attributes':_0x41a81c[_0xe110('0x16')],'include':_0x41a81c[_0xe110('0x18')]?_[_0xe110('0x19')](_0x41a81c['include'],function(_0x4ea464){return{'model':db[_0x4ea464[_0xe110('0x3e')]],'as':_0x4ea464['as'],'attributes':_0x4ea464[_0xe110('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe110('0x9')](function(_0x239d6d){var _0x95e111=[];for(var _0x577d3f=0x0;_0x577d3f<_0x239d6d[_0xe110('0x2e')];_0x577d3f+=0x1){_0x95e111['push'](_0x239d6d[_0x577d3f][_0xe110('0x23')](_0x249ca9[_0xe110('0x21')],{'transaction':_0x1fdca4}));}return BPromise[_0xe110('0x3f')](_0x95e111);});})[_0xe110('0x9')](function(_0xb2dd49){logger[_0xe110('0xa')](_0xe110('0x3c'),_0x249ca9);logger['debug'](_0xe110('0x3c'),_0x249ca9,JSON[_0xe110('0xd')](_0xb2dd49));_0x2c6143(_0xb2dd49);})[_0xe110('0x1e')](function(_0x5dbd3e){logger[_0xe110('0xe')](_0xe110('0x3c'),_0x5dbd3e[_0xe110('0xf')],_0x249ca9);_0x5234d7(_0xcdf324[_0xe110('0xe')](0x1f4,_0x5dbd3e[_0xe110('0xf')]));});});});};exports[_0xe110('0x40')]=function(_0x27d577){var _0x2837a7=this;return new Promise(function(_0x2d0eb5,_0x5c000d){db[_0xe110('0x26')][_0xe110('0x3d')]()[_0xe110('0x9')](function(_0x190a3a){return db[_0xe110('0x1c')][_0xe110('0x12')]({'raw':_0x27d577[_0xe110('0x13')]?_0x27d577[_0xe110('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x27d577['options']?_0x27d577[_0xe110('0x13')]['where']||null:null,'attributes':_0x27d577[_0xe110('0x13')]?_0x27d577[_0xe110('0x13')]['attributes']||null:null,'limit':_0x27d577[_0xe110('0x13')]?_0x27d577[_0xe110('0x13')]['limit']||null:null,'include':_0x27d577[_0xe110('0x13')]?_0x27d577[_0xe110('0x13')][_0xe110('0x18')]?_['map'](_0x27d577[_0xe110('0x13')][_0xe110('0x18')],function(_0x9c02d4){return{'model':db[_0x9c02d4['model']],'as':_0x9c02d4['as'],'attributes':_0x9c02d4['as']===_0xe110('0x41')?_[_0xe110('0x2b')](_0x190a3a):_0x9c02d4['attributes'],'include':_0x9c02d4[_0xe110('0x18')]?_[_0xe110('0x19')](_0x9c02d4[_0xe110('0x18')],function(_0x3270dd){return{'model':db[_0x3270dd['model']],'as':_0x3270dd['as'],'attributes':_0x3270dd[_0xe110('0x16')],'include':_0x3270dd['include']?_['map'](_0x3270dd['include'],function(_0x1176f2){return{'model':db[_0x1176f2[_0xe110('0x3e')]],'as':_0x1176f2['as'],'attributes':_0x1176f2[_0xe110('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49a429){logger[_0xe110('0xa')](_0xe110('0x1a'),_0x27d577);logger[_0xe110('0xc')]('GetCmHopper',_0x27d577,JSON[_0xe110('0xd')](_0x49a429));_0x2d0eb5(_0x49a429);})[_0xe110('0x1e')](function(_0x3ecff8){logger[_0xe110('0xe')]('GetCmHopper',_0x3ecff8[_0xe110('0xf')],_0x27d577);_0x5c000d(_0x2837a7['error'](0x1f4,_0x3ecff8['message']));});});});};exports[_0xe110('0x42')]=function(_0x25809b){_this=this;return new Promise(function(_0x360fcd,_0x3bf1e7){return db[_0xe110('0x26')][_0xe110('0x43')]({'raw':!![],'where':{'phone':_0x25809b[_0xe110('0x13')][_0xe110('0x15')][_0xe110('0x44')]},'attributes':['id',_0xe110('0x45')],'order':[['id',_0xe110('0x46')]]})[_0xe110('0x9')](function(_0xdd04fc){logger['info'](_0xe110('0x47'),_0x25809b);logger['debug'](_0xe110('0x47'),_0x25809b,JSON[_0xe110('0xd')](_0xdd04fc));_0x360fcd(_0xdd04fc);})[_0xe110('0x1e')](function(_0x50a9b6){logger['error']('getContactByPhone',_0x50a9b6[_0xe110('0xf')],_0x25809b);_0x3bf1e7(_this[_0xe110('0xe')](0x1f4,_0x50a9b6['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 69b1613..a77edf9 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 _0xcd19=['getOpenContacts','/:id','post','/preview','getPreview','/timezone','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/describe','describe'];(function(_0x2b31a8,_0x28b862){var _0x1175a5=function(_0x2cdb5d){while(--_0x2cdb5d){_0x2b31a8['push'](_0x2b31a8['shift']());}};_0x1175a5(++_0x28b862);}(_0xcd19,0xdc));var _0x9cd1=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0xcd19[_0x540133];return _0x26b6e9;};'use strict';var multer=require(_0x9cd1('0x0'));var util=require('util');var path=require(_0x9cd1('0x1'));var timeout=require(_0x9cd1('0x2'));var express=require(_0x9cd1('0x3'));var router=express[_0x9cd1('0x4')]();var fs_extra=require(_0x9cd1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9cd1('0x6'));var config=require('../../config/environment');var controller=require('./cmHopper.controller');router[_0x9cd1('0x7')]('/',auth[_0x9cd1('0x8')](),controller['index']);router[_0x9cd1('0x7')](_0x9cd1('0x9'),auth['isAuthenticated'](),controller[_0x9cd1('0xa')]);router[_0x9cd1('0x7')]('/opencontacts',auth['isAuthenticated'](),controller[_0x9cd1('0xb')]);router[_0x9cd1('0x7')]('/timezones',auth[_0x9cd1('0x8')](),controller['getTimezones']);router['get'](_0x9cd1('0xc'),auth[_0x9cd1('0x8')](),controller['show']);router[_0x9cd1('0xd')]('/',auth[_0x9cd1('0x8')](),controller['create']);router[_0x9cd1('0xd')](_0x9cd1('0xe'),auth[_0x9cd1('0x8')](),controller[_0x9cd1('0xf')]);router[_0x9cd1('0xd')](_0x9cd1('0x10'),auth[_0x9cd1('0x8')](),controller['getTimezone']);router[_0x9cd1('0x11')](_0x9cd1('0xc'),auth[_0x9cd1('0x8')](),controller[_0x9cd1('0x12')]);router['delete']('/:id',auth[_0x9cd1('0x8')](),controller[_0x9cd1('0x13')]);module[_0x9cd1('0x14')]=router; \ No newline at end of file +var _0xade2=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','/describe','describe','isAuthenticated','getOpenContacts','/timezones','/:id','show','post','/preview','getPreview','/timezone','getTimezone','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xade2,0x84));var _0x2ade=function(_0x4882f6,_0x21bbcb){_0x4882f6=_0x4882f6-0x0;var _0x5af943=_0xade2[_0x4882f6];return _0x5af943;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2ade('0x0'));var timeout=require(_0x2ade('0x1'));var express=require(_0x2ade('0x2'));var router=express[_0x2ade('0x3')]();var fs_extra=require(_0x2ade('0x4'));var auth=require(_0x2ade('0x5'));var interaction=require(_0x2ade('0x6'));var config=require(_0x2ade('0x7'));var controller=require(_0x2ade('0x8'));router[_0x2ade('0x9')]('/',auth['isAuthenticated'](),controller[_0x2ade('0xa')]);router[_0x2ade('0x9')](_0x2ade('0xb'),auth['isAuthenticated'](),controller[_0x2ade('0xc')]);router[_0x2ade('0x9')]('/opencontacts',auth[_0x2ade('0xd')](),controller[_0x2ade('0xe')]);router['get'](_0x2ade('0xf'),auth['isAuthenticated'](),controller['getTimezones']);router[_0x2ade('0x9')](_0x2ade('0x10'),auth['isAuthenticated'](),controller[_0x2ade('0x11')]);router[_0x2ade('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2ade('0x12')](_0x2ade('0x13'),auth[_0x2ade('0xd')](),controller[_0x2ade('0x14')]);router[_0x2ade('0x12')](_0x2ade('0x15'),auth[_0x2ade('0xd')](),controller[_0x2ade('0x16')]);router[_0x2ade('0x17')](_0x2ade('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x2ade('0x18')](_0x2ade('0x10'),auth[_0x2ade('0xd')](),controller[_0x2ade('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index d54a369..902f960 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 _0x5aa1=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x2d62c1,_0x147603){var _0x31d444=function(_0x518db2){while(--_0x518db2){_0x2d62c1['push'](_0x2d62c1['shift']());}};_0x31d444(++_0x147603);}(_0x5aa1,0x158));var _0x15aa=function(_0x2765f4,_0x2e82a4){_0x2765f4=_0x2765f4-0x0;var _0x4c3d54=_0x5aa1[_0x2765f4];return _0x4c3d54;};'use strict';var moment=require(_0x15aa('0x0'));var Sequelize=require(_0x15aa('0x1'));module[_0x15aa('0x2')]={'phone':{'type':Sequelize[_0x15aa('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x15aa('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x15aa('0x4')],'unique':_0x15aa('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x15aa('0x5')}}; \ No newline at end of file +var _0xd56f=['INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0xd7489d,_0x411685){var _0x2988b5=function(_0x2f51b2){while(--_0x2f51b2){_0xd7489d['push'](_0xd7489d['shift']());}};_0x2988b5(++_0x411685);}(_0xd56f,0xe8));var _0xfd56=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xd56f[_0x4e7d25];return _0x526fe6;};'use strict';var moment=require(_0xfd56('0x0'));var Sequelize=require(_0xfd56('0x1'));module[_0xfd56('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xfd56('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xfd56('0x3')],'unique':_0xfd56('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xfd56('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 6824f8c..123ddca 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 _0xa443=['save','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','CmHopperBlack','findAll','catch','show','params','length','options','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','count','limit','set','apply','reject'];(function(_0x5dc6a6,_0x21788b){var _0x3c641c=function(_0x9ce473){while(--_0x9ce473){_0x5dc6a6['push'](_0x5dc6a6['shift']());}};_0x3c641c(++_0x21788b);}(_0xa443,0x1a3));var _0x3a44=function(_0x39a75a,_0x43ba98){_0x39a75a=_0x39a75a-0x0;var _0x4cbd89=_0xa443[_0x39a75a];return _0x4cbd89;};'use strict';var emlformat=require(_0x3a44('0x0'));var rimraf=require(_0x3a44('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a44('0x2'));var rp=require(_0x3a44('0x3'));var moment=require(_0x3a44('0x4'));var BPromise=require(_0x3a44('0x5'));var Mustache=require(_0x3a44('0x6'));var util=require(_0x3a44('0x7'));var path=require(_0x3a44('0x8'));var sox=require(_0x3a44('0x9'));var csv=require(_0x3a44('0xa'));var ejs=require(_0x3a44('0xb'));var fs=require('fs');var fs_extra=require(_0x3a44('0xc'));var _=require(_0x3a44('0xd'));var squel=require('squel');var crypto=require(_0x3a44('0xe'));var jsforce=require(_0x3a44('0xf'));var deskjs=require(_0x3a44('0x10'));var toCsv=require(_0x3a44('0xa'));var querystring=require(_0x3a44('0x11'));var Papa=require(_0x3a44('0x12'));var Redis=require(_0x3a44('0x13'));var authService=require(_0x3a44('0x14'));var qs=require(_0x3a44('0x15'));var as=require(_0x3a44('0x16'));var hardwareService=require(_0x3a44('0x17'));var logger=require(_0x3a44('0x18'))(_0x3a44('0x19'));var utils=require(_0x3a44('0x1a'));var config=require(_0x3a44('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a44('0x1c'))['db'];function respondWithStatusCode(_0x2618c9,_0x5cb846){_0x5cb846=_0x5cb846||0xcc;return function(_0x28579f){if(_0x28579f){return _0x2618c9['sendStatus'](_0x5cb846);}return _0x2618c9[_0x3a44('0x1d')](_0x5cb846)[_0x3a44('0x1e')]();};}function respondWithResult(_0x530211,_0x438ece){_0x438ece=_0x438ece||0xc8;return function(_0x5269b6){if(_0x5269b6){return _0x530211[_0x3a44('0x1d')](_0x438ece)['json'](_0x5269b6);}};}function respondWithFilteredResult(_0x377681,_0x3a8981){return function(_0x569009){if(_0x569009){var _0x4c6515=typeof _0x3a8981['offset']===_0x3a44('0x1f')&&typeof _0x3a8981['limit']===_0x3a44('0x1f');var _0x382799=_0x569009[_0x3a44('0x20')];var _0x5a2a11=_0x4c6515?0x0:_0x3a8981['offset'];var _0xbbd249=_0x4c6515?_0x569009[_0x3a44('0x20')]:_0x3a8981['offset']+_0x3a8981[_0x3a44('0x21')];var _0x39abee;if(_0xbbd249>=_0x382799){_0xbbd249=_0x382799;_0x39abee=0xc8;}else{_0x39abee=0xce;}_0x377681[_0x3a44('0x1d')](_0x39abee);return _0x377681[_0x3a44('0x22')]('Content-Range',_0x5a2a11+'-'+_0xbbd249+'/'+_0x382799)['json'](_0x569009);}return null;};}function patchUpdates(_0xb92afa){return function(_0x43cb48){try{jsonpatch[_0x3a44('0x23')](_0x43cb48,_0xb92afa,!![]);}catch(_0x4ac97d){return BPromise[_0x3a44('0x24')](_0x4ac97d);}return _0x43cb48[_0x3a44('0x25')]();};}function saveUpdates(_0x2ec8fe,_0x8e8ae9){return function(_0x5bcf35){if(_0x5bcf35){return _0x5bcf35[_0x3a44('0x26')](_0x2ec8fe)[_0x3a44('0x27')](function(_0x3200bb){return _0x3200bb;});}return null;};}function removeEntity(_0x55a627,_0x21a6dd){return function(_0x4994b4){if(_0x4994b4){return _0x4994b4['destroy']()[_0x3a44('0x27')](function(){_0x55a627[_0x3a44('0x1d')](0xcc)[_0x3a44('0x1e')]();});}};}function handleEntityNotFound(_0x56ccaf,_0xc6f504){return function(_0x2525f7){if(!_0x2525f7){_0x56ccaf['sendStatus'](0x194);}return _0x2525f7;};}function handleError(_0x21e94a,_0x175889){_0x175889=_0x175889||0x1f4;return function(_0x2e1b1a){logger[_0x3a44('0x28')](_0x2e1b1a['stack']);if(_0x2e1b1a['name']){delete _0x2e1b1a[_0x3a44('0x29')];}_0x21e94a[_0x3a44('0x1d')](_0x175889)[_0x3a44('0x2a')](_0x2e1b1a);};}exports['index']=function(_0x57e6f2,_0x7782b3){var _0x416a86={},_0x1e10d5={},_0x4667dc={'count':0x0,'rows':[]};var _0x125396=_[_0x3a44('0x2b')](db['CmHopperBlack'][_0x3a44('0x2c')],function(_0x1dcd3f){return{'name':_0x1dcd3f[_0x3a44('0x2d')],'type':_0x1dcd3f[_0x3a44('0x2e')][_0x3a44('0x2f')]};});_0x1e10d5[_0x3a44('0x30')]=_[_0x3a44('0x2b')](_0x125396,_0x3a44('0x29'));_0x1e10d5[_0x3a44('0x31')]=_[_0x3a44('0x32')](_0x57e6f2['query']);_0x1e10d5[_0x3a44('0x33')]=_[_0x3a44('0x34')](_0x1e10d5[_0x3a44('0x30')],_0x1e10d5[_0x3a44('0x31')]);_0x416a86[_0x3a44('0x35')]=_[_0x3a44('0x34')](_0x1e10d5[_0x3a44('0x30')],qs['fields'](_0x57e6f2[_0x3a44('0x31')][_0x3a44('0x36')]));_0x416a86[_0x3a44('0x35')]=_0x416a86[_0x3a44('0x35')]['length']?_0x416a86[_0x3a44('0x35')]:_0x1e10d5['model'];if(!_0x57e6f2['query'][_0x3a44('0x37')](_0x3a44('0x38'))){_0x416a86[_0x3a44('0x21')]=qs[_0x3a44('0x21')](_0x57e6f2[_0x3a44('0x31')][_0x3a44('0x21')]);_0x416a86[_0x3a44('0x39')]=qs[_0x3a44('0x39')](_0x57e6f2[_0x3a44('0x31')]['offset']);}_0x416a86['order']=qs['sort'](_0x57e6f2['query'][_0x3a44('0x3a')]);_0x416a86[_0x3a44('0x3b')]=qs['filters'](_[_0x3a44('0x3c')](_0x57e6f2[_0x3a44('0x31')],_0x1e10d5['filters']),_0x125396);if(_0x57e6f2['query'][_0x3a44('0x3d')]){_0x416a86[_0x3a44('0x3b')]=_[_0x3a44('0x3e')](_0x416a86[_0x3a44('0x3b')],{'$or':_[_0x3a44('0x2b')](_0x125396,function(_0x5f4dcd){if(_0x5f4dcd['type']!==_0x3a44('0x3f')){var _0x318152={};_0x318152[_0x5f4dcd[_0x3a44('0x29')]]={'$like':'%'+_0x57e6f2[_0x3a44('0x31')][_0x3a44('0x3d')]+'%'};return _0x318152;}})});}_0x416a86=_[_0x3a44('0x3e')]({},_0x416a86,_0x57e6f2['options']);var _0x398e1a={'where':_0x416a86['where']};return db['CmHopperBlack'][_0x3a44('0x20')](_0x398e1a)[_0x3a44('0x27')](function(_0x4416ea){_0x4667dc[_0x3a44('0x20')]=_0x4416ea;if(_0x57e6f2[_0x3a44('0x31')][_0x3a44('0x40')]){_0x416a86[_0x3a44('0x41')]=[{'all':!![]}];}return db[_0x3a44('0x42')][_0x3a44('0x43')](_0x416a86);})[_0x3a44('0x27')](function(_0x4a7699){_0x4667dc['rows']=_0x4a7699;return _0x4667dc;})[_0x3a44('0x27')](respondWithFilteredResult(_0x7782b3,_0x416a86))[_0x3a44('0x44')](handleError(_0x7782b3,null));};exports[_0x3a44('0x45')]=function(_0x54fde6,_0x11bf54){var _0x32a4be={'raw':!![],'where':{'id':_0x54fde6[_0x3a44('0x46')]['id']}},_0xb8e411={};_0xb8e411[_0x3a44('0x30')]=_[_0x3a44('0x32')](db[_0x3a44('0x42')][_0x3a44('0x2c')]);_0xb8e411[_0x3a44('0x31')]=_[_0x3a44('0x32')](_0x54fde6['query']);_0xb8e411[_0x3a44('0x33')]=_[_0x3a44('0x34')](_0xb8e411['model'],_0xb8e411[_0x3a44('0x31')]);_0x32a4be[_0x3a44('0x35')]=_['intersection'](_0xb8e411['model'],qs[_0x3a44('0x36')](_0x54fde6[_0x3a44('0x31')][_0x3a44('0x36')]));_0x32a4be['attributes']=_0x32a4be[_0x3a44('0x35')][_0x3a44('0x47')]?_0x32a4be[_0x3a44('0x35')]:_0xb8e411[_0x3a44('0x30')];if(_0x54fde6[_0x3a44('0x31')][_0x3a44('0x40')]){_0x32a4be['include']=[{'all':!![]}];}_0x32a4be=_['merge']({},_0x32a4be,_0x54fde6[_0x3a44('0x48')]);return db[_0x3a44('0x42')]['find'](_0x32a4be)[_0x3a44('0x27')](handleEntityNotFound(_0x11bf54,null))[_0x3a44('0x27')](respondWithResult(_0x11bf54,null))[_0x3a44('0x44')](handleError(_0x11bf54,null));};exports[_0x3a44('0x26')]=function(_0x131799,_0x10f3e9){if(_0x131799[_0x3a44('0x49')]['id']){delete _0x131799[_0x3a44('0x49')]['id'];}return db[_0x3a44('0x42')][_0x3a44('0x4a')]({'where':{'id':_0x131799[_0x3a44('0x46')]['id']}})['then'](handleEntityNotFound(_0x10f3e9,null))[_0x3a44('0x27')](saveUpdates(_0x131799[_0x3a44('0x49')],null))[_0x3a44('0x27')](respondWithResult(_0x10f3e9,null))[_0x3a44('0x44')](handleError(_0x10f3e9,null));};exports['destroy']=function(_0x3fd23b,_0x331265){return db[_0x3a44('0x42')][_0x3a44('0x4a')]({'where':{'id':_0x3fd23b[_0x3a44('0x46')]['id']}})[_0x3a44('0x27')](handleEntityNotFound(_0x331265,null))['then'](removeEntity(_0x331265,null))[_0x3a44('0x44')](handleError(_0x331265,null));};exports[_0x3a44('0x4b')]=function(_0x5a8ca9,_0x2dbf4e){return db[_0x3a44('0x42')][_0x3a44('0x4b')]()['then'](respondWithResult(_0x2dbf4e,null))[_0x3a44('0x44')](handleError(_0x2dbf4e,null));}; \ No newline at end of file +var _0xced7=['limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','CmHopperBlack','include','rows','show','params','attributes','merge','body','find','catch','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','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','offset','undefined'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xced7,0xc7));var _0x7ced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xced7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7ced('0x0'));var rimraf=require(_0x7ced('0x1'));var zipdir=require(_0x7ced('0x2'));var jsonpatch=require(_0x7ced('0x3'));var rp=require(_0x7ced('0x4'));var moment=require(_0x7ced('0x5'));var BPromise=require(_0x7ced('0x6'));var Mustache=require(_0x7ced('0x7'));var util=require(_0x7ced('0x8'));var path=require('path');var sox=require(_0x7ced('0x9'));var csv=require(_0x7ced('0xa'));var ejs=require(_0x7ced('0xb'));var fs=require('fs');var fs_extra=require(_0x7ced('0xc'));var _=require(_0x7ced('0xd'));var squel=require(_0x7ced('0xe'));var crypto=require(_0x7ced('0xf'));var jsforce=require(_0x7ced('0x10'));var deskjs=require(_0x7ced('0x11'));var toCsv=require(_0x7ced('0xa'));var querystring=require(_0x7ced('0x12'));var Papa=require('papaparse');var Redis=require(_0x7ced('0x13'));var authService=require(_0x7ced('0x14'));var qs=require(_0x7ced('0x15'));var as=require(_0x7ced('0x16'));var hardwareService=require(_0x7ced('0x17'));var logger=require(_0x7ced('0x18'))(_0x7ced('0x19'));var utils=require(_0x7ced('0x1a'));var config=require(_0x7ced('0x1b'));var licenseUtil=require(_0x7ced('0x1c'));var db=require(_0x7ced('0x1d'))['db'];function respondWithStatusCode(_0x326002,_0x425d56){_0x425d56=_0x425d56||0xcc;return function(_0x465357){if(_0x465357){return _0x326002[_0x7ced('0x1e')](_0x425d56);}return _0x326002[_0x7ced('0x1f')](_0x425d56)[_0x7ced('0x20')]();};}function respondWithResult(_0x175eb6,_0x2f4df3){_0x2f4df3=_0x2f4df3||0xc8;return function(_0x5a89fa){if(_0x5a89fa){return _0x175eb6['status'](_0x2f4df3)['json'](_0x5a89fa);}};}function respondWithFilteredResult(_0x4c3095,_0x2910e3){return function(_0x2b4528){if(_0x2b4528){var _0x1269c4=typeof _0x2910e3[_0x7ced('0x21')]===_0x7ced('0x22')&&typeof _0x2910e3[_0x7ced('0x23')]===_0x7ced('0x22');var _0x47a1e5=_0x2b4528['count'];var _0x25fcad=_0x1269c4?0x0:_0x2910e3[_0x7ced('0x21')];var _0xbeeba1=_0x1269c4?_0x2b4528[_0x7ced('0x24')]:_0x2910e3[_0x7ced('0x21')]+_0x2910e3[_0x7ced('0x23')];var _0x4dbb11;if(_0xbeeba1>=_0x47a1e5){_0xbeeba1=_0x47a1e5;_0x4dbb11=0xc8;}else{_0x4dbb11=0xce;}_0x4c3095[_0x7ced('0x1f')](_0x4dbb11);return _0x4c3095[_0x7ced('0x25')](_0x7ced('0x26'),_0x25fcad+'-'+_0xbeeba1+'/'+_0x47a1e5)['json'](_0x2b4528);}return null;};}function patchUpdates(_0x4ce43f){return function(_0x5a13d1){try{jsonpatch[_0x7ced('0x27')](_0x5a13d1,_0x4ce43f,!![]);}catch(_0x4dc200){return BPromise['reject'](_0x4dc200);}return _0x5a13d1[_0x7ced('0x28')]();};}function saveUpdates(_0x481355,_0x4768b6){return function(_0x3962dd){if(_0x3962dd){return _0x3962dd[_0x7ced('0x29')](_0x481355)[_0x7ced('0x2a')](function(_0x57aaea){return _0x57aaea;});}return null;};}function removeEntity(_0x43b299,_0x13fd9a){return function(_0x80632f){if(_0x80632f){return _0x80632f[_0x7ced('0x2b')]()[_0x7ced('0x2a')](function(){_0x43b299['status'](0xcc)[_0x7ced('0x20')]();});}};}function handleEntityNotFound(_0x33a9db,_0x2b2d55){return function(_0x4cb065){if(!_0x4cb065){_0x33a9db[_0x7ced('0x1e')](0x194);}return _0x4cb065;};}function handleError(_0x3e2863,_0x4cb665){_0x4cb665=_0x4cb665||0x1f4;return function(_0x47de02){logger[_0x7ced('0x2c')](_0x47de02[_0x7ced('0x2d')]);if(_0x47de02[_0x7ced('0x2e')]){delete _0x47de02[_0x7ced('0x2e')];}_0x3e2863[_0x7ced('0x1f')](_0x4cb665)['send'](_0x47de02);};}exports[_0x7ced('0x2f')]=function(_0x29e426,_0x1bca00){var _0x397506={},_0x3146da={},_0x2815ab={'count':0x0,'rows':[]};var _0x5245bb=_[_0x7ced('0x30')](db['CmHopperBlack'][_0x7ced('0x31')],function(_0x44583d){return{'name':_0x44583d['fieldName'],'type':_0x44583d[_0x7ced('0x32')][_0x7ced('0x33')]};});_0x3146da[_0x7ced('0x34')]=_[_0x7ced('0x30')](_0x5245bb,_0x7ced('0x2e'));_0x3146da[_0x7ced('0x35')]=_[_0x7ced('0x36')](_0x29e426[_0x7ced('0x35')]);_0x3146da[_0x7ced('0x37')]=_[_0x7ced('0x38')](_0x3146da['model'],_0x3146da['query']);_0x397506['attributes']=_[_0x7ced('0x38')](_0x3146da['model'],qs[_0x7ced('0x39')](_0x29e426[_0x7ced('0x35')][_0x7ced('0x39')]));_0x397506['attributes']=_0x397506['attributes']['length']?_0x397506['attributes']:_0x3146da[_0x7ced('0x34')];if(!_0x29e426['query'][_0x7ced('0x3a')](_0x7ced('0x3b'))){_0x397506[_0x7ced('0x23')]=qs[_0x7ced('0x23')](_0x29e426['query'][_0x7ced('0x23')]);_0x397506[_0x7ced('0x21')]=qs[_0x7ced('0x21')](_0x29e426['query'][_0x7ced('0x21')]);}_0x397506[_0x7ced('0x3c')]=qs[_0x7ced('0x3d')](_0x29e426[_0x7ced('0x35')][_0x7ced('0x3d')]);_0x397506['where']=qs['filters'](_[_0x7ced('0x3e')](_0x29e426[_0x7ced('0x35')],_0x3146da[_0x7ced('0x37')]),_0x5245bb);if(_0x29e426[_0x7ced('0x35')]['filter']){_0x397506[_0x7ced('0x3f')]=_['merge'](_0x397506[_0x7ced('0x3f')],{'$or':_[_0x7ced('0x30')](_0x5245bb,function(_0x43504e){if(_0x43504e['type']!==_0x7ced('0x40')){var _0x57f305={};_0x57f305[_0x43504e['name']]={'$like':'%'+_0x29e426[_0x7ced('0x35')][_0x7ced('0x41')]+'%'};return _0x57f305;}})});}_0x397506=_['merge']({},_0x397506,_0x29e426[_0x7ced('0x42')]);var _0x12ce77={'where':_0x397506[_0x7ced('0x3f')]};return db[_0x7ced('0x43')]['count'](_0x12ce77)[_0x7ced('0x2a')](function(_0x467e9f){_0x2815ab[_0x7ced('0x24')]=_0x467e9f;if(_0x29e426[_0x7ced('0x35')]['includeAll']){_0x397506[_0x7ced('0x44')]=[{'all':!![]}];}return db[_0x7ced('0x43')]['findAll'](_0x397506);})[_0x7ced('0x2a')](function(_0x1abba9){_0x2815ab[_0x7ced('0x45')]=_0x1abba9;return _0x2815ab;})[_0x7ced('0x2a')](respondWithFilteredResult(_0x1bca00,_0x397506))['catch'](handleError(_0x1bca00,null));};exports[_0x7ced('0x46')]=function(_0x210689,_0x5d575a){var _0x58561a={'raw':!![],'where':{'id':_0x210689[_0x7ced('0x47')]['id']}},_0x3604b6={};_0x3604b6[_0x7ced('0x34')]=_['keys'](db[_0x7ced('0x43')][_0x7ced('0x31')]);_0x3604b6['query']=_[_0x7ced('0x36')](_0x210689[_0x7ced('0x35')]);_0x3604b6[_0x7ced('0x37')]=_[_0x7ced('0x38')](_0x3604b6[_0x7ced('0x34')],_0x3604b6[_0x7ced('0x35')]);_0x58561a[_0x7ced('0x48')]=_[_0x7ced('0x38')](_0x3604b6[_0x7ced('0x34')],qs[_0x7ced('0x39')](_0x210689[_0x7ced('0x35')]['fields']));_0x58561a[_0x7ced('0x48')]=_0x58561a[_0x7ced('0x48')]['length']?_0x58561a[_0x7ced('0x48')]:_0x3604b6[_0x7ced('0x34')];if(_0x210689[_0x7ced('0x35')]['includeAll']){_0x58561a[_0x7ced('0x44')]=[{'all':!![]}];}_0x58561a=_[_0x7ced('0x49')]({},_0x58561a,_0x210689[_0x7ced('0x42')]);return db[_0x7ced('0x43')]['find'](_0x58561a)[_0x7ced('0x2a')](handleEntityNotFound(_0x5d575a,null))['then'](respondWithResult(_0x5d575a,null))['catch'](handleError(_0x5d575a,null));};exports[_0x7ced('0x29')]=function(_0x5f340e,_0x225e39){if(_0x5f340e[_0x7ced('0x4a')]['id']){delete _0x5f340e[_0x7ced('0x4a')]['id'];}return db[_0x7ced('0x43')][_0x7ced('0x4b')]({'where':{'id':_0x5f340e['params']['id']}})[_0x7ced('0x2a')](handleEntityNotFound(_0x225e39,null))[_0x7ced('0x2a')](saveUpdates(_0x5f340e[_0x7ced('0x4a')],null))[_0x7ced('0x2a')](respondWithResult(_0x225e39,null))[_0x7ced('0x4c')](handleError(_0x225e39,null));};exports[_0x7ced('0x2b')]=function(_0x467234,_0x564597){return db[_0x7ced('0x43')][_0x7ced('0x4b')]({'where':{'id':_0x467234[_0x7ced('0x47')]['id']}})['then'](handleEntityNotFound(_0x564597,null))['then'](removeEntity(_0x564597,null))[_0x7ced('0x4c')](handleError(_0x564597,null));};exports[_0x7ced('0x4d')]=function(_0x53c214,_0x27294f){return db[_0x7ced('0x43')][_0x7ced('0x4d')]()[_0x7ced('0x2a')](respondWithResult(_0x27294f,null))[_0x7ced('0x4c')](handleError(_0x27294f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 45f24af..49d36a7 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 _0x6e30=['bluebird','request-promise','rimraf','../../config/environment','exports','define','cm_hopper_black','api','moment'];(function(_0x395e29,_0x772b76){var _0x2a1409=function(_0xa3e9d6){while(--_0xa3e9d6){_0x395e29['push'](_0x395e29['shift']());}};_0x2a1409(++_0x772b76);}(_0x6e30,0xbb));var _0x06e3=function(_0x2b0bc2,_0x4331f5){_0x2b0bc2=_0x2b0bc2-0x0;var _0x56e5b9=_0x6e30[_0x2b0bc2];return _0x56e5b9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x06e3('0x0'));var moment=require(_0x06e3('0x1'));var BPromise=require(_0x06e3('0x2'));var rp=require(_0x06e3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06e3('0x4'));var config=require(_0x06e3('0x5'));var attributes=require('./cmHopperBlack.attributes');module[_0x06e3('0x6')]=function(_0x147edc,_0x4bcfdd){return _0x147edc[_0x06e3('0x7')]('CmHopperBlack',attributes,{'tableName':_0x06e3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9ae=['path','rimraf','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xf9ae,0x192));var _0xef9a=function(_0x405c9b,_0x24a54c){_0x405c9b=_0x405c9b-0x0;var _0x1a8549=_0xf9ae[_0x405c9b];return _0x1a8549;};'use strict';var _=require(_0xef9a('0x0'));var util=require(_0xef9a('0x1'));var logger=require('../../config/logger')(_0xef9a('0x2'));var moment=require(_0xef9a('0x3'));var BPromise=require(_0xef9a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef9a('0x5'));var rimraf=require(_0xef9a('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0xef9a('0x7')]=function(_0x4db09e,_0x2ec89b){return _0x4db09e[_0xef9a('0x8')](_0xef9a('0x9'),attributes,{'tableName':_0xef9a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 050cd41..31c0f7f 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 _0x7355=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','result','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','DestroyCmHopperBlack','CmHopperBlack','destroy','catch','util'];(function(_0x18b8db,_0x3b97a9){var _0x369216=function(_0x2a5d62){while(--_0x2a5d62){_0x18b8db['push'](_0x18b8db['shift']());}};_0x369216(++_0x3b97a9);}(_0x7355,0x1cd));var _0x5735=function(_0x1495aa,_0x32a90a){_0x1495aa=_0x1495aa-0x0;var _0x31cb18=_0x7355[_0x1495aa];return _0x31cb18;};'use strict';var _=require('lodash');var util=require(_0x5735('0x0'));var moment=require(_0x5735('0x1'));var BPromise=require('bluebird');var rs=require(_0x5735('0x2'));var fs=require('fs');var Redis=require(_0x5735('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5735('0x4'));var logger=require(_0x5735('0x5'))('rpc');var config=require(_0x5735('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5735('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x18bd1a,_0x3b9437,_0x4676f9){return new BPromise(function(_0x2c45ad,_0x1ab6a2){return client['request'](_0x18bd1a,_0x4676f9)[_0x5735('0x8')](function(_0x1190f9){logger[_0x5735('0x9')](_0x5735('0xa'),_0x3b9437,_0x5735('0xb'));logger[_0x5735('0xc')](_0x5735('0xd'),_0x3b9437,_0x5735('0xb'),JSON[_0x5735('0xe')](_0x1190f9));if(_0x1190f9[_0x5735('0xf')]){if(_0x1190f9[_0x5735('0xf')]['code']===0x1f4){logger['error'](_0x5735('0xa'),_0x3b9437,_0x1190f9[_0x5735('0xf')][_0x5735('0x10')]);return _0x1ab6a2(_0x1190f9[_0x5735('0xf')]['message']);}logger[_0x5735('0xf')](_0x5735('0xa'),_0x3b9437,_0x1190f9[_0x5735('0xf')][_0x5735('0x10')]);return _0x2c45ad(_0x1190f9[_0x5735('0xf')][_0x5735('0x10')]);}else{logger['info'](_0x5735('0xa'),_0x3b9437,_0x5735('0xb'));_0x2c45ad(_0x1190f9[_0x5735('0x11')][_0x5735('0x10')]);}})['catch'](function(_0x7d3e25){logger[_0x5735('0xf')](_0x5735('0xa'),_0x3b9437,_0x7d3e25);_0x1ab6a2(_0x7d3e25);});});}exports['GetCmHopperBlack']=function(_0x366b25){var _0x4bd1ae=this;return new Promise(function(_0x24a309,_0x28f451){return db['CmHopperBlack'][_0x5735('0x12')]({'raw':_0x366b25['options']?_0x366b25[_0x5735('0x13')][_0x5735('0x14')]===undefined?!![]:![]:!![],'where':_0x366b25[_0x5735('0x13')]?_0x366b25[_0x5735('0x13')][_0x5735('0x15')]||null:null,'attributes':_0x366b25[_0x5735('0x13')]?_0x366b25['options'][_0x5735('0x16')]||null:null,'limit':_0x366b25[_0x5735('0x13')]?_0x366b25[_0x5735('0x13')][_0x5735('0x17')]||null:null,'include':_0x366b25[_0x5735('0x13')]?_0x366b25[_0x5735('0x13')][_0x5735('0x18')]?_['map'](_0x366b25[_0x5735('0x13')]['include'],function(_0x115270){return{'model':db[_0x115270['model']],'as':_0x115270['as'],'attributes':_0x115270[_0x5735('0x16')],'include':_0x115270[_0x5735('0x18')]?_[_0x5735('0x19')](_0x115270['include'],function(_0x133ff9){return{'model':db[_0x133ff9[_0x5735('0x1a')]],'as':_0x133ff9['as'],'attributes':_0x133ff9[_0x5735('0x16')],'include':_0x133ff9[_0x5735('0x18')]?_['map'](_0x133ff9[_0x5735('0x18')],function(_0x13201a){return{'model':db[_0x13201a[_0x5735('0x1a')]],'as':_0x13201a['as'],'attributes':_0x13201a['attributes']};}):[]};}):[]};}):[]:[]})[_0x5735('0x8')](function(_0x47c6d4){logger['info']('GetCmHopperBlack',_0x366b25);logger['debug'](_0x5735('0x1b'),_0x366b25,JSON[_0x5735('0xe')](_0x47c6d4));_0x24a309(_0x47c6d4);})['catch'](function(_0x1de629){logger['error'](_0x5735('0x1b'),_0x1de629[_0x5735('0x10')],_0x366b25);_0x28f451(_0x4bd1ae[_0x5735('0xf')](0x1f4,_0x1de629[_0x5735('0x10')]));});});};exports['UpdateCmHopperBlack']=function(_0xaa36bd){var _0x4559f1=this;return new Promise(function(_0x237665,_0x119840){return db['CmHopperBlack']['update'](_0xaa36bd['body'],{'raw':_0xaa36bd[_0x5735('0x13')]?_0xaa36bd[_0x5735('0x13')][_0x5735('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xaa36bd[_0x5735('0x13')]?_0xaa36bd['options'][_0x5735('0x15')]||null:null,'attributes':_0xaa36bd[_0x5735('0x13')]?_0xaa36bd[_0x5735('0x13')][_0x5735('0x16')]||null:null,'limit':_0xaa36bd['options']?_0xaa36bd[_0x5735('0x13')][_0x5735('0x17')]||null:null})[_0x5735('0x8')](function(_0x1919f7){logger[_0x5735('0x9')](_0x5735('0x1c'),_0xaa36bd);logger[_0x5735('0xc')](_0x5735('0x1c'),_0xaa36bd,JSON[_0x5735('0xe')](_0x1919f7));_0x237665(_0x1919f7);})['catch'](function(_0x1e287b){logger[_0x5735('0xf')](_0x5735('0x1c'),_0x1e287b['message'],_0xaa36bd);_0x119840(_0x4559f1[_0x5735('0xf')](0x1f4,_0x1e287b[_0x5735('0x10')]));});});};exports[_0x5735('0x1d')]=function(_0x57691c){var _0x4f5490=this;return new Promise(function(_0x467b9d,_0x1ae2c7){return db[_0x5735('0x1e')][_0x5735('0x1f')]({'where':_0x57691c[_0x5735('0x13')]?_0x57691c[_0x5735('0x13')][_0x5735('0x15')]||null:null})[_0x5735('0x8')](function(_0x21e0d9){logger[_0x5735('0x9')]('DestroyCmHopperBlack',_0x57691c);logger[_0x5735('0xc')](_0x5735('0x1d'),_0x57691c,JSON['stringify'](_0x21e0d9));_0x467b9d(_0x21e0d9);})[_0x5735('0x20')](function(_0x11aa59){logger[_0x5735('0xf')](_0x5735('0x1d'),_0x11aa59[_0x5735('0x10')],_0x57691c);_0x1ae2c7(_0x4f5490['error'](0x1f4,_0x11aa59[_0x5735('0x10')]));});});}; \ No newline at end of file +var _0xf538=['code','error','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetCmHopperBlack','debug','UpdateCmHopperBlack','CmHopperBlack','update','body','limit','DestroyCmHopperBlack','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x424c12,_0x562c2c){var _0x42a237=function(_0x486c0b){while(--_0x486c0b){_0x424c12['push'](_0x424c12['shift']());}};_0x42a237(++_0x562c2c);}(_0xf538,0x1e9));var _0x8f53=function(_0x456af7,_0x3d36d3){_0x456af7=_0x456af7-0x0;var _0x3818f7=_0xf538[_0x456af7];return _0x3818f7;};'use strict';var _=require(_0x8f53('0x0'));var util=require(_0x8f53('0x1'));var moment=require(_0x8f53('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f53('0x3'));var fs=require('fs');var Redis=require(_0x8f53('0x4'));var db=require(_0x8f53('0x5'))['db'];var utils=require(_0x8f53('0x6'));var logger=require(_0x8f53('0x7'))(_0x8f53('0x8'));var config=require('../../config/environment');var jayson=require(_0x8f53('0x9'));var client=jayson['client'][_0x8f53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f5869,_0x4c28ff,_0x1d897d){return new BPromise(function(_0x382560,_0x4326fe){return client[_0x8f53('0xb')](_0x3f5869,_0x1d897d)[_0x8f53('0xc')](function(_0x43fff4){logger[_0x8f53('0xd')](_0x8f53('0xe'),_0x4c28ff,_0x8f53('0xf'));logger['debug'](_0x8f53('0x10'),_0x4c28ff,_0x8f53('0xf'),JSON[_0x8f53('0x11')](_0x43fff4));if(_0x43fff4['error']){if(_0x43fff4['error'][_0x8f53('0x12')]===0x1f4){logger[_0x8f53('0x13')](_0x8f53('0xe'),_0x4c28ff,_0x43fff4[_0x8f53('0x13')]['message']);return _0x4326fe(_0x43fff4[_0x8f53('0x13')][_0x8f53('0x14')]);}logger[_0x8f53('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x4c28ff,_0x43fff4[_0x8f53('0x13')][_0x8f53('0x14')]);return _0x382560(_0x43fff4[_0x8f53('0x13')][_0x8f53('0x14')]);}else{logger['info'](_0x8f53('0xe'),_0x4c28ff,'request\x20sent');_0x382560(_0x43fff4[_0x8f53('0x15')][_0x8f53('0x14')]);}})[_0x8f53('0x16')](function(_0x484fc5){logger[_0x8f53('0x13')](_0x8f53('0xe'),_0x4c28ff,_0x484fc5);_0x4326fe(_0x484fc5);});});}exports['GetCmHopperBlack']=function(_0x50406a){var _0x35f33e=this;return new Promise(function(_0x2347f3,_0x5dcf76){return db['CmHopperBlack'][_0x8f53('0x17')]({'raw':_0x50406a['options']?_0x50406a[_0x8f53('0x18')][_0x8f53('0x19')]===undefined?!![]:![]:!![],'where':_0x50406a[_0x8f53('0x18')]?_0x50406a[_0x8f53('0x18')][_0x8f53('0x1a')]||null:null,'attributes':_0x50406a[_0x8f53('0x18')]?_0x50406a['options'][_0x8f53('0x1b')]||null:null,'limit':_0x50406a[_0x8f53('0x18')]?_0x50406a[_0x8f53('0x18')]['limit']||null:null,'include':_0x50406a[_0x8f53('0x18')]?_0x50406a[_0x8f53('0x18')][_0x8f53('0x1c')]?_[_0x8f53('0x1d')](_0x50406a[_0x8f53('0x18')][_0x8f53('0x1c')],function(_0x1bff0d){return{'model':db[_0x1bff0d[_0x8f53('0x1e')]],'as':_0x1bff0d['as'],'attributes':_0x1bff0d[_0x8f53('0x1b')],'include':_0x1bff0d[_0x8f53('0x1c')]?_[_0x8f53('0x1d')](_0x1bff0d[_0x8f53('0x1c')],function(_0xa456d6){return{'model':db[_0xa456d6[_0x8f53('0x1e')]],'as':_0xa456d6['as'],'attributes':_0xa456d6[_0x8f53('0x1b')],'include':_0xa456d6['include']?_[_0x8f53('0x1d')](_0xa456d6[_0x8f53('0x1c')],function(_0x2948d2){return{'model':db[_0x2948d2['model']],'as':_0x2948d2['as'],'attributes':_0x2948d2['attributes']};}):[]};}):[]};}):[]:[]})[_0x8f53('0xc')](function(_0x398c94){logger[_0x8f53('0xd')](_0x8f53('0x1f'),_0x50406a);logger[_0x8f53('0x20')]('GetCmHopperBlack',_0x50406a,JSON[_0x8f53('0x11')](_0x398c94));_0x2347f3(_0x398c94);})[_0x8f53('0x16')](function(_0x8cee6a){logger[_0x8f53('0x13')]('GetCmHopperBlack',_0x8cee6a[_0x8f53('0x14')],_0x50406a);_0x5dcf76(_0x35f33e['error'](0x1f4,_0x8cee6a[_0x8f53('0x14')]));});});};exports[_0x8f53('0x21')]=function(_0x5b9099){var _0xd76b0e=this;return new Promise(function(_0x20b2e9,_0x5bbe34){return db[_0x8f53('0x22')][_0x8f53('0x23')](_0x5b9099[_0x8f53('0x24')],{'raw':_0x5b9099[_0x8f53('0x18')]?_0x5b9099['options'][_0x8f53('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b9099[_0x8f53('0x18')]?_0x5b9099['options'][_0x8f53('0x1a')]||null:null,'attributes':_0x5b9099['options']?_0x5b9099[_0x8f53('0x18')][_0x8f53('0x1b')]||null:null,'limit':_0x5b9099[_0x8f53('0x18')]?_0x5b9099[_0x8f53('0x18')][_0x8f53('0x25')]||null:null})[_0x8f53('0xc')](function(_0x46684e){logger[_0x8f53('0xd')]('UpdateCmHopperBlack',_0x5b9099);logger['debug'](_0x8f53('0x21'),_0x5b9099,JSON[_0x8f53('0x11')](_0x46684e));_0x20b2e9(_0x46684e);})[_0x8f53('0x16')](function(_0x4d6ca7){logger[_0x8f53('0x13')](_0x8f53('0x21'),_0x4d6ca7['message'],_0x5b9099);_0x5bbe34(_0xd76b0e[_0x8f53('0x13')](0x1f4,_0x4d6ca7[_0x8f53('0x14')]));});});};exports[_0x8f53('0x26')]=function(_0x49639f){var _0x52b23a=this;return new Promise(function(_0x25e363,_0x326a61){return db[_0x8f53('0x22')]['destroy']({'where':_0x49639f['options']?_0x49639f['options'][_0x8f53('0x1a')]||null:null})['then'](function(_0x596d48){logger[_0x8f53('0xd')](_0x8f53('0x26'),_0x49639f);logger[_0x8f53('0x20')]('DestroyCmHopperBlack',_0x49639f,JSON[_0x8f53('0x11')](_0x596d48));_0x25e363(_0x596d48);})[_0x8f53('0x16')](function(_0x14bd32){logger[_0x8f53('0x13')](_0x8f53('0x26'),_0x14bd32[_0x8f53('0x14')],_0x49639f);_0x326a61(_0x52b23a[_0x8f53('0x13')](0x1f4,_0x14bd32[_0x8f53('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c90c224..17e95fc 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 _0x8f9d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','/:id','show','update','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8f9d,0x93));var _0xd8f9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f9d[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f9('0x2'));var router=express[_0xd8f9('0x3')]();var fs_extra=require(_0xd8f9('0x4'));var auth=require(_0xd8f9('0x5'));var interaction=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var controller=require(_0xd8f9('0x8'));router['get']('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xa')]);router[_0xd8f9('0xb')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller['describe']);router[_0xd8f9('0xb')](_0xd8f9('0xd'),auth['isAuthenticated'](),controller[_0xd8f9('0xe')]);router['put']('/:id',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xf')]);router[_0xd8f9('0x10')](_0xd8f9('0xd'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x11')]);module[_0xd8f9('0x12')]=router; \ No newline at end of file +var _0x9a5a=['put','/:id','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0x28ed97,_0x495a6d){var _0x2b247f=function(_0x4a3d78){while(--_0x4a3d78){_0x28ed97['push'](_0x28ed97['shift']());}};_0x2b247f(++_0x495a6d);}(_0x9a5a,0x194));var _0xa9a5=function(_0x14785f,_0x8cef42){_0x14785f=_0x14785f-0x0;var _0x52a6bf=_0x9a5a[_0x14785f];return _0x52a6bf;};'use strict';var multer=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var path=require(_0xa9a5('0x2'));var timeout=require(_0xa9a5('0x3'));var express=require(_0xa9a5('0x4'));var router=express['Router']();var fs_extra=require(_0xa9a5('0x5'));var auth=require(_0xa9a5('0x6'));var interaction=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var controller=require(_0xa9a5('0x9'));router[_0xa9a5('0xa')]('/',auth['isAuthenticated'](),controller[_0xa9a5('0xb')]);router[_0xa9a5('0xa')](_0xa9a5('0xc'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa9a5('0xf')]);router[_0xa9a5('0x10')](_0xa9a5('0x11'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x12')]);router[_0xa9a5('0x13')](_0xa9a5('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 9e8fb5a..e466d11 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 _0x4081=['DATE','STRING','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x3e1ab9,_0x38f016){var _0x1f4dc7=function(_0xdc10a3){while(--_0xdc10a3){_0x3e1ab9['push'](_0x3e1ab9['shift']());}};_0x1f4dc7(++_0x38f016);}(_0x4081,0x168));var _0x1408=function(_0x232657,_0x46517e){_0x232657=_0x232657-0x0;var _0x9ac645=_0x4081[_0x232657];return _0x9ac645;};'use strict';var Sequelize=require(_0x1408('0x0'));var moment=require('moment');module[_0x1408('0x1')]={'state':{'type':Sequelize[_0x1408('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1408('0x3')]},'countbusyretry':{'type':Sequelize[_0x1408('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1408('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1408('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1408('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x1408('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1408('0x4')]},'calleridname':{'type':Sequelize[_0x1408('0x4')]},'starttime':{'type':Sequelize[_0x1408('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x1408('0x3')]},'droptime':{'type':Sequelize[_0x1408('0x3')]},'endtime':{'type':Sequelize[_0x1408('0x3')]},'ringtime':{'type':Sequelize[_0x1408('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1408('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1408('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1408('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x1408('0x4')]},'membername':{'type':Sequelize[_0x1408('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1408('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1408('0x4')]},'dispositionat':{'type':Sequelize[_0x1408('0x3')],'set':function(_0x4f9539){var _0x2dd161=this['getDataValue']('endtime');if(_0x2dd161&&_0x4f9539){this[_0x1408('0x5')](_0x1408('0x6'),moment(_0x4f9539)[_0x1408('0x7')](moment(_0x2dd161),_0x1408('0x8')));}return this[_0x1408('0x5')](_0x1408('0x9'),_0x4f9539);}},'amd':{'type':Sequelize[_0x1408('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1408('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x1408('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x1408('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1408('0x3')]},'deleted':{'type':Sequelize[_0x1408('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x1408('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1408('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x1408('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1408('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1408('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1408('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1408('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1159=['sequelize','moment','exports','INTEGER','DATE','STRING','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN'];(function(_0x7c951c,_0x20f3c7){var _0x233c61=function(_0x3fad66){while(--_0x3fad66){_0x7c951c['push'](_0x7c951c['shift']());}};_0x233c61(++_0x20f3c7);}(_0x1159,0x1e1));var _0x9115=function(_0x21eb06,_0x179e8d){_0x21eb06=_0x21eb06-0x0;var _0x4e5e6a=_0x1159[_0x21eb06];return _0x4e5e6a;};'use strict';var Sequelize=require(_0x9115('0x0'));var moment=require(_0x9115('0x1'));module[_0x9115('0x2')]={'state':{'type':Sequelize[_0x9115('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x9115('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9115('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9115('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9115('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9115('0x5')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9115('0x5')]},'calleridname':{'type':Sequelize[_0x9115('0x5')]},'starttime':{'type':Sequelize[_0x9115('0x4')]},'responsetime':{'type':Sequelize[_0x9115('0x4')]},'answertime':{'type':Sequelize[_0x9115('0x4')]},'droptime':{'type':Sequelize[_0x9115('0x4')]},'endtime':{'type':Sequelize[_0x9115('0x4')]},'ringtime':{'type':Sequelize[_0x9115('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9115('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9115('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9115('0x5')]},'campaign':{'type':Sequelize[_0x9115('0x5')]},'campaigntype':{'type':Sequelize[_0x9115('0x5')]},'membername':{'type':Sequelize[_0x9115('0x5')]},'reason':{'type':Sequelize[_0x9115('0x5')]},'disposition':{'type':Sequelize[_0x9115('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x3cb675){var _0x5c26ea=this['getDataValue'](_0x9115('0x6'));if(_0x5c26ea&&_0x3cb675){this[_0x9115('0x7')](_0x9115('0x8'),moment(_0x3cb675)[_0x9115('0x9')](moment(_0x5c26ea),_0x9115('0xa')));}return this[_0x9115('0x7')](_0x9115('0xb'),_0x3cb675);}},'amd':{'type':Sequelize[_0x9115('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9115('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x9115('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x9115('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x9115('0x4')]},'callback':{'type':Sequelize[_0x9115('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9115('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x9115('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x9115('0x4')]},'recallme':{'type':Sequelize[_0x9115('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x9115('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x9115('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9115('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9115('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9115('0x3')],'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 b7181d0..b9bd1f0 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 _0x9536=['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','CmHopperFinal','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','options','find','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','noSuchContacts','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','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ListId','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(ListId)','CampaignId\x20=\x20?','cm_hopper_final','group','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x208931,_0x3a87b1){var _0x25b01b=function(_0x39a389){while(--_0x39a389){_0x208931['push'](_0x208931['shift']());}};_0x25b01b(++_0x3a87b1);}(_0x9536,0x179));var _0x6953=function(_0x4ec9e3,_0x15fbf4){_0x4ec9e3=_0x4ec9e3-0x0;var _0x2883ce=_0x9536[_0x4ec9e3];return _0x2883ce;};'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['CmHopperFinal'][_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['describe']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['describe']()[_0x6953('0x3c')](respondWithResult(_0x1d5979,null))[_0x6953('0x41')](handleError(_0x1d5979,null));};exports['update']=function(_0x525145,_0xbf5b61){if(_0x525145[_0x6953('0x48')][_0x6953('0x49')]){delete _0x525145[_0x6953('0x48')][_0x6953('0x49')];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'uniqueid':_0x525145[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xbf5b61,null))[_0x6953('0x3c')](saveUpdates(_0x525145[_0x6953('0x48')],null))['then'](respondWithResult(_0xbf5b61,null))['catch'](handleError(_0xbf5b61,null));};exports[_0x6953('0x4a')]=function(_0x38e3e8,_0x68ab5d,_0x7bcd92){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x38e3e8[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db['sequelize']['fn']('COUNT',db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db['sequelize']['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db['sequelize']['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x57')))),'reCallContacts'],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x58')))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x68ab5d,null))['then'](respondWithResult(_0x68ab5d,null))[_0x6953('0x41')](handleError(_0x68ab5d,null));};exports[_0x6953('0x5a')]=function(_0x35ac0e,_0x57ffab,_0x479ab4){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'CampaignId':_0x35ac0e[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5b')))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5c')))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5d')))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x57')))),_0x6953('0x5e')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x57ffab,null))['then'](respondWithResult(_0x57ffab,null))[_0x6953('0x41')](handleError(_0x57ffab,null));};exports[_0x6953('0x5f')]=function(_0x41d74d,_0x5063ac,_0x4cb8a4){return db[_0x6953('0x60')][_0x6953('0x47')]({'where':{'id':_0x41d74d[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x5063ac,null))[_0x6953('0x3c')](function(_0x43a39f){var _0x3cf1c0;if(_0x43a39f){_0x3cf1c0=squel[_0x6953('0x61')]()[_0x6953('0x62')]('cm_hopper')[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),_0x6953('0x66'),'ListId',_0x6953('0x67'),_0x6953('0x68'),_0x6953('0x69')],squel['select']()[_0x6953('0x6a')](_0x6953('0x6b'),_0x6953('0x64'))[_0x6953('0x6a')]('NOW()',_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field']('ANY_VALUE(ListId)',_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x68'))[_0x6953('0x6a')]('NOW()',_0x6953('0x69'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id']['toString']())['where'](_0x6953('0x71'),_0x41d74d[_0x6953('0x48')][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x64'))[_0x6953('0x6f')](_0x6953('0x76'))[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id'][_0x6953('0x73')]()))['where'](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x77'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))['group'](_0x6953('0x66')))[_0x6953('0x73')]();return db[_0x6953('0x4b')][_0x6953('0x2e')](_0x3cf1c0);}return[];})[_0x6953('0x3c')](respondWithResult(_0x5063ac,null))[_0x6953('0x41')](handleError(_0x5063ac,null));};exports[_0x6953('0x79')]=function(_0xa26241,_0xefb593,_0x216b92){return db[_0x6953('0x7a')]['find']({'where':{'id':_0xa26241[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xefb593,null))[_0x6953('0x3c')](function(_0x396a9f){var _0x92c0bc;if(_0x396a9f){_0x92c0bc=squel[_0x6953('0x61')]()[_0x6953('0x62')](_0x6953('0x76'))[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),'ContactId',_0x6953('0x6d'),_0x6953('0x7b'),_0x6953('0x68'),'updatedAt'],squel[_0x6953('0x7c')]()['field']('ANY_VALUE(calleridnum)',_0x6953('0x64'))[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field'](_0x6953('0x7d'),_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(CampaignId)',_0x6953('0x7b'))[_0x6953('0x6a')]('NOW()',_0x6953('0x68'))['field']('NOW()',_0x6953('0x69'))['from']('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id']['toString']())[_0x6953('0x39')](_0x6953('0x71'),_0xa26241['body'][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x64'))['from'](_0x6953('0x76'))[_0x6953('0x39')]('CampaignId\x20=\x20?',_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]()))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x77'))['from'](_0x6953('0x7f'))[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))[_0x6953('0x80')](_0x6953('0x66')))['toString']();return db[_0x6953('0x4b')]['query'](_0x92c0bc);}return[];})[_0x6953('0x3c')](respondWithResult(_0xefb593,null))['catch'](handleError(_0xefb593,null));};exports[_0x6953('0x81')]=function(_0x7215ed,_0x3cb96a,_0x46bcec){return db[_0x6953('0x82')]['findOne']({'where':{'VoiceQueueId':_0x7215ed[_0x6953('0x48')]['VoiceQueueId'],'CampaignId':_0x7215ed[_0x6953('0x48')][_0x6953('0x7b')],'ContactId':_0x7215ed[_0x6953('0x48')][_0x6953('0x66')]}})['then'](handleEntityNotFound(_0x3cb96a,null))[_0x6953('0x3c')](function(_0x50f019){if(_0x50f019){return _0x50f019;}return null;})[_0x6953('0x3c')](respondWithResult(_0x3cb96a,null))[_0x6953('0x41')](handleError(_0x3cb96a,null));}; \ No newline at end of file +var _0x1623=['reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ListId','createdAt','select','ANY_VALUE(calleridnum)','field','NOW()','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','updatedAt','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','CmHopperFinal','findAll','rows','catch','show','params','length','find','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0x3be703,_0x1d24da){var _0x2629c7=function(_0x4a9c3a){while(--_0x4a9c3a){_0x3be703['push'](_0x3be703['shift']());}};_0x2629c7(++_0x1d24da);}(_0x1623,0xab));var _0x3162=function(_0x490314,_0x5476e0){_0x490314=_0x490314-0x0;var _0x5d1bf8=_0x1623[_0x490314];return _0x5d1bf8;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['CmHopperFinal'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':!![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')]()[_0x3162('0x24')](respondWithResult(_0x28865c,null))['catch'](handleError(_0x28865c,null));};exports[_0x3162('0x23')]=function(_0x48cb8f,_0x4f1dde){if(_0x48cb8f[_0x3162('0x48')][_0x3162('0x49')]){delete _0x48cb8f[_0x3162('0x48')][_0x3162('0x49')];}return db['CmHopperFinal'][_0x3162('0x46')]({'where':{'uniqueid':_0x48cb8f['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x4f1dde,null))[_0x3162('0x24')](saveUpdates(_0x48cb8f['body'],null))[_0x3162('0x24')](respondWithResult(_0x4f1dde,null))['catch'](handleError(_0x4f1dde,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x13e7c4,_0x22c0a2,_0x160364){return db[_0x3162('0x3f')][_0x3162('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x13e7c4[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3162('0x4c')))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x50')))),_0x3162('0x51')],[db['sequelize']['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db['sequelize'][_0x3162('0x4e')](_0x3162('0x54')))),'dropContacts'],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),_0x3162('0x56')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3162('0x57')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x58')))),_0x3162('0x59')]]})[_0x3162('0x24')](handleEntityNotFound(_0x22c0a2,null))[_0x3162('0x24')](respondWithResult(_0x22c0a2,null))[_0x3162('0x42')](handleError(_0x22c0a2,null));};exports[_0x3162('0x5a')]=function(_0x4b5729,_0x4a42ea,_0x520b1a){return db[_0x3162('0x3f')]['findAll']({'raw':![],'where':{'CampaignId':_0x4b5729[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5b')))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x50')))),'busyContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x54')))),_0x3162('0x5c')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),'abandonedContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5d')))),'reCallContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x58')))),'answeringMachine']]})[_0x3162('0x24')](handleEntityNotFound(_0x4a42ea,null))[_0x3162('0x24')](respondWithResult(_0x4a42ea,null))[_0x3162('0x42')](handleError(_0x4a42ea,null));};exports[_0x3162('0x5e')]=function(_0x8a75ca,_0x33c39d,_0xb3d824){return db['VoiceQueue']['find']({'where':{'id':_0x8a75ca['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x33c39d,null))[_0x3162('0x24')](function(_0x59b3f7){var _0x129005;if(_0x59b3f7){_0x129005=squel[_0x3162('0x5f')]()[_0x3162('0x60')](_0x3162('0x61'))['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'VoiceQueueId',_0x3162('0x65'),'updatedAt'],squel[_0x3162('0x66')]()['field'](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))[_0x3162('0x68')]('ANY_VALUE(ContactId)',_0x3162('0x6a'))[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x6c'),_0x3162('0x6d'))[_0x3162('0x68')](_0x3162('0x69'),'createdAt')[_0x3162('0x68')](_0x3162('0x69'),'updatedAt')['from'](_0x3162('0x6e'))[_0x3162('0x3c')]('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x8a75ca[_0x3162('0x48')][_0x3162('0x71')][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x3162('0x66')]()[_0x3162('0x68')]('phone')[_0x3162('0x73')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id']['toString']()))[_0x3162('0x3c')](_0x3162('0x74'),squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x76'),_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where'](_0x3162('0x77')))[_0x3162('0x78')](_0x3162('0x6a')))[_0x3162('0x6f')]();return db[_0x3162('0x4a')][_0x3162('0x31')](_0x129005);}return[];})[_0x3162('0x24')](respondWithResult(_0x33c39d,null))[_0x3162('0x42')](handleError(_0x33c39d,null));};exports[_0x3162('0x79')]=function(_0x3f37fa,_0x1d242f,_0x190f91){return db['Campaign'][_0x3162('0x46')]({'where':{'id':_0x3f37fa[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x1d242f,null))['then'](function(_0x3d7bd1){var _0x5cdbb0;if(_0x3d7bd1){_0x5cdbb0=squel[_0x3162('0x5f')]()[_0x3162('0x60')]('cm_hopper')['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'CampaignId',_0x3162('0x65'),_0x3162('0x7a')],squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))['field'](_0x3162('0x7b'),'ContactId')[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x7c'),_0x3162('0x7d'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x65'))[_0x3162('0x68')]('NOW()',_0x3162('0x7a'))[_0x3162('0x73')](_0x3162('0x6e'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x3f37fa[_0x3162('0x48')]['state'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))[_0x3162('0x3c')](_0x3162('0x74'),squel['select']()[_0x3162('0x68')]('phone')[_0x3162('0x73')](_0x3162('0x61'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]()))['where'](_0x3162('0x74'),squel['select']()['field'](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where']('state\x20=\x204'))['group'](_0x3162('0x6a')))[_0x3162('0x6f')]();return db['sequelize']['query'](_0x5cdbb0);}return[];})[_0x3162('0x24')](respondWithResult(_0x1d242f,null))['catch'](handleError(_0x1d242f,null));};exports[_0x3162('0x7f')]=function(_0x35d9f0,_0x4408db,_0x377edb){return db['CmHopper'][_0x3162('0x80')]({'where':{'VoiceQueueId':_0x35d9f0[_0x3162('0x48')][_0x3162('0x6d')],'CampaignId':_0x35d9f0['body'][_0x3162('0x7d')],'ContactId':_0x35d9f0['body'][_0x3162('0x6a')]}})['then'](handleEntityNotFound(_0x4408db,null))[_0x3162('0x24')](function(_0x3d414f){if(_0x3d414f){return _0x3d414f;}return null;})[_0x3162('0x24')](respondWithResult(_0x4408db,null))['catch'](handleError(_0x4408db,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 566d53a..0572c08 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 _0x938c=['moment','bluebird','request-promise','path','rimraf','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0x938c,0x65));var _0xc938=function(_0x51ea96,_0x445a61){_0x51ea96=_0x51ea96-0x0;var _0x526984=_0x938c[_0x51ea96];return _0x526984;};'use strict';var _=require('lodash');var util=require(_0xc938('0x0'));var logger=require(_0xc938('0x1'))(_0xc938('0x2'));var moment=require(_0xc938('0x3'));var BPromise=require(_0xc938('0x4'));var rp=require(_0xc938('0x5'));var fs=require('fs');var path=require(_0xc938('0x6'));var rimraf=require(_0xc938('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0xc938('0x8')]=function(_0x1b3fe9,_0x5669e4){return _0x1b3fe9['define'](_0xc938('0x9'),attributes,{'tableName':_0xc938('0xa'),'paranoid':![],'indexes':[{'name':_0xc938('0xb'),'fields':[_0xc938('0xb')]},{'name':_0xc938('0xc'),'fields':[_0xc938('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d9d=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','bluebird'];(function(_0x59616b,_0x38e534){var _0x5c4523=function(_0x166f2e){while(--_0x166f2e){_0x59616b['push'](_0x59616b['shift']());}};_0x5c4523(++_0x38e534);}(_0x3d9d,0x10d));var _0xd3d9=function(_0xe8cee5,_0x383b1e){_0xe8cee5=_0xe8cee5-0x0;var _0x17b94f=_0x3d9d[_0xe8cee5];return _0x17b94f;};'use strict';var _=require(_0xd3d9('0x0'));var util=require(_0xd3d9('0x1'));var logger=require(_0xd3d9('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd3d9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd3d9('0x4'));var rimraf=require(_0xd3d9('0x5'));var config=require(_0xd3d9('0x6'));var attributes=require(_0xd3d9('0x7'));module[_0xd3d9('0x8')]=function(_0x5d5ca7,_0x1ef8c4){return _0x5d5ca7[_0xd3d9('0x9')](_0xd3d9('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xd3d9('0xb'),'fields':[_0xd3d9('0xb')]},{'name':_0xd3d9('0xc'),'fields':[_0xd3d9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 511ab41..5947308 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(_0x23f0a3,_0x49ba66){var _0x45b8ca=function(_0x2a86d8){while(--_0x2a86d8){_0x23f0a3['push'](_0x23f0a3['shift']());}};_0x45b8ca(++_0x49ba66);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f9939,_0x56fa3b){_0x4f9939=_0x4f9939-0x0;var _0x5e8326=_0xb10b[_0x4f9939];return _0x5e8326;};'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 _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x25edb7,_0x31c7ee){var _0x40daeb=function(_0x506e4a){while(--_0x506e4a){_0x25edb7['push'](_0x25edb7['shift']());}};_0x40daeb(++_0x31c7ee);}(_0x7a54,0x106));var _0x47a5=function(_0x57b9b5,_0x3696ee){_0x57b9b5=_0x57b9b5-0x0;var _0x2e6665=_0x7a54[_0x57b9b5];return _0x2e6665;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index b13e849..83504b8 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 _0x2752=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer'];(function(_0x3f604d,_0x57b887){var _0x1e4e15=function(_0x58e705){while(--_0x58e705){_0x3f604d['push'](_0x3f604d['shift']());}};_0x1e4e15(++_0x57b887);}(_0x2752,0x12b));var _0x2275=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2752[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2275('0x0'));var util=require('util');var path=require(_0x2275('0x1'));var timeout=require('connect-timeout');var express=require(_0x2275('0x2'));var router=express[_0x2275('0x3')]();var fs_extra=require(_0x2275('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2275('0x5'));var config=require(_0x2275('0x6'));var controller=require(_0x2275('0x7'));router[_0x2275('0x8')]('/',auth[_0x2275('0x9')](),controller[_0x2275('0xa')]);router['get'](_0x2275('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x2275('0x8')]('/:id',auth[_0x2275('0x9')](),controller[_0x2275('0xc')]);router[_0x2275('0x8')](_0x2275('0xd'),auth[_0x2275('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x2275('0x8')](_0x2275('0xe'),auth[_0x2275('0x9')](),controller[_0x2275('0xf')]);router[_0x2275('0x10')](_0x2275('0x11'),auth['isAuthenticated'](),controller[_0x2275('0x12')]);router[_0x2275('0x10')](_0x2275('0x13'),auth[_0x2275('0x9')](),controller[_0x2275('0x14')]);router[_0x2275('0x10')](_0x2275('0x15'),auth[_0x2275('0x9')](),controller[_0x2275('0x16')]);router[_0x2275('0x17')]('/:id',auth[_0x2275('0x9')](),controller['update']);module[_0x2275('0x18')]=router; \ No newline at end of file +var _0x5464=['/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','put','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','/describe','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post'];(function(_0x2fdaca,_0x1333a7){var _0x3028a6=function(_0x4952dc){while(--_0x4952dc){_0x2fdaca['push'](_0x2fdaca['shift']());}};_0x3028a6(++_0x1333a7);}(_0x5464,0x15d));var _0x4546=function(_0x3a099b,_0x41d34a){_0x3a099b=_0x3a099b-0x0;var _0x5df68a=_0x5464[_0x3a099b];return _0x5df68a;};'use strict';var multer=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var path=require(_0x4546('0x2'));var timeout=require('connect-timeout');var express=require(_0x4546('0x3'));var router=express['Router']();var fs_extra=require(_0x4546('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4546('0x5'));var config=require(_0x4546('0x6'));var controller=require(_0x4546('0x7'));router[_0x4546('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4546('0x9'),auth[_0x4546('0xa')](),controller[_0x4546('0xb')]);router[_0x4546('0x8')](_0x4546('0xc'),auth[_0x4546('0xa')](),controller[_0x4546('0xd')]);router[_0x4546('0x8')](_0x4546('0xe'),auth['isAuthenticated'](),controller[_0x4546('0xf')]);router[_0x4546('0x8')](_0x4546('0x10'),auth['isAuthenticated'](),controller[_0x4546('0x11')]);router[_0x4546('0x12')](_0x4546('0x13'),auth[_0x4546('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0x4546('0x14'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router['post']('/checkContactHopper',auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x4546('0x15')]('/:id',auth[_0x4546('0xa')](),controller['update']);module[_0x4546('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 45b5694..ba77c78 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 _0xd2fd=['sequelize','INTEGER','DATE','STRING','BOOLEAN'];(function(_0xcbda1,_0x19ffbf){var _0x3e25bf=function(_0x34504c){while(--_0x34504c){_0xcbda1['push'](_0xcbda1['shift']());}};_0x3e25bf(++_0x19ffbf);}(_0xd2fd,0x145));var _0xdd2f=function(_0x3688e8,_0x5e1826){_0x3688e8=_0x3688e8-0x0;var _0x33c03d=_0xd2fd[_0x3688e8];return _0x33c03d;};'use strict';var Sequelize=require(_0xdd2f('0x0'));module['exports']={'state':{'type':Sequelize[_0xdd2f('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xdd2f('0x2')]},'countbusyretry':{'type':Sequelize[_0xdd2f('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdd2f('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xdd2f('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xdd2f('0x3')]},'calleridnum':{'type':Sequelize[_0xdd2f('0x3')]},'calleridname':{'type':Sequelize[_0xdd2f('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xdd2f('0x2')]},'answertime':{'type':Sequelize[_0xdd2f('0x2')]},'droptime':{'type':Sequelize[_0xdd2f('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xdd2f('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xdd2f('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xdd2f('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xdd2f('0x3')]},'campaign':{'type':Sequelize[_0xdd2f('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xdd2f('0x3')]},'reason':{'type':Sequelize[_0xdd2f('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xdd2f('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdd2f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdd2f('0x2')]},'recallme':{'type':Sequelize[_0xdd2f('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xdd2f('0x2')]},'edited':{'type':Sequelize[_0xdd2f('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xdd2f('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdd2f('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdd2f('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xdd2f('0x3')]}}; \ No newline at end of file +var _0xb898=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0xb898,0xcd));var _0x8b89=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xb898[_0x1b349a];return _0x5d1f7c;};'use strict';var Sequelize=require(_0x8b89('0x0'));module[_0x8b89('0x1')]={'state':{'type':Sequelize[_0x8b89('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8b89('0x3')]},'scheduledat':{'type':Sequelize[_0x8b89('0x4')]},'countbusyretry':{'type':Sequelize[_0x8b89('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8b89('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8b89('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8b89('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x8b89('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8b89('0x3')]},'calleridname':{'type':Sequelize[_0x8b89('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x8b89('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x8b89('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x8b89('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8b89('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8b89('0x3')]},'campaign':{'type':Sequelize[_0x8b89('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x8b89('0x3')]},'amd':{'type':Sequelize[_0x8b89('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x8b89('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8b89('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8b89('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8b89('0x4')]},'edited':{'type':Sequelize[_0x8b89('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8b89('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8b89('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8b89('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8b89('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8b89('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 967fd8e..8361cd3 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 _0xb4f5=['type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','CmHopperHistory','findAll','show','params','intersection','includeAll','catch','create','describe','body','find','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','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/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','rawAttributes'];(function(_0x50653c,_0x81fc99){var _0x37c8fc=function(_0x350a56){while(--_0x350a56){_0x50653c['push'](_0x50653c['shift']());}};_0x37c8fc(++_0x81fc99);}(_0xb4f5,0x69));var _0x5b4f=function(_0x3bac2b,_0x2de937){_0x3bac2b=_0x3bac2b-0x0;var _0xc43b6a=_0xb4f5[_0x3bac2b];return _0xc43b6a;};'use strict';var emlformat=require(_0x5b4f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b4f('0x1'));var jsonpatch=require(_0x5b4f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5b4f('0x3'));var Mustache=require(_0x5b4f('0x4'));var util=require(_0x5b4f('0x5'));var path=require(_0x5b4f('0x6'));var sox=require(_0x5b4f('0x7'));var csv=require(_0x5b4f('0x8'));var ejs=require(_0x5b4f('0x9'));var fs=require('fs');var fs_extra=require(_0x5b4f('0xa'));var _=require(_0x5b4f('0xb'));var squel=require(_0x5b4f('0xc'));var crypto=require(_0x5b4f('0xd'));var jsforce=require(_0x5b4f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5b4f('0x8'));var querystring=require(_0x5b4f('0xf'));var Papa=require(_0x5b4f('0x10'));var Redis=require(_0x5b4f('0x11'));var authService=require(_0x5b4f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5b4f('0x13'));var hardwareService=require(_0x5b4f('0x14'));var logger=require(_0x5b4f('0x15'))(_0x5b4f('0x16'));var utils=require(_0x5b4f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5b4f('0x18'))['db'];function respondWithStatusCode(_0x481818,_0x16b6e0){_0x16b6e0=_0x16b6e0||0xcc;return function(_0x25edef){if(_0x25edef){return _0x481818[_0x5b4f('0x19')](_0x16b6e0);}return _0x481818[_0x5b4f('0x1a')](_0x16b6e0)[_0x5b4f('0x1b')]();};}function respondWithResult(_0x2dcd14,_0x353e97){_0x353e97=_0x353e97||0xc8;return function(_0x212bbe){if(_0x212bbe){return _0x2dcd14['status'](_0x353e97)[_0x5b4f('0x1c')](_0x212bbe);}};}function respondWithFilteredResult(_0x317129,_0x4c377c){return function(_0x446edb){if(_0x446edb){var _0x2ed228=typeof _0x4c377c[_0x5b4f('0x1d')]===_0x5b4f('0x1e')&&typeof _0x4c377c[_0x5b4f('0x1f')]===_0x5b4f('0x1e');var _0x24c5ad=_0x446edb['count'];var _0x5b38b9=_0x2ed228?0x0:_0x4c377c[_0x5b4f('0x1d')];var _0x1b42b1=_0x2ed228?_0x446edb[_0x5b4f('0x20')]:_0x4c377c[_0x5b4f('0x1d')]+_0x4c377c[_0x5b4f('0x1f')];var _0x1a06ec;if(_0x1b42b1>=_0x24c5ad){_0x1b42b1=_0x24c5ad;_0x1a06ec=0xc8;}else{_0x1a06ec=0xce;}_0x317129[_0x5b4f('0x1a')](_0x1a06ec);return _0x317129[_0x5b4f('0x21')](_0x5b4f('0x22'),_0x5b38b9+'-'+_0x1b42b1+'/'+_0x24c5ad)[_0x5b4f('0x1c')](_0x446edb);}return null;};}function patchUpdates(_0x351403){return function(_0x15ab02){try{jsonpatch[_0x5b4f('0x23')](_0x15ab02,_0x351403,!![]);}catch(_0x358705){return BPromise[_0x5b4f('0x24')](_0x358705);}return _0x15ab02['save']();};}function saveUpdates(_0xa26bc9,_0x47717d){return function(_0x49ada7){if(_0x49ada7){return _0x49ada7[_0x5b4f('0x25')](_0xa26bc9)[_0x5b4f('0x26')](function(_0x122468){return _0x122468;});}return null;};}function removeEntity(_0x5e91b0,_0x4f36a4){return function(_0x355d7f){if(_0x355d7f){return _0x355d7f['destroy']()['then'](function(){_0x5e91b0[_0x5b4f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x547471,_0x447fe3){return function(_0x4d20b6){if(!_0x4d20b6){_0x547471[_0x5b4f('0x19')](0x194);}return _0x4d20b6;};}function handleError(_0x488d11,_0x35bd85){_0x35bd85=_0x35bd85||0x1f4;return function(_0x585324){logger[_0x5b4f('0x27')](_0x585324[_0x5b4f('0x28')]);if(_0x585324[_0x5b4f('0x29')]){delete _0x585324[_0x5b4f('0x29')];}_0x488d11[_0x5b4f('0x1a')](_0x35bd85)[_0x5b4f('0x2a')](_0x585324);};}exports[_0x5b4f('0x2b')]=function(_0x572fef,_0xc8b8be){var _0x37126a={},_0xfa34f7={},_0x15179e={'count':0x0,'rows':[]};var _0x382f58=_['map'](db['CmHopperHistory'][_0x5b4f('0x2c')],function(_0x2651a8){return{'name':_0x2651a8['fieldName'],'type':_0x2651a8[_0x5b4f('0x2d')][_0x5b4f('0x2e')]};});_0xfa34f7[_0x5b4f('0x2f')]=_[_0x5b4f('0x30')](_0x382f58,_0x5b4f('0x29'));_0xfa34f7[_0x5b4f('0x31')]=_[_0x5b4f('0x32')](_0x572fef[_0x5b4f('0x31')]);_0xfa34f7['filters']=_['intersection'](_0xfa34f7[_0x5b4f('0x2f')],_0xfa34f7[_0x5b4f('0x31')]);_0x37126a[_0x5b4f('0x33')]=_['intersection'](_0xfa34f7['model'],qs['fields'](_0x572fef[_0x5b4f('0x31')][_0x5b4f('0x34')]));_0x37126a['attributes']=_0x37126a[_0x5b4f('0x33')][_0x5b4f('0x35')]?_0x37126a[_0x5b4f('0x33')]:_0xfa34f7[_0x5b4f('0x2f')];if(!_0x572fef[_0x5b4f('0x31')][_0x5b4f('0x36')](_0x5b4f('0x37'))){_0x37126a[_0x5b4f('0x1f')]=qs['limit'](_0x572fef[_0x5b4f('0x31')][_0x5b4f('0x1f')]);_0x37126a['offset']=qs[_0x5b4f('0x1d')](_0x572fef[_0x5b4f('0x31')][_0x5b4f('0x1d')]);}_0x37126a[_0x5b4f('0x38')]=qs[_0x5b4f('0x39')](_0x572fef[_0x5b4f('0x31')][_0x5b4f('0x39')]);_0x37126a['where']=qs[_0x5b4f('0x3a')](_['pick'](_0x572fef[_0x5b4f('0x31')],_0xfa34f7[_0x5b4f('0x3a')]),_0x382f58);if(_0x572fef[_0x5b4f('0x31')][_0x5b4f('0x3b')]){_0x37126a[_0x5b4f('0x3c')]=_[_0x5b4f('0x3d')](_0x37126a[_0x5b4f('0x3c')],{'$or':_[_0x5b4f('0x30')](_0x382f58,function(_0x2cdb41){if(_0x2cdb41[_0x5b4f('0x2d')]!==_0x5b4f('0x3e')){var _0x2fb951={};_0x2fb951[_0x2cdb41[_0x5b4f('0x29')]]={'$like':'%'+_0x572fef[_0x5b4f('0x31')][_0x5b4f('0x3b')]+'%'};return _0x2fb951;}})});}_0x37126a=_[_0x5b4f('0x3d')]({},_0x37126a,_0x572fef[_0x5b4f('0x3f')]);var _0x4ea8a8={'where':_0x37126a[_0x5b4f('0x3c')]};return db[_0x5b4f('0x40')][_0x5b4f('0x20')](_0x4ea8a8)['then'](function(_0x526844){_0x15179e[_0x5b4f('0x20')]=_0x526844;if(_0x572fef['query']['includeAll']){_0x37126a['include']=[{'all':!![]}];}return db[_0x5b4f('0x40')][_0x5b4f('0x41')](_0x37126a);})['then'](function(_0x3998e3){_0x15179e['rows']=_0x3998e3;return _0x15179e;})[_0x5b4f('0x26')](respondWithFilteredResult(_0xc8b8be,_0x37126a))['catch'](handleError(_0xc8b8be,null));};exports[_0x5b4f('0x42')]=function(_0x47a98a,_0x5cbb08){var _0x31d717={'raw':!![],'where':{'id':_0x47a98a[_0x5b4f('0x43')]['id']}},_0x47f4dc={};_0x47f4dc[_0x5b4f('0x2f')]=_[_0x5b4f('0x32')](db[_0x5b4f('0x40')][_0x5b4f('0x2c')]);_0x47f4dc['query']=_[_0x5b4f('0x32')](_0x47a98a[_0x5b4f('0x31')]);_0x47f4dc[_0x5b4f('0x3a')]=_[_0x5b4f('0x44')](_0x47f4dc['model'],_0x47f4dc[_0x5b4f('0x31')]);_0x31d717[_0x5b4f('0x33')]=_[_0x5b4f('0x44')](_0x47f4dc[_0x5b4f('0x2f')],qs['fields'](_0x47a98a[_0x5b4f('0x31')][_0x5b4f('0x34')]));_0x31d717['attributes']=_0x31d717['attributes'][_0x5b4f('0x35')]?_0x31d717['attributes']:_0x47f4dc[_0x5b4f('0x2f')];if(_0x47a98a['query'][_0x5b4f('0x45')]){_0x31d717['include']=[{'all':!![]}];}_0x31d717=_[_0x5b4f('0x3d')]({},_0x31d717,_0x47a98a['options']);return db[_0x5b4f('0x40')]['find'](_0x31d717)[_0x5b4f('0x26')](handleEntityNotFound(_0x5cbb08,null))[_0x5b4f('0x26')](respondWithResult(_0x5cbb08,null))[_0x5b4f('0x46')](handleError(_0x5cbb08,null));};exports['create']=function(_0x2a79e6,_0x1ba9fc){return db['CmHopperHistory'][_0x5b4f('0x47')](_0x2a79e6['body'],{})[_0x5b4f('0x26')](respondWithResult(_0x1ba9fc,0xc9))['catch'](handleError(_0x1ba9fc,null));};exports['describe']=function(_0x2cec99,_0x340a7a){return db[_0x5b4f('0x40')][_0x5b4f('0x48')]()[_0x5b4f('0x26')](respondWithResult(_0x340a7a,null))[_0x5b4f('0x46')](handleError(_0x340a7a,null));};exports[_0x5b4f('0x25')]=function(_0x5397b1,_0x164035){if(_0x5397b1[_0x5b4f('0x49')]['uniqueid']){delete _0x5397b1[_0x5b4f('0x49')]['uniqueid'];}return db[_0x5b4f('0x40')][_0x5b4f('0x4a')]({'where':{'uniqueid':_0x5397b1[_0x5b4f('0x43')]['id']}})['then'](handleEntityNotFound(_0x164035,null))[_0x5b4f('0x26')](saveUpdates(_0x5397b1[_0x5b4f('0x49')],null))[_0x5b4f('0x26')](respondWithResult(_0x164035,null))[_0x5b4f('0x46')](handleError(_0x164035,null));}; \ No newline at end of file +var _0xe7e0=['Content-Range','json','reject','save','update','then','error','stack','name','index','map','CmHopperHistory','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','catch','rawAttributes','length','include','find','create','body','describe','uniqueid','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','count','limit','set'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0xe7e0,0x199));var _0x0e7e=function(_0x1d71ef,_0xa5f43a){_0x1d71ef=_0x1d71ef-0x0;var _0x438e43=_0xe7e0[_0x1d71ef];return _0x438e43;};'use strict';var emlformat=require(_0x0e7e('0x0'));var rimraf=require(_0x0e7e('0x1'));var zipdir=require(_0x0e7e('0x2'));var jsonpatch=require(_0x0e7e('0x3'));var rp=require(_0x0e7e('0x4'));var moment=require(_0x0e7e('0x5'));var BPromise=require(_0x0e7e('0x6'));var Mustache=require(_0x0e7e('0x7'));var util=require(_0x0e7e('0x8'));var path=require(_0x0e7e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e7e('0xa'));var _=require('lodash');var squel=require(_0x0e7e('0xb'));var crypto=require(_0x0e7e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0e7e('0xd'));var querystring=require('querystring');var Papa=require(_0x0e7e('0xe'));var Redis=require(_0x0e7e('0xf'));var authService=require(_0x0e7e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e7e('0x11'));var logger=require(_0x0e7e('0x12'))(_0x0e7e('0x13'));var utils=require(_0x0e7e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0e7e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec7e5,_0x2e7466){_0x2e7466=_0x2e7466||0xcc;return function(_0x381a6a){if(_0x381a6a){return _0xec7e5[_0x0e7e('0x16')](_0x2e7466);}return _0xec7e5[_0x0e7e('0x17')](_0x2e7466)[_0x0e7e('0x18')]();};}function respondWithResult(_0x5071f,_0x5ea24b){_0x5ea24b=_0x5ea24b||0xc8;return function(_0x5504b9){if(_0x5504b9){return _0x5071f[_0x0e7e('0x17')](_0x5ea24b)['json'](_0x5504b9);}};}function respondWithFilteredResult(_0x51423d,_0x3ce48c){return function(_0x22c77c){if(_0x22c77c){var _0x3b0b78=typeof _0x3ce48c[_0x0e7e('0x19')]==='undefined'&&typeof _0x3ce48c['limit']==='undefined';var _0x19870d=_0x22c77c[_0x0e7e('0x1a')];var _0x51b37e=_0x3b0b78?0x0:_0x3ce48c['offset'];var _0x555777=_0x3b0b78?_0x22c77c[_0x0e7e('0x1a')]:_0x3ce48c[_0x0e7e('0x19')]+_0x3ce48c[_0x0e7e('0x1b')];var _0x2cdab5;if(_0x555777>=_0x19870d){_0x555777=_0x19870d;_0x2cdab5=0xc8;}else{_0x2cdab5=0xce;}_0x51423d[_0x0e7e('0x17')](_0x2cdab5);return _0x51423d[_0x0e7e('0x1c')](_0x0e7e('0x1d'),_0x51b37e+'-'+_0x555777+'/'+_0x19870d)[_0x0e7e('0x1e')](_0x22c77c);}return null;};}function patchUpdates(_0xb689fd){return function(_0x5b1168){try{jsonpatch['apply'](_0x5b1168,_0xb689fd,!![]);}catch(_0x372394){return BPromise[_0x0e7e('0x1f')](_0x372394);}return _0x5b1168[_0x0e7e('0x20')]();};}function saveUpdates(_0x345507,_0x43b900){return function(_0x5c8b73){if(_0x5c8b73){return _0x5c8b73[_0x0e7e('0x21')](_0x345507)['then'](function(_0x24ef96){return _0x24ef96;});}return null;};}function removeEntity(_0x4d7ebb,_0x142775){return function(_0x25ac3a){if(_0x25ac3a){return _0x25ac3a['destroy']()[_0x0e7e('0x22')](function(){_0x4d7ebb[_0x0e7e('0x17')](0xcc)[_0x0e7e('0x18')]();});}};}function handleEntityNotFound(_0x547f8b,_0x1aea7a){return function(_0x1a3814){if(!_0x1a3814){_0x547f8b['sendStatus'](0x194);}return _0x1a3814;};}function handleError(_0x55831f,_0x1bd2aa){_0x1bd2aa=_0x1bd2aa||0x1f4;return function(_0x3bc65d){logger[_0x0e7e('0x23')](_0x3bc65d[_0x0e7e('0x24')]);if(_0x3bc65d[_0x0e7e('0x25')]){delete _0x3bc65d[_0x0e7e('0x25')];}_0x55831f[_0x0e7e('0x17')](_0x1bd2aa)['send'](_0x3bc65d);};}exports[_0x0e7e('0x26')]=function(_0x1189c0,_0x315d8f){var _0xe0faa9={},_0x410a09={},_0x203973={'count':0x0,'rows':[]};var _0x473250=_[_0x0e7e('0x27')](db[_0x0e7e('0x28')]['rawAttributes'],function(_0x117f4b){return{'name':_0x117f4b[_0x0e7e('0x29')],'type':_0x117f4b['type'][_0x0e7e('0x2a')]};});_0x410a09[_0x0e7e('0x2b')]=_[_0x0e7e('0x27')](_0x473250,'name');_0x410a09[_0x0e7e('0x2c')]=_[_0x0e7e('0x2d')](_0x1189c0['query']);_0x410a09[_0x0e7e('0x2e')]=_[_0x0e7e('0x2f')](_0x410a09[_0x0e7e('0x2b')],_0x410a09[_0x0e7e('0x2c')]);_0xe0faa9[_0x0e7e('0x30')]=_[_0x0e7e('0x2f')](_0x410a09['model'],qs[_0x0e7e('0x31')](_0x1189c0[_0x0e7e('0x2c')][_0x0e7e('0x31')]));_0xe0faa9['attributes']=_0xe0faa9['attributes']['length']?_0xe0faa9[_0x0e7e('0x30')]:_0x410a09[_0x0e7e('0x2b')];if(!_0x1189c0['query'][_0x0e7e('0x32')](_0x0e7e('0x33'))){_0xe0faa9[_0x0e7e('0x1b')]=qs[_0x0e7e('0x1b')](_0x1189c0['query']['limit']);_0xe0faa9[_0x0e7e('0x19')]=qs['offset'](_0x1189c0['query']['offset']);}_0xe0faa9[_0x0e7e('0x34')]=qs[_0x0e7e('0x35')](_0x1189c0[_0x0e7e('0x2c')]['sort']);_0xe0faa9[_0x0e7e('0x36')]=qs[_0x0e7e('0x2e')](_[_0x0e7e('0x37')](_0x1189c0[_0x0e7e('0x2c')],_0x410a09['filters']),_0x473250);if(_0x1189c0[_0x0e7e('0x2c')]['filter']){_0xe0faa9[_0x0e7e('0x36')]=_[_0x0e7e('0x38')](_0xe0faa9[_0x0e7e('0x36')],{'$or':_[_0x0e7e('0x27')](_0x473250,function(_0x37cb2a){if(_0x37cb2a[_0x0e7e('0x39')]!==_0x0e7e('0x3a')){var _0x51b6b2={};_0x51b6b2[_0x37cb2a['name']]={'$like':'%'+_0x1189c0[_0x0e7e('0x2c')][_0x0e7e('0x3b')]+'%'};return _0x51b6b2;}})});}_0xe0faa9=_['merge']({},_0xe0faa9,_0x1189c0[_0x0e7e('0x3c')]);var _0x5ad53c={'where':_0xe0faa9[_0x0e7e('0x36')]};return db[_0x0e7e('0x28')][_0x0e7e('0x1a')](_0x5ad53c)[_0x0e7e('0x22')](function(_0x1d4f92){_0x203973[_0x0e7e('0x1a')]=_0x1d4f92;if(_0x1189c0[_0x0e7e('0x2c')][_0x0e7e('0x3d')]){_0xe0faa9['include']=[{'all':!![]}];}return db[_0x0e7e('0x28')][_0x0e7e('0x3e')](_0xe0faa9);})[_0x0e7e('0x22')](function(_0x7222e9){_0x203973['rows']=_0x7222e9;return _0x203973;})[_0x0e7e('0x22')](respondWithFilteredResult(_0x315d8f,_0xe0faa9))[_0x0e7e('0x3f')](handleError(_0x315d8f,null));};exports['show']=function(_0x183694,_0x3b79f3){var _0x4f8a0f={'raw':!![],'where':{'id':_0x183694['params']['id']}},_0x37e093={};_0x37e093[_0x0e7e('0x2b')]=_[_0x0e7e('0x2d')](db[_0x0e7e('0x28')][_0x0e7e('0x40')]);_0x37e093[_0x0e7e('0x2c')]=_[_0x0e7e('0x2d')](_0x183694['query']);_0x37e093['filters']=_['intersection'](_0x37e093['model'],_0x37e093[_0x0e7e('0x2c')]);_0x4f8a0f[_0x0e7e('0x30')]=_[_0x0e7e('0x2f')](_0x37e093[_0x0e7e('0x2b')],qs['fields'](_0x183694[_0x0e7e('0x2c')][_0x0e7e('0x31')]));_0x4f8a0f[_0x0e7e('0x30')]=_0x4f8a0f[_0x0e7e('0x30')][_0x0e7e('0x41')]?_0x4f8a0f['attributes']:_0x37e093[_0x0e7e('0x2b')];if(_0x183694[_0x0e7e('0x2c')][_0x0e7e('0x3d')]){_0x4f8a0f[_0x0e7e('0x42')]=[{'all':!![]}];}_0x4f8a0f=_[_0x0e7e('0x38')]({},_0x4f8a0f,_0x183694[_0x0e7e('0x3c')]);return db[_0x0e7e('0x28')][_0x0e7e('0x43')](_0x4f8a0f)[_0x0e7e('0x22')](handleEntityNotFound(_0x3b79f3,null))[_0x0e7e('0x22')](respondWithResult(_0x3b79f3,null))[_0x0e7e('0x3f')](handleError(_0x3b79f3,null));};exports[_0x0e7e('0x44')]=function(_0x4d146c,_0x3cc1cb){return db['CmHopperHistory']['create'](_0x4d146c[_0x0e7e('0x45')],{})[_0x0e7e('0x22')](respondWithResult(_0x3cc1cb,0xc9))[_0x0e7e('0x3f')](handleError(_0x3cc1cb,null));};exports['describe']=function(_0x34351f,_0x375b66){return db['CmHopperHistory'][_0x0e7e('0x46')]()[_0x0e7e('0x22')](respondWithResult(_0x375b66,null))[_0x0e7e('0x3f')](handleError(_0x375b66,null));};exports['update']=function(_0x20f523,_0x20a7eb){if(_0x20f523[_0x0e7e('0x45')][_0x0e7e('0x47')]){delete _0x20f523['body'][_0x0e7e('0x47')];}return db[_0x0e7e('0x28')]['find']({'where':{'uniqueid':_0x20f523[_0x0e7e('0x48')]['id']}})[_0x0e7e('0x22')](handleEntityNotFound(_0x20a7eb,null))[_0x0e7e('0x22')](saveUpdates(_0x20f523['body'],null))[_0x0e7e('0x22')](respondWithResult(_0x20a7eb,null))[_0x0e7e('0x3f')](handleError(_0x20a7eb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index fd40c5b..a4cffd4 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 _0xa6b0=['./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3871a5,_0x53821c){var _0x137243=function(_0x1e6634){while(--_0x1e6634){_0x3871a5['push'](_0x3871a5['shift']());}};_0x137243(++_0x53821c);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x274d7b,_0x6c43cf){_0x274d7b=_0x274d7b-0x0;var _0x2c87c2=_0xa6b0[_0x274d7b];return _0x2c87c2;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a6b('0x2'));var BPromise=require(_0x0a6b('0x3'));var rp=require(_0x0a6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var attributes=require(_0x0a6b('0x7'));module[_0x0a6b('0x8')]=function(_0x3dc2b0,_0x3b6967){return _0x3dc2b0[_0x0a6b('0x9')](_0x0a6b('0xa'),attributes,{'tableName':_0x0a6b('0xb'),'paranoid':![],'indexes':[{'name':_0x0a6b('0xc'),'fields':[_0x0a6b('0xc')]},{'name':_0x0a6b('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe61c=['api','moment','path','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid','lodash','../../config/logger'];(function(_0x2f7219,_0x1f38ec){var _0x4c4749=function(_0x50930f){while(--_0x50930f){_0x2f7219['push'](_0x2f7219['shift']());}};_0x4c4749(++_0x1f38ec);}(_0xe61c,0xee));var _0xce61=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0xe61c[_0x3d9176];return _0x12adc5;};'use strict';var _=require(_0xce61('0x0'));var util=require('util');var logger=require(_0xce61('0x1'))(_0xce61('0x2'));var moment=require(_0xce61('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xce61('0x4'));var rimraf=require('rimraf');var config=require(_0xce61('0x5'));var attributes=require(_0xce61('0x6'));module[_0xce61('0x7')]=function(_0x200b9a,_0x239319){return _0x200b9a[_0xce61('0x8')](_0xce61('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xce61('0xa'),'fields':[_0xce61('0xa')]},{'name':_0xce61('0xb'),'fields':[_0xce61('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index c9a5c98..3993f9f 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 _0xe844=['body','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','where','COUNT','col','predictiveIntervalTotalCalls','sequelize','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','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CmHopperHistory','create'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xe844,0xba));var _0x4e84=function(_0x33c2b9,_0x1e3b90){_0x33c2b9=_0x33c2b9-0x0;var _0x28700e=_0xe844[_0x33c2b9];return _0x28700e;};'use strict';var _=require(_0x4e84('0x0'));var util=require(_0x4e84('0x1'));var moment=require(_0x4e84('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e84('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e84('0x4'));var logger=require(_0x4e84('0x5'))(_0x4e84('0x6'));var config=require(_0x4e84('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4e84('0x8')][_0x4e84('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19a679,_0x41d6b0,_0x41c4d4){return new BPromise(function(_0x357196,_0xf4176b){return client[_0x4e84('0xa')](_0x19a679,_0x41c4d4)[_0x4e84('0xb')](function(_0x518e6e){logger[_0x4e84('0xc')](_0x4e84('0xd'),_0x41d6b0,_0x4e84('0xe'));logger[_0x4e84('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x41d6b0,_0x4e84('0xe'),JSON[_0x4e84('0x10')](_0x518e6e));if(_0x518e6e[_0x4e84('0x11')]){if(_0x518e6e[_0x4e84('0x11')][_0x4e84('0x12')]===0x1f4){logger[_0x4e84('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x41d6b0,_0x518e6e[_0x4e84('0x11')][_0x4e84('0x13')]);return _0xf4176b(_0x518e6e[_0x4e84('0x11')][_0x4e84('0x13')]);}logger[_0x4e84('0x11')](_0x4e84('0xd'),_0x41d6b0,_0x518e6e[_0x4e84('0x11')][_0x4e84('0x13')]);return _0x357196(_0x518e6e[_0x4e84('0x11')]['message']);}else{logger[_0x4e84('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x41d6b0,_0x4e84('0xe'));_0x357196(_0x518e6e[_0x4e84('0x14')][_0x4e84('0x13')]);}})[_0x4e84('0x15')](function(_0x35e214){logger['error'](_0x4e84('0xd'),_0x41d6b0,_0x35e214);_0xf4176b(_0x35e214);});});}exports['CreateCmHopperHistory']=function(_0x5c3e81){var _0x23d7ac=this;return new Promise(function(_0x28fae0,_0x41a0ea){return db[_0x4e84('0x16')][_0x4e84('0x17')](_0x5c3e81[_0x4e84('0x18')],{'raw':_0x5c3e81[_0x4e84('0x19')]?_0x5c3e81['options'][_0x4e84('0x1a')]===undefined?!![]:![]:!![]})[_0x4e84('0xb')](function(_0x11b884){logger[_0x4e84('0xc')](_0x4e84('0x1b'),_0x5c3e81);logger[_0x4e84('0xf')](_0x4e84('0x1b'),_0x5c3e81,JSON[_0x4e84('0x10')](_0x11b884));_0x28fae0(_0x11b884);})['catch'](function(_0x588d2c){logger[_0x4e84('0x11')](_0x4e84('0x1b'),_0x588d2c[_0x4e84('0x13')],_0x5c3e81);_0x41a0ea(_0x23d7ac[_0x4e84('0x11')](0x1f4,_0x588d2c[_0x4e84('0x13')]));});});};exports[_0x4e84('0x1c')]=function(_0x368323){var _0x5ac348=this;return new Promise(function(_0x719ca7,_0x103a79){return db[_0x4e84('0x16')][_0x4e84('0x1d')]({'raw':_0x368323[_0x4e84('0x19')]?_0x368323[_0x4e84('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x368323[_0x4e84('0x19')]?_0x368323[_0x4e84('0x19')][_0x4e84('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x4e84('0x1f'),db['sequelize'][_0x4e84('0x20')]('id')),_0x4e84('0x21')],[db[_0x4e84('0x22')]['fn'](_0x4e84('0x1f'),db[_0x4e84('0x22')]['fn']('IF',db[_0x4e84('0x22')][_0x4e84('0x23')](_0x4e84('0x24')))),_0x4e84('0x25')],[db[_0x4e84('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4e84('0x22')][_0x4e84('0x23')](_0x4e84('0x26')))),_0x4e84('0x27')],[db[_0x4e84('0x22')]['fn'](_0x4e84('0x1f'),db[_0x4e84('0x22')]['fn']('IF',db[_0x4e84('0x22')][_0x4e84('0x23')](_0x4e84('0x28')))),_0x4e84('0x29')],[db[_0x4e84('0x22')]['fn'](_0x4e84('0x2a'),db['sequelize']['fn']('IF',db[_0x4e84('0x22')]['literal'](_0x4e84('0x2b')))),_0x4e84('0x2c')],[db[_0x4e84('0x22')]['fn']('AVG',db[_0x4e84('0x22')]['fn']('IF',db[_0x4e84('0x22')][_0x4e84('0x23')](_0x4e84('0x2d')))),_0x4e84('0x2e')]]})[_0x4e84('0xb')](function(_0x553537){logger['info'](_0x4e84('0x1c'),_0x368323);logger[_0x4e84('0xf')]('AvgHandleTime',_0x368323,JSON[_0x4e84('0x10')](_0x553537));_0x719ca7(_0x553537);})[_0x4e84('0x15')](function(_0x85bd9d){logger['error']('AvgHandleTime',_0x85bd9d[_0x4e84('0x13')],_0x368323);_0x103a79(_0x5ac348[_0x4e84('0x11')](0x1f4,_0x85bd9d['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0xba9661){var _0x317f52=this;return new Promise(function(_0x5e1264,_0x168a86){return db[_0x4e84('0x16')]['findAll']({'raw':_0xba9661[_0x4e84('0x19')]?_0xba9661[_0x4e84('0x19')][_0x4e84('0x1a')]===undefined?!![]:![]:!![],'where':_0xba9661['options']?_0xba9661['options'][_0x4e84('0x1e')]||null:null,'attributes':[[_0x4e84('0x2f'),_0x4e84('0x30')],[db['sequelize']['fn'](_0x4e84('0x1f'),db[_0x4e84('0x22')]['fn']('IF',db[_0x4e84('0x22')][_0x4e84('0x23')](_0x4e84('0x31')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x4e84('0x22')]['fn']('IF',db['sequelize']['literal'](_0x4e84('0x32')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0x4e84('0x1f'),db[_0x4e84('0x22')]['fn']('IF',db['sequelize'][_0x4e84('0x23')](_0x4e84('0x24')))),_0x4e84('0x33')],[db[_0x4e84('0x22')]['fn'](_0x4e84('0x1f'),db[_0x4e84('0x22')]['fn']('IF',db[_0x4e84('0x22')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x4e84('0x34')],[db[_0x4e84('0x22')]['fn'](_0x4e84('0x1f'),db[_0x4e84('0x22')]['fn']('IF',db[_0x4e84('0x22')][_0x4e84('0x23')]('`state`\x20=\x208,\x201,\x20null'))),_0x4e84('0x35')],[db[_0x4e84('0x22')]['fn'](_0x4e84('0x1f'),db[_0x4e84('0x22')]['fn']('IF',db['sequelize'][_0x4e84('0x23')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4e84('0x36')],[db[_0x4e84('0x22')]['fn'](_0x4e84('0x1f'),db[_0x4e84('0x22')]['fn']('IF',db[_0x4e84('0x22')][_0x4e84('0x23')](_0x4e84('0x37')))),_0x4e84('0x38')],[db[_0x4e84('0x22')]['fn']('COUNT',db[_0x4e84('0x22')]['fn']('IF',db['sequelize'][_0x4e84('0x23')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0x4e84('0x22')]['fn']('COUNT',db[_0x4e84('0x22')]['fn']('IF',db[_0x4e84('0x22')][_0x4e84('0x23')](_0x4e84('0x39')))),_0x4e84('0x3a')],[db[_0x4e84('0x22')]['fn'](_0x4e84('0x1f'),db[_0x4e84('0x22')]['fn']('IF',db[_0x4e84('0x22')][_0x4e84('0x23')]('`state`\x20=\x2014,\x201,\x20null'))),_0x4e84('0x3b')],[db[_0x4e84('0x22')]['fn'](_0x4e84('0x1f'),db[_0x4e84('0x22')]['fn']('IF',db[_0x4e84('0x22')]['literal'](_0x4e84('0x3c')))),_0x4e84('0x3d')],[db['sequelize']['fn'](_0x4e84('0x1f'),db['sequelize']['fn']('IF',db[_0x4e84('0x22')][_0x4e84('0x23')](_0x4e84('0x3e')))),_0x4e84('0x3f')],[db['sequelize']['fn'](_0x4e84('0x1f'),db[_0x4e84('0x22')]['fn']('IF',db[_0x4e84('0x22')][_0x4e84('0x23')](_0x4e84('0x40')))),_0x4e84('0x3d')],[db[_0x4e84('0x22')]['fn'](_0x4e84('0x1f'),db[_0x4e84('0x22')]['fn']('IF',db[_0x4e84('0x22')][_0x4e84('0x23')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x4e84('0x41')]],'group':['campaign']})[_0x4e84('0xb')](function(_0x5c3459){logger[_0x4e84('0xc')](_0x4e84('0x42'),_0xba9661);logger[_0x4e84('0xf')](_0x4e84('0x42'),_0xba9661,JSON[_0x4e84('0x10')](_0x5c3459));_0x5e1264(_0x5c3459);})[_0x4e84('0x15')](function(_0x344c7a){logger[_0x4e84('0x11')](_0x4e84('0x42'),_0x344c7a[_0x4e84('0x13')],_0xba9661);_0x168a86(_0x317f52['error'](0x1f4,_0x344c7a[_0x4e84('0x13')]));});});};exports[_0x4e84('0x43')]=function(_0x1eaf0f){var _0x5aa700=this;return new Promise(function(_0x177e06,_0x17bd52){return db[_0x4e84('0x16')][_0x4e84('0x1d')]({'raw':_0x1eaf0f[_0x4e84('0x19')]?_0x1eaf0f['options'][_0x4e84('0x1a')]===undefined?!![]:![]:!![],'where':_0x1eaf0f[_0x4e84('0x19')]?_0x1eaf0f[_0x4e84('0x19')][_0x4e84('0x1e')]||null:null,'attributes':[[_0x4e84('0x2f'),_0x4e84('0x30')],[db[_0x4e84('0x22')]['fn'](_0x4e84('0x1f'),db[_0x4e84('0x22')]['col']('id')),_0x4e84('0x44')],[db[_0x4e84('0x22')]['fn']('COUNT',db[_0x4e84('0x22')]['fn']('IF',db[_0x4e84('0x22')][_0x4e84('0x23')](_0x4e84('0x24')))),_0x4e84('0x45')]],'group':['campaign']})['then'](function(_0x5228b4){logger[_0x4e84('0xc')](_0x4e84('0x43'),_0x1eaf0f);logger[_0x4e84('0xf')]('GetCampaignHopperHistory',_0x1eaf0f,JSON[_0x4e84('0x10')](_0x5228b4));_0x177e06(_0x5228b4);})[_0x4e84('0x15')](function(_0xd38f8a){logger[_0x4e84('0x11')](_0x4e84('0x43'),_0xd38f8a['message'],_0x1eaf0f);_0x17bd52(_0x5aa700[_0x4e84('0x11')](0x1f4,_0xd38f8a[_0x4e84('0x13')]));});});}; \ No newline at end of file +var _0xa1f1=['CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','body','options','raw','debug','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','then','GetCampaignHopperHistory','col','ivrTotalCallsDays','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent'];(function(_0x19dd31,_0x1dfd22){var _0x21bc80=function(_0x5938b3){while(--_0x5938b3){_0x19dd31['push'](_0x19dd31['shift']());}};_0x21bc80(++_0x1dfd22);}(_0xa1f1,0x7b));var _0x1a1f=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0xa1f1[_0x4dab14];return _0xf41aa;};'use strict';var _=require('lodash');var util=require(_0x1a1f('0x0'));var moment=require(_0x1a1f('0x1'));var BPromise=require(_0x1a1f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a1f('0x3'))['db'];var utils=require(_0x1a1f('0x4'));var logger=require(_0x1a1f('0x5'))(_0x1a1f('0x6'));var config=require(_0x1a1f('0x7'));var jayson=require(_0x1a1f('0x8'));var client=jayson[_0x1a1f('0x9')][_0x1a1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x187398,_0x3ec84e,_0x536442){return new BPromise(function(_0x1e608b,_0x8ecdd3){return client[_0x1a1f('0xb')](_0x187398,_0x536442)['then'](function(_0x42c485){logger[_0x1a1f('0xc')](_0x1a1f('0xd'),_0x3ec84e,_0x1a1f('0xe'));logger['debug'](_0x1a1f('0xf'),_0x3ec84e,_0x1a1f('0xe'),JSON[_0x1a1f('0x10')](_0x42c485));if(_0x42c485[_0x1a1f('0x11')]){if(_0x42c485[_0x1a1f('0x11')][_0x1a1f('0x12')]===0x1f4){logger[_0x1a1f('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x3ec84e,_0x42c485[_0x1a1f('0x11')][_0x1a1f('0x13')]);return _0x8ecdd3(_0x42c485[_0x1a1f('0x11')][_0x1a1f('0x13')]);}logger[_0x1a1f('0x11')](_0x1a1f('0xd'),_0x3ec84e,_0x42c485[_0x1a1f('0x11')][_0x1a1f('0x13')]);return _0x1e608b(_0x42c485[_0x1a1f('0x11')][_0x1a1f('0x13')]);}else{logger['info'](_0x1a1f('0xd'),_0x3ec84e,_0x1a1f('0xe'));_0x1e608b(_0x42c485[_0x1a1f('0x14')][_0x1a1f('0x13')]);}})[_0x1a1f('0x15')](function(_0x1f878d){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x3ec84e,_0x1f878d);_0x8ecdd3(_0x1f878d);});});}exports[_0x1a1f('0x16')]=function(_0x44d4b8){var _0x593d42=this;return new Promise(function(_0x65398b,_0x1a0bb9){return db['CmHopperHistory']['create'](_0x44d4b8[_0x1a1f('0x17')],{'raw':_0x44d4b8[_0x1a1f('0x18')]?_0x44d4b8[_0x1a1f('0x18')][_0x1a1f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1c7805){logger[_0x1a1f('0xc')](_0x1a1f('0x16'),_0x44d4b8);logger[_0x1a1f('0x1a')]('CreateCmHopperHistory',_0x44d4b8,JSON[_0x1a1f('0x10')](_0x1c7805));_0x65398b(_0x1c7805);})[_0x1a1f('0x15')](function(_0x52e524){logger[_0x1a1f('0x11')](_0x1a1f('0x16'),_0x52e524[_0x1a1f('0x13')],_0x44d4b8);_0x1a0bb9(_0x593d42[_0x1a1f('0x11')](0x1f4,_0x52e524['message']));});});};exports[_0x1a1f('0x1b')]=function(_0x56c4ae){var _0xe4161a=this;return new Promise(function(_0x39c629,_0xa6198d){return db[_0x1a1f('0x1c')][_0x1a1f('0x1d')]({'raw':_0x56c4ae[_0x1a1f('0x18')]?_0x56c4ae['options'][_0x1a1f('0x19')]===undefined?!![]:![]:!![],'where':_0x56c4ae[_0x1a1f('0x18')]?_0x56c4ae[_0x1a1f('0x18')][_0x1a1f('0x1e')]||null:null,'attributes':[[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db['sequelize']['col']('id')),_0x1a1f('0x21')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db['sequelize']['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x24'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x25')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0x1a1f('0x24'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')]['literal'](_0x1a1f('0x26')))),_0x1a1f('0x27')]]})['then'](function(_0x4c8470){logger[_0x1a1f('0xc')](_0x1a1f('0x1b'),_0x56c4ae);logger[_0x1a1f('0x1a')](_0x1a1f('0x1b'),_0x56c4ae,JSON[_0x1a1f('0x10')](_0x4c8470));_0x39c629(_0x4c8470);})['catch'](function(_0x347fe0){logger[_0x1a1f('0x11')](_0x1a1f('0x1b'),_0x347fe0[_0x1a1f('0x13')],_0x56c4ae);_0xa6198d(_0xe4161a['error'](0x1f4,_0x347fe0['message']));});});};exports[_0x1a1f('0x28')]=function(_0x1e88ad){var _0x4aead7=this;return new Promise(function(_0x39c8a0,_0x576190){return db['CmHopperHistory'][_0x1a1f('0x1d')]({'raw':_0x1e88ad[_0x1a1f('0x18')]?_0x1e88ad[_0x1a1f('0x18')][_0x1a1f('0x19')]===undefined?!![]:![]:!![],'where':_0x1e88ad[_0x1a1f('0x18')]?_0x1e88ad['options'][_0x1a1f('0x1e')]||null:null,'attributes':[[_0x1a1f('0x29'),_0x1a1f('0x2a')],[db['sequelize']['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x2b')))),_0x1a1f('0x2c')],[db['sequelize']['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x2d')))),_0x1a1f('0x2e')],[db['sequelize']['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize'][_0x1a1f('0x22')](_0x1a1f('0x2f')))),_0x1a1f('0x30')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1a1f('0x31')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x32')))),_0x1a1f('0x33')],[db['sequelize']['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1a1f('0x34')))),_0x1a1f('0x35')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0x1a1f('0x1f')]['fn']('COUNT',db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0x1a1f('0x36')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize'][_0x1a1f('0x22')](_0x1a1f('0x37')))),_0x1a1f('0x38')],[db[_0x1a1f('0x1f')]['fn']('COUNT',db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize'][_0x1a1f('0x22')](_0x1a1f('0x39')))),_0x1a1f('0x3a')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db['sequelize']['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x1a1f('0x1f')]['fn']('COUNT',db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')]['literal'](_0x1a1f('0x3b')))),_0x1a1f('0x3c')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db['sequelize']['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x3d')))),_0x1a1f('0x3e')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize'][_0x1a1f('0x22')](_0x1a1f('0x3f')))),_0x1a1f('0x40')]],'group':[_0x1a1f('0x29')]})[_0x1a1f('0x41')](function(_0x3f0bc3){logger[_0x1a1f('0xc')](_0x1a1f('0x28'),_0x1e88ad);logger['debug']('GetVoiceQueueHopperHistory',_0x1e88ad,JSON[_0x1a1f('0x10')](_0x3f0bc3));_0x39c8a0(_0x3f0bc3);})['catch'](function(_0x29a984){logger[_0x1a1f('0x11')](_0x1a1f('0x28'),_0x29a984['message'],_0x1e88ad);_0x576190(_0x4aead7['error'](0x1f4,_0x29a984[_0x1a1f('0x13')]));});});};exports[_0x1a1f('0x42')]=function(_0x29b1d5){var _0x17c011=this;return new Promise(function(_0x4b6988,_0x33ff8c){return db[_0x1a1f('0x1c')]['findAll']({'raw':_0x29b1d5[_0x1a1f('0x18')]?_0x29b1d5[_0x1a1f('0x18')][_0x1a1f('0x19')]===undefined?!![]:![]:!![],'where':_0x29b1d5[_0x1a1f('0x18')]?_0x29b1d5[_0x1a1f('0x18')][_0x1a1f('0x1e')]||null:null,'attributes':[[_0x1a1f('0x29'),_0x1a1f('0x2a')],[db['sequelize']['fn'](_0x1a1f('0x20'),db['sequelize'][_0x1a1f('0x43')]('id')),_0x1a1f('0x44')],[db[_0x1a1f('0x1f')]['fn']('COUNT',db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x2f')))),'ivrAnswerCallsDay']],'group':[_0x1a1f('0x29')]})['then'](function(_0x32116e){logger[_0x1a1f('0xc')](_0x1a1f('0x42'),_0x29b1d5);logger[_0x1a1f('0x1a')](_0x1a1f('0x42'),_0x29b1d5,JSON[_0x1a1f('0x10')](_0x32116e));_0x4b6988(_0x32116e);})['catch'](function(_0x54200c){logger['error'](_0x1a1f('0x42'),_0x54200c[_0x1a1f('0x13')],_0x29b1d5);_0x33ff8c(_0x17c011[_0x1a1f('0x11')](0x1f4,_0x54200c[_0x1a1f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 03bdd3e..857e83b 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 _0x05a2=['isAuthenticated','index','/describe','describe','/:id','show','post','create','update','multer','path','express','Router','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x32b7a6,_0x157eee){var _0x1c8748=function(_0x24adcd){while(--_0x24adcd){_0x32b7a6['push'](_0x32b7a6['shift']());}};_0x1c8748(++_0x157eee);}(_0x05a2,0x80));var _0x205a=function(_0x7f25f6,_0x636243){_0x7f25f6=_0x7f25f6-0x0;var _0x3e9458=_0x05a2[_0x7f25f6];return _0x3e9458;};'use strict';var multer=require(_0x205a('0x0'));var util=require('util');var path=require(_0x205a('0x1'));var timeout=require('connect-timeout');var express=require(_0x205a('0x2'));var router=express[_0x205a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x205a('0x4'));var config=require(_0x205a('0x5'));var controller=require(_0x205a('0x6'));router[_0x205a('0x7')]('/',auth[_0x205a('0x8')](),controller[_0x205a('0x9')]);router[_0x205a('0x7')](_0x205a('0xa'),auth[_0x205a('0x8')](),controller[_0x205a('0xb')]);router['get'](_0x205a('0xc'),auth['isAuthenticated'](),controller[_0x205a('0xd')]);router[_0x205a('0xe')]('/',auth[_0x205a('0x8')](),controller[_0x205a('0xf')]);router['put']('/:id',auth[_0x205a('0x8')](),controller[_0x205a('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6d95=['../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x30c288,_0x34590a){var _0xa617b9=function(_0x94d6a5){while(--_0x94d6a5){_0x30c288['push'](_0x30c288['shift']());}};_0xa617b9(++_0x34590a);}(_0x6d95,0x13d));var _0x56d9=function(_0x36c261,_0x3b8133){_0x36c261=_0x36c261-0x0;var _0x3d0ac0=_0x6d95[_0x36c261];return _0x3d0ac0;};'use strict';var multer=require(_0x56d9('0x0'));var util=require('util');var path=require(_0x56d9('0x1'));var timeout=require(_0x56d9('0x2'));var express=require(_0x56d9('0x3'));var router=express[_0x56d9('0x4')]();var fs_extra=require(_0x56d9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x56d9('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x56d9('0x7')]('/',auth[_0x56d9('0x8')](),controller['index']);router['get'](_0x56d9('0x9'),auth[_0x56d9('0x8')](),controller[_0x56d9('0xa')]);router[_0x56d9('0x7')](_0x56d9('0xb'),auth['isAuthenticated'](),controller[_0x56d9('0xc')]);router[_0x56d9('0xd')]('/',auth['isAuthenticated'](),controller[_0x56d9('0xe')]);router['put'](_0x56d9('0xb'),auth[_0x56d9('0x8')](),controller[_0x56d9('0xf')]);module[_0x56d9('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index cb2db71..cc49f3e 100644 --- a/server/api/cmList/cmList.attributes.js +++ b/server/api/cmList/cmList.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a28=['STRING','name','sequelize','exports'];(function(_0x5d5770,_0x28ba90){var _0x2e2301=function(_0x2bd5bb){while(--_0x2bd5bb){_0x5d5770['push'](_0x5d5770['shift']());}};_0x2e2301(++_0x28ba90);}(_0x1a28,0x10e));var _0x81a2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1a28[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x81a2('0x0'));module[_0x81a2('0x1')]={'name':{'type':Sequelize[_0x81a2('0x2')],'unique':_0x81a2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x81a2('0x2')]},'dialPrefix':{'type':Sequelize[_0x81a2('0x2')]}}; \ No newline at end of file +var _0x448a=['STRING','exports'];(function(_0x2ecd3e,_0x55f417){var _0x3a759d=function(_0x376f77){while(--_0x376f77){_0x2ecd3e['push'](_0x2ecd3e['shift']());}};_0x3a759d(++_0x55f417);}(_0x448a,0x1ef));var _0xa448=function(_0x4ec251,_0x51917e){_0x4ec251=_0x4ec251-0x0;var _0xfbbf46=_0x448a[_0x4ec251];return _0xfbbf46;};'use strict';var Sequelize=require('sequelize');module[_0xa448('0x0')]={'name':{'type':Sequelize[_0xa448('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa448('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index a0d5324..34f8853 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 _0x607d=['emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','send','index','CmList','rawAttributes','type','model','map','name','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','ListId','Disposition','getDispositions','length','hasOwnProperty','pick','removeDispositions','ids','addContacts','CmContact','tags','isArray','each','success','push','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','getContactsCsv','cf_%d','raw','isEmpty','writeFileSync','format','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','addAgents','spread'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x607d,0x96));var _0xd607=function(_0x46ef27,_0x1f0b10){_0x46ef27=_0x46ef27-0x0;var _0x324948=_0x607d[_0x46ef27];return _0x324948;};'use strict';var emlformat=require(_0xd607('0x0'));var rimraf=require(_0xd607('0x1'));var zipdir=require(_0xd607('0x2'));var jsonpatch=require(_0xd607('0x3'));var rp=require(_0xd607('0x4'));var moment=require(_0xd607('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd607('0x6'));var util=require('util');var path=require(_0xd607('0x7'));var sox=require(_0xd607('0x8'));var csv=require(_0xd607('0x9'));var ejs=require(_0xd607('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd607('0xb'));var jsforce=require(_0xd607('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd607('0x9'));var querystring=require(_0xd607('0xd'));var Papa=require(_0xd607('0xe'));var Redis=require(_0xd607('0xf'));var authService=require(_0xd607('0x10'));var qs=require(_0xd607('0x11'));var as=require(_0xd607('0x12'));var hardwareService=require(_0xd607('0x13'));var logger=require(_0xd607('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd607('0x15'));var licenseUtil=require(_0xd607('0x16'));var db=require('../../mysqldb')['db'];config[_0xd607('0x17')]=_[_0xd607('0x18')](config[_0xd607('0x17')],{'host':_0xd607('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd607('0x17')]));require('./cmList.socket')[_0xd607('0x1a')](socket);function respondWithStatusCode(_0x2a6f6a,_0x991507){_0x991507=_0x991507||0xcc;return function(_0x3e68ab){if(_0x3e68ab){return _0x2a6f6a[_0xd607('0x1b')](_0x991507);}return _0x2a6f6a[_0xd607('0x1c')](_0x991507)[_0xd607('0x1d')]();};}function respondWithResult(_0x39336a,_0x3d6a0d){_0x3d6a0d=_0x3d6a0d||0xc8;return function(_0x202df9){if(_0x202df9){return _0x39336a[_0xd607('0x1c')](_0x3d6a0d)[_0xd607('0x1e')](_0x202df9);}};}function respondWithFilteredResult(_0x5a658c,_0x5fd7c6){return function(_0x9cd1dd){if(_0x9cd1dd){var _0xf1afdd=typeof _0x5fd7c6[_0xd607('0x1f')]==='undefined'&&typeof _0x5fd7c6[_0xd607('0x20')]===_0xd607('0x21');var _0x262afe=_0x9cd1dd[_0xd607('0x22')];var _0x2546e1=_0xf1afdd?0x0:_0x5fd7c6[_0xd607('0x1f')];var _0x2bc23b=_0xf1afdd?_0x9cd1dd[_0xd607('0x22')]:_0x5fd7c6[_0xd607('0x1f')]+_0x5fd7c6[_0xd607('0x20')];var _0x227433;if(_0x2bc23b>=_0x262afe){_0x2bc23b=_0x262afe;_0x227433=0xc8;}else{_0x227433=0xce;}_0x5a658c['status'](_0x227433);return _0x5a658c['set'](_0xd607('0x23'),_0x2546e1+'-'+_0x2bc23b+'/'+_0x262afe)['json'](_0x9cd1dd);}return null;};}function patchUpdates(_0x4a1049){return function(_0x2b0d54){try{jsonpatch[_0xd607('0x24')](_0x2b0d54,_0x4a1049,!![]);}catch(_0x5dce17){return BPromise[_0xd607('0x25')](_0x5dce17);}return _0x2b0d54[_0xd607('0x26')]();};}function saveUpdates(_0x4f1ccc,_0x16afcd){return function(_0x1562ac){if(_0x1562ac){return _0x1562ac[_0xd607('0x27')](_0x4f1ccc)[_0xd607('0x28')](function(_0x3a7dde){return _0x3a7dde;});}return null;};}function removeEntity(_0x2a2766,_0x548bfe){return function(_0x20fa54){if(_0x20fa54){return _0x20fa54[_0xd607('0x29')]()[_0xd607('0x28')](function(){var _0x4b9178=_0x20fa54[_0xd607('0x2a')]({'plain':!![]});var _0x5defe8=_0xd607('0x2b');return db[_0xd607('0x2c')][_0xd607('0x29')]({'where':{'type':_0x5defe8,'resourceId':_0x4b9178['id']}})[_0xd607('0x28')](function(){return _0x20fa54;});})[_0xd607('0x28')](function(){_0x2a2766['status'](0xcc)[_0xd607('0x1d')]();});}};}function handleEntityNotFound(_0x5ba4df,_0x289b8a){return function(_0x4538c7){if(!_0x4538c7){_0x5ba4df[_0xd607('0x1b')](0x194);}return _0x4538c7;};}function handleError(_0x2293f3,_0x3df5d1){_0x3df5d1=_0x3df5d1||0x1f4;return function(_0x3628ba){logger[_0xd607('0x2d')](_0x3628ba[_0xd607('0x2e')]);if(_0x3628ba['name']){delete _0x3628ba['name'];}_0x2293f3[_0xd607('0x1c')](_0x3df5d1)[_0xd607('0x2f')](_0x3628ba);};}exports[_0xd607('0x30')]=function(_0x2a932c,_0x114201){var _0x156e99={},_0x52e892={},_0x38a584={'count':0x0,'rows':[]};var _0x3e1754=_['map'](db[_0xd607('0x31')][_0xd607('0x32')],function(_0xa5ea90){return{'name':_0xa5ea90['fieldName'],'type':_0xa5ea90[_0xd607('0x33')]['key']};});_0x52e892[_0xd607('0x34')]=_[_0xd607('0x35')](_0x3e1754,_0xd607('0x36'));_0x52e892[_0xd607('0x37')]=_[_0xd607('0x38')](_0x2a932c[_0xd607('0x37')]);_0x52e892[_0xd607('0x39')]=_[_0xd607('0x3a')](_0x52e892['model'],_0x52e892[_0xd607('0x37')]);_0x156e99['attributes']=_['intersection'](_0x52e892[_0xd607('0x34')],qs[_0xd607('0x3b')](_0x2a932c[_0xd607('0x37')][_0xd607('0x3b')]));_0x156e99[_0xd607('0x3c')]=_0x156e99[_0xd607('0x3c')]['length']?_0x156e99[_0xd607('0x3c')]:_0x52e892[_0xd607('0x34')];if(!_0x2a932c['query']['hasOwnProperty'](_0xd607('0x3d'))){_0x156e99[_0xd607('0x20')]=qs[_0xd607('0x20')](_0x2a932c[_0xd607('0x37')][_0xd607('0x20')]);_0x156e99[_0xd607('0x1f')]=qs[_0xd607('0x1f')](_0x2a932c['query'][_0xd607('0x1f')]);}_0x156e99[_0xd607('0x3e')]=qs[_0xd607('0x3f')](_0x2a932c['query'][_0xd607('0x3f')]);_0x156e99[_0xd607('0x40')]=qs[_0xd607('0x39')](_['pick'](_0x2a932c[_0xd607('0x37')],_0x52e892[_0xd607('0x39')]),_0x3e1754);if(_0x2a932c[_0xd607('0x37')][_0xd607('0x41')]){_0x156e99[_0xd607('0x40')]=_[_0xd607('0x42')](_0x156e99[_0xd607('0x40')],{'$or':_[_0xd607('0x35')](_0x3e1754,function(_0xb143ce){if(_0xb143ce[_0xd607('0x33')]!==_0xd607('0x43')){var _0x4f968e={};_0x4f968e[_0xb143ce[_0xd607('0x36')]]={'$like':'%'+_0x2a932c[_0xd607('0x37')]['filter']+'%'};return _0x4f968e;}})});}_0x156e99=_['merge']({},_0x156e99,_0x2a932c['options']);var _0x317c39={'where':_0x156e99[_0xd607('0x40')]};return db[_0xd607('0x31')]['count'](_0x317c39)[_0xd607('0x28')](function(_0x287ff1){_0x38a584['count']=_0x287ff1;if(_0x2a932c[_0xd607('0x37')][_0xd607('0x44')]){_0x156e99[_0xd607('0x45')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x156e99);})[_0xd607('0x28')](function(_0x1420f8){_0x38a584[_0xd607('0x46')]=_0x1420f8;return _0x38a584;})[_0xd607('0x28')](respondWithFilteredResult(_0x114201,_0x156e99))[_0xd607('0x47')](handleError(_0x114201,null));};exports[_0xd607('0x48')]=function(_0x170949,_0x195139){var _0xbdfa1b={'raw':![],'where':{'id':_0x170949[_0xd607('0x49')]['id']}},_0x48f156={};_0x48f156['model']=_[_0xd607('0x38')](db['CmList'][_0xd607('0x32')]);_0x48f156[_0xd607('0x37')]=_['keys'](_0x170949[_0xd607('0x37')]);_0x48f156[_0xd607('0x39')]=_['intersection'](_0x48f156[_0xd607('0x34')],_0x48f156[_0xd607('0x37')]);_0xbdfa1b[_0xd607('0x3c')]=_[_0xd607('0x3a')](_0x48f156[_0xd607('0x34')],qs[_0xd607('0x3b')](_0x170949[_0xd607('0x37')][_0xd607('0x3b')]));_0xbdfa1b['attributes']=_0xbdfa1b[_0xd607('0x3c')]['length']?_0xbdfa1b[_0xd607('0x3c')]:_0x48f156['model'];if(_0x170949[_0xd607('0x37')][_0xd607('0x44')]){_0xbdfa1b[_0xd607('0x45')]=[{'all':!![]}];}_0xbdfa1b=_[_0xd607('0x42')]({},_0xbdfa1b,_0x170949[_0xd607('0x4a')]);return db[_0xd607('0x31')][_0xd607('0x4b')](_0xbdfa1b)[_0xd607('0x28')](handleEntityNotFound(_0x195139,null))['then'](respondWithResult(_0x195139,null))['catch'](handleError(_0x195139,null));};exports[_0xd607('0x4c')]=function(_0x54e3af,_0x532d9a){return db[_0xd607('0x31')]['create'](_0x54e3af['body'],{})[_0xd607('0x28')](function(_0x56ec71){var _0x42f471=_0x54e3af[_0xd607('0x4d')]['get']({'plain':!![]});if(!_0x42f471)throw new Error(_0xd607('0x4e'));if(_0x42f471[_0xd607('0x4f')]===_0xd607('0x4d')){var _0x4b52f3=_0x56ec71[_0xd607('0x2a')]({'plain':!![]});var _0x1f6370=_0xd607('0x2b');return db[_0xd607('0x50')][_0xd607('0x4b')]({'where':{'name':_0x1f6370,'userProfileId':_0x42f471[_0xd607('0x51')]},'raw':!![]})[_0xd607('0x28')](function(_0x1abf7f){if(_0x1abf7f&&_0x1abf7f[_0xd607('0x52')]===0x0){return db[_0xd607('0x2c')]['create']({'name':_0x4b52f3[_0xd607('0x36')],'resourceId':_0x4b52f3['id'],'type':_0x1abf7f['name'],'sectionId':_0x1abf7f['id']},{})['then'](function(){return _0x56ec71;});}else{return _0x56ec71;}})[_0xd607('0x47')](function(_0x43a819){logger[_0xd607('0x2d')](_0xd607('0x53'),_0x43a819);throw _0x43a819;});}return _0x56ec71;})['then'](respondWithResult(_0x532d9a,0xc9))[_0xd607('0x47')](handleError(_0x532d9a,null));};exports['update']=function(_0x453224,_0x1c49f5){if(_0x453224[_0xd607('0x54')]['id']){delete _0x453224[_0xd607('0x54')]['id'];}return db[_0xd607('0x31')][_0xd607('0x4b')]({'where':{'id':_0x453224[_0xd607('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c49f5,null))[_0xd607('0x28')](saveUpdates(_0x453224['body'],null))['then'](respondWithResult(_0x1c49f5,null))[_0xd607('0x47')](handleError(_0x1c49f5,null));};exports['destroy']=function(_0x5b54a6,_0x165362){return db[_0xd607('0x31')][_0xd607('0x4b')]({'where':{'id':_0x5b54a6[_0xd607('0x49')]['id']}})[_0xd607('0x28')](handleEntityNotFound(_0x165362,null))[_0xd607('0x28')](removeEntity(_0x165362,null))[_0xd607('0x47')](handleError(_0x165362,null));};exports['describe']=function(_0x2df6a7,_0x1b6bd7){return db[_0xd607('0x31')]['describe']()[_0xd607('0x28')](respondWithResult(_0x1b6bd7,null))[_0xd607('0x47')](handleError(_0x1b6bd7,null));};exports[_0xd607('0x55')]=function(_0x48c1cc,_0x20f655,_0x31bfdc){if(_0x48c1cc['body']['id']){delete _0x48c1cc[_0xd607('0x54')]['id'];}return db['CmList']['find']({'where':{'id':_0x48c1cc[_0xd607('0x49')]['id']}})[_0xd607('0x28')](handleEntityNotFound(_0x20f655,null))['then'](function(_0x5b8efc){if(_0x5b8efc){_0x48c1cc[_0xd607('0x54')][_0xd607('0x56')]=_0x5b8efc['id'];return db[_0xd607('0x57')]['create'](_0x48c1cc[_0xd607('0x54')]);}})[_0xd607('0x28')](respondWithResult(_0x20f655,null))[_0xd607('0x47')](handleError(_0x20f655,null));};exports[_0xd607('0x58')]=function(_0x1cd138,_0x39aad2,_0x36146a){var _0x273e9f={'raw':![],'where':{}};var _0x173779={};var _0x32b02a={'count':0x0,'rows':[]};return db[_0xd607('0x31')]['findOne']({'where':{'id':_0x1cd138['params']['id']}})[_0xd607('0x28')](handleEntityNotFound(_0x39aad2,null))[_0xd607('0x28')](function(_0x15a020){if(_0x15a020){_0x173779['model']=_[_0xd607('0x38')](db[_0xd607('0x57')][_0xd607('0x32')]);_0x173779[_0xd607('0x37')]=_[_0xd607('0x38')](_0x1cd138['query']);_0x173779['filters']=_['intersection'](_0x173779[_0xd607('0x34')],_0x173779[_0xd607('0x37')]);_0x273e9f[_0xd607('0x3c')]=_[_0xd607('0x3a')](_0x173779[_0xd607('0x34')],qs[_0xd607('0x3b')](_0x1cd138[_0xd607('0x37')][_0xd607('0x3b')]));_0x273e9f[_0xd607('0x3c')]=_0x273e9f[_0xd607('0x3c')][_0xd607('0x59')]?_0x273e9f[_0xd607('0x3c')]:_0x173779['model'];if(!_0x1cd138[_0xd607('0x37')][_0xd607('0x5a')](_0xd607('0x3d'))){_0x273e9f['limit']=qs[_0xd607('0x20')](_0x1cd138[_0xd607('0x37')][_0xd607('0x20')]);_0x273e9f[_0xd607('0x1f')]=qs[_0xd607('0x1f')](_0x1cd138['query'][_0xd607('0x1f')]);}_0x273e9f[_0xd607('0x3e')]=qs['sort'](_0x1cd138[_0xd607('0x37')][_0xd607('0x3f')]);_0x273e9f[_0xd607('0x40')]=qs['filters'](_[_0xd607('0x5b')](_0x1cd138['query'],_0x173779[_0xd607('0x39')]));_0x273e9f[_0xd607('0x40')]['ListId']=_0x15a020['id'];if(_0x1cd138[_0xd607('0x37')]['filter']){_0x273e9f[_0xd607('0x40')]=_[_0xd607('0x42')](_0x273e9f[_0xd607('0x40')],{'$or':_[_0xd607('0x35')](_0x273e9f['attributes'],function(_0x377a25){var _0x190d56={};_0x190d56[_0x377a25]={'$like':'%'+_0x1cd138['query']['filter']+'%'};return _0x190d56;})});}_0x273e9f=_['merge']({},_0x273e9f,_0x1cd138[_0xd607('0x4a')]);return db[_0xd607('0x57')][_0xd607('0x22')]({'where':_0x273e9f[_0xd607('0x40')]})['then'](function(_0x4db5b8){_0x32b02a[_0xd607('0x22')]=_0x4db5b8;if(_0x1cd138[_0xd607('0x37')][_0xd607('0x44')]){_0x273e9f[_0xd607('0x45')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x273e9f);})[_0xd607('0x28')](function(_0x5daf7d){_0x32b02a[_0xd607('0x46')]=_0x5daf7d;return _0x32b02a;});}})[_0xd607('0x28')](respondWithFilteredResult(_0x39aad2,_0x273e9f))[_0xd607('0x47')](handleError(_0x39aad2,null));};exports[_0xd607('0x5c')]=function(_0x966c08,_0x3327da,_0x4b9e25){return db[_0xd607('0x31')][_0xd607('0x4b')]({'where':{'id':_0x966c08[_0xd607('0x49')]['id']}})[_0xd607('0x28')](handleEntityNotFound(_0x3327da,null))['then'](function(_0x1baf3a){if(_0x1baf3a){return _0x1baf3a['removeDispositions'](_0x966c08[_0xd607('0x37')][_0xd607('0x5d')]);}})[_0xd607('0x28')](respondWithStatusCode(_0x3327da,null))[_0xd607('0x47')](handleError(_0x3327da,null));};exports[_0xd607('0x5e')]=function(_0x4c77ac,_0x2787f8,_0x4f084f){return db[_0xd607('0x31')][_0xd607('0x4b')]({'where':{'id':_0x4c77ac['params']['id']}})[_0xd607('0x28')](handleEntityNotFound(_0x2787f8,null))['then'](function(_0x56815f){if(_0x56815f){var _0x1a2c7d=[];var _0x420972={'success':[],'errors':[]};return db[_0xd607('0x5f')]['describe']()[_0xd607('0x28')](function(_0x36f6a1){if(_0x4c77ac[_0xd607('0x54')][_0xd607('0x60')]&&_[_0xd607('0x61')](_0x4c77ac[_0xd607('0x54')][_0xd607('0x60')])){if(_0x4c77ac['body'][_0xd607('0x60')][_0xd607('0x59')]){_0x4c77ac[_0xd607('0x54')][_0xd607('0x60')]=_0x4c77ac[_0xd607('0x54')][_0xd607('0x60')]['join'](';')+';';}else{_0x4c77ac[_0xd607('0x54')]['tags']=null;}}else{_0x4c77ac[_0xd607('0x54')][_0xd607('0x60')]=null;}if(_0x4c77ac[_0xd607('0x54')]&&_['isArray'](_0x4c77ac[_0xd607('0x54')])){for(var _0x1ab9c4=0x0;_0x1ab9c4<_0x4c77ac[_0xd607('0x54')]['length'];_0x1ab9c4+=0x1){_0x4c77ac[_0xd607('0x54')][_0x1ab9c4][_0xd607('0x56')]=_0x4c77ac[_0xd607('0x49')]['id'];_0x1a2c7d['push'](_0x4c77ac[_0xd607('0x54')][_0x1ab9c4]);}return BPromise[_0xd607('0x62')](_0x1a2c7d,function(_0x3ab3b4){return db[_0xd607('0x5f')][_0xd607('0x4c')](_['omit'](_0x3ab3b4,[_0xd607('0x5d'),'id'])||{},{'fields':_['keys'](_0x36f6a1),'raw':!![]})[_0xd607('0x28')](function(_0x5646f8){_0x420972[_0xd607('0x63')][_0xd607('0x64')](_0x5646f8[_0xd607('0x65')]);})[_0xd607('0x47')](function(_0x587b06){_0x420972[_0xd607('0x66')][_0xd607('0x64')]({'data':_0x3ab3b4,'error':_0x587b06[_0xd607('0x67')]});});})[_0xd607('0x28')](function(_0x11130e){return _0x420972;})[_0xd607('0x47')](function(_0x10b85c){return _0x10b85c;});}else{_0x2787f8[_0xd607('0x1c')](0x190)[_0xd607('0x1e')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x2787f8,null))[_0xd607('0x47')](handleError(_0x2787f8,null));};exports[_0xd607('0x68')]=function(_0x3d92b8,_0x1db135,_0x481623){var _0xd63fe7;return db[_0xd607('0x31')]['find']({'where':{'id':_0x3d92b8[_0xd607('0x49')]['id']},'include':[{'model':db[_0xd607('0x69')],'as':_0xd607('0x6a')}]})[_0xd607('0x28')](handleEntityNotFound(_0x1db135,null))[_0xd607('0x28')](function(_0x34f5f4){if(_0x34f5f4){_0xd63fe7=_0x34f5f4;return db[_0xd607('0x5f')][_0xd607('0x32')];}})[_0xd607('0x28')](function(_0x4f4e84){if(_0x4f4e84){var _0x440420={};var _0x2b64a5={};_0x2b64a5[_0xd607('0x34')]=_[_0xd607('0x6b')](_['keys'](_0x4f4e84),_[_0xd607('0x35')](_0xd63fe7[_0xd607('0x6a')],function(_0x29a611){return util['format']('cf_%d',_0x29a611['id']);}));_0x2b64a5['query']=_[_0xd607('0x38')](_0x3d92b8[_0xd607('0x37')]);_0x2b64a5[_0xd607('0x39')]=_[_0xd607('0x3a')](_0x2b64a5[_0xd607('0x34')],_0x2b64a5['query']);_0x440420[_0xd607('0x3c')]=_[_0xd607('0x3a')](_0x2b64a5[_0xd607('0x34')],qs[_0xd607('0x3b')](_0x3d92b8[_0xd607('0x37')][_0xd607('0x3b')]));_0x440420[_0xd607('0x3c')]=_0x440420[_0xd607('0x3c')]['length']?_0x440420[_0xd607('0x3c')]:_0x2b64a5[_0xd607('0x34')];if(!_0x3d92b8['query'][_0xd607('0x5a')](_0xd607('0x3d'))){_0x440420[_0xd607('0x20')]=qs['limit'](_0x3d92b8[_0xd607('0x37')][_0xd607('0x20')]);_0x440420[_0xd607('0x1f')]=qs[_0xd607('0x1f')](_0x3d92b8['query']['offset']);}_0x440420[_0xd607('0x3e')]=qs[_0xd607('0x3f')](_0x3d92b8[_0xd607('0x37')][_0xd607('0x3f')]);_0x440420[_0xd607('0x40')]=qs[_0xd607('0x39')](_[_0xd607('0x5b')](_0x3d92b8['query'],_0x2b64a5['filters']));_0x440420['raw']=!![];if(_0x3d92b8['query'][_0xd607('0x41')]){_0x440420['where']=_['merge'](_0x440420['where'],{'$or':_[_0xd607('0x35')](_0x440420[_0xd607('0x3c')],function(_0x1281ed){var _0x32b7a2={};_0x32b7a2[_0x1281ed]={'$like':'%'+_0x3d92b8[_0xd607('0x37')]['filter']+'%'};return _0x32b7a2;})});}_0x440420=_[_0xd607('0x42')]({},_0x440420,_0x3d92b8['options']);return _0xd63fe7[_0xd607('0x68')](_0x440420);}})[_0xd607('0x28')](respondWithResult(_0x1db135,null))[_0xd607('0x47')](handleError(_0x1db135,null));};exports[_0xd607('0x6c')]=function(_0x145e56,_0x12c9b8,_0xecd8d0){var _0xf8ee;return db[_0xd607('0x31')][_0xd607('0x4b')]({'where':{'id':_0x145e56['params']['id']},'include':[{'model':db[_0xd607('0x69')],'as':_0xd607('0x6a')}]})[_0xd607('0x28')](handleEntityNotFound(_0x12c9b8,null))[_0xd607('0x28')](function(_0xab496c){if(_0xab496c){_0xf8ee=_0xab496c;return db[_0xd607('0x5f')][_0xd607('0x32')];}})[_0xd607('0x28')](function(_0x1c91ee){if(_0x1c91ee){var _0x390435={};var _0x1f7919={};_0x1f7919[_0xd607('0x34')]=_[_0xd607('0x6b')](_[_0xd607('0x38')](_0x1c91ee),_[_0xd607('0x35')](_0xf8ee['CustomFields'],function(_0x53861f){return util['format'](_0xd607('0x6d'),_0x53861f['id']);}));_0x1f7919['query']=_[_0xd607('0x38')](_0x145e56[_0xd607('0x37')]);_0x1f7919['filters']=_[_0xd607('0x3a')](_0x1f7919[_0xd607('0x34')],_0x1f7919[_0xd607('0x37')]);_0x390435['attributes']=_[_0xd607('0x3a')](_0x1f7919[_0xd607('0x34')],qs[_0xd607('0x3b')](_0x145e56[_0xd607('0x37')][_0xd607('0x3b')]));_0x390435[_0xd607('0x3c')]=_0x390435[_0xd607('0x3c')][_0xd607('0x59')]?_0x390435[_0xd607('0x3c')]:_0x1f7919[_0xd607('0x34')];if(!_0x145e56['query']['hasOwnProperty'](_0xd607('0x3d'))){_0x390435['limit']=qs[_0xd607('0x20')](_0x145e56['query'][_0xd607('0x20')]);_0x390435['offset']=qs[_0xd607('0x1f')](_0x145e56[_0xd607('0x37')]['offset']);}_0x390435[_0xd607('0x3e')]=qs[_0xd607('0x3f')](_0x145e56[_0xd607('0x37')][_0xd607('0x3f')]);_0x390435[_0xd607('0x40')]=qs[_0xd607('0x39')](_[_0xd607('0x5b')](_0x145e56['query'],_0x1f7919[_0xd607('0x39')]));_0x390435[_0xd607('0x6e')]=!![];if(_0x145e56[_0xd607('0x37')]['filter']){_0x390435['where']=_['merge'](_0x390435[_0xd607('0x40')],{'$or':_['map'](_0x390435[_0xd607('0x3c')],function(_0x1475ca){var _0x1851a1={};_0x1851a1[_0x1475ca]={'$like':'%'+_0x145e56['query']['filter']+'%'};return _0x1851a1;})});}_0x390435=_[_0xd607('0x42')]({},_0x390435,_0x145e56[_0xd607('0x4a')]);return _0xf8ee[_0xd607('0x68')](_0x390435);}})[_0xd607('0x28')](function(_0x2e9bed){if(!_[_0xd607('0x6f')](_0x2e9bed)){var _0x5dc718=toCsv(_0x2e9bed);var _0x1b8cb7=Date['now']();fs[_0xd607('0x70')](util[_0xd607('0x71')](_0xd607('0x72'),_0xf8ee['id'],_0x1b8cb7),_0x5dc718);_0x12c9b8['setHeader'](_0xd607('0x73'),_0xd607('0x74')+util[_0xd607('0x71')](_0xd607('0x75'),_0xf8ee['id'],_0x1b8cb7));_0x12c9b8[_0xd607('0x76')](_0xd607('0x77'),_0xd607('0x78'));return _0x12c9b8[_0xd607('0x79')](util[_0xd607('0x71')](_0xd607('0x72'),_0xf8ee['id'],_0x1b8cb7));}else{return _0x12c9b8[_0xd607('0x1b')](0xcc);}})[_0xd607('0x47')](handleError(_0x12c9b8,null));};exports['addCustomField']=function(_0x1f7b99,_0x4712ac,_0x55cf0c){var _0x5122b8;delete _0x1f7b99[_0xd607('0x54')]['id'];return db[_0xd607('0x31')][_0xd607('0x7a')]({'where':{'id':_0x1f7b99['params']['id']}})[_0xd607('0x28')](handleEntityNotFound(_0x4712ac,null))[_0xd607('0x28')](function(_0x4606e3){if(_0x4606e3){return db[_0xd607('0x7b')][_0xd607('0x7c')](function(_0x16d902){return db['CmCustomField']['create'](_0x1f7b99[_0xd607('0x54')],{'transaction':_0x16d902})[_0xd607('0x28')](function(_0x16c814){_0x5122b8=_0x16c814;return _0x4606e3[_0xd607('0x7d')](_0x16c814,{'transaction':_0x16d902});})[_0xd607('0x28')](function(){var _0x45a5cc={'type':db[_0xd607('0x7e')][_0xd607('0x7f')],'transaction':_0x16d902};switch(_0x1f7b99[_0xd607('0x54')][_0xd607('0x33')]){case _0xd607('0x80'):_0x45a5cc[_0xd607('0x33')]=db[_0xd607('0x7e')][_0xd607('0x7f')];break;case _0xd607('0x81'):_0x45a5cc['type']=db[_0xd607('0x7e')][_0xd607('0x82')];break;case _0xd607('0x83'):_0x45a5cc[_0xd607('0x33')]=db['Sequelize'][_0xd607('0x84')];_0x45a5cc[_0xd607('0x85')]=![];break;default:}return db[_0xd607('0x7b')][_0xd607('0x86')][_0xd607('0x87')]('cm_contacts',util[_0xd607('0x71')](_0xd607('0x88'),_0x5122b8['id']),_0x45a5cc);})[_0xd607('0x28')](function(){return _0x5122b8;});});}})[_0xd607('0x28')](respondWithResult(_0x4712ac,null))[_0xd607('0x47')](handleError(_0x4712ac,null));};exports[_0xd607('0x89')]=function(_0x162e91,_0x4d2c57,_0x1bc8b6){var _0x4bb149={};var _0xf7eb3e={};var _0x56fe59;var _0x315d05;return db[_0xd607('0x31')][_0xd607('0x7a')]({'where':{'id':_0x162e91[_0xd607('0x49')]['id']}})[_0xd607('0x28')](handleEntityNotFound(_0x4d2c57,null))[_0xd607('0x28')](function(_0x204f44){if(_0x204f44){_0x56fe59=_0x204f44;_0xf7eb3e[_0xd607('0x34')]=_[_0xd607('0x38')](db[_0xd607('0x69')][_0xd607('0x32')]);_0xf7eb3e[_0xd607('0x37')]=_[_0xd607('0x38')](_0x162e91[_0xd607('0x37')]);_0xf7eb3e['filters']=_[_0xd607('0x3a')](_0xf7eb3e[_0xd607('0x34')],_0xf7eb3e[_0xd607('0x37')]);_0x4bb149[_0xd607('0x3c')]=_[_0xd607('0x3a')](_0xf7eb3e[_0xd607('0x34')],qs[_0xd607('0x3b')](_0x162e91[_0xd607('0x37')][_0xd607('0x3b')]));_0x4bb149[_0xd607('0x3c')]=_0x4bb149['attributes'][_0xd607('0x59')]?_0x4bb149[_0xd607('0x3c')]:_0xf7eb3e['model'];_0x4bb149[_0xd607('0x3e')]=qs[_0xd607('0x3f')](_0x162e91[_0xd607('0x37')][_0xd607('0x3f')]);_0x4bb149[_0xd607('0x40')]=qs['filters'](_[_0xd607('0x5b')](_0x162e91[_0xd607('0x37')],_0xf7eb3e[_0xd607('0x39')]));_0x4bb149['where']=_['merge'](_0x4bb149[_0xd607('0x40')],{'$or':[{'ListId':_0x204f44['id']},{'ListId':null}]});if(_0x162e91[_0xd607('0x37')]['filter']){_0x4bb149[_0xd607('0x40')]=_[_0xd607('0x42')](_0x4bb149[_0xd607('0x40')],{'$or':_['map'](_0x4bb149[_0xd607('0x3c')],function(_0x239aa2){var _0xadc10b={};_0xadc10b[_0x239aa2]={'$like':'%'+_0x162e91[_0xd607('0x37')][_0xd607('0x41')]+'%'};return _0xadc10b;})});}_0x4bb149=_['merge']({},_0x4bb149,_0x162e91[_0xd607('0x4a')]);return db[_0xd607('0x69')]['findAndCountAll'](_0x4bb149);}})[_0xd607('0x28')](respondWithResult(_0x4d2c57,null))[_0xd607('0x47')](handleError(_0x4d2c57,null));};exports[_0xd607('0x8a')]=function(_0x4ec768,_0xfa75c3,_0x7fc90d){return db[_0xd607('0x31')][_0xd607('0x4b')]({'where':{'id':_0x4ec768[_0xd607('0x49')]['id']}})[_0xd607('0x28')](handleEntityNotFound(_0xfa75c3,null))[_0xd607('0x28')](function(_0xf94d){if(_0xf94d){return _0xf94d[_0xd607('0x8a')](_0x4ec768[_0xd607('0x54')][_0xd607('0x5d')],_['omit'](_0x4ec768[_0xd607('0x54')],[_0xd607('0x5d'),'id'])||{})[_0xd607('0x8b')](function(_0x426c93){for(var _0x2525d7=0x0;_0x2525d7<_0x4ec768[_0xd607('0x54')][_0xd607('0x5d')][_0xd607('0x59')];_0x2525d7+=0x1){socket[_0xd607('0x8c')](_0xd607('0x8d'),{'UserId':Number(_0x4ec768[_0xd607('0x54')][_0xd607('0x5d')][_0x2525d7]),'CmListId':Number(_0x4ec768[_0xd607('0x49')]['id'])});}return _0x426c93;});}})[_0xd607('0x28')](respondWithResult(_0xfa75c3,null))[_0xd607('0x47')](handleError(_0xfa75c3,null));};exports['removeAgents']=function(_0x3ce939,_0x1762ac,_0x44f05f){return db[_0xd607('0x31')][_0xd607('0x4b')]({'where':{'id':_0x3ce939[_0xd607('0x49')]['id']}})[_0xd607('0x28')](handleEntityNotFound(_0x1762ac,null))[_0xd607('0x28')](function(_0x5633e5){if(_0x5633e5){return _0x5633e5[_0xd607('0x8e')](_0x3ce939[_0xd607('0x37')][_0xd607('0x5d')])[_0xd607('0x28')](function(){if(_['isArray'](_0x3ce939[_0xd607('0x37')][_0xd607('0x5d')])){for(var _0x95b00f=0x0;_0x95b00f<_0x3ce939[_0xd607('0x37')][_0xd607('0x5d')][_0xd607('0x59')];_0x95b00f+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x3ce939[_0xd607('0x37')]['ids'][_0x95b00f]),'CmListId':Number(_0x3ce939[_0xd607('0x49')]['id'])});}}else{socket['emit'](_0xd607('0x8f'),{'UserId':Number(_0x3ce939['query'][_0xd607('0x5d')]),'CmListId':Number(_0x3ce939[_0xd607('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x1762ac,null))[_0xd607('0x47')](handleError(_0x1762ac,null));};exports[_0xd607('0x90')]=function(_0x5965fa,_0x25f3a5,_0x538819){var _0x84bf1c={};var _0x23223b={};var _0x478646;var _0x1eb855;return db['CmList'][_0xd607('0x7a')]({'where':{'id':_0x5965fa[_0xd607('0x49')]['id']}})[_0xd607('0x28')](handleEntityNotFound(_0x25f3a5,null))[_0xd607('0x28')](function(_0x560c1d){if(_0x560c1d){_0x478646=_0x560c1d;_0x23223b[_0xd607('0x34')]=_['keys'](db['User'][_0xd607('0x32')]);_0x23223b['query']=_[_0xd607('0x38')](_0x5965fa[_0xd607('0x37')]);_0x23223b[_0xd607('0x39')]=_[_0xd607('0x3a')](_0x23223b['model'],_0x23223b['query']);_0x84bf1c[_0xd607('0x3c')]=_[_0xd607('0x3a')](_0x23223b[_0xd607('0x34')],qs['fields'](_0x5965fa[_0xd607('0x37')][_0xd607('0x3b')]));_0x84bf1c[_0xd607('0x3c')]=_0x84bf1c[_0xd607('0x3c')][_0xd607('0x59')]?_0x84bf1c[_0xd607('0x3c')]:_0x23223b[_0xd607('0x34')];_0x84bf1c[_0xd607('0x3e')]=qs[_0xd607('0x3f')](_0x5965fa[_0xd607('0x37')][_0xd607('0x3f')]);_0x84bf1c[_0xd607('0x40')]=qs[_0xd607('0x39')](_[_0xd607('0x5b')](_0x5965fa[_0xd607('0x37')],_0x23223b[_0xd607('0x39')]));if(_0x5965fa['query'][_0xd607('0x41')]){_0x84bf1c[_0xd607('0x40')]=_[_0xd607('0x42')](_0x84bf1c[_0xd607('0x40')],{'$or':_[_0xd607('0x35')](_0x84bf1c[_0xd607('0x3c')],function(_0x17bbb0){var _0x2f7c68={};_0x2f7c68[_0x17bbb0]={'$like':'%'+_0x5965fa[_0xd607('0x37')][_0xd607('0x41')]+'%'};return _0x2f7c68;})});}_0x84bf1c=_['merge']({},_0x84bf1c,_0x5965fa['options']);return _0x478646[_0xd607('0x90')](_0x84bf1c);}})[_0xd607('0x28')](function(_0x361a49){if(_0x361a49){_0x1eb855=_0x361a49[_0xd607('0x59')];if(!_0x5965fa[_0xd607('0x37')]['hasOwnProperty'](_0xd607('0x3d'))){_0x84bf1c['limit']=qs['limit'](_0x5965fa[_0xd607('0x37')][_0xd607('0x20')]);_0x84bf1c[_0xd607('0x1f')]=qs['offset'](_0x5965fa['query'][_0xd607('0x1f')]);}return _0x478646['getAgents'](_0x84bf1c);}})[_0xd607('0x28')](function(_0x5d48b6){if(_0x5d48b6){return _0x5d48b6?{'count':_0x1eb855,'rows':_0x5d48b6}:null;}})[_0xd607('0x28')](respondWithResult(_0x25f3a5,null))['catch'](handleError(_0x25f3a5,null));}; \ No newline at end of file +var _0xb92f=['raw','CmCustomField','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','text/csv','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','cm_contacts','cf_%s','getCustomFields','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','get','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','count','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xb92f,0x13d));var _0xfb92=function(_0x52af14,_0x450fa2){_0x52af14=_0x52af14-0x0;var _0x5068b0=_0xb92f[_0x52af14];return _0x5068b0;};'use strict';var emlformat=require(_0xfb92('0x0'));var rimraf=require(_0xfb92('0x1'));var zipdir=require(_0xfb92('0x2'));var jsonpatch=require(_0xfb92('0x3'));var rp=require(_0xfb92('0x4'));var moment=require(_0xfb92('0x5'));var BPromise=require(_0xfb92('0x6'));var Mustache=require(_0xfb92('0x7'));var util=require('util');var path=require('path');var sox=require(_0xfb92('0x8'));var csv=require(_0xfb92('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb92('0xa'));var _=require(_0xfb92('0xb'));var squel=require('squel');var crypto=require(_0xfb92('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfb92('0xd'));var toCsv=require(_0xfb92('0x9'));var querystring=require(_0xfb92('0xe'));var Papa=require('papaparse');var Redis=require(_0xfb92('0xf'));var authService=require(_0xfb92('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfb92('0x11'));var hardwareService=require(_0xfb92('0x12'));var logger=require(_0xfb92('0x13'))(_0xfb92('0x14'));var utils=require('../../config/utils');var config=require(_0xfb92('0x15'));var licenseUtil=require(_0xfb92('0x16'));var db=require(_0xfb92('0x17'))['db'];config[_0xfb92('0x18')]=_[_0xfb92('0x19')](config['redis'],{'host':_0xfb92('0x1a'),'port':0x18eb});var socket=require(_0xfb92('0x1b'))(new Redis(config[_0xfb92('0x18')]));require('./cmList.socket')[_0xfb92('0x1c')](socket);function respondWithStatusCode(_0x51062b,_0x44df6f){_0x44df6f=_0x44df6f||0xcc;return function(_0x2176f0){if(_0x2176f0){return _0x51062b[_0xfb92('0x1d')](_0x44df6f);}return _0x51062b[_0xfb92('0x1e')](_0x44df6f)[_0xfb92('0x1f')]();};}function respondWithResult(_0x32aa9b,_0x2e5d06){_0x2e5d06=_0x2e5d06||0xc8;return function(_0x43e9c2){if(_0x43e9c2){return _0x32aa9b[_0xfb92('0x1e')](_0x2e5d06)[_0xfb92('0x20')](_0x43e9c2);}};}function respondWithFilteredResult(_0x2878fe,_0x115e9d){return function(_0x48a7cd){if(_0x48a7cd){var _0x40081c=typeof _0x115e9d[_0xfb92('0x21')]===_0xfb92('0x22')&&typeof _0x115e9d[_0xfb92('0x23')]==='undefined';var _0x581f01=_0x48a7cd['count'];var _0x45477b=_0x40081c?0x0:_0x115e9d[_0xfb92('0x21')];var _0x4588e5=_0x40081c?_0x48a7cd['count']:_0x115e9d[_0xfb92('0x21')]+_0x115e9d[_0xfb92('0x23')];var _0x41e868;if(_0x4588e5>=_0x581f01){_0x4588e5=_0x581f01;_0x41e868=0xc8;}else{_0x41e868=0xce;}_0x2878fe[_0xfb92('0x1e')](_0x41e868);return _0x2878fe[_0xfb92('0x24')](_0xfb92('0x25'),_0x45477b+'-'+_0x4588e5+'/'+_0x581f01)[_0xfb92('0x20')](_0x48a7cd);}return null;};}function patchUpdates(_0x27771a){return function(_0x20463f){try{jsonpatch[_0xfb92('0x26')](_0x20463f,_0x27771a,!![]);}catch(_0x13c925){return BPromise[_0xfb92('0x27')](_0x13c925);}return _0x20463f['save']();};}function saveUpdates(_0x3b861b,_0x48a26b){return function(_0x4b1828){if(_0x4b1828){return _0x4b1828[_0xfb92('0x28')](_0x3b861b)[_0xfb92('0x29')](function(_0x70a6e){return _0x70a6e;});}return null;};}function removeEntity(_0x40b72f,_0xb5403d){return function(_0x226927){if(_0x226927){return _0x226927[_0xfb92('0x2a')]()[_0xfb92('0x29')](function(){var _0x3dcc76=_0x226927[_0xfb92('0x2b')]({'plain':!![]});var _0x23f9d1='Lists';return db['UserProfileResource'][_0xfb92('0x2a')]({'where':{'type':_0x23f9d1,'resourceId':_0x3dcc76['id']}})[_0xfb92('0x29')](function(){return _0x226927;});})[_0xfb92('0x29')](function(){_0x40b72f['status'](0xcc)[_0xfb92('0x1f')]();});}};}function handleEntityNotFound(_0x1a277d,_0x52ae32){return function(_0x470f1c){if(!_0x470f1c){_0x1a277d['sendStatus'](0x194);}return _0x470f1c;};}function handleError(_0x10ac58,_0x528871){_0x528871=_0x528871||0x1f4;return function(_0x1f63ff){logger['error'](_0x1f63ff[_0xfb92('0x2c')]);if(_0x1f63ff[_0xfb92('0x2d')]){delete _0x1f63ff['name'];}_0x10ac58[_0xfb92('0x1e')](_0x528871)[_0xfb92('0x2e')](_0x1f63ff);};}exports[_0xfb92('0x2f')]=function(_0xa51e0,_0x17d5e7){var _0x17609c={},_0xf7ac2={},_0x22093d={'count':0x0,'rows':[]};var _0x417436=_[_0xfb92('0x30')](db[_0xfb92('0x31')][_0xfb92('0x32')],function(_0x1becd9){return{'name':_0x1becd9[_0xfb92('0x33')],'type':_0x1becd9[_0xfb92('0x34')][_0xfb92('0x35')]};});_0xf7ac2[_0xfb92('0x36')]=_['map'](_0x417436,_0xfb92('0x2d'));_0xf7ac2[_0xfb92('0x37')]=_[_0xfb92('0x38')](_0xa51e0[_0xfb92('0x37')]);_0xf7ac2['filters']=_[_0xfb92('0x39')](_0xf7ac2['model'],_0xf7ac2[_0xfb92('0x37')]);_0x17609c['attributes']=_[_0xfb92('0x39')](_0xf7ac2[_0xfb92('0x36')],qs[_0xfb92('0x3a')](_0xa51e0['query']['fields']));_0x17609c['attributes']=_0x17609c['attributes'][_0xfb92('0x3b')]?_0x17609c[_0xfb92('0x3c')]:_0xf7ac2[_0xfb92('0x36')];if(!_0xa51e0['query'][_0xfb92('0x3d')](_0xfb92('0x3e'))){_0x17609c[_0xfb92('0x23')]=qs[_0xfb92('0x23')](_0xa51e0[_0xfb92('0x37')][_0xfb92('0x23')]);_0x17609c[_0xfb92('0x21')]=qs[_0xfb92('0x21')](_0xa51e0[_0xfb92('0x37')][_0xfb92('0x21')]);}_0x17609c[_0xfb92('0x3f')]=qs[_0xfb92('0x40')](_0xa51e0[_0xfb92('0x37')][_0xfb92('0x40')]);_0x17609c[_0xfb92('0x41')]=qs['filters'](_[_0xfb92('0x42')](_0xa51e0['query'],_0xf7ac2[_0xfb92('0x43')]),_0x417436);if(_0xa51e0[_0xfb92('0x37')][_0xfb92('0x44')]){_0x17609c['where']=_[_0xfb92('0x45')](_0x17609c['where'],{'$or':_['map'](_0x417436,function(_0x6534c){if(_0x6534c[_0xfb92('0x34')]!==_0xfb92('0x46')){var _0x3c8da4={};_0x3c8da4[_0x6534c['name']]={'$like':'%'+_0xa51e0[_0xfb92('0x37')][_0xfb92('0x44')]+'%'};return _0x3c8da4;}})});}_0x17609c=_[_0xfb92('0x45')]({},_0x17609c,_0xa51e0[_0xfb92('0x47')]);var _0x2912df={'where':_0x17609c['where']};return db[_0xfb92('0x31')]['count'](_0x2912df)[_0xfb92('0x29')](function(_0x4f6a0f){_0x22093d['count']=_0x4f6a0f;if(_0xa51e0[_0xfb92('0x37')][_0xfb92('0x48')]){_0x17609c[_0xfb92('0x49')]=[{'all':!![]}];}return db['CmList'][_0xfb92('0x4a')](_0x17609c);})['then'](function(_0x101ee4){_0x22093d[_0xfb92('0x4b')]=_0x101ee4;return _0x22093d;})[_0xfb92('0x29')](respondWithFilteredResult(_0x17d5e7,_0x17609c))[_0xfb92('0x4c')](handleError(_0x17d5e7,null));};exports[_0xfb92('0x4d')]=function(_0x3d3e29,_0xb85c51){var _0x54dba3={'raw':![],'where':{'id':_0x3d3e29[_0xfb92('0x4e')]['id']}},_0x5936fe={};_0x5936fe['model']=_[_0xfb92('0x38')](db['CmList'][_0xfb92('0x32')]);_0x5936fe[_0xfb92('0x37')]=_[_0xfb92('0x38')](_0x3d3e29[_0xfb92('0x37')]);_0x5936fe[_0xfb92('0x43')]=_[_0xfb92('0x39')](_0x5936fe[_0xfb92('0x36')],_0x5936fe[_0xfb92('0x37')]);_0x54dba3[_0xfb92('0x3c')]=_[_0xfb92('0x39')](_0x5936fe['model'],qs[_0xfb92('0x3a')](_0x3d3e29[_0xfb92('0x37')][_0xfb92('0x3a')]));_0x54dba3[_0xfb92('0x3c')]=_0x54dba3[_0xfb92('0x3c')][_0xfb92('0x3b')]?_0x54dba3[_0xfb92('0x3c')]:_0x5936fe[_0xfb92('0x36')];if(_0x3d3e29[_0xfb92('0x37')][_0xfb92('0x48')]){_0x54dba3[_0xfb92('0x49')]=[{'all':!![]}];}_0x54dba3=_[_0xfb92('0x45')]({},_0x54dba3,_0x3d3e29[_0xfb92('0x47')]);return db[_0xfb92('0x31')][_0xfb92('0x4f')](_0x54dba3)[_0xfb92('0x29')](handleEntityNotFound(_0xb85c51,null))['then'](respondWithResult(_0xb85c51,null))['catch'](handleError(_0xb85c51,null));};exports[_0xfb92('0x50')]=function(_0x218bf8,_0x413a0e){return db[_0xfb92('0x31')][_0xfb92('0x50')](_0x218bf8[_0xfb92('0x51')],{})[_0xfb92('0x29')](function(_0x5dd633){var _0x440e24=_0x218bf8['user'][_0xfb92('0x2b')]({'plain':!![]});if(!_0x440e24)throw new Error(_0xfb92('0x52'));if(_0x440e24[_0xfb92('0x53')]==='user'){var _0x2d982e=_0x5dd633[_0xfb92('0x2b')]({'plain':!![]});var _0x3f4bfd=_0xfb92('0x54');return db[_0xfb92('0x55')]['find']({'where':{'name':_0x3f4bfd,'userProfileId':_0x440e24[_0xfb92('0x56')]},'raw':!![]})[_0xfb92('0x29')](function(_0x21aa83){if(_0x21aa83&&_0x21aa83[_0xfb92('0x57')]===0x0){return db[_0xfb92('0x58')][_0xfb92('0x50')]({'name':_0x2d982e[_0xfb92('0x2d')],'resourceId':_0x2d982e['id'],'type':_0x21aa83['name'],'sectionId':_0x21aa83['id']},{})[_0xfb92('0x29')](function(){return _0x5dd633;});}else{return _0x5dd633;}})[_0xfb92('0x4c')](function(_0x335834){logger['error'](_0xfb92('0x59'),_0x335834);throw _0x335834;});}return _0x5dd633;})[_0xfb92('0x29')](respondWithResult(_0x413a0e,0xc9))[_0xfb92('0x4c')](handleError(_0x413a0e,null));};exports[_0xfb92('0x28')]=function(_0x90dc27,_0x3a5b8a){if(_0x90dc27[_0xfb92('0x51')]['id']){delete _0x90dc27['body']['id'];}return db[_0xfb92('0x31')][_0xfb92('0x4f')]({'where':{'id':_0x90dc27[_0xfb92('0x4e')]['id']}})[_0xfb92('0x29')](handleEntityNotFound(_0x3a5b8a,null))['then'](saveUpdates(_0x90dc27['body'],null))[_0xfb92('0x29')](respondWithResult(_0x3a5b8a,null))[_0xfb92('0x4c')](handleError(_0x3a5b8a,null));};exports[_0xfb92('0x2a')]=function(_0x1972d0,_0x5a7b93){return db[_0xfb92('0x31')]['find']({'where':{'id':_0x1972d0['params']['id']}})[_0xfb92('0x29')](handleEntityNotFound(_0x5a7b93,null))[_0xfb92('0x29')](removeEntity(_0x5a7b93,null))['catch'](handleError(_0x5a7b93,null));};exports[_0xfb92('0x5a')]=function(_0x37c8bc,_0x43ee62){return db[_0xfb92('0x31')]['describe']()[_0xfb92('0x29')](respondWithResult(_0x43ee62,null))[_0xfb92('0x4c')](handleError(_0x43ee62,null));};exports[_0xfb92('0x5b')]=function(_0x1bb5b3,_0x2b67cc,_0x189076){if(_0x1bb5b3[_0xfb92('0x51')]['id']){delete _0x1bb5b3[_0xfb92('0x51')]['id'];}return db[_0xfb92('0x31')]['find']({'where':{'id':_0x1bb5b3[_0xfb92('0x4e')]['id']}})[_0xfb92('0x29')](handleEntityNotFound(_0x2b67cc,null))[_0xfb92('0x29')](function(_0x61457f){if(_0x61457f){_0x1bb5b3[_0xfb92('0x51')][_0xfb92('0x5c')]=_0x61457f['id'];return db[_0xfb92('0x5d')][_0xfb92('0x50')](_0x1bb5b3[_0xfb92('0x51')]);}})[_0xfb92('0x29')](respondWithResult(_0x2b67cc,null))[_0xfb92('0x4c')](handleError(_0x2b67cc,null));};exports[_0xfb92('0x5e')]=function(_0x1d3b56,_0x2aa8a4,_0x5b9eee){var _0xfdf562={'raw':![],'where':{}};var _0x5c9326={};var _0x3c359e={'count':0x0,'rows':[]};return db[_0xfb92('0x31')][_0xfb92('0x5f')]({'where':{'id':_0x1d3b56[_0xfb92('0x4e')]['id']}})[_0xfb92('0x29')](handleEntityNotFound(_0x2aa8a4,null))['then'](function(_0x5cb787){if(_0x5cb787){_0x5c9326[_0xfb92('0x36')]=_[_0xfb92('0x38')](db[_0xfb92('0x5d')][_0xfb92('0x32')]);_0x5c9326[_0xfb92('0x37')]=_[_0xfb92('0x38')](_0x1d3b56[_0xfb92('0x37')]);_0x5c9326['filters']=_['intersection'](_0x5c9326[_0xfb92('0x36')],_0x5c9326['query']);_0xfdf562[_0xfb92('0x3c')]=_[_0xfb92('0x39')](_0x5c9326[_0xfb92('0x36')],qs[_0xfb92('0x3a')](_0x1d3b56[_0xfb92('0x37')]['fields']));_0xfdf562[_0xfb92('0x3c')]=_0xfdf562[_0xfb92('0x3c')][_0xfb92('0x3b')]?_0xfdf562[_0xfb92('0x3c')]:_0x5c9326['model'];if(!_0x1d3b56['query'][_0xfb92('0x3d')](_0xfb92('0x3e'))){_0xfdf562['limit']=qs[_0xfb92('0x23')](_0x1d3b56[_0xfb92('0x37')][_0xfb92('0x23')]);_0xfdf562[_0xfb92('0x21')]=qs[_0xfb92('0x21')](_0x1d3b56[_0xfb92('0x37')]['offset']);}_0xfdf562[_0xfb92('0x3f')]=qs[_0xfb92('0x40')](_0x1d3b56[_0xfb92('0x37')][_0xfb92('0x40')]);_0xfdf562[_0xfb92('0x41')]=qs[_0xfb92('0x43')](_[_0xfb92('0x42')](_0x1d3b56[_0xfb92('0x37')],_0x5c9326[_0xfb92('0x43')]));_0xfdf562[_0xfb92('0x41')][_0xfb92('0x5c')]=_0x5cb787['id'];if(_0x1d3b56['query']['filter']){_0xfdf562[_0xfb92('0x41')]=_[_0xfb92('0x45')](_0xfdf562[_0xfb92('0x41')],{'$or':_['map'](_0xfdf562[_0xfb92('0x3c')],function(_0x76eb19){var _0x4f2110={};_0x4f2110[_0x76eb19]={'$like':'%'+_0x1d3b56[_0xfb92('0x37')]['filter']+'%'};return _0x4f2110;})});}_0xfdf562=_[_0xfb92('0x45')]({},_0xfdf562,_0x1d3b56[_0xfb92('0x47')]);return db['Disposition'][_0xfb92('0x60')]({'where':_0xfdf562[_0xfb92('0x41')]})[_0xfb92('0x29')](function(_0x23b176){_0x3c359e[_0xfb92('0x60')]=_0x23b176;if(_0x1d3b56[_0xfb92('0x37')][_0xfb92('0x48')]){_0xfdf562[_0xfb92('0x49')]=[{'all':!![]}];}return db[_0xfb92('0x5d')]['findAll'](_0xfdf562);})[_0xfb92('0x29')](function(_0x36aa00){_0x3c359e[_0xfb92('0x4b')]=_0x36aa00;return _0x3c359e;});}})[_0xfb92('0x29')](respondWithFilteredResult(_0x2aa8a4,_0xfdf562))[_0xfb92('0x4c')](handleError(_0x2aa8a4,null));};exports[_0xfb92('0x61')]=function(_0x3c696d,_0x46c527,_0x20007a){return db[_0xfb92('0x31')]['find']({'where':{'id':_0x3c696d[_0xfb92('0x4e')]['id']}})[_0xfb92('0x29')](handleEntityNotFound(_0x46c527,null))[_0xfb92('0x29')](function(_0xe99bd0){if(_0xe99bd0){return _0xe99bd0[_0xfb92('0x61')](_0x3c696d[_0xfb92('0x37')][_0xfb92('0x62')]);}})['then'](respondWithStatusCode(_0x46c527,null))[_0xfb92('0x4c')](handleError(_0x46c527,null));};exports[_0xfb92('0x63')]=function(_0x20cd1b,_0x4ceb74,_0x498447){return db[_0xfb92('0x31')][_0xfb92('0x4f')]({'where':{'id':_0x20cd1b[_0xfb92('0x4e')]['id']}})[_0xfb92('0x29')](handleEntityNotFound(_0x4ceb74,null))[_0xfb92('0x29')](function(_0xbd3840){if(_0xbd3840){var _0x50b136=[];var _0x58c2e9={'success':[],'errors':[]};return db[_0xfb92('0x64')]['describe']()['then'](function(_0x1162e0){if(_0x20cd1b[_0xfb92('0x51')][_0xfb92('0x65')]&&_['isArray'](_0x20cd1b['body']['tags'])){if(_0x20cd1b[_0xfb92('0x51')][_0xfb92('0x65')][_0xfb92('0x3b')]){_0x20cd1b[_0xfb92('0x51')][_0xfb92('0x65')]=_0x20cd1b[_0xfb92('0x51')][_0xfb92('0x65')][_0xfb92('0x66')](';')+';';}else{_0x20cd1b['body'][_0xfb92('0x65')]=null;}}else{_0x20cd1b[_0xfb92('0x51')][_0xfb92('0x65')]=null;}if(_0x20cd1b[_0xfb92('0x51')]&&_[_0xfb92('0x67')](_0x20cd1b[_0xfb92('0x51')])){for(var _0x8e1781=0x0;_0x8e1781<_0x20cd1b['body'][_0xfb92('0x3b')];_0x8e1781+=0x1){_0x20cd1b[_0xfb92('0x51')][_0x8e1781][_0xfb92('0x5c')]=_0x20cd1b[_0xfb92('0x4e')]['id'];_0x50b136[_0xfb92('0x68')](_0x20cd1b[_0xfb92('0x51')][_0x8e1781]);}return BPromise[_0xfb92('0x69')](_0x50b136,function(_0x1280ce){return db['CmContact'][_0xfb92('0x50')](_['omit'](_0x1280ce,[_0xfb92('0x62'),'id'])||{},{'fields':_[_0xfb92('0x38')](_0x1162e0),'raw':!![]})[_0xfb92('0x29')](function(_0x59f7e){_0x58c2e9[_0xfb92('0x6a')][_0xfb92('0x68')](_0x59f7e[_0xfb92('0x6b')]);})[_0xfb92('0x4c')](function(_0x290554){_0x58c2e9['errors'][_0xfb92('0x68')]({'data':_0x1280ce,'error':_0x290554[_0xfb92('0x6c')]});});})[_0xfb92('0x29')](function(_0x28a20e){return _0x58c2e9;})['catch'](function(_0x911a77){return _0x911a77;});}else{_0x4ceb74['status'](0x190)[_0xfb92('0x20')]({'message':_0xfb92('0x6d')});}});}})[_0xfb92('0x29')](respondWithResult(_0x4ceb74,null))[_0xfb92('0x4c')](handleError(_0x4ceb74,null));};exports[_0xfb92('0x6e')]=function(_0x381751,_0x13ee6f,_0x17314f){var _0x5bae32;return db['CmList']['find']({'where':{'id':_0x381751[_0xfb92('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xfb92('0x6f')}]})[_0xfb92('0x29')](handleEntityNotFound(_0x13ee6f,null))[_0xfb92('0x29')](function(_0x47cdad){if(_0x47cdad){_0x5bae32=_0x47cdad;return db[_0xfb92('0x64')]['rawAttributes'];}})['then'](function(_0x431285){if(_0x431285){var _0x1cdf13={};var _0x1857fe={};_0x1857fe[_0xfb92('0x36')]=_[_0xfb92('0x70')](_[_0xfb92('0x38')](_0x431285),_[_0xfb92('0x30')](_0x5bae32[_0xfb92('0x6f')],function(_0x9b5cc1){return util[_0xfb92('0x71')](_0xfb92('0x72'),_0x9b5cc1['id']);}));_0x1857fe[_0xfb92('0x37')]=_[_0xfb92('0x38')](_0x381751[_0xfb92('0x37')]);_0x1857fe[_0xfb92('0x43')]=_[_0xfb92('0x39')](_0x1857fe[_0xfb92('0x36')],_0x1857fe[_0xfb92('0x37')]);_0x1cdf13[_0xfb92('0x3c')]=_['intersection'](_0x1857fe[_0xfb92('0x36')],qs[_0xfb92('0x3a')](_0x381751[_0xfb92('0x37')]['fields']));_0x1cdf13[_0xfb92('0x3c')]=_0x1cdf13[_0xfb92('0x3c')]['length']?_0x1cdf13[_0xfb92('0x3c')]:_0x1857fe[_0xfb92('0x36')];if(!_0x381751['query'][_0xfb92('0x3d')](_0xfb92('0x3e'))){_0x1cdf13[_0xfb92('0x23')]=qs[_0xfb92('0x23')](_0x381751[_0xfb92('0x37')]['limit']);_0x1cdf13[_0xfb92('0x21')]=qs['offset'](_0x381751[_0xfb92('0x37')][_0xfb92('0x21')]);}_0x1cdf13[_0xfb92('0x3f')]=qs[_0xfb92('0x40')](_0x381751['query'][_0xfb92('0x40')]);_0x1cdf13['where']=qs[_0xfb92('0x43')](_[_0xfb92('0x42')](_0x381751['query'],_0x1857fe[_0xfb92('0x43')]));_0x1cdf13[_0xfb92('0x73')]=!![];if(_0x381751[_0xfb92('0x37')][_0xfb92('0x44')]){_0x1cdf13[_0xfb92('0x41')]=_[_0xfb92('0x45')](_0x1cdf13['where'],{'$or':_[_0xfb92('0x30')](_0x1cdf13[_0xfb92('0x3c')],function(_0xfc919e){var _0x40c804={};_0x40c804[_0xfc919e]={'$like':'%'+_0x381751[_0xfb92('0x37')][_0xfb92('0x44')]+'%'};return _0x40c804;})});}_0x1cdf13=_[_0xfb92('0x45')]({},_0x1cdf13,_0x381751[_0xfb92('0x47')]);return _0x5bae32[_0xfb92('0x6e')](_0x1cdf13);}})[_0xfb92('0x29')](respondWithResult(_0x13ee6f,null))['catch'](handleError(_0x13ee6f,null));};exports['getContactsCsv']=function(_0x3422b7,_0x2aae58,_0x108a7a){var _0x5a1549;return db[_0xfb92('0x31')][_0xfb92('0x4f')]({'where':{'id':_0x3422b7['params']['id']},'include':[{'model':db[_0xfb92('0x74')],'as':_0xfb92('0x6f')}]})[_0xfb92('0x29')](handleEntityNotFound(_0x2aae58,null))[_0xfb92('0x29')](function(_0x2061f9){if(_0x2061f9){_0x5a1549=_0x2061f9;return db[_0xfb92('0x64')][_0xfb92('0x32')];}})[_0xfb92('0x29')](function(_0x485436){if(_0x485436){var _0x5db986={};var _0xb25f8b={};_0xb25f8b[_0xfb92('0x36')]=_[_0xfb92('0x70')](_[_0xfb92('0x38')](_0x485436),_[_0xfb92('0x30')](_0x5a1549[_0xfb92('0x6f')],function(_0x29ae83){return util[_0xfb92('0x71')]('cf_%d',_0x29ae83['id']);}));_0xb25f8b[_0xfb92('0x37')]=_[_0xfb92('0x38')](_0x3422b7['query']);_0xb25f8b[_0xfb92('0x43')]=_[_0xfb92('0x39')](_0xb25f8b[_0xfb92('0x36')],_0xb25f8b[_0xfb92('0x37')]);_0x5db986[_0xfb92('0x3c')]=_[_0xfb92('0x39')](_0xb25f8b['model'],qs[_0xfb92('0x3a')](_0x3422b7['query'][_0xfb92('0x3a')]));_0x5db986[_0xfb92('0x3c')]=_0x5db986[_0xfb92('0x3c')]['length']?_0x5db986[_0xfb92('0x3c')]:_0xb25f8b['model'];if(!_0x3422b7['query'][_0xfb92('0x3d')](_0xfb92('0x3e'))){_0x5db986[_0xfb92('0x23')]=qs[_0xfb92('0x23')](_0x3422b7[_0xfb92('0x37')][_0xfb92('0x23')]);_0x5db986[_0xfb92('0x21')]=qs[_0xfb92('0x21')](_0x3422b7[_0xfb92('0x37')][_0xfb92('0x21')]);}_0x5db986['order']=qs['sort'](_0x3422b7[_0xfb92('0x37')][_0xfb92('0x40')]);_0x5db986[_0xfb92('0x41')]=qs['filters'](_[_0xfb92('0x42')](_0x3422b7[_0xfb92('0x37')],_0xb25f8b[_0xfb92('0x43')]));_0x5db986['raw']=!![];if(_0x3422b7['query'][_0xfb92('0x44')]){_0x5db986[_0xfb92('0x41')]=_['merge'](_0x5db986[_0xfb92('0x41')],{'$or':_['map'](_0x5db986[_0xfb92('0x3c')],function(_0x1723b0){var _0x45e229={};_0x45e229[_0x1723b0]={'$like':'%'+_0x3422b7['query'][_0xfb92('0x44')]+'%'};return _0x45e229;})});}_0x5db986=_[_0xfb92('0x45')]({},_0x5db986,_0x3422b7['options']);return _0x5a1549[_0xfb92('0x6e')](_0x5db986);}})[_0xfb92('0x29')](function(_0x12dcd6){if(!_[_0xfb92('0x75')](_0x12dcd6)){var _0xf489e5=toCsv(_0x12dcd6);var _0x105a8e=Date[_0xfb92('0x76')]();fs['writeFileSync'](util[_0xfb92('0x71')]('/tmp/list_%d_%s.csv',_0x5a1549['id'],_0x105a8e),_0xf489e5);_0x2aae58[_0xfb92('0x77')](_0xfb92('0x78'),_0xfb92('0x79')+util[_0xfb92('0x71')]('list_%d_%s.csv',_0x5a1549['id'],_0x105a8e));_0x2aae58[_0xfb92('0x77')]('Content-type',_0xfb92('0x7a'));return _0x2aae58['download'](util[_0xfb92('0x71')](_0xfb92('0x7b'),_0x5a1549['id'],_0x105a8e));}else{return _0x2aae58[_0xfb92('0x1d')](0xcc);}})['catch'](handleError(_0x2aae58,null));};exports[_0xfb92('0x7c')]=function(_0x3a39e7,_0xe1c790,_0x18688e){var _0xb9d141;delete _0x3a39e7['body']['id'];return db['CmList'][_0xfb92('0x5f')]({'where':{'id':_0x3a39e7[_0xfb92('0x4e')]['id']}})[_0xfb92('0x29')](handleEntityNotFound(_0xe1c790,null))[_0xfb92('0x29')](function(_0x1dbdbf){if(_0x1dbdbf){return db[_0xfb92('0x7d')][_0xfb92('0x7e')](function(_0x31a26d){return db[_0xfb92('0x74')]['create'](_0x3a39e7[_0xfb92('0x51')],{'transaction':_0x31a26d})['then'](function(_0x527a9f){_0xb9d141=_0x527a9f;return _0x1dbdbf[_0xfb92('0x7f')](_0x527a9f,{'transaction':_0x31a26d});})[_0xfb92('0x29')](function(){var _0x358b9f={'type':db[_0xfb92('0x80')][_0xfb92('0x81')],'transaction':_0x31a26d};switch(_0x3a39e7[_0xfb92('0x51')][_0xfb92('0x34')]){case _0xfb92('0x82'):_0x358b9f['type']=db[_0xfb92('0x80')][_0xfb92('0x81')];break;case _0xfb92('0x83'):_0x358b9f[_0xfb92('0x34')]=db['Sequelize'][_0xfb92('0x84')];break;case _0xfb92('0x85'):_0x358b9f[_0xfb92('0x34')]=db[_0xfb92('0x80')]['BOOLEAN'];_0x358b9f['defaultValue']=![];break;default:}return db[_0xfb92('0x7d')]['queryInterface']['addColumn'](_0xfb92('0x86'),util[_0xfb92('0x71')](_0xfb92('0x87'),_0xb9d141['id']),_0x358b9f);})[_0xfb92('0x29')](function(){return _0xb9d141;});});}})[_0xfb92('0x29')](respondWithResult(_0xe1c790,null))[_0xfb92('0x4c')](handleError(_0xe1c790,null));};exports[_0xfb92('0x88')]=function(_0x31fa06,_0x5ce9b5,_0x20b93b){var _0x4e96d0={};var _0x2c4334={};var _0x489f8d;var _0x4fb590;return db[_0xfb92('0x31')][_0xfb92('0x5f')]({'where':{'id':_0x31fa06[_0xfb92('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5ce9b5,null))['then'](function(_0x85c8d1){if(_0x85c8d1){_0x489f8d=_0x85c8d1;_0x2c4334['model']=_['keys'](db['CmCustomField'][_0xfb92('0x32')]);_0x2c4334['query']=_[_0xfb92('0x38')](_0x31fa06[_0xfb92('0x37')]);_0x2c4334[_0xfb92('0x43')]=_[_0xfb92('0x39')](_0x2c4334[_0xfb92('0x36')],_0x2c4334[_0xfb92('0x37')]);_0x4e96d0['attributes']=_['intersection'](_0x2c4334[_0xfb92('0x36')],qs[_0xfb92('0x3a')](_0x31fa06['query']['fields']));_0x4e96d0['attributes']=_0x4e96d0[_0xfb92('0x3c')]['length']?_0x4e96d0[_0xfb92('0x3c')]:_0x2c4334[_0xfb92('0x36')];_0x4e96d0[_0xfb92('0x3f')]=qs[_0xfb92('0x40')](_0x31fa06[_0xfb92('0x37')][_0xfb92('0x40')]);_0x4e96d0[_0xfb92('0x41')]=qs[_0xfb92('0x43')](_[_0xfb92('0x42')](_0x31fa06[_0xfb92('0x37')],_0x2c4334['filters']));_0x4e96d0[_0xfb92('0x41')]=_[_0xfb92('0x45')](_0x4e96d0['where'],{'$or':[{'ListId':_0x85c8d1['id']},{'ListId':null}]});if(_0x31fa06[_0xfb92('0x37')][_0xfb92('0x44')]){_0x4e96d0[_0xfb92('0x41')]=_[_0xfb92('0x45')](_0x4e96d0[_0xfb92('0x41')],{'$or':_['map'](_0x4e96d0[_0xfb92('0x3c')],function(_0x56284f){var _0x4a992f={};_0x4a992f[_0x56284f]={'$like':'%'+_0x31fa06[_0xfb92('0x37')][_0xfb92('0x44')]+'%'};return _0x4a992f;})});}_0x4e96d0=_[_0xfb92('0x45')]({},_0x4e96d0,_0x31fa06[_0xfb92('0x47')]);return db[_0xfb92('0x74')]['findAndCountAll'](_0x4e96d0);}})['then'](respondWithResult(_0x5ce9b5,null))[_0xfb92('0x4c')](handleError(_0x5ce9b5,null));};exports['addAgents']=function(_0x466866,_0x559a58,_0x313972){return db[_0xfb92('0x31')][_0xfb92('0x4f')]({'where':{'id':_0x466866['params']['id']}})[_0xfb92('0x29')](handleEntityNotFound(_0x559a58,null))[_0xfb92('0x29')](function(_0x39d022){if(_0x39d022){return _0x39d022['addAgents'](_0x466866['body'][_0xfb92('0x62')],_[_0xfb92('0x89')](_0x466866[_0xfb92('0x51')],[_0xfb92('0x62'),'id'])||{})[_0xfb92('0x8a')](function(_0x8d9869){for(var _0x5b5ec2=0x0;_0x5b5ec2<_0x466866['body'][_0xfb92('0x62')][_0xfb92('0x3b')];_0x5b5ec2+=0x1){socket[_0xfb92('0x8b')](_0xfb92('0x8c'),{'UserId':Number(_0x466866[_0xfb92('0x51')][_0xfb92('0x62')][_0x5b5ec2]),'CmListId':Number(_0x466866[_0xfb92('0x4e')]['id'])});}return _0x8d9869;});}})[_0xfb92('0x29')](respondWithResult(_0x559a58,null))[_0xfb92('0x4c')](handleError(_0x559a58,null));};exports[_0xfb92('0x8d')]=function(_0x5bb8e8,_0x4b5d96,_0x6950e5){return db[_0xfb92('0x31')][_0xfb92('0x4f')]({'where':{'id':_0x5bb8e8[_0xfb92('0x4e')]['id']}})[_0xfb92('0x29')](handleEntityNotFound(_0x4b5d96,null))[_0xfb92('0x29')](function(_0x5de4e3){if(_0x5de4e3){return _0x5de4e3['removeAgents'](_0x5bb8e8[_0xfb92('0x37')]['ids'])['then'](function(){if(_[_0xfb92('0x67')](_0x5bb8e8[_0xfb92('0x37')][_0xfb92('0x62')])){for(var _0x1c611a=0x0;_0x1c611a<_0x5bb8e8[_0xfb92('0x37')][_0xfb92('0x62')][_0xfb92('0x3b')];_0x1c611a+=0x1){socket[_0xfb92('0x8b')](_0xfb92('0x8e'),{'UserId':Number(_0x5bb8e8['query'][_0xfb92('0x62')][_0x1c611a]),'CmListId':Number(_0x5bb8e8['params']['id'])});}}else{socket['emit'](_0xfb92('0x8e'),{'UserId':Number(_0x5bb8e8[_0xfb92('0x37')][_0xfb92('0x62')]),'CmListId':Number(_0x5bb8e8[_0xfb92('0x4e')]['id'])});}});}})[_0xfb92('0x29')](respondWithStatusCode(_0x4b5d96,null))['catch'](handleError(_0x4b5d96,null));};exports[_0xfb92('0x8f')]=function(_0x4bd699,_0x471341,_0xdf5b03){var _0x453faa={};var _0x4b23ed={};var _0x333d7c;var _0xd2fa94;return db['CmList'][_0xfb92('0x5f')]({'where':{'id':_0x4bd699['params']['id']}})[_0xfb92('0x29')](handleEntityNotFound(_0x471341,null))[_0xfb92('0x29')](function(_0x4b8b90){if(_0x4b8b90){_0x333d7c=_0x4b8b90;_0x4b23ed[_0xfb92('0x36')]=_[_0xfb92('0x38')](db['User'][_0xfb92('0x32')]);_0x4b23ed[_0xfb92('0x37')]=_[_0xfb92('0x38')](_0x4bd699[_0xfb92('0x37')]);_0x4b23ed['filters']=_[_0xfb92('0x39')](_0x4b23ed['model'],_0x4b23ed[_0xfb92('0x37')]);_0x453faa[_0xfb92('0x3c')]=_['intersection'](_0x4b23ed[_0xfb92('0x36')],qs[_0xfb92('0x3a')](_0x4bd699[_0xfb92('0x37')][_0xfb92('0x3a')]));_0x453faa['attributes']=_0x453faa['attributes'][_0xfb92('0x3b')]?_0x453faa[_0xfb92('0x3c')]:_0x4b23ed[_0xfb92('0x36')];_0x453faa[_0xfb92('0x3f')]=qs['sort'](_0x4bd699[_0xfb92('0x37')][_0xfb92('0x40')]);_0x453faa[_0xfb92('0x41')]=qs[_0xfb92('0x43')](_[_0xfb92('0x42')](_0x4bd699[_0xfb92('0x37')],_0x4b23ed[_0xfb92('0x43')]));if(_0x4bd699[_0xfb92('0x37')][_0xfb92('0x44')]){_0x453faa[_0xfb92('0x41')]=_[_0xfb92('0x45')](_0x453faa[_0xfb92('0x41')],{'$or':_[_0xfb92('0x30')](_0x453faa[_0xfb92('0x3c')],function(_0x296947){var _0x49b0d6={};_0x49b0d6[_0x296947]={'$like':'%'+_0x4bd699[_0xfb92('0x37')]['filter']+'%'};return _0x49b0d6;})});}_0x453faa=_['merge']({},_0x453faa,_0x4bd699[_0xfb92('0x47')]);return _0x333d7c[_0xfb92('0x8f')](_0x453faa);}})[_0xfb92('0x29')](function(_0x513485){if(_0x513485){_0xd2fa94=_0x513485[_0xfb92('0x3b')];if(!_0x4bd699[_0xfb92('0x37')][_0xfb92('0x3d')](_0xfb92('0x3e'))){_0x453faa['limit']=qs[_0xfb92('0x23')](_0x4bd699[_0xfb92('0x37')][_0xfb92('0x23')]);_0x453faa['offset']=qs['offset'](_0x4bd699['query'][_0xfb92('0x21')]);}return _0x333d7c[_0xfb92('0x8f')](_0x453faa);}})[_0xfb92('0x29')](function(_0x346a62){if(_0x346a62){return _0x346a62?{'count':_0xd2fa94,'rows':_0x346a62}:null;}})[_0xfb92('0x29')](respondWithResult(_0x471341,null))['catch'](handleError(_0x471341,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index ccee499..ca64db7 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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe14b,0x93));var _0xbe14=function(_0x48ed3e,_0x576c47){_0x48ed3e=_0x48ed3e-0x0;var _0x1ba875=_0xe14b[_0x48ed3e];return _0x1ba875;};'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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x57aaec,_0x2d1cf5){_0x57aaec=_0x57aaec-0x0;var _0x29a83d=_0x3e74[_0x57aaec];return _0x29a83d;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 7c75b23..5cc033a 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 _0xb43b=['rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash','util','api','moment','bluebird','path'];(function(_0xb09b65,_0x22fc68){var _0x29ea26=function(_0x240192){while(--_0x240192){_0xb09b65['push'](_0xb09b65['shift']());}};_0x29ea26(++_0x22fc68);}(_0xb43b,0x1b2));var _0xbb43=function(_0x382738,_0x59f4ab){_0x382738=_0x382738-0x0;var _0x2f4a7f=_0xb43b[_0x382738];return _0x2f4a7f;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bde=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','api','bluebird'];(function(_0x18e5db,_0x4f836f){var _0x3c0fe9=function(_0x2c097b){while(--_0x2c097b){_0x18e5db['push'](_0x18e5db['shift']());}};_0x3c0fe9(++_0x4f836f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1ea5f0,_0x5ea56f){_0x1ea5f0=_0x1ea5f0-0x0;var _0x892c0d=_0x9bde[_0x1ea5f0];return _0x892c0d;};'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 diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index ee6b3ef..748346f 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 _0x2b7c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./cmList.socket','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x373f01,_0x58e725){var _0x2f19d7=function(_0x25a235){while(--_0x25a235){_0x373f01['push'](_0x373f01['shift']());}};_0x2f19d7(++_0x58e725);}(_0x2b7c,0x1f0));var _0xc2b7=function(_0x4e3827,_0x4478fb){_0x4e3827=_0x4e3827-0x0;var _0x35f00d=_0x2b7c[_0x4e3827];return _0x35f00d;};'use strict';var _=require(_0xc2b7('0x0'));var util=require(_0xc2b7('0x1'));var moment=require('moment');var BPromise=require(_0xc2b7('0x2'));var rs=require(_0xc2b7('0x3'));var fs=require('fs');var Redis=require(_0xc2b7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc2b7('0x5'));var logger=require(_0xc2b7('0x6'))(_0xc2b7('0x7'));var config=require(_0xc2b7('0x8'));var jayson=require(_0xc2b7('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xc2b7('0xa')]=_[_0xc2b7('0xb')](config[_0xc2b7('0xa')],{'host':_0xc2b7('0xc'),'port':0x18eb});var socket=require(_0xc2b7('0xd'))(new Redis(config[_0xc2b7('0xa')]));require(_0xc2b7('0xe'))['register'](socket);function respondWithRpcPromise(_0x289e3e,_0x2127af,_0x17f8df){return new BPromise(function(_0x3f675b,_0x2d5791){return client['request'](_0x289e3e,_0x17f8df)[_0xc2b7('0xf')](function(_0xe6c2d8){logger[_0xc2b7('0x10')](_0xc2b7('0x11'),_0x2127af,_0xc2b7('0x12'));logger['debug'](_0xc2b7('0x13'),_0x2127af,_0xc2b7('0x12'),JSON['stringify'](_0xe6c2d8));if(_0xe6c2d8[_0xc2b7('0x14')]){if(_0xe6c2d8[_0xc2b7('0x14')][_0xc2b7('0x15')]===0x1f4){logger[_0xc2b7('0x14')]('CmList,\x20%s,\x20%s',_0x2127af,_0xe6c2d8[_0xc2b7('0x14')][_0xc2b7('0x16')]);return _0x2d5791(_0xe6c2d8[_0xc2b7('0x14')]['message']);}logger[_0xc2b7('0x14')]('CmList,\x20%s,\x20%s',_0x2127af,_0xe6c2d8[_0xc2b7('0x14')][_0xc2b7('0x16')]);return _0x3f675b(_0xe6c2d8['error']['message']);}else{logger[_0xc2b7('0x10')](_0xc2b7('0x11'),_0x2127af,'request\x20sent');_0x3f675b(_0xe6c2d8[_0xc2b7('0x17')][_0xc2b7('0x16')]);}})[_0xc2b7('0x18')](function(_0x367caf){logger[_0xc2b7('0x14')](_0xc2b7('0x11'),_0x2127af,_0x367caf);_0x2d5791(_0x367caf);});});} \ No newline at end of file +var _0x390a=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis'];(function(_0x13bcbb,_0x2eb915){var _0x457c81=function(_0xf44477){while(--_0xf44477){_0x13bcbb['push'](_0x13bcbb['shift']());}};_0x457c81(++_0x2eb915);}(_0x390a,0x191));var _0xa390=function(_0x1a7f3f,_0x2ca23b){_0x1a7f3f=_0x1a7f3f-0x0;var _0xef0bb7=_0x390a[_0x1a7f3f];return _0xef0bb7;};'use strict';var _=require('lodash');var util=require(_0xa390('0x0'));var moment=require(_0xa390('0x1'));var BPromise=require(_0xa390('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa390('0x3'));var db=require(_0xa390('0x4'))['db'];var utils=require(_0xa390('0x5'));var logger=require('../../config/logger')(_0xa390('0x6'));var config=require(_0xa390('0x7'));var jayson=require(_0xa390('0x8'));var client=jayson[_0xa390('0x9')][_0xa390('0xa')]({'port':0x232a});config[_0xa390('0xb')]=_[_0xa390('0xc')](config[_0xa390('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa390('0xd'))(new Redis(config[_0xa390('0xb')]));require(_0xa390('0xe'))['register'](socket);function respondWithRpcPromise(_0x1bc104,_0x530575,_0x3a57d2){return new BPromise(function(_0xa5444f,_0xddf8b6){return client[_0xa390('0xf')](_0x1bc104,_0x3a57d2)[_0xa390('0x10')](function(_0x466cf8){logger[_0xa390('0x11')](_0xa390('0x12'),_0x530575,'request\x20sent');logger[_0xa390('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x530575,_0xa390('0x14'),JSON[_0xa390('0x15')](_0x466cf8));if(_0x466cf8[_0xa390('0x16')]){if(_0x466cf8[_0xa390('0x16')][_0xa390('0x17')]===0x1f4){logger[_0xa390('0x16')]('CmList,\x20%s,\x20%s',_0x530575,_0x466cf8['error'][_0xa390('0x18')]);return _0xddf8b6(_0x466cf8[_0xa390('0x16')][_0xa390('0x18')]);}logger[_0xa390('0x16')](_0xa390('0x12'),_0x530575,_0x466cf8[_0xa390('0x16')][_0xa390('0x18')]);return _0xa5444f(_0x466cf8['error'][_0xa390('0x18')]);}else{logger[_0xa390('0x11')]('CmList,\x20%s,\x20%s',_0x530575,_0xa390('0x14'));_0xa5444f(_0x466cf8[_0xa390('0x19')][_0xa390('0x18')]);}})[_0xa390('0x1a')](function(_0x2e4c1a){logger[_0xa390('0x16')](_0xa390('0x12'),_0x530575,_0x2e4c1a);_0xddf8b6(_0x2e4c1a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 550999d..591cc70 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 _0x82ca=['removeListener','register','./cmList.events','save','update','emit'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0x82ca,0xb6));var _0xa82c=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0x82ca[_0x39a2d6];return _0x23af66;};'use strict';var CmListEvents=require(_0xa82c('0x0'));var events=[_0xa82c('0x1'),'remove',_0xa82c('0x2')];function createListener(_0x1e667f,_0x39a703){return function(_0x476124){_0x39a703[_0xa82c('0x3')](_0x1e667f,_0x476124);};}function removeListener(_0x2d4353,_0x3622d8){return function(){CmListEvents[_0xa82c('0x4')](_0x2d4353,_0x3622d8);};}exports[_0xa82c('0x5')]=function(_0x8afa9d){for(var _0xd9d85e=0x0,_0x662c6a=events['length'];_0xd9d85e<_0x662c6a;_0xd9d85e++){var _0x3d5c9a=events[_0xd9d85e];var _0x288ca3=createListener('cmList:'+_0x3d5c9a,_0x8afa9d);CmListEvents['on'](_0x3d5c9a,_0x288ca3);}}; \ No newline at end of file +var _0x9bac=['cmList:','./cmList.events','save','update','emit','removeListener','register','length'];(function(_0x319b05,_0x496016){var _0x3f9d13=function(_0x488cd8){while(--_0x488cd8){_0x319b05['push'](_0x319b05['shift']());}};_0x3f9d13(++_0x496016);}(_0x9bac,0x91));var _0xc9ba=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9bac[_0x501510];return _0x1e6ee5;};'use strict';var CmListEvents=require(_0xc9ba('0x0'));var events=[_0xc9ba('0x1'),'remove',_0xc9ba('0x2')];function createListener(_0x50e9e3,_0x418e07){return function(_0x1986aa){_0x418e07[_0xc9ba('0x3')](_0x50e9e3,_0x1986aa);};}function removeListener(_0x4df49a,_0x121f03){return function(){CmListEvents[_0xc9ba('0x4')](_0x4df49a,_0x121f03);};}exports[_0xc9ba('0x5')]=function(_0x45acad){for(var _0x1c2278=0x0,_0x3f778a=events[_0xc9ba('0x6')];_0x1c2278<_0x3f778a;_0x1c2278++){var _0xea21a7=events[_0x1c2278];var _0x1bca1d=createListener(_0xc9ba('0x7')+_0xea21a7,_0x45acad);CmListEvents['on'](_0xea21a7,_0x1bca1d);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index d901b12..7a67f1f 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 _0xf9ee=['/describe','describe','/:id/dispositions','getContacts','/:id/contacts/csv','getCustomFields','/:id/users','getAgents','post','create','addDisposition','/:id/contacts','/:id/fields','addCustomField','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','index'];(function(_0x197954,_0x3f61d0){var _0x231d54=function(_0x1420c7){while(--_0x1420c7){_0x197954['push'](_0x197954['shift']());}};_0x231d54(++_0x3f61d0);}(_0xf9ee,0x1dd));var _0xef9e=function(_0x52ca97,_0x490f53){_0x52ca97=_0x52ca97-0x0;var _0x470ed4=_0xf9ee[_0x52ca97];return _0x470ed4;};'use strict';var multer=require(_0xef9e('0x0'));var util=require(_0xef9e('0x1'));var path=require(_0xef9e('0x2'));var timeout=require(_0xef9e('0x3'));var express=require(_0xef9e('0x4'));var router=express[_0xef9e('0x5')]();var fs_extra=require(_0xef9e('0x6'));var auth=require(_0xef9e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xef9e('0x8'));var controller=require(_0xef9e('0x9'));router[_0xef9e('0xa')]('/',auth[_0xef9e('0xb')](),controller[_0xef9e('0xc')]);router[_0xef9e('0xa')](_0xef9e('0xd'),auth[_0xef9e('0xb')](),controller[_0xef9e('0xe')]);router['get']('/:id',auth[_0xef9e('0xb')](),controller['show']);router[_0xef9e('0xa')](_0xef9e('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xef9e('0xa')]('/:id/contacts',auth[_0xef9e('0xb')](),controller[_0xef9e('0x10')]);router[_0xef9e('0xa')](_0xef9e('0x11'),auth['isAuthenticated'](),controller['getContactsCsv']);router['get']('/:id/fields',auth[_0xef9e('0xb')](),controller[_0xef9e('0x12')]);router['get'](_0xef9e('0x13'),auth[_0xef9e('0xb')](),controller[_0xef9e('0x14')]);router[_0xef9e('0x15')]('/',auth['isAuthenticated'](),controller[_0xef9e('0x16')]);router[_0xef9e('0x15')](_0xef9e('0xf'),auth[_0xef9e('0xb')](),controller[_0xef9e('0x17')]);router['post'](_0xef9e('0x18'),auth[_0xef9e('0xb')](),controller['addContacts']);router[_0xef9e('0x15')](_0xef9e('0x19'),auth['isAuthenticated'](),controller[_0xef9e('0x1a')]);router[_0xef9e('0x15')](_0xef9e('0x13'),auth[_0xef9e('0xb')](),controller[_0xef9e('0x1b')]);router[_0xef9e('0x1c')](_0xef9e('0x1d'),auth[_0xef9e('0xb')](),controller[_0xef9e('0x1e')]);router[_0xef9e('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0xef9e('0x20')]);router['delete'](_0xef9e('0xf'),auth[_0xef9e('0xb')](),controller[_0xef9e('0x21')]);router['delete'](_0xef9e('0x13'),auth['isAuthenticated'](),controller[_0xef9e('0x22')]);module['exports']=router; \ No newline at end of file +var _0xcc69=['express','Router','fs-extra','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addContacts','addCustomField','put','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path'];(function(_0x2c1114,_0x2a5c50){var _0x2b877c=function(_0x4f356d){while(--_0x4f356d){_0x2c1114['push'](_0x2c1114['shift']());}};_0x2b877c(++_0x2a5c50);}(_0xcc69,0x15b));var _0x9cc6=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0xcc69[_0x2459fd];return _0x364cd2;};'use strict';var multer=require(_0x9cc6('0x0'));var util=require(_0x9cc6('0x1'));var path=require(_0x9cc6('0x2'));var timeout=require('connect-timeout');var express=require(_0x9cc6('0x3'));var router=express[_0x9cc6('0x4')]();var fs_extra=require(_0x9cc6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9cc6('0x6'));var controller=require(_0x9cc6('0x7'));router[_0x9cc6('0x8')]('/',auth[_0x9cc6('0x9')](),controller[_0x9cc6('0xa')]);router[_0x9cc6('0x8')](_0x9cc6('0xb'),auth[_0x9cc6('0x9')](),controller[_0x9cc6('0xc')]);router[_0x9cc6('0x8')](_0x9cc6('0xd'),auth[_0x9cc6('0x9')](),controller['show']);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9cc6('0xe')]);router['get'](_0x9cc6('0xf'),auth[_0x9cc6('0x9')](),controller[_0x9cc6('0x10')]);router[_0x9cc6('0x8')](_0x9cc6('0x11'),auth[_0x9cc6('0x9')](),controller[_0x9cc6('0x12')]);router[_0x9cc6('0x8')](_0x9cc6('0x13'),auth['isAuthenticated'](),controller[_0x9cc6('0x14')]);router[_0x9cc6('0x8')](_0x9cc6('0x15'),auth[_0x9cc6('0x9')](),controller[_0x9cc6('0x16')]);router[_0x9cc6('0x17')]('/',auth[_0x9cc6('0x9')](),controller[_0x9cc6('0x18')]);router[_0x9cc6('0x17')](_0x9cc6('0x19'),auth[_0x9cc6('0x9')](),controller[_0x9cc6('0x1a')]);router[_0x9cc6('0x17')]('/:id/contacts',auth[_0x9cc6('0x9')](),controller[_0x9cc6('0x1b')]);router['post'](_0x9cc6('0x13'),auth[_0x9cc6('0x9')](),controller[_0x9cc6('0x1c')]);router[_0x9cc6('0x17')](_0x9cc6('0x15'),auth['isAuthenticated'](),controller['addAgents']);router[_0x9cc6('0x1d')](_0x9cc6('0xd'),auth[_0x9cc6('0x9')](),controller['update']);router[_0x9cc6('0x1e')](_0x9cc6('0xd'),auth['isAuthenticated'](),controller[_0x9cc6('0x1f')]);router[_0x9cc6('0x1e')](_0x9cc6('0x19'),auth[_0x9cc6('0x9')](),controller[_0x9cc6('0x20')]);router[_0x9cc6('0x1e')](_0x9cc6('0x15'),auth[_0x9cc6('0x9')](),controller[_0x9cc6('0x21')]);module[_0x9cc6('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 9308841..7a61a6e 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 _0x0ddd=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x4c133f,_0x1c6d4e){var _0x2d67a3=function(_0x985e02){while(--_0x985e02){_0x4c133f['push'](_0x4c133f['shift']());}};_0x2d67a3(++_0x1c6d4e);}(_0x0ddd,0x19f));var _0xd0dd=function(_0x9b94b5,_0x565e82){_0x9b94b5=_0x9b94b5-0x0;var _0x4e54eb=_0x0ddd[_0x9b94b5];return _0x4e54eb;};'use strict';var Sequelize=require(_0xd0dd('0x0'));module[_0xd0dd('0x1')]={'name':{'type':Sequelize[_0xd0dd('0x2')],'get':function(_0x596bfa){return this[_0xd0dd('0x3')](_0xd0dd('0x4'));}},'field':{'type':Sequelize[_0xd0dd('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xd0dd('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xd0dd('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0xcbb9=['STRING','sequelize','exports','VIRTUAL'];(function(_0x54a816,_0x24f7b6){var _0x35b0d9=function(_0x24a431){while(--_0x24a431){_0x54a816['push'](_0x54a816['shift']());}};_0x35b0d9(++_0x24f7b6);}(_0xcbb9,0x169));var _0x9cbb=function(_0x25bc6d,_0x3a9304){_0x25bc6d=_0x25bc6d-0x0;var _0x2b6d66=_0xcbb9[_0x25bc6d];return _0x2b6d66;};'use strict';var Sequelize=require(_0x9cbb('0x0'));module[_0x9cbb('0x1')]={'name':{'type':Sequelize[_0x9cbb('0x2')],'get':function(_0xc69d6f){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x9cbb('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x9cbb('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x9cbb('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 52a84ef..3606582 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(_0x31c6b6,_0xdd33b7){var _0x32b27b=function(_0x32f195){while(--_0x32f195){_0x31c6b6['push'](_0x31c6b6['shift']());}};_0x32b27b(++_0xdd33b7);}(_0x7a54,0x106));var _0x47a5=function(_0x1ce8c0,_0x4c1e49){_0x1ce8c0=_0x1ce8c0-0x0;var _0x2f1ddf=_0x7a54[_0x1ce8c0];return _0x2f1ddf;};'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(_0x47198c,_0x2eaf8e){var _0x5495d1=function(_0x281d1a){while(--_0x281d1a){_0x47198c['push'](_0x47198c['shift']());}};_0x5495d1(++_0x2eaf8e);}(_0x7a54,0x106));var _0x47a5=function(_0x202cb4,_0x2e523c){_0x202cb4=_0x202cb4-0x0;var _0x46b113=_0x7a54[_0x202cb4];return _0x46b113;};'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 4d0bceb..a633fcc 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 _0xd8f7=['path','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x23f642,_0x3c8f66){var _0x4ba0d0=function(_0x507a88){while(--_0x507a88){_0x23f642['push'](_0x23f642['shift']());}};_0x4ba0d0(++_0x3c8f66);}(_0xd8f7,0x18c));var _0x7d8f=function(_0x2be60d,_0x2c6bb1){_0x2be60d=_0x2be60d-0x0;var _0x2291b8=_0xd8f7[_0x2be60d];return _0x2291b8;};'use strict';var _=require(_0x7d8f('0x0'));var util=require(_0x7d8f('0x1'));var logger=require(_0x7d8f('0x2'))(_0x7d8f('0x3'));var moment=require(_0x7d8f('0x4'));var BPromise=require(_0x7d8f('0x5'));var rp=require(_0x7d8f('0x6'));var fs=require('fs');var path=require(_0x7d8f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7d8f('0x8'));module[_0x7d8f('0x9')]=function(_0x1033be,_0x40d65f){return _0x1033be[_0x7d8f('0xa')](_0x7d8f('0xb'),attributes,{'tableName':_0x7d8f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd584=['Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./condition.attributes','exports','define'];(function(_0x10dbcb,_0x96fd86){var _0x3fb2b7=function(_0x531261){while(--_0x531261){_0x10dbcb['push'](_0x10dbcb['shift']());}};_0x3fb2b7(++_0x96fd86);}(_0xd584,0x160));var _0x4d58=function(_0x8bece7,_0x2b0a5f){_0x8bece7=_0x8bece7-0x0;var _0x54191b=_0xd584[_0x8bece7];return _0x54191b;};'use strict';var _=require(_0x4d58('0x0'));var util=require(_0x4d58('0x1'));var logger=require(_0x4d58('0x2'))(_0x4d58('0x3'));var moment=require(_0x4d58('0x4'));var BPromise=require(_0x4d58('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d58('0x6'));var rimraf=require(_0x4d58('0x7'));var config=require(_0x4d58('0x8'));var attributes=require(_0x4d58('0x9'));module[_0x4d58('0xa')]=function(_0x2cc347,_0x37cf57){return _0x2cc347[_0x4d58('0xb')](_0x4d58('0xc'),attributes,{'tableName':_0x4d58('0xd'),'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 9e80dcf..afac889 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 _0x42ae=['debug','Condition,\x20%s,\x20%s,\x20%s','stringify','code','error','message','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x4d7ad9,_0x5f2362){var _0x16cd16=function(_0x27df2c){while(--_0x27df2c){_0x4d7ad9['push'](_0x4d7ad9['shift']());}};_0x16cd16(++_0x5f2362);}(_0x42ae,0x132));var _0xe42a=function(_0x58eb93,_0x3b8263){_0x58eb93=_0x58eb93-0x0;var _0xc0d5c0=_0x42ae[_0x58eb93];return _0xc0d5c0;};'use strict';var _=require(_0xe42a('0x0'));var util=require(_0xe42a('0x1'));var moment=require('moment');var BPromise=require(_0xe42a('0x2'));var rs=require(_0xe42a('0x3'));var fs=require('fs');var Redis=require(_0xe42a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe42a('0x5'));var logger=require(_0xe42a('0x6'))('rpc');var config=require(_0xe42a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe42a('0x8')][_0xe42a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e90a5,_0x3cb1d8,_0x26eb94){return new BPromise(function(_0x4b56d3,_0x445bf1){return client[_0xe42a('0xa')](_0x3e90a5,_0x26eb94)['then'](function(_0x1a3ddb){logger[_0xe42a('0xb')](_0xe42a('0xc'),_0x3cb1d8,_0xe42a('0xd'));logger[_0xe42a('0xe')](_0xe42a('0xf'),_0x3cb1d8,_0xe42a('0xd'),JSON[_0xe42a('0x10')](_0x1a3ddb));if(_0x1a3ddb['error']){if(_0x1a3ddb['error'][_0xe42a('0x11')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x3cb1d8,_0x1a3ddb[_0xe42a('0x12')][_0xe42a('0x13')]);return _0x445bf1(_0x1a3ddb[_0xe42a('0x12')][_0xe42a('0x13')]);}logger['error'](_0xe42a('0xc'),_0x3cb1d8,_0x1a3ddb[_0xe42a('0x12')]['message']);return _0x4b56d3(_0x1a3ddb[_0xe42a('0x12')]['message']);}else{logger['info'](_0xe42a('0xc'),_0x3cb1d8,_0xe42a('0xd'));_0x4b56d3(_0x1a3ddb['result']['message']);}})['catch'](function(_0xbffe41){logger[_0xe42a('0x12')]('Condition,\x20%s,\x20%s',_0x3cb1d8,_0xbffe41);_0x445bf1(_0xbffe41);});});} \ No newline at end of file +var _0xbdc6=['Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xbdc6,0x12e));var _0x6bdc=function(_0x15c8e1,_0x242c13){_0x15c8e1=_0x15c8e1-0x0;var _0x1af53b=_0xbdc6[_0x15c8e1];return _0x1af53b;};'use strict';var _=require(_0x6bdc('0x0'));var util=require(_0x6bdc('0x1'));var moment=require('moment');var BPromise=require(_0x6bdc('0x2'));var rs=require(_0x6bdc('0x3'));var fs=require('fs');var Redis=require(_0x6bdc('0x4'));var db=require(_0x6bdc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bdc('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6bdc('0x7'));var client=jayson[_0x6bdc('0x8')][_0x6bdc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1788a5,_0x468019,_0x29701d){return new BPromise(function(_0x1bb613,_0x14242d){return client[_0x6bdc('0xa')](_0x1788a5,_0x29701d)[_0x6bdc('0xb')](function(_0x5e4bac){logger[_0x6bdc('0xc')](_0x6bdc('0xd'),_0x468019,_0x6bdc('0xe'));logger[_0x6bdc('0xf')](_0x6bdc('0x10'),_0x468019,_0x6bdc('0xe'),JSON['stringify'](_0x5e4bac));if(_0x5e4bac[_0x6bdc('0x11')]){if(_0x5e4bac[_0x6bdc('0x11')][_0x6bdc('0x12')]===0x1f4){logger[_0x6bdc('0x11')](_0x6bdc('0xd'),_0x468019,_0x5e4bac[_0x6bdc('0x11')][_0x6bdc('0x13')]);return _0x14242d(_0x5e4bac['error'][_0x6bdc('0x13')]);}logger[_0x6bdc('0x11')](_0x6bdc('0xd'),_0x468019,_0x5e4bac['error'][_0x6bdc('0x13')]);return _0x1bb613(_0x5e4bac[_0x6bdc('0x11')][_0x6bdc('0x13')]);}else{logger[_0x6bdc('0xc')](_0x6bdc('0xd'),_0x468019,_0x6bdc('0xe'));_0x1bb613(_0x5e4bac[_0x6bdc('0x14')][_0x6bdc('0x13')]);}})['catch'](function(_0x46dd30){logger[_0x6bdc('0x11')](_0x6bdc('0xd'),_0x468019,_0x46dd30);_0x14242d(_0x46dd30);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index ac80777..917f7a8 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 _0xc3a9=['../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3f202c,_0xd9ff0){var _0x1af783=function(_0x23eed8){while(--_0x23eed8){_0x3f202c['push'](_0x3f202c['shift']());}};_0x1af783(++_0xd9ff0);}(_0xc3a9,0x1bc));var _0x9c3a=function(_0x1cfec5,_0x356b1f){_0x1cfec5=_0x1cfec5-0x0;var _0x4c3a45=_0xc3a9[_0x1cfec5];return _0x4c3a45;};'use strict';var multer=require(_0x9c3a('0x0'));var util=require(_0x9c3a('0x1'));var path=require('path');var timeout=require(_0x9c3a('0x2'));var express=require('express');var router=express[_0x9c3a('0x3')]();var fs_extra=require(_0x9c3a('0x4'));var auth=require(_0x9c3a('0x5'));var interaction=require(_0x9c3a('0x6'));var config=require(_0x9c3a('0x7'));var controller=require(_0x9c3a('0x8'));router[_0x9c3a('0x9')](_0x9c3a('0xa'),auth[_0x9c3a('0xb')](),controller[_0x9c3a('0xc')]);router[_0x9c3a('0xd')](_0x9c3a('0xa'),auth[_0x9c3a('0xb')](),controller[_0x9c3a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x3e5d=['isAuthenticated','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0x3e5d,0x1b6));var _0xd3e5=function(_0xc95745,_0xf8042f){_0xc95745=_0xc95745-0x0;var _0x33e16a=_0x3e5d[_0xc95745];return _0x33e16a;};'use strict';var multer=require('multer');var util=require(_0xd3e5('0x0'));var path=require(_0xd3e5('0x1'));var timeout=require(_0xd3e5('0x2'));var express=require(_0xd3e5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd3e5('0x4'));var interaction=require(_0xd3e5('0x5'));var config=require(_0xd3e5('0x6'));var controller=require(_0xd3e5('0x7'));router[_0xd3e5('0x8')](_0xd3e5('0x9'),auth[_0xd3e5('0xa')](),controller[_0xd3e5('0xb')]);router['delete']('/:id',auth[_0xd3e5('0xa')](),controller[_0xd3e5('0xc')]);module[_0xd3e5('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 6cca73b..00b14ea 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 _0xb10b=['name','sequelize','STRING'];(function(_0x4fc4e9,_0x416d5f){var _0x76f91a=function(_0x36d10a){while(--_0x36d10a){_0x4fc4e9['push'](_0x4fc4e9['shift']());}};_0x76f91a(++_0x416d5f);}(_0xb10b,0x12a));var _0xbb10=function(_0x59f5a6,_0x22e5fe){_0x59f5a6=_0x59f5a6-0x0;var _0x824ffa=_0xb10b[_0x59f5a6];return _0x824ffa;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x262654,_0xd3b17f){var _0x1eb12d=function(_0x18c1c1){while(--_0x18c1c1){_0x262654['push'](_0x262654['shift']());}};_0x1eb12d(++_0xd3b17f);}(_0x757a,0xde));var _0xa757=function(_0x1552ed,_0xb0f0eb){_0x1552ed=_0x1552ed-0x0;var _0x2c7de5=_0x757a[_0x1552ed];return _0x2c7de5;};'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 970f4eb..2141b83 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 _0xc8e1=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','end','status','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','params','length','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','order','pick','hasOwnProperty','rimraf','fast-json-patch','moment','bluebird','mustache','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'];(function(_0x3bae55,_0x50627c){var _0x478457=function(_0x5cf13e){while(--_0x5cf13e){_0x3bae55['push'](_0x3bae55['shift']());}};_0x478457(++_0x50627c);}(_0xc8e1,0x151));var _0x1c8e=function(_0x287006,_0x1142de){_0x287006=_0x287006-0x0;var _0x3e1a27=_0xc8e1[_0x287006];return _0x3e1a27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c8e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c8e('0x1'));var rp=require('request-promise');var moment=require(_0x1c8e('0x2'));var BPromise=require(_0x1c8e('0x3'));var Mustache=require(_0x1c8e('0x4'));var util=require('util');var path=require('path');var sox=require(_0x1c8e('0x5'));var csv=require(_0x1c8e('0x6'));var ejs=require(_0x1c8e('0x7'));var fs=require('fs');var fs_extra=require(_0x1c8e('0x8'));var _=require(_0x1c8e('0x9'));var squel=require(_0x1c8e('0xa'));var crypto=require(_0x1c8e('0xb'));var jsforce=require(_0x1c8e('0xc'));var deskjs=require(_0x1c8e('0xd'));var toCsv=require(_0x1c8e('0x6'));var querystring=require('querystring');var Papa=require(_0x1c8e('0xe'));var Redis=require(_0x1c8e('0xf'));var authService=require(_0x1c8e('0x10'));var qs=require(_0x1c8e('0x11'));var as=require(_0x1c8e('0x12'));var hardwareService=require(_0x1c8e('0x13'));var logger=require(_0x1c8e('0x14'))(_0x1c8e('0x15'));var utils=require(_0x1c8e('0x16'));var config=require(_0x1c8e('0x17'));var licenseUtil=require(_0x1c8e('0x18'));var db=require(_0x1c8e('0x19'))['db'];config['redis']=_['defaults'](config[_0x1c8e('0x1a')],{'host':_0x1c8e('0x1b'),'port':0x18eb});var socket=require(_0x1c8e('0x1c'))(new Redis(config[_0x1c8e('0x1a')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x32caef,_0x17e4f8){_0x17e4f8=_0x17e4f8||0xcc;return function(_0x5eb2ee){if(_0x5eb2ee){return _0x32caef[_0x1c8e('0x1d')](_0x17e4f8);}return _0x32caef['status'](_0x17e4f8)[_0x1c8e('0x1e')]();};}function respondWithResult(_0x335f17,_0x20dbc3){_0x20dbc3=_0x20dbc3||0xc8;return function(_0x2919a9){if(_0x2919a9){return _0x335f17[_0x1c8e('0x1f')](_0x20dbc3)[_0x1c8e('0x20')](_0x2919a9);}};}function respondWithFilteredResult(_0x4d7f85,_0x4479d7){return function(_0x2f2b1c){if(_0x2f2b1c){var _0x4ff1bd=typeof _0x4479d7['offset']===_0x1c8e('0x21')&&typeof _0x4479d7[_0x1c8e('0x22')]===_0x1c8e('0x21');var _0x18cdd7=_0x2f2b1c[_0x1c8e('0x23')];var _0x7a11b4=_0x4ff1bd?0x0:_0x4479d7['offset'];var _0x3ad03c=_0x4ff1bd?_0x2f2b1c[_0x1c8e('0x23')]:_0x4479d7[_0x1c8e('0x24')]+_0x4479d7['limit'];var _0x1e70db;if(_0x3ad03c>=_0x18cdd7){_0x3ad03c=_0x18cdd7;_0x1e70db=0xc8;}else{_0x1e70db=0xce;}_0x4d7f85[_0x1c8e('0x1f')](_0x1e70db);return _0x4d7f85[_0x1c8e('0x25')]('Content-Range',_0x7a11b4+'-'+_0x3ad03c+'/'+_0x18cdd7)[_0x1c8e('0x20')](_0x2f2b1c);}return null;};}function patchUpdates(_0x436560){return function(_0x11d5d7){try{jsonpatch['apply'](_0x11d5d7,_0x436560,!![]);}catch(_0x50177d){return BPromise[_0x1c8e('0x26')](_0x50177d);}return _0x11d5d7[_0x1c8e('0x27')]();};}function saveUpdates(_0x433200,_0x1dda85){return function(_0x13848f){if(_0x13848f){return _0x13848f[_0x1c8e('0x28')](_0x433200)[_0x1c8e('0x29')](function(_0x22f274){return _0x22f274;});}return null;};}function removeEntity(_0x543393,_0x46dba6){return function(_0xd00aa2){if(_0xd00aa2){return _0xd00aa2[_0x1c8e('0x2a')]()[_0x1c8e('0x29')](function(){var _0x157353=_0xd00aa2[_0x1c8e('0x2b')]({'plain':!![]});var _0x5cdbfc=_0x1c8e('0x2c');return db[_0x1c8e('0x2d')][_0x1c8e('0x2a')]({'where':{'type':_0x5cdbfc,'resourceId':_0x157353['id']}})[_0x1c8e('0x29')](function(){return _0xd00aa2;});})[_0x1c8e('0x29')](function(){_0x543393[_0x1c8e('0x1f')](0xcc)[_0x1c8e('0x1e')]();});}};}function handleEntityNotFound(_0x37ea0b,_0x1cdd62){return function(_0x396583){if(!_0x396583){_0x37ea0b['sendStatus'](0x194);}return _0x396583;};}function handleError(_0x376e99,_0x297838){_0x297838=_0x297838||0x1f4;return function(_0x4909fe){logger[_0x1c8e('0x2e')](_0x4909fe[_0x1c8e('0x2f')]);if(_0x4909fe['name']){delete _0x4909fe[_0x1c8e('0x30')];}_0x376e99[_0x1c8e('0x1f')](_0x297838)['send'](_0x4909fe);};}exports[_0x1c8e('0x31')]=function(_0x111342,_0xb30ea1){var _0x1ba6cd={},_0x43f275={},_0x30cb61={'count':0x0,'rows':[]};var _0x65f081=_[_0x1c8e('0x32')](db[_0x1c8e('0x33')][_0x1c8e('0x34')],function(_0x477e12){return{'name':_0x477e12[_0x1c8e('0x35')],'type':_0x477e12[_0x1c8e('0x36')][_0x1c8e('0x37')]};});_0x43f275[_0x1c8e('0x38')]=_[_0x1c8e('0x32')](_0x65f081,'name');_0x43f275[_0x1c8e('0x39')]=_[_0x1c8e('0x3a')](_0x111342[_0x1c8e('0x39')]);_0x43f275[_0x1c8e('0x3b')]=_[_0x1c8e('0x3c')](_0x43f275[_0x1c8e('0x38')],_0x43f275[_0x1c8e('0x39')]);_0x1ba6cd[_0x1c8e('0x3d')]=_['intersection'](_0x43f275[_0x1c8e('0x38')],qs[_0x1c8e('0x3e')](_0x111342[_0x1c8e('0x39')]['fields']));_0x1ba6cd[_0x1c8e('0x3d')]=_0x1ba6cd['attributes']['length']?_0x1ba6cd[_0x1c8e('0x3d')]:_0x43f275[_0x1c8e('0x38')];if(!_0x111342[_0x1c8e('0x39')]['hasOwnProperty'](_0x1c8e('0x3f'))){_0x1ba6cd[_0x1c8e('0x22')]=qs['limit'](_0x111342[_0x1c8e('0x39')][_0x1c8e('0x22')]);_0x1ba6cd[_0x1c8e('0x24')]=qs[_0x1c8e('0x24')](_0x111342['query'][_0x1c8e('0x24')]);}_0x1ba6cd['order']=qs[_0x1c8e('0x40')](_0x111342['query']['sort']);_0x1ba6cd[_0x1c8e('0x41')]=qs[_0x1c8e('0x3b')](_['pick'](_0x111342[_0x1c8e('0x39')],_0x43f275[_0x1c8e('0x3b')]),_0x65f081);if(_0x111342['query'][_0x1c8e('0x42')]){_0x1ba6cd[_0x1c8e('0x41')]=_['merge'](_0x1ba6cd[_0x1c8e('0x41')],{'$or':_[_0x1c8e('0x32')](_0x65f081,function(_0x321839){if(_0x321839[_0x1c8e('0x36')]!==_0x1c8e('0x43')){var _0x6ec22e={};_0x6ec22e[_0x321839[_0x1c8e('0x30')]]={'$like':'%'+_0x111342[_0x1c8e('0x39')][_0x1c8e('0x42')]+'%'};return _0x6ec22e;}})});}_0x1ba6cd=_[_0x1c8e('0x44')]({},_0x1ba6cd,_0x111342['options']);var _0x256127={'where':_0x1ba6cd['where']};return db[_0x1c8e('0x33')][_0x1c8e('0x23')](_0x256127)[_0x1c8e('0x29')](function(_0x3cfc2d){_0x30cb61[_0x1c8e('0x23')]=_0x3cfc2d;if(_0x111342[_0x1c8e('0x39')][_0x1c8e('0x45')]){_0x1ba6cd[_0x1c8e('0x46')]=[{'all':!![]}];}return db[_0x1c8e('0x33')][_0x1c8e('0x47')](_0x1ba6cd);})[_0x1c8e('0x29')](function(_0x4c82a7){_0x30cb61['rows']=_0x4c82a7;return _0x30cb61;})[_0x1c8e('0x29')](respondWithFilteredResult(_0xb30ea1,_0x1ba6cd))['catch'](handleError(_0xb30ea1,null));};exports['show']=function(_0x290609,_0x36f9d5){var _0xa057c9={'raw':![],'where':{'id':_0x290609[_0x1c8e('0x48')]['id']}},_0x448c7f={};_0x448c7f[_0x1c8e('0x38')]=_[_0x1c8e('0x3a')](db[_0x1c8e('0x33')][_0x1c8e('0x34')]);_0x448c7f[_0x1c8e('0x39')]=_[_0x1c8e('0x3a')](_0x290609[_0x1c8e('0x39')]);_0x448c7f[_0x1c8e('0x3b')]=_[_0x1c8e('0x3c')](_0x448c7f[_0x1c8e('0x38')],_0x448c7f[_0x1c8e('0x39')]);_0xa057c9['attributes']=_['intersection'](_0x448c7f[_0x1c8e('0x38')],qs[_0x1c8e('0x3e')](_0x290609[_0x1c8e('0x39')][_0x1c8e('0x3e')]));_0xa057c9[_0x1c8e('0x3d')]=_0xa057c9[_0x1c8e('0x3d')][_0x1c8e('0x49')]?_0xa057c9[_0x1c8e('0x3d')]:_0x448c7f['model'];if(_0x290609[_0x1c8e('0x39')][_0x1c8e('0x45')]){_0xa057c9['include']=[{'all':!![]}];}_0xa057c9=_[_0x1c8e('0x44')]({},_0xa057c9,_0x290609[_0x1c8e('0x4a')]);return db[_0x1c8e('0x33')][_0x1c8e('0x4b')](_0xa057c9)[_0x1c8e('0x29')](handleEntityNotFound(_0x36f9d5,null))[_0x1c8e('0x29')](respondWithResult(_0x36f9d5,null))[_0x1c8e('0x4c')](handleError(_0x36f9d5,null));};exports[_0x1c8e('0x4d')]=function(_0x15cf26,_0x55c0b2){return db[_0x1c8e('0x33')][_0x1c8e('0x4d')](_0x15cf26[_0x1c8e('0x4e')],{})[_0x1c8e('0x29')](function(_0x50c174){var _0x25b8f1=_0x15cf26[_0x1c8e('0x4f')][_0x1c8e('0x2b')]({'plain':!![]});if(!_0x25b8f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25b8f1[_0x1c8e('0x50')]==='user'){var _0x24ef2e=_0x50c174[_0x1c8e('0x2b')]({'plain':!![]});var _0x383212='CustomDashboards';return db[_0x1c8e('0x51')][_0x1c8e('0x4b')]({'where':{'name':_0x383212,'userProfileId':_0x25b8f1[_0x1c8e('0x52')]},'raw':!![]})[_0x1c8e('0x29')](function(_0x3381c6){if(_0x3381c6&&_0x3381c6[_0x1c8e('0x53')]===0x0){return db[_0x1c8e('0x2d')][_0x1c8e('0x4d')]({'name':_0x24ef2e['name'],'resourceId':_0x24ef2e['id'],'type':_0x3381c6[_0x1c8e('0x30')],'sectionId':_0x3381c6['id']},{})[_0x1c8e('0x29')](function(){return _0x50c174;});}else{return _0x50c174;}})[_0x1c8e('0x4c')](function(_0x34ac37){logger[_0x1c8e('0x2e')](_0x1c8e('0x54'),_0x34ac37);throw _0x34ac37;});}return _0x50c174;})[_0x1c8e('0x29')](respondWithResult(_0x55c0b2,0xc9))[_0x1c8e('0x4c')](handleError(_0x55c0b2,null));};exports[_0x1c8e('0x55')]=function(_0x36422e,_0xb7f372){var _0x1eea8c={'where':{'id':_0x36422e['params']['id']}},_0x36778b={};_0x36778b[_0x1c8e('0x38')]=_['keys'](db[_0x1c8e('0x33')]['rawAttributes']);_0x1eea8c[_0x1c8e('0x3d')]=_['intersection'](_0x36778b['model'],qs['fields'](_0x36422e['query'][_0x1c8e('0x3e')]));_0x1eea8c[_0x1c8e('0x3d')]=_0x1eea8c[_0x1c8e('0x3d')][_0x1c8e('0x49')]?_0x1eea8c['attributes']:_0x36778b[_0x1c8e('0x38')];if(_0x36422e['query'][_0x1c8e('0x45')]){_0x1eea8c[_0x1c8e('0x46')]=[{'all':!![]}];}_0x1eea8c=_[_0x1c8e('0x44')]({},_0x1eea8c,_0x36422e[_0x1c8e('0x4a')]);return db[_0x1c8e('0x33')]['find'](_0x1eea8c)[_0x1c8e('0x29')](handleEntityNotFound(_0xb7f372,null))['then'](function(_0x2194b4){if(_0x2194b4){var _0x651aba=_0x2194b4[_0x1c8e('0x2b')]({'plain':!![]});_0x651aba=qs['omit'](_0x651aba,['id',_0x1c8e('0x56'),'updatedAt']);_0x36422e[_0x1c8e('0x4e')]=_[_0x1c8e('0x57')](_0x36422e[_0x1c8e('0x4e')],['id','createdAt','updatedAt']);return db[_0x1c8e('0x33')][_0x1c8e('0x4d')](_[_0x1c8e('0x44')](_0x651aba,_0x36422e[_0x1c8e('0x4e')]),{'include':_0x36422e[_0x1c8e('0x39')][_0x1c8e('0x45')]?[{'all':!![]}]:undefined})[_0x1c8e('0x29')](function(_0x34cd4a){var _0x45db56=_0x36422e[_0x1c8e('0x4f')][_0x1c8e('0x2b')]({'plain':!![]});if(!_0x45db56)throw new Error(_0x1c8e('0x58'));if(_0x45db56['role']===_0x1c8e('0x4f')){var _0x780943=_0x34cd4a[_0x1c8e('0x2b')]({'plain':!![]});var _0x1bf31c='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x1bf31c,'userProfileId':_0x45db56[_0x1c8e('0x52')]},'raw':!![]})[_0x1c8e('0x29')](function(_0x588c1f){if(_0x588c1f&&_0x588c1f[_0x1c8e('0x53')]===0x0){return db[_0x1c8e('0x2d')][_0x1c8e('0x4d')]({'name':_0x780943[_0x1c8e('0x30')],'resourceId':_0x780943['id'],'type':_0x588c1f[_0x1c8e('0x30')],'sectionId':_0x588c1f['id']},{})['then'](function(){return _0x34cd4a;});}else{return _0x34cd4a;}})[_0x1c8e('0x4c')](function(_0x107715){logger['error'](_0x1c8e('0x54'),_0x107715);throw _0x107715;});}return _0x34cd4a;});}})[_0x1c8e('0x29')](respondWithResult(_0xb7f372,0xc9))[_0x1c8e('0x4c')](handleError(_0xb7f372,null));};exports[_0x1c8e('0x28')]=function(_0x3f7e4d,_0xc556d1){if(_0x3f7e4d[_0x1c8e('0x4e')]['id']){delete _0x3f7e4d['body']['id'];}return db['Dashboard'][_0x1c8e('0x4b')]({'where':{'id':_0x3f7e4d[_0x1c8e('0x48')]['id']}})[_0x1c8e('0x29')](handleEntityNotFound(_0xc556d1,null))[_0x1c8e('0x29')](saveUpdates(_0x3f7e4d[_0x1c8e('0x4e')],null))[_0x1c8e('0x29')](respondWithResult(_0xc556d1,null))[_0x1c8e('0x4c')](handleError(_0xc556d1,null));};exports[_0x1c8e('0x2a')]=function(_0xae39f6,_0x20e69f){return db[_0x1c8e('0x33')][_0x1c8e('0x4b')]({'where':{'id':_0xae39f6['params']['id']}})[_0x1c8e('0x29')](handleEntityNotFound(_0x20e69f,null))[_0x1c8e('0x29')](removeEntity(_0x20e69f,null))[_0x1c8e('0x4c')](handleError(_0x20e69f,null));};function widgetAttributes(_0x5f5359){try{switch(_0x5f5359['type']){case _0x1c8e('0x59'):return[{'name':_0x1c8e('0x5a'),'value':_0x5f5359['attrUrl']||(_0x5f5359[_0x1c8e('0x5b')]&&_0x5f5359[_0x1c8e('0x5b')][0x0]?_0x5f5359[_0x1c8e('0x5b')][0x0][_0x1c8e('0x5c')]:undefined)||_0x1c8e('0x5d')}];case _0x1c8e('0x5e'):return[{'name':_0x1c8e('0x5f'),'value':_0x5f5359[_0x1c8e('0x5f')]||(_0x5f5359['attrs']&&_0x5f5359[_0x1c8e('0x5b')][0x0]?_0x5f5359['attrs'][0x0][_0x1c8e('0x5c')]:undefined)||''}];case'clock':return[{'name':_0x1c8e('0x60'),'value':_0x5f5359[_0x1c8e('0x60')]||(_0x5f5359[_0x1c8e('0x5b')]&&_0x5f5359[_0x1c8e('0x5b')][0x0]?_0x5f5359[_0x1c8e('0x5b')][0x0][_0x1c8e('0x5c')]:undefined)||'HH:mm:ss'},{'name':_0x1c8e('0x61'),'value':_0x5f5359[_0x1c8e('0x61')]||(_0x5f5359[_0x1c8e('0x5b')]&&_0x5f5359[_0x1c8e('0x5b')][0x1]?_0x5f5359['attrs'][0x1]['value']:undefined)||_0x1c8e('0x62')},{'name':'attrFontSize','value':_0x5f5359[_0x1c8e('0x63')]||(_0x5f5359[_0x1c8e('0x5b')]&&_0x5f5359[_0x1c8e('0x5b')][0x2]?_0x5f5359[_0x1c8e('0x5b')][0x2][_0x1c8e('0x5c')]:undefined)||0xc}];case'counter':return[{'name':_0x1c8e('0x64'),'value':_0x5f5359['attrMetric']||(_0x5f5359[_0x1c8e('0x5b')]&&_0x5f5359[_0x1c8e('0x5b')][0x0]?_0x5f5359[_0x1c8e('0x5b')][0x0][_0x1c8e('0x5c')]:undefined)||_0x1c8e('0x65')},{'name':_0x1c8e('0x66'),'value':_0x5f5359[_0x1c8e('0x66')]||(_0x5f5359[_0x1c8e('0x5b')]&&_0x5f5359[_0x1c8e('0x5b')][0x1]?_0x5f5359[_0x1c8e('0x5b')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x5f5359[_0x1c8e('0x63')]||(_0x5f5359['attrs']&&_0x5f5359[_0x1c8e('0x5b')][0x2]?_0x5f5359[_0x1c8e('0x5b')][0x2]['value']:undefined)||0x14}];case _0x1c8e('0x67'):case _0x1c8e('0x68'):return[{'name':_0x1c8e('0x69'),'value':_0x5f5359[_0x1c8e('0x69')]||(_0x5f5359[_0x1c8e('0x5b')]&&_0x5f5359[_0x1c8e('0x5b')][0x0]?_0x5f5359[_0x1c8e('0x5b')][0x0][_0x1c8e('0x5c')]:undefined)||_0x1c8e('0x65')},{'name':_0x1c8e('0x6a'),'value':_0x5f5359[_0x1c8e('0x6a')]||(_0x5f5359[_0x1c8e('0x5b')]&&_0x5f5359['attrs'][0x1]?_0x5f5359[_0x1c8e('0x5b')][0x1][_0x1c8e('0x5c')]:undefined)||null},{'name':_0x1c8e('0x6b'),'value':_0x5f5359['attrSerie3']||(_0x5f5359[_0x1c8e('0x5b')]&&_0x5f5359[_0x1c8e('0x5b')][0x2]?_0x5f5359['attrs'][0x2][_0x1c8e('0x5c')]:undefined)||null},{'name':_0x1c8e('0x66'),'value':_0x5f5359[_0x1c8e('0x66')]||(_0x5f5359[_0x1c8e('0x5b')]&&_0x5f5359[_0x1c8e('0x5b')][0x3]?_0x5f5359[_0x1c8e('0x5b')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0x1c8e('0x6c'),'type':_0x5f5359[_0x1c8e('0x6d')]||(_0x5f5359[_0x1c8e('0x5b')]&&_0x5f5359[_0x1c8e('0x5b')][0x0]?_0x5f5359[_0x1c8e('0x5b')][0x0][_0x1c8e('0x36')]:undefined)||null,'value':_0x5f5359[_0x1c8e('0x6c')]||(_0x5f5359[_0x1c8e('0x5b')]&&_0x5f5359[_0x1c8e('0x5b')][0x0]?_0x5f5359[_0x1c8e('0x5b')][0x0][_0x1c8e('0x5c')]:undefined)||null},{'name':'attrRefresh','value':_0x5f5359['attrRefresh']||(_0x5f5359[_0x1c8e('0x5b')]&&_0x5f5359['attrs'][0x1]?_0x5f5359[_0x1c8e('0x5b')][0x1][_0x1c8e('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x37d61a){logger['error']('widgetAttributes:\x20%s',JSON[_0x1c8e('0x6e')](_0x37d61a));return[];}}exports[_0x1c8e('0x6f')]=function(_0xb30498,_0x4857b5,_0x566eca){if(_0xb30498[_0x1c8e('0x4e')]['id']){delete _0xb30498[_0x1c8e('0x4e')]['id'];}return db['Dashboard']['find']({'where':{'id':_0xb30498['params']['id']}})['then'](handleEntityNotFound(_0x4857b5,null))[_0x1c8e('0x29')](function(_0x696b97){if(_0x696b97){_0xb30498['body'][_0x1c8e('0x70')]=_0x696b97['id'];_0xb30498[_0x1c8e('0x4e')][_0x1c8e('0x5b')]=widgetAttributes(_0xb30498[_0x1c8e('0x4e')]);return db[_0x1c8e('0x71')][_0x1c8e('0x4d')](_0xb30498[_0x1c8e('0x4e')]);}})[_0x1c8e('0x29')](respondWithResult(_0x4857b5,null))[_0x1c8e('0x4c')](handleError(_0x4857b5,null));};exports[_0x1c8e('0x72')]=function(_0xc61787,_0x26dd52,_0xc667d9){var _0x6ed442={};var _0x13f5dc={};var _0x504171;var _0x3670c2;return db['Dashboard'][_0x1c8e('0x73')]({'where':{'id':_0xc61787[_0x1c8e('0x48')]['id']}})[_0x1c8e('0x29')](handleEntityNotFound(_0x26dd52,null))[_0x1c8e('0x29')](function(_0x1e8d99){if(_0x1e8d99){_0x504171=_0x1e8d99;_0x13f5dc[_0x1c8e('0x38')]=_['keys'](db[_0x1c8e('0x71')][_0x1c8e('0x34')]);_0x13f5dc[_0x1c8e('0x39')]=_[_0x1c8e('0x3a')](_0xc61787[_0x1c8e('0x39')]);_0x13f5dc[_0x1c8e('0x3b')]=_[_0x1c8e('0x3c')](_0x13f5dc[_0x1c8e('0x38')],_0x13f5dc[_0x1c8e('0x39')]);_0x6ed442[_0x1c8e('0x3d')]=_['intersection'](_0x13f5dc[_0x1c8e('0x38')],qs[_0x1c8e('0x3e')](_0xc61787[_0x1c8e('0x39')][_0x1c8e('0x3e')]));_0x6ed442['attributes']=_0x6ed442[_0x1c8e('0x3d')][_0x1c8e('0x49')]?_0x6ed442[_0x1c8e('0x3d')]:_0x13f5dc['model'];_0x6ed442[_0x1c8e('0x74')]=qs['sort'](_0xc61787[_0x1c8e('0x39')][_0x1c8e('0x40')]);_0x6ed442[_0x1c8e('0x41')]=qs['filters'](_[_0x1c8e('0x75')](_0xc61787[_0x1c8e('0x39')],_0x13f5dc[_0x1c8e('0x3b')]));if(_0xc61787['query']['filter']){_0x6ed442[_0x1c8e('0x41')]=_['merge'](_0x6ed442[_0x1c8e('0x41')],{'$or':_[_0x1c8e('0x32')](_0x6ed442[_0x1c8e('0x3d')],function(_0x2dbabc){var _0x3a8a37={};_0x3a8a37[_0x2dbabc]={'$like':'%'+_0xc61787[_0x1c8e('0x39')]['filter']+'%'};return _0x3a8a37;})});}_0x6ed442=_[_0x1c8e('0x44')]({},_0x6ed442,_0xc61787[_0x1c8e('0x4a')]);return _0x504171[_0x1c8e('0x72')](_0x6ed442);}})['then'](function(_0x18d289){if(_0x18d289){_0x3670c2=_0x18d289[_0x1c8e('0x49')];if(!_0xc61787[_0x1c8e('0x39')][_0x1c8e('0x76')](_0x1c8e('0x3f'))){_0x6ed442[_0x1c8e('0x22')]=qs['limit'](_0xc61787[_0x1c8e('0x39')][_0x1c8e('0x22')]);_0x6ed442['offset']=qs[_0x1c8e('0x24')](_0xc61787[_0x1c8e('0x39')][_0x1c8e('0x24')]);}return _0x504171[_0x1c8e('0x72')](_0x6ed442);}})['then'](function(_0x134945){if(_0x134945){return _0x134945?{'count':_0x3670c2,'rows':_0x134945}:null;}})[_0x1c8e('0x29')](respondWithResult(_0x26dd52,null))['catch'](handleError(_0x26dd52,null));}; \ No newline at end of file +var _0x0087=['rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','pick','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','./dashboard.socket','register','sendStatus','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','stack','name','status','send','index','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','type','options','include','Dashboard','findAll'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x0087,0xab));var _0x7008=function(_0x335c74,_0x550e56){_0x335c74=_0x335c74-0x0;var _0x1a45cc=_0x0087[_0x335c74];return _0x1a45cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7008('0x0'));var zipdir=require(_0x7008('0x1'));var jsonpatch=require(_0x7008('0x2'));var rp=require('request-promise');var moment=require(_0x7008('0x3'));var BPromise=require(_0x7008('0x4'));var Mustache=require(_0x7008('0x5'));var util=require('util');var path=require(_0x7008('0x6'));var sox=require(_0x7008('0x7'));var csv=require('to-csv');var ejs=require(_0x7008('0x8'));var fs=require('fs');var fs_extra=require(_0x7008('0x9'));var _=require(_0x7008('0xa'));var squel=require(_0x7008('0xb'));var crypto=require(_0x7008('0xc'));var jsforce=require(_0x7008('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7008('0xe'));var querystring=require(_0x7008('0xf'));var Papa=require(_0x7008('0x10'));var Redis=require(_0x7008('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7008('0x12'));var as=require(_0x7008('0x13'));var hardwareService=require(_0x7008('0x14'));var logger=require('../../config/logger')(_0x7008('0x15'));var utils=require('../../config/utils');var config=require(_0x7008('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7008('0x17')]=_[_0x7008('0x18')](config[_0x7008('0x17')],{'host':_0x7008('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7008('0x17')]));require(_0x7008('0x1a'))[_0x7008('0x1b')](socket);function respondWithStatusCode(_0x38dcfa,_0x6ab4d4){_0x6ab4d4=_0x6ab4d4||0xcc;return function(_0x14a883){if(_0x14a883){return _0x38dcfa[_0x7008('0x1c')](_0x6ab4d4);}return _0x38dcfa['status'](_0x6ab4d4)[_0x7008('0x1d')]();};}function respondWithResult(_0x477166,_0x4eee97){_0x4eee97=_0x4eee97||0xc8;return function(_0x2efcbc){if(_0x2efcbc){return _0x477166['status'](_0x4eee97)[_0x7008('0x1e')](_0x2efcbc);}};}function respondWithFilteredResult(_0x45b30f,_0x5ad42e){return function(_0x381d93){if(_0x381d93){var _0x15a020=typeof _0x5ad42e[_0x7008('0x1f')]===_0x7008('0x20')&&typeof _0x5ad42e['limit']===_0x7008('0x20');var _0x15906a=_0x381d93[_0x7008('0x21')];var _0x37d3db=_0x15a020?0x0:_0x5ad42e[_0x7008('0x1f')];var _0x3d887f=_0x15a020?_0x381d93[_0x7008('0x21')]:_0x5ad42e[_0x7008('0x1f')]+_0x5ad42e[_0x7008('0x22')];var _0x5dec9c;if(_0x3d887f>=_0x15906a){_0x3d887f=_0x15906a;_0x5dec9c=0xc8;}else{_0x5dec9c=0xce;}_0x45b30f['status'](_0x5dec9c);return _0x45b30f['set'](_0x7008('0x23'),_0x37d3db+'-'+_0x3d887f+'/'+_0x15906a)[_0x7008('0x1e')](_0x381d93);}return null;};}function patchUpdates(_0x16cd6b){return function(_0xad85ff){try{jsonpatch[_0x7008('0x24')](_0xad85ff,_0x16cd6b,!![]);}catch(_0x3969be){return BPromise['reject'](_0x3969be);}return _0xad85ff[_0x7008('0x25')]();};}function saveUpdates(_0x2591d,_0xa66197){return function(_0x5ea934){if(_0x5ea934){return _0x5ea934[_0x7008('0x26')](_0x2591d)[_0x7008('0x27')](function(_0x1fcf3d){return _0x1fcf3d;});}return null;};}function removeEntity(_0x3bc561,_0x692a54){return function(_0x39a9fe){if(_0x39a9fe){return _0x39a9fe[_0x7008('0x28')]()[_0x7008('0x27')](function(){var _0x1aa86c=_0x39a9fe['get']({'plain':!![]});var _0x5d62a5='CustomDashboards';return db[_0x7008('0x29')][_0x7008('0x28')]({'where':{'type':_0x5d62a5,'resourceId':_0x1aa86c['id']}})[_0x7008('0x27')](function(){return _0x39a9fe;});})['then'](function(){_0x3bc561['status'](0xcc)[_0x7008('0x1d')]();});}};}function handleEntityNotFound(_0x50b6c7,_0x50a624){return function(_0x5e2f56){if(!_0x5e2f56){_0x50b6c7[_0x7008('0x1c')](0x194);}return _0x5e2f56;};}function handleError(_0x3e89c9,_0x12cff4){_0x12cff4=_0x12cff4||0x1f4;return function(_0x426d97){logger[_0x7008('0x2a')](_0x426d97[_0x7008('0x2b')]);if(_0x426d97[_0x7008('0x2c')]){delete _0x426d97[_0x7008('0x2c')];}_0x3e89c9[_0x7008('0x2d')](_0x12cff4)[_0x7008('0x2e')](_0x426d97);};}exports[_0x7008('0x2f')]=function(_0x286265,_0x3275e7){var _0x17d250={},_0x3cff03={},_0x539ffc={'count':0x0,'rows':[]};var _0x26114c=_['map'](db['Dashboard'][_0x7008('0x30')],function(_0x47d7f8){return{'name':_0x47d7f8[_0x7008('0x31')],'type':_0x47d7f8['type'][_0x7008('0x32')]};});_0x3cff03['model']=_['map'](_0x26114c,'name');_0x3cff03[_0x7008('0x33')]=_[_0x7008('0x34')](_0x286265[_0x7008('0x33')]);_0x3cff03['filters']=_[_0x7008('0x35')](_0x3cff03[_0x7008('0x36')],_0x3cff03['query']);_0x17d250[_0x7008('0x37')]=_[_0x7008('0x35')](_0x3cff03[_0x7008('0x36')],qs[_0x7008('0x38')](_0x286265[_0x7008('0x33')][_0x7008('0x38')]));_0x17d250['attributes']=_0x17d250['attributes']['length']?_0x17d250[_0x7008('0x37')]:_0x3cff03['model'];if(!_0x286265[_0x7008('0x33')][_0x7008('0x39')](_0x7008('0x3a'))){_0x17d250['limit']=qs['limit'](_0x286265[_0x7008('0x33')]['limit']);_0x17d250['offset']=qs[_0x7008('0x1f')](_0x286265['query'][_0x7008('0x1f')]);}_0x17d250[_0x7008('0x3b')]=qs[_0x7008('0x3c')](_0x286265['query']['sort']);_0x17d250[_0x7008('0x3d')]=qs[_0x7008('0x3e')](_['pick'](_0x286265[_0x7008('0x33')],_0x3cff03[_0x7008('0x3e')]),_0x26114c);if(_0x286265[_0x7008('0x33')][_0x7008('0x3f')]){_0x17d250[_0x7008('0x3d')]=_[_0x7008('0x40')](_0x17d250['where'],{'$or':_[_0x7008('0x41')](_0x26114c,function(_0xa148e0){if(_0xa148e0[_0x7008('0x42')]!=='VIRTUAL'){var _0x454eaa={};_0x454eaa[_0xa148e0['name']]={'$like':'%'+_0x286265[_0x7008('0x33')][_0x7008('0x3f')]+'%'};return _0x454eaa;}})});}_0x17d250=_[_0x7008('0x40')]({},_0x17d250,_0x286265[_0x7008('0x43')]);var _0x1a073a={'where':_0x17d250[_0x7008('0x3d')]};return db['Dashboard'][_0x7008('0x21')](_0x1a073a)[_0x7008('0x27')](function(_0x561847){_0x539ffc[_0x7008('0x21')]=_0x561847;if(_0x286265['query']['includeAll']){_0x17d250[_0x7008('0x44')]=[{'all':!![]}];}return db[_0x7008('0x45')][_0x7008('0x46')](_0x17d250);})[_0x7008('0x27')](function(_0x371233){_0x539ffc[_0x7008('0x47')]=_0x371233;return _0x539ffc;})[_0x7008('0x27')](respondWithFilteredResult(_0x3275e7,_0x17d250))[_0x7008('0x48')](handleError(_0x3275e7,null));};exports[_0x7008('0x49')]=function(_0x4bb1f9,_0x33e6dc){var _0x3b2de1={'raw':![],'where':{'id':_0x4bb1f9[_0x7008('0x4a')]['id']}},_0x213efc={};_0x213efc['model']=_['keys'](db[_0x7008('0x45')][_0x7008('0x30')]);_0x213efc[_0x7008('0x33')]=_[_0x7008('0x34')](_0x4bb1f9['query']);_0x213efc[_0x7008('0x3e')]=_[_0x7008('0x35')](_0x213efc['model'],_0x213efc[_0x7008('0x33')]);_0x3b2de1[_0x7008('0x37')]=_['intersection'](_0x213efc[_0x7008('0x36')],qs[_0x7008('0x38')](_0x4bb1f9[_0x7008('0x33')]['fields']));_0x3b2de1[_0x7008('0x37')]=_0x3b2de1['attributes'][_0x7008('0x4b')]?_0x3b2de1['attributes']:_0x213efc[_0x7008('0x36')];if(_0x4bb1f9[_0x7008('0x33')]['includeAll']){_0x3b2de1[_0x7008('0x44')]=[{'all':!![]}];}_0x3b2de1=_[_0x7008('0x40')]({},_0x3b2de1,_0x4bb1f9[_0x7008('0x43')]);return db['Dashboard'][_0x7008('0x4c')](_0x3b2de1)[_0x7008('0x27')](handleEntityNotFound(_0x33e6dc,null))['then'](respondWithResult(_0x33e6dc,null))[_0x7008('0x48')](handleError(_0x33e6dc,null));};exports[_0x7008('0x4d')]=function(_0x4ecf61,_0xf49ac7){return db[_0x7008('0x45')][_0x7008('0x4d')](_0x4ecf61[_0x7008('0x4e')],{})[_0x7008('0x27')](function(_0xc6d80f){var _0x314b7b=_0x4ecf61[_0x7008('0x4f')][_0x7008('0x50')]({'plain':!![]});if(!_0x314b7b)throw new Error(_0x7008('0x51'));if(_0x314b7b[_0x7008('0x52')]===_0x7008('0x4f')){var _0xbee88b=_0xc6d80f[_0x7008('0x50')]({'plain':!![]});var _0x53e561=_0x7008('0x53');return db[_0x7008('0x54')][_0x7008('0x4c')]({'where':{'name':_0x53e561,'userProfileId':_0x314b7b[_0x7008('0x55')]},'raw':!![]})[_0x7008('0x27')](function(_0x2087f3){if(_0x2087f3&&_0x2087f3[_0x7008('0x56')]===0x0){return db[_0x7008('0x29')]['create']({'name':_0xbee88b[_0x7008('0x2c')],'resourceId':_0xbee88b['id'],'type':_0x2087f3[_0x7008('0x2c')],'sectionId':_0x2087f3['id']},{})[_0x7008('0x27')](function(){return _0xc6d80f;});}else{return _0xc6d80f;}})[_0x7008('0x48')](function(_0x533316){logger['error'](_0x7008('0x57'),_0x533316);throw _0x533316;});}return _0xc6d80f;})['then'](respondWithResult(_0xf49ac7,0xc9))[_0x7008('0x48')](handleError(_0xf49ac7,null));};exports['clone']=function(_0xc14110,_0x14d097){var _0x1934fd={'where':{'id':_0xc14110[_0x7008('0x4a')]['id']}},_0x39e971={};_0x39e971['model']=_['keys'](db[_0x7008('0x45')][_0x7008('0x30')]);_0x1934fd['attributes']=_['intersection'](_0x39e971[_0x7008('0x36')],qs[_0x7008('0x38')](_0xc14110[_0x7008('0x33')][_0x7008('0x38')]));_0x1934fd[_0x7008('0x37')]=_0x1934fd[_0x7008('0x37')]['length']?_0x1934fd['attributes']:_0x39e971[_0x7008('0x36')];if(_0xc14110[_0x7008('0x33')]['includeAll']){_0x1934fd[_0x7008('0x44')]=[{'all':!![]}];}_0x1934fd=_[_0x7008('0x40')]({},_0x1934fd,_0xc14110['options']);return db[_0x7008('0x45')]['find'](_0x1934fd)[_0x7008('0x27')](handleEntityNotFound(_0x14d097,null))[_0x7008('0x27')](function(_0x5f2350){if(_0x5f2350){var _0x42822e=_0x5f2350[_0x7008('0x50')]({'plain':!![]});_0x42822e=qs[_0x7008('0x58')](_0x42822e,['id',_0x7008('0x59'),'updatedAt']);_0xc14110['body']=_[_0x7008('0x58')](_0xc14110['body'],['id',_0x7008('0x59'),_0x7008('0x5a')]);return db[_0x7008('0x45')][_0x7008('0x4d')](_[_0x7008('0x40')](_0x42822e,_0xc14110[_0x7008('0x4e')]),{'include':_0xc14110[_0x7008('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0x7008('0x27')](function(_0x52ae8f){var _0x54467a=_0xc14110[_0x7008('0x4f')][_0x7008('0x50')]({'plain':!![]});if(!_0x54467a)throw new Error(_0x7008('0x51'));if(_0x54467a[_0x7008('0x52')]===_0x7008('0x4f')){var _0x25b2d4=_0x52ae8f[_0x7008('0x50')]({'plain':!![]});var _0x2e5533='CustomDashboards';return db[_0x7008('0x54')][_0x7008('0x4c')]({'where':{'name':_0x2e5533,'userProfileId':_0x54467a['userProfileId']},'raw':!![]})[_0x7008('0x27')](function(_0x5b5f3a){if(_0x5b5f3a&&_0x5b5f3a[_0x7008('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x25b2d4[_0x7008('0x2c')],'resourceId':_0x25b2d4['id'],'type':_0x5b5f3a['name'],'sectionId':_0x5b5f3a['id']},{})['then'](function(){return _0x52ae8f;});}else{return _0x52ae8f;}})[_0x7008('0x48')](function(_0x577365){logger[_0x7008('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x577365);throw _0x577365;});}return _0x52ae8f;});}})[_0x7008('0x27')](respondWithResult(_0x14d097,0xc9))[_0x7008('0x48')](handleError(_0x14d097,null));};exports[_0x7008('0x26')]=function(_0x55e1e4,_0x522b6e){if(_0x55e1e4[_0x7008('0x4e')]['id']){delete _0x55e1e4[_0x7008('0x4e')]['id'];}return db['Dashboard'][_0x7008('0x4c')]({'where':{'id':_0x55e1e4[_0x7008('0x4a')]['id']}})[_0x7008('0x27')](handleEntityNotFound(_0x522b6e,null))[_0x7008('0x27')](saveUpdates(_0x55e1e4[_0x7008('0x4e')],null))[_0x7008('0x27')](respondWithResult(_0x522b6e,null))[_0x7008('0x48')](handleError(_0x522b6e,null));};exports[_0x7008('0x28')]=function(_0x189e0b,_0x5ef61a){return db[_0x7008('0x45')][_0x7008('0x4c')]({'where':{'id':_0x189e0b[_0x7008('0x4a')]['id']}})[_0x7008('0x27')](handleEntityNotFound(_0x5ef61a,null))[_0x7008('0x27')](removeEntity(_0x5ef61a,null))['catch'](handleError(_0x5ef61a,null));};function widgetAttributes(_0x26f984){try{switch(_0x26f984[_0x7008('0x42')]){case _0x7008('0x5b'):return[{'name':_0x7008('0x5c'),'value':_0x26f984['attrUrl']||(_0x26f984[_0x7008('0x5d')]&&_0x26f984['attrs'][0x0]?_0x26f984['attrs'][0x0][_0x7008('0x5e')]:undefined)||_0x7008('0x5f')}];case'custom':return[{'name':_0x7008('0x60'),'value':_0x26f984[_0x7008('0x60')]||(_0x26f984[_0x7008('0x5d')]&&_0x26f984['attrs'][0x0]?_0x26f984['attrs'][0x0][_0x7008('0x5e')]:undefined)||''}];case _0x7008('0x61'):return[{'name':_0x7008('0x62'),'value':_0x26f984[_0x7008('0x62')]||(_0x26f984[_0x7008('0x5d')]&&_0x26f984[_0x7008('0x5d')][0x0]?_0x26f984[_0x7008('0x5d')][0x0][_0x7008('0x5e')]:undefined)||'HH:mm:ss'},{'name':_0x7008('0x63'),'value':_0x26f984['attrTimezone']||(_0x26f984[_0x7008('0x5d')]&&_0x26f984['attrs'][0x1]?_0x26f984[_0x7008('0x5d')][0x1][_0x7008('0x5e')]:undefined)||'0.00'},{'name':_0x7008('0x64'),'value':_0x26f984[_0x7008('0x64')]||(_0x26f984[_0x7008('0x5d')]&&_0x26f984[_0x7008('0x5d')][0x2]?_0x26f984[_0x7008('0x5d')][0x2][_0x7008('0x5e')]:undefined)||0xc}];case'counter':return[{'name':_0x7008('0x65'),'value':_0x26f984['attrMetric']||(_0x26f984[_0x7008('0x5d')]&&_0x26f984[_0x7008('0x5d')][0x0]?_0x26f984[_0x7008('0x5d')][0x0][_0x7008('0x5e')]:undefined)||_0x7008('0x66')},{'name':_0x7008('0x67'),'value':_0x26f984[_0x7008('0x67')]||(_0x26f984['attrs']&&_0x26f984[_0x7008('0x5d')][0x1]?_0x26f984[_0x7008('0x5d')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x26f984[_0x7008('0x64')]||(_0x26f984['attrs']&&_0x26f984['attrs'][0x2]?_0x26f984['attrs'][0x2][_0x7008('0x5e')]:undefined)||0x14}];case _0x7008('0x68'):case _0x7008('0x69'):return[{'name':_0x7008('0x6a'),'value':_0x26f984[_0x7008('0x6a')]||(_0x26f984[_0x7008('0x5d')]&&_0x26f984[_0x7008('0x5d')][0x0]?_0x26f984['attrs'][0x0][_0x7008('0x5e')]:undefined)||'total'},{'name':_0x7008('0x6b'),'value':_0x26f984['attrSerie2']||(_0x26f984['attrs']&&_0x26f984['attrs'][0x1]?_0x26f984[_0x7008('0x5d')][0x1][_0x7008('0x5e')]:undefined)||null},{'name':_0x7008('0x6c'),'value':_0x26f984['attrSerie3']||(_0x26f984[_0x7008('0x5d')]&&_0x26f984[_0x7008('0x5d')][0x2]?_0x26f984['attrs'][0x2][_0x7008('0x5e')]:undefined)||null},{'name':_0x7008('0x67'),'value':_0x26f984[_0x7008('0x67')]||(_0x26f984[_0x7008('0x5d')]&&_0x26f984[_0x7008('0x5d')][0x3]?_0x26f984[_0x7008('0x5d')][0x3][_0x7008('0x5e')]:undefined)||[]}];case _0x7008('0x6d'):return[{'name':_0x7008('0x6e'),'type':_0x26f984[_0x7008('0x6f')]||(_0x26f984[_0x7008('0x5d')]&&_0x26f984['attrs'][0x0]?_0x26f984['attrs'][0x0][_0x7008('0x42')]:undefined)||null,'value':_0x26f984[_0x7008('0x6e')]||(_0x26f984[_0x7008('0x5d')]&&_0x26f984[_0x7008('0x5d')][0x0]?_0x26f984[_0x7008('0x5d')][0x0][_0x7008('0x5e')]:undefined)||null},{'name':'attrRefresh','value':_0x26f984[_0x7008('0x70')]||(_0x26f984[_0x7008('0x5d')]&&_0x26f984[_0x7008('0x5d')][0x1]?_0x26f984[_0x7008('0x5d')][0x1][_0x7008('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x1a722d){logger[_0x7008('0x2a')](_0x7008('0x71'),JSON[_0x7008('0x72')](_0x1a722d));return[];}}exports[_0x7008('0x73')]=function(_0x493713,_0x32a2ef,_0x49b2e3){if(_0x493713['body']['id']){delete _0x493713[_0x7008('0x4e')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x493713[_0x7008('0x4a')]['id']}})[_0x7008('0x27')](handleEntityNotFound(_0x32a2ef,null))[_0x7008('0x27')](function(_0x536fc4){if(_0x536fc4){_0x493713[_0x7008('0x4e')][_0x7008('0x74')]=_0x536fc4['id'];_0x493713[_0x7008('0x4e')][_0x7008('0x5d')]=widgetAttributes(_0x493713[_0x7008('0x4e')]);return db[_0x7008('0x75')][_0x7008('0x4d')](_0x493713[_0x7008('0x4e')]);}})[_0x7008('0x27')](respondWithResult(_0x32a2ef,null))[_0x7008('0x48')](handleError(_0x32a2ef,null));};exports[_0x7008('0x76')]=function(_0x5239c4,_0x362a26,_0x46aaf2){var _0x4bfb32={};var _0xb37207={};var _0x4cb9b5;var _0x2c1fba;return db[_0x7008('0x45')][_0x7008('0x77')]({'where':{'id':_0x5239c4[_0x7008('0x4a')]['id']}})['then'](handleEntityNotFound(_0x362a26,null))[_0x7008('0x27')](function(_0x1bdd14){if(_0x1bdd14){_0x4cb9b5=_0x1bdd14;_0xb37207[_0x7008('0x36')]=_[_0x7008('0x34')](db[_0x7008('0x75')]['rawAttributes']);_0xb37207[_0x7008('0x33')]=_['keys'](_0x5239c4[_0x7008('0x33')]);_0xb37207[_0x7008('0x3e')]=_['intersection'](_0xb37207['model'],_0xb37207[_0x7008('0x33')]);_0x4bfb32[_0x7008('0x37')]=_[_0x7008('0x35')](_0xb37207[_0x7008('0x36')],qs[_0x7008('0x38')](_0x5239c4[_0x7008('0x33')]['fields']));_0x4bfb32[_0x7008('0x37')]=_0x4bfb32[_0x7008('0x37')][_0x7008('0x4b')]?_0x4bfb32[_0x7008('0x37')]:_0xb37207['model'];_0x4bfb32[_0x7008('0x3b')]=qs[_0x7008('0x3c')](_0x5239c4[_0x7008('0x33')][_0x7008('0x3c')]);_0x4bfb32[_0x7008('0x3d')]=qs[_0x7008('0x3e')](_[_0x7008('0x78')](_0x5239c4[_0x7008('0x33')],_0xb37207['filters']));if(_0x5239c4[_0x7008('0x33')]['filter']){_0x4bfb32[_0x7008('0x3d')]=_['merge'](_0x4bfb32['where'],{'$or':_[_0x7008('0x41')](_0x4bfb32[_0x7008('0x37')],function(_0x3ea963){var _0x7fd721={};_0x7fd721[_0x3ea963]={'$like':'%'+_0x5239c4['query']['filter']+'%'};return _0x7fd721;})});}_0x4bfb32=_['merge']({},_0x4bfb32,_0x5239c4[_0x7008('0x43')]);return _0x4cb9b5[_0x7008('0x76')](_0x4bfb32);}})['then'](function(_0xe8298e){if(_0xe8298e){_0x2c1fba=_0xe8298e[_0x7008('0x4b')];if(!_0x5239c4[_0x7008('0x33')]['hasOwnProperty'](_0x7008('0x3a'))){_0x4bfb32[_0x7008('0x22')]=qs[_0x7008('0x22')](_0x5239c4['query'][_0x7008('0x22')]);_0x4bfb32[_0x7008('0x1f')]=qs[_0x7008('0x1f')](_0x5239c4[_0x7008('0x33')][_0x7008('0x1f')]);}return _0x4cb9b5[_0x7008('0x76')](_0x4bfb32);}})[_0x7008('0x27')](function(_0x2fbeac){if(_0x2fbeac){return _0x2fbeac?{'count':_0x2c1fba,'rows':_0x2fbeac}:null;}})['then'](respondWithResult(_0x362a26,null))[_0x7008('0x48')](handleError(_0x362a26,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 19f7682..ef0249d 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 _0xc460=['hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','emit'];(function(_0x5579c1,_0x554bee){var _0x33084b=function(_0x1232ac){while(--_0x1232ac){_0x5579c1['push'](_0x5579c1['shift']());}};_0x33084b(++_0x554bee);}(_0xc460,0xed));var _0x0c46=function(_0xae2558,_0x2d7e36){_0xae2558=_0xae2558-0x0;var _0xcf1aec=_0xc460[_0xae2558];return _0xcf1aec;};'use strict';var EventEmitter=require(_0x0c46('0x0'));var Dashboard=require(_0x0c46('0x1'))['db'][_0x0c46('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x0c46('0x3')](0x0);var events={'afterCreate':_0x0c46('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1ce63d){return function(_0x192128,_0x1a022d,_0x3ead87){DashboardEvents[_0x0c46('0x5')](_0x1ce63d+':'+_0x192128['id'],_0x192128);DashboardEvents[_0x0c46('0x5')](_0x1ce63d,_0x192128);_0x3ead87(null);};}for(var e in events){if(events[_0x0c46('0x6')](e)){var event=events[e];Dashboard[_0x0c46('0x7')](e,emitEvent(event));}}module[_0x0c46('0x8')]=DashboardEvents; \ No newline at end of file +var _0x86fb=['exports','../../mysqldb','Dashboard','save','update','emit','hasOwnProperty','hook'];(function(_0x47a6f3,_0x2c8947){var _0xef2dd2=function(_0x46e29c){while(--_0x46e29c){_0x47a6f3['push'](_0x47a6f3['shift']());}};_0xef2dd2(++_0x2c8947);}(_0x86fb,0x119));var _0xb86f=function(_0x16baf0,_0x38934e){_0x16baf0=_0x16baf0-0x0;var _0x2db559=_0x86fb[_0x16baf0];return _0x2db559;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xb86f('0x0'))['db'][_0xb86f('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb86f('0x2'),'afterUpdate':_0xb86f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2b9189){return function(_0x400b29,_0x2c9f40,_0x541050){DashboardEvents['emit'](_0x2b9189+':'+_0x400b29['id'],_0x400b29);DashboardEvents[_0xb86f('0x4')](_0x2b9189,_0x400b29);_0x541050(null);};}for(var e in events){if(events[_0xb86f('0x5')](e)){var event=events[e];Dashboard[_0xb86f('0x6')](e,emitEvent(event));}}module[_0xb86f('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 16b6309..f70130f 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 _0xf9db=['dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./dashboard.attributes','exports','define','Dashboard'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xf9db,0x189));var _0xbf9d=function(_0x28acaf,_0x3966d3){_0x28acaf=_0x28acaf-0x0;var _0x99cb5f=_0xf9db[_0x28acaf];return _0x99cb5f;};'use strict';var _=require(_0xbf9d('0x0'));var util=require(_0xbf9d('0x1'));var logger=require(_0xbf9d('0x2'))(_0xbf9d('0x3'));var moment=require(_0xbf9d('0x4'));var BPromise=require(_0xbf9d('0x5'));var rp=require(_0xbf9d('0x6'));var fs=require('fs');var path=require(_0xbf9d('0x7'));var rimraf=require(_0xbf9d('0x8'));var config=require('../../config/environment');var attributes=require(_0xbf9d('0x9'));module[_0xbf9d('0xa')]=function(_0x3aba8d,_0x39c670){return _0x3aba8d[_0xbf9d('0xb')](_0xbf9d('0xc'),attributes,{'tableName':_0xbf9d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8434=['rimraf','../../config/environment','exports','define','Dashboard','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x39fb23,_0x2ad8c5){var _0x5e862c=function(_0x1d3ce3){while(--_0x1d3ce3){_0x39fb23['push'](_0x39fb23['shift']());}};_0x5e862c(++_0x2ad8c5);}(_0x8434,0x9f));var _0x4843=function(_0x385ed8,_0x5baa9f){_0x385ed8=_0x385ed8-0x0;var _0x37f1ac=_0x8434[_0x385ed8];return _0x37f1ac;};'use strict';var _=require('lodash');var util=require(_0x4843('0x0'));var logger=require(_0x4843('0x1'))(_0x4843('0x2'));var moment=require(_0x4843('0x3'));var BPromise=require(_0x4843('0x4'));var rp=require(_0x4843('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4843('0x6'));var config=require(_0x4843('0x7'));var attributes=require('./dashboard.attributes');module[_0x4843('0x8')]=function(_0x279601,_0x4934d1){return _0x279601[_0x4843('0x9')](_0x4843('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index e0d99e8..74be318 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 _0xb798=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x3c4e4c,_0x36ff70){var _0x144a87=function(_0x5efb4b){while(--_0x5efb4b){_0x3c4e4c['push'](_0x3c4e4c['shift']());}};_0x144a87(++_0x36ff70);}(_0xb798,0x1f3));var _0x8b79=function(_0x41254b,_0x162821){_0x41254b=_0x41254b-0x0;var _0x435fd9=_0xb798[_0x41254b];return _0x435fd9;};'use strict';var _=require(_0x8b79('0x0'));var util=require(_0x8b79('0x1'));var moment=require(_0x8b79('0x2'));var BPromise=require(_0x8b79('0x3'));var rs=require(_0x8b79('0x4'));var fs=require('fs');var Redis=require(_0x8b79('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b79('0x6'));var logger=require(_0x8b79('0x7'))('rpc');var config=require(_0x8b79('0x8'));var jayson=require(_0x8b79('0x9'));var client=jayson[_0x8b79('0xa')][_0x8b79('0xb')]({'port':0x232a});config[_0x8b79('0xc')]=_[_0x8b79('0xd')](config[_0x8b79('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8b79('0xe'))(new Redis(config[_0x8b79('0xc')]));require(_0x8b79('0xf'))[_0x8b79('0x10')](socket);function respondWithRpcPromise(_0x377e8e,_0x548de5,_0x1b567a){return new BPromise(function(_0x2529c0,_0x2abf1f){return client[_0x8b79('0x11')](_0x377e8e,_0x1b567a)[_0x8b79('0x12')](function(_0x1ae075){logger[_0x8b79('0x13')](_0x8b79('0x14'),_0x548de5,_0x8b79('0x15'));logger[_0x8b79('0x16')](_0x8b79('0x17'),_0x548de5,_0x8b79('0x15'),JSON[_0x8b79('0x18')](_0x1ae075));if(_0x1ae075[_0x8b79('0x19')]){if(_0x1ae075[_0x8b79('0x19')]['code']===0x1f4){logger[_0x8b79('0x19')]('Dashboard,\x20%s,\x20%s',_0x548de5,_0x1ae075['error'][_0x8b79('0x1a')]);return _0x2abf1f(_0x1ae075[_0x8b79('0x19')][_0x8b79('0x1a')]);}logger['error'](_0x8b79('0x14'),_0x548de5,_0x1ae075[_0x8b79('0x19')]['message']);return _0x2529c0(_0x1ae075[_0x8b79('0x19')][_0x8b79('0x1a')]);}else{logger[_0x8b79('0x13')]('Dashboard,\x20%s,\x20%s',_0x548de5,_0x8b79('0x15'));_0x2529c0(_0x1ae075[_0x8b79('0x1b')]['message']);}})['catch'](function(_0x1985ad){logger['error'](_0x8b79('0x14'),_0x548de5,_0x1985ad);_0x2abf1f(_0x1985ad);});});} \ No newline at end of file +var _0x9bb4=['message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3935d7,_0x39958f){var _0x2ca73e=function(_0x4a6c5d){while(--_0x4a6c5d){_0x3935d7['push'](_0x3935d7['shift']());}};_0x2ca73e(++_0x39958f);}(_0x9bb4,0x1ca));var _0x49bb=function(_0x397fcb,_0x2e0ad5){_0x397fcb=_0x397fcb-0x0;var _0x2158c9=_0x9bb4[_0x397fcb];return _0x2158c9;};'use strict';var _=require('lodash');var util=require(_0x49bb('0x0'));var moment=require(_0x49bb('0x1'));var BPromise=require(_0x49bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49bb('0x3'));var db=require(_0x49bb('0x4'))['db'];var utils=require(_0x49bb('0x5'));var logger=require('../../config/logger')(_0x49bb('0x6'));var config=require(_0x49bb('0x7'));var jayson=require(_0x49bb('0x8'));var client=jayson['client'][_0x49bb('0x9')]({'port':0x232a});config[_0x49bb('0xa')]=_['defaults'](config['redis'],{'host':_0x49bb('0xb'),'port':0x18eb});var socket=require(_0x49bb('0xc'))(new Redis(config['redis']));require('./dashboard.socket')[_0x49bb('0xd')](socket);function respondWithRpcPromise(_0x6dcb4f,_0x354b21,_0x42aa38){return new BPromise(function(_0x243641,_0x29c558){return client['request'](_0x6dcb4f,_0x42aa38)[_0x49bb('0xe')](function(_0x23d660){logger[_0x49bb('0xf')](_0x49bb('0x10'),_0x354b21,_0x49bb('0x11'));logger['debug'](_0x49bb('0x12'),_0x354b21,'request\x20sent',JSON[_0x49bb('0x13')](_0x23d660));if(_0x23d660[_0x49bb('0x14')]){if(_0x23d660[_0x49bb('0x14')][_0x49bb('0x15')]===0x1f4){logger[_0x49bb('0x14')](_0x49bb('0x10'),_0x354b21,_0x23d660['error'][_0x49bb('0x16')]);return _0x29c558(_0x23d660[_0x49bb('0x14')][_0x49bb('0x16')]);}logger[_0x49bb('0x14')](_0x49bb('0x10'),_0x354b21,_0x23d660['error'][_0x49bb('0x16')]);return _0x243641(_0x23d660[_0x49bb('0x14')]['message']);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x354b21,_0x49bb('0x11'));_0x243641(_0x23d660[_0x49bb('0x17')][_0x49bb('0x16')]);}})['catch'](function(_0x453a0d){logger['error'](_0x49bb('0x10'),_0x354b21,_0x453a0d);_0x29c558(_0x453a0d);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 673052f..8c7d5fe 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 _0x1c14=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener','register','length'];(function(_0x52b55e,_0x22741e){var _0x3ebceb=function(_0x49c57f){while(--_0x49c57f){_0x52b55e['push'](_0x52b55e['shift']());}};_0x3ebceb(++_0x22741e);}(_0x1c14,0x121));var _0x41c1=function(_0x4df349,_0x47250d){_0x4df349=_0x4df349-0x0;var _0xe43f04=_0x1c14[_0x4df349];return _0xe43f04;};'use strict';var DashboardEvents=require(_0x41c1('0x0'));var events=[_0x41c1('0x1'),_0x41c1('0x2'),_0x41c1('0x3')];function createListener(_0x4807b9,_0x137468){return function(_0x375349){_0x137468[_0x41c1('0x4')](_0x4807b9,_0x375349);};}function removeListener(_0x442c15,_0x10a519){return function(){DashboardEvents[_0x41c1('0x5')](_0x442c15,_0x10a519);};}exports[_0x41c1('0x6')]=function(_0x39eed1){for(var _0x1f593f=0x0,_0x1d718c=events[_0x41c1('0x7')];_0x1f593f<_0x1d718c;_0x1f593f++){var _0x21de01=events[_0x1f593f];var _0x25ca5f=createListener(_0x41c1('0x8')+_0x21de01,_0x39eed1);DashboardEvents['on'](_0x21de01,_0x25ca5f);}}; \ No newline at end of file +var _0xd391=['register','length','dashboard:','./dashboard.events','save','remove','update','emit'];(function(_0x399cc4,_0x5dfa6d){var _0x5527c6=function(_0x410734){while(--_0x410734){_0x399cc4['push'](_0x399cc4['shift']());}};_0x5527c6(++_0x5dfa6d);}(_0xd391,0xf3));var _0x1d39=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xd391[_0x599f41];return _0x2e4d58;};'use strict';var DashboardEvents=require(_0x1d39('0x0'));var events=[_0x1d39('0x1'),_0x1d39('0x2'),_0x1d39('0x3')];function createListener(_0x57d8f0,_0x4b6c67){return function(_0x332f04){_0x4b6c67[_0x1d39('0x4')](_0x57d8f0,_0x332f04);};}function removeListener(_0xaf3b31,_0x8a841d){return function(){DashboardEvents['removeListener'](_0xaf3b31,_0x8a841d);};}exports[_0x1d39('0x5')]=function(_0x3f978c){for(var _0x2fe8a1=0x0,_0x266367=events[_0x1d39('0x6')];_0x2fe8a1<_0x266367;_0x2fe8a1++){var _0x5dd4b4=events[_0x2fe8a1];var _0x3c4952=createListener(_0x1d39('0x7')+_0x5dd4b4,_0x3f978c);DashboardEvents['on'](_0x5dd4b4,_0x3c4952);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 038fd1e..3d891f4 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 _0x0635=['../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','clone','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x423035,_0x51ddeb){var _0x3645fc=function(_0x2205f8){while(--_0x2205f8){_0x423035['push'](_0x423035['shift']());}};_0x3645fc(++_0x51ddeb);}(_0x0635,0x176));var _0x5063=function(_0x1d4a38,_0x52dca0){_0x1d4a38=_0x1d4a38-0x0;var _0x1f2564=_0x0635[_0x1d4a38];return _0x1f2564;};'use strict';var multer=require(_0x5063('0x0'));var util=require(_0x5063('0x1'));var path=require(_0x5063('0x2'));var timeout=require(_0x5063('0x3'));var express=require('express');var router=express[_0x5063('0x4')]();var fs_extra=require(_0x5063('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5063('0x6'));var config=require(_0x5063('0x7'));var controller=require(_0x5063('0x8'));router[_0x5063('0x9')]('/',auth[_0x5063('0xa')](),controller[_0x5063('0xb')]);router[_0x5063('0x9')](_0x5063('0xc'),auth[_0x5063('0xa')](),controller[_0x5063('0xd')]);router[_0x5063('0x9')](_0x5063('0xe'),auth['isAuthenticated'](),controller[_0x5063('0xf')]);router[_0x5063('0x10')]('/',auth[_0x5063('0xa')](),controller['create']);router[_0x5063('0x10')]('/:id/clone',auth['isAuthenticated'](),controller[_0x5063('0x11')]);router['post'](_0x5063('0xe'),auth[_0x5063('0xa')](),controller['addItem']);router['put'](_0x5063('0xc'),auth[_0x5063('0xa')](),controller['update']);router['delete'](_0x5063('0xc'),auth[_0x5063('0xa')](),controller[_0x5063('0x12')]);module[_0x5063('0x13')]=router; \ No newline at end of file +var _0x1b5d=['/:id/clone','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post'];(function(_0x3f2149,_0x52e4d3){var _0x473503=function(_0x368e6c){while(--_0x368e6c){_0x3f2149['push'](_0x3f2149['shift']());}};_0x473503(++_0x52e4d3);}(_0x1b5d,0x1a3));var _0xd1b5=function(_0x14a94e,_0x1fc2d0){_0x14a94e=_0x14a94e-0x0;var _0x3d9238=_0x1b5d[_0x14a94e];return _0x3d9238;};'use strict';var multer=require('multer');var util=require(_0xd1b5('0x0'));var path=require('path');var timeout=require(_0xd1b5('0x1'));var express=require(_0xd1b5('0x2'));var router=express[_0xd1b5('0x3')]();var fs_extra=require(_0xd1b5('0x4'));var auth=require(_0xd1b5('0x5'));var interaction=require(_0xd1b5('0x6'));var config=require(_0xd1b5('0x7'));var controller=require(_0xd1b5('0x8'));router[_0xd1b5('0x9')]('/',auth[_0xd1b5('0xa')](),controller[_0xd1b5('0xb')]);router['get'](_0xd1b5('0xc'),auth[_0xd1b5('0xa')](),controller[_0xd1b5('0xd')]);router[_0xd1b5('0x9')](_0xd1b5('0xe'),auth['isAuthenticated'](),controller[_0xd1b5('0xf')]);router['post']('/',auth[_0xd1b5('0xa')](),controller[_0xd1b5('0x10')]);router[_0xd1b5('0x11')](_0xd1b5('0x12'),auth[_0xd1b5('0xa')](),controller['clone']);router[_0xd1b5('0x11')](_0xd1b5('0xe'),auth['isAuthenticated'](),controller['addItem']);router[_0xd1b5('0x13')]('/:id',auth[_0xd1b5('0xa')](),controller[_0xd1b5('0x14')]);router[_0xd1b5('0x15')](_0xd1b5('0xc'),auth[_0xd1b5('0xa')](),controller['destroy']);module[_0xd1b5('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 3bb3f36..3b1afd1 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 _0xc6ac=['#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x1e0690,_0x580938){var _0x49dc3e=function(_0x3125ab){while(--_0x3125ab){_0x1e0690['push'](_0x1e0690['shift']());}};_0x49dc3e(++_0x580938);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x1344c3,_0x5c1b5f){_0x1344c3=_0x1344c3-0x0;var _0x4de809=_0xc6ac[_0x1344c3];return _0x4de809;};'use strict';var Sequelize=require(_0xcc6a('0x0'));var squel=require(_0xcc6a('0x1'));var _=require(_0xcc6a('0x2'));module[_0xcc6a('0x3')]={'title':{'type':Sequelize[_0xcc6a('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xcc6a('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xcc6a('0x5')](_0xcc6a('0x6')),'get':function(){try{return JSON[_0xcc6a('0x7')](this[_0xcc6a('0x8')](_0xcc6a('0x9')));}catch(_0x188b05){return[];}},'set':function(_0x12330e){try{this[_0xcc6a('0xa')]('attrs',JSON[_0xcc6a('0xb')](_0x12330e));}catch(_0x11b919){this[_0xcc6a('0xa')]('attrs',JSON[_0xcc6a('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0xcc6a('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xcc6a('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xcc6a('0xc')]},'col':{'type':Sequelize[_0xcc6a('0xc')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcc6a('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xcc6a('0x4')],'allowNull':![],'defaultValue':_0xcc6a('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xcc6a('0xc')],'defaultValue':0xc}}; \ No newline at end of file +var _0xe2fe=['setDataValue','INTEGER','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify'];(function(_0x48c2d6,_0x3ae4ed){var _0x4ddf1d=function(_0x4a4296){while(--_0x4a4296){_0x48c2d6['push'](_0x48c2d6['shift']());}};_0x4ddf1d(++_0x3ae4ed);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xee2f('0x0'));var squel=require('squel');var _=require('lodash');module[_0xee2f('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xee2f('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xee2f('0x3')](_0xee2f('0x4')),'get':function(){try{return JSON[_0xee2f('0x5')](this[_0xee2f('0x6')]('attrs'));}catch(_0x311a2f){return[];}},'set':function(_0x2b7e7c){try{this['setDataValue'](_0xee2f('0x7'),JSON[_0xee2f('0x8')](_0x2b7e7c));}catch(_0x5a7975){this[_0xee2f('0x9')]('attrs',JSON[_0xee2f('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xee2f('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xee2f('0xa')]},'col':{'type':Sequelize[_0xee2f('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xee2f('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 91930b8..304a3ef 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 _0x1061=['to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','undefined','limit','count','offset','json','apply','reject','save','update','then','destroy','name','send','show','params','model','keys','query','filters','intersection','fields','attributes','length','merge','options','DashboardItem','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','stringify','create','body','eml-format','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3560e2,_0x17f686){var _0x8ab11b=function(_0x370ea6){while(--_0x370ea6){_0x3560e2['push'](_0x3560e2['shift']());}};_0x8ab11b(++_0x17f686);}(_0x1061,0x1b5));var _0x1106=function(_0x369c6f,_0x189dfb){_0x369c6f=_0x369c6f-0x0;var _0x1fb685=_0x1061[_0x369c6f];return _0x1fb685;};'use strict';var emlformat=require(_0x1106('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1106('0x1'));var moment=require(_0x1106('0x2'));var BPromise=require(_0x1106('0x3'));var Mustache=require(_0x1106('0x4'));var util=require(_0x1106('0x5'));var path=require(_0x1106('0x6'));var sox=require(_0x1106('0x7'));var csv=require(_0x1106('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1106('0x9'));var _=require(_0x1106('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1106('0xb'));var deskjs=require(_0x1106('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1106('0xd'));var Redis=require(_0x1106('0xe'));var authService=require(_0x1106('0xf'));var qs=require(_0x1106('0x10'));var as=require(_0x1106('0x11'));var hardwareService=require(_0x1106('0x12'));var logger=require(_0x1106('0x13'))(_0x1106('0x14'));var utils=require(_0x1106('0x15'));var config=require(_0x1106('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1106('0x17'))['db'];config[_0x1106('0x18')]=_[_0x1106('0x19')](config[_0x1106('0x18')],{'host':_0x1106('0x1a'),'port':0x18eb});var socket=require(_0x1106('0x1b'))(new Redis(config[_0x1106('0x18')]));require(_0x1106('0x1c'))[_0x1106('0x1d')](socket);function respondWithStatusCode(_0x6dff51,_0x358abb){_0x358abb=_0x358abb||0xcc;return function(_0x18ef62){if(_0x18ef62){return _0x6dff51[_0x1106('0x1e')](_0x358abb);}return _0x6dff51[_0x1106('0x1f')](_0x358abb)[_0x1106('0x20')]();};}function respondWithResult(_0x3f1c3a,_0x382f29){_0x382f29=_0x382f29||0xc8;return function(_0x4a23e5){if(_0x4a23e5){return _0x3f1c3a['status'](_0x382f29)['json'](_0x4a23e5);}};}function respondWithFilteredResult(_0x36f953,_0x3f2b84){return function(_0x2c2905){if(_0x2c2905){var _0x465c13=typeof _0x3f2b84['offset']===_0x1106('0x21')&&typeof _0x3f2b84[_0x1106('0x22')]===_0x1106('0x21');var _0x3d6566=_0x2c2905[_0x1106('0x23')];var _0x39e6cc=_0x465c13?0x0:_0x3f2b84[_0x1106('0x24')];var _0x1cfc45=_0x465c13?_0x2c2905[_0x1106('0x23')]:_0x3f2b84['offset']+_0x3f2b84[_0x1106('0x22')];var _0x516248;if(_0x1cfc45>=_0x3d6566){_0x1cfc45=_0x3d6566;_0x516248=0xc8;}else{_0x516248=0xce;}_0x36f953[_0x1106('0x1f')](_0x516248);return _0x36f953['set']('Content-Range',_0x39e6cc+'-'+_0x1cfc45+'/'+_0x3d6566)[_0x1106('0x25')](_0x2c2905);}return null;};}function patchUpdates(_0x5af16a){return function(_0x4418d9){try{jsonpatch[_0x1106('0x26')](_0x4418d9,_0x5af16a,!![]);}catch(_0x2c3b61){return BPromise[_0x1106('0x27')](_0x2c3b61);}return _0x4418d9[_0x1106('0x28')]();};}function saveUpdates(_0x3c76ce,_0x1d7429){return function(_0x12c44e){if(_0x12c44e){return _0x12c44e[_0x1106('0x29')](_0x3c76ce)[_0x1106('0x2a')](function(_0x1ff815){return _0x1ff815;});}return null;};}function removeEntity(_0x55dcec,_0x4dd4e9){return function(_0xac5be4){if(_0xac5be4){return _0xac5be4[_0x1106('0x2b')]()[_0x1106('0x2a')](function(){_0x55dcec[_0x1106('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16051b,_0x411021){return function(_0x465d83){if(!_0x465d83){_0x16051b[_0x1106('0x1e')](0x194);}return _0x465d83;};}function handleError(_0x8ae2af,_0x443cac){_0x443cac=_0x443cac||0x1f4;return function(_0x28b230){logger['error'](_0x28b230['stack']);if(_0x28b230['name']){delete _0x28b230[_0x1106('0x2c')];}_0x8ae2af[_0x1106('0x1f')](_0x443cac)[_0x1106('0x2d')](_0x28b230);};}exports[_0x1106('0x2e')]=function(_0x3932d3,_0x186f7){var _0x1edae3={'raw':![],'where':{'id':_0x3932d3[_0x1106('0x2f')]['id']}},_0x664bf4={};_0x664bf4[_0x1106('0x30')]=_[_0x1106('0x31')](db['DashboardItem']['rawAttributes']);_0x664bf4[_0x1106('0x32')]=_['keys'](_0x3932d3[_0x1106('0x32')]);_0x664bf4[_0x1106('0x33')]=_[_0x1106('0x34')](_0x664bf4[_0x1106('0x30')],_0x664bf4[_0x1106('0x32')]);_0x1edae3['attributes']=_[_0x1106('0x34')](_0x664bf4['model'],qs[_0x1106('0x35')](_0x3932d3[_0x1106('0x32')][_0x1106('0x35')]));_0x1edae3[_0x1106('0x36')]=_0x1edae3['attributes'][_0x1106('0x37')]?_0x1edae3[_0x1106('0x36')]:_0x664bf4[_0x1106('0x30')];if(_0x3932d3['query']['includeAll']){_0x1edae3['include']=[{'all':!![]}];}_0x1edae3=_[_0x1106('0x38')]({},_0x1edae3,_0x3932d3[_0x1106('0x39')]);return db[_0x1106('0x3a')]['find'](_0x1edae3)[_0x1106('0x2a')](handleEntityNotFound(_0x186f7,null))['then'](respondWithResult(_0x186f7,null))[_0x1106('0x3b')](handleError(_0x186f7,null));};exports[_0x1106('0x2b')]=function(_0x10943d,_0x56abbf){return db['DashboardItem']['find']({'where':{'id':_0x10943d[_0x1106('0x2f')]['id']}})['then'](handleEntityNotFound(_0x56abbf,null))['then'](removeEntity(_0x56abbf,null))['catch'](handleError(_0x56abbf,null));};function widgetAttributes(_0x3c2a02){try{switch(_0x3c2a02[_0x1106('0x3c')]){case _0x1106('0x3d'):return[{'name':_0x1106('0x3e'),'value':_0x3c2a02['attrUrl']||(_0x3c2a02['attrs']&&_0x3c2a02['attrs'][0x0]?_0x3c2a02[_0x1106('0x3f')][0x0][_0x1106('0x40')]:undefined)||_0x1106('0x41')}];case'custom':return[{'name':'attrPath','value':_0x3c2a02[_0x1106('0x42')]||(_0x3c2a02[_0x1106('0x3f')]&&_0x3c2a02[_0x1106('0x3f')][0x0]?_0x3c2a02[_0x1106('0x3f')][0x0]['value']:undefined)||''}];case _0x1106('0x43'):return[{'name':'attrHourFormat','value':_0x3c2a02[_0x1106('0x44')]||(_0x3c2a02['attrs']&&_0x3c2a02[_0x1106('0x3f')][0x0]?_0x3c2a02[_0x1106('0x3f')][0x0][_0x1106('0x40')]:undefined)||_0x1106('0x45')},{'name':_0x1106('0x46'),'value':_0x3c2a02['attrTimezone']||(_0x3c2a02['attrs']&&_0x3c2a02['attrs'][0x1]?_0x3c2a02['attrs'][0x1][_0x1106('0x40')]:undefined)||_0x1106('0x47')},{'name':'attrFontSize','value':_0x3c2a02[_0x1106('0x48')]||(_0x3c2a02[_0x1106('0x3f')]&&_0x3c2a02[_0x1106('0x3f')][0x2]?_0x3c2a02[_0x1106('0x3f')][0x2][_0x1106('0x40')]:undefined)||0xc}];case _0x1106('0x49'):return[{'name':_0x1106('0x4a'),'value':_0x3c2a02[_0x1106('0x4a')]||(_0x3c2a02[_0x1106('0x3f')]&&_0x3c2a02[_0x1106('0x3f')][0x0]?_0x3c2a02['attrs'][0x0][_0x1106('0x40')]:undefined)||_0x1106('0x4b')},{'name':_0x1106('0x4c'),'value':_0x3c2a02[_0x1106('0x4c')]||(_0x3c2a02[_0x1106('0x3f')]&&_0x3c2a02[_0x1106('0x3f')][0x1]?_0x3c2a02[_0x1106('0x3f')][0x1][_0x1106('0x40')]:undefined)||[]},{'name':_0x1106('0x48'),'value':_0x3c2a02['attrFontSize']||(_0x3c2a02[_0x1106('0x3f')]&&_0x3c2a02[_0x1106('0x3f')][0x2]?_0x3c2a02[_0x1106('0x3f')][0x2]['value']:undefined)||0x14}];case _0x1106('0x4d'):case'pie-chart':return[{'name':_0x1106('0x4e'),'value':_0x3c2a02['attrSerie1']||(_0x3c2a02[_0x1106('0x3f')]&&_0x3c2a02[_0x1106('0x3f')][0x0]?_0x3c2a02[_0x1106('0x3f')][0x0][_0x1106('0x40')]:undefined)||_0x1106('0x4b')},{'name':'attrSerie2','value':_0x3c2a02[_0x1106('0x4f')]||(_0x3c2a02['attrs']&&_0x3c2a02[_0x1106('0x3f')][0x1]?_0x3c2a02[_0x1106('0x3f')][0x1][_0x1106('0x40')]:undefined)||null},{'name':_0x1106('0x50'),'value':_0x3c2a02['attrSerie3']||(_0x3c2a02[_0x1106('0x3f')]&&_0x3c2a02[_0x1106('0x3f')][0x2]?_0x3c2a02[_0x1106('0x3f')][0x2][_0x1106('0x40')]:undefined)||null},{'name':_0x1106('0x4c'),'value':_0x3c2a02[_0x1106('0x4c')]||(_0x3c2a02[_0x1106('0x3f')]&&_0x3c2a02[_0x1106('0x3f')][0x3]?_0x3c2a02[_0x1106('0x3f')][0x3][_0x1106('0x40')]:undefined)||[]}];case _0x1106('0x51'):return[{'name':_0x1106('0x52'),'type':_0x3c2a02[_0x1106('0x53')]||(_0x3c2a02[_0x1106('0x3f')]&&_0x3c2a02[_0x1106('0x3f')][0x0]?_0x3c2a02[_0x1106('0x3f')][0x0]['type']:undefined)||null,'value':_0x3c2a02[_0x1106('0x52')]||(_0x3c2a02[_0x1106('0x3f')]&&_0x3c2a02[_0x1106('0x3f')][0x0]?_0x3c2a02['attrs'][0x0][_0x1106('0x40')]:undefined)||null},{'name':_0x1106('0x54'),'value':_0x3c2a02[_0x1106('0x54')]||(_0x3c2a02[_0x1106('0x3f')]&&_0x3c2a02[_0x1106('0x3f')][0x1]?_0x3c2a02[_0x1106('0x3f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1e146d){logger[_0x1106('0x55')]('widgetAttributes:\x20%s',JSON[_0x1106('0x56')](_0x1e146d));return[];}}exports[_0x1106('0x57')]=function(_0x412be1,_0x293a14){if(_0x412be1[_0x1106('0x58')]){_0x412be1[_0x1106('0x58')][_0x1106('0x3f')]=widgetAttributes(_0x412be1['body']);}return db[_0x1106('0x3a')][_0x1106('0x57')](_0x412be1['body'],{})[_0x1106('0x2a')](respondWithResult(_0x293a14,0xc9))[_0x1106('0x3b')](handleError(_0x293a14,null));};exports[_0x1106('0x29')]=function(_0x1a2e9f,_0x44ec51){if(_0x1a2e9f[_0x1106('0x58')]['id']){delete _0x1a2e9f[_0x1106('0x58')]['id'];}_0x1a2e9f[_0x1106('0x58')][_0x1106('0x3f')]=widgetAttributes(_0x1a2e9f['body']);return db[_0x1106('0x3a')]['find']({'where':{'id':_0x1a2e9f[_0x1106('0x2f')]['id']}})[_0x1106('0x2a')](handleEntityNotFound(_0x44ec51,null))['then'](saveUpdates(_0x1a2e9f[_0x1106('0x58')],null))[_0x1106('0x2a')](respondWithResult(_0x44ec51,null))['catch'](handleError(_0x44ec51,null));}; \ No newline at end of file +var _0x61df=['attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','model','include','merge','options','find','catch','type','iframe','attrUrl','attrs','https://','custom','clock','attrHourFormat','value','HH:mm:ss'];(function(_0x325831,_0xeb0b95){var _0x203294=function(_0x3fffad){while(--_0x3fffad){_0x325831['push'](_0x325831['shift']());}};_0x203294(++_0xeb0b95);}(_0x61df,0xbd));var _0xf61d=function(_0x4e355a,_0x5f2338){_0x4e355a=_0x4e355a-0x0;var _0x591087=_0x61df[_0x4e355a];return _0x591087;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf61d('0x0'));var rp=require(_0xf61d('0x1'));var moment=require('moment');var BPromise=require(_0xf61d('0x2'));var Mustache=require(_0xf61d('0x3'));var util=require('util');var path=require(_0xf61d('0x4'));var sox=require(_0xf61d('0x5'));var csv=require(_0xf61d('0x6'));var ejs=require(_0xf61d('0x7'));var fs=require('fs');var fs_extra=require(_0xf61d('0x8'));var _=require(_0xf61d('0x9'));var squel=require('squel');var crypto=require(_0xf61d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf61d('0xb'));var toCsv=require(_0xf61d('0x6'));var querystring=require(_0xf61d('0xc'));var Papa=require(_0xf61d('0xd'));var Redis=require(_0xf61d('0xe'));var authService=require(_0xf61d('0xf'));var qs=require(_0xf61d('0x10'));var as=require(_0xf61d('0x11'));var hardwareService=require(_0xf61d('0x12'));var logger=require(_0xf61d('0x13'))(_0xf61d('0x14'));var utils=require(_0xf61d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf61d('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf61d('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf61d('0x18')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x16c514,_0x3947f9){_0x3947f9=_0x3947f9||0xcc;return function(_0x884b38){if(_0x884b38){return _0x16c514[_0xf61d('0x19')](_0x3947f9);}return _0x16c514['status'](_0x3947f9)[_0xf61d('0x1a')]();};}function respondWithResult(_0x35b91e,_0x2e8c3f){_0x2e8c3f=_0x2e8c3f||0xc8;return function(_0x3c3f7d){if(_0x3c3f7d){return _0x35b91e['status'](_0x2e8c3f)['json'](_0x3c3f7d);}};}function respondWithFilteredResult(_0x20a048,_0x3d5b61){return function(_0x25e3ad){if(_0x25e3ad){var _0x34069c=typeof _0x3d5b61[_0xf61d('0x1b')]===_0xf61d('0x1c')&&typeof _0x3d5b61[_0xf61d('0x1d')]==='undefined';var _0x4a8430=_0x25e3ad[_0xf61d('0x1e')];var _0x28e417=_0x34069c?0x0:_0x3d5b61[_0xf61d('0x1b')];var _0x3f733b=_0x34069c?_0x25e3ad[_0xf61d('0x1e')]:_0x3d5b61[_0xf61d('0x1b')]+_0x3d5b61[_0xf61d('0x1d')];var _0x51d7ea;if(_0x3f733b>=_0x4a8430){_0x3f733b=_0x4a8430;_0x51d7ea=0xc8;}else{_0x51d7ea=0xce;}_0x20a048[_0xf61d('0x1f')](_0x51d7ea);return _0x20a048['set'](_0xf61d('0x20'),_0x28e417+'-'+_0x3f733b+'/'+_0x4a8430)[_0xf61d('0x21')](_0x25e3ad);}return null;};}function patchUpdates(_0x4006a0){return function(_0x8f3f28){try{jsonpatch[_0xf61d('0x22')](_0x8f3f28,_0x4006a0,!![]);}catch(_0x36e14a){return BPromise[_0xf61d('0x23')](_0x36e14a);}return _0x8f3f28[_0xf61d('0x24')]();};}function saveUpdates(_0x55a002,_0x59f754){return function(_0x580f53){if(_0x580f53){return _0x580f53[_0xf61d('0x25')](_0x55a002)[_0xf61d('0x26')](function(_0x17164a){return _0x17164a;});}return null;};}function removeEntity(_0x309c5b,_0x49d733){return function(_0x2b5024){if(_0x2b5024){return _0x2b5024[_0xf61d('0x27')]()['then'](function(){_0x309c5b['status'](0xcc)[_0xf61d('0x1a')]();});}};}function handleEntityNotFound(_0x11bcd1,_0x5b262f){return function(_0x16cf95){if(!_0x16cf95){_0x11bcd1[_0xf61d('0x19')](0x194);}return _0x16cf95;};}function handleError(_0x4d194d,_0x427dc4){_0x427dc4=_0x427dc4||0x1f4;return function(_0x4d1877){logger['error'](_0x4d1877[_0xf61d('0x28')]);if(_0x4d1877[_0xf61d('0x29')]){delete _0x4d1877['name'];}_0x4d194d[_0xf61d('0x1f')](_0x427dc4)['send'](_0x4d1877);};}exports[_0xf61d('0x2a')]=function(_0x5c170e,_0x210f4b){var _0x421090={'raw':![],'where':{'id':_0x5c170e[_0xf61d('0x2b')]['id']}},_0x1b8787={};_0x1b8787['model']=_[_0xf61d('0x2c')](db[_0xf61d('0x2d')][_0xf61d('0x2e')]);_0x1b8787[_0xf61d('0x2f')]=_[_0xf61d('0x2c')](_0x5c170e[_0xf61d('0x2f')]);_0x1b8787[_0xf61d('0x30')]=_[_0xf61d('0x31')](_0x1b8787['model'],_0x1b8787[_0xf61d('0x2f')]);_0x421090[_0xf61d('0x32')]=_[_0xf61d('0x31')](_0x1b8787['model'],qs[_0xf61d('0x33')](_0x5c170e[_0xf61d('0x2f')]['fields']));_0x421090['attributes']=_0x421090[_0xf61d('0x32')][_0xf61d('0x34')]?_0x421090[_0xf61d('0x32')]:_0x1b8787[_0xf61d('0x35')];if(_0x5c170e[_0xf61d('0x2f')]['includeAll']){_0x421090[_0xf61d('0x36')]=[{'all':!![]}];}_0x421090=_[_0xf61d('0x37')]({},_0x421090,_0x5c170e[_0xf61d('0x38')]);return db[_0xf61d('0x2d')][_0xf61d('0x39')](_0x421090)[_0xf61d('0x26')](handleEntityNotFound(_0x210f4b,null))[_0xf61d('0x26')](respondWithResult(_0x210f4b,null))[_0xf61d('0x3a')](handleError(_0x210f4b,null));};exports[_0xf61d('0x27')]=function(_0x4cc84d,_0x52b296){return db[_0xf61d('0x2d')][_0xf61d('0x39')]({'where':{'id':_0x4cc84d[_0xf61d('0x2b')]['id']}})[_0xf61d('0x26')](handleEntityNotFound(_0x52b296,null))[_0xf61d('0x26')](removeEntity(_0x52b296,null))[_0xf61d('0x3a')](handleError(_0x52b296,null));};function widgetAttributes(_0x186f0d){try{switch(_0x186f0d[_0xf61d('0x3b')]){case _0xf61d('0x3c'):return[{'name':_0xf61d('0x3d'),'value':_0x186f0d[_0xf61d('0x3d')]||(_0x186f0d[_0xf61d('0x3e')]&&_0x186f0d[_0xf61d('0x3e')][0x0]?_0x186f0d[_0xf61d('0x3e')][0x0]['value']:undefined)||_0xf61d('0x3f')}];case _0xf61d('0x40'):return[{'name':'attrPath','value':_0x186f0d['attrPath']||(_0x186f0d[_0xf61d('0x3e')]&&_0x186f0d['attrs'][0x0]?_0x186f0d['attrs'][0x0]['value']:undefined)||''}];case _0xf61d('0x41'):return[{'name':_0xf61d('0x42'),'value':_0x186f0d[_0xf61d('0x42')]||(_0x186f0d[_0xf61d('0x3e')]&&_0x186f0d['attrs'][0x0]?_0x186f0d[_0xf61d('0x3e')][0x0][_0xf61d('0x43')]:undefined)||_0xf61d('0x44')},{'name':_0xf61d('0x45'),'value':_0x186f0d[_0xf61d('0x45')]||(_0x186f0d[_0xf61d('0x3e')]&&_0x186f0d['attrs'][0x1]?_0x186f0d[_0xf61d('0x3e')][0x1][_0xf61d('0x43')]:undefined)||_0xf61d('0x46')},{'name':_0xf61d('0x47'),'value':_0x186f0d['attrFontSize']||(_0x186f0d[_0xf61d('0x3e')]&&_0x186f0d[_0xf61d('0x3e')][0x2]?_0x186f0d[_0xf61d('0x3e')][0x2][_0xf61d('0x43')]:undefined)||0xc}];case'counter':return[{'name':_0xf61d('0x48'),'value':_0x186f0d[_0xf61d('0x48')]||(_0x186f0d[_0xf61d('0x3e')]&&_0x186f0d[_0xf61d('0x3e')][0x0]?_0x186f0d[_0xf61d('0x3e')][0x0][_0xf61d('0x43')]:undefined)||'total'},{'name':_0xf61d('0x49'),'value':_0x186f0d[_0xf61d('0x49')]||(_0x186f0d[_0xf61d('0x3e')]&&_0x186f0d[_0xf61d('0x3e')][0x1]?_0x186f0d[_0xf61d('0x3e')][0x1][_0xf61d('0x43')]:undefined)||[]},{'name':_0xf61d('0x47'),'value':_0x186f0d[_0xf61d('0x47')]||(_0x186f0d[_0xf61d('0x3e')]&&_0x186f0d['attrs'][0x2]?_0x186f0d['attrs'][0x2][_0xf61d('0x43')]:undefined)||0x14}];case'multibar-chart':case _0xf61d('0x4a'):return[{'name':_0xf61d('0x4b'),'value':_0x186f0d['attrSerie1']||(_0x186f0d['attrs']&&_0x186f0d[_0xf61d('0x3e')][0x0]?_0x186f0d[_0xf61d('0x3e')][0x0][_0xf61d('0x43')]:undefined)||_0xf61d('0x4c')},{'name':_0xf61d('0x4d'),'value':_0x186f0d['attrSerie2']||(_0x186f0d['attrs']&&_0x186f0d[_0xf61d('0x3e')][0x1]?_0x186f0d[_0xf61d('0x3e')][0x1][_0xf61d('0x43')]:undefined)||null},{'name':_0xf61d('0x4e'),'value':_0x186f0d['attrSerie3']||(_0x186f0d[_0xf61d('0x3e')]&&_0x186f0d['attrs'][0x2]?_0x186f0d[_0xf61d('0x3e')][0x2]['value']:undefined)||null},{'name':_0xf61d('0x49'),'value':_0x186f0d[_0xf61d('0x49')]||(_0x186f0d[_0xf61d('0x3e')]&&_0x186f0d['attrs'][0x3]?_0x186f0d[_0xf61d('0x3e')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0xf61d('0x4f'),'type':_0x186f0d['reportType']||(_0x186f0d[_0xf61d('0x3e')]&&_0x186f0d[_0xf61d('0x3e')][0x0]?_0x186f0d[_0xf61d('0x3e')][0x0][_0xf61d('0x3b')]:undefined)||null,'value':_0x186f0d[_0xf61d('0x4f')]||(_0x186f0d[_0xf61d('0x3e')]&&_0x186f0d['attrs'][0x0]?_0x186f0d[_0xf61d('0x3e')][0x0][_0xf61d('0x43')]:undefined)||null},{'name':_0xf61d('0x50'),'value':_0x186f0d[_0xf61d('0x50')]||(_0x186f0d[_0xf61d('0x3e')]&&_0x186f0d[_0xf61d('0x3e')][0x1]?_0x186f0d[_0xf61d('0x3e')][0x1][_0xf61d('0x43')]:undefined)||0x0}];default:return[];}}catch(_0xfce4ee){logger[_0xf61d('0x51')](_0xf61d('0x52'),JSON[_0xf61d('0x53')](_0xfce4ee));return[];}}exports[_0xf61d('0x54')]=function(_0x1fe4be,_0x23a0fa){if(_0x1fe4be[_0xf61d('0x55')]){_0x1fe4be[_0xf61d('0x55')]['attrs']=widgetAttributes(_0x1fe4be[_0xf61d('0x55')]);}return db[_0xf61d('0x2d')]['create'](_0x1fe4be[_0xf61d('0x55')],{})['then'](respondWithResult(_0x23a0fa,0xc9))[_0xf61d('0x3a')](handleError(_0x23a0fa,null));};exports[_0xf61d('0x25')]=function(_0x422ed7,_0x529bdc){if(_0x422ed7[_0xf61d('0x55')]['id']){delete _0x422ed7['body']['id'];}_0x422ed7[_0xf61d('0x55')][_0xf61d('0x3e')]=widgetAttributes(_0x422ed7[_0xf61d('0x55')]);return db[_0xf61d('0x2d')][_0xf61d('0x39')]({'where':{'id':_0x422ed7['params']['id']}})[_0xf61d('0x26')](handleEntityNotFound(_0x529bdc,null))['then'](saveUpdates(_0x422ed7[_0xf61d('0x55')],null))[_0xf61d('0x26')](respondWithResult(_0x529bdc,null))[_0xf61d('0x3a')](handleError(_0x529bdc,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index e279bb8..5126dda 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 _0xbcff=['hasOwnProperty','hook','exports','events','DashboardItem','save','update','emit'];(function(_0x5b6064,_0x376df5){var _0x1f5b14=function(_0x361967){while(--_0x361967){_0x5b6064['push'](_0x5b6064['shift']());}};_0x1f5b14(++_0x376df5);}(_0xbcff,0xbb));var _0xfbcf=function(_0x5b4925,_0xd63f93){_0x5b4925=_0x5b4925-0x0;var _0x54b1ce=_0xbcff[_0x5b4925];return _0x54b1ce;};'use strict';var EventEmitter=require(_0xfbcf('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xfbcf('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfbcf('0x2'),'afterUpdate':_0xfbcf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4cb4e8){return function(_0xf3e86e,_0xc7fe0c,_0x5405a7){DashboardItemEvents[_0xfbcf('0x4')](_0x4cb4e8+':'+_0xf3e86e['id'],_0xf3e86e);DashboardItemEvents[_0xfbcf('0x4')](_0x4cb4e8,_0xf3e86e);_0x5405a7(null);};}for(var e in events){if(events[_0xfbcf('0x5')](e)){var event=events[e];DashboardItem[_0xfbcf('0x6')](e,emitEvent(event));}}module[_0xfbcf('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x8a76=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','DashboardItem'];(function(_0x4f16b3,_0x29707c){var _0x4c8fc7=function(_0x9985f3){while(--_0x9985f3){_0x4f16b3['push'](_0x4f16b3['shift']());}};_0x4c8fc7(++_0x29707c);}(_0x8a76,0x17e));var _0x68a7=function(_0x3adbe2,_0x36e0ef){_0x3adbe2=_0x3adbe2-0x0;var _0x1bd4f5=_0x8a76[_0x3adbe2];return _0x1bd4f5;};'use strict';var EventEmitter=require(_0x68a7('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x68a7('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x68a7('0x2')](0x0);var events={'afterCreate':_0x68a7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x347d59){return function(_0xd6b957,_0x379b81,_0x440530){DashboardItemEvents[_0x68a7('0x4')](_0x347d59+':'+_0xd6b957['id'],_0xd6b957);DashboardItemEvents[_0x68a7('0x4')](_0x347d59,_0xd6b957);_0x440530(null);};}for(var e in events){if(events[_0x68a7('0x5')](e)){var event=events[e];DashboardItem[_0x68a7('0x6')](e,emitEvent(event));}}module[_0x68a7('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 5910505..fce133c 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 _0x3228=['dashboard_items','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x3228,0x181));var _0x8322=function(_0x4cb46d,_0x1dcf2d){_0x4cb46d=_0x4cb46d-0x0;var _0xb38680=_0x3228[_0x4cb46d];return _0xb38680;};'use strict';var _=require(_0x8322('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8322('0x1'));var moment=require(_0x8322('0x2'));var BPromise=require(_0x8322('0x3'));var rp=require(_0x8322('0x4'));var fs=require('fs');var path=require(_0x8322('0x5'));var rimraf=require(_0x8322('0x6'));var config=require(_0x8322('0x7'));var attributes=require(_0x8322('0x8'));module[_0x8322('0x9')]=function(_0x4979e7,_0x2d3f72){return _0x4979e7[_0x8322('0xa')]('DashboardItem',attributes,{'tableName':_0x8322('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa01c=['exports','define','dashboard_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x12e129,_0x3688bd){var _0x59c8ef=function(_0x3a59e6){while(--_0x3a59e6){_0x12e129['push'](_0x12e129['shift']());}};_0x59c8ef(++_0x3688bd);}(_0xa01c,0x1f1));var _0xca01=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa01c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xca01('0x0'));var util=require(_0xca01('0x1'));var logger=require(_0xca01('0x2'))(_0xca01('0x3'));var moment=require('moment');var BPromise=require(_0xca01('0x4'));var rp=require(_0xca01('0x5'));var fs=require('fs');var path=require(_0xca01('0x6'));var rimraf=require(_0xca01('0x7'));var config=require(_0xca01('0x8'));var attributes=require(_0xca01('0x9'));module[_0xca01('0xa')]=function(_0x31ba2a,_0x31eec1){return _0x31ba2a[_0xca01('0xb')]('DashboardItem',attributes,{'tableName':_0xca01('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index f49c68b..141e504 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 _0x434a=['info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./dashboardItem.socket','register','then'];(function(_0x5cc778,_0x33a33d){var _0x35438a=function(_0xf4157c){while(--_0xf4157c){_0x5cc778['push'](_0x5cc778['shift']());}};_0x35438a(++_0x33a33d);}(_0x434a,0xc6));var _0xa434=function(_0x50423a,_0x50e45b){_0x50423a=_0x50423a-0x0;var _0x1f965a=_0x434a[_0x50423a];return _0x1f965a;};'use strict';var _=require(_0xa434('0x0'));var util=require(_0xa434('0x1'));var moment=require(_0xa434('0x2'));var BPromise=require(_0xa434('0x3'));var rs=require(_0xa434('0x4'));var fs=require('fs');var Redis=require(_0xa434('0x5'));var db=require(_0xa434('0x6'))['db'];var utils=require(_0xa434('0x7'));var logger=require('../../config/logger')(_0xa434('0x8'));var config=require(_0xa434('0x9'));var jayson=require(_0xa434('0xa'));var client=jayson[_0xa434('0xb')][_0xa434('0xc')]({'port':0x232a});config[_0xa434('0xd')]=_['defaults'](config[_0xa434('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xa434('0xe'))(new Redis(config[_0xa434('0xd')]));require(_0xa434('0xf'))[_0xa434('0x10')](socket);function respondWithRpcPromise(_0x45abcd,_0xda674b,_0x5c2204){return new BPromise(function(_0x242cf5,_0x3a718c){return client['request'](_0x45abcd,_0x5c2204)[_0xa434('0x11')](function(_0xf482ba){logger[_0xa434('0x12')](_0xa434('0x13'),_0xda674b,_0xa434('0x14'));logger[_0xa434('0x15')](_0xa434('0x16'),_0xda674b,'request\x20sent',JSON['stringify'](_0xf482ba));if(_0xf482ba[_0xa434('0x17')]){if(_0xf482ba[_0xa434('0x17')][_0xa434('0x18')]===0x1f4){logger[_0xa434('0x17')](_0xa434('0x13'),_0xda674b,_0xf482ba[_0xa434('0x17')][_0xa434('0x19')]);return _0x3a718c(_0xf482ba['error'][_0xa434('0x19')]);}logger[_0xa434('0x17')](_0xa434('0x13'),_0xda674b,_0xf482ba[_0xa434('0x17')][_0xa434('0x19')]);return _0x242cf5(_0xf482ba[_0xa434('0x17')][_0xa434('0x19')]);}else{logger['info'](_0xa434('0x13'),_0xda674b,_0xa434('0x14'));_0x242cf5(_0xf482ba['result'][_0xa434('0x19')]);}})[_0xa434('0x1a')](function(_0x519e3b){logger[_0xa434('0x17')](_0xa434('0x13'),_0xda674b,_0x519e3b);_0x3a718c(_0x519e3b);});});} \ No newline at end of file +var _0x5030=['DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','debug'];(function(_0x78ec14,_0x35e2c7){var _0x4c6175=function(_0x22c653){while(--_0x22c653){_0x78ec14['push'](_0x78ec14['shift']());}};_0x4c6175(++_0x35e2c7);}(_0x5030,0xcc));var _0x0503=function(_0x5c7a5d,_0x135ad0){_0x5c7a5d=_0x5c7a5d-0x0;var _0x468802=_0x5030[_0x5c7a5d];return _0x468802;};'use strict';var _=require(_0x0503('0x0'));var util=require('util');var moment=require(_0x0503('0x1'));var BPromise=require('bluebird');var rs=require(_0x0503('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0503('0x3'))['db'];var utils=require(_0x0503('0x4'));var logger=require(_0x0503('0x5'))(_0x0503('0x6'));var config=require('../../config/environment');var jayson=require(_0x0503('0x7'));var client=jayson['client'][_0x0503('0x8')]({'port':0x232a});config[_0x0503('0x9')]=_[_0x0503('0xa')](config[_0x0503('0x9')],{'host':_0x0503('0xb'),'port':0x18eb});var socket=require(_0x0503('0xc'))(new Redis(config[_0x0503('0x9')]));require(_0x0503('0xd'))[_0x0503('0xe')](socket);function respondWithRpcPromise(_0x5131dc,_0x47df8e,_0x5eecf6){return new BPromise(function(_0x44c5c3,_0x1bb24e){return client[_0x0503('0xf')](_0x5131dc,_0x5eecf6)[_0x0503('0x10')](function(_0xc7c95b){logger[_0x0503('0x11')]('DashboardItem,\x20%s,\x20%s',_0x47df8e,_0x0503('0x12'));logger[_0x0503('0x13')](_0x0503('0x14'),_0x47df8e,'request\x20sent',JSON[_0x0503('0x15')](_0xc7c95b));if(_0xc7c95b[_0x0503('0x16')]){if(_0xc7c95b[_0x0503('0x16')][_0x0503('0x17')]===0x1f4){logger[_0x0503('0x16')](_0x0503('0x18'),_0x47df8e,_0xc7c95b[_0x0503('0x16')]['message']);return _0x1bb24e(_0xc7c95b[_0x0503('0x16')][_0x0503('0x19')]);}logger[_0x0503('0x16')](_0x0503('0x18'),_0x47df8e,_0xc7c95b[_0x0503('0x16')][_0x0503('0x19')]);return _0x44c5c3(_0xc7c95b['error'][_0x0503('0x19')]);}else{logger[_0x0503('0x11')]('DashboardItem,\x20%s,\x20%s',_0x47df8e,'request\x20sent');_0x44c5c3(_0xc7c95b[_0x0503('0x1a')][_0x0503('0x19')]);}})[_0x0503('0x1b')](function(_0xb664bc){logger['error'](_0x0503('0x18'),_0x47df8e,_0xb664bc);_0x1bb24e(_0xb664bc);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index af8a894..4c06fa2 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 _0x79ca=['dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','length'];(function(_0xc52550,_0x53feb1){var _0x30605b=function(_0x2fcdf8){while(--_0x2fcdf8){_0xc52550['push'](_0xc52550['shift']());}};_0x30605b(++_0x53feb1);}(_0x79ca,0x121));var _0xa79c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x79ca[_0x20a584];return _0x4b41a8;};'use strict';var DashboardItemEvents=require(_0xa79c('0x0'));var events=[_0xa79c('0x1'),_0xa79c('0x2'),_0xa79c('0x3')];function createListener(_0x5d1473,_0x15e9b2){return function(_0x413620){_0x15e9b2[_0xa79c('0x4')](_0x5d1473,_0x413620);};}function removeListener(_0x3368a3,_0x2cadcc){return function(){DashboardItemEvents[_0xa79c('0x5')](_0x3368a3,_0x2cadcc);};}exports['register']=function(_0x20a407){for(var _0x1f58e0=0x0,_0x3027b9=events[_0xa79c('0x6')];_0x1f58e0<_0x3027b9;_0x1f58e0++){var _0x104e0c=events[_0x1f58e0];var _0x244e6d=createListener(_0xa79c('0x7')+_0x104e0c,_0x20a407);DashboardItemEvents['on'](_0x104e0c,_0x244e6d);}}; \ No newline at end of file +var _0xd5f4=['dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3ab39e,_0x506fd5){var _0x33fdf4=function(_0x18eb45){while(--_0x18eb45){_0x3ab39e['push'](_0x3ab39e['shift']());}};_0x33fdf4(++_0x506fd5);}(_0xd5f4,0xb5));var _0x4d5f=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xd5f4[_0x1da527];return _0x40fc7c;};'use strict';var DashboardItemEvents=require(_0x4d5f('0x0'));var events=[_0x4d5f('0x1'),_0x4d5f('0x2'),_0x4d5f('0x3')];function createListener(_0x325ab6,_0x46e74c){return function(_0x5dddfd){_0x46e74c[_0x4d5f('0x4')](_0x325ab6,_0x5dddfd);};}function removeListener(_0x332f47,_0x44e2c8){return function(){DashboardItemEvents[_0x4d5f('0x5')](_0x332f47,_0x44e2c8);};}exports[_0x4d5f('0x6')]=function(_0x227528){for(var _0x480609=0x0,_0x582627=events[_0x4d5f('0x7')];_0x480609<_0x582627;_0x480609++){var _0x538deb=events[_0x480609];var _0x3a35e9=createListener(_0x4d5f('0x8')+_0x538deb,_0x227528);DashboardItemEvents['on'](_0x538deb,_0x3a35e9);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 0b44eb8..284260e 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 _0xfa98=['Router','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','post','create','/:id','delete','destroy','exports','multer','util','path','express'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xfa98,0xb7));var _0x8fa9=function(_0x85cfb3,_0x102960){_0x85cfb3=_0x85cfb3-0x0;var _0x3a9584=_0xfa98[_0x85cfb3];return _0x3a9584;};'use strict';var multer=require(_0x8fa9('0x0'));var util=require(_0x8fa9('0x1'));var path=require(_0x8fa9('0x2'));var timeout=require('connect-timeout');var express=require(_0x8fa9('0x3'));var router=express[_0x8fa9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8fa9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8fa9('0x6'));var controller=require(_0x8fa9('0x7'));router[_0x8fa9('0x8')]('/:id',auth[_0x8fa9('0x9')](),controller[_0x8fa9('0xa')]);router[_0x8fa9('0xb')]('/',auth[_0x8fa9('0x9')](),controller[_0x8fa9('0xc')]);router['put'](_0x8fa9('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x8fa9('0xe')](_0x8fa9('0xd'),auth[_0x8fa9('0x9')](),controller[_0x8fa9('0xf')]);module[_0x8fa9('0x10')]=router; \ No newline at end of file +var _0x8fd8=['create','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','post'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8fd8,0x136));var _0x88fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8fd8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x88fd('0x0'));var util=require(_0x88fd('0x1'));var path=require('path');var timeout=require(_0x88fd('0x2'));var express=require(_0x88fd('0x3'));var router=express['Router']();var fs_extra=require(_0x88fd('0x4'));var auth=require(_0x88fd('0x5'));var interaction=require(_0x88fd('0x6'));var config=require(_0x88fd('0x7'));var controller=require(_0x88fd('0x8'));router[_0x88fd('0x9')]('/:id',auth[_0x88fd('0xa')](),controller[_0x88fd('0xb')]);router[_0x88fd('0xc')]('/',auth['isAuthenticated'](),controller[_0x88fd('0xd')]);router['put']('/:id',auth[_0x88fd('0xa')](),controller[_0x88fd('0xe')]);router[_0x88fd('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x88fd('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 4055d3e..7cde23c 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 _0x4221=['STRING','ENUM','first','third'];(function(_0x5e5129,_0x4547a5){var _0x3885e0=function(_0x3c6c3b){while(--_0x3c6c3b){_0x5e5129['push'](_0x5e5129['shift']());}};_0x3885e0(++_0x4547a5);}(_0x4221,0x81));var _0x1422=function(_0x18609b,_0x54be8f){_0x18609b=_0x18609b-0x0;var _0x5193cd=_0x4221[_0x18609b];return _0x5193cd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x1422('0x0')](_0x1422('0x1'),'second',_0x1422('0x2')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x1422('0x3')]}}; \ No newline at end of file +var _0x330c=['first','exports','STRING','ENUM','second','third'];(function(_0x3e249f,_0x21f479){var _0x3b203f=function(_0x14061c){while(--_0x14061c){_0x3e249f['push'](_0x3e249f['shift']());}};_0x3b203f(++_0x21f479);}(_0x330c,0x193));var _0xc330=function(_0x3e779f,_0x4e05c0){_0x3e779f=_0x3e779f-0x0;var _0x553999=_0x330c[_0x3e779f];return _0x553999;};'use strict';var Sequelize=require('sequelize');module[_0xc330('0x0')]={'name':{'type':Sequelize[_0xc330('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xc330('0x2')]('first',_0xc330('0x3'),_0xc330('0x4')),'allowNull':![],'defaultValue':_0xc330('0x5')},'description':{'type':Sequelize[_0xc330('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 9e3613f..f9a7aad 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 _0x2b95=['sendStatus','error','stack','name','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Dispositions'];(function(_0x64d7cf,_0xfb45dc){var _0x173631=function(_0x38cb07){while(--_0x38cb07){_0x64d7cf['push'](_0x64d7cf['shift']());}};_0x173631(++_0xfb45dc);}(_0x2b95,0x1f1));var _0x52b9=function(_0x562faf,_0x102bcc){_0x562faf=_0x562faf-0x0;var _0x22c1f6=_0x2b95[_0x562faf];return _0x22c1f6;};'use strict';var emlformat=require(_0x52b9('0x0'));var rimraf=require(_0x52b9('0x1'));var zipdir=require(_0x52b9('0x2'));var jsonpatch=require(_0x52b9('0x3'));var rp=require(_0x52b9('0x4'));var moment=require(_0x52b9('0x5'));var BPromise=require(_0x52b9('0x6'));var Mustache=require(_0x52b9('0x7'));var util=require(_0x52b9('0x8'));var path=require(_0x52b9('0x9'));var sox=require('sox');var csv=require(_0x52b9('0xa'));var ejs=require(_0x52b9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x52b9('0xc'));var squel=require(_0x52b9('0xd'));var crypto=require(_0x52b9('0xe'));var jsforce=require(_0x52b9('0xf'));var deskjs=require(_0x52b9('0x10'));var toCsv=require(_0x52b9('0xa'));var querystring=require(_0x52b9('0x11'));var Papa=require('papaparse');var Redis=require(_0x52b9('0x12'));var authService=require(_0x52b9('0x13'));var qs=require(_0x52b9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x52b9('0x15'))(_0x52b9('0x16'));var utils=require(_0x52b9('0x17'));var config=require(_0x52b9('0x18'));var licenseUtil=require(_0x52b9('0x19'));var db=require(_0x52b9('0x1a'))['db'];function respondWithStatusCode(_0xd8b5c4,_0x462810){_0x462810=_0x462810||0xcc;return function(_0x561980){if(_0x561980){return _0xd8b5c4['sendStatus'](_0x462810);}return _0xd8b5c4[_0x52b9('0x1b')](_0x462810)[_0x52b9('0x1c')]();};}function respondWithResult(_0x45537d,_0x1dec9c){_0x1dec9c=_0x1dec9c||0xc8;return function(_0x913129){if(_0x913129){return _0x45537d['status'](_0x1dec9c)[_0x52b9('0x1d')](_0x913129);}};}function respondWithFilteredResult(_0x250346,_0x58f8dd){return function(_0x41054e){if(_0x41054e){var _0x524e07=typeof _0x58f8dd['offset']==='undefined'&&typeof _0x58f8dd[_0x52b9('0x1e')]===_0x52b9('0x1f');var _0x5980b7=_0x41054e[_0x52b9('0x20')];var _0x3e61ec=_0x524e07?0x0:_0x58f8dd['offset'];var _0x57db7f=_0x524e07?_0x41054e[_0x52b9('0x20')]:_0x58f8dd[_0x52b9('0x21')]+_0x58f8dd['limit'];var _0x4e0288;if(_0x57db7f>=_0x5980b7){_0x57db7f=_0x5980b7;_0x4e0288=0xc8;}else{_0x4e0288=0xce;}_0x250346['status'](_0x4e0288);return _0x250346[_0x52b9('0x22')](_0x52b9('0x23'),_0x3e61ec+'-'+_0x57db7f+'/'+_0x5980b7)[_0x52b9('0x1d')](_0x41054e);}return null;};}function patchUpdates(_0xc46033){return function(_0x8e5bbf){try{jsonpatch[_0x52b9('0x24')](_0x8e5bbf,_0xc46033,!![]);}catch(_0x1f97f0){return BPromise[_0x52b9('0x25')](_0x1f97f0);}return _0x8e5bbf['save']();};}function saveUpdates(_0xe08976,_0x397c0d){return function(_0x577f58){if(_0x577f58){return _0x577f58[_0x52b9('0x26')](_0xe08976)[_0x52b9('0x27')](function(_0x2fdd6e){return _0x2fdd6e;});}return null;};}function removeEntity(_0x52fbc0,_0x192382){return function(_0x4f16ee){if(_0x4f16ee){return _0x4f16ee[_0x52b9('0x28')]()[_0x52b9('0x27')](function(){var _0x37431f=_0x4f16ee[_0x52b9('0x29')]({'plain':!![]});var _0x275c1a=_0x52b9('0x2a');return db['UserProfileResource'][_0x52b9('0x28')]({'where':{'type':_0x275c1a,'resourceId':_0x37431f['id']}})[_0x52b9('0x27')](function(){return _0x4f16ee;});})[_0x52b9('0x27')](function(){_0x52fbc0[_0x52b9('0x1b')](0xcc)[_0x52b9('0x1c')]();});}};}function handleEntityNotFound(_0x30d2ab,_0x44cb3e){return function(_0x48c993){if(!_0x48c993){_0x30d2ab[_0x52b9('0x2b')](0x194);}return _0x48c993;};}function handleError(_0x286665,_0x504212){_0x504212=_0x504212||0x1f4;return function(_0x197f88){logger[_0x52b9('0x2c')](_0x197f88[_0x52b9('0x2d')]);if(_0x197f88[_0x52b9('0x2e')]){delete _0x197f88['name'];}_0x286665[_0x52b9('0x1b')](_0x504212)['send'](_0x197f88);};}exports[_0x52b9('0x2f')]=function(_0x2b64bd,_0x2d530b){var _0x5ef2a2={},_0x2a3d5a={},_0x7bed64={'count':0x0,'rows':[]};var _0x2e09b5=_[_0x52b9('0x30')](db[_0x52b9('0x31')][_0x52b9('0x32')],function(_0x829acd){return{'name':_0x829acd[_0x52b9('0x33')],'type':_0x829acd[_0x52b9('0x34')][_0x52b9('0x35')]};});_0x2a3d5a[_0x52b9('0x36')]=_['map'](_0x2e09b5,_0x52b9('0x2e'));_0x2a3d5a[_0x52b9('0x37')]=_[_0x52b9('0x38')](_0x2b64bd['query']);_0x2a3d5a[_0x52b9('0x39')]=_[_0x52b9('0x3a')](_0x2a3d5a[_0x52b9('0x36')],_0x2a3d5a[_0x52b9('0x37')]);_0x5ef2a2[_0x52b9('0x3b')]=_['intersection'](_0x2a3d5a[_0x52b9('0x36')],qs[_0x52b9('0x3c')](_0x2b64bd['query']['fields']));_0x5ef2a2[_0x52b9('0x3b')]=_0x5ef2a2[_0x52b9('0x3b')][_0x52b9('0x3d')]?_0x5ef2a2['attributes']:_0x2a3d5a['model'];if(!_0x2b64bd['query'][_0x52b9('0x3e')](_0x52b9('0x3f'))){_0x5ef2a2[_0x52b9('0x1e')]=qs[_0x52b9('0x1e')](_0x2b64bd[_0x52b9('0x37')][_0x52b9('0x1e')]);_0x5ef2a2[_0x52b9('0x21')]=qs[_0x52b9('0x21')](_0x2b64bd[_0x52b9('0x37')][_0x52b9('0x21')]);}_0x5ef2a2[_0x52b9('0x40')]=qs[_0x52b9('0x41')](_0x2b64bd[_0x52b9('0x37')][_0x52b9('0x41')]);_0x5ef2a2[_0x52b9('0x42')]=qs[_0x52b9('0x39')](_[_0x52b9('0x43')](_0x2b64bd[_0x52b9('0x37')],_0x2a3d5a[_0x52b9('0x39')]),_0x2e09b5);if(_0x2b64bd[_0x52b9('0x37')][_0x52b9('0x44')]){_0x5ef2a2[_0x52b9('0x42')]=_[_0x52b9('0x45')](_0x5ef2a2[_0x52b9('0x42')],{'$or':_[_0x52b9('0x30')](_0x2e09b5,function(_0x4abbac){if(_0x4abbac[_0x52b9('0x34')]!==_0x52b9('0x46')){var _0x225f6c={};_0x225f6c[_0x4abbac[_0x52b9('0x2e')]]={'$like':'%'+_0x2b64bd[_0x52b9('0x37')]['filter']+'%'};return _0x225f6c;}})});}_0x5ef2a2=_['merge']({},_0x5ef2a2,_0x2b64bd[_0x52b9('0x47')]);var _0xc1b63d={'where':_0x5ef2a2['where']};return db[_0x52b9('0x31')]['count'](_0xc1b63d)[_0x52b9('0x27')](function(_0x316b4f){_0x7bed64[_0x52b9('0x20')]=_0x316b4f;if(_0x2b64bd['query'][_0x52b9('0x48')]){_0x5ef2a2[_0x52b9('0x49')]=[{'all':!![]}];}return db['Disposition'][_0x52b9('0x4a')](_0x5ef2a2);})[_0x52b9('0x27')](function(_0x2b7fe9){_0x7bed64[_0x52b9('0x4b')]=_0x2b7fe9;return _0x7bed64;})[_0x52b9('0x27')](respondWithFilteredResult(_0x2d530b,_0x5ef2a2))[_0x52b9('0x4c')](handleError(_0x2d530b,null));};exports[_0x52b9('0x4d')]=function(_0x1812d3,_0x4686a8){var _0x177a22={'raw':!![],'where':{'id':_0x1812d3[_0x52b9('0x4e')]['id']}},_0x6ae1b={};_0x6ae1b[_0x52b9('0x36')]=_['keys'](db['Disposition'][_0x52b9('0x32')]);_0x6ae1b['query']=_[_0x52b9('0x38')](_0x1812d3[_0x52b9('0x37')]);_0x6ae1b[_0x52b9('0x39')]=_['intersection'](_0x6ae1b[_0x52b9('0x36')],_0x6ae1b['query']);_0x177a22['attributes']=_[_0x52b9('0x3a')](_0x6ae1b['model'],qs[_0x52b9('0x3c')](_0x1812d3[_0x52b9('0x37')][_0x52b9('0x3c')]));_0x177a22[_0x52b9('0x3b')]=_0x177a22['attributes'][_0x52b9('0x3d')]?_0x177a22[_0x52b9('0x3b')]:_0x6ae1b[_0x52b9('0x36')];if(_0x1812d3[_0x52b9('0x37')][_0x52b9('0x48')]){_0x177a22[_0x52b9('0x49')]=[{'all':!![]}];}_0x177a22=_[_0x52b9('0x45')]({},_0x177a22,_0x1812d3[_0x52b9('0x47')]);return db[_0x52b9('0x31')][_0x52b9('0x4f')](_0x177a22)[_0x52b9('0x27')](handleEntityNotFound(_0x4686a8,null))[_0x52b9('0x27')](respondWithResult(_0x4686a8,null))[_0x52b9('0x4c')](handleError(_0x4686a8,null));};exports[_0x52b9('0x50')]=function(_0x5e5460,_0x2db115){return db['Disposition'][_0x52b9('0x50')](_0x5e5460['body'],{})[_0x52b9('0x27')](function(_0x7f8aa7){var _0xc8ace=_0x5e5460[_0x52b9('0x51')][_0x52b9('0x29')]({'plain':!![]});if(!_0xc8ace)throw new Error(_0x52b9('0x52'));if(_0xc8ace[_0x52b9('0x53')]===_0x52b9('0x51')){var _0x484475=_0x7f8aa7[_0x52b9('0x29')]({'plain':!![]});var _0x13acf0=_0x52b9('0x2a');return db[_0x52b9('0x54')][_0x52b9('0x4f')]({'where':{'name':_0x13acf0,'userProfileId':_0xc8ace[_0x52b9('0x55')]},'raw':!![]})[_0x52b9('0x27')](function(_0x31b254){if(_0x31b254&&_0x31b254[_0x52b9('0x56')]===0x0){return db[_0x52b9('0x57')]['create']({'name':_0x484475[_0x52b9('0x2e')],'resourceId':_0x484475['id'],'type':_0x31b254[_0x52b9('0x2e')],'sectionId':_0x31b254['id']},{})[_0x52b9('0x27')](function(){return _0x7f8aa7;});}else{return _0x7f8aa7;}})['catch'](function(_0x1c3a75){logger[_0x52b9('0x2c')](_0x52b9('0x58'),_0x1c3a75);throw _0x1c3a75;});}return _0x7f8aa7;})[_0x52b9('0x27')](respondWithResult(_0x2db115,0xc9))['catch'](handleError(_0x2db115,null));};exports[_0x52b9('0x26')]=function(_0x431130,_0x4a23ee){if(_0x431130['body']['id']){delete _0x431130[_0x52b9('0x59')]['id'];}return db['Disposition'][_0x52b9('0x4f')]({'where':{'id':_0x431130[_0x52b9('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4a23ee,null))[_0x52b9('0x27')](saveUpdates(_0x431130['body'],null))[_0x52b9('0x27')](respondWithResult(_0x4a23ee,null))[_0x52b9('0x4c')](handleError(_0x4a23ee,null));};exports[_0x52b9('0x28')]=function(_0x4676e1,_0x2e215a){return db[_0x52b9('0x31')][_0x52b9('0x4f')]({'where':{'id':_0x4676e1[_0x52b9('0x4e')]['id']}})[_0x52b9('0x27')](handleEntityNotFound(_0x2e215a,null))[_0x52b9('0x27')](removeEntity(_0x2e215a,null))['catch'](handleError(_0x2e215a,null));}; \ No newline at end of file +var _0xd2a3=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource','error','stack','name','map','Disposition','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0xd2a3,0x17f));var _0x3d2a=function(_0x29d601,_0x2c488b){_0x29d601=_0x29d601-0x0;var _0x37339f=_0xd2a3[_0x29d601];return _0x37339f;};'use strict';var emlformat=require(_0x3d2a('0x0'));var rimraf=require(_0x3d2a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d2a('0x2'));var rp=require(_0x3d2a('0x3'));var moment=require(_0x3d2a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3d2a('0x5'));var util=require(_0x3d2a('0x6'));var path=require(_0x3d2a('0x7'));var sox=require(_0x3d2a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d2a('0x9'));var _=require('lodash');var squel=require(_0x3d2a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3d2a('0xb'));var toCsv=require(_0x3d2a('0xc'));var querystring=require(_0x3d2a('0xd'));var Papa=require('papaparse');var Redis=require(_0x3d2a('0xe'));var authService=require(_0x3d2a('0xf'));var qs=require(_0x3d2a('0x10'));var as=require(_0x3d2a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d2a('0x12'))(_0x3d2a('0x13'));var utils=require('../../config/utils');var config=require(_0x3d2a('0x14'));var licenseUtil=require(_0x3d2a('0x15'));var db=require(_0x3d2a('0x16'))['db'];function respondWithStatusCode(_0x4e8ec9,_0x57e427){_0x57e427=_0x57e427||0xcc;return function(_0x26c84c){if(_0x26c84c){return _0x4e8ec9[_0x3d2a('0x17')](_0x57e427);}return _0x4e8ec9[_0x3d2a('0x18')](_0x57e427)[_0x3d2a('0x19')]();};}function respondWithResult(_0x29f4bf,_0x3e5b25){_0x3e5b25=_0x3e5b25||0xc8;return function(_0x181d35){if(_0x181d35){return _0x29f4bf[_0x3d2a('0x18')](_0x3e5b25)[_0x3d2a('0x1a')](_0x181d35);}};}function respondWithFilteredResult(_0x2ce2fa,_0x219165){return function(_0x36aa57){if(_0x36aa57){var _0x5b9cb2=typeof _0x219165[_0x3d2a('0x1b')]===_0x3d2a('0x1c')&&typeof _0x219165[_0x3d2a('0x1d')]===_0x3d2a('0x1c');var _0x2ea16d=_0x36aa57[_0x3d2a('0x1e')];var _0x3bb5a5=_0x5b9cb2?0x0:_0x219165[_0x3d2a('0x1b')];var _0x5522b9=_0x5b9cb2?_0x36aa57[_0x3d2a('0x1e')]:_0x219165[_0x3d2a('0x1b')]+_0x219165[_0x3d2a('0x1d')];var _0x192ae1;if(_0x5522b9>=_0x2ea16d){_0x5522b9=_0x2ea16d;_0x192ae1=0xc8;}else{_0x192ae1=0xce;}_0x2ce2fa[_0x3d2a('0x18')](_0x192ae1);return _0x2ce2fa[_0x3d2a('0x1f')]('Content-Range',_0x3bb5a5+'-'+_0x5522b9+'/'+_0x2ea16d)[_0x3d2a('0x1a')](_0x36aa57);}return null;};}function patchUpdates(_0x356a66){return function(_0x584b51){try{jsonpatch[_0x3d2a('0x20')](_0x584b51,_0x356a66,!![]);}catch(_0x49b085){return BPromise[_0x3d2a('0x21')](_0x49b085);}return _0x584b51[_0x3d2a('0x22')]();};}function saveUpdates(_0x3d3977,_0x435979){return function(_0xcdf4fb){if(_0xcdf4fb){return _0xcdf4fb[_0x3d2a('0x23')](_0x3d3977)[_0x3d2a('0x24')](function(_0x4645fb){return _0x4645fb;});}return null;};}function removeEntity(_0x3f9812,_0x5bcdca){return function(_0x1b2afd){if(_0x1b2afd){return _0x1b2afd[_0x3d2a('0x25')]()['then'](function(){var _0x4add6b=_0x1b2afd['get']({'plain':!![]});var _0x5afac4=_0x3d2a('0x26');return db[_0x3d2a('0x27')][_0x3d2a('0x25')]({'where':{'type':_0x5afac4,'resourceId':_0x4add6b['id']}})[_0x3d2a('0x24')](function(){return _0x1b2afd;});})[_0x3d2a('0x24')](function(){_0x3f9812['status'](0xcc)[_0x3d2a('0x19')]();});}};}function handleEntityNotFound(_0x15ffca,_0x10c73d){return function(_0x4fa84f){if(!_0x4fa84f){_0x15ffca[_0x3d2a('0x17')](0x194);}return _0x4fa84f;};}function handleError(_0x25cc98,_0x11460e){_0x11460e=_0x11460e||0x1f4;return function(_0x4a426a){logger[_0x3d2a('0x28')](_0x4a426a[_0x3d2a('0x29')]);if(_0x4a426a[_0x3d2a('0x2a')]){delete _0x4a426a[_0x3d2a('0x2a')];}_0x25cc98[_0x3d2a('0x18')](_0x11460e)['send'](_0x4a426a);};}exports['index']=function(_0x19d9da,_0x8d56db){var _0x177ffd={},_0x400fb5={},_0x488d7c={'count':0x0,'rows':[]};var _0x59af90=_[_0x3d2a('0x2b')](db[_0x3d2a('0x2c')][_0x3d2a('0x2d')],function(_0x271e21){return{'name':_0x271e21[_0x3d2a('0x2e')],'type':_0x271e21['type']['key']};});_0x400fb5[_0x3d2a('0x2f')]=_[_0x3d2a('0x2b')](_0x59af90,_0x3d2a('0x2a'));_0x400fb5[_0x3d2a('0x30')]=_[_0x3d2a('0x31')](_0x19d9da[_0x3d2a('0x30')]);_0x400fb5[_0x3d2a('0x32')]=_['intersection'](_0x400fb5['model'],_0x400fb5[_0x3d2a('0x30')]);_0x177ffd['attributes']=_[_0x3d2a('0x33')](_0x400fb5[_0x3d2a('0x2f')],qs[_0x3d2a('0x34')](_0x19d9da[_0x3d2a('0x30')]['fields']));_0x177ffd[_0x3d2a('0x35')]=_0x177ffd[_0x3d2a('0x35')][_0x3d2a('0x36')]?_0x177ffd[_0x3d2a('0x35')]:_0x400fb5[_0x3d2a('0x2f')];if(!_0x19d9da[_0x3d2a('0x30')][_0x3d2a('0x37')](_0x3d2a('0x38'))){_0x177ffd[_0x3d2a('0x1d')]=qs[_0x3d2a('0x1d')](_0x19d9da['query'][_0x3d2a('0x1d')]);_0x177ffd[_0x3d2a('0x1b')]=qs[_0x3d2a('0x1b')](_0x19d9da[_0x3d2a('0x30')][_0x3d2a('0x1b')]);}_0x177ffd['order']=qs[_0x3d2a('0x39')](_0x19d9da['query']['sort']);_0x177ffd[_0x3d2a('0x3a')]=qs[_0x3d2a('0x32')](_[_0x3d2a('0x3b')](_0x19d9da[_0x3d2a('0x30')],_0x400fb5[_0x3d2a('0x32')]),_0x59af90);if(_0x19d9da[_0x3d2a('0x30')][_0x3d2a('0x3c')]){_0x177ffd['where']=_[_0x3d2a('0x3d')](_0x177ffd[_0x3d2a('0x3a')],{'$or':_[_0x3d2a('0x2b')](_0x59af90,function(_0x53582b){if(_0x53582b[_0x3d2a('0x3e')]!==_0x3d2a('0x3f')){var _0x290d43={};_0x290d43[_0x53582b[_0x3d2a('0x2a')]]={'$like':'%'+_0x19d9da[_0x3d2a('0x30')][_0x3d2a('0x3c')]+'%'};return _0x290d43;}})});}_0x177ffd=_[_0x3d2a('0x3d')]({},_0x177ffd,_0x19d9da[_0x3d2a('0x40')]);var _0x1186f6={'where':_0x177ffd[_0x3d2a('0x3a')]};return db[_0x3d2a('0x2c')][_0x3d2a('0x1e')](_0x1186f6)[_0x3d2a('0x24')](function(_0x2be6c4){_0x488d7c[_0x3d2a('0x1e')]=_0x2be6c4;if(_0x19d9da[_0x3d2a('0x30')]['includeAll']){_0x177ffd[_0x3d2a('0x41')]=[{'all':!![]}];}return db[_0x3d2a('0x2c')][_0x3d2a('0x42')](_0x177ffd);})[_0x3d2a('0x24')](function(_0x1079b1){_0x488d7c[_0x3d2a('0x43')]=_0x1079b1;return _0x488d7c;})['then'](respondWithFilteredResult(_0x8d56db,_0x177ffd))[_0x3d2a('0x44')](handleError(_0x8d56db,null));};exports['show']=function(_0x429880,_0x8647dc){var _0x5c81bf={'raw':!![],'where':{'id':_0x429880[_0x3d2a('0x45')]['id']}},_0x1a9193={};_0x1a9193[_0x3d2a('0x2f')]=_[_0x3d2a('0x31')](db[_0x3d2a('0x2c')][_0x3d2a('0x2d')]);_0x1a9193['query']=_[_0x3d2a('0x31')](_0x429880[_0x3d2a('0x30')]);_0x1a9193[_0x3d2a('0x32')]=_[_0x3d2a('0x33')](_0x1a9193[_0x3d2a('0x2f')],_0x1a9193[_0x3d2a('0x30')]);_0x5c81bf[_0x3d2a('0x35')]=_[_0x3d2a('0x33')](_0x1a9193['model'],qs[_0x3d2a('0x34')](_0x429880['query'][_0x3d2a('0x34')]));_0x5c81bf['attributes']=_0x5c81bf[_0x3d2a('0x35')][_0x3d2a('0x36')]?_0x5c81bf[_0x3d2a('0x35')]:_0x1a9193[_0x3d2a('0x2f')];if(_0x429880[_0x3d2a('0x30')][_0x3d2a('0x46')]){_0x5c81bf['include']=[{'all':!![]}];}_0x5c81bf=_[_0x3d2a('0x3d')]({},_0x5c81bf,_0x429880[_0x3d2a('0x40')]);return db[_0x3d2a('0x2c')][_0x3d2a('0x47')](_0x5c81bf)[_0x3d2a('0x24')](handleEntityNotFound(_0x8647dc,null))[_0x3d2a('0x24')](respondWithResult(_0x8647dc,null))['catch'](handleError(_0x8647dc,null));};exports[_0x3d2a('0x48')]=function(_0xd3da8b,_0x1722f4){return db[_0x3d2a('0x2c')]['create'](_0xd3da8b[_0x3d2a('0x49')],{})[_0x3d2a('0x24')](function(_0x29f705){var _0x13f96d=_0xd3da8b['user'][_0x3d2a('0x4a')]({'plain':!![]});if(!_0x13f96d)throw new Error(_0x3d2a('0x4b'));if(_0x13f96d[_0x3d2a('0x4c')]==='user'){var _0x4affc6=_0x29f705[_0x3d2a('0x4a')]({'plain':!![]});var _0x3b315e=_0x3d2a('0x26');return db[_0x3d2a('0x4d')][_0x3d2a('0x47')]({'where':{'name':_0x3b315e,'userProfileId':_0x13f96d[_0x3d2a('0x4e')]},'raw':!![]})['then'](function(_0x2f23a3){if(_0x2f23a3&&_0x2f23a3[_0x3d2a('0x4f')]===0x0){return db[_0x3d2a('0x27')]['create']({'name':_0x4affc6[_0x3d2a('0x2a')],'resourceId':_0x4affc6['id'],'type':_0x2f23a3[_0x3d2a('0x2a')],'sectionId':_0x2f23a3['id']},{})[_0x3d2a('0x24')](function(){return _0x29f705;});}else{return _0x29f705;}})['catch'](function(_0x457570){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x457570);throw _0x457570;});}return _0x29f705;})[_0x3d2a('0x24')](respondWithResult(_0x1722f4,0xc9))[_0x3d2a('0x44')](handleError(_0x1722f4,null));};exports[_0x3d2a('0x23')]=function(_0x343384,_0x50bec0){if(_0x343384[_0x3d2a('0x49')]['id']){delete _0x343384[_0x3d2a('0x49')]['id'];}return db[_0x3d2a('0x2c')][_0x3d2a('0x47')]({'where':{'id':_0x343384[_0x3d2a('0x45')]['id']}})[_0x3d2a('0x24')](handleEntityNotFound(_0x50bec0,null))['then'](saveUpdates(_0x343384['body'],null))[_0x3d2a('0x24')](respondWithResult(_0x50bec0,null))[_0x3d2a('0x44')](handleError(_0x50bec0,null));};exports[_0x3d2a('0x25')]=function(_0x43c05a,_0x445d94){return db[_0x3d2a('0x2c')][_0x3d2a('0x47')]({'where':{'id':_0x43c05a[_0x3d2a('0x45')]['id']}})['then'](handleEntityNotFound(_0x445d94,null))[_0x3d2a('0x24')](removeEntity(_0x445d94,null))[_0x3d2a('0x44')](handleError(_0x445d94,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 6c1434d..a0d2e23 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 _0xb1bc=['ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name'];(function(_0x497a23,_0x5ec612){var _0x203203=function(_0x15c44b){while(--_0x15c44b){_0x497a23['push'](_0x497a23['shift']());}};_0x203203(++_0x5ec612);}(_0xb1bc,0xf1));var _0xcb1b=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xb1bc[_0x43f881];return _0x365c14;};'use strict';var _=require(_0xcb1b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcb1b('0x1'));var moment=require('moment');var BPromise=require(_0xcb1b('0x2'));var rp=require(_0xcb1b('0x3'));var fs=require('fs');var path=require(_0xcb1b('0x4'));var rimraf=require(_0xcb1b('0x5'));var config=require(_0xcb1b('0x6'));var attributes=require(_0xcb1b('0x7'));module['exports']=function(_0x21828c,_0x4208d3){return _0x21828c[_0xcb1b('0x8')](_0xcb1b('0x9'),attributes,{'tableName':_0xcb1b('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xcb1b('0xb'),_0xcb1b('0xc')]},{'unique':!![],'name':_0xcb1b('0xd'),'fields':[_0xcb1b('0xb'),_0xcb1b('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0xcb1b('0xb'),_0xcb1b('0xf')]},{'unique':!![],'name':_0xcb1b('0x10'),'fields':['name',_0xcb1b('0x11')]},{'unique':!![],'name':_0xcb1b('0x12'),'fields':[_0xcb1b('0xb'),_0xcb1b('0x13')]},{'unique':!![],'name':_0xcb1b('0x14'),'fields':[_0xcb1b('0xb'),_0xcb1b('0x15')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xcb1b('0xb'),_0xcb1b('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc07=['exports','Disposition','name_voice','name','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./disposition.attributes'];(function(_0x51fce0,_0x36e4f2){var _0xe01f2c=function(_0x13eea0){while(--_0x13eea0){_0x51fce0['push'](_0x51fce0['shift']());}};_0xe01f2c(++_0x36e4f2);}(_0xdc07,0x1c6));var _0x7dc0=function(_0x525a27,_0x2b405b){_0x525a27=_0x525a27-0x0;var _0x1b3121=_0xdc07[_0x525a27];return _0x1b3121;};'use strict';var _=require(_0x7dc0('0x0'));var util=require(_0x7dc0('0x1'));var logger=require(_0x7dc0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7dc0('0x3'));var fs=require('fs');var path=require(_0x7dc0('0x4'));var rimraf=require(_0x7dc0('0x5'));var config=require(_0x7dc0('0x6'));var attributes=require(_0x7dc0('0x7'));module[_0x7dc0('0x8')]=function(_0x31b7b4,_0x4fb122){return _0x31b7b4['define'](_0x7dc0('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x7dc0('0xa'),'fields':[_0x7dc0('0xb'),'ListId']},{'unique':!![],'name':_0x7dc0('0xc'),'fields':[_0x7dc0('0xb'),_0x7dc0('0xd')]},{'unique':!![],'name':_0x7dc0('0xe'),'fields':[_0x7dc0('0xb'),'MailAccountId']},{'unique':!![],'name':_0x7dc0('0xf'),'fields':[_0x7dc0('0xb'),_0x7dc0('0x10')]},{'unique':!![],'name':_0x7dc0('0x11'),'fields':[_0x7dc0('0xb'),_0x7dc0('0x12')]},{'unique':!![],'name':'name_openchannel','fields':[_0x7dc0('0xb'),_0x7dc0('0x13')]},{'unique':!![],'name':_0x7dc0('0x14'),'fields':[_0x7dc0('0xb'),'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 14f7183..f87f810 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(_0x2c2161,_0x5735cc){var _0x24513e=function(_0x10b2ae){while(--_0x10b2ae){_0x2c2161['push'](_0x2c2161['shift']());}};_0x24513e(++_0x5735cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x50e16b,_0x5168aa){var _0x7bc641=function(_0x1a148b){while(--_0x1a148b){_0x50e16b['push'](_0x50e16b['shift']());}};_0x7bc641(++_0x5168aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index a329a69..dc7bf32 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 _0x2cff=['../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x2cff,0x118));var _0xf2cf=function(_0x5a88a3,_0x390636){_0x5a88a3=_0x5a88a3-0x0;var _0x7faf3d=_0x2cff[_0x5a88a3];return _0x7faf3d;};'use strict';var multer=require(_0xf2cf('0x0'));var util=require('util');var path=require(_0xf2cf('0x1'));var timeout=require('connect-timeout');var express=require(_0xf2cf('0x2'));var router=express['Router']();var fs_extra=require(_0xf2cf('0x3'));var auth=require(_0xf2cf('0x4'));var interaction=require(_0xf2cf('0x5'));var config=require(_0xf2cf('0x6'));var controller=require(_0xf2cf('0x7'));router[_0xf2cf('0x8')]('/',auth[_0xf2cf('0x9')](),controller[_0xf2cf('0xa')]);router[_0xf2cf('0x8')](_0xf2cf('0xb'),auth[_0xf2cf('0x9')](),controller[_0xf2cf('0xc')]);router['post']('/',auth[_0xf2cf('0x9')](),controller[_0xf2cf('0xd')]);router[_0xf2cf('0xe')]('/:id',auth[_0xf2cf('0x9')](),controller[_0xf2cf('0xf')]);router[_0xf2cf('0x10')](_0xf2cf('0xb'),auth['isAuthenticated'](),controller[_0xf2cf('0x11')]);module[_0xf2cf('0x12')]=router; \ No newline at end of file +var _0x4031=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0x2533be,_0x1f9612){var _0x51c8ee=function(_0x591b65){while(--_0x591b65){_0x2533be['push'](_0x2533be['shift']());}};_0x51c8ee(++_0x1f9612);}(_0x4031,0xf7));var _0x1403=function(_0x1c7f5a,_0x2f55d9){_0x1c7f5a=_0x1c7f5a-0x0;var _0x289b16=_0x4031[_0x1c7f5a];return _0x289b16;};'use strict';var multer=require(_0x1403('0x0'));var util=require(_0x1403('0x1'));var path=require(_0x1403('0x2'));var timeout=require(_0x1403('0x3'));var express=require('express');var router=express[_0x1403('0x4')]();var fs_extra=require(_0x1403('0x5'));var auth=require(_0x1403('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1403('0x7'));var controller=require('./disposition.controller');router[_0x1403('0x8')]('/',auth[_0x1403('0x9')](),controller[_0x1403('0xa')]);router['get'](_0x1403('0xb'),auth[_0x1403('0x9')](),controller[_0x1403('0xc')]);router[_0x1403('0xd')]('/',auth[_0x1403('0x9')](),controller[_0x1403('0xe')]);router[_0x1403('0xf')](_0x1403('0xb'),auth[_0x1403('0x9')](),controller['update']);router[_0x1403('0x10')](_0x1403('0xb'),auth[_0x1403('0x9')](),controller[_0x1403('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 9777e39..584820f 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 _0xf474=['ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING'];(function(_0x4711ca,_0x53876e){var _0x3b44a2=function(_0x43b32d){while(--_0x43b32d){_0x4711ca['push'](_0x4711ca['shift']());}};_0x3b44a2(++_0x53876e);}(_0xf474,0x11d));var _0x4f47=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xf474[_0x243b59];return _0x3e1676;};'use strict';var Sequelize=require(_0x4f47('0x0'));module[_0x4f47('0x1')]={'name':{'type':Sequelize[_0x4f47('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4f47('0x2')]},'ecm':{'type':Sequelize[_0x4f47('0x3')](_0x4f47('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x4f47('0x2')],'defaultValue':_0x4f47('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x4f47('0x3')](_0x4f47('0x6'),_0x4f47('0x7'),_0x4f47('0x8'),_0x4f47('0x9'),_0x4f47('0xa'),_0x4f47('0xb')),'defaultValue':_0x4f47('0x7')},'maxrate':{'type':Sequelize[_0x4f47('0x3')](_0x4f47('0x6'),_0x4f47('0x7'),_0x4f47('0x8'),'9600','12000',_0x4f47('0xb')),'defaultValue':_0x4f47('0xb')},'modem':{'type':Sequelize[_0x4f47('0x2')],'defaultValue':_0x4f47('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4f47('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4f47('0x3')](_0x4f47('0xd'),_0x4f47('0xe'),_0x4f47('0xf'),'KHOMP'),'defaultValue':_0x4f47('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4f47('0x10')],'defaultValue':function(){return _0x4f47('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4f47('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4f47('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4f47('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4f47('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4f47('0x13')],'allowNull':!![],'defaultValue':null,'comment':_0x4f47('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x4f47('0x12')],'defaultValue':![],'comment':_0x4f47('0x15'),'set':function(_0x1e60c2){if(!_0x1e60c2)this[_0x4f47('0x16')](_0x4f47('0x17'),null);this[_0x4f47('0x16')]('mandatoryDisposition',_0x1e60c2);}}}; \ No newline at end of file +var _0x97f4=['DADHI','KHOMP','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','mandatoryDisposition','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','ENUM','INTEGER','SIP','IAX'];(function(_0x5cb085,_0x3b6a03){var _0x2b7d5f=function(_0x5db6a2){while(--_0x5db6a2){_0x5cb085['push'](_0x5cb085['shift']());}};_0x2b7d5f(++_0x3b6a03);}(_0x97f4,0x141));var _0x497f=function(_0x221923,_0x1d0883){_0x221923=_0x221923-0x0;var _0xb9acee=_0x97f4[_0x221923];return _0xb9acee;};'use strict';var Sequelize=require('sequelize');module[_0x497f('0x0')]={'name':{'type':Sequelize[_0x497f('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x497f('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x497f('0x2'),'no'),'defaultValue':_0x497f('0x2')},'headerinfo':{'type':Sequelize[_0x497f('0x1')],'defaultValue':_0x497f('0x3')},'localstationid':{'type':Sequelize[_0x497f('0x1')],'unique':_0x497f('0x4')},'minrate':{'type':Sequelize['ENUM'](_0x497f('0x5'),_0x497f('0x6'),_0x497f('0x7'),_0x497f('0x8'),_0x497f('0x9'),_0x497f('0xa')),'defaultValue':_0x497f('0x6')},'maxrate':{'type':Sequelize[_0x497f('0xb')]('2400',_0x497f('0x6'),_0x497f('0x7'),_0x497f('0x8'),_0x497f('0x9'),_0x497f('0xa')),'defaultValue':_0x497f('0xa')},'modem':{'type':Sequelize[_0x497f('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x497f('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x497f('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x497f('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x497f('0xb')](_0x497f('0xd'),_0x497f('0xe'),_0x497f('0xf'),_0x497f('0x10')),'defaultValue':_0x497f('0xd')},'key':{'type':Sequelize[_0x497f('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x497f('0x11')],'defaultValue':function(){return _0x497f('0x12');}},'notificationSound':{'type':Sequelize[_0x497f('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x497f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x497f('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x497f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x497f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x497f('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x497f('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x497f('0x13')],'defaultValue':![],'comment':_0x497f('0x15'),'set':function(_0x20c096){if(!_0x20c096)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x497f('0x16')](_0x497f('0x17'),_0x20c096);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 050c6ab..69ae1d6 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 _0x6eb9=['tech','updatedAt','TrunkId','findById','FaxMessage','$gte','split','format','send','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','path','isNil','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','undefined','limit','count','offset','set','json','apply','save','update','destroy','FaxAccounts','UserProfileResource','sendStatus','stack','name','mandatoryDispositionPause','map','FaxAccount','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','rows','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','getApplications','from-voip-provider','localstationid','app','system','description','priority','appdata','push','Answer','Set','ecm','faxdetect','maxrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension'];(function(_0x1c54fc,_0x147d21){var _0x325825=function(_0x3860d4){while(--_0x3860d4){_0x1c54fc['push'](_0x1c54fc['shift']());}};_0x325825(++_0x147d21);}(_0x6eb9,0x1ae));var _0x96eb=function(_0x93c171,_0x2b3a4c){_0x93c171=_0x93c171-0x0;var _0x4970d9=_0x6eb9[_0x93c171];return _0x4970d9;};'use strict';var emlformat=require(_0x96eb('0x0'));var rimraf=require(_0x96eb('0x1'));var zipdir=require(_0x96eb('0x2'));var jsonpatch=require(_0x96eb('0x3'));var rp=require(_0x96eb('0x4'));var moment=require(_0x96eb('0x5'));var BPromise=require(_0x96eb('0x6'));var Mustache=require(_0x96eb('0x7'));var util=require(_0x96eb('0x8'));var path=require('path');var sox=require(_0x96eb('0x9'));var csv=require(_0x96eb('0xa'));var ejs=require(_0x96eb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96eb('0xc'));var squel=require(_0x96eb('0xd'));var crypto=require('crypto');var jsforce=require(_0x96eb('0xe'));var deskjs=require(_0x96eb('0xf'));var toCsv=require(_0x96eb('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x96eb('0x10'));var as=require(_0x96eb('0x11'));var hardwareService=require(_0x96eb('0x12'));var logger=require(_0x96eb('0x13'))(_0x96eb('0x14'));var utils=require(_0x96eb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x96eb('0x16'));var db=require(_0x96eb('0x17'))['db'];config[_0x96eb('0x18')]=_[_0x96eb('0x19')](config[_0x96eb('0x18')],{'host':_0x96eb('0x1a'),'port':0x18eb});var socket=require(_0x96eb('0x1b'))(new Redis(config[_0x96eb('0x18')]));require(_0x96eb('0x1c'))[_0x96eb('0x1d')](socket);var jayson=require(_0x96eb('0x1e'));var client=jayson[_0x96eb('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x96eb('0x1f')][_0x96eb('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x498dcf,_0x174709,_0x3c793b,_0x41e974){return new BPromise(function(_0x202ab6,_0x1e2b8d){var _0x2e4f70=_0x41e974||client;return _0x2e4f70[_0x96eb('0x21')](_0x498dcf,_0x3c793b)[_0x96eb('0x22')](function(_0x9e7814){logger[_0x96eb('0x23')](_0x96eb('0x24'),_0x174709,_0x96eb('0x25'));logger[_0x96eb('0x26')](_0x96eb('0x27'),_0x174709,_0x96eb('0x25'),JSON[_0x96eb('0x28')](_0x9e7814));if(_0x9e7814[_0x96eb('0x29')]){if(_0x9e7814['error'][_0x96eb('0x2a')]===0x1f4){logger['error'](_0x96eb('0x24'),_0x174709,_0x9e7814[_0x96eb('0x29')][_0x96eb('0x2b')]);return _0x1e2b8d(_0x9e7814[_0x96eb('0x29')]['message']);}logger[_0x96eb('0x29')](_0x96eb('0x24'),_0x174709,_0x9e7814[_0x96eb('0x29')]['message']);return _0x202ab6(_0x9e7814[_0x96eb('0x29')][_0x96eb('0x2b')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x174709,_0x96eb('0x25'));_0x202ab6(_0x9e7814[_0x96eb('0x2c')][_0x96eb('0x2b')]);}})['catch'](function(_0xf140c0){logger[_0x96eb('0x29')](_0x96eb('0x24'),_0x174709,_0xf140c0);_0x1e2b8d(_0xf140c0);});});}function respondWithStatusCode(_0xfe18a0,_0x4165b6){_0x4165b6=_0x4165b6||0xcc;return function(_0x14220b){if(_0x14220b){return _0xfe18a0['sendStatus'](_0x4165b6);}return _0xfe18a0[_0x96eb('0x2d')](_0x4165b6)[_0x96eb('0x2e')]();};}function respondWithResult(_0x273fd0,_0x4958e7){_0x4958e7=_0x4958e7||0xc8;return function(_0x36fdd7){if(_0x36fdd7){return _0x273fd0[_0x96eb('0x2d')](_0x4958e7)['json'](_0x36fdd7);}};}function respondWithFilteredResult(_0x464e70,_0x5c4b5a){return function(_0xc6d0ed){if(_0xc6d0ed){var _0x137bcd=typeof _0x5c4b5a['offset']===_0x96eb('0x2f')&&typeof _0x5c4b5a[_0x96eb('0x30')]===_0x96eb('0x2f');var _0x30271d=_0xc6d0ed[_0x96eb('0x31')];var _0x403f71=_0x137bcd?0x0:_0x5c4b5a[_0x96eb('0x32')];var _0x104482=_0x137bcd?_0xc6d0ed[_0x96eb('0x31')]:_0x5c4b5a[_0x96eb('0x32')]+_0x5c4b5a[_0x96eb('0x30')];var _0x958be1;if(_0x104482>=_0x30271d){_0x104482=_0x30271d;_0x958be1=0xc8;}else{_0x958be1=0xce;}_0x464e70[_0x96eb('0x2d')](_0x958be1);return _0x464e70[_0x96eb('0x33')]('Content-Range',_0x403f71+'-'+_0x104482+'/'+_0x30271d)[_0x96eb('0x34')](_0xc6d0ed);}return null;};}function patchUpdates(_0xc5b907){return function(_0x1480f4){try{jsonpatch[_0x96eb('0x35')](_0x1480f4,_0xc5b907,!![]);}catch(_0x124438){return BPromise['reject'](_0x124438);}return _0x1480f4[_0x96eb('0x36')]();};}function saveUpdates(_0x209f77,_0x234d20){return function(_0x393813){if(_0x393813){return _0x393813[_0x96eb('0x37')](_0x209f77)[_0x96eb('0x22')](function(_0x23a8cd){return _0x23a8cd;});}return null;};}function removeEntity(_0x422e93,_0x339584){return function(_0x2b1e33){if(_0x2b1e33){return _0x2b1e33[_0x96eb('0x38')]()['then'](function(){var _0x13535f=_0x2b1e33['get']({'plain':!![]});var _0x4dd823=_0x96eb('0x39');return db[_0x96eb('0x3a')]['destroy']({'where':{'type':_0x4dd823,'resourceId':_0x13535f['id']}})[_0x96eb('0x22')](function(){return _0x2b1e33;});})[_0x96eb('0x22')](function(){_0x422e93[_0x96eb('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31ad40,_0x36706a){return function(_0x563cf0){if(!_0x563cf0){_0x31ad40[_0x96eb('0x3b')](0x194);}return _0x563cf0;};}function handleError(_0x1df22f,_0x2fc623){_0x2fc623=_0x2fc623||0x1f4;return function(_0x2ab9c3){logger[_0x96eb('0x29')](_0x2ab9c3[_0x96eb('0x3c')]);if(_0x2ab9c3[_0x96eb('0x3d')]){delete _0x2ab9c3['name'];}_0x1df22f[_0x96eb('0x2d')](_0x2fc623)['send'](_0x2ab9c3);};}exports['index']=function(_0x5ecf24,_0x13b8c){var _0xcf334d={'include':[{'model':db['Pause'],'as':_0x96eb('0x3e')}]},_0x31beb4={},_0x5ddddb={'count':0x0,'rows':[]};var _0x405961=_[_0x96eb('0x3f')](db[_0x96eb('0x40')][_0x96eb('0x41')],function(_0x42a3d2){return{'name':_0x42a3d2['fieldName'],'type':_0x42a3d2['type'][_0x96eb('0x42')]};});_0x31beb4[_0x96eb('0x43')]=_[_0x96eb('0x3f')](_0x405961,_0x96eb('0x3d'));_0x31beb4[_0x96eb('0x44')]=_[_0x96eb('0x45')](_0x5ecf24['query']);_0x31beb4[_0x96eb('0x46')]=_['intersection'](_0x31beb4[_0x96eb('0x43')],_0x31beb4[_0x96eb('0x44')]);_0xcf334d['attributes']=_[_0x96eb('0x47')](_0x31beb4[_0x96eb('0x43')],qs['fields'](_0x5ecf24[_0x96eb('0x44')][_0x96eb('0x48')]));_0xcf334d[_0x96eb('0x49')]=_0xcf334d[_0x96eb('0x49')][_0x96eb('0x4a')]?_0xcf334d['attributes']:_0x31beb4[_0x96eb('0x43')];if(!_0x5ecf24[_0x96eb('0x44')][_0x96eb('0x4b')]('nolimit')){_0xcf334d[_0x96eb('0x30')]=qs[_0x96eb('0x30')](_0x5ecf24[_0x96eb('0x44')][_0x96eb('0x30')]);_0xcf334d[_0x96eb('0x32')]=qs[_0x96eb('0x32')](_0x5ecf24[_0x96eb('0x44')][_0x96eb('0x32')]);}_0xcf334d[_0x96eb('0x4c')]=qs[_0x96eb('0x4d')](_0x5ecf24[_0x96eb('0x44')][_0x96eb('0x4d')]);_0xcf334d[_0x96eb('0x4e')]=qs['filters'](_[_0x96eb('0x4f')](_0x5ecf24[_0x96eb('0x44')],_0x31beb4[_0x96eb('0x46')]),_0x405961);if(_0x5ecf24[_0x96eb('0x44')][_0x96eb('0x50')]){_0xcf334d[_0x96eb('0x4e')]=_['merge'](_0xcf334d['where'],{'$or':_['map'](_0x405961,function(_0x7b7602){if(_0x7b7602[_0x96eb('0x51')]!==_0x96eb('0x52')){var _0x4b98d8={};_0x4b98d8[_0x7b7602[_0x96eb('0x3d')]]={'$like':'%'+_0x5ecf24[_0x96eb('0x44')]['filter']+'%'};return _0x4b98d8;}})});}_0xcf334d=_[_0x96eb('0x53')]({},_0xcf334d,_0x5ecf24[_0x96eb('0x54')]);var _0x5c3c33={'where':_0xcf334d['where']};return db[_0x96eb('0x40')][_0x96eb('0x31')](_0x5c3c33)[_0x96eb('0x22')](function(_0x43d46c){_0x5ddddb[_0x96eb('0x31')]=_0x43d46c;if(_0x5ecf24[_0x96eb('0x44')][_0x96eb('0x55')]){_0xcf334d[_0x96eb('0x56')]=[{'all':!![]}];}return db[_0x96eb('0x40')][_0x96eb('0x57')](_0xcf334d);})['then'](function(_0x2aaa90){_0x5ddddb['rows']=_0x2aaa90;return _0x5ddddb;})['then'](respondWithFilteredResult(_0x13b8c,_0xcf334d))[_0x96eb('0x58')](handleError(_0x13b8c,null));};exports[_0x96eb('0x59')]=function(_0x28404e,_0x3e8328){var _0x438eae={'raw':![],'where':{'id':_0x28404e[_0x96eb('0x5a')]['id']},'include':[{'model':db[_0x96eb('0x5b')],'as':_0x96eb('0x3e')}]},_0x1e55ab={};_0x1e55ab[_0x96eb('0x43')]=_[_0x96eb('0x45')](db[_0x96eb('0x40')][_0x96eb('0x41')]);_0x1e55ab['query']=_[_0x96eb('0x45')](_0x28404e[_0x96eb('0x44')]);_0x1e55ab[_0x96eb('0x46')]=_['intersection'](_0x1e55ab['model'],_0x1e55ab['query']);_0x438eae['attributes']=_[_0x96eb('0x47')](_0x1e55ab[_0x96eb('0x43')],qs[_0x96eb('0x48')](_0x28404e[_0x96eb('0x44')][_0x96eb('0x48')]));_0x438eae[_0x96eb('0x49')]=_0x438eae[_0x96eb('0x49')][_0x96eb('0x4a')]?_0x438eae[_0x96eb('0x49')]:_0x1e55ab['model'];if(_0x28404e[_0x96eb('0x44')][_0x96eb('0x55')]){_0x438eae[_0x96eb('0x56')]=[{'all':!![]}];}_0x438eae=_[_0x96eb('0x53')]({},_0x438eae,_0x28404e[_0x96eb('0x54')]);return db[_0x96eb('0x40')][_0x96eb('0x5c')](_0x438eae)['then'](handleEntityNotFound(_0x3e8328,null))[_0x96eb('0x22')](respondWithResult(_0x3e8328,null))[_0x96eb('0x58')](handleError(_0x3e8328,null));};exports['create']=function(_0x5d290b,_0x5b5fc6){return db[_0x96eb('0x40')][_0x96eb('0x5d')](_0x5d290b[_0x96eb('0x5e')],{})[_0x96eb('0x22')](function(_0x33646d){var _0x58a70b=_0x5d290b[_0x96eb('0x5f')]['get']({'plain':!![]});if(!_0x58a70b)throw new Error(_0x96eb('0x60'));if(_0x58a70b[_0x96eb('0x61')]===_0x96eb('0x5f')){var _0x10b3d0=_0x33646d[_0x96eb('0x62')]({'plain':!![]});var _0x4db348=_0x96eb('0x39');return db[_0x96eb('0x63')]['find']({'where':{'name':_0x4db348,'userProfileId':_0x58a70b['userProfileId']},'raw':!![]})[_0x96eb('0x22')](function(_0x294bbb){if(_0x294bbb&&_0x294bbb[_0x96eb('0x64')]===0x0){return db[_0x96eb('0x3a')]['create']({'name':_0x10b3d0[_0x96eb('0x3d')],'resourceId':_0x10b3d0['id'],'type':_0x294bbb[_0x96eb('0x3d')],'sectionId':_0x294bbb['id']},{})[_0x96eb('0x22')](function(){return _0x33646d;});}else{return _0x33646d;}})[_0x96eb('0x58')](function(_0x8fdca0){logger[_0x96eb('0x29')](_0x96eb('0x65'),_0x8fdca0);throw _0x8fdca0;});}return _0x33646d;})[_0x96eb('0x22')](respondWithResult(_0x5b5fc6,0xc9))[_0x96eb('0x58')](handleError(_0x5b5fc6,null));};exports['update']=function(_0x4e38ad,_0x475496){if(_0x4e38ad[_0x96eb('0x5e')]['id']){delete _0x4e38ad[_0x96eb('0x5e')]['id'];}return db[_0x96eb('0x40')]['find']({'where':{'id':_0x4e38ad[_0x96eb('0x5a')]['id']},'include':[{'model':db[_0x96eb('0x5b')],'as':_0x96eb('0x3e')}]})[_0x96eb('0x22')](handleEntityNotFound(_0x475496,null))[_0x96eb('0x22')](saveUpdates(_0x4e38ad[_0x96eb('0x5e')],null))[_0x96eb('0x22')](respondWithResult(_0x475496,null))[_0x96eb('0x58')](handleError(_0x475496,null));};exports[_0x96eb('0x38')]=function(_0x53820e,_0x9c0b0d){return db[_0x96eb('0x40')][_0x96eb('0x5c')]({'where':{'id':_0x53820e[_0x96eb('0x5a')]['id']}})[_0x96eb('0x22')](handleEntityNotFound(_0x9c0b0d,null))[_0x96eb('0x22')](removeEntity(_0x9c0b0d,null))[_0x96eb('0x58')](handleError(_0x9c0b0d,null));};exports[_0x96eb('0x66')]=function(_0x4a67a5,_0x13e80e){return db[_0x96eb('0x40')][_0x96eb('0x66')]()[_0x96eb('0x22')](respondWithResult(_0x13e80e,null))[_0x96eb('0x58')](handleError(_0x13e80e,null));};exports[_0x96eb('0x67')]=function(_0x3231a6,_0x4a8963,_0x2e2f8f){if(_0x3231a6[_0x96eb('0x5e')]['id']){delete _0x3231a6[_0x96eb('0x5e')]['id'];}return db[_0x96eb('0x40')][_0x96eb('0x5c')]({'where':{'id':_0x3231a6[_0x96eb('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4a8963,null))[_0x96eb('0x22')](function(_0x21a8a4){if(_0x21a8a4){_0x3231a6[_0x96eb('0x5e')][_0x96eb('0x68')]=_0x21a8a4['id'];return db[_0x96eb('0x69')][_0x96eb('0x5d')](_0x3231a6[_0x96eb('0x5e')]);}})['then'](respondWithResult(_0x4a8963,null))[_0x96eb('0x58')](handleError(_0x4a8963,null));};exports[_0x96eb('0x6a')]=function(_0x5a1c28,_0x1a8bf5,_0x4f61f0){var _0x1642d9={'raw':![],'where':{}};var _0x21b0d5={};var _0x1c3da9={'count':0x0,'rows':[]};return db[_0x96eb('0x40')][_0x96eb('0x6b')]({'where':{'id':_0x5a1c28[_0x96eb('0x5a')]['id']}})[_0x96eb('0x22')](handleEntityNotFound(_0x1a8bf5,null))[_0x96eb('0x22')](function(_0xbfb516){if(_0xbfb516){_0x21b0d5[_0x96eb('0x43')]=_[_0x96eb('0x45')](db[_0x96eb('0x69')][_0x96eb('0x41')]);_0x21b0d5[_0x96eb('0x44')]=_[_0x96eb('0x45')](_0x5a1c28[_0x96eb('0x44')]);_0x21b0d5[_0x96eb('0x46')]=_[_0x96eb('0x47')](_0x21b0d5['model'],_0x21b0d5[_0x96eb('0x44')]);_0x1642d9[_0x96eb('0x49')]=_[_0x96eb('0x47')](_0x21b0d5[_0x96eb('0x43')],qs[_0x96eb('0x48')](_0x5a1c28[_0x96eb('0x44')]['fields']));_0x1642d9['attributes']=_0x1642d9[_0x96eb('0x49')][_0x96eb('0x4a')]?_0x1642d9[_0x96eb('0x49')]:_0x21b0d5['model'];if(!_0x5a1c28[_0x96eb('0x44')][_0x96eb('0x4b')](_0x96eb('0x6c'))){_0x1642d9[_0x96eb('0x30')]=qs[_0x96eb('0x30')](_0x5a1c28[_0x96eb('0x44')][_0x96eb('0x30')]);_0x1642d9[_0x96eb('0x32')]=qs['offset'](_0x5a1c28[_0x96eb('0x44')][_0x96eb('0x32')]);}_0x1642d9[_0x96eb('0x4c')]=qs[_0x96eb('0x4d')](_0x5a1c28[_0x96eb('0x44')][_0x96eb('0x4d')]);_0x1642d9[_0x96eb('0x4e')]=qs[_0x96eb('0x46')](_[_0x96eb('0x4f')](_0x5a1c28[_0x96eb('0x44')],_0x21b0d5[_0x96eb('0x46')]));_0x1642d9[_0x96eb('0x4e')][_0x96eb('0x68')]=_0xbfb516['id'];if(_0x5a1c28[_0x96eb('0x44')][_0x96eb('0x50')]){_0x1642d9['where']=_[_0x96eb('0x53')](_0x1642d9[_0x96eb('0x4e')],{'$or':_[_0x96eb('0x3f')](_0x1642d9[_0x96eb('0x49')],function(_0x273f12){var _0x227a3e={};_0x227a3e[_0x273f12]={'$like':'%'+_0x5a1c28[_0x96eb('0x44')][_0x96eb('0x50')]+'%'};return _0x227a3e;})});}_0x1642d9=_['merge']({},_0x1642d9,_0x5a1c28[_0x96eb('0x54')]);return db[_0x96eb('0x69')]['count']({'where':_0x1642d9['where']})[_0x96eb('0x22')](function(_0x550b1e){_0x1c3da9[_0x96eb('0x31')]=_0x550b1e;if(_0x5a1c28['query'][_0x96eb('0x55')]){_0x1642d9['include']=[{'all':!![]}];}return db[_0x96eb('0x69')]['findAll'](_0x1642d9);})[_0x96eb('0x22')](function(_0xc6ddb0){_0x1c3da9[_0x96eb('0x6d')]=_0xc6ddb0;return _0x1c3da9;});}})[_0x96eb('0x22')](respondWithFilteredResult(_0x1a8bf5,_0x1642d9))[_0x96eb('0x58')](handleError(_0x1a8bf5,null));};exports['removeDispositions']=function(_0x344170,_0x48d716,_0x189505){return db[_0x96eb('0x40')]['find']({'where':{'id':_0x344170['params']['id']}})['then'](handleEntityNotFound(_0x48d716,null))[_0x96eb('0x22')](function(_0x5f4669){if(_0x5f4669){return _0x5f4669['removeDispositions'](_0x344170[_0x96eb('0x44')]['ids']);}})[_0x96eb('0x22')](respondWithStatusCode(_0x48d716,null))[_0x96eb('0x58')](handleError(_0x48d716,null));};exports[_0x96eb('0x6e')]=function(_0x2eba7d,_0x537b28,_0x3f8237){if(_0x2eba7d[_0x96eb('0x5e')]['id']){delete _0x2eba7d[_0x96eb('0x5e')]['id'];}return db[_0x96eb('0x40')]['find']({'where':{'id':_0x2eba7d[_0x96eb('0x5a')]['id']}})['then'](handleEntityNotFound(_0x537b28,null))[_0x96eb('0x22')](function(_0x13fa1a){if(_0x13fa1a){_0x2eba7d[_0x96eb('0x5e')][_0x96eb('0x68')]=_0x13fa1a['id'];return db['CannedAnswer'][_0x96eb('0x5d')](_0x2eba7d[_0x96eb('0x5e')]);}})[_0x96eb('0x22')](respondWithResult(_0x537b28,null))['catch'](handleError(_0x537b28,null));};exports[_0x96eb('0x6f')]=function(_0x570062,_0x315af5,_0x451fc2){var _0x267859={'raw':![],'where':{}};var _0x1679c6={};var _0x2b0c7c={'count':0x0,'rows':[]};return db[_0x96eb('0x40')][_0x96eb('0x6b')]({'where':{'id':_0x570062['params']['id']}})[_0x96eb('0x22')](handleEntityNotFound(_0x315af5,null))[_0x96eb('0x22')](function(_0xfcb148){if(_0xfcb148){_0x1679c6[_0x96eb('0x43')]=_['keys'](db[_0x96eb('0x70')][_0x96eb('0x41')]);_0x1679c6['query']=_[_0x96eb('0x45')](_0x570062[_0x96eb('0x44')]);_0x1679c6[_0x96eb('0x46')]=_[_0x96eb('0x47')](_0x1679c6[_0x96eb('0x43')],_0x1679c6['query']);_0x267859[_0x96eb('0x49')]=_[_0x96eb('0x47')](_0x1679c6[_0x96eb('0x43')],qs[_0x96eb('0x48')](_0x570062[_0x96eb('0x44')][_0x96eb('0x48')]));_0x267859[_0x96eb('0x49')]=_0x267859[_0x96eb('0x49')][_0x96eb('0x4a')]?_0x267859[_0x96eb('0x49')]:_0x1679c6[_0x96eb('0x43')];if(!_0x570062[_0x96eb('0x44')][_0x96eb('0x4b')](_0x96eb('0x6c'))){_0x267859[_0x96eb('0x30')]=qs['limit'](_0x570062[_0x96eb('0x44')][_0x96eb('0x30')]);_0x267859[_0x96eb('0x32')]=qs[_0x96eb('0x32')](_0x570062[_0x96eb('0x44')][_0x96eb('0x32')]);}_0x267859['order']=qs[_0x96eb('0x4d')](_0x570062[_0x96eb('0x44')][_0x96eb('0x4d')]);_0x267859[_0x96eb('0x4e')]=qs['filters'](_['pick'](_0x570062['query'],_0x1679c6[_0x96eb('0x46')]));_0x267859[_0x96eb('0x4e')][_0x96eb('0x68')]=_0xfcb148['id'];if(_0x570062[_0x96eb('0x44')][_0x96eb('0x50')]){_0x267859['where']=_[_0x96eb('0x53')](_0x267859[_0x96eb('0x4e')],{'$or':_['map'](_0x267859[_0x96eb('0x49')],function(_0x5b1bd0){var _0x464499={};_0x464499[_0x5b1bd0]={'$like':'%'+_0x570062[_0x96eb('0x44')]['filter']+'%'};return _0x464499;})});}_0x267859=_['merge']({},_0x267859,_0x570062[_0x96eb('0x54')]);return db[_0x96eb('0x70')][_0x96eb('0x31')]({'where':_0x267859['where']})[_0x96eb('0x22')](function(_0x54f286){_0x2b0c7c[_0x96eb('0x31')]=_0x54f286;if(_0x570062['query'][_0x96eb('0x55')]){_0x267859[_0x96eb('0x56')]=[{'all':!![]}];}return db[_0x96eb('0x70')]['findAll'](_0x267859);})[_0x96eb('0x22')](function(_0x385568){_0x2b0c7c[_0x96eb('0x6d')]=_0x385568;return _0x2b0c7c;});}})[_0x96eb('0x22')](respondWithFilteredResult(_0x315af5,_0x267859))[_0x96eb('0x58')](handleError(_0x315af5,null));};exports[_0x96eb('0x71')]=function(_0xa16c68,_0x27eae7,_0x13d6d0){return db[_0x96eb('0x40')][_0x96eb('0x5c')]({'where':{'id':_0xa16c68[_0x96eb('0x5a')]['id']}})['then'](handleEntityNotFound(_0x27eae7,null))[_0x96eb('0x22')](function(_0x874023){if(_0x874023){return _0x874023[_0x96eb('0x71')](_0xa16c68[_0x96eb('0x44')][_0x96eb('0x72')]);}})[_0x96eb('0x22')](respondWithStatusCode(_0x27eae7,null))[_0x96eb('0x58')](handleError(_0x27eae7,null));};exports[_0x96eb('0x73')]=function(_0x56a63b,_0x401ff9,_0x55c901){return db['FaxInteraction'][_0x96eb('0x5c')]({'where':{'id':_0x56a63b[_0x96eb('0x5a')]['id']}})[_0x96eb('0x22')](handleEntityNotFound(_0x401ff9,null))['then'](function(_0x25d637){if(_0x25d637){return _0x25d637[_0x96eb('0x73')](_0x56a63b[_0x96eb('0x5e')]['ids'],_[_0x96eb('0x74')](_0x56a63b[_0x96eb('0x5e')],[_0x96eb('0x72'),'id'])||{});}})[_0x96eb('0x22')](respondWithResult(_0x401ff9,null))['catch'](handleError(_0x401ff9,null));};exports[_0x96eb('0x75')]=function(_0x5a360c,_0x1d5098,_0x1b24d3){var _0x31f329={'raw':![],'where':{}};var _0x2319b4={};var _0x1ab190={'count':0x0,'rows':[]};return db[_0x96eb('0x40')][_0x96eb('0x6b')]({'where':{'id':_0x5a360c['params']['id']}})[_0x96eb('0x22')](handleEntityNotFound(_0x1d5098,null))[_0x96eb('0x22')](function(_0x262e65){if(_0x262e65){_0x2319b4['model']=_[_0x96eb('0x45')](db[_0x96eb('0x76')][_0x96eb('0x41')]);_0x2319b4['query']=_[_0x96eb('0x45')](_0x5a360c[_0x96eb('0x44')]);_0x2319b4['filters']=_[_0x96eb('0x47')](_0x2319b4[_0x96eb('0x43')],_0x2319b4['query']);_0x31f329[_0x96eb('0x49')]=_[_0x96eb('0x47')](_0x2319b4[_0x96eb('0x43')],qs[_0x96eb('0x48')](_0x5a360c[_0x96eb('0x44')]['fields']));_0x31f329[_0x96eb('0x49')]=_0x31f329[_0x96eb('0x49')][_0x96eb('0x4a')]?_0x31f329[_0x96eb('0x49')]:_0x2319b4['model'];if(!_0x5a360c['query'][_0x96eb('0x4b')](_0x96eb('0x6c'))){_0x31f329[_0x96eb('0x30')]=qs[_0x96eb('0x30')](_0x5a360c[_0x96eb('0x44')][_0x96eb('0x30')]);_0x31f329[_0x96eb('0x32')]=qs[_0x96eb('0x32')](_0x5a360c[_0x96eb('0x44')][_0x96eb('0x32')]);}_0x31f329[_0x96eb('0x4c')]=qs['sort'](_0x5a360c[_0x96eb('0x44')][_0x96eb('0x4d')]);_0x31f329[_0x96eb('0x4e')]=qs[_0x96eb('0x46')](_[_0x96eb('0x4f')](_0x5a360c[_0x96eb('0x44')],_0x2319b4[_0x96eb('0x46')]));_0x31f329['where'][_0x96eb('0x68')]=_0x262e65['id'];if(_0x5a360c[_0x96eb('0x44')][_0x96eb('0x50')]){_0x31f329[_0x96eb('0x4e')]=_[_0x96eb('0x53')](_0x31f329[_0x96eb('0x4e')],{'$or':_[_0x96eb('0x3f')](_0x31f329[_0x96eb('0x49')],function(_0xee3422){var _0x83ca5c={};_0x83ca5c[_0xee3422]={'$like':'%'+_0x5a360c[_0x96eb('0x44')][_0x96eb('0x50')]+'%'};return _0x83ca5c;})});}_0x31f329=_[_0x96eb('0x53')]({},_0x31f329,_0x5a360c['options']);return db[_0x96eb('0x76')]['count']({'where':_0x31f329[_0x96eb('0x4e')]})[_0x96eb('0x22')](function(_0x2a3124){_0x1ab190[_0x96eb('0x31')]=_0x2a3124;if(_0x5a360c[_0x96eb('0x44')]['includeAll']){_0x31f329[_0x96eb('0x56')]=[{'model':db[_0x96eb('0x77')],'as':_0x96eb('0x78'),'required':![]},{'model':db[_0x96eb('0x79')],'as':_0x96eb('0x7a'),'attributes':[_0x96eb('0x3d'),_0x96eb('0x7b'),_0x96eb('0x7c')],'required':![]},{'model':db[_0x96eb('0x7d')],'as':'Tags','attributes':['id',_0x96eb('0x3d'),_0x96eb('0x7e')],'where':_0x5a360c[_0x96eb('0x44')][_0x96eb('0x7f')]?{'id':_0x5a360c[_0x96eb('0x44')][_0x96eb('0x7f')]}:undefined,'required':_0x5a360c['query'][_0x96eb('0x7f')]?!![]:![]}];}return db[_0x96eb('0x76')][_0x96eb('0x57')](_0x31f329);})[_0x96eb('0x22')](function(_0x565ef6){_0x1ab190[_0x96eb('0x6d')]=_0x565ef6;return _0x1ab190;});}})['then'](respondWithFilteredResult(_0x1d5098,_0x31f329))['catch'](handleError(_0x1d5098,null));};exports[_0x96eb('0x80')]=function(_0x148801,_0x3bbd13,_0x2c780c){return db['FaxAccount']['findOne']({'where':{'id':_0x148801['params']['id']}})['then'](handleEntityNotFound(_0x3bbd13,null))['then'](function(_0x50eb76){if(_0x50eb76){return db[_0x96eb('0x81')][_0x96eb('0x82')](function(_0x1f6b0a){return db[_0x96eb('0x83')][_0x96eb('0x38')]({'where':{'FaxAccountId':_0x148801[_0x96eb('0x5a')]['id']},'transaction':_0x1f6b0a})['then'](function(_0x5a0c52){var _0x5db439=_[_0x96eb('0x3f')](_0x148801[_0x96eb('0x5e')],function(_0x3992a0){_0x3992a0['FaxAccountId']=_0x148801[_0x96eb('0x5a')]['id'];return _0x3992a0;});return db['FaxApplication'][_0x96eb('0x84')](_0x5db439,{'transaction':_0x1f6b0a});});})[_0x96eb('0x22')](function(){return db[_0x96eb('0x83')]['findAndCountAll']({'where':{'FaxAccountId':_0x148801[_0x96eb('0x5a')]['id']},'order':'priority'});});}})[_0x96eb('0x22')](respondWithResult(_0x3bbd13,null))['catch'](handleError(_0x3bbd13,null));};exports[_0x96eb('0x85')]=function(_0x5c06a0,_0x27a867,_0x3355d6){var _0x2c741e={};var _0x1548d2={};var _0x9d09d8;var _0x428476;return db[_0x96eb('0x40')][_0x96eb('0x6b')]({'where':{'id':_0x5c06a0['params']['id']}})['then'](handleEntityNotFound(_0x27a867,null))[_0x96eb('0x22')](function(_0x37fb82){if(_0x37fb82){_0x9d09d8=_0x37fb82;_0x1548d2['model']=_[_0x96eb('0x45')](db[_0x96eb('0x83')][_0x96eb('0x41')]);_0x1548d2[_0x96eb('0x44')]=_['keys'](_0x5c06a0['query']);_0x1548d2['filters']=_[_0x96eb('0x47')](_0x1548d2[_0x96eb('0x43')],_0x1548d2[_0x96eb('0x44')]);_0x2c741e[_0x96eb('0x49')]=_['intersection'](_0x1548d2[_0x96eb('0x43')],qs[_0x96eb('0x48')](_0x5c06a0[_0x96eb('0x44')][_0x96eb('0x48')]));_0x2c741e[_0x96eb('0x49')]=_0x2c741e[_0x96eb('0x49')][_0x96eb('0x4a')]?_0x2c741e[_0x96eb('0x49')]:_0x1548d2[_0x96eb('0x43')];_0x2c741e['order']=qs['sort'](_0x5c06a0[_0x96eb('0x44')][_0x96eb('0x4d')]);_0x2c741e[_0x96eb('0x4e')]=qs[_0x96eb('0x46')](_['pick'](_0x5c06a0['query'],_0x1548d2[_0x96eb('0x46')]));if(_0x5c06a0[_0x96eb('0x44')][_0x96eb('0x50')]){_0x2c741e[_0x96eb('0x4e')]=_['merge'](_0x2c741e[_0x96eb('0x4e')],{'$or':_[_0x96eb('0x3f')](_0x2c741e['attributes'],function(_0x24c8e6){var _0x413752={};_0x413752[_0x24c8e6]={'$like':'%'+_0x5c06a0['query']['filter']+'%'};return _0x413752;})});}_0x2c741e=_[_0x96eb('0x53')]({},_0x2c741e,_0x5c06a0[_0x96eb('0x54')]);return _0x9d09d8[_0x96eb('0x85')](_0x2c741e);}})[_0x96eb('0x22')](function(_0x34fded){if(_0x34fded){_0x428476=_0x34fded[_0x96eb('0x4a')];if(!_0x5c06a0['query']['hasOwnProperty']('nolimit')){_0x2c741e[_0x96eb('0x30')]=qs[_0x96eb('0x30')](_0x5c06a0[_0x96eb('0x44')]['limit']);_0x2c741e[_0x96eb('0x32')]=qs[_0x96eb('0x32')](_0x5c06a0[_0x96eb('0x44')]['offset']);}return _0x9d09d8[_0x96eb('0x85')](_0x2c741e);}})['then'](function(_0x26e07d){if(_0x26e07d){return _0x26e07d?{'count':_0x428476,'rows':_0x26e07d}:null;}})[_0x96eb('0x22')](respondWithResult(_0x27a867,null))['catch'](handleError(_0x27a867,null));};function Extension(_0x48bf50,_0x491f60,_0x4f015e,_0x52f77f){this['context']=_0x96eb('0x86');this['exten']=_0x48bf50[_0x96eb('0x87')];this[_0x96eb('0x88')]=_0x52f77f;this['type']=_0x96eb('0x89');this[_0x96eb('0x8a')]='Fax\x20Extension';this[_0x96eb('0x68')]=_0x48bf50['id'];this[_0x96eb('0x8b')]=_0x491f60;this[_0x96eb('0x8c')]=_0x4f015e;}function createExtensionsReciveFax(_0x3b508a){var _0x5c5122=0x1;var _0x5b7a54=[];_0x5b7a54[_0x96eb('0x8d')](new Extension(_0x3b508a,_0x5c5122,'',_0x96eb('0x8e')));_0x5c5122+=0x1;_0x5b7a54['push'](new Extension(_0x3b508a,_0x5c5122,'CDR(type)=inbound-fax',_0x96eb('0x8f')));_0x5c5122+=0x1;for(var _0x201b0e in _0x3b508a){if(_0x3b508a[_0x96eb('0x4b')](_0x201b0e)&&(_0x201b0e===_0x96eb('0x90')||_0x201b0e===_0x96eb('0x87')||_0x201b0e==='gateway'||_0x201b0e===_0x96eb('0x91')||_0x201b0e==='headerinfo'||_0x201b0e===_0x96eb('0x92')||_0x201b0e==='minrate'||_0x201b0e==='modem'||_0x201b0e===_0x96eb('0x93'))){_0x5b7a54[_0x96eb('0x8d')](new Extension(_0x3b508a,_0x5c5122,_0x96eb('0x94')+_0x201b0e+')='+_0x3b508a[_0x201b0e],_0x96eb('0x8f')));_0x5c5122+=0x1;}}_0x5b7a54[_0x96eb('0x8d')](new Extension(_0x3b508a,_0x5c5122,'6',_0x96eb('0x95')));_0x5c5122+=0x1;_0x5b7a54['push'](new Extension(_0x3b508a,_0x5c5122,_0x96eb('0x96'),_0x96eb('0x97')));_0x5c5122=0x0;return _0x5b7a54;}exports[_0x96eb('0x98')]=function(_0x353cdb,_0x13c18e,_0x347a0c){var _0x48e718;return db[_0x96eb('0x81')][_0x96eb('0x82')](function(_0x1d5304){return db[_0x96eb('0x40')]['create'](_0x353cdb[_0x96eb('0x5e')],{'transaction':_0x1d5304})[_0x96eb('0x22')](function(_0x425b9b){_0x48e718=_0x425b9b[_0x96eb('0x62')]({'plain':!![]});return db['VoiceExtension'][_0x96eb('0x84')](createExtensionsReciveFax(_0x48e718),{'transaction':_0x1d5304});});})[_0x96eb('0x22')](function(){return _0x48e718;})[_0x96eb('0x22')](respondWithResult(_0x13c18e,null))[_0x96eb('0x58')](handleError(_0x13c18e,null));};exports[_0x96eb('0x99')]=function(_0x4d55e4,_0x4afff2,_0xffe8a3){var _0xe4dbe4;return db['sequelize'][_0x96eb('0x82')](function(_0x554bde){return db['FaxAccount'][_0x96eb('0x37')](_0x4d55e4['body'],{'where':{'id':_0x4d55e4['body']['id']},'transaction':_0x554bde})[_0x96eb('0x22')](function(_0x3bf501){return db[_0x96eb('0x9a')][_0x96eb('0x38')]({'where':{'FaxAccountId':_0x4d55e4['body']['id']},'transaction':_0x554bde})[_0x96eb('0x22')](function(_0x164fb0){return db['VoiceExtension'][_0x96eb('0x84')](createExtensionsReciveFax(_['omit'](_0x4d55e4[_0x96eb('0x5e')],[_0x96eb('0x9b'),'key','createdAt',_0x96eb('0x9c'),_0x96eb('0x9d'),'ListId'])),{'transaction':_0x554bde});});});})[_0x96eb('0x22')](function(){return db[_0x96eb('0x40')][_0x96eb('0x9e')](_0x4d55e4[_0x96eb('0x5e')]['id']);})[_0x96eb('0x22')](respondWithResult(_0x4afff2,null))['catch'](handleError(_0x4afff2,null));};exports['getMessages']=function(_0x3f7580,_0x2e2384,_0x375dd6){var _0x577397={'raw':!![],'where':{}};var _0x178fcb={};var _0x1f7c8e={'count':0x0,'rows':[]};return db['FaxAccount'][_0x96eb('0x6b')]({'where':{'id':_0x3f7580[_0x96eb('0x5a')]['id']}})[_0x96eb('0x22')](handleEntityNotFound(_0x2e2384,null))[_0x96eb('0x22')](function(_0x55ece5){if(_0x55ece5){_0x178fcb[_0x96eb('0x43')]=_[_0x96eb('0x45')](db[_0x96eb('0x9f')][_0x96eb('0x41')]);_0x178fcb['query']=_[_0x96eb('0x45')](_0x3f7580[_0x96eb('0x44')]);_0x178fcb[_0x96eb('0x46')]=_[_0x96eb('0x47')](_0x178fcb[_0x96eb('0x43')],_0x178fcb['query']);_0x577397[_0x96eb('0x49')]=_['intersection'](_0x178fcb[_0x96eb('0x43')],qs[_0x96eb('0x48')](_0x3f7580['query']['fields']));_0x577397[_0x96eb('0x49')]=_0x577397['attributes'][_0x96eb('0x4a')]?_0x577397['attributes']:_0x178fcb[_0x96eb('0x43')];if(!_0x3f7580[_0x96eb('0x44')][_0x96eb('0x4b')](_0x96eb('0x6c'))){_0x577397[_0x96eb('0x30')]=qs['limit'](_0x3f7580[_0x96eb('0x44')]['limit']);_0x577397[_0x96eb('0x32')]=qs[_0x96eb('0x32')](_0x3f7580['query'][_0x96eb('0x32')]);}_0x577397['order']=qs[_0x96eb('0x4d')](_0x3f7580['query']['sort']);_0x577397['where']=qs[_0x96eb('0x46')](_['pick'](_0x3f7580[_0x96eb('0x44')],_0x178fcb[_0x96eb('0x46')]));_0x577397[_0x96eb('0x4e')][_0x96eb('0x68')]=_0x55ece5['id'];if(_0x3f7580[_0x96eb('0x44')]['filter']){_0x577397['where']=_['merge'](_0x577397[_0x96eb('0x4e')],{'$or':_[_0x96eb('0x3f')](_0x577397[_0x96eb('0x49')],function(_0x9a71f){var _0x1c1763={};_0x1c1763[_0x9a71f]={'$like':'%'+_0x3f7580['query'][_0x96eb('0x50')]+'%'};return _0x1c1763;})});}if(_0x3f7580[_0x96eb('0x44')][_0x96eb('0xa0')]){var _0x399d18=_0x3f7580[_0x96eb('0x44')][_0x96eb('0xa0')][_0x96eb('0xa1')](',');var _0x582d4c={};_0x582d4c[_0x399d18[0x0]]={'$gte':moment(_0x399d18[0x1])[_0x96eb('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x577397[_0x96eb('0x4e')]=_['merge'](_0x577397[_0x96eb('0x4e')],_0x582d4c);}_0x577397=_[_0x96eb('0x53')]({},_0x577397,_0x3f7580[_0x96eb('0x54')]);return db[_0x96eb('0x9f')][_0x96eb('0x31')]({'where':_0x577397[_0x96eb('0x4e')]})['then'](function(_0xa32f35){_0x1f7c8e['count']=_0xa32f35;if(_0x3f7580[_0x96eb('0x44')][_0x96eb('0x55')]){_0x577397[_0x96eb('0x56')]=[{'all':!![]}];}return db[_0x96eb('0x9f')][_0x96eb('0x57')](_0x577397);})[_0x96eb('0x22')](function(_0xebf6b9){_0x1f7c8e[_0x96eb('0x6d')]=_0xebf6b9;return _0x1f7c8e;});}})['then'](respondWithFilteredResult(_0x2e2384,_0x577397))[_0x96eb('0x58')](handleError(_0x2e2384,null));};exports[_0x96eb('0xa3')]=function(_0x308554,_0x4326e4,_0x48543e){var _0x546615,_0x4b0562={},_0x42b48b;if(_0x308554['body']['to']){_0x42b48b=_0x308554[_0x96eb('0x5e')]['to'][0x0];}return db['FaxAccount'][_0x96eb('0x5c')]({'where':{'id':_0x308554['params']['id']},'include':[{'model':db[_0x96eb('0xa4')],'as':_0x96eb('0xa5'),'include':[{'model':db['CmContact'],'as':_0x96eb('0xa6'),'where':{'fax':_0x42b48b},'limit':0x1,'order':[[_0x96eb('0x9c'),_0x96eb('0xa7')]]}]}]})[_0x96eb('0x22')](handleEntityNotFound(_0x4326e4,null))[_0x96eb('0x22')](function(_0x1c475a){_0x546615=_0x1c475a;if(_0x308554[_0x96eb('0x5e')][_0x96eb('0xa8')]&&_0x308554[_0x96eb('0x5e')][_0x96eb('0xa8')][_0x96eb('0x4a')]){for(var _0x448eec=0x0;_0x448eec<_0x308554['body'][_0x96eb('0xa8')][_0x96eb('0x4a')];_0x448eec+=0x1){_0x308554[_0x96eb('0x5e')]['attachments'][_0x448eec]={'filename':_0x308554[_0x96eb('0x5e')]['attachments'][_0x448eec][_0x96eb('0x3d')],'id':_0x308554[_0x96eb('0x5e')][_0x96eb('0xa8')][_0x448eec]['id'],'path':path['join'](config[_0x96eb('0xa9')],_0x96eb('0xaa'),_0x308554['body'][_0x96eb('0xa8')][_0x448eec][_0x96eb('0xab')])};}}return respondWithRpcPromise(_0x96eb('0xac'),_0x96eb('0xac'),{'FaxAccountId':_['isNil'](_0x308554[_0x96eb('0x5a')]['id'])?undefined:_0x308554[_0x96eb('0x5a')]['id'],'path':_['isNil'](_0x308554[_0x96eb('0x5e')][_0x96eb('0xa8')][0x0]['path'])?undefined:_0x308554[_0x96eb('0x5e')][_0x96eb('0xa8')][0x0][_0x96eb('0xad')],'fax':_[_0x96eb('0xae')](_0x308554[_0x96eb('0x5e')]['to'][0x0])?undefined:_0x308554[_0x96eb('0x5e')]['to'][0x0]},client9002);})[_0x96eb('0x22')](function(){if(_0x546615){if(_[_0x96eb('0xae')](_0x308554['body']['from'])){_0x308554[_0x96eb('0x5e')]['from']=util['format'](_0x96eb('0xaf'),_0x546615[_0x96eb('0x3d')],_0x546615[_0x96eb('0xb0')]);}if(_0x546615[_0x96eb('0xa5')]){if(_0x546615[_0x96eb('0xa5')]['Contacts'][_0x96eb('0x4a')]){return _0x546615[_0x96eb('0xa5')][_0x96eb('0xa6')][0x0];}else{return db[_0x96eb('0x77')]['create'](_['defaults'](_0x308554['body'],{'firstName':_0x308554[_0x96eb('0x5e')]['to'][0x0],'phone':_0x308554[_0x96eb('0x5e')]['to'][0x0],'fax':_0x308554[_0x96eb('0x5e')]['to'][0x0],'ListId':_0x546615[_0x96eb('0xb1')]}));}}else{throw new Error(_0x96eb('0xb2'));}}else{throw new Error(_0x96eb('0xb3'));}})[_0x96eb('0x22')](function(_0x1f0c8b){if(_0x1f0c8b){return db['FaxInteraction']['find']({'where':{'ContactId':_0x1f0c8b['id'],'closed':![],'FaxAccountId':_0x546615['id']}})['then'](function(_0x390d05){if(_0x390d05){return[_0x390d05,![]];}return db[_0x96eb('0x76')][_0x96eb('0x5d')]({'UserId':_0x308554[_0x96eb('0x5f')]['id'],'ContactId':_0x1f0c8b['id'],'FaxAccountId':_0x546615['id'],'fax':_0x308554[_0x96eb('0x5e')]['to'][0x0],'firstMsgDirection':_0x96eb('0xb4'),'Messages':[_[_0x96eb('0x53')](_0x308554[_0x96eb('0x5e')],{'read':![],'body':_0x308554[_0x96eb('0x5e')][_0x96eb('0xa8')][0x0]['filename'],'FaxAccountId':_0x546615['id'],'UserId':_0x308554[_0x96eb('0x5f')]['id'],'ContactId':_0x1f0c8b['id'],'AttachmentId':_0x308554[_0x96eb('0x5e')][_0x96eb('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0x96eb('0x9f')],'as':_0x96eb('0xb5')}]})[_0x96eb('0x22')](function(_0x209ea3){return[_0x209ea3,!![]];});});}else{throw new Error(_0x96eb('0xb6'));}})['spread'](function(_0xc9897e,_0x57ff2e){if(_0x57ff2e){return _0xc9897e;}return db[_0x96eb('0x9f')][_0x96eb('0x5d')]({'direction':_0x96eb('0xb4'),'read':![],'body':_0x308554[_0x96eb('0x5e')][_0x96eb('0xa8')][0x0][_0x96eb('0xb7')],'FaxAccountId':_0x546615['id'],'FaxInteractionId':_0xc9897e['id'],'UserId':_0x308554[_0x96eb('0x5f')]['id'],'ContactId':_0xc9897e[_0x96eb('0xb8')],'AttachmentId':_0x308554[_0x96eb('0x5e')][_0x96eb('0xa8')][0x0]['id']})['then'](function(_0x2545a9){_0xc9897e['dataValues'][_0x96eb('0xb5')]=[];_0xc9897e[_0x96eb('0xb9')]['Messages'][_0x96eb('0x8d')](_0x2545a9[_0x96eb('0xb9')]);return _0xc9897e;});})[_0x96eb('0x22')](function(_0x1ceb54){respondWithRpcPromise(_0x96eb('0xba'),'SendFax',{'FaxAccountId':_[_0x96eb('0xae')](_0x308554[_0x96eb('0x5a')]['id'])?undefined:_0x308554['params']['id'],'path':_[_0x96eb('0xae')](_0x308554[_0x96eb('0x5e')][_0x96eb('0xa8')][0x0][_0x96eb('0xad')])?undefined:_0x308554[_0x96eb('0x5e')][_0x96eb('0xa8')][0x0][_0x96eb('0xad')],'fax':_[_0x96eb('0xae')](_0x308554['body']['to'][0x0])?undefined:_0x308554[_0x96eb('0x5e')]['to'][0x0],'AttachmentId':_0x308554['body'][_0x96eb('0xa8')][0x0]['id']},client9002)[_0x96eb('0x22')](function(_0x4945d9){logger[_0x96eb('0x23')](_0x96eb('0xbb'),_0x4945d9);})[_0x96eb('0x58')](function(_0x2800f7){logger[_0x96eb('0x23')](_0x96eb('0xbb'),_0x2800f7);});return _0x1ceb54;})[_0x96eb('0x22')](respondWithResult(_0x4326e4,null))[_0x96eb('0x58')](handleError(_0x4326e4,null));};exports[_0x96eb('0xbc')]=function(_0x9ec539,_0x1ed6d2,_0x117cdb){return db['FaxAccount']['find']({'where':{'id':_0x9ec539[_0x96eb('0x5a')]['id']}})[_0x96eb('0x22')](handleEntityNotFound(_0x1ed6d2,null))[_0x96eb('0x22')](function(_0x5ba131){if(_0x5ba131){return _0x5ba131[_0x96eb('0xbc')](_0x9ec539['body']['ids'],_[_0x96eb('0x74')](_0x9ec539[_0x96eb('0x5e')],[_0x96eb('0x72'),'id'])||{})[_0x96eb('0xbd')](function(_0x30b6a7){for(var _0x7578a6=0x0;_0x7578a6<_0x9ec539[_0x96eb('0x5e')][_0x96eb('0x72')][_0x96eb('0x4a')];_0x7578a6+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x9ec539[_0x96eb('0x5e')]['ids'][_0x7578a6]),'FaxAccountId':Number(_0x9ec539[_0x96eb('0x5a')]['id'])});}return _0x30b6a7;});}})['then'](respondWithResult(_0x1ed6d2,null))[_0x96eb('0x58')](handleError(_0x1ed6d2,null));};exports[_0x96eb('0xbe')]=function(_0x5cf0df,_0x5231bf,_0x51e1ea){return db[_0x96eb('0x40')][_0x96eb('0x5c')]({'where':{'id':_0x5cf0df[_0x96eb('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5231bf,null))['then'](function(_0x3c3617){if(_0x3c3617){return _0x3c3617['removeAgents'](_0x5cf0df[_0x96eb('0x44')][_0x96eb('0x72')])[_0x96eb('0x22')](function(){if(_[_0x96eb('0xbf')](_0x5cf0df[_0x96eb('0x44')][_0x96eb('0x72')])){for(var _0x1d0751=0x0;_0x1d0751<_0x5cf0df[_0x96eb('0x44')][_0x96eb('0x72')]['length'];_0x1d0751+=0x1){socket[_0x96eb('0xc0')](_0x96eb('0xc1'),{'UserId':Number(_0x5cf0df[_0x96eb('0x44')]['ids'][_0x1d0751]),'FaxAccountId':Number(_0x5cf0df[_0x96eb('0x5a')]['id'])});}}else{socket[_0x96eb('0xc0')](_0x96eb('0xc1'),{'UserId':Number(_0x5cf0df[_0x96eb('0x44')][_0x96eb('0x72')]),'FaxAccountId':Number(_0x5cf0df['params']['id'])});}});}})[_0x96eb('0x22')](respondWithStatusCode(_0x5231bf,null))[_0x96eb('0x58')](handleError(_0x5231bf,null));};exports[_0x96eb('0xc2')]=function(_0x1468ea,_0x568c6b,_0xb02de3){var _0x2fce44={};var _0x3674c7={};var _0x3b4cf2;var _0x509972;return db[_0x96eb('0x40')][_0x96eb('0x6b')]({'where':{'id':_0x1468ea[_0x96eb('0x5a')]['id']}})[_0x96eb('0x22')](handleEntityNotFound(_0x568c6b,null))[_0x96eb('0x22')](function(_0x4e707b){if(_0x4e707b){_0x3b4cf2=_0x4e707b;_0x3674c7['model']=_['keys'](db[_0x96eb('0x79')][_0x96eb('0x41')]);_0x3674c7[_0x96eb('0x44')]=_[_0x96eb('0x45')](_0x1468ea[_0x96eb('0x44')]);_0x3674c7['filters']=_[_0x96eb('0x47')](_0x3674c7[_0x96eb('0x43')],_0x3674c7[_0x96eb('0x44')]);_0x2fce44[_0x96eb('0x49')]=_['intersection'](_0x3674c7[_0x96eb('0x43')],qs['fields'](_0x1468ea[_0x96eb('0x44')][_0x96eb('0x48')]));_0x2fce44[_0x96eb('0x49')]=_0x2fce44[_0x96eb('0x49')][_0x96eb('0x4a')]?_0x2fce44[_0x96eb('0x49')]:_0x3674c7[_0x96eb('0x43')];_0x2fce44['order']=qs[_0x96eb('0x4d')](_0x1468ea[_0x96eb('0x44')]['sort']);_0x2fce44[_0x96eb('0x4e')]=qs[_0x96eb('0x46')](_[_0x96eb('0x4f')](_0x1468ea[_0x96eb('0x44')],_0x3674c7[_0x96eb('0x46')]));if(_0x1468ea[_0x96eb('0x44')][_0x96eb('0x50')]){_0x2fce44[_0x96eb('0x4e')]=_[_0x96eb('0x53')](_0x2fce44['where'],{'$or':_[_0x96eb('0x3f')](_0x2fce44[_0x96eb('0x49')],function(_0x5ac020){var _0x5c13b4={};_0x5c13b4[_0x5ac020]={'$like':'%'+_0x1468ea[_0x96eb('0x44')]['filter']+'%'};return _0x5c13b4;})});}_0x2fce44=_[_0x96eb('0x53')]({},_0x2fce44,_0x1468ea[_0x96eb('0x54')]);return _0x3b4cf2[_0x96eb('0xc2')](_0x2fce44);}})[_0x96eb('0x22')](function(_0x186d55){if(_0x186d55){_0x509972=_0x186d55[_0x96eb('0x4a')];if(!_0x1468ea['query'][_0x96eb('0x4b')](_0x96eb('0x6c'))){_0x2fce44['limit']=qs[_0x96eb('0x30')](_0x1468ea[_0x96eb('0x44')]['limit']);_0x2fce44['offset']=qs[_0x96eb('0x32')](_0x1468ea[_0x96eb('0x44')]['offset']);}return _0x3b4cf2['getAgents'](_0x2fce44);}})[_0x96eb('0x22')](function(_0x123397){if(_0x123397){return _0x123397?{'count':_0x509972,'rows':_0x123397}:null;}})[_0x96eb('0x22')](respondWithResult(_0x568c6b,null))[_0x96eb('0x58')](handleError(_0x568c6b,null));}; \ No newline at end of file +var _0xa5e4=['VIRTUAL','options','FaxAccount','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','FaxInteraction','addInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','tag','addApplications','sequelize','transaction','FaxApplication','destroy','findAndCountAll','priority','getApplications','context','exten','localstationid','app','system','description','appdata','push','Answer','Set','gateway','faxdetect','headerinfo','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','bulkCreate','tech','createdAt','updatedAt','TrunkId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','http','client','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','get','FaxAccounts','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge'];(function(_0xa72345,_0x1fd304){var _0xbc82fb=function(_0xb1594f){while(--_0xb1594f){_0xa72345['push'](_0xa72345['shift']());}};_0xbc82fb(++_0x1fd304);}(_0xa5e4,0x136));var _0x4a5e=function(_0x41a5a0,_0x3bee12){_0x41a5a0=_0x41a5a0-0x0;var _0x2190f8=_0xa5e4[_0x41a5a0];return _0x2190f8;};'use strict';var emlformat=require(_0x4a5e('0x0'));var rimraf=require(_0x4a5e('0x1'));var zipdir=require(_0x4a5e('0x2'));var jsonpatch=require(_0x4a5e('0x3'));var rp=require(_0x4a5e('0x4'));var moment=require(_0x4a5e('0x5'));var BPromise=require(_0x4a5e('0x6'));var Mustache=require('mustache');var util=require(_0x4a5e('0x7'));var path=require('path');var sox=require(_0x4a5e('0x8'));var csv=require(_0x4a5e('0x9'));var ejs=require(_0x4a5e('0xa'));var fs=require('fs');var fs_extra=require(_0x4a5e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4a5e('0xc'));var deskjs=require(_0x4a5e('0xd'));var toCsv=require(_0x4a5e('0x9'));var querystring=require(_0x4a5e('0xe'));var Papa=require('papaparse');var Redis=require(_0x4a5e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4a5e('0x10'));var as=require(_0x4a5e('0x11'));var hardwareService=require(_0x4a5e('0x12'));var logger=require('../../config/logger')(_0x4a5e('0x13'));var utils=require(_0x4a5e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4a5e('0x15'));var db=require('../../mysqldb')['db'];config[_0x4a5e('0x16')]=_[_0x4a5e('0x17')](config[_0x4a5e('0x16')],{'host':_0x4a5e('0x18'),'port':0x18eb});var socket=require(_0x4a5e('0x19'))(new Redis(config[_0x4a5e('0x16')]));require(_0x4a5e('0x1a'))['register'](socket);var jayson=require(_0x4a5e('0x1b'));var client=jayson['client'][_0x4a5e('0x1c')]({'port':0x232c});var client9002=jayson[_0x4a5e('0x1d')][_0x4a5e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3f61cb,_0x5840ba,_0x3e7cbb,_0x2c3c43){return new BPromise(function(_0x517c3b,_0x3999ef){var _0x272376=_0x2c3c43||client;return _0x272376[_0x4a5e('0x1e')](_0x3f61cb,_0x3e7cbb)[_0x4a5e('0x1f')](function(_0x4a37c8){logger[_0x4a5e('0x20')](_0x4a5e('0x21'),_0x5840ba,_0x4a5e('0x22'));logger[_0x4a5e('0x23')](_0x4a5e('0x24'),_0x5840ba,_0x4a5e('0x22'),JSON[_0x4a5e('0x25')](_0x4a37c8));if(_0x4a37c8[_0x4a5e('0x26')]){if(_0x4a37c8[_0x4a5e('0x26')][_0x4a5e('0x27')]===0x1f4){logger[_0x4a5e('0x26')]('FaxAccount,\x20%s,\x20%s',_0x5840ba,_0x4a37c8['error'][_0x4a5e('0x28')]);return _0x3999ef(_0x4a37c8[_0x4a5e('0x26')][_0x4a5e('0x28')]);}logger[_0x4a5e('0x26')](_0x4a5e('0x21'),_0x5840ba,_0x4a37c8[_0x4a5e('0x26')]['message']);return _0x517c3b(_0x4a37c8[_0x4a5e('0x26')][_0x4a5e('0x28')]);}else{logger['info'](_0x4a5e('0x21'),_0x5840ba,_0x4a5e('0x22'));_0x517c3b(_0x4a37c8['result'][_0x4a5e('0x28')]);}})[_0x4a5e('0x29')](function(_0x5e728e){logger[_0x4a5e('0x26')]('FaxAccount,\x20%s,\x20%s',_0x5840ba,_0x5e728e);_0x3999ef(_0x5e728e);});});}function respondWithStatusCode(_0x2c0ad2,_0x334882){_0x334882=_0x334882||0xcc;return function(_0x14ba77){if(_0x14ba77){return _0x2c0ad2[_0x4a5e('0x2a')](_0x334882);}return _0x2c0ad2['status'](_0x334882)['end']();};}function respondWithResult(_0x2979cf,_0x9559bb){_0x9559bb=_0x9559bb||0xc8;return function(_0x21e983){if(_0x21e983){return _0x2979cf[_0x4a5e('0x2b')](_0x9559bb)['json'](_0x21e983);}};}function respondWithFilteredResult(_0x544a97,_0x8ba4f){return function(_0x2c88aa){if(_0x2c88aa){var _0x3b2e9b=typeof _0x8ba4f[_0x4a5e('0x2c')]==='undefined'&&typeof _0x8ba4f[_0x4a5e('0x2d')]==='undefined';var _0x23475=_0x2c88aa['count'];var _0x18597a=_0x3b2e9b?0x0:_0x8ba4f[_0x4a5e('0x2c')];var _0x1b0f20=_0x3b2e9b?_0x2c88aa[_0x4a5e('0x2e')]:_0x8ba4f[_0x4a5e('0x2c')]+_0x8ba4f['limit'];var _0x437cff;if(_0x1b0f20>=_0x23475){_0x1b0f20=_0x23475;_0x437cff=0xc8;}else{_0x437cff=0xce;}_0x544a97[_0x4a5e('0x2b')](_0x437cff);return _0x544a97[_0x4a5e('0x2f')](_0x4a5e('0x30'),_0x18597a+'-'+_0x1b0f20+'/'+_0x23475)[_0x4a5e('0x31')](_0x2c88aa);}return null;};}function patchUpdates(_0x143f16){return function(_0x4da1e8){try{jsonpatch['apply'](_0x4da1e8,_0x143f16,!![]);}catch(_0x30a2ad){return BPromise[_0x4a5e('0x32')](_0x30a2ad);}return _0x4da1e8[_0x4a5e('0x33')]();};}function saveUpdates(_0x3b8d38,_0x180c55){return function(_0x1a2368){if(_0x1a2368){return _0x1a2368['update'](_0x3b8d38)['then'](function(_0x1fc0fc){return _0x1fc0fc;});}return null;};}function removeEntity(_0x979d8a,_0x17474a){return function(_0x5bd99c){if(_0x5bd99c){return _0x5bd99c['destroy']()[_0x4a5e('0x1f')](function(){var _0x19d9c9=_0x5bd99c[_0x4a5e('0x34')]({'plain':!![]});var _0xe0b7c3=_0x4a5e('0x35');return db[_0x4a5e('0x36')]['destroy']({'where':{'type':_0xe0b7c3,'resourceId':_0x19d9c9['id']}})[_0x4a5e('0x1f')](function(){return _0x5bd99c;});})[_0x4a5e('0x1f')](function(){_0x979d8a[_0x4a5e('0x2b')](0xcc)[_0x4a5e('0x37')]();});}};}function handleEntityNotFound(_0x145a71,_0x997d9d){return function(_0x5196d9){if(!_0x5196d9){_0x145a71['sendStatus'](0x194);}return _0x5196d9;};}function handleError(_0x2fb6e6,_0x23242b){_0x23242b=_0x23242b||0x1f4;return function(_0x5b283c){logger[_0x4a5e('0x26')](_0x5b283c[_0x4a5e('0x38')]);if(_0x5b283c['name']){delete _0x5b283c[_0x4a5e('0x39')];}_0x2fb6e6[_0x4a5e('0x2b')](_0x23242b)['send'](_0x5b283c);};}exports[_0x4a5e('0x3a')]=function(_0x57afea,_0xf4f1b6){var _0x239ad9={'include':[{'model':db[_0x4a5e('0x3b')],'as':_0x4a5e('0x3c')}]},_0x523df3={},_0xc2c49f={'count':0x0,'rows':[]};var _0x45cd0d=_[_0x4a5e('0x3d')](db['FaxAccount'][_0x4a5e('0x3e')],function(_0x22ce77){return{'name':_0x22ce77[_0x4a5e('0x3f')],'type':_0x22ce77[_0x4a5e('0x40')][_0x4a5e('0x41')]};});_0x523df3[_0x4a5e('0x42')]=_[_0x4a5e('0x3d')](_0x45cd0d,_0x4a5e('0x39'));_0x523df3[_0x4a5e('0x43')]=_[_0x4a5e('0x44')](_0x57afea[_0x4a5e('0x43')]);_0x523df3[_0x4a5e('0x45')]=_[_0x4a5e('0x46')](_0x523df3[_0x4a5e('0x42')],_0x523df3[_0x4a5e('0x43')]);_0x239ad9[_0x4a5e('0x47')]=_[_0x4a5e('0x46')](_0x523df3[_0x4a5e('0x42')],qs[_0x4a5e('0x48')](_0x57afea['query'][_0x4a5e('0x48')]));_0x239ad9[_0x4a5e('0x47')]=_0x239ad9[_0x4a5e('0x47')][_0x4a5e('0x49')]?_0x239ad9[_0x4a5e('0x47')]:_0x523df3['model'];if(!_0x57afea[_0x4a5e('0x43')][_0x4a5e('0x4a')]('nolimit')){_0x239ad9[_0x4a5e('0x2d')]=qs[_0x4a5e('0x2d')](_0x57afea[_0x4a5e('0x43')]['limit']);_0x239ad9['offset']=qs['offset'](_0x57afea[_0x4a5e('0x43')][_0x4a5e('0x2c')]);}_0x239ad9[_0x4a5e('0x4b')]=qs[_0x4a5e('0x4c')](_0x57afea[_0x4a5e('0x43')][_0x4a5e('0x4c')]);_0x239ad9['where']=qs[_0x4a5e('0x45')](_['pick'](_0x57afea['query'],_0x523df3[_0x4a5e('0x45')]),_0x45cd0d);if(_0x57afea['query'][_0x4a5e('0x4d')]){_0x239ad9[_0x4a5e('0x4e')]=_[_0x4a5e('0x4f')](_0x239ad9['where'],{'$or':_[_0x4a5e('0x3d')](_0x45cd0d,function(_0x347692){if(_0x347692[_0x4a5e('0x40')]!==_0x4a5e('0x50')){var _0x1134a6={};_0x1134a6[_0x347692[_0x4a5e('0x39')]]={'$like':'%'+_0x57afea[_0x4a5e('0x43')][_0x4a5e('0x4d')]+'%'};return _0x1134a6;}})});}_0x239ad9=_[_0x4a5e('0x4f')]({},_0x239ad9,_0x57afea[_0x4a5e('0x51')]);var _0x297a42={'where':_0x239ad9['where']};return db[_0x4a5e('0x52')]['count'](_0x297a42)[_0x4a5e('0x1f')](function(_0xef839f){_0xc2c49f[_0x4a5e('0x2e')]=_0xef839f;if(_0x57afea[_0x4a5e('0x43')][_0x4a5e('0x53')]){_0x239ad9[_0x4a5e('0x54')]=[{'all':!![]}];}return db['FaxAccount'][_0x4a5e('0x55')](_0x239ad9);})[_0x4a5e('0x1f')](function(_0x3dd019){_0xc2c49f['rows']=_0x3dd019;return _0xc2c49f;})[_0x4a5e('0x1f')](respondWithFilteredResult(_0xf4f1b6,_0x239ad9))[_0x4a5e('0x29')](handleError(_0xf4f1b6,null));};exports[_0x4a5e('0x56')]=function(_0x392b59,_0x526a4c){var _0x53454d={'raw':![],'where':{'id':_0x392b59[_0x4a5e('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1369a9={};_0x1369a9['model']=_[_0x4a5e('0x44')](db[_0x4a5e('0x52')][_0x4a5e('0x3e')]);_0x1369a9[_0x4a5e('0x43')]=_['keys'](_0x392b59[_0x4a5e('0x43')]);_0x1369a9[_0x4a5e('0x45')]=_[_0x4a5e('0x46')](_0x1369a9[_0x4a5e('0x42')],_0x1369a9[_0x4a5e('0x43')]);_0x53454d[_0x4a5e('0x47')]=_['intersection'](_0x1369a9[_0x4a5e('0x42')],qs[_0x4a5e('0x48')](_0x392b59[_0x4a5e('0x43')][_0x4a5e('0x48')]));_0x53454d[_0x4a5e('0x47')]=_0x53454d[_0x4a5e('0x47')][_0x4a5e('0x49')]?_0x53454d[_0x4a5e('0x47')]:_0x1369a9['model'];if(_0x392b59[_0x4a5e('0x43')]['includeAll']){_0x53454d[_0x4a5e('0x54')]=[{'all':!![]}];}_0x53454d=_[_0x4a5e('0x4f')]({},_0x53454d,_0x392b59[_0x4a5e('0x51')]);return db[_0x4a5e('0x52')][_0x4a5e('0x58')](_0x53454d)[_0x4a5e('0x1f')](handleEntityNotFound(_0x526a4c,null))[_0x4a5e('0x1f')](respondWithResult(_0x526a4c,null))['catch'](handleError(_0x526a4c,null));};exports[_0x4a5e('0x59')]=function(_0x15c3c6,_0x598750){return db[_0x4a5e('0x52')][_0x4a5e('0x59')](_0x15c3c6[_0x4a5e('0x5a')],{})['then'](function(_0x22ca47){var _0x1cdaa1=_0x15c3c6[_0x4a5e('0x5b')][_0x4a5e('0x34')]({'plain':!![]});if(!_0x1cdaa1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cdaa1[_0x4a5e('0x5c')]===_0x4a5e('0x5b')){var _0x54667d=_0x22ca47[_0x4a5e('0x34')]({'plain':!![]});var _0x3b94b9=_0x4a5e('0x35');return db[_0x4a5e('0x5d')]['find']({'where':{'name':_0x3b94b9,'userProfileId':_0x1cdaa1[_0x4a5e('0x5e')]},'raw':!![]})[_0x4a5e('0x1f')](function(_0x3cdbd5){if(_0x3cdbd5&&_0x3cdbd5[_0x4a5e('0x5f')]===0x0){return db[_0x4a5e('0x36')][_0x4a5e('0x59')]({'name':_0x54667d[_0x4a5e('0x39')],'resourceId':_0x54667d['id'],'type':_0x3cdbd5[_0x4a5e('0x39')],'sectionId':_0x3cdbd5['id']},{})[_0x4a5e('0x1f')](function(){return _0x22ca47;});}else{return _0x22ca47;}})['catch'](function(_0x56d803){logger['error'](_0x4a5e('0x60'),_0x56d803);throw _0x56d803;});}return _0x22ca47;})['then'](respondWithResult(_0x598750,0xc9))[_0x4a5e('0x29')](handleError(_0x598750,null));};exports[_0x4a5e('0x61')]=function(_0x37d3d1,_0x5f321d){if(_0x37d3d1['body']['id']){delete _0x37d3d1[_0x4a5e('0x5a')]['id'];}return db[_0x4a5e('0x52')][_0x4a5e('0x58')]({'where':{'id':_0x37d3d1[_0x4a5e('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x4a5e('0x3c')}]})[_0x4a5e('0x1f')](handleEntityNotFound(_0x5f321d,null))[_0x4a5e('0x1f')](saveUpdates(_0x37d3d1[_0x4a5e('0x5a')],null))[_0x4a5e('0x1f')](respondWithResult(_0x5f321d,null))[_0x4a5e('0x29')](handleError(_0x5f321d,null));};exports['destroy']=function(_0x42d260,_0xc63fc1){return db['FaxAccount'][_0x4a5e('0x58')]({'where':{'id':_0x42d260[_0x4a5e('0x57')]['id']}})[_0x4a5e('0x1f')](handleEntityNotFound(_0xc63fc1,null))[_0x4a5e('0x1f')](removeEntity(_0xc63fc1,null))[_0x4a5e('0x29')](handleError(_0xc63fc1,null));};exports[_0x4a5e('0x62')]=function(_0x28dbfe,_0x3b1994){return db[_0x4a5e('0x52')][_0x4a5e('0x62')]()[_0x4a5e('0x1f')](respondWithResult(_0x3b1994,null))['catch'](handleError(_0x3b1994,null));};exports[_0x4a5e('0x63')]=function(_0x400231,_0x1ca3bc,_0x2fbaf6){if(_0x400231[_0x4a5e('0x5a')]['id']){delete _0x400231[_0x4a5e('0x5a')]['id'];}return db['FaxAccount'][_0x4a5e('0x58')]({'where':{'id':_0x400231[_0x4a5e('0x57')]['id']}})[_0x4a5e('0x1f')](handleEntityNotFound(_0x1ca3bc,null))[_0x4a5e('0x1f')](function(_0x185a40){if(_0x185a40){_0x400231[_0x4a5e('0x5a')][_0x4a5e('0x64')]=_0x185a40['id'];return db[_0x4a5e('0x65')][_0x4a5e('0x59')](_0x400231[_0x4a5e('0x5a')]);}})[_0x4a5e('0x1f')](respondWithResult(_0x1ca3bc,null))['catch'](handleError(_0x1ca3bc,null));};exports[_0x4a5e('0x66')]=function(_0x3b26ff,_0x41067f,_0x37ddcc){var _0x12cd3c={'raw':![],'where':{}};var _0x2e2a41={};var _0x32a134={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4a5e('0x67')]({'where':{'id':_0x3b26ff[_0x4a5e('0x57')]['id']}})[_0x4a5e('0x1f')](handleEntityNotFound(_0x41067f,null))[_0x4a5e('0x1f')](function(_0xd5ef16){if(_0xd5ef16){_0x2e2a41[_0x4a5e('0x42')]=_[_0x4a5e('0x44')](db[_0x4a5e('0x65')]['rawAttributes']);_0x2e2a41[_0x4a5e('0x43')]=_[_0x4a5e('0x44')](_0x3b26ff[_0x4a5e('0x43')]);_0x2e2a41[_0x4a5e('0x45')]=_['intersection'](_0x2e2a41[_0x4a5e('0x42')],_0x2e2a41['query']);_0x12cd3c[_0x4a5e('0x47')]=_['intersection'](_0x2e2a41[_0x4a5e('0x42')],qs['fields'](_0x3b26ff[_0x4a5e('0x43')][_0x4a5e('0x48')]));_0x12cd3c[_0x4a5e('0x47')]=_0x12cd3c[_0x4a5e('0x47')][_0x4a5e('0x49')]?_0x12cd3c[_0x4a5e('0x47')]:_0x2e2a41['model'];if(!_0x3b26ff[_0x4a5e('0x43')]['hasOwnProperty'](_0x4a5e('0x68'))){_0x12cd3c[_0x4a5e('0x2d')]=qs['limit'](_0x3b26ff[_0x4a5e('0x43')]['limit']);_0x12cd3c[_0x4a5e('0x2c')]=qs[_0x4a5e('0x2c')](_0x3b26ff[_0x4a5e('0x43')][_0x4a5e('0x2c')]);}_0x12cd3c[_0x4a5e('0x4b')]=qs[_0x4a5e('0x4c')](_0x3b26ff['query'][_0x4a5e('0x4c')]);_0x12cd3c[_0x4a5e('0x4e')]=qs[_0x4a5e('0x45')](_[_0x4a5e('0x69')](_0x3b26ff[_0x4a5e('0x43')],_0x2e2a41[_0x4a5e('0x45')]));_0x12cd3c[_0x4a5e('0x4e')]['FaxAccountId']=_0xd5ef16['id'];if(_0x3b26ff['query'][_0x4a5e('0x4d')]){_0x12cd3c['where']=_[_0x4a5e('0x4f')](_0x12cd3c[_0x4a5e('0x4e')],{'$or':_[_0x4a5e('0x3d')](_0x12cd3c[_0x4a5e('0x47')],function(_0x20d128){var _0x218fd0={};_0x218fd0[_0x20d128]={'$like':'%'+_0x3b26ff[_0x4a5e('0x43')]['filter']+'%'};return _0x218fd0;})});}_0x12cd3c=_['merge']({},_0x12cd3c,_0x3b26ff[_0x4a5e('0x51')]);return db['Disposition']['count']({'where':_0x12cd3c[_0x4a5e('0x4e')]})[_0x4a5e('0x1f')](function(_0x375d82){_0x32a134[_0x4a5e('0x2e')]=_0x375d82;if(_0x3b26ff[_0x4a5e('0x43')][_0x4a5e('0x53')]){_0x12cd3c[_0x4a5e('0x54')]=[{'all':!![]}];}return db[_0x4a5e('0x65')][_0x4a5e('0x55')](_0x12cd3c);})[_0x4a5e('0x1f')](function(_0x53666a){_0x32a134['rows']=_0x53666a;return _0x32a134;});}})[_0x4a5e('0x1f')](respondWithFilteredResult(_0x41067f,_0x12cd3c))[_0x4a5e('0x29')](handleError(_0x41067f,null));};exports['removeDispositions']=function(_0x1afac3,_0x577d46,_0x29d8c0){return db[_0x4a5e('0x52')][_0x4a5e('0x58')]({'where':{'id':_0x1afac3['params']['id']}})[_0x4a5e('0x1f')](handleEntityNotFound(_0x577d46,null))[_0x4a5e('0x1f')](function(_0x2f3e5b){if(_0x2f3e5b){return _0x2f3e5b[_0x4a5e('0x6a')](_0x1afac3[_0x4a5e('0x43')][_0x4a5e('0x6b')]);}})[_0x4a5e('0x1f')](respondWithStatusCode(_0x577d46,null))[_0x4a5e('0x29')](handleError(_0x577d46,null));};exports[_0x4a5e('0x6c')]=function(_0x361417,_0x3d8c69,_0x5ff9e6){if(_0x361417[_0x4a5e('0x5a')]['id']){delete _0x361417['body']['id'];}return db['FaxAccount'][_0x4a5e('0x58')]({'where':{'id':_0x361417['params']['id']}})['then'](handleEntityNotFound(_0x3d8c69,null))[_0x4a5e('0x1f')](function(_0x552a12){if(_0x552a12){_0x361417[_0x4a5e('0x5a')][_0x4a5e('0x64')]=_0x552a12['id'];return db[_0x4a5e('0x6d')][_0x4a5e('0x59')](_0x361417[_0x4a5e('0x5a')]);}})[_0x4a5e('0x1f')](respondWithResult(_0x3d8c69,null))['catch'](handleError(_0x3d8c69,null));};exports[_0x4a5e('0x6e')]=function(_0x5ecc2e,_0x11d2e1,_0x553eef){var _0x31bb71={'raw':![],'where':{}};var _0x249d2c={};var _0x452786={'count':0x0,'rows':[]};return db[_0x4a5e('0x52')][_0x4a5e('0x67')]({'where':{'id':_0x5ecc2e[_0x4a5e('0x57')]['id']}})['then'](handleEntityNotFound(_0x11d2e1,null))['then'](function(_0x39a8cd){if(_0x39a8cd){_0x249d2c[_0x4a5e('0x42')]=_[_0x4a5e('0x44')](db[_0x4a5e('0x6d')]['rawAttributes']);_0x249d2c['query']=_[_0x4a5e('0x44')](_0x5ecc2e[_0x4a5e('0x43')]);_0x249d2c['filters']=_[_0x4a5e('0x46')](_0x249d2c[_0x4a5e('0x42')],_0x249d2c[_0x4a5e('0x43')]);_0x31bb71[_0x4a5e('0x47')]=_[_0x4a5e('0x46')](_0x249d2c['model'],qs['fields'](_0x5ecc2e[_0x4a5e('0x43')][_0x4a5e('0x48')]));_0x31bb71[_0x4a5e('0x47')]=_0x31bb71[_0x4a5e('0x47')][_0x4a5e('0x49')]?_0x31bb71[_0x4a5e('0x47')]:_0x249d2c['model'];if(!_0x5ecc2e[_0x4a5e('0x43')][_0x4a5e('0x4a')](_0x4a5e('0x68'))){_0x31bb71[_0x4a5e('0x2d')]=qs[_0x4a5e('0x2d')](_0x5ecc2e[_0x4a5e('0x43')][_0x4a5e('0x2d')]);_0x31bb71['offset']=qs[_0x4a5e('0x2c')](_0x5ecc2e[_0x4a5e('0x43')][_0x4a5e('0x2c')]);}_0x31bb71[_0x4a5e('0x4b')]=qs[_0x4a5e('0x4c')](_0x5ecc2e[_0x4a5e('0x43')]['sort']);_0x31bb71[_0x4a5e('0x4e')]=qs[_0x4a5e('0x45')](_[_0x4a5e('0x69')](_0x5ecc2e[_0x4a5e('0x43')],_0x249d2c['filters']));_0x31bb71['where'][_0x4a5e('0x64')]=_0x39a8cd['id'];if(_0x5ecc2e['query']['filter']){_0x31bb71[_0x4a5e('0x4e')]=_[_0x4a5e('0x4f')](_0x31bb71[_0x4a5e('0x4e')],{'$or':_[_0x4a5e('0x3d')](_0x31bb71['attributes'],function(_0x28617a){var _0x47479c={};_0x47479c[_0x28617a]={'$like':'%'+_0x5ecc2e[_0x4a5e('0x43')][_0x4a5e('0x4d')]+'%'};return _0x47479c;})});}_0x31bb71=_[_0x4a5e('0x4f')]({},_0x31bb71,_0x5ecc2e[_0x4a5e('0x51')]);return db['CannedAnswer'][_0x4a5e('0x2e')]({'where':_0x31bb71['where']})[_0x4a5e('0x1f')](function(_0x2d925f){_0x452786[_0x4a5e('0x2e')]=_0x2d925f;if(_0x5ecc2e[_0x4a5e('0x43')]['includeAll']){_0x31bb71[_0x4a5e('0x54')]=[{'all':!![]}];}return db[_0x4a5e('0x6d')]['findAll'](_0x31bb71);})['then'](function(_0x5f049f){_0x452786[_0x4a5e('0x6f')]=_0x5f049f;return _0x452786;});}})[_0x4a5e('0x1f')](respondWithFilteredResult(_0x11d2e1,_0x31bb71))[_0x4a5e('0x29')](handleError(_0x11d2e1,null));};exports['removeAnswers']=function(_0xd513ae,_0x22ac5b,_0x5700fa){return db[_0x4a5e('0x52')][_0x4a5e('0x58')]({'where':{'id':_0xd513ae[_0x4a5e('0x57')]['id']}})[_0x4a5e('0x1f')](handleEntityNotFound(_0x22ac5b,null))[_0x4a5e('0x1f')](function(_0x26528c){if(_0x26528c){return _0x26528c['removeAnswers'](_0xd513ae['query']['ids']);}})[_0x4a5e('0x1f')](respondWithStatusCode(_0x22ac5b,null))[_0x4a5e('0x29')](handleError(_0x22ac5b,null));};exports['addInteraction']=function(_0x55760e,_0x38bd2f,_0x1b15aa){return db[_0x4a5e('0x70')]['find']({'where':{'id':_0x55760e[_0x4a5e('0x57')]['id']}})[_0x4a5e('0x1f')](handleEntityNotFound(_0x38bd2f,null))[_0x4a5e('0x1f')](function(_0x3f7683){if(_0x3f7683){return _0x3f7683[_0x4a5e('0x71')](_0x55760e['body'][_0x4a5e('0x6b')],_[_0x4a5e('0x72')](_0x55760e[_0x4a5e('0x5a')],['ids','id'])||{});}})[_0x4a5e('0x1f')](respondWithResult(_0x38bd2f,null))[_0x4a5e('0x29')](handleError(_0x38bd2f,null));};exports[_0x4a5e('0x73')]=function(_0x36c1e6,_0xce250f,_0x4e98a3){var _0x18aa8b={'raw':![],'where':{}};var _0x5ae14d={};var _0x94be00={'count':0x0,'rows':[]};return db[_0x4a5e('0x52')][_0x4a5e('0x67')]({'where':{'id':_0x36c1e6[_0x4a5e('0x57')]['id']}})[_0x4a5e('0x1f')](handleEntityNotFound(_0xce250f,null))['then'](function(_0x2b83ad){if(_0x2b83ad){_0x5ae14d['model']=_['keys'](db[_0x4a5e('0x70')][_0x4a5e('0x3e')]);_0x5ae14d['query']=_[_0x4a5e('0x44')](_0x36c1e6[_0x4a5e('0x43')]);_0x5ae14d[_0x4a5e('0x45')]=_[_0x4a5e('0x46')](_0x5ae14d[_0x4a5e('0x42')],_0x5ae14d['query']);_0x18aa8b[_0x4a5e('0x47')]=_[_0x4a5e('0x46')](_0x5ae14d[_0x4a5e('0x42')],qs[_0x4a5e('0x48')](_0x36c1e6[_0x4a5e('0x43')][_0x4a5e('0x48')]));_0x18aa8b[_0x4a5e('0x47')]=_0x18aa8b[_0x4a5e('0x47')]['length']?_0x18aa8b[_0x4a5e('0x47')]:_0x5ae14d[_0x4a5e('0x42')];if(!_0x36c1e6['query']['hasOwnProperty'](_0x4a5e('0x68'))){_0x18aa8b[_0x4a5e('0x2d')]=qs[_0x4a5e('0x2d')](_0x36c1e6[_0x4a5e('0x43')][_0x4a5e('0x2d')]);_0x18aa8b[_0x4a5e('0x2c')]=qs['offset'](_0x36c1e6[_0x4a5e('0x43')]['offset']);}_0x18aa8b[_0x4a5e('0x4b')]=qs[_0x4a5e('0x4c')](_0x36c1e6[_0x4a5e('0x43')]['sort']);_0x18aa8b['where']=qs['filters'](_[_0x4a5e('0x69')](_0x36c1e6['query'],_0x5ae14d[_0x4a5e('0x45')]));_0x18aa8b['where'][_0x4a5e('0x64')]=_0x2b83ad['id'];if(_0x36c1e6[_0x4a5e('0x43')]['filter']){_0x18aa8b[_0x4a5e('0x4e')]=_[_0x4a5e('0x4f')](_0x18aa8b[_0x4a5e('0x4e')],{'$or':_['map'](_0x18aa8b[_0x4a5e('0x47')],function(_0x496446){var _0x278087={};_0x278087[_0x496446]={'$like':'%'+_0x36c1e6[_0x4a5e('0x43')][_0x4a5e('0x4d')]+'%'};return _0x278087;})});}_0x18aa8b=_[_0x4a5e('0x4f')]({},_0x18aa8b,_0x36c1e6[_0x4a5e('0x51')]);return db[_0x4a5e('0x70')]['count']({'where':_0x18aa8b[_0x4a5e('0x4e')]})['then'](function(_0x15e3ee){_0x94be00[_0x4a5e('0x2e')]=_0x15e3ee;if(_0x36c1e6['query']['includeAll']){_0x18aa8b[_0x4a5e('0x54')]=[{'model':db[_0x4a5e('0x74')],'as':'Contact','required':![]},{'model':db[_0x4a5e('0x75')],'as':_0x4a5e('0x76'),'attributes':[_0x4a5e('0x39'),_0x4a5e('0x77'),_0x4a5e('0x78')],'required':![]},{'model':db[_0x4a5e('0x79')],'as':'Tags','attributes':['id',_0x4a5e('0x39'),'color'],'where':_0x36c1e6[_0x4a5e('0x43')][_0x4a5e('0x7a')]?{'id':_0x36c1e6[_0x4a5e('0x43')][_0x4a5e('0x7a')]}:undefined,'required':_0x36c1e6[_0x4a5e('0x43')][_0x4a5e('0x7a')]?!![]:![]}];}return db[_0x4a5e('0x70')][_0x4a5e('0x55')](_0x18aa8b);})[_0x4a5e('0x1f')](function(_0x5abd60){_0x94be00['rows']=_0x5abd60;return _0x94be00;});}})[_0x4a5e('0x1f')](respondWithFilteredResult(_0xce250f,_0x18aa8b))[_0x4a5e('0x29')](handleError(_0xce250f,null));};exports[_0x4a5e('0x7b')]=function(_0x5be326,_0x54dc4d,_0x2cba43){return db[_0x4a5e('0x52')][_0x4a5e('0x67')]({'where':{'id':_0x5be326['params']['id']}})[_0x4a5e('0x1f')](handleEntityNotFound(_0x54dc4d,null))['then'](function(_0x4cc63a){if(_0x4cc63a){return db[_0x4a5e('0x7c')][_0x4a5e('0x7d')](function(_0x4ceecf){return db[_0x4a5e('0x7e')][_0x4a5e('0x7f')]({'where':{'FaxAccountId':_0x5be326['params']['id']},'transaction':_0x4ceecf})[_0x4a5e('0x1f')](function(_0x5c4b3d){var _0x45c002=_[_0x4a5e('0x3d')](_0x5be326[_0x4a5e('0x5a')],function(_0x1bd976){_0x1bd976[_0x4a5e('0x64')]=_0x5be326[_0x4a5e('0x57')]['id'];return _0x1bd976;});return db[_0x4a5e('0x7e')]['bulkCreate'](_0x45c002,{'transaction':_0x4ceecf});});})[_0x4a5e('0x1f')](function(){return db[_0x4a5e('0x7e')][_0x4a5e('0x80')]({'where':{'FaxAccountId':_0x5be326[_0x4a5e('0x57')]['id']},'order':_0x4a5e('0x81')});});}})['then'](respondWithResult(_0x54dc4d,null))[_0x4a5e('0x29')](handleError(_0x54dc4d,null));};exports[_0x4a5e('0x82')]=function(_0x4b613d,_0x5aecbf,_0x113938){var _0x49a3bb={};var _0x52732c={};var _0x504cf3;var _0x393b10;return db[_0x4a5e('0x52')]['findOne']({'where':{'id':_0x4b613d[_0x4a5e('0x57')]['id']}})[_0x4a5e('0x1f')](handleEntityNotFound(_0x5aecbf,null))['then'](function(_0x4b1cd2){if(_0x4b1cd2){_0x504cf3=_0x4b1cd2;_0x52732c[_0x4a5e('0x42')]=_['keys'](db['FaxApplication']['rawAttributes']);_0x52732c[_0x4a5e('0x43')]=_[_0x4a5e('0x44')](_0x4b613d[_0x4a5e('0x43')]);_0x52732c['filters']=_[_0x4a5e('0x46')](_0x52732c[_0x4a5e('0x42')],_0x52732c[_0x4a5e('0x43')]);_0x49a3bb['attributes']=_[_0x4a5e('0x46')](_0x52732c[_0x4a5e('0x42')],qs[_0x4a5e('0x48')](_0x4b613d[_0x4a5e('0x43')]['fields']));_0x49a3bb['attributes']=_0x49a3bb['attributes'][_0x4a5e('0x49')]?_0x49a3bb[_0x4a5e('0x47')]:_0x52732c[_0x4a5e('0x42')];_0x49a3bb['order']=qs[_0x4a5e('0x4c')](_0x4b613d[_0x4a5e('0x43')]['sort']);_0x49a3bb[_0x4a5e('0x4e')]=qs[_0x4a5e('0x45')](_['pick'](_0x4b613d['query'],_0x52732c[_0x4a5e('0x45')]));if(_0x4b613d[_0x4a5e('0x43')][_0x4a5e('0x4d')]){_0x49a3bb[_0x4a5e('0x4e')]=_[_0x4a5e('0x4f')](_0x49a3bb[_0x4a5e('0x4e')],{'$or':_[_0x4a5e('0x3d')](_0x49a3bb[_0x4a5e('0x47')],function(_0x271500){var _0x5e25d1={};_0x5e25d1[_0x271500]={'$like':'%'+_0x4b613d[_0x4a5e('0x43')][_0x4a5e('0x4d')]+'%'};return _0x5e25d1;})});}_0x49a3bb=_['merge']({},_0x49a3bb,_0x4b613d[_0x4a5e('0x51')]);return _0x504cf3[_0x4a5e('0x82')](_0x49a3bb);}})[_0x4a5e('0x1f')](function(_0x5af514){if(_0x5af514){_0x393b10=_0x5af514[_0x4a5e('0x49')];if(!_0x4b613d[_0x4a5e('0x43')][_0x4a5e('0x4a')](_0x4a5e('0x68'))){_0x49a3bb[_0x4a5e('0x2d')]=qs[_0x4a5e('0x2d')](_0x4b613d['query']['limit']);_0x49a3bb[_0x4a5e('0x2c')]=qs[_0x4a5e('0x2c')](_0x4b613d[_0x4a5e('0x43')][_0x4a5e('0x2c')]);}return _0x504cf3[_0x4a5e('0x82')](_0x49a3bb);}})[_0x4a5e('0x1f')](function(_0x1492b1){if(_0x1492b1){return _0x1492b1?{'count':_0x393b10,'rows':_0x1492b1}:null;}})[_0x4a5e('0x1f')](respondWithResult(_0x5aecbf,null))['catch'](handleError(_0x5aecbf,null));};function Extension(_0x3fa23c,_0xa0e24f,_0x4b80bc,_0x74d27b){this[_0x4a5e('0x83')]='from-voip-provider';this[_0x4a5e('0x84')]=_0x3fa23c[_0x4a5e('0x85')];this[_0x4a5e('0x86')]=_0x74d27b;this[_0x4a5e('0x40')]=_0x4a5e('0x87');this[_0x4a5e('0x88')]='Fax\x20Extension';this[_0x4a5e('0x64')]=_0x3fa23c['id'];this[_0x4a5e('0x81')]=_0xa0e24f;this[_0x4a5e('0x89')]=_0x4b80bc;}function createExtensionsReciveFax(_0x5cc96c){var _0x522387=0x1;var _0x159ad9=[];_0x159ad9[_0x4a5e('0x8a')](new Extension(_0x5cc96c,_0x522387,'',_0x4a5e('0x8b')));_0x522387+=0x1;_0x159ad9[_0x4a5e('0x8a')](new Extension(_0x5cc96c,_0x522387,'CDR(type)=inbound-fax',_0x4a5e('0x8c')));_0x522387+=0x1;for(var _0x2637db in _0x5cc96c){if(_0x5cc96c['hasOwnProperty'](_0x2637db)&&(_0x2637db==='ecm'||_0x2637db===_0x4a5e('0x85')||_0x2637db===_0x4a5e('0x8d')||_0x2637db===_0x4a5e('0x8e')||_0x2637db===_0x4a5e('0x8f')||_0x2637db==='maxrate'||_0x2637db==='minrate'||_0x2637db===_0x4a5e('0x90')||_0x2637db===_0x4a5e('0x91'))){_0x159ad9[_0x4a5e('0x8a')](new Extension(_0x5cc96c,_0x522387,_0x4a5e('0x92')+_0x2637db+')='+_0x5cc96c[_0x2637db],'Set'));_0x522387+=0x1;}}_0x159ad9[_0x4a5e('0x8a')](new Extension(_0x5cc96c,_0x522387,'6','Wait'));_0x522387+=0x1;_0x159ad9['push'](new Extension(_0x5cc96c,_0x522387,_0x4a5e('0x93'),_0x4a5e('0x94')));_0x522387=0x0;return _0x159ad9;}exports[_0x4a5e('0x95')]=function(_0x5cfe26,_0x58229a,_0x3fbf89){var _0x530e2e;return db[_0x4a5e('0x7c')][_0x4a5e('0x7d')](function(_0x3830a0){return db[_0x4a5e('0x52')]['create'](_0x5cfe26[_0x4a5e('0x5a')],{'transaction':_0x3830a0})[_0x4a5e('0x1f')](function(_0x336c29){_0x530e2e=_0x336c29[_0x4a5e('0x34')]({'plain':!![]});return db[_0x4a5e('0x96')]['bulkCreate'](createExtensionsReciveFax(_0x530e2e),{'transaction':_0x3830a0});});})['then'](function(){return _0x530e2e;})[_0x4a5e('0x1f')](respondWithResult(_0x58229a,null))[_0x4a5e('0x29')](handleError(_0x58229a,null));};exports[_0x4a5e('0x97')]=function(_0x5b8a8a,_0x2b6619,_0x23e9e5){var _0x29e70c;return db['sequelize'][_0x4a5e('0x7d')](function(_0x330375){return db[_0x4a5e('0x52')][_0x4a5e('0x61')](_0x5b8a8a['body'],{'where':{'id':_0x5b8a8a[_0x4a5e('0x5a')]['id']},'transaction':_0x330375})[_0x4a5e('0x1f')](function(_0x5b60aa){return db[_0x4a5e('0x96')]['destroy']({'where':{'FaxAccountId':_0x5b8a8a['body']['id']},'transaction':_0x330375})[_0x4a5e('0x1f')](function(_0x2d5170){return db['VoiceExtension'][_0x4a5e('0x98')](createExtensionsReciveFax(_[_0x4a5e('0x72')](_0x5b8a8a[_0x4a5e('0x5a')],[_0x4a5e('0x99'),_0x4a5e('0x41'),_0x4a5e('0x9a'),_0x4a5e('0x9b'),_0x4a5e('0x9c'),'ListId'])),{'transaction':_0x330375});});});})[_0x4a5e('0x1f')](function(){return db['FaxAccount'][_0x4a5e('0x9d')](_0x5b8a8a[_0x4a5e('0x5a')]['id']);})['then'](respondWithResult(_0x2b6619,null))[_0x4a5e('0x29')](handleError(_0x2b6619,null));};exports[_0x4a5e('0x9e')]=function(_0x252dc5,_0x1dada1,_0x269de2){var _0x1124dc={'raw':!![],'where':{}};var _0x22a80d={};var _0x55108b={'count':0x0,'rows':[]};return db[_0x4a5e('0x52')]['findOne']({'where':{'id':_0x252dc5['params']['id']}})[_0x4a5e('0x1f')](handleEntityNotFound(_0x1dada1,null))['then'](function(_0x4f2445){if(_0x4f2445){_0x22a80d[_0x4a5e('0x42')]=_['keys'](db['FaxMessage'][_0x4a5e('0x3e')]);_0x22a80d['query']=_[_0x4a5e('0x44')](_0x252dc5['query']);_0x22a80d[_0x4a5e('0x45')]=_[_0x4a5e('0x46')](_0x22a80d[_0x4a5e('0x42')],_0x22a80d[_0x4a5e('0x43')]);_0x1124dc[_0x4a5e('0x47')]=_[_0x4a5e('0x46')](_0x22a80d['model'],qs[_0x4a5e('0x48')](_0x252dc5[_0x4a5e('0x43')]['fields']));_0x1124dc[_0x4a5e('0x47')]=_0x1124dc[_0x4a5e('0x47')][_0x4a5e('0x49')]?_0x1124dc['attributes']:_0x22a80d[_0x4a5e('0x42')];if(!_0x252dc5['query'][_0x4a5e('0x4a')](_0x4a5e('0x68'))){_0x1124dc[_0x4a5e('0x2d')]=qs[_0x4a5e('0x2d')](_0x252dc5[_0x4a5e('0x43')][_0x4a5e('0x2d')]);_0x1124dc[_0x4a5e('0x2c')]=qs[_0x4a5e('0x2c')](_0x252dc5[_0x4a5e('0x43')][_0x4a5e('0x2c')]);}_0x1124dc['order']=qs[_0x4a5e('0x4c')](_0x252dc5[_0x4a5e('0x43')][_0x4a5e('0x4c')]);_0x1124dc[_0x4a5e('0x4e')]=qs[_0x4a5e('0x45')](_['pick'](_0x252dc5[_0x4a5e('0x43')],_0x22a80d['filters']));_0x1124dc[_0x4a5e('0x4e')][_0x4a5e('0x64')]=_0x4f2445['id'];if(_0x252dc5[_0x4a5e('0x43')][_0x4a5e('0x4d')]){_0x1124dc[_0x4a5e('0x4e')]=_[_0x4a5e('0x4f')](_0x1124dc['where'],{'$or':_[_0x4a5e('0x3d')](_0x1124dc[_0x4a5e('0x47')],function(_0x2e1374){var _0x1f6b88={};_0x1f6b88[_0x2e1374]={'$like':'%'+_0x252dc5['query'][_0x4a5e('0x4d')]+'%'};return _0x1f6b88;})});}if(_0x252dc5[_0x4a5e('0x43')][_0x4a5e('0x9f')]){var _0x56d829=_0x252dc5[_0x4a5e('0x43')][_0x4a5e('0x9f')][_0x4a5e('0xa0')](',');var _0x3d64f5={};_0x3d64f5[_0x56d829[0x0]]={'$gte':moment(_0x56d829[0x1])[_0x4a5e('0xa1')](_0x4a5e('0xa2'))};_0x1124dc[_0x4a5e('0x4e')]=_[_0x4a5e('0x4f')](_0x1124dc[_0x4a5e('0x4e')],_0x3d64f5);}_0x1124dc=_[_0x4a5e('0x4f')]({},_0x1124dc,_0x252dc5['options']);return db[_0x4a5e('0xa3')][_0x4a5e('0x2e')]({'where':_0x1124dc['where']})[_0x4a5e('0x1f')](function(_0x264e1d){_0x55108b[_0x4a5e('0x2e')]=_0x264e1d;if(_0x252dc5[_0x4a5e('0x43')]['includeAll']){_0x1124dc[_0x4a5e('0x54')]=[{'all':!![]}];}return db[_0x4a5e('0xa3')][_0x4a5e('0x55')](_0x1124dc);})['then'](function(_0x34e69f){_0x55108b[_0x4a5e('0x6f')]=_0x34e69f;return _0x55108b;});}})[_0x4a5e('0x1f')](respondWithFilteredResult(_0x1dada1,_0x1124dc))[_0x4a5e('0x29')](handleError(_0x1dada1,null));};exports['send']=function(_0x2aedf7,_0x3c7bfe,_0x4c6b32){var _0x3fcba0,_0xee4839={},_0x1ace61;if(_0x2aedf7[_0x4a5e('0x5a')]['to']){_0x1ace61=_0x2aedf7[_0x4a5e('0x5a')]['to'][0x0];}return db[_0x4a5e('0x52')][_0x4a5e('0x58')]({'where':{'id':_0x2aedf7[_0x4a5e('0x57')]['id']},'include':[{'model':db[_0x4a5e('0xa4')],'as':'List','include':[{'model':db[_0x4a5e('0x74')],'as':_0x4a5e('0xa5'),'where':{'fax':_0x1ace61},'limit':0x1,'order':[[_0x4a5e('0x9b'),_0x4a5e('0xa6')]]}]}]})[_0x4a5e('0x1f')](handleEntityNotFound(_0x3c7bfe,null))[_0x4a5e('0x1f')](function(_0x24c8bc){_0x3fcba0=_0x24c8bc;if(_0x2aedf7[_0x4a5e('0x5a')][_0x4a5e('0xa7')]&&_0x2aedf7[_0x4a5e('0x5a')][_0x4a5e('0xa7')]['length']){for(var _0x31f42d=0x0;_0x31f42d<_0x2aedf7[_0x4a5e('0x5a')]['attachments']['length'];_0x31f42d+=0x1){_0x2aedf7['body']['attachments'][_0x31f42d]={'filename':_0x2aedf7['body'][_0x4a5e('0xa7')][_0x31f42d][_0x4a5e('0x39')],'id':_0x2aedf7[_0x4a5e('0x5a')][_0x4a5e('0xa7')][_0x31f42d]['id'],'path':path[_0x4a5e('0xa8')](config[_0x4a5e('0xa9')],_0x4a5e('0xaa'),_0x2aedf7['body'][_0x4a5e('0xa7')][_0x31f42d]['basename'])};}}return respondWithRpcPromise(_0x4a5e('0xab'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x2aedf7[_0x4a5e('0x57')]['id'])?undefined:_0x2aedf7[_0x4a5e('0x57')]['id'],'path':_[_0x4a5e('0xac')](_0x2aedf7[_0x4a5e('0x5a')][_0x4a5e('0xa7')][0x0][_0x4a5e('0xad')])?undefined:_0x2aedf7[_0x4a5e('0x5a')][_0x4a5e('0xa7')][0x0][_0x4a5e('0xad')],'fax':_[_0x4a5e('0xac')](_0x2aedf7[_0x4a5e('0x5a')]['to'][0x0])?undefined:_0x2aedf7['body']['to'][0x0]},client9002);})[_0x4a5e('0x1f')](function(){if(_0x3fcba0){if(_[_0x4a5e('0xac')](_0x2aedf7[_0x4a5e('0x5a')][_0x4a5e('0xae')])){_0x2aedf7['body'][_0x4a5e('0xae')]=util[_0x4a5e('0xa1')](_0x4a5e('0xaf'),_0x3fcba0[_0x4a5e('0x39')],_0x3fcba0[_0x4a5e('0xb0')]);}if(_0x3fcba0[_0x4a5e('0xb1')]){if(_0x3fcba0[_0x4a5e('0xb1')][_0x4a5e('0xa5')][_0x4a5e('0x49')]){return _0x3fcba0[_0x4a5e('0xb1')]['Contacts'][0x0];}else{return db[_0x4a5e('0x74')][_0x4a5e('0x59')](_[_0x4a5e('0x17')](_0x2aedf7[_0x4a5e('0x5a')],{'firstName':_0x2aedf7['body']['to'][0x0],'phone':_0x2aedf7['body']['to'][0x0],'fax':_0x2aedf7[_0x4a5e('0x5a')]['to'][0x0],'ListId':_0x3fcba0[_0x4a5e('0xb2')]}));}}else{throw new Error(_0x4a5e('0xb3'));}}else{throw new Error(_0x4a5e('0xb4'));}})[_0x4a5e('0x1f')](function(_0xa8ad30){if(_0xa8ad30){return db[_0x4a5e('0x70')]['find']({'where':{'ContactId':_0xa8ad30['id'],'closed':![],'FaxAccountId':_0x3fcba0['id']}})[_0x4a5e('0x1f')](function(_0x18d4b6){if(_0x18d4b6){return[_0x18d4b6,![]];}return db[_0x4a5e('0x70')][_0x4a5e('0x59')]({'UserId':_0x2aedf7[_0x4a5e('0x5b')]['id'],'ContactId':_0xa8ad30['id'],'FaxAccountId':_0x3fcba0['id'],'fax':_0x2aedf7[_0x4a5e('0x5a')]['to'][0x0],'firstMsgDirection':_0x4a5e('0xb5'),'Messages':[_[_0x4a5e('0x4f')](_0x2aedf7[_0x4a5e('0x5a')],{'read':![],'body':_0x2aedf7[_0x4a5e('0x5a')][_0x4a5e('0xa7')][0x0][_0x4a5e('0xb6')],'FaxAccountId':_0x3fcba0['id'],'UserId':_0x2aedf7[_0x4a5e('0x5b')]['id'],'ContactId':_0xa8ad30['id'],'AttachmentId':_0x2aedf7[_0x4a5e('0x5a')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x4a5e('0xa3')],'as':_0x4a5e('0xb7')}]})['then'](function(_0x51bee4){return[_0x51bee4,!![]];});});}else{throw new Error(_0x4a5e('0xb8'));}})[_0x4a5e('0xb9')](function(_0x5c4619,_0x40c1d1){if(_0x40c1d1){return _0x5c4619;}return db[_0x4a5e('0xa3')][_0x4a5e('0x59')]({'direction':_0x4a5e('0xb5'),'read':![],'body':_0x2aedf7[_0x4a5e('0x5a')][_0x4a5e('0xa7')][0x0][_0x4a5e('0xb6')],'FaxAccountId':_0x3fcba0['id'],'FaxInteractionId':_0x5c4619['id'],'UserId':_0x2aedf7[_0x4a5e('0x5b')]['id'],'ContactId':_0x5c4619['ContactId'],'AttachmentId':_0x2aedf7['body'][_0x4a5e('0xa7')][0x0]['id']})['then'](function(_0x3a2a17){_0x5c4619['dataValues'][_0x4a5e('0xb7')]=[];_0x5c4619['dataValues'][_0x4a5e('0xb7')][_0x4a5e('0x8a')](_0x3a2a17[_0x4a5e('0xba')]);return _0x5c4619;});})['then'](function(_0x58b989){respondWithRpcPromise(_0x4a5e('0xbb'),_0x4a5e('0xbb'),{'FaxAccountId':_['isNil'](_0x2aedf7[_0x4a5e('0x57')]['id'])?undefined:_0x2aedf7[_0x4a5e('0x57')]['id'],'path':_[_0x4a5e('0xac')](_0x2aedf7[_0x4a5e('0x5a')]['attachments'][0x0][_0x4a5e('0xad')])?undefined:_0x2aedf7[_0x4a5e('0x5a')]['attachments'][0x0][_0x4a5e('0xad')],'fax':_['isNil'](_0x2aedf7[_0x4a5e('0x5a')]['to'][0x0])?undefined:_0x2aedf7[_0x4a5e('0x5a')]['to'][0x0],'AttachmentId':_0x2aedf7[_0x4a5e('0x5a')][_0x4a5e('0xa7')][0x0]['id']},client9002)['then'](function(_0x2cfb58){logger['info'](_0x4a5e('0xbc'),_0x2cfb58);})['catch'](function(_0x1d6d73){logger[_0x4a5e('0x20')](_0x4a5e('0xbc'),_0x1d6d73);});return _0x58b989;})[_0x4a5e('0x1f')](respondWithResult(_0x3c7bfe,null))[_0x4a5e('0x29')](handleError(_0x3c7bfe,null));};exports[_0x4a5e('0xbd')]=function(_0x24a1b5,_0x2f0ea2,_0x2d3bdf){return db[_0x4a5e('0x52')][_0x4a5e('0x58')]({'where':{'id':_0x24a1b5['params']['id']}})['then'](handleEntityNotFound(_0x2f0ea2,null))[_0x4a5e('0x1f')](function(_0x3a9d0c){if(_0x3a9d0c){return _0x3a9d0c[_0x4a5e('0xbd')](_0x24a1b5[_0x4a5e('0x5a')][_0x4a5e('0x6b')],_[_0x4a5e('0x72')](_0x24a1b5[_0x4a5e('0x5a')],[_0x4a5e('0x6b'),'id'])||{})[_0x4a5e('0xb9')](function(_0x22dd1c){for(var _0x19c3ff=0x0;_0x19c3ff<_0x24a1b5['body'][_0x4a5e('0x6b')][_0x4a5e('0x49')];_0x19c3ff+=0x1){socket[_0x4a5e('0xbe')](_0x4a5e('0xbf'),{'UserId':Number(_0x24a1b5[_0x4a5e('0x5a')][_0x4a5e('0x6b')][_0x19c3ff]),'FaxAccountId':Number(_0x24a1b5[_0x4a5e('0x57')]['id'])});}return _0x22dd1c;});}})[_0x4a5e('0x1f')](respondWithResult(_0x2f0ea2,null))[_0x4a5e('0x29')](handleError(_0x2f0ea2,null));};exports[_0x4a5e('0xc0')]=function(_0x28f266,_0x164f76,_0x533e72){return db[_0x4a5e('0x52')][_0x4a5e('0x58')]({'where':{'id':_0x28f266[_0x4a5e('0x57')]['id']}})['then'](handleEntityNotFound(_0x164f76,null))[_0x4a5e('0x1f')](function(_0xff96cf){if(_0xff96cf){return _0xff96cf['removeAgents'](_0x28f266[_0x4a5e('0x43')][_0x4a5e('0x6b')])[_0x4a5e('0x1f')](function(){if(_[_0x4a5e('0xc1')](_0x28f266[_0x4a5e('0x43')][_0x4a5e('0x6b')])){for(var _0x58391d=0x0;_0x58391d<_0x28f266[_0x4a5e('0x43')][_0x4a5e('0x6b')]['length'];_0x58391d+=0x1){socket[_0x4a5e('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x28f266[_0x4a5e('0x43')][_0x4a5e('0x6b')][_0x58391d]),'FaxAccountId':Number(_0x28f266[_0x4a5e('0x57')]['id'])});}}else{socket[_0x4a5e('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x28f266[_0x4a5e('0x43')][_0x4a5e('0x6b')]),'FaxAccountId':Number(_0x28f266[_0x4a5e('0x57')]['id'])});}});}})[_0x4a5e('0x1f')](respondWithStatusCode(_0x164f76,null))[_0x4a5e('0x29')](handleError(_0x164f76,null));};exports['getAgents']=function(_0x40dbae,_0x2e3959,_0x250dbb){var _0x7ad9af={};var _0x14b500={};var _0x4b1033;var _0x1fd9ef;return db[_0x4a5e('0x52')][_0x4a5e('0x67')]({'where':{'id':_0x40dbae['params']['id']}})[_0x4a5e('0x1f')](handleEntityNotFound(_0x2e3959,null))[_0x4a5e('0x1f')](function(_0x23006c){if(_0x23006c){_0x4b1033=_0x23006c;_0x14b500[_0x4a5e('0x42')]=_['keys'](db[_0x4a5e('0x75')][_0x4a5e('0x3e')]);_0x14b500[_0x4a5e('0x43')]=_[_0x4a5e('0x44')](_0x40dbae['query']);_0x14b500['filters']=_[_0x4a5e('0x46')](_0x14b500[_0x4a5e('0x42')],_0x14b500['query']);_0x7ad9af['attributes']=_[_0x4a5e('0x46')](_0x14b500[_0x4a5e('0x42')],qs[_0x4a5e('0x48')](_0x40dbae['query'][_0x4a5e('0x48')]));_0x7ad9af[_0x4a5e('0x47')]=_0x7ad9af[_0x4a5e('0x47')]['length']?_0x7ad9af[_0x4a5e('0x47')]:_0x14b500['model'];_0x7ad9af[_0x4a5e('0x4b')]=qs['sort'](_0x40dbae['query'][_0x4a5e('0x4c')]);_0x7ad9af['where']=qs[_0x4a5e('0x45')](_[_0x4a5e('0x69')](_0x40dbae[_0x4a5e('0x43')],_0x14b500['filters']));if(_0x40dbae['query'][_0x4a5e('0x4d')]){_0x7ad9af['where']=_[_0x4a5e('0x4f')](_0x7ad9af[_0x4a5e('0x4e')],{'$or':_[_0x4a5e('0x3d')](_0x7ad9af[_0x4a5e('0x47')],function(_0x3da923){var _0x5b4c10={};_0x5b4c10[_0x3da923]={'$like':'%'+_0x40dbae[_0x4a5e('0x43')][_0x4a5e('0x4d')]+'%'};return _0x5b4c10;})});}_0x7ad9af=_['merge']({},_0x7ad9af,_0x40dbae[_0x4a5e('0x51')]);return _0x4b1033[_0x4a5e('0xc2')](_0x7ad9af);}})[_0x4a5e('0x1f')](function(_0x2ab1f6){if(_0x2ab1f6){_0x1fd9ef=_0x2ab1f6[_0x4a5e('0x49')];if(!_0x40dbae[_0x4a5e('0x43')]['hasOwnProperty'](_0x4a5e('0x68'))){_0x7ad9af[_0x4a5e('0x2d')]=qs['limit'](_0x40dbae['query'][_0x4a5e('0x2d')]);_0x7ad9af[_0x4a5e('0x2c')]=qs['offset'](_0x40dbae['query'][_0x4a5e('0x2c')]);}return _0x4b1033[_0x4a5e('0xc2')](_0x7ad9af);}})['then'](function(_0x34cbd4){if(_0x34cbd4){return _0x34cbd4?{'count':_0x1fd9ef,'rows':_0x34cbd4}:null;}})['then'](respondWithResult(_0x2e3959,null))['catch'](handleError(_0x2e3959,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 306bc96..1eee321 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 _0xf296=['FaxAccount','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x9b3efc,_0x577a0d){var _0x200f05=function(_0x15ad7c){while(--_0x15ad7c){_0x9b3efc['push'](_0x9b3efc['shift']());}};_0x200f05(++_0x577a0d);}(_0xf296,0x6a));var _0x6f29=function(_0x509083,_0xa6676b){_0x509083=_0x509083-0x0;var _0x4b2495=_0xf296[_0x509083];return _0x4b2495;};'use strict';var EventEmitter=require(_0x6f29('0x0'));var FaxAccount=require(_0x6f29('0x1'))['db'][_0x6f29('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x6f29('0x3')](0x0);var events={'afterCreate':_0x6f29('0x4'),'afterUpdate':_0x6f29('0x5'),'afterDestroy':_0x6f29('0x6')};function emitEvent(_0x1f2e42){return function(_0x3b3a64,_0x4950c1,_0x2bcff7){FaxAccountEvents[_0x6f29('0x7')](_0x1f2e42+':'+_0x3b3a64['id'],_0x3b3a64);FaxAccountEvents[_0x6f29('0x7')](_0x1f2e42,_0x3b3a64);_0x2bcff7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x6f29('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xc103=['events','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x4e4276,_0x1d5619){var _0x37d099=function(_0x3fd38d){while(--_0x3fd38d){_0x4e4276['push'](_0x4e4276['shift']());}};_0x37d099(++_0x1d5619);}(_0xc103,0x7e));var _0x3c10=function(_0x47beea,_0x44b235){_0x47beea=_0x47beea-0x0;var _0x28e5c4=_0xc103[_0x47beea];return _0x28e5c4;};'use strict';var EventEmitter=require(_0x3c10('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x3c10('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3c10('0x2')](0x0);var events={'afterCreate':_0x3c10('0x3'),'afterUpdate':_0x3c10('0x4'),'afterDestroy':_0x3c10('0x5')};function emitEvent(_0x1487fa){return function(_0x5b828c,_0xa247a8,_0x29e5f0){FaxAccountEvents[_0x3c10('0x6')](_0x1487fa+':'+_0x5b828c['id'],_0x5b828c);FaxAccountEvents['emit'](_0x1487fa,_0x5b828c);_0x29e5f0(null);};}for(var e in events){if(events[_0x3c10('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x3c10('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 2eea3d1..8e2ef85 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 _0x71be=['../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x347980,_0x542c1b){var _0x381b95=function(_0x5ce95b){while(--_0x5ce95b){_0x347980['push'](_0x347980['shift']());}};_0x381b95(++_0x542c1b);}(_0x71be,0x19c));var _0xe71b=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0x71be[_0x515afd];return _0x536d53;};'use strict';var _=require(_0xe71b('0x0'));var util=require('util');var logger=require(_0xe71b('0x1'))(_0xe71b('0x2'));var moment=require('moment');var BPromise=require(_0xe71b('0x3'));var rp=require(_0xe71b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe71b('0x5'));var config=require(_0xe71b('0x6'));var attributes=require(_0xe71b('0x7'));module['exports']=function(_0x14f0b9,_0x5c6ed9){return _0x14f0b9[_0xe71b('0x8')](_0xe71b('0x9'),attributes,{'tableName':_0xe71b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb86e=['api','moment','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','define','fax_accounts','lodash','util'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb86e,0x127));var _0xeb86=function(_0x21ed2e,_0x2253c2){_0x21ed2e=_0x21ed2e-0x0;var _0x31317f=_0xb86e[_0x21ed2e];return _0x31317f;};'use strict';var _=require(_0xeb86('0x0'));var util=require(_0xeb86('0x1'));var logger=require('../../config/logger')(_0xeb86('0x2'));var moment=require(_0xeb86('0x3'));var BPromise=require(_0xeb86('0x4'));var rp=require(_0xeb86('0x5'));var fs=require('fs');var path=require(_0xeb86('0x6'));var rimraf=require('rimraf');var config=require(_0xeb86('0x7'));var attributes=require(_0xeb86('0x8'));module['exports']=function(_0x1cf3aa,_0x37a4c6){return _0x1cf3aa[_0xeb86('0x9')]('FaxAccount',attributes,{'tableName':_0xeb86('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 0e6f5ff..8a86489 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 _0x39ee=['request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','find','account','CmList','List','Contacts','FaxApplication','get','applications','Applications','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','created','ContactId','AttachmentId','interaction','UserId','User','name','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s'];(function(_0x5210a9,_0x261b1e){var _0x4d04fb=function(_0x4eec88){while(--_0x4eec88){_0x5210a9['push'](_0x5210a9['shift']());}};_0x4d04fb(++_0x261b1e);}(_0x39ee,0x150));var _0xe39e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x39ee[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xe39e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe39e('0x1'));var rs=require(_0xe39e('0x2'));var fs=require('fs');var Redis=require(_0xe39e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe39e('0x4'));var logger=require(_0xe39e('0x5'))(_0xe39e('0x6'));var config=require(_0xe39e('0x7'));var jayson=require(_0xe39e('0x8'));var client=jayson[_0xe39e('0x9')][_0xe39e('0xa')]({'port':0x232c});config[_0xe39e('0xb')]=_[_0xe39e('0xc')](config['redis'],{'host':_0xe39e('0xd'),'port':0x18eb});var socket=require(_0xe39e('0xe'))(new Redis(config[_0xe39e('0xb')]));require(_0xe39e('0xf'))['register'](socket);function respondWithRpcPromise(_0x674527,_0x2016b5,_0x171eec){return new BPromise(function(_0x2699e2,_0x23ad3b){return client[_0xe39e('0x10')](_0x674527,_0x171eec)[_0xe39e('0x11')](function(_0x344592){logger[_0xe39e('0x12')](_0xe39e('0x13'),_0x2016b5,_0xe39e('0x14'));logger[_0xe39e('0x15')](_0xe39e('0x16'),_0x2016b5,_0xe39e('0x14'),JSON[_0xe39e('0x17')](_0x344592));if(_0x344592[_0xe39e('0x18')]){if(_0x344592[_0xe39e('0x18')][_0xe39e('0x19')]===0x1f4){logger['error'](_0xe39e('0x13'),_0x2016b5,_0x344592[_0xe39e('0x18')][_0xe39e('0x1a')]);return _0x23ad3b(_0x344592['error'][_0xe39e('0x1a')]);}logger[_0xe39e('0x18')]('FaxAccount,\x20%s,\x20%s',_0x2016b5,_0x344592['error'][_0xe39e('0x1a')]);return _0x2699e2(_0x344592['error'][_0xe39e('0x1a')]);}else{logger['info'](_0xe39e('0x13'),_0x2016b5,_0xe39e('0x14'));_0x2699e2(_0x344592[_0xe39e('0x1b')][_0xe39e('0x1a')]);}})[_0xe39e('0x1c')](function(_0x38f13d){logger['error'](_0xe39e('0x13'),_0x2016b5,_0x38f13d);_0x23ad3b(_0x38f13d);});});}exports[_0xe39e('0x1d')]=function(_0x4a5f50){var _0x335e03=this;return new Promise(function(_0x3fae35,_0x4ff676){return db[_0xe39e('0x1e')][_0xe39e('0x1f')]({'raw':_0x4a5f50[_0xe39e('0x20')]?_0x4a5f50[_0xe39e('0x20')][_0xe39e('0x21')]===undefined?!![]:![]:!![],'where':_0x4a5f50['options']?_0x4a5f50[_0xe39e('0x20')][_0xe39e('0x22')]||null:null,'attributes':_0x4a5f50['options']?_0x4a5f50[_0xe39e('0x20')][_0xe39e('0x23')]||null:null,'limit':_0x4a5f50[_0xe39e('0x20')]?_0x4a5f50[_0xe39e('0x20')]['limit']||null:null,'include':_0x4a5f50['options']?_0x4a5f50['options'][_0xe39e('0x24')]?_['map'](_0x4a5f50['options'][_0xe39e('0x24')],function(_0x32ce7c){return{'model':db[_0x32ce7c['model']],'as':_0x32ce7c['as'],'attributes':_0x32ce7c[_0xe39e('0x23')],'include':_0x32ce7c[_0xe39e('0x24')]?_[_0xe39e('0x25')](_0x32ce7c['include'],function(_0x5c530d){return{'model':db[_0x5c530d['model']],'as':_0x5c530d['as'],'attributes':_0x5c530d['attributes'],'include':_0x5c530d[_0xe39e('0x24')]?_[_0xe39e('0x25')](_0x5c530d[_0xe39e('0x24')],function(_0x25a898){return{'model':db[_0x25a898[_0xe39e('0x26')]],'as':_0x25a898['as'],'attributes':_0x25a898[_0xe39e('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26732d){logger['info'](_0xe39e('0x1d'),_0x4a5f50);logger[_0xe39e('0x15')](_0xe39e('0x1d'),_0x4a5f50,JSON['stringify'](_0x26732d));_0x3fae35(_0x26732d);})[_0xe39e('0x1c')](function(_0x398e2f){logger['error'](_0xe39e('0x1d'),_0x398e2f[_0xe39e('0x1a')],_0x4a5f50);_0x4ff676(_0x335e03[_0xe39e('0x18')](0x1f4,_0x398e2f[_0xe39e('0x1a')]));});});};exports[_0xe39e('0x27')]=function(_0x149420,_0x4ce7c5,_0xa3c0c8){var _0xaef068=this;return new Promise(function(_0x3803ad,_0x734d8d){var _0x40dd8b={'body':_0x149420[_0xe39e('0x28')],'channel':_0xe39e('0x29')};var _0x33765a=[];var _0x3ac4a6=[];var _0x5ef06c={};return db[_0xe39e('0x2a')][_0xe39e('0x2b')]()[_0xe39e('0x11')](function(_0x58fcec){if(!_0x58fcec){throw new db[(_0xe39e('0x2c'))][(_0xe39e('0x2d'))](_0xe39e('0x2e'));}_0x33765a=_[_0xe39e('0x2f')](_['keys'](_0x58fcec),[_0xe39e('0x30'),_0xe39e('0x31')]);_0x3ac4a6=_[_0xe39e('0x2f')](_[_0xe39e('0x32')](_0x58fcec),[_0xe39e('0x30'),_0xe39e('0x31'),_0xe39e('0x33'),_0xe39e('0x34')]);if(_0x149420['body']['id']){delete _0x149420[_0xe39e('0x28')]['id'];}if(_[_0xe39e('0x35')](_0x149420[_0xe39e('0x28')][_0xe39e('0x36')])){throw new db[(_0xe39e('0x2c'))][(_0xe39e('0x2d'))]('from\x20is\x20mandatory');}if(_[_0xe39e('0x35')](_0x149420[_0xe39e('0x28')][_0xe39e('0x28')])||_0x149420['body'][_0xe39e('0x28')]===''){throw new db[(_0xe39e('0x2c'))][(_0xe39e('0x2d'))](_0xe39e('0x37'));}if(_[_0xe39e('0x35')](_0x149420[_0xe39e('0x28')]['mapKey'])){throw new db[(_0xe39e('0x2c'))][(_0xe39e('0x2d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3ac4a6);}if(!_['includes'](_0x3ac4a6,_0x149420['body'][_0xe39e('0x38')])){throw new db[(_0xe39e('0x2c'))][(_0xe39e('0x2d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3ac4a6);}_0x5ef06c[_0x149420['body'][_0xe39e('0x38')]]=_0x149420[_0xe39e('0x28')][_0xe39e('0x36')];})[_0xe39e('0x11')](function(){return db[_0xe39e('0x1e')][_0xe39e('0x39')]({'where':{'id':_0x149420[_0xe39e('0x3a')]['id']},'include':[{'model':db[_0xe39e('0x3b')],'as':_0xe39e('0x3c'),'include':[{'model':db['CmContact'],'as':_0xe39e('0x3d'),'where':_0x5ef06c,'limit':0x1,'order':[[_0xe39e('0x31'),'DESC']]}]},{'model':db[_0xe39e('0x3e')],'as':'Applications'}]});})[_0xe39e('0x11')](function(_0xe27f5c){if(_0xe27f5c&&_0xe27f5c['List']){var _0xa49bd4=_0xe27f5c[_0xe39e('0x3f')]({'plain':!![]});_0x40dd8b[_0xe39e('0x3a')]=_0xa49bd4;_0x40dd8b[_0xe39e('0x40')]=_0xa49bd4[_0xe39e('0x41')];_0x40dd8b['list']=_0xa49bd4[_0xe39e('0x3c')];_0x40dd8b[_0xe39e('0x40')]=_[_0xe39e('0x42')](_0x40dd8b[_0xe39e('0x40')],[_0xe39e('0x43')],[_0xe39e('0x44')]);if(_0x40dd8b[_0xe39e('0x3a')]['Applications']){delete _0x40dd8b[_0xe39e('0x3a')]['Applications'];}if(_0x40dd8b[_0xe39e('0x3a')][_0xe39e('0x3c')]&&_0x40dd8b[_0xe39e('0x3a')][_0xe39e('0x3c')][_0xe39e('0x3d')][_0xe39e('0x45')]){return _0x40dd8b['account'][_0xe39e('0x3c')][_0xe39e('0x3d')][0x0];}var _0x3ad036=_[_0xe39e('0xc')](_0x149420[_0xe39e('0x28')],{'firstName':_0x149420[_0xe39e('0x28')]['from'],'ListId':_0xa49bd4[_0xe39e('0x34')]});_0x3ad036[_0x149420['body'][_0xe39e('0x38')]]=_0x149420['body'][_0xe39e('0x36')];return db[_0xe39e('0x2a')][_0xe39e('0x46')](_0x3ad036,{'fields':_0x33765a,'raw':!![]});}})[_0xe39e('0x11')](function(_0x271b3a){_0x40dd8b[_0xe39e('0x47')]=_0x271b3a;if(_0x271b3a){var _0xfc02c={'ContactId':_0x271b3a['id'],'FaxAccountId':_0x149420[_0xe39e('0x3a')]['id'],'fax':_0x271b3a[_0xe39e('0x29')]};return db[_0xe39e('0x48')][_0xe39e('0x39')]({'where':{'ContactId':_0x271b3a['id'],'closed':![],'FaxAccountId':_0x149420[_0xe39e('0x3a')]['id']}})[_0xe39e('0x11')](function(_0x511ed2){if(_0x511ed2){return[_0x511ed2,![]];}return db[_0xe39e('0x48')][_0xe39e('0x46')](_0xfc02c)[_0xe39e('0x11')](function(_0xcc3285){return[_0xcc3285,!![]];});});}else{throw new Error(_0xe39e('0x49'));}})[_0xe39e('0x4a')](function(_0x2ce3cb,_0x5a706b){var _0x2c2e3c=_0x2ce3cb[_0xe39e('0x3f')]({'plain':!![]});if(_0x5a706b){if(_0x40dd8b[_0xe39e('0x3a')][_0xe39e('0x4b')]){_0x40dd8b[_0xe39e('0x40')][_0xe39e('0x4c')]({'id':0x0,'priority':_0x40dd8b[_0xe39e('0x40')][_0xe39e('0x45')]+0x1,'app':'close','appdata':_0xe39e('0x4d'),'interval':'*,*,*,*'});}_0x2c2e3c[_0xe39e('0x4e')]=!![];}else{_0x2c2e3c[_0xe39e('0x4e')]=![];}_0x40dd8b['interaction']=_0x2c2e3c;return db['FaxMessage']['create']({'body':_0x149420['body']['body'],'FaxAccountId':_0x149420['account']['id'],'FaxInteractionId':_0x2ce3cb['id'],'direction':'in','ContactId':_0x2ce3cb[_0xe39e('0x4f')],'AttachmentId':_0x149420[_0xe39e('0x28')][_0xe39e('0x50')]});})[_0xe39e('0x11')](function(_0x2ed34b){_0x40dd8b['message']=_0x2ed34b;if(_0x40dd8b[_0xe39e('0x51')][_0xe39e('0x52')]){return db[_0xe39e('0x53')][_0xe39e('0x39')]({'attributes':['id',_0xe39e('0x54')],'where':{'id':_0x40dd8b[_0xe39e('0x51')][_0xe39e('0x52')]}})[_0xe39e('0x11')](function(_0x2e7ff2){if(_0x2e7ff2){_0x40dd8b[_0xe39e('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2e7ff2['name']+','+(_0x40dd8b[_0xe39e('0x3a')][_0xe39e('0x55')]||0xa),'interval':_0xe39e('0x56')});}return respondWithRpcPromise('Start',_0xe39e('0x57'),_0x40dd8b);});}return respondWithRpcPromise(_0xe39e('0x58'),_0xe39e('0x57'),_0x40dd8b);})[_0xe39e('0x11')](function(_0x18bb8e){_0x3803ad(_0x18bb8e);})[_0xe39e('0x1c')](function(_0x1b7a77){_0x734d8d(_0xaef068[_0xe39e('0x18')](0x1f4,_0x1b7a77['message']));});});}; \ No newline at end of file +var _0xb52e=['mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','FaxApplication','Applications','List','get','account','applications','orderBy','asc','Contacts','length','create','contact','find','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','NotifyFaxAccount','fax','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','body','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb52e,0xd9));var _0xeb52=function(_0x2f88ca,_0x3ed9a2){_0x2f88ca=_0x2f88ca-0x0;var _0xaac950=_0xb52e[_0x2f88ca];return _0xaac950;};'use strict';var _=require(_0xeb52('0x0'));var util=require(_0xeb52('0x1'));var moment=require(_0xeb52('0x2'));var BPromise=require(_0xeb52('0x3'));var rs=require(_0xeb52('0x4'));var fs=require('fs');var Redis=require(_0xeb52('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeb52('0x6'))(_0xeb52('0x7'));var config=require(_0xeb52('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeb52('0x9')][_0xeb52('0xa')]({'port':0x232c});config['redis']=_[_0xeb52('0xb')](config[_0xeb52('0xc')],{'host':_0xeb52('0xd'),'port':0x18eb});var socket=require(_0xeb52('0xe'))(new Redis(config[_0xeb52('0xc')]));require(_0xeb52('0xf'))[_0xeb52('0x10')](socket);function respondWithRpcPromise(_0x1bf9b5,_0x18eb42,_0x1bac64){return new BPromise(function(_0x11d01e,_0x3b74c9){return client[_0xeb52('0x11')](_0x1bf9b5,_0x1bac64)[_0xeb52('0x12')](function(_0x586c45){logger[_0xeb52('0x13')]('FaxAccount,\x20%s,\x20%s',_0x18eb42,_0xeb52('0x14'));logger[_0xeb52('0x15')](_0xeb52('0x16'),_0x18eb42,_0xeb52('0x14'),JSON[_0xeb52('0x17')](_0x586c45));if(_0x586c45[_0xeb52('0x18')]){if(_0x586c45[_0xeb52('0x18')][_0xeb52('0x19')]===0x1f4){logger[_0xeb52('0x18')](_0xeb52('0x1a'),_0x18eb42,_0x586c45[_0xeb52('0x18')][_0xeb52('0x1b')]);return _0x3b74c9(_0x586c45[_0xeb52('0x18')][_0xeb52('0x1b')]);}logger['error'](_0xeb52('0x1a'),_0x18eb42,_0x586c45['error'][_0xeb52('0x1b')]);return _0x11d01e(_0x586c45[_0xeb52('0x18')]['message']);}else{logger['info'](_0xeb52('0x1a'),_0x18eb42,_0xeb52('0x14'));_0x11d01e(_0x586c45[_0xeb52('0x1c')][_0xeb52('0x1b')]);}})[_0xeb52('0x1d')](function(_0x1137de){logger['error'](_0xeb52('0x1a'),_0x18eb42,_0x1137de);_0x3b74c9(_0x1137de);});});}exports[_0xeb52('0x1e')]=function(_0x17ed84){var _0x5107d1=this;return new Promise(function(_0x398fab,_0x1ba532){return db[_0xeb52('0x1f')][_0xeb52('0x20')]({'raw':_0x17ed84[_0xeb52('0x21')]?_0x17ed84[_0xeb52('0x21')][_0xeb52('0x22')]===undefined?!![]:![]:!![],'where':_0x17ed84[_0xeb52('0x21')]?_0x17ed84[_0xeb52('0x21')][_0xeb52('0x23')]||null:null,'attributes':_0x17ed84[_0xeb52('0x21')]?_0x17ed84[_0xeb52('0x21')][_0xeb52('0x24')]||null:null,'limit':_0x17ed84['options']?_0x17ed84[_0xeb52('0x21')][_0xeb52('0x25')]||null:null,'include':_0x17ed84[_0xeb52('0x21')]?_0x17ed84[_0xeb52('0x21')][_0xeb52('0x26')]?_['map'](_0x17ed84[_0xeb52('0x21')][_0xeb52('0x26')],function(_0x15d515){return{'model':db[_0x15d515[_0xeb52('0x27')]],'as':_0x15d515['as'],'attributes':_0x15d515[_0xeb52('0x24')],'include':_0x15d515['include']?_[_0xeb52('0x28')](_0x15d515[_0xeb52('0x26')],function(_0x3a6528){return{'model':db[_0x3a6528[_0xeb52('0x27')]],'as':_0x3a6528['as'],'attributes':_0x3a6528['attributes'],'include':_0x3a6528['include']?_['map'](_0x3a6528[_0xeb52('0x26')],function(_0x5e7b98){return{'model':db[_0x5e7b98[_0xeb52('0x27')]],'as':_0x5e7b98['as'],'attributes':_0x5e7b98[_0xeb52('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x283222){logger[_0xeb52('0x13')](_0xeb52('0x1e'),_0x17ed84);logger[_0xeb52('0x15')](_0xeb52('0x1e'),_0x17ed84,JSON[_0xeb52('0x17')](_0x283222));_0x398fab(_0x283222);})[_0xeb52('0x1d')](function(_0x79095d){logger[_0xeb52('0x18')](_0xeb52('0x1e'),_0x79095d[_0xeb52('0x1b')],_0x17ed84);_0x1ba532(_0x5107d1[_0xeb52('0x18')](0x1f4,_0x79095d[_0xeb52('0x1b')]));});});};exports[_0xeb52('0x29')]=function(_0x1da759,_0x39b465,_0x5ae421){var _0x23a8ad=this;return new Promise(function(_0x47848e,_0x2d77e9){var _0xf2a270={'body':_0x1da759['body'],'channel':_0xeb52('0x2a')};var _0x4304b0=[];var _0x17cd27=[];var _0x4c717c={};return db[_0xeb52('0x2b')]['describe']()[_0xeb52('0x12')](function(_0x26101a){if(!_0x26101a){throw new db[(_0xeb52('0x2c'))]['ValidationError'](_0xeb52('0x2d'));}_0x4304b0=_[_0xeb52('0x2e')](_['keys'](_0x26101a),[_0xeb52('0x2f'),'updatedAt']);_0x17cd27=_[_0xeb52('0x2e')](_['keys'](_0x26101a),[_0xeb52('0x2f'),_0xeb52('0x30'),_0xeb52('0x31'),'ListId']);if(_0x1da759[_0xeb52('0x32')]['id']){delete _0x1da759['body']['id'];}if(_[_0xeb52('0x33')](_0x1da759['body'][_0xeb52('0x34')])){throw new db[(_0xeb52('0x2c'))][(_0xeb52('0x35'))](_0xeb52('0x36'));}if(_[_0xeb52('0x33')](_0x1da759['body']['body'])||_0x1da759[_0xeb52('0x32')][_0xeb52('0x32')]===''){throw new db[(_0xeb52('0x2c'))][(_0xeb52('0x35'))](_0xeb52('0x37'));}if(_['isNil'](_0x1da759[_0xeb52('0x32')][_0xeb52('0x38')])){throw new db[(_0xeb52('0x2c'))][(_0xeb52('0x35'))](_0xeb52('0x39')+_0x17cd27);}if(!_[_0xeb52('0x3a')](_0x17cd27,_0x1da759[_0xeb52('0x32')][_0xeb52('0x38')])){throw new db[(_0xeb52('0x2c'))][(_0xeb52('0x35'))](_0xeb52('0x3b')+_0x17cd27);}_0x4c717c[_0x1da759[_0xeb52('0x32')]['mapKey']]=_0x1da759[_0xeb52('0x32')][_0xeb52('0x34')];})['then'](function(){return db['FaxAccount']['find']({'where':{'id':_0x1da759['account']['id']},'include':[{'model':db[_0xeb52('0x3c')],'as':'List','include':[{'model':db[_0xeb52('0x2b')],'as':'Contacts','where':_0x4c717c,'limit':0x1,'order':[['updatedAt',_0xeb52('0x3d')]]}]},{'model':db[_0xeb52('0x3e')],'as':_0xeb52('0x3f')}]});})[_0xeb52('0x12')](function(_0x4b56ea){if(_0x4b56ea&&_0x4b56ea[_0xeb52('0x40')]){var _0xba4a95=_0x4b56ea[_0xeb52('0x41')]({'plain':!![]});_0xf2a270[_0xeb52('0x42')]=_0xba4a95;_0xf2a270[_0xeb52('0x43')]=_0xba4a95[_0xeb52('0x3f')];_0xf2a270['list']=_0xba4a95['List'];_0xf2a270[_0xeb52('0x43')]=_[_0xeb52('0x44')](_0xf2a270['applications'],['priority'],[_0xeb52('0x45')]);if(_0xf2a270[_0xeb52('0x42')][_0xeb52('0x3f')]){delete _0xf2a270[_0xeb52('0x42')]['Applications'];}if(_0xf2a270[_0xeb52('0x42')]['List']&&_0xf2a270[_0xeb52('0x42')][_0xeb52('0x40')][_0xeb52('0x46')][_0xeb52('0x47')]){return _0xf2a270[_0xeb52('0x42')][_0xeb52('0x40')][_0xeb52('0x46')][0x0];}var _0x261530=_[_0xeb52('0xb')](_0x1da759[_0xeb52('0x32')],{'firstName':_0x1da759[_0xeb52('0x32')]['from'],'ListId':_0xba4a95['ListId']});_0x261530[_0x1da759[_0xeb52('0x32')][_0xeb52('0x38')]]=_0x1da759['body'][_0xeb52('0x34')];return db[_0xeb52('0x2b')][_0xeb52('0x48')](_0x261530,{'fields':_0x4304b0,'raw':!![]});}})[_0xeb52('0x12')](function(_0x136dfd){_0xf2a270[_0xeb52('0x49')]=_0x136dfd;if(_0x136dfd){var _0x16e659={'ContactId':_0x136dfd['id'],'FaxAccountId':_0x1da759[_0xeb52('0x42')]['id'],'fax':_0x136dfd[_0xeb52('0x2a')]};return db['FaxInteraction'][_0xeb52('0x4a')]({'where':{'ContactId':_0x136dfd['id'],'closed':![],'FaxAccountId':_0x1da759['account']['id']}})['then'](function(_0x463fca){if(_0x463fca){return[_0x463fca,![]];}return db[_0xeb52('0x4b')][_0xeb52('0x48')](_0x16e659)[_0xeb52('0x12')](function(_0x1a24a9){return[_0x1a24a9,!![]];});});}else{throw new Error(_0xeb52('0x4c'));}})[_0xeb52('0x4d')](function(_0x18a1bd,_0x4eccf7){var _0x20057e=_0x18a1bd['get']({'plain':!![]});if(_0x4eccf7){if(_0xf2a270[_0xeb52('0x42')][_0xeb52('0x4e')]){_0xf2a270[_0xeb52('0x43')]['push']({'id':0x0,'priority':_0xf2a270['applications'][_0xeb52('0x47')]+0x1,'app':_0xeb52('0x4f'),'appdata':_0xeb52('0x50'),'interval':_0xeb52('0x51')});}_0x20057e[_0xeb52('0x52')]=!![];}else{_0x20057e['created']=![];}_0xf2a270[_0xeb52('0x53')]=_0x20057e;return db['FaxMessage'][_0xeb52('0x48')]({'body':_0x1da759[_0xeb52('0x32')][_0xeb52('0x32')],'FaxAccountId':_0x1da759['account']['id'],'FaxInteractionId':_0x18a1bd['id'],'direction':'in','ContactId':_0x18a1bd[_0xeb52('0x54')],'AttachmentId':_0x1da759[_0xeb52('0x32')][_0xeb52('0x55')]});})[_0xeb52('0x12')](function(_0x3e56d6){_0xf2a270['message']=_0x3e56d6;if(_0xf2a270[_0xeb52('0x53')]['UserId']){return db[_0xeb52('0x56')][_0xeb52('0x4a')]({'attributes':['id',_0xeb52('0x57')],'where':{'id':_0xf2a270[_0xeb52('0x53')]['UserId']}})[_0xeb52('0x12')](function(_0x2f3f8d){if(_0x2f3f8d){_0xf2a270['applications'][_0xeb52('0x58')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2f3f8d[_0xeb52('0x57')]+','+(_0xf2a270[_0xeb52('0x42')][_0xeb52('0x59')]||0xa),'interval':_0xeb52('0x51')});}return respondWithRpcPromise(_0xeb52('0x5a'),_0xeb52('0x5b'),_0xf2a270);});}return respondWithRpcPromise(_0xeb52('0x5a'),_0xeb52('0x5b'),_0xf2a270);})['then'](function(_0x3ad554){_0x47848e(_0x3ad554);})[_0xeb52('0x1d')](function(_0x549bdd){_0x2d77e9(_0x23a8ad[_0xeb52('0x18')](0x1f4,_0x549bdd[_0xeb52('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 3650023..913e702 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 _0x4ec3=['length','faxAccount:','./faxAccount.events','update','emit','register'];(function(_0x47f32a,_0x1dbe9b){var _0x22512d=function(_0x4874a0){while(--_0x4874a0){_0x47f32a['push'](_0x47f32a['shift']());}};_0x22512d(++_0x1dbe9b);}(_0x4ec3,0x152));var _0x34ec=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0x4ec3[_0x4b03c9];return _0x161ba2;};'use strict';var FaxAccountEvents=require(_0x34ec('0x0'));var events=['save','remove',_0x34ec('0x1')];function createListener(_0x357fd1,_0x259bb4){return function(_0x899f4f){_0x259bb4[_0x34ec('0x2')](_0x357fd1,_0x899f4f);};}function removeListener(_0x54df98,_0x18ece0){return function(){FaxAccountEvents['removeListener'](_0x54df98,_0x18ece0);};}exports[_0x34ec('0x3')]=function(_0x326866){for(var _0x4c6e42=0x0,_0x35f2ed=events[_0x34ec('0x4')];_0x4c6e42<_0x35f2ed;_0x4c6e42++){var _0x26ea32=events[_0x4c6e42];var _0x5e2d4e=createListener(_0x34ec('0x5')+_0x26ea32,_0x326866);FaxAccountEvents['on'](_0x26ea32,_0x5e2d4e);}}; \ No newline at end of file +var _0x758a=['faxAccount:','remove','update','length'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x758a,0xd5));var _0xa758=function(_0x243e9c,_0x1089a1){_0x243e9c=_0x243e9c-0x0;var _0x1f50b1=_0x758a[_0x243e9c];return _0x1f50b1;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0xa758('0x0'),_0xa758('0x1')];function createListener(_0x22f9be,_0x4f7bdd){return function(_0x27c6c4){_0x4f7bdd['emit'](_0x22f9be,_0x27c6c4);};}function removeListener(_0x47b1c6,_0x502dd5){return function(){FaxAccountEvents['removeListener'](_0x47b1c6,_0x502dd5);};}exports['register']=function(_0x8b76ec){for(var _0x59a1af=0x0,_0x4b31f3=events[_0xa758('0x2')];_0x59a1af<_0x4b31f3;_0x59a1af++){var _0x2d4875=events[_0x59a1af];var _0x13407f=createListener(_0xa758('0x3')+_0x2d4875,_0x8b76ec);FaxAccountEvents['on'](_0x2d4875,_0x13407f);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index f778479..9e35cad 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(_0x2dd429,_0x1e5d4e){var _0x386787=function(_0x10c9c9){while(--_0x10c9c9){_0x2dd429['push'](_0x2dd429['shift']());}};_0x386787(++_0x1e5d4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x16bc92,_0x1b0935){var _0x27a2d2=function(_0x334beb){while(--_0x334beb){_0x16bc92['push'](_0x16bc92['shift']());}};_0x27a2d2(++_0x1b0935);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 8a98998..f631159 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 _0x8cd3=['sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x1f16ea,_0x190662){var _0x4af603=function(_0xddc5d2){while(--_0xddc5d2){_0x1f16ea['push'](_0x1f16ea['shift']());}};_0x4af603(++_0x190662);}(_0x8cd3,0x78));var _0x38cd=function(_0xeacbf2,_0x8491ca){_0xeacbf2=_0xeacbf2-0x0;var _0x57fb89=_0x8cd3[_0xeacbf2];return _0x57fb89;};'use strict';var Sequelize=require(_0x38cd('0x0'));module['exports']={'priority':{'type':Sequelize[_0x38cd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x38cd('0x2')],'allowNull':![],'defaultValue':_0x38cd('0x3')},'appdata':{'type':Sequelize[_0x38cd('0x4')]()},'description':{'type':Sequelize[_0x38cd('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa0e9=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x4980a6,_0x537fff){var _0x5bdfe7=function(_0xec3c41){while(--_0xec3c41){_0x4980a6['push'](_0x4980a6['shift']());}};_0x5bdfe7(++_0x537fff);}(_0xa0e9,0x196));var _0x9a0e=function(_0x2bedef,_0x3af172){_0x2bedef=_0x2bedef-0x0;var _0x57908a=_0xa0e9[_0x2bedef];return _0x57908a;};'use strict';var Sequelize=require(_0x9a0e('0x0'));module[_0x9a0e('0x1')]={'priority':{'type':Sequelize[_0x9a0e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9a0e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9a0e('0x4')]()},'description':{'type':Sequelize[_0x9a0e('0x3')]},'interval':{'type':Sequelize[_0x9a0e('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 d00c812..e87e998 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 _0x1f73=['show','params','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','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','catch'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0x1f73,0x149));var _0x31f7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1f73[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x31f7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x31f7('0x1'));var jsonpatch=require(_0x31f7('0x2'));var rp=require(_0x31f7('0x3'));var moment=require(_0x31f7('0x4'));var BPromise=require(_0x31f7('0x5'));var Mustache=require(_0x31f7('0x6'));var util=require(_0x31f7('0x7'));var path=require(_0x31f7('0x8'));var sox=require(_0x31f7('0x9'));var csv=require(_0x31f7('0xa'));var ejs=require(_0x31f7('0xb'));var fs=require('fs');var fs_extra=require(_0x31f7('0xc'));var _=require(_0x31f7('0xd'));var squel=require(_0x31f7('0xe'));var crypto=require(_0x31f7('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x31f7('0x10'));var toCsv=require('to-csv');var querystring=require(_0x31f7('0x11'));var Papa=require('papaparse');var Redis=require(_0x31f7('0x12'));var authService=require(_0x31f7('0x13'));var qs=require(_0x31f7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31f7('0x15'));var logger=require(_0x31f7('0x16'))(_0x31f7('0x17'));var utils=require(_0x31f7('0x18'));var config=require(_0x31f7('0x19'));var licenseUtil=require(_0x31f7('0x1a'));var db=require(_0x31f7('0x1b'))['db'];function respondWithStatusCode(_0x20956a,_0x1ba782){_0x1ba782=_0x1ba782||0xcc;return function(_0x1ffd86){if(_0x1ffd86){return _0x20956a['sendStatus'](_0x1ba782);}return _0x20956a[_0x31f7('0x1c')](_0x1ba782)[_0x31f7('0x1d')]();};}function respondWithResult(_0x12d39c,_0x3e19ed){_0x3e19ed=_0x3e19ed||0xc8;return function(_0x3da4f2){if(_0x3da4f2){return _0x12d39c[_0x31f7('0x1c')](_0x3e19ed)[_0x31f7('0x1e')](_0x3da4f2);}};}function respondWithFilteredResult(_0x1229ec,_0xa573f1){return function(_0x10be23){if(_0x10be23){var _0x11f886=typeof _0xa573f1[_0x31f7('0x1f')]===_0x31f7('0x20')&&typeof _0xa573f1[_0x31f7('0x21')]===_0x31f7('0x20');var _0x3e2390=_0x10be23[_0x31f7('0x22')];var _0x5d42db=_0x11f886?0x0:_0xa573f1[_0x31f7('0x1f')];var _0x12a8c1=_0x11f886?_0x10be23[_0x31f7('0x22')]:_0xa573f1[_0x31f7('0x1f')]+_0xa573f1[_0x31f7('0x21')];var _0x40d567;if(_0x12a8c1>=_0x3e2390){_0x12a8c1=_0x3e2390;_0x40d567=0xc8;}else{_0x40d567=0xce;}_0x1229ec[_0x31f7('0x1c')](_0x40d567);return _0x1229ec[_0x31f7('0x23')]('Content-Range',_0x5d42db+'-'+_0x12a8c1+'/'+_0x3e2390)[_0x31f7('0x1e')](_0x10be23);}return null;};}function patchUpdates(_0x292910){return function(_0x208875){try{jsonpatch[_0x31f7('0x24')](_0x208875,_0x292910,!![]);}catch(_0x4b90cc){return BPromise[_0x31f7('0x25')](_0x4b90cc);}return _0x208875[_0x31f7('0x26')]();};}function saveUpdates(_0x43ea7f,_0x5bffe2){return function(_0x482987){if(_0x482987){return _0x482987[_0x31f7('0x27')](_0x43ea7f)[_0x31f7('0x28')](function(_0xa8d653){return _0xa8d653;});}return null;};}function removeEntity(_0x5096f5,_0x42ab46){return function(_0x25b7a7){if(_0x25b7a7){return _0x25b7a7[_0x31f7('0x29')]()['then'](function(){_0x5096f5[_0x31f7('0x1c')](0xcc)[_0x31f7('0x1d')]();});}};}function handleEntityNotFound(_0x1d30dd,_0x5e9846){return function(_0x2beffe){if(!_0x2beffe){_0x1d30dd[_0x31f7('0x2a')](0x194);}return _0x2beffe;};}function handleError(_0x25e987,_0x49627b){_0x49627b=_0x49627b||0x1f4;return function(_0x53ae15){logger[_0x31f7('0x2b')](_0x53ae15[_0x31f7('0x2c')]);if(_0x53ae15[_0x31f7('0x2d')]){delete _0x53ae15[_0x31f7('0x2d')];}_0x25e987[_0x31f7('0x1c')](_0x49627b)[_0x31f7('0x2e')](_0x53ae15);};}exports[_0x31f7('0x2f')]=function(_0x621f78,_0xa93bd1){var _0x555506={},_0x5170ea={},_0x55f80b={'count':0x0,'rows':[]};var _0x4df2f0=_[_0x31f7('0x30')](db[_0x31f7('0x31')][_0x31f7('0x32')],function(_0x207f7c){return{'name':_0x207f7c[_0x31f7('0x33')],'type':_0x207f7c[_0x31f7('0x34')][_0x31f7('0x35')]};});_0x5170ea['model']=_['map'](_0x4df2f0,'name');_0x5170ea['query']=_[_0x31f7('0x36')](_0x621f78[_0x31f7('0x37')]);_0x5170ea[_0x31f7('0x38')]=_['intersection'](_0x5170ea['model'],_0x5170ea[_0x31f7('0x37')]);_0x555506[_0x31f7('0x39')]=_[_0x31f7('0x3a')](_0x5170ea[_0x31f7('0x3b')],qs[_0x31f7('0x3c')](_0x621f78[_0x31f7('0x37')]['fields']));_0x555506[_0x31f7('0x39')]=_0x555506[_0x31f7('0x39')][_0x31f7('0x3d')]?_0x555506['attributes']:_0x5170ea[_0x31f7('0x3b')];if(!_0x621f78['query'][_0x31f7('0x3e')](_0x31f7('0x3f'))){_0x555506[_0x31f7('0x21')]=qs[_0x31f7('0x21')](_0x621f78[_0x31f7('0x37')][_0x31f7('0x21')]);_0x555506['offset']=qs[_0x31f7('0x1f')](_0x621f78[_0x31f7('0x37')][_0x31f7('0x1f')]);}_0x555506[_0x31f7('0x40')]=qs[_0x31f7('0x41')](_0x621f78[_0x31f7('0x37')][_0x31f7('0x41')]);_0x555506['where']=qs['filters'](_[_0x31f7('0x42')](_0x621f78[_0x31f7('0x37')],_0x5170ea['filters']),_0x4df2f0);if(_0x621f78[_0x31f7('0x37')][_0x31f7('0x43')]){_0x555506['where']=_[_0x31f7('0x44')](_0x555506['where'],{'$or':_[_0x31f7('0x30')](_0x4df2f0,function(_0x161fbb){if(_0x161fbb['type']!==_0x31f7('0x45')){var _0xe70cf7={};_0xe70cf7[_0x161fbb[_0x31f7('0x2d')]]={'$like':'%'+_0x621f78[_0x31f7('0x37')][_0x31f7('0x43')]+'%'};return _0xe70cf7;}})});}_0x555506=_[_0x31f7('0x44')]({},_0x555506,_0x621f78[_0x31f7('0x46')]);var _0xf38911={'where':_0x555506[_0x31f7('0x47')]};return db[_0x31f7('0x31')][_0x31f7('0x22')](_0xf38911)[_0x31f7('0x28')](function(_0x2dd763){_0x55f80b['count']=_0x2dd763;if(_0x621f78['query'][_0x31f7('0x48')]){_0x555506[_0x31f7('0x49')]=[{'all':!![]}];}return db[_0x31f7('0x31')][_0x31f7('0x4a')](_0x555506);})['then'](function(_0x41673b){_0x55f80b['rows']=_0x41673b;return _0x55f80b;})['then'](respondWithFilteredResult(_0xa93bd1,_0x555506))[_0x31f7('0x4b')](handleError(_0xa93bd1,null));};exports[_0x31f7('0x4c')]=function(_0x532448,_0x33c8cd){var _0x1cd723={'raw':!![],'where':{'id':_0x532448[_0x31f7('0x4d')]['id']}},_0x42e7e8={};_0x42e7e8['model']=_[_0x31f7('0x36')](db[_0x31f7('0x31')][_0x31f7('0x32')]);_0x42e7e8[_0x31f7('0x37')]=_[_0x31f7('0x36')](_0x532448[_0x31f7('0x37')]);_0x42e7e8[_0x31f7('0x38')]=_[_0x31f7('0x3a')](_0x42e7e8[_0x31f7('0x3b')],_0x42e7e8['query']);_0x1cd723[_0x31f7('0x39')]=_[_0x31f7('0x3a')](_0x42e7e8[_0x31f7('0x3b')],qs[_0x31f7('0x3c')](_0x532448[_0x31f7('0x37')][_0x31f7('0x3c')]));_0x1cd723[_0x31f7('0x39')]=_0x1cd723['attributes'][_0x31f7('0x3d')]?_0x1cd723[_0x31f7('0x39')]:_0x42e7e8[_0x31f7('0x3b')];if(_0x532448[_0x31f7('0x37')]['includeAll']){_0x1cd723[_0x31f7('0x49')]=[{'all':!![]}];}_0x1cd723=_[_0x31f7('0x44')]({},_0x1cd723,_0x532448['options']);return db['FaxApplication'][_0x31f7('0x4e')](_0x1cd723)[_0x31f7('0x28')](handleEntityNotFound(_0x33c8cd,null))['then'](respondWithResult(_0x33c8cd,null))[_0x31f7('0x4b')](handleError(_0x33c8cd,null));};exports['create']=function(_0x3fce3d,_0x3d1db5){return db[_0x31f7('0x31')][_0x31f7('0x4f')](_0x3fce3d[_0x31f7('0x50')],{})['then'](respondWithResult(_0x3d1db5,0xc9))[_0x31f7('0x4b')](handleError(_0x3d1db5,null));};exports[_0x31f7('0x27')]=function(_0x311f9d,_0x475a24){if(_0x311f9d[_0x31f7('0x50')]['id']){delete _0x311f9d['body']['id'];}return db[_0x31f7('0x31')]['find']({'where':{'id':_0x311f9d[_0x31f7('0x4d')]['id']}})[_0x31f7('0x28')](handleEntityNotFound(_0x475a24,null))['then'](saveUpdates(_0x311f9d[_0x31f7('0x50')],null))[_0x31f7('0x28')](respondWithResult(_0x475a24,null))[_0x31f7('0x4b')](handleError(_0x475a24,null));};exports['destroy']=function(_0x4c452c,_0xd94ece){return db[_0x31f7('0x31')]['find']({'where':{'id':_0x4c452c['params']['id']}})['then'](handleEntityNotFound(_0xd94ece,null))[_0x31f7('0x28')](removeEntity(_0xd94ece,null))[_0x31f7('0x4b')](handleError(_0xd94ece,null));}; \ No newline at end of file +var _0x4ae6=['where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','error','name','index','map','FaxApplication','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort'];(function(_0x528fd9,_0x4de3c4){var _0x59b2aa=function(_0x958bda){while(--_0x958bda){_0x528fd9['push'](_0x528fd9['shift']());}};_0x59b2aa(++_0x4de3c4);}(_0x4ae6,0xa7));var _0x64ae=function(_0x3c635e,_0x50c248){_0x3c635e=_0x3c635e-0x0;var _0xb737b6=_0x4ae6[_0x3c635e];return _0xb737b6;};'use strict';var emlformat=require(_0x64ae('0x0'));var rimraf=require(_0x64ae('0x1'));var zipdir=require(_0x64ae('0x2'));var jsonpatch=require(_0x64ae('0x3'));var rp=require(_0x64ae('0x4'));var moment=require(_0x64ae('0x5'));var BPromise=require(_0x64ae('0x6'));var Mustache=require(_0x64ae('0x7'));var util=require('util');var path=require('path');var sox=require(_0x64ae('0x8'));var csv=require(_0x64ae('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x64ae('0xa'));var _=require(_0x64ae('0xb'));var squel=require(_0x64ae('0xc'));var crypto=require(_0x64ae('0xd'));var jsforce=require(_0x64ae('0xe'));var deskjs=require(_0x64ae('0xf'));var toCsv=require(_0x64ae('0x9'));var querystring=require(_0x64ae('0x10'));var Papa=require(_0x64ae('0x11'));var Redis=require(_0x64ae('0x12'));var authService=require(_0x64ae('0x13'));var qs=require(_0x64ae('0x14'));var as=require(_0x64ae('0x15'));var hardwareService=require(_0x64ae('0x16'));var logger=require(_0x64ae('0x17'))(_0x64ae('0x18'));var utils=require(_0x64ae('0x19'));var config=require(_0x64ae('0x1a'));var licenseUtil=require(_0x64ae('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf30bc0,_0x4c38a3){_0x4c38a3=_0x4c38a3||0xcc;return function(_0x4593fd){if(_0x4593fd){return _0xf30bc0[_0x64ae('0x1c')](_0x4c38a3);}return _0xf30bc0[_0x64ae('0x1d')](_0x4c38a3)[_0x64ae('0x1e')]();};}function respondWithResult(_0x255503,_0x3fd954){_0x3fd954=_0x3fd954||0xc8;return function(_0x2817b9){if(_0x2817b9){return _0x255503[_0x64ae('0x1d')](_0x3fd954)['json'](_0x2817b9);}};}function respondWithFilteredResult(_0x409673,_0x56d687){return function(_0x2def98){if(_0x2def98){var _0x55983f=typeof _0x56d687[_0x64ae('0x1f')]===_0x64ae('0x20')&&typeof _0x56d687[_0x64ae('0x21')]===_0x64ae('0x20');var _0x1f1313=_0x2def98[_0x64ae('0x22')];var _0x45576b=_0x55983f?0x0:_0x56d687['offset'];var _0x125cfa=_0x55983f?_0x2def98[_0x64ae('0x22')]:_0x56d687[_0x64ae('0x1f')]+_0x56d687['limit'];var _0x26e0a3;if(_0x125cfa>=_0x1f1313){_0x125cfa=_0x1f1313;_0x26e0a3=0xc8;}else{_0x26e0a3=0xce;}_0x409673[_0x64ae('0x1d')](_0x26e0a3);return _0x409673[_0x64ae('0x23')]('Content-Range',_0x45576b+'-'+_0x125cfa+'/'+_0x1f1313)[_0x64ae('0x24')](_0x2def98);}return null;};}function patchUpdates(_0x484a37){return function(_0x494619){try{jsonpatch[_0x64ae('0x25')](_0x494619,_0x484a37,!![]);}catch(_0xf0fd35){return BPromise[_0x64ae('0x26')](_0xf0fd35);}return _0x494619[_0x64ae('0x27')]();};}function saveUpdates(_0x2c75c0,_0x5872c2){return function(_0x473ed5){if(_0x473ed5){return _0x473ed5[_0x64ae('0x28')](_0x2c75c0)[_0x64ae('0x29')](function(_0x11216f){return _0x11216f;});}return null;};}function removeEntity(_0x28af25,_0x1f80cf){return function(_0xceac9e){if(_0xceac9e){return _0xceac9e['destroy']()[_0x64ae('0x29')](function(){_0x28af25[_0x64ae('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x397778,_0xd8e052){return function(_0x34d2a8){if(!_0x34d2a8){_0x397778['sendStatus'](0x194);}return _0x34d2a8;};}function handleError(_0x38f5e0,_0x252111){_0x252111=_0x252111||0x1f4;return function(_0x1e2bfd){logger[_0x64ae('0x2a')](_0x1e2bfd['stack']);if(_0x1e2bfd[_0x64ae('0x2b')]){delete _0x1e2bfd['name'];}_0x38f5e0[_0x64ae('0x1d')](_0x252111)['send'](_0x1e2bfd);};}exports[_0x64ae('0x2c')]=function(_0x4cbe37,_0x45adc0){var _0x4e7edc={},_0x3c4251={},_0xeba891={'count':0x0,'rows':[]};var _0x386c11=_[_0x64ae('0x2d')](db[_0x64ae('0x2e')][_0x64ae('0x2f')],function(_0x4dae7a){return{'name':_0x4dae7a['fieldName'],'type':_0x4dae7a[_0x64ae('0x30')][_0x64ae('0x31')]};});_0x3c4251[_0x64ae('0x32')]=_[_0x64ae('0x2d')](_0x386c11,'name');_0x3c4251[_0x64ae('0x33')]=_[_0x64ae('0x34')](_0x4cbe37[_0x64ae('0x33')]);_0x3c4251[_0x64ae('0x35')]=_[_0x64ae('0x36')](_0x3c4251['model'],_0x3c4251[_0x64ae('0x33')]);_0x4e7edc['attributes']=_[_0x64ae('0x36')](_0x3c4251[_0x64ae('0x32')],qs[_0x64ae('0x37')](_0x4cbe37[_0x64ae('0x33')][_0x64ae('0x37')]));_0x4e7edc['attributes']=_0x4e7edc[_0x64ae('0x38')][_0x64ae('0x39')]?_0x4e7edc[_0x64ae('0x38')]:_0x3c4251['model'];if(!_0x4cbe37[_0x64ae('0x33')]['hasOwnProperty'](_0x64ae('0x3a'))){_0x4e7edc[_0x64ae('0x21')]=qs[_0x64ae('0x21')](_0x4cbe37['query'][_0x64ae('0x21')]);_0x4e7edc[_0x64ae('0x1f')]=qs[_0x64ae('0x1f')](_0x4cbe37[_0x64ae('0x33')][_0x64ae('0x1f')]);}_0x4e7edc[_0x64ae('0x3b')]=qs[_0x64ae('0x3c')](_0x4cbe37['query'][_0x64ae('0x3c')]);_0x4e7edc[_0x64ae('0x3d')]=qs['filters'](_[_0x64ae('0x3e')](_0x4cbe37[_0x64ae('0x33')],_0x3c4251['filters']),_0x386c11);if(_0x4cbe37[_0x64ae('0x33')][_0x64ae('0x3f')]){_0x4e7edc[_0x64ae('0x3d')]=_[_0x64ae('0x40')](_0x4e7edc[_0x64ae('0x3d')],{'$or':_[_0x64ae('0x2d')](_0x386c11,function(_0x5925a3){if(_0x5925a3[_0x64ae('0x30')]!==_0x64ae('0x41')){var _0x21ae73={};_0x21ae73[_0x5925a3[_0x64ae('0x2b')]]={'$like':'%'+_0x4cbe37['query'][_0x64ae('0x3f')]+'%'};return _0x21ae73;}})});}_0x4e7edc=_['merge']({},_0x4e7edc,_0x4cbe37[_0x64ae('0x42')]);var _0x3adabe={'where':_0x4e7edc[_0x64ae('0x3d')]};return db[_0x64ae('0x2e')][_0x64ae('0x22')](_0x3adabe)[_0x64ae('0x29')](function(_0x5dacf8){_0xeba891[_0x64ae('0x22')]=_0x5dacf8;if(_0x4cbe37['query']['includeAll']){_0x4e7edc[_0x64ae('0x43')]=[{'all':!![]}];}return db[_0x64ae('0x2e')][_0x64ae('0x44')](_0x4e7edc);})['then'](function(_0x1f448e){_0xeba891['rows']=_0x1f448e;return _0xeba891;})[_0x64ae('0x29')](respondWithFilteredResult(_0x45adc0,_0x4e7edc))[_0x64ae('0x45')](handleError(_0x45adc0,null));};exports[_0x64ae('0x46')]=function(_0x49c14,_0x543a26){var _0x1f7129={'raw':!![],'where':{'id':_0x49c14[_0x64ae('0x47')]['id']}},_0x116916={};_0x116916[_0x64ae('0x32')]=_[_0x64ae('0x34')](db[_0x64ae('0x2e')][_0x64ae('0x2f')]);_0x116916[_0x64ae('0x33')]=_[_0x64ae('0x34')](_0x49c14['query']);_0x116916[_0x64ae('0x35')]=_['intersection'](_0x116916['model'],_0x116916[_0x64ae('0x33')]);_0x1f7129[_0x64ae('0x38')]=_[_0x64ae('0x36')](_0x116916[_0x64ae('0x32')],qs[_0x64ae('0x37')](_0x49c14[_0x64ae('0x33')][_0x64ae('0x37')]));_0x1f7129[_0x64ae('0x38')]=_0x1f7129[_0x64ae('0x38')][_0x64ae('0x39')]?_0x1f7129[_0x64ae('0x38')]:_0x116916[_0x64ae('0x32')];if(_0x49c14[_0x64ae('0x33')][_0x64ae('0x48')]){_0x1f7129['include']=[{'all':!![]}];}_0x1f7129=_[_0x64ae('0x40')]({},_0x1f7129,_0x49c14[_0x64ae('0x42')]);return db[_0x64ae('0x2e')][_0x64ae('0x49')](_0x1f7129)[_0x64ae('0x29')](handleEntityNotFound(_0x543a26,null))[_0x64ae('0x29')](respondWithResult(_0x543a26,null))[_0x64ae('0x45')](handleError(_0x543a26,null));};exports[_0x64ae('0x4a')]=function(_0x542e22,_0x5a4ae1){return db[_0x64ae('0x2e')]['create'](_0x542e22[_0x64ae('0x4b')],{})[_0x64ae('0x29')](respondWithResult(_0x5a4ae1,0xc9))[_0x64ae('0x45')](handleError(_0x5a4ae1,null));};exports[_0x64ae('0x28')]=function(_0x5e2f1f,_0x26f0c4){if(_0x5e2f1f[_0x64ae('0x4b')]['id']){delete _0x5e2f1f[_0x64ae('0x4b')]['id'];}return db['FaxApplication'][_0x64ae('0x49')]({'where':{'id':_0x5e2f1f[_0x64ae('0x47')]['id']}})[_0x64ae('0x29')](handleEntityNotFound(_0x26f0c4,null))[_0x64ae('0x29')](saveUpdates(_0x5e2f1f[_0x64ae('0x4b')],null))[_0x64ae('0x29')](respondWithResult(_0x26f0c4,null))[_0x64ae('0x45')](handleError(_0x26f0c4,null));};exports['destroy']=function(_0xa41657,_0xb0c4cb){return db[_0x64ae('0x2e')][_0x64ae('0x49')]({'where':{'id':_0xa41657[_0x64ae('0x47')]['id']}})[_0x64ae('0x29')](handleEntityNotFound(_0xb0c4cb,null))[_0x64ae('0x29')](removeEntity(_0xb0c4cb,null))[_0x64ae('0x45')](handleError(_0xb0c4cb,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 16078e2..a40dd8f 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 _0xaf97=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications'];(function(_0x3f6538,_0x55edfe){var _0x1943d3=function(_0x214314){while(--_0x214314){_0x3f6538['push'](_0x3f6538['shift']());}};_0x1943d3(++_0x55edfe);}(_0xaf97,0x122));var _0x7af9=function(_0x4b58db,_0x2a6f89){_0x4b58db=_0x4b58db-0x0;var _0x4fd743=_0xaf97[_0x4b58db];return _0x4fd743;};'use strict';var _=require(_0x7af9('0x0'));var util=require(_0x7af9('0x1'));var logger=require('../../config/logger')(_0x7af9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7af9('0x3'));var rimraf=require('rimraf');var config=require(_0x7af9('0x4'));var attributes=require(_0x7af9('0x5'));module[_0x7af9('0x6')]=function(_0xd5ccba,_0x1f1ca2){return _0xd5ccba[_0x7af9('0x7')](_0x7af9('0x8'),attributes,{'tableName':_0x7af9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7af9('0xa'),'collate':_0x7af9('0xb')});}; \ No newline at end of file +var _0x4e1a=['define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes'];(function(_0x195622,_0x1f682a){var _0x2791e5=function(_0x1d6791){while(--_0x1d6791){_0x195622['push'](_0x195622['shift']());}};_0x2791e5(++_0x1f682a);}(_0x4e1a,0x12a));var _0xa4e1=function(_0x58665b,_0x37ed96){_0x58665b=_0x58665b-0x0;var _0x5ef2ab=_0x4e1a[_0x58665b];return _0x5ef2ab;};'use strict';var _=require(_0xa4e1('0x0'));var util=require(_0xa4e1('0x1'));var logger=require(_0xa4e1('0x2'))(_0xa4e1('0x3'));var moment=require(_0xa4e1('0x4'));var BPromise=require('bluebird');var rp=require(_0xa4e1('0x5'));var fs=require('fs');var path=require(_0xa4e1('0x6'));var rimraf=require(_0xa4e1('0x7'));var config=require(_0xa4e1('0x8'));var attributes=require(_0xa4e1('0x9'));module['exports']=function(_0x573b0b,_0x4e410d){return _0x573b0b[_0xa4e1('0xa')](_0xa4e1('0xb'),attributes,{'tableName':_0xa4e1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa4e1('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index ab7b6e3..89706c2 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 _0x40e3=['body','options','raw','where','limit','info','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update'];(function(_0x41b872,_0x4c4ef9){var _0x439768=function(_0x1aba7d){while(--_0x1aba7d){_0x41b872['push'](_0x41b872['shift']());}};_0x439768(++_0x4c4ef9);}(_0x40e3,0xa1));var _0x340e=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x40e3[_0x35007a];return _0x574f68;};'use strict';var _=require(_0x340e('0x0'));var util=require('util');var moment=require(_0x340e('0x1'));var BPromise=require('bluebird');var rs=require(_0x340e('0x2'));var fs=require('fs');var Redis=require(_0x340e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x340e('0x4'));var logger=require(_0x340e('0x5'))(_0x340e('0x6'));var config=require(_0x340e('0x7'));var jayson=require(_0x340e('0x8'));var client=jayson[_0x340e('0x9')][_0x340e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x307889,_0x1ac08d,_0x2a4f46){return new BPromise(function(_0x3f6f1f,_0x2d338a){return client[_0x340e('0xb')](_0x307889,_0x2a4f46)[_0x340e('0xc')](function(_0x472efe){logger['info'](_0x340e('0xd'),_0x1ac08d,_0x340e('0xe'));logger[_0x340e('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x1ac08d,_0x340e('0xe'),JSON[_0x340e('0x10')](_0x472efe));if(_0x472efe['error']){if(_0x472efe[_0x340e('0x11')][_0x340e('0x12')]===0x1f4){logger['error'](_0x340e('0xd'),_0x1ac08d,_0x472efe['error'][_0x340e('0x13')]);return _0x2d338a(_0x472efe[_0x340e('0x11')]['message']);}logger[_0x340e('0x11')](_0x340e('0xd'),_0x1ac08d,_0x472efe[_0x340e('0x11')][_0x340e('0x13')]);return _0x3f6f1f(_0x472efe[_0x340e('0x11')][_0x340e('0x13')]);}else{logger['info'](_0x340e('0xd'),_0x1ac08d,_0x340e('0xe'));_0x3f6f1f(_0x472efe[_0x340e('0x14')]['message']);}})[_0x340e('0x15')](function(_0x46efa7){logger[_0x340e('0x11')](_0x340e('0xd'),_0x1ac08d,_0x46efa7);_0x2d338a(_0x46efa7);});});}exports[_0x340e('0x16')]=function(_0x6bf277){var _0x134cfc=this;return new Promise(function(_0x1fd455,_0x1ccc13){return db[_0x340e('0x17')][_0x340e('0x18')](_0x6bf277[_0x340e('0x19')],{'raw':_0x6bf277[_0x340e('0x1a')]?_0x6bf277['options'][_0x340e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6bf277[_0x340e('0x1a')]?_0x6bf277[_0x340e('0x1a')][_0x340e('0x1c')]||null:null,'attributes':_0x6bf277[_0x340e('0x1a')]?_0x6bf277['options']['attributes']||null:null,'limit':_0x6bf277[_0x340e('0x1a')]?_0x6bf277[_0x340e('0x1a')][_0x340e('0x1d')]||null:null})[_0x340e('0xc')](function(_0x2875f7){logger[_0x340e('0x1e')]('UpdateFaxApplication',_0x6bf277);logger[_0x340e('0xf')](_0x340e('0x16'),_0x6bf277,JSON[_0x340e('0x10')](_0x2875f7));_0x1fd455(_0x2875f7);})[_0x340e('0x15')](function(_0x441843){logger[_0x340e('0x11')](_0x340e('0x16'),_0x441843[_0x340e('0x13')],_0x6bf277);_0x1ccc13(_0x134cfc['error'](0x1f4,_0x441843[_0x340e('0x13')]));});});}; \ No newline at end of file +var _0x7f42=['message','catch','UpdateFaxApplication','body','options','raw','where','attributes','limit','lodash','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x52850c,_0x249dc8){var _0x113595=function(_0x4a6be5){while(--_0x4a6be5){_0x52850c['push'](_0x52850c['shift']());}};_0x113595(++_0x249dc8);}(_0x7f42,0x1dd));var _0x27f4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7f42[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x27f4('0x0'));var util=require('util');var moment=require(_0x27f4('0x1'));var BPromise=require(_0x27f4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x27f4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x27f4('0x4'));var logger=require('../../config/logger')(_0x27f4('0x5'));var config=require('../../config/environment');var jayson=require(_0x27f4('0x6'));var client=jayson['client'][_0x27f4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a85f2,_0xd283e2,_0x3010e3){return new BPromise(function(_0x2a4b6f,_0x9bc56e){return client[_0x27f4('0x8')](_0x1a85f2,_0x3010e3)[_0x27f4('0x9')](function(_0xe67021){logger[_0x27f4('0xa')](_0x27f4('0xb'),_0xd283e2,_0x27f4('0xc'));logger[_0x27f4('0xd')](_0x27f4('0xe'),_0xd283e2,_0x27f4('0xc'),JSON[_0x27f4('0xf')](_0xe67021));if(_0xe67021[_0x27f4('0x10')]){if(_0xe67021[_0x27f4('0x10')]['code']===0x1f4){logger['error'](_0x27f4('0xb'),_0xd283e2,_0xe67021[_0x27f4('0x10')][_0x27f4('0x11')]);return _0x9bc56e(_0xe67021[_0x27f4('0x10')][_0x27f4('0x11')]);}logger[_0x27f4('0x10')](_0x27f4('0xb'),_0xd283e2,_0xe67021[_0x27f4('0x10')]['message']);return _0x2a4b6f(_0xe67021['error'][_0x27f4('0x11')]);}else{logger[_0x27f4('0xa')](_0x27f4('0xb'),_0xd283e2,_0x27f4('0xc'));_0x2a4b6f(_0xe67021['result'][_0x27f4('0x11')]);}})[_0x27f4('0x12')](function(_0x321821){logger['error'](_0x27f4('0xb'),_0xd283e2,_0x321821);_0x9bc56e(_0x321821);});});}exports[_0x27f4('0x13')]=function(_0x43203e){var _0x49e6c0=this;return new Promise(function(_0x4f4c1d,_0xe4a7b6){return db['FaxApplication']['update'](_0x43203e[_0x27f4('0x14')],{'raw':_0x43203e[_0x27f4('0x15')]?_0x43203e[_0x27f4('0x15')][_0x27f4('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43203e[_0x27f4('0x15')]?_0x43203e[_0x27f4('0x15')][_0x27f4('0x17')]||null:null,'attributes':_0x43203e[_0x27f4('0x15')]?_0x43203e[_0x27f4('0x15')][_0x27f4('0x18')]||null:null,'limit':_0x43203e[_0x27f4('0x15')]?_0x43203e[_0x27f4('0x15')][_0x27f4('0x19')]||null:null})[_0x27f4('0x9')](function(_0x2fbe70){logger['info'](_0x27f4('0x13'),_0x43203e);logger[_0x27f4('0xd')](_0x27f4('0x13'),_0x43203e,JSON[_0x27f4('0xf')](_0x2fbe70));_0x4f4c1d(_0x2fbe70);})[_0x27f4('0x12')](function(_0x3da4c8){logger[_0x27f4('0x10')](_0x27f4('0x13'),_0x3da4c8[_0x27f4('0x11')],_0x43203e);_0xe4a7b6(_0x49e6c0[_0x27f4('0x10')](0x1f4,_0x3da4c8[_0x27f4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index c4f9d4b..315b115 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x34eb5b,_0x16dcb1){var _0x285b30=function(_0x39dde0){while(--_0x39dde0){_0x34eb5b['push'](_0x34eb5b['shift']());}};_0x285b30(++_0x16dcb1);}(_0x5eb8,0xb0));var _0x85eb=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0x5eb8[_0xfc0976];return _0x23579f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x28bdf,_0x5cc58a){var _0x3b5af0=function(_0x54acac){while(--_0x54acac){_0x28bdf['push'](_0x28bdf['shift']());}};_0x3b5af0(++_0x5cc58a);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xb7e7[_0xc67528];return _0x38e26d;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index fe42d4b..0bb072a 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 _0x9604=['exports','DATE','STRING','out','ENUM','sequelize'];(function(_0x3ca54c,_0xdaddba){var _0xbbccb4=function(_0x3a8e20){while(--_0x3a8e20){_0x3ca54c['push'](_0x3ca54c['shift']());}};_0xbbccb4(++_0xdaddba);}(_0x9604,0x14f));var _0x4960=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9604[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4960('0x0'));module[_0x4960('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4960('0x2')]},'disposition':{'type':Sequelize[_0x4960('0x3')]},'secondDisposition':{'type':Sequelize[_0x4960('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4960('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x4960('0x2')]},'fax':{'type':Sequelize[_0x4960('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4960('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4960('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4960('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6796=['STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x5dbd80,_0x3e6717){var _0x133599=function(_0x3fc71a){while(--_0x3fc71a){_0x5dbd80['push'](_0x5dbd80['shift']());}};_0x133599(++_0x3e6717);}(_0x6796,0x195));var _0x6679=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x6796[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require(_0x6679('0x0'));module[_0x6679('0x1')]={'closed':{'type':Sequelize[_0x6679('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6679('0x3')]},'secondDisposition':{'type':Sequelize[_0x6679('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6679('0x3')]},'note':{'type':Sequelize[_0x6679('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x6679('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6679('0x4')]('in',_0x6679('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6679('0x4')]('in',_0x6679('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 c3b72d9..7bcf152 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 _0x27f2=['from','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','text','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','QueryTypes','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.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?','FaxInteractionId','all','rows','params','includeAll','include','options','create','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','rawAttributes','$gte','format','addTags','setTags','spread','findAll','emit','faxInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createReadStream','pipe','resolve','download','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','end','stack','name','send','Users','map','fullname','split','forEach','Tags','push','TagIds','catch','index','FaxInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId'];(function(_0x44b2da,_0xb7e2f8){var _0x442e3a=function(_0x3c1ae0){while(--_0x3c1ae0){_0x44b2da['push'](_0x44b2da['shift']());}};_0x442e3a(++_0xb7e2f8);}(_0x27f2,0x85));var _0x227f=function(_0x1e8417,_0x5d94a7){_0x1e8417=_0x1e8417-0x0;var _0x408c39=_0x27f2[_0x1e8417];return _0x408c39;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x227f('0x0'));var jsonpatch=require(_0x227f('0x1'));var rp=require(_0x227f('0x2'));var moment=require(_0x227f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x227f('0x4'));var util=require(_0x227f('0x5'));var path=require(_0x227f('0x6'));var sox=require('sox');var csv=require(_0x227f('0x7'));var ejs=require(_0x227f('0x8'));var fs=require('fs');var fs_extra=require(_0x227f('0x9'));var _=require('lodash');var squel=require(_0x227f('0xa'));var crypto=require(_0x227f('0xb'));var jsforce=require(_0x227f('0xc'));var deskjs=require(_0x227f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x227f('0xe'));var Papa=require(_0x227f('0xf'));var Redis=require(_0x227f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x227f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x227f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x227f('0x13'));var licenseUtil=require(_0x227f('0x14'));var db=require(_0x227f('0x15'))['db'];config[_0x227f('0x16')]=_[_0x227f('0x17')](config[_0x227f('0x16')],{'host':_0x227f('0x18'),'port':0x18eb});var socket=require(_0x227f('0x19'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x227f('0x1a')](socket);function respondWithStatusCode(_0x10f1ec,_0x186619){_0x186619=_0x186619||0xcc;return function(_0x3b7b68){if(_0x3b7b68){return _0x10f1ec[_0x227f('0x1b')](_0x186619);}return _0x10f1ec['status'](_0x186619)['end']();};}function respondWithResult(_0x774a3d,_0x2b1029){_0x2b1029=_0x2b1029||0xc8;return function(_0x23968a){if(_0x23968a){return _0x774a3d['status'](_0x2b1029)[_0x227f('0x1c')](_0x23968a);}};}function respondWithFilteredResult(_0x399870,_0x53d691){return function(_0x377262){if(_0x377262){var _0x508412=typeof _0x53d691[_0x227f('0x1d')]===_0x227f('0x1e')&&typeof _0x53d691[_0x227f('0x1f')]===_0x227f('0x1e');var _0x1d3ef0=_0x377262[_0x227f('0x20')];var _0x543928=_0x508412?0x0:_0x53d691[_0x227f('0x1d')];var _0x76d21b=_0x508412?_0x377262[_0x227f('0x20')]:_0x53d691[_0x227f('0x1d')]+_0x53d691[_0x227f('0x1f')];var _0x49bb74;if(_0x76d21b>=_0x1d3ef0){_0x76d21b=_0x1d3ef0;_0x49bb74=0xc8;}else{_0x49bb74=0xce;}_0x399870[_0x227f('0x21')](_0x49bb74);return _0x399870[_0x227f('0x22')]('Content-Range',_0x543928+'-'+_0x76d21b+'/'+_0x1d3ef0)[_0x227f('0x1c')](_0x377262);}return null;};}function patchUpdates(_0x4db45c){return function(_0x52a64c){try{jsonpatch[_0x227f('0x23')](_0x52a64c,_0x4db45c,!![]);}catch(_0x6bc3fb){return BPromise[_0x227f('0x24')](_0x6bc3fb);}return _0x52a64c[_0x227f('0x25')]();};}function saveUpdates(_0x3241f4,_0x3a175d){return function(_0x54932d){if(_0x54932d){return _0x54932d[_0x227f('0x26')](_0x3241f4)['then'](function(_0x587e1e){return _0x587e1e;});}return null;};}function removeEntity(_0x291cf9,_0x34b744){return function(_0x18316f){if(_0x18316f){return _0x18316f['destroy']()[_0x227f('0x27')](function(){_0x291cf9[_0x227f('0x21')](0xcc)[_0x227f('0x28')]();});}};}function handleEntityNotFound(_0x367b2f,_0x5c5d49){return function(_0x5e0928){if(!_0x5e0928){_0x367b2f['sendStatus'](0x194);}return _0x5e0928;};}function handleError(_0x23f85f,_0x41cef0){_0x41cef0=_0x41cef0||0x1f4;return function(_0x5b98dc){logger['error'](_0x5b98dc[_0x227f('0x29')]);if(_0x5b98dc[_0x227f('0x2a')]){delete _0x5b98dc[_0x227f('0x2a')];}_0x23f85f[_0x227f('0x21')](_0x41cef0)[_0x227f('0x2b')](_0x5b98dc);};}function getInteractionUsers(_0x44c8c5,_0x5ef3b9){return new BPromise(function(_0x57bdc2,_0x217815){try{if(_0x5ef3b9[_0x44c8c5['id']]){_0x44c8c5[_0x227f('0x2c')]=_[_0x227f('0x2d')](_0x5ef3b9[_0x44c8c5['id']],function(_0x14a15e){return{'id':_0x14a15e['id'],'fullname':_0x14a15e[_0x227f('0x2e')]};});}}catch(_0xe1baae){_0x217815(_0xe1baae);}_0x57bdc2(_0x44c8c5);});}function getInteractionTags(_0xd8ea60,_0x246bc9){return new BPromise(function(_0x25deca,_0x4136e4){try{if(_0xd8ea60['TagIds']){_0xd8ea60['Tags']=[];_0xd8ea60['TagIds'][_0x227f('0x2f')](',')[_0x227f('0x30')](function(_0x4fb104){_0xd8ea60[_0x227f('0x31')][_0x227f('0x32')](_0x246bc9[_0x4fb104]);});}delete _0xd8ea60[_0x227f('0x33')];}catch(_0x564799){_0x4136e4(_0x564799);}_0x25deca(_0xd8ea60);});}function updateFaxInteraction(_0x3fa81e,_0x5e8f47,_0x363962){return new BPromise(function(_0x5ae1a7,_0x5e2769){return getInteractionUsers(_0x3fa81e,_0x363962)[_0x227f('0x27')](function(_0x2589b1){return getInteractionTags(_0x2589b1,_0x5e8f47);})[_0x227f('0x27')](function(_0x30d92e){_0x5ae1a7(_0x30d92e);})[_0x227f('0x34')](function(_0x5f02b4){_0x5e2769(_0x5f02b4);});});}exports[_0x227f('0x35')]=function(_0x133cb9,_0x5bd8db){var _0x145bd4={},_0x5722e={},_0x1d8eec={'count':0x0,'rows':[]};var _0x45b93f=_[_0x227f('0x2d')](db[_0x227f('0x36')]['rawAttributes'],function(_0x5def6b){return{'name':_0x5def6b[_0x227f('0x37')],'type':_0x5def6b[_0x227f('0x38')][_0x227f('0x39')]};});_0x5722e[_0x227f('0x3a')]=_[_0x227f('0x2d')](_0x45b93f,_0x227f('0x2a'));_0x5722e[_0x227f('0x3b')]=_[_0x227f('0x3c')](_0x133cb9[_0x227f('0x3b')]);_0x5722e[_0x227f('0x3d')]=_[_0x227f('0x3e')](_0x5722e[_0x227f('0x3a')],_0x5722e[_0x227f('0x3b')]);_0x145bd4[_0x227f('0x3f')]=_[_0x227f('0x3e')](_0x5722e[_0x227f('0x3a')],qs[_0x227f('0x40')](_0x133cb9[_0x227f('0x3b')][_0x227f('0x40')]));_0x145bd4[_0x227f('0x3f')]=_0x145bd4[_0x227f('0x3f')][_0x227f('0x41')]?_0x145bd4[_0x227f('0x3f')]:_0x5722e[_0x227f('0x3a')];if(!_0x133cb9['query'][_0x227f('0x42')](_0x227f('0x43'))){_0x145bd4[_0x227f('0x1f')]=qs[_0x227f('0x1f')](_0x133cb9['query'][_0x227f('0x1f')]);_0x145bd4[_0x227f('0x1d')]=qs[_0x227f('0x1d')](_0x133cb9[_0x227f('0x3b')][_0x227f('0x1d')]);}_0x145bd4[_0x227f('0x44')]=qs[_0x227f('0x45')](_0x133cb9[_0x227f('0x3b')]['sort']);_0x145bd4[_0x227f('0x46')]=qs[_0x227f('0x3d')](_[_0x227f('0x47')](_0x133cb9[_0x227f('0x3b')],_0x5722e['filters']),_0x45b93f);var _0x55da87=[];var _0x360a4b=squel[_0x227f('0x48')]()[_0x227f('0x49')]('id')[_0x227f('0x49')](_0x227f('0x2a'))[_0x227f('0x49')](_0x227f('0x4a'))['from'](_0x227f('0x4b'));var _0x3b249a=squel[_0x227f('0x48')]()['field'](_0x227f('0x4c'))[_0x227f('0x49')]('u.fullname')[_0x227f('0x49')](_0x227f('0x4d'))['from'](_0x227f('0x4e'),'ui')[_0x227f('0x4f')](_0x227f('0x50'),'u',_0x227f('0x51'));var _0x31fe11=squel[_0x227f('0x48')]()[_0x227f('0x52')]('fax_interactions','i')[_0x227f('0x4f')](_0x227f('0x53'),'c',_0x227f('0x54'))['left_join'](_0x227f('0x50'),'o','o.id\x20=\x20i.UserId')[_0x227f('0x4f')](_0x227f('0x55'),'a',_0x227f('0x56'))[_0x227f('0x4f')](_0x227f('0x57'),'me',_0x227f('0x58'))['left_join'](_0x227f('0x59'),'it',_0x227f('0x5a'))[_0x227f('0x4f')](_0x227f('0x4b'),'t',_0x227f('0x5b'));var _0x23428b=squel['expr']();var _0x38fccb=[];var _0x366611=squel[_0x227f('0x5c')]();var _0x546661;if(_0x133cb9[_0x227f('0x3b')]['search']){_0x546661=as[_0x227f('0x5d')](_0x133cb9['query'][_0x227f('0x5e')]);var _0x4416e9=_0x546661[_0x227f('0x5f')];for(var _0x1a8950=0x0;_0x1a8950<_0x546661[_0x227f('0x60')]['length'];_0x1a8950++){var _0xc72f86=_0x546661['conditions'][_0x1a8950];var _0x3490c0='i';var _0x2fbb8d=_[_0x227f('0x61')](_0x45b93f,[_0x227f('0x2a'),_0xc72f86[_0x227f('0x49')]]);if(!_0x2fbb8d){switch(_0xc72f86[_0x227f('0x49')]){case _0x227f('0x62'):if(_0xc72f86['value']==0x1){_0x31fe11['having']('`'+_0xc72f86[_0x227f('0x49')]+_0x227f('0x63'));}else{_0x31fe11[_0x227f('0x64')]('`'+_0xc72f86[_0x227f('0x49')]+_0x227f('0x65'));}break;case _0x227f('0x66'):if(_0xc72f86[_0x227f('0x67')]===_0x227f('0x68')){if(_0xc72f86[_0x227f('0x69')]['split']('\x20')[_0x227f('0x41')]>0x1){_0x23428b[_0x4416e9](_0x227f('0x6a'),qs[_0x227f('0x6b')](_0xc72f86[_0x227f('0x69')]),null);}else{var _0x22f376='%'+_0xc72f86[_0x227f('0x69')]+'%';_0x23428b[_0x4416e9]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x22f376,_0x22f376,_0x22f376);}}else{_0x2fbb8d=_[_0x227f('0x61')](_0x45b93f,['name','ContactId']);_0xc72f86[_0x227f('0x49')]='ContactId';_0x32c65b=as[_0x227f('0x6c')](_0x3490c0,_0x2fbb8d[_0x227f('0x38')],_0xc72f86);_0x23428b[_0x4416e9](_0x32c65b['text'],_0x32c65b['value'][_0x227f('0x6d')],_0x32c65b[_0x227f('0x69')][_0x227f('0x28')]);}break;case _0x227f('0x6e'):var _0x4cb3a0=_0xc72f86[_0x227f('0x69')][_0x227f('0x2f')](',')[_0x227f('0x2d')](function(_0x3829e1){return Number(_0x3829e1);});_0x4cb3a0[_0x227f('0x30')](function(_0xf7434f){_0x366611['or'](_0x227f('0x6f'),'%,'+_0xf7434f+',%');});_0x38fccb=_[_0x227f('0x70')](_0x38fccb,_0x4cb3a0);break;case _0x227f('0x71'):if(_0xc72f86[_0x227f('0x67')]===_0x227f('0x68')){_0x23428b[_0x4416e9]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xc72f86['value']+'%',null);}else{_0x2fbb8d=_['find'](_0x45b93f,['name',_0x227f('0x72')]);_0xc72f86['field']=_0x227f('0x72');_0x32c65b=as[_0x227f('0x6c')](_0x3490c0,_0x2fbb8d[_0x227f('0x38')],_0xc72f86);_0x23428b[_0x4416e9](_0x32c65b[_0x227f('0x73')],_0x32c65b[_0x227f('0x69')]['start'],_0x32c65b[_0x227f('0x69')][_0x227f('0x28')]);}break;case _0x227f('0x74'):_0x32c65b=as[_0x227f('0x6c')]('me',null,_0xc72f86);_0x23428b[_0x4416e9](_0x32c65b[_0x227f('0x73')],_0x32c65b[_0x227f('0x69')][_0x227f('0x6d')],_0x32c65b[_0x227f('0x69')][_0x227f('0x28')]);break;}}else{var _0x32c65b=as[_0x227f('0x6c')](_0x3490c0,_0x2fbb8d[_0x227f('0x38')],_0xc72f86);_0x23428b[_0x4416e9](_0x32c65b[_0x227f('0x73')],_0x32c65b[_0x227f('0x69')][_0x227f('0x6d')],_0x32c65b['value']['end']);}}}else{var _0x3f35a0=_(_0x133cb9['query'])['keys']()['map'](function(_0x26d4bf){return _[_0x227f('0x75')](_0x45b93f,[_0x227f('0x2a'),_0x26d4bf])?_0x26d4bf:undefined;})[_0x227f('0x76')]()[_0x227f('0x69')]();if(!_[_0x227f('0x77')](_0x3f35a0)){_0x3f35a0[_0x227f('0x30')](function(_0x5976e2){if(_0x5976e2===_0x227f('0x78')){_0x31fe11[_0x227f('0x46')](_0x227f('0x79'),[][_0x227f('0x7a')](_0x133cb9[_0x227f('0x3b')][_0x5976e2]));}else if(_0x5976e2===_0x227f('0x7b')){var _0x1f4bda=JSON['parse'](_0x133cb9[_0x227f('0x3b')][_0x5976e2])['$gte'];var _0x437a61=JSON[_0x227f('0x7c')](_0x133cb9[_0x227f('0x3b')][_0x5976e2])['$lte'];_0x31fe11[_0x227f('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1f4bda,_0x437a61);}else{if(_0x133cb9['query'][_0x5976e2]==='null'){_0x31fe11[_0x227f('0x46')]('i.'+_0x5976e2+_0x227f('0x7d'));}else{_0x31fe11[_0x227f('0x46')]('i.'+_0x5976e2+_0x227f('0x7e'),_0x133cb9[_0x227f('0x3b')][_0x5976e2]);}}});}if(_0x133cb9[_0x227f('0x3b')][_0x227f('0x7f')]){if(_0x133cb9[_0x227f('0x3b')][_0x227f('0x7f')]==0x1){_0x31fe11[_0x227f('0x64')]('`unreadMessages`\x20=\x200');}else{_0x31fe11[_0x227f('0x64')](_0x227f('0x80'));}}if(_0x133cb9[_0x227f('0x3b')][_0x227f('0x81')]){_0x38fccb=_[_0x227f('0x82')](_0x133cb9[_0x227f('0x3b')][_0x227f('0x81')])?_0x133cb9[_0x227f('0x3b')][_0x227f('0x81')]:new Array(_0x133cb9[_0x227f('0x3b')][_0x227f('0x81')]);_0x38fccb['forEach'](function(_0xbdddeb){_0x366611['or'](_0x227f('0x6f'),'%,'+_0xbdddeb+',%');});}if(_0x133cb9[_0x227f('0x3b')][_0x227f('0x83')]){var _0x2a0565=_0x133cb9[_0x227f('0x3b')]['filter'][_0x227f('0x84')]('\x5c','\x5c\x5c')[_0x227f('0x84')](/'/g,'\x27\x27');if(qs[_0x227f('0x85')](_0x2a0565)){_0x23428b['or'](_0x227f('0x86'),_0x2a0565+'%')['or'](_0x227f('0x87'),_0x2a0565+'%');}_0x23428b['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2a0565+'%');}}_0x31fe11[_0x227f('0x46')](_0x23428b);_0x31fe11['group']('i.id');var _0x4b8219={'type':db['Sequelize'][_0x227f('0x88')]['SELECT'],'raw':!![]};var _0x1b2a26=_0x31fe11['clone']();_0x1b2a26[_0x227f('0x49')](_0x227f('0x89'));_0x1b2a26[_0x227f('0x49')](_0x227f('0x8a'),_0x227f('0x62'));if(_0x145bd4[_0x227f('0x44')]){_0x145bd4[_0x227f('0x44')]['forEach'](function(_0x1fca60){var _0x5799d3=_0x1fca60[0x0]===_0x227f('0x8b')?_0x1fca60[0x0]:'i.'+_0x1fca60[0x0];_0x31fe11[_0x227f('0x44')](_0x5799d3,_0x1fca60[0x1]===_0x227f('0x8c')?![]:!![]);});}if(!_[_0x227f('0x77')](_0x38fccb)){_0x31fe11[_0x227f('0x64')](_0x366611);_0x1b2a26[_0x227f('0x46')]('t.id\x20IN\x20?',_0x38fccb);}BPromise['resolve']()[_0x227f('0x27')](function(){if(!_0x546661){if(_0x133cb9[_0x227f('0x3b')]['FaxAccountId'])return;_0x1b2a26[_0x227f('0x46')](_0x227f('0x8d'));_0x31fe11[_0x227f('0x46')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x133cb9[_0x227f('0x8e')]['role']!=='agent')return;return _0x133cb9[_0x227f('0x8e')][_0x227f('0x8f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x21a2c5){if(_['isEmpty'](_0x21a2c5)){_0x1b2a26['where'](_0x227f('0x90'));_0x31fe11[_0x227f('0x46')](_0x227f('0x90'));}else{_0x1b2a26[_0x227f('0x46')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x21a2c5,'id'));_0x31fe11[_0x227f('0x46')](_0x227f('0x79'),_[_0x227f('0x2d')](_0x21a2c5,'id'));}});})[_0x227f('0x27')](function(){if(_0x133cb9[_0x227f('0x8e')]['role']===_0x227f('0x91')&&!_0x546661&&!_0x133cb9['query'][_0x227f('0x78')])return[];return db[_0x227f('0x92')][_0x227f('0x3b')](_0x1b2a26[_0x227f('0x93')](),_0x4b8219);})[_0x227f('0x27')](function(_0x3dae11){_0x1d8eec[_0x227f('0x20')]=_0x3dae11['length'];if(_0x1d8eec[_0x227f('0x20')]===0x0)return[];return db[_0x227f('0x92')]['query'](_0x360a4b[_0x227f('0x93')](),_0x4b8219)[_0x227f('0x27')](function(_0x4b5870){_0x55da87=_[_0x227f('0x94')](_0x4b5870,'id');_0x4b8219=_[_0x227f('0x95')](_0x4b8219,{'model':db[_0x227f('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x133cb9['query'][_0x227f('0x40')]){_0x145bd4[_0x227f('0x3f')][_0x227f('0x30')](function(_0x294f41){_0x31fe11['field']('i.'+_0x294f41);});}else{_0x31fe11[_0x227f('0x49')](_0x227f('0x8a'),_0x227f('0x62'));_0x31fe11[_0x227f('0x49')](_0x227f('0x96'),_0x227f('0x97'));_0x31fe11[_0x227f('0x49')](_0x227f('0x98'),_0x227f('0x99'));_0x31fe11[_0x227f('0x49')](_0x227f('0x9a'),_0x227f('0x8b'));_0x31fe11['field']('i.*');_0x31fe11[_0x227f('0x49')](_0x227f('0x9b'),_0x227f('0x9c'));_0x31fe11['field'](_0x227f('0x9d'),'Contact.lastName');_0x31fe11[_0x227f('0x49')](_0x227f('0x9e'),_0x227f('0x9f'));_0x31fe11['field']('c.phone',_0x227f('0xa0'));_0x31fe11[_0x227f('0x49')](_0x227f('0xa1'),_0x227f('0xa2'));_0x31fe11['field'](_0x227f('0xa3'),_0x227f('0xa4'));_0x31fe11[_0x227f('0x49')](_0x227f('0xa5'),_0x227f('0xa6'));_0x31fe11['field'](_0x227f('0xa7'),_0x227f('0xa8'));_0x31fe11[_0x227f('0x49')](_0x227f('0xa9'),_0x227f('0x33'));}if(_0x145bd4['limit'])_0x31fe11[_0x227f('0x1f')](_0x145bd4[_0x227f('0x1f')]);if(_0x145bd4[_0x227f('0x1d')])_0x31fe11[_0x227f('0x1d')](_0x145bd4[_0x227f('0x1d')]);return db[_0x227f('0x92')][_0x227f('0x3b')](_0x31fe11['toString'](),_0x4b8219);})[_0x227f('0x27')](function(_0x14a010){if(_0x14a010[_0x227f('0x41')]>0x0)_0x3b249a[_0x227f('0x46')](_0x227f('0xaa'),_[_0x227f('0x2d')](_0x14a010,'id'));return db[_0x227f('0x92')][_0x227f('0x3b')](_0x3b249a[_0x227f('0x93')](),_0x4b8219)['then'](function(_0x2487d8){var _0x5793a3=_['groupBy'](_0x2487d8,_0x227f('0xab'));var _0x2774f8=[];_0x14a010[_0x227f('0x30')](function(_0x360e73){_0x2774f8[_0x227f('0x32')](updateFaxInteraction(_0x360e73,_0x55da87,_0x5793a3));});return BPromise[_0x227f('0xac')](_0x2774f8);});});})[_0x227f('0x27')](function(_0x1fb4ed){_0x1d8eec[_0x227f('0xad')]=_0x1fb4ed;return _0x1d8eec;})[_0x227f('0x27')](respondWithFilteredResult(_0x5bd8db,_0x145bd4))[_0x227f('0x34')](handleError(_0x5bd8db,null));};exports['show']=function(_0x1bce12,_0x2bc863){var _0x70ec56={'raw':![],'where':{'id':_0x1bce12[_0x227f('0xae')]['id']}},_0x304bf9={};_0x304bf9[_0x227f('0x3a')]=_[_0x227f('0x3c')](db[_0x227f('0x36')]['rawAttributes']);_0x304bf9[_0x227f('0x3b')]=_['keys'](_0x1bce12[_0x227f('0x3b')]);_0x304bf9['filters']=_[_0x227f('0x3e')](_0x304bf9[_0x227f('0x3a')],_0x304bf9[_0x227f('0x3b')]);_0x70ec56[_0x227f('0x3f')]=_[_0x227f('0x3e')](_0x304bf9[_0x227f('0x3a')],qs['fields'](_0x1bce12[_0x227f('0x3b')]['fields']));_0x70ec56[_0x227f('0x3f')]=_0x70ec56[_0x227f('0x3f')][_0x227f('0x41')]?_0x70ec56[_0x227f('0x3f')]:_0x304bf9['model'];if(_0x1bce12[_0x227f('0x3b')][_0x227f('0xaf')]){_0x70ec56[_0x227f('0xb0')]=[{'all':!![]}];}_0x70ec56=_[_0x227f('0x95')]({},_0x70ec56,_0x1bce12[_0x227f('0xb1')]);return db[_0x227f('0x36')][_0x227f('0x61')](_0x70ec56)[_0x227f('0x27')](handleEntityNotFound(_0x2bc863,null))[_0x227f('0x27')](respondWithResult(_0x2bc863,null))[_0x227f('0x34')](handleError(_0x2bc863,null));};exports[_0x227f('0xb2')]=function(_0x1bd019,_0x59e0d2){return db[_0x227f('0x36')][_0x227f('0xb2')](_0x1bd019[_0x227f('0x74')],{})[_0x227f('0x27')](respondWithResult(_0x59e0d2,0xc9))[_0x227f('0x34')](handleError(_0x59e0d2,null));};exports[_0x227f('0x26')]=function(_0xfd0946,_0x656b2f){if(_0xfd0946['body']['id']){delete _0xfd0946[_0x227f('0x74')]['id'];}return db[_0x227f('0x36')][_0x227f('0x61')]({'where':{'id':_0xfd0946[_0x227f('0xae')]['id']}})['then'](handleEntityNotFound(_0x656b2f,null))[_0x227f('0x27')](saveUpdates(_0xfd0946[_0x227f('0x74')],null))[_0x227f('0x27')](respondWithResult(_0x656b2f,null))[_0x227f('0x34')](handleError(_0x656b2f,null));};exports[_0x227f('0xb3')]=function(_0x258443,_0x35cc6f){return db[_0x227f('0x36')]['find']({'where':{'id':_0x258443[_0x227f('0xae')]['id']}})['then'](handleEntityNotFound(_0x35cc6f,null))[_0x227f('0x27')](removeEntity(_0x35cc6f,null))[_0x227f('0x34')](handleError(_0x35cc6f,null));};exports[_0x227f('0xb4')]=function(_0x4b0777,_0x4413d9){return db[_0x227f('0x36')][_0x227f('0xb4')]()[_0x227f('0x27')](respondWithResult(_0x4413d9,null))[_0x227f('0x34')](handleError(_0x4413d9,null));};exports[_0x227f('0xb5')]=function(_0x5a26ff,_0x1c4817,_0x291bca){return db[_0x227f('0xb6')][_0x227f('0x61')]({'where':{'id':_0x5a26ff[_0x227f('0xae')]['id']}})[_0x227f('0x27')](handleEntityNotFound(_0x1c4817,null))[_0x227f('0x27')](function(_0x3ac24a){if(_0x3ac24a){return _0x3ac24a['addMessage'](_0x5a26ff['body'][_0x227f('0xb7')],_[_0x227f('0xb8')](_0x5a26ff[_0x227f('0x74')],[_0x227f('0xb7'),'id'])||{});}})['then'](respondWithResult(_0x1c4817,null))[_0x227f('0x34')](handleError(_0x1c4817,null));};exports[_0x227f('0xb9')]=function(_0x3cc109,_0x2cd423,_0x4a241a){var _0x1e5039={'raw':![],'where':{}};var _0x4013fa={};var _0x5a1309={'count':0x0,'rows':[]};return db[_0x227f('0x36')][_0x227f('0xba')]({'where':{'id':_0x3cc109[_0x227f('0xae')]['id']}})['then'](handleEntityNotFound(_0x2cd423,null))[_0x227f('0x27')](function(_0x1764d0){if(_0x1764d0){_0x4013fa[_0x227f('0x3a')]=_[_0x227f('0x3c')](db[_0x227f('0xb6')][_0x227f('0xbb')]);_0x4013fa[_0x227f('0x3b')]=_[_0x227f('0x3c')](_0x3cc109[_0x227f('0x3b')]);_0x4013fa['filters']=_['intersection'](_0x4013fa[_0x227f('0x3a')],_0x4013fa[_0x227f('0x3b')]);_0x1e5039[_0x227f('0x3f')]=_[_0x227f('0x3e')](_0x4013fa['model'],qs['fields'](_0x3cc109[_0x227f('0x3b')]['fields']));_0x1e5039[_0x227f('0x3f')]=_0x1e5039[_0x227f('0x3f')][_0x227f('0x41')]?_0x1e5039['attributes']:_0x4013fa[_0x227f('0x3a')];if(!_0x3cc109['query'][_0x227f('0x42')](_0x227f('0x43'))){_0x1e5039[_0x227f('0x1f')]=qs[_0x227f('0x1f')](_0x3cc109[_0x227f('0x3b')][_0x227f('0x1f')]);_0x1e5039[_0x227f('0x1d')]=qs[_0x227f('0x1d')](_0x3cc109[_0x227f('0x3b')]['offset']);}_0x1e5039['order']=qs[_0x227f('0x45')](_0x3cc109[_0x227f('0x3b')][_0x227f('0x45')]);_0x1e5039[_0x227f('0x46')]=qs[_0x227f('0x3d')](_[_0x227f('0x47')](_0x3cc109[_0x227f('0x3b')],_0x4013fa[_0x227f('0x3d')]));_0x1e5039[_0x227f('0x46')][_0x227f('0xab')]=_0x1764d0['id'];if(_0x3cc109[_0x227f('0x3b')][_0x227f('0x83')]){_0x1e5039[_0x227f('0x46')]=_[_0x227f('0x95')](_0x1e5039[_0x227f('0x46')],{'$or':_[_0x227f('0x2d')](_0x1e5039[_0x227f('0x3f')],function(_0x4d958d){var _0x1e5e60={};_0x1e5e60[_0x4d958d]={'$like':'%'+_0x3cc109[_0x227f('0x3b')][_0x227f('0x83')]+'%'};return _0x1e5e60;})});}if(_0x3cc109[_0x227f('0x3b')][_0x227f('0xbc')]){var _0x20c13c=_0x3cc109[_0x227f('0x3b')][_0x227f('0xbc')][_0x227f('0x2f')](',');var _0x4231c0={};_0x4231c0[_0x20c13c[0x0]]={'$gte':moment(_0x20c13c[0x1])[_0x227f('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1e5039[_0x227f('0x46')]=_['merge'](_0x1e5039[_0x227f('0x46')],_0x4231c0);}_0x1e5039=_[_0x227f('0x95')]({},_0x1e5039,_0x3cc109[_0x227f('0xb1')]);return db[_0x227f('0xb6')]['count']({'where':_0x1e5039[_0x227f('0x46')]})[_0x227f('0x27')](function(_0x2677ce){_0x5a1309[_0x227f('0x20')]=_0x2677ce;if(_0x3cc109[_0x227f('0x3b')][_0x227f('0xaf')]){_0x1e5039[_0x227f('0xb0')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x1e5039);})['then'](function(_0x4763cf){_0x5a1309[_0x227f('0xad')]=_0x4763cf;return _0x5a1309;});}})[_0x227f('0x27')](respondWithFilteredResult(_0x2cd423,_0x1e5039))[_0x227f('0x34')](handleError(_0x2cd423,null));};exports[_0x227f('0xbe')]=function(_0x835492,_0x2bdf11,_0x1053ce){return db[_0x227f('0x36')][_0x227f('0x61')]({'where':{'id':_0x835492[_0x227f('0xae')]['id']}})[_0x227f('0x27')](handleEntityNotFound(_0x2bdf11,null))['then'](function(_0x40163b){if(_0x40163b){return _0x40163b[_0x227f('0xbf')](_0x835492[_0x227f('0x74')][_0x227f('0xb7')],_[_0x227f('0xb8')](_0x835492[_0x227f('0x74')],[_0x227f('0xb7'),'id'])||{})[_0x227f('0xc0')](function(){return db[_0x227f('0x6e')][_0x227f('0xc1')]({'attributes':['id','name','color'],'where':{'id':_0x835492['body'][_0x227f('0xb7')]}});})['then'](function(_0x135c78){socket[_0x227f('0xc2')](_0x227f('0xc3'),{'id':Number(_0x835492['params']['id']),'tags':_0x135c78||[]});return{'id':Number(_0x835492[_0x227f('0xae')]['id']),'tags':_0x135c78||[]};});}})[_0x227f('0x27')](respondWithResult(_0x2bdf11,null))[_0x227f('0x34')](handleError(_0x2bdf11,null));};exports[_0x227f('0xc4')]=function(_0x42b1e8,_0x2d3427,_0x320691){return db['FaxInteraction'][_0x227f('0x61')]({'where':{'id':_0x42b1e8[_0x227f('0xae')]['id']}})[_0x227f('0x27')](handleEntityNotFound(_0x2d3427,null))[_0x227f('0x27')](function(_0x8b6052){if(_0x8b6052){return _0x8b6052[_0x227f('0xc4')](_0x42b1e8[_0x227f('0x3b')][_0x227f('0xb7')]);}})[_0x227f('0x27')](respondWithStatusCode(_0x2d3427,null))[_0x227f('0x34')](handleError(_0x2d3427,null));};exports['download']=function(_0x4806fe,_0x515260){var _0x17f13a=moment()[_0x227f('0xc5')]()[_0x227f('0x93')]();var _0x5eaa42=path[_0x227f('0xc6')](config[_0x227f('0xc7')],_0x227f('0xc8'),_0x227f('0xc9'),_0x227f('0xca'));var _0x5d2860=path[_0x227f('0xc6')](config[_0x227f('0xc7')],_0x227f('0xc8'),_0x227f('0xc9'),_0x227f('0xcb'));var _0x3d608f=path[_0x227f('0xc6')](_0x5eaa42,_0x17f13a);var _0x5a8043=util['format'](_0x227f('0xcc'),_0x4806fe[_0x227f('0xae')]['id'],_0x17f13a);var _0x11bda6=path[_0x227f('0xc6')](_0x5eaa42,_0x5a8043);var _0x16feb6=[];_0x16feb6[_0x227f('0x32')]({'model':db[_0x227f('0xcd')],'as':_0x227f('0xcd'),'raw':!![]});var _0x2b5d45=[{'model':db[_0x227f('0xb6')],'as':'Messages','attributes':['id',_0x227f('0x74'),_0x227f('0x7b')],'include':_0x16feb6}];return db[_0x227f('0x36')]['find']({'where':{'id':_0x4806fe['params']['id']},'include':_0x2b5d45})['then'](handleEntityNotFound(_0x515260,null))['then'](function(_0x3b3f6e){if(_0x3b3f6e&&_0x3b3f6e[_0x227f('0xce')]){var _0x458fa0=_0x3b3f6e[_0x227f('0xcf')]({'plain':!![]});fs[_0x227f('0xd0')](_0x3d608f);for(var _0x54cb9e=0x0;_0x54cb9e<_0x458fa0[_0x227f('0xce')]['length'];_0x54cb9e++){var _0x247306=_0x458fa0['Messages'][_0x54cb9e][_0x227f('0xcd')];if(_0x247306){var _0x2d2120=path['join'](_0x5d2860,_0x247306[_0x227f('0xd1')]);if(fs['existsSync'](_0x2d2120)){fs[_0x227f('0xd2')](_0x2d2120)[_0x227f('0xd3')](fs['createWriteStream'](path[_0x227f('0xc6')](_0x3d608f,_0x247306['basename'])));}}}return BPromise[_0x227f('0xd4')]()[_0x227f('0x27')](function(){return new BPromise(function(_0x19218e,_0x9ef1a8){zipdir(_0x3d608f,{'saveTo':_0x11bda6},function(_0x36a473,_0x15da72){if(_0x36a473)return _0x9ef1a8(_0x36a473);return _0x19218e(_0x15da72);});})[_0x227f('0x27')](function(){return new BPromise(function(_0x2687ea,_0x4b3c8b){rimraf(_0x3d608f,function(_0x46f76e){if(_0x46f76e)_0x4b3c8b(_0x46f76e);return _0x2687ea();});});})[_0x227f('0x27')](function(){return _0x515260[_0x227f('0xd5')](_0x11bda6,_0x5a8043,function(_0x413d87){if(_0x413d87){console['log']('err',_0x413d87);}else{fs[_0x227f('0xd6')](_0x11bda6);}});});});}else{return _0x515260[_0x227f('0x1b')](0xc8);}})[_0x227f('0x34')](handleError(_0x515260,null));}; \ No newline at end of file +var _0x0e29=['operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','FaxAccountId','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','SELECT','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','agent','sequelize','toString','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.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','params','includeAll','options','catch','create','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','spread','Tag','color','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','createReadStream','log','err','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','reject','save','update','then','destroy','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','index','map','FaxInteraction','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','query','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact'];(function(_0x58275d,_0x1e1342){var _0x1ef03e=function(_0x2a5b43){while(--_0x2a5b43){_0x58275d['push'](_0x58275d['shift']());}};_0x1ef03e(++_0x1e1342);}(_0x0e29,0x13e));var _0x90e2=function(_0x4b5992,_0x1af2c4){_0x4b5992=_0x4b5992-0x0;var _0x61a89=_0x0e29[_0x4b5992];return _0x61a89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90e2('0x0'));var zipdir=require(_0x90e2('0x1'));var jsonpatch=require(_0x90e2('0x2'));var rp=require(_0x90e2('0x3'));var moment=require('moment');var BPromise=require(_0x90e2('0x4'));var Mustache=require(_0x90e2('0x5'));var util=require(_0x90e2('0x6'));var path=require(_0x90e2('0x7'));var sox=require(_0x90e2('0x8'));var csv=require(_0x90e2('0x9'));var ejs=require(_0x90e2('0xa'));var fs=require('fs');var fs_extra=require(_0x90e2('0xb'));var _=require(_0x90e2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x90e2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x90e2('0xe'));var Papa=require(_0x90e2('0xf'));var Redis=require(_0x90e2('0x10'));var authService=require(_0x90e2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x90e2('0x12'));var hardwareService=require(_0x90e2('0x13'));var logger=require('../../config/logger')(_0x90e2('0x14'));var utils=require(_0x90e2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x90e2('0x16')]=_['defaults'](config[_0x90e2('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x90e2('0x17'))(new Redis(config[_0x90e2('0x16')]));require(_0x90e2('0x18'))[_0x90e2('0x19')](socket);function respondWithStatusCode(_0x3ea734,_0x16a3bc){_0x16a3bc=_0x16a3bc||0xcc;return function(_0x395bc6){if(_0x395bc6){return _0x3ea734[_0x90e2('0x1a')](_0x16a3bc);}return _0x3ea734[_0x90e2('0x1b')](_0x16a3bc)[_0x90e2('0x1c')]();};}function respondWithResult(_0x24d6a1,_0x56a795){_0x56a795=_0x56a795||0xc8;return function(_0x197879){if(_0x197879){return _0x24d6a1[_0x90e2('0x1b')](_0x56a795)[_0x90e2('0x1d')](_0x197879);}};}function respondWithFilteredResult(_0x4bdbc1,_0x23a640){return function(_0x6c2d0d){if(_0x6c2d0d){var _0x42c21f=typeof _0x23a640[_0x90e2('0x1e')]==='undefined'&&typeof _0x23a640[_0x90e2('0x1f')]===_0x90e2('0x20');var _0x3d869e=_0x6c2d0d['count'];var _0xdad4ca=_0x42c21f?0x0:_0x23a640[_0x90e2('0x1e')];var _0x9cc97d=_0x42c21f?_0x6c2d0d[_0x90e2('0x21')]:_0x23a640['offset']+_0x23a640[_0x90e2('0x1f')];var _0x56fc01;if(_0x9cc97d>=_0x3d869e){_0x9cc97d=_0x3d869e;_0x56fc01=0xc8;}else{_0x56fc01=0xce;}_0x4bdbc1[_0x90e2('0x1b')](_0x56fc01);return _0x4bdbc1['set']('Content-Range',_0xdad4ca+'-'+_0x9cc97d+'/'+_0x3d869e)[_0x90e2('0x1d')](_0x6c2d0d);}return null;};}function patchUpdates(_0x390a60){return function(_0x5292b2){try{jsonpatch['apply'](_0x5292b2,_0x390a60,!![]);}catch(_0x265a79){return BPromise[_0x90e2('0x22')](_0x265a79);}return _0x5292b2[_0x90e2('0x23')]();};}function saveUpdates(_0x1a5f2e,_0x573c51){return function(_0x152f26){if(_0x152f26){return _0x152f26[_0x90e2('0x24')](_0x1a5f2e)[_0x90e2('0x25')](function(_0x57fb0d){return _0x57fb0d;});}return null;};}function removeEntity(_0x2ca74e,_0x59445e){return function(_0x3bf525){if(_0x3bf525){return _0x3bf525[_0x90e2('0x26')]()[_0x90e2('0x25')](function(){_0x2ca74e[_0x90e2('0x1b')](0xcc)[_0x90e2('0x1c')]();});}};}function handleEntityNotFound(_0x2dfd35,_0x5c021c){return function(_0xcfd448){if(!_0xcfd448){_0x2dfd35['sendStatus'](0x194);}return _0xcfd448;};}function handleError(_0x2c1cb2,_0xec5ddb){_0xec5ddb=_0xec5ddb||0x1f4;return function(_0x1b0a69){logger[_0x90e2('0x27')](_0x1b0a69[_0x90e2('0x28')]);if(_0x1b0a69[_0x90e2('0x29')]){delete _0x1b0a69[_0x90e2('0x29')];}_0x2c1cb2[_0x90e2('0x1b')](_0xec5ddb)[_0x90e2('0x2a')](_0x1b0a69);};}function getInteractionUsers(_0x21f65b,_0x4a3fc9){return new BPromise(function(_0x438021,_0x4fb358){try{if(_0x4a3fc9[_0x21f65b['id']]){_0x21f65b[_0x90e2('0x2b')]=_['map'](_0x4a3fc9[_0x21f65b['id']],function(_0xaac1fa){return{'id':_0xaac1fa['id'],'fullname':_0xaac1fa[_0x90e2('0x2c')]};});}}catch(_0x17798b){_0x4fb358(_0x17798b);}_0x438021(_0x21f65b);});}function getInteractionTags(_0x470917,_0x167e88){return new BPromise(function(_0x1fda20,_0xc31296){try{if(_0x470917[_0x90e2('0x2d')]){_0x470917[_0x90e2('0x2e')]=[];_0x470917[_0x90e2('0x2d')][_0x90e2('0x2f')](',')[_0x90e2('0x30')](function(_0x5ebf04){_0x470917['Tags'][_0x90e2('0x31')](_0x167e88[_0x5ebf04]);});}delete _0x470917[_0x90e2('0x2d')];}catch(_0x240a9b){_0xc31296(_0x240a9b);}_0x1fda20(_0x470917);});}function updateFaxInteraction(_0x277b52,_0x35ffb7,_0x2f83b1){return new BPromise(function(_0xbaddd6,_0x30a0f4){return getInteractionUsers(_0x277b52,_0x2f83b1)['then'](function(_0x56907f){return getInteractionTags(_0x56907f,_0x35ffb7);})[_0x90e2('0x25')](function(_0x4aff1e){_0xbaddd6(_0x4aff1e);})['catch'](function(_0xc70754){_0x30a0f4(_0xc70754);});});}exports[_0x90e2('0x32')]=function(_0x29c11e,_0x56c678){var _0x2136de={},_0x2a1d30={},_0x3d2b89={'count':0x0,'rows':[]};var _0x526eff=_[_0x90e2('0x33')](db[_0x90e2('0x34')][_0x90e2('0x35')],function(_0x9bf6c1){return{'name':_0x9bf6c1[_0x90e2('0x36')],'type':_0x9bf6c1[_0x90e2('0x37')]['key']};});_0x2a1d30['model']=_[_0x90e2('0x33')](_0x526eff,_0x90e2('0x29'));_0x2a1d30['query']=_[_0x90e2('0x38')](_0x29c11e['query']);_0x2a1d30[_0x90e2('0x39')]=_[_0x90e2('0x3a')](_0x2a1d30[_0x90e2('0x3b')],_0x2a1d30['query']);_0x2136de[_0x90e2('0x3c')]=_[_0x90e2('0x3a')](_0x2a1d30[_0x90e2('0x3b')],qs[_0x90e2('0x3d')](_0x29c11e['query'][_0x90e2('0x3d')]));_0x2136de['attributes']=_0x2136de['attributes'][_0x90e2('0x3e')]?_0x2136de[_0x90e2('0x3c')]:_0x2a1d30[_0x90e2('0x3b')];if(!_0x29c11e['query'][_0x90e2('0x3f')](_0x90e2('0x40'))){_0x2136de['limit']=qs['limit'](_0x29c11e[_0x90e2('0x41')][_0x90e2('0x1f')]);_0x2136de[_0x90e2('0x1e')]=qs[_0x90e2('0x1e')](_0x29c11e['query'][_0x90e2('0x1e')]);}_0x2136de[_0x90e2('0x42')]=qs[_0x90e2('0x43')](_0x29c11e[_0x90e2('0x41')][_0x90e2('0x43')]);_0x2136de[_0x90e2('0x44')]=qs[_0x90e2('0x39')](_[_0x90e2('0x45')](_0x29c11e[_0x90e2('0x41')],_0x2a1d30[_0x90e2('0x39')]),_0x526eff);var _0x411e5f=[];var _0x1d4d0b=squel[_0x90e2('0x46')]()[_0x90e2('0x47')]('id')[_0x90e2('0x47')](_0x90e2('0x29'))[_0x90e2('0x47')]('color')[_0x90e2('0x48')](_0x90e2('0x49'));var _0x47da1a=squel[_0x90e2('0x46')]()['field'](_0x90e2('0x4a'))[_0x90e2('0x47')](_0x90e2('0x4b'))['field'](_0x90e2('0x4c'))[_0x90e2('0x48')](_0x90e2('0x4d'),'ui')[_0x90e2('0x4e')](_0x90e2('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x244cd0=squel[_0x90e2('0x46')]()[_0x90e2('0x48')](_0x90e2('0x50'),'i')[_0x90e2('0x4e')](_0x90e2('0x51'),'c',_0x90e2('0x52'))[_0x90e2('0x4e')]('users','o','o.id\x20=\x20i.UserId')[_0x90e2('0x4e')]('fax_accounts','a','a.id\x20=\x20i.FaxAccountId')[_0x90e2('0x4e')]('fax_messages','me',_0x90e2('0x53'))[_0x90e2('0x4e')]('fax_interaction_has_tags','it',_0x90e2('0x54'))[_0x90e2('0x4e')](_0x90e2('0x49'),'t',_0x90e2('0x55'));var _0x183d3f=squel[_0x90e2('0x56')]();var _0x52b42a=[];var _0x34d4d5=squel['expr']();var _0x383e3f;if(_0x29c11e['query']['search']){_0x383e3f=as[_0x90e2('0x57')](_0x29c11e[_0x90e2('0x41')][_0x90e2('0x58')]);var _0x3a05b4=_0x383e3f[_0x90e2('0x59')];for(var _0x44a14e=0x0;_0x44a14e<_0x383e3f['conditions'][_0x90e2('0x3e')];_0x44a14e++){var _0x346fb6=_0x383e3f[_0x90e2('0x5a')][_0x44a14e];var _0x2adcf1='i';var _0x2ff9d6=_[_0x90e2('0x5b')](_0x526eff,[_0x90e2('0x29'),_0x346fb6['field']]);if(!_0x2ff9d6){switch(_0x346fb6[_0x90e2('0x47')]){case _0x90e2('0x5c'):if(_0x346fb6[_0x90e2('0x5d')]==0x1){_0x244cd0[_0x90e2('0x5e')]('`'+_0x346fb6[_0x90e2('0x47')]+_0x90e2('0x5f'));}else{_0x244cd0[_0x90e2('0x5e')]('`'+_0x346fb6[_0x90e2('0x47')]+_0x90e2('0x60'));}break;case _0x90e2('0x61'):if(_0x346fb6[_0x90e2('0x62')]===_0x90e2('0x63')){if(_0x346fb6[_0x90e2('0x5d')]['split']('\x20')[_0x90e2('0x3e')]>0x1){_0x183d3f[_0x3a05b4](_0x90e2('0x64'),qs[_0x90e2('0x65')](_0x346fb6[_0x90e2('0x5d')]),null);}else{var _0x44f841='%'+_0x346fb6[_0x90e2('0x5d')]+'%';_0x183d3f[_0x3a05b4]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x44f841,_0x44f841,_0x44f841);}}else{_0x2ff9d6=_[_0x90e2('0x5b')](_0x526eff,['name','ContactId']);_0x346fb6[_0x90e2('0x47')]=_0x90e2('0x66');_0x4f33c5=as[_0x90e2('0x67')](_0x2adcf1,_0x2ff9d6[_0x90e2('0x37')],_0x346fb6);_0x183d3f[_0x3a05b4](_0x4f33c5[_0x90e2('0x68')],_0x4f33c5['value'][_0x90e2('0x69')],_0x4f33c5[_0x90e2('0x5d')]['end']);}break;case'Tag':var _0x1c59e5=_0x346fb6[_0x90e2('0x5d')]['split'](',')[_0x90e2('0x33')](function(_0x317a03){return Number(_0x317a03);});_0x1c59e5[_0x90e2('0x30')](function(_0x2be629){_0x34d4d5['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2be629+',%');});_0x52b42a=_[_0x90e2('0x6a')](_0x52b42a,_0x1c59e5);break;case _0x90e2('0x6b'):if(_0x346fb6[_0x90e2('0x62')]===_0x90e2('0x63')){_0x183d3f[_0x3a05b4](_0x90e2('0x6c'),'%'+_0x346fb6[_0x90e2('0x5d')]+'%',null);}else{_0x2ff9d6=_[_0x90e2('0x5b')](_0x526eff,['name','UserId']);_0x346fb6[_0x90e2('0x47')]=_0x90e2('0x6d');_0x4f33c5=as[_0x90e2('0x67')](_0x2adcf1,_0x2ff9d6[_0x90e2('0x37')],_0x346fb6);_0x183d3f[_0x3a05b4](_0x4f33c5['text'],_0x4f33c5[_0x90e2('0x5d')]['start'],_0x4f33c5[_0x90e2('0x5d')]['end']);}break;case _0x90e2('0x6e'):_0x4f33c5=as[_0x90e2('0x67')]('me',null,_0x346fb6);_0x183d3f[_0x3a05b4](_0x4f33c5['text'],_0x4f33c5[_0x90e2('0x5d')][_0x90e2('0x69')],_0x4f33c5['value'][_0x90e2('0x1c')]);break;}}else{var _0x4f33c5=as[_0x90e2('0x67')](_0x2adcf1,_0x2ff9d6[_0x90e2('0x37')],_0x346fb6);_0x183d3f[_0x3a05b4](_0x4f33c5[_0x90e2('0x68')],_0x4f33c5[_0x90e2('0x5d')][_0x90e2('0x69')],_0x4f33c5['value'][_0x90e2('0x1c')]);}}}else{var _0x56f189=_(_0x29c11e[_0x90e2('0x41')])['keys']()[_0x90e2('0x33')](function(_0x2bd07f){return _[_0x90e2('0x6f')](_0x526eff,['name',_0x2bd07f])?_0x2bd07f:undefined;})[_0x90e2('0x70')]()[_0x90e2('0x5d')]();if(!_[_0x90e2('0x71')](_0x56f189)){_0x56f189[_0x90e2('0x30')](function(_0x485a70){if(_0x485a70===_0x90e2('0x72')){_0x244cd0['where']('i.FaxAccountId\x20IN\x20?',[][_0x90e2('0x73')](_0x29c11e[_0x90e2('0x41')][_0x485a70]));}else if(_0x485a70===_0x90e2('0x74')){var _0x5807c2=JSON['parse'](_0x29c11e[_0x90e2('0x41')][_0x485a70])[_0x90e2('0x75')];var _0x4cb356=JSON[_0x90e2('0x76')](_0x29c11e[_0x90e2('0x41')][_0x485a70])['$lte'];_0x244cd0[_0x90e2('0x44')](_0x90e2('0x77'),_0x5807c2,_0x4cb356);}else{if(_0x29c11e[_0x90e2('0x41')][_0x485a70]===_0x90e2('0x78')){_0x244cd0[_0x90e2('0x44')]('i.'+_0x485a70+_0x90e2('0x79'));}else{_0x244cd0[_0x90e2('0x44')]('i.'+_0x485a70+'\x20=\x20?',_0x29c11e[_0x90e2('0x41')][_0x485a70]);}}});}if(_0x29c11e[_0x90e2('0x41')]['read']){if(_0x29c11e[_0x90e2('0x41')]['read']==0x1){_0x244cd0['having'](_0x90e2('0x7a'));}else{_0x244cd0['having'](_0x90e2('0x7b'));}}if(_0x29c11e[_0x90e2('0x41')][_0x90e2('0x7c')]){_0x52b42a=_[_0x90e2('0x7d')](_0x29c11e[_0x90e2('0x41')]['tag'])?_0x29c11e[_0x90e2('0x41')][_0x90e2('0x7c')]:new Array(_0x29c11e[_0x90e2('0x41')][_0x90e2('0x7c')]);_0x52b42a[_0x90e2('0x30')](function(_0x4cd5e3){_0x34d4d5['or'](_0x90e2('0x7e'),'%,'+_0x4cd5e3+',%');});}if(_0x29c11e['query'][_0x90e2('0x7f')]){var _0x2221eb=_0x29c11e[_0x90e2('0x41')][_0x90e2('0x7f')][_0x90e2('0x80')]('\x5c','\x5c\x5c')[_0x90e2('0x80')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2221eb)){_0x183d3f['or']('i.id\x20LIKE\x20?',_0x2221eb+'%')['or'](_0x90e2('0x81'),_0x2221eb+'%');}_0x183d3f['or'](_0x90e2('0x82'),_0x2221eb+'%');}}_0x244cd0[_0x90e2('0x44')](_0x183d3f);_0x244cd0[_0x90e2('0x83')]('i.id');var _0x276554={'type':db[_0x90e2('0x84')]['QueryTypes'][_0x90e2('0x85')],'raw':!![]};var _0x2b245a=_0x244cd0['clone']();_0x2b245a['field'](_0x90e2('0x86'));_0x2b245a[_0x90e2('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x90e2('0x5c'));if(_0x2136de[_0x90e2('0x42')]){_0x2136de[_0x90e2('0x42')][_0x90e2('0x30')](function(_0x140670){var _0x206030=_0x140670[0x0]===_0x90e2('0x87')?_0x140670[0x0]:'i.'+_0x140670[0x0];_0x244cd0['order'](_0x206030,_0x140670[0x1]===_0x90e2('0x88')?![]:!![]);});}if(!_[_0x90e2('0x71')](_0x52b42a)){_0x244cd0[_0x90e2('0x5e')](_0x34d4d5);_0x2b245a[_0x90e2('0x44')](_0x90e2('0x89'),_0x52b42a);}BPromise[_0x90e2('0x8a')]()[_0x90e2('0x25')](function(){if(!_0x383e3f){if(_0x29c11e[_0x90e2('0x41')][_0x90e2('0x72')])return;_0x2b245a['where'](_0x90e2('0x8b'));_0x244cd0[_0x90e2('0x44')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x29c11e[_0x90e2('0x8c')][_0x90e2('0x8d')]!=='agent')return;return _0x29c11e['user']['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x90e2('0x25')](function(_0x5e9eda){if(_[_0x90e2('0x71')](_0x5e9eda)){_0x2b245a['where'](_0x90e2('0x8e'));_0x244cd0[_0x90e2('0x44')](_0x90e2('0x8e'));}else{_0x2b245a['where'](_0x90e2('0x8f'),_[_0x90e2('0x33')](_0x5e9eda,'id'));_0x244cd0[_0x90e2('0x44')](_0x90e2('0x8f'),_[_0x90e2('0x33')](_0x5e9eda,'id'));}});})[_0x90e2('0x25')](function(){if(_0x29c11e[_0x90e2('0x8c')][_0x90e2('0x8d')]===_0x90e2('0x90')&&!_0x383e3f&&!_0x29c11e[_0x90e2('0x41')]['FaxAccountId'])return[];return db[_0x90e2('0x91')][_0x90e2('0x41')](_0x2b245a[_0x90e2('0x92')](),_0x276554);})[_0x90e2('0x25')](function(_0x5c5e46){_0x3d2b89[_0x90e2('0x21')]=_0x5c5e46[_0x90e2('0x3e')];if(_0x3d2b89[_0x90e2('0x21')]===0x0)return[];return db[_0x90e2('0x91')][_0x90e2('0x41')](_0x1d4d0b['toString'](),_0x276554)['then'](function(_0x324fda){_0x411e5f=_[_0x90e2('0x93')](_0x324fda,'id');_0x276554=_[_0x90e2('0x94')](_0x276554,{'model':db[_0x90e2('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x29c11e[_0x90e2('0x41')][_0x90e2('0x3d')]){_0x2136de[_0x90e2('0x3c')]['forEach'](function(_0x46fb2d){_0x244cd0[_0x90e2('0x47')]('i.'+_0x46fb2d);});}else{_0x244cd0[_0x90e2('0x47')](_0x90e2('0x95'),_0x90e2('0x5c'));_0x244cd0[_0x90e2('0x47')](_0x90e2('0x96'),_0x90e2('0x97'));_0x244cd0[_0x90e2('0x47')](_0x90e2('0x98'),_0x90e2('0x99'));_0x244cd0[_0x90e2('0x47')](_0x90e2('0x9a'),'contactName');_0x244cd0[_0x90e2('0x47')](_0x90e2('0x9b'));_0x244cd0[_0x90e2('0x47')]('c.firstName','Contact.firstName');_0x244cd0[_0x90e2('0x47')](_0x90e2('0x9c'),_0x90e2('0x9d'));_0x244cd0[_0x90e2('0x47')](_0x90e2('0x9e'),'Contact.email');_0x244cd0[_0x90e2('0x47')](_0x90e2('0x9f'),_0x90e2('0xa0'));_0x244cd0[_0x90e2('0x47')](_0x90e2('0xa1'),_0x90e2('0xa2'));_0x244cd0['field'](_0x90e2('0xa3'),_0x90e2('0xa4'));_0x244cd0[_0x90e2('0x47')](_0x90e2('0xa5'),'Owner.fullname');_0x244cd0[_0x90e2('0x47')]('o.internal','Owner.internal');_0x244cd0[_0x90e2('0x47')](_0x90e2('0xa6'),'TagIds');}if(_0x2136de['limit'])_0x244cd0[_0x90e2('0x1f')](_0x2136de[_0x90e2('0x1f')]);if(_0x2136de[_0x90e2('0x1e')])_0x244cd0[_0x90e2('0x1e')](_0x2136de[_0x90e2('0x1e')]);return db[_0x90e2('0x91')][_0x90e2('0x41')](_0x244cd0[_0x90e2('0x92')](),_0x276554);})['then'](function(_0x443c98){if(_0x443c98['length']>0x0)_0x47da1a[_0x90e2('0x44')](_0x90e2('0xa7'),_[_0x90e2('0x33')](_0x443c98,'id'));return db[_0x90e2('0x91')]['query'](_0x47da1a['toString'](),_0x276554)[_0x90e2('0x25')](function(_0x4d468c){var _0x28c3bc=_[_0x90e2('0xa8')](_0x4d468c,'FaxInteractionId');var _0x3965fe=[];_0x443c98[_0x90e2('0x30')](function(_0x87fa84){_0x3965fe[_0x90e2('0x31')](updateFaxInteraction(_0x87fa84,_0x411e5f,_0x28c3bc));});return BPromise[_0x90e2('0xa9')](_0x3965fe);});});})[_0x90e2('0x25')](function(_0x1ac350){_0x3d2b89['rows']=_0x1ac350;return _0x3d2b89;})['then'](respondWithFilteredResult(_0x56c678,_0x2136de))['catch'](handleError(_0x56c678,null));};exports['show']=function(_0x1770f2,_0x3a83a7){var _0x1f81f7={'raw':![],'where':{'id':_0x1770f2[_0x90e2('0xaa')]['id']}},_0x5a7739={};_0x5a7739[_0x90e2('0x3b')]=_['keys'](db['FaxInteraction'][_0x90e2('0x35')]);_0x5a7739[_0x90e2('0x41')]=_[_0x90e2('0x38')](_0x1770f2['query']);_0x5a7739[_0x90e2('0x39')]=_[_0x90e2('0x3a')](_0x5a7739[_0x90e2('0x3b')],_0x5a7739[_0x90e2('0x41')]);_0x1f81f7[_0x90e2('0x3c')]=_[_0x90e2('0x3a')](_0x5a7739['model'],qs[_0x90e2('0x3d')](_0x1770f2[_0x90e2('0x41')]['fields']));_0x1f81f7[_0x90e2('0x3c')]=_0x1f81f7[_0x90e2('0x3c')][_0x90e2('0x3e')]?_0x1f81f7[_0x90e2('0x3c')]:_0x5a7739[_0x90e2('0x3b')];if(_0x1770f2[_0x90e2('0x41')][_0x90e2('0xab')]){_0x1f81f7['include']=[{'all':!![]}];}_0x1f81f7=_[_0x90e2('0x94')]({},_0x1f81f7,_0x1770f2[_0x90e2('0xac')]);return db[_0x90e2('0x34')][_0x90e2('0x5b')](_0x1f81f7)[_0x90e2('0x25')](handleEntityNotFound(_0x3a83a7,null))['then'](respondWithResult(_0x3a83a7,null))[_0x90e2('0xad')](handleError(_0x3a83a7,null));};exports[_0x90e2('0xae')]=function(_0x43e015,_0x98b197){return db['FaxInteraction'][_0x90e2('0xae')](_0x43e015[_0x90e2('0x6e')],{})[_0x90e2('0x25')](respondWithResult(_0x98b197,0xc9))[_0x90e2('0xad')](handleError(_0x98b197,null));};exports[_0x90e2('0x24')]=function(_0x4638f6,_0xdfb5bd){if(_0x4638f6['body']['id']){delete _0x4638f6[_0x90e2('0x6e')]['id'];}return db[_0x90e2('0x34')][_0x90e2('0x5b')]({'where':{'id':_0x4638f6[_0x90e2('0xaa')]['id']}})[_0x90e2('0x25')](handleEntityNotFound(_0xdfb5bd,null))[_0x90e2('0x25')](saveUpdates(_0x4638f6['body'],null))['then'](respondWithResult(_0xdfb5bd,null))[_0x90e2('0xad')](handleError(_0xdfb5bd,null));};exports[_0x90e2('0x26')]=function(_0x447413,_0x199bd0){return db['FaxInteraction']['find']({'where':{'id':_0x447413[_0x90e2('0xaa')]['id']}})[_0x90e2('0x25')](handleEntityNotFound(_0x199bd0,null))[_0x90e2('0x25')](removeEntity(_0x199bd0,null))['catch'](handleError(_0x199bd0,null));};exports[_0x90e2('0xaf')]=function(_0x13e5ec,_0x3e8132){return db[_0x90e2('0x34')][_0x90e2('0xaf')]()[_0x90e2('0x25')](respondWithResult(_0x3e8132,null))[_0x90e2('0xad')](handleError(_0x3e8132,null));};exports[_0x90e2('0xb0')]=function(_0x15fc9f,_0x3837a6,_0x56bcda){return db['FaxMessage'][_0x90e2('0x5b')]({'where':{'id':_0x15fc9f['params']['id']}})[_0x90e2('0x25')](handleEntityNotFound(_0x3837a6,null))[_0x90e2('0x25')](function(_0x1cf3a1){if(_0x1cf3a1){return _0x1cf3a1[_0x90e2('0xb0')](_0x15fc9f[_0x90e2('0x6e')][_0x90e2('0xb1')],_[_0x90e2('0xb2')](_0x15fc9f[_0x90e2('0x6e')],[_0x90e2('0xb1'),'id'])||{});}})['then'](respondWithResult(_0x3837a6,null))['catch'](handleError(_0x3837a6,null));};exports[_0x90e2('0xb3')]=function(_0x4cdd06,_0x4bf024,_0x124669){var _0x262708={'raw':![],'where':{}};var _0x2b15be={};var _0x650073={'count':0x0,'rows':[]};return db[_0x90e2('0x34')][_0x90e2('0xb4')]({'where':{'id':_0x4cdd06['params']['id']}})[_0x90e2('0x25')](handleEntityNotFound(_0x4bf024,null))['then'](function(_0x49a456){if(_0x49a456){_0x2b15be[_0x90e2('0x3b')]=_[_0x90e2('0x38')](db[_0x90e2('0xb5')]['rawAttributes']);_0x2b15be[_0x90e2('0x41')]=_[_0x90e2('0x38')](_0x4cdd06[_0x90e2('0x41')]);_0x2b15be[_0x90e2('0x39')]=_['intersection'](_0x2b15be[_0x90e2('0x3b')],_0x2b15be['query']);_0x262708[_0x90e2('0x3c')]=_[_0x90e2('0x3a')](_0x2b15be[_0x90e2('0x3b')],qs[_0x90e2('0x3d')](_0x4cdd06[_0x90e2('0x41')][_0x90e2('0x3d')]));_0x262708[_0x90e2('0x3c')]=_0x262708['attributes']['length']?_0x262708[_0x90e2('0x3c')]:_0x2b15be['model'];if(!_0x4cdd06[_0x90e2('0x41')][_0x90e2('0x3f')](_0x90e2('0x40'))){_0x262708[_0x90e2('0x1f')]=qs[_0x90e2('0x1f')](_0x4cdd06[_0x90e2('0x41')][_0x90e2('0x1f')]);_0x262708[_0x90e2('0x1e')]=qs[_0x90e2('0x1e')](_0x4cdd06['query'][_0x90e2('0x1e')]);}_0x262708[_0x90e2('0x42')]=qs[_0x90e2('0x43')](_0x4cdd06[_0x90e2('0x41')][_0x90e2('0x43')]);_0x262708[_0x90e2('0x44')]=qs[_0x90e2('0x39')](_[_0x90e2('0x45')](_0x4cdd06[_0x90e2('0x41')],_0x2b15be['filters']));_0x262708[_0x90e2('0x44')][_0x90e2('0xb6')]=_0x49a456['id'];if(_0x4cdd06['query'][_0x90e2('0x7f')]){_0x262708['where']=_[_0x90e2('0x94')](_0x262708['where'],{'$or':_[_0x90e2('0x33')](_0x262708[_0x90e2('0x3c')],function(_0x2dd6ea){var _0x32d381={};_0x32d381[_0x2dd6ea]={'$like':'%'+_0x4cdd06[_0x90e2('0x41')][_0x90e2('0x7f')]+'%'};return _0x32d381;})});}if(_0x4cdd06[_0x90e2('0x41')][_0x90e2('0x75')]){var _0x4e91d9=_0x4cdd06[_0x90e2('0x41')]['$gte']['split'](',');var _0x213202={};_0x213202[_0x4e91d9[0x0]]={'$gte':moment(_0x4e91d9[0x1])[_0x90e2('0xb7')](_0x90e2('0xb8'))};_0x262708['where']=_[_0x90e2('0x94')](_0x262708['where'],_0x213202);}_0x262708=_[_0x90e2('0x94')]({},_0x262708,_0x4cdd06[_0x90e2('0xac')]);return db['FaxMessage'][_0x90e2('0x21')]({'where':_0x262708['where']})['then'](function(_0x5d88a4){_0x650073[_0x90e2('0x21')]=_0x5d88a4;if(_0x4cdd06[_0x90e2('0x41')][_0x90e2('0xab')]){_0x262708[_0x90e2('0xb9')]=[{'all':!![]}];}return db[_0x90e2('0xb5')]['findAll'](_0x262708);})[_0x90e2('0x25')](function(_0x11e3e9){_0x650073[_0x90e2('0xba')]=_0x11e3e9;return _0x650073;});}})['then'](respondWithFilteredResult(_0x4bf024,_0x262708))['catch'](handleError(_0x4bf024,null));};exports[_0x90e2('0xbb')]=function(_0x4ee459,_0x3eab68,_0x35e8f8){return db[_0x90e2('0x34')]['find']({'where':{'id':_0x4ee459['params']['id']}})['then'](handleEntityNotFound(_0x3eab68,null))['then'](function(_0x1d662f){if(_0x1d662f){return _0x1d662f['setTags'](_0x4ee459[_0x90e2('0x6e')][_0x90e2('0xb1')],_['omit'](_0x4ee459[_0x90e2('0x6e')],[_0x90e2('0xb1'),'id'])||{})[_0x90e2('0xbc')](function(){return db[_0x90e2('0xbd')]['findAll']({'attributes':['id',_0x90e2('0x29'),_0x90e2('0xbe')],'where':{'id':_0x4ee459['body']['ids']}});})[_0x90e2('0x25')](function(_0x778c95){socket['emit']('faxInteractionTags:save',{'id':Number(_0x4ee459[_0x90e2('0xaa')]['id']),'tags':_0x778c95||[]});return{'id':Number(_0x4ee459[_0x90e2('0xaa')]['id']),'tags':_0x778c95||[]};});}})[_0x90e2('0x25')](respondWithResult(_0x3eab68,null))['catch'](handleError(_0x3eab68,null));};exports['removeTags']=function(_0xec8b5b,_0x4fb05e,_0x5e69f4){return db[_0x90e2('0x34')][_0x90e2('0x5b')]({'where':{'id':_0xec8b5b[_0x90e2('0xaa')]['id']}})[_0x90e2('0x25')](handleEntityNotFound(_0x4fb05e,null))[_0x90e2('0x25')](function(_0x1b25f3){if(_0x1b25f3){return _0x1b25f3['removeTags'](_0xec8b5b[_0x90e2('0x41')][_0x90e2('0xb1')]);}})[_0x90e2('0x25')](respondWithStatusCode(_0x4fb05e,null))[_0x90e2('0xad')](handleError(_0x4fb05e,null));};exports[_0x90e2('0xbf')]=function(_0x5da258,_0x1363bb){var _0x1818f8=moment()[_0x90e2('0xc0')]()[_0x90e2('0x92')]();var _0x5c6b5f=path[_0x90e2('0xc1')](config[_0x90e2('0xc2')],_0x90e2('0xc3'),_0x90e2('0xc4'),_0x90e2('0xc5'));var _0x773da4=path['join'](config[_0x90e2('0xc2')],'server',_0x90e2('0xc4'),_0x90e2('0xc6'));var _0x5918a1=path[_0x90e2('0xc1')](_0x5c6b5f,_0x1818f8);var _0xb78ed2=util[_0x90e2('0xb7')](_0x90e2('0xc7'),_0x5da258[_0x90e2('0xaa')]['id'],_0x1818f8);var _0x303933=path[_0x90e2('0xc1')](_0x5c6b5f,_0xb78ed2);var _0x544f4b=[];_0x544f4b[_0x90e2('0x31')]({'model':db[_0x90e2('0xc8')],'as':_0x90e2('0xc8'),'raw':!![]});var _0x49f075=[{'model':db[_0x90e2('0xb5')],'as':_0x90e2('0xc9'),'attributes':['id','body','createdAt'],'include':_0x544f4b}];return db[_0x90e2('0x34')][_0x90e2('0x5b')]({'where':{'id':_0x5da258[_0x90e2('0xaa')]['id']},'include':_0x49f075})['then'](handleEntityNotFound(_0x1363bb,null))[_0x90e2('0x25')](function(_0x534364){if(_0x534364&&_0x534364[_0x90e2('0xc9')]){var _0x4c3a4a=_0x534364[_0x90e2('0xca')]({'plain':!![]});fs['mkdirSync'](_0x5918a1);for(var _0x1ee889=0x0;_0x1ee889<_0x4c3a4a[_0x90e2('0xc9')][_0x90e2('0x3e')];_0x1ee889++){var _0x164e9b=_0x4c3a4a['Messages'][_0x1ee889][_0x90e2('0xc8')];if(_0x164e9b){var _0x29532c=path['join'](_0x773da4,_0x164e9b[_0x90e2('0xcb')]);if(fs[_0x90e2('0xcc')](_0x29532c)){fs[_0x90e2('0xcd')](_0x29532c)['pipe'](fs['createWriteStream'](path[_0x90e2('0xc1')](_0x5918a1,_0x164e9b['basename'])));}}}return BPromise['resolve']()[_0x90e2('0x25')](function(){return new BPromise(function(_0xe78516,_0x44412f){zipdir(_0x5918a1,{'saveTo':_0x303933},function(_0x4b95d5,_0x123796){if(_0x4b95d5)return _0x44412f(_0x4b95d5);return _0xe78516(_0x123796);});})[_0x90e2('0x25')](function(){return new BPromise(function(_0x4e3ec9,_0x346f30){rimraf(_0x5918a1,function(_0x2ed5e6){if(_0x2ed5e6)_0x346f30(_0x2ed5e6);return _0x4e3ec9();});});})[_0x90e2('0x25')](function(){return _0x1363bb[_0x90e2('0xbf')](_0x303933,_0xb78ed2,function(_0x12a9c9){if(_0x12a9c9){console[_0x90e2('0xce')](_0x90e2('0xcf'),_0x12a9c9);}else{fs['unlinkSync'](_0x303933);}});});});}else{return _0x1363bb[_0x90e2('0x1a')](0xc8);}})[_0x90e2('0xad')](handleError(_0x1363bb,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 51cef7d..7423511 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 _0x057a=['hook','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x2047eb,_0x1f7fc6){var _0x3050f5=function(_0x31733f){while(--_0x31733f){_0x2047eb['push'](_0x2047eb['shift']());}};_0x3050f5(++_0x1f7fc6);}(_0x057a,0x121));var _0xa057=function(_0x48a011,_0x42e581){_0x48a011=_0x48a011-0x0;var _0x16578c=_0x057a[_0x48a011];return _0x16578c;};'use strict';var EventEmitter=require(_0xa057('0x0'));var FaxInteraction=require(_0xa057('0x1'))['db'][_0xa057('0x2')];var FaxMessage=require(_0xa057('0x1'))['db'][_0xa057('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xa057('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa057('0x5'),'afterDestroy':_0xa057('0x6')};function emitEvent(_0x48b0db){return function(_0x46528a,_0x32f705,_0xb1c1b1){_0x46528a['getUsers']({'attributes':['id'],'raw':!![]})[_0xa057('0x7')](function(_0x26ee64){_0x46528a[_0xa057('0x8')](_0xa057('0x9'),_0x26ee64[_0xa057('0xa')](function(_0x54b8ad){return{'id':_0x54b8ad['id']};}));return FaxMessage[_0xa057('0xb')]({'where':{'FaxInteractionId':_0x46528a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa057('0x7')](function(_0x30ea95){_0x46528a[_0xa057('0x8')](_0xa057('0xc'),_0x30ea95[_0xa057('0xd')]);FaxInteractionEvents[_0xa057('0xe')](_0x48b0db+':'+_0x46528a['id'],_0x46528a);FaxInteractionEvents[_0xa057('0xe')](_0x48b0db,_0x46528a);_0xb1c1b1(null);})[_0xa057('0xf')](_0xb1c1b1(null));};}for(var e in events){if(events[_0xa057('0x10')](e)){var event=events[e];FaxInteraction[_0xa057('0x11')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x200e=['save','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','catch','hook','exports','events','../../mysqldb','FaxInteraction','setMaxListeners'];(function(_0x93d059,_0xc212dc){var _0x3a7525=function(_0x5323e5){while(--_0x5323e5){_0x93d059['push'](_0x93d059['shift']());}};_0x3a7525(++_0xc212dc);}(_0x200e,0x13f));var _0xe200=function(_0xea5676,_0x1eaff2){_0xea5676=_0xea5676-0x0;var _0x5d6f7b=_0x200e[_0xea5676];return _0x5d6f7b;};'use strict';var EventEmitter=require(_0xe200('0x0'));var FaxInteraction=require(_0xe200('0x1'))['db'][_0xe200('0x2')];var FaxMessage=require(_0xe200('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xe200('0x3')](0x0);var events={'afterCreate':_0xe200('0x4'),'afterUpdate':'update','afterDestroy':_0xe200('0x5')};function emitEvent(_0x52fa0a){return function(_0x5c0405,_0x5a5214,_0x2de22b){_0x5c0405[_0xe200('0x6')]({'attributes':['id'],'raw':!![]})[_0xe200('0x7')](function(_0x5ce5f8){_0x5c0405['setDataValue'](_0xe200('0x8'),_0x5ce5f8[_0xe200('0x9')](function(_0xa58266){return{'id':_0xa58266['id']};}));return FaxMessage[_0xe200('0xa')]({'where':{'FaxInteractionId':_0x5c0405['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x9af4d3){_0x5c0405[_0xe200('0xb')](_0xe200('0xc'),_0x9af4d3['length']);FaxInteractionEvents[_0xe200('0xd')](_0x52fa0a+':'+_0x5c0405['id'],_0x5c0405);FaxInteractionEvents[_0xe200('0xd')](_0x52fa0a,_0x5c0405);_0x2de22b(null);})[_0xe200('0xe')](_0x2de22b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xe200('0xf')](e,emitEvent(event));}}module[_0xe200('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index dd43df9..6e985d5 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 _0x7d47=['exports','FaxInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xb8f3cd,_0x4d05bd){var _0x37c5ce=function(_0x2457ef){while(--_0x2457ef){_0xb8f3cd['push'](_0xb8f3cd['shift']());}};_0x37c5ce(++_0x4d05bd);}(_0x7d47,0x149));var _0x77d4=function(_0x2f27d6,_0x1dcb81){_0x2f27d6=_0x2f27d6-0x0;var _0x354bb1=_0x7d47[_0x2f27d6];return _0x354bb1;};'use strict';var _=require('lodash');var util=require(_0x77d4('0x0'));var logger=require(_0x77d4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x77d4('0x2'));var rp=require(_0x77d4('0x3'));var fs=require('fs');var path=require(_0x77d4('0x4'));var rimraf=require(_0x77d4('0x5'));var config=require(_0x77d4('0x6'));var attributes=require('./faxInteraction.attributes');module[_0x77d4('0x7')]=function(_0x54a615,_0x201116){return _0x54a615['define'](_0x77d4('0x8'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5bca46,_0x1cf397,_0x38820d){if(_0x5bca46[_0x77d4('0x9')]('closed')){_0x5bca46['closedAt']=moment()[_0x77d4('0xa')](_0x77d4('0xb'));}_0x38820d(null,_0x5bca46);}}});}; \ No newline at end of file +var _0x3ef7=['./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4ff7ac,_0x5a49b6){var _0x39706e=function(_0x13baac){while(--_0x13baac){_0x4ff7ac['push'](_0x4ff7ac['shift']());}};_0x39706e(++_0x5a49b6);}(_0x3ef7,0xa2));var _0x73ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ef7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x73ef('0x0'));var util=require('util');var logger=require(_0x73ef('0x1'))(_0x73ef('0x2'));var moment=require(_0x73ef('0x3'));var BPromise=require(_0x73ef('0x4'));var rp=require(_0x73ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73ef('0x6'));var config=require(_0x73ef('0x7'));var attributes=require(_0x73ef('0x8'));module[_0x73ef('0x9')]=function(_0x4aaf96,_0x18cd10){return _0x4aaf96[_0x73ef('0xa')](_0x73ef('0xb'),attributes,{'tableName':_0x73ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe938e1,_0x4cd5ce,_0x2b60fd){if(_0xe938e1[_0x73ef('0xd')]('closed')){_0xe938e1[_0x73ef('0xe')]=moment()[_0x73ef('0xf')](_0x73ef('0x10'));}_0x2b60fd(null,_0xe938e1);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 7b9493e..52cfbc3 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 _0x5f94=['result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','debug','AddTagsToFaxInteraction','find','ids','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','defaults','redis','localhost','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3165fa,_0x269216){var _0x2e37e5=function(_0x4d3747){while(--_0x4d3747){_0x3165fa['push'](_0x3165fa['shift']());}};_0x2e37e5(++_0x269216);}(_0x5f94,0x15b));var _0x45f9=function(_0x19c14b,_0x86c434){_0x19c14b=_0x19c14b-0x0;var _0x26f08b=_0x5f94[_0x19c14b];return _0x26f08b;};'use strict';var _=require(_0x45f9('0x0'));var util=require(_0x45f9('0x1'));var moment=require('moment');var BPromise=require(_0x45f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45f9('0x3'));var db=require(_0x45f9('0x4'))['db'];var utils=require(_0x45f9('0x5'));var logger=require(_0x45f9('0x6'))('rpc');var config=require(_0x45f9('0x7'));var jayson=require(_0x45f9('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x45f9('0x9')](config[_0x45f9('0xa')],{'host':_0x45f9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x45f9('0xa')]));require(_0x45f9('0xc'))[_0x45f9('0xd')](socket);function respondWithRpcPromise(_0x55fc78,_0x538045,_0x4db42d){return new BPromise(function(_0x2b3816,_0x39c9a4){return client['request'](_0x55fc78,_0x4db42d)[_0x45f9('0xe')](function(_0x428e05){logger[_0x45f9('0xf')](_0x45f9('0x10'),_0x538045,_0x45f9('0x11'));logger['debug'](_0x45f9('0x12'),_0x538045,_0x45f9('0x11'),JSON[_0x45f9('0x13')](_0x428e05));if(_0x428e05[_0x45f9('0x14')]){if(_0x428e05[_0x45f9('0x14')][_0x45f9('0x15')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x538045,_0x428e05[_0x45f9('0x14')][_0x45f9('0x16')]);return _0x39c9a4(_0x428e05[_0x45f9('0x14')]['message']);}logger[_0x45f9('0x14')](_0x45f9('0x10'),_0x538045,_0x428e05[_0x45f9('0x14')]['message']);return _0x2b3816(_0x428e05[_0x45f9('0x14')]['message']);}else{logger['info'](_0x45f9('0x10'),_0x538045,_0x45f9('0x11'));_0x2b3816(_0x428e05[_0x45f9('0x17')][_0x45f9('0x16')]);}})[_0x45f9('0x18')](function(_0x15e54f){logger[_0x45f9('0x14')](_0x45f9('0x10'),_0x538045,_0x15e54f);_0x39c9a4(_0x15e54f);});});}exports[_0x45f9('0x19')]=function(_0x22cdd8){var _0x4b4a5a=this;return new Promise(function(_0xec64e3,_0x4b3500){return db[_0x45f9('0x1a')]['update'](_0x22cdd8[_0x45f9('0x1b')],{'raw':_0x22cdd8[_0x45f9('0x1c')]?_0x22cdd8[_0x45f9('0x1c')][_0x45f9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22cdd8[_0x45f9('0x1c')]?_0x22cdd8[_0x45f9('0x1c')][_0x45f9('0x1e')]||null:null,'attributes':_0x22cdd8[_0x45f9('0x1c')]?_0x22cdd8[_0x45f9('0x1c')][_0x45f9('0x1f')]||null:null,'limit':_0x22cdd8[_0x45f9('0x1c')]?_0x22cdd8[_0x45f9('0x1c')]['limit']||null:null})[_0x45f9('0xe')](function(_0x44097b){logger[_0x45f9('0xf')](_0x45f9('0x19'),_0x22cdd8);logger[_0x45f9('0x20')](_0x45f9('0x19'),_0x22cdd8,JSON[_0x45f9('0x13')](_0x44097b));_0xec64e3(_0x44097b);})[_0x45f9('0x18')](function(_0x4ebe8e){logger[_0x45f9('0x14')](_0x45f9('0x19'),_0x4ebe8e[_0x45f9('0x16')],_0x22cdd8);_0x4b3500(_0x4b4a5a[_0x45f9('0x14')](0x1f4,_0x4ebe8e[_0x45f9('0x16')]));});});};exports[_0x45f9('0x21')]=function(_0x4cc906){return new Promise(function(_0x2165aa,_0x339c1f){return db[_0x45f9('0x1a')][_0x45f9('0x22')]({'where':_0x4cc906['options']?_0x4cc906[_0x45f9('0x1c')][_0x45f9('0x1e')]||null:null})['then'](function(_0x5a16ee){if(_0x5a16ee){return _0x5a16ee['addTags'](_0x4cc906[_0x45f9('0x1b')][_0x45f9('0x23')],_['omit'](_0x4cc906[_0x45f9('0x1b')],[_0x45f9('0x23'),'id'])||{});}})['spread'](function(_0x5e72a9){logger[_0x45f9('0xf')](_0x45f9('0x24'),_0x4cc906);logger['debug'](_0x45f9('0x24'),_0x4cc906,JSON['stringify'](_0x5e72a9));_0x2165aa(_0x5e72a9);})[_0x45f9('0x18')](function(_0x466d7c){logger[_0x45f9('0x14')]('AddTags',_0x466d7c[_0x45f9('0x16')],_0x4cc906);_0x339c1f(_this[_0x45f9('0x14')](0x1f4,_0x466d7c[_0x45f9('0x16')]));});});}; \ No newline at end of file +var _0xd150=['UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','limit','catch','AddTagsToFaxInteraction','find','body','ids','omit','spread','AddTags','debug','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x77711f,_0x27a828){var _0x5a7d04=function(_0x3c6bb6){while(--_0x3c6bb6){_0x77711f['push'](_0x77711f['shift']());}};_0x5a7d04(++_0x27a828);}(_0xd150,0x67));var _0x0d15=function(_0x25cb8c,_0x4dd762){_0x25cb8c=_0x25cb8c-0x0;var _0x42b533=_0xd150[_0x25cb8c];return _0x42b533;};'use strict';var _=require(_0x0d15('0x0'));var util=require(_0x0d15('0x1'));var moment=require('moment');var BPromise=require(_0x0d15('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d15('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d15('0x4'));var logger=require(_0x0d15('0x5'))(_0x0d15('0x6'));var config=require(_0x0d15('0x7'));var jayson=require(_0x0d15('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x0d15('0x9')]=_[_0x0d15('0xa')](config[_0x0d15('0x9')],{'host':_0x0d15('0xb'),'port':0x18eb});var socket=require(_0x0d15('0xc'))(new Redis(config[_0x0d15('0x9')]));require(_0x0d15('0xd'))[_0x0d15('0xe')](socket);function respondWithRpcPromise(_0x4c7084,_0x2be72a,_0x2f8a27){return new BPromise(function(_0x2354c1,_0x4e7c9c){return client[_0x0d15('0xf')](_0x4c7084,_0x2f8a27)[_0x0d15('0x10')](function(_0x28a659){logger[_0x0d15('0x11')](_0x0d15('0x12'),_0x2be72a,_0x0d15('0x13'));logger['debug'](_0x0d15('0x14'),_0x2be72a,_0x0d15('0x13'),JSON[_0x0d15('0x15')](_0x28a659));if(_0x28a659[_0x0d15('0x16')]){if(_0x28a659[_0x0d15('0x16')][_0x0d15('0x17')]===0x1f4){logger[_0x0d15('0x16')](_0x0d15('0x12'),_0x2be72a,_0x28a659['error']['message']);return _0x4e7c9c(_0x28a659[_0x0d15('0x16')]['message']);}logger[_0x0d15('0x16')](_0x0d15('0x12'),_0x2be72a,_0x28a659[_0x0d15('0x16')][_0x0d15('0x18')]);return _0x2354c1(_0x28a659[_0x0d15('0x16')][_0x0d15('0x18')]);}else{logger[_0x0d15('0x11')](_0x0d15('0x12'),_0x2be72a,'request\x20sent');_0x2354c1(_0x28a659[_0x0d15('0x19')][_0x0d15('0x18')]);}})['catch'](function(_0x50cf71){logger[_0x0d15('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x2be72a,_0x50cf71);_0x4e7c9c(_0x50cf71);});});}exports[_0x0d15('0x1a')]=function(_0x426c6e){var _0x5130d9=this;return new Promise(function(_0xfeab79,_0x3c6c9c){return db[_0x0d15('0x1b')][_0x0d15('0x1c')](_0x426c6e['body'],{'raw':_0x426c6e[_0x0d15('0x1d')]?_0x426c6e[_0x0d15('0x1d')][_0x0d15('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x426c6e['options']?_0x426c6e[_0x0d15('0x1d')][_0x0d15('0x1f')]||null:null,'attributes':_0x426c6e[_0x0d15('0x1d')]?_0x426c6e[_0x0d15('0x1d')][_0x0d15('0x20')]||null:null,'limit':_0x426c6e[_0x0d15('0x1d')]?_0x426c6e['options'][_0x0d15('0x21')]||null:null})['then'](function(_0x487b0f){logger[_0x0d15('0x11')]('UpdateFaxInteraction',_0x426c6e);logger['debug'](_0x0d15('0x1a'),_0x426c6e,JSON[_0x0d15('0x15')](_0x487b0f));_0xfeab79(_0x487b0f);})[_0x0d15('0x22')](function(_0x4b8c55){logger['error'](_0x0d15('0x1a'),_0x4b8c55[_0x0d15('0x18')],_0x426c6e);_0x3c6c9c(_0x5130d9[_0x0d15('0x16')](0x1f4,_0x4b8c55[_0x0d15('0x18')]));});});};exports[_0x0d15('0x23')]=function(_0x1ae55f){return new Promise(function(_0xbc9ef5,_0x10457f){return db['FaxInteraction'][_0x0d15('0x24')]({'where':_0x1ae55f[_0x0d15('0x1d')]?_0x1ae55f[_0x0d15('0x1d')][_0x0d15('0x1f')]||null:null})['then'](function(_0x3c29db){if(_0x3c29db){return _0x3c29db['addTags'](_0x1ae55f[_0x0d15('0x25')][_0x0d15('0x26')],_[_0x0d15('0x27')](_0x1ae55f[_0x0d15('0x25')],['ids','id'])||{});}})[_0x0d15('0x28')](function(_0x363dfb){logger[_0x0d15('0x11')](_0x0d15('0x29'),_0x1ae55f);logger[_0x0d15('0x2a')]('AddTags',_0x1ae55f,JSON['stringify'](_0x363dfb));_0xbc9ef5(_0x363dfb);})['catch'](function(_0x3feb4a){logger[_0x0d15('0x16')](_0x0d15('0x29'),_0x3feb4a[_0x0d15('0x18')],_0x1ae55f);_0x10457f(_this[_0x0d15('0x16')](0x1f4,_0x3feb4a[_0x0d15('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 7222826..ed97286 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 _0xdc55=['length','faxInteraction:','./faxInteraction.events','save','update','emit','register'];(function(_0x2f7c97,_0x23657c){var _0x4e9203=function(_0x472a9a){while(--_0x472a9a){_0x2f7c97['push'](_0x2f7c97['shift']());}};_0x4e9203(++_0x23657c);}(_0xdc55,0xaa));var _0x5dc5=function(_0xb9ddf0,_0x14f53a){_0xb9ddf0=_0xb9ddf0-0x0;var _0xbc767a=_0xdc55[_0xb9ddf0];return _0xbc767a;};'use strict';var FaxInteractionEvents=require(_0x5dc5('0x0'));var events=[_0x5dc5('0x1'),'remove',_0x5dc5('0x2')];function createListener(_0x14fc4d,_0x14f604){return function(_0x5e40ff){_0x14f604[_0x5dc5('0x3')](_0x14fc4d,_0x5e40ff);};}function removeListener(_0x578b0c,_0x8a57f0){return function(){FaxInteractionEvents['removeListener'](_0x578b0c,_0x8a57f0);};}exports[_0x5dc5('0x4')]=function(_0x586bb4){for(var _0x30a2a9=0x0,_0x1d32be=events[_0x5dc5('0x5')];_0x30a2a9<_0x1d32be;_0x30a2a9++){var _0xa6739e=events[_0x30a2a9];var _0xebe529=createListener(_0x5dc5('0x6')+_0xa6739e,_0x586bb4);FaxInteractionEvents['on'](_0xa6739e,_0xebe529);}}; \ No newline at end of file +var _0x5bb2=['register','length','faxInteraction:','./faxInteraction.events','save','remove','removeListener'];(function(_0x2be83d,_0x2be17e){var _0x2e599e=function(_0x554ce4){while(--_0x554ce4){_0x2be83d['push'](_0x2be83d['shift']());}};_0x2e599e(++_0x2be17e);}(_0x5bb2,0x10d));var _0x25bb=function(_0x5d23cf,_0x2e12eb){_0x5d23cf=_0x5d23cf-0x0;var _0x51cb6d=_0x5bb2[_0x5d23cf];return _0x51cb6d;};'use strict';var FaxInteractionEvents=require(_0x25bb('0x0'));var events=[_0x25bb('0x1'),_0x25bb('0x2'),'update'];function createListener(_0xd46530,_0x1aae2d){return function(_0x2c8523){_0x1aae2d['emit'](_0xd46530,_0x2c8523);};}function removeListener(_0x5ab6f8,_0x42b6d8){return function(){FaxInteractionEvents[_0x25bb('0x3')](_0x5ab6f8,_0x42b6d8);};}exports[_0x25bb('0x4')]=function(_0x4a2f90){for(var _0x29f389=0x0,_0x5ec627=events[_0x25bb('0x5')];_0x29f389<_0x5ec627;_0x29f389++){var _0x1bd4fa=events[_0x29f389];var _0x105cd5=createListener(_0x25bb('0x6')+_0x1bd4fa,_0x4a2f90);FaxInteractionEvents['on'](_0x1bd4fa,_0x105cd5);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 5a2210b..5edc78a 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 _0x2937=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','fax','faxinteraction:update','delete','destroy','removeTags','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3498cf,_0x1bb72e){var _0x5a492d=function(_0x52e1b1){while(--_0x52e1b1){_0x3498cf['push'](_0x3498cf['shift']());}};_0x5a492d(++_0x1bb72e);}(_0x2937,0xb4));var _0x7293=function(_0x48470b,_0x36d9cc){_0x48470b=_0x48470b-0x0;var _0x2f6247=_0x2937[_0x48470b];return _0x2f6247;};'use strict';var multer=require(_0x7293('0x0'));var util=require('util');var path=require(_0x7293('0x1'));var timeout=require(_0x7293('0x2'));var express=require(_0x7293('0x3'));var router=express[_0x7293('0x4')]();var fs_extra=require(_0x7293('0x5'));var auth=require(_0x7293('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7293('0x7'));var controller=require('./faxInteraction.controller');router[_0x7293('0x8')]('/',auth[_0x7293('0x9')](),controller[_0x7293('0xa')]);router['get'](_0x7293('0xb'),auth[_0x7293('0x9')](),controller[_0x7293('0xc')]);router['get'](_0x7293('0xd'),auth[_0x7293('0x9')](),controller['show']);router[_0x7293('0x8')]('/:id/messages',auth[_0x7293('0x9')](),controller[_0x7293('0xe')]);router[_0x7293('0x8')](_0x7293('0xf'),auth[_0x7293('0x9')](),controller[_0x7293('0x10')]);router[_0x7293('0x11')]('/',auth[_0x7293('0x9')](),controller[_0x7293('0x12')]);router[_0x7293('0x11')](_0x7293('0x13'),auth[_0x7293('0x9')](),controller[_0x7293('0x14')]);router['post'](_0x7293('0x15'),auth[_0x7293('0x9')](),interaction[_0x7293('0x16')]('fax',_0x7293('0x17')),controller[_0x7293('0x18')]);router[_0x7293('0x19')](_0x7293('0xd'),auth[_0x7293('0x9')](),interaction['tracked'](_0x7293('0x1a'),_0x7293('0x1b')),controller['update']);router[_0x7293('0x1c')](_0x7293('0xd'),auth['isAuthenticated'](),interaction[_0x7293('0x16')](_0x7293('0x1a'),'faxinteraction:destroy'),controller[_0x7293('0x1d')]);router[_0x7293('0x1c')](_0x7293('0x15'),auth['isAuthenticated'](),controller[_0x7293('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xfb78=['get','index','describe','isAuthenticated','show','/:id/messages','getMessages','download','post','create','addMessage','fax','addTags','put','/:id','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller'];(function(_0xc0a3af,_0x53ec86){var _0x6af35b=function(_0x2dac0b){while(--_0x2dac0b){_0xc0a3af['push'](_0xc0a3af['shift']());}};_0x6af35b(++_0x53ec86);}(_0xfb78,0x141));var _0x8fb7=function(_0x2a829f,_0x1b0c15){_0x2a829f=_0x2a829f-0x0;var _0x5737c3=_0xfb78[_0x2a829f];return _0x5737c3;};'use strict';var multer=require(_0x8fb7('0x0'));var util=require(_0x8fb7('0x1'));var path=require(_0x8fb7('0x2'));var timeout=require(_0x8fb7('0x3'));var express=require('express');var router=express[_0x8fb7('0x4')]();var fs_extra=require(_0x8fb7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8fb7('0x6'));var config=require(_0x8fb7('0x7'));var controller=require(_0x8fb7('0x8'));router[_0x8fb7('0x9')]('/',auth['isAuthenticated'](),controller[_0x8fb7('0xa')]);router[_0x8fb7('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x8fb7('0xb')]);router[_0x8fb7('0x9')]('/:id',auth[_0x8fb7('0xc')](),controller[_0x8fb7('0xd')]);router['get'](_0x8fb7('0xe'),auth['isAuthenticated'](),controller[_0x8fb7('0xf')]);router[_0x8fb7('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x8fb7('0x10')]);router[_0x8fb7('0x11')]('/',auth[_0x8fb7('0xc')](),controller[_0x8fb7('0x12')]);router['post']('/:id/messages',auth[_0x8fb7('0xc')](),controller[_0x8fb7('0x13')]);router[_0x8fb7('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0x8fb7('0x14'),'faxinteraction:addtags'),controller[_0x8fb7('0x15')]);router[_0x8fb7('0x16')](_0x8fb7('0x17'),auth['isAuthenticated'](),interaction[_0x8fb7('0x18')](_0x8fb7('0x14'),_0x8fb7('0x19')),controller[_0x8fb7('0x1a')]);router[_0x8fb7('0x1b')](_0x8fb7('0x17'),auth[_0x8fb7('0xc')](),interaction[_0x8fb7('0x18')](_0x8fb7('0x14'),_0x8fb7('0x1c')),controller[_0x8fb7('0x1d')]);router['delete'](_0x8fb7('0x1e'),auth[_0x8fb7('0xc')](),controller[_0x8fb7('0x1f')]);module[_0x8fb7('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index d4a8ff4..e4ad8b4 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 _0x430e=['ENUM','out','DATE','exports','TEXT','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x430e,0x105));var _0xe430=function(_0x3aab24,_0x39137c){_0x3aab24=_0x3aab24-0x0;var _0x640a57=_0x430e[_0x3aab24];return _0x640a57;};'use strict';var Sequelize=require('sequelize');module[_0xe430('0x0')]={'body':{'type':Sequelize[_0xe430('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe430('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe430('0x3')]('in',_0xe430('0x4')),'defaultValue':_0xe430('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xe430('0x5')]}}; \ No newline at end of file +var _0x559a=['BOOLEAN','ENUM','out','TEXT','sequelize','exports','medium'];(function(_0x14d04d,_0x43941e){var _0x3d914b=function(_0x155c24){while(--_0x155c24){_0x14d04d['push'](_0x14d04d['shift']());}};_0x3d914b(++_0x43941e);}(_0x559a,0xb3));var _0xa559=function(_0x447410,_0x149a1c){_0x447410=_0x447410-0x0;var _0x38a9c5=_0x559a[_0x447410];return _0x38a9c5;};'use strict';var Sequelize=require(_0xa559('0x0'));module[_0xa559('0x1')]={'body':{'type':Sequelize['TEXT'](_0xa559('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa559('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa559('0x4')]('in',_0xa559('0x5')),'defaultValue':_0xa559('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa559('0x6')],'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 787e1a7..9268abf 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 _0x53d1=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','offset','set','apply','save','update','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','params','include','find','body','destroy','describe','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','isNil','format','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','fax-interactions','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','Sequelize','rejectmessage','create','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','attachments','rimraf','zip-dir','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'];(function(_0x546ca4,_0x2f0016){var _0x47e1bd=function(_0x1fbb51){while(--_0x1fbb51){_0x546ca4['push'](_0x546ca4['shift']());}};_0x47e1bd(++_0x2f0016);}(_0x53d1,0x10f));var _0x153d=function(_0x51d839,_0x2272d3){_0x51d839=_0x51d839-0x0;var _0x57e0db=_0x53d1[_0x51d839];return _0x57e0db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x153d('0x0'));var zipdir=require(_0x153d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x153d('0x2'));var moment=require(_0x153d('0x3'));var BPromise=require(_0x153d('0x4'));var Mustache=require(_0x153d('0x5'));var util=require('util');var path=require(_0x153d('0x6'));var sox=require(_0x153d('0x7'));var csv=require(_0x153d('0x8'));var ejs=require(_0x153d('0x9'));var fs=require('fs');var fs_extra=require(_0x153d('0xa'));var _=require(_0x153d('0xb'));var squel=require(_0x153d('0xc'));var crypto=require(_0x153d('0xd'));var jsforce=require(_0x153d('0xe'));var deskjs=require(_0x153d('0xf'));var toCsv=require(_0x153d('0x8'));var querystring=require('querystring');var Papa=require(_0x153d('0x10'));var Redis=require(_0x153d('0x11'));var authService=require(_0x153d('0x12'));var qs=require(_0x153d('0x13'));var as=require(_0x153d('0x14'));var hardwareService=require(_0x153d('0x15'));var logger=require(_0x153d('0x16'))(_0x153d('0x17'));var utils=require(_0x153d('0x18'));var config=require(_0x153d('0x19'));var licenseUtil=require(_0x153d('0x1a'));var db=require(_0x153d('0x1b'))['db'];config[_0x153d('0x1c')]=_['defaults'](config[_0x153d('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x153d('0x1d'))(new Redis(config[_0x153d('0x1c')]));require(_0x153d('0x1e'))[_0x153d('0x1f')](socket);var jayson=require(_0x153d('0x20'));var client=jayson[_0x153d('0x21')][_0x153d('0x22')]({'port':0x232c});var client9002=jayson[_0x153d('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34300a,_0x3d2c9a,_0x592175,_0x3fc2f1){return new BPromise(function(_0x54bf7e,_0x3d3b07){var _0x30f0c5=_0x3fc2f1||client;return _0x30f0c5[_0x153d('0x23')](_0x34300a,_0x592175)[_0x153d('0x24')](function(_0x5447fc){logger[_0x153d('0x25')](_0x153d('0x26'),_0x3d2c9a,_0x153d('0x27'));logger[_0x153d('0x28')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x3d2c9a,'request\x20sent',JSON[_0x153d('0x29')](_0x5447fc));if(_0x5447fc[_0x153d('0x2a')]){if(_0x5447fc[_0x153d('0x2a')][_0x153d('0x2b')]===0x1f4){logger[_0x153d('0x2a')](_0x153d('0x26'),_0x3d2c9a,_0x5447fc[_0x153d('0x2a')][_0x153d('0x2c')]);return _0x3d3b07(_0x5447fc[_0x153d('0x2a')]['message']);}logger[_0x153d('0x2a')](_0x153d('0x26'),_0x3d2c9a,_0x5447fc[_0x153d('0x2a')][_0x153d('0x2c')]);return _0x54bf7e(_0x5447fc['error'][_0x153d('0x2c')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x3d2c9a,'request\x20sent');_0x54bf7e(_0x5447fc[_0x153d('0x2d')][_0x153d('0x2c')]);}})[_0x153d('0x2e')](function(_0xea7716){logger[_0x153d('0x2a')](_0x153d('0x26'),_0x3d2c9a,_0xea7716);_0x3d3b07(_0xea7716);});});}function respondWithStatusCode(_0x298c8c,_0x5e2b8c){_0x5e2b8c=_0x5e2b8c||0xcc;return function(_0x3229a2){if(_0x3229a2){return _0x298c8c[_0x153d('0x2f')](_0x5e2b8c);}return _0x298c8c[_0x153d('0x30')](_0x5e2b8c)[_0x153d('0x31')]();};}function respondWithResult(_0x55b8e0,_0x19c739){_0x19c739=_0x19c739||0xc8;return function(_0x4289c3){if(_0x4289c3){return _0x55b8e0[_0x153d('0x30')](_0x19c739)[_0x153d('0x32')](_0x4289c3);}};}function respondWithFilteredResult(_0x1a247b,_0xf8e6c0){return function(_0x2fd382){if(_0x2fd382){var _0x9fdb7d=typeof _0xf8e6c0['offset']==='undefined'&&typeof _0xf8e6c0[_0x153d('0x33')]===_0x153d('0x34');var _0x30565f=_0x2fd382['count'];var _0x346f2c=_0x9fdb7d?0x0:_0xf8e6c0[_0x153d('0x35')];var _0x4714e2=_0x9fdb7d?_0x2fd382['count']:_0xf8e6c0[_0x153d('0x35')]+_0xf8e6c0[_0x153d('0x33')];var _0x3dee09;if(_0x4714e2>=_0x30565f){_0x4714e2=_0x30565f;_0x3dee09=0xc8;}else{_0x3dee09=0xce;}_0x1a247b[_0x153d('0x30')](_0x3dee09);return _0x1a247b[_0x153d('0x36')]('Content-Range',_0x346f2c+'-'+_0x4714e2+'/'+_0x30565f)[_0x153d('0x32')](_0x2fd382);}return null;};}function patchUpdates(_0x34333a){return function(_0x2ee0e3){try{jsonpatch[_0x153d('0x37')](_0x2ee0e3,_0x34333a,!![]);}catch(_0x39c236){return BPromise['reject'](_0x39c236);}return _0x2ee0e3[_0x153d('0x38')]();};}function saveUpdates(_0x3df4b8,_0x1bde52){return function(_0x1e3f81){if(_0x1e3f81){return _0x1e3f81[_0x153d('0x39')](_0x3df4b8)[_0x153d('0x24')](function(_0x33e4e4){return _0x33e4e4;});}return null;};}function removeEntity(_0x5a43be,_0x26c3c3){return function(_0x2f33af){if(_0x2f33af){return _0x2f33af['destroy']()[_0x153d('0x24')](function(){_0x5a43be[_0x153d('0x30')](0xcc)[_0x153d('0x31')]();});}};}function handleEntityNotFound(_0x2c04aa,_0x2a0741){return function(_0x50954c){if(!_0x50954c){_0x2c04aa[_0x153d('0x2f')](0x194);}return _0x50954c;};}function handleError(_0x31dc7d,_0x14c488){_0x14c488=_0x14c488||0x1f4;return function(_0x82cbda){logger['error'](_0x82cbda[_0x153d('0x3a')]);if(_0x82cbda[_0x153d('0x3b')]){delete _0x82cbda[_0x153d('0x3b')];}_0x31dc7d[_0x153d('0x30')](_0x14c488)[_0x153d('0x3c')](_0x82cbda);};}exports[_0x153d('0x3d')]=function(_0x2a4630,_0x79c115){var _0x13819e={},_0x4a0c19={},_0x2f7575={'count':0x0,'rows':[]};var _0x273e6e=_[_0x153d('0x3e')](db[_0x153d('0x3f')][_0x153d('0x40')],function(_0xe4fa00){return{'name':_0xe4fa00[_0x153d('0x41')],'type':_0xe4fa00[_0x153d('0x42')][_0x153d('0x43')]};});_0x4a0c19[_0x153d('0x44')]=_[_0x153d('0x3e')](_0x273e6e,'name');_0x4a0c19[_0x153d('0x45')]=_[_0x153d('0x46')](_0x2a4630[_0x153d('0x45')]);_0x4a0c19[_0x153d('0x47')]=_[_0x153d('0x48')](_0x4a0c19[_0x153d('0x44')],_0x4a0c19[_0x153d('0x45')]);_0x13819e[_0x153d('0x49')]=_[_0x153d('0x48')](_0x4a0c19[_0x153d('0x44')],qs[_0x153d('0x4a')](_0x2a4630[_0x153d('0x45')][_0x153d('0x4a')]));_0x13819e['attributes']=_0x13819e[_0x153d('0x49')][_0x153d('0x4b')]?_0x13819e[_0x153d('0x49')]:_0x4a0c19['model'];if(!_0x2a4630[_0x153d('0x45')][_0x153d('0x4c')]('nolimit')){_0x13819e['limit']=qs[_0x153d('0x33')](_0x2a4630[_0x153d('0x45')][_0x153d('0x33')]);_0x13819e[_0x153d('0x35')]=qs[_0x153d('0x35')](_0x2a4630[_0x153d('0x45')][_0x153d('0x35')]);}_0x13819e[_0x153d('0x4d')]=qs['sort'](_0x2a4630[_0x153d('0x45')][_0x153d('0x4e')]);_0x13819e[_0x153d('0x4f')]=qs[_0x153d('0x47')](_[_0x153d('0x50')](_0x2a4630[_0x153d('0x45')],_0x4a0c19['filters']),_0x273e6e);if(_0x2a4630[_0x153d('0x45')][_0x153d('0x51')]){_0x13819e[_0x153d('0x4f')]=_[_0x153d('0x52')](_0x13819e[_0x153d('0x4f')],{'$or':_[_0x153d('0x3e')](_0x273e6e,function(_0x13ff1){if(_0x13ff1[_0x153d('0x42')]!==_0x153d('0x53')){var _0x34bedf={};_0x34bedf[_0x13ff1[_0x153d('0x3b')]]={'$like':'%'+_0x2a4630[_0x153d('0x45')][_0x153d('0x51')]+'%'};return _0x34bedf;}})});}_0x13819e=_[_0x153d('0x52')]({},_0x13819e,_0x2a4630[_0x153d('0x54')]);var _0x1e95ee={'where':_0x13819e[_0x153d('0x4f')]};return db['FaxMessage'][_0x153d('0x55')](_0x1e95ee)[_0x153d('0x24')](function(_0x5263d3){_0x2f7575[_0x153d('0x55')]=_0x5263d3;if(_0x2a4630[_0x153d('0x45')][_0x153d('0x56')]){_0x13819e['include']=[{'all':!![]}];}return db[_0x153d('0x3f')][_0x153d('0x57')](_0x13819e);})[_0x153d('0x24')](function(_0x1c66f7){_0x2f7575[_0x153d('0x58')]=_0x1c66f7;return _0x2f7575;})[_0x153d('0x24')](respondWithFilteredResult(_0x79c115,_0x13819e))[_0x153d('0x2e')](handleError(_0x79c115,null));};exports['show']=function(_0x5db096,_0x29935a){var _0x16e8fc={'raw':!![],'where':{'id':_0x5db096[_0x153d('0x59')]['id']}},_0x49c5dd={};_0x49c5dd[_0x153d('0x44')]=_['keys'](db['FaxMessage'][_0x153d('0x40')]);_0x49c5dd[_0x153d('0x45')]=_[_0x153d('0x46')](_0x5db096[_0x153d('0x45')]);_0x49c5dd[_0x153d('0x47')]=_[_0x153d('0x48')](_0x49c5dd[_0x153d('0x44')],_0x49c5dd[_0x153d('0x45')]);_0x16e8fc['attributes']=_[_0x153d('0x48')](_0x49c5dd[_0x153d('0x44')],qs[_0x153d('0x4a')](_0x5db096['query'][_0x153d('0x4a')]));_0x16e8fc[_0x153d('0x49')]=_0x16e8fc[_0x153d('0x49')][_0x153d('0x4b')]?_0x16e8fc[_0x153d('0x49')]:_0x49c5dd['model'];if(_0x5db096[_0x153d('0x45')][_0x153d('0x56')]){_0x16e8fc[_0x153d('0x5a')]=[{'all':!![]}];}_0x16e8fc=_[_0x153d('0x52')]({},_0x16e8fc,_0x5db096[_0x153d('0x54')]);return db[_0x153d('0x3f')][_0x153d('0x5b')](_0x16e8fc)[_0x153d('0x24')](handleEntityNotFound(_0x29935a,null))[_0x153d('0x24')](respondWithResult(_0x29935a,null))[_0x153d('0x2e')](handleError(_0x29935a,null));};exports[_0x153d('0x39')]=function(_0x554c74,_0xaf8ea9){if(_0x554c74[_0x153d('0x5c')]['id']){delete _0x554c74[_0x153d('0x5c')]['id'];}return db[_0x153d('0x3f')][_0x153d('0x5b')]({'where':{'id':_0x554c74[_0x153d('0x59')]['id']}})['then'](handleEntityNotFound(_0xaf8ea9,null))[_0x153d('0x24')](saveUpdates(_0x554c74[_0x153d('0x5c')],null))[_0x153d('0x24')](respondWithResult(_0xaf8ea9,null))[_0x153d('0x2e')](handleError(_0xaf8ea9,null));};exports[_0x153d('0x5d')]=function(_0x4a2fbc,_0x5ed3cc){return db[_0x153d('0x3f')][_0x153d('0x5b')]({'where':{'id':_0x4a2fbc[_0x153d('0x59')]['id']}})[_0x153d('0x24')](handleEntityNotFound(_0x5ed3cc,null))[_0x153d('0x24')](removeEntity(_0x5ed3cc,null))[_0x153d('0x2e')](handleError(_0x5ed3cc,null));};exports['describe']=function(_0x3d3c05,_0x3c60c0){return db['FaxMessage'][_0x153d('0x5e')]()[_0x153d('0x24')](respondWithResult(_0x3c60c0,null))['catch'](handleError(_0x3c60c0,null));};var interaction_log=require(_0x153d('0x16'))('fax-interactions');exports[_0x153d('0x5f')]=function(_0xabf071,_0x2c8fb3,_0x3d38a8){var _0x471092={'agent':{},'channel':_0x153d('0x60')};if(_0xabf071[_0x153d('0x5c')]['id']){delete _0xabf071[_0x153d('0x5c')]['id'];}_0xabf071[_0x153d('0x5c')][_0x153d('0x61')]=!![];_0xabf071[_0x153d('0x5c')][_0x153d('0x62')]=moment()['format'](_0x153d('0x63'));_0xabf071[_0x153d('0x5c')][_0x153d('0x64')]=_0xabf071[_0x153d('0x5c')][_0x153d('0x64')]||_0xabf071[_0x153d('0x65')]['id'];_0x471092[_0x153d('0x66')]['id']=_0xabf071[_0x153d('0x5c')][_0x153d('0x64')];return db[_0x153d('0x3f')]['find']({'where':{'id':_0xabf071[_0x153d('0x59')]['id'],'UserId':null}})[_0x153d('0x24')](handleEntityNotFound(_0x2c8fb3,null))['then'](saveUpdates(_0xabf071['body'],null))['then'](function(_0x5d22d9){if(_0x5d22d9){_0x471092[_0x153d('0x2c')]=_0x5d22d9[_0x153d('0x67')]({'plain':!![]});return db[_0x153d('0x68')][_0x153d('0x5b')]({'where':{'id':_0x5d22d9['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2c8fb3,null))[_0x153d('0x24')](function(_0x5e0dfc){if(_0x5e0dfc){return _0x5e0dfc['update']({'UserId':_0xabf071[_0x153d('0x5c')]['UserId'],'read1stAt':_[_0x153d('0x69')](_0x5e0dfc['read1stAt'])?moment()[_0x153d('0x6a')](_0x153d('0x63')):undefined});}return null;})[_0x153d('0x24')](function(_0xec2409){if(_0xec2409){_0x471092[_0x153d('0x6b')]=_0xec2409[_0x153d('0x67')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xabf071[_0x153d('0x65')]['id'],_0xabf071['user'][_0x153d('0x3b')],_0xabf071[_0x153d('0x65')][_0x153d('0x6c')],_0x471092[_0x153d('0x6b')]['id'],_0xabf071[_0x153d('0x5c')]?JSON['stringify'](_0xabf071['body']):_0x153d('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x153d('0x6e'),_0x471092);}return null;})[_0x153d('0x24')](function(_0x1aa277){var _0x3f15a4=_0x153d('0x6f')+_0x1aa277[_0x153d('0x2c')][_0x153d('0x70')];return db[_0x153d('0x71')][_0x153d('0x45')](_0x3f15a4,{'type':db['Sequelize'][_0x153d('0x72')][_0x153d('0x73')],'raw':!![]})[_0x153d('0x24')](function(_0x3c6174){return _0x3c6174;});})['then'](function(_0x2fc252){if(_0x2fc252){_0x471092['message'][_0x153d('0x74')]=_0x2fc252[0x0];if(!_0xabf071[_0x153d('0x5c')][_0x153d('0x64')])return;return db[_0x153d('0x75')][_0x153d('0x5b')]({'where':{'id':_0xabf071[_0x153d('0x5c')]['UserId'],'role':_0x153d('0x66')},'attributes':['id','name',_0x153d('0x76'),_0x153d('0x77'),_0x153d('0x78')],'raw':!![]});}return null;})['then'](function(_0x1c4f0d){if(!_0x1c4f0d)return null;_0x471092[_0x153d('0x2c')][_0x153d('0x66')]=_0x1c4f0d;return _0x471092;})[_0x153d('0x24')](function(_0x385e96){if(_0x385e96){if(_0xabf071[_0x153d('0x5c')][_0x153d('0x79')]){_0x471092['message'][_0x153d('0x7a')]=util[_0x153d('0x6a')](_0x153d('0x7b'),_0xabf071[_0x153d('0x65')]['name']);_0x471092[_0x153d('0x2c')][_0x153d('0x7c')]=_0x471092['channel'];_0x471092[_0x153d('0x2c')][_0x153d('0x7d')]=_0x471092[_0x153d('0x7c')];_0x471092[_0x153d('0x2c')][_0x153d('0x7e')]='accept';return respondWithRpcPromise('EventManager',_0x153d('0x7f'),{'event':_0x153d('0x80'),'message':_0x471092[_0x153d('0x2c')]},client9002)[_0x153d('0x24')](function(){return _0x471092;});}return _0x471092;}return null;})[_0x153d('0x24')](respondWithResult(_0x2c8fb3,null))[_0x153d('0x2e')](handleError(_0x2c8fb3,null));};var interaction_log=require(_0x153d('0x16'))(_0x153d('0x81'));exports['reject']=function(_0x2994d9,_0x4607a7,_0xe67060){var _0x4e1a2b={'agent':{},'channel':_0x153d('0x60')};if(_0x2994d9[_0x153d('0x5c')]['id']){delete _0x2994d9[_0x153d('0x5c')]['id'];}_0x2994d9[_0x153d('0x5c')][_0x153d('0x64')]=_0x2994d9[_0x153d('0x5c')][_0x153d('0x64')]||_0x2994d9[_0x153d('0x65')]['id'];_0x4e1a2b[_0x153d('0x66')]['id']=_0x2994d9['body'][_0x153d('0x64')];return db[_0x153d('0x3f')]['find']({'where':{'id':_0x2994d9[_0x153d('0x59')]['id'],'UserId':null}})[_0x153d('0x24')](handleEntityNotFound(_0x4607a7,null))['then'](function(_0x3ac7fc){if(_0x3ac7fc){_0x4e1a2b['message']=_0x3ac7fc['get']({'plain':!![]});return db[_0x153d('0x68')]['find']({'where':{'id':_0x3ac7fc[_0x153d('0x82')]}});}return null;})[_0x153d('0x24')](handleEntityNotFound(_0x4607a7,null))[_0x153d('0x24')](function(_0x6b3fe1){if(_0x6b3fe1){_0x4e1a2b[_0x153d('0x6b')]=_0x6b3fe1['get']({'plain':!![]});interaction_log['info'](_0x153d('0x83'),_0x2994d9[_0x153d('0x65')]['id'],_0x2994d9['user'][_0x153d('0x3b')],_0x2994d9[_0x153d('0x65')][_0x153d('0x6c')],_0x4e1a2b[_0x153d('0x6b')]['id'],_0x2994d9[_0x153d('0x5c')]?JSON[_0x153d('0x29')](_0x2994d9['body']):_0x153d('0x6d'));return respondWithRpcPromise('RejectMessage',_0x153d('0x84'),_0x4e1a2b);}return null;})[_0x153d('0x24')](function(_0x1f96b8){var _0x55da2a=_0x153d('0x6f')+_0x1f96b8[_0x153d('0x2c')][_0x153d('0x70')];return db['sequelize'][_0x153d('0x45')](_0x55da2a,{'type':db[_0x153d('0x85')][_0x153d('0x72')][_0x153d('0x73')],'raw':!![]})[_0x153d('0x24')](function(_0x4d1133){return _0x4d1133;});})[_0x153d('0x24')](function(_0x3eaab7){if(_0x3eaab7){_0x4e1a2b[_0x153d('0x2c')]['contact']=_0x3eaab7[0x0];if(!_0x2994d9[_0x153d('0x5c')][_0x153d('0x64')])return;return db[_0x153d('0x75')][_0x153d('0x5b')]({'where':{'id':_0x2994d9[_0x153d('0x5c')][_0x153d('0x64')],'role':_0x153d('0x66')},'attributes':['id','name',_0x153d('0x76'),_0x153d('0x77'),'internal'],'raw':!![]});}return null;})[_0x153d('0x24')](function(_0xb13665){if(!_0xb13665)return null;_0x4e1a2b[_0x153d('0x2c')][_0x153d('0x66')]=_0xb13665;return _0x4e1a2b;})[_0x153d('0x24')](function(_0x2e6699){if(_0x2e6699){_0x2e6699[_0x153d('0x2c')][_0x153d('0x7a')]=util['format']('SIP/%s',_0x2994d9[_0x153d('0x65')][_0x153d('0x3b')]);_0x2e6699[_0x153d('0x2c')]['channel']=_0x4e1a2b[_0x153d('0x7c')];_0x2e6699[_0x153d('0x2c')][_0x153d('0x7d')]=_0x4e1a2b[_0x153d('0x7c')];_0x2e6699[_0x153d('0x2c')]['event']='reject';respondWithRpcPromise(_0x153d('0x7f'),_0x153d('0x7f'),{'event':_0x153d('0x86'),'message':_0x2e6699[_0x153d('0x2c')]},client9002);return _0x4e1a2b;}return null;})[_0x153d('0x24')](respondWithResult(_0x4607a7,null))[_0x153d('0x2e')](handleError(_0x4607a7,null));};exports[_0x153d('0x87')]=function(_0xda1c78,_0x25600f){var _0xde5c37;return db['FaxMessage'][_0x153d('0x87')](_0xda1c78[_0x153d('0x5c')],{})[_0x153d('0x24')](function(_0x2b2014){_0xde5c37=_0x2b2014;return db['CmContact']['findOne']({'where':{'id':_0xde5c37[_0x153d('0x70')]}});})['then'](function(_0x5d34f2){if(_[_0x153d('0x69')](_0x5d34f2)){return;}else{_0xde5c37[_0x153d('0x60')]=_0x5d34f2[_0x153d('0x60')];return db[_0x153d('0x88')]['findOne']({'where':{'id':_0xde5c37[_0x153d('0x89')]}});}})[_0x153d('0x24')](function(_0x5bce95){return respondWithRpcPromise(_0x153d('0x8a'),_0x153d('0x8a'),{'FaxAccountId':_[_0x153d('0x69')](_0xda1c78[_0x153d('0x5c')])?undefined:_0xda1c78[_0x153d('0x5c')][_0x153d('0x8b')],'path':_[_0x153d('0x69')](_0x5bce95)?undefined:util[_0x153d('0x6a')](_0x153d('0x8c'),_0x5bce95[_0x153d('0x8d')]),'fax':_[_0x153d('0x69')](_0xde5c37['fax'])?undefined:_0xde5c37[_0x153d('0x60')],'AttachmentId':_0xde5c37[_0x153d('0x89')]},client9002);})[_0x153d('0x24')](respondWithResult(_0x25600f,0xc9))[_0x153d('0x2e')](handleError(_0x25600f,null));};exports[_0x153d('0x8e')]=function(_0x1a0e61,_0x1a11a8){var _0x420a1d=path['join'](config[_0x153d('0x8f')],_0x153d('0x90'),_0x153d('0x91'),_0x153d('0x92'));return db[_0x153d('0x3f')][_0x153d('0x5b')]({'where':{'id':_0x1a0e61['params']['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x153d('0x24')](handleEntityNotFound(_0x1a11a8,null))['then'](function(_0x397ab7){if(_0x397ab7){return _0x1a11a8[_0x153d('0x8e')](path['join'](_0x420a1d,_0x397ab7[_0x153d('0x88')]['basename']));}})[_0x153d('0x2e')](handleError(_0x1a11a8,null));}; \ No newline at end of file +var _0x6ba7=['socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','name','FaxMessage','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','update','body','find','destroy','describe','fax-interactions','accept','fax','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','stringify','Sequelize','email','motionChannel','rejectmessage','create','CmContact','Attachment','findOne','SendFax','basename','AttachmentId','download','join','root','files','attachments','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x28bc24,_0x2d36ac){var _0x5e8445=function(_0x4dba80){while(--_0x4dba80){_0x28bc24['push'](_0x28bc24['shift']());}};_0x5e8445(++_0x2d36ac);}(_0x6ba7,0x1f3));var _0x76ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ba7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x76ba('0x0'));var rp=require(_0x76ba('0x1'));var moment=require(_0x76ba('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x76ba('0x3'));var util=require(_0x76ba('0x4'));var path=require('path');var sox=require(_0x76ba('0x5'));var csv=require(_0x76ba('0x6'));var ejs=require(_0x76ba('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76ba('0x8'));var squel=require(_0x76ba('0x9'));var crypto=require(_0x76ba('0xa'));var jsforce=require(_0x76ba('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x76ba('0xc'));var Papa=require(_0x76ba('0xd'));var Redis=require('ioredis');var authService=require(_0x76ba('0xe'));var qs=require(_0x76ba('0xf'));var as=require(_0x76ba('0x10'));var hardwareService=require(_0x76ba('0x11'));var logger=require('../../config/logger')(_0x76ba('0x12'));var utils=require(_0x76ba('0x13'));var config=require(_0x76ba('0x14'));var licenseUtil=require(_0x76ba('0x15'));var db=require(_0x76ba('0x16'))['db'];config[_0x76ba('0x17')]=_[_0x76ba('0x18')](config[_0x76ba('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x76ba('0x19'))(new Redis(config['redis']));require(_0x76ba('0x1a'))[_0x76ba('0x1b')](socket);var jayson=require(_0x76ba('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x76ba('0x1d')][_0x76ba('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x63a34a,_0x1b38c7,_0x3aea50,_0x1ddf24){return new BPromise(function(_0x298f19,_0x591080){var _0x4069c2=_0x1ddf24||client;return _0x4069c2['request'](_0x63a34a,_0x3aea50)[_0x76ba('0x1f')](function(_0x11db8f){logger[_0x76ba('0x20')](_0x76ba('0x21'),_0x1b38c7,_0x76ba('0x22'));logger['debug'](_0x76ba('0x23'),_0x1b38c7,_0x76ba('0x22'),JSON['stringify'](_0x11db8f));if(_0x11db8f[_0x76ba('0x24')]){if(_0x11db8f['error']['code']===0x1f4){logger['error'](_0x76ba('0x21'),_0x1b38c7,_0x11db8f[_0x76ba('0x24')][_0x76ba('0x25')]);return _0x591080(_0x11db8f[_0x76ba('0x24')]['message']);}logger[_0x76ba('0x24')](_0x76ba('0x21'),_0x1b38c7,_0x11db8f[_0x76ba('0x24')][_0x76ba('0x25')]);return _0x298f19(_0x11db8f['error']['message']);}else{logger[_0x76ba('0x20')](_0x76ba('0x21'),_0x1b38c7,_0x76ba('0x22'));_0x298f19(_0x11db8f[_0x76ba('0x26')][_0x76ba('0x25')]);}})['catch'](function(_0x4fd9d0){logger['error'](_0x76ba('0x21'),_0x1b38c7,_0x4fd9d0);_0x591080(_0x4fd9d0);});});}function respondWithStatusCode(_0x24780b,_0x470fec){_0x470fec=_0x470fec||0xcc;return function(_0x41670f){if(_0x41670f){return _0x24780b[_0x76ba('0x27')](_0x470fec);}return _0x24780b[_0x76ba('0x28')](_0x470fec)[_0x76ba('0x29')]();};}function respondWithResult(_0x4ce6e4,_0x567b8b){_0x567b8b=_0x567b8b||0xc8;return function(_0x5e6539){if(_0x5e6539){return _0x4ce6e4[_0x76ba('0x28')](_0x567b8b)[_0x76ba('0x2a')](_0x5e6539);}};}function respondWithFilteredResult(_0x1693c5,_0x51fe6c){return function(_0x233cbb){if(_0x233cbb){var _0x2e6bc1=typeof _0x51fe6c[_0x76ba('0x2b')]===_0x76ba('0x2c')&&typeof _0x51fe6c[_0x76ba('0x2d')]===_0x76ba('0x2c');var _0x32ab1a=_0x233cbb[_0x76ba('0x2e')];var _0x3fbc24=_0x2e6bc1?0x0:_0x51fe6c['offset'];var _0x31f74c=_0x2e6bc1?_0x233cbb[_0x76ba('0x2e')]:_0x51fe6c['offset']+_0x51fe6c['limit'];var _0x22a190;if(_0x31f74c>=_0x32ab1a){_0x31f74c=_0x32ab1a;_0x22a190=0xc8;}else{_0x22a190=0xce;}_0x1693c5[_0x76ba('0x28')](_0x22a190);return _0x1693c5[_0x76ba('0x2f')]('Content-Range',_0x3fbc24+'-'+_0x31f74c+'/'+_0x32ab1a)['json'](_0x233cbb);}return null;};}function patchUpdates(_0x4d936b){return function(_0x51e2ac){try{jsonpatch['apply'](_0x51e2ac,_0x4d936b,!![]);}catch(_0xd4ce09){return BPromise[_0x76ba('0x30')](_0xd4ce09);}return _0x51e2ac[_0x76ba('0x31')]();};}function saveUpdates(_0x4b4983,_0x86fe28){return function(_0x1d20e7){if(_0x1d20e7){return _0x1d20e7['update'](_0x4b4983)[_0x76ba('0x1f')](function(_0x5a6bba){return _0x5a6bba;});}return null;};}function removeEntity(_0x3214fa,_0x1f7069){return function(_0xf8fc76){if(_0xf8fc76){return _0xf8fc76['destroy']()['then'](function(){_0x3214fa[_0x76ba('0x28')](0xcc)[_0x76ba('0x29')]();});}};}function handleEntityNotFound(_0x53ac22,_0x137c1c){return function(_0x1cf72b){if(!_0x1cf72b){_0x53ac22['sendStatus'](0x194);}return _0x1cf72b;};}function handleError(_0x523444,_0x498e6e){_0x498e6e=_0x498e6e||0x1f4;return function(_0xb9b5b6){logger[_0x76ba('0x24')](_0xb9b5b6['stack']);if(_0xb9b5b6['name']){delete _0xb9b5b6[_0x76ba('0x32')];}_0x523444[_0x76ba('0x28')](_0x498e6e)['send'](_0xb9b5b6);};}exports['index']=function(_0x5b0486,_0xf4851e){var _0x276808={},_0x406eb8={},_0x5519e8={'count':0x0,'rows':[]};var _0x269aa6=_['map'](db[_0x76ba('0x33')][_0x76ba('0x34')],function(_0x3e1620){return{'name':_0x3e1620['fieldName'],'type':_0x3e1620[_0x76ba('0x35')]['key']};});_0x406eb8[_0x76ba('0x36')]=_[_0x76ba('0x37')](_0x269aa6,'name');_0x406eb8['query']=_[_0x76ba('0x38')](_0x5b0486[_0x76ba('0x39')]);_0x406eb8[_0x76ba('0x3a')]=_[_0x76ba('0x3b')](_0x406eb8['model'],_0x406eb8['query']);_0x276808[_0x76ba('0x3c')]=_[_0x76ba('0x3b')](_0x406eb8['model'],qs['fields'](_0x5b0486[_0x76ba('0x39')][_0x76ba('0x3d')]));_0x276808[_0x76ba('0x3c')]=_0x276808[_0x76ba('0x3c')][_0x76ba('0x3e')]?_0x276808[_0x76ba('0x3c')]:_0x406eb8[_0x76ba('0x36')];if(!_0x5b0486[_0x76ba('0x39')]['hasOwnProperty']('nolimit')){_0x276808[_0x76ba('0x2d')]=qs[_0x76ba('0x2d')](_0x5b0486[_0x76ba('0x39')][_0x76ba('0x2d')]);_0x276808[_0x76ba('0x2b')]=qs['offset'](_0x5b0486[_0x76ba('0x39')][_0x76ba('0x2b')]);}_0x276808['order']=qs[_0x76ba('0x3f')](_0x5b0486[_0x76ba('0x39')][_0x76ba('0x3f')]);_0x276808[_0x76ba('0x40')]=qs[_0x76ba('0x3a')](_[_0x76ba('0x41')](_0x5b0486[_0x76ba('0x39')],_0x406eb8['filters']),_0x269aa6);if(_0x5b0486[_0x76ba('0x39')][_0x76ba('0x42')]){_0x276808['where']=_[_0x76ba('0x43')](_0x276808[_0x76ba('0x40')],{'$or':_[_0x76ba('0x37')](_0x269aa6,function(_0x50810f){if(_0x50810f[_0x76ba('0x35')]!==_0x76ba('0x44')){var _0x1abdc0={};_0x1abdc0[_0x50810f[_0x76ba('0x32')]]={'$like':'%'+_0x5b0486[_0x76ba('0x39')][_0x76ba('0x42')]+'%'};return _0x1abdc0;}})});}_0x276808=_[_0x76ba('0x43')]({},_0x276808,_0x5b0486['options']);var _0x44502d={'where':_0x276808[_0x76ba('0x40')]};return db[_0x76ba('0x33')][_0x76ba('0x2e')](_0x44502d)['then'](function(_0x5a0314){_0x5519e8[_0x76ba('0x2e')]=_0x5a0314;if(_0x5b0486[_0x76ba('0x39')][_0x76ba('0x45')]){_0x276808[_0x76ba('0x46')]=[{'all':!![]}];}return db[_0x76ba('0x33')][_0x76ba('0x47')](_0x276808);})[_0x76ba('0x1f')](function(_0x43cd77){_0x5519e8[_0x76ba('0x48')]=_0x43cd77;return _0x5519e8;})[_0x76ba('0x1f')](respondWithFilteredResult(_0xf4851e,_0x276808))[_0x76ba('0x49')](handleError(_0xf4851e,null));};exports['show']=function(_0x376e69,_0x206021){var _0x5d69f4={'raw':!![],'where':{'id':_0x376e69[_0x76ba('0x4a')]['id']}},_0x4f6635={};_0x4f6635[_0x76ba('0x36')]=_['keys'](db[_0x76ba('0x33')][_0x76ba('0x34')]);_0x4f6635[_0x76ba('0x39')]=_[_0x76ba('0x38')](_0x376e69[_0x76ba('0x39')]);_0x4f6635[_0x76ba('0x3a')]=_[_0x76ba('0x3b')](_0x4f6635[_0x76ba('0x36')],_0x4f6635['query']);_0x5d69f4[_0x76ba('0x3c')]=_[_0x76ba('0x3b')](_0x4f6635[_0x76ba('0x36')],qs['fields'](_0x376e69['query'][_0x76ba('0x3d')]));_0x5d69f4[_0x76ba('0x3c')]=_0x5d69f4[_0x76ba('0x3c')][_0x76ba('0x3e')]?_0x5d69f4[_0x76ba('0x3c')]:_0x4f6635[_0x76ba('0x36')];if(_0x376e69['query'][_0x76ba('0x45')]){_0x5d69f4[_0x76ba('0x46')]=[{'all':!![]}];}_0x5d69f4=_[_0x76ba('0x43')]({},_0x5d69f4,_0x376e69['options']);return db['FaxMessage']['find'](_0x5d69f4)[_0x76ba('0x1f')](handleEntityNotFound(_0x206021,null))[_0x76ba('0x1f')](respondWithResult(_0x206021,null))[_0x76ba('0x49')](handleError(_0x206021,null));};exports[_0x76ba('0x4b')]=function(_0x37b384,_0x38d127){if(_0x37b384[_0x76ba('0x4c')]['id']){delete _0x37b384[_0x76ba('0x4c')]['id'];}return db[_0x76ba('0x33')][_0x76ba('0x4d')]({'where':{'id':_0x37b384['params']['id']}})[_0x76ba('0x1f')](handleEntityNotFound(_0x38d127,null))[_0x76ba('0x1f')](saveUpdates(_0x37b384[_0x76ba('0x4c')],null))[_0x76ba('0x1f')](respondWithResult(_0x38d127,null))[_0x76ba('0x49')](handleError(_0x38d127,null));};exports[_0x76ba('0x4e')]=function(_0x49b8ca,_0x4618c6){return db[_0x76ba('0x33')]['find']({'where':{'id':_0x49b8ca[_0x76ba('0x4a')]['id']}})[_0x76ba('0x1f')](handleEntityNotFound(_0x4618c6,null))['then'](removeEntity(_0x4618c6,null))[_0x76ba('0x49')](handleError(_0x4618c6,null));};exports[_0x76ba('0x4f')]=function(_0x134619,_0x1f0a20){return db[_0x76ba('0x33')][_0x76ba('0x4f')]()[_0x76ba('0x1f')](respondWithResult(_0x1f0a20,null))[_0x76ba('0x49')](handleError(_0x1f0a20,null));};var interaction_log=require('../../config/logger')(_0x76ba('0x50'));exports[_0x76ba('0x51')]=function(_0x555dfc,_0x3c1db0,_0x4b1043){var _0x534dbd={'agent':{},'channel':_0x76ba('0x52')};if(_0x555dfc[_0x76ba('0x4c')]['id']){delete _0x555dfc[_0x76ba('0x4c')]['id'];}_0x555dfc[_0x76ba('0x4c')]['read']=!![];_0x555dfc['body']['readAt']=moment()[_0x76ba('0x53')](_0x76ba('0x54'));_0x555dfc[_0x76ba('0x4c')][_0x76ba('0x55')]=_0x555dfc['body']['UserId']||_0x555dfc[_0x76ba('0x56')]['id'];_0x534dbd[_0x76ba('0x57')]['id']=_0x555dfc['body'][_0x76ba('0x55')];return db[_0x76ba('0x33')][_0x76ba('0x4d')]({'where':{'id':_0x555dfc[_0x76ba('0x4a')]['id'],'UserId':null}})[_0x76ba('0x1f')](handleEntityNotFound(_0x3c1db0,null))['then'](saveUpdates(_0x555dfc['body'],null))[_0x76ba('0x1f')](function(_0x3f5a95){if(_0x3f5a95){_0x534dbd['message']=_0x3f5a95[_0x76ba('0x58')]({'plain':!![]});return db[_0x76ba('0x59')][_0x76ba('0x4d')]({'where':{'id':_0x3f5a95[_0x76ba('0x5a')]}});}return null;})[_0x76ba('0x1f')](handleEntityNotFound(_0x3c1db0,null))[_0x76ba('0x1f')](function(_0x448868){if(_0x448868){return _0x448868[_0x76ba('0x4b')]({'UserId':_0x555dfc['body'][_0x76ba('0x55')],'read1stAt':_[_0x76ba('0x5b')](_0x448868[_0x76ba('0x5c')])?moment()[_0x76ba('0x53')](_0x76ba('0x54')):undefined});}return null;})[_0x76ba('0x1f')](function(_0x18b09a){if(_0x18b09a){_0x534dbd[_0x76ba('0x5d')]=_0x18b09a[_0x76ba('0x58')]({'plain':!![]});interaction_log[_0x76ba('0x20')](_0x76ba('0x5e'),_0x555dfc[_0x76ba('0x56')]['id'],_0x555dfc[_0x76ba('0x56')][_0x76ba('0x32')],_0x555dfc[_0x76ba('0x56')][_0x76ba('0x5f')],_0x534dbd[_0x76ba('0x5d')]['id'],_0x555dfc[_0x76ba('0x4c')]?JSON['stringify'](_0x555dfc[_0x76ba('0x4c')]):'null');return respondWithRpcPromise('AcceptMessage',_0x76ba('0x60'),_0x534dbd);}return null;})[_0x76ba('0x1f')](function(_0x57db82){var _0x200f63=_0x76ba('0x61')+_0x57db82[_0x76ba('0x25')][_0x76ba('0x62')];return db[_0x76ba('0x63')][_0x76ba('0x39')](_0x200f63,{'type':db['Sequelize'][_0x76ba('0x64')][_0x76ba('0x65')],'raw':!![]})[_0x76ba('0x1f')](function(_0x3f3bd4){return _0x3f3bd4;});})[_0x76ba('0x1f')](function(_0x3f9180){if(_0x3f9180){_0x534dbd[_0x76ba('0x25')][_0x76ba('0x66')]=_0x3f9180[0x0];if(!_0x555dfc['body'][_0x76ba('0x55')])return;return db[_0x76ba('0x67')][_0x76ba('0x4d')]({'where':{'id':_0x555dfc['body'][_0x76ba('0x55')],'role':_0x76ba('0x57')},'attributes':['id','name',_0x76ba('0x68'),'email',_0x76ba('0x69')],'raw':!![]});}return null;})[_0x76ba('0x1f')](function(_0x533ad6){if(!_0x533ad6)return null;_0x534dbd['message'][_0x76ba('0x57')]=_0x533ad6;return _0x534dbd;})[_0x76ba('0x1f')](function(_0x5a3cd6){if(_0x5a3cd6){if(_0x555dfc['body'][_0x76ba('0x6a')]){_0x534dbd[_0x76ba('0x25')][_0x76ba('0x6b')]=util[_0x76ba('0x53')](_0x76ba('0x6c'),_0x555dfc['user'][_0x76ba('0x32')]);_0x534dbd[_0x76ba('0x25')][_0x76ba('0x6d')]=_0x534dbd[_0x76ba('0x6d')];_0x534dbd[_0x76ba('0x25')]['motionChannel']=_0x534dbd[_0x76ba('0x6d')];_0x534dbd['message'][_0x76ba('0x6e')]=_0x76ba('0x51');return respondWithRpcPromise(_0x76ba('0x6f'),_0x76ba('0x6f'),{'event':_0x76ba('0x70'),'message':_0x534dbd[_0x76ba('0x25')]},client9002)[_0x76ba('0x1f')](function(){return _0x534dbd;});}return _0x534dbd;}return null;})[_0x76ba('0x1f')](respondWithResult(_0x3c1db0,null))[_0x76ba('0x49')](handleError(_0x3c1db0,null));};var interaction_log=require(_0x76ba('0x71'))(_0x76ba('0x50'));exports['reject']=function(_0x52e216,_0x36a7f6,_0x112101){var _0x4b6062={'agent':{},'channel':_0x76ba('0x52')};if(_0x52e216['body']['id']){delete _0x52e216[_0x76ba('0x4c')]['id'];}_0x52e216['body'][_0x76ba('0x55')]=_0x52e216[_0x76ba('0x4c')][_0x76ba('0x55')]||_0x52e216[_0x76ba('0x56')]['id'];_0x4b6062['agent']['id']=_0x52e216[_0x76ba('0x4c')]['UserId'];return db[_0x76ba('0x33')][_0x76ba('0x4d')]({'where':{'id':_0x52e216['params']['id'],'UserId':null}})[_0x76ba('0x1f')](handleEntityNotFound(_0x36a7f6,null))[_0x76ba('0x1f')](function(_0x3a94d1){if(_0x3a94d1){_0x4b6062[_0x76ba('0x25')]=_0x3a94d1[_0x76ba('0x58')]({'plain':!![]});return db['FaxInteraction'][_0x76ba('0x4d')]({'where':{'id':_0x3a94d1['FaxInteractionId']}});}return null;})[_0x76ba('0x1f')](handleEntityNotFound(_0x36a7f6,null))[_0x76ba('0x1f')](function(_0x50ec76){if(_0x50ec76){_0x4b6062[_0x76ba('0x5d')]=_0x50ec76[_0x76ba('0x58')]({'plain':!![]});interaction_log[_0x76ba('0x20')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x52e216[_0x76ba('0x56')]['id'],_0x52e216[_0x76ba('0x56')][_0x76ba('0x32')],_0x52e216[_0x76ba('0x56')][_0x76ba('0x5f')],_0x4b6062[_0x76ba('0x5d')]['id'],_0x52e216['body']?JSON[_0x76ba('0x72')](_0x52e216['body']):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x4b6062);}return null;})[_0x76ba('0x1f')](function(_0x3b3900){var _0x11a2ee=_0x76ba('0x61')+_0x3b3900[_0x76ba('0x25')][_0x76ba('0x62')];return db[_0x76ba('0x63')]['query'](_0x11a2ee,{'type':db[_0x76ba('0x73')][_0x76ba('0x64')][_0x76ba('0x65')],'raw':!![]})[_0x76ba('0x1f')](function(_0x3c36b7){return _0x3c36b7;});})[_0x76ba('0x1f')](function(_0x4a1591){if(_0x4a1591){_0x4b6062[_0x76ba('0x25')][_0x76ba('0x66')]=_0x4a1591[0x0];if(!_0x52e216[_0x76ba('0x4c')][_0x76ba('0x55')])return;return db[_0x76ba('0x67')][_0x76ba('0x4d')]({'where':{'id':_0x52e216[_0x76ba('0x4c')][_0x76ba('0x55')],'role':_0x76ba('0x57')},'attributes':['id',_0x76ba('0x32'),_0x76ba('0x68'),_0x76ba('0x74'),'internal'],'raw':!![]});}return null;})[_0x76ba('0x1f')](function(_0x423d44){if(!_0x423d44)return null;_0x4b6062[_0x76ba('0x25')][_0x76ba('0x57')]=_0x423d44;return _0x4b6062;})[_0x76ba('0x1f')](function(_0x1c5511){if(_0x1c5511){_0x1c5511[_0x76ba('0x25')]['interface']=util[_0x76ba('0x53')](_0x76ba('0x6c'),_0x52e216[_0x76ba('0x56')][_0x76ba('0x32')]);_0x1c5511[_0x76ba('0x25')][_0x76ba('0x6d')]=_0x4b6062['channel'];_0x1c5511[_0x76ba('0x25')][_0x76ba('0x75')]=_0x4b6062['channel'];_0x1c5511[_0x76ba('0x25')]['event']=_0x76ba('0x30');respondWithRpcPromise(_0x76ba('0x6f'),_0x76ba('0x6f'),{'event':_0x76ba('0x76'),'message':_0x1c5511[_0x76ba('0x25')]},client9002);return _0x4b6062;}return null;})[_0x76ba('0x1f')](respondWithResult(_0x36a7f6,null))[_0x76ba('0x49')](handleError(_0x36a7f6,null));};exports[_0x76ba('0x77')]=function(_0xd601ef,_0x15d326){var _0x27e462;return db[_0x76ba('0x33')][_0x76ba('0x77')](_0xd601ef['body'],{})[_0x76ba('0x1f')](function(_0xfab606){_0x27e462=_0xfab606;return db[_0x76ba('0x78')]['findOne']({'where':{'id':_0x27e462[_0x76ba('0x62')]}});})[_0x76ba('0x1f')](function(_0x3159bf){if(_[_0x76ba('0x5b')](_0x3159bf)){return;}else{_0x27e462[_0x76ba('0x52')]=_0x3159bf[_0x76ba('0x52')];return db[_0x76ba('0x79')][_0x76ba('0x7a')]({'where':{'id':_0x27e462['AttachmentId']}});}})[_0x76ba('0x1f')](function(_0x568175){return respondWithRpcPromise('SendFax',_0x76ba('0x7b'),{'FaxAccountId':_[_0x76ba('0x5b')](_0xd601ef[_0x76ba('0x4c')])?undefined:_0xd601ef[_0x76ba('0x4c')]['FaxAccountId'],'path':_[_0x76ba('0x5b')](_0x568175)?undefined:util[_0x76ba('0x53')]('/var/opt/motion2/server/files/attachments/%s',_0x568175[_0x76ba('0x7c')]),'fax':_[_0x76ba('0x5b')](_0x27e462[_0x76ba('0x52')])?undefined:_0x27e462[_0x76ba('0x52')],'AttachmentId':_0x27e462[_0x76ba('0x7d')]},client9002);})['then'](respondWithResult(_0x15d326,0xc9))[_0x76ba('0x49')](handleError(_0x15d326,null));};exports[_0x76ba('0x7e')]=function(_0x4185b9,_0x1c0131){var _0x386d0e=path[_0x76ba('0x7f')](config[_0x76ba('0x80')],'server',_0x76ba('0x81'),_0x76ba('0x82'));return db['FaxMessage'][_0x76ba('0x4d')]({'where':{'id':_0x4185b9[_0x76ba('0x4a')]['id']},'include':[{'model':db['Attachment'],'as':_0x76ba('0x79')}]})[_0x76ba('0x1f')](handleEntityNotFound(_0x1c0131,null))[_0x76ba('0x1f')](function(_0x4186a1){if(_0x4186a1){return _0x1c0131[_0x76ba('0x7e')](path[_0x76ba('0x7f')](_0x386d0e,_0x4186a1[_0x76ba('0x79')][_0x76ba('0x7c')]));}})[_0x76ba('0x49')](handleError(_0x1c0131,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index b0c2502..0915d9f 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 _0x4d49=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x171b6d,_0x1ead43){var _0x237f86=function(_0x99ccfb){while(--_0x99ccfb){_0x171b6d['push'](_0x171b6d['shift']());}};_0x237f86(++_0x1ead43);}(_0x4d49,0x141));var _0x94d4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4d49[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x94d4('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x94d4('0x1')](0x0);var events={'afterCreate':_0x94d4('0x2'),'afterUpdate':_0x94d4('0x3'),'afterDestroy':_0x94d4('0x4')};function emitEvent(_0xa6775f){return function(_0x95b780,_0x422546,_0x122abc){FaxMessageEvents[_0x94d4('0x5')](_0xa6775f+':'+_0x95b780['id'],_0x95b780);FaxMessageEvents['emit'](_0xa6775f,_0x95b780);_0x122abc(null);};}for(var e in events){if(events[_0x94d4('0x6')](e)){var event=events[e];FaxMessage[_0x94d4('0x7')](e,emitEvent(event));}}module[_0x94d4('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x677a=['setMaxListeners','save','update','remove','emit','hook','exports','events','FaxMessage'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0x677a,0xd6));var _0xa677=function(_0x1a4715,_0x212d14){_0x1a4715=_0x1a4715-0x0;var _0x49e220=_0x677a[_0x1a4715];return _0x49e220;};'use strict';var EventEmitter=require(_0xa677('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xa677('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa677('0x2')](0x0);var events={'afterCreate':_0xa677('0x3'),'afterUpdate':_0xa677('0x4'),'afterDestroy':_0xa677('0x5')};function emitEvent(_0x4a7c34){return function(_0x1ca988,_0x2e46f8,_0x45eebf){FaxMessageEvents[_0xa677('0x6')](_0x4a7c34+':'+_0x1ca988['id'],_0x1ca988);FaxMessageEvents[_0xa677('0x6')](_0x4a7c34,_0x1ca988);_0x45eebf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xa677('0x7')](e,emitEvent(event));}}module[_0xa677('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index f4ea830..043c4b9 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 _0xf216=['fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','rimraf','exports','define','FaxMessage'];(function(_0x11c0ae,_0x5c6b40){var _0x17f4fd=function(_0x372d55){while(--_0x372d55){_0x11c0ae['push'](_0x11c0ae['shift']());}};_0x17f4fd(++_0x5c6b40);}(_0xf216,0x9f));var _0x6f21=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0xf216[_0x4cbf20];return _0x582ae4;};'use strict';var _=require(_0x6f21('0x0'));var util=require(_0x6f21('0x1'));var logger=require(_0x6f21('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6f21('0x3'));var rp=require(_0x6f21('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6f21('0x5'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x6f21('0x6')]=function(_0x486abc,_0x55b3d5){return _0x486abc[_0x6f21('0x7')](_0x6f21('0x8'),attributes,{'tableName':_0x6f21('0x9'),'paranoid':![],'indexes':[{'name':_0x6f21('0xa'),'fields':[_0x6f21('0xb')],'type':_0x6f21('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2314a9,_0x115e9e,_0x540028){var _0x4835e0=_0x486abc[_0x6f21('0xd')];var _0x3bbff8=_0x2314a9[_0x6f21('0xe')]({'plain':!![]});if(_0x3bbff8[_0x6f21('0xf')][_0x6f21('0x10')]()==='in'||_0x3bbff8[_0x6f21('0xf')]['toLowerCase']()===_0x6f21('0x11')&&!_0x3bbff8[_0x6f21('0x12')]&&!_[_0x6f21('0x13')](_0x3bbff8[_0x6f21('0x14')])){_0x4835e0[_0x6f21('0x15')]['findOne']({'where':{'id':_0x3bbff8['FaxInteractionId']}})['then'](function(_0x1bd8eb){if(_0x1bd8eb){_0x1bd8eb[_0x6f21('0x16')]({'lastMsgAt':_0x3bbff8[_0x6f21('0x17')],'lastMsgDirection':_0x3bbff8[_0x6f21('0xf')][_0x6f21('0x10')]()});}})[_0x6f21('0x18')](function(_0x518cd9){console[_0x6f21('0x19')](_0x518cd9);});}_0x540028();}},'charset':_0x6f21('0x1a'),'collate':_0x6f21('0x1b')});}; \ No newline at end of file +var _0x7f57=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','FaxInteraction','findOne','then','update','createdAt','catch','error'];(function(_0x119d13,_0x263cd2){var _0x333c35=function(_0x422c6e){while(--_0x422c6e){_0x119d13['push'](_0x119d13['shift']());}};_0x333c35(++_0x263cd2);}(_0x7f57,0x10e));var _0x77f5=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x7f57[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x77f5('0x0'));var util=require(_0x77f5('0x1'));var logger=require(_0x77f5('0x2'))(_0x77f5('0x3'));var moment=require(_0x77f5('0x4'));var BPromise=require(_0x77f5('0x5'));var rp=require(_0x77f5('0x6'));var fs=require('fs');var path=require(_0x77f5('0x7'));var rimraf=require(_0x77f5('0x8'));var config=require(_0x77f5('0x9'));var attributes=require(_0x77f5('0xa'));module['exports']=function(_0x5895f2,_0x39a533){return _0x5895f2[_0x77f5('0xb')](_0x77f5('0xc'),attributes,{'tableName':_0x77f5('0xd'),'paranoid':![],'indexes':[{'name':_0x77f5('0xe'),'fields':[_0x77f5('0xf')],'type':_0x77f5('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3baecb,_0x19040c,_0x2835e5){var _0x112074=_0x5895f2[_0x77f5('0x11')];var _0x2a3568=_0x3baecb[_0x77f5('0x12')]({'plain':!![]});if(_0x2a3568[_0x77f5('0x13')][_0x77f5('0x14')]()==='in'||_0x2a3568[_0x77f5('0x13')][_0x77f5('0x14')]()==='out'&&!_0x2a3568['secret']&&!_[_0x77f5('0x15')](_0x2a3568[_0x77f5('0x16')])){_0x112074[_0x77f5('0x17')][_0x77f5('0x18')]({'where':{'id':_0x2a3568['FaxInteractionId']}})[_0x77f5('0x19')](function(_0x9ac4d8){if(_0x9ac4d8){_0x9ac4d8[_0x77f5('0x1a')]({'lastMsgAt':_0x2a3568[_0x77f5('0x1b')],'lastMsgDirection':_0x2a3568[_0x77f5('0x13')][_0x77f5('0x14')]()});}})[_0x77f5('0x1c')](function(_0x1acac4){console[_0x77f5('0x1d')](_0x1acac4);});}_0x2835e5();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 22bfb07..676d20e 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 _0x24ca=['redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','create','body','options','stringify','UpdateFaxMessage','FaxMessage','update','where','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2714ec,_0x36daa4){_0x2714ec=_0x2714ec-0x0;var _0x2608e5=_0x24ca[_0x2714ec];return _0x2608e5;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});config[_0xa24c('0xc')]=_[_0xa24c('0xd')](config[_0xa24c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa24c('0xe'))(new Redis(config[_0xa24c('0xc')]));require(_0xa24c('0xf'))['register'](socket);function respondWithRpcPromise(_0x399f32,_0x325c6d,_0x288f76){return new BPromise(function(_0x211003,_0x169632){return client[_0xa24c('0x10')](_0x399f32,_0x288f76)[_0xa24c('0x11')](function(_0xc82af0){logger[_0xa24c('0x12')]('FaxMessage,\x20%s,\x20%s',_0x325c6d,_0xa24c('0x13'));logger[_0xa24c('0x14')](_0xa24c('0x15'),_0x325c6d,_0xa24c('0x13'),JSON['stringify'](_0xc82af0));if(_0xc82af0[_0xa24c('0x16')]){if(_0xc82af0[_0xa24c('0x16')][_0xa24c('0x17')]===0x1f4){logger[_0xa24c('0x16')](_0xa24c('0x18'),_0x325c6d,_0xc82af0[_0xa24c('0x16')][_0xa24c('0x19')]);return _0x169632(_0xc82af0['error']['message']);}logger[_0xa24c('0x16')](_0xa24c('0x18'),_0x325c6d,_0xc82af0['error']['message']);return _0x211003(_0xc82af0[_0xa24c('0x16')][_0xa24c('0x19')]);}else{logger['info'](_0xa24c('0x18'),_0x325c6d,'request\x20sent');_0x211003(_0xc82af0[_0xa24c('0x1a')][_0xa24c('0x19')]);}})[_0xa24c('0x1b')](function(_0xefdbd9){logger['error'](_0xa24c('0x18'),_0x325c6d,_0xefdbd9);_0x169632(_0xefdbd9);});});}exports[_0xa24c('0x1c')]=function(_0x773f70){var _0x4d4bab=this;return new Promise(function(_0x48a768,_0x506424){return db['FaxMessage'][_0xa24c('0x1d')](_0x773f70[_0xa24c('0x1e')],{'raw':_0x773f70[_0xa24c('0x1f')]?_0x773f70[_0xa24c('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xa24c('0x11')](function(_0x5f299e){logger[_0xa24c('0x12')](_0xa24c('0x1c'),_0x773f70);logger['debug'](_0xa24c('0x1c'),_0x773f70,JSON[_0xa24c('0x20')](_0x5f299e));_0x48a768(_0x5f299e);})[_0xa24c('0x1b')](function(_0x188ee2){logger[_0xa24c('0x16')]('CreateFaxMessage',_0x188ee2[_0xa24c('0x19')],_0x773f70);_0x506424(_0x4d4bab['error'](0x1f4,_0x188ee2[_0xa24c('0x19')]));});});};exports[_0xa24c('0x21')]=function(_0x294685){var _0x51dc3f=this;return new Promise(function(_0x1beb55,_0x31c4d9){return db[_0xa24c('0x22')][_0xa24c('0x23')](_0x294685[_0xa24c('0x1e')],{'raw':_0x294685[_0xa24c('0x1f')]?_0x294685[_0xa24c('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x294685[_0xa24c('0x1f')]?_0x294685[_0xa24c('0x1f')][_0xa24c('0x24')]||null:null,'attributes':_0x294685[_0xa24c('0x1f')]?_0x294685['options'][_0xa24c('0x25')]||null:null,'limit':_0x294685[_0xa24c('0x1f')]?_0x294685[_0xa24c('0x1f')]['limit']||null:null})[_0xa24c('0x11')](function(_0x3dcb1b){logger[_0xa24c('0x12')]('UpdateFaxMessage',_0x294685);logger[_0xa24c('0x14')]('UpdateFaxMessage',_0x294685,JSON[_0xa24c('0x20')](_0x3dcb1b));_0x1beb55(_0x3dcb1b);})[_0xa24c('0x1b')](function(_0x1a247b){logger['error'](_0xa24c('0x21'),_0x1a247b[_0xa24c('0x19')],_0x294685);_0x31c4d9(_0x51dc3f[_0xa24c('0x16')](0x1f4,_0x1a247b['message']));});});}; \ No newline at end of file +var _0x55e0=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxMessage.socket','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','UpdateFaxMessage','update','where','attributes','limit','lodash','util'];(function(_0x280e74,_0x1bf1d2){var _0x14a14f=function(_0x406989){while(--_0x406989){_0x280e74['push'](_0x280e74['shift']());}};_0x14a14f(++_0x1bf1d2);}(_0x55e0,0xdc));var _0x055e=function(_0x7b8022,_0x2932d1){_0x7b8022=_0x7b8022-0x0;var _0x2ffa66=_0x55e0[_0x7b8022];return _0x2ffa66;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x055e('0xa')]=_['defaults'](config[_0x055e('0xa')],{'host':_0x055e('0xb'),'port':0x18eb});var socket=require(_0x055e('0xc'))(new Redis(config[_0x055e('0xa')]));require(_0x055e('0xd'))['register'](socket);function respondWithRpcPromise(_0x40779c,_0xd67814,_0xb816c){return new BPromise(function(_0xa0d384,_0x238068){return client['request'](_0x40779c,_0xb816c)['then'](function(_0x187cce){logger['info'](_0x055e('0xe'),_0xd67814,_0x055e('0xf'));logger[_0x055e('0x10')](_0x055e('0x11'),_0xd67814,_0x055e('0xf'),JSON[_0x055e('0x12')](_0x187cce));if(_0x187cce[_0x055e('0x13')]){if(_0x187cce['error'][_0x055e('0x14')]===0x1f4){logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);return _0x238068(_0x187cce['error'][_0x055e('0x15')]);}logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce['error'][_0x055e('0x15')]);return _0xa0d384(_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);}else{logger[_0x055e('0x16')](_0x055e('0xe'),_0xd67814,'request\x20sent');_0xa0d384(_0x187cce[_0x055e('0x17')][_0x055e('0x15')]);}})[_0x055e('0x18')](function(_0x2ed6fb){logger['error'](_0x055e('0xe'),_0xd67814,_0x2ed6fb);_0x238068(_0x2ed6fb);});});}exports[_0x055e('0x19')]=function(_0x58e44a){var _0xe2b7b5=this;return new Promise(function(_0x4412f9,_0x10258f){return db[_0x055e('0x1a')][_0x055e('0x1b')](_0x58e44a[_0x055e('0x1c')],{'raw':_0x58e44a['options']?_0x58e44a[_0x055e('0x1d')][_0x055e('0x1e')]===undefined?!![]:![]:!![]})[_0x055e('0x1f')](function(_0x5930ff){logger[_0x055e('0x16')](_0x055e('0x19'),_0x58e44a);logger[_0x055e('0x10')](_0x055e('0x19'),_0x58e44a,JSON['stringify'](_0x5930ff));_0x4412f9(_0x5930ff);})[_0x055e('0x18')](function(_0x56c372){logger[_0x055e('0x13')](_0x055e('0x19'),_0x56c372[_0x055e('0x15')],_0x58e44a);_0x10258f(_0xe2b7b5[_0x055e('0x13')](0x1f4,_0x56c372[_0x055e('0x15')]));});});};exports[_0x055e('0x20')]=function(_0x58caf9){var _0x2fb49b=this;return new Promise(function(_0x1f90a9,_0x2a82f8){return db['FaxMessage'][_0x055e('0x21')](_0x58caf9[_0x055e('0x1c')],{'raw':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x22')]||null:null,'attributes':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')][_0x055e('0x23')]||null:null,'limit':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x24')]||null:null})[_0x055e('0x1f')](function(_0x293062){logger[_0x055e('0x16')](_0x055e('0x20'),_0x58caf9);logger[_0x055e('0x10')](_0x055e('0x20'),_0x58caf9,JSON[_0x055e('0x12')](_0x293062));_0x1f90a9(_0x293062);})['catch'](function(_0x26d1c2){logger[_0x055e('0x13')]('UpdateFaxMessage',_0x26d1c2[_0x055e('0x15')],_0x58caf9);_0x2a82f8(_0x2fb49b[_0x055e('0x13')](0x1f4,_0x26d1c2[_0x055e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index fbb7071..32b5fc9 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 _0x6907=['faxMessage:','save','remove','update','register','length'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6907,0x18d));var _0x7690=function(_0x245a1b,_0x4d1c82){_0x245a1b=_0x245a1b-0x0;var _0x4cfc59=_0x6907[_0x245a1b];return _0x4cfc59;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x7690('0x0'),_0x7690('0x1'),_0x7690('0x2')];function createListener(_0x5efb06,_0x3d520e){return function(_0x1ba8ca){_0x3d520e['emit'](_0x5efb06,_0x1ba8ca);};}function removeListener(_0x1e3d1d,_0x70ce7f){return function(){FaxMessageEvents['removeListener'](_0x1e3d1d,_0x70ce7f);};}exports[_0x7690('0x3')]=function(_0x251d9f){for(var _0x5afc39=0x0,_0x495dee=events[_0x7690('0x4')];_0x5afc39<_0x495dee;_0x5afc39++){var _0xb4500a=events[_0x5afc39];var _0x2d9af5=createListener(_0x7690('0x5')+_0xb4500a,_0x251d9f);FaxMessageEvents['on'](_0xb4500a,_0x2d9af5);}}; \ No newline at end of file +var _0xe2f7=['update','emit','removeListener','register','./faxMessage.events','remove'];(function(_0xaaee00,_0x1e2042){var _0x4a9ade=function(_0x3f00aa){while(--_0x3f00aa){_0xaaee00['push'](_0xaaee00['shift']());}};_0x4a9ade(++_0x1e2042);}(_0xe2f7,0x100));var _0x7e2f=function(_0x4aae8b,_0x28f201){_0x4aae8b=_0x4aae8b-0x0;var _0x25ed11=_0xe2f7[_0x4aae8b];return _0x25ed11;};'use strict';var FaxMessageEvents=require(_0x7e2f('0x0'));var events=['save',_0x7e2f('0x1'),_0x7e2f('0x2')];function createListener(_0x132edb,_0x1cea27){return function(_0x4df000){_0x1cea27[_0x7e2f('0x3')](_0x132edb,_0x4df000);};}function removeListener(_0x32a57f,_0x2d1aa9){return function(){FaxMessageEvents[_0x7e2f('0x4')](_0x32a57f,_0x2d1aa9);};}exports[_0x7e2f('0x5')]=function(_0x26c8e4){for(var _0x130da7=0x0,_0x44b6ee=events['length'];_0x130da7<_0x44b6ee;_0x130da7++){var _0x5b93fd=events[_0x130da7];var _0x1d75ae=createListener('faxMessage:'+_0x5b93fd,_0x26c8e4);FaxMessageEvents['on'](_0x5b93fd,_0x1d75ae);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index f29e188..96e3a9f 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 _0x4ea3=['isAuthenticated','index','/describe','/:id','/:id/download','post','tracked','faxmessage:create','create','put','update','/:id/accept','accept','reject','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./faxMessage.controller','get'];(function(_0x4bac70,_0x571231){var _0xfa0804=function(_0x14b052){while(--_0x14b052){_0x4bac70['push'](_0x4bac70['shift']());}};_0xfa0804(++_0x571231);}(_0x4ea3,0x70));var _0x34ea=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4ea3[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller['describe']);router[_0x34ea('0x7')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller['show']);router[_0x34ea('0x7')](_0x34ea('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x34ea('0xd')]('/',auth[_0x34ea('0x8')](),interaction[_0x34ea('0xe')]('fax',_0x34ea('0xf')),controller[_0x34ea('0x10')]);router[_0x34ea('0x11')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0x12')]);router[_0x34ea('0x11')](_0x34ea('0x13'),auth[_0x34ea('0x8')](),controller[_0x34ea('0x14')]);router[_0x34ea('0x11')]('/:id/reject',auth[_0x34ea('0x8')](),controller[_0x34ea('0x15')]);router[_0x34ea('0x16')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller['destroy']);module[_0x34ea('0x17')]=router; \ No newline at end of file +var _0x7072=['/:id/download','download','post','tracked','fax','faxmessage:create','create','put','accept','/:id/reject','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1a431c,_0x4c9722){var _0x56c083=function(_0x229b88){while(--_0x229b88){_0x1a431c['push'](_0x1a431c['shift']());}};_0x56c083(++_0x4c9722);}(_0x7072,0x138));var _0x2707=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x7072[_0x1f36bb];return _0xaf97fa;};'use strict';var multer=require('multer');var util=require(_0x2707('0x0'));var path=require(_0x2707('0x1'));var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2707('0x5'));var config=require('../../config/environment');var controller=require(_0x2707('0x6'));router[_0x2707('0x7')]('/',auth[_0x2707('0x8')](),controller[_0x2707('0x9')]);router[_0x2707('0x7')](_0x2707('0xa'),auth[_0x2707('0x8')](),controller[_0x2707('0xb')]);router[_0x2707('0x7')](_0x2707('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2707('0x7')](_0x2707('0xd'),auth[_0x2707('0x8')](),controller[_0x2707('0xe')]);router[_0x2707('0xf')]('/',auth[_0x2707('0x8')](),interaction[_0x2707('0x10')](_0x2707('0x11'),_0x2707('0x12')),controller[_0x2707('0x13')]);router[_0x2707('0x14')](_0x2707('0xc'),auth[_0x2707('0x8')](),controller['update']);router[_0x2707('0x14')]('/:id/accept',auth[_0x2707('0x8')](),controller[_0x2707('0x15')]);router[_0x2707('0x14')](_0x2707('0x16'),auth[_0x2707('0x8')](),controller['reject']);router[_0x2707('0x17')](_0x2707('0xc'),auth[_0x2707('0x8')](),controller['destroy']);module[_0x2707('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 437f6b4..574d567 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 _0xc7c6=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','name','STRING'];(function(_0x53ae0a,_0x49e9ed){var _0x36bc91=function(_0x3af3ad){while(--_0x3af3ad){_0x53ae0a['push'](_0x53ae0a['shift']());}};_0x36bc91(++_0x49e9ed);}(_0xc7c6,0x85));var _0x6c7c=function(_0x1380a6,_0x18562e){_0x1380a6=_0x1380a6-0x0;var _0x65014=_0xc7c6[_0x1380a6];return _0x65014;};'use strict';var Sequelize=require('sequelize');module[_0x6c7c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6c7c('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6c7c('0x2')]},'timeout':{'type':Sequelize[_0x6c7c('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6c7c('0x4')](_0x6c7c('0x5'),_0x6c7c('0x6'),_0x6c7c('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6c7c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6365=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x2f13d5,_0xca2975){var _0x173f49=function(_0x39f855){while(--_0x39f855){_0x2f13d5['push'](_0x2f13d5['shift']());}};_0x173f49(++_0xca2975);}(_0x6365,0x148));var _0x5636=function(_0x389170,_0x25511c){_0x389170=_0x389170-0x0;var _0x4c7e2a=_0x6365[_0x389170];return _0x4c7e2a;};'use strict';var Sequelize=require(_0x5636('0x0'));module[_0x5636('0x1')]={'name':{'type':Sequelize[_0x5636('0x2')],'unique':_0x5636('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5636('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5636('0x5')](_0x5636('0x6'),_0x5636('0x7'),_0x5636('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index c4fb543..9dd3024 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 _0x0bbe=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','FaxQueues','error','name','index','map','FaxQueue','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','sort','pick','FaxQueueId','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','params','getTeams','addTeams','ids','Team','User','voicePause','Agents','sequelize','transaction','findOrCreate','forEach','userFaxQueue:save','removeTeams','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','compact','value','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x39dd29,_0x471dfd){var _0x185912=function(_0x58455e){while(--_0x58455e){_0x39dd29['push'](_0x39dd29['shift']());}};_0x185912(++_0x471dfd);}(_0x0bbe,0x84));var _0xe0bb=function(_0x13515a,_0x58952f){_0x13515a=_0x13515a-0x0;var _0x40d246=_0x0bbe[_0x13515a];return _0x40d246;};'use strict';var emlformat=require(_0xe0bb('0x0'));var rimraf=require(_0xe0bb('0x1'));var zipdir=require(_0xe0bb('0x2'));var jsonpatch=require(_0xe0bb('0x3'));var rp=require('request-promise');var moment=require(_0xe0bb('0x4'));var BPromise=require(_0xe0bb('0x5'));var Mustache=require(_0xe0bb('0x6'));var util=require(_0xe0bb('0x7'));var path=require(_0xe0bb('0x8'));var sox=require(_0xe0bb('0x9'));var csv=require(_0xe0bb('0xa'));var ejs=require(_0xe0bb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe0bb('0xc'));var squel=require(_0xe0bb('0xd'));var crypto=require(_0xe0bb('0xe'));var jsforce=require(_0xe0bb('0xf'));var deskjs=require(_0xe0bb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe0bb('0x11'));var Papa=require(_0xe0bb('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe0bb('0x13'));var as=require(_0xe0bb('0x14'));var hardwareService=require(_0xe0bb('0x15'));var logger=require(_0xe0bb('0x16'))(_0xe0bb('0x17'));var utils=require(_0xe0bb('0x18'));var config=require(_0xe0bb('0x19'));var licenseUtil=require(_0xe0bb('0x1a'));var db=require(_0xe0bb('0x1b'))['db'];config['redis']=_[_0xe0bb('0x1c')](config[_0xe0bb('0x1d')],{'host':_0xe0bb('0x1e'),'port':0x18eb});var socket=require(_0xe0bb('0x1f'))(new Redis(config[_0xe0bb('0x1d')]));require(_0xe0bb('0x20'))[_0xe0bb('0x21')](socket);function respondWithStatusCode(_0x362e48,_0x39f955){_0x39f955=_0x39f955||0xcc;return function(_0x8fcbb9){if(_0x8fcbb9){return _0x362e48['sendStatus'](_0x39f955);}return _0x362e48[_0xe0bb('0x22')](_0x39f955)[_0xe0bb('0x23')]();};}function respondWithResult(_0x20736c,_0x36052e){_0x36052e=_0x36052e||0xc8;return function(_0x102aa9){if(_0x102aa9){return _0x20736c[_0xe0bb('0x22')](_0x36052e)[_0xe0bb('0x24')](_0x102aa9);}};}function respondWithFilteredResult(_0x384a5d,_0x2a30cf){return function(_0x267539){if(_0x267539){var _0x21ac55=typeof _0x2a30cf[_0xe0bb('0x25')]===_0xe0bb('0x26')&&typeof _0x2a30cf[_0xe0bb('0x27')]==='undefined';var _0x29d289=_0x267539[_0xe0bb('0x28')];var _0x4d7bb9=_0x21ac55?0x0:_0x2a30cf['offset'];var _0xffbc02=_0x21ac55?_0x267539['count']:_0x2a30cf[_0xe0bb('0x25')]+_0x2a30cf[_0xe0bb('0x27')];var _0x4c9871;if(_0xffbc02>=_0x29d289){_0xffbc02=_0x29d289;_0x4c9871=0xc8;}else{_0x4c9871=0xce;}_0x384a5d['status'](_0x4c9871);return _0x384a5d[_0xe0bb('0x29')](_0xe0bb('0x2a'),_0x4d7bb9+'-'+_0xffbc02+'/'+_0x29d289)[_0xe0bb('0x24')](_0x267539);}return null;};}function patchUpdates(_0x220ae4){return function(_0x47fb81){try{jsonpatch[_0xe0bb('0x2b')](_0x47fb81,_0x220ae4,!![]);}catch(_0x3a359a){return BPromise['reject'](_0x3a359a);}return _0x47fb81[_0xe0bb('0x2c')]();};}function saveUpdates(_0x5c074c,_0x11fe8b){return function(_0x3295a0){if(_0x3295a0){return _0x3295a0['update'](_0x5c074c)[_0xe0bb('0x2d')](function(_0x4a2c2f){return _0x4a2c2f;});}return null;};}function removeEntity(_0x2e1b63,_0x5025a2){return function(_0x5d6a6){if(_0x5d6a6){return _0x5d6a6[_0xe0bb('0x2e')]()[_0xe0bb('0x2d')](function(){var _0x268c1d=_0x5d6a6[_0xe0bb('0x2f')]({'plain':!![]});var _0x5e40ed=_0xe0bb('0x30');return db['UserProfileResource']['destroy']({'where':{'type':_0x5e40ed,'resourceId':_0x268c1d['id']}})[_0xe0bb('0x2d')](function(){return _0x5d6a6;});})[_0xe0bb('0x2d')](function(){_0x2e1b63[_0xe0bb('0x22')](0xcc)[_0xe0bb('0x23')]();});}};}function handleEntityNotFound(_0x321743,_0x5632b9){return function(_0x4167e3){if(!_0x4167e3){_0x321743['sendStatus'](0x194);}return _0x4167e3;};}function handleError(_0x2e48fe,_0x196a4b){_0x196a4b=_0x196a4b||0x1f4;return function(_0x2e00b7){logger[_0xe0bb('0x31')](_0x2e00b7['stack']);if(_0x2e00b7[_0xe0bb('0x32')]){delete _0x2e00b7[_0xe0bb('0x32')];}_0x2e48fe['status'](_0x196a4b)['send'](_0x2e00b7);};}exports[_0xe0bb('0x33')]=function(_0x3b3f8b,_0x23f434){var _0x2e88d4={},_0x51e7d7={},_0x520932={'count':0x0,'rows':[]};var _0x33aa7e=_[_0xe0bb('0x34')](db[_0xe0bb('0x35')][_0xe0bb('0x36')],function(_0x1e7ab9){return{'name':_0x1e7ab9[_0xe0bb('0x37')],'type':_0x1e7ab9['type']['key']};});_0x51e7d7['model']=_['map'](_0x33aa7e,_0xe0bb('0x32'));_0x51e7d7[_0xe0bb('0x38')]=_[_0xe0bb('0x39')](_0x3b3f8b['query']);_0x51e7d7[_0xe0bb('0x3a')]=_[_0xe0bb('0x3b')](_0x51e7d7[_0xe0bb('0x3c')],_0x51e7d7[_0xe0bb('0x38')]);_0x2e88d4[_0xe0bb('0x3d')]=_[_0xe0bb('0x3b')](_0x51e7d7[_0xe0bb('0x3c')],qs['fields'](_0x3b3f8b[_0xe0bb('0x38')][_0xe0bb('0x3e')]));_0x2e88d4[_0xe0bb('0x3d')]=_0x2e88d4[_0xe0bb('0x3d')][_0xe0bb('0x3f')]?_0x2e88d4[_0xe0bb('0x3d')]:_0x51e7d7[_0xe0bb('0x3c')];if(!_0x3b3f8b[_0xe0bb('0x38')][_0xe0bb('0x40')](_0xe0bb('0x41'))){_0x2e88d4[_0xe0bb('0x27')]=qs[_0xe0bb('0x27')](_0x3b3f8b['query']['limit']);_0x2e88d4['offset']=qs[_0xe0bb('0x25')](_0x3b3f8b[_0xe0bb('0x38')]['offset']);}_0x2e88d4[_0xe0bb('0x42')]=qs['sort'](_0x3b3f8b[_0xe0bb('0x38')]['sort']);_0x2e88d4[_0xe0bb('0x43')]=qs[_0xe0bb('0x3a')](_['pick'](_0x3b3f8b[_0xe0bb('0x38')],_0x51e7d7[_0xe0bb('0x3a')]),_0x33aa7e);if(_0x3b3f8b['query'][_0xe0bb('0x44')]){_0x2e88d4[_0xe0bb('0x43')]=_[_0xe0bb('0x45')](_0x2e88d4[_0xe0bb('0x43')],{'$or':_[_0xe0bb('0x34')](_0x33aa7e,function(_0x3ecbaa){if(_0x3ecbaa[_0xe0bb('0x46')]!==_0xe0bb('0x47')){var _0x67d6be={};_0x67d6be[_0x3ecbaa[_0xe0bb('0x32')]]={'$like':'%'+_0x3b3f8b[_0xe0bb('0x38')]['filter']+'%'};return _0x67d6be;}})});}_0x2e88d4=_[_0xe0bb('0x45')]({},_0x2e88d4,_0x3b3f8b['options']);var _0x510054={'where':_0x2e88d4[_0xe0bb('0x43')]};return db['FaxQueue'][_0xe0bb('0x28')](_0x510054)[_0xe0bb('0x2d')](function(_0x3fdae5){_0x520932[_0xe0bb('0x28')]=_0x3fdae5;if(_0x3b3f8b['query']['includeAll']){_0x2e88d4[_0xe0bb('0x48')]=[{'all':!![]}];}return db['FaxQueue'][_0xe0bb('0x49')](_0x2e88d4);})[_0xe0bb('0x2d')](function(_0x4996f6){_0x520932[_0xe0bb('0x4a')]=_0x4996f6;return _0x520932;})[_0xe0bb('0x2d')](respondWithFilteredResult(_0x23f434,_0x2e88d4))[_0xe0bb('0x4b')](handleError(_0x23f434,null));};exports[_0xe0bb('0x4c')]=function(_0xa34429,_0x2e3a86){var _0x3e62ca={'raw':!![],'where':{'id':_0xa34429['params']['id']}},_0x2df0ba={};_0x2df0ba[_0xe0bb('0x3c')]=_[_0xe0bb('0x39')](db['FaxQueue'][_0xe0bb('0x36')]);_0x2df0ba[_0xe0bb('0x38')]=_['keys'](_0xa34429[_0xe0bb('0x38')]);_0x2df0ba[_0xe0bb('0x3a')]=_['intersection'](_0x2df0ba[_0xe0bb('0x3c')],_0x2df0ba[_0xe0bb('0x38')]);_0x3e62ca[_0xe0bb('0x3d')]=_[_0xe0bb('0x3b')](_0x2df0ba['model'],qs['fields'](_0xa34429['query'][_0xe0bb('0x3e')]));_0x3e62ca['attributes']=_0x3e62ca[_0xe0bb('0x3d')][_0xe0bb('0x3f')]?_0x3e62ca['attributes']:_0x2df0ba[_0xe0bb('0x3c')];if(_0xa34429[_0xe0bb('0x38')][_0xe0bb('0x4d')]){_0x3e62ca[_0xe0bb('0x48')]=[{'all':!![]}];}_0x3e62ca=_[_0xe0bb('0x45')]({},_0x3e62ca,_0xa34429[_0xe0bb('0x4e')]);return db[_0xe0bb('0x35')][_0xe0bb('0x4f')](_0x3e62ca)[_0xe0bb('0x2d')](handleEntityNotFound(_0x2e3a86,null))[_0xe0bb('0x2d')](respondWithResult(_0x2e3a86,null))['catch'](handleError(_0x2e3a86,null));};exports[_0xe0bb('0x50')]=function(_0x1f2fc9,_0x3e3ad7){return db[_0xe0bb('0x35')][_0xe0bb('0x50')](_0x1f2fc9[_0xe0bb('0x51')],{})[_0xe0bb('0x2d')](function(_0x1148c0){var _0x536f55=_0x1f2fc9[_0xe0bb('0x52')]['get']({'plain':!![]});if(!_0x536f55)throw new Error(_0xe0bb('0x53'));if(_0x536f55['role']==='user'){var _0x156681=_0x1148c0[_0xe0bb('0x2f')]({'plain':!![]});var _0x56858b=_0xe0bb('0x30');return db['UserProfileSection']['find']({'where':{'name':_0x56858b,'userProfileId':_0x536f55[_0xe0bb('0x54')]},'raw':!![]})[_0xe0bb('0x2d')](function(_0x5752a6){if(_0x5752a6&&_0x5752a6[_0xe0bb('0x55')]===0x0){return db[_0xe0bb('0x56')][_0xe0bb('0x50')]({'name':_0x156681[_0xe0bb('0x32')],'resourceId':_0x156681['id'],'type':_0x5752a6['name'],'sectionId':_0x5752a6['id']},{})[_0xe0bb('0x2d')](function(){return _0x1148c0;});}else{return _0x1148c0;}})[_0xe0bb('0x4b')](function(_0x3ecba1){logger[_0xe0bb('0x31')](_0xe0bb('0x57'),_0x3ecba1);throw _0x3ecba1;});}return _0x1148c0;})[_0xe0bb('0x2d')](respondWithResult(_0x3e3ad7,0xc9))[_0xe0bb('0x4b')](handleError(_0x3e3ad7,null));};exports['update']=function(_0x154028,_0x32585a){if(_0x154028[_0xe0bb('0x51')]['id']){delete _0x154028[_0xe0bb('0x51')]['id'];}return db['FaxQueue'][_0xe0bb('0x4f')]({'where':{'id':_0x154028['params']['id']}})[_0xe0bb('0x2d')](handleEntityNotFound(_0x32585a,null))[_0xe0bb('0x2d')](saveUpdates(_0x154028[_0xe0bb('0x51')],null))[_0xe0bb('0x2d')](respondWithResult(_0x32585a,null))[_0xe0bb('0x4b')](handleError(_0x32585a,null));};exports['destroy']=function(_0x16aeee,_0x2015ac){return db[_0xe0bb('0x35')][_0xe0bb('0x4f')]({'where':{'id':_0x16aeee['params']['id']}})[_0xe0bb('0x2d')](handleEntityNotFound(_0x2015ac,null))[_0xe0bb('0x2d')](removeEntity(_0x2015ac,null))[_0xe0bb('0x4b')](handleError(_0x2015ac,null));};exports['describe']=function(_0x312386,_0x4e8696){return db[_0xe0bb('0x35')][_0xe0bb('0x58')]()['then'](respondWithResult(_0x4e8696,null))[_0xe0bb('0x4b')](handleError(_0x4e8696,null));};exports[_0xe0bb('0x59')]=function(_0x53445c,_0x52d9dd,_0x174873){var _0x23697={'raw':!![],'where':{}},_0x12caee={},_0x274ab9;return db[_0xe0bb('0x35')][_0xe0bb('0x5a')]({'where':{'id':_0x53445c['params']['id']}})['then'](handleEntityNotFound(_0x52d9dd,null))[_0xe0bb('0x2d')](function(_0x4017d9){if(_0x4017d9){_0x274ab9=_0x4017d9['get']({'plain':!![]});_0x12caee[_0xe0bb('0x3c')]=_[_0xe0bb('0x39')](db[_0xe0bb('0x5b')][_0xe0bb('0x36')]);_0x12caee['query']=_['keys'](_0x53445c[_0xe0bb('0x38')]);_0x12caee[_0xe0bb('0x3a')]=_[_0xe0bb('0x3b')](_0x12caee[_0xe0bb('0x3c')],_0x12caee[_0xe0bb('0x38')]);_0x23697[_0xe0bb('0x3d')]=_[_0xe0bb('0x3b')](_0x12caee[_0xe0bb('0x3c')],qs[_0xe0bb('0x3e')](_0x53445c[_0xe0bb('0x38')]['fields']));_0x23697[_0xe0bb('0x3d')]=_0x23697[_0xe0bb('0x3d')][_0xe0bb('0x3f')]?_0x23697[_0xe0bb('0x3d')]:_0x12caee[_0xe0bb('0x3c')];if(!_0x53445c['query'][_0xe0bb('0x40')](_0xe0bb('0x41'))){_0x23697[_0xe0bb('0x27')]=qs[_0xe0bb('0x27')](_0x53445c[_0xe0bb('0x38')]['limit']);_0x23697[_0xe0bb('0x25')]=qs['offset'](_0x53445c[_0xe0bb('0x38')][_0xe0bb('0x25')]);}_0x23697[_0xe0bb('0x42')]=qs[_0xe0bb('0x5c')](_0x53445c['query'][_0xe0bb('0x5c')]);_0x23697['where']=qs[_0xe0bb('0x3a')](_[_0xe0bb('0x5d')](_0x53445c[_0xe0bb('0x38')],_0x12caee[_0xe0bb('0x3a')]));_0x23697[_0xe0bb('0x43')][_0xe0bb('0x5e')]=_0x4017d9['id'];if(_0x53445c[_0xe0bb('0x38')][_0xe0bb('0x44')]){_0x23697['where']=_[_0xe0bb('0x45')](_0x23697[_0xe0bb('0x43')],{'$or':_[_0xe0bb('0x34')](_0x23697['attributes'],function(_0xaa02cd){var _0xf1f219={};_0xf1f219[_0xaa02cd]={'$like':'%'+_0x53445c[_0xe0bb('0x38')][_0xe0bb('0x44')]+'%'};return _0xf1f219;})});}_0x23697=_['merge']({},_0x23697,_0x53445c[_0xe0bb('0x4e')]);return db[_0xe0bb('0x5b')][_0xe0bb('0x49')](_0x23697);}})[_0xe0bb('0x2d')](function(_0x27b900){if(_0x27b900){return db['User'][_0xe0bb('0x5f')]({'where':{'id':_[_0xe0bb('0x34')](_0x27b900,_0xe0bb('0x60')),'role':_0xe0bb('0x61')},'attributes':['id',_0xe0bb('0x32'),'faxPause',_0xe0bb('0x62'),_0xe0bb('0x63')]});}})[_0xe0bb('0x2d')](function(_0x8417ae){if(_0x8417ae){return{'count':_0x8417ae[_0xe0bb('0x28')],'rows':_['map'](_0x8417ae[_0xe0bb('0x4a')],function(_0x148f82){return{'membername':_0x148f82['name'],'UserId':_0x148f82['id'],'queue_name':_0x274ab9['name'],'FaxQueueId':_0x274ab9['id'],'interface':util[_0xe0bb('0x64')](_0xe0bb('0x65'),_0xe0bb('0x66'),_0x148f82['name']),'penalty':0x0,'paused':_0x148f82[_0xe0bb('0x67')],'createdAt':_0x148f82[_0xe0bb('0x63')],'updatedAt':_0x148f82[_0xe0bb('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x52d9dd,_0x23697))[_0xe0bb('0x4b')](handleError(_0x52d9dd,null));};exports['getTeams']=function(_0x3b6193,_0x581800,_0x4cef00){var _0x4dcea1={};var _0x2edaf4={};var _0x4e0841;var _0x8cb8f7;return db[_0xe0bb('0x35')][_0xe0bb('0x5a')]({'where':{'id':_0x3b6193[_0xe0bb('0x68')]['id']}})[_0xe0bb('0x2d')](handleEntityNotFound(_0x581800,null))['then'](function(_0x5cd015){if(_0x5cd015){_0x4e0841=_0x5cd015;_0x2edaf4[_0xe0bb('0x3c')]=_[_0xe0bb('0x39')](db['Team'][_0xe0bb('0x36')]);_0x2edaf4[_0xe0bb('0x38')]=_[_0xe0bb('0x39')](_0x3b6193['query']);_0x2edaf4[_0xe0bb('0x3a')]=_[_0xe0bb('0x3b')](_0x2edaf4[_0xe0bb('0x3c')],_0x2edaf4[_0xe0bb('0x38')]);_0x4dcea1[_0xe0bb('0x3d')]=_[_0xe0bb('0x3b')](_0x2edaf4[_0xe0bb('0x3c')],qs[_0xe0bb('0x3e')](_0x3b6193[_0xe0bb('0x38')]['fields']));_0x4dcea1[_0xe0bb('0x3d')]=_0x4dcea1['attributes'][_0xe0bb('0x3f')]?_0x4dcea1[_0xe0bb('0x3d')]:_0x2edaf4[_0xe0bb('0x3c')];_0x4dcea1[_0xe0bb('0x42')]=qs[_0xe0bb('0x5c')](_0x3b6193[_0xe0bb('0x38')]['sort']);_0x4dcea1[_0xe0bb('0x43')]=qs[_0xe0bb('0x3a')](_['pick'](_0x3b6193[_0xe0bb('0x38')],_0x2edaf4['filters']));if(_0x3b6193[_0xe0bb('0x38')][_0xe0bb('0x44')]){_0x4dcea1[_0xe0bb('0x43')]=_['merge'](_0x4dcea1[_0xe0bb('0x43')],{'$or':_[_0xe0bb('0x34')](_0x4dcea1[_0xe0bb('0x3d')],function(_0x4461d0){var _0x21f052={};_0x21f052[_0x4461d0]={'$like':'%'+_0x3b6193[_0xe0bb('0x38')]['filter']+'%'};return _0x21f052;})});}_0x4dcea1=_['merge']({},_0x4dcea1,_0x3b6193['options']);return _0x4e0841[_0xe0bb('0x69')](_0x4dcea1);}})[_0xe0bb('0x2d')](function(_0x483fd3){if(_0x483fd3){_0x8cb8f7=_0x483fd3[_0xe0bb('0x3f')];if(!_0x3b6193[_0xe0bb('0x38')]['hasOwnProperty'](_0xe0bb('0x41'))){_0x4dcea1[_0xe0bb('0x27')]=qs[_0xe0bb('0x27')](_0x3b6193[_0xe0bb('0x38')][_0xe0bb('0x27')]);_0x4dcea1['offset']=qs[_0xe0bb('0x25')](_0x3b6193[_0xe0bb('0x38')][_0xe0bb('0x25')]);}return _0x4e0841[_0xe0bb('0x69')](_0x4dcea1);}})['then'](function(_0x2bd575){if(_0x2bd575){return _0x2bd575?{'count':_0x8cb8f7,'rows':_0x2bd575}:null;}})[_0xe0bb('0x2d')](respondWithResult(_0x581800,null))[_0xe0bb('0x4b')](handleError(_0x581800,null));};exports[_0xe0bb('0x6a')]=function(_0x374442,_0x115d38,_0x18b63b){var _0x9b029b=_0x374442['body'][_0xe0bb('0x6b')];return db[_0xe0bb('0x6c')][_0xe0bb('0x49')]({'where':{'id':_0x9b029b},'attributes':['id'],'include':[{'model':db[_0xe0bb('0x6d')],'as':'Agents','attributes':['id','name','online',_0xe0bb('0x6e'),'interface'],'raw':!![]}]})[_0xe0bb('0x2d')](function(_0x18ed1d){if(_0x18ed1d){var _0x4b475d=_['flatMap'](_0x18ed1d,function(_0x41f3dd){var _0x26487c=_0x41f3dd['get']({'plain':!![]});return _0x26487c[_0xe0bb('0x6f')];});return db['FaxQueue']['find']({'where':{'id':_0x374442[_0xe0bb('0x68')]['id']}})[_0xe0bb('0x2d')](function(_0x388bdc){return db[_0xe0bb('0x70')][_0xe0bb('0x71')](function(_0x546e64){return _0x388bdc[_0xe0bb('0x6a')](_0x9b029b,{'transaction':_0x546e64})[_0xe0bb('0x2d')](function(){return BPromise['each'](_0x4b475d,function(_0x75958c){return db[_0xe0bb('0x5b')][_0xe0bb('0x72')]({'where':{'UserId':_0x75958c['id'],'FaxQueueId':_0x374442['params']['id']},'transaction':_0x546e64});});})[_0xe0bb('0x2d')](function(){_0x4b475d[_0xe0bb('0x73')](function(_0x18a697){socket['emit'](_0xe0bb('0x74'),{'UserId':_0x18a697['id'],'FaxQueueId':_0x388bdc['id']});});});});});}})['then'](respondWithStatusCode(_0x115d38,null))[_0xe0bb('0x4b')](handleError(_0x115d38,null));};exports[_0xe0bb('0x75')]=function(_0x4f0416,_0x5b380c,_0x24c19c){return db[_0xe0bb('0x6c')]['findAll']({'where':{'id':_0x4f0416['query'][_0xe0bb('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xe0bb('0x6d')],'as':_0xe0bb('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5b380c,null))[_0xe0bb('0x2d')](function(_0x3fb868){var _0x316d72=_['map'](_0x3fb868,'id');var _0x511627=[];var _0x249bb8=[];var _0x199d63=squel['select']();_0x199d63[_0xe0bb('0x76')]('tq.TeamId')[_0xe0bb('0x77')](_0xe0bb('0x78'),'tq')[_0xe0bb('0x79')](_0xe0bb('0x7a'),'ut',_0xe0bb('0x7b'))[_0xe0bb('0x43')](_0xe0bb('0x7c'),_0x4f0416[_0xe0bb('0x68')]['id']);for(var _0x255452=0x0;_0x255452<_0x3fb868[_0xe0bb('0x3f')];_0x255452+=0x1){let _0x146237=_0x3fb868[_0x255452];for(var _0x37e1b8=0x0;_0x37e1b8<_0x146237[_0xe0bb('0x6f')][_0xe0bb('0x3f')];_0x37e1b8+=0x1){let _0xb28283=_0x146237[_0xe0bb('0x6f')][_0x37e1b8];var _0x230529=_0x199d63[_0xe0bb('0x7d')]();_0x230529[_0xe0bb('0x43')](_0xe0bb('0x7e'),_0xb28283['id']);_0x249bb8[_0xe0bb('0x7f')](db[_0xe0bb('0x70')][_0xe0bb('0x38')](_0x230529[_0xe0bb('0x80')](),{'type':db[_0xe0bb('0x70')]['QueryTypes'][_0xe0bb('0x81')]})['then'](function(_0x12f23a){if(_0x12f23a['length']===0x1){return _0xb28283['id'];}else{var _0x4f10e3=_[_0xe0bb('0x82')](_[_0xe0bb('0x34')](_0x12f23a,'TeamId'),function(_0x129d51){return _[_0xe0bb('0x83')](_0x316d72,_0x129d51);});if(_0x4f10e3){return _0xb28283['id'];}}}));}}return BPromise[_0xe0bb('0x84')](_0x249bb8)[_0xe0bb('0x2d')](function(_0x1195d4){_0x511627=_(_0x511627)['union'](_0x1195d4)[_0xe0bb('0x85')]()[_0xe0bb('0x86')]();return db['FaxQueue'][_0xe0bb('0x4f')]({'where':{'id':_0x4f0416[_0xe0bb('0x68')]['id']}})['then'](function(_0x29e620){return db[_0xe0bb('0x70')][_0xe0bb('0x71')](function(_0x430764){return _0x29e620['removeTeams'](_0x4f0416[_0xe0bb('0x38')][_0xe0bb('0x6b')],{'transaction':_0x430764})[_0xe0bb('0x2d')](function(){if(!_[_0xe0bb('0x87')](_0x511627)){return _0x29e620[_0xe0bb('0x88')](_0x511627,{'transaction':_0x430764});}})[_0xe0bb('0x2d')](function(){_0x511627['forEach'](function(_0x2fec3f){socket[_0xe0bb('0x89')](_0xe0bb('0x8a'),{'UserId':_0x2fec3f,'FaxQueueId':_0x29e620['id']});});});});});});})[_0xe0bb('0x2d')](respondWithStatusCode(_0x5b380c,null))['catch'](handleError(_0x5b380c,null));};exports[_0xe0bb('0x8b')]=function(_0x540874,_0x536207,_0x1c598f){return db[_0xe0bb('0x35')][_0xe0bb('0x4f')]({'where':{'id':_0x540874[_0xe0bb('0x68')]['id']}})[_0xe0bb('0x2d')](handleEntityNotFound(_0x536207,null))[_0xe0bb('0x2d')](function(_0x5ce9e4){if(_0x5ce9e4){return _0x5ce9e4[_0xe0bb('0x8b')](_0x540874[_0xe0bb('0x51')][_0xe0bb('0x6b')],_[_0xe0bb('0x8c')](_0x540874['body'],[_0xe0bb('0x6b'),'id'])||{})[_0xe0bb('0x8d')](function(_0x22c482){for(var _0x426b6f=0x0;_0x426b6f<_0x540874[_0xe0bb('0x51')][_0xe0bb('0x6b')][_0xe0bb('0x3f')];_0x426b6f+=0x1){socket[_0xe0bb('0x89')](_0xe0bb('0x74'),{'UserId':Number(_0x540874[_0xe0bb('0x51')]['ids'][_0x426b6f]),'FaxQueueId':Number(_0x540874[_0xe0bb('0x68')]['id'])});}return _0x22c482;});}})[_0xe0bb('0x2d')](respondWithResult(_0x536207,null))[_0xe0bb('0x4b')](handleError(_0x536207,null));};exports[_0xe0bb('0x88')]=function(_0x3ca014,_0x36a053,_0x4255b4){return db[_0xe0bb('0x35')][_0xe0bb('0x4f')]({'where':{'id':_0x3ca014[_0xe0bb('0x68')]['id']}})[_0xe0bb('0x2d')](handleEntityNotFound(_0x36a053,null))[_0xe0bb('0x2d')](function(_0x9d5882){if(_0x9d5882){return _0x9d5882['removeAgents'](_0x3ca014[_0xe0bb('0x38')][_0xe0bb('0x6b')])[_0xe0bb('0x2d')](function(){if(_[_0xe0bb('0x8e')](_0x3ca014[_0xe0bb('0x38')]['ids'])){for(var _0x399076=0x0;_0x399076<_0x3ca014[_0xe0bb('0x38')]['ids']['length'];_0x399076+=0x1){socket[_0xe0bb('0x89')](_0xe0bb('0x8a'),{'UserId':Number(_0x3ca014[_0xe0bb('0x38')][_0xe0bb('0x6b')][_0x399076]),'FaxQueueId':Number(_0x3ca014[_0xe0bb('0x68')]['id'])});}}else{socket[_0xe0bb('0x89')]('userFaxQueue:remove',{'UserId':Number(_0x3ca014[_0xe0bb('0x38')][_0xe0bb('0x6b')]),'FaxQueueId':Number(_0x3ca014[_0xe0bb('0x68')]['id'])});}});}})[_0xe0bb('0x2d')](respondWithStatusCode(_0x36a053,null))[_0xe0bb('0x4b')](handleError(_0x36a053,null));};exports[_0xe0bb('0x8f')]=function(_0x4a1f90,_0x40ff8b,_0x4a1759){var _0x1699db={};var _0x4bf10d={};var _0x1eb4c2;var _0x2f7967;return db[_0xe0bb('0x35')]['findOne']({'where':{'id':_0x4a1f90[_0xe0bb('0x68')]['id']}})[_0xe0bb('0x2d')](handleEntityNotFound(_0x40ff8b,null))[_0xe0bb('0x2d')](function(_0x1d2d23){if(_0x1d2d23){_0x1eb4c2=_0x1d2d23;_0x4bf10d[_0xe0bb('0x3c')]=_['keys'](db[_0xe0bb('0x6d')][_0xe0bb('0x36')]);_0x4bf10d[_0xe0bb('0x38')]=_['keys'](_0x4a1f90[_0xe0bb('0x38')]);_0x4bf10d['filters']=_[_0xe0bb('0x3b')](_0x4bf10d[_0xe0bb('0x3c')],_0x4bf10d[_0xe0bb('0x38')]);_0x1699db[_0xe0bb('0x3d')]=_[_0xe0bb('0x3b')](_0x4bf10d[_0xe0bb('0x3c')],qs['fields'](_0x4a1f90[_0xe0bb('0x38')][_0xe0bb('0x3e')]));_0x1699db[_0xe0bb('0x3d')]=_0x1699db['attributes'][_0xe0bb('0x3f')]?_0x1699db['attributes']:_0x4bf10d[_0xe0bb('0x3c')];_0x1699db['order']=qs[_0xe0bb('0x5c')](_0x4a1f90[_0xe0bb('0x38')][_0xe0bb('0x5c')]);_0x1699db[_0xe0bb('0x43')]=qs[_0xe0bb('0x3a')](_[_0xe0bb('0x5d')](_0x4a1f90[_0xe0bb('0x38')],_0x4bf10d[_0xe0bb('0x3a')]));if(_0x4a1f90[_0xe0bb('0x38')][_0xe0bb('0x44')]){_0x1699db[_0xe0bb('0x43')]=_[_0xe0bb('0x45')](_0x1699db[_0xe0bb('0x43')],{'$or':_[_0xe0bb('0x34')](_0x1699db[_0xe0bb('0x3d')],function(_0x32ee3e){var _0x563f8c={};_0x563f8c[_0x32ee3e]={'$like':'%'+_0x4a1f90[_0xe0bb('0x38')][_0xe0bb('0x44')]+'%'};return _0x563f8c;})});}_0x1699db=_['merge']({},_0x1699db,_0x4a1f90[_0xe0bb('0x4e')]);return _0x1eb4c2[_0xe0bb('0x8f')](_0x1699db);}})[_0xe0bb('0x2d')](function(_0x319000){if(_0x319000){_0x2f7967=_0x319000[_0xe0bb('0x3f')];if(!_0x4a1f90['query'][_0xe0bb('0x40')](_0xe0bb('0x41'))){_0x1699db[_0xe0bb('0x27')]=qs[_0xe0bb('0x27')](_0x4a1f90[_0xe0bb('0x38')]['limit']);_0x1699db[_0xe0bb('0x25')]=qs[_0xe0bb('0x25')](_0x4a1f90[_0xe0bb('0x38')][_0xe0bb('0x25')]);}return _0x1eb4c2[_0xe0bb('0x8f')](_0x1699db);}})[_0xe0bb('0x2d')](function(_0x56617b){if(_0x56617b){return _0x56617b?{'count':_0x2f7967,'rows':_0x56617b}:null;}})['then'](respondWithResult(_0x40ff8b,null))[_0xe0bb('0x4b')](handleError(_0x40ff8b,null));}; \ No newline at end of file +var _0xd411=['status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','map','FaxQueue','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','UserId','agent','faxPause','updatedAt','createdAt','format','getTeams','hasOwnProperty','addTeams','ids','User','Agents','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','from','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','userFaxQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd411,0xfa));var _0x1d41=function(_0x5bf1ec,_0x1709bd){_0x5bf1ec=_0x5bf1ec-0x0;var _0x35a0c3=_0xd411[_0x5bf1ec];return _0x35a0c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1d41('0x0'));var zipdir=require(_0x1d41('0x1'));var jsonpatch=require(_0x1d41('0x2'));var rp=require(_0x1d41('0x3'));var moment=require(_0x1d41('0x4'));var BPromise=require(_0x1d41('0x5'));var Mustache=require(_0x1d41('0x6'));var util=require(_0x1d41('0x7'));var path=require(_0x1d41('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1d41('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d41('0xa'));var squel=require(_0x1d41('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1d41('0xc'));var querystring=require(_0x1d41('0xd'));var Papa=require(_0x1d41('0xe'));var Redis=require('ioredis');var authService=require(_0x1d41('0xf'));var qs=require(_0x1d41('0x10'));var as=require(_0x1d41('0x11'));var hardwareService=require(_0x1d41('0x12'));var logger=require(_0x1d41('0x13'))(_0x1d41('0x14'));var utils=require(_0x1d41('0x15'));var config=require(_0x1d41('0x16'));var licenseUtil=require(_0x1d41('0x17'));var db=require(_0x1d41('0x18'))['db'];config['redis']=_[_0x1d41('0x19')](config[_0x1d41('0x1a')],{'host':_0x1d41('0x1b'),'port':0x18eb});var socket=require(_0x1d41('0x1c'))(new Redis(config[_0x1d41('0x1a')]));require(_0x1d41('0x1d'))[_0x1d41('0x1e')](socket);function respondWithStatusCode(_0x56f2d1,_0x5100ca){_0x5100ca=_0x5100ca||0xcc;return function(_0xbad6db){if(_0xbad6db){return _0x56f2d1[_0x1d41('0x1f')](_0x5100ca);}return _0x56f2d1[_0x1d41('0x20')](_0x5100ca)[_0x1d41('0x21')]();};}function respondWithResult(_0x38ce6c,_0x20af0c){_0x20af0c=_0x20af0c||0xc8;return function(_0xb83159){if(_0xb83159){return _0x38ce6c[_0x1d41('0x20')](_0x20af0c)[_0x1d41('0x22')](_0xb83159);}};}function respondWithFilteredResult(_0x206e56,_0x27fae2){return function(_0x850070){if(_0x850070){var _0x4bbc61=typeof _0x27fae2[_0x1d41('0x23')]==='undefined'&&typeof _0x27fae2[_0x1d41('0x24')]===_0x1d41('0x25');var _0x2a3ded=_0x850070['count'];var _0x38aac5=_0x4bbc61?0x0:_0x27fae2[_0x1d41('0x23')];var _0x5c3962=_0x4bbc61?_0x850070[_0x1d41('0x26')]:_0x27fae2[_0x1d41('0x23')]+_0x27fae2[_0x1d41('0x24')];var _0x36c336;if(_0x5c3962>=_0x2a3ded){_0x5c3962=_0x2a3ded;_0x36c336=0xc8;}else{_0x36c336=0xce;}_0x206e56[_0x1d41('0x20')](_0x36c336);return _0x206e56['set'](_0x1d41('0x27'),_0x38aac5+'-'+_0x5c3962+'/'+_0x2a3ded)['json'](_0x850070);}return null;};}function patchUpdates(_0x355912){return function(_0x4e9944){try{jsonpatch[_0x1d41('0x28')](_0x4e9944,_0x355912,!![]);}catch(_0x2a5253){return BPromise[_0x1d41('0x29')](_0x2a5253);}return _0x4e9944[_0x1d41('0x2a')]();};}function saveUpdates(_0x2cf913,_0x32cbdb){return function(_0x3b659b){if(_0x3b659b){return _0x3b659b[_0x1d41('0x2b')](_0x2cf913)[_0x1d41('0x2c')](function(_0x13af44){return _0x13af44;});}return null;};}function removeEntity(_0x5d3857,_0x21e553){return function(_0x307dcb){if(_0x307dcb){return _0x307dcb['destroy']()[_0x1d41('0x2c')](function(){var _0x2de898=_0x307dcb[_0x1d41('0x2d')]({'plain':!![]});var _0x5b24f7='FaxQueues';return db[_0x1d41('0x2e')][_0x1d41('0x2f')]({'where':{'type':_0x5b24f7,'resourceId':_0x2de898['id']}})['then'](function(){return _0x307dcb;});})['then'](function(){_0x5d3857[_0x1d41('0x20')](0xcc)[_0x1d41('0x21')]();});}};}function handleEntityNotFound(_0x3470e2,_0x3b251c){return function(_0x59760e){if(!_0x59760e){_0x3470e2[_0x1d41('0x1f')](0x194);}return _0x59760e;};}function handleError(_0x3da08f,_0x1cf45d){_0x1cf45d=_0x1cf45d||0x1f4;return function(_0x1be7ef){logger[_0x1d41('0x30')](_0x1be7ef[_0x1d41('0x31')]);if(_0x1be7ef[_0x1d41('0x32')]){delete _0x1be7ef[_0x1d41('0x32')];}_0x3da08f[_0x1d41('0x20')](_0x1cf45d)[_0x1d41('0x33')](_0x1be7ef);};}exports['index']=function(_0x2d0c51,_0x326993){var _0xa2d78={},_0x5b784d={},_0x46e815={'count':0x0,'rows':[]};var _0x3ebc13=_[_0x1d41('0x34')](db[_0x1d41('0x35')]['rawAttributes'],function(_0x5dc27b){return{'name':_0x5dc27b['fieldName'],'type':_0x5dc27b['type'][_0x1d41('0x36')]};});_0x5b784d[_0x1d41('0x37')]=_[_0x1d41('0x34')](_0x3ebc13,'name');_0x5b784d['query']=_[_0x1d41('0x38')](_0x2d0c51[_0x1d41('0x39')]);_0x5b784d[_0x1d41('0x3a')]=_[_0x1d41('0x3b')](_0x5b784d[_0x1d41('0x37')],_0x5b784d[_0x1d41('0x39')]);_0xa2d78[_0x1d41('0x3c')]=_['intersection'](_0x5b784d[_0x1d41('0x37')],qs[_0x1d41('0x3d')](_0x2d0c51[_0x1d41('0x39')]['fields']));_0xa2d78[_0x1d41('0x3c')]=_0xa2d78[_0x1d41('0x3c')][_0x1d41('0x3e')]?_0xa2d78[_0x1d41('0x3c')]:_0x5b784d[_0x1d41('0x37')];if(!_0x2d0c51['query']['hasOwnProperty'](_0x1d41('0x3f'))){_0xa2d78[_0x1d41('0x24')]=qs[_0x1d41('0x24')](_0x2d0c51[_0x1d41('0x39')]['limit']);_0xa2d78[_0x1d41('0x23')]=qs['offset'](_0x2d0c51[_0x1d41('0x39')]['offset']);}_0xa2d78[_0x1d41('0x40')]=qs[_0x1d41('0x41')](_0x2d0c51[_0x1d41('0x39')][_0x1d41('0x41')]);_0xa2d78['where']=qs[_0x1d41('0x3a')](_[_0x1d41('0x42')](_0x2d0c51[_0x1d41('0x39')],_0x5b784d['filters']),_0x3ebc13);if(_0x2d0c51[_0x1d41('0x39')][_0x1d41('0x43')]){_0xa2d78['where']=_[_0x1d41('0x44')](_0xa2d78[_0x1d41('0x45')],{'$or':_[_0x1d41('0x34')](_0x3ebc13,function(_0xcaeb73){if(_0xcaeb73[_0x1d41('0x46')]!==_0x1d41('0x47')){var _0x2a5d32={};_0x2a5d32[_0xcaeb73[_0x1d41('0x32')]]={'$like':'%'+_0x2d0c51[_0x1d41('0x39')][_0x1d41('0x43')]+'%'};return _0x2a5d32;}})});}_0xa2d78=_[_0x1d41('0x44')]({},_0xa2d78,_0x2d0c51[_0x1d41('0x48')]);var _0xd210a9={'where':_0xa2d78[_0x1d41('0x45')]};return db[_0x1d41('0x35')][_0x1d41('0x26')](_0xd210a9)[_0x1d41('0x2c')](function(_0x3e8b9e){_0x46e815[_0x1d41('0x26')]=_0x3e8b9e;if(_0x2d0c51[_0x1d41('0x39')]['includeAll']){_0xa2d78[_0x1d41('0x49')]=[{'all':!![]}];}return db[_0x1d41('0x35')][_0x1d41('0x4a')](_0xa2d78);})[_0x1d41('0x2c')](function(_0x546fc9){_0x46e815[_0x1d41('0x4b')]=_0x546fc9;return _0x46e815;})[_0x1d41('0x2c')](respondWithFilteredResult(_0x326993,_0xa2d78))[_0x1d41('0x4c')](handleError(_0x326993,null));};exports[_0x1d41('0x4d')]=function(_0x41863b,_0x1f5bf3){var _0x2a7872={'raw':!![],'where':{'id':_0x41863b[_0x1d41('0x4e')]['id']}},_0x22730b={};_0x22730b[_0x1d41('0x37')]=_[_0x1d41('0x38')](db[_0x1d41('0x35')][_0x1d41('0x4f')]);_0x22730b[_0x1d41('0x39')]=_['keys'](_0x41863b[_0x1d41('0x39')]);_0x22730b[_0x1d41('0x3a')]=_[_0x1d41('0x3b')](_0x22730b[_0x1d41('0x37')],_0x22730b['query']);_0x2a7872['attributes']=_['intersection'](_0x22730b[_0x1d41('0x37')],qs[_0x1d41('0x3d')](_0x41863b[_0x1d41('0x39')][_0x1d41('0x3d')]));_0x2a7872['attributes']=_0x2a7872[_0x1d41('0x3c')][_0x1d41('0x3e')]?_0x2a7872['attributes']:_0x22730b[_0x1d41('0x37')];if(_0x41863b[_0x1d41('0x39')][_0x1d41('0x50')]){_0x2a7872['include']=[{'all':!![]}];}_0x2a7872=_['merge']({},_0x2a7872,_0x41863b[_0x1d41('0x48')]);return db[_0x1d41('0x35')]['find'](_0x2a7872)[_0x1d41('0x2c')](handleEntityNotFound(_0x1f5bf3,null))[_0x1d41('0x2c')](respondWithResult(_0x1f5bf3,null))[_0x1d41('0x4c')](handleError(_0x1f5bf3,null));};exports['create']=function(_0x5ac894,_0x5e67c4){return db[_0x1d41('0x35')]['create'](_0x5ac894['body'],{})[_0x1d41('0x2c')](function(_0xe00cae){var _0xe7fc3f=_0x5ac894[_0x1d41('0x51')]['get']({'plain':!![]});if(!_0xe7fc3f)throw new Error(_0x1d41('0x52'));if(_0xe7fc3f[_0x1d41('0x53')]==='user'){var _0x3e0ad3=_0xe00cae['get']({'plain':!![]});var _0x8e5b01='FaxQueues';return db[_0x1d41('0x54')][_0x1d41('0x55')]({'where':{'name':_0x8e5b01,'userProfileId':_0xe7fc3f[_0x1d41('0x56')]},'raw':!![]})[_0x1d41('0x2c')](function(_0x574c3d){if(_0x574c3d&&_0x574c3d[_0x1d41('0x57')]===0x0){return db[_0x1d41('0x2e')][_0x1d41('0x58')]({'name':_0x3e0ad3[_0x1d41('0x32')],'resourceId':_0x3e0ad3['id'],'type':_0x574c3d[_0x1d41('0x32')],'sectionId':_0x574c3d['id']},{})[_0x1d41('0x2c')](function(){return _0xe00cae;});}else{return _0xe00cae;}})[_0x1d41('0x4c')](function(_0xcd9eca){logger[_0x1d41('0x30')](_0x1d41('0x59'),_0xcd9eca);throw _0xcd9eca;});}return _0xe00cae;})['then'](respondWithResult(_0x5e67c4,0xc9))[_0x1d41('0x4c')](handleError(_0x5e67c4,null));};exports['update']=function(_0x3830f8,_0x516074){if(_0x3830f8['body']['id']){delete _0x3830f8['body']['id'];}return db[_0x1d41('0x35')]['find']({'where':{'id':_0x3830f8['params']['id']}})['then'](handleEntityNotFound(_0x516074,null))[_0x1d41('0x2c')](saveUpdates(_0x3830f8[_0x1d41('0x5a')],null))[_0x1d41('0x2c')](respondWithResult(_0x516074,null))[_0x1d41('0x4c')](handleError(_0x516074,null));};exports[_0x1d41('0x2f')]=function(_0x3ed308,_0xf87906){return db[_0x1d41('0x35')][_0x1d41('0x55')]({'where':{'id':_0x3ed308[_0x1d41('0x4e')]['id']}})[_0x1d41('0x2c')](handleEntityNotFound(_0xf87906,null))['then'](removeEntity(_0xf87906,null))[_0x1d41('0x4c')](handleError(_0xf87906,null));};exports[_0x1d41('0x5b')]=function(_0x2be9a6,_0x4cef39){return db['FaxQueue'][_0x1d41('0x5b')]()[_0x1d41('0x2c')](respondWithResult(_0x4cef39,null))[_0x1d41('0x4c')](handleError(_0x4cef39,null));};exports[_0x1d41('0x5c')]=function(_0x4441d7,_0x267186,_0xda2600){var _0x4a2a4e={'raw':!![],'where':{}},_0xf016a6={},_0x26c3d9;return db[_0x1d41('0x35')][_0x1d41('0x5d')]({'where':{'id':_0x4441d7['params']['id']}})[_0x1d41('0x2c')](handleEntityNotFound(_0x267186,null))[_0x1d41('0x2c')](function(_0x1766fe){if(_0x1766fe){_0x26c3d9=_0x1766fe[_0x1d41('0x2d')]({'plain':!![]});_0xf016a6[_0x1d41('0x37')]=_['keys'](db[_0x1d41('0x5e')][_0x1d41('0x4f')]);_0xf016a6[_0x1d41('0x39')]=_[_0x1d41('0x38')](_0x4441d7[_0x1d41('0x39')]);_0xf016a6['filters']=_[_0x1d41('0x3b')](_0xf016a6[_0x1d41('0x37')],_0xf016a6['query']);_0x4a2a4e[_0x1d41('0x3c')]=_['intersection'](_0xf016a6[_0x1d41('0x37')],qs[_0x1d41('0x3d')](_0x4441d7[_0x1d41('0x39')][_0x1d41('0x3d')]));_0x4a2a4e[_0x1d41('0x3c')]=_0x4a2a4e[_0x1d41('0x3c')][_0x1d41('0x3e')]?_0x4a2a4e['attributes']:_0xf016a6[_0x1d41('0x37')];if(!_0x4441d7['query']['hasOwnProperty'](_0x1d41('0x3f'))){_0x4a2a4e['limit']=qs[_0x1d41('0x24')](_0x4441d7['query']['limit']);_0x4a2a4e[_0x1d41('0x23')]=qs[_0x1d41('0x23')](_0x4441d7[_0x1d41('0x39')][_0x1d41('0x23')]);}_0x4a2a4e[_0x1d41('0x40')]=qs[_0x1d41('0x41')](_0x4441d7[_0x1d41('0x39')][_0x1d41('0x41')]);_0x4a2a4e[_0x1d41('0x45')]=qs[_0x1d41('0x3a')](_[_0x1d41('0x42')](_0x4441d7['query'],_0xf016a6[_0x1d41('0x3a')]));_0x4a2a4e[_0x1d41('0x45')][_0x1d41('0x5f')]=_0x1766fe['id'];if(_0x4441d7[_0x1d41('0x39')][_0x1d41('0x43')]){_0x4a2a4e[_0x1d41('0x45')]=_['merge'](_0x4a2a4e[_0x1d41('0x45')],{'$or':_[_0x1d41('0x34')](_0x4a2a4e[_0x1d41('0x3c')],function(_0x518e4b){var _0x5691de={};_0x5691de[_0x518e4b]={'$like':'%'+_0x4441d7[_0x1d41('0x39')][_0x1d41('0x43')]+'%'};return _0x5691de;})});}_0x4a2a4e=_['merge']({},_0x4a2a4e,_0x4441d7['options']);return db[_0x1d41('0x5e')][_0x1d41('0x4a')](_0x4a2a4e);}})[_0x1d41('0x2c')](function(_0x454332){if(_0x454332){return db['User']['findAndCountAll']({'where':{'id':_[_0x1d41('0x34')](_0x454332,_0x1d41('0x60')),'role':_0x1d41('0x61')},'attributes':['id',_0x1d41('0x32'),_0x1d41('0x62'),_0x1d41('0x63'),_0x1d41('0x64')]});}})[_0x1d41('0x2c')](function(_0x1daf70){if(_0x1daf70){return{'count':_0x1daf70['count'],'rows':_[_0x1d41('0x34')](_0x1daf70[_0x1d41('0x4b')],function(_0x4d258f){return{'membername':_0x4d258f[_0x1d41('0x32')],'UserId':_0x4d258f['id'],'queue_name':_0x26c3d9[_0x1d41('0x32')],'FaxQueueId':_0x26c3d9['id'],'interface':util[_0x1d41('0x65')]('%s/%s','SIP',_0x4d258f[_0x1d41('0x32')]),'penalty':0x0,'paused':_0x4d258f[_0x1d41('0x62')],'createdAt':_0x4d258f[_0x1d41('0x64')],'updatedAt':_0x4d258f[_0x1d41('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1d41('0x2c')](respondWithFilteredResult(_0x267186,_0x4a2a4e))[_0x1d41('0x4c')](handleError(_0x267186,null));};exports[_0x1d41('0x66')]=function(_0x9180d8,_0x638818,_0x307c38){var _0x17dc0f={};var _0x3f2992={};var _0x3a7def;var _0x16a486;return db[_0x1d41('0x35')][_0x1d41('0x5d')]({'where':{'id':_0x9180d8[_0x1d41('0x4e')]['id']}})['then'](handleEntityNotFound(_0x638818,null))[_0x1d41('0x2c')](function(_0x22de81){if(_0x22de81){_0x3a7def=_0x22de81;_0x3f2992[_0x1d41('0x37')]=_[_0x1d41('0x38')](db['Team'][_0x1d41('0x4f')]);_0x3f2992[_0x1d41('0x39')]=_[_0x1d41('0x38')](_0x9180d8[_0x1d41('0x39')]);_0x3f2992[_0x1d41('0x3a')]=_[_0x1d41('0x3b')](_0x3f2992[_0x1d41('0x37')],_0x3f2992[_0x1d41('0x39')]);_0x17dc0f[_0x1d41('0x3c')]=_['intersection'](_0x3f2992[_0x1d41('0x37')],qs[_0x1d41('0x3d')](_0x9180d8[_0x1d41('0x39')][_0x1d41('0x3d')]));_0x17dc0f['attributes']=_0x17dc0f[_0x1d41('0x3c')]['length']?_0x17dc0f[_0x1d41('0x3c')]:_0x3f2992[_0x1d41('0x37')];_0x17dc0f['order']=qs[_0x1d41('0x41')](_0x9180d8[_0x1d41('0x39')]['sort']);_0x17dc0f[_0x1d41('0x45')]=qs[_0x1d41('0x3a')](_['pick'](_0x9180d8['query'],_0x3f2992[_0x1d41('0x3a')]));if(_0x9180d8[_0x1d41('0x39')][_0x1d41('0x43')]){_0x17dc0f[_0x1d41('0x45')]=_['merge'](_0x17dc0f[_0x1d41('0x45')],{'$or':_[_0x1d41('0x34')](_0x17dc0f[_0x1d41('0x3c')],function(_0x467034){var _0x9f4648={};_0x9f4648[_0x467034]={'$like':'%'+_0x9180d8[_0x1d41('0x39')][_0x1d41('0x43')]+'%'};return _0x9f4648;})});}_0x17dc0f=_[_0x1d41('0x44')]({},_0x17dc0f,_0x9180d8['options']);return _0x3a7def['getTeams'](_0x17dc0f);}})[_0x1d41('0x2c')](function(_0x2f2b46){if(_0x2f2b46){_0x16a486=_0x2f2b46[_0x1d41('0x3e')];if(!_0x9180d8[_0x1d41('0x39')][_0x1d41('0x67')](_0x1d41('0x3f'))){_0x17dc0f['limit']=qs[_0x1d41('0x24')](_0x9180d8['query']['limit']);_0x17dc0f[_0x1d41('0x23')]=qs[_0x1d41('0x23')](_0x9180d8['query'][_0x1d41('0x23')]);}return _0x3a7def['getTeams'](_0x17dc0f);}})['then'](function(_0x3cf329){if(_0x3cf329){return _0x3cf329?{'count':_0x16a486,'rows':_0x3cf329}:null;}})[_0x1d41('0x2c')](respondWithResult(_0x638818,null))[_0x1d41('0x4c')](handleError(_0x638818,null));};exports[_0x1d41('0x68')]=function(_0x42f036,_0x5a175d,_0x3ff9f3){var _0x2f975f=_0x42f036['body'][_0x1d41('0x69')];return db['Team']['findAll']({'where':{'id':_0x2f975f},'attributes':['id'],'include':[{'model':db[_0x1d41('0x6a')],'as':_0x1d41('0x6b'),'attributes':['id',_0x1d41('0x32'),'online',_0x1d41('0x6c'),'interface'],'raw':!![]}]})[_0x1d41('0x2c')](function(_0x31bdd9){if(_0x31bdd9){var _0x26c202=_['flatMap'](_0x31bdd9,function(_0x2b7dac){var _0x33d3ed=_0x2b7dac[_0x1d41('0x2d')]({'plain':!![]});return _0x33d3ed[_0x1d41('0x6b')];});return db[_0x1d41('0x35')]['find']({'where':{'id':_0x42f036[_0x1d41('0x4e')]['id']}})[_0x1d41('0x2c')](function(_0x3d6f99){return db[_0x1d41('0x6d')][_0x1d41('0x6e')](function(_0x35aa66){return _0x3d6f99[_0x1d41('0x68')](_0x2f975f,{'transaction':_0x35aa66})[_0x1d41('0x2c')](function(){return BPromise[_0x1d41('0x6f')](_0x26c202,function(_0x1cf680){return db[_0x1d41('0x5e')][_0x1d41('0x70')]({'where':{'UserId':_0x1cf680['id'],'FaxQueueId':_0x42f036[_0x1d41('0x4e')]['id']},'transaction':_0x35aa66});});})['then'](function(){_0x26c202[_0x1d41('0x71')](function(_0xcc9408){socket[_0x1d41('0x72')](_0x1d41('0x73'),{'UserId':_0xcc9408['id'],'FaxQueueId':_0x3d6f99['id']});});});});});}})[_0x1d41('0x2c')](respondWithStatusCode(_0x5a175d,null))[_0x1d41('0x4c')](handleError(_0x5a175d,null));};exports['removeTeams']=function(_0x420cbd,_0x3af5e3,_0x427e18){return db['Team'][_0x1d41('0x4a')]({'where':{'id':_0x420cbd[_0x1d41('0x39')][_0x1d41('0x69')]},'attributes':['id'],'include':[{'model':db[_0x1d41('0x6a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3af5e3,null))[_0x1d41('0x2c')](function(_0x3299a2){var _0x4f5631=_['map'](_0x3299a2,'id');var _0xa52da8=[];var _0x330304=[];var _0x16257c=squel[_0x1d41('0x74')]();_0x16257c[_0x1d41('0x75')](_0x1d41('0x76'))[_0x1d41('0x77')]('team_has_fax_queues','tq')[_0x1d41('0x78')](_0x1d41('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x1d41('0x7a'),_0x420cbd['params']['id']);for(var _0x36d0a4=0x0;_0x36d0a4<_0x3299a2[_0x1d41('0x3e')];_0x36d0a4+=0x1){let _0xbabefc=_0x3299a2[_0x36d0a4];for(var _0x23f24b=0x0;_0x23f24b<_0xbabefc[_0x1d41('0x6b')]['length'];_0x23f24b+=0x1){let _0x141079=_0xbabefc[_0x1d41('0x6b')][_0x23f24b];var _0x14228f=_0x16257c[_0x1d41('0x7b')]();_0x14228f[_0x1d41('0x45')](_0x1d41('0x7c'),_0x141079['id']);_0x330304['push'](db[_0x1d41('0x6d')][_0x1d41('0x39')](_0x14228f[_0x1d41('0x7d')](),{'type':db[_0x1d41('0x6d')][_0x1d41('0x7e')][_0x1d41('0x7f')]})[_0x1d41('0x2c')](function(_0x5b9cdf){if(_0x5b9cdf['length']===0x1){return _0x141079['id'];}else{var _0x133d03=_[_0x1d41('0x80')](_[_0x1d41('0x34')](_0x5b9cdf,_0x1d41('0x81')),function(_0x48ce36){return _[_0x1d41('0x82')](_0x4f5631,_0x48ce36);});if(_0x133d03){return _0x141079['id'];}}}));}}return BPromise[_0x1d41('0x83')](_0x330304)['then'](function(_0x250508){_0xa52da8=_(_0xa52da8)[_0x1d41('0x84')](_0x250508)[_0x1d41('0x85')]()[_0x1d41('0x86')]();return db[_0x1d41('0x35')][_0x1d41('0x55')]({'where':{'id':_0x420cbd[_0x1d41('0x4e')]['id']}})[_0x1d41('0x2c')](function(_0x578eb0){return db['sequelize'][_0x1d41('0x6e')](function(_0x1984e8){return _0x578eb0['removeTeams'](_0x420cbd[_0x1d41('0x39')]['ids'],{'transaction':_0x1984e8})[_0x1d41('0x2c')](function(){if(!_[_0x1d41('0x87')](_0xa52da8)){return _0x578eb0[_0x1d41('0x88')](_0xa52da8,{'transaction':_0x1984e8});}})['then'](function(){_0xa52da8[_0x1d41('0x71')](function(_0x23951a){socket['emit']('userFaxQueue:remove',{'UserId':_0x23951a,'FaxQueueId':_0x578eb0['id']});});});});});});})[_0x1d41('0x2c')](respondWithStatusCode(_0x3af5e3,null))['catch'](handleError(_0x3af5e3,null));};exports[_0x1d41('0x89')]=function(_0x2a099d,_0x38ee3e,_0x211af5){return db['FaxQueue']['find']({'where':{'id':_0x2a099d['params']['id']}})[_0x1d41('0x2c')](handleEntityNotFound(_0x38ee3e,null))[_0x1d41('0x2c')](function(_0x2c1f2a){if(_0x2c1f2a){return _0x2c1f2a[_0x1d41('0x89')](_0x2a099d['body'][_0x1d41('0x69')],_[_0x1d41('0x8a')](_0x2a099d[_0x1d41('0x5a')],[_0x1d41('0x69'),'id'])||{})['spread'](function(_0x813a0f){for(var _0x236d04=0x0;_0x236d04<_0x2a099d['body'][_0x1d41('0x69')][_0x1d41('0x3e')];_0x236d04+=0x1){socket['emit'](_0x1d41('0x73'),{'UserId':Number(_0x2a099d[_0x1d41('0x5a')][_0x1d41('0x69')][_0x236d04]),'FaxQueueId':Number(_0x2a099d[_0x1d41('0x4e')]['id'])});}return _0x813a0f;});}})[_0x1d41('0x2c')](respondWithResult(_0x38ee3e,null))[_0x1d41('0x4c')](handleError(_0x38ee3e,null));};exports[_0x1d41('0x88')]=function(_0x3d202c,_0x183f42,_0x229ad7){return db[_0x1d41('0x35')][_0x1d41('0x55')]({'where':{'id':_0x3d202c[_0x1d41('0x4e')]['id']}})[_0x1d41('0x2c')](handleEntityNotFound(_0x183f42,null))[_0x1d41('0x2c')](function(_0x2e4d86){if(_0x2e4d86){return _0x2e4d86[_0x1d41('0x88')](_0x3d202c[_0x1d41('0x39')][_0x1d41('0x69')])[_0x1d41('0x2c')](function(){if(_['isArray'](_0x3d202c[_0x1d41('0x39')]['ids'])){for(var _0x55e905=0x0;_0x55e905<_0x3d202c[_0x1d41('0x39')]['ids'][_0x1d41('0x3e')];_0x55e905+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x3d202c[_0x1d41('0x39')][_0x1d41('0x69')][_0x55e905]),'FaxQueueId':Number(_0x3d202c['params']['id'])});}}else{socket[_0x1d41('0x72')](_0x1d41('0x8b'),{'UserId':Number(_0x3d202c[_0x1d41('0x39')][_0x1d41('0x69')]),'FaxQueueId':Number(_0x3d202c[_0x1d41('0x4e')]['id'])});}});}})[_0x1d41('0x2c')](respondWithStatusCode(_0x183f42,null))[_0x1d41('0x4c')](handleError(_0x183f42,null));};exports[_0x1d41('0x8c')]=function(_0x195d9b,_0x329458,_0x49e1f4){var _0x43807e={};var _0x5168c3={};var _0x26c446;var _0x34a829;return db[_0x1d41('0x35')][_0x1d41('0x5d')]({'where':{'id':_0x195d9b[_0x1d41('0x4e')]['id']}})['then'](handleEntityNotFound(_0x329458,null))[_0x1d41('0x2c')](function(_0x20042f){if(_0x20042f){_0x26c446=_0x20042f;_0x5168c3[_0x1d41('0x37')]=_[_0x1d41('0x38')](db['User'][_0x1d41('0x4f')]);_0x5168c3[_0x1d41('0x39')]=_[_0x1d41('0x38')](_0x195d9b[_0x1d41('0x39')]);_0x5168c3[_0x1d41('0x3a')]=_[_0x1d41('0x3b')](_0x5168c3[_0x1d41('0x37')],_0x5168c3[_0x1d41('0x39')]);_0x43807e['attributes']=_[_0x1d41('0x3b')](_0x5168c3['model'],qs[_0x1d41('0x3d')](_0x195d9b[_0x1d41('0x39')]['fields']));_0x43807e[_0x1d41('0x3c')]=_0x43807e['attributes'][_0x1d41('0x3e')]?_0x43807e['attributes']:_0x5168c3[_0x1d41('0x37')];_0x43807e[_0x1d41('0x40')]=qs['sort'](_0x195d9b[_0x1d41('0x39')][_0x1d41('0x41')]);_0x43807e[_0x1d41('0x45')]=qs[_0x1d41('0x3a')](_[_0x1d41('0x42')](_0x195d9b[_0x1d41('0x39')],_0x5168c3[_0x1d41('0x3a')]));if(_0x195d9b[_0x1d41('0x39')]['filter']){_0x43807e[_0x1d41('0x45')]=_['merge'](_0x43807e[_0x1d41('0x45')],{'$or':_[_0x1d41('0x34')](_0x43807e[_0x1d41('0x3c')],function(_0x463e12){var _0x35ad24={};_0x35ad24[_0x463e12]={'$like':'%'+_0x195d9b[_0x1d41('0x39')]['filter']+'%'};return _0x35ad24;})});}_0x43807e=_['merge']({},_0x43807e,_0x195d9b[_0x1d41('0x48')]);return _0x26c446[_0x1d41('0x8c')](_0x43807e);}})[_0x1d41('0x2c')](function(_0x18425b){if(_0x18425b){_0x34a829=_0x18425b[_0x1d41('0x3e')];if(!_0x195d9b['query']['hasOwnProperty'](_0x1d41('0x3f'))){_0x43807e['limit']=qs[_0x1d41('0x24')](_0x195d9b[_0x1d41('0x39')][_0x1d41('0x24')]);_0x43807e[_0x1d41('0x23')]=qs[_0x1d41('0x23')](_0x195d9b[_0x1d41('0x39')][_0x1d41('0x23')]);}return _0x26c446[_0x1d41('0x8c')](_0x43807e);}})[_0x1d41('0x2c')](function(_0x5ef429){if(_0x5ef429){return _0x5ef429?{'count':_0x34a829,'rows':_0x5ef429}:null;}})[_0x1d41('0x2c')](respondWithResult(_0x329458,null))['catch'](handleError(_0x329458,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 272de96..2226db5 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 _0xfed0=['exports','FaxQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfed0,0xef));var _0x0fed=function(_0x12a071,_0x3c1dfa){_0x12a071=_0x12a071-0x0;var _0x38d8ae=_0xfed0[_0x12a071];return _0x38d8ae;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0x0fed('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0fed('0x1')](0x0);var events={'afterCreate':_0x0fed('0x2'),'afterUpdate':'update','afterDestroy':_0x0fed('0x3')};function emitEvent(_0xa47455){return function(_0x1ae656,_0x13d3dc,_0x2da8d6){FaxQueueEvents[_0x0fed('0x4')](_0xa47455+':'+_0x1ae656['id'],_0x1ae656);FaxQueueEvents[_0x0fed('0x4')](_0xa47455,_0x1ae656);_0x2da8d6(null);};}for(var e in events){if(events[_0x0fed('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x0fed('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x6f90=['events','setMaxListeners','save','update','emit','exports'];(function(_0x2a8d0b,_0x572e47){var _0x53e4c5=function(_0x4cc871){while(--_0x4cc871){_0x2a8d0b['push'](_0x2a8d0b['shift']());}};_0x53e4c5(++_0x572e47);}(_0x6f90,0x1e0));var _0x06f9=function(_0x247cb6,_0x136177){_0x247cb6=_0x247cb6-0x0;var _0x554363=_0x6f90[_0x247cb6];return _0x554363;};'use strict';var EventEmitter=require(_0x06f9('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x06f9('0x1')](0x0);var events={'afterCreate':_0x06f9('0x2'),'afterUpdate':_0x06f9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x307a9e){return function(_0xc9f6a1,_0x5e3034,_0x1d4194){FaxQueueEvents[_0x06f9('0x4')](_0x307a9e+':'+_0xc9f6a1['id'],_0xc9f6a1);FaxQueueEvents[_0x06f9('0x4')](_0x307a9e,_0xc9f6a1);_0x1d4194(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x06f9('0x5')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 9229b71..cdd7c03 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 _0x0747=['lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue','fax_queues'];(function(_0xcfff8,_0x19daf6){var _0xe8fc55=function(_0x31608c){while(--_0x31608c){_0xcfff8['push'](_0xcfff8['shift']());}};_0xe8fc55(++_0x19daf6);}(_0x0747,0x16b));var _0x7074=function(_0x7572da,_0x2b6475){_0x7572da=_0x7572da-0x0;var _0x364a4a=_0x0747[_0x7572da];return _0x364a4a;};'use strict';var _=require(_0x7074('0x0'));var util=require(_0x7074('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7074('0x2'));var rp=require(_0x7074('0x3'));var fs=require('fs');var path=require(_0x7074('0x4'));var rimraf=require(_0x7074('0x5'));var config=require(_0x7074('0x6'));var attributes=require(_0x7074('0x7'));module[_0x7074('0x8')]=function(_0x49cee5,_0x448fc4){return _0x49cee5['define'](_0x7074('0x9'),attributes,{'tableName':_0x7074('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd303=['FaxQueue','fax_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','define'];(function(_0x2d67f4,_0x307a0c){var _0x3a9d33=function(_0x3de2d2){while(--_0x3de2d2){_0x2d67f4['push'](_0x2d67f4['shift']());}};_0x3a9d33(++_0x307a0c);}(_0xd303,0x183));var _0x3d30=function(_0x5cb1d9,_0x425711){_0x5cb1d9=_0x5cb1d9-0x0;var _0x4d347a=_0xd303[_0x5cb1d9];return _0x4d347a;};'use strict';var _=require(_0x3d30('0x0'));var util=require(_0x3d30('0x1'));var logger=require('../../config/logger')(_0x3d30('0x2'));var moment=require(_0x3d30('0x3'));var BPromise=require(_0x3d30('0x4'));var rp=require(_0x3d30('0x5'));var fs=require('fs');var path=require(_0x3d30('0x6'));var rimraf=require(_0x3d30('0x7'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module['exports']=function(_0x5124cb,_0x4ff64d){return _0x5124cb[_0x3d30('0x8')](_0x3d30('0x9'),attributes,{'tableName':_0x3d30('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index de4083f..e2f4774 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 _0x4b00=['bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','model','map','then','debug','find','ShowFaxQueue','lodash','util'];(function(_0x1d7138,_0x1a9ffa){var _0x4008b8=function(_0x4c7227){while(--_0x4c7227){_0x1d7138['push'](_0x1d7138['shift']());}};_0x4008b8(++_0x1a9ffa);}(_0x4b00,0x1a0));var _0x04b0=function(_0x3495d0,_0x511c03){_0x3495d0=_0x3495d0-0x0;var _0x4a3dd9=_0x4b00[_0x3495d0];return _0x4a3dd9;};'use strict';var _=require(_0x04b0('0x0'));var util=require(_0x04b0('0x1'));var moment=require('moment');var BPromise=require(_0x04b0('0x2'));var rs=require(_0x04b0('0x3'));var fs=require('fs');var Redis=require(_0x04b0('0x4'));var db=require(_0x04b0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x04b0('0x6'));var jayson=require(_0x04b0('0x7'));var client=jayson[_0x04b0('0x8')][_0x04b0('0x9')]({'port':0x232a});config[_0x04b0('0xa')]=_['defaults'](config[_0x04b0('0xa')],{'host':_0x04b0('0xb'),'port':0x18eb});var socket=require(_0x04b0('0xc'))(new Redis(config['redis']));require(_0x04b0('0xd'))[_0x04b0('0xe')](socket);function respondWithRpcPromise(_0x5717d4,_0x30402f,_0x567c87){return new BPromise(function(_0x7edd4b,_0x3fc1ec){return client[_0x04b0('0xf')](_0x5717d4,_0x567c87)['then'](function(_0x501b52){logger[_0x04b0('0x10')](_0x04b0('0x11'),_0x30402f,_0x04b0('0x12'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x30402f,_0x04b0('0x12'),JSON[_0x04b0('0x13')](_0x501b52));if(_0x501b52[_0x04b0('0x14')]){if(_0x501b52[_0x04b0('0x14')][_0x04b0('0x15')]===0x1f4){logger[_0x04b0('0x14')](_0x04b0('0x11'),_0x30402f,_0x501b52['error'][_0x04b0('0x16')]);return _0x3fc1ec(_0x501b52['error'][_0x04b0('0x16')]);}logger['error'](_0x04b0('0x11'),_0x30402f,_0x501b52[_0x04b0('0x14')][_0x04b0('0x16')]);return _0x7edd4b(_0x501b52[_0x04b0('0x14')][_0x04b0('0x16')]);}else{logger[_0x04b0('0x10')](_0x04b0('0x11'),_0x30402f,_0x04b0('0x12'));_0x7edd4b(_0x501b52['result'][_0x04b0('0x16')]);}})[_0x04b0('0x17')](function(_0x51be83){logger[_0x04b0('0x14')](_0x04b0('0x11'),_0x30402f,_0x51be83);_0x3fc1ec(_0x51be83);});});}exports[_0x04b0('0x18')]=function(_0x8a17db){var _0x381036=this;return new Promise(function(_0x4df1b2,_0x75aa5e){return db[_0x04b0('0x19')]['findAll']({'raw':_0x8a17db['options']?_0x8a17db[_0x04b0('0x1a')][_0x04b0('0x1b')]===undefined?!![]:![]:!![],'where':_0x8a17db[_0x04b0('0x1a')]?_0x8a17db['options'][_0x04b0('0x1c')]||null:null,'attributes':_0x8a17db[_0x04b0('0x1a')]?_0x8a17db[_0x04b0('0x1a')][_0x04b0('0x1d')]||null:null,'limit':_0x8a17db['options']?_0x8a17db[_0x04b0('0x1a')][_0x04b0('0x1e')]||null:null,'include':_0x8a17db[_0x04b0('0x1a')]?_0x8a17db[_0x04b0('0x1a')][_0x04b0('0x1f')]?_['map'](_0x8a17db[_0x04b0('0x1a')][_0x04b0('0x1f')],function(_0x4a4eec){return{'model':db[_0x4a4eec['model']],'as':_0x4a4eec['as'],'attributes':_0x4a4eec[_0x04b0('0x1d')],'include':_0x4a4eec[_0x04b0('0x1f')]?_['map'](_0x4a4eec[_0x04b0('0x1f')],function(_0x28591b){return{'model':db[_0x28591b[_0x04b0('0x20')]],'as':_0x28591b['as'],'attributes':_0x28591b[_0x04b0('0x1d')],'include':_0x28591b[_0x04b0('0x1f')]?_[_0x04b0('0x21')](_0x28591b[_0x04b0('0x1f')],function(_0x4031fd){return{'model':db[_0x4031fd[_0x04b0('0x20')]],'as':_0x4031fd['as'],'attributes':_0x4031fd[_0x04b0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x04b0('0x22')](function(_0x53036f){logger['info']('GetFaxQueue',_0x8a17db);logger[_0x04b0('0x23')]('GetFaxQueue',_0x8a17db,JSON[_0x04b0('0x13')](_0x53036f));_0x4df1b2(_0x53036f);})['catch'](function(_0xbe8e2d){logger['error']('GetFaxQueue',_0xbe8e2d[_0x04b0('0x16')],_0x8a17db);_0x75aa5e(_0x381036[_0x04b0('0x14')](0x1f4,_0xbe8e2d[_0x04b0('0x16')]));});});};exports['ShowFaxQueue']=function(_0xec12f4){var _0x19f98a=this;return new Promise(function(_0x1cbea0,_0x12d6b2){return db['FaxQueue'][_0x04b0('0x24')]({'raw':_0xec12f4[_0x04b0('0x1a')]?_0xec12f4['options'][_0x04b0('0x1b')]===undefined?!![]:![]:!![],'where':_0xec12f4[_0x04b0('0x1a')]?_0xec12f4[_0x04b0('0x1a')]['where']||null:null,'attributes':_0xec12f4[_0x04b0('0x1a')]?_0xec12f4[_0x04b0('0x1a')][_0x04b0('0x1d')]||null:null,'include':_0xec12f4[_0x04b0('0x1a')]?_0xec12f4['options']['include']?_[_0x04b0('0x21')](_0xec12f4[_0x04b0('0x1a')]['include'],function(_0x591280){return{'model':db[_0x591280[_0x04b0('0x20')]],'as':_0x591280['as'],'attributes':_0x591280[_0x04b0('0x1d')],'include':_0x591280[_0x04b0('0x1f')]?_[_0x04b0('0x21')](_0x591280['include'],function(_0x4b7da2){return{'model':db[_0x4b7da2['model']],'as':_0x4b7da2['as'],'attributes':_0x4b7da2['attributes'],'include':_0x4b7da2[_0x04b0('0x1f')]?_[_0x04b0('0x21')](_0x4b7da2['include'],function(_0x3719d0){return{'model':db[_0x3719d0[_0x04b0('0x20')]],'as':_0x3719d0['as'],'attributes':_0x3719d0[_0x04b0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x04b0('0x22')](function(_0x1d0672){logger[_0x04b0('0x10')](_0x04b0('0x25'),_0xec12f4);logger['debug'](_0x04b0('0x25'),_0xec12f4,JSON[_0x04b0('0x13')](_0x1d0672));_0x1cbea0(_0x1d0672);})['catch'](function(_0x377fe5){logger[_0x04b0('0x14')](_0x04b0('0x25'),_0x377fe5['message'],_0xec12f4);_0x12d6b2(_0x19f98a[_0x04b0('0x14')](0x1f4,_0x377fe5[_0x04b0('0x16')]));});});}; \ No newline at end of file +var _0xfa2a=['limit','include','map','model','attributes','ShowFaxQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where'];(function(_0x532627,_0x226a2c){var _0x38d3b3=function(_0x13e3d2){while(--_0x13e3d2){_0x532627['push'](_0x532627['shift']());}};_0x38d3b3(++_0x226a2c);}(_0xfa2a,0x1e7));var _0xafa2=function(_0x227a38,_0x379e1c){_0x227a38=_0x227a38-0x0;var _0x39b942=_0xfa2a[_0x227a38];return _0x39b942;};'use strict';var _=require(_0xafa2('0x0'));var util=require('util');var moment=require(_0xafa2('0x1'));var BPromise=require(_0xafa2('0x2'));var rs=require(_0xafa2('0x3'));var fs=require('fs');var Redis=require(_0xafa2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xafa2('0x5'));var logger=require(_0xafa2('0x6'))('rpc');var config=require(_0xafa2('0x7'));var jayson=require(_0xafa2('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xafa2('0x9')]=_[_0xafa2('0xa')](config[_0xafa2('0x9')],{'host':_0xafa2('0xb'),'port':0x18eb});var socket=require(_0xafa2('0xc'))(new Redis(config['redis']));require(_0xafa2('0xd'))[_0xafa2('0xe')](socket);function respondWithRpcPromise(_0x2ad7a5,_0x322489,_0xe383a6){return new BPromise(function(_0x443cc6,_0x11a317){return client[_0xafa2('0xf')](_0x2ad7a5,_0xe383a6)[_0xafa2('0x10')](function(_0x21ab7a){logger[_0xafa2('0x11')](_0xafa2('0x12'),_0x322489,'request\x20sent');logger[_0xafa2('0x13')](_0xafa2('0x14'),_0x322489,_0xafa2('0x15'),JSON[_0xafa2('0x16')](_0x21ab7a));if(_0x21ab7a['error']){if(_0x21ab7a[_0xafa2('0x17')][_0xafa2('0x18')]===0x1f4){logger[_0xafa2('0x17')](_0xafa2('0x12'),_0x322489,_0x21ab7a[_0xafa2('0x17')][_0xafa2('0x19')]);return _0x11a317(_0x21ab7a['error'][_0xafa2('0x19')]);}logger[_0xafa2('0x17')]('FaxQueue,\x20%s,\x20%s',_0x322489,_0x21ab7a[_0xafa2('0x17')]['message']);return _0x443cc6(_0x21ab7a[_0xafa2('0x17')]['message']);}else{logger[_0xafa2('0x11')](_0xafa2('0x12'),_0x322489,_0xafa2('0x15'));_0x443cc6(_0x21ab7a[_0xafa2('0x1a')][_0xafa2('0x19')]);}})[_0xafa2('0x1b')](function(_0x18c5ad){logger[_0xafa2('0x17')](_0xafa2('0x12'),_0x322489,_0x18c5ad);_0x11a317(_0x18c5ad);});});}exports[_0xafa2('0x1c')]=function(_0x20f872){var _0x13e83e=this;return new Promise(function(_0x2ce9ad,_0x2ee18f){return db[_0xafa2('0x1d')]['findAll']({'raw':_0x20f872[_0xafa2('0x1e')]?_0x20f872[_0xafa2('0x1e')][_0xafa2('0x1f')]===undefined?!![]:![]:!![],'where':_0x20f872[_0xafa2('0x1e')]?_0x20f872[_0xafa2('0x1e')][_0xafa2('0x20')]||null:null,'attributes':_0x20f872[_0xafa2('0x1e')]?_0x20f872['options']['attributes']||null:null,'limit':_0x20f872['options']?_0x20f872['options'][_0xafa2('0x21')]||null:null,'include':_0x20f872[_0xafa2('0x1e')]?_0x20f872[_0xafa2('0x1e')][_0xafa2('0x22')]?_[_0xafa2('0x23')](_0x20f872[_0xafa2('0x1e')][_0xafa2('0x22')],function(_0x55c2b1){return{'model':db[_0x55c2b1[_0xafa2('0x24')]],'as':_0x55c2b1['as'],'attributes':_0x55c2b1[_0xafa2('0x25')],'include':_0x55c2b1[_0xafa2('0x22')]?_['map'](_0x55c2b1[_0xafa2('0x22')],function(_0x345679){return{'model':db[_0x345679[_0xafa2('0x24')]],'as':_0x345679['as'],'attributes':_0x345679['attributes'],'include':_0x345679[_0xafa2('0x22')]?_['map'](_0x345679[_0xafa2('0x22')],function(_0x354c29){return{'model':db[_0x354c29[_0xafa2('0x24')]],'as':_0x354c29['as'],'attributes':_0x354c29['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x41f328){logger['info']('GetFaxQueue',_0x20f872);logger[_0xafa2('0x13')](_0xafa2('0x1c'),_0x20f872,JSON[_0xafa2('0x16')](_0x41f328));_0x2ce9ad(_0x41f328);})[_0xafa2('0x1b')](function(_0x28e562){logger[_0xafa2('0x17')]('GetFaxQueue',_0x28e562[_0xafa2('0x19')],_0x20f872);_0x2ee18f(_0x13e83e[_0xafa2('0x17')](0x1f4,_0x28e562['message']));});});};exports[_0xafa2('0x26')]=function(_0x452653){var _0x4476be=this;return new Promise(function(_0x298737,_0x187b23){return db['FaxQueue'][_0xafa2('0x27')]({'raw':_0x452653[_0xafa2('0x1e')]?_0x452653[_0xafa2('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x452653['options']?_0x452653[_0xafa2('0x1e')][_0xafa2('0x20')]||null:null,'attributes':_0x452653[_0xafa2('0x1e')]?_0x452653[_0xafa2('0x1e')][_0xafa2('0x25')]||null:null,'include':_0x452653['options']?_0x452653[_0xafa2('0x1e')][_0xafa2('0x22')]?_[_0xafa2('0x23')](_0x452653[_0xafa2('0x1e')][_0xafa2('0x22')],function(_0x44bbc1){return{'model':db[_0x44bbc1['model']],'as':_0x44bbc1['as'],'attributes':_0x44bbc1['attributes'],'include':_0x44bbc1[_0xafa2('0x22')]?_[_0xafa2('0x23')](_0x44bbc1[_0xafa2('0x22')],function(_0x27ec44){return{'model':db[_0x27ec44['model']],'as':_0x27ec44['as'],'attributes':_0x27ec44[_0xafa2('0x25')],'include':_0x27ec44[_0xafa2('0x22')]?_['map'](_0x27ec44[_0xafa2('0x22')],function(_0x1dc365){return{'model':db[_0x1dc365[_0xafa2('0x24')]],'as':_0x1dc365['as'],'attributes':_0x1dc365[_0xafa2('0x25')]};}):[]};}):[]};}):[]:[]})[_0xafa2('0x10')](function(_0x3c92b3){logger[_0xafa2('0x11')](_0xafa2('0x26'),_0x452653);logger[_0xafa2('0x13')](_0xafa2('0x26'),_0x452653,JSON['stringify'](_0x3c92b3));_0x298737(_0x3c92b3);})[_0xafa2('0x1b')](function(_0x3a1b04){logger[_0xafa2('0x17')]('ShowFaxQueue',_0x3a1b04[_0xafa2('0x19')],_0x452653);_0x187b23(_0x4476be[_0xafa2('0x17')](0x1f4,_0x3a1b04[_0xafa2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 3cbf3fc..313c61d 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 _0x34e7=['emit','removeListener','register','length','./faxQueue.events','save','remove','update'];(function(_0x1de7e5,_0x1224a3){var _0x104412=function(_0x321690){while(--_0x321690){_0x1de7e5['push'](_0x1de7e5['shift']());}};_0x104412(++_0x1224a3);}(_0x34e7,0x164));var _0x734e=function(_0x58da8a,_0x1fb6ff){_0x58da8a=_0x58da8a-0x0;var _0x5294b9=_0x34e7[_0x58da8a];return _0x5294b9;};'use strict';var FaxQueueEvents=require(_0x734e('0x0'));var events=[_0x734e('0x1'),_0x734e('0x2'),_0x734e('0x3')];function createListener(_0x3a3562,_0x381907){return function(_0x3872ce){_0x381907[_0x734e('0x4')](_0x3a3562,_0x3872ce);};}function removeListener(_0x23d0df,_0x28573b){return function(){FaxQueueEvents[_0x734e('0x5')](_0x23d0df,_0x28573b);};}exports[_0x734e('0x6')]=function(_0x3405b1){for(var _0x192562=0x0,_0x4f49aa=events[_0x734e('0x7')];_0x192562<_0x4f49aa;_0x192562++){var _0x1b11da=events[_0x192562];var _0x444194=createListener('faxQueue:'+_0x1b11da,_0x3405b1);FaxQueueEvents['on'](_0x1b11da,_0x444194);}}; \ No newline at end of file +var _0xcede=['register','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xcede,0x94));var _0xeced=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xcede[_0x3947c9];return _0x2e7871;};'use strict';var FaxQueueEvents=require(_0xeced('0x0'));var events=[_0xeced('0x1'),_0xeced('0x2'),_0xeced('0x3')];function createListener(_0x2acf4e,_0x41638a){return function(_0x493ed5){_0x41638a[_0xeced('0x4')](_0x2acf4e,_0x493ed5);};}function removeListener(_0x1f2cb2,_0x1c19c2){return function(){FaxQueueEvents[_0xeced('0x5')](_0x1f2cb2,_0x1c19c2);};}exports[_0xeced('0x6')]=function(_0x1809da){for(var _0x4bc2a0=0x0,_0xbf873b=events['length'];_0x4bc2a0<_0xbf873b;_0x4bc2a0++){var _0xef36ec=events[_0x4bc2a0];var _0x42eb6f=createListener('faxQueue:'+_0xef36ec,_0x1809da);FaxQueueEvents['on'](_0xef36ec,_0x42eb6f);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 290d57f..fae55ae 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 _0x292c=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams','put','update','destroy','delete','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x343d58,_0x17a44d){var _0x1fef1d=function(_0x159528){while(--_0x159528){_0x343d58['push'](_0x343d58['shift']());}};_0x1fef1d(++_0x17a44d);}(_0x292c,0x66));var _0xc292=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0x292c[_0x1e6b59];return _0x40d7c5;};'use strict';var multer=require(_0xc292('0x0'));var util=require('util');var path=require(_0xc292('0x1'));var timeout=require(_0xc292('0x2'));var express=require(_0xc292('0x3'));var router=express[_0xc292('0x4')]();var fs_extra=require(_0xc292('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc292('0x6'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xc292('0x7')]('/',auth[_0xc292('0x8')](),controller[_0xc292('0x9')]);router[_0xc292('0x7')](_0xc292('0xa'),auth[_0xc292('0x8')](),controller[_0xc292('0xb')]);router[_0xc292('0x7')](_0xc292('0xc'),auth[_0xc292('0x8')](),controller['show']);router[_0xc292('0x7')](_0xc292('0xd'),auth[_0xc292('0x8')](),controller[_0xc292('0xe')]);router[_0xc292('0x7')]('/:id/teams',auth[_0xc292('0x8')](),controller[_0xc292('0xf')]);router[_0xc292('0x7')](_0xc292('0x10'),auth[_0xc292('0x8')](),controller[_0xc292('0x11')]);router['post']('/',auth[_0xc292('0x8')](),controller[_0xc292('0x12')]);router[_0xc292('0x13')](_0xc292('0x14'),auth[_0xc292('0x8')](),controller['addTeams']);router['post'](_0xc292('0x10'),auth[_0xc292('0x8')](),controller['addAgents']);router[_0xc292('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xc292('0x16')]);router['delete'](_0xc292('0xc'),auth[_0xc292('0x8')](),controller[_0xc292('0x17')]);router['delete'](_0xc292('0x14'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xc292('0x18')](_0xc292('0x10'),auth['isAuthenticated'](),controller[_0xc292('0x19')]);module[_0xc292('0x1a')]=router; \ No newline at end of file +var _0xba34=['create','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents'];(function(_0x21c78a,_0x764783){var _0x1ac4c9=function(_0x5694e1){while(--_0x5694e1){_0x21c78a['push'](_0x21c78a['shift']());}};_0x1ac4c9(++_0x764783);}(_0xba34,0x119));var _0x4ba3=function(_0x286a76,_0x4265ab){_0x286a76=_0x286a76-0x0;var _0x28dffd=_0xba34[_0x286a76];return _0x28dffd;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0x8')](_0x4ba3('0xe'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x8')]('/:id/teams',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x10')]);router['get'](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x12')]);router['post']('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x13')]);router[_0x4ba3('0x14')](_0x4ba3('0x15'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x16')]);router[_0x4ba3('0x14')](_0x4ba3('0x11'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x17')]);router[_0x4ba3('0x18')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x19')]);router[_0x4ba3('0x1a')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x1b')]);router[_0x4ba3('0x1a')](_0x4ba3('0x15'),auth[_0x4ba3('0x9')](),controller['removeTeams']);router[_0x4ba3('0x1a')](_0x4ba3('0x11'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x1c')]);module[_0x4ba3('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 1b688da..909b848 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 _0xa976=['sequelize','STRING','DATE','moment'];(function(_0x3dd1bc,_0x34c25a){var _0x2e1648=function(_0x5acaee){while(--_0x5acaee){_0x3dd1bc['push'](_0x3dd1bc['shift']());}};_0x2e1648(++_0x34c25a);}(_0xa976,0xd7));var _0x6a97=function(_0x5bc741,_0x2a1710){_0x5bc741=_0x5bc741-0x0;var _0x313102=_0xa976[_0x5bc741];return _0x313102;};'use strict';var moment=require(_0x6a97('0x0'));var Sequelize=require(_0x6a97('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6a97('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6a97('0x2')]},'joinAt':{'type':Sequelize[_0x6a97('0x3')]},'leaveAt':{'type':Sequelize[_0x6a97('0x3')]},'acceptAt':{'type':Sequelize[_0x6a97('0x3')]},'exitAt':{'type':Sequelize[_0x6a97('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfe9d=['STRING','DATE','moment','sequelize','exports'];(function(_0x10ca4f,_0x418cbf){var _0x59ecc0=function(_0x556d0b){while(--_0x556d0b){_0x10ca4f['push'](_0x10ca4f['shift']());}};_0x59ecc0(++_0x418cbf);}(_0xfe9d,0x1a1));var _0xdfe9=function(_0x5a77bc,_0x2aafb8){_0x5a77bc=_0x5a77bc-0x0;var _0xec75b4=_0xfe9d[_0x5a77bc];return _0xec75b4;};'use strict';var moment=require(_0xdfe9('0x0'));var Sequelize=require(_0xdfe9('0x1'));module[_0xdfe9('0x2')]={'uniqueid':{'type':Sequelize[_0xdfe9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xdfe9('0x3')]},'joinAt':{'type':Sequelize[_0xdfe9('0x4')]},'leaveAt':{'type':Sequelize[_0xdfe9('0x4')]},'acceptAt':{'type':Sequelize[_0xdfe9('0x4')]},'exitAt':{'type':Sequelize[_0xdfe9('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 87e9d97..b35a638 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 _0x2bdb=['count','set','save','then','destroy','end','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','create','update','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined'];(function(_0x40b50a,_0x3526ba){var _0x551dc1=function(_0x40ff97){while(--_0x40ff97){_0x40b50a['push'](_0x40b50a['shift']());}};_0x551dc1(++_0x3526ba);}(_0x2bdb,0x105));var _0xb2bd=function(_0x1ff16e,_0x2cf334){_0x1ff16e=_0x1ff16e-0x0;var _0x4f7a22=_0x2bdb[_0x1ff16e];return _0x4f7a22;};'use strict';var emlformat=require(_0xb2bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb2bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb2bd('0x2'));var moment=require(_0xb2bd('0x3'));var BPromise=require(_0xb2bd('0x4'));var Mustache=require('mustache');var util=require(_0xb2bd('0x5'));var path=require(_0xb2bd('0x6'));var sox=require(_0xb2bd('0x7'));var csv=require(_0xb2bd('0x8'));var ejs=require(_0xb2bd('0x9'));var fs=require('fs');var fs_extra=require(_0xb2bd('0xa'));var _=require(_0xb2bd('0xb'));var squel=require('squel');var crypto=require(_0xb2bd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb2bd('0xd'));var toCsv=require(_0xb2bd('0x8'));var querystring=require(_0xb2bd('0xe'));var Papa=require(_0xb2bd('0xf'));var Redis=require(_0xb2bd('0x10'));var authService=require(_0xb2bd('0x11'));var qs=require(_0xb2bd('0x12'));var as=require(_0xb2bd('0x13'));var hardwareService=require(_0xb2bd('0x14'));var logger=require('../../config/logger')(_0xb2bd('0x15'));var utils=require(_0xb2bd('0x16'));var config=require(_0xb2bd('0x17'));var licenseUtil=require(_0xb2bd('0x18'));var db=require(_0xb2bd('0x19'))['db'];function respondWithStatusCode(_0x35f174,_0x6d2212){_0x6d2212=_0x6d2212||0xcc;return function(_0x452cd6){if(_0x452cd6){return _0x35f174['sendStatus'](_0x6d2212);}return _0x35f174[_0xb2bd('0x1a')](_0x6d2212)['end']();};}function respondWithResult(_0x2da8e6,_0x2adda1){_0x2adda1=_0x2adda1||0xc8;return function(_0x17e238){if(_0x17e238){return _0x2da8e6[_0xb2bd('0x1a')](_0x2adda1)[_0xb2bd('0x1b')](_0x17e238);}};}function respondWithFilteredResult(_0x47d679,_0x23c440){return function(_0x315ecc){if(_0x315ecc){var _0x2091d2=typeof _0x23c440[_0xb2bd('0x1c')]==='undefined'&&typeof _0x23c440[_0xb2bd('0x1d')]===_0xb2bd('0x1e');var _0x5b632d=_0x315ecc[_0xb2bd('0x1f')];var _0x380089=_0x2091d2?0x0:_0x23c440[_0xb2bd('0x1c')];var _0x315815=_0x2091d2?_0x315ecc['count']:_0x23c440[_0xb2bd('0x1c')]+_0x23c440[_0xb2bd('0x1d')];var _0x58b3b9;if(_0x315815>=_0x5b632d){_0x315815=_0x5b632d;_0x58b3b9=0xc8;}else{_0x58b3b9=0xce;}_0x47d679[_0xb2bd('0x1a')](_0x58b3b9);return _0x47d679[_0xb2bd('0x20')]('Content-Range',_0x380089+'-'+_0x315815+'/'+_0x5b632d)['json'](_0x315ecc);}return null;};}function patchUpdates(_0x51c595){return function(_0x31a69f){try{jsonpatch['apply'](_0x31a69f,_0x51c595,!![]);}catch(_0x33dfdc){return BPromise['reject'](_0x33dfdc);}return _0x31a69f[_0xb2bd('0x21')]();};}function saveUpdates(_0x25b331,_0x505c35){return function(_0x246f71){if(_0x246f71){return _0x246f71['update'](_0x25b331)[_0xb2bd('0x22')](function(_0x24e202){return _0x24e202;});}return null;};}function removeEntity(_0x2d281c,_0x7517de){return function(_0x5665ae){if(_0x5665ae){return _0x5665ae[_0xb2bd('0x23')]()[_0xb2bd('0x22')](function(){_0x2d281c[_0xb2bd('0x1a')](0xcc)[_0xb2bd('0x24')]();});}};}function handleEntityNotFound(_0x42109f,_0x284da5){return function(_0x5fd563){if(!_0x5fd563){_0x42109f['sendStatus'](0x194);}return _0x5fd563;};}function handleError(_0x2d0bf3,_0x18859a){_0x18859a=_0x18859a||0x1f4;return function(_0xdba731){logger[_0xb2bd('0x25')](_0xdba731[_0xb2bd('0x26')]);if(_0xdba731[_0xb2bd('0x27')]){delete _0xdba731[_0xb2bd('0x27')];}_0x2d0bf3['status'](_0x18859a)[_0xb2bd('0x28')](_0xdba731);};}exports['index']=function(_0x3917e5,_0x5a7a7c){var _0xbfae89={},_0x41ba8f={},_0x65211d={'count':0x0,'rows':[]};var _0x5628c3=_[_0xb2bd('0x29')](db[_0xb2bd('0x2a')][_0xb2bd('0x2b')],function(_0x4633e1){return{'name':_0x4633e1[_0xb2bd('0x2c')],'type':_0x4633e1[_0xb2bd('0x2d')]['key']};});_0x41ba8f['model']=_[_0xb2bd('0x29')](_0x5628c3,'name');_0x41ba8f[_0xb2bd('0x2e')]=_[_0xb2bd('0x2f')](_0x3917e5[_0xb2bd('0x2e')]);_0x41ba8f['filters']=_[_0xb2bd('0x30')](_0x41ba8f[_0xb2bd('0x31')],_0x41ba8f[_0xb2bd('0x2e')]);_0xbfae89[_0xb2bd('0x32')]=_[_0xb2bd('0x30')](_0x41ba8f[_0xb2bd('0x31')],qs[_0xb2bd('0x33')](_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x33')]));_0xbfae89[_0xb2bd('0x32')]=_0xbfae89['attributes'][_0xb2bd('0x34')]?_0xbfae89[_0xb2bd('0x32')]:_0x41ba8f[_0xb2bd('0x31')];if(!_0x3917e5[_0xb2bd('0x2e')]['hasOwnProperty'](_0xb2bd('0x35'))){_0xbfae89[_0xb2bd('0x1d')]=qs[_0xb2bd('0x1d')](_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x1d')]);_0xbfae89['offset']=qs['offset'](_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x1c')]);}_0xbfae89[_0xb2bd('0x36')]=qs[_0xb2bd('0x37')](_0x3917e5[_0xb2bd('0x2e')]['sort']);_0xbfae89[_0xb2bd('0x38')]=qs[_0xb2bd('0x39')](_[_0xb2bd('0x3a')](_0x3917e5[_0xb2bd('0x2e')],_0x41ba8f[_0xb2bd('0x39')]),_0x5628c3);if(_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x3b')]){_0xbfae89[_0xb2bd('0x38')]=_[_0xb2bd('0x3c')](_0xbfae89[_0xb2bd('0x38')],{'$or':_[_0xb2bd('0x29')](_0x5628c3,function(_0x6ac71c){if(_0x6ac71c[_0xb2bd('0x2d')]!=='VIRTUAL'){var _0x7bc3b8={};_0x7bc3b8[_0x6ac71c[_0xb2bd('0x27')]]={'$like':'%'+_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x3b')]+'%'};return _0x7bc3b8;}})});}_0xbfae89=_[_0xb2bd('0x3c')]({},_0xbfae89,_0x3917e5[_0xb2bd('0x3d')]);var _0x342296={'where':_0xbfae89[_0xb2bd('0x38')]};return db['FaxQueueReport']['count'](_0x342296)[_0xb2bd('0x22')](function(_0x13c541){_0x65211d['count']=_0x13c541;if(_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x3e')]){_0xbfae89[_0xb2bd('0x3f')]=[{'all':!![]}];}return db[_0xb2bd('0x2a')]['findAll'](_0xbfae89);})[_0xb2bd('0x22')](function(_0x1a5a4f){_0x65211d[_0xb2bd('0x40')]=_0x1a5a4f;return _0x65211d;})['then'](respondWithFilteredResult(_0x5a7a7c,_0xbfae89))[_0xb2bd('0x41')](handleError(_0x5a7a7c,null));};exports[_0xb2bd('0x42')]=function(_0x514e37,_0xbbfd15){var _0x5c316f={'raw':!![],'where':{'id':_0x514e37[_0xb2bd('0x43')]['id']}},_0x285599={};_0x285599['model']=_[_0xb2bd('0x2f')](db[_0xb2bd('0x2a')][_0xb2bd('0x2b')]);_0x285599[_0xb2bd('0x2e')]=_[_0xb2bd('0x2f')](_0x514e37['query']);_0x285599[_0xb2bd('0x39')]=_[_0xb2bd('0x30')](_0x285599[_0xb2bd('0x31')],_0x285599[_0xb2bd('0x2e')]);_0x5c316f[_0xb2bd('0x32')]=_[_0xb2bd('0x30')](_0x285599[_0xb2bd('0x31')],qs[_0xb2bd('0x33')](_0x514e37[_0xb2bd('0x2e')][_0xb2bd('0x33')]));_0x5c316f['attributes']=_0x5c316f[_0xb2bd('0x32')][_0xb2bd('0x34')]?_0x5c316f[_0xb2bd('0x32')]:_0x285599[_0xb2bd('0x31')];if(_0x514e37[_0xb2bd('0x2e')]['includeAll']){_0x5c316f[_0xb2bd('0x3f')]=[{'all':!![]}];}_0x5c316f=_[_0xb2bd('0x3c')]({},_0x5c316f,_0x514e37['options']);return db[_0xb2bd('0x2a')]['find'](_0x5c316f)[_0xb2bd('0x22')](handleEntityNotFound(_0xbbfd15,null))[_0xb2bd('0x22')](respondWithResult(_0xbbfd15,null))[_0xb2bd('0x41')](handleError(_0xbbfd15,null));};exports[_0xb2bd('0x44')]=function(_0x3d4b20,_0x4a35f4){return db[_0xb2bd('0x2a')][_0xb2bd('0x44')](_0x3d4b20['body'],{})[_0xb2bd('0x22')](respondWithResult(_0x4a35f4,0xc9))['catch'](handleError(_0x4a35f4,null));};exports[_0xb2bd('0x45')]=function(_0x4021cb,_0x311ab8){if(_0x4021cb[_0xb2bd('0x46')]['id']){delete _0x4021cb[_0xb2bd('0x46')]['id'];}return db[_0xb2bd('0x2a')][_0xb2bd('0x47')]({'where':{'id':_0x4021cb[_0xb2bd('0x43')]['id']}})[_0xb2bd('0x22')](handleEntityNotFound(_0x311ab8,null))[_0xb2bd('0x22')](saveUpdates(_0x4021cb[_0xb2bd('0x46')],null))[_0xb2bd('0x22')](respondWithResult(_0x311ab8,null))[_0xb2bd('0x41')](handleError(_0x311ab8,null));};exports[_0xb2bd('0x23')]=function(_0x448f29,_0x5037d4){return db['FaxQueueReport'][_0xb2bd('0x47')]({'where':{'id':_0x448f29['params']['id']}})[_0xb2bd('0x22')](handleEntityNotFound(_0x5037d4,null))['then'](removeEntity(_0x5037d4,null))[_0xb2bd('0x41')](handleError(_0x5037d4,null));};exports[_0xb2bd('0x48')]=function(_0x220144,_0x4b65a9){return db['FaxQueueReport'][_0xb2bd('0x48')]()[_0xb2bd('0x22')](respondWithResult(_0x4b65a9,null))[_0xb2bd('0x41')](handleError(_0x4b65a9,null));}; \ No newline at end of file +var _0x0ba7=['sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FaxQueueReport','fieldName','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','include','options','find','catch','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x0ba7,0x16d));var _0x70ba=function(_0x238d75,_0x50ea04){_0x238d75=_0x238d75-0x0;var _0x5ba459=_0x0ba7[_0x238d75];return _0x5ba459;};'use strict';var emlformat=require(_0x70ba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x70ba('0x1'));var jsonpatch=require(_0x70ba('0x2'));var rp=require(_0x70ba('0x3'));var moment=require(_0x70ba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x70ba('0x5'));var util=require(_0x70ba('0x6'));var path=require(_0x70ba('0x7'));var sox=require(_0x70ba('0x8'));var csv=require(_0x70ba('0x9'));var ejs=require(_0x70ba('0xa'));var fs=require('fs');var fs_extra=require(_0x70ba('0xb'));var _=require(_0x70ba('0xc'));var squel=require(_0x70ba('0xd'));var crypto=require(_0x70ba('0xe'));var jsforce=require(_0x70ba('0xf'));var deskjs=require(_0x70ba('0x10'));var toCsv=require(_0x70ba('0x9'));var querystring=require(_0x70ba('0x11'));var Papa=require(_0x70ba('0x12'));var Redis=require('ioredis');var authService=require(_0x70ba('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x70ba('0x14'));var hardwareService=require(_0x70ba('0x15'));var logger=require(_0x70ba('0x16'))(_0x70ba('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x70ba('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd6580e,_0x5e94c7){_0x5e94c7=_0x5e94c7||0xcc;return function(_0x285dad){if(_0x285dad){return _0xd6580e[_0x70ba('0x19')](_0x5e94c7);}return _0xd6580e['status'](_0x5e94c7)[_0x70ba('0x1a')]();};}function respondWithResult(_0x57d84e,_0x51321d){_0x51321d=_0x51321d||0xc8;return function(_0x2728e1){if(_0x2728e1){return _0x57d84e[_0x70ba('0x1b')](_0x51321d)[_0x70ba('0x1c')](_0x2728e1);}};}function respondWithFilteredResult(_0x2516fd,_0x29734b){return function(_0x232138){if(_0x232138){var _0x164521=typeof _0x29734b[_0x70ba('0x1d')]===_0x70ba('0x1e')&&typeof _0x29734b[_0x70ba('0x1f')]===_0x70ba('0x1e');var _0x3a52a8=_0x232138[_0x70ba('0x20')];var _0x5ed907=_0x164521?0x0:_0x29734b['offset'];var _0x489cf9=_0x164521?_0x232138[_0x70ba('0x20')]:_0x29734b[_0x70ba('0x1d')]+_0x29734b[_0x70ba('0x1f')];var _0xb4dad;if(_0x489cf9>=_0x3a52a8){_0x489cf9=_0x3a52a8;_0xb4dad=0xc8;}else{_0xb4dad=0xce;}_0x2516fd[_0x70ba('0x1b')](_0xb4dad);return _0x2516fd[_0x70ba('0x21')](_0x70ba('0x22'),_0x5ed907+'-'+_0x489cf9+'/'+_0x3a52a8)[_0x70ba('0x1c')](_0x232138);}return null;};}function patchUpdates(_0x415879){return function(_0x40b82c){try{jsonpatch[_0x70ba('0x23')](_0x40b82c,_0x415879,!![]);}catch(_0x221529){return BPromise[_0x70ba('0x24')](_0x221529);}return _0x40b82c[_0x70ba('0x25')]();};}function saveUpdates(_0x273ce4,_0x5ebe9d){return function(_0x3b31ef){if(_0x3b31ef){return _0x3b31ef[_0x70ba('0x26')](_0x273ce4)['then'](function(_0x123b0c){return _0x123b0c;});}return null;};}function removeEntity(_0x5519d4,_0x4868a1){return function(_0x112aeb){if(_0x112aeb){return _0x112aeb['destroy']()[_0x70ba('0x27')](function(){_0x5519d4[_0x70ba('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf403fc,_0x4ef847){return function(_0x5ad828){if(!_0x5ad828){_0xf403fc[_0x70ba('0x19')](0x194);}return _0x5ad828;};}function handleError(_0x47ae00,_0x230d11){_0x230d11=_0x230d11||0x1f4;return function(_0x441fed){logger[_0x70ba('0x28')](_0x441fed[_0x70ba('0x29')]);if(_0x441fed[_0x70ba('0x2a')]){delete _0x441fed[_0x70ba('0x2a')];}_0x47ae00['status'](_0x230d11)[_0x70ba('0x2b')](_0x441fed);};}exports[_0x70ba('0x2c')]=function(_0x797467,_0x5179c6){var _0x445fe5={},_0x51b5cb={},_0x5955dc={'count':0x0,'rows':[]};var _0x505f98=_[_0x70ba('0x2d')](db[_0x70ba('0x2e')]['rawAttributes'],function(_0x51b3e3){return{'name':_0x51b3e3[_0x70ba('0x2f')],'type':_0x51b3e3['type'][_0x70ba('0x30')]};});_0x51b5cb[_0x70ba('0x31')]=_[_0x70ba('0x2d')](_0x505f98,_0x70ba('0x2a'));_0x51b5cb[_0x70ba('0x32')]=_[_0x70ba('0x33')](_0x797467[_0x70ba('0x32')]);_0x51b5cb[_0x70ba('0x34')]=_[_0x70ba('0x35')](_0x51b5cb[_0x70ba('0x31')],_0x51b5cb[_0x70ba('0x32')]);_0x445fe5['attributes']=_['intersection'](_0x51b5cb[_0x70ba('0x31')],qs[_0x70ba('0x36')](_0x797467[_0x70ba('0x32')]['fields']));_0x445fe5['attributes']=_0x445fe5['attributes'][_0x70ba('0x37')]?_0x445fe5[_0x70ba('0x38')]:_0x51b5cb[_0x70ba('0x31')];if(!_0x797467['query'][_0x70ba('0x39')]('nolimit')){_0x445fe5['limit']=qs[_0x70ba('0x1f')](_0x797467['query'][_0x70ba('0x1f')]);_0x445fe5[_0x70ba('0x1d')]=qs['offset'](_0x797467[_0x70ba('0x32')][_0x70ba('0x1d')]);}_0x445fe5[_0x70ba('0x3a')]=qs['sort'](_0x797467[_0x70ba('0x32')][_0x70ba('0x3b')]);_0x445fe5[_0x70ba('0x3c')]=qs[_0x70ba('0x34')](_['pick'](_0x797467[_0x70ba('0x32')],_0x51b5cb['filters']),_0x505f98);if(_0x797467[_0x70ba('0x32')][_0x70ba('0x3d')]){_0x445fe5[_0x70ba('0x3c')]=_[_0x70ba('0x3e')](_0x445fe5[_0x70ba('0x3c')],{'$or':_[_0x70ba('0x2d')](_0x505f98,function(_0x377e61){if(_0x377e61['type']!==_0x70ba('0x3f')){var _0x382c3e={};_0x382c3e[_0x377e61[_0x70ba('0x2a')]]={'$like':'%'+_0x797467[_0x70ba('0x32')][_0x70ba('0x3d')]+'%'};return _0x382c3e;}})});}_0x445fe5=_[_0x70ba('0x3e')]({},_0x445fe5,_0x797467['options']);var _0x452208={'where':_0x445fe5[_0x70ba('0x3c')]};return db[_0x70ba('0x2e')]['count'](_0x452208)['then'](function(_0x5ee9b1){_0x5955dc[_0x70ba('0x20')]=_0x5ee9b1;if(_0x797467[_0x70ba('0x32')][_0x70ba('0x40')]){_0x445fe5['include']=[{'all':!![]}];}return db[_0x70ba('0x2e')][_0x70ba('0x41')](_0x445fe5);})[_0x70ba('0x27')](function(_0x42c1bd){_0x5955dc[_0x70ba('0x42')]=_0x42c1bd;return _0x5955dc;})['then'](respondWithFilteredResult(_0x5179c6,_0x445fe5))['catch'](handleError(_0x5179c6,null));};exports[_0x70ba('0x43')]=function(_0x3f2bb7,_0x3bdd66){var _0x5a1edb={'raw':!![],'where':{'id':_0x3f2bb7[_0x70ba('0x44')]['id']}},_0x595645={};_0x595645['model']=_[_0x70ba('0x33')](db[_0x70ba('0x2e')][_0x70ba('0x45')]);_0x595645[_0x70ba('0x32')]=_[_0x70ba('0x33')](_0x3f2bb7['query']);_0x595645[_0x70ba('0x34')]=_[_0x70ba('0x35')](_0x595645[_0x70ba('0x31')],_0x595645[_0x70ba('0x32')]);_0x5a1edb[_0x70ba('0x38')]=_[_0x70ba('0x35')](_0x595645[_0x70ba('0x31')],qs[_0x70ba('0x36')](_0x3f2bb7[_0x70ba('0x32')][_0x70ba('0x36')]));_0x5a1edb[_0x70ba('0x38')]=_0x5a1edb[_0x70ba('0x38')][_0x70ba('0x37')]?_0x5a1edb[_0x70ba('0x38')]:_0x595645[_0x70ba('0x31')];if(_0x3f2bb7['query'][_0x70ba('0x40')]){_0x5a1edb[_0x70ba('0x46')]=[{'all':!![]}];}_0x5a1edb=_['merge']({},_0x5a1edb,_0x3f2bb7[_0x70ba('0x47')]);return db[_0x70ba('0x2e')][_0x70ba('0x48')](_0x5a1edb)[_0x70ba('0x27')](handleEntityNotFound(_0x3bdd66,null))[_0x70ba('0x27')](respondWithResult(_0x3bdd66,null))[_0x70ba('0x49')](handleError(_0x3bdd66,null));};exports[_0x70ba('0x4a')]=function(_0x479016,_0x2e2613){return db[_0x70ba('0x2e')][_0x70ba('0x4a')](_0x479016[_0x70ba('0x4b')],{})[_0x70ba('0x27')](respondWithResult(_0x2e2613,0xc9))[_0x70ba('0x49')](handleError(_0x2e2613,null));};exports[_0x70ba('0x26')]=function(_0x400c37,_0xc574b){if(_0x400c37[_0x70ba('0x4b')]['id']){delete _0x400c37[_0x70ba('0x4b')]['id'];}return db[_0x70ba('0x2e')][_0x70ba('0x48')]({'where':{'id':_0x400c37[_0x70ba('0x44')]['id']}})[_0x70ba('0x27')](handleEntityNotFound(_0xc574b,null))[_0x70ba('0x27')](saveUpdates(_0x400c37[_0x70ba('0x4b')],null))['then'](respondWithResult(_0xc574b,null))[_0x70ba('0x49')](handleError(_0xc574b,null));};exports[_0x70ba('0x4c')]=function(_0x2dc3c5,_0x19c99c){return db['FaxQueueReport']['find']({'where':{'id':_0x2dc3c5['params']['id']}})[_0x70ba('0x27')](handleEntityNotFound(_0x19c99c,null))[_0x70ba('0x27')](removeEntity(_0x19c99c,null))['catch'](handleError(_0x19c99c,null));};exports['describe']=function(_0x6a3dc6,_0x29877d){return db[_0x70ba('0x2e')][_0x70ba('0x4d')]()[_0x70ba('0x27')](respondWithResult(_0x29877d,null))[_0x70ba('0x49')](handleError(_0x29877d,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 9104fb1..669f3de 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 _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x14173f,_0xc82c0d){var _0x3b6e79=function(_0x4fe856){while(--_0x4fe856){_0x14173f['push'](_0x14173f['shift']());}};_0x3b6e79(++_0xc82c0d);}(_0x7a54,0x106));var _0x47a5=function(_0x396473,_0x27ae80){_0x396473=_0x396473-0x0;var _0x534d37=_0x7a54[_0x396473];return _0x534d37;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x51a9ce,_0x15affd){var _0xb2af4d=function(_0x43abd4){while(--_0x43abd4){_0x51a9ce['push'](_0x51a9ce['shift']());}};_0xb2af4d(++_0x15affd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 136952a..6653ef2 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 _0x5881=['body','options','raw','then','catch','update','where','attributes','limit','UpdateFaxQueueReport','lodash','moment','randomstring','../../mysqldb','rpc','client','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxQueueReport','FaxQueueReport'];(function(_0x2e2292,_0x1891b8){var _0x4f77ab=function(_0x3e5cb6){while(--_0x3e5cb6){_0x2e2292['push'](_0x2e2292['shift']());}};_0x4f77ab(++_0x1891b8);}(_0x5881,0x1a0));var _0x1588=function(_0x498b5a,_0x4788b2){_0x498b5a=_0x498b5a-0x0;var _0x347811=_0x5881[_0x498b5a];return _0x347811;};'use strict';var _=require(_0x1588('0x0'));var util=require('util');var moment=require(_0x1588('0x1'));var BPromise=require('bluebird');var rs=require(_0x1588('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1588('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1588('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1588('0x5')][_0x1588('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4f463e,_0x46f297,_0x3846fb){return new BPromise(function(_0x1e9532,_0x4d16e9){return client['request'](_0x4f463e,_0x3846fb)['then'](function(_0x56fb97){logger[_0x1588('0x7')](_0x1588('0x8'),_0x46f297,_0x1588('0x9'));logger[_0x1588('0xa')](_0x1588('0xb'),_0x46f297,_0x1588('0x9'),JSON[_0x1588('0xc')](_0x56fb97));if(_0x56fb97['error']){if(_0x56fb97[_0x1588('0xd')][_0x1588('0xe')]===0x1f4){logger[_0x1588('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x46f297,_0x56fb97[_0x1588('0xd')]['message']);return _0x4d16e9(_0x56fb97[_0x1588('0xd')]['message']);}logger['error'](_0x1588('0x8'),_0x46f297,_0x56fb97['error'][_0x1588('0xf')]);return _0x1e9532(_0x56fb97[_0x1588('0xd')][_0x1588('0xf')]);}else{logger[_0x1588('0x7')]('FaxQueueReport,\x20%s,\x20%s',_0x46f297,'request\x20sent');_0x1e9532(_0x56fb97[_0x1588('0x10')][_0x1588('0xf')]);}})['catch'](function(_0x2b094d){logger['error'](_0x1588('0x8'),_0x46f297,_0x2b094d);_0x4d16e9(_0x2b094d);});});}exports[_0x1588('0x11')]=function(_0x4a455e){var _0x175a8c=this;return new Promise(function(_0x376182,_0x1cbada){return db[_0x1588('0x12')]['create'](_0x4a455e[_0x1588('0x13')],{'raw':_0x4a455e[_0x1588('0x14')]?_0x4a455e['options'][_0x1588('0x15')]===undefined?!![]:![]:!![]})[_0x1588('0x16')](function(_0xe53fd7){logger[_0x1588('0x7')](_0x1588('0x11'),_0x4a455e);logger[_0x1588('0xa')]('CreateFaxQueueReport',_0x4a455e,JSON[_0x1588('0xc')](_0xe53fd7));_0x376182(_0xe53fd7);})[_0x1588('0x17')](function(_0x4eea06){logger[_0x1588('0xd')](_0x1588('0x11'),_0x4eea06[_0x1588('0xf')],_0x4a455e);_0x1cbada(_0x175a8c[_0x1588('0xd')](0x1f4,_0x4eea06[_0x1588('0xf')]));});});};exports['UpdateFaxQueueReport']=function(_0x137a8b){var _0x52ebf3=this;return new Promise(function(_0xe59dd9,_0x24d814){return db[_0x1588('0x12')][_0x1588('0x18')](_0x137a8b[_0x1588('0x13')],{'raw':_0x137a8b[_0x1588('0x14')]?_0x137a8b['options'][_0x1588('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x137a8b[_0x1588('0x14')]?_0x137a8b[_0x1588('0x14')][_0x1588('0x19')]||null:null,'attributes':_0x137a8b[_0x1588('0x14')]?_0x137a8b[_0x1588('0x14')][_0x1588('0x1a')]||null:null,'limit':_0x137a8b[_0x1588('0x14')]?_0x137a8b[_0x1588('0x14')][_0x1588('0x1b')]||null:null})[_0x1588('0x16')](function(_0x23854c){logger[_0x1588('0x7')](_0x1588('0x1c'),_0x137a8b);logger[_0x1588('0xa')](_0x1588('0x1c'),_0x137a8b,JSON[_0x1588('0xc')](_0x23854c));_0xe59dd9(_0x23854c);})['catch'](function(_0x537a12){logger['error']('UpdateFaxQueueReport',_0x537a12[_0x1588('0xf')],_0x137a8b);_0x24d814(_0x52ebf3[_0x1588('0xd')](0x1f4,_0x537a12[_0x1588('0xf')]));});});}; \ No newline at end of file +var _0xe094=['request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','create','body','options','raw','CreateFaxQueueReport','stringify','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x224368,_0x3bcf8e){var _0x3f450c=function(_0x5ecddd){while(--_0x5ecddd){_0x224368['push'](_0x224368['shift']());}};_0x3f450c(++_0x3bcf8e);}(_0xe094,0x1a3));var _0x4e09=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe094[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x4e09('0x0'));var util=require(_0x4e09('0x1'));var moment=require(_0x4e09('0x2'));var BPromise=require(_0x4e09('0x3'));var rs=require(_0x4e09('0x4'));var fs=require('fs');var Redis=require(_0x4e09('0x5'));var db=require(_0x4e09('0x6'))['db'];var utils=require(_0x4e09('0x7'));var logger=require(_0x4e09('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4e09('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10c91d,_0x54e038,_0x45dd64){return new BPromise(function(_0x18912e,_0x59c11e){return client[_0x4e09('0xa')](_0x10c91d,_0x45dd64)[_0x4e09('0xb')](function(_0x3ae8fd){logger[_0x4e09('0xc')](_0x4e09('0xd'),_0x54e038,'request\x20sent');logger[_0x4e09('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x54e038,_0x4e09('0xf'),JSON['stringify'](_0x3ae8fd));if(_0x3ae8fd[_0x4e09('0x10')]){if(_0x3ae8fd[_0x4e09('0x10')][_0x4e09('0x11')]===0x1f4){logger['error'](_0x4e09('0xd'),_0x54e038,_0x3ae8fd[_0x4e09('0x10')]['message']);return _0x59c11e(_0x3ae8fd[_0x4e09('0x10')][_0x4e09('0x12')]);}logger[_0x4e09('0x10')](_0x4e09('0xd'),_0x54e038,_0x3ae8fd[_0x4e09('0x10')][_0x4e09('0x12')]);return _0x18912e(_0x3ae8fd['error'][_0x4e09('0x12')]);}else{logger['info'](_0x4e09('0xd'),_0x54e038,_0x4e09('0xf'));_0x18912e(_0x3ae8fd[_0x4e09('0x13')][_0x4e09('0x12')]);}})[_0x4e09('0x14')](function(_0x91418){logger[_0x4e09('0x10')](_0x4e09('0xd'),_0x54e038,_0x91418);_0x59c11e(_0x91418);});});}exports['CreateFaxQueueReport']=function(_0x4c5f29){var _0x9421bb=this;return new Promise(function(_0x4471fe,_0x43c2fe){return db['FaxQueueReport'][_0x4e09('0x15')](_0x4c5f29[_0x4e09('0x16')],{'raw':_0x4c5f29[_0x4e09('0x17')]?_0x4c5f29['options'][_0x4e09('0x18')]===undefined?!![]:![]:!![]})[_0x4e09('0xb')](function(_0xedc17e){logger[_0x4e09('0xc')](_0x4e09('0x19'),_0x4c5f29);logger[_0x4e09('0xe')](_0x4e09('0x19'),_0x4c5f29,JSON[_0x4e09('0x1a')](_0xedc17e));_0x4471fe(_0xedc17e);})['catch'](function(_0x2f2003){logger['error']('CreateFaxQueueReport',_0x2f2003[_0x4e09('0x12')],_0x4c5f29);_0x43c2fe(_0x9421bb['error'](0x1f4,_0x2f2003['message']));});});};exports[_0x4e09('0x1b')]=function(_0x2f10ff){var _0x182477=this;return new Promise(function(_0x22d00b,_0x52d717){return db[_0x4e09('0x1c')][_0x4e09('0x1d')](_0x2f10ff[_0x4e09('0x16')],{'raw':_0x2f10ff[_0x4e09('0x17')]?_0x2f10ff[_0x4e09('0x17')][_0x4e09('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f10ff['options']?_0x2f10ff[_0x4e09('0x17')][_0x4e09('0x1e')]||null:null,'attributes':_0x2f10ff[_0x4e09('0x17')]?_0x2f10ff['options'][_0x4e09('0x1f')]||null:null,'limit':_0x2f10ff['options']?_0x2f10ff['options'][_0x4e09('0x20')]||null:null})['then'](function(_0x22e730){logger[_0x4e09('0xc')]('UpdateFaxQueueReport',_0x2f10ff);logger[_0x4e09('0xe')]('UpdateFaxQueueReport',_0x2f10ff,JSON['stringify'](_0x22e730));_0x22d00b(_0x22e730);})['catch'](function(_0x47407e){logger[_0x4e09('0x10')](_0x4e09('0x1b'),_0x47407e[_0x4e09('0x12')],_0x2f10ff);_0x52d717(_0x182477[_0x4e09('0x10')](0x1f4,_0x47407e[_0x4e09('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 3dae8a5..c72aeb2 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 _0xb2b8=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/describe','describe','get','/:id','post','create','delete','destroy','exports','multer','util'];(function(_0x41e91b,_0x36f4bb){var _0x129af5=function(_0x1af78d){while(--_0x1af78d){_0x41e91b['push'](_0x41e91b['shift']());}};_0x129af5(++_0x36f4bb);}(_0xb2b8,0x1b3));var _0x8b2b=function(_0x2b4e3a,_0x31d38b){_0x2b4e3a=_0x2b4e3a-0x0;var _0x233231=_0xb2b8[_0x2b4e3a];return _0x233231;};'use strict';var multer=require(_0x8b2b('0x0'));var util=require(_0x8b2b('0x1'));var path=require(_0x8b2b('0x2'));var timeout=require(_0x8b2b('0x3'));var express=require(_0x8b2b('0x4'));var router=express['Router']();var fs_extra=require(_0x8b2b('0x5'));var auth=require(_0x8b2b('0x6'));var interaction=require(_0x8b2b('0x7'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x8b2b('0x8')](),controller[_0x8b2b('0x9')]);router['get'](_0x8b2b('0xa'),auth['isAuthenticated'](),controller[_0x8b2b('0xb')]);router[_0x8b2b('0xc')](_0x8b2b('0xd'),auth[_0x8b2b('0x8')](),controller['show']);router[_0x8b2b('0xe')]('/',auth[_0x8b2b('0x8')](),controller[_0x8b2b('0xf')]);router['put'](_0x8b2b('0xd'),auth[_0x8b2b('0x8')](),controller['update']);router[_0x8b2b('0x10')]('/:id',auth[_0x8b2b('0x8')](),controller[_0x8b2b('0x11')]);module[_0x8b2b('0x12')]=router; \ No newline at end of file +var _0x01c8=['../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5617e2,_0x1ffcd7){var _0x27b60d=function(_0xf3f7a2){while(--_0xf3f7a2){_0x5617e2['push'](_0x5617e2['shift']());}};_0x27b60d(++_0x1ffcd7);}(_0x01c8,0x139));var _0x801c=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x01c8[_0x5037ab];return _0x512adb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x801c('0x0'));var timeout=require(_0x801c('0x1'));var express=require(_0x801c('0x2'));var router=express[_0x801c('0x3')]();var fs_extra=require(_0x801c('0x4'));var auth=require(_0x801c('0x5'));var interaction=require(_0x801c('0x6'));var config=require(_0x801c('0x7'));var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x801c('0x8')](),controller[_0x801c('0x9')]);router[_0x801c('0xa')]('/describe',auth[_0x801c('0x8')](),controller[_0x801c('0xb')]);router[_0x801c('0xa')](_0x801c('0xc'),auth[_0x801c('0x8')](),controller[_0x801c('0xd')]);router[_0x801c('0xe')]('/',auth[_0x801c('0x8')](),controller[_0x801c('0xf')]);router[_0x801c('0x10')](_0x801c('0xc'),auth[_0x801c('0x8')](),controller[_0x801c('0x11')]);router[_0x801c('0x12')](_0x801c('0xc'),auth[_0x801c('0x8')](),controller[_0x801c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 7a61b5c..1321f35 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x2a0f0e,_0x55b802){var _0x1ea73f=function(_0x4652f0){while(--_0x4652f0){_0x2a0f0e['push'](_0x2a0f0e['shift']());}};_0x1ea73f(++_0x55b802);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0xf3cd[_0x3042c5];return _0x7cd140;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x1476fb,_0x467d01){var _0x44f57e=function(_0x4d7771){while(--_0x4d7771){_0x1476fb['push'](_0x1476fb['shift']());}};_0x44f57e(++_0x467d01);}(_0x54ef,0x112));var _0xf54e=function(_0x3a346f,_0x41709c){_0x3a346f=_0x3a346f-0x0;var _0x4c8340=_0x54ef[_0x3a346f];return _0x4c8340;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index f571076..f2e3751 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 _0xadab=['include','findAll','rows','catch','params','merge','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options'];(function(_0x32ecf5,_0x345f85){var _0xb8b77b=function(_0x31d0da){while(--_0x31d0da){_0x32ecf5['push'](_0x32ecf5['shift']());}};_0xb8b77b(++_0x345f85);}(_0xadab,0x1ca));var _0xbada=function(_0x5cbab1,_0x32afac){_0x5cbab1=_0x5cbab1-0x0;var _0x2637f4=_0xadab[_0x5cbab1];return _0x2637f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbada('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbada('0x1'));var rp=require('request-promise');var moment=require(_0xbada('0x2'));var BPromise=require(_0xbada('0x3'));var Mustache=require(_0xbada('0x4'));var util=require('util');var path=require(_0xbada('0x5'));var sox=require(_0xbada('0x6'));var csv=require('to-csv');var ejs=require(_0xbada('0x7'));var fs=require('fs');var fs_extra=require(_0xbada('0x8'));var _=require(_0xbada('0x9'));var squel=require('squel');var crypto=require(_0xbada('0xa'));var jsforce=require(_0xbada('0xb'));var deskjs=require(_0xbada('0xc'));var toCsv=require(_0xbada('0xd'));var querystring=require(_0xbada('0xe'));var Papa=require(_0xbada('0xf'));var Redis=require(_0xbada('0x10'));var authService=require(_0xbada('0x11'));var qs=require(_0xbada('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbada('0x13'))(_0xbada('0x14'));var utils=require(_0xbada('0x15'));var config=require(_0xbada('0x16'));var licenseUtil=require(_0xbada('0x17'));var db=require(_0xbada('0x18'))['db'];function respondWithStatusCode(_0x5c31d4,_0x92d240){_0x92d240=_0x92d240||0xcc;return function(_0xbcde94){if(_0xbcde94){return _0x5c31d4[_0xbada('0x19')](_0x92d240);}return _0x5c31d4[_0xbada('0x1a')](_0x92d240)['end']();};}function respondWithResult(_0x2bd132,_0x1d4e82){_0x1d4e82=_0x1d4e82||0xc8;return function(_0x3f6d71){if(_0x3f6d71){return _0x2bd132['status'](_0x1d4e82)[_0xbada('0x1b')](_0x3f6d71);}};}function respondWithFilteredResult(_0x4af7e2,_0x3ef4bb){return function(_0x3cf5f7){if(_0x3cf5f7){var _0x905f46=typeof _0x3ef4bb['offset']===_0xbada('0x1c')&&typeof _0x3ef4bb['limit']===_0xbada('0x1c');var _0xd371b0=_0x3cf5f7[_0xbada('0x1d')];var _0x3f60da=_0x905f46?0x0:_0x3ef4bb[_0xbada('0x1e')];var _0x1f2f3b=_0x905f46?_0x3cf5f7['count']:_0x3ef4bb[_0xbada('0x1e')]+_0x3ef4bb[_0xbada('0x1f')];var _0x28f5af;if(_0x1f2f3b>=_0xd371b0){_0x1f2f3b=_0xd371b0;_0x28f5af=0xc8;}else{_0x28f5af=0xce;}_0x4af7e2[_0xbada('0x1a')](_0x28f5af);return _0x4af7e2[_0xbada('0x20')](_0xbada('0x21'),_0x3f60da+'-'+_0x1f2f3b+'/'+_0xd371b0)[_0xbada('0x1b')](_0x3cf5f7);}return null;};}function patchUpdates(_0x38a3e5){return function(_0x840a14){try{jsonpatch[_0xbada('0x22')](_0x840a14,_0x38a3e5,!![]);}catch(_0x49da36){return BPromise[_0xbada('0x23')](_0x49da36);}return _0x840a14['save']();};}function saveUpdates(_0x49840b,_0xf8a086){return function(_0x5e6152){if(_0x5e6152){return _0x5e6152[_0xbada('0x24')](_0x49840b)[_0xbada('0x25')](function(_0x5db98d){return _0x5db98d;});}return null;};}function removeEntity(_0x22214b,_0x3cc749){return function(_0x387d77){if(_0x387d77){return _0x387d77[_0xbada('0x26')]()[_0xbada('0x25')](function(){_0x22214b[_0xbada('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40a805,_0x2616ec){return function(_0x33e33f){if(!_0x33e33f){_0x40a805[_0xbada('0x19')](0x194);}return _0x33e33f;};}function handleError(_0x5e21d7,_0x29955a){_0x29955a=_0x29955a||0x1f4;return function(_0x276cbf){logger[_0xbada('0x27')](_0x276cbf[_0xbada('0x28')]);if(_0x276cbf[_0xbada('0x29')]){delete _0x276cbf[_0xbada('0x29')];}_0x5e21d7[_0xbada('0x1a')](_0x29955a)[_0xbada('0x2a')](_0x276cbf);};}exports[_0xbada('0x2b')]=function(_0x6b7df2,_0x42a674){var _0x271d39={},_0x5ce110={},_0x28e3bb={'count':0x0,'rows':[]};var _0x26efbf=_[_0xbada('0x2c')](db[_0xbada('0x2d')][_0xbada('0x2e')],function(_0x5269b2){return{'name':_0x5269b2[_0xbada('0x2f')],'type':_0x5269b2[_0xbada('0x30')][_0xbada('0x31')]};});_0x5ce110[_0xbada('0x32')]=_[_0xbada('0x2c')](_0x26efbf,_0xbada('0x29'));_0x5ce110[_0xbada('0x33')]=_[_0xbada('0x34')](_0x6b7df2[_0xbada('0x33')]);_0x5ce110[_0xbada('0x35')]=_[_0xbada('0x36')](_0x5ce110[_0xbada('0x32')],_0x5ce110[_0xbada('0x33')]);_0x271d39['attributes']=_['intersection'](_0x5ce110[_0xbada('0x32')],qs[_0xbada('0x37')](_0x6b7df2[_0xbada('0x33')]['fields']));_0x271d39['attributes']=_0x271d39[_0xbada('0x38')][_0xbada('0x39')]?_0x271d39[_0xbada('0x38')]:_0x5ce110[_0xbada('0x32')];if(!_0x6b7df2[_0xbada('0x33')][_0xbada('0x3a')](_0xbada('0x3b'))){_0x271d39[_0xbada('0x1f')]=qs[_0xbada('0x1f')](_0x6b7df2['query'][_0xbada('0x1f')]);_0x271d39[_0xbada('0x1e')]=qs[_0xbada('0x1e')](_0x6b7df2[_0xbada('0x33')][_0xbada('0x1e')]);}_0x271d39[_0xbada('0x3c')]=qs['sort'](_0x6b7df2[_0xbada('0x33')][_0xbada('0x3d')]);_0x271d39[_0xbada('0x3e')]=qs[_0xbada('0x35')](_[_0xbada('0x3f')](_0x6b7df2[_0xbada('0x33')],_0x5ce110[_0xbada('0x35')]),_0x26efbf);if(_0x6b7df2[_0xbada('0x33')][_0xbada('0x40')]){_0x271d39[_0xbada('0x3e')]=_['merge'](_0x271d39['where'],{'$or':_[_0xbada('0x2c')](_0x26efbf,function(_0x463e88){if(_0x463e88[_0xbada('0x30')]!==_0xbada('0x41')){var _0x3ec7dc={};_0x3ec7dc[_0x463e88['name']]={'$like':'%'+_0x6b7df2[_0xbada('0x33')][_0xbada('0x40')]+'%'};return _0x3ec7dc;}})});}_0x271d39=_['merge']({},_0x271d39,_0x6b7df2[_0xbada('0x42')]);var _0x4b9cfc={'where':_0x271d39[_0xbada('0x3e')]};return db[_0xbada('0x2d')][_0xbada('0x1d')](_0x4b9cfc)['then'](function(_0x12af7a){_0x28e3bb[_0xbada('0x1d')]=_0x12af7a;if(_0x6b7df2[_0xbada('0x33')]['includeAll']){_0x271d39[_0xbada('0x43')]=[{'all':!![]}];}return db[_0xbada('0x2d')][_0xbada('0x44')](_0x271d39);})['then'](function(_0x26d2cd){_0x28e3bb[_0xbada('0x45')]=_0x26d2cd;return _0x28e3bb;})[_0xbada('0x25')](respondWithFilteredResult(_0x42a674,_0x271d39))[_0xbada('0x46')](handleError(_0x42a674,null));};exports['show']=function(_0x45067a,_0x1e5c57){var _0x335dcf={'raw':!![],'where':{'id':_0x45067a[_0xbada('0x47')]['id']}},_0x1eacec={};_0x1eacec[_0xbada('0x32')]=_[_0xbada('0x34')](db['FaxTransferReport'][_0xbada('0x2e')]);_0x1eacec['query']=_[_0xbada('0x34')](_0x45067a[_0xbada('0x33')]);_0x1eacec['filters']=_['intersection'](_0x1eacec[_0xbada('0x32')],_0x1eacec[_0xbada('0x33')]);_0x335dcf[_0xbada('0x38')]=_[_0xbada('0x36')](_0x1eacec[_0xbada('0x32')],qs[_0xbada('0x37')](_0x45067a[_0xbada('0x33')][_0xbada('0x37')]));_0x335dcf[_0xbada('0x38')]=_0x335dcf[_0xbada('0x38')][_0xbada('0x39')]?_0x335dcf[_0xbada('0x38')]:_0x1eacec[_0xbada('0x32')];if(_0x45067a[_0xbada('0x33')]['includeAll']){_0x335dcf[_0xbada('0x43')]=[{'all':!![]}];}_0x335dcf=_[_0xbada('0x48')]({},_0x335dcf,_0x45067a[_0xbada('0x42')]);return db[_0xbada('0x2d')]['find'](_0x335dcf)['then'](handleEntityNotFound(_0x1e5c57,null))[_0xbada('0x25')](respondWithResult(_0x1e5c57,null))['catch'](handleError(_0x1e5c57,null));};exports['create']=function(_0x1010fd,_0x28e26f){return db[_0xbada('0x2d')]['create'](_0x1010fd['body'],{})[_0xbada('0x25')](respondWithResult(_0x28e26f,0xc9))[_0xbada('0x46')](handleError(_0x28e26f,null));};exports[_0xbada('0x24')]=function(_0xd7d1ea,_0x514c84){if(_0xd7d1ea[_0xbada('0x49')]['id']){delete _0xd7d1ea[_0xbada('0x49')]['id'];}return db[_0xbada('0x2d')]['find']({'where':{'id':_0xd7d1ea['params']['id']}})['then'](handleEntityNotFound(_0x514c84,null))[_0xbada('0x25')](saveUpdates(_0xd7d1ea['body'],null))[_0xbada('0x25')](respondWithResult(_0x514c84,null))[_0xbada('0x46')](handleError(_0x514c84,null));};exports[_0xbada('0x26')]=function(_0xee2361,_0x356dda){return db[_0xbada('0x2d')]['find']({'where':{'id':_0xee2361[_0xbada('0x47')]['id']}})[_0xbada('0x25')](handleEntityNotFound(_0x356dda,null))[_0xbada('0x25')](removeEntity(_0x356dda,null))['catch'](handleError(_0x356dda,null));};exports[_0xbada('0x4a')]=function(_0xa99edc,_0x1826a8){return db[_0xbada('0x2d')]['describe']()['then'](respondWithResult(_0x1826a8,null))['catch'](handleError(_0x1826a8,null));}; \ No newline at end of file +var _0x57fb=['offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','FaxTransferReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x5e1fea,_0x386dd3){var _0x445f4c=function(_0x2516c4){while(--_0x2516c4){_0x5e1fea['push'](_0x5e1fea['shift']());}};_0x445f4c(++_0x386dd3);}(_0x57fb,0x157));var _0xb57f=function(_0x49bb12,_0x17dbce){_0x49bb12=_0x49bb12-0x0;var _0x2b28eb=_0x57fb[_0x49bb12];return _0x2b28eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb57f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb57f('0x1'));var rp=require(_0xb57f('0x2'));var moment=require(_0xb57f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb57f('0x4'));var util=require(_0xb57f('0x5'));var path=require(_0xb57f('0x6'));var sox=require(_0xb57f('0x7'));var csv=require(_0xb57f('0x8'));var ejs=require(_0xb57f('0x9'));var fs=require('fs');var fs_extra=require(_0xb57f('0xa'));var _=require(_0xb57f('0xb'));var squel=require('squel');var crypto=require(_0xb57f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb57f('0xd'));var toCsv=require(_0xb57f('0x8'));var querystring=require(_0xb57f('0xe'));var Papa=require('papaparse');var Redis=require(_0xb57f('0xf'));var authService=require(_0xb57f('0x10'));var qs=require(_0xb57f('0x11'));var as=require(_0xb57f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb57f('0x13'))('api');var utils=require(_0xb57f('0x14'));var config=require(_0xb57f('0x15'));var licenseUtil=require(_0xb57f('0x16'));var db=require(_0xb57f('0x17'))['db'];function respondWithStatusCode(_0x11ff88,_0x5c4698){_0x5c4698=_0x5c4698||0xcc;return function(_0x207cf8){if(_0x207cf8){return _0x11ff88[_0xb57f('0x18')](_0x5c4698);}return _0x11ff88['status'](_0x5c4698)[_0xb57f('0x19')]();};}function respondWithResult(_0x31739c,_0x45cf6d){_0x45cf6d=_0x45cf6d||0xc8;return function(_0x445636){if(_0x445636){return _0x31739c[_0xb57f('0x1a')](_0x45cf6d)['json'](_0x445636);}};}function respondWithFilteredResult(_0xd5ab9a,_0x539546){return function(_0x35137b){if(_0x35137b){var _0x15ee6f=typeof _0x539546[_0xb57f('0x1b')]===_0xb57f('0x1c')&&typeof _0x539546[_0xb57f('0x1d')]===_0xb57f('0x1c');var _0x34b725=_0x35137b[_0xb57f('0x1e')];var _0x9d672c=_0x15ee6f?0x0:_0x539546[_0xb57f('0x1b')];var _0x5488f1=_0x15ee6f?_0x35137b[_0xb57f('0x1e')]:_0x539546[_0xb57f('0x1b')]+_0x539546['limit'];var _0x2eee79;if(_0x5488f1>=_0x34b725){_0x5488f1=_0x34b725;_0x2eee79=0xc8;}else{_0x2eee79=0xce;}_0xd5ab9a[_0xb57f('0x1a')](_0x2eee79);return _0xd5ab9a['set'](_0xb57f('0x1f'),_0x9d672c+'-'+_0x5488f1+'/'+_0x34b725)[_0xb57f('0x20')](_0x35137b);}return null;};}function patchUpdates(_0x24cf7c){return function(_0x175cdc){try{jsonpatch['apply'](_0x175cdc,_0x24cf7c,!![]);}catch(_0x18a33b){return BPromise[_0xb57f('0x21')](_0x18a33b);}return _0x175cdc[_0xb57f('0x22')]();};}function saveUpdates(_0x5dd1ce,_0x329ce5){return function(_0x50fbe6){if(_0x50fbe6){return _0x50fbe6[_0xb57f('0x23')](_0x5dd1ce)[_0xb57f('0x24')](function(_0x4c0f60){return _0x4c0f60;});}return null;};}function removeEntity(_0x311588,_0x1ffa92){return function(_0x1887ae){if(_0x1887ae){return _0x1887ae[_0xb57f('0x25')]()[_0xb57f('0x24')](function(){_0x311588[_0xb57f('0x1a')](0xcc)[_0xb57f('0x19')]();});}};}function handleEntityNotFound(_0x4a4673,_0x589d44){return function(_0x549bc8){if(!_0x549bc8){_0x4a4673['sendStatus'](0x194);}return _0x549bc8;};}function handleError(_0x1d7ac8,_0x2bc92c){_0x2bc92c=_0x2bc92c||0x1f4;return function(_0x5916ad){logger[_0xb57f('0x26')](_0x5916ad[_0xb57f('0x27')]);if(_0x5916ad[_0xb57f('0x28')]){delete _0x5916ad[_0xb57f('0x28')];}_0x1d7ac8[_0xb57f('0x1a')](_0x2bc92c)[_0xb57f('0x29')](_0x5916ad);};}exports[_0xb57f('0x2a')]=function(_0xc695cf,_0x36efe9){var _0x1e999a={},_0x1a5f9e={},_0x4efedc={'count':0x0,'rows':[]};var _0x36164b=_['map'](db[_0xb57f('0x2b')][_0xb57f('0x2c')],function(_0x1269cb){return{'name':_0x1269cb[_0xb57f('0x2d')],'type':_0x1269cb['type'][_0xb57f('0x2e')]};});_0x1a5f9e[_0xb57f('0x2f')]=_[_0xb57f('0x30')](_0x36164b,_0xb57f('0x28'));_0x1a5f9e[_0xb57f('0x31')]=_['keys'](_0xc695cf[_0xb57f('0x31')]);_0x1a5f9e[_0xb57f('0x32')]=_[_0xb57f('0x33')](_0x1a5f9e[_0xb57f('0x2f')],_0x1a5f9e[_0xb57f('0x31')]);_0x1e999a[_0xb57f('0x34')]=_[_0xb57f('0x33')](_0x1a5f9e[_0xb57f('0x2f')],qs['fields'](_0xc695cf['query'][_0xb57f('0x35')]));_0x1e999a[_0xb57f('0x34')]=_0x1e999a['attributes'][_0xb57f('0x36')]?_0x1e999a[_0xb57f('0x34')]:_0x1a5f9e[_0xb57f('0x2f')];if(!_0xc695cf['query'][_0xb57f('0x37')]('nolimit')){_0x1e999a[_0xb57f('0x1d')]=qs[_0xb57f('0x1d')](_0xc695cf['query'][_0xb57f('0x1d')]);_0x1e999a[_0xb57f('0x1b')]=qs['offset'](_0xc695cf[_0xb57f('0x31')][_0xb57f('0x1b')]);}_0x1e999a[_0xb57f('0x38')]=qs['sort'](_0xc695cf['query'][_0xb57f('0x39')]);_0x1e999a[_0xb57f('0x3a')]=qs[_0xb57f('0x32')](_[_0xb57f('0x3b')](_0xc695cf[_0xb57f('0x31')],_0x1a5f9e[_0xb57f('0x32')]),_0x36164b);if(_0xc695cf[_0xb57f('0x31')][_0xb57f('0x3c')]){_0x1e999a['where']=_[_0xb57f('0x3d')](_0x1e999a['where'],{'$or':_['map'](_0x36164b,function(_0x2b6378){if(_0x2b6378['type']!==_0xb57f('0x3e')){var _0x2226ad={};_0x2226ad[_0x2b6378['name']]={'$like':'%'+_0xc695cf[_0xb57f('0x31')][_0xb57f('0x3c')]+'%'};return _0x2226ad;}})});}_0x1e999a=_[_0xb57f('0x3d')]({},_0x1e999a,_0xc695cf[_0xb57f('0x3f')]);var _0x48cde5={'where':_0x1e999a[_0xb57f('0x3a')]};return db[_0xb57f('0x2b')][_0xb57f('0x1e')](_0x48cde5)[_0xb57f('0x24')](function(_0x1ed121){_0x4efedc[_0xb57f('0x1e')]=_0x1ed121;if(_0xc695cf['query']['includeAll']){_0x1e999a['include']=[{'all':!![]}];}return db[_0xb57f('0x2b')][_0xb57f('0x40')](_0x1e999a);})[_0xb57f('0x24')](function(_0x3affbe){_0x4efedc[_0xb57f('0x41')]=_0x3affbe;return _0x4efedc;})[_0xb57f('0x24')](respondWithFilteredResult(_0x36efe9,_0x1e999a))[_0xb57f('0x42')](handleError(_0x36efe9,null));};exports[_0xb57f('0x43')]=function(_0x24e4c1,_0x3f096a){var _0x4149b1={'raw':!![],'where':{'id':_0x24e4c1[_0xb57f('0x44')]['id']}},_0x43f3b7={};_0x43f3b7[_0xb57f('0x2f')]=_[_0xb57f('0x45')](db[_0xb57f('0x2b')][_0xb57f('0x2c')]);_0x43f3b7[_0xb57f('0x31')]=_[_0xb57f('0x45')](_0x24e4c1['query']);_0x43f3b7[_0xb57f('0x32')]=_[_0xb57f('0x33')](_0x43f3b7[_0xb57f('0x2f')],_0x43f3b7[_0xb57f('0x31')]);_0x4149b1[_0xb57f('0x34')]=_[_0xb57f('0x33')](_0x43f3b7['model'],qs[_0xb57f('0x35')](_0x24e4c1[_0xb57f('0x31')]['fields']));_0x4149b1[_0xb57f('0x34')]=_0x4149b1['attributes'][_0xb57f('0x36')]?_0x4149b1[_0xb57f('0x34')]:_0x43f3b7[_0xb57f('0x2f')];if(_0x24e4c1[_0xb57f('0x31')]['includeAll']){_0x4149b1['include']=[{'all':!![]}];}_0x4149b1=_['merge']({},_0x4149b1,_0x24e4c1[_0xb57f('0x3f')]);return db['FaxTransferReport'][_0xb57f('0x46')](_0x4149b1)[_0xb57f('0x24')](handleEntityNotFound(_0x3f096a,null))[_0xb57f('0x24')](respondWithResult(_0x3f096a,null))['catch'](handleError(_0x3f096a,null));};exports[_0xb57f('0x47')]=function(_0x46721c,_0x2c5abf){return db['FaxTransferReport'][_0xb57f('0x47')](_0x46721c[_0xb57f('0x48')],{})[_0xb57f('0x24')](respondWithResult(_0x2c5abf,0xc9))[_0xb57f('0x42')](handleError(_0x2c5abf,null));};exports[_0xb57f('0x23')]=function(_0x4cd3ad,_0x3aa6b1){if(_0x4cd3ad[_0xb57f('0x48')]['id']){delete _0x4cd3ad[_0xb57f('0x48')]['id'];}return db[_0xb57f('0x2b')]['find']({'where':{'id':_0x4cd3ad[_0xb57f('0x44')]['id']}})[_0xb57f('0x24')](handleEntityNotFound(_0x3aa6b1,null))[_0xb57f('0x24')](saveUpdates(_0x4cd3ad['body'],null))['then'](respondWithResult(_0x3aa6b1,null))[_0xb57f('0x42')](handleError(_0x3aa6b1,null));};exports[_0xb57f('0x25')]=function(_0x315a3c,_0x82a4c3){return db['FaxTransferReport']['find']({'where':{'id':_0x315a3c[_0xb57f('0x44')]['id']}})['then'](handleEntityNotFound(_0x82a4c3,null))[_0xb57f('0x24')](removeEntity(_0x82a4c3,null))[_0xb57f('0x42')](handleError(_0x82a4c3,null));};exports[_0xb57f('0x49')]=function(_0x497222,_0x24a3ef){return db['FaxTransferReport'][_0xb57f('0x49')]()['then'](respondWithResult(_0x24a3ef,null))['catch'](handleError(_0x24a3ef,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index c4e6533..b6508f5 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 _0xa770=['report_fax_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport'];(function(_0x5817d1,_0x141a85){var _0x457d80=function(_0x59d815){while(--_0x59d815){_0x5817d1['push'](_0x5817d1['shift']());}};_0x457d80(++_0x141a85);}(_0xa770,0xc6));var _0x0a77=function(_0x445578,_0x3ddf67){_0x445578=_0x445578-0x0;var _0x3e7284=_0xa770[_0x445578];return _0x3e7284;};'use strict';var _=require(_0x0a77('0x0'));var util=require('util');var logger=require(_0x0a77('0x1'))(_0x0a77('0x2'));var moment=require(_0x0a77('0x3'));var BPromise=require(_0x0a77('0x4'));var rp=require(_0x0a77('0x5'));var fs=require('fs');var path=require(_0x0a77('0x6'));var rimraf=require('rimraf');var config=require(_0x0a77('0x7'));var attributes=require(_0x0a77('0x8'));module[_0x0a77('0x9')]=function(_0x5e15d4,_0x43c04b){return _0x5e15d4[_0x0a77('0xa')](_0x0a77('0xb'),attributes,{'tableName':_0x0a77('0xc'),'paranoid':![],'indexes':[{'name':_0x0a77('0xd'),'fields':[_0x0a77('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd7fa=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport'];(function(_0x5ec8ec,_0x2c6197){var _0x5594ad=function(_0x2d9a4b){while(--_0x2d9a4b){_0x5ec8ec['push'](_0x5ec8ec['shift']());}};_0x5594ad(++_0x2c6197);}(_0xd7fa,0x127));var _0xad7f=function(_0x46d087,_0x476dff){_0x46d087=_0x46d087-0x0;var _0x48b413=_0xd7fa[_0x46d087];return _0x48b413;};'use strict';var _=require(_0xad7f('0x0'));var util=require(_0xad7f('0x1'));var logger=require(_0xad7f('0x2'))(_0xad7f('0x3'));var moment=require(_0xad7f('0x4'));var BPromise=require(_0xad7f('0x5'));var rp=require(_0xad7f('0x6'));var fs=require('fs');var path=require(_0xad7f('0x7'));var rimraf=require(_0xad7f('0x8'));var config=require(_0xad7f('0x9'));var attributes=require(_0xad7f('0xa'));module[_0xad7f('0xb')]=function(_0x2b9731,_0x17a346){return _0x2b9731['define'](_0xad7f('0xc'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xad7f('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index a1c28d9..45be136 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 _0x2349=['result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x2349,0x12e));var _0x9234=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0x2349[_0x59ee41];return _0x3ecd3e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9234('0x0'));var BPromise=require(_0x9234('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9234('0x2'));var db=require(_0x9234('0x3'))['db'];var utils=require(_0x9234('0x4'));var logger=require('../../config/logger')(_0x9234('0x5'));var config=require('../../config/environment');var jayson=require(_0x9234('0x6'));var client=jayson[_0x9234('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e39db,_0x1138ac,_0x2a3d04){return new BPromise(function(_0x1109d9,_0x26b7fc){return client[_0x9234('0x8')](_0x1e39db,_0x2a3d04)[_0x9234('0x9')](function(_0x43ab16){logger[_0x9234('0xa')](_0x9234('0xb'),_0x1138ac,'request\x20sent');logger[_0x9234('0xc')](_0x9234('0xd'),_0x1138ac,_0x9234('0xe'),JSON[_0x9234('0xf')](_0x43ab16));if(_0x43ab16['error']){if(_0x43ab16[_0x9234('0x10')]['code']===0x1f4){logger[_0x9234('0x10')](_0x9234('0xb'),_0x1138ac,_0x43ab16[_0x9234('0x10')][_0x9234('0x11')]);return _0x26b7fc(_0x43ab16[_0x9234('0x10')]['message']);}logger[_0x9234('0x10')](_0x9234('0xb'),_0x1138ac,_0x43ab16['error'][_0x9234('0x11')]);return _0x1109d9(_0x43ab16[_0x9234('0x10')]['message']);}else{logger['info'](_0x9234('0xb'),_0x1138ac,_0x9234('0xe'));_0x1109d9(_0x43ab16[_0x9234('0x12')]['message']);}})[_0x9234('0x13')](function(_0x46b04e){logger['error'](_0x9234('0xb'),_0x1138ac,_0x46b04e);_0x26b7fc(_0x46b04e);});});} \ No newline at end of file +var _0x3e66=['info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x3e66,0xbe));var _0x63e6=function(_0x187983,_0x4ed46b){_0x187983=_0x187983-0x0;var _0x57365f=_0x3e66[_0x187983];return _0x57365f;};'use strict';var _=require(_0x63e6('0x0'));var util=require(_0x63e6('0x1'));var moment=require(_0x63e6('0x2'));var BPromise=require(_0x63e6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63e6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x63e6('0x5'));var config=require(_0x63e6('0x6'));var jayson=require(_0x63e6('0x7'));var client=jayson[_0x63e6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5878fd,_0x4ca15e,_0x5db5ed){return new BPromise(function(_0x494668,_0x466fb7){return client['request'](_0x5878fd,_0x5db5ed)[_0x63e6('0x9')](function(_0x3f18d3){logger[_0x63e6('0xa')](_0x63e6('0xb'),_0x4ca15e,_0x63e6('0xc'));logger[_0x63e6('0xd')](_0x63e6('0xe'),_0x4ca15e,_0x63e6('0xc'),JSON['stringify'](_0x3f18d3));if(_0x3f18d3['error']){if(_0x3f18d3[_0x63e6('0xf')][_0x63e6('0x10')]===0x1f4){logger[_0x63e6('0xf')](_0x63e6('0xb'),_0x4ca15e,_0x3f18d3[_0x63e6('0xf')][_0x63e6('0x11')]);return _0x466fb7(_0x3f18d3['error'][_0x63e6('0x11')]);}logger[_0x63e6('0xf')](_0x63e6('0xb'),_0x4ca15e,_0x3f18d3['error'][_0x63e6('0x11')]);return _0x494668(_0x3f18d3[_0x63e6('0xf')][_0x63e6('0x11')]);}else{logger['info'](_0x63e6('0xb'),_0x4ca15e,_0x63e6('0xc'));_0x494668(_0x3f18d3[_0x63e6('0x12')][_0x63e6('0x11')]);}})[_0x63e6('0x13')](function(_0x5dddbd){logger['error'](_0x63e6('0xb'),_0x4ca15e,_0x5dddbd);_0x466fb7(_0x5dddbd);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 45f94d0..5a3619b 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 _0x5315=['show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./faxTransferReport.controller','isAuthenticated','/describe','describe','get','/:id'];(function(_0x13c70c,_0x546b34){var _0x50f0f2=function(_0x2a2991){while(--_0x2a2991){_0x13c70c['push'](_0x13c70c['shift']());}};_0x50f0f2(++_0x546b34);}(_0x5315,0x1bf));var _0x5531=function(_0x2c11a2,_0x2d81b0){_0x2c11a2=_0x2c11a2-0x0;var _0x453f1a=_0x5315[_0x2c11a2];return _0x453f1a;};'use strict';var multer=require(_0x5531('0x0'));var util=require(_0x5531('0x1'));var path=require('path');var timeout=require(_0x5531('0x2'));var express=require(_0x5531('0x3'));var router=express[_0x5531('0x4')]();var fs_extra=require(_0x5531('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5531('0x6'));var controller=require(_0x5531('0x7'));router['get']('/',auth[_0x5531('0x8')](),controller['index']);router['get'](_0x5531('0x9'),auth['isAuthenticated'](),controller[_0x5531('0xa')]);router[_0x5531('0xb')](_0x5531('0xc'),auth[_0x5531('0x8')](),controller[_0x5531('0xd')]);router['post']('/',auth[_0x5531('0x8')](),controller[_0x5531('0xe')]);router[_0x5531('0xf')](_0x5531('0xc'),auth[_0x5531('0x8')](),controller[_0x5531('0x10')]);router[_0x5531('0x11')](_0x5531('0xc'),auth[_0x5531('0x8')](),controller[_0x5531('0x12')]);module[_0x5531('0x13')]=router; \ No newline at end of file +var _0x3b01=['update','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x5712fc,_0x415228){var _0x2f89fa=function(_0x3a0309){while(--_0x3a0309){_0x5712fc['push'](_0x5712fc['shift']());}};_0x2f89fa(++_0x415228);}(_0x3b01,0x17d));var _0x13b0=function(_0x3407c7,_0x54699c){_0x3407c7=_0x3407c7-0x0;var _0x276d87=_0x3b01[_0x3407c7];return _0x276d87;};'use strict';var multer=require(_0x13b0('0x0'));var util=require(_0x13b0('0x1'));var path=require(_0x13b0('0x2'));var timeout=require('connect-timeout');var express=require(_0x13b0('0x3'));var router=express['Router']();var fs_extra=require(_0x13b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x13b0('0x5'));var config=require(_0x13b0('0x6'));var controller=require('./faxTransferReport.controller');router[_0x13b0('0x7')]('/',auth['isAuthenticated'](),controller[_0x13b0('0x8')]);router['get'](_0x13b0('0x9'),auth[_0x13b0('0xa')](),controller[_0x13b0('0xb')]);router[_0x13b0('0x7')](_0x13b0('0xc'),auth[_0x13b0('0xa')](),controller[_0x13b0('0xd')]);router[_0x13b0('0xe')]('/',auth[_0x13b0('0xa')](),controller['create']);router['put'](_0x13b0('0xc'),auth['isAuthenticated'](),controller[_0x13b0('0xf')]);router['delete'](_0x13b0('0xc'),auth[_0x13b0('0xa')](),controller[_0x13b0('0x10')]);module[_0x13b0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index f320c18..230349f 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 _0xb998=['../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb998,0x158));var _0x8b99=function(_0x5aba3f,_0x515f79){_0x5aba3f=_0x5aba3f-0x0;var _0x349b89=_0xb998[_0x5aba3f];return _0x349b89;};'use strict';var multer=require(_0x8b99('0x0'));var util=require(_0x8b99('0x1'));var path=require('path');var timeout=require(_0x8b99('0x2'));var express=require(_0x8b99('0x3'));var router=express[_0x8b99('0x4')]();var fs_extra=require(_0x8b99('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b99('0x6'));var config=require(_0x8b99('0x7'));var controller=require(_0x8b99('0x8'));router[_0x8b99('0x9')]('/',auth[_0x8b99('0xa')](),controller[_0x8b99('0xb')]);router[_0x8b99('0x9')](_0x8b99('0xc'),auth['isAuthenticated'](),controller[_0x8b99('0xd')]);router['get'](_0x8b99('0xe'),auth['isAuthenticated'](),controller[_0x8b99('0xf')]);router[_0x8b99('0x9')](_0x8b99('0x10'),auth[_0x8b99('0xa')](),controller[_0x8b99('0x11')]);router['post']('/',auth[_0x8b99('0xa')](),controller['create']);router[_0x8b99('0x12')](_0x8b99('0xe'),auth['isAuthenticated'](),controller[_0x8b99('0x13')]);router[_0x8b99('0x14')](_0x8b99('0xc'),auth[_0x8b99('0xa')](),controller[_0x8b99('0x15')]);router[_0x8b99('0x16')](_0x8b99('0xc'),auth[_0x8b99('0xa')](),controller[_0x8b99('0x17')]);module[_0x8b99('0x18')]=router; \ No newline at end of file +var _0xe7e4=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x171e4d,_0x4f2493){var _0x2d2bf4=function(_0x3a74cc){while(--_0x3a74cc){_0x171e4d['push'](_0x171e4d['shift']());}};_0x2d2bf4(++_0x4f2493);}(_0xe7e4,0x1cc));var _0x4e7e=function(_0x241a02,_0x432a15){_0x241a02=_0x241a02-0x0;var _0x163a39=_0xe7e4[_0x241a02];return _0x163a39;};'use strict';var multer=require(_0x4e7e('0x0'));var util=require(_0x4e7e('0x1'));var path=require(_0x4e7e('0x2'));var timeout=require(_0x4e7e('0x3'));var express=require(_0x4e7e('0x4'));var router=express[_0x4e7e('0x5')]();var fs_extra=require(_0x4e7e('0x6'));var auth=require(_0x4e7e('0x7'));var interaction=require(_0x4e7e('0x8'));var config=require(_0x4e7e('0x9'));var controller=require(_0x4e7e('0xa'));router[_0x4e7e('0xb')]('/',auth[_0x4e7e('0xc')](),controller[_0x4e7e('0xd')]);router['get'](_0x4e7e('0xe'),auth[_0x4e7e('0xc')](),controller[_0x4e7e('0xf')]);router['get'](_0x4e7e('0x10'),auth[_0x4e7e('0xc')](),controller[_0x4e7e('0x11')]);router[_0x4e7e('0xb')](_0x4e7e('0x12'),auth[_0x4e7e('0xc')](),controller[_0x4e7e('0x13')]);router[_0x4e7e('0x14')]('/',auth[_0x4e7e('0xc')](),controller[_0x4e7e('0x15')]);router[_0x4e7e('0x14')](_0x4e7e('0x10'),auth[_0x4e7e('0xc')](),controller['addConfiguration']);router[_0x4e7e('0x16')](_0x4e7e('0xe'),auth[_0x4e7e('0xc')](),controller['update']);router['delete'](_0x4e7e('0xe'),auth[_0x4e7e('0xc')](),controller[_0x4e7e('0x17')]);module[_0x4e7e('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index df57210..91017e7 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 _0x06a1=['newTab','STRING','basic','integrationTab'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x06a1,0x14d));var _0x106a=function(_0x46b810,_0x651bf7){_0x46b810=_0x46b810-0x0;var _0x1727e6=_0x06a1[_0x46b810];return _0x1727e6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x106a('0x0')]},'description':{'type':Sequelize[_0x106a('0x0')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x106a('0x0')]},'authType':{'type':Sequelize['ENUM'](_0x106a('0x1')),'defaultValue':_0x106a('0x1')},'password':{'type':Sequelize[_0x106a('0x0')]},'consumerKey':{'type':Sequelize[_0x106a('0x0')]},'consumerSecret':{'type':Sequelize[_0x106a('0x0')]},'token':{'type':Sequelize[_0x106a('0x0')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x106a('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x106a('0x2'),_0x106a('0x3')),'defaultValue':_0x106a('0x2')}}; \ No newline at end of file +var _0xc376=['ENUM','basic','integrationTab','exports','STRING'];(function(_0x29be28,_0x1d71e5){var _0x5bcc73=function(_0x4bfef0){while(--_0x4bfef0){_0x29be28['push'](_0x29be28['shift']());}};_0x5bcc73(++_0x1d71e5);}(_0xc376,0x1b1));var _0x6c37=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0xc376[_0x401676];return _0x4f13fe;};'use strict';var Sequelize=require('sequelize');module[_0x6c37('0x0')]={'name':{'type':Sequelize[_0x6c37('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6c37('0x1')]},'remoteUri':{'type':Sequelize[_0x6c37('0x1')]},'authType':{'type':Sequelize[_0x6c37('0x2')](_0x6c37('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x6c37('0x1')]},'consumerKey':{'type':Sequelize[_0x6c37('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6c37('0x1')]},'tokenSecret':{'type':Sequelize[_0x6c37('0x1')]},'serverUrl':{'type':Sequelize[_0x6c37('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6c37('0x2')](_0x6c37('0x4'),'newTab'),'defaultValue':_0x6c37('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 8bdf8db..4e842fb 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 _0x48b6=['apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','DeskAccount','includeAll','include','findAll','rows','catch','show','params','keys','find','body','destroy','findOne','DeskConfiguration','length','order','sort','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','create','DeskField','getFields','priority','remoteUri','authType','username','consumerSecret','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','password','toString','concat','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x485e11,_0x12088d){var _0x442b4b=function(_0x2c6344){while(--_0x2c6344){_0x485e11['push'](_0x485e11['shift']());}};_0x442b4b(++_0x12088d);}(_0x48b6,0x144));var _0x648b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x48b6[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x648b('0x0'));var jsonpatch=require(_0x648b('0x1'));var rp=require('request-promise');var moment=require(_0x648b('0x2'));var BPromise=require(_0x648b('0x3'));var Mustache=require(_0x648b('0x4'));var util=require(_0x648b('0x5'));var path=require(_0x648b('0x6'));var sox=require('sox');var csv=require(_0x648b('0x7'));var ejs=require(_0x648b('0x8'));var fs=require('fs');var fs_extra=require(_0x648b('0x9'));var _=require(_0x648b('0xa'));var squel=require('squel');var crypto=require(_0x648b('0xb'));var jsforce=require(_0x648b('0xc'));var deskjs=require(_0x648b('0xd'));var toCsv=require(_0x648b('0x7'));var querystring=require(_0x648b('0xe'));var Papa=require(_0x648b('0xf'));var Redis=require('ioredis');var authService=require(_0x648b('0x10'));var qs=require(_0x648b('0x11'));var as=require(_0x648b('0x12'));var hardwareService=require(_0x648b('0x13'));var logger=require(_0x648b('0x14'))(_0x648b('0x15'));var utils=require(_0x648b('0x16'));var config=require(_0x648b('0x17'));var licenseUtil=require(_0x648b('0x18'));var db=require(_0x648b('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5c2a68,_0x5a6ba5){_0x5a6ba5=_0x5a6ba5||0xcc;return function(_0x3f5a4a){if(_0x3f5a4a){return _0x5c2a68[_0x648b('0x1a')](_0x5a6ba5);}return _0x5c2a68[_0x648b('0x1b')](_0x5a6ba5)[_0x648b('0x1c')]();};}function respondWithResult(_0x55a816,_0x5383d6){_0x5383d6=_0x5383d6||0xc8;return function(_0x3d9ce6){if(_0x3d9ce6){return _0x55a816[_0x648b('0x1b')](_0x5383d6)[_0x648b('0x1d')](_0x3d9ce6);}};}function respondWithFilteredResult(_0x306433,_0x47a157){return function(_0x32c5e8){if(_0x32c5e8){var _0x315506=typeof _0x47a157['offset']===_0x648b('0x1e')&&typeof _0x47a157[_0x648b('0x1f')]===_0x648b('0x1e');var _0x4ac61e=_0x32c5e8[_0x648b('0x20')];var _0x1d9c38=_0x315506?0x0:_0x47a157[_0x648b('0x21')];var _0x2c6dd5=_0x315506?_0x32c5e8[_0x648b('0x20')]:_0x47a157[_0x648b('0x21')]+_0x47a157[_0x648b('0x1f')];var _0x3e5ee7;if(_0x2c6dd5>=_0x4ac61e){_0x2c6dd5=_0x4ac61e;_0x3e5ee7=0xc8;}else{_0x3e5ee7=0xce;}_0x306433[_0x648b('0x1b')](_0x3e5ee7);return _0x306433[_0x648b('0x22')](_0x648b('0x23'),_0x1d9c38+'-'+_0x2c6dd5+'/'+_0x4ac61e)['json'](_0x32c5e8);}return null;};}function patchUpdates(_0x142a0e){return function(_0x1ce080){try{jsonpatch[_0x648b('0x24')](_0x1ce080,_0x142a0e,!![]);}catch(_0x2575aa){return BPromise[_0x648b('0x25')](_0x2575aa);}return _0x1ce080[_0x648b('0x26')]();};}function saveUpdates(_0x176c87,_0x1fd322){return function(_0x20e78d){if(_0x20e78d){return _0x20e78d[_0x648b('0x27')](_0x176c87)[_0x648b('0x28')](function(_0x3ebba0){return _0x3ebba0;});}return null;};}function removeEntity(_0x4fba62,_0x4d13d3){return function(_0x42ea20){if(_0x42ea20){return _0x42ea20['destroy']()['then'](function(){_0x4fba62[_0x648b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17cc1f,_0x37d879){return function(_0x571ba6){if(!_0x571ba6){_0x17cc1f[_0x648b('0x1a')](0x194);}return _0x571ba6;};}function handleError(_0x2284f2,_0x471cb1){_0x471cb1=_0x471cb1||0x1f4;return function(_0x56dccc){logger[_0x648b('0x29')](_0x56dccc[_0x648b('0x2a')]);if(_0x56dccc[_0x648b('0x2b')]){delete _0x56dccc[_0x648b('0x2b')];}_0x2284f2[_0x648b('0x1b')](_0x471cb1)[_0x648b('0x2c')](_0x56dccc);};}exports[_0x648b('0x2d')]=function(_0x341b6,_0x2c91d8){var _0x2de9b4={},_0x4d7c7e={},_0x1f23e1={'count':0x0,'rows':[]};var _0x57abcf=_[_0x648b('0x2e')](db['DeskAccount'][_0x648b('0x2f')],function(_0x2c1d89){return{'name':_0x2c1d89[_0x648b('0x30')],'type':_0x2c1d89[_0x648b('0x31')][_0x648b('0x32')]};});_0x4d7c7e[_0x648b('0x33')]=_[_0x648b('0x2e')](_0x57abcf,'name');_0x4d7c7e[_0x648b('0x34')]=_['keys'](_0x341b6[_0x648b('0x34')]);_0x4d7c7e[_0x648b('0x35')]=_[_0x648b('0x36')](_0x4d7c7e['model'],_0x4d7c7e[_0x648b('0x34')]);_0x2de9b4[_0x648b('0x37')]=_[_0x648b('0x36')](_0x4d7c7e[_0x648b('0x33')],qs[_0x648b('0x38')](_0x341b6[_0x648b('0x34')][_0x648b('0x38')]));_0x2de9b4[_0x648b('0x37')]=_0x2de9b4['attributes']['length']?_0x2de9b4[_0x648b('0x37')]:_0x4d7c7e[_0x648b('0x33')];if(!_0x341b6[_0x648b('0x34')][_0x648b('0x39')](_0x648b('0x3a'))){_0x2de9b4[_0x648b('0x1f')]=qs[_0x648b('0x1f')](_0x341b6[_0x648b('0x34')][_0x648b('0x1f')]);_0x2de9b4[_0x648b('0x21')]=qs[_0x648b('0x21')](_0x341b6[_0x648b('0x34')][_0x648b('0x21')]);}_0x2de9b4['order']=qs['sort'](_0x341b6['query']['sort']);_0x2de9b4[_0x648b('0x3b')]=qs[_0x648b('0x35')](_[_0x648b('0x3c')](_0x341b6[_0x648b('0x34')],_0x4d7c7e['filters']),_0x57abcf);if(_0x341b6[_0x648b('0x34')][_0x648b('0x3d')]){_0x2de9b4['where']=_[_0x648b('0x3e')](_0x2de9b4[_0x648b('0x3b')],{'$or':_[_0x648b('0x2e')](_0x57abcf,function(_0x5eddf7){if(_0x5eddf7[_0x648b('0x31')]!==_0x648b('0x3f')){var _0x2e9e56={};_0x2e9e56[_0x5eddf7['name']]={'$like':'%'+_0x341b6[_0x648b('0x34')]['filter']+'%'};return _0x2e9e56;}})});}_0x2de9b4=_[_0x648b('0x3e')]({},_0x2de9b4,_0x341b6[_0x648b('0x40')]);var _0x51fc41={'where':_0x2de9b4[_0x648b('0x3b')]};return db[_0x648b('0x41')][_0x648b('0x20')](_0x51fc41)[_0x648b('0x28')](function(_0x417ae6){_0x1f23e1[_0x648b('0x20')]=_0x417ae6;if(_0x341b6['query'][_0x648b('0x42')]){_0x2de9b4[_0x648b('0x43')]=[{'all':!![]}];}return db[_0x648b('0x41')][_0x648b('0x44')](_0x2de9b4);})['then'](function(_0x5805d1){_0x1f23e1[_0x648b('0x45')]=_0x5805d1;return _0x1f23e1;})[_0x648b('0x28')](respondWithFilteredResult(_0x2c91d8,_0x2de9b4))[_0x648b('0x46')](handleError(_0x2c91d8,null));};exports[_0x648b('0x47')]=function(_0x4d4d23,_0x39e34a){var _0x4a5b02={'raw':![],'where':{'id':_0x4d4d23[_0x648b('0x48')]['id']}},_0x3cf62d={};_0x3cf62d[_0x648b('0x33')]=_['keys'](db[_0x648b('0x41')]['rawAttributes']);_0x3cf62d['query']=_[_0x648b('0x49')](_0x4d4d23[_0x648b('0x34')]);_0x3cf62d['filters']=_[_0x648b('0x36')](_0x3cf62d[_0x648b('0x33')],_0x3cf62d[_0x648b('0x34')]);_0x4a5b02[_0x648b('0x37')]=_['intersection'](_0x3cf62d[_0x648b('0x33')],qs[_0x648b('0x38')](_0x4d4d23[_0x648b('0x34')]['fields']));_0x4a5b02[_0x648b('0x37')]=_0x4a5b02[_0x648b('0x37')]['length']?_0x4a5b02['attributes']:_0x3cf62d[_0x648b('0x33')];if(_0x4d4d23[_0x648b('0x34')][_0x648b('0x42')]){_0x4a5b02[_0x648b('0x43')]=[{'all':!![]}];}_0x4a5b02=_[_0x648b('0x3e')]({},_0x4a5b02,_0x4d4d23['options']);return db[_0x648b('0x41')][_0x648b('0x4a')](_0x4a5b02)[_0x648b('0x28')](handleEntityNotFound(_0x39e34a,null))[_0x648b('0x28')](respondWithResult(_0x39e34a,null))[_0x648b('0x46')](handleError(_0x39e34a,null));};exports['create']=function(_0x3e00fc,_0xafe84a){return db['DeskAccount']['create'](_0x3e00fc['body'],{})[_0x648b('0x28')](respondWithResult(_0xafe84a,0xc9))[_0x648b('0x46')](handleError(_0xafe84a,null));};exports[_0x648b('0x27')]=function(_0x16b2c9,_0x4f7002){if(_0x16b2c9['body']['id']){delete _0x16b2c9['body']['id'];}return db[_0x648b('0x41')]['find']({'where':{'id':_0x16b2c9['params']['id']}})[_0x648b('0x28')](handleEntityNotFound(_0x4f7002,null))[_0x648b('0x28')](saveUpdates(_0x16b2c9[_0x648b('0x4b')],null))['then'](respondWithResult(_0x4f7002,null))['catch'](handleError(_0x4f7002,null));};exports[_0x648b('0x4c')]=function(_0x2c47ce,_0x4fdf1d){return db['DeskAccount']['find']({'where':{'id':_0x2c47ce[_0x648b('0x48')]['id']}})[_0x648b('0x28')](handleEntityNotFound(_0x4fdf1d,null))['then'](removeEntity(_0x4fdf1d,null))[_0x648b('0x46')](handleError(_0x4fdf1d,null));};exports['getConfigurations']=function(_0x386625,_0x3f3305,_0x4f52f5){var _0x4d4597={};var _0x59c2d8={};var _0x157285;var _0x7b6cef;return db[_0x648b('0x41')][_0x648b('0x4d')]({'where':{'id':_0x386625[_0x648b('0x48')]['id']}})[_0x648b('0x28')](handleEntityNotFound(_0x3f3305,null))[_0x648b('0x28')](function(_0x5e7772){if(_0x5e7772){_0x157285=_0x5e7772;_0x59c2d8[_0x648b('0x33')]=_[_0x648b('0x49')](db[_0x648b('0x4e')][_0x648b('0x2f')]);_0x59c2d8[_0x648b('0x34')]=_['keys'](_0x386625['query']);_0x59c2d8[_0x648b('0x35')]=_[_0x648b('0x36')](_0x59c2d8[_0x648b('0x33')],_0x59c2d8[_0x648b('0x34')]);_0x4d4597['attributes']=_['intersection'](_0x59c2d8['model'],qs[_0x648b('0x38')](_0x386625[_0x648b('0x34')][_0x648b('0x38')]));_0x4d4597[_0x648b('0x37')]=_0x4d4597['attributes'][_0x648b('0x4f')]?_0x4d4597['attributes']:_0x59c2d8['model'];_0x4d4597[_0x648b('0x50')]=qs[_0x648b('0x51')](_0x386625[_0x648b('0x34')][_0x648b('0x51')]);_0x4d4597[_0x648b('0x3b')]=qs[_0x648b('0x35')](_[_0x648b('0x3c')](_0x386625[_0x648b('0x34')],_0x59c2d8['filters']));if(_0x386625[_0x648b('0x34')][_0x648b('0x3d')]){_0x4d4597['where']=_[_0x648b('0x3e')](_0x4d4597[_0x648b('0x3b')],{'$or':_[_0x648b('0x2e')](_0x4d4597['attributes'],function(_0x244d6c){var _0x475f56={};_0x475f56[_0x244d6c]={'$like':'%'+_0x386625[_0x648b('0x34')]['filter']+'%'};return _0x475f56;})});}_0x4d4597=_[_0x648b('0x3e')]({},_0x4d4597,_0x386625['options']);return _0x157285['getConfigurations'](_0x4d4597);}})[_0x648b('0x28')](function(_0x3f1292){if(_0x3f1292){_0x7b6cef=_0x3f1292[_0x648b('0x4f')];if(!_0x386625[_0x648b('0x34')][_0x648b('0x39')](_0x648b('0x3a'))){_0x4d4597[_0x648b('0x1f')]=qs[_0x648b('0x1f')](_0x386625[_0x648b('0x34')][_0x648b('0x1f')]);_0x4d4597['offset']=qs['offset'](_0x386625['query'][_0x648b('0x21')]);}return _0x157285[_0x648b('0x52')](_0x4d4597);}})[_0x648b('0x28')](function(_0x13a0f8){if(_0x13a0f8){return _0x13a0f8?{'count':_0x7b6cef,'rows':_0x13a0f8}:null;}})[_0x648b('0x28')](respondWithResult(_0x3f3305,null))[_0x648b('0x46')](handleError(_0x3f3305,null));};exports[_0x648b('0x53')]=function(_0x5ddf25,_0xf7c10,_0x3e4c03){if(_0x5ddf25['body']['id']){delete _0x5ddf25[_0x648b('0x4b')]['id'];}return db[_0x648b('0x41')][_0x648b('0x4d')]({'where':{'id':_0x5ddf25[_0x648b('0x48')]['id']}})[_0x648b('0x28')](handleEntityNotFound(_0xf7c10,null))[_0x648b('0x28')](function(_0x4675d4){if(_0x4675d4){_0x5ddf25['body'][_0x648b('0x54')]=_0x4675d4['id'];_0x5ddf25[_0x648b('0x4b')][_0x648b('0x55')]=integrations[_0x648b('0x56')](_0x5ddf25[_0x648b('0x4b')][_0x648b('0x57')],_0x5ddf25[_0x648b('0x4b')]['type']);_0x5ddf25[_0x648b('0x4b')][_0x648b('0x58')]=integrations['getDescriptions'](_0x5ddf25[_0x648b('0x4b')][_0x648b('0x57')],_0x5ddf25[_0x648b('0x4b')]['type']);return db[_0x648b('0x4e')][_0x648b('0x59')](_0x5ddf25[_0x648b('0x4b')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0x648b('0x5a')],'as':_0x648b('0x58')}]});}return null;})[_0x648b('0x28')](respondWithResult(_0xf7c10,null))['catch'](handleError(_0xf7c10,null));};exports[_0x648b('0x5b')]=function(_0x3e48c5,_0x5e020d,_0x20bc7d){var _0x3d449c=[{'name':_0x648b('0x5c'),'label':_0x648b('0x5c'),'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 _0x3b6b37='';return db[_0x648b('0x41')][_0x648b('0x4d')]({'where':{'id':_0x3e48c5[_0x648b('0x48')]['id']},'attributes':['id',_0x648b('0x5d'),_0x648b('0x5e'),_0x648b('0x5f'),'password','consumerKey',_0x648b('0x60'),'token',_0x648b('0x61')]})['then'](handleEntityNotFound(_0x5e020d,null))[_0x648b('0x28')](function(_0x1064fd){if(_0x1064fd){_0x3b6b37=_0x1064fd[_0x648b('0x5d')];var _0x3911b5=_0x3b6b37[_0x648b('0x62')](-0x1);if(_0x3911b5==='/'){_0x3b6b37=_0x3b6b37[_0x648b('0x63')](0x0,_0x3b6b37[_0x648b('0x64')](_0x3911b5));}var _0x3a688b={'method':_0x648b('0x65'),'uri':util[_0x648b('0x66')](_0x648b('0x67'),_0x3b6b37),'headers':{'Content-Type':_0x648b('0x68'),'Accept':_0x648b('0x68')},'json':!![]};if(_0x1064fd['authType']===_0x648b('0x69')){_0x3a688b[_0x648b('0x6a')][_0x648b('0x6b')]=util[_0x648b('0x66')]('Basic\x20%s',new Buffer(util['format'](_0x648b('0x6c'),_0x1064fd['username'],_0x1064fd[_0x648b('0x6d')]))[_0x648b('0x6e')]('base64'));}return rp(_0x3a688b)[_0x648b('0x28')](function(_0x509abf){return _0x3d449c[_0x648b('0x6f')](_[_0x648b('0x2e')](_0x509abf[_0x648b('0x70')]['entries'],function(_0x53f13c){return{'id':_0x53f13c[_0x648b('0x2b')],'name':_0x53f13c[_0x648b('0x2b')],'type':_0x53f13c[_0x648b('0x31')],'active':_0x53f13c[_0x648b('0x71')],'label':_0x53f13c[_0x648b('0x72')],'custom':!![]};}));});}})['then'](function(_0x15c5de){return{'count':_0x15c5de['length'],'rows':_0x15c5de};})[_0x648b('0x28')](respondWithResult(_0x5e020d,null))[_0x648b('0x46')](function(_0x234393){var _0x27a761=_0x3e48c5[_0x648b('0x34')][_0x648b('0x73')]?0x1f4:_0x234393[_0x648b('0x74')]||0x1f4;logger[_0x648b('0x29')](_0x648b('0x75'),_0x648b('0x5b'),_0x27a761,JSON[_0x648b('0x76')](_0x234393));delete _0x234393[_0x648b('0x2b')];if(_0x27a761===0x191){_0x27a761=0x190;}_0x5e020d[_0x648b('0x1b')](_0x27a761)[_0x648b('0x2c')](_0x3e48c5['query'][_0x648b('0x73')]?{'message':_0x648b('0x77'),'statusCode':_0x234393[_0x648b('0x74')]}:_0x234393);});}; \ No newline at end of file +var _0xaf22=['headers','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded','entries','active','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','DeskAccount','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','authType','password','slice','substring','lastIndexOf','format','%s/custom_fields','application/json'];(function(_0x49d11e,_0x258542){var _0x4b5fb0=function(_0x20ac09){while(--_0x20ac09){_0x49d11e['push'](_0x49d11e['shift']());}};_0x4b5fb0(++_0x258542);}(_0xaf22,0x81));var _0x2af2=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xaf22[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2af2('0x0'));var jsonpatch=require(_0x2af2('0x1'));var rp=require(_0x2af2('0x2'));var moment=require('moment');var BPromise=require(_0x2af2('0x3'));var Mustache=require(_0x2af2('0x4'));var util=require(_0x2af2('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2af2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2af2('0x7'));var _=require(_0x2af2('0x8'));var squel=require(_0x2af2('0x9'));var crypto=require(_0x2af2('0xa'));var jsforce=require(_0x2af2('0xb'));var deskjs=require(_0x2af2('0xc'));var toCsv=require(_0x2af2('0x6'));var querystring=require(_0x2af2('0xd'));var Papa=require(_0x2af2('0xe'));var Redis=require('ioredis');var authService=require(_0x2af2('0xf'));var qs=require(_0x2af2('0x10'));var as=require(_0x2af2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2af2('0x12'))(_0x2af2('0x13'));var utils=require(_0x2af2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2af2('0x15'));var db=require(_0x2af2('0x16'))['db'];var integrations=require(_0x2af2('0x17'));function respondWithStatusCode(_0x475762,_0xfc90a){_0xfc90a=_0xfc90a||0xcc;return function(_0x3397f4){if(_0x3397f4){return _0x475762[_0x2af2('0x18')](_0xfc90a);}return _0x475762[_0x2af2('0x19')](_0xfc90a)['end']();};}function respondWithResult(_0x5b87cc,_0x2cd914){_0x2cd914=_0x2cd914||0xc8;return function(_0x59b874){if(_0x59b874){return _0x5b87cc[_0x2af2('0x19')](_0x2cd914)[_0x2af2('0x1a')](_0x59b874);}};}function respondWithFilteredResult(_0x2a0cee,_0x4dfa2f){return function(_0x30c5f0){if(_0x30c5f0){var _0x3496d9=typeof _0x4dfa2f[_0x2af2('0x1b')]===_0x2af2('0x1c')&&typeof _0x4dfa2f[_0x2af2('0x1d')]===_0x2af2('0x1c');var _0x205d24=_0x30c5f0[_0x2af2('0x1e')];var _0x8f9c82=_0x3496d9?0x0:_0x4dfa2f[_0x2af2('0x1b')];var _0x6f4a46=_0x3496d9?_0x30c5f0[_0x2af2('0x1e')]:_0x4dfa2f[_0x2af2('0x1b')]+_0x4dfa2f['limit'];var _0x3c1d64;if(_0x6f4a46>=_0x205d24){_0x6f4a46=_0x205d24;_0x3c1d64=0xc8;}else{_0x3c1d64=0xce;}_0x2a0cee[_0x2af2('0x19')](_0x3c1d64);return _0x2a0cee[_0x2af2('0x1f')](_0x2af2('0x20'),_0x8f9c82+'-'+_0x6f4a46+'/'+_0x205d24)[_0x2af2('0x1a')](_0x30c5f0);}return null;};}function patchUpdates(_0x2927d1){return function(_0x4891f4){try{jsonpatch[_0x2af2('0x21')](_0x4891f4,_0x2927d1,!![]);}catch(_0x3ab86e){return BPromise[_0x2af2('0x22')](_0x3ab86e);}return _0x4891f4[_0x2af2('0x23')]();};}function saveUpdates(_0x5a347e,_0x258d3f){return function(_0x5a271e){if(_0x5a271e){return _0x5a271e[_0x2af2('0x24')](_0x5a347e)[_0x2af2('0x25')](function(_0x22d65){return _0x22d65;});}return null;};}function removeEntity(_0x60260e,_0xc4dd3e){return function(_0x4ef639){if(_0x4ef639){return _0x4ef639[_0x2af2('0x26')]()[_0x2af2('0x25')](function(){_0x60260e['status'](0xcc)[_0x2af2('0x27')]();});}};}function handleEntityNotFound(_0x1e5fba,_0x1ca66a){return function(_0x106355){if(!_0x106355){_0x1e5fba[_0x2af2('0x18')](0x194);}return _0x106355;};}function handleError(_0x7f0b0a,_0x3cebba){_0x3cebba=_0x3cebba||0x1f4;return function(_0x4f882){logger[_0x2af2('0x28')](_0x4f882[_0x2af2('0x29')]);if(_0x4f882[_0x2af2('0x2a')]){delete _0x4f882[_0x2af2('0x2a')];}_0x7f0b0a[_0x2af2('0x19')](_0x3cebba)['send'](_0x4f882);};}exports[_0x2af2('0x2b')]=function(_0x3dac2a,_0xc908be){var _0x56c16e={},_0x1c6e3e={},_0x2c95ef={'count':0x0,'rows':[]};var _0x1d164f=_['map'](db['DeskAccount'][_0x2af2('0x2c')],function(_0x592735){return{'name':_0x592735[_0x2af2('0x2d')],'type':_0x592735[_0x2af2('0x2e')][_0x2af2('0x2f')]};});_0x1c6e3e[_0x2af2('0x30')]=_[_0x2af2('0x31')](_0x1d164f,_0x2af2('0x2a'));_0x1c6e3e['query']=_[_0x2af2('0x32')](_0x3dac2a[_0x2af2('0x33')]);_0x1c6e3e[_0x2af2('0x34')]=_[_0x2af2('0x35')](_0x1c6e3e[_0x2af2('0x30')],_0x1c6e3e[_0x2af2('0x33')]);_0x56c16e[_0x2af2('0x36')]=_[_0x2af2('0x35')](_0x1c6e3e[_0x2af2('0x30')],qs[_0x2af2('0x37')](_0x3dac2a['query'][_0x2af2('0x37')]));_0x56c16e['attributes']=_0x56c16e[_0x2af2('0x36')][_0x2af2('0x38')]?_0x56c16e[_0x2af2('0x36')]:_0x1c6e3e[_0x2af2('0x30')];if(!_0x3dac2a[_0x2af2('0x33')]['hasOwnProperty'](_0x2af2('0x39'))){_0x56c16e['limit']=qs[_0x2af2('0x1d')](_0x3dac2a[_0x2af2('0x33')]['limit']);_0x56c16e[_0x2af2('0x1b')]=qs[_0x2af2('0x1b')](_0x3dac2a[_0x2af2('0x33')][_0x2af2('0x1b')]);}_0x56c16e['order']=qs[_0x2af2('0x3a')](_0x3dac2a[_0x2af2('0x33')][_0x2af2('0x3a')]);_0x56c16e[_0x2af2('0x3b')]=qs[_0x2af2('0x34')](_[_0x2af2('0x3c')](_0x3dac2a['query'],_0x1c6e3e[_0x2af2('0x34')]),_0x1d164f);if(_0x3dac2a[_0x2af2('0x33')][_0x2af2('0x3d')]){_0x56c16e[_0x2af2('0x3b')]=_[_0x2af2('0x3e')](_0x56c16e['where'],{'$or':_[_0x2af2('0x31')](_0x1d164f,function(_0x46b25e){if(_0x46b25e[_0x2af2('0x2e')]!==_0x2af2('0x3f')){var _0x45cd69={};_0x45cd69[_0x46b25e[_0x2af2('0x2a')]]={'$like':'%'+_0x3dac2a[_0x2af2('0x33')]['filter']+'%'};return _0x45cd69;}})});}_0x56c16e=_[_0x2af2('0x3e')]({},_0x56c16e,_0x3dac2a[_0x2af2('0x40')]);var _0x2801e9={'where':_0x56c16e[_0x2af2('0x3b')]};return db[_0x2af2('0x41')]['count'](_0x2801e9)[_0x2af2('0x25')](function(_0xa46033){_0x2c95ef[_0x2af2('0x1e')]=_0xa46033;if(_0x3dac2a['query'][_0x2af2('0x42')]){_0x56c16e[_0x2af2('0x43')]=[{'all':!![]}];}return db['DeskAccount'][_0x2af2('0x44')](_0x56c16e);})[_0x2af2('0x25')](function(_0x35a705){_0x2c95ef['rows']=_0x35a705;return _0x2c95ef;})[_0x2af2('0x25')](respondWithFilteredResult(_0xc908be,_0x56c16e))[_0x2af2('0x45')](handleError(_0xc908be,null));};exports[_0x2af2('0x46')]=function(_0x5686dc,_0x56dd61){var _0x5ce202={'raw':![],'where':{'id':_0x5686dc[_0x2af2('0x47')]['id']}},_0x29ac02={};_0x29ac02[_0x2af2('0x30')]=_[_0x2af2('0x32')](db['DeskAccount'][_0x2af2('0x2c')]);_0x29ac02[_0x2af2('0x33')]=_[_0x2af2('0x32')](_0x5686dc[_0x2af2('0x33')]);_0x29ac02[_0x2af2('0x34')]=_[_0x2af2('0x35')](_0x29ac02[_0x2af2('0x30')],_0x29ac02['query']);_0x5ce202[_0x2af2('0x36')]=_[_0x2af2('0x35')](_0x29ac02[_0x2af2('0x30')],qs[_0x2af2('0x37')](_0x5686dc[_0x2af2('0x33')][_0x2af2('0x37')]));_0x5ce202['attributes']=_0x5ce202[_0x2af2('0x36')][_0x2af2('0x38')]?_0x5ce202[_0x2af2('0x36')]:_0x29ac02['model'];if(_0x5686dc[_0x2af2('0x33')]['includeAll']){_0x5ce202[_0x2af2('0x43')]=[{'all':!![]}];}_0x5ce202=_[_0x2af2('0x3e')]({},_0x5ce202,_0x5686dc['options']);return db[_0x2af2('0x41')][_0x2af2('0x48')](_0x5ce202)[_0x2af2('0x25')](handleEntityNotFound(_0x56dd61,null))['then'](respondWithResult(_0x56dd61,null))['catch'](handleError(_0x56dd61,null));};exports[_0x2af2('0x49')]=function(_0x457992,_0x502bde){return db[_0x2af2('0x41')][_0x2af2('0x49')](_0x457992[_0x2af2('0x4a')],{})[_0x2af2('0x25')](respondWithResult(_0x502bde,0xc9))[_0x2af2('0x45')](handleError(_0x502bde,null));};exports[_0x2af2('0x24')]=function(_0x23c9e9,_0x5df82a){if(_0x23c9e9[_0x2af2('0x4a')]['id']){delete _0x23c9e9[_0x2af2('0x4a')]['id'];}return db[_0x2af2('0x41')][_0x2af2('0x48')]({'where':{'id':_0x23c9e9[_0x2af2('0x47')]['id']}})['then'](handleEntityNotFound(_0x5df82a,null))[_0x2af2('0x25')](saveUpdates(_0x23c9e9[_0x2af2('0x4a')],null))[_0x2af2('0x25')](respondWithResult(_0x5df82a,null))[_0x2af2('0x45')](handleError(_0x5df82a,null));};exports['destroy']=function(_0x2e33a8,_0xbd2dd6){return db[_0x2af2('0x41')][_0x2af2('0x48')]({'where':{'id':_0x2e33a8[_0x2af2('0x47')]['id']}})[_0x2af2('0x25')](handleEntityNotFound(_0xbd2dd6,null))[_0x2af2('0x25')](removeEntity(_0xbd2dd6,null))['catch'](handleError(_0xbd2dd6,null));};exports[_0x2af2('0x4b')]=function(_0x21cd9a,_0x22d52a,_0x373173){var _0x15313c={};var _0x2c6ae3={};var _0x1abbc1;var _0x131cdc;return db[_0x2af2('0x41')][_0x2af2('0x4c')]({'where':{'id':_0x21cd9a[_0x2af2('0x47')]['id']}})[_0x2af2('0x25')](handleEntityNotFound(_0x22d52a,null))[_0x2af2('0x25')](function(_0x3a01b2){if(_0x3a01b2){_0x1abbc1=_0x3a01b2;_0x2c6ae3[_0x2af2('0x30')]=_[_0x2af2('0x32')](db[_0x2af2('0x4d')][_0x2af2('0x2c')]);_0x2c6ae3[_0x2af2('0x33')]=_['keys'](_0x21cd9a[_0x2af2('0x33')]);_0x2c6ae3[_0x2af2('0x34')]=_[_0x2af2('0x35')](_0x2c6ae3['model'],_0x2c6ae3[_0x2af2('0x33')]);_0x15313c[_0x2af2('0x36')]=_[_0x2af2('0x35')](_0x2c6ae3['model'],qs[_0x2af2('0x37')](_0x21cd9a[_0x2af2('0x33')]['fields']));_0x15313c[_0x2af2('0x36')]=_0x15313c[_0x2af2('0x36')][_0x2af2('0x38')]?_0x15313c[_0x2af2('0x36')]:_0x2c6ae3['model'];_0x15313c['order']=qs[_0x2af2('0x3a')](_0x21cd9a[_0x2af2('0x33')][_0x2af2('0x3a')]);_0x15313c[_0x2af2('0x3b')]=qs['filters'](_[_0x2af2('0x3c')](_0x21cd9a[_0x2af2('0x33')],_0x2c6ae3[_0x2af2('0x34')]));if(_0x21cd9a[_0x2af2('0x33')][_0x2af2('0x3d')]){_0x15313c[_0x2af2('0x3b')]=_[_0x2af2('0x3e')](_0x15313c['where'],{'$or':_[_0x2af2('0x31')](_0x15313c[_0x2af2('0x36')],function(_0x47b7a5){var _0x95a917={};_0x95a917[_0x47b7a5]={'$like':'%'+_0x21cd9a[_0x2af2('0x33')][_0x2af2('0x3d')]+'%'};return _0x95a917;})});}_0x15313c=_[_0x2af2('0x3e')]({},_0x15313c,_0x21cd9a[_0x2af2('0x40')]);return _0x1abbc1['getConfigurations'](_0x15313c);}})[_0x2af2('0x25')](function(_0x17990c){if(_0x17990c){_0x131cdc=_0x17990c[_0x2af2('0x38')];if(!_0x21cd9a[_0x2af2('0x33')][_0x2af2('0x4e')](_0x2af2('0x39'))){_0x15313c['limit']=qs['limit'](_0x21cd9a[_0x2af2('0x33')][_0x2af2('0x1d')]);_0x15313c['offset']=qs[_0x2af2('0x1b')](_0x21cd9a[_0x2af2('0x33')][_0x2af2('0x1b')]);}return _0x1abbc1[_0x2af2('0x4b')](_0x15313c);}})[_0x2af2('0x25')](function(_0x3dfe4c){if(_0x3dfe4c){return _0x3dfe4c?{'count':_0x131cdc,'rows':_0x3dfe4c}:null;}})[_0x2af2('0x25')](respondWithResult(_0x22d52a,null))[_0x2af2('0x45')](handleError(_0x22d52a,null));};exports['addConfiguration']=function(_0x48c1f5,_0x5df1cb,_0x4a6e2a){if(_0x48c1f5['body']['id']){delete _0x48c1f5[_0x2af2('0x4a')]['id'];}return db[_0x2af2('0x41')][_0x2af2('0x4c')]({'where':{'id':_0x48c1f5[_0x2af2('0x47')]['id']}})[_0x2af2('0x25')](handleEntityNotFound(_0x5df1cb,null))['then'](function(_0x5bf2bb){if(_0x5bf2bb){_0x48c1f5[_0x2af2('0x4a')][_0x2af2('0x4f')]=_0x5bf2bb['id'];_0x48c1f5[_0x2af2('0x4a')][_0x2af2('0x50')]=integrations[_0x2af2('0x51')](_0x48c1f5[_0x2af2('0x4a')]['channel'],_0x48c1f5['body']['type']);_0x48c1f5[_0x2af2('0x4a')][_0x2af2('0x52')]=integrations[_0x2af2('0x53')](_0x48c1f5['body'][_0x2af2('0x54')],_0x48c1f5[_0x2af2('0x4a')][_0x2af2('0x2e')]);return db[_0x2af2('0x4d')][_0x2af2('0x49')](_0x48c1f5['body'],{'include':[{'model':db[_0x2af2('0x55')],'as':_0x2af2('0x50')},{'model':db[_0x2af2('0x55')],'as':'Descriptions'}]});}return null;})[_0x2af2('0x25')](respondWithResult(_0x5df1cb,null))[_0x2af2('0x45')](handleError(_0x5df1cb,null));};exports[_0x2af2('0x56')]=function(_0x269e4f,_0x2160b8,_0x2cba43){var _0xbb938c=[{'name':_0x2af2('0x57'),'label':_0x2af2('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 _0x1f7ff3='';return db[_0x2af2('0x41')][_0x2af2('0x4c')]({'where':{'id':_0x269e4f[_0x2af2('0x47')]['id']},'attributes':['id',_0x2af2('0x58'),_0x2af2('0x59'),'username',_0x2af2('0x5a'),'consumerKey','consumerSecret','token','tokenSecret']})['then'](handleEntityNotFound(_0x2160b8,null))[_0x2af2('0x25')](function(_0x22e8a9){if(_0x22e8a9){_0x1f7ff3=_0x22e8a9[_0x2af2('0x58')];var _0xb3c34=_0x1f7ff3[_0x2af2('0x5b')](-0x1);if(_0xb3c34==='/'){_0x1f7ff3=_0x1f7ff3[_0x2af2('0x5c')](0x0,_0x1f7ff3[_0x2af2('0x5d')](_0xb3c34));}var _0x1190c6={'method':'GET','uri':util[_0x2af2('0x5e')](_0x2af2('0x5f'),_0x1f7ff3),'headers':{'Content-Type':'application/json','Accept':_0x2af2('0x60')},'json':!![]};if(_0x22e8a9[_0x2af2('0x59')]==='basic'){_0x1190c6[_0x2af2('0x61')]['Authorization']=util[_0x2af2('0x5e')](_0x2af2('0x62'),new Buffer(util[_0x2af2('0x5e')](_0x2af2('0x63'),_0x22e8a9[_0x2af2('0x64')],_0x22e8a9[_0x2af2('0x5a')]))[_0x2af2('0x65')](_0x2af2('0x66')));}return rp(_0x1190c6)['then'](function(_0x3ff8b3){return _0xbb938c[_0x2af2('0x67')](_[_0x2af2('0x31')](_0x3ff8b3[_0x2af2('0x68')][_0x2af2('0x69')],function(_0xa88e64){return{'id':_0xa88e64[_0x2af2('0x2a')],'name':_0xa88e64[_0x2af2('0x2a')],'type':_0xa88e64[_0x2af2('0x2e')],'active':_0xa88e64[_0x2af2('0x6a')],'label':_0xa88e64['label'],'custom':!![]};}));});}})[_0x2af2('0x25')](function(_0x324bf3){return{'count':_0x324bf3['length'],'rows':_0x324bf3};})[_0x2af2('0x25')](respondWithResult(_0x2160b8,null))['catch'](function(_0x3880bb){var _0xb277d2=_0x269e4f['query'][_0x2af2('0x6b')]?0x1f4:_0x3880bb['statusCode']||0x1f4;logger[_0x2af2('0x28')](_0x2af2('0x6c'),_0x2af2('0x56'),_0xb277d2,JSON[_0x2af2('0x6d')](_0x3880bb));delete _0x3880bb[_0x2af2('0x2a')];if(_0xb277d2===0x191){_0xb277d2=0x190;}_0x2160b8[_0x2af2('0x19')](_0xb277d2)[_0x2af2('0x6e')](_0x269e4f[_0x2af2('0x33')][_0x2af2('0x6b')]?{'message':_0x2af2('0x6f'),'statusCode':_0x3880bb[_0x2af2('0x70')]}:_0x3880bb);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 078ed79..bc4a37c 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 _0x579d=['DeskAccount','../../config/logger','api','moment','request-promise','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x579d,0x160));var _0xd579=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x579d[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd579('0x0'))(_0xd579('0x1'));var moment=require(_0xd579('0x2'));var BPromise=require('bluebird');var rp=require(_0xd579('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd579('0x4'));var attributes=require(_0xd579('0x5'));var integrations=require(_0xd579('0x6'));module[_0xd579('0x7')]=function(_0x2c9da8,_0x30f1a9){return _0x2c9da8['define'](_0xd579('0x8'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84da=['request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','bluebird'];(function(_0x1ba19c,_0x3975e2){var _0x4e069b=function(_0xd95964){while(--_0xd95964){_0x1ba19c['push'](_0x1ba19c['shift']());}};_0x4e069b(++_0x3975e2);}(_0x84da,0x192));var _0xa84d=function(_0x533be8,_0x241b7a){_0x533be8=_0x533be8-0x0;var _0x33d0ca=_0x84da[_0x533be8];return _0x33d0ca;};'use strict';var _=require(_0xa84d('0x0'));var util=require(_0xa84d('0x1'));var logger=require(_0xa84d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa84d('0x3'));var rp=require(_0xa84d('0x4'));var fs=require('fs');var path=require(_0xa84d('0x5'));var rimraf=require(_0xa84d('0x6'));var config=require(_0xa84d('0x7'));var attributes=require(_0xa84d('0x8'));var integrations=require(_0xa84d('0x9'));module[_0xa84d('0xa')]=function(_0x5eca5f,_0x488f96){return _0x5eca5f[_0xa84d('0xb')](_0xa84d('0xc'),attributes,{'tableName':_0xa84d('0xd'),'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 23a8018..0b3d642 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 _0xfe5a=['rpc','../../config/environment','jayson/promise','client','request','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','model','include','map','then','debug','catch','ShowDeskAccount','lodash','moment','randomstring','ioredis','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe5a,0xe2));var _0xafe5=function(_0x57f091,_0x5ce496){_0x57f091=_0x57f091-0x0;var _0x124169=_0xfe5a[_0x57f091];return _0x124169;};'use strict';var _=require(_0xafe5('0x0'));var util=require('util');var moment=require(_0xafe5('0x1'));var BPromise=require('bluebird');var rs=require(_0xafe5('0x2'));var fs=require('fs');var Redis=require(_0xafe5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xafe5('0x4'));var logger=require('../../config/logger')(_0xafe5('0x5'));var config=require(_0xafe5('0x6'));var jayson=require(_0xafe5('0x7'));var client=jayson[_0xafe5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3370e4,_0x43f5a3,_0x880269){return new BPromise(function(_0x5f0bd7,_0x4d56b6){return client[_0xafe5('0x9')](_0x3370e4,_0x880269)['then'](function(_0x4eaaf6){logger['info'](_0xafe5('0xa'),_0x43f5a3,_0xafe5('0xb'));logger['debug'](_0xafe5('0xc'),_0x43f5a3,'request\x20sent',JSON[_0xafe5('0xd')](_0x4eaaf6));if(_0x4eaaf6[_0xafe5('0xe')]){if(_0x4eaaf6['error']['code']===0x1f4){logger[_0xafe5('0xe')](_0xafe5('0xa'),_0x43f5a3,_0x4eaaf6[_0xafe5('0xe')][_0xafe5('0xf')]);return _0x4d56b6(_0x4eaaf6['error'][_0xafe5('0xf')]);}logger[_0xafe5('0xe')]('DeskAccount,\x20%s,\x20%s',_0x43f5a3,_0x4eaaf6[_0xafe5('0xe')]['message']);return _0x5f0bd7(_0x4eaaf6[_0xafe5('0xe')][_0xafe5('0xf')]);}else{logger[_0xafe5('0x10')](_0xafe5('0xa'),_0x43f5a3,'request\x20sent');_0x5f0bd7(_0x4eaaf6[_0xafe5('0x11')]['message']);}})['catch'](function(_0x58e1fa){logger['error']('DeskAccount,\x20%s,\x20%s',_0x43f5a3,_0x58e1fa);_0x4d56b6(_0x58e1fa);});});}exports[_0xafe5('0x12')]=function(_0x597fa8){var _0x36fde1=this;return new Promise(function(_0x691df8,_0x3ff319){return db[_0xafe5('0x13')][_0xafe5('0x14')]({'raw':_0x597fa8[_0xafe5('0x15')]?_0x597fa8[_0xafe5('0x15')][_0xafe5('0x16')]===undefined?!![]:![]:!![],'where':_0x597fa8['options']?_0x597fa8[_0xafe5('0x15')][_0xafe5('0x17')]||null:null,'attributes':_0x597fa8[_0xafe5('0x15')]?_0x597fa8[_0xafe5('0x15')][_0xafe5('0x18')]||null:null,'limit':_0x597fa8[_0xafe5('0x15')]?_0x597fa8['options'][_0xafe5('0x19')]||null:null,'include':_0x597fa8[_0xafe5('0x15')]?_0x597fa8['options']['include']?_['map'](_0x597fa8['options']['include'],function(_0x115dfa){return{'model':db[_0x115dfa[_0xafe5('0x1a')]],'as':_0x115dfa['as'],'attributes':_0x115dfa[_0xafe5('0x18')],'include':_0x115dfa[_0xafe5('0x1b')]?_[_0xafe5('0x1c')](_0x115dfa[_0xafe5('0x1b')],function(_0x10a23e){return{'model':db[_0x10a23e['model']],'as':_0x10a23e['as'],'attributes':_0x10a23e[_0xafe5('0x18')],'include':_0x10a23e[_0xafe5('0x1b')]?_[_0xafe5('0x1c')](_0x10a23e[_0xafe5('0x1b')],function(_0x3101a7){return{'model':db[_0x3101a7[_0xafe5('0x1a')]],'as':_0x3101a7['as'],'attributes':_0x3101a7[_0xafe5('0x18')]};}):[]};}):[]};}):[]:[]})[_0xafe5('0x1d')](function(_0x3ea199){logger[_0xafe5('0x10')](_0xafe5('0x12'),_0x597fa8);logger[_0xafe5('0x1e')]('GetDeskAccount',_0x597fa8,JSON[_0xafe5('0xd')](_0x3ea199));_0x691df8(_0x3ea199);})[_0xafe5('0x1f')](function(_0x238032){logger['error']('GetDeskAccount',_0x238032[_0xafe5('0xf')],_0x597fa8);_0x3ff319(_0x36fde1[_0xafe5('0xe')](0x1f4,_0x238032[_0xafe5('0xf')]));});});};exports[_0xafe5('0x20')]=function(_0x47139){var _0x5ed5fa=this;return new Promise(function(_0x39b583,_0x365ece){return db[_0xafe5('0x13')]['find']({'raw':_0x47139[_0xafe5('0x15')]?_0x47139[_0xafe5('0x15')][_0xafe5('0x16')]===undefined?!![]:![]:!![],'where':_0x47139['options']?_0x47139[_0xafe5('0x15')][_0xafe5('0x17')]||null:null,'attributes':_0x47139[_0xafe5('0x15')]?_0x47139[_0xafe5('0x15')][_0xafe5('0x18')]||null:null,'include':_0x47139['options']?_0x47139[_0xafe5('0x15')][_0xafe5('0x1b')]?_[_0xafe5('0x1c')](_0x47139['options']['include'],function(_0x4f646d){return{'model':db[_0x4f646d[_0xafe5('0x1a')]],'as':_0x4f646d['as'],'attributes':_0x4f646d[_0xafe5('0x18')],'include':_0x4f646d[_0xafe5('0x1b')]?_['map'](_0x4f646d[_0xafe5('0x1b')],function(_0x3ace48){return{'model':db[_0x3ace48[_0xafe5('0x1a')]],'as':_0x3ace48['as'],'attributes':_0x3ace48[_0xafe5('0x18')],'include':_0x3ace48['include']?_['map'](_0x3ace48[_0xafe5('0x1b')],function(_0x5685da){return{'model':db[_0x5685da['model']],'as':_0x5685da['as'],'attributes':_0x5685da[_0xafe5('0x18')]};}):[]};}):[]};}):[]:[]})[_0xafe5('0x1d')](function(_0x3fbb0a){logger['info'](_0xafe5('0x20'),_0x47139);logger[_0xafe5('0x1e')](_0xafe5('0x20'),_0x47139,JSON['stringify'](_0x3fbb0a));_0x39b583(_0x3fbb0a);})[_0xafe5('0x1f')](function(_0x55be3b){logger[_0xafe5('0xe')]('ShowDeskAccount',_0x55be3b['message'],_0x47139);_0x365ece(_0x5ed5fa[_0xafe5('0xe')](0x1f4,_0x55be3b[_0xafe5('0xf')]));});});}; \ No newline at end of file +var _0x02c1=['debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','DeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetDeskAccount','DeskAccount','raw','options','where','limit','include','map','model','attributes','stringify','ShowDeskAccount'];(function(_0x37e136,_0x59434e){var _0xda4942=function(_0x38426e){while(--_0x38426e){_0x37e136['push'](_0x37e136['shift']());}};_0xda4942(++_0x59434e);}(_0x02c1,0x155));var _0x102c=function(_0x20b3ab,_0x5f54e9){_0x20b3ab=_0x20b3ab-0x0;var _0x293fd8=_0x02c1[_0x20b3ab];return _0x293fd8;};'use strict';var _=require(_0x102c('0x0'));var util=require(_0x102c('0x1'));var moment=require(_0x102c('0x2'));var BPromise=require(_0x102c('0x3'));var rs=require(_0x102c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x102c('0x5'))['db'];var utils=require(_0x102c('0x6'));var logger=require(_0x102c('0x7'))(_0x102c('0x8'));var config=require('../../config/environment');var jayson=require(_0x102c('0x9'));var client=jayson[_0x102c('0xa')][_0x102c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50ad27,_0x10ae16,_0x366f25){return new BPromise(function(_0x597b42,_0xb3c3f0){return client['request'](_0x50ad27,_0x366f25)[_0x102c('0xc')](function(_0x397573){logger['info'](_0x102c('0xd'),_0x10ae16,_0x102c('0xe'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x10ae16,_0x102c('0xe'),JSON['stringify'](_0x397573));if(_0x397573['error']){if(_0x397573[_0x102c('0xf')][_0x102c('0x10')]===0x1f4){logger[_0x102c('0xf')](_0x102c('0xd'),_0x10ae16,_0x397573[_0x102c('0xf')][_0x102c('0x11')]);return _0xb3c3f0(_0x397573[_0x102c('0xf')][_0x102c('0x11')]);}logger[_0x102c('0xf')](_0x102c('0xd'),_0x10ae16,_0x397573[_0x102c('0xf')]['message']);return _0x597b42(_0x397573[_0x102c('0xf')]['message']);}else{logger[_0x102c('0x12')](_0x102c('0xd'),_0x10ae16,_0x102c('0xe'));_0x597b42(_0x397573[_0x102c('0x13')][_0x102c('0x11')]);}})[_0x102c('0x14')](function(_0x16079e){logger['error'](_0x102c('0xd'),_0x10ae16,_0x16079e);_0xb3c3f0(_0x16079e);});});}exports[_0x102c('0x15')]=function(_0x246aae){var _0x423516=this;return new Promise(function(_0x549c9a,_0x21facf){return db[_0x102c('0x16')]['findAll']({'raw':_0x246aae['options']?_0x246aae['options'][_0x102c('0x17')]===undefined?!![]:![]:!![],'where':_0x246aae[_0x102c('0x18')]?_0x246aae[_0x102c('0x18')][_0x102c('0x19')]||null:null,'attributes':_0x246aae[_0x102c('0x18')]?_0x246aae[_0x102c('0x18')]['attributes']||null:null,'limit':_0x246aae[_0x102c('0x18')]?_0x246aae[_0x102c('0x18')][_0x102c('0x1a')]||null:null,'include':_0x246aae[_0x102c('0x18')]?_0x246aae[_0x102c('0x18')][_0x102c('0x1b')]?_[_0x102c('0x1c')](_0x246aae[_0x102c('0x18')]['include'],function(_0x1e4706){return{'model':db[_0x1e4706[_0x102c('0x1d')]],'as':_0x1e4706['as'],'attributes':_0x1e4706[_0x102c('0x1e')],'include':_0x1e4706[_0x102c('0x1b')]?_[_0x102c('0x1c')](_0x1e4706[_0x102c('0x1b')],function(_0xf28d09){return{'model':db[_0xf28d09[_0x102c('0x1d')]],'as':_0xf28d09['as'],'attributes':_0xf28d09[_0x102c('0x1e')],'include':_0xf28d09['include']?_['map'](_0xf28d09[_0x102c('0x1b')],function(_0x52e634){return{'model':db[_0x52e634['model']],'as':_0x52e634['as'],'attributes':_0x52e634[_0x102c('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x571346){logger[_0x102c('0x12')](_0x102c('0x15'),_0x246aae);logger['debug'](_0x102c('0x15'),_0x246aae,JSON[_0x102c('0x1f')](_0x571346));_0x549c9a(_0x571346);})[_0x102c('0x14')](function(_0x3386b2){logger['error'](_0x102c('0x15'),_0x3386b2[_0x102c('0x11')],_0x246aae);_0x21facf(_0x423516[_0x102c('0xf')](0x1f4,_0x3386b2[_0x102c('0x11')]));});});};exports['ShowDeskAccount']=function(_0x497453){var _0x527ff0=this;return new Promise(function(_0x45bfe0,_0x226ab0){return db[_0x102c('0x16')]['find']({'raw':_0x497453[_0x102c('0x18')]?_0x497453[_0x102c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x497453[_0x102c('0x18')]?_0x497453[_0x102c('0x18')][_0x102c('0x19')]||null:null,'attributes':_0x497453[_0x102c('0x18')]?_0x497453[_0x102c('0x18')]['attributes']||null:null,'include':_0x497453['options']?_0x497453[_0x102c('0x18')][_0x102c('0x1b')]?_['map'](_0x497453[_0x102c('0x18')][_0x102c('0x1b')],function(_0x45a8e7){return{'model':db[_0x45a8e7['model']],'as':_0x45a8e7['as'],'attributes':_0x45a8e7[_0x102c('0x1e')],'include':_0x45a8e7[_0x102c('0x1b')]?_['map'](_0x45a8e7[_0x102c('0x1b')],function(_0x3673a7){return{'model':db[_0x3673a7['model']],'as':_0x3673a7['as'],'attributes':_0x3673a7[_0x102c('0x1e')],'include':_0x3673a7['include']?_['map'](_0x3673a7[_0x102c('0x1b')],function(_0x57c776){return{'model':db[_0x57c776[_0x102c('0x1d')]],'as':_0x57c776['as'],'attributes':_0x57c776[_0x102c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x102c('0xc')](function(_0x204122){logger[_0x102c('0x12')](_0x102c('0x20'),_0x497453);logger[_0x102c('0x21')](_0x102c('0x20'),_0x497453,JSON[_0x102c('0x1f')](_0x204122));_0x45bfe0(_0x204122);})[_0x102c('0x14')](function(_0x10a528){logger['error'](_0x102c('0x20'),_0x10a528[_0x102c('0x11')],_0x497453);_0x226ab0(_0x527ff0[_0x102c('0xf')](0x1f4,_0x10a528['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index c294b55..225f837 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x10cbd8,_0x4e81f7){var _0x40c5ec=function(_0x386dcc){while(--_0x386dcc){_0x10cbd8['push'](_0x10cbd8['shift']());}};_0x40c5ec(++_0x4e81f7);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x1320ab,_0x4453bf){var _0x5e3250=function(_0x35b805){while(--_0x35b805){_0x1320ab['push'](_0x1320ab['shift']());}};_0x5e3250(++_0x4453bf);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 3e87fd9..2d4f1e9 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 _0xb63f=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb63f,0x174));var _0xfb63=function(_0x54f7c0,_0x27af83){_0x54f7c0=_0x54f7c0-0x0;var _0x245d03=_0xb63f[_0x54f7c0];return _0x245d03;};'use strict';var Sequelize=require(_0xfb63('0x0'));module[_0xfb63('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfb63('0x2')]}}; \ No newline at end of file +var _0xaa01=['STRING','sequelize','exports'];(function(_0xa3e0f7,_0x1b06db){var _0x4ce604=function(_0x29df1e){while(--_0x29df1e){_0xa3e0f7['push'](_0xa3e0f7['shift']());}};_0x4ce604(++_0x1b06db);}(_0xaa01,0x91));var _0x1aa0=function(_0x25e1f8,_0x4c5860){_0x25e1f8=_0x25e1f8-0x0;var _0x15b86a=_0xaa01[_0x25e1f8];return _0x15b86a;};'use strict';var Sequelize=require(_0x1aa0('0x0'));module[_0x1aa0('0x1')]={'name':{'type':Sequelize[_0x1aa0('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 64c1f04..3158e0b 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 _0xa535=['keys','find','create','update','body','params','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','map','rawAttributes','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','filter','options','DeskConfiguration','includeAll','include','findAll','catch'];(function(_0x710083,_0x31b009){var _0x4871b=function(_0x25662c){while(--_0x25662c){_0x710083['push'](_0x710083['shift']());}};_0x4871b(++_0x31b009);}(_0xa535,0xaf));var _0x5a53=function(_0x58c210,_0x2acdd8){_0x58c210=_0x58c210-0x0;var _0x1257f0=_0xa535[_0x58c210];return _0x1257f0;};'use strict';var emlformat=require(_0x5a53('0x0'));var rimraf=require(_0x5a53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5a53('0x2'));var rp=require('request-promise');var moment=require(_0x5a53('0x3'));var BPromise=require(_0x5a53('0x4'));var Mustache=require(_0x5a53('0x5'));var util=require(_0x5a53('0x6'));var path=require(_0x5a53('0x7'));var sox=require('sox');var csv=require(_0x5a53('0x8'));var ejs=require(_0x5a53('0x9'));var fs=require('fs');var fs_extra=require(_0x5a53('0xa'));var _=require('lodash');var squel=require(_0x5a53('0xb'));var crypto=require(_0x5a53('0xc'));var jsforce=require(_0x5a53('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5a53('0x8'));var querystring=require(_0x5a53('0xe'));var Papa=require(_0x5a53('0xf'));var Redis=require('ioredis');var authService=require(_0x5a53('0x10'));var qs=require(_0x5a53('0x11'));var as=require(_0x5a53('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5a53('0x13'));var config=require(_0x5a53('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a53('0x15'))['db'];function respondWithStatusCode(_0x273860,_0x14c709){_0x14c709=_0x14c709||0xcc;return function(_0x230ca2){if(_0x230ca2){return _0x273860[_0x5a53('0x16')](_0x14c709);}return _0x273860[_0x5a53('0x17')](_0x14c709)['end']();};}function respondWithResult(_0x4b7af1,_0x128290){_0x128290=_0x128290||0xc8;return function(_0xe32f51){if(_0xe32f51){return _0x4b7af1[_0x5a53('0x17')](_0x128290)[_0x5a53('0x18')](_0xe32f51);}};}function respondWithFilteredResult(_0x237336,_0x125d18){return function(_0x2b278e){if(_0x2b278e){var _0x492c87=typeof _0x125d18['offset']===_0x5a53('0x19')&&typeof _0x125d18[_0x5a53('0x1a')]===_0x5a53('0x19');var _0xd0b9ec=_0x2b278e[_0x5a53('0x1b')];var _0x222612=_0x492c87?0x0:_0x125d18[_0x5a53('0x1c')];var _0x3262a2=_0x492c87?_0x2b278e['count']:_0x125d18[_0x5a53('0x1c')]+_0x125d18[_0x5a53('0x1a')];var _0x16f8bd;if(_0x3262a2>=_0xd0b9ec){_0x3262a2=_0xd0b9ec;_0x16f8bd=0xc8;}else{_0x16f8bd=0xce;}_0x237336['status'](_0x16f8bd);return _0x237336[_0x5a53('0x1d')](_0x5a53('0x1e'),_0x222612+'-'+_0x3262a2+'/'+_0xd0b9ec)[_0x5a53('0x18')](_0x2b278e);}return null;};}function patchUpdates(_0x31f118){return function(_0x3fe1d8){try{jsonpatch[_0x5a53('0x1f')](_0x3fe1d8,_0x31f118,!![]);}catch(_0x20d595){return BPromise[_0x5a53('0x20')](_0x20d595);}return _0x3fe1d8['save']();};}function saveUpdates(_0x56292d,_0xc25b3){return function(_0x29c941){if(_0x29c941){return _0x29c941['update'](_0x56292d)[_0x5a53('0x21')](function(_0x2dfe20){return _0x2dfe20;});}return null;};}function removeEntity(_0x168694,_0x3f7802){return function(_0x5d036a){if(_0x5d036a){return _0x5d036a[_0x5a53('0x22')]()[_0x5a53('0x21')](function(){_0x168694[_0x5a53('0x17')](0xcc)[_0x5a53('0x23')]();});}};}function handleEntityNotFound(_0xa2121f,_0x240740){return function(_0x526210){if(!_0x526210){_0xa2121f[_0x5a53('0x16')](0x194);}return _0x526210;};}function handleError(_0x596b69,_0x23df64){_0x23df64=_0x23df64||0x1f4;return function(_0x511f38){logger[_0x5a53('0x24')](_0x511f38[_0x5a53('0x25')]);if(_0x511f38[_0x5a53('0x26')]){delete _0x511f38[_0x5a53('0x26')];}_0x596b69[_0x5a53('0x17')](_0x23df64)[_0x5a53('0x27')](_0x511f38);};}exports[_0x5a53('0x28')]=function(_0x189c71,_0x141b5b){var _0x10ce93={},_0x47bb43={},_0xe38853={'count':0x0,'rows':[]};var _0x330095=_[_0x5a53('0x29')](db['DeskConfiguration'][_0x5a53('0x2a')],function(_0x39db97){return{'name':_0x39db97['fieldName'],'type':_0x39db97[_0x5a53('0x2b')]['key']};});_0x47bb43['model']=_[_0x5a53('0x29')](_0x330095,_0x5a53('0x26'));_0x47bb43['query']=_['keys'](_0x189c71[_0x5a53('0x2c')]);_0x47bb43['filters']=_[_0x5a53('0x2d')](_0x47bb43[_0x5a53('0x2e')],_0x47bb43[_0x5a53('0x2c')]);_0x10ce93[_0x5a53('0x2f')]=_[_0x5a53('0x2d')](_0x47bb43[_0x5a53('0x2e')],qs[_0x5a53('0x30')](_0x189c71[_0x5a53('0x2c')][_0x5a53('0x30')]));_0x10ce93[_0x5a53('0x2f')]=_0x10ce93[_0x5a53('0x2f')][_0x5a53('0x31')]?_0x10ce93[_0x5a53('0x2f')]:_0x47bb43[_0x5a53('0x2e')];if(!_0x189c71[_0x5a53('0x2c')][_0x5a53('0x32')](_0x5a53('0x33'))){_0x10ce93[_0x5a53('0x1a')]=qs[_0x5a53('0x1a')](_0x189c71[_0x5a53('0x2c')][_0x5a53('0x1a')]);_0x10ce93['offset']=qs[_0x5a53('0x1c')](_0x189c71[_0x5a53('0x2c')][_0x5a53('0x1c')]);}_0x10ce93[_0x5a53('0x34')]=qs[_0x5a53('0x35')](_0x189c71[_0x5a53('0x2c')][_0x5a53('0x35')]);_0x10ce93[_0x5a53('0x36')]=qs['filters'](_[_0x5a53('0x37')](_0x189c71[_0x5a53('0x2c')],_0x47bb43[_0x5a53('0x38')]),_0x330095);if(_0x189c71[_0x5a53('0x2c')]['filter']){_0x10ce93['where']=_[_0x5a53('0x39')](_0x10ce93[_0x5a53('0x36')],{'$or':_[_0x5a53('0x29')](_0x330095,function(_0x21025d){if(_0x21025d[_0x5a53('0x2b')]!=='VIRTUAL'){var _0x5554eb={};_0x5554eb[_0x21025d['name']]={'$like':'%'+_0x189c71[_0x5a53('0x2c')][_0x5a53('0x3a')]+'%'};return _0x5554eb;}})});}_0x10ce93=_[_0x5a53('0x39')]({},_0x10ce93,_0x189c71[_0x5a53('0x3b')]);var _0x248a03={'where':_0x10ce93[_0x5a53('0x36')]};return db[_0x5a53('0x3c')][_0x5a53('0x1b')](_0x248a03)['then'](function(_0x138f78){_0xe38853[_0x5a53('0x1b')]=_0x138f78;if(_0x189c71[_0x5a53('0x2c')][_0x5a53('0x3d')]){_0x10ce93[_0x5a53('0x3e')]=[{'all':!![]}];}return db[_0x5a53('0x3c')][_0x5a53('0x3f')](_0x10ce93);})[_0x5a53('0x21')](function(_0x2833da){_0xe38853['rows']=_0x2833da;return _0xe38853;})[_0x5a53('0x21')](respondWithFilteredResult(_0x141b5b,_0x10ce93))[_0x5a53('0x40')](handleError(_0x141b5b,null));};exports['show']=function(_0x25ce0d,_0x155ee7){var _0x308719={'raw':![],'where':{'id':_0x25ce0d['params']['id']}},_0x2c8aec={};_0x2c8aec[_0x5a53('0x2e')]=_['keys'](db[_0x5a53('0x3c')][_0x5a53('0x2a')]);_0x2c8aec[_0x5a53('0x2c')]=_[_0x5a53('0x41')](_0x25ce0d[_0x5a53('0x2c')]);_0x2c8aec[_0x5a53('0x38')]=_[_0x5a53('0x2d')](_0x2c8aec[_0x5a53('0x2e')],_0x2c8aec[_0x5a53('0x2c')]);_0x308719[_0x5a53('0x2f')]=_[_0x5a53('0x2d')](_0x2c8aec['model'],qs[_0x5a53('0x30')](_0x25ce0d[_0x5a53('0x2c')]['fields']));_0x308719['attributes']=_0x308719['attributes']['length']?_0x308719[_0x5a53('0x2f')]:_0x2c8aec[_0x5a53('0x2e')];if(_0x25ce0d[_0x5a53('0x2c')][_0x5a53('0x3d')]){_0x308719[_0x5a53('0x3e')]=[{'all':!![]}];}_0x308719=_[_0x5a53('0x39')]({},_0x308719,_0x25ce0d[_0x5a53('0x3b')]);return db[_0x5a53('0x3c')][_0x5a53('0x42')](_0x308719)[_0x5a53('0x21')](handleEntityNotFound(_0x155ee7,null))['then'](respondWithResult(_0x155ee7,null))[_0x5a53('0x40')](handleError(_0x155ee7,null));};exports[_0x5a53('0x43')]=function(_0x2a3e61,_0x59bf17){return db[_0x5a53('0x3c')][_0x5a53('0x43')](_0x2a3e61['body'],{})['then'](respondWithResult(_0x59bf17,0xc9))[_0x5a53('0x40')](handleError(_0x59bf17,null));};exports[_0x5a53('0x44')]=function(_0x12d39a,_0x374817){if(_0x12d39a[_0x5a53('0x45')]['id']){delete _0x12d39a[_0x5a53('0x45')]['id'];}return db[_0x5a53('0x3c')][_0x5a53('0x42')]({'where':{'id':_0x12d39a[_0x5a53('0x46')]['id']}})[_0x5a53('0x21')](handleEntityNotFound(_0x374817,null))[_0x5a53('0x21')](saveUpdates(_0x12d39a[_0x5a53('0x45')],null))[_0x5a53('0x21')](respondWithResult(_0x374817,null))[_0x5a53('0x40')](handleError(_0x374817,null));};exports[_0x5a53('0x22')]=function(_0x1a8cf5,_0x51be7d){return db[_0x5a53('0x3c')]['find']({'where':{'id':_0x1a8cf5[_0x5a53('0x46')]['id']}})[_0x5a53('0x21')](handleEntityNotFound(_0x51be7d,null))[_0x5a53('0x21')](removeEntity(_0x51be7d,null))[_0x5a53('0x40')](handleError(_0x51be7d,null));};exports[_0x5a53('0x47')]=function(_0x650294,_0x5a8a5a,_0x458c32){var _0xc84031={};var _0x3e09da={};var _0x2f1e95;var _0x1923cc;return db[_0x5a53('0x3c')][_0x5a53('0x48')]({'where':{'id':_0x650294['params']['id']}})['then'](handleEntityNotFound(_0x5a8a5a,null))['then'](function(_0x5d9ddd){if(_0x5d9ddd){_0x2f1e95=_0x5d9ddd;_0x3e09da['model']=_[_0x5a53('0x41')](db[_0x5a53('0x49')]['rawAttributes']);_0x3e09da[_0x5a53('0x2c')]=_[_0x5a53('0x41')](_0x650294['query']);_0x3e09da[_0x5a53('0x38')]=_[_0x5a53('0x2d')](_0x3e09da['model'],_0x3e09da[_0x5a53('0x2c')]);_0xc84031[_0x5a53('0x2f')]=_[_0x5a53('0x2d')](_0x3e09da[_0x5a53('0x2e')],qs[_0x5a53('0x30')](_0x650294[_0x5a53('0x2c')][_0x5a53('0x30')]));_0xc84031[_0x5a53('0x2f')]=_0xc84031[_0x5a53('0x2f')]['length']?_0xc84031['attributes']:_0x3e09da[_0x5a53('0x2e')];_0xc84031[_0x5a53('0x34')]=qs[_0x5a53('0x35')](_0x650294[_0x5a53('0x2c')][_0x5a53('0x35')]);_0xc84031[_0x5a53('0x36')]=qs[_0x5a53('0x38')](_[_0x5a53('0x37')](_0x650294['query'],_0x3e09da[_0x5a53('0x38')]));if(_0x650294[_0x5a53('0x2c')][_0x5a53('0x3a')]){_0xc84031[_0x5a53('0x36')]=_[_0x5a53('0x39')](_0xc84031[_0x5a53('0x36')],{'$or':_['map'](_0xc84031['attributes'],function(_0x186e6f){var _0x1b77e0={};_0x1b77e0[_0x186e6f]={'$like':'%'+_0x650294[_0x5a53('0x2c')][_0x5a53('0x3a')]+'%'};return _0x1b77e0;})});}_0xc84031=_[_0x5a53('0x39')]({},_0xc84031,_0x650294['options']);return _0x2f1e95[_0x5a53('0x47')](_0xc84031);}})[_0x5a53('0x21')](function(_0x189c1e){if(_0x189c1e){_0x1923cc=_0x189c1e[_0x5a53('0x31')];if(!_0x650294['query'][_0x5a53('0x32')](_0x5a53('0x33'))){_0xc84031[_0x5a53('0x1a')]=qs[_0x5a53('0x1a')](_0x650294[_0x5a53('0x2c')][_0x5a53('0x1a')]);_0xc84031[_0x5a53('0x1c')]=qs['offset'](_0x650294['query']['offset']);}return _0x2f1e95[_0x5a53('0x47')](_0xc84031);}})[_0x5a53('0x21')](function(_0x56731c){if(_0x56731c){return _0x56731c?{'count':_0x1923cc,'rows':_0x56731c}:null;}})['then'](respondWithResult(_0x5a8a5a,null))[_0x5a53('0x40')](handleError(_0x5a8a5a,null));};exports[_0x5a53('0x4a')]=function(_0x418c99,_0xea6beb,_0x5d89b0){var _0x3866b6={};var _0x43a66e={};var _0x9c528d;var _0x39dd76;return db[_0x5a53('0x3c')]['findOne']({'where':{'id':_0x418c99[_0x5a53('0x46')]['id']}})[_0x5a53('0x21')](handleEntityNotFound(_0xea6beb,null))[_0x5a53('0x21')](function(_0x4fd7ca){if(_0x4fd7ca){_0x9c528d=_0x4fd7ca;_0x43a66e[_0x5a53('0x2e')]=_[_0x5a53('0x41')](db[_0x5a53('0x49')][_0x5a53('0x2a')]);_0x43a66e[_0x5a53('0x2c')]=_['keys'](_0x418c99['query']);_0x43a66e['filters']=_[_0x5a53('0x2d')](_0x43a66e['model'],_0x43a66e[_0x5a53('0x2c')]);_0x3866b6['attributes']=_[_0x5a53('0x2d')](_0x43a66e['model'],qs['fields'](_0x418c99[_0x5a53('0x2c')][_0x5a53('0x30')]));_0x3866b6[_0x5a53('0x2f')]=_0x3866b6[_0x5a53('0x2f')]['length']?_0x3866b6['attributes']:_0x43a66e[_0x5a53('0x2e')];_0x3866b6[_0x5a53('0x34')]=qs[_0x5a53('0x35')](_0x418c99[_0x5a53('0x2c')][_0x5a53('0x35')]);_0x3866b6[_0x5a53('0x36')]=qs[_0x5a53('0x38')](_[_0x5a53('0x37')](_0x418c99[_0x5a53('0x2c')],_0x43a66e[_0x5a53('0x38')]));if(_0x418c99[_0x5a53('0x2c')][_0x5a53('0x3a')]){_0x3866b6[_0x5a53('0x36')]=_[_0x5a53('0x39')](_0x3866b6[_0x5a53('0x36')],{'$or':_['map'](_0x3866b6[_0x5a53('0x2f')],function(_0xa8b242){var _0x5d43ab={};_0x5d43ab[_0xa8b242]={'$like':'%'+_0x418c99['query']['filter']+'%'};return _0x5d43ab;})});}_0x3866b6=_[_0x5a53('0x39')]({},_0x3866b6,_0x418c99[_0x5a53('0x3b')]);return _0x9c528d[_0x5a53('0x4a')](_0x3866b6);}})[_0x5a53('0x21')](function(_0x58d6b7){if(_0x58d6b7){_0x39dd76=_0x58d6b7[_0x5a53('0x31')];if(!_0x418c99[_0x5a53('0x2c')][_0x5a53('0x32')]('nolimit')){_0x3866b6[_0x5a53('0x1a')]=qs[_0x5a53('0x1a')](_0x418c99[_0x5a53('0x2c')][_0x5a53('0x1a')]);_0x3866b6[_0x5a53('0x1c')]=qs[_0x5a53('0x1c')](_0x418c99[_0x5a53('0x2c')]['offset']);}return _0x9c528d[_0x5a53('0x4a')](_0x3866b6);}})[_0x5a53('0x21')](function(_0x390a0f){if(_0x390a0f){return _0x390a0f?{'count':_0x39dd76,'rows':_0x390a0f}:null;}})[_0x5a53('0x21')](respondWithResult(_0xea6beb,null))[_0x5a53('0x40')](handleError(_0xea6beb,null));};exports[_0x5a53('0x4b')]=function(_0x5e91ca,_0xd0c9b3,_0x11bee4){var _0x2d1346={};var _0x4aade4={};var _0x378928;var _0x44e948;return db[_0x5a53('0x3c')]['findOne']({'where':{'id':_0x5e91ca[_0x5a53('0x46')]['id']}})[_0x5a53('0x21')](handleEntityNotFound(_0xd0c9b3,null))[_0x5a53('0x21')](function(_0x5bfa81){if(_0x5bfa81){_0x378928=_0x5bfa81;_0x4aade4[_0x5a53('0x2e')]=_['keys'](db[_0x5a53('0x49')][_0x5a53('0x2a')]);_0x4aade4[_0x5a53('0x2c')]=_[_0x5a53('0x41')](_0x5e91ca[_0x5a53('0x2c')]);_0x4aade4[_0x5a53('0x38')]=_['intersection'](_0x4aade4[_0x5a53('0x2e')],_0x4aade4[_0x5a53('0x2c')]);_0x2d1346[_0x5a53('0x2f')]=_[_0x5a53('0x2d')](_0x4aade4[_0x5a53('0x2e')],qs[_0x5a53('0x30')](_0x5e91ca[_0x5a53('0x2c')][_0x5a53('0x30')]));_0x2d1346[_0x5a53('0x2f')]=_0x2d1346['attributes']['length']?_0x2d1346[_0x5a53('0x2f')]:_0x4aade4['model'];_0x2d1346['order']=qs['sort'](_0x5e91ca[_0x5a53('0x2c')][_0x5a53('0x35')]);_0x2d1346['where']=qs['filters'](_[_0x5a53('0x37')](_0x5e91ca[_0x5a53('0x2c')],_0x4aade4[_0x5a53('0x38')]));if(_0x5e91ca['query'][_0x5a53('0x3a')]){_0x2d1346[_0x5a53('0x36')]=_['merge'](_0x2d1346['where'],{'$or':_[_0x5a53('0x29')](_0x2d1346[_0x5a53('0x2f')],function(_0x3cfae8){var _0x3b63ad={};_0x3b63ad[_0x3cfae8]={'$like':'%'+_0x5e91ca[_0x5a53('0x2c')]['filter']+'%'};return _0x3b63ad;})});}_0x2d1346=_[_0x5a53('0x39')]({},_0x2d1346,_0x5e91ca['options']);return _0x378928[_0x5a53('0x4b')](_0x2d1346);}})[_0x5a53('0x21')](function(_0x2d0bba){if(_0x2d0bba){_0x44e948=_0x2d0bba['length'];if(!_0x5e91ca[_0x5a53('0x2c')][_0x5a53('0x32')](_0x5a53('0x33'))){_0x2d1346[_0x5a53('0x1a')]=qs[_0x5a53('0x1a')](_0x5e91ca[_0x5a53('0x2c')]['limit']);_0x2d1346[_0x5a53('0x1c')]=qs[_0x5a53('0x1c')](_0x5e91ca[_0x5a53('0x2c')][_0x5a53('0x1c')]);}return _0x378928[_0x5a53('0x4b')](_0x2d1346);}})[_0x5a53('0x21')](function(_0x1448de){if(_0x1448de){return _0x1448de?{'count':_0x44e948,'rows':_0x1448de}:null;}})[_0x5a53('0x21')](respondWithResult(_0xd0c9b3,null))['catch'](handleError(_0xd0c9b3,null));};exports[_0x5a53('0x4c')]=function(_0x352f97,_0x30a8e0,_0x2fb3a2){var _0x4c56c3={};var _0x31bee2={};var _0x149d9f;var _0x5a9ea1;return db[_0x5a53('0x3c')][_0x5a53('0x48')]({'where':{'id':_0x352f97[_0x5a53('0x46')]['id']}})['then'](handleEntityNotFound(_0x30a8e0,null))[_0x5a53('0x21')](function(_0x2df8d0){if(_0x2df8d0){_0x149d9f=_0x2df8d0;_0x31bee2['model']=_['keys'](db[_0x5a53('0x4d')][_0x5a53('0x2a')]);_0x31bee2[_0x5a53('0x2c')]=_[_0x5a53('0x41')](_0x352f97[_0x5a53('0x2c')]);_0x31bee2['filters']=_[_0x5a53('0x2d')](_0x31bee2[_0x5a53('0x2e')],_0x31bee2[_0x5a53('0x2c')]);_0x4c56c3['attributes']=_[_0x5a53('0x2d')](_0x31bee2[_0x5a53('0x2e')],qs[_0x5a53('0x30')](_0x352f97['query']['fields']));_0x4c56c3[_0x5a53('0x2f')]=_0x4c56c3[_0x5a53('0x2f')]['length']?_0x4c56c3['attributes']:_0x31bee2['model'];_0x4c56c3[_0x5a53('0x34')]=qs['sort'](_0x352f97[_0x5a53('0x2c')]['sort']);_0x4c56c3['where']=qs[_0x5a53('0x38')](_[_0x5a53('0x37')](_0x352f97['query'],_0x31bee2[_0x5a53('0x38')]));if(_0x352f97[_0x5a53('0x2c')]['filter']){_0x4c56c3[_0x5a53('0x36')]=_[_0x5a53('0x39')](_0x4c56c3[_0x5a53('0x36')],{'$or':_[_0x5a53('0x29')](_0x4c56c3[_0x5a53('0x2f')],function(_0x3989e8){var _0x251d89={};_0x251d89[_0x3989e8]={'$like':'%'+_0x352f97[_0x5a53('0x2c')]['filter']+'%'};return _0x251d89;})});}_0x4c56c3=_[_0x5a53('0x39')]({},_0x4c56c3,_0x352f97[_0x5a53('0x3b')]);return _0x149d9f['getTags'](_0x4c56c3);}})[_0x5a53('0x21')](function(_0x5d73be){if(_0x5d73be){_0x5a9ea1=_0x5d73be[_0x5a53('0x31')];if(!_0x352f97[_0x5a53('0x2c')][_0x5a53('0x32')](_0x5a53('0x33'))){_0x4c56c3[_0x5a53('0x1a')]=qs[_0x5a53('0x1a')](_0x352f97['query'][_0x5a53('0x1a')]);_0x4c56c3[_0x5a53('0x1c')]=qs[_0x5a53('0x1c')](_0x352f97[_0x5a53('0x2c')]['offset']);}return _0x149d9f['getTags'](_0x4c56c3);}})[_0x5a53('0x21')](function(_0x2c962b){if(_0x2c962b){return _0x2c962b?{'count':_0x5a9ea1,'rows':_0x2c962b}:null;}})[_0x5a53('0x21')](respondWithResult(_0x30a8e0,null))[_0x5a53('0x40')](handleError(_0x30a8e0,null));};exports[_0x5a53('0x4e')]=function(_0x4034d9,_0x1b5568,_0x5068d9){if(_0x4034d9[_0x5a53('0x45')]['id']){delete _0x4034d9[_0x5a53('0x45')]['id'];}return db[_0x5a53('0x3c')][_0x5a53('0x48')]({'where':{'id':_0x4034d9[_0x5a53('0x46')]['id']}})[_0x5a53('0x21')](handleEntityNotFound(_0x1b5568,null))[_0x5a53('0x21')](function(_0x3badd8){if(_0x3badd8){return _0x3badd8[_0x5a53('0x4e')](_0x4034d9[_0x5a53('0x45')][_0x5a53('0x4f')]||[]);}return null;})[_0x5a53('0x21')](respondWithResult(_0x1b5568,null))['catch'](handleError(_0x1b5568,null));}; \ No newline at end of file +var _0x963d=['attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','find','create','catch','getFields','findOne','DeskField','getSubjects','nolimit','getDescriptions','getTags','setTags','body','ids','rimraf','fast-json-patch','request-promise','moment','bluebird','path','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','stack','name','send','map','DeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x10ba57,_0x15788f){var _0x3fa59e=function(_0x39f9d0){while(--_0x39f9d0){_0x10ba57['push'](_0x10ba57['shift']());}};_0x3fa59e(++_0x15788f);}(_0x963d,0xc5));var _0xd963=function(_0x333e89,_0x51983c){_0x333e89=_0x333e89-0x0;var _0x52c146=_0x963d[_0x333e89];return _0x52c146;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd963('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd963('0x1'));var rp=require(_0xd963('0x2'));var moment=require(_0xd963('0x3'));var BPromise=require(_0xd963('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd963('0x5'));var sox=require(_0xd963('0x6'));var csv=require(_0xd963('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd963('0x8'));var _=require(_0xd963('0x9'));var squel=require('squel');var crypto=require(_0xd963('0xa'));var jsforce=require(_0xd963('0xb'));var deskjs=require(_0xd963('0xc'));var toCsv=require(_0xd963('0x7'));var querystring=require(_0xd963('0xd'));var Papa=require(_0xd963('0xe'));var Redis=require(_0xd963('0xf'));var authService=require(_0xd963('0x10'));var qs=require(_0xd963('0x11'));var as=require(_0xd963('0x12'));var hardwareService=require(_0xd963('0x13'));var logger=require(_0xd963('0x14'))(_0xd963('0x15'));var utils=require(_0xd963('0x16'));var config=require(_0xd963('0x17'));var licenseUtil=require(_0xd963('0x18'));var db=require(_0xd963('0x19'))['db'];function respondWithStatusCode(_0x5081d7,_0x4d9198){_0x4d9198=_0x4d9198||0xcc;return function(_0x2353ce){if(_0x2353ce){return _0x5081d7[_0xd963('0x1a')](_0x4d9198);}return _0x5081d7[_0xd963('0x1b')](_0x4d9198)[_0xd963('0x1c')]();};}function respondWithResult(_0x46d992,_0x538d9c){_0x538d9c=_0x538d9c||0xc8;return function(_0x897bd6){if(_0x897bd6){return _0x46d992[_0xd963('0x1b')](_0x538d9c)['json'](_0x897bd6);}};}function respondWithFilteredResult(_0x151c03,_0x4e0704){return function(_0x29c273){if(_0x29c273){var _0x20ec64=typeof _0x4e0704[_0xd963('0x1d')]===_0xd963('0x1e')&&typeof _0x4e0704[_0xd963('0x1f')]==='undefined';var _0x261b7e=_0x29c273[_0xd963('0x20')];var _0x180418=_0x20ec64?0x0:_0x4e0704[_0xd963('0x1d')];var _0x66561d=_0x20ec64?_0x29c273[_0xd963('0x20')]:_0x4e0704['offset']+_0x4e0704[_0xd963('0x1f')];var _0x545d07;if(_0x66561d>=_0x261b7e){_0x66561d=_0x261b7e;_0x545d07=0xc8;}else{_0x545d07=0xce;}_0x151c03['status'](_0x545d07);return _0x151c03[_0xd963('0x21')](_0xd963('0x22'),_0x180418+'-'+_0x66561d+'/'+_0x261b7e)['json'](_0x29c273);}return null;};}function patchUpdates(_0x2ef36a){return function(_0x55e1a8){try{jsonpatch['apply'](_0x55e1a8,_0x2ef36a,!![]);}catch(_0x17a4d0){return BPromise[_0xd963('0x23')](_0x17a4d0);}return _0x55e1a8['save']();};}function saveUpdates(_0x28af8c,_0x5262db){return function(_0x44d9c7){if(_0x44d9c7){return _0x44d9c7[_0xd963('0x24')](_0x28af8c)[_0xd963('0x25')](function(_0x3e4779){return _0x3e4779;});}return null;};}function removeEntity(_0x2aa727,_0x382845){return function(_0x2c10eb){if(_0x2c10eb){return _0x2c10eb[_0xd963('0x26')]()[_0xd963('0x25')](function(){_0x2aa727[_0xd963('0x1b')](0xcc)[_0xd963('0x1c')]();});}};}function handleEntityNotFound(_0xc7f3e0,_0x121b91){return function(_0x1a3db4){if(!_0x1a3db4){_0xc7f3e0[_0xd963('0x1a')](0x194);}return _0x1a3db4;};}function handleError(_0x2e22c8,_0x226440){_0x226440=_0x226440||0x1f4;return function(_0x45b12c){logger['error'](_0x45b12c[_0xd963('0x27')]);if(_0x45b12c['name']){delete _0x45b12c[_0xd963('0x28')];}_0x2e22c8['status'](_0x226440)[_0xd963('0x29')](_0x45b12c);};}exports['index']=function(_0x4efbe6,_0x49e2ba){var _0x1dfbcf={},_0x44cb3d={},_0x82c73={'count':0x0,'rows':[]};var _0x164ea8=_[_0xd963('0x2a')](db[_0xd963('0x2b')][_0xd963('0x2c')],function(_0x50499b){return{'name':_0x50499b['fieldName'],'type':_0x50499b[_0xd963('0x2d')][_0xd963('0x2e')]};});_0x44cb3d[_0xd963('0x2f')]=_['map'](_0x164ea8,'name');_0x44cb3d[_0xd963('0x30')]=_[_0xd963('0x31')](_0x4efbe6[_0xd963('0x30')]);_0x44cb3d[_0xd963('0x32')]=_[_0xd963('0x33')](_0x44cb3d[_0xd963('0x2f')],_0x44cb3d[_0xd963('0x30')]);_0x1dfbcf[_0xd963('0x34')]=_[_0xd963('0x33')](_0x44cb3d['model'],qs[_0xd963('0x35')](_0x4efbe6['query']['fields']));_0x1dfbcf[_0xd963('0x34')]=_0x1dfbcf[_0xd963('0x34')]['length']?_0x1dfbcf[_0xd963('0x34')]:_0x44cb3d['model'];if(!_0x4efbe6['query'][_0xd963('0x36')]('nolimit')){_0x1dfbcf[_0xd963('0x1f')]=qs[_0xd963('0x1f')](_0x4efbe6[_0xd963('0x30')][_0xd963('0x1f')]);_0x1dfbcf['offset']=qs[_0xd963('0x1d')](_0x4efbe6[_0xd963('0x30')][_0xd963('0x1d')]);}_0x1dfbcf[_0xd963('0x37')]=qs['sort'](_0x4efbe6[_0xd963('0x30')][_0xd963('0x38')]);_0x1dfbcf[_0xd963('0x39')]=qs[_0xd963('0x32')](_[_0xd963('0x3a')](_0x4efbe6[_0xd963('0x30')],_0x44cb3d[_0xd963('0x32')]),_0x164ea8);if(_0x4efbe6['query'][_0xd963('0x3b')]){_0x1dfbcf[_0xd963('0x39')]=_['merge'](_0x1dfbcf[_0xd963('0x39')],{'$or':_[_0xd963('0x2a')](_0x164ea8,function(_0x364a7c){if(_0x364a7c[_0xd963('0x2d')]!==_0xd963('0x3c')){var _0x100ae6={};_0x100ae6[_0x364a7c[_0xd963('0x28')]]={'$like':'%'+_0x4efbe6[_0xd963('0x30')][_0xd963('0x3b')]+'%'};return _0x100ae6;}})});}_0x1dfbcf=_[_0xd963('0x3d')]({},_0x1dfbcf,_0x4efbe6[_0xd963('0x3e')]);var _0x4a36f2={'where':_0x1dfbcf[_0xd963('0x39')]};return db[_0xd963('0x2b')][_0xd963('0x20')](_0x4a36f2)[_0xd963('0x25')](function(_0x4867c1){_0x82c73[_0xd963('0x20')]=_0x4867c1;if(_0x4efbe6['query'][_0xd963('0x3f')]){_0x1dfbcf[_0xd963('0x40')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xd963('0x41')](_0x1dfbcf);})['then'](function(_0x575a4d){_0x82c73[_0xd963('0x42')]=_0x575a4d;return _0x82c73;})['then'](respondWithFilteredResult(_0x49e2ba,_0x1dfbcf))['catch'](handleError(_0x49e2ba,null));};exports[_0xd963('0x43')]=function(_0x344f5a,_0x4c0619){var _0x28a6ce={'raw':![],'where':{'id':_0x344f5a[_0xd963('0x44')]['id']}},_0x2c7369={};_0x2c7369['model']=_['keys'](db['DeskConfiguration'][_0xd963('0x2c')]);_0x2c7369[_0xd963('0x30')]=_['keys'](_0x344f5a[_0xd963('0x30')]);_0x2c7369[_0xd963('0x32')]=_[_0xd963('0x33')](_0x2c7369[_0xd963('0x2f')],_0x2c7369['query']);_0x28a6ce['attributes']=_[_0xd963('0x33')](_0x2c7369[_0xd963('0x2f')],qs['fields'](_0x344f5a[_0xd963('0x30')][_0xd963('0x35')]));_0x28a6ce[_0xd963('0x34')]=_0x28a6ce['attributes'][_0xd963('0x45')]?_0x28a6ce[_0xd963('0x34')]:_0x2c7369[_0xd963('0x2f')];if(_0x344f5a[_0xd963('0x30')]['includeAll']){_0x28a6ce[_0xd963('0x40')]=[{'all':!![]}];}_0x28a6ce=_[_0xd963('0x3d')]({},_0x28a6ce,_0x344f5a[_0xd963('0x3e')]);return db['DeskConfiguration'][_0xd963('0x46')](_0x28a6ce)[_0xd963('0x25')](handleEntityNotFound(_0x4c0619,null))[_0xd963('0x25')](respondWithResult(_0x4c0619,null))['catch'](handleError(_0x4c0619,null));};exports[_0xd963('0x47')]=function(_0x560cfb,_0x147b8a){return db['DeskConfiguration'][_0xd963('0x47')](_0x560cfb['body'],{})['then'](respondWithResult(_0x147b8a,0xc9))[_0xd963('0x48')](handleError(_0x147b8a,null));};exports[_0xd963('0x24')]=function(_0x266315,_0x4f876e){if(_0x266315['body']['id']){delete _0x266315['body']['id'];}return db['DeskConfiguration'][_0xd963('0x46')]({'where':{'id':_0x266315[_0xd963('0x44')]['id']}})[_0xd963('0x25')](handleEntityNotFound(_0x4f876e,null))['then'](saveUpdates(_0x266315['body'],null))[_0xd963('0x25')](respondWithResult(_0x4f876e,null))[_0xd963('0x48')](handleError(_0x4f876e,null));};exports['destroy']=function(_0x561484,_0x292d44){return db[_0xd963('0x2b')][_0xd963('0x46')]({'where':{'id':_0x561484[_0xd963('0x44')]['id']}})[_0xd963('0x25')](handleEntityNotFound(_0x292d44,null))[_0xd963('0x25')](removeEntity(_0x292d44,null))['catch'](handleError(_0x292d44,null));};exports[_0xd963('0x49')]=function(_0x22cde4,_0x57358c,_0x57a2be){var _0x5bb3d2={};var _0x2b0d88={};var _0x411b0f;var _0x2e2d74;return db[_0xd963('0x2b')][_0xd963('0x4a')]({'where':{'id':_0x22cde4[_0xd963('0x44')]['id']}})[_0xd963('0x25')](handleEntityNotFound(_0x57358c,null))[_0xd963('0x25')](function(_0xf96e10){if(_0xf96e10){_0x411b0f=_0xf96e10;_0x2b0d88[_0xd963('0x2f')]=_[_0xd963('0x31')](db[_0xd963('0x4b')][_0xd963('0x2c')]);_0x2b0d88[_0xd963('0x30')]=_[_0xd963('0x31')](_0x22cde4[_0xd963('0x30')]);_0x2b0d88[_0xd963('0x32')]=_[_0xd963('0x33')](_0x2b0d88['model'],_0x2b0d88[_0xd963('0x30')]);_0x5bb3d2[_0xd963('0x34')]=_[_0xd963('0x33')](_0x2b0d88[_0xd963('0x2f')],qs[_0xd963('0x35')](_0x22cde4['query'][_0xd963('0x35')]));_0x5bb3d2[_0xd963('0x34')]=_0x5bb3d2[_0xd963('0x34')][_0xd963('0x45')]?_0x5bb3d2[_0xd963('0x34')]:_0x2b0d88[_0xd963('0x2f')];_0x5bb3d2[_0xd963('0x37')]=qs[_0xd963('0x38')](_0x22cde4[_0xd963('0x30')][_0xd963('0x38')]);_0x5bb3d2[_0xd963('0x39')]=qs['filters'](_[_0xd963('0x3a')](_0x22cde4[_0xd963('0x30')],_0x2b0d88[_0xd963('0x32')]));if(_0x22cde4[_0xd963('0x30')][_0xd963('0x3b')]){_0x5bb3d2['where']=_[_0xd963('0x3d')](_0x5bb3d2[_0xd963('0x39')],{'$or':_['map'](_0x5bb3d2[_0xd963('0x34')],function(_0x3ca92e){var _0x2727f4={};_0x2727f4[_0x3ca92e]={'$like':'%'+_0x22cde4[_0xd963('0x30')][_0xd963('0x3b')]+'%'};return _0x2727f4;})});}_0x5bb3d2=_['merge']({},_0x5bb3d2,_0x22cde4[_0xd963('0x3e')]);return _0x411b0f[_0xd963('0x49')](_0x5bb3d2);}})['then'](function(_0x2bc02d){if(_0x2bc02d){_0x2e2d74=_0x2bc02d[_0xd963('0x45')];if(!_0x22cde4[_0xd963('0x30')]['hasOwnProperty']('nolimit')){_0x5bb3d2['limit']=qs[_0xd963('0x1f')](_0x22cde4[_0xd963('0x30')]['limit']);_0x5bb3d2['offset']=qs[_0xd963('0x1d')](_0x22cde4[_0xd963('0x30')][_0xd963('0x1d')]);}return _0x411b0f[_0xd963('0x49')](_0x5bb3d2);}})[_0xd963('0x25')](function(_0x1e333b){if(_0x1e333b){return _0x1e333b?{'count':_0x2e2d74,'rows':_0x1e333b}:null;}})['then'](respondWithResult(_0x57358c,null))[_0xd963('0x48')](handleError(_0x57358c,null));};exports['getSubjects']=function(_0x5af2b5,_0x26d3c3,_0x999347){var _0x1339ca={};var _0x1e9359={};var _0x356af4;var _0x438b10;return db[_0xd963('0x2b')]['findOne']({'where':{'id':_0x5af2b5[_0xd963('0x44')]['id']}})[_0xd963('0x25')](handleEntityNotFound(_0x26d3c3,null))[_0xd963('0x25')](function(_0x2476cd){if(_0x2476cd){_0x356af4=_0x2476cd;_0x1e9359[_0xd963('0x2f')]=_[_0xd963('0x31')](db['DeskField'][_0xd963('0x2c')]);_0x1e9359[_0xd963('0x30')]=_[_0xd963('0x31')](_0x5af2b5['query']);_0x1e9359[_0xd963('0x32')]=_['intersection'](_0x1e9359[_0xd963('0x2f')],_0x1e9359[_0xd963('0x30')]);_0x1339ca[_0xd963('0x34')]=_[_0xd963('0x33')](_0x1e9359[_0xd963('0x2f')],qs[_0xd963('0x35')](_0x5af2b5[_0xd963('0x30')][_0xd963('0x35')]));_0x1339ca[_0xd963('0x34')]=_0x1339ca[_0xd963('0x34')][_0xd963('0x45')]?_0x1339ca[_0xd963('0x34')]:_0x1e9359[_0xd963('0x2f')];_0x1339ca[_0xd963('0x37')]=qs['sort'](_0x5af2b5[_0xd963('0x30')][_0xd963('0x38')]);_0x1339ca['where']=qs[_0xd963('0x32')](_['pick'](_0x5af2b5[_0xd963('0x30')],_0x1e9359['filters']));if(_0x5af2b5['query']['filter']){_0x1339ca[_0xd963('0x39')]=_['merge'](_0x1339ca['where'],{'$or':_[_0xd963('0x2a')](_0x1339ca[_0xd963('0x34')],function(_0x78e978){var _0x2a5abc={};_0x2a5abc[_0x78e978]={'$like':'%'+_0x5af2b5[_0xd963('0x30')]['filter']+'%'};return _0x2a5abc;})});}_0x1339ca=_['merge']({},_0x1339ca,_0x5af2b5[_0xd963('0x3e')]);return _0x356af4[_0xd963('0x4c')](_0x1339ca);}})[_0xd963('0x25')](function(_0x1b5527){if(_0x1b5527){_0x438b10=_0x1b5527['length'];if(!_0x5af2b5[_0xd963('0x30')][_0xd963('0x36')](_0xd963('0x4d'))){_0x1339ca['limit']=qs['limit'](_0x5af2b5['query'][_0xd963('0x1f')]);_0x1339ca[_0xd963('0x1d')]=qs['offset'](_0x5af2b5[_0xd963('0x30')][_0xd963('0x1d')]);}return _0x356af4[_0xd963('0x4c')](_0x1339ca);}})[_0xd963('0x25')](function(_0x9e861f){if(_0x9e861f){return _0x9e861f?{'count':_0x438b10,'rows':_0x9e861f}:null;}})['then'](respondWithResult(_0x26d3c3,null))[_0xd963('0x48')](handleError(_0x26d3c3,null));};exports[_0xd963('0x4e')]=function(_0x273752,_0x10bb70,_0x5a9199){var _0x24503d={};var _0x29339d={};var _0x4af36f;var _0x1d36b9;return db[_0xd963('0x2b')]['findOne']({'where':{'id':_0x273752[_0xd963('0x44')]['id']}})[_0xd963('0x25')](handleEntityNotFound(_0x10bb70,null))[_0xd963('0x25')](function(_0x1c2800){if(_0x1c2800){_0x4af36f=_0x1c2800;_0x29339d['model']=_[_0xd963('0x31')](db[_0xd963('0x4b')][_0xd963('0x2c')]);_0x29339d[_0xd963('0x30')]=_[_0xd963('0x31')](_0x273752['query']);_0x29339d[_0xd963('0x32')]=_[_0xd963('0x33')](_0x29339d[_0xd963('0x2f')],_0x29339d['query']);_0x24503d[_0xd963('0x34')]=_[_0xd963('0x33')](_0x29339d[_0xd963('0x2f')],qs[_0xd963('0x35')](_0x273752[_0xd963('0x30')][_0xd963('0x35')]));_0x24503d[_0xd963('0x34')]=_0x24503d[_0xd963('0x34')]['length']?_0x24503d[_0xd963('0x34')]:_0x29339d[_0xd963('0x2f')];_0x24503d[_0xd963('0x37')]=qs[_0xd963('0x38')](_0x273752[_0xd963('0x30')][_0xd963('0x38')]);_0x24503d[_0xd963('0x39')]=qs[_0xd963('0x32')](_[_0xd963('0x3a')](_0x273752[_0xd963('0x30')],_0x29339d[_0xd963('0x32')]));if(_0x273752[_0xd963('0x30')]['filter']){_0x24503d[_0xd963('0x39')]=_['merge'](_0x24503d[_0xd963('0x39')],{'$or':_[_0xd963('0x2a')](_0x24503d[_0xd963('0x34')],function(_0x336567){var _0x474797={};_0x474797[_0x336567]={'$like':'%'+_0x273752[_0xd963('0x30')][_0xd963('0x3b')]+'%'};return _0x474797;})});}_0x24503d=_[_0xd963('0x3d')]({},_0x24503d,_0x273752['options']);return _0x4af36f[_0xd963('0x4e')](_0x24503d);}})[_0xd963('0x25')](function(_0x4365e4){if(_0x4365e4){_0x1d36b9=_0x4365e4[_0xd963('0x45')];if(!_0x273752['query'][_0xd963('0x36')]('nolimit')){_0x24503d[_0xd963('0x1f')]=qs['limit'](_0x273752[_0xd963('0x30')][_0xd963('0x1f')]);_0x24503d['offset']=qs[_0xd963('0x1d')](_0x273752[_0xd963('0x30')][_0xd963('0x1d')]);}return _0x4af36f[_0xd963('0x4e')](_0x24503d);}})[_0xd963('0x25')](function(_0x3d8af1){if(_0x3d8af1){return _0x3d8af1?{'count':_0x1d36b9,'rows':_0x3d8af1}:null;}})[_0xd963('0x25')](respondWithResult(_0x10bb70,null))[_0xd963('0x48')](handleError(_0x10bb70,null));};exports['getTags']=function(_0x499f5c,_0x52134f,_0x3dd6d9){var _0x5131a8={};var _0x28c688={};var _0x418b51;var _0x4eff8c;return db[_0xd963('0x2b')]['findOne']({'where':{'id':_0x499f5c[_0xd963('0x44')]['id']}})[_0xd963('0x25')](handleEntityNotFound(_0x52134f,null))['then'](function(_0x43d684){if(_0x43d684){_0x418b51=_0x43d684;_0x28c688[_0xd963('0x2f')]=_[_0xd963('0x31')](db['Tag'][_0xd963('0x2c')]);_0x28c688[_0xd963('0x30')]=_['keys'](_0x499f5c['query']);_0x28c688[_0xd963('0x32')]=_[_0xd963('0x33')](_0x28c688[_0xd963('0x2f')],_0x28c688[_0xd963('0x30')]);_0x5131a8[_0xd963('0x34')]=_['intersection'](_0x28c688['model'],qs['fields'](_0x499f5c[_0xd963('0x30')][_0xd963('0x35')]));_0x5131a8['attributes']=_0x5131a8[_0xd963('0x34')][_0xd963('0x45')]?_0x5131a8[_0xd963('0x34')]:_0x28c688[_0xd963('0x2f')];_0x5131a8['order']=qs[_0xd963('0x38')](_0x499f5c[_0xd963('0x30')][_0xd963('0x38')]);_0x5131a8[_0xd963('0x39')]=qs['filters'](_[_0xd963('0x3a')](_0x499f5c['query'],_0x28c688['filters']));if(_0x499f5c[_0xd963('0x30')]['filter']){_0x5131a8[_0xd963('0x39')]=_[_0xd963('0x3d')](_0x5131a8[_0xd963('0x39')],{'$or':_['map'](_0x5131a8[_0xd963('0x34')],function(_0xbec53b){var _0x126a71={};_0x126a71[_0xbec53b]={'$like':'%'+_0x499f5c[_0xd963('0x30')][_0xd963('0x3b')]+'%'};return _0x126a71;})});}_0x5131a8=_['merge']({},_0x5131a8,_0x499f5c[_0xd963('0x3e')]);return _0x418b51[_0xd963('0x4f')](_0x5131a8);}})[_0xd963('0x25')](function(_0x5e7182){if(_0x5e7182){_0x4eff8c=_0x5e7182[_0xd963('0x45')];if(!_0x499f5c[_0xd963('0x30')][_0xd963('0x36')](_0xd963('0x4d'))){_0x5131a8['limit']=qs[_0xd963('0x1f')](_0x499f5c[_0xd963('0x30')][_0xd963('0x1f')]);_0x5131a8[_0xd963('0x1d')]=qs[_0xd963('0x1d')](_0x499f5c[_0xd963('0x30')][_0xd963('0x1d')]);}return _0x418b51['getTags'](_0x5131a8);}})[_0xd963('0x25')](function(_0x29c62b){if(_0x29c62b){return _0x29c62b?{'count':_0x4eff8c,'rows':_0x29c62b}:null;}})[_0xd963('0x25')](respondWithResult(_0x52134f,null))['catch'](handleError(_0x52134f,null));};exports[_0xd963('0x50')]=function(_0x2af3bc,_0x4ed3e8,_0x31891a){if(_0x2af3bc[_0xd963('0x51')]['id']){delete _0x2af3bc['body']['id'];}return db[_0xd963('0x2b')]['findOne']({'where':{'id':_0x2af3bc[_0xd963('0x44')]['id']}})[_0xd963('0x25')](handleEntityNotFound(_0x4ed3e8,null))['then'](function(_0x364e83){if(_0x364e83){return _0x364e83[_0xd963('0x50')](_0x2af3bc[_0xd963('0x51')][_0xd963('0x52')]||[]);}return null;})['then'](respondWithResult(_0x4ed3e8,null))[_0xd963('0x48')](handleError(_0x4ed3e8,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 3e0907e..5aeaa5f 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 _0x1807=['api','moment','request-promise','path','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x1a909e,_0x32d3dd){var _0x4585b3=function(_0x4c7a4c){while(--_0x4c7a4c){_0x1a909e['push'](_0x1a909e['shift']());}};_0x4585b3(++_0x32d3dd);}(_0x1807,0xdb));var _0x7180=function(_0x4e8e31,_0x497e28){_0x4e8e31=_0x4e8e31-0x0;var _0x3a47ac=_0x1807[_0x4e8e31];return _0x3a47ac;};'use strict';var _=require(_0x7180('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7180('0x1'));var moment=require(_0x7180('0x2'));var BPromise=require('bluebird');var rp=require(_0x7180('0x3'));var fs=require('fs');var path=require(_0x7180('0x4'));var rimraf=require(_0x7180('0x5'));var config=require('../../config/environment');var attributes=require(_0x7180('0x6'));module[_0x7180('0x7')]=function(_0x21a9ef,_0x5640ae){return _0x21a9ef[_0x7180('0x8')](_0x7180('0x9'),attributes,{'tableName':_0x7180('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb61a=['define','DeskConfiguration','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb61a,0x162));var _0xab61=function(_0x4af267,_0x3a6714){_0x4af267=_0x4af267-0x0;var _0x40faf3=_0xb61a[_0x4af267];return _0x40faf3;};'use strict';var _=require(_0xab61('0x0'));var util=require(_0xab61('0x1'));var logger=require('../../config/logger')(_0xab61('0x2'));var moment=require(_0xab61('0x3'));var BPromise=require(_0xab61('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab61('0x5'));var rimraf=require(_0xab61('0x6'));var config=require(_0xab61('0x7'));var attributes=require(_0xab61('0x8'));module['exports']=function(_0x15b887,_0x584724){return _0x15b887[_0xab61('0x9')](_0xab61('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index efff148..0044903 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 _0x5cc3=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x1139d0,_0x41e5f8){var _0xcc01a6=function(_0x504ffa){while(--_0x504ffa){_0x1139d0['push'](_0x1139d0['shift']());}};_0xcc01a6(++_0x41e5f8);}(_0x5cc3,0x144));var _0x35cc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5cc3[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x35cc('0x0'));var util=require(_0x35cc('0x1'));var moment=require(_0x35cc('0x2'));var BPromise=require(_0x35cc('0x3'));var rs=require(_0x35cc('0x4'));var fs=require('fs');var Redis=require(_0x35cc('0x5'));var db=require(_0x35cc('0x6'))['db'];var utils=require(_0x35cc('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x35cc('0x8'));var jayson=require(_0x35cc('0x9'));var client=jayson[_0x35cc('0xa')][_0x35cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40b600,_0x12322a,_0x11bf91){return new BPromise(function(_0x3d9c00,_0x3d3724){return client[_0x35cc('0xc')](_0x40b600,_0x11bf91)[_0x35cc('0xd')](function(_0x3d53e9){logger[_0x35cc('0xe')](_0x35cc('0xf'),_0x12322a,'request\x20sent');logger['debug'](_0x35cc('0x10'),_0x12322a,_0x35cc('0x11'),JSON[_0x35cc('0x12')](_0x3d53e9));if(_0x3d53e9[_0x35cc('0x13')]){if(_0x3d53e9[_0x35cc('0x13')]['code']===0x1f4){logger[_0x35cc('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x12322a,_0x3d53e9[_0x35cc('0x13')][_0x35cc('0x14')]);return _0x3d3724(_0x3d53e9[_0x35cc('0x13')][_0x35cc('0x14')]);}logger[_0x35cc('0x13')](_0x35cc('0xf'),_0x12322a,_0x3d53e9[_0x35cc('0x13')][_0x35cc('0x14')]);return _0x3d9c00(_0x3d53e9['error'][_0x35cc('0x14')]);}else{logger['info'](_0x35cc('0xf'),_0x12322a,_0x35cc('0x11'));_0x3d9c00(_0x3d53e9[_0x35cc('0x15')][_0x35cc('0x14')]);}})[_0x35cc('0x16')](function(_0x188cf6){logger[_0x35cc('0x13')](_0x35cc('0xf'),_0x12322a,_0x188cf6);_0x3d3724(_0x188cf6);});});} \ No newline at end of file +var _0x6af6=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x6af6,0x176));var _0x66af=function(_0x3383e1,_0x4e5b9d){_0x3383e1=_0x3383e1-0x0;var _0x42d1d0=_0x6af6[_0x3383e1];return _0x42d1d0;};'use strict';var _=require(_0x66af('0x0'));var util=require(_0x66af('0x1'));var moment=require(_0x66af('0x2'));var BPromise=require(_0x66af('0x3'));var rs=require(_0x66af('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66af('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x66af('0x6'))(_0x66af('0x7'));var config=require(_0x66af('0x8'));var jayson=require(_0x66af('0x9'));var client=jayson['client'][_0x66af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4989a5,_0x45bd30,_0xcf9131){return new BPromise(function(_0x132168,_0x3da3cf){return client[_0x66af('0xb')](_0x4989a5,_0xcf9131)['then'](function(_0x230dd1){logger[_0x66af('0xc')](_0x66af('0xd'),_0x45bd30,_0x66af('0xe'));logger[_0x66af('0xf')](_0x66af('0x10'),_0x45bd30,_0x66af('0xe'),JSON[_0x66af('0x11')](_0x230dd1));if(_0x230dd1[_0x66af('0x12')]){if(_0x230dd1[_0x66af('0x12')][_0x66af('0x13')]===0x1f4){logger[_0x66af('0x12')](_0x66af('0xd'),_0x45bd30,_0x230dd1[_0x66af('0x12')][_0x66af('0x14')]);return _0x3da3cf(_0x230dd1[_0x66af('0x12')][_0x66af('0x14')]);}logger['error'](_0x66af('0xd'),_0x45bd30,_0x230dd1[_0x66af('0x12')]['message']);return _0x132168(_0x230dd1[_0x66af('0x12')]['message']);}else{logger[_0x66af('0xc')](_0x66af('0xd'),_0x45bd30,'request\x20sent');_0x132168(_0x230dd1[_0x66af('0x15')][_0x66af('0x14')]);}})[_0x66af('0x16')](function(_0x1547a5){logger['error'](_0x66af('0xd'),_0x45bd30,_0x1547a5);_0x3da3cf(_0x1547a5);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 2c78a12..e24b7d0 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 _0x1b81=['./intDeskField.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x1b81,0x107));var _0x11b8=function(_0x3dc469,_0x14b64b){_0x3dc469=_0x3dc469-0x0;var _0x218222=_0x1b81[_0x3dc469];return _0x218222;};'use strict';var multer=require(_0x11b8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x11b8('0x1'));var express=require(_0x11b8('0x2'));var router=express[_0x11b8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x11b8('0x4'));var interaction=require(_0x11b8('0x5'));var config=require(_0x11b8('0x6'));var controller=require(_0x11b8('0x7'));router[_0x11b8('0x8')]('/',auth[_0x11b8('0x9')](),controller[_0x11b8('0xa')]);router['get'](_0x11b8('0xb'),auth[_0x11b8('0x9')](),controller['show']);router[_0x11b8('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x11b8('0xd')]('/:id',auth[_0x11b8('0x9')](),controller[_0x11b8('0xe')]);router[_0x11b8('0xf')]('/:id',auth[_0x11b8('0x9')](),controller[_0x11b8('0x10')]);module[_0x11b8('0x11')]=router; \ No newline at end of file +var _0xc094=['create','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x32ed6a,_0x1cd968){var _0x5d670c=function(_0x6a8efc){while(--_0x6a8efc){_0x32ed6a['push'](_0x32ed6a['shift']());}};_0x5d670c(++_0x1cd968);}(_0xc094,0x71));var _0x4c09=function(_0x2394aa,_0x4f353a){_0x2394aa=_0x2394aa-0x0;var _0x2fd34e=_0xc094[_0x2394aa];return _0x2fd34e;};'use strict';var multer=require(_0x4c09('0x0'));var util=require('util');var path=require(_0x4c09('0x1'));var timeout=require(_0x4c09('0x2'));var express=require(_0x4c09('0x3'));var router=express['Router']();var fs_extra=require(_0x4c09('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4c09('0x5'));var config=require(_0x4c09('0x6'));var controller=require(_0x4c09('0x7'));router[_0x4c09('0x8')]('/',auth[_0x4c09('0x9')](),controller[_0x4c09('0xa')]);router[_0x4c09('0x8')](_0x4c09('0xb'),auth['isAuthenticated'](),controller[_0x4c09('0xc')]);router['post']('/',auth[_0x4c09('0x9')](),controller[_0x4c09('0xd')]);router[_0x4c09('0xe')](_0x4c09('0xb'),auth[_0x4c09('0x9')](),controller[_0x4c09('0xf')]);router[_0x4c09('0x10')](_0x4c09('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4c09('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 d2f5624..23a81a8 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 _0xe3ab=['customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','string','variable'];(function(_0x37f44a,_0x507337){var _0x1d5b47=function(_0x54536c){while(--_0x54536c){_0x37f44a['push'](_0x37f44a['shift']());}};_0x1d5b47(++_0x507337);}(_0xe3ab,0x1d1));var _0xbe3a=function(_0x36b15d,_0x3208a8){_0x36b15d=_0x36b15d-0x0;var _0xc1be7=_0xe3ab[_0x36b15d];return _0xc1be7;};'use strict';var Sequelize=require(_0xbe3a('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xbe3a('0x1'),_0xbe3a('0x2'),_0xbe3a('0x3'),_0xbe3a('0x4'),_0xbe3a('0x5')),'defaultValue':_0xbe3a('0x1')},'content':{'type':Sequelize[_0xbe3a('0x6')]},'key':{'type':Sequelize[_0xbe3a('0x6')]},'keyType':{'type':Sequelize[_0xbe3a('0x7')](_0xbe3a('0x1'),'variable',_0xbe3a('0x3'))},'keyContent':{'type':Sequelize[_0xbe3a('0x6')]},'idField':{'type':Sequelize[_0xbe3a('0x6')]},'nameField':{'type':Sequelize[_0xbe3a('0x6')]},'customField':{'type':Sequelize[_0xbe3a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbe3a('0x6')]}}; \ No newline at end of file +var _0x90e8=['picklist','STRING','variable','customVariable','BOOLEAN','exports','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90e8,0x18d));var _0x890e=function(_0x4f3865,_0x1a44f7){_0x4f3865=_0x4f3865-0x0;var _0x317465=_0x90e8[_0x4f3865];return _0x317465;};'use strict';var Sequelize=require('sequelize');module[_0x890e('0x0')]={'type':{'type':Sequelize['ENUM'](_0x890e('0x1'),'variable','customVariable','keyValue',_0x890e('0x2')),'defaultValue':_0x890e('0x1')},'content':{'type':Sequelize[_0x890e('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x890e('0x1'),_0x890e('0x4'),_0x890e('0x5'))},'keyContent':{'type':Sequelize[_0x890e('0x3')]},'idField':{'type':Sequelize[_0x890e('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x890e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x890e('0x3')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index f6517f8..f296477 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 _0x7278=['reject','save','update','then','error','stack','name','send','DeskField','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','length','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','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/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7278,0x161));var _0x8727=function(_0x2fd8e8,_0x11c50e){_0x2fd8e8=_0x2fd8e8-0x0;var _0x4b51fb=_0x7278[_0x2fd8e8];return _0x4b51fb;};'use strict';var emlformat=require(_0x8727('0x0'));var rimraf=require(_0x8727('0x1'));var zipdir=require(_0x8727('0x2'));var jsonpatch=require(_0x8727('0x3'));var rp=require(_0x8727('0x4'));var moment=require('moment');var BPromise=require(_0x8727('0x5'));var Mustache=require(_0x8727('0x6'));var util=require(_0x8727('0x7'));var path=require(_0x8727('0x8'));var sox=require(_0x8727('0x9'));var csv=require(_0x8727('0xa'));var ejs=require(_0x8727('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8727('0xc'));var squel=require(_0x8727('0xd'));var crypto=require(_0x8727('0xe'));var jsforce=require(_0x8727('0xf'));var deskjs=require(_0x8727('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8727('0x11'));var authService=require(_0x8727('0x12'));var qs=require(_0x8727('0x13'));var as=require(_0x8727('0x14'));var hardwareService=require(_0x8727('0x15'));var logger=require(_0x8727('0x16'))(_0x8727('0x17'));var utils=require(_0x8727('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8727('0x19'));var db=require(_0x8727('0x1a'))['db'];function respondWithStatusCode(_0x176389,_0x518e56){_0x518e56=_0x518e56||0xcc;return function(_0x22d03d){if(_0x22d03d){return _0x176389[_0x8727('0x1b')](_0x518e56);}return _0x176389['status'](_0x518e56)[_0x8727('0x1c')]();};}function respondWithResult(_0x3aa1b,_0x47c29d){_0x47c29d=_0x47c29d||0xc8;return function(_0x2185e5){if(_0x2185e5){return _0x3aa1b[_0x8727('0x1d')](_0x47c29d)[_0x8727('0x1e')](_0x2185e5);}};}function respondWithFilteredResult(_0x3865e9,_0x1916f7){return function(_0x11c828){if(_0x11c828){var _0x88857c=typeof _0x1916f7['offset']===_0x8727('0x1f')&&typeof _0x1916f7[_0x8727('0x20')]===_0x8727('0x1f');var _0x2f6e1d=_0x11c828[_0x8727('0x21')];var _0xba0af5=_0x88857c?0x0:_0x1916f7['offset'];var _0x575d29=_0x88857c?_0x11c828[_0x8727('0x21')]:_0x1916f7['offset']+_0x1916f7[_0x8727('0x20')];var _0xfd266f;if(_0x575d29>=_0x2f6e1d){_0x575d29=_0x2f6e1d;_0xfd266f=0xc8;}else{_0xfd266f=0xce;}_0x3865e9[_0x8727('0x1d')](_0xfd266f);return _0x3865e9[_0x8727('0x22')](_0x8727('0x23'),_0xba0af5+'-'+_0x575d29+'/'+_0x2f6e1d)['json'](_0x11c828);}return null;};}function patchUpdates(_0x6e552f){return function(_0x286856){try{jsonpatch[_0x8727('0x24')](_0x286856,_0x6e552f,!![]);}catch(_0x1d78df){return BPromise[_0x8727('0x25')](_0x1d78df);}return _0x286856[_0x8727('0x26')]();};}function saveUpdates(_0x46d43e,_0x441cc0){return function(_0x117f58){if(_0x117f58){return _0x117f58[_0x8727('0x27')](_0x46d43e)[_0x8727('0x28')](function(_0x1a69d5){return _0x1a69d5;});}return null;};}function removeEntity(_0x4c699b,_0x464a32){return function(_0x3d3592){if(_0x3d3592){return _0x3d3592['destroy']()['then'](function(){_0x4c699b[_0x8727('0x1d')](0xcc)[_0x8727('0x1c')]();});}};}function handleEntityNotFound(_0x15e8bf,_0x5de6fa){return function(_0x98261b){if(!_0x98261b){_0x15e8bf[_0x8727('0x1b')](0x194);}return _0x98261b;};}function handleError(_0x267008,_0x440ff5){_0x440ff5=_0x440ff5||0x1f4;return function(_0x2c8cd5){logger[_0x8727('0x29')](_0x2c8cd5[_0x8727('0x2a')]);if(_0x2c8cd5[_0x8727('0x2b')]){delete _0x2c8cd5['name'];}_0x267008[_0x8727('0x1d')](_0x440ff5)[_0x8727('0x2c')](_0x2c8cd5);};}exports['index']=function(_0x23325f,_0x163989){var _0x3ecd6a={},_0x228ca9={},_0x416da8={'count':0x0,'rows':[]};var _0x1e21b9=_['map'](db[_0x8727('0x2d')]['rawAttributes'],function(_0x34c58e){return{'name':_0x34c58e['fieldName'],'type':_0x34c58e[_0x8727('0x2e')][_0x8727('0x2f')]};});_0x228ca9[_0x8727('0x30')]=_[_0x8727('0x31')](_0x1e21b9,_0x8727('0x2b'));_0x228ca9[_0x8727('0x32')]=_[_0x8727('0x33')](_0x23325f['query']);_0x228ca9[_0x8727('0x34')]=_[_0x8727('0x35')](_0x228ca9[_0x8727('0x30')],_0x228ca9[_0x8727('0x32')]);_0x3ecd6a[_0x8727('0x36')]=_[_0x8727('0x35')](_0x228ca9[_0x8727('0x30')],qs[_0x8727('0x37')](_0x23325f[_0x8727('0x32')][_0x8727('0x37')]));_0x3ecd6a[_0x8727('0x36')]=_0x3ecd6a[_0x8727('0x36')]['length']?_0x3ecd6a['attributes']:_0x228ca9[_0x8727('0x30')];if(!_0x23325f[_0x8727('0x32')][_0x8727('0x38')](_0x8727('0x39'))){_0x3ecd6a['limit']=qs[_0x8727('0x20')](_0x23325f[_0x8727('0x32')][_0x8727('0x20')]);_0x3ecd6a[_0x8727('0x3a')]=qs[_0x8727('0x3a')](_0x23325f['query'][_0x8727('0x3a')]);}_0x3ecd6a[_0x8727('0x3b')]=qs[_0x8727('0x3c')](_0x23325f[_0x8727('0x32')][_0x8727('0x3c')]);_0x3ecd6a[_0x8727('0x3d')]=qs[_0x8727('0x34')](_[_0x8727('0x3e')](_0x23325f[_0x8727('0x32')],_0x228ca9[_0x8727('0x34')]),_0x1e21b9);if(_0x23325f[_0x8727('0x32')][_0x8727('0x3f')]){_0x3ecd6a['where']=_[_0x8727('0x40')](_0x3ecd6a[_0x8727('0x3d')],{'$or':_[_0x8727('0x31')](_0x1e21b9,function(_0x403d90){if(_0x403d90[_0x8727('0x2e')]!==_0x8727('0x41')){var _0x308035={};_0x308035[_0x403d90[_0x8727('0x2b')]]={'$like':'%'+_0x23325f[_0x8727('0x32')][_0x8727('0x3f')]+'%'};return _0x308035;}})});}_0x3ecd6a=_[_0x8727('0x40')]({},_0x3ecd6a,_0x23325f[_0x8727('0x42')]);var _0x2a1063={'where':_0x3ecd6a[_0x8727('0x3d')]};return db['DeskField'][_0x8727('0x21')](_0x2a1063)[_0x8727('0x28')](function(_0x19d08a){_0x416da8['count']=_0x19d08a;if(_0x23325f[_0x8727('0x32')][_0x8727('0x43')]){_0x3ecd6a[_0x8727('0x44')]=[{'all':!![]}];}return db[_0x8727('0x2d')]['findAll'](_0x3ecd6a);})[_0x8727('0x28')](function(_0x37e87c){_0x416da8[_0x8727('0x45')]=_0x37e87c;return _0x416da8;})[_0x8727('0x28')](respondWithFilteredResult(_0x163989,_0x3ecd6a))[_0x8727('0x46')](handleError(_0x163989,null));};exports[_0x8727('0x47')]=function(_0x2fe40d,_0x15b764){var _0x3aac97={'raw':!![],'where':{'id':_0x2fe40d['params']['id']}},_0x2b5ba7={};_0x2b5ba7[_0x8727('0x30')]=_[_0x8727('0x33')](db[_0x8727('0x2d')][_0x8727('0x48')]);_0x2b5ba7[_0x8727('0x32')]=_['keys'](_0x2fe40d[_0x8727('0x32')]);_0x2b5ba7[_0x8727('0x34')]=_[_0x8727('0x35')](_0x2b5ba7['model'],_0x2b5ba7[_0x8727('0x32')]);_0x3aac97[_0x8727('0x36')]=_[_0x8727('0x35')](_0x2b5ba7[_0x8727('0x30')],qs[_0x8727('0x37')](_0x2fe40d[_0x8727('0x32')]['fields']));_0x3aac97[_0x8727('0x36')]=_0x3aac97[_0x8727('0x36')][_0x8727('0x49')]?_0x3aac97['attributes']:_0x2b5ba7[_0x8727('0x30')];if(_0x2fe40d[_0x8727('0x32')][_0x8727('0x43')]){_0x3aac97[_0x8727('0x44')]=[{'all':!![]}];}_0x3aac97=_[_0x8727('0x40')]({},_0x3aac97,_0x2fe40d[_0x8727('0x42')]);return db[_0x8727('0x2d')]['find'](_0x3aac97)[_0x8727('0x28')](handleEntityNotFound(_0x15b764,null))[_0x8727('0x28')](respondWithResult(_0x15b764,null))[_0x8727('0x46')](handleError(_0x15b764,null));};exports[_0x8727('0x4a')]=function(_0x152de6,_0x426727){return db[_0x8727('0x2d')]['create'](_0x152de6[_0x8727('0x4b')],{})[_0x8727('0x28')](respondWithResult(_0x426727,0xc9))[_0x8727('0x46')](handleError(_0x426727,null));};exports['update']=function(_0x30e656,_0x22cd31){if(_0x30e656[_0x8727('0x4b')]['id']){delete _0x30e656[_0x8727('0x4b')]['id'];}return db[_0x8727('0x2d')][_0x8727('0x4c')]({'where':{'id':_0x30e656[_0x8727('0x4d')]['id']}})['then'](handleEntityNotFound(_0x22cd31,null))[_0x8727('0x28')](saveUpdates(_0x30e656['body'],null))[_0x8727('0x28')](respondWithResult(_0x22cd31,null))[_0x8727('0x46')](handleError(_0x22cd31,null));};exports['destroy']=function(_0x133973,_0x3bb732){return db[_0x8727('0x2d')]['find']({'where':{'id':_0x133973['params']['id']}})[_0x8727('0x28')](handleEntityNotFound(_0x3bb732,null))[_0x8727('0x28')](removeEntity(_0x3bb732,null))[_0x8727('0x46')](handleError(_0x3bb732,null));}; \ No newline at end of file +var _0x0c9c=['create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','DeskField','findAll','rows','show','params','keys','find','catch'];(function(_0x85b145,_0x4490b9){var _0xffb47=function(_0x4df565){while(--_0x4df565){_0x85b145['push'](_0x85b145['shift']());}};_0xffb47(++_0x4490b9);}(_0x0c9c,0x188));var _0xc0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc0c9('0x0'));var rimraf=require(_0xc0c9('0x1'));var zipdir=require(_0xc0c9('0x2'));var jsonpatch=require(_0xc0c9('0x3'));var rp=require('request-promise');var moment=require(_0xc0c9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc0c9('0x5'));var util=require(_0xc0c9('0x6'));var path=require(_0xc0c9('0x7'));var sox=require(_0xc0c9('0x8'));var csv=require(_0xc0c9('0x9'));var ejs=require(_0xc0c9('0xa'));var fs=require('fs');var fs_extra=require(_0xc0c9('0xb'));var _=require(_0xc0c9('0xc'));var squel=require(_0xc0c9('0xd'));var crypto=require(_0xc0c9('0xe'));var jsforce=require(_0xc0c9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc0c9('0x9'));var querystring=require(_0xc0c9('0x10'));var Papa=require(_0xc0c9('0x11'));var Redis=require(_0xc0c9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc0c9('0x13'));var as=require(_0xc0c9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0c9('0x15'))('api');var utils=require(_0xc0c9('0x16'));var config=require(_0xc0c9('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3181e3,_0xebab88){_0xebab88=_0xebab88||0xcc;return function(_0x17613d){if(_0x17613d){return _0x3181e3[_0xc0c9('0x18')](_0xebab88);}return _0x3181e3[_0xc0c9('0x19')](_0xebab88)[_0xc0c9('0x1a')]();};}function respondWithResult(_0x10406a,_0x43e6b4){_0x43e6b4=_0x43e6b4||0xc8;return function(_0x4cac4c){if(_0x4cac4c){return _0x10406a['status'](_0x43e6b4)[_0xc0c9('0x1b')](_0x4cac4c);}};}function respondWithFilteredResult(_0x413f84,_0x2c4879){return function(_0x254722){if(_0x254722){var _0x4fad7e=typeof _0x2c4879[_0xc0c9('0x1c')]===_0xc0c9('0x1d')&&typeof _0x2c4879[_0xc0c9('0x1e')]===_0xc0c9('0x1d');var _0x49045f=_0x254722[_0xc0c9('0x1f')];var _0x40ecaa=_0x4fad7e?0x0:_0x2c4879[_0xc0c9('0x1c')];var _0xa6ea55=_0x4fad7e?_0x254722[_0xc0c9('0x1f')]:_0x2c4879[_0xc0c9('0x1c')]+_0x2c4879[_0xc0c9('0x1e')];var _0xa5ea7e;if(_0xa6ea55>=_0x49045f){_0xa6ea55=_0x49045f;_0xa5ea7e=0xc8;}else{_0xa5ea7e=0xce;}_0x413f84[_0xc0c9('0x19')](_0xa5ea7e);return _0x413f84[_0xc0c9('0x20')](_0xc0c9('0x21'),_0x40ecaa+'-'+_0xa6ea55+'/'+_0x49045f)['json'](_0x254722);}return null;};}function patchUpdates(_0xdafb56){return function(_0x361a09){try{jsonpatch[_0xc0c9('0x22')](_0x361a09,_0xdafb56,!![]);}catch(_0x4ad456){return BPromise[_0xc0c9('0x23')](_0x4ad456);}return _0x361a09[_0xc0c9('0x24')]();};}function saveUpdates(_0x1c2170,_0x436616){return function(_0x4385c1){if(_0x4385c1){return _0x4385c1[_0xc0c9('0x25')](_0x1c2170)[_0xc0c9('0x26')](function(_0x1e82ee){return _0x1e82ee;});}return null;};}function removeEntity(_0x27542d,_0x1144b9){return function(_0x5cc111){if(_0x5cc111){return _0x5cc111[_0xc0c9('0x27')]()[_0xc0c9('0x26')](function(){_0x27542d[_0xc0c9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2366be,_0x485489){return function(_0x59d65f){if(!_0x59d65f){_0x2366be[_0xc0c9('0x18')](0x194);}return _0x59d65f;};}function handleError(_0x1fefe9,_0x2afb6f){_0x2afb6f=_0x2afb6f||0x1f4;return function(_0xbd7e47){logger[_0xc0c9('0x28')](_0xbd7e47[_0xc0c9('0x29')]);if(_0xbd7e47['name']){delete _0xbd7e47[_0xc0c9('0x2a')];}_0x1fefe9[_0xc0c9('0x19')](_0x2afb6f)[_0xc0c9('0x2b')](_0xbd7e47);};}exports[_0xc0c9('0x2c')]=function(_0x126c34,_0x4e3e2c){var _0x4327ce={},_0x1171a6={},_0xa46694={'count':0x0,'rows':[]};var _0x594e61=_['map'](db['DeskField'][_0xc0c9('0x2d')],function(_0x24a33a){return{'name':_0x24a33a[_0xc0c9('0x2e')],'type':_0x24a33a[_0xc0c9('0x2f')][_0xc0c9('0x30')]};});_0x1171a6[_0xc0c9('0x31')]=_[_0xc0c9('0x32')](_0x594e61,_0xc0c9('0x2a'));_0x1171a6[_0xc0c9('0x33')]=_['keys'](_0x126c34[_0xc0c9('0x33')]);_0x1171a6[_0xc0c9('0x34')]=_[_0xc0c9('0x35')](_0x1171a6['model'],_0x1171a6['query']);_0x4327ce[_0xc0c9('0x36')]=_[_0xc0c9('0x35')](_0x1171a6[_0xc0c9('0x31')],qs[_0xc0c9('0x37')](_0x126c34[_0xc0c9('0x33')]['fields']));_0x4327ce[_0xc0c9('0x36')]=_0x4327ce[_0xc0c9('0x36')][_0xc0c9('0x38')]?_0x4327ce['attributes']:_0x1171a6[_0xc0c9('0x31')];if(!_0x126c34[_0xc0c9('0x33')]['hasOwnProperty'](_0xc0c9('0x39'))){_0x4327ce['limit']=qs[_0xc0c9('0x1e')](_0x126c34['query']['limit']);_0x4327ce[_0xc0c9('0x1c')]=qs[_0xc0c9('0x1c')](_0x126c34[_0xc0c9('0x33')][_0xc0c9('0x1c')]);}_0x4327ce[_0xc0c9('0x3a')]=qs[_0xc0c9('0x3b')](_0x126c34[_0xc0c9('0x33')][_0xc0c9('0x3b')]);_0x4327ce[_0xc0c9('0x3c')]=qs[_0xc0c9('0x34')](_[_0xc0c9('0x3d')](_0x126c34[_0xc0c9('0x33')],_0x1171a6[_0xc0c9('0x34')]),_0x594e61);if(_0x126c34[_0xc0c9('0x33')][_0xc0c9('0x3e')]){_0x4327ce[_0xc0c9('0x3c')]=_[_0xc0c9('0x3f')](_0x4327ce[_0xc0c9('0x3c')],{'$or':_['map'](_0x594e61,function(_0x2547ea){if(_0x2547ea[_0xc0c9('0x2f')]!==_0xc0c9('0x40')){var _0x286e30={};_0x286e30[_0x2547ea['name']]={'$like':'%'+_0x126c34[_0xc0c9('0x33')]['filter']+'%'};return _0x286e30;}})});}_0x4327ce=_[_0xc0c9('0x3f')]({},_0x4327ce,_0x126c34[_0xc0c9('0x41')]);var _0x3d4953={'where':_0x4327ce['where']};return db['DeskField'][_0xc0c9('0x1f')](_0x3d4953)[_0xc0c9('0x26')](function(_0x1605b1){_0xa46694[_0xc0c9('0x1f')]=_0x1605b1;if(_0x126c34[_0xc0c9('0x33')][_0xc0c9('0x42')]){_0x4327ce[_0xc0c9('0x43')]=[{'all':!![]}];}return db[_0xc0c9('0x44')][_0xc0c9('0x45')](_0x4327ce);})[_0xc0c9('0x26')](function(_0x16e875){_0xa46694[_0xc0c9('0x46')]=_0x16e875;return _0xa46694;})[_0xc0c9('0x26')](respondWithFilteredResult(_0x4e3e2c,_0x4327ce))['catch'](handleError(_0x4e3e2c,null));};exports[_0xc0c9('0x47')]=function(_0x103c3b,_0x527552){var _0x4d836e={'raw':!![],'where':{'id':_0x103c3b[_0xc0c9('0x48')]['id']}},_0xdc29bc={};_0xdc29bc[_0xc0c9('0x31')]=_[_0xc0c9('0x49')](db[_0xc0c9('0x44')]['rawAttributes']);_0xdc29bc[_0xc0c9('0x33')]=_['keys'](_0x103c3b['query']);_0xdc29bc[_0xc0c9('0x34')]=_[_0xc0c9('0x35')](_0xdc29bc['model'],_0xdc29bc[_0xc0c9('0x33')]);_0x4d836e[_0xc0c9('0x36')]=_[_0xc0c9('0x35')](_0xdc29bc['model'],qs['fields'](_0x103c3b[_0xc0c9('0x33')][_0xc0c9('0x37')]));_0x4d836e[_0xc0c9('0x36')]=_0x4d836e[_0xc0c9('0x36')][_0xc0c9('0x38')]?_0x4d836e[_0xc0c9('0x36')]:_0xdc29bc[_0xc0c9('0x31')];if(_0x103c3b['query'][_0xc0c9('0x42')]){_0x4d836e[_0xc0c9('0x43')]=[{'all':!![]}];}_0x4d836e=_[_0xc0c9('0x3f')]({},_0x4d836e,_0x103c3b['options']);return db[_0xc0c9('0x44')][_0xc0c9('0x4a')](_0x4d836e)[_0xc0c9('0x26')](handleEntityNotFound(_0x527552,null))[_0xc0c9('0x26')](respondWithResult(_0x527552,null))[_0xc0c9('0x4b')](handleError(_0x527552,null));};exports[_0xc0c9('0x4c')]=function(_0x1e9fb2,_0x172d2f){return db[_0xc0c9('0x44')][_0xc0c9('0x4c')](_0x1e9fb2['body'],{})['then'](respondWithResult(_0x172d2f,0xc9))['catch'](handleError(_0x172d2f,null));};exports[_0xc0c9('0x25')]=function(_0x2aa7ae,_0x14ed1){if(_0x2aa7ae[_0xc0c9('0x4d')]['id']){delete _0x2aa7ae['body']['id'];}return db[_0xc0c9('0x44')]['find']({'where':{'id':_0x2aa7ae[_0xc0c9('0x48')]['id']}})[_0xc0c9('0x26')](handleEntityNotFound(_0x14ed1,null))[_0xc0c9('0x26')](saveUpdates(_0x2aa7ae[_0xc0c9('0x4d')],null))[_0xc0c9('0x26')](respondWithResult(_0x14ed1,null))[_0xc0c9('0x4b')](handleError(_0x14ed1,null));};exports[_0xc0c9('0x27')]=function(_0x450679,_0x5bb665){return db[_0xc0c9('0x44')][_0xc0c9('0x4a')]({'where':{'id':_0x450679[_0xc0c9('0x48')]['id']}})['then'](handleEntityNotFound(_0x5bb665,null))[_0xc0c9('0x26')](removeEntity(_0x5bb665,null))[_0xc0c9('0x4b')](handleError(_0x5bb665,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 8e80ae4..f125eb5 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 _0x28d5=['bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger','api','moment'];(function(_0x5a8709,_0x4ef872){var _0x24c807=function(_0x5dc0a7){while(--_0x5dc0a7){_0x5a8709['push'](_0x5a8709['shift']());}};_0x24c807(++_0x4ef872);}(_0x28d5,0xcb));var _0x528d=function(_0x39fb6a,_0x8b07ae){_0x39fb6a=_0x39fb6a-0x0;var _0x1452a1=_0x28d5[_0x39fb6a];return _0x1452a1;};'use strict';var _=require(_0x528d('0x0'));var util=require(_0x528d('0x1'));var logger=require(_0x528d('0x2'))(_0x528d('0x3'));var moment=require(_0x528d('0x4'));var BPromise=require(_0x528d('0x5'));var rp=require(_0x528d('0x6'));var fs=require('fs');var path=require(_0x528d('0x7'));var rimraf=require('rimraf');var config=require(_0x528d('0x8'));var attributes=require(_0x528d('0x9'));module[_0x528d('0xa')]=function(_0x2f3f40,_0x874cb){return _0x2f3f40[_0x528d('0xb')](_0x528d('0xc'),attributes,{'tableName':_0x528d('0xd'),'paranoid':![],'indexes':[{'name':_0x528d('0xe'),'fields':[_0x528d('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x416b=['path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index','idField','util','../../config/logger','api','moment','bluebird'];(function(_0x2486a0,_0x3f7d74){var _0x5236eb=function(_0x114cf0){while(--_0x114cf0){_0x2486a0['push'](_0x2486a0['shift']());}};_0x5236eb(++_0x3f7d74);}(_0x416b,0x113));var _0xb416=function(_0x31ba1a,_0x4e88ce){_0x31ba1a=_0x31ba1a-0x0;var _0xf8402b=_0x416b[_0x31ba1a];return _0xf8402b;};'use strict';var _=require('lodash');var util=require(_0xb416('0x0'));var logger=require(_0xb416('0x1'))(_0xb416('0x2'));var moment=require(_0xb416('0x3'));var BPromise=require(_0xb416('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb416('0x5'));var rimraf=require(_0xb416('0x6'));var config=require(_0xb416('0x7'));var attributes=require(_0xb416('0x8'));module['exports']=function(_0x16de27,_0x394839){return _0x16de27[_0xb416('0x9')](_0xb416('0xa'),attributes,{'tableName':_0xb416('0xb'),'paranoid':![],'indexes':[{'name':_0xb416('0xc'),'fields':[_0xb416('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index b617fc7..9fff006 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 _0xef4b=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird'];(function(_0x1aea32,_0x390268){var _0x41e439=function(_0x27f21f){while(--_0x27f21f){_0x1aea32['push'](_0x1aea32['shift']());}};_0x41e439(++_0x390268);}(_0xef4b,0x138));var _0xbef4=function(_0x2d64fc,_0x42b2a7){_0x2d64fc=_0x2d64fc-0x0;var _0x2c8556=_0xef4b[_0x2d64fc];return _0x2c8556;};'use strict';var _=require(_0xbef4('0x0'));var util=require('util');var moment=require(_0xbef4('0x1'));var BPromise=require(_0xbef4('0x2'));var rs=require(_0xbef4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbef4('0x4'))['db'];var utils=require(_0xbef4('0x5'));var logger=require(_0xbef4('0x6'))('rpc');var config=require(_0xbef4('0x7'));var jayson=require(_0xbef4('0x8'));var client=jayson[_0xbef4('0x9')][_0xbef4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6ef9e4,_0x2a6f4e,_0x5d06ab){return new BPromise(function(_0x4bc8bc,_0x1552c0){return client['request'](_0x6ef9e4,_0x5d06ab)[_0xbef4('0xb')](function(_0x342303){logger[_0xbef4('0xc')](_0xbef4('0xd'),_0x2a6f4e,_0xbef4('0xe'));logger[_0xbef4('0xf')](_0xbef4('0x10'),_0x2a6f4e,'request\x20sent',JSON['stringify'](_0x342303));if(_0x342303[_0xbef4('0x11')]){if(_0x342303[_0xbef4('0x11')][_0xbef4('0x12')]===0x1f4){logger[_0xbef4('0x11')](_0xbef4('0xd'),_0x2a6f4e,_0x342303[_0xbef4('0x11')][_0xbef4('0x13')]);return _0x1552c0(_0x342303[_0xbef4('0x11')]['message']);}logger[_0xbef4('0x11')](_0xbef4('0xd'),_0x2a6f4e,_0x342303[_0xbef4('0x11')][_0xbef4('0x13')]);return _0x4bc8bc(_0x342303[_0xbef4('0x11')][_0xbef4('0x13')]);}else{logger['info'](_0xbef4('0xd'),_0x2a6f4e,'request\x20sent');_0x4bc8bc(_0x342303[_0xbef4('0x14')]['message']);}})['catch'](function(_0x5a2d3c){logger[_0xbef4('0x11')](_0xbef4('0xd'),_0x2a6f4e,_0x5a2d3c);_0x1552c0(_0x5a2d3c);});});} \ No newline at end of file +var _0x99eb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','DeskField,\x20%s,\x20%s','message','info','catch','lodash','util','moment'];(function(_0x48df6e,_0xd49de5){var _0x2f9610=function(_0x658b9f){while(--_0x658b9f){_0x48df6e['push'](_0x48df6e['shift']());}};_0x2f9610(++_0xd49de5);}(_0x99eb,0x9d));var _0xb99e=function(_0x461c83,_0x417d65){_0x461c83=_0x461c83-0x0;var _0x586b15=_0x99eb[_0x461c83];return _0x586b15;};'use strict';var _=require(_0xb99e('0x0'));var util=require(_0xb99e('0x1'));var moment=require(_0xb99e('0x2'));var BPromise=require(_0xb99e('0x3'));var rs=require(_0xb99e('0x4'));var fs=require('fs');var Redis=require(_0xb99e('0x5'));var db=require(_0xb99e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb99e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb99e('0x8'));var client=jayson[_0xb99e('0x9')][_0xb99e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c0ef6,_0xaedbb2,_0x377689){return new BPromise(function(_0x33b5ac,_0x1ea48f){return client['request'](_0x5c0ef6,_0x377689)[_0xb99e('0xb')](function(_0x348d4d){logger['info']('DeskField,\x20%s,\x20%s',_0xaedbb2,_0xb99e('0xc'));logger['debug'](_0xb99e('0xd'),_0xaedbb2,_0xb99e('0xc'),JSON[_0xb99e('0xe')](_0x348d4d));if(_0x348d4d[_0xb99e('0xf')]){if(_0x348d4d[_0xb99e('0xf')]['code']===0x1f4){logger[_0xb99e('0xf')](_0xb99e('0x10'),_0xaedbb2,_0x348d4d['error'][_0xb99e('0x11')]);return _0x1ea48f(_0x348d4d[_0xb99e('0xf')][_0xb99e('0x11')]);}logger['error'](_0xb99e('0x10'),_0xaedbb2,_0x348d4d[_0xb99e('0xf')][_0xb99e('0x11')]);return _0x33b5ac(_0x348d4d[_0xb99e('0xf')][_0xb99e('0x11')]);}else{logger[_0xb99e('0x12')](_0xb99e('0x10'),_0xaedbb2,_0xb99e('0xc'));_0x33b5ac(_0x348d4d['result']['message']);}})[_0xb99e('0x13')](function(_0x4d9f22){logger[_0xb99e('0xf')](_0xb99e('0x10'),_0xaedbb2,_0x4d9f22);_0x1ea48f(_0x4d9f22);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index a04e880..fe75285 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 _0xa067=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util'];(function(_0x4b2ebe,_0x15162f){var _0x481abf=function(_0x2b1468){while(--_0x2b1468){_0x4b2ebe['push'](_0x4b2ebe['shift']());}};_0x481abf(++_0x15162f);}(_0xa067,0x143));var _0x7a06=function(_0x1bd812,_0x293bc9){_0x1bd812=_0x1bd812-0x0;var _0xf5d195=_0xa067[_0x1bd812];return _0xf5d195;};'use strict';var multer=require(_0x7a06('0x0'));var util=require(_0x7a06('0x1'));var path=require('path');var timeout=require(_0x7a06('0x2'));var express=require(_0x7a06('0x3'));var router=express['Router']();var fs_extra=require(_0x7a06('0x4'));var auth=require(_0x7a06('0x5'));var interaction=require(_0x7a06('0x6'));var config=require(_0x7a06('0x7'));var controller=require(_0x7a06('0x8'));router[_0x7a06('0x9')]('/',auth[_0x7a06('0xa')](),controller[_0x7a06('0xb')]);router[_0x7a06('0x9')](_0x7a06('0xc'),auth[_0x7a06('0xa')](),controller[_0x7a06('0xd')]);router[_0x7a06('0x9')](_0x7a06('0xe'),auth[_0x7a06('0xa')](),controller[_0x7a06('0xf')]);router[_0x7a06('0x9')](_0x7a06('0x10'),auth['isAuthenticated'](),controller[_0x7a06('0x11')]);router[_0x7a06('0x12')]('/',auth[_0x7a06('0xa')](),controller[_0x7a06('0x13')]);router[_0x7a06('0x12')]('/:id/configurations',auth[_0x7a06('0xa')](),controller[_0x7a06('0x14')]);router[_0x7a06('0x15')](_0x7a06('0xc'),auth[_0x7a06('0xa')](),controller[_0x7a06('0x16')]);router[_0x7a06('0x17')](_0x7a06('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7a06('0x18')]=router; \ No newline at end of file +var _0x4ac7=['/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','isAuthenticated','getFields','create','post','addConfiguration','put'];(function(_0x442c68,_0x5a31d5){var _0x2416cd=function(_0x2d2d13){while(--_0x2d2d13){_0x442c68['push'](_0x442c68['shift']());}};_0x2416cd(++_0x5a31d5);}(_0x4ac7,0xa3));var _0x74ac=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x4ac7[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x74ac('0x0'));var util=require(_0x74ac('0x1'));var path=require(_0x74ac('0x2'));var timeout=require(_0x74ac('0x3'));var express=require(_0x74ac('0x4'));var router=express[_0x74ac('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x74ac('0x6'));var config=require(_0x74ac('0x7'));var controller=require(_0x74ac('0x8'));router[_0x74ac('0x9')]('/',auth['isAuthenticated'](),controller[_0x74ac('0xa')]);router['get']('/:id',auth[_0x74ac('0xb')](),controller['show']);router[_0x74ac('0x9')]('/:id/configurations',auth[_0x74ac('0xb')](),controller['getConfigurations']);router[_0x74ac('0x9')]('/:id/fields',auth[_0x74ac('0xb')](),controller[_0x74ac('0xc')]);router['post']('/',auth[_0x74ac('0xb')](),controller[_0x74ac('0xd')]);router[_0x74ac('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x74ac('0xf')]);router[_0x74ac('0x10')](_0x74ac('0x11'),auth['isAuthenticated'](),controller[_0x74ac('0x12')]);router[_0x74ac('0x13')]('/:id',auth[_0x74ac('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 6a8b712..8609ceb 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 _0xeca8=['sequelize','exports','STRING'];(function(_0x14525d,_0x747b83){var _0x26b05c=function(_0xf98e52){while(--_0xf98e52){_0x14525d['push'](_0x14525d['shift']());}};_0x26b05c(++_0x747b83);}(_0xeca8,0x1f2));var _0x8eca=function(_0x5dbfc9,_0x5c00df){_0x5dbfc9=_0x5dbfc9-0x0;var _0x12d743=_0xeca8[_0x5dbfc9];return _0x12d743;};'use strict';var Sequelize=require(_0x8eca('0x0'));module[_0x8eca('0x1')]={'name':{'type':Sequelize[_0x8eca('0x2')]},'username':{'type':Sequelize[_0x8eca('0x2')]},'password':{'type':Sequelize[_0x8eca('0x2')]},'remoteUri':{'type':Sequelize[_0x8eca('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x8eca('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x8eca('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8eca('0x2')]}}; \ No newline at end of file +var _0x096b=['STRING'];(function(_0x2fbd0e,_0x3460a9){var _0x481c9f=function(_0x4bc402){while(--_0x4bc402){_0x2fbd0e['push'](_0x2fbd0e['shift']());}};_0x481c9f(++_0x3460a9);}(_0x096b,0x1df));var _0xb096=function(_0x397032,_0x358e10){_0x397032=_0x397032-0x0;var _0x4abc69=_0x096b[_0x397032];return _0x4abc69;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb096('0x0')]},'username':{'type':Sequelize[_0xb096('0x0')]},'password':{'type':Sequelize[_0xb096('0x0')]},'remoteUri':{'type':Sequelize[_0xb096('0x0')]},'tenantId':{'type':Sequelize[_0xb096('0x0')]},'clientId':{'type':Sequelize[_0xb096('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb096('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xb096('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 3cccb19..af11f92 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 _0xc252=['overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','responsiblecontactidname','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','/oauth2/token','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','LogicalName','forEach','PicklistAttributeMetadata','all','isNil','@odata.type','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','stack','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','TrueOption','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','error','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','includeAll','include','catch','show','params','length','options','create','body','find','destroy','getConfigurations','findOne','Dynamics365Configuration','pick','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','Incident','PhoneCall','title','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime'];(function(_0x2cea58,_0x153c15){var _0x192933=function(_0x4f1e9b){while(--_0x4f1e9b){_0x2cea58['push'](_0x2cea58['shift']());}};_0x192933(++_0x153c15);}(_0xc252,0x118));var _0x2c25=function(_0x543229,_0x37dcb1){_0x543229=_0x543229-0x0;var _0x317f6b=_0xc252[_0x543229];return _0x317f6b;};'use strict';var emlformat=require(_0x2c25('0x0'));var rimraf=require(_0x2c25('0x1'));var zipdir=require(_0x2c25('0x2'));var jsonpatch=require(_0x2c25('0x3'));var rp=require(_0x2c25('0x4'));var moment=require(_0x2c25('0x5'));var BPromise=require(_0x2c25('0x6'));var Mustache=require(_0x2c25('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2c25('0x8'));var csv=require('to-csv');var ejs=require(_0x2c25('0x9'));var fs=require('fs');var fs_extra=require(_0x2c25('0xa'));var _=require(_0x2c25('0xb'));var squel=require(_0x2c25('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2c25('0xd'));var toCsv=require(_0x2c25('0xe'));var querystring=require(_0x2c25('0xf'));var Papa=require(_0x2c25('0x10'));var Redis=require(_0x2c25('0x11'));var authService=require(_0x2c25('0x12'));var qs=require(_0x2c25('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c25('0x14'));var logger=require('../../config/logger')(_0x2c25('0x15'));var utils=require('../../config/utils');var config=require(_0x2c25('0x16'));var licenseUtil=require(_0x2c25('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2c25('0x18'));function respondWithStatusCode(_0x3308ec,_0x5533f7){_0x5533f7=_0x5533f7||0xcc;return function(_0x5f08a6){if(_0x5f08a6){return _0x3308ec[_0x2c25('0x19')](_0x5533f7);}return _0x3308ec[_0x2c25('0x1a')](_0x5533f7)[_0x2c25('0x1b')]();};}function respondWithResult(_0x2c802e,_0x93582b){_0x93582b=_0x93582b||0xc8;return function(_0x41da7b){if(_0x41da7b){return _0x2c802e[_0x2c25('0x1a')](_0x93582b)[_0x2c25('0x1c')](_0x41da7b);}};}function respondWithFilteredResult(_0x360c81,_0x5dc040){return function(_0x48aed8){if(_0x48aed8){var _0x207fdb=typeof _0x5dc040[_0x2c25('0x1d')]===_0x2c25('0x1e')&&typeof _0x5dc040['limit']===_0x2c25('0x1e');var _0x7372cf=_0x48aed8[_0x2c25('0x1f')];var _0x19ff99=_0x207fdb?0x0:_0x5dc040['offset'];var _0xe0af6=_0x207fdb?_0x48aed8[_0x2c25('0x1f')]:_0x5dc040[_0x2c25('0x1d')]+_0x5dc040[_0x2c25('0x20')];var _0x52982d;if(_0xe0af6>=_0x7372cf){_0xe0af6=_0x7372cf;_0x52982d=0xc8;}else{_0x52982d=0xce;}_0x360c81[_0x2c25('0x1a')](_0x52982d);return _0x360c81['set']('Content-Range',_0x19ff99+'-'+_0xe0af6+'/'+_0x7372cf)[_0x2c25('0x1c')](_0x48aed8);}return null;};}function patchUpdates(_0x4b22f1){return function(_0x18bee0){try{jsonpatch[_0x2c25('0x21')](_0x18bee0,_0x4b22f1,!![]);}catch(_0x39f32e){return BPromise[_0x2c25('0x22')](_0x39f32e);}return _0x18bee0[_0x2c25('0x23')]();};}function saveUpdates(_0x372887,_0x32b1ee){return function(_0x3717d2){if(_0x3717d2){return _0x3717d2[_0x2c25('0x24')](_0x372887)[_0x2c25('0x25')](function(_0x3d9d75){return _0x3d9d75;});}return null;};}function removeEntity(_0x516ed1,_0x58244a){return function(_0x33c3e8){if(_0x33c3e8){return _0x33c3e8['destroy']()[_0x2c25('0x25')](function(){_0x516ed1[_0x2c25('0x1a')](0xcc)[_0x2c25('0x1b')]();});}};}function handleEntityNotFound(_0x38e13b,_0x1bb20c){return function(_0x5d6b6b){if(!_0x5d6b6b){_0x38e13b[_0x2c25('0x19')](0x194);}return _0x5d6b6b;};}function handleError(_0x32b2d4,_0x3f6906){_0x3f6906=_0x3f6906||0x1f4;return function(_0x59cae6){logger[_0x2c25('0x26')](_0x59cae6['stack']);if(_0x59cae6[_0x2c25('0x27')]){delete _0x59cae6[_0x2c25('0x27')];}_0x32b2d4['status'](_0x3f6906)[_0x2c25('0x28')](_0x59cae6);};}exports[_0x2c25('0x29')]=function(_0x51d744,_0x246e25){var _0x4a8193={},_0x553f0a={},_0xc56104={'count':0x0,'rows':[]};var _0x9c12b1=_[_0x2c25('0x2a')](db[_0x2c25('0x2b')][_0x2c25('0x2c')],function(_0x3bdf71){return{'name':_0x3bdf71[_0x2c25('0x2d')],'type':_0x3bdf71['type'][_0x2c25('0x2e')]};});_0x553f0a[_0x2c25('0x2f')]=_[_0x2c25('0x2a')](_0x9c12b1,'name');_0x553f0a[_0x2c25('0x30')]=_[_0x2c25('0x31')](_0x51d744[_0x2c25('0x30')]);_0x553f0a[_0x2c25('0x32')]=_['intersection'](_0x553f0a[_0x2c25('0x2f')],_0x553f0a['query']);_0x4a8193['attributes']=_[_0x2c25('0x33')](_0x553f0a[_0x2c25('0x2f')],qs['fields'](_0x51d744[_0x2c25('0x30')][_0x2c25('0x34')]));_0x4a8193[_0x2c25('0x35')]=_0x4a8193[_0x2c25('0x35')]['length']?_0x4a8193['attributes']:_0x553f0a[_0x2c25('0x2f')];if(!_0x51d744[_0x2c25('0x30')][_0x2c25('0x36')](_0x2c25('0x37'))){_0x4a8193[_0x2c25('0x20')]=qs[_0x2c25('0x20')](_0x51d744[_0x2c25('0x30')][_0x2c25('0x20')]);_0x4a8193[_0x2c25('0x1d')]=qs['offset'](_0x51d744[_0x2c25('0x30')][_0x2c25('0x1d')]);}_0x4a8193[_0x2c25('0x38')]=qs[_0x2c25('0x39')](_0x51d744[_0x2c25('0x30')][_0x2c25('0x39')]);_0x4a8193[_0x2c25('0x3a')]=qs[_0x2c25('0x32')](_['pick'](_0x51d744['query'],_0x553f0a[_0x2c25('0x32')]),_0x9c12b1);if(_0x51d744['query'][_0x2c25('0x3b')]){_0x4a8193[_0x2c25('0x3a')]=_['merge'](_0x4a8193[_0x2c25('0x3a')],{'$or':_[_0x2c25('0x2a')](_0x9c12b1,function(_0x3ccbed){if(_0x3ccbed[_0x2c25('0x3c')]!==_0x2c25('0x3d')){var _0x35f620={};_0x35f620[_0x3ccbed[_0x2c25('0x27')]]={'$like':'%'+_0x51d744[_0x2c25('0x30')][_0x2c25('0x3b')]+'%'};return _0x35f620;}})});}_0x4a8193=_[_0x2c25('0x3e')]({},_0x4a8193,_0x51d744['options']);var _0x2632d7={'where':_0x4a8193[_0x2c25('0x3a')]};return db[_0x2c25('0x2b')]['count'](_0x2632d7)['then'](function(_0x4a1d02){_0xc56104[_0x2c25('0x1f')]=_0x4a1d02;if(_0x51d744[_0x2c25('0x30')][_0x2c25('0x3f')]){_0x4a8193[_0x2c25('0x40')]=[{'all':!![]}];}return db[_0x2c25('0x2b')]['findAll'](_0x4a8193);})['then'](function(_0x370fe3){_0xc56104['rows']=_0x370fe3;return _0xc56104;})['then'](respondWithFilteredResult(_0x246e25,_0x4a8193))[_0x2c25('0x41')](handleError(_0x246e25,null));};exports[_0x2c25('0x42')]=function(_0x4d5eb2,_0x5ebcfd){var _0x159bec={'raw':![],'where':{'id':_0x4d5eb2[_0x2c25('0x43')]['id']}},_0x42136d={};_0x42136d[_0x2c25('0x2f')]=_['keys'](db[_0x2c25('0x2b')][_0x2c25('0x2c')]);_0x42136d[_0x2c25('0x30')]=_['keys'](_0x4d5eb2[_0x2c25('0x30')]);_0x42136d[_0x2c25('0x32')]=_[_0x2c25('0x33')](_0x42136d[_0x2c25('0x2f')],_0x42136d[_0x2c25('0x30')]);_0x159bec[_0x2c25('0x35')]=_['intersection'](_0x42136d[_0x2c25('0x2f')],qs['fields'](_0x4d5eb2['query']['fields']));_0x159bec[_0x2c25('0x35')]=_0x159bec[_0x2c25('0x35')][_0x2c25('0x44')]?_0x159bec[_0x2c25('0x35')]:_0x42136d[_0x2c25('0x2f')];if(_0x4d5eb2[_0x2c25('0x30')][_0x2c25('0x3f')]){_0x159bec['include']=[{'all':!![]}];}_0x159bec=_['merge']({},_0x159bec,_0x4d5eb2[_0x2c25('0x45')]);return db[_0x2c25('0x2b')]['find'](_0x159bec)['then'](handleEntityNotFound(_0x5ebcfd,null))[_0x2c25('0x25')](respondWithResult(_0x5ebcfd,null))[_0x2c25('0x41')](handleError(_0x5ebcfd,null));};exports[_0x2c25('0x46')]=function(_0x158113,_0x5ef461){return db[_0x2c25('0x2b')][_0x2c25('0x46')](_0x158113[_0x2c25('0x47')],{})[_0x2c25('0x25')](respondWithResult(_0x5ef461,0xc9))[_0x2c25('0x41')](handleError(_0x5ef461,null));};exports[_0x2c25('0x24')]=function(_0x23eb66,_0x2a5076){if(_0x23eb66['body']['id']){delete _0x23eb66[_0x2c25('0x47')]['id'];}return db['Dynamics365Account'][_0x2c25('0x48')]({'where':{'id':_0x23eb66[_0x2c25('0x43')]['id']}})[_0x2c25('0x25')](handleEntityNotFound(_0x2a5076,null))['then'](saveUpdates(_0x23eb66['body'],null))[_0x2c25('0x25')](respondWithResult(_0x2a5076,null))[_0x2c25('0x41')](handleError(_0x2a5076,null));};exports[_0x2c25('0x49')]=function(_0xe7656d,_0x17b6d7){return db[_0x2c25('0x2b')][_0x2c25('0x48')]({'where':{'id':_0xe7656d[_0x2c25('0x43')]['id']}})[_0x2c25('0x25')](handleEntityNotFound(_0x17b6d7,null))[_0x2c25('0x25')](removeEntity(_0x17b6d7,null))['catch'](handleError(_0x17b6d7,null));};exports[_0x2c25('0x4a')]=function(_0x2c175e,_0x4bad15,_0x265902){var _0x54765f={};var _0x489b18={};var _0x22cf8e;var _0x137955;return db[_0x2c25('0x2b')][_0x2c25('0x4b')]({'where':{'id':_0x2c175e['params']['id']}})[_0x2c25('0x25')](handleEntityNotFound(_0x4bad15,null))[_0x2c25('0x25')](function(_0x1a865e){if(_0x1a865e){_0x22cf8e=_0x1a865e;_0x489b18[_0x2c25('0x2f')]=_['keys'](db[_0x2c25('0x4c')][_0x2c25('0x2c')]);_0x489b18[_0x2c25('0x30')]=_[_0x2c25('0x31')](_0x2c175e[_0x2c25('0x30')]);_0x489b18[_0x2c25('0x32')]=_[_0x2c25('0x33')](_0x489b18[_0x2c25('0x2f')],_0x489b18[_0x2c25('0x30')]);_0x54765f[_0x2c25('0x35')]=_['intersection'](_0x489b18[_0x2c25('0x2f')],qs[_0x2c25('0x34')](_0x2c175e['query'][_0x2c25('0x34')]));_0x54765f[_0x2c25('0x35')]=_0x54765f[_0x2c25('0x35')][_0x2c25('0x44')]?_0x54765f['attributes']:_0x489b18[_0x2c25('0x2f')];_0x54765f[_0x2c25('0x38')]=qs['sort'](_0x2c175e[_0x2c25('0x30')]['sort']);_0x54765f['where']=qs[_0x2c25('0x32')](_[_0x2c25('0x4d')](_0x2c175e[_0x2c25('0x30')],_0x489b18[_0x2c25('0x32')]));if(_0x2c175e[_0x2c25('0x30')][_0x2c25('0x3b')]){_0x54765f[_0x2c25('0x3a')]=_[_0x2c25('0x3e')](_0x54765f[_0x2c25('0x3a')],{'$or':_[_0x2c25('0x2a')](_0x54765f[_0x2c25('0x35')],function(_0x2cd34b){var _0x1d9fca={};_0x1d9fca[_0x2cd34b]={'$like':'%'+_0x2c175e[_0x2c25('0x30')][_0x2c25('0x3b')]+'%'};return _0x1d9fca;})});}_0x54765f=_[_0x2c25('0x3e')]({},_0x54765f,_0x2c175e[_0x2c25('0x45')]);return _0x22cf8e[_0x2c25('0x4a')](_0x54765f);}})[_0x2c25('0x25')](function(_0x235024){if(_0x235024){_0x137955=_0x235024[_0x2c25('0x44')];if(!_0x2c175e['query'][_0x2c25('0x36')](_0x2c25('0x37'))){_0x54765f['limit']=qs[_0x2c25('0x20')](_0x2c175e[_0x2c25('0x30')]['limit']);_0x54765f[_0x2c25('0x1d')]=qs[_0x2c25('0x1d')](_0x2c175e[_0x2c25('0x30')][_0x2c25('0x1d')]);}return _0x22cf8e['getConfigurations'](_0x54765f);}})[_0x2c25('0x25')](function(_0x4e6efe){if(_0x4e6efe){return _0x4e6efe?{'count':_0x137955,'rows':_0x4e6efe}:null;}})['then'](respondWithResult(_0x4bad15,null))[_0x2c25('0x41')](handleError(_0x4bad15,null));};exports['addConfiguration']=function(_0x2596fb,_0x458b8d,_0xe22f03){if(_0x2596fb['body']['id']){delete _0x2596fb[_0x2c25('0x47')]['id'];}return db[_0x2c25('0x2b')]['findOne']({'where':{'id':_0x2596fb['params']['id']}})[_0x2c25('0x25')](handleEntityNotFound(_0x458b8d,null))[_0x2c25('0x25')](function(_0x58874f){if(_0x58874f){_0x2596fb[_0x2c25('0x47')][_0x2c25('0x4e')]=_0x58874f['id'];_0x2596fb[_0x2c25('0x47')][_0x2c25('0x4f')]=integrations['getSubjects'](_0x2596fb[_0x2c25('0x47')][_0x2c25('0x50')],_0x2596fb['body'][_0x2c25('0x3c')]);_0x2596fb[_0x2c25('0x47')][_0x2c25('0x51')]=integrations[_0x2c25('0x52')](_0x2596fb[_0x2c25('0x47')][_0x2c25('0x50')],_0x2596fb[_0x2c25('0x47')][_0x2c25('0x3c')]);return db[_0x2c25('0x4c')][_0x2c25('0x46')](_0x2596fb['body'],{'include':[{'model':db[_0x2c25('0x53')],'as':_0x2c25('0x4f')},{'model':db[_0x2c25('0x53')],'as':_0x2c25('0x51')}]});}return null;})[_0x2c25('0x25')](respondWithResult(_0x458b8d,null))[_0x2c25('0x41')](handleError(_0x458b8d,null));};exports[_0x2c25('0x54')]=function(_0x35cae8,_0x1bcda6,_0x5c737e){var _0x582df9=_0x35cae8[_0x2c25('0x30')][_0x2c25('0x55')];var _0x301ab=_0x582df9==='incident'?_0x2c25('0x56'):_0x2c25('0x57');var _0x368c55='';var _0xb08658='';var _0x3ac3d6='';var _0x20b74c='';var _0x4cf377='';var _0x4a2898='';var _0x2e5338='';var _0x395594='';var _0x3ae4c5=[_0x2c25('0x58'),'description','customerid',_0x2c25('0x59'),_0x2c25('0x5a'),_0x2c25('0x5b'),_0x2c25('0x5c'),'regardingobjectid',_0x2c25('0x5d'),_0x2c25('0x5e')];var _0x4145b5=[_0x2c25('0x5f'),_0x2c25('0x60'),'actualserviceunits',_0x2c25('0x61'),_0x2c25('0x62'),'contactidyominame',_0x2c25('0x63'),'contractidname',_0x2c25('0x64'),_0x2c25('0x65'),_0x2c25('0x66'),_0x2c25('0x67'),_0x2c25('0x68'),_0x2c25('0x69'),_0x2c25('0x6a'),_0x2c25('0x6b'),'customeridtype',_0x2c25('0x6c'),'emailaddress',_0x2c25('0x6d'),_0x2c25('0x6e'),'entityimage_url',_0x2c25('0x6f'),_0x2c25('0x70'),_0x2c25('0x71'),'followupby',_0x2c25('0x72'),_0x2c25('0x73'),'kbarticleidname',_0x2c25('0x74'),_0x2c25('0x75'),_0x2c25('0x76'),_0x2c25('0x77'),'modifiedbyname',_0x2c25('0x78'),_0x2c25('0x79'),_0x2c25('0x7a'),_0x2c25('0x7b'),_0x2c25('0x7c'),_0x2c25('0x7d'),_0x2c25('0x7e'),_0x2c25('0x7f'),_0x2c25('0x80'),'owneridname',_0x2c25('0x81'),_0x2c25('0x82'),_0x2c25('0x83'),_0x2c25('0x84'),_0x2c25('0x85'),_0x2c25('0x86'),'productidname',_0x2c25('0x87'),'resolveby','resolvebykpiidname','responseby',_0x2c25('0x88'),'responsiblecontactidyominame',_0x2c25('0x89'),'slainvokedidname',_0x2c25('0x8a'),_0x2c25('0x8b'),_0x2c25('0x8c'),_0x2c25('0x8d'),'subjectidname',_0x2c25('0x8e'),_0x2c25('0x8f'),_0x2c25('0x90'),'traversedpath',_0x2c25('0x91'),_0x2c25('0x92')];var _0x559596=_0x3ae4c5[_0x2c25('0x93')](_0x4145b5);return db[_0x2c25('0x2b')][_0x2c25('0x4b')]({'where':{'id':_0x35cae8[_0x2c25('0x43')]['id']},'attributes':['id',_0x2c25('0x94'),'password',_0x2c25('0x95'),_0x2c25('0x96'),_0x2c25('0x97'),'clientSecret']})[_0x2c25('0x25')](handleEntityNotFound(_0x1bcda6,null))[_0x2c25('0x25')](function(_0x248eb9){if(_0x248eb9){_0x395594=_0x248eb9['remoteUri'];var _0x17198c=_0x395594[_0x2c25('0x98')](-0x1);if(_0x17198c==='/'){_0x395594=_0x395594[_0x2c25('0x99')](0x0,_0x395594[_0x2c25('0x9a')](_0x17198c));}_0x2e5338=util[_0x2c25('0x9b')](_0x2c25('0x9c'),_0x395594);var _0x19deda={'method':_0x2c25('0x9d'),'uri':'https://login.microsoftonline.com/'+_0x248eb9[_0x2c25('0x96')]+_0x2c25('0x9e'),'form':{'client_id':_0x248eb9[_0x2c25('0x97')],'resource':_0x395594,'username':_0x248eb9[_0x2c25('0x94')],'password':_0x248eb9[_0x2c25('0x9f')],'grant_type':'password','client_secret':_0x248eb9['clientSecret']},'json':!![]};return rp(_0x19deda);}})[_0x2c25('0x25')](function(_0x3a41ab){_0x4a2898=_0x3a41ab[_0x2c25('0xa0')];var _0x4bdd71={'method':_0x2c25('0xa1'),'uri':encodeURI(_0x2e5338+_0x2c25('0xa2')+_0x301ab+'\x27'),'headers':{'Authorization':_0x2c25('0xa3')+_0x4a2898,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4bdd71);})[_0x2c25('0x25')](function(_0x2ea2f2){var _0x67ab85=_0x2ea2f2[_0x2c25('0xa4')][0x0];var _0x420b7f=_0x67ab85[_0x2c25('0xa5')];var _0x222b63={'method':_0x2c25('0xa1'),'uri':_0x2e5338+_0x2c25('0xa6')+_0x420b7f+_0x2c25('0xa7'),'headers':{'Authorization':_0x2c25('0xa3')+_0x4a2898,'If-None-Match':null,'OData-Version':_0x2c25('0xa8')},'json':!![]};return rp(_0x222b63);})['then'](function(_0x4f28e7){_0x368c55=_0x4f28e7;_0xb08658=_0x368c55[_0x2c25('0xa9')];_0xb08658=_[_0x2c25('0xaa')](_0xb08658,function(_0x4fe29e){return!_0x559596['includes'](_0x4fe29e[_0x2c25('0xab')]);});var _0x2ad3a5=[];var _0x3aba76=[];_0xb08658[_0x2c25('0xac')](function(_0x5e4d78){if(_0x5e4d78['@odata.type']){var _0x3d8c90=_0x5e4d78['@odata.type'][_0x2c25('0x99')](_0x5e4d78['@odata.type']['lastIndexOf']('.')+0x1);if(_0x3d8c90===_0x2c25('0xad')){_0x2ad3a5['push'](getSelectList(_0x2e5338,_0x582df9,_0x3aba76,_0x368c55[_0x2c25('0xa5')],_0x5e4d78['MetadataId'],_0x4a2898));}}});return Promise[_0x2c25('0xae')](_0x2ad3a5);})[_0x2c25('0x25')](function(_0x26d1cc){_0x3ac3d6=_0x26d1cc[0x0];var _0x36b0a3=[];var _0x59a137=[];_0xb08658[_0x2c25('0xac')](function(_0x4424e1){if(!_[_0x2c25('0xaf')](_0x4424e1[_0x2c25('0xb0')])){var _0x16bc23=_0x4424e1[_0x2c25('0xb0')][_0x2c25('0x99')](_0x4424e1[_0x2c25('0xb0')]['lastIndexOf']('.')+0x1);if(_0x16bc23===_0x2c25('0xb1')){_0x36b0a3[_0x2c25('0xb2')](getBooleanList(_0x2e5338,_0x582df9,_0x59a137,_0x368c55[_0x2c25('0xa5')],_0x4424e1['MetadataId'],_0x4a2898));}}});return Promise[_0x2c25('0xae')](_0x36b0a3);})[_0x2c25('0x25')](function(_0x515ed4){_0x20b74c=_0x515ed4[0x0];var _0x582c34=[];var _0x2bc6f9=[];_0xb08658[_0x2c25('0xac')](function(_0x32da96){if(_0x32da96['@odata.type']){var _0x371ee1=_0x32da96['@odata.type'][_0x2c25('0x99')](_0x32da96[_0x2c25('0xb0')][_0x2c25('0x9a')]('.')+0x1);if(_0x371ee1===_0x2c25('0xb3')||_0x371ee1===_0x2c25('0xb4')||_0x371ee1===_0x2c25('0xb5')||_0x371ee1===_0x2c25('0xb6')||_0x371ee1===_0x2c25('0xb7')||_0x371ee1===_0x2c25('0xb8')||_0x371ee1===_0x2c25('0xb9')||_0x371ee1===_0x2c25('0xba')||_0x371ee1===_0x2c25('0xbb')||_0x371ee1===_0x2c25('0xbc')){_0x582c34['push'](getInputList(_0x2e5338,_0x582df9,_0x371ee1,_0x2bc6f9,_0x368c55[_0x2c25('0xa5')],_0x32da96[_0x2c25('0xa5')],_0x4a2898));}}});return Promise[_0x2c25('0xae')](_0x582c34);})[_0x2c25('0x25')](function(_0x2931aa){_0x4cf377=_0x2931aa[0x0];var _0x359dc8=_0x3ac3d6[_0x2c25('0x93')](_0x20b74c)['concat'](_0x4cf377);var _0x30b226={'count':_0x359dc8[_0x2c25('0x44')],'rows':_0x359dc8};return _0x30b226;})[_0x2c25('0x25')](respondWithResult(_0x1bcda6,null))[_0x2c25('0x41')](function(_0x28bbc2){var _0x28d020=_0x35cae8[_0x2c25('0x30')]['test']?0x1f4:_0x28bbc2[_0x2c25('0xbd')]||0x1f4;logger['error'](_0x28bbc2[_0x2c25('0xbe')]);delete _0x28bbc2['name'];if(_0x28d020===0x191){_0x28d020=0x190;}_0x1bcda6['status'](_0x28d020)[_0x2c25('0x28')](_0x35cae8['query'][_0x2c25('0xbf')]?{'message':_0x2c25('0xc0'),'statusCode':_0x28bbc2[_0x2c25('0xbd')]}:_0x28bbc2);});};function getSelectList(_0x48ac57,_0x2f4b43,_0x4a9b27,_0x369976,_0x24176c,_0x134c66){var _0x545a73={'method':_0x2c25('0xa1'),'uri':_0x48ac57+'EntityDefinitions('+_0x369976+_0x2c25('0xc1')+_0x24176c+_0x2c25('0xc2')+_0x2c25('0xc3'),'headers':{'Authorization':_0x2c25('0xa3')+_0x134c66,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x545a73)[_0x2c25('0x25')](function(_0x1197e3){var _0x2bedad=[];var _0x3ace82=_0x1197e3[_0x2c25('0xc4')]['Options'];_0x3ace82[_0x2c25('0xac')](function(_0x4affa8){_0x2bedad[_0x2c25('0xb2')]({'name':_0x4affa8[_0x2c25('0xc5')][_0x2c25('0xc6')][_0x2c25('0xc5')],'value':String(_0x4affa8['Value'])});});var _0x43d2a9={'id':_0x2f4b43+'_'+_0x1197e3[_0x2c25('0xab')],'name':_0x1197e3['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x2bedad};_0x4a9b27['push'](_0x43d2a9);return _0x4a9b27;});}function getBooleanList(_0x21ce8f,_0x169080,_0x52ea3a,_0x4a2c66,_0x4ce9bc,_0x439ff6){var _0x457ba6={'method':_0x2c25('0xa1'),'uri':_0x21ce8f+_0x2c25('0xa6')+_0x4a2c66+_0x2c25('0xc1')+_0x4ce9bc+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x2c25('0xa3')+_0x439ff6,'If-None-Match':null,'OData-Version':_0x2c25('0xa8')},'json':!![]};return rp(_0x457ba6)[_0x2c25('0x25')](function(_0x212128){var _0x27a4b0=[];_0x27a4b0['push']({'name':_0x212128[_0x2c25('0xc4')][_0x2c25('0xc7')][_0x2c25('0xc5')][_0x2c25('0xc6')]['Label'],'value':'true'},{'name':_0x212128['OptionSet'][_0x2c25('0xc8')][_0x2c25('0xc5')]['UserLocalizedLabel'][_0x2c25('0xc5')],'value':_0x2c25('0xc9')});var _0x2b5d6f={'id':_0x169080+'_'+_0x212128[_0x2c25('0xab')],'name':_0x212128[_0x2c25('0xca')][_0x2c25('0xc6')][_0x2c25('0xc5')],'custom':![],'options':_0x27a4b0};_0x52ea3a['push'](_0x2b5d6f);return _0x52ea3a;});}function getInputList(_0xcba781,_0x145334,_0xcc20b6,_0x3811a1,_0xa22a87,_0x3110bd,_0x4b82cb){var _0xd16a62={'method':'GET','uri':_0xcba781+_0x2c25('0xa6')+_0xa22a87+')/Attributes('+_0x3110bd+_0x2c25('0xcb')+_0xcc20b6+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x4b82cb,'If-None-Match':null,'OData-Version':_0x2c25('0xa8')},'json':!![]};return rp(_0xd16a62)['then'](function(_0x1e6981){var _0x71009a={'id':_0x145334+'_'+_0x1e6981[_0x2c25('0xab')],'name':_0x1e6981['DisplayName'][_0x2c25('0xc6')]?_0x1e6981[_0x2c25('0xca')][_0x2c25('0xc6')][_0x2c25('0xc5')]:_0x1e6981[_0x2c25('0xab')],'custom':![],'options':[]};_0x3811a1['push'](_0x71009a);return _0x3811a1;});} \ No newline at end of file +var _0x7119=['4.0','Attributes','includes','LogicalName','forEach','@odata.type','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','all','statusCode','error','send','test','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Attributes(','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','limit','count','set','apply','save','then','destroy','sendStatus','stack','name','index','Dynamics365Account','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','update','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','Dynamics365Field','getFields','ticketType','incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','remoteUri','tenantId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','clientId','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)'];(function(_0x279229,_0x1d69d9){var _0x195ca7=function(_0x362fbd){while(--_0x362fbd){_0x279229['push'](_0x279229['shift']());}};_0x195ca7(++_0x1d69d9);}(_0x7119,0x1c7));var _0x9711=function(_0x27bcf5,_0x236765){_0x27bcf5=_0x27bcf5-0x0;var _0x4ce4cf=_0x7119[_0x27bcf5];return _0x4ce4cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9711('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9711('0x1'));var rp=require('request-promise');var moment=require(_0x9711('0x2'));var BPromise=require(_0x9711('0x3'));var Mustache=require(_0x9711('0x4'));var util=require(_0x9711('0x5'));var path=require('path');var sox=require(_0x9711('0x6'));var csv=require(_0x9711('0x7'));var ejs=require(_0x9711('0x8'));var fs=require('fs');var fs_extra=require(_0x9711('0x9'));var _=require(_0x9711('0xa'));var squel=require('squel');var crypto=require(_0x9711('0xb'));var jsforce=require(_0x9711('0xc'));var deskjs=require(_0x9711('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9711('0xe'));var Papa=require('papaparse');var Redis=require(_0x9711('0xf'));var authService=require(_0x9711('0x10'));var qs=require(_0x9711('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9711('0x12'));var logger=require(_0x9711('0x13'))(_0x9711('0x14'));var utils=require(_0x9711('0x15'));var config=require(_0x9711('0x16'));var licenseUtil=require(_0x9711('0x17'));var db=require(_0x9711('0x18'))['db'];var integrations=require(_0x9711('0x19'));function respondWithStatusCode(_0xdcc5ec,_0x33249b){_0x33249b=_0x33249b||0xcc;return function(_0x46f80a){if(_0x46f80a){return _0xdcc5ec['sendStatus'](_0x33249b);}return _0xdcc5ec['status'](_0x33249b)[_0x9711('0x1a')]();};}function respondWithResult(_0x38d721,_0x449c99){_0x449c99=_0x449c99||0xc8;return function(_0x323979){if(_0x323979){return _0x38d721[_0x9711('0x1b')](_0x449c99)['json'](_0x323979);}};}function respondWithFilteredResult(_0x3f8a3d,_0x5324ce){return function(_0x376f3c){if(_0x376f3c){var _0x2cc523=typeof _0x5324ce[_0x9711('0x1c')]===_0x9711('0x1d')&&typeof _0x5324ce[_0x9711('0x1e')]==='undefined';var _0x487349=_0x376f3c[_0x9711('0x1f')];var _0x3615c9=_0x2cc523?0x0:_0x5324ce[_0x9711('0x1c')];var _0x4629e2=_0x2cc523?_0x376f3c[_0x9711('0x1f')]:_0x5324ce['offset']+_0x5324ce[_0x9711('0x1e')];var _0x31e19f;if(_0x4629e2>=_0x487349){_0x4629e2=_0x487349;_0x31e19f=0xc8;}else{_0x31e19f=0xce;}_0x3f8a3d[_0x9711('0x1b')](_0x31e19f);return _0x3f8a3d[_0x9711('0x20')]('Content-Range',_0x3615c9+'-'+_0x4629e2+'/'+_0x487349)['json'](_0x376f3c);}return null;};}function patchUpdates(_0x55b6d7){return function(_0x3a8083){try{jsonpatch[_0x9711('0x21')](_0x3a8083,_0x55b6d7,!![]);}catch(_0x3d90b5){return BPromise['reject'](_0x3d90b5);}return _0x3a8083[_0x9711('0x22')]();};}function saveUpdates(_0x3f3859,_0x4ac003){return function(_0x3de529){if(_0x3de529){return _0x3de529['update'](_0x3f3859)[_0x9711('0x23')](function(_0x4f363a){return _0x4f363a;});}return null;};}function removeEntity(_0x3023cf,_0x124eb7){return function(_0x5c64db){if(_0x5c64db){return _0x5c64db[_0x9711('0x24')]()[_0x9711('0x23')](function(){_0x3023cf[_0x9711('0x1b')](0xcc)[_0x9711('0x1a')]();});}};}function handleEntityNotFound(_0x4d2438,_0x50726b){return function(_0x42e919){if(!_0x42e919){_0x4d2438[_0x9711('0x25')](0x194);}return _0x42e919;};}function handleError(_0x5e3eda,_0x4d16e5){_0x4d16e5=_0x4d16e5||0x1f4;return function(_0x493297){logger['error'](_0x493297[_0x9711('0x26')]);if(_0x493297[_0x9711('0x27')]){delete _0x493297['name'];}_0x5e3eda[_0x9711('0x1b')](_0x4d16e5)['send'](_0x493297);};}exports[_0x9711('0x28')]=function(_0x38e357,_0x5eff02){var _0x3fc5bb={},_0x1db611={},_0x3c6da4={'count':0x0,'rows':[]};var _0x3f6f8e=_['map'](db[_0x9711('0x29')][_0x9711('0x2a')],function(_0x211ae1){return{'name':_0x211ae1['fieldName'],'type':_0x211ae1[_0x9711('0x2b')][_0x9711('0x2c')]};});_0x1db611[_0x9711('0x2d')]=_[_0x9711('0x2e')](_0x3f6f8e,'name');_0x1db611['query']=_[_0x9711('0x2f')](_0x38e357[_0x9711('0x30')]);_0x1db611[_0x9711('0x31')]=_[_0x9711('0x32')](_0x1db611['model'],_0x1db611['query']);_0x3fc5bb['attributes']=_['intersection'](_0x1db611['model'],qs[_0x9711('0x33')](_0x38e357[_0x9711('0x30')][_0x9711('0x33')]));_0x3fc5bb[_0x9711('0x34')]=_0x3fc5bb[_0x9711('0x34')][_0x9711('0x35')]?_0x3fc5bb[_0x9711('0x34')]:_0x1db611[_0x9711('0x2d')];if(!_0x38e357[_0x9711('0x30')][_0x9711('0x36')]('nolimit')){_0x3fc5bb[_0x9711('0x1e')]=qs[_0x9711('0x1e')](_0x38e357[_0x9711('0x30')][_0x9711('0x1e')]);_0x3fc5bb[_0x9711('0x1c')]=qs[_0x9711('0x1c')](_0x38e357[_0x9711('0x30')]['offset']);}_0x3fc5bb[_0x9711('0x37')]=qs[_0x9711('0x38')](_0x38e357[_0x9711('0x30')][_0x9711('0x38')]);_0x3fc5bb[_0x9711('0x39')]=qs[_0x9711('0x31')](_[_0x9711('0x3a')](_0x38e357[_0x9711('0x30')],_0x1db611[_0x9711('0x31')]),_0x3f6f8e);if(_0x38e357[_0x9711('0x30')][_0x9711('0x3b')]){_0x3fc5bb['where']=_[_0x9711('0x3c')](_0x3fc5bb[_0x9711('0x39')],{'$or':_[_0x9711('0x2e')](_0x3f6f8e,function(_0x57c72a){if(_0x57c72a[_0x9711('0x2b')]!=='VIRTUAL'){var _0x39c277={};_0x39c277[_0x57c72a[_0x9711('0x27')]]={'$like':'%'+_0x38e357['query'][_0x9711('0x3b')]+'%'};return _0x39c277;}})});}_0x3fc5bb=_[_0x9711('0x3c')]({},_0x3fc5bb,_0x38e357[_0x9711('0x3d')]);var _0x2be061={'where':_0x3fc5bb['where']};return db[_0x9711('0x29')][_0x9711('0x1f')](_0x2be061)[_0x9711('0x23')](function(_0x41f2da){_0x3c6da4['count']=_0x41f2da;if(_0x38e357['query']['includeAll']){_0x3fc5bb[_0x9711('0x3e')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x9711('0x3f')](_0x3fc5bb);})[_0x9711('0x23')](function(_0x52ac13){_0x3c6da4[_0x9711('0x40')]=_0x52ac13;return _0x3c6da4;})[_0x9711('0x23')](respondWithFilteredResult(_0x5eff02,_0x3fc5bb))[_0x9711('0x41')](handleError(_0x5eff02,null));};exports['show']=function(_0x242477,_0x483cb7){var _0x1b93f2={'raw':![],'where':{'id':_0x242477[_0x9711('0x42')]['id']}},_0x46f6cc={};_0x46f6cc[_0x9711('0x2d')]=_[_0x9711('0x2f')](db[_0x9711('0x29')]['rawAttributes']);_0x46f6cc[_0x9711('0x30')]=_[_0x9711('0x2f')](_0x242477['query']);_0x46f6cc['filters']=_[_0x9711('0x32')](_0x46f6cc[_0x9711('0x2d')],_0x46f6cc[_0x9711('0x30')]);_0x1b93f2[_0x9711('0x34')]=_[_0x9711('0x32')](_0x46f6cc[_0x9711('0x2d')],qs[_0x9711('0x33')](_0x242477[_0x9711('0x30')][_0x9711('0x33')]));_0x1b93f2[_0x9711('0x34')]=_0x1b93f2[_0x9711('0x34')][_0x9711('0x35')]?_0x1b93f2[_0x9711('0x34')]:_0x46f6cc['model'];if(_0x242477['query'][_0x9711('0x43')]){_0x1b93f2[_0x9711('0x3e')]=[{'all':!![]}];}_0x1b93f2=_[_0x9711('0x3c')]({},_0x1b93f2,_0x242477['options']);return db[_0x9711('0x29')][_0x9711('0x44')](_0x1b93f2)[_0x9711('0x23')](handleEntityNotFound(_0x483cb7,null))[_0x9711('0x23')](respondWithResult(_0x483cb7,null))[_0x9711('0x41')](handleError(_0x483cb7,null));};exports[_0x9711('0x45')]=function(_0x4c6362,_0x353260){return db['Dynamics365Account'][_0x9711('0x45')](_0x4c6362[_0x9711('0x46')],{})[_0x9711('0x23')](respondWithResult(_0x353260,0xc9))[_0x9711('0x41')](handleError(_0x353260,null));};exports[_0x9711('0x47')]=function(_0xbd198a,_0x18343c){if(_0xbd198a[_0x9711('0x46')]['id']){delete _0xbd198a['body']['id'];}return db[_0x9711('0x29')][_0x9711('0x44')]({'where':{'id':_0xbd198a[_0x9711('0x42')]['id']}})[_0x9711('0x23')](handleEntityNotFound(_0x18343c,null))[_0x9711('0x23')](saveUpdates(_0xbd198a[_0x9711('0x46')],null))[_0x9711('0x23')](respondWithResult(_0x18343c,null))['catch'](handleError(_0x18343c,null));};exports[_0x9711('0x24')]=function(_0x3ed8a0,_0x16ff3c){return db[_0x9711('0x29')][_0x9711('0x44')]({'where':{'id':_0x3ed8a0['params']['id']}})[_0x9711('0x23')](handleEntityNotFound(_0x16ff3c,null))[_0x9711('0x23')](removeEntity(_0x16ff3c,null))['catch'](handleError(_0x16ff3c,null));};exports[_0x9711('0x48')]=function(_0x5d0d74,_0x31b5df,_0x9989ce){var _0x5f0faa={};var _0x41d496={};var _0x45e8a3;var _0x377524;return db[_0x9711('0x29')][_0x9711('0x49')]({'where':{'id':_0x5d0d74[_0x9711('0x42')]['id']}})[_0x9711('0x23')](handleEntityNotFound(_0x31b5df,null))[_0x9711('0x23')](function(_0x35572a){if(_0x35572a){_0x45e8a3=_0x35572a;_0x41d496[_0x9711('0x2d')]=_[_0x9711('0x2f')](db[_0x9711('0x4a')][_0x9711('0x2a')]);_0x41d496[_0x9711('0x30')]=_['keys'](_0x5d0d74[_0x9711('0x30')]);_0x41d496[_0x9711('0x31')]=_['intersection'](_0x41d496[_0x9711('0x2d')],_0x41d496[_0x9711('0x30')]);_0x5f0faa[_0x9711('0x34')]=_['intersection'](_0x41d496[_0x9711('0x2d')],qs['fields'](_0x5d0d74[_0x9711('0x30')][_0x9711('0x33')]));_0x5f0faa['attributes']=_0x5f0faa['attributes'][_0x9711('0x35')]?_0x5f0faa[_0x9711('0x34')]:_0x41d496[_0x9711('0x2d')];_0x5f0faa[_0x9711('0x37')]=qs['sort'](_0x5d0d74[_0x9711('0x30')][_0x9711('0x38')]);_0x5f0faa[_0x9711('0x39')]=qs[_0x9711('0x31')](_[_0x9711('0x3a')](_0x5d0d74['query'],_0x41d496[_0x9711('0x31')]));if(_0x5d0d74[_0x9711('0x30')]['filter']){_0x5f0faa['where']=_[_0x9711('0x3c')](_0x5f0faa['where'],{'$or':_[_0x9711('0x2e')](_0x5f0faa['attributes'],function(_0x161974){var _0x1fe636={};_0x1fe636[_0x161974]={'$like':'%'+_0x5d0d74[_0x9711('0x30')][_0x9711('0x3b')]+'%'};return _0x1fe636;})});}_0x5f0faa=_[_0x9711('0x3c')]({},_0x5f0faa,_0x5d0d74[_0x9711('0x3d')]);return _0x45e8a3['getConfigurations'](_0x5f0faa);}})[_0x9711('0x23')](function(_0x44819c){if(_0x44819c){_0x377524=_0x44819c[_0x9711('0x35')];if(!_0x5d0d74[_0x9711('0x30')][_0x9711('0x36')](_0x9711('0x4b'))){_0x5f0faa['limit']=qs[_0x9711('0x1e')](_0x5d0d74[_0x9711('0x30')][_0x9711('0x1e')]);_0x5f0faa[_0x9711('0x1c')]=qs[_0x9711('0x1c')](_0x5d0d74[_0x9711('0x30')][_0x9711('0x1c')]);}return _0x45e8a3['getConfigurations'](_0x5f0faa);}})['then'](function(_0x23589d){if(_0x23589d){return _0x23589d?{'count':_0x377524,'rows':_0x23589d}:null;}})[_0x9711('0x23')](respondWithResult(_0x31b5df,null))['catch'](handleError(_0x31b5df,null));};exports[_0x9711('0x4c')]=function(_0x4b0e5e,_0x325121,_0x360538){if(_0x4b0e5e[_0x9711('0x46')]['id']){delete _0x4b0e5e[_0x9711('0x46')]['id'];}return db[_0x9711('0x29')][_0x9711('0x49')]({'where':{'id':_0x4b0e5e[_0x9711('0x42')]['id']}})[_0x9711('0x23')](handleEntityNotFound(_0x325121,null))['then'](function(_0x11d1b8){if(_0x11d1b8){_0x4b0e5e['body'][_0x9711('0x4d')]=_0x11d1b8['id'];_0x4b0e5e[_0x9711('0x46')][_0x9711('0x4e')]=integrations[_0x9711('0x4f')](_0x4b0e5e[_0x9711('0x46')]['channel'],_0x4b0e5e[_0x9711('0x46')][_0x9711('0x2b')]);_0x4b0e5e[_0x9711('0x46')]['Descriptions']=integrations[_0x9711('0x50')](_0x4b0e5e[_0x9711('0x46')]['channel'],_0x4b0e5e[_0x9711('0x46')][_0x9711('0x2b')]);return db[_0x9711('0x4a')][_0x9711('0x45')](_0x4b0e5e['body'],{'include':[{'model':db[_0x9711('0x51')],'as':'Subjects'},{'model':db[_0x9711('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x325121,null))[_0x9711('0x41')](handleError(_0x325121,null));};exports[_0x9711('0x52')]=function(_0x418a2a,_0x284415,_0x5ee68d){var _0x1f20ba=_0x418a2a[_0x9711('0x30')][_0x9711('0x53')];var _0x28f205=_0x1f20ba===_0x9711('0x54')?'Incident':_0x9711('0x55');var _0x1a6ccf='';var _0x467419='';var _0x1d64db='';var _0x355833='';var _0x3abef4='';var _0x7d49d='';var _0x7326b3='';var _0x30f938='';var _0x180da0=[_0x9711('0x56'),_0x9711('0x57'),_0x9711('0x58'),_0x9711('0x59'),_0x9711('0x5a'),_0x9711('0x5b'),_0x9711('0x5c'),_0x9711('0x5d'),_0x9711('0x5e'),_0x9711('0x5f')];var _0x4c15e3=[_0x9711('0x60'),_0x9711('0x61'),_0x9711('0x62'),_0x9711('0x63'),_0x9711('0x64'),_0x9711('0x65'),_0x9711('0x66'),_0x9711('0x67'),_0x9711('0x68'),'createdbyexternalpartyyominame',_0x9711('0x69'),_0x9711('0x6a'),_0x9711('0x6b'),_0x9711('0x6c'),_0x9711('0x6d'),_0x9711('0x6e'),'customeridtype',_0x9711('0x6f'),_0x9711('0x70'),_0x9711('0x71'),'entityimage_timestamp',_0x9711('0x72'),_0x9711('0x73'),'exchangerate',_0x9711('0x74'),_0x9711('0x75'),_0x9711('0x76'),_0x9711('0x77'),'kbarticleidname',_0x9711('0x78'),_0x9711('0x79'),'modifiedbyexternalpartyname',_0x9711('0x7a'),_0x9711('0x7b'),_0x9711('0x7c'),'modifiedon',_0x9711('0x7d'),_0x9711('0x7e'),_0x9711('0x7f'),_0x9711('0x80'),'numberofchildincidents',_0x9711('0x81'),'overriddencreatedon',_0x9711('0x82'),_0x9711('0x83'),_0x9711('0x84'),_0x9711('0x85'),_0x9711('0x86'),_0x9711('0x87'),_0x9711('0x88'),_0x9711('0x89'),_0x9711('0x8a'),'resolveby',_0x9711('0x8b'),_0x9711('0x8c'),_0x9711('0x8d'),_0x9711('0x8e'),_0x9711('0x8f'),_0x9711('0x90'),_0x9711('0x91'),_0x9711('0x92'),_0x9711('0x93'),_0x9711('0x94'),_0x9711('0x95'),_0x9711('0x96'),_0x9711('0x97'),_0x9711('0x98'),_0x9711('0x99'),'utcconversiontimezonecode',_0x9711('0x9a')];var _0x142052=_0x180da0[_0x9711('0x9b')](_0x4c15e3);return db[_0x9711('0x29')]['findOne']({'where':{'id':_0x418a2a[_0x9711('0x42')]['id']},'attributes':['id','username','password',_0x9711('0x9c'),_0x9711('0x9d'),'clientId',_0x9711('0x9e')]})[_0x9711('0x23')](handleEntityNotFound(_0x284415,null))[_0x9711('0x23')](function(_0x13890f){if(_0x13890f){_0x30f938=_0x13890f[_0x9711('0x9c')];var _0x4598c0=_0x30f938[_0x9711('0x9f')](-0x1);if(_0x4598c0==='/'){_0x30f938=_0x30f938[_0x9711('0xa0')](0x0,_0x30f938[_0x9711('0xa1')](_0x4598c0));}_0x7326b3=util[_0x9711('0xa2')](_0x9711('0xa3'),_0x30f938);var _0x1ff170={'method':_0x9711('0xa4'),'uri':_0x9711('0xa5')+_0x13890f[_0x9711('0x9d')]+'/oauth2/token','form':{'client_id':_0x13890f[_0x9711('0xa6')],'resource':_0x30f938,'username':_0x13890f['username'],'password':_0x13890f['password'],'grant_type':_0x9711('0xa7'),'client_secret':_0x13890f[_0x9711('0x9e')]},'json':!![]};return rp(_0x1ff170);}})[_0x9711('0x23')](function(_0x3c8708){_0x7d49d=_0x3c8708['access_token'];var _0x456ce9={'method':_0x9711('0xa8'),'uri':encodeURI(_0x7326b3+_0x9711('0xa9')+_0x28f205+'\x27'),'headers':{'Authorization':_0x9711('0xaa')+_0x7d49d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x456ce9);})[_0x9711('0x23')](function(_0x49084b){var _0x42daa4=_0x49084b[_0x9711('0xab')][0x0];var _0xa85339=_0x42daa4[_0x9711('0xac')];var _0xd4f2e7={'method':_0x9711('0xa8'),'uri':_0x7326b3+_0x9711('0xad')+_0xa85339+_0x9711('0xae'),'headers':{'Authorization':_0x9711('0xaa')+_0x7d49d,'If-None-Match':null,'OData-Version':_0x9711('0xaf')},'json':!![]};return rp(_0xd4f2e7);})['then'](function(_0x4b1dba){_0x1a6ccf=_0x4b1dba;_0x467419=_0x1a6ccf[_0x9711('0xb0')];_0x467419=_['remove'](_0x467419,function(_0x525379){return!_0x142052[_0x9711('0xb1')](_0x525379[_0x9711('0xb2')]);});var _0x393ed7=[];var _0x27b71c=[];_0x467419[_0x9711('0xb3')](function(_0x4f43d0){if(_0x4f43d0[_0x9711('0xb4')]){var _0x1bbdec=_0x4f43d0[_0x9711('0xb4')]['substring'](_0x4f43d0[_0x9711('0xb4')][_0x9711('0xa1')]('.')+0x1);if(_0x1bbdec==='PicklistAttributeMetadata'){_0x393ed7['push'](getSelectList(_0x7326b3,_0x1f20ba,_0x27b71c,_0x1a6ccf[_0x9711('0xac')],_0x4f43d0[_0x9711('0xac')],_0x7d49d));}}});return Promise['all'](_0x393ed7);})['then'](function(_0x20b70b){_0x1d64db=_0x20b70b[0x0];var _0x4c15ee=[];var _0x1cbd49=[];_0x467419['forEach'](function(_0x406989){if(!_[_0x9711('0xb5')](_0x406989[_0x9711('0xb4')])){var _0xecf650=_0x406989['@odata.type'][_0x9711('0xa0')](_0x406989[_0x9711('0xb4')][_0x9711('0xa1')]('.')+0x1);if(_0xecf650===_0x9711('0xb6')){_0x4c15ee[_0x9711('0xb7')](getBooleanList(_0x7326b3,_0x1f20ba,_0x1cbd49,_0x1a6ccf[_0x9711('0xac')],_0x406989[_0x9711('0xac')],_0x7d49d));}}});return Promise['all'](_0x4c15ee);})[_0x9711('0x23')](function(_0x4020b8){_0x355833=_0x4020b8[0x0];var _0x3d0238=[];var _0x11fa68=[];_0x467419[_0x9711('0xb3')](function(_0x2ff341){if(_0x2ff341['@odata.type']){var _0x55347a=_0x2ff341[_0x9711('0xb4')][_0x9711('0xa0')](_0x2ff341[_0x9711('0xb4')][_0x9711('0xa1')]('.')+0x1);if(_0x55347a===_0x9711('0xb8')||_0x55347a===_0x9711('0xb9')||_0x55347a===_0x9711('0xba')||_0x55347a==='IntegerAttributeMetadata'||_0x55347a==='MemoAttributeMetadata'||_0x55347a===_0x9711('0xbb')||_0x55347a===_0x9711('0xbc')||_0x55347a===_0x9711('0xbd')||_0x55347a==='StateAttributeMetadata'||_0x55347a===_0x9711('0xbe')){_0x3d0238['push'](getInputList(_0x7326b3,_0x1f20ba,_0x55347a,_0x11fa68,_0x1a6ccf['MetadataId'],_0x2ff341[_0x9711('0xac')],_0x7d49d));}}});return Promise[_0x9711('0xbf')](_0x3d0238);})[_0x9711('0x23')](function(_0x43c5fe){_0x3abef4=_0x43c5fe[0x0];var _0xb3873c=_0x1d64db[_0x9711('0x9b')](_0x355833)[_0x9711('0x9b')](_0x3abef4);var _0x4f95c9={'count':_0xb3873c[_0x9711('0x35')],'rows':_0xb3873c};return _0x4f95c9;})['then'](respondWithResult(_0x284415,null))[_0x9711('0x41')](function(_0xbbd831){var _0x165d3d=_0x418a2a['query']['test']?0x1f4:_0xbbd831[_0x9711('0xc0')]||0x1f4;logger[_0x9711('0xc1')](_0xbbd831['stack']);delete _0xbbd831['name'];if(_0x165d3d===0x191){_0x165d3d=0x190;}_0x284415[_0x9711('0x1b')](_0x165d3d)[_0x9711('0xc2')](_0x418a2a[_0x9711('0x30')][_0x9711('0xc3')]?{'message':_0x9711('0xc4'),'statusCode':_0xbbd831[_0x9711('0xc0')]}:_0xbbd831);});};function getSelectList(_0x69ec5a,_0x4efbb5,_0x21842c,_0x122730,_0x3a3c43,_0x2b69d1){var _0x5460d0={'method':_0x9711('0xa8'),'uri':_0x69ec5a+_0x9711('0xad')+_0x122730+')/Attributes('+_0x3a3c43+_0x9711('0xc5')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x9711('0xaa')+_0x2b69d1,'If-None-Match':null,'OData-Version':_0x9711('0xaf')},'json':!![]};return rp(_0x5460d0)[_0x9711('0x23')](function(_0x6c3750){var _0x40061d=[];var _0x5e9740=_0x6c3750[_0x9711('0xc6')][_0x9711('0xc7')];_0x5e9740[_0x9711('0xb3')](function(_0x4cd385){_0x40061d[_0x9711('0xb7')]({'name':_0x4cd385[_0x9711('0xc8')][_0x9711('0xc9')][_0x9711('0xc8')],'value':String(_0x4cd385[_0x9711('0xca')])});});var _0x442c8a={'id':_0x4efbb5+'_'+_0x6c3750[_0x9711('0xb2')],'name':_0x6c3750[_0x9711('0xcb')][_0x9711('0xc9')][_0x9711('0xc8')],'custom':![],'options':_0x40061d};_0x21842c['push'](_0x442c8a);return _0x21842c;});}function getBooleanList(_0x4c25a5,_0x1041de,_0x2717db,_0x53d261,_0x2fc3fc,_0x3c7152){var _0x27c4e4={'method':_0x9711('0xa8'),'uri':_0x4c25a5+_0x9711('0xad')+_0x53d261+_0x9711('0xcc')+_0x2fc3fc+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x3c7152,'If-None-Match':null,'OData-Version':_0x9711('0xaf')},'json':!![]};return rp(_0x27c4e4)['then'](function(_0x148cce){var _0x8e124=[];_0x8e124[_0x9711('0xb7')]({'name':_0x148cce[_0x9711('0xc6')][_0x9711('0xcd')]['Label'][_0x9711('0xc9')][_0x9711('0xc8')],'value':_0x9711('0xce')},{'name':_0x148cce['OptionSet']['FalseOption'][_0x9711('0xc8')][_0x9711('0xc9')][_0x9711('0xc8')],'value':_0x9711('0xcf')});var _0x204312={'id':_0x1041de+'_'+_0x148cce[_0x9711('0xb2')],'name':_0x148cce[_0x9711('0xcb')][_0x9711('0xc9')][_0x9711('0xc8')],'custom':![],'options':_0x8e124};_0x2717db[_0x9711('0xb7')](_0x204312);return _0x2717db;});}function getInputList(_0x335c9a,_0x33c08c,_0x24fc65,_0x4759af,_0x45579e,_0x47bb06,_0x5daa56){var _0x3df67d={'method':'GET','uri':_0x335c9a+_0x9711('0xad')+_0x45579e+_0x9711('0xcc')+_0x47bb06+_0x9711('0xd0')+_0x24fc65+_0x9711('0xd1'),'headers':{'Authorization':'Bearer\x20'+_0x5daa56,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3df67d)['then'](function(_0x5d03f6){var _0x5b8fc0={'id':_0x33c08c+'_'+_0x5d03f6[_0x9711('0xb2')],'name':_0x5d03f6[_0x9711('0xcb')]['UserLocalizedLabel']?_0x5d03f6[_0x9711('0xcb')]['UserLocalizedLabel'][_0x9711('0xc8')]:_0x5d03f6[_0x9711('0xb2')],'custom':![],'options':[]};_0x4759af[_0x9711('0xb7')](_0x5b8fc0);return _0x4759af;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 95e8151..945d326 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x1a1ba7,_0x1b8bd8){var _0x244a0b=function(_0x145aae){while(--_0x145aae){_0x1a1ba7['push'](_0x1a1ba7['shift']());}};_0x244a0b(++_0x1b8bd8);}(_0xe706,0xa3));var _0x6e70=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0xe706[_0x1e5cc3];return _0x15c596;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2e6d63,_0x454c5c){var _0x37cd21=function(_0x192514){while(--_0x192514){_0x2e6d63['push'](_0x2e6d63['shift']());}};_0x37cd21(++_0x454c5c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index ee289ad..f9e628b 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 _0x751e=['raw','info','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','limit','map','include','model','then','ShowDynamics365Account','find'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x751e,0x1d6));var _0xe751=function(_0x32b315,_0x13aaa7){_0x32b315=_0x32b315-0x0;var _0x29b031=_0x751e[_0x32b315];return _0x29b031;};'use strict';var _=require(_0xe751('0x0'));var util=require(_0xe751('0x1'));var moment=require(_0xe751('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe751('0x3'));var db=require(_0xe751('0x4'))['db'];var utils=require(_0xe751('0x5'));var logger=require(_0xe751('0x6'))(_0xe751('0x7'));var config=require(_0xe751('0x8'));var jayson=require(_0xe751('0x9'));var client=jayson['client'][_0xe751('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x597f6b,_0x4eb18b,_0x13f973){return new BPromise(function(_0x10025f,_0x48a401){return client['request'](_0x597f6b,_0x13f973)['then'](function(_0x15427b){logger['info'](_0xe751('0xb'),_0x4eb18b,'request\x20sent');logger[_0xe751('0xc')](_0xe751('0xd'),_0x4eb18b,_0xe751('0xe'),JSON[_0xe751('0xf')](_0x15427b));if(_0x15427b['error']){if(_0x15427b[_0xe751('0x10')][_0xe751('0x11')]===0x1f4){logger[_0xe751('0x10')](_0xe751('0xb'),_0x4eb18b,_0x15427b['error'][_0xe751('0x12')]);return _0x48a401(_0x15427b[_0xe751('0x10')][_0xe751('0x12')]);}logger[_0xe751('0x10')](_0xe751('0xb'),_0x4eb18b,_0x15427b[_0xe751('0x10')][_0xe751('0x12')]);return _0x10025f(_0x15427b[_0xe751('0x10')]['message']);}else{logger['info'](_0xe751('0xb'),_0x4eb18b,'request\x20sent');_0x10025f(_0x15427b[_0xe751('0x13')]['message']);}})[_0xe751('0x14')](function(_0x1fdd4e){logger[_0xe751('0x10')](_0xe751('0xb'),_0x4eb18b,_0x1fdd4e);_0x48a401(_0x1fdd4e);});});}exports[_0xe751('0x15')]=function(_0x15be2a){var _0x1a0e1b=this;return new Promise(function(_0x57258f,_0x24a9c7){return db[_0xe751('0x16')][_0xe751('0x17')]({'raw':_0x15be2a[_0xe751('0x18')]?_0x15be2a['options']['raw']===undefined?!![]:![]:!![],'where':_0x15be2a[_0xe751('0x18')]?_0x15be2a['options'][_0xe751('0x19')]||null:null,'attributes':_0x15be2a[_0xe751('0x18')]?_0x15be2a[_0xe751('0x18')][_0xe751('0x1a')]||null:null,'limit':_0x15be2a['options']?_0x15be2a[_0xe751('0x18')][_0xe751('0x1b')]||null:null,'include':_0x15be2a[_0xe751('0x18')]?_0x15be2a[_0xe751('0x18')]['include']?_[_0xe751('0x1c')](_0x15be2a[_0xe751('0x18')][_0xe751('0x1d')],function(_0x5882a4){return{'model':db[_0x5882a4['model']],'as':_0x5882a4['as'],'attributes':_0x5882a4[_0xe751('0x1a')],'include':_0x5882a4['include']?_['map'](_0x5882a4[_0xe751('0x1d')],function(_0x4d072a){return{'model':db[_0x4d072a['model']],'as':_0x4d072a['as'],'attributes':_0x4d072a[_0xe751('0x1a')],'include':_0x4d072a[_0xe751('0x1d')]?_['map'](_0x4d072a[_0xe751('0x1d')],function(_0xcfe7d9){return{'model':db[_0xcfe7d9[_0xe751('0x1e')]],'as':_0xcfe7d9['as'],'attributes':_0xcfe7d9[_0xe751('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe751('0x1f')](function(_0x1af93a){logger['info'](_0xe751('0x15'),_0x15be2a);logger[_0xe751('0xc')]('GetDynamics365Account',_0x15be2a,JSON['stringify'](_0x1af93a));_0x57258f(_0x1af93a);})['catch'](function(_0x2e54b0){logger[_0xe751('0x10')](_0xe751('0x15'),_0x2e54b0['message'],_0x15be2a);_0x24a9c7(_0x1a0e1b[_0xe751('0x10')](0x1f4,_0x2e54b0[_0xe751('0x12')]));});});};exports[_0xe751('0x20')]=function(_0xe62eba){var _0x14f90e=this;return new Promise(function(_0x10de29,_0x49678f){return db['Dynamics365Account'][_0xe751('0x21')]({'raw':_0xe62eba['options']?_0xe62eba['options'][_0xe751('0x22')]===undefined?!![]:![]:!![],'where':_0xe62eba[_0xe751('0x18')]?_0xe62eba[_0xe751('0x18')][_0xe751('0x19')]||null:null,'attributes':_0xe62eba[_0xe751('0x18')]?_0xe62eba['options'][_0xe751('0x1a')]||null:null,'include':_0xe62eba['options']?_0xe62eba['options']['include']?_[_0xe751('0x1c')](_0xe62eba[_0xe751('0x18')][_0xe751('0x1d')],function(_0x5dc03b){return{'model':db[_0x5dc03b[_0xe751('0x1e')]],'as':_0x5dc03b['as'],'attributes':_0x5dc03b[_0xe751('0x1a')],'include':_0x5dc03b['include']?_[_0xe751('0x1c')](_0x5dc03b[_0xe751('0x1d')],function(_0x7b93b2){return{'model':db[_0x7b93b2[_0xe751('0x1e')]],'as':_0x7b93b2['as'],'attributes':_0x7b93b2[_0xe751('0x1a')],'include':_0x7b93b2[_0xe751('0x1d')]?_[_0xe751('0x1c')](_0x7b93b2[_0xe751('0x1d')],function(_0x2c95e6){return{'model':db[_0x2c95e6[_0xe751('0x1e')]],'as':_0x2c95e6['as'],'attributes':_0x2c95e6['attributes']};}):[]};}):[]};}):[]:[]})[_0xe751('0x1f')](function(_0xc7904b){logger[_0xe751('0x23')](_0xe751('0x20'),_0xe62eba);logger[_0xe751('0xc')](_0xe751('0x20'),_0xe62eba,JSON[_0xe751('0xf')](_0xc7904b));_0x10de29(_0xc7904b);})[_0xe751('0x14')](function(_0x536d4f){logger[_0xe751('0x10')](_0xe751('0x20'),_0x536d4f['message'],_0xe62eba);_0x49678f(_0x14f90e[_0xe751('0x10')](0x1f4,_0x536d4f[_0xe751('0x12')]));});});}; \ No newline at end of file +var _0x7881=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','find','util','moment','bluebird'];(function(_0x257d84,_0x8eaaea){var _0x3d1ba2=function(_0x349119){while(--_0x349119){_0x257d84['push'](_0x257d84['shift']());}};_0x3d1ba2(++_0x8eaaea);}(_0x7881,0xac));var _0x1788=function(_0x514cd7,_0x5930dc){_0x514cd7=_0x514cd7-0x0;var _0x5f0978=_0x7881[_0x514cd7];return _0x5f0978;};'use strict';var _=require('lodash');var util=require(_0x1788('0x0'));var moment=require(_0x1788('0x1'));var BPromise=require(_0x1788('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1788('0x3'));var db=require(_0x1788('0x4'))['db'];var utils=require(_0x1788('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1788('0x6'));var jayson=require(_0x1788('0x7'));var client=jayson[_0x1788('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eaac7,_0xb40f22,_0x16bcbb){return new BPromise(function(_0x52cff8,_0x5221b8){return client[_0x1788('0x9')](_0x5eaac7,_0x16bcbb)[_0x1788('0xa')](function(_0x14c132){logger[_0x1788('0xb')](_0x1788('0xc'),_0xb40f22,_0x1788('0xd'));logger[_0x1788('0xe')](_0x1788('0xf'),_0xb40f22,_0x1788('0xd'),JSON[_0x1788('0x10')](_0x14c132));if(_0x14c132[_0x1788('0x11')]){if(_0x14c132[_0x1788('0x11')][_0x1788('0x12')]===0x1f4){logger[_0x1788('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0xb40f22,_0x14c132[_0x1788('0x11')][_0x1788('0x13')]);return _0x5221b8(_0x14c132['error'][_0x1788('0x13')]);}logger[_0x1788('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0xb40f22,_0x14c132[_0x1788('0x11')][_0x1788('0x13')]);return _0x52cff8(_0x14c132[_0x1788('0x11')][_0x1788('0x13')]);}else{logger[_0x1788('0xb')](_0x1788('0xc'),_0xb40f22,'request\x20sent');_0x52cff8(_0x14c132[_0x1788('0x14')][_0x1788('0x13')]);}})[_0x1788('0x15')](function(_0x4f660c){logger[_0x1788('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0xb40f22,_0x4f660c);_0x5221b8(_0x4f660c);});});}exports[_0x1788('0x16')]=function(_0x276bbd){var _0x33760c=this;return new Promise(function(_0x93a6e7,_0x306131){return db[_0x1788('0x17')][_0x1788('0x18')]({'raw':_0x276bbd[_0x1788('0x19')]?_0x276bbd[_0x1788('0x19')][_0x1788('0x1a')]===undefined?!![]:![]:!![],'where':_0x276bbd[_0x1788('0x19')]?_0x276bbd[_0x1788('0x19')][_0x1788('0x1b')]||null:null,'attributes':_0x276bbd[_0x1788('0x19')]?_0x276bbd['options'][_0x1788('0x1c')]||null:null,'limit':_0x276bbd[_0x1788('0x19')]?_0x276bbd[_0x1788('0x19')][_0x1788('0x1d')]||null:null,'include':_0x276bbd[_0x1788('0x19')]?_0x276bbd[_0x1788('0x19')][_0x1788('0x1e')]?_[_0x1788('0x1f')](_0x276bbd[_0x1788('0x19')][_0x1788('0x1e')],function(_0x5c53c7){return{'model':db[_0x5c53c7[_0x1788('0x20')]],'as':_0x5c53c7['as'],'attributes':_0x5c53c7[_0x1788('0x1c')],'include':_0x5c53c7[_0x1788('0x1e')]?_['map'](_0x5c53c7[_0x1788('0x1e')],function(_0x180500){return{'model':db[_0x180500[_0x1788('0x20')]],'as':_0x180500['as'],'attributes':_0x180500[_0x1788('0x1c')],'include':_0x180500[_0x1788('0x1e')]?_[_0x1788('0x1f')](_0x180500['include'],function(_0x1f2144){return{'model':db[_0x1f2144[_0x1788('0x20')]],'as':_0x1f2144['as'],'attributes':_0x1f2144[_0x1788('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d48ec){logger['info'](_0x1788('0x16'),_0x276bbd);logger[_0x1788('0xe')](_0x1788('0x16'),_0x276bbd,JSON[_0x1788('0x10')](_0x1d48ec));_0x93a6e7(_0x1d48ec);})[_0x1788('0x15')](function(_0x452e73){logger[_0x1788('0x11')](_0x1788('0x16'),_0x452e73['message'],_0x276bbd);_0x306131(_0x33760c['error'](0x1f4,_0x452e73['message']));});});};exports[_0x1788('0x21')]=function(_0x5e114c){var _0x2d1cd8=this;return new Promise(function(_0x524d8d,_0x169e76){return db[_0x1788('0x17')][_0x1788('0x22')]({'raw':_0x5e114c[_0x1788('0x19')]?_0x5e114c['options'][_0x1788('0x1a')]===undefined?!![]:![]:!![],'where':_0x5e114c[_0x1788('0x19')]?_0x5e114c[_0x1788('0x19')][_0x1788('0x1b')]||null:null,'attributes':_0x5e114c['options']?_0x5e114c['options']['attributes']||null:null,'include':_0x5e114c['options']?_0x5e114c[_0x1788('0x19')][_0x1788('0x1e')]?_['map'](_0x5e114c[_0x1788('0x19')][_0x1788('0x1e')],function(_0x2cf2bb){return{'model':db[_0x2cf2bb[_0x1788('0x20')]],'as':_0x2cf2bb['as'],'attributes':_0x2cf2bb[_0x1788('0x1c')],'include':_0x2cf2bb[_0x1788('0x1e')]?_[_0x1788('0x1f')](_0x2cf2bb['include'],function(_0x2b124d){return{'model':db[_0x2b124d[_0x1788('0x20')]],'as':_0x2b124d['as'],'attributes':_0x2b124d[_0x1788('0x1c')],'include':_0x2b124d[_0x1788('0x1e')]?_[_0x1788('0x1f')](_0x2b124d[_0x1788('0x1e')],function(_0x2d853e){return{'model':db[_0x2d853e[_0x1788('0x20')]],'as':_0x2d853e['as'],'attributes':_0x2d853e[_0x1788('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1788('0xa')](function(_0x1311b0){logger[_0x1788('0xb')]('ShowDynamics365Account',_0x5e114c);logger['debug'](_0x1788('0x21'),_0x5e114c,JSON[_0x1788('0x10')](_0x1311b0));_0x524d8d(_0x1311b0);})[_0x1788('0x15')](function(_0x49c559){logger[_0x1788('0x11')](_0x1788('0x21'),_0x49c559[_0x1788('0x13')],_0x5e114c);_0x169e76(_0x2d1cd8['error'](0x1f4,_0x49c559[_0x1788('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index ce36597..88bee4a 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 _0xe469=['/:id/descriptions','post','create','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields','getFields'];(function(_0x51a67e,_0x16525f){var _0x461dee=function(_0x3cc3c4){while(--_0x3cc3c4){_0x51a67e['push'](_0x51a67e['shift']());}};_0x461dee(++_0x16525f);}(_0xe469,0xef));var _0x9e46=function(_0x5da440,_0x50fe36){_0x5da440=_0x5da440-0x0;var _0x231f3b=_0xe469[_0x5da440];return _0x231f3b;};'use strict';var multer=require(_0x9e46('0x0'));var util=require(_0x9e46('0x1'));var path=require(_0x9e46('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9e46('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9e46('0x4'));var config=require(_0x9e46('0x5'));var controller=require(_0x9e46('0x6'));router[_0x9e46('0x7')]('/',auth[_0x9e46('0x8')](),controller[_0x9e46('0x9')]);router[_0x9e46('0x7')]('/:id',auth[_0x9e46('0x8')](),controller[_0x9e46('0xa')]);router[_0x9e46('0x7')](_0x9e46('0xb'),auth[_0x9e46('0x8')](),controller[_0x9e46('0xc')]);router[_0x9e46('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x9e46('0x7')](_0x9e46('0xd'),auth[_0x9e46('0x8')](),controller['getDescriptions']);router[_0x9e46('0xe')]('/',auth[_0x9e46('0x8')](),controller[_0x9e46('0xf')]);router[_0x9e46('0x10')](_0x9e46('0x11'),auth['isAuthenticated'](),controller[_0x9e46('0x12')]);router['delete']('/:id',auth[_0x9e46('0x8')](),controller[_0x9e46('0x13')]);module[_0x9e46('0x14')]=router; \ No newline at end of file +var _0x1fda=['destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','put','/:id','update'];(function(_0x36b3e5,_0x45d630){var _0x5bad3b=function(_0x3270e1){while(--_0x3270e1){_0x36b3e5['push'](_0x36b3e5['shift']());}};_0x5bad3b(++_0x45d630);}(_0x1fda,0x74));var _0xa1fd=function(_0x37f27b,_0x4fe436){_0x37f27b=_0x37f27b-0x0;var _0x28fb45=_0x1fda[_0x37f27b];return _0x28fb45;};'use strict';var multer=require(_0xa1fd('0x0'));var util=require(_0xa1fd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa1fd('0x2'));var router=express['Router']();var fs_extra=require(_0xa1fd('0x3'));var auth=require(_0xa1fd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa1fd('0x5'));var controller=require(_0xa1fd('0x6'));router[_0xa1fd('0x7')]('/',auth[_0xa1fd('0x8')](),controller['index']);router[_0xa1fd('0x7')]('/:id',auth[_0xa1fd('0x8')](),controller[_0xa1fd('0x9')]);router[_0xa1fd('0x7')](_0xa1fd('0xa'),auth['isAuthenticated'](),controller['getFields']);router['get']('/:id/subjects',auth[_0xa1fd('0x8')](),controller[_0xa1fd('0xb')]);router['get'](_0xa1fd('0xc'),auth[_0xa1fd('0x8')](),controller[_0xa1fd('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa1fd('0xe')](_0xa1fd('0xf'),auth['isAuthenticated'](),controller[_0xa1fd('0x10')]);router['delete']('/:id',auth[_0xa1fd('0x8')](),controller[_0xa1fd('0x11')]);module[_0xa1fd('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index ca360cb..8103a6d 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 _0x1b1d=['STRING','incident','phonecall','sequelize','exports'];(function(_0x2cf56e,_0x323161){var _0x1044e7=function(_0x2abfd4){while(--_0x2abfd4){_0x2cf56e['push'](_0x2cf56e['shift']());}};_0x1044e7(++_0x323161);}(_0x1b1d,0xe9));var _0xd1b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b1d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd1b1('0x0'));module[_0xd1b1('0x1')]={'name':{'type':Sequelize[_0xd1b1('0x2')]},'description':{'type':Sequelize[_0xd1b1('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xd1b1('0x3'),_0xd1b1('0x4')),'defaultValue':_0xd1b1('0x3')}}; \ No newline at end of file +var _0xab04=['STRING','ENUM','phonecall','sequelize','exports'];(function(_0x514f19,_0x5d9b97){var _0x3706e1=function(_0x2ed7a3){while(--_0x2ed7a3){_0x514f19['push'](_0x514f19['shift']());}};_0x3706e1(++_0x5d9b97);}(_0xab04,0x17a));var _0x4ab0=function(_0x1e4dca,_0x44147a){_0x1e4dca=_0x1e4dca-0x0;var _0x355ca9=_0xab04[_0x1e4dca];return _0x355ca9;};'use strict';var Sequelize=require(_0x4ab0('0x0'));module[_0x4ab0('0x1')]={'name':{'type':Sequelize[_0x4ab0('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x4ab0('0x3')]('incident',_0x4ab0('0x4')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index e7c3475..4271970 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 _0xdbf3=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','findOne','getFields','Dynamics365Field','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x34a38d,_0x5af692){var _0x268aac=function(_0x3ea46b){while(--_0x3ea46b){_0x34a38d['push'](_0x34a38d['shift']());}};_0x268aac(++_0x5af692);}(_0xdbf3,0xe7));var _0x3dbf=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xdbf3[_0x725b8e];return _0x43ac45;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3dbf('0x1'));var rp=require(_0x3dbf('0x2'));var moment=require(_0x3dbf('0x3'));var BPromise=require(_0x3dbf('0x4'));var Mustache=require(_0x3dbf('0x5'));var util=require(_0x3dbf('0x6'));var path=require('path');var sox=require(_0x3dbf('0x7'));var csv=require(_0x3dbf('0x8'));var ejs=require(_0x3dbf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3dbf('0xa'));var squel=require(_0x3dbf('0xb'));var crypto=require(_0x3dbf('0xc'));var jsforce=require(_0x3dbf('0xd'));var deskjs=require(_0x3dbf('0xe'));var toCsv=require(_0x3dbf('0x8'));var querystring=require(_0x3dbf('0xf'));var Papa=require(_0x3dbf('0x10'));var Redis=require('ioredis');var authService=require(_0x3dbf('0x11'));var qs=require(_0x3dbf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3dbf('0x13'));var logger=require(_0x3dbf('0x14'))(_0x3dbf('0x15'));var utils=require(_0x3dbf('0x16'));var config=require(_0x3dbf('0x17'));var licenseUtil=require(_0x3dbf('0x18'));var db=require(_0x3dbf('0x19'))['db'];function respondWithStatusCode(_0x4fe40,_0x46cd7c){_0x46cd7c=_0x46cd7c||0xcc;return function(_0x11d9a9){if(_0x11d9a9){return _0x4fe40['sendStatus'](_0x46cd7c);}return _0x4fe40[_0x3dbf('0x1a')](_0x46cd7c)[_0x3dbf('0x1b')]();};}function respondWithResult(_0x346c1c,_0x209c1f){_0x209c1f=_0x209c1f||0xc8;return function(_0x9de75a){if(_0x9de75a){return _0x346c1c['status'](_0x209c1f)[_0x3dbf('0x1c')](_0x9de75a);}};}function respondWithFilteredResult(_0x148fb8,_0x1fbb7e){return function(_0x514fd1){if(_0x514fd1){var _0x2550f2=typeof _0x1fbb7e[_0x3dbf('0x1d')]===_0x3dbf('0x1e')&&typeof _0x1fbb7e['limit']==='undefined';var _0x532cca=_0x514fd1[_0x3dbf('0x1f')];var _0x5eefd2=_0x2550f2?0x0:_0x1fbb7e['offset'];var _0x456210=_0x2550f2?_0x514fd1[_0x3dbf('0x1f')]:_0x1fbb7e[_0x3dbf('0x1d')]+_0x1fbb7e[_0x3dbf('0x20')];var _0x485af9;if(_0x456210>=_0x532cca){_0x456210=_0x532cca;_0x485af9=0xc8;}else{_0x485af9=0xce;}_0x148fb8[_0x3dbf('0x1a')](_0x485af9);return _0x148fb8[_0x3dbf('0x21')](_0x3dbf('0x22'),_0x5eefd2+'-'+_0x456210+'/'+_0x532cca)['json'](_0x514fd1);}return null;};}function patchUpdates(_0xe7f313){return function(_0x14743a){try{jsonpatch['apply'](_0x14743a,_0xe7f313,!![]);}catch(_0x3a6cc3){return BPromise['reject'](_0x3a6cc3);}return _0x14743a['save']();};}function saveUpdates(_0x558a47,_0x5764c4){return function(_0x37ef2e){if(_0x37ef2e){return _0x37ef2e['update'](_0x558a47)[_0x3dbf('0x23')](function(_0x38822e){return _0x38822e;});}return null;};}function removeEntity(_0x46e2c8,_0x207752){return function(_0x89758b){if(_0x89758b){return _0x89758b[_0x3dbf('0x24')]()[_0x3dbf('0x23')](function(){_0x46e2c8[_0x3dbf('0x1a')](0xcc)[_0x3dbf('0x1b')]();});}};}function handleEntityNotFound(_0x479299,_0x5eed32){return function(_0x5106f2){if(!_0x5106f2){_0x479299['sendStatus'](0x194);}return _0x5106f2;};}function handleError(_0x2c59b6,_0x2d13aa){_0x2d13aa=_0x2d13aa||0x1f4;return function(_0x1a94bb){logger[_0x3dbf('0x25')](_0x1a94bb[_0x3dbf('0x26')]);if(_0x1a94bb[_0x3dbf('0x27')]){delete _0x1a94bb[_0x3dbf('0x27')];}_0x2c59b6[_0x3dbf('0x1a')](_0x2d13aa)[_0x3dbf('0x28')](_0x1a94bb);};}exports[_0x3dbf('0x29')]=function(_0x598039,_0x12c1b5){var _0x1bf3a2={},_0x1387f0={},_0x3ed11a={'count':0x0,'rows':[]};var _0x4ceaba=_[_0x3dbf('0x2a')](db[_0x3dbf('0x2b')][_0x3dbf('0x2c')],function(_0xbd00e1){return{'name':_0xbd00e1['fieldName'],'type':_0xbd00e1[_0x3dbf('0x2d')][_0x3dbf('0x2e')]};});_0x1387f0[_0x3dbf('0x2f')]=_[_0x3dbf('0x2a')](_0x4ceaba,_0x3dbf('0x27'));_0x1387f0[_0x3dbf('0x30')]=_[_0x3dbf('0x31')](_0x598039['query']);_0x1387f0[_0x3dbf('0x32')]=_[_0x3dbf('0x33')](_0x1387f0['model'],_0x1387f0[_0x3dbf('0x30')]);_0x1bf3a2[_0x3dbf('0x34')]=_[_0x3dbf('0x33')](_0x1387f0[_0x3dbf('0x2f')],qs[_0x3dbf('0x35')](_0x598039[_0x3dbf('0x30')]['fields']));_0x1bf3a2[_0x3dbf('0x34')]=_0x1bf3a2[_0x3dbf('0x34')][_0x3dbf('0x36')]?_0x1bf3a2[_0x3dbf('0x34')]:_0x1387f0[_0x3dbf('0x2f')];if(!_0x598039[_0x3dbf('0x30')][_0x3dbf('0x37')](_0x3dbf('0x38'))){_0x1bf3a2[_0x3dbf('0x20')]=qs[_0x3dbf('0x20')](_0x598039[_0x3dbf('0x30')][_0x3dbf('0x20')]);_0x1bf3a2[_0x3dbf('0x1d')]=qs[_0x3dbf('0x1d')](_0x598039[_0x3dbf('0x30')][_0x3dbf('0x1d')]);}_0x1bf3a2[_0x3dbf('0x39')]=qs[_0x3dbf('0x3a')](_0x598039[_0x3dbf('0x30')][_0x3dbf('0x3a')]);_0x1bf3a2[_0x3dbf('0x3b')]=qs[_0x3dbf('0x32')](_[_0x3dbf('0x3c')](_0x598039[_0x3dbf('0x30')],_0x1387f0['filters']),_0x4ceaba);if(_0x598039[_0x3dbf('0x30')]['filter']){_0x1bf3a2[_0x3dbf('0x3b')]=_[_0x3dbf('0x3d')](_0x1bf3a2[_0x3dbf('0x3b')],{'$or':_[_0x3dbf('0x2a')](_0x4ceaba,function(_0x2d919e){if(_0x2d919e['type']!=='VIRTUAL'){var _0x22e4e0={};_0x22e4e0[_0x2d919e[_0x3dbf('0x27')]]={'$like':'%'+_0x598039[_0x3dbf('0x30')][_0x3dbf('0x3e')]+'%'};return _0x22e4e0;}})});}_0x1bf3a2=_[_0x3dbf('0x3d')]({},_0x1bf3a2,_0x598039[_0x3dbf('0x3f')]);var _0x1ed691={'where':_0x1bf3a2[_0x3dbf('0x3b')]};return db[_0x3dbf('0x2b')][_0x3dbf('0x1f')](_0x1ed691)['then'](function(_0x1e0c61){_0x3ed11a[_0x3dbf('0x1f')]=_0x1e0c61;if(_0x598039[_0x3dbf('0x30')][_0x3dbf('0x40')]){_0x1bf3a2[_0x3dbf('0x41')]=[{'all':!![]}];}return db[_0x3dbf('0x2b')][_0x3dbf('0x42')](_0x1bf3a2);})[_0x3dbf('0x23')](function(_0x39f8ff){_0x3ed11a[_0x3dbf('0x43')]=_0x39f8ff;return _0x3ed11a;})[_0x3dbf('0x23')](respondWithFilteredResult(_0x12c1b5,_0x1bf3a2))[_0x3dbf('0x44')](handleError(_0x12c1b5,null));};exports[_0x3dbf('0x45')]=function(_0x5b5674,_0x2876e0){var _0x689fa2={'raw':![],'where':{'id':_0x5b5674[_0x3dbf('0x46')]['id']}},_0xc5b5eb={};_0xc5b5eb[_0x3dbf('0x2f')]=_[_0x3dbf('0x31')](db['Dynamics365Configuration']['rawAttributes']);_0xc5b5eb[_0x3dbf('0x30')]=_[_0x3dbf('0x31')](_0x5b5674[_0x3dbf('0x30')]);_0xc5b5eb[_0x3dbf('0x32')]=_[_0x3dbf('0x33')](_0xc5b5eb['model'],_0xc5b5eb[_0x3dbf('0x30')]);_0x689fa2[_0x3dbf('0x34')]=_[_0x3dbf('0x33')](_0xc5b5eb[_0x3dbf('0x2f')],qs[_0x3dbf('0x35')](_0x5b5674[_0x3dbf('0x30')][_0x3dbf('0x35')]));_0x689fa2[_0x3dbf('0x34')]=_0x689fa2[_0x3dbf('0x34')]['length']?_0x689fa2['attributes']:_0xc5b5eb[_0x3dbf('0x2f')];if(_0x5b5674[_0x3dbf('0x30')][_0x3dbf('0x40')]){_0x689fa2[_0x3dbf('0x41')]=[{'all':!![]}];}_0x689fa2=_['merge']({},_0x689fa2,_0x5b5674[_0x3dbf('0x3f')]);return db[_0x3dbf('0x2b')]['find'](_0x689fa2)[_0x3dbf('0x23')](handleEntityNotFound(_0x2876e0,null))[_0x3dbf('0x23')](respondWithResult(_0x2876e0,null))[_0x3dbf('0x44')](handleError(_0x2876e0,null));};exports[_0x3dbf('0x47')]=function(_0x57b821,_0x3b5e9f){return db[_0x3dbf('0x2b')][_0x3dbf('0x47')](_0x57b821[_0x3dbf('0x48')],{})['then'](respondWithResult(_0x3b5e9f,0xc9))[_0x3dbf('0x44')](handleError(_0x3b5e9f,null));};exports[_0x3dbf('0x49')]=function(_0x1e3473,_0x8c4bd6){if(_0x1e3473[_0x3dbf('0x48')]['id']){delete _0x1e3473[_0x3dbf('0x48')]['id'];}return db[_0x3dbf('0x2b')][_0x3dbf('0x4a')]({'where':{'id':_0x1e3473[_0x3dbf('0x46')]['id']}})[_0x3dbf('0x23')](handleEntityNotFound(_0x8c4bd6,null))['then'](saveUpdates(_0x1e3473[_0x3dbf('0x48')],null))['then'](respondWithResult(_0x8c4bd6,null))[_0x3dbf('0x44')](handleError(_0x8c4bd6,null));};exports[_0x3dbf('0x24')]=function(_0x2f103b,_0x1e707e){return db[_0x3dbf('0x2b')]['find']({'where':{'id':_0x2f103b[_0x3dbf('0x46')]['id']}})[_0x3dbf('0x23')](handleEntityNotFound(_0x1e707e,null))[_0x3dbf('0x23')](removeEntity(_0x1e707e,null))['catch'](handleError(_0x1e707e,null));};exports['getFields']=function(_0x2052e4,_0x3bfcb2,_0x58dc90){var _0xf2ec1d={};var _0x36ea35={};var _0x370aa6;var _0x68005;return db[_0x3dbf('0x2b')][_0x3dbf('0x4b')]({'where':{'id':_0x2052e4['params']['id']}})[_0x3dbf('0x23')](handleEntityNotFound(_0x3bfcb2,null))['then'](function(_0x5a340d){if(_0x5a340d){_0x370aa6=_0x5a340d;_0x36ea35['model']=_[_0x3dbf('0x31')](db['Dynamics365Field'][_0x3dbf('0x2c')]);_0x36ea35[_0x3dbf('0x30')]=_[_0x3dbf('0x31')](_0x2052e4[_0x3dbf('0x30')]);_0x36ea35[_0x3dbf('0x32')]=_[_0x3dbf('0x33')](_0x36ea35[_0x3dbf('0x2f')],_0x36ea35[_0x3dbf('0x30')]);_0xf2ec1d['attributes']=_['intersection'](_0x36ea35[_0x3dbf('0x2f')],qs['fields'](_0x2052e4[_0x3dbf('0x30')][_0x3dbf('0x35')]));_0xf2ec1d['attributes']=_0xf2ec1d['attributes'][_0x3dbf('0x36')]?_0xf2ec1d[_0x3dbf('0x34')]:_0x36ea35[_0x3dbf('0x2f')];_0xf2ec1d[_0x3dbf('0x39')]=qs[_0x3dbf('0x3a')](_0x2052e4[_0x3dbf('0x30')][_0x3dbf('0x3a')]);_0xf2ec1d[_0x3dbf('0x3b')]=qs['filters'](_[_0x3dbf('0x3c')](_0x2052e4[_0x3dbf('0x30')],_0x36ea35[_0x3dbf('0x32')]));if(_0x2052e4[_0x3dbf('0x30')][_0x3dbf('0x3e')]){_0xf2ec1d[_0x3dbf('0x3b')]=_[_0x3dbf('0x3d')](_0xf2ec1d[_0x3dbf('0x3b')],{'$or':_['map'](_0xf2ec1d[_0x3dbf('0x34')],function(_0x2336c8){var _0x3d574e={};_0x3d574e[_0x2336c8]={'$like':'%'+_0x2052e4[_0x3dbf('0x30')][_0x3dbf('0x3e')]+'%'};return _0x3d574e;})});}_0xf2ec1d=_[_0x3dbf('0x3d')]({},_0xf2ec1d,_0x2052e4['options']);return _0x370aa6[_0x3dbf('0x4c')](_0xf2ec1d);}})[_0x3dbf('0x23')](function(_0x321405){if(_0x321405){_0x68005=_0x321405[_0x3dbf('0x36')];if(!_0x2052e4[_0x3dbf('0x30')][_0x3dbf('0x37')](_0x3dbf('0x38'))){_0xf2ec1d[_0x3dbf('0x20')]=qs['limit'](_0x2052e4[_0x3dbf('0x30')][_0x3dbf('0x20')]);_0xf2ec1d['offset']=qs[_0x3dbf('0x1d')](_0x2052e4[_0x3dbf('0x30')][_0x3dbf('0x1d')]);}return _0x370aa6[_0x3dbf('0x4c')](_0xf2ec1d);}})[_0x3dbf('0x23')](function(_0x53345f){if(_0x53345f){return _0x53345f?{'count':_0x68005,'rows':_0x53345f}:null;}})[_0x3dbf('0x23')](respondWithResult(_0x3bfcb2,null))[_0x3dbf('0x44')](handleError(_0x3bfcb2,null));};exports['getSubjects']=function(_0x17d7c2,_0x38c8e0,_0x42171a){var _0x2fd319={};var _0x1c62d6={};var _0x28a5ee;var _0x1ec0b8;return db[_0x3dbf('0x2b')][_0x3dbf('0x4b')]({'where':{'id':_0x17d7c2[_0x3dbf('0x46')]['id']}})[_0x3dbf('0x23')](handleEntityNotFound(_0x38c8e0,null))[_0x3dbf('0x23')](function(_0x7275d2){if(_0x7275d2){_0x28a5ee=_0x7275d2;_0x1c62d6[_0x3dbf('0x2f')]=_[_0x3dbf('0x31')](db[_0x3dbf('0x4d')][_0x3dbf('0x2c')]);_0x1c62d6[_0x3dbf('0x30')]=_['keys'](_0x17d7c2['query']);_0x1c62d6[_0x3dbf('0x32')]=_['intersection'](_0x1c62d6[_0x3dbf('0x2f')],_0x1c62d6[_0x3dbf('0x30')]);_0x2fd319['attributes']=_[_0x3dbf('0x33')](_0x1c62d6[_0x3dbf('0x2f')],qs[_0x3dbf('0x35')](_0x17d7c2[_0x3dbf('0x30')][_0x3dbf('0x35')]));_0x2fd319[_0x3dbf('0x34')]=_0x2fd319[_0x3dbf('0x34')][_0x3dbf('0x36')]?_0x2fd319[_0x3dbf('0x34')]:_0x1c62d6[_0x3dbf('0x2f')];_0x2fd319[_0x3dbf('0x39')]=qs['sort'](_0x17d7c2[_0x3dbf('0x30')][_0x3dbf('0x3a')]);_0x2fd319['where']=qs[_0x3dbf('0x32')](_[_0x3dbf('0x3c')](_0x17d7c2[_0x3dbf('0x30')],_0x1c62d6[_0x3dbf('0x32')]));if(_0x17d7c2[_0x3dbf('0x30')][_0x3dbf('0x3e')]){_0x2fd319[_0x3dbf('0x3b')]=_['merge'](_0x2fd319[_0x3dbf('0x3b')],{'$or':_[_0x3dbf('0x2a')](_0x2fd319[_0x3dbf('0x34')],function(_0xe0532){var _0x23f52d={};_0x23f52d[_0xe0532]={'$like':'%'+_0x17d7c2[_0x3dbf('0x30')][_0x3dbf('0x3e')]+'%'};return _0x23f52d;})});}_0x2fd319=_[_0x3dbf('0x3d')]({},_0x2fd319,_0x17d7c2[_0x3dbf('0x3f')]);return _0x28a5ee[_0x3dbf('0x4e')](_0x2fd319);}})[_0x3dbf('0x23')](function(_0x5ca0bc){if(_0x5ca0bc){_0x1ec0b8=_0x5ca0bc[_0x3dbf('0x36')];if(!_0x17d7c2[_0x3dbf('0x30')][_0x3dbf('0x37')](_0x3dbf('0x38'))){_0x2fd319[_0x3dbf('0x20')]=qs['limit'](_0x17d7c2[_0x3dbf('0x30')][_0x3dbf('0x20')]);_0x2fd319[_0x3dbf('0x1d')]=qs[_0x3dbf('0x1d')](_0x17d7c2[_0x3dbf('0x30')][_0x3dbf('0x1d')]);}return _0x28a5ee[_0x3dbf('0x4e')](_0x2fd319);}})[_0x3dbf('0x23')](function(_0x5a8daf){if(_0x5a8daf){return _0x5a8daf?{'count':_0x1ec0b8,'rows':_0x5a8daf}:null;}})[_0x3dbf('0x23')](respondWithResult(_0x38c8e0,null))['catch'](handleError(_0x38c8e0,null));};exports['getDescriptions']=function(_0x1311c4,_0x4072a3,_0x5ef126){var _0x59f8aa={};var _0x314e39={};var _0x58ce73;var _0x276fb8;return db[_0x3dbf('0x2b')]['findOne']({'where':{'id':_0x1311c4[_0x3dbf('0x46')]['id']}})[_0x3dbf('0x23')](handleEntityNotFound(_0x4072a3,null))[_0x3dbf('0x23')](function(_0x51e6e8){if(_0x51e6e8){_0x58ce73=_0x51e6e8;_0x314e39[_0x3dbf('0x2f')]=_[_0x3dbf('0x31')](db[_0x3dbf('0x4d')][_0x3dbf('0x2c')]);_0x314e39[_0x3dbf('0x30')]=_['keys'](_0x1311c4['query']);_0x314e39[_0x3dbf('0x32')]=_['intersection'](_0x314e39[_0x3dbf('0x2f')],_0x314e39['query']);_0x59f8aa['attributes']=_[_0x3dbf('0x33')](_0x314e39[_0x3dbf('0x2f')],qs[_0x3dbf('0x35')](_0x1311c4[_0x3dbf('0x30')][_0x3dbf('0x35')]));_0x59f8aa[_0x3dbf('0x34')]=_0x59f8aa[_0x3dbf('0x34')][_0x3dbf('0x36')]?_0x59f8aa[_0x3dbf('0x34')]:_0x314e39[_0x3dbf('0x2f')];_0x59f8aa[_0x3dbf('0x39')]=qs['sort'](_0x1311c4[_0x3dbf('0x30')][_0x3dbf('0x3a')]);_0x59f8aa[_0x3dbf('0x3b')]=qs['filters'](_[_0x3dbf('0x3c')](_0x1311c4[_0x3dbf('0x30')],_0x314e39[_0x3dbf('0x32')]));if(_0x1311c4[_0x3dbf('0x30')][_0x3dbf('0x3e')]){_0x59f8aa['where']=_[_0x3dbf('0x3d')](_0x59f8aa['where'],{'$or':_[_0x3dbf('0x2a')](_0x59f8aa['attributes'],function(_0x31b2c6){var _0x4649df={};_0x4649df[_0x31b2c6]={'$like':'%'+_0x1311c4['query']['filter']+'%'};return _0x4649df;})});}_0x59f8aa=_[_0x3dbf('0x3d')]({},_0x59f8aa,_0x1311c4['options']);return _0x58ce73['getDescriptions'](_0x59f8aa);}})[_0x3dbf('0x23')](function(_0x16db9c){if(_0x16db9c){_0x276fb8=_0x16db9c['length'];if(!_0x1311c4[_0x3dbf('0x30')][_0x3dbf('0x37')](_0x3dbf('0x38'))){_0x59f8aa['limit']=qs[_0x3dbf('0x20')](_0x1311c4[_0x3dbf('0x30')]['limit']);_0x59f8aa[_0x3dbf('0x1d')]=qs[_0x3dbf('0x1d')](_0x1311c4[_0x3dbf('0x30')]['offset']);}return _0x58ce73[_0x3dbf('0x4f')](_0x59f8aa);}})[_0x3dbf('0x23')](function(_0x40595f){if(_0x40595f){return _0x40595f?{'count':_0x276fb8,'rows':_0x40595f}:null;}})[_0x3dbf('0x23')](respondWithResult(_0x4072a3,null))[_0x3dbf('0x44')](handleError(_0x4072a3,null));}; \ No newline at end of file +var _0xb241=['body','getFields','findOne','Dynamics365Field','length','nolimit','getSubjects','getDescriptions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','reject','then','destroy','end','name','index','Dynamics365Configuration','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','order','sort','where','pick','filter','merge','map','type','includeAll','include','findAll','catch','show','params','fields','options','find','create'];(function(_0x3b9cdd,_0x5d2313){var _0x28051d=function(_0x342633){while(--_0x342633){_0x3b9cdd['push'](_0x3b9cdd['shift']());}};_0x28051d(++_0x5d2313);}(_0xb241,0xa5));var _0x1b24=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xb241[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x1b24('0x0'));var rimraf=require(_0x1b24('0x1'));var zipdir=require(_0x1b24('0x2'));var jsonpatch=require(_0x1b24('0x3'));var rp=require(_0x1b24('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b24('0x5'));var util=require('util');var path=require(_0x1b24('0x6'));var sox=require(_0x1b24('0x7'));var csv=require(_0x1b24('0x8'));var ejs=require(_0x1b24('0x9'));var fs=require('fs');var fs_extra=require(_0x1b24('0xa'));var _=require(_0x1b24('0xb'));var squel=require(_0x1b24('0xc'));var crypto=require(_0x1b24('0xd'));var jsforce=require(_0x1b24('0xe'));var deskjs=require(_0x1b24('0xf'));var toCsv=require(_0x1b24('0x8'));var querystring=require(_0x1b24('0x10'));var Papa=require(_0x1b24('0x11'));var Redis=require('ioredis');var authService=require(_0x1b24('0x12'));var qs=require(_0x1b24('0x13'));var as=require(_0x1b24('0x14'));var hardwareService=require(_0x1b24('0x15'));var logger=require(_0x1b24('0x16'))(_0x1b24('0x17'));var utils=require(_0x1b24('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1b24('0x19'));var db=require(_0x1b24('0x1a'))['db'];function respondWithStatusCode(_0x25f5d4,_0x349d5c){_0x349d5c=_0x349d5c||0xcc;return function(_0x4e6234){if(_0x4e6234){return _0x25f5d4[_0x1b24('0x1b')](_0x349d5c);}return _0x25f5d4[_0x1b24('0x1c')](_0x349d5c)['end']();};}function respondWithResult(_0x162ef6,_0x30ceb7){_0x30ceb7=_0x30ceb7||0xc8;return function(_0x2239ae){if(_0x2239ae){return _0x162ef6['status'](_0x30ceb7)[_0x1b24('0x1d')](_0x2239ae);}};}function respondWithFilteredResult(_0x15fd6b,_0x169811){return function(_0x57f3d6){if(_0x57f3d6){var _0x195773=typeof _0x169811['offset']===_0x1b24('0x1e')&&typeof _0x169811[_0x1b24('0x1f')]==='undefined';var _0x42d05c=_0x57f3d6['count'];var _0x185550=_0x195773?0x0:_0x169811[_0x1b24('0x20')];var _0xb048dc=_0x195773?_0x57f3d6[_0x1b24('0x21')]:_0x169811[_0x1b24('0x20')]+_0x169811[_0x1b24('0x1f')];var _0x34f5b3;if(_0xb048dc>=_0x42d05c){_0xb048dc=_0x42d05c;_0x34f5b3=0xc8;}else{_0x34f5b3=0xce;}_0x15fd6b['status'](_0x34f5b3);return _0x15fd6b['set'](_0x1b24('0x22'),_0x185550+'-'+_0xb048dc+'/'+_0x42d05c)[_0x1b24('0x1d')](_0x57f3d6);}return null;};}function patchUpdates(_0xe82af3){return function(_0x125bfc){try{jsonpatch[_0x1b24('0x23')](_0x125bfc,_0xe82af3,!![]);}catch(_0x3e0267){return BPromise[_0x1b24('0x24')](_0x3e0267);}return _0x125bfc['save']();};}function saveUpdates(_0x3dbd3e,_0x29b970){return function(_0x2798cd){if(_0x2798cd){return _0x2798cd['update'](_0x3dbd3e)[_0x1b24('0x25')](function(_0x1f92c7){return _0x1f92c7;});}return null;};}function removeEntity(_0x2b0f51,_0x18bc77){return function(_0x23b041){if(_0x23b041){return _0x23b041[_0x1b24('0x26')]()['then'](function(){_0x2b0f51[_0x1b24('0x1c')](0xcc)[_0x1b24('0x27')]();});}};}function handleEntityNotFound(_0x3c542b,_0x2f5826){return function(_0x3b0eb5){if(!_0x3b0eb5){_0x3c542b[_0x1b24('0x1b')](0x194);}return _0x3b0eb5;};}function handleError(_0x17d033,_0x50df9a){_0x50df9a=_0x50df9a||0x1f4;return function(_0x38965a){logger['error'](_0x38965a['stack']);if(_0x38965a[_0x1b24('0x28')]){delete _0x38965a['name'];}_0x17d033[_0x1b24('0x1c')](_0x50df9a)['send'](_0x38965a);};}exports[_0x1b24('0x29')]=function(_0x44ac97,_0x5745a4){var _0x51cb39={},_0x3256d8={},_0x38c30a={'count':0x0,'rows':[]};var _0x319416=_['map'](db[_0x1b24('0x2a')][_0x1b24('0x2b')],function(_0x59a7d8){return{'name':_0x59a7d8[_0x1b24('0x2c')],'type':_0x59a7d8['type']['key']};});_0x3256d8[_0x1b24('0x2d')]=_['map'](_0x319416,'name');_0x3256d8[_0x1b24('0x2e')]=_[_0x1b24('0x2f')](_0x44ac97[_0x1b24('0x2e')]);_0x3256d8[_0x1b24('0x30')]=_[_0x1b24('0x31')](_0x3256d8['model'],_0x3256d8[_0x1b24('0x2e')]);_0x51cb39[_0x1b24('0x32')]=_[_0x1b24('0x31')](_0x3256d8[_0x1b24('0x2d')],qs['fields'](_0x44ac97[_0x1b24('0x2e')]['fields']));_0x51cb39[_0x1b24('0x32')]=_0x51cb39[_0x1b24('0x32')]['length']?_0x51cb39[_0x1b24('0x32')]:_0x3256d8['model'];if(!_0x44ac97['query']['hasOwnProperty']('nolimit')){_0x51cb39[_0x1b24('0x1f')]=qs[_0x1b24('0x1f')](_0x44ac97['query'][_0x1b24('0x1f')]);_0x51cb39[_0x1b24('0x20')]=qs[_0x1b24('0x20')](_0x44ac97[_0x1b24('0x2e')]['offset']);}_0x51cb39[_0x1b24('0x33')]=qs[_0x1b24('0x34')](_0x44ac97[_0x1b24('0x2e')]['sort']);_0x51cb39[_0x1b24('0x35')]=qs[_0x1b24('0x30')](_[_0x1b24('0x36')](_0x44ac97[_0x1b24('0x2e')],_0x3256d8[_0x1b24('0x30')]),_0x319416);if(_0x44ac97[_0x1b24('0x2e')][_0x1b24('0x37')]){_0x51cb39[_0x1b24('0x35')]=_[_0x1b24('0x38')](_0x51cb39[_0x1b24('0x35')],{'$or':_[_0x1b24('0x39')](_0x319416,function(_0xb38b3){if(_0xb38b3[_0x1b24('0x3a')]!=='VIRTUAL'){var _0x3ae4dd={};_0x3ae4dd[_0xb38b3['name']]={'$like':'%'+_0x44ac97[_0x1b24('0x2e')][_0x1b24('0x37')]+'%'};return _0x3ae4dd;}})});}_0x51cb39=_[_0x1b24('0x38')]({},_0x51cb39,_0x44ac97['options']);var _0x1237c0={'where':_0x51cb39[_0x1b24('0x35')]};return db[_0x1b24('0x2a')][_0x1b24('0x21')](_0x1237c0)[_0x1b24('0x25')](function(_0x265f96){_0x38c30a['count']=_0x265f96;if(_0x44ac97['query'][_0x1b24('0x3b')]){_0x51cb39[_0x1b24('0x3c')]=[{'all':!![]}];}return db[_0x1b24('0x2a')][_0x1b24('0x3d')](_0x51cb39);})[_0x1b24('0x25')](function(_0x36abbe){_0x38c30a['rows']=_0x36abbe;return _0x38c30a;})[_0x1b24('0x25')](respondWithFilteredResult(_0x5745a4,_0x51cb39))[_0x1b24('0x3e')](handleError(_0x5745a4,null));};exports[_0x1b24('0x3f')]=function(_0x77a6d1,_0x37c97b){var _0x4c986c={'raw':![],'where':{'id':_0x77a6d1[_0x1b24('0x40')]['id']}},_0x3cd01f={};_0x3cd01f[_0x1b24('0x2d')]=_[_0x1b24('0x2f')](db['Dynamics365Configuration']['rawAttributes']);_0x3cd01f['query']=_[_0x1b24('0x2f')](_0x77a6d1[_0x1b24('0x2e')]);_0x3cd01f[_0x1b24('0x30')]=_[_0x1b24('0x31')](_0x3cd01f[_0x1b24('0x2d')],_0x3cd01f[_0x1b24('0x2e')]);_0x4c986c[_0x1b24('0x32')]=_[_0x1b24('0x31')](_0x3cd01f['model'],qs['fields'](_0x77a6d1['query'][_0x1b24('0x41')]));_0x4c986c[_0x1b24('0x32')]=_0x4c986c['attributes']['length']?_0x4c986c[_0x1b24('0x32')]:_0x3cd01f[_0x1b24('0x2d')];if(_0x77a6d1[_0x1b24('0x2e')][_0x1b24('0x3b')]){_0x4c986c['include']=[{'all':!![]}];}_0x4c986c=_['merge']({},_0x4c986c,_0x77a6d1[_0x1b24('0x42')]);return db[_0x1b24('0x2a')][_0x1b24('0x43')](_0x4c986c)[_0x1b24('0x25')](handleEntityNotFound(_0x37c97b,null))['then'](respondWithResult(_0x37c97b,null))[_0x1b24('0x3e')](handleError(_0x37c97b,null));};exports[_0x1b24('0x44')]=function(_0x12138b,_0x210d67){return db[_0x1b24('0x2a')]['create'](_0x12138b['body'],{})[_0x1b24('0x25')](respondWithResult(_0x210d67,0xc9))[_0x1b24('0x3e')](handleError(_0x210d67,null));};exports['update']=function(_0x296f44,_0x26984c){if(_0x296f44[_0x1b24('0x45')]['id']){delete _0x296f44[_0x1b24('0x45')]['id'];}return db['Dynamics365Configuration'][_0x1b24('0x43')]({'where':{'id':_0x296f44[_0x1b24('0x40')]['id']}})['then'](handleEntityNotFound(_0x26984c,null))[_0x1b24('0x25')](saveUpdates(_0x296f44[_0x1b24('0x45')],null))[_0x1b24('0x25')](respondWithResult(_0x26984c,null))['catch'](handleError(_0x26984c,null));};exports[_0x1b24('0x26')]=function(_0x16263b,_0x15cd00){return db['Dynamics365Configuration']['find']({'where':{'id':_0x16263b[_0x1b24('0x40')]['id']}})[_0x1b24('0x25')](handleEntityNotFound(_0x15cd00,null))[_0x1b24('0x25')](removeEntity(_0x15cd00,null))[_0x1b24('0x3e')](handleError(_0x15cd00,null));};exports[_0x1b24('0x46')]=function(_0x4c45ba,_0x54615e,_0x54bc8a){var _0x8e9317={};var _0x2a0834={};var _0x251cc1;var _0xede3c8;return db[_0x1b24('0x2a')][_0x1b24('0x47')]({'where':{'id':_0x4c45ba[_0x1b24('0x40')]['id']}})[_0x1b24('0x25')](handleEntityNotFound(_0x54615e,null))[_0x1b24('0x25')](function(_0x1ac173){if(_0x1ac173){_0x251cc1=_0x1ac173;_0x2a0834[_0x1b24('0x2d')]=_[_0x1b24('0x2f')](db[_0x1b24('0x48')]['rawAttributes']);_0x2a0834[_0x1b24('0x2e')]=_['keys'](_0x4c45ba[_0x1b24('0x2e')]);_0x2a0834[_0x1b24('0x30')]=_[_0x1b24('0x31')](_0x2a0834[_0x1b24('0x2d')],_0x2a0834[_0x1b24('0x2e')]);_0x8e9317[_0x1b24('0x32')]=_[_0x1b24('0x31')](_0x2a0834[_0x1b24('0x2d')],qs[_0x1b24('0x41')](_0x4c45ba[_0x1b24('0x2e')]['fields']));_0x8e9317[_0x1b24('0x32')]=_0x8e9317[_0x1b24('0x32')][_0x1b24('0x49')]?_0x8e9317[_0x1b24('0x32')]:_0x2a0834[_0x1b24('0x2d')];_0x8e9317[_0x1b24('0x33')]=qs[_0x1b24('0x34')](_0x4c45ba[_0x1b24('0x2e')][_0x1b24('0x34')]);_0x8e9317[_0x1b24('0x35')]=qs[_0x1b24('0x30')](_[_0x1b24('0x36')](_0x4c45ba[_0x1b24('0x2e')],_0x2a0834[_0x1b24('0x30')]));if(_0x4c45ba[_0x1b24('0x2e')][_0x1b24('0x37')]){_0x8e9317[_0x1b24('0x35')]=_[_0x1b24('0x38')](_0x8e9317['where'],{'$or':_[_0x1b24('0x39')](_0x8e9317['attributes'],function(_0x4e632b){var _0x2502d5={};_0x2502d5[_0x4e632b]={'$like':'%'+_0x4c45ba[_0x1b24('0x2e')]['filter']+'%'};return _0x2502d5;})});}_0x8e9317=_['merge']({},_0x8e9317,_0x4c45ba['options']);return _0x251cc1[_0x1b24('0x46')](_0x8e9317);}})[_0x1b24('0x25')](function(_0x166c77){if(_0x166c77){_0xede3c8=_0x166c77[_0x1b24('0x49')];if(!_0x4c45ba['query']['hasOwnProperty'](_0x1b24('0x4a'))){_0x8e9317[_0x1b24('0x1f')]=qs[_0x1b24('0x1f')](_0x4c45ba['query'][_0x1b24('0x1f')]);_0x8e9317[_0x1b24('0x20')]=qs[_0x1b24('0x20')](_0x4c45ba['query'][_0x1b24('0x20')]);}return _0x251cc1[_0x1b24('0x46')](_0x8e9317);}})['then'](function(_0x5b7b9d){if(_0x5b7b9d){return _0x5b7b9d?{'count':_0xede3c8,'rows':_0x5b7b9d}:null;}})[_0x1b24('0x25')](respondWithResult(_0x54615e,null))[_0x1b24('0x3e')](handleError(_0x54615e,null));};exports[_0x1b24('0x4b')]=function(_0x3fa0b1,_0x2dda20,_0x55a685){var _0x20f3ba={};var _0x5e44d8={};var _0x12bafc;var _0x2992c7;return db[_0x1b24('0x2a')]['findOne']({'where':{'id':_0x3fa0b1[_0x1b24('0x40')]['id']}})[_0x1b24('0x25')](handleEntityNotFound(_0x2dda20,null))[_0x1b24('0x25')](function(_0x1030e7){if(_0x1030e7){_0x12bafc=_0x1030e7;_0x5e44d8[_0x1b24('0x2d')]=_['keys'](db[_0x1b24('0x48')]['rawAttributes']);_0x5e44d8[_0x1b24('0x2e')]=_[_0x1b24('0x2f')](_0x3fa0b1[_0x1b24('0x2e')]);_0x5e44d8[_0x1b24('0x30')]=_[_0x1b24('0x31')](_0x5e44d8['model'],_0x5e44d8['query']);_0x20f3ba[_0x1b24('0x32')]=_[_0x1b24('0x31')](_0x5e44d8['model'],qs['fields'](_0x3fa0b1[_0x1b24('0x2e')][_0x1b24('0x41')]));_0x20f3ba['attributes']=_0x20f3ba['attributes'][_0x1b24('0x49')]?_0x20f3ba[_0x1b24('0x32')]:_0x5e44d8[_0x1b24('0x2d')];_0x20f3ba['order']=qs[_0x1b24('0x34')](_0x3fa0b1[_0x1b24('0x2e')]['sort']);_0x20f3ba['where']=qs[_0x1b24('0x30')](_['pick'](_0x3fa0b1[_0x1b24('0x2e')],_0x5e44d8[_0x1b24('0x30')]));if(_0x3fa0b1[_0x1b24('0x2e')][_0x1b24('0x37')]){_0x20f3ba[_0x1b24('0x35')]=_['merge'](_0x20f3ba[_0x1b24('0x35')],{'$or':_[_0x1b24('0x39')](_0x20f3ba['attributes'],function(_0x3c3cdd){var _0x3ebbbf={};_0x3ebbbf[_0x3c3cdd]={'$like':'%'+_0x3fa0b1[_0x1b24('0x2e')]['filter']+'%'};return _0x3ebbbf;})});}_0x20f3ba=_[_0x1b24('0x38')]({},_0x20f3ba,_0x3fa0b1[_0x1b24('0x42')]);return _0x12bafc[_0x1b24('0x4b')](_0x20f3ba);}})[_0x1b24('0x25')](function(_0x55bb6c){if(_0x55bb6c){_0x2992c7=_0x55bb6c['length'];if(!_0x3fa0b1['query']['hasOwnProperty'](_0x1b24('0x4a'))){_0x20f3ba['limit']=qs['limit'](_0x3fa0b1[_0x1b24('0x2e')][_0x1b24('0x1f')]);_0x20f3ba[_0x1b24('0x20')]=qs[_0x1b24('0x20')](_0x3fa0b1[_0x1b24('0x2e')]['offset']);}return _0x12bafc[_0x1b24('0x4b')](_0x20f3ba);}})[_0x1b24('0x25')](function(_0x5155cb){if(_0x5155cb){return _0x5155cb?{'count':_0x2992c7,'rows':_0x5155cb}:null;}})['then'](respondWithResult(_0x2dda20,null))[_0x1b24('0x3e')](handleError(_0x2dda20,null));};exports['getDescriptions']=function(_0x219b07,_0x40d2d5,_0x333d8e){var _0x4918e2={};var _0x30de8d={};var _0x4301bb;var _0x143975;return db[_0x1b24('0x2a')][_0x1b24('0x47')]({'where':{'id':_0x219b07[_0x1b24('0x40')]['id']}})[_0x1b24('0x25')](handleEntityNotFound(_0x40d2d5,null))[_0x1b24('0x25')](function(_0x4f8d41){if(_0x4f8d41){_0x4301bb=_0x4f8d41;_0x30de8d[_0x1b24('0x2d')]=_[_0x1b24('0x2f')](db['Dynamics365Field']['rawAttributes']);_0x30de8d[_0x1b24('0x2e')]=_[_0x1b24('0x2f')](_0x219b07['query']);_0x30de8d['filters']=_[_0x1b24('0x31')](_0x30de8d['model'],_0x30de8d[_0x1b24('0x2e')]);_0x4918e2[_0x1b24('0x32')]=_['intersection'](_0x30de8d[_0x1b24('0x2d')],qs[_0x1b24('0x41')](_0x219b07[_0x1b24('0x2e')][_0x1b24('0x41')]));_0x4918e2['attributes']=_0x4918e2['attributes']['length']?_0x4918e2[_0x1b24('0x32')]:_0x30de8d[_0x1b24('0x2d')];_0x4918e2[_0x1b24('0x33')]=qs[_0x1b24('0x34')](_0x219b07['query']['sort']);_0x4918e2[_0x1b24('0x35')]=qs[_0x1b24('0x30')](_[_0x1b24('0x36')](_0x219b07[_0x1b24('0x2e')],_0x30de8d[_0x1b24('0x30')]));if(_0x219b07[_0x1b24('0x2e')]['filter']){_0x4918e2['where']=_[_0x1b24('0x38')](_0x4918e2[_0x1b24('0x35')],{'$or':_[_0x1b24('0x39')](_0x4918e2['attributes'],function(_0x408137){var _0x3005e1={};_0x3005e1[_0x408137]={'$like':'%'+_0x219b07[_0x1b24('0x2e')]['filter']+'%'};return _0x3005e1;})});}_0x4918e2=_['merge']({},_0x4918e2,_0x219b07['options']);return _0x4301bb[_0x1b24('0x4c')](_0x4918e2);}})['then'](function(_0x6f6f1c){if(_0x6f6f1c){_0x143975=_0x6f6f1c['length'];if(!_0x219b07[_0x1b24('0x2e')][_0x1b24('0x4d')](_0x1b24('0x4a'))){_0x4918e2[_0x1b24('0x1f')]=qs[_0x1b24('0x1f')](_0x219b07[_0x1b24('0x2e')][_0x1b24('0x1f')]);_0x4918e2['offset']=qs[_0x1b24('0x20')](_0x219b07['query']['offset']);}return _0x4301bb['getDescriptions'](_0x4918e2);}})['then'](function(_0x10a860){if(_0x10a860){return _0x10a860?{'count':_0x143975,'rows':_0x10a860}:null;}})[_0x1b24('0x25')](respondWithResult(_0x40d2d5,null))[_0x1b24('0x3e')](handleError(_0x40d2d5,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 1dad156..3be013e 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 _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4abe67,_0x179189){var _0x5200d5=function(_0x4f85ac){while(--_0x4f85ac){_0x4abe67['push'](_0x4abe67['shift']());}};_0x5200d5(++_0x179189);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0xb4e6[_0x1ab0e6];return _0x248815;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','int_dynamics365_configurations','lodash'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xe14d,0x1ee));var _0xde14=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xe14d[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('Dynamics365Configuration',attributes,{'tableName':_0xde14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index d955690..adc11a8 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 _0x66cf=['result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5da880,_0x4e64de){var _0x5621ca=function(_0x4a4ddc){while(--_0x4a4ddc){_0x5da880['push'](_0x5da880['shift']());}};_0x5621ca(++_0x4e64de);}(_0x66cf,0xe8));var _0xf66c=function(_0x5b9b96,_0x1b1f42){_0x5b9b96=_0x5b9b96-0x0;var _0x4fda42=_0x66cf[_0x5b9b96];return _0x4fda42;};'use strict';var _=require(_0xf66c('0x0'));var util=require(_0xf66c('0x1'));var moment=require(_0xf66c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf66c('0x3'));var db=require(_0xf66c('0x4'))['db'];var utils=require(_0xf66c('0x5'));var logger=require('../../config/logger')(_0xf66c('0x6'));var config=require(_0xf66c('0x7'));var jayson=require(_0xf66c('0x8'));var client=jayson['client'][_0xf66c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2554ac,_0x5c406d,_0x391bba){return new BPromise(function(_0x2ef486,_0xcc3456){return client[_0xf66c('0xa')](_0x2554ac,_0x391bba)[_0xf66c('0xb')](function(_0x40ecf8){logger[_0xf66c('0xc')](_0xf66c('0xd'),_0x5c406d,_0xf66c('0xe'));logger[_0xf66c('0xf')](_0xf66c('0x10'),_0x5c406d,_0xf66c('0xe'),JSON[_0xf66c('0x11')](_0x40ecf8));if(_0x40ecf8[_0xf66c('0x12')]){if(_0x40ecf8['error'][_0xf66c('0x13')]===0x1f4){logger[_0xf66c('0x12')](_0xf66c('0xd'),_0x5c406d,_0x40ecf8[_0xf66c('0x12')][_0xf66c('0x14')]);return _0xcc3456(_0x40ecf8[_0xf66c('0x12')]['message']);}logger[_0xf66c('0x12')](_0xf66c('0xd'),_0x5c406d,_0x40ecf8[_0xf66c('0x12')][_0xf66c('0x14')]);return _0x2ef486(_0x40ecf8[_0xf66c('0x12')][_0xf66c('0x14')]);}else{logger[_0xf66c('0xc')](_0xf66c('0xd'),_0x5c406d,'request\x20sent');_0x2ef486(_0x40ecf8[_0xf66c('0x15')][_0xf66c('0x14')]);}})[_0xf66c('0x16')](function(_0x56297e){logger['error'](_0xf66c('0xd'),_0x5c406d,_0x56297e);_0xcc3456(_0x56297e);});});} \ No newline at end of file +var _0x80c2=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x80c2,0xfb));var _0x280c=function(_0x2992de,_0x3d8fa7){_0x2992de=_0x2992de-0x0;var _0x305511=_0x80c2[_0x2992de];return _0x305511;};'use strict';var _=require(_0x280c('0x0'));var util=require(_0x280c('0x1'));var moment=require(_0x280c('0x2'));var BPromise=require('bluebird');var rs=require(_0x280c('0x3'));var fs=require('fs');var Redis=require(_0x280c('0x4'));var db=require(_0x280c('0x5'))['db'];var utils=require(_0x280c('0x6'));var logger=require('../../config/logger')(_0x280c('0x7'));var config=require('../../config/environment');var jayson=require(_0x280c('0x8'));var client=jayson[_0x280c('0x9')][_0x280c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35b48e,_0x1e7336,_0x58d1bc){return new BPromise(function(_0x22a626,_0x41e322){return client[_0x280c('0xb')](_0x35b48e,_0x58d1bc)[_0x280c('0xc')](function(_0x246b48){logger[_0x280c('0xd')](_0x280c('0xe'),_0x1e7336,'request\x20sent');logger[_0x280c('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1e7336,_0x280c('0x10'),JSON[_0x280c('0x11')](_0x246b48));if(_0x246b48[_0x280c('0x12')]){if(_0x246b48[_0x280c('0x12')][_0x280c('0x13')]===0x1f4){logger[_0x280c('0x12')](_0x280c('0xe'),_0x1e7336,_0x246b48['error'][_0x280c('0x14')]);return _0x41e322(_0x246b48['error'][_0x280c('0x14')]);}logger[_0x280c('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1e7336,_0x246b48[_0x280c('0x12')][_0x280c('0x14')]);return _0x22a626(_0x246b48['error'][_0x280c('0x14')]);}else{logger[_0x280c('0xd')](_0x280c('0xe'),_0x1e7336,_0x280c('0x10'));_0x22a626(_0x246b48[_0x280c('0x15')]['message']);}})[_0x280c('0x16')](function(_0x42aa3d){logger[_0x280c('0x12')](_0x280c('0xe'),_0x1e7336,_0x42aa3d);_0x41e322(_0x42aa3d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 0686ec6..c734e67 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 _0xb9d2=['destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xb9d2,0x1b1));var _0x2b9d=function(_0x4b6cc8,_0x355e5b){_0x4b6cc8=_0x4b6cc8-0x0;var _0x5c4743=_0xb9d2[_0x4b6cc8];return _0x5c4743;};'use strict';var multer=require(_0x2b9d('0x0'));var util=require(_0x2b9d('0x1'));var path=require('path');var timeout=require(_0x2b9d('0x2'));var express=require(_0x2b9d('0x3'));var router=express[_0x2b9d('0x4')]();var fs_extra=require(_0x2b9d('0x5'));var auth=require(_0x2b9d('0x6'));var interaction=require(_0x2b9d('0x7'));var config=require(_0x2b9d('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x2b9d('0x9')]('/',auth[_0x2b9d('0xa')](),controller[_0x2b9d('0xb')]);router[_0x2b9d('0x9')](_0x2b9d('0xc'),auth[_0x2b9d('0xa')](),controller['show']);router[_0x2b9d('0xd')]('/',auth['isAuthenticated'](),controller[_0x2b9d('0xe')]);router['put']('/:id',auth[_0x2b9d('0xa')](),controller['update']);router['delete'](_0x2b9d('0xc'),auth[_0x2b9d('0xa')](),controller[_0x2b9d('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9445=['delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x9445,0x159));var _0x5944=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9445[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x5944('0x0'));var util=require(_0x5944('0x1'));var path=require(_0x5944('0x2'));var timeout=require(_0x5944('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5944('0x4'));var auth=require(_0x5944('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5944('0x6'));var controller=require(_0x5944('0x7'));router[_0x5944('0x8')]('/',auth[_0x5944('0x9')](),controller[_0x5944('0xa')]);router[_0x5944('0x8')](_0x5944('0xb'),auth[_0x5944('0x9')](),controller[_0x5944('0xc')]);router['post']('/',auth[_0x5944('0x9')](),controller[_0x5944('0xd')]);router[_0x5944('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5944('0xf')]);router[_0x5944('0x10')]('/:id',auth[_0x5944('0x9')](),controller[_0x5944('0x11')]);module[_0x5944('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index e81561b..8168716 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 _0x7ef2=['string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x4fcadf,_0x731091){var _0x146114=function(_0x390e2c){while(--_0x390e2c){_0x4fcadf['push'](_0x4fcadf['shift']());}};_0x146114(++_0x731091);}(_0x7ef2,0x133));var _0x27ef=function(_0x5c0e3b,_0x318d69){_0x5c0e3b=_0x5c0e3b-0x0;var _0x1eb1ef=_0x7ef2[_0x5c0e3b];return _0x1eb1ef;};'use strict';var Sequelize=require(_0x27ef('0x0'));module[_0x27ef('0x1')]={'type':{'type':Sequelize[_0x27ef('0x2')](_0x27ef('0x3'),_0x27ef('0x4'),'customVariable',_0x27ef('0x5'),_0x27ef('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x27ef('0x7')]},'key':{'type':Sequelize[_0x27ef('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x27ef('0x3'),_0x27ef('0x4'),_0x27ef('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x27ef('0x7')]},'nameField':{'type':Sequelize[_0x27ef('0x7')]},'customField':{'type':Sequelize[_0x27ef('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1233=['picklist','STRING','variable','BOOLEAN','exports','ENUM','string','customVariable','keyValue'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x1233,0x17e));var _0x3123=function(_0x3e2489,_0x41d9dd){_0x3e2489=_0x3e2489-0x0;var _0x2254ce=_0x1233[_0x3e2489];return _0x2254ce;};'use strict';var Sequelize=require('sequelize');module[_0x3123('0x0')]={'type':{'type':Sequelize[_0x3123('0x1')](_0x3123('0x2'),'variable',_0x3123('0x3'),_0x3123('0x4'),_0x3123('0x5')),'defaultValue':_0x3123('0x2')},'content':{'type':Sequelize[_0x3123('0x6')]},'key':{'type':Sequelize[_0x3123('0x6')]},'keyType':{'type':Sequelize[_0x3123('0x1')](_0x3123('0x2'),_0x3123('0x7'),_0x3123('0x3'))},'keyContent':{'type':Sequelize[_0x3123('0x6')]},'idField':{'type':Sequelize[_0x3123('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3123('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 77f173d..935186c 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 _0xc8b1=['apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xc8b1,0x103));var _0x1c8b=function(_0x27f4c5,_0x561a57){_0x27f4c5=_0x27f4c5-0x0;var _0x452c26=_0xc8b1[_0x27f4c5];return _0x452c26;};'use strict';var emlformat=require(_0x1c8b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1c8b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c8b('0x2'));var moment=require(_0x1c8b('0x3'));var BPromise=require(_0x1c8b('0x4'));var Mustache=require(_0x1c8b('0x5'));var util=require(_0x1c8b('0x6'));var path=require(_0x1c8b('0x7'));var sox=require('sox');var csv=require(_0x1c8b('0x8'));var ejs=require(_0x1c8b('0x9'));var fs=require('fs');var fs_extra=require(_0x1c8b('0xa'));var _=require(_0x1c8b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1c8b('0xc'));var deskjs=require(_0x1c8b('0xd'));var toCsv=require(_0x1c8b('0x8'));var querystring=require('querystring');var Papa=require(_0x1c8b('0xe'));var Redis=require(_0x1c8b('0xf'));var authService=require(_0x1c8b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1c8b('0x11'));var hardwareService=require(_0x1c8b('0x12'));var logger=require(_0x1c8b('0x13'))('api');var utils=require(_0x1c8b('0x14'));var config=require(_0x1c8b('0x15'));var licenseUtil=require(_0x1c8b('0x16'));var db=require(_0x1c8b('0x17'))['db'];function respondWithStatusCode(_0x2a3b81,_0x22b7e1){_0x22b7e1=_0x22b7e1||0xcc;return function(_0x5d4243){if(_0x5d4243){return _0x2a3b81['sendStatus'](_0x22b7e1);}return _0x2a3b81['status'](_0x22b7e1)[_0x1c8b('0x18')]();};}function respondWithResult(_0x3bdb5b,_0x5b843a){_0x5b843a=_0x5b843a||0xc8;return function(_0x537065){if(_0x537065){return _0x3bdb5b[_0x1c8b('0x19')](_0x5b843a)[_0x1c8b('0x1a')](_0x537065);}};}function respondWithFilteredResult(_0x32b228,_0x5271b3){return function(_0x54c9d8){if(_0x54c9d8){var _0x2ad957=typeof _0x5271b3[_0x1c8b('0x1b')]==='undefined'&&typeof _0x5271b3[_0x1c8b('0x1c')]===_0x1c8b('0x1d');var _0x1952c6=_0x54c9d8[_0x1c8b('0x1e')];var _0x2e92f6=_0x2ad957?0x0:_0x5271b3[_0x1c8b('0x1b')];var _0x4208ce=_0x2ad957?_0x54c9d8[_0x1c8b('0x1e')]:_0x5271b3[_0x1c8b('0x1b')]+_0x5271b3[_0x1c8b('0x1c')];var _0x53be4c;if(_0x4208ce>=_0x1952c6){_0x4208ce=_0x1952c6;_0x53be4c=0xc8;}else{_0x53be4c=0xce;}_0x32b228[_0x1c8b('0x19')](_0x53be4c);return _0x32b228[_0x1c8b('0x1f')](_0x1c8b('0x20'),_0x2e92f6+'-'+_0x4208ce+'/'+_0x1952c6)[_0x1c8b('0x1a')](_0x54c9d8);}return null;};}function patchUpdates(_0x551dcc){return function(_0x397996){try{jsonpatch[_0x1c8b('0x21')](_0x397996,_0x551dcc,!![]);}catch(_0x3f0adf){return BPromise[_0x1c8b('0x22')](_0x3f0adf);}return _0x397996[_0x1c8b('0x23')]();};}function saveUpdates(_0x5c4baf,_0x19d31c){return function(_0x4404b3){if(_0x4404b3){return _0x4404b3[_0x1c8b('0x24')](_0x5c4baf)['then'](function(_0xd572ef){return _0xd572ef;});}return null;};}function removeEntity(_0x135f19,_0x7572da){return function(_0x38924f){if(_0x38924f){return _0x38924f[_0x1c8b('0x25')]()[_0x1c8b('0x26')](function(){_0x135f19[_0x1c8b('0x19')](0xcc)[_0x1c8b('0x18')]();});}};}function handleEntityNotFound(_0x43c8e1,_0x5a4ac2){return function(_0x4047ec){if(!_0x4047ec){_0x43c8e1[_0x1c8b('0x27')](0x194);}return _0x4047ec;};}function handleError(_0xd139e6,_0x4241bb){_0x4241bb=_0x4241bb||0x1f4;return function(_0x492bfd){logger[_0x1c8b('0x28')](_0x492bfd[_0x1c8b('0x29')]);if(_0x492bfd[_0x1c8b('0x2a')]){delete _0x492bfd[_0x1c8b('0x2a')];}_0xd139e6[_0x1c8b('0x19')](_0x4241bb)[_0x1c8b('0x2b')](_0x492bfd);};}exports[_0x1c8b('0x2c')]=function(_0x29d668,_0x1873bf){var _0x4e96e1={},_0x4d4c02={},_0x2d4d28={'count':0x0,'rows':[]};var _0x4e8274=_[_0x1c8b('0x2d')](db[_0x1c8b('0x2e')][_0x1c8b('0x2f')],function(_0x1fd26b){return{'name':_0x1fd26b[_0x1c8b('0x30')],'type':_0x1fd26b[_0x1c8b('0x31')]['key']};});_0x4d4c02[_0x1c8b('0x32')]=_[_0x1c8b('0x2d')](_0x4e8274,_0x1c8b('0x2a'));_0x4d4c02['query']=_[_0x1c8b('0x33')](_0x29d668[_0x1c8b('0x34')]);_0x4d4c02[_0x1c8b('0x35')]=_[_0x1c8b('0x36')](_0x4d4c02[_0x1c8b('0x32')],_0x4d4c02[_0x1c8b('0x34')]);_0x4e96e1['attributes']=_[_0x1c8b('0x36')](_0x4d4c02[_0x1c8b('0x32')],qs[_0x1c8b('0x37')](_0x29d668[_0x1c8b('0x34')][_0x1c8b('0x37')]));_0x4e96e1[_0x1c8b('0x38')]=_0x4e96e1[_0x1c8b('0x38')][_0x1c8b('0x39')]?_0x4e96e1[_0x1c8b('0x38')]:_0x4d4c02[_0x1c8b('0x32')];if(!_0x29d668[_0x1c8b('0x34')]['hasOwnProperty'](_0x1c8b('0x3a'))){_0x4e96e1[_0x1c8b('0x1c')]=qs[_0x1c8b('0x1c')](_0x29d668[_0x1c8b('0x34')][_0x1c8b('0x1c')]);_0x4e96e1[_0x1c8b('0x1b')]=qs[_0x1c8b('0x1b')](_0x29d668[_0x1c8b('0x34')][_0x1c8b('0x1b')]);}_0x4e96e1['order']=qs['sort'](_0x29d668[_0x1c8b('0x34')][_0x1c8b('0x3b')]);_0x4e96e1[_0x1c8b('0x3c')]=qs[_0x1c8b('0x35')](_['pick'](_0x29d668[_0x1c8b('0x34')],_0x4d4c02[_0x1c8b('0x35')]),_0x4e8274);if(_0x29d668[_0x1c8b('0x34')][_0x1c8b('0x3d')]){_0x4e96e1[_0x1c8b('0x3c')]=_[_0x1c8b('0x3e')](_0x4e96e1['where'],{'$or':_[_0x1c8b('0x2d')](_0x4e8274,function(_0x431df3){if(_0x431df3[_0x1c8b('0x31')]!==_0x1c8b('0x3f')){var _0x53640d={};_0x53640d[_0x431df3['name']]={'$like':'%'+_0x29d668['query'][_0x1c8b('0x3d')]+'%'};return _0x53640d;}})});}_0x4e96e1=_[_0x1c8b('0x3e')]({},_0x4e96e1,_0x29d668[_0x1c8b('0x40')]);var _0x2195fc={'where':_0x4e96e1[_0x1c8b('0x3c')]};return db[_0x1c8b('0x2e')][_0x1c8b('0x1e')](_0x2195fc)[_0x1c8b('0x26')](function(_0xbb6fbd){_0x2d4d28[_0x1c8b('0x1e')]=_0xbb6fbd;if(_0x29d668[_0x1c8b('0x34')]['includeAll']){_0x4e96e1['include']=[{'all':!![]}];}return db[_0x1c8b('0x2e')][_0x1c8b('0x41')](_0x4e96e1);})['then'](function(_0x5eaef0){_0x2d4d28[_0x1c8b('0x42')]=_0x5eaef0;return _0x2d4d28;})[_0x1c8b('0x26')](respondWithFilteredResult(_0x1873bf,_0x4e96e1))[_0x1c8b('0x43')](handleError(_0x1873bf,null));};exports[_0x1c8b('0x44')]=function(_0x20fbe3,_0x4bc1da){var _0x4eb2c3={'raw':!![],'where':{'id':_0x20fbe3[_0x1c8b('0x45')]['id']}},_0x2fff74={};_0x2fff74[_0x1c8b('0x32')]=_[_0x1c8b('0x33')](db[_0x1c8b('0x2e')][_0x1c8b('0x2f')]);_0x2fff74[_0x1c8b('0x34')]=_[_0x1c8b('0x33')](_0x20fbe3[_0x1c8b('0x34')]);_0x2fff74['filters']=_[_0x1c8b('0x36')](_0x2fff74[_0x1c8b('0x32')],_0x2fff74['query']);_0x4eb2c3[_0x1c8b('0x38')]=_[_0x1c8b('0x36')](_0x2fff74[_0x1c8b('0x32')],qs[_0x1c8b('0x37')](_0x20fbe3[_0x1c8b('0x34')][_0x1c8b('0x37')]));_0x4eb2c3['attributes']=_0x4eb2c3[_0x1c8b('0x38')][_0x1c8b('0x39')]?_0x4eb2c3[_0x1c8b('0x38')]:_0x2fff74[_0x1c8b('0x32')];if(_0x20fbe3[_0x1c8b('0x34')]['includeAll']){_0x4eb2c3['include']=[{'all':!![]}];}_0x4eb2c3=_[_0x1c8b('0x3e')]({},_0x4eb2c3,_0x20fbe3[_0x1c8b('0x40')]);return db['Dynamics365Field'][_0x1c8b('0x46')](_0x4eb2c3)[_0x1c8b('0x26')](handleEntityNotFound(_0x4bc1da,null))[_0x1c8b('0x26')](respondWithResult(_0x4bc1da,null))[_0x1c8b('0x43')](handleError(_0x4bc1da,null));};exports['create']=function(_0x231f2a,_0x371ed0){return db['Dynamics365Field'][_0x1c8b('0x47')](_0x231f2a[_0x1c8b('0x48')],{})[_0x1c8b('0x26')](respondWithResult(_0x371ed0,0xc9))[_0x1c8b('0x43')](handleError(_0x371ed0,null));};exports[_0x1c8b('0x24')]=function(_0x31fb77,_0x504823){if(_0x31fb77[_0x1c8b('0x48')]['id']){delete _0x31fb77['body']['id'];}return db[_0x1c8b('0x2e')][_0x1c8b('0x46')]({'where':{'id':_0x31fb77[_0x1c8b('0x45')]['id']}})[_0x1c8b('0x26')](handleEntityNotFound(_0x504823,null))[_0x1c8b('0x26')](saveUpdates(_0x31fb77[_0x1c8b('0x48')],null))['then'](respondWithResult(_0x504823,null))['catch'](handleError(_0x504823,null));};exports['destroy']=function(_0x4d3c3e,_0x3b6746){return db['Dynamics365Field'][_0x1c8b('0x46')]({'where':{'id':_0x4d3c3e[_0x1c8b('0x45')]['id']}})[_0x1c8b('0x26')](handleEntityNotFound(_0x3b6746,null))[_0x1c8b('0x26')](removeEntity(_0x3b6746,null))['catch'](handleError(_0x3b6746,null));}; \ No newline at end of file +var _0xaa55=['map','Dynamics365Field','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','name','send','index'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0xaa55,0xb2));var _0x5aa5=function(_0x5f0625,_0x225214){_0x5f0625=_0x5f0625-0x0;var _0x5ca187=_0xaa55[_0x5f0625];return _0x5ca187;};'use strict';var emlformat=require(_0x5aa5('0x0'));var rimraf=require(_0x5aa5('0x1'));var zipdir=require(_0x5aa5('0x2'));var jsonpatch=require(_0x5aa5('0x3'));var rp=require(_0x5aa5('0x4'));var moment=require(_0x5aa5('0x5'));var BPromise=require(_0x5aa5('0x6'));var Mustache=require('mustache');var util=require(_0x5aa5('0x7'));var path=require(_0x5aa5('0x8'));var sox=require(_0x5aa5('0x9'));var csv=require(_0x5aa5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5aa5('0xb'));var squel=require(_0x5aa5('0xc'));var crypto=require(_0x5aa5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5aa5('0xa'));var querystring=require(_0x5aa5('0xe'));var Papa=require('papaparse');var Redis=require(_0x5aa5('0xf'));var authService=require(_0x5aa5('0x10'));var qs=require(_0x5aa5('0x11'));var as=require(_0x5aa5('0x12'));var hardwareService=require(_0x5aa5('0x13'));var logger=require(_0x5aa5('0x14'))('api');var utils=require(_0x5aa5('0x15'));var config=require(_0x5aa5('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37db8c,_0x1dc2bd){_0x1dc2bd=_0x1dc2bd||0xcc;return function(_0x45a130){if(_0x45a130){return _0x37db8c[_0x5aa5('0x17')](_0x1dc2bd);}return _0x37db8c[_0x5aa5('0x18')](_0x1dc2bd)[_0x5aa5('0x19')]();};}function respondWithResult(_0x208aaa,_0x2b9a1b){_0x2b9a1b=_0x2b9a1b||0xc8;return function(_0x40d852){if(_0x40d852){return _0x208aaa['status'](_0x2b9a1b)[_0x5aa5('0x1a')](_0x40d852);}};}function respondWithFilteredResult(_0xb64b0a,_0x5182d4){return function(_0x84cd20){if(_0x84cd20){var _0x399a8a=typeof _0x5182d4[_0x5aa5('0x1b')]===_0x5aa5('0x1c')&&typeof _0x5182d4[_0x5aa5('0x1d')]==='undefined';var _0x2910c3=_0x84cd20['count'];var _0x1f88a1=_0x399a8a?0x0:_0x5182d4['offset'];var _0xa78289=_0x399a8a?_0x84cd20[_0x5aa5('0x1e')]:_0x5182d4['offset']+_0x5182d4[_0x5aa5('0x1d')];var _0x8b7daf;if(_0xa78289>=_0x2910c3){_0xa78289=_0x2910c3;_0x8b7daf=0xc8;}else{_0x8b7daf=0xce;}_0xb64b0a[_0x5aa5('0x18')](_0x8b7daf);return _0xb64b0a[_0x5aa5('0x1f')](_0x5aa5('0x20'),_0x1f88a1+'-'+_0xa78289+'/'+_0x2910c3)['json'](_0x84cd20);}return null;};}function patchUpdates(_0x1de689){return function(_0x103658){try{jsonpatch[_0x5aa5('0x21')](_0x103658,_0x1de689,!![]);}catch(_0x39dfe4){return BPromise['reject'](_0x39dfe4);}return _0x103658['save']();};}function saveUpdates(_0x458b52,_0x514b52){return function(_0x18283c){if(_0x18283c){return _0x18283c[_0x5aa5('0x22')](_0x458b52)[_0x5aa5('0x23')](function(_0x6f0931){return _0x6f0931;});}return null;};}function removeEntity(_0x96a93f,_0x3412ea){return function(_0x51f129){if(_0x51f129){return _0x51f129[_0x5aa5('0x24')]()[_0x5aa5('0x23')](function(){_0x96a93f[_0x5aa5('0x18')](0xcc)[_0x5aa5('0x19')]();});}};}function handleEntityNotFound(_0x19d509,_0x5a9716){return function(_0x19516f){if(!_0x19516f){_0x19d509['sendStatus'](0x194);}return _0x19516f;};}function handleError(_0x10eead,_0x1d6b81){_0x1d6b81=_0x1d6b81||0x1f4;return function(_0x1f8216){logger[_0x5aa5('0x25')](_0x1f8216['stack']);if(_0x1f8216[_0x5aa5('0x26')]){delete _0x1f8216['name'];}_0x10eead[_0x5aa5('0x18')](_0x1d6b81)[_0x5aa5('0x27')](_0x1f8216);};}exports[_0x5aa5('0x28')]=function(_0x2eb450,_0x2b8d92){var _0x38c082={},_0x128301={},_0x40581d={'count':0x0,'rows':[]};var _0x5f2cf5=_[_0x5aa5('0x29')](db[_0x5aa5('0x2a')][_0x5aa5('0x2b')],function(_0x4b987a){return{'name':_0x4b987a['fieldName'],'type':_0x4b987a[_0x5aa5('0x2c')]['key']};});_0x128301[_0x5aa5('0x2d')]=_[_0x5aa5('0x29')](_0x5f2cf5,'name');_0x128301[_0x5aa5('0x2e')]=_[_0x5aa5('0x2f')](_0x2eb450['query']);_0x128301[_0x5aa5('0x30')]=_[_0x5aa5('0x31')](_0x128301[_0x5aa5('0x2d')],_0x128301['query']);_0x38c082['attributes']=_['intersection'](_0x128301[_0x5aa5('0x2d')],qs[_0x5aa5('0x32')](_0x2eb450[_0x5aa5('0x2e')][_0x5aa5('0x32')]));_0x38c082[_0x5aa5('0x33')]=_0x38c082['attributes'][_0x5aa5('0x34')]?_0x38c082[_0x5aa5('0x33')]:_0x128301[_0x5aa5('0x2d')];if(!_0x2eb450['query'][_0x5aa5('0x35')](_0x5aa5('0x36'))){_0x38c082[_0x5aa5('0x1d')]=qs[_0x5aa5('0x1d')](_0x2eb450[_0x5aa5('0x2e')]['limit']);_0x38c082['offset']=qs['offset'](_0x2eb450['query'][_0x5aa5('0x1b')]);}_0x38c082[_0x5aa5('0x37')]=qs['sort'](_0x2eb450['query'][_0x5aa5('0x38')]);_0x38c082[_0x5aa5('0x39')]=qs[_0x5aa5('0x30')](_[_0x5aa5('0x3a')](_0x2eb450[_0x5aa5('0x2e')],_0x128301[_0x5aa5('0x30')]),_0x5f2cf5);if(_0x2eb450[_0x5aa5('0x2e')][_0x5aa5('0x3b')]){_0x38c082[_0x5aa5('0x39')]=_[_0x5aa5('0x3c')](_0x38c082['where'],{'$or':_[_0x5aa5('0x29')](_0x5f2cf5,function(_0x455357){if(_0x455357['type']!==_0x5aa5('0x3d')){var _0x47cce1={};_0x47cce1[_0x455357[_0x5aa5('0x26')]]={'$like':'%'+_0x2eb450[_0x5aa5('0x2e')]['filter']+'%'};return _0x47cce1;}})});}_0x38c082=_[_0x5aa5('0x3c')]({},_0x38c082,_0x2eb450[_0x5aa5('0x3e')]);var _0x54ea2f={'where':_0x38c082[_0x5aa5('0x39')]};return db[_0x5aa5('0x2a')][_0x5aa5('0x1e')](_0x54ea2f)['then'](function(_0x10cea8){_0x40581d[_0x5aa5('0x1e')]=_0x10cea8;if(_0x2eb450[_0x5aa5('0x2e')][_0x5aa5('0x3f')]){_0x38c082[_0x5aa5('0x40')]=[{'all':!![]}];}return db[_0x5aa5('0x2a')][_0x5aa5('0x41')](_0x38c082);})[_0x5aa5('0x23')](function(_0x5ecb1c){_0x40581d[_0x5aa5('0x42')]=_0x5ecb1c;return _0x40581d;})['then'](respondWithFilteredResult(_0x2b8d92,_0x38c082))['catch'](handleError(_0x2b8d92,null));};exports[_0x5aa5('0x43')]=function(_0x38b52b,_0x152f23){var _0x8a6d7f={'raw':!![],'where':{'id':_0x38b52b[_0x5aa5('0x44')]['id']}},_0x31a796={};_0x31a796[_0x5aa5('0x2d')]=_[_0x5aa5('0x2f')](db[_0x5aa5('0x2a')][_0x5aa5('0x2b')]);_0x31a796[_0x5aa5('0x2e')]=_[_0x5aa5('0x2f')](_0x38b52b[_0x5aa5('0x2e')]);_0x31a796[_0x5aa5('0x30')]=_['intersection'](_0x31a796['model'],_0x31a796[_0x5aa5('0x2e')]);_0x8a6d7f[_0x5aa5('0x33')]=_[_0x5aa5('0x31')](_0x31a796[_0x5aa5('0x2d')],qs[_0x5aa5('0x32')](_0x38b52b['query'][_0x5aa5('0x32')]));_0x8a6d7f[_0x5aa5('0x33')]=_0x8a6d7f[_0x5aa5('0x33')]['length']?_0x8a6d7f[_0x5aa5('0x33')]:_0x31a796['model'];if(_0x38b52b[_0x5aa5('0x2e')][_0x5aa5('0x3f')]){_0x8a6d7f[_0x5aa5('0x40')]=[{'all':!![]}];}_0x8a6d7f=_[_0x5aa5('0x3c')]({},_0x8a6d7f,_0x38b52b['options']);return db[_0x5aa5('0x2a')][_0x5aa5('0x45')](_0x8a6d7f)[_0x5aa5('0x23')](handleEntityNotFound(_0x152f23,null))[_0x5aa5('0x23')](respondWithResult(_0x152f23,null))[_0x5aa5('0x46')](handleError(_0x152f23,null));};exports[_0x5aa5('0x47')]=function(_0x4d6ff7,_0x3b50a3){return db[_0x5aa5('0x2a')][_0x5aa5('0x47')](_0x4d6ff7[_0x5aa5('0x48')],{})['then'](respondWithResult(_0x3b50a3,0xc9))[_0x5aa5('0x46')](handleError(_0x3b50a3,null));};exports['update']=function(_0x493573,_0x59b360){if(_0x493573[_0x5aa5('0x48')]['id']){delete _0x493573[_0x5aa5('0x48')]['id'];}return db[_0x5aa5('0x2a')][_0x5aa5('0x45')]({'where':{'id':_0x493573[_0x5aa5('0x44')]['id']}})[_0x5aa5('0x23')](handleEntityNotFound(_0x59b360,null))['then'](saveUpdates(_0x493573[_0x5aa5('0x48')],null))[_0x5aa5('0x23')](respondWithResult(_0x59b360,null))[_0x5aa5('0x46')](handleError(_0x59b360,null));};exports[_0x5aa5('0x24')]=function(_0x7b1afe,_0x5e9460){return db['Dynamics365Field']['find']({'where':{'id':_0x7b1afe[_0x5aa5('0x44')]['id']}})['then'](handleEntityNotFound(_0x5e9460,null))[_0x5aa5('0x23')](removeEntity(_0x5e9460,null))[_0x5aa5('0x46')](handleError(_0x5e9460,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index bbd1de1..09b8be7 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 _0xacc1=['rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','../../config/logger','request-promise'];(function(_0x5d27,_0x35c50d){var _0x2529c4=function(_0x4dfc57){while(--_0x4dfc57){_0x5d27['push'](_0x5d27['shift']());}};_0x2529c4(++_0x35c50d);}(_0xacc1,0x1a2));var _0x1acc=function(_0x41e31e,_0x44dd9e){_0x41e31e=_0x41e31e-0x0;var _0x4350c4=_0xacc1[_0x41e31e];return _0x4350c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1acc('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1acc('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1acc('0x2'));var config=require('../../config/environment');var attributes=require(_0x1acc('0x3'));module[_0x1acc('0x4')]=function(_0x510e2e,_0x6cf33f){return _0x510e2e[_0x1acc('0x5')](_0x1acc('0x6'),attributes,{'tableName':_0x1acc('0x7'),'paranoid':![],'indexes':[{'name':_0x1acc('0x8'),'fields':['idField',_0x1acc('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x11ea=['api','moment','request-promise','./intDynamics365Field.attributes','exports','define','idField','lodash','util'];(function(_0xd0448e,_0x2d3d92){var _0x3563cb=function(_0x19ccf3){while(--_0x19ccf3){_0xd0448e['push'](_0xd0448e['shift']());}};_0x3563cb(++_0x2d3d92);}(_0x11ea,0x10c));var _0xa11e=function(_0x31594d,_0x4c809e){_0x31594d=_0x31594d-0x0;var _0x409627=_0x11ea[_0x31594d];return _0x409627;};'use strict';var _=require(_0xa11e('0x0'));var util=require(_0xa11e('0x1'));var logger=require('../../config/logger')(_0xa11e('0x2'));var moment=require(_0xa11e('0x3'));var BPromise=require('bluebird');var rp=require(_0xa11e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa11e('0x5'));module[_0xa11e('0x6')]=function(_0x96f3af,_0x5f3673){return _0x96f3af[_0xa11e('0x7')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xa11e('0x8'),'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 2d97ef9..4c77118 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 _0xb33f=['rpc','jayson/promise','client','request','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','Dynamics365Field,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x58d1a8,_0x79eb1b){var _0x97dc05=function(_0x257900){while(--_0x257900){_0x58d1a8['push'](_0x58d1a8['shift']());}};_0x97dc05(++_0x79eb1b);}(_0xb33f,0x188));var _0xfb33=function(_0x2d99bc,_0x471da7){_0x2d99bc=_0x2d99bc-0x0;var _0x5d89af=_0xb33f[_0x2d99bc];return _0x5d89af;};'use strict';var _=require('lodash');var util=require(_0xfb33('0x0'));var moment=require(_0xfb33('0x1'));var BPromise=require(_0xfb33('0x2'));var rs=require(_0xfb33('0x3'));var fs=require('fs');var Redis=require(_0xfb33('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb33('0x5'));var logger=require(_0xfb33('0x6'))(_0xfb33('0x7'));var config=require('../../config/environment');var jayson=require(_0xfb33('0x8'));var client=jayson[_0xfb33('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f4e6b,_0x17da2e,_0xe4a976){return new BPromise(function(_0x3d4b58,_0x178b15){return client[_0xfb33('0xa')](_0x4f4e6b,_0xe4a976)['then'](function(_0x39b8b8){logger[_0xfb33('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x17da2e,_0xfb33('0xc'));logger['debug'](_0xfb33('0xd'),_0x17da2e,'request\x20sent',JSON['stringify'](_0x39b8b8));if(_0x39b8b8['error']){if(_0x39b8b8['error']['code']===0x1f4){logger[_0xfb33('0xe')](_0xfb33('0xf'),_0x17da2e,_0x39b8b8['error'][_0xfb33('0x10')]);return _0x178b15(_0x39b8b8[_0xfb33('0xe')][_0xfb33('0x10')]);}logger[_0xfb33('0xe')](_0xfb33('0xf'),_0x17da2e,_0x39b8b8[_0xfb33('0xe')]['message']);return _0x3d4b58(_0x39b8b8['error'][_0xfb33('0x10')]);}else{logger[_0xfb33('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x17da2e,_0xfb33('0xc'));_0x3d4b58(_0x39b8b8[_0xfb33('0x11')][_0xfb33('0x10')]);}})[_0xfb33('0x12')](function(_0x243573){logger[_0xfb33('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x17da2e,_0x243573);_0x178b15(_0x243573);});});} \ No newline at end of file +var _0x409a=['../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xb8fc4b,_0x1f5eab){var _0x3c3b26=function(_0x2e6a73){while(--_0x2e6a73){_0xb8fc4b['push'](_0xb8fc4b['shift']());}};_0x3c3b26(++_0x1f5eab);}(_0x409a,0x17f));var _0xa409=function(_0x10ac81,_0x4af0eb){_0x10ac81=_0x10ac81-0x0;var _0x30bc7b=_0x409a[_0x10ac81];return _0x30bc7b;};'use strict';var _=require(_0xa409('0x0'));var util=require(_0xa409('0x1'));var moment=require(_0xa409('0x2'));var BPromise=require('bluebird');var rs=require(_0xa409('0x3'));var fs=require('fs');var Redis=require(_0xa409('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa409('0x5'));var logger=require(_0xa409('0x6'))(_0xa409('0x7'));var config=require(_0xa409('0x8'));var jayson=require(_0xa409('0x9'));var client=jayson[_0xa409('0xa')][_0xa409('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f1b49,_0x243612,_0x5c6e5c){return new BPromise(function(_0x482c08,_0x228520){return client[_0xa409('0xc')](_0x5f1b49,_0x5c6e5c)[_0xa409('0xd')](function(_0x52ebd6){logger[_0xa409('0xe')](_0xa409('0xf'),_0x243612,_0xa409('0x10'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x243612,_0xa409('0x10'),JSON[_0xa409('0x11')](_0x52ebd6));if(_0x52ebd6['error']){if(_0x52ebd6[_0xa409('0x12')][_0xa409('0x13')]===0x1f4){logger[_0xa409('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x243612,_0x52ebd6[_0xa409('0x12')]['message']);return _0x228520(_0x52ebd6[_0xa409('0x12')][_0xa409('0x14')]);}logger['error'](_0xa409('0xf'),_0x243612,_0x52ebd6[_0xa409('0x12')][_0xa409('0x14')]);return _0x482c08(_0x52ebd6[_0xa409('0x12')][_0xa409('0x14')]);}else{logger[_0xa409('0xe')](_0xa409('0xf'),_0x243612,_0xa409('0x10'));_0x482c08(_0x52ebd6[_0xa409('0x15')]['message']);}})[_0xa409('0x16')](function(_0x2f66fe){logger['error'](_0xa409('0xf'),_0x243612,_0x2f66fe);_0x228520(_0x2f66fe);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 679fe67..a1cd9bb 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 _0x921b=['post','create','/:id/configurations','addConfiguration','put','update','delete','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields'];(function(_0x218e99,_0x4a364f){var _0x47da41=function(_0x483838){while(--_0x483838){_0x218e99['push'](_0x218e99['shift']());}};_0x47da41(++_0x4a364f);}(_0x921b,0x13b));var _0xb921=function(_0x25258c,_0xb60597){_0x25258c=_0x25258c-0x0;var _0x4348df=_0x921b[_0x25258c];return _0x4348df;};'use strict';var multer=require(_0xb921('0x0'));var util=require(_0xb921('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb921('0x2')]();var fs_extra=require(_0xb921('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb921('0x4'));var config=require(_0xb921('0x5'));var controller=require(_0xb921('0x6'));router[_0xb921('0x7')]('/',auth[_0xb921('0x8')](),controller[_0xb921('0x9')]);router['get'](_0xb921('0xa'),auth[_0xb921('0x8')](),controller[_0xb921('0xb')]);router['get']('/:id/configurations',auth[_0xb921('0x8')](),controller[_0xb921('0xc')]);router['get'](_0xb921('0xd'),auth['isAuthenticated'](),controller[_0xb921('0xe')]);router[_0xb921('0xf')]('/',auth[_0xb921('0x8')](),controller[_0xb921('0x10')]);router[_0xb921('0xf')](_0xb921('0x11'),auth[_0xb921('0x8')](),controller[_0xb921('0x12')]);router[_0xb921('0x13')]('/:id',auth[_0xb921('0x8')](),controller[_0xb921('0x14')]);router[_0xb921('0x15')](_0xb921('0xa'),auth[_0xb921('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5dce=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','post','/:id/configurations','put','/:id','update','destroy','exports','multer','path'];(function(_0x5b53f2,_0x2eaa2e){var _0xa539eb=function(_0x427b8a){while(--_0x427b8a){_0x5b53f2['push'](_0x5b53f2['shift']());}};_0xa539eb(++_0x2eaa2e);}(_0x5dce,0xda));var _0xe5dc=function(_0x16fd68,_0x3d394d){_0x16fd68=_0x16fd68-0x0;var _0x12cf8e=_0x5dce[_0x16fd68];return _0x12cf8e;};'use strict';var multer=require(_0xe5dc('0x0'));var util=require('util');var path=require(_0xe5dc('0x1'));var timeout=require(_0xe5dc('0x2'));var express=require('express');var router=express[_0xe5dc('0x3')]();var fs_extra=require(_0xe5dc('0x4'));var auth=require(_0xe5dc('0x5'));var interaction=require(_0xe5dc('0x6'));var config=require(_0xe5dc('0x7'));var controller=require(_0xe5dc('0x8'));router[_0xe5dc('0x9')]('/',auth[_0xe5dc('0xa')](),controller[_0xe5dc('0xb')]);router[_0xe5dc('0x9')]('/:id',auth[_0xe5dc('0xa')](),controller[_0xe5dc('0xc')]);router['get']('/:id/configurations',auth[_0xe5dc('0xa')](),controller['getConfigurations']);router[_0xe5dc('0x9')](_0xe5dc('0xd'),auth[_0xe5dc('0xa')](),controller[_0xe5dc('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe5dc('0xf')](_0xe5dc('0x10'),auth[_0xe5dc('0xa')](),controller['addConfiguration']);router[_0xe5dc('0x11')](_0xe5dc('0x12'),auth['isAuthenticated'](),controller[_0xe5dc('0x13')]);router['delete'](_0xe5dc('0x12'),auth[_0xe5dc('0xa')](),controller[_0xe5dc('0x14')]);module[_0xe5dc('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 3a6efef..417e4af 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 _0x1893=['STRING','username','remoteUri'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x1893,0xa2));var _0x3189=function(_0x5d2ed9,_0x16c436){_0x5d2ed9=_0x5d2ed9-0x0;var _0x4262c5=_0x1893[_0x5d2ed9];return _0x4262c5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3189('0x0')]},'description':{'type':Sequelize[_0x3189('0x0')]},'username':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x1')},'apiKey':{'type':Sequelize[_0x3189('0x0')]},'remoteUri':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x8952=['username','remoteUri','exports','STRING'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x8952,0x17e));var _0x2895=function(_0x14ec1d,_0x4d7cc3){_0x14ec1d=_0x14ec1d-0x0;var _0x3f5215=_0x8952[_0x14ec1d];return _0x3f5215;};'use strict';var Sequelize=require('sequelize');module[_0x2895('0x0')]={'name':{'type':Sequelize[_0x2895('0x1')]},'description':{'type':Sequelize[_0x2895('0x1')]},'username':{'type':Sequelize[_0x2895('0x1')],'unique':_0x2895('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2895('0x1')],'unique':_0x2895('0x3')},'serverUrl':{'type':Sequelize[_0x2895('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 82890b0..557c0d9 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 _0xbdeb=['moment','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','FreshdeskAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','params','rawAttributes','keys','catch','create','body','find','findOne','getConfigurations','addConfiguration','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','Basic\x20%s','format','%s:X','base64','requester','subject','agent','description','priority','group','source','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','stringify','send','statusCode','rimraf','fast-json-patch'];(function(_0xfdf6cf,_0xca5151){var _0x4d0dbd=function(_0x4f8f05){while(--_0x4f8f05){_0xfdf6cf['push'](_0xfdf6cf['shift']());}};_0x4d0dbd(++_0xca5151);}(_0xbdeb,0x6f));var _0xbbde=function(_0x5b6fe5,_0x5ddf47){_0x5b6fe5=_0x5b6fe5-0x0;var _0x5928d4=_0xbdeb[_0x5b6fe5];return _0x5928d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbde('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbde('0x1'));var rp=require('request-promise');var moment=require(_0xbbde('0x2'));var BPromise=require(_0xbbde('0x3'));var Mustache=require(_0xbbde('0x4'));var util=require(_0xbbde('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xbbde('0x6'));var ejs=require(_0xbbde('0x7'));var fs=require('fs');var fs_extra=require(_0xbbde('0x8'));var _=require(_0xbbde('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbbde('0xa'));var deskjs=require(_0xbbde('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbbde('0xc'));var Papa=require(_0xbbde('0xd'));var Redis=require(_0xbbde('0xe'));var authService=require(_0xbbde('0xf'));var qs=require(_0xbbde('0x10'));var as=require(_0xbbde('0x11'));var hardwareService=require(_0xbbde('0x12'));var logger=require(_0xbbde('0x13'))(_0xbbde('0x14'));var utils=require(_0xbbde('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbbde('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3d09fa,_0x55e439){_0x55e439=_0x55e439||0xcc;return function(_0x38fba2){if(_0x38fba2){return _0x3d09fa[_0xbbde('0x17')](_0x55e439);}return _0x3d09fa[_0xbbde('0x18')](_0x55e439)[_0xbbde('0x19')]();};}function respondWithResult(_0x4afa45,_0x374e93){_0x374e93=_0x374e93||0xc8;return function(_0x1b6a23){if(_0x1b6a23){return _0x4afa45['status'](_0x374e93)[_0xbbde('0x1a')](_0x1b6a23);}};}function respondWithFilteredResult(_0x13db58,_0x4b3c6f){return function(_0x5ce713){if(_0x5ce713){var _0x4f23d7=typeof _0x4b3c6f['offset']===_0xbbde('0x1b')&&typeof _0x4b3c6f['limit']===_0xbbde('0x1b');var _0x939bc2=_0x5ce713['count'];var _0x2073d1=_0x4f23d7?0x0:_0x4b3c6f[_0xbbde('0x1c')];var _0xeb6b63=_0x4f23d7?_0x5ce713[_0xbbde('0x1d')]:_0x4b3c6f[_0xbbde('0x1c')]+_0x4b3c6f[_0xbbde('0x1e')];var _0x49e8e5;if(_0xeb6b63>=_0x939bc2){_0xeb6b63=_0x939bc2;_0x49e8e5=0xc8;}else{_0x49e8e5=0xce;}_0x13db58[_0xbbde('0x18')](_0x49e8e5);return _0x13db58[_0xbbde('0x1f')](_0xbbde('0x20'),_0x2073d1+'-'+_0xeb6b63+'/'+_0x939bc2)[_0xbbde('0x1a')](_0x5ce713);}return null;};}function patchUpdates(_0x1a5c58){return function(_0x51d22c){try{jsonpatch[_0xbbde('0x21')](_0x51d22c,_0x1a5c58,!![]);}catch(_0x3355e6){return BPromise[_0xbbde('0x22')](_0x3355e6);}return _0x51d22c[_0xbbde('0x23')]();};}function saveUpdates(_0x2c2c14,_0x31b97d){return function(_0x329d54){if(_0x329d54){return _0x329d54[_0xbbde('0x24')](_0x2c2c14)[_0xbbde('0x25')](function(_0x1b6f82){return _0x1b6f82;});}return null;};}function removeEntity(_0x4ac50b,_0x45db0e){return function(_0x460194){if(_0x460194){return _0x460194[_0xbbde('0x26')]()['then'](function(){_0x4ac50b[_0xbbde('0x18')](0xcc)[_0xbbde('0x19')]();});}};}function handleEntityNotFound(_0xad2657,_0x61d0a8){return function(_0x20a180){if(!_0x20a180){_0xad2657['sendStatus'](0x194);}return _0x20a180;};}function handleError(_0xbcf40e,_0x14243a){_0x14243a=_0x14243a||0x1f4;return function(_0x4ec095){logger[_0xbbde('0x27')](_0x4ec095[_0xbbde('0x28')]);if(_0x4ec095[_0xbbde('0x29')]){delete _0x4ec095[_0xbbde('0x29')];}_0xbcf40e[_0xbbde('0x18')](_0x14243a)['send'](_0x4ec095);};}exports['index']=function(_0x18bc12,_0x36a98a){var _0x5ac8a2={},_0x1ee462={},_0x22413b={'count':0x0,'rows':[]};var _0x2762ed=_[_0xbbde('0x2a')](db[_0xbbde('0x2b')]['rawAttributes'],function(_0x387eb3){return{'name':_0x387eb3[_0xbbde('0x2c')],'type':_0x387eb3[_0xbbde('0x2d')][_0xbbde('0x2e')]};});_0x1ee462[_0xbbde('0x2f')]=_['map'](_0x2762ed,_0xbbde('0x29'));_0x1ee462[_0xbbde('0x30')]=_['keys'](_0x18bc12['query']);_0x1ee462[_0xbbde('0x31')]=_[_0xbbde('0x32')](_0x1ee462[_0xbbde('0x2f')],_0x1ee462[_0xbbde('0x30')]);_0x5ac8a2[_0xbbde('0x33')]=_[_0xbbde('0x32')](_0x1ee462[_0xbbde('0x2f')],qs[_0xbbde('0x34')](_0x18bc12[_0xbbde('0x30')]['fields']));_0x5ac8a2[_0xbbde('0x33')]=_0x5ac8a2[_0xbbde('0x33')][_0xbbde('0x35')]?_0x5ac8a2[_0xbbde('0x33')]:_0x1ee462['model'];if(!_0x18bc12['query'][_0xbbde('0x36')](_0xbbde('0x37'))){_0x5ac8a2[_0xbbde('0x1e')]=qs[_0xbbde('0x1e')](_0x18bc12['query'][_0xbbde('0x1e')]);_0x5ac8a2['offset']=qs[_0xbbde('0x1c')](_0x18bc12[_0xbbde('0x30')][_0xbbde('0x1c')]);}_0x5ac8a2[_0xbbde('0x38')]=qs[_0xbbde('0x39')](_0x18bc12['query'][_0xbbde('0x39')]);_0x5ac8a2[_0xbbde('0x3a')]=qs['filters'](_[_0xbbde('0x3b')](_0x18bc12[_0xbbde('0x30')],_0x1ee462['filters']),_0x2762ed);if(_0x18bc12[_0xbbde('0x30')]['filter']){_0x5ac8a2[_0xbbde('0x3a')]=_[_0xbbde('0x3c')](_0x5ac8a2[_0xbbde('0x3a')],{'$or':_['map'](_0x2762ed,function(_0x17cc96){if(_0x17cc96[_0xbbde('0x2d')]!=='VIRTUAL'){var _0x32d03f={};_0x32d03f[_0x17cc96['name']]={'$like':'%'+_0x18bc12[_0xbbde('0x30')][_0xbbde('0x3d')]+'%'};return _0x32d03f;}})});}_0x5ac8a2=_['merge']({},_0x5ac8a2,_0x18bc12[_0xbbde('0x3e')]);var _0x1b79c9={'where':_0x5ac8a2[_0xbbde('0x3a')]};return db[_0xbbde('0x2b')]['count'](_0x1b79c9)[_0xbbde('0x25')](function(_0x4670de){_0x22413b['count']=_0x4670de;if(_0x18bc12[_0xbbde('0x30')][_0xbbde('0x3f')]){_0x5ac8a2[_0xbbde('0x40')]=[{'all':!![]}];}return db[_0xbbde('0x2b')]['findAll'](_0x5ac8a2);})[_0xbbde('0x25')](function(_0x89aad1){_0x22413b['rows']=_0x89aad1;return _0x22413b;})[_0xbbde('0x25')](respondWithFilteredResult(_0x36a98a,_0x5ac8a2))['catch'](handleError(_0x36a98a,null));};exports['show']=function(_0x82cc4d,_0x6a5b40){var _0x3110d8={'raw':![],'where':{'id':_0x82cc4d[_0xbbde('0x41')]['id']}},_0xfa2709={};_0xfa2709[_0xbbde('0x2f')]=_['keys'](db[_0xbbde('0x2b')][_0xbbde('0x42')]);_0xfa2709[_0xbbde('0x30')]=_[_0xbbde('0x43')](_0x82cc4d[_0xbbde('0x30')]);_0xfa2709['filters']=_[_0xbbde('0x32')](_0xfa2709[_0xbbde('0x2f')],_0xfa2709[_0xbbde('0x30')]);_0x3110d8['attributes']=_['intersection'](_0xfa2709['model'],qs[_0xbbde('0x34')](_0x82cc4d['query'][_0xbbde('0x34')]));_0x3110d8[_0xbbde('0x33')]=_0x3110d8[_0xbbde('0x33')][_0xbbde('0x35')]?_0x3110d8['attributes']:_0xfa2709[_0xbbde('0x2f')];if(_0x82cc4d[_0xbbde('0x30')][_0xbbde('0x3f')]){_0x3110d8[_0xbbde('0x40')]=[{'all':!![]}];}_0x3110d8=_[_0xbbde('0x3c')]({},_0x3110d8,_0x82cc4d['options']);return db['FreshdeskAccount']['find'](_0x3110d8)[_0xbbde('0x25')](handleEntityNotFound(_0x6a5b40,null))[_0xbbde('0x25')](respondWithResult(_0x6a5b40,null))[_0xbbde('0x44')](handleError(_0x6a5b40,null));};exports['create']=function(_0x48aecb,_0x25b8b6){return db['FreshdeskAccount'][_0xbbde('0x45')](_0x48aecb['body'],{})[_0xbbde('0x25')](respondWithResult(_0x25b8b6,0xc9))['catch'](handleError(_0x25b8b6,null));};exports['update']=function(_0x356109,_0x33adf2){if(_0x356109[_0xbbde('0x46')]['id']){delete _0x356109['body']['id'];}return db['FreshdeskAccount'][_0xbbde('0x47')]({'where':{'id':_0x356109[_0xbbde('0x41')]['id']}})['then'](handleEntityNotFound(_0x33adf2,null))[_0xbbde('0x25')](saveUpdates(_0x356109[_0xbbde('0x46')],null))[_0xbbde('0x25')](respondWithResult(_0x33adf2,null))['catch'](handleError(_0x33adf2,null));};exports[_0xbbde('0x26')]=function(_0x341d5f,_0x222eee){return db['FreshdeskAccount'][_0xbbde('0x47')]({'where':{'id':_0x341d5f['params']['id']}})[_0xbbde('0x25')](handleEntityNotFound(_0x222eee,null))[_0xbbde('0x25')](removeEntity(_0x222eee,null))[_0xbbde('0x44')](handleError(_0x222eee,null));};exports['getConfigurations']=function(_0x45d479,_0x5917b2,_0x428501){var _0x37c2ea={};var _0x2b4810={};var _0x2a2228;var _0x278e40;return db['FreshdeskAccount'][_0xbbde('0x48')]({'where':{'id':_0x45d479['params']['id']}})[_0xbbde('0x25')](handleEntityNotFound(_0x5917b2,null))[_0xbbde('0x25')](function(_0x47759a){if(_0x47759a){_0x2a2228=_0x47759a;_0x2b4810[_0xbbde('0x2f')]=_['keys'](db['FreshdeskConfiguration'][_0xbbde('0x42')]);_0x2b4810[_0xbbde('0x30')]=_['keys'](_0x45d479[_0xbbde('0x30')]);_0x2b4810[_0xbbde('0x31')]=_['intersection'](_0x2b4810[_0xbbde('0x2f')],_0x2b4810['query']);_0x37c2ea[_0xbbde('0x33')]=_['intersection'](_0x2b4810[_0xbbde('0x2f')],qs[_0xbbde('0x34')](_0x45d479[_0xbbde('0x30')][_0xbbde('0x34')]));_0x37c2ea[_0xbbde('0x33')]=_0x37c2ea[_0xbbde('0x33')][_0xbbde('0x35')]?_0x37c2ea[_0xbbde('0x33')]:_0x2b4810['model'];_0x37c2ea[_0xbbde('0x38')]=qs[_0xbbde('0x39')](_0x45d479['query'][_0xbbde('0x39')]);_0x37c2ea['where']=qs[_0xbbde('0x31')](_[_0xbbde('0x3b')](_0x45d479[_0xbbde('0x30')],_0x2b4810[_0xbbde('0x31')]));if(_0x45d479['query'][_0xbbde('0x3d')]){_0x37c2ea['where']=_[_0xbbde('0x3c')](_0x37c2ea[_0xbbde('0x3a')],{'$or':_[_0xbbde('0x2a')](_0x37c2ea[_0xbbde('0x33')],function(_0x39880c){var _0x4d0826={};_0x4d0826[_0x39880c]={'$like':'%'+_0x45d479['query'][_0xbbde('0x3d')]+'%'};return _0x4d0826;})});}_0x37c2ea=_[_0xbbde('0x3c')]({},_0x37c2ea,_0x45d479[_0xbbde('0x3e')]);return _0x2a2228[_0xbbde('0x49')](_0x37c2ea);}})[_0xbbde('0x25')](function(_0x24e86c){if(_0x24e86c){_0x278e40=_0x24e86c[_0xbbde('0x35')];if(!_0x45d479[_0xbbde('0x30')][_0xbbde('0x36')](_0xbbde('0x37'))){_0x37c2ea[_0xbbde('0x1e')]=qs[_0xbbde('0x1e')](_0x45d479[_0xbbde('0x30')]['limit']);_0x37c2ea[_0xbbde('0x1c')]=qs[_0xbbde('0x1c')](_0x45d479[_0xbbde('0x30')]['offset']);}return _0x2a2228[_0xbbde('0x49')](_0x37c2ea);}})['then'](function(_0x53bab3){if(_0x53bab3){return _0x53bab3?{'count':_0x278e40,'rows':_0x53bab3}:null;}})[_0xbbde('0x25')](respondWithResult(_0x5917b2,null))['catch'](handleError(_0x5917b2,null));};exports[_0xbbde('0x4a')]=function(_0x43238f,_0x56bb00,_0x2d5ec3){if(_0x43238f[_0xbbde('0x46')]['id']){delete _0x43238f[_0xbbde('0x46')]['id'];}return db[_0xbbde('0x2b')]['findOne']({'where':{'id':_0x43238f[_0xbbde('0x41')]['id']}})['then'](handleEntityNotFound(_0x56bb00,null))[_0xbbde('0x25')](function(_0x4b4b41){if(_0x4b4b41){_0x43238f[_0xbbde('0x46')]['AccountId']=_0x4b4b41['id'];_0x43238f['body'][_0xbbde('0x4b')]=integrations['getSubjects'](_0x43238f['body'][_0xbbde('0x4c')],_0x43238f[_0xbbde('0x46')][_0xbbde('0x2d')]);_0x43238f[_0xbbde('0x46')][_0xbbde('0x4d')]=integrations[_0xbbde('0x4e')](_0x43238f['body'][_0xbbde('0x4c')],_0x43238f[_0xbbde('0x46')][_0xbbde('0x2d')]);return db['FreshdeskConfiguration'][_0xbbde('0x45')](_0x43238f[_0xbbde('0x46')],{'include':[{'model':db[_0xbbde('0x4f')],'as':_0xbbde('0x4b')},{'model':db[_0xbbde('0x4f')],'as':_0xbbde('0x4d')}]});}return null;})['then'](respondWithResult(_0x56bb00,null))[_0xbbde('0x44')](handleError(_0x56bb00,null));};exports[_0xbbde('0x50')]=function(_0x2db950,_0x58e526,_0x14d543){var _0x2ff894='';return db[_0xbbde('0x2b')][_0xbbde('0x48')]({'where':{'id':_0x2db950[_0xbbde('0x41')]['id']},'attributes':['id',_0xbbde('0x51'),_0xbbde('0x52')]})[_0xbbde('0x25')](handleEntityNotFound(_0x58e526,null))[_0xbbde('0x25')](function(_0x32472b){if(_0x32472b){_0x2ff894=_0x32472b['remoteUri'];var _0x5bc8b2=_0x2ff894[_0xbbde('0x53')](-0x1);if(_0x5bc8b2==='/'){_0x2ff894=_0x2ff894[_0xbbde('0x54')](0x0,_0x2ff894[_0xbbde('0x55')](_0x5bc8b2));}return rp({'method':_0xbbde('0x56'),'uri':util['format'](_0xbbde('0x57'),_0x2ff894,_0xbbde('0x58')),'headers':{'Authorization':util['format'](_0xbbde('0x59'),new Buffer(util[_0xbbde('0x5a')](_0xbbde('0x5b'),_0x32472b[_0xbbde('0x52')]))['toString'](_0xbbde('0x5c')))},'json':!![]});}})['then'](function(_0x3934f9){if(_0x3934f9){var _0x5025fe=[_0xbbde('0x5d'),_0xbbde('0x5e'),_0xbbde('0x5f'),_0xbbde('0x60'),_0xbbde('0x18'),_0xbbde('0x61'),_0xbbde('0x62'),_0xbbde('0x63'),'ticket_type','group',_0xbbde('0x64')];_[_0xbbde('0x65')](_0x3934f9,function(_0xc8d997){return _0x5025fe[_0xbbde('0x66')](_0xc8d997['name'])||!_0xc8d997[_0xbbde('0x67')]&&_0xc8d997[_0xbbde('0x2d')]!==_0xbbde('0x68')&&_0xc8d997[_0xbbde('0x2d')]!==_0xbbde('0x69');});return{'count':_0x3934f9['length'],'rows':_[_0xbbde('0x2a')](_0x3934f9,function(_0x2cfea8){return{'id':_0x2cfea8[_0xbbde('0x29')],'name':_0x2cfea8[_0xbbde('0x6a')],'custom':!_0x2cfea8[_0xbbde('0x67')],'options':_0x2cfea8['choices']?_[_0xbbde('0x2a')](_0x2cfea8[_0xbbde('0x6b')],function(_0x15fd76){return{'name':_[_0xbbde('0x6c')](_0x15fd76),'value':_0x15fd76};}):[]};})};}})[_0xbbde('0x25')](respondWithResult(_0x58e526,null))[_0xbbde('0x44')](function(_0x1deee1){var _0x5e125d=_0x2db950[_0xbbde('0x30')][_0xbbde('0x6d')]?0x1f4:_0x1deee1['statusCode']||0x1f4;logger[_0xbbde('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xbbde('0x50'),_0x5e125d,JSON[_0xbbde('0x6e')](_0x1deee1));delete _0x1deee1['name'];if(_0x5e125d===0x191){_0x5e125d=0x190;}_0x58e526[_0xbbde('0x18')](_0x5e125d)[_0xbbde('0x6f')](_0x2db950[_0xbbde('0x30')][_0xbbde('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x1deee1[_0xbbde('0x70')]}:_0x1deee1);});}; \ No newline at end of file +var _0x25a3=['merge','options','FreshdeskAccount','includeAll','include','findAll','rows','catch','show','keys','create','body','params','find','findOne','pick','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskConfiguration','FreshdeskField','getFields','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','priority','ticket_type','group','company','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x25a3,0x121));var _0x325a=function(_0x443732,_0x644284){_0x443732=_0x443732-0x0;var _0x2d8440=_0x25a3[_0x443732];return _0x2d8440;};'use strict';var emlformat=require(_0x325a('0x0'));var rimraf=require(_0x325a('0x1'));var zipdir=require(_0x325a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x325a('0x3'));var moment=require('moment');var BPromise=require(_0x325a('0x4'));var Mustache=require(_0x325a('0x5'));var util=require(_0x325a('0x6'));var path=require('path');var sox=require(_0x325a('0x7'));var csv=require(_0x325a('0x8'));var ejs=require(_0x325a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x325a('0xa'));var crypto=require(_0x325a('0xb'));var jsforce=require(_0x325a('0xc'));var deskjs=require(_0x325a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x325a('0xe'));var Redis=require(_0x325a('0xf'));var authService=require(_0x325a('0x10'));var qs=require(_0x325a('0x11'));var as=require(_0x325a('0x12'));var hardwareService=require(_0x325a('0x13'));var logger=require('../../config/logger')(_0x325a('0x14'));var utils=require(_0x325a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x325a('0x16'));var db=require(_0x325a('0x17'))['db'];var integrations=require(_0x325a('0x18'));function respondWithStatusCode(_0x3e90fe,_0x4e3b88){_0x4e3b88=_0x4e3b88||0xcc;return function(_0x596519){if(_0x596519){return _0x3e90fe[_0x325a('0x19')](_0x4e3b88);}return _0x3e90fe['status'](_0x4e3b88)[_0x325a('0x1a')]();};}function respondWithResult(_0xa8dc3a,_0x3db556){_0x3db556=_0x3db556||0xc8;return function(_0x28d6d3){if(_0x28d6d3){return _0xa8dc3a[_0x325a('0x1b')](_0x3db556)[_0x325a('0x1c')](_0x28d6d3);}};}function respondWithFilteredResult(_0x1d7efc,_0x4412ba){return function(_0x1fd4ec){if(_0x1fd4ec){var _0x1b0f33=typeof _0x4412ba[_0x325a('0x1d')]===_0x325a('0x1e')&&typeof _0x4412ba[_0x325a('0x1f')]===_0x325a('0x1e');var _0x4d934d=_0x1fd4ec[_0x325a('0x20')];var _0x4fbd50=_0x1b0f33?0x0:_0x4412ba['offset'];var _0x34c4c8=_0x1b0f33?_0x1fd4ec[_0x325a('0x20')]:_0x4412ba[_0x325a('0x1d')]+_0x4412ba[_0x325a('0x1f')];var _0x1ea710;if(_0x34c4c8>=_0x4d934d){_0x34c4c8=_0x4d934d;_0x1ea710=0xc8;}else{_0x1ea710=0xce;}_0x1d7efc[_0x325a('0x1b')](_0x1ea710);return _0x1d7efc[_0x325a('0x21')](_0x325a('0x22'),_0x4fbd50+'-'+_0x34c4c8+'/'+_0x4d934d)[_0x325a('0x1c')](_0x1fd4ec);}return null;};}function patchUpdates(_0x1d76b7){return function(_0x36c634){try{jsonpatch[_0x325a('0x23')](_0x36c634,_0x1d76b7,!![]);}catch(_0x5bd4e5){return BPromise[_0x325a('0x24')](_0x5bd4e5);}return _0x36c634[_0x325a('0x25')]();};}function saveUpdates(_0x18e29f,_0x192e83){return function(_0x2535ef){if(_0x2535ef){return _0x2535ef[_0x325a('0x26')](_0x18e29f)['then'](function(_0x36b2ac){return _0x36b2ac;});}return null;};}function removeEntity(_0x4c403d,_0x15b5a6){return function(_0x3e6934){if(_0x3e6934){return _0x3e6934[_0x325a('0x27')]()[_0x325a('0x28')](function(){_0x4c403d[_0x325a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29543e,_0x4b4155){return function(_0x13e86b){if(!_0x13e86b){_0x29543e[_0x325a('0x19')](0x194);}return _0x13e86b;};}function handleError(_0x41d0d2,_0x5ad31d){_0x5ad31d=_0x5ad31d||0x1f4;return function(_0x2ff37a){logger[_0x325a('0x29')](_0x2ff37a[_0x325a('0x2a')]);if(_0x2ff37a[_0x325a('0x2b')]){delete _0x2ff37a[_0x325a('0x2b')];}_0x41d0d2[_0x325a('0x1b')](_0x5ad31d)[_0x325a('0x2c')](_0x2ff37a);};}exports[_0x325a('0x2d')]=function(_0x44468d,_0x5cdfd1){var _0x201e01={},_0x3fa4f6={},_0xb10b39={'count':0x0,'rows':[]};var _0x19a3b0=_[_0x325a('0x2e')](db['FreshdeskAccount'][_0x325a('0x2f')],function(_0x4b1e46){return{'name':_0x4b1e46[_0x325a('0x30')],'type':_0x4b1e46[_0x325a('0x31')]['key']};});_0x3fa4f6[_0x325a('0x32')]=_[_0x325a('0x2e')](_0x19a3b0,_0x325a('0x2b'));_0x3fa4f6[_0x325a('0x33')]=_['keys'](_0x44468d[_0x325a('0x33')]);_0x3fa4f6[_0x325a('0x34')]=_[_0x325a('0x35')](_0x3fa4f6[_0x325a('0x32')],_0x3fa4f6['query']);_0x201e01[_0x325a('0x36')]=_[_0x325a('0x35')](_0x3fa4f6[_0x325a('0x32')],qs[_0x325a('0x37')](_0x44468d[_0x325a('0x33')][_0x325a('0x37')]));_0x201e01['attributes']=_0x201e01[_0x325a('0x36')][_0x325a('0x38')]?_0x201e01['attributes']:_0x3fa4f6[_0x325a('0x32')];if(!_0x44468d[_0x325a('0x33')]['hasOwnProperty'](_0x325a('0x39'))){_0x201e01['limit']=qs[_0x325a('0x1f')](_0x44468d[_0x325a('0x33')][_0x325a('0x1f')]);_0x201e01[_0x325a('0x1d')]=qs['offset'](_0x44468d[_0x325a('0x33')]['offset']);}_0x201e01[_0x325a('0x3a')]=qs['sort'](_0x44468d['query'][_0x325a('0x3b')]);_0x201e01[_0x325a('0x3c')]=qs[_0x325a('0x34')](_['pick'](_0x44468d[_0x325a('0x33')],_0x3fa4f6['filters']),_0x19a3b0);if(_0x44468d[_0x325a('0x33')][_0x325a('0x3d')]){_0x201e01[_0x325a('0x3c')]=_[_0x325a('0x3e')](_0x201e01[_0x325a('0x3c')],{'$or':_[_0x325a('0x2e')](_0x19a3b0,function(_0x10b7bf){if(_0x10b7bf[_0x325a('0x31')]!=='VIRTUAL'){var _0x45b9cc={};_0x45b9cc[_0x10b7bf[_0x325a('0x2b')]]={'$like':'%'+_0x44468d[_0x325a('0x33')][_0x325a('0x3d')]+'%'};return _0x45b9cc;}})});}_0x201e01=_[_0x325a('0x3e')]({},_0x201e01,_0x44468d[_0x325a('0x3f')]);var _0x1adb83={'where':_0x201e01[_0x325a('0x3c')]};return db[_0x325a('0x40')]['count'](_0x1adb83)[_0x325a('0x28')](function(_0x2eed88){_0xb10b39[_0x325a('0x20')]=_0x2eed88;if(_0x44468d[_0x325a('0x33')][_0x325a('0x41')]){_0x201e01[_0x325a('0x42')]=[{'all':!![]}];}return db[_0x325a('0x40')][_0x325a('0x43')](_0x201e01);})[_0x325a('0x28')](function(_0xefcc28){_0xb10b39[_0x325a('0x44')]=_0xefcc28;return _0xb10b39;})['then'](respondWithFilteredResult(_0x5cdfd1,_0x201e01))[_0x325a('0x45')](handleError(_0x5cdfd1,null));};exports[_0x325a('0x46')]=function(_0x415825,_0x128d53){var _0x2750dd={'raw':![],'where':{'id':_0x415825['params']['id']}},_0x39a6f7={};_0x39a6f7[_0x325a('0x32')]=_[_0x325a('0x47')](db[_0x325a('0x40')][_0x325a('0x2f')]);_0x39a6f7[_0x325a('0x33')]=_['keys'](_0x415825[_0x325a('0x33')]);_0x39a6f7[_0x325a('0x34')]=_[_0x325a('0x35')](_0x39a6f7['model'],_0x39a6f7[_0x325a('0x33')]);_0x2750dd[_0x325a('0x36')]=_[_0x325a('0x35')](_0x39a6f7['model'],qs['fields'](_0x415825[_0x325a('0x33')][_0x325a('0x37')]));_0x2750dd[_0x325a('0x36')]=_0x2750dd[_0x325a('0x36')]['length']?_0x2750dd[_0x325a('0x36')]:_0x39a6f7[_0x325a('0x32')];if(_0x415825['query'][_0x325a('0x41')]){_0x2750dd[_0x325a('0x42')]=[{'all':!![]}];}_0x2750dd=_['merge']({},_0x2750dd,_0x415825[_0x325a('0x3f')]);return db[_0x325a('0x40')]['find'](_0x2750dd)[_0x325a('0x28')](handleEntityNotFound(_0x128d53,null))['then'](respondWithResult(_0x128d53,null))['catch'](handleError(_0x128d53,null));};exports[_0x325a('0x48')]=function(_0x26721a,_0x7486ba){return db['FreshdeskAccount'][_0x325a('0x48')](_0x26721a[_0x325a('0x49')],{})['then'](respondWithResult(_0x7486ba,0xc9))['catch'](handleError(_0x7486ba,null));};exports[_0x325a('0x26')]=function(_0x2002c4,_0x5ac946){if(_0x2002c4[_0x325a('0x49')]['id']){delete _0x2002c4['body']['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x2002c4[_0x325a('0x4a')]['id']}})[_0x325a('0x28')](handleEntityNotFound(_0x5ac946,null))['then'](saveUpdates(_0x2002c4[_0x325a('0x49')],null))[_0x325a('0x28')](respondWithResult(_0x5ac946,null))['catch'](handleError(_0x5ac946,null));};exports[_0x325a('0x27')]=function(_0x2d00c4,_0x12a4c6){return db[_0x325a('0x40')][_0x325a('0x4b')]({'where':{'id':_0x2d00c4[_0x325a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12a4c6,null))[_0x325a('0x28')](removeEntity(_0x12a4c6,null))[_0x325a('0x45')](handleError(_0x12a4c6,null));};exports['getConfigurations']=function(_0x189b23,_0x508514,_0x2ed4ed){var _0x264cda={};var _0x2c938a={};var _0x454aca;var _0x2854e6;return db[_0x325a('0x40')][_0x325a('0x4c')]({'where':{'id':_0x189b23[_0x325a('0x4a')]['id']}})[_0x325a('0x28')](handleEntityNotFound(_0x508514,null))[_0x325a('0x28')](function(_0x52a211){if(_0x52a211){_0x454aca=_0x52a211;_0x2c938a[_0x325a('0x32')]=_[_0x325a('0x47')](db['FreshdeskConfiguration'][_0x325a('0x2f')]);_0x2c938a[_0x325a('0x33')]=_[_0x325a('0x47')](_0x189b23[_0x325a('0x33')]);_0x2c938a[_0x325a('0x34')]=_[_0x325a('0x35')](_0x2c938a[_0x325a('0x32')],_0x2c938a[_0x325a('0x33')]);_0x264cda[_0x325a('0x36')]=_[_0x325a('0x35')](_0x2c938a[_0x325a('0x32')],qs[_0x325a('0x37')](_0x189b23[_0x325a('0x33')][_0x325a('0x37')]));_0x264cda['attributes']=_0x264cda[_0x325a('0x36')][_0x325a('0x38')]?_0x264cda[_0x325a('0x36')]:_0x2c938a[_0x325a('0x32')];_0x264cda[_0x325a('0x3a')]=qs[_0x325a('0x3b')](_0x189b23[_0x325a('0x33')][_0x325a('0x3b')]);_0x264cda[_0x325a('0x3c')]=qs[_0x325a('0x34')](_[_0x325a('0x4d')](_0x189b23[_0x325a('0x33')],_0x2c938a['filters']));if(_0x189b23[_0x325a('0x33')][_0x325a('0x3d')]){_0x264cda['where']=_[_0x325a('0x3e')](_0x264cda[_0x325a('0x3c')],{'$or':_[_0x325a('0x2e')](_0x264cda['attributes'],function(_0x55eb10){var _0x44af6b={};_0x44af6b[_0x55eb10]={'$like':'%'+_0x189b23[_0x325a('0x33')][_0x325a('0x3d')]+'%'};return _0x44af6b;})});}_0x264cda=_[_0x325a('0x3e')]({},_0x264cda,_0x189b23[_0x325a('0x3f')]);return _0x454aca[_0x325a('0x4e')](_0x264cda);}})[_0x325a('0x28')](function(_0x12d276){if(_0x12d276){_0x2854e6=_0x12d276['length'];if(!_0x189b23[_0x325a('0x33')][_0x325a('0x4f')](_0x325a('0x39'))){_0x264cda[_0x325a('0x1f')]=qs[_0x325a('0x1f')](_0x189b23[_0x325a('0x33')][_0x325a('0x1f')]);_0x264cda[_0x325a('0x1d')]=qs[_0x325a('0x1d')](_0x189b23[_0x325a('0x33')][_0x325a('0x1d')]);}return _0x454aca[_0x325a('0x4e')](_0x264cda);}})[_0x325a('0x28')](function(_0xcdfbc2){if(_0xcdfbc2){return _0xcdfbc2?{'count':_0x2854e6,'rows':_0xcdfbc2}:null;}})['then'](respondWithResult(_0x508514,null))[_0x325a('0x45')](handleError(_0x508514,null));};exports[_0x325a('0x50')]=function(_0x5c7681,_0x3a7d44,_0x415524){if(_0x5c7681[_0x325a('0x49')]['id']){delete _0x5c7681[_0x325a('0x49')]['id'];}return db[_0x325a('0x40')][_0x325a('0x4c')]({'where':{'id':_0x5c7681['params']['id']}})[_0x325a('0x28')](handleEntityNotFound(_0x3a7d44,null))[_0x325a('0x28')](function(_0x286572){if(_0x286572){_0x5c7681[_0x325a('0x49')][_0x325a('0x51')]=_0x286572['id'];_0x5c7681['body'][_0x325a('0x52')]=integrations[_0x325a('0x53')](_0x5c7681['body']['channel'],_0x5c7681[_0x325a('0x49')]['type']);_0x5c7681['body'][_0x325a('0x54')]=integrations[_0x325a('0x55')](_0x5c7681['body'][_0x325a('0x56')],_0x5c7681[_0x325a('0x49')]['type']);return db[_0x325a('0x57')]['create'](_0x5c7681[_0x325a('0x49')],{'include':[{'model':db[_0x325a('0x58')],'as':_0x325a('0x52')},{'model':db[_0x325a('0x58')],'as':_0x325a('0x54')}]});}return null;})[_0x325a('0x28')](respondWithResult(_0x3a7d44,null))['catch'](handleError(_0x3a7d44,null));};exports[_0x325a('0x59')]=function(_0x2ddfa0,_0x3b9520,_0x5168de){var _0x47e360='';return db['FreshdeskAccount'][_0x325a('0x4c')]({'where':{'id':_0x2ddfa0[_0x325a('0x4a')]['id']},'attributes':['id','remoteUri',_0x325a('0x5a')]})[_0x325a('0x28')](handleEntityNotFound(_0x3b9520,null))['then'](function(_0x423fd5){if(_0x423fd5){_0x47e360=_0x423fd5['remoteUri'];var _0xa1cacf=_0x47e360[_0x325a('0x5b')](-0x1);if(_0xa1cacf==='/'){_0x47e360=_0x47e360[_0x325a('0x5c')](0x0,_0x47e360[_0x325a('0x5d')](_0xa1cacf));}return rp({'method':_0x325a('0x5e'),'uri':util[_0x325a('0x5f')](_0x325a('0x60'),_0x47e360,_0x325a('0x61')),'headers':{'Authorization':util[_0x325a('0x5f')](_0x325a('0x62'),new Buffer(util[_0x325a('0x5f')](_0x325a('0x63'),_0x423fd5[_0x325a('0x5a')]))['toString'](_0x325a('0x64')))},'json':!![]});}})[_0x325a('0x28')](function(_0x54acd0){if(_0x54acd0){var _0x1c5d62=[_0x325a('0x65'),_0x325a('0x66'),'agent','description',_0x325a('0x1b'),_0x325a('0x67'),'group','source',_0x325a('0x68'),_0x325a('0x69'),_0x325a('0x6a')];_['remove'](_0x54acd0,function(_0x1cbe07){return _0x1c5d62[_0x325a('0x6b')](_0x1cbe07['name'])||!_0x1cbe07[_0x325a('0x6c')]&&_0x1cbe07[_0x325a('0x31')]!==_0x325a('0x6d')&&_0x1cbe07[_0x325a('0x31')]!=='custom_dropdown';});return{'count':_0x54acd0[_0x325a('0x38')],'rows':_[_0x325a('0x2e')](_0x54acd0,function(_0x398f31){return{'id':_0x398f31[_0x325a('0x2b')],'name':_0x398f31[_0x325a('0x6e')],'custom':!_0x398f31[_0x325a('0x6c')],'options':_0x398f31[_0x325a('0x6f')]?_[_0x325a('0x2e')](_0x398f31['choices'],function(_0x4c33a4){return{'name':_[_0x325a('0x70')](_0x4c33a4),'value':_0x4c33a4};}):[]};})};}})['then'](respondWithResult(_0x3b9520,null))[_0x325a('0x45')](function(_0x573c8){var _0x32a397=_0x2ddfa0[_0x325a('0x33')][_0x325a('0x71')]?0x1f4:_0x573c8[_0x325a('0x72')]||0x1f4;logger[_0x325a('0x29')](_0x325a('0x73'),_0x325a('0x59'),_0x32a397,JSON[_0x325a('0x74')](_0x573c8));delete _0x573c8[_0x325a('0x2b')];if(_0x32a397===0x191){_0x32a397=0x190;}_0x3b9520[_0x325a('0x1b')](_0x32a397)['send'](_0x2ddfa0[_0x325a('0x33')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x573c8[_0x325a('0x72')]}:_0x573c8);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index c0cb469..74cbc5b 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 _0xfff9=['FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x2064ed,_0x8530f){var _0x3413d1=function(_0x4408ac){while(--_0x4408ac){_0x2064ed['push'](_0x2064ed['shift']());}};_0x3413d1(++_0x8530f);}(_0xfff9,0x1be));var _0x9fff=function(_0x4f67a2,_0x273325){_0x4f67a2=_0x4f67a2-0x0;var _0x42beb3=_0xfff9[_0x4f67a2];return _0x42beb3;};'use strict';var _=require(_0x9fff('0x0'));var util=require(_0x9fff('0x1'));var logger=require(_0x9fff('0x2'))('api');var moment=require(_0x9fff('0x3'));var BPromise=require(_0x9fff('0x4'));var rp=require(_0x9fff('0x5'));var fs=require('fs');var path=require(_0x9fff('0x6'));var rimraf=require(_0x9fff('0x7'));var config=require('../../config/environment');var attributes=require(_0x9fff('0x8'));var integrations=require(_0x9fff('0x9'));module['exports']=function(_0x489305,_0x177e30){return _0x489305['define'](_0x9fff('0xa'),attributes,{'tableName':_0x9fff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72fc=['../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x1b5d5f,_0x5ed766){var _0x3c9347=function(_0x21afdd){while(--_0x21afdd){_0x1b5d5f['push'](_0x1b5d5f['shift']());}};_0x3c9347(++_0x5ed766);}(_0x72fc,0x65));var _0xc72f=function(_0x32cb46,_0x399aa7){_0x32cb46=_0x32cb46-0x0;var _0x5c67b5=_0x72fc[_0x32cb46];return _0x5c67b5;};'use strict';var _=require(_0xc72f('0x0'));var util=require(_0xc72f('0x1'));var logger=require('../../config/logger')(_0xc72f('0x2'));var moment=require(_0xc72f('0x3'));var BPromise=require('bluebird');var rp=require(_0xc72f('0x4'));var fs=require('fs');var path=require(_0xc72f('0x5'));var rimraf=require(_0xc72f('0x6'));var config=require(_0xc72f('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xc72f('0x8'));module[_0xc72f('0x9')]=function(_0x356281,_0x2e3f13){return _0x356281[_0xc72f('0xa')](_0xc72f('0xb'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 2ccb3e6..dd9b9b2 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 _0xd634=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','findAll','raw','options','where','limit','include','map','attributes','model','then','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xd634,0x151));var _0x4d63=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0xd634[_0x11ca63];return _0x41f1f6;};'use strict';var _=require(_0x4d63('0x0'));var util=require(_0x4d63('0x1'));var moment=require(_0x4d63('0x2'));var BPromise=require(_0x4d63('0x3'));var rs=require(_0x4d63('0x4'));var fs=require('fs');var Redis=require(_0x4d63('0x5'));var db=require(_0x4d63('0x6'))['db'];var utils=require(_0x4d63('0x7'));var logger=require(_0x4d63('0x8'))(_0x4d63('0x9'));var config=require('../../config/environment');var jayson=require(_0x4d63('0xa'));var client=jayson[_0x4d63('0xb')][_0x4d63('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a28b8,_0x42c748,_0x3578d0){return new BPromise(function(_0x269b6b,_0x1421d0){return client['request'](_0x1a28b8,_0x3578d0)['then'](function(_0x16c4dc){logger['info'](_0x4d63('0xd'),_0x42c748,_0x4d63('0xe'));logger[_0x4d63('0xf')](_0x4d63('0x10'),_0x42c748,'request\x20sent',JSON[_0x4d63('0x11')](_0x16c4dc));if(_0x16c4dc['error']){if(_0x16c4dc[_0x4d63('0x12')][_0x4d63('0x13')]===0x1f4){logger['error'](_0x4d63('0xd'),_0x42c748,_0x16c4dc[_0x4d63('0x12')][_0x4d63('0x14')]);return _0x1421d0(_0x16c4dc[_0x4d63('0x12')][_0x4d63('0x14')]);}logger[_0x4d63('0x12')](_0x4d63('0xd'),_0x42c748,_0x16c4dc[_0x4d63('0x12')][_0x4d63('0x14')]);return _0x269b6b(_0x16c4dc[_0x4d63('0x12')][_0x4d63('0x14')]);}else{logger[_0x4d63('0x15')](_0x4d63('0xd'),_0x42c748,'request\x20sent');_0x269b6b(_0x16c4dc[_0x4d63('0x16')][_0x4d63('0x14')]);}})[_0x4d63('0x17')](function(_0x3ed512){logger[_0x4d63('0x12')](_0x4d63('0xd'),_0x42c748,_0x3ed512);_0x1421d0(_0x3ed512);});});}exports[_0x4d63('0x18')]=function(_0x20f810){var _0x413050=this;return new Promise(function(_0x603dc3,_0x3922a3){return db['FreshdeskAccount'][_0x4d63('0x19')]({'raw':_0x20f810['options']?_0x20f810['options'][_0x4d63('0x1a')]===undefined?!![]:![]:!![],'where':_0x20f810['options']?_0x20f810[_0x4d63('0x1b')][_0x4d63('0x1c')]||null:null,'attributes':_0x20f810[_0x4d63('0x1b')]?_0x20f810[_0x4d63('0x1b')]['attributes']||null:null,'limit':_0x20f810[_0x4d63('0x1b')]?_0x20f810[_0x4d63('0x1b')][_0x4d63('0x1d')]||null:null,'include':_0x20f810[_0x4d63('0x1b')]?_0x20f810[_0x4d63('0x1b')][_0x4d63('0x1e')]?_[_0x4d63('0x1f')](_0x20f810['options'][_0x4d63('0x1e')],function(_0x26d29c){return{'model':db[_0x26d29c['model']],'as':_0x26d29c['as'],'attributes':_0x26d29c[_0x4d63('0x20')],'include':_0x26d29c[_0x4d63('0x1e')]?_[_0x4d63('0x1f')](_0x26d29c['include'],function(_0x484c30){return{'model':db[_0x484c30[_0x4d63('0x21')]],'as':_0x484c30['as'],'attributes':_0x484c30[_0x4d63('0x20')],'include':_0x484c30['include']?_[_0x4d63('0x1f')](_0x484c30[_0x4d63('0x1e')],function(_0x48197c){return{'model':db[_0x48197c[_0x4d63('0x21')]],'as':_0x48197c['as'],'attributes':_0x48197c[_0x4d63('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4d63('0x22')](function(_0x40e76b){logger[_0x4d63('0x15')](_0x4d63('0x18'),_0x20f810);logger[_0x4d63('0xf')](_0x4d63('0x18'),_0x20f810,JSON[_0x4d63('0x11')](_0x40e76b));_0x603dc3(_0x40e76b);})[_0x4d63('0x17')](function(_0x5d3051){logger[_0x4d63('0x12')](_0x4d63('0x18'),_0x5d3051[_0x4d63('0x14')],_0x20f810);_0x3922a3(_0x413050[_0x4d63('0x12')](0x1f4,_0x5d3051[_0x4d63('0x14')]));});});};exports[_0x4d63('0x23')]=function(_0x4ee7a5){var _0x2b0711=this;return new Promise(function(_0x4fd372,_0x22e805){return db[_0x4d63('0x24')][_0x4d63('0x25')]({'raw':_0x4ee7a5['options']?_0x4ee7a5[_0x4d63('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4ee7a5[_0x4d63('0x1b')]?_0x4ee7a5[_0x4d63('0x1b')][_0x4d63('0x1c')]||null:null,'attributes':_0x4ee7a5[_0x4d63('0x1b')]?_0x4ee7a5['options'][_0x4d63('0x20')]||null:null,'include':_0x4ee7a5[_0x4d63('0x1b')]?_0x4ee7a5[_0x4d63('0x1b')]['include']?_[_0x4d63('0x1f')](_0x4ee7a5['options']['include'],function(_0x10fa6b){return{'model':db[_0x10fa6b[_0x4d63('0x21')]],'as':_0x10fa6b['as'],'attributes':_0x10fa6b['attributes'],'include':_0x10fa6b[_0x4d63('0x1e')]?_[_0x4d63('0x1f')](_0x10fa6b[_0x4d63('0x1e')],function(_0x346b1b){return{'model':db[_0x346b1b[_0x4d63('0x21')]],'as':_0x346b1b['as'],'attributes':_0x346b1b['attributes'],'include':_0x346b1b[_0x4d63('0x1e')]?_[_0x4d63('0x1f')](_0x346b1b[_0x4d63('0x1e')],function(_0x553f56){return{'model':db[_0x553f56[_0x4d63('0x21')]],'as':_0x553f56['as'],'attributes':_0x553f56[_0x4d63('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2495e5){logger[_0x4d63('0x15')](_0x4d63('0x23'),_0x4ee7a5);logger['debug'](_0x4d63('0x23'),_0x4ee7a5,JSON[_0x4d63('0x11')](_0x2495e5));_0x4fd372(_0x2495e5);})[_0x4d63('0x17')](function(_0x251a8b){logger['error'](_0x4d63('0x23'),_0x251a8b[_0x4d63('0x14')],_0x4ee7a5);_0x22e805(_0x2b0711['error'](0x1f4,_0x251a8b['message']));});});}; \ No newline at end of file +var _0x7f58=['result','FreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetFreshdeskAccount','stringify','catch','ShowFreshdeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message'];(function(_0x4d1b48,_0x5951d8){var _0x5c5d4b=function(_0x21e1f3){while(--_0x21e1f3){_0x4d1b48['push'](_0x4d1b48['shift']());}};_0x5c5d4b(++_0x5951d8);}(_0x7f58,0xce));var _0x87f5=function(_0x4c9d58,_0x1c83f0){_0x4c9d58=_0x4c9d58-0x0;var _0x3ad22d=_0x7f58[_0x4c9d58];return _0x3ad22d;};'use strict';var _=require(_0x87f5('0x0'));var util=require('util');var moment=require(_0x87f5('0x1'));var BPromise=require(_0x87f5('0x2'));var rs=require(_0x87f5('0x3'));var fs=require('fs');var Redis=require(_0x87f5('0x4'));var db=require(_0x87f5('0x5'))['db'];var utils=require(_0x87f5('0x6'));var logger=require(_0x87f5('0x7'))('rpc');var config=require(_0x87f5('0x8'));var jayson=require(_0x87f5('0x9'));var client=jayson[_0x87f5('0xa')][_0x87f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8801c2,_0x198076,_0x1c7735){return new BPromise(function(_0x5a6123,_0x5063ce){return client[_0x87f5('0xc')](_0x8801c2,_0x1c7735)[_0x87f5('0xd')](function(_0x1892d1){logger[_0x87f5('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x198076,_0x87f5('0xf'));logger[_0x87f5('0x10')](_0x87f5('0x11'),_0x198076,_0x87f5('0xf'),JSON['stringify'](_0x1892d1));if(_0x1892d1[_0x87f5('0x12')]){if(_0x1892d1[_0x87f5('0x12')][_0x87f5('0x13')]===0x1f4){logger['error'](_0x87f5('0x14'),_0x198076,_0x1892d1['error'][_0x87f5('0x15')]);return _0x5063ce(_0x1892d1[_0x87f5('0x12')]['message']);}logger[_0x87f5('0x12')](_0x87f5('0x14'),_0x198076,_0x1892d1['error']['message']);return _0x5a6123(_0x1892d1['error'][_0x87f5('0x15')]);}else{logger[_0x87f5('0xe')](_0x87f5('0x14'),_0x198076,_0x87f5('0xf'));_0x5a6123(_0x1892d1[_0x87f5('0x16')][_0x87f5('0x15')]);}})['catch'](function(_0x3b49bc){logger['error'](_0x87f5('0x14'),_0x198076,_0x3b49bc);_0x5063ce(_0x3b49bc);});});}exports['GetFreshdeskAccount']=function(_0x551f87){var _0x5e5715=this;return new Promise(function(_0x3b912c,_0x5bf71d){return db[_0x87f5('0x17')][_0x87f5('0x18')]({'raw':_0x551f87[_0x87f5('0x19')]?_0x551f87['options'][_0x87f5('0x1a')]===undefined?!![]:![]:!![],'where':_0x551f87[_0x87f5('0x19')]?_0x551f87['options'][_0x87f5('0x1b')]||null:null,'attributes':_0x551f87[_0x87f5('0x19')]?_0x551f87['options']['attributes']||null:null,'limit':_0x551f87[_0x87f5('0x19')]?_0x551f87[_0x87f5('0x19')][_0x87f5('0x1c')]||null:null,'include':_0x551f87[_0x87f5('0x19')]?_0x551f87[_0x87f5('0x19')][_0x87f5('0x1d')]?_[_0x87f5('0x1e')](_0x551f87[_0x87f5('0x19')]['include'],function(_0x5b2c32){return{'model':db[_0x5b2c32[_0x87f5('0x1f')]],'as':_0x5b2c32['as'],'attributes':_0x5b2c32['attributes'],'include':_0x5b2c32[_0x87f5('0x1d')]?_[_0x87f5('0x1e')](_0x5b2c32[_0x87f5('0x1d')],function(_0x44536f){return{'model':db[_0x44536f[_0x87f5('0x1f')]],'as':_0x44536f['as'],'attributes':_0x44536f[_0x87f5('0x20')],'include':_0x44536f[_0x87f5('0x1d')]?_['map'](_0x44536f['include'],function(_0x7a8ba){return{'model':db[_0x7a8ba[_0x87f5('0x1f')]],'as':_0x7a8ba['as'],'attributes':_0x7a8ba['attributes']};}):[]};}):[]};}):[]:[]})[_0x87f5('0xd')](function(_0x54fb9e){logger[_0x87f5('0xe')](_0x87f5('0x21'),_0x551f87);logger[_0x87f5('0x10')](_0x87f5('0x21'),_0x551f87,JSON[_0x87f5('0x22')](_0x54fb9e));_0x3b912c(_0x54fb9e);})[_0x87f5('0x23')](function(_0x2a4ddd){logger[_0x87f5('0x12')]('GetFreshdeskAccount',_0x2a4ddd[_0x87f5('0x15')],_0x551f87);_0x5bf71d(_0x5e5715[_0x87f5('0x12')](0x1f4,_0x2a4ddd[_0x87f5('0x15')]));});});};exports[_0x87f5('0x24')]=function(_0x167b02){var _0x9f4610=this;return new Promise(function(_0x21f904,_0x3598e1){return db['FreshdeskAccount'][_0x87f5('0x25')]({'raw':_0x167b02['options']?_0x167b02[_0x87f5('0x19')][_0x87f5('0x1a')]===undefined?!![]:![]:!![],'where':_0x167b02['options']?_0x167b02[_0x87f5('0x19')][_0x87f5('0x1b')]||null:null,'attributes':_0x167b02['options']?_0x167b02[_0x87f5('0x19')][_0x87f5('0x20')]||null:null,'include':_0x167b02[_0x87f5('0x19')]?_0x167b02[_0x87f5('0x19')][_0x87f5('0x1d')]?_['map'](_0x167b02['options'][_0x87f5('0x1d')],function(_0x2a3fa7){return{'model':db[_0x2a3fa7[_0x87f5('0x1f')]],'as':_0x2a3fa7['as'],'attributes':_0x2a3fa7[_0x87f5('0x20')],'include':_0x2a3fa7[_0x87f5('0x1d')]?_[_0x87f5('0x1e')](_0x2a3fa7['include'],function(_0xb46712){return{'model':db[_0xb46712[_0x87f5('0x1f')]],'as':_0xb46712['as'],'attributes':_0xb46712[_0x87f5('0x20')],'include':_0xb46712[_0x87f5('0x1d')]?_['map'](_0xb46712[_0x87f5('0x1d')],function(_0x560a89){return{'model':db[_0x560a89[_0x87f5('0x1f')]],'as':_0x560a89['as'],'attributes':_0x560a89[_0x87f5('0x20')]};}):[]};}):[]};}):[]:[]})[_0x87f5('0xd')](function(_0x2583af){logger['info']('ShowFreshdeskAccount',_0x167b02);logger[_0x87f5('0x10')]('ShowFreshdeskAccount',_0x167b02,JSON[_0x87f5('0x22')](_0x2583af));_0x21f904(_0x2583af);})[_0x87f5('0x23')](function(_0x2442a5){logger['error']('ShowFreshdeskAccount',_0x2442a5['message'],_0x167b02);_0x3598e1(_0x9f4610[_0x87f5('0x12')](0x1f4,_0x2442a5[_0x87f5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 44d2df6..286fc4b 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 _0x44b0=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','setTags'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x44b0,0x1ad));var _0x044b=function(_0x2d8c93,_0x3c0f4d){_0x2d8c93=_0x2d8c93-0x0;var _0x5b9484=_0x44b0[_0x2d8c93];return _0x5b9484;};'use strict';var multer=require(_0x044b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x044b('0x1'));var express=require(_0x044b('0x2'));var router=express[_0x044b('0x3')]();var fs_extra=require(_0x044b('0x4'));var auth=require(_0x044b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x044b('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x044b('0x7')]('/',auth[_0x044b('0x8')](),controller[_0x044b('0x9')]);router[_0x044b('0x7')](_0x044b('0xa'),auth[_0x044b('0x8')](),controller[_0x044b('0xb')]);router[_0x044b('0x7')](_0x044b('0xc'),auth[_0x044b('0x8')](),controller[_0x044b('0xd')]);router['get'](_0x044b('0xe'),auth[_0x044b('0x8')](),controller[_0x044b('0xf')]);router[_0x044b('0x7')](_0x044b('0x10'),auth[_0x044b('0x8')](),controller[_0x044b('0x11')]);router[_0x044b('0x7')]('/:id/tags',auth[_0x044b('0x8')](),controller['getTags']);router[_0x044b('0x12')]('/',auth['isAuthenticated'](),controller[_0x044b('0x13')]);router[_0x044b('0x12')]('/:id/tags',auth[_0x044b('0x8')](),controller[_0x044b('0x14')]);router['put'](_0x044b('0xa'),auth[_0x044b('0x8')](),controller[_0x044b('0x15')]);router[_0x044b('0x16')](_0x044b('0xa'),auth[_0x044b('0x8')](),controller[_0x044b('0x17')]);module[_0x044b('0x18')]=router; \ No newline at end of file +var _0x54e8=['get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','/:id/tags','setTags','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller'];(function(_0xbcf21c,_0x2a47b9){var _0x4cdc04=function(_0x5bcbad){while(--_0x5bcbad){_0xbcf21c['push'](_0xbcf21c['shift']());}};_0x4cdc04(++_0x2a47b9);}(_0x54e8,0x1b1));var _0x854e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x54e8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x854e('0x0'));var util=require(_0x854e('0x1'));var path=require('path');var timeout=require(_0x854e('0x2'));var express=require('express');var router=express[_0x854e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x854e('0x4'));var interaction=require(_0x854e('0x5'));var config=require('../../config/environment');var controller=require(_0x854e('0x6'));router[_0x854e('0x7')]('/',auth[_0x854e('0x8')](),controller['index']);router[_0x854e('0x7')](_0x854e('0x9'),auth[_0x854e('0x8')](),controller[_0x854e('0xa')]);router[_0x854e('0x7')]('/:id/fields',auth[_0x854e('0x8')](),controller['getFields']);router[_0x854e('0x7')](_0x854e('0xb'),auth[_0x854e('0x8')](),controller[_0x854e('0xc')]);router['get'](_0x854e('0xd'),auth['isAuthenticated'](),controller[_0x854e('0xe')]);router[_0x854e('0x7')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0x854e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x854e('0xf')](_0x854e('0x10'),auth['isAuthenticated'](),controller[_0x854e('0x11')]);router['put'](_0x854e('0x9'),auth[_0x854e('0x8')](),controller['update']);router[_0x854e('0x12')]('/:id',auth[_0x854e('0x8')](),controller[_0x854e('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 1aa7551..a3b4e33 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 _0x20b1=['STRING','sequelize'];(function(_0x575a45,_0x28787a){var _0x356ac9=function(_0x5b379e){while(--_0x5b379e){_0x575a45['push'](_0x575a45['shift']());}};_0x356ac9(++_0x28787a);}(_0x20b1,0x113));var _0x120b=function(_0x292950,_0x59b776){_0x292950=_0x292950-0x0;var _0x1dd78a=_0x20b1[_0x292950];return _0x1dd78a;};'use strict';var Sequelize=require(_0x120b('0x0'));module['exports']={'name':{'type':Sequelize[_0x120b('0x1')]},'description':{'type':Sequelize[_0x120b('0x1')]}}; \ No newline at end of file +var _0x0354=['STRING','sequelize','exports'];(function(_0x5c6382,_0x5da3ef){var _0x19a5d2=function(_0x144dd2){while(--_0x144dd2){_0x5c6382['push'](_0x5c6382['shift']());}};_0x19a5d2(++_0x5da3ef);}(_0x0354,0x19c));var _0x4035=function(_0x4f49f3,_0x3171ac){_0x4f49f3=_0x4f49f3-0x0;var _0x49514a=_0x0354[_0x4f49f3];return _0x49514a;};'use strict';var Sequelize=require(_0x4035('0x0'));module[_0x4035('0x1')]={'name':{'type':Sequelize[_0x4035('0x2')]},'description':{'type':Sequelize[_0x4035('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 50adab8..d84c08c 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 _0x9d33=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','offset','order','sort','pick','where','merge','VIRTUAL','filter','options','FreshdeskConfiguration','includeAll','include','findAll','rows','catch','show','params','find','body','FreshdeskField','length','getFields','getSubjects','findOne','hasOwnProperty','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0x9d33,0xe2));var _0x39d3=function(_0x281d85,_0x1b497b){_0x281d85=_0x281d85-0x0;var _0x21e3ac=_0x9d33[_0x281d85];return _0x21e3ac;};'use strict';var emlformat=require(_0x39d3('0x0'));var rimraf=require(_0x39d3('0x1'));var zipdir=require(_0x39d3('0x2'));var jsonpatch=require(_0x39d3('0x3'));var rp=require(_0x39d3('0x4'));var moment=require('moment');var BPromise=require(_0x39d3('0x5'));var Mustache=require(_0x39d3('0x6'));var util=require(_0x39d3('0x7'));var path=require('path');var sox=require(_0x39d3('0x8'));var csv=require(_0x39d3('0x9'));var ejs=require(_0x39d3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x39d3('0xb'));var squel=require(_0x39d3('0xc'));var crypto=require(_0x39d3('0xd'));var jsforce=require(_0x39d3('0xe'));var deskjs=require(_0x39d3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x39d3('0x10'));var Papa=require(_0x39d3('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x39d3('0x12'));var as=require(_0x39d3('0x13'));var hardwareService=require(_0x39d3('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x39d3('0x15'));var config=require(_0x39d3('0x16'));var licenseUtil=require(_0x39d3('0x17'));var db=require(_0x39d3('0x18'))['db'];function respondWithStatusCode(_0x1bd911,_0x51de56){_0x51de56=_0x51de56||0xcc;return function(_0x2d5dae){if(_0x2d5dae){return _0x1bd911[_0x39d3('0x19')](_0x51de56);}return _0x1bd911[_0x39d3('0x1a')](_0x51de56)[_0x39d3('0x1b')]();};}function respondWithResult(_0x50775b,_0x15f387){_0x15f387=_0x15f387||0xc8;return function(_0x56874b){if(_0x56874b){return _0x50775b[_0x39d3('0x1a')](_0x15f387)[_0x39d3('0x1c')](_0x56874b);}};}function respondWithFilteredResult(_0x3b2a83,_0x428f94){return function(_0x5e720c){if(_0x5e720c){var _0x32c0ee=typeof _0x428f94['offset']===_0x39d3('0x1d')&&typeof _0x428f94['limit']===_0x39d3('0x1d');var _0x45a941=_0x5e720c[_0x39d3('0x1e')];var _0x4b8df2=_0x32c0ee?0x0:_0x428f94['offset'];var _0x38ada4=_0x32c0ee?_0x5e720c[_0x39d3('0x1e')]:_0x428f94['offset']+_0x428f94[_0x39d3('0x1f')];var _0x355954;if(_0x38ada4>=_0x45a941){_0x38ada4=_0x45a941;_0x355954=0xc8;}else{_0x355954=0xce;}_0x3b2a83[_0x39d3('0x1a')](_0x355954);return _0x3b2a83[_0x39d3('0x20')](_0x39d3('0x21'),_0x4b8df2+'-'+_0x38ada4+'/'+_0x45a941)[_0x39d3('0x1c')](_0x5e720c);}return null;};}function patchUpdates(_0x2c0c31){return function(_0x26da5e){try{jsonpatch[_0x39d3('0x22')](_0x26da5e,_0x2c0c31,!![]);}catch(_0x4cf768){return BPromise['reject'](_0x4cf768);}return _0x26da5e[_0x39d3('0x23')]();};}function saveUpdates(_0x1b4fa2,_0x13f78d){return function(_0x5643a2){if(_0x5643a2){return _0x5643a2[_0x39d3('0x24')](_0x1b4fa2)['then'](function(_0x281989){return _0x281989;});}return null;};}function removeEntity(_0xff7088,_0x4fe9b3){return function(_0x57397e){if(_0x57397e){return _0x57397e['destroy']()[_0x39d3('0x25')](function(){_0xff7088['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bce5a,_0x37a234){return function(_0x4554a0){if(!_0x4554a0){_0x3bce5a[_0x39d3('0x19')](0x194);}return _0x4554a0;};}function handleError(_0x25e9b2,_0x4eddde){_0x4eddde=_0x4eddde||0x1f4;return function(_0x5da8ea){logger[_0x39d3('0x26')](_0x5da8ea[_0x39d3('0x27')]);if(_0x5da8ea['name']){delete _0x5da8ea[_0x39d3('0x28')];}_0x25e9b2[_0x39d3('0x1a')](_0x4eddde)['send'](_0x5da8ea);};}exports[_0x39d3('0x29')]=function(_0x2a50a1,_0x4de90a){var _0x5722e2={},_0x5a9a44={},_0x187c5a={'count':0x0,'rows':[]};var _0x4f6951=_[_0x39d3('0x2a')](db['FreshdeskConfiguration'][_0x39d3('0x2b')],function(_0xaee40d){return{'name':_0xaee40d[_0x39d3('0x2c')],'type':_0xaee40d[_0x39d3('0x2d')][_0x39d3('0x2e')]};});_0x5a9a44[_0x39d3('0x2f')]=_[_0x39d3('0x2a')](_0x4f6951,'name');_0x5a9a44[_0x39d3('0x30')]=_[_0x39d3('0x31')](_0x2a50a1['query']);_0x5a9a44[_0x39d3('0x32')]=_['intersection'](_0x5a9a44[_0x39d3('0x2f')],_0x5a9a44[_0x39d3('0x30')]);_0x5722e2['attributes']=_[_0x39d3('0x33')](_0x5a9a44[_0x39d3('0x2f')],qs[_0x39d3('0x34')](_0x2a50a1['query']['fields']));_0x5722e2[_0x39d3('0x35')]=_0x5722e2[_0x39d3('0x35')]['length']?_0x5722e2[_0x39d3('0x35')]:_0x5a9a44[_0x39d3('0x2f')];if(!_0x2a50a1['query']['hasOwnProperty'](_0x39d3('0x36'))){_0x5722e2[_0x39d3('0x1f')]=qs['limit'](_0x2a50a1['query'][_0x39d3('0x1f')]);_0x5722e2[_0x39d3('0x37')]=qs[_0x39d3('0x37')](_0x2a50a1[_0x39d3('0x30')][_0x39d3('0x37')]);}_0x5722e2[_0x39d3('0x38')]=qs[_0x39d3('0x39')](_0x2a50a1['query'][_0x39d3('0x39')]);_0x5722e2['where']=qs[_0x39d3('0x32')](_[_0x39d3('0x3a')](_0x2a50a1[_0x39d3('0x30')],_0x5a9a44['filters']),_0x4f6951);if(_0x2a50a1[_0x39d3('0x30')]['filter']){_0x5722e2[_0x39d3('0x3b')]=_[_0x39d3('0x3c')](_0x5722e2[_0x39d3('0x3b')],{'$or':_[_0x39d3('0x2a')](_0x4f6951,function(_0x964538){if(_0x964538[_0x39d3('0x2d')]!==_0x39d3('0x3d')){var _0x121ef1={};_0x121ef1[_0x964538[_0x39d3('0x28')]]={'$like':'%'+_0x2a50a1[_0x39d3('0x30')][_0x39d3('0x3e')]+'%'};return _0x121ef1;}})});}_0x5722e2=_[_0x39d3('0x3c')]({},_0x5722e2,_0x2a50a1[_0x39d3('0x3f')]);var _0x168c03={'where':_0x5722e2[_0x39d3('0x3b')]};return db[_0x39d3('0x40')][_0x39d3('0x1e')](_0x168c03)[_0x39d3('0x25')](function(_0x117b22){_0x187c5a['count']=_0x117b22;if(_0x2a50a1[_0x39d3('0x30')][_0x39d3('0x41')]){_0x5722e2[_0x39d3('0x42')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x39d3('0x43')](_0x5722e2);})[_0x39d3('0x25')](function(_0x35571d){_0x187c5a[_0x39d3('0x44')]=_0x35571d;return _0x187c5a;})[_0x39d3('0x25')](respondWithFilteredResult(_0x4de90a,_0x5722e2))[_0x39d3('0x45')](handleError(_0x4de90a,null));};exports[_0x39d3('0x46')]=function(_0x4c0a76,_0x17db92){var _0x542c57={'raw':![],'where':{'id':_0x4c0a76[_0x39d3('0x47')]['id']}},_0x2c110c={};_0x2c110c[_0x39d3('0x2f')]=_['keys'](db[_0x39d3('0x40')][_0x39d3('0x2b')]);_0x2c110c[_0x39d3('0x30')]=_[_0x39d3('0x31')](_0x4c0a76[_0x39d3('0x30')]);_0x2c110c['filters']=_[_0x39d3('0x33')](_0x2c110c[_0x39d3('0x2f')],_0x2c110c[_0x39d3('0x30')]);_0x542c57[_0x39d3('0x35')]=_[_0x39d3('0x33')](_0x2c110c['model'],qs['fields'](_0x4c0a76[_0x39d3('0x30')][_0x39d3('0x34')]));_0x542c57[_0x39d3('0x35')]=_0x542c57['attributes']['length']?_0x542c57[_0x39d3('0x35')]:_0x2c110c[_0x39d3('0x2f')];if(_0x4c0a76[_0x39d3('0x30')][_0x39d3('0x41')]){_0x542c57[_0x39d3('0x42')]=[{'all':!![]}];}_0x542c57=_[_0x39d3('0x3c')]({},_0x542c57,_0x4c0a76[_0x39d3('0x3f')]);return db[_0x39d3('0x40')][_0x39d3('0x48')](_0x542c57)[_0x39d3('0x25')](handleEntityNotFound(_0x17db92,null))['then'](respondWithResult(_0x17db92,null))[_0x39d3('0x45')](handleError(_0x17db92,null));};exports['create']=function(_0x1589d2,_0x1cd4a3){return db['FreshdeskConfiguration']['create'](_0x1589d2[_0x39d3('0x49')],{})[_0x39d3('0x25')](respondWithResult(_0x1cd4a3,0xc9))[_0x39d3('0x45')](handleError(_0x1cd4a3,null));};exports[_0x39d3('0x24')]=function(_0x5600d1,_0x206e82){if(_0x5600d1[_0x39d3('0x49')]['id']){delete _0x5600d1[_0x39d3('0x49')]['id'];}return db[_0x39d3('0x40')][_0x39d3('0x48')]({'where':{'id':_0x5600d1['params']['id']}})[_0x39d3('0x25')](handleEntityNotFound(_0x206e82,null))[_0x39d3('0x25')](saveUpdates(_0x5600d1[_0x39d3('0x49')],null))['then'](respondWithResult(_0x206e82,null))[_0x39d3('0x45')](handleError(_0x206e82,null));};exports['destroy']=function(_0xaf8690,_0x211163){return db[_0x39d3('0x40')]['find']({'where':{'id':_0xaf8690[_0x39d3('0x47')]['id']}})[_0x39d3('0x25')](handleEntityNotFound(_0x211163,null))[_0x39d3('0x25')](removeEntity(_0x211163,null))[_0x39d3('0x45')](handleError(_0x211163,null));};exports['getFields']=function(_0x557323,_0x5e8c40,_0x45ee82){var _0x44ba35={};var _0x467b62={};var _0xc18fa;var _0x5cc6ff;return db[_0x39d3('0x40')]['findOne']({'where':{'id':_0x557323[_0x39d3('0x47')]['id']}})['then'](handleEntityNotFound(_0x5e8c40,null))[_0x39d3('0x25')](function(_0x1bef52){if(_0x1bef52){_0xc18fa=_0x1bef52;_0x467b62[_0x39d3('0x2f')]=_[_0x39d3('0x31')](db[_0x39d3('0x4a')][_0x39d3('0x2b')]);_0x467b62[_0x39d3('0x30')]=_[_0x39d3('0x31')](_0x557323['query']);_0x467b62[_0x39d3('0x32')]=_['intersection'](_0x467b62[_0x39d3('0x2f')],_0x467b62[_0x39d3('0x30')]);_0x44ba35[_0x39d3('0x35')]=_[_0x39d3('0x33')](_0x467b62[_0x39d3('0x2f')],qs[_0x39d3('0x34')](_0x557323[_0x39d3('0x30')]['fields']));_0x44ba35[_0x39d3('0x35')]=_0x44ba35['attributes'][_0x39d3('0x4b')]?_0x44ba35['attributes']:_0x467b62[_0x39d3('0x2f')];_0x44ba35['order']=qs[_0x39d3('0x39')](_0x557323['query'][_0x39d3('0x39')]);_0x44ba35[_0x39d3('0x3b')]=qs[_0x39d3('0x32')](_['pick'](_0x557323[_0x39d3('0x30')],_0x467b62[_0x39d3('0x32')]));if(_0x557323[_0x39d3('0x30')][_0x39d3('0x3e')]){_0x44ba35[_0x39d3('0x3b')]=_[_0x39d3('0x3c')](_0x44ba35['where'],{'$or':_['map'](_0x44ba35[_0x39d3('0x35')],function(_0x11f40b){var _0xe8ee3a={};_0xe8ee3a[_0x11f40b]={'$like':'%'+_0x557323[_0x39d3('0x30')]['filter']+'%'};return _0xe8ee3a;})});}_0x44ba35=_['merge']({},_0x44ba35,_0x557323['options']);return _0xc18fa[_0x39d3('0x4c')](_0x44ba35);}})[_0x39d3('0x25')](function(_0x53c1af){if(_0x53c1af){_0x5cc6ff=_0x53c1af['length'];if(!_0x557323[_0x39d3('0x30')]['hasOwnProperty'](_0x39d3('0x36'))){_0x44ba35[_0x39d3('0x1f')]=qs[_0x39d3('0x1f')](_0x557323['query'][_0x39d3('0x1f')]);_0x44ba35['offset']=qs['offset'](_0x557323[_0x39d3('0x30')][_0x39d3('0x37')]);}return _0xc18fa[_0x39d3('0x4c')](_0x44ba35);}})[_0x39d3('0x25')](function(_0x178b68){if(_0x178b68){return _0x178b68?{'count':_0x5cc6ff,'rows':_0x178b68}:null;}})[_0x39d3('0x25')](respondWithResult(_0x5e8c40,null))[_0x39d3('0x45')](handleError(_0x5e8c40,null));};exports[_0x39d3('0x4d')]=function(_0x576231,_0x425972,_0x302828){var _0x4a6c30={};var _0x1e5c8f={};var _0x1285b0;var _0x3cbc4b;return db[_0x39d3('0x40')][_0x39d3('0x4e')]({'where':{'id':_0x576231[_0x39d3('0x47')]['id']}})['then'](handleEntityNotFound(_0x425972,null))[_0x39d3('0x25')](function(_0x12f727){if(_0x12f727){_0x1285b0=_0x12f727;_0x1e5c8f['model']=_[_0x39d3('0x31')](db[_0x39d3('0x4a')][_0x39d3('0x2b')]);_0x1e5c8f[_0x39d3('0x30')]=_[_0x39d3('0x31')](_0x576231['query']);_0x1e5c8f[_0x39d3('0x32')]=_['intersection'](_0x1e5c8f[_0x39d3('0x2f')],_0x1e5c8f['query']);_0x4a6c30[_0x39d3('0x35')]=_[_0x39d3('0x33')](_0x1e5c8f[_0x39d3('0x2f')],qs[_0x39d3('0x34')](_0x576231[_0x39d3('0x30')][_0x39d3('0x34')]));_0x4a6c30[_0x39d3('0x35')]=_0x4a6c30['attributes'][_0x39d3('0x4b')]?_0x4a6c30['attributes']:_0x1e5c8f['model'];_0x4a6c30[_0x39d3('0x38')]=qs[_0x39d3('0x39')](_0x576231[_0x39d3('0x30')]['sort']);_0x4a6c30[_0x39d3('0x3b')]=qs[_0x39d3('0x32')](_['pick'](_0x576231[_0x39d3('0x30')],_0x1e5c8f[_0x39d3('0x32')]));if(_0x576231[_0x39d3('0x30')][_0x39d3('0x3e')]){_0x4a6c30[_0x39d3('0x3b')]=_[_0x39d3('0x3c')](_0x4a6c30[_0x39d3('0x3b')],{'$or':_[_0x39d3('0x2a')](_0x4a6c30[_0x39d3('0x35')],function(_0x453131){var _0x47b1e6={};_0x47b1e6[_0x453131]={'$like':'%'+_0x576231[_0x39d3('0x30')]['filter']+'%'};return _0x47b1e6;})});}_0x4a6c30=_[_0x39d3('0x3c')]({},_0x4a6c30,_0x576231[_0x39d3('0x3f')]);return _0x1285b0[_0x39d3('0x4d')](_0x4a6c30);}})[_0x39d3('0x25')](function(_0x141181){if(_0x141181){_0x3cbc4b=_0x141181[_0x39d3('0x4b')];if(!_0x576231[_0x39d3('0x30')][_0x39d3('0x4f')](_0x39d3('0x36'))){_0x4a6c30[_0x39d3('0x1f')]=qs[_0x39d3('0x1f')](_0x576231[_0x39d3('0x30')]['limit']);_0x4a6c30[_0x39d3('0x37')]=qs[_0x39d3('0x37')](_0x576231[_0x39d3('0x30')][_0x39d3('0x37')]);}return _0x1285b0[_0x39d3('0x4d')](_0x4a6c30);}})['then'](function(_0x34d1ef){if(_0x34d1ef){return _0x34d1ef?{'count':_0x3cbc4b,'rows':_0x34d1ef}:null;}})['then'](respondWithResult(_0x425972,null))[_0x39d3('0x45')](handleError(_0x425972,null));};exports[_0x39d3('0x50')]=function(_0x1124d5,_0x9a3bb8,_0x3f9e46){var _0x67f6af={};var _0x48f669={};var _0x46ca28;var _0x3d98a7;return db[_0x39d3('0x40')]['findOne']({'where':{'id':_0x1124d5[_0x39d3('0x47')]['id']}})[_0x39d3('0x25')](handleEntityNotFound(_0x9a3bb8,null))[_0x39d3('0x25')](function(_0x1aeac1){if(_0x1aeac1){_0x46ca28=_0x1aeac1;_0x48f669[_0x39d3('0x2f')]=_['keys'](db[_0x39d3('0x4a')][_0x39d3('0x2b')]);_0x48f669[_0x39d3('0x30')]=_['keys'](_0x1124d5[_0x39d3('0x30')]);_0x48f669[_0x39d3('0x32')]=_[_0x39d3('0x33')](_0x48f669[_0x39d3('0x2f')],_0x48f669[_0x39d3('0x30')]);_0x67f6af[_0x39d3('0x35')]=_[_0x39d3('0x33')](_0x48f669[_0x39d3('0x2f')],qs[_0x39d3('0x34')](_0x1124d5[_0x39d3('0x30')]['fields']));_0x67f6af[_0x39d3('0x35')]=_0x67f6af[_0x39d3('0x35')]['length']?_0x67f6af['attributes']:_0x48f669[_0x39d3('0x2f')];_0x67f6af[_0x39d3('0x38')]=qs[_0x39d3('0x39')](_0x1124d5[_0x39d3('0x30')]['sort']);_0x67f6af[_0x39d3('0x3b')]=qs[_0x39d3('0x32')](_[_0x39d3('0x3a')](_0x1124d5['query'],_0x48f669[_0x39d3('0x32')]));if(_0x1124d5[_0x39d3('0x30')][_0x39d3('0x3e')]){_0x67f6af[_0x39d3('0x3b')]=_[_0x39d3('0x3c')](_0x67f6af[_0x39d3('0x3b')],{'$or':_[_0x39d3('0x2a')](_0x67f6af[_0x39d3('0x35')],function(_0xfd83f0){var _0x1c0397={};_0x1c0397[_0xfd83f0]={'$like':'%'+_0x1124d5['query'][_0x39d3('0x3e')]+'%'};return _0x1c0397;})});}_0x67f6af=_[_0x39d3('0x3c')]({},_0x67f6af,_0x1124d5['options']);return _0x46ca28[_0x39d3('0x50')](_0x67f6af);}})[_0x39d3('0x25')](function(_0x5aa106){if(_0x5aa106){_0x3d98a7=_0x5aa106[_0x39d3('0x4b')];if(!_0x1124d5[_0x39d3('0x30')][_0x39d3('0x4f')](_0x39d3('0x36'))){_0x67f6af[_0x39d3('0x1f')]=qs[_0x39d3('0x1f')](_0x1124d5['query'][_0x39d3('0x1f')]);_0x67f6af[_0x39d3('0x37')]=qs[_0x39d3('0x37')](_0x1124d5[_0x39d3('0x30')][_0x39d3('0x37')]);}return _0x46ca28[_0x39d3('0x50')](_0x67f6af);}})[_0x39d3('0x25')](function(_0x209d99){if(_0x209d99){return _0x209d99?{'count':_0x3d98a7,'rows':_0x209d99}:null;}})[_0x39d3('0x25')](respondWithResult(_0x9a3bb8,null))[_0x39d3('0x45')](handleError(_0x9a3bb8,null));};exports[_0x39d3('0x51')]=function(_0x5f048f,_0x1ac738,_0x21278a){var _0x228e0a={};var _0x4561e7={};var _0x5833b9;var _0x1024fc;return db[_0x39d3('0x40')][_0x39d3('0x4e')]({'where':{'id':_0x5f048f[_0x39d3('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ac738,null))[_0x39d3('0x25')](function(_0x37de40){if(_0x37de40){_0x5833b9=_0x37de40;_0x4561e7[_0x39d3('0x2f')]=_[_0x39d3('0x31')](db['Tag'][_0x39d3('0x2b')]);_0x4561e7[_0x39d3('0x30')]=_['keys'](_0x5f048f[_0x39d3('0x30')]);_0x4561e7[_0x39d3('0x32')]=_['intersection'](_0x4561e7[_0x39d3('0x2f')],_0x4561e7[_0x39d3('0x30')]);_0x228e0a[_0x39d3('0x35')]=_[_0x39d3('0x33')](_0x4561e7[_0x39d3('0x2f')],qs[_0x39d3('0x34')](_0x5f048f[_0x39d3('0x30')][_0x39d3('0x34')]));_0x228e0a[_0x39d3('0x35')]=_0x228e0a[_0x39d3('0x35')]['length']?_0x228e0a[_0x39d3('0x35')]:_0x4561e7['model'];_0x228e0a[_0x39d3('0x38')]=qs['sort'](_0x5f048f[_0x39d3('0x30')][_0x39d3('0x39')]);_0x228e0a[_0x39d3('0x3b')]=qs['filters'](_['pick'](_0x5f048f['query'],_0x4561e7[_0x39d3('0x32')]));if(_0x5f048f[_0x39d3('0x30')][_0x39d3('0x3e')]){_0x228e0a[_0x39d3('0x3b')]=_[_0x39d3('0x3c')](_0x228e0a['where'],{'$or':_[_0x39d3('0x2a')](_0x228e0a[_0x39d3('0x35')],function(_0x1bdd5f){var _0xabef26={};_0xabef26[_0x1bdd5f]={'$like':'%'+_0x5f048f[_0x39d3('0x30')][_0x39d3('0x3e')]+'%'};return _0xabef26;})});}_0x228e0a=_['merge']({},_0x228e0a,_0x5f048f[_0x39d3('0x3f')]);return _0x5833b9[_0x39d3('0x51')](_0x228e0a);}})[_0x39d3('0x25')](function(_0x5cebc0){if(_0x5cebc0){_0x1024fc=_0x5cebc0[_0x39d3('0x4b')];if(!_0x5f048f[_0x39d3('0x30')][_0x39d3('0x4f')](_0x39d3('0x36'))){_0x228e0a['limit']=qs[_0x39d3('0x1f')](_0x5f048f['query']['limit']);_0x228e0a[_0x39d3('0x37')]=qs[_0x39d3('0x37')](_0x5f048f['query']['offset']);}return _0x5833b9['getTags'](_0x228e0a);}})[_0x39d3('0x25')](function(_0x19bd0a){if(_0x19bd0a){return _0x19bd0a?{'count':_0x1024fc,'rows':_0x19bd0a}:null;}})[_0x39d3('0x25')](respondWithResult(_0x1ac738,null))[_0x39d3('0x45')](handleError(_0x1ac738,null));};exports['setTags']=function(_0x26ff14,_0xc6216a,_0x36a7e){if(_0x26ff14['body']['id']){delete _0x26ff14[_0x39d3('0x49')]['id'];}return db[_0x39d3('0x40')][_0x39d3('0x4e')]({'where':{'id':_0x26ff14['params']['id']}})[_0x39d3('0x25')](handleEntityNotFound(_0xc6216a,null))['then'](function(_0x38c9d5){if(_0x38c9d5){return _0x38c9d5[_0x39d3('0x52')](_0x26ff14['body']['ids']||[]);}return null;})[_0x39d3('0x25')](respondWithResult(_0xc6216a,null))[_0x39d3('0x45')](handleError(_0xc6216a,null));}; \ No newline at end of file +var _0x8662=['options','find','create','body','getFields','findOne','FreshdeskField','sort','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','name','send','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','FreshdeskConfiguration','include','findAll','rows','catch','params','rawAttributes'];(function(_0x4cd4e4,_0x1857a2){var _0x18cf3b=function(_0x27ea45){while(--_0x27ea45){_0x4cd4e4['push'](_0x4cd4e4['shift']());}};_0x18cf3b(++_0x1857a2);}(_0x8662,0x113));var _0x2866=function(_0x2cd565,_0x3faf26){_0x2cd565=_0x2cd565-0x0;var _0x1695e2=_0x8662[_0x2cd565];return _0x1695e2;};'use strict';var emlformat=require(_0x2866('0x0'));var rimraf=require(_0x2866('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2866('0x2'));var rp=require(_0x2866('0x3'));var moment=require(_0x2866('0x4'));var BPromise=require(_0x2866('0x5'));var Mustache=require(_0x2866('0x6'));var util=require(_0x2866('0x7'));var path=require(_0x2866('0x8'));var sox=require(_0x2866('0x9'));var csv=require(_0x2866('0xa'));var ejs=require(_0x2866('0xb'));var fs=require('fs');var fs_extra=require(_0x2866('0xc'));var _=require(_0x2866('0xd'));var squel=require(_0x2866('0xe'));var crypto=require(_0x2866('0xf'));var jsforce=require(_0x2866('0x10'));var deskjs=require(_0x2866('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2866('0x12'));var Papa=require(_0x2866('0x13'));var Redis=require('ioredis');var authService=require(_0x2866('0x14'));var qs=require(_0x2866('0x15'));var as=require(_0x2866('0x16'));var hardwareService=require(_0x2866('0x17'));var logger=require(_0x2866('0x18'))(_0x2866('0x19'));var utils=require(_0x2866('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x2866('0x1b'));var db=require(_0x2866('0x1c'))['db'];function respondWithStatusCode(_0x91a223,_0x20b075){_0x20b075=_0x20b075||0xcc;return function(_0x4fdca4){if(_0x4fdca4){return _0x91a223[_0x2866('0x1d')](_0x20b075);}return _0x91a223[_0x2866('0x1e')](_0x20b075)[_0x2866('0x1f')]();};}function respondWithResult(_0x410071,_0x4ee57f){_0x4ee57f=_0x4ee57f||0xc8;return function(_0x36b661){if(_0x36b661){return _0x410071['status'](_0x4ee57f)[_0x2866('0x20')](_0x36b661);}};}function respondWithFilteredResult(_0x2f0e41,_0x468fbe){return function(_0x1e302e){if(_0x1e302e){var _0x3a0737=typeof _0x468fbe[_0x2866('0x21')]===_0x2866('0x22')&&typeof _0x468fbe['limit']==='undefined';var _0x2d5726=_0x1e302e[_0x2866('0x23')];var _0xcf77bd=_0x3a0737?0x0:_0x468fbe[_0x2866('0x21')];var _0x4a93fb=_0x3a0737?_0x1e302e[_0x2866('0x23')]:_0x468fbe['offset']+_0x468fbe['limit'];var _0x457177;if(_0x4a93fb>=_0x2d5726){_0x4a93fb=_0x2d5726;_0x457177=0xc8;}else{_0x457177=0xce;}_0x2f0e41[_0x2866('0x1e')](_0x457177);return _0x2f0e41[_0x2866('0x24')]('Content-Range',_0xcf77bd+'-'+_0x4a93fb+'/'+_0x2d5726)[_0x2866('0x20')](_0x1e302e);}return null;};}function patchUpdates(_0x3447af){return function(_0xc115c4){try{jsonpatch[_0x2866('0x25')](_0xc115c4,_0x3447af,!![]);}catch(_0x5481d7){return BPromise[_0x2866('0x26')](_0x5481d7);}return _0xc115c4[_0x2866('0x27')]();};}function saveUpdates(_0x5531e1,_0x4bf8b4){return function(_0x2ae5dd){if(_0x2ae5dd){return _0x2ae5dd[_0x2866('0x28')](_0x5531e1)[_0x2866('0x29')](function(_0x290f7e){return _0x290f7e;});}return null;};}function removeEntity(_0x45bda2,_0x355204){return function(_0x443d75){if(_0x443d75){return _0x443d75[_0x2866('0x2a')]()[_0x2866('0x29')](function(){_0x45bda2[_0x2866('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22902a,_0x430947){return function(_0x164bcd){if(!_0x164bcd){_0x22902a['sendStatus'](0x194);}return _0x164bcd;};}function handleError(_0xebd112,_0x5f584a){_0x5f584a=_0x5f584a||0x1f4;return function(_0x5a5433){logger[_0x2866('0x2b')](_0x5a5433['stack']);if(_0x5a5433['name']){delete _0x5a5433[_0x2866('0x2c')];}_0xebd112[_0x2866('0x1e')](_0x5f584a)[_0x2866('0x2d')](_0x5a5433);};}exports['index']=function(_0x21fd1d,_0x4616b8){var _0x34bcd9={},_0x534ce5={},_0x4adc3c={'count':0x0,'rows':[]};var _0x4436ef=_['map'](db['FreshdeskConfiguration']['rawAttributes'],function(_0x1abc26){return{'name':_0x1abc26['fieldName'],'type':_0x1abc26[_0x2866('0x2e')][_0x2866('0x2f')]};});_0x534ce5['model']=_[_0x2866('0x30')](_0x4436ef,_0x2866('0x2c'));_0x534ce5[_0x2866('0x31')]=_[_0x2866('0x32')](_0x21fd1d[_0x2866('0x31')]);_0x534ce5[_0x2866('0x33')]=_[_0x2866('0x34')](_0x534ce5[_0x2866('0x35')],_0x534ce5[_0x2866('0x31')]);_0x34bcd9[_0x2866('0x36')]=_[_0x2866('0x34')](_0x534ce5[_0x2866('0x35')],qs[_0x2866('0x37')](_0x21fd1d[_0x2866('0x31')][_0x2866('0x37')]));_0x34bcd9['attributes']=_0x34bcd9[_0x2866('0x36')][_0x2866('0x38')]?_0x34bcd9[_0x2866('0x36')]:_0x534ce5[_0x2866('0x35')];if(!_0x21fd1d[_0x2866('0x31')][_0x2866('0x39')](_0x2866('0x3a'))){_0x34bcd9[_0x2866('0x3b')]=qs[_0x2866('0x3b')](_0x21fd1d[_0x2866('0x31')][_0x2866('0x3b')]);_0x34bcd9[_0x2866('0x21')]=qs['offset'](_0x21fd1d[_0x2866('0x31')][_0x2866('0x21')]);}_0x34bcd9[_0x2866('0x3c')]=qs['sort'](_0x21fd1d[_0x2866('0x31')]['sort']);_0x34bcd9[_0x2866('0x3d')]=qs[_0x2866('0x33')](_[_0x2866('0x3e')](_0x21fd1d[_0x2866('0x31')],_0x534ce5[_0x2866('0x33')]),_0x4436ef);if(_0x21fd1d[_0x2866('0x31')][_0x2866('0x3f')]){_0x34bcd9[_0x2866('0x3d')]=_[_0x2866('0x40')](_0x34bcd9[_0x2866('0x3d')],{'$or':_[_0x2866('0x30')](_0x4436ef,function(_0x14825d){if(_0x14825d[_0x2866('0x2e')]!==_0x2866('0x41')){var _0x329b8c={};_0x329b8c[_0x14825d[_0x2866('0x2c')]]={'$like':'%'+_0x21fd1d[_0x2866('0x31')]['filter']+'%'};return _0x329b8c;}})});}_0x34bcd9=_[_0x2866('0x40')]({},_0x34bcd9,_0x21fd1d['options']);var _0x345a13={'where':_0x34bcd9['where']};return db[_0x2866('0x42')][_0x2866('0x23')](_0x345a13)[_0x2866('0x29')](function(_0x365673){_0x4adc3c['count']=_0x365673;if(_0x21fd1d[_0x2866('0x31')]['includeAll']){_0x34bcd9[_0x2866('0x43')]=[{'all':!![]}];}return db[_0x2866('0x42')][_0x2866('0x44')](_0x34bcd9);})[_0x2866('0x29')](function(_0x33348b){_0x4adc3c[_0x2866('0x45')]=_0x33348b;return _0x4adc3c;})[_0x2866('0x29')](respondWithFilteredResult(_0x4616b8,_0x34bcd9))[_0x2866('0x46')](handleError(_0x4616b8,null));};exports['show']=function(_0x4e547c,_0x39ac95){var _0xc7f652={'raw':![],'where':{'id':_0x4e547c[_0x2866('0x47')]['id']}},_0x34b474={};_0x34b474[_0x2866('0x35')]=_[_0x2866('0x32')](db[_0x2866('0x42')][_0x2866('0x48')]);_0x34b474[_0x2866('0x31')]=_[_0x2866('0x32')](_0x4e547c[_0x2866('0x31')]);_0x34b474[_0x2866('0x33')]=_[_0x2866('0x34')](_0x34b474[_0x2866('0x35')],_0x34b474[_0x2866('0x31')]);_0xc7f652[_0x2866('0x36')]=_[_0x2866('0x34')](_0x34b474[_0x2866('0x35')],qs[_0x2866('0x37')](_0x4e547c['query'][_0x2866('0x37')]));_0xc7f652[_0x2866('0x36')]=_0xc7f652[_0x2866('0x36')][_0x2866('0x38')]?_0xc7f652[_0x2866('0x36')]:_0x34b474['model'];if(_0x4e547c['query']['includeAll']){_0xc7f652['include']=[{'all':!![]}];}_0xc7f652=_['merge']({},_0xc7f652,_0x4e547c[_0x2866('0x49')]);return db[_0x2866('0x42')][_0x2866('0x4a')](_0xc7f652)['then'](handleEntityNotFound(_0x39ac95,null))['then'](respondWithResult(_0x39ac95,null))['catch'](handleError(_0x39ac95,null));};exports[_0x2866('0x4b')]=function(_0x592b41,_0xbc64f9){return db[_0x2866('0x42')][_0x2866('0x4b')](_0x592b41[_0x2866('0x4c')],{})[_0x2866('0x29')](respondWithResult(_0xbc64f9,0xc9))['catch'](handleError(_0xbc64f9,null));};exports[_0x2866('0x28')]=function(_0xbc1be0,_0x35f23d){if(_0xbc1be0[_0x2866('0x4c')]['id']){delete _0xbc1be0[_0x2866('0x4c')]['id'];}return db['FreshdeskConfiguration'][_0x2866('0x4a')]({'where':{'id':_0xbc1be0[_0x2866('0x47')]['id']}})[_0x2866('0x29')](handleEntityNotFound(_0x35f23d,null))[_0x2866('0x29')](saveUpdates(_0xbc1be0['body'],null))[_0x2866('0x29')](respondWithResult(_0x35f23d,null))['catch'](handleError(_0x35f23d,null));};exports['destroy']=function(_0x3a7231,_0x17630b){return db[_0x2866('0x42')][_0x2866('0x4a')]({'where':{'id':_0x3a7231[_0x2866('0x47')]['id']}})[_0x2866('0x29')](handleEntityNotFound(_0x17630b,null))[_0x2866('0x29')](removeEntity(_0x17630b,null))[_0x2866('0x46')](handleError(_0x17630b,null));};exports[_0x2866('0x4d')]=function(_0x531177,_0x2a171b,_0x2c06c9){var _0x3eecc2={};var _0x8c4fcc={};var _0x50fba7;var _0x520adf;return db[_0x2866('0x42')][_0x2866('0x4e')]({'where':{'id':_0x531177['params']['id']}})[_0x2866('0x29')](handleEntityNotFound(_0x2a171b,null))[_0x2866('0x29')](function(_0x2bb627){if(_0x2bb627){_0x50fba7=_0x2bb627;_0x8c4fcc[_0x2866('0x35')]=_[_0x2866('0x32')](db[_0x2866('0x4f')]['rawAttributes']);_0x8c4fcc['query']=_['keys'](_0x531177[_0x2866('0x31')]);_0x8c4fcc[_0x2866('0x33')]=_[_0x2866('0x34')](_0x8c4fcc[_0x2866('0x35')],_0x8c4fcc[_0x2866('0x31')]);_0x3eecc2[_0x2866('0x36')]=_[_0x2866('0x34')](_0x8c4fcc[_0x2866('0x35')],qs[_0x2866('0x37')](_0x531177[_0x2866('0x31')][_0x2866('0x37')]));_0x3eecc2[_0x2866('0x36')]=_0x3eecc2[_0x2866('0x36')][_0x2866('0x38')]?_0x3eecc2[_0x2866('0x36')]:_0x8c4fcc['model'];_0x3eecc2['order']=qs[_0x2866('0x50')](_0x531177['query'][_0x2866('0x50')]);_0x3eecc2[_0x2866('0x3d')]=qs[_0x2866('0x33')](_['pick'](_0x531177[_0x2866('0x31')],_0x8c4fcc['filters']));if(_0x531177[_0x2866('0x31')][_0x2866('0x3f')]){_0x3eecc2['where']=_[_0x2866('0x40')](_0x3eecc2['where'],{'$or':_[_0x2866('0x30')](_0x3eecc2[_0x2866('0x36')],function(_0xa1c1ed){var _0x5cc50f={};_0x5cc50f[_0xa1c1ed]={'$like':'%'+_0x531177[_0x2866('0x31')][_0x2866('0x3f')]+'%'};return _0x5cc50f;})});}_0x3eecc2=_[_0x2866('0x40')]({},_0x3eecc2,_0x531177[_0x2866('0x49')]);return _0x50fba7['getFields'](_0x3eecc2);}})[_0x2866('0x29')](function(_0x2d6126){if(_0x2d6126){_0x520adf=_0x2d6126['length'];if(!_0x531177[_0x2866('0x31')][_0x2866('0x39')](_0x2866('0x3a'))){_0x3eecc2[_0x2866('0x3b')]=qs[_0x2866('0x3b')](_0x531177[_0x2866('0x31')][_0x2866('0x3b')]);_0x3eecc2[_0x2866('0x21')]=qs['offset'](_0x531177['query'][_0x2866('0x21')]);}return _0x50fba7[_0x2866('0x4d')](_0x3eecc2);}})['then'](function(_0x439c39){if(_0x439c39){return _0x439c39?{'count':_0x520adf,'rows':_0x439c39}:null;}})[_0x2866('0x29')](respondWithResult(_0x2a171b,null))[_0x2866('0x46')](handleError(_0x2a171b,null));};exports[_0x2866('0x51')]=function(_0x22f298,_0x4c12fe,_0x1f17e1){var _0x1c1587={};var _0x4d0c1e={};var _0x361780;var _0x618a4a;return db[_0x2866('0x42')][_0x2866('0x4e')]({'where':{'id':_0x22f298[_0x2866('0x47')]['id']}})[_0x2866('0x29')](handleEntityNotFound(_0x4c12fe,null))['then'](function(_0x2efec1){if(_0x2efec1){_0x361780=_0x2efec1;_0x4d0c1e[_0x2866('0x35')]=_[_0x2866('0x32')](db['FreshdeskField']['rawAttributes']);_0x4d0c1e['query']=_[_0x2866('0x32')](_0x22f298[_0x2866('0x31')]);_0x4d0c1e[_0x2866('0x33')]=_[_0x2866('0x34')](_0x4d0c1e['model'],_0x4d0c1e[_0x2866('0x31')]);_0x1c1587[_0x2866('0x36')]=_[_0x2866('0x34')](_0x4d0c1e['model'],qs[_0x2866('0x37')](_0x22f298[_0x2866('0x31')][_0x2866('0x37')]));_0x1c1587[_0x2866('0x36')]=_0x1c1587[_0x2866('0x36')]['length']?_0x1c1587['attributes']:_0x4d0c1e[_0x2866('0x35')];_0x1c1587[_0x2866('0x3c')]=qs[_0x2866('0x50')](_0x22f298[_0x2866('0x31')][_0x2866('0x50')]);_0x1c1587['where']=qs[_0x2866('0x33')](_['pick'](_0x22f298[_0x2866('0x31')],_0x4d0c1e[_0x2866('0x33')]));if(_0x22f298['query'][_0x2866('0x3f')]){_0x1c1587[_0x2866('0x3d')]=_[_0x2866('0x40')](_0x1c1587[_0x2866('0x3d')],{'$or':_[_0x2866('0x30')](_0x1c1587[_0x2866('0x36')],function(_0x3d4e17){var _0x1380d3={};_0x1380d3[_0x3d4e17]={'$like':'%'+_0x22f298[_0x2866('0x31')]['filter']+'%'};return _0x1380d3;})});}_0x1c1587=_[_0x2866('0x40')]({},_0x1c1587,_0x22f298[_0x2866('0x49')]);return _0x361780[_0x2866('0x51')](_0x1c1587);}})['then'](function(_0x58ec70){if(_0x58ec70){_0x618a4a=_0x58ec70[_0x2866('0x38')];if(!_0x22f298[_0x2866('0x31')][_0x2866('0x39')]('nolimit')){_0x1c1587[_0x2866('0x3b')]=qs['limit'](_0x22f298[_0x2866('0x31')][_0x2866('0x3b')]);_0x1c1587[_0x2866('0x21')]=qs[_0x2866('0x21')](_0x22f298['query'][_0x2866('0x21')]);}return _0x361780['getSubjects'](_0x1c1587);}})[_0x2866('0x29')](function(_0x1c0eed){if(_0x1c0eed){return _0x1c0eed?{'count':_0x618a4a,'rows':_0x1c0eed}:null;}})[_0x2866('0x29')](respondWithResult(_0x4c12fe,null))[_0x2866('0x46')](handleError(_0x4c12fe,null));};exports[_0x2866('0x52')]=function(_0x1afd54,_0x343646,_0x57b545){var _0x11704f={};var _0x9b7ac4={};var _0x14cc55;var _0x5578cb;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x1afd54[_0x2866('0x47')]['id']}})[_0x2866('0x29')](handleEntityNotFound(_0x343646,null))['then'](function(_0x3096ac){if(_0x3096ac){_0x14cc55=_0x3096ac;_0x9b7ac4[_0x2866('0x35')]=_[_0x2866('0x32')](db[_0x2866('0x4f')][_0x2866('0x48')]);_0x9b7ac4[_0x2866('0x31')]=_[_0x2866('0x32')](_0x1afd54['query']);_0x9b7ac4[_0x2866('0x33')]=_[_0x2866('0x34')](_0x9b7ac4[_0x2866('0x35')],_0x9b7ac4[_0x2866('0x31')]);_0x11704f[_0x2866('0x36')]=_[_0x2866('0x34')](_0x9b7ac4[_0x2866('0x35')],qs[_0x2866('0x37')](_0x1afd54[_0x2866('0x31')][_0x2866('0x37')]));_0x11704f[_0x2866('0x36')]=_0x11704f['attributes'][_0x2866('0x38')]?_0x11704f['attributes']:_0x9b7ac4['model'];_0x11704f[_0x2866('0x3c')]=qs['sort'](_0x1afd54[_0x2866('0x31')][_0x2866('0x50')]);_0x11704f[_0x2866('0x3d')]=qs[_0x2866('0x33')](_[_0x2866('0x3e')](_0x1afd54[_0x2866('0x31')],_0x9b7ac4[_0x2866('0x33')]));if(_0x1afd54[_0x2866('0x31')][_0x2866('0x3f')]){_0x11704f[_0x2866('0x3d')]=_['merge'](_0x11704f[_0x2866('0x3d')],{'$or':_[_0x2866('0x30')](_0x11704f[_0x2866('0x36')],function(_0x5d6c19){var _0x222b0c={};_0x222b0c[_0x5d6c19]={'$like':'%'+_0x1afd54[_0x2866('0x31')][_0x2866('0x3f')]+'%'};return _0x222b0c;})});}_0x11704f=_[_0x2866('0x40')]({},_0x11704f,_0x1afd54['options']);return _0x14cc55['getDescriptions'](_0x11704f);}})['then'](function(_0x3d0046){if(_0x3d0046){_0x5578cb=_0x3d0046[_0x2866('0x38')];if(!_0x1afd54['query'][_0x2866('0x39')](_0x2866('0x3a'))){_0x11704f[_0x2866('0x3b')]=qs[_0x2866('0x3b')](_0x1afd54[_0x2866('0x31')]['limit']);_0x11704f[_0x2866('0x21')]=qs[_0x2866('0x21')](_0x1afd54['query'][_0x2866('0x21')]);}return _0x14cc55['getDescriptions'](_0x11704f);}})['then'](function(_0x940127){if(_0x940127){return _0x940127?{'count':_0x5578cb,'rows':_0x940127}:null;}})[_0x2866('0x29')](respondWithResult(_0x343646,null))['catch'](handleError(_0x343646,null));};exports[_0x2866('0x53')]=function(_0x4e7eb0,_0x51d5ee,_0x356439){var _0x1beb93={};var _0x5d397a={};var _0x5edde6;var _0xb7c224;return db[_0x2866('0x42')][_0x2866('0x4e')]({'where':{'id':_0x4e7eb0[_0x2866('0x47')]['id']}})[_0x2866('0x29')](handleEntityNotFound(_0x51d5ee,null))[_0x2866('0x29')](function(_0xbb1fbc){if(_0xbb1fbc){_0x5edde6=_0xbb1fbc;_0x5d397a[_0x2866('0x35')]=_[_0x2866('0x32')](db[_0x2866('0x54')][_0x2866('0x48')]);_0x5d397a[_0x2866('0x31')]=_[_0x2866('0x32')](_0x4e7eb0['query']);_0x5d397a[_0x2866('0x33')]=_[_0x2866('0x34')](_0x5d397a[_0x2866('0x35')],_0x5d397a[_0x2866('0x31')]);_0x1beb93['attributes']=_[_0x2866('0x34')](_0x5d397a[_0x2866('0x35')],qs['fields'](_0x4e7eb0[_0x2866('0x31')]['fields']));_0x1beb93['attributes']=_0x1beb93[_0x2866('0x36')][_0x2866('0x38')]?_0x1beb93['attributes']:_0x5d397a[_0x2866('0x35')];_0x1beb93[_0x2866('0x3c')]=qs[_0x2866('0x50')](_0x4e7eb0['query'][_0x2866('0x50')]);_0x1beb93['where']=qs[_0x2866('0x33')](_[_0x2866('0x3e')](_0x4e7eb0[_0x2866('0x31')],_0x5d397a['filters']));if(_0x4e7eb0['query'][_0x2866('0x3f')]){_0x1beb93[_0x2866('0x3d')]=_[_0x2866('0x40')](_0x1beb93['where'],{'$or':_['map'](_0x1beb93[_0x2866('0x36')],function(_0x59ed91){var _0x537d48={};_0x537d48[_0x59ed91]={'$like':'%'+_0x4e7eb0[_0x2866('0x31')]['filter']+'%'};return _0x537d48;})});}_0x1beb93=_['merge']({},_0x1beb93,_0x4e7eb0[_0x2866('0x49')]);return _0x5edde6['getTags'](_0x1beb93);}})['then'](function(_0x3e9a54){if(_0x3e9a54){_0xb7c224=_0x3e9a54['length'];if(!_0x4e7eb0['query']['hasOwnProperty'](_0x2866('0x3a'))){_0x1beb93[_0x2866('0x3b')]=qs[_0x2866('0x3b')](_0x4e7eb0['query'][_0x2866('0x3b')]);_0x1beb93[_0x2866('0x21')]=qs[_0x2866('0x21')](_0x4e7eb0[_0x2866('0x31')]['offset']);}return _0x5edde6[_0x2866('0x53')](_0x1beb93);}})[_0x2866('0x29')](function(_0x16c78b){if(_0x16c78b){return _0x16c78b?{'count':_0xb7c224,'rows':_0x16c78b}:null;}})[_0x2866('0x29')](respondWithResult(_0x51d5ee,null))[_0x2866('0x46')](handleError(_0x51d5ee,null));};exports[_0x2866('0x55')]=function(_0x7f0327,_0x5d9ed0,_0x5b61aa){if(_0x7f0327[_0x2866('0x4c')]['id']){delete _0x7f0327[_0x2866('0x4c')]['id'];}return db[_0x2866('0x42')][_0x2866('0x4e')]({'where':{'id':_0x7f0327['params']['id']}})[_0x2866('0x29')](handleEntityNotFound(_0x5d9ed0,null))[_0x2866('0x29')](function(_0x3eadab){if(_0x3eadab){return _0x3eadab[_0x2866('0x55')](_0x7f0327['body'][_0x2866('0x56')]||[]);}return null;})['then'](respondWithResult(_0x5d9ed0,null))[_0x2866('0x46')](handleError(_0x5d9ed0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index e7fbdd8..274e72d 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 _0x9e6b=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x16c3e6,_0x463577){var _0x39b9c2=function(_0x519bc3){while(--_0x519bc3){_0x16c3e6['push'](_0x16c3e6['shift']());}};_0x39b9c2(++_0x463577);}(_0x9e6b,0x6c));var _0xb9e6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9e6b[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xb9e6('0x0'));var util=require(_0xb9e6('0x1'));var logger=require(_0xb9e6('0x2'))(_0xb9e6('0x3'));var moment=require(_0xb9e6('0x4'));var BPromise=require(_0xb9e6('0x5'));var rp=require(_0xb9e6('0x6'));var fs=require('fs');var path=require(_0xb9e6('0x7'));var rimraf=require('rimraf');var config=require(_0xb9e6('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xb9e6('0x9')]=function(_0x16d5e4,_0x2a0b6b){return _0x16d5e4[_0xb9e6('0xa')](_0xb9e6('0xb'),attributes,{'tableName':_0xb9e6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35ab=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x35ab,0x1d9));var _0xb35a=function(_0x1f4ea0,_0xf62d9b){_0x1f4ea0=_0x1f4ea0-0x0;var _0xc3d0ca=_0x35ab[_0x1f4ea0];return _0xc3d0ca;};'use strict';var _=require(_0xb35a('0x0'));var util=require(_0xb35a('0x1'));var logger=require(_0xb35a('0x2'))(_0xb35a('0x3'));var moment=require(_0xb35a('0x4'));var BPromise=require(_0xb35a('0x5'));var rp=require(_0xb35a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb35a('0x7'));var config=require(_0xb35a('0x8'));var attributes=require(_0xb35a('0x9'));module[_0xb35a('0xa')]=function(_0x52fbcb,_0x8a7f83){return _0x52fbcb[_0xb35a('0xb')]('FreshdeskConfiguration',attributes,{'tableName':_0xb35a('0xc'),'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 590bba7..77abf41 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 _0x47e1=['info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x47e1,0x6b));var _0x147e=function(_0x5127de,_0x3cd192){_0x5127de=_0x5127de-0x0;var _0x2c228a=_0x47e1[_0x5127de];return _0x2c228a;};'use strict';var _=require(_0x147e('0x0'));var util=require('util');var moment=require(_0x147e('0x1'));var BPromise=require(_0x147e('0x2'));var rs=require(_0x147e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x147e('0x4'))['db'];var utils=require(_0x147e('0x5'));var logger=require('../../config/logger')(_0x147e('0x6'));var config=require(_0x147e('0x7'));var jayson=require(_0x147e('0x8'));var client=jayson[_0x147e('0x9')][_0x147e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b8b6b,_0x320902,_0x3eb82b){return new BPromise(function(_0x1ce975,_0x6a63a5){return client[_0x147e('0xb')](_0x3b8b6b,_0x3eb82b)[_0x147e('0xc')](function(_0x51bca1){logger[_0x147e('0xd')](_0x147e('0xe'),_0x320902,_0x147e('0xf'));logger[_0x147e('0x10')](_0x147e('0x11'),_0x320902,'request\x20sent',JSON[_0x147e('0x12')](_0x51bca1));if(_0x51bca1[_0x147e('0x13')]){if(_0x51bca1[_0x147e('0x13')][_0x147e('0x14')]===0x1f4){logger[_0x147e('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x320902,_0x51bca1[_0x147e('0x13')][_0x147e('0x15')]);return _0x6a63a5(_0x51bca1['error'][_0x147e('0x15')]);}logger[_0x147e('0x13')](_0x147e('0xe'),_0x320902,_0x51bca1[_0x147e('0x13')][_0x147e('0x15')]);return _0x1ce975(_0x51bca1[_0x147e('0x13')][_0x147e('0x15')]);}else{logger[_0x147e('0xd')](_0x147e('0xe'),_0x320902,'request\x20sent');_0x1ce975(_0x51bca1[_0x147e('0x16')][_0x147e('0x15')]);}})[_0x147e('0x17')](function(_0x23b7a1){logger['error'](_0x147e('0xe'),_0x320902,_0x23b7a1);_0x6a63a5(_0x23b7a1);});});} \ No newline at end of file +var _0x55d3=['http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x564656,_0x251e6c){var _0x2cbf40=function(_0x12426a){while(--_0x12426a){_0x564656['push'](_0x564656['shift']());}};_0x2cbf40(++_0x251e6c);}(_0x55d3,0x108));var _0x355d=function(_0x324c80,_0x16f210){_0x324c80=_0x324c80-0x0;var _0xb60721=_0x55d3[_0x324c80];return _0xb60721;};'use strict';var _=require(_0x355d('0x0'));var util=require(_0x355d('0x1'));var moment=require('moment');var BPromise=require(_0x355d('0x2'));var rs=require(_0x355d('0x3'));var fs=require('fs');var Redis=require(_0x355d('0x4'));var db=require(_0x355d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x355d('0x6'))(_0x355d('0x7'));var config=require(_0x355d('0x8'));var jayson=require(_0x355d('0x9'));var client=jayson[_0x355d('0xa')][_0x355d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5396d9,_0xb14d89,_0x59d21a){return new BPromise(function(_0x38a9a0,_0x380e1f){return client[_0x355d('0xc')](_0x5396d9,_0x59d21a)[_0x355d('0xd')](function(_0xf9ae48){logger[_0x355d('0xe')](_0x355d('0xf'),_0xb14d89,'request\x20sent');logger[_0x355d('0x10')](_0x355d('0x11'),_0xb14d89,_0x355d('0x12'),JSON[_0x355d('0x13')](_0xf9ae48));if(_0xf9ae48['error']){if(_0xf9ae48['error'][_0x355d('0x14')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0xb14d89,_0xf9ae48[_0x355d('0x15')][_0x355d('0x16')]);return _0x380e1f(_0xf9ae48[_0x355d('0x15')][_0x355d('0x16')]);}logger[_0x355d('0x15')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xb14d89,_0xf9ae48[_0x355d('0x15')]['message']);return _0x38a9a0(_0xf9ae48[_0x355d('0x15')]['message']);}else{logger[_0x355d('0xe')](_0x355d('0xf'),_0xb14d89,_0x355d('0x12'));_0x38a9a0(_0xf9ae48[_0x355d('0x17')][_0x355d('0x16')]);}})[_0x355d('0x18')](function(_0x5916fe){logger[_0x355d('0x15')](_0x355d('0xf'),_0xb14d89,_0x5916fe);_0x380e1f(_0x5916fe);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 73b7193..59abf57 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 _0xb3d5=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller'];(function(_0x4c8bc5,_0x1d0adb){var _0x2d545c=function(_0x6e364f){while(--_0x6e364f){_0x4c8bc5['push'](_0x4c8bc5['shift']());}};_0x2d545c(++_0x1d0adb);}(_0xb3d5,0x70));var _0x5b3d=function(_0x664812,_0x6fa776){_0x664812=_0x664812-0x0;var _0x5f1687=_0xb3d5[_0x664812];return _0x5f1687;};'use strict';var multer=require(_0x5b3d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5b3d('0x1'));var express=require(_0x5b3d('0x2'));var router=express['Router']();var fs_extra=require(_0x5b3d('0x3'));var auth=require(_0x5b3d('0x4'));var interaction=require(_0x5b3d('0x5'));var config=require(_0x5b3d('0x6'));var controller=require(_0x5b3d('0x7'));router[_0x5b3d('0x8')]('/',auth[_0x5b3d('0x9')](),controller[_0x5b3d('0xa')]);router[_0x5b3d('0x8')](_0x5b3d('0xb'),auth[_0x5b3d('0x9')](),controller[_0x5b3d('0xc')]);router[_0x5b3d('0xd')]('/',auth[_0x5b3d('0x9')](),controller[_0x5b3d('0xe')]);router[_0x5b3d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5b3d('0x10')]);router[_0x5b3d('0x11')](_0x5b3d('0xb'),auth[_0x5b3d('0x9')](),controller[_0x5b3d('0x12')]);module[_0x5b3d('0x13')]=router; \ No newline at end of file +var _0x3560=['exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./intFreshdeskField.controller','get','index','/:id','post','isAuthenticated','create','put','delete','destroy'];(function(_0x53cf5e,_0x2b9ec7){var _0x24ba53=function(_0xd54774){while(--_0xd54774){_0x53cf5e['push'](_0x53cf5e['shift']());}};_0x24ba53(++_0x2b9ec7);}(_0x3560,0x78));var _0x0356=function(_0x21125f,_0x8079f8){_0x21125f=_0x21125f-0x0;var _0x2f421d=_0x3560[_0x21125f];return _0x2f421d;};'use strict';var multer=require('multer');var util=require(_0x0356('0x0'));var path=require(_0x0356('0x1'));var timeout=require(_0x0356('0x2'));var express=require(_0x0356('0x3'));var router=express[_0x0356('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0356('0x5'));var config=require('../../config/environment');var controller=require(_0x0356('0x6'));router[_0x0356('0x7')]('/',auth['isAuthenticated'](),controller[_0x0356('0x8')]);router[_0x0356('0x7')](_0x0356('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x0356('0xa')]('/',auth[_0x0356('0xb')](),controller[_0x0356('0xc')]);router[_0x0356('0xd')](_0x0356('0x9'),auth[_0x0356('0xb')](),controller['update']);router[_0x0356('0xe')](_0x0356('0x9'),auth['isAuthenticated'](),controller[_0x0356('0xf')]);module[_0x0356('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index a1cfc39..7c62324 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 _0xb783=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0xf1a516,_0x4b7594){var _0x6792d2=function(_0x2bbdf1){while(--_0x2bbdf1){_0xf1a516['push'](_0xf1a516['shift']());}};_0x6792d2(++_0x4b7594);}(_0xb783,0x12e));var _0x3b78=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xb783[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require(_0x3b78('0x0'));module[_0x3b78('0x1')]={'type':{'type':Sequelize[_0x3b78('0x2')]('string',_0x3b78('0x3'),_0x3b78('0x4'),_0x3b78('0x5'),_0x3b78('0x6')),'defaultValue':_0x3b78('0x7')},'content':{'type':Sequelize[_0x3b78('0x8')]},'key':{'type':Sequelize[_0x3b78('0x8')]},'keyType':{'type':Sequelize[_0x3b78('0x2')](_0x3b78('0x7'),'variable',_0x3b78('0x4'))},'keyContent':{'type':Sequelize[_0x3b78('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3b78('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3b78('0x8')]}}; \ No newline at end of file +var _0x6662=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x302e80,_0x3aa51a){var _0x4ff161=function(_0x104786){while(--_0x104786){_0x302e80['push'](_0x302e80['shift']());}};_0x4ff161(++_0x3aa51a);}(_0x6662,0x172));var _0x2666=function(_0x1aed01,_0x3b59f3){_0x1aed01=_0x1aed01-0x0;var _0x34ccb8=_0x6662[_0x1aed01];return _0x34ccb8;};'use strict';var Sequelize=require(_0x2666('0x0'));module[_0x2666('0x1')]={'type':{'type':Sequelize[_0x2666('0x2')](_0x2666('0x3'),_0x2666('0x4'),_0x2666('0x5'),_0x2666('0x6'),_0x2666('0x7')),'defaultValue':_0x2666('0x3')},'content':{'type':Sequelize[_0x2666('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x2666('0x3'),_0x2666('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x2666('0x8')]},'idField':{'type':Sequelize[_0x2666('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2666('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2666('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index fa653f7..6fc36d0 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 _0x823c=['reject','save','update','destroy','then','end','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','filters','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply'];(function(_0x50dd2d,_0x2ed7d5){var _0x7b56fc=function(_0x48ce66){while(--_0x48ce66){_0x50dd2d['push'](_0x50dd2d['shift']());}};_0x7b56fc(++_0x2ed7d5);}(_0x823c,0x143));var _0xc823=function(_0x4f9ab3,_0x19d2cc){_0x4f9ab3=_0x4f9ab3-0x0;var _0x34c2bd=_0x823c[_0x4f9ab3];return _0x34c2bd;};'use strict';var emlformat=require(_0xc823('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc823('0x1'));var jsonpatch=require(_0xc823('0x2'));var rp=require(_0xc823('0x3'));var moment=require(_0xc823('0x4'));var BPromise=require(_0xc823('0x5'));var Mustache=require(_0xc823('0x6'));var util=require('util');var path=require(_0xc823('0x7'));var sox=require(_0xc823('0x8'));var csv=require(_0xc823('0x9'));var ejs=require(_0xc823('0xa'));var fs=require('fs');var fs_extra=require(_0xc823('0xb'));var _=require('lodash');var squel=require(_0xc823('0xc'));var crypto=require(_0xc823('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc823('0x9'));var querystring=require(_0xc823('0xe'));var Papa=require('papaparse');var Redis=require(_0xc823('0xf'));var authService=require(_0xc823('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc823('0x11'));var logger=require(_0xc823('0x12'))(_0xc823('0x13'));var utils=require(_0xc823('0x14'));var config=require(_0xc823('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc823('0x16'))['db'];function respondWithStatusCode(_0x80372,_0x11c0fd){_0x11c0fd=_0x11c0fd||0xcc;return function(_0x1546b9){if(_0x1546b9){return _0x80372[_0xc823('0x17')](_0x11c0fd);}return _0x80372[_0xc823('0x18')](_0x11c0fd)['end']();};}function respondWithResult(_0x1e4425,_0xff0ec2){_0xff0ec2=_0xff0ec2||0xc8;return function(_0x4daac9){if(_0x4daac9){return _0x1e4425[_0xc823('0x18')](_0xff0ec2)['json'](_0x4daac9);}};}function respondWithFilteredResult(_0x4bc9c9,_0x59749d){return function(_0x5bdfc9){if(_0x5bdfc9){var _0x565aeb=typeof _0x59749d['offset']===_0xc823('0x19')&&typeof _0x59749d[_0xc823('0x1a')]===_0xc823('0x19');var _0x2ff583=_0x5bdfc9[_0xc823('0x1b')];var _0x1aca6d=_0x565aeb?0x0:_0x59749d[_0xc823('0x1c')];var _0x58b7c7=_0x565aeb?_0x5bdfc9[_0xc823('0x1b')]:_0x59749d['offset']+_0x59749d[_0xc823('0x1a')];var _0x3aa68f;if(_0x58b7c7>=_0x2ff583){_0x58b7c7=_0x2ff583;_0x3aa68f=0xc8;}else{_0x3aa68f=0xce;}_0x4bc9c9[_0xc823('0x18')](_0x3aa68f);return _0x4bc9c9['set'](_0xc823('0x1d'),_0x1aca6d+'-'+_0x58b7c7+'/'+_0x2ff583)[_0xc823('0x1e')](_0x5bdfc9);}return null;};}function patchUpdates(_0x3a3fcd){return function(_0x599e59){try{jsonpatch[_0xc823('0x1f')](_0x599e59,_0x3a3fcd,!![]);}catch(_0x325c8a){return BPromise[_0xc823('0x20')](_0x325c8a);}return _0x599e59[_0xc823('0x21')]();};}function saveUpdates(_0x574c76,_0x414c86){return function(_0x5dcb4e){if(_0x5dcb4e){return _0x5dcb4e[_0xc823('0x22')](_0x574c76)['then'](function(_0x510460){return _0x510460;});}return null;};}function removeEntity(_0x3af14f,_0x3cead8){return function(_0x52c941){if(_0x52c941){return _0x52c941[_0xc823('0x23')]()[_0xc823('0x24')](function(){_0x3af14f[_0xc823('0x18')](0xcc)[_0xc823('0x25')]();});}};}function handleEntityNotFound(_0x263865,_0x8d6161){return function(_0x19594e){if(!_0x19594e){_0x263865[_0xc823('0x17')](0x194);}return _0x19594e;};}function handleError(_0x14bd7d,_0x26bb81){_0x26bb81=_0x26bb81||0x1f4;return function(_0x4e4bd4){logger[_0xc823('0x26')](_0x4e4bd4['stack']);if(_0x4e4bd4['name']){delete _0x4e4bd4[_0xc823('0x27')];}_0x14bd7d[_0xc823('0x18')](_0x26bb81)[_0xc823('0x28')](_0x4e4bd4);};}exports[_0xc823('0x29')]=function(_0x20d2b1,_0x182fcf){var _0x1d20c6={},_0xa5a380={},_0x12f061={'count':0x0,'rows':[]};var _0xba0f46=_[_0xc823('0x2a')](db[_0xc823('0x2b')][_0xc823('0x2c')],function(_0xda39a3){return{'name':_0xda39a3[_0xc823('0x2d')],'type':_0xda39a3['type'][_0xc823('0x2e')]};});_0xa5a380[_0xc823('0x2f')]=_[_0xc823('0x2a')](_0xba0f46,_0xc823('0x27'));_0xa5a380[_0xc823('0x30')]=_['keys'](_0x20d2b1['query']);_0xa5a380['filters']=_[_0xc823('0x31')](_0xa5a380[_0xc823('0x2f')],_0xa5a380[_0xc823('0x30')]);_0x1d20c6[_0xc823('0x32')]=_['intersection'](_0xa5a380[_0xc823('0x2f')],qs[_0xc823('0x33')](_0x20d2b1[_0xc823('0x30')][_0xc823('0x33')]));_0x1d20c6[_0xc823('0x32')]=_0x1d20c6[_0xc823('0x32')][_0xc823('0x34')]?_0x1d20c6[_0xc823('0x32')]:_0xa5a380[_0xc823('0x2f')];if(!_0x20d2b1[_0xc823('0x30')][_0xc823('0x35')](_0xc823('0x36'))){_0x1d20c6[_0xc823('0x1a')]=qs['limit'](_0x20d2b1[_0xc823('0x30')][_0xc823('0x1a')]);_0x1d20c6[_0xc823('0x1c')]=qs[_0xc823('0x1c')](_0x20d2b1[_0xc823('0x30')][_0xc823('0x1c')]);}_0x1d20c6['order']=qs[_0xc823('0x37')](_0x20d2b1[_0xc823('0x30')]['sort']);_0x1d20c6[_0xc823('0x38')]=qs['filters'](_[_0xc823('0x39')](_0x20d2b1[_0xc823('0x30')],_0xa5a380['filters']),_0xba0f46);if(_0x20d2b1[_0xc823('0x30')][_0xc823('0x3a')]){_0x1d20c6[_0xc823('0x38')]=_[_0xc823('0x3b')](_0x1d20c6[_0xc823('0x38')],{'$or':_[_0xc823('0x2a')](_0xba0f46,function(_0x1fb5a4){if(_0x1fb5a4['type']!=='VIRTUAL'){var _0x48decd={};_0x48decd[_0x1fb5a4[_0xc823('0x27')]]={'$like':'%'+_0x20d2b1[_0xc823('0x30')][_0xc823('0x3a')]+'%'};return _0x48decd;}})});}_0x1d20c6=_[_0xc823('0x3b')]({},_0x1d20c6,_0x20d2b1[_0xc823('0x3c')]);var _0x5d547f={'where':_0x1d20c6[_0xc823('0x38')]};return db[_0xc823('0x2b')][_0xc823('0x1b')](_0x5d547f)[_0xc823('0x24')](function(_0x5d6e9b){_0x12f061['count']=_0x5d6e9b;if(_0x20d2b1['query'][_0xc823('0x3d')]){_0x1d20c6[_0xc823('0x3e')]=[{'all':!![]}];}return db[_0xc823('0x2b')]['findAll'](_0x1d20c6);})[_0xc823('0x24')](function(_0x4aa160){_0x12f061[_0xc823('0x3f')]=_0x4aa160;return _0x12f061;})[_0xc823('0x24')](respondWithFilteredResult(_0x182fcf,_0x1d20c6))[_0xc823('0x40')](handleError(_0x182fcf,null));};exports[_0xc823('0x41')]=function(_0x337541,_0x26a2f2){var _0x46daca={'raw':!![],'where':{'id':_0x337541[_0xc823('0x42')]['id']}},_0x521e47={};_0x521e47['model']=_[_0xc823('0x43')](db[_0xc823('0x2b')][_0xc823('0x2c')]);_0x521e47[_0xc823('0x30')]=_[_0xc823('0x43')](_0x337541[_0xc823('0x30')]);_0x521e47[_0xc823('0x44')]=_[_0xc823('0x31')](_0x521e47['model'],_0x521e47[_0xc823('0x30')]);_0x46daca[_0xc823('0x32')]=_['intersection'](_0x521e47[_0xc823('0x2f')],qs[_0xc823('0x33')](_0x337541[_0xc823('0x30')][_0xc823('0x33')]));_0x46daca[_0xc823('0x32')]=_0x46daca[_0xc823('0x32')][_0xc823('0x34')]?_0x46daca[_0xc823('0x32')]:_0x521e47[_0xc823('0x2f')];if(_0x337541['query'][_0xc823('0x3d')]){_0x46daca[_0xc823('0x3e')]=[{'all':!![]}];}_0x46daca=_['merge']({},_0x46daca,_0x337541[_0xc823('0x3c')]);return db[_0xc823('0x2b')]['find'](_0x46daca)[_0xc823('0x24')](handleEntityNotFound(_0x26a2f2,null))['then'](respondWithResult(_0x26a2f2,null))[_0xc823('0x40')](handleError(_0x26a2f2,null));};exports[_0xc823('0x45')]=function(_0x57f4c0,_0x5e999d){return db[_0xc823('0x2b')][_0xc823('0x45')](_0x57f4c0[_0xc823('0x46')],{})[_0xc823('0x24')](respondWithResult(_0x5e999d,0xc9))[_0xc823('0x40')](handleError(_0x5e999d,null));};exports[_0xc823('0x22')]=function(_0x190a72,_0x1ae82d){if(_0x190a72['body']['id']){delete _0x190a72[_0xc823('0x46')]['id'];}return db[_0xc823('0x2b')]['find']({'where':{'id':_0x190a72['params']['id']}})[_0xc823('0x24')](handleEntityNotFound(_0x1ae82d,null))['then'](saveUpdates(_0x190a72['body'],null))['then'](respondWithResult(_0x1ae82d,null))['catch'](handleError(_0x1ae82d,null));};exports['destroy']=function(_0x511d71,_0x8f742d){return db['FreshdeskField']['find']({'where':{'id':_0x511d71[_0xc823('0x42')]['id']}})['then'](handleEntityNotFound(_0x8f742d,null))[_0xc823('0x24')](removeEntity(_0x8f742d,null))[_0xc823('0x40')](handleError(_0x8f742d,null));}; \ No newline at end of file +var _0x263f=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','findAll','catch','show','params','length','includeAll','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','set','reject','save','update','then','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','type','model'];(function(_0x39ed71,_0x40e6c4){var _0x233ec0=function(_0x10b091){while(--_0x10b091){_0x39ed71['push'](_0x39ed71['shift']());}};_0x233ec0(++_0x40e6c4);}(_0x263f,0x182));var _0xf263=function(_0x2eddcf,_0x29a0bf){_0x2eddcf=_0x2eddcf-0x0;var _0x4cbbd1=_0x263f[_0x2eddcf];return _0x4cbbd1;};'use strict';var emlformat=require(_0xf263('0x0'));var rimraf=require(_0xf263('0x1'));var zipdir=require(_0xf263('0x2'));var jsonpatch=require(_0xf263('0x3'));var rp=require(_0xf263('0x4'));var moment=require(_0xf263('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf263('0x6'));var util=require(_0xf263('0x7'));var path=require(_0xf263('0x8'));var sox=require('sox');var csv=require(_0xf263('0x9'));var ejs=require(_0xf263('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf263('0xb'));var crypto=require(_0xf263('0xc'));var jsforce=require(_0xf263('0xd'));var deskjs=require(_0xf263('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf263('0xf'));var Papa=require(_0xf263('0x10'));var Redis=require(_0xf263('0x11'));var authService=require(_0xf263('0x12'));var qs=require(_0xf263('0x13'));var as=require(_0xf263('0x14'));var hardwareService=require(_0xf263('0x15'));var logger=require('../../config/logger')(_0xf263('0x16'));var utils=require('../../config/utils');var config=require(_0xf263('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fc9f0,_0x2b1145){_0x2b1145=_0x2b1145||0xcc;return function(_0x17471d){if(_0x17471d){return _0x2fc9f0[_0xf263('0x18')](_0x2b1145);}return _0x2fc9f0[_0xf263('0x19')](_0x2b1145)[_0xf263('0x1a')]();};}function respondWithResult(_0xc75366,_0x559c6c){_0x559c6c=_0x559c6c||0xc8;return function(_0x2f40d8){if(_0x2f40d8){return _0xc75366['status'](_0x559c6c)[_0xf263('0x1b')](_0x2f40d8);}};}function respondWithFilteredResult(_0x27b16a,_0x3ac432){return function(_0x402739){if(_0x402739){var _0x16b4dd=typeof _0x3ac432[_0xf263('0x1c')]===_0xf263('0x1d')&&typeof _0x3ac432['limit']==='undefined';var _0x2bbe2f=_0x402739[_0xf263('0x1e')];var _0x325a84=_0x16b4dd?0x0:_0x3ac432[_0xf263('0x1c')];var _0x1ea46b=_0x16b4dd?_0x402739['count']:_0x3ac432[_0xf263('0x1c')]+_0x3ac432['limit'];var _0x39205b;if(_0x1ea46b>=_0x2bbe2f){_0x1ea46b=_0x2bbe2f;_0x39205b=0xc8;}else{_0x39205b=0xce;}_0x27b16a[_0xf263('0x19')](_0x39205b);return _0x27b16a[_0xf263('0x1f')]('Content-Range',_0x325a84+'-'+_0x1ea46b+'/'+_0x2bbe2f)[_0xf263('0x1b')](_0x402739);}return null;};}function patchUpdates(_0x169328){return function(_0x127135){try{jsonpatch['apply'](_0x127135,_0x169328,!![]);}catch(_0x41627f){return BPromise[_0xf263('0x20')](_0x41627f);}return _0x127135[_0xf263('0x21')]();};}function saveUpdates(_0x426667,_0xa0695){return function(_0x2c0996){if(_0x2c0996){return _0x2c0996[_0xf263('0x22')](_0x426667)[_0xf263('0x23')](function(_0x6a1dd2){return _0x6a1dd2;});}return null;};}function removeEntity(_0xe32b07,_0x29eb45){return function(_0x4de045){if(_0x4de045){return _0x4de045['destroy']()['then'](function(){_0xe32b07[_0xf263('0x19')](0xcc)[_0xf263('0x1a')]();});}};}function handleEntityNotFound(_0x231748,_0x1b3603){return function(_0x36df8e){if(!_0x36df8e){_0x231748[_0xf263('0x18')](0x194);}return _0x36df8e;};}function handleError(_0x16af55,_0x41fab2){_0x41fab2=_0x41fab2||0x1f4;return function(_0x3c44f1){logger[_0xf263('0x24')](_0x3c44f1[_0xf263('0x25')]);if(_0x3c44f1['name']){delete _0x3c44f1[_0xf263('0x26')];}_0x16af55['status'](_0x41fab2)[_0xf263('0x27')](_0x3c44f1);};}exports['index']=function(_0x368cfc,_0x3500b2){var _0x5a11bf={},_0x57ae2f={},_0x43f306={'count':0x0,'rows':[]};var _0x339b3b=_[_0xf263('0x28')](db[_0xf263('0x29')][_0xf263('0x2a')],function(_0x28288b){return{'name':_0x28288b[_0xf263('0x2b')],'type':_0x28288b[_0xf263('0x2c')]['key']};});_0x57ae2f[_0xf263('0x2d')]=_[_0xf263('0x28')](_0x339b3b,_0xf263('0x26'));_0x57ae2f[_0xf263('0x2e')]=_[_0xf263('0x2f')](_0x368cfc[_0xf263('0x2e')]);_0x57ae2f[_0xf263('0x30')]=_[_0xf263('0x31')](_0x57ae2f[_0xf263('0x2d')],_0x57ae2f['query']);_0x5a11bf[_0xf263('0x32')]=_['intersection'](_0x57ae2f['model'],qs[_0xf263('0x33')](_0x368cfc[_0xf263('0x2e')]['fields']));_0x5a11bf[_0xf263('0x32')]=_0x5a11bf[_0xf263('0x32')]['length']?_0x5a11bf[_0xf263('0x32')]:_0x57ae2f[_0xf263('0x2d')];if(!_0x368cfc[_0xf263('0x2e')][_0xf263('0x34')](_0xf263('0x35'))){_0x5a11bf[_0xf263('0x36')]=qs['limit'](_0x368cfc[_0xf263('0x2e')][_0xf263('0x36')]);_0x5a11bf['offset']=qs['offset'](_0x368cfc[_0xf263('0x2e')][_0xf263('0x1c')]);}_0x5a11bf[_0xf263('0x37')]=qs[_0xf263('0x38')](_0x368cfc['query'][_0xf263('0x38')]);_0x5a11bf[_0xf263('0x39')]=qs[_0xf263('0x30')](_[_0xf263('0x3a')](_0x368cfc[_0xf263('0x2e')],_0x57ae2f['filters']),_0x339b3b);if(_0x368cfc[_0xf263('0x2e')][_0xf263('0x3b')]){_0x5a11bf[_0xf263('0x39')]=_['merge'](_0x5a11bf[_0xf263('0x39')],{'$or':_[_0xf263('0x28')](_0x339b3b,function(_0x3f2670){if(_0x3f2670[_0xf263('0x2c')]!==_0xf263('0x3c')){var _0x5eb46a={};_0x5eb46a[_0x3f2670[_0xf263('0x26')]]={'$like':'%'+_0x368cfc[_0xf263('0x2e')][_0xf263('0x3b')]+'%'};return _0x5eb46a;}})});}_0x5a11bf=_['merge']({},_0x5a11bf,_0x368cfc[_0xf263('0x3d')]);var _0x2d20a5={'where':_0x5a11bf[_0xf263('0x39')]};return db['FreshdeskField'][_0xf263('0x1e')](_0x2d20a5)['then'](function(_0x3bb081){_0x43f306[_0xf263('0x1e')]=_0x3bb081;if(_0x368cfc[_0xf263('0x2e')]['includeAll']){_0x5a11bf['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xf263('0x3e')](_0x5a11bf);})[_0xf263('0x23')](function(_0x56303f){_0x43f306['rows']=_0x56303f;return _0x43f306;})[_0xf263('0x23')](respondWithFilteredResult(_0x3500b2,_0x5a11bf))[_0xf263('0x3f')](handleError(_0x3500b2,null));};exports[_0xf263('0x40')]=function(_0x11205c,_0x1bc12a){var _0x54d8e4={'raw':!![],'where':{'id':_0x11205c[_0xf263('0x41')]['id']}},_0x1577c9={};_0x1577c9[_0xf263('0x2d')]=_[_0xf263('0x2f')](db[_0xf263('0x29')]['rawAttributes']);_0x1577c9[_0xf263('0x2e')]=_[_0xf263('0x2f')](_0x11205c[_0xf263('0x2e')]);_0x1577c9['filters']=_['intersection'](_0x1577c9[_0xf263('0x2d')],_0x1577c9['query']);_0x54d8e4['attributes']=_[_0xf263('0x31')](_0x1577c9[_0xf263('0x2d')],qs[_0xf263('0x33')](_0x11205c['query'][_0xf263('0x33')]));_0x54d8e4[_0xf263('0x32')]=_0x54d8e4['attributes'][_0xf263('0x42')]?_0x54d8e4[_0xf263('0x32')]:_0x1577c9['model'];if(_0x11205c[_0xf263('0x2e')][_0xf263('0x43')]){_0x54d8e4['include']=[{'all':!![]}];}_0x54d8e4=_[_0xf263('0x44')]({},_0x54d8e4,_0x11205c[_0xf263('0x3d')]);return db[_0xf263('0x29')][_0xf263('0x45')](_0x54d8e4)[_0xf263('0x23')](handleEntityNotFound(_0x1bc12a,null))[_0xf263('0x23')](respondWithResult(_0x1bc12a,null))[_0xf263('0x3f')](handleError(_0x1bc12a,null));};exports['create']=function(_0x11eb85,_0x2e8cbe){return db[_0xf263('0x29')][_0xf263('0x46')](_0x11eb85[_0xf263('0x47')],{})[_0xf263('0x23')](respondWithResult(_0x2e8cbe,0xc9))[_0xf263('0x3f')](handleError(_0x2e8cbe,null));};exports[_0xf263('0x22')]=function(_0x5da8ba,_0x8993f7){if(_0x5da8ba[_0xf263('0x47')]['id']){delete _0x5da8ba[_0xf263('0x47')]['id'];}return db[_0xf263('0x29')]['find']({'where':{'id':_0x5da8ba[_0xf263('0x41')]['id']}})['then'](handleEntityNotFound(_0x8993f7,null))[_0xf263('0x23')](saveUpdates(_0x5da8ba[_0xf263('0x47')],null))[_0xf263('0x23')](respondWithResult(_0x8993f7,null))['catch'](handleError(_0x8993f7,null));};exports['destroy']=function(_0x5b5585,_0x4f5578){return db['FreshdeskField'][_0xf263('0x45')]({'where':{'id':_0x5b5585[_0xf263('0x41')]['id']}})['then'](handleEntityNotFound(_0x4f5578,null))[_0xf263('0x23')](removeEntity(_0x4f5578,null))[_0xf263('0x3f')](handleError(_0x4f5578,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index fd29c04..b8051b0 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 _0x84ed=['path','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xabe763,_0x13afcf){var _0x2f87c3=function(_0x416681){while(--_0x416681){_0xabe763['push'](_0xabe763['shift']());}};_0x2f87c3(++_0x13afcf);}(_0x84ed,0x1bc));var _0xd84e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x84ed[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xd84e('0x0'));var util=require(_0xd84e('0x1'));var logger=require(_0xd84e('0x2'))(_0xd84e('0x3'));var moment=require(_0xd84e('0x4'));var BPromise=require(_0xd84e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd84e('0x6'));var rimraf=require(_0xd84e('0x7'));var config=require('../../config/environment');var attributes=require(_0xd84e('0x8'));module[_0xd84e('0x9')]=function(_0x5dd1ba,_0x2dd572){return _0x5dd1ba[_0xd84e('0xa')](_0xd84e('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xd84e('0xc'),'fields':[_0xd84e('0xd'),_0xd84e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe790=['FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField'];(function(_0x4c7384,_0x4c4fc3){var _0xa29fd2=function(_0x20b58e){while(--_0x20b58e){_0x4c7384['push'](_0x4c7384['shift']());}};_0xa29fd2(++_0x4c4fc3);}(_0xe790,0x90));var _0x0e79=function(_0x151ec9,_0x3d974f){_0x151ec9=_0x151ec9-0x0;var _0x1af291=_0xe790[_0x151ec9];return _0x1af291;};'use strict';var _=require('lodash');var util=require(_0x0e79('0x0'));var logger=require(_0x0e79('0x1'))(_0x0e79('0x2'));var moment=require(_0x0e79('0x3'));var BPromise=require(_0x0e79('0x4'));var rp=require(_0x0e79('0x5'));var fs=require('fs');var path=require(_0x0e79('0x6'));var rimraf=require(_0x0e79('0x7'));var config=require('../../config/environment');var attributes=require(_0x0e79('0x8'));module[_0x0e79('0x9')]=function(_0x596f75,_0xca4738){return _0x596f75[_0x0e79('0xa')](_0x0e79('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x0e79('0xc')],'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 4ca7028..5de4f28 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 _0xf30b=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','bluebird'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xf30b,0x11f));var _0xbf30=function(_0x406ba5,_0x39fa4b){_0x406ba5=_0x406ba5-0x0;var _0x557db7=_0xf30b[_0x406ba5];return _0x557db7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbf30('0x0'));var rs=require(_0xbf30('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf30('0x2'))['db'];var utils=require(_0xbf30('0x3'));var logger=require(_0xbf30('0x4'))(_0xbf30('0x5'));var config=require(_0xbf30('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f2e37,_0xa739f2,_0x178b02){return new BPromise(function(_0xc3cf09,_0x59cf9f){return client[_0xbf30('0x7')](_0x4f2e37,_0x178b02)['then'](function(_0x434fc0){logger[_0xbf30('0x8')](_0xbf30('0x9'),_0xa739f2,_0xbf30('0xa'));logger[_0xbf30('0xb')](_0xbf30('0xc'),_0xa739f2,_0xbf30('0xa'),JSON['stringify'](_0x434fc0));if(_0x434fc0[_0xbf30('0xd')]){if(_0x434fc0[_0xbf30('0xd')][_0xbf30('0xe')]===0x1f4){logger[_0xbf30('0xd')]('FreshdeskField,\x20%s,\x20%s',_0xa739f2,_0x434fc0['error']['message']);return _0x59cf9f(_0x434fc0[_0xbf30('0xd')][_0xbf30('0xf')]);}logger[_0xbf30('0xd')](_0xbf30('0x9'),_0xa739f2,_0x434fc0[_0xbf30('0xd')][_0xbf30('0xf')]);return _0xc3cf09(_0x434fc0[_0xbf30('0xd')][_0xbf30('0xf')]);}else{logger[_0xbf30('0x8')](_0xbf30('0x9'),_0xa739f2,_0xbf30('0xa'));_0xc3cf09(_0x434fc0[_0xbf30('0x10')][_0xbf30('0xf')]);}})[_0xbf30('0x11')](function(_0x5b31eb){logger[_0xbf30('0xd')](_0xbf30('0x9'),_0xa739f2,_0x5b31eb);_0x59cf9f(_0x5b31eb);});});} \ No newline at end of file +var _0xac01=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird'];(function(_0x9a3d47,_0x1953a0){var _0xf60b78=function(_0x31575d){while(--_0x31575d){_0x9a3d47['push'](_0x9a3d47['shift']());}};_0xf60b78(++_0x1953a0);}(_0xac01,0xd8));var _0x1ac0=function(_0x41ef70,_0x26cc33){_0x41ef70=_0x41ef70-0x0;var _0x55a08b=_0xac01[_0x41ef70];return _0x55a08b;};'use strict';var _=require(_0x1ac0('0x0'));var util=require(_0x1ac0('0x1'));var moment=require(_0x1ac0('0x2'));var BPromise=require(_0x1ac0('0x3'));var rs=require(_0x1ac0('0x4'));var fs=require('fs');var Redis=require(_0x1ac0('0x5'));var db=require(_0x1ac0('0x6'))['db'];var utils=require(_0x1ac0('0x7'));var logger=require(_0x1ac0('0x8'))(_0x1ac0('0x9'));var config=require('../../config/environment');var jayson=require(_0x1ac0('0xa'));var client=jayson[_0x1ac0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d3a55,_0x3dcf67,_0x306863){return new BPromise(function(_0x30615a,_0x275441){return client['request'](_0x2d3a55,_0x306863)[_0x1ac0('0xc')](function(_0x4ff8dd){logger[_0x1ac0('0xd')](_0x1ac0('0xe'),_0x3dcf67,_0x1ac0('0xf'));logger[_0x1ac0('0x10')](_0x1ac0('0x11'),_0x3dcf67,_0x1ac0('0xf'),JSON[_0x1ac0('0x12')](_0x4ff8dd));if(_0x4ff8dd['error']){if(_0x4ff8dd[_0x1ac0('0x13')][_0x1ac0('0x14')]===0x1f4){logger[_0x1ac0('0x13')](_0x1ac0('0xe'),_0x3dcf67,_0x4ff8dd[_0x1ac0('0x13')][_0x1ac0('0x15')]);return _0x275441(_0x4ff8dd[_0x1ac0('0x13')][_0x1ac0('0x15')]);}logger[_0x1ac0('0x13')](_0x1ac0('0xe'),_0x3dcf67,_0x4ff8dd['error'][_0x1ac0('0x15')]);return _0x30615a(_0x4ff8dd[_0x1ac0('0x13')]['message']);}else{logger[_0x1ac0('0xd')](_0x1ac0('0xe'),_0x3dcf67,_0x1ac0('0xf'));_0x30615a(_0x4ff8dd['result'][_0x1ac0('0x15')]);}})['catch'](function(_0x18f47d){logger[_0x1ac0('0x13')](_0x1ac0('0xe'),_0x3dcf67,_0x18f47d);_0x275441(_0x18f47d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index d78c026..5c42baa 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 _0x0972=['create','addConfiguration','put','/:id','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x0972,0x64));var _0x2097=function(_0x5865ad,_0x21a86a){_0x5865ad=_0x5865ad-0x0;var _0x4c8960=_0x0972[_0x5865ad];return _0x4c8960;};'use strict';var multer=require('multer');var util=require(_0x2097('0x0'));var path=require('path');var timeout=require(_0x2097('0x1'));var express=require('express');var router=express[_0x2097('0x2')]();var fs_extra=require(_0x2097('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var controller=require(_0x2097('0x6'));router[_0x2097('0x7')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0x9')]);router[_0x2097('0x7')]('/:id',auth[_0x2097('0x8')](),controller[_0x2097('0xa')]);router[_0x2097('0x7')](_0x2097('0xb'),auth[_0x2097('0x8')](),controller['getConfigurations']);router[_0x2097('0x7')](_0x2097('0xc'),auth[_0x2097('0x8')](),controller[_0x2097('0xd')]);router[_0x2097('0xe')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0xf')]);router[_0x2097('0xe')](_0x2097('0xb'),auth[_0x2097('0x8')](),controller[_0x2097('0x10')]);router[_0x2097('0x11')](_0x2097('0x12'),auth[_0x2097('0x8')](),controller[_0x2097('0x13')]);router[_0x2097('0x14')](_0x2097('0x12'),auth[_0x2097('0x8')](),controller[_0x2097('0x15')]);module[_0x2097('0x16')]=router; \ No newline at end of file +var _0xa75b=['post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields'];(function(_0x5ee820,_0x1eaab3){var _0x5c08a5=function(_0x486fcb){while(--_0x486fcb){_0x5ee820['push'](_0x5ee820['shift']());}};_0x5c08a5(++_0x1eaab3);}(_0xa75b,0x170));var _0xba75=function(_0x52b86d,_0x23f0cf){_0x52b86d=_0x52b86d-0x0;var _0xa48674=_0xa75b[_0x52b86d];return _0xa48674;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xba75('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['get'](_0xba75('0xe'),auth[_0xba75('0xa')](),controller[_0xba75('0xf')]);router[_0xba75('0x10')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x10')](_0xba75('0x12'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);router[_0xba75('0x14')](_0xba75('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xba75('0x15')]('/:id',auth[_0xba75('0xa')](),controller[_0xba75('0x16')]);module[_0xba75('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 d2f2a67..84a6dfd 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 _0xa456=['STRING','username','sequelize','exports'];(function(_0x156870,_0x230e8e){var _0x262bd2=function(_0x454677){while(--_0x454677){_0x156870['push'](_0x156870['shift']());}};_0x262bd2(++_0x230e8e);}(_0xa456,0x142));var _0x6a45=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xa456[_0x220f3f];return _0x1f170e;};'use strict';var Sequelize=require(_0x6a45('0x0'));module[_0x6a45('0x1')]={'name':{'type':Sequelize[_0x6a45('0x2')]},'description':{'type':Sequelize[_0x6a45('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6a45('0x3')},'apiKey':{'type':Sequelize[_0x6a45('0x2')]},'remoteUri':{'type':Sequelize[_0x6a45('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6a45('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7916=['sequelize','STRING','username','remoteUri'];(function(_0x31de4e,_0x4024d8){var _0x3108d7=function(_0xe7593e){while(--_0xe7593e){_0x31de4e['push'](_0x31de4e['shift']());}};_0x3108d7(++_0x4024d8);}(_0x7916,0x128));var _0x6791=function(_0x155fea,_0x1afd1e){_0x155fea=_0x155fea-0x0;var _0x4394bb=_0x7916[_0x155fea];return _0x4394bb;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')]},'description':{'type':Sequelize[_0x6791('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6791('0x2')},'apiKey':{'type':Sequelize[_0x6791('0x1')]},'remoteUri':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index a6655a2..3d22e03 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 _0xebab=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','error','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','map','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','destroy','getConfigurations','findOne','FreshsalesConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s%s','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5c872e,_0x465446){var _0x5bae13=function(_0x375052){while(--_0x375052){_0x5c872e['push'](_0x5c872e['shift']());}};_0x5bae13(++_0x465446);}(_0xebab,0x13e));var _0xbeba=function(_0x773dca,_0x32b2e7){_0x773dca=_0x773dca-0x0;var _0x42187d=_0xebab[_0x773dca];return _0x42187d;};'use strict';var emlformat=require(_0xbeba('0x0'));var rimraf=require(_0xbeba('0x1'));var zipdir=require(_0xbeba('0x2'));var jsonpatch=require(_0xbeba('0x3'));var rp=require(_0xbeba('0x4'));var moment=require(_0xbeba('0x5'));var BPromise=require(_0xbeba('0x6'));var Mustache=require(_0xbeba('0x7'));var util=require(_0xbeba('0x8'));var path=require(_0xbeba('0x9'));var sox=require(_0xbeba('0xa'));var csv=require(_0xbeba('0xb'));var ejs=require(_0xbeba('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbeba('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbeba('0xe'));var deskjs=require(_0xbeba('0xf'));var toCsv=require(_0xbeba('0xb'));var querystring=require(_0xbeba('0x10'));var Papa=require(_0xbeba('0x11'));var Redis=require(_0xbeba('0x12'));var authService=require(_0xbeba('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbeba('0x14'));var logger=require(_0xbeba('0x15'))('api');var utils=require(_0xbeba('0x16'));var config=require(_0xbeba('0x17'));var licenseUtil=require(_0xbeba('0x18'));var db=require(_0xbeba('0x19'))['db'];var integrations=require(_0xbeba('0x1a'));function respondWithStatusCode(_0x2253aa,_0x1fe207){_0x1fe207=_0x1fe207||0xcc;return function(_0x14aa3d){if(_0x14aa3d){return _0x2253aa[_0xbeba('0x1b')](_0x1fe207);}return _0x2253aa[_0xbeba('0x1c')](_0x1fe207)[_0xbeba('0x1d')]();};}function respondWithResult(_0x1f9bae,_0x1bec6f){_0x1bec6f=_0x1bec6f||0xc8;return function(_0x190b4c){if(_0x190b4c){return _0x1f9bae[_0xbeba('0x1c')](_0x1bec6f)[_0xbeba('0x1e')](_0x190b4c);}};}function respondWithFilteredResult(_0x5e53d1,_0x23ec2b){return function(_0x557a30){if(_0x557a30){var _0x39bfcb=typeof _0x23ec2b['offset']===_0xbeba('0x1f')&&typeof _0x23ec2b[_0xbeba('0x20')]===_0xbeba('0x1f');var _0x4302d8=_0x557a30[_0xbeba('0x21')];var _0x1e1228=_0x39bfcb?0x0:_0x23ec2b[_0xbeba('0x22')];var _0x1e4dd2=_0x39bfcb?_0x557a30[_0xbeba('0x21')]:_0x23ec2b[_0xbeba('0x22')]+_0x23ec2b[_0xbeba('0x20')];var _0x1900b7;if(_0x1e4dd2>=_0x4302d8){_0x1e4dd2=_0x4302d8;_0x1900b7=0xc8;}else{_0x1900b7=0xce;}_0x5e53d1['status'](_0x1900b7);return _0x5e53d1[_0xbeba('0x23')]('Content-Range',_0x1e1228+'-'+_0x1e4dd2+'/'+_0x4302d8)['json'](_0x557a30);}return null;};}function patchUpdates(_0x52426c){return function(_0x21e72a){try{jsonpatch[_0xbeba('0x24')](_0x21e72a,_0x52426c,!![]);}catch(_0xf07ce8){return BPromise[_0xbeba('0x25')](_0xf07ce8);}return _0x21e72a['save']();};}function saveUpdates(_0x41b196,_0x1ba84a){return function(_0x4926d6){if(_0x4926d6){return _0x4926d6[_0xbeba('0x26')](_0x41b196)[_0xbeba('0x27')](function(_0x95ae18){return _0x95ae18;});}return null;};}function removeEntity(_0x53ba2f,_0x21b5f8){return function(_0x3028c8){if(_0x3028c8){return _0x3028c8['destroy']()[_0xbeba('0x27')](function(){_0x53ba2f[_0xbeba('0x1c')](0xcc)[_0xbeba('0x1d')]();});}};}function handleEntityNotFound(_0xa68488,_0x5349e2){return function(_0x18c5fe){if(!_0x18c5fe){_0xa68488['sendStatus'](0x194);}return _0x18c5fe;};}function handleError(_0x1dfc5f,_0x1ff5bf){_0x1ff5bf=_0x1ff5bf||0x1f4;return function(_0x1279a0){logger[_0xbeba('0x28')](_0x1279a0[_0xbeba('0x29')]);if(_0x1279a0[_0xbeba('0x2a')]){delete _0x1279a0[_0xbeba('0x2a')];}_0x1dfc5f[_0xbeba('0x1c')](_0x1ff5bf)[_0xbeba('0x2b')](_0x1279a0);};}exports[_0xbeba('0x2c')]=function(_0xa7077c,_0x4d268d){var _0x35ba48={},_0x1f530b={},_0x2c666b={'count':0x0,'rows':[]};var _0x403807=_['map'](db[_0xbeba('0x2d')][_0xbeba('0x2e')],function(_0xddeaa7){return{'name':_0xddeaa7[_0xbeba('0x2f')],'type':_0xddeaa7[_0xbeba('0x30')][_0xbeba('0x31')]};});_0x1f530b[_0xbeba('0x32')]=_['map'](_0x403807,_0xbeba('0x2a'));_0x1f530b['query']=_[_0xbeba('0x33')](_0xa7077c[_0xbeba('0x34')]);_0x1f530b[_0xbeba('0x35')]=_[_0xbeba('0x36')](_0x1f530b[_0xbeba('0x32')],_0x1f530b['query']);_0x35ba48['attributes']=_[_0xbeba('0x36')](_0x1f530b['model'],qs[_0xbeba('0x37')](_0xa7077c['query']['fields']));_0x35ba48[_0xbeba('0x38')]=_0x35ba48[_0xbeba('0x38')][_0xbeba('0x39')]?_0x35ba48[_0xbeba('0x38')]:_0x1f530b[_0xbeba('0x32')];if(!_0xa7077c['query']['hasOwnProperty'](_0xbeba('0x3a'))){_0x35ba48[_0xbeba('0x20')]=qs[_0xbeba('0x20')](_0xa7077c[_0xbeba('0x34')][_0xbeba('0x20')]);_0x35ba48[_0xbeba('0x22')]=qs[_0xbeba('0x22')](_0xa7077c[_0xbeba('0x34')][_0xbeba('0x22')]);}_0x35ba48[_0xbeba('0x3b')]=qs['sort'](_0xa7077c[_0xbeba('0x34')][_0xbeba('0x3c')]);_0x35ba48[_0xbeba('0x3d')]=qs[_0xbeba('0x35')](_['pick'](_0xa7077c[_0xbeba('0x34')],_0x1f530b['filters']),_0x403807);if(_0xa7077c[_0xbeba('0x34')]['filter']){_0x35ba48[_0xbeba('0x3d')]=_['merge'](_0x35ba48[_0xbeba('0x3d')],{'$or':_[_0xbeba('0x3e')](_0x403807,function(_0x4b5aa1){if(_0x4b5aa1[_0xbeba('0x30')]!==_0xbeba('0x3f')){var _0x285a58={};_0x285a58[_0x4b5aa1[_0xbeba('0x2a')]]={'$like':'%'+_0xa7077c[_0xbeba('0x34')][_0xbeba('0x40')]+'%'};return _0x285a58;}})});}_0x35ba48=_[_0xbeba('0x41')]({},_0x35ba48,_0xa7077c['options']);var _0x1908d6={'where':_0x35ba48[_0xbeba('0x3d')]};return db[_0xbeba('0x2d')][_0xbeba('0x21')](_0x1908d6)[_0xbeba('0x27')](function(_0x5cfcdb){_0x2c666b[_0xbeba('0x21')]=_0x5cfcdb;if(_0xa7077c[_0xbeba('0x34')][_0xbeba('0x42')]){_0x35ba48[_0xbeba('0x43')]=[{'all':!![]}];}return db[_0xbeba('0x2d')][_0xbeba('0x44')](_0x35ba48);})['then'](function(_0x1edb27){_0x2c666b[_0xbeba('0x45')]=_0x1edb27;return _0x2c666b;})['then'](respondWithFilteredResult(_0x4d268d,_0x35ba48))[_0xbeba('0x46')](handleError(_0x4d268d,null));};exports[_0xbeba('0x47')]=function(_0x2ccd45,_0x40029d){var _0xfa8cd8={'raw':![],'where':{'id':_0x2ccd45['params']['id']}},_0x5c00a9={};_0x5c00a9[_0xbeba('0x32')]=_['keys'](db['FreshsalesAccount'][_0xbeba('0x2e')]);_0x5c00a9[_0xbeba('0x34')]=_[_0xbeba('0x33')](_0x2ccd45[_0xbeba('0x34')]);_0x5c00a9[_0xbeba('0x35')]=_[_0xbeba('0x36')](_0x5c00a9['model'],_0x5c00a9[_0xbeba('0x34')]);_0xfa8cd8[_0xbeba('0x38')]=_[_0xbeba('0x36')](_0x5c00a9[_0xbeba('0x32')],qs[_0xbeba('0x37')](_0x2ccd45[_0xbeba('0x34')][_0xbeba('0x37')]));_0xfa8cd8[_0xbeba('0x38')]=_0xfa8cd8[_0xbeba('0x38')]['length']?_0xfa8cd8[_0xbeba('0x38')]:_0x5c00a9[_0xbeba('0x32')];if(_0x2ccd45['query'][_0xbeba('0x42')]){_0xfa8cd8['include']=[{'all':!![]}];}_0xfa8cd8=_[_0xbeba('0x41')]({},_0xfa8cd8,_0x2ccd45[_0xbeba('0x48')]);return db[_0xbeba('0x2d')][_0xbeba('0x49')](_0xfa8cd8)[_0xbeba('0x27')](handleEntityNotFound(_0x40029d,null))[_0xbeba('0x27')](respondWithResult(_0x40029d,null))['catch'](handleError(_0x40029d,null));};exports[_0xbeba('0x4a')]=function(_0x28f9bd,_0x72d9f5){return db[_0xbeba('0x2d')]['create'](_0x28f9bd[_0xbeba('0x4b')],{})[_0xbeba('0x27')](respondWithResult(_0x72d9f5,0xc9))[_0xbeba('0x46')](handleError(_0x72d9f5,null));};exports[_0xbeba('0x26')]=function(_0x41ed46,_0x3fe69b){if(_0x41ed46[_0xbeba('0x4b')]['id']){delete _0x41ed46[_0xbeba('0x4b')]['id'];}return db[_0xbeba('0x2d')][_0xbeba('0x49')]({'where':{'id':_0x41ed46[_0xbeba('0x4c')]['id']}})[_0xbeba('0x27')](handleEntityNotFound(_0x3fe69b,null))[_0xbeba('0x27')](saveUpdates(_0x41ed46['body'],null))[_0xbeba('0x27')](respondWithResult(_0x3fe69b,null))[_0xbeba('0x46')](handleError(_0x3fe69b,null));};exports[_0xbeba('0x4d')]=function(_0x51f6be,_0x309ced){return db[_0xbeba('0x2d')][_0xbeba('0x49')]({'where':{'id':_0x51f6be['params']['id']}})[_0xbeba('0x27')](handleEntityNotFound(_0x309ced,null))[_0xbeba('0x27')](removeEntity(_0x309ced,null))['catch'](handleError(_0x309ced,null));};exports[_0xbeba('0x4e')]=function(_0x28347d,_0x3c13a2,_0xebe53a){var _0x9dea41={};var _0x1ba457={};var _0x1a39cb;var _0x1cffbf;return db[_0xbeba('0x2d')][_0xbeba('0x4f')]({'where':{'id':_0x28347d[_0xbeba('0x4c')]['id']}})[_0xbeba('0x27')](handleEntityNotFound(_0x3c13a2,null))[_0xbeba('0x27')](function(_0x300488){if(_0x300488){_0x1a39cb=_0x300488;_0x1ba457[_0xbeba('0x32')]=_[_0xbeba('0x33')](db[_0xbeba('0x50')]['rawAttributes']);_0x1ba457[_0xbeba('0x34')]=_[_0xbeba('0x33')](_0x28347d[_0xbeba('0x34')]);_0x1ba457[_0xbeba('0x35')]=_[_0xbeba('0x36')](_0x1ba457[_0xbeba('0x32')],_0x1ba457[_0xbeba('0x34')]);_0x9dea41['attributes']=_[_0xbeba('0x36')](_0x1ba457['model'],qs[_0xbeba('0x37')](_0x28347d[_0xbeba('0x34')]['fields']));_0x9dea41['attributes']=_0x9dea41[_0xbeba('0x38')][_0xbeba('0x39')]?_0x9dea41[_0xbeba('0x38')]:_0x1ba457[_0xbeba('0x32')];_0x9dea41[_0xbeba('0x3b')]=qs[_0xbeba('0x3c')](_0x28347d[_0xbeba('0x34')][_0xbeba('0x3c')]);_0x9dea41[_0xbeba('0x3d')]=qs[_0xbeba('0x35')](_[_0xbeba('0x51')](_0x28347d[_0xbeba('0x34')],_0x1ba457['filters']));if(_0x28347d['query']['filter']){_0x9dea41[_0xbeba('0x3d')]=_['merge'](_0x9dea41[_0xbeba('0x3d')],{'$or':_[_0xbeba('0x3e')](_0x9dea41['attributes'],function(_0x1046d9){var _0x229cca={};_0x229cca[_0x1046d9]={'$like':'%'+_0x28347d[_0xbeba('0x34')][_0xbeba('0x40')]+'%'};return _0x229cca;})});}_0x9dea41=_[_0xbeba('0x41')]({},_0x9dea41,_0x28347d['options']);return _0x1a39cb['getConfigurations'](_0x9dea41);}})['then'](function(_0x11f294){if(_0x11f294){_0x1cffbf=_0x11f294[_0xbeba('0x39')];if(!_0x28347d[_0xbeba('0x34')][_0xbeba('0x52')](_0xbeba('0x3a'))){_0x9dea41[_0xbeba('0x20')]=qs[_0xbeba('0x20')](_0x28347d[_0xbeba('0x34')][_0xbeba('0x20')]);_0x9dea41[_0xbeba('0x22')]=qs[_0xbeba('0x22')](_0x28347d[_0xbeba('0x34')][_0xbeba('0x22')]);}return _0x1a39cb['getConfigurations'](_0x9dea41);}})['then'](function(_0x52ce0b){if(_0x52ce0b){return _0x52ce0b?{'count':_0x1cffbf,'rows':_0x52ce0b}:null;}})[_0xbeba('0x27')](respondWithResult(_0x3c13a2,null))[_0xbeba('0x46')](handleError(_0x3c13a2,null));};exports[_0xbeba('0x53')]=function(_0x58e21a,_0x130156,_0x5d0352){if(_0x58e21a[_0xbeba('0x4b')]['id']){delete _0x58e21a[_0xbeba('0x4b')]['id'];}return db[_0xbeba('0x2d')]['findOne']({'where':{'id':_0x58e21a['params']['id']}})['then'](handleEntityNotFound(_0x130156,null))[_0xbeba('0x27')](function(_0x12506a){if(_0x12506a){_0x58e21a[_0xbeba('0x4b')][_0xbeba('0x54')]=_0x12506a['id'];_0x58e21a['body']['Subjects']=integrations[_0xbeba('0x55')](_0x58e21a[_0xbeba('0x4b')][_0xbeba('0x56')],_0x58e21a[_0xbeba('0x4b')][_0xbeba('0x30')]);_0x58e21a[_0xbeba('0x4b')][_0xbeba('0x57')]=integrations[_0xbeba('0x58')](_0x58e21a[_0xbeba('0x4b')]['channel'],_0x58e21a[_0xbeba('0x4b')][_0xbeba('0x30')]);return db[_0xbeba('0x50')]['create'](_0x58e21a[_0xbeba('0x4b')],{'include':[{'model':db[_0xbeba('0x59')],'as':_0xbeba('0x5a')},{'model':db['FreshsalesField'],'as':_0xbeba('0x57')}]});}return null;})[_0xbeba('0x27')](respondWithResult(_0x130156,null))[_0xbeba('0x46')](handleError(_0x130156,null));};exports[_0xbeba('0x5b')]=function(_0x194584,_0x55e7c4,_0x4ff1fe){var _0x17f81f='';var _0x52cf6d='';return db[_0xbeba('0x2d')][_0xbeba('0x4f')]({'where':{'id':_0x194584[_0xbeba('0x4c')]['id']},'attributes':['id',_0xbeba('0x5c'),_0xbeba('0x5d'),_0xbeba('0x5e')]})[_0xbeba('0x27')](handleEntityNotFound(_0x55e7c4,null))['then'](function(_0x3109d7){if(_0x3109d7){_0x52cf6d=_0x3109d7[_0xbeba('0x5c')];_0x17f81f=_0x3109d7[_0xbeba('0x5d')];var _0x55270d=_0x3109d7[_0xbeba('0x5d')][_0xbeba('0x5f')](-0x1);if(_0x55270d==='/'){_0x17f81f=_0x17f81f[_0xbeba('0x60')](0x0,_0x17f81f[_0xbeba('0x61')](_0x55270d));}return rp({'method':'GET','uri':util[_0xbeba('0x62')](_0xbeba('0x63'),_0x17f81f,'/api/selector/owners'),'headers':{'Authorization':_0xbeba('0x64')+_0x3109d7[_0xbeba('0x5e')]},'json':!![]});}})[_0xbeba('0x27')](function(_0x51b95f){if(_0x51b95f){var _0xe664da=_0x51b95f['users'];var _0x373446=![];var _0x3e4a0f=null;for(_0x3e4a0f=0x0;_0x3e4a0f<_0xe664da['length'];_0x3e4a0f++){if(_0xe664da[_0x3e4a0f][_0xbeba('0x65')]===_0x52cf6d){_0x373446=!![];}}if(_0x373446){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xbeba('0x66')});}}})[_0xbeba('0x27')](respondWithResult(_0x55e7c4,null))['catch'](function(_0x4c2a44){var _0x584670=_0x194584[_0xbeba('0x34')][_0xbeba('0x67')]?0x1f4:_0x4c2a44[_0xbeba('0x68')]||0x1f4;logger[_0xbeba('0x28')](_0xbeba('0x69'),_0xbeba('0x5b'),_0x584670,JSON[_0xbeba('0x6a')](_0x4c2a44));delete _0x4c2a44[_0xbeba('0x2a')];if(_0x584670===0x191){_0x584670=0x190;}_0x55e7c4[_0xbeba('0x1c')](_0x584670)[_0xbeba('0x2b')](_0x194584[_0xbeba('0x34')][_0xbeba('0x67')]?{'message':_0xbeba('0x6b'),'statusCode':_0x4c2a44[_0xbeba('0x68')]}:_0x4c2a44);});}; \ No newline at end of file +var _0xb348=['nolimit','limit','order','sort','where','pick','filter','merge','count','includeAll','include','rows','catch','show','params','length','create','body','find','findOne','FreshsalesConfiguration','options','getConfigurations','getSubjects','channel','getDescriptions','FreshsalesField','Subjects','remoteUri','apiKey','slice','substring','lastIndexOf','format','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','undefined','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x3ac601,_0x56123b){var _0x343f0e=function(_0x581986){while(--_0x581986){_0x3ac601['push'](_0x3ac601['shift']());}};_0x343f0e(++_0x56123b);}(_0xb348,0x8f));var _0x8b34=function(_0x412049,_0x36c723){_0x412049=_0x412049-0x0;var _0xd06495=_0xb348[_0x412049];return _0xd06495;};'use strict';var emlformat=require(_0x8b34('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b34('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b34('0x2'));var moment=require(_0x8b34('0x3'));var BPromise=require(_0x8b34('0x4'));var Mustache=require('mustache');var util=require(_0x8b34('0x5'));var path=require(_0x8b34('0x6'));var sox=require(_0x8b34('0x7'));var csv=require(_0x8b34('0x8'));var ejs=require(_0x8b34('0x9'));var fs=require('fs');var fs_extra=require(_0x8b34('0xa'));var _=require('lodash');var squel=require(_0x8b34('0xb'));var crypto=require(_0x8b34('0xc'));var jsforce=require(_0x8b34('0xd'));var deskjs=require(_0x8b34('0xe'));var toCsv=require(_0x8b34('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b34('0xf'));var authService=require(_0x8b34('0x10'));var qs=require(_0x8b34('0x11'));var as=require(_0x8b34('0x12'));var hardwareService=require(_0x8b34('0x13'));var logger=require(_0x8b34('0x14'))('api');var utils=require(_0x8b34('0x15'));var config=require(_0x8b34('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x51d3cc,_0x4a5461){_0x4a5461=_0x4a5461||0xcc;return function(_0x393d12){if(_0x393d12){return _0x51d3cc[_0x8b34('0x17')](_0x4a5461);}return _0x51d3cc['status'](_0x4a5461)['end']();};}function respondWithResult(_0x1ee1e9,_0x3fec86){_0x3fec86=_0x3fec86||0xc8;return function(_0x51d848){if(_0x51d848){return _0x1ee1e9[_0x8b34('0x18')](_0x3fec86)[_0x8b34('0x19')](_0x51d848);}};}function respondWithFilteredResult(_0x5aa930,_0xe97685){return function(_0x28687a){if(_0x28687a){var _0x44b66b=typeof _0xe97685['offset']===_0x8b34('0x1a')&&typeof _0xe97685['limit']===_0x8b34('0x1a');var _0xd02899=_0x28687a['count'];var _0x26dafc=_0x44b66b?0x0:_0xe97685[_0x8b34('0x1b')];var _0x4188e4=_0x44b66b?_0x28687a['count']:_0xe97685[_0x8b34('0x1b')]+_0xe97685['limit'];var _0x59c78b;if(_0x4188e4>=_0xd02899){_0x4188e4=_0xd02899;_0x59c78b=0xc8;}else{_0x59c78b=0xce;}_0x5aa930[_0x8b34('0x18')](_0x59c78b);return _0x5aa930[_0x8b34('0x1c')](_0x8b34('0x1d'),_0x26dafc+'-'+_0x4188e4+'/'+_0xd02899)[_0x8b34('0x19')](_0x28687a);}return null;};}function patchUpdates(_0x19aace){return function(_0x3693ee){try{jsonpatch[_0x8b34('0x1e')](_0x3693ee,_0x19aace,!![]);}catch(_0x3c0ebb){return BPromise[_0x8b34('0x1f')](_0x3c0ebb);}return _0x3693ee[_0x8b34('0x20')]();};}function saveUpdates(_0x46ad5e,_0x11be48){return function(_0x39fc25){if(_0x39fc25){return _0x39fc25[_0x8b34('0x21')](_0x46ad5e)['then'](function(_0x393baf){return _0x393baf;});}return null;};}function removeEntity(_0x212b51,_0x58c2c8){return function(_0x16b89f){if(_0x16b89f){return _0x16b89f[_0x8b34('0x22')]()[_0x8b34('0x23')](function(){_0x212b51[_0x8b34('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33840f,_0x4e8520){return function(_0x4945ee){if(!_0x4945ee){_0x33840f[_0x8b34('0x17')](0x194);}return _0x4945ee;};}function handleError(_0x5d8a39,_0xfd038){_0xfd038=_0xfd038||0x1f4;return function(_0x511c67){logger[_0x8b34('0x24')](_0x511c67[_0x8b34('0x25')]);if(_0x511c67[_0x8b34('0x26')]){delete _0x511c67[_0x8b34('0x26')];}_0x5d8a39[_0x8b34('0x18')](_0xfd038)[_0x8b34('0x27')](_0x511c67);};}exports[_0x8b34('0x28')]=function(_0x21f96d,_0x447e26){var _0x27d010={},_0xd38dd2={},_0x3d4711={'count':0x0,'rows':[]};var _0x1379b7=_['map'](db[_0x8b34('0x29')][_0x8b34('0x2a')],function(_0x5e8fde){return{'name':_0x5e8fde[_0x8b34('0x2b')],'type':_0x5e8fde[_0x8b34('0x2c')][_0x8b34('0x2d')]};});_0xd38dd2[_0x8b34('0x2e')]=_[_0x8b34('0x2f')](_0x1379b7,_0x8b34('0x26'));_0xd38dd2[_0x8b34('0x30')]=_[_0x8b34('0x31')](_0x21f96d['query']);_0xd38dd2[_0x8b34('0x32')]=_['intersection'](_0xd38dd2[_0x8b34('0x2e')],_0xd38dd2[_0x8b34('0x30')]);_0x27d010['attributes']=_[_0x8b34('0x33')](_0xd38dd2[_0x8b34('0x2e')],qs[_0x8b34('0x34')](_0x21f96d[_0x8b34('0x30')][_0x8b34('0x34')]));_0x27d010[_0x8b34('0x35')]=_0x27d010[_0x8b34('0x35')]['length']?_0x27d010[_0x8b34('0x35')]:_0xd38dd2[_0x8b34('0x2e')];if(!_0x21f96d[_0x8b34('0x30')][_0x8b34('0x36')](_0x8b34('0x37'))){_0x27d010[_0x8b34('0x38')]=qs[_0x8b34('0x38')](_0x21f96d['query'][_0x8b34('0x38')]);_0x27d010[_0x8b34('0x1b')]=qs[_0x8b34('0x1b')](_0x21f96d['query'][_0x8b34('0x1b')]);}_0x27d010[_0x8b34('0x39')]=qs['sort'](_0x21f96d['query'][_0x8b34('0x3a')]);_0x27d010[_0x8b34('0x3b')]=qs[_0x8b34('0x32')](_[_0x8b34('0x3c')](_0x21f96d[_0x8b34('0x30')],_0xd38dd2[_0x8b34('0x32')]),_0x1379b7);if(_0x21f96d[_0x8b34('0x30')][_0x8b34('0x3d')]){_0x27d010['where']=_['merge'](_0x27d010[_0x8b34('0x3b')],{'$or':_['map'](_0x1379b7,function(_0x897f71){if(_0x897f71['type']!=='VIRTUAL'){var _0x385710={};_0x385710[_0x897f71['name']]={'$like':'%'+_0x21f96d[_0x8b34('0x30')][_0x8b34('0x3d')]+'%'};return _0x385710;}})});}_0x27d010=_[_0x8b34('0x3e')]({},_0x27d010,_0x21f96d['options']);var _0x38a332={'where':_0x27d010[_0x8b34('0x3b')]};return db[_0x8b34('0x29')][_0x8b34('0x3f')](_0x38a332)[_0x8b34('0x23')](function(_0x5a4f12){_0x3d4711[_0x8b34('0x3f')]=_0x5a4f12;if(_0x21f96d[_0x8b34('0x30')][_0x8b34('0x40')]){_0x27d010[_0x8b34('0x41')]=[{'all':!![]}];}return db[_0x8b34('0x29')]['findAll'](_0x27d010);})[_0x8b34('0x23')](function(_0x394560){_0x3d4711[_0x8b34('0x42')]=_0x394560;return _0x3d4711;})['then'](respondWithFilteredResult(_0x447e26,_0x27d010))[_0x8b34('0x43')](handleError(_0x447e26,null));};exports[_0x8b34('0x44')]=function(_0x4247b8,_0x4b622f){var _0x1f1c5d={'raw':![],'where':{'id':_0x4247b8[_0x8b34('0x45')]['id']}},_0x2ccba2={};_0x2ccba2[_0x8b34('0x2e')]=_[_0x8b34('0x31')](db[_0x8b34('0x29')]['rawAttributes']);_0x2ccba2[_0x8b34('0x30')]=_[_0x8b34('0x31')](_0x4247b8['query']);_0x2ccba2[_0x8b34('0x32')]=_[_0x8b34('0x33')](_0x2ccba2[_0x8b34('0x2e')],_0x2ccba2[_0x8b34('0x30')]);_0x1f1c5d[_0x8b34('0x35')]=_[_0x8b34('0x33')](_0x2ccba2[_0x8b34('0x2e')],qs['fields'](_0x4247b8[_0x8b34('0x30')]['fields']));_0x1f1c5d[_0x8b34('0x35')]=_0x1f1c5d[_0x8b34('0x35')][_0x8b34('0x46')]?_0x1f1c5d['attributes']:_0x2ccba2[_0x8b34('0x2e')];if(_0x4247b8[_0x8b34('0x30')][_0x8b34('0x40')]){_0x1f1c5d[_0x8b34('0x41')]=[{'all':!![]}];}_0x1f1c5d=_[_0x8b34('0x3e')]({},_0x1f1c5d,_0x4247b8['options']);return db[_0x8b34('0x29')]['find'](_0x1f1c5d)['then'](handleEntityNotFound(_0x4b622f,null))['then'](respondWithResult(_0x4b622f,null))[_0x8b34('0x43')](handleError(_0x4b622f,null));};exports[_0x8b34('0x47')]=function(_0x5d194e,_0x23cfba){return db['FreshsalesAccount'][_0x8b34('0x47')](_0x5d194e[_0x8b34('0x48')],{})['then'](respondWithResult(_0x23cfba,0xc9))['catch'](handleError(_0x23cfba,null));};exports[_0x8b34('0x21')]=function(_0x11ab7d,_0xc800ea){if(_0x11ab7d['body']['id']){delete _0x11ab7d['body']['id'];}return db[_0x8b34('0x29')][_0x8b34('0x49')]({'where':{'id':_0x11ab7d[_0x8b34('0x45')]['id']}})['then'](handleEntityNotFound(_0xc800ea,null))[_0x8b34('0x23')](saveUpdates(_0x11ab7d['body'],null))[_0x8b34('0x23')](respondWithResult(_0xc800ea,null))['catch'](handleError(_0xc800ea,null));};exports['destroy']=function(_0x5f1fce,_0x11cf0c){return db[_0x8b34('0x29')][_0x8b34('0x49')]({'where':{'id':_0x5f1fce[_0x8b34('0x45')]['id']}})[_0x8b34('0x23')](handleEntityNotFound(_0x11cf0c,null))[_0x8b34('0x23')](removeEntity(_0x11cf0c,null))[_0x8b34('0x43')](handleError(_0x11cf0c,null));};exports['getConfigurations']=function(_0x232cd5,_0x4e2478,_0x551a6c){var _0x233204={};var _0x1320ec={};var _0x5966b3;var _0x5b83c1;return db[_0x8b34('0x29')][_0x8b34('0x4a')]({'where':{'id':_0x232cd5[_0x8b34('0x45')]['id']}})[_0x8b34('0x23')](handleEntityNotFound(_0x4e2478,null))['then'](function(_0xe1deb){if(_0xe1deb){_0x5966b3=_0xe1deb;_0x1320ec['model']=_['keys'](db[_0x8b34('0x4b')]['rawAttributes']);_0x1320ec['query']=_[_0x8b34('0x31')](_0x232cd5[_0x8b34('0x30')]);_0x1320ec[_0x8b34('0x32')]=_['intersection'](_0x1320ec[_0x8b34('0x2e')],_0x1320ec[_0x8b34('0x30')]);_0x233204[_0x8b34('0x35')]=_['intersection'](_0x1320ec[_0x8b34('0x2e')],qs[_0x8b34('0x34')](_0x232cd5[_0x8b34('0x30')][_0x8b34('0x34')]));_0x233204[_0x8b34('0x35')]=_0x233204[_0x8b34('0x35')][_0x8b34('0x46')]?_0x233204[_0x8b34('0x35')]:_0x1320ec[_0x8b34('0x2e')];_0x233204[_0x8b34('0x39')]=qs['sort'](_0x232cd5['query'][_0x8b34('0x3a')]);_0x233204['where']=qs['filters'](_[_0x8b34('0x3c')](_0x232cd5['query'],_0x1320ec['filters']));if(_0x232cd5[_0x8b34('0x30')][_0x8b34('0x3d')]){_0x233204[_0x8b34('0x3b')]=_[_0x8b34('0x3e')](_0x233204['where'],{'$or':_[_0x8b34('0x2f')](_0x233204[_0x8b34('0x35')],function(_0x1f8374){var _0x56f97a={};_0x56f97a[_0x1f8374]={'$like':'%'+_0x232cd5['query'][_0x8b34('0x3d')]+'%'};return _0x56f97a;})});}_0x233204=_[_0x8b34('0x3e')]({},_0x233204,_0x232cd5[_0x8b34('0x4c')]);return _0x5966b3['getConfigurations'](_0x233204);}})[_0x8b34('0x23')](function(_0xbd3299){if(_0xbd3299){_0x5b83c1=_0xbd3299[_0x8b34('0x46')];if(!_0x232cd5[_0x8b34('0x30')][_0x8b34('0x36')](_0x8b34('0x37'))){_0x233204['limit']=qs[_0x8b34('0x38')](_0x232cd5[_0x8b34('0x30')][_0x8b34('0x38')]);_0x233204['offset']=qs['offset'](_0x232cd5[_0x8b34('0x30')]['offset']);}return _0x5966b3[_0x8b34('0x4d')](_0x233204);}})[_0x8b34('0x23')](function(_0x2a4638){if(_0x2a4638){return _0x2a4638?{'count':_0x5b83c1,'rows':_0x2a4638}:null;}})['then'](respondWithResult(_0x4e2478,null))['catch'](handleError(_0x4e2478,null));};exports['addConfiguration']=function(_0x381417,_0x1070cc,_0x3c789a){if(_0x381417['body']['id']){delete _0x381417[_0x8b34('0x48')]['id'];}return db[_0x8b34('0x29')][_0x8b34('0x4a')]({'where':{'id':_0x381417[_0x8b34('0x45')]['id']}})[_0x8b34('0x23')](handleEntityNotFound(_0x1070cc,null))[_0x8b34('0x23')](function(_0x219fca){if(_0x219fca){_0x381417['body']['AccountId']=_0x219fca['id'];_0x381417[_0x8b34('0x48')]['Subjects']=integrations[_0x8b34('0x4e')](_0x381417[_0x8b34('0x48')][_0x8b34('0x4f')],_0x381417[_0x8b34('0x48')]['type']);_0x381417['body']['Descriptions']=integrations[_0x8b34('0x50')](_0x381417[_0x8b34('0x48')]['channel'],_0x381417[_0x8b34('0x48')]['type']);return db[_0x8b34('0x4b')][_0x8b34('0x47')](_0x381417[_0x8b34('0x48')],{'include':[{'model':db[_0x8b34('0x51')],'as':_0x8b34('0x52')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1070cc,null))[_0x8b34('0x43')](handleError(_0x1070cc,null));};exports['getFields']=function(_0x1c098f,_0x5a6f5b,_0x1b1de2){var _0x15e1bc='';var _0x21f1a2='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x1c098f['params']['id']},'attributes':['id','username',_0x8b34('0x53'),_0x8b34('0x54')]})[_0x8b34('0x23')](handleEntityNotFound(_0x5a6f5b,null))[_0x8b34('0x23')](function(_0x373427){if(_0x373427){_0x21f1a2=_0x373427['username'];_0x15e1bc=_0x373427[_0x8b34('0x53')];var _0x18ddd9=_0x373427[_0x8b34('0x53')][_0x8b34('0x55')](-0x1);if(_0x18ddd9==='/'){_0x15e1bc=_0x15e1bc[_0x8b34('0x56')](0x0,_0x15e1bc[_0x8b34('0x57')](_0x18ddd9));}return rp({'method':'GET','uri':util[_0x8b34('0x58')]('%s%s',_0x15e1bc,_0x8b34('0x59')),'headers':{'Authorization':_0x8b34('0x5a')+_0x373427[_0x8b34('0x54')]},'json':!![]});}})[_0x8b34('0x23')](function(_0x3f621c){if(_0x3f621c){var _0x35bfd0=_0x3f621c[_0x8b34('0x5b')];var _0x57fb3d=![];var _0x5716a4=null;for(_0x5716a4=0x0;_0x5716a4<_0x35bfd0['length'];_0x5716a4++){if(_0x35bfd0[_0x5716a4]['email']===_0x21f1a2){_0x57fb3d=!![];}}if(_0x57fb3d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8b34('0x5c')});}}})[_0x8b34('0x23')](respondWithResult(_0x5a6f5b,null))[_0x8b34('0x43')](function(_0x3137ab){var _0x10eee1=_0x1c098f['query'][_0x8b34('0x5d')]?0x1f4:_0x3137ab[_0x8b34('0x5e')]||0x1f4;logger[_0x8b34('0x24')](_0x8b34('0x5f'),_0x8b34('0x60'),_0x10eee1,JSON[_0x8b34('0x61')](_0x3137ab));delete _0x3137ab[_0x8b34('0x26')];if(_0x10eee1===0x191){_0x10eee1=0x190;}_0x5a6f5b[_0x8b34('0x18')](_0x10eee1)[_0x8b34('0x27')](_0x1c098f['query'][_0x8b34('0x5d')]?{'message':_0x8b34('0x62'),'statusCode':_0x3137ab[_0x8b34('0x5e')]}:_0x3137ab);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 36dfb89..c81fe28 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 _0x9a5a=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util'];(function(_0x10ef69,_0x440695){var _0x26c2b7=function(_0x2e8b58){while(--_0x2e8b58){_0x10ef69['push'](_0x10ef69['shift']());}};_0x26c2b7(++_0x440695);}(_0x9a5a,0x194));var _0xa9a5=function(_0x238411,_0x124a6d){_0x238411=_0x238411-0x0;var _0x39b23d=_0x9a5a[_0x238411];return _0x39b23d;};'use strict';var _=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var logger=require(_0xa9a5('0x2'))(_0xa9a5('0x3'));var moment=require(_0xa9a5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9a5('0x5'));var fs=require('fs');var path=require(_0xa9a5('0x6'));var rimraf=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var attributes=require(_0xa9a5('0x9'));var integrations=require(_0xa9a5('0xa'));module['exports']=function(_0xb0ccd9,_0x37e93b){return _0xb0ccd9[_0xa9a5('0xb')](_0xa9a5('0xc'),attributes,{'tableName':_0xa9a5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9536=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x17cfae,_0x1b540a){var _0x10ecec=function(_0xcf2c5f){while(--_0xcf2c5f){_0x17cfae['push'](_0x17cfae['shift']());}};_0x10ecec(++_0x1b540a);}(_0x9536,0x179));var _0x6953=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x9536[_0x368e09];return _0x14b7df;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));var integrations=require(_0x6953('0x9'));module['exports']=function(_0x2b273e,_0x2bb026){return _0x2b273e[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('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 d580f42..0e2a1a9 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 _0xd943=['limit','include','map','model','attributes','debug','ShowFreshsalesAccount','find','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where'];(function(_0x209302,_0x5826ac){var _0x1df8e9=function(_0x16ae49){while(--_0x16ae49){_0x209302['push'](_0x209302['shift']());}};_0x1df8e9(++_0x5826ac);}(_0xd943,0x15d));var _0x3d94=function(_0x325ed0,_0xe8ccd7){_0x325ed0=_0x325ed0-0x0;var _0x1b7412=_0xd943[_0x325ed0];return _0x1b7412;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['findAll']({'raw':_0x2acee3[_0x3d94('0x16')]?_0x2acee3['options'][_0x3d94('0x17')]===undefined?!![]:![]:!![],'where':_0x2acee3[_0x3d94('0x16')]?_0x2acee3[_0x3d94('0x16')][_0x3d94('0x18')]||null:null,'attributes':_0x2acee3[_0x3d94('0x16')]?_0x2acee3['options']['attributes']||null:null,'limit':_0x2acee3[_0x3d94('0x16')]?_0x2acee3[_0x3d94('0x16')][_0x3d94('0x19')]||null:null,'include':_0x2acee3['options']?_0x2acee3[_0x3d94('0x16')][_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x2acee3[_0x3d94('0x16')][_0x3d94('0x1a')],function(_0x4093a4){return{'model':db[_0x4093a4[_0x3d94('0x1c')]],'as':_0x4093a4['as'],'attributes':_0x4093a4[_0x3d94('0x1d')],'include':_0x4093a4[_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x4093a4[_0x3d94('0x1a')],function(_0x192839){return{'model':db[_0x192839[_0x3d94('0x1c')]],'as':_0x192839['as'],'attributes':_0x192839[_0x3d94('0x1d')],'include':_0x192839[_0x3d94('0x1a')]?_['map'](_0x192839[_0x3d94('0x1a')],function(_0x558fd2){return{'model':db[_0x558fd2[_0x3d94('0x1c')]],'as':_0x558fd2['as'],'attributes':_0x558fd2[_0x3d94('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3d94('0xa')](function(_0x439173){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1e')]('GetFreshsalesAccount',_0x2acee3,JSON['stringify'](_0x439173));_0x4afc92(_0x439173);})[_0x3d94('0x13')](function(_0x4813e1){logger['error'](_0x3d94('0x14'),_0x4813e1['message'],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0x4813e1[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1f')]=function(_0x4cef9c){var _0x2a07b4=this;return new Promise(function(_0x4c1237,_0x3d4994){return db['FreshsalesAccount'][_0x3d94('0x20')]({'raw':_0x4cef9c[_0x3d94('0x16')]?_0x4cef9c[_0x3d94('0x16')][_0x3d94('0x17')]===undefined?!![]:![]:!![],'where':_0x4cef9c['options']?_0x4cef9c[_0x3d94('0x16')]['where']||null:null,'attributes':_0x4cef9c[_0x3d94('0x16')]?_0x4cef9c[_0x3d94('0x16')]['attributes']||null:null,'include':_0x4cef9c['options']?_0x4cef9c[_0x3d94('0x16')][_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x4cef9c['options'][_0x3d94('0x1a')],function(_0x3d29fd){return{'model':db[_0x3d29fd['model']],'as':_0x3d29fd['as'],'attributes':_0x3d29fd[_0x3d94('0x1d')],'include':_0x3d29fd[_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x3d29fd[_0x3d94('0x1a')],function(_0x782c1){return{'model':db[_0x782c1['model']],'as':_0x782c1['as'],'attributes':_0x782c1[_0x3d94('0x1d')],'include':_0x782c1[_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x782c1[_0x3d94('0x1a')],function(_0xb493f1){return{'model':db[_0xb493f1[_0x3d94('0x1c')]],'as':_0xb493f1['as'],'attributes':_0xb493f1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfe58eb){logger[_0x3d94('0xb')](_0x3d94('0x1f'),_0x4cef9c);logger[_0x3d94('0x1e')](_0x3d94('0x1f'),_0x4cef9c,JSON[_0x3d94('0x21')](_0xfe58eb));_0x4c1237(_0xfe58eb);})[_0x3d94('0x13')](function(_0x12c01a){logger[_0x3d94('0xe')](_0x3d94('0x1f'),_0x12c01a['message'],_0x4cef9c);_0x3d4994(_0x2a07b4[_0x3d94('0xe')](0x1f4,_0x12c01a[_0x3d94('0x11')]));});});}; \ No newline at end of file +var _0x4888=['FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowFreshsalesAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFreshsalesAccount'];(function(_0x1065f1,_0x38858b){var _0x364697=function(_0x5db4a6){while(--_0x5db4a6){_0x1065f1['push'](_0x1065f1['shift']());}};_0x364697(++_0x38858b);}(_0x4888,0x198));var _0x8488=function(_0x14a516,_0x5dee29){_0x14a516=_0x14a516-0x0;var _0x51a308=_0x4888[_0x14a516];return _0x51a308;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19e508,_0x5250a1,_0x5b30a7){return new BPromise(function(_0x56aad0,_0x568a82){return client[_0x8488('0xc')](_0x19e508,_0x5b30a7)[_0x8488('0xd')](function(_0x542bd8){logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));logger[_0x8488('0x11')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5250a1,_0x8488('0x10'),JSON[_0x8488('0x12')](_0x542bd8));if(_0x542bd8[_0x8488('0x13')]){if(_0x542bd8[_0x8488('0x13')][_0x8488('0x14')]===0x1f4){logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8[_0x8488('0x13')]['message']);return _0x568a82(_0x542bd8['error'][_0x8488('0x15')]);}logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8['error']['message']);return _0x56aad0(_0x542bd8[_0x8488('0x13')][_0x8488('0x15')]);}else{logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));_0x56aad0(_0x542bd8[_0x8488('0x16')][_0x8488('0x15')]);}})['catch'](function(_0x3dad45){logger[_0x8488('0x13')](_0x8488('0xf'),_0x5250a1,_0x3dad45);_0x568a82(_0x3dad45);});});}exports[_0x8488('0x17')]=function(_0x60ae2f){var _0x39775f=this;return new Promise(function(_0x1aedb1,_0x27c62a){return db[_0x8488('0x18')][_0x8488('0x19')]({'raw':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')][_0x8488('0x1b')]===undefined?!![]:![]:!![],'where':_0x60ae2f['options']?_0x60ae2f['options'][_0x8488('0x1c')]||null:null,'attributes':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')][_0x8488('0x1d')]||null:null,'limit':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')][_0x8488('0x1e')]||null:null,'include':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')]['include']?_[_0x8488('0x1f')](_0x60ae2f[_0x8488('0x1a')][_0x8488('0x20')],function(_0x1361a6){return{'model':db[_0x1361a6[_0x8488('0x21')]],'as':_0x1361a6['as'],'attributes':_0x1361a6['attributes'],'include':_0x1361a6['include']?_['map'](_0x1361a6['include'],function(_0x472624){return{'model':db[_0x472624['model']],'as':_0x472624['as'],'attributes':_0x472624['attributes'],'include':_0x472624[_0x8488('0x20')]?_[_0x8488('0x1f')](_0x472624[_0x8488('0x20')],function(_0x6ebee0){return{'model':db[_0x6ebee0[_0x8488('0x21')]],'as':_0x6ebee0['as'],'attributes':_0x6ebee0['attributes']};}):[]};}):[]};}):[]:[]})[_0x8488('0xd')](function(_0x38c137){logger[_0x8488('0xe')](_0x8488('0x17'),_0x60ae2f);logger[_0x8488('0x11')](_0x8488('0x17'),_0x60ae2f,JSON[_0x8488('0x12')](_0x38c137));_0x1aedb1(_0x38c137);})[_0x8488('0x22')](function(_0x368f9c){logger[_0x8488('0x13')](_0x8488('0x17'),_0x368f9c['message'],_0x60ae2f);_0x27c62a(_0x39775f['error'](0x1f4,_0x368f9c['message']));});});};exports[_0x8488('0x23')]=function(_0x408c36){var _0x19cf42=this;return new Promise(function(_0x121dcc,_0x117321){return db[_0x8488('0x18')]['find']({'raw':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')][_0x8488('0x1b')]===undefined?!![]:![]:!![],'where':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')]['where']||null:null,'attributes':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')]['attributes']||null:null,'include':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')][_0x8488('0x20')]?_[_0x8488('0x1f')](_0x408c36[_0x8488('0x1a')]['include'],function(_0x44c8f3){return{'model':db[_0x44c8f3[_0x8488('0x21')]],'as':_0x44c8f3['as'],'attributes':_0x44c8f3[_0x8488('0x1d')],'include':_0x44c8f3['include']?_[_0x8488('0x1f')](_0x44c8f3['include'],function(_0x205ccc){return{'model':db[_0x205ccc[_0x8488('0x21')]],'as':_0x205ccc['as'],'attributes':_0x205ccc[_0x8488('0x1d')],'include':_0x205ccc[_0x8488('0x20')]?_['map'](_0x205ccc[_0x8488('0x20')],function(_0xe71bd9){return{'model':db[_0xe71bd9[_0x8488('0x21')]],'as':_0xe71bd9['as'],'attributes':_0xe71bd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x8488('0xd')](function(_0x17bfea){logger[_0x8488('0xe')](_0x8488('0x23'),_0x408c36);logger[_0x8488('0x11')](_0x8488('0x23'),_0x408c36,JSON[_0x8488('0x12')](_0x17bfea));_0x121dcc(_0x17bfea);})[_0x8488('0x22')](function(_0x1a8235){logger[_0x8488('0x13')](_0x8488('0x23'),_0x1a8235['message'],_0x408c36);_0x117321(_0x19cf42['error'](0x1f4,_0x1a8235[_0x8488('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 37986f3..49cd07b 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 _0x3196=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','post','update','destroy','exports','util','path'];(function(_0x17a815,_0x23c98b){var _0x2726b8=function(_0x5e43e2){while(--_0x5e43e2){_0x17a815['push'](_0x17a815['shift']());}};_0x2726b8(++_0x23c98b);}(_0x3196,0x142));var _0x6319=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3196[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x6319('0x0'));var path=require(_0x6319('0x1'));var timeout=require(_0x6319('0x2'));var express=require(_0x6319('0x3'));var router=express['Router']();var fs_extra=require(_0x6319('0x4'));var auth=require(_0x6319('0x5'));var interaction=require(_0x6319('0x6'));var config=require('../../config/environment');var controller=require(_0x6319('0x7'));router[_0x6319('0x8')]('/',auth[_0x6319('0x9')](),controller[_0x6319('0xa')]);router[_0x6319('0x8')](_0x6319('0xb'),auth[_0x6319('0x9')](),controller['show']);router[_0x6319('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x6319('0x8')]('/:id/descriptions',auth[_0x6319('0x9')](),controller['getDescriptions']);router[_0x6319('0x8')](_0x6319('0xc'),auth[_0x6319('0x9')](),controller[_0x6319('0xd')]);router[_0x6319('0xe')]('/',auth[_0x6319('0x9')](),controller['create']);router['put'](_0x6319('0xb'),auth['isAuthenticated'](),controller[_0x6319('0xf')]);router['delete'](_0x6319('0xb'),auth[_0x6319('0x9')](),controller[_0x6319('0x10')]);module[_0x6319('0x11')]=router; \ No newline at end of file +var _0x541b=['Router','fs-extra','../../components/auth/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1008da,_0x1bdec0){var _0x4ed756=function(_0x4ac079){while(--_0x4ac079){_0x1008da['push'](_0x1008da['shift']());}};_0x4ed756(++_0x1bdec0);}(_0x541b,0x1a5));var _0xb541=function(_0x4c42ff,_0x3d3d75){_0x4c42ff=_0x4c42ff-0x0;var _0x27387f=_0x541b[_0x4c42ff];return _0x27387f;};'use strict';var multer=require(_0xb541('0x0'));var util=require(_0xb541('0x1'));var path=require(_0xb541('0x2'));var timeout=require(_0xb541('0x3'));var express=require('express');var router=express[_0xb541('0x4')]();var fs_extra=require(_0xb541('0x5'));var auth=require(_0xb541('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb541('0x7'));router[_0xb541('0x8')]('/',auth[_0xb541('0x9')](),controller[_0xb541('0xa')]);router[_0xb541('0x8')](_0xb541('0xb'),auth[_0xb541('0x9')](),controller[_0xb541('0xc')]);router['get'](_0xb541('0xd'),auth['isAuthenticated'](),controller[_0xb541('0xe')]);router[_0xb541('0x8')](_0xb541('0xf'),auth[_0xb541('0x9')](),controller[_0xb541('0x10')]);router[_0xb541('0x8')]('/:id/fields',auth[_0xb541('0x9')](),controller[_0xb541('0x11')]);router[_0xb541('0x12')]('/',auth[_0xb541('0x9')](),controller[_0xb541('0x13')]);router[_0xb541('0x14')](_0xb541('0xb'),auth[_0xb541('0x9')](),controller[_0xb541('0x15')]);router[_0xb541('0x16')](_0xb541('0xb'),auth['isAuthenticated'](),controller[_0xb541('0x17')]);module[_0xb541('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 9363141..d682c96 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 _0x8c49=['sequelize','exports','STRING'];(function(_0x11141d,_0x576077){var _0x28bdd4=function(_0x18ec5e){while(--_0x18ec5e){_0x11141d['push'](_0x11141d['shift']());}};_0x28bdd4(++_0x576077);}(_0x8c49,0x1e6));var _0x98c4=function(_0x4ac743,_0x3fa20d){_0x4ac743=_0x4ac743-0x0;var _0x3e60a3=_0x8c49[_0x4ac743];return _0x3e60a3;};'use strict';var Sequelize=require(_0x98c4('0x0'));module[_0x98c4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x98c4('0x2')]}}; \ No newline at end of file +var _0x6461=['STRING','sequelize','exports'];(function(_0x1ab71f,_0x48b68c){var _0x5748bd=function(_0x2056e3){while(--_0x2056e3){_0x1ab71f['push'](_0x1ab71f['shift']());}};_0x5748bd(++_0x48b68c);}(_0x6461,0x85));var _0x1646=function(_0x344bf3,_0x2c9bda){_0x344bf3=_0x344bf3-0x0;var _0x37bbdf=_0x6461[_0x344bf3];return _0x37bbdf;};'use strict';var Sequelize=require(_0x1646('0x0'));module[_0x1646('0x1')]={'name':{'type':Sequelize[_0x1646('0x2')]},'description':{'type':Sequelize[_0x1646('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 0a9c8f0..ff223b3 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 _0xcb1c=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','destroy','then','stack','name','send','index','map','FreshsalesConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','merge','options','find','create','body','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x16be35,_0x33eb7e){var _0x4ca389=function(_0x1bc759){while(--_0x1bc759){_0x16be35['push'](_0x16be35['shift']());}};_0x4ca389(++_0x33eb7e);}(_0xcb1c,0x17e));var _0xccb1=function(_0x346bcc,_0x68f64d){_0x346bcc=_0x346bcc-0x0;var _0x1fb90d=_0xcb1c[_0x346bcc];return _0x1fb90d;};'use strict';var emlformat=require(_0xccb1('0x0'));var rimraf=require(_0xccb1('0x1'));var zipdir=require(_0xccb1('0x2'));var jsonpatch=require(_0xccb1('0x3'));var rp=require(_0xccb1('0x4'));var moment=require(_0xccb1('0x5'));var BPromise=require(_0xccb1('0x6'));var Mustache=require(_0xccb1('0x7'));var util=require(_0xccb1('0x8'));var path=require('path');var sox=require(_0xccb1('0x9'));var csv=require('to-csv');var ejs=require(_0xccb1('0xa'));var fs=require('fs');var fs_extra=require(_0xccb1('0xb'));var _=require('lodash');var squel=require(_0xccb1('0xc'));var crypto=require(_0xccb1('0xd'));var jsforce=require(_0xccb1('0xe'));var deskjs=require(_0xccb1('0xf'));var toCsv=require(_0xccb1('0x10'));var querystring=require(_0xccb1('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xccb1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccb1('0x13'))(_0xccb1('0x14'));var utils=require(_0xccb1('0x15'));var config=require(_0xccb1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xccb1('0x17'))['db'];function respondWithStatusCode(_0x48a911,_0x29ebcd){_0x29ebcd=_0x29ebcd||0xcc;return function(_0x12bb31){if(_0x12bb31){return _0x48a911[_0xccb1('0x18')](_0x29ebcd);}return _0x48a911[_0xccb1('0x19')](_0x29ebcd)[_0xccb1('0x1a')]();};}function respondWithResult(_0x3924c5,_0x129f03){_0x129f03=_0x129f03||0xc8;return function(_0x30b8cc){if(_0x30b8cc){return _0x3924c5[_0xccb1('0x19')](_0x129f03)[_0xccb1('0x1b')](_0x30b8cc);}};}function respondWithFilteredResult(_0x2fc079,_0x4147c2){return function(_0x5ae4de){if(_0x5ae4de){var _0x274c28=typeof _0x4147c2[_0xccb1('0x1c')]===_0xccb1('0x1d')&&typeof _0x4147c2['limit']==='undefined';var _0x3ffc32=_0x5ae4de[_0xccb1('0x1e')];var _0x3e2f62=_0x274c28?0x0:_0x4147c2[_0xccb1('0x1c')];var _0x53c095=_0x274c28?_0x5ae4de[_0xccb1('0x1e')]:_0x4147c2[_0xccb1('0x1c')]+_0x4147c2[_0xccb1('0x1f')];var _0x3aac88;if(_0x53c095>=_0x3ffc32){_0x53c095=_0x3ffc32;_0x3aac88=0xc8;}else{_0x3aac88=0xce;}_0x2fc079[_0xccb1('0x19')](_0x3aac88);return _0x2fc079[_0xccb1('0x20')](_0xccb1('0x21'),_0x3e2f62+'-'+_0x53c095+'/'+_0x3ffc32)[_0xccb1('0x1b')](_0x5ae4de);}return null;};}function patchUpdates(_0x4c0a40){return function(_0x5d60b3){try{jsonpatch['apply'](_0x5d60b3,_0x4c0a40,!![]);}catch(_0x302ea9){return BPromise['reject'](_0x302ea9);}return _0x5d60b3[_0xccb1('0x22')]();};}function saveUpdates(_0x5537f4,_0x4d7d01){return function(_0x205fcf){if(_0x205fcf){return _0x205fcf[_0xccb1('0x23')](_0x5537f4)['then'](function(_0x4df03d){return _0x4df03d;});}return null;};}function removeEntity(_0x3ddc47,_0x1195d0){return function(_0x45b76b){if(_0x45b76b){return _0x45b76b[_0xccb1('0x24')]()[_0xccb1('0x25')](function(){_0x3ddc47[_0xccb1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fd878,_0x1b390f){return function(_0x1f7e4f){if(!_0x1f7e4f){_0x4fd878[_0xccb1('0x18')](0x194);}return _0x1f7e4f;};}function handleError(_0x37e5b0,_0x2803bb){_0x2803bb=_0x2803bb||0x1f4;return function(_0x4c6619){logger['error'](_0x4c6619[_0xccb1('0x26')]);if(_0x4c6619[_0xccb1('0x27')]){delete _0x4c6619['name'];}_0x37e5b0[_0xccb1('0x19')](_0x2803bb)[_0xccb1('0x28')](_0x4c6619);};}exports[_0xccb1('0x29')]=function(_0x34b4e2,_0x5c5e43){var _0x916220={},_0x5800c9={},_0x3d2463={'count':0x0,'rows':[]};var _0x844f8=_[_0xccb1('0x2a')](db[_0xccb1('0x2b')]['rawAttributes'],function(_0x1008ec){return{'name':_0x1008ec[_0xccb1('0x2c')],'type':_0x1008ec['type'][_0xccb1('0x2d')]};});_0x5800c9[_0xccb1('0x2e')]=_['map'](_0x844f8,_0xccb1('0x27'));_0x5800c9[_0xccb1('0x2f')]=_[_0xccb1('0x30')](_0x34b4e2[_0xccb1('0x2f')]);_0x5800c9[_0xccb1('0x31')]=_[_0xccb1('0x32')](_0x5800c9['model'],_0x5800c9[_0xccb1('0x2f')]);_0x916220[_0xccb1('0x33')]=_[_0xccb1('0x32')](_0x5800c9['model'],qs[_0xccb1('0x34')](_0x34b4e2[_0xccb1('0x2f')]['fields']));_0x916220['attributes']=_0x916220[_0xccb1('0x33')][_0xccb1('0x35')]?_0x916220[_0xccb1('0x33')]:_0x5800c9[_0xccb1('0x2e')];if(!_0x34b4e2[_0xccb1('0x2f')][_0xccb1('0x36')](_0xccb1('0x37'))){_0x916220['limit']=qs[_0xccb1('0x1f')](_0x34b4e2[_0xccb1('0x2f')][_0xccb1('0x1f')]);_0x916220[_0xccb1('0x1c')]=qs[_0xccb1('0x1c')](_0x34b4e2['query']['offset']);}_0x916220[_0xccb1('0x38')]=qs[_0xccb1('0x39')](_0x34b4e2[_0xccb1('0x2f')]['sort']);_0x916220[_0xccb1('0x3a')]=qs[_0xccb1('0x31')](_[_0xccb1('0x3b')](_0x34b4e2[_0xccb1('0x2f')],_0x5800c9[_0xccb1('0x31')]),_0x844f8);if(_0x34b4e2['query'][_0xccb1('0x3c')]){_0x916220['where']=_['merge'](_0x916220[_0xccb1('0x3a')],{'$or':_[_0xccb1('0x2a')](_0x844f8,function(_0x80600e){if(_0x80600e[_0xccb1('0x3d')]!==_0xccb1('0x3e')){var _0xf41a06={};_0xf41a06[_0x80600e[_0xccb1('0x27')]]={'$like':'%'+_0x34b4e2[_0xccb1('0x2f')][_0xccb1('0x3c')]+'%'};return _0xf41a06;}})});}_0x916220=_['merge']({},_0x916220,_0x34b4e2['options']);var _0x1b6103={'where':_0x916220[_0xccb1('0x3a')]};return db[_0xccb1('0x2b')]['count'](_0x1b6103)[_0xccb1('0x25')](function(_0x44ffff){_0x3d2463['count']=_0x44ffff;if(_0x34b4e2['query'][_0xccb1('0x3f')]){_0x916220[_0xccb1('0x40')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xccb1('0x41')](_0x916220);})[_0xccb1('0x25')](function(_0x49d2e5){_0x3d2463['rows']=_0x49d2e5;return _0x3d2463;})['then'](respondWithFilteredResult(_0x5c5e43,_0x916220))[_0xccb1('0x42')](handleError(_0x5c5e43,null));};exports[_0xccb1('0x43')]=function(_0x4a3e47,_0x3948ae){var _0x45e670={'raw':![],'where':{'id':_0x4a3e47[_0xccb1('0x44')]['id']}},_0x550075={};_0x550075[_0xccb1('0x2e')]=_['keys'](db[_0xccb1('0x2b')][_0xccb1('0x45')]);_0x550075[_0xccb1('0x2f')]=_[_0xccb1('0x30')](_0x4a3e47[_0xccb1('0x2f')]);_0x550075[_0xccb1('0x31')]=_['intersection'](_0x550075[_0xccb1('0x2e')],_0x550075[_0xccb1('0x2f')]);_0x45e670[_0xccb1('0x33')]=_['intersection'](_0x550075[_0xccb1('0x2e')],qs[_0xccb1('0x34')](_0x4a3e47[_0xccb1('0x2f')]['fields']));_0x45e670[_0xccb1('0x33')]=_0x45e670['attributes']['length']?_0x45e670[_0xccb1('0x33')]:_0x550075[_0xccb1('0x2e')];if(_0x4a3e47['query'][_0xccb1('0x3f')]){_0x45e670[_0xccb1('0x40')]=[{'all':!![]}];}_0x45e670=_[_0xccb1('0x46')]({},_0x45e670,_0x4a3e47[_0xccb1('0x47')]);return db[_0xccb1('0x2b')][_0xccb1('0x48')](_0x45e670)['then'](handleEntityNotFound(_0x3948ae,null))[_0xccb1('0x25')](respondWithResult(_0x3948ae,null))[_0xccb1('0x42')](handleError(_0x3948ae,null));};exports[_0xccb1('0x49')]=function(_0x10ceb5,_0x4d71d5){return db['FreshsalesConfiguration'][_0xccb1('0x49')](_0x10ceb5[_0xccb1('0x4a')],{})[_0xccb1('0x25')](respondWithResult(_0x4d71d5,0xc9))[_0xccb1('0x42')](handleError(_0x4d71d5,null));};exports['update']=function(_0x3e3c6f,_0xb93c08){if(_0x3e3c6f[_0xccb1('0x4a')]['id']){delete _0x3e3c6f[_0xccb1('0x4a')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x3e3c6f[_0xccb1('0x44')]['id']}})[_0xccb1('0x25')](handleEntityNotFound(_0xb93c08,null))[_0xccb1('0x25')](saveUpdates(_0x3e3c6f['body'],null))[_0xccb1('0x25')](respondWithResult(_0xb93c08,null))[_0xccb1('0x42')](handleError(_0xb93c08,null));};exports[_0xccb1('0x24')]=function(_0x471ebb,_0x3df257){return db['FreshsalesConfiguration'][_0xccb1('0x48')]({'where':{'id':_0x471ebb[_0xccb1('0x44')]['id']}})[_0xccb1('0x25')](handleEntityNotFound(_0x3df257,null))[_0xccb1('0x25')](removeEntity(_0x3df257,null))['catch'](handleError(_0x3df257,null));};exports[_0xccb1('0x4b')]=function(_0x4433ea,_0x4a8aeb,_0x5b1232){var _0x3cbb0b={};var _0x340f63={};var _0x5e5a65;var _0x3101a6;return db['FreshsalesConfiguration'][_0xccb1('0x4c')]({'where':{'id':_0x4433ea[_0xccb1('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a8aeb,null))['then'](function(_0x3d5b0e){if(_0x3d5b0e){_0x5e5a65=_0x3d5b0e;_0x340f63[_0xccb1('0x2e')]=_[_0xccb1('0x30')](db[_0xccb1('0x4d')][_0xccb1('0x45')]);_0x340f63['query']=_[_0xccb1('0x30')](_0x4433ea[_0xccb1('0x2f')]);_0x340f63['filters']=_['intersection'](_0x340f63[_0xccb1('0x2e')],_0x340f63['query']);_0x3cbb0b[_0xccb1('0x33')]=_[_0xccb1('0x32')](_0x340f63[_0xccb1('0x2e')],qs['fields'](_0x4433ea[_0xccb1('0x2f')][_0xccb1('0x34')]));_0x3cbb0b[_0xccb1('0x33')]=_0x3cbb0b[_0xccb1('0x33')][_0xccb1('0x35')]?_0x3cbb0b['attributes']:_0x340f63[_0xccb1('0x2e')];_0x3cbb0b['order']=qs[_0xccb1('0x39')](_0x4433ea[_0xccb1('0x2f')][_0xccb1('0x39')]);_0x3cbb0b['where']=qs[_0xccb1('0x31')](_[_0xccb1('0x3b')](_0x4433ea[_0xccb1('0x2f')],_0x340f63['filters']));if(_0x4433ea[_0xccb1('0x2f')][_0xccb1('0x3c')]){_0x3cbb0b['where']=_[_0xccb1('0x46')](_0x3cbb0b[_0xccb1('0x3a')],{'$or':_['map'](_0x3cbb0b['attributes'],function(_0x377015){var _0xfed722={};_0xfed722[_0x377015]={'$like':'%'+_0x4433ea[_0xccb1('0x2f')][_0xccb1('0x3c')]+'%'};return _0xfed722;})});}_0x3cbb0b=_['merge']({},_0x3cbb0b,_0x4433ea[_0xccb1('0x47')]);return _0x5e5a65['getSubjects'](_0x3cbb0b);}})[_0xccb1('0x25')](function(_0x4e9921){if(_0x4e9921){_0x3101a6=_0x4e9921[_0xccb1('0x35')];if(!_0x4433ea[_0xccb1('0x2f')][_0xccb1('0x36')](_0xccb1('0x37'))){_0x3cbb0b[_0xccb1('0x1f')]=qs[_0xccb1('0x1f')](_0x4433ea[_0xccb1('0x2f')][_0xccb1('0x1f')]);_0x3cbb0b[_0xccb1('0x1c')]=qs[_0xccb1('0x1c')](_0x4433ea[_0xccb1('0x2f')][_0xccb1('0x1c')]);}return _0x5e5a65['getSubjects'](_0x3cbb0b);}})[_0xccb1('0x25')](function(_0x48d599){if(_0x48d599){return _0x48d599?{'count':_0x3101a6,'rows':_0x48d599}:null;}})[_0xccb1('0x25')](respondWithResult(_0x4a8aeb,null))['catch'](handleError(_0x4a8aeb,null));};exports[_0xccb1('0x4e')]=function(_0x4d2a63,_0x274f39,_0x177f04){var _0x55e542={};var _0x45b3b2={};var _0x17e12e;var _0x5446f4;return db[_0xccb1('0x2b')][_0xccb1('0x4c')]({'where':{'id':_0x4d2a63[_0xccb1('0x44')]['id']}})[_0xccb1('0x25')](handleEntityNotFound(_0x274f39,null))['then'](function(_0x2131fa){if(_0x2131fa){_0x17e12e=_0x2131fa;_0x45b3b2[_0xccb1('0x2e')]=_['keys'](db[_0xccb1('0x4d')]['rawAttributes']);_0x45b3b2[_0xccb1('0x2f')]=_[_0xccb1('0x30')](_0x4d2a63[_0xccb1('0x2f')]);_0x45b3b2['filters']=_[_0xccb1('0x32')](_0x45b3b2[_0xccb1('0x2e')],_0x45b3b2[_0xccb1('0x2f')]);_0x55e542['attributes']=_[_0xccb1('0x32')](_0x45b3b2[_0xccb1('0x2e')],qs[_0xccb1('0x34')](_0x4d2a63[_0xccb1('0x2f')]['fields']));_0x55e542[_0xccb1('0x33')]=_0x55e542['attributes'][_0xccb1('0x35')]?_0x55e542['attributes']:_0x45b3b2[_0xccb1('0x2e')];_0x55e542[_0xccb1('0x38')]=qs[_0xccb1('0x39')](_0x4d2a63['query'][_0xccb1('0x39')]);_0x55e542[_0xccb1('0x3a')]=qs[_0xccb1('0x31')](_[_0xccb1('0x3b')](_0x4d2a63[_0xccb1('0x2f')],_0x45b3b2[_0xccb1('0x31')]));if(_0x4d2a63[_0xccb1('0x2f')][_0xccb1('0x3c')]){_0x55e542[_0xccb1('0x3a')]=_[_0xccb1('0x46')](_0x55e542[_0xccb1('0x3a')],{'$or':_[_0xccb1('0x2a')](_0x55e542[_0xccb1('0x33')],function(_0x10a2be){var _0x282f87={};_0x282f87[_0x10a2be]={'$like':'%'+_0x4d2a63[_0xccb1('0x2f')][_0xccb1('0x3c')]+'%'};return _0x282f87;})});}_0x55e542=_[_0xccb1('0x46')]({},_0x55e542,_0x4d2a63[_0xccb1('0x47')]);return _0x17e12e[_0xccb1('0x4e')](_0x55e542);}})[_0xccb1('0x25')](function(_0x1c51fa){if(_0x1c51fa){_0x5446f4=_0x1c51fa['length'];if(!_0x4d2a63[_0xccb1('0x2f')]['hasOwnProperty'](_0xccb1('0x37'))){_0x55e542[_0xccb1('0x1f')]=qs['limit'](_0x4d2a63[_0xccb1('0x2f')][_0xccb1('0x1f')]);_0x55e542[_0xccb1('0x1c')]=qs[_0xccb1('0x1c')](_0x4d2a63[_0xccb1('0x2f')][_0xccb1('0x1c')]);}return _0x17e12e[_0xccb1('0x4e')](_0x55e542);}})[_0xccb1('0x25')](function(_0x3bb4b8){if(_0x3bb4b8){return _0x3bb4b8?{'count':_0x5446f4,'rows':_0x3bb4b8}:null;}})[_0xccb1('0x25')](respondWithResult(_0x274f39,null))[_0xccb1('0x42')](handleError(_0x274f39,null));};exports[_0xccb1('0x4f')]=function(_0x2b9110,_0x5008f3,_0x5bb34d){var _0x5b421d={};var _0x3a6a4f={};var _0x5d65b9;var _0x38e375;return db[_0xccb1('0x2b')][_0xccb1('0x4c')]({'where':{'id':_0x2b9110[_0xccb1('0x44')]['id']}})[_0xccb1('0x25')](handleEntityNotFound(_0x5008f3,null))[_0xccb1('0x25')](function(_0x3f3010){if(_0x3f3010){_0x5d65b9=_0x3f3010;_0x3a6a4f['model']=_['keys'](db['FreshsalesField'][_0xccb1('0x45')]);_0x3a6a4f[_0xccb1('0x2f')]=_[_0xccb1('0x30')](_0x2b9110[_0xccb1('0x2f')]);_0x3a6a4f[_0xccb1('0x31')]=_[_0xccb1('0x32')](_0x3a6a4f['model'],_0x3a6a4f[_0xccb1('0x2f')]);_0x5b421d['attributes']=_[_0xccb1('0x32')](_0x3a6a4f[_0xccb1('0x2e')],qs['fields'](_0x2b9110[_0xccb1('0x2f')][_0xccb1('0x34')]));_0x5b421d[_0xccb1('0x33')]=_0x5b421d['attributes']['length']?_0x5b421d['attributes']:_0x3a6a4f[_0xccb1('0x2e')];_0x5b421d['order']=qs['sort'](_0x2b9110[_0xccb1('0x2f')][_0xccb1('0x39')]);_0x5b421d[_0xccb1('0x3a')]=qs[_0xccb1('0x31')](_['pick'](_0x2b9110[_0xccb1('0x2f')],_0x3a6a4f['filters']));if(_0x2b9110[_0xccb1('0x2f')][_0xccb1('0x3c')]){_0x5b421d['where']=_['merge'](_0x5b421d[_0xccb1('0x3a')],{'$or':_[_0xccb1('0x2a')](_0x5b421d['attributes'],function(_0x16ee20){var _0x1f1813={};_0x1f1813[_0x16ee20]={'$like':'%'+_0x2b9110['query']['filter']+'%'};return _0x1f1813;})});}_0x5b421d=_['merge']({},_0x5b421d,_0x2b9110[_0xccb1('0x47')]);return _0x5d65b9['getFields'](_0x5b421d);}})['then'](function(_0xeaf911){if(_0xeaf911){_0x38e375=_0xeaf911[_0xccb1('0x35')];if(!_0x2b9110[_0xccb1('0x2f')]['hasOwnProperty'](_0xccb1('0x37'))){_0x5b421d[_0xccb1('0x1f')]=qs[_0xccb1('0x1f')](_0x2b9110[_0xccb1('0x2f')][_0xccb1('0x1f')]);_0x5b421d['offset']=qs['offset'](_0x2b9110[_0xccb1('0x2f')]['offset']);}return _0x5d65b9[_0xccb1('0x4f')](_0x5b421d);}})[_0xccb1('0x25')](function(_0x295bd2){if(_0x295bd2){return _0x295bd2?{'count':_0x38e375,'rows':_0x295bd2}:null;}})[_0xccb1('0x25')](respondWithResult(_0x5008f3,null))[_0xccb1('0x42')](handleError(_0x5008f3,null));}; \ No newline at end of file +var _0x3d00=['update','then','destroy','sendStatus','stack','name','send','map','FreshsalesConfiguration','fieldName','type','key','query','keys','intersection','attributes','fields','length','order','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','model','rawAttributes','find','create','body','getSubjects','findOne','FreshsalesField','pick','hasOwnProperty','nolimit','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','status','end','undefined','limit','count','offset','Content-Range','apply','reject','save'];(function(_0x499079,_0x4ad88f){var _0x499b2b=function(_0x9be063){while(--_0x9be063){_0x499079['push'](_0x499079['shift']());}};_0x499b2b(++_0x4ad88f);}(_0x3d00,0x11b));var _0x03d0=function(_0xf67acd,_0x1256f7){_0xf67acd=_0xf67acd-0x0;var _0x34766d=_0x3d00[_0xf67acd];return _0x34766d;};'use strict';var emlformat=require(_0x03d0('0x0'));var rimraf=require(_0x03d0('0x1'));var zipdir=require(_0x03d0('0x2'));var jsonpatch=require(_0x03d0('0x3'));var rp=require(_0x03d0('0x4'));var moment=require('moment');var BPromise=require(_0x03d0('0x5'));var Mustache=require(_0x03d0('0x6'));var util=require('util');var path=require('path');var sox=require(_0x03d0('0x7'));var csv=require(_0x03d0('0x8'));var ejs=require(_0x03d0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x03d0('0xa'));var squel=require(_0x03d0('0xb'));var crypto=require(_0x03d0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x03d0('0xd'));var toCsv=require(_0x03d0('0x8'));var querystring=require(_0x03d0('0xe'));var Papa=require(_0x03d0('0xf'));var Redis=require(_0x03d0('0x10'));var authService=require(_0x03d0('0x11'));var qs=require(_0x03d0('0x12'));var as=require(_0x03d0('0x13'));var hardwareService=require(_0x03d0('0x14'));var logger=require(_0x03d0('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x03d0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x199c96,_0x440cbe){_0x440cbe=_0x440cbe||0xcc;return function(_0xfc25ae){if(_0xfc25ae){return _0x199c96['sendStatus'](_0x440cbe);}return _0x199c96[_0x03d0('0x17')](_0x440cbe)[_0x03d0('0x18')]();};}function respondWithResult(_0x2c9a00,_0x44aa09){_0x44aa09=_0x44aa09||0xc8;return function(_0x30de2d){if(_0x30de2d){return _0x2c9a00[_0x03d0('0x17')](_0x44aa09)['json'](_0x30de2d);}};}function respondWithFilteredResult(_0x2fb500,_0x507612){return function(_0x3eb158){if(_0x3eb158){var _0x2840fc=typeof _0x507612['offset']===_0x03d0('0x19')&&typeof _0x507612[_0x03d0('0x1a')]===_0x03d0('0x19');var _0x216037=_0x3eb158[_0x03d0('0x1b')];var _0x41d540=_0x2840fc?0x0:_0x507612[_0x03d0('0x1c')];var _0x902002=_0x2840fc?_0x3eb158[_0x03d0('0x1b')]:_0x507612[_0x03d0('0x1c')]+_0x507612['limit'];var _0x25fa88;if(_0x902002>=_0x216037){_0x902002=_0x216037;_0x25fa88=0xc8;}else{_0x25fa88=0xce;}_0x2fb500['status'](_0x25fa88);return _0x2fb500['set'](_0x03d0('0x1d'),_0x41d540+'-'+_0x902002+'/'+_0x216037)['json'](_0x3eb158);}return null;};}function patchUpdates(_0xb6e32c){return function(_0x5c1b84){try{jsonpatch[_0x03d0('0x1e')](_0x5c1b84,_0xb6e32c,!![]);}catch(_0x573cd0){return BPromise[_0x03d0('0x1f')](_0x573cd0);}return _0x5c1b84[_0x03d0('0x20')]();};}function saveUpdates(_0x454276,_0x52a271){return function(_0x16a265){if(_0x16a265){return _0x16a265[_0x03d0('0x21')](_0x454276)[_0x03d0('0x22')](function(_0x25b345){return _0x25b345;});}return null;};}function removeEntity(_0x4adf78,_0x63be64){return function(_0x5a5aaf){if(_0x5a5aaf){return _0x5a5aaf[_0x03d0('0x23')]()[_0x03d0('0x22')](function(){_0x4adf78[_0x03d0('0x17')](0xcc)[_0x03d0('0x18')]();});}};}function handleEntityNotFound(_0x54e3d0,_0x16c0fb){return function(_0xb2fd9b){if(!_0xb2fd9b){_0x54e3d0[_0x03d0('0x24')](0x194);}return _0xb2fd9b;};}function handleError(_0x46b5d1,_0x595b95){_0x595b95=_0x595b95||0x1f4;return function(_0x33c4bc){logger['error'](_0x33c4bc[_0x03d0('0x25')]);if(_0x33c4bc['name']){delete _0x33c4bc[_0x03d0('0x26')];}_0x46b5d1[_0x03d0('0x17')](_0x595b95)[_0x03d0('0x27')](_0x33c4bc);};}exports['index']=function(_0x7190c2,_0x2ae1ed){var _0x582b66={},_0x1ec8ce={},_0x3a3156={'count':0x0,'rows':[]};var _0x12064c=_[_0x03d0('0x28')](db[_0x03d0('0x29')]['rawAttributes'],function(_0x402e20){return{'name':_0x402e20[_0x03d0('0x2a')],'type':_0x402e20[_0x03d0('0x2b')][_0x03d0('0x2c')]};});_0x1ec8ce['model']=_['map'](_0x12064c,_0x03d0('0x26'));_0x1ec8ce[_0x03d0('0x2d')]=_[_0x03d0('0x2e')](_0x7190c2['query']);_0x1ec8ce['filters']=_[_0x03d0('0x2f')](_0x1ec8ce['model'],_0x1ec8ce[_0x03d0('0x2d')]);_0x582b66[_0x03d0('0x30')]=_[_0x03d0('0x2f')](_0x1ec8ce['model'],qs[_0x03d0('0x31')](_0x7190c2[_0x03d0('0x2d')][_0x03d0('0x31')]));_0x582b66[_0x03d0('0x30')]=_0x582b66[_0x03d0('0x30')][_0x03d0('0x32')]?_0x582b66['attributes']:_0x1ec8ce['model'];if(!_0x7190c2[_0x03d0('0x2d')]['hasOwnProperty']('nolimit')){_0x582b66['limit']=qs[_0x03d0('0x1a')](_0x7190c2['query']['limit']);_0x582b66[_0x03d0('0x1c')]=qs[_0x03d0('0x1c')](_0x7190c2[_0x03d0('0x2d')]['offset']);}_0x582b66[_0x03d0('0x33')]=qs[_0x03d0('0x34')](_0x7190c2[_0x03d0('0x2d')]['sort']);_0x582b66[_0x03d0('0x35')]=qs[_0x03d0('0x36')](_['pick'](_0x7190c2['query'],_0x1ec8ce['filters']),_0x12064c);if(_0x7190c2['query']['filter']){_0x582b66[_0x03d0('0x35')]=_['merge'](_0x582b66['where'],{'$or':_[_0x03d0('0x28')](_0x12064c,function(_0x5e9769){if(_0x5e9769[_0x03d0('0x2b')]!==_0x03d0('0x37')){var _0x415519={};_0x415519[_0x5e9769['name']]={'$like':'%'+_0x7190c2[_0x03d0('0x2d')][_0x03d0('0x38')]+'%'};return _0x415519;}})});}_0x582b66=_[_0x03d0('0x39')]({},_0x582b66,_0x7190c2[_0x03d0('0x3a')]);var _0x4dd485={'where':_0x582b66['where']};return db[_0x03d0('0x29')][_0x03d0('0x1b')](_0x4dd485)['then'](function(_0x136616){_0x3a3156['count']=_0x136616;if(_0x7190c2[_0x03d0('0x2d')][_0x03d0('0x3b')]){_0x582b66[_0x03d0('0x3c')]=[{'all':!![]}];}return db[_0x03d0('0x29')][_0x03d0('0x3d')](_0x582b66);})[_0x03d0('0x22')](function(_0x128fc3){_0x3a3156[_0x03d0('0x3e')]=_0x128fc3;return _0x3a3156;})[_0x03d0('0x22')](respondWithFilteredResult(_0x2ae1ed,_0x582b66))[_0x03d0('0x3f')](handleError(_0x2ae1ed,null));};exports[_0x03d0('0x40')]=function(_0x387056,_0x5198a1){var _0x100013={'raw':![],'where':{'id':_0x387056[_0x03d0('0x41')]['id']}},_0x580564={};_0x580564[_0x03d0('0x42')]=_['keys'](db[_0x03d0('0x29')][_0x03d0('0x43')]);_0x580564[_0x03d0('0x2d')]=_['keys'](_0x387056['query']);_0x580564[_0x03d0('0x36')]=_[_0x03d0('0x2f')](_0x580564['model'],_0x580564[_0x03d0('0x2d')]);_0x100013[_0x03d0('0x30')]=_[_0x03d0('0x2f')](_0x580564['model'],qs[_0x03d0('0x31')](_0x387056[_0x03d0('0x2d')][_0x03d0('0x31')]));_0x100013['attributes']=_0x100013[_0x03d0('0x30')][_0x03d0('0x32')]?_0x100013['attributes']:_0x580564[_0x03d0('0x42')];if(_0x387056[_0x03d0('0x2d')][_0x03d0('0x3b')]){_0x100013[_0x03d0('0x3c')]=[{'all':!![]}];}_0x100013=_['merge']({},_0x100013,_0x387056[_0x03d0('0x3a')]);return db['FreshsalesConfiguration'][_0x03d0('0x44')](_0x100013)[_0x03d0('0x22')](handleEntityNotFound(_0x5198a1,null))[_0x03d0('0x22')](respondWithResult(_0x5198a1,null))[_0x03d0('0x3f')](handleError(_0x5198a1,null));};exports['create']=function(_0x27856f,_0xb6e201){return db[_0x03d0('0x29')][_0x03d0('0x45')](_0x27856f[_0x03d0('0x46')],{})[_0x03d0('0x22')](respondWithResult(_0xb6e201,0xc9))[_0x03d0('0x3f')](handleError(_0xb6e201,null));};exports[_0x03d0('0x21')]=function(_0x20442d,_0x2461c8){if(_0x20442d[_0x03d0('0x46')]['id']){delete _0x20442d[_0x03d0('0x46')]['id'];}return db[_0x03d0('0x29')][_0x03d0('0x44')]({'where':{'id':_0x20442d[_0x03d0('0x41')]['id']}})[_0x03d0('0x22')](handleEntityNotFound(_0x2461c8,null))[_0x03d0('0x22')](saveUpdates(_0x20442d[_0x03d0('0x46')],null))[_0x03d0('0x22')](respondWithResult(_0x2461c8,null))[_0x03d0('0x3f')](handleError(_0x2461c8,null));};exports[_0x03d0('0x23')]=function(_0x188a00,_0x37270b){return db[_0x03d0('0x29')][_0x03d0('0x44')]({'where':{'id':_0x188a00['params']['id']}})['then'](handleEntityNotFound(_0x37270b,null))[_0x03d0('0x22')](removeEntity(_0x37270b,null))[_0x03d0('0x3f')](handleError(_0x37270b,null));};exports[_0x03d0('0x47')]=function(_0x3b6e29,_0x225fdb,_0x35cd3e){var _0x2cff33={};var _0x404bc9={};var _0x438aa7;var _0x452749;return db[_0x03d0('0x29')][_0x03d0('0x48')]({'where':{'id':_0x3b6e29[_0x03d0('0x41')]['id']}})[_0x03d0('0x22')](handleEntityNotFound(_0x225fdb,null))['then'](function(_0x5284be){if(_0x5284be){_0x438aa7=_0x5284be;_0x404bc9['model']=_['keys'](db[_0x03d0('0x49')][_0x03d0('0x43')]);_0x404bc9[_0x03d0('0x2d')]=_['keys'](_0x3b6e29[_0x03d0('0x2d')]);_0x404bc9[_0x03d0('0x36')]=_['intersection'](_0x404bc9[_0x03d0('0x42')],_0x404bc9[_0x03d0('0x2d')]);_0x2cff33['attributes']=_[_0x03d0('0x2f')](_0x404bc9[_0x03d0('0x42')],qs[_0x03d0('0x31')](_0x3b6e29[_0x03d0('0x2d')][_0x03d0('0x31')]));_0x2cff33[_0x03d0('0x30')]=_0x2cff33[_0x03d0('0x30')][_0x03d0('0x32')]?_0x2cff33[_0x03d0('0x30')]:_0x404bc9['model'];_0x2cff33[_0x03d0('0x33')]=qs['sort'](_0x3b6e29[_0x03d0('0x2d')][_0x03d0('0x34')]);_0x2cff33[_0x03d0('0x35')]=qs[_0x03d0('0x36')](_[_0x03d0('0x4a')](_0x3b6e29[_0x03d0('0x2d')],_0x404bc9['filters']));if(_0x3b6e29[_0x03d0('0x2d')][_0x03d0('0x38')]){_0x2cff33[_0x03d0('0x35')]=_['merge'](_0x2cff33[_0x03d0('0x35')],{'$or':_[_0x03d0('0x28')](_0x2cff33[_0x03d0('0x30')],function(_0x55db20){var _0x134b62={};_0x134b62[_0x55db20]={'$like':'%'+_0x3b6e29[_0x03d0('0x2d')]['filter']+'%'};return _0x134b62;})});}_0x2cff33=_[_0x03d0('0x39')]({},_0x2cff33,_0x3b6e29['options']);return _0x438aa7[_0x03d0('0x47')](_0x2cff33);}})[_0x03d0('0x22')](function(_0xac81c5){if(_0xac81c5){_0x452749=_0xac81c5[_0x03d0('0x32')];if(!_0x3b6e29[_0x03d0('0x2d')][_0x03d0('0x4b')](_0x03d0('0x4c'))){_0x2cff33[_0x03d0('0x1a')]=qs[_0x03d0('0x1a')](_0x3b6e29[_0x03d0('0x2d')][_0x03d0('0x1a')]);_0x2cff33[_0x03d0('0x1c')]=qs[_0x03d0('0x1c')](_0x3b6e29[_0x03d0('0x2d')][_0x03d0('0x1c')]);}return _0x438aa7[_0x03d0('0x47')](_0x2cff33);}})[_0x03d0('0x22')](function(_0x1287e0){if(_0x1287e0){return _0x1287e0?{'count':_0x452749,'rows':_0x1287e0}:null;}})[_0x03d0('0x22')](respondWithResult(_0x225fdb,null))['catch'](handleError(_0x225fdb,null));};exports[_0x03d0('0x4d')]=function(_0x212224,_0x7d5499,_0x5aa552){var _0x39bf32={};var _0x1acb51={};var _0x2f1686;var _0x802d10;return db[_0x03d0('0x29')][_0x03d0('0x48')]({'where':{'id':_0x212224[_0x03d0('0x41')]['id']}})[_0x03d0('0x22')](handleEntityNotFound(_0x7d5499,null))[_0x03d0('0x22')](function(_0x42d9f9){if(_0x42d9f9){_0x2f1686=_0x42d9f9;_0x1acb51[_0x03d0('0x42')]=_[_0x03d0('0x2e')](db[_0x03d0('0x49')][_0x03d0('0x43')]);_0x1acb51[_0x03d0('0x2d')]=_[_0x03d0('0x2e')](_0x212224[_0x03d0('0x2d')]);_0x1acb51[_0x03d0('0x36')]=_[_0x03d0('0x2f')](_0x1acb51[_0x03d0('0x42')],_0x1acb51['query']);_0x39bf32['attributes']=_[_0x03d0('0x2f')](_0x1acb51[_0x03d0('0x42')],qs[_0x03d0('0x31')](_0x212224[_0x03d0('0x2d')][_0x03d0('0x31')]));_0x39bf32['attributes']=_0x39bf32[_0x03d0('0x30')]['length']?_0x39bf32['attributes']:_0x1acb51[_0x03d0('0x42')];_0x39bf32[_0x03d0('0x33')]=qs['sort'](_0x212224[_0x03d0('0x2d')][_0x03d0('0x34')]);_0x39bf32['where']=qs['filters'](_['pick'](_0x212224['query'],_0x1acb51[_0x03d0('0x36')]));if(_0x212224[_0x03d0('0x2d')]['filter']){_0x39bf32[_0x03d0('0x35')]=_['merge'](_0x39bf32[_0x03d0('0x35')],{'$or':_[_0x03d0('0x28')](_0x39bf32[_0x03d0('0x30')],function(_0x5cb901){var _0x57ecee={};_0x57ecee[_0x5cb901]={'$like':'%'+_0x212224['query'][_0x03d0('0x38')]+'%'};return _0x57ecee;})});}_0x39bf32=_[_0x03d0('0x39')]({},_0x39bf32,_0x212224[_0x03d0('0x3a')]);return _0x2f1686[_0x03d0('0x4d')](_0x39bf32);}})['then'](function(_0x2fce99){if(_0x2fce99){_0x802d10=_0x2fce99[_0x03d0('0x32')];if(!_0x212224[_0x03d0('0x2d')][_0x03d0('0x4b')](_0x03d0('0x4c'))){_0x39bf32[_0x03d0('0x1a')]=qs[_0x03d0('0x1a')](_0x212224['query']['limit']);_0x39bf32[_0x03d0('0x1c')]=qs['offset'](_0x212224['query'][_0x03d0('0x1c')]);}return _0x2f1686[_0x03d0('0x4d')](_0x39bf32);}})['then'](function(_0x326ec9){if(_0x326ec9){return _0x326ec9?{'count':_0x802d10,'rows':_0x326ec9}:null;}})['then'](respondWithResult(_0x7d5499,null))['catch'](handleError(_0x7d5499,null));};exports[_0x03d0('0x4e')]=function(_0x5cd0f5,_0x1742b8,_0x301f84){var _0x14a7e1={};var _0x23acf1={};var _0xe445b4;var _0x4629db;return db[_0x03d0('0x29')][_0x03d0('0x48')]({'where':{'id':_0x5cd0f5[_0x03d0('0x41')]['id']}})[_0x03d0('0x22')](handleEntityNotFound(_0x1742b8,null))['then'](function(_0x91a1a4){if(_0x91a1a4){_0xe445b4=_0x91a1a4;_0x23acf1[_0x03d0('0x42')]=_[_0x03d0('0x2e')](db[_0x03d0('0x49')][_0x03d0('0x43')]);_0x23acf1[_0x03d0('0x2d')]=_['keys'](_0x5cd0f5[_0x03d0('0x2d')]);_0x23acf1[_0x03d0('0x36')]=_[_0x03d0('0x2f')](_0x23acf1[_0x03d0('0x42')],_0x23acf1['query']);_0x14a7e1[_0x03d0('0x30')]=_[_0x03d0('0x2f')](_0x23acf1[_0x03d0('0x42')],qs['fields'](_0x5cd0f5[_0x03d0('0x2d')][_0x03d0('0x31')]));_0x14a7e1[_0x03d0('0x30')]=_0x14a7e1[_0x03d0('0x30')]['length']?_0x14a7e1['attributes']:_0x23acf1[_0x03d0('0x42')];_0x14a7e1[_0x03d0('0x33')]=qs[_0x03d0('0x34')](_0x5cd0f5['query'][_0x03d0('0x34')]);_0x14a7e1[_0x03d0('0x35')]=qs[_0x03d0('0x36')](_['pick'](_0x5cd0f5['query'],_0x23acf1[_0x03d0('0x36')]));if(_0x5cd0f5[_0x03d0('0x2d')][_0x03d0('0x38')]){_0x14a7e1[_0x03d0('0x35')]=_[_0x03d0('0x39')](_0x14a7e1[_0x03d0('0x35')],{'$or':_[_0x03d0('0x28')](_0x14a7e1[_0x03d0('0x30')],function(_0x1a57ae){var _0x4653e1={};_0x4653e1[_0x1a57ae]={'$like':'%'+_0x5cd0f5[_0x03d0('0x2d')]['filter']+'%'};return _0x4653e1;})});}_0x14a7e1=_['merge']({},_0x14a7e1,_0x5cd0f5[_0x03d0('0x3a')]);return _0xe445b4[_0x03d0('0x4e')](_0x14a7e1);}})[_0x03d0('0x22')](function(_0x1522f2){if(_0x1522f2){_0x4629db=_0x1522f2[_0x03d0('0x32')];if(!_0x5cd0f5[_0x03d0('0x2d')][_0x03d0('0x4b')]('nolimit')){_0x14a7e1[_0x03d0('0x1a')]=qs[_0x03d0('0x1a')](_0x5cd0f5[_0x03d0('0x2d')][_0x03d0('0x1a')]);_0x14a7e1['offset']=qs[_0x03d0('0x1c')](_0x5cd0f5[_0x03d0('0x2d')][_0x03d0('0x1c')]);}return _0xe445b4['getFields'](_0x14a7e1);}})['then'](function(_0x32616d){if(_0x32616d){return _0x32616d?{'count':_0x4629db,'rows':_0x32616d}:null;}})[_0x03d0('0x22')](respondWithResult(_0x1742b8,null))[_0x03d0('0x3f')](handleError(_0x1742b8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 8ac5ae4..b2896b2 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 _0x1c05=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x8fe1cb,_0x48f849){var _0xe4ad15=function(_0x4c7519){while(--_0x4c7519){_0x8fe1cb['push'](_0x8fe1cb['shift']());}};_0xe4ad15(++_0x48f849);}(_0x1c05,0x1cc));var _0x51c0=function(_0xd7105a,_0x289f1f){_0xd7105a=_0xd7105a-0x0;var _0x5de9a0=_0x1c05[_0xd7105a];return _0x5de9a0;};'use strict';var _=require(_0x51c0('0x0'));var util=require(_0x51c0('0x1'));var logger=require(_0x51c0('0x2'))('api');var moment=require(_0x51c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x51c0('0x4'));var fs=require('fs');var path=require(_0x51c0('0x5'));var rimraf=require(_0x51c0('0x6'));var config=require(_0x51c0('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x51c0('0x8')]=function(_0x39da25,_0x30d211){return _0x39da25[_0x51c0('0x9')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6250=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x32d414,_0x4d23da){var _0x4e0bca=function(_0x15d397){while(--_0x15d397){_0x32d414['push'](_0x32d414['shift']());}};_0x4e0bca(++_0x4d23da);}(_0x6250,0x193));var _0x0625=function(_0x179e75,_0x2f81a6){_0x179e75=_0x179e75-0x0;var _0x424650=_0x6250[_0x179e75];return _0x424650;};'use strict';var _=require(_0x0625('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0625('0x1'));var moment=require(_0x0625('0x2'));var BPromise=require(_0x0625('0x3'));var rp=require(_0x0625('0x4'));var fs=require('fs');var path=require(_0x0625('0x5'));var rimraf=require(_0x0625('0x6'));var config=require(_0x0625('0x7'));var attributes=require(_0x0625('0x8'));module[_0x0625('0x9')]=function(_0x11f93d,_0x3e9baa){return _0x11f93d[_0x0625('0xa')](_0x0625('0xb'),attributes,{'tableName':_0x0625('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 a5b5947..8a512fa 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 _0x9c28=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x273fde,_0x314f0c){var _0x4ddf06=function(_0x403a4f){while(--_0x403a4f){_0x273fde['push'](_0x273fde['shift']());}};_0x4ddf06(++_0x314f0c);}(_0x9c28,0x183));var _0x89c2=function(_0x3cab5a,_0x1cf1df){_0x3cab5a=_0x3cab5a-0x0;var _0x1bfa41=_0x9c28[_0x3cab5a];return _0x1bfa41;};'use strict';var _=require(_0x89c2('0x0'));var util=require(_0x89c2('0x1'));var moment=require('moment');var BPromise=require(_0x89c2('0x2'));var rs=require(_0x89c2('0x3'));var fs=require('fs');var Redis=require(_0x89c2('0x4'));var db=require(_0x89c2('0x5'))['db'];var utils=require(_0x89c2('0x6'));var logger=require(_0x89c2('0x7'))(_0x89c2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x89c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36c841,_0x59f158,_0x334162){return new BPromise(function(_0x11398a,_0x5af635){return client[_0x89c2('0xa')](_0x36c841,_0x334162)[_0x89c2('0xb')](function(_0x2e7726){logger[_0x89c2('0xc')](_0x89c2('0xd'),_0x59f158,_0x89c2('0xe'));logger[_0x89c2('0xf')](_0x89c2('0x10'),_0x59f158,'request\x20sent',JSON[_0x89c2('0x11')](_0x2e7726));if(_0x2e7726[_0x89c2('0x12')]){if(_0x2e7726[_0x89c2('0x12')][_0x89c2('0x13')]===0x1f4){logger[_0x89c2('0x12')](_0x89c2('0xd'),_0x59f158,_0x2e7726[_0x89c2('0x12')][_0x89c2('0x14')]);return _0x5af635(_0x2e7726[_0x89c2('0x12')][_0x89c2('0x14')]);}logger['error'](_0x89c2('0xd'),_0x59f158,_0x2e7726[_0x89c2('0x12')][_0x89c2('0x14')]);return _0x11398a(_0x2e7726['error'][_0x89c2('0x14')]);}else{logger[_0x89c2('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x59f158,_0x89c2('0xe'));_0x11398a(_0x2e7726[_0x89c2('0x15')][_0x89c2('0x14')]);}})[_0x89c2('0x16')](function(_0x48ea7e){logger[_0x89c2('0x12')](_0x89c2('0xd'),_0x59f158,_0x48ea7e);_0x5af635(_0x48ea7e);});});} \ No newline at end of file +var _0x3c1d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','info','request\x20sent','result','catch','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x32aaa5,_0x45c662){var _0x45b69e=function(_0x258774){while(--_0x258774){_0x32aaa5['push'](_0x32aaa5['shift']());}};_0x45b69e(++_0x45c662);}(_0x3c1d,0x188));var _0xd3c1=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x3c1d[_0x36884e];return _0x1cc367;};'use strict';var _=require('lodash');var util=require(_0xd3c1('0x0'));var moment=require('moment');var BPromise=require(_0xd3c1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3c1('0x2'))['db'];var utils=require(_0xd3c1('0x3'));var logger=require(_0xd3c1('0x4'))(_0xd3c1('0x5'));var config=require(_0xd3c1('0x6'));var jayson=require(_0xd3c1('0x7'));var client=jayson[_0xd3c1('0x8')][_0xd3c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x117a6e,_0x70a0a7,_0x4cf450){return new BPromise(function(_0x17f662,_0x43bf19){return client[_0xd3c1('0xa')](_0x117a6e,_0x4cf450)[_0xd3c1('0xb')](function(_0xfbc430){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x70a0a7,'request\x20sent');logger[_0xd3c1('0xc')](_0xd3c1('0xd'),_0x70a0a7,'request\x20sent',JSON['stringify'](_0xfbc430));if(_0xfbc430[_0xd3c1('0xe')]){if(_0xfbc430[_0xd3c1('0xe')][_0xd3c1('0xf')]===0x1f4){logger[_0xd3c1('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x70a0a7,_0xfbc430[_0xd3c1('0xe')][_0xd3c1('0x10')]);return _0x43bf19(_0xfbc430[_0xd3c1('0xe')]['message']);}logger[_0xd3c1('0xe')](_0xd3c1('0x11'),_0x70a0a7,_0xfbc430[_0xd3c1('0xe')]['message']);return _0x17f662(_0xfbc430['error'][_0xd3c1('0x10')]);}else{logger[_0xd3c1('0x12')](_0xd3c1('0x11'),_0x70a0a7,_0xd3c1('0x13'));_0x17f662(_0xfbc430[_0xd3c1('0x14')][_0xd3c1('0x10')]);}})[_0xd3c1('0x15')](function(_0x422e66){logger[_0xd3c1('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x70a0a7,_0x422e66);_0x43bf19(_0x422e66);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index a75fd9d..1aeb95f 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 _0x0a9a=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','update','destroy','util','connect-timeout','express'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x0a9a,0x183));var _0xa0a9=function(_0x15aeca,_0x33edf3){_0x15aeca=_0x15aeca-0x0;var _0x3a610f=_0x0a9a[_0x15aeca];return _0x3a610f;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./intFreshsalesField.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/:id',auth[_0xa0a9('0x8')](),controller['show']);router[_0xa0a9('0xa')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xb')]);router[_0xa0a9('0xc')]('/:id',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);router['delete']('/:id',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa854=['./intFreshsalesField.controller','get','index','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x4548bb,_0x3cb9b3){var _0x310687=function(_0x5859dc){while(--_0x5859dc){_0x4548bb['push'](_0x4548bb['shift']());}};_0x310687(++_0x3cb9b3);}(_0xa854,0x103));var _0x4a85=function(_0x5b9f33,_0x2918f4){_0x5b9f33=_0x5b9f33-0x0;var _0x20538e=_0xa854[_0x5b9f33];return _0x20538e;};'use strict';var multer=require(_0x4a85('0x0'));var util=require(_0x4a85('0x1'));var path=require(_0x4a85('0x2'));var timeout=require(_0x4a85('0x3'));var express=require(_0x4a85('0x4'));var router=express['Router']();var fs_extra=require(_0x4a85('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4a85('0x6'));var config=require('../../config/environment');var controller=require(_0x4a85('0x7'));router[_0x4a85('0x8')]('/',auth['isAuthenticated'](),controller[_0x4a85('0x9')]);router[_0x4a85('0x8')]('/:id',auth[_0x4a85('0xa')](),controller['show']);router[_0x4a85('0xb')]('/',auth[_0x4a85('0xa')](),controller[_0x4a85('0xc')]);router[_0x4a85('0xd')](_0x4a85('0xe'),auth[_0x4a85('0xa')](),controller[_0x4a85('0xf')]);router[_0x4a85('0x10')](_0x4a85('0xe'),auth['isAuthenticated'](),controller[_0x4a85('0x11')]);module[_0x4a85('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index c1abf0e..cfe00d8 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 _0xef98=['string','STRING','variable','BOOLEAN','sequelize','ENUM'];(function(_0x53007e,_0x3bde01){var _0x3e7f47=function(_0x26f45f){while(--_0x26f45f){_0x53007e['push'](_0x53007e['shift']());}};_0x3e7f47(++_0x3bde01);}(_0xef98,0xdc));var _0x8ef9=function(_0x5d84d0,_0x6dd5ea){_0x5d84d0=_0x5d84d0-0x0;var _0x541a29=_0xef98[_0x5d84d0];return _0x541a29;};'use strict';var Sequelize=require(_0x8ef9('0x0'));module['exports']={'type':{'type':Sequelize[_0x8ef9('0x1')](_0x8ef9('0x2'),'variable','customVariable','keyValue','picklist'),'defaultValue':_0x8ef9('0x2')},'content':{'type':Sequelize[_0x8ef9('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8ef9('0x1')](_0x8ef9('0x2'),_0x8ef9('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x8ef9('0x3')]},'idField':{'type':Sequelize[_0x8ef9('0x3')]},'nameField':{'type':Sequelize[_0x8ef9('0x3')]},'customField':{'type':Sequelize[_0x8ef9('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x54a2=['customVariable','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0xb31209,_0x5d4200){var _0x531276=function(_0x2ee4ab){while(--_0x2ee4ab){_0xb31209['push'](_0xb31209['shift']());}};_0x531276(++_0x5d4200);}(_0x54a2,0xa7));var _0x254a=function(_0x17b94e,_0x1b2f59){_0x17b94e=_0x17b94e-0x0;var _0x14ab53=_0x54a2[_0x17b94e];return _0x14ab53;};'use strict';var Sequelize=require(_0x254a('0x0'));module[_0x254a('0x1')]={'type':{'type':Sequelize['ENUM'](_0x254a('0x2'),_0x254a('0x3'),_0x254a('0x4'),'keyValue',_0x254a('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x254a('0x6')]},'keyType':{'type':Sequelize[_0x254a('0x7')]('string',_0x254a('0x3'),_0x254a('0x4'))},'keyContent':{'type':Sequelize[_0x254a('0x6')]},'idField':{'type':Sequelize[_0x254a('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x254a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x254a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 7aef787..2ea367f 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 _0x4f74=['sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','FreshsalesField','includeAll','include','findAll','rows','catch','show','create','body','find','params','eml-format','rimraf','zip-dir','request-promise','mustache','util','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x384113,_0xccc4b0){var _0x3fc9f1=function(_0x5f5c92){while(--_0x5f5c92){_0x384113['push'](_0x384113['shift']());}};_0x3fc9f1(++_0xccc4b0);}(_0x4f74,0x7d));var _0x44f7=function(_0x14d250,_0x4b2e12){_0x14d250=_0x14d250-0x0;var _0xb991d8=_0x4f74[_0x14d250];return _0xb991d8;};'use strict';var emlformat=require(_0x44f7('0x0'));var rimraf=require(_0x44f7('0x1'));var zipdir=require(_0x44f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x44f7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44f7('0x4'));var util=require(_0x44f7('0x5'));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(_0x44f7('0x6'));var _=require(_0x44f7('0x7'));var squel=require(_0x44f7('0x8'));var crypto=require(_0x44f7('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x44f7('0xa'));var toCsv=require(_0x44f7('0xb'));var querystring=require(_0x44f7('0xc'));var Papa=require(_0x44f7('0xd'));var Redis=require('ioredis');var authService=require(_0x44f7('0xe'));var qs=require(_0x44f7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44f7('0x10'));var logger=require(_0x44f7('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x44f7('0x12'));var licenseUtil=require(_0x44f7('0x13'));var db=require(_0x44f7('0x14'))['db'];function respondWithStatusCode(_0x362a26,_0x38bb51){_0x38bb51=_0x38bb51||0xcc;return function(_0x188c33){if(_0x188c33){return _0x362a26[_0x44f7('0x15')](_0x38bb51);}return _0x362a26['status'](_0x38bb51)[_0x44f7('0x16')]();};}function respondWithResult(_0x471557,_0x3dbbef){_0x3dbbef=_0x3dbbef||0xc8;return function(_0x30738d){if(_0x30738d){return _0x471557[_0x44f7('0x17')](_0x3dbbef)['json'](_0x30738d);}};}function respondWithFilteredResult(_0x3fa4a5,_0x39dd39){return function(_0xe3090e){if(_0xe3090e){var _0x2ebaca=typeof _0x39dd39['offset']==='undefined'&&typeof _0x39dd39[_0x44f7('0x18')]===_0x44f7('0x19');var _0x3815fc=_0xe3090e[_0x44f7('0x1a')];var _0x2c5e6d=_0x2ebaca?0x0:_0x39dd39[_0x44f7('0x1b')];var _0x4b7876=_0x2ebaca?_0xe3090e[_0x44f7('0x1a')]:_0x39dd39[_0x44f7('0x1b')]+_0x39dd39[_0x44f7('0x18')];var _0x5303e5;if(_0x4b7876>=_0x3815fc){_0x4b7876=_0x3815fc;_0x5303e5=0xc8;}else{_0x5303e5=0xce;}_0x3fa4a5['status'](_0x5303e5);return _0x3fa4a5[_0x44f7('0x1c')](_0x44f7('0x1d'),_0x2c5e6d+'-'+_0x4b7876+'/'+_0x3815fc)[_0x44f7('0x1e')](_0xe3090e);}return null;};}function patchUpdates(_0x1378c9){return function(_0x528063){try{jsonpatch[_0x44f7('0x1f')](_0x528063,_0x1378c9,!![]);}catch(_0x2f90c8){return BPromise[_0x44f7('0x20')](_0x2f90c8);}return _0x528063[_0x44f7('0x21')]();};}function saveUpdates(_0x48d36f,_0x348935){return function(_0x2accd9){if(_0x2accd9){return _0x2accd9[_0x44f7('0x22')](_0x48d36f)['then'](function(_0x35d571){return _0x35d571;});}return null;};}function removeEntity(_0x47dead,_0x4fb269){return function(_0x2b1d6c){if(_0x2b1d6c){return _0x2b1d6c[_0x44f7('0x23')]()[_0x44f7('0x24')](function(){_0x47dead[_0x44f7('0x17')](0xcc)[_0x44f7('0x16')]();});}};}function handleEntityNotFound(_0x11d72c,_0x39b0c2){return function(_0x4b4115){if(!_0x4b4115){_0x11d72c[_0x44f7('0x15')](0x194);}return _0x4b4115;};}function handleError(_0x25476e,_0x50e6d4){_0x50e6d4=_0x50e6d4||0x1f4;return function(_0x4e0c6b){logger[_0x44f7('0x25')](_0x4e0c6b[_0x44f7('0x26')]);if(_0x4e0c6b[_0x44f7('0x27')]){delete _0x4e0c6b['name'];}_0x25476e[_0x44f7('0x17')](_0x50e6d4)['send'](_0x4e0c6b);};}exports[_0x44f7('0x28')]=function(_0x2939ac,_0x1b9614){var _0x1625f8={},_0x3d7551={},_0x20a496={'count':0x0,'rows':[]};var _0x323896=_[_0x44f7('0x29')](db['FreshsalesField'][_0x44f7('0x2a')],function(_0x4c18f4){return{'name':_0x4c18f4[_0x44f7('0x2b')],'type':_0x4c18f4[_0x44f7('0x2c')][_0x44f7('0x2d')]};});_0x3d7551[_0x44f7('0x2e')]=_['map'](_0x323896,_0x44f7('0x27'));_0x3d7551[_0x44f7('0x2f')]=_[_0x44f7('0x30')](_0x2939ac[_0x44f7('0x2f')]);_0x3d7551[_0x44f7('0x31')]=_['intersection'](_0x3d7551[_0x44f7('0x2e')],_0x3d7551['query']);_0x1625f8['attributes']=_[_0x44f7('0x32')](_0x3d7551['model'],qs[_0x44f7('0x33')](_0x2939ac['query']['fields']));_0x1625f8[_0x44f7('0x34')]=_0x1625f8['attributes'][_0x44f7('0x35')]?_0x1625f8['attributes']:_0x3d7551[_0x44f7('0x2e')];if(!_0x2939ac[_0x44f7('0x2f')]['hasOwnProperty'](_0x44f7('0x36'))){_0x1625f8[_0x44f7('0x18')]=qs[_0x44f7('0x18')](_0x2939ac[_0x44f7('0x2f')][_0x44f7('0x18')]);_0x1625f8['offset']=qs[_0x44f7('0x1b')](_0x2939ac[_0x44f7('0x2f')]['offset']);}_0x1625f8['order']=qs[_0x44f7('0x37')](_0x2939ac['query']['sort']);_0x1625f8['where']=qs['filters'](_[_0x44f7('0x38')](_0x2939ac['query'],_0x3d7551[_0x44f7('0x31')]),_0x323896);if(_0x2939ac['query'][_0x44f7('0x39')]){_0x1625f8['where']=_[_0x44f7('0x3a')](_0x1625f8[_0x44f7('0x3b')],{'$or':_[_0x44f7('0x29')](_0x323896,function(_0x1d2d92){if(_0x1d2d92[_0x44f7('0x2c')]!==_0x44f7('0x3c')){var _0x5396b6={};_0x5396b6[_0x1d2d92['name']]={'$like':'%'+_0x2939ac['query'][_0x44f7('0x39')]+'%'};return _0x5396b6;}})});}_0x1625f8=_[_0x44f7('0x3a')]({},_0x1625f8,_0x2939ac[_0x44f7('0x3d')]);var _0x55fe5b={'where':_0x1625f8[_0x44f7('0x3b')]};return db[_0x44f7('0x3e')]['count'](_0x55fe5b)[_0x44f7('0x24')](function(_0x28ea48){_0x20a496[_0x44f7('0x1a')]=_0x28ea48;if(_0x2939ac[_0x44f7('0x2f')][_0x44f7('0x3f')]){_0x1625f8[_0x44f7('0x40')]=[{'all':!![]}];}return db['FreshsalesField'][_0x44f7('0x41')](_0x1625f8);})[_0x44f7('0x24')](function(_0x396e67){_0x20a496[_0x44f7('0x42')]=_0x396e67;return _0x20a496;})['then'](respondWithFilteredResult(_0x1b9614,_0x1625f8))[_0x44f7('0x43')](handleError(_0x1b9614,null));};exports[_0x44f7('0x44')]=function(_0x13a0ac,_0x26ea77){var _0x15a117={'raw':!![],'where':{'id':_0x13a0ac['params']['id']}},_0x32e447={};_0x32e447['model']=_[_0x44f7('0x30')](db[_0x44f7('0x3e')][_0x44f7('0x2a')]);_0x32e447['query']=_[_0x44f7('0x30')](_0x13a0ac[_0x44f7('0x2f')]);_0x32e447[_0x44f7('0x31')]=_[_0x44f7('0x32')](_0x32e447[_0x44f7('0x2e')],_0x32e447[_0x44f7('0x2f')]);_0x15a117['attributes']=_['intersection'](_0x32e447[_0x44f7('0x2e')],qs[_0x44f7('0x33')](_0x13a0ac[_0x44f7('0x2f')][_0x44f7('0x33')]));_0x15a117[_0x44f7('0x34')]=_0x15a117[_0x44f7('0x34')][_0x44f7('0x35')]?_0x15a117['attributes']:_0x32e447[_0x44f7('0x2e')];if(_0x13a0ac[_0x44f7('0x2f')][_0x44f7('0x3f')]){_0x15a117[_0x44f7('0x40')]=[{'all':!![]}];}_0x15a117=_['merge']({},_0x15a117,_0x13a0ac[_0x44f7('0x3d')]);return db[_0x44f7('0x3e')]['find'](_0x15a117)[_0x44f7('0x24')](handleEntityNotFound(_0x26ea77,null))[_0x44f7('0x24')](respondWithResult(_0x26ea77,null))[_0x44f7('0x43')](handleError(_0x26ea77,null));};exports[_0x44f7('0x45')]=function(_0x4fed08,_0x9f42f1){return db['FreshsalesField'][_0x44f7('0x45')](_0x4fed08[_0x44f7('0x46')],{})[_0x44f7('0x24')](respondWithResult(_0x9f42f1,0xc9))['catch'](handleError(_0x9f42f1,null));};exports[_0x44f7('0x22')]=function(_0xa22d7b,_0x3c81ad){if(_0xa22d7b[_0x44f7('0x46')]['id']){delete _0xa22d7b[_0x44f7('0x46')]['id'];}return db[_0x44f7('0x3e')][_0x44f7('0x47')]({'where':{'id':_0xa22d7b[_0x44f7('0x48')]['id']}})[_0x44f7('0x24')](handleEntityNotFound(_0x3c81ad,null))[_0x44f7('0x24')](saveUpdates(_0xa22d7b[_0x44f7('0x46')],null))['then'](respondWithResult(_0x3c81ad,null))[_0x44f7('0x43')](handleError(_0x3c81ad,null));};exports[_0x44f7('0x23')]=function(_0x3cfe43,_0x148fa9){return db[_0x44f7('0x3e')][_0x44f7('0x47')]({'where':{'id':_0x3cfe43[_0x44f7('0x48')]['id']}})[_0x44f7('0x24')](handleEntityNotFound(_0x148fa9,null))[_0x44f7('0x24')](removeEntity(_0x148fa9,null))['catch'](handleError(_0x148fa9,null));}; \ No newline at end of file +var _0xeff7=['keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','reject','save','then','destroy','error','name','FreshsalesField','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xeff7,0x190));var _0x7eff=function(_0x1df28f,_0x49e01a){_0x1df28f=_0x1df28f-0x0;var _0xdd15f8=_0xeff7[_0x1df28f];return _0xdd15f8;};'use strict';var emlformat=require(_0x7eff('0x0'));var rimraf=require(_0x7eff('0x1'));var zipdir=require(_0x7eff('0x2'));var jsonpatch=require(_0x7eff('0x3'));var rp=require('request-promise');var moment=require(_0x7eff('0x4'));var BPromise=require(_0x7eff('0x5'));var Mustache=require(_0x7eff('0x6'));var util=require(_0x7eff('0x7'));var path=require('path');var sox=require(_0x7eff('0x8'));var csv=require(_0x7eff('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7eff('0xa'));var _=require(_0x7eff('0xb'));var squel=require(_0x7eff('0xc'));var crypto=require(_0x7eff('0xd'));var jsforce=require(_0x7eff('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7eff('0xf'));var Redis=require(_0x7eff('0x10'));var authService=require(_0x7eff('0x11'));var qs=require(_0x7eff('0x12'));var as=require(_0x7eff('0x13'));var hardwareService=require(_0x7eff('0x14'));var logger=require(_0x7eff('0x15'))(_0x7eff('0x16'));var utils=require(_0x7eff('0x17'));var config=require(_0x7eff('0x18'));var licenseUtil=require(_0x7eff('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x530fe1,_0xe1a190){_0xe1a190=_0xe1a190||0xcc;return function(_0x58fa7f){if(_0x58fa7f){return _0x530fe1[_0x7eff('0x1a')](_0xe1a190);}return _0x530fe1['status'](_0xe1a190)[_0x7eff('0x1b')]();};}function respondWithResult(_0x454e37,_0x4b9814){_0x4b9814=_0x4b9814||0xc8;return function(_0x17846e){if(_0x17846e){return _0x454e37['status'](_0x4b9814)[_0x7eff('0x1c')](_0x17846e);}};}function respondWithFilteredResult(_0x53ef3c,_0x16dc18){return function(_0x4889f3){if(_0x4889f3){var _0x5a9981=typeof _0x16dc18[_0x7eff('0x1d')]===_0x7eff('0x1e')&&typeof _0x16dc18['limit']==='undefined';var _0x84b65e=_0x4889f3[_0x7eff('0x1f')];var _0x3b867c=_0x5a9981?0x0:_0x16dc18[_0x7eff('0x1d')];var _0x5b6978=_0x5a9981?_0x4889f3[_0x7eff('0x1f')]:_0x16dc18[_0x7eff('0x1d')]+_0x16dc18[_0x7eff('0x20')];var _0x89ab0c;if(_0x5b6978>=_0x84b65e){_0x5b6978=_0x84b65e;_0x89ab0c=0xc8;}else{_0x89ab0c=0xce;}_0x53ef3c[_0x7eff('0x21')](_0x89ab0c);return _0x53ef3c[_0x7eff('0x22')](_0x7eff('0x23'),_0x3b867c+'-'+_0x5b6978+'/'+_0x84b65e)[_0x7eff('0x1c')](_0x4889f3);}return null;};}function patchUpdates(_0x190435){return function(_0x4359b4){try{jsonpatch['apply'](_0x4359b4,_0x190435,!![]);}catch(_0x5aebdf){return BPromise[_0x7eff('0x24')](_0x5aebdf);}return _0x4359b4[_0x7eff('0x25')]();};}function saveUpdates(_0x24cfda,_0x3641aa){return function(_0x2baf6c){if(_0x2baf6c){return _0x2baf6c['update'](_0x24cfda)[_0x7eff('0x26')](function(_0x2bc55f){return _0x2bc55f;});}return null;};}function removeEntity(_0x2ab500,_0x3f83a1){return function(_0x4cdcbc){if(_0x4cdcbc){return _0x4cdcbc[_0x7eff('0x27')]()[_0x7eff('0x26')](function(){_0x2ab500[_0x7eff('0x21')](0xcc)[_0x7eff('0x1b')]();});}};}function handleEntityNotFound(_0x56cc9d,_0x38733d){return function(_0x4d0ef1){if(!_0x4d0ef1){_0x56cc9d[_0x7eff('0x1a')](0x194);}return _0x4d0ef1;};}function handleError(_0x383d09,_0x591efd){_0x591efd=_0x591efd||0x1f4;return function(_0xfe0e80){logger[_0x7eff('0x28')](_0xfe0e80['stack']);if(_0xfe0e80[_0x7eff('0x29')]){delete _0xfe0e80[_0x7eff('0x29')];}_0x383d09[_0x7eff('0x21')](_0x591efd)['send'](_0xfe0e80);};}exports['index']=function(_0x2801ae,_0x3d37a6){var _0xc500fa={},_0x274b01={},_0x3cc554={'count':0x0,'rows':[]};var _0x170e9c=_['map'](db[_0x7eff('0x2a')][_0x7eff('0x2b')],function(_0x578419){return{'name':_0x578419[_0x7eff('0x2c')],'type':_0x578419[_0x7eff('0x2d')][_0x7eff('0x2e')]};});_0x274b01[_0x7eff('0x2f')]=_[_0x7eff('0x30')](_0x170e9c,_0x7eff('0x29'));_0x274b01[_0x7eff('0x31')]=_[_0x7eff('0x32')](_0x2801ae[_0x7eff('0x31')]);_0x274b01[_0x7eff('0x33')]=_[_0x7eff('0x34')](_0x274b01[_0x7eff('0x2f')],_0x274b01[_0x7eff('0x31')]);_0xc500fa[_0x7eff('0x35')]=_['intersection'](_0x274b01[_0x7eff('0x2f')],qs[_0x7eff('0x36')](_0x2801ae[_0x7eff('0x31')]['fields']));_0xc500fa['attributes']=_0xc500fa[_0x7eff('0x35')][_0x7eff('0x37')]?_0xc500fa['attributes']:_0x274b01[_0x7eff('0x2f')];if(!_0x2801ae['query']['hasOwnProperty'](_0x7eff('0x38'))){_0xc500fa[_0x7eff('0x20')]=qs[_0x7eff('0x20')](_0x2801ae['query']['limit']);_0xc500fa[_0x7eff('0x1d')]=qs[_0x7eff('0x1d')](_0x2801ae[_0x7eff('0x31')][_0x7eff('0x1d')]);}_0xc500fa[_0x7eff('0x39')]=qs[_0x7eff('0x3a')](_0x2801ae[_0x7eff('0x31')][_0x7eff('0x3a')]);_0xc500fa[_0x7eff('0x3b')]=qs['filters'](_[_0x7eff('0x3c')](_0x2801ae[_0x7eff('0x31')],_0x274b01[_0x7eff('0x33')]),_0x170e9c);if(_0x2801ae[_0x7eff('0x31')][_0x7eff('0x3d')]){_0xc500fa[_0x7eff('0x3b')]=_[_0x7eff('0x3e')](_0xc500fa[_0x7eff('0x3b')],{'$or':_[_0x7eff('0x30')](_0x170e9c,function(_0x2edd78){if(_0x2edd78[_0x7eff('0x2d')]!==_0x7eff('0x3f')){var _0x5dc558={};_0x5dc558[_0x2edd78[_0x7eff('0x29')]]={'$like':'%'+_0x2801ae[_0x7eff('0x31')][_0x7eff('0x3d')]+'%'};return _0x5dc558;}})});}_0xc500fa=_[_0x7eff('0x3e')]({},_0xc500fa,_0x2801ae[_0x7eff('0x40')]);var _0x2d2a19={'where':_0xc500fa[_0x7eff('0x3b')]};return db['FreshsalesField'][_0x7eff('0x1f')](_0x2d2a19)['then'](function(_0x11427e){_0x3cc554[_0x7eff('0x1f')]=_0x11427e;if(_0x2801ae['query'][_0x7eff('0x41')]){_0xc500fa['include']=[{'all':!![]}];}return db[_0x7eff('0x2a')][_0x7eff('0x42')](_0xc500fa);})['then'](function(_0xb8eee8){_0x3cc554['rows']=_0xb8eee8;return _0x3cc554;})[_0x7eff('0x26')](respondWithFilteredResult(_0x3d37a6,_0xc500fa))[_0x7eff('0x43')](handleError(_0x3d37a6,null));};exports[_0x7eff('0x44')]=function(_0x2aee7b,_0x25b6f6){var _0x5c42a6={'raw':!![],'where':{'id':_0x2aee7b[_0x7eff('0x45')]['id']}},_0x49301e={};_0x49301e[_0x7eff('0x2f')]=_[_0x7eff('0x32')](db['FreshsalesField'][_0x7eff('0x2b')]);_0x49301e['query']=_[_0x7eff('0x32')](_0x2aee7b[_0x7eff('0x31')]);_0x49301e[_0x7eff('0x33')]=_[_0x7eff('0x34')](_0x49301e[_0x7eff('0x2f')],_0x49301e[_0x7eff('0x31')]);_0x5c42a6[_0x7eff('0x35')]=_['intersection'](_0x49301e['model'],qs[_0x7eff('0x36')](_0x2aee7b[_0x7eff('0x31')][_0x7eff('0x36')]));_0x5c42a6['attributes']=_0x5c42a6['attributes'][_0x7eff('0x37')]?_0x5c42a6[_0x7eff('0x35')]:_0x49301e[_0x7eff('0x2f')];if(_0x2aee7b[_0x7eff('0x31')]['includeAll']){_0x5c42a6[_0x7eff('0x46')]=[{'all':!![]}];}_0x5c42a6=_[_0x7eff('0x3e')]({},_0x5c42a6,_0x2aee7b[_0x7eff('0x40')]);return db[_0x7eff('0x2a')][_0x7eff('0x47')](_0x5c42a6)['then'](handleEntityNotFound(_0x25b6f6,null))['then'](respondWithResult(_0x25b6f6,null))[_0x7eff('0x43')](handleError(_0x25b6f6,null));};exports['create']=function(_0x18948e,_0x5b1bee){return db[_0x7eff('0x2a')][_0x7eff('0x48')](_0x18948e[_0x7eff('0x49')],{})[_0x7eff('0x26')](respondWithResult(_0x5b1bee,0xc9))[_0x7eff('0x43')](handleError(_0x5b1bee,null));};exports[_0x7eff('0x4a')]=function(_0x4f3482,_0x268c88){if(_0x4f3482['body']['id']){delete _0x4f3482[_0x7eff('0x49')]['id'];}return db[_0x7eff('0x2a')]['find']({'where':{'id':_0x4f3482[_0x7eff('0x45')]['id']}})[_0x7eff('0x26')](handleEntityNotFound(_0x268c88,null))['then'](saveUpdates(_0x4f3482[_0x7eff('0x49')],null))[_0x7eff('0x26')](respondWithResult(_0x268c88,null))[_0x7eff('0x43')](handleError(_0x268c88,null));};exports[_0x7eff('0x27')]=function(_0x47c9d3,_0x152bbc){return db['FreshsalesField']['find']({'where':{'id':_0x47c9d3[_0x7eff('0x45')]['id']}})[_0x7eff('0x26')](handleEntityNotFound(_0x152bbc,null))[_0x7eff('0x26')](removeEntity(_0x152bbc,null))[_0x7eff('0x43')](handleError(_0x152bbc,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 01fa231..ee521d8 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 _0x2a84=['FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','api','moment','bluebird','path','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x214d8c,_0x242dc3){var _0x5a5060=function(_0x3dc1e0){while(--_0x3dc1e0){_0x214d8c['push'](_0x214d8c['shift']());}};_0x5a5060(++_0x242dc3);}(_0x2a84,0x170));var _0x42a8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2a84[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x42a8('0x0'));var util=require(_0x42a8('0x1'));var logger=require('../../config/logger')(_0x42a8('0x2'));var moment=require(_0x42a8('0x3'));var BPromise=require(_0x42a8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x42a8('0x5'));var rimraf=require('rimraf');var config=require(_0x42a8('0x6'));var attributes=require(_0x42a8('0x7'));module[_0x42a8('0x8')]=function(_0x59505e,_0x593b3a){return _0x59505e['define'](_0x42a8('0x9'),attributes,{'tableName':_0x42a8('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x42a8('0xb'),_0x42a8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2deb=['int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define'];(function(_0x3806b1,_0x425a11){var _0x2a0da2=function(_0x4833f3){while(--_0x4833f3){_0x3806b1['push'](_0x3806b1['shift']());}};_0x2a0da2(++_0x425a11);}(_0x2deb,0xdb));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var logger=require(_0xb2de('0x2'))(_0xb2de('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb2de('0x4'));var fs=require('fs');var path=require(_0xb2de('0x5'));var rimraf=require(_0xb2de('0x6'));var config=require(_0xb2de('0x7'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x201fcc,_0x2ed8ec){return _0x201fcc[_0xb2de('0x8')]('FreshsalesField',attributes,{'tableName':_0xb2de('0x9'),'paranoid':![],'indexes':[{'name':_0xb2de('0xa'),'fields':['idField',_0xb2de('0xb')],'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 14c50b6..7941078 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 _0x6f47=['request\x20sent','debug','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2d91c6,_0x10ae0e){var _0x3a8d19=function(_0x27a3ce){while(--_0x27a3ce){_0x2d91c6['push'](_0x2d91c6['shift']());}};_0x3a8d19(++_0x10ae0e);}(_0x6f47,0xc7));var _0x76f4=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x6f47[_0xac151d];return _0x111dba;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var moment=require(_0x76f4('0x1'));var BPromise=require('bluebird');var rs=require(_0x76f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76f4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x76f4('0x4'))(_0x76f4('0x5'));var config=require(_0x76f4('0x6'));var jayson=require(_0x76f4('0x7'));var client=jayson['client'][_0x76f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfc2405,_0x2176a7,_0x497f99){return new BPromise(function(_0x1a3172,_0x25656d){return client[_0x76f4('0x9')](_0xfc2405,_0x497f99)[_0x76f4('0xa')](function(_0x101f55){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2176a7,_0x76f4('0xb'));logger[_0x76f4('0xc')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2176a7,'request\x20sent',JSON[_0x76f4('0xd')](_0x101f55));if(_0x101f55[_0x76f4('0xe')]){if(_0x101f55[_0x76f4('0xe')][_0x76f4('0xf')]===0x1f4){logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x101f55[_0x76f4('0xe')][_0x76f4('0x11')]);return _0x25656d(_0x101f55[_0x76f4('0xe')]['message']);}logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x101f55['error']['message']);return _0x1a3172(_0x101f55['error'][_0x76f4('0x11')]);}else{logger[_0x76f4('0x12')](_0x76f4('0x10'),_0x2176a7,_0x76f4('0xb'));_0x1a3172(_0x101f55[_0x76f4('0x13')][_0x76f4('0x11')]);}})[_0x76f4('0x14')](function(_0x981a87){logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x981a87);_0x25656d(_0x981a87);});});} \ No newline at end of file +var _0x5d58=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x248a43,_0x59e52a){var _0x451379=function(_0x2c5209){while(--_0x2c5209){_0x248a43['push'](_0x248a43['shift']());}};_0x451379(++_0x59e52a);}(_0x5d58,0x187));var _0x85d5=function(_0x5b3eb1,_0x1d557e){_0x5b3eb1=_0x5b3eb1-0x0;var _0x1cced1=_0x5d58[_0x5b3eb1];return _0x1cced1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85d5('0x0'));var db=require(_0x85d5('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x85d5('0x2'))(_0x85d5('0x3'));var config=require('../../config/environment');var jayson=require(_0x85d5('0x4'));var client=jayson[_0x85d5('0x5')][_0x85d5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x46e7b4,_0x5f47ec,_0x98c963){return new BPromise(function(_0x3fecca,_0x4ca293){return client[_0x85d5('0x7')](_0x46e7b4,_0x98c963)['then'](function(_0x1098be){logger[_0x85d5('0x8')](_0x85d5('0x9'),_0x5f47ec,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x5f47ec,_0x85d5('0xa'),JSON[_0x85d5('0xb')](_0x1098be));if(_0x1098be[_0x85d5('0xc')]){if(_0x1098be[_0x85d5('0xc')][_0x85d5('0xd')]===0x1f4){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be['error']['message']);return _0x4ca293(_0x1098be['error'][_0x85d5('0xe')]);}logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);return _0x3fecca(_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);}else{logger['info'](_0x85d5('0x9'),_0x5f47ec,_0x85d5('0xa'));_0x3fecca(_0x1098be[_0x85d5('0xf')][_0x85d5('0xe')]);}})[_0x85d5('0x10')](function(_0x3dc83c){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x3dc83c);_0x4ca293(_0x3dc83c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index e974ee0..d08f5d0 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(_0x5b2d32,_0x490905){var _0x100447=function(_0x5d2443){while(--_0x5d2443){_0x5b2d32['push'](_0x5b2d32['shift']());}};_0x100447(++_0x490905);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x137ea4,_0x99e607){var _0x2197ea=function(_0x557fa4){while(--_0x557fa4){_0x137ea4['push'](_0x137ea4['shift']());}};_0x2197ea(++_0x99e607);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index c6c4548..caf40a3 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 _0x5a1b=['integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0xd344ef,_0x132b5f){var _0x50a171=function(_0x1f7059){while(--_0x1f7059){_0xd344ef['push'](_0xd344ef['shift']());}};_0x50a171(++_0x132b5f);}(_0x5a1b,0xe6));var _0xb5a1=function(_0x65d877,_0x16dcd2){_0x65d877=_0x65d877-0x0;var _0x2e129c=_0x5a1b[_0x65d877];return _0x2e129c;};'use strict';var Sequelize=require(_0xb5a1('0x0'));module[_0xb5a1('0x1')]={'name':{'type':Sequelize[_0xb5a1('0x2')]},'description':{'type':Sequelize[_0xb5a1('0x2')]},'username':{'type':Sequelize[_0xb5a1('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xb5a1('0x2')]},'password':{'type':Sequelize[_0xb5a1('0x2')]},'clientId':{'type':Sequelize[_0xb5a1('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xb5a1('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb5a1('0x3')](_0xb5a1('0x4'),_0xb5a1('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x056b=['integrationTab','newTab','exports','STRING','username'];(function(_0x10dcbe,_0x30d60d){var _0x294e6b=function(_0x5ff33b){while(--_0x5ff33b){_0x10dcbe['push'](_0x10dcbe['shift']());}};_0x294e6b(++_0x30d60d);}(_0x056b,0xb6));var _0xb056=function(_0x1144b9,_0x58585e){_0x1144b9=_0x1144b9-0x0;var _0x58552c=_0x056b[_0x1144b9];return _0x58552c;};'use strict';var Sequelize=require('sequelize');module[_0xb056('0x0')]={'name':{'type':Sequelize[_0xb056('0x1')]},'description':{'type':Sequelize[_0xb056('0x1')]},'username':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x2')},'remoteUri':{'type':Sequelize[_0xb056('0x1')]},'password':{'type':Sequelize[_0xb056('0x1')]},'clientId':{'type':Sequelize[_0xb056('0x1')]},'clientSecret':{'type':Sequelize[_0xb056('0x1')]},'securityToken':{'type':Sequelize[_0xb056('0x1')]},'serverUrl':{'type':Sequelize[_0xb056('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb056('0x3'),_0xb056('0x4')),'defaultValue':_0xb056('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 7ddb889..27a0dfb 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 _0x2c8f=['getDescriptions','channel','SalesforceConfiguration','create','SalesforceField','Subjects','getFields','Task','clientSecret','username','password','remoteUri','slice','substring','lastIndexOf','Connection','clientId','login','concat','securityToken','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','int','boolean','email','textarea','phone','remove','includes','picklistValues','value','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','limit','count','Content-Range','apply','update','then','sendStatus','error','stack','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','body','destroy','getConfigurations','merge','findOne','AccountId','getSubjects','Descriptions'];(function(_0x50dd66,_0x31884a){var _0x4bc63d=function(_0x2d9bb2){while(--_0x2d9bb2){_0x50dd66['push'](_0x50dd66['shift']());}};_0x4bc63d(++_0x31884a);}(_0x2c8f,0x132));var _0xf2c8=function(_0x851a89,_0x3edb77){_0x851a89=_0x851a89-0x0;var _0x8f1ddc=_0x2c8f[_0x851a89];return _0x8f1ddc;};'use strict';var emlformat=require(_0xf2c8('0x0'));var rimraf=require(_0xf2c8('0x1'));var zipdir=require(_0xf2c8('0x2'));var jsonpatch=require(_0xf2c8('0x3'));var rp=require(_0xf2c8('0x4'));var moment=require(_0xf2c8('0x5'));var BPromise=require(_0xf2c8('0x6'));var Mustache=require(_0xf2c8('0x7'));var util=require(_0xf2c8('0x8'));var path=require(_0xf2c8('0x9'));var sox=require(_0xf2c8('0xa'));var csv=require(_0xf2c8('0xb'));var ejs=require(_0xf2c8('0xc'));var fs=require('fs');var fs_extra=require(_0xf2c8('0xd'));var _=require(_0xf2c8('0xe'));var squel=require(_0xf2c8('0xf'));var crypto=require(_0xf2c8('0x10'));var jsforce=require(_0xf2c8('0x11'));var deskjs=require(_0xf2c8('0x12'));var toCsv=require(_0xf2c8('0xb'));var querystring=require(_0xf2c8('0x13'));var Papa=require(_0xf2c8('0x14'));var Redis=require(_0xf2c8('0x15'));var authService=require(_0xf2c8('0x16'));var qs=require(_0xf2c8('0x17'));var as=require(_0xf2c8('0x18'));var hardwareService=require(_0xf2c8('0x19'));var logger=require(_0xf2c8('0x1a'))(_0xf2c8('0x1b'));var utils=require('../../config/utils');var config=require(_0xf2c8('0x1c'));var licenseUtil=require(_0xf2c8('0x1d'));var db=require(_0xf2c8('0x1e'))['db'];var integrations=require(_0xf2c8('0x1f'));function respondWithStatusCode(_0x155406,_0x1d5acd){_0x1d5acd=_0x1d5acd||0xcc;return function(_0x43d378){if(_0x43d378){return _0x155406['sendStatus'](_0x1d5acd);}return _0x155406['status'](_0x1d5acd)[_0xf2c8('0x20')]();};}function respondWithResult(_0x2e0862,_0x21fc17){_0x21fc17=_0x21fc17||0xc8;return function(_0x7e5c35){if(_0x7e5c35){return _0x2e0862[_0xf2c8('0x21')](_0x21fc17)['json'](_0x7e5c35);}};}function respondWithFilteredResult(_0x2c1e26,_0x11cf0c){return function(_0x210959){if(_0x210959){var _0x52589c=typeof _0x11cf0c[_0xf2c8('0x22')]===_0xf2c8('0x23')&&typeof _0x11cf0c[_0xf2c8('0x24')]===_0xf2c8('0x23');var _0x5cc99d=_0x210959[_0xf2c8('0x25')];var _0x9c1ad8=_0x52589c?0x0:_0x11cf0c['offset'];var _0x41f944=_0x52589c?_0x210959['count']:_0x11cf0c[_0xf2c8('0x22')]+_0x11cf0c[_0xf2c8('0x24')];var _0x1f1654;if(_0x41f944>=_0x5cc99d){_0x41f944=_0x5cc99d;_0x1f1654=0xc8;}else{_0x1f1654=0xce;}_0x2c1e26[_0xf2c8('0x21')](_0x1f1654);return _0x2c1e26['set'](_0xf2c8('0x26'),_0x9c1ad8+'-'+_0x41f944+'/'+_0x5cc99d)['json'](_0x210959);}return null;};}function patchUpdates(_0xb99464){return function(_0x5df3f1){try{jsonpatch[_0xf2c8('0x27')](_0x5df3f1,_0xb99464,!![]);}catch(_0x1a590b){return BPromise['reject'](_0x1a590b);}return _0x5df3f1['save']();};}function saveUpdates(_0xf8df,_0x4c0eb4){return function(_0x26b6fe){if(_0x26b6fe){return _0x26b6fe[_0xf2c8('0x28')](_0xf8df)[_0xf2c8('0x29')](function(_0x17bc3d){return _0x17bc3d;});}return null;};}function removeEntity(_0x6b41e8,_0x3b8fca){return function(_0x3f0277){if(_0x3f0277){return _0x3f0277['destroy']()[_0xf2c8('0x29')](function(){_0x6b41e8[_0xf2c8('0x21')](0xcc)[_0xf2c8('0x20')]();});}};}function handleEntityNotFound(_0x252590,_0x2512c4){return function(_0x3aee66){if(!_0x3aee66){_0x252590[_0xf2c8('0x2a')](0x194);}return _0x3aee66;};}function handleError(_0x1e0166,_0x2bee2b){_0x2bee2b=_0x2bee2b||0x1f4;return function(_0x2edaf9){logger[_0xf2c8('0x2b')](_0x2edaf9[_0xf2c8('0x2c')]);if(_0x2edaf9[_0xf2c8('0x2d')]){delete _0x2edaf9[_0xf2c8('0x2d')];}_0x1e0166[_0xf2c8('0x21')](_0x2bee2b)[_0xf2c8('0x2e')](_0x2edaf9);};}exports['index']=function(_0x3db94a,_0x5ebd98){var _0x225f7e={},_0x2e99c8={},_0x4f4aae={'count':0x0,'rows':[]};var _0x2feefd=_[_0xf2c8('0x2f')](db[_0xf2c8('0x30')][_0xf2c8('0x31')],function(_0x1a5f99){return{'name':_0x1a5f99[_0xf2c8('0x32')],'type':_0x1a5f99[_0xf2c8('0x33')][_0xf2c8('0x34')]};});_0x2e99c8[_0xf2c8('0x35')]=_['map'](_0x2feefd,_0xf2c8('0x2d'));_0x2e99c8[_0xf2c8('0x36')]=_[_0xf2c8('0x37')](_0x3db94a['query']);_0x2e99c8[_0xf2c8('0x38')]=_[_0xf2c8('0x39')](_0x2e99c8['model'],_0x2e99c8[_0xf2c8('0x36')]);_0x225f7e['attributes']=_[_0xf2c8('0x39')](_0x2e99c8[_0xf2c8('0x35')],qs[_0xf2c8('0x3a')](_0x3db94a['query']['fields']));_0x225f7e[_0xf2c8('0x3b')]=_0x225f7e['attributes']['length']?_0x225f7e[_0xf2c8('0x3b')]:_0x2e99c8[_0xf2c8('0x35')];if(!_0x3db94a['query'][_0xf2c8('0x3c')](_0xf2c8('0x3d'))){_0x225f7e[_0xf2c8('0x24')]=qs[_0xf2c8('0x24')](_0x3db94a[_0xf2c8('0x36')][_0xf2c8('0x24')]);_0x225f7e['offset']=qs['offset'](_0x3db94a['query'][_0xf2c8('0x22')]);}_0x225f7e[_0xf2c8('0x3e')]=qs['sort'](_0x3db94a['query'][_0xf2c8('0x3f')]);_0x225f7e[_0xf2c8('0x40')]=qs[_0xf2c8('0x38')](_['pick'](_0x3db94a['query'],_0x2e99c8['filters']),_0x2feefd);if(_0x3db94a[_0xf2c8('0x36')][_0xf2c8('0x41')]){_0x225f7e[_0xf2c8('0x40')]=_['merge'](_0x225f7e[_0xf2c8('0x40')],{'$or':_[_0xf2c8('0x2f')](_0x2feefd,function(_0x9c0b05){if(_0x9c0b05[_0xf2c8('0x33')]!==_0xf2c8('0x42')){var _0x428720={};_0x428720[_0x9c0b05[_0xf2c8('0x2d')]]={'$like':'%'+_0x3db94a[_0xf2c8('0x36')][_0xf2c8('0x41')]+'%'};return _0x428720;}})});}_0x225f7e=_['merge']({},_0x225f7e,_0x3db94a[_0xf2c8('0x43')]);var _0x33cd0c={'where':_0x225f7e[_0xf2c8('0x40')]};return db[_0xf2c8('0x30')][_0xf2c8('0x25')](_0x33cd0c)[_0xf2c8('0x29')](function(_0x38f4cb){_0x4f4aae[_0xf2c8('0x25')]=_0x38f4cb;if(_0x3db94a['query'][_0xf2c8('0x44')]){_0x225f7e[_0xf2c8('0x45')]=[{'all':!![]}];}return db[_0xf2c8('0x30')][_0xf2c8('0x46')](_0x225f7e);})[_0xf2c8('0x29')](function(_0x245239){_0x4f4aae[_0xf2c8('0x47')]=_0x245239;return _0x4f4aae;})[_0xf2c8('0x29')](respondWithFilteredResult(_0x5ebd98,_0x225f7e))[_0xf2c8('0x48')](handleError(_0x5ebd98,null));};exports['show']=function(_0x46009a,_0xe04ec8){var _0x58a274={'raw':![],'where':{'id':_0x46009a[_0xf2c8('0x49')]['id']}},_0x3789a4={};_0x3789a4[_0xf2c8('0x35')]=_[_0xf2c8('0x37')](db[_0xf2c8('0x30')]['rawAttributes']);_0x3789a4['query']=_['keys'](_0x46009a['query']);_0x3789a4[_0xf2c8('0x38')]=_[_0xf2c8('0x39')](_0x3789a4['model'],_0x3789a4[_0xf2c8('0x36')]);_0x58a274['attributes']=_[_0xf2c8('0x39')](_0x3789a4[_0xf2c8('0x35')],qs['fields'](_0x46009a[_0xf2c8('0x36')]['fields']));_0x58a274[_0xf2c8('0x3b')]=_0x58a274[_0xf2c8('0x3b')][_0xf2c8('0x4a')]?_0x58a274['attributes']:_0x3789a4['model'];if(_0x46009a[_0xf2c8('0x36')][_0xf2c8('0x44')]){_0x58a274[_0xf2c8('0x45')]=[{'all':!![]}];}_0x58a274=_['merge']({},_0x58a274,_0x46009a[_0xf2c8('0x43')]);return db[_0xf2c8('0x30')][_0xf2c8('0x4b')](_0x58a274)[_0xf2c8('0x29')](handleEntityNotFound(_0xe04ec8,null))[_0xf2c8('0x29')](respondWithResult(_0xe04ec8,null))['catch'](handleError(_0xe04ec8,null));};exports['create']=function(_0x125627,_0x2ddb43){return db[_0xf2c8('0x30')]['create'](_0x125627[_0xf2c8('0x4c')],{})['then'](respondWithResult(_0x2ddb43,0xc9))[_0xf2c8('0x48')](handleError(_0x2ddb43,null));};exports[_0xf2c8('0x28')]=function(_0x4cbb13,_0x4ba14b){if(_0x4cbb13[_0xf2c8('0x4c')]['id']){delete _0x4cbb13['body']['id'];}return db[_0xf2c8('0x30')]['find']({'where':{'id':_0x4cbb13['params']['id']}})[_0xf2c8('0x29')](handleEntityNotFound(_0x4ba14b,null))[_0xf2c8('0x29')](saveUpdates(_0x4cbb13[_0xf2c8('0x4c')],null))[_0xf2c8('0x29')](respondWithResult(_0x4ba14b,null))[_0xf2c8('0x48')](handleError(_0x4ba14b,null));};exports[_0xf2c8('0x4d')]=function(_0x3d4403,_0x1a11ee){return db[_0xf2c8('0x30')]['find']({'where':{'id':_0x3d4403['params']['id']}})['then'](handleEntityNotFound(_0x1a11ee,null))[_0xf2c8('0x29')](removeEntity(_0x1a11ee,null))['catch'](handleError(_0x1a11ee,null));};exports[_0xf2c8('0x4e')]=function(_0x27e23e,_0x344426,_0x50ed89){var _0x1a9bc0={};var _0x3c1bb5={};var _0xf9b9ea;var _0x486c47;return db[_0xf2c8('0x30')]['findOne']({'where':{'id':_0x27e23e[_0xf2c8('0x49')]['id']}})[_0xf2c8('0x29')](handleEntityNotFound(_0x344426,null))[_0xf2c8('0x29')](function(_0x782a49){if(_0x782a49){_0xf9b9ea=_0x782a49;_0x3c1bb5['model']=_[_0xf2c8('0x37')](db['SalesforceConfiguration'][_0xf2c8('0x31')]);_0x3c1bb5[_0xf2c8('0x36')]=_[_0xf2c8('0x37')](_0x27e23e[_0xf2c8('0x36')]);_0x3c1bb5[_0xf2c8('0x38')]=_[_0xf2c8('0x39')](_0x3c1bb5[_0xf2c8('0x35')],_0x3c1bb5[_0xf2c8('0x36')]);_0x1a9bc0['attributes']=_[_0xf2c8('0x39')](_0x3c1bb5[_0xf2c8('0x35')],qs[_0xf2c8('0x3a')](_0x27e23e[_0xf2c8('0x36')][_0xf2c8('0x3a')]));_0x1a9bc0[_0xf2c8('0x3b')]=_0x1a9bc0[_0xf2c8('0x3b')][_0xf2c8('0x4a')]?_0x1a9bc0['attributes']:_0x3c1bb5['model'];_0x1a9bc0['order']=qs['sort'](_0x27e23e[_0xf2c8('0x36')][_0xf2c8('0x3f')]);_0x1a9bc0[_0xf2c8('0x40')]=qs[_0xf2c8('0x38')](_['pick'](_0x27e23e[_0xf2c8('0x36')],_0x3c1bb5[_0xf2c8('0x38')]));if(_0x27e23e['query'][_0xf2c8('0x41')]){_0x1a9bc0[_0xf2c8('0x40')]=_['merge'](_0x1a9bc0['where'],{'$or':_[_0xf2c8('0x2f')](_0x1a9bc0[_0xf2c8('0x3b')],function(_0x119c8e){var _0x11639d={};_0x11639d[_0x119c8e]={'$like':'%'+_0x27e23e['query'][_0xf2c8('0x41')]+'%'};return _0x11639d;})});}_0x1a9bc0=_[_0xf2c8('0x4f')]({},_0x1a9bc0,_0x27e23e[_0xf2c8('0x43')]);return _0xf9b9ea[_0xf2c8('0x4e')](_0x1a9bc0);}})[_0xf2c8('0x29')](function(_0x1e9f13){if(_0x1e9f13){_0x486c47=_0x1e9f13[_0xf2c8('0x4a')];if(!_0x27e23e[_0xf2c8('0x36')][_0xf2c8('0x3c')](_0xf2c8('0x3d'))){_0x1a9bc0[_0xf2c8('0x24')]=qs[_0xf2c8('0x24')](_0x27e23e[_0xf2c8('0x36')]['limit']);_0x1a9bc0[_0xf2c8('0x22')]=qs[_0xf2c8('0x22')](_0x27e23e[_0xf2c8('0x36')][_0xf2c8('0x22')]);}return _0xf9b9ea[_0xf2c8('0x4e')](_0x1a9bc0);}})[_0xf2c8('0x29')](function(_0x58e6ab){if(_0x58e6ab){return _0x58e6ab?{'count':_0x486c47,'rows':_0x58e6ab}:null;}})[_0xf2c8('0x29')](respondWithResult(_0x344426,null))[_0xf2c8('0x48')](handleError(_0x344426,null));};exports['addConfiguration']=function(_0x5c9345,_0x58fbac,_0x40b2ef){if(_0x5c9345[_0xf2c8('0x4c')]['id']){delete _0x5c9345[_0xf2c8('0x4c')]['id'];}return db['SalesforceAccount'][_0xf2c8('0x50')]({'where':{'id':_0x5c9345[_0xf2c8('0x49')]['id']}})[_0xf2c8('0x29')](handleEntityNotFound(_0x58fbac,null))[_0xf2c8('0x29')](function(_0x30af60){if(_0x30af60){_0x5c9345[_0xf2c8('0x4c')][_0xf2c8('0x51')]=_0x30af60['id'];_0x5c9345[_0xf2c8('0x4c')]['Subjects']=integrations[_0xf2c8('0x52')](_0x5c9345['body']['channel'],_0x5c9345[_0xf2c8('0x4c')][_0xf2c8('0x33')]);_0x5c9345[_0xf2c8('0x4c')][_0xf2c8('0x53')]=integrations[_0xf2c8('0x54')](_0x5c9345[_0xf2c8('0x4c')][_0xf2c8('0x55')],_0x5c9345[_0xf2c8('0x4c')][_0xf2c8('0x33')]);return db[_0xf2c8('0x56')][_0xf2c8('0x57')](_0x5c9345[_0xf2c8('0x4c')],{'include':[{'model':db[_0xf2c8('0x58')],'as':_0xf2c8('0x59')},{'model':db[_0xf2c8('0x58')],'as':'Descriptions'}]});}return null;})[_0xf2c8('0x29')](respondWithResult(_0x58fbac,null))[_0xf2c8('0x48')](handleError(_0x58fbac,null));};exports[_0xf2c8('0x5a')]=function(_0x1ce968,_0x3f192d,_0x7b339){var _0x51efab;var _0x38b7e1='';var _0x49f94d=_0xf2c8('0x5b');return db[_0xf2c8('0x30')][_0xf2c8('0x50')]({'where':{'id':_0x1ce968[_0xf2c8('0x49')]['id']},'attributes':['id','remoteUri','clientId',_0xf2c8('0x5c'),_0xf2c8('0x5d'),_0xf2c8('0x5e'),'securityToken']})[_0xf2c8('0x29')](handleEntityNotFound(_0x3f192d,null))[_0xf2c8('0x29')](function(_0x5132be){if(_0x5132be){_0x38b7e1=_0x5132be[_0xf2c8('0x5f')];var _0x115b4a=_0x38b7e1[_0xf2c8('0x60')](-0x1);if(_0x115b4a==='/'){_0x38b7e1=_0x38b7e1[_0xf2c8('0x61')](0x0,_0x38b7e1[_0xf2c8('0x62')](_0x115b4a));}_0x51efab=new jsforce[(_0xf2c8('0x63'))]({'oauth2':{'loginUrl':_0x38b7e1,'clientId':_0x5132be[_0xf2c8('0x64')],'clientSecret':_0x5132be[_0xf2c8('0x5c')]}});return _0x51efab[_0xf2c8('0x65')](_0x5132be[_0xf2c8('0x5d')],_0x5132be[_0xf2c8('0x5e')][_0xf2c8('0x66')](_0x5132be[_0xf2c8('0x67')]));}})[_0xf2c8('0x29')](function(_0x382220){if(_0x382220){if(!_[_0xf2c8('0x68')](_0x1ce968['query']['ticketType'])){_0x49f94d=_0x1ce968['query'][_0xf2c8('0x69')];}return _0x51efab[_0xf2c8('0x6a')](_0x49f94d)[_0xf2c8('0x6b')]();}})[_0xf2c8('0x29')](function(_0x18b1ac){var _0x480cfa=[_0xf2c8('0x6c'),'ActivityDate',_0xf2c8('0x6d'),_0xf2c8('0x6e'),_0xf2c8('0x6f'),_0xf2c8('0x70')];var _0x4537ec=['string',_0xf2c8('0x71'),'picklist',_0xf2c8('0x72'),_0xf2c8('0x73'),_0xf2c8('0x74'),_0xf2c8('0x75')];if(_0x18b1ac){_[_0xf2c8('0x76')](_0x18b1ac['fields'],function(_0x4053d4){return _0x480cfa[_0xf2c8('0x77')](_0x4053d4[_0xf2c8('0x2d')])||!_0x4537ec[_0xf2c8('0x77')](_0x4053d4[_0xf2c8('0x33')]);});return{'count':_0x18b1ac[_0xf2c8('0x3a')][_0xf2c8('0x4a')],'rows':_[_0xf2c8('0x2f')](_0x18b1ac[_0xf2c8('0x3a')],function(_0x4409ee){return{'id':_0x4409ee[_0xf2c8('0x2d')],'name':_0x4409ee['label'],'custom':_0x4409ee['custom'],'options':_0x4409ee[_0xf2c8('0x78')]['length']>0x0?_['map'](_0x4409ee[_0xf2c8('0x78')],function(_0x4c4037){return{'name':_0x4c4037['label'],'value':_0x4c4037[_0xf2c8('0x79')]};}):_0x4409ee['type']==_0xf2c8('0x72')?[{'name':_0xf2c8('0x7a'),'value':_0xf2c8('0x7b')},{'name':_0xf2c8('0x7c'),'value':'false'}]:[]};})};}})[_0xf2c8('0x29')](respondWithResult(_0x3f192d,null))['catch'](function(_0x5dd2ff){var _0xfce5ed=_0x1ce968[_0xf2c8('0x36')][_0xf2c8('0x7d')]?0x1f4:_0x5dd2ff[_0xf2c8('0x7e')]||0x1f4;logger[_0xf2c8('0x2b')](_0xf2c8('0x7f'),_0xf2c8('0x5a'),_0xfce5ed,JSON[_0xf2c8('0x80')](_0x5dd2ff));delete _0x5dd2ff['name'];if(_0xfce5ed===0x191){_0xfce5ed=0x190;}_0x3f192d[_0xf2c8('0x21')](_0xfce5ed)[_0xf2c8('0x2e')](_0x1ce968[_0xf2c8('0x36')][_0xf2c8('0x7d')]?{'message':_0xf2c8('0x81'),'statusCode':_0x5dd2ff[_0xf2c8('0x7e')]}:_0x5dd2ff);});}; \ No newline at end of file +var _0x60ba=['getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','lastIndexOf','login','username','concat','isNil','ticketType','describe','OwnerId','ActivityDate','Subject','Description','int','picklist','email','textarea','phone','remove','includes','label','custom','picklistValues','value','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','find','destroy','findOne'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x60ba,0x12d));var _0xa60b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x60ba[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa60b('0x0'));var zipdir=require(_0xa60b('0x1'));var jsonpatch=require(_0xa60b('0x2'));var rp=require('request-promise');var moment=require(_0xa60b('0x3'));var BPromise=require(_0xa60b('0x4'));var Mustache=require(_0xa60b('0x5'));var util=require(_0xa60b('0x6'));var path=require(_0xa60b('0x7'));var sox=require(_0xa60b('0x8'));var csv=require(_0xa60b('0x9'));var ejs=require(_0xa60b('0xa'));var fs=require('fs');var fs_extra=require(_0xa60b('0xb'));var _=require(_0xa60b('0xc'));var squel=require(_0xa60b('0xd'));var crypto=require(_0xa60b('0xe'));var jsforce=require(_0xa60b('0xf'));var deskjs=require(_0xa60b('0x10'));var toCsv=require(_0xa60b('0x9'));var querystring=require(_0xa60b('0x11'));var Papa=require(_0xa60b('0x12'));var Redis=require(_0xa60b('0x13'));var authService=require(_0xa60b('0x14'));var qs=require(_0xa60b('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa60b('0x16'));var logger=require(_0xa60b('0x17'))('api');var utils=require(_0xa60b('0x18'));var config=require(_0xa60b('0x19'));var licenseUtil=require(_0xa60b('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa60b('0x1b'));function respondWithStatusCode(_0x5b869b,_0x4066ad){_0x4066ad=_0x4066ad||0xcc;return function(_0x1b274d){if(_0x1b274d){return _0x5b869b[_0xa60b('0x1c')](_0x4066ad);}return _0x5b869b[_0xa60b('0x1d')](_0x4066ad)['end']();};}function respondWithResult(_0xf23dca,_0x4b06dd){_0x4b06dd=_0x4b06dd||0xc8;return function(_0x3c97c4){if(_0x3c97c4){return _0xf23dca[_0xa60b('0x1d')](_0x4b06dd)[_0xa60b('0x1e')](_0x3c97c4);}};}function respondWithFilteredResult(_0x485a34,_0x3863e0){return function(_0x147565){if(_0x147565){var _0x139ddf=typeof _0x3863e0[_0xa60b('0x1f')]==='undefined'&&typeof _0x3863e0[_0xa60b('0x20')]==='undefined';var _0x988df8=_0x147565[_0xa60b('0x21')];var _0x54428b=_0x139ddf?0x0:_0x3863e0[_0xa60b('0x1f')];var _0x526dfe=_0x139ddf?_0x147565[_0xa60b('0x21')]:_0x3863e0[_0xa60b('0x1f')]+_0x3863e0[_0xa60b('0x20')];var _0x19d89e;if(_0x526dfe>=_0x988df8){_0x526dfe=_0x988df8;_0x19d89e=0xc8;}else{_0x19d89e=0xce;}_0x485a34['status'](_0x19d89e);return _0x485a34[_0xa60b('0x22')](_0xa60b('0x23'),_0x54428b+'-'+_0x526dfe+'/'+_0x988df8)[_0xa60b('0x1e')](_0x147565);}return null;};}function patchUpdates(_0x2a5733){return function(_0x574015){try{jsonpatch[_0xa60b('0x24')](_0x574015,_0x2a5733,!![]);}catch(_0x19843a){return BPromise[_0xa60b('0x25')](_0x19843a);}return _0x574015[_0xa60b('0x26')]();};}function saveUpdates(_0x562711,_0x8d72d1){return function(_0x11c8b6){if(_0x11c8b6){return _0x11c8b6[_0xa60b('0x27')](_0x562711)['then'](function(_0x1337b2){return _0x1337b2;});}return null;};}function removeEntity(_0xb63af9,_0x299f98){return function(_0x403376){if(_0x403376){return _0x403376['destroy']()[_0xa60b('0x28')](function(){_0xb63af9[_0xa60b('0x1d')](0xcc)[_0xa60b('0x29')]();});}};}function handleEntityNotFound(_0x592c83,_0x41fe41){return function(_0x34c532){if(!_0x34c532){_0x592c83[_0xa60b('0x1c')](0x194);}return _0x34c532;};}function handleError(_0x54f14f,_0x52011d){_0x52011d=_0x52011d||0x1f4;return function(_0x532dd3){logger[_0xa60b('0x2a')](_0x532dd3[_0xa60b('0x2b')]);if(_0x532dd3[_0xa60b('0x2c')]){delete _0x532dd3[_0xa60b('0x2c')];}_0x54f14f['status'](_0x52011d)[_0xa60b('0x2d')](_0x532dd3);};}exports[_0xa60b('0x2e')]=function(_0x25ca3c,_0x545265){var _0x488233={},_0x550b0b={},_0x5e15bf={'count':0x0,'rows':[]};var _0x3045f4=_[_0xa60b('0x2f')](db[_0xa60b('0x30')][_0xa60b('0x31')],function(_0x39a1bf){return{'name':_0x39a1bf[_0xa60b('0x32')],'type':_0x39a1bf['type']['key']};});_0x550b0b[_0xa60b('0x33')]=_['map'](_0x3045f4,'name');_0x550b0b[_0xa60b('0x34')]=_[_0xa60b('0x35')](_0x25ca3c[_0xa60b('0x34')]);_0x550b0b[_0xa60b('0x36')]=_[_0xa60b('0x37')](_0x550b0b[_0xa60b('0x33')],_0x550b0b[_0xa60b('0x34')]);_0x488233[_0xa60b('0x38')]=_[_0xa60b('0x37')](_0x550b0b[_0xa60b('0x33')],qs[_0xa60b('0x39')](_0x25ca3c[_0xa60b('0x34')][_0xa60b('0x39')]));_0x488233[_0xa60b('0x38')]=_0x488233[_0xa60b('0x38')][_0xa60b('0x3a')]?_0x488233['attributes']:_0x550b0b[_0xa60b('0x33')];if(!_0x25ca3c[_0xa60b('0x34')][_0xa60b('0x3b')](_0xa60b('0x3c'))){_0x488233[_0xa60b('0x20')]=qs[_0xa60b('0x20')](_0x25ca3c[_0xa60b('0x34')][_0xa60b('0x20')]);_0x488233[_0xa60b('0x1f')]=qs[_0xa60b('0x1f')](_0x25ca3c[_0xa60b('0x34')][_0xa60b('0x1f')]);}_0x488233[_0xa60b('0x3d')]=qs[_0xa60b('0x3e')](_0x25ca3c[_0xa60b('0x34')][_0xa60b('0x3e')]);_0x488233[_0xa60b('0x3f')]=qs['filters'](_[_0xa60b('0x40')](_0x25ca3c['query'],_0x550b0b[_0xa60b('0x36')]),_0x3045f4);if(_0x25ca3c[_0xa60b('0x34')][_0xa60b('0x41')]){_0x488233[_0xa60b('0x3f')]=_[_0xa60b('0x42')](_0x488233[_0xa60b('0x3f')],{'$or':_[_0xa60b('0x2f')](_0x3045f4,function(_0x370da5){if(_0x370da5[_0xa60b('0x43')]!==_0xa60b('0x44')){var _0x46dc3d={};_0x46dc3d[_0x370da5['name']]={'$like':'%'+_0x25ca3c['query'][_0xa60b('0x41')]+'%'};return _0x46dc3d;}})});}_0x488233=_[_0xa60b('0x42')]({},_0x488233,_0x25ca3c[_0xa60b('0x45')]);var _0x3dcba4={'where':_0x488233[_0xa60b('0x3f')]};return db[_0xa60b('0x30')]['count'](_0x3dcba4)['then'](function(_0x3dc9d6){_0x5e15bf[_0xa60b('0x21')]=_0x3dc9d6;if(_0x25ca3c[_0xa60b('0x34')][_0xa60b('0x46')]){_0x488233[_0xa60b('0x47')]=[{'all':!![]}];}return db[_0xa60b('0x30')][_0xa60b('0x48')](_0x488233);})[_0xa60b('0x28')](function(_0x365d2e){_0x5e15bf['rows']=_0x365d2e;return _0x5e15bf;})[_0xa60b('0x28')](respondWithFilteredResult(_0x545265,_0x488233))[_0xa60b('0x49')](handleError(_0x545265,null));};exports['show']=function(_0x50f3bf,_0x1f97af){var _0x40a33d={'raw':![],'where':{'id':_0x50f3bf[_0xa60b('0x4a')]['id']}},_0x3e8d4d={};_0x3e8d4d['model']=_[_0xa60b('0x35')](db[_0xa60b('0x30')]['rawAttributes']);_0x3e8d4d[_0xa60b('0x34')]=_[_0xa60b('0x35')](_0x50f3bf[_0xa60b('0x34')]);_0x3e8d4d['filters']=_[_0xa60b('0x37')](_0x3e8d4d[_0xa60b('0x33')],_0x3e8d4d[_0xa60b('0x34')]);_0x40a33d[_0xa60b('0x38')]=_[_0xa60b('0x37')](_0x3e8d4d[_0xa60b('0x33')],qs[_0xa60b('0x39')](_0x50f3bf[_0xa60b('0x34')][_0xa60b('0x39')]));_0x40a33d[_0xa60b('0x38')]=_0x40a33d['attributes'][_0xa60b('0x3a')]?_0x40a33d[_0xa60b('0x38')]:_0x3e8d4d[_0xa60b('0x33')];if(_0x50f3bf[_0xa60b('0x34')][_0xa60b('0x46')]){_0x40a33d['include']=[{'all':!![]}];}_0x40a33d=_['merge']({},_0x40a33d,_0x50f3bf[_0xa60b('0x45')]);return db[_0xa60b('0x30')]['find'](_0x40a33d)[_0xa60b('0x28')](handleEntityNotFound(_0x1f97af,null))['then'](respondWithResult(_0x1f97af,null))[_0xa60b('0x49')](handleError(_0x1f97af,null));};exports['create']=function(_0x2a3eed,_0x3a3a23){return db[_0xa60b('0x30')][_0xa60b('0x4b')](_0x2a3eed[_0xa60b('0x4c')],{})['then'](respondWithResult(_0x3a3a23,0xc9))[_0xa60b('0x49')](handleError(_0x3a3a23,null));};exports[_0xa60b('0x27')]=function(_0xa4b0b8,_0x5be0fa){if(_0xa4b0b8['body']['id']){delete _0xa4b0b8[_0xa60b('0x4c')]['id'];}return db['SalesforceAccount'][_0xa60b('0x4d')]({'where':{'id':_0xa4b0b8[_0xa60b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5be0fa,null))['then'](saveUpdates(_0xa4b0b8[_0xa60b('0x4c')],null))['then'](respondWithResult(_0x5be0fa,null))[_0xa60b('0x49')](handleError(_0x5be0fa,null));};exports[_0xa60b('0x4e')]=function(_0x2a956b,_0x51d7d8){return db['SalesforceAccount']['find']({'where':{'id':_0x2a956b[_0xa60b('0x4a')]['id']}})[_0xa60b('0x28')](handleEntityNotFound(_0x51d7d8,null))[_0xa60b('0x28')](removeEntity(_0x51d7d8,null))[_0xa60b('0x49')](handleError(_0x51d7d8,null));};exports['getConfigurations']=function(_0x5d1abf,_0x5676b5,_0x1a25f1){var _0x69987a={};var _0x177332={};var _0x235437;var _0x5a9a79;return db[_0xa60b('0x30')][_0xa60b('0x4f')]({'where':{'id':_0x5d1abf[_0xa60b('0x4a')]['id']}})[_0xa60b('0x28')](handleEntityNotFound(_0x5676b5,null))[_0xa60b('0x28')](function(_0x163f89){if(_0x163f89){_0x235437=_0x163f89;_0x177332[_0xa60b('0x33')]=_[_0xa60b('0x35')](db['SalesforceConfiguration']['rawAttributes']);_0x177332[_0xa60b('0x34')]=_['keys'](_0x5d1abf['query']);_0x177332[_0xa60b('0x36')]=_['intersection'](_0x177332[_0xa60b('0x33')],_0x177332[_0xa60b('0x34')]);_0x69987a['attributes']=_[_0xa60b('0x37')](_0x177332[_0xa60b('0x33')],qs[_0xa60b('0x39')](_0x5d1abf['query'][_0xa60b('0x39')]));_0x69987a['attributes']=_0x69987a[_0xa60b('0x38')][_0xa60b('0x3a')]?_0x69987a['attributes']:_0x177332[_0xa60b('0x33')];_0x69987a[_0xa60b('0x3d')]=qs[_0xa60b('0x3e')](_0x5d1abf[_0xa60b('0x34')]['sort']);_0x69987a[_0xa60b('0x3f')]=qs[_0xa60b('0x36')](_[_0xa60b('0x40')](_0x5d1abf[_0xa60b('0x34')],_0x177332['filters']));if(_0x5d1abf[_0xa60b('0x34')][_0xa60b('0x41')]){_0x69987a[_0xa60b('0x3f')]=_['merge'](_0x69987a['where'],{'$or':_[_0xa60b('0x2f')](_0x69987a[_0xa60b('0x38')],function(_0x149c9e){var _0x5185e0={};_0x5185e0[_0x149c9e]={'$like':'%'+_0x5d1abf['query'][_0xa60b('0x41')]+'%'};return _0x5185e0;})});}_0x69987a=_['merge']({},_0x69987a,_0x5d1abf[_0xa60b('0x45')]);return _0x235437[_0xa60b('0x50')](_0x69987a);}})[_0xa60b('0x28')](function(_0x118104){if(_0x118104){_0x5a9a79=_0x118104['length'];if(!_0x5d1abf[_0xa60b('0x34')][_0xa60b('0x3b')](_0xa60b('0x3c'))){_0x69987a['limit']=qs['limit'](_0x5d1abf[_0xa60b('0x34')][_0xa60b('0x20')]);_0x69987a[_0xa60b('0x1f')]=qs[_0xa60b('0x1f')](_0x5d1abf['query'][_0xa60b('0x1f')]);}return _0x235437['getConfigurations'](_0x69987a);}})[_0xa60b('0x28')](function(_0x346d3c){if(_0x346d3c){return _0x346d3c?{'count':_0x5a9a79,'rows':_0x346d3c}:null;}})[_0xa60b('0x28')](respondWithResult(_0x5676b5,null))[_0xa60b('0x49')](handleError(_0x5676b5,null));};exports[_0xa60b('0x51')]=function(_0x48ea19,_0x33d4b2,_0x2d58cb){if(_0x48ea19['body']['id']){delete _0x48ea19[_0xa60b('0x4c')]['id'];}return db[_0xa60b('0x30')][_0xa60b('0x4f')]({'where':{'id':_0x48ea19[_0xa60b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x33d4b2,null))[_0xa60b('0x28')](function(_0x335f21){if(_0x335f21){_0x48ea19['body'][_0xa60b('0x52')]=_0x335f21['id'];_0x48ea19['body'][_0xa60b('0x53')]=integrations[_0xa60b('0x54')](_0x48ea19[_0xa60b('0x4c')][_0xa60b('0x55')],_0x48ea19['body'][_0xa60b('0x43')]);_0x48ea19[_0xa60b('0x4c')][_0xa60b('0x56')]=integrations['getDescriptions'](_0x48ea19[_0xa60b('0x4c')][_0xa60b('0x55')],_0x48ea19[_0xa60b('0x4c')][_0xa60b('0x43')]);return db[_0xa60b('0x57')][_0xa60b('0x4b')](_0x48ea19[_0xa60b('0x4c')],{'include':[{'model':db[_0xa60b('0x58')],'as':_0xa60b('0x53')},{'model':db['SalesforceField'],'as':_0xa60b('0x56')}]});}return null;})[_0xa60b('0x28')](respondWithResult(_0x33d4b2,null))['catch'](handleError(_0x33d4b2,null));};exports[_0xa60b('0x59')]=function(_0x4327d6,_0x536138,_0x479588){var _0x48f556;var _0x57c640='';var _0x20cc08=_0xa60b('0x5a');return db[_0xa60b('0x30')][_0xa60b('0x4f')]({'where':{'id':_0x4327d6[_0xa60b('0x4a')]['id']},'attributes':['id',_0xa60b('0x5b'),_0xa60b('0x5c'),_0xa60b('0x5d'),'username',_0xa60b('0x5e'),_0xa60b('0x5f')]})[_0xa60b('0x28')](handleEntityNotFound(_0x536138,null))['then'](function(_0x1d92c6){if(_0x1d92c6){_0x57c640=_0x1d92c6['remoteUri'];var _0x143864=_0x57c640[_0xa60b('0x60')](-0x1);if(_0x143864==='/'){_0x57c640=_0x57c640[_0xa60b('0x61')](0x0,_0x57c640[_0xa60b('0x62')](_0x143864));}_0x48f556=new jsforce['Connection']({'oauth2':{'loginUrl':_0x57c640,'clientId':_0x1d92c6[_0xa60b('0x5c')],'clientSecret':_0x1d92c6[_0xa60b('0x5d')]}});return _0x48f556[_0xa60b('0x63')](_0x1d92c6[_0xa60b('0x64')],_0x1d92c6['password'][_0xa60b('0x65')](_0x1d92c6[_0xa60b('0x5f')]));}})[_0xa60b('0x28')](function(_0x48f2bd){if(_0x48f2bd){if(!_[_0xa60b('0x66')](_0x4327d6['query'][_0xa60b('0x67')])){_0x20cc08=_0x4327d6[_0xa60b('0x34')]['ticketType'];}return _0x48f556['sobject'](_0x20cc08)[_0xa60b('0x68')]();}})['then'](function(_0x59344d){var _0x30a856=[_0xa60b('0x69'),_0xa60b('0x6a'),'IsReminderSet','IsRecurrence',_0xa60b('0x6b'),_0xa60b('0x6c')];var _0x20e54e=['string',_0xa60b('0x6d'),_0xa60b('0x6e'),'boolean',_0xa60b('0x6f'),_0xa60b('0x70'),_0xa60b('0x71')];if(_0x59344d){_[_0xa60b('0x72')](_0x59344d[_0xa60b('0x39')],function(_0xb5fc18){return _0x30a856[_0xa60b('0x73')](_0xb5fc18[_0xa60b('0x2c')])||!_0x20e54e[_0xa60b('0x73')](_0xb5fc18[_0xa60b('0x43')]);});return{'count':_0x59344d[_0xa60b('0x39')][_0xa60b('0x3a')],'rows':_[_0xa60b('0x2f')](_0x59344d[_0xa60b('0x39')],function(_0x14a14c){return{'id':_0x14a14c[_0xa60b('0x2c')],'name':_0x14a14c[_0xa60b('0x74')],'custom':_0x14a14c[_0xa60b('0x75')],'options':_0x14a14c[_0xa60b('0x76')][_0xa60b('0x3a')]>0x0?_[_0xa60b('0x2f')](_0x14a14c[_0xa60b('0x76')],function(_0x9b0ed2){return{'name':_0x9b0ed2[_0xa60b('0x74')],'value':_0x9b0ed2[_0xa60b('0x77')]};}):_0x14a14c[_0xa60b('0x43')]=='boolean'?[{'name':'True','value':'true'},{'name':_0xa60b('0x78'),'value':_0xa60b('0x79')}]:[]};})};}})['then'](respondWithResult(_0x536138,null))[_0xa60b('0x49')](function(_0x3e75cd){var _0x1945cf=_0x4327d6[_0xa60b('0x34')][_0xa60b('0x7a')]?0x1f4:_0x3e75cd[_0xa60b('0x7b')]||0x1f4;logger[_0xa60b('0x2a')](_0xa60b('0x7c'),_0xa60b('0x59'),_0x1945cf,JSON[_0xa60b('0x7d')](_0x3e75cd));delete _0x3e75cd['name'];if(_0x1945cf===0x191){_0x1945cf=0x190;}_0x536138[_0xa60b('0x1d')](_0x1945cf)[_0xa60b('0x2d')](_0x4327d6[_0xa60b('0x34')]['test']?{'message':_0xa60b('0x7e'),'statusCode':_0x3e75cd[_0xa60b('0x7b')]}:_0x3e75cd);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 78a2654..14226d2 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 _0x2049=['bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','moment'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2049,0x15d));var _0x9204=function(_0x1b4bca,_0x47468e){_0x1b4bca=_0x1b4bca-0x0;var _0x36b4c=_0x2049[_0x1b4bca];return _0x36b4c;};'use strict';var _=require('lodash');var util=require(_0x9204('0x0'));var logger=require(_0x9204('0x1'))('api');var moment=require(_0x9204('0x2'));var BPromise=require(_0x9204('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9204('0x4'));var rimraf=require(_0x9204('0x5'));var config=require(_0x9204('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x9204('0x7'));module['exports']=function(_0xc02375,_0x531799){return _0xc02375[_0x9204('0x8')](_0x9204('0x9'),attributes,{'tableName':_0x9204('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65d9=['util','moment','bluebird','path','rimraf','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x2ba6df,_0x58b6de){var _0x5d6c09=function(_0x2b20b2){while(--_0x2b20b2){_0x2ba6df['push'](_0x2ba6df['shift']());}};_0x5d6c09(++_0x58b6de);}(_0x65d9,0xaf));var _0x965d=function(_0x1161dc,_0x3b4023){_0x1161dc=_0x1161dc-0x0;var _0x4d7689=_0x65d9[_0x1161dc];return _0x4d7689;};'use strict';var _=require(_0x965d('0x0'));var util=require(_0x965d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x965d('0x2'));var BPromise=require(_0x965d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x965d('0x4'));var rimraf=require(_0x965d('0x5'));var config=require('../../config/environment');var attributes=require(_0x965d('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x965d('0x7')]=function(_0x3967b8,_0x126a28){return _0x3967b8[_0x965d('0x8')](_0x965d('0x9'),attributes,{'tableName':_0x965d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 378a764..4bcca24 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 _0xf08f=['findAll','options','raw','where','limit','include','model','attributes','map','ShowSalesforceAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0xf08f,0x73));var _0xff08=function(_0x290fa6,_0x16d017){_0x290fa6=_0x290fa6-0x0;var _0x47f1f3=_0xf08f[_0x290fa6];return _0x47f1f3;};'use strict';var _=require('lodash');var util=require(_0xff08('0x0'));var moment=require(_0xff08('0x1'));var BPromise=require(_0xff08('0x2'));var rs=require(_0xff08('0x3'));var fs=require('fs');var Redis=require(_0xff08('0x4'));var db=require(_0xff08('0x5'))['db'];var utils=require(_0xff08('0x6'));var logger=require('../../config/logger')(_0xff08('0x7'));var config=require('../../config/environment');var jayson=require(_0xff08('0x8'));var client=jayson[_0xff08('0x9')][_0xff08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c8cae,_0x6d6985,_0x27fef8){return new BPromise(function(_0x2dc692,_0x4df5dc){return client[_0xff08('0xb')](_0x1c8cae,_0x27fef8)[_0xff08('0xc')](function(_0xc5ac84){logger[_0xff08('0xd')](_0xff08('0xe'),_0x6d6985,'request\x20sent');logger[_0xff08('0xf')](_0xff08('0x10'),_0x6d6985,_0xff08('0x11'),JSON[_0xff08('0x12')](_0xc5ac84));if(_0xc5ac84[_0xff08('0x13')]){if(_0xc5ac84[_0xff08('0x13')][_0xff08('0x14')]===0x1f4){logger[_0xff08('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x6d6985,_0xc5ac84[_0xff08('0x13')][_0xff08('0x15')]);return _0x4df5dc(_0xc5ac84[_0xff08('0x13')]['message']);}logger[_0xff08('0x13')](_0xff08('0xe'),_0x6d6985,_0xc5ac84[_0xff08('0x13')]['message']);return _0x2dc692(_0xc5ac84[_0xff08('0x13')][_0xff08('0x15')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x6d6985,_0xff08('0x11'));_0x2dc692(_0xc5ac84['result'][_0xff08('0x15')]);}})[_0xff08('0x16')](function(_0x3fc1ca){logger[_0xff08('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x6d6985,_0x3fc1ca);_0x4df5dc(_0x3fc1ca);});});}exports[_0xff08('0x17')]=function(_0x156ce2){var _0x52a519=this;return new Promise(function(_0x354d0c,_0x2523ff){return db[_0xff08('0x18')][_0xff08('0x19')]({'raw':_0x156ce2[_0xff08('0x1a')]?_0x156ce2['options'][_0xff08('0x1b')]===undefined?!![]:![]:!![],'where':_0x156ce2[_0xff08('0x1a')]?_0x156ce2[_0xff08('0x1a')][_0xff08('0x1c')]||null:null,'attributes':_0x156ce2[_0xff08('0x1a')]?_0x156ce2['options']['attributes']||null:null,'limit':_0x156ce2[_0xff08('0x1a')]?_0x156ce2['options'][_0xff08('0x1d')]||null:null,'include':_0x156ce2['options']?_0x156ce2[_0xff08('0x1a')][_0xff08('0x1e')]?_['map'](_0x156ce2['options'][_0xff08('0x1e')],function(_0x5ad844){return{'model':db[_0x5ad844[_0xff08('0x1f')]],'as':_0x5ad844['as'],'attributes':_0x5ad844[_0xff08('0x20')],'include':_0x5ad844[_0xff08('0x1e')]?_[_0xff08('0x21')](_0x5ad844[_0xff08('0x1e')],function(_0x140be7){return{'model':db[_0x140be7[_0xff08('0x1f')]],'as':_0x140be7['as'],'attributes':_0x140be7[_0xff08('0x20')],'include':_0x140be7[_0xff08('0x1e')]?_['map'](_0x140be7[_0xff08('0x1e')],function(_0x492d9b){return{'model':db[_0x492d9b[_0xff08('0x1f')]],'as':_0x492d9b['as'],'attributes':_0x492d9b[_0xff08('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b5521){logger[_0xff08('0xd')](_0xff08('0x17'),_0x156ce2);logger[_0xff08('0xf')](_0xff08('0x17'),_0x156ce2,JSON[_0xff08('0x12')](_0x4b5521));_0x354d0c(_0x4b5521);})[_0xff08('0x16')](function(_0x13a327){logger['error'](_0xff08('0x17'),_0x13a327['message'],_0x156ce2);_0x2523ff(_0x52a519[_0xff08('0x13')](0x1f4,_0x13a327[_0xff08('0x15')]));});});};exports[_0xff08('0x22')]=function(_0x4910eb){var _0x431fe7=this;return new Promise(function(_0x1a8b8c,_0x3b860e){return db[_0xff08('0x18')]['find']({'raw':_0x4910eb['options']?_0x4910eb[_0xff08('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4910eb[_0xff08('0x1a')]?_0x4910eb[_0xff08('0x1a')][_0xff08('0x1c')]||null:null,'attributes':_0x4910eb[_0xff08('0x1a')]?_0x4910eb[_0xff08('0x1a')][_0xff08('0x20')]||null:null,'include':_0x4910eb[_0xff08('0x1a')]?_0x4910eb[_0xff08('0x1a')][_0xff08('0x1e')]?_[_0xff08('0x21')](_0x4910eb[_0xff08('0x1a')][_0xff08('0x1e')],function(_0x55163e){return{'model':db[_0x55163e[_0xff08('0x1f')]],'as':_0x55163e['as'],'attributes':_0x55163e[_0xff08('0x20')],'include':_0x55163e[_0xff08('0x1e')]?_['map'](_0x55163e[_0xff08('0x1e')],function(_0x26b993){return{'model':db[_0x26b993[_0xff08('0x1f')]],'as':_0x26b993['as'],'attributes':_0x26b993[_0xff08('0x20')],'include':_0x26b993[_0xff08('0x1e')]?_[_0xff08('0x21')](_0x26b993[_0xff08('0x1e')],function(_0x18fed5){return{'model':db[_0x18fed5[_0xff08('0x1f')]],'as':_0x18fed5['as'],'attributes':_0x18fed5['attributes']};}):[]};}):[]};}):[]:[]})[_0xff08('0xc')](function(_0x1d0045){logger['info']('ShowSalesforceAccount',_0x4910eb);logger[_0xff08('0xf')](_0xff08('0x22'),_0x4910eb,JSON[_0xff08('0x12')](_0x1d0045));_0x1a8b8c(_0x1d0045);})[_0xff08('0x16')](function(_0x1ccec6){logger[_0xff08('0x13')](_0xff08('0x22'),_0x1ccec6[_0xff08('0x15')],_0x4910eb);_0x3b860e(_0x431fe7[_0xff08('0x13')](0x1f4,_0x1ccec6[_0xff08('0x15')]));});});}; \ No newline at end of file +var _0x39aa=['options','raw','where','attributes','limit','map','include','model','GetSalesforceAccount','SalesforceAccount','find','ShowSalesforceAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll'];(function(_0x5bf81e,_0x16e4d2){var _0x38212f=function(_0x3aff76){while(--_0x3aff76){_0x5bf81e['push'](_0x5bf81e['shift']());}};_0x38212f(++_0x16e4d2);}(_0x39aa,0x1ed));var _0xa39a=function(_0x1a13b1,_0x4d1d25){_0x1a13b1=_0x1a13b1-0x0;var _0x395e05=_0x39aa[_0x1a13b1];return _0x395e05;};'use strict';var _=require(_0xa39a('0x0'));var util=require('util');var moment=require(_0xa39a('0x1'));var BPromise=require(_0xa39a('0x2'));var rs=require(_0xa39a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa39a('0x4'))['db'];var utils=require(_0xa39a('0x5'));var logger=require(_0xa39a('0x6'))(_0xa39a('0x7'));var config=require(_0xa39a('0x8'));var jayson=require(_0xa39a('0x9'));var client=jayson['client'][_0xa39a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2298a4,_0x3a7d74,_0xaa5b95){return new BPromise(function(_0x4eae38,_0x54a9d2){return client[_0xa39a('0xb')](_0x2298a4,_0xaa5b95)[_0xa39a('0xc')](function(_0xa7cbad){logger[_0xa39a('0xd')](_0xa39a('0xe'),_0x3a7d74,_0xa39a('0xf'));logger[_0xa39a('0x10')](_0xa39a('0x11'),_0x3a7d74,'request\x20sent',JSON[_0xa39a('0x12')](_0xa7cbad));if(_0xa7cbad[_0xa39a('0x13')]){if(_0xa7cbad['error'][_0xa39a('0x14')]===0x1f4){logger[_0xa39a('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x3a7d74,_0xa7cbad[_0xa39a('0x13')]['message']);return _0x54a9d2(_0xa7cbad[_0xa39a('0x13')][_0xa39a('0x15')]);}logger[_0xa39a('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x3a7d74,_0xa7cbad['error'][_0xa39a('0x15')]);return _0x4eae38(_0xa7cbad[_0xa39a('0x13')][_0xa39a('0x15')]);}else{logger['info'](_0xa39a('0xe'),_0x3a7d74,_0xa39a('0xf'));_0x4eae38(_0xa7cbad[_0xa39a('0x16')][_0xa39a('0x15')]);}})[_0xa39a('0x17')](function(_0x1def7a){logger[_0xa39a('0x13')](_0xa39a('0xe'),_0x3a7d74,_0x1def7a);_0x54a9d2(_0x1def7a);});});}exports['GetSalesforceAccount']=function(_0x1f7c9d){var _0x3f794f=this;return new Promise(function(_0x547ae6,_0x2a969e){return db['SalesforceAccount'][_0xa39a('0x18')]({'raw':_0x1f7c9d[_0xa39a('0x19')]?_0x1f7c9d[_0xa39a('0x19')][_0xa39a('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f7c9d[_0xa39a('0x19')]?_0x1f7c9d[_0xa39a('0x19')][_0xa39a('0x1b')]||null:null,'attributes':_0x1f7c9d[_0xa39a('0x19')]?_0x1f7c9d[_0xa39a('0x19')][_0xa39a('0x1c')]||null:null,'limit':_0x1f7c9d['options']?_0x1f7c9d[_0xa39a('0x19')][_0xa39a('0x1d')]||null:null,'include':_0x1f7c9d[_0xa39a('0x19')]?_0x1f7c9d[_0xa39a('0x19')]['include']?_[_0xa39a('0x1e')](_0x1f7c9d[_0xa39a('0x19')][_0xa39a('0x1f')],function(_0x326548){return{'model':db[_0x326548[_0xa39a('0x20')]],'as':_0x326548['as'],'attributes':_0x326548[_0xa39a('0x1c')],'include':_0x326548[_0xa39a('0x1f')]?_[_0xa39a('0x1e')](_0x326548[_0xa39a('0x1f')],function(_0x2b354e){return{'model':db[_0x2b354e[_0xa39a('0x20')]],'as':_0x2b354e['as'],'attributes':_0x2b354e[_0xa39a('0x1c')],'include':_0x2b354e['include']?_[_0xa39a('0x1e')](_0x2b354e[_0xa39a('0x1f')],function(_0x2b3953){return{'model':db[_0x2b3953['model']],'as':_0x2b3953['as'],'attributes':_0x2b3953[_0xa39a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa39a('0xc')](function(_0x18f1fe){logger[_0xa39a('0xd')](_0xa39a('0x21'),_0x1f7c9d);logger['debug']('GetSalesforceAccount',_0x1f7c9d,JSON[_0xa39a('0x12')](_0x18f1fe));_0x547ae6(_0x18f1fe);})[_0xa39a('0x17')](function(_0x974b92){logger['error'](_0xa39a('0x21'),_0x974b92[_0xa39a('0x15')],_0x1f7c9d);_0x2a969e(_0x3f794f['error'](0x1f4,_0x974b92['message']));});});};exports['ShowSalesforceAccount']=function(_0x5b2201){var _0x6d92bb=this;return new Promise(function(_0x135a2c,_0x3d12f2){return db[_0xa39a('0x22')][_0xa39a('0x23')]({'raw':_0x5b2201['options']?_0x5b2201[_0xa39a('0x19')][_0xa39a('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b2201[_0xa39a('0x19')]?_0x5b2201[_0xa39a('0x19')][_0xa39a('0x1b')]||null:null,'attributes':_0x5b2201[_0xa39a('0x19')]?_0x5b2201[_0xa39a('0x19')]['attributes']||null:null,'include':_0x5b2201[_0xa39a('0x19')]?_0x5b2201[_0xa39a('0x19')][_0xa39a('0x1f')]?_[_0xa39a('0x1e')](_0x5b2201[_0xa39a('0x19')][_0xa39a('0x1f')],function(_0x4c2b04){return{'model':db[_0x4c2b04['model']],'as':_0x4c2b04['as'],'attributes':_0x4c2b04['attributes'],'include':_0x4c2b04[_0xa39a('0x1f')]?_[_0xa39a('0x1e')](_0x4c2b04[_0xa39a('0x1f')],function(_0x3d16bb){return{'model':db[_0x3d16bb[_0xa39a('0x20')]],'as':_0x3d16bb['as'],'attributes':_0x3d16bb[_0xa39a('0x1c')],'include':_0x3d16bb['include']?_[_0xa39a('0x1e')](_0x3d16bb[_0xa39a('0x1f')],function(_0x53ac24){return{'model':db[_0x53ac24[_0xa39a('0x20')]],'as':_0x53ac24['as'],'attributes':_0x53ac24[_0xa39a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa39a('0xc')](function(_0xc34daa){logger['info'](_0xa39a('0x24'),_0x5b2201);logger['debug'](_0xa39a('0x24'),_0x5b2201,JSON[_0xa39a('0x12')](_0xc34daa));_0x135a2c(_0xc34daa);})['catch'](function(_0xe7dc3d){logger[_0xa39a('0x13')](_0xa39a('0x24'),_0xe7dc3d[_0xa39a('0x15')],_0x5b2201);_0x3d12f2(_0x6d92bb[_0xa39a('0x13')](0x1f4,_0xe7dc3d[_0xa39a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 91c1a52..42744b7 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdb28,0x106));var _0x8db2=function(_0x23407b,_0x2dfe50){_0x23407b=_0x23407b-0x0;var _0x319078=_0xdb28[_0x23407b];return _0x319078;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x157baf,_0xbd6c69){var _0x12f169=function(_0x133a0a){while(--_0x133a0a){_0x157baf['push'](_0x157baf['shift']());}};_0x12f169(++_0xbd6c69);}(_0x2ef3,0xba));var _0x32ef=function(_0x53bb56,_0x16fad2){_0x53bb56=_0x53bb56-0x0;var _0x3faa25=_0x2ef3[_0x53bb56];return _0x3faa25;};'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('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 971d5bf..862b291 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 _0xf721=['nothing','account','sequelize','exports','STRING','ENUM','Case','Task','contact','lead','contact_lead'];(function(_0xd00e6a,_0x282a33){var _0x2e8452=function(_0x20b578){while(--_0x20b578){_0xd00e6a['push'](_0xd00e6a['shift']());}};_0x2e8452(++_0x282a33);}(_0xf721,0x65));var _0x1f72=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xf721[_0x1fc122];return _0xa2cb13;};'use strict';var Sequelize=require(_0x1f72('0x0'));module[_0x1f72('0x1')]={'name':{'type':Sequelize[_0x1f72('0x2')]},'description':{'type':Sequelize[_0x1f72('0x2')]},'ticketType':{'type':Sequelize[_0x1f72('0x3')]('Task',_0x1f72('0x4')),'defaultValue':_0x1f72('0x5')},'moduleSearch':{'type':Sequelize[_0x1f72('0x3')]('contact_lead',_0x1f72('0x6'),_0x1f72('0x7'),'account_contact_lead','account'),'defaultValue':_0x1f72('0x8')},'moduleCreate':{'type':Sequelize[_0x1f72('0x3')](_0x1f72('0x9'),_0x1f72('0x6'),_0x1f72('0x7'),_0x1f72('0xa')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x1f72('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x1f72('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x938f=['nothing','sequelize','exports','STRING','ENUM','Task','Case','contact','lead','account_contact_lead','account','contact_lead'];(function(_0x3391cd,_0x2aae8){var _0x5668e2=function(_0x5f3fdc){while(--_0x5f3fdc){_0x3391cd['push'](_0x3391cd['shift']());}};_0x5668e2(++_0x2aae8);}(_0x938f,0xc1));var _0xf938=function(_0x1cd65a,_0x29fa8f){_0x1cd65a=_0x1cd65a-0x0;var _0xf93849=_0x938f[_0x1cd65a];return _0xf93849;};'use strict';var Sequelize=require(_0xf938('0x0'));module[_0xf938('0x1')]={'name':{'type':Sequelize[_0xf938('0x2')]},'description':{'type':Sequelize[_0xf938('0x2')]},'ticketType':{'type':Sequelize[_0xf938('0x3')](_0xf938('0x4'),_0xf938('0x5')),'defaultValue':_0xf938('0x4')},'moduleSearch':{'type':Sequelize[_0xf938('0x3')]('contact_lead',_0xf938('0x6'),_0xf938('0x7'),_0xf938('0x8'),_0xf938('0x9')),'defaultValue':_0xf938('0xa')},'moduleCreate':{'type':Sequelize[_0xf938('0x3')](_0xf938('0xb'),_0xf938('0x6'),'lead',_0xf938('0x9')),'defaultValue':_0xf938('0x7')},'leadId':{'type':Sequelize[_0xf938('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'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 25c1c01..e3211dc 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 _0x29e7=['getDescriptions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','then','destroy','end','error','stack','name','send','map','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','merge','filter','options','includeAll','SalesforceConfiguration','findAll','rows','params','include','find','catch','create','body','getFields','SalesforceField','order','hasOwnProperty','getSubjects'];(function(_0xfbdbb,_0x4c162e){var _0x20b550=function(_0x25c86e){while(--_0x25c86e){_0xfbdbb['push'](_0xfbdbb['shift']());}};_0x20b550(++_0x4c162e);}(_0x29e7,0x1f4));var _0x729e=function(_0xe7c36a,_0x641105){_0xe7c36a=_0xe7c36a-0x0;var _0x8b1186=_0x29e7[_0xe7c36a];return _0x8b1186;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x729e('0x0'));var zipdir=require(_0x729e('0x1'));var jsonpatch=require(_0x729e('0x2'));var rp=require(_0x729e('0x3'));var moment=require(_0x729e('0x4'));var BPromise=require(_0x729e('0x5'));var Mustache=require(_0x729e('0x6'));var util=require(_0x729e('0x7'));var path=require(_0x729e('0x8'));var sox=require(_0x729e('0x9'));var csv=require(_0x729e('0xa'));var ejs=require(_0x729e('0xb'));var fs=require('fs');var fs_extra=require(_0x729e('0xc'));var _=require(_0x729e('0xd'));var squel=require(_0x729e('0xe'));var crypto=require('crypto');var jsforce=require(_0x729e('0xf'));var deskjs=require(_0x729e('0x10'));var toCsv=require(_0x729e('0xa'));var querystring=require(_0x729e('0x11'));var Papa=require(_0x729e('0x12'));var Redis=require(_0x729e('0x13'));var authService=require(_0x729e('0x14'));var qs=require(_0x729e('0x15'));var as=require(_0x729e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x729e('0x17'));var utils=require(_0x729e('0x18'));var config=require(_0x729e('0x19'));var licenseUtil=require(_0x729e('0x1a'));var db=require(_0x729e('0x1b'))['db'];function respondWithStatusCode(_0x213c9d,_0x35c70c){_0x35c70c=_0x35c70c||0xcc;return function(_0x5928ab){if(_0x5928ab){return _0x213c9d[_0x729e('0x1c')](_0x35c70c);}return _0x213c9d[_0x729e('0x1d')](_0x35c70c)['end']();};}function respondWithResult(_0x418b48,_0x16ad4b){_0x16ad4b=_0x16ad4b||0xc8;return function(_0x54e119){if(_0x54e119){return _0x418b48[_0x729e('0x1d')](_0x16ad4b)[_0x729e('0x1e')](_0x54e119);}};}function respondWithFilteredResult(_0x4a7955,_0x230e43){return function(_0x3deaf2){if(_0x3deaf2){var _0x13a884=typeof _0x230e43[_0x729e('0x1f')]===_0x729e('0x20')&&typeof _0x230e43[_0x729e('0x21')]===_0x729e('0x20');var _0xe64431=_0x3deaf2[_0x729e('0x22')];var _0x31bc07=_0x13a884?0x0:_0x230e43['offset'];var _0x46b20a=_0x13a884?_0x3deaf2[_0x729e('0x22')]:_0x230e43['offset']+_0x230e43[_0x729e('0x21')];var _0x171672;if(_0x46b20a>=_0xe64431){_0x46b20a=_0xe64431;_0x171672=0xc8;}else{_0x171672=0xce;}_0x4a7955[_0x729e('0x1d')](_0x171672);return _0x4a7955[_0x729e('0x23')](_0x729e('0x24'),_0x31bc07+'-'+_0x46b20a+'/'+_0xe64431)['json'](_0x3deaf2);}return null;};}function patchUpdates(_0x175dd7){return function(_0xf60745){try{jsonpatch[_0x729e('0x25')](_0xf60745,_0x175dd7,!![]);}catch(_0x385810){return BPromise[_0x729e('0x26')](_0x385810);}return _0xf60745[_0x729e('0x27')]();};}function saveUpdates(_0x427255,_0x502342){return function(_0x4fe2a4){if(_0x4fe2a4){return _0x4fe2a4['update'](_0x427255)[_0x729e('0x28')](function(_0x566323){return _0x566323;});}return null;};}function removeEntity(_0x48d7cd,_0x587868){return function(_0x4aa616){if(_0x4aa616){return _0x4aa616[_0x729e('0x29')]()[_0x729e('0x28')](function(){_0x48d7cd[_0x729e('0x1d')](0xcc)[_0x729e('0x2a')]();});}};}function handleEntityNotFound(_0x349348,_0x2248d4){return function(_0x1e35f6){if(!_0x1e35f6){_0x349348['sendStatus'](0x194);}return _0x1e35f6;};}function handleError(_0x2dc6e6,_0x337238){_0x337238=_0x337238||0x1f4;return function(_0x3d7ea4){logger[_0x729e('0x2b')](_0x3d7ea4[_0x729e('0x2c')]);if(_0x3d7ea4[_0x729e('0x2d')]){delete _0x3d7ea4[_0x729e('0x2d')];}_0x2dc6e6[_0x729e('0x1d')](_0x337238)[_0x729e('0x2e')](_0x3d7ea4);};}exports['index']=function(_0xcfe818,_0x14d9e3){var _0x4e5abd={},_0x4795bd={},_0x24eea3={'count':0x0,'rows':[]};var _0x205044=_[_0x729e('0x2f')](db['SalesforceConfiguration'][_0x729e('0x30')],function(_0x23a06e){return{'name':_0x23a06e['fieldName'],'type':_0x23a06e[_0x729e('0x31')][_0x729e('0x32')]};});_0x4795bd['model']=_[_0x729e('0x2f')](_0x205044,'name');_0x4795bd['query']=_[_0x729e('0x33')](_0xcfe818[_0x729e('0x34')]);_0x4795bd[_0x729e('0x35')]=_[_0x729e('0x36')](_0x4795bd[_0x729e('0x37')],_0x4795bd[_0x729e('0x34')]);_0x4e5abd[_0x729e('0x38')]=_[_0x729e('0x36')](_0x4795bd[_0x729e('0x37')],qs['fields'](_0xcfe818[_0x729e('0x34')][_0x729e('0x39')]));_0x4e5abd['attributes']=_0x4e5abd[_0x729e('0x38')][_0x729e('0x3a')]?_0x4e5abd['attributes']:_0x4795bd[_0x729e('0x37')];if(!_0xcfe818[_0x729e('0x34')]['hasOwnProperty'](_0x729e('0x3b'))){_0x4e5abd[_0x729e('0x21')]=qs[_0x729e('0x21')](_0xcfe818['query'][_0x729e('0x21')]);_0x4e5abd[_0x729e('0x1f')]=qs['offset'](_0xcfe818['query'][_0x729e('0x1f')]);}_0x4e5abd['order']=qs[_0x729e('0x3c')](_0xcfe818[_0x729e('0x34')][_0x729e('0x3c')]);_0x4e5abd[_0x729e('0x3d')]=qs[_0x729e('0x35')](_[_0x729e('0x3e')](_0xcfe818['query'],_0x4795bd[_0x729e('0x35')]),_0x205044);if(_0xcfe818['query']['filter']){_0x4e5abd[_0x729e('0x3d')]=_[_0x729e('0x3f')](_0x4e5abd[_0x729e('0x3d')],{'$or':_[_0x729e('0x2f')](_0x205044,function(_0x28f159){if(_0x28f159[_0x729e('0x31')]!=='VIRTUAL'){var _0xef941a={};_0xef941a[_0x28f159[_0x729e('0x2d')]]={'$like':'%'+_0xcfe818['query'][_0x729e('0x40')]+'%'};return _0xef941a;}})});}_0x4e5abd=_[_0x729e('0x3f')]({},_0x4e5abd,_0xcfe818[_0x729e('0x41')]);var _0x2af791={'where':_0x4e5abd[_0x729e('0x3d')]};return db['SalesforceConfiguration']['count'](_0x2af791)['then'](function(_0x1986ba){_0x24eea3[_0x729e('0x22')]=_0x1986ba;if(_0xcfe818[_0x729e('0x34')][_0x729e('0x42')]){_0x4e5abd['include']=[{'all':!![]}];}return db[_0x729e('0x43')][_0x729e('0x44')](_0x4e5abd);})[_0x729e('0x28')](function(_0x40dd32){_0x24eea3[_0x729e('0x45')]=_0x40dd32;return _0x24eea3;})['then'](respondWithFilteredResult(_0x14d9e3,_0x4e5abd))['catch'](handleError(_0x14d9e3,null));};exports['show']=function(_0x5a3ac8,_0x1066b0){var _0x3a40bd={'raw':![],'where':{'id':_0x5a3ac8[_0x729e('0x46')]['id']}},_0x5cf621={};_0x5cf621[_0x729e('0x37')]=_['keys'](db['SalesforceConfiguration']['rawAttributes']);_0x5cf621[_0x729e('0x34')]=_[_0x729e('0x33')](_0x5a3ac8[_0x729e('0x34')]);_0x5cf621[_0x729e('0x35')]=_[_0x729e('0x36')](_0x5cf621['model'],_0x5cf621[_0x729e('0x34')]);_0x3a40bd[_0x729e('0x38')]=_['intersection'](_0x5cf621[_0x729e('0x37')],qs['fields'](_0x5a3ac8[_0x729e('0x34')][_0x729e('0x39')]));_0x3a40bd[_0x729e('0x38')]=_0x3a40bd[_0x729e('0x38')][_0x729e('0x3a')]?_0x3a40bd[_0x729e('0x38')]:_0x5cf621['model'];if(_0x5a3ac8[_0x729e('0x34')][_0x729e('0x42')]){_0x3a40bd[_0x729e('0x47')]=[{'all':!![]}];}_0x3a40bd=_[_0x729e('0x3f')]({},_0x3a40bd,_0x5a3ac8[_0x729e('0x41')]);return db[_0x729e('0x43')][_0x729e('0x48')](_0x3a40bd)['then'](handleEntityNotFound(_0x1066b0,null))[_0x729e('0x28')](respondWithResult(_0x1066b0,null))[_0x729e('0x49')](handleError(_0x1066b0,null));};exports[_0x729e('0x4a')]=function(_0x435a83,_0x5c7ee0){return db[_0x729e('0x43')][_0x729e('0x4a')](_0x435a83[_0x729e('0x4b')],{})[_0x729e('0x28')](respondWithResult(_0x5c7ee0,0xc9))[_0x729e('0x49')](handleError(_0x5c7ee0,null));};exports['update']=function(_0x1cf13e,_0x2c8cb9){if(_0x1cf13e[_0x729e('0x4b')]['id']){delete _0x1cf13e[_0x729e('0x4b')]['id'];}return db[_0x729e('0x43')][_0x729e('0x48')]({'where':{'id':_0x1cf13e[_0x729e('0x46')]['id']}})[_0x729e('0x28')](handleEntityNotFound(_0x2c8cb9,null))[_0x729e('0x28')](saveUpdates(_0x1cf13e['body'],null))[_0x729e('0x28')](respondWithResult(_0x2c8cb9,null))[_0x729e('0x49')](handleError(_0x2c8cb9,null));};exports[_0x729e('0x29')]=function(_0x199ed3,_0x324e86){return db[_0x729e('0x43')][_0x729e('0x48')]({'where':{'id':_0x199ed3[_0x729e('0x46')]['id']}})[_0x729e('0x28')](handleEntityNotFound(_0x324e86,null))[_0x729e('0x28')](removeEntity(_0x324e86,null))[_0x729e('0x49')](handleError(_0x324e86,null));};exports[_0x729e('0x4c')]=function(_0x139029,_0x266fdd,_0x45c5e8){var _0x44f020={};var _0x45a53e={};var _0x1a88ca;var _0x5b166c;return db[_0x729e('0x43')]['findOne']({'where':{'id':_0x139029[_0x729e('0x46')]['id']}})[_0x729e('0x28')](handleEntityNotFound(_0x266fdd,null))[_0x729e('0x28')](function(_0x401e23){if(_0x401e23){_0x1a88ca=_0x401e23;_0x45a53e[_0x729e('0x37')]=_[_0x729e('0x33')](db[_0x729e('0x4d')][_0x729e('0x30')]);_0x45a53e[_0x729e('0x34')]=_['keys'](_0x139029[_0x729e('0x34')]);_0x45a53e['filters']=_[_0x729e('0x36')](_0x45a53e[_0x729e('0x37')],_0x45a53e[_0x729e('0x34')]);_0x44f020[_0x729e('0x38')]=_[_0x729e('0x36')](_0x45a53e[_0x729e('0x37')],qs[_0x729e('0x39')](_0x139029[_0x729e('0x34')][_0x729e('0x39')]));_0x44f020[_0x729e('0x38')]=_0x44f020['attributes']['length']?_0x44f020[_0x729e('0x38')]:_0x45a53e[_0x729e('0x37')];_0x44f020[_0x729e('0x4e')]=qs[_0x729e('0x3c')](_0x139029[_0x729e('0x34')][_0x729e('0x3c')]);_0x44f020[_0x729e('0x3d')]=qs['filters'](_[_0x729e('0x3e')](_0x139029[_0x729e('0x34')],_0x45a53e[_0x729e('0x35')]));if(_0x139029[_0x729e('0x34')][_0x729e('0x40')]){_0x44f020[_0x729e('0x3d')]=_[_0x729e('0x3f')](_0x44f020['where'],{'$or':_[_0x729e('0x2f')](_0x44f020[_0x729e('0x38')],function(_0x3c26aa){var _0x3fb70d={};_0x3fb70d[_0x3c26aa]={'$like':'%'+_0x139029[_0x729e('0x34')][_0x729e('0x40')]+'%'};return _0x3fb70d;})});}_0x44f020=_[_0x729e('0x3f')]({},_0x44f020,_0x139029['options']);return _0x1a88ca[_0x729e('0x4c')](_0x44f020);}})[_0x729e('0x28')](function(_0x1d92d0){if(_0x1d92d0){_0x5b166c=_0x1d92d0[_0x729e('0x3a')];if(!_0x139029[_0x729e('0x34')][_0x729e('0x4f')](_0x729e('0x3b'))){_0x44f020[_0x729e('0x21')]=qs[_0x729e('0x21')](_0x139029[_0x729e('0x34')][_0x729e('0x21')]);_0x44f020[_0x729e('0x1f')]=qs[_0x729e('0x1f')](_0x139029['query'][_0x729e('0x1f')]);}return _0x1a88ca[_0x729e('0x4c')](_0x44f020);}})['then'](function(_0x3fddda){if(_0x3fddda){return _0x3fddda?{'count':_0x5b166c,'rows':_0x3fddda}:null;}})[_0x729e('0x28')](respondWithResult(_0x266fdd,null))['catch'](handleError(_0x266fdd,null));};exports[_0x729e('0x50')]=function(_0x1ebdf1,_0x3565bc,_0x3a9516){var _0x392e04={};var _0x4ef082={};var _0x5934f4;var _0x2cd4dc;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x1ebdf1[_0x729e('0x46')]['id']}})[_0x729e('0x28')](handleEntityNotFound(_0x3565bc,null))[_0x729e('0x28')](function(_0x516558){if(_0x516558){_0x5934f4=_0x516558;_0x4ef082['model']=_['keys'](db[_0x729e('0x4d')]['rawAttributes']);_0x4ef082[_0x729e('0x34')]=_['keys'](_0x1ebdf1[_0x729e('0x34')]);_0x4ef082[_0x729e('0x35')]=_[_0x729e('0x36')](_0x4ef082[_0x729e('0x37')],_0x4ef082['query']);_0x392e04['attributes']=_[_0x729e('0x36')](_0x4ef082[_0x729e('0x37')],qs[_0x729e('0x39')](_0x1ebdf1[_0x729e('0x34')][_0x729e('0x39')]));_0x392e04['attributes']=_0x392e04[_0x729e('0x38')][_0x729e('0x3a')]?_0x392e04[_0x729e('0x38')]:_0x4ef082[_0x729e('0x37')];_0x392e04['order']=qs['sort'](_0x1ebdf1['query'][_0x729e('0x3c')]);_0x392e04[_0x729e('0x3d')]=qs['filters'](_[_0x729e('0x3e')](_0x1ebdf1[_0x729e('0x34')],_0x4ef082[_0x729e('0x35')]));if(_0x1ebdf1[_0x729e('0x34')][_0x729e('0x40')]){_0x392e04['where']=_[_0x729e('0x3f')](_0x392e04[_0x729e('0x3d')],{'$or':_[_0x729e('0x2f')](_0x392e04[_0x729e('0x38')],function(_0x128c63){var _0x544fea={};_0x544fea[_0x128c63]={'$like':'%'+_0x1ebdf1[_0x729e('0x34')][_0x729e('0x40')]+'%'};return _0x544fea;})});}_0x392e04=_[_0x729e('0x3f')]({},_0x392e04,_0x1ebdf1[_0x729e('0x41')]);return _0x5934f4[_0x729e('0x50')](_0x392e04);}})[_0x729e('0x28')](function(_0x1a9354){if(_0x1a9354){_0x2cd4dc=_0x1a9354[_0x729e('0x3a')];if(!_0x1ebdf1[_0x729e('0x34')]['hasOwnProperty']('nolimit')){_0x392e04['limit']=qs[_0x729e('0x21')](_0x1ebdf1[_0x729e('0x34')][_0x729e('0x21')]);_0x392e04['offset']=qs['offset'](_0x1ebdf1[_0x729e('0x34')][_0x729e('0x1f')]);}return _0x5934f4[_0x729e('0x50')](_0x392e04);}})[_0x729e('0x28')](function(_0x34f59e){if(_0x34f59e){return _0x34f59e?{'count':_0x2cd4dc,'rows':_0x34f59e}:null;}})['then'](respondWithResult(_0x3565bc,null))[_0x729e('0x49')](handleError(_0x3565bc,null));};exports[_0x729e('0x51')]=function(_0x491cbd,_0x537a0a,_0x55e836){var _0x2be092={};var _0x302d8f={};var _0x30b0e1;var _0x5d8ece;return db[_0x729e('0x43')][_0x729e('0x52')]({'where':{'id':_0x491cbd[_0x729e('0x46')]['id']}})[_0x729e('0x28')](handleEntityNotFound(_0x537a0a,null))[_0x729e('0x28')](function(_0x1c1d42){if(_0x1c1d42){_0x30b0e1=_0x1c1d42;_0x302d8f[_0x729e('0x37')]=_['keys'](db[_0x729e('0x4d')][_0x729e('0x30')]);_0x302d8f[_0x729e('0x34')]=_[_0x729e('0x33')](_0x491cbd['query']);_0x302d8f[_0x729e('0x35')]=_[_0x729e('0x36')](_0x302d8f[_0x729e('0x37')],_0x302d8f[_0x729e('0x34')]);_0x2be092['attributes']=_[_0x729e('0x36')](_0x302d8f[_0x729e('0x37')],qs[_0x729e('0x39')](_0x491cbd[_0x729e('0x34')][_0x729e('0x39')]));_0x2be092[_0x729e('0x38')]=_0x2be092['attributes']['length']?_0x2be092[_0x729e('0x38')]:_0x302d8f[_0x729e('0x37')];_0x2be092['order']=qs[_0x729e('0x3c')](_0x491cbd[_0x729e('0x34')]['sort']);_0x2be092[_0x729e('0x3d')]=qs[_0x729e('0x35')](_[_0x729e('0x3e')](_0x491cbd[_0x729e('0x34')],_0x302d8f[_0x729e('0x35')]));if(_0x491cbd[_0x729e('0x34')][_0x729e('0x40')]){_0x2be092['where']=_[_0x729e('0x3f')](_0x2be092['where'],{'$or':_[_0x729e('0x2f')](_0x2be092[_0x729e('0x38')],function(_0x4fc4ad){var _0xa1b30c={};_0xa1b30c[_0x4fc4ad]={'$like':'%'+_0x491cbd[_0x729e('0x34')][_0x729e('0x40')]+'%'};return _0xa1b30c;})});}_0x2be092=_[_0x729e('0x3f')]({},_0x2be092,_0x491cbd['options']);return _0x30b0e1[_0x729e('0x51')](_0x2be092);}})[_0x729e('0x28')](function(_0x2d010d){if(_0x2d010d){_0x5d8ece=_0x2d010d['length'];if(!_0x491cbd[_0x729e('0x34')][_0x729e('0x4f')](_0x729e('0x3b'))){_0x2be092[_0x729e('0x21')]=qs['limit'](_0x491cbd[_0x729e('0x34')]['limit']);_0x2be092[_0x729e('0x1f')]=qs[_0x729e('0x1f')](_0x491cbd['query'][_0x729e('0x1f')]);}return _0x30b0e1[_0x729e('0x51')](_0x2be092);}})['then'](function(_0x4185fc){if(_0x4185fc){return _0x4185fc?{'count':_0x5d8ece,'rows':_0x4185fc}:null;}})[_0x729e('0x28')](respondWithResult(_0x537a0a,null))[_0x729e('0x49')](handleError(_0x537a0a,null));}; \ No newline at end of file +var _0x077a=['findOne','hasOwnProperty','nolimit','getSubjects','SalesforceField','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','fields','length','find','catch','create','body','update','getFields'];(function(_0x2fc285,_0x29d686){var _0x4a9184=function(_0x5534f7){while(--_0x5534f7){_0x2fc285['push'](_0x2fc285['shift']());}};_0x4a9184(++_0x29d686);}(_0x077a,0x1f2));var _0xa077=function(_0x4c825d,_0x10ec2b){_0x4c825d=_0x4c825d-0x0;var _0x43de87=_0x077a[_0x4c825d];return _0x43de87;};'use strict';var emlformat=require(_0xa077('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa077('0x1'));var jsonpatch=require(_0xa077('0x2'));var rp=require(_0xa077('0x3'));var moment=require(_0xa077('0x4'));var BPromise=require(_0xa077('0x5'));var Mustache=require(_0xa077('0x6'));var util=require(_0xa077('0x7'));var path=require(_0xa077('0x8'));var sox=require('sox');var csv=require(_0xa077('0x9'));var ejs=require(_0xa077('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa077('0xb'));var jsforce=require(_0xa077('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa077('0xd'));var Papa=require(_0xa077('0xe'));var Redis=require(_0xa077('0xf'));var authService=require(_0xa077('0x10'));var qs=require(_0xa077('0x11'));var as=require(_0xa077('0x12'));var hardwareService=require(_0xa077('0x13'));var logger=require('../../config/logger')(_0xa077('0x14'));var utils=require(_0xa077('0x15'));var config=require(_0xa077('0x16'));var licenseUtil=require(_0xa077('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5464b9,_0x5101e8){_0x5101e8=_0x5101e8||0xcc;return function(_0x3c0656){if(_0x3c0656){return _0x5464b9[_0xa077('0x18')](_0x5101e8);}return _0x5464b9[_0xa077('0x19')](_0x5101e8)[_0xa077('0x1a')]();};}function respondWithResult(_0x30329d,_0x2835b8){_0x2835b8=_0x2835b8||0xc8;return function(_0x32e7fa){if(_0x32e7fa){return _0x30329d[_0xa077('0x19')](_0x2835b8)[_0xa077('0x1b')](_0x32e7fa);}};}function respondWithFilteredResult(_0x1b2d7b,_0x30b448){return function(_0x46d0fb){if(_0x46d0fb){var _0x52ce2=typeof _0x30b448[_0xa077('0x1c')]===_0xa077('0x1d')&&typeof _0x30b448[_0xa077('0x1e')]===_0xa077('0x1d');var _0x4077a3=_0x46d0fb[_0xa077('0x1f')];var _0x7c58a=_0x52ce2?0x0:_0x30b448['offset'];var _0x579144=_0x52ce2?_0x46d0fb[_0xa077('0x1f')]:_0x30b448[_0xa077('0x1c')]+_0x30b448[_0xa077('0x1e')];var _0x18092f;if(_0x579144>=_0x4077a3){_0x579144=_0x4077a3;_0x18092f=0xc8;}else{_0x18092f=0xce;}_0x1b2d7b[_0xa077('0x19')](_0x18092f);return _0x1b2d7b['set'](_0xa077('0x20'),_0x7c58a+'-'+_0x579144+'/'+_0x4077a3)['json'](_0x46d0fb);}return null;};}function patchUpdates(_0x3c608d){return function(_0x264785){try{jsonpatch[_0xa077('0x21')](_0x264785,_0x3c608d,!![]);}catch(_0x58431d){return BPromise[_0xa077('0x22')](_0x58431d);}return _0x264785[_0xa077('0x23')]();};}function saveUpdates(_0x991323,_0x1d8493){return function(_0x474a10){if(_0x474a10){return _0x474a10['update'](_0x991323)[_0xa077('0x24')](function(_0x868a9b){return _0x868a9b;});}return null;};}function removeEntity(_0x11f568,_0xc6be80){return function(_0x272cd5){if(_0x272cd5){return _0x272cd5[_0xa077('0x25')]()['then'](function(){_0x11f568['status'](0xcc)[_0xa077('0x1a')]();});}};}function handleEntityNotFound(_0x4dc63e,_0x54ec2e){return function(_0x5731bb){if(!_0x5731bb){_0x4dc63e[_0xa077('0x18')](0x194);}return _0x5731bb;};}function handleError(_0x326a01,_0x32f25f){_0x32f25f=_0x32f25f||0x1f4;return function(_0x33455a){logger['error'](_0x33455a[_0xa077('0x26')]);if(_0x33455a[_0xa077('0x27')]){delete _0x33455a[_0xa077('0x27')];}_0x326a01['status'](_0x32f25f)[_0xa077('0x28')](_0x33455a);};}exports[_0xa077('0x29')]=function(_0x5cc35b,_0x11c5de){var _0x3f7751={},_0xb4d238={},_0x32c9c6={'count':0x0,'rows':[]};var _0x4612cc=_[_0xa077('0x2a')](db[_0xa077('0x2b')][_0xa077('0x2c')],function(_0x3d43b7){return{'name':_0x3d43b7[_0xa077('0x2d')],'type':_0x3d43b7[_0xa077('0x2e')][_0xa077('0x2f')]};});_0xb4d238['model']=_[_0xa077('0x2a')](_0x4612cc,_0xa077('0x27'));_0xb4d238[_0xa077('0x30')]=_['keys'](_0x5cc35b[_0xa077('0x30')]);_0xb4d238[_0xa077('0x31')]=_[_0xa077('0x32')](_0xb4d238[_0xa077('0x33')],_0xb4d238['query']);_0x3f7751['attributes']=_[_0xa077('0x32')](_0xb4d238[_0xa077('0x33')],qs['fields'](_0x5cc35b[_0xa077('0x30')]['fields']));_0x3f7751[_0xa077('0x34')]=_0x3f7751['attributes']['length']?_0x3f7751[_0xa077('0x34')]:_0xb4d238[_0xa077('0x33')];if(!_0x5cc35b['query']['hasOwnProperty']('nolimit')){_0x3f7751[_0xa077('0x1e')]=qs['limit'](_0x5cc35b[_0xa077('0x30')][_0xa077('0x1e')]);_0x3f7751[_0xa077('0x1c')]=qs[_0xa077('0x1c')](_0x5cc35b[_0xa077('0x30')][_0xa077('0x1c')]);}_0x3f7751[_0xa077('0x35')]=qs['sort'](_0x5cc35b[_0xa077('0x30')][_0xa077('0x36')]);_0x3f7751[_0xa077('0x37')]=qs[_0xa077('0x31')](_[_0xa077('0x38')](_0x5cc35b['query'],_0xb4d238[_0xa077('0x31')]),_0x4612cc);if(_0x5cc35b[_0xa077('0x30')][_0xa077('0x39')]){_0x3f7751['where']=_[_0xa077('0x3a')](_0x3f7751[_0xa077('0x37')],{'$or':_[_0xa077('0x2a')](_0x4612cc,function(_0x3eb7fb){if(_0x3eb7fb['type']!==_0xa077('0x3b')){var _0x27f742={};_0x27f742[_0x3eb7fb[_0xa077('0x27')]]={'$like':'%'+_0x5cc35b[_0xa077('0x30')]['filter']+'%'};return _0x27f742;}})});}_0x3f7751=_[_0xa077('0x3a')]({},_0x3f7751,_0x5cc35b[_0xa077('0x3c')]);var _0x2604f1={'where':_0x3f7751['where']};return db[_0xa077('0x2b')][_0xa077('0x1f')](_0x2604f1)[_0xa077('0x24')](function(_0x4a0fb2){_0x32c9c6[_0xa077('0x1f')]=_0x4a0fb2;if(_0x5cc35b[_0xa077('0x30')][_0xa077('0x3d')]){_0x3f7751[_0xa077('0x3e')]=[{'all':!![]}];}return db[_0xa077('0x2b')][_0xa077('0x3f')](_0x3f7751);})[_0xa077('0x24')](function(_0x48d16f){_0x32c9c6[_0xa077('0x40')]=_0x48d16f;return _0x32c9c6;})[_0xa077('0x24')](respondWithFilteredResult(_0x11c5de,_0x3f7751))['catch'](handleError(_0x11c5de,null));};exports[_0xa077('0x41')]=function(_0x53a7b2,_0x3eabf1){var _0x4b550d={'raw':![],'where':{'id':_0x53a7b2[_0xa077('0x42')]['id']}},_0x10ae94={};_0x10ae94[_0xa077('0x33')]=_['keys'](db[_0xa077('0x2b')][_0xa077('0x2c')]);_0x10ae94['query']=_[_0xa077('0x43')](_0x53a7b2[_0xa077('0x30')]);_0x10ae94[_0xa077('0x31')]=_[_0xa077('0x32')](_0x10ae94[_0xa077('0x33')],_0x10ae94[_0xa077('0x30')]);_0x4b550d[_0xa077('0x34')]=_['intersection'](_0x10ae94['model'],qs[_0xa077('0x44')](_0x53a7b2['query']['fields']));_0x4b550d['attributes']=_0x4b550d['attributes'][_0xa077('0x45')]?_0x4b550d[_0xa077('0x34')]:_0x10ae94[_0xa077('0x33')];if(_0x53a7b2[_0xa077('0x30')][_0xa077('0x3d')]){_0x4b550d[_0xa077('0x3e')]=[{'all':!![]}];}_0x4b550d=_[_0xa077('0x3a')]({},_0x4b550d,_0x53a7b2[_0xa077('0x3c')]);return db[_0xa077('0x2b')][_0xa077('0x46')](_0x4b550d)['then'](handleEntityNotFound(_0x3eabf1,null))['then'](respondWithResult(_0x3eabf1,null))[_0xa077('0x47')](handleError(_0x3eabf1,null));};exports[_0xa077('0x48')]=function(_0x5a2fda,_0x809d17){return db[_0xa077('0x2b')][_0xa077('0x48')](_0x5a2fda[_0xa077('0x49')],{})[_0xa077('0x24')](respondWithResult(_0x809d17,0xc9))[_0xa077('0x47')](handleError(_0x809d17,null));};exports[_0xa077('0x4a')]=function(_0x4d1637,_0x24089a){if(_0x4d1637[_0xa077('0x49')]['id']){delete _0x4d1637[_0xa077('0x49')]['id'];}return db[_0xa077('0x2b')][_0xa077('0x46')]({'where':{'id':_0x4d1637[_0xa077('0x42')]['id']}})[_0xa077('0x24')](handleEntityNotFound(_0x24089a,null))[_0xa077('0x24')](saveUpdates(_0x4d1637['body'],null))[_0xa077('0x24')](respondWithResult(_0x24089a,null))[_0xa077('0x47')](handleError(_0x24089a,null));};exports[_0xa077('0x25')]=function(_0x2594ea,_0x5bea6b){return db[_0xa077('0x2b')]['find']({'where':{'id':_0x2594ea[_0xa077('0x42')]['id']}})[_0xa077('0x24')](handleEntityNotFound(_0x5bea6b,null))[_0xa077('0x24')](removeEntity(_0x5bea6b,null))['catch'](handleError(_0x5bea6b,null));};exports[_0xa077('0x4b')]=function(_0x34c792,_0x46b711,_0x6baa0d){var _0xf0e8d1={};var _0x467839={};var _0x4d8e16;var _0x5eed98;return db[_0xa077('0x2b')][_0xa077('0x4c')]({'where':{'id':_0x34c792[_0xa077('0x42')]['id']}})['then'](handleEntityNotFound(_0x46b711,null))[_0xa077('0x24')](function(_0x3b1fef){if(_0x3b1fef){_0x4d8e16=_0x3b1fef;_0x467839[_0xa077('0x33')]=_[_0xa077('0x43')](db['SalesforceField'][_0xa077('0x2c')]);_0x467839['query']=_['keys'](_0x34c792[_0xa077('0x30')]);_0x467839[_0xa077('0x31')]=_[_0xa077('0x32')](_0x467839[_0xa077('0x33')],_0x467839[_0xa077('0x30')]);_0xf0e8d1[_0xa077('0x34')]=_[_0xa077('0x32')](_0x467839[_0xa077('0x33')],qs[_0xa077('0x44')](_0x34c792['query'][_0xa077('0x44')]));_0xf0e8d1[_0xa077('0x34')]=_0xf0e8d1[_0xa077('0x34')][_0xa077('0x45')]?_0xf0e8d1[_0xa077('0x34')]:_0x467839[_0xa077('0x33')];_0xf0e8d1[_0xa077('0x35')]=qs[_0xa077('0x36')](_0x34c792[_0xa077('0x30')][_0xa077('0x36')]);_0xf0e8d1[_0xa077('0x37')]=qs[_0xa077('0x31')](_[_0xa077('0x38')](_0x34c792[_0xa077('0x30')],_0x467839[_0xa077('0x31')]));if(_0x34c792[_0xa077('0x30')][_0xa077('0x39')]){_0xf0e8d1[_0xa077('0x37')]=_['merge'](_0xf0e8d1[_0xa077('0x37')],{'$or':_[_0xa077('0x2a')](_0xf0e8d1[_0xa077('0x34')],function(_0x94f22d){var _0x380fc7={};_0x380fc7[_0x94f22d]={'$like':'%'+_0x34c792[_0xa077('0x30')][_0xa077('0x39')]+'%'};return _0x380fc7;})});}_0xf0e8d1=_[_0xa077('0x3a')]({},_0xf0e8d1,_0x34c792['options']);return _0x4d8e16['getFields'](_0xf0e8d1);}})[_0xa077('0x24')](function(_0x3d5cff){if(_0x3d5cff){_0x5eed98=_0x3d5cff['length'];if(!_0x34c792['query'][_0xa077('0x4d')](_0xa077('0x4e'))){_0xf0e8d1[_0xa077('0x1e')]=qs[_0xa077('0x1e')](_0x34c792[_0xa077('0x30')][_0xa077('0x1e')]);_0xf0e8d1[_0xa077('0x1c')]=qs[_0xa077('0x1c')](_0x34c792['query'][_0xa077('0x1c')]);}return _0x4d8e16[_0xa077('0x4b')](_0xf0e8d1);}})[_0xa077('0x24')](function(_0x47761b){if(_0x47761b){return _0x47761b?{'count':_0x5eed98,'rows':_0x47761b}:null;}})[_0xa077('0x24')](respondWithResult(_0x46b711,null))['catch'](handleError(_0x46b711,null));};exports[_0xa077('0x4f')]=function(_0x15baf9,_0x337234,_0x396a2d){var _0x69a1b7={};var _0x1c556f={};var _0x330f64;var _0x15a4c6;return db['SalesforceConfiguration'][_0xa077('0x4c')]({'where':{'id':_0x15baf9[_0xa077('0x42')]['id']}})[_0xa077('0x24')](handleEntityNotFound(_0x337234,null))[_0xa077('0x24')](function(_0x9ddcfa){if(_0x9ddcfa){_0x330f64=_0x9ddcfa;_0x1c556f['model']=_[_0xa077('0x43')](db[_0xa077('0x50')][_0xa077('0x2c')]);_0x1c556f[_0xa077('0x30')]=_[_0xa077('0x43')](_0x15baf9[_0xa077('0x30')]);_0x1c556f[_0xa077('0x31')]=_[_0xa077('0x32')](_0x1c556f[_0xa077('0x33')],_0x1c556f[_0xa077('0x30')]);_0x69a1b7[_0xa077('0x34')]=_[_0xa077('0x32')](_0x1c556f['model'],qs[_0xa077('0x44')](_0x15baf9[_0xa077('0x30')][_0xa077('0x44')]));_0x69a1b7[_0xa077('0x34')]=_0x69a1b7[_0xa077('0x34')][_0xa077('0x45')]?_0x69a1b7[_0xa077('0x34')]:_0x1c556f[_0xa077('0x33')];_0x69a1b7[_0xa077('0x35')]=qs[_0xa077('0x36')](_0x15baf9['query']['sort']);_0x69a1b7[_0xa077('0x37')]=qs[_0xa077('0x31')](_['pick'](_0x15baf9['query'],_0x1c556f[_0xa077('0x31')]));if(_0x15baf9[_0xa077('0x30')][_0xa077('0x39')]){_0x69a1b7[_0xa077('0x37')]=_[_0xa077('0x3a')](_0x69a1b7['where'],{'$or':_[_0xa077('0x2a')](_0x69a1b7['attributes'],function(_0x3d43d7){var _0xd991f4={};_0xd991f4[_0x3d43d7]={'$like':'%'+_0x15baf9[_0xa077('0x30')][_0xa077('0x39')]+'%'};return _0xd991f4;})});}_0x69a1b7=_[_0xa077('0x3a')]({},_0x69a1b7,_0x15baf9[_0xa077('0x3c')]);return _0x330f64[_0xa077('0x4f')](_0x69a1b7);}})['then'](function(_0x1e68fd){if(_0x1e68fd){_0x15a4c6=_0x1e68fd['length'];if(!_0x15baf9['query']['hasOwnProperty'](_0xa077('0x4e'))){_0x69a1b7[_0xa077('0x1e')]=qs[_0xa077('0x1e')](_0x15baf9[_0xa077('0x30')]['limit']);_0x69a1b7[_0xa077('0x1c')]=qs[_0xa077('0x1c')](_0x15baf9[_0xa077('0x30')][_0xa077('0x1c')]);}return _0x330f64[_0xa077('0x4f')](_0x69a1b7);}})['then'](function(_0x48bcfa){if(_0x48bcfa){return _0x48bcfa?{'count':_0x15a4c6,'rows':_0x48bcfa}:null;}})[_0xa077('0x24')](respondWithResult(_0x337234,null))[_0xa077('0x47')](handleError(_0x337234,null));};exports[_0xa077('0x51')]=function(_0x30f89b,_0x21ad00,_0x2e602c){var _0x511594={};var _0x3bb596={};var _0x8912a3;var _0x5d0c26;return db[_0xa077('0x2b')]['findOne']({'where':{'id':_0x30f89b[_0xa077('0x42')]['id']}})[_0xa077('0x24')](handleEntityNotFound(_0x21ad00,null))[_0xa077('0x24')](function(_0x3c36a1){if(_0x3c36a1){_0x8912a3=_0x3c36a1;_0x3bb596[_0xa077('0x33')]=_['keys'](db[_0xa077('0x50')][_0xa077('0x2c')]);_0x3bb596[_0xa077('0x30')]=_['keys'](_0x30f89b['query']);_0x3bb596[_0xa077('0x31')]=_[_0xa077('0x32')](_0x3bb596[_0xa077('0x33')],_0x3bb596[_0xa077('0x30')]);_0x511594[_0xa077('0x34')]=_[_0xa077('0x32')](_0x3bb596['model'],qs[_0xa077('0x44')](_0x30f89b[_0xa077('0x30')][_0xa077('0x44')]));_0x511594[_0xa077('0x34')]=_0x511594['attributes']['length']?_0x511594[_0xa077('0x34')]:_0x3bb596[_0xa077('0x33')];_0x511594['order']=qs[_0xa077('0x36')](_0x30f89b[_0xa077('0x30')][_0xa077('0x36')]);_0x511594[_0xa077('0x37')]=qs[_0xa077('0x31')](_['pick'](_0x30f89b[_0xa077('0x30')],_0x3bb596['filters']));if(_0x30f89b[_0xa077('0x30')][_0xa077('0x39')]){_0x511594['where']=_[_0xa077('0x3a')](_0x511594[_0xa077('0x37')],{'$or':_[_0xa077('0x2a')](_0x511594[_0xa077('0x34')],function(_0x2b610f){var _0x346f97={};_0x346f97[_0x2b610f]={'$like':'%'+_0x30f89b['query']['filter']+'%'};return _0x346f97;})});}_0x511594=_[_0xa077('0x3a')]({},_0x511594,_0x30f89b[_0xa077('0x3c')]);return _0x8912a3['getDescriptions'](_0x511594);}})[_0xa077('0x24')](function(_0x5c2d5b){if(_0x5c2d5b){_0x5d0c26=_0x5c2d5b['length'];if(!_0x30f89b[_0xa077('0x30')][_0xa077('0x4d')](_0xa077('0x4e'))){_0x511594[_0xa077('0x1e')]=qs[_0xa077('0x1e')](_0x30f89b[_0xa077('0x30')][_0xa077('0x1e')]);_0x511594[_0xa077('0x1c')]=qs[_0xa077('0x1c')](_0x30f89b[_0xa077('0x30')][_0xa077('0x1c')]);}return _0x8912a3[_0xa077('0x51')](_0x511594);}})[_0xa077('0x24')](function(_0x539348){if(_0x539348){return _0x539348?{'count':_0x5d0c26,'rows':_0x539348}:null;}})[_0xa077('0x24')](respondWithResult(_0x21ad00,null))[_0xa077('0x47')](handleError(_0x21ad00,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 874ff57..fee6e22 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 _0xaccc=['SalesforceConfiguration','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xaccc,0x1ed));var _0xcacc=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xaccc[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0xcacc('0x0'));var util=require(_0xcacc('0x1'));var logger=require(_0xcacc('0x2'))('api');var moment=require(_0xcacc('0x3'));var BPromise=require('bluebird');var rp=require(_0xcacc('0x4'));var fs=require('fs');var path=require(_0xcacc('0x5'));var rimraf=require(_0xcacc('0x6'));var config=require(_0xcacc('0x7'));var attributes=require(_0xcacc('0x8'));module[_0xcacc('0x9')]=function(_0x34dd9f,_0x367816){return _0x34dd9f[_0xcacc('0xa')](_0xcacc('0xb'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f4b=['exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x3f768f,_0x145fe2){var _0x1e7ee5=function(_0x4c7ed3){while(--_0x4c7ed3){_0x3f768f['push'](_0x3f768f['shift']());}};_0x1e7ee5(++_0x145fe2);}(_0x3f4b,0x159));var _0xb3f4=function(_0x3934ba,_0x190450){_0x3934ba=_0x3934ba-0x0;var _0x2ba557=_0x3f4b[_0x3934ba];return _0x2ba557;};'use strict';var _=require(_0xb3f4('0x0'));var util=require(_0xb3f4('0x1'));var logger=require(_0xb3f4('0x2'))(_0xb3f4('0x3'));var moment=require('moment');var BPromise=require(_0xb3f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb3f4('0x5'));var config=require(_0xb3f4('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xb3f4('0x7')]=function(_0x3d0311,_0x4d19bc){return _0x3d0311[_0xb3f4('0x8')](_0xb3f4('0x9'),attributes,{'tableName':_0xb3f4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 458f56c..e823175 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 _0xf320=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x20efe8,_0x70a8c7){var _0x313883=function(_0x33e0b1){while(--_0x33e0b1){_0x20efe8['push'](_0x20efe8['shift']());}};_0x313883(++_0x70a8c7);}(_0xf320,0x68));var _0x0f32=function(_0x3a026c,_0x28b94a){_0x3a026c=_0x3a026c-0x0;var _0x3d5874=_0xf320[_0x3a026c];return _0x3d5874;};'use strict';var _=require(_0x0f32('0x0'));var util=require(_0x0f32('0x1'));var moment=require(_0x0f32('0x2'));var BPromise=require(_0x0f32('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f32('0x4'));var db=require(_0x0f32('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f32('0x6'))(_0x0f32('0x7'));var config=require(_0x0f32('0x8'));var jayson=require(_0x0f32('0x9'));var client=jayson[_0x0f32('0xa')][_0x0f32('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31f093,_0x556d75,_0x2c4850){return new BPromise(function(_0x38fbbd,_0x1cb5d6){return client['request'](_0x31f093,_0x2c4850)[_0x0f32('0xc')](function(_0x243831){logger[_0x0f32('0xd')](_0x0f32('0xe'),_0x556d75,_0x0f32('0xf'));logger[_0x0f32('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x556d75,_0x0f32('0xf'),JSON['stringify'](_0x243831));if(_0x243831['error']){if(_0x243831[_0x0f32('0x11')][_0x0f32('0x12')]===0x1f4){logger[_0x0f32('0x11')](_0x0f32('0xe'),_0x556d75,_0x243831['error'][_0x0f32('0x13')]);return _0x1cb5d6(_0x243831[_0x0f32('0x11')][_0x0f32('0x13')]);}logger['error'](_0x0f32('0xe'),_0x556d75,_0x243831['error']['message']);return _0x38fbbd(_0x243831['error'][_0x0f32('0x13')]);}else{logger['info'](_0x0f32('0xe'),_0x556d75,_0x0f32('0xf'));_0x38fbbd(_0x243831[_0x0f32('0x14')][_0x0f32('0x13')]);}})[_0x0f32('0x15')](function(_0xdb105f){logger[_0x0f32('0x11')](_0x0f32('0xe'),_0x556d75,_0xdb105f);_0x1cb5d6(_0xdb105f);});});} \ No newline at end of file +var _0xe03f=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xe03f,0x170));var _0xfe03=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe03f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xfe03('0x0'));var util=require('util');var moment=require(_0xfe03('0x1'));var BPromise=require(_0xfe03('0x2'));var rs=require(_0xfe03('0x3'));var fs=require('fs');var Redis=require(_0xfe03('0x4'));var db=require(_0xfe03('0x5'))['db'];var utils=require(_0xfe03('0x6'));var logger=require(_0xfe03('0x7'))(_0xfe03('0x8'));var config=require('../../config/environment');var jayson=require(_0xfe03('0x9'));var client=jayson[_0xfe03('0xa')][_0xfe03('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x133c65,_0x37dcd0,_0x871ace){return new BPromise(function(_0x5bc708,_0x107b04){return client['request'](_0x133c65,_0x871ace)[_0xfe03('0xc')](function(_0x129c47){logger[_0xfe03('0xd')](_0xfe03('0xe'),_0x37dcd0,_0xfe03('0xf'));logger[_0xfe03('0x10')](_0xfe03('0x11'),_0x37dcd0,_0xfe03('0xf'),JSON[_0xfe03('0x12')](_0x129c47));if(_0x129c47[_0xfe03('0x13')]){if(_0x129c47['error'][_0xfe03('0x14')]===0x1f4){logger[_0xfe03('0x13')](_0xfe03('0xe'),_0x37dcd0,_0x129c47[_0xfe03('0x13')][_0xfe03('0x15')]);return _0x107b04(_0x129c47[_0xfe03('0x13')][_0xfe03('0x15')]);}logger['error'](_0xfe03('0xe'),_0x37dcd0,_0x129c47[_0xfe03('0x13')][_0xfe03('0x15')]);return _0x5bc708(_0x129c47['error'][_0xfe03('0x15')]);}else{logger[_0xfe03('0xd')](_0xfe03('0xe'),_0x37dcd0,_0xfe03('0xf'));_0x5bc708(_0x129c47['result'][_0xfe03('0x15')]);}})['catch'](function(_0x21af06){logger[_0xfe03('0x13')](_0xfe03('0xe'),_0x37dcd0,_0x21af06);_0x107b04(_0x21af06);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 4e112ad..1318f4c 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 _0xafcd=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete'];(function(_0x35584e,_0x5c72a6){var _0x1533fc=function(_0x42e2a8){while(--_0x42e2a8){_0x35584e['push'](_0x35584e['shift']());}};_0x1533fc(++_0x5c72a6);}(_0xafcd,0x167));var _0xdafc=function(_0x1ac41c,_0x1dacbf){_0x1ac41c=_0x1ac41c-0x0;var _0x561d64=_0xafcd[_0x1ac41c];return _0x561d64;};'use strict';var multer=require('multer');var util=require(_0xdafc('0x0'));var path=require(_0xdafc('0x1'));var timeout=require(_0xdafc('0x2'));var express=require(_0xdafc('0x3'));var router=express[_0xdafc('0x4')]();var fs_extra=require(_0xdafc('0x5'));var auth=require(_0xdafc('0x6'));var interaction=require(_0xdafc('0x7'));var config=require(_0xdafc('0x8'));var controller=require(_0xdafc('0x9'));router['get']('/',auth[_0xdafc('0xa')](),controller[_0xdafc('0xb')]);router[_0xdafc('0xc')](_0xdafc('0xd'),auth[_0xdafc('0xa')](),controller['show']);router[_0xdafc('0xe')]('/',auth[_0xdafc('0xa')](),controller[_0xdafc('0xf')]);router[_0xdafc('0x10')](_0xdafc('0xd'),auth[_0xdafc('0xa')](),controller[_0xdafc('0x11')]);router[_0xdafc('0x12')](_0xdafc('0xd'),auth['isAuthenticated'](),controller[_0xdafc('0x13')]);module[_0xdafc('0x14')]=router; \ No newline at end of file +var _0x7e3d=['./intSalesforceField.controller','get','isAuthenticated','index','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x300f57,_0x38bc92){var _0x369a46=function(_0x3ce60e){while(--_0x3ce60e){_0x300f57['push'](_0x300f57['shift']());}};_0x369a46(++_0x38bc92);}(_0x7e3d,0x7c));var _0xd7e3=function(_0x4aee8a,_0x3198e2){_0x4aee8a=_0x4aee8a-0x0;var _0x51fddb=_0x7e3d[_0x4aee8a];return _0x51fddb;};'use strict';var multer=require(_0xd7e3('0x0'));var util=require(_0xd7e3('0x1'));var path=require(_0xd7e3('0x2'));var timeout=require(_0xd7e3('0x3'));var express=require(_0xd7e3('0x4'));var router=express[_0xd7e3('0x5')]();var fs_extra=require(_0xd7e3('0x6'));var auth=require(_0xd7e3('0x7'));var interaction=require(_0xd7e3('0x8'));var config=require('../../config/environment');var controller=require(_0xd7e3('0x9'));router[_0xd7e3('0xa')]('/',auth[_0xd7e3('0xb')](),controller[_0xd7e3('0xc')]);router[_0xd7e3('0xa')]('/:id',auth[_0xd7e3('0xb')](),controller['show']);router['post']('/',auth[_0xd7e3('0xb')](),controller[_0xd7e3('0xd')]);router[_0xd7e3('0xe')](_0xd7e3('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xd7e3('0x10')](_0xd7e3('0xf'),auth[_0xd7e3('0xb')](),controller[_0xd7e3('0x11')]);module[_0xd7e3('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 8fc5d81..d246afe 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 _0x82a1=['string','keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x82a1,0xcd));var _0x182a=function(_0x43db59,_0x406a05){_0x43db59=_0x43db59-0x0;var _0x582d3e=_0x82a1[_0x43db59];return _0x582d3e;};'use strict';var Sequelize=require(_0x182a('0x0'));module[_0x182a('0x1')]={'type':{'type':Sequelize[_0x182a('0x2')](_0x182a('0x3'),'variable','customVariable',_0x182a('0x4'),_0x182a('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x182a('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x182a('0x2')](_0x182a('0x3'),'variable',_0x182a('0x7'))},'keyContent':{'type':Sequelize[_0x182a('0x6')]},'idField':{'type':Sequelize[_0x182a('0x6')]},'variableName':{'type':Sequelize[_0x182a('0x6')]}}; \ No newline at end of file +var _0xfeab=['STRING','customVariable','exports','ENUM','string','variable','keyValue','picklist'];(function(_0x3a1313,_0x359e39){var _0x42142d=function(_0x321ffe){while(--_0x321ffe){_0x3a1313['push'](_0x3a1313['shift']());}};_0x42142d(++_0x359e39);}(_0xfeab,0xfa));var _0xbfea=function(_0x5d461c,_0x1f11e5){_0x5d461c=_0x5d461c-0x0;var _0x201166=_0xfeab[_0x5d461c];return _0x201166;};'use strict';var Sequelize=require('sequelize');module[_0xbfea('0x0')]={'type':{'type':Sequelize[_0xbfea('0x1')](_0xbfea('0x2'),_0xbfea('0x3'),'customVariable',_0xbfea('0x4'),_0xbfea('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbfea('0x6')]},'key':{'type':Sequelize[_0xbfea('0x6')]},'keyType':{'type':Sequelize[_0xbfea('0x1')](_0xbfea('0x2'),_0xbfea('0x3'),_0xbfea('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbfea('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index ba5b2a7..a26af5e 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 _0xe7b5=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SalesforceField','includeAll','include','findAll','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x20436f,_0x31629b){var _0x2c1abf=function(_0x1f7ee2){while(--_0x1f7ee2){_0x20436f['push'](_0x20436f['shift']());}};_0x2c1abf(++_0x31629b);}(_0xe7b5,0x180));var _0x5e7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe7b5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5e7b('0x0'));var rimraf=require(_0x5e7b('0x1'));var zipdir=require(_0x5e7b('0x2'));var jsonpatch=require(_0x5e7b('0x3'));var rp=require('request-promise');var moment=require(_0x5e7b('0x4'));var BPromise=require(_0x5e7b('0x5'));var Mustache=require('mustache');var util=require(_0x5e7b('0x6'));var path=require(_0x5e7b('0x7'));var sox=require(_0x5e7b('0x8'));var csv=require(_0x5e7b('0x9'));var ejs=require(_0x5e7b('0xa'));var fs=require('fs');var fs_extra=require(_0x5e7b('0xb'));var _=require(_0x5e7b('0xc'));var squel=require(_0x5e7b('0xd'));var crypto=require(_0x5e7b('0xe'));var jsforce=require(_0x5e7b('0xf'));var deskjs=require(_0x5e7b('0x10'));var toCsv=require(_0x5e7b('0x9'));var querystring=require(_0x5e7b('0x11'));var Papa=require(_0x5e7b('0x12'));var Redis=require(_0x5e7b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5e7b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e7b('0x15'));var logger=require(_0x5e7b('0x16'))(_0x5e7b('0x17'));var utils=require(_0x5e7b('0x18'));var config=require(_0x5e7b('0x19'));var licenseUtil=require(_0x5e7b('0x1a'));var db=require(_0x5e7b('0x1b'))['db'];function respondWithStatusCode(_0x37373f,_0x420e7f){_0x420e7f=_0x420e7f||0xcc;return function(_0x5b8777){if(_0x5b8777){return _0x37373f[_0x5e7b('0x1c')](_0x420e7f);}return _0x37373f['status'](_0x420e7f)[_0x5e7b('0x1d')]();};}function respondWithResult(_0x3995e4,_0x3a0d8b){_0x3a0d8b=_0x3a0d8b||0xc8;return function(_0x3761e1){if(_0x3761e1){return _0x3995e4[_0x5e7b('0x1e')](_0x3a0d8b)[_0x5e7b('0x1f')](_0x3761e1);}};}function respondWithFilteredResult(_0x13b8c8,_0x5c3f0c){return function(_0x1f6212){if(_0x1f6212){var _0x581be7=typeof _0x5c3f0c[_0x5e7b('0x20')]==='undefined'&&typeof _0x5c3f0c[_0x5e7b('0x21')]===_0x5e7b('0x22');var _0x4018ea=_0x1f6212[_0x5e7b('0x23')];var _0x23224c=_0x581be7?0x0:_0x5c3f0c[_0x5e7b('0x20')];var _0x3e4818=_0x581be7?_0x1f6212[_0x5e7b('0x23')]:_0x5c3f0c[_0x5e7b('0x20')]+_0x5c3f0c[_0x5e7b('0x21')];var _0x12d8fe;if(_0x3e4818>=_0x4018ea){_0x3e4818=_0x4018ea;_0x12d8fe=0xc8;}else{_0x12d8fe=0xce;}_0x13b8c8['status'](_0x12d8fe);return _0x13b8c8[_0x5e7b('0x24')]('Content-Range',_0x23224c+'-'+_0x3e4818+'/'+_0x4018ea)[_0x5e7b('0x1f')](_0x1f6212);}return null;};}function patchUpdates(_0x4187c8){return function(_0x5d7433){try{jsonpatch[_0x5e7b('0x25')](_0x5d7433,_0x4187c8,!![]);}catch(_0x3123dd){return BPromise[_0x5e7b('0x26')](_0x3123dd);}return _0x5d7433['save']();};}function saveUpdates(_0x4ff2b9,_0x3c45e9){return function(_0x2330e9){if(_0x2330e9){return _0x2330e9['update'](_0x4ff2b9)[_0x5e7b('0x27')](function(_0x53fdef){return _0x53fdef;});}return null;};}function removeEntity(_0x3c52b4,_0x1c744f){return function(_0x955c35){if(_0x955c35){return _0x955c35[_0x5e7b('0x28')]()[_0x5e7b('0x27')](function(){_0x3c52b4[_0x5e7b('0x1e')](0xcc)[_0x5e7b('0x1d')]();});}};}function handleEntityNotFound(_0x4509b3,_0x3c0ed1){return function(_0xc130dc){if(!_0xc130dc){_0x4509b3[_0x5e7b('0x1c')](0x194);}return _0xc130dc;};}function handleError(_0x342159,_0x2d2a6c){_0x2d2a6c=_0x2d2a6c||0x1f4;return function(_0x19bdb7){logger[_0x5e7b('0x29')](_0x19bdb7[_0x5e7b('0x2a')]);if(_0x19bdb7['name']){delete _0x19bdb7[_0x5e7b('0x2b')];}_0x342159[_0x5e7b('0x1e')](_0x2d2a6c)[_0x5e7b('0x2c')](_0x19bdb7);};}exports[_0x5e7b('0x2d')]=function(_0x52acb7,_0x2af8d4){var _0x6a9623={},_0x2e403e={},_0x45a0cf={'count':0x0,'rows':[]};var _0x1f832d=_[_0x5e7b('0x2e')](db['SalesforceField'][_0x5e7b('0x2f')],function(_0x57a310){return{'name':_0x57a310[_0x5e7b('0x30')],'type':_0x57a310[_0x5e7b('0x31')][_0x5e7b('0x32')]};});_0x2e403e[_0x5e7b('0x33')]=_[_0x5e7b('0x2e')](_0x1f832d,_0x5e7b('0x2b'));_0x2e403e[_0x5e7b('0x34')]=_[_0x5e7b('0x35')](_0x52acb7['query']);_0x2e403e[_0x5e7b('0x36')]=_[_0x5e7b('0x37')](_0x2e403e[_0x5e7b('0x33')],_0x2e403e[_0x5e7b('0x34')]);_0x6a9623[_0x5e7b('0x38')]=_['intersection'](_0x2e403e[_0x5e7b('0x33')],qs[_0x5e7b('0x39')](_0x52acb7['query'][_0x5e7b('0x39')]));_0x6a9623[_0x5e7b('0x38')]=_0x6a9623[_0x5e7b('0x38')][_0x5e7b('0x3a')]?_0x6a9623['attributes']:_0x2e403e[_0x5e7b('0x33')];if(!_0x52acb7[_0x5e7b('0x34')][_0x5e7b('0x3b')](_0x5e7b('0x3c'))){_0x6a9623[_0x5e7b('0x21')]=qs[_0x5e7b('0x21')](_0x52acb7[_0x5e7b('0x34')][_0x5e7b('0x21')]);_0x6a9623[_0x5e7b('0x20')]=qs['offset'](_0x52acb7['query']['offset']);}_0x6a9623[_0x5e7b('0x3d')]=qs[_0x5e7b('0x3e')](_0x52acb7['query'][_0x5e7b('0x3e')]);_0x6a9623[_0x5e7b('0x3f')]=qs[_0x5e7b('0x36')](_['pick'](_0x52acb7[_0x5e7b('0x34')],_0x2e403e[_0x5e7b('0x36')]),_0x1f832d);if(_0x52acb7[_0x5e7b('0x34')][_0x5e7b('0x40')]){_0x6a9623[_0x5e7b('0x3f')]=_[_0x5e7b('0x41')](_0x6a9623[_0x5e7b('0x3f')],{'$or':_[_0x5e7b('0x2e')](_0x1f832d,function(_0x26945a){if(_0x26945a[_0x5e7b('0x31')]!==_0x5e7b('0x42')){var _0x58feac={};_0x58feac[_0x26945a['name']]={'$like':'%'+_0x52acb7[_0x5e7b('0x34')][_0x5e7b('0x40')]+'%'};return _0x58feac;}})});}_0x6a9623=_['merge']({},_0x6a9623,_0x52acb7[_0x5e7b('0x43')]);var _0x128a05={'where':_0x6a9623['where']};return db[_0x5e7b('0x44')][_0x5e7b('0x23')](_0x128a05)[_0x5e7b('0x27')](function(_0x79b91a){_0x45a0cf['count']=_0x79b91a;if(_0x52acb7[_0x5e7b('0x34')][_0x5e7b('0x45')]){_0x6a9623[_0x5e7b('0x46')]=[{'all':!![]}];}return db[_0x5e7b('0x44')][_0x5e7b('0x47')](_0x6a9623);})[_0x5e7b('0x27')](function(_0x153708){_0x45a0cf['rows']=_0x153708;return _0x45a0cf;})['then'](respondWithFilteredResult(_0x2af8d4,_0x6a9623))[_0x5e7b('0x48')](handleError(_0x2af8d4,null));};exports[_0x5e7b('0x49')]=function(_0x422c1d,_0x262353){var _0x432a1b={'raw':!![],'where':{'id':_0x422c1d[_0x5e7b('0x4a')]['id']}},_0x327215={};_0x327215[_0x5e7b('0x33')]=_[_0x5e7b('0x35')](db[_0x5e7b('0x44')][_0x5e7b('0x2f')]);_0x327215[_0x5e7b('0x34')]=_[_0x5e7b('0x35')](_0x422c1d['query']);_0x327215[_0x5e7b('0x36')]=_[_0x5e7b('0x37')](_0x327215['model'],_0x327215[_0x5e7b('0x34')]);_0x432a1b['attributes']=_[_0x5e7b('0x37')](_0x327215['model'],qs[_0x5e7b('0x39')](_0x422c1d[_0x5e7b('0x34')][_0x5e7b('0x39')]));_0x432a1b[_0x5e7b('0x38')]=_0x432a1b[_0x5e7b('0x38')][_0x5e7b('0x3a')]?_0x432a1b['attributes']:_0x327215[_0x5e7b('0x33')];if(_0x422c1d[_0x5e7b('0x34')][_0x5e7b('0x45')]){_0x432a1b[_0x5e7b('0x46')]=[{'all':!![]}];}_0x432a1b=_[_0x5e7b('0x41')]({},_0x432a1b,_0x422c1d['options']);return db[_0x5e7b('0x44')][_0x5e7b('0x4b')](_0x432a1b)[_0x5e7b('0x27')](handleEntityNotFound(_0x262353,null))[_0x5e7b('0x27')](respondWithResult(_0x262353,null))[_0x5e7b('0x48')](handleError(_0x262353,null));};exports['create']=function(_0x241965,_0x22feef){return db[_0x5e7b('0x44')][_0x5e7b('0x4c')](_0x241965[_0x5e7b('0x4d')],{})[_0x5e7b('0x27')](respondWithResult(_0x22feef,0xc9))[_0x5e7b('0x48')](handleError(_0x22feef,null));};exports[_0x5e7b('0x4e')]=function(_0x5b7290,_0x2a667b){if(_0x5b7290[_0x5e7b('0x4d')]['id']){delete _0x5b7290[_0x5e7b('0x4d')]['id'];}return db[_0x5e7b('0x44')]['find']({'where':{'id':_0x5b7290['params']['id']}})[_0x5e7b('0x27')](handleEntityNotFound(_0x2a667b,null))[_0x5e7b('0x27')](saveUpdates(_0x5b7290[_0x5e7b('0x4d')],null))[_0x5e7b('0x27')](respondWithResult(_0x2a667b,null))[_0x5e7b('0x48')](handleError(_0x2a667b,null));};exports['destroy']=function(_0x3677be,_0x4b6f24){return db['SalesforceField'][_0x5e7b('0x4b')]({'where':{'id':_0x3677be[_0x5e7b('0x4a')]['id']}})[_0x5e7b('0x27')](handleEntityNotFound(_0x4b6f24,null))[_0x5e7b('0x27')](removeEntity(_0x4b6f24,null))[_0x5e7b('0x48')](handleError(_0x4b6f24,null));}; \ No newline at end of file +var _0xa54a=['set','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','SalesforceField','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xa54a,0xc3));var _0xaa54=function(_0xd43b29,_0x580633){_0xd43b29=_0xd43b29-0x0;var _0x460fff=_0xa54a[_0xd43b29];return _0x460fff;};'use strict';var emlformat=require(_0xaa54('0x0'));var rimraf=require(_0xaa54('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa54('0x2'));var rp=require(_0xaa54('0x3'));var moment=require(_0xaa54('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaa54('0x5'));var util=require(_0xaa54('0x6'));var path=require(_0xaa54('0x7'));var sox=require(_0xaa54('0x8'));var csv=require(_0xaa54('0x9'));var ejs=require(_0xaa54('0xa'));var fs=require('fs');var fs_extra=require(_0xaa54('0xb'));var _=require(_0xaa54('0xc'));var squel=require(_0xaa54('0xd'));var crypto=require(_0xaa54('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xaa54('0xf'));var toCsv=require(_0xaa54('0x9'));var querystring=require(_0xaa54('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa54('0x11'));var qs=require(_0xaa54('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa54('0x13'));var logger=require(_0xaa54('0x14'))(_0xaa54('0x15'));var utils=require(_0xaa54('0x16'));var config=require(_0xaa54('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa54('0x18'))['db'];function respondWithStatusCode(_0x3ce4f1,_0x3186f2){_0x3186f2=_0x3186f2||0xcc;return function(_0x320083){if(_0x320083){return _0x3ce4f1[_0xaa54('0x19')](_0x3186f2);}return _0x3ce4f1[_0xaa54('0x1a')](_0x3186f2)[_0xaa54('0x1b')]();};}function respondWithResult(_0x312b12,_0x136c53){_0x136c53=_0x136c53||0xc8;return function(_0x5075bd){if(_0x5075bd){return _0x312b12[_0xaa54('0x1a')](_0x136c53)[_0xaa54('0x1c')](_0x5075bd);}};}function respondWithFilteredResult(_0x2ec5e5,_0x3f8e6a){return function(_0x38ce57){if(_0x38ce57){var _0x58c529=typeof _0x3f8e6a[_0xaa54('0x1d')]===_0xaa54('0x1e')&&typeof _0x3f8e6a[_0xaa54('0x1f')]==='undefined';var _0x4066b5=_0x38ce57[_0xaa54('0x20')];var _0x4f4708=_0x58c529?0x0:_0x3f8e6a[_0xaa54('0x1d')];var _0x3dd31e=_0x58c529?_0x38ce57[_0xaa54('0x20')]:_0x3f8e6a['offset']+_0x3f8e6a['limit'];var _0x2af526;if(_0x3dd31e>=_0x4066b5){_0x3dd31e=_0x4066b5;_0x2af526=0xc8;}else{_0x2af526=0xce;}_0x2ec5e5['status'](_0x2af526);return _0x2ec5e5[_0xaa54('0x21')](_0xaa54('0x22'),_0x4f4708+'-'+_0x3dd31e+'/'+_0x4066b5)[_0xaa54('0x1c')](_0x38ce57);}return null;};}function patchUpdates(_0x4e5d84){return function(_0x5c1028){try{jsonpatch['apply'](_0x5c1028,_0x4e5d84,!![]);}catch(_0x12d661){return BPromise['reject'](_0x12d661);}return _0x5c1028[_0xaa54('0x23')]();};}function saveUpdates(_0x5f5060,_0x3114bb){return function(_0x2ca678){if(_0x2ca678){return _0x2ca678[_0xaa54('0x24')](_0x5f5060)['then'](function(_0x2702cf){return _0x2702cf;});}return null;};}function removeEntity(_0x1f1612,_0x128d15){return function(_0x3df9c5){if(_0x3df9c5){return _0x3df9c5[_0xaa54('0x25')]()[_0xaa54('0x26')](function(){_0x1f1612[_0xaa54('0x1a')](0xcc)[_0xaa54('0x1b')]();});}};}function handleEntityNotFound(_0x38c623,_0x109500){return function(_0x1f7075){if(!_0x1f7075){_0x38c623[_0xaa54('0x19')](0x194);}return _0x1f7075;};}function handleError(_0x51f1e2,_0xdf9d48){_0xdf9d48=_0xdf9d48||0x1f4;return function(_0x21193e){logger[_0xaa54('0x27')](_0x21193e[_0xaa54('0x28')]);if(_0x21193e[_0xaa54('0x29')]){delete _0x21193e['name'];}_0x51f1e2[_0xaa54('0x1a')](_0xdf9d48)[_0xaa54('0x2a')](_0x21193e);};}exports[_0xaa54('0x2b')]=function(_0x5ee593,_0x3496cd){var _0x3859e8={},_0x4400f2={},_0x59fe89={'count':0x0,'rows':[]};var _0x3580d6=_[_0xaa54('0x2c')](db[_0xaa54('0x2d')]['rawAttributes'],function(_0x4a0c6c){return{'name':_0x4a0c6c['fieldName'],'type':_0x4a0c6c[_0xaa54('0x2e')][_0xaa54('0x2f')]};});_0x4400f2[_0xaa54('0x30')]=_['map'](_0x3580d6,_0xaa54('0x29'));_0x4400f2['query']=_[_0xaa54('0x31')](_0x5ee593[_0xaa54('0x32')]);_0x4400f2[_0xaa54('0x33')]=_[_0xaa54('0x34')](_0x4400f2['model'],_0x4400f2['query']);_0x3859e8[_0xaa54('0x35')]=_['intersection'](_0x4400f2['model'],qs[_0xaa54('0x36')](_0x5ee593[_0xaa54('0x32')][_0xaa54('0x36')]));_0x3859e8[_0xaa54('0x35')]=_0x3859e8[_0xaa54('0x35')][_0xaa54('0x37')]?_0x3859e8[_0xaa54('0x35')]:_0x4400f2[_0xaa54('0x30')];if(!_0x5ee593[_0xaa54('0x32')][_0xaa54('0x38')](_0xaa54('0x39'))){_0x3859e8[_0xaa54('0x1f')]=qs[_0xaa54('0x1f')](_0x5ee593[_0xaa54('0x32')][_0xaa54('0x1f')]);_0x3859e8[_0xaa54('0x1d')]=qs['offset'](_0x5ee593[_0xaa54('0x32')][_0xaa54('0x1d')]);}_0x3859e8[_0xaa54('0x3a')]=qs[_0xaa54('0x3b')](_0x5ee593['query'][_0xaa54('0x3b')]);_0x3859e8[_0xaa54('0x3c')]=qs[_0xaa54('0x33')](_[_0xaa54('0x3d')](_0x5ee593[_0xaa54('0x32')],_0x4400f2[_0xaa54('0x33')]),_0x3580d6);if(_0x5ee593[_0xaa54('0x32')]['filter']){_0x3859e8[_0xaa54('0x3c')]=_['merge'](_0x3859e8[_0xaa54('0x3c')],{'$or':_[_0xaa54('0x2c')](_0x3580d6,function(_0x4e2450){if(_0x4e2450['type']!==_0xaa54('0x3e')){var _0x29ae7c={};_0x29ae7c[_0x4e2450['name']]={'$like':'%'+_0x5ee593[_0xaa54('0x32')][_0xaa54('0x3f')]+'%'};return _0x29ae7c;}})});}_0x3859e8=_[_0xaa54('0x40')]({},_0x3859e8,_0x5ee593[_0xaa54('0x41')]);var _0x243073={'where':_0x3859e8[_0xaa54('0x3c')]};return db[_0xaa54('0x2d')][_0xaa54('0x20')](_0x243073)[_0xaa54('0x26')](function(_0x246562){_0x59fe89['count']=_0x246562;if(_0x5ee593[_0xaa54('0x32')][_0xaa54('0x42')]){_0x3859e8[_0xaa54('0x43')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x3859e8);})['then'](function(_0x19d072){_0x59fe89[_0xaa54('0x44')]=_0x19d072;return _0x59fe89;})[_0xaa54('0x26')](respondWithFilteredResult(_0x3496cd,_0x3859e8))[_0xaa54('0x45')](handleError(_0x3496cd,null));};exports[_0xaa54('0x46')]=function(_0x320c0d,_0x2be0fe){var _0x9b74da={'raw':!![],'where':{'id':_0x320c0d[_0xaa54('0x47')]['id']}},_0x1c7bb4={};_0x1c7bb4[_0xaa54('0x30')]=_[_0xaa54('0x31')](db[_0xaa54('0x2d')][_0xaa54('0x48')]);_0x1c7bb4[_0xaa54('0x32')]=_[_0xaa54('0x31')](_0x320c0d[_0xaa54('0x32')]);_0x1c7bb4[_0xaa54('0x33')]=_[_0xaa54('0x34')](_0x1c7bb4[_0xaa54('0x30')],_0x1c7bb4[_0xaa54('0x32')]);_0x9b74da['attributes']=_['intersection'](_0x1c7bb4[_0xaa54('0x30')],qs[_0xaa54('0x36')](_0x320c0d[_0xaa54('0x32')][_0xaa54('0x36')]));_0x9b74da[_0xaa54('0x35')]=_0x9b74da['attributes'][_0xaa54('0x37')]?_0x9b74da[_0xaa54('0x35')]:_0x1c7bb4[_0xaa54('0x30')];if(_0x320c0d[_0xaa54('0x32')][_0xaa54('0x42')]){_0x9b74da[_0xaa54('0x43')]=[{'all':!![]}];}_0x9b74da=_[_0xaa54('0x40')]({},_0x9b74da,_0x320c0d[_0xaa54('0x41')]);return db[_0xaa54('0x2d')][_0xaa54('0x49')](_0x9b74da)[_0xaa54('0x26')](handleEntityNotFound(_0x2be0fe,null))['then'](respondWithResult(_0x2be0fe,null))[_0xaa54('0x45')](handleError(_0x2be0fe,null));};exports[_0xaa54('0x4a')]=function(_0x4661d3,_0x1c30c7){return db[_0xaa54('0x2d')]['create'](_0x4661d3[_0xaa54('0x4b')],{})['then'](respondWithResult(_0x1c30c7,0xc9))[_0xaa54('0x45')](handleError(_0x1c30c7,null));};exports[_0xaa54('0x24')]=function(_0x1439e0,_0x140548){if(_0x1439e0[_0xaa54('0x4b')]['id']){delete _0x1439e0[_0xaa54('0x4b')]['id'];}return db[_0xaa54('0x2d')]['find']({'where':{'id':_0x1439e0[_0xaa54('0x47')]['id']}})[_0xaa54('0x26')](handleEntityNotFound(_0x140548,null))[_0xaa54('0x26')](saveUpdates(_0x1439e0[_0xaa54('0x4b')],null))[_0xaa54('0x26')](respondWithResult(_0x140548,null))[_0xaa54('0x45')](handleError(_0x140548,null));};exports[_0xaa54('0x25')]=function(_0x589447,_0x23b1f2){return db[_0xaa54('0x2d')][_0xaa54('0x49')]({'where':{'id':_0x589447['params']['id']}})[_0xaa54('0x26')](handleEntityNotFound(_0x23b1f2,null))[_0xaa54('0x26')](removeEntity(_0x23b1f2,null))[_0xaa54('0x45')](handleError(_0x23b1f2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 1f1ace7..21ec298 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 _0xf30c=['define','SalesforceField','int_salesforce_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intSalesforceField.attributes'];(function(_0x51e4c0,_0x31ee02){var _0x3db2e6=function(_0x5e9a3d){while(--_0x5e9a3d){_0x51e4c0['push'](_0x51e4c0['shift']());}};_0x3db2e6(++_0x31ee02);}(_0xf30c,0x1e1));var _0xcf30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf30c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf30('0x0'));var util=require(_0xcf30('0x1'));var logger=require(_0xcf30('0x2'))(_0xcf30('0x3'));var moment=require(_0xcf30('0x4'));var BPromise=require(_0xcf30('0x5'));var rp=require(_0xcf30('0x6'));var fs=require('fs');var path=require(_0xcf30('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcf30('0x8'));module['exports']=function(_0x1c0c4c,_0x180c68){return _0x1c0c4c[_0xcf30('0x9')](_0xcf30('0xa'),attributes,{'tableName':_0xcf30('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xcf30('0xc'),_0xcf30('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x91c0=['exports','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intSalesforceField.attributes'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x91c0,0xc7));var _0x091c=function(_0x35d42c,_0x28508e){_0x35d42c=_0x35d42c-0x0;var _0x51be88=_0x91c0[_0x35d42c];return _0x51be88;};'use strict';var _=require(_0x091c('0x0'));var util=require(_0x091c('0x1'));var logger=require(_0x091c('0x2'))(_0x091c('0x3'));var moment=require(_0x091c('0x4'));var BPromise=require('bluebird');var rp=require(_0x091c('0x5'));var fs=require('fs');var path=require(_0x091c('0x6'));var rimraf=require('rimraf');var config=require(_0x091c('0x7'));var attributes=require(_0x091c('0x8'));module[_0x091c('0x9')]=function(_0x312e32,_0x24b6c7){return _0x312e32['define']('SalesforceField',attributes,{'tableName':_0x091c('0xa'),'paranoid':![],'indexes':[{'name':_0x091c('0xb'),'fields':[_0x091c('0xc'),'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 b55314f..1065ebb 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 _0xab49=['message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x35d2d6,_0x14e944){var _0x1637d5=function(_0x327b04){while(--_0x327b04){_0x35d2d6['push'](_0x35d2d6['shift']());}};_0x1637d5(++_0x14e944);}(_0xab49,0x117));var _0x9ab4=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0xab49[_0x233cb1];return _0x29ee7e;};'use strict';var _=require(_0x9ab4('0x0'));var util=require(_0x9ab4('0x1'));var moment=require(_0x9ab4('0x2'));var BPromise=require(_0x9ab4('0x3'));var rs=require(_0x9ab4('0x4'));var fs=require('fs');var Redis=require(_0x9ab4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9ab4('0x6'))(_0x9ab4('0x7'));var config=require(_0x9ab4('0x8'));var jayson=require(_0x9ab4('0x9'));var client=jayson[_0x9ab4('0xa')][_0x9ab4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a10a3,_0x53ac85,_0x2e8282){return new BPromise(function(_0x482d89,_0x3dfa3f){return client[_0x9ab4('0xc')](_0x5a10a3,_0x2e8282)[_0x9ab4('0xd')](function(_0x3f676a){logger['info'](_0x9ab4('0xe'),_0x53ac85,_0x9ab4('0xf'));logger['debug'](_0x9ab4('0x10'),_0x53ac85,'request\x20sent',JSON[_0x9ab4('0x11')](_0x3f676a));if(_0x3f676a['error']){if(_0x3f676a['error'][_0x9ab4('0x12')]===0x1f4){logger['error'](_0x9ab4('0xe'),_0x53ac85,_0x3f676a[_0x9ab4('0x13')][_0x9ab4('0x14')]);return _0x3dfa3f(_0x3f676a[_0x9ab4('0x13')][_0x9ab4('0x14')]);}logger[_0x9ab4('0x13')]('SalesforceField,\x20%s,\x20%s',_0x53ac85,_0x3f676a[_0x9ab4('0x13')]['message']);return _0x482d89(_0x3f676a['error'][_0x9ab4('0x14')]);}else{logger[_0x9ab4('0x15')](_0x9ab4('0xe'),_0x53ac85,_0x9ab4('0xf'));_0x482d89(_0x3f676a['result']['message']);}})[_0x9ab4('0x16')](function(_0x483b23){logger[_0x9ab4('0x13')]('SalesforceField,\x20%s,\x20%s',_0x53ac85,_0x483b23);_0x3dfa3f(_0x483b23);});});} \ No newline at end of file +var _0x8a66=['rpc','jayson/promise','client','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger'];(function(_0x1950a9,_0x4d55a5){var _0x5b872b=function(_0x3ae374){while(--_0x3ae374){_0x1950a9['push'](_0x1950a9['shift']());}};_0x5b872b(++_0x4d55a5);}(_0x8a66,0x1a3));var _0x68a6=function(_0x263f9d,_0x3d854e){_0x263f9d=_0x263f9d-0x0;var _0x4c4efa=_0x8a66[_0x263f9d];return _0x4c4efa;};'use strict';var _=require(_0x68a6('0x0'));var util=require(_0x68a6('0x1'));var moment=require(_0x68a6('0x2'));var BPromise=require(_0x68a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x68a6('0x4'));var logger=require(_0x68a6('0x5'))(_0x68a6('0x6'));var config=require('../../config/environment');var jayson=require(_0x68a6('0x7'));var client=jayson[_0x68a6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3140c9,_0x59a0f2,_0x1381fa){return new BPromise(function(_0x507e7b,_0x128f75){return client['request'](_0x3140c9,_0x1381fa)['then'](function(_0x3df3bb){logger['info'](_0x68a6('0x9'),_0x59a0f2,'request\x20sent');logger[_0x68a6('0xa')](_0x68a6('0xb'),_0x59a0f2,_0x68a6('0xc'),JSON['stringify'](_0x3df3bb));if(_0x3df3bb['error']){if(_0x3df3bb[_0x68a6('0xd')]['code']===0x1f4){logger[_0x68a6('0xd')](_0x68a6('0x9'),_0x59a0f2,_0x3df3bb[_0x68a6('0xd')]['message']);return _0x128f75(_0x3df3bb[_0x68a6('0xd')][_0x68a6('0xe')]);}logger[_0x68a6('0xd')](_0x68a6('0x9'),_0x59a0f2,_0x3df3bb[_0x68a6('0xd')][_0x68a6('0xe')]);return _0x507e7b(_0x3df3bb[_0x68a6('0xd')]['message']);}else{logger[_0x68a6('0xf')](_0x68a6('0x9'),_0x59a0f2,'request\x20sent');_0x507e7b(_0x3df3bb[_0x68a6('0x10')][_0x68a6('0xe')]);}})['catch'](function(_0x15137e){logger[_0x68a6('0xd')](_0x68a6('0x9'),_0x59a0f2,_0x15137e);_0x128f75(_0x15137e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 75321b8..98da3c8 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 _0xbf1a=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put'];(function(_0x104eb2,_0x3568f4){var _0x331ad2=function(_0x3eb6e4){while(--_0x3eb6e4){_0x104eb2['push'](_0x104eb2['shift']());}};_0x331ad2(++_0x3568f4);}(_0xbf1a,0x7c));var _0xabf1=function(_0x110ab3,_0x4928e3){_0x110ab3=_0x110ab3-0x0;var _0x52ec73=_0xbf1a[_0x110ab3];return _0x52ec73;};'use strict';var multer=require(_0xabf1('0x0'));var util=require(_0xabf1('0x1'));var path=require(_0xabf1('0x2'));var timeout=require(_0xabf1('0x3'));var express=require(_0xabf1('0x4'));var router=express['Router']();var fs_extra=require(_0xabf1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xabf1('0x6'));var config=require(_0xabf1('0x7'));var controller=require(_0xabf1('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xabf1('0x9')]);router['get'](_0xabf1('0xa'),auth[_0xabf1('0xb')](),controller[_0xabf1('0xc')]);router[_0xabf1('0xd')](_0xabf1('0xe'),auth[_0xabf1('0xb')](),controller['getConfigurations']);router[_0xabf1('0xd')](_0xabf1('0xf'),auth[_0xabf1('0xb')](),controller[_0xabf1('0x10')]);router[_0xabf1('0x11')]('/',auth[_0xabf1('0xb')](),controller['create']);router[_0xabf1('0x11')](_0xabf1('0xe'),auth[_0xabf1('0xb')](),controller[_0xabf1('0x12')]);router[_0xabf1('0x13')](_0xabf1('0xa'),auth[_0xabf1('0xb')](),controller[_0xabf1('0x14')]);router[_0xabf1('0x15')](_0xabf1('0xa'),auth['isAuthenticated'](),controller[_0xabf1('0x16')]);module[_0xabf1('0x17')]=router; \ No newline at end of file +var _0x59e0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x29b1a7,_0x4506bb){var _0xdfbf16=function(_0x2a01a1){while(--_0x2a01a1){_0x29b1a7['push'](_0x29b1a7['shift']());}};_0xdfbf16(++_0x4506bb);}(_0x59e0,0x1f4));var _0x059e=function(_0x46ccaf,_0x3dd76d){_0x46ccaf=_0x46ccaf-0x0;var _0xcc40f7=_0x59e0[_0x46ccaf];return _0xcc40f7;};'use strict';var multer=require('multer');var util=require(_0x059e('0x0'));var path=require(_0x059e('0x1'));var timeout=require(_0x059e('0x2'));var express=require(_0x059e('0x3'));var router=express[_0x059e('0x4')]();var fs_extra=require(_0x059e('0x5'));var auth=require(_0x059e('0x6'));var interaction=require(_0x059e('0x7'));var config=require(_0x059e('0x8'));var controller=require(_0x059e('0x9'));router[_0x059e('0xa')]('/',auth[_0x059e('0xb')](),controller['index']);router[_0x059e('0xa')](_0x059e('0xc'),auth[_0x059e('0xb')](),controller['show']);router[_0x059e('0xa')](_0x059e('0xd'),auth[_0x059e('0xb')](),controller[_0x059e('0xe')]);router[_0x059e('0xa')](_0x059e('0xf'),auth[_0x059e('0xb')](),controller[_0x059e('0x10')]);router[_0x059e('0x11')]('/',auth[_0x059e('0xb')](),controller[_0x059e('0x12')]);router['post'](_0x059e('0xd'),auth[_0x059e('0xb')](),controller[_0x059e('0x13')]);router[_0x059e('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x059e('0x15')]);router['delete'](_0x059e('0xc'),auth['isAuthenticated'](),controller[_0x059e('0x16')]);module[_0x059e('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 ea04c10..71e57cd 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 _0x8006=['STRING','username','remoteUri','sequelize','exports'];(function(_0x539eaa,_0xd953ca){var _0xf740ba=function(_0x5022a2){while(--_0x5022a2){_0x539eaa['push'](_0x539eaa['shift']());}};_0xf740ba(++_0xd953ca);}(_0x8006,0x1bb));var _0x6800=function(_0x180136,_0x311af7){_0x180136=_0x180136-0x0;var _0x4c01b8=_0x8006[_0x180136];return _0x4c01b8;};'use strict';var Sequelize=require(_0x6800('0x0'));module[_0x6800('0x1')]={'name':{'type':Sequelize[_0x6800('0x2')]},'description':{'type':Sequelize[_0x6800('0x2')]},'username':{'type':Sequelize[_0x6800('0x2')],'unique':_0x6800('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6800('0x2')],'unique':_0x6800('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x46db=['exports','STRING','username','sequelize'];(function(_0x57aec1,_0x2b6744){var _0x4597ae=function(_0x505364){while(--_0x505364){_0x57aec1['push'](_0x57aec1['shift']());}};_0x4597ae(++_0x2b6744);}(_0x46db,0x8f));var _0xb46d=function(_0x20dc85,_0x5d4aaa){_0x20dc85=_0x20dc85-0x0;var _0x557257=_0x46db[_0x20dc85];return _0x557257;};'use strict';var Sequelize=require(_0xb46d('0x0'));module[_0xb46d('0x1')]={'name':{'type':Sequelize[_0xb46d('0x2')]},'description':{'type':Sequelize[_0xb46d('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xb46d('0x3')},'password':{'type':Sequelize[_0xb46d('0x2')]},'email':{'type':Sequelize[_0xb46d('0x2')]},'remoteUri':{'type':Sequelize[_0xb46d('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xb46d('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 6165113..378c50c 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 _0xa177=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','count','limit','status','set','apply','reject','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','include','ServicenowAccount','rows','show','params','find','catch','create','body','getConfigurations','ServicenowConfiguration','order','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','number','resolved_by','sys_updated_by','opened_by','user_input','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','reopened_time','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','reassignment_count','assigned_to','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','remove','includes','forEach','internalType','label','push','all','assign','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','stack','statusCode','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','eml-format','rimraf','fast-json-patch','moment','sox','ejs','fs-extra'];(function(_0xba02fb,_0xf1c006){var _0x1bf44c=function(_0xd4a52f){while(--_0xd4a52f){_0xba02fb['push'](_0xba02fb['shift']());}};_0x1bf44c(++_0xf1c006);}(_0xa177,0xa9));var _0x7a17=function(_0x54f5f8,_0x1e307a){_0x54f5f8=_0x54f5f8-0x0;var _0x309af4=_0xa177[_0x54f5f8];return _0x309af4;};'use strict';var emlformat=require(_0x7a17('0x0'));var rimraf=require(_0x7a17('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a17('0x2'));var rp=require('request-promise');var moment=require(_0x7a17('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7a17('0x4'));var csv=require('to-csv');var ejs=require(_0x7a17('0x5'));var fs=require('fs');var fs_extra=require(_0x7a17('0x6'));var _=require(_0x7a17('0x7'));var squel=require(_0x7a17('0x8'));var crypto=require(_0x7a17('0x9'));var jsforce=require(_0x7a17('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7a17('0xb'));var Papa=require(_0x7a17('0xc'));var Redis=require(_0x7a17('0xd'));var authService=require(_0x7a17('0xe'));var qs=require(_0x7a17('0xf'));var as=require(_0x7a17('0x10'));var hardwareService=require(_0x7a17('0x11'));var logger=require('../../config/logger')(_0x7a17('0x12'));var utils=require(_0x7a17('0x13'));var config=require(_0x7a17('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7a17('0x15'))['db'];var integrations=require(_0x7a17('0x16'));function respondWithStatusCode(_0x3a4e2d,_0x52ea02){_0x52ea02=_0x52ea02||0xcc;return function(_0x5d0d43){if(_0x5d0d43){return _0x3a4e2d[_0x7a17('0x17')](_0x52ea02);}return _0x3a4e2d['status'](_0x52ea02)[_0x7a17('0x18')]();};}function respondWithResult(_0x4bf8b5,_0x338b4f){_0x338b4f=_0x338b4f||0xc8;return function(_0x3f988f){if(_0x3f988f){return _0x4bf8b5['status'](_0x338b4f)[_0x7a17('0x19')](_0x3f988f);}};}function respondWithFilteredResult(_0x32351b,_0xad1357){return function(_0x52a284){if(_0x52a284){var _0x5d11c3=typeof _0xad1357[_0x7a17('0x1a')]===_0x7a17('0x1b')&&typeof _0xad1357['limit']===_0x7a17('0x1b');var _0x1935e7=_0x52a284[_0x7a17('0x1c')];var _0x8daf59=_0x5d11c3?0x0:_0xad1357['offset'];var _0x31cbc9=_0x5d11c3?_0x52a284[_0x7a17('0x1c')]:_0xad1357['offset']+_0xad1357[_0x7a17('0x1d')];var _0x20a0a9;if(_0x31cbc9>=_0x1935e7){_0x31cbc9=_0x1935e7;_0x20a0a9=0xc8;}else{_0x20a0a9=0xce;}_0x32351b[_0x7a17('0x1e')](_0x20a0a9);return _0x32351b[_0x7a17('0x1f')]('Content-Range',_0x8daf59+'-'+_0x31cbc9+'/'+_0x1935e7)[_0x7a17('0x19')](_0x52a284);}return null;};}function patchUpdates(_0x5a04bd){return function(_0x57fb94){try{jsonpatch[_0x7a17('0x20')](_0x57fb94,_0x5a04bd,!![]);}catch(_0x25bb6f){return BPromise[_0x7a17('0x21')](_0x25bb6f);}return _0x57fb94[_0x7a17('0x22')]();};}function saveUpdates(_0x18788b,_0x5de873){return function(_0x181531){if(_0x181531){return _0x181531[_0x7a17('0x23')](_0x18788b)[_0x7a17('0x24')](function(_0x10666e){return _0x10666e;});}return null;};}function removeEntity(_0x3fb0a7,_0x3cd0ca){return function(_0x39d729){if(_0x39d729){return _0x39d729[_0x7a17('0x25')]()[_0x7a17('0x24')](function(){_0x3fb0a7[_0x7a17('0x1e')](0xcc)[_0x7a17('0x18')]();});}};}function handleEntityNotFound(_0x2cf535,_0x40d833){return function(_0x9b96a4){if(!_0x9b96a4){_0x2cf535[_0x7a17('0x17')](0x194);}return _0x9b96a4;};}function handleError(_0x3df697,_0x1ffa5c){_0x1ffa5c=_0x1ffa5c||0x1f4;return function(_0x16e6f0){logger[_0x7a17('0x26')](_0x16e6f0['stack']);if(_0x16e6f0[_0x7a17('0x27')]){delete _0x16e6f0['name'];}_0x3df697[_0x7a17('0x1e')](_0x1ffa5c)[_0x7a17('0x28')](_0x16e6f0);};}exports['index']=function(_0x11f262,_0x59ec18){var _0x4d71f9={},_0x5de3f2={},_0x31c82b={'count':0x0,'rows':[]};var _0x233bb9=_[_0x7a17('0x29')](db['ServicenowAccount'][_0x7a17('0x2a')],function(_0x2e41bd){return{'name':_0x2e41bd[_0x7a17('0x2b')],'type':_0x2e41bd[_0x7a17('0x2c')][_0x7a17('0x2d')]};});_0x5de3f2[_0x7a17('0x2e')]=_[_0x7a17('0x29')](_0x233bb9,_0x7a17('0x27'));_0x5de3f2[_0x7a17('0x2f')]=_[_0x7a17('0x30')](_0x11f262['query']);_0x5de3f2[_0x7a17('0x31')]=_[_0x7a17('0x32')](_0x5de3f2[_0x7a17('0x2e')],_0x5de3f2[_0x7a17('0x2f')]);_0x4d71f9[_0x7a17('0x33')]=_['intersection'](_0x5de3f2[_0x7a17('0x2e')],qs[_0x7a17('0x34')](_0x11f262[_0x7a17('0x2f')][_0x7a17('0x34')]));_0x4d71f9[_0x7a17('0x33')]=_0x4d71f9[_0x7a17('0x33')][_0x7a17('0x35')]?_0x4d71f9[_0x7a17('0x33')]:_0x5de3f2['model'];if(!_0x11f262[_0x7a17('0x2f')]['hasOwnProperty'](_0x7a17('0x36'))){_0x4d71f9[_0x7a17('0x1d')]=qs[_0x7a17('0x1d')](_0x11f262[_0x7a17('0x2f')][_0x7a17('0x1d')]);_0x4d71f9['offset']=qs[_0x7a17('0x1a')](_0x11f262['query'][_0x7a17('0x1a')]);}_0x4d71f9['order']=qs['sort'](_0x11f262[_0x7a17('0x2f')][_0x7a17('0x37')]);_0x4d71f9['where']=qs[_0x7a17('0x31')](_[_0x7a17('0x38')](_0x11f262[_0x7a17('0x2f')],_0x5de3f2[_0x7a17('0x31')]),_0x233bb9);if(_0x11f262[_0x7a17('0x2f')][_0x7a17('0x39')]){_0x4d71f9['where']=_[_0x7a17('0x3a')](_0x4d71f9[_0x7a17('0x3b')],{'$or':_[_0x7a17('0x29')](_0x233bb9,function(_0x4bc9f2){if(_0x4bc9f2[_0x7a17('0x2c')]!==_0x7a17('0x3c')){var _0x4b72e2={};_0x4b72e2[_0x4bc9f2[_0x7a17('0x27')]]={'$like':'%'+_0x11f262[_0x7a17('0x2f')][_0x7a17('0x39')]+'%'};return _0x4b72e2;}})});}_0x4d71f9=_[_0x7a17('0x3a')]({},_0x4d71f9,_0x11f262[_0x7a17('0x3d')]);var _0x1a7c7e={'where':_0x4d71f9['where']};return db['ServicenowAccount']['count'](_0x1a7c7e)[_0x7a17('0x24')](function(_0x1b8034){_0x31c82b[_0x7a17('0x1c')]=_0x1b8034;if(_0x11f262[_0x7a17('0x2f')]['includeAll']){_0x4d71f9[_0x7a17('0x3e')]=[{'all':!![]}];}return db[_0x7a17('0x3f')]['findAll'](_0x4d71f9);})[_0x7a17('0x24')](function(_0x3ca94b){_0x31c82b[_0x7a17('0x40')]=_0x3ca94b;return _0x31c82b;})[_0x7a17('0x24')](respondWithFilteredResult(_0x59ec18,_0x4d71f9))['catch'](handleError(_0x59ec18,null));};exports[_0x7a17('0x41')]=function(_0xe8dea7,_0x397ecb){var _0x2950db={'raw':![],'where':{'id':_0xe8dea7[_0x7a17('0x42')]['id']}},_0x48b56e={};_0x48b56e[_0x7a17('0x2e')]=_['keys'](db['ServicenowAccount']['rawAttributes']);_0x48b56e[_0x7a17('0x2f')]=_['keys'](_0xe8dea7[_0x7a17('0x2f')]);_0x48b56e[_0x7a17('0x31')]=_[_0x7a17('0x32')](_0x48b56e[_0x7a17('0x2e')],_0x48b56e[_0x7a17('0x2f')]);_0x2950db['attributes']=_['intersection'](_0x48b56e[_0x7a17('0x2e')],qs[_0x7a17('0x34')](_0xe8dea7[_0x7a17('0x2f')]['fields']));_0x2950db[_0x7a17('0x33')]=_0x2950db[_0x7a17('0x33')][_0x7a17('0x35')]?_0x2950db['attributes']:_0x48b56e[_0x7a17('0x2e')];if(_0xe8dea7[_0x7a17('0x2f')]['includeAll']){_0x2950db[_0x7a17('0x3e')]=[{'all':!![]}];}_0x2950db=_['merge']({},_0x2950db,_0xe8dea7[_0x7a17('0x3d')]);return db[_0x7a17('0x3f')][_0x7a17('0x43')](_0x2950db)['then'](handleEntityNotFound(_0x397ecb,null))[_0x7a17('0x24')](respondWithResult(_0x397ecb,null))[_0x7a17('0x44')](handleError(_0x397ecb,null));};exports[_0x7a17('0x45')]=function(_0x204a0f,_0x274c80){return db[_0x7a17('0x3f')][_0x7a17('0x45')](_0x204a0f[_0x7a17('0x46')],{})['then'](respondWithResult(_0x274c80,0xc9))[_0x7a17('0x44')](handleError(_0x274c80,null));};exports[_0x7a17('0x23')]=function(_0x2476aa,_0x58d714){if(_0x2476aa[_0x7a17('0x46')]['id']){delete _0x2476aa['body']['id'];}return db['ServicenowAccount'][_0x7a17('0x43')]({'where':{'id':_0x2476aa['params']['id']}})[_0x7a17('0x24')](handleEntityNotFound(_0x58d714,null))[_0x7a17('0x24')](saveUpdates(_0x2476aa[_0x7a17('0x46')],null))['then'](respondWithResult(_0x58d714,null))['catch'](handleError(_0x58d714,null));};exports[_0x7a17('0x25')]=function(_0x33e5c9,_0x5562ca){return db[_0x7a17('0x3f')]['find']({'where':{'id':_0x33e5c9[_0x7a17('0x42')]['id']}})[_0x7a17('0x24')](handleEntityNotFound(_0x5562ca,null))[_0x7a17('0x24')](removeEntity(_0x5562ca,null))[_0x7a17('0x44')](handleError(_0x5562ca,null));};exports[_0x7a17('0x47')]=function(_0x5a256b,_0x2fb7a7,_0x1ebc75){var _0x32b1ab={};var _0x12f1c5={};var _0x4dd0ae;var _0x205883;return db[_0x7a17('0x3f')]['findOne']({'where':{'id':_0x5a256b[_0x7a17('0x42')]['id']}})['then'](handleEntityNotFound(_0x2fb7a7,null))[_0x7a17('0x24')](function(_0x1595c7){if(_0x1595c7){_0x4dd0ae=_0x1595c7;_0x12f1c5[_0x7a17('0x2e')]=_[_0x7a17('0x30')](db[_0x7a17('0x48')][_0x7a17('0x2a')]);_0x12f1c5['query']=_[_0x7a17('0x30')](_0x5a256b[_0x7a17('0x2f')]);_0x12f1c5[_0x7a17('0x31')]=_[_0x7a17('0x32')](_0x12f1c5[_0x7a17('0x2e')],_0x12f1c5['query']);_0x32b1ab['attributes']=_['intersection'](_0x12f1c5[_0x7a17('0x2e')],qs[_0x7a17('0x34')](_0x5a256b[_0x7a17('0x2f')]['fields']));_0x32b1ab['attributes']=_0x32b1ab[_0x7a17('0x33')][_0x7a17('0x35')]?_0x32b1ab['attributes']:_0x12f1c5[_0x7a17('0x2e')];_0x32b1ab[_0x7a17('0x49')]=qs['sort'](_0x5a256b[_0x7a17('0x2f')][_0x7a17('0x37')]);_0x32b1ab[_0x7a17('0x3b')]=qs[_0x7a17('0x31')](_[_0x7a17('0x38')](_0x5a256b['query'],_0x12f1c5[_0x7a17('0x31')]));if(_0x5a256b[_0x7a17('0x2f')][_0x7a17('0x39')]){_0x32b1ab[_0x7a17('0x3b')]=_[_0x7a17('0x3a')](_0x32b1ab[_0x7a17('0x3b')],{'$or':_[_0x7a17('0x29')](_0x32b1ab[_0x7a17('0x33')],function(_0x155a06){var _0x48be77={};_0x48be77[_0x155a06]={'$like':'%'+_0x5a256b['query'][_0x7a17('0x39')]+'%'};return _0x48be77;})});}_0x32b1ab=_[_0x7a17('0x3a')]({},_0x32b1ab,_0x5a256b[_0x7a17('0x3d')]);return _0x4dd0ae[_0x7a17('0x47')](_0x32b1ab);}})['then'](function(_0x5bc902){if(_0x5bc902){_0x205883=_0x5bc902[_0x7a17('0x35')];if(!_0x5a256b[_0x7a17('0x2f')][_0x7a17('0x4a')]('nolimit')){_0x32b1ab[_0x7a17('0x1d')]=qs['limit'](_0x5a256b[_0x7a17('0x2f')]['limit']);_0x32b1ab['offset']=qs['offset'](_0x5a256b['query']['offset']);}return _0x4dd0ae[_0x7a17('0x47')](_0x32b1ab);}})[_0x7a17('0x24')](function(_0x685e7){if(_0x685e7){return _0x685e7?{'count':_0x205883,'rows':_0x685e7}:null;}})[_0x7a17('0x24')](respondWithResult(_0x2fb7a7,null))[_0x7a17('0x44')](handleError(_0x2fb7a7,null));};exports['addConfiguration']=function(_0x3fed0a,_0x2b1cb7,_0x40b607){if(_0x3fed0a[_0x7a17('0x46')]['id']){delete _0x3fed0a[_0x7a17('0x46')]['id'];}return db[_0x7a17('0x3f')][_0x7a17('0x4b')]({'where':{'id':_0x3fed0a[_0x7a17('0x42')]['id']}})[_0x7a17('0x24')](handleEntityNotFound(_0x2b1cb7,null))[_0x7a17('0x24')](function(_0x32e523){if(_0x32e523){_0x3fed0a[_0x7a17('0x46')][_0x7a17('0x4c')]=_0x32e523['id'];_0x3fed0a['body'][_0x7a17('0x4d')]=integrations[_0x7a17('0x4e')](_0x3fed0a[_0x7a17('0x46')][_0x7a17('0x4f')],_0x3fed0a[_0x7a17('0x46')][_0x7a17('0x2c')]);_0x3fed0a['body'][_0x7a17('0x50')]=integrations['getDescriptions'](_0x3fed0a[_0x7a17('0x46')][_0x7a17('0x4f')],_0x3fed0a[_0x7a17('0x46')][_0x7a17('0x2c')]);return db[_0x7a17('0x48')]['create'](_0x3fed0a[_0x7a17('0x46')],{'include':[{'model':db[_0x7a17('0x51')],'as':_0x7a17('0x4d')},{'model':db[_0x7a17('0x51')],'as':_0x7a17('0x50')}]});}return null;})[_0x7a17('0x24')](respondWithResult(_0x2b1cb7,null))[_0x7a17('0x44')](handleError(_0x2b1cb7,null));};exports[_0x7a17('0x52')]=function(_0x12a959,_0x5b7cff,_0x42230d){var _0x141c0a=[_0x7a17('0x53'),_0x7a17('0x54'),_0x7a17('0x55'),_0x7a17('0x56'),'close_code','notify',_0x7a17('0x57'),_0x7a17('0x58'),_0x7a17('0x59')];var _0x4244a8=[_0x7a17('0x5a'),_0x7a17('0x53'),_0x7a17('0x5b'),_0x7a17('0x5c'),_0x7a17('0x5d'),'sys_updated_on','child_incidents',_0x7a17('0x54'),'approval_history',_0x7a17('0x5e'),_0x7a17('0x5f'),_0x7a17('0x60'),_0x7a17('0x61'),_0x7a17('0x62'),'sys_created_on','sys_domain','state','sys_created_by','knowledge','order',_0x7a17('0x63'),_0x7a17('0x64'),_0x7a17('0x65'),_0x7a17('0x66'),_0x7a17('0x67'),_0x7a17('0x68'),_0x7a17('0x69'),_0x7a17('0x6a'),_0x7a17('0x6b'),_0x7a17('0x6c'),_0x7a17('0x6d'),_0x7a17('0x6e'),_0x7a17('0x6f'),_0x7a17('0x70'),_0x7a17('0x71'),'group_list','work_end',_0x7a17('0x72'),'resolved_at',_0x7a17('0x73'),_0x7a17('0x74'),_0x7a17('0x56'),_0x7a17('0x75'),_0x7a17('0x76'),'close_code',_0x7a17('0x77'),_0x7a17('0x78'),_0x7a17('0x79'),_0x7a17('0x7a'),_0x7a17('0x7b'),_0x7a17('0x7c'),_0x7a17('0x7d'),'calendar_duration','notify',_0x7a17('0x7e'),_0x7a17('0x7f'),_0x7a17('0x80'),_0x7a17('0x81'),'parent_incident',_0x7a17('0x82'),_0x7a17('0x83'),_0x7a17('0x84'),_0x7a17('0x57'),'urgency','problem_id','company',_0x7a17('0x85'),'activity_due',_0x7a17('0x86'),_0x7a17('0x58'),_0x7a17('0x87'),_0x7a17('0x88'),'approval',_0x7a17('0x89'),_0x7a17('0x8a'),_0x7a17('0x8b'),_0x7a17('0x8c'),'sys_tags','escalation',_0x7a17('0x8d'),_0x7a17('0x8e'),_0x7a17('0x8f'),_0x7a17('0x59')];var _0x2c6c61='';var _0xa11ba2='';var _0x1d1879=[];var _0x488bf5='';var _0x573d32='';var _0x494a1b=[];var _0x490731='';var _0x2000d9='';var _0x44c783={};var _0x5e2cec='';return db[_0x7a17('0x3f')][_0x7a17('0x4b')]({'where':{'id':_0x12a959[_0x7a17('0x42')]['id']},'attributes':['id',_0x7a17('0x90'),_0x7a17('0x91'),_0x7a17('0x92'),_0x7a17('0x93'),_0x7a17('0x94')]})[_0x7a17('0x24')](handleEntityNotFound(_0x5b7cff,null))[_0x7a17('0x24')](function(_0x4e80b5){if(_0x4e80b5){_0x5e2cec=_0x4e80b5[_0x7a17('0x93')];var _0x53d2a5=_0x5e2cec['slice'](-0x1);if(_0x53d2a5==='/'){_0x5e2cec=_0x5e2cec[_0x7a17('0x95')](0x0,_0x5e2cec[_0x7a17('0x96')](_0x53d2a5));}_0x2000d9=util[_0x7a17('0x97')](_0x7a17('0x98'),_0x5e2cec);_0x490731=util[_0x7a17('0x97')](_0x7a17('0x99'),_0x5e2cec);_0x44c783={'user':_0x4e80b5[_0x7a17('0x90')],'pass':_0x4e80b5[_0x7a17('0x91')]};var _0x597130={'method':_0x7a17('0x9a'),'uri':_0x2000d9+_0x7a17('0x9b'),'auth':_0x44c783,'json':!![]};return rp(_0x597130);}})[_0x7a17('0x24')](function(_0x2602da){if(_0x2602da[_0x7a17('0x9c')]['length']>0x0){_0x2c6c61=_0x2602da['result'];}console[_0x7a17('0x9d')]('incident\x20table\x20objects',_0x2c6c61);_0x494a1b=[];_0xa11ba2=Object['assign']([],_0x2c6c61);_[_0x7a17('0x9e')](_0xa11ba2,function(_0x5ab764){return!_0x141c0a[_0x7a17('0x9f')](_0x5ab764[_0x7a17('0x27')]);});_0xa11ba2[_0x7a17('0xa0')](function(_0x27f70a){var _0x3273e6=createFieldObject(_0x490731,_0x44c783,_0x27f70a[_0x7a17('0xa1')],_0x27f70a['name'],_0x27f70a[_0x7a17('0xa2')],![]);_0x494a1b[_0x7a17('0xa3')](_0x3273e6);});return Promise[_0x7a17('0xa4')](_0x494a1b);})[_0x7a17('0x24')](function(_0x6eebf5){_0x1d1879=_0x6eebf5;_0x488bf5=Object[_0x7a17('0xa5')]([],_0x2c6c61);console[_0x7a17('0x9d')]('TCL:\x20_object',_0x2c6c61);_[_0x7a17('0x9e')](_0x488bf5,function(_0x7ae39){return _0x4244a8[_0x7a17('0x9f')](_0x7ae39['name']);});console[_0x7a17('0x9d')](_0x7a17('0xa6'),_0x488bf5);_0x494a1b=[];_0x488bf5[_0x7a17('0xa0')](function(_0x2851a7){var _0x5b90f6=createFieldObject(_0x490731,_0x44c783,_0x2851a7[_0x7a17('0xa1')],_0x2851a7[_0x7a17('0x27')],_0x2851a7['label'],!![]);_0x494a1b[_0x7a17('0xa3')](_0x5b90f6);});return Promise[_0x7a17('0xa4')](_0x494a1b);})['then'](function(_0x3ce8b3){_0x573d32=_0x3ce8b3;var _0x10bc34=_0x1d1879['concat'](_0x573d32);return{'count':_0x10bc34[_0x7a17('0x35')],'rows':_0x10bc34};})[_0x7a17('0x24')](respondWithResult(_0x5b7cff,null))[_0x7a17('0x44')](function(_0x23359a){console[_0x7a17('0x9d')](_0x7a17('0xa7')+_0x23359a);var _0x436ff2=_0x12a959[_0x7a17('0x2f')][_0x7a17('0xa8')]?0x1f4:_0x23359a['statusCode']||0x1f4;logger['error'](_0x23359a[_0x7a17('0xa9')]);delete _0x23359a[_0x7a17('0x27')];if(_0x436ff2===0x191){_0x436ff2=0x190;}_0x5b7cff['status'](_0x436ff2)[_0x7a17('0x28')](_0x12a959[_0x7a17('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x23359a[_0x7a17('0xaa')]}:_0x23359a);});};function createFieldObject(_0x12b8dd,_0x370096,_0x2f9fa1,_0x5af821,_0x54f8db,_0x34d01e){return new Promise(function(_0xd39f5b,_0x54e838){var _0x4c56e8={'id':_0x5af821,'name':_0x54f8db,'custom':_0x34d01e};if(_0x2f9fa1==='boolean'){_0x4c56e8['options']=[{'name':_0x7a17('0xab'),'value':_0x7a17('0xac')},{'name':_0x7a17('0xad'),'value':_0x7a17('0xae')}];_0xd39f5b(_0x4c56e8);}else{var _0x3ba17d={'method':'GET','uri':_0x12b8dd+_0x7a17('0xaf')+_0x5af821,'auth':_0x370096,'json':!![]};return rp(_0x3ba17d)[_0x7a17('0x24')](function(_0x13617c){var _0x248fa8=[];if(_0x13617c[_0x7a17('0x9c')][_0x7a17('0x35')]>0x0){_0x13617c[_0x7a17('0x9c')]['forEach'](function(_0x5ed92f){if(_0x5ed92f['inactive']===_0x7a17('0xae')){var _0x237bda={'name':_0x5ed92f[_0x7a17('0xa2')],'value':_0x5ed92f['value']};_0x248fa8[_0x7a17('0xa3')](_0x237bda);}});}_0x4c56e8[_0x7a17('0x3d')]=_0x248fa8;if(_0x4c56e8[_0x7a17('0x3d')]['length']>0x0){_0xd39f5b(_0x4c56e8);}else{if(_0x34d01e==![]){_0xd39f5b();}else{_0xd39f5b(_0x4c56e8);}}});}});} \ No newline at end of file +var _0x48e1=['boolean','True','true','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','error','stack','index','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','name','filter','options','ServicenowAccount','includeAll','include','findAll','then','rows','catch','show','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','pick','nolimit','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','closed_at','cmdb_ci','impact','active','business_service','time_worked','expected_start','opened_at','group_list','work_end','resolved_at','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','additional_assignee_list','calendar_duration','close_notes','closed_by','follow_up','parent_incident','contact_type','urgency','problem_id','company','reassignment_count','activity_due','severity','comments','sla_due','reopen_count','sys_tags','escalation','correlation_id','location','username','password','email','remoteUri','slice','lastIndexOf','%s/api/now/doc/table/schema/','format','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','statusCode','send'];(function(_0x163c73,_0x31230c){var _0x5e1d3c=function(_0x47ea0a){while(--_0x47ea0a){_0x163c73['push'](_0x163c73['shift']());}};_0x5e1d3c(++_0x31230c);}(_0x48e1,0x16b));var _0x148e=function(_0xf1fb0d,_0xb508b9){_0xf1fb0d=_0xf1fb0d-0x0;var _0x44d17a=_0x48e1[_0xf1fb0d];return _0x44d17a;};'use strict';var emlformat=require(_0x148e('0x0'));var rimraf=require(_0x148e('0x1'));var zipdir=require(_0x148e('0x2'));var jsonpatch=require(_0x148e('0x3'));var rp=require(_0x148e('0x4'));var moment=require(_0x148e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x148e('0x6'));var util=require(_0x148e('0x7'));var path=require(_0x148e('0x8'));var sox=require(_0x148e('0x9'));var csv=require(_0x148e('0xa'));var ejs=require(_0x148e('0xb'));var fs=require('fs');var fs_extra=require(_0x148e('0xc'));var _=require(_0x148e('0xd'));var squel=require(_0x148e('0xe'));var crypto=require(_0x148e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x148e('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x148e('0x11'));var Redis=require('ioredis');var authService=require(_0x148e('0x12'));var qs=require(_0x148e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x148e('0x14'));var logger=require('../../config/logger')(_0x148e('0x15'));var utils=require(_0x148e('0x16'));var config=require(_0x148e('0x17'));var licenseUtil=require(_0x148e('0x18'));var db=require(_0x148e('0x19'))['db'];var integrations=require(_0x148e('0x1a'));function respondWithStatusCode(_0x5d9f9b,_0x59be7a){_0x59be7a=_0x59be7a||0xcc;return function(_0x1b013f){if(_0x1b013f){return _0x5d9f9b[_0x148e('0x1b')](_0x59be7a);}return _0x5d9f9b[_0x148e('0x1c')](_0x59be7a)[_0x148e('0x1d')]();};}function respondWithResult(_0x1539fe,_0xcab444){_0xcab444=_0xcab444||0xc8;return function(_0x5344bb){if(_0x5344bb){return _0x1539fe[_0x148e('0x1c')](_0xcab444)[_0x148e('0x1e')](_0x5344bb);}};}function respondWithFilteredResult(_0x425f19,_0x3f5d16){return function(_0x1b6bfd){if(_0x1b6bfd){var _0x2c9523=typeof _0x3f5d16[_0x148e('0x1f')]==='undefined'&&typeof _0x3f5d16[_0x148e('0x20')]===_0x148e('0x21');var _0x156732=_0x1b6bfd[_0x148e('0x22')];var _0xd94554=_0x2c9523?0x0:_0x3f5d16[_0x148e('0x1f')];var _0x2dc8bf=_0x2c9523?_0x1b6bfd[_0x148e('0x22')]:_0x3f5d16[_0x148e('0x1f')]+_0x3f5d16[_0x148e('0x20')];var _0x38e38a;if(_0x2dc8bf>=_0x156732){_0x2dc8bf=_0x156732;_0x38e38a=0xc8;}else{_0x38e38a=0xce;}_0x425f19[_0x148e('0x1c')](_0x38e38a);return _0x425f19['set'](_0x148e('0x23'),_0xd94554+'-'+_0x2dc8bf+'/'+_0x156732)[_0x148e('0x1e')](_0x1b6bfd);}return null;};}function patchUpdates(_0x5007e0){return function(_0x5cdb37){try{jsonpatch[_0x148e('0x24')](_0x5cdb37,_0x5007e0,!![]);}catch(_0x5104a2){return BPromise[_0x148e('0x25')](_0x5104a2);}return _0x5cdb37['save']();};}function saveUpdates(_0x34a8f3,_0x163315){return function(_0x417087){if(_0x417087){return _0x417087[_0x148e('0x26')](_0x34a8f3)['then'](function(_0x1cc6a6){return _0x1cc6a6;});}return null;};}function removeEntity(_0x5435c9,_0x2e6117){return function(_0x2131c4){if(_0x2131c4){return _0x2131c4['destroy']()['then'](function(){_0x5435c9['status'](0xcc)[_0x148e('0x1d')]();});}};}function handleEntityNotFound(_0x48cf02,_0x4e3ee0){return function(_0x36e24d){if(!_0x36e24d){_0x48cf02[_0x148e('0x1b')](0x194);}return _0x36e24d;};}function handleError(_0x400e87,_0x313be3){_0x313be3=_0x313be3||0x1f4;return function(_0x39ef09){logger[_0x148e('0x27')](_0x39ef09[_0x148e('0x28')]);if(_0x39ef09['name']){delete _0x39ef09['name'];}_0x400e87['status'](_0x313be3)['send'](_0x39ef09);};}exports[_0x148e('0x29')]=function(_0x4a8cbf,_0x3b769a){var _0x1e9983={},_0x521426={},_0x42e12f={'count':0x0,'rows':[]};var _0x291840=_[_0x148e('0x2a')](db['ServicenowAccount']['rawAttributes'],function(_0x2ce94b){return{'name':_0x2ce94b['fieldName'],'type':_0x2ce94b[_0x148e('0x2b')][_0x148e('0x2c')]};});_0x521426[_0x148e('0x2d')]=_[_0x148e('0x2a')](_0x291840,'name');_0x521426[_0x148e('0x2e')]=_[_0x148e('0x2f')](_0x4a8cbf['query']);_0x521426['filters']=_[_0x148e('0x30')](_0x521426['model'],_0x521426[_0x148e('0x2e')]);_0x1e9983[_0x148e('0x31')]=_[_0x148e('0x30')](_0x521426['model'],qs[_0x148e('0x32')](_0x4a8cbf[_0x148e('0x2e')][_0x148e('0x32')]));_0x1e9983[_0x148e('0x31')]=_0x1e9983[_0x148e('0x31')][_0x148e('0x33')]?_0x1e9983[_0x148e('0x31')]:_0x521426[_0x148e('0x2d')];if(!_0x4a8cbf[_0x148e('0x2e')][_0x148e('0x34')]('nolimit')){_0x1e9983[_0x148e('0x20')]=qs[_0x148e('0x20')](_0x4a8cbf[_0x148e('0x2e')]['limit']);_0x1e9983[_0x148e('0x1f')]=qs[_0x148e('0x1f')](_0x4a8cbf[_0x148e('0x2e')][_0x148e('0x1f')]);}_0x1e9983[_0x148e('0x35')]=qs[_0x148e('0x36')](_0x4a8cbf[_0x148e('0x2e')][_0x148e('0x36')]);_0x1e9983[_0x148e('0x37')]=qs['filters'](_['pick'](_0x4a8cbf[_0x148e('0x2e')],_0x521426[_0x148e('0x38')]),_0x291840);if(_0x4a8cbf[_0x148e('0x2e')]['filter']){_0x1e9983[_0x148e('0x37')]=_[_0x148e('0x39')](_0x1e9983[_0x148e('0x37')],{'$or':_[_0x148e('0x2a')](_0x291840,function(_0x91d054){if(_0x91d054['type']!==_0x148e('0x3a')){var _0x33d6fb={};_0x33d6fb[_0x91d054[_0x148e('0x3b')]]={'$like':'%'+_0x4a8cbf[_0x148e('0x2e')][_0x148e('0x3c')]+'%'};return _0x33d6fb;}})});}_0x1e9983=_[_0x148e('0x39')]({},_0x1e9983,_0x4a8cbf[_0x148e('0x3d')]);var _0xfdf8ed={'where':_0x1e9983['where']};return db[_0x148e('0x3e')][_0x148e('0x22')](_0xfdf8ed)['then'](function(_0x2283a8){_0x42e12f[_0x148e('0x22')]=_0x2283a8;if(_0x4a8cbf[_0x148e('0x2e')][_0x148e('0x3f')]){_0x1e9983[_0x148e('0x40')]=[{'all':!![]}];}return db[_0x148e('0x3e')][_0x148e('0x41')](_0x1e9983);})[_0x148e('0x42')](function(_0x3ee197){_0x42e12f[_0x148e('0x43')]=_0x3ee197;return _0x42e12f;})[_0x148e('0x42')](respondWithFilteredResult(_0x3b769a,_0x1e9983))[_0x148e('0x44')](handleError(_0x3b769a,null));};exports[_0x148e('0x45')]=function(_0x2270d5,_0x677129){var _0x58d007={'raw':![],'where':{'id':_0x2270d5[_0x148e('0x46')]['id']}},_0x2bf128={};_0x2bf128['model']=_[_0x148e('0x2f')](db['ServicenowAccount'][_0x148e('0x47')]);_0x2bf128['query']=_[_0x148e('0x2f')](_0x2270d5['query']);_0x2bf128[_0x148e('0x38')]=_[_0x148e('0x30')](_0x2bf128['model'],_0x2bf128[_0x148e('0x2e')]);_0x58d007[_0x148e('0x31')]=_[_0x148e('0x30')](_0x2bf128[_0x148e('0x2d')],qs[_0x148e('0x32')](_0x2270d5[_0x148e('0x2e')]['fields']));_0x58d007['attributes']=_0x58d007[_0x148e('0x31')][_0x148e('0x33')]?_0x58d007['attributes']:_0x2bf128[_0x148e('0x2d')];if(_0x2270d5['query']['includeAll']){_0x58d007[_0x148e('0x40')]=[{'all':!![]}];}_0x58d007=_[_0x148e('0x39')]({},_0x58d007,_0x2270d5[_0x148e('0x3d')]);return db[_0x148e('0x3e')][_0x148e('0x48')](_0x58d007)[_0x148e('0x42')](handleEntityNotFound(_0x677129,null))[_0x148e('0x42')](respondWithResult(_0x677129,null))[_0x148e('0x44')](handleError(_0x677129,null));};exports[_0x148e('0x49')]=function(_0x22b4f3,_0x2f962f){return db['ServicenowAccount']['create'](_0x22b4f3[_0x148e('0x4a')],{})[_0x148e('0x42')](respondWithResult(_0x2f962f,0xc9))[_0x148e('0x44')](handleError(_0x2f962f,null));};exports[_0x148e('0x26')]=function(_0x50d352,_0x210585){if(_0x50d352['body']['id']){delete _0x50d352[_0x148e('0x4a')]['id'];}return db[_0x148e('0x3e')][_0x148e('0x48')]({'where':{'id':_0x50d352[_0x148e('0x46')]['id']}})[_0x148e('0x42')](handleEntityNotFound(_0x210585,null))[_0x148e('0x42')](saveUpdates(_0x50d352[_0x148e('0x4a')],null))[_0x148e('0x42')](respondWithResult(_0x210585,null))['catch'](handleError(_0x210585,null));};exports[_0x148e('0x4b')]=function(_0x484b2c,_0x2bf182){return db[_0x148e('0x3e')][_0x148e('0x48')]({'where':{'id':_0x484b2c[_0x148e('0x46')]['id']}})['then'](handleEntityNotFound(_0x2bf182,null))[_0x148e('0x42')](removeEntity(_0x2bf182,null))[_0x148e('0x44')](handleError(_0x2bf182,null));};exports[_0x148e('0x4c')]=function(_0x5089d3,_0x2a5795,_0xf6001f){var _0x367559={};var _0x4ae349={};var _0x59260d;var _0x3d549e;return db['ServicenowAccount'][_0x148e('0x4d')]({'where':{'id':_0x5089d3['params']['id']}})[_0x148e('0x42')](handleEntityNotFound(_0x2a5795,null))[_0x148e('0x42')](function(_0x133eb8){if(_0x133eb8){_0x59260d=_0x133eb8;_0x4ae349[_0x148e('0x2d')]=_[_0x148e('0x2f')](db[_0x148e('0x4e')][_0x148e('0x47')]);_0x4ae349[_0x148e('0x2e')]=_['keys'](_0x5089d3['query']);_0x4ae349[_0x148e('0x38')]=_['intersection'](_0x4ae349[_0x148e('0x2d')],_0x4ae349['query']);_0x367559[_0x148e('0x31')]=_[_0x148e('0x30')](_0x4ae349['model'],qs[_0x148e('0x32')](_0x5089d3['query'][_0x148e('0x32')]));_0x367559[_0x148e('0x31')]=_0x367559[_0x148e('0x31')]['length']?_0x367559['attributes']:_0x4ae349[_0x148e('0x2d')];_0x367559['order']=qs[_0x148e('0x36')](_0x5089d3[_0x148e('0x2e')][_0x148e('0x36')]);_0x367559[_0x148e('0x37')]=qs['filters'](_[_0x148e('0x4f')](_0x5089d3[_0x148e('0x2e')],_0x4ae349[_0x148e('0x38')]));if(_0x5089d3['query'][_0x148e('0x3c')]){_0x367559['where']=_[_0x148e('0x39')](_0x367559[_0x148e('0x37')],{'$or':_[_0x148e('0x2a')](_0x367559[_0x148e('0x31')],function(_0x3090b7){var _0x16fe06={};_0x16fe06[_0x3090b7]={'$like':'%'+_0x5089d3['query'][_0x148e('0x3c')]+'%'};return _0x16fe06;})});}_0x367559=_['merge']({},_0x367559,_0x5089d3['options']);return _0x59260d[_0x148e('0x4c')](_0x367559);}})[_0x148e('0x42')](function(_0x923a7){if(_0x923a7){_0x3d549e=_0x923a7[_0x148e('0x33')];if(!_0x5089d3['query'][_0x148e('0x34')](_0x148e('0x50'))){_0x367559[_0x148e('0x20')]=qs[_0x148e('0x20')](_0x5089d3[_0x148e('0x2e')][_0x148e('0x20')]);_0x367559['offset']=qs[_0x148e('0x1f')](_0x5089d3['query'][_0x148e('0x1f')]);}return _0x59260d[_0x148e('0x4c')](_0x367559);}})['then'](function(_0x2dd7f2){if(_0x2dd7f2){return _0x2dd7f2?{'count':_0x3d549e,'rows':_0x2dd7f2}:null;}})[_0x148e('0x42')](respondWithResult(_0x2a5795,null))['catch'](handleError(_0x2a5795,null));};exports['addConfiguration']=function(_0x5562a1,_0x4da9b0,_0x3b3888){if(_0x5562a1[_0x148e('0x4a')]['id']){delete _0x5562a1[_0x148e('0x4a')]['id'];}return db[_0x148e('0x3e')][_0x148e('0x4d')]({'where':{'id':_0x5562a1[_0x148e('0x46')]['id']}})[_0x148e('0x42')](handleEntityNotFound(_0x4da9b0,null))[_0x148e('0x42')](function(_0x3df0ea){if(_0x3df0ea){_0x5562a1[_0x148e('0x4a')]['AccountId']=_0x3df0ea['id'];_0x5562a1[_0x148e('0x4a')][_0x148e('0x51')]=integrations[_0x148e('0x52')](_0x5562a1[_0x148e('0x4a')][_0x148e('0x53')],_0x5562a1[_0x148e('0x4a')][_0x148e('0x2b')]);_0x5562a1[_0x148e('0x4a')][_0x148e('0x54')]=integrations['getDescriptions'](_0x5562a1[_0x148e('0x4a')][_0x148e('0x53')],_0x5562a1[_0x148e('0x4a')]['type']);return db['ServicenowConfiguration'][_0x148e('0x49')](_0x5562a1[_0x148e('0x4a')],{'include':[{'model':db[_0x148e('0x55')],'as':'Subjects'},{'model':db[_0x148e('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4da9b0,null))[_0x148e('0x44')](handleError(_0x4da9b0,null));};exports[_0x148e('0x56')]=function(_0x2fde35,_0x47cc09,_0x2a2d92){var _0x1596f5=[_0x148e('0x57'),_0x148e('0x58'),_0x148e('0x59'),_0x148e('0x5a'),_0x148e('0x5b'),_0x148e('0x5c'),_0x148e('0x5d'),'severity',_0x148e('0x5e')];var _0xad16a9=['parent',_0x148e('0x57'),_0x148e('0x5f'),_0x148e('0x60'),_0x148e('0x61'),_0x148e('0x62'),_0x148e('0x63'),_0x148e('0x58'),'approval_history','number',_0x148e('0x64'),_0x148e('0x65'),_0x148e('0x66'),_0x148e('0x67'),'sys_created_on',_0x148e('0x68'),_0x148e('0x69'),_0x148e('0x6a'),_0x148e('0x59'),_0x148e('0x35'),'calendar_stc',_0x148e('0x6b'),_0x148e('0x6c'),'delivery_plan',_0x148e('0x6d'),_0x148e('0x6e'),'work_notes_list',_0x148e('0x6f'),'priority','sys_domain_path','rfc',_0x148e('0x70'),_0x148e('0x71'),_0x148e('0x72'),'business_duration',_0x148e('0x73'),_0x148e('0x74'),'reopened_time',_0x148e('0x75'),'caller_id',_0x148e('0x76'),_0x148e('0x5a'),_0x148e('0x77'),_0x148e('0x78'),'close_code',_0x148e('0x79'),'delivery_task',_0x148e('0x7a'),_0x148e('0x7b'),'business_stc',_0x148e('0x7c'),'description',_0x148e('0x7d'),_0x148e('0x5c'),'sys_class_name',_0x148e('0x7e'),_0x148e('0x7f'),_0x148e('0x80'),_0x148e('0x81'),'sys_id',_0x148e('0x82'),'reopened_by','incident_state',_0x148e('0x83'),_0x148e('0x84'),_0x148e('0x85'),_0x148e('0x86'),_0x148e('0x87'),'assigned_to',_0x148e('0x88'),_0x148e('0x89'),_0x148e('0x8a'),'approval','comments_and_work_notes','due_date','sys_mod_count',_0x148e('0x8b'),_0x148e('0x8c'),_0x148e('0x8d'),'upon_approval',_0x148e('0x8e'),_0x148e('0x8f'),_0x148e('0x5e')];var _0x162cd5='';var _0x1246ff='';var _0x5ac99b=[];var _0x1c30b5='';var _0x39a8fc='';var _0x43bce0=[];var _0x1b7285='';var _0x372932='';var _0x5188b1={};var _0x119cad='';return db[_0x148e('0x3e')][_0x148e('0x4d')]({'where':{'id':_0x2fde35[_0x148e('0x46')]['id']},'attributes':['id',_0x148e('0x90'),_0x148e('0x91'),_0x148e('0x92'),'remoteUri','serverUrl']})[_0x148e('0x42')](handleEntityNotFound(_0x47cc09,null))['then'](function(_0x2d0756){if(_0x2d0756){_0x119cad=_0x2d0756[_0x148e('0x93')];var _0x38e4a3=_0x119cad[_0x148e('0x94')](-0x1);if(_0x38e4a3==='/'){_0x119cad=_0x119cad['substring'](0x0,_0x119cad[_0x148e('0x95')](_0x38e4a3));}_0x372932=util['format'](_0x148e('0x96'),_0x119cad);_0x1b7285=util[_0x148e('0x97')]('%s/api/now/table/',_0x119cad);_0x5188b1={'user':_0x2d0756[_0x148e('0x90')],'pass':_0x2d0756[_0x148e('0x91')]};var _0x3dde7b={'method':'GET','uri':_0x372932+_0x148e('0x98'),'auth':_0x5188b1,'json':!![]};return rp(_0x3dde7b);}})['then'](function(_0x231136){if(_0x231136['result']['length']>0x0){_0x162cd5=_0x231136[_0x148e('0x99')];}console[_0x148e('0x9a')](_0x148e('0x9b'),_0x162cd5);_0x43bce0=[];_0x1246ff=Object['assign']([],_0x162cd5);_[_0x148e('0x9c')](_0x1246ff,function(_0x5cd835){return!_0x1596f5[_0x148e('0x9d')](_0x5cd835[_0x148e('0x3b')]);});_0x1246ff[_0x148e('0x9e')](function(_0x3b740a){var _0x3ccf9e=createFieldObject(_0x1b7285,_0x5188b1,_0x3b740a[_0x148e('0x9f')],_0x3b740a[_0x148e('0x3b')],_0x3b740a[_0x148e('0xa0')],![]);_0x43bce0['push'](_0x3ccf9e);});return Promise[_0x148e('0xa1')](_0x43bce0);})[_0x148e('0x42')](function(_0x3f76dd){_0x5ac99b=_0x3f76dd;_0x1c30b5=Object[_0x148e('0xa2')]([],_0x162cd5);console[_0x148e('0x9a')](_0x148e('0xa3'),_0x162cd5);_[_0x148e('0x9c')](_0x1c30b5,function(_0x4d4ca6){return _0xad16a9[_0x148e('0x9d')](_0x4d4ca6[_0x148e('0x3b')]);});console[_0x148e('0x9a')](_0x148e('0xa4'),_0x1c30b5);_0x43bce0=[];_0x1c30b5[_0x148e('0x9e')](function(_0x4bd84c){var _0x5696ba=createFieldObject(_0x1b7285,_0x5188b1,_0x4bd84c[_0x148e('0x9f')],_0x4bd84c[_0x148e('0x3b')],_0x4bd84c[_0x148e('0xa0')],!![]);_0x43bce0[_0x148e('0xa5')](_0x5696ba);});return Promise[_0x148e('0xa1')](_0x43bce0);})['then'](function(_0x3ed2c1){_0x39a8fc=_0x3ed2c1;var _0x1e3f8e=_0x5ac99b[_0x148e('0xa6')](_0x39a8fc);return{'count':_0x1e3f8e[_0x148e('0x33')],'rows':_0x1e3f8e};})[_0x148e('0x42')](respondWithResult(_0x47cc09,null))['catch'](function(_0x4cc56a){console[_0x148e('0x9a')](_0x148e('0xa7')+_0x4cc56a);var _0x83b197=_0x2fde35[_0x148e('0x2e')][_0x148e('0xa8')]?0x1f4:_0x4cc56a[_0x148e('0xa9')]||0x1f4;logger[_0x148e('0x27')](_0x4cc56a[_0x148e('0x28')]);delete _0x4cc56a['name'];if(_0x83b197===0x191){_0x83b197=0x190;}_0x47cc09['status'](_0x83b197)[_0x148e('0xaa')](_0x2fde35['query'][_0x148e('0xa8')]?{'message':'Wrong\x20credentials','statusCode':_0x4cc56a[_0x148e('0xa9')]}:_0x4cc56a);});};function createFieldObject(_0x278266,_0x1b4d93,_0x4a8da2,_0x59213d,_0x10988e,_0x43f985){return new Promise(function(_0x212f0c,_0xde36b3){var _0xbaef4f={'id':_0x59213d,'name':_0x10988e,'custom':_0x43f985};if(_0x4a8da2===_0x148e('0xab')){_0xbaef4f[_0x148e('0x3d')]=[{'name':_0x148e('0xac'),'value':_0x148e('0xad')},{'name':'False','value':_0x148e('0xae')}];_0x212f0c(_0xbaef4f);}else{var _0x2355cf={'method':_0x148e('0xaf'),'uri':_0x278266+_0x148e('0xb0')+_0x59213d,'auth':_0x1b4d93,'json':!![]};return rp(_0x2355cf)[_0x148e('0x42')](function(_0x1ccb25){var _0xb48c46=[];if(_0x1ccb25[_0x148e('0x99')]['length']>0x0){_0x1ccb25[_0x148e('0x99')][_0x148e('0x9e')](function(_0x2ef6e9){if(_0x2ef6e9[_0x148e('0xb1')]===_0x148e('0xae')){var _0x138d57={'name':_0x2ef6e9[_0x148e('0xa0')],'value':_0x2ef6e9['value']};_0xb48c46['push'](_0x138d57);}});}_0xbaef4f['options']=_0xb48c46;if(_0xbaef4f[_0x148e('0x3d')][_0x148e('0x33')]>0x0){_0x212f0c(_0xbaef4f);}else{if(_0x43f985==![]){_0x212f0c();}else{_0x212f0c(_0xbaef4f);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index b28da7c..de16833 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 _0xc1c6=['rimraf','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x3ce68f,_0x57665a){var _0x150e24=function(_0x26dd43){while(--_0x26dd43){_0x3ce68f['push'](_0x3ce68f['shift']());}};_0x150e24(++_0x57665a);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x516743,_0x58199f){_0x516743=_0x516743-0x0;var _0xf114b5=_0xc1c6[_0x516743];return _0xf114b5;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x6c1c('0x7'));module['exports']=function(_0x50c1bb,_0x582bec){return _0x50c1bb[_0x6c1c('0x8')](_0x6c1c('0x9'),attributes,{'tableName':_0x6c1c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dfd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x27af3e,_0x36e38c){var _0x349528=function(_0x48df48){while(--_0x48df48){_0x27af3e['push'](_0x27af3e['shift']());}};_0x349528(++_0x36e38c);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var moment=require(_0xd7df('0x4'));var BPromise=require(_0xd7df('0x5'));var rp=require(_0xd7df('0x6'));var fs=require('fs');var path=require(_0xd7df('0x7'));var rimraf=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var attributes=require(_0xd7df('0xa'));var integrations=require(_0xd7df('0xb'));module[_0xd7df('0xc')]=function(_0x39ce98,_0x354ea7){return _0x39ce98[_0xd7df('0xd')](_0xd7df('0xe'),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 e34d706..5c6d300 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 _0x43da=['debug','ShowServicenowAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x47bcdd,_0x5a74bd){var _0x5d8071=function(_0x4fab9f){while(--_0x4fab9f){_0x47bcdd['push'](_0x47bcdd['shift']());}};_0x5d8071(++_0x5a74bd);}(_0x43da,0xbc));var _0xa43d=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x43da[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0xa43d('0x0'));var util=require(_0xa43d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa43d('0x2'));var fs=require('fs');var Redis=require(_0xa43d('0x3'));var db=require(_0xa43d('0x4'))['db'];var utils=require(_0xa43d('0x5'));var logger=require(_0xa43d('0x6'))(_0xa43d('0x7'));var config=require('../../config/environment');var jayson=require(_0xa43d('0x8'));var client=jayson[_0xa43d('0x9')][_0xa43d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cb915,_0xe7df08,_0x1136c2){return new BPromise(function(_0xbe7e85,_0x3c432f){return client[_0xa43d('0xb')](_0x5cb915,_0x1136c2)[_0xa43d('0xc')](function(_0xcaf2e1){logger[_0xa43d('0xd')](_0xa43d('0xe'),_0xe7df08,_0xa43d('0xf'));logger['debug'](_0xa43d('0x10'),_0xe7df08,'request\x20sent',JSON[_0xa43d('0x11')](_0xcaf2e1));if(_0xcaf2e1['error']){if(_0xcaf2e1[_0xa43d('0x12')][_0xa43d('0x13')]===0x1f4){logger['error'](_0xa43d('0xe'),_0xe7df08,_0xcaf2e1[_0xa43d('0x12')][_0xa43d('0x14')]);return _0x3c432f(_0xcaf2e1[_0xa43d('0x12')]['message']);}logger[_0xa43d('0x12')](_0xa43d('0xe'),_0xe7df08,_0xcaf2e1[_0xa43d('0x12')][_0xa43d('0x14')]);return _0xbe7e85(_0xcaf2e1['error']['message']);}else{logger['info'](_0xa43d('0xe'),_0xe7df08,_0xa43d('0xf'));_0xbe7e85(_0xcaf2e1[_0xa43d('0x15')][_0xa43d('0x14')]);}})[_0xa43d('0x16')](function(_0x43ec80){logger['error'](_0xa43d('0xe'),_0xe7df08,_0x43ec80);_0x3c432f(_0x43ec80);});});}exports[_0xa43d('0x17')]=function(_0x52db28){var _0x534609=this;return new Promise(function(_0x2b35f3,_0x48ee18){return db[_0xa43d('0x18')][_0xa43d('0x19')]({'raw':_0x52db28[_0xa43d('0x1a')]?_0x52db28[_0xa43d('0x1a')][_0xa43d('0x1b')]===undefined?!![]:![]:!![],'where':_0x52db28[_0xa43d('0x1a')]?_0x52db28[_0xa43d('0x1a')][_0xa43d('0x1c')]||null:null,'attributes':_0x52db28[_0xa43d('0x1a')]?_0x52db28['options'][_0xa43d('0x1d')]||null:null,'limit':_0x52db28[_0xa43d('0x1a')]?_0x52db28['options'][_0xa43d('0x1e')]||null:null,'include':_0x52db28['options']?_0x52db28['options'][_0xa43d('0x1f')]?_[_0xa43d('0x20')](_0x52db28[_0xa43d('0x1a')][_0xa43d('0x1f')],function(_0x148fc4){return{'model':db[_0x148fc4[_0xa43d('0x21')]],'as':_0x148fc4['as'],'attributes':_0x148fc4[_0xa43d('0x1d')],'include':_0x148fc4[_0xa43d('0x1f')]?_[_0xa43d('0x20')](_0x148fc4[_0xa43d('0x1f')],function(_0x481107){return{'model':db[_0x481107['model']],'as':_0x481107['as'],'attributes':_0x481107[_0xa43d('0x1d')],'include':_0x481107[_0xa43d('0x1f')]?_[_0xa43d('0x20')](_0x481107[_0xa43d('0x1f')],function(_0x1b80f8){return{'model':db[_0x1b80f8[_0xa43d('0x21')]],'as':_0x1b80f8['as'],'attributes':_0x1b80f8[_0xa43d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa43d('0xc')](function(_0x5b8e8e){logger[_0xa43d('0xd')](_0xa43d('0x17'),_0x52db28);logger[_0xa43d('0x22')](_0xa43d('0x17'),_0x52db28,JSON[_0xa43d('0x11')](_0x5b8e8e));_0x2b35f3(_0x5b8e8e);})[_0xa43d('0x16')](function(_0xeda6ac){logger['error']('GetServicenowAccount',_0xeda6ac[_0xa43d('0x14')],_0x52db28);_0x48ee18(_0x534609[_0xa43d('0x12')](0x1f4,_0xeda6ac[_0xa43d('0x14')]));});});};exports[_0xa43d('0x23')]=function(_0x3a9e0e){var _0x347a97=this;return new Promise(function(_0x56b380,_0x4e2aac){return db['ServicenowAccount'][_0xa43d('0x24')]({'raw':_0x3a9e0e[_0xa43d('0x1a')]?_0x3a9e0e[_0xa43d('0x1a')][_0xa43d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3a9e0e[_0xa43d('0x1a')]?_0x3a9e0e[_0xa43d('0x1a')][_0xa43d('0x1c')]||null:null,'attributes':_0x3a9e0e[_0xa43d('0x1a')]?_0x3a9e0e[_0xa43d('0x1a')]['attributes']||null:null,'include':_0x3a9e0e[_0xa43d('0x1a')]?_0x3a9e0e[_0xa43d('0x1a')][_0xa43d('0x1f')]?_[_0xa43d('0x20')](_0x3a9e0e['options'][_0xa43d('0x1f')],function(_0x5ebd4c){return{'model':db[_0x5ebd4c[_0xa43d('0x21')]],'as':_0x5ebd4c['as'],'attributes':_0x5ebd4c[_0xa43d('0x1d')],'include':_0x5ebd4c[_0xa43d('0x1f')]?_[_0xa43d('0x20')](_0x5ebd4c[_0xa43d('0x1f')],function(_0x309209){return{'model':db[_0x309209[_0xa43d('0x21')]],'as':_0x309209['as'],'attributes':_0x309209[_0xa43d('0x1d')],'include':_0x309209[_0xa43d('0x1f')]?_[_0xa43d('0x20')](_0x309209[_0xa43d('0x1f')],function(_0x19f5e3){return{'model':db[_0x19f5e3[_0xa43d('0x21')]],'as':_0x19f5e3['as'],'attributes':_0x19f5e3[_0xa43d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa43d('0xc')](function(_0x43e844){logger[_0xa43d('0xd')](_0xa43d('0x23'),_0x3a9e0e);logger[_0xa43d('0x22')]('ShowServicenowAccount',_0x3a9e0e,JSON[_0xa43d('0x11')](_0x43e844));_0x56b380(_0x43e844);})['catch'](function(_0x33cd22){logger[_0xa43d('0x12')](_0xa43d('0x23'),_0x33cd22[_0xa43d('0x14')],_0x3a9e0e);_0x4e2aac(_0x347a97[_0xa43d('0x12')](0x1f4,_0x33cd22['message']));});});}; \ No newline at end of file +var _0x2866=['where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowServicenowAccount'];(function(_0x30cedf,_0x5aa539){var _0x177499=function(_0x15b073){while(--_0x15b073){_0x30cedf['push'](_0x30cedf['shift']());}};_0x177499(++_0x5aa539);}(_0x2866,0x129));var _0x6286=function(_0x471273,_0x1587f1){_0x471273=_0x471273-0x0;var _0x56c63e=_0x2866[_0x471273];return _0x56c63e;};'use strict';var _=require(_0x6286('0x0'));var util=require(_0x6286('0x1'));var moment=require(_0x6286('0x2'));var BPromise=require(_0x6286('0x3'));var rs=require(_0x6286('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6286('0x5'))['db'];var utils=require(_0x6286('0x6'));var logger=require(_0x6286('0x7'))(_0x6286('0x8'));var config=require('../../config/environment');var jayson=require(_0x6286('0x9'));var client=jayson[_0x6286('0xa')][_0x6286('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x92f72b,_0x5d036d,_0xba7a40){return new BPromise(function(_0x429139,_0x242353){return client[_0x6286('0xc')](_0x92f72b,_0xba7a40)[_0x6286('0xd')](function(_0x5000d0){logger[_0x6286('0xe')](_0x6286('0xf'),_0x5d036d,_0x6286('0x10'));logger[_0x6286('0x11')](_0x6286('0x12'),_0x5d036d,'request\x20sent',JSON['stringify'](_0x5000d0));if(_0x5000d0[_0x6286('0x13')]){if(_0x5000d0[_0x6286('0x13')][_0x6286('0x14')]===0x1f4){logger['error'](_0x6286('0xf'),_0x5d036d,_0x5000d0['error'][_0x6286('0x15')]);return _0x242353(_0x5000d0[_0x6286('0x13')][_0x6286('0x15')]);}logger[_0x6286('0x13')](_0x6286('0xf'),_0x5d036d,_0x5000d0[_0x6286('0x13')][_0x6286('0x15')]);return _0x429139(_0x5000d0[_0x6286('0x13')][_0x6286('0x15')]);}else{logger[_0x6286('0xe')](_0x6286('0xf'),_0x5d036d,_0x6286('0x10'));_0x429139(_0x5000d0[_0x6286('0x16')][_0x6286('0x15')]);}})[_0x6286('0x17')](function(_0x37e6fb){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x5d036d,_0x37e6fb);_0x242353(_0x37e6fb);});});}exports[_0x6286('0x18')]=function(_0xa42440){var _0x42c516=this;return new Promise(function(_0x1375d1,_0x347a6e){return db[_0x6286('0x19')][_0x6286('0x1a')]({'raw':_0xa42440[_0x6286('0x1b')]?_0xa42440[_0x6286('0x1b')][_0x6286('0x1c')]===undefined?!![]:![]:!![],'where':_0xa42440['options']?_0xa42440[_0x6286('0x1b')]['where']||null:null,'attributes':_0xa42440['options']?_0xa42440[_0x6286('0x1b')][_0x6286('0x1d')]||null:null,'limit':_0xa42440['options']?_0xa42440[_0x6286('0x1b')][_0x6286('0x1e')]||null:null,'include':_0xa42440[_0x6286('0x1b')]?_0xa42440[_0x6286('0x1b')][_0x6286('0x1f')]?_[_0x6286('0x20')](_0xa42440['options'][_0x6286('0x1f')],function(_0x5540bb){return{'model':db[_0x5540bb[_0x6286('0x21')]],'as':_0x5540bb['as'],'attributes':_0x5540bb[_0x6286('0x1d')],'include':_0x5540bb['include']?_[_0x6286('0x20')](_0x5540bb[_0x6286('0x1f')],function(_0x4e7333){return{'model':db[_0x4e7333[_0x6286('0x21')]],'as':_0x4e7333['as'],'attributes':_0x4e7333[_0x6286('0x1d')],'include':_0x4e7333[_0x6286('0x1f')]?_['map'](_0x4e7333['include'],function(_0x248a2c){return{'model':db[_0x248a2c[_0x6286('0x21')]],'as':_0x248a2c['as'],'attributes':_0x248a2c[_0x6286('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6286('0xd')](function(_0x169947){logger[_0x6286('0xe')](_0x6286('0x18'),_0xa42440);logger['debug']('GetServicenowAccount',_0xa42440,JSON[_0x6286('0x22')](_0x169947));_0x1375d1(_0x169947);})['catch'](function(_0x4cb694){logger[_0x6286('0x13')]('GetServicenowAccount',_0x4cb694[_0x6286('0x15')],_0xa42440);_0x347a6e(_0x42c516[_0x6286('0x13')](0x1f4,_0x4cb694['message']));});});};exports[_0x6286('0x23')]=function(_0x1eda32){var _0x1f0ff6=this;return new Promise(function(_0x149660,_0x4468f2){return db[_0x6286('0x19')]['find']({'raw':_0x1eda32[_0x6286('0x1b')]?_0x1eda32[_0x6286('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1eda32[_0x6286('0x1b')]?_0x1eda32[_0x6286('0x1b')][_0x6286('0x24')]||null:null,'attributes':_0x1eda32[_0x6286('0x1b')]?_0x1eda32['options'][_0x6286('0x1d')]||null:null,'include':_0x1eda32['options']?_0x1eda32[_0x6286('0x1b')][_0x6286('0x1f')]?_['map'](_0x1eda32[_0x6286('0x1b')][_0x6286('0x1f')],function(_0x221503){return{'model':db[_0x221503[_0x6286('0x21')]],'as':_0x221503['as'],'attributes':_0x221503['attributes'],'include':_0x221503[_0x6286('0x1f')]?_['map'](_0x221503[_0x6286('0x1f')],function(_0x999844){return{'model':db[_0x999844[_0x6286('0x21')]],'as':_0x999844['as'],'attributes':_0x999844[_0x6286('0x1d')],'include':_0x999844[_0x6286('0x1f')]?_[_0x6286('0x20')](_0x999844['include'],function(_0x3e3419){return{'model':db[_0x3e3419[_0x6286('0x21')]],'as':_0x3e3419['as'],'attributes':_0x3e3419['attributes']};}):[]};}):[]};}):[]:[]})[_0x6286('0xd')](function(_0x2ab0c9){logger[_0x6286('0xe')](_0x6286('0x23'),_0x1eda32);logger[_0x6286('0x11')](_0x6286('0x23'),_0x1eda32,JSON[_0x6286('0x22')](_0x2ab0c9));_0x149660(_0x2ab0c9);})['catch'](function(_0x5038c4){logger[_0x6286('0x13')]('ShowServicenowAccount',_0x5038c4[_0x6286('0x15')],_0x1eda32);_0x4468f2(_0x1f0ff6[_0x6286('0x13')](0x1f4,_0x5038c4['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 8ba3edc..47e7cf5 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 _0x5bd8=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','create','update','delete','destroy'];(function(_0x2fe328,_0x31cad2){var _0x319cb3=function(_0x1ed0cf){while(--_0x1ed0cf){_0x2fe328['push'](_0x2fe328['shift']());}};_0x319cb3(++_0x31cad2);}(_0x5bd8,0x15a));var _0x85bd=function(_0x1bf45e,_0x192d44){_0x1bf45e=_0x1bf45e-0x0;var _0x22a5f1=_0x5bd8[_0x1bf45e];return _0x22a5f1;};'use strict';var multer=require(_0x85bd('0x0'));var util=require('util');var path=require(_0x85bd('0x1'));var timeout=require(_0x85bd('0x2'));var express=require(_0x85bd('0x3'));var router=express[_0x85bd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x85bd('0x5'));var interaction=require(_0x85bd('0x6'));var config=require(_0x85bd('0x7'));var controller=require(_0x85bd('0x8'));router[_0x85bd('0x9')]('/',auth[_0x85bd('0xa')](),controller[_0x85bd('0xb')]);router[_0x85bd('0x9')](_0x85bd('0xc'),auth[_0x85bd('0xa')](),controller[_0x85bd('0xd')]);router['get'](_0x85bd('0xe'),auth[_0x85bd('0xa')](),controller[_0x85bd('0xf')]);router[_0x85bd('0x9')](_0x85bd('0x10'),auth[_0x85bd('0xa')](),controller['getSubjects']);router[_0x85bd('0x9')]('/:id/descriptions',auth[_0x85bd('0xa')](),controller[_0x85bd('0x11')]);router['post']('/',auth[_0x85bd('0xa')](),controller[_0x85bd('0x12')]);router['put'](_0x85bd('0xc'),auth[_0x85bd('0xa')](),controller[_0x85bd('0x13')]);router[_0x85bd('0x14')](_0x85bd('0xc'),auth[_0x85bd('0xa')](),controller[_0x85bd('0x15')]);module[_0x85bd('0x16')]=router; \ No newline at end of file +var _0x5c40=['../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4c92ae,_0x1b9dc1){var _0x28e1c3=function(_0x21b6ea){while(--_0x21b6ea){_0x4c92ae['push'](_0x4c92ae['shift']());}};_0x28e1c3(++_0x1b9dc1);}(_0x5c40,0x1d4));var _0x05c4=function(_0x2d186f,_0x540880){_0x2d186f=_0x2d186f-0x0;var _0x2acb9b=_0x5c40[_0x2d186f];return _0x2acb9b;};'use strict';var multer=require(_0x05c4('0x0'));var util=require(_0x05c4('0x1'));var path=require(_0x05c4('0x2'));var timeout=require(_0x05c4('0x3'));var express=require(_0x05c4('0x4'));var router=express[_0x05c4('0x5')]();var fs_extra=require(_0x05c4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x05c4('0x7'));var config=require(_0x05c4('0x8'));var controller=require(_0x05c4('0x9'));router[_0x05c4('0xa')]('/',auth[_0x05c4('0xb')](),controller[_0x05c4('0xc')]);router['get'](_0x05c4('0xd'),auth[_0x05c4('0xb')](),controller[_0x05c4('0xe')]);router[_0x05c4('0xa')]('/:id/fields',auth[_0x05c4('0xb')](),controller[_0x05c4('0xf')]);router[_0x05c4('0xa')](_0x05c4('0x10'),auth['isAuthenticated'](),controller[_0x05c4('0x11')]);router[_0x05c4('0xa')](_0x05c4('0x12'),auth[_0x05c4('0xb')](),controller[_0x05c4('0x13')]);router[_0x05c4('0x14')]('/',auth[_0x05c4('0xb')](),controller[_0x05c4('0x15')]);router[_0x05c4('0x16')](_0x05c4('0xd'),auth[_0x05c4('0xb')](),controller['update']);router[_0x05c4('0x17')](_0x05c4('0xd'),auth[_0x05c4('0xb')](),controller[_0x05c4('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 57f5c21..8f600ef 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 _0xf685=['STRING','sequelize'];(function(_0x5198bb,_0x5b44d7){var _0x67fa0d=function(_0x1c391a){while(--_0x1c391a){_0x5198bb['push'](_0x5198bb['shift']());}};_0x67fa0d(++_0x5b44d7);}(_0xf685,0xcd));var _0x5f68=function(_0x36ee05,_0xf6a255){_0x36ee05=_0x36ee05-0x0;var _0x2da47c=_0xf685[_0x36ee05];return _0x2da47c;};'use strict';var Sequelize=require(_0x5f68('0x0'));module['exports']={'name':{'type':Sequelize[_0x5f68('0x1')]},'description':{'type':Sequelize[_0x5f68('0x1')]}}; \ No newline at end of file +var _0x9667=['STRING','exports'];(function(_0x3050ca,_0x3e36b0){var _0x1eed1d=function(_0x195e8f){while(--_0x195e8f){_0x3050ca['push'](_0x3050ca['shift']());}};_0x1eed1d(++_0x3e36b0);}(_0x9667,0x77));var _0x7966=function(_0x232843,_0x27c29e){_0x232843=_0x232843-0x0;var _0x223037=_0x9667[_0x232843];return _0x223037;};'use strict';var Sequelize=require('sequelize');module[_0x7966('0x0')]={'name':{'type':Sequelize[_0x7966('0x1')]},'description':{'type':Sequelize[_0x7966('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index cd8ea6a..6575de1 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 _0xc46f=['include','rows','catch','show','params','keys','fields','includeAll','find','create','body','getFields','findOne','ServicenowField','order','where','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','VIRTUAL','options'];(function(_0x54ebcb,_0x4ec17e){var _0x2c6d7e=function(_0x6ccc32){while(--_0x6ccc32){_0x54ebcb['push'](_0x54ebcb['shift']());}};_0x2c6d7e(++_0x4ec17e);}(_0xc46f,0x108));var _0xfc46=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc46f[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0xfc46('0x0'));var rimraf=require(_0xfc46('0x1'));var zipdir=require(_0xfc46('0x2'));var jsonpatch=require(_0xfc46('0x3'));var rp=require(_0xfc46('0x4'));var moment=require(_0xfc46('0x5'));var BPromise=require(_0xfc46('0x6'));var Mustache=require(_0xfc46('0x7'));var util=require(_0xfc46('0x8'));var path=require(_0xfc46('0x9'));var sox=require('sox');var csv=require(_0xfc46('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc46('0xb'));var squel=require(_0xfc46('0xc'));var crypto=require(_0xfc46('0xd'));var jsforce=require(_0xfc46('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfc46('0xa'));var querystring=require(_0xfc46('0xf'));var Papa=require(_0xfc46('0x10'));var Redis=require('ioredis');var authService=require(_0xfc46('0x11'));var qs=require(_0xfc46('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc46('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xfc46('0x14'));var config=require(_0xfc46('0x15'));var licenseUtil=require(_0xfc46('0x16'));var db=require(_0xfc46('0x17'))['db'];function respondWithStatusCode(_0x491091,_0x1322c8){_0x1322c8=_0x1322c8||0xcc;return function(_0x398db3){if(_0x398db3){return _0x491091['sendStatus'](_0x1322c8);}return _0x491091[_0xfc46('0x18')](_0x1322c8)[_0xfc46('0x19')]();};}function respondWithResult(_0x603d2b,_0x58e4a0){_0x58e4a0=_0x58e4a0||0xc8;return function(_0x3ef45d){if(_0x3ef45d){return _0x603d2b[_0xfc46('0x18')](_0x58e4a0)[_0xfc46('0x1a')](_0x3ef45d);}};}function respondWithFilteredResult(_0x295380,_0x8a4fdb){return function(_0x1a5254){if(_0x1a5254){var _0x4308ea=typeof _0x8a4fdb[_0xfc46('0x1b')]===_0xfc46('0x1c')&&typeof _0x8a4fdb[_0xfc46('0x1d')]===_0xfc46('0x1c');var _0x51ae3e=_0x1a5254[_0xfc46('0x1e')];var _0x4c90c4=_0x4308ea?0x0:_0x8a4fdb[_0xfc46('0x1b')];var _0x543c83=_0x4308ea?_0x1a5254[_0xfc46('0x1e')]:_0x8a4fdb[_0xfc46('0x1b')]+_0x8a4fdb[_0xfc46('0x1d')];var _0x348aef;if(_0x543c83>=_0x51ae3e){_0x543c83=_0x51ae3e;_0x348aef=0xc8;}else{_0x348aef=0xce;}_0x295380[_0xfc46('0x18')](_0x348aef);return _0x295380[_0xfc46('0x1f')](_0xfc46('0x20'),_0x4c90c4+'-'+_0x543c83+'/'+_0x51ae3e)['json'](_0x1a5254);}return null;};}function patchUpdates(_0x35ba20){return function(_0x57d207){try{jsonpatch[_0xfc46('0x21')](_0x57d207,_0x35ba20,!![]);}catch(_0x1aac3d){return BPromise[_0xfc46('0x22')](_0x1aac3d);}return _0x57d207[_0xfc46('0x23')]();};}function saveUpdates(_0x5a9fc4,_0x4b3c39){return function(_0xa98240){if(_0xa98240){return _0xa98240[_0xfc46('0x24')](_0x5a9fc4)[_0xfc46('0x25')](function(_0x16f862){return _0x16f862;});}return null;};}function removeEntity(_0x574c50,_0x1e39c7){return function(_0x1aaccc){if(_0x1aaccc){return _0x1aaccc[_0xfc46('0x26')]()[_0xfc46('0x25')](function(){_0x574c50['status'](0xcc)[_0xfc46('0x19')]();});}};}function handleEntityNotFound(_0x4d852,_0x43261e){return function(_0x8c1fc){if(!_0x8c1fc){_0x4d852[_0xfc46('0x27')](0x194);}return _0x8c1fc;};}function handleError(_0x84ce54,_0x53304f){_0x53304f=_0x53304f||0x1f4;return function(_0x4406cf){logger[_0xfc46('0x28')](_0x4406cf['stack']);if(_0x4406cf[_0xfc46('0x29')]){delete _0x4406cf['name'];}_0x84ce54[_0xfc46('0x18')](_0x53304f)[_0xfc46('0x2a')](_0x4406cf);};}exports[_0xfc46('0x2b')]=function(_0x232348,_0x490f04){var _0x393345={},_0x114a65={},_0x155b1c={'count':0x0,'rows':[]};var _0x260cb9=_['map'](db[_0xfc46('0x2c')][_0xfc46('0x2d')],function(_0x17d78b){return{'name':_0x17d78b[_0xfc46('0x2e')],'type':_0x17d78b[_0xfc46('0x2f')][_0xfc46('0x30')]};});_0x114a65[_0xfc46('0x31')]=_[_0xfc46('0x32')](_0x260cb9,_0xfc46('0x29'));_0x114a65[_0xfc46('0x33')]=_['keys'](_0x232348[_0xfc46('0x33')]);_0x114a65['filters']=_['intersection'](_0x114a65['model'],_0x114a65[_0xfc46('0x33')]);_0x393345[_0xfc46('0x34')]=_[_0xfc46('0x35')](_0x114a65[_0xfc46('0x31')],qs['fields'](_0x232348[_0xfc46('0x33')]['fields']));_0x393345[_0xfc46('0x34')]=_0x393345[_0xfc46('0x34')][_0xfc46('0x36')]?_0x393345[_0xfc46('0x34')]:_0x114a65['model'];if(!_0x232348[_0xfc46('0x33')][_0xfc46('0x37')](_0xfc46('0x38'))){_0x393345[_0xfc46('0x1d')]=qs[_0xfc46('0x1d')](_0x232348['query'][_0xfc46('0x1d')]);_0x393345[_0xfc46('0x1b')]=qs['offset'](_0x232348['query'][_0xfc46('0x1b')]);}_0x393345['order']=qs[_0xfc46('0x39')](_0x232348[_0xfc46('0x33')][_0xfc46('0x39')]);_0x393345['where']=qs['filters'](_[_0xfc46('0x3a')](_0x232348[_0xfc46('0x33')],_0x114a65[_0xfc46('0x3b')]),_0x260cb9);if(_0x232348[_0xfc46('0x33')][_0xfc46('0x3c')]){_0x393345['where']=_[_0xfc46('0x3d')](_0x393345['where'],{'$or':_[_0xfc46('0x32')](_0x260cb9,function(_0x3a0cbe){if(_0x3a0cbe[_0xfc46('0x2f')]!==_0xfc46('0x3e')){var _0x1f8de5={};_0x1f8de5[_0x3a0cbe[_0xfc46('0x29')]]={'$like':'%'+_0x232348['query']['filter']+'%'};return _0x1f8de5;}})});}_0x393345=_[_0xfc46('0x3d')]({},_0x393345,_0x232348[_0xfc46('0x3f')]);var _0x5a4a88={'where':_0x393345['where']};return db[_0xfc46('0x2c')][_0xfc46('0x1e')](_0x5a4a88)[_0xfc46('0x25')](function(_0x44bb50){_0x155b1c[_0xfc46('0x1e')]=_0x44bb50;if(_0x232348['query']['includeAll']){_0x393345[_0xfc46('0x40')]=[{'all':!![]}];}return db[_0xfc46('0x2c')]['findAll'](_0x393345);})['then'](function(_0x315ee6){_0x155b1c[_0xfc46('0x41')]=_0x315ee6;return _0x155b1c;})['then'](respondWithFilteredResult(_0x490f04,_0x393345))[_0xfc46('0x42')](handleError(_0x490f04,null));};exports[_0xfc46('0x43')]=function(_0x4ddf05,_0x535ae5){var _0x5ea010={'raw':![],'where':{'id':_0x4ddf05[_0xfc46('0x44')]['id']}},_0x579ebc={};_0x579ebc['model']=_[_0xfc46('0x45')](db[_0xfc46('0x2c')]['rawAttributes']);_0x579ebc['query']=_[_0xfc46('0x45')](_0x4ddf05['query']);_0x579ebc[_0xfc46('0x3b')]=_['intersection'](_0x579ebc[_0xfc46('0x31')],_0x579ebc[_0xfc46('0x33')]);_0x5ea010[_0xfc46('0x34')]=_[_0xfc46('0x35')](_0x579ebc[_0xfc46('0x31')],qs['fields'](_0x4ddf05[_0xfc46('0x33')][_0xfc46('0x46')]));_0x5ea010[_0xfc46('0x34')]=_0x5ea010[_0xfc46('0x34')][_0xfc46('0x36')]?_0x5ea010['attributes']:_0x579ebc['model'];if(_0x4ddf05[_0xfc46('0x33')][_0xfc46('0x47')]){_0x5ea010[_0xfc46('0x40')]=[{'all':!![]}];}_0x5ea010=_['merge']({},_0x5ea010,_0x4ddf05[_0xfc46('0x3f')]);return db['ServicenowConfiguration'][_0xfc46('0x48')](_0x5ea010)[_0xfc46('0x25')](handleEntityNotFound(_0x535ae5,null))[_0xfc46('0x25')](respondWithResult(_0x535ae5,null))[_0xfc46('0x42')](handleError(_0x535ae5,null));};exports['create']=function(_0x566fdf,_0x1c011e){return db[_0xfc46('0x2c')][_0xfc46('0x49')](_0x566fdf['body'],{})[_0xfc46('0x25')](respondWithResult(_0x1c011e,0xc9))[_0xfc46('0x42')](handleError(_0x1c011e,null));};exports[_0xfc46('0x24')]=function(_0x37e070,_0x114d76){if(_0x37e070[_0xfc46('0x4a')]['id']){delete _0x37e070[_0xfc46('0x4a')]['id'];}return db['ServicenowConfiguration'][_0xfc46('0x48')]({'where':{'id':_0x37e070[_0xfc46('0x44')]['id']}})['then'](handleEntityNotFound(_0x114d76,null))[_0xfc46('0x25')](saveUpdates(_0x37e070[_0xfc46('0x4a')],null))[_0xfc46('0x25')](respondWithResult(_0x114d76,null))[_0xfc46('0x42')](handleError(_0x114d76,null));};exports[_0xfc46('0x26')]=function(_0x1ed0ea,_0x2d542f){return db[_0xfc46('0x2c')][_0xfc46('0x48')]({'where':{'id':_0x1ed0ea['params']['id']}})[_0xfc46('0x25')](handleEntityNotFound(_0x2d542f,null))[_0xfc46('0x25')](removeEntity(_0x2d542f,null))[_0xfc46('0x42')](handleError(_0x2d542f,null));};exports[_0xfc46('0x4b')]=function(_0x526450,_0x4b969b,_0x528e67){var _0x1e1aca={};var _0x942817={};var _0x5f1743;var _0x5401df;return db[_0xfc46('0x2c')][_0xfc46('0x4c')]({'where':{'id':_0x526450[_0xfc46('0x44')]['id']}})[_0xfc46('0x25')](handleEntityNotFound(_0x4b969b,null))[_0xfc46('0x25')](function(_0x4bad89){if(_0x4bad89){_0x5f1743=_0x4bad89;_0x942817['model']=_[_0xfc46('0x45')](db[_0xfc46('0x4d')]['rawAttributes']);_0x942817[_0xfc46('0x33')]=_['keys'](_0x526450[_0xfc46('0x33')]);_0x942817[_0xfc46('0x3b')]=_[_0xfc46('0x35')](_0x942817[_0xfc46('0x31')],_0x942817[_0xfc46('0x33')]);_0x1e1aca[_0xfc46('0x34')]=_['intersection'](_0x942817[_0xfc46('0x31')],qs[_0xfc46('0x46')](_0x526450['query'][_0xfc46('0x46')]));_0x1e1aca[_0xfc46('0x34')]=_0x1e1aca[_0xfc46('0x34')]['length']?_0x1e1aca[_0xfc46('0x34')]:_0x942817[_0xfc46('0x31')];_0x1e1aca[_0xfc46('0x4e')]=qs[_0xfc46('0x39')](_0x526450[_0xfc46('0x33')]['sort']);_0x1e1aca[_0xfc46('0x4f')]=qs[_0xfc46('0x3b')](_['pick'](_0x526450[_0xfc46('0x33')],_0x942817['filters']));if(_0x526450['query']['filter']){_0x1e1aca['where']=_['merge'](_0x1e1aca[_0xfc46('0x4f')],{'$or':_['map'](_0x1e1aca[_0xfc46('0x34')],function(_0x2c1ae6){var _0xe01ce6={};_0xe01ce6[_0x2c1ae6]={'$like':'%'+_0x526450['query']['filter']+'%'};return _0xe01ce6;})});}_0x1e1aca=_['merge']({},_0x1e1aca,_0x526450[_0xfc46('0x3f')]);return _0x5f1743[_0xfc46('0x4b')](_0x1e1aca);}})[_0xfc46('0x25')](function(_0x322b8c){if(_0x322b8c){_0x5401df=_0x322b8c[_0xfc46('0x36')];if(!_0x526450[_0xfc46('0x33')][_0xfc46('0x37')](_0xfc46('0x38'))){_0x1e1aca['limit']=qs['limit'](_0x526450[_0xfc46('0x33')][_0xfc46('0x1d')]);_0x1e1aca[_0xfc46('0x1b')]=qs[_0xfc46('0x1b')](_0x526450[_0xfc46('0x33')][_0xfc46('0x1b')]);}return _0x5f1743[_0xfc46('0x4b')](_0x1e1aca);}})[_0xfc46('0x25')](function(_0x4cc34b){if(_0x4cc34b){return _0x4cc34b?{'count':_0x5401df,'rows':_0x4cc34b}:null;}})[_0xfc46('0x25')](respondWithResult(_0x4b969b,null))[_0xfc46('0x42')](handleError(_0x4b969b,null));};exports[_0xfc46('0x50')]=function(_0x544b79,_0x47539c,_0x2c7fe6){var _0x320876={};var _0x36d941={};var _0x481b61;var _0x374d1f;return db['ServicenowConfiguration'][_0xfc46('0x4c')]({'where':{'id':_0x544b79[_0xfc46('0x44')]['id']}})[_0xfc46('0x25')](handleEntityNotFound(_0x47539c,null))['then'](function(_0x109b43){if(_0x109b43){_0x481b61=_0x109b43;_0x36d941[_0xfc46('0x31')]=_[_0xfc46('0x45')](db['ServicenowField']['rawAttributes']);_0x36d941[_0xfc46('0x33')]=_[_0xfc46('0x45')](_0x544b79[_0xfc46('0x33')]);_0x36d941[_0xfc46('0x3b')]=_['intersection'](_0x36d941[_0xfc46('0x31')],_0x36d941[_0xfc46('0x33')]);_0x320876[_0xfc46('0x34')]=_[_0xfc46('0x35')](_0x36d941[_0xfc46('0x31')],qs['fields'](_0x544b79[_0xfc46('0x33')][_0xfc46('0x46')]));_0x320876['attributes']=_0x320876[_0xfc46('0x34')]['length']?_0x320876['attributes']:_0x36d941['model'];_0x320876['order']=qs[_0xfc46('0x39')](_0x544b79[_0xfc46('0x33')][_0xfc46('0x39')]);_0x320876['where']=qs[_0xfc46('0x3b')](_['pick'](_0x544b79[_0xfc46('0x33')],_0x36d941[_0xfc46('0x3b')]));if(_0x544b79[_0xfc46('0x33')][_0xfc46('0x3c')]){_0x320876['where']=_[_0xfc46('0x3d')](_0x320876[_0xfc46('0x4f')],{'$or':_[_0xfc46('0x32')](_0x320876[_0xfc46('0x34')],function(_0x110437){var _0x4af4b4={};_0x4af4b4[_0x110437]={'$like':'%'+_0x544b79[_0xfc46('0x33')]['filter']+'%'};return _0x4af4b4;})});}_0x320876=_['merge']({},_0x320876,_0x544b79[_0xfc46('0x3f')]);return _0x481b61[_0xfc46('0x50')](_0x320876);}})[_0xfc46('0x25')](function(_0x544d63){if(_0x544d63){_0x374d1f=_0x544d63[_0xfc46('0x36')];if(!_0x544b79[_0xfc46('0x33')][_0xfc46('0x37')](_0xfc46('0x38'))){_0x320876[_0xfc46('0x1d')]=qs['limit'](_0x544b79[_0xfc46('0x33')][_0xfc46('0x1d')]);_0x320876[_0xfc46('0x1b')]=qs[_0xfc46('0x1b')](_0x544b79[_0xfc46('0x33')][_0xfc46('0x1b')]);}return _0x481b61[_0xfc46('0x50')](_0x320876);}})['then'](function(_0x7aa840){if(_0x7aa840){return _0x7aa840?{'count':_0x374d1f,'rows':_0x7aa840}:null;}})['then'](respondWithResult(_0x47539c,null))[_0xfc46('0x42')](handleError(_0x47539c,null));};exports[_0xfc46('0x51')]=function(_0x49aae3,_0x27faf2,_0x45b162){var _0x59b44e={};var _0x8c9052={};var _0x4821aa;var _0x2f8859;return db['ServicenowConfiguration'][_0xfc46('0x4c')]({'where':{'id':_0x49aae3[_0xfc46('0x44')]['id']}})[_0xfc46('0x25')](handleEntityNotFound(_0x27faf2,null))[_0xfc46('0x25')](function(_0x326ecd){if(_0x326ecd){_0x4821aa=_0x326ecd;_0x8c9052['model']=_[_0xfc46('0x45')](db[_0xfc46('0x4d')][_0xfc46('0x2d')]);_0x8c9052[_0xfc46('0x33')]=_[_0xfc46('0x45')](_0x49aae3[_0xfc46('0x33')]);_0x8c9052[_0xfc46('0x3b')]=_[_0xfc46('0x35')](_0x8c9052['model'],_0x8c9052[_0xfc46('0x33')]);_0x59b44e[_0xfc46('0x34')]=_[_0xfc46('0x35')](_0x8c9052[_0xfc46('0x31')],qs[_0xfc46('0x46')](_0x49aae3[_0xfc46('0x33')][_0xfc46('0x46')]));_0x59b44e['attributes']=_0x59b44e[_0xfc46('0x34')][_0xfc46('0x36')]?_0x59b44e['attributes']:_0x8c9052[_0xfc46('0x31')];_0x59b44e[_0xfc46('0x4e')]=qs['sort'](_0x49aae3[_0xfc46('0x33')][_0xfc46('0x39')]);_0x59b44e[_0xfc46('0x4f')]=qs[_0xfc46('0x3b')](_['pick'](_0x49aae3[_0xfc46('0x33')],_0x8c9052[_0xfc46('0x3b')]));if(_0x49aae3[_0xfc46('0x33')][_0xfc46('0x3c')]){_0x59b44e[_0xfc46('0x4f')]=_['merge'](_0x59b44e[_0xfc46('0x4f')],{'$or':_[_0xfc46('0x32')](_0x59b44e[_0xfc46('0x34')],function(_0x563403){var _0x297395={};_0x297395[_0x563403]={'$like':'%'+_0x49aae3['query'][_0xfc46('0x3c')]+'%'};return _0x297395;})});}_0x59b44e=_[_0xfc46('0x3d')]({},_0x59b44e,_0x49aae3[_0xfc46('0x3f')]);return _0x4821aa[_0xfc46('0x51')](_0x59b44e);}})[_0xfc46('0x25')](function(_0xb3ea3d){if(_0xb3ea3d){_0x2f8859=_0xb3ea3d[_0xfc46('0x36')];if(!_0x49aae3[_0xfc46('0x33')][_0xfc46('0x37')](_0xfc46('0x38'))){_0x59b44e[_0xfc46('0x1d')]=qs[_0xfc46('0x1d')](_0x49aae3[_0xfc46('0x33')][_0xfc46('0x1d')]);_0x59b44e[_0xfc46('0x1b')]=qs[_0xfc46('0x1b')](_0x49aae3[_0xfc46('0x33')][_0xfc46('0x1b')]);}return _0x4821aa[_0xfc46('0x51')](_0x59b44e);}})[_0xfc46('0x25')](function(_0x3fbb1c){if(_0x3fbb1c){return _0x3fbb1c?{'count':_0x2f8859,'rows':_0x3fbb1c}:null;}})[_0xfc46('0x25')](respondWithResult(_0x27faf2,null))[_0xfc46('0x42')](handleError(_0x27faf2,null));}; \ No newline at end of file +var _0x8983=['order','sort','where','pick','filters','filter','merge','VIRTUAL','options','ServicenowConfiguration','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','destroy','getFields','findOne','ServicenowField','rawAttributes','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','error','stack','send','map','type','key','model','name','query','keys','intersection','fields','attributes','hasOwnProperty'];(function(_0x56dbc3,_0x41c87a){var _0x58cf7f=function(_0x5a06e7){while(--_0x5a06e7){_0x56dbc3['push'](_0x56dbc3['shift']());}};_0x58cf7f(++_0x41c87a);}(_0x8983,0x179));var _0x3898=function(_0x1b94b2,_0x5beda5){_0x1b94b2=_0x1b94b2-0x0;var _0x58c4bd=_0x8983[_0x1b94b2];return _0x58c4bd;};'use strict';var emlformat=require(_0x3898('0x0'));var rimraf=require(_0x3898('0x1'));var zipdir=require(_0x3898('0x2'));var jsonpatch=require(_0x3898('0x3'));var rp=require(_0x3898('0x4'));var moment=require(_0x3898('0x5'));var BPromise=require(_0x3898('0x6'));var Mustache=require(_0x3898('0x7'));var util=require(_0x3898('0x8'));var path=require(_0x3898('0x9'));var sox=require(_0x3898('0xa'));var csv=require(_0x3898('0xb'));var ejs=require(_0x3898('0xc'));var fs=require('fs');var fs_extra=require(_0x3898('0xd'));var _=require(_0x3898('0xe'));var squel=require(_0x3898('0xf'));var crypto=require(_0x3898('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3898('0x11'));var toCsv=require('to-csv');var querystring=require(_0x3898('0x12'));var Papa=require(_0x3898('0x13'));var Redis=require(_0x3898('0x14'));var authService=require(_0x3898('0x15'));var qs=require(_0x3898('0x16'));var as=require(_0x3898('0x17'));var hardwareService=require(_0x3898('0x18'));var logger=require(_0x3898('0x19'))(_0x3898('0x1a'));var utils=require('../../config/utils');var config=require(_0x3898('0x1b'));var licenseUtil=require(_0x3898('0x1c'));var db=require(_0x3898('0x1d'))['db'];function respondWithStatusCode(_0x182ba2,_0x267ba3){_0x267ba3=_0x267ba3||0xcc;return function(_0x16a7d0){if(_0x16a7d0){return _0x182ba2[_0x3898('0x1e')](_0x267ba3);}return _0x182ba2['status'](_0x267ba3)[_0x3898('0x1f')]();};}function respondWithResult(_0x3745ae,_0x212fc7){_0x212fc7=_0x212fc7||0xc8;return function(_0x3a4a90){if(_0x3a4a90){return _0x3745ae['status'](_0x212fc7)[_0x3898('0x20')](_0x3a4a90);}};}function respondWithFilteredResult(_0x4f2295,_0x36f17b){return function(_0x21281c){if(_0x21281c){var _0x29b4f2=typeof _0x36f17b[_0x3898('0x21')]===_0x3898('0x22')&&typeof _0x36f17b[_0x3898('0x23')]==='undefined';var _0x3c8358=_0x21281c[_0x3898('0x24')];var _0x3407a7=_0x29b4f2?0x0:_0x36f17b[_0x3898('0x21')];var _0x2ab2c4=_0x29b4f2?_0x21281c[_0x3898('0x24')]:_0x36f17b['offset']+_0x36f17b[_0x3898('0x23')];var _0x572fd8;if(_0x2ab2c4>=_0x3c8358){_0x2ab2c4=_0x3c8358;_0x572fd8=0xc8;}else{_0x572fd8=0xce;}_0x4f2295[_0x3898('0x25')](_0x572fd8);return _0x4f2295[_0x3898('0x26')](_0x3898('0x27'),_0x3407a7+'-'+_0x2ab2c4+'/'+_0x3c8358)[_0x3898('0x20')](_0x21281c);}return null;};}function patchUpdates(_0x7d480a){return function(_0x32b927){try{jsonpatch[_0x3898('0x28')](_0x32b927,_0x7d480a,!![]);}catch(_0x382d44){return BPromise['reject'](_0x382d44);}return _0x32b927[_0x3898('0x29')]();};}function saveUpdates(_0x2aa0b9,_0x261e17){return function(_0x34d945){if(_0x34d945){return _0x34d945[_0x3898('0x2a')](_0x2aa0b9)[_0x3898('0x2b')](function(_0x5db1da){return _0x5db1da;});}return null;};}function removeEntity(_0x303778,_0x1aacfd){return function(_0x953e79){if(_0x953e79){return _0x953e79['destroy']()[_0x3898('0x2b')](function(){_0x303778[_0x3898('0x25')](0xcc)[_0x3898('0x1f')]();});}};}function handleEntityNotFound(_0x5377ff,_0x5e65d8){return function(_0x27937e){if(!_0x27937e){_0x5377ff[_0x3898('0x1e')](0x194);}return _0x27937e;};}function handleError(_0x22d4d5,_0x225176){_0x225176=_0x225176||0x1f4;return function(_0x401b40){logger[_0x3898('0x2c')](_0x401b40[_0x3898('0x2d')]);if(_0x401b40['name']){delete _0x401b40['name'];}_0x22d4d5['status'](_0x225176)[_0x3898('0x2e')](_0x401b40);};}exports['index']=function(_0x595d8f,_0x1ca0c0){var _0x339c18={},_0x1243e0={},_0x28b969={'count':0x0,'rows':[]};var _0x57b774=_[_0x3898('0x2f')](db['ServicenowConfiguration']['rawAttributes'],function(_0x67af26){return{'name':_0x67af26['fieldName'],'type':_0x67af26[_0x3898('0x30')][_0x3898('0x31')]};});_0x1243e0[_0x3898('0x32')]=_[_0x3898('0x2f')](_0x57b774,_0x3898('0x33'));_0x1243e0[_0x3898('0x34')]=_[_0x3898('0x35')](_0x595d8f[_0x3898('0x34')]);_0x1243e0['filters']=_['intersection'](_0x1243e0['model'],_0x1243e0[_0x3898('0x34')]);_0x339c18['attributes']=_[_0x3898('0x36')](_0x1243e0[_0x3898('0x32')],qs['fields'](_0x595d8f[_0x3898('0x34')][_0x3898('0x37')]));_0x339c18['attributes']=_0x339c18['attributes']['length']?_0x339c18[_0x3898('0x38')]:_0x1243e0['model'];if(!_0x595d8f[_0x3898('0x34')][_0x3898('0x39')]('nolimit')){_0x339c18[_0x3898('0x23')]=qs['limit'](_0x595d8f[_0x3898('0x34')][_0x3898('0x23')]);_0x339c18[_0x3898('0x21')]=qs['offset'](_0x595d8f[_0x3898('0x34')][_0x3898('0x21')]);}_0x339c18[_0x3898('0x3a')]=qs[_0x3898('0x3b')](_0x595d8f[_0x3898('0x34')]['sort']);_0x339c18[_0x3898('0x3c')]=qs['filters'](_[_0x3898('0x3d')](_0x595d8f[_0x3898('0x34')],_0x1243e0[_0x3898('0x3e')]),_0x57b774);if(_0x595d8f['query'][_0x3898('0x3f')]){_0x339c18[_0x3898('0x3c')]=_[_0x3898('0x40')](_0x339c18['where'],{'$or':_[_0x3898('0x2f')](_0x57b774,function(_0x19eb6a){if(_0x19eb6a['type']!==_0x3898('0x41')){var _0x3de727={};_0x3de727[_0x19eb6a[_0x3898('0x33')]]={'$like':'%'+_0x595d8f['query']['filter']+'%'};return _0x3de727;}})});}_0x339c18=_[_0x3898('0x40')]({},_0x339c18,_0x595d8f[_0x3898('0x42')]);var _0x47f814={'where':_0x339c18[_0x3898('0x3c')]};return db[_0x3898('0x43')]['count'](_0x47f814)[_0x3898('0x2b')](function(_0x520aee){_0x28b969[_0x3898('0x24')]=_0x520aee;if(_0x595d8f[_0x3898('0x34')][_0x3898('0x44')]){_0x339c18[_0x3898('0x45')]=[{'all':!![]}];}return db[_0x3898('0x43')][_0x3898('0x46')](_0x339c18);})[_0x3898('0x2b')](function(_0x5236f8){_0x28b969[_0x3898('0x47')]=_0x5236f8;return _0x28b969;})[_0x3898('0x2b')](respondWithFilteredResult(_0x1ca0c0,_0x339c18))[_0x3898('0x48')](handleError(_0x1ca0c0,null));};exports[_0x3898('0x49')]=function(_0x1c3a5e,_0x5203f8){var _0x702380={'raw':![],'where':{'id':_0x1c3a5e[_0x3898('0x4a')]['id']}},_0x50acd8={};_0x50acd8[_0x3898('0x32')]=_[_0x3898('0x35')](db[_0x3898('0x43')]['rawAttributes']);_0x50acd8[_0x3898('0x34')]=_[_0x3898('0x35')](_0x1c3a5e[_0x3898('0x34')]);_0x50acd8['filters']=_[_0x3898('0x36')](_0x50acd8[_0x3898('0x32')],_0x50acd8['query']);_0x702380[_0x3898('0x38')]=_[_0x3898('0x36')](_0x50acd8[_0x3898('0x32')],qs[_0x3898('0x37')](_0x1c3a5e['query'][_0x3898('0x37')]));_0x702380[_0x3898('0x38')]=_0x702380['attributes'][_0x3898('0x4b')]?_0x702380[_0x3898('0x38')]:_0x50acd8[_0x3898('0x32')];if(_0x1c3a5e[_0x3898('0x34')][_0x3898('0x44')]){_0x702380[_0x3898('0x45')]=[{'all':!![]}];}_0x702380=_[_0x3898('0x40')]({},_0x702380,_0x1c3a5e[_0x3898('0x42')]);return db[_0x3898('0x43')]['find'](_0x702380)[_0x3898('0x2b')](handleEntityNotFound(_0x5203f8,null))[_0x3898('0x2b')](respondWithResult(_0x5203f8,null))['catch'](handleError(_0x5203f8,null));};exports[_0x3898('0x4c')]=function(_0x5f37a2,_0x4a344f){return db['ServicenowConfiguration'][_0x3898('0x4c')](_0x5f37a2[_0x3898('0x4d')],{})['then'](respondWithResult(_0x4a344f,0xc9))['catch'](handleError(_0x4a344f,null));};exports[_0x3898('0x2a')]=function(_0x1448ac,_0x32026c){if(_0x1448ac['body']['id']){delete _0x1448ac[_0x3898('0x4d')]['id'];}return db[_0x3898('0x43')][_0x3898('0x4e')]({'where':{'id':_0x1448ac[_0x3898('0x4a')]['id']}})[_0x3898('0x2b')](handleEntityNotFound(_0x32026c,null))[_0x3898('0x2b')](saveUpdates(_0x1448ac[_0x3898('0x4d')],null))[_0x3898('0x2b')](respondWithResult(_0x32026c,null))[_0x3898('0x48')](handleError(_0x32026c,null));};exports[_0x3898('0x4f')]=function(_0x5106ab,_0x5a48c4){return db['ServicenowConfiguration'][_0x3898('0x4e')]({'where':{'id':_0x5106ab[_0x3898('0x4a')]['id']}})[_0x3898('0x2b')](handleEntityNotFound(_0x5a48c4,null))[_0x3898('0x2b')](removeEntity(_0x5a48c4,null))['catch'](handleError(_0x5a48c4,null));};exports[_0x3898('0x50')]=function(_0x4b17ae,_0x429d9b,_0x48329b){var _0x3ed375={};var _0x15848b={};var _0x58f72b;var _0x15e8f2;return db[_0x3898('0x43')][_0x3898('0x51')]({'where':{'id':_0x4b17ae[_0x3898('0x4a')]['id']}})[_0x3898('0x2b')](handleEntityNotFound(_0x429d9b,null))[_0x3898('0x2b')](function(_0xabdb70){if(_0xabdb70){_0x58f72b=_0xabdb70;_0x15848b[_0x3898('0x32')]=_[_0x3898('0x35')](db[_0x3898('0x52')][_0x3898('0x53')]);_0x15848b[_0x3898('0x34')]=_['keys'](_0x4b17ae['query']);_0x15848b[_0x3898('0x3e')]=_[_0x3898('0x36')](_0x15848b[_0x3898('0x32')],_0x15848b['query']);_0x3ed375[_0x3898('0x38')]=_[_0x3898('0x36')](_0x15848b[_0x3898('0x32')],qs[_0x3898('0x37')](_0x4b17ae['query']['fields']));_0x3ed375['attributes']=_0x3ed375[_0x3898('0x38')][_0x3898('0x4b')]?_0x3ed375[_0x3898('0x38')]:_0x15848b[_0x3898('0x32')];_0x3ed375[_0x3898('0x3a')]=qs[_0x3898('0x3b')](_0x4b17ae[_0x3898('0x34')][_0x3898('0x3b')]);_0x3ed375[_0x3898('0x3c')]=qs[_0x3898('0x3e')](_[_0x3898('0x3d')](_0x4b17ae[_0x3898('0x34')],_0x15848b[_0x3898('0x3e')]));if(_0x4b17ae[_0x3898('0x34')][_0x3898('0x3f')]){_0x3ed375[_0x3898('0x3c')]=_['merge'](_0x3ed375['where'],{'$or':_[_0x3898('0x2f')](_0x3ed375[_0x3898('0x38')],function(_0x45bc91){var _0x453d6e={};_0x453d6e[_0x45bc91]={'$like':'%'+_0x4b17ae[_0x3898('0x34')]['filter']+'%'};return _0x453d6e;})});}_0x3ed375=_[_0x3898('0x40')]({},_0x3ed375,_0x4b17ae[_0x3898('0x42')]);return _0x58f72b[_0x3898('0x50')](_0x3ed375);}})['then'](function(_0x176644){if(_0x176644){_0x15e8f2=_0x176644['length'];if(!_0x4b17ae[_0x3898('0x34')]['hasOwnProperty'](_0x3898('0x54'))){_0x3ed375['limit']=qs['limit'](_0x4b17ae[_0x3898('0x34')][_0x3898('0x23')]);_0x3ed375[_0x3898('0x21')]=qs[_0x3898('0x21')](_0x4b17ae[_0x3898('0x34')][_0x3898('0x21')]);}return _0x58f72b[_0x3898('0x50')](_0x3ed375);}})[_0x3898('0x2b')](function(_0x485014){if(_0x485014){return _0x485014?{'count':_0x15e8f2,'rows':_0x485014}:null;}})['then'](respondWithResult(_0x429d9b,null))[_0x3898('0x48')](handleError(_0x429d9b,null));};exports[_0x3898('0x55')]=function(_0x3a53a1,_0x135c7b,_0x2ce8b4){var _0x393aa7={};var _0x1bf683={};var _0x3c4ac1;var _0x2d6d16;return db[_0x3898('0x43')][_0x3898('0x51')]({'where':{'id':_0x3a53a1['params']['id']}})[_0x3898('0x2b')](handleEntityNotFound(_0x135c7b,null))['then'](function(_0x5f0856){if(_0x5f0856){_0x3c4ac1=_0x5f0856;_0x1bf683['model']=_['keys'](db['ServicenowField'][_0x3898('0x53')]);_0x1bf683['query']=_[_0x3898('0x35')](_0x3a53a1[_0x3898('0x34')]);_0x1bf683[_0x3898('0x3e')]=_[_0x3898('0x36')](_0x1bf683[_0x3898('0x32')],_0x1bf683[_0x3898('0x34')]);_0x393aa7[_0x3898('0x38')]=_[_0x3898('0x36')](_0x1bf683[_0x3898('0x32')],qs[_0x3898('0x37')](_0x3a53a1[_0x3898('0x34')][_0x3898('0x37')]));_0x393aa7[_0x3898('0x38')]=_0x393aa7['attributes'][_0x3898('0x4b')]?_0x393aa7['attributes']:_0x1bf683[_0x3898('0x32')];_0x393aa7['order']=qs['sort'](_0x3a53a1[_0x3898('0x34')]['sort']);_0x393aa7[_0x3898('0x3c')]=qs[_0x3898('0x3e')](_[_0x3898('0x3d')](_0x3a53a1[_0x3898('0x34')],_0x1bf683[_0x3898('0x3e')]));if(_0x3a53a1['query']['filter']){_0x393aa7[_0x3898('0x3c')]=_[_0x3898('0x40')](_0x393aa7['where'],{'$or':_[_0x3898('0x2f')](_0x393aa7['attributes'],function(_0x3a431b){var _0x1a205c={};_0x1a205c[_0x3a431b]={'$like':'%'+_0x3a53a1[_0x3898('0x34')][_0x3898('0x3f')]+'%'};return _0x1a205c;})});}_0x393aa7=_['merge']({},_0x393aa7,_0x3a53a1[_0x3898('0x42')]);return _0x3c4ac1[_0x3898('0x55')](_0x393aa7);}})['then'](function(_0x45e0c0){if(_0x45e0c0){_0x2d6d16=_0x45e0c0[_0x3898('0x4b')];if(!_0x3a53a1[_0x3898('0x34')]['hasOwnProperty']('nolimit')){_0x393aa7[_0x3898('0x23')]=qs[_0x3898('0x23')](_0x3a53a1[_0x3898('0x34')][_0x3898('0x23')]);_0x393aa7[_0x3898('0x21')]=qs[_0x3898('0x21')](_0x3a53a1['query']['offset']);}return _0x3c4ac1['getSubjects'](_0x393aa7);}})[_0x3898('0x2b')](function(_0x143241){if(_0x143241){return _0x143241?{'count':_0x2d6d16,'rows':_0x143241}:null;}})[_0x3898('0x2b')](respondWithResult(_0x135c7b,null))['catch'](handleError(_0x135c7b,null));};exports[_0x3898('0x56')]=function(_0x213e55,_0x19c59f,_0xb55b5){var _0x4915a4={};var _0x249e44={};var _0x5b91c9;var _0x9aa8fe;return db[_0x3898('0x43')][_0x3898('0x51')]({'where':{'id':_0x213e55[_0x3898('0x4a')]['id']}})[_0x3898('0x2b')](handleEntityNotFound(_0x19c59f,null))['then'](function(_0x3b6ddd){if(_0x3b6ddd){_0x5b91c9=_0x3b6ddd;_0x249e44[_0x3898('0x32')]=_[_0x3898('0x35')](db['ServicenowField']['rawAttributes']);_0x249e44[_0x3898('0x34')]=_[_0x3898('0x35')](_0x213e55[_0x3898('0x34')]);_0x249e44[_0x3898('0x3e')]=_['intersection'](_0x249e44[_0x3898('0x32')],_0x249e44['query']);_0x4915a4[_0x3898('0x38')]=_[_0x3898('0x36')](_0x249e44[_0x3898('0x32')],qs[_0x3898('0x37')](_0x213e55['query'][_0x3898('0x37')]));_0x4915a4[_0x3898('0x38')]=_0x4915a4[_0x3898('0x38')]['length']?_0x4915a4[_0x3898('0x38')]:_0x249e44[_0x3898('0x32')];_0x4915a4['order']=qs['sort'](_0x213e55[_0x3898('0x34')][_0x3898('0x3b')]);_0x4915a4['where']=qs['filters'](_[_0x3898('0x3d')](_0x213e55[_0x3898('0x34')],_0x249e44[_0x3898('0x3e')]));if(_0x213e55[_0x3898('0x34')][_0x3898('0x3f')]){_0x4915a4[_0x3898('0x3c')]=_['merge'](_0x4915a4[_0x3898('0x3c')],{'$or':_[_0x3898('0x2f')](_0x4915a4[_0x3898('0x38')],function(_0x1744a1){var _0x54fac5={};_0x54fac5[_0x1744a1]={'$like':'%'+_0x213e55[_0x3898('0x34')][_0x3898('0x3f')]+'%'};return _0x54fac5;})});}_0x4915a4=_[_0x3898('0x40')]({},_0x4915a4,_0x213e55[_0x3898('0x42')]);return _0x5b91c9['getDescriptions'](_0x4915a4);}})[_0x3898('0x2b')](function(_0x507aac){if(_0x507aac){_0x9aa8fe=_0x507aac[_0x3898('0x4b')];if(!_0x213e55['query'][_0x3898('0x39')](_0x3898('0x54'))){_0x4915a4[_0x3898('0x23')]=qs[_0x3898('0x23')](_0x213e55[_0x3898('0x34')][_0x3898('0x23')]);_0x4915a4[_0x3898('0x21')]=qs[_0x3898('0x21')](_0x213e55[_0x3898('0x34')][_0x3898('0x21')]);}return _0x5b91c9[_0x3898('0x56')](_0x4915a4);}})['then'](function(_0x5ebeba){if(_0x5ebeba){return _0x5ebeba?{'count':_0x9aa8fe,'rows':_0x5ebeba}:null;}})[_0x3898('0x2b')](respondWithResult(_0x19c59f,null))[_0x3898('0x48')](handleError(_0x19c59f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index c3e5d0d..cc52d31 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 _0x56bd=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x52bcc6,_0x3de945){var _0xa6852b=function(_0x2095c2){while(--_0x2095c2){_0x52bcc6['push'](_0x52bcc6['shift']());}};_0xa6852b(++_0x3de945);}(_0x56bd,0xe9));var _0xd56b=function(_0x15e346,_0x2f9ad1){_0x15e346=_0x15e346-0x0;var _0x246007=_0x56bd[_0x15e346];return _0x246007;};'use strict';var _=require('lodash');var util=require(_0xd56b('0x0'));var logger=require(_0xd56b('0x1'))(_0xd56b('0x2'));var moment=require('moment');var BPromise=require(_0xd56b('0x3'));var rp=require(_0xd56b('0x4'));var fs=require('fs');var path=require(_0xd56b('0x5'));var rimraf=require(_0xd56b('0x6'));var config=require('../../config/environment');var attributes=require(_0xd56b('0x7'));module[_0xd56b('0x8')]=function(_0x1ac686,_0x18a88e){return _0x1ac686[_0xd56b('0x9')](_0xd56b('0xa'),attributes,{'tableName':_0xd56b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfff0=['./intServicenowConfiguration.attributes','define','int_servicenow_configurations','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xfff0,0x139));var _0x0fff=function(_0x52d243,_0x1bdd35){_0x52d243=_0x52d243-0x0;var _0x11e2a0=_0xfff0[_0x52d243];return _0x11e2a0;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var logger=require(_0x0fff('0x1'))(_0x0fff('0x2'));var moment=require('moment');var BPromise=require(_0x0fff('0x3'));var rp=require(_0x0fff('0x4'));var fs=require('fs');var path=require(_0x0fff('0x5'));var rimraf=require('rimraf');var config=require(_0x0fff('0x6'));var attributes=require(_0x0fff('0x7'));module['exports']=function(_0x33c813,_0x4c2221){return _0x33c813[_0x0fff('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0x0fff('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 1736834..a11b901 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 _0x548f=['stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0x548f,0x104));var _0xf548=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x548f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf548('0x0'));var util=require(_0xf548('0x1'));var moment=require(_0xf548('0x2'));var BPromise=require('bluebird');var rs=require(_0xf548('0x3'));var fs=require('fs');var Redis=require(_0xf548('0x4'));var db=require(_0xf548('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf548('0x6'));var config=require(_0xf548('0x7'));var jayson=require(_0xf548('0x8'));var client=jayson[_0xf548('0x9')][_0xf548('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd792cd,_0x403d88,_0x5bfe40){return new BPromise(function(_0x25aa35,_0x343bbc){return client[_0xf548('0xb')](_0xd792cd,_0x5bfe40)[_0xf548('0xc')](function(_0x1509d9){logger[_0xf548('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x403d88,_0xf548('0xe'));logger[_0xf548('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x403d88,_0xf548('0xe'),JSON[_0xf548('0x10')](_0x1509d9));if(_0x1509d9[_0xf548('0x11')]){if(_0x1509d9[_0xf548('0x11')][_0xf548('0x12')]===0x1f4){logger[_0xf548('0x11')](_0xf548('0x13'),_0x403d88,_0x1509d9[_0xf548('0x11')]['message']);return _0x343bbc(_0x1509d9[_0xf548('0x11')][_0xf548('0x14')]);}logger[_0xf548('0x11')](_0xf548('0x13'),_0x403d88,_0x1509d9[_0xf548('0x11')][_0xf548('0x14')]);return _0x25aa35(_0x1509d9[_0xf548('0x11')][_0xf548('0x14')]);}else{logger['info'](_0xf548('0x13'),_0x403d88,'request\x20sent');_0x25aa35(_0x1509d9[_0xf548('0x15')][_0xf548('0x14')]);}})[_0xf548('0x16')](function(_0x43da63){logger[_0xf548('0x11')](_0xf548('0x13'),_0x403d88,_0x43da63);_0x343bbc(_0x43da63);});});} \ No newline at end of file +var _0xd3e3=['http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x5b7377,_0x40997a){var _0x128801=function(_0x2964db){while(--_0x2964db){_0x5b7377['push'](_0x5b7377['shift']());}};_0x128801(++_0x40997a);}(_0xd3e3,0xdd));var _0x3d3e=function(_0x1de41b,_0x1ddfe9){_0x1de41b=_0x1de41b-0x0;var _0x58d016=_0xd3e3[_0x1de41b];return _0x58d016;};'use strict';var _=require(_0x3d3e('0x0'));var util=require(_0x3d3e('0x1'));var moment=require(_0x3d3e('0x2'));var BPromise=require(_0x3d3e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d3e('0x4'));var db=require(_0x3d3e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d3e('0x6'))(_0x3d3e('0x7'));var config=require('../../config/environment');var jayson=require(_0x3d3e('0x8'));var client=jayson[_0x3d3e('0x9')][_0x3d3e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f0668,_0xbf673e,_0x51a23c){return new BPromise(function(_0xa4d65d,_0x3324a2){return client[_0x3d3e('0xb')](_0x3f0668,_0x51a23c)['then'](function(_0x3cfff9){logger[_0x3d3e('0xc')](_0x3d3e('0xd'),_0xbf673e,_0x3d3e('0xe'));logger['debug'](_0x3d3e('0xf'),_0xbf673e,'request\x20sent',JSON[_0x3d3e('0x10')](_0x3cfff9));if(_0x3cfff9[_0x3d3e('0x11')]){if(_0x3cfff9[_0x3d3e('0x11')][_0x3d3e('0x12')]===0x1f4){logger['error'](_0x3d3e('0xd'),_0xbf673e,_0x3cfff9[_0x3d3e('0x11')]['message']);return _0x3324a2(_0x3cfff9[_0x3d3e('0x11')][_0x3d3e('0x13')]);}logger[_0x3d3e('0x11')](_0x3d3e('0xd'),_0xbf673e,_0x3cfff9[_0x3d3e('0x11')][_0x3d3e('0x13')]);return _0xa4d65d(_0x3cfff9[_0x3d3e('0x11')][_0x3d3e('0x13')]);}else{logger[_0x3d3e('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0xbf673e,_0x3d3e('0xe'));_0xa4d65d(_0x3cfff9[_0x3d3e('0x14')][_0x3d3e('0x13')]);}})['catch'](function(_0x59f0cb){logger[_0x3d3e('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0xbf673e,_0x59f0cb);_0x3324a2(_0x59f0cb);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index e8b5b76..02b4608 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 _0x1587=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5ba631,_0x1abaa8){var _0x52c572=function(_0xb77273){while(--_0xb77273){_0x5ba631['push'](_0x5ba631['shift']());}};_0x52c572(++_0x1abaa8);}(_0x1587,0x117));var _0x7158=function(_0xa48542,_0x1374d9){_0xa48542=_0xa48542-0x0;var _0x25d640=_0x1587[_0xa48542];return _0x25d640;};'use strict';var multer=require('multer');var util=require(_0x7158('0x0'));var path=require(_0x7158('0x1'));var timeout=require(_0x7158('0x2'));var express=require(_0x7158('0x3'));var router=express[_0x7158('0x4')]();var fs_extra=require(_0x7158('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7158('0x6'));var config=require(_0x7158('0x7'));var controller=require(_0x7158('0x8'));router[_0x7158('0x9')]('/',auth[_0x7158('0xa')](),controller['index']);router[_0x7158('0x9')](_0x7158('0xb'),auth[_0x7158('0xa')](),controller[_0x7158('0xc')]);router[_0x7158('0xd')]('/',auth['isAuthenticated'](),controller[_0x7158('0xe')]);router[_0x7158('0xf')](_0x7158('0xb'),auth[_0x7158('0xa')](),controller['update']);router[_0x7158('0x10')](_0x7158('0xb'),auth['isAuthenticated'](),controller[_0x7158('0x11')]);module[_0x7158('0x12')]=router; \ No newline at end of file +var _0xd110=['show','post','create','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id'];(function(_0x21f176,_0x2054d7){var _0x458cc3=function(_0x1b5c41){while(--_0x1b5c41){_0x21f176['push'](_0x21f176['shift']());}};_0x458cc3(++_0x2054d7);}(_0xd110,0x79));var _0x0d11=function(_0x4d4897,_0x346650){_0x4d4897=_0x4d4897-0x0;var _0x2ad95a=_0xd110[_0x4d4897];return _0x2ad95a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0d11('0x0'));var timeout=require(_0x0d11('0x1'));var express=require('express');var router=express[_0x0d11('0x2')]();var fs_extra=require(_0x0d11('0x3'));var auth=require(_0x0d11('0x4'));var interaction=require(_0x0d11('0x5'));var config=require(_0x0d11('0x6'));var controller=require(_0x0d11('0x7'));router[_0x0d11('0x8')]('/',auth[_0x0d11('0x9')](),controller[_0x0d11('0xa')]);router[_0x0d11('0x8')](_0x0d11('0xb'),auth[_0x0d11('0x9')](),controller[_0x0d11('0xc')]);router[_0x0d11('0xd')]('/',auth[_0x0d11('0x9')](),controller[_0x0d11('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0d11('0xf')]);router[_0x0d11('0x10')](_0x0d11('0xb'),auth['isAuthenticated'](),controller[_0x0d11('0x11')]);module[_0x0d11('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 5e17029..53278e7 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 _0xfa88=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x1ab214,_0xa6b2){var _0x8c67a1=function(_0x511360){while(--_0x511360){_0x1ab214['push'](_0x1ab214['shift']());}};_0x8c67a1(++_0xa6b2);}(_0xfa88,0x15d));var _0x8fa8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xfa88[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x8fa8('0x0'));module['exports']={'type':{'type':Sequelize[_0x8fa8('0x1')](_0x8fa8('0x2'),_0x8fa8('0x3'),_0x8fa8('0x4'),_0x8fa8('0x5'),_0x8fa8('0x6')),'defaultValue':_0x8fa8('0x2')},'content':{'type':Sequelize[_0x8fa8('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8fa8('0x1')](_0x8fa8('0x2'),_0x8fa8('0x3'),_0x8fa8('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8fa8('0x7')]},'nameField':{'type':Sequelize[_0x8fa8('0x7')]},'customField':{'type':Sequelize[_0x8fa8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8fa8('0x7')]}}; \ No newline at end of file +var _0x341b=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x14502a,_0x1f9bbd){var _0x21f359=function(_0xb0b37c){while(--_0xb0b37c){_0x14502a['push'](_0x14502a['shift']());}};_0x21f359(++_0x1f9bbd);}(_0x341b,0x194));var _0xb341=function(_0x460347,_0x4ba090){_0x460347=_0x460347-0x0;var _0x355db5=_0x341b[_0x460347];return _0x355db5;};'use strict';var Sequelize=require(_0xb341('0x0'));module[_0xb341('0x1')]={'type':{'type':Sequelize[_0xb341('0x2')](_0xb341('0x3'),_0xb341('0x4'),_0xb341('0x5'),_0xb341('0x6'),_0xb341('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb341('0x8')]},'key':{'type':Sequelize[_0xb341('0x8')]},'keyType':{'type':Sequelize[_0xb341('0x2')](_0xb341('0x3'),_0xb341('0x4'),_0xb341('0x5'))},'keyContent':{'type':Sequelize[_0xb341('0x8')]},'idField':{'type':Sequelize[_0xb341('0x8')]},'nameField':{'type':Sequelize[_0xb341('0x8')]},'customField':{'type':Sequelize[_0xb341('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb341('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 2bbd3a9..d0290b1 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 _0x8e21=['sendStatus','stack','name','send','index','map','ServicenowField','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','count','includeAll','catch','params','include','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','set','Content-Range','apply','save','then','destroy'];(function(_0x2adacd,_0x4d3a56){var _0x5e5696=function(_0x3bb53d){while(--_0x3bb53d){_0x2adacd['push'](_0x2adacd['shift']());}};_0x5e5696(++_0x4d3a56);}(_0x8e21,0x1d2));var _0x18e2=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0x8e21[_0x74892f];return _0x10ee61;};'use strict';var emlformat=require(_0x18e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x18e2('0x1'));var jsonpatch=require(_0x18e2('0x2'));var rp=require(_0x18e2('0x3'));var moment=require(_0x18e2('0x4'));var BPromise=require(_0x18e2('0x5'));var Mustache=require('mustache');var util=require(_0x18e2('0x6'));var path=require(_0x18e2('0x7'));var sox=require(_0x18e2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18e2('0x9'));var _=require(_0x18e2('0xa'));var squel=require(_0x18e2('0xb'));var crypto=require('crypto');var jsforce=require(_0x18e2('0xc'));var deskjs=require(_0x18e2('0xd'));var toCsv=require(_0x18e2('0xe'));var querystring=require(_0x18e2('0xf'));var Papa=require(_0x18e2('0x10'));var Redis=require(_0x18e2('0x11'));var authService=require(_0x18e2('0x12'));var qs=require(_0x18e2('0x13'));var as=require(_0x18e2('0x14'));var hardwareService=require(_0x18e2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x18e2('0x16'));var config=require(_0x18e2('0x17'));var licenseUtil=require(_0x18e2('0x18'));var db=require(_0x18e2('0x19'))['db'];function respondWithStatusCode(_0x96604f,_0x3e0a89){_0x3e0a89=_0x3e0a89||0xcc;return function(_0x2bf0f1){if(_0x2bf0f1){return _0x96604f['sendStatus'](_0x3e0a89);}return _0x96604f[_0x18e2('0x1a')](_0x3e0a89)[_0x18e2('0x1b')]();};}function respondWithResult(_0xfdd190,_0x162927){_0x162927=_0x162927||0xc8;return function(_0x5e3c77){if(_0x5e3c77){return _0xfdd190['status'](_0x162927)[_0x18e2('0x1c')](_0x5e3c77);}};}function respondWithFilteredResult(_0x26f8b4,_0x1bc089){return function(_0x2cd4b0){if(_0x2cd4b0){var _0x28d8a3=typeof _0x1bc089[_0x18e2('0x1d')]==='undefined'&&typeof _0x1bc089[_0x18e2('0x1e')]===_0x18e2('0x1f');var _0x3849f2=_0x2cd4b0['count'];var _0x1354f7=_0x28d8a3?0x0:_0x1bc089[_0x18e2('0x1d')];var _0x242ab0=_0x28d8a3?_0x2cd4b0['count']:_0x1bc089[_0x18e2('0x1d')]+_0x1bc089[_0x18e2('0x1e')];var _0x3dc3ba;if(_0x242ab0>=_0x3849f2){_0x242ab0=_0x3849f2;_0x3dc3ba=0xc8;}else{_0x3dc3ba=0xce;}_0x26f8b4['status'](_0x3dc3ba);return _0x26f8b4[_0x18e2('0x20')](_0x18e2('0x21'),_0x1354f7+'-'+_0x242ab0+'/'+_0x3849f2)[_0x18e2('0x1c')](_0x2cd4b0);}return null;};}function patchUpdates(_0x1c4fc9){return function(_0x481e72){try{jsonpatch[_0x18e2('0x22')](_0x481e72,_0x1c4fc9,!![]);}catch(_0x33b39a){return BPromise['reject'](_0x33b39a);}return _0x481e72[_0x18e2('0x23')]();};}function saveUpdates(_0x255790,_0x2aa505){return function(_0x25a293){if(_0x25a293){return _0x25a293['update'](_0x255790)[_0x18e2('0x24')](function(_0x14c0f1){return _0x14c0f1;});}return null;};}function removeEntity(_0x573270,_0x5a0432){return function(_0x5e192c){if(_0x5e192c){return _0x5e192c[_0x18e2('0x25')]()[_0x18e2('0x24')](function(){_0x573270[_0x18e2('0x1a')](0xcc)[_0x18e2('0x1b')]();});}};}function handleEntityNotFound(_0x1ed84a,_0x597321){return function(_0x17c8d0){if(!_0x17c8d0){_0x1ed84a[_0x18e2('0x26')](0x194);}return _0x17c8d0;};}function handleError(_0x573abb,_0xf350c1){_0xf350c1=_0xf350c1||0x1f4;return function(_0x1a6fb1){logger['error'](_0x1a6fb1[_0x18e2('0x27')]);if(_0x1a6fb1[_0x18e2('0x28')]){delete _0x1a6fb1[_0x18e2('0x28')];}_0x573abb['status'](_0xf350c1)[_0x18e2('0x29')](_0x1a6fb1);};}exports[_0x18e2('0x2a')]=function(_0x2b0c19,_0x380931){var _0xf79436={},_0x2fa37c={},_0x101323={'count':0x0,'rows':[]};var _0x95e966=_[_0x18e2('0x2b')](db[_0x18e2('0x2c')][_0x18e2('0x2d')],function(_0x4c7435){return{'name':_0x4c7435['fieldName'],'type':_0x4c7435['type'][_0x18e2('0x2e')]};});_0x2fa37c[_0x18e2('0x2f')]=_[_0x18e2('0x2b')](_0x95e966,_0x18e2('0x28'));_0x2fa37c['query']=_[_0x18e2('0x30')](_0x2b0c19[_0x18e2('0x31')]);_0x2fa37c[_0x18e2('0x32')]=_[_0x18e2('0x33')](_0x2fa37c[_0x18e2('0x2f')],_0x2fa37c[_0x18e2('0x31')]);_0xf79436['attributes']=_[_0x18e2('0x33')](_0x2fa37c[_0x18e2('0x2f')],qs['fields'](_0x2b0c19[_0x18e2('0x31')][_0x18e2('0x34')]));_0xf79436[_0x18e2('0x35')]=_0xf79436[_0x18e2('0x35')][_0x18e2('0x36')]?_0xf79436[_0x18e2('0x35')]:_0x2fa37c[_0x18e2('0x2f')];if(!_0x2b0c19[_0x18e2('0x31')][_0x18e2('0x37')](_0x18e2('0x38'))){_0xf79436[_0x18e2('0x1e')]=qs[_0x18e2('0x1e')](_0x2b0c19[_0x18e2('0x31')][_0x18e2('0x1e')]);_0xf79436['offset']=qs[_0x18e2('0x1d')](_0x2b0c19['query']['offset']);}_0xf79436[_0x18e2('0x39')]=qs[_0x18e2('0x3a')](_0x2b0c19[_0x18e2('0x31')][_0x18e2('0x3a')]);_0xf79436[_0x18e2('0x3b')]=qs[_0x18e2('0x32')](_['pick'](_0x2b0c19[_0x18e2('0x31')],_0x2fa37c[_0x18e2('0x32')]),_0x95e966);if(_0x2b0c19['query'][_0x18e2('0x3c')]){_0xf79436[_0x18e2('0x3b')]=_[_0x18e2('0x3d')](_0xf79436['where'],{'$or':_[_0x18e2('0x2b')](_0x95e966,function(_0x1fe283){if(_0x1fe283[_0x18e2('0x3e')]!=='VIRTUAL'){var _0x3d1297={};_0x3d1297[_0x1fe283[_0x18e2('0x28')]]={'$like':'%'+_0x2b0c19[_0x18e2('0x31')][_0x18e2('0x3c')]+'%'};return _0x3d1297;}})});}_0xf79436=_[_0x18e2('0x3d')]({},_0xf79436,_0x2b0c19['options']);var _0x43245c={'where':_0xf79436[_0x18e2('0x3b')]};return db[_0x18e2('0x2c')][_0x18e2('0x3f')](_0x43245c)[_0x18e2('0x24')](function(_0xd58bcb){_0x101323['count']=_0xd58bcb;if(_0x2b0c19[_0x18e2('0x31')][_0x18e2('0x40')]){_0xf79436['include']=[{'all':!![]}];}return db[_0x18e2('0x2c')]['findAll'](_0xf79436);})['then'](function(_0x3341b3){_0x101323['rows']=_0x3341b3;return _0x101323;})[_0x18e2('0x24')](respondWithFilteredResult(_0x380931,_0xf79436))[_0x18e2('0x41')](handleError(_0x380931,null));};exports['show']=function(_0x2c5bd5,_0x148ac5){var _0x486808={'raw':!![],'where':{'id':_0x2c5bd5[_0x18e2('0x42')]['id']}},_0x259043={};_0x259043['model']=_[_0x18e2('0x30')](db[_0x18e2('0x2c')][_0x18e2('0x2d')]);_0x259043['query']=_[_0x18e2('0x30')](_0x2c5bd5[_0x18e2('0x31')]);_0x259043[_0x18e2('0x32')]=_[_0x18e2('0x33')](_0x259043['model'],_0x259043['query']);_0x486808[_0x18e2('0x35')]=_[_0x18e2('0x33')](_0x259043[_0x18e2('0x2f')],qs[_0x18e2('0x34')](_0x2c5bd5[_0x18e2('0x31')][_0x18e2('0x34')]));_0x486808[_0x18e2('0x35')]=_0x486808[_0x18e2('0x35')][_0x18e2('0x36')]?_0x486808[_0x18e2('0x35')]:_0x259043[_0x18e2('0x2f')];if(_0x2c5bd5[_0x18e2('0x31')]['includeAll']){_0x486808[_0x18e2('0x43')]=[{'all':!![]}];}_0x486808=_[_0x18e2('0x3d')]({},_0x486808,_0x2c5bd5[_0x18e2('0x44')]);return db[_0x18e2('0x2c')][_0x18e2('0x45')](_0x486808)['then'](handleEntityNotFound(_0x148ac5,null))[_0x18e2('0x24')](respondWithResult(_0x148ac5,null))[_0x18e2('0x41')](handleError(_0x148ac5,null));};exports[_0x18e2('0x46')]=function(_0xafd2af,_0xa7e4f4){return db[_0x18e2('0x2c')][_0x18e2('0x46')](_0xafd2af[_0x18e2('0x47')],{})['then'](respondWithResult(_0xa7e4f4,0xc9))[_0x18e2('0x41')](handleError(_0xa7e4f4,null));};exports['update']=function(_0x165753,_0x179ac4){if(_0x165753[_0x18e2('0x47')]['id']){delete _0x165753[_0x18e2('0x47')]['id'];}return db[_0x18e2('0x2c')][_0x18e2('0x45')]({'where':{'id':_0x165753[_0x18e2('0x42')]['id']}})[_0x18e2('0x24')](handleEntityNotFound(_0x179ac4,null))[_0x18e2('0x24')](saveUpdates(_0x165753[_0x18e2('0x47')],null))['then'](respondWithResult(_0x179ac4,null))[_0x18e2('0x41')](handleError(_0x179ac4,null));};exports[_0x18e2('0x25')]=function(_0x429f55,_0x7f7eed){return db[_0x18e2('0x2c')]['find']({'where':{'id':_0x429f55[_0x18e2('0x42')]['id']}})[_0x18e2('0x24')](handleEntityNotFound(_0x7f7eed,null))[_0x18e2('0x24')](removeEntity(_0x7f7eed,null))[_0x18e2('0x41')](handleError(_0x7f7eed,null));}; \ No newline at end of file +var _0xa7b9=['../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5cc45b,_0x395e01){var _0x38dc45=function(_0x29810b){while(--_0x29810b){_0x5cc45b['push'](_0x5cc45b['shift']());}};_0x38dc45(++_0x395e01);}(_0xa7b9,0x83));var _0x9a7b=function(_0x2998db,_0x3424f1){_0x2998db=_0x2998db-0x0;var _0x115fea=_0xa7b9[_0x2998db];return _0x115fea;};'use strict';var emlformat=require(_0x9a7b('0x0'));var rimraf=require(_0x9a7b('0x1'));var zipdir=require(_0x9a7b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a7b('0x3'));var moment=require(_0x9a7b('0x4'));var BPromise=require(_0x9a7b('0x5'));var Mustache=require(_0x9a7b('0x6'));var util=require(_0x9a7b('0x7'));var path=require(_0x9a7b('0x8'));var sox=require('sox');var csv=require(_0x9a7b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a7b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9a7b('0xb'));var deskjs=require(_0x9a7b('0xc'));var toCsv=require(_0x9a7b('0x9'));var querystring=require(_0x9a7b('0xd'));var Papa=require(_0x9a7b('0xe'));var Redis=require(_0x9a7b('0xf'));var authService=require(_0x9a7b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9a7b('0x11'));var hardwareService=require(_0x9a7b('0x12'));var logger=require(_0x9a7b('0x13'))(_0x9a7b('0x14'));var utils=require(_0x9a7b('0x15'));var config=require(_0x9a7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a2c7a,_0x191065){_0x191065=_0x191065||0xcc;return function(_0x4e29eb){if(_0x4e29eb){return _0x3a2c7a[_0x9a7b('0x17')](_0x191065);}return _0x3a2c7a[_0x9a7b('0x18')](_0x191065)['end']();};}function respondWithResult(_0x1ce4d5,_0x74800c){_0x74800c=_0x74800c||0xc8;return function(_0x58b70d){if(_0x58b70d){return _0x1ce4d5[_0x9a7b('0x18')](_0x74800c)[_0x9a7b('0x19')](_0x58b70d);}};}function respondWithFilteredResult(_0x58962e,_0x4c8962){return function(_0x7208b7){if(_0x7208b7){var _0x325b47=typeof _0x4c8962[_0x9a7b('0x1a')]==='undefined'&&typeof _0x4c8962['limit']===_0x9a7b('0x1b');var _0x1d35a2=_0x7208b7[_0x9a7b('0x1c')];var _0x1d4c7b=_0x325b47?0x0:_0x4c8962['offset'];var _0x48a6c1=_0x325b47?_0x7208b7[_0x9a7b('0x1c')]:_0x4c8962[_0x9a7b('0x1a')]+_0x4c8962['limit'];var _0x1f4b73;if(_0x48a6c1>=_0x1d35a2){_0x48a6c1=_0x1d35a2;_0x1f4b73=0xc8;}else{_0x1f4b73=0xce;}_0x58962e[_0x9a7b('0x18')](_0x1f4b73);return _0x58962e[_0x9a7b('0x1d')](_0x9a7b('0x1e'),_0x1d4c7b+'-'+_0x48a6c1+'/'+_0x1d35a2)['json'](_0x7208b7);}return null;};}function patchUpdates(_0x213416){return function(_0x260c5a){try{jsonpatch[_0x9a7b('0x1f')](_0x260c5a,_0x213416,!![]);}catch(_0x25fe08){return BPromise['reject'](_0x25fe08);}return _0x260c5a[_0x9a7b('0x20')]();};}function saveUpdates(_0x5edb0f,_0x1ce48c){return function(_0x50623b){if(_0x50623b){return _0x50623b['update'](_0x5edb0f)[_0x9a7b('0x21')](function(_0x541550){return _0x541550;});}return null;};}function removeEntity(_0xbe6a77,_0x498d14){return function(_0x103e9e){if(_0x103e9e){return _0x103e9e[_0x9a7b('0x22')]()[_0x9a7b('0x21')](function(){_0xbe6a77['status'](0xcc)[_0x9a7b('0x23')]();});}};}function handleEntityNotFound(_0x5f5134,_0x24fd55){return function(_0x596c2f){if(!_0x596c2f){_0x5f5134[_0x9a7b('0x17')](0x194);}return _0x596c2f;};}function handleError(_0x48b4f3,_0x16ff89){_0x16ff89=_0x16ff89||0x1f4;return function(_0x5b6aca){logger[_0x9a7b('0x24')](_0x5b6aca[_0x9a7b('0x25')]);if(_0x5b6aca[_0x9a7b('0x26')]){delete _0x5b6aca['name'];}_0x48b4f3[_0x9a7b('0x18')](_0x16ff89)[_0x9a7b('0x27')](_0x5b6aca);};}exports['index']=function(_0x3d8728,_0x1ce716){var _0x4eea80={},_0x5af5d6={},_0x89155c={'count':0x0,'rows':[]};var _0xcf9512=_[_0x9a7b('0x28')](db[_0x9a7b('0x29')][_0x9a7b('0x2a')],function(_0x47c41a){return{'name':_0x47c41a[_0x9a7b('0x2b')],'type':_0x47c41a[_0x9a7b('0x2c')][_0x9a7b('0x2d')]};});_0x5af5d6[_0x9a7b('0x2e')]=_['map'](_0xcf9512,_0x9a7b('0x26'));_0x5af5d6[_0x9a7b('0x2f')]=_[_0x9a7b('0x30')](_0x3d8728['query']);_0x5af5d6['filters']=_[_0x9a7b('0x31')](_0x5af5d6[_0x9a7b('0x2e')],_0x5af5d6[_0x9a7b('0x2f')]);_0x4eea80['attributes']=_[_0x9a7b('0x31')](_0x5af5d6[_0x9a7b('0x2e')],qs['fields'](_0x3d8728[_0x9a7b('0x2f')][_0x9a7b('0x32')]));_0x4eea80[_0x9a7b('0x33')]=_0x4eea80[_0x9a7b('0x33')][_0x9a7b('0x34')]?_0x4eea80[_0x9a7b('0x33')]:_0x5af5d6[_0x9a7b('0x2e')];if(!_0x3d8728[_0x9a7b('0x2f')][_0x9a7b('0x35')](_0x9a7b('0x36'))){_0x4eea80[_0x9a7b('0x37')]=qs[_0x9a7b('0x37')](_0x3d8728[_0x9a7b('0x2f')][_0x9a7b('0x37')]);_0x4eea80[_0x9a7b('0x1a')]=qs[_0x9a7b('0x1a')](_0x3d8728[_0x9a7b('0x2f')][_0x9a7b('0x1a')]);}_0x4eea80[_0x9a7b('0x38')]=qs[_0x9a7b('0x39')](_0x3d8728['query'][_0x9a7b('0x39')]);_0x4eea80[_0x9a7b('0x3a')]=qs[_0x9a7b('0x3b')](_['pick'](_0x3d8728[_0x9a7b('0x2f')],_0x5af5d6[_0x9a7b('0x3b')]),_0xcf9512);if(_0x3d8728[_0x9a7b('0x2f')]['filter']){_0x4eea80[_0x9a7b('0x3a')]=_['merge'](_0x4eea80[_0x9a7b('0x3a')],{'$or':_[_0x9a7b('0x28')](_0xcf9512,function(_0x4fb338){if(_0x4fb338[_0x9a7b('0x2c')]!==_0x9a7b('0x3c')){var _0x14f5c8={};_0x14f5c8[_0x4fb338[_0x9a7b('0x26')]]={'$like':'%'+_0x3d8728[_0x9a7b('0x2f')][_0x9a7b('0x3d')]+'%'};return _0x14f5c8;}})});}_0x4eea80=_[_0x9a7b('0x3e')]({},_0x4eea80,_0x3d8728[_0x9a7b('0x3f')]);var _0x488cb5={'where':_0x4eea80[_0x9a7b('0x3a')]};return db[_0x9a7b('0x29')]['count'](_0x488cb5)[_0x9a7b('0x21')](function(_0x5e4bb2){_0x89155c[_0x9a7b('0x1c')]=_0x5e4bb2;if(_0x3d8728[_0x9a7b('0x2f')][_0x9a7b('0x40')]){_0x4eea80[_0x9a7b('0x41')]=[{'all':!![]}];}return db[_0x9a7b('0x29')][_0x9a7b('0x42')](_0x4eea80);})[_0x9a7b('0x21')](function(_0x40cea3){_0x89155c[_0x9a7b('0x43')]=_0x40cea3;return _0x89155c;})[_0x9a7b('0x21')](respondWithFilteredResult(_0x1ce716,_0x4eea80))[_0x9a7b('0x44')](handleError(_0x1ce716,null));};exports[_0x9a7b('0x45')]=function(_0x5e0647,_0x5480a7){var _0x367e41={'raw':!![],'where':{'id':_0x5e0647[_0x9a7b('0x46')]['id']}},_0x392f79={};_0x392f79[_0x9a7b('0x2e')]=_[_0x9a7b('0x30')](db[_0x9a7b('0x29')]['rawAttributes']);_0x392f79[_0x9a7b('0x2f')]=_[_0x9a7b('0x30')](_0x5e0647['query']);_0x392f79['filters']=_['intersection'](_0x392f79[_0x9a7b('0x2e')],_0x392f79['query']);_0x367e41[_0x9a7b('0x33')]=_[_0x9a7b('0x31')](_0x392f79['model'],qs[_0x9a7b('0x32')](_0x5e0647['query'][_0x9a7b('0x32')]));_0x367e41[_0x9a7b('0x33')]=_0x367e41[_0x9a7b('0x33')][_0x9a7b('0x34')]?_0x367e41[_0x9a7b('0x33')]:_0x392f79[_0x9a7b('0x2e')];if(_0x5e0647[_0x9a7b('0x2f')][_0x9a7b('0x40')]){_0x367e41[_0x9a7b('0x41')]=[{'all':!![]}];}_0x367e41=_[_0x9a7b('0x3e')]({},_0x367e41,_0x5e0647['options']);return db['ServicenowField'][_0x9a7b('0x47')](_0x367e41)[_0x9a7b('0x21')](handleEntityNotFound(_0x5480a7,null))['then'](respondWithResult(_0x5480a7,null))[_0x9a7b('0x44')](handleError(_0x5480a7,null));};exports[_0x9a7b('0x48')]=function(_0x4b1a95,_0x5334eb){return db['ServicenowField'][_0x9a7b('0x48')](_0x4b1a95[_0x9a7b('0x49')],{})['then'](respondWithResult(_0x5334eb,0xc9))[_0x9a7b('0x44')](handleError(_0x5334eb,null));};exports[_0x9a7b('0x4a')]=function(_0xd48041,_0x131f77){if(_0xd48041[_0x9a7b('0x49')]['id']){delete _0xd48041[_0x9a7b('0x49')]['id'];}return db[_0x9a7b('0x29')][_0x9a7b('0x47')]({'where':{'id':_0xd48041['params']['id']}})['then'](handleEntityNotFound(_0x131f77,null))[_0x9a7b('0x21')](saveUpdates(_0xd48041[_0x9a7b('0x49')],null))['then'](respondWithResult(_0x131f77,null))[_0x9a7b('0x44')](handleError(_0x131f77,null));};exports[_0x9a7b('0x22')]=function(_0x11b9dd,_0x325054){return db[_0x9a7b('0x29')][_0x9a7b('0x47')]({'where':{'id':_0x11b9dd['params']['id']}})[_0x9a7b('0x21')](handleEntityNotFound(_0x325054,null))[_0x9a7b('0x21')](removeEntity(_0x325054,null))[_0x9a7b('0x44')](handleError(_0x325054,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index b048cd3..b3bc7b3 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 _0xfab4=['servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields'];(function(_0x56b0ac,_0x337e13){var _0x45ea42=function(_0x278176){while(--_0x278176){_0x56b0ac['push'](_0x56b0ac['shift']());}};_0x45ea42(++_0x337e13);}(_0xfab4,0x1a7));var _0x4fab=function(_0x1330ee,_0x2b16bf){_0x1330ee=_0x1330ee-0x0;var _0x33eea4=_0xfab4[_0x1330ee];return _0x33eea4;};'use strict';var _=require(_0x4fab('0x0'));var util=require(_0x4fab('0x1'));var logger=require(_0x4fab('0x2'))(_0x4fab('0x3'));var moment=require('moment');var BPromise=require(_0x4fab('0x4'));var rp=require(_0x4fab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4fab('0x6'));var config=require(_0x4fab('0x7'));var attributes=require(_0x4fab('0x8'));module[_0x4fab('0x9')]=function(_0x24549f,_0x438760){return _0x24549f[_0x4fab('0xa')]('ServicenowField',attributes,{'tableName':_0x4fab('0xb'),'paranoid':![],'indexes':[{'name':_0x4fab('0xc'),'fields':[_0x4fab('0xd'),_0x4fab('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc57e=['./intServicenowField.attributes','define','ServicenowField','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xc57e,0x191));var _0xec57=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc57e[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xec57('0x0'));var util=require('util');var logger=require(_0xec57('0x1'))(_0xec57('0x2'));var moment=require(_0xec57('0x3'));var BPromise=require(_0xec57('0x4'));var rp=require(_0xec57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xec57('0x6'));var attributes=require(_0xec57('0x7'));module['exports']=function(_0x11e390,_0x56f65e){return _0x11e390[_0xec57('0x8')](_0xec57('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xec57('0xa'),_0xec57('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index a443634..d044323 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x335c37,_0x14411c){var _0x865bae=function(_0x49e76d){while(--_0x49e76d){_0x335c37['push'](_0x335c37['shift']());}};_0x865bae(++_0x14411c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0xcb91[_0x3a78a0];return _0x48e917;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x54ae02,_0x22b535){var _0x4c8a24=function(_0x12a50c){while(--_0x12a50c){_0x54ae02['push'](_0x54ae02['shift']());}};_0x4c8a24(++_0x22b535);}(_0xb43b,0x1b2));var _0xbb43=function(_0xcd9134,_0x396d35){_0xcd9134=_0xcd9134-0x0;var _0x9b42a5=_0xb43b[_0xcd9134];return _0x9b42a5;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 2830e99..152de7c 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4eb2d0,_0x49a6c4){var _0x3075cb=function(_0x1dd012){while(--_0x1dd012){_0x4eb2d0['push'](_0x4eb2d0['shift']());}};_0x3075cb(++_0x49a6c4);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x360744,_0x48b049){var _0x122545=function(_0x5900b8){while(--_0x5900b8){_0x360744['push'](_0x360744['shift']());}};_0x122545(++_0x48b049);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 0dc2ab8..73d9686 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(_0x5033bd,_0x491255){var _0x43b24e=function(_0x44d984){while(--_0x44d984){_0x5033bd['push'](_0x5033bd['shift']());}};_0x43b24e(++_0x491255);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x222afc,_0x306791){var _0x3f9f95=function(_0x5d36a1){while(--_0x5d36a1){_0x222afc['push'](_0x222afc['shift']());}};_0x3f9f95(++_0x306791);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 0b54c34..e0e329a 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 _0xf717=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','send','index','map','SugarcrmAccount','rawAttributes','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','AccountId','getSubjects','channel','type','getDescriptions','SugarcrmField','Subjects','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','remoteUri','slice','lastIndexOf','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','password','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','POST','format','get_module_fields','values','remove','includes','label','endsWith','value','test','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0xdf8b33,_0xd18563){var _0x45cea9=function(_0x19575d){while(--_0x19575d){_0xdf8b33['push'](_0xdf8b33['shift']());}};_0x45cea9(++_0xd18563);}(_0xf717,0x1c6));var _0x7f71=function(_0x538560,_0x4dad68){_0x538560=_0x538560-0x0;var _0xc480ef=_0xf717[_0x538560];return _0xc480ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f71('0x0'));var zipdir=require(_0x7f71('0x1'));var jsonpatch=require(_0x7f71('0x2'));var rp=require(_0x7f71('0x3'));var moment=require(_0x7f71('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');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('fs-extra');var _=require(_0x7f71('0x9'));var squel=require('squel');var crypto=require(_0x7f71('0xa'));var jsforce=require(_0x7f71('0xb'));var deskjs=require(_0x7f71('0xc'));var toCsv=require(_0x7f71('0x7'));var querystring=require('querystring');var Papa=require(_0x7f71('0xd'));var Redis=require('ioredis');var authService=require(_0x7f71('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f71('0xf'));var logger=require(_0x7f71('0x10'))('api');var utils=require(_0x7f71('0x11'));var config=require(_0x7f71('0x12'));var licenseUtil=require(_0x7f71('0x13'));var db=require(_0x7f71('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3a7d74,_0x2d4f98){_0x2d4f98=_0x2d4f98||0xcc;return function(_0x1dbe05){if(_0x1dbe05){return _0x3a7d74['sendStatus'](_0x2d4f98);}return _0x3a7d74[_0x7f71('0x15')](_0x2d4f98)[_0x7f71('0x16')]();};}function respondWithResult(_0x3f9fe2,_0x37734e){_0x37734e=_0x37734e||0xc8;return function(_0x1c696a){if(_0x1c696a){return _0x3f9fe2[_0x7f71('0x15')](_0x37734e)[_0x7f71('0x17')](_0x1c696a);}};}function respondWithFilteredResult(_0x3ad0fe,_0x272e3d){return function(_0x246030){if(_0x246030){var _0x20a5d5=typeof _0x272e3d[_0x7f71('0x18')]===_0x7f71('0x19')&&typeof _0x272e3d[_0x7f71('0x1a')]==='undefined';var _0x5338b9=_0x246030[_0x7f71('0x1b')];var _0x32db12=_0x20a5d5?0x0:_0x272e3d[_0x7f71('0x18')];var _0x4b126c=_0x20a5d5?_0x246030[_0x7f71('0x1b')]:_0x272e3d[_0x7f71('0x18')]+_0x272e3d[_0x7f71('0x1a')];var _0x309d8a;if(_0x4b126c>=_0x5338b9){_0x4b126c=_0x5338b9;_0x309d8a=0xc8;}else{_0x309d8a=0xce;}_0x3ad0fe[_0x7f71('0x15')](_0x309d8a);return _0x3ad0fe[_0x7f71('0x1c')](_0x7f71('0x1d'),_0x32db12+'-'+_0x4b126c+'/'+_0x5338b9)[_0x7f71('0x17')](_0x246030);}return null;};}function patchUpdates(_0x2fa46f){return function(_0x264248){try{jsonpatch[_0x7f71('0x1e')](_0x264248,_0x2fa46f,!![]);}catch(_0x438921){return BPromise[_0x7f71('0x1f')](_0x438921);}return _0x264248[_0x7f71('0x20')]();};}function saveUpdates(_0xb06191,_0x5544bc){return function(_0x4b2491){if(_0x4b2491){return _0x4b2491[_0x7f71('0x21')](_0xb06191)['then'](function(_0x2c0e38){return _0x2c0e38;});}return null;};}function removeEntity(_0x2f4ba9,_0x457481){return function(_0xca4462){if(_0xca4462){return _0xca4462[_0x7f71('0x22')]()[_0x7f71('0x23')](function(){_0x2f4ba9[_0x7f71('0x15')](0xcc)[_0x7f71('0x16')]();});}};}function handleEntityNotFound(_0x132f80,_0x2049c9){return function(_0x172996){if(!_0x172996){_0x132f80['sendStatus'](0x194);}return _0x172996;};}function handleError(_0x16f694,_0x3125d1){_0x3125d1=_0x3125d1||0x1f4;return function(_0x36f686){logger['error'](_0x36f686[_0x7f71('0x24')]);if(_0x36f686['name']){delete _0x36f686['name'];}_0x16f694[_0x7f71('0x15')](_0x3125d1)[_0x7f71('0x25')](_0x36f686);};}exports[_0x7f71('0x26')]=function(_0x266dd2,_0x1b1d67){var _0x19cd52={},_0x36f9e6={},_0x427b9b={'count':0x0,'rows':[]};var _0x543a87=_[_0x7f71('0x27')](db[_0x7f71('0x28')][_0x7f71('0x29')],function(_0x476142){return{'name':_0x476142['fieldName'],'type':_0x476142['type']['key']};});_0x36f9e6[_0x7f71('0x2a')]=_[_0x7f71('0x27')](_0x543a87,_0x7f71('0x2b'));_0x36f9e6[_0x7f71('0x2c')]=_[_0x7f71('0x2d')](_0x266dd2['query']);_0x36f9e6[_0x7f71('0x2e')]=_[_0x7f71('0x2f')](_0x36f9e6[_0x7f71('0x2a')],_0x36f9e6['query']);_0x19cd52[_0x7f71('0x30')]=_['intersection'](_0x36f9e6[_0x7f71('0x2a')],qs[_0x7f71('0x31')](_0x266dd2[_0x7f71('0x2c')][_0x7f71('0x31')]));_0x19cd52[_0x7f71('0x30')]=_0x19cd52['attributes'][_0x7f71('0x32')]?_0x19cd52['attributes']:_0x36f9e6[_0x7f71('0x2a')];if(!_0x266dd2['query'][_0x7f71('0x33')](_0x7f71('0x34'))){_0x19cd52[_0x7f71('0x1a')]=qs['limit'](_0x266dd2[_0x7f71('0x2c')][_0x7f71('0x1a')]);_0x19cd52[_0x7f71('0x18')]=qs[_0x7f71('0x18')](_0x266dd2[_0x7f71('0x2c')]['offset']);}_0x19cd52[_0x7f71('0x35')]=qs[_0x7f71('0x36')](_0x266dd2[_0x7f71('0x2c')][_0x7f71('0x36')]);_0x19cd52['where']=qs[_0x7f71('0x2e')](_[_0x7f71('0x37')](_0x266dd2[_0x7f71('0x2c')],_0x36f9e6[_0x7f71('0x2e')]),_0x543a87);if(_0x266dd2['query']['filter']){_0x19cd52[_0x7f71('0x38')]=_[_0x7f71('0x39')](_0x19cd52[_0x7f71('0x38')],{'$or':_[_0x7f71('0x27')](_0x543a87,function(_0x533a2c){if(_0x533a2c['type']!==_0x7f71('0x3a')){var _0x34ffc1={};_0x34ffc1[_0x533a2c[_0x7f71('0x2b')]]={'$like':'%'+_0x266dd2[_0x7f71('0x2c')][_0x7f71('0x3b')]+'%'};return _0x34ffc1;}})});}_0x19cd52=_[_0x7f71('0x39')]({},_0x19cd52,_0x266dd2[_0x7f71('0x3c')]);var _0x1c2ccf={'where':_0x19cd52[_0x7f71('0x38')]};return db['SugarcrmAccount'][_0x7f71('0x1b')](_0x1c2ccf)[_0x7f71('0x23')](function(_0x379dc9){_0x427b9b[_0x7f71('0x1b')]=_0x379dc9;if(_0x266dd2[_0x7f71('0x2c')][_0x7f71('0x3d')]){_0x19cd52['include']=[{'all':!![]}];}return db['SugarcrmAccount'][_0x7f71('0x3e')](_0x19cd52);})[_0x7f71('0x23')](function(_0x505287){_0x427b9b[_0x7f71('0x3f')]=_0x505287;return _0x427b9b;})[_0x7f71('0x23')](respondWithFilteredResult(_0x1b1d67,_0x19cd52))[_0x7f71('0x40')](handleError(_0x1b1d67,null));};exports['show']=function(_0x55bd6c,_0x17a4ea){var _0x1b61d4={'raw':![],'where':{'id':_0x55bd6c[_0x7f71('0x41')]['id']}},_0x220391={};_0x220391[_0x7f71('0x2a')]=_[_0x7f71('0x2d')](db['SugarcrmAccount'][_0x7f71('0x29')]);_0x220391[_0x7f71('0x2c')]=_['keys'](_0x55bd6c['query']);_0x220391[_0x7f71('0x2e')]=_['intersection'](_0x220391[_0x7f71('0x2a')],_0x220391['query']);_0x1b61d4[_0x7f71('0x30')]=_['intersection'](_0x220391['model'],qs[_0x7f71('0x31')](_0x55bd6c[_0x7f71('0x2c')][_0x7f71('0x31')]));_0x1b61d4['attributes']=_0x1b61d4['attributes'][_0x7f71('0x32')]?_0x1b61d4[_0x7f71('0x30')]:_0x220391['model'];if(_0x55bd6c[_0x7f71('0x2c')][_0x7f71('0x3d')]){_0x1b61d4[_0x7f71('0x42')]=[{'all':!![]}];}_0x1b61d4=_[_0x7f71('0x39')]({},_0x1b61d4,_0x55bd6c['options']);return db[_0x7f71('0x28')][_0x7f71('0x43')](_0x1b61d4)[_0x7f71('0x23')](handleEntityNotFound(_0x17a4ea,null))[_0x7f71('0x23')](respondWithResult(_0x17a4ea,null))[_0x7f71('0x40')](handleError(_0x17a4ea,null));};exports[_0x7f71('0x44')]=function(_0x2a2fcb,_0xd97f04){return db['SugarcrmAccount'][_0x7f71('0x44')](_0x2a2fcb[_0x7f71('0x45')],{})['then'](respondWithResult(_0xd97f04,0xc9))[_0x7f71('0x40')](handleError(_0xd97f04,null));};exports['update']=function(_0x23ce74,_0x5e7172){if(_0x23ce74[_0x7f71('0x45')]['id']){delete _0x23ce74[_0x7f71('0x45')]['id'];}return db[_0x7f71('0x28')][_0x7f71('0x43')]({'where':{'id':_0x23ce74[_0x7f71('0x41')]['id']}})[_0x7f71('0x23')](handleEntityNotFound(_0x5e7172,null))[_0x7f71('0x23')](saveUpdates(_0x23ce74['body'],null))['then'](respondWithResult(_0x5e7172,null))[_0x7f71('0x40')](handleError(_0x5e7172,null));};exports[_0x7f71('0x22')]=function(_0x3348e0,_0x7d5f1d){return db['SugarcrmAccount'][_0x7f71('0x43')]({'where':{'id':_0x3348e0[_0x7f71('0x41')]['id']}})[_0x7f71('0x23')](handleEntityNotFound(_0x7d5f1d,null))[_0x7f71('0x23')](removeEntity(_0x7d5f1d,null))[_0x7f71('0x40')](handleError(_0x7d5f1d,null));};exports[_0x7f71('0x46')]=function(_0x58dd2c,_0x4203ce,_0x21033c){var _0x2f1488={};var _0x33ea45={};var _0x5dc40e;var _0x16310c;return db[_0x7f71('0x28')][_0x7f71('0x47')]({'where':{'id':_0x58dd2c['params']['id']}})[_0x7f71('0x23')](handleEntityNotFound(_0x4203ce,null))[_0x7f71('0x23')](function(_0x59ff6d){if(_0x59ff6d){_0x5dc40e=_0x59ff6d;_0x33ea45['model']=_[_0x7f71('0x2d')](db[_0x7f71('0x48')][_0x7f71('0x29')]);_0x33ea45[_0x7f71('0x2c')]=_[_0x7f71('0x2d')](_0x58dd2c[_0x7f71('0x2c')]);_0x33ea45[_0x7f71('0x2e')]=_[_0x7f71('0x2f')](_0x33ea45[_0x7f71('0x2a')],_0x33ea45[_0x7f71('0x2c')]);_0x2f1488['attributes']=_[_0x7f71('0x2f')](_0x33ea45['model'],qs[_0x7f71('0x31')](_0x58dd2c['query'][_0x7f71('0x31')]));_0x2f1488[_0x7f71('0x30')]=_0x2f1488[_0x7f71('0x30')][_0x7f71('0x32')]?_0x2f1488[_0x7f71('0x30')]:_0x33ea45[_0x7f71('0x2a')];_0x2f1488['order']=qs[_0x7f71('0x36')](_0x58dd2c['query'][_0x7f71('0x36')]);_0x2f1488[_0x7f71('0x38')]=qs[_0x7f71('0x2e')](_[_0x7f71('0x37')](_0x58dd2c[_0x7f71('0x2c')],_0x33ea45[_0x7f71('0x2e')]));if(_0x58dd2c[_0x7f71('0x2c')][_0x7f71('0x3b')]){_0x2f1488[_0x7f71('0x38')]=_['merge'](_0x2f1488[_0x7f71('0x38')],{'$or':_[_0x7f71('0x27')](_0x2f1488['attributes'],function(_0x361675){var _0x332b5d={};_0x332b5d[_0x361675]={'$like':'%'+_0x58dd2c['query'][_0x7f71('0x3b')]+'%'};return _0x332b5d;})});}_0x2f1488=_[_0x7f71('0x39')]({},_0x2f1488,_0x58dd2c[_0x7f71('0x3c')]);return _0x5dc40e['getConfigurations'](_0x2f1488);}})['then'](function(_0x17b54a){if(_0x17b54a){_0x16310c=_0x17b54a[_0x7f71('0x32')];if(!_0x58dd2c[_0x7f71('0x2c')][_0x7f71('0x33')]('nolimit')){_0x2f1488['limit']=qs[_0x7f71('0x1a')](_0x58dd2c[_0x7f71('0x2c')][_0x7f71('0x1a')]);_0x2f1488[_0x7f71('0x18')]=qs['offset'](_0x58dd2c[_0x7f71('0x2c')][_0x7f71('0x18')]);}return _0x5dc40e[_0x7f71('0x46')](_0x2f1488);}})[_0x7f71('0x23')](function(_0x2d5307){if(_0x2d5307){return _0x2d5307?{'count':_0x16310c,'rows':_0x2d5307}:null;}})[_0x7f71('0x23')](respondWithResult(_0x4203ce,null))[_0x7f71('0x40')](handleError(_0x4203ce,null));};exports['addConfiguration']=function(_0x2540bb,_0x40e266,_0x1f710d){if(_0x2540bb['body']['id']){delete _0x2540bb[_0x7f71('0x45')]['id'];}return db[_0x7f71('0x28')][_0x7f71('0x47')]({'where':{'id':_0x2540bb['params']['id']}})['then'](handleEntityNotFound(_0x40e266,null))[_0x7f71('0x23')](function(_0x3080af){if(_0x3080af){_0x2540bb[_0x7f71('0x45')][_0x7f71('0x49')]=_0x3080af['id'];_0x2540bb[_0x7f71('0x45')]['Subjects']=integrations[_0x7f71('0x4a')](_0x2540bb[_0x7f71('0x45')][_0x7f71('0x4b')],_0x2540bb['body'][_0x7f71('0x4c')]);_0x2540bb[_0x7f71('0x45')]['Descriptions']=integrations[_0x7f71('0x4d')](_0x2540bb[_0x7f71('0x45')][_0x7f71('0x4b')],_0x2540bb[_0x7f71('0x45')]['type']);return db['SugarcrmConfiguration'][_0x7f71('0x44')](_0x2540bb[_0x7f71('0x45')],{'include':[{'model':db[_0x7f71('0x4e')],'as':_0x7f71('0x4f')},{'model':db[_0x7f71('0x4e')],'as':_0x7f71('0x50')}]});}return null;})[_0x7f71('0x23')](respondWithResult(_0x40e266,null))[_0x7f71('0x40')](handleError(_0x40e266,null));};exports[_0x7f71('0x51')]=function(_0x52d4e6,_0x26fb5e,_0x5ce530){var _0x1c86d0='';var _0x425b49=['id',_0x7f71('0x2b'),_0x7f71('0x52'),_0x7f71('0x53'),_0x7f71('0x54'),_0x7f71('0x55'),_0x7f71('0x56'),_0x7f71('0x57'),_0x7f71('0x58'),_0x7f71('0x59'),'parent_name',_0x7f71('0x5a')];return db[_0x7f71('0x28')][_0x7f71('0x47')]({'where':{'id':_0x52d4e6[_0x7f71('0x41')]['id']},'attributes':['id','username','password',_0x7f71('0x5b')]})[_0x7f71('0x23')](handleEntityNotFound(_0x26fb5e,null))[_0x7f71('0x23')](function(_0x588ccb){if(_0x588ccb){_0x1c86d0=_0x588ccb[_0x7f71('0x5b')];var _0x48715a=_0x1c86d0[_0x7f71('0x5c')](-0x1);if(_0x48715a==='/'){_0x1c86d0=_0x1c86d0['substring'](0x0,_0x1c86d0[_0x7f71('0x5d')](_0x48715a));}return rp({'method':'POST','uri':util['format'](_0x7f71('0x5e'),_0x1c86d0,_0x7f71('0x5f')),'json':!![],'form':{'method':_0x7f71('0x60'),'input_type':_0x7f71('0x61'),'response_type':_0x7f71('0x61'),'rest_data':JSON[_0x7f71('0x62')]({'user_auth':{'user_name':_0x588ccb[_0x7f71('0x63')],'password':_0x588ccb[_0x7f71('0x64')],'encryption':_0x7f71('0x65')},'application':_0x7f71('0x66')})}});}})[_0x7f71('0x23')](function(_0xa6f81){if(_0xa6f81&&_0xa6f81['name']!=='Invalid\x20Login'&&_0xa6f81[_0x7f71('0x2b')]!==_0x7f71('0x67')){return rp({'method':_0x7f71('0x68'),'uri':util[_0x7f71('0x69')](_0x7f71('0x5e'),_0x1c86d0,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x7f71('0x6a'),'input_type':'JSON','response_type':_0x7f71('0x61'),'rest_data':JSON[_0x7f71('0x62')]({'session':_0xa6f81['id'],'module_name':'Calls'})}})[_0x7f71('0x23')](function(_0xb1faec){if(_0xb1faec){var _0x1abe48=_[_0x7f71('0x6b')](_0xb1faec['module_fields']);_[_0x7f71('0x6c')](_0x1abe48,function(_0x8d3fd7){return _0x425b49[_0x7f71('0x6d')](_0x8d3fd7[_0x7f71('0x2b')]);});return{'count':_0x1abe48['length'],'rows':_[_0x7f71('0x27')](_0x1abe48,function(_0x58c58b){return{'id':_0x58c58b[_0x7f71('0x2b')],'name':_0x58c58b[_0x7f71('0x6e')],'custom':_[_0x7f71('0x6f')](_0x58c58b[_0x7f71('0x2b')],'_c')?!![]:![],'options':_0x58c58b[_0x7f71('0x3c')]?_[_0x7f71('0x27')](_['values'](_0x58c58b['options']),function(_0x585297){return{'name':_0x585297[_0x7f71('0x70')],'value':_0x585297['name']};}):[]};})};}})[_0x7f71('0x23')](respondWithResult(_0x26fb5e,null))['catch'](function(_0x4767ec){var _0x1736ed=_0x52d4e6[_0x7f71('0x2c')][_0x7f71('0x71')]?0x1f4:_0x4767ec['statusCode']||0x1f4;logger[_0x7f71('0x72')](_0x7f71('0x73'),'getFields',_0x1736ed,JSON['stringify'](_0x4767ec));delete _0x4767ec[_0x7f71('0x2b')];if(_0x1736ed===0x191){_0x1736ed=0x190;}_0x26fb5e[_0x7f71('0x15')](_0x1736ed)[_0x7f71('0x25')](_0x52d4e6[_0x7f71('0x2c')]['test']?{'message':_0x7f71('0x74'),'statusCode':_0x4767ec[_0x7f71('0x75')]}:_0x4767ec);});}else{var _0x10206a=0x1f4;_0x26fb5e[_0x7f71('0x15')](_0x10206a)[_0x7f71('0x25')]({'message':_0x7f71('0x74'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x2f65=['api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','description','date_start','duration_minutes','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','format','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','includes','endsWith','value','test','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x2f65,0x13b));var _0x52f6=function(_0x56ac6f,_0x265214){_0x56ac6f=_0x56ac6f-0x0;var _0x2e769d=_0x2f65[_0x56ac6f];return _0x2e769d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x52f6('0x0'));var zipdir=require(_0x52f6('0x1'));var jsonpatch=require(_0x52f6('0x2'));var rp=require(_0x52f6('0x3'));var moment=require(_0x52f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x52f6('0x5'));var util=require(_0x52f6('0x6'));var path=require(_0x52f6('0x7'));var sox=require(_0x52f6('0x8'));var csv=require(_0x52f6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x52f6('0xa'));var squel=require(_0x52f6('0xb'));var crypto=require(_0x52f6('0xc'));var jsforce=require(_0x52f6('0xd'));var deskjs=require(_0x52f6('0xe'));var toCsv=require(_0x52f6('0x9'));var querystring=require('querystring');var Papa=require(_0x52f6('0xf'));var Redis=require('ioredis');var authService=require(_0x52f6('0x10'));var qs=require(_0x52f6('0x11'));var as=require(_0x52f6('0x12'));var hardwareService=require(_0x52f6('0x13'));var logger=require(_0x52f6('0x14'))(_0x52f6('0x15'));var utils=require(_0x52f6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x52f6('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x52f6('0x18'));function respondWithStatusCode(_0x164e96,_0x37af40){_0x37af40=_0x37af40||0xcc;return function(_0x57c31a){if(_0x57c31a){return _0x164e96[_0x52f6('0x19')](_0x37af40);}return _0x164e96[_0x52f6('0x1a')](_0x37af40)['end']();};}function respondWithResult(_0x1fba7e,_0x36fbac){_0x36fbac=_0x36fbac||0xc8;return function(_0x1f719f){if(_0x1f719f){return _0x1fba7e[_0x52f6('0x1a')](_0x36fbac)[_0x52f6('0x1b')](_0x1f719f);}};}function respondWithFilteredResult(_0xa1c80a,_0x1a2151){return function(_0x3b2ab8){if(_0x3b2ab8){var _0x2bf53f=typeof _0x1a2151[_0x52f6('0x1c')]===_0x52f6('0x1d')&&typeof _0x1a2151[_0x52f6('0x1e')]==='undefined';var _0x2801e2=_0x3b2ab8[_0x52f6('0x1f')];var _0x31567b=_0x2bf53f?0x0:_0x1a2151[_0x52f6('0x1c')];var _0x5dbe05=_0x2bf53f?_0x3b2ab8[_0x52f6('0x1f')]:_0x1a2151['offset']+_0x1a2151[_0x52f6('0x1e')];var _0x17c49f;if(_0x5dbe05>=_0x2801e2){_0x5dbe05=_0x2801e2;_0x17c49f=0xc8;}else{_0x17c49f=0xce;}_0xa1c80a[_0x52f6('0x1a')](_0x17c49f);return _0xa1c80a[_0x52f6('0x20')](_0x52f6('0x21'),_0x31567b+'-'+_0x5dbe05+'/'+_0x2801e2)['json'](_0x3b2ab8);}return null;};}function patchUpdates(_0x2437ea){return function(_0x4e3107){try{jsonpatch[_0x52f6('0x22')](_0x4e3107,_0x2437ea,!![]);}catch(_0x208c87){return BPromise['reject'](_0x208c87);}return _0x4e3107[_0x52f6('0x23')]();};}function saveUpdates(_0x52e6aa,_0x2e2059){return function(_0x2cf84b){if(_0x2cf84b){return _0x2cf84b[_0x52f6('0x24')](_0x52e6aa)[_0x52f6('0x25')](function(_0x50d114){return _0x50d114;});}return null;};}function removeEntity(_0x3dcff6,_0xfc6c52){return function(_0xe24b71){if(_0xe24b71){return _0xe24b71[_0x52f6('0x26')]()['then'](function(){_0x3dcff6[_0x52f6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541dd1,_0xee32f4){return function(_0x19f51a){if(!_0x19f51a){_0x541dd1[_0x52f6('0x19')](0x194);}return _0x19f51a;};}function handleError(_0x3039b8,_0xc6c4c2){_0xc6c4c2=_0xc6c4c2||0x1f4;return function(_0x32006a){logger[_0x52f6('0x27')](_0x32006a['stack']);if(_0x32006a[_0x52f6('0x28')]){delete _0x32006a['name'];}_0x3039b8[_0x52f6('0x1a')](_0xc6c4c2)[_0x52f6('0x29')](_0x32006a);};}exports[_0x52f6('0x2a')]=function(_0x1b001a,_0x45513c){var _0x3a5b5e={},_0x2c09fe={},_0x5bf018={'count':0x0,'rows':[]};var _0x42faaa=_[_0x52f6('0x2b')](db[_0x52f6('0x2c')][_0x52f6('0x2d')],function(_0x3f4f66){return{'name':_0x3f4f66[_0x52f6('0x2e')],'type':_0x3f4f66[_0x52f6('0x2f')][_0x52f6('0x30')]};});_0x2c09fe['model']=_[_0x52f6('0x2b')](_0x42faaa,_0x52f6('0x28'));_0x2c09fe[_0x52f6('0x31')]=_[_0x52f6('0x32')](_0x1b001a['query']);_0x2c09fe[_0x52f6('0x33')]=_[_0x52f6('0x34')](_0x2c09fe[_0x52f6('0x35')],_0x2c09fe[_0x52f6('0x31')]);_0x3a5b5e[_0x52f6('0x36')]=_[_0x52f6('0x34')](_0x2c09fe[_0x52f6('0x35')],qs[_0x52f6('0x37')](_0x1b001a[_0x52f6('0x31')][_0x52f6('0x37')]));_0x3a5b5e['attributes']=_0x3a5b5e[_0x52f6('0x36')][_0x52f6('0x38')]?_0x3a5b5e['attributes']:_0x2c09fe[_0x52f6('0x35')];if(!_0x1b001a[_0x52f6('0x31')][_0x52f6('0x39')](_0x52f6('0x3a'))){_0x3a5b5e[_0x52f6('0x1e')]=qs[_0x52f6('0x1e')](_0x1b001a[_0x52f6('0x31')][_0x52f6('0x1e')]);_0x3a5b5e['offset']=qs[_0x52f6('0x1c')](_0x1b001a[_0x52f6('0x31')][_0x52f6('0x1c')]);}_0x3a5b5e[_0x52f6('0x3b')]=qs['sort'](_0x1b001a[_0x52f6('0x31')][_0x52f6('0x3c')]);_0x3a5b5e['where']=qs[_0x52f6('0x33')](_[_0x52f6('0x3d')](_0x1b001a[_0x52f6('0x31')],_0x2c09fe[_0x52f6('0x33')]),_0x42faaa);if(_0x1b001a[_0x52f6('0x31')]['filter']){_0x3a5b5e[_0x52f6('0x3e')]=_[_0x52f6('0x3f')](_0x3a5b5e['where'],{'$or':_['map'](_0x42faaa,function(_0x47fbef){if(_0x47fbef[_0x52f6('0x2f')]!==_0x52f6('0x40')){var _0x2979bb={};_0x2979bb[_0x47fbef[_0x52f6('0x28')]]={'$like':'%'+_0x1b001a[_0x52f6('0x31')][_0x52f6('0x41')]+'%'};return _0x2979bb;}})});}_0x3a5b5e=_[_0x52f6('0x3f')]({},_0x3a5b5e,_0x1b001a[_0x52f6('0x42')]);var _0xa43d6e={'where':_0x3a5b5e[_0x52f6('0x3e')]};return db['SugarcrmAccount'][_0x52f6('0x1f')](_0xa43d6e)[_0x52f6('0x25')](function(_0x210ce5){_0x5bf018[_0x52f6('0x1f')]=_0x210ce5;if(_0x1b001a[_0x52f6('0x31')][_0x52f6('0x43')]){_0x3a5b5e['include']=[{'all':!![]}];}return db[_0x52f6('0x2c')]['findAll'](_0x3a5b5e);})[_0x52f6('0x25')](function(_0x2f0abb){_0x5bf018[_0x52f6('0x44')]=_0x2f0abb;return _0x5bf018;})[_0x52f6('0x25')](respondWithFilteredResult(_0x45513c,_0x3a5b5e))[_0x52f6('0x45')](handleError(_0x45513c,null));};exports[_0x52f6('0x46')]=function(_0x2a23a5,_0x160083){var _0x4230d9={'raw':![],'where':{'id':_0x2a23a5[_0x52f6('0x47')]['id']}},_0x5c5706={};_0x5c5706['model']=_['keys'](db['SugarcrmAccount'][_0x52f6('0x2d')]);_0x5c5706[_0x52f6('0x31')]=_[_0x52f6('0x32')](_0x2a23a5[_0x52f6('0x31')]);_0x5c5706[_0x52f6('0x33')]=_[_0x52f6('0x34')](_0x5c5706['model'],_0x5c5706[_0x52f6('0x31')]);_0x4230d9[_0x52f6('0x36')]=_[_0x52f6('0x34')](_0x5c5706[_0x52f6('0x35')],qs[_0x52f6('0x37')](_0x2a23a5[_0x52f6('0x31')][_0x52f6('0x37')]));_0x4230d9[_0x52f6('0x36')]=_0x4230d9[_0x52f6('0x36')]['length']?_0x4230d9[_0x52f6('0x36')]:_0x5c5706[_0x52f6('0x35')];if(_0x2a23a5[_0x52f6('0x31')][_0x52f6('0x43')]){_0x4230d9['include']=[{'all':!![]}];}_0x4230d9=_[_0x52f6('0x3f')]({},_0x4230d9,_0x2a23a5[_0x52f6('0x42')]);return db[_0x52f6('0x2c')]['find'](_0x4230d9)[_0x52f6('0x25')](handleEntityNotFound(_0x160083,null))[_0x52f6('0x25')](respondWithResult(_0x160083,null))['catch'](handleError(_0x160083,null));};exports[_0x52f6('0x48')]=function(_0xf39f1d,_0x4a3df9){return db['SugarcrmAccount'][_0x52f6('0x48')](_0xf39f1d[_0x52f6('0x49')],{})['then'](respondWithResult(_0x4a3df9,0xc9))[_0x52f6('0x45')](handleError(_0x4a3df9,null));};exports[_0x52f6('0x24')]=function(_0xb76dcf,_0x570be4){if(_0xb76dcf[_0x52f6('0x49')]['id']){delete _0xb76dcf[_0x52f6('0x49')]['id'];}return db[_0x52f6('0x2c')]['find']({'where':{'id':_0xb76dcf[_0x52f6('0x47')]['id']}})['then'](handleEntityNotFound(_0x570be4,null))[_0x52f6('0x25')](saveUpdates(_0xb76dcf['body'],null))['then'](respondWithResult(_0x570be4,null))[_0x52f6('0x45')](handleError(_0x570be4,null));};exports['destroy']=function(_0x3fb8b6,_0x20e0ce){return db['SugarcrmAccount'][_0x52f6('0x4a')]({'where':{'id':_0x3fb8b6['params']['id']}})['then'](handleEntityNotFound(_0x20e0ce,null))[_0x52f6('0x25')](removeEntity(_0x20e0ce,null))[_0x52f6('0x45')](handleError(_0x20e0ce,null));};exports[_0x52f6('0x4b')]=function(_0x4ddaa5,_0x5d9c0c,_0x2f7218){var _0x259a8d={};var _0x24840f={};var _0x3fc6a6;var _0x1909ee;return db['SugarcrmAccount'][_0x52f6('0x4c')]({'where':{'id':_0x4ddaa5['params']['id']}})[_0x52f6('0x25')](handleEntityNotFound(_0x5d9c0c,null))[_0x52f6('0x25')](function(_0xf79658){if(_0xf79658){_0x3fc6a6=_0xf79658;_0x24840f['model']=_['keys'](db['SugarcrmConfiguration']['rawAttributes']);_0x24840f[_0x52f6('0x31')]=_[_0x52f6('0x32')](_0x4ddaa5[_0x52f6('0x31')]);_0x24840f['filters']=_[_0x52f6('0x34')](_0x24840f[_0x52f6('0x35')],_0x24840f[_0x52f6('0x31')]);_0x259a8d[_0x52f6('0x36')]=_[_0x52f6('0x34')](_0x24840f[_0x52f6('0x35')],qs[_0x52f6('0x37')](_0x4ddaa5[_0x52f6('0x31')]['fields']));_0x259a8d[_0x52f6('0x36')]=_0x259a8d[_0x52f6('0x36')][_0x52f6('0x38')]?_0x259a8d[_0x52f6('0x36')]:_0x24840f[_0x52f6('0x35')];_0x259a8d[_0x52f6('0x3b')]=qs['sort'](_0x4ddaa5[_0x52f6('0x31')][_0x52f6('0x3c')]);_0x259a8d['where']=qs[_0x52f6('0x33')](_[_0x52f6('0x3d')](_0x4ddaa5['query'],_0x24840f[_0x52f6('0x33')]));if(_0x4ddaa5[_0x52f6('0x31')][_0x52f6('0x41')]){_0x259a8d[_0x52f6('0x3e')]=_[_0x52f6('0x3f')](_0x259a8d[_0x52f6('0x3e')],{'$or':_[_0x52f6('0x2b')](_0x259a8d[_0x52f6('0x36')],function(_0x3d8c21){var _0x50faac={};_0x50faac[_0x3d8c21]={'$like':'%'+_0x4ddaa5[_0x52f6('0x31')][_0x52f6('0x41')]+'%'};return _0x50faac;})});}_0x259a8d=_['merge']({},_0x259a8d,_0x4ddaa5[_0x52f6('0x42')]);return _0x3fc6a6[_0x52f6('0x4b')](_0x259a8d);}})[_0x52f6('0x25')](function(_0x4093b3){if(_0x4093b3){_0x1909ee=_0x4093b3[_0x52f6('0x38')];if(!_0x4ddaa5['query'][_0x52f6('0x39')](_0x52f6('0x3a'))){_0x259a8d['limit']=qs[_0x52f6('0x1e')](_0x4ddaa5[_0x52f6('0x31')]['limit']);_0x259a8d['offset']=qs['offset'](_0x4ddaa5['query'][_0x52f6('0x1c')]);}return _0x3fc6a6[_0x52f6('0x4b')](_0x259a8d);}})[_0x52f6('0x25')](function(_0x12458d){if(_0x12458d){return _0x12458d?{'count':_0x1909ee,'rows':_0x12458d}:null;}})['then'](respondWithResult(_0x5d9c0c,null))[_0x52f6('0x45')](handleError(_0x5d9c0c,null));};exports['addConfiguration']=function(_0xb6a70e,_0x3aaa88,_0x378ca8){if(_0xb6a70e['body']['id']){delete _0xb6a70e['body']['id'];}return db[_0x52f6('0x2c')][_0x52f6('0x4c')]({'where':{'id':_0xb6a70e[_0x52f6('0x47')]['id']}})[_0x52f6('0x25')](handleEntityNotFound(_0x3aaa88,null))[_0x52f6('0x25')](function(_0x59903a){if(_0x59903a){_0xb6a70e['body']['AccountId']=_0x59903a['id'];_0xb6a70e[_0x52f6('0x49')][_0x52f6('0x4d')]=integrations[_0x52f6('0x4e')](_0xb6a70e[_0x52f6('0x49')][_0x52f6('0x4f')],_0xb6a70e[_0x52f6('0x49')][_0x52f6('0x2f')]);_0xb6a70e['body'][_0x52f6('0x50')]=integrations[_0x52f6('0x51')](_0xb6a70e[_0x52f6('0x49')][_0x52f6('0x4f')],_0xb6a70e[_0x52f6('0x49')]['type']);return db[_0x52f6('0x52')][_0x52f6('0x48')](_0xb6a70e['body'],{'include':[{'model':db[_0x52f6('0x53')],'as':_0x52f6('0x4d')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x52f6('0x25')](respondWithResult(_0x3aaa88,null))[_0x52f6('0x45')](handleError(_0x3aaa88,null));};exports[_0x52f6('0x54')]=function(_0x5bb694,_0x5ae24b,_0x19b8ec){var _0x449898='';var _0x1396e4=['id',_0x52f6('0x28'),'assigned_user_id','created_by',_0x52f6('0x55'),_0x52f6('0x56'),'duration_hours',_0x52f6('0x57'),'parent_id','parent_type',_0x52f6('0x58'),_0x52f6('0x59')];return db[_0x52f6('0x2c')][_0x52f6('0x4c')]({'where':{'id':_0x5bb694[_0x52f6('0x47')]['id']},'attributes':['id',_0x52f6('0x5a'),_0x52f6('0x5b'),_0x52f6('0x5c')]})[_0x52f6('0x25')](handleEntityNotFound(_0x5ae24b,null))['then'](function(_0x346e9e){if(_0x346e9e){_0x449898=_0x346e9e['remoteUri'];var _0x35c22d=_0x449898['slice'](-0x1);if(_0x35c22d==='/'){_0x449898=_0x449898[_0x52f6('0x5d')](0x0,_0x449898[_0x52f6('0x5e')](_0x35c22d));}return rp({'method':'POST','uri':util[_0x52f6('0x5f')](_0x52f6('0x60'),_0x449898,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x52f6('0x61'),'input_type':'JSON','response_type':_0x52f6('0x62'),'rest_data':JSON[_0x52f6('0x63')]({'user_auth':{'user_name':_0x346e9e[_0x52f6('0x5a')],'password':_0x346e9e['password'],'encryption':_0x52f6('0x64')},'application':_0x52f6('0x65')})}});}})[_0x52f6('0x25')](function(_0x5da353){if(_0x5da353&&_0x5da353['name']!==_0x52f6('0x66')&&_0x5da353[_0x52f6('0x28')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util['format']('%s%s',_0x449898,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x52f6('0x67'),'input_type':_0x52f6('0x62'),'response_type':'JSON','rest_data':JSON[_0x52f6('0x63')]({'session':_0x5da353['id'],'module_name':_0x52f6('0x68')})}})[_0x52f6('0x25')](function(_0x1a3725){if(_0x1a3725){var _0x5122c2=_[_0x52f6('0x69')](_0x1a3725[_0x52f6('0x6a')]);_['remove'](_0x5122c2,function(_0x3dd7ce){return _0x1396e4[_0x52f6('0x6b')](_0x3dd7ce[_0x52f6('0x28')]);});return{'count':_0x5122c2['length'],'rows':_[_0x52f6('0x2b')](_0x5122c2,function(_0x1d2acd){return{'id':_0x1d2acd['name'],'name':_0x1d2acd['label'],'custom':_[_0x52f6('0x6c')](_0x1d2acd['name'],'_c')?!![]:![],'options':_0x1d2acd['options']?_[_0x52f6('0x2b')](_[_0x52f6('0x69')](_0x1d2acd[_0x52f6('0x42')]),function(_0x4f6085){return{'name':_0x4f6085[_0x52f6('0x6d')],'value':_0x4f6085[_0x52f6('0x28')]};}):[]};})};}})[_0x52f6('0x25')](respondWithResult(_0x5ae24b,null))['catch'](function(_0x9f7c7d){var _0x53bf1f=_0x5bb694[_0x52f6('0x31')][_0x52f6('0x6e')]?0x1f4:_0x9f7c7d[_0x52f6('0x6f')]||0x1f4;logger[_0x52f6('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x52f6('0x54'),_0x53bf1f,JSON[_0x52f6('0x63')](_0x9f7c7d));delete _0x9f7c7d['name'];if(_0x53bf1f===0x191){_0x53bf1f=0x190;}_0x5ae24b[_0x52f6('0x1a')](_0x53bf1f)[_0x52f6('0x29')](_0x5bb694[_0x52f6('0x31')][_0x52f6('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x9f7c7d['statusCode']}:_0x9f7c7d);});}else{var _0x3fb96e=0x1f4;_0x5ae24b[_0x52f6('0x1a')](_0x3fb96e)[_0x52f6('0x29')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 7efbc1c..294b079 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 _0x2752=['SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','moment','request-promise','./intSugarcrmAccount.attributes','define'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x2752,0x1ad));var _0x2275=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2752[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2275('0x0'))('api');var moment=require(_0x2275('0x1'));var BPromise=require('bluebird');var rp=require(_0x2275('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2275('0x3'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1fe9ad,_0x4c42a7){return _0x1fe9ad[_0x2275('0x4')](_0x2275('0x5'),attributes,{'tableName':_0x2275('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07c3=['api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','lodash'];(function(_0x3ccdb0,_0x4adc30){var _0x58aa5b=function(_0x579c7a){while(--_0x579c7a){_0x3ccdb0['push'](_0x3ccdb0['shift']());}};_0x58aa5b(++_0x4adc30);}(_0x07c3,0xe0));var _0x307c=function(_0x4322c6,_0x28f126){_0x4322c6=_0x4322c6-0x0;var _0x4e7537=_0x07c3[_0x4322c6];return _0x4e7537;};'use strict';var _=require(_0x307c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x307c('0x1'));var moment=require(_0x307c('0x2'));var BPromise=require(_0x307c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x307c('0x4'));var rimraf=require(_0x307c('0x5'));var config=require(_0x307c('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x307c('0x7'));module[_0x307c('0x8')]=function(_0x5cb1ca,_0x51df5c){return _0x5cb1ca['define']('SugarcrmAccount',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 9df28ef..62a89a5 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 _0x2133=['debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s'];(function(_0x45adc7,_0xd4069f){var _0x3b9008=function(_0xb82233){while(--_0xb82233){_0x45adc7['push'](_0x45adc7['shift']());}};_0x3b9008(++_0xd4069f);}(_0x2133,0x1e8));var _0x3213=function(_0x45d55d,_0x2c14af){_0x45d55d=_0x45d55d-0x0;var _0x4df5bd=_0x2133[_0x45d55d];return _0x4df5bd;};'use strict';var _=require(_0x3213('0x0'));var util=require(_0x3213('0x1'));var moment=require('moment');var BPromise=require(_0x3213('0x2'));var rs=require(_0x3213('0x3'));var fs=require('fs');var Redis=require(_0x3213('0x4'));var db=require(_0x3213('0x5'))['db'];var utils=require(_0x3213('0x6'));var logger=require(_0x3213('0x7'))('rpc');var config=require(_0x3213('0x8'));var jayson=require(_0x3213('0x9'));var client=jayson[_0x3213('0xa')][_0x3213('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50f9d6,_0x598b75,_0x1816ea){return new BPromise(function(_0x34c5b8,_0x2ca9ea){return client[_0x3213('0xc')](_0x50f9d6,_0x1816ea)[_0x3213('0xd')](function(_0x23bacd){logger[_0x3213('0xe')](_0x3213('0xf'),_0x598b75,'request\x20sent');logger[_0x3213('0x10')](_0x3213('0x11'),_0x598b75,_0x3213('0x12'),JSON[_0x3213('0x13')](_0x23bacd));if(_0x23bacd[_0x3213('0x14')]){if(_0x23bacd[_0x3213('0x14')][_0x3213('0x15')]===0x1f4){logger[_0x3213('0x14')](_0x3213('0xf'),_0x598b75,_0x23bacd[_0x3213('0x14')]['message']);return _0x2ca9ea(_0x23bacd[_0x3213('0x14')]['message']);}logger[_0x3213('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x598b75,_0x23bacd[_0x3213('0x14')][_0x3213('0x16')]);return _0x34c5b8(_0x23bacd[_0x3213('0x14')][_0x3213('0x16')]);}else{logger[_0x3213('0xe')](_0x3213('0xf'),_0x598b75,'request\x20sent');_0x34c5b8(_0x23bacd['result'][_0x3213('0x16')]);}})[_0x3213('0x17')](function(_0x521570){logger[_0x3213('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x598b75,_0x521570);_0x2ca9ea(_0x521570);});});}exports[_0x3213('0x18')]=function(_0x5019f0){var _0x2111f5=this;return new Promise(function(_0x5e1295,_0x5dea89){return db['SugarcrmAccount'][_0x3213('0x19')]({'raw':_0x5019f0[_0x3213('0x1a')]?_0x5019f0[_0x3213('0x1a')][_0x3213('0x1b')]===undefined?!![]:![]:!![],'where':_0x5019f0[_0x3213('0x1a')]?_0x5019f0[_0x3213('0x1a')][_0x3213('0x1c')]||null:null,'attributes':_0x5019f0['options']?_0x5019f0['options'][_0x3213('0x1d')]||null:null,'limit':_0x5019f0[_0x3213('0x1a')]?_0x5019f0[_0x3213('0x1a')]['limit']||null:null,'include':_0x5019f0[_0x3213('0x1a')]?_0x5019f0[_0x3213('0x1a')][_0x3213('0x1e')]?_[_0x3213('0x1f')](_0x5019f0['options'][_0x3213('0x1e')],function(_0x38389d){return{'model':db[_0x38389d[_0x3213('0x20')]],'as':_0x38389d['as'],'attributes':_0x38389d[_0x3213('0x1d')],'include':_0x38389d[_0x3213('0x1e')]?_[_0x3213('0x1f')](_0x38389d[_0x3213('0x1e')],function(_0xbb214d){return{'model':db[_0xbb214d[_0x3213('0x20')]],'as':_0xbb214d['as'],'attributes':_0xbb214d[_0x3213('0x1d')],'include':_0xbb214d[_0x3213('0x1e')]?_[_0x3213('0x1f')](_0xbb214d[_0x3213('0x1e')],function(_0x266d74){return{'model':db[_0x266d74[_0x3213('0x20')]],'as':_0x266d74['as'],'attributes':_0x266d74[_0x3213('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3213('0xd')](function(_0x527292){logger[_0x3213('0xe')](_0x3213('0x18'),_0x5019f0);logger[_0x3213('0x10')](_0x3213('0x18'),_0x5019f0,JSON[_0x3213('0x13')](_0x527292));_0x5e1295(_0x527292);})[_0x3213('0x17')](function(_0x16a8c9){logger[_0x3213('0x14')]('GetSugarcrmAccount',_0x16a8c9['message'],_0x5019f0);_0x5dea89(_0x2111f5[_0x3213('0x14')](0x1f4,_0x16a8c9[_0x3213('0x16')]));});});};exports[_0x3213('0x21')]=function(_0x1a05a0){var _0x3521a3=this;return new Promise(function(_0x152b87,_0x43348d){return db[_0x3213('0x22')][_0x3213('0x23')]({'raw':_0x1a05a0['options']?_0x1a05a0[_0x3213('0x1a')][_0x3213('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a05a0['options']?_0x1a05a0[_0x3213('0x1a')][_0x3213('0x1c')]||null:null,'attributes':_0x1a05a0[_0x3213('0x1a')]?_0x1a05a0[_0x3213('0x1a')]['attributes']||null:null,'include':_0x1a05a0[_0x3213('0x1a')]?_0x1a05a0[_0x3213('0x1a')][_0x3213('0x1e')]?_[_0x3213('0x1f')](_0x1a05a0[_0x3213('0x1a')]['include'],function(_0x1db269){return{'model':db[_0x1db269[_0x3213('0x20')]],'as':_0x1db269['as'],'attributes':_0x1db269['attributes'],'include':_0x1db269[_0x3213('0x1e')]?_[_0x3213('0x1f')](_0x1db269['include'],function(_0x434ebb){return{'model':db[_0x434ebb[_0x3213('0x20')]],'as':_0x434ebb['as'],'attributes':_0x434ebb[_0x3213('0x1d')],'include':_0x434ebb['include']?_['map'](_0x434ebb[_0x3213('0x1e')],function(_0x30b414){return{'model':db[_0x30b414['model']],'as':_0x30b414['as'],'attributes':_0x30b414[_0x3213('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3213('0xd')](function(_0x5049f4){logger[_0x3213('0xe')](_0x3213('0x21'),_0x1a05a0);logger[_0x3213('0x10')]('ShowSugarcrmAccount',_0x1a05a0,JSON[_0x3213('0x13')](_0x5049f4));_0x152b87(_0x5049f4);})[_0x3213('0x17')](function(_0x3baa78){logger[_0x3213('0x14')](_0x3213('0x21'),_0x3baa78[_0x3213('0x16')],_0x1a05a0);_0x43348d(_0x3521a3[_0x3213('0x14')](0x1f4,_0x3baa78[_0x3213('0x16')]));});});}; \ No newline at end of file +var _0x9b4c=['map','model','find','then','ShowSugarcrmAccount','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0xa95e14,_0x1cc5c7){var _0x3e8766=function(_0x53a7f2){while(--_0x53a7f2){_0xa95e14['push'](_0xa95e14['shift']());}};_0x3e8766(++_0x1cc5c7);}(_0x9b4c,0x110));var _0xc9b4=function(_0x37de50,_0x27f82a){_0x37de50=_0x37de50-0x0;var _0x2c37dc=_0x9b4c[_0x37de50];return _0x2c37dc;};'use strict';var _=require(_0xc9b4('0x0'));var util=require(_0xc9b4('0x1'));var moment=require(_0xc9b4('0x2'));var BPromise=require(_0xc9b4('0x3'));var rs=require(_0xc9b4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9b4('0x5'))['db'];var utils=require(_0xc9b4('0x6'));var logger=require(_0xc9b4('0x7'))(_0xc9b4('0x8'));var config=require(_0xc9b4('0x9'));var jayson=require(_0xc9b4('0xa'));var client=jayson['client'][_0xc9b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a4a55,_0x152c8e,_0x43cefc){return new BPromise(function(_0x541b2a,_0x2662d1){return client[_0xc9b4('0xc')](_0x3a4a55,_0x43cefc)['then'](function(_0xe189b){logger[_0xc9b4('0xd')](_0xc9b4('0xe'),_0x152c8e,_0xc9b4('0xf'));logger[_0xc9b4('0x10')](_0xc9b4('0x11'),_0x152c8e,_0xc9b4('0xf'),JSON['stringify'](_0xe189b));if(_0xe189b['error']){if(_0xe189b[_0xc9b4('0x12')][_0xc9b4('0x13')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x152c8e,_0xe189b[_0xc9b4('0x12')][_0xc9b4('0x14')]);return _0x2662d1(_0xe189b[_0xc9b4('0x12')]['message']);}logger[_0xc9b4('0x12')](_0xc9b4('0xe'),_0x152c8e,_0xe189b[_0xc9b4('0x12')][_0xc9b4('0x14')]);return _0x541b2a(_0xe189b['error'][_0xc9b4('0x14')]);}else{logger[_0xc9b4('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x152c8e,'request\x20sent');_0x541b2a(_0xe189b[_0xc9b4('0x15')][_0xc9b4('0x14')]);}})[_0xc9b4('0x16')](function(_0x9f4c62){logger[_0xc9b4('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x152c8e,_0x9f4c62);_0x2662d1(_0x9f4c62);});});}exports[_0xc9b4('0x17')]=function(_0x5416d7){var _0x2bde05=this;return new Promise(function(_0xbbec35,_0x1f9b4b){return db[_0xc9b4('0x18')][_0xc9b4('0x19')]({'raw':_0x5416d7[_0xc9b4('0x1a')]?_0x5416d7['options'][_0xc9b4('0x1b')]===undefined?!![]:![]:!![],'where':_0x5416d7[_0xc9b4('0x1a')]?_0x5416d7[_0xc9b4('0x1a')][_0xc9b4('0x1c')]||null:null,'attributes':_0x5416d7[_0xc9b4('0x1a')]?_0x5416d7[_0xc9b4('0x1a')][_0xc9b4('0x1d')]||null:null,'limit':_0x5416d7['options']?_0x5416d7[_0xc9b4('0x1a')][_0xc9b4('0x1e')]||null:null,'include':_0x5416d7[_0xc9b4('0x1a')]?_0x5416d7[_0xc9b4('0x1a')][_0xc9b4('0x1f')]?_[_0xc9b4('0x20')](_0x5416d7['options'][_0xc9b4('0x1f')],function(_0x1e5563){return{'model':db[_0x1e5563[_0xc9b4('0x21')]],'as':_0x1e5563['as'],'attributes':_0x1e5563[_0xc9b4('0x1d')],'include':_0x1e5563[_0xc9b4('0x1f')]?_[_0xc9b4('0x20')](_0x1e5563['include'],function(_0xf9c9ca){return{'model':db[_0xf9c9ca[_0xc9b4('0x21')]],'as':_0xf9c9ca['as'],'attributes':_0xf9c9ca['attributes'],'include':_0xf9c9ca[_0xc9b4('0x1f')]?_[_0xc9b4('0x20')](_0xf9c9ca[_0xc9b4('0x1f')],function(_0x50bd8){return{'model':db[_0x50bd8['model']],'as':_0x50bd8['as'],'attributes':_0x50bd8[_0xc9b4('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x380308){logger[_0xc9b4('0xd')](_0xc9b4('0x17'),_0x5416d7);logger[_0xc9b4('0x10')](_0xc9b4('0x17'),_0x5416d7,JSON['stringify'](_0x380308));_0xbbec35(_0x380308);})[_0xc9b4('0x16')](function(_0x37d073){logger['error']('GetSugarcrmAccount',_0x37d073[_0xc9b4('0x14')],_0x5416d7);_0x1f9b4b(_0x2bde05[_0xc9b4('0x12')](0x1f4,_0x37d073['message']));});});};exports['ShowSugarcrmAccount']=function(_0x4709c6){var _0x24d16c=this;return new Promise(function(_0x1b3c2b,_0x57f22f){return db[_0xc9b4('0x18')][_0xc9b4('0x22')]({'raw':_0x4709c6[_0xc9b4('0x1a')]?_0x4709c6[_0xc9b4('0x1a')][_0xc9b4('0x1b')]===undefined?!![]:![]:!![],'where':_0x4709c6[_0xc9b4('0x1a')]?_0x4709c6['options'][_0xc9b4('0x1c')]||null:null,'attributes':_0x4709c6[_0xc9b4('0x1a')]?_0x4709c6[_0xc9b4('0x1a')]['attributes']||null:null,'include':_0x4709c6[_0xc9b4('0x1a')]?_0x4709c6[_0xc9b4('0x1a')][_0xc9b4('0x1f')]?_[_0xc9b4('0x20')](_0x4709c6[_0xc9b4('0x1a')]['include'],function(_0x4ddadc){return{'model':db[_0x4ddadc[_0xc9b4('0x21')]],'as':_0x4ddadc['as'],'attributes':_0x4ddadc[_0xc9b4('0x1d')],'include':_0x4ddadc[_0xc9b4('0x1f')]?_['map'](_0x4ddadc[_0xc9b4('0x1f')],function(_0x18a488){return{'model':db[_0x18a488[_0xc9b4('0x21')]],'as':_0x18a488['as'],'attributes':_0x18a488[_0xc9b4('0x1d')],'include':_0x18a488[_0xc9b4('0x1f')]?_['map'](_0x18a488['include'],function(_0x13689a){return{'model':db[_0x13689a[_0xc9b4('0x21')]],'as':_0x13689a['as'],'attributes':_0x13689a['attributes']};}):[]};}):[]};}):[]:[]})[_0xc9b4('0x23')](function(_0x4b950a){logger[_0xc9b4('0xd')](_0xc9b4('0x24'),_0x4709c6);logger[_0xc9b4('0x10')]('ShowSugarcrmAccount',_0x4709c6,JSON[_0xc9b4('0x25')](_0x4b950a));_0x1b3c2b(_0x4b950a);})[_0xc9b4('0x16')](function(_0x44aa3e){logger['error'](_0xc9b4('0x24'),_0x44aa3e[_0xc9b4('0x14')],_0x4709c6);_0x57f22f(_0x24d16c[_0xc9b4('0x12')](0x1f4,_0x44aa3e['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 48cf865..f8c4f5d 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 _0xab32=['delete','exports','multer','connect-timeout','fs-extra','../../components/auth/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id'];(function(_0x251b53,_0x5e3392){var _0x3d723f=function(_0x108b2a){while(--_0x108b2a){_0x251b53['push'](_0x251b53['shift']());}};_0x3d723f(++_0x5e3392);}(_0xab32,0xe6));var _0x2ab3=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0xab32[_0x397f37];return _0x31cae6;};'use strict';var multer=require(_0x2ab3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2ab3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2ab3('0x2'));var auth=require(_0x2ab3('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2ab3('0x4'));router[_0x2ab3('0x5')]('/',auth[_0x2ab3('0x6')](),controller[_0x2ab3('0x7')]);router[_0x2ab3('0x5')]('/:id',auth[_0x2ab3('0x6')](),controller[_0x2ab3('0x8')]);router[_0x2ab3('0x5')]('/:id/fields',auth[_0x2ab3('0x6')](),controller[_0x2ab3('0x9')]);router['get'](_0x2ab3('0xa'),auth[_0x2ab3('0x6')](),controller[_0x2ab3('0xb')]);router[_0x2ab3('0x5')](_0x2ab3('0xc'),auth[_0x2ab3('0x6')](),controller[_0x2ab3('0xd')]);router[_0x2ab3('0xe')]('/',auth[_0x2ab3('0x6')](),controller['create']);router[_0x2ab3('0xf')](_0x2ab3('0x10'),auth[_0x2ab3('0x6')](),controller['update']);router[_0x2ab3('0x11')](_0x2ab3('0x10'),auth[_0x2ab3('0x6')](),controller['destroy']);module[_0x2ab3('0x12')]=router; \ No newline at end of file +var _0xac98=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5bacce,_0x599fbc){var _0x405023=function(_0x15c557){while(--_0x15c557){_0x5bacce['push'](_0x5bacce['shift']());}};_0x405023(++_0x599fbc);}(_0xac98,0x163));var _0x8ac9=function(_0x3e5aa0,_0x4389d9){_0x3e5aa0=_0x3e5aa0-0x0;var _0x18b145=_0xac98[_0x3e5aa0];return _0x18b145;};'use strict';var multer=require(_0x8ac9('0x0'));var util=require(_0x8ac9('0x1'));var path=require(_0x8ac9('0x2'));var timeout=require(_0x8ac9('0x3'));var express=require(_0x8ac9('0x4'));var router=express['Router']();var fs_extra=require(_0x8ac9('0x5'));var auth=require(_0x8ac9('0x6'));var interaction=require(_0x8ac9('0x7'));var config=require(_0x8ac9('0x8'));var controller=require(_0x8ac9('0x9'));router[_0x8ac9('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ac9('0xb')]);router[_0x8ac9('0xa')](_0x8ac9('0xc'),auth[_0x8ac9('0xd')](),controller['show']);router[_0x8ac9('0xa')](_0x8ac9('0xe'),auth['isAuthenticated'](),controller[_0x8ac9('0xf')]);router['get'](_0x8ac9('0x10'),auth[_0x8ac9('0xd')](),controller[_0x8ac9('0x11')]);router[_0x8ac9('0xa')](_0x8ac9('0x12'),auth[_0x8ac9('0xd')](),controller['getDescriptions']);router[_0x8ac9('0x13')]('/',auth[_0x8ac9('0xd')](),controller[_0x8ac9('0x14')]);router['put'](_0x8ac9('0xc'),auth[_0x8ac9('0xd')](),controller['update']);router[_0x8ac9('0x15')](_0x8ac9('0xc'),auth['isAuthenticated'](),controller[_0x8ac9('0x16')]);module[_0x8ac9('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index c92dffc..c844e9b 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 _0xfb9c=['STRING','sequelize','exports'];(function(_0x3258e3,_0x41d553){var _0x5dde15=function(_0x221829){while(--_0x221829){_0x3258e3['push'](_0x3258e3['shift']());}};_0x5dde15(++_0x41d553);}(_0xfb9c,0x121));var _0xcfb9=function(_0x1b3251,_0x58f958){_0x1b3251=_0x1b3251-0x0;var _0x370769=_0xfb9c[_0x1b3251];return _0x370769;};'use strict';var Sequelize=require(_0xcfb9('0x0'));module[_0xcfb9('0x1')]={'name':{'type':Sequelize[_0xcfb9('0x2')]},'description':{'type':Sequelize[_0xcfb9('0x2')]}}; \ No newline at end of file +var _0x1c4a=['STRING','sequelize','exports'];(function(_0x310196,_0x2e76d7){var _0x35aa0a=function(_0x468dfc){while(--_0x468dfc){_0x310196['push'](_0x310196['shift']());}};_0x35aa0a(++_0x2e76d7);}(_0x1c4a,0x1c6));var _0xa1c4=function(_0xa92559,_0x1d2e45){_0xa92559=_0xa92559-0x0;var _0x502df8=_0x1c4a[_0xa92559];return _0x502df8;};'use strict';var Sequelize=require(_0xa1c4('0x0'));module[_0xa1c4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa1c4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 6534408..103717c 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 _0x7591=['rimraf','zip-dir','moment','bluebird','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','merge','find','create','body','update','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format'];(function(_0x229630,_0x533479){var _0x2731d0=function(_0x240ab3){while(--_0x240ab3){_0x229630['push'](_0x229630['shift']());}};_0x2731d0(++_0x533479);}(_0x7591,0x1c7));var _0x1759=function(_0x4d1828,_0x3d9465){_0x4d1828=_0x4d1828-0x0;var _0x108ba9=_0x7591[_0x4d1828];return _0x108ba9;};'use strict';var emlformat=require(_0x1759('0x0'));var rimraf=require(_0x1759('0x1'));var zipdir=require(_0x1759('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1759('0x3'));var BPromise=require(_0x1759('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1759('0x5'));var sox=require(_0x1759('0x6'));var csv=require('to-csv');var ejs=require(_0x1759('0x7'));var fs=require('fs');var fs_extra=require(_0x1759('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1759('0x9'));var jsforce=require(_0x1759('0xa'));var deskjs=require(_0x1759('0xb'));var toCsv=require(_0x1759('0xc'));var querystring=require(_0x1759('0xd'));var Papa=require(_0x1759('0xe'));var Redis=require(_0x1759('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1759('0x10'));var as=require(_0x1759('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1759('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x1759('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1759('0x14'))['db'];function respondWithStatusCode(_0x35e4ca,_0x5a3f46){_0x5a3f46=_0x5a3f46||0xcc;return function(_0x47cf82){if(_0x47cf82){return _0x35e4ca[_0x1759('0x15')](_0x5a3f46);}return _0x35e4ca[_0x1759('0x16')](_0x5a3f46)['end']();};}function respondWithResult(_0xb41d3c,_0xe7ef3e){_0xe7ef3e=_0xe7ef3e||0xc8;return function(_0x3fec25){if(_0x3fec25){return _0xb41d3c[_0x1759('0x16')](_0xe7ef3e)['json'](_0x3fec25);}};}function respondWithFilteredResult(_0x4a1652,_0x5588c1){return function(_0x2b7204){if(_0x2b7204){var _0x5efbb6=typeof _0x5588c1[_0x1759('0x17')]==='undefined'&&typeof _0x5588c1[_0x1759('0x18')]==='undefined';var _0x16c870=_0x2b7204[_0x1759('0x19')];var _0xc696f6=_0x5efbb6?0x0:_0x5588c1[_0x1759('0x17')];var _0x50718e=_0x5efbb6?_0x2b7204[_0x1759('0x19')]:_0x5588c1['offset']+_0x5588c1['limit'];var _0x1f1a01;if(_0x50718e>=_0x16c870){_0x50718e=_0x16c870;_0x1f1a01=0xc8;}else{_0x1f1a01=0xce;}_0x4a1652[_0x1759('0x16')](_0x1f1a01);return _0x4a1652['set'](_0x1759('0x1a'),_0xc696f6+'-'+_0x50718e+'/'+_0x16c870)['json'](_0x2b7204);}return null;};}function patchUpdates(_0x3cd91a){return function(_0x5189da){try{jsonpatch[_0x1759('0x1b')](_0x5189da,_0x3cd91a,!![]);}catch(_0x34398b){return BPromise[_0x1759('0x1c')](_0x34398b);}return _0x5189da[_0x1759('0x1d')]();};}function saveUpdates(_0x2f9572,_0x55482e){return function(_0x34ece0){if(_0x34ece0){return _0x34ece0['update'](_0x2f9572)[_0x1759('0x1e')](function(_0x2af609){return _0x2af609;});}return null;};}function removeEntity(_0x58a5be,_0xe9df93){return function(_0x22052d){if(_0x22052d){return _0x22052d[_0x1759('0x1f')]()['then'](function(){_0x58a5be[_0x1759('0x16')](0xcc)[_0x1759('0x20')]();});}};}function handleEntityNotFound(_0x2bd450,_0x5715d5){return function(_0x46dea0){if(!_0x46dea0){_0x2bd450[_0x1759('0x15')](0x194);}return _0x46dea0;};}function handleError(_0x460327,_0x2a9264){_0x2a9264=_0x2a9264||0x1f4;return function(_0x1e045e){logger[_0x1759('0x21')](_0x1e045e[_0x1759('0x22')]);if(_0x1e045e[_0x1759('0x23')]){delete _0x1e045e['name'];}_0x460327['status'](_0x2a9264)[_0x1759('0x24')](_0x1e045e);};}exports[_0x1759('0x25')]=function(_0x3132be,_0x2c83ab){var _0x45814d={},_0x5d862e={},_0xdc6620={'count':0x0,'rows':[]};var _0x529615=_[_0x1759('0x26')](db[_0x1759('0x27')][_0x1759('0x28')],function(_0x593d06){return{'name':_0x593d06[_0x1759('0x29')],'type':_0x593d06[_0x1759('0x2a')]['key']};});_0x5d862e[_0x1759('0x2b')]=_[_0x1759('0x26')](_0x529615,_0x1759('0x23'));_0x5d862e['query']=_[_0x1759('0x2c')](_0x3132be['query']);_0x5d862e[_0x1759('0x2d')]=_[_0x1759('0x2e')](_0x5d862e[_0x1759('0x2b')],_0x5d862e[_0x1759('0x2f')]);_0x45814d[_0x1759('0x30')]=_[_0x1759('0x2e')](_0x5d862e[_0x1759('0x2b')],qs[_0x1759('0x31')](_0x3132be['query'][_0x1759('0x31')]));_0x45814d[_0x1759('0x30')]=_0x45814d[_0x1759('0x30')][_0x1759('0x32')]?_0x45814d[_0x1759('0x30')]:_0x5d862e['model'];if(!_0x3132be['query'][_0x1759('0x33')](_0x1759('0x34'))){_0x45814d['limit']=qs[_0x1759('0x18')](_0x3132be[_0x1759('0x2f')][_0x1759('0x18')]);_0x45814d[_0x1759('0x17')]=qs[_0x1759('0x17')](_0x3132be[_0x1759('0x2f')][_0x1759('0x17')]);}_0x45814d[_0x1759('0x35')]=qs[_0x1759('0x36')](_0x3132be[_0x1759('0x2f')][_0x1759('0x36')]);_0x45814d[_0x1759('0x37')]=qs[_0x1759('0x2d')](_[_0x1759('0x38')](_0x3132be[_0x1759('0x2f')],_0x5d862e[_0x1759('0x2d')]),_0x529615);if(_0x3132be[_0x1759('0x2f')][_0x1759('0x39')]){_0x45814d['where']=_['merge'](_0x45814d[_0x1759('0x37')],{'$or':_[_0x1759('0x26')](_0x529615,function(_0x4b5cb1){if(_0x4b5cb1[_0x1759('0x2a')]!==_0x1759('0x3a')){var _0x1f3c43={};_0x1f3c43[_0x4b5cb1['name']]={'$like':'%'+_0x3132be[_0x1759('0x2f')][_0x1759('0x39')]+'%'};return _0x1f3c43;}})});}_0x45814d=_['merge']({},_0x45814d,_0x3132be[_0x1759('0x3b')]);var _0x5eef23={'where':_0x45814d[_0x1759('0x37')]};return db[_0x1759('0x27')][_0x1759('0x19')](_0x5eef23)[_0x1759('0x1e')](function(_0x49b22f){_0xdc6620[_0x1759('0x19')]=_0x49b22f;if(_0x3132be['query'][_0x1759('0x3c')]){_0x45814d[_0x1759('0x3d')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x1759('0x3e')](_0x45814d);})[_0x1759('0x1e')](function(_0x108226){_0xdc6620[_0x1759('0x3f')]=_0x108226;return _0xdc6620;})[_0x1759('0x1e')](respondWithFilteredResult(_0x2c83ab,_0x45814d))[_0x1759('0x40')](handleError(_0x2c83ab,null));};exports['show']=function(_0x27a75d,_0x3a7dd0){var _0x2fc63={'raw':![],'where':{'id':_0x27a75d[_0x1759('0x41')]['id']}},_0x5bb0d4={};_0x5bb0d4[_0x1759('0x2b')]=_[_0x1759('0x2c')](db['SugarcrmConfiguration'][_0x1759('0x28')]);_0x5bb0d4[_0x1759('0x2f')]=_['keys'](_0x27a75d[_0x1759('0x2f')]);_0x5bb0d4['filters']=_[_0x1759('0x2e')](_0x5bb0d4[_0x1759('0x2b')],_0x5bb0d4[_0x1759('0x2f')]);_0x2fc63[_0x1759('0x30')]=_[_0x1759('0x2e')](_0x5bb0d4[_0x1759('0x2b')],qs[_0x1759('0x31')](_0x27a75d[_0x1759('0x2f')][_0x1759('0x31')]));_0x2fc63[_0x1759('0x30')]=_0x2fc63['attributes'][_0x1759('0x32')]?_0x2fc63[_0x1759('0x30')]:_0x5bb0d4['model'];if(_0x27a75d[_0x1759('0x2f')][_0x1759('0x3c')]){_0x2fc63[_0x1759('0x3d')]=[{'all':!![]}];}_0x2fc63=_[_0x1759('0x42')]({},_0x2fc63,_0x27a75d[_0x1759('0x3b')]);return db[_0x1759('0x27')][_0x1759('0x43')](_0x2fc63)[_0x1759('0x1e')](handleEntityNotFound(_0x3a7dd0,null))[_0x1759('0x1e')](respondWithResult(_0x3a7dd0,null))[_0x1759('0x40')](handleError(_0x3a7dd0,null));};exports[_0x1759('0x44')]=function(_0x1064e8,_0x5c0203){return db[_0x1759('0x27')][_0x1759('0x44')](_0x1064e8[_0x1759('0x45')],{})[_0x1759('0x1e')](respondWithResult(_0x5c0203,0xc9))['catch'](handleError(_0x5c0203,null));};exports[_0x1759('0x46')]=function(_0x35bf09,_0x4f9392){if(_0x35bf09[_0x1759('0x45')]['id']){delete _0x35bf09[_0x1759('0x45')]['id'];}return db[_0x1759('0x27')][_0x1759('0x43')]({'where':{'id':_0x35bf09[_0x1759('0x41')]['id']}})[_0x1759('0x1e')](handleEntityNotFound(_0x4f9392,null))['then'](saveUpdates(_0x35bf09[_0x1759('0x45')],null))['then'](respondWithResult(_0x4f9392,null))[_0x1759('0x40')](handleError(_0x4f9392,null));};exports[_0x1759('0x1f')]=function(_0x4b02bc,_0x5db7b5){return db[_0x1759('0x27')]['find']({'where':{'id':_0x4b02bc['params']['id']}})[_0x1759('0x1e')](handleEntityNotFound(_0x5db7b5,null))[_0x1759('0x1e')](removeEntity(_0x5db7b5,null))[_0x1759('0x40')](handleError(_0x5db7b5,null));};exports[_0x1759('0x47')]=function(_0x2afb06,_0xd344cd,_0x5e7eca){var _0x40efb7={};var _0xef6ec6={};var _0x449713;var _0x838ab0;return db[_0x1759('0x27')][_0x1759('0x48')]({'where':{'id':_0x2afb06[_0x1759('0x41')]['id']}})['then'](handleEntityNotFound(_0xd344cd,null))[_0x1759('0x1e')](function(_0x11b464){if(_0x11b464){_0x449713=_0x11b464;_0xef6ec6[_0x1759('0x2b')]=_[_0x1759('0x2c')](db[_0x1759('0x49')][_0x1759('0x28')]);_0xef6ec6[_0x1759('0x2f')]=_[_0x1759('0x2c')](_0x2afb06[_0x1759('0x2f')]);_0xef6ec6[_0x1759('0x2d')]=_[_0x1759('0x2e')](_0xef6ec6[_0x1759('0x2b')],_0xef6ec6[_0x1759('0x2f')]);_0x40efb7['attributes']=_['intersection'](_0xef6ec6[_0x1759('0x2b')],qs[_0x1759('0x31')](_0x2afb06[_0x1759('0x2f')][_0x1759('0x31')]));_0x40efb7['attributes']=_0x40efb7[_0x1759('0x30')][_0x1759('0x32')]?_0x40efb7['attributes']:_0xef6ec6[_0x1759('0x2b')];_0x40efb7[_0x1759('0x35')]=qs[_0x1759('0x36')](_0x2afb06[_0x1759('0x2f')][_0x1759('0x36')]);_0x40efb7[_0x1759('0x37')]=qs[_0x1759('0x2d')](_[_0x1759('0x38')](_0x2afb06['query'],_0xef6ec6['filters']));if(_0x2afb06[_0x1759('0x2f')][_0x1759('0x39')]){_0x40efb7['where']=_[_0x1759('0x42')](_0x40efb7[_0x1759('0x37')],{'$or':_[_0x1759('0x26')](_0x40efb7[_0x1759('0x30')],function(_0x2a60b2){var _0x4241c1={};_0x4241c1[_0x2a60b2]={'$like':'%'+_0x2afb06[_0x1759('0x2f')][_0x1759('0x39')]+'%'};return _0x4241c1;})});}_0x40efb7=_[_0x1759('0x42')]({},_0x40efb7,_0x2afb06[_0x1759('0x3b')]);return _0x449713['getFields'](_0x40efb7);}})['then'](function(_0x58c172){if(_0x58c172){_0x838ab0=_0x58c172['length'];if(!_0x2afb06['query'][_0x1759('0x33')](_0x1759('0x34'))){_0x40efb7[_0x1759('0x18')]=qs[_0x1759('0x18')](_0x2afb06[_0x1759('0x2f')][_0x1759('0x18')]);_0x40efb7[_0x1759('0x17')]=qs[_0x1759('0x17')](_0x2afb06[_0x1759('0x2f')][_0x1759('0x17')]);}return _0x449713[_0x1759('0x47')](_0x40efb7);}})[_0x1759('0x1e')](function(_0x2ee1a9){if(_0x2ee1a9){return _0x2ee1a9?{'count':_0x838ab0,'rows':_0x2ee1a9}:null;}})[_0x1759('0x1e')](respondWithResult(_0xd344cd,null))[_0x1759('0x40')](handleError(_0xd344cd,null));};exports[_0x1759('0x4a')]=function(_0x4dc8dd,_0x4cda25,_0x17788e){var _0x5c8eb5={};var _0x1aa8bc={};var _0x3b874e;var _0x242cb7;return db[_0x1759('0x27')]['findOne']({'where':{'id':_0x4dc8dd[_0x1759('0x41')]['id']}})[_0x1759('0x1e')](handleEntityNotFound(_0x4cda25,null))[_0x1759('0x1e')](function(_0xeaccf8){if(_0xeaccf8){_0x3b874e=_0xeaccf8;_0x1aa8bc[_0x1759('0x2b')]=_[_0x1759('0x2c')](db[_0x1759('0x49')][_0x1759('0x28')]);_0x1aa8bc[_0x1759('0x2f')]=_[_0x1759('0x2c')](_0x4dc8dd['query']);_0x1aa8bc[_0x1759('0x2d')]=_[_0x1759('0x2e')](_0x1aa8bc[_0x1759('0x2b')],_0x1aa8bc[_0x1759('0x2f')]);_0x5c8eb5['attributes']=_['intersection'](_0x1aa8bc[_0x1759('0x2b')],qs[_0x1759('0x31')](_0x4dc8dd[_0x1759('0x2f')][_0x1759('0x31')]));_0x5c8eb5[_0x1759('0x30')]=_0x5c8eb5[_0x1759('0x30')][_0x1759('0x32')]?_0x5c8eb5['attributes']:_0x1aa8bc[_0x1759('0x2b')];_0x5c8eb5['order']=qs[_0x1759('0x36')](_0x4dc8dd[_0x1759('0x2f')][_0x1759('0x36')]);_0x5c8eb5[_0x1759('0x37')]=qs[_0x1759('0x2d')](_[_0x1759('0x38')](_0x4dc8dd[_0x1759('0x2f')],_0x1aa8bc[_0x1759('0x2d')]));if(_0x4dc8dd[_0x1759('0x2f')][_0x1759('0x39')]){_0x5c8eb5[_0x1759('0x37')]=_[_0x1759('0x42')](_0x5c8eb5[_0x1759('0x37')],{'$or':_[_0x1759('0x26')](_0x5c8eb5[_0x1759('0x30')],function(_0x48483c){var _0x1198e7={};_0x1198e7[_0x48483c]={'$like':'%'+_0x4dc8dd[_0x1759('0x2f')][_0x1759('0x39')]+'%'};return _0x1198e7;})});}_0x5c8eb5=_[_0x1759('0x42')]({},_0x5c8eb5,_0x4dc8dd[_0x1759('0x3b')]);return _0x3b874e[_0x1759('0x4a')](_0x5c8eb5);}})['then'](function(_0x1a0914){if(_0x1a0914){_0x242cb7=_0x1a0914['length'];if(!_0x4dc8dd[_0x1759('0x2f')][_0x1759('0x33')](_0x1759('0x34'))){_0x5c8eb5[_0x1759('0x18')]=qs[_0x1759('0x18')](_0x4dc8dd[_0x1759('0x2f')]['limit']);_0x5c8eb5['offset']=qs['offset'](_0x4dc8dd[_0x1759('0x2f')][_0x1759('0x17')]);}return _0x3b874e[_0x1759('0x4a')](_0x5c8eb5);}})[_0x1759('0x1e')](function(_0x358e1a){if(_0x358e1a){return _0x358e1a?{'count':_0x242cb7,'rows':_0x358e1a}:null;}})[_0x1759('0x1e')](respondWithResult(_0x4cda25,null))['catch'](handleError(_0x4cda25,null));};exports[_0x1759('0x4b')]=function(_0x315c7b,_0x33874e,_0x328a34){var _0x59c4c2={};var _0x196b2c={};var _0x56202b;var _0x2e7f32;return db[_0x1759('0x27')]['findOne']({'where':{'id':_0x315c7b[_0x1759('0x41')]['id']}})[_0x1759('0x1e')](handleEntityNotFound(_0x33874e,null))[_0x1759('0x1e')](function(_0x24ff92){if(_0x24ff92){_0x56202b=_0x24ff92;_0x196b2c[_0x1759('0x2b')]=_['keys'](db[_0x1759('0x49')][_0x1759('0x28')]);_0x196b2c[_0x1759('0x2f')]=_['keys'](_0x315c7b[_0x1759('0x2f')]);_0x196b2c['filters']=_[_0x1759('0x2e')](_0x196b2c[_0x1759('0x2b')],_0x196b2c['query']);_0x59c4c2[_0x1759('0x30')]=_[_0x1759('0x2e')](_0x196b2c[_0x1759('0x2b')],qs[_0x1759('0x31')](_0x315c7b['query'][_0x1759('0x31')]));_0x59c4c2[_0x1759('0x30')]=_0x59c4c2[_0x1759('0x30')][_0x1759('0x32')]?_0x59c4c2[_0x1759('0x30')]:_0x196b2c[_0x1759('0x2b')];_0x59c4c2[_0x1759('0x35')]=qs[_0x1759('0x36')](_0x315c7b[_0x1759('0x2f')][_0x1759('0x36')]);_0x59c4c2[_0x1759('0x37')]=qs[_0x1759('0x2d')](_['pick'](_0x315c7b[_0x1759('0x2f')],_0x196b2c[_0x1759('0x2d')]));if(_0x315c7b['query'][_0x1759('0x39')]){_0x59c4c2[_0x1759('0x37')]=_[_0x1759('0x42')](_0x59c4c2['where'],{'$or':_[_0x1759('0x26')](_0x59c4c2[_0x1759('0x30')],function(_0x1e7d2c){var _0x40f538={};_0x40f538[_0x1e7d2c]={'$like':'%'+_0x315c7b['query'][_0x1759('0x39')]+'%'};return _0x40f538;})});}_0x59c4c2=_[_0x1759('0x42')]({},_0x59c4c2,_0x315c7b[_0x1759('0x3b')]);return _0x56202b[_0x1759('0x4b')](_0x59c4c2);}})[_0x1759('0x1e')](function(_0x4dadca){if(_0x4dadca){_0x2e7f32=_0x4dadca['length'];if(!_0x315c7b[_0x1759('0x2f')][_0x1759('0x33')](_0x1759('0x34'))){_0x59c4c2[_0x1759('0x18')]=qs[_0x1759('0x18')](_0x315c7b['query'][_0x1759('0x18')]);_0x59c4c2['offset']=qs[_0x1759('0x17')](_0x315c7b[_0x1759('0x2f')][_0x1759('0x17')]);}return _0x56202b['getDescriptions'](_0x59c4c2);}})[_0x1759('0x1e')](function(_0xa0eb0b){if(_0xa0eb0b){return _0xa0eb0b?{'count':_0x2e7f32,'rows':_0xa0eb0b}:null;}})[_0x1759('0x1e')](respondWithResult(_0x33874e,null))[_0x1759('0x40')](handleError(_0x33874e,null));}; \ No newline at end of file +var _0x1ee7=['params','length','includeAll','find','create','body','getFields','findOne','SugarcrmField','rawAttributes','order','sort','getSubjects','getDescriptions','hasOwnProperty','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','end','error','stack','name','index','map','SugarcrmConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ee7,0xaf));var _0x71ee=function(_0x7abb77,_0x4d588a){_0x7abb77=_0x7abb77-0x0;var _0x5efb93=_0x1ee7[_0x7abb77];return _0x5efb93;};'use strict';var emlformat=require(_0x71ee('0x0'));var rimraf=require(_0x71ee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x71ee('0x2'));var moment=require(_0x71ee('0x3'));var BPromise=require(_0x71ee('0x4'));var Mustache=require('mustache');var util=require(_0x71ee('0x5'));var path=require('path');var sox=require(_0x71ee('0x6'));var csv=require(_0x71ee('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71ee('0x8'));var _=require(_0x71ee('0x9'));var squel=require(_0x71ee('0xa'));var crypto=require('crypto');var jsforce=require(_0x71ee('0xb'));var deskjs=require(_0x71ee('0xc'));var toCsv=require(_0x71ee('0x7'));var querystring=require(_0x71ee('0xd'));var Papa=require(_0x71ee('0xe'));var Redis=require(_0x71ee('0xf'));var authService=require(_0x71ee('0x10'));var qs=require(_0x71ee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x71ee('0x12'));var logger=require('../../config/logger')(_0x71ee('0x13'));var utils=require(_0x71ee('0x14'));var config=require(_0x71ee('0x15'));var licenseUtil=require(_0x71ee('0x16'));var db=require(_0x71ee('0x17'))['db'];function respondWithStatusCode(_0x487860,_0x5921aa){_0x5921aa=_0x5921aa||0xcc;return function(_0x3f920b){if(_0x3f920b){return _0x487860[_0x71ee('0x18')](_0x5921aa);}return _0x487860[_0x71ee('0x19')](_0x5921aa)['end']();};}function respondWithResult(_0x32e98b,_0x514201){_0x514201=_0x514201||0xc8;return function(_0x8e769b){if(_0x8e769b){return _0x32e98b['status'](_0x514201)[_0x71ee('0x1a')](_0x8e769b);}};}function respondWithFilteredResult(_0x312bf6,_0x1233c0){return function(_0x2c4e09){if(_0x2c4e09){var _0xe2ca90=typeof _0x1233c0[_0x71ee('0x1b')]==='undefined'&&typeof _0x1233c0[_0x71ee('0x1c')]===_0x71ee('0x1d');var _0x237189=_0x2c4e09[_0x71ee('0x1e')];var _0x28a498=_0xe2ca90?0x0:_0x1233c0[_0x71ee('0x1b')];var _0x455863=_0xe2ca90?_0x2c4e09[_0x71ee('0x1e')]:_0x1233c0['offset']+_0x1233c0[_0x71ee('0x1c')];var _0x4c9d83;if(_0x455863>=_0x237189){_0x455863=_0x237189;_0x4c9d83=0xc8;}else{_0x4c9d83=0xce;}_0x312bf6[_0x71ee('0x19')](_0x4c9d83);return _0x312bf6[_0x71ee('0x1f')](_0x71ee('0x20'),_0x28a498+'-'+_0x455863+'/'+_0x237189)['json'](_0x2c4e09);}return null;};}function patchUpdates(_0xf4d24b){return function(_0x17ff64){try{jsonpatch['apply'](_0x17ff64,_0xf4d24b,!![]);}catch(_0x4d7d1c){return BPromise[_0x71ee('0x21')](_0x4d7d1c);}return _0x17ff64[_0x71ee('0x22')]();};}function saveUpdates(_0x5ad9c1,_0x5c2c79){return function(_0x525e9d){if(_0x525e9d){return _0x525e9d[_0x71ee('0x23')](_0x5ad9c1)['then'](function(_0x57a882){return _0x57a882;});}return null;};}function removeEntity(_0x446664,_0x27f68a){return function(_0x39921a){if(_0x39921a){return _0x39921a['destroy']()[_0x71ee('0x24')](function(){_0x446664[_0x71ee('0x19')](0xcc)[_0x71ee('0x25')]();});}};}function handleEntityNotFound(_0x2f344e,_0x8c2c0a){return function(_0x1e09e0){if(!_0x1e09e0){_0x2f344e[_0x71ee('0x18')](0x194);}return _0x1e09e0;};}function handleError(_0x244499,_0x4ae47e){_0x4ae47e=_0x4ae47e||0x1f4;return function(_0x12adae){logger[_0x71ee('0x26')](_0x12adae[_0x71ee('0x27')]);if(_0x12adae[_0x71ee('0x28')]){delete _0x12adae[_0x71ee('0x28')];}_0x244499[_0x71ee('0x19')](_0x4ae47e)['send'](_0x12adae);};}exports[_0x71ee('0x29')]=function(_0x419a6d,_0x449433){var _0x50de8b={},_0x56fa0b={},_0x40ddd1={'count':0x0,'rows':[]};var _0x11d9dd=_[_0x71ee('0x2a')](db[_0x71ee('0x2b')]['rawAttributes'],function(_0x3a5b55){return{'name':_0x3a5b55[_0x71ee('0x2c')],'type':_0x3a5b55[_0x71ee('0x2d')][_0x71ee('0x2e')]};});_0x56fa0b[_0x71ee('0x2f')]=_[_0x71ee('0x2a')](_0x11d9dd,_0x71ee('0x28'));_0x56fa0b[_0x71ee('0x30')]=_[_0x71ee('0x31')](_0x419a6d[_0x71ee('0x30')]);_0x56fa0b[_0x71ee('0x32')]=_[_0x71ee('0x33')](_0x56fa0b['model'],_0x56fa0b['query']);_0x50de8b['attributes']=_[_0x71ee('0x33')](_0x56fa0b[_0x71ee('0x2f')],qs[_0x71ee('0x34')](_0x419a6d[_0x71ee('0x30')][_0x71ee('0x34')]));_0x50de8b[_0x71ee('0x35')]=_0x50de8b[_0x71ee('0x35')]['length']?_0x50de8b[_0x71ee('0x35')]:_0x56fa0b[_0x71ee('0x2f')];if(!_0x419a6d[_0x71ee('0x30')]['hasOwnProperty'](_0x71ee('0x36'))){_0x50de8b[_0x71ee('0x1c')]=qs[_0x71ee('0x1c')](_0x419a6d['query'][_0x71ee('0x1c')]);_0x50de8b[_0x71ee('0x1b')]=qs[_0x71ee('0x1b')](_0x419a6d[_0x71ee('0x30')][_0x71ee('0x1b')]);}_0x50de8b['order']=qs['sort'](_0x419a6d[_0x71ee('0x30')]['sort']);_0x50de8b[_0x71ee('0x37')]=qs['filters'](_[_0x71ee('0x38')](_0x419a6d['query'],_0x56fa0b[_0x71ee('0x32')]),_0x11d9dd);if(_0x419a6d[_0x71ee('0x30')][_0x71ee('0x39')]){_0x50de8b[_0x71ee('0x37')]=_[_0x71ee('0x3a')](_0x50de8b[_0x71ee('0x37')],{'$or':_[_0x71ee('0x2a')](_0x11d9dd,function(_0x320ebe){if(_0x320ebe[_0x71ee('0x2d')]!==_0x71ee('0x3b')){var _0x3649a1={};_0x3649a1[_0x320ebe[_0x71ee('0x28')]]={'$like':'%'+_0x419a6d[_0x71ee('0x30')][_0x71ee('0x39')]+'%'};return _0x3649a1;}})});}_0x50de8b=_[_0x71ee('0x3a')]({},_0x50de8b,_0x419a6d[_0x71ee('0x3c')]);var _0xfac434={'where':_0x50de8b[_0x71ee('0x37')]};return db[_0x71ee('0x2b')][_0x71ee('0x1e')](_0xfac434)['then'](function(_0x43ebd2){_0x40ddd1[_0x71ee('0x1e')]=_0x43ebd2;if(_0x419a6d[_0x71ee('0x30')]['includeAll']){_0x50de8b['include']=[{'all':!![]}];}return db[_0x71ee('0x2b')][_0x71ee('0x3d')](_0x50de8b);})[_0x71ee('0x24')](function(_0x377deb){_0x40ddd1[_0x71ee('0x3e')]=_0x377deb;return _0x40ddd1;})['then'](respondWithFilteredResult(_0x449433,_0x50de8b))[_0x71ee('0x3f')](handleError(_0x449433,null));};exports[_0x71ee('0x40')]=function(_0x5c84b0,_0x1a1a1f){var _0x5577ec={'raw':![],'where':{'id':_0x5c84b0[_0x71ee('0x41')]['id']}},_0x39e565={};_0x39e565[_0x71ee('0x2f')]=_['keys'](db[_0x71ee('0x2b')]['rawAttributes']);_0x39e565['query']=_[_0x71ee('0x31')](_0x5c84b0['query']);_0x39e565['filters']=_[_0x71ee('0x33')](_0x39e565[_0x71ee('0x2f')],_0x39e565[_0x71ee('0x30')]);_0x5577ec[_0x71ee('0x35')]=_['intersection'](_0x39e565['model'],qs[_0x71ee('0x34')](_0x5c84b0[_0x71ee('0x30')][_0x71ee('0x34')]));_0x5577ec[_0x71ee('0x35')]=_0x5577ec['attributes'][_0x71ee('0x42')]?_0x5577ec[_0x71ee('0x35')]:_0x39e565[_0x71ee('0x2f')];if(_0x5c84b0[_0x71ee('0x30')][_0x71ee('0x43')]){_0x5577ec['include']=[{'all':!![]}];}_0x5577ec=_[_0x71ee('0x3a')]({},_0x5577ec,_0x5c84b0[_0x71ee('0x3c')]);return db['SugarcrmConfiguration'][_0x71ee('0x44')](_0x5577ec)[_0x71ee('0x24')](handleEntityNotFound(_0x1a1a1f,null))[_0x71ee('0x24')](respondWithResult(_0x1a1a1f,null))[_0x71ee('0x3f')](handleError(_0x1a1a1f,null));};exports[_0x71ee('0x45')]=function(_0x204fc5,_0x11d105){return db[_0x71ee('0x2b')]['create'](_0x204fc5[_0x71ee('0x46')],{})['then'](respondWithResult(_0x11d105,0xc9))['catch'](handleError(_0x11d105,null));};exports[_0x71ee('0x23')]=function(_0x56d13b,_0x40e3f8){if(_0x56d13b[_0x71ee('0x46')]['id']){delete _0x56d13b[_0x71ee('0x46')]['id'];}return db[_0x71ee('0x2b')][_0x71ee('0x44')]({'where':{'id':_0x56d13b['params']['id']}})[_0x71ee('0x24')](handleEntityNotFound(_0x40e3f8,null))[_0x71ee('0x24')](saveUpdates(_0x56d13b[_0x71ee('0x46')],null))['then'](respondWithResult(_0x40e3f8,null))[_0x71ee('0x3f')](handleError(_0x40e3f8,null));};exports['destroy']=function(_0x5088dd,_0x4019e5){return db['SugarcrmConfiguration'][_0x71ee('0x44')]({'where':{'id':_0x5088dd[_0x71ee('0x41')]['id']}})[_0x71ee('0x24')](handleEntityNotFound(_0x4019e5,null))[_0x71ee('0x24')](removeEntity(_0x4019e5,null))[_0x71ee('0x3f')](handleError(_0x4019e5,null));};exports[_0x71ee('0x47')]=function(_0x2a86a5,_0x3680ed,_0x1ce913){var _0x50b85d={};var _0x4644cd={};var _0x60094;var _0x1a11cd;return db[_0x71ee('0x2b')][_0x71ee('0x48')]({'where':{'id':_0x2a86a5[_0x71ee('0x41')]['id']}})['then'](handleEntityNotFound(_0x3680ed,null))[_0x71ee('0x24')](function(_0x55c152){if(_0x55c152){_0x60094=_0x55c152;_0x4644cd[_0x71ee('0x2f')]=_[_0x71ee('0x31')](db[_0x71ee('0x49')][_0x71ee('0x4a')]);_0x4644cd['query']=_[_0x71ee('0x31')](_0x2a86a5[_0x71ee('0x30')]);_0x4644cd[_0x71ee('0x32')]=_[_0x71ee('0x33')](_0x4644cd[_0x71ee('0x2f')],_0x4644cd[_0x71ee('0x30')]);_0x50b85d[_0x71ee('0x35')]=_[_0x71ee('0x33')](_0x4644cd[_0x71ee('0x2f')],qs[_0x71ee('0x34')](_0x2a86a5[_0x71ee('0x30')][_0x71ee('0x34')]));_0x50b85d[_0x71ee('0x35')]=_0x50b85d[_0x71ee('0x35')][_0x71ee('0x42')]?_0x50b85d['attributes']:_0x4644cd[_0x71ee('0x2f')];_0x50b85d[_0x71ee('0x4b')]=qs[_0x71ee('0x4c')](_0x2a86a5[_0x71ee('0x30')][_0x71ee('0x4c')]);_0x50b85d[_0x71ee('0x37')]=qs['filters'](_[_0x71ee('0x38')](_0x2a86a5[_0x71ee('0x30')],_0x4644cd[_0x71ee('0x32')]));if(_0x2a86a5['query'][_0x71ee('0x39')]){_0x50b85d['where']=_[_0x71ee('0x3a')](_0x50b85d[_0x71ee('0x37')],{'$or':_['map'](_0x50b85d[_0x71ee('0x35')],function(_0x4b459b){var _0x2433ca={};_0x2433ca[_0x4b459b]={'$like':'%'+_0x2a86a5[_0x71ee('0x30')][_0x71ee('0x39')]+'%'};return _0x2433ca;})});}_0x50b85d=_[_0x71ee('0x3a')]({},_0x50b85d,_0x2a86a5[_0x71ee('0x3c')]);return _0x60094['getFields'](_0x50b85d);}})[_0x71ee('0x24')](function(_0x3846e8){if(_0x3846e8){_0x1a11cd=_0x3846e8[_0x71ee('0x42')];if(!_0x2a86a5[_0x71ee('0x30')]['hasOwnProperty'](_0x71ee('0x36'))){_0x50b85d['limit']=qs[_0x71ee('0x1c')](_0x2a86a5[_0x71ee('0x30')]['limit']);_0x50b85d[_0x71ee('0x1b')]=qs[_0x71ee('0x1b')](_0x2a86a5[_0x71ee('0x30')][_0x71ee('0x1b')]);}return _0x60094[_0x71ee('0x47')](_0x50b85d);}})[_0x71ee('0x24')](function(_0x7f6941){if(_0x7f6941){return _0x7f6941?{'count':_0x1a11cd,'rows':_0x7f6941}:null;}})[_0x71ee('0x24')](respondWithResult(_0x3680ed,null))[_0x71ee('0x3f')](handleError(_0x3680ed,null));};exports[_0x71ee('0x4d')]=function(_0x2d4d93,_0x837e32,_0x35b4f7){var _0x39eba2={};var _0x26a336={};var _0x3a260a;var _0x492cd2;return db[_0x71ee('0x2b')]['findOne']({'where':{'id':_0x2d4d93[_0x71ee('0x41')]['id']}})[_0x71ee('0x24')](handleEntityNotFound(_0x837e32,null))[_0x71ee('0x24')](function(_0x12cd23){if(_0x12cd23){_0x3a260a=_0x12cd23;_0x26a336[_0x71ee('0x2f')]=_[_0x71ee('0x31')](db[_0x71ee('0x49')]['rawAttributes']);_0x26a336[_0x71ee('0x30')]=_[_0x71ee('0x31')](_0x2d4d93[_0x71ee('0x30')]);_0x26a336[_0x71ee('0x32')]=_[_0x71ee('0x33')](_0x26a336[_0x71ee('0x2f')],_0x26a336['query']);_0x39eba2[_0x71ee('0x35')]=_[_0x71ee('0x33')](_0x26a336['model'],qs['fields'](_0x2d4d93[_0x71ee('0x30')][_0x71ee('0x34')]));_0x39eba2[_0x71ee('0x35')]=_0x39eba2[_0x71ee('0x35')][_0x71ee('0x42')]?_0x39eba2[_0x71ee('0x35')]:_0x26a336[_0x71ee('0x2f')];_0x39eba2['order']=qs[_0x71ee('0x4c')](_0x2d4d93['query'][_0x71ee('0x4c')]);_0x39eba2[_0x71ee('0x37')]=qs[_0x71ee('0x32')](_[_0x71ee('0x38')](_0x2d4d93['query'],_0x26a336[_0x71ee('0x32')]));if(_0x2d4d93[_0x71ee('0x30')]['filter']){_0x39eba2[_0x71ee('0x37')]=_['merge'](_0x39eba2[_0x71ee('0x37')],{'$or':_['map'](_0x39eba2['attributes'],function(_0x88e43d){var _0x4d4369={};_0x4d4369[_0x88e43d]={'$like':'%'+_0x2d4d93[_0x71ee('0x30')][_0x71ee('0x39')]+'%'};return _0x4d4369;})});}_0x39eba2=_[_0x71ee('0x3a')]({},_0x39eba2,_0x2d4d93[_0x71ee('0x3c')]);return _0x3a260a['getSubjects'](_0x39eba2);}})['then'](function(_0x4e84af){if(_0x4e84af){_0x492cd2=_0x4e84af[_0x71ee('0x42')];if(!_0x2d4d93[_0x71ee('0x30')]['hasOwnProperty'](_0x71ee('0x36'))){_0x39eba2['limit']=qs[_0x71ee('0x1c')](_0x2d4d93['query'][_0x71ee('0x1c')]);_0x39eba2['offset']=qs[_0x71ee('0x1b')](_0x2d4d93[_0x71ee('0x30')]['offset']);}return _0x3a260a['getSubjects'](_0x39eba2);}})['then'](function(_0x44b6cc){if(_0x44b6cc){return _0x44b6cc?{'count':_0x492cd2,'rows':_0x44b6cc}:null;}})['then'](respondWithResult(_0x837e32,null))[_0x71ee('0x3f')](handleError(_0x837e32,null));};exports[_0x71ee('0x4e')]=function(_0x3c9af4,_0x16cbec,_0x48bf53){var _0x459a3d={};var _0x29240c={};var _0x5c7c65;var _0x222b52;return db[_0x71ee('0x2b')][_0x71ee('0x48')]({'where':{'id':_0x3c9af4[_0x71ee('0x41')]['id']}})[_0x71ee('0x24')](handleEntityNotFound(_0x16cbec,null))['then'](function(_0x28c2c1){if(_0x28c2c1){_0x5c7c65=_0x28c2c1;_0x29240c[_0x71ee('0x2f')]=_[_0x71ee('0x31')](db['SugarcrmField']['rawAttributes']);_0x29240c[_0x71ee('0x30')]=_[_0x71ee('0x31')](_0x3c9af4[_0x71ee('0x30')]);_0x29240c[_0x71ee('0x32')]=_[_0x71ee('0x33')](_0x29240c[_0x71ee('0x2f')],_0x29240c[_0x71ee('0x30')]);_0x459a3d['attributes']=_[_0x71ee('0x33')](_0x29240c['model'],qs[_0x71ee('0x34')](_0x3c9af4['query'][_0x71ee('0x34')]));_0x459a3d[_0x71ee('0x35')]=_0x459a3d['attributes']['length']?_0x459a3d[_0x71ee('0x35')]:_0x29240c['model'];_0x459a3d[_0x71ee('0x4b')]=qs['sort'](_0x3c9af4[_0x71ee('0x30')]['sort']);_0x459a3d[_0x71ee('0x37')]=qs[_0x71ee('0x32')](_[_0x71ee('0x38')](_0x3c9af4[_0x71ee('0x30')],_0x29240c[_0x71ee('0x32')]));if(_0x3c9af4[_0x71ee('0x30')]['filter']){_0x459a3d[_0x71ee('0x37')]=_['merge'](_0x459a3d[_0x71ee('0x37')],{'$or':_[_0x71ee('0x2a')](_0x459a3d[_0x71ee('0x35')],function(_0x47e1ea){var _0x423152={};_0x423152[_0x47e1ea]={'$like':'%'+_0x3c9af4[_0x71ee('0x30')][_0x71ee('0x39')]+'%'};return _0x423152;})});}_0x459a3d=_[_0x71ee('0x3a')]({},_0x459a3d,_0x3c9af4['options']);return _0x5c7c65['getDescriptions'](_0x459a3d);}})[_0x71ee('0x24')](function(_0x1bdb9b){if(_0x1bdb9b){_0x222b52=_0x1bdb9b['length'];if(!_0x3c9af4[_0x71ee('0x30')][_0x71ee('0x4f')](_0x71ee('0x36'))){_0x459a3d[_0x71ee('0x1c')]=qs[_0x71ee('0x1c')](_0x3c9af4[_0x71ee('0x30')][_0x71ee('0x1c')]);_0x459a3d[_0x71ee('0x1b')]=qs['offset'](_0x3c9af4['query']['offset']);}return _0x5c7c65[_0x71ee('0x4e')](_0x459a3d);}})[_0x71ee('0x24')](function(_0x25ce68){if(_0x25ce68){return _0x25ce68?{'count':_0x222b52,'rows':_0x25ce68}:null;}})[_0x71ee('0x24')](respondWithResult(_0x16cbec,null))[_0x71ee('0x3f')](handleError(_0x16cbec,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 87ef9d9..671dfb6 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 _0xe454=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','SugarcrmConfiguration','int_sugarcrm_configurations','../../config/logger'];(function(_0x52534c,_0x283ffa){var _0x23a7e2=function(_0x224c8e){while(--_0x224c8e){_0x52534c['push'](_0x52534c['shift']());}};_0x23a7e2(++_0x283ffa);}(_0xe454,0xba));var _0x4e45=function(_0x572d37,_0x1b4a02){_0x572d37=_0x572d37-0x0;var _0x10a0fc=_0xe454[_0x572d37];return _0x10a0fc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4e45('0x0'))(_0x4e45('0x1'));var moment=require(_0x4e45('0x2'));var BPromise=require(_0x4e45('0x3'));var rp=require(_0x4e45('0x4'));var fs=require('fs');var path=require(_0x4e45('0x5'));var rimraf=require(_0x4e45('0x6'));var config=require(_0x4e45('0x7'));var attributes=require(_0x4e45('0x8'));module['exports']=function(_0x1eba60,_0x470d82){return _0x1eba60['define'](_0x4e45('0x9'),attributes,{'tableName':_0x4e45('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d92=['define','SugarcrmConfiguration','int_sugarcrm_configurations','util','api','bluebird','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports'];(function(_0x493655,_0xcae32b){var _0x2aa89d=function(_0x2b1b1a){while(--_0x2b1b1a){_0x493655['push'](_0x493655['shift']());}};_0x2aa89d(++_0xcae32b);}(_0x1d92,0x158));var _0x21d9=function(_0x4ec911,_0x3534a0){_0x4ec911=_0x4ec911-0x0;var _0x13ab51=_0x1d92[_0x4ec911];return _0x13ab51;};'use strict';var _=require('lodash');var util=require(_0x21d9('0x0'));var logger=require('../../config/logger')(_0x21d9('0x1'));var moment=require('moment');var BPromise=require(_0x21d9('0x2'));var rp=require(_0x21d9('0x3'));var fs=require('fs');var path=require(_0x21d9('0x4'));var rimraf=require('rimraf');var config=require(_0x21d9('0x5'));var attributes=require(_0x21d9('0x6'));module[_0x21d9('0x7')]=function(_0x4d5ed3,_0x3e403e){return _0x4d5ed3[_0x21d9('0x8')](_0x21d9('0x9'),attributes,{'tableName':_0x21d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 844767d..1beab07 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 _0xa005=['client','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x1cf85d,_0x46f14c){var _0x663a56=function(_0x23587c){while(--_0x23587c){_0x1cf85d['push'](_0x1cf85d['shift']());}};_0x663a56(++_0x46f14c);}(_0xa005,0x1e5));var _0x5a00=function(_0xb5fc3e,_0x234703){_0xb5fc3e=_0xb5fc3e-0x0;var _0x2efc3c=_0xa005[_0xb5fc3e];return _0x2efc3c;};'use strict';var _=require(_0x5a00('0x0'));var util=require(_0x5a00('0x1'));var moment=require(_0x5a00('0x2'));var BPromise=require(_0x5a00('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a00('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a00('0x5'));var logger=require('../../config/logger')(_0x5a00('0x6'));var config=require('../../config/environment');var jayson=require(_0x5a00('0x7'));var client=jayson[_0x5a00('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42259d,_0x3a9f3e,_0x33340a){return new BPromise(function(_0x49d877,_0x54ab55){return client['request'](_0x42259d,_0x33340a)['then'](function(_0x2a120a){logger[_0x5a00('0x9')](_0x5a00('0xa'),_0x3a9f3e,_0x5a00('0xb'));logger[_0x5a00('0xc')](_0x5a00('0xd'),_0x3a9f3e,_0x5a00('0xb'),JSON[_0x5a00('0xe')](_0x2a120a));if(_0x2a120a['error']){if(_0x2a120a[_0x5a00('0xf')]['code']===0x1f4){logger[_0x5a00('0xf')](_0x5a00('0xa'),_0x3a9f3e,_0x2a120a[_0x5a00('0xf')][_0x5a00('0x10')]);return _0x54ab55(_0x2a120a[_0x5a00('0xf')][_0x5a00('0x10')]);}logger[_0x5a00('0xf')](_0x5a00('0xa'),_0x3a9f3e,_0x2a120a['error'][_0x5a00('0x10')]);return _0x49d877(_0x2a120a[_0x5a00('0xf')][_0x5a00('0x10')]);}else{logger['info'](_0x5a00('0xa'),_0x3a9f3e,'request\x20sent');_0x49d877(_0x2a120a['result']['message']);}})['catch'](function(_0x4991ab){logger[_0x5a00('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3a9f3e,_0x4991ab);_0x54ab55(_0x4991ab);});});} \ No newline at end of file +var _0x14c6=['catch','lodash','util','moment','bluebird','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x7244c1,_0x54c305){var _0x337d8e=function(_0x341900){while(--_0x341900){_0x7244c1['push'](_0x7244c1['shift']());}};_0x337d8e(++_0x54c305);}(_0x14c6,0x6a));var _0x614c=function(_0x1ecd26,_0x34941b){_0x1ecd26=_0x1ecd26-0x0;var _0x589e56=_0x14c6[_0x1ecd26];return _0x589e56;};'use strict';var _=require(_0x614c('0x0'));var util=require(_0x614c('0x1'));var moment=require(_0x614c('0x2'));var BPromise=require(_0x614c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x614c('0x4'))('rpc');var config=require(_0x614c('0x5'));var jayson=require(_0x614c('0x6'));var client=jayson[_0x614c('0x7')][_0x614c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39c96b,_0xf58c5a,_0x4f680b){return new BPromise(function(_0x276703,_0x3b7243){return client[_0x614c('0x9')](_0x39c96b,_0x4f680b)[_0x614c('0xa')](function(_0xf73c60){logger[_0x614c('0xb')](_0x614c('0xc'),_0xf58c5a,_0x614c('0xd'));logger[_0x614c('0xe')](_0x614c('0xf'),_0xf58c5a,'request\x20sent',JSON[_0x614c('0x10')](_0xf73c60));if(_0xf73c60[_0x614c('0x11')]){if(_0xf73c60[_0x614c('0x11')]['code']===0x1f4){logger[_0x614c('0x11')](_0x614c('0xc'),_0xf58c5a,_0xf73c60[_0x614c('0x11')]['message']);return _0x3b7243(_0xf73c60['error']['message']);}logger[_0x614c('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xf58c5a,_0xf73c60[_0x614c('0x11')][_0x614c('0x12')]);return _0x276703(_0xf73c60['error']['message']);}else{logger['info'](_0x614c('0xc'),_0xf58c5a,_0x614c('0xd'));_0x276703(_0xf73c60[_0x614c('0x13')][_0x614c('0x12')]);}})[_0x614c('0x14')](function(_0x172531){logger[_0x614c('0x11')](_0x614c('0xc'),_0xf58c5a,_0x172531);_0x3b7243(_0x172531);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index cc0395a..f383434 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 _0x34a4=['index','/:id','show','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0x2803fa,_0x1fe79e){var _0x2f2a6c=function(_0x2c945d){while(--_0x2c945d){_0x2803fa['push'](_0x2803fa['shift']());}};_0x2f2a6c(++_0x1fe79e);}(_0x34a4,0xe3));var _0x434a=function(_0x49da7c,_0x449131){_0x49da7c=_0x49da7c-0x0;var _0x5b6908=_0x34a4[_0x49da7c];return _0x5b6908;};'use strict';var multer=require(_0x434a('0x0'));var util=require(_0x434a('0x1'));var path=require(_0x434a('0x2'));var timeout=require(_0x434a('0x3'));var express=require(_0x434a('0x4'));var router=express[_0x434a('0x5')]();var fs_extra=require(_0x434a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x434a('0x7'));var config=require('../../config/environment');var controller=require(_0x434a('0x8'));router[_0x434a('0x9')]('/',auth[_0x434a('0xa')](),controller[_0x434a('0xb')]);router[_0x434a('0x9')](_0x434a('0xc'),auth['isAuthenticated'](),controller[_0x434a('0xd')]);router['post']('/',auth[_0x434a('0xa')](),controller['create']);router[_0x434a('0xe')](_0x434a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x434a('0xf')](_0x434a('0xc'),auth['isAuthenticated'](),controller[_0x434a('0x10')]);module['exports']=router; \ No newline at end of file +var _0xca66=['show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x4a6e98,_0x25fc9d){var _0xa35324=function(_0x565fea){while(--_0x565fea){_0x4a6e98['push'](_0x4a6e98['shift']());}};_0xa35324(++_0x25fc9d);}(_0xca66,0xea));var _0x6ca6=function(_0x44bd2e,_0x13db86){_0x44bd2e=_0x44bd2e-0x0;var _0x11857b=_0xca66[_0x44bd2e];return _0x11857b;};'use strict';var multer=require(_0x6ca6('0x0'));var util=require(_0x6ca6('0x1'));var path=require(_0x6ca6('0x2'));var timeout=require(_0x6ca6('0x3'));var express=require(_0x6ca6('0x4'));var router=express[_0x6ca6('0x5')]();var fs_extra=require(_0x6ca6('0x6'));var auth=require(_0x6ca6('0x7'));var interaction=require(_0x6ca6('0x8'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0x6ca6('0x9')]('/',auth[_0x6ca6('0xa')](),controller[_0x6ca6('0xb')]);router[_0x6ca6('0x9')](_0x6ca6('0xc'),auth[_0x6ca6('0xa')](),controller[_0x6ca6('0xd')]);router[_0x6ca6('0xe')]('/',auth[_0x6ca6('0xa')](),controller['create']);router['put'](_0x6ca6('0xc'),auth['isAuthenticated'](),controller[_0x6ca6('0xf')]);router[_0x6ca6('0x10')](_0x6ca6('0xc'),auth[_0x6ca6('0xa')](),controller[_0x6ca6('0x11')]);module[_0x6ca6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index dca4ab2..ba87789 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 _0xde29=['variable','customVariable','BOOLEAN','sequelize','exports','ENUM','STRING'];(function(_0x443439,_0x415fab){var _0x404464=function(_0x517a02){while(--_0x517a02){_0x443439['push'](_0x443439['shift']());}};_0x404464(++_0x415fab);}(_0xde29,0x1f4));var _0x9de2=function(_0x487eca,_0x400dd4){_0x487eca=_0x487eca-0x0;var _0x28865d=_0xde29[_0x487eca];return _0x28865d;};'use strict';var Sequelize=require(_0x9de2('0x0'));module[_0x9de2('0x1')]={'type':{'type':Sequelize[_0x9de2('0x2')]('string','variable','customVariable','keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x9de2('0x3')]},'key':{'type':Sequelize[_0x9de2('0x3')]},'keyType':{'type':Sequelize[_0x9de2('0x2')]('string',_0x9de2('0x4'),_0x9de2('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9de2('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9de2('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9de2('0x3')]}}; \ No newline at end of file +var _0x6396=['variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','string'];(function(_0x4ff417,_0x11f0ed){var _0x57a243=function(_0x33a827){while(--_0x33a827){_0x4ff417['push'](_0x4ff417['shift']());}};_0x57a243(++_0x11f0ed);}(_0x6396,0xfe));var _0x6639=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0x6396[_0x188a93];return _0x23b40d;};'use strict';var Sequelize=require(_0x6639('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x6639('0x1'),_0x6639('0x2'),_0x6639('0x3'),_0x6639('0x4'),'picklist'),'defaultValue':_0x6639('0x1')},'content':{'type':Sequelize[_0x6639('0x5')]},'key':{'type':Sequelize[_0x6639('0x5')]},'keyType':{'type':Sequelize[_0x6639('0x6')](_0x6639('0x1'),_0x6639('0x2'),_0x6639('0x3'))},'keyContent':{'type':Sequelize[_0x6639('0x5')]},'idField':{'type':Sequelize[_0x6639('0x5')]},'nameField':{'type':Sequelize[_0x6639('0x5')]},'customField':{'type':Sequelize[_0x6639('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6639('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c3a2ca5..6ec2d98 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 _0x8ca8=['intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','SugarcrmField','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','then','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','reject','save','update','destroy','stack','name','map','type','key','model','query','keys','filters','attributes'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x8ca8,0xac));var _0x88ca=function(_0x335e2e,_0x33b29c){_0x335e2e=_0x335e2e-0x0;var _0x4ae9e1=_0x8ca8[_0x335e2e];return _0x4ae9e1;};'use strict';var emlformat=require(_0x88ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x88ca('0x1'));var jsonpatch=require(_0x88ca('0x2'));var rp=require(_0x88ca('0x3'));var moment=require(_0x88ca('0x4'));var BPromise=require(_0x88ca('0x5'));var Mustache=require(_0x88ca('0x6'));var util=require(_0x88ca('0x7'));var path=require(_0x88ca('0x8'));var sox=require('sox');var csv=require(_0x88ca('0x9'));var ejs=require(_0x88ca('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88ca('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x88ca('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x88ca('0xd'));var Redis=require(_0x88ca('0xe'));var authService=require(_0x88ca('0xf'));var qs=require(_0x88ca('0x10'));var as=require(_0x88ca('0x11'));var hardwareService=require(_0x88ca('0x12'));var logger=require('../../config/logger')(_0x88ca('0x13'));var utils=require(_0x88ca('0x14'));var config=require(_0x88ca('0x15'));var licenseUtil=require(_0x88ca('0x16'));var db=require(_0x88ca('0x17'))['db'];function respondWithStatusCode(_0x883552,_0x551043){_0x551043=_0x551043||0xcc;return function(_0x3f66ff){if(_0x3f66ff){return _0x883552[_0x88ca('0x18')](_0x551043);}return _0x883552['status'](_0x551043)[_0x88ca('0x19')]();};}function respondWithResult(_0x49ce8f,_0x2fe319){_0x2fe319=_0x2fe319||0xc8;return function(_0x4e63f){if(_0x4e63f){return _0x49ce8f[_0x88ca('0x1a')](_0x2fe319)['json'](_0x4e63f);}};}function respondWithFilteredResult(_0x4ec9b0,_0x33c0fd){return function(_0x3189fc){if(_0x3189fc){var _0x1d20a0=typeof _0x33c0fd[_0x88ca('0x1b')]==='undefined'&&typeof _0x33c0fd['limit']===_0x88ca('0x1c');var _0x2cb088=_0x3189fc[_0x88ca('0x1d')];var _0x4878bd=_0x1d20a0?0x0:_0x33c0fd[_0x88ca('0x1b')];var _0x182a9d=_0x1d20a0?_0x3189fc[_0x88ca('0x1d')]:_0x33c0fd[_0x88ca('0x1b')]+_0x33c0fd['limit'];var _0xe1dd8a;if(_0x182a9d>=_0x2cb088){_0x182a9d=_0x2cb088;_0xe1dd8a=0xc8;}else{_0xe1dd8a=0xce;}_0x4ec9b0[_0x88ca('0x1a')](_0xe1dd8a);return _0x4ec9b0[_0x88ca('0x1e')](_0x88ca('0x1f'),_0x4878bd+'-'+_0x182a9d+'/'+_0x2cb088)[_0x88ca('0x20')](_0x3189fc);}return null;};}function patchUpdates(_0xf76080){return function(_0x2e361a){try{jsonpatch['apply'](_0x2e361a,_0xf76080,!![]);}catch(_0x34bf84){return BPromise[_0x88ca('0x21')](_0x34bf84);}return _0x2e361a[_0x88ca('0x22')]();};}function saveUpdates(_0x52f7b0,_0xbfad89){return function(_0x533fde){if(_0x533fde){return _0x533fde[_0x88ca('0x23')](_0x52f7b0)['then'](function(_0x54a20a){return _0x54a20a;});}return null;};}function removeEntity(_0x4b3d63,_0x53e405){return function(_0x20e63a){if(_0x20e63a){return _0x20e63a[_0x88ca('0x24')]()['then'](function(){_0x4b3d63[_0x88ca('0x1a')](0xcc)[_0x88ca('0x19')]();});}};}function handleEntityNotFound(_0x15be57,_0x227d6e){return function(_0x138ea8){if(!_0x138ea8){_0x15be57[_0x88ca('0x18')](0x194);}return _0x138ea8;};}function handleError(_0x313cd6,_0x579a83){_0x579a83=_0x579a83||0x1f4;return function(_0x35ea3f){logger['error'](_0x35ea3f[_0x88ca('0x25')]);if(_0x35ea3f[_0x88ca('0x26')]){delete _0x35ea3f[_0x88ca('0x26')];}_0x313cd6['status'](_0x579a83)['send'](_0x35ea3f);};}exports['index']=function(_0x45f982,_0x4fc202){var _0x1cb57a={},_0x3bb146={},_0xe4fb0c={'count':0x0,'rows':[]};var _0x2cfb7f=_[_0x88ca('0x27')](db['SugarcrmField']['rawAttributes'],function(_0x4a81c2){return{'name':_0x4a81c2['fieldName'],'type':_0x4a81c2[_0x88ca('0x28')][_0x88ca('0x29')]};});_0x3bb146[_0x88ca('0x2a')]=_[_0x88ca('0x27')](_0x2cfb7f,_0x88ca('0x26'));_0x3bb146[_0x88ca('0x2b')]=_[_0x88ca('0x2c')](_0x45f982[_0x88ca('0x2b')]);_0x3bb146[_0x88ca('0x2d')]=_['intersection'](_0x3bb146[_0x88ca('0x2a')],_0x3bb146[_0x88ca('0x2b')]);_0x1cb57a[_0x88ca('0x2e')]=_[_0x88ca('0x2f')](_0x3bb146['model'],qs[_0x88ca('0x30')](_0x45f982['query'][_0x88ca('0x30')]));_0x1cb57a[_0x88ca('0x2e')]=_0x1cb57a[_0x88ca('0x2e')]['length']?_0x1cb57a[_0x88ca('0x2e')]:_0x3bb146[_0x88ca('0x2a')];if(!_0x45f982[_0x88ca('0x2b')][_0x88ca('0x31')](_0x88ca('0x32'))){_0x1cb57a[_0x88ca('0x33')]=qs[_0x88ca('0x33')](_0x45f982[_0x88ca('0x2b')][_0x88ca('0x33')]);_0x1cb57a[_0x88ca('0x1b')]=qs['offset'](_0x45f982[_0x88ca('0x2b')][_0x88ca('0x1b')]);}_0x1cb57a[_0x88ca('0x34')]=qs[_0x88ca('0x35')](_0x45f982[_0x88ca('0x2b')][_0x88ca('0x35')]);_0x1cb57a['where']=qs['filters'](_[_0x88ca('0x36')](_0x45f982[_0x88ca('0x2b')],_0x3bb146['filters']),_0x2cfb7f);if(_0x45f982[_0x88ca('0x2b')][_0x88ca('0x37')]){_0x1cb57a[_0x88ca('0x38')]=_[_0x88ca('0x39')](_0x1cb57a[_0x88ca('0x38')],{'$or':_['map'](_0x2cfb7f,function(_0x155c4c){if(_0x155c4c[_0x88ca('0x28')]!=='VIRTUAL'){var _0x39979a={};_0x39979a[_0x155c4c[_0x88ca('0x26')]]={'$like':'%'+_0x45f982[_0x88ca('0x2b')][_0x88ca('0x37')]+'%'};return _0x39979a;}})});}_0x1cb57a=_[_0x88ca('0x39')]({},_0x1cb57a,_0x45f982[_0x88ca('0x3a')]);var _0x3d98a5={'where':_0x1cb57a[_0x88ca('0x38')]};return db[_0x88ca('0x3b')]['count'](_0x3d98a5)['then'](function(_0x4dbe56){_0xe4fb0c[_0x88ca('0x1d')]=_0x4dbe56;if(_0x45f982[_0x88ca('0x2b')][_0x88ca('0x3c')]){_0x1cb57a[_0x88ca('0x3d')]=[{'all':!![]}];}return db[_0x88ca('0x3b')][_0x88ca('0x3e')](_0x1cb57a);})['then'](function(_0x52f3c1){_0xe4fb0c[_0x88ca('0x3f')]=_0x52f3c1;return _0xe4fb0c;})['then'](respondWithFilteredResult(_0x4fc202,_0x1cb57a))[_0x88ca('0x40')](handleError(_0x4fc202,null));};exports[_0x88ca('0x41')]=function(_0x403e5f,_0x5af0ba){var _0x202e2={'raw':!![],'where':{'id':_0x403e5f[_0x88ca('0x42')]['id']}},_0x3289ce={};_0x3289ce['model']=_['keys'](db[_0x88ca('0x3b')][_0x88ca('0x43')]);_0x3289ce[_0x88ca('0x2b')]=_['keys'](_0x403e5f[_0x88ca('0x2b')]);_0x3289ce[_0x88ca('0x2d')]=_[_0x88ca('0x2f')](_0x3289ce['model'],_0x3289ce['query']);_0x202e2['attributes']=_[_0x88ca('0x2f')](_0x3289ce[_0x88ca('0x2a')],qs[_0x88ca('0x30')](_0x403e5f[_0x88ca('0x2b')][_0x88ca('0x30')]));_0x202e2[_0x88ca('0x2e')]=_0x202e2['attributes'][_0x88ca('0x44')]?_0x202e2[_0x88ca('0x2e')]:_0x3289ce['model'];if(_0x403e5f[_0x88ca('0x2b')][_0x88ca('0x3c')]){_0x202e2['include']=[{'all':!![]}];}_0x202e2=_['merge']({},_0x202e2,_0x403e5f[_0x88ca('0x3a')]);return db[_0x88ca('0x3b')][_0x88ca('0x45')](_0x202e2)[_0x88ca('0x46')](handleEntityNotFound(_0x5af0ba,null))[_0x88ca('0x46')](respondWithResult(_0x5af0ba,null))[_0x88ca('0x40')](handleError(_0x5af0ba,null));};exports[_0x88ca('0x47')]=function(_0x5347c2,_0x48e39f){return db[_0x88ca('0x3b')][_0x88ca('0x47')](_0x5347c2[_0x88ca('0x48')],{})[_0x88ca('0x46')](respondWithResult(_0x48e39f,0xc9))[_0x88ca('0x40')](handleError(_0x48e39f,null));};exports[_0x88ca('0x23')]=function(_0x191ce2,_0x425e61){if(_0x191ce2[_0x88ca('0x48')]['id']){delete _0x191ce2[_0x88ca('0x48')]['id'];}return db[_0x88ca('0x3b')][_0x88ca('0x45')]({'where':{'id':_0x191ce2[_0x88ca('0x42')]['id']}})[_0x88ca('0x46')](handleEntityNotFound(_0x425e61,null))[_0x88ca('0x46')](saveUpdates(_0x191ce2['body'],null))[_0x88ca('0x46')](respondWithResult(_0x425e61,null))[_0x88ca('0x40')](handleError(_0x425e61,null));};exports['destroy']=function(_0x34a1dc,_0x28c7c1){return db[_0x88ca('0x3b')][_0x88ca('0x45')]({'where':{'id':_0x34a1dc['params']['id']}})[_0x88ca('0x46')](handleEntityNotFound(_0x28c7c1,null))[_0x88ca('0x46')](removeEntity(_0x28c7c1,null))[_0x88ca('0x40')](handleError(_0x28c7c1,null));}; \ No newline at end of file +var _0x76c8=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmField','includeAll','include','findAll','catch','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x76c8,0x114));var _0x876c=function(_0x594ef7,_0x2172c9){_0x594ef7=_0x594ef7-0x0;var _0x67df2a=_0x76c8[_0x594ef7];return _0x67df2a;};'use strict';var emlformat=require(_0x876c('0x0'));var rimraf=require(_0x876c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x876c('0x2'));var rp=require(_0x876c('0x3'));var moment=require(_0x876c('0x4'));var BPromise=require(_0x876c('0x5'));var Mustache=require(_0x876c('0x6'));var util=require(_0x876c('0x7'));var path=require(_0x876c('0x8'));var sox=require(_0x876c('0x9'));var csv=require(_0x876c('0xa'));var ejs=require(_0x876c('0xb'));var fs=require('fs');var fs_extra=require(_0x876c('0xc'));var _=require(_0x876c('0xd'));var squel=require(_0x876c('0xe'));var crypto=require('crypto');var jsforce=require(_0x876c('0xf'));var deskjs=require(_0x876c('0x10'));var toCsv=require(_0x876c('0xa'));var querystring=require(_0x876c('0x11'));var Papa=require(_0x876c('0x12'));var Redis=require(_0x876c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x876c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x876c('0x15'));var logger=require('../../config/logger')(_0x876c('0x16'));var utils=require(_0x876c('0x17'));var config=require(_0x876c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x876c('0x19'))['db'];function respondWithStatusCode(_0x17a244,_0xe4fccb){_0xe4fccb=_0xe4fccb||0xcc;return function(_0x35ed2a){if(_0x35ed2a){return _0x17a244[_0x876c('0x1a')](_0xe4fccb);}return _0x17a244[_0x876c('0x1b')](_0xe4fccb)[_0x876c('0x1c')]();};}function respondWithResult(_0x192520,_0x467b78){_0x467b78=_0x467b78||0xc8;return function(_0x520553){if(_0x520553){return _0x192520[_0x876c('0x1b')](_0x467b78)[_0x876c('0x1d')](_0x520553);}};}function respondWithFilteredResult(_0x25f949,_0x541313){return function(_0x30bce6){if(_0x30bce6){var _0x58f8a8=typeof _0x541313[_0x876c('0x1e')]==='undefined'&&typeof _0x541313[_0x876c('0x1f')]===_0x876c('0x20');var _0x3a5fdb=_0x30bce6['count'];var _0x54a43f=_0x58f8a8?0x0:_0x541313['offset'];var _0x2be67c=_0x58f8a8?_0x30bce6['count']:_0x541313[_0x876c('0x1e')]+_0x541313[_0x876c('0x1f')];var _0x266f37;if(_0x2be67c>=_0x3a5fdb){_0x2be67c=_0x3a5fdb;_0x266f37=0xc8;}else{_0x266f37=0xce;}_0x25f949[_0x876c('0x1b')](_0x266f37);return _0x25f949['set']('Content-Range',_0x54a43f+'-'+_0x2be67c+'/'+_0x3a5fdb)[_0x876c('0x1d')](_0x30bce6);}return null;};}function patchUpdates(_0x64c0ed){return function(_0x5c2aeb){try{jsonpatch[_0x876c('0x21')](_0x5c2aeb,_0x64c0ed,!![]);}catch(_0x2522b7){return BPromise[_0x876c('0x22')](_0x2522b7);}return _0x5c2aeb[_0x876c('0x23')]();};}function saveUpdates(_0x397a4e,_0x5debc2){return function(_0x5a3275){if(_0x5a3275){return _0x5a3275[_0x876c('0x24')](_0x397a4e)[_0x876c('0x25')](function(_0xa9ed47){return _0xa9ed47;});}return null;};}function removeEntity(_0x3736e1,_0x72a51c){return function(_0x3beadc){if(_0x3beadc){return _0x3beadc[_0x876c('0x26')]()[_0x876c('0x25')](function(){_0x3736e1[_0x876c('0x1b')](0xcc)[_0x876c('0x1c')]();});}};}function handleEntityNotFound(_0x588e58,_0x4f4267){return function(_0x14f0f5){if(!_0x14f0f5){_0x588e58['sendStatus'](0x194);}return _0x14f0f5;};}function handleError(_0x4f2b9e,_0x1c1ca1){_0x1c1ca1=_0x1c1ca1||0x1f4;return function(_0x113f6e){logger[_0x876c('0x27')](_0x113f6e[_0x876c('0x28')]);if(_0x113f6e[_0x876c('0x29')]){delete _0x113f6e[_0x876c('0x29')];}_0x4f2b9e[_0x876c('0x1b')](_0x1c1ca1)[_0x876c('0x2a')](_0x113f6e);};}exports[_0x876c('0x2b')]=function(_0x3c7717,_0x5610d7){var _0x3ae4f1={},_0x249e62={},_0x5cfe99={'count':0x0,'rows':[]};var _0x3fab58=_['map'](db['SugarcrmField'][_0x876c('0x2c')],function(_0x54cc6e){return{'name':_0x54cc6e[_0x876c('0x2d')],'type':_0x54cc6e[_0x876c('0x2e')]['key']};});_0x249e62[_0x876c('0x2f')]=_[_0x876c('0x30')](_0x3fab58,_0x876c('0x29'));_0x249e62[_0x876c('0x31')]=_[_0x876c('0x32')](_0x3c7717['query']);_0x249e62[_0x876c('0x33')]=_[_0x876c('0x34')](_0x249e62[_0x876c('0x2f')],_0x249e62[_0x876c('0x31')]);_0x3ae4f1[_0x876c('0x35')]=_['intersection'](_0x249e62['model'],qs[_0x876c('0x36')](_0x3c7717[_0x876c('0x31')]['fields']));_0x3ae4f1[_0x876c('0x35')]=_0x3ae4f1['attributes'][_0x876c('0x37')]?_0x3ae4f1[_0x876c('0x35')]:_0x249e62[_0x876c('0x2f')];if(!_0x3c7717[_0x876c('0x31')][_0x876c('0x38')](_0x876c('0x39'))){_0x3ae4f1['limit']=qs[_0x876c('0x1f')](_0x3c7717['query'][_0x876c('0x1f')]);_0x3ae4f1[_0x876c('0x1e')]=qs[_0x876c('0x1e')](_0x3c7717['query'][_0x876c('0x1e')]);}_0x3ae4f1[_0x876c('0x3a')]=qs['sort'](_0x3c7717['query'][_0x876c('0x3b')]);_0x3ae4f1[_0x876c('0x3c')]=qs[_0x876c('0x33')](_[_0x876c('0x3d')](_0x3c7717[_0x876c('0x31')],_0x249e62[_0x876c('0x33')]),_0x3fab58);if(_0x3c7717['query'][_0x876c('0x3e')]){_0x3ae4f1['where']=_[_0x876c('0x3f')](_0x3ae4f1['where'],{'$or':_['map'](_0x3fab58,function(_0x719444){if(_0x719444[_0x876c('0x2e')]!==_0x876c('0x40')){var _0x2b8d30={};_0x2b8d30[_0x719444[_0x876c('0x29')]]={'$like':'%'+_0x3c7717[_0x876c('0x31')]['filter']+'%'};return _0x2b8d30;}})});}_0x3ae4f1=_[_0x876c('0x3f')]({},_0x3ae4f1,_0x3c7717[_0x876c('0x41')]);var _0xf5c116={'where':_0x3ae4f1['where']};return db[_0x876c('0x42')]['count'](_0xf5c116)['then'](function(_0x37f15a){_0x5cfe99['count']=_0x37f15a;if(_0x3c7717[_0x876c('0x31')][_0x876c('0x43')]){_0x3ae4f1[_0x876c('0x44')]=[{'all':!![]}];}return db['SugarcrmField'][_0x876c('0x45')](_0x3ae4f1);})['then'](function(_0x2ebde9){_0x5cfe99['rows']=_0x2ebde9;return _0x5cfe99;})[_0x876c('0x25')](respondWithFilteredResult(_0x5610d7,_0x3ae4f1))[_0x876c('0x46')](handleError(_0x5610d7,null));};exports['show']=function(_0x37f988,_0x41081c){var _0x3d5ac0={'raw':!![],'where':{'id':_0x37f988[_0x876c('0x47')]['id']}},_0x5a329c={};_0x5a329c[_0x876c('0x2f')]=_[_0x876c('0x32')](db['SugarcrmField'][_0x876c('0x2c')]);_0x5a329c['query']=_[_0x876c('0x32')](_0x37f988[_0x876c('0x31')]);_0x5a329c[_0x876c('0x33')]=_[_0x876c('0x34')](_0x5a329c[_0x876c('0x2f')],_0x5a329c[_0x876c('0x31')]);_0x3d5ac0[_0x876c('0x35')]=_['intersection'](_0x5a329c['model'],qs[_0x876c('0x36')](_0x37f988[_0x876c('0x31')][_0x876c('0x36')]));_0x3d5ac0['attributes']=_0x3d5ac0[_0x876c('0x35')]['length']?_0x3d5ac0[_0x876c('0x35')]:_0x5a329c[_0x876c('0x2f')];if(_0x37f988['query'][_0x876c('0x43')]){_0x3d5ac0[_0x876c('0x44')]=[{'all':!![]}];}_0x3d5ac0=_['merge']({},_0x3d5ac0,_0x37f988[_0x876c('0x41')]);return db['SugarcrmField'][_0x876c('0x48')](_0x3d5ac0)[_0x876c('0x25')](handleEntityNotFound(_0x41081c,null))[_0x876c('0x25')](respondWithResult(_0x41081c,null))['catch'](handleError(_0x41081c,null));};exports[_0x876c('0x49')]=function(_0x176ecf,_0x36709d){return db[_0x876c('0x42')]['create'](_0x176ecf[_0x876c('0x4a')],{})['then'](respondWithResult(_0x36709d,0xc9))['catch'](handleError(_0x36709d,null));};exports[_0x876c('0x24')]=function(_0xe38184,_0x21a9c4){if(_0xe38184[_0x876c('0x4a')]['id']){delete _0xe38184['body']['id'];}return db[_0x876c('0x42')][_0x876c('0x48')]({'where':{'id':_0xe38184[_0x876c('0x47')]['id']}})[_0x876c('0x25')](handleEntityNotFound(_0x21a9c4,null))[_0x876c('0x25')](saveUpdates(_0xe38184['body'],null))[_0x876c('0x25')](respondWithResult(_0x21a9c4,null))['catch'](handleError(_0x21a9c4,null));};exports[_0x876c('0x26')]=function(_0x1a7f38,_0x5ee055){return db['SugarcrmField'][_0x876c('0x48')]({'where':{'id':_0x1a7f38[_0x876c('0x47')]['id']}})[_0x876c('0x25')](handleEntityNotFound(_0x5ee055,null))[_0x876c('0x25')](removeEntity(_0x5ee055,null))[_0x876c('0x46')](handleError(_0x5ee055,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index c62b5f1..ae53ecf 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 _0xfa58=['path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1de4ca,_0x3d951d){var _0x1290fb=function(_0x215f72){while(--_0x215f72){_0x1de4ca['push'](_0x1de4ca['shift']());}};_0x1290fb(++_0x3d951d);}(_0xfa58,0xb4));var _0x8fa5=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0xfa58[_0x1f5a63];return _0x30bb7a;};'use strict';var _=require(_0x8fa5('0x0'));var util=require(_0x8fa5('0x1'));var logger=require(_0x8fa5('0x2'))(_0x8fa5('0x3'));var moment=require(_0x8fa5('0x4'));var BPromise=require(_0x8fa5('0x5'));var rp=require(_0x8fa5('0x6'));var fs=require('fs');var path=require(_0x8fa5('0x7'));var rimraf=require(_0x8fa5('0x8'));var config=require(_0x8fa5('0x9'));var attributes=require(_0x8fa5('0xa'));module[_0x8fa5('0xb')]=function(_0x3f1138,_0x2406f8){return _0x3f1138[_0x8fa5('0xc')](_0x8fa5('0xd'),attributes,{'tableName':_0x8fa5('0xe'),'paranoid':![],'indexes':[{'name':_0x8fa5('0xf'),'fields':[_0x8fa5('0x10'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9aba=['moment','request-promise','path','rimraf','./intSugarcrmField.attributes','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0xcf581b,_0x4359dd){var _0x4f454d=function(_0x182d58){while(--_0x182d58){_0xcf581b['push'](_0xcf581b['shift']());}};_0x4f454d(++_0x4359dd);}(_0x9aba,0xce));var _0xa9ab=function(_0x154d5c,_0x598f47){_0x154d5c=_0x154d5c-0x0;var _0x347afb=_0x9aba[_0x154d5c];return _0x347afb;};'use strict';var _=require(_0xa9ab('0x0'));var util=require(_0xa9ab('0x1'));var logger=require(_0xa9ab('0x2'))(_0xa9ab('0x3'));var moment=require(_0xa9ab('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9ab('0x5'));var fs=require('fs');var path=require(_0xa9ab('0x6'));var rimraf=require(_0xa9ab('0x7'));var config=require('../../config/environment');var attributes=require(_0xa9ab('0x8'));module['exports']=function(_0x4f350c,_0x36a96d){return _0x4f350c['define'](_0xa9ab('0x9'),attributes,{'tableName':_0xa9ab('0xa'),'paranoid':![],'indexes':[{'name':_0xa9ab('0xb'),'fields':[_0xa9ab('0xc'),_0xa9ab('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 360a5f3..57f1b03 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 _0x06c6=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x06c6,0x1dc));var _0x606c=function(_0x327d7a,_0x3104f5){_0x327d7a=_0x327d7a-0x0;var _0x50562a=_0x06c6[_0x327d7a];return _0x50562a;};'use strict';var _=require(_0x606c('0x0'));var util=require(_0x606c('0x1'));var moment=require(_0x606c('0x2'));var BPromise=require(_0x606c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x606c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x606c('0x5'));var logger=require('../../config/logger')(_0x606c('0x6'));var config=require(_0x606c('0x7'));var jayson=require(_0x606c('0x8'));var client=jayson[_0x606c('0x9')][_0x606c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa4c67f,_0x482b5e,_0x1c6930){return new BPromise(function(_0x170853,_0x23b1bc){return client['request'](_0xa4c67f,_0x1c6930)['then'](function(_0x12e34a){logger['info'](_0x606c('0xb'),_0x482b5e,_0x606c('0xc'));logger[_0x606c('0xd')](_0x606c('0xe'),_0x482b5e,'request\x20sent',JSON['stringify'](_0x12e34a));if(_0x12e34a['error']){if(_0x12e34a[_0x606c('0xf')][_0x606c('0x10')]===0x1f4){logger['error'](_0x606c('0xb'),_0x482b5e,_0x12e34a[_0x606c('0xf')][_0x606c('0x11')]);return _0x23b1bc(_0x12e34a['error'][_0x606c('0x11')]);}logger[_0x606c('0xf')](_0x606c('0xb'),_0x482b5e,_0x12e34a[_0x606c('0xf')]['message']);return _0x170853(_0x12e34a[_0x606c('0xf')][_0x606c('0x11')]);}else{logger['info'](_0x606c('0xb'),_0x482b5e,'request\x20sent');_0x170853(_0x12e34a[_0x606c('0x12')][_0x606c('0x11')]);}})[_0x606c('0x13')](function(_0x2034b8){logger[_0x606c('0xf')](_0x606c('0xb'),_0x482b5e,_0x2034b8);_0x23b1bc(_0x2034b8);});});} \ No newline at end of file +var _0x26b6=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x26b6,0xd0));var _0x626b=function(_0x139f9d,_0x53be63){_0x139f9d=_0x139f9d-0x0;var _0x363c63=_0x26b6[_0x139f9d];return _0x363c63;};'use strict';var _=require(_0x626b('0x0'));var util=require('util');var moment=require(_0x626b('0x1'));var BPromise=require('bluebird');var rs=require(_0x626b('0x2'));var fs=require('fs');var Redis=require(_0x626b('0x3'));var db=require(_0x626b('0x4'))['db'];var utils=require(_0x626b('0x5'));var logger=require(_0x626b('0x6'))('rpc');var config=require(_0x626b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x626b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xee1e4b,_0x57e8f1,_0x4a9d2b){return new BPromise(function(_0x553687,_0x568db8){return client[_0x626b('0x9')](_0xee1e4b,_0x4a9d2b)[_0x626b('0xa')](function(_0x1bce75){logger[_0x626b('0xb')](_0x626b('0xc'),_0x57e8f1,'request\x20sent');logger['debug'](_0x626b('0xd'),_0x57e8f1,_0x626b('0xe'),JSON[_0x626b('0xf')](_0x1bce75));if(_0x1bce75['error']){if(_0x1bce75[_0x626b('0x10')][_0x626b('0x11')]===0x1f4){logger['error'](_0x626b('0xc'),_0x57e8f1,_0x1bce75[_0x626b('0x10')]['message']);return _0x568db8(_0x1bce75[_0x626b('0x10')][_0x626b('0x12')]);}logger[_0x626b('0x10')](_0x626b('0xc'),_0x57e8f1,_0x1bce75[_0x626b('0x10')][_0x626b('0x12')]);return _0x553687(_0x1bce75[_0x626b('0x10')][_0x626b('0x12')]);}else{logger[_0x626b('0xb')](_0x626b('0xc'),_0x57e8f1,'request\x20sent');_0x553687(_0x1bce75[_0x626b('0x13')][_0x626b('0x12')]);}})[_0x626b('0x14')](function(_0x3f8b13){logger['error'](_0x626b('0xc'),_0x57e8f1,_0x3f8b13);_0x568db8(_0x3f8b13);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index ea91b38..d1cb276 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 _0x5af0=['show','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x4798de,_0x12f3fd){var _0x332509=function(_0x4334db){while(--_0x4334db){_0x4798de['push'](_0x4798de['shift']());}};_0x332509(++_0x12f3fd);}(_0x5af0,0x1eb));var _0x05af=function(_0x30755a,_0x2f1a51){_0x30755a=_0x30755a-0x0;var _0xa1d259=_0x5af0[_0x30755a];return _0xa1d259;};'use strict';var multer=require(_0x05af('0x0'));var util=require(_0x05af('0x1'));var path=require(_0x05af('0x2'));var timeout=require(_0x05af('0x3'));var express=require(_0x05af('0x4'));var router=express[_0x05af('0x5')]();var fs_extra=require(_0x05af('0x6'));var auth=require(_0x05af('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x05af('0x8'));var controller=require('./intVtigerAccount.controller');router[_0x05af('0x9')]('/',auth[_0x05af('0xa')](),controller[_0x05af('0xb')]);router['get'](_0x05af('0xc'),auth['isAuthenticated'](),controller[_0x05af('0xd')]);router[_0x05af('0x9')](_0x05af('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x05af('0xa')](),controller[_0x05af('0xf')]);router[_0x05af('0x10')]('/',auth['isAuthenticated'](),controller[_0x05af('0x11')]);router['post']('/:id/configurations',auth[_0x05af('0xa')](),controller[_0x05af('0x12')]);router[_0x05af('0x13')](_0x05af('0xc'),auth[_0x05af('0xa')](),controller[_0x05af('0x14')]);router[_0x05af('0x15')](_0x05af('0xc'),auth[_0x05af('0xa')](),controller[_0x05af('0x16')]);module[_0x05af('0x17')]=router; \ No newline at end of file +var _0xe148=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','create','post','/:id/configurations','put','update','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe148,0x9e));var _0x8e14=function(_0x3071ab,_0x574a59){_0x3071ab=_0x3071ab-0x0;var _0x2f458c=_0xe148[_0x3071ab];return _0x2f458c;};'use strict';var multer=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var path=require('path');var timeout=require(_0x8e14('0x2'));var express=require(_0x8e14('0x3'));var router=express['Router']();var fs_extra=require(_0x8e14('0x4'));var auth=require(_0x8e14('0x5'));var interaction=require(_0x8e14('0x6'));var config=require(_0x8e14('0x7'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x8e14('0x8')](),controller[_0x8e14('0x9')]);router['get'](_0x8e14('0xa'),auth[_0x8e14('0x8')](),controller[_0x8e14('0xb')]);router[_0x8e14('0xc')]('/:id/configurations',auth[_0x8e14('0x8')](),controller['getConfigurations']);router[_0x8e14('0xc')](_0x8e14('0xd'),auth['isAuthenticated'](),controller[_0x8e14('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8e14('0xf')]);router[_0x8e14('0x10')](_0x8e14('0x11'),auth[_0x8e14('0x8')](),controller['addConfiguration']);router[_0x8e14('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8e14('0x13')]);router['delete'](_0x8e14('0xa'),auth[_0x8e14('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 938cd47..6a22666 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 _0x3cf9=['STRING','exports'];(function(_0x1cc58c,_0x4b260b){var _0x6d04ea=function(_0x39c7f6){while(--_0x39c7f6){_0x1cc58c['push'](_0x1cc58c['shift']());}};_0x6d04ea(++_0x4b260b);}(_0x3cf9,0x111));var _0x93cf=function(_0x360e07,_0x10f407){_0x360e07=_0x360e07-0x0;var _0x4093d8=_0x3cf9[_0x360e07];return _0x4093d8;};'use strict';var Sequelize=require('sequelize');module[_0x93cf('0x0')]={'name':{'type':Sequelize[_0x93cf('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x93cf('0x1')]},'username':{'type':Sequelize[_0x93cf('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x93cf('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x93cf('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x99ff=['sequelize','exports','STRING','HelpDesk'];(function(_0x19aeaa,_0x13ab50){var _0x1c4e85=function(_0x3673fd){while(--_0x3673fd){_0x19aeaa['push'](_0x19aeaa['shift']());}};_0x1c4e85(++_0x13ab50);}(_0x99ff,0xc8));var _0xf99f=function(_0x5162ed,_0x386cb7){_0x5162ed=_0x5162ed-0x0;var _0x4c579b=_0x99ff[_0x5162ed];return _0x4c579b;};'use strict';var Sequelize=require(_0xf99f('0x0'));module[_0xf99f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf99f('0x2')]},'username':{'type':Sequelize[_0xf99f('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf99f('0x2')],'allowNull':![],'defaultValue':_0xf99f('0x3')},'remoteUri':{'type':Sequelize[_0xf99f('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index d1ddef1..7c5d821 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 _0x9965=['moduleName','remoteUri','username','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','result','token','describe','sessionName','autogenerated','reference','remove','includes','editable','false','label','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerAccount','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','getConfigurations','findOne','length','merge','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','VtigerConfiguration','VtigerField','md5','getFields','description'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x9965,0x18a));var _0x5996=function(_0x49076a,_0x1ba997){_0x49076a=_0x49076a-0x0;var _0xc1ca18=_0x9965[_0x49076a];return _0xc1ca18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5996('0x0'));var zipdir=require(_0x5996('0x1'));var jsonpatch=require(_0x5996('0x2'));var rp=require(_0x5996('0x3'));var moment=require(_0x5996('0x4'));var BPromise=require(_0x5996('0x5'));var Mustache=require(_0x5996('0x6'));var util=require(_0x5996('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5996('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5996('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5996('0xa'));var deskjs=require(_0x5996('0xb'));var toCsv=require(_0x5996('0x8'));var querystring=require(_0x5996('0xc'));var Papa=require('papaparse');var Redis=require(_0x5996('0xd'));var authService=require(_0x5996('0xe'));var qs=require(_0x5996('0xf'));var as=require(_0x5996('0x10'));var hardwareService=require(_0x5996('0x11'));var logger=require('../../config/logger')(_0x5996('0x12'));var utils=require(_0x5996('0x13'));var config=require(_0x5996('0x14'));var licenseUtil=require(_0x5996('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5996('0x16'));function respondWithStatusCode(_0x4cfbe0,_0x23be92){_0x23be92=_0x23be92||0xcc;return function(_0x55fd6a){if(_0x55fd6a){return _0x4cfbe0['sendStatus'](_0x23be92);}return _0x4cfbe0['status'](_0x23be92)[_0x5996('0x17')]();};}function respondWithResult(_0x102f53,_0x165cd6){_0x165cd6=_0x165cd6||0xc8;return function(_0x5324c5){if(_0x5324c5){return _0x102f53[_0x5996('0x18')](_0x165cd6)[_0x5996('0x19')](_0x5324c5);}};}function respondWithFilteredResult(_0x1be636,_0x4ad77a){return function(_0x6712cf){if(_0x6712cf){var _0x347ec5=typeof _0x4ad77a[_0x5996('0x1a')]===_0x5996('0x1b')&&typeof _0x4ad77a[_0x5996('0x1c')]==='undefined';var _0x1fcb35=_0x6712cf[_0x5996('0x1d')];var _0x3f8efd=_0x347ec5?0x0:_0x4ad77a['offset'];var _0xabb245=_0x347ec5?_0x6712cf[_0x5996('0x1d')]:_0x4ad77a[_0x5996('0x1a')]+_0x4ad77a[_0x5996('0x1c')];var _0x4386f8;if(_0xabb245>=_0x1fcb35){_0xabb245=_0x1fcb35;_0x4386f8=0xc8;}else{_0x4386f8=0xce;}_0x1be636[_0x5996('0x18')](_0x4386f8);return _0x1be636['set'](_0x5996('0x1e'),_0x3f8efd+'-'+_0xabb245+'/'+_0x1fcb35)[_0x5996('0x19')](_0x6712cf);}return null;};}function patchUpdates(_0x18e84b){return function(_0x10943d){try{jsonpatch['apply'](_0x10943d,_0x18e84b,!![]);}catch(_0xe93609){return BPromise['reject'](_0xe93609);}return _0x10943d[_0x5996('0x1f')]();};}function saveUpdates(_0x1ac816,_0x5a9649){return function(_0x45206a){if(_0x45206a){return _0x45206a[_0x5996('0x20')](_0x1ac816)[_0x5996('0x21')](function(_0x2f6f73){return _0x2f6f73;});}return null;};}function removeEntity(_0x4b25d3,_0x2864d4){return function(_0x1eb125){if(_0x1eb125){return _0x1eb125[_0x5996('0x22')]()[_0x5996('0x21')](function(){_0x4b25d3[_0x5996('0x18')](0xcc)[_0x5996('0x17')]();});}};}function handleEntityNotFound(_0x32f359,_0x339f2e){return function(_0x240a68){if(!_0x240a68){_0x32f359[_0x5996('0x23')](0x194);}return _0x240a68;};}function handleError(_0x3f19c4,_0x2c1433){_0x2c1433=_0x2c1433||0x1f4;return function(_0x5080c1){logger[_0x5996('0x24')](_0x5080c1[_0x5996('0x25')]);if(_0x5080c1[_0x5996('0x26')]){delete _0x5080c1[_0x5996('0x26')];}_0x3f19c4[_0x5996('0x18')](_0x2c1433)[_0x5996('0x27')](_0x5080c1);};}exports[_0x5996('0x28')]=function(_0x2ce4cc,_0x59a1c5){var _0x3f5dc6={},_0x1bb5f7={},_0x526912={'count':0x0,'rows':[]};var _0x51f068=_[_0x5996('0x29')](db[_0x5996('0x2a')]['rawAttributes'],function(_0x4d590b){return{'name':_0x4d590b['fieldName'],'type':_0x4d590b[_0x5996('0x2b')][_0x5996('0x2c')]};});_0x1bb5f7[_0x5996('0x2d')]=_[_0x5996('0x29')](_0x51f068,_0x5996('0x26'));_0x1bb5f7[_0x5996('0x2e')]=_[_0x5996('0x2f')](_0x2ce4cc[_0x5996('0x2e')]);_0x1bb5f7[_0x5996('0x30')]=_[_0x5996('0x31')](_0x1bb5f7[_0x5996('0x2d')],_0x1bb5f7[_0x5996('0x2e')]);_0x3f5dc6[_0x5996('0x32')]=_['intersection'](_0x1bb5f7[_0x5996('0x2d')],qs['fields'](_0x2ce4cc[_0x5996('0x2e')][_0x5996('0x33')]));_0x3f5dc6['attributes']=_0x3f5dc6['attributes']['length']?_0x3f5dc6[_0x5996('0x32')]:_0x1bb5f7[_0x5996('0x2d')];if(!_0x2ce4cc['query'][_0x5996('0x34')](_0x5996('0x35'))){_0x3f5dc6[_0x5996('0x1c')]=qs[_0x5996('0x1c')](_0x2ce4cc[_0x5996('0x2e')][_0x5996('0x1c')]);_0x3f5dc6['offset']=qs['offset'](_0x2ce4cc[_0x5996('0x2e')][_0x5996('0x1a')]);}_0x3f5dc6[_0x5996('0x36')]=qs['sort'](_0x2ce4cc[_0x5996('0x2e')][_0x5996('0x37')]);_0x3f5dc6['where']=qs['filters'](_[_0x5996('0x38')](_0x2ce4cc[_0x5996('0x2e')],_0x1bb5f7[_0x5996('0x30')]),_0x51f068);if(_0x2ce4cc['query'][_0x5996('0x39')]){_0x3f5dc6[_0x5996('0x3a')]=_['merge'](_0x3f5dc6['where'],{'$or':_[_0x5996('0x29')](_0x51f068,function(_0x119779){if(_0x119779[_0x5996('0x2b')]!==_0x5996('0x3b')){var _0x54d8d2={};_0x54d8d2[_0x119779['name']]={'$like':'%'+_0x2ce4cc[_0x5996('0x2e')]['filter']+'%'};return _0x54d8d2;}})});}_0x3f5dc6=_['merge']({},_0x3f5dc6,_0x2ce4cc[_0x5996('0x3c')]);var _0x51a91d={'where':_0x3f5dc6[_0x5996('0x3a')]};return db[_0x5996('0x2a')]['count'](_0x51a91d)[_0x5996('0x21')](function(_0x5656a8){_0x526912[_0x5996('0x1d')]=_0x5656a8;if(_0x2ce4cc[_0x5996('0x2e')][_0x5996('0x3d')]){_0x3f5dc6['include']=[{'all':!![]}];}return db[_0x5996('0x2a')][_0x5996('0x3e')](_0x3f5dc6);})[_0x5996('0x21')](function(_0x4d9b34){_0x526912['rows']=_0x4d9b34;return _0x526912;})[_0x5996('0x21')](respondWithFilteredResult(_0x59a1c5,_0x3f5dc6))[_0x5996('0x3f')](handleError(_0x59a1c5,null));};exports[_0x5996('0x40')]=function(_0x1dad95,_0x40009b){var _0x39667c={'raw':![],'where':{'id':_0x1dad95[_0x5996('0x41')]['id']}},_0xd45cd2={};_0xd45cd2['model']=_[_0x5996('0x2f')](db[_0x5996('0x2a')][_0x5996('0x42')]);_0xd45cd2[_0x5996('0x2e')]=_[_0x5996('0x2f')](_0x1dad95[_0x5996('0x2e')]);_0xd45cd2[_0x5996('0x30')]=_[_0x5996('0x31')](_0xd45cd2['model'],_0xd45cd2[_0x5996('0x2e')]);_0x39667c[_0x5996('0x32')]=_[_0x5996('0x31')](_0xd45cd2[_0x5996('0x2d')],qs[_0x5996('0x33')](_0x1dad95['query'][_0x5996('0x33')]));_0x39667c[_0x5996('0x32')]=_0x39667c[_0x5996('0x32')]['length']?_0x39667c[_0x5996('0x32')]:_0xd45cd2[_0x5996('0x2d')];if(_0x1dad95['query'][_0x5996('0x3d')]){_0x39667c[_0x5996('0x43')]=[{'all':!![]}];}_0x39667c=_['merge']({},_0x39667c,_0x1dad95[_0x5996('0x3c')]);return db[_0x5996('0x2a')][_0x5996('0x44')](_0x39667c)[_0x5996('0x21')](handleEntityNotFound(_0x40009b,null))[_0x5996('0x21')](respondWithResult(_0x40009b,null))[_0x5996('0x3f')](handleError(_0x40009b,null));};exports[_0x5996('0x45')]=function(_0x28af06,_0x39e59c){return db[_0x5996('0x2a')][_0x5996('0x45')](_0x28af06[_0x5996('0x46')],{})[_0x5996('0x21')](respondWithResult(_0x39e59c,0xc9))['catch'](handleError(_0x39e59c,null));};exports[_0x5996('0x20')]=function(_0x36caf2,_0x82cc0e){if(_0x36caf2[_0x5996('0x46')]['id']){delete _0x36caf2[_0x5996('0x46')]['id'];}return db[_0x5996('0x2a')]['find']({'where':{'id':_0x36caf2[_0x5996('0x41')]['id']}})[_0x5996('0x21')](handleEntityNotFound(_0x82cc0e,null))[_0x5996('0x21')](saveUpdates(_0x36caf2[_0x5996('0x46')],null))[_0x5996('0x21')](respondWithResult(_0x82cc0e,null))[_0x5996('0x3f')](handleError(_0x82cc0e,null));};exports[_0x5996('0x22')]=function(_0x396165,_0x31fe2b){return db[_0x5996('0x2a')][_0x5996('0x44')]({'where':{'id':_0x396165[_0x5996('0x41')]['id']}})['then'](handleEntityNotFound(_0x31fe2b,null))['then'](removeEntity(_0x31fe2b,null))[_0x5996('0x3f')](handleError(_0x31fe2b,null));};exports[_0x5996('0x47')]=function(_0x4dfc09,_0x3bdf23,_0x11de01){var _0x46cb45={};var _0x237d29={};var _0x1878c6;var _0x2f418c;return db[_0x5996('0x2a')][_0x5996('0x48')]({'where':{'id':_0x4dfc09[_0x5996('0x41')]['id']}})[_0x5996('0x21')](handleEntityNotFound(_0x3bdf23,null))[_0x5996('0x21')](function(_0x3abed6){if(_0x3abed6){_0x1878c6=_0x3abed6;_0x237d29['model']=_[_0x5996('0x2f')](db['VtigerConfiguration'][_0x5996('0x42')]);_0x237d29[_0x5996('0x2e')]=_[_0x5996('0x2f')](_0x4dfc09[_0x5996('0x2e')]);_0x237d29[_0x5996('0x30')]=_[_0x5996('0x31')](_0x237d29[_0x5996('0x2d')],_0x237d29[_0x5996('0x2e')]);_0x46cb45[_0x5996('0x32')]=_[_0x5996('0x31')](_0x237d29['model'],qs['fields'](_0x4dfc09[_0x5996('0x2e')]['fields']));_0x46cb45['attributes']=_0x46cb45['attributes'][_0x5996('0x49')]?_0x46cb45['attributes']:_0x237d29[_0x5996('0x2d')];_0x46cb45[_0x5996('0x36')]=qs['sort'](_0x4dfc09[_0x5996('0x2e')][_0x5996('0x37')]);_0x46cb45[_0x5996('0x3a')]=qs[_0x5996('0x30')](_[_0x5996('0x38')](_0x4dfc09['query'],_0x237d29[_0x5996('0x30')]));if(_0x4dfc09[_0x5996('0x2e')][_0x5996('0x39')]){_0x46cb45['where']=_[_0x5996('0x4a')](_0x46cb45[_0x5996('0x3a')],{'$or':_['map'](_0x46cb45[_0x5996('0x32')],function(_0x231cc0){var _0x19ca04={};_0x19ca04[_0x231cc0]={'$like':'%'+_0x4dfc09[_0x5996('0x2e')][_0x5996('0x39')]+'%'};return _0x19ca04;})});}_0x46cb45=_['merge']({},_0x46cb45,_0x4dfc09['options']);return _0x1878c6[_0x5996('0x47')](_0x46cb45);}})[_0x5996('0x21')](function(_0x411701){if(_0x411701){_0x2f418c=_0x411701['length'];if(!_0x4dfc09[_0x5996('0x2e')][_0x5996('0x34')](_0x5996('0x35'))){_0x46cb45[_0x5996('0x1c')]=qs[_0x5996('0x1c')](_0x4dfc09['query']['limit']);_0x46cb45[_0x5996('0x1a')]=qs[_0x5996('0x1a')](_0x4dfc09[_0x5996('0x2e')][_0x5996('0x1a')]);}return _0x1878c6[_0x5996('0x47')](_0x46cb45);}})[_0x5996('0x21')](function(_0x3e69ba){if(_0x3e69ba){return _0x3e69ba?{'count':_0x2f418c,'rows':_0x3e69ba}:null;}})[_0x5996('0x21')](respondWithResult(_0x3bdf23,null))[_0x5996('0x3f')](handleError(_0x3bdf23,null));};exports[_0x5996('0x4b')]=function(_0xea884f,_0x495704,_0x4baaa9){if(_0xea884f[_0x5996('0x46')]['id']){delete _0xea884f[_0x5996('0x46')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0xea884f[_0x5996('0x41')]['id']}})[_0x5996('0x21')](handleEntityNotFound(_0x495704,null))['then'](function(_0x86832d){if(_0x86832d){_0xea884f['body'][_0x5996('0x4c')]=_0x86832d['id'];_0xea884f[_0x5996('0x46')][_0x5996('0x4d')]=integrations['getSubjects'](_0xea884f[_0x5996('0x46')]['channel'],_0xea884f[_0x5996('0x46')][_0x5996('0x2b')]);_0xea884f[_0x5996('0x46')][_0x5996('0x4e')]=integrations[_0x5996('0x4f')](_0xea884f['body'][_0x5996('0x50')],_0xea884f[_0x5996('0x46')][_0x5996('0x2b')]);return db[_0x5996('0x51')]['create'](_0xea884f[_0x5996('0x46')],{'include':[{'model':db[_0x5996('0x52')],'as':_0x5996('0x4d')},{'model':db[_0x5996('0x52')],'as':_0x5996('0x4e')}]});}return null;})[_0x5996('0x21')](respondWithResult(_0x495704,null))[_0x5996('0x3f')](handleError(_0x495704,null));};var md5=require(_0x5996('0x53'));exports[_0x5996('0x54')]=function(_0x24ce8c,_0x4e457d,_0x53a8f8){var _0x1700c1=null;var _0x485865=null;var _0x587414=null;var _0x246b4b=null;var _0xa7b214='';return db[_0x5996('0x2a')][_0x5996('0x48')]({'where':{'id':_0x24ce8c['params']['id']},'attributes':['id',_0x5996('0x26'),'username',_0x5996('0x55'),_0x5996('0x56'),_0x5996('0x57'),'serverUrl','accessKey']})[_0x5996('0x21')](handleEntityNotFound(_0x4e457d,null))[_0x5996('0x21')](function(_0x243a80){if(_0x243a80){_0x1700c1=_0x243a80[_0x5996('0x58')];_0x485865=_0x243a80[_0x5996('0x59')];_0x587414=_0x243a80[_0x5996('0x56')];_0xa7b214=_0x243a80[_0x5996('0x57')];var _0xb2257e=_0xa7b214[_0x5996('0x5a')](-0x1);if(_0xb2257e==='/'){_0xa7b214=_0xa7b214[_0x5996('0x5b')](0x0,_0xa7b214[_0x5996('0x5c')](_0xb2257e));}_0x246b4b=util[_0x5996('0x5d')](_0x5996('0x5e'),_0xa7b214);var _0x24c865={'method':_0x5996('0x5f'),'uri':_0x246b4b,'qs':{'operation':_0x5996('0x60'),'username':_0x243a80[_0x5996('0x58')]},'json':!![]};return rp(_0x24c865);}})[_0x5996('0x21')](function(_0x5dbfb6){if(_0x5dbfb6[_0x5996('0x61')]){var _0x1c6d01={'method':_0x5996('0x62'),'uri':_0x246b4b,'form':{'operation':'login','username':_0x1700c1,'accessKey':md5(_0x5dbfb6[_0x5996('0x63')][_0x5996('0x64')]+_0x485865)},'json':!![]};return rp(_0x1c6d01);}})['then'](function(_0x22be92){if(_0x22be92[_0x5996('0x61')]){var _0x5d0c94={'method':_0x5996('0x5f'),'uri':_0x246b4b,'qs':{'operation':_0x5996('0x65'),'username':_0x1700c1,'sessionName':_0x22be92[_0x5996('0x63')][_0x5996('0x66')],'elementType':_0x587414},'json':!![]};return rp(_0x5d0c94);}})['then'](function(_0x5a0f94){if(_0x5a0f94[_0x5996('0x61')]){var _0x1afedd=[_0x5996('0x67'),_0x5996('0x68'),'owner'];_[_0x5996('0x69')](_0x5a0f94[_0x5996('0x63')][_0x5996('0x33')],function(_0x6281e0){return _0x1afedd[_0x5996('0x6a')](_0x6281e0[_0x5996('0x2b')][_0x5996('0x26')]);});_[_0x5996('0x69')](_0x5a0f94[_0x5996('0x63')][_0x5996('0x33')],function(_0x2cb1c2){return _0x2cb1c2[_0x5996('0x6b')]===_0x5996('0x6c');});return{'count':_0x5a0f94['result'][_0x5996('0x33')]['length'],'rows':_['map'](_0x5a0f94[_0x5996('0x63')]['fields'],function(_0x1e907f){return{'id':_0x1e907f[_0x5996('0x26')],'name':_0x1e907f[_0x5996('0x6d')],'custom':_['startsWith'](_0x1e907f['name'],_0x5996('0x6e'))?!![]:![],'options':_0x1e907f[_0x5996('0x2b')][_0x5996('0x26')]==='picklist'&&_0x1e907f[_0x5996('0x2b')][_0x5996('0x6f')][_0x5996('0x49')]>0x0?_[_0x5996('0x29')](_0x1e907f[_0x5996('0x2b')]['picklistValues'],function(_0x53e4f9){return{'name':_0x53e4f9[_0x5996('0x6d')],'value':_0x53e4f9[_0x5996('0x70')]};}):[]};})};}})[_0x5996('0x21')](respondWithResult(_0x4e457d,null))[_0x5996('0x3f')](function(_0xc8fa1f){console[_0x5996('0x71')](_0x5996('0x72')+_0xc8fa1f);var _0x1b6540=_0x24ce8c['query'][_0x5996('0x73')]?0x1f4:_0xc8fa1f['statusCode']||0x1f4;logger[_0x5996('0x24')](_0x5996('0x74'),_0x5996('0x54'),_0x1b6540,JSON[_0x5996('0x75')](_0xc8fa1f));delete _0xc8fa1f[_0x5996('0x26')];if(_0x1b6540===0x191){_0x1b6540=0x190;}_0x4e457d[_0x5996('0x18')](_0x1b6540)[_0x5996('0x27')](_0x24ce8c[_0x5996('0x2e')][_0x5996('0x73')]?{'message':_0x5996('0x76'),'statusCode':_0xc8fa1f[_0x5996('0x77')]}:_0xc8fa1f);});}; \ No newline at end of file +var _0x2e1a=['end','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','type','getDescriptions','VtigerField','Descriptions','md5','getFields','username','description','accessKey','moduleName','remoteUri','slice','substring','lastIndexOf','format','GET','getchallenge','success','POST','login','result','token','sessionName','autogenerated','remove','includes','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2e1a,0xd3));var _0xa2e1=function(_0x4a4922,_0x82cb8f){_0x4a4922=_0x4a4922-0x0;var _0x55a8c6=_0x2e1a[_0x4a4922];return _0x55a8c6;};'use strict';var emlformat=require(_0xa2e1('0x0'));var rimraf=require(_0xa2e1('0x1'));var zipdir=require(_0xa2e1('0x2'));var jsonpatch=require(_0xa2e1('0x3'));var rp=require(_0xa2e1('0x4'));var moment=require('moment');var BPromise=require(_0xa2e1('0x5'));var Mustache=require('mustache');var util=require(_0xa2e1('0x6'));var path=require(_0xa2e1('0x7'));var sox=require('sox');var csv=require(_0xa2e1('0x8'));var ejs=require(_0xa2e1('0x9'));var fs=require('fs');var fs_extra=require(_0xa2e1('0xa'));var _=require('lodash');var squel=require(_0xa2e1('0xb'));var crypto=require(_0xa2e1('0xc'));var jsforce=require(_0xa2e1('0xd'));var deskjs=require(_0xa2e1('0xe'));var toCsv=require(_0xa2e1('0x8'));var querystring=require('querystring');var Papa=require(_0xa2e1('0xf'));var Redis=require('ioredis');var authService=require(_0xa2e1('0x10'));var qs=require(_0xa2e1('0x11'));var as=require(_0xa2e1('0x12'));var hardwareService=require(_0xa2e1('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa2e1('0x14'));var config=require(_0xa2e1('0x15'));var licenseUtil=require(_0xa2e1('0x16'));var db=require(_0xa2e1('0x17'))['db'];var integrations=require(_0xa2e1('0x18'));function respondWithStatusCode(_0x46bf75,_0x23a5dd){_0x23a5dd=_0x23a5dd||0xcc;return function(_0x3bfb95){if(_0x3bfb95){return _0x46bf75['sendStatus'](_0x23a5dd);}return _0x46bf75['status'](_0x23a5dd)[_0xa2e1('0x19')]();};}function respondWithResult(_0x287822,_0x396be3){_0x396be3=_0x396be3||0xc8;return function(_0x217fab){if(_0x217fab){return _0x287822[_0xa2e1('0x1a')](_0x396be3)['json'](_0x217fab);}};}function respondWithFilteredResult(_0x5370dd,_0x10e96f){return function(_0x4e82a3){if(_0x4e82a3){var _0xfbd452=typeof _0x10e96f[_0xa2e1('0x1b')]===_0xa2e1('0x1c')&&typeof _0x10e96f['limit']===_0xa2e1('0x1c');var _0x5e597c=_0x4e82a3[_0xa2e1('0x1d')];var _0x44a8b2=_0xfbd452?0x0:_0x10e96f[_0xa2e1('0x1b')];var _0x4f5042=_0xfbd452?_0x4e82a3[_0xa2e1('0x1d')]:_0x10e96f['offset']+_0x10e96f['limit'];var _0x268f2b;if(_0x4f5042>=_0x5e597c){_0x4f5042=_0x5e597c;_0x268f2b=0xc8;}else{_0x268f2b=0xce;}_0x5370dd[_0xa2e1('0x1a')](_0x268f2b);return _0x5370dd[_0xa2e1('0x1e')](_0xa2e1('0x1f'),_0x44a8b2+'-'+_0x4f5042+'/'+_0x5e597c)[_0xa2e1('0x20')](_0x4e82a3);}return null;};}function patchUpdates(_0x1a8376){return function(_0x5976ae){try{jsonpatch[_0xa2e1('0x21')](_0x5976ae,_0x1a8376,!![]);}catch(_0x188467){return BPromise[_0xa2e1('0x22')](_0x188467);}return _0x5976ae[_0xa2e1('0x23')]();};}function saveUpdates(_0x5ce681,_0x212002){return function(_0x45272b){if(_0x45272b){return _0x45272b[_0xa2e1('0x24')](_0x5ce681)[_0xa2e1('0x25')](function(_0x4af6d6){return _0x4af6d6;});}return null;};}function removeEntity(_0x223b47,_0x4ce238){return function(_0x3e9062){if(_0x3e9062){return _0x3e9062['destroy']()[_0xa2e1('0x25')](function(){_0x223b47[_0xa2e1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a576,_0x4f0662){return function(_0x3e0db4){if(!_0x3e0db4){_0x28a576[_0xa2e1('0x26')](0x194);}return _0x3e0db4;};}function handleError(_0x292438,_0x2ee005){_0x2ee005=_0x2ee005||0x1f4;return function(_0x203150){logger[_0xa2e1('0x27')](_0x203150[_0xa2e1('0x28')]);if(_0x203150[_0xa2e1('0x29')]){delete _0x203150[_0xa2e1('0x29')];}_0x292438['status'](_0x2ee005)[_0xa2e1('0x2a')](_0x203150);};}exports[_0xa2e1('0x2b')]=function(_0x5e1633,_0x7028cd){var _0x5eab5f={},_0x19c87a={},_0x3288e8={'count':0x0,'rows':[]};var _0x1ed18b=_[_0xa2e1('0x2c')](db[_0xa2e1('0x2d')][_0xa2e1('0x2e')],function(_0x59fa28){return{'name':_0x59fa28[_0xa2e1('0x2f')],'type':_0x59fa28['type'][_0xa2e1('0x30')]};});_0x19c87a[_0xa2e1('0x31')]=_[_0xa2e1('0x2c')](_0x1ed18b,_0xa2e1('0x29'));_0x19c87a['query']=_[_0xa2e1('0x32')](_0x5e1633[_0xa2e1('0x33')]);_0x19c87a[_0xa2e1('0x34')]=_[_0xa2e1('0x35')](_0x19c87a[_0xa2e1('0x31')],_0x19c87a[_0xa2e1('0x33')]);_0x5eab5f[_0xa2e1('0x36')]=_[_0xa2e1('0x35')](_0x19c87a[_0xa2e1('0x31')],qs[_0xa2e1('0x37')](_0x5e1633[_0xa2e1('0x33')][_0xa2e1('0x37')]));_0x5eab5f[_0xa2e1('0x36')]=_0x5eab5f[_0xa2e1('0x36')][_0xa2e1('0x38')]?_0x5eab5f[_0xa2e1('0x36')]:_0x19c87a[_0xa2e1('0x31')];if(!_0x5e1633[_0xa2e1('0x33')]['hasOwnProperty'](_0xa2e1('0x39'))){_0x5eab5f[_0xa2e1('0x3a')]=qs[_0xa2e1('0x3a')](_0x5e1633[_0xa2e1('0x33')][_0xa2e1('0x3a')]);_0x5eab5f[_0xa2e1('0x1b')]=qs['offset'](_0x5e1633['query'][_0xa2e1('0x1b')]);}_0x5eab5f[_0xa2e1('0x3b')]=qs[_0xa2e1('0x3c')](_0x5e1633['query'][_0xa2e1('0x3c')]);_0x5eab5f[_0xa2e1('0x3d')]=qs[_0xa2e1('0x34')](_[_0xa2e1('0x3e')](_0x5e1633[_0xa2e1('0x33')],_0x19c87a['filters']),_0x1ed18b);if(_0x5e1633[_0xa2e1('0x33')][_0xa2e1('0x3f')]){_0x5eab5f[_0xa2e1('0x3d')]=_[_0xa2e1('0x40')](_0x5eab5f[_0xa2e1('0x3d')],{'$or':_[_0xa2e1('0x2c')](_0x1ed18b,function(_0x22316f){if(_0x22316f['type']!==_0xa2e1('0x41')){var _0x5a9a47={};_0x5a9a47[_0x22316f['name']]={'$like':'%'+_0x5e1633[_0xa2e1('0x33')][_0xa2e1('0x3f')]+'%'};return _0x5a9a47;}})});}_0x5eab5f=_[_0xa2e1('0x40')]({},_0x5eab5f,_0x5e1633[_0xa2e1('0x42')]);var _0x893dd4={'where':_0x5eab5f[_0xa2e1('0x3d')]};return db[_0xa2e1('0x2d')][_0xa2e1('0x1d')](_0x893dd4)[_0xa2e1('0x25')](function(_0x3c88d3){_0x3288e8[_0xa2e1('0x1d')]=_0x3c88d3;if(_0x5e1633[_0xa2e1('0x33')][_0xa2e1('0x43')]){_0x5eab5f[_0xa2e1('0x44')]=[{'all':!![]}];}return db[_0xa2e1('0x2d')][_0xa2e1('0x45')](_0x5eab5f);})['then'](function(_0x3f2c54){_0x3288e8['rows']=_0x3f2c54;return _0x3288e8;})['then'](respondWithFilteredResult(_0x7028cd,_0x5eab5f))[_0xa2e1('0x46')](handleError(_0x7028cd,null));};exports['show']=function(_0x453e20,_0x568e8f){var _0x1e2107={'raw':![],'where':{'id':_0x453e20[_0xa2e1('0x47')]['id']}},_0x19015d={};_0x19015d[_0xa2e1('0x31')]=_[_0xa2e1('0x32')](db[_0xa2e1('0x2d')][_0xa2e1('0x2e')]);_0x19015d[_0xa2e1('0x33')]=_[_0xa2e1('0x32')](_0x453e20[_0xa2e1('0x33')]);_0x19015d['filters']=_[_0xa2e1('0x35')](_0x19015d[_0xa2e1('0x31')],_0x19015d['query']);_0x1e2107[_0xa2e1('0x36')]=_[_0xa2e1('0x35')](_0x19015d[_0xa2e1('0x31')],qs[_0xa2e1('0x37')](_0x453e20[_0xa2e1('0x33')][_0xa2e1('0x37')]));_0x1e2107[_0xa2e1('0x36')]=_0x1e2107[_0xa2e1('0x36')]['length']?_0x1e2107[_0xa2e1('0x36')]:_0x19015d['model'];if(_0x453e20[_0xa2e1('0x33')][_0xa2e1('0x43')]){_0x1e2107['include']=[{'all':!![]}];}_0x1e2107=_[_0xa2e1('0x40')]({},_0x1e2107,_0x453e20[_0xa2e1('0x42')]);return db[_0xa2e1('0x2d')][_0xa2e1('0x48')](_0x1e2107)[_0xa2e1('0x25')](handleEntityNotFound(_0x568e8f,null))[_0xa2e1('0x25')](respondWithResult(_0x568e8f,null))[_0xa2e1('0x46')](handleError(_0x568e8f,null));};exports[_0xa2e1('0x49')]=function(_0x3f30b3,_0x1ff0c2){return db['VtigerAccount'][_0xa2e1('0x49')](_0x3f30b3[_0xa2e1('0x4a')],{})[_0xa2e1('0x25')](respondWithResult(_0x1ff0c2,0xc9))[_0xa2e1('0x46')](handleError(_0x1ff0c2,null));};exports['update']=function(_0x189ebd,_0x7c697e){if(_0x189ebd[_0xa2e1('0x4a')]['id']){delete _0x189ebd[_0xa2e1('0x4a')]['id'];}return db[_0xa2e1('0x2d')][_0xa2e1('0x48')]({'where':{'id':_0x189ebd[_0xa2e1('0x47')]['id']}})[_0xa2e1('0x25')](handleEntityNotFound(_0x7c697e,null))['then'](saveUpdates(_0x189ebd['body'],null))['then'](respondWithResult(_0x7c697e,null))[_0xa2e1('0x46')](handleError(_0x7c697e,null));};exports[_0xa2e1('0x4b')]=function(_0xcb39b,_0x4a455d){return db[_0xa2e1('0x2d')][_0xa2e1('0x48')]({'where':{'id':_0xcb39b[_0xa2e1('0x47')]['id']}})[_0xa2e1('0x25')](handleEntityNotFound(_0x4a455d,null))[_0xa2e1('0x25')](removeEntity(_0x4a455d,null))[_0xa2e1('0x46')](handleError(_0x4a455d,null));};exports[_0xa2e1('0x4c')]=function(_0x85e247,_0x4bc360,_0x131f23){var _0x53c404={};var _0x246735={};var _0x8a7ce5;var _0xe0ca09;return db[_0xa2e1('0x2d')][_0xa2e1('0x4d')]({'where':{'id':_0x85e247[_0xa2e1('0x47')]['id']}})[_0xa2e1('0x25')](handleEntityNotFound(_0x4bc360,null))['then'](function(_0x549f10){if(_0x549f10){_0x8a7ce5=_0x549f10;_0x246735[_0xa2e1('0x31')]=_[_0xa2e1('0x32')](db['VtigerConfiguration']['rawAttributes']);_0x246735['query']=_[_0xa2e1('0x32')](_0x85e247[_0xa2e1('0x33')]);_0x246735[_0xa2e1('0x34')]=_[_0xa2e1('0x35')](_0x246735[_0xa2e1('0x31')],_0x246735[_0xa2e1('0x33')]);_0x53c404[_0xa2e1('0x36')]=_[_0xa2e1('0x35')](_0x246735['model'],qs[_0xa2e1('0x37')](_0x85e247['query'][_0xa2e1('0x37')]));_0x53c404[_0xa2e1('0x36')]=_0x53c404[_0xa2e1('0x36')]['length']?_0x53c404[_0xa2e1('0x36')]:_0x246735[_0xa2e1('0x31')];_0x53c404[_0xa2e1('0x3b')]=qs['sort'](_0x85e247['query']['sort']);_0x53c404['where']=qs['filters'](_[_0xa2e1('0x3e')](_0x85e247[_0xa2e1('0x33')],_0x246735['filters']));if(_0x85e247[_0xa2e1('0x33')][_0xa2e1('0x3f')]){_0x53c404[_0xa2e1('0x3d')]=_[_0xa2e1('0x40')](_0x53c404['where'],{'$or':_[_0xa2e1('0x2c')](_0x53c404[_0xa2e1('0x36')],function(_0x208245){var _0x1563c5={};_0x1563c5[_0x208245]={'$like':'%'+_0x85e247['query'][_0xa2e1('0x3f')]+'%'};return _0x1563c5;})});}_0x53c404=_[_0xa2e1('0x40')]({},_0x53c404,_0x85e247[_0xa2e1('0x42')]);return _0x8a7ce5[_0xa2e1('0x4c')](_0x53c404);}})['then'](function(_0x4bc708){if(_0x4bc708){_0xe0ca09=_0x4bc708['length'];if(!_0x85e247[_0xa2e1('0x33')]['hasOwnProperty'](_0xa2e1('0x39'))){_0x53c404[_0xa2e1('0x3a')]=qs[_0xa2e1('0x3a')](_0x85e247[_0xa2e1('0x33')][_0xa2e1('0x3a')]);_0x53c404['offset']=qs[_0xa2e1('0x1b')](_0x85e247[_0xa2e1('0x33')][_0xa2e1('0x1b')]);}return _0x8a7ce5['getConfigurations'](_0x53c404);}})['then'](function(_0x2fca10){if(_0x2fca10){return _0x2fca10?{'count':_0xe0ca09,'rows':_0x2fca10}:null;}})[_0xa2e1('0x25')](respondWithResult(_0x4bc360,null))['catch'](handleError(_0x4bc360,null));};exports[_0xa2e1('0x4e')]=function(_0x459f9d,_0x234c78,_0x5c66fe){if(_0x459f9d[_0xa2e1('0x4a')]['id']){delete _0x459f9d[_0xa2e1('0x4a')]['id'];}return db['VtigerAccount'][_0xa2e1('0x4d')]({'where':{'id':_0x459f9d[_0xa2e1('0x47')]['id']}})['then'](handleEntityNotFound(_0x234c78,null))[_0xa2e1('0x25')](function(_0x28f7cd){if(_0x28f7cd){_0x459f9d['body'][_0xa2e1('0x4f')]=_0x28f7cd['id'];_0x459f9d[_0xa2e1('0x4a')][_0xa2e1('0x50')]=integrations[_0xa2e1('0x51')](_0x459f9d[_0xa2e1('0x4a')][_0xa2e1('0x52')],_0x459f9d[_0xa2e1('0x4a')][_0xa2e1('0x53')]);_0x459f9d[_0xa2e1('0x4a')]['Descriptions']=integrations[_0xa2e1('0x54')](_0x459f9d[_0xa2e1('0x4a')][_0xa2e1('0x52')],_0x459f9d[_0xa2e1('0x4a')][_0xa2e1('0x53')]);return db['VtigerConfiguration'][_0xa2e1('0x49')](_0x459f9d[_0xa2e1('0x4a')],{'include':[{'model':db[_0xa2e1('0x55')],'as':_0xa2e1('0x50')},{'model':db[_0xa2e1('0x55')],'as':_0xa2e1('0x56')}]});}return null;})[_0xa2e1('0x25')](respondWithResult(_0x234c78,null))[_0xa2e1('0x46')](handleError(_0x234c78,null));};var md5=require(_0xa2e1('0x57'));exports[_0xa2e1('0x58')]=function(_0xdc716,_0x561cd4,_0x2ede14){var _0x5d44b0=null;var _0x2a0886=null;var _0x389413=null;var _0x48d308=null;var _0x2a0bbd='';return db[_0xa2e1('0x2d')]['findOne']({'where':{'id':_0xdc716[_0xa2e1('0x47')]['id']},'attributes':['id',_0xa2e1('0x29'),_0xa2e1('0x59'),_0xa2e1('0x5a'),'moduleName','remoteUri','serverUrl',_0xa2e1('0x5b')]})[_0xa2e1('0x25')](handleEntityNotFound(_0x561cd4,null))['then'](function(_0x530395){if(_0x530395){_0x5d44b0=_0x530395['username'];_0x2a0886=_0x530395[_0xa2e1('0x5b')];_0x389413=_0x530395[_0xa2e1('0x5c')];_0x2a0bbd=_0x530395[_0xa2e1('0x5d')];var _0x589349=_0x2a0bbd[_0xa2e1('0x5e')](-0x1);if(_0x589349==='/'){_0x2a0bbd=_0x2a0bbd[_0xa2e1('0x5f')](0x0,_0x2a0bbd[_0xa2e1('0x60')](_0x589349));}_0x48d308=util[_0xa2e1('0x61')]('%s/webservice.php',_0x2a0bbd);var _0x582e95={'method':_0xa2e1('0x62'),'uri':_0x48d308,'qs':{'operation':_0xa2e1('0x63'),'username':_0x530395[_0xa2e1('0x59')]},'json':!![]};return rp(_0x582e95);}})['then'](function(_0x116913){if(_0x116913[_0xa2e1('0x64')]){var _0x25e9ff={'method':_0xa2e1('0x65'),'uri':_0x48d308,'form':{'operation':_0xa2e1('0x66'),'username':_0x5d44b0,'accessKey':md5(_0x116913[_0xa2e1('0x67')][_0xa2e1('0x68')]+_0x2a0886)},'json':!![]};return rp(_0x25e9ff);}})[_0xa2e1('0x25')](function(_0x4e1563){if(_0x4e1563['success']){var _0x565339={'method':'GET','uri':_0x48d308,'qs':{'operation':'describe','username':_0x5d44b0,'sessionName':_0x4e1563[_0xa2e1('0x67')][_0xa2e1('0x69')],'elementType':_0x389413},'json':!![]};return rp(_0x565339);}})['then'](function(_0x553a90){if(_0x553a90[_0xa2e1('0x64')]){var _0x38ccc3=[_0xa2e1('0x6a'),'reference','owner'];_[_0xa2e1('0x6b')](_0x553a90[_0xa2e1('0x67')]['fields'],function(_0x361c6a){return _0x38ccc3[_0xa2e1('0x6c')](_0x361c6a[_0xa2e1('0x53')]['name']);});_[_0xa2e1('0x6b')](_0x553a90['result']['fields'],function(_0x42cb5b){return _0x42cb5b['editable']==='false';});return{'count':_0x553a90['result'][_0xa2e1('0x37')][_0xa2e1('0x38')],'rows':_[_0xa2e1('0x2c')](_0x553a90[_0xa2e1('0x67')][_0xa2e1('0x37')],function(_0x5621e4){return{'id':_0x5621e4[_0xa2e1('0x29')],'name':_0x5621e4[_0xa2e1('0x6d')],'custom':_[_0xa2e1('0x6e')](_0x5621e4[_0xa2e1('0x29')],_0xa2e1('0x6f'))?!![]:![],'options':_0x5621e4[_0xa2e1('0x53')][_0xa2e1('0x29')]===_0xa2e1('0x70')&&_0x5621e4[_0xa2e1('0x53')][_0xa2e1('0x71')]['length']>0x0?_[_0xa2e1('0x2c')](_0x5621e4[_0xa2e1('0x53')][_0xa2e1('0x71')],function(_0x5b94c7){return{'name':_0x5b94c7['label'],'value':_0x5b94c7['value']};}):[]};})};}})[_0xa2e1('0x25')](respondWithResult(_0x561cd4,null))[_0xa2e1('0x46')](function(_0x528f5b){console[_0xa2e1('0x72')](_0xa2e1('0x73')+_0x528f5b);var _0x263a3c=_0xdc716[_0xa2e1('0x33')][_0xa2e1('0x74')]?0x1f4:_0x528f5b['statusCode']||0x1f4;logger[_0xa2e1('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xa2e1('0x58'),_0x263a3c,JSON[_0xa2e1('0x75')](_0x528f5b));delete _0x528f5b[_0xa2e1('0x29')];if(_0x263a3c===0x191){_0x263a3c=0x190;}_0x561cd4[_0xa2e1('0x1a')](_0x263a3c)['send'](_0xdc716['query'][_0xa2e1('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x528f5b['statusCode']}:_0x528f5b);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index aaf4a3f..3c25e73 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 _0xad6a=['request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x45aed4,_0x45d212){var _0x4b1cd0=function(_0x137571){while(--_0x137571){_0x45aed4['push'](_0x45aed4['shift']());}};_0x4b1cd0(++_0x45d212);}(_0xad6a,0x112));var _0xaad6=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xad6a[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0xaad6('0x0'));var util=require(_0xaad6('0x1'));var logger=require(_0xaad6('0x2'))(_0xaad6('0x3'));var moment=require(_0xaad6('0x4'));var BPromise=require(_0xaad6('0x5'));var rp=require(_0xaad6('0x6'));var fs=require('fs');var path=require(_0xaad6('0x7'));var rimraf=require('rimraf');var config=require(_0xaad6('0x8'));var attributes=require(_0xaad6('0x9'));var integrations=require(_0xaad6('0xa'));module[_0xaad6('0xb')]=function(_0x188eb3,_0x457544){return _0x188eb3[_0xaad6('0xc')](_0xaad6('0xd'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ab1=['define','int_vtiger_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0x7ab1,0xfe));var _0x17ab=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x7ab1[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x17ab('0x0'));var util=require('util');var logger=require(_0x17ab('0x1'))(_0x17ab('0x2'));var moment=require(_0x17ab('0x3'));var BPromise=require(_0x17ab('0x4'));var rp=require(_0x17ab('0x5'));var fs=require('fs');var path=require(_0x17ab('0x6'));var rimraf=require(_0x17ab('0x7'));var config=require(_0x17ab('0x8'));var attributes=require(_0x17ab('0x9'));var integrations=require(_0x17ab('0xa'));module[_0x17ab('0xb')]=function(_0x23f4cf,_0x291ae0){return _0x23f4cf[_0x17ab('0xc')]('VtigerAccount',attributes,{'tableName':_0x17ab('0xd'),'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 0876345..eb767b6 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 _0x16d2=['request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','map','include','model','attributes','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x2f7b7a,_0x504188){var _0x3bb636=function(_0x2ed28b){while(--_0x2ed28b){_0x2f7b7a['push'](_0x2f7b7a['shift']());}};_0x3bb636(++_0x504188);}(_0x16d2,0x123));var _0x216d=function(_0x4bb27a,_0x373798){_0x4bb27a=_0x4bb27a-0x0;var _0x1ef716=_0x16d2[_0x4bb27a];return _0x1ef716;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var moment=require(_0x216d('0x2'));var BPromise=require(_0x216d('0x3'));var rs=require(_0x216d('0x4'));var fs=require('fs');var Redis=require(_0x216d('0x5'));var db=require(_0x216d('0x6'))['db'];var utils=require(_0x216d('0x7'));var logger=require(_0x216d('0x8'))('rpc');var config=require(_0x216d('0x9'));var jayson=require(_0x216d('0xa'));var client=jayson[_0x216d('0xb')][_0x216d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1dd8e2,_0x24c831,_0x3e0ada){return new BPromise(function(_0x28da14,_0x57accc){return client[_0x216d('0xd')](_0x1dd8e2,_0x3e0ada)[_0x216d('0xe')](function(_0x35abcf){logger[_0x216d('0xf')](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));logger['debug'](_0x216d('0x12'),_0x24c831,'request\x20sent',JSON[_0x216d('0x13')](_0x35abcf));if(_0x35abcf[_0x216d('0x14')]){if(_0x35abcf[_0x216d('0x14')][_0x216d('0x15')]===0x1f4){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x35abcf['error'][_0x216d('0x16')]);return _0x57accc(_0x35abcf['error'][_0x216d('0x16')]);}logger[_0x216d('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x24c831,_0x35abcf[_0x216d('0x14')][_0x216d('0x16')]);return _0x28da14(_0x35abcf['error'][_0x216d('0x16')]);}else{logger['info'](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));_0x28da14(_0x35abcf[_0x216d('0x17')][_0x216d('0x16')]);}})[_0x216d('0x18')](function(_0x304dfa){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x304dfa);_0x57accc(_0x304dfa);});});}exports[_0x216d('0x19')]=function(_0x53d464){var _0x3b60dd=this;return new Promise(function(_0x5124ab,_0x4ddc51){return db[_0x216d('0x1a')][_0x216d('0x1b')]({'raw':_0x53d464['options']?_0x53d464[_0x216d('0x1c')][_0x216d('0x1d')]===undefined?!![]:![]:!![],'where':_0x53d464['options']?_0x53d464[_0x216d('0x1c')][_0x216d('0x1e')]||null:null,'attributes':_0x53d464[_0x216d('0x1c')]?_0x53d464[_0x216d('0x1c')]['attributes']||null:null,'limit':_0x53d464[_0x216d('0x1c')]?_0x53d464[_0x216d('0x1c')][_0x216d('0x1f')]||null:null,'include':_0x53d464[_0x216d('0x1c')]?_0x53d464[_0x216d('0x1c')]['include']?_[_0x216d('0x20')](_0x53d464[_0x216d('0x1c')][_0x216d('0x21')],function(_0x2880c6){return{'model':db[_0x2880c6[_0x216d('0x22')]],'as':_0x2880c6['as'],'attributes':_0x2880c6['attributes'],'include':_0x2880c6[_0x216d('0x21')]?_[_0x216d('0x20')](_0x2880c6[_0x216d('0x21')],function(_0x5998a1){return{'model':db[_0x5998a1['model']],'as':_0x5998a1['as'],'attributes':_0x5998a1['attributes'],'include':_0x5998a1['include']?_['map'](_0x5998a1[_0x216d('0x21')],function(_0x470d8a){return{'model':db[_0x470d8a[_0x216d('0x22')]],'as':_0x470d8a['as'],'attributes':_0x470d8a[_0x216d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x216d('0xe')](function(_0x47fa6d){logger['info'](_0x216d('0x19'),_0x53d464);logger['debug'](_0x216d('0x19'),_0x53d464,JSON[_0x216d('0x13')](_0x47fa6d));_0x5124ab(_0x47fa6d);})[_0x216d('0x18')](function(_0x20bc16){logger[_0x216d('0x14')](_0x216d('0x19'),_0x20bc16[_0x216d('0x16')],_0x53d464);_0x4ddc51(_0x3b60dd[_0x216d('0x14')](0x1f4,_0x20bc16[_0x216d('0x16')]));});});};exports[_0x216d('0x24')]=function(_0x11be90){var _0x260134=this;return new Promise(function(_0x4537fd,_0x483324){return db[_0x216d('0x1a')][_0x216d('0x25')]({'raw':_0x11be90[_0x216d('0x1c')]?_0x11be90['options'][_0x216d('0x1d')]===undefined?!![]:![]:!![],'where':_0x11be90[_0x216d('0x1c')]?_0x11be90[_0x216d('0x1c')][_0x216d('0x1e')]||null:null,'attributes':_0x11be90['options']?_0x11be90[_0x216d('0x1c')][_0x216d('0x23')]||null:null,'include':_0x11be90[_0x216d('0x1c')]?_0x11be90[_0x216d('0x1c')][_0x216d('0x21')]?_[_0x216d('0x20')](_0x11be90[_0x216d('0x1c')][_0x216d('0x21')],function(_0x461320){return{'model':db[_0x461320[_0x216d('0x22')]],'as':_0x461320['as'],'attributes':_0x461320[_0x216d('0x23')],'include':_0x461320['include']?_[_0x216d('0x20')](_0x461320[_0x216d('0x21')],function(_0x1eee8c){return{'model':db[_0x1eee8c['model']],'as':_0x1eee8c['as'],'attributes':_0x1eee8c[_0x216d('0x23')],'include':_0x1eee8c[_0x216d('0x21')]?_['map'](_0x1eee8c[_0x216d('0x21')],function(_0x49e5c3){return{'model':db[_0x49e5c3['model']],'as':_0x49e5c3['as'],'attributes':_0x49e5c3[_0x216d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x216d('0xe')](function(_0x1e5ad0){logger[_0x216d('0xf')]('ShowVtigerAccount',_0x11be90);logger['debug']('ShowVtigerAccount',_0x11be90,JSON[_0x216d('0x13')](_0x1e5ad0));_0x4537fd(_0x1e5ad0);})[_0x216d('0x18')](function(_0x47e006){logger[_0x216d('0x14')](_0x216d('0x24'),_0x47e006['message'],_0x11be90);_0x483324(_0x260134[_0x216d('0x14')](0x1f4,_0x47e006[_0x216d('0x16')]));});});}; \ No newline at end of file +var _0x7d25=['raw','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','attributes','limit','include','map','model','then','ShowVtigerAccount','find'];(function(_0x2d7836,_0x5a5412){var _0x491179=function(_0xaafd3){while(--_0xaafd3){_0x2d7836['push'](_0x2d7836['shift']());}};_0x491179(++_0x5a5412);}(_0x7d25,0x8a));var _0x57d2=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x7d25[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43b2,_0x263d35,_0x147194){return new BPromise(function(_0x59ae87,_0x49e3e5){return client[_0x57d2('0x8')](_0x1f43b2,_0x147194)['then'](function(_0x3a1ec5){logger[_0x57d2('0x9')](_0x57d2('0xa'),_0x263d35,'request\x20sent');logger[_0x57d2('0xb')](_0x57d2('0xc'),_0x263d35,_0x57d2('0xd'),JSON[_0x57d2('0xe')](_0x3a1ec5));if(_0x3a1ec5[_0x57d2('0xf')]){if(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x49e3e5(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);}logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')]['message']);return _0x59ae87(_0x3a1ec5['error'][_0x57d2('0x11')]);}else{logger[_0x57d2('0x9')]('VtigerAccount,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});}exports[_0x57d2('0x14')]=function(_0x7d4cf1){var _0x2ecfdf=this;return new Promise(function(_0x4a94e3,_0x525cfc){return db[_0x57d2('0x15')][_0x57d2('0x16')]({'raw':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')]['where']||null:null,'attributes':_0x7d4cf1['options']?_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x18')]||null:null,'limit':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x19')]||null:null,'include':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x1a')]?_[_0x57d2('0x1b')](_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x1a')],function(_0x456fe1){return{'model':db[_0x456fe1[_0x57d2('0x1c')]],'as':_0x456fe1['as'],'attributes':_0x456fe1[_0x57d2('0x18')],'include':_0x456fe1['include']?_[_0x57d2('0x1b')](_0x456fe1[_0x57d2('0x1a')],function(_0x3c7de8){return{'model':db[_0x3c7de8[_0x57d2('0x1c')]],'as':_0x3c7de8['as'],'attributes':_0x3c7de8[_0x57d2('0x18')],'include':_0x3c7de8['include']?_[_0x57d2('0x1b')](_0x3c7de8[_0x57d2('0x1a')],function(_0x995928){return{'model':db[_0x995928[_0x57d2('0x1c')]],'as':_0x995928['as'],'attributes':_0x995928[_0x57d2('0x18')]};}):[]};}):[]};}):[]:[]})[_0x57d2('0x1d')](function(_0x9bdb11){logger['info'](_0x57d2('0x14'),_0x7d4cf1);logger[_0x57d2('0xb')](_0x57d2('0x14'),_0x7d4cf1,JSON[_0x57d2('0xe')](_0x9bdb11));_0x4a94e3(_0x9bdb11);})[_0x57d2('0x13')](function(_0x7c33f3){logger[_0x57d2('0xf')](_0x57d2('0x14'),_0x7c33f3[_0x57d2('0x11')],_0x7d4cf1);_0x525cfc(_0x2ecfdf[_0x57d2('0xf')](0x1f4,_0x7c33f3['message']));});});};exports[_0x57d2('0x1e')]=function(_0x3da926){var _0x26e052=this;return new Promise(function(_0x3e017c,_0x484597){return db[_0x57d2('0x15')][_0x57d2('0x1f')]({'raw':_0x3da926[_0x57d2('0x17')]?_0x3da926[_0x57d2('0x17')][_0x57d2('0x20')]===undefined?!![]:![]:!![],'where':_0x3da926[_0x57d2('0x17')]?_0x3da926[_0x57d2('0x17')][_0x57d2('0x21')]||null:null,'attributes':_0x3da926[_0x57d2('0x17')]?_0x3da926['options'][_0x57d2('0x18')]||null:null,'include':_0x3da926[_0x57d2('0x17')]?_0x3da926['options'][_0x57d2('0x1a')]?_[_0x57d2('0x1b')](_0x3da926['options'][_0x57d2('0x1a')],function(_0x1c4ea5){return{'model':db[_0x1c4ea5[_0x57d2('0x1c')]],'as':_0x1c4ea5['as'],'attributes':_0x1c4ea5[_0x57d2('0x18')],'include':_0x1c4ea5[_0x57d2('0x1a')]?_['map'](_0x1c4ea5['include'],function(_0x581ebc){return{'model':db[_0x581ebc['model']],'as':_0x581ebc['as'],'attributes':_0x581ebc[_0x57d2('0x18')],'include':_0x581ebc[_0x57d2('0x1a')]?_[_0x57d2('0x1b')](_0x581ebc[_0x57d2('0x1a')],function(_0x13beac){return{'model':db[_0x13beac['model']],'as':_0x13beac['as'],'attributes':_0x13beac[_0x57d2('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3378a6){logger[_0x57d2('0x9')](_0x57d2('0x1e'),_0x3da926);logger['debug'](_0x57d2('0x1e'),_0x3da926,JSON[_0x57d2('0xe')](_0x3378a6));_0x3e017c(_0x3378a6);})['catch'](function(_0xb33455){logger[_0x57d2('0xf')](_0x57d2('0x1e'),_0xb33455[_0x57d2('0x11')],_0x3da926);_0x484597(_0x26e052[_0x57d2('0xf')](0x1f4,_0xb33455[_0x57d2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index ba200c0..d539c43 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 _0xf182=['../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf182,0x8f));var _0x2f18=function(_0x35d5db,_0x55a54c){_0x35d5db=_0x35d5db-0x0;var _0xe25664=_0xf182[_0x35d5db];return _0xe25664;};'use strict';var multer=require(_0x2f18('0x0'));var util=require(_0x2f18('0x1'));var path=require(_0x2f18('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f18('0x3'));var router=express['Router']();var fs_extra=require(_0x2f18('0x4'));var auth=require(_0x2f18('0x5'));var interaction=require(_0x2f18('0x6'));var config=require(_0x2f18('0x7'));var controller=require(_0x2f18('0x8'));router[_0x2f18('0x9')]('/',auth[_0x2f18('0xa')](),controller[_0x2f18('0xb')]);router[_0x2f18('0x9')](_0x2f18('0xc'),auth[_0x2f18('0xa')](),controller[_0x2f18('0xd')]);router['get'](_0x2f18('0xe'),auth['isAuthenticated'](),controller[_0x2f18('0xf')]);router[_0x2f18('0x9')](_0x2f18('0x10'),auth[_0x2f18('0xa')](),controller[_0x2f18('0x11')]);router[_0x2f18('0x9')](_0x2f18('0x12'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x2f18('0x13')]('/',auth['isAuthenticated'](),controller[_0x2f18('0x14')]);router[_0x2f18('0x15')](_0x2f18('0xc'),auth[_0x2f18('0xa')](),controller[_0x2f18('0x16')]);router[_0x2f18('0x17')](_0x2f18('0xc'),auth[_0x2f18('0xa')](),controller[_0x2f18('0x18')]);module['exports']=router; \ No newline at end of file +var _0x6a36=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0x53eeac,_0x1babff){var _0x41dddf=function(_0x2e8176){while(--_0x2e8176){_0x53eeac['push'](_0x53eeac['shift']());}};_0x41dddf(++_0x1babff);}(_0x6a36,0x17a));var _0x66a3=function(_0x330651,_0x1d41c2){_0x330651=_0x330651-0x0;var _0x24b0f1=_0x6a36[_0x330651];return _0x24b0f1;};'use strict';var multer=require(_0x66a3('0x0'));var util=require(_0x66a3('0x1'));var path=require(_0x66a3('0x2'));var timeout=require(_0x66a3('0x3'));var express=require('express');var router=express[_0x66a3('0x4')]();var fs_extra=require(_0x66a3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x66a3('0x6'));var config=require('../../config/environment');var controller=require(_0x66a3('0x7'));router[_0x66a3('0x8')]('/',auth[_0x66a3('0x9')](),controller[_0x66a3('0xa')]);router[_0x66a3('0x8')](_0x66a3('0xb'),auth[_0x66a3('0x9')](),controller['show']);router[_0x66a3('0x8')](_0x66a3('0xc'),auth['isAuthenticated'](),controller[_0x66a3('0xd')]);router[_0x66a3('0x8')](_0x66a3('0xe'),auth[_0x66a3('0x9')](),controller[_0x66a3('0xf')]);router['get'](_0x66a3('0x10'),auth[_0x66a3('0x9')](),controller[_0x66a3('0x11')]);router[_0x66a3('0x12')]('/',auth['isAuthenticated'](),controller[_0x66a3('0x13')]);router[_0x66a3('0x14')](_0x66a3('0xb'),auth['isAuthenticated'](),controller[_0x66a3('0x15')]);router[_0x66a3('0x16')](_0x66a3('0xb'),auth[_0x66a3('0x9')](),controller[_0x66a3('0x17')]);module[_0x66a3('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 2f1ce24..93227de 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 _0xe81d=['STRING','sequelize','exports'];(function(_0x490add,_0x46c6a0){var _0x281822=function(_0x42637){while(--_0x42637){_0x490add['push'](_0x490add['shift']());}};_0x281822(++_0x46c6a0);}(_0xe81d,0x15a));var _0xde81=function(_0x207463,_0x3c3bc9){_0x207463=_0x207463-0x0;var _0x3bddbd=_0xe81d[_0x207463];return _0x3bddbd;};'use strict';var Sequelize=require(_0xde81('0x0'));module[_0xde81('0x1')]={'name':{'type':Sequelize[_0xde81('0x2')]},'description':{'type':Sequelize[_0xde81('0x2')]}}; \ No newline at end of file +var _0x1907=['STRING','sequelize','exports'];(function(_0x2acd9a,_0xeea071){var _0x11c695=function(_0x3af365){while(--_0x3af365){_0x2acd9a['push'](_0x2acd9a['shift']());}};_0x11c695(++_0xeea071);}(_0x1907,0x172));var _0x7190=function(_0x580fe5,_0x5a7b4a){_0x580fe5=_0x580fe5-0x0;var _0x5a8770=_0x1907[_0x580fe5];return _0x5a8770;};'use strict';var Sequelize=require(_0x7190('0x0'));module[_0x7190('0x1')]={'name':{'type':Sequelize[_0x7190('0x2')]},'description':{'type':Sequelize[_0x7190('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index c60ec5e..e141424 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 _0x3316=['options','where','VtigerConfiguration','includeAll','include','findAll','rows','catch','show','length','create','body','find','getFields','VtigerField','order','hasOwnProperty','getSubjects','params','getDescriptions','findOne','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','stack','name','status','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','filter','merge','VIRTUAL'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3316,0x161));var _0x6331=function(_0x19c5f2,_0x44ed13){_0x19c5f2=_0x19c5f2-0x0;var _0xb94caf=_0x3316[_0x19c5f2];return _0xb94caf;};'use strict';var emlformat=require(_0x6331('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6331('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6331('0x2'));var moment=require(_0x6331('0x3'));var BPromise=require(_0x6331('0x4'));var Mustache=require(_0x6331('0x5'));var util=require(_0x6331('0x6'));var path=require('path');var sox=require(_0x6331('0x7'));var csv=require(_0x6331('0x8'));var ejs=require(_0x6331('0x9'));var fs=require('fs');var fs_extra=require(_0x6331('0xa'));var _=require(_0x6331('0xb'));var squel=require(_0x6331('0xc'));var crypto=require(_0x6331('0xd'));var jsforce=require(_0x6331('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6331('0x8'));var querystring=require(_0x6331('0xf'));var Papa=require(_0x6331('0x10'));var Redis=require(_0x6331('0x11'));var authService=require(_0x6331('0x12'));var qs=require(_0x6331('0x13'));var as=require(_0x6331('0x14'));var hardwareService=require(_0x6331('0x15'));var logger=require(_0x6331('0x16'))(_0x6331('0x17'));var utils=require('../../config/utils');var config=require(_0x6331('0x18'));var licenseUtil=require(_0x6331('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x494b8d,_0x3ba8a5){_0x3ba8a5=_0x3ba8a5||0xcc;return function(_0x25952e){if(_0x25952e){return _0x494b8d[_0x6331('0x1a')](_0x3ba8a5);}return _0x494b8d['status'](_0x3ba8a5)[_0x6331('0x1b')]();};}function respondWithResult(_0x3a931c,_0x29d63d){_0x29d63d=_0x29d63d||0xc8;return function(_0x5fd2bc){if(_0x5fd2bc){return _0x3a931c['status'](_0x29d63d)[_0x6331('0x1c')](_0x5fd2bc);}};}function respondWithFilteredResult(_0x964e38,_0x35481a){return function(_0x230e09){if(_0x230e09){var _0x59e02a=typeof _0x35481a[_0x6331('0x1d')]===_0x6331('0x1e')&&typeof _0x35481a[_0x6331('0x1f')]===_0x6331('0x1e');var _0x540eb5=_0x230e09[_0x6331('0x20')];var _0x5c345c=_0x59e02a?0x0:_0x35481a[_0x6331('0x1d')];var _0x3a78b5=_0x59e02a?_0x230e09['count']:_0x35481a[_0x6331('0x1d')]+_0x35481a['limit'];var _0x1cdcbe;if(_0x3a78b5>=_0x540eb5){_0x3a78b5=_0x540eb5;_0x1cdcbe=0xc8;}else{_0x1cdcbe=0xce;}_0x964e38['status'](_0x1cdcbe);return _0x964e38[_0x6331('0x21')](_0x6331('0x22'),_0x5c345c+'-'+_0x3a78b5+'/'+_0x540eb5)[_0x6331('0x1c')](_0x230e09);}return null;};}function patchUpdates(_0x31737c){return function(_0x194191){try{jsonpatch[_0x6331('0x23')](_0x194191,_0x31737c,!![]);}catch(_0x5a0af9){return BPromise['reject'](_0x5a0af9);}return _0x194191[_0x6331('0x24')]();};}function saveUpdates(_0x182804,_0x6279e3){return function(_0xdeda92){if(_0xdeda92){return _0xdeda92[_0x6331('0x25')](_0x182804)['then'](function(_0x57bc68){return _0x57bc68;});}return null;};}function removeEntity(_0x391a54,_0x349e5f){return function(_0x342e3b){if(_0x342e3b){return _0x342e3b[_0x6331('0x26')]()[_0x6331('0x27')](function(){_0x391a54['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20132e,_0x54883d){return function(_0x371c75){if(!_0x371c75){_0x20132e[_0x6331('0x1a')](0x194);}return _0x371c75;};}function handleError(_0xce215c,_0x2e533b){_0x2e533b=_0x2e533b||0x1f4;return function(_0x51a69d){logger['error'](_0x51a69d[_0x6331('0x28')]);if(_0x51a69d[_0x6331('0x29')]){delete _0x51a69d[_0x6331('0x29')];}_0xce215c[_0x6331('0x2a')](_0x2e533b)['send'](_0x51a69d);};}exports[_0x6331('0x2b')]=function(_0x58bbe4,_0x155978){var _0x260656={},_0x2a0a21={},_0xc9cf16={'count':0x0,'rows':[]};var _0x1b7093=_[_0x6331('0x2c')](db['VtigerConfiguration'][_0x6331('0x2d')],function(_0x439f94){return{'name':_0x439f94[_0x6331('0x2e')],'type':_0x439f94[_0x6331('0x2f')][_0x6331('0x30')]};});_0x2a0a21[_0x6331('0x31')]=_['map'](_0x1b7093,'name');_0x2a0a21[_0x6331('0x32')]=_[_0x6331('0x33')](_0x58bbe4[_0x6331('0x32')]);_0x2a0a21[_0x6331('0x34')]=_[_0x6331('0x35')](_0x2a0a21[_0x6331('0x31')],_0x2a0a21[_0x6331('0x32')]);_0x260656[_0x6331('0x36')]=_[_0x6331('0x35')](_0x2a0a21[_0x6331('0x31')],qs[_0x6331('0x37')](_0x58bbe4['query'][_0x6331('0x37')]));_0x260656[_0x6331('0x36')]=_0x260656[_0x6331('0x36')]['length']?_0x260656[_0x6331('0x36')]:_0x2a0a21[_0x6331('0x31')];if(!_0x58bbe4[_0x6331('0x32')]['hasOwnProperty'](_0x6331('0x38'))){_0x260656['limit']=qs['limit'](_0x58bbe4[_0x6331('0x32')][_0x6331('0x1f')]);_0x260656['offset']=qs['offset'](_0x58bbe4[_0x6331('0x32')][_0x6331('0x1d')]);}_0x260656['order']=qs[_0x6331('0x39')](_0x58bbe4[_0x6331('0x32')][_0x6331('0x39')]);_0x260656['where']=qs[_0x6331('0x34')](_[_0x6331('0x3a')](_0x58bbe4[_0x6331('0x32')],_0x2a0a21[_0x6331('0x34')]),_0x1b7093);if(_0x58bbe4[_0x6331('0x32')][_0x6331('0x3b')]){_0x260656['where']=_[_0x6331('0x3c')](_0x260656['where'],{'$or':_[_0x6331('0x2c')](_0x1b7093,function(_0x313a7f){if(_0x313a7f[_0x6331('0x2f')]!==_0x6331('0x3d')){var _0x3c1866={};_0x3c1866[_0x313a7f['name']]={'$like':'%'+_0x58bbe4[_0x6331('0x32')][_0x6331('0x3b')]+'%'};return _0x3c1866;}})});}_0x260656=_[_0x6331('0x3c')]({},_0x260656,_0x58bbe4[_0x6331('0x3e')]);var _0x2ae985={'where':_0x260656[_0x6331('0x3f')]};return db[_0x6331('0x40')]['count'](_0x2ae985)[_0x6331('0x27')](function(_0x349a8d){_0xc9cf16[_0x6331('0x20')]=_0x349a8d;if(_0x58bbe4[_0x6331('0x32')][_0x6331('0x41')]){_0x260656[_0x6331('0x42')]=[{'all':!![]}];}return db[_0x6331('0x40')][_0x6331('0x43')](_0x260656);})['then'](function(_0x36cade){_0xc9cf16[_0x6331('0x44')]=_0x36cade;return _0xc9cf16;})['then'](respondWithFilteredResult(_0x155978,_0x260656))[_0x6331('0x45')](handleError(_0x155978,null));};exports[_0x6331('0x46')]=function(_0x25a49c,_0x3725ea){var _0x3bf3ea={'raw':![],'where':{'id':_0x25a49c['params']['id']}},_0x4d4e3d={};_0x4d4e3d[_0x6331('0x31')]=_[_0x6331('0x33')](db[_0x6331('0x40')][_0x6331('0x2d')]);_0x4d4e3d[_0x6331('0x32')]=_[_0x6331('0x33')](_0x25a49c[_0x6331('0x32')]);_0x4d4e3d[_0x6331('0x34')]=_[_0x6331('0x35')](_0x4d4e3d['model'],_0x4d4e3d[_0x6331('0x32')]);_0x3bf3ea['attributes']=_[_0x6331('0x35')](_0x4d4e3d[_0x6331('0x31')],qs[_0x6331('0x37')](_0x25a49c[_0x6331('0x32')]['fields']));_0x3bf3ea[_0x6331('0x36')]=_0x3bf3ea['attributes'][_0x6331('0x47')]?_0x3bf3ea['attributes']:_0x4d4e3d[_0x6331('0x31')];if(_0x25a49c[_0x6331('0x32')][_0x6331('0x41')]){_0x3bf3ea[_0x6331('0x42')]=[{'all':!![]}];}_0x3bf3ea=_[_0x6331('0x3c')]({},_0x3bf3ea,_0x25a49c[_0x6331('0x3e')]);return db[_0x6331('0x40')]['find'](_0x3bf3ea)[_0x6331('0x27')](handleEntityNotFound(_0x3725ea,null))[_0x6331('0x27')](respondWithResult(_0x3725ea,null))['catch'](handleError(_0x3725ea,null));};exports[_0x6331('0x48')]=function(_0x29dfc4,_0x3c3324){return db[_0x6331('0x40')][_0x6331('0x48')](_0x29dfc4[_0x6331('0x49')],{})[_0x6331('0x27')](respondWithResult(_0x3c3324,0xc9))[_0x6331('0x45')](handleError(_0x3c3324,null));};exports[_0x6331('0x25')]=function(_0x387f86,_0x2bf420){if(_0x387f86[_0x6331('0x49')]['id']){delete _0x387f86[_0x6331('0x49')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x387f86['params']['id']}})['then'](handleEntityNotFound(_0x2bf420,null))[_0x6331('0x27')](saveUpdates(_0x387f86['body'],null))[_0x6331('0x27')](respondWithResult(_0x2bf420,null))[_0x6331('0x45')](handleError(_0x2bf420,null));};exports['destroy']=function(_0x529a5f,_0x45ed59){return db[_0x6331('0x40')][_0x6331('0x4a')]({'where':{'id':_0x529a5f['params']['id']}})[_0x6331('0x27')](handleEntityNotFound(_0x45ed59,null))['then'](removeEntity(_0x45ed59,null))[_0x6331('0x45')](handleError(_0x45ed59,null));};exports[_0x6331('0x4b')]=function(_0x554fb1,_0x28cfb5,_0x8e35ea){var _0x21c7c8={};var _0x22d47e={};var _0x2593a8;var _0x19389b;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x554fb1['params']['id']}})[_0x6331('0x27')](handleEntityNotFound(_0x28cfb5,null))[_0x6331('0x27')](function(_0x1bcc9f){if(_0x1bcc9f){_0x2593a8=_0x1bcc9f;_0x22d47e['model']=_['keys'](db[_0x6331('0x4c')]['rawAttributes']);_0x22d47e['query']=_[_0x6331('0x33')](_0x554fb1[_0x6331('0x32')]);_0x22d47e[_0x6331('0x34')]=_[_0x6331('0x35')](_0x22d47e[_0x6331('0x31')],_0x22d47e[_0x6331('0x32')]);_0x21c7c8[_0x6331('0x36')]=_[_0x6331('0x35')](_0x22d47e[_0x6331('0x31')],qs[_0x6331('0x37')](_0x554fb1['query'][_0x6331('0x37')]));_0x21c7c8[_0x6331('0x36')]=_0x21c7c8[_0x6331('0x36')][_0x6331('0x47')]?_0x21c7c8[_0x6331('0x36')]:_0x22d47e[_0x6331('0x31')];_0x21c7c8[_0x6331('0x4d')]=qs['sort'](_0x554fb1[_0x6331('0x32')][_0x6331('0x39')]);_0x21c7c8['where']=qs[_0x6331('0x34')](_[_0x6331('0x3a')](_0x554fb1[_0x6331('0x32')],_0x22d47e[_0x6331('0x34')]));if(_0x554fb1[_0x6331('0x32')]['filter']){_0x21c7c8['where']=_['merge'](_0x21c7c8[_0x6331('0x3f')],{'$or':_['map'](_0x21c7c8[_0x6331('0x36')],function(_0xe1a2){var _0x14bd5b={};_0x14bd5b[_0xe1a2]={'$like':'%'+_0x554fb1[_0x6331('0x32')][_0x6331('0x3b')]+'%'};return _0x14bd5b;})});}_0x21c7c8=_['merge']({},_0x21c7c8,_0x554fb1[_0x6331('0x3e')]);return _0x2593a8[_0x6331('0x4b')](_0x21c7c8);}})[_0x6331('0x27')](function(_0x330fee){if(_0x330fee){_0x19389b=_0x330fee['length'];if(!_0x554fb1[_0x6331('0x32')][_0x6331('0x4e')](_0x6331('0x38'))){_0x21c7c8[_0x6331('0x1f')]=qs[_0x6331('0x1f')](_0x554fb1[_0x6331('0x32')][_0x6331('0x1f')]);_0x21c7c8['offset']=qs[_0x6331('0x1d')](_0x554fb1[_0x6331('0x32')]['offset']);}return _0x2593a8[_0x6331('0x4b')](_0x21c7c8);}})['then'](function(_0x36f16a){if(_0x36f16a){return _0x36f16a?{'count':_0x19389b,'rows':_0x36f16a}:null;}})[_0x6331('0x27')](respondWithResult(_0x28cfb5,null))[_0x6331('0x45')](handleError(_0x28cfb5,null));};exports[_0x6331('0x4f')]=function(_0x278102,_0x20d930,_0x209b98){var _0x5e85b5={};var _0x5e6cb4={};var _0x5b1c2e;var _0x5bc97b;return db[_0x6331('0x40')]['findOne']({'where':{'id':_0x278102[_0x6331('0x50')]['id']}})[_0x6331('0x27')](handleEntityNotFound(_0x20d930,null))[_0x6331('0x27')](function(_0x2181d0){if(_0x2181d0){_0x5b1c2e=_0x2181d0;_0x5e6cb4['model']=_[_0x6331('0x33')](db['VtigerField'][_0x6331('0x2d')]);_0x5e6cb4[_0x6331('0x32')]=_[_0x6331('0x33')](_0x278102[_0x6331('0x32')]);_0x5e6cb4[_0x6331('0x34')]=_[_0x6331('0x35')](_0x5e6cb4['model'],_0x5e6cb4[_0x6331('0x32')]);_0x5e85b5[_0x6331('0x36')]=_[_0x6331('0x35')](_0x5e6cb4[_0x6331('0x31')],qs['fields'](_0x278102[_0x6331('0x32')][_0x6331('0x37')]));_0x5e85b5[_0x6331('0x36')]=_0x5e85b5[_0x6331('0x36')]['length']?_0x5e85b5[_0x6331('0x36')]:_0x5e6cb4[_0x6331('0x31')];_0x5e85b5[_0x6331('0x4d')]=qs[_0x6331('0x39')](_0x278102[_0x6331('0x32')][_0x6331('0x39')]);_0x5e85b5[_0x6331('0x3f')]=qs['filters'](_['pick'](_0x278102[_0x6331('0x32')],_0x5e6cb4[_0x6331('0x34')]));if(_0x278102[_0x6331('0x32')][_0x6331('0x3b')]){_0x5e85b5[_0x6331('0x3f')]=_['merge'](_0x5e85b5[_0x6331('0x3f')],{'$or':_['map'](_0x5e85b5[_0x6331('0x36')],function(_0x1f9e9b){var _0x387e41={};_0x387e41[_0x1f9e9b]={'$like':'%'+_0x278102[_0x6331('0x32')][_0x6331('0x3b')]+'%'};return _0x387e41;})});}_0x5e85b5=_[_0x6331('0x3c')]({},_0x5e85b5,_0x278102[_0x6331('0x3e')]);return _0x5b1c2e[_0x6331('0x4f')](_0x5e85b5);}})[_0x6331('0x27')](function(_0x3812e6){if(_0x3812e6){_0x5bc97b=_0x3812e6[_0x6331('0x47')];if(!_0x278102[_0x6331('0x32')][_0x6331('0x4e')](_0x6331('0x38'))){_0x5e85b5[_0x6331('0x1f')]=qs[_0x6331('0x1f')](_0x278102[_0x6331('0x32')][_0x6331('0x1f')]);_0x5e85b5['offset']=qs[_0x6331('0x1d')](_0x278102[_0x6331('0x32')]['offset']);}return _0x5b1c2e[_0x6331('0x4f')](_0x5e85b5);}})['then'](function(_0x20e904){if(_0x20e904){return _0x20e904?{'count':_0x5bc97b,'rows':_0x20e904}:null;}})[_0x6331('0x27')](respondWithResult(_0x20d930,null))['catch'](handleError(_0x20d930,null));};exports[_0x6331('0x51')]=function(_0x5ef010,_0x354e74,_0xf06e10){var _0x23ddac={};var _0xd8208c={};var _0x41aaca;var _0x56ee42;return db[_0x6331('0x40')][_0x6331('0x52')]({'where':{'id':_0x5ef010[_0x6331('0x50')]['id']}})[_0x6331('0x27')](handleEntityNotFound(_0x354e74,null))[_0x6331('0x27')](function(_0x313b80){if(_0x313b80){_0x41aaca=_0x313b80;_0xd8208c['model']=_['keys'](db['VtigerField'][_0x6331('0x2d')]);_0xd8208c[_0x6331('0x32')]=_[_0x6331('0x33')](_0x5ef010[_0x6331('0x32')]);_0xd8208c['filters']=_[_0x6331('0x35')](_0xd8208c['model'],_0xd8208c[_0x6331('0x32')]);_0x23ddac['attributes']=_['intersection'](_0xd8208c[_0x6331('0x31')],qs['fields'](_0x5ef010[_0x6331('0x32')][_0x6331('0x37')]));_0x23ddac[_0x6331('0x36')]=_0x23ddac[_0x6331('0x36')]['length']?_0x23ddac['attributes']:_0xd8208c[_0x6331('0x31')];_0x23ddac[_0x6331('0x4d')]=qs[_0x6331('0x39')](_0x5ef010[_0x6331('0x32')][_0x6331('0x39')]);_0x23ddac[_0x6331('0x3f')]=qs[_0x6331('0x34')](_[_0x6331('0x3a')](_0x5ef010[_0x6331('0x32')],_0xd8208c['filters']));if(_0x5ef010[_0x6331('0x32')]['filter']){_0x23ddac[_0x6331('0x3f')]=_[_0x6331('0x3c')](_0x23ddac[_0x6331('0x3f')],{'$or':_['map'](_0x23ddac[_0x6331('0x36')],function(_0x109814){var _0x1fd67a={};_0x1fd67a[_0x109814]={'$like':'%'+_0x5ef010[_0x6331('0x32')][_0x6331('0x3b')]+'%'};return _0x1fd67a;})});}_0x23ddac=_[_0x6331('0x3c')]({},_0x23ddac,_0x5ef010[_0x6331('0x3e')]);return _0x41aaca[_0x6331('0x51')](_0x23ddac);}})[_0x6331('0x27')](function(_0x2fa906){if(_0x2fa906){_0x56ee42=_0x2fa906[_0x6331('0x47')];if(!_0x5ef010[_0x6331('0x32')][_0x6331('0x4e')](_0x6331('0x38'))){_0x23ddac['limit']=qs[_0x6331('0x1f')](_0x5ef010[_0x6331('0x32')]['limit']);_0x23ddac[_0x6331('0x1d')]=qs[_0x6331('0x1d')](_0x5ef010[_0x6331('0x32')][_0x6331('0x1d')]);}return _0x41aaca[_0x6331('0x51')](_0x23ddac);}})[_0x6331('0x27')](function(_0x4ad292){if(_0x4ad292){return _0x4ad292?{'count':_0x56ee42,'rows':_0x4ad292}:null;}})[_0x6331('0x27')](respondWithResult(_0x354e74,null))[_0x6331('0x45')](handleError(_0x354e74,null));}; \ No newline at end of file +var _0xf4af=['getFields','findOne','VtigerField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','name','send','index','map','VtigerConfiguration','fieldName','key','keys','query','filters','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','rows','show','params','rawAttributes','intersection','include','find','catch','create','body'];(function(_0x4a8c57,_0x419a69){var _0x3b1d79=function(_0x287baf){while(--_0x287baf){_0x4a8c57['push'](_0x4a8c57['shift']());}};_0x3b1d79(++_0x419a69);}(_0xf4af,0xa4));var _0xff4a=function(_0x569560,_0x16b989){_0x569560=_0x569560-0x0;var _0x3c1de0=_0xf4af[_0x569560];return _0x3c1de0;};'use strict';var emlformat=require(_0xff4a('0x0'));var rimraf=require(_0xff4a('0x1'));var zipdir=require(_0xff4a('0x2'));var jsonpatch=require(_0xff4a('0x3'));var rp=require(_0xff4a('0x4'));var moment=require(_0xff4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xff4a('0x6'));var path=require(_0xff4a('0x7'));var sox=require(_0xff4a('0x8'));var csv=require('to-csv');var ejs=require(_0xff4a('0x9'));var fs=require('fs');var fs_extra=require(_0xff4a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xff4a('0xb'));var jsforce=require(_0xff4a('0xc'));var deskjs=require(_0xff4a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xff4a('0xe'));var Papa=require(_0xff4a('0xf'));var Redis=require(_0xff4a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xff4a('0x11'));var as=require(_0xff4a('0x12'));var hardwareService=require(_0xff4a('0x13'));var logger=require(_0xff4a('0x14'))(_0xff4a('0x15'));var utils=require(_0xff4a('0x16'));var config=require(_0xff4a('0x17'));var licenseUtil=require(_0xff4a('0x18'));var db=require(_0xff4a('0x19'))['db'];function respondWithStatusCode(_0x17aa02,_0x3d4ef6){_0x3d4ef6=_0x3d4ef6||0xcc;return function(_0x20b189){if(_0x20b189){return _0x17aa02[_0xff4a('0x1a')](_0x3d4ef6);}return _0x17aa02[_0xff4a('0x1b')](_0x3d4ef6)['end']();};}function respondWithResult(_0x368ac4,_0x25a4e5){_0x25a4e5=_0x25a4e5||0xc8;return function(_0x53ab62){if(_0x53ab62){return _0x368ac4[_0xff4a('0x1b')](_0x25a4e5)[_0xff4a('0x1c')](_0x53ab62);}};}function respondWithFilteredResult(_0x254ce5,_0x5a9635){return function(_0x12d6e2){if(_0x12d6e2){var _0x562042=typeof _0x5a9635[_0xff4a('0x1d')]===_0xff4a('0x1e')&&typeof _0x5a9635[_0xff4a('0x1f')]===_0xff4a('0x1e');var _0x188a5b=_0x12d6e2[_0xff4a('0x20')];var _0x4839d7=_0x562042?0x0:_0x5a9635['offset'];var _0x16fc3a=_0x562042?_0x12d6e2[_0xff4a('0x20')]:_0x5a9635[_0xff4a('0x1d')]+_0x5a9635[_0xff4a('0x1f')];var _0x580f80;if(_0x16fc3a>=_0x188a5b){_0x16fc3a=_0x188a5b;_0x580f80=0xc8;}else{_0x580f80=0xce;}_0x254ce5[_0xff4a('0x1b')](_0x580f80);return _0x254ce5['set'](_0xff4a('0x21'),_0x4839d7+'-'+_0x16fc3a+'/'+_0x188a5b)[_0xff4a('0x1c')](_0x12d6e2);}return null;};}function patchUpdates(_0x41f929){return function(_0x5f2cc3){try{jsonpatch[_0xff4a('0x22')](_0x5f2cc3,_0x41f929,!![]);}catch(_0x228cac){return BPromise[_0xff4a('0x23')](_0x228cac);}return _0x5f2cc3['save']();};}function saveUpdates(_0x5e3d9d,_0x5ce7a7){return function(_0x4862ce){if(_0x4862ce){return _0x4862ce[_0xff4a('0x24')](_0x5e3d9d)[_0xff4a('0x25')](function(_0x81ba7b){return _0x81ba7b;});}return null;};}function removeEntity(_0x1171a0,_0xb6a276){return function(_0x238805){if(_0x238805){return _0x238805[_0xff4a('0x26')]()[_0xff4a('0x25')](function(){_0x1171a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x597e3a,_0x5a4d3e){return function(_0xf03d99){if(!_0xf03d99){_0x597e3a[_0xff4a('0x1a')](0x194);}return _0xf03d99;};}function handleError(_0x25bc2c,_0x286f94){_0x286f94=_0x286f94||0x1f4;return function(_0x35e25f){logger['error'](_0x35e25f['stack']);if(_0x35e25f[_0xff4a('0x27')]){delete _0x35e25f[_0xff4a('0x27')];}_0x25bc2c[_0xff4a('0x1b')](_0x286f94)[_0xff4a('0x28')](_0x35e25f);};}exports[_0xff4a('0x29')]=function(_0x3718e3,_0x3c880a){var _0x3ef953={},_0x192448={},_0x4cd8ad={'count':0x0,'rows':[]};var _0x3c5fa6=_[_0xff4a('0x2a')](db[_0xff4a('0x2b')]['rawAttributes'],function(_0x157761){return{'name':_0x157761[_0xff4a('0x2c')],'type':_0x157761['type'][_0xff4a('0x2d')]};});_0x192448['model']=_[_0xff4a('0x2a')](_0x3c5fa6,_0xff4a('0x27'));_0x192448['query']=_[_0xff4a('0x2e')](_0x3718e3[_0xff4a('0x2f')]);_0x192448[_0xff4a('0x30')]=_['intersection'](_0x192448[_0xff4a('0x31')],_0x192448[_0xff4a('0x2f')]);_0x3ef953[_0xff4a('0x32')]=_['intersection'](_0x192448[_0xff4a('0x31')],qs[_0xff4a('0x33')](_0x3718e3[_0xff4a('0x2f')]['fields']));_0x3ef953[_0xff4a('0x32')]=_0x3ef953[_0xff4a('0x32')][_0xff4a('0x34')]?_0x3ef953[_0xff4a('0x32')]:_0x192448[_0xff4a('0x31')];if(!_0x3718e3[_0xff4a('0x2f')]['hasOwnProperty'](_0xff4a('0x35'))){_0x3ef953['limit']=qs[_0xff4a('0x1f')](_0x3718e3[_0xff4a('0x2f')][_0xff4a('0x1f')]);_0x3ef953[_0xff4a('0x1d')]=qs[_0xff4a('0x1d')](_0x3718e3['query'][_0xff4a('0x1d')]);}_0x3ef953[_0xff4a('0x36')]=qs['sort'](_0x3718e3[_0xff4a('0x2f')][_0xff4a('0x37')]);_0x3ef953['where']=qs['filters'](_[_0xff4a('0x38')](_0x3718e3['query'],_0x192448[_0xff4a('0x30')]),_0x3c5fa6);if(_0x3718e3[_0xff4a('0x2f')][_0xff4a('0x39')]){_0x3ef953[_0xff4a('0x3a')]=_[_0xff4a('0x3b')](_0x3ef953['where'],{'$or':_[_0xff4a('0x2a')](_0x3c5fa6,function(_0x10a7d8){if(_0x10a7d8[_0xff4a('0x3c')]!=='VIRTUAL'){var _0xea489a={};_0xea489a[_0x10a7d8[_0xff4a('0x27')]]={'$like':'%'+_0x3718e3[_0xff4a('0x2f')]['filter']+'%'};return _0xea489a;}})});}_0x3ef953=_['merge']({},_0x3ef953,_0x3718e3[_0xff4a('0x3d')]);var _0x20f072={'where':_0x3ef953[_0xff4a('0x3a')]};return db[_0xff4a('0x2b')][_0xff4a('0x20')](_0x20f072)[_0xff4a('0x25')](function(_0x3c4875){_0x4cd8ad[_0xff4a('0x20')]=_0x3c4875;if(_0x3718e3[_0xff4a('0x2f')][_0xff4a('0x3e')]){_0x3ef953['include']=[{'all':!![]}];}return db[_0xff4a('0x2b')]['findAll'](_0x3ef953);})[_0xff4a('0x25')](function(_0x21d5fb){_0x4cd8ad[_0xff4a('0x3f')]=_0x21d5fb;return _0x4cd8ad;})[_0xff4a('0x25')](respondWithFilteredResult(_0x3c880a,_0x3ef953))['catch'](handleError(_0x3c880a,null));};exports[_0xff4a('0x40')]=function(_0x3ea751,_0x15d083){var _0xa633bd={'raw':![],'where':{'id':_0x3ea751[_0xff4a('0x41')]['id']}},_0x5eadfd={};_0x5eadfd['model']=_[_0xff4a('0x2e')](db[_0xff4a('0x2b')][_0xff4a('0x42')]);_0x5eadfd[_0xff4a('0x2f')]=_[_0xff4a('0x2e')](_0x3ea751[_0xff4a('0x2f')]);_0x5eadfd[_0xff4a('0x30')]=_[_0xff4a('0x43')](_0x5eadfd[_0xff4a('0x31')],_0x5eadfd[_0xff4a('0x2f')]);_0xa633bd['attributes']=_['intersection'](_0x5eadfd[_0xff4a('0x31')],qs[_0xff4a('0x33')](_0x3ea751['query']['fields']));_0xa633bd[_0xff4a('0x32')]=_0xa633bd[_0xff4a('0x32')][_0xff4a('0x34')]?_0xa633bd['attributes']:_0x5eadfd[_0xff4a('0x31')];if(_0x3ea751[_0xff4a('0x2f')]['includeAll']){_0xa633bd[_0xff4a('0x44')]=[{'all':!![]}];}_0xa633bd=_['merge']({},_0xa633bd,_0x3ea751[_0xff4a('0x3d')]);return db['VtigerConfiguration'][_0xff4a('0x45')](_0xa633bd)[_0xff4a('0x25')](handleEntityNotFound(_0x15d083,null))[_0xff4a('0x25')](respondWithResult(_0x15d083,null))[_0xff4a('0x46')](handleError(_0x15d083,null));};exports[_0xff4a('0x47')]=function(_0x20ea74,_0x456291){return db[_0xff4a('0x2b')][_0xff4a('0x47')](_0x20ea74[_0xff4a('0x48')],{})[_0xff4a('0x25')](respondWithResult(_0x456291,0xc9))['catch'](handleError(_0x456291,null));};exports[_0xff4a('0x24')]=function(_0x2ec155,_0x191c3b){if(_0x2ec155[_0xff4a('0x48')]['id']){delete _0x2ec155[_0xff4a('0x48')]['id'];}return db[_0xff4a('0x2b')][_0xff4a('0x45')]({'where':{'id':_0x2ec155[_0xff4a('0x41')]['id']}})[_0xff4a('0x25')](handleEntityNotFound(_0x191c3b,null))[_0xff4a('0x25')](saveUpdates(_0x2ec155['body'],null))[_0xff4a('0x25')](respondWithResult(_0x191c3b,null))['catch'](handleError(_0x191c3b,null));};exports[_0xff4a('0x26')]=function(_0x90780b,_0x56f64a){return db['VtigerConfiguration'][_0xff4a('0x45')]({'where':{'id':_0x90780b[_0xff4a('0x41')]['id']}})[_0xff4a('0x25')](handleEntityNotFound(_0x56f64a,null))[_0xff4a('0x25')](removeEntity(_0x56f64a,null))[_0xff4a('0x46')](handleError(_0x56f64a,null));};exports[_0xff4a('0x49')]=function(_0x5811f7,_0x2e918c,_0x300fba){var _0x6468a={};var _0x5a18fb={};var _0x3a35e7;var _0x2d541e;return db[_0xff4a('0x2b')][_0xff4a('0x4a')]({'where':{'id':_0x5811f7[_0xff4a('0x41')]['id']}})[_0xff4a('0x25')](handleEntityNotFound(_0x2e918c,null))['then'](function(_0x2364f2){if(_0x2364f2){_0x3a35e7=_0x2364f2;_0x5a18fb[_0xff4a('0x31')]=_[_0xff4a('0x2e')](db[_0xff4a('0x4b')][_0xff4a('0x42')]);_0x5a18fb[_0xff4a('0x2f')]=_[_0xff4a('0x2e')](_0x5811f7['query']);_0x5a18fb[_0xff4a('0x30')]=_['intersection'](_0x5a18fb[_0xff4a('0x31')],_0x5a18fb['query']);_0x6468a[_0xff4a('0x32')]=_[_0xff4a('0x43')](_0x5a18fb[_0xff4a('0x31')],qs['fields'](_0x5811f7['query'][_0xff4a('0x33')]));_0x6468a[_0xff4a('0x32')]=_0x6468a[_0xff4a('0x32')][_0xff4a('0x34')]?_0x6468a[_0xff4a('0x32')]:_0x5a18fb[_0xff4a('0x31')];_0x6468a['order']=qs[_0xff4a('0x37')](_0x5811f7[_0xff4a('0x2f')][_0xff4a('0x37')]);_0x6468a['where']=qs[_0xff4a('0x30')](_[_0xff4a('0x38')](_0x5811f7['query'],_0x5a18fb[_0xff4a('0x30')]));if(_0x5811f7[_0xff4a('0x2f')][_0xff4a('0x39')]){_0x6468a[_0xff4a('0x3a')]=_[_0xff4a('0x3b')](_0x6468a['where'],{'$or':_[_0xff4a('0x2a')](_0x6468a[_0xff4a('0x32')],function(_0x148f77){var _0x9ee828={};_0x9ee828[_0x148f77]={'$like':'%'+_0x5811f7['query']['filter']+'%'};return _0x9ee828;})});}_0x6468a=_[_0xff4a('0x3b')]({},_0x6468a,_0x5811f7[_0xff4a('0x3d')]);return _0x3a35e7[_0xff4a('0x49')](_0x6468a);}})['then'](function(_0x4d9ec3){if(_0x4d9ec3){_0x2d541e=_0x4d9ec3[_0xff4a('0x34')];if(!_0x5811f7[_0xff4a('0x2f')][_0xff4a('0x4c')](_0xff4a('0x35'))){_0x6468a['limit']=qs['limit'](_0x5811f7[_0xff4a('0x2f')][_0xff4a('0x1f')]);_0x6468a[_0xff4a('0x1d')]=qs[_0xff4a('0x1d')](_0x5811f7['query'][_0xff4a('0x1d')]);}return _0x3a35e7['getFields'](_0x6468a);}})[_0xff4a('0x25')](function(_0x41965e){if(_0x41965e){return _0x41965e?{'count':_0x2d541e,'rows':_0x41965e}:null;}})[_0xff4a('0x25')](respondWithResult(_0x2e918c,null))[_0xff4a('0x46')](handleError(_0x2e918c,null));};exports[_0xff4a('0x4d')]=function(_0x4b3eb0,_0x288647,_0x111f3a){var _0x4364e9={};var _0x4a97c1={};var _0x12dea0;var _0xee67bb;return db[_0xff4a('0x2b')][_0xff4a('0x4a')]({'where':{'id':_0x4b3eb0[_0xff4a('0x41')]['id']}})[_0xff4a('0x25')](handleEntityNotFound(_0x288647,null))['then'](function(_0x3c93a5){if(_0x3c93a5){_0x12dea0=_0x3c93a5;_0x4a97c1[_0xff4a('0x31')]=_[_0xff4a('0x2e')](db['VtigerField'][_0xff4a('0x42')]);_0x4a97c1[_0xff4a('0x2f')]=_[_0xff4a('0x2e')](_0x4b3eb0[_0xff4a('0x2f')]);_0x4a97c1['filters']=_[_0xff4a('0x43')](_0x4a97c1['model'],_0x4a97c1['query']);_0x4364e9[_0xff4a('0x32')]=_[_0xff4a('0x43')](_0x4a97c1['model'],qs['fields'](_0x4b3eb0[_0xff4a('0x2f')][_0xff4a('0x33')]));_0x4364e9[_0xff4a('0x32')]=_0x4364e9[_0xff4a('0x32')][_0xff4a('0x34')]?_0x4364e9[_0xff4a('0x32')]:_0x4a97c1['model'];_0x4364e9[_0xff4a('0x36')]=qs[_0xff4a('0x37')](_0x4b3eb0[_0xff4a('0x2f')][_0xff4a('0x37')]);_0x4364e9[_0xff4a('0x3a')]=qs[_0xff4a('0x30')](_[_0xff4a('0x38')](_0x4b3eb0[_0xff4a('0x2f')],_0x4a97c1[_0xff4a('0x30')]));if(_0x4b3eb0[_0xff4a('0x2f')]['filter']){_0x4364e9['where']=_[_0xff4a('0x3b')](_0x4364e9['where'],{'$or':_[_0xff4a('0x2a')](_0x4364e9[_0xff4a('0x32')],function(_0x1dd2cd){var _0x1860ed={};_0x1860ed[_0x1dd2cd]={'$like':'%'+_0x4b3eb0['query'][_0xff4a('0x39')]+'%'};return _0x1860ed;})});}_0x4364e9=_[_0xff4a('0x3b')]({},_0x4364e9,_0x4b3eb0[_0xff4a('0x3d')]);return _0x12dea0[_0xff4a('0x4d')](_0x4364e9);}})[_0xff4a('0x25')](function(_0x5c0ee9){if(_0x5c0ee9){_0xee67bb=_0x5c0ee9[_0xff4a('0x34')];if(!_0x4b3eb0[_0xff4a('0x2f')][_0xff4a('0x4c')](_0xff4a('0x35'))){_0x4364e9[_0xff4a('0x1f')]=qs[_0xff4a('0x1f')](_0x4b3eb0[_0xff4a('0x2f')][_0xff4a('0x1f')]);_0x4364e9[_0xff4a('0x1d')]=qs[_0xff4a('0x1d')](_0x4b3eb0[_0xff4a('0x2f')]['offset']);}return _0x12dea0['getSubjects'](_0x4364e9);}})[_0xff4a('0x25')](function(_0x482142){if(_0x482142){return _0x482142?{'count':_0xee67bb,'rows':_0x482142}:null;}})[_0xff4a('0x25')](respondWithResult(_0x288647,null))[_0xff4a('0x46')](handleError(_0x288647,null));};exports[_0xff4a('0x4e')]=function(_0x4dbd52,_0x2e8fcd,_0x4a4d50){var _0x1db230={};var _0x1634a2={};var _0x115d2d;var _0x5f4672;return db[_0xff4a('0x2b')][_0xff4a('0x4a')]({'where':{'id':_0x4dbd52[_0xff4a('0x41')]['id']}})[_0xff4a('0x25')](handleEntityNotFound(_0x2e8fcd,null))[_0xff4a('0x25')](function(_0x3a61b6){if(_0x3a61b6){_0x115d2d=_0x3a61b6;_0x1634a2[_0xff4a('0x31')]=_[_0xff4a('0x2e')](db[_0xff4a('0x4b')][_0xff4a('0x42')]);_0x1634a2['query']=_['keys'](_0x4dbd52[_0xff4a('0x2f')]);_0x1634a2['filters']=_[_0xff4a('0x43')](_0x1634a2[_0xff4a('0x31')],_0x1634a2[_0xff4a('0x2f')]);_0x1db230[_0xff4a('0x32')]=_[_0xff4a('0x43')](_0x1634a2[_0xff4a('0x31')],qs['fields'](_0x4dbd52[_0xff4a('0x2f')]['fields']));_0x1db230[_0xff4a('0x32')]=_0x1db230[_0xff4a('0x32')]['length']?_0x1db230[_0xff4a('0x32')]:_0x1634a2[_0xff4a('0x31')];_0x1db230[_0xff4a('0x36')]=qs['sort'](_0x4dbd52[_0xff4a('0x2f')][_0xff4a('0x37')]);_0x1db230[_0xff4a('0x3a')]=qs[_0xff4a('0x30')](_[_0xff4a('0x38')](_0x4dbd52[_0xff4a('0x2f')],_0x1634a2['filters']));if(_0x4dbd52[_0xff4a('0x2f')][_0xff4a('0x39')]){_0x1db230[_0xff4a('0x3a')]=_[_0xff4a('0x3b')](_0x1db230[_0xff4a('0x3a')],{'$or':_[_0xff4a('0x2a')](_0x1db230[_0xff4a('0x32')],function(_0x336c94){var _0x492a82={};_0x492a82[_0x336c94]={'$like':'%'+_0x4dbd52[_0xff4a('0x2f')]['filter']+'%'};return _0x492a82;})});}_0x1db230=_[_0xff4a('0x3b')]({},_0x1db230,_0x4dbd52[_0xff4a('0x3d')]);return _0x115d2d[_0xff4a('0x4e')](_0x1db230);}})[_0xff4a('0x25')](function(_0x2a6d6d){if(_0x2a6d6d){_0x5f4672=_0x2a6d6d[_0xff4a('0x34')];if(!_0x4dbd52[_0xff4a('0x2f')][_0xff4a('0x4c')]('nolimit')){_0x1db230['limit']=qs[_0xff4a('0x1f')](_0x4dbd52[_0xff4a('0x2f')]['limit']);_0x1db230[_0xff4a('0x1d')]=qs[_0xff4a('0x1d')](_0x4dbd52[_0xff4a('0x2f')][_0xff4a('0x1d')]);}return _0x115d2d['getDescriptions'](_0x1db230);}})[_0xff4a('0x25')](function(_0x357a85){if(_0x357a85){return _0x357a85?{'count':_0x5f4672,'rows':_0x357a85}:null;}})[_0xff4a('0x25')](respondWithResult(_0x2e8fcd,null))[_0xff4a('0x46')](handleError(_0x2e8fcd,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index b4d01d3..839da95 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 _0x93c3=['path','rimraf','../../config/environment','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x44af81,_0x2e0305){var _0x3626e7=function(_0x56f9e7){while(--_0x56f9e7){_0x44af81['push'](_0x44af81['shift']());}};_0x3626e7(++_0x2e0305);}(_0x93c3,0xf0));var _0x393c=function(_0x14f8f1,_0x35b42f){_0x14f8f1=_0x14f8f1-0x0;var _0xf7d77b=_0x93c3[_0x14f8f1];return _0xf7d77b;};'use strict';var _=require(_0x393c('0x0'));var util=require(_0x393c('0x1'));var logger=require(_0x393c('0x2'))(_0x393c('0x3'));var moment=require(_0x393c('0x4'));var BPromise=require(_0x393c('0x5'));var rp=require(_0x393c('0x6'));var fs=require('fs');var path=require(_0x393c('0x7'));var rimraf=require(_0x393c('0x8'));var config=require(_0x393c('0x9'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x50a02a,_0x24b85d){return _0x50a02a[_0x393c('0xa')](_0x393c('0xb'),attributes,{'tableName':_0x393c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89d5=['./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','api','moment','request-promise','rimraf'];(function(_0x203d8c,_0x1f8556){var _0xc689b9=function(_0x404851){while(--_0x404851){_0x203d8c['push'](_0x203d8c['shift']());}};_0xc689b9(++_0x1f8556);}(_0x89d5,0x1ee));var _0x589d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x89d5[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x589d('0x0'));var util=require(_0x589d('0x1'));var logger=require('../../config/logger')(_0x589d('0x2'));var moment=require(_0x589d('0x3'));var BPromise=require('bluebird');var rp=require(_0x589d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x589d('0x5'));var config=require('../../config/environment');var attributes=require(_0x589d('0x6'));module['exports']=function(_0x142a24,_0xb2e8fc){return _0x142a24[_0x589d('0x7')](_0x589d('0x8'),attributes,{'tableName':_0x589d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 77aef3c..4aff488 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 _0x1972=['../../config/environment','client','request','info','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','VtigerConfiguration,\x20%s,\x20%s','moment','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x3a6b8b,_0x4e483a){var _0x175a2a=function(_0x562bce){while(--_0x562bce){_0x3a6b8b['push'](_0x3a6b8b['shift']());}};_0x175a2a(++_0x4e483a);}(_0x1972,0x1d7));var _0x2197=function(_0x25aa0a,_0x119e02){_0x25aa0a=_0x25aa0a-0x0;var _0x4cc16a=_0x1972[_0x25aa0a];return _0x4cc16a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2197('0x0'));var BPromise=require('bluebird');var rs=require(_0x2197('0x1'));var fs=require('fs');var Redis=require(_0x2197('0x2'));var db=require(_0x2197('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2197('0x4'));var config=require(_0x2197('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2197('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x427aa5,_0x37dcd2,_0x2c9773){return new BPromise(function(_0x34ded9,_0x3fa8af){return client[_0x2197('0x7')](_0x427aa5,_0x2c9773)['then'](function(_0x366566){logger[_0x2197('0x8')]('VtigerConfiguration,\x20%s,\x20%s',_0x37dcd2,'request\x20sent');logger['debug'](_0x2197('0x9'),_0x37dcd2,_0x2197('0xa'),JSON[_0x2197('0xb')](_0x366566));if(_0x366566[_0x2197('0xc')]){if(_0x366566['error'][_0x2197('0xd')]===0x1f4){logger[_0x2197('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x37dcd2,_0x366566[_0x2197('0xc')][_0x2197('0xe')]);return _0x3fa8af(_0x366566[_0x2197('0xc')][_0x2197('0xe')]);}logger[_0x2197('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x37dcd2,_0x366566[_0x2197('0xc')][_0x2197('0xe')]);return _0x34ded9(_0x366566[_0x2197('0xc')][_0x2197('0xe')]);}else{logger[_0x2197('0x8')]('VtigerConfiguration,\x20%s,\x20%s',_0x37dcd2,_0x2197('0xa'));_0x34ded9(_0x366566[_0x2197('0xf')][_0x2197('0xe')]);}})['catch'](function(_0x5141b4){logger['error'](_0x2197('0x10'),_0x37dcd2,_0x5141b4);_0x3fa8af(_0x5141b4);});});} \ No newline at end of file +var _0x82f9=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../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','error','code'];(function(_0x462150,_0x48ac37){var _0x28a15c=function(_0x43057b){while(--_0x43057b){_0x462150['push'](_0x462150['shift']());}};_0x28a15c(++_0x48ac37);}(_0x82f9,0xc3));var _0x982f=function(_0x292423,_0x1759b7){_0x292423=_0x292423-0x0;var _0x2801cb=_0x82f9[_0x292423];return _0x2801cb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x982f('0x0'));var BPromise=require(_0x982f('0x1'));var rs=require(_0x982f('0x2'));var fs=require('fs');var Redis=require(_0x982f('0x3'));var db=require(_0x982f('0x4'))['db'];var utils=require(_0x982f('0x5'));var logger=require(_0x982f('0x6'))(_0x982f('0x7'));var config=require(_0x982f('0x8'));var jayson=require(_0x982f('0x9'));var client=jayson[_0x982f('0xa')][_0x982f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39ecf0,_0x191758,_0x56f0d5){return new BPromise(function(_0x497747,_0x4745e0){return client[_0x982f('0xc')](_0x39ecf0,_0x56f0d5)[_0x982f('0xd')](function(_0x47c1b6){logger[_0x982f('0xe')](_0x982f('0xf'),_0x191758,_0x982f('0x10'));logger[_0x982f('0x11')](_0x982f('0x12'),_0x191758,_0x982f('0x10'),JSON['stringify'](_0x47c1b6));if(_0x47c1b6[_0x982f('0x13')]){if(_0x47c1b6[_0x982f('0x13')][_0x982f('0x14')]===0x1f4){logger['error'](_0x982f('0xf'),_0x191758,_0x47c1b6[_0x982f('0x13')][_0x982f('0x15')]);return _0x4745e0(_0x47c1b6[_0x982f('0x13')][_0x982f('0x15')]);}logger[_0x982f('0x13')](_0x982f('0xf'),_0x191758,_0x47c1b6[_0x982f('0x13')][_0x982f('0x15')]);return _0x497747(_0x47c1b6['error'][_0x982f('0x15')]);}else{logger[_0x982f('0xe')](_0x982f('0xf'),_0x191758,_0x982f('0x10'));_0x497747(_0x47c1b6[_0x982f('0x16')][_0x982f('0x15')]);}})[_0x982f('0x17')](function(_0x3f4212){logger['error'](_0x982f('0xf'),_0x191758,_0x3f4212);_0x4745e0(_0x3f4212);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 164698a..0e9cd06 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 _0x14e8=['index','isAuthenticated','create','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x50185e,_0x2c3a91){var _0x70548d=function(_0x29fd07){while(--_0x29fd07){_0x50185e['push'](_0x50185e['shift']());}};_0x70548d(++_0x2c3a91);}(_0x14e8,0x1d3));var _0x814e=function(_0x187bb2,_0x2f59bf){_0x187bb2=_0x187bb2-0x0;var _0x4af854=_0x14e8[_0x187bb2];return _0x4af854;};'use strict';var multer=require(_0x814e('0x0'));var util=require(_0x814e('0x1'));var path=require(_0x814e('0x2'));var timeout=require(_0x814e('0x3'));var express=require(_0x814e('0x4'));var router=express['Router']();var fs_extra=require(_0x814e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x814e('0x6'));var config=require(_0x814e('0x7'));var controller=require('./intVtigerField.controller');router[_0x814e('0x8')]('/',auth['isAuthenticated'](),controller[_0x814e('0x9')]);router[_0x814e('0x8')]('/:id',auth[_0x814e('0xa')](),controller['show']);router['post']('/',auth[_0x814e('0xa')](),controller[_0x814e('0xb')]);router[_0x814e('0xc')]('/:id',auth[_0x814e('0xa')](),controller[_0x814e('0xd')]);router['delete'](_0x814e('0xe'),auth[_0x814e('0xa')](),controller[_0x814e('0xf')]);module[_0x814e('0x10')]=router; \ No newline at end of file +var _0xfd54=['get','isAuthenticated','index','/:id','show','post','create','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd54,0x1ab));var _0x4fd5=function(_0x3de4b2,_0x2b1cb8){_0x3de4b2=_0x3de4b2-0x0;var _0x57ca15=_0xfd54[_0x3de4b2];return _0x57ca15;};'use strict';var multer=require(_0x4fd5('0x0'));var util=require(_0x4fd5('0x1'));var path=require(_0x4fd5('0x2'));var timeout=require(_0x4fd5('0x3'));var express=require(_0x4fd5('0x4'));var router=express[_0x4fd5('0x5')]();var fs_extra=require(_0x4fd5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4fd5('0x7'));var config=require(_0x4fd5('0x8'));var controller=require(_0x4fd5('0x9'));router[_0x4fd5('0xa')]('/',auth[_0x4fd5('0xb')](),controller[_0x4fd5('0xc')]);router['get'](_0x4fd5('0xd'),auth['isAuthenticated'](),controller[_0x4fd5('0xe')]);router[_0x4fd5('0xf')]('/',auth[_0x4fd5('0xb')](),controller[_0x4fd5('0x10')]);router['put'](_0x4fd5('0xd'),auth[_0x4fd5('0xb')](),controller['update']);router['delete']('/:id',auth[_0x4fd5('0xb')](),controller[_0x4fd5('0x11')]);module[_0x4fd5('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index fa8dadb..eca35b0 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 _0x6ab5=['keyValue','picklist','string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x6ab5,0x178));var _0x56ab=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x6ab5[_0x5d2803];return _0xdcad2c;};'use strict';var Sequelize=require(_0x56ab('0x0'));module[_0x56ab('0x1')]={'type':{'type':Sequelize[_0x56ab('0x2')]('string',_0x56ab('0x3'),'customVariable',_0x56ab('0x4'),_0x56ab('0x5')),'defaultValue':_0x56ab('0x6')},'content':{'type':Sequelize[_0x56ab('0x7')]},'key':{'type':Sequelize[_0x56ab('0x7')]},'keyType':{'type':Sequelize[_0x56ab('0x2')](_0x56ab('0x6'),_0x56ab('0x3'),_0x56ab('0x8'))},'keyContent':{'type':Sequelize[_0x56ab('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x56ab('0x7')]},'customField':{'type':Sequelize[_0x56ab('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7cb8=['ENUM','variable','customVariable','keyValue','STRING','string','BOOLEAN','sequelize','exports'];(function(_0x4e99b0,_0x4cedb0){var _0x4f005e=function(_0x4f5b37){while(--_0x4f5b37){_0x4e99b0['push'](_0x4e99b0['shift']());}};_0x4f005e(++_0x4cedb0);}(_0x7cb8,0x19c));var _0x87cb=function(_0x4e914d,_0x5c7e83){_0x4e914d=_0x4e914d-0x0;var _0x49a6af=_0x7cb8[_0x4e914d];return _0x49a6af;};'use strict';var Sequelize=require(_0x87cb('0x0'));module[_0x87cb('0x1')]={'type':{'type':Sequelize[_0x87cb('0x2')]('string',_0x87cb('0x3'),_0x87cb('0x4'),_0x87cb('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x87cb('0x6')]},'keyType':{'type':Sequelize[_0x87cb('0x2')](_0x87cb('0x7'),_0x87cb('0x3'),_0x87cb('0x4'))},'keyContent':{'type':Sequelize[_0x87cb('0x6')]},'idField':{'type':Sequelize[_0x87cb('0x6')]},'nameField':{'type':Sequelize[_0x87cb('0x6')]},'customField':{'type':Sequelize[_0x87cb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x87cb('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 7d7a225..dc45211 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 _0xb5fc=['count','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','index','map','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VtigerField','then','includeAll','include','findAll','rows','catch','params','options','find','create','body','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0xb5fc,0x71));var _0xcb5f=function(_0xe6463e,_0x51ad03){_0xe6463e=_0xe6463e-0x0;var _0x311b0a=_0xb5fc[_0xe6463e];return _0x311b0a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcb5f('0x0'));var moment=require('moment');var BPromise=require(_0xcb5f('0x1'));var Mustache=require(_0xcb5f('0x2'));var util=require(_0xcb5f('0x3'));var path=require(_0xcb5f('0x4'));var sox=require(_0xcb5f('0x5'));var csv=require(_0xcb5f('0x6'));var ejs=require(_0xcb5f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb5f('0x8'));var squel=require('squel');var crypto=require(_0xcb5f('0x9'));var jsforce=require(_0xcb5f('0xa'));var deskjs=require(_0xcb5f('0xb'));var toCsv=require(_0xcb5f('0x6'));var querystring=require('querystring');var Papa=require(_0xcb5f('0xc'));var Redis=require(_0xcb5f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xcb5f('0xe'));var as=require(_0xcb5f('0xf'));var hardwareService=require(_0xcb5f('0x10'));var logger=require(_0xcb5f('0x11'))(_0xcb5f('0x12'));var utils=require(_0xcb5f('0x13'));var config=require(_0xcb5f('0x14'));var licenseUtil=require(_0xcb5f('0x15'));var db=require(_0xcb5f('0x16'))['db'];function respondWithStatusCode(_0x261269,_0x8c66db){_0x8c66db=_0x8c66db||0xcc;return function(_0x360aa8){if(_0x360aa8){return _0x261269['sendStatus'](_0x8c66db);}return _0x261269[_0xcb5f('0x17')](_0x8c66db)[_0xcb5f('0x18')]();};}function respondWithResult(_0xf05f9b,_0x41e4a7){_0x41e4a7=_0x41e4a7||0xc8;return function(_0x2174a2){if(_0x2174a2){return _0xf05f9b[_0xcb5f('0x17')](_0x41e4a7)[_0xcb5f('0x19')](_0x2174a2);}};}function respondWithFilteredResult(_0x550f17,_0x487080){return function(_0x22ea59){if(_0x22ea59){var _0x44aafa=typeof _0x487080[_0xcb5f('0x1a')]===_0xcb5f('0x1b')&&typeof _0x487080[_0xcb5f('0x1c')]===_0xcb5f('0x1b');var _0x11f205=_0x22ea59[_0xcb5f('0x1d')];var _0x25c404=_0x44aafa?0x0:_0x487080[_0xcb5f('0x1a')];var _0xc7b12b=_0x44aafa?_0x22ea59[_0xcb5f('0x1d')]:_0x487080[_0xcb5f('0x1a')]+_0x487080[_0xcb5f('0x1c')];var _0x523efc;if(_0xc7b12b>=_0x11f205){_0xc7b12b=_0x11f205;_0x523efc=0xc8;}else{_0x523efc=0xce;}_0x550f17[_0xcb5f('0x17')](_0x523efc);return _0x550f17['set'](_0xcb5f('0x1e'),_0x25c404+'-'+_0xc7b12b+'/'+_0x11f205)[_0xcb5f('0x19')](_0x22ea59);}return null;};}function patchUpdates(_0x5888a7){return function(_0xb4f80b){try{jsonpatch[_0xcb5f('0x1f')](_0xb4f80b,_0x5888a7,!![]);}catch(_0x1bdde0){return BPromise[_0xcb5f('0x20')](_0x1bdde0);}return _0xb4f80b[_0xcb5f('0x21')]();};}function saveUpdates(_0x44b1b7,_0xdca778){return function(_0x1487be){if(_0x1487be){return _0x1487be[_0xcb5f('0x22')](_0x44b1b7)['then'](function(_0x257c67){return _0x257c67;});}return null;};}function removeEntity(_0xff8c39,_0xffcae3){return function(_0x35a702){if(_0x35a702){return _0x35a702[_0xcb5f('0x23')]()['then'](function(){_0xff8c39[_0xcb5f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c0273,_0x50532c){return function(_0x478939){if(!_0x478939){_0x1c0273[_0xcb5f('0x24')](0x194);}return _0x478939;};}function handleError(_0x186afe,_0x3b729d){_0x3b729d=_0x3b729d||0x1f4;return function(_0x50f7ae){logger[_0xcb5f('0x25')](_0x50f7ae[_0xcb5f('0x26')]);if(_0x50f7ae[_0xcb5f('0x27')]){delete _0x50f7ae[_0xcb5f('0x27')];}_0x186afe[_0xcb5f('0x17')](_0x3b729d)['send'](_0x50f7ae);};}exports[_0xcb5f('0x28')]=function(_0x40681a,_0xb937b6){var _0x3d4cbe={},_0x3afb40={},_0x518812={'count':0x0,'rows':[]};var _0x1cac58=_[_0xcb5f('0x29')](db['VtigerField'][_0xcb5f('0x2a')],function(_0xb11d14){return{'name':_0xb11d14['fieldName'],'type':_0xb11d14[_0xcb5f('0x2b')][_0xcb5f('0x2c')]};});_0x3afb40[_0xcb5f('0x2d')]=_['map'](_0x1cac58,'name');_0x3afb40['query']=_[_0xcb5f('0x2e')](_0x40681a[_0xcb5f('0x2f')]);_0x3afb40[_0xcb5f('0x30')]=_['intersection'](_0x3afb40['model'],_0x3afb40[_0xcb5f('0x2f')]);_0x3d4cbe[_0xcb5f('0x31')]=_[_0xcb5f('0x32')](_0x3afb40[_0xcb5f('0x2d')],qs[_0xcb5f('0x33')](_0x40681a[_0xcb5f('0x2f')][_0xcb5f('0x33')]));_0x3d4cbe[_0xcb5f('0x31')]=_0x3d4cbe[_0xcb5f('0x31')][_0xcb5f('0x34')]?_0x3d4cbe[_0xcb5f('0x31')]:_0x3afb40[_0xcb5f('0x2d')];if(!_0x40681a[_0xcb5f('0x2f')][_0xcb5f('0x35')](_0xcb5f('0x36'))){_0x3d4cbe['limit']=qs[_0xcb5f('0x1c')](_0x40681a[_0xcb5f('0x2f')][_0xcb5f('0x1c')]);_0x3d4cbe['offset']=qs[_0xcb5f('0x1a')](_0x40681a['query'][_0xcb5f('0x1a')]);}_0x3d4cbe[_0xcb5f('0x37')]=qs[_0xcb5f('0x38')](_0x40681a[_0xcb5f('0x2f')][_0xcb5f('0x38')]);_0x3d4cbe[_0xcb5f('0x39')]=qs['filters'](_['pick'](_0x40681a['query'],_0x3afb40[_0xcb5f('0x30')]),_0x1cac58);if(_0x40681a[_0xcb5f('0x2f')][_0xcb5f('0x3a')]){_0x3d4cbe[_0xcb5f('0x39')]=_['merge'](_0x3d4cbe[_0xcb5f('0x39')],{'$or':_['map'](_0x1cac58,function(_0x83f41e){if(_0x83f41e[_0xcb5f('0x2b')]!=='VIRTUAL'){var _0x3b71b7={};_0x3b71b7[_0x83f41e[_0xcb5f('0x27')]]={'$like':'%'+_0x40681a[_0xcb5f('0x2f')]['filter']+'%'};return _0x3b71b7;}})});}_0x3d4cbe=_['merge']({},_0x3d4cbe,_0x40681a['options']);var _0xf853c9={'where':_0x3d4cbe[_0xcb5f('0x39')]};return db[_0xcb5f('0x3b')][_0xcb5f('0x1d')](_0xf853c9)[_0xcb5f('0x3c')](function(_0x5b6f06){_0x518812[_0xcb5f('0x1d')]=_0x5b6f06;if(_0x40681a[_0xcb5f('0x2f')][_0xcb5f('0x3d')]){_0x3d4cbe[_0xcb5f('0x3e')]=[{'all':!![]}];}return db['VtigerField'][_0xcb5f('0x3f')](_0x3d4cbe);})[_0xcb5f('0x3c')](function(_0x3ed8ee){_0x518812[_0xcb5f('0x40')]=_0x3ed8ee;return _0x518812;})[_0xcb5f('0x3c')](respondWithFilteredResult(_0xb937b6,_0x3d4cbe))[_0xcb5f('0x41')](handleError(_0xb937b6,null));};exports['show']=function(_0x285532,_0x3c1311){var _0x2c6968={'raw':!![],'where':{'id':_0x285532[_0xcb5f('0x42')]['id']}},_0x407f8e={};_0x407f8e[_0xcb5f('0x2d')]=_[_0xcb5f('0x2e')](db[_0xcb5f('0x3b')][_0xcb5f('0x2a')]);_0x407f8e[_0xcb5f('0x2f')]=_[_0xcb5f('0x2e')](_0x285532[_0xcb5f('0x2f')]);_0x407f8e['filters']=_['intersection'](_0x407f8e[_0xcb5f('0x2d')],_0x407f8e[_0xcb5f('0x2f')]);_0x2c6968[_0xcb5f('0x31')]=_['intersection'](_0x407f8e[_0xcb5f('0x2d')],qs['fields'](_0x285532[_0xcb5f('0x2f')][_0xcb5f('0x33')]));_0x2c6968[_0xcb5f('0x31')]=_0x2c6968['attributes']['length']?_0x2c6968[_0xcb5f('0x31')]:_0x407f8e['model'];if(_0x285532[_0xcb5f('0x2f')][_0xcb5f('0x3d')]){_0x2c6968[_0xcb5f('0x3e')]=[{'all':!![]}];}_0x2c6968=_['merge']({},_0x2c6968,_0x285532[_0xcb5f('0x43')]);return db['VtigerField'][_0xcb5f('0x44')](_0x2c6968)['then'](handleEntityNotFound(_0x3c1311,null))['then'](respondWithResult(_0x3c1311,null))[_0xcb5f('0x41')](handleError(_0x3c1311,null));};exports[_0xcb5f('0x45')]=function(_0x530c7a,_0x1e7043){return db[_0xcb5f('0x3b')][_0xcb5f('0x45')](_0x530c7a[_0xcb5f('0x46')],{})[_0xcb5f('0x3c')](respondWithResult(_0x1e7043,0xc9))[_0xcb5f('0x41')](handleError(_0x1e7043,null));};exports[_0xcb5f('0x22')]=function(_0x1ef6dd,_0x52c50b){if(_0x1ef6dd[_0xcb5f('0x46')]['id']){delete _0x1ef6dd['body']['id'];}return db[_0xcb5f('0x3b')]['find']({'where':{'id':_0x1ef6dd[_0xcb5f('0x42')]['id']}})[_0xcb5f('0x3c')](handleEntityNotFound(_0x52c50b,null))[_0xcb5f('0x3c')](saveUpdates(_0x1ef6dd[_0xcb5f('0x46')],null))[_0xcb5f('0x3c')](respondWithResult(_0x52c50b,null))[_0xcb5f('0x41')](handleError(_0x52c50b,null));};exports[_0xcb5f('0x23')]=function(_0xcb3d53,_0x435a20){return db[_0xcb5f('0x3b')][_0xcb5f('0x44')]({'where':{'id':_0xcb3d53['params']['id']}})[_0xcb5f('0x3c')](handleEntityNotFound(_0x435a20,null))[_0xcb5f('0x3c')](removeEntity(_0x435a20,null))['catch'](handleError(_0x435a20,null));}; \ No newline at end of file +var _0x0c19=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','findAll','rows','catch','show','params','include','options','find','create','body','update','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','destroy','then','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type'];(function(_0x4bc577,_0x28a9d8){var _0x417064=function(_0x4d5016){while(--_0x4d5016){_0x4bc577['push'](_0x4bc577['shift']());}};_0x417064(++_0x28a9d8);}(_0x0c19,0x1c6));var _0x90c1=function(_0x18c219,_0x468963){_0x18c219=_0x18c219-0x0;var _0x5cea8d=_0x0c19[_0x18c219];return _0x5cea8d;};'use strict';var emlformat=require(_0x90c1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x90c1('0x1'));var rp=require(_0x90c1('0x2'));var moment=require('moment');var BPromise=require(_0x90c1('0x3'));var Mustache=require(_0x90c1('0x4'));var util=require(_0x90c1('0x5'));var path=require(_0x90c1('0x6'));var sox=require('sox');var csv=require(_0x90c1('0x7'));var ejs=require(_0x90c1('0x8'));var fs=require('fs');var fs_extra=require(_0x90c1('0x9'));var _=require(_0x90c1('0xa'));var squel=require('squel');var crypto=require(_0x90c1('0xb'));var jsforce=require(_0x90c1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x90c1('0xd'));var Redis=require(_0x90c1('0xe'));var authService=require(_0x90c1('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90c1('0x10'));var logger=require(_0x90c1('0x11'))(_0x90c1('0x12'));var utils=require('../../config/utils');var config=require(_0x90c1('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fce9c,_0x1b5f1b){_0x1b5f1b=_0x1b5f1b||0xcc;return function(_0x377154){if(_0x377154){return _0x2fce9c[_0x90c1('0x14')](_0x1b5f1b);}return _0x2fce9c[_0x90c1('0x15')](_0x1b5f1b)[_0x90c1('0x16')]();};}function respondWithResult(_0x5d096b,_0x42f410){_0x42f410=_0x42f410||0xc8;return function(_0x5486dc){if(_0x5486dc){return _0x5d096b['status'](_0x42f410)['json'](_0x5486dc);}};}function respondWithFilteredResult(_0x124ca4,_0x1567a6){return function(_0x3f371c){if(_0x3f371c){var _0x46defa=typeof _0x1567a6[_0x90c1('0x17')]===_0x90c1('0x18')&&typeof _0x1567a6[_0x90c1('0x19')]===_0x90c1('0x18');var _0x50e4c3=_0x3f371c['count'];var _0x44c0e0=_0x46defa?0x0:_0x1567a6[_0x90c1('0x17')];var _0xd14bae=_0x46defa?_0x3f371c[_0x90c1('0x1a')]:_0x1567a6[_0x90c1('0x17')]+_0x1567a6[_0x90c1('0x19')];var _0x2d8877;if(_0xd14bae>=_0x50e4c3){_0xd14bae=_0x50e4c3;_0x2d8877=0xc8;}else{_0x2d8877=0xce;}_0x124ca4['status'](_0x2d8877);return _0x124ca4[_0x90c1('0x1b')]('Content-Range',_0x44c0e0+'-'+_0xd14bae+'/'+_0x50e4c3)[_0x90c1('0x1c')](_0x3f371c);}return null;};}function patchUpdates(_0x46ad97){return function(_0x51bbf1){try{jsonpatch[_0x90c1('0x1d')](_0x51bbf1,_0x46ad97,!![]);}catch(_0x537e0a){return BPromise[_0x90c1('0x1e')](_0x537e0a);}return _0x51bbf1['save']();};}function saveUpdates(_0x180097,_0x2ba5e0){return function(_0x39f41e){if(_0x39f41e){return _0x39f41e['update'](_0x180097)['then'](function(_0x1e072f){return _0x1e072f;});}return null;};}function removeEntity(_0x509eb8,_0x502363){return function(_0x198bb8){if(_0x198bb8){return _0x198bb8[_0x90c1('0x1f')]()[_0x90c1('0x20')](function(){_0x509eb8[_0x90c1('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21b0a2,_0x5f1a09){return function(_0x3d18b5){if(!_0x3d18b5){_0x21b0a2[_0x90c1('0x14')](0x194);}return _0x3d18b5;};}function handleError(_0x4dae25,_0x3c7a2f){_0x3c7a2f=_0x3c7a2f||0x1f4;return function(_0xb535e2){logger[_0x90c1('0x21')](_0xb535e2[_0x90c1('0x22')]);if(_0xb535e2[_0x90c1('0x23')]){delete _0xb535e2[_0x90c1('0x23')];}_0x4dae25[_0x90c1('0x15')](_0x3c7a2f)[_0x90c1('0x24')](_0xb535e2);};}exports[_0x90c1('0x25')]=function(_0xe6deb9,_0x40aa32){var _0x1d4561={},_0x4a5ef8={},_0x4b520d={'count':0x0,'rows':[]};var _0x4be0b7=_[_0x90c1('0x26')](db[_0x90c1('0x27')][_0x90c1('0x28')],function(_0x5a13d6){return{'name':_0x5a13d6[_0x90c1('0x29')],'type':_0x5a13d6[_0x90c1('0x2a')][_0x90c1('0x2b')]};});_0x4a5ef8[_0x90c1('0x2c')]=_[_0x90c1('0x26')](_0x4be0b7,_0x90c1('0x23'));_0x4a5ef8[_0x90c1('0x2d')]=_[_0x90c1('0x2e')](_0xe6deb9[_0x90c1('0x2d')]);_0x4a5ef8[_0x90c1('0x2f')]=_[_0x90c1('0x30')](_0x4a5ef8[_0x90c1('0x2c')],_0x4a5ef8[_0x90c1('0x2d')]);_0x1d4561[_0x90c1('0x31')]=_[_0x90c1('0x30')](_0x4a5ef8[_0x90c1('0x2c')],qs[_0x90c1('0x32')](_0xe6deb9[_0x90c1('0x2d')][_0x90c1('0x32')]));_0x1d4561[_0x90c1('0x31')]=_0x1d4561[_0x90c1('0x31')][_0x90c1('0x33')]?_0x1d4561[_0x90c1('0x31')]:_0x4a5ef8[_0x90c1('0x2c')];if(!_0xe6deb9[_0x90c1('0x2d')][_0x90c1('0x34')](_0x90c1('0x35'))){_0x1d4561[_0x90c1('0x19')]=qs[_0x90c1('0x19')](_0xe6deb9['query']['limit']);_0x1d4561['offset']=qs[_0x90c1('0x17')](_0xe6deb9['query'][_0x90c1('0x17')]);}_0x1d4561[_0x90c1('0x36')]=qs[_0x90c1('0x37')](_0xe6deb9[_0x90c1('0x2d')][_0x90c1('0x37')]);_0x1d4561[_0x90c1('0x38')]=qs[_0x90c1('0x2f')](_['pick'](_0xe6deb9['query'],_0x4a5ef8['filters']),_0x4be0b7);if(_0xe6deb9['query'][_0x90c1('0x39')]){_0x1d4561['where']=_[_0x90c1('0x3a')](_0x1d4561['where'],{'$or':_[_0x90c1('0x26')](_0x4be0b7,function(_0x59f1fb){if(_0x59f1fb[_0x90c1('0x2a')]!==_0x90c1('0x3b')){var _0x24a0e1={};_0x24a0e1[_0x59f1fb[_0x90c1('0x23')]]={'$like':'%'+_0xe6deb9['query']['filter']+'%'};return _0x24a0e1;}})});}_0x1d4561=_['merge']({},_0x1d4561,_0xe6deb9['options']);var _0x59d9e4={'where':_0x1d4561['where']};return db[_0x90c1('0x27')]['count'](_0x59d9e4)[_0x90c1('0x20')](function(_0x40dacc){_0x4b520d['count']=_0x40dacc;if(_0xe6deb9[_0x90c1('0x2d')]['includeAll']){_0x1d4561['include']=[{'all':!![]}];}return db[_0x90c1('0x27')][_0x90c1('0x3c')](_0x1d4561);})[_0x90c1('0x20')](function(_0x3c3cb8){_0x4b520d[_0x90c1('0x3d')]=_0x3c3cb8;return _0x4b520d;})['then'](respondWithFilteredResult(_0x40aa32,_0x1d4561))[_0x90c1('0x3e')](handleError(_0x40aa32,null));};exports[_0x90c1('0x3f')]=function(_0x198169,_0x2bdfbf){var _0xb43930={'raw':!![],'where':{'id':_0x198169[_0x90c1('0x40')]['id']}},_0x4fbc19={};_0x4fbc19[_0x90c1('0x2c')]=_[_0x90c1('0x2e')](db[_0x90c1('0x27')]['rawAttributes']);_0x4fbc19[_0x90c1('0x2d')]=_[_0x90c1('0x2e')](_0x198169[_0x90c1('0x2d')]);_0x4fbc19[_0x90c1('0x2f')]=_[_0x90c1('0x30')](_0x4fbc19[_0x90c1('0x2c')],_0x4fbc19[_0x90c1('0x2d')]);_0xb43930[_0x90c1('0x31')]=_[_0x90c1('0x30')](_0x4fbc19[_0x90c1('0x2c')],qs['fields'](_0x198169['query']['fields']));_0xb43930['attributes']=_0xb43930[_0x90c1('0x31')][_0x90c1('0x33')]?_0xb43930[_0x90c1('0x31')]:_0x4fbc19['model'];if(_0x198169[_0x90c1('0x2d')]['includeAll']){_0xb43930[_0x90c1('0x41')]=[{'all':!![]}];}_0xb43930=_[_0x90c1('0x3a')]({},_0xb43930,_0x198169[_0x90c1('0x42')]);return db['VtigerField'][_0x90c1('0x43')](_0xb43930)[_0x90c1('0x20')](handleEntityNotFound(_0x2bdfbf,null))['then'](respondWithResult(_0x2bdfbf,null))[_0x90c1('0x3e')](handleError(_0x2bdfbf,null));};exports[_0x90c1('0x44')]=function(_0x190e68,_0x1fb55f){return db[_0x90c1('0x27')]['create'](_0x190e68[_0x90c1('0x45')],{})[_0x90c1('0x20')](respondWithResult(_0x1fb55f,0xc9))[_0x90c1('0x3e')](handleError(_0x1fb55f,null));};exports[_0x90c1('0x46')]=function(_0x56081f,_0x5aa790){if(_0x56081f[_0x90c1('0x45')]['id']){delete _0x56081f[_0x90c1('0x45')]['id'];}return db['VtigerField'][_0x90c1('0x43')]({'where':{'id':_0x56081f['params']['id']}})[_0x90c1('0x20')](handleEntityNotFound(_0x5aa790,null))[_0x90c1('0x20')](saveUpdates(_0x56081f['body'],null))[_0x90c1('0x20')](respondWithResult(_0x5aa790,null))[_0x90c1('0x3e')](handleError(_0x5aa790,null));};exports[_0x90c1('0x1f')]=function(_0x3c2ea1,_0x3b190a){return db[_0x90c1('0x27')][_0x90c1('0x43')]({'where':{'id':_0x3c2ea1[_0x90c1('0x40')]['id']}})[_0x90c1('0x20')](handleEntityNotFound(_0x3b190a,null))[_0x90c1('0x20')](removeEntity(_0x3b190a,null))['catch'](handleError(_0x3b190a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c216528..6bec8de 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 _0xdbb3=['../../config/logger','api','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbb3,0x11d));var _0x3dbb=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xdbb3[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0x3dbb('0x0'));var util=require('util');var logger=require(_0x3dbb('0x1'))(_0x3dbb('0x2'));var moment=require('moment');var BPromise=require(_0x3dbb('0x3'));var rp=require(_0x3dbb('0x4'));var fs=require('fs');var path=require(_0x3dbb('0x5'));var rimraf=require(_0x3dbb('0x6'));var config=require('../../config/environment');var attributes=require(_0x3dbb('0x7'));module[_0x3dbb('0x8')]=function(_0x3ff486,_0x35424c){return _0x3ff486['define'](_0x3dbb('0x9'),attributes,{'tableName':_0x3dbb('0xa'),'paranoid':![],'indexes':[{'name':_0x3dbb('0xb'),'fields':['idField',_0x3dbb('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab5a=['define','VtigerField','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intVtigerField.attributes','exports'];(function(_0x33f277,_0x2ecebd){var _0x3f5d3c=function(_0x3c2854){while(--_0x3c2854){_0x33f277['push'](_0x33f277['shift']());}};_0x3f5d3c(++_0x2ecebd);}(_0xab5a,0xc8));var _0xaab5=function(_0x52b275,_0x3a1c44){_0x52b275=_0x52b275-0x0;var _0x5d5d4d=_0xab5a[_0x52b275];return _0x5d5d4d;};'use strict';var _=require(_0xaab5('0x0'));var util=require(_0xaab5('0x1'));var logger=require(_0xaab5('0x2'))(_0xaab5('0x3'));var moment=require(_0xaab5('0x4'));var BPromise=require(_0xaab5('0x5'));var rp=require(_0xaab5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaab5('0x7'));var config=require('../../config/environment');var attributes=require(_0xaab5('0x8'));module[_0xaab5('0x9')]=function(_0x42f887,_0x2dc912){return _0x42f887[_0xaab5('0xa')](_0xaab5('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xaab5('0xc'),'fields':[_0xaab5('0xd'),_0xaab5('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 3fb5747..bb30ee8 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 _0xdd1b=['then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x2c273d,_0x344fb2){var _0x3ea713=function(_0xb205a2){while(--_0xb205a2){_0x2c273d['push'](_0x2c273d['shift']());}};_0x3ea713(++_0x344fb2);}(_0xdd1b,0x11f));var _0xbdd1=function(_0x40f127,_0x34a090){_0x40f127=_0x40f127-0x0;var _0x248628=_0xdd1b[_0x40f127];return _0x248628;};'use strict';var _=require(_0xbdd1('0x0'));var util=require(_0xbdd1('0x1'));var moment=require(_0xbdd1('0x2'));var BPromise=require(_0xbdd1('0x3'));var rs=require(_0xbdd1('0x4'));var fs=require('fs');var Redis=require(_0xbdd1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbdd1('0x6'))('rpc');var config=require(_0xbdd1('0x7'));var jayson=require(_0xbdd1('0x8'));var client=jayson[_0xbdd1('0x9')][_0xbdd1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46f0d3,_0x774689,_0x3acb8a){return new BPromise(function(_0x1e4260,_0x3d74e7){return client[_0xbdd1('0xb')](_0x46f0d3,_0x3acb8a)[_0xbdd1('0xc')](function(_0x457336){logger[_0xbdd1('0xd')](_0xbdd1('0xe'),_0x774689,_0xbdd1('0xf'));logger[_0xbdd1('0x10')](_0xbdd1('0x11'),_0x774689,_0xbdd1('0xf'),JSON[_0xbdd1('0x12')](_0x457336));if(_0x457336['error']){if(_0x457336[_0xbdd1('0x13')][_0xbdd1('0x14')]===0x1f4){logger['error'](_0xbdd1('0xe'),_0x774689,_0x457336[_0xbdd1('0x13')]['message']);return _0x3d74e7(_0x457336[_0xbdd1('0x13')][_0xbdd1('0x15')]);}logger['error'](_0xbdd1('0xe'),_0x774689,_0x457336['error'][_0xbdd1('0x15')]);return _0x1e4260(_0x457336[_0xbdd1('0x13')][_0xbdd1('0x15')]);}else{logger[_0xbdd1('0xd')]('VtigerField,\x20%s,\x20%s',_0x774689,_0xbdd1('0xf'));_0x1e4260(_0x457336['result'][_0xbdd1('0x15')]);}})[_0xbdd1('0x16')](function(_0x372201){logger['error'](_0xbdd1('0xe'),_0x774689,_0x372201);_0x3d74e7(_0x372201);});});} \ No newline at end of file +var _0x3b85=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x499bf1,_0x496bf4){var _0xa399c0=function(_0x360c63){while(--_0x360c63){_0x499bf1['push'](_0x499bf1['shift']());}};_0xa399c0(++_0x496bf4);}(_0x3b85,0xeb));var _0x53b8=function(_0xdcf40a,_0x36e55b){_0xdcf40a=_0xdcf40a-0x0;var _0x4ad808=_0x3b85[_0xdcf40a];return _0x4ad808;};'use strict';var _=require(_0x53b8('0x0'));var util=require(_0x53b8('0x1'));var moment=require(_0x53b8('0x2'));var BPromise=require(_0x53b8('0x3'));var rs=require(_0x53b8('0x4'));var fs=require('fs');var Redis=require(_0x53b8('0x5'));var db=require(_0x53b8('0x6'))['db'];var utils=require(_0x53b8('0x7'));var logger=require(_0x53b8('0x8'))(_0x53b8('0x9'));var config=require(_0x53b8('0xa'));var jayson=require(_0x53b8('0xb'));var client=jayson[_0x53b8('0xc')][_0x53b8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x421ffa,_0x5453b3,_0x442030){return new BPromise(function(_0x2591cd,_0x1546f8){return client[_0x53b8('0xe')](_0x421ffa,_0x442030)['then'](function(_0x10b56b){logger[_0x53b8('0xf')](_0x53b8('0x10'),_0x5453b3,_0x53b8('0x11'));logger[_0x53b8('0x12')](_0x53b8('0x13'),_0x5453b3,_0x53b8('0x11'),JSON['stringify'](_0x10b56b));if(_0x10b56b[_0x53b8('0x14')]){if(_0x10b56b[_0x53b8('0x14')][_0x53b8('0x15')]===0x1f4){logger[_0x53b8('0x14')](_0x53b8('0x10'),_0x5453b3,_0x10b56b[_0x53b8('0x14')]['message']);return _0x1546f8(_0x10b56b['error'][_0x53b8('0x16')]);}logger['error'](_0x53b8('0x10'),_0x5453b3,_0x10b56b['error'][_0x53b8('0x16')]);return _0x2591cd(_0x10b56b['error'][_0x53b8('0x16')]);}else{logger[_0x53b8('0xf')](_0x53b8('0x10'),_0x5453b3,_0x53b8('0x11'));_0x2591cd(_0x10b56b['result'][_0x53b8('0x16')]);}})[_0x53b8('0x17')](function(_0x57f3b3){logger['error'](_0x53b8('0x10'),_0x5453b3,_0x57f3b3);_0x1546f8(_0x57f3b3);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index d27c988..d2dec7b 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 _0x1d1d=['../../config/environment','./intZendeskAccount.controller','get','index','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0x1d1d,0x1cc));var _0xd1d1=function(_0x4cfbd0,_0x5d99c7){_0x4cfbd0=_0x4cfbd0-0x0;var _0x46c796=_0x1d1d[_0x4cfbd0];return _0x46c796;};'use strict';var multer=require(_0xd1d1('0x0'));var util=require('util');var path=require(_0xd1d1('0x1'));var timeout=require(_0xd1d1('0x2'));var express=require(_0xd1d1('0x3'));var router=express[_0xd1d1('0x4')]();var fs_extra=require(_0xd1d1('0x5'));var auth=require(_0xd1d1('0x6'));var interaction=require(_0xd1d1('0x7'));var config=require(_0xd1d1('0x8'));var controller=require(_0xd1d1('0x9'));router[_0xd1d1('0xa')]('/',auth['isAuthenticated'](),controller[_0xd1d1('0xb')]);router[_0xd1d1('0xa')]('/:id',auth[_0xd1d1('0xc')](),controller[_0xd1d1('0xd')]);router[_0xd1d1('0xa')]('/:id/configurations',auth[_0xd1d1('0xc')](),controller[_0xd1d1('0xe')]);router[_0xd1d1('0xa')](_0xd1d1('0xf'),auth[_0xd1d1('0xc')](),controller[_0xd1d1('0x10')]);router[_0xd1d1('0x11')]('/',auth[_0xd1d1('0xc')](),controller['create']);router[_0xd1d1('0x11')](_0xd1d1('0x12'),auth[_0xd1d1('0xc')](),controller[_0xd1d1('0x13')]);router[_0xd1d1('0x14')](_0xd1d1('0x15'),auth[_0xd1d1('0xc')](),controller[_0xd1d1('0x16')]);router[_0xd1d1('0x17')](_0xd1d1('0x15'),auth[_0xd1d1('0xc')](),controller[_0xd1d1('0x18')]);module[_0xd1d1('0x19')]=router; \ No newline at end of file +var _0x093b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x51426b,_0x56069c){var _0xb53cc3=function(_0x24363c){while(--_0x24363c){_0x51426b['push'](_0x51426b['shift']());}};_0xb53cc3(++_0x56069c);}(_0x093b,0x1b4));var _0xb093=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x093b[_0x4017b0];return _0x5ed4f7;};'use strict';var multer=require(_0xb093('0x0'));var util=require(_0xb093('0x1'));var path=require(_0xb093('0x2'));var timeout=require(_0xb093('0x3'));var express=require('express');var router=express[_0xb093('0x4')]();var fs_extra=require(_0xb093('0x5'));var auth=require(_0xb093('0x6'));var interaction=require(_0xb093('0x7'));var config=require(_0xb093('0x8'));var controller=require('./intZendeskAccount.controller');router[_0xb093('0x9')]('/',auth[_0xb093('0xa')](),controller[_0xb093('0xb')]);router[_0xb093('0x9')](_0xb093('0xc'),auth[_0xb093('0xa')](),controller[_0xb093('0xd')]);router[_0xb093('0x9')](_0xb093('0xe'),auth[_0xb093('0xa')](),controller['getConfigurations']);router['get'](_0xb093('0xf'),auth[_0xb093('0xa')](),controller[_0xb093('0x10')]);router['post']('/',auth[_0xb093('0xa')](),controller[_0xb093('0x11')]);router['post'](_0xb093('0xe'),auth[_0xb093('0xa')](),controller[_0xb093('0x12')]);router[_0xb093('0x13')]('/:id',auth[_0xb093('0xa')](),controller['update']);router[_0xb093('0x14')](_0xb093('0xc'),auth[_0xb093('0xa')](),controller[_0xb093('0x15')]);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 509d348..323f954 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 _0x4279=['remoteUri','password','token','ENUM','integrationTab','exports','STRING','username'];(function(_0x4dfce8,_0x2a9880){var _0x488a8c=function(_0xcf49e5){while(--_0xcf49e5){_0x4dfce8['push'](_0x4dfce8['shift']());}};_0x488a8c(++_0x2a9880);}(_0x4279,0x8d));var _0x9427=function(_0x467e62,_0x444ca2){_0x467e62=_0x467e62-0x0;var _0x4a5487=_0x4279[_0x467e62];return _0x4a5487;};'use strict';var Sequelize=require('sequelize');module[_0x9427('0x0')]={'name':{'type':Sequelize[_0x9427('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9427('0x1')],'unique':_0x9427('0x2')},'password':{'type':Sequelize[_0x9427('0x1')]},'token':{'type':Sequelize[_0x9427('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x9427('0x3')},'authType':{'type':Sequelize['ENUM'](_0x9427('0x4'),_0x9427('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x9427('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9427('0x6')](_0x9427('0x7'),'newTab'),'defaultValue':_0x9427('0x7')}}; \ No newline at end of file +var _0x9b09=['integrationTab','newTab','sequelize','exports','STRING','ENUM','password'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9b09,0x1ad));var _0x99b0=function(_0x50068c,_0x38a87a){_0x50068c=_0x50068c-0x0;var _0x11826a=_0x9b09[_0x50068c];return _0x11826a;};'use strict';var Sequelize=require(_0x99b0('0x0'));module[_0x99b0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x99b0('0x2')]},'username':{'type':Sequelize[_0x99b0('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x99b0('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x99b0('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x99b0('0x3')](_0x99b0('0x4'),'token'),'defaultValue':_0x99b0('0x4')},'serverUrl':{'type':Sequelize[_0x99b0('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x99b0('0x5'),_0x99b0('0x6')),'defaultValue':_0x99b0('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 690c311..44a40c1 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 _0xbee3=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','count','limit','set','reject','save','update','then','error','name','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','destroy','findOne','ZendeskConfiguration','rawAttributes','length','getConfigurations','addConfiguration','AccountId','Subjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1f906d,_0x457311){var _0x133b04=function(_0x4f2a52){while(--_0x4f2a52){_0x1f906d['push'](_0x1f906d['shift']());}};_0x133b04(++_0x457311);}(_0xbee3,0xd5));var _0x3bee=function(_0x581197,_0x3cb99b){_0x581197=_0x581197-0x0;var _0x221059=_0xbee3[_0x581197];return _0x221059;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3bee('0x3'));var util=require(_0x3bee('0x4'));var path=require(_0x3bee('0x5'));var sox=require('sox');var csv=require(_0x3bee('0x6'));var ejs=require(_0x3bee('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x6'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];var integrations=require(_0x3bee('0x17'));function respondWithStatusCode(_0x6950d0,_0x410124){_0x410124=_0x410124||0xcc;return function(_0x459129){if(_0x459129){return _0x6950d0[_0x3bee('0x18')](_0x410124);}return _0x6950d0['status'](_0x410124)[_0x3bee('0x19')]();};}function respondWithResult(_0x33504d,_0x31ac52){_0x31ac52=_0x31ac52||0xc8;return function(_0x237110){if(_0x237110){return _0x33504d[_0x3bee('0x1a')](_0x31ac52)['json'](_0x237110);}};}function respondWithFilteredResult(_0x558436,_0x346767){return function(_0x515397){if(_0x515397){var _0x2cfba7=typeof _0x346767[_0x3bee('0x1b')]==='undefined'&&typeof _0x346767['limit']===_0x3bee('0x1c');var _0x36c5aa=_0x515397[_0x3bee('0x1d')];var _0x631ff8=_0x2cfba7?0x0:_0x346767['offset'];var _0x30a1de=_0x2cfba7?_0x515397[_0x3bee('0x1d')]:_0x346767[_0x3bee('0x1b')]+_0x346767[_0x3bee('0x1e')];var _0x33d812;if(_0x30a1de>=_0x36c5aa){_0x30a1de=_0x36c5aa;_0x33d812=0xc8;}else{_0x33d812=0xce;}_0x558436[_0x3bee('0x1a')](_0x33d812);return _0x558436[_0x3bee('0x1f')]('Content-Range',_0x631ff8+'-'+_0x30a1de+'/'+_0x36c5aa)['json'](_0x515397);}return null;};}function patchUpdates(_0x1afd0f){return function(_0x30bba2){try{jsonpatch['apply'](_0x30bba2,_0x1afd0f,!![]);}catch(_0x471027){return BPromise[_0x3bee('0x20')](_0x471027);}return _0x30bba2[_0x3bee('0x21')]();};}function saveUpdates(_0x179e62,_0x28c248){return function(_0x26e92e){if(_0x26e92e){return _0x26e92e[_0x3bee('0x22')](_0x179e62)['then'](function(_0x8ae4ca){return _0x8ae4ca;});}return null;};}function removeEntity(_0x1ed0c1,_0x1fed5a){return function(_0x3bb884){if(_0x3bb884){return _0x3bb884['destroy']()[_0x3bee('0x23')](function(){_0x1ed0c1[_0x3bee('0x1a')](0xcc)[_0x3bee('0x19')]();});}};}function handleEntityNotFound(_0x4b4cd4,_0x5ed022){return function(_0x13181e){if(!_0x13181e){_0x4b4cd4[_0x3bee('0x18')](0x194);}return _0x13181e;};}function handleError(_0x5341e2,_0x2c0e50){_0x2c0e50=_0x2c0e50||0x1f4;return function(_0x1b4ce0){logger[_0x3bee('0x24')](_0x1b4ce0['stack']);if(_0x1b4ce0[_0x3bee('0x25')]){delete _0x1b4ce0[_0x3bee('0x25')];}_0x5341e2[_0x3bee('0x1a')](_0x2c0e50)['send'](_0x1b4ce0);};}exports[_0x3bee('0x26')]=function(_0xf08fb3,_0x3a3d92){var _0x496abd={},_0x1115ed={},_0x24d523={'count':0x0,'rows':[]};var _0x27ed99=_[_0x3bee('0x27')](db[_0x3bee('0x28')]['rawAttributes'],function(_0x564e45){return{'name':_0x564e45[_0x3bee('0x29')],'type':_0x564e45[_0x3bee('0x2a')][_0x3bee('0x2b')]};});_0x1115ed[_0x3bee('0x2c')]=_['map'](_0x27ed99,'name');_0x1115ed[_0x3bee('0x2d')]=_[_0x3bee('0x2e')](_0xf08fb3['query']);_0x1115ed['filters']=_[_0x3bee('0x2f')](_0x1115ed[_0x3bee('0x2c')],_0x1115ed[_0x3bee('0x2d')]);_0x496abd[_0x3bee('0x30')]=_[_0x3bee('0x2f')](_0x1115ed[_0x3bee('0x2c')],qs[_0x3bee('0x31')](_0xf08fb3[_0x3bee('0x2d')][_0x3bee('0x31')]));_0x496abd[_0x3bee('0x30')]=_0x496abd['attributes']['length']?_0x496abd[_0x3bee('0x30')]:_0x1115ed['model'];if(!_0xf08fb3['query'][_0x3bee('0x32')](_0x3bee('0x33'))){_0x496abd[_0x3bee('0x1e')]=qs[_0x3bee('0x1e')](_0xf08fb3[_0x3bee('0x2d')][_0x3bee('0x1e')]);_0x496abd[_0x3bee('0x1b')]=qs[_0x3bee('0x1b')](_0xf08fb3['query'][_0x3bee('0x1b')]);}_0x496abd[_0x3bee('0x34')]=qs['sort'](_0xf08fb3[_0x3bee('0x2d')][_0x3bee('0x35')]);_0x496abd[_0x3bee('0x36')]=qs[_0x3bee('0x37')](_[_0x3bee('0x38')](_0xf08fb3['query'],_0x1115ed['filters']),_0x27ed99);if(_0xf08fb3[_0x3bee('0x2d')][_0x3bee('0x39')]){_0x496abd[_0x3bee('0x36')]=_[_0x3bee('0x3a')](_0x496abd[_0x3bee('0x36')],{'$or':_[_0x3bee('0x27')](_0x27ed99,function(_0x2c6ca3){if(_0x2c6ca3[_0x3bee('0x2a')]!==_0x3bee('0x3b')){var _0x2591f1={};_0x2591f1[_0x2c6ca3[_0x3bee('0x25')]]={'$like':'%'+_0xf08fb3[_0x3bee('0x2d')]['filter']+'%'};return _0x2591f1;}})});}_0x496abd=_[_0x3bee('0x3a')]({},_0x496abd,_0xf08fb3[_0x3bee('0x3c')]);var _0x25158b={'where':_0x496abd[_0x3bee('0x36')]};return db[_0x3bee('0x28')][_0x3bee('0x1d')](_0x25158b)[_0x3bee('0x23')](function(_0x6195a3){_0x24d523[_0x3bee('0x1d')]=_0x6195a3;if(_0xf08fb3[_0x3bee('0x2d')][_0x3bee('0x3d')]){_0x496abd[_0x3bee('0x3e')]=[{'all':!![]}];}return db[_0x3bee('0x28')]['findAll'](_0x496abd);})[_0x3bee('0x23')](function(_0x2f30d7){_0x24d523[_0x3bee('0x3f')]=_0x2f30d7;return _0x24d523;})[_0x3bee('0x23')](respondWithFilteredResult(_0x3a3d92,_0x496abd))[_0x3bee('0x40')](handleError(_0x3a3d92,null));};exports[_0x3bee('0x41')]=function(_0x13dd72,_0xd1140d){var _0x5d9e1b={'raw':![],'where':{'id':_0x13dd72[_0x3bee('0x42')]['id']}},_0x10a59d={};_0x10a59d[_0x3bee('0x2c')]=_['keys'](db[_0x3bee('0x28')]['rawAttributes']);_0x10a59d[_0x3bee('0x2d')]=_['keys'](_0x13dd72['query']);_0x10a59d[_0x3bee('0x37')]=_[_0x3bee('0x2f')](_0x10a59d[_0x3bee('0x2c')],_0x10a59d[_0x3bee('0x2d')]);_0x5d9e1b[_0x3bee('0x30')]=_['intersection'](_0x10a59d['model'],qs[_0x3bee('0x31')](_0x13dd72['query'][_0x3bee('0x31')]));_0x5d9e1b['attributes']=_0x5d9e1b[_0x3bee('0x30')]['length']?_0x5d9e1b[_0x3bee('0x30')]:_0x10a59d[_0x3bee('0x2c')];if(_0x13dd72[_0x3bee('0x2d')][_0x3bee('0x3d')]){_0x5d9e1b['include']=[{'all':!![]}];}_0x5d9e1b=_['merge']({},_0x5d9e1b,_0x13dd72[_0x3bee('0x3c')]);return db['ZendeskAccount']['find'](_0x5d9e1b)['then'](handleEntityNotFound(_0xd1140d,null))[_0x3bee('0x23')](respondWithResult(_0xd1140d,null))['catch'](handleError(_0xd1140d,null));};exports[_0x3bee('0x43')]=function(_0x33d615,_0xd87fd2){return db['ZendeskAccount'][_0x3bee('0x43')](_0x33d615['body'],{})[_0x3bee('0x23')](respondWithResult(_0xd87fd2,0xc9))['catch'](handleError(_0xd87fd2,null));};exports[_0x3bee('0x22')]=function(_0x16b096,_0x15a96a){if(_0x16b096['body']['id']){delete _0x16b096[_0x3bee('0x44')]['id'];}return db[_0x3bee('0x28')][_0x3bee('0x45')]({'where':{'id':_0x16b096['params']['id']}})['then'](handleEntityNotFound(_0x15a96a,null))[_0x3bee('0x23')](saveUpdates(_0x16b096[_0x3bee('0x44')],null))[_0x3bee('0x23')](respondWithResult(_0x15a96a,null))[_0x3bee('0x40')](handleError(_0x15a96a,null));};exports[_0x3bee('0x46')]=function(_0x21ab40,_0x4005a3){return db['ZendeskAccount'][_0x3bee('0x45')]({'where':{'id':_0x21ab40[_0x3bee('0x42')]['id']}})['then'](handleEntityNotFound(_0x4005a3,null))['then'](removeEntity(_0x4005a3,null))[_0x3bee('0x40')](handleError(_0x4005a3,null));};exports['getConfigurations']=function(_0x1cb54e,_0x2162ce,_0x1f0f23){var _0x4fb836={};var _0x1a13fd={};var _0x3beac9;var _0x127cb8;return db['ZendeskAccount'][_0x3bee('0x47')]({'where':{'id':_0x1cb54e[_0x3bee('0x42')]['id']}})['then'](handleEntityNotFound(_0x2162ce,null))[_0x3bee('0x23')](function(_0x14940e){if(_0x14940e){_0x3beac9=_0x14940e;_0x1a13fd['model']=_[_0x3bee('0x2e')](db[_0x3bee('0x48')][_0x3bee('0x49')]);_0x1a13fd[_0x3bee('0x2d')]=_[_0x3bee('0x2e')](_0x1cb54e[_0x3bee('0x2d')]);_0x1a13fd[_0x3bee('0x37')]=_[_0x3bee('0x2f')](_0x1a13fd['model'],_0x1a13fd['query']);_0x4fb836[_0x3bee('0x30')]=_['intersection'](_0x1a13fd[_0x3bee('0x2c')],qs[_0x3bee('0x31')](_0x1cb54e[_0x3bee('0x2d')]['fields']));_0x4fb836[_0x3bee('0x30')]=_0x4fb836[_0x3bee('0x30')][_0x3bee('0x4a')]?_0x4fb836['attributes']:_0x1a13fd[_0x3bee('0x2c')];_0x4fb836['order']=qs[_0x3bee('0x35')](_0x1cb54e[_0x3bee('0x2d')][_0x3bee('0x35')]);_0x4fb836['where']=qs[_0x3bee('0x37')](_[_0x3bee('0x38')](_0x1cb54e[_0x3bee('0x2d')],_0x1a13fd['filters']));if(_0x1cb54e['query'][_0x3bee('0x39')]){_0x4fb836[_0x3bee('0x36')]=_[_0x3bee('0x3a')](_0x4fb836['where'],{'$or':_['map'](_0x4fb836[_0x3bee('0x30')],function(_0x572fa6){var _0x5cd620={};_0x5cd620[_0x572fa6]={'$like':'%'+_0x1cb54e[_0x3bee('0x2d')][_0x3bee('0x39')]+'%'};return _0x5cd620;})});}_0x4fb836=_[_0x3bee('0x3a')]({},_0x4fb836,_0x1cb54e['options']);return _0x3beac9['getConfigurations'](_0x4fb836);}})[_0x3bee('0x23')](function(_0x1f4eb9){if(_0x1f4eb9){_0x127cb8=_0x1f4eb9['length'];if(!_0x1cb54e[_0x3bee('0x2d')]['hasOwnProperty'](_0x3bee('0x33'))){_0x4fb836[_0x3bee('0x1e')]=qs[_0x3bee('0x1e')](_0x1cb54e[_0x3bee('0x2d')][_0x3bee('0x1e')]);_0x4fb836[_0x3bee('0x1b')]=qs[_0x3bee('0x1b')](_0x1cb54e[_0x3bee('0x2d')][_0x3bee('0x1b')]);}return _0x3beac9[_0x3bee('0x4b')](_0x4fb836);}})[_0x3bee('0x23')](function(_0x5647c8){if(_0x5647c8){return _0x5647c8?{'count':_0x127cb8,'rows':_0x5647c8}:null;}})['then'](respondWithResult(_0x2162ce,null))['catch'](handleError(_0x2162ce,null));};exports[_0x3bee('0x4c')]=function(_0xb5a685,_0x4acba2,_0x9828ad){if(_0xb5a685['body']['id']){delete _0xb5a685[_0x3bee('0x44')]['id'];}return db[_0x3bee('0x28')]['findOne']({'where':{'id':_0xb5a685['params']['id']}})[_0x3bee('0x23')](handleEntityNotFound(_0x4acba2,null))[_0x3bee('0x23')](function(_0x20be01){if(_0x20be01){_0xb5a685['body'][_0x3bee('0x4d')]=_0x20be01['id'];_0xb5a685[_0x3bee('0x44')][_0x3bee('0x4e')]=integrations['getSubjects'](_0xb5a685[_0x3bee('0x44')][_0x3bee('0x4f')],_0xb5a685[_0x3bee('0x44')][_0x3bee('0x2a')]);_0xb5a685['body']['Descriptions']=integrations[_0x3bee('0x50')](_0xb5a685[_0x3bee('0x44')][_0x3bee('0x4f')],_0xb5a685[_0x3bee('0x44')][_0x3bee('0x2a')]);return db['ZendeskConfiguration'][_0x3bee('0x43')](_0xb5a685['body'],{'include':[{'model':db[_0x3bee('0x51')],'as':_0x3bee('0x4e')},{'model':db[_0x3bee('0x51')],'as':_0x3bee('0x52')}]});}return null;})[_0x3bee('0x23')](respondWithResult(_0x4acba2,null))[_0x3bee('0x40')](handleError(_0x4acba2,null));};exports[_0x3bee('0x53')]=function(_0x4d52f3,_0x25f936,_0x28c16e){var _0x42045d='';return db[_0x3bee('0x28')]['findOne']({'where':{'id':_0x4d52f3[_0x3bee('0x42')]['id']},'attributes':['id',_0x3bee('0x54'),_0x3bee('0x55'),_0x3bee('0x56'),_0x3bee('0x57'),_0x3bee('0x58')]})[_0x3bee('0x23')](handleEntityNotFound(_0x25f936,null))[_0x3bee('0x23')](function(_0x519efb){if(_0x519efb){_0x42045d=_0x519efb[_0x3bee('0x58')];var _0x110575=_0x42045d[_0x3bee('0x59')](-0x1);if(_0x110575==='/'){_0x42045d=_0x42045d['substring'](0x0,_0x42045d[_0x3bee('0x5a')](_0x110575));}var _0x479ee2={'method':_0x3bee('0x5b'),'uri':util[_0x3bee('0x5c')](_0x3bee('0x5d'),_0x42045d,_0x3bee('0x5e')),'json':!![]};switch(_0x519efb[_0x3bee('0x57')]){case _0x3bee('0x55'):_0x479ee2[_0x3bee('0x5f')]={'Authorization':util[_0x3bee('0x5c')](_0x3bee('0x60'),new Buffer(util[_0x3bee('0x5c')](_0x3bee('0x61'),_0x519efb[_0x3bee('0x54')],_0x519efb[_0x3bee('0x55')]))[_0x3bee('0x62')](_0x3bee('0x63')))};break;case _0x3bee('0x56'):_0x479ee2[_0x3bee('0x5f')]={'Authorization':util[_0x3bee('0x5c')](_0x3bee('0x60'),new Buffer(util[_0x3bee('0x5c')](_0x3bee('0x64'),_0x519efb[_0x3bee('0x54')],_0x519efb[_0x3bee('0x56')]))['toString'](_0x3bee('0x63')))};break;default:throw new db[(_0x3bee('0x65'))][(_0x3bee('0x66'))](_0x3bee('0x67'));}return rp(_0x479ee2);}})[_0x3bee('0x23')](function(_0x4be1c8){if(_0x4be1c8){var _0x2d6a3d=[_0x3bee('0x68'),_0x3bee('0x69'),'group',_0x3bee('0x6a')];_[_0x3bee('0x6b')](_0x4be1c8['ticket_fields'],function(_0xbfb4af){return _0x2d6a3d['includes'](_0xbfb4af[_0x3bee('0x2a')]);});return{'count':_0x4be1c8[_0x3bee('0x5e')][_0x3bee('0x4a')],'rows':_['map'](_0x4be1c8['ticket_fields'],function(_0x29a2ea){return{'id':_0x29a2ea['id'],'name':_0x29a2ea[_0x3bee('0x6c')]>0x7?_0x29a2ea[_0x3bee('0x6d')]:_0x29a2ea[_0x3bee('0x2a')],'custom':_0x29a2ea[_0x3bee('0x6c')]>0x7?!![]:![],'options':_0x29a2ea[_0x3bee('0x6e')]?_0x29a2ea[_0x3bee('0x6e')]:_0x29a2ea[_0x3bee('0x6f')]?_0x29a2ea['custom_field_options']:[]};})};}})[_0x3bee('0x23')](respondWithResult(_0x25f936,null))[_0x3bee('0x40')](function(_0x22d336){var _0x470ea8=_0x4d52f3[_0x3bee('0x2d')][_0x3bee('0x70')]?0x1f4:_0x22d336[_0x3bee('0x71')]||0x1f4;logger['error'](_0x3bee('0x72'),_0x3bee('0x53'),_0x470ea8,JSON['stringify'](_0x22d336));delete _0x22d336[_0x3bee('0x25')];if(_0x470ea8===0x191){_0x470ea8=0x190;}_0x25f936[_0x3bee('0x1a')](_0x470ea8)['send'](_0x4d52f3[_0x3bee('0x2d')]['test']?{'message':_0x3bee('0x73'),'statusCode':_0x22d336[_0x3bee('0x71')]}:_0x22d336);});}; \ No newline at end of file +var _0xb10b=['sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','rawAttributes','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','Basic\x20%s','%s:%s','password','headers','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','ZendeskAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x204f01,_0x3a520d){var _0x495759=function(_0x587497){while(--_0x587497){_0x204f01['push'](_0x204f01['shift']());}};_0x495759(++_0x3a520d);}(_0xb10b,0x12a));var _0xbb10=function(_0x36d25e,_0x1a047d){_0x36d25e=_0x36d25e-0x0;var _0x4b95b8=_0xb10b[_0x36d25e];return _0x4b95b8;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];var integrations=require(_0xbb10('0x18'));function respondWithStatusCode(_0x285009,_0x193a27){_0x193a27=_0x193a27||0xcc;return function(_0x442548){if(_0x442548){return _0x285009[_0xbb10('0x19')](_0x193a27);}return _0x285009['status'](_0x193a27)[_0xbb10('0x1a')]();};}function respondWithResult(_0x42d7e4,_0x45b9d6){_0x45b9d6=_0x45b9d6||0xc8;return function(_0x17fd46){if(_0x17fd46){return _0x42d7e4[_0xbb10('0x1b')](_0x45b9d6)[_0xbb10('0x1c')](_0x17fd46);}};}function respondWithFilteredResult(_0x24a57b,_0x36b5e8){return function(_0x3e26f4){if(_0x3e26f4){var _0x2b184e=typeof _0x36b5e8['offset']===_0xbb10('0x1d')&&typeof _0x36b5e8[_0xbb10('0x1e')]===_0xbb10('0x1d');var _0x42db98=_0x3e26f4[_0xbb10('0x1f')];var _0x1682a4=_0x2b184e?0x0:_0x36b5e8[_0xbb10('0x20')];var _0x30efc6=_0x2b184e?_0x3e26f4[_0xbb10('0x1f')]:_0x36b5e8[_0xbb10('0x20')]+_0x36b5e8['limit'];var _0x5ff0cf;if(_0x30efc6>=_0x42db98){_0x30efc6=_0x42db98;_0x5ff0cf=0xc8;}else{_0x5ff0cf=0xce;}_0x24a57b[_0xbb10('0x1b')](_0x5ff0cf);return _0x24a57b[_0xbb10('0x21')](_0xbb10('0x22'),_0x1682a4+'-'+_0x30efc6+'/'+_0x42db98)[_0xbb10('0x1c')](_0x3e26f4);}return null;};}function patchUpdates(_0x44e563){return function(_0x4deb49){try{jsonpatch[_0xbb10('0x23')](_0x4deb49,_0x44e563,!![]);}catch(_0x12ef77){return BPromise['reject'](_0x12ef77);}return _0x4deb49['save']();};}function saveUpdates(_0x8e2b97,_0x311abe){return function(_0x2e911d){if(_0x2e911d){return _0x2e911d[_0xbb10('0x24')](_0x8e2b97)[_0xbb10('0x25')](function(_0x1824b7){return _0x1824b7;});}return null;};}function removeEntity(_0x407cb4,_0x436104){return function(_0x7f2377){if(_0x7f2377){return _0x7f2377[_0xbb10('0x26')]()[_0xbb10('0x25')](function(){_0x407cb4[_0xbb10('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x19')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x27')](_0x2fdde9[_0xbb10('0x28')]);if(_0x2fdde9[_0xbb10('0x29')]){delete _0x2fdde9[_0xbb10('0x29')];}_0x2c89b9[_0xbb10('0x1b')](_0x4e25ff)[_0xbb10('0x2a')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2b')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2c')][_0xbb10('0x2d')]};});_0x2e0249[_0xbb10('0x2e')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x2e0249[_0xbb10('0x2e')],_0x2e0249[_0xbb10('0x2f')]);_0xfc3595[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x2e0249[_0xbb10('0x2e')],qs['fields'](_0x3796c7[_0xbb10('0x2f')][_0xbb10('0x34')]));_0xfc3595[_0xbb10('0x33')]=_0xfc3595[_0xbb10('0x33')][_0xbb10('0x35')]?_0xfc3595[_0xbb10('0x33')]:_0x2e0249[_0xbb10('0x2e')];if(!_0x3796c7[_0xbb10('0x2f')][_0xbb10('0x36')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x2f')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x20')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x37')]=qs[_0xbb10('0x38')](_0x3796c7[_0xbb10('0x2f')][_0xbb10('0x38')]);_0xfc3595[_0xbb10('0x39')]=qs[_0xbb10('0x31')](_['pick'](_0x3796c7[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x31')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3a')](_0xfc3595[_0xbb10('0x39')],{'$or':_[_0xbb10('0x3b')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2c')]!==_0xbb10('0x3c')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x2f')][_0xbb10('0x3d')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3a')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3e')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x39')]};return db[_0xbb10('0x2b')]['count'](_0x4f1cdd)[_0xbb10('0x25')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1f')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x2f')][_0xbb10('0x3f')]){_0xfc3595[_0xbb10('0x40')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xbb10('0x41')](_0xfc3595);})[_0xbb10('0x25')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x42')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x43')](handleError(_0x21ac54,null));};exports[_0xbb10('0x44')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x45')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2b')]['rawAttributes']);_0x351484[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x23dc18['query']);_0x351484[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x351484[_0xbb10('0x2e')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x351484[_0xbb10('0x2e')],qs[_0xbb10('0x34')](_0x23dc18[_0xbb10('0x2f')][_0xbb10('0x34')]));_0x5e2cfa[_0xbb10('0x33')]=_0x5e2cfa[_0xbb10('0x33')][_0xbb10('0x35')]?_0x5e2cfa[_0xbb10('0x33')]:_0x351484[_0xbb10('0x2e')];if(_0x23dc18[_0xbb10('0x2f')]['includeAll']){_0x5e2cfa[_0xbb10('0x40')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3a')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2b')][_0xbb10('0x46')](_0x5e2cfa)[_0xbb10('0x25')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x25')](respondWithResult(_0x403beb,null))[_0xbb10('0x43')](handleError(_0x403beb,null));};exports[_0xbb10('0x47')]=function(_0x3e06b0,_0x5be85e){return db['ZendeskAccount'][_0xbb10('0x47')](_0x3e06b0[_0xbb10('0x48')],{})[_0xbb10('0x25')](respondWithResult(_0x5be85e,0xc9))['catch'](handleError(_0x5be85e,null));};exports['update']=function(_0x3cd6f3,_0x34cf4e){if(_0x3cd6f3[_0xbb10('0x48')]['id']){delete _0x3cd6f3[_0xbb10('0x48')]['id'];}return db[_0xbb10('0x2b')][_0xbb10('0x46')]({'where':{'id':_0x3cd6f3[_0xbb10('0x45')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x34cf4e,null))[_0xbb10('0x25')](saveUpdates(_0x3cd6f3[_0xbb10('0x48')],null))['then'](respondWithResult(_0x34cf4e,null))['catch'](handleError(_0x34cf4e,null));};exports[_0xbb10('0x26')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x2b')][_0xbb10('0x46')]({'where':{'id':_0x467dba[_0xbb10('0x45')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x36ab7d,null))[_0xbb10('0x25')](removeEntity(_0x36ab7d,null))[_0xbb10('0x43')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x49')]=function(_0x19ca3e,_0x20e18a,_0x61e689){var _0x2e6fd9={};var _0x1d15f4={};var _0x547a7a;var _0x124052;return db['ZendeskAccount'][_0xbb10('0x4a')]({'where':{'id':_0x19ca3e[_0xbb10('0x45')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x20e18a,null))[_0xbb10('0x25')](function(_0x26e66e){if(_0x26e66e){_0x547a7a=_0x26e66e;_0x1d15f4[_0xbb10('0x2e')]=_[_0xbb10('0x30')](db[_0xbb10('0x4b')][_0xbb10('0x4c')]);_0x1d15f4[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x19ca3e[_0xbb10('0x2f')]);_0x1d15f4[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x1d15f4[_0xbb10('0x2e')],_0x1d15f4['query']);_0x2e6fd9[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x1d15f4[_0xbb10('0x2e')],qs[_0xbb10('0x34')](_0x19ca3e[_0xbb10('0x2f')][_0xbb10('0x34')]));_0x2e6fd9['attributes']=_0x2e6fd9[_0xbb10('0x33')][_0xbb10('0x35')]?_0x2e6fd9[_0xbb10('0x33')]:_0x1d15f4[_0xbb10('0x2e')];_0x2e6fd9[_0xbb10('0x37')]=qs[_0xbb10('0x38')](_0x19ca3e[_0xbb10('0x2f')][_0xbb10('0x38')]);_0x2e6fd9[_0xbb10('0x39')]=qs[_0xbb10('0x31')](_[_0xbb10('0x4d')](_0x19ca3e[_0xbb10('0x2f')],_0x1d15f4[_0xbb10('0x31')]));if(_0x19ca3e['query']['filter']){_0x2e6fd9[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x2e6fd9[_0xbb10('0x39')],{'$or':_[_0xbb10('0x3b')](_0x2e6fd9['attributes'],function(_0x506498){var _0x79411e={};_0x79411e[_0x506498]={'$like':'%'+_0x19ca3e[_0xbb10('0x2f')][_0xbb10('0x3d')]+'%'};return _0x79411e;})});}_0x2e6fd9=_[_0xbb10('0x3a')]({},_0x2e6fd9,_0x19ca3e[_0xbb10('0x3e')]);return _0x547a7a[_0xbb10('0x49')](_0x2e6fd9);}})[_0xbb10('0x25')](function(_0x4a5fb9){if(_0x4a5fb9){_0x124052=_0x4a5fb9[_0xbb10('0x35')];if(!_0x19ca3e[_0xbb10('0x2f')]['hasOwnProperty']('nolimit')){_0x2e6fd9['limit']=qs[_0xbb10('0x1e')](_0x19ca3e[_0xbb10('0x2f')][_0xbb10('0x1e')]);_0x2e6fd9['offset']=qs['offset'](_0x19ca3e['query'][_0xbb10('0x20')]);}return _0x547a7a[_0xbb10('0x49')](_0x2e6fd9);}})[_0xbb10('0x25')](function(_0x4e9fbd){if(_0x4e9fbd){return _0x4e9fbd?{'count':_0x124052,'rows':_0x4e9fbd}:null;}})[_0xbb10('0x25')](respondWithResult(_0x20e18a,null))[_0xbb10('0x43')](handleError(_0x20e18a,null));};exports['addConfiguration']=function(_0x4a560c,_0x27d7b9,_0x308896){if(_0x4a560c[_0xbb10('0x48')]['id']){delete _0x4a560c[_0xbb10('0x48')]['id'];}return db['ZendeskAccount'][_0xbb10('0x4a')]({'where':{'id':_0x4a560c[_0xbb10('0x45')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x27d7b9,null))['then'](function(_0x402a01){if(_0x402a01){_0x4a560c[_0xbb10('0x48')][_0xbb10('0x4e')]=_0x402a01['id'];_0x4a560c['body'][_0xbb10('0x4f')]=integrations[_0xbb10('0x50')](_0x4a560c[_0xbb10('0x48')][_0xbb10('0x51')],_0x4a560c['body'][_0xbb10('0x2c')]);_0x4a560c[_0xbb10('0x48')][_0xbb10('0x52')]=integrations[_0xbb10('0x53')](_0x4a560c['body'][_0xbb10('0x51')],_0x4a560c[_0xbb10('0x48')][_0xbb10('0x2c')]);return db[_0xbb10('0x4b')][_0xbb10('0x47')](_0x4a560c[_0xbb10('0x48')],{'include':[{'model':db[_0xbb10('0x54')],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0xbb10('0x25')](respondWithResult(_0x27d7b9,null))[_0xbb10('0x43')](handleError(_0x27d7b9,null));};exports[_0xbb10('0x55')]=function(_0x5c9afc,_0x5cd089,_0x46f462){var _0x1b11c0='';return db[_0xbb10('0x2b')][_0xbb10('0x4a')]({'where':{'id':_0x5c9afc[_0xbb10('0x45')]['id']},'attributes':['id',_0xbb10('0x56'),'password',_0xbb10('0x57'),_0xbb10('0x58'),_0xbb10('0x59')]})[_0xbb10('0x25')](handleEntityNotFound(_0x5cd089,null))[_0xbb10('0x25')](function(_0x5bfc68){if(_0x5bfc68){_0x1b11c0=_0x5bfc68['remoteUri'];var _0x5ad6ad=_0x1b11c0[_0xbb10('0x5a')](-0x1);if(_0x5ad6ad==='/'){_0x1b11c0=_0x1b11c0[_0xbb10('0x5b')](0x0,_0x1b11c0[_0xbb10('0x5c')](_0x5ad6ad));}var _0x21459e={'method':_0xbb10('0x5d'),'uri':util[_0xbb10('0x5e')]('%s/%s',_0x1b11c0,_0xbb10('0x5f')),'json':!![]};switch(_0x5bfc68['authType']){case'password':_0x21459e['headers']={'Authorization':util[_0xbb10('0x5e')](_0xbb10('0x60'),new Buffer(util[_0xbb10('0x5e')](_0xbb10('0x61'),_0x5bfc68['username'],_0x5bfc68[_0xbb10('0x62')]))['toString']('base64'))};break;case _0xbb10('0x57'):_0x21459e[_0xbb10('0x63')]={'Authorization':util[_0xbb10('0x5e')](_0xbb10('0x60'),new Buffer(util[_0xbb10('0x5e')]('%s/token:%s',_0x5bfc68[_0xbb10('0x56')],_0x5bfc68[_0xbb10('0x57')]))[_0xbb10('0x64')](_0xbb10('0x65')))};break;default:throw new db[(_0xbb10('0x66'))][(_0xbb10('0x67'))](_0xbb10('0x68'));}return rp(_0x21459e);}})['then'](function(_0x387b10){if(_0x387b10){var _0x1f648a=[_0xbb10('0x69'),_0xbb10('0x6a'),_0xbb10('0x6b'),_0xbb10('0x6c')];_[_0xbb10('0x6d')](_0x387b10[_0xbb10('0x5f')],function(_0x5a4429){return _0x1f648a[_0xbb10('0x6e')](_0x5a4429[_0xbb10('0x2c')]);});return{'count':_0x387b10[_0xbb10('0x5f')]['length'],'rows':_['map'](_0x387b10['ticket_fields'],function(_0x23286d){return{'id':_0x23286d['id'],'name':_0x23286d['position']>0x7?_0x23286d['title']:_0x23286d[_0xbb10('0x2c')],'custom':_0x23286d[_0xbb10('0x6f')]>0x7?!![]:![],'options':_0x23286d[_0xbb10('0x70')]?_0x23286d[_0xbb10('0x70')]:_0x23286d[_0xbb10('0x71')]?_0x23286d[_0xbb10('0x71')]:[]};})};}})[_0xbb10('0x25')](respondWithResult(_0x5cd089,null))[_0xbb10('0x43')](function(_0x188b97){var _0x5206e1=_0x5c9afc[_0xbb10('0x2f')][_0xbb10('0x72')]?0x1f4:_0x188b97[_0xbb10('0x73')]||0x1f4;logger[_0xbb10('0x27')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5206e1,JSON[_0xbb10('0x74')](_0x188b97));delete _0x188b97[_0xbb10('0x29')];if(_0x5206e1===0x191){_0x5206e1=0x190;}_0x5cd089[_0xbb10('0x1b')](_0x5206e1)[_0xbb10('0x2a')](_0x5c9afc['query'][_0xbb10('0x72')]?{'message':_0xbb10('0x75'),'statusCode':_0x188b97[_0xbb10('0x73')]}:_0x188b97);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index dcadcf7..d2e470d 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 _0xc439=['request-promise','path','rimraf','./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc439,0x1b5));var _0x9c43=function(_0x2ccfc7,_0x2b3411){_0x2ccfc7=_0x2ccfc7-0x0;var _0x3982a4=_0xc439[_0x2ccfc7];return _0x3982a4;};'use strict';var _=require(_0x9c43('0x0'));var util=require(_0x9c43('0x1'));var logger=require(_0x9c43('0x2'))('api');var moment=require(_0x9c43('0x3'));var BPromise=require(_0x9c43('0x4'));var rp=require(_0x9c43('0x5'));var fs=require('fs');var path=require(_0x9c43('0x6'));var rimraf=require(_0x9c43('0x7'));var config=require('../../config/environment');var attributes=require(_0x9c43('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x9c43('0x9')]=function(_0x44ee8a,_0x11de66){return _0x44ee8a[_0x9c43('0xa')](_0x9c43('0xb'),attributes,{'tableName':_0x9c43('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5cd=['moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api'];(function(_0x2ec5da,_0x4b18c1){var _0x58e313=function(_0x25310e){while(--_0x25310e){_0x2ec5da['push'](_0x2ec5da['shift']());}};_0x58e313(++_0x4b18c1);}(_0xc5cd,0x185));var _0xdc5c=function(_0x301995,_0x1b9687){_0x301995=_0x301995-0x0;var _0x4ccf3d=_0xc5cd[_0x301995];return _0x4ccf3d;};'use strict';var _=require(_0xdc5c('0x0'));var util=require('util');var logger=require(_0xdc5c('0x1'))(_0xdc5c('0x2'));var moment=require(_0xdc5c('0x3'));var BPromise=require(_0xdc5c('0x4'));var rp=require(_0xdc5c('0x5'));var fs=require('fs');var path=require(_0xdc5c('0x6'));var rimraf=require(_0xdc5c('0x7'));var config=require('../../config/environment');var attributes=require(_0xdc5c('0x8'));var integrations=require(_0xdc5c('0x9'));module[_0xdc5c('0xa')]=function(_0x24f44f,_0x4b54e4){return _0x24f44f[_0xdc5c('0xb')](_0xdc5c('0xc'),attributes,{'tableName':_0xdc5c('0xd'),'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 15af4e8..67c684b 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 _0x85b4=['GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','find','ShowZendeskAccount','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xe1928d,_0xfcc6ef){var _0x1ee209=function(_0x29b13a){while(--_0x29b13a){_0xe1928d['push'](_0xe1928d['shift']());}};_0x1ee209(++_0xfcc6ef);}(_0x85b4,0x183));var _0x485b=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0x85b4[_0xd816e2];return _0x1f5924;};'use strict';var _=require(_0x485b('0x0'));var util=require(_0x485b('0x1'));var moment=require(_0x485b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x485b('0x3'))['db'];var utils=require(_0x485b('0x4'));var logger=require(_0x485b('0x5'))(_0x485b('0x6'));var config=require(_0x485b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x485b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f7a26,_0x496828,_0x24d717){return new BPromise(function(_0x9237,_0x5e78c4){return client['request'](_0x2f7a26,_0x24d717)[_0x485b('0x9')](function(_0x57579e){logger[_0x485b('0xa')](_0x485b('0xb'),_0x496828,_0x485b('0xc'));logger[_0x485b('0xd')](_0x485b('0xe'),_0x496828,_0x485b('0xc'),JSON[_0x485b('0xf')](_0x57579e));if(_0x57579e[_0x485b('0x10')]){if(_0x57579e[_0x485b('0x10')][_0x485b('0x11')]===0x1f4){logger[_0x485b('0x10')](_0x485b('0xb'),_0x496828,_0x57579e[_0x485b('0x10')][_0x485b('0x12')]);return _0x5e78c4(_0x57579e[_0x485b('0x10')]['message']);}logger[_0x485b('0x10')](_0x485b('0xb'),_0x496828,_0x57579e['error'][_0x485b('0x12')]);return _0x9237(_0x57579e[_0x485b('0x10')][_0x485b('0x12')]);}else{logger[_0x485b('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x496828,_0x485b('0xc'));_0x9237(_0x57579e[_0x485b('0x13')][_0x485b('0x12')]);}})[_0x485b('0x14')](function(_0x21aad2){logger[_0x485b('0x10')](_0x485b('0xb'),_0x496828,_0x21aad2);_0x5e78c4(_0x21aad2);});});}exports[_0x485b('0x15')]=function(_0x4384f8){var _0x9ba5a4=this;return new Promise(function(_0x539b92,_0x32c86a){return db[_0x485b('0x16')][_0x485b('0x17')]({'raw':_0x4384f8[_0x485b('0x18')]?_0x4384f8['options'][_0x485b('0x19')]===undefined?!![]:![]:!![],'where':_0x4384f8['options']?_0x4384f8[_0x485b('0x18')][_0x485b('0x1a')]||null:null,'attributes':_0x4384f8[_0x485b('0x18')]?_0x4384f8[_0x485b('0x18')][_0x485b('0x1b')]||null:null,'limit':_0x4384f8[_0x485b('0x18')]?_0x4384f8[_0x485b('0x18')][_0x485b('0x1c')]||null:null,'include':_0x4384f8[_0x485b('0x18')]?_0x4384f8['options'][_0x485b('0x1d')]?_['map'](_0x4384f8['options']['include'],function(_0x45dd5c){return{'model':db[_0x45dd5c[_0x485b('0x1e')]],'as':_0x45dd5c['as'],'attributes':_0x45dd5c['attributes'],'include':_0x45dd5c[_0x485b('0x1d')]?_[_0x485b('0x1f')](_0x45dd5c[_0x485b('0x1d')],function(_0x31326b){return{'model':db[_0x31326b[_0x485b('0x1e')]],'as':_0x31326b['as'],'attributes':_0x31326b['attributes'],'include':_0x31326b['include']?_['map'](_0x31326b[_0x485b('0x1d')],function(_0x43a0b8){return{'model':db[_0x43a0b8[_0x485b('0x1e')]],'as':_0x43a0b8['as'],'attributes':_0x43a0b8[_0x485b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3335f3){logger['info'](_0x485b('0x15'),_0x4384f8);logger[_0x485b('0xd')](_0x485b('0x15'),_0x4384f8,JSON[_0x485b('0xf')](_0x3335f3));_0x539b92(_0x3335f3);})[_0x485b('0x14')](function(_0x132712){logger[_0x485b('0x10')]('GetZendeskAccount',_0x132712[_0x485b('0x12')],_0x4384f8);_0x32c86a(_0x9ba5a4[_0x485b('0x10')](0x1f4,_0x132712[_0x485b('0x12')]));});});};exports['ShowZendeskAccount']=function(_0x350075){var _0x64b069=this;return new Promise(function(_0x3ec042,_0x3dcee6){return db[_0x485b('0x16')][_0x485b('0x20')]({'raw':_0x350075[_0x485b('0x18')]?_0x350075[_0x485b('0x18')][_0x485b('0x19')]===undefined?!![]:![]:!![],'where':_0x350075[_0x485b('0x18')]?_0x350075[_0x485b('0x18')][_0x485b('0x1a')]||null:null,'attributes':_0x350075[_0x485b('0x18')]?_0x350075['options']['attributes']||null:null,'include':_0x350075[_0x485b('0x18')]?_0x350075[_0x485b('0x18')][_0x485b('0x1d')]?_[_0x485b('0x1f')](_0x350075[_0x485b('0x18')][_0x485b('0x1d')],function(_0x561096){return{'model':db[_0x561096[_0x485b('0x1e')]],'as':_0x561096['as'],'attributes':_0x561096['attributes'],'include':_0x561096[_0x485b('0x1d')]?_[_0x485b('0x1f')](_0x561096['include'],function(_0x1f1203){return{'model':db[_0x1f1203[_0x485b('0x1e')]],'as':_0x1f1203['as'],'attributes':_0x1f1203[_0x485b('0x1b')],'include':_0x1f1203[_0x485b('0x1d')]?_[_0x485b('0x1f')](_0x1f1203[_0x485b('0x1d')],function(_0x4f5ec1){return{'model':db[_0x4f5ec1[_0x485b('0x1e')]],'as':_0x4f5ec1['as'],'attributes':_0x4f5ec1[_0x485b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x485b('0x9')](function(_0x5a11c9){logger['info']('ShowZendeskAccount',_0x350075);logger['debug'](_0x485b('0x21'),_0x350075,JSON[_0x485b('0xf')](_0x5a11c9));_0x3ec042(_0x5a11c9);})[_0x485b('0x14')](function(_0x5d83dc){logger['error'](_0x485b('0x21'),_0x5d83dc['message'],_0x350075);_0x3dcee6(_0x64b069[_0x485b('0x10')](0x1f4,_0x5d83dc['message']));});});}; \ No newline at end of file +var _0x4b82=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','GetZendeskAccount','findAll','options','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','find','raw','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4b82,0x8a));var _0x24b8=function(_0x3cb004,_0x25d5d1){_0x3cb004=_0x3cb004-0x0;var _0x343ec2=_0x4b82[_0x3cb004];return _0x343ec2;};'use strict';var _=require(_0x24b8('0x0'));var util=require(_0x24b8('0x1'));var moment=require(_0x24b8('0x2'));var BPromise=require(_0x24b8('0x3'));var rs=require(_0x24b8('0x4'));var fs=require('fs');var Redis=require(_0x24b8('0x5'));var db=require(_0x24b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x24b8('0x7'));var jayson=require(_0x24b8('0x8'));var client=jayson[_0x24b8('0x9')][_0x24b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdbc1ab,_0x25d234,_0x289e23){return new BPromise(function(_0x338485,_0x580fe8){return client[_0x24b8('0xb')](_0xdbc1ab,_0x289e23)[_0x24b8('0xc')](function(_0x7c54e4){logger[_0x24b8('0xd')](_0x24b8('0xe'),_0x25d234,'request\x20sent');logger[_0x24b8('0xf')](_0x24b8('0x10'),_0x25d234,'request\x20sent',JSON['stringify'](_0x7c54e4));if(_0x7c54e4[_0x24b8('0x11')]){if(_0x7c54e4[_0x24b8('0x11')][_0x24b8('0x12')]===0x1f4){logger[_0x24b8('0x11')](_0x24b8('0xe'),_0x25d234,_0x7c54e4[_0x24b8('0x11')]['message']);return _0x580fe8(_0x7c54e4[_0x24b8('0x11')][_0x24b8('0x13')]);}logger['error'](_0x24b8('0xe'),_0x25d234,_0x7c54e4[_0x24b8('0x11')]['message']);return _0x338485(_0x7c54e4['error'][_0x24b8('0x13')]);}else{logger[_0x24b8('0xd')](_0x24b8('0xe'),_0x25d234,_0x24b8('0x14'));_0x338485(_0x7c54e4['result'][_0x24b8('0x13')]);}})[_0x24b8('0x15')](function(_0x3fd0c5){logger[_0x24b8('0x11')](_0x24b8('0xe'),_0x25d234,_0x3fd0c5);_0x580fe8(_0x3fd0c5);});});}exports[_0x24b8('0x16')]=function(_0x50c4a8){var _0x47b24c=this;return new Promise(function(_0x42c906,_0x3047dd){return db['ZendeskAccount'][_0x24b8('0x17')]({'raw':_0x50c4a8[_0x24b8('0x18')]?_0x50c4a8[_0x24b8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x50c4a8[_0x24b8('0x18')]?_0x50c4a8['options']['where']||null:null,'attributes':_0x50c4a8[_0x24b8('0x18')]?_0x50c4a8['options'][_0x24b8('0x19')]||null:null,'limit':_0x50c4a8[_0x24b8('0x18')]?_0x50c4a8[_0x24b8('0x18')][_0x24b8('0x1a')]||null:null,'include':_0x50c4a8[_0x24b8('0x18')]?_0x50c4a8['options'][_0x24b8('0x1b')]?_[_0x24b8('0x1c')](_0x50c4a8[_0x24b8('0x18')][_0x24b8('0x1b')],function(_0x314aff){return{'model':db[_0x314aff[_0x24b8('0x1d')]],'as':_0x314aff['as'],'attributes':_0x314aff[_0x24b8('0x19')],'include':_0x314aff[_0x24b8('0x1b')]?_[_0x24b8('0x1c')](_0x314aff[_0x24b8('0x1b')],function(_0x28bc8d){return{'model':db[_0x28bc8d[_0x24b8('0x1d')]],'as':_0x28bc8d['as'],'attributes':_0x28bc8d[_0x24b8('0x19')],'include':_0x28bc8d[_0x24b8('0x1b')]?_[_0x24b8('0x1c')](_0x28bc8d[_0x24b8('0x1b')],function(_0x2a5392){return{'model':db[_0x2a5392[_0x24b8('0x1d')]],'as':_0x2a5392['as'],'attributes':_0x2a5392[_0x24b8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x24b8('0xc')](function(_0x120206){logger[_0x24b8('0xd')](_0x24b8('0x16'),_0x50c4a8);logger['debug'](_0x24b8('0x16'),_0x50c4a8,JSON[_0x24b8('0x1e')](_0x120206));_0x42c906(_0x120206);})[_0x24b8('0x15')](function(_0x5b7b1f){logger['error'](_0x24b8('0x16'),_0x5b7b1f[_0x24b8('0x13')],_0x50c4a8);_0x3047dd(_0x47b24c['error'](0x1f4,_0x5b7b1f['message']));});});};exports[_0x24b8('0x1f')]=function(_0x3736d0){var _0x12a956=this;return new Promise(function(_0x4f5dc0,_0x2efff8){return db[_0x24b8('0x20')][_0x24b8('0x21')]({'raw':_0x3736d0[_0x24b8('0x18')]?_0x3736d0[_0x24b8('0x18')][_0x24b8('0x22')]===undefined?!![]:![]:!![],'where':_0x3736d0[_0x24b8('0x18')]?_0x3736d0[_0x24b8('0x18')]['where']||null:null,'attributes':_0x3736d0[_0x24b8('0x18')]?_0x3736d0[_0x24b8('0x18')][_0x24b8('0x19')]||null:null,'include':_0x3736d0['options']?_0x3736d0[_0x24b8('0x18')]['include']?_[_0x24b8('0x1c')](_0x3736d0[_0x24b8('0x18')][_0x24b8('0x1b')],function(_0x1c021d){return{'model':db[_0x1c021d[_0x24b8('0x1d')]],'as':_0x1c021d['as'],'attributes':_0x1c021d[_0x24b8('0x19')],'include':_0x1c021d[_0x24b8('0x1b')]?_['map'](_0x1c021d[_0x24b8('0x1b')],function(_0x4e1080){return{'model':db[_0x4e1080[_0x24b8('0x1d')]],'as':_0x4e1080['as'],'attributes':_0x4e1080['attributes'],'include':_0x4e1080['include']?_['map'](_0x4e1080[_0x24b8('0x1b')],function(_0x3c5cc6){return{'model':db[_0x3c5cc6[_0x24b8('0x1d')]],'as':_0x3c5cc6['as'],'attributes':_0x3c5cc6[_0x24b8('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x341721){logger[_0x24b8('0xd')](_0x24b8('0x1f'),_0x3736d0);logger[_0x24b8('0xf')](_0x24b8('0x1f'),_0x3736d0,JSON[_0x24b8('0x1e')](_0x341721));_0x4f5dc0(_0x341721);})[_0x24b8('0x15')](function(_0x5df69e){logger[_0x24b8('0x11')](_0x24b8('0x1f'),_0x5df69e['message'],_0x3736d0);_0x2efff8(_0x12a956[_0x24b8('0x11')](0x1f4,_0x5df69e[_0x24b8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8910aa4..e98d013 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 _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0xb688,0xcf));var _0x8b68=function(_0x2ebce5,_0x4d089a){_0x2ebce5=_0x2ebce5-0x0;var _0x2173cf=_0xb688[_0x2ebce5];return _0x2173cf;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=router; \ No newline at end of file +var _0xcb91=['get','index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','create','post','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller'];(function(_0x13e300,_0x1bcb41){var _0x5a3eea=function(_0x2dfd2a){while(--_0x2dfd2a){_0x13e300['push'](_0x13e300['shift']());}};_0x5a3eea(++_0x1bcb41);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0xcb91[_0x590851];return _0x3b0115;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/:id',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x1cb9('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0x7')]('/:id/descriptions',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0x7')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x1cb9('0x10')]);router[_0x1cb9('0x11')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['setTags']);router[_0x1cb9('0x12')](_0x1cb9('0x13'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);router[_0x1cb9('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1cb9('0x16')]);module[_0x1cb9('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 20c1952..f8e3de8 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 _0xdff6=['STRING','sequelize','exports'];(function(_0x4d6a82,_0x411478){var _0x283918=function(_0x3a17cc){while(--_0x3a17cc){_0x4d6a82['push'](_0x4d6a82['shift']());}};_0x283918(++_0x411478);}(_0xdff6,0x130));var _0x6dff=function(_0x5421e2,_0x3d82fc){_0x5421e2=_0x5421e2-0x0;var _0x423e2d=_0xdff6[_0x5421e2];return _0x423e2d;};'use strict';var Sequelize=require(_0x6dff('0x0'));module[_0x6dff('0x1')]={'name':{'type':Sequelize[_0x6dff('0x2')]},'description':{'type':Sequelize[_0x6dff('0x2')]}}; \ No newline at end of file +var _0x3a89=['STRING','sequelize'];(function(_0x3834fa,_0x18360b){var _0x4c8b0d=function(_0x431ff4){while(--_0x431ff4){_0x3834fa['push'](_0x3834fa['shift']());}};_0x4c8b0d(++_0x18360b);}(_0x3a89,0x17f));var _0x93a8=function(_0x4709dd,_0x3ce70d){_0x4709dd=_0x4709dd-0x0;var _0x1c3128=_0x3a89[_0x4709dd];return _0x1c3128;};'use strict';var Sequelize=require(_0x93a8('0x0'));module['exports']={'name':{'type':Sequelize[_0x93a8('0x1')]},'description':{'type':Sequelize[_0x93a8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index efd5bcd..fcdb9cd 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 _0x2a65=['query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','ZendeskConfiguration','include','findAll','show','keys','find','catch','create','params','body','getFields','pick','nolimit','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map'];(function(_0x3fe440,_0x18d0cb){var _0x30cf95=function(_0x1f7af5){while(--_0x1f7af5){_0x3fe440['push'](_0x3fe440['shift']());}};_0x30cf95(++_0x18d0cb);}(_0x2a65,0xc7));var _0x52a6=function(_0x4083da,_0x7aee27){_0x4083da=_0x4083da-0x0;var _0x46dfcc=_0x2a65[_0x4083da];return _0x46dfcc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x52a6('0x0'));var rp=require(_0x52a6('0x1'));var moment=require(_0x52a6('0x2'));var BPromise=require(_0x52a6('0x3'));var Mustache=require(_0x52a6('0x4'));var util=require(_0x52a6('0x5'));var path=require(_0x52a6('0x6'));var sox=require(_0x52a6('0x7'));var csv=require(_0x52a6('0x8'));var ejs=require(_0x52a6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x52a6('0xa'));var squel=require(_0x52a6('0xb'));var crypto=require(_0x52a6('0xc'));var jsforce=require(_0x52a6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x52a6('0xe'));var Papa=require(_0x52a6('0xf'));var Redis=require(_0x52a6('0x10'));var authService=require(_0x52a6('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52a6('0x12'));var logger=require(_0x52a6('0x13'))(_0x52a6('0x14'));var utils=require(_0x52a6('0x15'));var config=require(_0x52a6('0x16'));var licenseUtil=require(_0x52a6('0x17'));var db=require(_0x52a6('0x18'))['db'];function respondWithStatusCode(_0x3c61c7,_0x3c11cb){_0x3c11cb=_0x3c11cb||0xcc;return function(_0x5be1cb){if(_0x5be1cb){return _0x3c61c7[_0x52a6('0x19')](_0x3c11cb);}return _0x3c61c7[_0x52a6('0x1a')](_0x3c11cb)[_0x52a6('0x1b')]();};}function respondWithResult(_0x241ce7,_0x242149){_0x242149=_0x242149||0xc8;return function(_0x76027a){if(_0x76027a){return _0x241ce7[_0x52a6('0x1a')](_0x242149)['json'](_0x76027a);}};}function respondWithFilteredResult(_0x53a692,_0x1f3598){return function(_0x511780){if(_0x511780){var _0x83e1d9=typeof _0x1f3598['offset']===_0x52a6('0x1c')&&typeof _0x1f3598[_0x52a6('0x1d')]==='undefined';var _0x2fa970=_0x511780[_0x52a6('0x1e')];var _0x1571cc=_0x83e1d9?0x0:_0x1f3598[_0x52a6('0x1f')];var _0x59e87e=_0x83e1d9?_0x511780['count']:_0x1f3598[_0x52a6('0x1f')]+_0x1f3598[_0x52a6('0x1d')];var _0xd5fa5;if(_0x59e87e>=_0x2fa970){_0x59e87e=_0x2fa970;_0xd5fa5=0xc8;}else{_0xd5fa5=0xce;}_0x53a692['status'](_0xd5fa5);return _0x53a692[_0x52a6('0x20')](_0x52a6('0x21'),_0x1571cc+'-'+_0x59e87e+'/'+_0x2fa970)[_0x52a6('0x22')](_0x511780);}return null;};}function patchUpdates(_0x39d99c){return function(_0x13d036){try{jsonpatch['apply'](_0x13d036,_0x39d99c,!![]);}catch(_0x150b62){return BPromise[_0x52a6('0x23')](_0x150b62);}return _0x13d036[_0x52a6('0x24')]();};}function saveUpdates(_0x451379,_0xb900d8){return function(_0x173fd7){if(_0x173fd7){return _0x173fd7[_0x52a6('0x25')](_0x451379)[_0x52a6('0x26')](function(_0x45ca89){return _0x45ca89;});}return null;};}function removeEntity(_0x1455a4,_0x10a682){return function(_0x5e3417){if(_0x5e3417){return _0x5e3417[_0x52a6('0x27')]()['then'](function(){_0x1455a4['status'](0xcc)[_0x52a6('0x1b')]();});}};}function handleEntityNotFound(_0x5ddb87,_0x326163){return function(_0x3641d1){if(!_0x3641d1){_0x5ddb87['sendStatus'](0x194);}return _0x3641d1;};}function handleError(_0x294260,_0x5eefd6){_0x5eefd6=_0x5eefd6||0x1f4;return function(_0x2ac390){logger['error'](_0x2ac390[_0x52a6('0x28')]);if(_0x2ac390[_0x52a6('0x29')]){delete _0x2ac390['name'];}_0x294260[_0x52a6('0x1a')](_0x5eefd6)[_0x52a6('0x2a')](_0x2ac390);};}exports[_0x52a6('0x2b')]=function(_0xbd1287,_0x533dbf){var _0x56817a={},_0x66b260={},_0x4394d2={'count':0x0,'rows':[]};var _0x307506=_['map'](db['ZendeskConfiguration'][_0x52a6('0x2c')],function(_0x30704d){return{'name':_0x30704d[_0x52a6('0x2d')],'type':_0x30704d[_0x52a6('0x2e')][_0x52a6('0x2f')]};});_0x66b260[_0x52a6('0x30')]=_[_0x52a6('0x31')](_0x307506,_0x52a6('0x29'));_0x66b260[_0x52a6('0x32')]=_['keys'](_0xbd1287[_0x52a6('0x32')]);_0x66b260[_0x52a6('0x33')]=_[_0x52a6('0x34')](_0x66b260[_0x52a6('0x30')],_0x66b260['query']);_0x56817a[_0x52a6('0x35')]=_[_0x52a6('0x34')](_0x66b260[_0x52a6('0x30')],qs['fields'](_0xbd1287[_0x52a6('0x32')][_0x52a6('0x36')]));_0x56817a[_0x52a6('0x35')]=_0x56817a['attributes'][_0x52a6('0x37')]?_0x56817a[_0x52a6('0x35')]:_0x66b260[_0x52a6('0x30')];if(!_0xbd1287[_0x52a6('0x32')][_0x52a6('0x38')]('nolimit')){_0x56817a['limit']=qs[_0x52a6('0x1d')](_0xbd1287[_0x52a6('0x32')]['limit']);_0x56817a[_0x52a6('0x1f')]=qs[_0x52a6('0x1f')](_0xbd1287[_0x52a6('0x32')][_0x52a6('0x1f')]);}_0x56817a[_0x52a6('0x39')]=qs[_0x52a6('0x3a')](_0xbd1287[_0x52a6('0x32')][_0x52a6('0x3a')]);_0x56817a[_0x52a6('0x3b')]=qs[_0x52a6('0x33')](_['pick'](_0xbd1287['query'],_0x66b260['filters']),_0x307506);if(_0xbd1287[_0x52a6('0x32')][_0x52a6('0x3c')]){_0x56817a[_0x52a6('0x3b')]=_[_0x52a6('0x3d')](_0x56817a[_0x52a6('0x3b')],{'$or':_[_0x52a6('0x31')](_0x307506,function(_0x2cddad){if(_0x2cddad[_0x52a6('0x2e')]!=='VIRTUAL'){var _0x1e0ce7={};_0x1e0ce7[_0x2cddad[_0x52a6('0x29')]]={'$like':'%'+_0xbd1287[_0x52a6('0x32')]['filter']+'%'};return _0x1e0ce7;}})});}_0x56817a=_[_0x52a6('0x3d')]({},_0x56817a,_0xbd1287[_0x52a6('0x3e')]);var _0x11c871={'where':_0x56817a[_0x52a6('0x3b')]};return db[_0x52a6('0x3f')]['count'](_0x11c871)[_0x52a6('0x26')](function(_0x286740){_0x4394d2[_0x52a6('0x1e')]=_0x286740;if(_0xbd1287[_0x52a6('0x32')]['includeAll']){_0x56817a[_0x52a6('0x40')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x52a6('0x41')](_0x56817a);})['then'](function(_0x1f32cd){_0x4394d2['rows']=_0x1f32cd;return _0x4394d2;})['then'](respondWithFilteredResult(_0x533dbf,_0x56817a))['catch'](handleError(_0x533dbf,null));};exports[_0x52a6('0x42')]=function(_0x5724b1,_0x43a55e){var _0x3283c7={'raw':![],'where':{'id':_0x5724b1['params']['id']}},_0x3fe671={};_0x3fe671[_0x52a6('0x30')]=_['keys'](db[_0x52a6('0x3f')][_0x52a6('0x2c')]);_0x3fe671[_0x52a6('0x32')]=_[_0x52a6('0x43')](_0x5724b1[_0x52a6('0x32')]);_0x3fe671['filters']=_['intersection'](_0x3fe671[_0x52a6('0x30')],_0x3fe671[_0x52a6('0x32')]);_0x3283c7[_0x52a6('0x35')]=_[_0x52a6('0x34')](_0x3fe671[_0x52a6('0x30')],qs[_0x52a6('0x36')](_0x5724b1[_0x52a6('0x32')][_0x52a6('0x36')]));_0x3283c7[_0x52a6('0x35')]=_0x3283c7[_0x52a6('0x35')][_0x52a6('0x37')]?_0x3283c7[_0x52a6('0x35')]:_0x3fe671[_0x52a6('0x30')];if(_0x5724b1[_0x52a6('0x32')]['includeAll']){_0x3283c7[_0x52a6('0x40')]=[{'all':!![]}];}_0x3283c7=_['merge']({},_0x3283c7,_0x5724b1['options']);return db['ZendeskConfiguration'][_0x52a6('0x44')](_0x3283c7)[_0x52a6('0x26')](handleEntityNotFound(_0x43a55e,null))[_0x52a6('0x26')](respondWithResult(_0x43a55e,null))[_0x52a6('0x45')](handleError(_0x43a55e,null));};exports[_0x52a6('0x46')]=function(_0x5b75fa,_0x2e0242){return db[_0x52a6('0x3f')][_0x52a6('0x46')](_0x5b75fa['body'],{})[_0x52a6('0x26')](respondWithResult(_0x2e0242,0xc9))['catch'](handleError(_0x2e0242,null));};exports['update']=function(_0xded90,_0x45303e){if(_0xded90['body']['id']){delete _0xded90['body']['id'];}return db[_0x52a6('0x3f')][_0x52a6('0x44')]({'where':{'id':_0xded90[_0x52a6('0x47')]['id']}})[_0x52a6('0x26')](handleEntityNotFound(_0x45303e,null))[_0x52a6('0x26')](saveUpdates(_0xded90[_0x52a6('0x48')],null))[_0x52a6('0x26')](respondWithResult(_0x45303e,null))[_0x52a6('0x45')](handleError(_0x45303e,null));};exports[_0x52a6('0x27')]=function(_0x502424,_0x15d3b0){return db[_0x52a6('0x3f')]['find']({'where':{'id':_0x502424[_0x52a6('0x47')]['id']}})[_0x52a6('0x26')](handleEntityNotFound(_0x15d3b0,null))[_0x52a6('0x26')](removeEntity(_0x15d3b0,null))[_0x52a6('0x45')](handleError(_0x15d3b0,null));};exports[_0x52a6('0x49')]=function(_0x365840,_0x4e7f04,_0x503fac){var _0x5376a5={};var _0x50094d={};var _0x4d0c0c;var _0x40fc75;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x365840['params']['id']}})['then'](handleEntityNotFound(_0x4e7f04,null))[_0x52a6('0x26')](function(_0xf2054){if(_0xf2054){_0x4d0c0c=_0xf2054;_0x50094d[_0x52a6('0x30')]=_[_0x52a6('0x43')](db['ZendeskField'][_0x52a6('0x2c')]);_0x50094d['query']=_[_0x52a6('0x43')](_0x365840['query']);_0x50094d[_0x52a6('0x33')]=_[_0x52a6('0x34')](_0x50094d[_0x52a6('0x30')],_0x50094d[_0x52a6('0x32')]);_0x5376a5['attributes']=_[_0x52a6('0x34')](_0x50094d[_0x52a6('0x30')],qs['fields'](_0x365840['query'][_0x52a6('0x36')]));_0x5376a5[_0x52a6('0x35')]=_0x5376a5[_0x52a6('0x35')]['length']?_0x5376a5[_0x52a6('0x35')]:_0x50094d[_0x52a6('0x30')];_0x5376a5[_0x52a6('0x39')]=qs[_0x52a6('0x3a')](_0x365840[_0x52a6('0x32')][_0x52a6('0x3a')]);_0x5376a5[_0x52a6('0x3b')]=qs[_0x52a6('0x33')](_[_0x52a6('0x4a')](_0x365840[_0x52a6('0x32')],_0x50094d[_0x52a6('0x33')]));if(_0x365840[_0x52a6('0x32')][_0x52a6('0x3c')]){_0x5376a5[_0x52a6('0x3b')]=_[_0x52a6('0x3d')](_0x5376a5[_0x52a6('0x3b')],{'$or':_[_0x52a6('0x31')](_0x5376a5['attributes'],function(_0xd21c4c){var _0x514f7c={};_0x514f7c[_0xd21c4c]={'$like':'%'+_0x365840['query'][_0x52a6('0x3c')]+'%'};return _0x514f7c;})});}_0x5376a5=_['merge']({},_0x5376a5,_0x365840[_0x52a6('0x3e')]);return _0x4d0c0c[_0x52a6('0x49')](_0x5376a5);}})[_0x52a6('0x26')](function(_0x3de130){if(_0x3de130){_0x40fc75=_0x3de130[_0x52a6('0x37')];if(!_0x365840[_0x52a6('0x32')]['hasOwnProperty'](_0x52a6('0x4b'))){_0x5376a5[_0x52a6('0x1d')]=qs[_0x52a6('0x1d')](_0x365840[_0x52a6('0x32')][_0x52a6('0x1d')]);_0x5376a5[_0x52a6('0x1f')]=qs['offset'](_0x365840[_0x52a6('0x32')][_0x52a6('0x1f')]);}return _0x4d0c0c['getFields'](_0x5376a5);}})['then'](function(_0x5424ba){if(_0x5424ba){return _0x5424ba?{'count':_0x40fc75,'rows':_0x5424ba}:null;}})[_0x52a6('0x26')](respondWithResult(_0x4e7f04,null))[_0x52a6('0x45')](handleError(_0x4e7f04,null));};exports['getSubjects']=function(_0x1b2751,_0x36f494,_0x10199b){var _0x2aa48e={};var _0x4ccbde={};var _0x594074;var _0x395cc9;return db['ZendeskConfiguration'][_0x52a6('0x4c')]({'where':{'id':_0x1b2751[_0x52a6('0x47')]['id']}})['then'](handleEntityNotFound(_0x36f494,null))[_0x52a6('0x26')](function(_0x38b137){if(_0x38b137){_0x594074=_0x38b137;_0x4ccbde[_0x52a6('0x30')]=_[_0x52a6('0x43')](db['ZendeskField'][_0x52a6('0x2c')]);_0x4ccbde['query']=_[_0x52a6('0x43')](_0x1b2751[_0x52a6('0x32')]);_0x4ccbde[_0x52a6('0x33')]=_['intersection'](_0x4ccbde[_0x52a6('0x30')],_0x4ccbde[_0x52a6('0x32')]);_0x2aa48e[_0x52a6('0x35')]=_[_0x52a6('0x34')](_0x4ccbde[_0x52a6('0x30')],qs[_0x52a6('0x36')](_0x1b2751[_0x52a6('0x32')]['fields']));_0x2aa48e[_0x52a6('0x35')]=_0x2aa48e[_0x52a6('0x35')][_0x52a6('0x37')]?_0x2aa48e['attributes']:_0x4ccbde[_0x52a6('0x30')];_0x2aa48e[_0x52a6('0x39')]=qs[_0x52a6('0x3a')](_0x1b2751[_0x52a6('0x32')]['sort']);_0x2aa48e[_0x52a6('0x3b')]=qs[_0x52a6('0x33')](_[_0x52a6('0x4a')](_0x1b2751[_0x52a6('0x32')],_0x4ccbde['filters']));if(_0x1b2751[_0x52a6('0x32')][_0x52a6('0x3c')]){_0x2aa48e[_0x52a6('0x3b')]=_[_0x52a6('0x3d')](_0x2aa48e[_0x52a6('0x3b')],{'$or':_[_0x52a6('0x31')](_0x2aa48e[_0x52a6('0x35')],function(_0x1cc7c2){var _0x4bf036={};_0x4bf036[_0x1cc7c2]={'$like':'%'+_0x1b2751[_0x52a6('0x32')][_0x52a6('0x3c')]+'%'};return _0x4bf036;})});}_0x2aa48e=_['merge']({},_0x2aa48e,_0x1b2751[_0x52a6('0x3e')]);return _0x594074[_0x52a6('0x4d')](_0x2aa48e);}})[_0x52a6('0x26')](function(_0x4dfaff){if(_0x4dfaff){_0x395cc9=_0x4dfaff[_0x52a6('0x37')];if(!_0x1b2751[_0x52a6('0x32')]['hasOwnProperty'](_0x52a6('0x4b'))){_0x2aa48e[_0x52a6('0x1d')]=qs[_0x52a6('0x1d')](_0x1b2751[_0x52a6('0x32')][_0x52a6('0x1d')]);_0x2aa48e[_0x52a6('0x1f')]=qs['offset'](_0x1b2751[_0x52a6('0x32')][_0x52a6('0x1f')]);}return _0x594074['getSubjects'](_0x2aa48e);}})[_0x52a6('0x26')](function(_0x4e9bf1){if(_0x4e9bf1){return _0x4e9bf1?{'count':_0x395cc9,'rows':_0x4e9bf1}:null;}})[_0x52a6('0x26')](respondWithResult(_0x36f494,null))['catch'](handleError(_0x36f494,null));};exports[_0x52a6('0x4e')]=function(_0x3837d0,_0x1f9368,_0x2d2691){var _0x5f1af1={};var _0x209bd8={};var _0x2a3354;var _0xf44d14;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3837d0[_0x52a6('0x47')]['id']}})[_0x52a6('0x26')](handleEntityNotFound(_0x1f9368,null))['then'](function(_0x52d87b){if(_0x52d87b){_0x2a3354=_0x52d87b;_0x209bd8['model']=_[_0x52a6('0x43')](db['ZendeskField'][_0x52a6('0x2c')]);_0x209bd8[_0x52a6('0x32')]=_[_0x52a6('0x43')](_0x3837d0[_0x52a6('0x32')]);_0x209bd8['filters']=_['intersection'](_0x209bd8[_0x52a6('0x30')],_0x209bd8[_0x52a6('0x32')]);_0x5f1af1['attributes']=_['intersection'](_0x209bd8['model'],qs[_0x52a6('0x36')](_0x3837d0[_0x52a6('0x32')]['fields']));_0x5f1af1[_0x52a6('0x35')]=_0x5f1af1[_0x52a6('0x35')]['length']?_0x5f1af1[_0x52a6('0x35')]:_0x209bd8['model'];_0x5f1af1['order']=qs[_0x52a6('0x3a')](_0x3837d0[_0x52a6('0x32')]['sort']);_0x5f1af1['where']=qs[_0x52a6('0x33')](_[_0x52a6('0x4a')](_0x3837d0[_0x52a6('0x32')],_0x209bd8[_0x52a6('0x33')]));if(_0x3837d0[_0x52a6('0x32')][_0x52a6('0x3c')]){_0x5f1af1[_0x52a6('0x3b')]=_[_0x52a6('0x3d')](_0x5f1af1[_0x52a6('0x3b')],{'$or':_['map'](_0x5f1af1[_0x52a6('0x35')],function(_0x4100a6){var _0x59e652={};_0x59e652[_0x4100a6]={'$like':'%'+_0x3837d0[_0x52a6('0x32')][_0x52a6('0x3c')]+'%'};return _0x59e652;})});}_0x5f1af1=_[_0x52a6('0x3d')]({},_0x5f1af1,_0x3837d0[_0x52a6('0x3e')]);return _0x2a3354[_0x52a6('0x4e')](_0x5f1af1);}})[_0x52a6('0x26')](function(_0x428cee){if(_0x428cee){_0xf44d14=_0x428cee[_0x52a6('0x37')];if(!_0x3837d0[_0x52a6('0x32')][_0x52a6('0x38')](_0x52a6('0x4b'))){_0x5f1af1[_0x52a6('0x1d')]=qs[_0x52a6('0x1d')](_0x3837d0[_0x52a6('0x32')]['limit']);_0x5f1af1[_0x52a6('0x1f')]=qs[_0x52a6('0x1f')](_0x3837d0['query']['offset']);}return _0x2a3354[_0x52a6('0x4e')](_0x5f1af1);}})[_0x52a6('0x26')](function(_0x42a1a6){if(_0x42a1a6){return _0x42a1a6?{'count':_0xf44d14,'rows':_0x42a1a6}:null;}})[_0x52a6('0x26')](respondWithResult(_0x1f9368,null))[_0x52a6('0x45')](handleError(_0x1f9368,null));};exports[_0x52a6('0x4f')]=function(_0x213090,_0x4860d4,_0x1ddda8){var _0x5390f0={};var _0x524220={};var _0x4e2828;var _0x207c13;return db[_0x52a6('0x3f')][_0x52a6('0x4c')]({'where':{'id':_0x213090[_0x52a6('0x47')]['id']}})[_0x52a6('0x26')](handleEntityNotFound(_0x4860d4,null))[_0x52a6('0x26')](function(_0x5d40f2){if(_0x5d40f2){_0x4e2828=_0x5d40f2;_0x524220[_0x52a6('0x30')]=_[_0x52a6('0x43')](db[_0x52a6('0x50')][_0x52a6('0x2c')]);_0x524220[_0x52a6('0x32')]=_[_0x52a6('0x43')](_0x213090[_0x52a6('0x32')]);_0x524220[_0x52a6('0x33')]=_['intersection'](_0x524220[_0x52a6('0x30')],_0x524220[_0x52a6('0x32')]);_0x5390f0['attributes']=_[_0x52a6('0x34')](_0x524220[_0x52a6('0x30')],qs[_0x52a6('0x36')](_0x213090[_0x52a6('0x32')][_0x52a6('0x36')]));_0x5390f0[_0x52a6('0x35')]=_0x5390f0['attributes'][_0x52a6('0x37')]?_0x5390f0[_0x52a6('0x35')]:_0x524220['model'];_0x5390f0['order']=qs[_0x52a6('0x3a')](_0x213090[_0x52a6('0x32')]['sort']);_0x5390f0[_0x52a6('0x3b')]=qs[_0x52a6('0x33')](_[_0x52a6('0x4a')](_0x213090['query'],_0x524220[_0x52a6('0x33')]));if(_0x213090['query'][_0x52a6('0x3c')]){_0x5390f0['where']=_[_0x52a6('0x3d')](_0x5390f0['where'],{'$or':_[_0x52a6('0x31')](_0x5390f0['attributes'],function(_0x468a36){var _0x58fb78={};_0x58fb78[_0x468a36]={'$like':'%'+_0x213090[_0x52a6('0x32')][_0x52a6('0x3c')]+'%'};return _0x58fb78;})});}_0x5390f0=_[_0x52a6('0x3d')]({},_0x5390f0,_0x213090[_0x52a6('0x3e')]);return _0x4e2828['getTags'](_0x5390f0);}})[_0x52a6('0x26')](function(_0x2aa20a){if(_0x2aa20a){_0x207c13=_0x2aa20a[_0x52a6('0x37')];if(!_0x213090[_0x52a6('0x32')][_0x52a6('0x38')](_0x52a6('0x4b'))){_0x5390f0[_0x52a6('0x1d')]=qs[_0x52a6('0x1d')](_0x213090[_0x52a6('0x32')][_0x52a6('0x1d')]);_0x5390f0[_0x52a6('0x1f')]=qs[_0x52a6('0x1f')](_0x213090[_0x52a6('0x32')][_0x52a6('0x1f')]);}return _0x4e2828[_0x52a6('0x4f')](_0x5390f0);}})[_0x52a6('0x26')](function(_0x1a91a7){if(_0x1a91a7){return _0x1a91a7?{'count':_0x207c13,'rows':_0x1a91a7}:null;}})[_0x52a6('0x26')](respondWithResult(_0x4860d4,null))[_0x52a6('0x45')](handleError(_0x4860d4,null));};exports[_0x52a6('0x51')]=function(_0x3ebfed,_0x85c95b,_0x377dbf){if(_0x3ebfed[_0x52a6('0x48')]['id']){delete _0x3ebfed[_0x52a6('0x48')]['id'];}return db[_0x52a6('0x3f')][_0x52a6('0x4c')]({'where':{'id':_0x3ebfed['params']['id']}})['then'](handleEntityNotFound(_0x85c95b,null))[_0x52a6('0x26')](function(_0x200d82){if(_0x200d82){return _0x200d82[_0x52a6('0x51')](_0x3ebfed[_0x52a6('0x48')][_0x52a6('0x52')]||[]);}return null;})[_0x52a6('0x26')](respondWithResult(_0x85c95b,null))[_0x52a6('0x45')](handleError(_0x85c95b,null));}; \ No newline at end of file +var _0xf335=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','ZendeskConfiguration','fieldName','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getFields','findOne','ZendeskField','length','nolimit','rawAttributes','getSubjects','getDescriptions','Tag','getTags','setTags','ids','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv'];(function(_0x315002,_0x4ee032){var _0x54e480=function(_0x4683bc){while(--_0x4683bc){_0x315002['push'](_0x315002['shift']());}};_0x54e480(++_0x4ee032);}(_0xf335,0xf7));var _0x5f33=function(_0x12b56c,_0x4d8f7a){_0x12b56c=_0x12b56c-0x0;var _0x40966b=_0xf335[_0x12b56c];return _0x40966b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5f33('0x0'));var jsonpatch=require(_0x5f33('0x1'));var rp=require(_0x5f33('0x2'));var moment=require(_0x5f33('0x3'));var BPromise=require(_0x5f33('0x4'));var Mustache=require(_0x5f33('0x5'));var util=require(_0x5f33('0x6'));var path=require(_0x5f33('0x7'));var sox=require(_0x5f33('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f33('0x9'));var squel=require(_0x5f33('0xa'));var crypto=require(_0x5f33('0xb'));var jsforce=require(_0x5f33('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5f33('0xd'));var querystring=require('querystring');var Papa=require(_0x5f33('0xe'));var Redis=require(_0x5f33('0xf'));var authService=require(_0x5f33('0x10'));var qs=require(_0x5f33('0x11'));var as=require(_0x5f33('0x12'));var hardwareService=require(_0x5f33('0x13'));var logger=require('../../config/logger')(_0x5f33('0x14'));var utils=require(_0x5f33('0x15'));var config=require(_0x5f33('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f33('0x17'))['db'];function respondWithStatusCode(_0x9f4f6a,_0x4f2f3a){_0x4f2f3a=_0x4f2f3a||0xcc;return function(_0x5e6233){if(_0x5e6233){return _0x9f4f6a[_0x5f33('0x18')](_0x4f2f3a);}return _0x9f4f6a[_0x5f33('0x19')](_0x4f2f3a)['end']();};}function respondWithResult(_0x143995,_0x4b177c){_0x4b177c=_0x4b177c||0xc8;return function(_0x342780){if(_0x342780){return _0x143995[_0x5f33('0x19')](_0x4b177c)[_0x5f33('0x1a')](_0x342780);}};}function respondWithFilteredResult(_0x47d26a,_0x36fa67){return function(_0x4cada6){if(_0x4cada6){var _0x44d498=typeof _0x36fa67[_0x5f33('0x1b')]===_0x5f33('0x1c')&&typeof _0x36fa67[_0x5f33('0x1d')]===_0x5f33('0x1c');var _0x134748=_0x4cada6['count'];var _0x3c0836=_0x44d498?0x0:_0x36fa67[_0x5f33('0x1b')];var _0x3deb7c=_0x44d498?_0x4cada6[_0x5f33('0x1e')]:_0x36fa67['offset']+_0x36fa67['limit'];var _0x1f1092;if(_0x3deb7c>=_0x134748){_0x3deb7c=_0x134748;_0x1f1092=0xc8;}else{_0x1f1092=0xce;}_0x47d26a['status'](_0x1f1092);return _0x47d26a[_0x5f33('0x1f')](_0x5f33('0x20'),_0x3c0836+'-'+_0x3deb7c+'/'+_0x134748)[_0x5f33('0x1a')](_0x4cada6);}return null;};}function patchUpdates(_0xf162a2){return function(_0x2b7663){try{jsonpatch[_0x5f33('0x21')](_0x2b7663,_0xf162a2,!![]);}catch(_0x51a215){return BPromise[_0x5f33('0x22')](_0x51a215);}return _0x2b7663[_0x5f33('0x23')]();};}function saveUpdates(_0x2ee521,_0x374097){return function(_0x33abf9){if(_0x33abf9){return _0x33abf9[_0x5f33('0x24')](_0x2ee521)[_0x5f33('0x25')](function(_0x46178c){return _0x46178c;});}return null;};}function removeEntity(_0x4ef08a,_0x381f9f){return function(_0x1cee88){if(_0x1cee88){return _0x1cee88['destroy']()[_0x5f33('0x25')](function(){_0x4ef08a['status'](0xcc)[_0x5f33('0x26')]();});}};}function handleEntityNotFound(_0x5d82cc,_0x3289be){return function(_0x565bfa){if(!_0x565bfa){_0x5d82cc[_0x5f33('0x18')](0x194);}return _0x565bfa;};}function handleError(_0x9e3d31,_0xf97cec){_0xf97cec=_0xf97cec||0x1f4;return function(_0xebae7){logger['error'](_0xebae7[_0x5f33('0x27')]);if(_0xebae7['name']){delete _0xebae7[_0x5f33('0x28')];}_0x9e3d31[_0x5f33('0x19')](_0xf97cec)[_0x5f33('0x29')](_0xebae7);};}exports[_0x5f33('0x2a')]=function(_0x3e6ccf,_0x2cddf1){var _0x11fb8c={},_0x48124a={},_0x5a8511={'count':0x0,'rows':[]};var _0x467139=_['map'](db[_0x5f33('0x2b')]['rawAttributes'],function(_0x5758d7){return{'name':_0x5758d7[_0x5f33('0x2c')],'type':_0x5758d7['type'][_0x5f33('0x2d')]};});_0x48124a['model']=_[_0x5f33('0x2e')](_0x467139,_0x5f33('0x28'));_0x48124a[_0x5f33('0x2f')]=_[_0x5f33('0x30')](_0x3e6ccf[_0x5f33('0x2f')]);_0x48124a['filters']=_[_0x5f33('0x31')](_0x48124a[_0x5f33('0x32')],_0x48124a[_0x5f33('0x2f')]);_0x11fb8c[_0x5f33('0x33')]=_[_0x5f33('0x31')](_0x48124a['model'],qs[_0x5f33('0x34')](_0x3e6ccf['query'][_0x5f33('0x34')]));_0x11fb8c[_0x5f33('0x33')]=_0x11fb8c[_0x5f33('0x33')]['length']?_0x11fb8c['attributes']:_0x48124a[_0x5f33('0x32')];if(!_0x3e6ccf['query'][_0x5f33('0x35')]('nolimit')){_0x11fb8c[_0x5f33('0x1d')]=qs['limit'](_0x3e6ccf[_0x5f33('0x2f')][_0x5f33('0x1d')]);_0x11fb8c[_0x5f33('0x1b')]=qs['offset'](_0x3e6ccf['query'][_0x5f33('0x1b')]);}_0x11fb8c[_0x5f33('0x36')]=qs['sort'](_0x3e6ccf['query'][_0x5f33('0x37')]);_0x11fb8c[_0x5f33('0x38')]=qs[_0x5f33('0x39')](_[_0x5f33('0x3a')](_0x3e6ccf['query'],_0x48124a[_0x5f33('0x39')]),_0x467139);if(_0x3e6ccf[_0x5f33('0x2f')][_0x5f33('0x3b')]){_0x11fb8c[_0x5f33('0x38')]=_[_0x5f33('0x3c')](_0x11fb8c[_0x5f33('0x38')],{'$or':_[_0x5f33('0x2e')](_0x467139,function(_0x86ff7){if(_0x86ff7[_0x5f33('0x3d')]!==_0x5f33('0x3e')){var _0x35cf90={};_0x35cf90[_0x86ff7['name']]={'$like':'%'+_0x3e6ccf['query'][_0x5f33('0x3b')]+'%'};return _0x35cf90;}})});}_0x11fb8c=_[_0x5f33('0x3c')]({},_0x11fb8c,_0x3e6ccf[_0x5f33('0x3f')]);var _0x6058e={'where':_0x11fb8c[_0x5f33('0x38')]};return db[_0x5f33('0x2b')]['count'](_0x6058e)[_0x5f33('0x25')](function(_0x24f864){_0x5a8511[_0x5f33('0x1e')]=_0x24f864;if(_0x3e6ccf['query'][_0x5f33('0x40')]){_0x11fb8c[_0x5f33('0x41')]=[{'all':!![]}];}return db[_0x5f33('0x2b')][_0x5f33('0x42')](_0x11fb8c);})['then'](function(_0x2587ae){_0x5a8511[_0x5f33('0x43')]=_0x2587ae;return _0x5a8511;})['then'](respondWithFilteredResult(_0x2cddf1,_0x11fb8c))[_0x5f33('0x44')](handleError(_0x2cddf1,null));};exports[_0x5f33('0x45')]=function(_0x1199ae,_0x30da55){var _0x2643d9={'raw':![],'where':{'id':_0x1199ae[_0x5f33('0x46')]['id']}},_0x1d5e3d={};_0x1d5e3d[_0x5f33('0x32')]=_[_0x5f33('0x30')](db[_0x5f33('0x2b')]['rawAttributes']);_0x1d5e3d[_0x5f33('0x2f')]=_[_0x5f33('0x30')](_0x1199ae[_0x5f33('0x2f')]);_0x1d5e3d[_0x5f33('0x39')]=_[_0x5f33('0x31')](_0x1d5e3d['model'],_0x1d5e3d[_0x5f33('0x2f')]);_0x2643d9[_0x5f33('0x33')]=_[_0x5f33('0x31')](_0x1d5e3d['model'],qs[_0x5f33('0x34')](_0x1199ae['query'][_0x5f33('0x34')]));_0x2643d9['attributes']=_0x2643d9[_0x5f33('0x33')]['length']?_0x2643d9[_0x5f33('0x33')]:_0x1d5e3d[_0x5f33('0x32')];if(_0x1199ae[_0x5f33('0x2f')][_0x5f33('0x40')]){_0x2643d9[_0x5f33('0x41')]=[{'all':!![]}];}_0x2643d9=_[_0x5f33('0x3c')]({},_0x2643d9,_0x1199ae['options']);return db[_0x5f33('0x2b')][_0x5f33('0x47')](_0x2643d9)['then'](handleEntityNotFound(_0x30da55,null))[_0x5f33('0x25')](respondWithResult(_0x30da55,null))['catch'](handleError(_0x30da55,null));};exports['create']=function(_0x1610c6,_0x4a4d72){return db['ZendeskConfiguration'][_0x5f33('0x48')](_0x1610c6[_0x5f33('0x49')],{})[_0x5f33('0x25')](respondWithResult(_0x4a4d72,0xc9))[_0x5f33('0x44')](handleError(_0x4a4d72,null));};exports[_0x5f33('0x24')]=function(_0x1c8094,_0x289d21){if(_0x1c8094[_0x5f33('0x49')]['id']){delete _0x1c8094[_0x5f33('0x49')]['id'];}return db[_0x5f33('0x2b')]['find']({'where':{'id':_0x1c8094['params']['id']}})[_0x5f33('0x25')](handleEntityNotFound(_0x289d21,null))[_0x5f33('0x25')](saveUpdates(_0x1c8094[_0x5f33('0x49')],null))[_0x5f33('0x25')](respondWithResult(_0x289d21,null))[_0x5f33('0x44')](handleError(_0x289d21,null));};exports[_0x5f33('0x4a')]=function(_0x33641d,_0x5ae36e){return db['ZendeskConfiguration']['find']({'where':{'id':_0x33641d['params']['id']}})[_0x5f33('0x25')](handleEntityNotFound(_0x5ae36e,null))['then'](removeEntity(_0x5ae36e,null))[_0x5f33('0x44')](handleError(_0x5ae36e,null));};exports[_0x5f33('0x4b')]=function(_0x1bf32,_0x8c719e,_0x5b087d){var _0x59b961={};var _0x4087fc={};var _0x2e8d02;var _0x11f14c;return db[_0x5f33('0x2b')][_0x5f33('0x4c')]({'where':{'id':_0x1bf32[_0x5f33('0x46')]['id']}})[_0x5f33('0x25')](handleEntityNotFound(_0x8c719e,null))['then'](function(_0x470261){if(_0x470261){_0x2e8d02=_0x470261;_0x4087fc[_0x5f33('0x32')]=_[_0x5f33('0x30')](db[_0x5f33('0x4d')]['rawAttributes']);_0x4087fc['query']=_[_0x5f33('0x30')](_0x1bf32[_0x5f33('0x2f')]);_0x4087fc[_0x5f33('0x39')]=_[_0x5f33('0x31')](_0x4087fc[_0x5f33('0x32')],_0x4087fc[_0x5f33('0x2f')]);_0x59b961[_0x5f33('0x33')]=_[_0x5f33('0x31')](_0x4087fc['model'],qs['fields'](_0x1bf32[_0x5f33('0x2f')][_0x5f33('0x34')]));_0x59b961[_0x5f33('0x33')]=_0x59b961[_0x5f33('0x33')][_0x5f33('0x4e')]?_0x59b961['attributes']:_0x4087fc[_0x5f33('0x32')];_0x59b961[_0x5f33('0x36')]=qs['sort'](_0x1bf32[_0x5f33('0x2f')]['sort']);_0x59b961['where']=qs[_0x5f33('0x39')](_['pick'](_0x1bf32[_0x5f33('0x2f')],_0x4087fc[_0x5f33('0x39')]));if(_0x1bf32[_0x5f33('0x2f')]['filter']){_0x59b961[_0x5f33('0x38')]=_[_0x5f33('0x3c')](_0x59b961[_0x5f33('0x38')],{'$or':_[_0x5f33('0x2e')](_0x59b961[_0x5f33('0x33')],function(_0x5b4db3){var _0x4fe3a3={};_0x4fe3a3[_0x5b4db3]={'$like':'%'+_0x1bf32[_0x5f33('0x2f')][_0x5f33('0x3b')]+'%'};return _0x4fe3a3;})});}_0x59b961=_['merge']({},_0x59b961,_0x1bf32[_0x5f33('0x3f')]);return _0x2e8d02['getFields'](_0x59b961);}})[_0x5f33('0x25')](function(_0x391ad2){if(_0x391ad2){_0x11f14c=_0x391ad2['length'];if(!_0x1bf32['query'][_0x5f33('0x35')](_0x5f33('0x4f'))){_0x59b961[_0x5f33('0x1d')]=qs[_0x5f33('0x1d')](_0x1bf32[_0x5f33('0x2f')]['limit']);_0x59b961[_0x5f33('0x1b')]=qs[_0x5f33('0x1b')](_0x1bf32[_0x5f33('0x2f')][_0x5f33('0x1b')]);}return _0x2e8d02['getFields'](_0x59b961);}})[_0x5f33('0x25')](function(_0x212ba6){if(_0x212ba6){return _0x212ba6?{'count':_0x11f14c,'rows':_0x212ba6}:null;}})[_0x5f33('0x25')](respondWithResult(_0x8c719e,null))['catch'](handleError(_0x8c719e,null));};exports['getSubjects']=function(_0x5c4c37,_0x1b1f44,_0x4d9ab0){var _0x50c54a={};var _0x3a7a81={};var _0x3507c1;var _0x565793;return db[_0x5f33('0x2b')][_0x5f33('0x4c')]({'where':{'id':_0x5c4c37['params']['id']}})[_0x5f33('0x25')](handleEntityNotFound(_0x1b1f44,null))[_0x5f33('0x25')](function(_0xc5c23){if(_0xc5c23){_0x3507c1=_0xc5c23;_0x3a7a81[_0x5f33('0x32')]=_['keys'](db[_0x5f33('0x4d')][_0x5f33('0x50')]);_0x3a7a81[_0x5f33('0x2f')]=_['keys'](_0x5c4c37[_0x5f33('0x2f')]);_0x3a7a81[_0x5f33('0x39')]=_[_0x5f33('0x31')](_0x3a7a81['model'],_0x3a7a81[_0x5f33('0x2f')]);_0x50c54a[_0x5f33('0x33')]=_['intersection'](_0x3a7a81[_0x5f33('0x32')],qs[_0x5f33('0x34')](_0x5c4c37[_0x5f33('0x2f')][_0x5f33('0x34')]));_0x50c54a[_0x5f33('0x33')]=_0x50c54a['attributes']['length']?_0x50c54a[_0x5f33('0x33')]:_0x3a7a81[_0x5f33('0x32')];_0x50c54a[_0x5f33('0x36')]=qs[_0x5f33('0x37')](_0x5c4c37[_0x5f33('0x2f')][_0x5f33('0x37')]);_0x50c54a[_0x5f33('0x38')]=qs['filters'](_[_0x5f33('0x3a')](_0x5c4c37[_0x5f33('0x2f')],_0x3a7a81[_0x5f33('0x39')]));if(_0x5c4c37[_0x5f33('0x2f')][_0x5f33('0x3b')]){_0x50c54a['where']=_[_0x5f33('0x3c')](_0x50c54a['where'],{'$or':_[_0x5f33('0x2e')](_0x50c54a[_0x5f33('0x33')],function(_0x1e68c0){var _0x1a23e6={};_0x1a23e6[_0x1e68c0]={'$like':'%'+_0x5c4c37[_0x5f33('0x2f')][_0x5f33('0x3b')]+'%'};return _0x1a23e6;})});}_0x50c54a=_[_0x5f33('0x3c')]({},_0x50c54a,_0x5c4c37[_0x5f33('0x3f')]);return _0x3507c1['getSubjects'](_0x50c54a);}})[_0x5f33('0x25')](function(_0x3bd9e6){if(_0x3bd9e6){_0x565793=_0x3bd9e6[_0x5f33('0x4e')];if(!_0x5c4c37['query']['hasOwnProperty'](_0x5f33('0x4f'))){_0x50c54a['limit']=qs[_0x5f33('0x1d')](_0x5c4c37[_0x5f33('0x2f')][_0x5f33('0x1d')]);_0x50c54a['offset']=qs[_0x5f33('0x1b')](_0x5c4c37['query'][_0x5f33('0x1b')]);}return _0x3507c1[_0x5f33('0x51')](_0x50c54a);}})[_0x5f33('0x25')](function(_0x98013f){if(_0x98013f){return _0x98013f?{'count':_0x565793,'rows':_0x98013f}:null;}})[_0x5f33('0x25')](respondWithResult(_0x1b1f44,null))[_0x5f33('0x44')](handleError(_0x1b1f44,null));};exports[_0x5f33('0x52')]=function(_0x426695,_0x1e84e8,_0xf7b6bb){var _0x30a057={};var _0x119fb5={};var _0x24159e;var _0x3819e4;return db[_0x5f33('0x2b')]['findOne']({'where':{'id':_0x426695[_0x5f33('0x46')]['id']}})['then'](handleEntityNotFound(_0x1e84e8,null))[_0x5f33('0x25')](function(_0x43c00a){if(_0x43c00a){_0x24159e=_0x43c00a;_0x119fb5['model']=_[_0x5f33('0x30')](db[_0x5f33('0x4d')]['rawAttributes']);_0x119fb5[_0x5f33('0x2f')]=_[_0x5f33('0x30')](_0x426695[_0x5f33('0x2f')]);_0x119fb5['filters']=_[_0x5f33('0x31')](_0x119fb5[_0x5f33('0x32')],_0x119fb5[_0x5f33('0x2f')]);_0x30a057['attributes']=_[_0x5f33('0x31')](_0x119fb5[_0x5f33('0x32')],qs[_0x5f33('0x34')](_0x426695[_0x5f33('0x2f')][_0x5f33('0x34')]));_0x30a057[_0x5f33('0x33')]=_0x30a057[_0x5f33('0x33')]['length']?_0x30a057['attributes']:_0x119fb5[_0x5f33('0x32')];_0x30a057['order']=qs[_0x5f33('0x37')](_0x426695[_0x5f33('0x2f')][_0x5f33('0x37')]);_0x30a057[_0x5f33('0x38')]=qs[_0x5f33('0x39')](_[_0x5f33('0x3a')](_0x426695[_0x5f33('0x2f')],_0x119fb5[_0x5f33('0x39')]));if(_0x426695[_0x5f33('0x2f')][_0x5f33('0x3b')]){_0x30a057['where']=_[_0x5f33('0x3c')](_0x30a057['where'],{'$or':_[_0x5f33('0x2e')](_0x30a057[_0x5f33('0x33')],function(_0x48e831){var _0x28b8ed={};_0x28b8ed[_0x48e831]={'$like':'%'+_0x426695[_0x5f33('0x2f')]['filter']+'%'};return _0x28b8ed;})});}_0x30a057=_[_0x5f33('0x3c')]({},_0x30a057,_0x426695[_0x5f33('0x3f')]);return _0x24159e[_0x5f33('0x52')](_0x30a057);}})[_0x5f33('0x25')](function(_0x4af005){if(_0x4af005){_0x3819e4=_0x4af005[_0x5f33('0x4e')];if(!_0x426695[_0x5f33('0x2f')]['hasOwnProperty']('nolimit')){_0x30a057[_0x5f33('0x1d')]=qs[_0x5f33('0x1d')](_0x426695[_0x5f33('0x2f')][_0x5f33('0x1d')]);_0x30a057[_0x5f33('0x1b')]=qs[_0x5f33('0x1b')](_0x426695[_0x5f33('0x2f')][_0x5f33('0x1b')]);}return _0x24159e[_0x5f33('0x52')](_0x30a057);}})['then'](function(_0x45c940){if(_0x45c940){return _0x45c940?{'count':_0x3819e4,'rows':_0x45c940}:null;}})[_0x5f33('0x25')](respondWithResult(_0x1e84e8,null))[_0x5f33('0x44')](handleError(_0x1e84e8,null));};exports['getTags']=function(_0x43e388,_0x31698a,_0x299f94){var _0x351385={};var _0xd449ef={};var _0x54d743;var _0x1db510;return db[_0x5f33('0x2b')]['findOne']({'where':{'id':_0x43e388[_0x5f33('0x46')]['id']}})[_0x5f33('0x25')](handleEntityNotFound(_0x31698a,null))[_0x5f33('0x25')](function(_0x5b57b1){if(_0x5b57b1){_0x54d743=_0x5b57b1;_0xd449ef[_0x5f33('0x32')]=_['keys'](db[_0x5f33('0x53')][_0x5f33('0x50')]);_0xd449ef[_0x5f33('0x2f')]=_[_0x5f33('0x30')](_0x43e388[_0x5f33('0x2f')]);_0xd449ef[_0x5f33('0x39')]=_[_0x5f33('0x31')](_0xd449ef[_0x5f33('0x32')],_0xd449ef[_0x5f33('0x2f')]);_0x351385[_0x5f33('0x33')]=_[_0x5f33('0x31')](_0xd449ef[_0x5f33('0x32')],qs[_0x5f33('0x34')](_0x43e388[_0x5f33('0x2f')][_0x5f33('0x34')]));_0x351385[_0x5f33('0x33')]=_0x351385[_0x5f33('0x33')][_0x5f33('0x4e')]?_0x351385['attributes']:_0xd449ef[_0x5f33('0x32')];_0x351385['order']=qs[_0x5f33('0x37')](_0x43e388['query']['sort']);_0x351385['where']=qs['filters'](_[_0x5f33('0x3a')](_0x43e388[_0x5f33('0x2f')],_0xd449ef['filters']));if(_0x43e388[_0x5f33('0x2f')]['filter']){_0x351385[_0x5f33('0x38')]=_[_0x5f33('0x3c')](_0x351385[_0x5f33('0x38')],{'$or':_[_0x5f33('0x2e')](_0x351385['attributes'],function(_0x401f7b){var _0x4d31ba={};_0x4d31ba[_0x401f7b]={'$like':'%'+_0x43e388[_0x5f33('0x2f')][_0x5f33('0x3b')]+'%'};return _0x4d31ba;})});}_0x351385=_[_0x5f33('0x3c')]({},_0x351385,_0x43e388[_0x5f33('0x3f')]);return _0x54d743[_0x5f33('0x54')](_0x351385);}})[_0x5f33('0x25')](function(_0x4ff1c6){if(_0x4ff1c6){_0x1db510=_0x4ff1c6[_0x5f33('0x4e')];if(!_0x43e388[_0x5f33('0x2f')][_0x5f33('0x35')](_0x5f33('0x4f'))){_0x351385[_0x5f33('0x1d')]=qs[_0x5f33('0x1d')](_0x43e388[_0x5f33('0x2f')][_0x5f33('0x1d')]);_0x351385[_0x5f33('0x1b')]=qs[_0x5f33('0x1b')](_0x43e388[_0x5f33('0x2f')][_0x5f33('0x1b')]);}return _0x54d743[_0x5f33('0x54')](_0x351385);}})[_0x5f33('0x25')](function(_0x1b24db){if(_0x1b24db){return _0x1b24db?{'count':_0x1db510,'rows':_0x1b24db}:null;}})[_0x5f33('0x25')](respondWithResult(_0x31698a,null))[_0x5f33('0x44')](handleError(_0x31698a,null));};exports[_0x5f33('0x55')]=function(_0x5f2641,_0x57d6fc,_0x56ff01){if(_0x5f2641[_0x5f33('0x49')]['id']){delete _0x5f2641[_0x5f33('0x49')]['id'];}return db['ZendeskConfiguration'][_0x5f33('0x4c')]({'where':{'id':_0x5f2641[_0x5f33('0x46')]['id']}})['then'](handleEntityNotFound(_0x57d6fc,null))[_0x5f33('0x25')](function(_0x5c4105){if(_0x5c4105){return _0x5c4105[_0x5f33('0x55')](_0x5f2641[_0x5f33('0x49')][_0x5f33('0x56')]||[]);}return null;})[_0x5f33('0x25')](respondWithResult(_0x57d6fc,null))['catch'](handleError(_0x57d6fc,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 549525f..ed86163 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x5c4bf7,_0x265f35){var _0x57b8c9=function(_0x5091d3){while(--_0x5091d3){_0x5c4bf7['push'](_0x5c4bf7['shift']());}};_0x57b8c9(++_0x265f35);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc900=['api','moment','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','../../config/logger'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0xc900,0xb3));var _0x0c90=function(_0x56df32,_0x30caa5){_0x56df32=_0x56df32-0x0;var _0x264828=_0xc900[_0x56df32];return _0x264828;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c90('0x0'))(_0x0c90('0x1'));var moment=require(_0x0c90('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c90('0x3'));var fs=require('fs');var path=require(_0x0c90('0x4'));var rimraf=require('rimraf');var config=require(_0x0c90('0x5'));var attributes=require(_0x0c90('0x6'));module[_0x0c90('0x7')]=function(_0x718a5c,_0x42f9a3){return _0x718a5c[_0x0c90('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x0c90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 07afa8c..97ea1a4 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 _0xb1ff=['info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x552204,_0x222864){var _0x24988d=function(_0x5d893b){while(--_0x5d893b){_0x552204['push'](_0x552204['shift']());}};_0x24988d(++_0x222864);}(_0xb1ff,0x96));var _0xfb1f=function(_0x2e65ee,_0x29dad9){_0x2e65ee=_0x2e65ee-0x0;var _0x4c712a=_0xb1ff[_0x2e65ee];return _0x4c712a;};'use strict';var _=require(_0xfb1f('0x0'));var util=require(_0xfb1f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb1f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb1f('0x3'));var logger=require(_0xfb1f('0x4'))(_0xfb1f('0x5'));var config=require(_0xfb1f('0x6'));var jayson=require(_0xfb1f('0x7'));var client=jayson['client'][_0xfb1f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5612cd,_0x483a49,_0x15c5fa){return new BPromise(function(_0x3ccb22,_0x3f6483){return client['request'](_0x5612cd,_0x15c5fa)[_0xfb1f('0x9')](function(_0x1f3e66){logger[_0xfb1f('0xa')](_0xfb1f('0xb'),_0x483a49,_0xfb1f('0xc'));logger[_0xfb1f('0xd')](_0xfb1f('0xe'),_0x483a49,_0xfb1f('0xc'),JSON[_0xfb1f('0xf')](_0x1f3e66));if(_0x1f3e66[_0xfb1f('0x10')]){if(_0x1f3e66[_0xfb1f('0x10')][_0xfb1f('0x11')]===0x1f4){logger[_0xfb1f('0x10')](_0xfb1f('0xb'),_0x483a49,_0x1f3e66[_0xfb1f('0x10')][_0xfb1f('0x12')]);return _0x3f6483(_0x1f3e66[_0xfb1f('0x10')][_0xfb1f('0x12')]);}logger[_0xfb1f('0x10')](_0xfb1f('0xb'),_0x483a49,_0x1f3e66[_0xfb1f('0x10')][_0xfb1f('0x12')]);return _0x3ccb22(_0x1f3e66[_0xfb1f('0x10')]['message']);}else{logger[_0xfb1f('0xa')](_0xfb1f('0xb'),_0x483a49,_0xfb1f('0xc'));_0x3ccb22(_0x1f3e66['result']['message']);}})[_0xfb1f('0x13')](function(_0x27ad0e){logger[_0xfb1f('0x10')](_0xfb1f('0xb'),_0x483a49,_0x27ad0e);_0x3f6483(_0x27ad0e);});});} \ No newline at end of file +var _0x40c2=['result','catch','util','moment','bluebird','randomstring','ioredis','../../config/environment','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x114b59,_0x41f449){var _0x47c573=function(_0x57a7aa){while(--_0x57a7aa){_0x114b59['push'](_0x114b59['shift']());}};_0x47c573(++_0x41f449);}(_0x40c2,0x192));var _0x240c=function(_0x37bee6,_0xa58df8){_0x37bee6=_0x37bee6-0x0;var _0x1bfcf9=_0x40c2[_0x37bee6];return _0x1bfcf9;};'use strict';var _=require('lodash');var util=require(_0x240c('0x0'));var moment=require(_0x240c('0x1'));var BPromise=require(_0x240c('0x2'));var rs=require(_0x240c('0x3'));var fs=require('fs');var Redis=require(_0x240c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x240c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x240c('0x6')][_0x240c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x424b7d,_0x3a25ac,_0x5bc93d){return new BPromise(function(_0x280bd9,_0x476938){return client[_0x240c('0x8')](_0x424b7d,_0x5bc93d)['then'](function(_0x2d1ca6){logger[_0x240c('0x9')](_0x240c('0xa'),_0x3a25ac,_0x240c('0xb'));logger[_0x240c('0xc')](_0x240c('0xd'),_0x3a25ac,_0x240c('0xb'),JSON[_0x240c('0xe')](_0x2d1ca6));if(_0x2d1ca6[_0x240c('0xf')]){if(_0x2d1ca6[_0x240c('0xf')][_0x240c('0x10')]===0x1f4){logger[_0x240c('0xf')](_0x240c('0xa'),_0x3a25ac,_0x2d1ca6[_0x240c('0xf')][_0x240c('0x11')]);return _0x476938(_0x2d1ca6[_0x240c('0xf')][_0x240c('0x11')]);}logger[_0x240c('0xf')](_0x240c('0xa'),_0x3a25ac,_0x2d1ca6[_0x240c('0xf')][_0x240c('0x11')]);return _0x280bd9(_0x2d1ca6[_0x240c('0xf')][_0x240c('0x11')]);}else{logger[_0x240c('0x9')](_0x240c('0xa'),_0x3a25ac,'request\x20sent');_0x280bd9(_0x2d1ca6[_0x240c('0x12')][_0x240c('0x11')]);}})[_0x240c('0x13')](function(_0x36a581){logger[_0x240c('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3a25ac,_0x36a581);_0x476938(_0x36a581);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index dc8d348..9bf8a4e 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 _0xdcd1=['multer','util','path','connect-timeout','Router','../../components/auth/service','./intZendeskField.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x54b468,_0x30d4bc){var _0x4d39d4=function(_0x519b8e){while(--_0x519b8e){_0x54b468['push'](_0x54b468['shift']());}};_0x4d39d4(++_0x30d4bc);}(_0xdcd1,0xc6));var _0x1dcd=function(_0x462854,_0xd16692){_0x462854=_0x462854-0x0;var _0x63c7c7=_0xdcd1[_0x462854];return _0x63c7c7;};'use strict';var multer=require(_0x1dcd('0x0'));var util=require(_0x1dcd('0x1'));var path=require(_0x1dcd('0x2'));var timeout=require(_0x1dcd('0x3'));var express=require('express');var router=express[_0x1dcd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1dcd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1dcd('0x6'));router['get']('/',auth[_0x1dcd('0x7')](),controller[_0x1dcd('0x8')]);router[_0x1dcd('0x9')](_0x1dcd('0xa'),auth[_0x1dcd('0x7')](),controller['show']);router[_0x1dcd('0xb')]('/',auth[_0x1dcd('0x7')](),controller[_0x1dcd('0xc')]);router[_0x1dcd('0xd')]('/:id',auth[_0x1dcd('0x7')](),controller[_0x1dcd('0xe')]);router[_0x1dcd('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x1dcd('0x10')]);module[_0x1dcd('0x11')]=router; \ No newline at end of file +var _0xa812=['update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0xd158dc,_0x128608){var _0x12d25f=function(_0x2e9d2b){while(--_0x2e9d2b){_0xd158dc['push'](_0xd158dc['shift']());}};_0x12d25f(++_0x128608);}(_0xa812,0x84));var _0x2a81=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xa812[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x2a81('0x0'));var util=require(_0x2a81('0x1'));var path=require(_0x2a81('0x2'));var timeout=require(_0x2a81('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2a81('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2a81('0x5'));var config=require('../../config/environment');var controller=require(_0x2a81('0x6'));router[_0x2a81('0x7')]('/',auth[_0x2a81('0x8')](),controller[_0x2a81('0x9')]);router[_0x2a81('0x7')](_0x2a81('0xa'),auth[_0x2a81('0x8')](),controller[_0x2a81('0xb')]);router['post']('/',auth[_0x2a81('0x8')](),controller['create']);router['put']('/:id',auth[_0x2a81('0x8')](),controller[_0x2a81('0xc')]);router[_0x2a81('0xd')](_0x2a81('0xa'),auth[_0x2a81('0x8')](),controller[_0x2a81('0xe')]);module[_0x2a81('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 3f52f15..e1131e9 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 _0x08b0=['keyValue','STRING','BOOLEAN','ENUM','string','variable','customVariable'];(function(_0x1587e0,_0x129936){var _0x3ff105=function(_0x14bc82){while(--_0x14bc82){_0x1587e0['push'](_0x1587e0['shift']());}};_0x3ff105(++_0x129936);}(_0x08b0,0xff));var _0x008b=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0x08b0[_0x3712e2];return _0x1faff4;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x008b('0x0')](_0x008b('0x1'),_0x008b('0x2'),_0x008b('0x3'),_0x008b('0x4'),'picklist'),'defaultValue':_0x008b('0x1')},'content':{'type':Sequelize[_0x008b('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x008b('0x0')](_0x008b('0x1'),_0x008b('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x008b('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x008b('0x5')]}}; \ No newline at end of file +var _0x66e8=['exports','ENUM','string','variable','customVariable','picklist','STRING','sequelize'];(function(_0xc14a52,_0x5b84b9){var _0x2e5227=function(_0x580348){while(--_0x580348){_0xc14a52['push'](_0xc14a52['shift']());}};_0x2e5227(++_0x5b84b9);}(_0x66e8,0xe7));var _0x866e=function(_0x2bd6e1,_0x1c6820){_0x2bd6e1=_0x2bd6e1-0x0;var _0x3dc9c4=_0x66e8[_0x2bd6e1];return _0x3dc9c4;};'use strict';var Sequelize=require(_0x866e('0x0'));module[_0x866e('0x1')]={'type':{'type':Sequelize[_0x866e('0x2')](_0x866e('0x3'),_0x866e('0x4'),_0x866e('0x5'),'keyValue',_0x866e('0x6')),'defaultValue':_0x866e('0x3')},'content':{'type':Sequelize[_0x866e('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x866e('0x2')](_0x866e('0x3'),_0x866e('0x4'),_0x866e('0x5'))},'keyContent':{'type':Sequelize[_0x866e('0x7')]},'idField':{'type':Sequelize[_0x866e('0x7')]},'nameField':{'type':Sequelize[_0x866e('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x866e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 7ed229e..0ae3b61 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 _0x2413=['reject','save','update','then','destroy','error','stack','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','catch','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','apply'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x2413,0x1a1));var _0x3241=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2413[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x3241('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3241('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3241('0x2'));var moment=require(_0x3241('0x3'));var BPromise=require(_0x3241('0x4'));var Mustache=require(_0x3241('0x5'));var util=require(_0x3241('0x6'));var path=require('path');var sox=require(_0x3241('0x7'));var csv=require('to-csv');var ejs=require(_0x3241('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3241('0x9'));var squel=require(_0x3241('0xa'));var crypto=require(_0x3241('0xb'));var jsforce=require(_0x3241('0xc'));var deskjs=require(_0x3241('0xd'));var toCsv=require(_0x3241('0xe'));var querystring=require(_0x3241('0xf'));var Papa=require(_0x3241('0x10'));var Redis=require(_0x3241('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3241('0x12'));var hardwareService=require(_0x3241('0x13'));var logger=require(_0x3241('0x14'))(_0x3241('0x15'));var utils=require(_0x3241('0x16'));var config=require(_0x3241('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aae34,_0x51907b){_0x51907b=_0x51907b||0xcc;return function(_0x1c17b5){if(_0x1c17b5){return _0x1aae34[_0x3241('0x18')](_0x51907b);}return _0x1aae34[_0x3241('0x19')](_0x51907b)['end']();};}function respondWithResult(_0x4f097d,_0x229889){_0x229889=_0x229889||0xc8;return function(_0x8c1736){if(_0x8c1736){return _0x4f097d[_0x3241('0x19')](_0x229889)[_0x3241('0x1a')](_0x8c1736);}};}function respondWithFilteredResult(_0x2bd4a1,_0x259e64){return function(_0x987749){if(_0x987749){var _0x227702=typeof _0x259e64['offset']===_0x3241('0x1b')&&typeof _0x259e64[_0x3241('0x1c')]==='undefined';var _0x41e765=_0x987749[_0x3241('0x1d')];var _0x4cdd14=_0x227702?0x0:_0x259e64[_0x3241('0x1e')];var _0x5879eb=_0x227702?_0x987749[_0x3241('0x1d')]:_0x259e64[_0x3241('0x1e')]+_0x259e64[_0x3241('0x1c')];var _0x20c01a;if(_0x5879eb>=_0x41e765){_0x5879eb=_0x41e765;_0x20c01a=0xc8;}else{_0x20c01a=0xce;}_0x2bd4a1[_0x3241('0x19')](_0x20c01a);return _0x2bd4a1[_0x3241('0x1f')]('Content-Range',_0x4cdd14+'-'+_0x5879eb+'/'+_0x41e765)['json'](_0x987749);}return null;};}function patchUpdates(_0x1fa162){return function(_0x487018){try{jsonpatch[_0x3241('0x20')](_0x487018,_0x1fa162,!![]);}catch(_0x524735){return BPromise[_0x3241('0x21')](_0x524735);}return _0x487018[_0x3241('0x22')]();};}function saveUpdates(_0x83f6d3,_0x2153d4){return function(_0x560c53){if(_0x560c53){return _0x560c53[_0x3241('0x23')](_0x83f6d3)[_0x3241('0x24')](function(_0x810289){return _0x810289;});}return null;};}function removeEntity(_0x57f6d4,_0x1edaa8){return function(_0x36f8c5){if(_0x36f8c5){return _0x36f8c5[_0x3241('0x25')]()[_0x3241('0x24')](function(){_0x57f6d4[_0x3241('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x586e9d,_0x2afbf9){return function(_0x39e2c0){if(!_0x39e2c0){_0x586e9d['sendStatus'](0x194);}return _0x39e2c0;};}function handleError(_0x20a468,_0x6fb158){_0x6fb158=_0x6fb158||0x1f4;return function(_0x2947e6){logger[_0x3241('0x26')](_0x2947e6[_0x3241('0x27')]);if(_0x2947e6[_0x3241('0x28')]){delete _0x2947e6[_0x3241('0x28')];}_0x20a468[_0x3241('0x19')](_0x6fb158)['send'](_0x2947e6);};}exports[_0x3241('0x29')]=function(_0x2eee0b,_0x4294ea){var _0x509b30={},_0x37a529={},_0x1ff11e={'count':0x0,'rows':[]};var _0x8a423f=_[_0x3241('0x2a')](db[_0x3241('0x2b')][_0x3241('0x2c')],function(_0x548cc3){return{'name':_0x548cc3[_0x3241('0x2d')],'type':_0x548cc3[_0x3241('0x2e')][_0x3241('0x2f')]};});_0x37a529[_0x3241('0x30')]=_[_0x3241('0x2a')](_0x8a423f,_0x3241('0x28'));_0x37a529['query']=_[_0x3241('0x31')](_0x2eee0b[_0x3241('0x32')]);_0x37a529[_0x3241('0x33')]=_[_0x3241('0x34')](_0x37a529[_0x3241('0x30')],_0x37a529['query']);_0x509b30[_0x3241('0x35')]=_['intersection'](_0x37a529[_0x3241('0x30')],qs[_0x3241('0x36')](_0x2eee0b['query'][_0x3241('0x36')]));_0x509b30[_0x3241('0x35')]=_0x509b30[_0x3241('0x35')][_0x3241('0x37')]?_0x509b30[_0x3241('0x35')]:_0x37a529['model'];if(!_0x2eee0b[_0x3241('0x32')][_0x3241('0x38')](_0x3241('0x39'))){_0x509b30['limit']=qs['limit'](_0x2eee0b['query']['limit']);_0x509b30[_0x3241('0x1e')]=qs[_0x3241('0x1e')](_0x2eee0b[_0x3241('0x32')][_0x3241('0x1e')]);}_0x509b30[_0x3241('0x3a')]=qs[_0x3241('0x3b')](_0x2eee0b[_0x3241('0x32')][_0x3241('0x3b')]);_0x509b30[_0x3241('0x3c')]=qs[_0x3241('0x33')](_[_0x3241('0x3d')](_0x2eee0b[_0x3241('0x32')],_0x37a529[_0x3241('0x33')]),_0x8a423f);if(_0x2eee0b[_0x3241('0x32')][_0x3241('0x3e')]){_0x509b30[_0x3241('0x3c')]=_[_0x3241('0x3f')](_0x509b30[_0x3241('0x3c')],{'$or':_[_0x3241('0x2a')](_0x8a423f,function(_0x124f75){if(_0x124f75[_0x3241('0x2e')]!==_0x3241('0x40')){var _0x54c21d={};_0x54c21d[_0x124f75[_0x3241('0x28')]]={'$like':'%'+_0x2eee0b[_0x3241('0x32')][_0x3241('0x3e')]+'%'};return _0x54c21d;}})});}_0x509b30=_['merge']({},_0x509b30,_0x2eee0b[_0x3241('0x41')]);var _0x391b92={'where':_0x509b30[_0x3241('0x3c')]};return db[_0x3241('0x2b')][_0x3241('0x1d')](_0x391b92)[_0x3241('0x24')](function(_0x33083f){_0x1ff11e['count']=_0x33083f;if(_0x2eee0b['query'][_0x3241('0x42')]){_0x509b30['include']=[{'all':!![]}];}return db['ZendeskField'][_0x3241('0x43')](_0x509b30);})[_0x3241('0x24')](function(_0x167ca5){_0x1ff11e['rows']=_0x167ca5;return _0x1ff11e;})[_0x3241('0x24')](respondWithFilteredResult(_0x4294ea,_0x509b30))['catch'](handleError(_0x4294ea,null));};exports[_0x3241('0x44')]=function(_0x55bd7a,_0x2c50d6){var _0x3f3328={'raw':!![],'where':{'id':_0x55bd7a[_0x3241('0x45')]['id']}},_0x10ab02={};_0x10ab02[_0x3241('0x30')]=_[_0x3241('0x31')](db[_0x3241('0x2b')][_0x3241('0x2c')]);_0x10ab02['query']=_[_0x3241('0x31')](_0x55bd7a[_0x3241('0x32')]);_0x10ab02['filters']=_[_0x3241('0x34')](_0x10ab02['model'],_0x10ab02[_0x3241('0x32')]);_0x3f3328['attributes']=_['intersection'](_0x10ab02[_0x3241('0x30')],qs[_0x3241('0x36')](_0x55bd7a['query'][_0x3241('0x36')]));_0x3f3328[_0x3241('0x35')]=_0x3f3328[_0x3241('0x35')]['length']?_0x3f3328[_0x3241('0x35')]:_0x10ab02[_0x3241('0x30')];if(_0x55bd7a[_0x3241('0x32')][_0x3241('0x42')]){_0x3f3328[_0x3241('0x46')]=[{'all':!![]}];}_0x3f3328=_[_0x3241('0x3f')]({},_0x3f3328,_0x55bd7a[_0x3241('0x41')]);return db['ZendeskField'][_0x3241('0x47')](_0x3f3328)[_0x3241('0x24')](handleEntityNotFound(_0x2c50d6,null))['then'](respondWithResult(_0x2c50d6,null))[_0x3241('0x48')](handleError(_0x2c50d6,null));};exports[_0x3241('0x49')]=function(_0x4156a2,_0x4b9e7f){return db[_0x3241('0x2b')][_0x3241('0x49')](_0x4156a2['body'],{})['then'](respondWithResult(_0x4b9e7f,0xc9))[_0x3241('0x48')](handleError(_0x4b9e7f,null));};exports[_0x3241('0x23')]=function(_0x4b6ee8,_0x168763){if(_0x4b6ee8[_0x3241('0x4a')]['id']){delete _0x4b6ee8[_0x3241('0x4a')]['id'];}return db[_0x3241('0x2b')]['find']({'where':{'id':_0x4b6ee8[_0x3241('0x45')]['id']}})[_0x3241('0x24')](handleEntityNotFound(_0x168763,null))['then'](saveUpdates(_0x4b6ee8[_0x3241('0x4a')],null))[_0x3241('0x24')](respondWithResult(_0x168763,null))['catch'](handleError(_0x168763,null));};exports[_0x3241('0x25')]=function(_0x3af7a6,_0x2493e7){return db[_0x3241('0x2b')][_0x3241('0x47')]({'where':{'id':_0x3af7a6[_0x3241('0x45')]['id']}})[_0x3241('0x24')](handleEntityNotFound(_0x2493e7,null))[_0x3241('0x24')](removeEntity(_0x2493e7,null))[_0x3241('0x48')](handleError(_0x2493e7,null));}; \ No newline at end of file +var _0xeb8c=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','send','ZendeskField','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox'];(function(_0x4b0f03,_0x3d09f0){var _0x55585f=function(_0x3765ce){while(--_0x3765ce){_0x4b0f03['push'](_0x4b0f03['shift']());}};_0x55585f(++_0x3d09f0);}(_0xeb8c,0x170));var _0xceb8=function(_0x2b4072,_0x51c2c2){_0x2b4072=_0x2b4072-0x0;var _0x1f280a=_0xeb8c[_0x2b4072];return _0x1f280a;};'use strict';var emlformat=require(_0xceb8('0x0'));var rimraf=require(_0xceb8('0x1'));var zipdir=require(_0xceb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xceb8('0x3'));var BPromise=require(_0xceb8('0x4'));var Mustache=require(_0xceb8('0x5'));var util=require('util');var path=require('path');var sox=require(_0xceb8('0x6'));var csv=require('to-csv');var ejs=require(_0xceb8('0x7'));var fs=require('fs');var fs_extra=require(_0xceb8('0x8'));var _=require(_0xceb8('0x9'));var squel=require(_0xceb8('0xa'));var crypto=require('crypto');var jsforce=require(_0xceb8('0xb'));var deskjs=require(_0xceb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0xceb8('0xd'));var Papa=require(_0xceb8('0xe'));var Redis=require(_0xceb8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xceb8('0x10'));var as=require(_0xceb8('0x11'));var hardwareService=require(_0xceb8('0x12'));var logger=require(_0xceb8('0x13'))(_0xceb8('0x14'));var utils=require(_0xceb8('0x15'));var config=require(_0xceb8('0x16'));var licenseUtil=require(_0xceb8('0x17'));var db=require(_0xceb8('0x18'))['db'];function respondWithStatusCode(_0x14003d,_0x4c662d){_0x4c662d=_0x4c662d||0xcc;return function(_0x1815bd){if(_0x1815bd){return _0x14003d[_0xceb8('0x19')](_0x4c662d);}return _0x14003d[_0xceb8('0x1a')](_0x4c662d)['end']();};}function respondWithResult(_0x1e8af2,_0x576910){_0x576910=_0x576910||0xc8;return function(_0x442f0d){if(_0x442f0d){return _0x1e8af2[_0xceb8('0x1a')](_0x576910)['json'](_0x442f0d);}};}function respondWithFilteredResult(_0x306ef0,_0x12e8e0){return function(_0xe68e20){if(_0xe68e20){var _0x550887=typeof _0x12e8e0['offset']===_0xceb8('0x1b')&&typeof _0x12e8e0[_0xceb8('0x1c')]===_0xceb8('0x1b');var _0x790c3f=_0xe68e20[_0xceb8('0x1d')];var _0x15ee47=_0x550887?0x0:_0x12e8e0[_0xceb8('0x1e')];var _0x304899=_0x550887?_0xe68e20[_0xceb8('0x1d')]:_0x12e8e0[_0xceb8('0x1e')]+_0x12e8e0['limit'];var _0x57a92e;if(_0x304899>=_0x790c3f){_0x304899=_0x790c3f;_0x57a92e=0xc8;}else{_0x57a92e=0xce;}_0x306ef0['status'](_0x57a92e);return _0x306ef0['set'](_0xceb8('0x1f'),_0x15ee47+'-'+_0x304899+'/'+_0x790c3f)[_0xceb8('0x20')](_0xe68e20);}return null;};}function patchUpdates(_0x3b2f9d){return function(_0x42db02){try{jsonpatch[_0xceb8('0x21')](_0x42db02,_0x3b2f9d,!![]);}catch(_0xcb192f){return BPromise[_0xceb8('0x22')](_0xcb192f);}return _0x42db02[_0xceb8('0x23')]();};}function saveUpdates(_0x2faa80,_0x275736){return function(_0x5a8342){if(_0x5a8342){return _0x5a8342[_0xceb8('0x24')](_0x2faa80)[_0xceb8('0x25')](function(_0x2bd762){return _0x2bd762;});}return null;};}function removeEntity(_0x103b4f,_0x2c7d76){return function(_0x5ba4d8){if(_0x5ba4d8){return _0x5ba4d8[_0xceb8('0x26')]()['then'](function(){_0x103b4f[_0xceb8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x979bc2,_0x517239){return function(_0x26723e){if(!_0x26723e){_0x979bc2[_0xceb8('0x19')](0x194);}return _0x26723e;};}function handleError(_0x415fbb,_0x256eb5){_0x256eb5=_0x256eb5||0x1f4;return function(_0x36476d){logger[_0xceb8('0x27')](_0x36476d[_0xceb8('0x28')]);if(_0x36476d['name']){delete _0x36476d['name'];}_0x415fbb['status'](_0x256eb5)[_0xceb8('0x29')](_0x36476d);};}exports['index']=function(_0x50d9d9,_0x49876b){var _0x2db98a={},_0x826b1b={},_0x39423c={'count':0x0,'rows':[]};var _0x39c3bd=_['map'](db[_0xceb8('0x2a')][_0xceb8('0x2b')],function(_0x45ed69){return{'name':_0x45ed69[_0xceb8('0x2c')],'type':_0x45ed69['type'][_0xceb8('0x2d')]};});_0x826b1b[_0xceb8('0x2e')]=_['map'](_0x39c3bd,_0xceb8('0x2f'));_0x826b1b[_0xceb8('0x30')]=_[_0xceb8('0x31')](_0x50d9d9[_0xceb8('0x30')]);_0x826b1b[_0xceb8('0x32')]=_['intersection'](_0x826b1b[_0xceb8('0x2e')],_0x826b1b[_0xceb8('0x30')]);_0x2db98a[_0xceb8('0x33')]=_[_0xceb8('0x34')](_0x826b1b[_0xceb8('0x2e')],qs['fields'](_0x50d9d9['query'][_0xceb8('0x35')]));_0x2db98a[_0xceb8('0x33')]=_0x2db98a['attributes']['length']?_0x2db98a[_0xceb8('0x33')]:_0x826b1b[_0xceb8('0x2e')];if(!_0x50d9d9[_0xceb8('0x30')][_0xceb8('0x36')](_0xceb8('0x37'))){_0x2db98a[_0xceb8('0x1c')]=qs[_0xceb8('0x1c')](_0x50d9d9[_0xceb8('0x30')][_0xceb8('0x1c')]);_0x2db98a['offset']=qs[_0xceb8('0x1e')](_0x50d9d9[_0xceb8('0x30')]['offset']);}_0x2db98a['order']=qs['sort'](_0x50d9d9['query'][_0xceb8('0x38')]);_0x2db98a[_0xceb8('0x39')]=qs[_0xceb8('0x32')](_[_0xceb8('0x3a')](_0x50d9d9[_0xceb8('0x30')],_0x826b1b[_0xceb8('0x32')]),_0x39c3bd);if(_0x50d9d9[_0xceb8('0x30')][_0xceb8('0x3b')]){_0x2db98a[_0xceb8('0x39')]=_[_0xceb8('0x3c')](_0x2db98a[_0xceb8('0x39')],{'$or':_[_0xceb8('0x3d')](_0x39c3bd,function(_0x5c35a0){if(_0x5c35a0[_0xceb8('0x3e')]!=='VIRTUAL'){var _0x3562eb={};_0x3562eb[_0x5c35a0[_0xceb8('0x2f')]]={'$like':'%'+_0x50d9d9[_0xceb8('0x30')][_0xceb8('0x3b')]+'%'};return _0x3562eb;}})});}_0x2db98a=_[_0xceb8('0x3c')]({},_0x2db98a,_0x50d9d9[_0xceb8('0x3f')]);var _0x1dad9d={'where':_0x2db98a['where']};return db['ZendeskField'][_0xceb8('0x1d')](_0x1dad9d)[_0xceb8('0x25')](function(_0x2891d9){_0x39423c[_0xceb8('0x1d')]=_0x2891d9;if(_0x50d9d9[_0xceb8('0x30')][_0xceb8('0x40')]){_0x2db98a['include']=[{'all':!![]}];}return db['ZendeskField'][_0xceb8('0x41')](_0x2db98a);})['then'](function(_0x5836e5){_0x39423c[_0xceb8('0x42')]=_0x5836e5;return _0x39423c;})['then'](respondWithFilteredResult(_0x49876b,_0x2db98a))[_0xceb8('0x43')](handleError(_0x49876b,null));};exports[_0xceb8('0x44')]=function(_0x185bbf,_0x59e269){var _0x492340={'raw':!![],'where':{'id':_0x185bbf[_0xceb8('0x45')]['id']}},_0x1c49c1={};_0x1c49c1[_0xceb8('0x2e')]=_[_0xceb8('0x31')](db[_0xceb8('0x2a')]['rawAttributes']);_0x1c49c1[_0xceb8('0x30')]=_[_0xceb8('0x31')](_0x185bbf['query']);_0x1c49c1[_0xceb8('0x32')]=_[_0xceb8('0x34')](_0x1c49c1[_0xceb8('0x2e')],_0x1c49c1[_0xceb8('0x30')]);_0x492340[_0xceb8('0x33')]=_[_0xceb8('0x34')](_0x1c49c1[_0xceb8('0x2e')],qs[_0xceb8('0x35')](_0x185bbf[_0xceb8('0x30')]['fields']));_0x492340[_0xceb8('0x33')]=_0x492340[_0xceb8('0x33')][_0xceb8('0x46')]?_0x492340[_0xceb8('0x33')]:_0x1c49c1['model'];if(_0x185bbf[_0xceb8('0x30')][_0xceb8('0x40')]){_0x492340[_0xceb8('0x47')]=[{'all':!![]}];}_0x492340=_[_0xceb8('0x3c')]({},_0x492340,_0x185bbf['options']);return db['ZendeskField'][_0xceb8('0x48')](_0x492340)[_0xceb8('0x25')](handleEntityNotFound(_0x59e269,null))['then'](respondWithResult(_0x59e269,null))['catch'](handleError(_0x59e269,null));};exports[_0xceb8('0x49')]=function(_0x3e94d4,_0xdefa76){return db[_0xceb8('0x2a')]['create'](_0x3e94d4[_0xceb8('0x4a')],{})[_0xceb8('0x25')](respondWithResult(_0xdefa76,0xc9))[_0xceb8('0x43')](handleError(_0xdefa76,null));};exports[_0xceb8('0x24')]=function(_0x2f6d4a,_0x31e422){if(_0x2f6d4a[_0xceb8('0x4a')]['id']){delete _0x2f6d4a[_0xceb8('0x4a')]['id'];}return db['ZendeskField'][_0xceb8('0x48')]({'where':{'id':_0x2f6d4a[_0xceb8('0x45')]['id']}})[_0xceb8('0x25')](handleEntityNotFound(_0x31e422,null))[_0xceb8('0x25')](saveUpdates(_0x2f6d4a[_0xceb8('0x4a')],null))[_0xceb8('0x25')](respondWithResult(_0x31e422,null))[_0xceb8('0x43')](handleError(_0x31e422,null));};exports[_0xceb8('0x26')]=function(_0x559d82,_0x135234){return db['ZendeskField']['find']({'where':{'id':_0x559d82[_0xceb8('0x45')]['id']}})[_0xceb8('0x25')](handleEntityNotFound(_0x135234,null))[_0xceb8('0x25')](removeEntity(_0x135234,null))[_0xceb8('0x43')](handleError(_0x135234,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 06e31bc..76468dd 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 _0x5ab9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','util'];(function(_0x2f227b,_0x26e8ae){var _0x3d6594=function(_0x284ae1){while(--_0x284ae1){_0x2f227b['push'](_0x2f227b['shift']());}};_0x3d6594(++_0x26e8ae);}(_0x5ab9,0x1d0));var _0x95ab=function(_0x44b533,_0x221c8d){_0x44b533=_0x44b533-0x0;var _0x42325b=_0x5ab9[_0x44b533];return _0x42325b;};'use strict';var _=require('lodash');var util=require(_0x95ab('0x0'));var logger=require(_0x95ab('0x1'))(_0x95ab('0x2'));var moment=require(_0x95ab('0x3'));var BPromise=require(_0x95ab('0x4'));var rp=require(_0x95ab('0x5'));var fs=require('fs');var path=require(_0x95ab('0x6'));var rimraf=require(_0x95ab('0x7'));var config=require(_0x95ab('0x8'));var attributes=require(_0x95ab('0x9'));module[_0x95ab('0xa')]=function(_0x24b719,_0x44ff32){return _0x24b719['define'](_0x95ab('0xb'),attributes,{'tableName':_0x95ab('0xc'),'paranoid':![],'indexes':[{'name':_0x95ab('0xd'),'fields':[_0x95ab('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe768=['request-promise','path','../../config/environment','define','int_zendesk_fields','zendesk_unique_index','lodash','util','api','moment','bluebird'];(function(_0x3f8561,_0x294bd2){var _0x529730=function(_0x33baaa){while(--_0x33baaa){_0x3f8561['push'](_0x3f8561['shift']());}};_0x529730(++_0x294bd2);}(_0xe768,0x74));var _0x8e76=function(_0x88774a,_0x56eba6){_0x88774a=_0x88774a-0x0;var _0x2fb0cf=_0xe768[_0x88774a];return _0x2fb0cf;};'use strict';var _=require(_0x8e76('0x0'));var util=require(_0x8e76('0x1'));var logger=require('../../config/logger')(_0x8e76('0x2'));var moment=require(_0x8e76('0x3'));var BPromise=require(_0x8e76('0x4'));var rp=require(_0x8e76('0x5'));var fs=require('fs');var path=require(_0x8e76('0x6'));var rimraf=require('rimraf');var config=require(_0x8e76('0x7'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x39fe28,_0x5e5c5e){return _0x39fe28[_0x8e76('0x8')]('ZendeskField',attributes,{'tableName':_0x8e76('0x9'),'paranoid':![],'indexes':[{'name':_0x8e76('0xa'),'fields':['idField','FieldId'],'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 4b845f9..bff8d21 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 _0xf1f7=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','ZendeskField,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xf1f7,0x6c));var _0x7f1f=function(_0xf405ad,_0x1afcdf){_0xf405ad=_0xf405ad-0x0;var _0x45c5a7=_0xf1f7[_0xf405ad];return _0x45c5a7;};'use strict';var _=require('lodash');var util=require(_0x7f1f('0x0'));var moment=require(_0x7f1f('0x1'));var BPromise=require(_0x7f1f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f1f('0x3'));var db=require(_0x7f1f('0x4'))['db'];var utils=require(_0x7f1f('0x5'));var logger=require(_0x7f1f('0x6'))(_0x7f1f('0x7'));var config=require(_0x7f1f('0x8'));var jayson=require(_0x7f1f('0x9'));var client=jayson[_0x7f1f('0xa')][_0x7f1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d1073,_0x2b5400,_0x2acbd3){return new BPromise(function(_0x3cfaf9,_0x5d3aa3){return client[_0x7f1f('0xc')](_0x3d1073,_0x2acbd3)[_0x7f1f('0xd')](function(_0x4cba2e){logger[_0x7f1f('0xe')]('ZendeskField,\x20%s,\x20%s',_0x2b5400,_0x7f1f('0xf'));logger[_0x7f1f('0x10')](_0x7f1f('0x11'),_0x2b5400,_0x7f1f('0xf'),JSON['stringify'](_0x4cba2e));if(_0x4cba2e[_0x7f1f('0x12')]){if(_0x4cba2e[_0x7f1f('0x12')][_0x7f1f('0x13')]===0x1f4){logger[_0x7f1f('0x12')](_0x7f1f('0x14'),_0x2b5400,_0x4cba2e[_0x7f1f('0x12')]['message']);return _0x5d3aa3(_0x4cba2e[_0x7f1f('0x12')][_0x7f1f('0x15')]);}logger[_0x7f1f('0x12')]('ZendeskField,\x20%s,\x20%s',_0x2b5400,_0x4cba2e['error'][_0x7f1f('0x15')]);return _0x3cfaf9(_0x4cba2e[_0x7f1f('0x12')][_0x7f1f('0x15')]);}else{logger[_0x7f1f('0xe')]('ZendeskField,\x20%s,\x20%s',_0x2b5400,_0x7f1f('0xf'));_0x3cfaf9(_0x4cba2e['result'][_0x7f1f('0x15')]);}})[_0x7f1f('0x16')](function(_0x2657db){logger[_0x7f1f('0x12')](_0x7f1f('0x14'),_0x2b5400,_0x2657db);_0x5d3aa3(_0x2657db);});});} \ No newline at end of file +var _0xec54=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x302cc7,_0x107770){var _0x937de8=function(_0x984dea){while(--_0x984dea){_0x302cc7['push'](_0x302cc7['shift']());}};_0x937de8(++_0x107770);}(_0xec54,0x1ba));var _0x4ec5=function(_0x43732a,_0x16e389){_0x43732a=_0x43732a-0x0;var _0x4efae7=_0xec54[_0x43732a];return _0x4efae7;};'use strict';var _=require(_0x4ec5('0x0'));var util=require(_0x4ec5('0x1'));var moment=require(_0x4ec5('0x2'));var BPromise=require(_0x4ec5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ec5('0x4'))['db'];var utils=require(_0x4ec5('0x5'));var logger=require(_0x4ec5('0x6'))(_0x4ec5('0x7'));var config=require(_0x4ec5('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3710a5,_0x52c9cc,_0x2f3ea6){return new BPromise(function(_0x5e573f,_0x54624b){return client[_0x4ec5('0x9')](_0x3710a5,_0x2f3ea6)[_0x4ec5('0xa')](function(_0x3c4d14){logger[_0x4ec5('0xb')](_0x4ec5('0xc'),_0x52c9cc,_0x4ec5('0xd'));logger[_0x4ec5('0xe')](_0x4ec5('0xf'),_0x52c9cc,'request\x20sent',JSON[_0x4ec5('0x10')](_0x3c4d14));if(_0x3c4d14[_0x4ec5('0x11')]){if(_0x3c4d14[_0x4ec5('0x11')]['code']===0x1f4){logger[_0x4ec5('0x11')](_0x4ec5('0xc'),_0x52c9cc,_0x3c4d14[_0x4ec5('0x11')][_0x4ec5('0x12')]);return _0x54624b(_0x3c4d14[_0x4ec5('0x11')][_0x4ec5('0x12')]);}logger[_0x4ec5('0x11')](_0x4ec5('0xc'),_0x52c9cc,_0x3c4d14['error'][_0x4ec5('0x12')]);return _0x5e573f(_0x3c4d14['error']['message']);}else{logger[_0x4ec5('0xb')]('ZendeskField,\x20%s,\x20%s',_0x52c9cc,_0x4ec5('0xd'));_0x5e573f(_0x3c4d14[_0x4ec5('0x13')]['message']);}})[_0x4ec5('0x14')](function(_0x58c19e){logger[_0x4ec5('0x11')](_0x4ec5('0xc'),_0x52c9cc,_0x58c19e);_0x54624b(_0x58c19e);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 9e36ea3..38eeaed 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 _0xa3b7=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xa3b7,0x15d));var _0x7a3b=function(_0x2dbcef,_0x1cfecb){_0x2dbcef=_0x2dbcef-0x0;var _0x5a90ea=_0xa3b7[_0x2dbcef];return _0x5a90ea;};'use strict';var multer=require(_0x7a3b('0x0'));var util=require(_0x7a3b('0x1'));var path=require('path');var timeout=require(_0x7a3b('0x2'));var express=require('express');var router=express[_0x7a3b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7a3b('0x4'));var interaction=require(_0x7a3b('0x5'));var config=require(_0x7a3b('0x6'));var controller=require(_0x7a3b('0x7'));router['get']('/',auth[_0x7a3b('0x8')](),controller['index']);router[_0x7a3b('0x9')](_0x7a3b('0xa'),auth[_0x7a3b('0x8')](),controller[_0x7a3b('0xb')]);router[_0x7a3b('0x9')](_0x7a3b('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x7a3b('0xd'),auth[_0x7a3b('0x8')](),controller[_0x7a3b('0xe')]);router[_0x7a3b('0xf')]('/',auth[_0x7a3b('0x8')](),controller[_0x7a3b('0x10')]);router[_0x7a3b('0xf')](_0x7a3b('0xc'),auth['isAuthenticated'](),controller[_0x7a3b('0x11')]);router[_0x7a3b('0x12')](_0x7a3b('0xa'),auth[_0x7a3b('0x8')](),controller[_0x7a3b('0x13')]);router[_0x7a3b('0x14')](_0x7a3b('0xa'),auth[_0x7a3b('0x8')](),controller[_0x7a3b('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5d92=['fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','exports','multer','util','path','connect-timeout'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5d92,0x137));var _0x25d9=function(_0x143318,_0x4ee708){_0x143318=_0x143318-0x0;var _0x49ea48=_0x5d92[_0x143318];return _0x49ea48;};'use strict';var multer=require(_0x25d9('0x0'));var util=require(_0x25d9('0x1'));var path=require(_0x25d9('0x2'));var timeout=require(_0x25d9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25d9('0x4'));var auth=require(_0x25d9('0x5'));var interaction=require(_0x25d9('0x6'));var config=require('../../config/environment');var controller=require(_0x25d9('0x7'));router['get']('/',auth[_0x25d9('0x8')](),controller[_0x25d9('0x9')]);router[_0x25d9('0xa')](_0x25d9('0xb'),auth['isAuthenticated'](),controller[_0x25d9('0xc')]);router[_0x25d9('0xa')]('/:id/configurations',auth[_0x25d9('0x8')](),controller[_0x25d9('0xd')]);router[_0x25d9('0xa')](_0x25d9('0xe'),auth[_0x25d9('0x8')](),controller[_0x25d9('0xf')]);router[_0x25d9('0x10')]('/',auth[_0x25d9('0x8')](),controller[_0x25d9('0x11')]);router['post']('/:id/configurations',auth[_0x25d9('0x8')](),controller[_0x25d9('0x12')]);router[_0x25d9('0x13')]('/:id',auth[_0x25d9('0x8')](),controller['update']);router['delete'](_0x25d9('0xb'),auth[_0x25d9('0x8')](),controller['destroy']);module[_0x25d9('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 7f46429..445c42c 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 _0xbec5=['STRING','sequelize','exports'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xbec5,0xe5));var _0x5bec=function(_0x402731,_0x43c115){_0x402731=_0x402731-0x0;var _0x111736=_0xbec5[_0x402731];return _0x111736;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5bec('0x2')]},'host':{'type':Sequelize[_0x5bec('0x2')]},'zone':{'type':Sequelize[_0x5bec('0x2')]},'clientId':{'type':Sequelize[_0x5bec('0x2')]},'clientSecret':{'type':Sequelize[_0x5bec('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x5bec('0x2')]},'refreshToken':{'type':Sequelize[_0x5bec('0x2')]}}; \ No newline at end of file +var _0x5636=['sequelize','exports','STRING'];(function(_0x48e5ae,_0x521840){var _0x4a56a9=function(_0x2c4972){while(--_0x2c4972){_0x48e5ae['push'](_0x48e5ae['shift']());}};_0x4a56a9(++_0x521840);}(_0x5636,0x102));var _0x6563=function(_0x58d04e,_0x70cf93){_0x58d04e=_0x58d04e-0x0;var _0x1472ea=_0x5636[_0x58d04e];return _0x1472ea;};'use strict';var Sequelize=require(_0x6563('0x0'));module[_0x6563('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x6563('0x2')]},'clientId':{'type':Sequelize[_0x6563('0x2')]},'clientSecret':{'type':Sequelize[_0x6563('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x6563('0x2')]},'refreshToken':{'type':Sequelize[_0x6563('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 3550c2a..1b1058a 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 _0x4825=['/oauth/v2/token','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientSecret','refreshToken','host','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','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'];(function(_0x2af770,_0x26d42){var _0x3f351d=function(_0x46ffdc){while(--_0x46ffdc){_0x2af770['push'](_0x2af770['shift']());}};_0x3f351d(++_0x26d42);}(_0x4825,0x148));var _0x5482=function(_0x9c195e,_0x590a81){_0x9c195e=_0x9c195e-0x0;var _0x734e7b=_0x4825[_0x9c195e];return _0x734e7b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5482('0x0'));var zipdir=require(_0x5482('0x1'));var jsonpatch=require(_0x5482('0x2'));var rp=require(_0x5482('0x3'));var moment=require(_0x5482('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5482('0x5'));var util=require(_0x5482('0x6'));var path=require(_0x5482('0x7'));var sox=require(_0x5482('0x8'));var csv=require('to-csv');var ejs=require(_0x5482('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5482('0xa'));var squel=require(_0x5482('0xb'));var crypto=require(_0x5482('0xc'));var jsforce=require(_0x5482('0xd'));var deskjs=require(_0x5482('0xe'));var toCsv=require(_0x5482('0xf'));var querystring=require(_0x5482('0x10'));var Papa=require(_0x5482('0x11'));var Redis=require('ioredis');var authService=require(_0x5482('0x12'));var qs=require(_0x5482('0x13'));var as=require(_0x5482('0x14'));var hardwareService=require(_0x5482('0x15'));var logger=require(_0x5482('0x16'))('api');var utils=require(_0x5482('0x17'));var config=require(_0x5482('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5482('0x19'))['db'];var integrations=require(_0x5482('0x1a'));function respondWithStatusCode(_0x125146,_0x55adda){_0x55adda=_0x55adda||0xcc;return function(_0x144cde){if(_0x144cde){return _0x125146[_0x5482('0x1b')](_0x55adda);}return _0x125146[_0x5482('0x1c')](_0x55adda)[_0x5482('0x1d')]();};}function respondWithResult(_0x3a4918,_0x5a4b7d){_0x5a4b7d=_0x5a4b7d||0xc8;return function(_0x1d9e90){if(_0x1d9e90){return _0x3a4918['status'](_0x5a4b7d)[_0x5482('0x1e')](_0x1d9e90);}};}function respondWithFilteredResult(_0x12df0b,_0xad9f3a){return function(_0x172267){if(_0x172267){var _0x549d6e=typeof _0xad9f3a[_0x5482('0x1f')]===_0x5482('0x20')&&typeof _0xad9f3a[_0x5482('0x21')]==='undefined';var _0x5a72aa=_0x172267[_0x5482('0x22')];var _0x46f59c=_0x549d6e?0x0:_0xad9f3a[_0x5482('0x1f')];var _0x48d7d0=_0x549d6e?_0x172267[_0x5482('0x22')]:_0xad9f3a['offset']+_0xad9f3a[_0x5482('0x21')];var _0x488ec1;if(_0x48d7d0>=_0x5a72aa){_0x48d7d0=_0x5a72aa;_0x488ec1=0xc8;}else{_0x488ec1=0xce;}_0x12df0b[_0x5482('0x1c')](_0x488ec1);return _0x12df0b[_0x5482('0x23')](_0x5482('0x24'),_0x46f59c+'-'+_0x48d7d0+'/'+_0x5a72aa)['json'](_0x172267);}return null;};}function patchUpdates(_0x294194){return function(_0x436668){try{jsonpatch[_0x5482('0x25')](_0x436668,_0x294194,!![]);}catch(_0x32d810){return BPromise[_0x5482('0x26')](_0x32d810);}return _0x436668[_0x5482('0x27')]();};}function saveUpdates(_0x54edd8,_0x269ff6){return function(_0x3770c0){if(_0x3770c0){return _0x3770c0[_0x5482('0x28')](_0x54edd8)[_0x5482('0x29')](function(_0x23e67e){return _0x23e67e;});}return null;};}function removeEntity(_0xf1028c,_0x1d5d88){return function(_0x5bb2ea){if(_0x5bb2ea){return _0x5bb2ea[_0x5482('0x2a')]()[_0x5482('0x29')](function(){_0xf1028c['status'](0xcc)[_0x5482('0x1d')]();});}};}function handleEntityNotFound(_0x13b7b9,_0x1cc2e5){return function(_0x50cd66){if(!_0x50cd66){_0x13b7b9[_0x5482('0x1b')](0x194);}return _0x50cd66;};}function handleError(_0x3c63da,_0x39d36f){_0x39d36f=_0x39d36f||0x1f4;return function(_0x1bc50a){logger[_0x5482('0x2b')](_0x1bc50a[_0x5482('0x2c')]);if(_0x1bc50a[_0x5482('0x2d')]){delete _0x1bc50a['name'];}_0x3c63da[_0x5482('0x1c')](_0x39d36f)['send'](_0x1bc50a);};}exports['index']=function(_0x14669e,_0x1dc090){var _0x5144c8={},_0x29b8cb={},_0x58d39f={'count':0x0,'rows':[]};var _0x44fb4d=_[_0x5482('0x2e')](db[_0x5482('0x2f')][_0x5482('0x30')],function(_0x299dd2){return{'name':_0x299dd2[_0x5482('0x31')],'type':_0x299dd2[_0x5482('0x32')][_0x5482('0x33')]};});_0x29b8cb[_0x5482('0x34')]=_[_0x5482('0x2e')](_0x44fb4d,_0x5482('0x2d'));_0x29b8cb['query']=_[_0x5482('0x35')](_0x14669e[_0x5482('0x36')]);_0x29b8cb['filters']=_['intersection'](_0x29b8cb[_0x5482('0x34')],_0x29b8cb[_0x5482('0x36')]);_0x5144c8[_0x5482('0x37')]=_[_0x5482('0x38')](_0x29b8cb[_0x5482('0x34')],qs[_0x5482('0x39')](_0x14669e[_0x5482('0x36')][_0x5482('0x39')]));_0x5144c8[_0x5482('0x37')]=_0x5144c8[_0x5482('0x37')][_0x5482('0x3a')]?_0x5144c8[_0x5482('0x37')]:_0x29b8cb[_0x5482('0x34')];if(!_0x14669e[_0x5482('0x36')][_0x5482('0x3b')](_0x5482('0x3c'))){_0x5144c8[_0x5482('0x21')]=qs[_0x5482('0x21')](_0x14669e['query']['limit']);_0x5144c8[_0x5482('0x1f')]=qs[_0x5482('0x1f')](_0x14669e[_0x5482('0x36')][_0x5482('0x1f')]);}_0x5144c8[_0x5482('0x3d')]=qs[_0x5482('0x3e')](_0x14669e['query'][_0x5482('0x3e')]);_0x5144c8[_0x5482('0x3f')]=qs[_0x5482('0x40')](_[_0x5482('0x41')](_0x14669e['query'],_0x29b8cb[_0x5482('0x40')]),_0x44fb4d);if(_0x14669e[_0x5482('0x36')][_0x5482('0x42')]){_0x5144c8[_0x5482('0x3f')]=_[_0x5482('0x43')](_0x5144c8[_0x5482('0x3f')],{'$or':_[_0x5482('0x2e')](_0x44fb4d,function(_0x443857){if(_0x443857[_0x5482('0x32')]!==_0x5482('0x44')){var _0x4d7c57={};_0x4d7c57[_0x443857['name']]={'$like':'%'+_0x14669e[_0x5482('0x36')][_0x5482('0x42')]+'%'};return _0x4d7c57;}})});}_0x5144c8=_[_0x5482('0x43')]({},_0x5144c8,_0x14669e[_0x5482('0x45')]);var _0x740361={'where':_0x5144c8[_0x5482('0x3f')]};return db[_0x5482('0x2f')][_0x5482('0x22')](_0x740361)['then'](function(_0x381278){_0x58d39f[_0x5482('0x22')]=_0x381278;if(_0x14669e[_0x5482('0x36')][_0x5482('0x46')]){_0x5144c8['include']=[{'all':!![]}];}return db[_0x5482('0x2f')][_0x5482('0x47')](_0x5144c8);})[_0x5482('0x29')](function(_0x63a23){_0x58d39f[_0x5482('0x48')]=_0x63a23;return _0x58d39f;})[_0x5482('0x29')](respondWithFilteredResult(_0x1dc090,_0x5144c8))[_0x5482('0x49')](handleError(_0x1dc090,null));};exports['show']=function(_0x38ea1c,_0x38dee9){var _0x2e77fb={'raw':![],'where':{'id':_0x38ea1c[_0x5482('0x4a')]['id']}},_0x1c9e7a={};_0x1c9e7a[_0x5482('0x34')]=_[_0x5482('0x35')](db[_0x5482('0x2f')]['rawAttributes']);_0x1c9e7a[_0x5482('0x36')]=_[_0x5482('0x35')](_0x38ea1c['query']);_0x1c9e7a[_0x5482('0x40')]=_[_0x5482('0x38')](_0x1c9e7a[_0x5482('0x34')],_0x1c9e7a['query']);_0x2e77fb['attributes']=_[_0x5482('0x38')](_0x1c9e7a[_0x5482('0x34')],qs['fields'](_0x38ea1c['query'][_0x5482('0x39')]));_0x2e77fb[_0x5482('0x37')]=_0x2e77fb[_0x5482('0x37')][_0x5482('0x3a')]?_0x2e77fb[_0x5482('0x37')]:_0x1c9e7a['model'];if(_0x38ea1c['query'][_0x5482('0x46')]){_0x2e77fb[_0x5482('0x4b')]=[{'all':!![]}];}_0x2e77fb=_[_0x5482('0x43')]({},_0x2e77fb,_0x38ea1c['options']);return db[_0x5482('0x2f')][_0x5482('0x4c')](_0x2e77fb)[_0x5482('0x29')](handleEntityNotFound(_0x38dee9,null))['then'](respondWithResult(_0x38dee9,null))[_0x5482('0x49')](handleError(_0x38dee9,null));};exports[_0x5482('0x4d')]=function(_0x41a489,_0x409ab4){return db[_0x5482('0x2f')][_0x5482('0x4d')](_0x41a489[_0x5482('0x4e')],{})[_0x5482('0x29')](respondWithResult(_0x409ab4,0xc9))['catch'](handleError(_0x409ab4,null));};exports[_0x5482('0x28')]=function(_0x461ef7,_0x364210){if(_0x461ef7[_0x5482('0x4e')]['id']){delete _0x461ef7[_0x5482('0x4e')]['id'];}return db[_0x5482('0x2f')]['find']({'where':{'id':_0x461ef7[_0x5482('0x4a')]['id']}})[_0x5482('0x29')](handleEntityNotFound(_0x364210,null))[_0x5482('0x29')](saveUpdates(_0x461ef7[_0x5482('0x4e')],null))['then'](respondWithResult(_0x364210,null))['catch'](handleError(_0x364210,null));};exports['destroy']=function(_0x13a563,_0x362848){return db[_0x5482('0x2f')][_0x5482('0x4c')]({'where':{'id':_0x13a563[_0x5482('0x4a')]['id']}})[_0x5482('0x29')](handleEntityNotFound(_0x362848,null))[_0x5482('0x29')](removeEntity(_0x362848,null))[_0x5482('0x49')](handleError(_0x362848,null));};exports[_0x5482('0x4f')]=function(_0x5c6ba7,_0x216b1a,_0x334341){var _0x3bda09={};var _0x2d98a={};var _0x40481c;var _0x16cb9a;return db[_0x5482('0x2f')]['findOne']({'where':{'id':_0x5c6ba7[_0x5482('0x4a')]['id']}})['then'](handleEntityNotFound(_0x216b1a,null))[_0x5482('0x29')](function(_0x4de08f){if(_0x4de08f){_0x40481c=_0x4de08f;_0x2d98a[_0x5482('0x34')]=_[_0x5482('0x35')](db['ZohoConfiguration'][_0x5482('0x30')]);_0x2d98a[_0x5482('0x36')]=_[_0x5482('0x35')](_0x5c6ba7[_0x5482('0x36')]);_0x2d98a[_0x5482('0x40')]=_[_0x5482('0x38')](_0x2d98a[_0x5482('0x34')],_0x2d98a[_0x5482('0x36')]);_0x3bda09['attributes']=_['intersection'](_0x2d98a['model'],qs[_0x5482('0x39')](_0x5c6ba7[_0x5482('0x36')][_0x5482('0x39')]));_0x3bda09[_0x5482('0x37')]=_0x3bda09[_0x5482('0x37')]['length']?_0x3bda09[_0x5482('0x37')]:_0x2d98a['model'];_0x3bda09[_0x5482('0x3d')]=qs[_0x5482('0x3e')](_0x5c6ba7[_0x5482('0x36')]['sort']);_0x3bda09[_0x5482('0x3f')]=qs[_0x5482('0x40')](_[_0x5482('0x41')](_0x5c6ba7[_0x5482('0x36')],_0x2d98a[_0x5482('0x40')]));if(_0x5c6ba7[_0x5482('0x36')][_0x5482('0x42')]){_0x3bda09[_0x5482('0x3f')]=_[_0x5482('0x43')](_0x3bda09[_0x5482('0x3f')],{'$or':_[_0x5482('0x2e')](_0x3bda09[_0x5482('0x37')],function(_0x4f55a0){var _0x1d732f={};_0x1d732f[_0x4f55a0]={'$like':'%'+_0x5c6ba7[_0x5482('0x36')][_0x5482('0x42')]+'%'};return _0x1d732f;})});}_0x3bda09=_['merge']({},_0x3bda09,_0x5c6ba7[_0x5482('0x45')]);return _0x40481c[_0x5482('0x4f')](_0x3bda09);}})['then'](function(_0x2d427a){if(_0x2d427a){_0x16cb9a=_0x2d427a[_0x5482('0x3a')];if(!_0x5c6ba7[_0x5482('0x36')][_0x5482('0x3b')](_0x5482('0x3c'))){_0x3bda09[_0x5482('0x21')]=qs[_0x5482('0x21')](_0x5c6ba7[_0x5482('0x36')][_0x5482('0x21')]);_0x3bda09[_0x5482('0x1f')]=qs[_0x5482('0x1f')](_0x5c6ba7[_0x5482('0x36')][_0x5482('0x1f')]);}return _0x40481c['getConfigurations'](_0x3bda09);}})[_0x5482('0x29')](function(_0x33e5dd){if(_0x33e5dd){return _0x33e5dd?{'count':_0x16cb9a,'rows':_0x33e5dd}:null;}})['then'](respondWithResult(_0x216b1a,null))[_0x5482('0x49')](handleError(_0x216b1a,null));};exports[_0x5482('0x50')]=function(_0x16fe3f,_0x13cbb0,_0x9a4e1){if(_0x16fe3f['body']['id']){delete _0x16fe3f[_0x5482('0x4e')]['id'];}return db[_0x5482('0x2f')][_0x5482('0x51')]({'where':{'id':_0x16fe3f['params']['id']}})[_0x5482('0x29')](handleEntityNotFound(_0x13cbb0,null))[_0x5482('0x29')](function(_0x277714){if(_0x277714){_0x16fe3f['body'][_0x5482('0x52')]=_0x277714['id'];_0x16fe3f['body'][_0x5482('0x53')]=integrations['getSubjects'](_0x16fe3f[_0x5482('0x4e')][_0x5482('0x54')],_0x16fe3f['body']['type']);_0x16fe3f[_0x5482('0x4e')][_0x5482('0x55')]=integrations[_0x5482('0x56')](_0x16fe3f[_0x5482('0x4e')][_0x5482('0x54')],_0x16fe3f[_0x5482('0x4e')]['type']);return db[_0x5482('0x57')][_0x5482('0x4d')](_0x16fe3f[_0x5482('0x4e')],{'include':[{'model':db[_0x5482('0x58')],'as':'Subjects'},{'model':db[_0x5482('0x58')],'as':'Descriptions'}]});}return null;})[_0x5482('0x29')](respondWithResult(_0x13cbb0,null))['catch'](handleError(_0x13cbb0,null));};function getAccessToken(_0x28845a){return new Promise(function(_0x23c709,_0x2115b1){var _0x3c35a8;switch(_0x28845a[_0x5482('0x59')]){case'US':_0x3c35a8=_0x5482('0x5a');break;case'AU':_0x3c35a8=_0x5482('0x5b');break;case'EU':_0x3c35a8=_0x5482('0x5c');break;case'IN':_0x3c35a8=_0x5482('0x5d');break;case'CN':_0x3c35a8=_0x5482('0x5e');break;default:_0x3c35a8=_0x5482('0x5c');break;}var _0x48686c={'method':'POST','uri':_0x3c35a8+_0x5482('0x5f'),'qs':{'refresh_token':_0x28845a['refreshToken'],'client_id':_0x28845a[_0x5482('0x60')],'client_secret':_0x28845a['clientSecret'],'grant_type':_0x5482('0x61')},'json':!![]};return rp(_0x48686c)[_0x5482('0x29')](function(_0x5c4951){if(_0x5c4951[_0x5482('0x62')]){_0x23c709(_0x5c4951[_0x5482('0x62')]);}else{_0x2115b1(_0x5482('0x63'));}})[_0x5482('0x49')](function(_0x43d6eb){_0x2115b1(_0x43d6eb);});});}exports[_0x5482('0x64')]=function(_0x56f3ce,_0x154de1,_0x415a8c){var _0x55020e,_0x484729,_0x21092c,_0x5a0baa,_0x2cee4e;return db[_0x5482('0x2f')][_0x5482('0x51')]({'where':{'id':_0x56f3ce[_0x5482('0x4a')]['id']},'attributes':['id','host',_0x5482('0x59'),_0x5482('0x60'),_0x5482('0x65'),'serverUrl','code',_0x5482('0x66')]})[_0x5482('0x29')](handleEntityNotFound(_0x154de1,null))[_0x5482('0x29')](function(_0x559a1c){_0x2cee4e=_0x559a1c;_0x55020e=_0x2cee4e[_0x5482('0x67')];_0x484729=_0x55020e===_0x5482('0x68')?'eu':_0x5482('0x69');_0x21092c=_0x2cee4e[_0x5482('0x6a')];var _0x3b0b81=_0x21092c[_0x5482('0x6b')](-0x1);if(_0x3b0b81==='/'||_0x3b0b81==='\x5c'||_0x3b0b81===':'){_0x21092c=_0x21092c[_0x5482('0x6c')](0x0,_0x21092c[_0x5482('0x6d')](_0x3b0b81));}if(!_0x2cee4e[_0x5482('0x66')]){throw new Error(_0x5482('0x6e'));}return getAccessToken(_0x2cee4e);})['then'](function(_0x3e0c84){if(_0x3e0c84){return rp({'method':_0x5482('0x6f'),'uri':util[_0x5482('0x70')](_0x5482('0x71'),_0x484729),'qs':{'module':_0x5482('0x72')},'headers':{'Authorization':_0x5482('0x73')+_0x3e0c84},'json':!![]});}})[_0x5482('0x29')](function(_0x4245b8){if(_0x4245b8){if(_0x4245b8[_0x5482('0x74')]&&_0x4245b8[_0x5482('0x74')][_0x5482('0x2b')]){throw new Error(_0x4245b8[_0x5482('0x74')][_0x5482('0x2b')][_0x5482('0x75')]);}var _0x171cea=[];var _0x14b88a=[];var _0x1b2713=[_0x5482('0x76'),_0x5482('0x77'),_0x5482('0x78'),_0x5482('0x79'),_0x5482('0x7a'),_0x5482('0x7b'),_0x5482('0x7c'),_0x5482('0x7d')];_0x14b88a=_[_0x5482('0x7e')](_0x4245b8[_0x5482('0x39')],function(_0x2a15f7){return _0x1b2713[_0x5482('0x7f')](_0x2a15f7[_0x5482('0x80')]);});for(var _0x11181b=0x0;_0x11181b<_0x14b88a['length'];_0x11181b++){if(_0x14b88a[_0x11181b][_0x5482('0x81')]===![]){_0x171cea[_0x5482('0x82')]({'id':_0x14b88a[_0x11181b]['id'],'name':_0x14b88a[_0x11181b][_0x5482('0x83')],'custom':_0x14b88a[_0x11181b][_0x5482('0x84')],'options':_0x14b88a[_0x11181b][_0x5482('0x85')]===_0x5482('0x86')&&_0x14b88a[_0x11181b]['pick_list_values'][_0x5482('0x3a')]>-0x1?_['map'](_0x14b88a[_0x11181b]['pick_list_values'],function(_0x3c1073){return{'name':_0x3c1073,'value':_0x3c1073};}):[]});}}return{'count':_0x171cea[_0x5482('0x3a')],'rows':_0x171cea};}else{return{'count':0x0,'rows':[]};}})[_0x5482('0x29')](respondWithResult(_0x154de1,null))[_0x5482('0x49')](function(_0x221769){var _0x9beef1=_0x56f3ce[_0x5482('0x36')][_0x5482('0x87')]?0x1f4:_0x221769[_0x5482('0x88')]||0x1f4;logger[_0x5482('0x2b')](_0x5482('0x89'),_0x5482('0x64'),_0x9beef1,JSON[_0x5482('0x8a')](_0x221769));delete _0x221769[_0x5482('0x2d')];if(_0x9beef1===0x191){_0x9beef1=0x190;}_0x154de1['status'](_0x9beef1)[_0x5482('0x8b')](_0x56f3ce[_0x5482('0x36')][_0x5482('0x87')]?{'message':_0x5482('0x8c'),'statusCode':_0x221769['statusCode']}:_0x221769);});}; \ No newline at end of file +var _0xef75=['getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','access_token','getFields','host','clientId','clientSecret','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','sort','where','merge','filter','options','includeAll','include','rows','catch','intersection','find','create','body','params','findOne','ZohoConfiguration','order','pick','nolimit','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects'];(function(_0x45017c,_0x97c833){var _0x3a000b=function(_0x2770e0){while(--_0x2770e0){_0x45017c['push'](_0x45017c['shift']());}};_0x3a000b(++_0x97c833);}(_0xef75,0x13e));var _0x5ef7=function(_0x5f2111,_0x2edf65){_0x5f2111=_0x5f2111-0x0;var _0x211f2a=_0xef75[_0x5f2111];return _0x211f2a;};'use strict';var emlformat=require(_0x5ef7('0x0'));var rimraf=require(_0x5ef7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ef7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5ef7('0x3'));var Mustache=require(_0x5ef7('0x4'));var util=require(_0x5ef7('0x5'));var path=require(_0x5ef7('0x6'));var sox=require(_0x5ef7('0x7'));var csv=require(_0x5ef7('0x8'));var ejs=require(_0x5ef7('0x9'));var fs=require('fs');var fs_extra=require(_0x5ef7('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5ef7('0xb'));var jsforce=require(_0x5ef7('0xc'));var deskjs=require(_0x5ef7('0xd'));var toCsv=require(_0x5ef7('0x8'));var querystring=require(_0x5ef7('0xe'));var Papa=require(_0x5ef7('0xf'));var Redis=require(_0x5ef7('0x10'));var authService=require(_0x5ef7('0x11'));var qs=require(_0x5ef7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5ef7('0x13'));var utils=require(_0x5ef7('0x14'));var config=require(_0x5ef7('0x15'));var licenseUtil=require(_0x5ef7('0x16'));var db=require(_0x5ef7('0x17'))['db'];var integrations=require(_0x5ef7('0x18'));function respondWithStatusCode(_0x46e064,_0x12e3cb){_0x12e3cb=_0x12e3cb||0xcc;return function(_0x3ac47f){if(_0x3ac47f){return _0x46e064[_0x5ef7('0x19')](_0x12e3cb);}return _0x46e064['status'](_0x12e3cb)[_0x5ef7('0x1a')]();};}function respondWithResult(_0x23e168,_0x280a01){_0x280a01=_0x280a01||0xc8;return function(_0xf7684f){if(_0xf7684f){return _0x23e168[_0x5ef7('0x1b')](_0x280a01)[_0x5ef7('0x1c')](_0xf7684f);}};}function respondWithFilteredResult(_0x591bbf,_0x228e5d){return function(_0x21ee80){if(_0x21ee80){var _0xa53523=typeof _0x228e5d['offset']==='undefined'&&typeof _0x228e5d[_0x5ef7('0x1d')]===_0x5ef7('0x1e');var _0x519499=_0x21ee80[_0x5ef7('0x1f')];var _0x3ba2fe=_0xa53523?0x0:_0x228e5d[_0x5ef7('0x20')];var _0x2e2bdc=_0xa53523?_0x21ee80[_0x5ef7('0x1f')]:_0x228e5d[_0x5ef7('0x20')]+_0x228e5d[_0x5ef7('0x1d')];var _0x2eeb82;if(_0x2e2bdc>=_0x519499){_0x2e2bdc=_0x519499;_0x2eeb82=0xc8;}else{_0x2eeb82=0xce;}_0x591bbf[_0x5ef7('0x1b')](_0x2eeb82);return _0x591bbf[_0x5ef7('0x21')]('Content-Range',_0x3ba2fe+'-'+_0x2e2bdc+'/'+_0x519499)[_0x5ef7('0x1c')](_0x21ee80);}return null;};}function patchUpdates(_0x561ca1){return function(_0x4354e8){try{jsonpatch[_0x5ef7('0x22')](_0x4354e8,_0x561ca1,!![]);}catch(_0x39912b){return BPromise[_0x5ef7('0x23')](_0x39912b);}return _0x4354e8[_0x5ef7('0x24')]();};}function saveUpdates(_0x1678c1,_0x5aa70a){return function(_0xf2bbe8){if(_0xf2bbe8){return _0xf2bbe8[_0x5ef7('0x25')](_0x1678c1)[_0x5ef7('0x26')](function(_0x232402){return _0x232402;});}return null;};}function removeEntity(_0x434f4d,_0x92c96e){return function(_0x547023){if(_0x547023){return _0x547023[_0x5ef7('0x27')]()['then'](function(){_0x434f4d[_0x5ef7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e6260,_0x48e8b8){return function(_0x186e0a){if(!_0x186e0a){_0x5e6260['sendStatus'](0x194);}return _0x186e0a;};}function handleError(_0x475d54,_0x336c49){_0x336c49=_0x336c49||0x1f4;return function(_0x1a6531){logger['error'](_0x1a6531[_0x5ef7('0x28')]);if(_0x1a6531[_0x5ef7('0x29')]){delete _0x1a6531[_0x5ef7('0x29')];}_0x475d54['status'](_0x336c49)['send'](_0x1a6531);};}exports[_0x5ef7('0x2a')]=function(_0x50cec8,_0xd90890){var _0x3482bf={},_0x1900a0={},_0x46433e={'count':0x0,'rows':[]};var _0x69c9e1=_[_0x5ef7('0x2b')](db[_0x5ef7('0x2c')][_0x5ef7('0x2d')],function(_0x428bf0){return{'name':_0x428bf0[_0x5ef7('0x2e')],'type':_0x428bf0[_0x5ef7('0x2f')][_0x5ef7('0x30')]};});_0x1900a0['model']=_[_0x5ef7('0x2b')](_0x69c9e1,_0x5ef7('0x29'));_0x1900a0[_0x5ef7('0x31')]=_[_0x5ef7('0x32')](_0x50cec8[_0x5ef7('0x31')]);_0x1900a0[_0x5ef7('0x33')]=_['intersection'](_0x1900a0[_0x5ef7('0x34')],_0x1900a0['query']);_0x3482bf[_0x5ef7('0x35')]=_['intersection'](_0x1900a0[_0x5ef7('0x34')],qs[_0x5ef7('0x36')](_0x50cec8['query'][_0x5ef7('0x36')]));_0x3482bf['attributes']=_0x3482bf['attributes'][_0x5ef7('0x37')]?_0x3482bf[_0x5ef7('0x35')]:_0x1900a0[_0x5ef7('0x34')];if(!_0x50cec8[_0x5ef7('0x31')][_0x5ef7('0x38')]('nolimit')){_0x3482bf['limit']=qs['limit'](_0x50cec8[_0x5ef7('0x31')]['limit']);_0x3482bf[_0x5ef7('0x20')]=qs[_0x5ef7('0x20')](_0x50cec8[_0x5ef7('0x31')][_0x5ef7('0x20')]);}_0x3482bf['order']=qs[_0x5ef7('0x39')](_0x50cec8[_0x5ef7('0x31')][_0x5ef7('0x39')]);_0x3482bf['where']=qs[_0x5ef7('0x33')](_['pick'](_0x50cec8[_0x5ef7('0x31')],_0x1900a0['filters']),_0x69c9e1);if(_0x50cec8[_0x5ef7('0x31')]['filter']){_0x3482bf[_0x5ef7('0x3a')]=_[_0x5ef7('0x3b')](_0x3482bf['where'],{'$or':_[_0x5ef7('0x2b')](_0x69c9e1,function(_0x543b85){if(_0x543b85[_0x5ef7('0x2f')]!=='VIRTUAL'){var _0x2e0238={};_0x2e0238[_0x543b85[_0x5ef7('0x29')]]={'$like':'%'+_0x50cec8[_0x5ef7('0x31')][_0x5ef7('0x3c')]+'%'};return _0x2e0238;}})});}_0x3482bf=_['merge']({},_0x3482bf,_0x50cec8[_0x5ef7('0x3d')]);var _0x2e5660={'where':_0x3482bf[_0x5ef7('0x3a')]};return db[_0x5ef7('0x2c')]['count'](_0x2e5660)[_0x5ef7('0x26')](function(_0x1b4041){_0x46433e[_0x5ef7('0x1f')]=_0x1b4041;if(_0x50cec8[_0x5ef7('0x31')][_0x5ef7('0x3e')]){_0x3482bf[_0x5ef7('0x3f')]=[{'all':!![]}];}return db[_0x5ef7('0x2c')]['findAll'](_0x3482bf);})['then'](function(_0x307cd7){_0x46433e[_0x5ef7('0x40')]=_0x307cd7;return _0x46433e;})['then'](respondWithFilteredResult(_0xd90890,_0x3482bf))[_0x5ef7('0x41')](handleError(_0xd90890,null));};exports['show']=function(_0x7e5485,_0x3df0bc){var _0x582578={'raw':![],'where':{'id':_0x7e5485['params']['id']}},_0x6cdf00={};_0x6cdf00['model']=_['keys'](db[_0x5ef7('0x2c')][_0x5ef7('0x2d')]);_0x6cdf00[_0x5ef7('0x31')]=_[_0x5ef7('0x32')](_0x7e5485[_0x5ef7('0x31')]);_0x6cdf00[_0x5ef7('0x33')]=_[_0x5ef7('0x42')](_0x6cdf00[_0x5ef7('0x34')],_0x6cdf00['query']);_0x582578[_0x5ef7('0x35')]=_['intersection'](_0x6cdf00['model'],qs['fields'](_0x7e5485[_0x5ef7('0x31')][_0x5ef7('0x36')]));_0x582578['attributes']=_0x582578[_0x5ef7('0x35')][_0x5ef7('0x37')]?_0x582578[_0x5ef7('0x35')]:_0x6cdf00[_0x5ef7('0x34')];if(_0x7e5485[_0x5ef7('0x31')][_0x5ef7('0x3e')]){_0x582578[_0x5ef7('0x3f')]=[{'all':!![]}];}_0x582578=_[_0x5ef7('0x3b')]({},_0x582578,_0x7e5485[_0x5ef7('0x3d')]);return db[_0x5ef7('0x2c')][_0x5ef7('0x43')](_0x582578)[_0x5ef7('0x26')](handleEntityNotFound(_0x3df0bc,null))[_0x5ef7('0x26')](respondWithResult(_0x3df0bc,null))[_0x5ef7('0x41')](handleError(_0x3df0bc,null));};exports[_0x5ef7('0x44')]=function(_0x12fc09,_0x13fea8){return db[_0x5ef7('0x2c')]['create'](_0x12fc09[_0x5ef7('0x45')],{})['then'](respondWithResult(_0x13fea8,0xc9))[_0x5ef7('0x41')](handleError(_0x13fea8,null));};exports[_0x5ef7('0x25')]=function(_0x1c79bb,_0x1c1d48){if(_0x1c79bb[_0x5ef7('0x45')]['id']){delete _0x1c79bb[_0x5ef7('0x45')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x1c79bb[_0x5ef7('0x46')]['id']}})[_0x5ef7('0x26')](handleEntityNotFound(_0x1c1d48,null))[_0x5ef7('0x26')](saveUpdates(_0x1c79bb[_0x5ef7('0x45')],null))['then'](respondWithResult(_0x1c1d48,null))['catch'](handleError(_0x1c1d48,null));};exports['destroy']=function(_0x18ca14,_0x1266ba){return db['ZohoAccount'][_0x5ef7('0x43')]({'where':{'id':_0x18ca14[_0x5ef7('0x46')]['id']}})['then'](handleEntityNotFound(_0x1266ba,null))[_0x5ef7('0x26')](removeEntity(_0x1266ba,null))[_0x5ef7('0x41')](handleError(_0x1266ba,null));};exports['getConfigurations']=function(_0x47a50f,_0xb0242f,_0x491a71){var _0x3f87f3={};var _0x22ad7a={};var _0x6e7ee2;var _0xcfa923;return db[_0x5ef7('0x2c')][_0x5ef7('0x47')]({'where':{'id':_0x47a50f[_0x5ef7('0x46')]['id']}})[_0x5ef7('0x26')](handleEntityNotFound(_0xb0242f,null))['then'](function(_0x3e52b9){if(_0x3e52b9){_0x6e7ee2=_0x3e52b9;_0x22ad7a[_0x5ef7('0x34')]=_['keys'](db[_0x5ef7('0x48')][_0x5ef7('0x2d')]);_0x22ad7a[_0x5ef7('0x31')]=_['keys'](_0x47a50f[_0x5ef7('0x31')]);_0x22ad7a[_0x5ef7('0x33')]=_[_0x5ef7('0x42')](_0x22ad7a[_0x5ef7('0x34')],_0x22ad7a[_0x5ef7('0x31')]);_0x3f87f3[_0x5ef7('0x35')]=_['intersection'](_0x22ad7a[_0x5ef7('0x34')],qs[_0x5ef7('0x36')](_0x47a50f[_0x5ef7('0x31')][_0x5ef7('0x36')]));_0x3f87f3[_0x5ef7('0x35')]=_0x3f87f3['attributes']['length']?_0x3f87f3['attributes']:_0x22ad7a[_0x5ef7('0x34')];_0x3f87f3[_0x5ef7('0x49')]=qs['sort'](_0x47a50f[_0x5ef7('0x31')][_0x5ef7('0x39')]);_0x3f87f3[_0x5ef7('0x3a')]=qs[_0x5ef7('0x33')](_[_0x5ef7('0x4a')](_0x47a50f['query'],_0x22ad7a['filters']));if(_0x47a50f['query']['filter']){_0x3f87f3[_0x5ef7('0x3a')]=_[_0x5ef7('0x3b')](_0x3f87f3[_0x5ef7('0x3a')],{'$or':_[_0x5ef7('0x2b')](_0x3f87f3[_0x5ef7('0x35')],function(_0x4bc54d){var _0x4efe5d={};_0x4efe5d[_0x4bc54d]={'$like':'%'+_0x47a50f['query'][_0x5ef7('0x3c')]+'%'};return _0x4efe5d;})});}_0x3f87f3=_['merge']({},_0x3f87f3,_0x47a50f[_0x5ef7('0x3d')]);return _0x6e7ee2['getConfigurations'](_0x3f87f3);}})[_0x5ef7('0x26')](function(_0x22e410){if(_0x22e410){_0xcfa923=_0x22e410[_0x5ef7('0x37')];if(!_0x47a50f[_0x5ef7('0x31')][_0x5ef7('0x38')](_0x5ef7('0x4b'))){_0x3f87f3[_0x5ef7('0x1d')]=qs[_0x5ef7('0x1d')](_0x47a50f[_0x5ef7('0x31')][_0x5ef7('0x1d')]);_0x3f87f3[_0x5ef7('0x20')]=qs[_0x5ef7('0x20')](_0x47a50f['query'][_0x5ef7('0x20')]);}return _0x6e7ee2[_0x5ef7('0x4c')](_0x3f87f3);}})[_0x5ef7('0x26')](function(_0x2e4435){if(_0x2e4435){return _0x2e4435?{'count':_0xcfa923,'rows':_0x2e4435}:null;}})[_0x5ef7('0x26')](respondWithResult(_0xb0242f,null))['catch'](handleError(_0xb0242f,null));};exports[_0x5ef7('0x4d')]=function(_0x1d7301,_0x515048,_0x45b8d3){if(_0x1d7301['body']['id']){delete _0x1d7301[_0x5ef7('0x45')]['id'];}return db[_0x5ef7('0x2c')]['findOne']({'where':{'id':_0x1d7301[_0x5ef7('0x46')]['id']}})[_0x5ef7('0x26')](handleEntityNotFound(_0x515048,null))[_0x5ef7('0x26')](function(_0x334e46){if(_0x334e46){_0x1d7301[_0x5ef7('0x45')][_0x5ef7('0x4e')]=_0x334e46['id'];_0x1d7301['body'][_0x5ef7('0x4f')]=integrations[_0x5ef7('0x50')](_0x1d7301['body']['channel'],_0x1d7301[_0x5ef7('0x45')][_0x5ef7('0x2f')]);_0x1d7301[_0x5ef7('0x45')]['Descriptions']=integrations[_0x5ef7('0x51')](_0x1d7301[_0x5ef7('0x45')]['channel'],_0x1d7301[_0x5ef7('0x45')][_0x5ef7('0x2f')]);return db[_0x5ef7('0x48')][_0x5ef7('0x44')](_0x1d7301[_0x5ef7('0x45')],{'include':[{'model':db[_0x5ef7('0x52')],'as':_0x5ef7('0x4f')},{'model':db[_0x5ef7('0x52')],'as':_0x5ef7('0x53')}]});}return null;})[_0x5ef7('0x26')](respondWithResult(_0x515048,null))[_0x5ef7('0x41')](handleError(_0x515048,null));};function getAccessToken(_0x4d7eb1){return new Promise(function(_0x46d1eb,_0x5aa152){var _0x595647;switch(_0x4d7eb1[_0x5ef7('0x54')]){case'US':_0x595647=_0x5ef7('0x55');break;case'AU':_0x595647='https://accounts.zoho.com.au';break;case'EU':_0x595647=_0x5ef7('0x56');break;case'IN':_0x595647=_0x5ef7('0x57');break;case'CN':_0x595647=_0x5ef7('0x58');break;default:_0x595647=_0x5ef7('0x56');break;}var _0x318da3={'method':_0x5ef7('0x59'),'uri':_0x595647+_0x5ef7('0x5a'),'qs':{'refresh_token':_0x4d7eb1[_0x5ef7('0x5b')],'client_id':_0x4d7eb1['clientId'],'client_secret':_0x4d7eb1['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x318da3)[_0x5ef7('0x26')](function(_0x1f2188){if(_0x1f2188[_0x5ef7('0x5c')]){_0x46d1eb(_0x1f2188['access_token']);}else{_0x5aa152('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x265973){_0x5aa152(_0x265973);});});}exports[_0x5ef7('0x5d')]=function(_0x4e3a19,_0x5d298d,_0x1d7605){var _0x3b169e,_0x1e0921,_0x2a00e7,_0x3e3503,_0x509181;return db[_0x5ef7('0x2c')][_0x5ef7('0x47')]({'where':{'id':_0x4e3a19[_0x5ef7('0x46')]['id']},'attributes':['id',_0x5ef7('0x5e'),_0x5ef7('0x54'),_0x5ef7('0x5f'),_0x5ef7('0x60'),_0x5ef7('0x61'),'code',_0x5ef7('0x5b')]})[_0x5ef7('0x26')](handleEntityNotFound(_0x5d298d,null))[_0x5ef7('0x26')](function(_0x6fd024){_0x509181=_0x6fd024;_0x3b169e=_0x509181[_0x5ef7('0x5e')];_0x1e0921=_0x3b169e===_0x5ef7('0x62')?'eu':_0x5ef7('0x63');_0x2a00e7=_0x509181[_0x5ef7('0x61')];var _0x11d584=_0x2a00e7[_0x5ef7('0x64')](-0x1);if(_0x11d584==='/'||_0x11d584==='\x5c'||_0x11d584===':'){_0x2a00e7=_0x2a00e7[_0x5ef7('0x65')](0x0,_0x2a00e7[_0x5ef7('0x66')](_0x11d584));}if(!_0x509181[_0x5ef7('0x5b')]){throw new Error(_0x5ef7('0x67'));}return getAccessToken(_0x509181);})['then'](function(_0x3227e2){if(_0x3227e2){return rp({'method':_0x5ef7('0x68'),'uri':util[_0x5ef7('0x69')](_0x5ef7('0x6a'),_0x1e0921),'qs':{'module':'Calls'},'headers':{'Authorization':_0x5ef7('0x6b')+_0x3227e2},'json':!![]});}})[_0x5ef7('0x26')](function(_0x7de33d){if(_0x7de33d){if(_0x7de33d[_0x5ef7('0x6c')]&&_0x7de33d[_0x5ef7('0x6c')][_0x5ef7('0x6d')]){throw new Error(_0x7de33d[_0x5ef7('0x6c')][_0x5ef7('0x6d')][_0x5ef7('0x6e')]);}var _0x26bbe4=[];var _0x5320fa=[];var _0x4973fa=[_0x5ef7('0x6f'),_0x5ef7('0x70'),_0x5ef7('0x71'),_0x5ef7('0x72'),_0x5ef7('0x73'),_0x5ef7('0x74'),_0x5ef7('0x75'),'Call_Type'];_0x5320fa=_[_0x5ef7('0x76')](_0x7de33d[_0x5ef7('0x36')],function(_0x190af7){return _0x4973fa[_0x5ef7('0x77')](_0x190af7[_0x5ef7('0x78')]);});for(var _0x34e4b8=0x0;_0x34e4b8<_0x5320fa[_0x5ef7('0x37')];_0x34e4b8++){if(_0x5320fa[_0x34e4b8][_0x5ef7('0x79')]===![]){_0x26bbe4[_0x5ef7('0x7a')]({'id':_0x5320fa[_0x34e4b8]['id'],'name':_0x5320fa[_0x34e4b8][_0x5ef7('0x7b')],'custom':_0x5320fa[_0x34e4b8][_0x5ef7('0x7c')],'options':_0x5320fa[_0x34e4b8][_0x5ef7('0x7d')]==='picklist'&&_0x5320fa[_0x34e4b8][_0x5ef7('0x7e')]['length']>-0x1?_['map'](_0x5320fa[_0x34e4b8]['pick_list_values'],function(_0x466518){return{'name':_0x466518,'value':_0x466518};}):[]});}}return{'count':_0x26bbe4[_0x5ef7('0x37')],'rows':_0x26bbe4};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x5d298d,null))[_0x5ef7('0x41')](function(_0x1b8c0e){var _0x26e063=_0x4e3a19['query'][_0x5ef7('0x7f')]?0x1f4:_0x1b8c0e[_0x5ef7('0x80')]||0x1f4;logger[_0x5ef7('0x6d')](_0x5ef7('0x81'),_0x5ef7('0x5d'),_0x26e063,JSON[_0x5ef7('0x82')](_0x1b8c0e));delete _0x1b8c0e[_0x5ef7('0x29')];if(_0x26e063===0x191){_0x26e063=0x190;}_0x5d298d['status'](_0x26e063)[_0x5ef7('0x83')](_0x4e3a19[_0x5ef7('0x31')][_0x5ef7('0x7f')]?{'message':_0x5ef7('0x84'),'statusCode':_0x1b8c0e['statusCode']}:_0x1b8c0e);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 0b82558..ae96b24 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 _0x0983=['./intZohoAccount.attributes','../../components/integrations/configuration','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','application/x-www-form-urlencoded','parse','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x0983,0x1c7));var _0x3098=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x0983[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x3098('0x0'));var util=require(_0x3098('0x1'));var logger=require(_0x3098('0x2'))(_0x3098('0x3'));var moment=require(_0x3098('0x4'));var BPromise=require('bluebird');var rp=require(_0x3098('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3098('0x6'));var config=require('../../config/environment');var attributes=require(_0x3098('0x7'));var integrations=require(_0x3098('0x8'));module['exports']=function(_0x46ab7f,_0x372acf){return _0x46ab7f[_0x3098('0x9')]('ZohoAccount',attributes,{'tableName':_0x3098('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xd51f91,_0x3f5c43,_0xb2057b){if(_0xd51f91[_0x3098('0xb')](_0x3098('0xc'))||_0xd51f91['changed'](_0x3098('0xd'))||_0xd51f91[_0x3098('0xb')](_0x3098('0xe'))||_0xd51f91['changed'](_0x3098('0xf'))||_0xd51f91[_0x3098('0xb')](_0x3098('0x10'))||_0xd51f91[_0x3098('0xb')](_0x3098('0x11'))){var _0xf32721,_0x446e41;_0xf32721=_0xd51f91[_0x3098('0xd')];var _0x41ae4f=_0xf32721[_0x3098('0x12')](-0x1);if(_0x41ae4f==='/'||_0x41ae4f==='\x5c'||_0x41ae4f===':'){_0xf32721=_0xf32721[_0x3098('0x13')](0x0,_0xf32721['lastIndexOf'](_0x41ae4f));}switch(_0xd51f91[_0x3098('0xc')]){case'US':_0x446e41=_0x3098('0x14');break;case'AU':_0x446e41='https://accounts.zoho.com.au';break;case'IN':_0x446e41='https://accounts.zoho.in';break;case'CN':_0x446e41=_0x3098('0x15');break;default:_0x446e41=_0x3098('0x16');break;}var _0x838f3e={'method':_0x3098('0x17'),'uri':_0x446e41+_0x3098('0x18'),'form':{'grant_type':_0x3098('0x19'),'client_id':_0xd51f91[_0x3098('0xe')],'client_secret':_0xd51f91[_0x3098('0xf')],'redirect_uri':_0xd51f91[_0x3098('0xd')],'code':_0xd51f91[_0x3098('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x838f3e)[_0x3098('0x1a')](function(_0x460221){var _0x36c6cd=JSON['parse'](_0x460221);if(_0x36c6cd[_0x3098('0x1b')]){_0xd51f91[_0x3098('0x1c')]=_0x36c6cd['refresh_token'];logger[_0x3098('0x1d')](util[_0x3098('0x1e')](_0x3098('0x1f'),_0xd51f91[_0x3098('0x20')],_0xd51f91['id']));}else{logger[_0x3098('0x21')](util[_0x3098('0x1e')](_0x3098('0x22'),_0xd51f91[_0x3098('0x20')],_0xd51f91['id']),util['inspect'](_0x36c6cd,{'showHidden':![],'depth':null}));}return _0xb2057b(null,_0x3f5c43);})[_0x3098('0x23')](function(_0x33cd3e){logger['error'](util[_0x3098('0x1e')](_0x3098('0x22'),_0xd51f91[_0x3098('0x20')],_0xd51f91['id']),util[_0x3098('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0xb2057b(_0x33cd3e);});}else{return _0xb2057b(null,_0x3f5c43);}},'beforeUpdate':function(_0x3d808d,_0x103c61,_0x5e54df){if(_0x3d808d[_0x3098('0xb')](_0x3098('0xc'))||_0x3d808d[_0x3098('0xb')]('serverUrl')||_0x3d808d[_0x3098('0xb')]('clientId')||_0x3d808d[_0x3098('0xb')](_0x3098('0xf'))||_0x3d808d[_0x3098('0xb')]('code')||_0x3d808d[_0x3098('0xb')](_0x3098('0x11'))){var _0x5a0a33,_0x207a0a;_0x5a0a33=_0x3d808d[_0x3098('0xd')];var _0x523055=_0x5a0a33[_0x3098('0x12')](-0x1);if(_0x523055==='/'||_0x523055==='\x5c'||_0x523055===':'){_0x5a0a33=_0x5a0a33[_0x3098('0x13')](0x0,_0x5a0a33[_0x3098('0x25')](_0x523055));}switch(_0x3d808d[_0x3098('0xc')]){case'US':_0x207a0a=_0x3098('0x14');break;case'AU':_0x207a0a=_0x3098('0x26');break;case'IN':_0x207a0a=_0x3098('0x27');break;case'CN':_0x207a0a='https://accounts.zoho.com.cn';break;default:_0x207a0a='https://accounts.zoho.eu';break;}var _0x343659={'method':_0x3098('0x17'),'uri':_0x207a0a+_0x3098('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x3d808d['clientId'],'client_secret':_0x3d808d['clientSecret'],'redirect_uri':_0x3d808d['serverUrl'],'code':_0x3d808d[_0x3098('0x10')]},'headers':{'Content-Type':_0x3098('0x28')}};return rp(_0x343659)['then'](function(_0x3f55ff){var _0x1631b0=JSON[_0x3098('0x29')](_0x3f55ff);if(_0x1631b0['refresh_token']){_0x3d808d[_0x3098('0x1c')]=_0x1631b0['refresh_token'];logger[_0x3098('0x1d')](util['format'](_0x3098('0x1f'),_0x3d808d[_0x3098('0x20')],_0x3d808d['id']));}else{logger[_0x3098('0x21')](util['format'](_0x3098('0x22'),_0x3d808d[_0x3098('0x20')],_0x3d808d['id']),util[_0x3098('0x24')](_0x1631b0,{'showHidden':![],'depth':null}));}return _0x5e54df(null,_0x103c61);})['catch'](function(_0x31e8ad){logger[_0x3098('0x21')](util[_0x3098('0x1e')](_0x3098('0x22'),_0x3d808d[_0x3098('0x20')],_0x3d808d['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5e54df(_0x31e8ad);});}else{return _0x5e54df(null,_0x103c61);}}}});}; \ No newline at end of file +var _0x949b=['authorization_code','clientSecret','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','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lastIndexOf','/oauth/v2/token','refreshToken','inspect','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','code','substring','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST'];(function(_0x437161,_0xa60a2e){var _0x28e99a=function(_0x1bd4bd){while(--_0x1bd4bd){_0x437161['push'](_0x437161['shift']());}};_0x28e99a(++_0xa60a2e);}(_0x949b,0x161));var _0xb949=function(_0x57d6c3,_0x5ac8b8){_0x57d6c3=_0x57d6c3-0x0;var _0x4c101c=_0x949b[_0x57d6c3];return _0x4c101c;};'use strict';var _=require(_0xb949('0x0'));var util=require(_0xb949('0x1'));var logger=require(_0xb949('0x2'))(_0xb949('0x3'));var moment=require(_0xb949('0x4'));var BPromise=require(_0xb949('0x5'));var rp=require(_0xb949('0x6'));var fs=require('fs');var path=require(_0xb949('0x7'));var rimraf=require(_0xb949('0x8'));var config=require(_0xb949('0x9'));var attributes=require(_0xb949('0xa'));var integrations=require(_0xb949('0xb'));module[_0xb949('0xc')]=function(_0x501256,_0x13d90b){return _0x501256['define'](_0xb949('0xd'),attributes,{'tableName':_0xb949('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x54dc16,_0x29724d,_0x320e72){if(_0x54dc16['changed']('zone')||_0x54dc16[_0xb949('0xf')](_0xb949('0x10'))||_0x54dc16[_0xb949('0xf')](_0xb949('0x11'))||_0x54dc16[_0xb949('0xf')]('clientSecret')||_0x54dc16[_0xb949('0xf')](_0xb949('0x12'))||_0x54dc16[_0xb949('0xf')]('host')){var _0x4b365e,_0x490e6f;_0x4b365e=_0x54dc16[_0xb949('0x10')];var _0xe3be64=_0x4b365e['slice'](-0x1);if(_0xe3be64==='/'||_0xe3be64==='\x5c'||_0xe3be64===':'){_0x4b365e=_0x4b365e[_0xb949('0x13')](0x0,_0x4b365e['lastIndexOf'](_0xe3be64));}switch(_0x54dc16[_0xb949('0x14')]){case'US':_0x490e6f=_0xb949('0x15');break;case'AU':_0x490e6f=_0xb949('0x16');break;case'IN':_0x490e6f=_0xb949('0x17');break;case'CN':_0x490e6f='https://accounts.zoho.com.cn';break;default:_0x490e6f='https://accounts.zoho.eu';break;}var _0x27722d={'method':_0xb949('0x18'),'uri':_0x490e6f+'/oauth/v2/token','form':{'grant_type':_0xb949('0x19'),'client_id':_0x54dc16[_0xb949('0x11')],'client_secret':_0x54dc16[_0xb949('0x1a')],'redirect_uri':_0x54dc16[_0xb949('0x10')],'code':_0x54dc16['code']},'headers':{'Content-Type':_0xb949('0x1b')}};return rp(_0x27722d)[_0xb949('0x1c')](function(_0x49419f){var _0x50c06f=JSON[_0xb949('0x1d')](_0x49419f);if(_0x50c06f[_0xb949('0x1e')]){_0x54dc16['refreshToken']=_0x50c06f[_0xb949('0x1e')];logger[_0xb949('0x1f')](util[_0xb949('0x20')](_0xb949('0x21'),_0x54dc16[_0xb949('0x22')],_0x54dc16['id']));}else{logger[_0xb949('0x23')](util[_0xb949('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x54dc16[_0xb949('0x22')],_0x54dc16['id']),util['inspect'](_0x50c06f,{'showHidden':![],'depth':null}));}return _0x320e72(null,_0x29724d);})[_0xb949('0x24')](function(_0x450fae){logger[_0xb949('0x23')](util[_0xb949('0x20')](_0xb949('0x25'),_0x54dc16[_0xb949('0x22')],_0x54dc16['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x320e72(_0x450fae);});}else{return _0x320e72(null,_0x29724d);}},'beforeUpdate':function(_0x32cb47,_0x427b56,_0x386258){if(_0x32cb47['changed'](_0xb949('0x14'))||_0x32cb47[_0xb949('0xf')](_0xb949('0x10'))||_0x32cb47[_0xb949('0xf')](_0xb949('0x11'))||_0x32cb47[_0xb949('0xf')](_0xb949('0x1a'))||_0x32cb47['changed'](_0xb949('0x12'))||_0x32cb47['changed']('host')){var _0x34d60c,_0xdf5641;_0x34d60c=_0x32cb47[_0xb949('0x10')];var _0x290f98=_0x34d60c['slice'](-0x1);if(_0x290f98==='/'||_0x290f98==='\x5c'||_0x290f98===':'){_0x34d60c=_0x34d60c['substring'](0x0,_0x34d60c[_0xb949('0x26')](_0x290f98));}switch(_0x32cb47[_0xb949('0x14')]){case'US':_0xdf5641=_0xb949('0x15');break;case'AU':_0xdf5641=_0xb949('0x16');break;case'IN':_0xdf5641='https://accounts.zoho.in';break;case'CN':_0xdf5641='https://accounts.zoho.com.cn';break;default:_0xdf5641='https://accounts.zoho.eu';break;}var _0xf8c8bc={'method':'POST','uri':_0xdf5641+_0xb949('0x27'),'form':{'grant_type':_0xb949('0x19'),'client_id':_0x32cb47[_0xb949('0x11')],'client_secret':_0x32cb47['clientSecret'],'redirect_uri':_0x32cb47[_0xb949('0x10')],'code':_0x32cb47[_0xb949('0x12')]},'headers':{'Content-Type':_0xb949('0x1b')}};return rp(_0xf8c8bc)[_0xb949('0x1c')](function(_0xae5b97){var _0x2ed840=JSON[_0xb949('0x1d')](_0xae5b97);if(_0x2ed840[_0xb949('0x1e')]){_0x32cb47[_0xb949('0x28')]=_0x2ed840[_0xb949('0x1e')];logger[_0xb949('0x1f')](util['format'](_0xb949('0x21'),_0x32cb47[_0xb949('0x22')],_0x32cb47['id']));}else{logger[_0xb949('0x23')](util[_0xb949('0x20')](_0xb949('0x25'),_0x32cb47['name'],_0x32cb47['id']),util[_0xb949('0x29')](_0x2ed840,{'showHidden':![],'depth':null}));}return _0x386258(null,_0x427b56);})[_0xb949('0x24')](function(_0x4f5bc1){logger[_0xb949('0x23')](util[_0xb949('0x20')](_0xb949('0x25'),_0x32cb47[_0xb949('0x22')],_0x32cb47['id']),util[_0xb949('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x386258(_0x4f5bc1);});}else{return _0x386258(null,_0x427b56);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 2b6e08a..4532667 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 _0xe34f=['ShowZohoAccount','stringify','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','error','message','result','ZohoAccount','findAll','options','raw','where','attributes','include','map','model','GetZohoAccount','debug','catch'];(function(_0xb18ea8,_0x56b365){var _0x2e6446=function(_0x9363f9){while(--_0x9363f9){_0xb18ea8['push'](_0xb18ea8['shift']());}};_0x2e6446(++_0x56b365);}(_0xe34f,0xbc));var _0xfe34=function(_0x59c91e,_0x353197){_0x59c91e=_0x59c91e-0x0;var _0x569f00=_0xe34f[_0x59c91e];return _0x569f00;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfe34('0x0'));var fs=require('fs');var Redis=require(_0xfe34('0x1'));var db=require(_0xfe34('0x2'))['db'];var utils=require(_0xfe34('0x3'));var logger=require(_0xfe34('0x4'))(_0xfe34('0x5'));var config=require(_0xfe34('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfe34('0x7')][_0xfe34('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x195bcd,_0x3fe816,_0x25f17a){return new BPromise(function(_0x4fa1cd,_0x5cdc7e){return client[_0xfe34('0x9')](_0x195bcd,_0x25f17a)[_0xfe34('0xa')](function(_0x252ec7){logger[_0xfe34('0xb')](_0xfe34('0xc'),_0x3fe816,_0xfe34('0xd'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3fe816,'request\x20sent',JSON['stringify'](_0x252ec7));if(_0x252ec7[_0xfe34('0xe')]){if(_0x252ec7[_0xfe34('0xe')]['code']===0x1f4){logger[_0xfe34('0xe')](_0xfe34('0xc'),_0x3fe816,_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);return _0x5cdc7e(_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);}logger['error'](_0xfe34('0xc'),_0x3fe816,_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);return _0x4fa1cd(_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);}else{logger['info'](_0xfe34('0xc'),_0x3fe816,_0xfe34('0xd'));_0x4fa1cd(_0x252ec7[_0xfe34('0x10')][_0xfe34('0xf')]);}})['catch'](function(_0x53b469){logger['error'](_0xfe34('0xc'),_0x3fe816,_0x53b469);_0x5cdc7e(_0x53b469);});});}exports['GetZohoAccount']=function(_0x5c95f5){var _0x495b48=this;return new Promise(function(_0x3f7f60,_0x19f7e3){return db[_0xfe34('0x11')][_0xfe34('0x12')]({'raw':_0x5c95f5['options']?_0x5c95f5[_0xfe34('0x13')][_0xfe34('0x14')]===undefined?!![]:![]:!![],'where':_0x5c95f5[_0xfe34('0x13')]?_0x5c95f5[_0xfe34('0x13')][_0xfe34('0x15')]||null:null,'attributes':_0x5c95f5[_0xfe34('0x13')]?_0x5c95f5['options'][_0xfe34('0x16')]||null:null,'limit':_0x5c95f5[_0xfe34('0x13')]?_0x5c95f5[_0xfe34('0x13')]['limit']||null:null,'include':_0x5c95f5[_0xfe34('0x13')]?_0x5c95f5[_0xfe34('0x13')][_0xfe34('0x17')]?_[_0xfe34('0x18')](_0x5c95f5[_0xfe34('0x13')][_0xfe34('0x17')],function(_0x249ffc){return{'model':db[_0x249ffc[_0xfe34('0x19')]],'as':_0x249ffc['as'],'attributes':_0x249ffc[_0xfe34('0x16')],'include':_0x249ffc[_0xfe34('0x17')]?_['map'](_0x249ffc[_0xfe34('0x17')],function(_0x257c3c){return{'model':db[_0x257c3c['model']],'as':_0x257c3c['as'],'attributes':_0x257c3c[_0xfe34('0x16')],'include':_0x257c3c['include']?_['map'](_0x257c3c[_0xfe34('0x17')],function(_0x5221dc){return{'model':db[_0x5221dc['model']],'as':_0x5221dc['as'],'attributes':_0x5221dc[_0xfe34('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfe34('0xa')](function(_0x48a886){logger[_0xfe34('0xb')](_0xfe34('0x1a'),_0x5c95f5);logger[_0xfe34('0x1b')](_0xfe34('0x1a'),_0x5c95f5,JSON['stringify'](_0x48a886));_0x3f7f60(_0x48a886);})[_0xfe34('0x1c')](function(_0x59e06b){logger[_0xfe34('0xe')](_0xfe34('0x1a'),_0x59e06b[_0xfe34('0xf')],_0x5c95f5);_0x19f7e3(_0x495b48[_0xfe34('0xe')](0x1f4,_0x59e06b[_0xfe34('0xf')]));});});};exports[_0xfe34('0x1d')]=function(_0x44adf0){var _0x4b9b50=this;return new Promise(function(_0x345c00,_0x1a3cec){return db[_0xfe34('0x11')]['find']({'raw':_0x44adf0[_0xfe34('0x13')]?_0x44adf0[_0xfe34('0x13')][_0xfe34('0x14')]===undefined?!![]:![]:!![],'where':_0x44adf0[_0xfe34('0x13')]?_0x44adf0['options'][_0xfe34('0x15')]||null:null,'attributes':_0x44adf0[_0xfe34('0x13')]?_0x44adf0['options'][_0xfe34('0x16')]||null:null,'include':_0x44adf0[_0xfe34('0x13')]?_0x44adf0[_0xfe34('0x13')][_0xfe34('0x17')]?_[_0xfe34('0x18')](_0x44adf0['options']['include'],function(_0xa0a65a){return{'model':db[_0xa0a65a['model']],'as':_0xa0a65a['as'],'attributes':_0xa0a65a[_0xfe34('0x16')],'include':_0xa0a65a[_0xfe34('0x17')]?_[_0xfe34('0x18')](_0xa0a65a[_0xfe34('0x17')],function(_0x1c40c9){return{'model':db[_0x1c40c9[_0xfe34('0x19')]],'as':_0x1c40c9['as'],'attributes':_0x1c40c9['attributes'],'include':_0x1c40c9[_0xfe34('0x17')]?_[_0xfe34('0x18')](_0x1c40c9[_0xfe34('0x17')],function(_0x460911){return{'model':db[_0x460911[_0xfe34('0x19')]],'as':_0x460911['as'],'attributes':_0x460911[_0xfe34('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfe34('0xa')](function(_0x3510a0){logger[_0xfe34('0xb')](_0xfe34('0x1d'),_0x44adf0);logger[_0xfe34('0x1b')](_0xfe34('0x1d'),_0x44adf0,JSON[_0xfe34('0x1e')](_0x3510a0));_0x345c00(_0x3510a0);})[_0xfe34('0x1c')](function(_0x1589f9){logger[_0xfe34('0xe')](_0xfe34('0x1d'),_0x1589f9[_0xfe34('0xf')],_0x44adf0);_0x1a3cec(_0x4b9b50[_0xfe34('0xe')](0x1f4,_0x1589f9['message']));});});}; \ No newline at end of file +var _0x5458=['catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowZohoAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1cc4c2,_0x608a36){var _0x1c0b84=function(_0x1272b7){while(--_0x1272b7){_0x1cc4c2['push'](_0x1cc4c2['shift']());}};_0x1c0b84(++_0x608a36);}(_0x5458,0x1c7));var _0x8545=function(_0x5e6cb2,_0x3b0cbd){_0x5e6cb2=_0x5e6cb2-0x0;var _0x499e03=_0x5458[_0x5e6cb2];return _0x499e03;};'use strict';var _=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var moment=require(_0x8545('0x2'));var BPromise=require('bluebird');var rs=require(_0x8545('0x3'));var fs=require('fs');var Redis=require(_0x8545('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8545('0x5'));var logger=require(_0x8545('0x6'))(_0x8545('0x7'));var config=require('../../config/environment');var jayson=require(_0x8545('0x8'));var client=jayson[_0x8545('0x9')][_0x8545('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x359d01,_0x5062c7,_0x291bc9){return new BPromise(function(_0x507ed8,_0x2cc4f4){return client[_0x8545('0xb')](_0x359d01,_0x291bc9)[_0x8545('0xc')](function(_0x10931d){logger[_0x8545('0xd')](_0x8545('0xe'),_0x5062c7,_0x8545('0xf'));logger[_0x8545('0x10')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x5062c7,_0x8545('0xf'),JSON[_0x8545('0x11')](_0x10931d));if(_0x10931d[_0x8545('0x12')]){if(_0x10931d['error'][_0x8545('0x13')]===0x1f4){logger[_0x8545('0x12')](_0x8545('0xe'),_0x5062c7,_0x10931d[_0x8545('0x12')][_0x8545('0x14')]);return _0x2cc4f4(_0x10931d[_0x8545('0x12')][_0x8545('0x14')]);}logger[_0x8545('0x12')](_0x8545('0xe'),_0x5062c7,_0x10931d['error'][_0x8545('0x14')]);return _0x507ed8(_0x10931d[_0x8545('0x12')]['message']);}else{logger[_0x8545('0xd')](_0x8545('0xe'),_0x5062c7,_0x8545('0xf'));_0x507ed8(_0x10931d['result'][_0x8545('0x14')]);}})[_0x8545('0x15')](function(_0x3374f7){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x5062c7,_0x3374f7);_0x2cc4f4(_0x3374f7);});});}exports[_0x8545('0x16')]=function(_0x122a4c){var _0x4e5733=this;return new Promise(function(_0x50e621,_0x564d3f){return db[_0x8545('0x17')][_0x8545('0x18')]({'raw':_0x122a4c[_0x8545('0x19')]?_0x122a4c[_0x8545('0x19')][_0x8545('0x1a')]===undefined?!![]:![]:!![],'where':_0x122a4c[_0x8545('0x19')]?_0x122a4c[_0x8545('0x19')][_0x8545('0x1b')]||null:null,'attributes':_0x122a4c['options']?_0x122a4c[_0x8545('0x19')][_0x8545('0x1c')]||null:null,'limit':_0x122a4c[_0x8545('0x19')]?_0x122a4c[_0x8545('0x19')][_0x8545('0x1d')]||null:null,'include':_0x122a4c[_0x8545('0x19')]?_0x122a4c['options'][_0x8545('0x1e')]?_['map'](_0x122a4c['options'][_0x8545('0x1e')],function(_0x20d2d9){return{'model':db[_0x20d2d9[_0x8545('0x1f')]],'as':_0x20d2d9['as'],'attributes':_0x20d2d9['attributes'],'include':_0x20d2d9[_0x8545('0x1e')]?_[_0x8545('0x20')](_0x20d2d9[_0x8545('0x1e')],function(_0x178ff8){return{'model':db[_0x178ff8['model']],'as':_0x178ff8['as'],'attributes':_0x178ff8[_0x8545('0x1c')],'include':_0x178ff8[_0x8545('0x1e')]?_[_0x8545('0x20')](_0x178ff8[_0x8545('0x1e')],function(_0x4bd30a){return{'model':db[_0x4bd30a['model']],'as':_0x4bd30a['as'],'attributes':_0x4bd30a['attributes']};}):[]};}):[]};}):[]:[]})[_0x8545('0xc')](function(_0x2f244d){logger[_0x8545('0xd')]('GetZohoAccount',_0x122a4c);logger['debug'](_0x8545('0x16'),_0x122a4c,JSON[_0x8545('0x11')](_0x2f244d));_0x50e621(_0x2f244d);})[_0x8545('0x15')](function(_0x2ec6d6){logger[_0x8545('0x12')](_0x8545('0x16'),_0x2ec6d6[_0x8545('0x14')],_0x122a4c);_0x564d3f(_0x4e5733[_0x8545('0x12')](0x1f4,_0x2ec6d6[_0x8545('0x14')]));});});};exports[_0x8545('0x21')]=function(_0x576048){var _0x17e87e=this;return new Promise(function(_0x3b9659,_0x375289){return db['ZohoAccount']['find']({'raw':_0x576048[_0x8545('0x19')]?_0x576048[_0x8545('0x19')][_0x8545('0x1a')]===undefined?!![]:![]:!![],'where':_0x576048[_0x8545('0x19')]?_0x576048[_0x8545('0x19')][_0x8545('0x1b')]||null:null,'attributes':_0x576048[_0x8545('0x19')]?_0x576048[_0x8545('0x19')][_0x8545('0x1c')]||null:null,'include':_0x576048[_0x8545('0x19')]?_0x576048[_0x8545('0x19')][_0x8545('0x1e')]?_[_0x8545('0x20')](_0x576048[_0x8545('0x19')][_0x8545('0x1e')],function(_0x48b305){return{'model':db[_0x48b305[_0x8545('0x1f')]],'as':_0x48b305['as'],'attributes':_0x48b305['attributes'],'include':_0x48b305['include']?_[_0x8545('0x20')](_0x48b305['include'],function(_0x1efdc7){return{'model':db[_0x1efdc7['model']],'as':_0x1efdc7['as'],'attributes':_0x1efdc7[_0x8545('0x1c')],'include':_0x1efdc7[_0x8545('0x1e')]?_['map'](_0x1efdc7[_0x8545('0x1e')],function(_0x47a771){return{'model':db[_0x47a771['model']],'as':_0x47a771['as'],'attributes':_0x47a771[_0x8545('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8545('0xc')](function(_0x1b9ded){logger['info'](_0x8545('0x21'),_0x576048);logger[_0x8545('0x10')](_0x8545('0x21'),_0x576048,JSON['stringify'](_0x1b9ded));_0x3b9659(_0x1b9ded);})[_0x8545('0x15')](function(_0x113b81){logger[_0x8545('0x12')](_0x8545('0x21'),_0x113b81['message'],_0x576048);_0x375289(_0x17e87e[_0x8545('0x12')](0x1f4,_0x113b81[_0x8545('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 769ed0f..6e49cb7 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 _0xa79f=['Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','exports','multer','util','path','express'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xa79f,0x9d));var _0xfa79=function(_0x139d01,_0x562ebf){_0x139d01=_0x139d01-0x0;var _0xdc3f27=_0xa79f[_0x139d01];return _0xdc3f27;};'use strict';var multer=require(_0xfa79('0x0'));var util=require(_0xfa79('0x1'));var path=require(_0xfa79('0x2'));var timeout=require('connect-timeout');var express=require(_0xfa79('0x3'));var router=express[_0xfa79('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfa79('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa79('0x6'));var controller=require(_0xfa79('0x7'));router[_0xfa79('0x8')]('/',auth[_0xfa79('0x9')](),controller[_0xfa79('0xa')]);router[_0xfa79('0x8')](_0xfa79('0xb'),auth[_0xfa79('0x9')](),controller[_0xfa79('0xc')]);router['get']('/:id/fields',auth[_0xfa79('0x9')](),controller[_0xfa79('0xd')]);router[_0xfa79('0x8')](_0xfa79('0xe'),auth[_0xfa79('0x9')](),controller[_0xfa79('0xf')]);router[_0xfa79('0x8')](_0xfa79('0x10'),auth[_0xfa79('0x9')](),controller[_0xfa79('0x11')]);router[_0xfa79('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfa79('0x13')](_0xfa79('0xb'),auth[_0xfa79('0x9')](),controller[_0xfa79('0x14')]);router[_0xfa79('0x15')](_0xfa79('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xfa79('0x16')]=router; \ No newline at end of file +var _0x733d=['express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x733d,0x195));var _0xd733=function(_0x7ca96a,_0x35f270){_0x7ca96a=_0x7ca96a-0x0;var _0x4f8841=_0x733d[_0x7ca96a];return _0x4f8841;};'use strict';var multer=require(_0xd733('0x0'));var util=require(_0xd733('0x1'));var path=require('path');var timeout=require(_0xd733('0x2'));var express=require(_0xd733('0x3'));var router=express['Router']();var fs_extra=require(_0xd733('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd733('0x5'));var config=require(_0xd733('0x6'));var controller=require(_0xd733('0x7'));router[_0xd733('0x8')]('/',auth[_0xd733('0x9')](),controller[_0xd733('0xa')]);router['get'](_0xd733('0xb'),auth[_0xd733('0x9')](),controller[_0xd733('0xc')]);router['get'](_0xd733('0xd'),auth[_0xd733('0x9')](),controller['getFields']);router[_0xd733('0x8')](_0xd733('0xe'),auth[_0xd733('0x9')](),controller['getSubjects']);router[_0xd733('0x8')](_0xd733('0xf'),auth[_0xd733('0x9')](),controller[_0xd733('0x10')]);router[_0xd733('0x11')]('/',auth[_0xd733('0x9')](),controller[_0xd733('0x12')]);router[_0xd733('0x13')](_0xd733('0xb'),auth['isAuthenticated'](),controller[_0xd733('0x14')]);router[_0xd733('0x15')]('/:id',auth[_0xd733('0x9')](),controller[_0xd733('0x16')]);module[_0xd733('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index a1147b0..9a9153d 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 _0xbd3c=['contact','nothing','contact_lead','exports','STRING','ENUM','lead'];(function(_0x29d2d2,_0x3344){var _0x3f6476=function(_0x29c2a2){while(--_0x29c2a2){_0x29d2d2['push'](_0x29d2d2['shift']());}};_0x3f6476(++_0x3344);}(_0xbd3c,0x184));var _0xcbd3=function(_0x22e7a3,_0x2b07ea){_0x22e7a3=_0x22e7a3-0x0;var _0x582a4d=_0xbd3c[_0x22e7a3];return _0x582a4d;};'use strict';var Sequelize=require('sequelize');module[_0xcbd3('0x0')]={'name':{'type':Sequelize[_0xcbd3('0x1')]},'moduleCreate':{'type':Sequelize[_0xcbd3('0x2')](_0xcbd3('0x3'),_0xcbd3('0x4'),_0xcbd3('0x5')),'defaultValue':_0xcbd3('0x3')},'moduleSearch':{'type':Sequelize[_0xcbd3('0x2')](_0xcbd3('0x6'),_0xcbd3('0x4'),_0xcbd3('0x3')),'defaultValue':_0xcbd3('0x6')},'description':{'type':Sequelize[_0xcbd3('0x1')]}}; \ No newline at end of file +var _0xd1c5=['lead','contact','nothing','contact_lead','sequelize','exports','ENUM'];(function(_0xee7bd8,_0x281b38){var _0x295961=function(_0x1f9605){while(--_0x1f9605){_0xee7bd8['push'](_0xee7bd8['shift']());}};_0x295961(++_0x281b38);}(_0xd1c5,0x162));var _0x5d1c=function(_0x1e1a7f,_0x5c292a){_0x1e1a7f=_0x1e1a7f-0x0;var _0x31dd45=_0xd1c5[_0x1e1a7f];return _0x31dd45;};'use strict';var Sequelize=require(_0x5d1c('0x0'));module[_0x5d1c('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x5d1c('0x2')](_0x5d1c('0x3'),_0x5d1c('0x4'),_0x5d1c('0x5')),'defaultValue':_0x5d1c('0x3')},'moduleSearch':{'type':Sequelize[_0x5d1c('0x2')](_0x5d1c('0x6'),_0x5d1c('0x4'),_0x5d1c('0x3')),'defaultValue':_0x5d1c('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 8b22533..16305a7 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 _0x13b9=['to-csv','querystring','../../config/license/hardware','api','../../config/environment','status','end','json','offset','undefined','limit','count','apply','reject','update','then','sendStatus','error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','merge','map','VIRTUAL','filter','options','include','findAll','rows','catch','params','find','create','body','destroy','getFields','ZohoField','length','order','pick','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x158cb6,_0x2ddfbe){var _0x3276c1=function(_0x2088af){while(--_0x2088af){_0x158cb6['push'](_0x158cb6['shift']());}};_0x3276c1(++_0x2ddfbe);}(_0x13b9,0x114));var _0x913b=function(_0x4fd264,_0x3896b2){_0x4fd264=_0x4fd264-0x0;var _0x218d87=_0x13b9[_0x4fd264];return _0x218d87;};'use strict';var emlformat=require(_0x913b('0x0'));var rimraf=require(_0x913b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x913b('0x2'));var rp=require('request-promise');var moment=require(_0x913b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x913b('0x4'));var util=require(_0x913b('0x5'));var path=require('path');var sox=require(_0x913b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x913b('0x7'));var _=require('lodash');var squel=require(_0x913b('0x8'));var crypto=require(_0x913b('0x9'));var jsforce=require(_0x913b('0xa'));var deskjs=require(_0x913b('0xb'));var toCsv=require(_0x913b('0xc'));var querystring=require(_0x913b('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x913b('0xe'));var logger=require('../../config/logger')(_0x913b('0xf'));var utils=require('../../config/utils');var config=require(_0x913b('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ede9d,_0x16fa68){_0x16fa68=_0x16fa68||0xcc;return function(_0x3119ba){if(_0x3119ba){return _0x1ede9d['sendStatus'](_0x16fa68);}return _0x1ede9d[_0x913b('0x11')](_0x16fa68)[_0x913b('0x12')]();};}function respondWithResult(_0x9612e4,_0x34ff59){_0x34ff59=_0x34ff59||0xc8;return function(_0x5aee83){if(_0x5aee83){return _0x9612e4['status'](_0x34ff59)[_0x913b('0x13')](_0x5aee83);}};}function respondWithFilteredResult(_0x30e94f,_0xa7bdc5){return function(_0x880d2b){if(_0x880d2b){var _0x385fdd=typeof _0xa7bdc5[_0x913b('0x14')]===_0x913b('0x15')&&typeof _0xa7bdc5[_0x913b('0x16')]===_0x913b('0x15');var _0x2aebca=_0x880d2b[_0x913b('0x17')];var _0x399057=_0x385fdd?0x0:_0xa7bdc5[_0x913b('0x14')];var _0x20bf45=_0x385fdd?_0x880d2b[_0x913b('0x17')]:_0xa7bdc5[_0x913b('0x14')]+_0xa7bdc5[_0x913b('0x16')];var _0x23ea24;if(_0x20bf45>=_0x2aebca){_0x20bf45=_0x2aebca;_0x23ea24=0xc8;}else{_0x23ea24=0xce;}_0x30e94f[_0x913b('0x11')](_0x23ea24);return _0x30e94f['set']('Content-Range',_0x399057+'-'+_0x20bf45+'/'+_0x2aebca)[_0x913b('0x13')](_0x880d2b);}return null;};}function patchUpdates(_0x4f365b){return function(_0x1f305a){try{jsonpatch[_0x913b('0x18')](_0x1f305a,_0x4f365b,!![]);}catch(_0x16b274){return BPromise[_0x913b('0x19')](_0x16b274);}return _0x1f305a['save']();};}function saveUpdates(_0x142ea4,_0x1b5859){return function(_0x12a788){if(_0x12a788){return _0x12a788[_0x913b('0x1a')](_0x142ea4)[_0x913b('0x1b')](function(_0x911351){return _0x911351;});}return null;};}function removeEntity(_0x2e3343,_0xeb3bee){return function(_0x1934d7){if(_0x1934d7){return _0x1934d7['destroy']()[_0x913b('0x1b')](function(){_0x2e3343['status'](0xcc)[_0x913b('0x12')]();});}};}function handleEntityNotFound(_0x386b60,_0x5224a4){return function(_0x4de07c){if(!_0x4de07c){_0x386b60[_0x913b('0x1c')](0x194);}return _0x4de07c;};}function handleError(_0x417940,_0xd6e947){_0xd6e947=_0xd6e947||0x1f4;return function(_0x2d86a7){logger[_0x913b('0x1d')](_0x2d86a7[_0x913b('0x1e')]);if(_0x2d86a7['name']){delete _0x2d86a7[_0x913b('0x1f')];}_0x417940['status'](_0xd6e947)[_0x913b('0x20')](_0x2d86a7);};}exports[_0x913b('0x21')]=function(_0x5ac263,_0x378904){var _0x49d156={},_0x2abc60={},_0x3b9936={'count':0x0,'rows':[]};var _0x37531a=_['map'](db[_0x913b('0x22')][_0x913b('0x23')],function(_0x20ba09){return{'name':_0x20ba09[_0x913b('0x24')],'type':_0x20ba09[_0x913b('0x25')][_0x913b('0x26')]};});_0x2abc60[_0x913b('0x27')]=_['map'](_0x37531a,_0x913b('0x1f'));_0x2abc60[_0x913b('0x28')]=_[_0x913b('0x29')](_0x5ac263[_0x913b('0x28')]);_0x2abc60['filters']=_[_0x913b('0x2a')](_0x2abc60[_0x913b('0x27')],_0x2abc60[_0x913b('0x28')]);_0x49d156[_0x913b('0x2b')]=_['intersection'](_0x2abc60[_0x913b('0x27')],qs[_0x913b('0x2c')](_0x5ac263[_0x913b('0x28')][_0x913b('0x2c')]));_0x49d156[_0x913b('0x2b')]=_0x49d156[_0x913b('0x2b')]['length']?_0x49d156[_0x913b('0x2b')]:_0x2abc60[_0x913b('0x27')];if(!_0x5ac263[_0x913b('0x28')][_0x913b('0x2d')](_0x913b('0x2e'))){_0x49d156['limit']=qs[_0x913b('0x16')](_0x5ac263[_0x913b('0x28')][_0x913b('0x16')]);_0x49d156['offset']=qs[_0x913b('0x14')](_0x5ac263[_0x913b('0x28')]['offset']);}_0x49d156['order']=qs[_0x913b('0x2f')](_0x5ac263['query'][_0x913b('0x2f')]);_0x49d156[_0x913b('0x30')]=qs[_0x913b('0x31')](_['pick'](_0x5ac263[_0x913b('0x28')],_0x2abc60[_0x913b('0x31')]),_0x37531a);if(_0x5ac263[_0x913b('0x28')]['filter']){_0x49d156['where']=_[_0x913b('0x32')](_0x49d156[_0x913b('0x30')],{'$or':_[_0x913b('0x33')](_0x37531a,function(_0x18a4b3){if(_0x18a4b3['type']!==_0x913b('0x34')){var _0x323650={};_0x323650[_0x18a4b3['name']]={'$like':'%'+_0x5ac263[_0x913b('0x28')][_0x913b('0x35')]+'%'};return _0x323650;}})});}_0x49d156=_[_0x913b('0x32')]({},_0x49d156,_0x5ac263[_0x913b('0x36')]);var _0x103b65={'where':_0x49d156['where']};return db['ZohoConfiguration'][_0x913b('0x17')](_0x103b65)[_0x913b('0x1b')](function(_0x302ed4){_0x3b9936[_0x913b('0x17')]=_0x302ed4;if(_0x5ac263[_0x913b('0x28')]['includeAll']){_0x49d156[_0x913b('0x37')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x913b('0x38')](_0x49d156);})[_0x913b('0x1b')](function(_0x86df15){_0x3b9936[_0x913b('0x39')]=_0x86df15;return _0x3b9936;})['then'](respondWithFilteredResult(_0x378904,_0x49d156))[_0x913b('0x3a')](handleError(_0x378904,null));};exports['show']=function(_0x2ba054,_0x45bec4){var _0x5759b6={'raw':![],'where':{'id':_0x2ba054[_0x913b('0x3b')]['id']}},_0x1af938={};_0x1af938[_0x913b('0x27')]=_[_0x913b('0x29')](db[_0x913b('0x22')]['rawAttributes']);_0x1af938['query']=_[_0x913b('0x29')](_0x2ba054[_0x913b('0x28')]);_0x1af938[_0x913b('0x31')]=_[_0x913b('0x2a')](_0x1af938['model'],_0x1af938[_0x913b('0x28')]);_0x5759b6[_0x913b('0x2b')]=_[_0x913b('0x2a')](_0x1af938[_0x913b('0x27')],qs[_0x913b('0x2c')](_0x2ba054['query'][_0x913b('0x2c')]));_0x5759b6[_0x913b('0x2b')]=_0x5759b6[_0x913b('0x2b')]['length']?_0x5759b6[_0x913b('0x2b')]:_0x1af938[_0x913b('0x27')];if(_0x2ba054[_0x913b('0x28')]['includeAll']){_0x5759b6[_0x913b('0x37')]=[{'all':!![]}];}_0x5759b6=_[_0x913b('0x32')]({},_0x5759b6,_0x2ba054[_0x913b('0x36')]);return db[_0x913b('0x22')][_0x913b('0x3c')](_0x5759b6)[_0x913b('0x1b')](handleEntityNotFound(_0x45bec4,null))[_0x913b('0x1b')](respondWithResult(_0x45bec4,null))[_0x913b('0x3a')](handleError(_0x45bec4,null));};exports['create']=function(_0x1f8aa5,_0x1dc91c){return db[_0x913b('0x22')][_0x913b('0x3d')](_0x1f8aa5[_0x913b('0x3e')],{})['then'](respondWithResult(_0x1dc91c,0xc9))['catch'](handleError(_0x1dc91c,null));};exports[_0x913b('0x1a')]=function(_0x217341,_0x1791bc){if(_0x217341[_0x913b('0x3e')]['id']){delete _0x217341[_0x913b('0x3e')]['id'];}return db[_0x913b('0x22')][_0x913b('0x3c')]({'where':{'id':_0x217341[_0x913b('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1791bc,null))[_0x913b('0x1b')](saveUpdates(_0x217341[_0x913b('0x3e')],null))[_0x913b('0x1b')](respondWithResult(_0x1791bc,null))['catch'](handleError(_0x1791bc,null));};exports[_0x913b('0x3f')]=function(_0x41a360,_0x13cca5){return db[_0x913b('0x22')][_0x913b('0x3c')]({'where':{'id':_0x41a360[_0x913b('0x3b')]['id']}})[_0x913b('0x1b')](handleEntityNotFound(_0x13cca5,null))[_0x913b('0x1b')](removeEntity(_0x13cca5,null))[_0x913b('0x3a')](handleError(_0x13cca5,null));};exports[_0x913b('0x40')]=function(_0x186511,_0x5088a3,_0x241074){var _0xf9e6d6={};var _0x13a02d={};var _0x572b15;var _0x686afa;return db[_0x913b('0x22')]['findOne']({'where':{'id':_0x186511[_0x913b('0x3b')]['id']}})[_0x913b('0x1b')](handleEntityNotFound(_0x5088a3,null))[_0x913b('0x1b')](function(_0x50ef61){if(_0x50ef61){_0x572b15=_0x50ef61;_0x13a02d['model']=_[_0x913b('0x29')](db[_0x913b('0x41')][_0x913b('0x23')]);_0x13a02d[_0x913b('0x28')]=_[_0x913b('0x29')](_0x186511[_0x913b('0x28')]);_0x13a02d[_0x913b('0x31')]=_[_0x913b('0x2a')](_0x13a02d[_0x913b('0x27')],_0x13a02d[_0x913b('0x28')]);_0xf9e6d6[_0x913b('0x2b')]=_[_0x913b('0x2a')](_0x13a02d['model'],qs['fields'](_0x186511[_0x913b('0x28')][_0x913b('0x2c')]));_0xf9e6d6[_0x913b('0x2b')]=_0xf9e6d6[_0x913b('0x2b')][_0x913b('0x42')]?_0xf9e6d6[_0x913b('0x2b')]:_0x13a02d[_0x913b('0x27')];_0xf9e6d6[_0x913b('0x43')]=qs[_0x913b('0x2f')](_0x186511[_0x913b('0x28')][_0x913b('0x2f')]);_0xf9e6d6[_0x913b('0x30')]=qs[_0x913b('0x31')](_[_0x913b('0x44')](_0x186511[_0x913b('0x28')],_0x13a02d['filters']));if(_0x186511[_0x913b('0x28')][_0x913b('0x35')]){_0xf9e6d6[_0x913b('0x30')]=_[_0x913b('0x32')](_0xf9e6d6[_0x913b('0x30')],{'$or':_['map'](_0xf9e6d6[_0x913b('0x2b')],function(_0x42fc91){var _0x1df087={};_0x1df087[_0x42fc91]={'$like':'%'+_0x186511[_0x913b('0x28')][_0x913b('0x35')]+'%'};return _0x1df087;})});}_0xf9e6d6=_[_0x913b('0x32')]({},_0xf9e6d6,_0x186511[_0x913b('0x36')]);return _0x572b15[_0x913b('0x40')](_0xf9e6d6);}})[_0x913b('0x1b')](function(_0x3044c6){if(_0x3044c6){_0x686afa=_0x3044c6[_0x913b('0x42')];if(!_0x186511[_0x913b('0x28')][_0x913b('0x2d')](_0x913b('0x2e'))){_0xf9e6d6[_0x913b('0x16')]=qs['limit'](_0x186511[_0x913b('0x28')][_0x913b('0x16')]);_0xf9e6d6[_0x913b('0x14')]=qs[_0x913b('0x14')](_0x186511[_0x913b('0x28')]['offset']);}return _0x572b15['getFields'](_0xf9e6d6);}})[_0x913b('0x1b')](function(_0xedc17b){if(_0xedc17b){return _0xedc17b?{'count':_0x686afa,'rows':_0xedc17b}:null;}})['then'](respondWithResult(_0x5088a3,null))[_0x913b('0x3a')](handleError(_0x5088a3,null));};exports[_0x913b('0x45')]=function(_0x493cd2,_0x171b09,_0x13695f){var _0x58bcc3={};var _0xdedbf4={};var _0x39c6fe;var _0x349f2;return db[_0x913b('0x22')][_0x913b('0x46')]({'where':{'id':_0x493cd2[_0x913b('0x3b')]['id']}})[_0x913b('0x1b')](handleEntityNotFound(_0x171b09,null))['then'](function(_0x4ec1bc){if(_0x4ec1bc){_0x39c6fe=_0x4ec1bc;_0xdedbf4[_0x913b('0x27')]=_[_0x913b('0x29')](db[_0x913b('0x41')][_0x913b('0x23')]);_0xdedbf4[_0x913b('0x28')]=_['keys'](_0x493cd2[_0x913b('0x28')]);_0xdedbf4[_0x913b('0x31')]=_[_0x913b('0x2a')](_0xdedbf4['model'],_0xdedbf4[_0x913b('0x28')]);_0x58bcc3['attributes']=_['intersection'](_0xdedbf4[_0x913b('0x27')],qs['fields'](_0x493cd2[_0x913b('0x28')][_0x913b('0x2c')]));_0x58bcc3[_0x913b('0x2b')]=_0x58bcc3[_0x913b('0x2b')]['length']?_0x58bcc3[_0x913b('0x2b')]:_0xdedbf4[_0x913b('0x27')];_0x58bcc3[_0x913b('0x43')]=qs[_0x913b('0x2f')](_0x493cd2[_0x913b('0x28')][_0x913b('0x2f')]);_0x58bcc3[_0x913b('0x30')]=qs['filters'](_[_0x913b('0x44')](_0x493cd2['query'],_0xdedbf4['filters']));if(_0x493cd2[_0x913b('0x28')][_0x913b('0x35')]){_0x58bcc3[_0x913b('0x30')]=_[_0x913b('0x32')](_0x58bcc3[_0x913b('0x30')],{'$or':_[_0x913b('0x33')](_0x58bcc3[_0x913b('0x2b')],function(_0x12054b){var _0x487bd3={};_0x487bd3[_0x12054b]={'$like':'%'+_0x493cd2[_0x913b('0x28')][_0x913b('0x35')]+'%'};return _0x487bd3;})});}_0x58bcc3=_[_0x913b('0x32')]({},_0x58bcc3,_0x493cd2[_0x913b('0x36')]);return _0x39c6fe[_0x913b('0x45')](_0x58bcc3);}})[_0x913b('0x1b')](function(_0x5ccf16){if(_0x5ccf16){_0x349f2=_0x5ccf16['length'];if(!_0x493cd2['query'][_0x913b('0x2d')](_0x913b('0x2e'))){_0x58bcc3[_0x913b('0x16')]=qs[_0x913b('0x16')](_0x493cd2[_0x913b('0x28')][_0x913b('0x16')]);_0x58bcc3[_0x913b('0x14')]=qs[_0x913b('0x14')](_0x493cd2[_0x913b('0x28')][_0x913b('0x14')]);}return _0x39c6fe[_0x913b('0x45')](_0x58bcc3);}})['then'](function(_0x562aad){if(_0x562aad){return _0x562aad?{'count':_0x349f2,'rows':_0x562aad}:null;}})[_0x913b('0x1b')](respondWithResult(_0x171b09,null))[_0x913b('0x3a')](handleError(_0x171b09,null));};exports[_0x913b('0x47')]=function(_0x291667,_0x581b79,_0x3f67f6){var _0x4b3906={};var _0x94ce74={};var _0x46644e;var _0x12ce22;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x291667[_0x913b('0x3b')]['id']}})[_0x913b('0x1b')](handleEntityNotFound(_0x581b79,null))[_0x913b('0x1b')](function(_0x58b06c){if(_0x58b06c){_0x46644e=_0x58b06c;_0x94ce74['model']=_[_0x913b('0x29')](db[_0x913b('0x41')][_0x913b('0x23')]);_0x94ce74[_0x913b('0x28')]=_[_0x913b('0x29')](_0x291667[_0x913b('0x28')]);_0x94ce74[_0x913b('0x31')]=_[_0x913b('0x2a')](_0x94ce74[_0x913b('0x27')],_0x94ce74[_0x913b('0x28')]);_0x4b3906[_0x913b('0x2b')]=_[_0x913b('0x2a')](_0x94ce74['model'],qs[_0x913b('0x2c')](_0x291667[_0x913b('0x28')][_0x913b('0x2c')]));_0x4b3906[_0x913b('0x2b')]=_0x4b3906['attributes'][_0x913b('0x42')]?_0x4b3906[_0x913b('0x2b')]:_0x94ce74[_0x913b('0x27')];_0x4b3906[_0x913b('0x43')]=qs[_0x913b('0x2f')](_0x291667[_0x913b('0x28')][_0x913b('0x2f')]);_0x4b3906[_0x913b('0x30')]=qs[_0x913b('0x31')](_['pick'](_0x291667['query'],_0x94ce74[_0x913b('0x31')]));if(_0x291667[_0x913b('0x28')]['filter']){_0x4b3906[_0x913b('0x30')]=_['merge'](_0x4b3906[_0x913b('0x30')],{'$or':_[_0x913b('0x33')](_0x4b3906[_0x913b('0x2b')],function(_0x1bf769){var _0x3b57f0={};_0x3b57f0[_0x1bf769]={'$like':'%'+_0x291667['query'][_0x913b('0x35')]+'%'};return _0x3b57f0;})});}_0x4b3906=_[_0x913b('0x32')]({},_0x4b3906,_0x291667['options']);return _0x46644e[_0x913b('0x47')](_0x4b3906);}})[_0x913b('0x1b')](function(_0x14b529){if(_0x14b529){_0x12ce22=_0x14b529['length'];if(!_0x291667[_0x913b('0x28')][_0x913b('0x2d')](_0x913b('0x2e'))){_0x4b3906[_0x913b('0x16')]=qs['limit'](_0x291667[_0x913b('0x28')][_0x913b('0x16')]);_0x4b3906[_0x913b('0x14')]=qs['offset'](_0x291667[_0x913b('0x28')][_0x913b('0x14')]);}return _0x46644e[_0x913b('0x47')](_0x4b3906);}})['then'](function(_0xa7e9ed){if(_0xa7e9ed){return _0xa7e9ed?{'count':_0x12ce22,'rows':_0xa7e9ed}:null;}})[_0x913b('0x1b')](respondWithResult(_0x581b79,null))[_0x913b('0x3a')](handleError(_0x581b79,null));}; \ No newline at end of file +var _0xc2a4=['json','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','name','index','map','ZohoConfiguration','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','keys','rawAttributes','includeAll','find','catch','create','body','params','findOne','ZohoField','order','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end'];(function(_0x48ced6,_0x3871b8){var _0x8171f5=function(_0x355d8f){while(--_0x355d8f){_0x48ced6['push'](_0x48ced6['shift']());}};_0x8171f5(++_0x3871b8);}(_0xc2a4,0x7e));var _0x4c2a=function(_0xd3917d,_0x732781){_0xd3917d=_0xd3917d-0x0;var _0x35aa9d=_0xc2a4[_0xd3917d];return _0x35aa9d;};'use strict';var emlformat=require(_0x4c2a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c2a('0x1'));var jsonpatch=require(_0x4c2a('0x2'));var rp=require(_0x4c2a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4c2a('0x4'));var util=require(_0x4c2a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x4c2a('0x6'));var ejs=require(_0x4c2a('0x7'));var fs=require('fs');var fs_extra=require(_0x4c2a('0x8'));var _=require('lodash');var squel=require(_0x4c2a('0x9'));var crypto=require(_0x4c2a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4c2a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4c2a('0xc'));var Papa=require(_0x4c2a('0xd'));var Redis=require('ioredis');var authService=require(_0x4c2a('0xe'));var qs=require(_0x4c2a('0xf'));var as=require(_0x4c2a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c2a('0x11'))(_0x4c2a('0x12'));var utils=require(_0x4c2a('0x13'));var config=require(_0x4c2a('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cd581,_0x4e24dd){_0x4e24dd=_0x4e24dd||0xcc;return function(_0x13720a){if(_0x13720a){return _0x5cd581[_0x4c2a('0x15')](_0x4e24dd);}return _0x5cd581[_0x4c2a('0x16')](_0x4e24dd)[_0x4c2a('0x17')]();};}function respondWithResult(_0x8bac63,_0x10937c){_0x10937c=_0x10937c||0xc8;return function(_0x39d47f){if(_0x39d47f){return _0x8bac63[_0x4c2a('0x16')](_0x10937c)[_0x4c2a('0x18')](_0x39d47f);}};}function respondWithFilteredResult(_0x562871,_0x5e1188){return function(_0x29ebba){if(_0x29ebba){var _0x2e1281=typeof _0x5e1188['offset']===_0x4c2a('0x19')&&typeof _0x5e1188[_0x4c2a('0x1a')]===_0x4c2a('0x19');var _0x4fb3d4=_0x29ebba[_0x4c2a('0x1b')];var _0xc18ab4=_0x2e1281?0x0:_0x5e1188['offset'];var _0x1e7f09=_0x2e1281?_0x29ebba['count']:_0x5e1188['offset']+_0x5e1188[_0x4c2a('0x1a')];var _0x107bb7;if(_0x1e7f09>=_0x4fb3d4){_0x1e7f09=_0x4fb3d4;_0x107bb7=0xc8;}else{_0x107bb7=0xce;}_0x562871[_0x4c2a('0x16')](_0x107bb7);return _0x562871[_0x4c2a('0x1c')](_0x4c2a('0x1d'),_0xc18ab4+'-'+_0x1e7f09+'/'+_0x4fb3d4)[_0x4c2a('0x18')](_0x29ebba);}return null;};}function patchUpdates(_0x174e1b){return function(_0x4d13b7){try{jsonpatch[_0x4c2a('0x1e')](_0x4d13b7,_0x174e1b,!![]);}catch(_0x1ab135){return BPromise['reject'](_0x1ab135);}return _0x4d13b7[_0x4c2a('0x1f')]();};}function saveUpdates(_0x18ca9c,_0x2d058a){return function(_0x45c590){if(_0x45c590){return _0x45c590[_0x4c2a('0x20')](_0x18ca9c)[_0x4c2a('0x21')](function(_0x4eedc0){return _0x4eedc0;});}return null;};}function removeEntity(_0x3a6257,_0x975b83){return function(_0x23c602){if(_0x23c602){return _0x23c602[_0x4c2a('0x22')]()[_0x4c2a('0x21')](function(){_0x3a6257[_0x4c2a('0x16')](0xcc)[_0x4c2a('0x17')]();});}};}function handleEntityNotFound(_0x1bdb8,_0x32b2c9){return function(_0x1c1460){if(!_0x1c1460){_0x1bdb8[_0x4c2a('0x15')](0x194);}return _0x1c1460;};}function handleError(_0x126af5,_0x4f680e){_0x4f680e=_0x4f680e||0x1f4;return function(_0xa1526){logger['error'](_0xa1526['stack']);if(_0xa1526[_0x4c2a('0x23')]){delete _0xa1526[_0x4c2a('0x23')];}_0x126af5[_0x4c2a('0x16')](_0x4f680e)['send'](_0xa1526);};}exports[_0x4c2a('0x24')]=function(_0x260942,_0x2311e5){var _0x5ce2e8={},_0x22959e={},_0x9a5f08={'count':0x0,'rows':[]};var _0x38da67=_[_0x4c2a('0x25')](db[_0x4c2a('0x26')]['rawAttributes'],function(_0x353a78){return{'name':_0x353a78[_0x4c2a('0x27')],'type':_0x353a78[_0x4c2a('0x28')]['key']};});_0x22959e['model']=_['map'](_0x38da67,_0x4c2a('0x23'));_0x22959e[_0x4c2a('0x29')]=_['keys'](_0x260942[_0x4c2a('0x29')]);_0x22959e['filters']=_[_0x4c2a('0x2a')](_0x22959e[_0x4c2a('0x2b')],_0x22959e[_0x4c2a('0x29')]);_0x5ce2e8[_0x4c2a('0x2c')]=_[_0x4c2a('0x2a')](_0x22959e['model'],qs[_0x4c2a('0x2d')](_0x260942['query'][_0x4c2a('0x2d')]));_0x5ce2e8[_0x4c2a('0x2c')]=_0x5ce2e8[_0x4c2a('0x2c')][_0x4c2a('0x2e')]?_0x5ce2e8[_0x4c2a('0x2c')]:_0x22959e[_0x4c2a('0x2b')];if(!_0x260942['query'][_0x4c2a('0x2f')](_0x4c2a('0x30'))){_0x5ce2e8[_0x4c2a('0x1a')]=qs[_0x4c2a('0x1a')](_0x260942[_0x4c2a('0x29')][_0x4c2a('0x1a')]);_0x5ce2e8[_0x4c2a('0x31')]=qs[_0x4c2a('0x31')](_0x260942['query'][_0x4c2a('0x31')]);}_0x5ce2e8['order']=qs[_0x4c2a('0x32')](_0x260942[_0x4c2a('0x29')]['sort']);_0x5ce2e8[_0x4c2a('0x33')]=qs[_0x4c2a('0x34')](_[_0x4c2a('0x35')](_0x260942[_0x4c2a('0x29')],_0x22959e[_0x4c2a('0x34')]),_0x38da67);if(_0x260942['query'][_0x4c2a('0x36')]){_0x5ce2e8[_0x4c2a('0x33')]=_[_0x4c2a('0x37')](_0x5ce2e8['where'],{'$or':_[_0x4c2a('0x25')](_0x38da67,function(_0xd4a5e7){if(_0xd4a5e7[_0x4c2a('0x28')]!==_0x4c2a('0x38')){var _0x125a54={};_0x125a54[_0xd4a5e7[_0x4c2a('0x23')]]={'$like':'%'+_0x260942[_0x4c2a('0x29')]['filter']+'%'};return _0x125a54;}})});}_0x5ce2e8=_[_0x4c2a('0x37')]({},_0x5ce2e8,_0x260942[_0x4c2a('0x39')]);var _0x20522e={'where':_0x5ce2e8['where']};return db['ZohoConfiguration']['count'](_0x20522e)[_0x4c2a('0x21')](function(_0x5252ac){_0x9a5f08[_0x4c2a('0x1b')]=_0x5252ac;if(_0x260942[_0x4c2a('0x29')]['includeAll']){_0x5ce2e8[_0x4c2a('0x3a')]=[{'all':!![]}];}return db[_0x4c2a('0x26')][_0x4c2a('0x3b')](_0x5ce2e8);})['then'](function(_0x2cba1b){_0x9a5f08[_0x4c2a('0x3c')]=_0x2cba1b;return _0x9a5f08;})[_0x4c2a('0x21')](respondWithFilteredResult(_0x2311e5,_0x5ce2e8))['catch'](handleError(_0x2311e5,null));};exports[_0x4c2a('0x3d')]=function(_0xff2532,_0x2cdd3c){var _0x112703={'raw':![],'where':{'id':_0xff2532['params']['id']}},_0xcf5e9d={};_0xcf5e9d[_0x4c2a('0x2b')]=_[_0x4c2a('0x3e')](db[_0x4c2a('0x26')][_0x4c2a('0x3f')]);_0xcf5e9d[_0x4c2a('0x29')]=_[_0x4c2a('0x3e')](_0xff2532[_0x4c2a('0x29')]);_0xcf5e9d['filters']=_['intersection'](_0xcf5e9d[_0x4c2a('0x2b')],_0xcf5e9d[_0x4c2a('0x29')]);_0x112703['attributes']=_['intersection'](_0xcf5e9d[_0x4c2a('0x2b')],qs[_0x4c2a('0x2d')](_0xff2532[_0x4c2a('0x29')]['fields']));_0x112703[_0x4c2a('0x2c')]=_0x112703[_0x4c2a('0x2c')]['length']?_0x112703[_0x4c2a('0x2c')]:_0xcf5e9d[_0x4c2a('0x2b')];if(_0xff2532['query'][_0x4c2a('0x40')]){_0x112703[_0x4c2a('0x3a')]=[{'all':!![]}];}_0x112703=_[_0x4c2a('0x37')]({},_0x112703,_0xff2532['options']);return db[_0x4c2a('0x26')][_0x4c2a('0x41')](_0x112703)[_0x4c2a('0x21')](handleEntityNotFound(_0x2cdd3c,null))[_0x4c2a('0x21')](respondWithResult(_0x2cdd3c,null))[_0x4c2a('0x42')](handleError(_0x2cdd3c,null));};exports[_0x4c2a('0x43')]=function(_0x27e66e,_0x4ee1c5){return db['ZohoConfiguration']['create'](_0x27e66e[_0x4c2a('0x44')],{})[_0x4c2a('0x21')](respondWithResult(_0x4ee1c5,0xc9))['catch'](handleError(_0x4ee1c5,null));};exports[_0x4c2a('0x20')]=function(_0x539f82,_0x2d9a09){if(_0x539f82['body']['id']){delete _0x539f82[_0x4c2a('0x44')]['id'];}return db[_0x4c2a('0x26')][_0x4c2a('0x41')]({'where':{'id':_0x539f82[_0x4c2a('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d9a09,null))[_0x4c2a('0x21')](saveUpdates(_0x539f82['body'],null))['then'](respondWithResult(_0x2d9a09,null))[_0x4c2a('0x42')](handleError(_0x2d9a09,null));};exports[_0x4c2a('0x22')]=function(_0x3ad9e5,_0x2604ab){return db[_0x4c2a('0x26')][_0x4c2a('0x41')]({'where':{'id':_0x3ad9e5['params']['id']}})[_0x4c2a('0x21')](handleEntityNotFound(_0x2604ab,null))[_0x4c2a('0x21')](removeEntity(_0x2604ab,null))[_0x4c2a('0x42')](handleError(_0x2604ab,null));};exports['getFields']=function(_0x20f2f0,_0x510b3d,_0x127801){var _0x4cec00={};var _0x39735d={};var _0x1428e5;var _0xfe5a10;return db['ZohoConfiguration'][_0x4c2a('0x46')]({'where':{'id':_0x20f2f0[_0x4c2a('0x45')]['id']}})['then'](handleEntityNotFound(_0x510b3d,null))['then'](function(_0x313ea3){if(_0x313ea3){_0x1428e5=_0x313ea3;_0x39735d[_0x4c2a('0x2b')]=_[_0x4c2a('0x3e')](db[_0x4c2a('0x47')][_0x4c2a('0x3f')]);_0x39735d[_0x4c2a('0x29')]=_['keys'](_0x20f2f0['query']);_0x39735d[_0x4c2a('0x34')]=_[_0x4c2a('0x2a')](_0x39735d['model'],_0x39735d['query']);_0x4cec00[_0x4c2a('0x2c')]=_['intersection'](_0x39735d[_0x4c2a('0x2b')],qs['fields'](_0x20f2f0[_0x4c2a('0x29')]['fields']));_0x4cec00[_0x4c2a('0x2c')]=_0x4cec00['attributes'][_0x4c2a('0x2e')]?_0x4cec00[_0x4c2a('0x2c')]:_0x39735d[_0x4c2a('0x2b')];_0x4cec00[_0x4c2a('0x48')]=qs['sort'](_0x20f2f0[_0x4c2a('0x29')][_0x4c2a('0x32')]);_0x4cec00[_0x4c2a('0x33')]=qs[_0x4c2a('0x34')](_[_0x4c2a('0x35')](_0x20f2f0['query'],_0x39735d[_0x4c2a('0x34')]));if(_0x20f2f0[_0x4c2a('0x29')]['filter']){_0x4cec00['where']=_[_0x4c2a('0x37')](_0x4cec00[_0x4c2a('0x33')],{'$or':_[_0x4c2a('0x25')](_0x4cec00[_0x4c2a('0x2c')],function(_0x4c396e){var _0x29244e={};_0x29244e[_0x4c396e]={'$like':'%'+_0x20f2f0[_0x4c2a('0x29')][_0x4c2a('0x36')]+'%'};return _0x29244e;})});}_0x4cec00=_[_0x4c2a('0x37')]({},_0x4cec00,_0x20f2f0[_0x4c2a('0x39')]);return _0x1428e5['getFields'](_0x4cec00);}})['then'](function(_0xdee267){if(_0xdee267){_0xfe5a10=_0xdee267['length'];if(!_0x20f2f0['query'][_0x4c2a('0x2f')]('nolimit')){_0x4cec00[_0x4c2a('0x1a')]=qs[_0x4c2a('0x1a')](_0x20f2f0[_0x4c2a('0x29')][_0x4c2a('0x1a')]);_0x4cec00[_0x4c2a('0x31')]=qs[_0x4c2a('0x31')](_0x20f2f0['query'][_0x4c2a('0x31')]);}return _0x1428e5['getFields'](_0x4cec00);}})['then'](function(_0xdd77c1){if(_0xdd77c1){return _0xdd77c1?{'count':_0xfe5a10,'rows':_0xdd77c1}:null;}})[_0x4c2a('0x21')](respondWithResult(_0x510b3d,null))[_0x4c2a('0x42')](handleError(_0x510b3d,null));};exports[_0x4c2a('0x49')]=function(_0xdb3770,_0x8bd3b,_0x2e35e8){var _0xa96054={};var _0x2e3098={};var _0x47a906;var _0x504ba9;return db[_0x4c2a('0x26')][_0x4c2a('0x46')]({'where':{'id':_0xdb3770[_0x4c2a('0x45')]['id']}})[_0x4c2a('0x21')](handleEntityNotFound(_0x8bd3b,null))[_0x4c2a('0x21')](function(_0xd0ab8d){if(_0xd0ab8d){_0x47a906=_0xd0ab8d;_0x2e3098['model']=_[_0x4c2a('0x3e')](db['ZohoField'][_0x4c2a('0x3f')]);_0x2e3098[_0x4c2a('0x29')]=_[_0x4c2a('0x3e')](_0xdb3770[_0x4c2a('0x29')]);_0x2e3098[_0x4c2a('0x34')]=_[_0x4c2a('0x2a')](_0x2e3098[_0x4c2a('0x2b')],_0x2e3098[_0x4c2a('0x29')]);_0xa96054['attributes']=_['intersection'](_0x2e3098['model'],qs[_0x4c2a('0x2d')](_0xdb3770['query'][_0x4c2a('0x2d')]));_0xa96054[_0x4c2a('0x2c')]=_0xa96054[_0x4c2a('0x2c')]['length']?_0xa96054[_0x4c2a('0x2c')]:_0x2e3098[_0x4c2a('0x2b')];_0xa96054['order']=qs[_0x4c2a('0x32')](_0xdb3770[_0x4c2a('0x29')][_0x4c2a('0x32')]);_0xa96054[_0x4c2a('0x33')]=qs['filters'](_['pick'](_0xdb3770[_0x4c2a('0x29')],_0x2e3098[_0x4c2a('0x34')]));if(_0xdb3770['query'][_0x4c2a('0x36')]){_0xa96054['where']=_[_0x4c2a('0x37')](_0xa96054[_0x4c2a('0x33')],{'$or':_[_0x4c2a('0x25')](_0xa96054[_0x4c2a('0x2c')],function(_0x27e08c){var _0x44c6c6={};_0x44c6c6[_0x27e08c]={'$like':'%'+_0xdb3770[_0x4c2a('0x29')]['filter']+'%'};return _0x44c6c6;})});}_0xa96054=_['merge']({},_0xa96054,_0xdb3770[_0x4c2a('0x39')]);return _0x47a906[_0x4c2a('0x49')](_0xa96054);}})[_0x4c2a('0x21')](function(_0x2515d1){if(_0x2515d1){_0x504ba9=_0x2515d1[_0x4c2a('0x2e')];if(!_0xdb3770[_0x4c2a('0x29')]['hasOwnProperty']('nolimit')){_0xa96054[_0x4c2a('0x1a')]=qs[_0x4c2a('0x1a')](_0xdb3770[_0x4c2a('0x29')][_0x4c2a('0x1a')]);_0xa96054[_0x4c2a('0x31')]=qs[_0x4c2a('0x31')](_0xdb3770[_0x4c2a('0x29')][_0x4c2a('0x31')]);}return _0x47a906[_0x4c2a('0x49')](_0xa96054);}})[_0x4c2a('0x21')](function(_0x1ea004){if(_0x1ea004){return _0x1ea004?{'count':_0x504ba9,'rows':_0x1ea004}:null;}})[_0x4c2a('0x21')](respondWithResult(_0x8bd3b,null))['catch'](handleError(_0x8bd3b,null));};exports[_0x4c2a('0x4a')]=function(_0x242a7c,_0x19576d,_0x5d9f17){var _0x1e578a={};var _0x460379={};var _0x4210b5;var _0x2ac67e;return db[_0x4c2a('0x26')][_0x4c2a('0x46')]({'where':{'id':_0x242a7c[_0x4c2a('0x45')]['id']}})[_0x4c2a('0x21')](handleEntityNotFound(_0x19576d,null))[_0x4c2a('0x21')](function(_0x56b19f){if(_0x56b19f){_0x4210b5=_0x56b19f;_0x460379[_0x4c2a('0x2b')]=_[_0x4c2a('0x3e')](db[_0x4c2a('0x47')]['rawAttributes']);_0x460379[_0x4c2a('0x29')]=_[_0x4c2a('0x3e')](_0x242a7c[_0x4c2a('0x29')]);_0x460379[_0x4c2a('0x34')]=_[_0x4c2a('0x2a')](_0x460379['model'],_0x460379['query']);_0x1e578a['attributes']=_[_0x4c2a('0x2a')](_0x460379[_0x4c2a('0x2b')],qs[_0x4c2a('0x2d')](_0x242a7c[_0x4c2a('0x29')][_0x4c2a('0x2d')]));_0x1e578a[_0x4c2a('0x2c')]=_0x1e578a['attributes']['length']?_0x1e578a['attributes']:_0x460379['model'];_0x1e578a[_0x4c2a('0x48')]=qs['sort'](_0x242a7c[_0x4c2a('0x29')][_0x4c2a('0x32')]);_0x1e578a[_0x4c2a('0x33')]=qs['filters'](_['pick'](_0x242a7c[_0x4c2a('0x29')],_0x460379['filters']));if(_0x242a7c['query'][_0x4c2a('0x36')]){_0x1e578a[_0x4c2a('0x33')]=_[_0x4c2a('0x37')](_0x1e578a[_0x4c2a('0x33')],{'$or':_['map'](_0x1e578a[_0x4c2a('0x2c')],function(_0x2894f3){var _0x353ee3={};_0x353ee3[_0x2894f3]={'$like':'%'+_0x242a7c[_0x4c2a('0x29')]['filter']+'%'};return _0x353ee3;})});}_0x1e578a=_[_0x4c2a('0x37')]({},_0x1e578a,_0x242a7c[_0x4c2a('0x39')]);return _0x4210b5[_0x4c2a('0x4a')](_0x1e578a);}})[_0x4c2a('0x21')](function(_0x432857){if(_0x432857){_0x2ac67e=_0x432857[_0x4c2a('0x2e')];if(!_0x242a7c['query']['hasOwnProperty'](_0x4c2a('0x30'))){_0x1e578a['limit']=qs['limit'](_0x242a7c[_0x4c2a('0x29')]['limit']);_0x1e578a['offset']=qs[_0x4c2a('0x31')](_0x242a7c[_0x4c2a('0x29')][_0x4c2a('0x31')]);}return _0x4210b5[_0x4c2a('0x4a')](_0x1e578a);}})[_0x4c2a('0x21')](function(_0x1af7f5){if(_0x1af7f5){return _0x1af7f5?{'count':_0x2ac67e,'rows':_0x1af7f5}:null;}})[_0x4c2a('0x21')](respondWithResult(_0x19576d,null))['catch'](handleError(_0x19576d,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 6f7c0d4..ca7d449 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 _0xbc52=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util'];(function(_0x30cb79,_0x53c727){var _0x4aa1aa=function(_0x5ccccc){while(--_0x5ccccc){_0x30cb79['push'](_0x30cb79['shift']());}};_0x4aa1aa(++_0x53c727);}(_0xbc52,0x82));var _0x2bc5=function(_0x45605b,_0x22c23f){_0x45605b=_0x45605b-0x0;var _0x47614d=_0xbc52[_0x45605b];return _0x47614d;};'use strict';var _=require(_0x2bc5('0x0'));var util=require(_0x2bc5('0x1'));var logger=require(_0x2bc5('0x2'))(_0x2bc5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2bc5('0x4'));var fs=require('fs');var path=require(_0x2bc5('0x5'));var rimraf=require(_0x2bc5('0x6'));var config=require(_0x2bc5('0x7'));var attributes=require(_0x2bc5('0x8'));module[_0x2bc5('0x9')]=function(_0x129368,_0x50e9ab){return _0x129368[_0x2bc5('0xa')]('ZohoConfiguration',attributes,{'tableName':_0x2bc5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x729d=['../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x31ac72,_0x467dcb){var _0xe4325a=function(_0x14c93c){while(--_0x14c93c){_0x31ac72['push'](_0x31ac72['shift']());}};_0xe4325a(++_0x467dcb);}(_0x729d,0xec));var _0xd729=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0x729d[_0x34232c];return _0x4d4f4e;};'use strict';var _=require(_0xd729('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd729('0x1'));var BPromise=require(_0xd729('0x2'));var rp=require(_0xd729('0x3'));var fs=require('fs');var path=require(_0xd729('0x4'));var rimraf=require(_0xd729('0x5'));var config=require(_0xd729('0x6'));var attributes=require(_0xd729('0x7'));module[_0xd729('0x8')]=function(_0x58ae69,_0x55e55a){return _0x58ae69[_0xd729('0x9')]('ZohoConfiguration',attributes,{'tableName':_0xd729('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 ee9ea80..5c009a5 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 _0x9eeb=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','lodash','moment','bluebird'];(function(_0x12762a,_0x10d661){var _0x412556=function(_0x3f67b6){while(--_0x3f67b6){_0x12762a['push'](_0x12762a['shift']());}};_0x412556(++_0x10d661);}(_0x9eeb,0x140));var _0xb9ee=function(_0x807164,_0x32d00a){_0x807164=_0x807164-0x0;var _0x33464a=_0x9eeb[_0x807164];return _0x33464a;};'use strict';var _=require(_0xb9ee('0x0'));var util=require('util');var moment=require(_0xb9ee('0x1'));var BPromise=require(_0xb9ee('0x2'));var rs=require(_0xb9ee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9ee('0x4'))['db'];var utils=require(_0xb9ee('0x5'));var logger=require(_0xb9ee('0x6'))(_0xb9ee('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb9ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe10e4f,_0x537f9e,_0x261a56){return new BPromise(function(_0x51f0a9,_0x1810fa){return client[_0xb9ee('0x9')](_0xe10e4f,_0x261a56)[_0xb9ee('0xa')](function(_0x4287fc){logger[_0xb9ee('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x537f9e,_0xb9ee('0xc'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x537f9e,'request\x20sent',JSON[_0xb9ee('0xd')](_0x4287fc));if(_0x4287fc['error']){if(_0x4287fc[_0xb9ee('0xe')][_0xb9ee('0xf')]===0x1f4){logger[_0xb9ee('0xe')](_0xb9ee('0x10'),_0x537f9e,_0x4287fc[_0xb9ee('0xe')]['message']);return _0x1810fa(_0x4287fc[_0xb9ee('0xe')][_0xb9ee('0x11')]);}logger[_0xb9ee('0xe')](_0xb9ee('0x10'),_0x537f9e,_0x4287fc['error']['message']);return _0x51f0a9(_0x4287fc[_0xb9ee('0xe')]['message']);}else{logger['info'](_0xb9ee('0x10'),_0x537f9e,_0xb9ee('0xc'));_0x51f0a9(_0x4287fc[_0xb9ee('0x12')][_0xb9ee('0x11')]);}})['catch'](function(_0x35d807){logger[_0xb9ee('0xe')](_0xb9ee('0x10'),_0x537f9e,_0x35d807);_0x1810fa(_0x35d807);});});} \ No newline at end of file +var _0xaefe=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xfab961,_0x2646e7){var _0x476d8a=function(_0x35b376){while(--_0x35b376){_0xfab961['push'](_0xfab961['shift']());}};_0x476d8a(++_0x2646e7);}(_0xaefe,0xe2));var _0xeaef=function(_0x44f974,_0x4db616){_0x44f974=_0x44f974-0x0;var _0x805dbd=_0xaefe[_0x44f974];return _0x805dbd;};'use strict';var _=require(_0xeaef('0x0'));var util=require(_0xeaef('0x1'));var moment=require(_0xeaef('0x2'));var BPromise=require(_0xeaef('0x3'));var rs=require(_0xeaef('0x4'));var fs=require('fs');var Redis=require(_0xeaef('0x5'));var db=require(_0xeaef('0x6'))['db'];var utils=require(_0xeaef('0x7'));var logger=require(_0xeaef('0x8'))('rpc');var config=require(_0xeaef('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeaef('0xa')][_0xeaef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54ad76,_0x4db6ce,_0x1a92a9){return new BPromise(function(_0x3f9e2a,_0xf8da99){return client[_0xeaef('0xc')](_0x54ad76,_0x1a92a9)[_0xeaef('0xd')](function(_0x728d9b){logger[_0xeaef('0xe')](_0xeaef('0xf'),_0x4db6ce,_0xeaef('0x10'));logger[_0xeaef('0x11')](_0xeaef('0x12'),_0x4db6ce,_0xeaef('0x10'),JSON[_0xeaef('0x13')](_0x728d9b));if(_0x728d9b[_0xeaef('0x14')]){if(_0x728d9b[_0xeaef('0x14')][_0xeaef('0x15')]===0x1f4){logger[_0xeaef('0x14')](_0xeaef('0xf'),_0x4db6ce,_0x728d9b[_0xeaef('0x14')][_0xeaef('0x16')]);return _0xf8da99(_0x728d9b[_0xeaef('0x14')]['message']);}logger[_0xeaef('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x4db6ce,_0x728d9b[_0xeaef('0x14')]['message']);return _0x3f9e2a(_0x728d9b[_0xeaef('0x14')][_0xeaef('0x16')]);}else{logger['info'](_0xeaef('0xf'),_0x4db6ce,'request\x20sent');_0x3f9e2a(_0x728d9b[_0xeaef('0x17')][_0xeaef('0x16')]);}})[_0xeaef('0x18')](function(_0x2a5d1c){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x4db6ce,_0x2a5d1c);_0xf8da99(_0x2a5d1c);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 0a27b8a..1f835fd 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 _0x308e=['fs-extra','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x308e,0xe4));var _0xe308=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x308e[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xe308('0x0'));var util=require(_0xe308('0x1'));var path=require(_0xe308('0x2'));var timeout=require(_0xe308('0x3'));var express=require(_0xe308('0x4'));var router=express[_0xe308('0x5')]();var fs_extra=require(_0xe308('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe308('0x7'));var controller=require('./intZohoField.controller');router[_0xe308('0x8')]('/',auth[_0xe308('0x9')](),controller['index']);router[_0xe308('0x8')](_0xe308('0xa'),auth[_0xe308('0x9')](),controller[_0xe308('0xb')]);router[_0xe308('0xc')]('/',auth[_0xe308('0x9')](),controller[_0xe308('0xd')]);router[_0xe308('0xe')]('/:id',auth[_0xe308('0x9')](),controller[_0xe308('0xf')]);router[_0xe308('0x10')](_0xe308('0xa'),auth[_0xe308('0x9')](),controller['destroy']);module[_0xe308('0x11')]=router; \ No newline at end of file +var _0x6755=['fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x587395,_0x55e073){var _0x1397d3=function(_0x464842){while(--_0x464842){_0x587395['push'](_0x587395['shift']());}};_0x1397d3(++_0x55e073);}(_0x6755,0xa7));var _0x5675=function(_0x46b83,_0x4bacea){_0x46b83=_0x46b83-0x0;var _0x5c5acb=_0x6755[_0x46b83];return _0x5c5acb;};'use strict';var multer=require(_0x5675('0x0'));var util=require('util');var path=require(_0x5675('0x1'));var timeout=require(_0x5675('0x2'));var express=require('express');var router=express[_0x5675('0x3')]();var fs_extra=require(_0x5675('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5675('0x5'));var config=require(_0x5675('0x6'));var controller=require(_0x5675('0x7'));router[_0x5675('0x8')]('/',auth[_0x5675('0x9')](),controller[_0x5675('0xa')]);router[_0x5675('0x8')](_0x5675('0xb'),auth[_0x5675('0x9')](),controller['show']);router[_0x5675('0xc')]('/',auth['isAuthenticated'](),controller[_0x5675('0xd')]);router[_0x5675('0xe')]('/:id',auth[_0x5675('0x9')](),controller[_0x5675('0xf')]);router[_0x5675('0x10')](_0x5675('0xb'),auth['isAuthenticated'](),controller[_0x5675('0x11')]);module[_0x5675('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 724c8bd..d4d938a 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 _0x1a10=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x1184fe,_0x263689){var _0x4c029d=function(_0x471983){while(--_0x471983){_0x1184fe['push'](_0x1184fe['shift']());}};_0x4c029d(++_0x263689);}(_0x1a10,0x108));var _0x01a1=function(_0xc2877c,_0x2cf7ba){_0xc2877c=_0xc2877c-0x0;var _0xdc0d8e=_0x1a10[_0xc2877c];return _0xdc0d8e;};'use strict';var Sequelize=require(_0x01a1('0x0'));module[_0x01a1('0x1')]={'type':{'type':Sequelize[_0x01a1('0x2')](_0x01a1('0x3'),_0x01a1('0x4'),_0x01a1('0x5'),_0x01a1('0x6'),'picklist'),'defaultValue':_0x01a1('0x3')},'content':{'type':Sequelize[_0x01a1('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x01a1('0x2')](_0x01a1('0x3'),_0x01a1('0x4'),_0x01a1('0x5'))},'keyContent':{'type':Sequelize[_0x01a1('0x7')]},'idField':{'type':Sequelize[_0x01a1('0x7')]},'nameField':{'type':Sequelize[_0x01a1('0x7')]},'customField':{'type':Sequelize[_0x01a1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdabe=['BOOLEAN','sequelize','exports','string','variable','STRING','ENUM','customVariable'];(function(_0x4a82bd,_0x385f10){var _0xd889f9=function(_0x414033){while(--_0x414033){_0x4a82bd['push'](_0x4a82bd['shift']());}};_0xd889f9(++_0x385f10);}(_0xdabe,0x119));var _0xedab=function(_0x2d8db1,_0x3b2030){_0x2d8db1=_0x2d8db1-0x0;var _0x5c65dd=_0xdabe[_0x2d8db1];return _0x5c65dd;};'use strict';var Sequelize=require(_0xedab('0x0'));module[_0xedab('0x1')]={'type':{'type':Sequelize['ENUM'](_0xedab('0x2'),_0xedab('0x3'),'customVariable','keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xedab('0x4')]},'key':{'type':Sequelize[_0xedab('0x4')]},'keyType':{'type':Sequelize[_0xedab('0x5')](_0xedab('0x2'),_0xedab('0x3'),_0xedab('0x6'))},'keyContent':{'type':Sequelize[_0xedab('0x4')]},'idField':{'type':Sequelize[_0xedab('0x4')]},'nameField':{'type':Sequelize[_0xedab('0x4')]},'customField':{'type':Sequelize[_0xedab('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xedab('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 966ef59..6cb9097 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 _0xe464=['reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','fields','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','json','apply'];(function(_0x4ea45d,_0x577ead){var _0x57d872=function(_0xb8f29e){while(--_0xb8f29e){_0x4ea45d['push'](_0x4ea45d['shift']());}};_0x57d872(++_0x577ead);}(_0xe464,0x11a));var _0x4e46=function(_0x290610,_0x3db3e8){_0x290610=_0x290610-0x0;var _0x1e50d4=_0xe464[_0x290610];return _0x1e50d4;};'use strict';var emlformat=require(_0x4e46('0x0'));var rimraf=require(_0x4e46('0x1'));var zipdir=require(_0x4e46('0x2'));var jsonpatch=require(_0x4e46('0x3'));var rp=require(_0x4e46('0x4'));var moment=require(_0x4e46('0x5'));var BPromise=require(_0x4e46('0x6'));var Mustache=require(_0x4e46('0x7'));var util=require(_0x4e46('0x8'));var path=require(_0x4e46('0x9'));var sox=require('sox');var csv=require(_0x4e46('0xa'));var ejs=require(_0x4e46('0xb'));var fs=require('fs');var fs_extra=require(_0x4e46('0xc'));var _=require(_0x4e46('0xd'));var squel=require(_0x4e46('0xe'));var crypto=require(_0x4e46('0xf'));var jsforce=require(_0x4e46('0x10'));var deskjs=require(_0x4e46('0x11'));var toCsv=require(_0x4e46('0xa'));var querystring=require(_0x4e46('0x12'));var Papa=require(_0x4e46('0x13'));var Redis=require(_0x4e46('0x14'));var authService=require(_0x4e46('0x15'));var qs=require(_0x4e46('0x16'));var as=require(_0x4e46('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e46('0x18'))(_0x4e46('0x19'));var utils=require(_0x4e46('0x1a'));var config=require(_0x4e46('0x1b'));var licenseUtil=require(_0x4e46('0x1c'));var db=require(_0x4e46('0x1d'))['db'];function respondWithStatusCode(_0x1fa06e,_0xb8ef2a){_0xb8ef2a=_0xb8ef2a||0xcc;return function(_0x47ecb5){if(_0x47ecb5){return _0x1fa06e['sendStatus'](_0xb8ef2a);}return _0x1fa06e[_0x4e46('0x1e')](_0xb8ef2a)[_0x4e46('0x1f')]();};}function respondWithResult(_0xc09d15,_0x32c582){_0x32c582=_0x32c582||0xc8;return function(_0x45845f){if(_0x45845f){return _0xc09d15['status'](_0x32c582)['json'](_0x45845f);}};}function respondWithFilteredResult(_0x5cd886,_0x30b4f0){return function(_0x28f8b5){if(_0x28f8b5){var _0x400a0c=typeof _0x30b4f0[_0x4e46('0x20')]==='undefined'&&typeof _0x30b4f0[_0x4e46('0x21')]===_0x4e46('0x22');var _0x4c32ba=_0x28f8b5[_0x4e46('0x23')];var _0x31c552=_0x400a0c?0x0:_0x30b4f0[_0x4e46('0x20')];var _0x521fe1=_0x400a0c?_0x28f8b5['count']:_0x30b4f0[_0x4e46('0x20')]+_0x30b4f0[_0x4e46('0x21')];var _0x4093d2;if(_0x521fe1>=_0x4c32ba){_0x521fe1=_0x4c32ba;_0x4093d2=0xc8;}else{_0x4093d2=0xce;}_0x5cd886[_0x4e46('0x1e')](_0x4093d2);return _0x5cd886['set']('Content-Range',_0x31c552+'-'+_0x521fe1+'/'+_0x4c32ba)[_0x4e46('0x24')](_0x28f8b5);}return null;};}function patchUpdates(_0x308ed5){return function(_0x593c48){try{jsonpatch[_0x4e46('0x25')](_0x593c48,_0x308ed5,!![]);}catch(_0x32a46e){return BPromise[_0x4e46('0x26')](_0x32a46e);}return _0x593c48[_0x4e46('0x27')]();};}function saveUpdates(_0xcda78d,_0x5668cd){return function(_0x1053d7){if(_0x1053d7){return _0x1053d7[_0x4e46('0x28')](_0xcda78d)[_0x4e46('0x29')](function(_0xd26485){return _0xd26485;});}return null;};}function removeEntity(_0x3e15bb,_0x2339a9){return function(_0x196b01){if(_0x196b01){return _0x196b01[_0x4e46('0x2a')]()[_0x4e46('0x29')](function(){_0x3e15bb[_0x4e46('0x1e')](0xcc)[_0x4e46('0x1f')]();});}};}function handleEntityNotFound(_0x138f15,_0x5f1a76){return function(_0x5c74c1){if(!_0x5c74c1){_0x138f15[_0x4e46('0x2b')](0x194);}return _0x5c74c1;};}function handleError(_0x25cc8c,_0x2cbfd2){_0x2cbfd2=_0x2cbfd2||0x1f4;return function(_0x47920c){logger[_0x4e46('0x2c')](_0x47920c[_0x4e46('0x2d')]);if(_0x47920c['name']){delete _0x47920c[_0x4e46('0x2e')];}_0x25cc8c[_0x4e46('0x1e')](_0x2cbfd2)[_0x4e46('0x2f')](_0x47920c);};}exports[_0x4e46('0x30')]=function(_0x3342e1,_0x99038c){var _0x1b898e={},_0x538199={},_0x513a4d={'count':0x0,'rows':[]};var _0x4d9c22=_[_0x4e46('0x31')](db[_0x4e46('0x32')][_0x4e46('0x33')],function(_0x32bb73){return{'name':_0x32bb73[_0x4e46('0x34')],'type':_0x32bb73[_0x4e46('0x35')][_0x4e46('0x36')]};});_0x538199[_0x4e46('0x37')]=_[_0x4e46('0x31')](_0x4d9c22,_0x4e46('0x2e'));_0x538199[_0x4e46('0x38')]=_['keys'](_0x3342e1[_0x4e46('0x38')]);_0x538199[_0x4e46('0x39')]=_[_0x4e46('0x3a')](_0x538199['model'],_0x538199['query']);_0x1b898e[_0x4e46('0x3b')]=_[_0x4e46('0x3a')](_0x538199[_0x4e46('0x37')],qs['fields'](_0x3342e1[_0x4e46('0x38')]['fields']));_0x1b898e['attributes']=_0x1b898e['attributes']['length']?_0x1b898e[_0x4e46('0x3b')]:_0x538199[_0x4e46('0x37')];if(!_0x3342e1[_0x4e46('0x38')][_0x4e46('0x3c')]('nolimit')){_0x1b898e[_0x4e46('0x21')]=qs[_0x4e46('0x21')](_0x3342e1[_0x4e46('0x38')]['limit']);_0x1b898e['offset']=qs[_0x4e46('0x20')](_0x3342e1[_0x4e46('0x38')][_0x4e46('0x20')]);}_0x1b898e[_0x4e46('0x3d')]=qs[_0x4e46('0x3e')](_0x3342e1[_0x4e46('0x38')][_0x4e46('0x3e')]);_0x1b898e[_0x4e46('0x3f')]=qs[_0x4e46('0x39')](_[_0x4e46('0x40')](_0x3342e1['query'],_0x538199[_0x4e46('0x39')]),_0x4d9c22);if(_0x3342e1['query']['filter']){_0x1b898e[_0x4e46('0x3f')]=_[_0x4e46('0x41')](_0x1b898e[_0x4e46('0x3f')],{'$or':_[_0x4e46('0x31')](_0x4d9c22,function(_0x1f6868){if(_0x1f6868['type']!==_0x4e46('0x42')){var _0x4aedd4={};_0x4aedd4[_0x1f6868[_0x4e46('0x2e')]]={'$like':'%'+_0x3342e1[_0x4e46('0x38')]['filter']+'%'};return _0x4aedd4;}})});}_0x1b898e=_[_0x4e46('0x41')]({},_0x1b898e,_0x3342e1[_0x4e46('0x43')]);var _0x2fae19={'where':_0x1b898e[_0x4e46('0x3f')]};return db[_0x4e46('0x32')][_0x4e46('0x23')](_0x2fae19)['then'](function(_0x5be32c){_0x513a4d['count']=_0x5be32c;if(_0x3342e1[_0x4e46('0x38')][_0x4e46('0x44')]){_0x1b898e['include']=[{'all':!![]}];}return db[_0x4e46('0x32')][_0x4e46('0x45')](_0x1b898e);})['then'](function(_0x4d8ae5){_0x513a4d[_0x4e46('0x46')]=_0x4d8ae5;return _0x513a4d;})[_0x4e46('0x29')](respondWithFilteredResult(_0x99038c,_0x1b898e))[_0x4e46('0x47')](handleError(_0x99038c,null));};exports['show']=function(_0x5e0f47,_0x2f5c2e){var _0x1326ff={'raw':!![],'where':{'id':_0x5e0f47[_0x4e46('0x48')]['id']}},_0x2c8bbf={};_0x2c8bbf[_0x4e46('0x37')]=_['keys'](db[_0x4e46('0x32')]['rawAttributes']);_0x2c8bbf[_0x4e46('0x38')]=_[_0x4e46('0x49')](_0x5e0f47[_0x4e46('0x38')]);_0x2c8bbf[_0x4e46('0x39')]=_[_0x4e46('0x3a')](_0x2c8bbf['model'],_0x2c8bbf[_0x4e46('0x38')]);_0x1326ff[_0x4e46('0x3b')]=_[_0x4e46('0x3a')](_0x2c8bbf[_0x4e46('0x37')],qs[_0x4e46('0x4a')](_0x5e0f47[_0x4e46('0x38')][_0x4e46('0x4a')]));_0x1326ff[_0x4e46('0x3b')]=_0x1326ff[_0x4e46('0x3b')][_0x4e46('0x4b')]?_0x1326ff[_0x4e46('0x3b')]:_0x2c8bbf[_0x4e46('0x37')];if(_0x5e0f47[_0x4e46('0x38')][_0x4e46('0x44')]){_0x1326ff[_0x4e46('0x4c')]=[{'all':!![]}];}_0x1326ff=_[_0x4e46('0x41')]({},_0x1326ff,_0x5e0f47[_0x4e46('0x43')]);return db[_0x4e46('0x32')][_0x4e46('0x4d')](_0x1326ff)[_0x4e46('0x29')](handleEntityNotFound(_0x2f5c2e,null))['then'](respondWithResult(_0x2f5c2e,null))[_0x4e46('0x47')](handleError(_0x2f5c2e,null));};exports[_0x4e46('0x4e')]=function(_0x35bf84,_0x3b4a27){return db[_0x4e46('0x32')][_0x4e46('0x4e')](_0x35bf84[_0x4e46('0x4f')],{})[_0x4e46('0x29')](respondWithResult(_0x3b4a27,0xc9))['catch'](handleError(_0x3b4a27,null));};exports[_0x4e46('0x28')]=function(_0x28ddf5,_0x52d91d){if(_0x28ddf5[_0x4e46('0x4f')]['id']){delete _0x28ddf5['body']['id'];}return db[_0x4e46('0x32')]['find']({'where':{'id':_0x28ddf5[_0x4e46('0x48')]['id']}})[_0x4e46('0x29')](handleEntityNotFound(_0x52d91d,null))[_0x4e46('0x29')](saveUpdates(_0x28ddf5[_0x4e46('0x4f')],null))['then'](respondWithResult(_0x52d91d,null))[_0x4e46('0x47')](handleError(_0x52d91d,null));};exports[_0x4e46('0x2a')]=function(_0x4c0353,_0x5a29ba){return db[_0x4e46('0x32')][_0x4e46('0x4d')]({'where':{'id':_0x4c0353[_0x4e46('0x48')]['id']}})[_0x4e46('0x29')](handleEntityNotFound(_0x5a29ba,null))[_0x4e46('0x29')](removeEntity(_0x5a29ba,null))[_0x4e46('0x47')](handleError(_0x5a29ba,null));}; \ No newline at end of file +var _0xddbd=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','destroy','then','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x333767,_0x3e6f9c){var _0x51661b=function(_0x46e5d6){while(--_0x46e5d6){_0x333767['push'](_0x333767['shift']());}};_0x51661b(++_0x3e6f9c);}(_0xddbd,0xf4));var _0xdddb=function(_0x2376d1,_0x38eec4){_0x2376d1=_0x2376d1-0x0;var _0x443759=_0xddbd[_0x2376d1];return _0x443759;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdddb('0x0'));var zipdir=require(_0xdddb('0x1'));var jsonpatch=require(_0xdddb('0x2'));var rp=require(_0xdddb('0x3'));var moment=require(_0xdddb('0x4'));var BPromise=require(_0xdddb('0x5'));var Mustache=require(_0xdddb('0x6'));var util=require(_0xdddb('0x7'));var path=require(_0xdddb('0x8'));var sox=require(_0xdddb('0x9'));var csv=require(_0xdddb('0xa'));var ejs=require(_0xdddb('0xb'));var fs=require('fs');var fs_extra=require(_0xdddb('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdddb('0xd'));var jsforce=require(_0xdddb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdddb('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdddb('0xf'));var authService=require(_0xdddb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdddb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdddb('0x12'))('api');var utils=require(_0xdddb('0x13'));var config=require(_0xdddb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdddb('0x15'))['db'];function respondWithStatusCode(_0x3cce6f,_0x4fb31e){_0x4fb31e=_0x4fb31e||0xcc;return function(_0x41eab3){if(_0x41eab3){return _0x3cce6f[_0xdddb('0x16')](_0x4fb31e);}return _0x3cce6f[_0xdddb('0x17')](_0x4fb31e)[_0xdddb('0x18')]();};}function respondWithResult(_0x130950,_0x563eb7){_0x563eb7=_0x563eb7||0xc8;return function(_0x3dd479){if(_0x3dd479){return _0x130950['status'](_0x563eb7)[_0xdddb('0x19')](_0x3dd479);}};}function respondWithFilteredResult(_0xdbf05f,_0x3cf3dd){return function(_0x1f27e6){if(_0x1f27e6){var _0x472707=typeof _0x3cf3dd[_0xdddb('0x1a')]===_0xdddb('0x1b')&&typeof _0x3cf3dd[_0xdddb('0x1c')]===_0xdddb('0x1b');var _0x8ca8a4=_0x1f27e6[_0xdddb('0x1d')];var _0x11b43f=_0x472707?0x0:_0x3cf3dd[_0xdddb('0x1a')];var _0x4afa3c=_0x472707?_0x1f27e6['count']:_0x3cf3dd['offset']+_0x3cf3dd[_0xdddb('0x1c')];var _0x1e7acd;if(_0x4afa3c>=_0x8ca8a4){_0x4afa3c=_0x8ca8a4;_0x1e7acd=0xc8;}else{_0x1e7acd=0xce;}_0xdbf05f[_0xdddb('0x17')](_0x1e7acd);return _0xdbf05f['set']('Content-Range',_0x11b43f+'-'+_0x4afa3c+'/'+_0x8ca8a4)['json'](_0x1f27e6);}return null;};}function patchUpdates(_0x1e183e){return function(_0x253db3){try{jsonpatch[_0xdddb('0x1e')](_0x253db3,_0x1e183e,!![]);}catch(_0x68475a){return BPromise[_0xdddb('0x1f')](_0x68475a);}return _0x253db3['save']();};}function saveUpdates(_0x37c3e0,_0x3bc6c0){return function(_0x12285f){if(_0x12285f){return _0x12285f[_0xdddb('0x20')](_0x37c3e0)['then'](function(_0x3a3e9d){return _0x3a3e9d;});}return null;};}function removeEntity(_0x321446,_0x43b59b){return function(_0x1f5fba){if(_0x1f5fba){return _0x1f5fba[_0xdddb('0x21')]()[_0xdddb('0x22')](function(){_0x321446[_0xdddb('0x17')](0xcc)[_0xdddb('0x18')]();});}};}function handleEntityNotFound(_0x3b9ef6,_0x4f1f47){return function(_0x53f013){if(!_0x53f013){_0x3b9ef6[_0xdddb('0x16')](0x194);}return _0x53f013;};}function handleError(_0x36f925,_0x29f961){_0x29f961=_0x29f961||0x1f4;return function(_0x5c7ebc){logger[_0xdddb('0x23')](_0x5c7ebc[_0xdddb('0x24')]);if(_0x5c7ebc[_0xdddb('0x25')]){delete _0x5c7ebc[_0xdddb('0x25')];}_0x36f925[_0xdddb('0x17')](_0x29f961)[_0xdddb('0x26')](_0x5c7ebc);};}exports[_0xdddb('0x27')]=function(_0x53caba,_0x2a3603){var _0x2a8df6={},_0x4f02a8={},_0x48a5e7={'count':0x0,'rows':[]};var _0x212914=_[_0xdddb('0x28')](db[_0xdddb('0x29')][_0xdddb('0x2a')],function(_0x333c5a){return{'name':_0x333c5a[_0xdddb('0x2b')],'type':_0x333c5a[_0xdddb('0x2c')][_0xdddb('0x2d')]};});_0x4f02a8[_0xdddb('0x2e')]=_[_0xdddb('0x28')](_0x212914,_0xdddb('0x25'));_0x4f02a8[_0xdddb('0x2f')]=_[_0xdddb('0x30')](_0x53caba[_0xdddb('0x2f')]);_0x4f02a8[_0xdddb('0x31')]=_[_0xdddb('0x32')](_0x4f02a8[_0xdddb('0x2e')],_0x4f02a8['query']);_0x2a8df6[_0xdddb('0x33')]=_[_0xdddb('0x32')](_0x4f02a8[_0xdddb('0x2e')],qs[_0xdddb('0x34')](_0x53caba[_0xdddb('0x2f')][_0xdddb('0x34')]));_0x2a8df6[_0xdddb('0x33')]=_0x2a8df6[_0xdddb('0x33')][_0xdddb('0x35')]?_0x2a8df6[_0xdddb('0x33')]:_0x4f02a8[_0xdddb('0x2e')];if(!_0x53caba['query'][_0xdddb('0x36')](_0xdddb('0x37'))){_0x2a8df6[_0xdddb('0x1c')]=qs[_0xdddb('0x1c')](_0x53caba['query'][_0xdddb('0x1c')]);_0x2a8df6[_0xdddb('0x1a')]=qs[_0xdddb('0x1a')](_0x53caba[_0xdddb('0x2f')][_0xdddb('0x1a')]);}_0x2a8df6[_0xdddb('0x38')]=qs[_0xdddb('0x39')](_0x53caba[_0xdddb('0x2f')][_0xdddb('0x39')]);_0x2a8df6[_0xdddb('0x3a')]=qs[_0xdddb('0x31')](_[_0xdddb('0x3b')](_0x53caba[_0xdddb('0x2f')],_0x4f02a8[_0xdddb('0x31')]),_0x212914);if(_0x53caba[_0xdddb('0x2f')][_0xdddb('0x3c')]){_0x2a8df6[_0xdddb('0x3a')]=_['merge'](_0x2a8df6[_0xdddb('0x3a')],{'$or':_[_0xdddb('0x28')](_0x212914,function(_0x4e5547){if(_0x4e5547[_0xdddb('0x2c')]!==_0xdddb('0x3d')){var _0x2b7b41={};_0x2b7b41[_0x4e5547[_0xdddb('0x25')]]={'$like':'%'+_0x53caba[_0xdddb('0x2f')]['filter']+'%'};return _0x2b7b41;}})});}_0x2a8df6=_[_0xdddb('0x3e')]({},_0x2a8df6,_0x53caba[_0xdddb('0x3f')]);var _0x20af6c={'where':_0x2a8df6[_0xdddb('0x3a')]};return db[_0xdddb('0x29')][_0xdddb('0x1d')](_0x20af6c)[_0xdddb('0x22')](function(_0xdc1061){_0x48a5e7[_0xdddb('0x1d')]=_0xdc1061;if(_0x53caba[_0xdddb('0x2f')][_0xdddb('0x40')]){_0x2a8df6['include']=[{'all':!![]}];}return db[_0xdddb('0x29')][_0xdddb('0x41')](_0x2a8df6);})['then'](function(_0x269365){_0x48a5e7[_0xdddb('0x42')]=_0x269365;return _0x48a5e7;})['then'](respondWithFilteredResult(_0x2a3603,_0x2a8df6))[_0xdddb('0x43')](handleError(_0x2a3603,null));};exports[_0xdddb('0x44')]=function(_0x5c8bc5,_0x5902a6){var _0x8607f9={'raw':!![],'where':{'id':_0x5c8bc5[_0xdddb('0x45')]['id']}},_0x465c5e={};_0x465c5e[_0xdddb('0x2e')]=_[_0xdddb('0x30')](db[_0xdddb('0x29')][_0xdddb('0x2a')]);_0x465c5e[_0xdddb('0x2f')]=_[_0xdddb('0x30')](_0x5c8bc5['query']);_0x465c5e[_0xdddb('0x31')]=_['intersection'](_0x465c5e[_0xdddb('0x2e')],_0x465c5e[_0xdddb('0x2f')]);_0x8607f9[_0xdddb('0x33')]=_[_0xdddb('0x32')](_0x465c5e[_0xdddb('0x2e')],qs[_0xdddb('0x34')](_0x5c8bc5[_0xdddb('0x2f')][_0xdddb('0x34')]));_0x8607f9[_0xdddb('0x33')]=_0x8607f9[_0xdddb('0x33')]['length']?_0x8607f9[_0xdddb('0x33')]:_0x465c5e[_0xdddb('0x2e')];if(_0x5c8bc5['query'][_0xdddb('0x40')]){_0x8607f9[_0xdddb('0x46')]=[{'all':!![]}];}_0x8607f9=_[_0xdddb('0x3e')]({},_0x8607f9,_0x5c8bc5[_0xdddb('0x3f')]);return db[_0xdddb('0x29')]['find'](_0x8607f9)[_0xdddb('0x22')](handleEntityNotFound(_0x5902a6,null))['then'](respondWithResult(_0x5902a6,null))['catch'](handleError(_0x5902a6,null));};exports[_0xdddb('0x47')]=function(_0x15473d,_0x364c07){return db[_0xdddb('0x29')]['create'](_0x15473d[_0xdddb('0x48')],{})[_0xdddb('0x22')](respondWithResult(_0x364c07,0xc9))['catch'](handleError(_0x364c07,null));};exports[_0xdddb('0x20')]=function(_0x3ec7e9,_0x2f717a){if(_0x3ec7e9[_0xdddb('0x48')]['id']){delete _0x3ec7e9[_0xdddb('0x48')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x3ec7e9[_0xdddb('0x45')]['id']}})[_0xdddb('0x22')](handleEntityNotFound(_0x2f717a,null))[_0xdddb('0x22')](saveUpdates(_0x3ec7e9[_0xdddb('0x48')],null))[_0xdddb('0x22')](respondWithResult(_0x2f717a,null))[_0xdddb('0x43')](handleError(_0x2f717a,null));};exports[_0xdddb('0x21')]=function(_0x3edbeb,_0x263814){return db[_0xdddb('0x29')][_0xdddb('0x49')]({'where':{'id':_0x3edbeb[_0xdddb('0x45')]['id']}})[_0xdddb('0x22')](handleEntityNotFound(_0x263814,null))[_0xdddb('0x22')](removeEntity(_0x263814,null))[_0xdddb('0x43')](handleError(_0x263814,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1709a70..05d5328 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 _0x01d9=['define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xf'),_0x901d('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['FieldId','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','zoho_unique_index','idField'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xba34,0x119));var _0x4ba3=function(_0x461543,_0x1adb57){_0x461543=_0x461543-0x0;var _0x2aeb76=_0xba34[_0x461543];return _0x2aeb76;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('ZohoField',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[{'name':_0x4ba3('0xb'),'fields':[_0x4ba3('0xc'),_0x4ba3('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 acbf6bf..2c7db85 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 _0xcdd9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoField,\x20%s,\x20%s','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcdd9,0x18b));var _0x9cdd=function(_0x39c96f,_0x48c5d1){_0x39c96f=_0x39c96f-0x0;var _0x81f286=_0xcdd9[_0x39c96f];return _0x81f286;};'use strict';var _=require(_0x9cdd('0x0'));var util=require(_0x9cdd('0x1'));var moment=require(_0x9cdd('0x2'));var BPromise=require(_0x9cdd('0x3'));var rs=require(_0x9cdd('0x4'));var fs=require('fs');var Redis=require(_0x9cdd('0x5'));var db=require(_0x9cdd('0x6'))['db'];var utils=require(_0x9cdd('0x7'));var logger=require(_0x9cdd('0x8'))('rpc');var config=require(_0x9cdd('0x9'));var jayson=require(_0x9cdd('0xa'));var client=jayson[_0x9cdd('0xb')][_0x9cdd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa2b4e1,_0x4f5877,_0x585280){return new BPromise(function(_0x1ed6b5,_0x59dd8f){return client['request'](_0xa2b4e1,_0x585280)[_0x9cdd('0xd')](function(_0x22419e){logger[_0x9cdd('0xe')]('ZohoField,\x20%s,\x20%s',_0x4f5877,'request\x20sent');logger[_0x9cdd('0xf')](_0x9cdd('0x10'),_0x4f5877,'request\x20sent',JSON[_0x9cdd('0x11')](_0x22419e));if(_0x22419e[_0x9cdd('0x12')]){if(_0x22419e['error'][_0x9cdd('0x13')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x4f5877,_0x22419e[_0x9cdd('0x12')][_0x9cdd('0x14')]);return _0x59dd8f(_0x22419e['error'][_0x9cdd('0x14')]);}logger[_0x9cdd('0x12')](_0x9cdd('0x15'),_0x4f5877,_0x22419e[_0x9cdd('0x12')][_0x9cdd('0x14')]);return _0x1ed6b5(_0x22419e['error']['message']);}else{logger[_0x9cdd('0xe')]('ZohoField,\x20%s,\x20%s',_0x4f5877,_0x9cdd('0x16'));_0x1ed6b5(_0x22419e[_0x9cdd('0x17')][_0x9cdd('0x14')]);}})[_0x9cdd('0x18')](function(_0x533999){logger[_0x9cdd('0x12')](_0x9cdd('0x15'),_0x4f5877,_0x533999);_0x59dd8f(_0x533999);});});} \ No newline at end of file +var _0x5208=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5208,0x16e));var _0x8520=function(_0x5a03fa,_0xcf3275){_0x5a03fa=_0x5a03fa-0x0;var _0x29e6c2=_0x5208[_0x5a03fa];return _0x29e6c2;};'use strict';var _=require(_0x8520('0x0'));var util=require(_0x8520('0x1'));var moment=require(_0x8520('0x2'));var BPromise=require(_0x8520('0x3'));var rs=require(_0x8520('0x4'));var fs=require('fs');var Redis=require(_0x8520('0x5'));var db=require(_0x8520('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8520('0x7'))(_0x8520('0x8'));var config=require(_0x8520('0x9'));var jayson=require(_0x8520('0xa'));var client=jayson[_0x8520('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x156fd3,_0xfbe15c,_0x356c82){return new BPromise(function(_0x3aefe0,_0xe017a5){return client['request'](_0x156fd3,_0x356c82)[_0x8520('0xc')](function(_0x4e813d){logger[_0x8520('0xd')](_0x8520('0xe'),_0xfbe15c,_0x8520('0xf'));logger[_0x8520('0x10')](_0x8520('0x11'),_0xfbe15c,_0x8520('0xf'),JSON[_0x8520('0x12')](_0x4e813d));if(_0x4e813d[_0x8520('0x13')]){if(_0x4e813d[_0x8520('0x13')][_0x8520('0x14')]===0x1f4){logger[_0x8520('0x13')](_0x8520('0xe'),_0xfbe15c,_0x4e813d[_0x8520('0x13')][_0x8520('0x15')]);return _0xe017a5(_0x4e813d[_0x8520('0x13')][_0x8520('0x15')]);}logger[_0x8520('0x13')](_0x8520('0xe'),_0xfbe15c,_0x4e813d['error'][_0x8520('0x15')]);return _0x3aefe0(_0x4e813d[_0x8520('0x13')][_0x8520('0x15')]);}else{logger['info'](_0x8520('0xe'),_0xfbe15c,_0x8520('0xf'));_0x3aefe0(_0x4e813d[_0x8520('0x16')][_0x8520('0x15')]);}})[_0x8520('0x17')](function(_0x23e610){logger[_0x8520('0x13')](_0x8520('0xe'),_0xfbe15c,_0x23e610);_0xe017a5(_0x23e610);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 46b9562..09ab699 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4c8890,_0x34c779){var _0x2e7ed5=function(_0x6ba2c6){while(--_0x6ba2c6){_0x4c8890['push'](_0x4c8890['shift']());}};_0x2e7ed5(++_0x34c779);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x465e1c,_0xdff365){var _0xb35dda=function(_0x496535){while(--_0x496535){_0x465e1c['push'](_0x465e1c['shift']());}};_0xb35dda(++_0xdff365);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index c64c977..0aef3d4 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 _0x3da4=['app.js','INTEGER','BOOLEAN','sequelize','exports','unique_name_and_version','STRING'];(function(_0xf736b1,_0x7493ba){var _0x5b091c=function(_0x48e137){while(--_0x48e137){_0xf736b1['push'](_0xf736b1['shift']());}};_0x5b091c(++_0x7493ba);}(_0x3da4,0xce));var _0x43da=function(_0x413898,_0x277f4d){_0x413898=_0x413898-0x0;var _0x2106ac=_0x3da4[_0x413898];return _0x2106ac;};'use strict';var Sequelize=require(_0x43da('0x0'));module[_0x43da('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x43da('0x2')},'version':{'type':Sequelize[_0x43da('0x3')],'allowNull':![],'unique':_0x43da('0x2')},'main':{'type':Sequelize[_0x43da('0x3')],'defaultValue':_0x43da('0x4')},'filename':{'type':Sequelize[_0x43da('0x3')]},'path':{'type':Sequelize[_0x43da('0x3')]},'type':{'type':Sequelize[_0x43da('0x3')]},'size':{'type':Sequelize[_0x43da('0x5')]},'active':{'type':Sequelize[_0x43da('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x43da('0x3')]},'state':{'type':Sequelize[_0x43da('0x3')],'unique':'state'},'description':{'type':Sequelize[_0x43da('0x3')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x43da('0x3')]},'link':{'type':Sequelize[_0x43da('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0x9086=['STRING','app.js','state','sequelize','exports','unique_name_and_version'];(function(_0x32b7b9,_0x3de1e6){var _0x2c5a74=function(_0x3dba68){while(--_0x3dba68){_0x32b7b9['push'](_0x32b7b9['shift']());}};_0x2c5a74(++_0x3de1e6);}(_0x9086,0x10b));var _0x6908=function(_0x2b24d0,_0x49b3d7){_0x2b24d0=_0x2b24d0-0x0;var _0x1a2482=_0x9086[_0x2b24d0];return _0x1a2482;};'use strict';var Sequelize=require(_0x6908('0x0'));module[_0x6908('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6908('0x2')},'version':{'type':Sequelize[_0x6908('0x3')],'allowNull':![],'unique':_0x6908('0x2')},'main':{'type':Sequelize[_0x6908('0x3')],'defaultValue':_0x6908('0x4')},'filename':{'type':Sequelize[_0x6908('0x3')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6908('0x3')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x6908('0x3')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x6908('0x3')],'unique':_0x6908('0x5')},'description':{'type':Sequelize[_0x6908('0x3')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6908('0x3')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index cd8e03e..bcca43a 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 _0x1261=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','Integration','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x1261,0x144));var _0x1126=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0x1261[_0x561f25];return _0x150e4c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['Integration'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['Integration']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));}; \ No newline at end of file +var _0x4991=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','Integration','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters'];(function(_0x233494,_0x498a62){var _0x4547f9=function(_0x1948c7){while(--_0x1948c7){_0x233494['push'](_0x233494['shift']());}};_0x4547f9(++_0x498a62);}(_0x4991,0xf7));var _0x1499=function(_0x2d8000,_0x15f15f){_0x2d8000=_0x2d8000-0x0;var _0x12139e=_0x4991[_0x2d8000];return _0x12139e;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3039ce,_0x274bc1){_0x274bc1=_0x274bc1||0xcc;return function(_0x34a928){if(_0x34a928){return _0x3039ce[_0x1499('0x17')](_0x274bc1);}return _0x3039ce[_0x1499('0x18')](_0x274bc1)['end']();};}function respondWithResult(_0x5f34f2,_0x308177){_0x308177=_0x308177||0xc8;return function(_0x4e5195){if(_0x4e5195){return _0x5f34f2[_0x1499('0x18')](_0x308177)[_0x1499('0x19')](_0x4e5195);}};}function respondWithFilteredResult(_0x308318,_0x3ab605){return function(_0x48f654){if(_0x48f654){var _0x1ed43b=typeof _0x3ab605[_0x1499('0x1a')]==='undefined'&&typeof _0x3ab605[_0x1499('0x1b')]===_0x1499('0x1c');var _0x46b364=_0x48f654[_0x1499('0x1d')];var _0x1e45a9=_0x1ed43b?0x0:_0x3ab605[_0x1499('0x1a')];var _0x5b9859=_0x1ed43b?_0x48f654['count']:_0x3ab605['offset']+_0x3ab605[_0x1499('0x1b')];var _0xad534b;if(_0x5b9859>=_0x46b364){_0x5b9859=_0x46b364;_0xad534b=0xc8;}else{_0xad534b=0xce;}_0x308318['status'](_0xad534b);return _0x308318[_0x1499('0x1e')](_0x1499('0x1f'),_0x1e45a9+'-'+_0x5b9859+'/'+_0x46b364)[_0x1499('0x19')](_0x48f654);}return null;};}function patchUpdates(_0x18e4a6){return function(_0x21e887){try{jsonpatch[_0x1499('0x20')](_0x21e887,_0x18e4a6,!![]);}catch(_0x2b0458){return BPromise[_0x1499('0x21')](_0x2b0458);}return _0x21e887[_0x1499('0x22')]();};}function saveUpdates(_0x15bcd4,_0x2bb71f){return function(_0x836081){if(_0x836081){return _0x836081[_0x1499('0x23')](_0x15bcd4)[_0x1499('0x24')](function(_0x4ec57a){return _0x4ec57a;});}return null;};}function removeEntity(_0x1e2c51,_0x2c7f57){return function(_0x5615b4){if(_0x5615b4){return _0x5615b4[_0x1499('0x25')]()[_0x1499('0x24')](function(){_0x1e2c51[_0x1499('0x18')](0xcc)[_0x1499('0x26')]();});}};}function handleEntityNotFound(_0x3968e0,_0x16d036){return function(_0x54f3c2){if(!_0x54f3c2){_0x3968e0['sendStatus'](0x194);}return _0x54f3c2;};}function handleError(_0x12739b,_0x3c9aca){_0x3c9aca=_0x3c9aca||0x1f4;return function(_0x3b9259){logger[_0x1499('0x27')](_0x3b9259[_0x1499('0x28')]);if(_0x3b9259['name']){delete _0x3b9259[_0x1499('0x29')];}_0x12739b['status'](_0x3c9aca)['send'](_0x3b9259);};}exports['index']=function(_0x21d204,_0x103efa){var _0x40932a={},_0x1b460b={},_0x3dad86={'count':0x0,'rows':[]};var _0x388513=_[_0x1499('0x2a')](db['Integration'][_0x1499('0x2b')],function(_0x1a2c99){return{'name':_0x1a2c99[_0x1499('0x2c')],'type':_0x1a2c99['type'][_0x1499('0x2d')]};});_0x1b460b[_0x1499('0x2e')]=_['map'](_0x388513,_0x1499('0x29'));_0x1b460b[_0x1499('0x2f')]=_['keys'](_0x21d204[_0x1499('0x2f')]);_0x1b460b[_0x1499('0x30')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],_0x1b460b[_0x1499('0x2f')]);_0x40932a[_0x1499('0x32')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x21d204[_0x1499('0x2f')][_0x1499('0x33')]));_0x40932a[_0x1499('0x32')]=_0x40932a[_0x1499('0x32')][_0x1499('0x34')]?_0x40932a[_0x1499('0x32')]:_0x1b460b[_0x1499('0x2e')];if(!_0x21d204[_0x1499('0x2f')][_0x1499('0x35')](_0x1499('0x36'))){_0x40932a[_0x1499('0x1b')]=qs['limit'](_0x21d204[_0x1499('0x2f')][_0x1499('0x1b')]);_0x40932a[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x21d204[_0x1499('0x2f')][_0x1499('0x1a')]);}_0x40932a[_0x1499('0x37')]=qs[_0x1499('0x38')](_0x21d204[_0x1499('0x2f')][_0x1499('0x38')]);_0x40932a[_0x1499('0x39')]=qs['filters'](_['pick'](_0x21d204[_0x1499('0x2f')],_0x1b460b['filters']),_0x388513);if(_0x21d204[_0x1499('0x2f')]['filter']){_0x40932a[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x40932a[_0x1499('0x39')],{'$or':_[_0x1499('0x2a')](_0x388513,function(_0x531933){if(_0x531933[_0x1499('0x3b')]!=='VIRTUAL'){var _0x2f9c59={};_0x2f9c59[_0x531933[_0x1499('0x29')]]={'$like':'%'+_0x21d204[_0x1499('0x2f')][_0x1499('0x3c')]+'%'};return _0x2f9c59;}})});}_0x40932a=_['merge']({},_0x40932a,_0x21d204[_0x1499('0x3d')]);var _0x815a99={'where':_0x40932a[_0x1499('0x39')]};return db[_0x1499('0x3e')]['count'](_0x815a99)[_0x1499('0x24')](function(_0x4cc411){_0x3dad86[_0x1499('0x1d')]=_0x4cc411;if(_0x21d204[_0x1499('0x2f')][_0x1499('0x3f')]){_0x40932a[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x3e')][_0x1499('0x41')](_0x40932a);})[_0x1499('0x24')](function(_0xcb85eb){_0x3dad86[_0x1499('0x42')]=_0xcb85eb;return _0x3dad86;})[_0x1499('0x24')](respondWithFilteredResult(_0x103efa,_0x40932a))['catch'](handleError(_0x103efa,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x2e')]=_[_0x1499('0x45')](db[_0x1499('0x3e')][_0x1499('0x2b')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2f')]);_0x5646cf[_0x1499('0x30')]=_['intersection'](_0x5646cf[_0x1499('0x2e')],_0x5646cf[_0x1499('0x2f')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x5dd36c[_0x1499('0x2f')]['fields']));_0x1af1a1[_0x1499('0x32')]=_0x1af1a1[_0x1499('0x32')][_0x1499('0x34')]?_0x1af1a1[_0x1499('0x32')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2f')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3a')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x3e')][_0x1499('0x46')](_0x1af1a1)[_0x1499('0x24')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x47')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x3e')][_0x1499('0x47')](_0x491777[_0x1499('0x48')],{})[_0x1499('0x24')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x49')](handleError(_0x7fa101,null));};exports[_0x1499('0x23')]=function(_0x591aa8,_0x420d16){if(_0x591aa8['body']['id']){delete _0x591aa8[_0x1499('0x48')]['id'];}return db[_0x1499('0x3e')]['find']({'where':{'id':_0x591aa8[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x420d16,null))[_0x1499('0x24')](saveUpdates(_0x591aa8['body'],null))[_0x1499('0x24')](respondWithResult(_0x420d16,null))[_0x1499('0x49')](handleError(_0x420d16,null));};exports[_0x1499('0x25')]=function(_0x29ac0f,_0x305599){return db[_0x1499('0x3e')][_0x1499('0x46')]({'where':{'id':_0x29ac0f[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x305599,null))[_0x1499('0x24')](removeEntity(_0x305599,null))['catch'](handleError(_0x305599,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index f9b2776..a596f2c 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 _0xb488=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash'];(function(_0x141dd0,_0x13f015){var _0x41aa2a=function(_0x51213d){while(--_0x51213d){_0x141dd0['push'](_0x141dd0['shift']());}};_0x41aa2a(++_0x13f015);}(_0xb488,0x1a3));var _0x8b48=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb488[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x8b48('0x0'));var util=require(_0x8b48('0x1'));var logger=require(_0x8b48('0x2'))(_0x8b48('0x3'));var moment=require(_0x8b48('0x4'));var BPromise=require(_0x8b48('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b48('0x6'));var rimraf=require(_0x8b48('0x7'));var config=require(_0x8b48('0x8'));var attributes=require(_0x8b48('0x9'));module[_0x8b48('0xa')]=function(_0x131263,_0x4814b5){return _0x131263[_0x8b48('0xb')](_0x8b48('0xc'),attributes,{'tableName':_0x8b48('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x578a=['rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4f2e02,_0x3ff4db){var _0x59f62d=function(_0x458789){while(--_0x458789){_0x4f2e02['push'](_0x4f2e02['shift']());}};_0x59f62d(++_0x3ff4db);}(_0x578a,0x8e));var _0xa578=function(_0x5575cd,_0x73ab7a){_0x5575cd=_0x5575cd-0x0;var _0x4979a0=_0x578a[_0x5575cd];return _0x4979a0;};'use strict';var _=require(_0xa578('0x0'));var util=require(_0xa578('0x1'));var logger=require(_0xa578('0x2'))(_0xa578('0x3'));var moment=require(_0xa578('0x4'));var BPromise=require(_0xa578('0x5'));var rp=require(_0xa578('0x6'));var fs=require('fs');var path=require(_0xa578('0x7'));var rimraf=require(_0xa578('0x8'));var config=require(_0xa578('0x9'));var attributes=require(_0xa578('0xa'));module[_0xa578('0xb')]=function(_0x37d09e,_0xd3b0cd){return _0x37d09e[_0xa578('0xc')](_0xa578('0xd'),attributes,{'tableName':_0xa578('0xe'),'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 392fc19..ae145c5 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x590ac6,_0x3a3771){var _0x20a66f=function(_0xfda6cd){while(--_0xfda6cd){_0x590ac6['push'](_0x590ac6['shift']());}};_0x20a66f(++_0x3a3771);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5b740d,_0x89abbe){_0x5b740d=_0x5b740d-0x0;var _0x46b17c=_0x5f2f[_0x5b740d];return _0x46b17c;};'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')]('Integration,\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 _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(_0x57767a,_0x2603ac){var _0x357603=function(_0x2a886b){while(--_0x2a886b){_0x57767a['push'](_0x57767a['shift']());}};_0x357603(++_0x2603ac);}(_0xef0f,0x168));var _0xfef0=function(_0x2c6413,_0x4f07d8){_0x2c6413=_0x2c6413-0x0;var _0x54923d=_0xef0f[_0x2c6413];return _0x54923d;};'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 a33d00e..4f88217 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 _0x524e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','path','connect-timeout'];(function(_0x14abdb,_0x25d5fc){var _0x2ad641=function(_0x17d5bc){while(--_0x17d5bc){_0x14abdb['push'](_0x14abdb['shift']());}};_0x2ad641(++_0x25d5fc);}(_0x524e,0x15e));var _0xe524=function(_0x49bc17,_0x9d7254){_0x49bc17=_0x49bc17-0x0;var _0x33e475=_0x524e[_0x49bc17];return _0x33e475;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x10')]('/',auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x12')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x14')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x15')]);module['exports']=router; \ No newline at end of file +var _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x26985b,_0x300d88){var _0x3404b5=function(_0x24db7f){while(--_0x24db7f){_0x26985b['push'](_0x26985b['shift']());}};_0x3404b5(++_0x300d88);}(_0x57ca,0x108));var _0xa57c=function(_0x235fda,_0x3e2c1c){_0x235fda=_0x235fda-0x0;var _0x17fd9f=_0x57ca[_0x235fda];return _0x17fd9f;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x11')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 6ca0cbc..15bc9f5 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 _0xff77=['INTEGER','DATE','BOOLEAN','TEXT','SENT','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x5e15e0,_0x3b0615){var _0x256343=function(_0x1cd9f0){while(--_0x1cd9f0){_0x5e15e0['push'](_0x5e15e0['shift']());}};_0x256343(++_0x3b0615);}(_0xff77,0x75));var _0x7ff7=function(_0x480695,_0x5cbdac){_0x480695=_0x480695-0x0;var _0x20bb70=_0xff77[_0x480695];return _0x20bb70;};'use strict';var Sequelize=require(_0x7ff7('0x0'));module[_0x7ff7('0x1')]={'integration':{'type':Sequelize[_0x7ff7('0x2')]},'eventChannel':{'type':Sequelize[_0x7ff7('0x2')]},'exitStatus':{'type':Sequelize[_0x7ff7('0x2')]},'ticketId':{'type':Sequelize[_0x7ff7('0x2')]},'integrationId':{'type':Sequelize[_0x7ff7('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7ff7('0x2')]},'calleridnum':{'type':Sequelize[_0x7ff7('0x2')]},'calleridname':{'type':Sequelize[_0x7ff7('0x2')]},'queue':{'type':Sequelize[_0x7ff7('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7ff7('0x2')]},'agentcalledAt':{'type':Sequelize[_0x7ff7('0x4')]},'agentconnectAt':{'type':Sequelize[_0x7ff7('0x4')]},'holdtime':{'type':Sequelize[_0x7ff7('0x3')]},'agentcomplete':{'type':Sequelize[_0x7ff7('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7ff7('0x4')]},'talktime':{'type':Sequelize[_0x7ff7('0x3')]},'agentacw':{'type':Sequelize[_0x7ff7('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x7ff7('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x7ff7('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7ff7('0x4')]},'lastevent':{'type':Sequelize[_0x7ff7('0x2')]},'channel':{'type':Sequelize[_0x7ff7('0x2')]},'channelstate':{'type':Sequelize[_0x7ff7('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x7ff7('0x2')]},'connectedlinename':{'type':Sequelize[_0x7ff7('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7ff7('0x2')]},'context':{'type':Sequelize[_0x7ff7('0x2')]},'exten':{'type':Sequelize[_0x7ff7('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7ff7('0x2')]},'destchannelstate':{'type':Sequelize[_0x7ff7('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x7ff7('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7ff7('0x2')]},'destcalleridname':{'type':Sequelize[_0x7ff7('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7ff7('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7ff7('0x2')]},'destlanguage':{'type':Sequelize[_0x7ff7('0x2')]},'destaccountcode':{'type':Sequelize[_0x7ff7('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x7ff7('0x2')]},'destpriority':{'type':Sequelize[_0x7ff7('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x7ff7('0x2')]},'inReplyTo':{'type':Sequelize[_0x7ff7('0x2')]},'subject':{'type':Sequelize[_0x7ff7('0x2')]},'from':{'type':Sequelize[_0x7ff7('0x2')]},'to':{'type':Sequelize[_0x7ff7('0x2')]},'cc':{'type':Sequelize[_0x7ff7('0x2')]},'attachment':{'type':Sequelize[_0x7ff7('0x6')]},'html':{'type':Sequelize[_0x7ff7('0x6')]},'text':{'type':Sequelize[_0x7ff7('0x6')]},'status':{'type':Sequelize['ENUM'](_0x7ff7('0x7'),'SENDING',_0x7ff7('0x8'),_0x7ff7('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x7ff7('0x2')]},'appdata':{'type':Sequelize[_0x7ff7('0x2')]},'projectId':{'type':Sequelize[_0x7ff7('0x3')]}}; \ No newline at end of file +var _0x3104=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','RECEIVED','FAILED','exports'];(function(_0x2f6764,_0x3d8b4f){var _0x49c478=function(_0x671aa1){while(--_0x671aa1){_0x2f6764['push'](_0x2f6764['shift']());}};_0x49c478(++_0x3d8b4f);}(_0x3104,0x86));var _0x4310=function(_0x196731,_0x599e91){_0x196731=_0x196731-0x0;var _0x4d6fca=_0x3104[_0x196731];return _0x4d6fca;};'use strict';var Sequelize=require('sequelize');module[_0x4310('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x4310('0x1')]},'exitStatus':{'type':Sequelize[_0x4310('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x4310('0x2')]},'contacts':{'type':Sequelize[_0x4310('0x1')]},'uniqueid':{'type':Sequelize[_0x4310('0x1')]},'calleridnum':{'type':Sequelize[_0x4310('0x1')]},'calleridname':{'type':Sequelize[_0x4310('0x1')]},'queue':{'type':Sequelize[_0x4310('0x1')]},'interface':{'type':Sequelize[_0x4310('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x4310('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4310('0x3')]},'holdtime':{'type':Sequelize[_0x4310('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4310('0x3')]},'talktime':{'type':Sequelize[_0x4310('0x2')]},'agentacw':{'type':Sequelize[_0x4310('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4310('0x2')]},'reason':{'type':Sequelize[_0x4310('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x4310('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4310('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4310('0x3')]},'lastevent':{'type':Sequelize[_0x4310('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x4310('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4310('0x1')]},'connectedlinename':{'type':Sequelize[_0x4310('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4310('0x1')]},'priority':{'type':Sequelize[_0x4310('0x1')]},'destchannel':{'type':Sequelize[_0x4310('0x1')]},'destchannelstate':{'type':Sequelize[_0x4310('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4310('0x1')]},'destcalleridnum':{'type':Sequelize[_0x4310('0x1')]},'destcalleridname':{'type':Sequelize[_0x4310('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x4310('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4310('0x1')]},'destcontext':{'type':Sequelize[_0x4310('0x1')]},'destexten':{'type':Sequelize[_0x4310('0x1')]},'destpriority':{'type':Sequelize[_0x4310('0x1')]},'destuniqueid':{'type':Sequelize[_0x4310('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x4310('0x1')]},'subject':{'type':Sequelize[_0x4310('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x4310('0x1')]},'cc':{'type':Sequelize[_0x4310('0x1')]},'attachment':{'type':Sequelize[_0x4310('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x4310('0x6')]('SENT','SENDING',_0x4310('0x7'),_0x4310('0x8'))},'url':{'type':Sequelize[_0x4310('0x1')]},'app':{'type':Sequelize[_0x4310('0x1')]},'appdata':{'type':Sequelize[_0x4310('0x1')]},'projectId':{'type':Sequelize[_0x4310('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 5753786..fa3c479 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 _0x48a1=['rows','catch','show','params','intersection','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filter','type','VIRTUAL','merge','includeAll','include','findAll'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0x48a1,0xf1));var _0x148a=function(_0x1b1ded,_0x2e53a6){_0x1b1ded=_0x1b1ded-0x0;var _0x3a4921=_0x48a1[_0x1b1ded];return _0x3a4921;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x148a('0x0'));var zipdir=require(_0x148a('0x1'));var jsonpatch=require(_0x148a('0x2'));var rp=require(_0x148a('0x3'));var moment=require(_0x148a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x148a('0x5'));var util=require(_0x148a('0x6'));var path=require(_0x148a('0x7'));var sox=require('sox');var csv=require(_0x148a('0x8'));var ejs=require(_0x148a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x148a('0xa'));var crypto=require(_0x148a('0xb'));var jsforce=require(_0x148a('0xc'));var deskjs=require(_0x148a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x148a('0xe'));var Redis=require(_0x148a('0xf'));var authService=require(_0x148a('0x10'));var qs=require(_0x148a('0x11'));var as=require(_0x148a('0x12'));var hardwareService=require(_0x148a('0x13'));var logger=require(_0x148a('0x14'))('api');var utils=require(_0x148a('0x15'));var config=require(_0x148a('0x16'));var licenseUtil=require(_0x148a('0x17'));var db=require(_0x148a('0x18'))['db'];function respondWithStatusCode(_0x489544,_0x3a23ce){_0x3a23ce=_0x3a23ce||0xcc;return function(_0x40393f){if(_0x40393f){return _0x489544[_0x148a('0x19')](_0x3a23ce);}return _0x489544[_0x148a('0x1a')](_0x3a23ce)[_0x148a('0x1b')]();};}function respondWithResult(_0x2f65fb,_0x33a737){_0x33a737=_0x33a737||0xc8;return function(_0x1842ca){if(_0x1842ca){return _0x2f65fb[_0x148a('0x1a')](_0x33a737)[_0x148a('0x1c')](_0x1842ca);}};}function respondWithFilteredResult(_0x36678b,_0xb25b1f){return function(_0x28d2a1){if(_0x28d2a1){var _0x5948dd=typeof _0xb25b1f['offset']===_0x148a('0x1d')&&typeof _0xb25b1f['limit']==='undefined';var _0x2fc137=_0x28d2a1[_0x148a('0x1e')];var _0x1dd30d=_0x5948dd?0x0:_0xb25b1f['offset'];var _0x395323=_0x5948dd?_0x28d2a1[_0x148a('0x1e')]:_0xb25b1f['offset']+_0xb25b1f['limit'];var _0x3e4e05;if(_0x395323>=_0x2fc137){_0x395323=_0x2fc137;_0x3e4e05=0xc8;}else{_0x3e4e05=0xce;}_0x36678b[_0x148a('0x1a')](_0x3e4e05);return _0x36678b['set'](_0x148a('0x1f'),_0x1dd30d+'-'+_0x395323+'/'+_0x2fc137)[_0x148a('0x1c')](_0x28d2a1);}return null;};}function patchUpdates(_0x19e82d){return function(_0x4d70b9){try{jsonpatch['apply'](_0x4d70b9,_0x19e82d,!![]);}catch(_0x26684c){return BPromise[_0x148a('0x20')](_0x26684c);}return _0x4d70b9[_0x148a('0x21')]();};}function saveUpdates(_0x3b3813,_0x4848ec){return function(_0x489cb7){if(_0x489cb7){return _0x489cb7[_0x148a('0x22')](_0x3b3813)[_0x148a('0x23')](function(_0x46b084){return _0x46b084;});}return null;};}function removeEntity(_0x24a62c,_0x2d09a8){return function(_0x5f5510){if(_0x5f5510){return _0x5f5510[_0x148a('0x24')]()[_0x148a('0x23')](function(){_0x24a62c['status'](0xcc)[_0x148a('0x1b')]();});}};}function handleEntityNotFound(_0x12f708,_0x1ffc89){return function(_0x10166e){if(!_0x10166e){_0x12f708[_0x148a('0x19')](0x194);}return _0x10166e;};}function handleError(_0x195cf8,_0x35bceb){_0x35bceb=_0x35bceb||0x1f4;return function(_0x51beb3){logger[_0x148a('0x25')](_0x51beb3[_0x148a('0x26')]);if(_0x51beb3[_0x148a('0x27')]){delete _0x51beb3[_0x148a('0x27')];}_0x195cf8[_0x148a('0x1a')](_0x35bceb)['send'](_0x51beb3);};}exports[_0x148a('0x28')]=function(_0x48ddef,_0x3e7d8e){var _0x2a079e={},_0x44971d={},_0x3d2ab6={'count':0x0,'rows':[]};var _0x5a7685=_[_0x148a('0x29')](db[_0x148a('0x2a')][_0x148a('0x2b')],function(_0x47b870){return{'name':_0x47b870[_0x148a('0x2c')],'type':_0x47b870['type'][_0x148a('0x2d')]};});_0x44971d[_0x148a('0x2e')]=_[_0x148a('0x29')](_0x5a7685,_0x148a('0x27'));_0x44971d[_0x148a('0x2f')]=_[_0x148a('0x30')](_0x48ddef[_0x148a('0x2f')]);_0x44971d[_0x148a('0x31')]=_['intersection'](_0x44971d[_0x148a('0x2e')],_0x44971d[_0x148a('0x2f')]);_0x2a079e['attributes']=_['intersection'](_0x44971d[_0x148a('0x2e')],qs[_0x148a('0x32')](_0x48ddef[_0x148a('0x2f')][_0x148a('0x32')]));_0x2a079e['attributes']=_0x2a079e[_0x148a('0x33')][_0x148a('0x34')]?_0x2a079e[_0x148a('0x33')]:_0x44971d[_0x148a('0x2e')];if(!_0x48ddef[_0x148a('0x2f')][_0x148a('0x35')](_0x148a('0x36'))){_0x2a079e[_0x148a('0x37')]=qs[_0x148a('0x37')](_0x48ddef[_0x148a('0x2f')][_0x148a('0x37')]);_0x2a079e[_0x148a('0x38')]=qs[_0x148a('0x38')](_0x48ddef[_0x148a('0x2f')][_0x148a('0x38')]);}_0x2a079e[_0x148a('0x39')]=qs[_0x148a('0x3a')](_0x48ddef[_0x148a('0x2f')][_0x148a('0x3a')]);_0x2a079e[_0x148a('0x3b')]=qs[_0x148a('0x31')](_['pick'](_0x48ddef['query'],_0x44971d[_0x148a('0x31')]),_0x5a7685);if(_0x48ddef[_0x148a('0x2f')][_0x148a('0x3c')]){_0x2a079e['where']=_['merge'](_0x2a079e['where'],{'$or':_['map'](_0x5a7685,function(_0x64ddd5){if(_0x64ddd5[_0x148a('0x3d')]!==_0x148a('0x3e')){var _0x39600a={};_0x39600a[_0x64ddd5[_0x148a('0x27')]]={'$like':'%'+_0x48ddef['query'][_0x148a('0x3c')]+'%'};return _0x39600a;}})});}_0x2a079e=_[_0x148a('0x3f')]({},_0x2a079e,_0x48ddef['options']);var _0x5128dc={'where':_0x2a079e[_0x148a('0x3b')]};return db[_0x148a('0x2a')][_0x148a('0x1e')](_0x5128dc)['then'](function(_0x430e4b){_0x3d2ab6['count']=_0x430e4b;if(_0x48ddef[_0x148a('0x2f')][_0x148a('0x40')]){_0x2a079e[_0x148a('0x41')]=[{'all':!![]}];}return db[_0x148a('0x2a')][_0x148a('0x42')](_0x2a079e);})[_0x148a('0x23')](function(_0xcc08bf){_0x3d2ab6[_0x148a('0x43')]=_0xcc08bf;return _0x3d2ab6;})[_0x148a('0x23')](respondWithFilteredResult(_0x3e7d8e,_0x2a079e))[_0x148a('0x44')](handleError(_0x3e7d8e,null));};exports[_0x148a('0x45')]=function(_0x47b1bf,_0x1ebf05){var _0x3ce2fd={'raw':![],'where':{'id':_0x47b1bf[_0x148a('0x46')]['id']}},_0x47c60a={};_0x47c60a[_0x148a('0x2e')]=_[_0x148a('0x30')](db['IntegrationReport']['rawAttributes']);_0x47c60a[_0x148a('0x2f')]=_[_0x148a('0x30')](_0x47b1bf[_0x148a('0x2f')]);_0x47c60a['filters']=_[_0x148a('0x47')](_0x47c60a[_0x148a('0x2e')],_0x47c60a[_0x148a('0x2f')]);_0x3ce2fd[_0x148a('0x33')]=_[_0x148a('0x47')](_0x47c60a[_0x148a('0x2e')],qs[_0x148a('0x32')](_0x47b1bf[_0x148a('0x2f')][_0x148a('0x32')]));_0x3ce2fd[_0x148a('0x33')]=_0x3ce2fd[_0x148a('0x33')][_0x148a('0x34')]?_0x3ce2fd[_0x148a('0x33')]:_0x47c60a['model'];if(_0x47b1bf[_0x148a('0x2f')][_0x148a('0x40')]){_0x3ce2fd[_0x148a('0x41')]=[{'all':!![]}];}_0x3ce2fd=_[_0x148a('0x3f')]({},_0x3ce2fd,_0x47b1bf[_0x148a('0x48')]);return db[_0x148a('0x2a')][_0x148a('0x49')](_0x3ce2fd)[_0x148a('0x23')](handleEntityNotFound(_0x1ebf05,null))['then'](respondWithResult(_0x1ebf05,null))[_0x148a('0x44')](handleError(_0x1ebf05,null));};exports['create']=function(_0x498c6d,_0x15fcfd){return db[_0x148a('0x2a')][_0x148a('0x4a')](_0x498c6d[_0x148a('0x4b')],{})[_0x148a('0x23')](respondWithResult(_0x15fcfd,0xc9))[_0x148a('0x44')](handleError(_0x15fcfd,null));};exports[_0x148a('0x22')]=function(_0x3bfda7,_0x3f0145){if(_0x3bfda7[_0x148a('0x4b')]['id']){delete _0x3bfda7[_0x148a('0x4b')]['id'];}return db[_0x148a('0x2a')][_0x148a('0x49')]({'where':{'id':_0x3bfda7[_0x148a('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f0145,null))[_0x148a('0x23')](saveUpdates(_0x3bfda7[_0x148a('0x4b')],null))['then'](respondWithResult(_0x3f0145,null))[_0x148a('0x44')](handleError(_0x3f0145,null));};exports['destroy']=function(_0x3eb6b0,_0x3ff948){return db['IntegrationReport'][_0x148a('0x49')]({'where':{'id':_0x3eb6b0[_0x148a('0x46')]['id']}})[_0x148a('0x23')](handleEntityNotFound(_0x3ff948,null))[_0x148a('0x23')](removeEntity(_0x3ff948,null))[_0x148a('0x44')](handleError(_0x3ff948,null));};exports[_0x148a('0x4c')]=function(_0x566963,_0x53d5da){return db[_0x148a('0x2a')]['describe']()['then'](respondWithResult(_0x53d5da,null))[_0x148a('0x44')](handleError(_0x53d5da,null));}; \ No newline at end of file +var _0xafa1=['limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined'];(function(_0x4da588,_0x187aeb){var _0x3ee89d=function(_0x21f3d6){while(--_0x21f3d6){_0x4da588['push'](_0x4da588['shift']());}};_0x3ee89d(++_0x187aeb);}(_0xafa1,0xd3));var _0x1afa=function(_0x3b0d12,_0x581b78){_0x3b0d12=_0x3b0d12-0x0;var _0x44eb08=_0xafa1[_0x3b0d12];return _0x44eb08;};'use strict';var emlformat=require(_0x1afa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1afa('0x1'));var jsonpatch=require(_0x1afa('0x2'));var rp=require(_0x1afa('0x3'));var moment=require(_0x1afa('0x4'));var BPromise=require(_0x1afa('0x5'));var Mustache=require(_0x1afa('0x6'));var util=require(_0x1afa('0x7'));var path=require('path');var sox=require(_0x1afa('0x8'));var csv=require(_0x1afa('0x9'));var ejs=require(_0x1afa('0xa'));var fs=require('fs');var fs_extra=require(_0x1afa('0xb'));var _=require(_0x1afa('0xc'));var squel=require(_0x1afa('0xd'));var crypto=require(_0x1afa('0xe'));var jsforce=require(_0x1afa('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1afa('0x9'));var querystring=require(_0x1afa('0x10'));var Papa=require(_0x1afa('0x11'));var Redis=require(_0x1afa('0x12'));var authService=require(_0x1afa('0x13'));var qs=require(_0x1afa('0x14'));var as=require(_0x1afa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1afa('0x16'))(_0x1afa('0x17'));var utils=require(_0x1afa('0x18'));var config=require(_0x1afa('0x19'));var licenseUtil=require(_0x1afa('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a8cb7,_0x8c6a6b){_0x8c6a6b=_0x8c6a6b||0xcc;return function(_0xf6a0b2){if(_0xf6a0b2){return _0x2a8cb7['sendStatus'](_0x8c6a6b);}return _0x2a8cb7[_0x1afa('0x1b')](_0x8c6a6b)[_0x1afa('0x1c')]();};}function respondWithResult(_0x368e43,_0x5870db){_0x5870db=_0x5870db||0xc8;return function(_0x5f1cef){if(_0x5f1cef){return _0x368e43['status'](_0x5870db)[_0x1afa('0x1d')](_0x5f1cef);}};}function respondWithFilteredResult(_0x42b33f,_0x5f1113){return function(_0x1c1466){if(_0x1c1466){var _0x6992f4=typeof _0x5f1113[_0x1afa('0x1e')]===_0x1afa('0x1f')&&typeof _0x5f1113[_0x1afa('0x20')]===_0x1afa('0x1f');var _0x2f4656=_0x1c1466[_0x1afa('0x21')];var _0x1b3db2=_0x6992f4?0x0:_0x5f1113[_0x1afa('0x1e')];var _0x4418a2=_0x6992f4?_0x1c1466[_0x1afa('0x21')]:_0x5f1113[_0x1afa('0x1e')]+_0x5f1113[_0x1afa('0x20')];var _0x1aa43e;if(_0x4418a2>=_0x2f4656){_0x4418a2=_0x2f4656;_0x1aa43e=0xc8;}else{_0x1aa43e=0xce;}_0x42b33f[_0x1afa('0x1b')](_0x1aa43e);return _0x42b33f[_0x1afa('0x22')](_0x1afa('0x23'),_0x1b3db2+'-'+_0x4418a2+'/'+_0x2f4656)['json'](_0x1c1466);}return null;};}function patchUpdates(_0x50feaf){return function(_0x657cac){try{jsonpatch[_0x1afa('0x24')](_0x657cac,_0x50feaf,!![]);}catch(_0x279a47){return BPromise[_0x1afa('0x25')](_0x279a47);}return _0x657cac[_0x1afa('0x26')]();};}function saveUpdates(_0x189263,_0x452997){return function(_0xb2167b){if(_0xb2167b){return _0xb2167b[_0x1afa('0x27')](_0x189263)['then'](function(_0x432ec4){return _0x432ec4;});}return null;};}function removeEntity(_0x1974d1,_0x2a34e0){return function(_0x39faa5){if(_0x39faa5){return _0x39faa5['destroy']()[_0x1afa('0x28')](function(){_0x1974d1['status'](0xcc)[_0x1afa('0x1c')]();});}};}function handleEntityNotFound(_0x4d2d57,_0x3b73c1){return function(_0x535168){if(!_0x535168){_0x4d2d57[_0x1afa('0x29')](0x194);}return _0x535168;};}function handleError(_0x264f0e,_0x441afd){_0x441afd=_0x441afd||0x1f4;return function(_0x34bce1){logger['error'](_0x34bce1[_0x1afa('0x2a')]);if(_0x34bce1[_0x1afa('0x2b')]){delete _0x34bce1[_0x1afa('0x2b')];}_0x264f0e['status'](_0x441afd)[_0x1afa('0x2c')](_0x34bce1);};}exports[_0x1afa('0x2d')]=function(_0x527297,_0x28cede){var _0x58c4d1={},_0x1c24ef={},_0x3fbf26={'count':0x0,'rows':[]};var _0x39d23c=_[_0x1afa('0x2e')](db[_0x1afa('0x2f')][_0x1afa('0x30')],function(_0x13989a){return{'name':_0x13989a[_0x1afa('0x31')],'type':_0x13989a['type'][_0x1afa('0x32')]};});_0x1c24ef[_0x1afa('0x33')]=_[_0x1afa('0x2e')](_0x39d23c,_0x1afa('0x2b'));_0x1c24ef[_0x1afa('0x34')]=_[_0x1afa('0x35')](_0x527297['query']);_0x1c24ef[_0x1afa('0x36')]=_[_0x1afa('0x37')](_0x1c24ef[_0x1afa('0x33')],_0x1c24ef[_0x1afa('0x34')]);_0x58c4d1['attributes']=_[_0x1afa('0x37')](_0x1c24ef[_0x1afa('0x33')],qs[_0x1afa('0x38')](_0x527297[_0x1afa('0x34')][_0x1afa('0x38')]));_0x58c4d1[_0x1afa('0x39')]=_0x58c4d1[_0x1afa('0x39')][_0x1afa('0x3a')]?_0x58c4d1['attributes']:_0x1c24ef[_0x1afa('0x33')];if(!_0x527297[_0x1afa('0x34')][_0x1afa('0x3b')](_0x1afa('0x3c'))){_0x58c4d1[_0x1afa('0x20')]=qs[_0x1afa('0x20')](_0x527297[_0x1afa('0x34')]['limit']);_0x58c4d1[_0x1afa('0x1e')]=qs[_0x1afa('0x1e')](_0x527297[_0x1afa('0x34')][_0x1afa('0x1e')]);}_0x58c4d1[_0x1afa('0x3d')]=qs['sort'](_0x527297[_0x1afa('0x34')][_0x1afa('0x3e')]);_0x58c4d1[_0x1afa('0x3f')]=qs['filters'](_[_0x1afa('0x40')](_0x527297[_0x1afa('0x34')],_0x1c24ef[_0x1afa('0x36')]),_0x39d23c);if(_0x527297[_0x1afa('0x34')][_0x1afa('0x41')]){_0x58c4d1[_0x1afa('0x3f')]=_[_0x1afa('0x42')](_0x58c4d1[_0x1afa('0x3f')],{'$or':_['map'](_0x39d23c,function(_0x46af17){if(_0x46af17[_0x1afa('0x43')]!==_0x1afa('0x44')){var _0x46d837={};_0x46d837[_0x46af17['name']]={'$like':'%'+_0x527297[_0x1afa('0x34')][_0x1afa('0x41')]+'%'};return _0x46d837;}})});}_0x58c4d1=_['merge']({},_0x58c4d1,_0x527297[_0x1afa('0x45')]);var _0x5e676d={'where':_0x58c4d1[_0x1afa('0x3f')]};return db[_0x1afa('0x2f')][_0x1afa('0x21')](_0x5e676d)[_0x1afa('0x28')](function(_0x519d70){_0x3fbf26['count']=_0x519d70;if(_0x527297[_0x1afa('0x34')][_0x1afa('0x46')]){_0x58c4d1[_0x1afa('0x47')]=[{'all':!![]}];}return db[_0x1afa('0x2f')][_0x1afa('0x48')](_0x58c4d1);})['then'](function(_0x4b90af){_0x3fbf26[_0x1afa('0x49')]=_0x4b90af;return _0x3fbf26;})[_0x1afa('0x28')](respondWithFilteredResult(_0x28cede,_0x58c4d1))[_0x1afa('0x4a')](handleError(_0x28cede,null));};exports['show']=function(_0x1aaac6,_0x88105b){var _0x6f36e6={'raw':![],'where':{'id':_0x1aaac6[_0x1afa('0x4b')]['id']}},_0x204fed={};_0x204fed[_0x1afa('0x33')]=_[_0x1afa('0x35')](db[_0x1afa('0x2f')][_0x1afa('0x30')]);_0x204fed[_0x1afa('0x34')]=_[_0x1afa('0x35')](_0x1aaac6[_0x1afa('0x34')]);_0x204fed[_0x1afa('0x36')]=_[_0x1afa('0x37')](_0x204fed[_0x1afa('0x33')],_0x204fed[_0x1afa('0x34')]);_0x6f36e6[_0x1afa('0x39')]=_[_0x1afa('0x37')](_0x204fed[_0x1afa('0x33')],qs[_0x1afa('0x38')](_0x1aaac6[_0x1afa('0x34')][_0x1afa('0x38')]));_0x6f36e6['attributes']=_0x6f36e6[_0x1afa('0x39')][_0x1afa('0x3a')]?_0x6f36e6[_0x1afa('0x39')]:_0x204fed[_0x1afa('0x33')];if(_0x1aaac6['query'][_0x1afa('0x46')]){_0x6f36e6[_0x1afa('0x47')]=[{'all':!![]}];}_0x6f36e6=_[_0x1afa('0x42')]({},_0x6f36e6,_0x1aaac6[_0x1afa('0x45')]);return db['IntegrationReport'][_0x1afa('0x4c')](_0x6f36e6)[_0x1afa('0x28')](handleEntityNotFound(_0x88105b,null))[_0x1afa('0x28')](respondWithResult(_0x88105b,null))[_0x1afa('0x4a')](handleError(_0x88105b,null));};exports[_0x1afa('0x4d')]=function(_0x5dea4f,_0x5a838c){return db[_0x1afa('0x2f')][_0x1afa('0x4d')](_0x5dea4f[_0x1afa('0x4e')],{})['then'](respondWithResult(_0x5a838c,0xc9))[_0x1afa('0x4a')](handleError(_0x5a838c,null));};exports[_0x1afa('0x27')]=function(_0x57543f,_0x156e52){if(_0x57543f[_0x1afa('0x4e')]['id']){delete _0x57543f[_0x1afa('0x4e')]['id'];}return db[_0x1afa('0x2f')][_0x1afa('0x4c')]({'where':{'id':_0x57543f['params']['id']}})['then'](handleEntityNotFound(_0x156e52,null))[_0x1afa('0x28')](saveUpdates(_0x57543f[_0x1afa('0x4e')],null))[_0x1afa('0x28')](respondWithResult(_0x156e52,null))[_0x1afa('0x4a')](handleError(_0x156e52,null));};exports[_0x1afa('0x4f')]=function(_0x48fe34,_0x459a37){return db[_0x1afa('0x2f')][_0x1afa('0x4c')]({'where':{'id':_0x48fe34[_0x1afa('0x4b')]['id']}})[_0x1afa('0x28')](handleEntityNotFound(_0x459a37,null))[_0x1afa('0x28')](removeEntity(_0x459a37,null))[_0x1afa('0x4a')](handleError(_0x459a37,null));};exports[_0x1afa('0x50')]=function(_0x1207c2,_0x191009){return db['IntegrationReport'][_0x1afa('0x50')]()[_0x1afa('0x28')](respondWithResult(_0x191009,null))[_0x1afa('0x4a')](handleError(_0x191009,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index eb5de42..e5ae891 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 _0x9cfe=['lodash','util','../../config/logger','api','bluebird','request-promise','./integrationReport.attributes','exports','IntegrationReport','report_integration'];(function(_0x58e772,_0x1afaf2){var _0x16d989=function(_0x13a1c8){while(--_0x13a1c8){_0x58e772['push'](_0x58e772['shift']());}};_0x16d989(++_0x1afaf2);}(_0x9cfe,0x14a));var _0xe9cf=function(_0x46c66c,_0x993a66){_0x46c66c=_0x46c66c-0x0;var _0x19b2a6=_0x9cfe[_0x46c66c];return _0x19b2a6;};'use strict';var _=require(_0xe9cf('0x0'));var util=require(_0xe9cf('0x1'));var logger=require(_0xe9cf('0x2'))(_0xe9cf('0x3'));var moment=require('moment');var BPromise=require(_0xe9cf('0x4'));var rp=require(_0xe9cf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe9cf('0x6'));module[_0xe9cf('0x7')]=function(_0xc85cf6,_0x654c6a){return _0xc85cf6['define'](_0xe9cf('0x8'),attributes,{'tableName':_0xe9cf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcc2=['api','request-promise','../../config/environment','exports','IntegrationReport','lodash','util','../../config/logger'];(function(_0x99d37,_0x4e7974){var _0x2db098=function(_0x1ebfa2){while(--_0x1ebfa2){_0x99d37['push'](_0x99d37['shift']());}};_0x2db098(++_0x4e7974);}(_0xfcc2,0x1b5));var _0x2fcc=function(_0x3a89dc,_0x54bb1e){_0x3a89dc=_0x3a89dc-0x0;var _0x11c5c9=_0xfcc2[_0x3a89dc];return _0x11c5c9;};'use strict';var _=require(_0x2fcc('0x0'));var util=require(_0x2fcc('0x1'));var logger=require(_0x2fcc('0x2'))(_0x2fcc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2fcc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2fcc('0x5'));var attributes=require('./integrationReport.attributes');module[_0x2fcc('0x6')]=function(_0x19a2b5,_0x4d9f8e){return _0x19a2b5['define'](_0x2fcc('0x7'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index f5d137e..936b9ce 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 _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x463ef0,_0x1989e5){var _0x21fe19=function(_0x38dda5){while(--_0x38dda5){_0x463ef0['push'](_0x463ef0['shift']());}};_0x21fe19(++_0x1989e5);}(_0x57ca,0x108));var _0xa57c=function(_0x1354b1,_0x1fc2ed){_0x1354b1=_0x1354b1-0x0;var _0x4050b9=_0x57ca[_0x1354b1];return _0x4050b9;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0xba34=['../../config/environment','jayson/promise','client','http','request','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','randomstring','../../config/logger','rpc'];(function(_0x48bc67,_0x3bbb21){var _0x36fe97=function(_0x33d0a6){while(--_0x33d0a6){_0x48bc67['push'](_0x48bc67['shift']());}};_0x36fe97(++_0x3bbb21);}(_0xba34,0x119));var _0x4ba3=function(_0x5d5254,_0x36edcf){_0x5d5254=_0x5d5254-0x0;var _0xbabd67=_0xba34[_0x5d5254];return _0xbabd67;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 7c9eb85..7f8186c 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 _0x07e8=['create','addInterval','/:id/sub_intervals/create_many','addIntervals','update','delete','destroy','multer','util','path','express','fs-extra','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07e8,0x10f));var _0x807e=function(_0x321c5e,_0x5b29f4){_0x321c5e=_0x321c5e-0x0;var _0x153a45=_0x07e8[_0x321c5e];return _0x153a45;};'use strict';var multer=require(_0x807e('0x0'));var util=require(_0x807e('0x1'));var path=require(_0x807e('0x2'));var timeout=require('connect-timeout');var express=require(_0x807e('0x3'));var router=express['Router']();var fs_extra=require(_0x807e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x807e('0x5'));var controller=require(_0x807e('0x6'));router[_0x807e('0x7')]('/',auth['isAuthenticated'](),controller[_0x807e('0x8')]);router[_0x807e('0x7')](_0x807e('0x9'),auth[_0x807e('0xa')](),controller[_0x807e('0xb')]);router['get'](_0x807e('0xc'),auth[_0x807e('0xa')](),controller[_0x807e('0xd')]);router[_0x807e('0xe')]('/',auth[_0x807e('0xa')](),controller[_0x807e('0xf')]);router[_0x807e('0xe')](_0x807e('0xc'),auth[_0x807e('0xa')](),controller[_0x807e('0x10')]);router[_0x807e('0xe')](_0x807e('0x11'),auth[_0x807e('0xa')](),controller[_0x807e('0x12')]);router['put'](_0x807e('0x9'),auth[_0x807e('0xa')](),controller[_0x807e('0x13')]);router[_0x807e('0x14')](_0x807e('0x9'),auth[_0x807e('0xa')](),controller[_0x807e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2144=['isAuthenticated','show','/:id/sub_intervals','getIntervals','create','addInterval','addIntervals','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','index','get','/:id'];(function(_0x48b8d7,_0x3fc471){var _0x13637d=function(_0x59c5df){while(--_0x59c5df){_0x48b8d7['push'](_0x48b8d7['shift']());}};_0x13637d(++_0x3fc471);}(_0x2144,0xfa));var _0x4214=function(_0x2b20c7,_0x278d49){_0x2b20c7=_0x2b20c7-0x0;var _0x3a6e02=_0x2144[_0x2b20c7];return _0x3a6e02;};'use strict';var multer=require(_0x4214('0x0'));var util=require(_0x4214('0x1'));var path=require(_0x4214('0x2'));var timeout=require(_0x4214('0x3'));var express=require(_0x4214('0x4'));var router=express[_0x4214('0x5')]();var fs_extra=require(_0x4214('0x6'));var auth=require(_0x4214('0x7'));var interaction=require(_0x4214('0x8'));var config=require(_0x4214('0x9'));var controller=require(_0x4214('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x4214('0xb')]);router[_0x4214('0xc')](_0x4214('0xd'),auth[_0x4214('0xe')](),controller[_0x4214('0xf')]);router[_0x4214('0xc')](_0x4214('0x10'),auth['isAuthenticated'](),controller[_0x4214('0x11')]);router['post']('/',auth[_0x4214('0xe')](),controller[_0x4214('0x12')]);router['post'](_0x4214('0x10'),auth[_0x4214('0xe')](),controller[_0x4214('0x13')]);router['post']('/:id/sub_intervals/create_many',auth[_0x4214('0xe')](),controller[_0x4214('0x14')]);router[_0x4214('0x15')]('/:id',auth[_0x4214('0xe')](),controller[_0x4214('0x16')]);router['delete'](_0x4214('0xd'),auth[_0x4214('0xe')](),controller['destroy']);module[_0x4214('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index c7b0b5f..b6f8bb3 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 _0x6de9=['sequelize','exports','STRING'];(function(_0x4fa4fd,_0x4c656b){var _0x3c50d0=function(_0x223600){while(--_0x223600){_0x4fa4fd['push'](_0x4fa4fd['shift']());}};_0x3c50d0(++_0x4c656b);}(_0x6de9,0x159));var _0x96de=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x6de9[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x96de('0x0'));module[_0x96de('0x1')]={'name':{'type':Sequelize[_0x96de('0x2')]},'description':{'type':Sequelize[_0x96de('0x2')]},'interval':{'type':Sequelize[_0x96de('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x86f7=['exports','STRING','sequelize'];(function(_0xa5676e,_0x553716){var _0x138810=function(_0x2f7625){while(--_0x2f7625){_0xa5676e['push'](_0xa5676e['shift']());}};_0x138810(++_0x553716);}(_0x86f7,0x119));var _0x786f=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x86f7[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0x786f('0x0'));module[_0x786f('0x1')]={'name':{'type':Sequelize[_0x786f('0x2')]},'description':{'type':Sequelize[_0x786f('0x2')]},'interval':{'type':Sequelize[_0x786f('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 19ddf42..2e5f630 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 _0xcb59=['hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','Interval','includeAll','include','catch','rawAttributes','length','user','role','Intervals','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getIntervals','findOne','pick','sequelize','transaction','IntervalId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x47cfa0,_0x176b87){var _0x386b1d=function(_0x5785e5){while(--_0x5785e5){_0x47cfa0['push'](_0x47cfa0['shift']());}};_0x386b1d(++_0x176b87);}(_0xcb59,0x78));var _0x9cb5=function(_0x21a74,_0x384465){_0x21a74=_0x21a74-0x0;var _0x22f44e=_0xcb59[_0x21a74];return _0x22f44e;};'use strict';var emlformat=require(_0x9cb5('0x0'));var rimraf=require(_0x9cb5('0x1'));var zipdir=require(_0x9cb5('0x2'));var jsonpatch=require(_0x9cb5('0x3'));var rp=require(_0x9cb5('0x4'));var moment=require(_0x9cb5('0x5'));var BPromise=require(_0x9cb5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9cb5('0x7'));var csv=require('to-csv');var ejs=require(_0x9cb5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9cb5('0x9'));var squel=require('squel');var crypto=require(_0x9cb5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9cb5('0xb'));var toCsv=require(_0x9cb5('0xc'));var querystring=require(_0x9cb5('0xd'));var Papa=require(_0x9cb5('0xe'));var Redis=require(_0x9cb5('0xf'));var authService=require(_0x9cb5('0x10'));var qs=require(_0x9cb5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cb5('0x12'));var logger=require(_0x9cb5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x9cb5('0x14'));var licenseUtil=require(_0x9cb5('0x15'));var db=require(_0x9cb5('0x16'))['db'];var extensions=require(_0x9cb5('0x17'));function respondWithStatusCode(_0x118afa,_0x159402){_0x159402=_0x159402||0xcc;return function(_0x2a3777){if(_0x2a3777){return _0x118afa[_0x9cb5('0x18')](_0x159402);}return _0x118afa[_0x9cb5('0x19')](_0x159402)[_0x9cb5('0x1a')]();};}function respondWithResult(_0x583eab,_0x2f8e5e){_0x2f8e5e=_0x2f8e5e||0xc8;return function(_0x418aa4){if(_0x418aa4){return _0x583eab[_0x9cb5('0x19')](_0x2f8e5e)[_0x9cb5('0x1b')](_0x418aa4);}};}function respondWithFilteredResult(_0x305638,_0x550627){return function(_0x38e04b){if(_0x38e04b){var _0x177e4d=typeof _0x550627[_0x9cb5('0x1c')]===_0x9cb5('0x1d')&&typeof _0x550627['limit']===_0x9cb5('0x1d');var _0x33e172=_0x38e04b['count'];var _0x270746=_0x177e4d?0x0:_0x550627[_0x9cb5('0x1c')];var _0x29d008=_0x177e4d?_0x38e04b[_0x9cb5('0x1e')]:_0x550627['offset']+_0x550627[_0x9cb5('0x1f')];var _0x567b86;if(_0x29d008>=_0x33e172){_0x29d008=_0x33e172;_0x567b86=0xc8;}else{_0x567b86=0xce;}_0x305638[_0x9cb5('0x19')](_0x567b86);return _0x305638[_0x9cb5('0x20')](_0x9cb5('0x21'),_0x270746+'-'+_0x29d008+'/'+_0x33e172)[_0x9cb5('0x1b')](_0x38e04b);}return null;};}function patchUpdates(_0xb0912b){return function(_0x1e52ec){try{jsonpatch[_0x9cb5('0x22')](_0x1e52ec,_0xb0912b,!![]);}catch(_0x1a2449){return BPromise[_0x9cb5('0x23')](_0x1a2449);}return _0x1e52ec['save']();};}function saveUpdates(_0x1c7614,_0x3f925b){return function(_0x5af6b6){if(_0x5af6b6){return _0x5af6b6[_0x9cb5('0x24')](_0x1c7614)['then'](function(_0x142d51){return _0x142d51;});}return null;};}function removeEntity(_0x1fe4af,_0x1f1a1e){return function(_0xf85e6a){if(_0xf85e6a){return _0xf85e6a[_0x9cb5('0x25')]()[_0x9cb5('0x26')](function(){var _0xd1bb61=_0xf85e6a[_0x9cb5('0x27')]({'plain':!![]});var _0x31f079='Intervals';return db[_0x9cb5('0x28')][_0x9cb5('0x25')]({'where':{'type':_0x31f079,'resourceId':_0xd1bb61['id']}})[_0x9cb5('0x26')](function(){return _0xf85e6a;});})[_0x9cb5('0x26')](function(){_0x1fe4af['status'](0xcc)[_0x9cb5('0x1a')]();});}};}function handleEntityNotFound(_0x178676,_0x5d0cae){return function(_0x4eb124){if(!_0x4eb124){_0x178676[_0x9cb5('0x18')](0x194);}return _0x4eb124;};}function handleError(_0xc625de,_0x399287){_0x399287=_0x399287||0x1f4;return function(_0xd7efa9){logger[_0x9cb5('0x29')](_0xd7efa9[_0x9cb5('0x2a')]);if(_0xd7efa9[_0x9cb5('0x2b')]){delete _0xd7efa9['name'];}_0xc625de[_0x9cb5('0x19')](_0x399287)[_0x9cb5('0x2c')](_0xd7efa9);};}exports[_0x9cb5('0x2d')]=function(_0x1647c8,_0x5b1bff){var _0x47d601={},_0xa40f76={},_0x39a904={'count':0x0,'rows':[]};var _0x36c33a=_[_0x9cb5('0x2e')](db['Interval']['rawAttributes'],function(_0x22f6de){return{'name':_0x22f6de[_0x9cb5('0x2f')],'type':_0x22f6de[_0x9cb5('0x30')][_0x9cb5('0x31')]};});_0xa40f76[_0x9cb5('0x32')]=_[_0x9cb5('0x2e')](_0x36c33a,_0x9cb5('0x2b'));_0xa40f76[_0x9cb5('0x33')]=_[_0x9cb5('0x34')](_0x1647c8[_0x9cb5('0x33')]);_0xa40f76['filters']=_[_0x9cb5('0x35')](_0xa40f76[_0x9cb5('0x32')],_0xa40f76[_0x9cb5('0x33')]);_0x47d601[_0x9cb5('0x36')]=_['intersection'](_0xa40f76[_0x9cb5('0x32')],qs[_0x9cb5('0x37')](_0x1647c8['query'][_0x9cb5('0x37')]));_0x47d601['attributes']=_0x47d601[_0x9cb5('0x36')]['length']?_0x47d601['attributes']:_0xa40f76[_0x9cb5('0x32')];if(!_0x1647c8[_0x9cb5('0x33')][_0x9cb5('0x38')](_0x9cb5('0x39'))){_0x47d601[_0x9cb5('0x1f')]=qs[_0x9cb5('0x1f')](_0x1647c8['query'][_0x9cb5('0x1f')]);_0x47d601[_0x9cb5('0x1c')]=qs[_0x9cb5('0x1c')](_0x1647c8[_0x9cb5('0x33')][_0x9cb5('0x1c')]);}_0x47d601[_0x9cb5('0x3a')]=qs[_0x9cb5('0x3b')](_0x1647c8['query']['sort']);_0x47d601['where']=qs[_0x9cb5('0x3c')](_['pick'](_0x1647c8[_0x9cb5('0x33')],_0xa40f76[_0x9cb5('0x3c')]),_0x36c33a);if(_0x1647c8[_0x9cb5('0x33')][_0x9cb5('0x3d')]){_0x47d601[_0x9cb5('0x3e')]=_[_0x9cb5('0x3f')](_0x47d601[_0x9cb5('0x3e')],{'$or':_[_0x9cb5('0x2e')](_0x36c33a,function(_0x39e7c4){if(_0x39e7c4[_0x9cb5('0x30')]!==_0x9cb5('0x40')){var _0x4c9bd0={};_0x4c9bd0[_0x39e7c4[_0x9cb5('0x2b')]]={'$like':'%'+_0x1647c8['query'][_0x9cb5('0x3d')]+'%'};return _0x4c9bd0;}})});}_0x47d601=_[_0x9cb5('0x3f')]({},_0x47d601,_0x1647c8[_0x9cb5('0x41')]);var _0x51c39f={'where':_0x47d601[_0x9cb5('0x3e')]};return db[_0x9cb5('0x42')][_0x9cb5('0x1e')](_0x51c39f)[_0x9cb5('0x26')](function(_0x28f1cf){_0x39a904[_0x9cb5('0x1e')]=_0x28f1cf;if(_0x1647c8[_0x9cb5('0x33')][_0x9cb5('0x43')]){_0x47d601[_0x9cb5('0x44')]=[{'all':!![]}];}return db[_0x9cb5('0x42')]['findAll'](_0x47d601);})[_0x9cb5('0x26')](function(_0x4cd1c5){_0x39a904['rows']=_0x4cd1c5;return _0x39a904;})[_0x9cb5('0x26')](respondWithFilteredResult(_0x5b1bff,_0x47d601))[_0x9cb5('0x45')](handleError(_0x5b1bff,null));};exports['show']=function(_0x20159f,_0x394bbc){var _0x158392={'raw':!![],'where':{'id':_0x20159f['params']['id']}},_0x4520cf={};_0x4520cf['model']=_[_0x9cb5('0x34')](db['Interval'][_0x9cb5('0x46')]);_0x4520cf['query']=_[_0x9cb5('0x34')](_0x20159f[_0x9cb5('0x33')]);_0x4520cf[_0x9cb5('0x3c')]=_[_0x9cb5('0x35')](_0x4520cf[_0x9cb5('0x32')],_0x4520cf[_0x9cb5('0x33')]);_0x158392['attributes']=_[_0x9cb5('0x35')](_0x4520cf[_0x9cb5('0x32')],qs['fields'](_0x20159f['query']['fields']));_0x158392[_0x9cb5('0x36')]=_0x158392[_0x9cb5('0x36')][_0x9cb5('0x47')]?_0x158392[_0x9cb5('0x36')]:_0x4520cf['model'];if(_0x20159f[_0x9cb5('0x33')][_0x9cb5('0x43')]){_0x158392[_0x9cb5('0x44')]=[{'all':!![]}];}_0x158392=_[_0x9cb5('0x3f')]({},_0x158392,_0x20159f[_0x9cb5('0x41')]);return db[_0x9cb5('0x42')]['find'](_0x158392)[_0x9cb5('0x26')](handleEntityNotFound(_0x394bbc,null))[_0x9cb5('0x26')](respondWithResult(_0x394bbc,null))[_0x9cb5('0x45')](handleError(_0x394bbc,null));};exports['create']=function(_0x2bf42a,_0x51e5a6){return db['Interval']['create'](_0x2bf42a['body'],{})[_0x9cb5('0x26')](function(_0x1f410a){var _0x2a633a=_0x2bf42a[_0x9cb5('0x48')]['get']({'plain':!![]});if(!_0x2a633a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a633a[_0x9cb5('0x49')]==='user'){var _0x3b78eb=_0x1f410a[_0x9cb5('0x27')]({'plain':!![]});var _0x4e7fee=_0x9cb5('0x4a');return db[_0x9cb5('0x4b')][_0x9cb5('0x4c')]({'where':{'name':_0x4e7fee,'userProfileId':_0x2a633a[_0x9cb5('0x4d')]},'raw':!![]})['then'](function(_0x110fcf){if(_0x110fcf&&_0x110fcf['autoAssociation']===0x0){return db[_0x9cb5('0x28')][_0x9cb5('0x4e')]({'name':_0x3b78eb[_0x9cb5('0x2b')],'resourceId':_0x3b78eb['id'],'type':_0x110fcf[_0x9cb5('0x2b')],'sectionId':_0x110fcf['id']},{})[_0x9cb5('0x26')](function(){return _0x1f410a;});}else{return _0x1f410a;}})['catch'](function(_0x4ca048){logger[_0x9cb5('0x29')](_0x9cb5('0x4f'),_0x4ca048);throw _0x4ca048;});}return _0x1f410a;})[_0x9cb5('0x26')](respondWithResult(_0x51e5a6,0xc9))[_0x9cb5('0x45')](handleError(_0x51e5a6,null));};exports['update']=function(_0x4b00e5,_0x21b642){if(_0x4b00e5[_0x9cb5('0x50')]['id']){delete _0x4b00e5['body']['id'];}return db[_0x9cb5('0x42')]['find']({'where':{'id':_0x4b00e5[_0x9cb5('0x51')]['id']}})[_0x9cb5('0x26')](handleEntityNotFound(_0x21b642,null))['then'](saveUpdates(_0x4b00e5[_0x9cb5('0x50')],null))['then'](respondWithResult(_0x21b642,null))[_0x9cb5('0x45')](handleError(_0x21b642,null));};exports[_0x9cb5('0x25')]=function(_0x344dbf,_0x94f64e){return db[_0x9cb5('0x42')][_0x9cb5('0x4c')]({'where':{'id':_0x344dbf[_0x9cb5('0x51')]['id']}})[_0x9cb5('0x26')](handleEntityNotFound(_0x94f64e,null))[_0x9cb5('0x26')](removeEntity(_0x94f64e,null))[_0x9cb5('0x45')](handleError(_0x94f64e,null));};exports['addInterval']=function(_0x4bdb08,_0x1d7d6d,_0x3b5031){if(_0x4bdb08[_0x9cb5('0x50')]['id']){delete _0x4bdb08['body']['id'];}return db['Interval'][_0x9cb5('0x4c')]({'where':{'id':_0x4bdb08[_0x9cb5('0x51')]['id']}})[_0x9cb5('0x26')](handleEntityNotFound(_0x1d7d6d,null))[_0x9cb5('0x26')](function(_0x204be0){if(_0x204be0){_0x4bdb08[_0x9cb5('0x50')]['IntervalId']=_0x204be0['id'];return db[_0x9cb5('0x42')][_0x9cb5('0x4e')](_0x4bdb08[_0x9cb5('0x50')]);}})['then'](respondWithResult(_0x1d7d6d,null))[_0x9cb5('0x45')](handleError(_0x1d7d6d,null));};exports[_0x9cb5('0x52')]=function(_0x5ab549,_0x4f907a,_0x1d7eac){var _0x540378={};var _0xba2a4={};var _0x35d2ba;var _0x1d905d;return db[_0x9cb5('0x42')][_0x9cb5('0x53')]({'where':{'id':_0x5ab549[_0x9cb5('0x51')]['id']}})[_0x9cb5('0x26')](handleEntityNotFound(_0x4f907a,null))['then'](function(_0x1b525c){if(_0x1b525c){_0x35d2ba=_0x1b525c;_0xba2a4[_0x9cb5('0x32')]=_[_0x9cb5('0x34')](db[_0x9cb5('0x42')]['rawAttributes']);_0xba2a4[_0x9cb5('0x33')]=_['keys'](_0x5ab549[_0x9cb5('0x33')]);_0xba2a4[_0x9cb5('0x3c')]=_['intersection'](_0xba2a4[_0x9cb5('0x32')],_0xba2a4[_0x9cb5('0x33')]);_0x540378['attributes']=_[_0x9cb5('0x35')](_0xba2a4[_0x9cb5('0x32')],qs[_0x9cb5('0x37')](_0x5ab549[_0x9cb5('0x33')]['fields']));_0x540378['attributes']=_0x540378[_0x9cb5('0x36')][_0x9cb5('0x47')]?_0x540378[_0x9cb5('0x36')]:_0xba2a4[_0x9cb5('0x32')];_0x540378[_0x9cb5('0x3a')]=qs[_0x9cb5('0x3b')](_0x5ab549[_0x9cb5('0x33')][_0x9cb5('0x3b')]);_0x540378[_0x9cb5('0x3e')]=qs[_0x9cb5('0x3c')](_[_0x9cb5('0x54')](_0x5ab549[_0x9cb5('0x33')],_0xba2a4['filters']));if(_0x5ab549['query'][_0x9cb5('0x3d')]){_0x540378[_0x9cb5('0x3e')]=_[_0x9cb5('0x3f')](_0x540378[_0x9cb5('0x3e')],{'$or':_[_0x9cb5('0x2e')](_0x540378['attributes'],function(_0x819c24){var _0x2ff082={};_0x2ff082[_0x819c24]={'$like':'%'+_0x5ab549[_0x9cb5('0x33')]['filter']+'%'};return _0x2ff082;})});}_0x540378=_['merge']({},_0x540378,_0x5ab549[_0x9cb5('0x41')]);return _0x35d2ba[_0x9cb5('0x52')](_0x540378);}})[_0x9cb5('0x26')](function(_0x31cbd8){if(_0x31cbd8){_0x1d905d=_0x31cbd8[_0x9cb5('0x47')];if(!_0x5ab549[_0x9cb5('0x33')]['hasOwnProperty']('nolimit')){_0x540378['limit']=qs['limit'](_0x5ab549[_0x9cb5('0x33')][_0x9cb5('0x1f')]);_0x540378[_0x9cb5('0x1c')]=qs['offset'](_0x5ab549[_0x9cb5('0x33')][_0x9cb5('0x1c')]);}return _0x35d2ba[_0x9cb5('0x52')](_0x540378);}})[_0x9cb5('0x26')](function(_0x12138f){if(_0x12138f){return _0x12138f?{'count':_0x1d905d,'rows':_0x12138f}:null;}})[_0x9cb5('0x26')](respondWithResult(_0x4f907a,null))[_0x9cb5('0x45')](handleError(_0x4f907a,null));};exports['addIntervals']=function(_0x46ce0e,_0x1183ca,_0x1ea869){return db[_0x9cb5('0x42')][_0x9cb5('0x53')]({'where':{'id':_0x46ce0e['params']['id']}})[_0x9cb5('0x26')](handleEntityNotFound(_0x1183ca,null))[_0x9cb5('0x26')](function(_0x263f6c){if(_0x263f6c){return db[_0x9cb5('0x55')][_0x9cb5('0x56')](function(_0x3d917b){return db['Interval'][_0x9cb5('0x25')]({'where':{'IntervalId':_0x46ce0e[_0x9cb5('0x51')]['id']},'transaction':_0x3d917b})['then'](function(_0x5387e6){var _0x1739e9=_[_0x9cb5('0x2e')](_0x46ce0e[_0x9cb5('0x50')],function(_0x5f3ad0){delete _0x5f3ad0['id'];_0x5f3ad0[_0x9cb5('0x57')]=_0x46ce0e['params']['id'];return _0x5f3ad0;});return db['Interval']['bulkCreate'](_0x1739e9,{'transaction':_0x3d917b});});})['then'](function(){return db[_0x9cb5('0x42')]['findAll']({'where':{'IntervalId':_0x46ce0e[_0x9cb5('0x51')]['id']}});});}})['then'](respondWithResult(_0x1183ca,null))['catch'](handleError(_0x1183ca,null));}; \ No newline at end of file +var _0xdcbb=['catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','destroy','error','stack','name','send','index','map','Interval','rawAttributes','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x79856,_0x2a01e1){var _0x38fab9=function(_0x3fbba7){while(--_0x3fbba7){_0x79856['push'](_0x79856['shift']());}};_0x38fab9(++_0x2a01e1);}(_0xdcbb,0x17c));var _0xbdcb=function(_0x2a12ec,_0x238ce2){_0x2a12ec=_0x2a12ec-0x0;var _0x192574=_0xdcbb[_0x2a12ec];return _0x192574;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbdcb('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbdcb('0x1'));var moment=require(_0xbdcb('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbdcb('0x3'));var path=require(_0xbdcb('0x4'));var sox=require(_0xbdcb('0x5'));var csv=require('to-csv');var ejs=require(_0xbdcb('0x6'));var fs=require('fs');var fs_extra=require(_0xbdcb('0x7'));var _=require('lodash');var squel=require(_0xbdcb('0x8'));var crypto=require(_0xbdcb('0x9'));var jsforce=require(_0xbdcb('0xa'));var deskjs=require(_0xbdcb('0xb'));var toCsv=require(_0xbdcb('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbdcb('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xbdcb('0xe'));var hardwareService=require(_0xbdcb('0xf'));var logger=require(_0xbdcb('0x10'))(_0xbdcb('0x11'));var utils=require(_0xbdcb('0x12'));var config=require(_0xbdcb('0x13'));var licenseUtil=require(_0xbdcb('0x14'));var db=require('../../mysqldb')['db'];var extensions=require(_0xbdcb('0x15'));function respondWithStatusCode(_0x1984dd,_0x2e1dea){_0x2e1dea=_0x2e1dea||0xcc;return function(_0x668fd8){if(_0x668fd8){return _0x1984dd[_0xbdcb('0x16')](_0x2e1dea);}return _0x1984dd[_0xbdcb('0x17')](_0x2e1dea)[_0xbdcb('0x18')]();};}function respondWithResult(_0x311b9a,_0x1e30d8){_0x1e30d8=_0x1e30d8||0xc8;return function(_0x5cb012){if(_0x5cb012){return _0x311b9a['status'](_0x1e30d8)[_0xbdcb('0x19')](_0x5cb012);}};}function respondWithFilteredResult(_0x573513,_0x4eeefc){return function(_0x3d38cf){if(_0x3d38cf){var _0xf5a34c=typeof _0x4eeefc['offset']==='undefined'&&typeof _0x4eeefc[_0xbdcb('0x1a')]===_0xbdcb('0x1b');var _0x14ec6c=_0x3d38cf['count'];var _0x3733dc=_0xf5a34c?0x0:_0x4eeefc[_0xbdcb('0x1c')];var _0x27a1b4=_0xf5a34c?_0x3d38cf[_0xbdcb('0x1d')]:_0x4eeefc[_0xbdcb('0x1c')]+_0x4eeefc[_0xbdcb('0x1a')];var _0x396c8b;if(_0x27a1b4>=_0x14ec6c){_0x27a1b4=_0x14ec6c;_0x396c8b=0xc8;}else{_0x396c8b=0xce;}_0x573513['status'](_0x396c8b);return _0x573513[_0xbdcb('0x1e')](_0xbdcb('0x1f'),_0x3733dc+'-'+_0x27a1b4+'/'+_0x14ec6c)[_0xbdcb('0x19')](_0x3d38cf);}return null;};}function patchUpdates(_0xd9f25e){return function(_0x2f96cb){try{jsonpatch[_0xbdcb('0x20')](_0x2f96cb,_0xd9f25e,!![]);}catch(_0x12148b){return BPromise[_0xbdcb('0x21')](_0x12148b);}return _0x2f96cb[_0xbdcb('0x22')]();};}function saveUpdates(_0x449b58,_0x432991){return function(_0x3d1792){if(_0x3d1792){return _0x3d1792[_0xbdcb('0x23')](_0x449b58)['then'](function(_0x2b5170){return _0x2b5170;});}return null;};}function removeEntity(_0x5ad5ab,_0x127a75){return function(_0x193192){if(_0x193192){return _0x193192['destroy']()[_0xbdcb('0x24')](function(){var _0x470533=_0x193192[_0xbdcb('0x25')]({'plain':!![]});var _0x5cd483=_0xbdcb('0x26');return db[_0xbdcb('0x27')][_0xbdcb('0x28')]({'where':{'type':_0x5cd483,'resourceId':_0x470533['id']}})[_0xbdcb('0x24')](function(){return _0x193192;});})['then'](function(){_0x5ad5ab['status'](0xcc)[_0xbdcb('0x18')]();});}};}function handleEntityNotFound(_0x23bd52,_0x584346){return function(_0x818f9b){if(!_0x818f9b){_0x23bd52['sendStatus'](0x194);}return _0x818f9b;};}function handleError(_0x4a8961,_0x42d02d){_0x42d02d=_0x42d02d||0x1f4;return function(_0x265058){logger[_0xbdcb('0x29')](_0x265058[_0xbdcb('0x2a')]);if(_0x265058[_0xbdcb('0x2b')]){delete _0x265058[_0xbdcb('0x2b')];}_0x4a8961['status'](_0x42d02d)[_0xbdcb('0x2c')](_0x265058);};}exports[_0xbdcb('0x2d')]=function(_0x4ea5d8,_0x258433){var _0x3976f0={},_0x9cbd4e={},_0x36072d={'count':0x0,'rows':[]};var _0x59578f=_[_0xbdcb('0x2e')](db[_0xbdcb('0x2f')][_0xbdcb('0x30')],function(_0x334f84){return{'name':_0x334f84['fieldName'],'type':_0x334f84['type']['key']};});_0x9cbd4e[_0xbdcb('0x31')]=_['map'](_0x59578f,_0xbdcb('0x2b'));_0x9cbd4e[_0xbdcb('0x32')]=_[_0xbdcb('0x33')](_0x4ea5d8[_0xbdcb('0x32')]);_0x9cbd4e[_0xbdcb('0x34')]=_['intersection'](_0x9cbd4e[_0xbdcb('0x31')],_0x9cbd4e['query']);_0x3976f0['attributes']=_[_0xbdcb('0x35')](_0x9cbd4e[_0xbdcb('0x31')],qs[_0xbdcb('0x36')](_0x4ea5d8['query'][_0xbdcb('0x36')]));_0x3976f0[_0xbdcb('0x37')]=_0x3976f0[_0xbdcb('0x37')]['length']?_0x3976f0[_0xbdcb('0x37')]:_0x9cbd4e['model'];if(!_0x4ea5d8[_0xbdcb('0x32')][_0xbdcb('0x38')](_0xbdcb('0x39'))){_0x3976f0['limit']=qs[_0xbdcb('0x1a')](_0x4ea5d8[_0xbdcb('0x32')][_0xbdcb('0x1a')]);_0x3976f0['offset']=qs['offset'](_0x4ea5d8['query'][_0xbdcb('0x1c')]);}_0x3976f0[_0xbdcb('0x3a')]=qs[_0xbdcb('0x3b')](_0x4ea5d8[_0xbdcb('0x32')][_0xbdcb('0x3b')]);_0x3976f0[_0xbdcb('0x3c')]=qs['filters'](_['pick'](_0x4ea5d8['query'],_0x9cbd4e[_0xbdcb('0x34')]),_0x59578f);if(_0x4ea5d8['query']['filter']){_0x3976f0[_0xbdcb('0x3c')]=_['merge'](_0x3976f0[_0xbdcb('0x3c')],{'$or':_[_0xbdcb('0x2e')](_0x59578f,function(_0x3c91b5){if(_0x3c91b5[_0xbdcb('0x3d')]!==_0xbdcb('0x3e')){var _0x5ec3c8={};_0x5ec3c8[_0x3c91b5['name']]={'$like':'%'+_0x4ea5d8['query'][_0xbdcb('0x3f')]+'%'};return _0x5ec3c8;}})});}_0x3976f0=_[_0xbdcb('0x40')]({},_0x3976f0,_0x4ea5d8[_0xbdcb('0x41')]);var _0x60ba16={'where':_0x3976f0[_0xbdcb('0x3c')]};return db[_0xbdcb('0x2f')][_0xbdcb('0x1d')](_0x60ba16)[_0xbdcb('0x24')](function(_0x50991f){_0x36072d[_0xbdcb('0x1d')]=_0x50991f;if(_0x4ea5d8['query'][_0xbdcb('0x42')]){_0x3976f0[_0xbdcb('0x43')]=[{'all':!![]}];}return db[_0xbdcb('0x2f')][_0xbdcb('0x44')](_0x3976f0);})[_0xbdcb('0x24')](function(_0x4d3a8c){_0x36072d[_0xbdcb('0x45')]=_0x4d3a8c;return _0x36072d;})[_0xbdcb('0x24')](respondWithFilteredResult(_0x258433,_0x3976f0))[_0xbdcb('0x46')](handleError(_0x258433,null));};exports[_0xbdcb('0x47')]=function(_0x8c6179,_0x248136){var _0x2f293b={'raw':!![],'where':{'id':_0x8c6179[_0xbdcb('0x48')]['id']}},_0x183b25={};_0x183b25[_0xbdcb('0x31')]=_[_0xbdcb('0x33')](db[_0xbdcb('0x2f')][_0xbdcb('0x30')]);_0x183b25[_0xbdcb('0x32')]=_[_0xbdcb('0x33')](_0x8c6179['query']);_0x183b25[_0xbdcb('0x34')]=_['intersection'](_0x183b25[_0xbdcb('0x31')],_0x183b25[_0xbdcb('0x32')]);_0x2f293b[_0xbdcb('0x37')]=_['intersection'](_0x183b25[_0xbdcb('0x31')],qs[_0xbdcb('0x36')](_0x8c6179[_0xbdcb('0x32')][_0xbdcb('0x36')]));_0x2f293b[_0xbdcb('0x37')]=_0x2f293b[_0xbdcb('0x37')][_0xbdcb('0x49')]?_0x2f293b[_0xbdcb('0x37')]:_0x183b25[_0xbdcb('0x31')];if(_0x8c6179['query'][_0xbdcb('0x42')]){_0x2f293b[_0xbdcb('0x43')]=[{'all':!![]}];}_0x2f293b=_[_0xbdcb('0x40')]({},_0x2f293b,_0x8c6179[_0xbdcb('0x41')]);return db[_0xbdcb('0x2f')][_0xbdcb('0x4a')](_0x2f293b)[_0xbdcb('0x24')](handleEntityNotFound(_0x248136,null))[_0xbdcb('0x24')](respondWithResult(_0x248136,null))[_0xbdcb('0x46')](handleError(_0x248136,null));};exports['create']=function(_0x4234b6,_0xd67822){return db[_0xbdcb('0x2f')][_0xbdcb('0x4b')](_0x4234b6[_0xbdcb('0x4c')],{})[_0xbdcb('0x24')](function(_0x1a7ecb){var _0x2bfb6e=_0x4234b6[_0xbdcb('0x4d')][_0xbdcb('0x25')]({'plain':!![]});if(!_0x2bfb6e)throw new Error(_0xbdcb('0x4e'));if(_0x2bfb6e[_0xbdcb('0x4f')]==='user'){var _0xa79f04=_0x1a7ecb['get']({'plain':!![]});var _0x81cd08=_0xbdcb('0x26');return db[_0xbdcb('0x50')]['find']({'where':{'name':_0x81cd08,'userProfileId':_0x2bfb6e['userProfileId']},'raw':!![]})[_0xbdcb('0x24')](function(_0xf137a9){if(_0xf137a9&&_0xf137a9[_0xbdcb('0x51')]===0x0){return db[_0xbdcb('0x27')][_0xbdcb('0x4b')]({'name':_0xa79f04[_0xbdcb('0x2b')],'resourceId':_0xa79f04['id'],'type':_0xf137a9[_0xbdcb('0x2b')],'sectionId':_0xf137a9['id']},{})[_0xbdcb('0x24')](function(){return _0x1a7ecb;});}else{return _0x1a7ecb;}})[_0xbdcb('0x46')](function(_0xee90b5){logger[_0xbdcb('0x29')](_0xbdcb('0x52'),_0xee90b5);throw _0xee90b5;});}return _0x1a7ecb;})[_0xbdcb('0x24')](respondWithResult(_0xd67822,0xc9))['catch'](handleError(_0xd67822,null));};exports[_0xbdcb('0x23')]=function(_0x3b666b,_0x26624d){if(_0x3b666b[_0xbdcb('0x4c')]['id']){delete _0x3b666b[_0xbdcb('0x4c')]['id'];}return db[_0xbdcb('0x2f')][_0xbdcb('0x4a')]({'where':{'id':_0x3b666b['params']['id']}})[_0xbdcb('0x24')](handleEntityNotFound(_0x26624d,null))[_0xbdcb('0x24')](saveUpdates(_0x3b666b['body'],null))['then'](respondWithResult(_0x26624d,null))[_0xbdcb('0x46')](handleError(_0x26624d,null));};exports[_0xbdcb('0x28')]=function(_0x18b28b,_0x1fd641){return db[_0xbdcb('0x2f')]['find']({'where':{'id':_0x18b28b['params']['id']}})[_0xbdcb('0x24')](handleEntityNotFound(_0x1fd641,null))['then'](removeEntity(_0x1fd641,null))[_0xbdcb('0x46')](handleError(_0x1fd641,null));};exports[_0xbdcb('0x53')]=function(_0x17be1a,_0x4086cc,_0x5ea147){if(_0x17be1a[_0xbdcb('0x4c')]['id']){delete _0x17be1a['body']['id'];}return db[_0xbdcb('0x2f')]['find']({'where':{'id':_0x17be1a['params']['id']}})[_0xbdcb('0x24')](handleEntityNotFound(_0x4086cc,null))['then'](function(_0x5c2022){if(_0x5c2022){_0x17be1a[_0xbdcb('0x4c')][_0xbdcb('0x54')]=_0x5c2022['id'];return db[_0xbdcb('0x2f')][_0xbdcb('0x4b')](_0x17be1a[_0xbdcb('0x4c')]);}})[_0xbdcb('0x24')](respondWithResult(_0x4086cc,null))['catch'](handleError(_0x4086cc,null));};exports[_0xbdcb('0x55')]=function(_0x416967,_0x2172cd,_0x570aaa){var _0x1634f6={};var _0x2f747b={};var _0x280714;var _0x5b1b65;return db[_0xbdcb('0x2f')][_0xbdcb('0x56')]({'where':{'id':_0x416967[_0xbdcb('0x48')]['id']}})[_0xbdcb('0x24')](handleEntityNotFound(_0x2172cd,null))[_0xbdcb('0x24')](function(_0x51cefc){if(_0x51cefc){_0x280714=_0x51cefc;_0x2f747b['model']=_[_0xbdcb('0x33')](db[_0xbdcb('0x2f')][_0xbdcb('0x30')]);_0x2f747b[_0xbdcb('0x32')]=_[_0xbdcb('0x33')](_0x416967[_0xbdcb('0x32')]);_0x2f747b[_0xbdcb('0x34')]=_[_0xbdcb('0x35')](_0x2f747b[_0xbdcb('0x31')],_0x2f747b[_0xbdcb('0x32')]);_0x1634f6[_0xbdcb('0x37')]=_[_0xbdcb('0x35')](_0x2f747b[_0xbdcb('0x31')],qs[_0xbdcb('0x36')](_0x416967[_0xbdcb('0x32')][_0xbdcb('0x36')]));_0x1634f6[_0xbdcb('0x37')]=_0x1634f6[_0xbdcb('0x37')][_0xbdcb('0x49')]?_0x1634f6['attributes']:_0x2f747b[_0xbdcb('0x31')];_0x1634f6[_0xbdcb('0x3a')]=qs[_0xbdcb('0x3b')](_0x416967['query'][_0xbdcb('0x3b')]);_0x1634f6[_0xbdcb('0x3c')]=qs[_0xbdcb('0x34')](_['pick'](_0x416967[_0xbdcb('0x32')],_0x2f747b[_0xbdcb('0x34')]));if(_0x416967[_0xbdcb('0x32')][_0xbdcb('0x3f')]){_0x1634f6[_0xbdcb('0x3c')]=_[_0xbdcb('0x40')](_0x1634f6[_0xbdcb('0x3c')],{'$or':_[_0xbdcb('0x2e')](_0x1634f6[_0xbdcb('0x37')],function(_0x16e181){var _0x1bb5bc={};_0x1bb5bc[_0x16e181]={'$like':'%'+_0x416967[_0xbdcb('0x32')][_0xbdcb('0x3f')]+'%'};return _0x1bb5bc;})});}_0x1634f6=_[_0xbdcb('0x40')]({},_0x1634f6,_0x416967[_0xbdcb('0x41')]);return _0x280714['getIntervals'](_0x1634f6);}})[_0xbdcb('0x24')](function(_0x783aea){if(_0x783aea){_0x5b1b65=_0x783aea[_0xbdcb('0x49')];if(!_0x416967[_0xbdcb('0x32')][_0xbdcb('0x38')](_0xbdcb('0x39'))){_0x1634f6['limit']=qs[_0xbdcb('0x1a')](_0x416967[_0xbdcb('0x32')][_0xbdcb('0x1a')]);_0x1634f6['offset']=qs[_0xbdcb('0x1c')](_0x416967[_0xbdcb('0x32')]['offset']);}return _0x280714[_0xbdcb('0x55')](_0x1634f6);}})['then'](function(_0x49ab3d){if(_0x49ab3d){return _0x49ab3d?{'count':_0x5b1b65,'rows':_0x49ab3d}:null;}})['then'](respondWithResult(_0x2172cd,null))[_0xbdcb('0x46')](handleError(_0x2172cd,null));};exports[_0xbdcb('0x57')]=function(_0x23663c,_0x2bafeb,_0x445fe6){return db[_0xbdcb('0x2f')][_0xbdcb('0x56')]({'where':{'id':_0x23663c[_0xbdcb('0x48')]['id']}})['then'](handleEntityNotFound(_0x2bafeb,null))['then'](function(_0x2a8c84){if(_0x2a8c84){return db[_0xbdcb('0x58')][_0xbdcb('0x59')](function(_0x3eb471){return db[_0xbdcb('0x2f')]['destroy']({'where':{'IntervalId':_0x23663c[_0xbdcb('0x48')]['id']},'transaction':_0x3eb471})['then'](function(_0x276e3f){var _0xf2cd58=_['map'](_0x23663c[_0xbdcb('0x4c')],function(_0x5496e2){delete _0x5496e2['id'];_0x5496e2['IntervalId']=_0x23663c[_0xbdcb('0x48')]['id'];return _0x5496e2;});return db[_0xbdcb('0x2f')]['bulkCreate'](_0xf2cd58,{'transaction':_0x3eb471});});})[_0xbdcb('0x24')](function(){return db[_0xbdcb('0x2f')][_0xbdcb('0x44')]({'where':{'IntervalId':_0x23663c['params']['id']}});});}})[_0xbdcb('0x24')](respondWithResult(_0x2bafeb,null))[_0xbdcb('0x46')](handleError(_0x2bafeb,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 62c59eb..54c07e2 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 _0x7c22=['bluebird','path','rimraf','../../config/environment','exports','tools_intervals','rewrite','util','../../config/logger','api','moment'];(function(_0x18f396,_0x174d17){var _0x3ba532=function(_0x2bc92f){while(--_0x2bc92f){_0x18f396['push'](_0x18f396['shift']());}};_0x3ba532(++_0x174d17);}(_0x7c22,0x1bf));var _0x27c2=function(_0x2e8b89,_0x267529){_0x2e8b89=_0x2e8b89-0x0;var _0x4b6f1f=_0x7c22[_0x2e8b89];return _0x4b6f1f;};'use strict';var _=require('lodash');var util=require(_0x27c2('0x0'));var logger=require(_0x27c2('0x1'))(_0x27c2('0x2'));var moment=require(_0x27c2('0x3'));var BPromise=require(_0x27c2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27c2('0x5'));var rimraf=require(_0x27c2('0x6'));var config=require(_0x27c2('0x7'));var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');module[_0x27c2('0x8')]=function(_0x19e473,_0x58c5c6){return _0x19e473['define']('Interval',attributes,{'tableName':_0x27c2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x160310,_0x64ee3f){extensions[_0x27c2('0xa')](_0x19e473,_0x160310);},'afterBulkCreate':function(_0x26066a,_0x1ac1e7,_0xd1cb14){_0xd1cb14();extensions[_0x27c2('0xa')](_0x19e473,_0x26066a[0x0]);},'afterUpdate':function(_0x4da50a,_0x2f09c2){extensions[_0x27c2('0xa')](_0x19e473,_0x4da50a);},'afterDestroy':function(_0x1b55d6,_0x5c2fe5){extensions[_0x27c2('0xa')](_0x19e473,_0x1b55d6);}}});}; \ No newline at end of file +var _0x88e9=['bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','rewrite','lodash','util','../../config/logger','api','moment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x88e9,0x18b));var _0x988e=function(_0x39158d,_0x9d3d4b){_0x39158d=_0x39158d-0x0;var _0x4a16f9=_0x88e9[_0x39158d];return _0x4a16f9;};'use strict';var _=require(_0x988e('0x0'));var util=require(_0x988e('0x1'));var logger=require(_0x988e('0x2'))(_0x988e('0x3'));var moment=require(_0x988e('0x4'));var BPromise=require(_0x988e('0x5'));var rp=require(_0x988e('0x6'));var fs=require('fs');var path=require(_0x988e('0x7'));var rimraf=require(_0x988e('0x8'));var config=require(_0x988e('0x9'));var attributes=require(_0x988e('0xa'));var extensions=require(_0x988e('0xb'));module[_0x988e('0xc')]=function(_0x4e214e,_0x2acf57){return _0x4e214e[_0x988e('0xd')](_0x988e('0xe'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5dc291,_0x227954){extensions[_0x988e('0xf')](_0x4e214e,_0x5dc291);},'afterBulkCreate':function(_0x694c29,_0x4b7a29,_0x16cbdf){_0x16cbdf();extensions[_0x988e('0xf')](_0x4e214e,_0x694c29[0x0]);},'afterUpdate':function(_0x483baa,_0x1f33bf){extensions[_0x988e('0xf')](_0x4e214e,_0x483baa);},'afterDestroy':function(_0x659650,_0x428662){extensions[_0x988e('0xf')](_0x4e214e,_0x659650);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index d3d6a9d..dfc2b3a 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(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 469eda6..1e722fd 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x27d106,_0x1226fb){var _0x3f10c7=function(_0x129b68){while(--_0x129b68){_0x27d106['push'](_0x27d106['shift']());}};_0x3f10c7(++_0x1226fb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c57d6,_0x4207ae){_0x1c57d6=_0x1c57d6-0x0;var _0x496414=_0x5f2f[_0x1c57d6];return _0x496414;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x512a57,_0x1b51cd){var _0x19d788=function(_0x1f1e47){while(--_0x1f1e47){_0x512a57['push'](_0x512a57['shift']());}};_0x19d788(++_0x1b51cd);}(_0xadb5,0xad));var _0x5adb=function(_0x9107b3,_0x152f7d){_0x9107b3=_0x9107b3-0x0;var _0x4919f4=_0xadb5[_0x9107b3];return _0x4919f4;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 5b00555..4e1f6cd 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 _0x145a=['Report','description','stringify','issuetype','Bug','email','fields','customfield_11501','oldToken','customfield_11502','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','toString','base64','request','utf8','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','summary'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x145a,0xc6));var _0xa145=function(_0x3b20ef,_0xf0638a){_0x3b20ef=_0x3b20ef-0x0;var _0x301416=_0x145a[_0x3b20ef];return _0x301416;};'use strict';var BPromise=require(_0xa145('0x0'));var https=require(_0xa145('0x1'));var logger=require(_0xa145('0x2'))(_0xa145('0x3'));var USERNAME='support';var PASSWORD=_0xa145('0x4');function openIssue(_0x598dfe,_0x5eaf97){var _0x55576b={'fields':{'project':{'key':_0x598dfe[_0xa145('0x5')]||'MOTGUI'},'summary':(_0x598dfe[_0xa145('0x6')]||_0xa145('0x7'))+'\x20from\x20'+_0x598dfe['ip'],'description':_0x598dfe[_0xa145('0x8')]||JSON[_0xa145('0x9')](_0x598dfe),'issuetype':{'name':_0x598dfe[_0xa145('0xa')]||_0xa145('0xb')}}};_0x55576b['fields']['customfield_11500']=_0x598dfe[_0xa145('0xc')];_0x55576b[_0xa145('0xd')][_0xa145('0xe')]=_0x598dfe[_0xa145('0xf')];_0x55576b[_0xa145('0xd')][_0xa145('0x10')]=_0x598dfe['newToken'];_0x55576b[_0xa145('0xd')]['customfield_11503']=_0x598dfe[_0xa145('0x11')];_0x55576b[_0xa145('0xd')][_0xa145('0x12')]=_0x598dfe[_0xa145('0x13')];_0x55576b[_0xa145('0xd')][_0xa145('0x14')]=_0x598dfe['ip'];var _0xc3ed5d={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xa145('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xa145('0x16')](_0xa145('0x17'))}};var _0xb654e3=JSON['stringify'](_0x55576b);var _0x118db4=https[_0xa145('0x18')](_0xc3ed5d,function(_0x29dc81){_0x29dc81['setEncoding'](_0xa145('0x19'));var _0x2a874b='';_0x29dc81['on']('data',function(_0x485f4a){_0x2a874b+=_0x485f4a;});_0x29dc81['on'](_0xa145('0x1a'),function(){if(_0x5eaf97){return _0x5eaf97[_0xa145('0x1b')](_0x29dc81[_0xa145('0x1c')])[_0xa145('0x1d')](JSON[_0xa145('0x1e')](_0x2a874b));}});});_0x118db4['on'](_0xa145('0x1f'),function(_0x348f87){if(_0x5eaf97){return _0x5eaf97[_0xa145('0x1b')](0x1f4)[_0xa145('0x1d')]({'errors':[{'message':_0xa145('0x20'),'type':'api.jira'}]});}});_0x118db4[_0xa145('0x21')](_0xb654e3);_0x118db4['end']();}exports['openIssue']=openIssue;exports[_0xa145('0x22')]=function(_0x517cdc,_0x13f3cd){_0x517cdc[_0xa145('0x23')]['ip']=_0x517cdc[_0xa145('0x24')][_0xa145('0x25')]||_0x517cdc[_0xa145('0x26')][_0xa145('0x27')]||_0x517cdc[_0xa145('0x28')][_0xa145('0x27')]||_0x517cdc[_0xa145('0x26')][_0xa145('0x28')][_0xa145('0x27')];return openIssue(_0x517cdc['body'],_0x13f3cd);}; \ No newline at end of file +var _0x53dd=['email','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','status','statusCode','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','MOTGUI','summary','Report','\x20from\x20','description','issuetype','Bug','customfield_11500'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0x53dd,0x14a));var _0xd53d=function(_0x27b680,_0x3e84c1){_0x27b680=_0x27b680-0x0;var _0xcd449b=_0x53dd[_0x27b680];return _0xcd449b;};'use strict';var BPromise=require(_0xd53d('0x0'));var https=require(_0xd53d('0x1'));var logger=require(_0xd53d('0x2'))(_0xd53d('0x3'));var USERNAME=_0xd53d('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x13fb7f,_0x16fed8){var _0x42d4e1={'fields':{'project':{'key':_0x13fb7f['key']||_0xd53d('0x5')},'summary':(_0x13fb7f[_0xd53d('0x6')]||_0xd53d('0x7'))+_0xd53d('0x8')+_0x13fb7f['ip'],'description':_0x13fb7f[_0xd53d('0x9')]||JSON['stringify'](_0x13fb7f),'issuetype':{'name':_0x13fb7f[_0xd53d('0xa')]||_0xd53d('0xb')}}};_0x42d4e1['fields'][_0xd53d('0xc')]=_0x13fb7f[_0xd53d('0xd')];_0x42d4e1[_0xd53d('0xe')][_0xd53d('0xf')]=_0x13fb7f[_0xd53d('0x10')];_0x42d4e1[_0xd53d('0xe')][_0xd53d('0x11')]=_0x13fb7f[_0xd53d('0x12')];_0x42d4e1[_0xd53d('0xe')][_0xd53d('0x13')]=_0x13fb7f['name'];_0x42d4e1[_0xd53d('0xe')][_0xd53d('0x14')]=_0x13fb7f[_0xd53d('0x15')];_0x42d4e1[_0xd53d('0xe')][_0xd53d('0x16')]=_0x13fb7f['ip'];var _0xde8e0e={'host':_0xd53d('0x17'),'port':0x1bb,'path':_0xd53d('0x18'),'method':_0xd53d('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0xd53d('0x1a'),'Authorization':_0xd53d('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0xd53d('0x1c')](_0xd53d('0x1d'))}};var _0x280ca3=JSON[_0xd53d('0x1e')](_0x42d4e1);var _0x3b4e2f=https[_0xd53d('0x1f')](_0xde8e0e,function(_0x398c46){_0x398c46[_0xd53d('0x20')]('utf8');var _0x274be3='';_0x398c46['on']('data',function(_0x57740f){_0x274be3+=_0x57740f;});_0x398c46['on']('end',function(){if(_0x16fed8){return _0x16fed8[_0xd53d('0x21')](_0x398c46[_0xd53d('0x22')])['json'](JSON[_0xd53d('0x23')](_0x274be3));}});});_0x3b4e2f['on'](_0xd53d('0x24'),function(_0x55a11a){if(_0x16fed8){return _0x16fed8['status'](0x1f4)['json']({'errors':[{'message':_0xd53d('0x25'),'type':_0xd53d('0x26')}]});}});_0x3b4e2f[_0xd53d('0x27')](_0x280ca3);_0x3b4e2f[_0xd53d('0x28')]();}exports[_0xd53d('0x29')]=openIssue;exports[_0xd53d('0x2a')]=function(_0x51ac37,_0x53df08){_0x51ac37[_0xd53d('0x2b')]['ip']=_0x51ac37[_0xd53d('0x2c')][_0xd53d('0x2d')]||_0x51ac37[_0xd53d('0x2e')][_0xd53d('0x2f')]||_0x51ac37[_0xd53d('0x30')]['remoteAddress']||_0x51ac37['connection'][_0xd53d('0x30')][_0xd53d('0x2f')];return openIssue(_0x51ac37['body'],_0x53df08);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 4b67cc0..cfb7e78 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 _0x9bde=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','destroy','util','connect-timeout','Router'];(function(_0x76471b,_0x419cc9){var _0x5285fc=function(_0x5d4fb1){while(--_0x5d4fb1){_0x76471b['push'](_0x76471b['shift']());}};_0x5285fc(++_0x419cc9);}(_0x9bde,0xe1));var _0xe9bd=function(_0x238356,_0x438867){_0x238356=_0x238356-0x0;var _0x1fe4d4=_0x9bde[_0x238356];return _0x1fe4d4;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0x8')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe9bd('0x10')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller['update']);router[_0xe9bd('0x11')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe14d=['isAuthenticated','index','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x528009,_0x14ff4c){var _0x20991a=function(_0x4aa10f){while(--_0x4aa10f){_0x528009['push'](_0x528009['shift']());}};_0x20991a(++_0x14ff4c);}(_0xe14d,0x1ee));var _0xde14=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xe14d[_0x3826ad];return _0x17b900;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/describe',auth[_0xde14('0xa')](),controller[_0xde14('0xc')]);router[_0xde14('0x9')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0xf')]('/',auth[_0xde14('0xa')](),controller['create']);router[_0xde14('0x10')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x11')]);router[_0xde14('0x12')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 642d586..0b68790 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0x4163fd,_0x30f18e){_0x4163fd=_0x4163fd-0x0;var _0x166b1b=_0x7a54[_0x4163fd];return _0x166b1b;};'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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0x5240d6,_0x3a9379){_0x5240d6=_0x5240d6-0x0;var _0xff9881=_0x7a54[_0x5240d6];return _0xff9881;};'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 fc20af2..c9d1f58 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 _0x4fb4=['filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','reject','save','update','then','sendStatus','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','order','where','pick'];(function(_0x1d4ad7,_0x538284){var _0xb6ee31=function(_0x23c534){while(--_0x23c534){_0x1d4ad7['push'](_0x1d4ad7['shift']());}};_0xb6ee31(++_0x538284);}(_0x4fb4,0x190));var _0x44fb=function(_0x3fbbe0,_0x21997f){_0x3fbbe0=_0x3fbbe0-0x0;var _0x401e28=_0x4fb4[_0x3fbbe0];return _0x401e28;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x44fb('0x0'));var zipdir=require(_0x44fb('0x1'));var jsonpatch=require(_0x44fb('0x2'));var rp=require(_0x44fb('0x3'));var moment=require(_0x44fb('0x4'));var BPromise=require(_0x44fb('0x5'));var Mustache=require('mustache');var util=require(_0x44fb('0x6'));var path=require(_0x44fb('0x7'));var sox=require(_0x44fb('0x8'));var csv=require(_0x44fb('0x9'));var ejs=require(_0x44fb('0xa'));var fs=require('fs');var fs_extra=require(_0x44fb('0xb'));var _=require(_0x44fb('0xc'));var squel=require(_0x44fb('0xd'));var crypto=require('crypto');var jsforce=require(_0x44fb('0xe'));var deskjs=require(_0x44fb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x44fb('0x10'));var Papa=require(_0x44fb('0x11'));var Redis=require(_0x44fb('0x12'));var authService=require(_0x44fb('0x13'));var qs=require(_0x44fb('0x14'));var as=require(_0x44fb('0x15'));var hardwareService=require(_0x44fb('0x16'));var logger=require(_0x44fb('0x17'))(_0x44fb('0x18'));var utils=require(_0x44fb('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x44fb('0x1a'));var db=require(_0x44fb('0x1b'))['db'];function respondWithStatusCode(_0x40cb86,_0x103b56){_0x103b56=_0x103b56||0xcc;return function(_0x1c1cbc){if(_0x1c1cbc){return _0x40cb86['sendStatus'](_0x103b56);}return _0x40cb86[_0x44fb('0x1c')](_0x103b56)[_0x44fb('0x1d')]();};}function respondWithResult(_0x39fb83,_0x449150){_0x449150=_0x449150||0xc8;return function(_0x9a367d){if(_0x9a367d){return _0x39fb83['status'](_0x449150)[_0x44fb('0x1e')](_0x9a367d);}};}function respondWithFilteredResult(_0x18268c,_0x472658){return function(_0x147fe0){if(_0x147fe0){var _0x550b32=typeof _0x472658[_0x44fb('0x1f')]===_0x44fb('0x20')&&typeof _0x472658['limit']===_0x44fb('0x20');var _0x21886d=_0x147fe0[_0x44fb('0x21')];var _0x13cf75=_0x550b32?0x0:_0x472658[_0x44fb('0x1f')];var _0x22c2eb=_0x550b32?_0x147fe0[_0x44fb('0x21')]:_0x472658[_0x44fb('0x1f')]+_0x472658[_0x44fb('0x22')];var _0x1fc48c;if(_0x22c2eb>=_0x21886d){_0x22c2eb=_0x21886d;_0x1fc48c=0xc8;}else{_0x1fc48c=0xce;}_0x18268c['status'](_0x1fc48c);return _0x18268c['set']('Content-Range',_0x13cf75+'-'+_0x22c2eb+'/'+_0x21886d)[_0x44fb('0x1e')](_0x147fe0);}return null;};}function patchUpdates(_0xca80c){return function(_0x2dd412){try{jsonpatch['apply'](_0x2dd412,_0xca80c,!![]);}catch(_0x52507a){return BPromise[_0x44fb('0x23')](_0x52507a);}return _0x2dd412[_0x44fb('0x24')]();};}function saveUpdates(_0x5adc98,_0x558283){return function(_0x38e834){if(_0x38e834){return _0x38e834[_0x44fb('0x25')](_0x5adc98)[_0x44fb('0x26')](function(_0x4fc66d){return _0x4fc66d;});}return null;};}function removeEntity(_0x954b1d,_0x3563a6){return function(_0x1f3d5c){if(_0x1f3d5c){return _0x1f3d5c['destroy']()['then'](function(){_0x954b1d[_0x44fb('0x1c')](0xcc)[_0x44fb('0x1d')]();});}};}function handleEntityNotFound(_0x1c831e,_0x733c){return function(_0x5e7116){if(!_0x5e7116){_0x1c831e[_0x44fb('0x27')](0x194);}return _0x5e7116;};}function handleError(_0x3a7cd1,_0x4f4c64){_0x4f4c64=_0x4f4c64||0x1f4;return function(_0x5b6ce5){logger[_0x44fb('0x28')](_0x5b6ce5[_0x44fb('0x29')]);if(_0x5b6ce5[_0x44fb('0x2a')]){delete _0x5b6ce5[_0x44fb('0x2a')];}_0x3a7cd1[_0x44fb('0x1c')](_0x4f4c64)[_0x44fb('0x2b')](_0x5b6ce5);};}exports[_0x44fb('0x2c')]=function(_0x35652e,_0x6bd0b4){var _0x4f079d={},_0x48eb7d={},_0x587984={'count':0x0,'rows':[]};var _0x51b40e=_['map'](db[_0x44fb('0x2d')][_0x44fb('0x2e')],function(_0x5e3639){return{'name':_0x5e3639[_0x44fb('0x2f')],'type':_0x5e3639[_0x44fb('0x30')][_0x44fb('0x31')]};});_0x48eb7d[_0x44fb('0x32')]=_[_0x44fb('0x33')](_0x51b40e,'name');_0x48eb7d['query']=_[_0x44fb('0x34')](_0x35652e['query']);_0x48eb7d[_0x44fb('0x35')]=_[_0x44fb('0x36')](_0x48eb7d[_0x44fb('0x32')],_0x48eb7d[_0x44fb('0x37')]);_0x4f079d[_0x44fb('0x38')]=_[_0x44fb('0x36')](_0x48eb7d[_0x44fb('0x32')],qs[_0x44fb('0x39')](_0x35652e[_0x44fb('0x37')][_0x44fb('0x39')]));_0x4f079d[_0x44fb('0x38')]=_0x4f079d[_0x44fb('0x38')][_0x44fb('0x3a')]?_0x4f079d[_0x44fb('0x38')]:_0x48eb7d[_0x44fb('0x32')];if(!_0x35652e['query']['hasOwnProperty']('nolimit')){_0x4f079d[_0x44fb('0x22')]=qs[_0x44fb('0x22')](_0x35652e[_0x44fb('0x37')][_0x44fb('0x22')]);_0x4f079d['offset']=qs[_0x44fb('0x1f')](_0x35652e[_0x44fb('0x37')]['offset']);}_0x4f079d[_0x44fb('0x3b')]=qs['sort'](_0x35652e[_0x44fb('0x37')]['sort']);_0x4f079d[_0x44fb('0x3c')]=qs['filters'](_[_0x44fb('0x3d')](_0x35652e['query'],_0x48eb7d['filters']),_0x51b40e);if(_0x35652e[_0x44fb('0x37')][_0x44fb('0x3e')]){_0x4f079d[_0x44fb('0x3c')]=_[_0x44fb('0x3f')](_0x4f079d[_0x44fb('0x3c')],{'$or':_[_0x44fb('0x33')](_0x51b40e,function(_0x29e6c4){if(_0x29e6c4[_0x44fb('0x30')]!==_0x44fb('0x40')){var _0x2f761b={};_0x2f761b[_0x29e6c4['name']]={'$like':'%'+_0x35652e[_0x44fb('0x37')][_0x44fb('0x3e')]+'%'};return _0x2f761b;}})});}_0x4f079d=_[_0x44fb('0x3f')]({},_0x4f079d,_0x35652e[_0x44fb('0x41')]);var _0x22aa31={'where':_0x4f079d['where']};return db[_0x44fb('0x2d')][_0x44fb('0x21')](_0x22aa31)['then'](function(_0x52d454){_0x587984[_0x44fb('0x21')]=_0x52d454;if(_0x35652e[_0x44fb('0x37')][_0x44fb('0x42')]){_0x4f079d['include']=[{'all':!![]}];}return db[_0x44fb('0x2d')][_0x44fb('0x43')](_0x4f079d);})[_0x44fb('0x26')](function(_0x2bfb76){_0x587984[_0x44fb('0x44')]=_0x2bfb76;return _0x587984;})[_0x44fb('0x26')](respondWithFilteredResult(_0x6bd0b4,_0x4f079d))['catch'](handleError(_0x6bd0b4,null));};exports[_0x44fb('0x45')]=function(_0x537535,_0x40c590){var _0x10243b={'raw':!![],'where':{'id':_0x537535[_0x44fb('0x46')]['id']}},_0x2b66be={};_0x2b66be['model']=_[_0x44fb('0x34')](db[_0x44fb('0x2d')][_0x44fb('0x2e')]);_0x2b66be[_0x44fb('0x37')]=_[_0x44fb('0x34')](_0x537535['query']);_0x2b66be[_0x44fb('0x35')]=_[_0x44fb('0x36')](_0x2b66be[_0x44fb('0x32')],_0x2b66be[_0x44fb('0x37')]);_0x10243b['attributes']=_['intersection'](_0x2b66be[_0x44fb('0x32')],qs[_0x44fb('0x39')](_0x537535['query'][_0x44fb('0x39')]));_0x10243b['attributes']=_0x10243b['attributes']['length']?_0x10243b['attributes']:_0x2b66be[_0x44fb('0x32')];if(_0x537535[_0x44fb('0x37')][_0x44fb('0x42')]){_0x10243b[_0x44fb('0x47')]=[{'all':!![]}];}_0x10243b=_['merge']({},_0x10243b,_0x537535[_0x44fb('0x41')]);return db[_0x44fb('0x2d')][_0x44fb('0x48')](_0x10243b)[_0x44fb('0x26')](handleEntityNotFound(_0x40c590,null))[_0x44fb('0x26')](respondWithResult(_0x40c590,null))[_0x44fb('0x49')](handleError(_0x40c590,null));};exports[_0x44fb('0x4a')]=function(_0x15084d,_0x4d9e1c){return db[_0x44fb('0x2d')]['create'](_0x15084d['body'],{})[_0x44fb('0x26')](respondWithResult(_0x4d9e1c,0xc9))[_0x44fb('0x49')](handleError(_0x4d9e1c,null));};exports[_0x44fb('0x25')]=function(_0x543f14,_0x34fe03){if(_0x543f14[_0x44fb('0x4b')]['id']){delete _0x543f14[_0x44fb('0x4b')]['id'];}return db[_0x44fb('0x2d')][_0x44fb('0x48')]({'where':{'id':_0x543f14[_0x44fb('0x46')]['id']}})[_0x44fb('0x26')](handleEntityNotFound(_0x34fe03,null))['then'](saveUpdates(_0x543f14[_0x44fb('0x4b')],null))['then'](respondWithResult(_0x34fe03,null))[_0x44fb('0x49')](handleError(_0x34fe03,null));};exports['destroy']=function(_0x335437,_0x223013){return db[_0x44fb('0x2d')][_0x44fb('0x48')]({'where':{'id':_0x335437['params']['id']}})[_0x44fb('0x26')](handleEntityNotFound(_0x223013,null))[_0x44fb('0x26')](removeEntity(_0x223013,null))[_0x44fb('0x49')](handleError(_0x223013,null));};exports[_0x44fb('0x4c')]=function(_0x20094d,_0x32b166){return db[_0x44fb('0x2d')][_0x44fb('0x4c')]()[_0x44fb('0x26')](respondWithResult(_0x32b166,null))[_0x44fb('0x49')](handleError(_0x32b166,null));}; \ No newline at end of file +var _0xe015=['type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','limit','set','Content-Range','json','reject','update','then','destroy','name','send','index','JscriptyAnswerReport','rawAttributes'];(function(_0x4cefc3,_0x23f291){var _0x1cc779=function(_0x7cb914){while(--_0x7cb914){_0x4cefc3['push'](_0x4cefc3['shift']());}};_0x1cc779(++_0x23f291);}(_0xe015,0x13b));var _0x5e01=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe015[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x5e01('0x0'));var rimraf=require(_0x5e01('0x1'));var zipdir=require(_0x5e01('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5e01('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5e01('0x4'));var util=require(_0x5e01('0x5'));var path=require(_0x5e01('0x6'));var sox=require(_0x5e01('0x7'));var csv=require('to-csv');var ejs=require(_0x5e01('0x8'));var fs=require('fs');var fs_extra=require(_0x5e01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e01('0xa'));var jsforce=require(_0x5e01('0xb'));var deskjs=require(_0x5e01('0xc'));var toCsv=require(_0x5e01('0xd'));var querystring=require(_0x5e01('0xe'));var Papa=require(_0x5e01('0xf'));var Redis=require('ioredis');var authService=require(_0x5e01('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5e01('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e01('0x12'))(_0x5e01('0x13'));var utils=require('../../config/utils');var config=require(_0x5e01('0x14'));var licenseUtil=require(_0x5e01('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x560ae2,_0x3d0b04){_0x3d0b04=_0x3d0b04||0xcc;return function(_0x160f79){if(_0x160f79){return _0x560ae2[_0x5e01('0x16')](_0x3d0b04);}return _0x560ae2[_0x5e01('0x17')](_0x3d0b04)[_0x5e01('0x18')]();};}function respondWithResult(_0x16bc8f,_0x4bd426){_0x4bd426=_0x4bd426||0xc8;return function(_0x36da26){if(_0x36da26){return _0x16bc8f['status'](_0x4bd426)['json'](_0x36da26);}};}function respondWithFilteredResult(_0x1df2e0,_0x2dd70c){return function(_0x494b8a){if(_0x494b8a){var _0x27c6e7=typeof _0x2dd70c['offset']===_0x5e01('0x19')&&typeof _0x2dd70c['limit']===_0x5e01('0x19');var _0x5d85e3=_0x494b8a[_0x5e01('0x1a')];var _0x5eda1d=_0x27c6e7?0x0:_0x2dd70c['offset'];var _0x35a002=_0x27c6e7?_0x494b8a[_0x5e01('0x1a')]:_0x2dd70c['offset']+_0x2dd70c[_0x5e01('0x1b')];var _0x2df752;if(_0x35a002>=_0x5d85e3){_0x35a002=_0x5d85e3;_0x2df752=0xc8;}else{_0x2df752=0xce;}_0x1df2e0[_0x5e01('0x17')](_0x2df752);return _0x1df2e0[_0x5e01('0x1c')](_0x5e01('0x1d'),_0x5eda1d+'-'+_0x35a002+'/'+_0x5d85e3)[_0x5e01('0x1e')](_0x494b8a);}return null;};}function patchUpdates(_0x173410){return function(_0x153eb1){try{jsonpatch['apply'](_0x153eb1,_0x173410,!![]);}catch(_0x150ebf){return BPromise[_0x5e01('0x1f')](_0x150ebf);}return _0x153eb1['save']();};}function saveUpdates(_0xf6fe3f,_0x306cff){return function(_0x337ad2){if(_0x337ad2){return _0x337ad2[_0x5e01('0x20')](_0xf6fe3f)[_0x5e01('0x21')](function(_0x284803){return _0x284803;});}return null;};}function removeEntity(_0x5efff9,_0x329315){return function(_0x720922){if(_0x720922){return _0x720922[_0x5e01('0x22')]()[_0x5e01('0x21')](function(){_0x5efff9['status'](0xcc)[_0x5e01('0x18')]();});}};}function handleEntityNotFound(_0x23264f,_0x31eb7f){return function(_0x4f94d0){if(!_0x4f94d0){_0x23264f[_0x5e01('0x16')](0x194);}return _0x4f94d0;};}function handleError(_0x23454e,_0x12a19a){_0x12a19a=_0x12a19a||0x1f4;return function(_0x28344a){logger['error'](_0x28344a['stack']);if(_0x28344a[_0x5e01('0x23')]){delete _0x28344a['name'];}_0x23454e[_0x5e01('0x17')](_0x12a19a)[_0x5e01('0x24')](_0x28344a);};}exports[_0x5e01('0x25')]=function(_0xc26cf8,_0x592a61){var _0x531f0a={},_0x4a4a9f={},_0x51a98d={'count':0x0,'rows':[]};var _0x350ab4=_['map'](db[_0x5e01('0x26')][_0x5e01('0x27')],function(_0xc6d3c2){return{'name':_0xc6d3c2['fieldName'],'type':_0xc6d3c2[_0x5e01('0x28')][_0x5e01('0x29')]};});_0x4a4a9f[_0x5e01('0x2a')]=_[_0x5e01('0x2b')](_0x350ab4,'name');_0x4a4a9f['query']=_[_0x5e01('0x2c')](_0xc26cf8[_0x5e01('0x2d')]);_0x4a4a9f[_0x5e01('0x2e')]=_[_0x5e01('0x2f')](_0x4a4a9f[_0x5e01('0x2a')],_0x4a4a9f[_0x5e01('0x2d')]);_0x531f0a[_0x5e01('0x30')]=_[_0x5e01('0x2f')](_0x4a4a9f[_0x5e01('0x2a')],qs[_0x5e01('0x31')](_0xc26cf8[_0x5e01('0x2d')][_0x5e01('0x31')]));_0x531f0a['attributes']=_0x531f0a[_0x5e01('0x30')][_0x5e01('0x32')]?_0x531f0a[_0x5e01('0x30')]:_0x4a4a9f['model'];if(!_0xc26cf8[_0x5e01('0x2d')][_0x5e01('0x33')]('nolimit')){_0x531f0a[_0x5e01('0x1b')]=qs[_0x5e01('0x1b')](_0xc26cf8[_0x5e01('0x2d')]['limit']);_0x531f0a[_0x5e01('0x34')]=qs[_0x5e01('0x34')](_0xc26cf8[_0x5e01('0x2d')][_0x5e01('0x34')]);}_0x531f0a[_0x5e01('0x35')]=qs[_0x5e01('0x36')](_0xc26cf8[_0x5e01('0x2d')][_0x5e01('0x36')]);_0x531f0a[_0x5e01('0x37')]=qs[_0x5e01('0x2e')](_[_0x5e01('0x38')](_0xc26cf8[_0x5e01('0x2d')],_0x4a4a9f[_0x5e01('0x2e')]),_0x350ab4);if(_0xc26cf8[_0x5e01('0x2d')][_0x5e01('0x39')]){_0x531f0a['where']=_[_0x5e01('0x3a')](_0x531f0a['where'],{'$or':_['map'](_0x350ab4,function(_0x34e8f5){if(_0x34e8f5[_0x5e01('0x28')]!==_0x5e01('0x3b')){var _0x117fb3={};_0x117fb3[_0x34e8f5[_0x5e01('0x23')]]={'$like':'%'+_0xc26cf8['query'][_0x5e01('0x39')]+'%'};return _0x117fb3;}})});}_0x531f0a=_[_0x5e01('0x3a')]({},_0x531f0a,_0xc26cf8['options']);var _0x3c37d5={'where':_0x531f0a[_0x5e01('0x37')]};return db[_0x5e01('0x26')]['count'](_0x3c37d5)[_0x5e01('0x21')](function(_0xfed2d2){_0x51a98d['count']=_0xfed2d2;if(_0xc26cf8[_0x5e01('0x2d')][_0x5e01('0x3c')]){_0x531f0a['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x5e01('0x3d')](_0x531f0a);})['then'](function(_0x2d7423){_0x51a98d[_0x5e01('0x3e')]=_0x2d7423;return _0x51a98d;})[_0x5e01('0x21')](respondWithFilteredResult(_0x592a61,_0x531f0a))[_0x5e01('0x3f')](handleError(_0x592a61,null));};exports['show']=function(_0x296d33,_0xb93846){var _0x23275f={'raw':!![],'where':{'id':_0x296d33[_0x5e01('0x40')]['id']}},_0x44a5e4={};_0x44a5e4[_0x5e01('0x2a')]=_[_0x5e01('0x2c')](db['JscriptyAnswerReport'][_0x5e01('0x27')]);_0x44a5e4[_0x5e01('0x2d')]=_[_0x5e01('0x2c')](_0x296d33[_0x5e01('0x2d')]);_0x44a5e4[_0x5e01('0x2e')]=_['intersection'](_0x44a5e4[_0x5e01('0x2a')],_0x44a5e4[_0x5e01('0x2d')]);_0x23275f[_0x5e01('0x30')]=_[_0x5e01('0x2f')](_0x44a5e4[_0x5e01('0x2a')],qs[_0x5e01('0x31')](_0x296d33[_0x5e01('0x2d')]['fields']));_0x23275f[_0x5e01('0x30')]=_0x23275f['attributes'][_0x5e01('0x32')]?_0x23275f[_0x5e01('0x30')]:_0x44a5e4[_0x5e01('0x2a')];if(_0x296d33[_0x5e01('0x2d')][_0x5e01('0x3c')]){_0x23275f[_0x5e01('0x41')]=[{'all':!![]}];}_0x23275f=_['merge']({},_0x23275f,_0x296d33[_0x5e01('0x42')]);return db['JscriptyAnswerReport'][_0x5e01('0x43')](_0x23275f)[_0x5e01('0x21')](handleEntityNotFound(_0xb93846,null))[_0x5e01('0x21')](respondWithResult(_0xb93846,null))[_0x5e01('0x3f')](handleError(_0xb93846,null));};exports[_0x5e01('0x44')]=function(_0x1fbb1f,_0x555204){return db['JscriptyAnswerReport'][_0x5e01('0x44')](_0x1fbb1f[_0x5e01('0x45')],{})[_0x5e01('0x21')](respondWithResult(_0x555204,0xc9))[_0x5e01('0x3f')](handleError(_0x555204,null));};exports[_0x5e01('0x20')]=function(_0x389520,_0x661d){if(_0x389520[_0x5e01('0x45')]['id']){delete _0x389520[_0x5e01('0x45')]['id'];}return db[_0x5e01('0x26')][_0x5e01('0x43')]({'where':{'id':_0x389520['params']['id']}})[_0x5e01('0x21')](handleEntityNotFound(_0x661d,null))[_0x5e01('0x21')](saveUpdates(_0x389520[_0x5e01('0x45')],null))['then'](respondWithResult(_0x661d,null))[_0x5e01('0x3f')](handleError(_0x661d,null));};exports[_0x5e01('0x22')]=function(_0x3fd5ac,_0xa8ff1b){return db[_0x5e01('0x26')]['find']({'where':{'id':_0x3fd5ac[_0x5e01('0x40')]['id']}})['then'](handleEntityNotFound(_0xa8ff1b,null))[_0x5e01('0x21')](removeEntity(_0xa8ff1b,null))[_0x5e01('0x3f')](handleError(_0xa8ff1b,null));};exports[_0x5e01('0x46')]=function(_0x4c368c,_0x11b36f){return db[_0x5e01('0x26')][_0x5e01('0x46')]()[_0x5e01('0x21')](respondWithResult(_0x11b36f,null))[_0x5e01('0x3f')](handleError(_0x11b36f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 2448da7..8dc2fc7 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 _0x95f9=['bluebird','request-promise','rimraf','../../config/environment','define','report_jscripty_answers','api'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x95f9,0x14f));var _0x995f=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x95f9[_0x28947d];return _0x12d2ee;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x995f('0x0'));var moment=require('moment');var BPromise=require(_0x995f('0x1'));var rp=require(_0x995f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x995f('0x3'));var config=require(_0x995f('0x4'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x5b8603,_0x542c5b){return _0x5b8603[_0x995f('0x5')]('JscriptyAnswerReport',attributes,{'tableName':_0x995f('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa67=['./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xfa67,0x1cf));var _0x7fa6=function(_0x153f69,_0x4fbc79){_0x153f69=_0x153f69-0x0;var _0x14ac6f=_0xfa67[_0x153f69];return _0x14ac6f;};'use strict';var _=require(_0x7fa6('0x0'));var util=require(_0x7fa6('0x1'));var logger=require(_0x7fa6('0x2'))('api');var moment=require(_0x7fa6('0x3'));var BPromise=require(_0x7fa6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7fa6('0x5'));var rimraf=require('rimraf');var config=require(_0x7fa6('0x6'));var attributes=require(_0x7fa6('0x7'));module[_0x7fa6('0x8')]=function(_0x5843ea,_0x393b12){return _0x5843ea['define'](_0x7fa6('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 445e374..b636557 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 _0xfaab=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird'];(function(_0x404c55,_0x39b734){var _0x579e60=function(_0x11df78){while(--_0x11df78){_0x404c55['push'](_0x404c55['shift']());}};_0x579e60(++_0x39b734);}(_0xfaab,0xcb));var _0xbfaa=function(_0x2ab7ab,_0x55437b){_0x2ab7ab=_0x2ab7ab-0x0;var _0x451638=_0xfaab[_0x2ab7ab];return _0x451638;};'use strict';var _=require(_0xbfaa('0x0'));var util=require(_0xbfaa('0x1'));var moment=require(_0xbfaa('0x2'));var BPromise=require(_0xbfaa('0x3'));var rs=require(_0xbfaa('0x4'));var fs=require('fs');var Redis=require(_0xbfaa('0x5'));var db=require(_0xbfaa('0x6'))['db'];var utils=require(_0xbfaa('0x7'));var logger=require(_0xbfaa('0x8'))('rpc');var config=require(_0xbfaa('0x9'));var jayson=require(_0xbfaa('0xa'));var client=jayson[_0xbfaa('0xb')][_0xbfaa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10f470,_0x400a49,_0x41d61a){return new BPromise(function(_0x4ebd68,_0x3c586a){return client[_0xbfaa('0xd')](_0x10f470,_0x41d61a)[_0xbfaa('0xe')](function(_0x71884d){logger['info'](_0xbfaa('0xf'),_0x400a49,_0xbfaa('0x10'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x400a49,'request\x20sent',JSON[_0xbfaa('0x11')](_0x71884d));if(_0x71884d[_0xbfaa('0x12')]){if(_0x71884d[_0xbfaa('0x12')][_0xbfaa('0x13')]===0x1f4){logger[_0xbfaa('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x400a49,_0x71884d[_0xbfaa('0x12')][_0xbfaa('0x14')]);return _0x3c586a(_0x71884d['error']['message']);}logger['error'](_0xbfaa('0xf'),_0x400a49,_0x71884d['error'][_0xbfaa('0x14')]);return _0x4ebd68(_0x71884d[_0xbfaa('0x12')][_0xbfaa('0x14')]);}else{logger[_0xbfaa('0x15')](_0xbfaa('0xf'),_0x400a49,_0xbfaa('0x10'));_0x4ebd68(_0x71884d[_0xbfaa('0x16')]['message']);}})['catch'](function(_0x4d4ead){logger[_0xbfaa('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x400a49,_0x4d4ead);_0x3c586a(_0x4d4ead);});});} \ No newline at end of file +var _0xe173=['request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x3a9dd9,_0x93ae44){var _0x3ff267=function(_0xa5836c){while(--_0xa5836c){_0x3a9dd9['push'](_0x3a9dd9['shift']());}};_0x3ff267(++_0x93ae44);}(_0xe173,0xcc));var _0x3e17=function(_0xe94c81,_0x429af7){_0xe94c81=_0xe94c81-0x0;var _0x17d93f=_0xe173[_0xe94c81];return _0x17d93f;};'use strict';var _=require(_0x3e17('0x0'));var util=require(_0x3e17('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3e17('0x2'));var fs=require('fs');var Redis=require(_0x3e17('0x3'));var db=require(_0x3e17('0x4'))['db'];var utils=require(_0x3e17('0x5'));var logger=require('../../config/logger')(_0x3e17('0x6'));var config=require('../../config/environment');var jayson=require(_0x3e17('0x7'));var client=jayson[_0x3e17('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x485a87,_0x40eea9,_0x475906){return new BPromise(function(_0x2777c6,_0x37147a){return client[_0x3e17('0x9')](_0x485a87,_0x475906)[_0x3e17('0xa')](function(_0x1948ca){logger['info'](_0x3e17('0xb'),_0x40eea9,_0x3e17('0xc'));logger[_0x3e17('0xd')](_0x3e17('0xe'),_0x40eea9,_0x3e17('0xc'),JSON['stringify'](_0x1948ca));if(_0x1948ca[_0x3e17('0xf')]){if(_0x1948ca['error']['code']===0x1f4){logger[_0x3e17('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x40eea9,_0x1948ca[_0x3e17('0xf')][_0x3e17('0x10')]);return _0x37147a(_0x1948ca[_0x3e17('0xf')][_0x3e17('0x10')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x40eea9,_0x1948ca[_0x3e17('0xf')][_0x3e17('0x10')]);return _0x2777c6(_0x1948ca[_0x3e17('0xf')][_0x3e17('0x10')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x40eea9,_0x3e17('0xc'));_0x2777c6(_0x1948ca[_0x3e17('0x11')][_0x3e17('0x10')]);}})['catch'](function(_0x7d5555){logger[_0x3e17('0xf')](_0x3e17('0xb'),_0x40eea9,_0x7d5555);_0x37147a(_0x7d5555);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 03b5cc0..a861513 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 _0x60ce=['./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','getSessions','/:id/summary','getSummary','create','post','/:id/clone','put','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4b9c6b,_0x3ed0fe){var _0x2ed2a1=function(_0x40c97e){while(--_0x40c97e){_0x4b9c6b['push'](_0x4b9c6b['shift']());}};_0x2ed2a1(++_0x3ed0fe);}(_0x60ce,0x123));var _0xe60c=function(_0x59d8a6,_0x177eec){_0x59d8a6=_0x59d8a6-0x0;var _0x264911=_0x60ce[_0x59d8a6];return _0x264911;};'use strict';var multer=require(_0xe60c('0x0'));var util=require('util');var path=require(_0xe60c('0x1'));var timeout=require(_0xe60c('0x2'));var express=require(_0xe60c('0x3'));var router=express['Router']();var fs_extra=require(_0xe60c('0x4'));var auth=require(_0xe60c('0x5'));var interaction=require(_0xe60c('0x6'));var config=require(_0xe60c('0x7'));var controller=require(_0xe60c('0x8'));router[_0xe60c('0x9')]('/',auth['isAuthenticated'](),controller[_0xe60c('0xa')]);router[_0xe60c('0x9')](_0xe60c('0xb'),auth[_0xe60c('0xc')](),controller[_0xe60c('0xd')]);router[_0xe60c('0x9')]('/:id/sessions',auth[_0xe60c('0xc')](),controller[_0xe60c('0xe')]);router[_0xe60c('0x9')]('/:id/answers',auth[_0xe60c('0xc')](),controller['getAnswers']);router[_0xe60c('0x9')](_0xe60c('0xf'),auth['isAuthenticated'](),timeout('30s'),controller[_0xe60c('0x10')]);router['post']('/',auth[_0xe60c('0xc')](),controller[_0xe60c('0x11')]);router[_0xe60c('0x12')](_0xe60c('0x13'),auth[_0xe60c('0xc')](),controller['clone']);router[_0xe60c('0x14')]('/:id',auth[_0xe60c('0xc')](),controller['update']);router[_0xe60c('0x15')](_0xe60c('0xb'),auth[_0xe60c('0xc')](),controller['destroy']);module[_0xe60c('0x16')]=router; \ No newline at end of file +var _0x28ab=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','getSessions','/:id/answers','getAnswers','30s','post','create','/:id/clone','clone','put','update','delete','/:id'];(function(_0x131fa4,_0x516143){var _0x4c66c1=function(_0x24aa85){while(--_0x24aa85){_0x131fa4['push'](_0x131fa4['shift']());}};_0x4c66c1(++_0x516143);}(_0x28ab,0xb1));var _0xb28a=function(_0xbb2f2d,_0x5753f8){_0xbb2f2d=_0xbb2f2d-0x0;var _0x44ccdf=_0x28ab[_0xbb2f2d];return _0x44ccdf;};'use strict';var multer=require(_0xb28a('0x0'));var util=require('util');var path=require(_0xb28a('0x1'));var timeout=require(_0xb28a('0x2'));var express=require('express');var router=express[_0xb28a('0x3')]();var fs_extra=require(_0xb28a('0x4'));var auth=require(_0xb28a('0x5'));var interaction=require(_0xb28a('0x6'));var config=require(_0xb28a('0x7'));var controller=require(_0xb28a('0x8'));router[_0xb28a('0x9')]('/',auth[_0xb28a('0xa')](),controller['index']);router[_0xb28a('0x9')]('/:id',auth[_0xb28a('0xa')](),controller['show']);router[_0xb28a('0x9')]('/:id/sessions',auth[_0xb28a('0xa')](),controller[_0xb28a('0xb')]);router['get'](_0xb28a('0xc'),auth[_0xb28a('0xa')](),controller[_0xb28a('0xd')]);router['get']('/:id/summary',auth[_0xb28a('0xa')](),timeout(_0xb28a('0xe')),controller['getSummary']);router[_0xb28a('0xf')]('/',auth[_0xb28a('0xa')](),controller[_0xb28a('0x10')]);router[_0xb28a('0xf')](_0xb28a('0x11'),auth[_0xb28a('0xa')](),controller[_0xb28a('0x12')]);router[_0xb28a('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb28a('0x14')]);router[_0xb28a('0x15')](_0xb28a('0x16'),auth['isAuthenticated'](),controller[_0xb28a('0x17')]);module[_0xb28a('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 535f069..e6ad16d 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 _0xba00=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','sequelize','lodash','util','exports','name','STRING','long','setDataValue','formData','format'];(function(_0x17e2dc,_0x20feb0){var _0x169164=function(_0x15ad69){while(--_0x15ad69){_0x17e2dc['push'](_0x17e2dc['shift']());}};_0x169164(++_0x20feb0);}(_0xba00,0x107));var _0x0ba0=function(_0x484fbc,_0x138108){_0x484fbc=_0x484fbc-0x0;var _0x191151=_0xba00[_0x484fbc];return _0x191151;};'use strict';var Sequelize=require(_0x0ba0('0x0'));var _=require(_0x0ba0('0x1'));var util=require(_0x0ba0('0x2'));module[_0x0ba0('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x0ba0('0x4')},'description':{'type':Sequelize[_0x0ba0('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x0ba0('0x6')),'set':function(_0x41bfcf){if(_['isObjectLike'](_0x41bfcf)){this[_0x0ba0('0x7')](_0x0ba0('0x8'),JSON['stringify'](_0x41bfcf));}else if(_['isString'](_0x41bfcf)){this[_0x0ba0('0x7')]('formData',_0x41bfcf);}else{this[_0x0ba0('0x7')](_0x0ba0('0x8'),util[_0x0ba0('0x9')](_0x0ba0('0xa'),this['getDataValue']('name')||'',this[_0x0ba0('0xb')](_0x0ba0('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x70f7=['format','getDataValue','description','BOOLEAN','sequelize','lodash','util','name','STRING','TEXT','long','setDataValue','isString','formData'];(function(_0x5afeab,_0x536dcd){var _0x419cd3=function(_0x20edb8){while(--_0x20edb8){_0x5afeab['push'](_0x5afeab['shift']());}};_0x419cd3(++_0x536dcd);}(_0x70f7,0x11c));var _0x770f=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0x70f7[_0x3f2d02];return _0x54092b;};'use strict';var Sequelize=require(_0x770f('0x0'));var _=require(_0x770f('0x1'));var util=require(_0x770f('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x770f('0x3')},'description':{'type':Sequelize[_0x770f('0x4')]},'formData':{'type':Sequelize[_0x770f('0x5')](_0x770f('0x6')),'set':function(_0x290c3f){if(_['isObjectLike'](_0x290c3f)){this[_0x770f('0x7')]('formData',JSON['stringify'](_0x290c3f));}else if(_[_0x770f('0x8')](_0x290c3f)){this[_0x770f('0x7')](_0x770f('0x9'),_0x290c3f);}else{this[_0x770f('0x7')](_0x770f('0x9'),util[_0x770f('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x770f('0xb')]('name')||'',this['getDataValue'](_0x770f('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x770f('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x770f('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index b5cbe58..7c5f85d 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 _0x3f7c=['attributes','length','order','sort','where','filters','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','updatedAt','body','createdAt','JscriptySessionReport','nolimit','ProjectId','getAnswers','JscriptyAnswerReport','hasOwnProperty','pick','rows','toString','indexOf','replace','startTime','parse','JscriptyQuestionReport','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','now','writeFileSync','Content-disposition','attachment;\x20filename=','format','Content-type','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','intersection'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x3f7c,0xaa));var _0xc3f7=function(_0x560ddf,_0x3d2a5e){_0x560ddf=_0x560ddf-0x0;var _0xc2a2b3=_0x3f7c[_0x560ddf];return _0xc2a2b3;};'use strict';var emlformat=require(_0xc3f7('0x0'));var rimraf=require(_0xc3f7('0x1'));var zipdir=require(_0xc3f7('0x2'));var jsonpatch=require(_0xc3f7('0x3'));var rp=require(_0xc3f7('0x4'));var moment=require('moment');var BPromise=require(_0xc3f7('0x5'));var Mustache=require('mustache');var util=require(_0xc3f7('0x6'));var path=require(_0xc3f7('0x7'));var sox=require(_0xc3f7('0x8'));var csv=require(_0xc3f7('0x9'));var ejs=require(_0xc3f7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3f7('0xb'));var squel=require(_0xc3f7('0xc'));var crypto=require(_0xc3f7('0xd'));var jsforce=require(_0xc3f7('0xe'));var deskjs=require(_0xc3f7('0xf'));var toCsv=require(_0xc3f7('0x9'));var querystring=require(_0xc3f7('0x10'));var Papa=require(_0xc3f7('0x11'));var Redis=require(_0xc3f7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc3f7('0x13'));var as=require(_0xc3f7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3f7('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc3f7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3f7('0x17'))['db'];function respondWithStatusCode(_0x3b5638,_0xeb5db4){_0xeb5db4=_0xeb5db4||0xcc;return function(_0x45a43f){if(_0x45a43f){return _0x3b5638[_0xc3f7('0x18')](_0xeb5db4);}return _0x3b5638[_0xc3f7('0x19')](_0xeb5db4)[_0xc3f7('0x1a')]();};}function respondWithResult(_0x3f004f,_0x2c0e79){_0x2c0e79=_0x2c0e79||0xc8;return function(_0x1cdf8c){if(_0x1cdf8c){return _0x3f004f['status'](_0x2c0e79)[_0xc3f7('0x1b')](_0x1cdf8c);}};}function respondWithFilteredResult(_0x52f8eb,_0x2f8b2d){return function(_0x4b7b97){if(_0x4b7b97){var _0x43d5bb=typeof _0x2f8b2d[_0xc3f7('0x1c')]===_0xc3f7('0x1d')&&typeof _0x2f8b2d[_0xc3f7('0x1e')]===_0xc3f7('0x1d');var _0x3f7c60=_0x4b7b97[_0xc3f7('0x1f')];var _0x2b82fd=_0x43d5bb?0x0:_0x2f8b2d[_0xc3f7('0x1c')];var _0x46c343=_0x43d5bb?_0x4b7b97[_0xc3f7('0x1f')]:_0x2f8b2d[_0xc3f7('0x1c')]+_0x2f8b2d[_0xc3f7('0x1e')];var _0x539214;if(_0x46c343>=_0x3f7c60){_0x46c343=_0x3f7c60;_0x539214=0xc8;}else{_0x539214=0xce;}_0x52f8eb[_0xc3f7('0x19')](_0x539214);return _0x52f8eb[_0xc3f7('0x20')](_0xc3f7('0x21'),_0x2b82fd+'-'+_0x46c343+'/'+_0x3f7c60)[_0xc3f7('0x1b')](_0x4b7b97);}return null;};}function patchUpdates(_0x48c8c9){return function(_0x5743a2){try{jsonpatch[_0xc3f7('0x22')](_0x5743a2,_0x48c8c9,!![]);}catch(_0xb92b42){return BPromise[_0xc3f7('0x23')](_0xb92b42);}return _0x5743a2[_0xc3f7('0x24')]();};}function saveUpdates(_0xcd4042,_0x194399){return function(_0x86b1f0){if(_0x86b1f0){return _0x86b1f0[_0xc3f7('0x25')](_0xcd4042)[_0xc3f7('0x26')](function(_0x5125ee){return _0x5125ee;});}return null;};}function removeEntity(_0x132a7f,_0x4f514b){return function(_0x1ddc26){if(_0x1ddc26){return _0x1ddc26[_0xc3f7('0x27')]()[_0xc3f7('0x26')](function(){var _0x3cc75b=_0x1ddc26[_0xc3f7('0x28')]({'plain':!![]});var _0xf2482b=_0xc3f7('0x29');return db[_0xc3f7('0x2a')]['destroy']({'where':{'type':_0xf2482b,'resourceId':_0x3cc75b['id']}})[_0xc3f7('0x26')](function(){return _0x1ddc26;});})[_0xc3f7('0x26')](function(){_0x132a7f[_0xc3f7('0x19')](0xcc)[_0xc3f7('0x1a')]();});}};}function handleEntityNotFound(_0x4799f6,_0x2d2b72){return function(_0x24d241){if(!_0x24d241){_0x4799f6['sendStatus'](0x194);}return _0x24d241;};}function handleError(_0x267520,_0xe20399){_0xe20399=_0xe20399||0x1f4;return function(_0x585c65){logger[_0xc3f7('0x2b')](_0x585c65[_0xc3f7('0x2c')]);if(_0x585c65[_0xc3f7('0x2d')]){delete _0x585c65['name'];}_0x267520['status'](_0xe20399)['send'](_0x585c65);};}exports[_0xc3f7('0x2e')]=function(_0x3d9253,_0x1bef3c){var _0x1a8f5a={},_0x28b14e={},_0x2d9326={'count':0x0,'rows':[]};var _0x22ad6e=_[_0xc3f7('0x2f')](db[_0xc3f7('0x30')][_0xc3f7('0x31')],function(_0x171106){return{'name':_0x171106[_0xc3f7('0x32')],'type':_0x171106['type'][_0xc3f7('0x33')]};});_0x28b14e[_0xc3f7('0x34')]=_[_0xc3f7('0x2f')](_0x22ad6e,_0xc3f7('0x2d'));_0x28b14e[_0xc3f7('0x35')]=_[_0xc3f7('0x36')](_0x3d9253['query']);_0x28b14e['filters']=_[_0xc3f7('0x37')](_0x28b14e['model'],_0x28b14e['query']);_0x1a8f5a[_0xc3f7('0x38')]=_[_0xc3f7('0x37')](_0x28b14e[_0xc3f7('0x34')],qs['fields'](_0x3d9253[_0xc3f7('0x35')]['fields']));_0x1a8f5a[_0xc3f7('0x38')]=_0x1a8f5a[_0xc3f7('0x38')][_0xc3f7('0x39')]?_0x1a8f5a[_0xc3f7('0x38')]:_0x28b14e[_0xc3f7('0x34')];if(!_0x3d9253[_0xc3f7('0x35')]['hasOwnProperty']('nolimit')){_0x1a8f5a[_0xc3f7('0x1e')]=qs[_0xc3f7('0x1e')](_0x3d9253[_0xc3f7('0x35')][_0xc3f7('0x1e')]);_0x1a8f5a[_0xc3f7('0x1c')]=qs['offset'](_0x3d9253[_0xc3f7('0x35')][_0xc3f7('0x1c')]);}_0x1a8f5a[_0xc3f7('0x3a')]=qs['sort'](_0x3d9253[_0xc3f7('0x35')][_0xc3f7('0x3b')]);_0x1a8f5a[_0xc3f7('0x3c')]=qs[_0xc3f7('0x3d')](_['pick'](_0x3d9253[_0xc3f7('0x35')],_0x28b14e['filters']),_0x22ad6e);if(_0x3d9253[_0xc3f7('0x35')][_0xc3f7('0x3e')]){_0x1a8f5a[_0xc3f7('0x3c')]=_[_0xc3f7('0x3f')](_0x1a8f5a[_0xc3f7('0x3c')],{'$or':_[_0xc3f7('0x2f')](_0x22ad6e,function(_0x1bedda){if(_0x1bedda[_0xc3f7('0x40')]!==_0xc3f7('0x41')){var _0x30c00f={};_0x30c00f[_0x1bedda[_0xc3f7('0x2d')]]={'$like':'%'+_0x3d9253[_0xc3f7('0x35')]['filter']+'%'};return _0x30c00f;}})});}_0x1a8f5a=_[_0xc3f7('0x3f')]({},_0x1a8f5a,_0x3d9253[_0xc3f7('0x42')]);var _0xc8a21d={'where':_0x1a8f5a[_0xc3f7('0x3c')]};return db[_0xc3f7('0x30')][_0xc3f7('0x1f')](_0xc8a21d)[_0xc3f7('0x26')](function(_0x22f109){_0x2d9326[_0xc3f7('0x1f')]=_0x22f109;if(_0x3d9253[_0xc3f7('0x35')]['includeAll']){_0x1a8f5a[_0xc3f7('0x43')]=[{'all':!![]}];}return db['JscriptyProject'][_0xc3f7('0x44')](_0x1a8f5a);})[_0xc3f7('0x26')](function(_0x358879){_0x2d9326['rows']=_0x358879;return _0x2d9326;})['then'](respondWithFilteredResult(_0x1bef3c,_0x1a8f5a))[_0xc3f7('0x45')](handleError(_0x1bef3c,null));};exports[_0xc3f7('0x46')]=function(_0x543652,_0x36b5be){var _0x20feff={'raw':![],'where':{'id':_0x543652[_0xc3f7('0x47')]['id']}},_0xef6b33={};_0xef6b33[_0xc3f7('0x34')]=_[_0xc3f7('0x36')](db['JscriptyProject'][_0xc3f7('0x31')]);_0xef6b33['query']=_[_0xc3f7('0x36')](_0x543652[_0xc3f7('0x35')]);_0xef6b33[_0xc3f7('0x3d')]=_[_0xc3f7('0x37')](_0xef6b33[_0xc3f7('0x34')],_0xef6b33[_0xc3f7('0x35')]);_0x20feff['attributes']=_['intersection'](_0xef6b33[_0xc3f7('0x34')],qs[_0xc3f7('0x48')](_0x543652[_0xc3f7('0x35')][_0xc3f7('0x48')]));_0x20feff['attributes']=_0x20feff[_0xc3f7('0x38')]['length']?_0x20feff['attributes']:_0xef6b33[_0xc3f7('0x34')];if(_0x543652[_0xc3f7('0x35')]['includeAll']){_0x20feff[_0xc3f7('0x43')]=[{'all':!![]}];}_0x20feff=_[_0xc3f7('0x3f')]({},_0x20feff,_0x543652[_0xc3f7('0x42')]);return db[_0xc3f7('0x30')][_0xc3f7('0x49')](_0x20feff)[_0xc3f7('0x26')](handleEntityNotFound(_0x36b5be,null))['then'](respondWithResult(_0x36b5be,null))[_0xc3f7('0x45')](handleError(_0x36b5be,null));};exports[_0xc3f7('0x4a')]=function(_0x1bf4f3,_0x188503){return db[_0xc3f7('0x30')]['create'](_0x1bf4f3['body'],{})['then'](function(_0x5c3cc2){var _0x214da9=_0x1bf4f3[_0xc3f7('0x4b')][_0xc3f7('0x28')]({'plain':!![]});if(!_0x214da9)throw new Error(_0xc3f7('0x4c'));if(_0x214da9[_0xc3f7('0x4d')]==='user'){var _0x339c20=_0x5c3cc2['get']({'plain':!![]});var _0x2be2a0=_0xc3f7('0x29');return db[_0xc3f7('0x4e')][_0xc3f7('0x49')]({'where':{'name':_0x2be2a0,'userProfileId':_0x214da9[_0xc3f7('0x4f')]},'raw':!![]})['then'](function(_0x12e5e3){if(_0x12e5e3&&_0x12e5e3[_0xc3f7('0x50')]===0x0){return db['UserProfileResource'][_0xc3f7('0x4a')]({'name':_0x339c20['name'],'resourceId':_0x339c20['id'],'type':_0x12e5e3[_0xc3f7('0x2d')],'sectionId':_0x12e5e3['id']},{})['then'](function(){return _0x5c3cc2;});}else{return _0x5c3cc2;}})[_0xc3f7('0x45')](function(_0xd5759f){logger[_0xc3f7('0x2b')](_0xc3f7('0x51'),_0xd5759f);throw _0xd5759f;});}return _0x5c3cc2;})[_0xc3f7('0x26')](respondWithResult(_0x188503,0xc9))['catch'](handleError(_0x188503,null));};exports['clone']=function(_0x39fdfc,_0x130756){var _0x317da9={'where':{'id':_0x39fdfc[_0xc3f7('0x47')]['id']}},_0x34727e={};_0x34727e[_0xc3f7('0x34')]=_[_0xc3f7('0x36')](db[_0xc3f7('0x30')][_0xc3f7('0x31')]);_0x317da9[_0xc3f7('0x38')]=_['intersection'](_0x34727e[_0xc3f7('0x34')],qs[_0xc3f7('0x48')](_0x39fdfc[_0xc3f7('0x35')][_0xc3f7('0x48')]));_0x317da9[_0xc3f7('0x38')]=_0x317da9[_0xc3f7('0x38')]['length']?_0x317da9['attributes']:_0x34727e[_0xc3f7('0x34')];if(_0x39fdfc[_0xc3f7('0x35')][_0xc3f7('0x52')]){_0x317da9[_0xc3f7('0x43')]=[{'all':!![]}];}_0x317da9=_['merge']({},_0x317da9,_0x39fdfc[_0xc3f7('0x42')]);return db[_0xc3f7('0x30')][_0xc3f7('0x49')](_0x317da9)[_0xc3f7('0x26')](handleEntityNotFound(_0x130756,null))[_0xc3f7('0x26')](function(_0xdb1c22){if(_0xdb1c22){var _0x3c1f86=_0xdb1c22['get']({'plain':!![]});_0x3c1f86=qs['omit'](_0x3c1f86,['id','createdAt',_0xc3f7('0x53')]);_0x39fdfc[_0xc3f7('0x54')]=_['omit'](_0x39fdfc['body'],['id',_0xc3f7('0x55'),_0xc3f7('0x53')]);return db['JscriptyProject']['create'](_[_0xc3f7('0x3f')](_0x3c1f86,_0x39fdfc[_0xc3f7('0x54')]),{'include':_0x39fdfc[_0xc3f7('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0xc3f7('0x26')](function(_0x545962){var _0x8eefee=_0x39fdfc[_0xc3f7('0x4b')][_0xc3f7('0x28')]({'plain':!![]});if(!_0x8eefee)throw new Error(_0xc3f7('0x4c'));if(_0x8eefee[_0xc3f7('0x4d')]===_0xc3f7('0x4b')){var _0xc1273a=_0x545962[_0xc3f7('0x28')]({'plain':!![]});var _0x5d510f=_0xc3f7('0x29');return db[_0xc3f7('0x4e')][_0xc3f7('0x49')]({'where':{'name':_0x5d510f,'userProfileId':_0x8eefee[_0xc3f7('0x4f')]},'raw':!![]})['then'](function(_0x5b7426){if(_0x5b7426&&_0x5b7426[_0xc3f7('0x50')]===0x0){return db[_0xc3f7('0x2a')][_0xc3f7('0x4a')]({'name':_0xc1273a[_0xc3f7('0x2d')],'resourceId':_0xc1273a['id'],'type':_0x5b7426[_0xc3f7('0x2d')],'sectionId':_0x5b7426['id']},{})[_0xc3f7('0x26')](function(){return _0x545962;});}else{return _0x545962;}})[_0xc3f7('0x45')](function(_0x59bd7c){logger['error'](_0xc3f7('0x51'),_0x59bd7c);throw _0x59bd7c;});}return _0x545962;});}})[_0xc3f7('0x26')](respondWithResult(_0x130756,0xc9))['catch'](handleError(_0x130756,null));};exports[_0xc3f7('0x25')]=function(_0x2dbcd1,_0x3de292){if(_0x2dbcd1[_0xc3f7('0x54')]['id']){delete _0x2dbcd1[_0xc3f7('0x54')]['id'];}return db[_0xc3f7('0x30')][_0xc3f7('0x49')]({'where':{'id':_0x2dbcd1[_0xc3f7('0x47')]['id']}})[_0xc3f7('0x26')](handleEntityNotFound(_0x3de292,null))[_0xc3f7('0x26')](saveUpdates(_0x2dbcd1[_0xc3f7('0x54')],null))[_0xc3f7('0x26')](respondWithResult(_0x3de292,null))[_0xc3f7('0x45')](handleError(_0x3de292,null));};exports['destroy']=function(_0x53d7da,_0x5449f3){return db[_0xc3f7('0x30')]['find']({'where':{'id':_0x53d7da[_0xc3f7('0x47')]['id']}})[_0xc3f7('0x26')](handleEntityNotFound(_0x5449f3,null))[_0xc3f7('0x26')](removeEntity(_0x5449f3,null))[_0xc3f7('0x45')](handleError(_0x5449f3,null));};exports['getSessions']=function(_0x34216f,_0x1c2d58,_0x36f3e8){var _0x7ce90c={'raw':!![],'where':{}};var _0x3d078e={};var _0x33c8b2={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x34216f[_0xc3f7('0x47')]['id']}})[_0xc3f7('0x26')](handleEntityNotFound(_0x1c2d58,null))[_0xc3f7('0x26')](function(_0x238f35){if(_0x238f35){_0x3d078e['model']=_[_0xc3f7('0x36')](db[_0xc3f7('0x56')]['rawAttributes']);_0x3d078e[_0xc3f7('0x35')]=_[_0xc3f7('0x36')](_0x34216f[_0xc3f7('0x35')]);_0x3d078e[_0xc3f7('0x3d')]=_[_0xc3f7('0x37')](_0x3d078e[_0xc3f7('0x34')],_0x3d078e['query']);_0x7ce90c['attributes']=_[_0xc3f7('0x37')](_0x3d078e[_0xc3f7('0x34')],qs['fields'](_0x34216f[_0xc3f7('0x35')][_0xc3f7('0x48')]));_0x7ce90c[_0xc3f7('0x38')]=_0x7ce90c[_0xc3f7('0x38')][_0xc3f7('0x39')]?_0x7ce90c[_0xc3f7('0x38')]:_0x3d078e[_0xc3f7('0x34')];if(!_0x34216f[_0xc3f7('0x35')]['hasOwnProperty'](_0xc3f7('0x57'))){_0x7ce90c['limit']=qs[_0xc3f7('0x1e')](_0x34216f[_0xc3f7('0x35')][_0xc3f7('0x1e')]);_0x7ce90c['offset']=qs[_0xc3f7('0x1c')](_0x34216f[_0xc3f7('0x35')]['offset']);}_0x7ce90c['order']=qs[_0xc3f7('0x3b')](_0x34216f[_0xc3f7('0x35')][_0xc3f7('0x3b')]);_0x7ce90c[_0xc3f7('0x3c')]=qs[_0xc3f7('0x3d')](_['pick'](_0x34216f[_0xc3f7('0x35')],_0x3d078e[_0xc3f7('0x3d')]));_0x7ce90c[_0xc3f7('0x3c')][_0xc3f7('0x58')]=_0x238f35['id'];if(_0x34216f[_0xc3f7('0x35')][_0xc3f7('0x3e')]){_0x7ce90c[_0xc3f7('0x3c')]=_['merge'](_0x7ce90c[_0xc3f7('0x3c')],{'$or':_['map'](_0x7ce90c[_0xc3f7('0x38')],function(_0x12df7f){var _0x201f80={};_0x201f80[_0x12df7f]={'$like':'%'+_0x34216f[_0xc3f7('0x35')][_0xc3f7('0x3e')]+'%'};return _0x201f80;})});}_0x7ce90c=_[_0xc3f7('0x3f')]({},_0x7ce90c,_0x34216f[_0xc3f7('0x42')]);return db['JscriptySessionReport'][_0xc3f7('0x1f')]({'where':_0x7ce90c['where']})[_0xc3f7('0x26')](function(_0x2f46b3){_0x33c8b2[_0xc3f7('0x1f')]=_0x2f46b3;if(_0x34216f[_0xc3f7('0x35')][_0xc3f7('0x52')]){_0x7ce90c[_0xc3f7('0x43')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xc3f7('0x44')](_0x7ce90c);})[_0xc3f7('0x26')](function(_0x5ce2ed){_0x33c8b2['rows']=_0x5ce2ed;return _0x33c8b2;});}})[_0xc3f7('0x26')](respondWithFilteredResult(_0x1c2d58,_0x7ce90c))['catch'](handleError(_0x1c2d58,null));};exports[_0xc3f7('0x59')]=function(_0x81ce9c,_0x47885d,_0x53db6b){var _0x443ac5={'raw':!![],'where':{}};var _0x3f31e0={};var _0x540228={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x81ce9c[_0xc3f7('0x47')]['id']}})[_0xc3f7('0x26')](handleEntityNotFound(_0x47885d,null))[_0xc3f7('0x26')](function(_0x27172b){if(_0x27172b){_0x3f31e0[_0xc3f7('0x34')]=_[_0xc3f7('0x36')](db[_0xc3f7('0x5a')][_0xc3f7('0x31')]);_0x3f31e0[_0xc3f7('0x35')]=_[_0xc3f7('0x36')](_0x81ce9c[_0xc3f7('0x35')]);_0x3f31e0[_0xc3f7('0x3d')]=_['intersection'](_0x3f31e0[_0xc3f7('0x34')],_0x3f31e0[_0xc3f7('0x35')]);_0x443ac5['attributes']=_['intersection'](_0x3f31e0[_0xc3f7('0x34')],qs[_0xc3f7('0x48')](_0x81ce9c['query']['fields']));_0x443ac5[_0xc3f7('0x38')]=_0x443ac5[_0xc3f7('0x38')][_0xc3f7('0x39')]?_0x443ac5[_0xc3f7('0x38')]:_0x3f31e0[_0xc3f7('0x34')];if(!_0x81ce9c[_0xc3f7('0x35')][_0xc3f7('0x5b')](_0xc3f7('0x57'))){_0x443ac5[_0xc3f7('0x1e')]=qs['limit'](_0x81ce9c[_0xc3f7('0x35')][_0xc3f7('0x1e')]);_0x443ac5[_0xc3f7('0x1c')]=qs[_0xc3f7('0x1c')](_0x81ce9c[_0xc3f7('0x35')][_0xc3f7('0x1c')]);}_0x443ac5[_0xc3f7('0x3a')]=qs['sort'](_0x81ce9c['query'][_0xc3f7('0x3b')]);_0x443ac5[_0xc3f7('0x3c')]=qs[_0xc3f7('0x3d')](_[_0xc3f7('0x5c')](_0x81ce9c[_0xc3f7('0x35')],_0x3f31e0[_0xc3f7('0x3d')]));_0x443ac5[_0xc3f7('0x3c')][_0xc3f7('0x58')]=_0x27172b['id'];if(_0x81ce9c['query']['filter']){_0x443ac5['where']=_[_0xc3f7('0x3f')](_0x443ac5[_0xc3f7('0x3c')],{'$or':_[_0xc3f7('0x2f')](_0x443ac5[_0xc3f7('0x38')],function(_0x2259aa){var _0x1bc32d={};_0x1bc32d[_0x2259aa]={'$like':'%'+_0x81ce9c[_0xc3f7('0x35')][_0xc3f7('0x3e')]+'%'};return _0x1bc32d;})});}_0x443ac5=_[_0xc3f7('0x3f')]({},_0x443ac5,_0x81ce9c[_0xc3f7('0x42')]);return db[_0xc3f7('0x5a')][_0xc3f7('0x1f')]({'where':_0x443ac5[_0xc3f7('0x3c')]})['then'](function(_0x9462e6){_0x540228['count']=_0x9462e6;if(_0x81ce9c[_0xc3f7('0x35')]['includeAll']){_0x443ac5['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc3f7('0x44')](_0x443ac5);})['then'](function(_0x18f4c8){_0x540228[_0xc3f7('0x5d')]=_0x18f4c8;return _0x540228;});}})[_0xc3f7('0x26')](respondWithFilteredResult(_0x47885d,_0x443ac5))[_0xc3f7('0x45')](handleError(_0x47885d,null));};function char(_0x3059d1){return'number'===typeof _0x3059d1?String['fromCharCode'][_0xc3f7('0x22')](null,arguments):_0x3059d1;}function needsEncapsulation(_0x20008d){return!!_0x20008d&&(_0x20008d[_0xc3f7('0x5e')]()['indexOf'](char(0xd))>=0x0||_0x20008d[_0xc3f7('0x5e')]()[_0xc3f7('0x5f')](char(0xa))>=0x0||_0x20008d[_0xc3f7('0x5e')]()[_0xc3f7('0x5f')](char(0x2c))>=0x0||_0x20008d[_0xc3f7('0x5e')]()[_0xc3f7('0x5f')](char(0x22))>=0x0);}function encapsulate(_0xfacf0e){var _0x3cb02c=char(0x22),_0x857938='\x5c'+char(0x22),_0x42ce86=_0xfacf0e[_0xc3f7('0x5e')]()[_0xc3f7('0x60')](new RegExp(_0x3cb02c,'g'),_0x857938);return _0x3cb02c+_0x42ce86+_0x3cb02c;}exports['getSummary']=function(_0x24daf5,_0x390676,_0x477084){var _0x4bc5b8,_0x1bcc31;var _0x12f1d3={'where':{'ProjectId':_0x24daf5[_0xc3f7('0x47')]['id']}};if(_0x24daf5[_0xc3f7('0x35')][_0xc3f7('0x61')]){_0x12f1d3[_0xc3f7('0x3c')]['starttime']=JSON[_0xc3f7('0x62')](_0x24daf5[_0xc3f7('0x35')][_0xc3f7('0x61')]);}return db[_0xc3f7('0x56')][_0xc3f7('0x44')](_0x12f1d3)[_0xc3f7('0x26')](handleEntityNotFound(_0x390676,null))['then'](function(_0x351389){if(_0x351389){_0x4bc5b8=_0x351389;return db[_0xc3f7('0x63')][_0xc3f7('0x44')]({'where':{'SessionId':{'$in':_[_0xc3f7('0x2f')](_0x4bc5b8,'id')},'ProjectId':_0x24daf5['params']['id']},'order':'-createdAt'});}})[_0xc3f7('0x26')](handleEntityNotFound(_0x390676,null))[_0xc3f7('0x26')](function(_0x12ff8d){if(_0x12ff8d){_0x1bcc31=_0x12ff8d;var _0x34cc3f={};for(var _0xa68fea=0x0,_0x161ebe=_0x1bcc31['length'];_0xa68fea<_0x161ebe;_0xa68fea++){if(!_0x34cc3f[_0xc3f7('0x5b')](_0x1bcc31[_0xa68fea][_0xc3f7('0x64')])){_0x34cc3f[_0x1bcc31[_0xa68fea][_0xc3f7('0x64')]]=needsEncapsulation(_0x1bcc31[_0xa68fea][_0xc3f7('0x65')])?encapsulate(_0x1bcc31[_0xa68fea][_0xc3f7('0x65')]):_0x1bcc31[_0xa68fea][_0xc3f7('0x65')];}}var _0x1e38f1=[],_0x4a9910={};for(var _0x2d7864=0x0,_0x40e4f8=_0x4bc5b8[_0xc3f7('0x39')];_0x2d7864<_0x40e4f8;_0x2d7864++){_0x4a9910={'ProjectId':_0x24daf5['params']['id'],'SessionId':_0x4bc5b8[_0x2d7864]['id'],'StartTime':moment(_0x4bc5b8[_0x2d7864]['starttime'])['format'](_0xc3f7('0x66'))};for(var _0x123a80=0x0,_0x4e8706=_0x1bcc31[_0xc3f7('0x39')];_0x123a80<_0x4e8706;_0x123a80++){if(_0x1bcc31[_0x123a80][_0xc3f7('0x67')]==_0x4bc5b8[_0x2d7864]['id']&&_0x34cc3f[_0xc3f7('0x5b')](_0x1bcc31[_0x123a80][_0xc3f7('0x64')])){_0x4a9910[_0x34cc3f[_0x1bcc31[_0x123a80][_0xc3f7('0x64')]]]=_0x1bcc31[_0x123a80][_0xc3f7('0x68')];}}for(var _0x775800 in _0x34cc3f){if(!_0x4a9910[_0xc3f7('0x5b')](_0x34cc3f[_0x775800])){_0x4a9910[_0x34cc3f[_0x775800]]=null;}}_0x1e38f1['push'](_0x4a9910);}return _0x1e38f1;}})[_0xc3f7('0x26')](function(_0x4b1750){if(!_['isEmpty'](_0x4b1750)){var _0x2e9191=toCsv(_0x4b1750);var _0x287ae7=Date[_0xc3f7('0x69')]();fs[_0xc3f7('0x6a')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x24daf5[_0xc3f7('0x47')]['id'],_0x287ae7),_0x2e9191);_0x390676['setHeader'](_0xc3f7('0x6b'),_0xc3f7('0x6c')+util[_0xc3f7('0x6d')]('Jscripty_Project_%d_Summary_%s.csv',_0x24daf5[_0xc3f7('0x47')]['id'],_0x287ae7));_0x390676['setHeader'](_0xc3f7('0x6e'),_0xc3f7('0x6f'));return _0x390676['download'](util[_0xc3f7('0x6d')](_0xc3f7('0x70'),_0x24daf5[_0xc3f7('0x47')]['id'],_0x287ae7));}else{return _0x390676[_0xc3f7('0x18')](0xcc);}})[_0xc3f7('0x45')](handleError(_0x390676,null));}; \ No newline at end of file +var _0xc719=['zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','undefined','offset','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','Projects','UserProfileResource','error','stack','name','map','JscriptyProject','type','key','model','query','keys','filters','fields','attributes','length','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','update','getSessions','findOne','hasOwnProperty','nolimit','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','-createdAt','question','SessionId','questionId','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','format','eml-format','rimraf'];(function(_0x34271c,_0x28a8b){var _0x83585f=function(_0x7d2264){while(--_0x7d2264){_0x34271c['push'](_0x34271c['shift']());}};_0x83585f(++_0x28a8b);}(_0xc719,0x1d2));var _0x9c71=function(_0x53f715,_0x52587b){_0x53f715=_0x53f715-0x0;var _0x16c757=_0xc719[_0x53f715];return _0x16c757;};'use strict';var emlformat=require(_0x9c71('0x0'));var rimraf=require(_0x9c71('0x1'));var zipdir=require(_0x9c71('0x2'));var jsonpatch=require(_0x9c71('0x3'));var rp=require(_0x9c71('0x4'));var moment=require('moment');var BPromise=require(_0x9c71('0x5'));var Mustache=require('mustache');var util=require(_0x9c71('0x6'));var path=require(_0x9c71('0x7'));var sox=require(_0x9c71('0x8'));var csv=require(_0x9c71('0x9'));var ejs=require(_0x9c71('0xa'));var fs=require('fs');var fs_extra=require(_0x9c71('0xb'));var _=require(_0x9c71('0xc'));var squel=require(_0x9c71('0xd'));var crypto=require('crypto');var jsforce=require(_0x9c71('0xe'));var deskjs=require(_0x9c71('0xf'));var toCsv=require(_0x9c71('0x9'));var querystring=require(_0x9c71('0x10'));var Papa=require(_0x9c71('0x11'));var Redis=require(_0x9c71('0x12'));var authService=require(_0x9c71('0x13'));var qs=require(_0x9c71('0x14'));var as=require(_0x9c71('0x15'));var hardwareService=require(_0x9c71('0x16'));var logger=require(_0x9c71('0x17'))(_0x9c71('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9c71('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ed326,_0x4c2767){_0x4c2767=_0x4c2767||0xcc;return function(_0x269fe4){if(_0x269fe4){return _0x3ed326[_0x9c71('0x1a')](_0x4c2767);}return _0x3ed326[_0x9c71('0x1b')](_0x4c2767)['end']();};}function respondWithResult(_0x2b0490,_0x4a5095){_0x4a5095=_0x4a5095||0xc8;return function(_0x28a385){if(_0x28a385){return _0x2b0490['status'](_0x4a5095)['json'](_0x28a385);}};}function respondWithFilteredResult(_0x232212,_0x27cffc){return function(_0x4c39b5){if(_0x4c39b5){var _0x53f556=typeof _0x27cffc['offset']===_0x9c71('0x1c')&&typeof _0x27cffc['limit']===_0x9c71('0x1c');var _0x1e8f7f=_0x4c39b5['count'];var _0x3941b9=_0x53f556?0x0:_0x27cffc[_0x9c71('0x1d')];var _0x550bc1=_0x53f556?_0x4c39b5[_0x9c71('0x1e')]:_0x27cffc[_0x9c71('0x1d')]+_0x27cffc[_0x9c71('0x1f')];var _0x34f171;if(_0x550bc1>=_0x1e8f7f){_0x550bc1=_0x1e8f7f;_0x34f171=0xc8;}else{_0x34f171=0xce;}_0x232212[_0x9c71('0x1b')](_0x34f171);return _0x232212[_0x9c71('0x20')](_0x9c71('0x21'),_0x3941b9+'-'+_0x550bc1+'/'+_0x1e8f7f)[_0x9c71('0x22')](_0x4c39b5);}return null;};}function patchUpdates(_0x2a50f4){return function(_0x138fb3){try{jsonpatch[_0x9c71('0x23')](_0x138fb3,_0x2a50f4,!![]);}catch(_0x1300d5){return BPromise[_0x9c71('0x24')](_0x1300d5);}return _0x138fb3[_0x9c71('0x25')]();};}function saveUpdates(_0x4bc9ac,_0x5bdddb){return function(_0x329b85){if(_0x329b85){return _0x329b85['update'](_0x4bc9ac)[_0x9c71('0x26')](function(_0x12c871){return _0x12c871;});}return null;};}function removeEntity(_0x4e34e6,_0xdfa2ed){return function(_0x23b8c1){if(_0x23b8c1){return _0x23b8c1[_0x9c71('0x27')]()[_0x9c71('0x26')](function(){var _0x377b99=_0x23b8c1[_0x9c71('0x28')]({'plain':!![]});var _0x5aa446=_0x9c71('0x29');return db[_0x9c71('0x2a')][_0x9c71('0x27')]({'where':{'type':_0x5aa446,'resourceId':_0x377b99['id']}})[_0x9c71('0x26')](function(){return _0x23b8c1;});})[_0x9c71('0x26')](function(){_0x4e34e6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xca3988,_0xb568ff){return function(_0x4747d0){if(!_0x4747d0){_0xca3988[_0x9c71('0x1a')](0x194);}return _0x4747d0;};}function handleError(_0x27e2ec,_0x4836e5){_0x4836e5=_0x4836e5||0x1f4;return function(_0xd9ce71){logger[_0x9c71('0x2b')](_0xd9ce71[_0x9c71('0x2c')]);if(_0xd9ce71[_0x9c71('0x2d')]){delete _0xd9ce71[_0x9c71('0x2d')];}_0x27e2ec[_0x9c71('0x1b')](_0x4836e5)['send'](_0xd9ce71);};}exports['index']=function(_0x18a51a,_0x408b58){var _0x3179e6={},_0xf9c2f4={},_0x50525b={'count':0x0,'rows':[]};var _0x10afaf=_[_0x9c71('0x2e')](db[_0x9c71('0x2f')]['rawAttributes'],function(_0x21c374){return{'name':_0x21c374['fieldName'],'type':_0x21c374[_0x9c71('0x30')][_0x9c71('0x31')]};});_0xf9c2f4[_0x9c71('0x32')]=_[_0x9c71('0x2e')](_0x10afaf,_0x9c71('0x2d'));_0xf9c2f4[_0x9c71('0x33')]=_[_0x9c71('0x34')](_0x18a51a['query']);_0xf9c2f4[_0x9c71('0x35')]=_['intersection'](_0xf9c2f4[_0x9c71('0x32')],_0xf9c2f4[_0x9c71('0x33')]);_0x3179e6['attributes']=_['intersection'](_0xf9c2f4[_0x9c71('0x32')],qs['fields'](_0x18a51a[_0x9c71('0x33')][_0x9c71('0x36')]));_0x3179e6['attributes']=_0x3179e6[_0x9c71('0x37')][_0x9c71('0x38')]?_0x3179e6['attributes']:_0xf9c2f4['model'];if(!_0x18a51a[_0x9c71('0x33')]['hasOwnProperty']('nolimit')){_0x3179e6[_0x9c71('0x1f')]=qs['limit'](_0x18a51a['query'][_0x9c71('0x1f')]);_0x3179e6[_0x9c71('0x1d')]=qs[_0x9c71('0x1d')](_0x18a51a['query']['offset']);}_0x3179e6[_0x9c71('0x39')]=qs[_0x9c71('0x3a')](_0x18a51a['query'][_0x9c71('0x3a')]);_0x3179e6[_0x9c71('0x3b')]=qs['filters'](_[_0x9c71('0x3c')](_0x18a51a[_0x9c71('0x33')],_0xf9c2f4[_0x9c71('0x35')]),_0x10afaf);if(_0x18a51a[_0x9c71('0x33')][_0x9c71('0x3d')]){_0x3179e6[_0x9c71('0x3b')]=_[_0x9c71('0x3e')](_0x3179e6['where'],{'$or':_['map'](_0x10afaf,function(_0x4a5e69){if(_0x4a5e69[_0x9c71('0x30')]!=='VIRTUAL'){var _0x2d9123={};_0x2d9123[_0x4a5e69[_0x9c71('0x2d')]]={'$like':'%'+_0x18a51a[_0x9c71('0x33')][_0x9c71('0x3d')]+'%'};return _0x2d9123;}})});}_0x3179e6=_[_0x9c71('0x3e')]({},_0x3179e6,_0x18a51a[_0x9c71('0x3f')]);var _0x2eadc8={'where':_0x3179e6['where']};return db[_0x9c71('0x2f')][_0x9c71('0x1e')](_0x2eadc8)['then'](function(_0x2e1048){_0x50525b[_0x9c71('0x1e')]=_0x2e1048;if(_0x18a51a[_0x9c71('0x33')]['includeAll']){_0x3179e6[_0x9c71('0x40')]=[{'all':!![]}];}return db[_0x9c71('0x2f')][_0x9c71('0x41')](_0x3179e6);})['then'](function(_0x35fa06){_0x50525b[_0x9c71('0x42')]=_0x35fa06;return _0x50525b;})[_0x9c71('0x26')](respondWithFilteredResult(_0x408b58,_0x3179e6))[_0x9c71('0x43')](handleError(_0x408b58,null));};exports[_0x9c71('0x44')]=function(_0x20a911,_0x17f95d){var _0x3959d8={'raw':![],'where':{'id':_0x20a911[_0x9c71('0x45')]['id']}},_0x46517a={};_0x46517a[_0x9c71('0x32')]=_[_0x9c71('0x34')](db['JscriptyProject'][_0x9c71('0x46')]);_0x46517a[_0x9c71('0x33')]=_[_0x9c71('0x34')](_0x20a911[_0x9c71('0x33')]);_0x46517a['filters']=_[_0x9c71('0x47')](_0x46517a['model'],_0x46517a[_0x9c71('0x33')]);_0x3959d8[_0x9c71('0x37')]=_[_0x9c71('0x47')](_0x46517a[_0x9c71('0x32')],qs['fields'](_0x20a911[_0x9c71('0x33')][_0x9c71('0x36')]));_0x3959d8[_0x9c71('0x37')]=_0x3959d8['attributes']['length']?_0x3959d8[_0x9c71('0x37')]:_0x46517a[_0x9c71('0x32')];if(_0x20a911['query'][_0x9c71('0x48')]){_0x3959d8['include']=[{'all':!![]}];}_0x3959d8=_[_0x9c71('0x3e')]({},_0x3959d8,_0x20a911[_0x9c71('0x3f')]);return db['JscriptyProject'][_0x9c71('0x49')](_0x3959d8)[_0x9c71('0x26')](handleEntityNotFound(_0x17f95d,null))[_0x9c71('0x26')](respondWithResult(_0x17f95d,null))[_0x9c71('0x43')](handleError(_0x17f95d,null));};exports[_0x9c71('0x4a')]=function(_0xa37348,_0x436ef0){return db[_0x9c71('0x2f')][_0x9c71('0x4a')](_0xa37348[_0x9c71('0x4b')],{})[_0x9c71('0x26')](function(_0x40bf2d){var _0x44476d=_0xa37348[_0x9c71('0x4c')]['get']({'plain':!![]});if(!_0x44476d)throw new Error(_0x9c71('0x4d'));if(_0x44476d[_0x9c71('0x4e')]===_0x9c71('0x4c')){var _0x5e0f92=_0x40bf2d[_0x9c71('0x28')]({'plain':!![]});var _0x535a8c=_0x9c71('0x29');return db['UserProfileSection'][_0x9c71('0x49')]({'where':{'name':_0x535a8c,'userProfileId':_0x44476d['userProfileId']},'raw':!![]})['then'](function(_0x3a3dbb){if(_0x3a3dbb&&_0x3a3dbb[_0x9c71('0x4f')]===0x0){return db[_0x9c71('0x2a')]['create']({'name':_0x5e0f92[_0x9c71('0x2d')],'resourceId':_0x5e0f92['id'],'type':_0x3a3dbb['name'],'sectionId':_0x3a3dbb['id']},{})['then'](function(){return _0x40bf2d;});}else{return _0x40bf2d;}})[_0x9c71('0x43')](function(_0x11dd47){logger[_0x9c71('0x2b')](_0x9c71('0x50'),_0x11dd47);throw _0x11dd47;});}return _0x40bf2d;})[_0x9c71('0x26')](respondWithResult(_0x436ef0,0xc9))[_0x9c71('0x43')](handleError(_0x436ef0,null));};exports[_0x9c71('0x51')]=function(_0x2a2d31,_0x27ec58){var _0x157163={'where':{'id':_0x2a2d31['params']['id']}},_0x2d9718={};_0x2d9718['model']=_['keys'](db['JscriptyProject']['rawAttributes']);_0x157163[_0x9c71('0x37')]=_[_0x9c71('0x47')](_0x2d9718[_0x9c71('0x32')],qs[_0x9c71('0x36')](_0x2a2d31['query'][_0x9c71('0x36')]));_0x157163[_0x9c71('0x37')]=_0x157163[_0x9c71('0x37')][_0x9c71('0x38')]?_0x157163['attributes']:_0x2d9718[_0x9c71('0x32')];if(_0x2a2d31[_0x9c71('0x33')]['includeAll']){_0x157163[_0x9c71('0x40')]=[{'all':!![]}];}_0x157163=_[_0x9c71('0x3e')]({},_0x157163,_0x2a2d31[_0x9c71('0x3f')]);return db['JscriptyProject'][_0x9c71('0x49')](_0x157163)[_0x9c71('0x26')](handleEntityNotFound(_0x27ec58,null))['then'](function(_0xb829a1){if(_0xb829a1){var _0x8b8e0d=_0xb829a1[_0x9c71('0x28')]({'plain':!![]});_0x8b8e0d=qs[_0x9c71('0x52')](_0x8b8e0d,['id',_0x9c71('0x53'),_0x9c71('0x54')]);_0x2a2d31[_0x9c71('0x4b')]=_[_0x9c71('0x52')](_0x2a2d31['body'],['id','createdAt',_0x9c71('0x54')]);return db[_0x9c71('0x2f')][_0x9c71('0x4a')](_[_0x9c71('0x3e')](_0x8b8e0d,_0x2a2d31[_0x9c71('0x4b')]),{'include':_0x2a2d31[_0x9c71('0x33')][_0x9c71('0x48')]?[{'all':!![]}]:undefined})[_0x9c71('0x26')](function(_0x367470){var _0x3a0f03=_0x2a2d31[_0x9c71('0x4c')][_0x9c71('0x28')]({'plain':!![]});if(!_0x3a0f03)throw new Error(_0x9c71('0x4d'));if(_0x3a0f03[_0x9c71('0x4e')]==='user'){var _0x4259b3=_0x367470[_0x9c71('0x28')]({'plain':!![]});var _0x149b6f=_0x9c71('0x29');return db[_0x9c71('0x55')]['find']({'where':{'name':_0x149b6f,'userProfileId':_0x3a0f03['userProfileId']},'raw':!![]})[_0x9c71('0x26')](function(_0x2f1846){if(_0x2f1846&&_0x2f1846['autoAssociation']===0x0){return db[_0x9c71('0x2a')]['create']({'name':_0x4259b3[_0x9c71('0x2d')],'resourceId':_0x4259b3['id'],'type':_0x2f1846['name'],'sectionId':_0x2f1846['id']},{})['then'](function(){return _0x367470;});}else{return _0x367470;}})[_0x9c71('0x43')](function(_0x3f80e7){logger[_0x9c71('0x2b')](_0x9c71('0x50'),_0x3f80e7);throw _0x3f80e7;});}return _0x367470;});}})[_0x9c71('0x26')](respondWithResult(_0x27ec58,0xc9))[_0x9c71('0x43')](handleError(_0x27ec58,null));};exports[_0x9c71('0x56')]=function(_0x11c6f6,_0x4885cf){if(_0x11c6f6[_0x9c71('0x4b')]['id']){delete _0x11c6f6['body']['id'];}return db[_0x9c71('0x2f')][_0x9c71('0x49')]({'where':{'id':_0x11c6f6[_0x9c71('0x45')]['id']}})['then'](handleEntityNotFound(_0x4885cf,null))[_0x9c71('0x26')](saveUpdates(_0x11c6f6[_0x9c71('0x4b')],null))[_0x9c71('0x26')](respondWithResult(_0x4885cf,null))['catch'](handleError(_0x4885cf,null));};exports[_0x9c71('0x27')]=function(_0x1c700,_0x399044){return db[_0x9c71('0x2f')][_0x9c71('0x49')]({'where':{'id':_0x1c700[_0x9c71('0x45')]['id']}})[_0x9c71('0x26')](handleEntityNotFound(_0x399044,null))[_0x9c71('0x26')](removeEntity(_0x399044,null))[_0x9c71('0x43')](handleError(_0x399044,null));};exports[_0x9c71('0x57')]=function(_0x1b468c,_0x3e75f3,_0x5900e9){var _0x24505c={'raw':!![],'where':{}};var _0x3f2266={};var _0x5b7bf4={'count':0x0,'rows':[]};return db[_0x9c71('0x2f')][_0x9c71('0x58')]({'where':{'id':_0x1b468c[_0x9c71('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e75f3,null))[_0x9c71('0x26')](function(_0x5d783c){if(_0x5d783c){_0x3f2266[_0x9c71('0x32')]=_['keys'](db['JscriptySessionReport'][_0x9c71('0x46')]);_0x3f2266[_0x9c71('0x33')]=_[_0x9c71('0x34')](_0x1b468c['query']);_0x3f2266['filters']=_[_0x9c71('0x47')](_0x3f2266[_0x9c71('0x32')],_0x3f2266[_0x9c71('0x33')]);_0x24505c['attributes']=_[_0x9c71('0x47')](_0x3f2266[_0x9c71('0x32')],qs[_0x9c71('0x36')](_0x1b468c['query'][_0x9c71('0x36')]));_0x24505c['attributes']=_0x24505c[_0x9c71('0x37')]['length']?_0x24505c[_0x9c71('0x37')]:_0x3f2266[_0x9c71('0x32')];if(!_0x1b468c['query'][_0x9c71('0x59')](_0x9c71('0x5a'))){_0x24505c[_0x9c71('0x1f')]=qs[_0x9c71('0x1f')](_0x1b468c[_0x9c71('0x33')][_0x9c71('0x1f')]);_0x24505c[_0x9c71('0x1d')]=qs[_0x9c71('0x1d')](_0x1b468c[_0x9c71('0x33')]['offset']);}_0x24505c[_0x9c71('0x39')]=qs['sort'](_0x1b468c[_0x9c71('0x33')][_0x9c71('0x3a')]);_0x24505c[_0x9c71('0x3b')]=qs[_0x9c71('0x35')](_['pick'](_0x1b468c[_0x9c71('0x33')],_0x3f2266['filters']));_0x24505c[_0x9c71('0x3b')][_0x9c71('0x5b')]=_0x5d783c['id'];if(_0x1b468c[_0x9c71('0x33')][_0x9c71('0x3d')]){_0x24505c['where']=_[_0x9c71('0x3e')](_0x24505c[_0x9c71('0x3b')],{'$or':_[_0x9c71('0x2e')](_0x24505c[_0x9c71('0x37')],function(_0x5a65a0){var _0xd94867={};_0xd94867[_0x5a65a0]={'$like':'%'+_0x1b468c['query'][_0x9c71('0x3d')]+'%'};return _0xd94867;})});}_0x24505c=_[_0x9c71('0x3e')]({},_0x24505c,_0x1b468c[_0x9c71('0x3f')]);return db[_0x9c71('0x5c')][_0x9c71('0x1e')]({'where':_0x24505c[_0x9c71('0x3b')]})[_0x9c71('0x26')](function(_0x4477af){_0x5b7bf4[_0x9c71('0x1e')]=_0x4477af;if(_0x1b468c[_0x9c71('0x33')][_0x9c71('0x48')]){_0x24505c[_0x9c71('0x40')]=[{'all':!![]}];}return db[_0x9c71('0x5c')]['findAll'](_0x24505c);})[_0x9c71('0x26')](function(_0x40bbae){_0x5b7bf4[_0x9c71('0x42')]=_0x40bbae;return _0x5b7bf4;});}})[_0x9c71('0x26')](respondWithFilteredResult(_0x3e75f3,_0x24505c))[_0x9c71('0x43')](handleError(_0x3e75f3,null));};exports[_0x9c71('0x5d')]=function(_0x44591a,_0x4875f3,_0x13b793){var _0x47c7be={'raw':!![],'where':{}};var _0x2dd90b={};var _0xe139a4={'count':0x0,'rows':[]};return db[_0x9c71('0x2f')]['findOne']({'where':{'id':_0x44591a[_0x9c71('0x45')]['id']}})[_0x9c71('0x26')](handleEntityNotFound(_0x4875f3,null))[_0x9c71('0x26')](function(_0x551b49){if(_0x551b49){_0x2dd90b[_0x9c71('0x32')]=_[_0x9c71('0x34')](db[_0x9c71('0x5e')]['rawAttributes']);_0x2dd90b['query']=_[_0x9c71('0x34')](_0x44591a[_0x9c71('0x33')]);_0x2dd90b[_0x9c71('0x35')]=_[_0x9c71('0x47')](_0x2dd90b[_0x9c71('0x32')],_0x2dd90b[_0x9c71('0x33')]);_0x47c7be[_0x9c71('0x37')]=_['intersection'](_0x2dd90b[_0x9c71('0x32')],qs[_0x9c71('0x36')](_0x44591a[_0x9c71('0x33')][_0x9c71('0x36')]));_0x47c7be[_0x9c71('0x37')]=_0x47c7be[_0x9c71('0x37')][_0x9c71('0x38')]?_0x47c7be['attributes']:_0x2dd90b[_0x9c71('0x32')];if(!_0x44591a[_0x9c71('0x33')][_0x9c71('0x59')](_0x9c71('0x5a'))){_0x47c7be[_0x9c71('0x1f')]=qs[_0x9c71('0x1f')](_0x44591a[_0x9c71('0x33')][_0x9c71('0x1f')]);_0x47c7be[_0x9c71('0x1d')]=qs[_0x9c71('0x1d')](_0x44591a[_0x9c71('0x33')][_0x9c71('0x1d')]);}_0x47c7be['order']=qs['sort'](_0x44591a[_0x9c71('0x33')]['sort']);_0x47c7be['where']=qs[_0x9c71('0x35')](_[_0x9c71('0x3c')](_0x44591a[_0x9c71('0x33')],_0x2dd90b[_0x9c71('0x35')]));_0x47c7be[_0x9c71('0x3b')]['ProjectId']=_0x551b49['id'];if(_0x44591a[_0x9c71('0x33')]['filter']){_0x47c7be[_0x9c71('0x3b')]=_[_0x9c71('0x3e')](_0x47c7be[_0x9c71('0x3b')],{'$or':_[_0x9c71('0x2e')](_0x47c7be[_0x9c71('0x37')],function(_0x2fc36c){var _0x4aef45={};_0x4aef45[_0x2fc36c]={'$like':'%'+_0x44591a[_0x9c71('0x33')][_0x9c71('0x3d')]+'%'};return _0x4aef45;})});}_0x47c7be=_['merge']({},_0x47c7be,_0x44591a[_0x9c71('0x3f')]);return db[_0x9c71('0x5e')][_0x9c71('0x1e')]({'where':_0x47c7be[_0x9c71('0x3b')]})[_0x9c71('0x26')](function(_0x1c55cc){_0xe139a4['count']=_0x1c55cc;if(_0x44591a[_0x9c71('0x33')][_0x9c71('0x48')]){_0x47c7be['include']=[{'all':!![]}];}return db[_0x9c71('0x5e')][_0x9c71('0x41')](_0x47c7be);})[_0x9c71('0x26')](function(_0x544c2c){_0xe139a4[_0x9c71('0x42')]=_0x544c2c;return _0xe139a4;});}})[_0x9c71('0x26')](respondWithFilteredResult(_0x4875f3,_0x47c7be))['catch'](handleError(_0x4875f3,null));};function char(_0x574ce5){return _0x9c71('0x5f')===typeof _0x574ce5?String[_0x9c71('0x60')][_0x9c71('0x23')](null,arguments):_0x574ce5;}function needsEncapsulation(_0x90debe){return!!_0x90debe&&(_0x90debe[_0x9c71('0x61')]()[_0x9c71('0x62')](char(0xd))>=0x0||_0x90debe[_0x9c71('0x61')]()[_0x9c71('0x62')](char(0xa))>=0x0||_0x90debe[_0x9c71('0x61')]()[_0x9c71('0x62')](char(0x2c))>=0x0||_0x90debe[_0x9c71('0x61')]()[_0x9c71('0x62')](char(0x22))>=0x0);}function encapsulate(_0x4ff974){var _0x1018d7=char(0x22),_0x5a646b='\x5c'+char(0x22),_0x1770bb=_0x4ff974['toString']()[_0x9c71('0x63')](new RegExp(_0x1018d7,'g'),_0x5a646b);return _0x1018d7+_0x1770bb+_0x1018d7;}exports[_0x9c71('0x64')]=function(_0x640b53,_0x3a4a80,_0x5b10e2){var _0x2eb6e6,_0x557c16;var _0x313be2={'where':{'ProjectId':_0x640b53[_0x9c71('0x45')]['id']}};if(_0x640b53[_0x9c71('0x33')]['startTime']){_0x313be2[_0x9c71('0x3b')][_0x9c71('0x65')]=JSON['parse'](_0x640b53[_0x9c71('0x33')]['startTime']);}return db[_0x9c71('0x5c')][_0x9c71('0x41')](_0x313be2)[_0x9c71('0x26')](handleEntityNotFound(_0x3a4a80,null))[_0x9c71('0x26')](function(_0x2d5491){if(_0x2d5491){_0x2eb6e6=_0x2d5491;return db['JscriptyQuestionReport'][_0x9c71('0x41')]({'where':{'SessionId':{'$in':_[_0x9c71('0x2e')](_0x2eb6e6,'id')},'ProjectId':_0x640b53[_0x9c71('0x45')]['id']},'order':_0x9c71('0x66')});}})[_0x9c71('0x26')](handleEntityNotFound(_0x3a4a80,null))['then'](function(_0x3d276c){if(_0x3d276c){_0x557c16=_0x3d276c;var _0x369b3b={};for(var _0x2f6c4d=0x0,_0x394bb4=_0x557c16['length'];_0x2f6c4d<_0x394bb4;_0x2f6c4d++){if(!_0x369b3b[_0x9c71('0x59')](_0x557c16[_0x2f6c4d]['questionId'])){_0x369b3b[_0x557c16[_0x2f6c4d]['questionId']]=needsEncapsulation(_0x557c16[_0x2f6c4d]['question'])?encapsulate(_0x557c16[_0x2f6c4d][_0x9c71('0x67')]):_0x557c16[_0x2f6c4d][_0x9c71('0x67')];}}var _0x36446c=[],_0x32900a={};for(var _0x1175da=0x0,_0x4d20fd=_0x2eb6e6[_0x9c71('0x38')];_0x1175da<_0x4d20fd;_0x1175da++){_0x32900a={'ProjectId':_0x640b53[_0x9c71('0x45')]['id'],'SessionId':_0x2eb6e6[_0x1175da]['id'],'StartTime':moment(_0x2eb6e6[_0x1175da][_0x9c71('0x65')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x369962=0x0,_0x2e56c5=_0x557c16[_0x9c71('0x38')];_0x369962<_0x2e56c5;_0x369962++){if(_0x557c16[_0x369962][_0x9c71('0x68')]==_0x2eb6e6[_0x1175da]['id']&&_0x369b3b[_0x9c71('0x59')](_0x557c16[_0x369962][_0x9c71('0x69')])){_0x32900a[_0x369b3b[_0x557c16[_0x369962][_0x9c71('0x69')]]]=_0x557c16[_0x369962]['answer'];}}for(var _0x49af40 in _0x369b3b){if(!_0x32900a[_0x9c71('0x59')](_0x369b3b[_0x49af40])){_0x32900a[_0x369b3b[_0x49af40]]=null;}}_0x36446c[_0x9c71('0x6a')](_0x32900a);}return _0x36446c;}})['then'](function(_0x31cfe6){if(!_['isEmpty'](_0x31cfe6)){var _0x25d0bd=toCsv(_0x31cfe6);var _0x5a5dc3=Date[_0x9c71('0x6b')]();fs[_0x9c71('0x6c')](util['format'](_0x9c71('0x6d'),_0x640b53[_0x9c71('0x45')]['id'],_0x5a5dc3),_0x25d0bd);_0x3a4a80[_0x9c71('0x6e')](_0x9c71('0x6f'),_0x9c71('0x70')+util['format'](_0x9c71('0x71'),_0x640b53['params']['id'],_0x5a5dc3));_0x3a4a80[_0x9c71('0x6e')]('Content-type',_0x9c71('0x72'));return _0x3a4a80[_0x9c71('0x73')](util[_0x9c71('0x74')](_0x9c71('0x6d'),_0x640b53[_0x9c71('0x45')]['id'],_0x5a5dc3));}else{return _0x3a4a80[_0x9c71('0x1a')](0xcc);}})[_0x9c71('0x43')](handleError(_0x3a4a80,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 747f704..ee08cff 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 _0x27a8=['exports','define','JscriptyProject','jscripty_projects','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0x3d8e0b,_0x2ec330){var _0x5f533c=function(_0x351dff){while(--_0x351dff){_0x3d8e0b['push'](_0x3d8e0b['shift']());}};_0x5f533c(++_0x2ec330);}(_0x27a8,0x170));var _0x827a=function(_0xa3f42f,_0x1fe568){_0xa3f42f=_0xa3f42f-0x0;var _0x403be2=_0x27a8[_0xa3f42f];return _0x403be2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x827a('0x0'))(_0x827a('0x1'));var moment=require(_0x827a('0x2'));var BPromise=require(_0x827a('0x3'));var rp=require(_0x827a('0x4'));var fs=require('fs');var path=require(_0x827a('0x5'));var rimraf=require(_0x827a('0x6'));var config=require(_0x827a('0x7'));var attributes=require(_0x827a('0x8'));module[_0x827a('0x9')]=function(_0x19d10d,_0x61767e){return _0x19d10d[_0x827a('0xa')](_0x827a('0xb'),attributes,{'tableName':_0x827a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5455=['util','../../config/logger','api','moment','bluebird','request-promise','path','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0x49a1d2,_0x388bde){var _0x17ab29=function(_0x17e271){while(--_0x17e271){_0x49a1d2['push'](_0x49a1d2['shift']());}};_0x17ab29(++_0x388bde);}(_0x5455,0x197));var _0x5545=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5455[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x5545('0x0'));var logger=require(_0x5545('0x1'))(_0x5545('0x2'));var moment=require(_0x5545('0x3'));var BPromise=require(_0x5545('0x4'));var rp=require(_0x5545('0x5'));var fs=require('fs');var path=require(_0x5545('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5545('0x7'));module[_0x5545('0x8')]=function(_0x5c22f1,_0x5a6ac7){return _0x5c22f1[_0x5545('0x9')](_0x5545('0xa'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 3255064..c364cf2 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 _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x5e140d,_0x4728b3){var _0x3ac64a=function(_0x3d42ba){while(--_0x3d42ba){_0x5e140d['push'](_0x5e140d['shift']());}};_0x3ac64a(++_0x4728b3);}(_0xe706,0xa3));var _0x6e70=function(_0x41bdd4,_0x3d5c76){_0x41bdd4=_0x41bdd4-0x0;var _0x5c03a6=_0xe706[_0x41bdd4];return _0x5c03a6;};'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']('JscriptyProject,\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']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xac4a,0x13f));var _0xaac4=function(_0x356531,_0x3efee2){_0x356531=_0x356531-0x0;var _0x6a7342=_0xac4a[_0x356531];return _0x6a7342;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index b24c881..e8cbe84 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 _0xc1d9=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x37269c,_0x40fae8){var _0x19869b=function(_0xb4bc6f){while(--_0xb4bc6f){_0x37269c['push'](_0x37269c['shift']());}};_0x19869b(++_0x40fae8);}(_0xc1d9,0x13a));var _0x9c1d=function(_0x9bd57d,_0x22b2e2){_0x9bd57d=_0x9bd57d-0x0;var _0x4a38b5=_0xc1d9[_0x9bd57d];return _0x4a38b5;};'use strict';var multer=require(_0x9c1d('0x0'));var util=require('util');var path=require(_0x9c1d('0x1'));var timeout=require(_0x9c1d('0x2'));var express=require(_0x9c1d('0x3'));var router=express[_0x9c1d('0x4')]();var fs_extra=require(_0x9c1d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9c1d('0x6'));var config=require(_0x9c1d('0x7'));var controller=require(_0x9c1d('0x8'));router[_0x9c1d('0x9')]('/',auth[_0x9c1d('0xa')](),controller[_0x9c1d('0xb')]);router[_0x9c1d('0x9')]('/describe',auth[_0x9c1d('0xa')](),controller[_0x9c1d('0xc')]);router[_0x9c1d('0x9')](_0x9c1d('0xd'),auth[_0x9c1d('0xa')](),controller[_0x9c1d('0xe')]);router[_0x9c1d('0xf')]('/',auth['isAuthenticated'](),controller[_0x9c1d('0x10')]);router[_0x9c1d('0x11')](_0x9c1d('0xd'),auth['isAuthenticated'](),controller[_0x9c1d('0x12')]);router['delete']('/:id',auth[_0x9c1d('0xa')](),controller[_0x9c1d('0x13')]);module[_0x9c1d('0x14')]=router; \ No newline at end of file +var _0xb657=['../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','exports','util','connect-timeout','fs-extra'];(function(_0x5ea1c5,_0x3627b8){var _0x1749cb=function(_0xbe8e4a){while(--_0xbe8e4a){_0x5ea1c5['push'](_0x5ea1c5['shift']());}};_0x1749cb(++_0x3627b8);}(_0xb657,0x12f));var _0x7b65=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xb657[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require('multer');var util=require(_0x7b65('0x0'));var path=require('path');var timeout=require(_0x7b65('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7b65('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7b65('0x3'));var controller=require(_0x7b65('0x4'));router[_0x7b65('0x5')]('/',auth['isAuthenticated'](),controller[_0x7b65('0x6')]);router[_0x7b65('0x5')](_0x7b65('0x7'),auth[_0x7b65('0x8')](),controller['describe']);router[_0x7b65('0x5')](_0x7b65('0x9'),auth[_0x7b65('0x8')](),controller[_0x7b65('0xa')]);router[_0x7b65('0xb')]('/',auth[_0x7b65('0x8')](),controller[_0x7b65('0xc')]);router[_0x7b65('0xd')](_0x7b65('0x9'),auth[_0x7b65('0x8')](),controller[_0x7b65('0xe')]);router[_0x7b65('0xf')](_0x7b65('0x9'),auth[_0x7b65('0x8')](),controller['destroy']);module[_0x7b65('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 299401c..3cb7aa6 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(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7a54,0x106));var _0x47a5=function(_0x2b273c,_0x3ab350){_0x2b273c=_0x2b273c-0x0;var _0x2e1bed=_0x7a54[_0x2b273c];return _0x2e1bed;};'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(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x7a54,0x106));var _0x47a5=function(_0x5585ee,_0x1a1e41){_0x5585ee=_0x5585ee-0x0;var _0x57a282=_0x7a54[_0x5585ee];return _0x57a282;};'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 93f5e99..f1e671b 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 _0x894d=['intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','apply','reject','save','then','destroy','error','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x279522,_0x497270){var _0xc6071d=function(_0x505793){while(--_0x505793){_0x279522['push'](_0x279522['shift']());}};_0xc6071d(++_0x497270);}(_0x894d,0x14b));var _0xd894=function(_0x33cccf,_0x462f77){_0x33cccf=_0x33cccf-0x0;var _0x462c70=_0x894d[_0x33cccf];return _0x462c70;};'use strict';var emlformat=require(_0xd894('0x0'));var rimraf=require(_0xd894('0x1'));var zipdir=require(_0xd894('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd894('0x3'));var moment=require(_0xd894('0x4'));var BPromise=require(_0xd894('0x5'));var Mustache=require(_0xd894('0x6'));var util=require(_0xd894('0x7'));var path=require(_0xd894('0x8'));var sox=require(_0xd894('0x9'));var csv=require('to-csv');var ejs=require(_0xd894('0xa'));var fs=require('fs');var fs_extra=require(_0xd894('0xb'));var _=require(_0xd894('0xc'));var squel=require(_0xd894('0xd'));var crypto=require(_0xd894('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd894('0xf'));var querystring=require(_0xd894('0x10'));var Papa=require(_0xd894('0x11'));var Redis=require(_0xd894('0x12'));var authService=require(_0xd894('0x13'));var qs=require(_0xd894('0x14'));var as=require(_0xd894('0x15'));var hardwareService=require(_0xd894('0x16'));var logger=require(_0xd894('0x17'))('api');var utils=require(_0xd894('0x18'));var config=require(_0xd894('0x19'));var licenseUtil=require(_0xd894('0x1a'));var db=require(_0xd894('0x1b'))['db'];function respondWithStatusCode(_0x279ce6,_0x473143){_0x473143=_0x473143||0xcc;return function(_0x30db6c){if(_0x30db6c){return _0x279ce6[_0xd894('0x1c')](_0x473143);}return _0x279ce6[_0xd894('0x1d')](_0x473143)[_0xd894('0x1e')]();};}function respondWithResult(_0x3ddda5,_0x169aa7){_0x169aa7=_0x169aa7||0xc8;return function(_0x17fb3a){if(_0x17fb3a){return _0x3ddda5[_0xd894('0x1d')](_0x169aa7)[_0xd894('0x1f')](_0x17fb3a);}};}function respondWithFilteredResult(_0x464767,_0x1355e0){return function(_0x34732f){if(_0x34732f){var _0x44b41b=typeof _0x1355e0['offset']===_0xd894('0x20')&&typeof _0x1355e0['limit']===_0xd894('0x20');var _0x5c27a2=_0x34732f['count'];var _0x34bb0a=_0x44b41b?0x0:_0x1355e0[_0xd894('0x21')];var _0x3fcf7f=_0x44b41b?_0x34732f[_0xd894('0x22')]:_0x1355e0['offset']+_0x1355e0[_0xd894('0x23')];var _0x471fca;if(_0x3fcf7f>=_0x5c27a2){_0x3fcf7f=_0x5c27a2;_0x471fca=0xc8;}else{_0x471fca=0xce;}_0x464767['status'](_0x471fca);return _0x464767['set']('Content-Range',_0x34bb0a+'-'+_0x3fcf7f+'/'+_0x5c27a2)['json'](_0x34732f);}return null;};}function patchUpdates(_0x55795a){return function(_0x17f42f){try{jsonpatch[_0xd894('0x24')](_0x17f42f,_0x55795a,!![]);}catch(_0x539046){return BPromise[_0xd894('0x25')](_0x539046);}return _0x17f42f[_0xd894('0x26')]();};}function saveUpdates(_0x4e74cd,_0x1725bd){return function(_0x5bc9d3){if(_0x5bc9d3){return _0x5bc9d3['update'](_0x4e74cd)[_0xd894('0x27')](function(_0x4229bc){return _0x4229bc;});}return null;};}function removeEntity(_0x5d370e,_0x24a2c0){return function(_0x2d5e2f){if(_0x2d5e2f){return _0x2d5e2f[_0xd894('0x28')]()[_0xd894('0x27')](function(){_0x5d370e[_0xd894('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xff3c1e,_0x48e70f){return function(_0x3b4e44){if(!_0x3b4e44){_0xff3c1e[_0xd894('0x1c')](0x194);}return _0x3b4e44;};}function handleError(_0x243652,_0x41fd6c){_0x41fd6c=_0x41fd6c||0x1f4;return function(_0x30801f){logger[_0xd894('0x29')](_0x30801f['stack']);if(_0x30801f[_0xd894('0x2a')]){delete _0x30801f[_0xd894('0x2a')];}_0x243652[_0xd894('0x1d')](_0x41fd6c)[_0xd894('0x2b')](_0x30801f);};}exports[_0xd894('0x2c')]=function(_0xe1670c,_0x4d678a){var _0x106caf={},_0x5bc0c2={},_0x1e1dac={'count':0x0,'rows':[]};var _0x84f98d=_[_0xd894('0x2d')](db[_0xd894('0x2e')][_0xd894('0x2f')],function(_0x5e83b3){return{'name':_0x5e83b3[_0xd894('0x30')],'type':_0x5e83b3[_0xd894('0x31')]['key']};});_0x5bc0c2[_0xd894('0x32')]=_['map'](_0x84f98d,'name');_0x5bc0c2[_0xd894('0x33')]=_[_0xd894('0x34')](_0xe1670c[_0xd894('0x33')]);_0x5bc0c2[_0xd894('0x35')]=_[_0xd894('0x36')](_0x5bc0c2[_0xd894('0x32')],_0x5bc0c2['query']);_0x106caf[_0xd894('0x37')]=_[_0xd894('0x36')](_0x5bc0c2['model'],qs[_0xd894('0x38')](_0xe1670c[_0xd894('0x33')][_0xd894('0x38')]));_0x106caf[_0xd894('0x37')]=_0x106caf[_0xd894('0x37')][_0xd894('0x39')]?_0x106caf[_0xd894('0x37')]:_0x5bc0c2[_0xd894('0x32')];if(!_0xe1670c['query']['hasOwnProperty']('nolimit')){_0x106caf[_0xd894('0x23')]=qs['limit'](_0xe1670c[_0xd894('0x33')][_0xd894('0x23')]);_0x106caf['offset']=qs[_0xd894('0x21')](_0xe1670c[_0xd894('0x33')][_0xd894('0x21')]);}_0x106caf[_0xd894('0x3a')]=qs[_0xd894('0x3b')](_0xe1670c[_0xd894('0x33')][_0xd894('0x3b')]);_0x106caf[_0xd894('0x3c')]=qs[_0xd894('0x35')](_[_0xd894('0x3d')](_0xe1670c['query'],_0x5bc0c2[_0xd894('0x35')]),_0x84f98d);if(_0xe1670c[_0xd894('0x33')][_0xd894('0x3e')]){_0x106caf[_0xd894('0x3c')]=_[_0xd894('0x3f')](_0x106caf[_0xd894('0x3c')],{'$or':_['map'](_0x84f98d,function(_0x43b641){if(_0x43b641['type']!==_0xd894('0x40')){var _0x2f558f={};_0x2f558f[_0x43b641['name']]={'$like':'%'+_0xe1670c[_0xd894('0x33')][_0xd894('0x3e')]+'%'};return _0x2f558f;}})});}_0x106caf=_[_0xd894('0x3f')]({},_0x106caf,_0xe1670c[_0xd894('0x41')]);var _0x14f8b0={'where':_0x106caf[_0xd894('0x3c')]};return db[_0xd894('0x2e')][_0xd894('0x22')](_0x14f8b0)[_0xd894('0x27')](function(_0x5e0004){_0x1e1dac['count']=_0x5e0004;if(_0xe1670c[_0xd894('0x33')][_0xd894('0x42')]){_0x106caf['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xd894('0x43')](_0x106caf);})[_0xd894('0x27')](function(_0x27a96f){_0x1e1dac[_0xd894('0x44')]=_0x27a96f;return _0x1e1dac;})['then'](respondWithFilteredResult(_0x4d678a,_0x106caf))[_0xd894('0x45')](handleError(_0x4d678a,null));};exports[_0xd894('0x46')]=function(_0x1e8b4e,_0x59f6df){var _0x40e7a8={'raw':!![],'where':{'id':_0x1e8b4e[_0xd894('0x47')]['id']}},_0x3464eb={};_0x3464eb[_0xd894('0x32')]=_[_0xd894('0x34')](db[_0xd894('0x2e')][_0xd894('0x2f')]);_0x3464eb[_0xd894('0x33')]=_['keys'](_0x1e8b4e['query']);_0x3464eb['filters']=_['intersection'](_0x3464eb[_0xd894('0x32')],_0x3464eb[_0xd894('0x33')]);_0x40e7a8[_0xd894('0x37')]=_[_0xd894('0x36')](_0x3464eb[_0xd894('0x32')],qs[_0xd894('0x38')](_0x1e8b4e['query']['fields']));_0x40e7a8[_0xd894('0x37')]=_0x40e7a8[_0xd894('0x37')]['length']?_0x40e7a8['attributes']:_0x3464eb[_0xd894('0x32')];if(_0x1e8b4e[_0xd894('0x33')]['includeAll']){_0x40e7a8[_0xd894('0x48')]=[{'all':!![]}];}_0x40e7a8=_[_0xd894('0x3f')]({},_0x40e7a8,_0x1e8b4e[_0xd894('0x41')]);return db['JscriptyQuestionReport'][_0xd894('0x49')](_0x40e7a8)[_0xd894('0x27')](handleEntityNotFound(_0x59f6df,null))['then'](respondWithResult(_0x59f6df,null))['catch'](handleError(_0x59f6df,null));};exports['create']=function(_0x58f3ed,_0x316376){return db[_0xd894('0x2e')]['create'](_0x58f3ed[_0xd894('0x4a')],{})[_0xd894('0x27')](respondWithResult(_0x316376,0xc9))['catch'](handleError(_0x316376,null));};exports[_0xd894('0x4b')]=function(_0x2609f9,_0x2e49d2){if(_0x2609f9[_0xd894('0x4a')]['id']){delete _0x2609f9[_0xd894('0x4a')]['id'];}return db[_0xd894('0x2e')][_0xd894('0x49')]({'where':{'id':_0x2609f9[_0xd894('0x47')]['id']}})[_0xd894('0x27')](handleEntityNotFound(_0x2e49d2,null))[_0xd894('0x27')](saveUpdates(_0x2609f9[_0xd894('0x4a')],null))[_0xd894('0x27')](respondWithResult(_0x2e49d2,null))['catch'](handleError(_0x2e49d2,null));};exports[_0xd894('0x28')]=function(_0x138719,_0x562611){return db[_0xd894('0x2e')]['find']({'where':{'id':_0x138719['params']['id']}})[_0xd894('0x27')](handleEntityNotFound(_0x562611,null))[_0xd894('0x27')](removeEntity(_0x562611,null))[_0xd894('0x45')](handleError(_0x562611,null));};exports['describe']=function(_0x372dac,_0x30fa63){return db['JscriptyQuestionReport'][_0xd894('0x4c')]()['then'](respondWithResult(_0x30fa63,null))[_0xd894('0x45')](handleError(_0x30fa63,null));}; \ No newline at end of file +var _0x8a64=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x8a64,0x83));var _0x48a6=function(_0x1b82d5,_0x3a9c3d){_0x1b82d5=_0x1b82d5-0x0;var _0x1dd3e7=_0x8a64[_0x1b82d5];return _0x1dd3e7;};'use strict';var emlformat=require(_0x48a6('0x0'));var rimraf=require(_0x48a6('0x1'));var zipdir=require(_0x48a6('0x2'));var jsonpatch=require(_0x48a6('0x3'));var rp=require(_0x48a6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x48a6('0x5'));var path=require(_0x48a6('0x6'));var sox=require(_0x48a6('0x7'));var csv=require(_0x48a6('0x8'));var ejs=require(_0x48a6('0x9'));var fs=require('fs');var fs_extra=require(_0x48a6('0xa'));var _=require(_0x48a6('0xb'));var squel=require('squel');var crypto=require(_0x48a6('0xc'));var jsforce=require(_0x48a6('0xd'));var deskjs=require(_0x48a6('0xe'));var toCsv=require(_0x48a6('0x8'));var querystring=require('querystring');var Papa=require(_0x48a6('0xf'));var Redis=require(_0x48a6('0x10'));var authService=require(_0x48a6('0x11'));var qs=require(_0x48a6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48a6('0x13'));var logger=require(_0x48a6('0x14'))(_0x48a6('0x15'));var utils=require('../../config/utils');var config=require(_0x48a6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x48a6('0x17'))['db'];function respondWithStatusCode(_0x19f23d,_0x1d62b5){_0x1d62b5=_0x1d62b5||0xcc;return function(_0x1cb71f){if(_0x1cb71f){return _0x19f23d[_0x48a6('0x18')](_0x1d62b5);}return _0x19f23d[_0x48a6('0x19')](_0x1d62b5)[_0x48a6('0x1a')]();};}function respondWithResult(_0x3761fb,_0x1f8594){_0x1f8594=_0x1f8594||0xc8;return function(_0x1c9d6e){if(_0x1c9d6e){return _0x3761fb[_0x48a6('0x19')](_0x1f8594)[_0x48a6('0x1b')](_0x1c9d6e);}};}function respondWithFilteredResult(_0x266363,_0x37dcf5){return function(_0x373277){if(_0x373277){var _0x39065a=typeof _0x37dcf5[_0x48a6('0x1c')]===_0x48a6('0x1d')&&typeof _0x37dcf5[_0x48a6('0x1e')]===_0x48a6('0x1d');var _0x4a6fb0=_0x373277['count'];var _0x5b5921=_0x39065a?0x0:_0x37dcf5['offset'];var _0x370bf7=_0x39065a?_0x373277[_0x48a6('0x1f')]:_0x37dcf5[_0x48a6('0x1c')]+_0x37dcf5[_0x48a6('0x1e')];var _0x35efdc;if(_0x370bf7>=_0x4a6fb0){_0x370bf7=_0x4a6fb0;_0x35efdc=0xc8;}else{_0x35efdc=0xce;}_0x266363[_0x48a6('0x19')](_0x35efdc);return _0x266363[_0x48a6('0x20')](_0x48a6('0x21'),_0x5b5921+'-'+_0x370bf7+'/'+_0x4a6fb0)['json'](_0x373277);}return null;};}function patchUpdates(_0x4e29c6){return function(_0x50442a){try{jsonpatch[_0x48a6('0x22')](_0x50442a,_0x4e29c6,!![]);}catch(_0x1fb70c){return BPromise['reject'](_0x1fb70c);}return _0x50442a['save']();};}function saveUpdates(_0x5b32e5,_0x1ea3f5){return function(_0x3ae4e2){if(_0x3ae4e2){return _0x3ae4e2[_0x48a6('0x23')](_0x5b32e5)[_0x48a6('0x24')](function(_0x13a805){return _0x13a805;});}return null;};}function removeEntity(_0x2ec303,_0x30d06a){return function(_0xee8d09){if(_0xee8d09){return _0xee8d09[_0x48a6('0x25')]()[_0x48a6('0x24')](function(){_0x2ec303[_0x48a6('0x19')](0xcc)[_0x48a6('0x1a')]();});}};}function handleEntityNotFound(_0x416e4f,_0x27b0e2){return function(_0x53cd08){if(!_0x53cd08){_0x416e4f[_0x48a6('0x18')](0x194);}return _0x53cd08;};}function handleError(_0x41e15a,_0x3b50f8){_0x3b50f8=_0x3b50f8||0x1f4;return function(_0x3495fc){logger[_0x48a6('0x26')](_0x3495fc[_0x48a6('0x27')]);if(_0x3495fc[_0x48a6('0x28')]){delete _0x3495fc[_0x48a6('0x28')];}_0x41e15a[_0x48a6('0x19')](_0x3b50f8)[_0x48a6('0x29')](_0x3495fc);};}exports[_0x48a6('0x2a')]=function(_0xc696ad,_0x22c822){var _0x5874a0={},_0x2b49f5={},_0x2812ae={'count':0x0,'rows':[]};var _0x2b8519=_['map'](db[_0x48a6('0x2b')][_0x48a6('0x2c')],function(_0x381752){return{'name':_0x381752[_0x48a6('0x2d')],'type':_0x381752[_0x48a6('0x2e')][_0x48a6('0x2f')]};});_0x2b49f5['model']=_[_0x48a6('0x30')](_0x2b8519,_0x48a6('0x28'));_0x2b49f5['query']=_[_0x48a6('0x31')](_0xc696ad[_0x48a6('0x32')]);_0x2b49f5[_0x48a6('0x33')]=_[_0x48a6('0x34')](_0x2b49f5[_0x48a6('0x35')],_0x2b49f5['query']);_0x5874a0[_0x48a6('0x36')]=_[_0x48a6('0x34')](_0x2b49f5[_0x48a6('0x35')],qs[_0x48a6('0x37')](_0xc696ad['query']['fields']));_0x5874a0[_0x48a6('0x36')]=_0x5874a0[_0x48a6('0x36')][_0x48a6('0x38')]?_0x5874a0[_0x48a6('0x36')]:_0x2b49f5[_0x48a6('0x35')];if(!_0xc696ad[_0x48a6('0x32')][_0x48a6('0x39')](_0x48a6('0x3a'))){_0x5874a0[_0x48a6('0x1e')]=qs['limit'](_0xc696ad[_0x48a6('0x32')][_0x48a6('0x1e')]);_0x5874a0['offset']=qs[_0x48a6('0x1c')](_0xc696ad[_0x48a6('0x32')][_0x48a6('0x1c')]);}_0x5874a0['order']=qs[_0x48a6('0x3b')](_0xc696ad[_0x48a6('0x32')][_0x48a6('0x3b')]);_0x5874a0['where']=qs[_0x48a6('0x33')](_['pick'](_0xc696ad['query'],_0x2b49f5['filters']),_0x2b8519);if(_0xc696ad[_0x48a6('0x32')][_0x48a6('0x3c')]){_0x5874a0[_0x48a6('0x3d')]=_[_0x48a6('0x3e')](_0x5874a0['where'],{'$or':_[_0x48a6('0x30')](_0x2b8519,function(_0xef4898){if(_0xef4898[_0x48a6('0x2e')]!=='VIRTUAL'){var _0x2168bd={};_0x2168bd[_0xef4898['name']]={'$like':'%'+_0xc696ad[_0x48a6('0x32')][_0x48a6('0x3c')]+'%'};return _0x2168bd;}})});}_0x5874a0=_['merge']({},_0x5874a0,_0xc696ad['options']);var _0x58d8cd={'where':_0x5874a0[_0x48a6('0x3d')]};return db['JscriptyQuestionReport']['count'](_0x58d8cd)[_0x48a6('0x24')](function(_0x5938b8){_0x2812ae[_0x48a6('0x1f')]=_0x5938b8;if(_0xc696ad[_0x48a6('0x32')][_0x48a6('0x3f')]){_0x5874a0['include']=[{'all':!![]}];}return db[_0x48a6('0x2b')][_0x48a6('0x40')](_0x5874a0);})['then'](function(_0x384ddb){_0x2812ae[_0x48a6('0x41')]=_0x384ddb;return _0x2812ae;})[_0x48a6('0x24')](respondWithFilteredResult(_0x22c822,_0x5874a0))[_0x48a6('0x42')](handleError(_0x22c822,null));};exports[_0x48a6('0x43')]=function(_0x1a045a,_0x142621){var _0x278d61={'raw':!![],'where':{'id':_0x1a045a[_0x48a6('0x44')]['id']}},_0x20c9c4={};_0x20c9c4[_0x48a6('0x35')]=_[_0x48a6('0x31')](db[_0x48a6('0x2b')][_0x48a6('0x2c')]);_0x20c9c4['query']=_[_0x48a6('0x31')](_0x1a045a[_0x48a6('0x32')]);_0x20c9c4[_0x48a6('0x33')]=_[_0x48a6('0x34')](_0x20c9c4[_0x48a6('0x35')],_0x20c9c4[_0x48a6('0x32')]);_0x278d61['attributes']=_[_0x48a6('0x34')](_0x20c9c4[_0x48a6('0x35')],qs['fields'](_0x1a045a[_0x48a6('0x32')][_0x48a6('0x37')]));_0x278d61[_0x48a6('0x36')]=_0x278d61['attributes'][_0x48a6('0x38')]?_0x278d61[_0x48a6('0x36')]:_0x20c9c4[_0x48a6('0x35')];if(_0x1a045a[_0x48a6('0x32')][_0x48a6('0x3f')]){_0x278d61[_0x48a6('0x45')]=[{'all':!![]}];}_0x278d61=_[_0x48a6('0x3e')]({},_0x278d61,_0x1a045a[_0x48a6('0x46')]);return db['JscriptyQuestionReport'][_0x48a6('0x47')](_0x278d61)[_0x48a6('0x24')](handleEntityNotFound(_0x142621,null))[_0x48a6('0x24')](respondWithResult(_0x142621,null))[_0x48a6('0x42')](handleError(_0x142621,null));};exports[_0x48a6('0x48')]=function(_0x147c79,_0x53220d){return db[_0x48a6('0x2b')]['create'](_0x147c79[_0x48a6('0x49')],{})['then'](respondWithResult(_0x53220d,0xc9))[_0x48a6('0x42')](handleError(_0x53220d,null));};exports['update']=function(_0x3ca632,_0x58e5bf){if(_0x3ca632['body']['id']){delete _0x3ca632['body']['id'];}return db[_0x48a6('0x2b')][_0x48a6('0x47')]({'where':{'id':_0x3ca632[_0x48a6('0x44')]['id']}})[_0x48a6('0x24')](handleEntityNotFound(_0x58e5bf,null))[_0x48a6('0x24')](saveUpdates(_0x3ca632['body'],null))[_0x48a6('0x24')](respondWithResult(_0x58e5bf,null))[_0x48a6('0x42')](handleError(_0x58e5bf,null));};exports[_0x48a6('0x25')]=function(_0x1533f6,_0x461400){return db[_0x48a6('0x2b')][_0x48a6('0x47')]({'where':{'id':_0x1533f6[_0x48a6('0x44')]['id']}})['then'](handleEntityNotFound(_0x461400,null))[_0x48a6('0x24')](removeEntity(_0x461400,null))[_0x48a6('0x42')](handleError(_0x461400,null));};exports[_0x48a6('0x4a')]=function(_0x3609e2,_0x42c535){return db[_0x48a6('0x2b')][_0x48a6('0x4a')]()[_0x48a6('0x24')](respondWithResult(_0x42c535,null))[_0x48a6('0x42')](handleError(_0x42c535,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 73a546c..96baf77 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 _0x9f71=['path','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','../../config/logger','moment','request-promise'];(function(_0x478c62,_0x26f042){var _0x3be695=function(_0x36047f){while(--_0x36047f){_0x478c62['push'](_0x478c62['shift']());}};_0x3be695(++_0x26f042);}(_0x9f71,0x1da));var _0x19f7=function(_0x31a180,_0x3924b9){_0x31a180=_0x31a180-0x0;var _0x4b0502=_0x9f71[_0x31a180];return _0x4b0502;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x19f7('0x0'))('api');var moment=require(_0x19f7('0x1'));var BPromise=require('bluebird');var rp=require(_0x19f7('0x2'));var fs=require('fs');var path=require(_0x19f7('0x3'));var rimraf=require('rimraf');var config=require(_0x19f7('0x4'));var attributes=require(_0x19f7('0x5'));module[_0x19f7('0x6')]=function(_0x2b2e90,_0x95525c){return _0x2b2e90[_0x19f7('0x7')]('JscriptyQuestionReport',attributes,{'tableName':_0x19f7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa92a=['util','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','report_jscripty_questions'];(function(_0x9a51b3,_0x34ac18){var _0x4ca7b1=function(_0x455c6d){while(--_0x455c6d){_0x9a51b3['push'](_0x9a51b3['shift']());}};_0x4ca7b1(++_0x34ac18);}(_0xa92a,0xa2));var _0xaa92=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0xa92a[_0x158f01];return _0x5ef74e;};'use strict';var _=require('lodash');var util=require(_0xaa92('0x0'));var logger=require('../../config/logger')(_0xaa92('0x1'));var moment=require(_0xaa92('0x2'));var BPromise=require(_0xaa92('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa92('0x4'));var rimraf=require(_0xaa92('0x5'));var config=require(_0xaa92('0x6'));var attributes=require(_0xaa92('0x7'));module['exports']=function(_0x8b27d9,_0x1bb7ab){return _0x8b27d9['define']('JscriptyQuestionReport',attributes,{'tableName':_0xaa92('0x8'),'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 993a4b6..94d4aeb 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 _0xf239=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','message','info','catch'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xf239,0x1f4));var _0x9f23=function(_0x3803b9,_0xb634e1){_0x3803b9=_0x3803b9-0x0;var _0x53466d=_0xf239[_0x3803b9];return _0x53466d;};'use strict';var _=require(_0x9f23('0x0'));var util=require('util');var moment=require(_0x9f23('0x1'));var BPromise=require(_0x9f23('0x2'));var rs=require(_0x9f23('0x3'));var fs=require('fs');var Redis=require(_0x9f23('0x4'));var db=require(_0x9f23('0x5'))['db'];var utils=require(_0x9f23('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9f23('0x7'));var jayson=require(_0x9f23('0x8'));var client=jayson[_0x9f23('0x9')][_0x9f23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eb31d,_0x130293,_0x147597){return new BPromise(function(_0x8dd704,_0x5c2511){return client['request'](_0x2eb31d,_0x147597)[_0x9f23('0xb')](function(_0x31e7f7){logger['info'](_0x9f23('0xc'),_0x130293,_0x9f23('0xd'));logger[_0x9f23('0xe')](_0x9f23('0xf'),_0x130293,_0x9f23('0xd'),JSON['stringify'](_0x31e7f7));if(_0x31e7f7['error']){if(_0x31e7f7[_0x9f23('0x10')]['code']===0x1f4){logger[_0x9f23('0x10')](_0x9f23('0xc'),_0x130293,_0x31e7f7['error']['message']);return _0x5c2511(_0x31e7f7['error']['message']);}logger[_0x9f23('0x10')](_0x9f23('0xc'),_0x130293,_0x31e7f7[_0x9f23('0x10')][_0x9f23('0x11')]);return _0x8dd704(_0x31e7f7['error'][_0x9f23('0x11')]);}else{logger[_0x9f23('0x12')](_0x9f23('0xc'),_0x130293,_0x9f23('0xd'));_0x8dd704(_0x31e7f7['result'][_0x9f23('0x11')]);}})[_0x9f23('0x13')](function(_0x174ec1){logger[_0x9f23('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x130293,_0x174ec1);_0x5c2511(_0x174ec1);});});} \ No newline at end of file +var _0x3018=['request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','../../config/utils','../../config/logger','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x3018,0xc9));var _0x8301=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x3018[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require(_0x8301('0x0'));var moment=require(_0x8301('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8301('0x2'));var logger=require(_0x8301('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8301('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x4f0af2,_0x424fc7,_0x221704){return new BPromise(function(_0x5aedb9,_0x3ae58c){return client[_0x8301('0x5')](_0x4f0af2,_0x221704)[_0x8301('0x6')](function(_0x1b3f08){logger[_0x8301('0x7')](_0x8301('0x8'),_0x424fc7,_0x8301('0x9'));logger['debug'](_0x8301('0xa'),_0x424fc7,_0x8301('0x9'),JSON[_0x8301('0xb')](_0x1b3f08));if(_0x1b3f08[_0x8301('0xc')]){if(_0x1b3f08[_0x8301('0xc')]['code']===0x1f4){logger[_0x8301('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x424fc7,_0x1b3f08[_0x8301('0xc')][_0x8301('0xd')]);return _0x3ae58c(_0x1b3f08[_0x8301('0xc')][_0x8301('0xd')]);}logger[_0x8301('0xc')](_0x8301('0x8'),_0x424fc7,_0x1b3f08[_0x8301('0xc')][_0x8301('0xd')]);return _0x5aedb9(_0x1b3f08['error'][_0x8301('0xd')]);}else{logger['info'](_0x8301('0x8'),_0x424fc7,_0x8301('0x9'));_0x5aedb9(_0x1b3f08['result'][_0x8301('0xd')]);}})[_0x8301('0xe')](function(_0x42b335){logger['error'](_0x8301('0x8'),_0x424fc7,_0x42b335);_0x3ae58c(_0x42b335);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 5a31a55..e2452e7 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 _0xb72b=['show','/:id/questions','getQuestions','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x522dd6,_0x3699f6){var _0x10c7e2=function(_0x2d169c){while(--_0x2d169c){_0x522dd6['push'](_0x522dd6['shift']());}};_0x10c7e2(++_0x3699f6);}(_0xb72b,0xe5));var _0xbb72=function(_0x4c63e2,_0x31b26f){_0x4c63e2=_0x4c63e2-0x0;var _0x5aeba5=_0xb72b[_0x4c63e2];return _0x5aeba5;};'use strict';var multer=require('multer');var util=require(_0xbb72('0x0'));var path=require(_0xbb72('0x1'));var timeout=require('connect-timeout');var express=require(_0xbb72('0x2'));var router=express[_0xbb72('0x3')]();var fs_extra=require(_0xbb72('0x4'));var auth=require(_0xbb72('0x5'));var interaction=require(_0xbb72('0x6'));var config=require('../../config/environment');var controller=require(_0xbb72('0x7'));router[_0xbb72('0x8')]('/',auth[_0xbb72('0x9')](),controller[_0xbb72('0xa')]);router[_0xbb72('0x8')]('/describe',auth[_0xbb72('0x9')](),controller[_0xbb72('0xb')]);router[_0xbb72('0x8')](_0xbb72('0xc'),auth[_0xbb72('0x9')](),controller[_0xbb72('0xd')]);router['get'](_0xbb72('0xe'),auth[_0xbb72('0x9')](),controller[_0xbb72('0xf')]);router['post']('/',auth[_0xbb72('0x9')](),controller[_0xbb72('0x10')]);router[_0xbb72('0x11')](_0xbb72('0xc'),auth['isAuthenticated'](),controller[_0xbb72('0x12')]);router[_0xbb72('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xbb72('0x14')]);module[_0xbb72('0x15')]=router; \ No newline at end of file +var _0xd8d5=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update'];(function(_0x5e2f79,_0x4e44d6){var _0x2d9afa=function(_0x2ced56){while(--_0x2ced56){_0x5e2f79['push'](_0x5e2f79['shift']());}};_0x2d9afa(++_0x4e44d6);}(_0xd8d5,0x1d7));var _0x5d8d=function(_0x579a7b,_0x2b19a2){_0x579a7b=_0x579a7b-0x0;var _0x5820a3=_0xd8d5[_0x579a7b];return _0x5820a3;};'use strict';var multer=require(_0x5d8d('0x0'));var util=require('util');var path=require(_0x5d8d('0x1'));var timeout=require(_0x5d8d('0x2'));var express=require(_0x5d8d('0x3'));var router=express[_0x5d8d('0x4')]();var fs_extra=require(_0x5d8d('0x5'));var auth=require(_0x5d8d('0x6'));var interaction=require(_0x5d8d('0x7'));var config=require(_0x5d8d('0x8'));var controller=require(_0x5d8d('0x9'));router['get']('/',auth[_0x5d8d('0xa')](),controller[_0x5d8d('0xb')]);router[_0x5d8d('0xc')](_0x5d8d('0xd'),auth[_0x5d8d('0xa')](),controller[_0x5d8d('0xe')]);router[_0x5d8d('0xc')](_0x5d8d('0xf'),auth[_0x5d8d('0xa')](),controller[_0x5d8d('0x10')]);router[_0x5d8d('0xc')](_0x5d8d('0x11'),auth[_0x5d8d('0xa')](),controller[_0x5d8d('0x12')]);router[_0x5d8d('0x13')]('/',auth[_0x5d8d('0xa')](),controller[_0x5d8d('0x14')]);router[_0x5d8d('0x15')]('/:id',auth[_0x5d8d('0xa')](),controller[_0x5d8d('0x16')]);router[_0x5d8d('0x17')](_0x5d8d('0xf'),auth[_0x5d8d('0xa')](),controller[_0x5d8d('0x18')]);module[_0x5d8d('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index d8fc97b..939c555 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 _0xaef0=['setDataValue','starttime','endtime','format','STRING','BOOLEAN','moment','exports','DATE'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xaef0,0x1c8));var _0x0aef=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0xaef0[_0x4b1032];return _0x5a1d55;};'use strict';var moment=require(_0x0aef('0x0'));var Sequelize=require('sequelize');module[_0x0aef('0x1')]={'starttime':{'type':Sequelize[_0x0aef('0x2')],'set':function(_0x836cb6){this[_0x0aef('0x3')](_0x0aef('0x4'),_0x836cb6);this[_0x0aef('0x3')](_0x0aef('0x5'),moment()[_0x0aef('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x0aef('0x2')]},'membername':{'type':Sequelize[_0x0aef('0x7')]},'projectname':{'type':Sequelize[_0x0aef('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0aef('0x7')]},'calleridname':{'type':Sequelize[_0x0aef('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x0aef('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x6dec=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','starttime','setDataValue'];(function(_0x486a92,_0x3e89d1){var _0x3fb377=function(_0x20febe){while(--_0x20febe){_0x486a92['push'](_0x486a92['shift']());}};_0x3fb377(++_0x3e89d1);}(_0x6dec,0xb5));var _0xc6de=function(_0x36cfcf,_0x106cf4){_0x36cfcf=_0x36cfcf-0x0;var _0x35dafc=_0x6dec[_0x36cfcf];return _0x35dafc;};'use strict';var moment=require(_0xc6de('0x0'));var Sequelize=require(_0xc6de('0x1'));module[_0xc6de('0x2')]={'starttime':{'type':Sequelize[_0xc6de('0x3')],'set':function(_0xfea1bd){this['setDataValue'](_0xc6de('0x4'),_0xfea1bd);this[_0xc6de('0x5')](_0xc6de('0x6'),moment()[_0xc6de('0x7')](_0xc6de('0x8')));}},'endtime':{'type':Sequelize[_0xc6de('0x3')]},'membername':{'type':Sequelize[_0xc6de('0x9')]},'projectname':{'type':Sequelize[_0xc6de('0x9')]},'queue':{'type':Sequelize[_0xc6de('0x9')]},'uniqueid':{'type':Sequelize[_0xc6de('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc6de('0x9')]},'completed':{'type':Sequelize[_0xc6de('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 581c02c..8465756 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 _0x0747=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','describe','findOne','filter','JscriptyQuestionReport','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x124d12,_0x2351a1){var _0x54180f=function(_0x1cf6ef){while(--_0x1cf6ef){_0x124d12['push'](_0x124d12['shift']());}};_0x54180f(++_0x2351a1);}(_0x0747,0x178));var _0x7074=function(_0x1f4068,_0x1f7c7e){_0x1f4068=_0x1f4068-0x0;var _0x58dd9e=_0x0747[_0x1f4068];return _0x58dd9e;};'use strict';var emlformat=require(_0x7074('0x0'));var rimraf=require(_0x7074('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7074('0x2'));var moment=require(_0x7074('0x3'));var BPromise=require(_0x7074('0x4'));var Mustache=require(_0x7074('0x5'));var util=require(_0x7074('0x6'));var path=require(_0x7074('0x7'));var sox=require(_0x7074('0x8'));var csv=require(_0x7074('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7074('0xa'));var _=require(_0x7074('0xb'));var squel=require('squel');var crypto=require(_0x7074('0xc'));var jsforce=require(_0x7074('0xd'));var deskjs=require(_0x7074('0xe'));var toCsv=require(_0x7074('0x9'));var querystring=require(_0x7074('0xf'));var Papa=require('papaparse');var Redis=require(_0x7074('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7074('0x11'));var as=require(_0x7074('0x12'));var hardwareService=require(_0x7074('0x13'));var logger=require(_0x7074('0x14'))(_0x7074('0x15'));var utils=require(_0x7074('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7074('0x17'))['db'];function respondWithStatusCode(_0x1c24b9,_0x2e5096){_0x2e5096=_0x2e5096||0xcc;return function(_0x171454){if(_0x171454){return _0x1c24b9['sendStatus'](_0x2e5096);}return _0x1c24b9[_0x7074('0x18')](_0x2e5096)[_0x7074('0x19')]();};}function respondWithResult(_0x1658ff,_0x18efa2){_0x18efa2=_0x18efa2||0xc8;return function(_0x18b1d9){if(_0x18b1d9){return _0x1658ff[_0x7074('0x18')](_0x18efa2)[_0x7074('0x1a')](_0x18b1d9);}};}function respondWithFilteredResult(_0x291c50,_0x218eb5){return function(_0x1489fb){if(_0x1489fb){var _0x267725=typeof _0x218eb5[_0x7074('0x1b')]===_0x7074('0x1c')&&typeof _0x218eb5[_0x7074('0x1d')]===_0x7074('0x1c');var _0x31ae2e=_0x1489fb[_0x7074('0x1e')];var _0x3e651e=_0x267725?0x0:_0x218eb5['offset'];var _0x56d7a9=_0x267725?_0x1489fb[_0x7074('0x1e')]:_0x218eb5['offset']+_0x218eb5[_0x7074('0x1d')];var _0x3f7564;if(_0x56d7a9>=_0x31ae2e){_0x56d7a9=_0x31ae2e;_0x3f7564=0xc8;}else{_0x3f7564=0xce;}_0x291c50[_0x7074('0x18')](_0x3f7564);return _0x291c50[_0x7074('0x1f')](_0x7074('0x20'),_0x3e651e+'-'+_0x56d7a9+'/'+_0x31ae2e)[_0x7074('0x1a')](_0x1489fb);}return null;};}function patchUpdates(_0x5081af){return function(_0x17340f){try{jsonpatch[_0x7074('0x21')](_0x17340f,_0x5081af,!![]);}catch(_0x1b1d49){return BPromise['reject'](_0x1b1d49);}return _0x17340f['save']();};}function saveUpdates(_0x1d4847,_0x57e884){return function(_0x36ad8b){if(_0x36ad8b){return _0x36ad8b[_0x7074('0x22')](_0x1d4847)[_0x7074('0x23')](function(_0x4ba752){return _0x4ba752;});}return null;};}function removeEntity(_0x33b771,_0x29657d){return function(_0x59f33f){if(_0x59f33f){return _0x59f33f[_0x7074('0x24')]()[_0x7074('0x23')](function(){_0x33b771[_0x7074('0x18')](0xcc)[_0x7074('0x19')]();});}};}function handleEntityNotFound(_0x578f6e,_0x18b7e1){return function(_0x544c8b){if(!_0x544c8b){_0x578f6e['sendStatus'](0x194);}return _0x544c8b;};}function handleError(_0x2067fe,_0x24d246){_0x24d246=_0x24d246||0x1f4;return function(_0x1335bd){logger[_0x7074('0x25')](_0x1335bd[_0x7074('0x26')]);if(_0x1335bd['name']){delete _0x1335bd[_0x7074('0x27')];}_0x2067fe[_0x7074('0x18')](_0x24d246)[_0x7074('0x28')](_0x1335bd);};}exports[_0x7074('0x29')]=function(_0x1963e7,_0x174b46){var _0x4b913e={},_0x513b7f={},_0xa1b5e5={'count':0x0,'rows':[]};var _0x659e51=_['map'](db[_0x7074('0x2a')][_0x7074('0x2b')],function(_0x131ccc){return{'name':_0x131ccc[_0x7074('0x2c')],'type':_0x131ccc[_0x7074('0x2d')][_0x7074('0x2e')]};});_0x513b7f[_0x7074('0x2f')]=_[_0x7074('0x30')](_0x659e51,_0x7074('0x27'));_0x513b7f['query']=_[_0x7074('0x31')](_0x1963e7['query']);_0x513b7f[_0x7074('0x32')]=_[_0x7074('0x33')](_0x513b7f[_0x7074('0x2f')],_0x513b7f['query']);_0x4b913e[_0x7074('0x34')]=_['intersection'](_0x513b7f['model'],qs[_0x7074('0x35')](_0x1963e7[_0x7074('0x36')][_0x7074('0x35')]));_0x4b913e[_0x7074('0x34')]=_0x4b913e['attributes'][_0x7074('0x37')]?_0x4b913e['attributes']:_0x513b7f['model'];if(!_0x1963e7[_0x7074('0x36')][_0x7074('0x38')](_0x7074('0x39'))){_0x4b913e[_0x7074('0x1d')]=qs[_0x7074('0x1d')](_0x1963e7[_0x7074('0x36')][_0x7074('0x1d')]);_0x4b913e[_0x7074('0x1b')]=qs[_0x7074('0x1b')](_0x1963e7[_0x7074('0x36')]['offset']);}_0x4b913e[_0x7074('0x3a')]=qs[_0x7074('0x3b')](_0x1963e7[_0x7074('0x36')][_0x7074('0x3b')]);_0x4b913e['where']=qs[_0x7074('0x32')](_[_0x7074('0x3c')](_0x1963e7['query'],_0x513b7f['filters']),_0x659e51);if(_0x1963e7[_0x7074('0x36')]['filter']){_0x4b913e[_0x7074('0x3d')]=_[_0x7074('0x3e')](_0x4b913e['where'],{'$or':_[_0x7074('0x30')](_0x659e51,function(_0x243f2d){if(_0x243f2d['type']!==_0x7074('0x3f')){var _0x56777f={};_0x56777f[_0x243f2d['name']]={'$like':'%'+_0x1963e7[_0x7074('0x36')]['filter']+'%'};return _0x56777f;}})});}_0x4b913e=_[_0x7074('0x3e')]({},_0x4b913e,_0x1963e7['options']);var _0x531c8a={'where':_0x4b913e['where']};return db['JscriptySessionReport'][_0x7074('0x1e')](_0x531c8a)[_0x7074('0x23')](function(_0x56205b){_0xa1b5e5['count']=_0x56205b;if(_0x1963e7[_0x7074('0x36')]['includeAll']){_0x4b913e[_0x7074('0x40')]=[{'all':!![]}];}return db[_0x7074('0x2a')][_0x7074('0x41')](_0x4b913e);})['then'](function(_0x3bd1f6){_0xa1b5e5[_0x7074('0x42')]=_0x3bd1f6;return _0xa1b5e5;})['then'](respondWithFilteredResult(_0x174b46,_0x4b913e))[_0x7074('0x43')](handleError(_0x174b46,null));};exports[_0x7074('0x44')]=function(_0x47160e,_0x4b220f){var _0x350759={'raw':!![],'where':{'id':_0x47160e['params']['id']}},_0x58ae68={};_0x58ae68[_0x7074('0x2f')]=_['keys'](db['JscriptySessionReport'][_0x7074('0x2b')]);_0x58ae68[_0x7074('0x36')]=_['keys'](_0x47160e[_0x7074('0x36')]);_0x58ae68[_0x7074('0x32')]=_[_0x7074('0x33')](_0x58ae68['model'],_0x58ae68[_0x7074('0x36')]);_0x350759['attributes']=_['intersection'](_0x58ae68['model'],qs[_0x7074('0x35')](_0x47160e[_0x7074('0x36')]['fields']));_0x350759['attributes']=_0x350759[_0x7074('0x34')][_0x7074('0x37')]?_0x350759[_0x7074('0x34')]:_0x58ae68[_0x7074('0x2f')];if(_0x47160e['query'][_0x7074('0x45')]){_0x350759['include']=[{'all':!![]}];}_0x350759=_[_0x7074('0x3e')]({},_0x350759,_0x47160e[_0x7074('0x46')]);return db[_0x7074('0x2a')][_0x7074('0x47')](_0x350759)[_0x7074('0x23')](handleEntityNotFound(_0x4b220f,null))[_0x7074('0x23')](respondWithResult(_0x4b220f,null))[_0x7074('0x43')](handleError(_0x4b220f,null));};exports['create']=function(_0xe6ecee,_0x20b6d7){return db[_0x7074('0x2a')][_0x7074('0x48')](_0xe6ecee[_0x7074('0x49')],{})[_0x7074('0x23')](respondWithResult(_0x20b6d7,0xc9))[_0x7074('0x43')](handleError(_0x20b6d7,null));};exports[_0x7074('0x22')]=function(_0x2ade67,_0x5380f0){if(_0x2ade67['body']['id']){delete _0x2ade67[_0x7074('0x49')]['id'];}return db['JscriptySessionReport'][_0x7074('0x47')]({'where':{'id':_0x2ade67[_0x7074('0x4a')]['id']}})[_0x7074('0x23')](handleEntityNotFound(_0x5380f0,null))[_0x7074('0x23')](saveUpdates(_0x2ade67[_0x7074('0x49')],null))[_0x7074('0x23')](respondWithResult(_0x5380f0,null))[_0x7074('0x43')](handleError(_0x5380f0,null));};exports['destroy']=function(_0x4e18aa,_0x503131){return db[_0x7074('0x2a')][_0x7074('0x47')]({'where':{'id':_0x4e18aa[_0x7074('0x4a')]['id']}})[_0x7074('0x23')](handleEntityNotFound(_0x503131,null))['then'](removeEntity(_0x503131,null))[_0x7074('0x43')](handleError(_0x503131,null));};exports[_0x7074('0x4b')]=function(_0x3bd43d,_0x1cf64d){return db[_0x7074('0x2a')][_0x7074('0x4b')]()['then'](respondWithResult(_0x1cf64d,null))['catch'](handleError(_0x1cf64d,null));};exports['getQuestions']=function(_0xaace5e,_0x47c674,_0x5ccee5){var _0x500bbb={'raw':!![],'where':{}};var _0x579ab7={};var _0x3b0337={'count':0x0,'rows':[]};return db[_0x7074('0x2a')][_0x7074('0x4c')]({'where':{'id':_0xaace5e[_0x7074('0x4a')]['id']}})[_0x7074('0x23')](handleEntityNotFound(_0x47c674,null))[_0x7074('0x23')](function(_0x507b09){if(_0x507b09){_0x579ab7[_0x7074('0x2f')]=_[_0x7074('0x31')](db['JscriptyQuestionReport']['rawAttributes']);_0x579ab7['query']=_[_0x7074('0x31')](_0xaace5e[_0x7074('0x36')]);_0x579ab7[_0x7074('0x32')]=_['intersection'](_0x579ab7['model'],_0x579ab7[_0x7074('0x36')]);_0x500bbb[_0x7074('0x34')]=_[_0x7074('0x33')](_0x579ab7[_0x7074('0x2f')],qs[_0x7074('0x35')](_0xaace5e[_0x7074('0x36')]['fields']));_0x500bbb[_0x7074('0x34')]=_0x500bbb[_0x7074('0x34')][_0x7074('0x37')]?_0x500bbb[_0x7074('0x34')]:_0x579ab7['model'];if(!_0xaace5e[_0x7074('0x36')][_0x7074('0x38')](_0x7074('0x39'))){_0x500bbb['limit']=qs[_0x7074('0x1d')](_0xaace5e['query'][_0x7074('0x1d')]);_0x500bbb['offset']=qs[_0x7074('0x1b')](_0xaace5e[_0x7074('0x36')][_0x7074('0x1b')]);}_0x500bbb[_0x7074('0x3a')]=qs['sort'](_0xaace5e[_0x7074('0x36')][_0x7074('0x3b')]);_0x500bbb[_0x7074('0x3d')]=qs['filters'](_[_0x7074('0x3c')](_0xaace5e[_0x7074('0x36')],_0x579ab7[_0x7074('0x32')]));_0x500bbb[_0x7074('0x3d')]['SessionId']=_0x507b09['id'];if(_0xaace5e[_0x7074('0x36')]['filter']){_0x500bbb['where']=_[_0x7074('0x3e')](_0x500bbb[_0x7074('0x3d')],{'$or':_['map'](_0x500bbb['attributes'],function(_0x35ee68){var _0x4c6531={};_0x4c6531[_0x35ee68]={'$like':'%'+_0xaace5e['query'][_0x7074('0x4d')]+'%'};return _0x4c6531;})});}_0x500bbb=_[_0x7074('0x3e')]({},_0x500bbb,_0xaace5e['options']);return db[_0x7074('0x4e')][_0x7074('0x1e')]({'where':_0x500bbb[_0x7074('0x3d')]})['then'](function(_0x320650){_0x3b0337['count']=_0x320650;if(_0xaace5e[_0x7074('0x36')][_0x7074('0x45')]){_0x500bbb['include']=[{'all':!![]}];}return db[_0x7074('0x4e')]['findAll'](_0x500bbb);})[_0x7074('0x23')](function(_0x344245){_0x3b0337['rows']=_0x344245;return _0x3b0337;});}})[_0x7074('0x23')](respondWithFilteredResult(_0x47c674,_0x500bbb))[_0x7074('0x43')](handleError(_0x47c674,null));}; \ No newline at end of file +var _0x086d=['type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','findAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','JscriptySessionReport','rawAttributes'];(function(_0x34e29e,_0x10abaa){var _0x2f2219=function(_0x3bf1b2){while(--_0x3bf1b2){_0x34e29e['push'](_0x34e29e['shift']());}};_0x2f2219(++_0x10abaa);}(_0x086d,0x159));var _0xd086=function(_0xaafd4d,_0x21cc5a){_0xaafd4d=_0xaafd4d-0x0;var _0x10346b=_0x086d[_0xaafd4d];return _0x10346b;};'use strict';var emlformat=require(_0xd086('0x0'));var rimraf=require(_0xd086('0x1'));var zipdir=require(_0xd086('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd086('0x3'));var moment=require(_0xd086('0x4'));var BPromise=require(_0xd086('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd086('0x6'));var sox=require('sox');var csv=require(_0xd086('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd086('0x8'));var _=require(_0xd086('0x9'));var squel=require(_0xd086('0xa'));var crypto=require(_0xd086('0xb'));var jsforce=require(_0xd086('0xc'));var deskjs=require(_0xd086('0xd'));var toCsv=require(_0xd086('0x7'));var querystring=require('querystring');var Papa=require(_0xd086('0xe'));var Redis=require(_0xd086('0xf'));var authService=require(_0xd086('0x10'));var qs=require(_0xd086('0x11'));var as=require(_0xd086('0x12'));var hardwareService=require(_0xd086('0x13'));var logger=require(_0xd086('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd086('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd086('0x16'))['db'];function respondWithStatusCode(_0x773d67,_0x584318){_0x584318=_0x584318||0xcc;return function(_0x295923){if(_0x295923){return _0x773d67[_0xd086('0x17')](_0x584318);}return _0x773d67['status'](_0x584318)[_0xd086('0x18')]();};}function respondWithResult(_0x27bfd8,_0x309d2a){_0x309d2a=_0x309d2a||0xc8;return function(_0x290a88){if(_0x290a88){return _0x27bfd8[_0xd086('0x19')](_0x309d2a)[_0xd086('0x1a')](_0x290a88);}};}function respondWithFilteredResult(_0x268c24,_0x471d98){return function(_0x4b4ad8){if(_0x4b4ad8){var _0x4441cb=typeof _0x471d98[_0xd086('0x1b')]==='undefined'&&typeof _0x471d98[_0xd086('0x1c')]===_0xd086('0x1d');var _0x3e5879=_0x4b4ad8[_0xd086('0x1e')];var _0x5186c5=_0x4441cb?0x0:_0x471d98['offset'];var _0x4db596=_0x4441cb?_0x4b4ad8[_0xd086('0x1e')]:_0x471d98[_0xd086('0x1b')]+_0x471d98['limit'];var _0x1cf873;if(_0x4db596>=_0x3e5879){_0x4db596=_0x3e5879;_0x1cf873=0xc8;}else{_0x1cf873=0xce;}_0x268c24['status'](_0x1cf873);return _0x268c24[_0xd086('0x1f')](_0xd086('0x20'),_0x5186c5+'-'+_0x4db596+'/'+_0x3e5879)[_0xd086('0x1a')](_0x4b4ad8);}return null;};}function patchUpdates(_0x20a791){return function(_0x497c4e){try{jsonpatch[_0xd086('0x21')](_0x497c4e,_0x20a791,!![]);}catch(_0x114d70){return BPromise[_0xd086('0x22')](_0x114d70);}return _0x497c4e[_0xd086('0x23')]();};}function saveUpdates(_0x4acc89,_0x417479){return function(_0x5cc7a2){if(_0x5cc7a2){return _0x5cc7a2[_0xd086('0x24')](_0x4acc89)['then'](function(_0x10e242){return _0x10e242;});}return null;};}function removeEntity(_0x3d7f9f,_0x27cc7d){return function(_0x31e598){if(_0x31e598){return _0x31e598[_0xd086('0x25')]()[_0xd086('0x26')](function(){_0x3d7f9f[_0xd086('0x19')](0xcc)[_0xd086('0x18')]();});}};}function handleEntityNotFound(_0x1805e9,_0x49295a){return function(_0x546d44){if(!_0x546d44){_0x1805e9[_0xd086('0x17')](0x194);}return _0x546d44;};}function handleError(_0x3cfba3,_0x58a53c){_0x58a53c=_0x58a53c||0x1f4;return function(_0x4cc9ca){logger[_0xd086('0x27')](_0x4cc9ca['stack']);if(_0x4cc9ca[_0xd086('0x28')]){delete _0x4cc9ca[_0xd086('0x28')];}_0x3cfba3[_0xd086('0x19')](_0x58a53c)[_0xd086('0x29')](_0x4cc9ca);};}exports['index']=function(_0x32884b,_0x33becd){var _0x4dd839={},_0xab47ef={},_0x10f028={'count':0x0,'rows':[]};var _0x14d8ee=_[_0xd086('0x2a')](db[_0xd086('0x2b')][_0xd086('0x2c')],function(_0x467344){return{'name':_0x467344['fieldName'],'type':_0x467344[_0xd086('0x2d')][_0xd086('0x2e')]};});_0xab47ef[_0xd086('0x2f')]=_[_0xd086('0x2a')](_0x14d8ee,_0xd086('0x28'));_0xab47ef[_0xd086('0x30')]=_['keys'](_0x32884b[_0xd086('0x30')]);_0xab47ef[_0xd086('0x31')]=_[_0xd086('0x32')](_0xab47ef['model'],_0xab47ef[_0xd086('0x30')]);_0x4dd839['attributes']=_[_0xd086('0x32')](_0xab47ef['model'],qs[_0xd086('0x33')](_0x32884b['query'][_0xd086('0x33')]));_0x4dd839[_0xd086('0x34')]=_0x4dd839['attributes'][_0xd086('0x35')]?_0x4dd839[_0xd086('0x34')]:_0xab47ef['model'];if(!_0x32884b[_0xd086('0x30')][_0xd086('0x36')](_0xd086('0x37'))){_0x4dd839[_0xd086('0x1c')]=qs['limit'](_0x32884b['query'][_0xd086('0x1c')]);_0x4dd839[_0xd086('0x1b')]=qs[_0xd086('0x1b')](_0x32884b['query'][_0xd086('0x1b')]);}_0x4dd839[_0xd086('0x38')]=qs[_0xd086('0x39')](_0x32884b[_0xd086('0x30')][_0xd086('0x39')]);_0x4dd839[_0xd086('0x3a')]=qs['filters'](_[_0xd086('0x3b')](_0x32884b[_0xd086('0x30')],_0xab47ef[_0xd086('0x31')]),_0x14d8ee);if(_0x32884b[_0xd086('0x30')][_0xd086('0x3c')]){_0x4dd839[_0xd086('0x3a')]=_['merge'](_0x4dd839['where'],{'$or':_[_0xd086('0x2a')](_0x14d8ee,function(_0x500f2a){if(_0x500f2a['type']!=='VIRTUAL'){var _0x3e0ec4={};_0x3e0ec4[_0x500f2a[_0xd086('0x28')]]={'$like':'%'+_0x32884b[_0xd086('0x30')]['filter']+'%'};return _0x3e0ec4;}})});}_0x4dd839=_[_0xd086('0x3d')]({},_0x4dd839,_0x32884b[_0xd086('0x3e')]);var _0x4fca0c={'where':_0x4dd839['where']};return db[_0xd086('0x2b')]['count'](_0x4fca0c)[_0xd086('0x26')](function(_0x23103f){_0x10f028[_0xd086('0x1e')]=_0x23103f;if(_0x32884b[_0xd086('0x30')][_0xd086('0x3f')]){_0x4dd839[_0xd086('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x4dd839);})[_0xd086('0x26')](function(_0x299bb1){_0x10f028[_0xd086('0x41')]=_0x299bb1;return _0x10f028;})[_0xd086('0x26')](respondWithFilteredResult(_0x33becd,_0x4dd839))[_0xd086('0x42')](handleError(_0x33becd,null));};exports[_0xd086('0x43')]=function(_0x4a0d0b,_0x378ead){var _0x30c1f1={'raw':!![],'where':{'id':_0x4a0d0b[_0xd086('0x44')]['id']}},_0x16f20f={};_0x16f20f[_0xd086('0x2f')]=_[_0xd086('0x45')](db['JscriptySessionReport']['rawAttributes']);_0x16f20f['query']=_[_0xd086('0x45')](_0x4a0d0b[_0xd086('0x30')]);_0x16f20f[_0xd086('0x31')]=_[_0xd086('0x32')](_0x16f20f[_0xd086('0x2f')],_0x16f20f[_0xd086('0x30')]);_0x30c1f1[_0xd086('0x34')]=_[_0xd086('0x32')](_0x16f20f['model'],qs[_0xd086('0x33')](_0x4a0d0b[_0xd086('0x30')][_0xd086('0x33')]));_0x30c1f1[_0xd086('0x34')]=_0x30c1f1[_0xd086('0x34')][_0xd086('0x35')]?_0x30c1f1['attributes']:_0x16f20f[_0xd086('0x2f')];if(_0x4a0d0b[_0xd086('0x30')][_0xd086('0x3f')]){_0x30c1f1[_0xd086('0x40')]=[{'all':!![]}];}_0x30c1f1=_[_0xd086('0x3d')]({},_0x30c1f1,_0x4a0d0b[_0xd086('0x3e')]);return db[_0xd086('0x2b')][_0xd086('0x46')](_0x30c1f1)['then'](handleEntityNotFound(_0x378ead,null))[_0xd086('0x26')](respondWithResult(_0x378ead,null))[_0xd086('0x42')](handleError(_0x378ead,null));};exports[_0xd086('0x47')]=function(_0x38ff60,_0x4958e9){return db[_0xd086('0x2b')]['create'](_0x38ff60[_0xd086('0x48')],{})['then'](respondWithResult(_0x4958e9,0xc9))[_0xd086('0x42')](handleError(_0x4958e9,null));};exports[_0xd086('0x24')]=function(_0x4f6967,_0x48ba74){if(_0x4f6967['body']['id']){delete _0x4f6967['body']['id'];}return db[_0xd086('0x2b')]['find']({'where':{'id':_0x4f6967[_0xd086('0x44')]['id']}})[_0xd086('0x26')](handleEntityNotFound(_0x48ba74,null))['then'](saveUpdates(_0x4f6967[_0xd086('0x48')],null))[_0xd086('0x26')](respondWithResult(_0x48ba74,null))['catch'](handleError(_0x48ba74,null));};exports[_0xd086('0x25')]=function(_0x1b5ecc,_0x55c77c){return db[_0xd086('0x2b')]['find']({'where':{'id':_0x1b5ecc[_0xd086('0x44')]['id']}})[_0xd086('0x26')](handleEntityNotFound(_0x55c77c,null))[_0xd086('0x26')](removeEntity(_0x55c77c,null))[_0xd086('0x42')](handleError(_0x55c77c,null));};exports[_0xd086('0x49')]=function(_0x53831b,_0xa4da1b){return db[_0xd086('0x2b')][_0xd086('0x49')]()['then'](respondWithResult(_0xa4da1b,null))['catch'](handleError(_0xa4da1b,null));};exports[_0xd086('0x4a')]=function(_0x455252,_0x55142b,_0x13d46d){var _0x52992f={'raw':!![],'where':{}};var _0xa9aa9c={};var _0x1b5ded={'count':0x0,'rows':[]};return db[_0xd086('0x2b')][_0xd086('0x4b')]({'where':{'id':_0x455252[_0xd086('0x44')]['id']}})[_0xd086('0x26')](handleEntityNotFound(_0x55142b,null))['then'](function(_0x38d2c3){if(_0x38d2c3){_0xa9aa9c['model']=_['keys'](db[_0xd086('0x4c')][_0xd086('0x2c')]);_0xa9aa9c[_0xd086('0x30')]=_[_0xd086('0x45')](_0x455252[_0xd086('0x30')]);_0xa9aa9c[_0xd086('0x31')]=_[_0xd086('0x32')](_0xa9aa9c[_0xd086('0x2f')],_0xa9aa9c['query']);_0x52992f[_0xd086('0x34')]=_[_0xd086('0x32')](_0xa9aa9c[_0xd086('0x2f')],qs[_0xd086('0x33')](_0x455252[_0xd086('0x30')][_0xd086('0x33')]));_0x52992f[_0xd086('0x34')]=_0x52992f[_0xd086('0x34')][_0xd086('0x35')]?_0x52992f[_0xd086('0x34')]:_0xa9aa9c[_0xd086('0x2f')];if(!_0x455252['query'][_0xd086('0x36')](_0xd086('0x37'))){_0x52992f['limit']=qs[_0xd086('0x1c')](_0x455252['query'][_0xd086('0x1c')]);_0x52992f[_0xd086('0x1b')]=qs['offset'](_0x455252[_0xd086('0x30')][_0xd086('0x1b')]);}_0x52992f['order']=qs['sort'](_0x455252[_0xd086('0x30')][_0xd086('0x39')]);_0x52992f[_0xd086('0x3a')]=qs[_0xd086('0x31')](_[_0xd086('0x3b')](_0x455252['query'],_0xa9aa9c[_0xd086('0x31')]));_0x52992f[_0xd086('0x3a')]['SessionId']=_0x38d2c3['id'];if(_0x455252['query']['filter']){_0x52992f[_0xd086('0x3a')]=_[_0xd086('0x3d')](_0x52992f[_0xd086('0x3a')],{'$or':_[_0xd086('0x2a')](_0x52992f[_0xd086('0x34')],function(_0x4f4305){var _0x3a5d96={};_0x3a5d96[_0x4f4305]={'$like':'%'+_0x455252[_0xd086('0x30')][_0xd086('0x3c')]+'%'};return _0x3a5d96;})});}_0x52992f=_[_0xd086('0x3d')]({},_0x52992f,_0x455252[_0xd086('0x3e')]);return db[_0xd086('0x4c')]['count']({'where':_0x52992f[_0xd086('0x3a')]})[_0xd086('0x26')](function(_0x22a79b){_0x1b5ded[_0xd086('0x1e')]=_0x22a79b;if(_0x455252[_0xd086('0x30')][_0xd086('0x3f')]){_0x52992f[_0xd086('0x40')]=[{'all':!![]}];}return db[_0xd086('0x4c')][_0xd086('0x4d')](_0x52992f);})['then'](function(_0x271edb){_0x1b5ded[_0xd086('0x41')]=_0x271edb;return _0x1b5ded;});}})[_0xd086('0x26')](respondWithFilteredResult(_0x55142b,_0x52992f))[_0xd086('0x42')](handleError(_0x55142b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index a4c8448..3dd998c 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 _0x9fd4=['rimraf','exports','define','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9fd4,0x16c));var _0x49fd=function(_0x1a68dd,_0x168fdd){_0x1a68dd=_0x1a68dd-0x0;var _0x564bc7=_0x9fd4[_0x1a68dd];return _0x564bc7;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x49fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x741c=['../../config/logger','api','moment','bluebird','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util'];(function(_0x47c10a,_0x26445d){var _0x182f10=function(_0x1fba37){while(--_0x1fba37){_0x47c10a['push'](_0x47c10a['shift']());}};_0x182f10(++_0x26445d);}(_0x741c,0x196));var _0xc741=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x741c[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var logger=require(_0xc741('0x2'))(_0xc741('0x3'));var moment=require(_0xc741('0x4'));var BPromise=require(_0xc741('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc741('0x6'));var config=require('../../config/environment');var attributes=require(_0xc741('0x7'));module[_0xc741('0x8')]=function(_0x3708ae,_0x133bc4){return _0x3708ae[_0xc741('0x9')](_0xc741('0xa'),attributes,{'tableName':_0xc741('0xb'),'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 8b24d92..92946b0 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 _0xafc4=['error','code','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3c8244,_0x5f27c7){var _0x4adb62=function(_0x536abc){while(--_0x536abc){_0x3c8244['push'](_0x3c8244['shift']());}};_0x4adb62(++_0x5f27c7);}(_0xafc4,0x69));var _0x4afc=function(_0x574d49,_0x180f7a){_0x574d49=_0x574d49-0x0;var _0x4be431=_0xafc4[_0x574d49];return _0x4be431;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bb281,_0xc828d9,_0xaf053d){return new BPromise(function(_0x5e1e29,_0x31e165){return client[_0x4afc('0x9')](_0x1bb281,_0xaf053d)[_0x4afc('0xa')](function(_0x1e6bf5){logger[_0x4afc('0xb')](_0x4afc('0xc'),_0xc828d9,'request\x20sent');logger['debug'](_0x4afc('0xd'),_0xc828d9,'request\x20sent',JSON[_0x4afc('0xe')](_0x1e6bf5));if(_0x1e6bf5[_0x4afc('0xf')]){if(_0x1e6bf5['error'][_0x4afc('0x10')]===0x1f4){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x31e165(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}logger[_0x4afc('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x5e1e29(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0xc828d9,_0x4afc('0x12'));_0x5e1e29(_0x1e6bf5['result'][_0x4afc('0x11')]);}})[_0x4afc('0x13')](function(_0x2b928b){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x2b928b);_0x31e165(_0x2b928b);});});} \ No newline at end of file +var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x687b,0x14a));var _0xb687=function(_0x1c443f,_0x51319d){_0x1c443f=_0x1c443f-0x0;var _0x4a4a71=_0x687b[_0x1c443f];return _0x4a4a71;};'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/license/index.js b/server/api/license/index.js index 89adc2f..5406576 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 _0x34aa=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update'];(function(_0x183dda,_0x10140a){var _0x3aacb1=function(_0x553e5f){while(--_0x553e5f){_0x183dda['push'](_0x183dda['shift']());}};_0x3aacb1(++_0x10140a);}(_0x34aa,0x171));var _0xa34a=function(_0x146be0,_0x39a85e){_0x146be0=_0x146be0-0x0;var _0x1bcc25=_0x34aa[_0x146be0];return _0x1bcc25;};'use strict';var multer=require(_0xa34a('0x0'));var util=require('util');var path=require(_0xa34a('0x1'));var timeout=require(_0xa34a('0x2'));var express=require(_0xa34a('0x3'));var router=express[_0xa34a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa34a('0x5'));var interaction=require(_0xa34a('0x6'));var config=require(_0xa34a('0x7'));var controller=require(_0xa34a('0x8'));router[_0xa34a('0x9')]('/',controller[_0xa34a('0xa')]);router[_0xa34a('0xb')](_0xa34a('0xc'),auth[_0xa34a('0xd')](),controller[_0xa34a('0xe')]);module[_0xa34a('0xf')]=router; \ No newline at end of file +var _0xa1aa=['fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get','put','/:id','isAuthenticated','update','exports','path','connect-timeout','express','Router'];(function(_0x4dd093,_0x3aa43e){var _0x4e5d21=function(_0x39e177){while(--_0x39e177){_0x4dd093['push'](_0x4dd093['shift']());}};_0x4e5d21(++_0x3aa43e);}(_0xa1aa,0x88));var _0xaa1a=function(_0x1a534c,_0x1b395f){_0x1a534c=_0x1a534c-0x0;var _0x4f84db=_0xa1aa[_0x1a534c];return _0x4f84db;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaa1a('0x0'));var timeout=require(_0xaa1a('0x1'));var express=require(_0xaa1a('0x2'));var router=express[_0xaa1a('0x3')]();var fs_extra=require(_0xaa1a('0x4'));var auth=require(_0xaa1a('0x5'));var interaction=require(_0xaa1a('0x6'));var config=require('../../config/environment');var controller=require(_0xaa1a('0x7'));router[_0xaa1a('0x8')]('/',controller['index']);router[_0xaa1a('0x9')](_0xaa1a('0xa'),auth[_0xaa1a('0xb')](),controller[_0xaa1a('0xc')]);module[_0xaa1a('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index a91d1d4..1b3d520 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 _0x9439=['sequelize','exports','TEXT','STRING'];(function(_0x45fc36,_0x7a095b){var _0x337d89=function(_0x5a3e5f){while(--_0x5a3e5f){_0x45fc36['push'](_0x45fc36['shift']());}};_0x337d89(++_0x7a095b);}(_0x9439,0x174));var _0x9943=function(_0x588821,_0x463d22){_0x588821=_0x588821-0x0;var _0x56ed13=_0x9439[_0x588821];return _0x56ed13;};'use strict';var Sequelize=require(_0x9943('0x0'));module[_0x9943('0x1')]={'license':{'type':Sequelize[_0x9943('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x9943('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2ede=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2ede,0x9e));var _0xe2ed=function(_0x5e3b4d,_0x13d9fe){_0x5e3b4d=_0x5e3b4d-0x0;var _0xebb09=_0x2ede[_0x5e3b4d];return _0xebb09;};'use strict';var Sequelize=require(_0xe2ed('0x0'));module[_0xe2ed('0x1')]={'license':{'type':Sequelize[_0xe2ed('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xe2ed('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xe2ed('0x4')],'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 355d27a..a76ce52 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 _0x57ca=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','model','keys','License','query','intersection','fields','attributes','merge','options','getLicense','catch','body','find','get','checkLicense','key','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57ca,0x108));var _0xa57c=function(_0x24b7ef,_0x7f7c49){_0x24b7ef=_0x24b7ef-0x0;var _0x2a8585=_0x57ca[_0x24b7ef];return _0x2a8585;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}var utilLicense=require(_0xa57c('0x15'));exports['index']=function(_0x54a18b,_0x257661){var _0x7d10ec={'raw':!![],'where':{'id':0x1}},_0x5a3e03={};_0x5a3e03[_0xa57c('0x28')]=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes']);_0x5a3e03[_0xa57c('0x2b')]=_['keys'](_0x54a18b[_0xa57c('0x2b')]);_0x5a3e03['filters']=_[_0xa57c('0x2c')](_0x5a3e03['model'],_0x5a3e03[_0xa57c('0x2b')]);_0x7d10ec['attributes']=_[_0xa57c('0x2c')](_0x5a3e03[_0xa57c('0x28')],qs[_0xa57c('0x2d')](_0x54a18b[_0xa57c('0x2b')][_0xa57c('0x2d')]));_0x7d10ec[_0xa57c('0x2e')]=_0x7d10ec[_0xa57c('0x2e')]['length']?_0x7d10ec[_0xa57c('0x2e')]:_0x5a3e03['model'];_0x7d10ec=_[_0xa57c('0x2f')]({},_0x7d10ec,_0x54a18b[_0xa57c('0x30')]);return utilLicense[_0xa57c('0x31')](_0x7d10ec)['then'](respondWithResult(_0x257661,null))[_0xa57c('0x32')](handleError(_0x257661,null));};exports['update']=function(_0x24a087,_0x501a4c){if(_0x24a087[_0xa57c('0x33')]['id']){delete _0x24a087['body']['id'];}return db[_0xa57c('0x2a')][_0xa57c('0x34')]({'where':{'id':_0x24a087['params']['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x501a4c,null))['then'](function(_0x1eeeb8){var _0x5c56d3=_0x1eeeb8[_0xa57c('0x35')]({'plain':!![]});return utilLicense[_0xa57c('0x36')](_0x5c56d3,_0x24a087[_0xa57c('0x33')][_0xa57c('0x37')]);})[_0xa57c('0x21')](function(_0x44350f){if(!_0x44350f['demo']){return saveUpdates(_0x24a087['body'],null);}return _0x44350f;})[_0xa57c('0x21')](respondWithResult(_0x501a4c,null))[_0xa57c('0x32')](handleError(_0x501a4c,null));}; \ No newline at end of file +var _0x57ca=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','model','keys','License','query','intersection','fields','attributes','merge','options','getLicense','catch','body','find','get','checkLicense','key','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57ca,0x108));var _0xa57c=function(_0x203fef,_0x1eea0f){_0x203fef=_0x203fef-0x0;var _0x2c49bb=_0x57ca[_0x203fef];return _0x2c49bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}var utilLicense=require(_0xa57c('0x15'));exports['index']=function(_0x54a18b,_0x257661){var _0x7d10ec={'raw':!![],'where':{'id':0x1}},_0x5a3e03={};_0x5a3e03[_0xa57c('0x28')]=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes']);_0x5a3e03[_0xa57c('0x2b')]=_['keys'](_0x54a18b[_0xa57c('0x2b')]);_0x5a3e03['filters']=_[_0xa57c('0x2c')](_0x5a3e03['model'],_0x5a3e03[_0xa57c('0x2b')]);_0x7d10ec['attributes']=_[_0xa57c('0x2c')](_0x5a3e03[_0xa57c('0x28')],qs[_0xa57c('0x2d')](_0x54a18b[_0xa57c('0x2b')][_0xa57c('0x2d')]));_0x7d10ec[_0xa57c('0x2e')]=_0x7d10ec[_0xa57c('0x2e')]['length']?_0x7d10ec[_0xa57c('0x2e')]:_0x5a3e03['model'];_0x7d10ec=_[_0xa57c('0x2f')]({},_0x7d10ec,_0x54a18b[_0xa57c('0x30')]);return utilLicense[_0xa57c('0x31')](_0x7d10ec)['then'](respondWithResult(_0x257661,null))[_0xa57c('0x32')](handleError(_0x257661,null));};exports['update']=function(_0x24a087,_0x501a4c){if(_0x24a087[_0xa57c('0x33')]['id']){delete _0x24a087['body']['id'];}return db[_0xa57c('0x2a')][_0xa57c('0x34')]({'where':{'id':_0x24a087['params']['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x501a4c,null))['then'](function(_0x1eeeb8){var _0x5c56d3=_0x1eeeb8[_0xa57c('0x35')]({'plain':!![]});return utilLicense[_0xa57c('0x36')](_0x5c56d3,_0x24a087[_0xa57c('0x33')][_0xa57c('0x37')]);})[_0xa57c('0x21')](function(_0x44350f){if(!_0x44350f['demo']){return saveUpdates(_0x24a087['body'],null);}return _0x44350f;})[_0xa57c('0x21')](respondWithResult(_0x501a4c,null))[_0xa57c('0x32')](handleError(_0x501a4c,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index c14aa85..a3a5074 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 _0xea10=['bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','define','lodash','util','api','moment'];(function(_0x1dacd4,_0x4259f7){var _0x5c29c5=function(_0x388498){while(--_0x388498){_0x1dacd4['push'](_0x1dacd4['shift']());}};_0x5c29c5(++_0x4259f7);}(_0xea10,0x125));var _0x0ea1=function(_0xeb6036,_0x3e2d7d){_0xeb6036=_0xeb6036-0x0;var _0x16602b=_0xea10[_0xeb6036];return _0x16602b;};'use strict';var _=require(_0x0ea1('0x0'));var util=require(_0x0ea1('0x1'));var logger=require('../../config/logger')(_0x0ea1('0x2'));var moment=require(_0x0ea1('0x3'));var BPromise=require(_0x0ea1('0x4'));var rp=require(_0x0ea1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ea1('0x6'));var config=require(_0x0ea1('0x7'));var attributes=require(_0x0ea1('0x8'));module[_0x0ea1('0x9')]=function(_0x47a164,_0x5707a4){return _0x47a164[_0x0ea1('0xa')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01cd=['path','rimraf','../../config/environment','./license.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5594d7,_0x2a4a9e){var _0x186d2c=function(_0x121bd7){while(--_0x121bd7){_0x5594d7['push'](_0x5594d7['shift']());}};_0x186d2c(++_0x2a4a9e);}(_0x01cd,0xfd));var _0xd01c=function(_0x35b1d7,_0xbcd2f2){_0x35b1d7=_0x35b1d7-0x0;var _0x3a2516=_0x01cd[_0x35b1d7];return _0x3a2516;};'use strict';var _=require(_0xd01c('0x0'));var util=require(_0xd01c('0x1'));var logger=require(_0xd01c('0x2'))(_0xd01c('0x3'));var moment=require(_0xd01c('0x4'));var BPromise=require(_0xd01c('0x5'));var rp=require(_0xd01c('0x6'));var fs=require('fs');var path=require(_0xd01c('0x7'));var rimraf=require(_0xd01c('0x8'));var config=require(_0xd01c('0x9'));var attributes=require(_0xd01c('0xa'));module[_0xd01c('0xb')]=function(_0x586e2b,_0x57e189){return _0x586e2b[_0xd01c('0xc')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 6fc1f56..cd44d09 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 _0x0c54=['error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c54,0xe6));var _0x40c5=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x0c54[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x40c5('0x0'));var util=require(_0x40c5('0x1'));var moment=require('moment');var BPromise=require(_0x40c5('0x2'));var rs=require(_0x40c5('0x3'));var fs=require('fs');var Redis=require(_0x40c5('0x4'));var db=require(_0x40c5('0x5'))['db'];var utils=require(_0x40c5('0x6'));var logger=require(_0x40c5('0x7'))(_0x40c5('0x8'));var config=require(_0x40c5('0x9'));var jayson=require(_0x40c5('0xa'));var client=jayson[_0x40c5('0xb')][_0x40c5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45e068,_0x18e375,_0x18d5d5){return new BPromise(function(_0x45083c,_0x47dde7){return client[_0x40c5('0xd')](_0x45e068,_0x18d5d5)[_0x40c5('0xe')](function(_0xe5b98b){logger[_0x40c5('0xf')](_0x40c5('0x10'),_0x18e375,_0x40c5('0x11'));logger['debug'](_0x40c5('0x12'),_0x18e375,'request\x20sent',JSON[_0x40c5('0x13')](_0xe5b98b));if(_0xe5b98b[_0x40c5('0x14')]){if(_0xe5b98b['error'][_0x40c5('0x15')]===0x1f4){logger[_0x40c5('0x14')](_0x40c5('0x10'),_0x18e375,_0xe5b98b[_0x40c5('0x14')][_0x40c5('0x16')]);return _0x47dde7(_0xe5b98b[_0x40c5('0x14')][_0x40c5('0x16')]);}logger[_0x40c5('0x14')]('License,\x20%s,\x20%s',_0x18e375,_0xe5b98b[_0x40c5('0x14')][_0x40c5('0x16')]);return _0x45083c(_0xe5b98b[_0x40c5('0x14')][_0x40c5('0x16')]);}else{logger['info'](_0x40c5('0x10'),_0x18e375,'request\x20sent');_0x45083c(_0xe5b98b[_0x40c5('0x17')][_0x40c5('0x16')]);}})[_0x40c5('0x18')](function(_0x560724){logger[_0x40c5('0x14')](_0x40c5('0x10'),_0x18e375,_0x560724);_0x47dde7(_0x560724);});});} \ No newline at end of file +var _0x91e2=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','info','License,\x20%s,\x20%s'];(function(_0x5ef9ac,_0x29eae7){var _0x37c1ef=function(_0x2ebd63){while(--_0x2ebd63){_0x5ef9ac['push'](_0x5ef9ac['shift']());}};_0x37c1ef(++_0x29eae7);}(_0x91e2,0x148));var _0x291e=function(_0x2e0c68,_0x363e82){_0x2e0c68=_0x2e0c68-0x0;var _0x3a0be1=_0x91e2[_0x2e0c68];return _0x3a0be1;};'use strict';var _=require(_0x291e('0x0'));var util=require(_0x291e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x291e('0x2'));var fs=require('fs');var Redis=require(_0x291e('0x3'));var db=require(_0x291e('0x4'))['db'];var utils=require(_0x291e('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x291e('0x6'));var client=jayson['client'][_0x291e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x282f5d,_0xf3c06a,_0x5df6f1){return new BPromise(function(_0x36020d,_0x105768){return client[_0x291e('0x8')](_0x282f5d,_0x5df6f1)[_0x291e('0x9')](function(_0x23c66f){logger[_0x291e('0xa')](_0x291e('0xb'),_0xf3c06a,_0x291e('0xc'));logger[_0x291e('0xd')](_0x291e('0xe'),_0xf3c06a,'request\x20sent',JSON[_0x291e('0xf')](_0x23c66f));if(_0x23c66f['error']){if(_0x23c66f[_0x291e('0x10')][_0x291e('0x11')]===0x1f4){logger[_0x291e('0x10')]('License,\x20%s,\x20%s',_0xf3c06a,_0x23c66f['error']['message']);return _0x105768(_0x23c66f[_0x291e('0x10')]['message']);}logger[_0x291e('0x10')](_0x291e('0xb'),_0xf3c06a,_0x23c66f[_0x291e('0x10')][_0x291e('0x12')]);return _0x36020d(_0x23c66f['error']['message']);}else{logger[_0x291e('0xa')](_0x291e('0xb'),_0xf3c06a,'request\x20sent');_0x36020d(_0x23c66f['result']['message']);}})[_0x291e('0x13')](function(_0xfb28bb){logger[_0x291e('0x10')](_0x291e('0xb'),_0xf3c06a,_0xfb28bb);_0x105768(_0xfb28bb);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index c45dd02..e427a0c 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 _0xc457=['index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','/:id/dispositions','addDisposition','post','addAnswer','create','addImap','addSmtp','addInteraction','/:id/send','send','addAgents','put','update','delete','removeAnswers','removeSmtp','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated'];(function(_0x54665f,_0xc698d1){var _0x5c8a95=function(_0x2709d5){while(--_0x2709d5){_0x54665f['push'](_0x54665f['shift']());}};_0x5c8a95(++_0xc698d1);}(_0xc457,0x1ae));var _0x7c45=function(_0x625479,_0x515e77){_0x625479=_0x625479-0x0;var _0x1d5883=_0xc457[_0x625479];return _0x1d5883;};'use strict';var multer=require('multer');var util=require(_0x7c45('0x0'));var path=require(_0x7c45('0x1'));var timeout=require(_0x7c45('0x2'));var express=require('express');var router=express[_0x7c45('0x3')]();var fs_extra=require(_0x7c45('0x4'));var auth=require(_0x7c45('0x5'));var interaction=require(_0x7c45('0x6'));var config=require(_0x7c45('0x7'));var controller=require(_0x7c45('0x8'));router[_0x7c45('0x9')]('/',auth[_0x7c45('0xa')](),controller[_0x7c45('0xb')]);router['get'](_0x7c45('0xc'),auth[_0x7c45('0xa')](),controller[_0x7c45('0xd')]);router[_0x7c45('0x9')](_0x7c45('0xe'),auth[_0x7c45('0xa')](),controller[_0x7c45('0xf')]);router[_0x7c45('0x9')]('/:id/dispositions',auth[_0x7c45('0xa')](),controller[_0x7c45('0x10')]);router[_0x7c45('0x9')](_0x7c45('0x11'),auth[_0x7c45('0xa')](),controller[_0x7c45('0x12')]);router[_0x7c45('0x9')](_0x7c45('0x13'),auth[_0x7c45('0xa')](),controller[_0x7c45('0x14')]);router[_0x7c45('0x9')](_0x7c45('0x15'),auth[_0x7c45('0xa')](),controller['getSmtp']);router[_0x7c45('0x9')](_0x7c45('0x16'),auth[_0x7c45('0xa')](),controller[_0x7c45('0x17')]);router[_0x7c45('0x9')](_0x7c45('0x18'),auth[_0x7c45('0xa')](),controller[_0x7c45('0x19')]);router[_0x7c45('0x9')](_0x7c45('0x1a'),auth['isAuthenticated'](),controller['getMessages']);router[_0x7c45('0x9')](_0x7c45('0x1b'),auth['isAuthenticated'](),controller[_0x7c45('0x1c')]);router[_0x7c45('0x9')](_0x7c45('0x1d'),auth[_0x7c45('0xa')](),controller[_0x7c45('0x1e')]);router['post'](_0x7c45('0x1f'),auth[_0x7c45('0xa')](),controller[_0x7c45('0x20')]);router[_0x7c45('0x21')](_0x7c45('0x11'),auth[_0x7c45('0xa')](),controller[_0x7c45('0x22')]);router[_0x7c45('0x21')]('/',auth['isAuthenticated'](),controller[_0x7c45('0x23')]);router[_0x7c45('0x21')](_0x7c45('0x13'),auth[_0x7c45('0xa')](),controller[_0x7c45('0x24')]);router['post']('/:id/out_servers',auth[_0x7c45('0xa')](),controller[_0x7c45('0x25')]);router[_0x7c45('0x21')](_0x7c45('0x16'),auth[_0x7c45('0xa')](),controller[_0x7c45('0x26')]);router[_0x7c45('0x21')](_0x7c45('0x18'),auth[_0x7c45('0xa')](),controller['addApplications']);router[_0x7c45('0x21')](_0x7c45('0x27'),auth['isAuthenticated'](),controller[_0x7c45('0x28')]);router[_0x7c45('0x21')](_0x7c45('0x1d'),auth[_0x7c45('0xa')](),controller[_0x7c45('0x29')]);router[_0x7c45('0x2a')](_0x7c45('0xe'),auth[_0x7c45('0xa')](),controller[_0x7c45('0x2b')]);router[_0x7c45('0x2c')](_0x7c45('0x1f'),auth[_0x7c45('0xa')](),controller['removeDispositions']);router[_0x7c45('0x2c')](_0x7c45('0x11'),auth[_0x7c45('0xa')](),controller[_0x7c45('0x2d')]);router[_0x7c45('0x2c')](_0x7c45('0x13'),auth[_0x7c45('0xa')](),controller['removeImap']);router['delete'](_0x7c45('0x15'),auth[_0x7c45('0xa')](),controller[_0x7c45('0x2e')]);router[_0x7c45('0x2c')](_0x7c45('0xe'),auth[_0x7c45('0xa')](),controller[_0x7c45('0x2f')]);router[_0x7c45('0x2c')](_0x7c45('0x1d'),auth[_0x7c45('0xa')](),controller['removeAgents']);module[_0x7c45('0x30')]=router; \ No newline at end of file +var _0xf414=['getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','create','addSmtp','/:id/interactions','addApplications','/:id/send','send','put','update','delete','removeAnswers','removeImap','removeSmtp','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./mailAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/applications','getApplications','/:id/messages'];(function(_0xb6da2d,_0x9dbbba){var _0x155572=function(_0x2ebdd3){while(--_0x2ebdd3){_0xb6da2d['push'](_0xb6da2d['shift']());}};_0x155572(++_0x9dbbba);}(_0xf414,0xa2));var _0x4f41=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0xf414[_0x7dbd65];return _0x33d551;};'use strict';var multer=require(_0x4f41('0x0'));var util=require(_0x4f41('0x1'));var path=require(_0x4f41('0x2'));var timeout=require(_0x4f41('0x3'));var express=require(_0x4f41('0x4'));var router=express[_0x4f41('0x5')]();var fs_extra=require(_0x4f41('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4f41('0x7'));var controller=require(_0x4f41('0x8'));router[_0x4f41('0x9')]('/',auth['isAuthenticated'](),controller[_0x4f41('0xa')]);router[_0x4f41('0x9')](_0x4f41('0xb'),auth[_0x4f41('0xc')](),controller[_0x4f41('0xd')]);router[_0x4f41('0x9')](_0x4f41('0xe'),auth[_0x4f41('0xc')](),controller[_0x4f41('0xf')]);router[_0x4f41('0x9')](_0x4f41('0x10'),auth[_0x4f41('0xc')](),controller[_0x4f41('0x11')]);router[_0x4f41('0x9')](_0x4f41('0x12'),auth[_0x4f41('0xc')](),controller[_0x4f41('0x13')]);router[_0x4f41('0x9')](_0x4f41('0x14'),auth[_0x4f41('0xc')](),controller['getImap']);router[_0x4f41('0x9')](_0x4f41('0x15'),auth[_0x4f41('0xc')](),controller[_0x4f41('0x16')]);router['get']('/:id/interactions',auth[_0x4f41('0xc')](),controller['getInteractions']);router[_0x4f41('0x9')](_0x4f41('0x17'),auth[_0x4f41('0xc')](),controller[_0x4f41('0x18')]);router['get'](_0x4f41('0x19'),auth[_0x4f41('0xc')](),controller[_0x4f41('0x1a')]);router[_0x4f41('0x9')](_0x4f41('0x1b'),auth['isAuthenticated'](),controller[_0x4f41('0x1c')]);router[_0x4f41('0x9')](_0x4f41('0x1d'),auth[_0x4f41('0xc')](),controller[_0x4f41('0x1e')]);router[_0x4f41('0x1f')](_0x4f41('0x10'),auth['isAuthenticated'](),controller[_0x4f41('0x20')]);router[_0x4f41('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router['post']('/',auth[_0x4f41('0xc')](),controller[_0x4f41('0x21')]);router[_0x4f41('0x1f')]('/:id/in_servers',auth[_0x4f41('0xc')](),controller['addImap']);router[_0x4f41('0x1f')](_0x4f41('0x15'),auth[_0x4f41('0xc')](),controller[_0x4f41('0x22')]);router[_0x4f41('0x1f')](_0x4f41('0x23'),auth[_0x4f41('0xc')](),controller['addInteraction']);router['post'](_0x4f41('0x17'),auth[_0x4f41('0xc')](),controller[_0x4f41('0x24')]);router[_0x4f41('0x1f')](_0x4f41('0x25'),auth[_0x4f41('0xc')](),controller[_0x4f41('0x26')]);router[_0x4f41('0x1f')](_0x4f41('0x1d'),auth[_0x4f41('0xc')](),controller['addAgents']);router[_0x4f41('0x27')](_0x4f41('0xe'),auth[_0x4f41('0xc')](),controller[_0x4f41('0x28')]);router[_0x4f41('0x29')](_0x4f41('0x10'),auth[_0x4f41('0xc')](),controller['removeDispositions']);router[_0x4f41('0x29')]('/:id/canned_answers',auth[_0x4f41('0xc')](),controller[_0x4f41('0x2a')]);router['delete'](_0x4f41('0x14'),auth['isAuthenticated'](),controller[_0x4f41('0x2b')]);router['delete'](_0x4f41('0x15'),auth['isAuthenticated'](),controller[_0x4f41('0x2c')]);router[_0x4f41('0x29')](_0x4f41('0xe'),auth[_0x4f41('0xc')](),controller[_0x4f41('0x2d')]);router[_0x4f41('0x29')](_0x4f41('0x1d'),auth[_0x4f41('0xc')](),controller['removeAgents']);module[_0x4f41('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 304b4ac..2e90099 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 _0x2fed=['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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2fed,0x7c));var _0xd2fe=function(_0x2300d6,_0x141704){_0x2300d6=_0x2300d6-0x0;var _0x52bb5d=_0x2fed[_0x2300d6];return _0x52bb5d;};'use strict';var Sequelize=require(_0xd2fe('0x0'));module[_0xd2fe('0x1')]={'description':{'type':Sequelize[_0xd2fe('0x2')]},'name':{'type':Sequelize[_0xd2fe('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xd2fe('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xd2fe('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xd2fe('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd2fe('0x2')],'allowNull':![],'defaultValue':_0xd2fe('0x4')},'fontSize':{'type':Sequelize[_0xd2fe('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd2fe('0x6')],'defaultValue':function(){return _0xd2fe('0x7');}},'notificationSound':{'type':Sequelize[_0xd2fe('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd2fe('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd2fe('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd2fe('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd2fe('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd2fe('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd2fe('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xd2fe('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xd2fe('0x3')],'defaultValue':![],'comment':_0xd2fe('0x9'),'set':function(_0x341f82){if(!_0x341f82)this[_0xd2fe('0xa')](_0xd2fe('0xb'),null);this[_0xd2fe('0xa')](_0xd2fe('0xc'),_0x341f82);}}}; \ No newline at end of file +var _0x2ce1=['INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x4a8cbb,_0x40177c){var _0x36b5b1=function(_0x436ef1){while(--_0x436ef1){_0x4a8cbb['push'](_0x4a8cbb['shift']());}};_0x36b5b1(++_0x40177c);}(_0x2ce1,0x8b));var _0x12ce=function(_0x5e07d6,_0x55ae29){_0x5e07d6=_0x5e07d6-0x0;var _0xc1f210=_0x2ce1[_0x5e07d6];return _0xc1f210;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x12ce('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x12ce('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x12ce('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x12ce('0x1')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x12ce('0x2')]},'markAsUnread':{'type':Sequelize[_0x12ce('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x12ce('0x3')},'fontSize':{'type':Sequelize[_0x12ce('0x4')](0x2)[_0x12ce('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x12ce('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x12ce('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x12ce('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x12ce('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x12ce('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x12ce('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x12ce('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x12ce('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x12ce('0x8'),'set':function(_0x4d6de1){if(!_0x4d6de1)this[_0x12ce('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x12ce('0xa'),_0x4d6de1);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index fcacca3..80a33e4 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 _0x8b7d=['MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','MailAccounts','UserProfileResource','then','stack','name','send','index','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','MailServerIn','body','find','params','describe','MailAccountId','Disposition','getDispositions','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','active','description','isNil','cauthentication','user','password','cpassword','authentication','host','port','service','cservice','cuser','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','addInteraction','MailInteraction','omit','User','Owner','fullname','internal','Tag','Tags','tag','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','server/files/attachments','basename','auth','secure','create','List\x20not\x20found','subject','out','messageId','Interaction','Messages','VerifySmtp','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','html-to-text','juice','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','request'];(function(_0x2dc444,_0x5f42b8){var _0x30f285=function(_0x440d64){while(--_0x440d64){_0x2dc444['push'](_0x2dc444['shift']());}};_0x30f285(++_0x5f42b8);}(_0x8b7d,0x9e));var _0xd8b7=function(_0x118765,_0x44aca2){_0x118765=_0x118765-0x0;var _0x4af8d7=_0x8b7d[_0x118765];return _0x4af8d7;};'use strict';var emlformat=require(_0xd8b7('0x0'));var rimraf=require(_0xd8b7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd8b7('0x2'));var moment=require(_0xd8b7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd8b7('0x4'));var csv=require(_0xd8b7('0x5'));var ejs=require(_0xd8b7('0x6'));var fs=require('fs');var fs_extra=require(_0xd8b7('0x7'));var _=require(_0xd8b7('0x8'));var squel=require(_0xd8b7('0x9'));var crypto=require('crypto');var jsforce=require(_0xd8b7('0xa'));var deskjs=require(_0xd8b7('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require(_0xd8b7('0xc'));var juice=require(_0xd8b7('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd8b7('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd8b7('0xf'));var logger=require(_0xd8b7('0x10'))(_0xd8b7('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd8b7('0x12'));var db=require(_0xd8b7('0x13'))['db'];config[_0xd8b7('0x14')]=_[_0xd8b7('0x15')](config[_0xd8b7('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xd8b7('0x16'))(new Redis(config['redis']));require(_0xd8b7('0x17'))['register'](socket);var jayson=require(_0xd8b7('0x18'));var client=jayson[_0xd8b7('0x19')][_0xd8b7('0x1a')]({'port':0x232b});function respondWithRpcPromise(_0x3014fc,_0x2d5b70,_0x4b94d1,_0x27ef7a){return new BPromise(function(_0x400510,_0x1c3747){var _0x468a8b=_0x27ef7a||client;return _0x468a8b[_0xd8b7('0x1b')](_0x3014fc,_0x4b94d1)['then'](function(_0x320a71){logger['info'](_0xd8b7('0x1c'),_0x2d5b70,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x2d5b70,_0xd8b7('0x1d'),JSON[_0xd8b7('0x1e')](_0x320a71));if(_0x320a71[_0xd8b7('0x1f')]){if(_0x320a71[_0xd8b7('0x1f')]['code']===0x1f4){logger[_0xd8b7('0x1f')]('MailAccount,\x20%s,\x20%s',_0x2d5b70,_0x320a71['error']['message']);return _0x1c3747(_0x320a71[_0xd8b7('0x1f')][_0xd8b7('0x20')]);}logger[_0xd8b7('0x1f')](_0xd8b7('0x1c'),_0x2d5b70,_0x320a71[_0xd8b7('0x1f')]['message']);return _0x400510(_0x320a71[_0xd8b7('0x1f')][_0xd8b7('0x20')]);}else{logger[_0xd8b7('0x21')]('MailAccount,\x20%s,\x20%s',_0x2d5b70,_0xd8b7('0x1d'));_0x400510(_0x320a71[_0xd8b7('0x22')][_0xd8b7('0x20')]);}})[_0xd8b7('0x23')](function(_0x54057a){logger[_0xd8b7('0x1f')](_0xd8b7('0x1c'),_0x2d5b70,_0x54057a);_0x1c3747(_0x54057a);});});}function respondWithStatusCode(_0x5f1995,_0xa0ff1a){_0xa0ff1a=_0xa0ff1a||0xcc;return function(_0x2eb52a){if(_0x2eb52a){return _0x5f1995[_0xd8b7('0x24')](_0xa0ff1a);}return _0x5f1995[_0xd8b7('0x25')](_0xa0ff1a)[_0xd8b7('0x26')]();};}function respondWithResult(_0x16e295,_0x5278a8){_0x5278a8=_0x5278a8||0xc8;return function(_0x333fb7){if(_0x333fb7){return _0x16e295['status'](_0x5278a8)[_0xd8b7('0x27')](_0x333fb7);}};}function respondWithFilteredResult(_0x12df89,_0x505de5){return function(_0x4b2fb5){if(_0x4b2fb5){var _0x2a13d7=typeof _0x505de5[_0xd8b7('0x28')]===_0xd8b7('0x29')&&typeof _0x505de5[_0xd8b7('0x2a')]==='undefined';var _0x1765d8=_0x4b2fb5[_0xd8b7('0x2b')];var _0x18447e=_0x2a13d7?0x0:_0x505de5[_0xd8b7('0x28')];var _0x5576fa=_0x2a13d7?_0x4b2fb5[_0xd8b7('0x2b')]:_0x505de5[_0xd8b7('0x28')]+_0x505de5[_0xd8b7('0x2a')];var _0x1a8d92;if(_0x5576fa>=_0x1765d8){_0x5576fa=_0x1765d8;_0x1a8d92=0xc8;}else{_0x1a8d92=0xce;}_0x12df89[_0xd8b7('0x25')](_0x1a8d92);return _0x12df89[_0xd8b7('0x2c')]('Content-Range',_0x18447e+'-'+_0x5576fa+'/'+_0x1765d8)['json'](_0x4b2fb5);}return null;};}function patchUpdates(_0x25ffc8){return function(_0x23e0ad){try{jsonpatch[_0xd8b7('0x2d')](_0x23e0ad,_0x25ffc8,!![]);}catch(_0x295ad6){return BPromise[_0xd8b7('0x2e')](_0x295ad6);}return _0x23e0ad[_0xd8b7('0x2f')]();};}function saveUpdates(_0x20c3b0,_0x4ef8aa){return function(_0x3ac995){if(_0x3ac995){return _0x3ac995[_0xd8b7('0x30')](_0x20c3b0)['then'](function(_0x5e8e61){return _0x5e8e61;});}return null;};}function removeEntity(_0x303555,_0x16303d){return function(_0x40e6f4){if(_0x40e6f4){return _0x40e6f4[_0xd8b7('0x31')]()['then'](function(){var _0xe5612d=_0x40e6f4[_0xd8b7('0x32')]({'plain':!![]});var _0x488337=_0xd8b7('0x33');return db[_0xd8b7('0x34')][_0xd8b7('0x31')]({'where':{'type':_0x488337,'resourceId':_0xe5612d['id']}})[_0xd8b7('0x35')](function(){return _0x40e6f4;});})[_0xd8b7('0x35')](function(){_0x303555[_0xd8b7('0x25')](0xcc)[_0xd8b7('0x26')]();});}};}function handleEntityNotFound(_0x1b6dc0,_0x26471b){return function(_0x35c61e){if(!_0x35c61e){_0x1b6dc0['sendStatus'](0x194);}return _0x35c61e;};}function handleError(_0x201bf5,_0x17b412){_0x17b412=_0x17b412||0x1f4;return function(_0x25008d){logger[_0xd8b7('0x1f')](_0x25008d[_0xd8b7('0x36')]);if(_0x25008d['name']){delete _0x25008d[_0xd8b7('0x37')];}_0x201bf5[_0xd8b7('0x25')](_0x17b412)[_0xd8b7('0x38')](_0x25008d);};}exports[_0xd8b7('0x39')]=function(_0x43820f,_0x2ad01f){var _0x356d29={'include':[{'model':db['MailServerIn'],'as':_0xd8b7('0x3a')},{'model':db[_0xd8b7('0x3b')],'as':_0xd8b7('0x3c')},{'model':db[_0xd8b7('0x3d')],'as':_0xd8b7('0x3e')}]},_0x234c2d={},_0xf981f8={'count':0x0,'rows':[]};var _0x4f6f9c=_[_0xd8b7('0x3f')](db[_0xd8b7('0x40')][_0xd8b7('0x41')],function(_0x1b2fd6){return{'name':_0x1b2fd6[_0xd8b7('0x42')],'type':_0x1b2fd6[_0xd8b7('0x43')][_0xd8b7('0x44')]};});_0x234c2d[_0xd8b7('0x45')]=_['map'](_0x4f6f9c,_0xd8b7('0x37'));_0x234c2d[_0xd8b7('0x46')]=_[_0xd8b7('0x47')](_0x43820f['query']);_0x234c2d[_0xd8b7('0x48')]=_[_0xd8b7('0x49')](_0x234c2d[_0xd8b7('0x45')],_0x234c2d[_0xd8b7('0x46')]);_0x356d29['attributes']=_['intersection'](_0x234c2d[_0xd8b7('0x45')],qs['fields'](_0x43820f[_0xd8b7('0x46')][_0xd8b7('0x4a')]));_0x356d29[_0xd8b7('0x4b')]=_0x356d29[_0xd8b7('0x4b')][_0xd8b7('0x4c')]?_0x356d29['attributes']:_0x234c2d[_0xd8b7('0x45')];if(!_0x43820f[_0xd8b7('0x46')]['hasOwnProperty'](_0xd8b7('0x4d'))){_0x356d29[_0xd8b7('0x2a')]=qs[_0xd8b7('0x2a')](_0x43820f[_0xd8b7('0x46')][_0xd8b7('0x2a')]);_0x356d29[_0xd8b7('0x28')]=qs['offset'](_0x43820f['query'][_0xd8b7('0x28')]);}_0x356d29[_0xd8b7('0x4e')]=qs[_0xd8b7('0x4f')](_0x43820f[_0xd8b7('0x46')]['sort']);_0x356d29[_0xd8b7('0x50')]=qs['filters'](_[_0xd8b7('0x51')](_0x43820f[_0xd8b7('0x46')],_0x234c2d[_0xd8b7('0x48')]),_0x4f6f9c);if(_0x43820f[_0xd8b7('0x46')][_0xd8b7('0x52')]){_0x356d29['where']=_[_0xd8b7('0x53')](_0x356d29[_0xd8b7('0x50')],{'$or':_['map'](_0x4f6f9c,function(_0x333627){if(_0x333627[_0xd8b7('0x43')]!==_0xd8b7('0x54')){var _0xe182c8={};_0xe182c8[_0x333627['name']]={'$like':'%'+_0x43820f[_0xd8b7('0x46')][_0xd8b7('0x52')]+'%'};return _0xe182c8;}})});}_0x356d29=_[_0xd8b7('0x53')]({},_0x356d29,_0x43820f[_0xd8b7('0x55')]);var _0x531516={'where':_0x356d29[_0xd8b7('0x50')]};return db[_0xd8b7('0x40')][_0xd8b7('0x2b')](_0x531516)[_0xd8b7('0x35')](function(_0x237b86){_0xf981f8[_0xd8b7('0x2b')]=_0x237b86;if(_0x43820f['query'][_0xd8b7('0x56')]){_0x356d29[_0xd8b7('0x57')]=[{'all':!![]}];}return db['MailAccount'][_0xd8b7('0x58')](_0x356d29);})[_0xd8b7('0x35')](function(_0x361f8b){_0xf981f8[_0xd8b7('0x59')]=_0x361f8b;return _0xf981f8;})[_0xd8b7('0x35')](respondWithFilteredResult(_0x2ad01f,_0x356d29))['catch'](handleError(_0x2ad01f,null));};exports[_0xd8b7('0x5a')]=function(_0x3a581e,_0x3780f4){var _0x39d89d={'raw':![],'where':{'id':_0x3a581e['params']['id']},'include':[{'model':db[_0xd8b7('0x5b')],'as':'Imap'},{'model':db[_0xd8b7('0x3b')],'as':_0xd8b7('0x3c')},{'model':db['Pause'],'as':_0xd8b7('0x3e')}]},_0x1604f1={};_0x1604f1['model']=_[_0xd8b7('0x47')](db[_0xd8b7('0x40')][_0xd8b7('0x41')]);_0x1604f1[_0xd8b7('0x46')]=_[_0xd8b7('0x47')](_0x3a581e[_0xd8b7('0x46')]);_0x1604f1['filters']=_[_0xd8b7('0x49')](_0x1604f1['model'],_0x1604f1[_0xd8b7('0x46')]);_0x39d89d[_0xd8b7('0x4b')]=_['intersection'](_0x1604f1[_0xd8b7('0x45')],qs[_0xd8b7('0x4a')](_0x3a581e[_0xd8b7('0x46')][_0xd8b7('0x4a')]));_0x39d89d['attributes']=_0x39d89d[_0xd8b7('0x4b')][_0xd8b7('0x4c')]?_0x39d89d[_0xd8b7('0x4b')]:_0x1604f1[_0xd8b7('0x45')];if(_0x3a581e['query'][_0xd8b7('0x56')]){_0x39d89d[_0xd8b7('0x57')]=[{'all':!![]}];}_0x39d89d=_[_0xd8b7('0x53')]({},_0x39d89d,_0x3a581e[_0xd8b7('0x55')]);return db[_0xd8b7('0x40')]['find'](_0x39d89d)[_0xd8b7('0x35')](handleEntityNotFound(_0x3780f4,null))[_0xd8b7('0x35')](respondWithResult(_0x3780f4,null))[_0xd8b7('0x23')](handleError(_0x3780f4,null));};exports['update']=function(_0x223990,_0x1cd674){if(_0x223990[_0xd8b7('0x5c')]['id']){delete _0x223990[_0xd8b7('0x5c')]['id'];}return db[_0xd8b7('0x40')][_0xd8b7('0x5d')]({'where':{'id':_0x223990[_0xd8b7('0x5e')]['id']},'include':[{'model':db[_0xd8b7('0x5b')],'as':_0xd8b7('0x3a')},{'model':db[_0xd8b7('0x3b')],'as':_0xd8b7('0x3c')},{'model':db['Pause'],'as':_0xd8b7('0x3e')}]})['then'](handleEntityNotFound(_0x1cd674,null))[_0xd8b7('0x35')](saveUpdates(_0x223990[_0xd8b7('0x5c')],null))['then'](function(_0x1c0d9f){if(_0x1c0d9f&&_0x223990[_0xd8b7('0x5c')][_0xd8b7('0x3a')]){return db['MailServerIn'][_0xd8b7('0x30')](_0x223990['body']['Imap'],{'where':{'MailAccountId':_0x1c0d9f['id']}})['then'](function(){return _0x1c0d9f;});}return _0x1c0d9f;})[_0xd8b7('0x35')](function(_0x540d52){if(_0x540d52&&_0x223990[_0xd8b7('0x5c')][_0xd8b7('0x3c')]){return db[_0xd8b7('0x3b')][_0xd8b7('0x30')](_0x223990['body'][_0xd8b7('0x3c')],{'where':{'MailAccountId':_0x540d52['id']}})[_0xd8b7('0x35')](function(){return _0x540d52;});}return _0x540d52;})[_0xd8b7('0x35')](respondWithResult(_0x1cd674,null))[_0xd8b7('0x23')](handleError(_0x1cd674,null));};exports['describe']=function(_0x1ac37d,_0x286d41){return db[_0xd8b7('0x40')][_0xd8b7('0x5f')]()[_0xd8b7('0x35')](respondWithResult(_0x286d41,null))['catch'](handleError(_0x286d41,null));};exports['addDisposition']=function(_0x368ab0,_0x3331f1,_0x57fdd0){if(_0x368ab0[_0xd8b7('0x5c')]['id']){delete _0x368ab0['body']['id'];}return db[_0xd8b7('0x40')][_0xd8b7('0x5d')]({'where':{'id':_0x368ab0[_0xd8b7('0x5e')]['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0x3331f1,null))[_0xd8b7('0x35')](function(_0x46d7e4){if(_0x46d7e4){_0x368ab0[_0xd8b7('0x5c')][_0xd8b7('0x60')]=_0x46d7e4['id'];return db[_0xd8b7('0x61')]['create'](_0x368ab0['body']);}})[_0xd8b7('0x35')](respondWithResult(_0x3331f1,null))[_0xd8b7('0x23')](handleError(_0x3331f1,null));};exports[_0xd8b7('0x62')]=function(_0x4ad2e8,_0x39466c,_0x4c6b6d){var _0x4eed25={'raw':![],'where':{}};var _0x17a0dc={};var _0x32e82d={'count':0x0,'rows':[]};return db[_0xd8b7('0x40')]['findOne']({'where':{'id':_0x4ad2e8['params']['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0x39466c,null))['then'](function(_0x991a68){if(_0x991a68){_0x17a0dc[_0xd8b7('0x45')]=_[_0xd8b7('0x47')](db[_0xd8b7('0x61')][_0xd8b7('0x41')]);_0x17a0dc[_0xd8b7('0x46')]=_[_0xd8b7('0x47')](_0x4ad2e8[_0xd8b7('0x46')]);_0x17a0dc[_0xd8b7('0x48')]=_['intersection'](_0x17a0dc[_0xd8b7('0x45')],_0x17a0dc['query']);_0x4eed25[_0xd8b7('0x4b')]=_['intersection'](_0x17a0dc[_0xd8b7('0x45')],qs[_0xd8b7('0x4a')](_0x4ad2e8[_0xd8b7('0x46')][_0xd8b7('0x4a')]));_0x4eed25['attributes']=_0x4eed25['attributes'][_0xd8b7('0x4c')]?_0x4eed25[_0xd8b7('0x4b')]:_0x17a0dc['model'];if(!_0x4ad2e8[_0xd8b7('0x46')][_0xd8b7('0x63')](_0xd8b7('0x4d'))){_0x4eed25['limit']=qs[_0xd8b7('0x2a')](_0x4ad2e8['query']['limit']);_0x4eed25['offset']=qs['offset'](_0x4ad2e8[_0xd8b7('0x46')][_0xd8b7('0x28')]);}_0x4eed25[_0xd8b7('0x4e')]=qs['sort'](_0x4ad2e8[_0xd8b7('0x46')][_0xd8b7('0x4f')]);_0x4eed25[_0xd8b7('0x50')]=qs[_0xd8b7('0x48')](_[_0xd8b7('0x51')](_0x4ad2e8[_0xd8b7('0x46')],_0x17a0dc['filters']));_0x4eed25[_0xd8b7('0x50')][_0xd8b7('0x60')]=_0x991a68['id'];if(_0x4ad2e8['query'][_0xd8b7('0x52')]){_0x4eed25[_0xd8b7('0x50')]=_[_0xd8b7('0x53')](_0x4eed25['where'],{'$or':_[_0xd8b7('0x3f')](_0x4eed25['attributes'],function(_0x1cbd3e){var _0x3679bb={};_0x3679bb[_0x1cbd3e]={'$like':'%'+_0x4ad2e8[_0xd8b7('0x46')][_0xd8b7('0x52')]+'%'};return _0x3679bb;})});}_0x4eed25=_[_0xd8b7('0x53')]({},_0x4eed25,_0x4ad2e8[_0xd8b7('0x55')]);return db[_0xd8b7('0x61')][_0xd8b7('0x2b')]({'where':_0x4eed25[_0xd8b7('0x50')]})[_0xd8b7('0x35')](function(_0x512cd1){_0x32e82d[_0xd8b7('0x2b')]=_0x512cd1;if(_0x4ad2e8[_0xd8b7('0x46')][_0xd8b7('0x56')]){_0x4eed25[_0xd8b7('0x57')]=[{'all':!![]}];}return db[_0xd8b7('0x61')]['findAll'](_0x4eed25);})[_0xd8b7('0x35')](function(_0x4f4bc6){_0x32e82d[_0xd8b7('0x59')]=_0x4f4bc6;return _0x32e82d;});}})[_0xd8b7('0x35')](respondWithFilteredResult(_0x39466c,_0x4eed25))[_0xd8b7('0x23')](handleError(_0x39466c,null));};exports[_0xd8b7('0x64')]=function(_0x2e8eeb,_0x564952,_0x3a5e55){return db[_0xd8b7('0x40')]['find']({'where':{'id':_0x2e8eeb['params']['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0x564952,null))[_0xd8b7('0x35')](function(_0xe8a6cc){if(_0xe8a6cc){return _0xe8a6cc['removeDispositions'](_0x2e8eeb['query']['ids']);}})['then'](respondWithStatusCode(_0x564952,null))[_0xd8b7('0x23')](handleError(_0x564952,null));};exports[_0xd8b7('0x65')]=function(_0x7d46ba,_0x4d8c60,_0x533fda){if(_0x7d46ba[_0xd8b7('0x5c')]['id']){delete _0x7d46ba[_0xd8b7('0x5c')]['id'];}return db[_0xd8b7('0x40')][_0xd8b7('0x5d')]({'where':{'id':_0x7d46ba[_0xd8b7('0x5e')]['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0x4d8c60,null))[_0xd8b7('0x35')](function(_0x333ec3){if(_0x333ec3){_0x7d46ba[_0xd8b7('0x5c')][_0xd8b7('0x60')]=_0x333ec3['id'];return db[_0xd8b7('0x66')]['create'](_0x7d46ba[_0xd8b7('0x5c')]);}})[_0xd8b7('0x35')](respondWithResult(_0x4d8c60,null))[_0xd8b7('0x23')](handleError(_0x4d8c60,null));};exports[_0xd8b7('0x67')]=function(_0x45873b,_0x3ab09b,_0x343004){var _0xcb63e3={'raw':![],'where':{}};var _0x57f811={};var _0xc4a36e={'count':0x0,'rows':[]};return db[_0xd8b7('0x40')][_0xd8b7('0x68')]({'where':{'id':_0x45873b['params']['id']}})['then'](handleEntityNotFound(_0x3ab09b,null))[_0xd8b7('0x35')](function(_0x453e23){if(_0x453e23){_0x57f811[_0xd8b7('0x45')]=_[_0xd8b7('0x47')](db[_0xd8b7('0x66')][_0xd8b7('0x41')]);_0x57f811[_0xd8b7('0x46')]=_[_0xd8b7('0x47')](_0x45873b[_0xd8b7('0x46')]);_0x57f811[_0xd8b7('0x48')]=_[_0xd8b7('0x49')](_0x57f811['model'],_0x57f811[_0xd8b7('0x46')]);_0xcb63e3[_0xd8b7('0x4b')]=_[_0xd8b7('0x49')](_0x57f811['model'],qs[_0xd8b7('0x4a')](_0x45873b[_0xd8b7('0x46')][_0xd8b7('0x4a')]));_0xcb63e3[_0xd8b7('0x4b')]=_0xcb63e3['attributes']['length']?_0xcb63e3[_0xd8b7('0x4b')]:_0x57f811['model'];if(!_0x45873b['query'][_0xd8b7('0x63')](_0xd8b7('0x4d'))){_0xcb63e3[_0xd8b7('0x2a')]=qs[_0xd8b7('0x2a')](_0x45873b[_0xd8b7('0x46')][_0xd8b7('0x2a')]);_0xcb63e3[_0xd8b7('0x28')]=qs[_0xd8b7('0x28')](_0x45873b[_0xd8b7('0x46')]['offset']);}_0xcb63e3[_0xd8b7('0x4e')]=qs[_0xd8b7('0x4f')](_0x45873b[_0xd8b7('0x46')][_0xd8b7('0x4f')]);_0xcb63e3[_0xd8b7('0x50')]=qs[_0xd8b7('0x48')](_[_0xd8b7('0x51')](_0x45873b['query'],_0x57f811[_0xd8b7('0x48')]));_0xcb63e3[_0xd8b7('0x50')]['MailAccountId']=_0x453e23['id'];if(_0x45873b[_0xd8b7('0x46')][_0xd8b7('0x52')]){_0xcb63e3['where']=_[_0xd8b7('0x53')](_0xcb63e3[_0xd8b7('0x50')],{'$or':_[_0xd8b7('0x3f')](_0xcb63e3[_0xd8b7('0x4b')],function(_0x7b364a){var _0x3739b1={};_0x3739b1[_0x7b364a]={'$like':'%'+_0x45873b[_0xd8b7('0x46')]['filter']+'%'};return _0x3739b1;})});}_0xcb63e3=_[_0xd8b7('0x53')]({},_0xcb63e3,_0x45873b[_0xd8b7('0x55')]);return db[_0xd8b7('0x66')]['count']({'where':_0xcb63e3['where']})[_0xd8b7('0x35')](function(_0x39ed97){_0xc4a36e['count']=_0x39ed97;if(_0x45873b[_0xd8b7('0x46')][_0xd8b7('0x56')]){_0xcb63e3[_0xd8b7('0x57')]=[{'all':!![]}];}return db[_0xd8b7('0x66')]['findAll'](_0xcb63e3);})[_0xd8b7('0x35')](function(_0x540e37){_0xc4a36e[_0xd8b7('0x59')]=_0x540e37;return _0xc4a36e;});}})[_0xd8b7('0x35')](respondWithFilteredResult(_0x3ab09b,_0xcb63e3))[_0xd8b7('0x23')](handleError(_0x3ab09b,null));};exports['removeAnswers']=function(_0x4b7c5f,_0x161921,_0x34cc8c){return db[_0xd8b7('0x40')][_0xd8b7('0x5d')]({'where':{'id':_0x4b7c5f[_0xd8b7('0x5e')]['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0x161921,null))[_0xd8b7('0x35')](function(_0x5bec6f){if(_0x5bec6f){return _0x5bec6f[_0xd8b7('0x69')](_0x4b7c5f['query'][_0xd8b7('0x6a')]);}})[_0xd8b7('0x35')](respondWithStatusCode(_0x161921,null))[_0xd8b7('0x23')](handleError(_0x161921,null));};exports['create']=function(_0xc1f922,_0x240937){var _0x4d1ed6={'name':_0xc1f922[_0xd8b7('0x5c')][_0xd8b7('0x37')],'key':_0xc1f922[_0xd8b7('0x5c')][_0xd8b7('0x44')],'email':_0xc1f922[_0xd8b7('0x5c')]['email'],'ListId':_0xc1f922['body']['ListId'],'active':!_['isNil'](_0xc1f922[_0xd8b7('0x5c')][_0xd8b7('0x6b')])?_0xc1f922[_0xd8b7('0x5c')][_0xd8b7('0x6b')]:!![],'description':_0xc1f922[_0xd8b7('0x5c')][_0xd8b7('0x6c')]||null,'Imap':{},'Smtp':{}};if(_[_0xd8b7('0x6d')](_0xc1f922['body']['cservice'])){if(_0xc1f922[_0xd8b7('0x5c')][_0xd8b7('0x6e')]){_0x4d1ed6[_0xd8b7('0x3a')][_0xd8b7('0x6f')]=_0x4d1ed6['Smtp'][_0xd8b7('0x6f')]=_0xc1f922[_0xd8b7('0x5c')]['cuser'];_0x4d1ed6[_0xd8b7('0x3a')][_0xd8b7('0x70')]=_0x4d1ed6[_0xd8b7('0x3c')]['pass']=_0xc1f922['body'][_0xd8b7('0x71')];}else{_0x4d1ed6[_0xd8b7('0x3a')][_0xd8b7('0x72')]=_0x4d1ed6[_0xd8b7('0x3c')]['authentication']=![];}_0x4d1ed6[_0xd8b7('0x3a')][_0xd8b7('0x73')]=_0xc1f922[_0xd8b7('0x5c')]['Imap'][_0xd8b7('0x73')];_0x4d1ed6[_0xd8b7('0x3a')][_0xd8b7('0x74')]=_0xc1f922[_0xd8b7('0x5c')][_0xd8b7('0x3a')]['port'];_0x4d1ed6[_0xd8b7('0x3c')]['host']=_0xc1f922['body'][_0xd8b7('0x3c')]['host'];_0x4d1ed6[_0xd8b7('0x3c')]['port']=_0xc1f922[_0xd8b7('0x5c')]['Smtp'][_0xd8b7('0x74')];}else{_0x4d1ed6['Imap'][_0xd8b7('0x75')]=_0x4d1ed6[_0xd8b7('0x3c')][_0xd8b7('0x75')]=_0xc1f922['body'][_0xd8b7('0x76')];_0x4d1ed6[_0xd8b7('0x3a')][_0xd8b7('0x6f')]=_0x4d1ed6[_0xd8b7('0x3c')][_0xd8b7('0x6f')]=_0xc1f922[_0xd8b7('0x5c')][_0xd8b7('0x77')];_0x4d1ed6[_0xd8b7('0x3a')][_0xd8b7('0x70')]=_0x4d1ed6['Smtp'][_0xd8b7('0x78')]=_0xc1f922['body'][_0xd8b7('0x71')];}return db[_0xd8b7('0x40')]['create'](_0x4d1ed6,{'include':[{'model':db[_0xd8b7('0x3b')],'as':_0xd8b7('0x3c')},{'model':db[_0xd8b7('0x5b')],'as':_0xd8b7('0x3a')}]})[_0xd8b7('0x35')](function(_0x54f836){var _0x22ba03=_0xc1f922[_0xd8b7('0x6f')]['get']({'plain':!![]});if(!_0x22ba03)throw new Error(_0xd8b7('0x79'));if(_0x22ba03[_0xd8b7('0x7a')]===_0xd8b7('0x6f')){var _0x43efca=_0x54f836[_0xd8b7('0x32')]({'plain':!![]});return db[_0xd8b7('0x7b')][_0xd8b7('0x5d')]({'where':{'name':_0xd8b7('0x33'),'userProfileId':_0x22ba03['userProfileId']},'raw':!![]})[_0xd8b7('0x35')](function(_0x1a8be0){if(_0x1a8be0&&_0x1a8be0[_0xd8b7('0x7c')]===0x0){return db[_0xd8b7('0x34')]['create']({'name':_0x43efca[_0xd8b7('0x37')],'resourceId':_0x43efca['id'],'type':_0x1a8be0[_0xd8b7('0x37')],'sectionId':_0x1a8be0['id']},{})[_0xd8b7('0x35')](function(){return _0x54f836;});}else{return _0x54f836;}})[_0xd8b7('0x23')](function(_0x5a29ed){logger[_0xd8b7('0x1f')](_0xd8b7('0x7d'),_0x5a29ed);throw _0x5a29ed;});}return _0x54f836;})[_0xd8b7('0x35')](respondWithResult(_0x240937,0xc9))[_0xd8b7('0x23')](handleError(_0x240937,null));};exports['getImap']=function(_0x4969ad,_0x3036b1,_0x5b719a){return db[_0xd8b7('0x40')]['findOne']({'where':{'id':_0x4969ad[_0xd8b7('0x5e')]['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0x3036b1,null))['then'](function(_0x59b17a){if(_0x59b17a){return _0x59b17a[_0xd8b7('0x7e')]();}return null;})[_0xd8b7('0x35')](respondWithResult(_0x3036b1,null))['catch'](handleError(_0x3036b1,null));};exports[_0xd8b7('0x7f')]=function(_0xbf758c,_0x3c2612,_0x2997ab){if(_0xbf758c['body']['id']){delete _0xbf758c[_0xd8b7('0x5c')]['id'];}return db[_0xd8b7('0x40')][_0xd8b7('0x5d')]({'where':{'id':_0xbf758c[_0xd8b7('0x5e')]['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0x3c2612,null))[_0xd8b7('0x35')](function(_0x371a04){if(_0x371a04){_0xbf758c[_0xd8b7('0x5c')][_0xd8b7('0x60')]=_0x371a04['id'];return db['MailServerIn']['create'](_0xbf758c['body']);}})[_0xd8b7('0x35')](respondWithResult(_0x3c2612,null))[_0xd8b7('0x23')](handleError(_0x3c2612,null));};exports['removeImap']=function(_0x14cb15,_0x2f615e,_0x561883){return db[_0xd8b7('0x40')][_0xd8b7('0x68')]({'where':{'id':_0x14cb15[_0xd8b7('0x5e')]['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0x2f615e,null))['then'](function(_0x24264c){if(_0x24264c){return _0x24264c[_0xd8b7('0x80')](null);}return null;})['then'](respondWithStatusCode(_0x2f615e,null))['catch'](handleError(_0x2f615e,null));};exports[_0xd8b7('0x81')]=function(_0x23f296,_0x2814a4,_0x4807fe){return db[_0xd8b7('0x40')]['findOne']({'where':{'id':_0x23f296[_0xd8b7('0x5e')]['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0x2814a4,null))['then'](function(_0x4e1958){if(_0x4e1958){return _0x4e1958[_0xd8b7('0x81')]();}return null;})[_0xd8b7('0x35')](respondWithResult(_0x2814a4,null))[_0xd8b7('0x23')](handleError(_0x2814a4,null));};exports[_0xd8b7('0x82')]=function(_0x1fc81a,_0x428818,_0x53d399){if(_0x1fc81a[_0xd8b7('0x5c')]['id']){delete _0x1fc81a[_0xd8b7('0x5c')]['id'];}return db[_0xd8b7('0x40')][_0xd8b7('0x5d')]({'where':{'id':_0x1fc81a[_0xd8b7('0x5e')]['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0x428818,null))[_0xd8b7('0x35')](function(_0x56b906){if(_0x56b906){_0x1fc81a[_0xd8b7('0x5c')][_0xd8b7('0x60')]=_0x56b906['id'];return db[_0xd8b7('0x3b')]['create'](_0x1fc81a['body']);}})[_0xd8b7('0x35')](respondWithResult(_0x428818,null))[_0xd8b7('0x23')](handleError(_0x428818,null));};exports['removeSmtp']=function(_0x201a63,_0x4a7bac,_0x49ce06){return db[_0xd8b7('0x40')]['findOne']({'where':{'id':_0x201a63[_0xd8b7('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4a7bac,null))['then'](function(_0x1440f3){if(_0x1440f3){return _0x1440f3['setSmtp'](null);}return null;})[_0xd8b7('0x35')](respondWithStatusCode(_0x4a7bac,null))[_0xd8b7('0x23')](handleError(_0x4a7bac,null));};exports[_0xd8b7('0x83')]=function(_0x1efffb,_0x2b16f1,_0xaea953){return db[_0xd8b7('0x84')][_0xd8b7('0x5d')]({'where':{'id':_0x1efffb[_0xd8b7('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2b16f1,null))['then'](function(_0x374d0c){if(_0x374d0c){return _0x374d0c[_0xd8b7('0x83')](_0x1efffb['body'][_0xd8b7('0x6a')],_[_0xd8b7('0x85')](_0x1efffb['body'],['ids','id'])||{});}})[_0xd8b7('0x35')](respondWithResult(_0x2b16f1,null))[_0xd8b7('0x23')](handleError(_0x2b16f1,null));};exports['getInteractions']=function(_0x350a9c,_0xc013d9,_0x31c7a3){var _0x30b724={'raw':![],'where':{}};var _0x535822={};var _0x27e8f4={'count':0x0,'rows':[]};return db[_0xd8b7('0x40')][_0xd8b7('0x68')]({'where':{'id':_0x350a9c['params']['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0xc013d9,null))[_0xd8b7('0x35')](function(_0x1c245c){if(_0x1c245c){_0x535822[_0xd8b7('0x45')]=_['keys'](db[_0xd8b7('0x84')][_0xd8b7('0x41')]);_0x535822['query']=_[_0xd8b7('0x47')](_0x350a9c[_0xd8b7('0x46')]);_0x535822[_0xd8b7('0x48')]=_['intersection'](_0x535822[_0xd8b7('0x45')],_0x535822['query']);_0x30b724['attributes']=_[_0xd8b7('0x49')](_0x535822['model'],qs[_0xd8b7('0x4a')](_0x350a9c[_0xd8b7('0x46')][_0xd8b7('0x4a')]));_0x30b724[_0xd8b7('0x4b')]=_0x30b724[_0xd8b7('0x4b')][_0xd8b7('0x4c')]?_0x30b724[_0xd8b7('0x4b')]:_0x535822[_0xd8b7('0x45')];if(!_0x350a9c[_0xd8b7('0x46')]['hasOwnProperty'](_0xd8b7('0x4d'))){_0x30b724[_0xd8b7('0x2a')]=qs[_0xd8b7('0x2a')](_0x350a9c[_0xd8b7('0x46')][_0xd8b7('0x2a')]);_0x30b724['offset']=qs[_0xd8b7('0x28')](_0x350a9c[_0xd8b7('0x46')][_0xd8b7('0x28')]);}_0x30b724[_0xd8b7('0x4e')]=qs[_0xd8b7('0x4f')](_0x350a9c['query'][_0xd8b7('0x4f')]);_0x30b724[_0xd8b7('0x50')]=qs[_0xd8b7('0x48')](_[_0xd8b7('0x51')](_0x350a9c[_0xd8b7('0x46')],_0x535822[_0xd8b7('0x48')]));_0x30b724[_0xd8b7('0x50')][_0xd8b7('0x60')]=_0x1c245c['id'];if(_0x350a9c[_0xd8b7('0x46')][_0xd8b7('0x52')]){_0x30b724[_0xd8b7('0x50')]=_[_0xd8b7('0x53')](_0x30b724[_0xd8b7('0x50')],{'$or':_[_0xd8b7('0x3f')](_0x30b724[_0xd8b7('0x4b')],function(_0x58f330){var _0x8ba32f={};_0x8ba32f[_0x58f330]={'$like':'%'+_0x350a9c[_0xd8b7('0x46')][_0xd8b7('0x52')]+'%'};return _0x8ba32f;})});}_0x30b724=_[_0xd8b7('0x53')]({},_0x30b724,_0x350a9c[_0xd8b7('0x55')]);return db[_0xd8b7('0x84')][_0xd8b7('0x2b')]({'where':_0x30b724[_0xd8b7('0x50')]})['then'](function(_0xa0484d){_0x27e8f4[_0xd8b7('0x2b')]=_0xa0484d;if(_0x350a9c[_0xd8b7('0x46')][_0xd8b7('0x56')]){_0x30b724[_0xd8b7('0x57')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xd8b7('0x86')],'as':_0xd8b7('0x87'),'attributes':[_0xd8b7('0x37'),_0xd8b7('0x88'),_0xd8b7('0x89')],'required':![]},{'model':db[_0xd8b7('0x8a')],'as':_0xd8b7('0x8b'),'attributes':['id',_0xd8b7('0x37'),'color'],'where':_0x350a9c[_0xd8b7('0x46')][_0xd8b7('0x8c')]?{'id':_0x350a9c[_0xd8b7('0x46')][_0xd8b7('0x8c')]}:undefined,'required':_0x350a9c[_0xd8b7('0x46')][_0xd8b7('0x8c')]?!![]:![]}];}return db[_0xd8b7('0x84')][_0xd8b7('0x58')](_0x30b724);})[_0xd8b7('0x35')](function(_0x117c87){_0x27e8f4['rows']=_0x117c87;return _0x27e8f4;});}})[_0xd8b7('0x35')](respondWithFilteredResult(_0xc013d9,_0x30b724))['catch'](handleError(_0xc013d9,null));};exports['addApplications']=function(_0x2c5949,_0x20761a,_0x10de04){return db['MailAccount'][_0xd8b7('0x68')]({'where':{'id':_0x2c5949['params']['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0x20761a,null))[_0xd8b7('0x35')](function(_0x4e6b54){if(_0x4e6b54){return db['sequelize']['transaction'](function(_0x4e98ec){return db[_0xd8b7('0x8d')][_0xd8b7('0x31')]({'where':{'MailAccountId':_0x2c5949[_0xd8b7('0x5e')]['id']},'transaction':_0x4e98ec})[_0xd8b7('0x35')](function(_0x4f4fad){var _0x135cc9=_[_0xd8b7('0x3f')](_0x2c5949[_0xd8b7('0x5c')],function(_0x527e60){_0x527e60['MailAccountId']=_0x2c5949[_0xd8b7('0x5e')]['id'];return _0x527e60;});return db[_0xd8b7('0x8d')][_0xd8b7('0x8e')](_0x135cc9,{'transaction':_0x4e98ec});});})[_0xd8b7('0x35')](function(){return db[_0xd8b7('0x8d')][_0xd8b7('0x8f')]({'where':{'MailAccountId':_0x2c5949[_0xd8b7('0x5e')]['id']},'order':_0xd8b7('0x90')});});}})[_0xd8b7('0x35')](respondWithResult(_0x20761a,null))[_0xd8b7('0x23')](handleError(_0x20761a,null));};exports[_0xd8b7('0x91')]=function(_0x37ee0e,_0x27219b,_0x2ed418){var _0xf2a57={};var _0x5f0736={};var _0x3e5c42;var _0x44599e;return db[_0xd8b7('0x40')][_0xd8b7('0x68')]({'where':{'id':_0x37ee0e[_0xd8b7('0x5e')]['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0x27219b,null))[_0xd8b7('0x35')](function(_0x582f65){if(_0x582f65){_0x3e5c42=_0x582f65;_0x5f0736[_0xd8b7('0x45')]=_[_0xd8b7('0x47')](db[_0xd8b7('0x8d')][_0xd8b7('0x41')]);_0x5f0736['query']=_['keys'](_0x37ee0e[_0xd8b7('0x46')]);_0x5f0736[_0xd8b7('0x48')]=_['intersection'](_0x5f0736['model'],_0x5f0736['query']);_0xf2a57[_0xd8b7('0x4b')]=_[_0xd8b7('0x49')](_0x5f0736[_0xd8b7('0x45')],qs['fields'](_0x37ee0e[_0xd8b7('0x46')]['fields']));_0xf2a57[_0xd8b7('0x4b')]=_0xf2a57[_0xd8b7('0x4b')][_0xd8b7('0x4c')]?_0xf2a57[_0xd8b7('0x4b')]:_0x5f0736[_0xd8b7('0x45')];_0xf2a57[_0xd8b7('0x4e')]=qs[_0xd8b7('0x4f')](_0x37ee0e['query'][_0xd8b7('0x4f')]);_0xf2a57['where']=qs['filters'](_[_0xd8b7('0x51')](_0x37ee0e[_0xd8b7('0x46')],_0x5f0736[_0xd8b7('0x48')]));if(_0x37ee0e[_0xd8b7('0x46')][_0xd8b7('0x52')]){_0xf2a57[_0xd8b7('0x50')]=_[_0xd8b7('0x53')](_0xf2a57[_0xd8b7('0x50')],{'$or':_['map'](_0xf2a57['attributes'],function(_0x37ae77){var _0x281515={};_0x281515[_0x37ae77]={'$like':'%'+_0x37ee0e[_0xd8b7('0x46')][_0xd8b7('0x52')]+'%'};return _0x281515;})});}_0xf2a57=_[_0xd8b7('0x53')]({},_0xf2a57,_0x37ee0e[_0xd8b7('0x55')]);return _0x3e5c42[_0xd8b7('0x91')](_0xf2a57);}})[_0xd8b7('0x35')](function(_0x22f48a){if(_0x22f48a){_0x44599e=_0x22f48a[_0xd8b7('0x4c')];if(!_0x37ee0e['query'][_0xd8b7('0x63')](_0xd8b7('0x4d'))){_0xf2a57[_0xd8b7('0x2a')]=qs['limit'](_0x37ee0e[_0xd8b7('0x46')][_0xd8b7('0x2a')]);_0xf2a57['offset']=qs[_0xd8b7('0x28')](_0x37ee0e['query'][_0xd8b7('0x28')]);}return _0x3e5c42[_0xd8b7('0x91')](_0xf2a57);}})[_0xd8b7('0x35')](function(_0x3cb99c){if(_0x3cb99c){return _0x3cb99c?{'count':_0x44599e,'rows':_0x3cb99c}:null;}})[_0xd8b7('0x35')](respondWithResult(_0x27219b,null))[_0xd8b7('0x23')](handleError(_0x27219b,null));};exports[_0xd8b7('0x92')]=function(_0xf2c4bc,_0xcd512a,_0x43d31f){var _0x39d744={'raw':!![],'where':{}};var _0x13736e={};var _0x499ee6={'count':0x0,'rows':[]};return db['MailAccount'][_0xd8b7('0x68')]({'where':{'id':_0xf2c4bc[_0xd8b7('0x5e')]['id']}})['then'](handleEntityNotFound(_0xcd512a,null))[_0xd8b7('0x35')](function(_0x17a122){if(_0x17a122){_0x13736e[_0xd8b7('0x45')]=_[_0xd8b7('0x47')](db[_0xd8b7('0x93')][_0xd8b7('0x41')]);_0x13736e[_0xd8b7('0x46')]=_[_0xd8b7('0x47')](_0xf2c4bc[_0xd8b7('0x46')]);_0x13736e[_0xd8b7('0x48')]=_['intersection'](_0x13736e[_0xd8b7('0x45')],_0x13736e[_0xd8b7('0x46')]);_0x39d744[_0xd8b7('0x4b')]=_[_0xd8b7('0x49')](_0x13736e[_0xd8b7('0x45')],qs[_0xd8b7('0x4a')](_0xf2c4bc[_0xd8b7('0x46')]['fields']));_0x39d744['attributes']=_0x39d744[_0xd8b7('0x4b')][_0xd8b7('0x4c')]?_0x39d744[_0xd8b7('0x4b')]:_0x13736e[_0xd8b7('0x45')];if(!_0xf2c4bc[_0xd8b7('0x46')][_0xd8b7('0x63')](_0xd8b7('0x4d'))){_0x39d744[_0xd8b7('0x2a')]=qs[_0xd8b7('0x2a')](_0xf2c4bc[_0xd8b7('0x46')][_0xd8b7('0x2a')]);_0x39d744['offset']=qs[_0xd8b7('0x28')](_0xf2c4bc['query'][_0xd8b7('0x28')]);}_0x39d744[_0xd8b7('0x4e')]=qs[_0xd8b7('0x4f')](_0xf2c4bc[_0xd8b7('0x46')][_0xd8b7('0x4f')]);_0x39d744[_0xd8b7('0x50')]=qs[_0xd8b7('0x48')](_[_0xd8b7('0x51')](_0xf2c4bc['query'],_0x13736e[_0xd8b7('0x48')]));_0x39d744[_0xd8b7('0x50')][_0xd8b7('0x60')]=_0x17a122['id'];if(_0xf2c4bc[_0xd8b7('0x46')][_0xd8b7('0x52')]){_0x39d744[_0xd8b7('0x50')]=_[_0xd8b7('0x53')](_0x39d744['where'],{'$or':_['map'](_0x39d744[_0xd8b7('0x4b')],function(_0x5fb5b6){var _0x689a7f={};_0x689a7f[_0x5fb5b6]={'$like':'%'+_0xf2c4bc['query'][_0xd8b7('0x52')]+'%'};return _0x689a7f;})});}if(_0xf2c4bc[_0xd8b7('0x46')][_0xd8b7('0x94')]){var _0x49e007=_0xf2c4bc[_0xd8b7('0x46')][_0xd8b7('0x94')][_0xd8b7('0x95')](',');var _0x243435={};_0x243435[_0x49e007[0x0]]={'$gte':moment(_0x49e007[0x1])[_0xd8b7('0x96')](_0xd8b7('0x97'))};_0x39d744[_0xd8b7('0x50')]=_[_0xd8b7('0x53')](_0x39d744[_0xd8b7('0x50')],_0x243435);}_0x39d744=_[_0xd8b7('0x53')]({},_0x39d744,_0xf2c4bc['options']);return db[_0xd8b7('0x93')][_0xd8b7('0x2b')]({'where':_0x39d744[_0xd8b7('0x50')]})[_0xd8b7('0x35')](function(_0x4448ca){_0x499ee6[_0xd8b7('0x2b')]=_0x4448ca;if(_0xf2c4bc['query'][_0xd8b7('0x56')]){_0x39d744[_0xd8b7('0x57')]=[{'all':!![]}];}return db['MailMessage'][_0xd8b7('0x58')](_0x39d744);})['then'](function(_0x2d3fd8){if(_0xf2c4bc[_0xd8b7('0x46')]['inlineCss']==='true'){for(var _0x3ca915=0x0;_0x3ca915<_0x2d3fd8[_0xd8b7('0x4c')];_0x3ca915++){_0x2d3fd8[_0x3ca915]['body']=juice(_0x2d3fd8[_0x3ca915]['body']);}}_0x499ee6[_0xd8b7('0x59')]=_0x2d3fd8;return _0x499ee6;});}})['then'](respondWithFilteredResult(_0xcd512a,_0x39d744))[_0xd8b7('0x23')](handleError(_0xcd512a,null));};exports[_0xd8b7('0x38')]=function(_0x310f8a,_0x5fab88,_0x1643d3){var _0x1d3196,_0x5de230={},_0x6804eb;if(_0x310f8a[_0xd8b7('0x5c')]['to']){_0x6804eb=_0x310f8a['body']['to'][_0xd8b7('0x95')](',')[0x0];}return db[_0xd8b7('0x40')][_0xd8b7('0x5d')]({'where':{'id':_0x310f8a['params']['id']},'include':[{'model':db[_0xd8b7('0x98')],'as':_0xd8b7('0x99'),'include':[{'model':db[_0xd8b7('0x9a')],'as':_0xd8b7('0x9b'),'where':{'email':_0x6804eb},'limit':0x1,'order':[[_0xd8b7('0x9c'),_0xd8b7('0x9d')]]}]},{'model':db[_0xd8b7('0x3b')],'as':_0xd8b7('0x3c'),'raw':!![]}]})[_0xd8b7('0x35')](handleEntityNotFound(_0x5fab88,null))['then'](function(_0x1fd5d5){if(_0x1fd5d5){_0x1d3196=_0x1fd5d5;if(_0x1fd5d5[_0xd8b7('0x3c')]){if(_[_0xd8b7('0x6d')](_0x310f8a[_0xd8b7('0x5c')][_0xd8b7('0x9e')])){_0x310f8a['body'][_0xd8b7('0x9e')]=util[_0xd8b7('0x96')](_0xd8b7('0x9f'),_0x1fd5d5[_0xd8b7('0x37')],_0x1fd5d5[_0xd8b7('0xa0')]||_0x1fd5d5['Smtp'][_0xd8b7('0x6f')]);}if(_0x310f8a[_0xd8b7('0x5c')]['attachments']&&_0x310f8a[_0xd8b7('0x5c')]['attachments']['length']){for(var _0x3e9264=0x0;_0x3e9264<_0x310f8a[_0xd8b7('0x5c')][_0xd8b7('0xa1')][_0xd8b7('0x4c')];_0x3e9264+=0x1){_0x310f8a[_0xd8b7('0x5c')][_0xd8b7('0xa1')][_0x3e9264]={'filename':_0x310f8a['body'][_0xd8b7('0xa1')][_0x3e9264][_0xd8b7('0x37')],'path':path[_0xd8b7('0xa2')](config['root'],_0xd8b7('0xa3'),_0x310f8a[_0xd8b7('0x5c')][_0xd8b7('0xa1')][_0x3e9264][_0xd8b7('0xa4')])};}}var _0xeb64ab={'tls':{'rejectUnauthorized':![]}};if(_[_0xd8b7('0x6d')](_0x1fd5d5[_0xd8b7('0x3c')][_0xd8b7('0x75')])){if(_0x1fd5d5[_0xd8b7('0x3c')][_0xd8b7('0x72')]){_0xeb64ab[_0xd8b7('0xa5')]={'user':_0x1fd5d5[_0xd8b7('0x3c')][_0xd8b7('0x6f')],'pass':_0x1fd5d5[_0xd8b7('0x3c')][_0xd8b7('0x78')]};}_0xeb64ab[_0xd8b7('0x73')]=_0x1fd5d5[_0xd8b7('0x3c')][_0xd8b7('0x73')];_0xeb64ab[_0xd8b7('0x74')]=_0x1fd5d5['Smtp'][_0xd8b7('0x74')];_0xeb64ab['secure']=_0x1fd5d5[_0xd8b7('0x3c')][_0xd8b7('0xa6')];}else{_0xeb64ab[_0xd8b7('0x75')]=_0x1fd5d5[_0xd8b7('0x3c')][_0xd8b7('0x75')];_0xeb64ab['auth']={'user':_0x1fd5d5[_0xd8b7('0x3c')][_0xd8b7('0x6f')],'pass':_0x1fd5d5[_0xd8b7('0x3c')][_0xd8b7('0x78')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0xeb64ab,'message':_0x310f8a['body']});}else{throw new Error('List\x20not\x20found');}}})[_0xd8b7('0x35')](function(_0x4632ab){if(_0x4632ab){_0x5de230=_0x4632ab;if(_0x1d3196[_0xd8b7('0x99')]){if(_0x1d3196['List'][_0xd8b7('0x9b')][_0xd8b7('0x4c')]){return _0x1d3196[_0xd8b7('0x99')]['Contacts'][0x0];}else{return db[_0xd8b7('0x9a')][_0xd8b7('0xa7')](_[_0xd8b7('0x15')](_0x310f8a[_0xd8b7('0x5c')],{'firstName':_0x310f8a[_0xd8b7('0x5c')]['to'],'email':_0x310f8a[_0xd8b7('0x5c')]['to'],'phone':_0x310f8a[_0xd8b7('0x5c')]['to'],'ListId':_0x1d3196['ListId']}));}}else{throw new Error(_0xd8b7('0xa8'));}}})['then'](function(_0x17a06c){if(_0x17a06c){var _0x445120={'UserId':_0x310f8a[_0xd8b7('0x6f')]['id'],'ContactId':_0x17a06c['id'],'MailAccountId':_0x1d3196['id'],'inReplyTo':_0x5de230['messageId'],'to':_0x310f8a[_0xd8b7('0x5c')][_0xd8b7('0x9e')],'cc':_0x310f8a[_0xd8b7('0x5c')]['cc'],'subject':_0x310f8a[_0xd8b7('0x5c')][_0xd8b7('0xa9')],'attach':_0x310f8a[_0xd8b7('0x5c')]['attach'],'firstMsgDirection':_0xd8b7('0xaa'),'lastMsgAt':moment()[_0xd8b7('0x96')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xd8b7('0xaa'),'Messages':[_[_0xd8b7('0x53')](_0x310f8a[_0xd8b7('0x5c')],{'messageId':_0x5de230[_0xd8b7('0xab')],'sentAt':moment()['format'](_0xd8b7('0x97')),'read':!![],'MailAccountId':_0x1d3196['id'],'UserId':_0x310f8a['user']['id'],'ContactId':_0x17a06c['id']})]};if(_0x310f8a['body'][_0xd8b7('0xac')]){_0x445120=_[_0xd8b7('0x53')](_0x445120,_0x310f8a[_0xd8b7('0x5c')][_0xd8b7('0xac')]);}return db[_0xd8b7('0x84')]['create'](_0x445120,{'include':[{'model':db['MailMessage'],'as':_0xd8b7('0xad')}]});}})[_0xd8b7('0x35')](respondWithResult(_0x5fab88,null))[_0xd8b7('0x23')](handleError(_0x5fab88,null));};exports['verifySmtp']=function(_0x11ef7a,_0x8c7c46,_0x1df16d){return db['MailAccount'][_0xd8b7('0x5d')]({'where':{'id':_0x11ef7a[_0xd8b7('0x5e')]['id']},'include':[{'model':db[_0xd8b7('0x3b')],'as':_0xd8b7('0x3c'),'raw':!![]}]})[_0xd8b7('0x35')](handleEntityNotFound(_0x8c7c46,null))[_0xd8b7('0x35')](function(_0x11a4b3){if(_0x11a4b3&&_0x11a4b3['Smtp']){var _0x5e095d={'id':_0x11a4b3['id'],'tls':{'rejectUnauthorized':![]}};if(_0x11a4b3[_0xd8b7('0x3c')]['service']){_0x5e095d[_0xd8b7('0x75')]=_0x11a4b3['Smtp']['service'];}else{_0x5e095d['host']=_0x11a4b3[_0xd8b7('0x3c')][_0xd8b7('0x73')];_0x5e095d[_0xd8b7('0x74')]=_0x11a4b3['Smtp'][_0xd8b7('0x74')];_0x5e095d[_0xd8b7('0xa6')]=_0x11a4b3[_0xd8b7('0x3c')][_0xd8b7('0xa6')];}if(_0x11a4b3[_0xd8b7('0x3c')][_0xd8b7('0x72')]){_0x5e095d['auth']={'user':_0x11a4b3['Smtp'][_0xd8b7('0x6f')],'pass':_0x11a4b3['Smtp'][_0xd8b7('0x78')]};}return respondWithRpcPromise(_0xd8b7('0xae'),_0xd8b7('0xaf'),{'account':_0x5e095d});}})[_0xd8b7('0x35')](respondWithResult(_0x8c7c46,null))[_0xd8b7('0x23')](handleError(_0x8c7c46,null));};exports[_0xd8b7('0x31')]=function(_0x32b45f,_0x45329e){return db[_0xd8b7('0x40')][_0xd8b7('0x5d')]({'where':{'id':_0x32b45f['params']['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0x45329e,null))['then'](function(_0xebe589){if(_0xebe589&&_0xebe589[_0xd8b7('0x75')]){throw new db['Sequelize'][(_0xd8b7('0xb0'))](_0xd8b7('0xb1'));}return _0xebe589;})[_0xd8b7('0x35')](removeEntity(_0x45329e,null))[_0xd8b7('0x23')](handleError(_0x45329e,null));};exports[_0xd8b7('0xb2')]=function(_0x4cbd08,_0x325271,_0x2946a7){return db[_0xd8b7('0x40')][_0xd8b7('0x5d')]({'where':{'id':_0x4cbd08['params']['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0x325271,null))[_0xd8b7('0x35')](function(_0x4ee628){if(_0x4ee628){return _0x4ee628[_0xd8b7('0xb2')](_0x4cbd08[_0xd8b7('0x5c')][_0xd8b7('0x6a')],_[_0xd8b7('0x85')](_0x4cbd08[_0xd8b7('0x5c')],[_0xd8b7('0x6a'),'id'])||{})[_0xd8b7('0xb3')](function(_0x306b65){for(var _0x1e8139=0x0;_0x1e8139<_0x4cbd08[_0xd8b7('0x5c')][_0xd8b7('0x6a')][_0xd8b7('0x4c')];_0x1e8139+=0x1){socket['emit'](_0xd8b7('0xb4'),{'UserId':Number(_0x4cbd08[_0xd8b7('0x5c')][_0xd8b7('0x6a')][_0x1e8139]),'MailAccountId':Number(_0x4cbd08['params']['id'])});}return _0x306b65;});}})[_0xd8b7('0x35')](respondWithResult(_0x325271,null))[_0xd8b7('0x23')](handleError(_0x325271,null));};exports[_0xd8b7('0xb5')]=function(_0xa04e20,_0x2f2998,_0x3a6778){return db['MailAccount']['find']({'where':{'id':_0xa04e20['params']['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0x2f2998,null))[_0xd8b7('0x35')](function(_0x5a1d90){if(_0x5a1d90){return _0x5a1d90[_0xd8b7('0xb5')](_0xa04e20[_0xd8b7('0x46')][_0xd8b7('0x6a')])[_0xd8b7('0x35')](function(){if(_[_0xd8b7('0xb6')](_0xa04e20[_0xd8b7('0x46')][_0xd8b7('0x6a')])){for(var _0x55aa92=0x0;_0x55aa92<_0xa04e20['query'][_0xd8b7('0x6a')]['length'];_0x55aa92+=0x1){socket[_0xd8b7('0xb7')](_0xd8b7('0xb8'),{'UserId':Number(_0xa04e20['query'][_0xd8b7('0x6a')][_0x55aa92]),'MailAccountId':Number(_0xa04e20[_0xd8b7('0x5e')]['id'])});}}else{socket[_0xd8b7('0xb7')](_0xd8b7('0xb8'),{'UserId':Number(_0xa04e20['query'][_0xd8b7('0x6a')]),'MailAccountId':Number(_0xa04e20[_0xd8b7('0x5e')]['id'])});}});}})[_0xd8b7('0x35')](respondWithStatusCode(_0x2f2998,null))['catch'](handleError(_0x2f2998,null));};exports['getAgents']=function(_0x5eeb32,_0xebb486,_0x470b15){var _0x53cf9c={};var _0x558c18={};var _0x5644f2;var _0x142ffd;return db[_0xd8b7('0x40')][_0xd8b7('0x68')]({'where':{'id':_0x5eeb32[_0xd8b7('0x5e')]['id']}})[_0xd8b7('0x35')](handleEntityNotFound(_0xebb486,null))[_0xd8b7('0x35')](function(_0x499828){if(_0x499828){_0x5644f2=_0x499828;_0x558c18[_0xd8b7('0x45')]=_[_0xd8b7('0x47')](db['User'][_0xd8b7('0x41')]);_0x558c18[_0xd8b7('0x46')]=_[_0xd8b7('0x47')](_0x5eeb32[_0xd8b7('0x46')]);_0x558c18['filters']=_[_0xd8b7('0x49')](_0x558c18[_0xd8b7('0x45')],_0x558c18[_0xd8b7('0x46')]);_0x53cf9c[_0xd8b7('0x4b')]=_[_0xd8b7('0x49')](_0x558c18[_0xd8b7('0x45')],qs['fields'](_0x5eeb32[_0xd8b7('0x46')][_0xd8b7('0x4a')]));_0x53cf9c[_0xd8b7('0x4b')]=_0x53cf9c[_0xd8b7('0x4b')][_0xd8b7('0x4c')]?_0x53cf9c[_0xd8b7('0x4b')]:_0x558c18[_0xd8b7('0x45')];_0x53cf9c[_0xd8b7('0x4e')]=qs[_0xd8b7('0x4f')](_0x5eeb32[_0xd8b7('0x46')][_0xd8b7('0x4f')]);_0x53cf9c[_0xd8b7('0x50')]=qs['filters'](_[_0xd8b7('0x51')](_0x5eeb32[_0xd8b7('0x46')],_0x558c18['filters']));if(_0x5eeb32[_0xd8b7('0x46')]['filter']){_0x53cf9c[_0xd8b7('0x50')]=_[_0xd8b7('0x53')](_0x53cf9c[_0xd8b7('0x50')],{'$or':_['map'](_0x53cf9c[_0xd8b7('0x4b')],function(_0x28ede3){var _0xb4eda7={};_0xb4eda7[_0x28ede3]={'$like':'%'+_0x5eeb32[_0xd8b7('0x46')][_0xd8b7('0x52')]+'%'};return _0xb4eda7;})});}_0x53cf9c=_[_0xd8b7('0x53')]({},_0x53cf9c,_0x5eeb32[_0xd8b7('0x55')]);return _0x5644f2[_0xd8b7('0xb9')](_0x53cf9c);}})[_0xd8b7('0x35')](function(_0x3f2424){if(_0x3f2424){_0x142ffd=_0x3f2424[_0xd8b7('0x4c')];if(!_0x5eeb32[_0xd8b7('0x46')][_0xd8b7('0x63')](_0xd8b7('0x4d'))){_0x53cf9c['limit']=qs[_0xd8b7('0x2a')](_0x5eeb32['query'][_0xd8b7('0x2a')]);_0x53cf9c[_0xd8b7('0x28')]=qs[_0xd8b7('0x28')](_0x5eeb32['query']['offset']);}return _0x5644f2[_0xd8b7('0xb9')](_0x53cf9c);}})[_0xd8b7('0x35')](function(_0x48e426){if(_0x48e426){return _0x48e426?{'count':_0x142ffd,'rows':_0x48e426}:null;}})[_0xd8b7('0x35')](respondWithResult(_0xebb486,null))[_0xd8b7('0x23')](handleError(_0xebb486,null));}; \ No newline at end of file +var _0xbd48=['Contacts','ListId','messageId','subject','out','Interaction','Messages','verifySmtp','Sequelize','ValidationError','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','User','getAgents','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','redis','./mailAccount.socket','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','undefined','limit','count','offset','apply','reject','save','update','destroy','MailAccounts','UserProfileResource','stack','name','send','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','show','MailServerIn','Pause','find','body','params','describe','addDisposition','MailAccountId','create','getDispositions','Disposition','findAll','rows','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','key','email','isNil','active','description','cservice','cauthentication','cuser','password','cpassword','authentication','host','port','service','user','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','CmContact','Contact','fullname','internal','Tag','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','updatedAt','from','%s\x20<%s>','attachments','join','root','basename','auth','secure','SendMail','List\x20not\x20found'];(function(_0x2447a4,_0xe3b67){var _0x5f4c05=function(_0x2db276){while(--_0x2db276){_0x2447a4['push'](_0x2447a4['shift']());}};_0x5f4c05(++_0xe3b67);}(_0xbd48,0xd1));var _0x8bd4=function(_0x48c680,_0x21fc47){_0x48c680=_0x48c680-0x0;var _0x55d73d=_0xbd48[_0x48c680];return _0x55d73d;};'use strict';var emlformat=require(_0x8bd4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8bd4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8bd4('0x2'));var moment=require('moment');var BPromise=require(_0x8bd4('0x3'));var Mustache=require(_0x8bd4('0x4'));var util=require(_0x8bd4('0x5'));var path=require(_0x8bd4('0x6'));var sox=require(_0x8bd4('0x7'));var csv=require(_0x8bd4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8bd4('0x9'));var _=require(_0x8bd4('0xa'));var squel=require(_0x8bd4('0xb'));var crypto=require(_0x8bd4('0xc'));var jsforce=require(_0x8bd4('0xd'));var deskjs=require(_0x8bd4('0xe'));var toCsv=require(_0x8bd4('0x8'));var querystring=require(_0x8bd4('0xf'));var Papa=require(_0x8bd4('0x10'));var htmlToText=require(_0x8bd4('0x11'));var juice=require('juice');var Redis=require(_0x8bd4('0x12'));var authService=require(_0x8bd4('0x13'));var qs=require(_0x8bd4('0x14'));var as=require(_0x8bd4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bd4('0x16'))(_0x8bd4('0x17'));var utils=require(_0x8bd4('0x18'));var config=require(_0x8bd4('0x19'));var licenseUtil=require(_0x8bd4('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8bd4('0x1b')](config['redis'],{'host':_0x8bd4('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8bd4('0x1d')]));require(_0x8bd4('0x1e'))['register'](socket);var jayson=require(_0x8bd4('0x1f'));var client=jayson[_0x8bd4('0x20')][_0x8bd4('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x304f6c,_0x20e0c5,_0x51f80c,_0x2801ab){return new BPromise(function(_0x317c9f,_0x163088){var _0x250a84=_0x2801ab||client;return _0x250a84['request'](_0x304f6c,_0x51f80c)[_0x8bd4('0x22')](function(_0x121a31){logger[_0x8bd4('0x23')](_0x8bd4('0x24'),_0x20e0c5,_0x8bd4('0x25'));logger[_0x8bd4('0x26')](_0x8bd4('0x27'),_0x20e0c5,_0x8bd4('0x25'),JSON[_0x8bd4('0x28')](_0x121a31));if(_0x121a31[_0x8bd4('0x29')]){if(_0x121a31[_0x8bd4('0x29')][_0x8bd4('0x2a')]===0x1f4){logger[_0x8bd4('0x29')](_0x8bd4('0x24'),_0x20e0c5,_0x121a31[_0x8bd4('0x29')][_0x8bd4('0x2b')]);return _0x163088(_0x121a31[_0x8bd4('0x29')]['message']);}logger[_0x8bd4('0x29')](_0x8bd4('0x24'),_0x20e0c5,_0x121a31['error']['message']);return _0x317c9f(_0x121a31[_0x8bd4('0x29')]['message']);}else{logger[_0x8bd4('0x23')](_0x8bd4('0x24'),_0x20e0c5,_0x8bd4('0x25'));_0x317c9f(_0x121a31[_0x8bd4('0x2c')][_0x8bd4('0x2b')]);}})[_0x8bd4('0x2d')](function(_0x16aca3){logger[_0x8bd4('0x29')](_0x8bd4('0x24'),_0x20e0c5,_0x16aca3);_0x163088(_0x16aca3);});});}function respondWithStatusCode(_0x33016e,_0x20ee07){_0x20ee07=_0x20ee07||0xcc;return function(_0x594339){if(_0x594339){return _0x33016e['sendStatus'](_0x20ee07);}return _0x33016e[_0x8bd4('0x2e')](_0x20ee07)[_0x8bd4('0x2f')]();};}function respondWithResult(_0x4153a1,_0x29726d){_0x29726d=_0x29726d||0xc8;return function(_0x1e973b){if(_0x1e973b){return _0x4153a1[_0x8bd4('0x2e')](_0x29726d)[_0x8bd4('0x30')](_0x1e973b);}};}function respondWithFilteredResult(_0x309c2b,_0x23eb53){return function(_0x510296){if(_0x510296){var _0x2e3c47=typeof _0x23eb53['offset']===_0x8bd4('0x31')&&typeof _0x23eb53[_0x8bd4('0x32')]===_0x8bd4('0x31');var _0x22ecf3=_0x510296[_0x8bd4('0x33')];var _0x47212d=_0x2e3c47?0x0:_0x23eb53[_0x8bd4('0x34')];var _0x4c38c3=_0x2e3c47?_0x510296[_0x8bd4('0x33')]:_0x23eb53[_0x8bd4('0x34')]+_0x23eb53[_0x8bd4('0x32')];var _0x49c6bf;if(_0x4c38c3>=_0x22ecf3){_0x4c38c3=_0x22ecf3;_0x49c6bf=0xc8;}else{_0x49c6bf=0xce;}_0x309c2b['status'](_0x49c6bf);return _0x309c2b['set']('Content-Range',_0x47212d+'-'+_0x4c38c3+'/'+_0x22ecf3)[_0x8bd4('0x30')](_0x510296);}return null;};}function patchUpdates(_0x1ab152){return function(_0x1e97aa){try{jsonpatch[_0x8bd4('0x35')](_0x1e97aa,_0x1ab152,!![]);}catch(_0x3606db){return BPromise[_0x8bd4('0x36')](_0x3606db);}return _0x1e97aa[_0x8bd4('0x37')]();};}function saveUpdates(_0x19d666,_0x375b01){return function(_0x2d1f1c){if(_0x2d1f1c){return _0x2d1f1c[_0x8bd4('0x38')](_0x19d666)[_0x8bd4('0x22')](function(_0x1e1d20){return _0x1e1d20;});}return null;};}function removeEntity(_0x5463af,_0x431d1d){return function(_0x132297){if(_0x132297){return _0x132297[_0x8bd4('0x39')]()[_0x8bd4('0x22')](function(){var _0x3ada7a=_0x132297['get']({'plain':!![]});var _0x215737=_0x8bd4('0x3a');return db[_0x8bd4('0x3b')][_0x8bd4('0x39')]({'where':{'type':_0x215737,'resourceId':_0x3ada7a['id']}})[_0x8bd4('0x22')](function(){return _0x132297;});})[_0x8bd4('0x22')](function(){_0x5463af[_0x8bd4('0x2e')](0xcc)[_0x8bd4('0x2f')]();});}};}function handleEntityNotFound(_0x3fd9c0,_0x535a1a){return function(_0xeff460){if(!_0xeff460){_0x3fd9c0['sendStatus'](0x194);}return _0xeff460;};}function handleError(_0x4358c8,_0x2a36b){_0x2a36b=_0x2a36b||0x1f4;return function(_0x2a5cd5){logger[_0x8bd4('0x29')](_0x2a5cd5[_0x8bd4('0x3c')]);if(_0x2a5cd5[_0x8bd4('0x3d')]){delete _0x2a5cd5[_0x8bd4('0x3d')];}_0x4358c8[_0x8bd4('0x2e')](_0x2a36b)[_0x8bd4('0x3e')](_0x2a5cd5);};}exports['index']=function(_0x502778,_0x2d1f48){var _0x988d79={'include':[{'model':db['MailServerIn'],'as':_0x8bd4('0x3f')},{'model':db[_0x8bd4('0x40')],'as':_0x8bd4('0x41')},{'model':db['Pause'],'as':_0x8bd4('0x42')}]},_0xdda056={},_0x2504a6={'count':0x0,'rows':[]};var _0x2e239c=_[_0x8bd4('0x43')](db[_0x8bd4('0x44')][_0x8bd4('0x45')],function(_0x5981fe){return{'name':_0x5981fe['fieldName'],'type':_0x5981fe['type']['key']};});_0xdda056[_0x8bd4('0x46')]=_[_0x8bd4('0x43')](_0x2e239c,_0x8bd4('0x3d'));_0xdda056['query']=_[_0x8bd4('0x47')](_0x502778[_0x8bd4('0x48')]);_0xdda056['filters']=_[_0x8bd4('0x49')](_0xdda056[_0x8bd4('0x46')],_0xdda056[_0x8bd4('0x48')]);_0x988d79[_0x8bd4('0x4a')]=_[_0x8bd4('0x49')](_0xdda056['model'],qs[_0x8bd4('0x4b')](_0x502778[_0x8bd4('0x48')][_0x8bd4('0x4b')]));_0x988d79['attributes']=_0x988d79[_0x8bd4('0x4a')][_0x8bd4('0x4c')]?_0x988d79[_0x8bd4('0x4a')]:_0xdda056[_0x8bd4('0x46')];if(!_0x502778[_0x8bd4('0x48')][_0x8bd4('0x4d')](_0x8bd4('0x4e'))){_0x988d79['limit']=qs['limit'](_0x502778[_0x8bd4('0x48')][_0x8bd4('0x32')]);_0x988d79[_0x8bd4('0x34')]=qs[_0x8bd4('0x34')](_0x502778[_0x8bd4('0x48')]['offset']);}_0x988d79[_0x8bd4('0x4f')]=qs[_0x8bd4('0x50')](_0x502778[_0x8bd4('0x48')]['sort']);_0x988d79[_0x8bd4('0x51')]=qs[_0x8bd4('0x52')](_[_0x8bd4('0x53')](_0x502778[_0x8bd4('0x48')],_0xdda056[_0x8bd4('0x52')]),_0x2e239c);if(_0x502778[_0x8bd4('0x48')][_0x8bd4('0x54')]){_0x988d79[_0x8bd4('0x51')]=_[_0x8bd4('0x55')](_0x988d79['where'],{'$or':_[_0x8bd4('0x43')](_0x2e239c,function(_0x5a8c24){if(_0x5a8c24[_0x8bd4('0x56')]!==_0x8bd4('0x57')){var _0x19fa67={};_0x19fa67[_0x5a8c24['name']]={'$like':'%'+_0x502778[_0x8bd4('0x48')][_0x8bd4('0x54')]+'%'};return _0x19fa67;}})});}_0x988d79=_['merge']({},_0x988d79,_0x502778[_0x8bd4('0x58')]);var _0x24f684={'where':_0x988d79['where']};return db[_0x8bd4('0x44')][_0x8bd4('0x33')](_0x24f684)['then'](function(_0x1b9742){_0x2504a6['count']=_0x1b9742;if(_0x502778[_0x8bd4('0x48')][_0x8bd4('0x59')]){_0x988d79[_0x8bd4('0x5a')]=[{'all':!![]}];}return db[_0x8bd4('0x44')]['findAll'](_0x988d79);})[_0x8bd4('0x22')](function(_0x28528d){_0x2504a6['rows']=_0x28528d;return _0x2504a6;})['then'](respondWithFilteredResult(_0x2d1f48,_0x988d79))[_0x8bd4('0x2d')](handleError(_0x2d1f48,null));};exports[_0x8bd4('0x5b')]=function(_0x48a1a4,_0x7bd95e){var _0x35f61a={'raw':![],'where':{'id':_0x48a1a4['params']['id']},'include':[{'model':db[_0x8bd4('0x5c')],'as':'Imap'},{'model':db[_0x8bd4('0x40')],'as':_0x8bd4('0x41')},{'model':db[_0x8bd4('0x5d')],'as':_0x8bd4('0x42')}]},_0x4f4df9={};_0x4f4df9[_0x8bd4('0x46')]=_[_0x8bd4('0x47')](db[_0x8bd4('0x44')][_0x8bd4('0x45')]);_0x4f4df9[_0x8bd4('0x48')]=_[_0x8bd4('0x47')](_0x48a1a4['query']);_0x4f4df9[_0x8bd4('0x52')]=_[_0x8bd4('0x49')](_0x4f4df9['model'],_0x4f4df9['query']);_0x35f61a[_0x8bd4('0x4a')]=_['intersection'](_0x4f4df9['model'],qs['fields'](_0x48a1a4[_0x8bd4('0x48')]['fields']));_0x35f61a['attributes']=_0x35f61a[_0x8bd4('0x4a')][_0x8bd4('0x4c')]?_0x35f61a[_0x8bd4('0x4a')]:_0x4f4df9[_0x8bd4('0x46')];if(_0x48a1a4[_0x8bd4('0x48')][_0x8bd4('0x59')]){_0x35f61a[_0x8bd4('0x5a')]=[{'all':!![]}];}_0x35f61a=_['merge']({},_0x35f61a,_0x48a1a4[_0x8bd4('0x58')]);return db[_0x8bd4('0x44')][_0x8bd4('0x5e')](_0x35f61a)[_0x8bd4('0x22')](handleEntityNotFound(_0x7bd95e,null))[_0x8bd4('0x22')](respondWithResult(_0x7bd95e,null))['catch'](handleError(_0x7bd95e,null));};exports[_0x8bd4('0x38')]=function(_0x1ebc9a,_0x18a867){if(_0x1ebc9a[_0x8bd4('0x5f')]['id']){delete _0x1ebc9a[_0x8bd4('0x5f')]['id'];}return db[_0x8bd4('0x44')][_0x8bd4('0x5e')]({'where':{'id':_0x1ebc9a[_0x8bd4('0x60')]['id']},'include':[{'model':db[_0x8bd4('0x5c')],'as':_0x8bd4('0x3f')},{'model':db[_0x8bd4('0x40')],'as':_0x8bd4('0x41')},{'model':db[_0x8bd4('0x5d')],'as':_0x8bd4('0x42')}]})[_0x8bd4('0x22')](handleEntityNotFound(_0x18a867,null))[_0x8bd4('0x22')](saveUpdates(_0x1ebc9a[_0x8bd4('0x5f')],null))['then'](function(_0x3ba5b1){if(_0x3ba5b1&&_0x1ebc9a[_0x8bd4('0x5f')][_0x8bd4('0x3f')]){return db[_0x8bd4('0x5c')][_0x8bd4('0x38')](_0x1ebc9a[_0x8bd4('0x5f')]['Imap'],{'where':{'MailAccountId':_0x3ba5b1['id']}})['then'](function(){return _0x3ba5b1;});}return _0x3ba5b1;})['then'](function(_0x275941){if(_0x275941&&_0x1ebc9a[_0x8bd4('0x5f')]['Smtp']){return db[_0x8bd4('0x40')][_0x8bd4('0x38')](_0x1ebc9a[_0x8bd4('0x5f')][_0x8bd4('0x41')],{'where':{'MailAccountId':_0x275941['id']}})['then'](function(){return _0x275941;});}return _0x275941;})[_0x8bd4('0x22')](respondWithResult(_0x18a867,null))[_0x8bd4('0x2d')](handleError(_0x18a867,null));};exports[_0x8bd4('0x61')]=function(_0x1009ec,_0x2ff50c){return db['MailAccount']['describe']()[_0x8bd4('0x22')](respondWithResult(_0x2ff50c,null))[_0x8bd4('0x2d')](handleError(_0x2ff50c,null));};exports[_0x8bd4('0x62')]=function(_0x19e85e,_0xc44480,_0x4a5865){if(_0x19e85e[_0x8bd4('0x5f')]['id']){delete _0x19e85e[_0x8bd4('0x5f')]['id'];}return db[_0x8bd4('0x44')][_0x8bd4('0x5e')]({'where':{'id':_0x19e85e[_0x8bd4('0x60')]['id']}})['then'](handleEntityNotFound(_0xc44480,null))[_0x8bd4('0x22')](function(_0xb6f732){if(_0xb6f732){_0x19e85e['body'][_0x8bd4('0x63')]=_0xb6f732['id'];return db['Disposition'][_0x8bd4('0x64')](_0x19e85e['body']);}})[_0x8bd4('0x22')](respondWithResult(_0xc44480,null))[_0x8bd4('0x2d')](handleError(_0xc44480,null));};exports[_0x8bd4('0x65')]=function(_0x307242,_0x515bb9,_0x403439){var _0xe75c32={'raw':![],'where':{}};var _0xd47dbc={};var _0x13f634={'count':0x0,'rows':[]};return db[_0x8bd4('0x44')]['findOne']({'where':{'id':_0x307242[_0x8bd4('0x60')]['id']}})[_0x8bd4('0x22')](handleEntityNotFound(_0x515bb9,null))[_0x8bd4('0x22')](function(_0x28c4e2){if(_0x28c4e2){_0xd47dbc[_0x8bd4('0x46')]=_['keys'](db[_0x8bd4('0x66')]['rawAttributes']);_0xd47dbc[_0x8bd4('0x48')]=_['keys'](_0x307242['query']);_0xd47dbc[_0x8bd4('0x52')]=_['intersection'](_0xd47dbc[_0x8bd4('0x46')],_0xd47dbc[_0x8bd4('0x48')]);_0xe75c32[_0x8bd4('0x4a')]=_[_0x8bd4('0x49')](_0xd47dbc[_0x8bd4('0x46')],qs['fields'](_0x307242['query'][_0x8bd4('0x4b')]));_0xe75c32['attributes']=_0xe75c32[_0x8bd4('0x4a')]['length']?_0xe75c32[_0x8bd4('0x4a')]:_0xd47dbc[_0x8bd4('0x46')];if(!_0x307242[_0x8bd4('0x48')][_0x8bd4('0x4d')](_0x8bd4('0x4e'))){_0xe75c32['limit']=qs[_0x8bd4('0x32')](_0x307242[_0x8bd4('0x48')][_0x8bd4('0x32')]);_0xe75c32[_0x8bd4('0x34')]=qs[_0x8bd4('0x34')](_0x307242['query'][_0x8bd4('0x34')]);}_0xe75c32[_0x8bd4('0x4f')]=qs['sort'](_0x307242[_0x8bd4('0x48')][_0x8bd4('0x50')]);_0xe75c32['where']=qs[_0x8bd4('0x52')](_['pick'](_0x307242[_0x8bd4('0x48')],_0xd47dbc[_0x8bd4('0x52')]));_0xe75c32[_0x8bd4('0x51')][_0x8bd4('0x63')]=_0x28c4e2['id'];if(_0x307242['query'][_0x8bd4('0x54')]){_0xe75c32[_0x8bd4('0x51')]=_[_0x8bd4('0x55')](_0xe75c32[_0x8bd4('0x51')],{'$or':_['map'](_0xe75c32[_0x8bd4('0x4a')],function(_0x141fb0){var _0xf74db8={};_0xf74db8[_0x141fb0]={'$like':'%'+_0x307242[_0x8bd4('0x48')]['filter']+'%'};return _0xf74db8;})});}_0xe75c32=_[_0x8bd4('0x55')]({},_0xe75c32,_0x307242[_0x8bd4('0x58')]);return db[_0x8bd4('0x66')][_0x8bd4('0x33')]({'where':_0xe75c32['where']})[_0x8bd4('0x22')](function(_0xaf78aa){_0x13f634[_0x8bd4('0x33')]=_0xaf78aa;if(_0x307242[_0x8bd4('0x48')][_0x8bd4('0x59')]){_0xe75c32[_0x8bd4('0x5a')]=[{'all':!![]}];}return db[_0x8bd4('0x66')][_0x8bd4('0x67')](_0xe75c32);})[_0x8bd4('0x22')](function(_0x5b359a){_0x13f634[_0x8bd4('0x68')]=_0x5b359a;return _0x13f634;});}})[_0x8bd4('0x22')](respondWithFilteredResult(_0x515bb9,_0xe75c32))[_0x8bd4('0x2d')](handleError(_0x515bb9,null));};exports[_0x8bd4('0x69')]=function(_0x433589,_0x5b9b07,_0x45bd06){return db[_0x8bd4('0x44')]['find']({'where':{'id':_0x433589[_0x8bd4('0x60')]['id']}})[_0x8bd4('0x22')](handleEntityNotFound(_0x5b9b07,null))['then'](function(_0x18afe9){if(_0x18afe9){return _0x18afe9[_0x8bd4('0x69')](_0x433589['query'][_0x8bd4('0x6a')]);}})['then'](respondWithStatusCode(_0x5b9b07,null))[_0x8bd4('0x2d')](handleError(_0x5b9b07,null));};exports['addAnswer']=function(_0x1f30f4,_0x475237,_0x3cb2c4){if(_0x1f30f4['body']['id']){delete _0x1f30f4[_0x8bd4('0x5f')]['id'];}return db[_0x8bd4('0x44')][_0x8bd4('0x5e')]({'where':{'id':_0x1f30f4['params']['id']}})[_0x8bd4('0x22')](handleEntityNotFound(_0x475237,null))['then'](function(_0x48ab61){if(_0x48ab61){_0x1f30f4[_0x8bd4('0x5f')][_0x8bd4('0x63')]=_0x48ab61['id'];return db[_0x8bd4('0x6b')][_0x8bd4('0x64')](_0x1f30f4[_0x8bd4('0x5f')]);}})['then'](respondWithResult(_0x475237,null))['catch'](handleError(_0x475237,null));};exports[_0x8bd4('0x6c')]=function(_0x552e14,_0xeebdd1,_0x486cda){var _0x4f413a={'raw':![],'where':{}};var _0x30b6ec={};var _0x5a8ea0={'count':0x0,'rows':[]};return db[_0x8bd4('0x44')][_0x8bd4('0x6d')]({'where':{'id':_0x552e14['params']['id']}})[_0x8bd4('0x22')](handleEntityNotFound(_0xeebdd1,null))[_0x8bd4('0x22')](function(_0x16e25b){if(_0x16e25b){_0x30b6ec[_0x8bd4('0x46')]=_[_0x8bd4('0x47')](db['CannedAnswer'][_0x8bd4('0x45')]);_0x30b6ec[_0x8bd4('0x48')]=_[_0x8bd4('0x47')](_0x552e14['query']);_0x30b6ec[_0x8bd4('0x52')]=_[_0x8bd4('0x49')](_0x30b6ec['model'],_0x30b6ec['query']);_0x4f413a[_0x8bd4('0x4a')]=_[_0x8bd4('0x49')](_0x30b6ec['model'],qs['fields'](_0x552e14[_0x8bd4('0x48')]['fields']));_0x4f413a[_0x8bd4('0x4a')]=_0x4f413a[_0x8bd4('0x4a')][_0x8bd4('0x4c')]?_0x4f413a[_0x8bd4('0x4a')]:_0x30b6ec['model'];if(!_0x552e14['query']['hasOwnProperty'](_0x8bd4('0x4e'))){_0x4f413a['limit']=qs[_0x8bd4('0x32')](_0x552e14['query'][_0x8bd4('0x32')]);_0x4f413a[_0x8bd4('0x34')]=qs[_0x8bd4('0x34')](_0x552e14[_0x8bd4('0x48')][_0x8bd4('0x34')]);}_0x4f413a[_0x8bd4('0x4f')]=qs[_0x8bd4('0x50')](_0x552e14[_0x8bd4('0x48')]['sort']);_0x4f413a[_0x8bd4('0x51')]=qs[_0x8bd4('0x52')](_[_0x8bd4('0x53')](_0x552e14[_0x8bd4('0x48')],_0x30b6ec[_0x8bd4('0x52')]));_0x4f413a[_0x8bd4('0x51')]['MailAccountId']=_0x16e25b['id'];if(_0x552e14[_0x8bd4('0x48')]['filter']){_0x4f413a[_0x8bd4('0x51')]=_['merge'](_0x4f413a[_0x8bd4('0x51')],{'$or':_['map'](_0x4f413a[_0x8bd4('0x4a')],function(_0x538870){var _0x2d2464={};_0x2d2464[_0x538870]={'$like':'%'+_0x552e14['query'][_0x8bd4('0x54')]+'%'};return _0x2d2464;})});}_0x4f413a=_[_0x8bd4('0x55')]({},_0x4f413a,_0x552e14[_0x8bd4('0x58')]);return db[_0x8bd4('0x6b')][_0x8bd4('0x33')]({'where':_0x4f413a[_0x8bd4('0x51')]})['then'](function(_0x159599){_0x5a8ea0[_0x8bd4('0x33')]=_0x159599;if(_0x552e14[_0x8bd4('0x48')][_0x8bd4('0x59')]){_0x4f413a[_0x8bd4('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8bd4('0x67')](_0x4f413a);})[_0x8bd4('0x22')](function(_0x54f203){_0x5a8ea0[_0x8bd4('0x68')]=_0x54f203;return _0x5a8ea0;});}})['then'](respondWithFilteredResult(_0xeebdd1,_0x4f413a))['catch'](handleError(_0xeebdd1,null));};exports[_0x8bd4('0x6e')]=function(_0x2e6ce0,_0xa6f5f2,_0x2204f9){return db[_0x8bd4('0x44')][_0x8bd4('0x5e')]({'where':{'id':_0x2e6ce0[_0x8bd4('0x60')]['id']}})['then'](handleEntityNotFound(_0xa6f5f2,null))[_0x8bd4('0x22')](function(_0x55a380){if(_0x55a380){return _0x55a380[_0x8bd4('0x6e')](_0x2e6ce0[_0x8bd4('0x48')][_0x8bd4('0x6a')]);}})[_0x8bd4('0x22')](respondWithStatusCode(_0xa6f5f2,null))[_0x8bd4('0x2d')](handleError(_0xa6f5f2,null));};exports[_0x8bd4('0x64')]=function(_0x56dee2,_0x5a94c7){var _0x4dcd4b={'name':_0x56dee2[_0x8bd4('0x5f')]['name'],'key':_0x56dee2['body'][_0x8bd4('0x6f')],'email':_0x56dee2['body'][_0x8bd4('0x70')],'ListId':_0x56dee2[_0x8bd4('0x5f')]['ListId'],'active':!_[_0x8bd4('0x71')](_0x56dee2['body'][_0x8bd4('0x72')])?_0x56dee2[_0x8bd4('0x5f')][_0x8bd4('0x72')]:!![],'description':_0x56dee2[_0x8bd4('0x5f')][_0x8bd4('0x73')]||null,'Imap':{},'Smtp':{}};if(_[_0x8bd4('0x71')](_0x56dee2[_0x8bd4('0x5f')][_0x8bd4('0x74')])){if(_0x56dee2[_0x8bd4('0x5f')][_0x8bd4('0x75')]){_0x4dcd4b[_0x8bd4('0x3f')]['user']=_0x4dcd4b['Smtp']['user']=_0x56dee2['body'][_0x8bd4('0x76')];_0x4dcd4b[_0x8bd4('0x3f')][_0x8bd4('0x77')]=_0x4dcd4b[_0x8bd4('0x41')]['pass']=_0x56dee2[_0x8bd4('0x5f')][_0x8bd4('0x78')];}else{_0x4dcd4b[_0x8bd4('0x3f')][_0x8bd4('0x79')]=_0x4dcd4b['Smtp'][_0x8bd4('0x79')]=![];}_0x4dcd4b[_0x8bd4('0x3f')][_0x8bd4('0x7a')]=_0x56dee2[_0x8bd4('0x5f')][_0x8bd4('0x3f')][_0x8bd4('0x7a')];_0x4dcd4b['Imap'][_0x8bd4('0x7b')]=_0x56dee2[_0x8bd4('0x5f')][_0x8bd4('0x3f')][_0x8bd4('0x7b')];_0x4dcd4b[_0x8bd4('0x41')][_0x8bd4('0x7a')]=_0x56dee2[_0x8bd4('0x5f')][_0x8bd4('0x41')][_0x8bd4('0x7a')];_0x4dcd4b[_0x8bd4('0x41')][_0x8bd4('0x7b')]=_0x56dee2[_0x8bd4('0x5f')]['Smtp'][_0x8bd4('0x7b')];}else{_0x4dcd4b[_0x8bd4('0x3f')][_0x8bd4('0x7c')]=_0x4dcd4b[_0x8bd4('0x41')][_0x8bd4('0x7c')]=_0x56dee2[_0x8bd4('0x5f')][_0x8bd4('0x74')];_0x4dcd4b['Imap'][_0x8bd4('0x7d')]=_0x4dcd4b[_0x8bd4('0x41')]['user']=_0x56dee2[_0x8bd4('0x5f')][_0x8bd4('0x76')];_0x4dcd4b[_0x8bd4('0x3f')][_0x8bd4('0x77')]=_0x4dcd4b[_0x8bd4('0x41')][_0x8bd4('0x7e')]=_0x56dee2[_0x8bd4('0x5f')][_0x8bd4('0x78')];}return db[_0x8bd4('0x44')][_0x8bd4('0x64')](_0x4dcd4b,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x8bd4('0x3f')}]})[_0x8bd4('0x22')](function(_0x187e24){var _0x2971be=_0x56dee2[_0x8bd4('0x7d')]['get']({'plain':!![]});if(!_0x2971be)throw new Error(_0x8bd4('0x7f'));if(_0x2971be[_0x8bd4('0x80')]===_0x8bd4('0x7d')){var _0x486b78=_0x187e24[_0x8bd4('0x81')]({'plain':!![]});return db[_0x8bd4('0x82')][_0x8bd4('0x5e')]({'where':{'name':'MailAccounts','userProfileId':_0x2971be['userProfileId']},'raw':!![]})[_0x8bd4('0x22')](function(_0x11d3bc){if(_0x11d3bc&&_0x11d3bc[_0x8bd4('0x83')]===0x0){return db[_0x8bd4('0x3b')][_0x8bd4('0x64')]({'name':_0x486b78[_0x8bd4('0x3d')],'resourceId':_0x486b78['id'],'type':_0x11d3bc['name'],'sectionId':_0x11d3bc['id']},{})['then'](function(){return _0x187e24;});}else{return _0x187e24;}})[_0x8bd4('0x2d')](function(_0x26d0c6){logger[_0x8bd4('0x29')](_0x8bd4('0x84'),_0x26d0c6);throw _0x26d0c6;});}return _0x187e24;})[_0x8bd4('0x22')](respondWithResult(_0x5a94c7,0xc9))[_0x8bd4('0x2d')](handleError(_0x5a94c7,null));};exports[_0x8bd4('0x85')]=function(_0x55939e,_0x4468f4,_0x5b9969){return db[_0x8bd4('0x44')]['findOne']({'where':{'id':_0x55939e[_0x8bd4('0x60')]['id']}})[_0x8bd4('0x22')](handleEntityNotFound(_0x4468f4,null))[_0x8bd4('0x22')](function(_0x487e43){if(_0x487e43){return _0x487e43[_0x8bd4('0x85')]();}return null;})[_0x8bd4('0x22')](respondWithResult(_0x4468f4,null))[_0x8bd4('0x2d')](handleError(_0x4468f4,null));};exports[_0x8bd4('0x86')]=function(_0x304ee4,_0x4678e9,_0x33701c){if(_0x304ee4[_0x8bd4('0x5f')]['id']){delete _0x304ee4[_0x8bd4('0x5f')]['id'];}return db[_0x8bd4('0x44')][_0x8bd4('0x5e')]({'where':{'id':_0x304ee4[_0x8bd4('0x60')]['id']}})['then'](handleEntityNotFound(_0x4678e9,null))[_0x8bd4('0x22')](function(_0x3587b2){if(_0x3587b2){_0x304ee4[_0x8bd4('0x5f')]['MailAccountId']=_0x3587b2['id'];return db[_0x8bd4('0x5c')]['create'](_0x304ee4[_0x8bd4('0x5f')]);}})[_0x8bd4('0x22')](respondWithResult(_0x4678e9,null))['catch'](handleError(_0x4678e9,null));};exports['removeImap']=function(_0x596d08,_0x19ecc0,_0x3b2d30){return db['MailAccount'][_0x8bd4('0x6d')]({'where':{'id':_0x596d08['params']['id']}})[_0x8bd4('0x22')](handleEntityNotFound(_0x19ecc0,null))[_0x8bd4('0x22')](function(_0x445daf){if(_0x445daf){return _0x445daf[_0x8bd4('0x87')](null);}return null;})['then'](respondWithStatusCode(_0x19ecc0,null))['catch'](handleError(_0x19ecc0,null));};exports[_0x8bd4('0x88')]=function(_0x4b5964,_0x11e9a8,_0x30210d){return db[_0x8bd4('0x44')][_0x8bd4('0x6d')]({'where':{'id':_0x4b5964[_0x8bd4('0x60')]['id']}})['then'](handleEntityNotFound(_0x11e9a8,null))[_0x8bd4('0x22')](function(_0x12e938){if(_0x12e938){return _0x12e938[_0x8bd4('0x88')]();}return null;})[_0x8bd4('0x22')](respondWithResult(_0x11e9a8,null))[_0x8bd4('0x2d')](handleError(_0x11e9a8,null));};exports[_0x8bd4('0x89')]=function(_0x3b2b6f,_0x52662f,_0x4eff46){if(_0x3b2b6f[_0x8bd4('0x5f')]['id']){delete _0x3b2b6f['body']['id'];}return db['MailAccount'][_0x8bd4('0x5e')]({'where':{'id':_0x3b2b6f[_0x8bd4('0x60')]['id']}})['then'](handleEntityNotFound(_0x52662f,null))['then'](function(_0x398e56){if(_0x398e56){_0x3b2b6f[_0x8bd4('0x5f')][_0x8bd4('0x63')]=_0x398e56['id'];return db[_0x8bd4('0x40')][_0x8bd4('0x64')](_0x3b2b6f[_0x8bd4('0x5f')]);}})[_0x8bd4('0x22')](respondWithResult(_0x52662f,null))[_0x8bd4('0x2d')](handleError(_0x52662f,null));};exports[_0x8bd4('0x8a')]=function(_0x15b85b,_0xb1f255,_0x4fb02d){return db[_0x8bd4('0x44')][_0x8bd4('0x6d')]({'where':{'id':_0x15b85b[_0x8bd4('0x60')]['id']}})['then'](handleEntityNotFound(_0xb1f255,null))[_0x8bd4('0x22')](function(_0x2de577){if(_0x2de577){return _0x2de577['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0xb1f255,null))[_0x8bd4('0x2d')](handleError(_0xb1f255,null));};exports[_0x8bd4('0x8b')]=function(_0x28ff44,_0x4f89a1,_0xbec873){return db['MailInteraction']['find']({'where':{'id':_0x28ff44[_0x8bd4('0x60')]['id']}})[_0x8bd4('0x22')](handleEntityNotFound(_0x4f89a1,null))[_0x8bd4('0x22')](function(_0x1e590b){if(_0x1e590b){return _0x1e590b[_0x8bd4('0x8b')](_0x28ff44[_0x8bd4('0x5f')][_0x8bd4('0x6a')],_['omit'](_0x28ff44[_0x8bd4('0x5f')],[_0x8bd4('0x6a'),'id'])||{});}})[_0x8bd4('0x22')](respondWithResult(_0x4f89a1,null))[_0x8bd4('0x2d')](handleError(_0x4f89a1,null));};exports['getInteractions']=function(_0x546654,_0x3b0a17,_0x367c07){var _0x25ec04={'raw':![],'where':{}};var _0x7951ad={};var _0x58b5c9={'count':0x0,'rows':[]};return db[_0x8bd4('0x44')][_0x8bd4('0x6d')]({'where':{'id':_0x546654[_0x8bd4('0x60')]['id']}})[_0x8bd4('0x22')](handleEntityNotFound(_0x3b0a17,null))[_0x8bd4('0x22')](function(_0x3ee195){if(_0x3ee195){_0x7951ad[_0x8bd4('0x46')]=_[_0x8bd4('0x47')](db[_0x8bd4('0x8c')]['rawAttributes']);_0x7951ad['query']=_[_0x8bd4('0x47')](_0x546654[_0x8bd4('0x48')]);_0x7951ad[_0x8bd4('0x52')]=_[_0x8bd4('0x49')](_0x7951ad['model'],_0x7951ad[_0x8bd4('0x48')]);_0x25ec04[_0x8bd4('0x4a')]=_[_0x8bd4('0x49')](_0x7951ad['model'],qs[_0x8bd4('0x4b')](_0x546654[_0x8bd4('0x48')][_0x8bd4('0x4b')]));_0x25ec04[_0x8bd4('0x4a')]=_0x25ec04[_0x8bd4('0x4a')][_0x8bd4('0x4c')]?_0x25ec04['attributes']:_0x7951ad[_0x8bd4('0x46')];if(!_0x546654['query']['hasOwnProperty']('nolimit')){_0x25ec04[_0x8bd4('0x32')]=qs[_0x8bd4('0x32')](_0x546654['query'][_0x8bd4('0x32')]);_0x25ec04['offset']=qs['offset'](_0x546654[_0x8bd4('0x48')]['offset']);}_0x25ec04[_0x8bd4('0x4f')]=qs[_0x8bd4('0x50')](_0x546654[_0x8bd4('0x48')][_0x8bd4('0x50')]);_0x25ec04[_0x8bd4('0x51')]=qs[_0x8bd4('0x52')](_[_0x8bd4('0x53')](_0x546654[_0x8bd4('0x48')],_0x7951ad[_0x8bd4('0x52')]));_0x25ec04[_0x8bd4('0x51')][_0x8bd4('0x63')]=_0x3ee195['id'];if(_0x546654[_0x8bd4('0x48')][_0x8bd4('0x54')]){_0x25ec04[_0x8bd4('0x51')]=_[_0x8bd4('0x55')](_0x25ec04[_0x8bd4('0x51')],{'$or':_[_0x8bd4('0x43')](_0x25ec04[_0x8bd4('0x4a')],function(_0x967e03){var _0x2f714d={};_0x2f714d[_0x967e03]={'$like':'%'+_0x546654[_0x8bd4('0x48')][_0x8bd4('0x54')]+'%'};return _0x2f714d;})});}_0x25ec04=_[_0x8bd4('0x55')]({},_0x25ec04,_0x546654[_0x8bd4('0x58')]);return db[_0x8bd4('0x8c')][_0x8bd4('0x33')]({'where':_0x25ec04[_0x8bd4('0x51')]})[_0x8bd4('0x22')](function(_0x1dc07e){_0x58b5c9['count']=_0x1dc07e;if(_0x546654['query']['includeAll']){_0x25ec04[_0x8bd4('0x5a')]=[{'model':db[_0x8bd4('0x8d')],'as':_0x8bd4('0x8e'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x8bd4('0x3d'),_0x8bd4('0x8f'),_0x8bd4('0x90')],'required':![]},{'model':db[_0x8bd4('0x91')],'as':'Tags','attributes':['id','name','color'],'where':_0x546654[_0x8bd4('0x48')][_0x8bd4('0x92')]?{'id':_0x546654[_0x8bd4('0x48')][_0x8bd4('0x92')]}:undefined,'required':_0x546654[_0x8bd4('0x48')][_0x8bd4('0x92')]?!![]:![]}];}return db[_0x8bd4('0x8c')][_0x8bd4('0x67')](_0x25ec04);})[_0x8bd4('0x22')](function(_0x193a14){_0x58b5c9[_0x8bd4('0x68')]=_0x193a14;return _0x58b5c9;});}})[_0x8bd4('0x22')](respondWithFilteredResult(_0x3b0a17,_0x25ec04))[_0x8bd4('0x2d')](handleError(_0x3b0a17,null));};exports[_0x8bd4('0x93')]=function(_0x230bed,_0x3aae7a,_0x1e0a4a){return db[_0x8bd4('0x44')]['findOne']({'where':{'id':_0x230bed[_0x8bd4('0x60')]['id']}})['then'](handleEntityNotFound(_0x3aae7a,null))[_0x8bd4('0x22')](function(_0x34c89e){if(_0x34c89e){return db[_0x8bd4('0x94')][_0x8bd4('0x95')](function(_0x1c5e24){return db[_0x8bd4('0x96')][_0x8bd4('0x39')]({'where':{'MailAccountId':_0x230bed[_0x8bd4('0x60')]['id']},'transaction':_0x1c5e24})[_0x8bd4('0x22')](function(_0x3957b8){var _0x45d864=_[_0x8bd4('0x43')](_0x230bed[_0x8bd4('0x5f')],function(_0x25163f){_0x25163f[_0x8bd4('0x63')]=_0x230bed[_0x8bd4('0x60')]['id'];return _0x25163f;});return db['MailApplication'][_0x8bd4('0x97')](_0x45d864,{'transaction':_0x1c5e24});});})[_0x8bd4('0x22')](function(){return db[_0x8bd4('0x96')]['findAndCountAll']({'where':{'MailAccountId':_0x230bed[_0x8bd4('0x60')]['id']},'order':'priority'});});}})[_0x8bd4('0x22')](respondWithResult(_0x3aae7a,null))[_0x8bd4('0x2d')](handleError(_0x3aae7a,null));};exports['getApplications']=function(_0x5c9f0e,_0x1fcbdb,_0x5d5201){var _0xc3bcb1={};var _0x3d2b1c={};var _0xc23dea;var _0x3f3e45;return db[_0x8bd4('0x44')][_0x8bd4('0x6d')]({'where':{'id':_0x5c9f0e[_0x8bd4('0x60')]['id']}})['then'](handleEntityNotFound(_0x1fcbdb,null))[_0x8bd4('0x22')](function(_0x2273c5){if(_0x2273c5){_0xc23dea=_0x2273c5;_0x3d2b1c[_0x8bd4('0x46')]=_['keys'](db[_0x8bd4('0x96')]['rawAttributes']);_0x3d2b1c[_0x8bd4('0x48')]=_['keys'](_0x5c9f0e['query']);_0x3d2b1c['filters']=_['intersection'](_0x3d2b1c[_0x8bd4('0x46')],_0x3d2b1c[_0x8bd4('0x48')]);_0xc3bcb1[_0x8bd4('0x4a')]=_['intersection'](_0x3d2b1c[_0x8bd4('0x46')],qs[_0x8bd4('0x4b')](_0x5c9f0e[_0x8bd4('0x48')]['fields']));_0xc3bcb1[_0x8bd4('0x4a')]=_0xc3bcb1[_0x8bd4('0x4a')][_0x8bd4('0x4c')]?_0xc3bcb1[_0x8bd4('0x4a')]:_0x3d2b1c[_0x8bd4('0x46')];_0xc3bcb1[_0x8bd4('0x4f')]=qs[_0x8bd4('0x50')](_0x5c9f0e[_0x8bd4('0x48')][_0x8bd4('0x50')]);_0xc3bcb1[_0x8bd4('0x51')]=qs[_0x8bd4('0x52')](_[_0x8bd4('0x53')](_0x5c9f0e['query'],_0x3d2b1c[_0x8bd4('0x52')]));if(_0x5c9f0e[_0x8bd4('0x48')][_0x8bd4('0x54')]){_0xc3bcb1['where']=_[_0x8bd4('0x55')](_0xc3bcb1[_0x8bd4('0x51')],{'$or':_['map'](_0xc3bcb1[_0x8bd4('0x4a')],function(_0x5d035e){var _0x422892={};_0x422892[_0x5d035e]={'$like':'%'+_0x5c9f0e[_0x8bd4('0x48')][_0x8bd4('0x54')]+'%'};return _0x422892;})});}_0xc3bcb1=_[_0x8bd4('0x55')]({},_0xc3bcb1,_0x5c9f0e[_0x8bd4('0x58')]);return _0xc23dea[_0x8bd4('0x98')](_0xc3bcb1);}})[_0x8bd4('0x22')](function(_0x1ee13b){if(_0x1ee13b){_0x3f3e45=_0x1ee13b[_0x8bd4('0x4c')];if(!_0x5c9f0e['query'][_0x8bd4('0x4d')](_0x8bd4('0x4e'))){_0xc3bcb1[_0x8bd4('0x32')]=qs[_0x8bd4('0x32')](_0x5c9f0e[_0x8bd4('0x48')][_0x8bd4('0x32')]);_0xc3bcb1[_0x8bd4('0x34')]=qs['offset'](_0x5c9f0e['query'][_0x8bd4('0x34')]);}return _0xc23dea[_0x8bd4('0x98')](_0xc3bcb1);}})[_0x8bd4('0x22')](function(_0x16fbd6){if(_0x16fbd6){return _0x16fbd6?{'count':_0x3f3e45,'rows':_0x16fbd6}:null;}})['then'](respondWithResult(_0x1fcbdb,null))[_0x8bd4('0x2d')](handleError(_0x1fcbdb,null));};exports[_0x8bd4('0x99')]=function(_0xfe282f,_0x5556c4,_0x56960b){var _0x25cc9f={'raw':!![],'where':{}};var _0x3895ed={};var _0x256f10={'count':0x0,'rows':[]};return db['MailAccount'][_0x8bd4('0x6d')]({'where':{'id':_0xfe282f[_0x8bd4('0x60')]['id']}})[_0x8bd4('0x22')](handleEntityNotFound(_0x5556c4,null))['then'](function(_0x42c2bb){if(_0x42c2bb){_0x3895ed[_0x8bd4('0x46')]=_[_0x8bd4('0x47')](db[_0x8bd4('0x9a')][_0x8bd4('0x45')]);_0x3895ed[_0x8bd4('0x48')]=_[_0x8bd4('0x47')](_0xfe282f[_0x8bd4('0x48')]);_0x3895ed['filters']=_['intersection'](_0x3895ed[_0x8bd4('0x46')],_0x3895ed[_0x8bd4('0x48')]);_0x25cc9f[_0x8bd4('0x4a')]=_['intersection'](_0x3895ed[_0x8bd4('0x46')],qs[_0x8bd4('0x4b')](_0xfe282f[_0x8bd4('0x48')][_0x8bd4('0x4b')]));_0x25cc9f[_0x8bd4('0x4a')]=_0x25cc9f[_0x8bd4('0x4a')][_0x8bd4('0x4c')]?_0x25cc9f[_0x8bd4('0x4a')]:_0x3895ed['model'];if(!_0xfe282f[_0x8bd4('0x48')][_0x8bd4('0x4d')](_0x8bd4('0x4e'))){_0x25cc9f[_0x8bd4('0x32')]=qs[_0x8bd4('0x32')](_0xfe282f[_0x8bd4('0x48')]['limit']);_0x25cc9f[_0x8bd4('0x34')]=qs[_0x8bd4('0x34')](_0xfe282f[_0x8bd4('0x48')][_0x8bd4('0x34')]);}_0x25cc9f[_0x8bd4('0x4f')]=qs[_0x8bd4('0x50')](_0xfe282f[_0x8bd4('0x48')][_0x8bd4('0x50')]);_0x25cc9f[_0x8bd4('0x51')]=qs[_0x8bd4('0x52')](_[_0x8bd4('0x53')](_0xfe282f[_0x8bd4('0x48')],_0x3895ed['filters']));_0x25cc9f[_0x8bd4('0x51')][_0x8bd4('0x63')]=_0x42c2bb['id'];if(_0xfe282f[_0x8bd4('0x48')][_0x8bd4('0x54')]){_0x25cc9f[_0x8bd4('0x51')]=_['merge'](_0x25cc9f[_0x8bd4('0x51')],{'$or':_[_0x8bd4('0x43')](_0x25cc9f[_0x8bd4('0x4a')],function(_0xd2f2f3){var _0x593699={};_0x593699[_0xd2f2f3]={'$like':'%'+_0xfe282f[_0x8bd4('0x48')][_0x8bd4('0x54')]+'%'};return _0x593699;})});}if(_0xfe282f[_0x8bd4('0x48')][_0x8bd4('0x9b')]){var _0x1aaf71=_0xfe282f[_0x8bd4('0x48')]['$gte'][_0x8bd4('0x9c')](',');var _0x2dfa38={};_0x2dfa38[_0x1aaf71[0x0]]={'$gte':moment(_0x1aaf71[0x1])[_0x8bd4('0x9d')](_0x8bd4('0x9e'))};_0x25cc9f[_0x8bd4('0x51')]=_[_0x8bd4('0x55')](_0x25cc9f['where'],_0x2dfa38);}_0x25cc9f=_[_0x8bd4('0x55')]({},_0x25cc9f,_0xfe282f[_0x8bd4('0x58')]);return db[_0x8bd4('0x9a')]['count']({'where':_0x25cc9f[_0x8bd4('0x51')]})['then'](function(_0x32c9ed){_0x256f10[_0x8bd4('0x33')]=_0x32c9ed;if(_0xfe282f[_0x8bd4('0x48')][_0x8bd4('0x59')]){_0x25cc9f[_0x8bd4('0x5a')]=[{'all':!![]}];}return db[_0x8bd4('0x9a')][_0x8bd4('0x67')](_0x25cc9f);})[_0x8bd4('0x22')](function(_0x4db221){if(_0xfe282f[_0x8bd4('0x48')][_0x8bd4('0x9f')]==='true'){for(var _0x1062c4=0x0;_0x1062c4<_0x4db221['length'];_0x1062c4++){_0x4db221[_0x1062c4]['body']=juice(_0x4db221[_0x1062c4][_0x8bd4('0x5f')]);}}_0x256f10[_0x8bd4('0x68')]=_0x4db221;return _0x256f10;});}})[_0x8bd4('0x22')](respondWithFilteredResult(_0x5556c4,_0x25cc9f))[_0x8bd4('0x2d')](handleError(_0x5556c4,null));};exports[_0x8bd4('0x3e')]=function(_0x2c6f18,_0x590362,_0xc7faeb){var _0x2572a8,_0x320c0a={},_0x88e7de;if(_0x2c6f18[_0x8bd4('0x5f')]['to']){_0x88e7de=_0x2c6f18[_0x8bd4('0x5f')]['to'][_0x8bd4('0x9c')](',')[0x0];}return db[_0x8bd4('0x44')][_0x8bd4('0x5e')]({'where':{'id':_0x2c6f18[_0x8bd4('0x60')]['id']},'include':[{'model':db[_0x8bd4('0xa0')],'as':_0x8bd4('0xa1'),'include':[{'model':db[_0x8bd4('0x8d')],'as':'Contacts','where':{'email':_0x88e7de},'limit':0x1,'order':[[_0x8bd4('0xa2'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x8bd4('0x22')](handleEntityNotFound(_0x590362,null))[_0x8bd4('0x22')](function(_0x44fb0c){if(_0x44fb0c){_0x2572a8=_0x44fb0c;if(_0x44fb0c[_0x8bd4('0x41')]){if(_[_0x8bd4('0x71')](_0x2c6f18['body'][_0x8bd4('0xa3')])){_0x2c6f18['body'][_0x8bd4('0xa3')]=util[_0x8bd4('0x9d')](_0x8bd4('0xa4'),_0x44fb0c[_0x8bd4('0x3d')],_0x44fb0c['email']||_0x44fb0c[_0x8bd4('0x41')][_0x8bd4('0x7d')]);}if(_0x2c6f18[_0x8bd4('0x5f')][_0x8bd4('0xa5')]&&_0x2c6f18[_0x8bd4('0x5f')][_0x8bd4('0xa5')][_0x8bd4('0x4c')]){for(var _0x171dfd=0x0;_0x171dfd<_0x2c6f18[_0x8bd4('0x5f')][_0x8bd4('0xa5')][_0x8bd4('0x4c')];_0x171dfd+=0x1){_0x2c6f18[_0x8bd4('0x5f')][_0x8bd4('0xa5')][_0x171dfd]={'filename':_0x2c6f18[_0x8bd4('0x5f')][_0x8bd4('0xa5')][_0x171dfd][_0x8bd4('0x3d')],'path':path[_0x8bd4('0xa6')](config[_0x8bd4('0xa7')],'server/files/attachments',_0x2c6f18[_0x8bd4('0x5f')][_0x8bd4('0xa5')][_0x171dfd][_0x8bd4('0xa8')])};}}var _0x40cec1={'tls':{'rejectUnauthorized':![]}};if(_[_0x8bd4('0x71')](_0x44fb0c['Smtp'][_0x8bd4('0x7c')])){if(_0x44fb0c[_0x8bd4('0x41')][_0x8bd4('0x79')]){_0x40cec1[_0x8bd4('0xa9')]={'user':_0x44fb0c['Smtp'][_0x8bd4('0x7d')],'pass':_0x44fb0c[_0x8bd4('0x41')][_0x8bd4('0x7e')]};}_0x40cec1[_0x8bd4('0x7a')]=_0x44fb0c[_0x8bd4('0x41')][_0x8bd4('0x7a')];_0x40cec1[_0x8bd4('0x7b')]=_0x44fb0c['Smtp'][_0x8bd4('0x7b')];_0x40cec1[_0x8bd4('0xaa')]=_0x44fb0c[_0x8bd4('0x41')][_0x8bd4('0xaa')];}else{_0x40cec1[_0x8bd4('0x7c')]=_0x44fb0c[_0x8bd4('0x41')]['service'];_0x40cec1['auth']={'user':_0x44fb0c[_0x8bd4('0x41')][_0x8bd4('0x7d')],'pass':_0x44fb0c['Smtp'][_0x8bd4('0x7e')]};}return respondWithRpcPromise(_0x8bd4('0xab'),'sendMail',{'account':_0x40cec1,'message':_0x2c6f18[_0x8bd4('0x5f')]});}else{throw new Error(_0x8bd4('0xac'));}}})[_0x8bd4('0x22')](function(_0x418d48){if(_0x418d48){_0x320c0a=_0x418d48;if(_0x2572a8[_0x8bd4('0xa1')]){if(_0x2572a8[_0x8bd4('0xa1')][_0x8bd4('0xad')][_0x8bd4('0x4c')]){return _0x2572a8[_0x8bd4('0xa1')]['Contacts'][0x0];}else{return db[_0x8bd4('0x8d')][_0x8bd4('0x64')](_[_0x8bd4('0x1b')](_0x2c6f18['body'],{'firstName':_0x2c6f18[_0x8bd4('0x5f')]['to'],'email':_0x2c6f18[_0x8bd4('0x5f')]['to'],'phone':_0x2c6f18[_0x8bd4('0x5f')]['to'],'ListId':_0x2572a8[_0x8bd4('0xae')]}));}}else{throw new Error(_0x8bd4('0xac'));}}})[_0x8bd4('0x22')](function(_0x1d60db){if(_0x1d60db){var _0x56f113={'UserId':_0x2c6f18[_0x8bd4('0x7d')]['id'],'ContactId':_0x1d60db['id'],'MailAccountId':_0x2572a8['id'],'inReplyTo':_0x320c0a[_0x8bd4('0xaf')],'to':_0x2c6f18['body'][_0x8bd4('0xa3')],'cc':_0x2c6f18[_0x8bd4('0x5f')]['cc'],'subject':_0x2c6f18['body'][_0x8bd4('0xb0')],'attach':_0x2c6f18['body']['attach'],'firstMsgDirection':_0x8bd4('0xb1'),'lastMsgAt':moment()[_0x8bd4('0x9d')](_0x8bd4('0x9e')),'lastMsgDirection':_0x8bd4('0xb1'),'Messages':[_[_0x8bd4('0x55')](_0x2c6f18[_0x8bd4('0x5f')],{'messageId':_0x320c0a['messageId'],'sentAt':moment()[_0x8bd4('0x9d')](_0x8bd4('0x9e')),'read':!![],'MailAccountId':_0x2572a8['id'],'UserId':_0x2c6f18[_0x8bd4('0x7d')]['id'],'ContactId':_0x1d60db['id']})]};if(_0x2c6f18[_0x8bd4('0x5f')][_0x8bd4('0xb2')]){_0x56f113=_[_0x8bd4('0x55')](_0x56f113,_0x2c6f18[_0x8bd4('0x5f')][_0x8bd4('0xb2')]);}return db['MailInteraction'][_0x8bd4('0x64')](_0x56f113,{'include':[{'model':db['MailMessage'],'as':_0x8bd4('0xb3')}]});}})[_0x8bd4('0x22')](respondWithResult(_0x590362,null))[_0x8bd4('0x2d')](handleError(_0x590362,null));};exports[_0x8bd4('0xb4')]=function(_0x571732,_0x5072bc,_0x292ba1){return db[_0x8bd4('0x44')][_0x8bd4('0x5e')]({'where':{'id':_0x571732[_0x8bd4('0x60')]['id']},'include':[{'model':db[_0x8bd4('0x40')],'as':_0x8bd4('0x41'),'raw':!![]}]})[_0x8bd4('0x22')](handleEntityNotFound(_0x5072bc,null))[_0x8bd4('0x22')](function(_0x1b1f20){if(_0x1b1f20&&_0x1b1f20[_0x8bd4('0x41')]){var _0x373c74={'id':_0x1b1f20['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1b1f20['Smtp']['service']){_0x373c74[_0x8bd4('0x7c')]=_0x1b1f20[_0x8bd4('0x41')][_0x8bd4('0x7c')];}else{_0x373c74[_0x8bd4('0x7a')]=_0x1b1f20[_0x8bd4('0x41')][_0x8bd4('0x7a')];_0x373c74[_0x8bd4('0x7b')]=_0x1b1f20[_0x8bd4('0x41')][_0x8bd4('0x7b')];_0x373c74[_0x8bd4('0xaa')]=_0x1b1f20[_0x8bd4('0x41')]['secure'];}if(_0x1b1f20[_0x8bd4('0x41')][_0x8bd4('0x79')]){_0x373c74[_0x8bd4('0xa9')]={'user':_0x1b1f20['Smtp'][_0x8bd4('0x7d')],'pass':_0x1b1f20[_0x8bd4('0x41')][_0x8bd4('0x7e')]};}return respondWithRpcPromise('VerifySmtp',_0x8bd4('0xb4'),{'account':_0x373c74});}})[_0x8bd4('0x22')](respondWithResult(_0x5072bc,null))['catch'](handleError(_0x5072bc,null));};exports[_0x8bd4('0x39')]=function(_0x420dd2,_0x1c5bee){return db[_0x8bd4('0x44')][_0x8bd4('0x5e')]({'where':{'id':_0x420dd2[_0x8bd4('0x60')]['id']}})[_0x8bd4('0x22')](handleEntityNotFound(_0x1c5bee,null))['then'](function(_0x4330ea){if(_0x4330ea&&_0x4330ea[_0x8bd4('0x7c')]){throw new db[(_0x8bd4('0xb5'))][(_0x8bd4('0xb6'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x4330ea;})['then'](removeEntity(_0x1c5bee,null))['catch'](handleError(_0x1c5bee,null));};exports['addAgents']=function(_0x470286,_0x43fd35,_0x1735dc){return db[_0x8bd4('0x44')][_0x8bd4('0x5e')]({'where':{'id':_0x470286[_0x8bd4('0x60')]['id']}})['then'](handleEntityNotFound(_0x43fd35,null))['then'](function(_0x441016){if(_0x441016){return _0x441016[_0x8bd4('0xb7')](_0x470286[_0x8bd4('0x5f')]['ids'],_['omit'](_0x470286[_0x8bd4('0x5f')],['ids','id'])||{})['spread'](function(_0x1c75ec){for(var _0x585081=0x0;_0x585081<_0x470286[_0x8bd4('0x5f')][_0x8bd4('0x6a')][_0x8bd4('0x4c')];_0x585081+=0x1){socket[_0x8bd4('0xb8')](_0x8bd4('0xb9'),{'UserId':Number(_0x470286[_0x8bd4('0x5f')][_0x8bd4('0x6a')][_0x585081]),'MailAccountId':Number(_0x470286[_0x8bd4('0x60')]['id'])});}return _0x1c75ec;});}})[_0x8bd4('0x22')](respondWithResult(_0x43fd35,null))[_0x8bd4('0x2d')](handleError(_0x43fd35,null));};exports[_0x8bd4('0xba')]=function(_0x149761,_0x12f3e2,_0x1611c8){return db[_0x8bd4('0x44')][_0x8bd4('0x5e')]({'where':{'id':_0x149761[_0x8bd4('0x60')]['id']}})['then'](handleEntityNotFound(_0x12f3e2,null))[_0x8bd4('0x22')](function(_0x293a28){if(_0x293a28){return _0x293a28[_0x8bd4('0xba')](_0x149761[_0x8bd4('0x48')]['ids'])['then'](function(){if(_[_0x8bd4('0xbb')](_0x149761[_0x8bd4('0x48')][_0x8bd4('0x6a')])){for(var _0x5c46cc=0x0;_0x5c46cc<_0x149761[_0x8bd4('0x48')]['ids']['length'];_0x5c46cc+=0x1){socket[_0x8bd4('0xb8')]('userMailAccount:remove',{'UserId':Number(_0x149761[_0x8bd4('0x48')][_0x8bd4('0x6a')][_0x5c46cc]),'MailAccountId':Number(_0x149761['params']['id'])});}}else{socket[_0x8bd4('0xb8')](_0x8bd4('0xbc'),{'UserId':Number(_0x149761[_0x8bd4('0x48')]['ids']),'MailAccountId':Number(_0x149761[_0x8bd4('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x12f3e2,null))['catch'](handleError(_0x12f3e2,null));};exports['getAgents']=function(_0x22728c,_0x49ed44,_0x598281){var _0x5e0ec0={};var _0x586fcb={};var _0x4c2ba8;var _0x59fbf2;return db[_0x8bd4('0x44')][_0x8bd4('0x6d')]({'where':{'id':_0x22728c[_0x8bd4('0x60')]['id']}})['then'](handleEntityNotFound(_0x49ed44,null))[_0x8bd4('0x22')](function(_0x24e5ef){if(_0x24e5ef){_0x4c2ba8=_0x24e5ef;_0x586fcb['model']=_[_0x8bd4('0x47')](db[_0x8bd4('0xbd')][_0x8bd4('0x45')]);_0x586fcb[_0x8bd4('0x48')]=_[_0x8bd4('0x47')](_0x22728c[_0x8bd4('0x48')]);_0x586fcb['filters']=_[_0x8bd4('0x49')](_0x586fcb[_0x8bd4('0x46')],_0x586fcb['query']);_0x5e0ec0[_0x8bd4('0x4a')]=_[_0x8bd4('0x49')](_0x586fcb[_0x8bd4('0x46')],qs['fields'](_0x22728c[_0x8bd4('0x48')]['fields']));_0x5e0ec0[_0x8bd4('0x4a')]=_0x5e0ec0[_0x8bd4('0x4a')][_0x8bd4('0x4c')]?_0x5e0ec0['attributes']:_0x586fcb[_0x8bd4('0x46')];_0x5e0ec0[_0x8bd4('0x4f')]=qs[_0x8bd4('0x50')](_0x22728c[_0x8bd4('0x48')][_0x8bd4('0x50')]);_0x5e0ec0[_0x8bd4('0x51')]=qs[_0x8bd4('0x52')](_[_0x8bd4('0x53')](_0x22728c[_0x8bd4('0x48')],_0x586fcb[_0x8bd4('0x52')]));if(_0x22728c[_0x8bd4('0x48')][_0x8bd4('0x54')]){_0x5e0ec0[_0x8bd4('0x51')]=_[_0x8bd4('0x55')](_0x5e0ec0['where'],{'$or':_[_0x8bd4('0x43')](_0x5e0ec0[_0x8bd4('0x4a')],function(_0x321ac2){var _0x59d23f={};_0x59d23f[_0x321ac2]={'$like':'%'+_0x22728c['query'][_0x8bd4('0x54')]+'%'};return _0x59d23f;})});}_0x5e0ec0=_[_0x8bd4('0x55')]({},_0x5e0ec0,_0x22728c[_0x8bd4('0x58')]);return _0x4c2ba8[_0x8bd4('0xbe')](_0x5e0ec0);}})[_0x8bd4('0x22')](function(_0x4c0acb){if(_0x4c0acb){_0x59fbf2=_0x4c0acb[_0x8bd4('0x4c')];if(!_0x22728c['query'][_0x8bd4('0x4d')](_0x8bd4('0x4e'))){_0x5e0ec0[_0x8bd4('0x32')]=qs['limit'](_0x22728c[_0x8bd4('0x48')]['limit']);_0x5e0ec0[_0x8bd4('0x34')]=qs[_0x8bd4('0x34')](_0x22728c['query'][_0x8bd4('0x34')]);}return _0x4c2ba8[_0x8bd4('0xbe')](_0x5e0ec0);}})[_0x8bd4('0x22')](function(_0x178424){if(_0x178424){return _0x178424?{'count':_0x59fbf2,'rows':_0x178424}:null;}})[_0x8bd4('0x22')](respondWithResult(_0x49ed44,null))[_0x8bd4('0x2d')](handleError(_0x49ed44,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 234cca7..7a04329 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 _0x0958=['MailAccount','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x0958,0x7c));var _0x8095=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0958[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x8095('0x0'));var MailAccount=require(_0x8095('0x1'))['db'][_0x8095('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8095('0x3'),'afterUpdate':_0x8095('0x4'),'afterDestroy':'remove'};function emitEvent(_0x56d986){return function(_0x4625ee,_0x3da09b,_0x58bdb8){MailAccountEvents['emit'](_0x56d986+':'+_0x4625ee['id'],_0x4625ee);MailAccountEvents[_0x8095('0x5')](_0x56d986,_0x4625ee);_0x58bdb8(null);};}for(var e in events){if(events[_0x8095('0x6')](e)){var event=events[e];MailAccount[_0x8095('0x7')](e,emitEvent(event));}}module[_0x8095('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xb512=['MailAccount','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x55fa7f,_0x36f5cb){var _0x156879=function(_0x30b1ee){while(--_0x30b1ee){_0x55fa7f['push'](_0x55fa7f['shift']());}};_0x156879(++_0x36f5cb);}(_0xb512,0xe6));var _0x2b51=function(_0x4b6cc3,_0x6642c0){_0x4b6cc3=_0x4b6cc3-0x0;var _0x4e6deb=_0xb512[_0x4b6cc3];return _0x4e6deb;};'use strict';var EventEmitter=require(_0x2b51('0x0'));var MailAccount=require(_0x2b51('0x1'))['db'][_0x2b51('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2b51('0x3'),'afterUpdate':_0x2b51('0x4'),'afterDestroy':_0x2b51('0x5')};function emitEvent(_0x3d1cdb){return function(_0x590c98,_0x818546,_0xaee29){MailAccountEvents[_0x2b51('0x6')](_0x3d1cdb+':'+_0x590c98['id'],_0x590c98);MailAccountEvents['emit'](_0x3d1cdb,_0x590c98);_0xaee29(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x2b51('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 23af2cd..2cf12de 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 _0xd94f=['exports','define','mail_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./mailAccount.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd94f,0x142));var _0xfd94=function(_0x5d8232,_0x156279){_0x5d8232=_0x5d8232-0x0;var _0x5daf30=_0xd94f[_0x5d8232];return _0x5daf30;};'use strict';var _=require(_0xfd94('0x0'));var util=require(_0xfd94('0x1'));var logger=require(_0xfd94('0x2'))(_0xfd94('0x3'));var moment=require(_0xfd94('0x4'));var BPromise=require('bluebird');var rp=require(_0xfd94('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd94('0x6'));var config=require('../../config/environment');var attributes=require(_0xfd94('0x7'));module[_0xfd94('0x8')]=function(_0xd841c,_0x39fc88){return _0xd841c[_0xfd94('0x9')]('MailAccount',attributes,{'tableName':_0xfd94('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4386=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailAccount.attributes','MailAccount','mail_accounts'];(function(_0x1bf176,_0x5066ed){var _0x230f12=function(_0x1f8ba2){while(--_0x1f8ba2){_0x1bf176['push'](_0x1bf176['shift']());}};_0x230f12(++_0x5066ed);}(_0x4386,0xd1));var _0x6438=function(_0x2c5ec9,_0x4d69fe){_0x2c5ec9=_0x2c5ec9-0x0;var _0x460637=_0x4386[_0x2c5ec9];return _0x460637;};'use strict';var _=require('lodash');var util=require(_0x6438('0x0'));var logger=require(_0x6438('0x1'))(_0x6438('0x2'));var moment=require(_0x6438('0x3'));var BPromise=require(_0x6438('0x4'));var rp=require(_0x6438('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6438('0x6'));var config=require(_0x6438('0x7'));var attributes=require(_0x6438('0x8'));module['exports']=function(_0xcda6b5,_0x2b9340){return _0xcda6b5['define'](_0x6438('0x9'),attributes,{'tableName':_0x6438('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 89499a9..3a0d003 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 _0x77c2=['Attachments','UserId','User','agent','name','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','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','limit','include','map','model','catch','ShowMailAccount','where','NotifyMailAccount','body','mail','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','find','account','CmList','Contacts','MailApplication','Applications','MailServerOut','Smtp','List','get','orderBy','applications','priority','autoclose','push','length','close','List\x20not\x20found','contact','messageId','generate','attach','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','format','YYYY-MM-DD\x20HH:mm:ss','interaction','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment'];(function(_0x3dc0f8,_0x32249d){var _0x2adacf=function(_0x4fa969){while(--_0x4fa969){_0x3dc0f8['push'](_0x3dc0f8['shift']());}};_0x2adacf(++_0x32249d);}(_0x77c2,0x13c));var _0x277c=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x77c2[_0x32b542];return _0x554d54;};'use strict';var _=require(_0x277c('0x0'));var util=require(_0x277c('0x1'));var moment=require(_0x277c('0x2'));var BPromise=require('bluebird');var rs=require(_0x277c('0x3'));var fs=require('fs');var Redis=require(_0x277c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x277c('0x5'));var logger=require(_0x277c('0x6'))(_0x277c('0x7'));var config=require(_0x277c('0x8'));var jayson=require(_0x277c('0x9'));var client=jayson['client'][_0x277c('0xa')]({'port':0x232c});config[_0x277c('0xb')]=_[_0x277c('0xc')](config[_0x277c('0xb')],{'host':_0x277c('0xd'),'port':0x18eb});var socket=require(_0x277c('0xe'))(new Redis(config[_0x277c('0xb')]));require(_0x277c('0xf'))[_0x277c('0x10')](socket);function respondWithRpcPromise(_0x330a6c,_0x543c51,_0x3db7f1){return new BPromise(function(_0x33684d,_0x9ef047){return client[_0x277c('0x11')](_0x330a6c,_0x3db7f1)[_0x277c('0x12')](function(_0x1f69d5){logger[_0x277c('0x13')]('MailAccount,\x20%s,\x20%s',_0x543c51,_0x277c('0x14'));logger[_0x277c('0x15')](_0x277c('0x16'),_0x543c51,'request\x20sent',JSON[_0x277c('0x17')](_0x1f69d5));if(_0x1f69d5[_0x277c('0x18')]){if(_0x1f69d5[_0x277c('0x18')][_0x277c('0x19')]===0x1f4){logger[_0x277c('0x18')](_0x277c('0x1a'),_0x543c51,_0x1f69d5[_0x277c('0x18')][_0x277c('0x1b')]);return _0x9ef047(_0x1f69d5[_0x277c('0x18')]['message']);}logger[_0x277c('0x18')](_0x277c('0x1a'),_0x543c51,_0x1f69d5[_0x277c('0x18')][_0x277c('0x1b')]);return _0x33684d(_0x1f69d5[_0x277c('0x18')][_0x277c('0x1b')]);}else{logger['info'](_0x277c('0x1a'),_0x543c51,'request\x20sent');_0x33684d(_0x1f69d5[_0x277c('0x1c')][_0x277c('0x1b')]);}})['catch'](function(_0x56ac68){logger['error'](_0x277c('0x1a'),_0x543c51,_0x56ac68);_0x9ef047(_0x56ac68);});});}exports[_0x277c('0x1d')]=function(_0xd50a3){var _0x136a23=this;return new Promise(function(_0x515acd,_0x211ad4){return db[_0x277c('0x1e')][_0x277c('0x1f')]({'raw':_0xd50a3[_0x277c('0x20')]?_0xd50a3[_0x277c('0x20')][_0x277c('0x21')]===undefined?!![]:![]:!![],'where':_0xd50a3[_0x277c('0x20')]?_0xd50a3[_0x277c('0x20')]['where']||null:null,'attributes':_0xd50a3[_0x277c('0x20')]?_0xd50a3[_0x277c('0x20')][_0x277c('0x22')]||null:null,'limit':_0xd50a3[_0x277c('0x20')]?_0xd50a3[_0x277c('0x20')][_0x277c('0x23')]||null:null,'include':_0xd50a3[_0x277c('0x20')]?_0xd50a3[_0x277c('0x20')][_0x277c('0x24')]?_[_0x277c('0x25')](_0xd50a3[_0x277c('0x20')]['include'],function(_0x2a9d7f){return{'model':db[_0x2a9d7f['model']],'as':_0x2a9d7f['as'],'attributes':_0x2a9d7f[_0x277c('0x22')],'include':_0x2a9d7f[_0x277c('0x24')]?_['map'](_0x2a9d7f[_0x277c('0x24')],function(_0x587ded){return{'model':db[_0x587ded[_0x277c('0x26')]],'as':_0x587ded['as'],'attributes':_0x587ded[_0x277c('0x22')],'include':_0x587ded[_0x277c('0x24')]?_[_0x277c('0x25')](_0x587ded[_0x277c('0x24')],function(_0x35e1b5){return{'model':db[_0x35e1b5[_0x277c('0x26')]],'as':_0x35e1b5['as'],'attributes':_0x35e1b5[_0x277c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x277c('0x12')](function(_0x431317){logger[_0x277c('0x13')]('GetMailAccount',_0xd50a3);logger[_0x277c('0x15')](_0x277c('0x1d'),_0xd50a3,JSON[_0x277c('0x17')](_0x431317));_0x515acd(_0x431317);})[_0x277c('0x27')](function(_0x474b0a){logger[_0x277c('0x18')](_0x277c('0x1d'),_0x474b0a['message'],_0xd50a3);_0x211ad4(_0x136a23['error'](0x1f4,_0x474b0a[_0x277c('0x1b')]));});});};exports[_0x277c('0x28')]=function(_0x23c743){var _0x187f96=this;return new Promise(function(_0x3cfbec,_0x4bf4bc){return db[_0x277c('0x1e')]['find']({'raw':_0x23c743[_0x277c('0x20')]?_0x23c743[_0x277c('0x20')][_0x277c('0x21')]===undefined?!![]:![]:!![],'where':_0x23c743['options']?_0x23c743[_0x277c('0x20')][_0x277c('0x29')]||null:null,'attributes':_0x23c743[_0x277c('0x20')]?_0x23c743[_0x277c('0x20')]['attributes']||null:null,'include':_0x23c743['options']?_0x23c743[_0x277c('0x20')][_0x277c('0x24')]?_[_0x277c('0x25')](_0x23c743[_0x277c('0x20')][_0x277c('0x24')],function(_0xb5b4b7){return{'model':db[_0xb5b4b7['model']],'as':_0xb5b4b7['as'],'attributes':_0xb5b4b7[_0x277c('0x22')],'include':_0xb5b4b7[_0x277c('0x24')]?_[_0x277c('0x25')](_0xb5b4b7['include'],function(_0x1d97e7){return{'model':db[_0x1d97e7[_0x277c('0x26')]],'as':_0x1d97e7['as'],'attributes':_0x1d97e7[_0x277c('0x22')],'include':_0x1d97e7[_0x277c('0x24')]?_[_0x277c('0x25')](_0x1d97e7[_0x277c('0x24')],function(_0x438441){return{'model':db[_0x438441[_0x277c('0x26')]],'as':_0x438441['as'],'attributes':_0x438441[_0x277c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x277c('0x12')](function(_0x2ed6e6){logger[_0x277c('0x13')]('ShowMailAccount',_0x23c743);logger[_0x277c('0x15')](_0x277c('0x28'),_0x23c743,JSON[_0x277c('0x17')](_0x2ed6e6));_0x3cfbec(_0x2ed6e6);})[_0x277c('0x27')](function(_0x3f162d){logger[_0x277c('0x18')]('ShowMailAccount',_0x3f162d[_0x277c('0x1b')],_0x23c743);_0x4bf4bc(_0x187f96[_0x277c('0x18')](0x1f4,_0x3f162d['message']));});});};exports[_0x277c('0x2a')]=function(_0x3ca7bf){var _0x584fc9=this;return new Promise(function(_0x13b84b,_0x5cc4a){var _0x1cdb90={'body':_0x3ca7bf[_0x277c('0x2b')],'channel':_0x277c('0x2c')};var _0x34570d=_['difference'](_['keys'](db[_0x277c('0x2d')][_0x277c('0x2e')]),[_0x277c('0x2f'),_0x277c('0x30'),_0x277c('0x31'),_0x277c('0x32')]);var _0x31dd4d=![];if(_0x3ca7bf['body']['id']){delete _0x3ca7bf[_0x277c('0x2b')]['id'];}if(_[_0x277c('0x33')](_0x3ca7bf['body'][_0x277c('0x34')])){return _0x5cc4a(_0x584fc9[_0x277c('0x18')](0x1f4,_0x277c('0x35')));}if(_[_0x277c('0x33')](_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x2b')])||_0x3ca7bf['body'][_0x277c('0x2b')]===''){return _0x5cc4a(_0x584fc9[_0x277c('0x18')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x277c('0x33')](_0x3ca7bf['body'][_0x277c('0x36')])){return _0x5cc4a(_0x584fc9[_0x277c('0x18')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x34570d));}if(!_['includes'](_0x34570d,_0x3ca7bf[_0x277c('0x2b')]['mapKey'])){return _0x5cc4a(_0x584fc9[_0x277c('0x18')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x34570d));}var _0x4ef879={};_0x4ef879[_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x36')]]=_0x3ca7bf['body'][_0x277c('0x34')];return db['MailAccount'][_0x277c('0x37')]({'where':{'id':_0x3ca7bf[_0x277c('0x38')]['id']},'include':[{'model':db[_0x277c('0x39')],'as':'List','include':[{'model':db['CmContact'],'as':_0x277c('0x3a'),'where':_0x4ef879,'limit':0x1,'order':[[_0x277c('0x30'),'DESC']]}]},{'model':db[_0x277c('0x3b')],'as':_0x277c('0x3c')},{'model':db[_0x277c('0x3d')],'as':_0x277c('0x3e')}]})['then'](function(_0x4f25f2){if(_0x4f25f2&&_0x4f25f2[_0x277c('0x3f')]){var _0x566211=_0x4f25f2[_0x277c('0x40')]({'plain':!![]});_0x1cdb90[_0x277c('0x38')]=_['omit'](_0x566211,[_0x277c('0x3c'),_0x277c('0x3f')]);_0x1cdb90['applications']=_0x566211[_0x277c('0x3c')];_0x1cdb90['list']=_0x566211[_0x277c('0x3f')];_0x1cdb90['applications']=_[_0x277c('0x41')](_0x1cdb90[_0x277c('0x42')],[_0x277c('0x43')],['asc']);if(_0x1cdb90['account']&&_0x1cdb90[_0x277c('0x38')][_0x277c('0x44')]){_0x1cdb90[_0x277c('0x42')][_0x277c('0x45')]({'id':0x0,'priority':_0x1cdb90[_0x277c('0x42')][_0x277c('0x46')]+0x1,'app':_0x277c('0x47'),'appdata':_0x277c('0x44'),'interval':'*,*,*,*'});}if(_0x1cdb90[_0x277c('0x38')]['Applications']){delete _0x1cdb90[_0x277c('0x38')][_0x277c('0x3c')];}if(_0x1cdb90['account']['List']){delete _0x1cdb90[_0x277c('0x38')]['List'];}if(_0x566211[_0x277c('0x3f')][_0x277c('0x3a')][_0x277c('0x46')]){return _0x566211[_0x277c('0x3f')][_0x277c('0x3a')][0x0];}var _0x33d121=_[_0x277c('0xc')](_0x3ca7bf[_0x277c('0x2b')],{'firstName':_0x3ca7bf['body'][_0x277c('0x34')],'ListId':_0x566211[_0x277c('0x32')]});_0x33d121[_0x3ca7bf['body']['mapKey']]=_0x3ca7bf['body'][_0x277c('0x34')];return db['CmContact']['create'](_0x33d121);}else{throw new Error(_0x277c('0x48'));}})[_0x277c('0x12')](function(_0x3d97b1){_0x1cdb90[_0x277c('0x49')]=_0x3d97b1;if(_0x3d97b1){if(!_0x3ca7bf['body'][_0x277c('0x1b')][_0x277c('0x4a')]){_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')][_0x277c('0x4a')]=rs[_0x277c('0x4b')]()+'\x20'+_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')]['from'];}var _0x302d7a={'ContactId':_0x3d97b1['id'],'MailAccountId':_0x3ca7bf[_0x277c('0x38')]['id'],'inReplyTo':_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')][_0x277c('0x4a')],'to':_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')]['from'],'cc':_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')]['cc'],'subject':_0x3ca7bf['body'][_0x277c('0x1b')]['subject'],'attach':_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')][_0x277c('0x4c')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x277c('0x4d')][_0x277c('0x37')]({'where':{'closed':![],'MailAccountId':_0x3ca7bf['account']['id']},'include':[{'model':db[_0x277c('0x4e')],'as':_0x277c('0x4f'),'attributes':['messageId'],'where':{'messageId':_0x3ca7bf['body'][_0x277c('0x1b')][_0x277c('0x50')]}}]})[_0x277c('0x12')](function(_0x25196d){if(_0x25196d){return[_0x25196d,![]];}return db[_0x277c('0x4d')]['create'](_0x302d7a)[_0x277c('0x12')](function(_0x20006b){return[_0x20006b,!![]];});});}else{throw new Error(_0x277c('0x51'));}})[_0x277c('0x52')](function(_0xf219a6,_0x1f0f65){if(_0xf219a6){_0x31dd4d=_0x1f0f65;if(!_0x1f0f65){return _0xf219a6[_0x277c('0x53')]({'inReplyTo':_0x3ca7bf['body'][_0x277c('0x1b')]['messageId'],'to':_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')][_0x277c('0x34')],'cc':_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')]['cc'],'subject':_0x3ca7bf[_0x277c('0x2b')]['message'][_0x277c('0x54')],'attach':_0xf219a6[_0x277c('0x4c')]?_0xf219a6[_0x277c('0x4c')]:_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')][_0x277c('0x4c')],'substatus':null,'substatusAt':moment()[_0x277c('0x55')](_0x277c('0x56')),'lastMsgAt':moment()[_0x277c('0x55')](_0x277c('0x56')),'lastMsgDirection':'in'});}else{return _0xf219a6;}}})['then'](function(_0x2034ab){_0x1cdb90[_0x277c('0x57')]=_0x2034ab['get']({'plain':!![]});_0x1cdb90[_0x277c('0x57')]['created']=_0x31dd4d;return db[_0x277c('0x4e')]['create']({'body':_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x2b')],'MailAccountId':_0x3ca7bf[_0x277c('0x38')]['id'],'MailInteractionId':_0x2034ab['id'],'direction':'in','ContactId':_0x1cdb90['contact']['id'],'messageId':_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')]['messageId'],'from':_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')]['from'],'to':_0x3ca7bf[_0x277c('0x2b')]['message']['to'],'cc':_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')]['cc'],'subject':_0x3ca7bf[_0x277c('0x2b')]['message'][_0x277c('0x54')],'attach':_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')]['attach'],'Attachments':_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')][_0x277c('0x58')],'originTo':_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')][_0x277c('0x59')],'originCc':_0x3ca7bf['body'][_0x277c('0x1b')]['originCc'],'bcc':_0x3ca7bf[_0x277c('0x2b')][_0x277c('0x1b')][_0x277c('0x5a')],'ChatWebsiteId':_0x3ca7bf[_0x277c('0x2b')]['message'][_0x277c('0x5b')]||null,'originChannel':_0x3ca7bf[_0x277c('0x2b')]['message'][_0x277c('0x5c')]||_0x277c('0x5d'),'ChatOfflineMessageId':_0x3ca7bf['body'][_0x277c('0x1b')][_0x277c('0x5e')]||null},{'include':[{'model':db[_0x277c('0x5f')],'as':_0x277c('0x60')}]});})[_0x277c('0x12')](function(_0x45083b){_0x1cdb90[_0x277c('0x1b')]=_0x45083b;if(_0x1cdb90[_0x277c('0x57')][_0x277c('0x61')]){return db[_0x277c('0x62')][_0x277c('0x37')]({'attributes':['id','name'],'where':{'id':_0x1cdb90[_0x277c('0x57')][_0x277c('0x61')]}})['then'](function(_0x44d16a){if(_0x44d16a){_0x1cdb90[_0x277c('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0x277c('0x63'),'appdata':_0x44d16a[_0x277c('0x64')]+','+(_0x1cdb90[_0x277c('0x38')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x277c('0x65'),_0x277c('0x66'),_0x1cdb90);});}return respondWithRpcPromise('Start','startRouting',_0x1cdb90);})[_0x277c('0x12')](function(_0x1a5af8){_0x13b84b(_0x1a5af8);})[_0x277c('0x27')](function(_0x5a27f9){_0x5cc4a(_0x584fc9[_0x277c('0x18')](0x1f4,_0x5a27f9[_0x277c('0x1b')]));});});}; \ No newline at end of file +var _0x41fe=['asc','autoclose','push','length','close','*,*,*,*','Contacts','ListId','create','List\x20not\x20found','contact','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','update','subject','attach','interaction','created','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','include','map','model','then','ShowMailAccount','find','where','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','Applications','MailServerOut','get','omit','applications','list','priority'];(function(_0x418f0b,_0xe47fcf){var _0x4c0491=function(_0xf1922e){while(--_0xf1922e){_0x418f0b['push'](_0x418f0b['shift']());}};_0x4c0491(++_0xe47fcf);}(_0x41fe,0x1c8));var _0xe41f=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x41fe[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xe41f('0x0'));var util=require(_0xe41f('0x1'));var moment=require('moment');var BPromise=require(_0xe41f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe41f('0x3'))['db'];var utils=require(_0xe41f('0x4'));var logger=require(_0xe41f('0x5'))(_0xe41f('0x6'));var config=require(_0xe41f('0x7'));var jayson=require(_0xe41f('0x8'));var client=jayson['client'][_0xe41f('0x9')]({'port':0x232c});config[_0xe41f('0xa')]=_[_0xe41f('0xb')](config['redis'],{'host':_0xe41f('0xc'),'port':0x18eb});var socket=require(_0xe41f('0xd'))(new Redis(config[_0xe41f('0xa')]));require(_0xe41f('0xe'))['register'](socket);function respondWithRpcPromise(_0x2281ff,_0x55eb75,_0x37e04d){return new BPromise(function(_0x5600e0,_0x27bc06){return client[_0xe41f('0xf')](_0x2281ff,_0x37e04d)['then'](function(_0xb71935){logger[_0xe41f('0x10')](_0xe41f('0x11'),_0x55eb75,_0xe41f('0x12'));logger[_0xe41f('0x13')](_0xe41f('0x14'),_0x55eb75,_0xe41f('0x12'),JSON[_0xe41f('0x15')](_0xb71935));if(_0xb71935['error']){if(_0xb71935[_0xe41f('0x16')][_0xe41f('0x17')]===0x1f4){logger['error'](_0xe41f('0x11'),_0x55eb75,_0xb71935['error'][_0xe41f('0x18')]);return _0x27bc06(_0xb71935[_0xe41f('0x16')][_0xe41f('0x18')]);}logger[_0xe41f('0x16')](_0xe41f('0x11'),_0x55eb75,_0xb71935[_0xe41f('0x16')][_0xe41f('0x18')]);return _0x5600e0(_0xb71935[_0xe41f('0x16')][_0xe41f('0x18')]);}else{logger[_0xe41f('0x10')](_0xe41f('0x11'),_0x55eb75,_0xe41f('0x12'));_0x5600e0(_0xb71935[_0xe41f('0x19')][_0xe41f('0x18')]);}})[_0xe41f('0x1a')](function(_0x547ae0){logger['error']('MailAccount,\x20%s,\x20%s',_0x55eb75,_0x547ae0);_0x27bc06(_0x547ae0);});});}exports[_0xe41f('0x1b')]=function(_0x3d25eb){var _0x4db3d1=this;return new Promise(function(_0x4efd5b,_0xd28560){return db[_0xe41f('0x1c')]['findAll']({'raw':_0x3d25eb[_0xe41f('0x1d')]?_0x3d25eb['options'][_0xe41f('0x1e')]===undefined?!![]:![]:!![],'where':_0x3d25eb[_0xe41f('0x1d')]?_0x3d25eb[_0xe41f('0x1d')]['where']||null:null,'attributes':_0x3d25eb[_0xe41f('0x1d')]?_0x3d25eb[_0xe41f('0x1d')][_0xe41f('0x1f')]||null:null,'limit':_0x3d25eb[_0xe41f('0x1d')]?_0x3d25eb[_0xe41f('0x1d')]['limit']||null:null,'include':_0x3d25eb[_0xe41f('0x1d')]?_0x3d25eb[_0xe41f('0x1d')][_0xe41f('0x20')]?_[_0xe41f('0x21')](_0x3d25eb[_0xe41f('0x1d')][_0xe41f('0x20')],function(_0xd8dd03){return{'model':db[_0xd8dd03[_0xe41f('0x22')]],'as':_0xd8dd03['as'],'attributes':_0xd8dd03[_0xe41f('0x1f')],'include':_0xd8dd03[_0xe41f('0x20')]?_[_0xe41f('0x21')](_0xd8dd03['include'],function(_0x329eb6){return{'model':db[_0x329eb6['model']],'as':_0x329eb6['as'],'attributes':_0x329eb6[_0xe41f('0x1f')],'include':_0x329eb6[_0xe41f('0x20')]?_[_0xe41f('0x21')](_0x329eb6['include'],function(_0x2e46eb){return{'model':db[_0x2e46eb[_0xe41f('0x22')]],'as':_0x2e46eb['as'],'attributes':_0x2e46eb[_0xe41f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe41f('0x23')](function(_0x5e1d41){logger['info'](_0xe41f('0x1b'),_0x3d25eb);logger[_0xe41f('0x13')](_0xe41f('0x1b'),_0x3d25eb,JSON[_0xe41f('0x15')](_0x5e1d41));_0x4efd5b(_0x5e1d41);})[_0xe41f('0x1a')](function(_0x39f214){logger[_0xe41f('0x16')](_0xe41f('0x1b'),_0x39f214[_0xe41f('0x18')],_0x3d25eb);_0xd28560(_0x4db3d1[_0xe41f('0x16')](0x1f4,_0x39f214[_0xe41f('0x18')]));});});};exports[_0xe41f('0x24')]=function(_0x3257e0){var _0x183a5a=this;return new Promise(function(_0x50426f,_0x119598){return db[_0xe41f('0x1c')][_0xe41f('0x25')]({'raw':_0x3257e0['options']?_0x3257e0[_0xe41f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3257e0[_0xe41f('0x1d')]?_0x3257e0[_0xe41f('0x1d')][_0xe41f('0x26')]||null:null,'attributes':_0x3257e0[_0xe41f('0x1d')]?_0x3257e0[_0xe41f('0x1d')][_0xe41f('0x1f')]||null:null,'include':_0x3257e0[_0xe41f('0x1d')]?_0x3257e0[_0xe41f('0x1d')][_0xe41f('0x20')]?_['map'](_0x3257e0[_0xe41f('0x1d')][_0xe41f('0x20')],function(_0x3a894a){return{'model':db[_0x3a894a[_0xe41f('0x22')]],'as':_0x3a894a['as'],'attributes':_0x3a894a['attributes'],'include':_0x3a894a['include']?_[_0xe41f('0x21')](_0x3a894a[_0xe41f('0x20')],function(_0x129b41){return{'model':db[_0x129b41[_0xe41f('0x22')]],'as':_0x129b41['as'],'attributes':_0x129b41['attributes'],'include':_0x129b41[_0xe41f('0x20')]?_[_0xe41f('0x21')](_0x129b41[_0xe41f('0x20')],function(_0x973dca){return{'model':db[_0x973dca[_0xe41f('0x22')]],'as':_0x973dca['as'],'attributes':_0x973dca['attributes']};}):[]};}):[]};}):[]:[]})[_0xe41f('0x23')](function(_0x4b8087){logger[_0xe41f('0x10')](_0xe41f('0x24'),_0x3257e0);logger[_0xe41f('0x13')](_0xe41f('0x24'),_0x3257e0,JSON['stringify'](_0x4b8087));_0x50426f(_0x4b8087);})[_0xe41f('0x1a')](function(_0x1e81a3){logger['error'](_0xe41f('0x24'),_0x1e81a3[_0xe41f('0x18')],_0x3257e0);_0x119598(_0x183a5a[_0xe41f('0x16')](0x1f4,_0x1e81a3[_0xe41f('0x18')]));});});};exports['NotifyMailAccount']=function(_0x39ca34){var _0x52c900=this;return new Promise(function(_0x43c63a,_0xa42265){var _0xf45e5d={'body':_0x39ca34['body'],'channel':_0xe41f('0x27')};var _0x2ede6d=_[_0xe41f('0x28')](_[_0xe41f('0x29')](db[_0xe41f('0x2a')][_0xe41f('0x2b')]),[_0xe41f('0x2c'),_0xe41f('0x2d'),'CompanyId','ListId']);var _0x40b290=![];if(_0x39ca34[_0xe41f('0x2e')]['id']){delete _0x39ca34[_0xe41f('0x2e')]['id'];}if(_[_0xe41f('0x2f')](_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x30')])){return _0xa42265(_0x52c900['error'](0x1f4,_0xe41f('0x31')));}if(_[_0xe41f('0x2f')](_0x39ca34['body'][_0xe41f('0x2e')])||_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x2e')]===''){return _0xa42265(_0x52c900[_0xe41f('0x16')](0x1f4,_0xe41f('0x32')));}if(_['isNil'](_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x33')])){return _0xa42265(_0x52c900['error'](0x1f4,_0xe41f('0x34')+_0x2ede6d));}if(!_['includes'](_0x2ede6d,_0x39ca34['body'][_0xe41f('0x33')])){return _0xa42265(_0x52c900[_0xe41f('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ede6d));}var _0x1170c7={};_0x1170c7[_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x33')]]=_0x39ca34['body'][_0xe41f('0x30')];return db[_0xe41f('0x1c')]['find']({'where':{'id':_0x39ca34[_0xe41f('0x35')]['id']},'include':[{'model':db[_0xe41f('0x36')],'as':_0xe41f('0x37'),'include':[{'model':db[_0xe41f('0x2a')],'as':'Contacts','where':_0x1170c7,'limit':0x1,'order':[[_0xe41f('0x2d'),_0xe41f('0x38')]]}]},{'model':db['MailApplication'],'as':_0xe41f('0x39')},{'model':db[_0xe41f('0x3a')],'as':'Smtp'}]})['then'](function(_0x35c07e){if(_0x35c07e&&_0x35c07e[_0xe41f('0x37')]){var _0x1e8c2f=_0x35c07e[_0xe41f('0x3b')]({'plain':!![]});_0xf45e5d[_0xe41f('0x35')]=_[_0xe41f('0x3c')](_0x1e8c2f,[_0xe41f('0x39'),'List']);_0xf45e5d[_0xe41f('0x3d')]=_0x1e8c2f[_0xe41f('0x39')];_0xf45e5d[_0xe41f('0x3e')]=_0x1e8c2f[_0xe41f('0x37')];_0xf45e5d[_0xe41f('0x3d')]=_['orderBy'](_0xf45e5d['applications'],[_0xe41f('0x3f')],[_0xe41f('0x40')]);if(_0xf45e5d['account']&&_0xf45e5d[_0xe41f('0x35')][_0xe41f('0x41')]){_0xf45e5d[_0xe41f('0x3d')][_0xe41f('0x42')]({'id':0x0,'priority':_0xf45e5d[_0xe41f('0x3d')][_0xe41f('0x43')]+0x1,'app':_0xe41f('0x44'),'appdata':'autoclose','interval':_0xe41f('0x45')});}if(_0xf45e5d['account'][_0xe41f('0x39')]){delete _0xf45e5d[_0xe41f('0x35')][_0xe41f('0x39')];}if(_0xf45e5d['account'][_0xe41f('0x37')]){delete _0xf45e5d['account']['List'];}if(_0x1e8c2f[_0xe41f('0x37')][_0xe41f('0x46')][_0xe41f('0x43')]){return _0x1e8c2f['List'][_0xe41f('0x46')][0x0];}var _0x5cfd55=_['defaults'](_0x39ca34[_0xe41f('0x2e')],{'firstName':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x30')],'ListId':_0x1e8c2f[_0xe41f('0x47')]});_0x5cfd55[_0x39ca34['body'][_0xe41f('0x33')]]=_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x30')];return db[_0xe41f('0x2a')][_0xe41f('0x48')](_0x5cfd55);}else{throw new Error(_0xe41f('0x49'));}})[_0xe41f('0x23')](function(_0x568907){_0xf45e5d[_0xe41f('0x4a')]=_0x568907;if(_0x568907){if(!_0x39ca34['body'][_0xe41f('0x18')][_0xe41f('0x4b')]){_0x39ca34['body']['message'][_0xe41f('0x4b')]=rs[_0xe41f('0x4c')]()+'\x20'+_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')][_0xe41f('0x30')];}var _0x5f07fb={'ContactId':_0x568907['id'],'MailAccountId':_0x39ca34[_0xe41f('0x35')]['id'],'inReplyTo':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')][_0xe41f('0x4b')],'to':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')][_0xe41f('0x30')],'cc':_0x39ca34['body'][_0xe41f('0x18')]['cc'],'subject':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')]['subject'],'attach':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')]['attach'],'lastMsgAt':moment()[_0xe41f('0x4d')](_0xe41f('0x4e')),'lastMsgDirection':'in'};return db[_0xe41f('0x4f')][_0xe41f('0x25')]({'where':{'closed':![],'MailAccountId':_0x39ca34[_0xe41f('0x35')]['id']},'include':[{'model':db['MailMessage'],'as':_0xe41f('0x50'),'attributes':[_0xe41f('0x4b')],'where':{'messageId':_0x39ca34[_0xe41f('0x2e')]['message'][_0xe41f('0x51')]}}]})[_0xe41f('0x23')](function(_0x296b1f){if(_0x296b1f){return[_0x296b1f,![]];}return db[_0xe41f('0x4f')][_0xe41f('0x48')](_0x5f07fb)[_0xe41f('0x23')](function(_0x979c82){return[_0x979c82,!![]];});});}else{throw new Error(_0xe41f('0x52'));}})['spread'](function(_0x2449af,_0x297322){if(_0x2449af){_0x40b290=_0x297322;if(!_0x297322){return _0x2449af[_0xe41f('0x53')]({'inReplyTo':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')][_0xe41f('0x4b')],'to':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')][_0xe41f('0x30')],'cc':_0x39ca34['body'][_0xe41f('0x18')]['cc'],'subject':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')][_0xe41f('0x54')],'attach':_0x2449af[_0xe41f('0x55')]?_0x2449af[_0xe41f('0x55')]:_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')][_0xe41f('0x55')],'substatus':null,'substatusAt':moment()[_0xe41f('0x4d')](_0xe41f('0x4e')),'lastMsgAt':moment()[_0xe41f('0x4d')](_0xe41f('0x4e')),'lastMsgDirection':'in'});}else{return _0x2449af;}}})[_0xe41f('0x23')](function(_0x45d041){_0xf45e5d[_0xe41f('0x56')]=_0x45d041[_0xe41f('0x3b')]({'plain':!![]});_0xf45e5d[_0xe41f('0x56')][_0xe41f('0x57')]=_0x40b290;return db['MailMessage'][_0xe41f('0x48')]({'body':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x2e')],'MailAccountId':_0x39ca34[_0xe41f('0x35')]['id'],'MailInteractionId':_0x45d041['id'],'direction':'in','ContactId':_0xf45e5d['contact']['id'],'messageId':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')]['messageId'],'from':_0x39ca34[_0xe41f('0x2e')]['message'][_0xe41f('0x30')],'to':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')]['to'],'cc':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')]['cc'],'subject':_0x39ca34['body'][_0xe41f('0x18')][_0xe41f('0x54')],'attach':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')][_0xe41f('0x55')],'Attachments':_0x39ca34['body']['message']['attachments'],'originTo':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')][_0xe41f('0x58')],'originCc':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')][_0xe41f('0x59')],'bcc':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')][_0xe41f('0x5a')],'ChatWebsiteId':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')][_0xe41f('0x5b')]||null,'originChannel':_0x39ca34[_0xe41f('0x2e')]['message'][_0xe41f('0x5c')]||_0xe41f('0x5d'),'ChatOfflineMessageId':_0x39ca34[_0xe41f('0x2e')][_0xe41f('0x18')][_0xe41f('0x5e')]||null},{'include':[{'model':db[_0xe41f('0x5f')],'as':'Attachments'}]});})[_0xe41f('0x23')](function(_0x33b307){_0xf45e5d[_0xe41f('0x18')]=_0x33b307;if(_0xf45e5d[_0xe41f('0x56')][_0xe41f('0x60')]){return db[_0xe41f('0x61')][_0xe41f('0x25')]({'attributes':['id','name'],'where':{'id':_0xf45e5d[_0xe41f('0x56')][_0xe41f('0x60')]}})['then'](function(_0x71c4a3){if(_0x71c4a3){_0xf45e5d[_0xe41f('0x3d')][_0xe41f('0x62')]({'id':0x0,'priority':0x0,'app':_0xe41f('0x63'),'appdata':_0x71c4a3[_0xe41f('0x64')]+','+(_0xf45e5d[_0xe41f('0x35')][_0xe41f('0x65')]||0xa),'interval':_0xe41f('0x45')});}return respondWithRpcPromise(_0xe41f('0x66'),_0xe41f('0x67'),_0xf45e5d);});}return respondWithRpcPromise(_0xe41f('0x66'),_0xe41f('0x67'),_0xf45e5d);})['then'](function(_0x51bc53){_0x43c63a(_0x51bc53);})[_0xe41f('0x1a')](function(_0x1cf06c){_0xa42265(_0x52c900['error'](0x1f4,_0x1cf06c[_0xe41f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index aeb570e..7f8de92 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 _0x7461=['register','length','mailAccount:','./mailAccount.events','save','remove','update','removeListener'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0x7461,0xdb));var _0x1746=function(_0x4385ba,_0x21bb05){_0x4385ba=_0x4385ba-0x0;var _0xf089b1=_0x7461[_0x4385ba];return _0xf089b1;};'use strict';var MailAccountEvents=require(_0x1746('0x0'));var events=[_0x1746('0x1'),_0x1746('0x2'),_0x1746('0x3')];function createListener(_0x2fc60c,_0x5b396e){return function(_0x4c93cb){_0x5b396e['emit'](_0x2fc60c,_0x4c93cb);};}function removeListener(_0x4aa336,_0x89a445){return function(){MailAccountEvents[_0x1746('0x4')](_0x4aa336,_0x89a445);};}exports[_0x1746('0x5')]=function(_0x3c5416){for(var _0x2313d7=0x0,_0x165636=events[_0x1746('0x6')];_0x2313d7<_0x165636;_0x2313d7++){var _0x35946e=events[_0x2313d7];var _0x177aa8=createListener(_0x1746('0x7')+_0x35946e,_0x3c5416);MailAccountEvents['on'](_0x35946e,_0x177aa8);}}; \ No newline at end of file +var _0x1c2e=['save','remove','emit','removeListener','length'];(function(_0x513119,_0x425e6f){var _0x587511=function(_0x42d4f2){while(--_0x42d4f2){_0x513119['push'](_0x513119['shift']());}};_0x587511(++_0x425e6f);}(_0x1c2e,0x186));var _0xe1c2=function(_0x4f6e06,_0x4582bc){_0x4f6e06=_0x4f6e06-0x0;var _0x365c0d=_0x1c2e[_0x4f6e06];return _0x365c0d;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xe1c2('0x0'),_0xe1c2('0x1'),'update'];function createListener(_0x1ec5c3,_0xe6cc88){return function(_0x5aa6c2){_0xe6cc88[_0xe1c2('0x2')](_0x1ec5c3,_0x5aa6c2);};}function removeListener(_0x4dfb3d,_0xb769b3){return function(){MailAccountEvents[_0xe1c2('0x3')](_0x4dfb3d,_0xb769b3);};}exports['register']=function(_0x564500){for(var _0x1cf122=0x0,_0x16b09e=events[_0xe1c2('0x4')];_0x1cf122<_0x16b09e;_0x1cf122++){var _0x49fbff=events[_0x1cf122];var _0x48062d=createListener('mailAccount:'+_0x49fbff,_0x564500);MailAccountEvents['on'](_0x49fbff,_0x48062d);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 37d01dc..b5e8f9d 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 _0x4e1e=['path','fs-extra','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','put','update','destroy','exports','multer','util'];(function(_0x179451,_0x24d4f2){var _0x5d8ca9=function(_0x229f11){while(--_0x229f11){_0x179451['push'](_0x179451['shift']());}};_0x5d8ca9(++_0x24d4f2);}(_0x4e1e,0x1c5));var _0xe4e1=function(_0x5a7e78,_0x400b57){_0x5a7e78=_0x5a7e78-0x0;var _0xa8d4a1=_0x4e1e[_0x5a7e78];return _0xa8d4a1;};'use strict';var multer=require(_0xe4e1('0x0'));var util=require(_0xe4e1('0x1'));var path=require(_0xe4e1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe4e1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe4e1('0x4'));var config=require('../../config/environment');var controller=require(_0xe4e1('0x5'));router[_0xe4e1('0x6')](_0xe4e1('0x7'),auth[_0xe4e1('0x8')](),controller['show']);router[_0xe4e1('0x9')](_0xe4e1('0x7'),auth[_0xe4e1('0x8')](),controller[_0xe4e1('0xa')]);router['delete'](_0xe4e1('0x7'),auth[_0xe4e1('0x8')](),controller[_0xe4e1('0xb')]);module[_0xe4e1('0xc')]=router; \ No newline at end of file +var _0x48ba=['/:id','isAuthenticated','show','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get'];(function(_0x25110f,_0x125ee6){var _0x20f115=function(_0x50d7bf){while(--_0x50d7bf){_0x25110f['push'](_0x25110f['shift']());}};_0x20f115(++_0x125ee6);}(_0x48ba,0x196));var _0xa48b=function(_0x42ab52,_0x3db6a8){_0x42ab52=_0x42ab52-0x0;var _0xf3974a=_0x48ba[_0x42ab52];return _0xf3974a;};'use strict';var multer=require(_0xa48b('0x0'));var util=require(_0xa48b('0x1'));var path=require(_0xa48b('0x2'));var timeout=require(_0xa48b('0x3'));var express=require(_0xa48b('0x4'));var router=express[_0xa48b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa48b('0x6'));var interaction=require(_0xa48b('0x7'));var config=require('../../config/environment');var controller=require(_0xa48b('0x8'));router[_0xa48b('0x9')](_0xa48b('0xa'),auth[_0xa48b('0xb')](),controller[_0xa48b('0xc')]);router[_0xa48b('0xd')](_0xa48b('0xa'),auth[_0xa48b('0xb')](),controller['update']);router[_0xa48b('0xe')](_0xa48b('0xa'),auth[_0xa48b('0xb')](),controller[_0xa48b('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 1feefe6..bfa4144 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 _0x895a=['sequelize','exports','noop','TEXT','STRING'];(function(_0x332ef8,_0x27a02d){var _0x2ca59d=function(_0x1590ef){while(--_0x1590ef){_0x332ef8['push'](_0x332ef8['shift']());}};_0x2ca59d(++_0x27a02d);}(_0x895a,0x1a4));var _0xa895=function(_0x4dbe4f,_0x5043e6){_0x4dbe4f=_0x4dbe4f-0x0;var _0x144b41=_0x895a[_0x4dbe4f];return _0x144b41;};'use strict';var Sequelize=require(_0xa895('0x0'));module[_0xa895('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa895('0x2')},'appdata':{'type':Sequelize[_0xa895('0x3')]()},'description':{'type':Sequelize[_0xa895('0x4')]},'interval':{'type':Sequelize[_0xa895('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x20d3=['noop','TEXT','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x20d3,0xb9));var _0x320d=function(_0x33efbf,_0x18284a){_0x33efbf=_0x33efbf-0x0;var _0x3b6fe7=_0x20d3[_0x33efbf];return _0x3b6fe7;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x320d('0x0')],'allowNull':![],'defaultValue':_0x320d('0x1')},'appdata':{'type':Sequelize[_0x320d('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x320d('0x0')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 66c7248..0899ab8 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 _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x189228,_0x4ce03d){var _0x304248=function(_0x4c3e2e){while(--_0x4c3e2e){_0x189228['push'](_0x189228['shift']());}};_0x304248(++_0x4ce03d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0xc7ea8b,_0x3699b9){var _0x1adf2d=function(_0x489273){while(--_0x489273){_0xc7ea8b['push'](_0xc7ea8b['shift']());}};_0x1adf2d(++_0x3699b9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 63ff2f4..30c65b0 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 _0x221d=['request-promise','MailApplication','utf8mb4_unicode_ci','../../config/logger','api','bluebird'];(function(_0x4b3f6e,_0x477cb5){var _0x26569e=function(_0x25b2c5){while(--_0x25b2c5){_0x4b3f6e['push'](_0x4b3f6e['shift']());}};_0x26569e(++_0x477cb5);}(_0x221d,0x159));var _0xd221=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0x221d[_0x285824];return _0x311d7e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd221('0x0'))(_0xd221('0x1'));var moment=require('moment');var BPromise=require(_0xd221('0x2'));var rp=require(_0xd221('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module['exports']=function(_0x30e1f1,_0x290f63){return _0x30e1f1['define'](_0xd221('0x4'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd221('0x5')});}; \ No newline at end of file +var _0x13f0=['define','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0x13f0,0x15f));var _0x013f=function(_0x55888f,_0x2fbbd9){_0x55888f=_0x55888f-0x0;var _0x313e8e=_0x13f0[_0x55888f];return _0x313e8e;};'use strict';var _=require('lodash');var util=require(_0x013f('0x0'));var logger=require('../../config/logger')(_0x013f('0x1'));var moment=require('moment');var BPromise=require(_0x013f('0x2'));var rp=require(_0x013f('0x3'));var fs=require('fs');var path=require(_0x013f('0x4'));var rimraf=require(_0x013f('0x5'));var config=require(_0x013f('0x6'));var attributes=require(_0x013f('0x7'));module[_0x013f('0x8')]=function(_0x4344d5,_0x5b530d){return _0x4344d5[_0x013f('0x9')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x013f('0xa'),'collate':_0x013f('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 6e0d23f..074f250 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 _0x7f3b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','MailApplication','update','body','options','raw','where','limit','UpdateMailApplication','debug','stringify','lodash','moment'];(function(_0x574ce3,_0x59eef4){var _0x3447a0=function(_0x27f8cb){while(--_0x27f8cb){_0x574ce3['push'](_0x574ce3['shift']());}};_0x3447a0(++_0x59eef4);}(_0x7f3b,0x13e));var _0xb7f3=function(_0x46a598,_0x5b42eb){_0x46a598=_0x46a598-0x0;var _0x209224=_0x7f3b[_0x46a598];return _0x209224;};'use strict';var _=require(_0xb7f3('0x0'));var util=require('util');var moment=require(_0xb7f3('0x1'));var BPromise=require(_0xb7f3('0x2'));var rs=require(_0xb7f3('0x3'));var fs=require('fs');var Redis=require(_0xb7f3('0x4'));var db=require(_0xb7f3('0x5'))['db'];var utils=require(_0xb7f3('0x6'));var logger=require(_0xb7f3('0x7'))(_0xb7f3('0x8'));var config=require(_0xb7f3('0x9'));var jayson=require(_0xb7f3('0xa'));var client=jayson['client'][_0xb7f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x578631,_0x5dfd47,_0x18bc0b){return new BPromise(function(_0x51ee31,_0x382bf0){return client[_0xb7f3('0xc')](_0x578631,_0x18bc0b)[_0xb7f3('0xd')](function(_0x1b05ce){logger['info'](_0xb7f3('0xe'),_0x5dfd47,'request\x20sent');logger['debug'](_0xb7f3('0xf'),_0x5dfd47,_0xb7f3('0x10'),JSON['stringify'](_0x1b05ce));if(_0x1b05ce[_0xb7f3('0x11')]){if(_0x1b05ce[_0xb7f3('0x11')][_0xb7f3('0x12')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x5dfd47,_0x1b05ce[_0xb7f3('0x11')][_0xb7f3('0x13')]);return _0x382bf0(_0x1b05ce[_0xb7f3('0x11')][_0xb7f3('0x13')]);}logger['error'](_0xb7f3('0xe'),_0x5dfd47,_0x1b05ce[_0xb7f3('0x11')][_0xb7f3('0x13')]);return _0x51ee31(_0x1b05ce[_0xb7f3('0x11')][_0xb7f3('0x13')]);}else{logger[_0xb7f3('0x14')](_0xb7f3('0xe'),_0x5dfd47,_0xb7f3('0x10'));_0x51ee31(_0x1b05ce['result'][_0xb7f3('0x13')]);}})[_0xb7f3('0x15')](function(_0x343046){logger[_0xb7f3('0x11')](_0xb7f3('0xe'),_0x5dfd47,_0x343046);_0x382bf0(_0x343046);});});}exports['UpdateMailApplication']=function(_0x5a762f){var _0x4197a1=this;return new Promise(function(_0x5e9057,_0x158714){return db[_0xb7f3('0x16')][_0xb7f3('0x17')](_0x5a762f[_0xb7f3('0x18')],{'raw':_0x5a762f[_0xb7f3('0x19')]?_0x5a762f[_0xb7f3('0x19')][_0xb7f3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a762f[_0xb7f3('0x19')]?_0x5a762f[_0xb7f3('0x19')][_0xb7f3('0x1b')]||null:null,'attributes':_0x5a762f[_0xb7f3('0x19')]?_0x5a762f[_0xb7f3('0x19')]['attributes']||null:null,'limit':_0x5a762f['options']?_0x5a762f[_0xb7f3('0x19')][_0xb7f3('0x1c')]||null:null})[_0xb7f3('0xd')](function(_0x146952){logger['info'](_0xb7f3('0x1d'),_0x5a762f);logger[_0xb7f3('0x1e')](_0xb7f3('0x1d'),_0x5a762f,JSON[_0xb7f3('0x1f')](_0x146952));_0x5e9057(_0x146952);})[_0xb7f3('0x15')](function(_0x128c24){logger['error'](_0xb7f3('0x1d'),_0x128c24[_0xb7f3('0x13')],_0x5a762f);_0x158714(_0x4197a1[_0xb7f3('0x11')](0x1f4,_0x128c24[_0xb7f3('0x13')]));});});}; \ No newline at end of file +var _0x972a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','catch','UpdateMailApplication','update','options','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x972a,0xc5));var _0xa972=function(_0x3c9c05,_0x31f740){_0x3c9c05=_0x3c9c05-0x0;var _0x2f1d51=_0x972a[_0x3c9c05];return _0x2f1d51;};'use strict';var _=require(_0xa972('0x0'));var util=require(_0xa972('0x1'));var moment=require(_0xa972('0x2'));var BPromise=require('bluebird');var rs=require(_0xa972('0x3'));var fs=require('fs');var Redis=require(_0xa972('0x4'));var db=require(_0xa972('0x5'))['db'];var utils=require(_0xa972('0x6'));var logger=require(_0xa972('0x7'))(_0xa972('0x8'));var config=require(_0xa972('0x9'));var jayson=require(_0xa972('0xa'));var client=jayson[_0xa972('0xb')][_0xa972('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c8a0d,_0x3ca337,_0x5896d1){return new BPromise(function(_0x1ab352,_0x3a2edf){return client[_0xa972('0xd')](_0x5c8a0d,_0x5896d1)[_0xa972('0xe')](function(_0x1bcaea){logger[_0xa972('0xf')]('MailApplication,\x20%s,\x20%s',_0x3ca337,_0xa972('0x10'));logger[_0xa972('0x11')](_0xa972('0x12'),_0x3ca337,_0xa972('0x10'),JSON[_0xa972('0x13')](_0x1bcaea));if(_0x1bcaea[_0xa972('0x14')]){if(_0x1bcaea['error'][_0xa972('0x15')]===0x1f4){logger[_0xa972('0x14')](_0xa972('0x16'),_0x3ca337,_0x1bcaea[_0xa972('0x14')][_0xa972('0x17')]);return _0x3a2edf(_0x1bcaea['error'][_0xa972('0x17')]);}logger[_0xa972('0x14')](_0xa972('0x16'),_0x3ca337,_0x1bcaea['error'][_0xa972('0x17')]);return _0x1ab352(_0x1bcaea[_0xa972('0x14')][_0xa972('0x17')]);}else{logger[_0xa972('0xf')]('MailApplication,\x20%s,\x20%s',_0x3ca337,_0xa972('0x10'));_0x1ab352(_0x1bcaea['result'][_0xa972('0x17')]);}})[_0xa972('0x18')](function(_0xdccd40){logger[_0xa972('0x14')](_0xa972('0x16'),_0x3ca337,_0xdccd40);_0x3a2edf(_0xdccd40);});});}exports[_0xa972('0x19')]=function(_0xf8962c){var _0x2f5d61=this;return new Promise(function(_0x4d58d8,_0x4d741f){return db['MailApplication'][_0xa972('0x1a')](_0xf8962c['body'],{'raw':_0xf8962c[_0xa972('0x1b')]?_0xf8962c[_0xa972('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf8962c[_0xa972('0x1b')]?_0xf8962c[_0xa972('0x1b')]['where']||null:null,'attributes':_0xf8962c[_0xa972('0x1b')]?_0xf8962c[_0xa972('0x1b')]['attributes']||null:null,'limit':_0xf8962c[_0xa972('0x1b')]?_0xf8962c[_0xa972('0x1b')][_0xa972('0x1c')]||null:null})[_0xa972('0xe')](function(_0x1cb9d4){logger['info'](_0xa972('0x19'),_0xf8962c);logger[_0xa972('0x11')](_0xa972('0x19'),_0xf8962c,JSON[_0xa972('0x13')](_0x1cb9d4));_0x4d58d8(_0x1cb9d4);})[_0xa972('0x18')](function(_0x232184){logger['error']('UpdateMailApplication',_0x232184[_0xa972('0x17')],_0xf8962c);_0x4d741f(_0x2f5d61['error'](0x1f4,_0x232184['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 0bbe9cf..8c41641 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 _0xbcaf=['describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','mail','addTags','put','tracked','mailinteraction:update','update','mailinteraction:destroy','/:id/tags','exports','express','Router','./mailInteraction.controller','get','isAuthenticated','/describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbcaf,0x1ee));var _0xfbca=function(_0x46c30e,_0x745695){_0x46c30e=_0x46c30e-0x0;var _0x5e0c9e=_0xbcaf[_0x46c30e];return _0x5e0c9e;};'use strict';var express=require(_0xfbca('0x0'));var router=express[_0xfbca('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require(_0xfbca('0x2'));router[_0xfbca('0x3')]('/',auth[_0xfbca('0x4')](),controller['index']);router['get'](_0xfbca('0x5'),auth[_0xfbca('0x4')](),controller[_0xfbca('0x6')]);router['get'](_0xfbca('0x7'),auth[_0xfbca('0x4')](),controller[_0xfbca('0x8')]);router[_0xfbca('0x3')](_0xfbca('0x9'),auth[_0xfbca('0x4')](),controller[_0xfbca('0xa')]);router['get'](_0xfbca('0xb'),auth['isAuthenticated'](),controller[_0xfbca('0xc')]);router[_0xfbca('0xd')]('/',auth[_0xfbca('0x4')](),controller[_0xfbca('0xe')]);router[_0xfbca('0xd')](_0xfbca('0x9'),auth[_0xfbca('0x4')](),controller[_0xfbca('0xf')]);router['post']('/:id/tags',auth[_0xfbca('0x4')](),interaction['tracked'](_0xfbca('0x10'),'mailinteraction:addtags'),controller[_0xfbca('0x11')]);router[_0xfbca('0x12')](_0xfbca('0x7'),auth[_0xfbca('0x4')](),interaction[_0xfbca('0x13')](_0xfbca('0x10'),_0xfbca('0x14')),controller[_0xfbca('0x15')]);router['delete'](_0xfbca('0x7'),auth[_0xfbca('0x4')](),interaction[_0xfbca('0x13')](_0xfbca('0x10'),_0xfbca('0x16')),controller['destroy']);router['delete'](_0xfbca('0x17'),auth['isAuthenticated'](),controller['removeTags']);module[_0xfbca('0x18')]=router; \ No newline at end of file +var _0x54cf=['describe','/:id','show','/:id/messages','getMessages','download','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','mailinteraction:destroy','removeTags','express','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0xa05ac6,_0x4c0b52){var _0x56b76e=function(_0x29f4b0){while(--_0x29f4b0){_0xa05ac6['push'](_0xa05ac6['shift']());}};_0x56b76e(++_0x4c0b52);}(_0x54cf,0x1c5));var _0xf54c=function(_0x2afb17,_0xb56d2f){_0x2afb17=_0x2afb17-0x0;var _0x12c7a1=_0x54cf[_0x2afb17];return _0x12c7a1;};'use strict';var express=require(_0xf54c('0x0'));var router=express['Router']();var auth=require(_0xf54c('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0xf54c('0x2'));router[_0xf54c('0x3')]('/',auth[_0xf54c('0x4')](),controller[_0xf54c('0x5')]);router['get'](_0xf54c('0x6'),auth[_0xf54c('0x4')](),controller[_0xf54c('0x7')]);router[_0xf54c('0x3')](_0xf54c('0x8'),auth[_0xf54c('0x4')](),controller[_0xf54c('0x9')]);router['get'](_0xf54c('0xa'),auth[_0xf54c('0x4')](),controller[_0xf54c('0xb')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf54c('0xc')]);router['post']('/',auth[_0xf54c('0x4')](),controller['create']);router['post'](_0xf54c('0xa'),auth[_0xf54c('0x4')](),controller[_0xf54c('0xd')]);router['post'](_0xf54c('0xe'),auth[_0xf54c('0x4')](),interaction['tracked'](_0xf54c('0xf'),_0xf54c('0x10')),controller[_0xf54c('0x11')]);router['put'](_0xf54c('0x8'),auth['isAuthenticated'](),interaction['tracked']('mail','mailinteraction:update'),controller['update']);router['delete'](_0xf54c('0x8'),auth['isAuthenticated'](),interaction['tracked'](_0xf54c('0xf'),_0xf54c('0x12')),controller['destroy']);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0xf54c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 30af7a9..d8bda42 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 _0x58bd=['iconv','exports','DATE','STRING','TEXT','BOOLEAN','ENUM','out','sequelize'];(function(_0x5218cf,_0x3069cb){var _0x74576d=function(_0x2443e3){while(--_0x2443e3){_0x5218cf['push'](_0x5218cf['shift']());}};_0x74576d(++_0x3069cb);}(_0x58bd,0x18b));var _0xd58b=function(_0x42819f,_0x27911f){_0x42819f=_0x42819f-0x0;var _0x21fb56=_0x58bd[_0x42819f];return _0x21fb56;};'use strict';var Sequelize=require(_0xd58b('0x0'));var iconv=require(_0xd58b('0x1'));module[_0xd58b('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd58b('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd58b('0x4')]},'note':{'type':Sequelize[_0xd58b('0x4')]},'inReplyTo':{'type':Sequelize[_0xd58b('0x4')](0x1fe)},'to':{'type':Sequelize[_0xd58b('0x4')]},'cc':{'type':Sequelize[_0xd58b('0x5')]('long')},'subject':{'type':Sequelize[_0xd58b('0x5')]()},'attach':{'type':Sequelize[_0xd58b('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd58b('0x3')]},'substatus':{'type':Sequelize[_0xd58b('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xd58b('0x7')]('in',_0xd58b('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x567c=['out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x567c,0x8d));var _0xc567=function(_0xb0b922,_0x183826){_0xb0b922=_0xb0b922-0x0;var _0x5dc41e=_0x567c[_0xb0b922];return _0x5dc41e;};'use strict';var Sequelize=require(_0xc567('0x0'));var iconv=require(_0xc567('0x1'));module[_0xc567('0x2')]={'closed':{'type':Sequelize[_0xc567('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc567('0x4')]},'disposition':{'type':Sequelize[_0xc567('0x5')]},'secondDisposition':{'type':Sequelize[_0xc567('0x5')]},'thirdDisposition':{'type':Sequelize[_0xc567('0x5')]},'note':{'type':Sequelize[_0xc567('0x5')]},'inReplyTo':{'type':Sequelize[_0xc567('0x5')](0x1fe)},'to':{'type':Sequelize[_0xc567('0x5')]},'cc':{'type':Sequelize[_0xc567('0x6')](_0xc567('0x7'))},'subject':{'type':Sequelize[_0xc567('0x6')]()},'attach':{'type':Sequelize[_0xc567('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc567('0x4')]},'substatus':{'type':Sequelize[_0xc567('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xc567('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc567('0x8')]('in',_0xc567('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc567('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xc567('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc567('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 261785e..bb4990a 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 _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xb10b,0x12a));var _0xbb10=function(_0x6a27db,_0x2731a7){_0x6a27db=_0x6a27db-0x0;var _0xd814f5=_0xb10b[_0x6a27db];return _0xd814f5;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,null));}; \ No newline at end of file +var _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b142f,_0x10815a){_0x5b142f=_0x5b142f-0x0;var _0x327bbd=_0xb10b[_0x5b142f];return _0x327bbd;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 903b4e7..f933d68 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 _0x7762=['findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','save','update','remove','getUsers','then','Users'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x7762,0x117));var _0x2776=function(_0x3e4b95,_0x77d661){_0x3e4b95=_0x3e4b95-0x0;var _0x30f1b3=_0x7762[_0x3e4b95];return _0x30f1b3;};'use strict';var EventEmitter=require(_0x2776('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x2776('0x1')];var MailMessage=require(_0x2776('0x2'))['db'][_0x2776('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2776('0x4'),'afterUpdate':_0x2776('0x5'),'afterDestroy':_0x2776('0x6')};function emitEvent(_0x498bce){return function(_0x414c23,_0x546f43,_0x35c57a){_0x414c23[_0x2776('0x7')]({'attributes':['id'],'raw':!![]})[_0x2776('0x8')](function(_0x28b1be){_0x414c23['setDataValue'](_0x2776('0x9'),_0x28b1be['map'](function(_0x515e70){return{'id':_0x515e70['id']};}));return MailMessage[_0x2776('0xa')]({'where':{'MailInteractionId':_0x414c23['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2776('0x8')](function(_0x14ca67){_0x414c23['setDataValue'](_0x2776('0xb'),_0x14ca67[_0x2776('0xc')]);MailInteractionEvents[_0x2776('0xd')](_0x498bce+':'+_0x414c23['id'],_0x414c23);MailInteractionEvents[_0x2776('0xd')](_0x498bce,_0x414c23);_0x35c57a(null);})['catch'](_0x35c57a(null));};}for(var e in events){if(events[_0x2776('0xe')](e)){var event=events[e];MailInteraction[_0x2776('0xf')](e,emitEvent(event));}}module[_0x2776('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x9b44=['../../mysqldb','MailInteraction','MailMessage','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events'];(function(_0x553145,_0x4f9ab8){var _0x11cfbd=function(_0x2e7702){while(--_0x2e7702){_0x553145['push'](_0x553145['shift']());}};_0x11cfbd(++_0x4f9ab8);}(_0x9b44,0x1c7));var _0x49b4=function(_0x5b3b9b,_0x1c71b0){_0x5b3b9b=_0x5b3b9b-0x0;var _0x47c1d7=_0x9b44[_0x5b3b9b];return _0x47c1d7;};'use strict';var EventEmitter=require(_0x49b4('0x0'));var MailInteraction=require(_0x49b4('0x1'))['db'][_0x49b4('0x2')];var MailMessage=require(_0x49b4('0x1'))['db'][_0x49b4('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x49b4('0x4'),'afterUpdate':_0x49b4('0x5'),'afterDestroy':_0x49b4('0x6')};function emitEvent(_0x4fbc0a){return function(_0x526ac8,_0x19ea34,_0x1bc842){_0x526ac8[_0x49b4('0x7')]({'attributes':['id'],'raw':!![]})[_0x49b4('0x8')](function(_0x567354){_0x526ac8['setDataValue'](_0x49b4('0x9'),_0x567354[_0x49b4('0xa')](function(_0x5dd406){return{'id':_0x5dd406['id']};}));return MailMessage[_0x49b4('0xb')]({'where':{'MailInteractionId':_0x526ac8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x49b4('0x8')](function(_0x5477ea){_0x526ac8[_0x49b4('0xc')](_0x49b4('0xd'),_0x5477ea[_0x49b4('0xe')]);MailInteractionEvents[_0x49b4('0xf')](_0x4fbc0a+':'+_0x526ac8['id'],_0x526ac8);MailInteractionEvents[_0x49b4('0xf')](_0x4fbc0a,_0x526ac8);_0x1bc842(null);})['catch'](_0x1bc842(null));};}for(var e in events){if(events[_0x49b4('0x10')](e)){var event=events[e];MailInteraction[_0x49b4('0x11')](e,emitEvent(event));}}module[_0x49b4('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index f23122e..1b80861 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 _0xb185=['closedAt','changed','substatus','models','get','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xb185,0xb7));var _0x5b18=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xb185[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x5b18('0x0'));var util=require(_0x5b18('0x1'));var logger=require(_0x5b18('0x2'))(_0x5b18('0x3'));var moment=require('moment');var BPromise=require(_0x5b18('0x4'));var rp=require(_0x5b18('0x5'));var fs=require('fs');var path=require(_0x5b18('0x6'));var rimraf=require(_0x5b18('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b18('0x8'));module[_0x5b18('0x9')]=function(_0x92d565,_0x2871fe){return _0x92d565[_0x5b18('0xa')](_0x5b18('0xb'),attributes,{'tableName':_0x5b18('0xc'),'paranoid':![],'indexes':[{'name':_0x5b18('0xd'),'fields':[_0x5b18('0xe'),'to'],'type':_0x5b18('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4f01ba,_0x18bdc1,_0x1c88e5){if(_0x4f01ba['substatus']){_0x4f01ba[_0x5b18('0x10')]=moment()[_0x5b18('0x11')](_0x5b18('0x12'));}if(_0x4f01ba[_0x5b18('0x13')]){_0x4f01ba[_0x5b18('0x14')]=moment()[_0x5b18('0x11')](_0x5b18('0x12'));}_0x1c88e5(null,_0x18bdc1);},'beforeUpdate':function(_0x3d8ed3,_0x9e5812,_0x5b361a){if(_0x3d8ed3[_0x5b18('0x15')]('substatus')){_0x3d8ed3['substatusAt']=_0x3d8ed3['substatus']?moment()[_0x5b18('0x11')](_0x5b18('0x12')):null;}if(_0x3d8ed3[_0x5b18('0x15')](_0x5b18('0x13'))){_0x3d8ed3[_0x5b18('0x14')]=moment()[_0x5b18('0x11')](_0x5b18('0x12'));_0x3d8ed3[_0x5b18('0x16')]=null;_0x3d8ed3[_0x5b18('0x10')]=null;}_0x5b361a(null,_0x3d8ed3);},'afterUpdate':function(_0x1fe37b,_0x153542,_0x244757){var _0x4b1b61=_0x92d565[_0x5b18('0x17')];var _0x1bad31=_0x1fe37b[_0x5b18('0x18')]({'plain':!![]});if(_0x1bad31[_0x5b18('0x13')]){return _0x4b1b61['MailMessage'][_0x5b18('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x1bad31['id']}})[_0x5b18('0x1a')](function(){_0x244757();})['catch'](function(_0x287a57){_0x244757(_0x287a57);});}else{_0x244757();}}},'charset':_0x5b18('0x1b'),'collate':_0x5b18('0x1c')});}; \ No newline at end of file +var _0x8e8c=['substatusAt','closed','get','MailMessage','update','catch','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','substatus'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0x8e8c,0x1bb));var _0xc8e8=function(_0x478e2f,_0xcc2041){_0x478e2f=_0x478e2f-0x0;var _0x4b088d=_0x8e8c[_0x478e2f];return _0x4b088d;};'use strict';var _=require(_0xc8e8('0x0'));var util=require(_0xc8e8('0x1'));var logger=require(_0xc8e8('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc8e8('0x3'));var rp=require(_0xc8e8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8e8('0x5'));var config=require(_0xc8e8('0x6'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x11a433,_0x8311e5){return _0x11a433[_0xc8e8('0x7')](_0xc8e8('0x8'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xc8e8('0x9'),'fields':[_0xc8e8('0xa'),'to'],'type':_0xc8e8('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x351cca,_0x1f6d93,_0x421236){if(_0x351cca['substatus']){_0x351cca['substatusAt']=moment()[_0xc8e8('0xc')](_0xc8e8('0xd'));}if(_0x351cca['closed']){_0x351cca[_0xc8e8('0xe')]=moment()[_0xc8e8('0xc')](_0xc8e8('0xd'));}_0x421236(null,_0x1f6d93);},'beforeUpdate':function(_0x56e5f7,_0x505c6b,_0x3a1324){if(_0x56e5f7[_0xc8e8('0xf')](_0xc8e8('0x10'))){_0x56e5f7[_0xc8e8('0x11')]=_0x56e5f7['substatus']?moment()[_0xc8e8('0xc')](_0xc8e8('0xd')):null;}if(_0x56e5f7['changed'](_0xc8e8('0x12'))){_0x56e5f7[_0xc8e8('0xe')]=moment()[_0xc8e8('0xc')](_0xc8e8('0xd'));_0x56e5f7[_0xc8e8('0x10')]=null;_0x56e5f7[_0xc8e8('0x11')]=null;}_0x3a1324(null,_0x56e5f7);},'afterUpdate':function(_0x43a554,_0x3f8499,_0x3c317c){var _0x1ffbb6=_0x11a433['models'];var _0x1fab00=_0x43a554[_0xc8e8('0x13')]({'plain':!![]});if(_0x1fab00['closed']){return _0x1ffbb6[_0xc8e8('0x14')][_0xc8e8('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x1fab00['id']}})['then'](function(){_0x3c317c();})[_0xc8e8('0x16')](function(_0x1729f7){_0x3c317c(_0x1729f7);});}else{_0x3c317c();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 6de97d7..760fadc 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 _0x8cad=['localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','AddTagsToMailInteraction','find','where','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x5bafd7,_0x253fd3){var _0x47dc4d=function(_0x15d11e){while(--_0x15d11e){_0x5bafd7['push'](_0x5bafd7['shift']());}};_0x47dc4d(++_0x253fd3);}(_0x8cad,0xfe));var _0xd8ca=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x8cad[_0x368fb9];return _0x4892fb;};'use strict';var _=require(_0xd8ca('0x0'));var util=require(_0xd8ca('0x1'));var moment=require(_0xd8ca('0x2'));var BPromise=require(_0xd8ca('0x3'));var rs=require(_0xd8ca('0x4'));var fs=require('fs');var Redis=require(_0xd8ca('0x5'));var db=require(_0xd8ca('0x6'))['db'];var utils=require(_0xd8ca('0x7'));var logger=require(_0xd8ca('0x8'))(_0xd8ca('0x9'));var config=require(_0xd8ca('0xa'));var jayson=require(_0xd8ca('0xb'));var client=jayson[_0xd8ca('0xc')][_0xd8ca('0xd')]({'port':0x232a});config['redis']=_[_0xd8ca('0xe')](config[_0xd8ca('0xf')],{'host':_0xd8ca('0x10'),'port':0x18eb});var socket=require(_0xd8ca('0x11'))(new Redis(config[_0xd8ca('0xf')]));require('./mailInteraction.socket')[_0xd8ca('0x12')](socket);function respondWithRpcPromise(_0x4db932,_0x225d7a,_0x8476e7){return new BPromise(function(_0x1f41d8,_0x38fa7e){return client[_0xd8ca('0x13')](_0x4db932,_0x8476e7)[_0xd8ca('0x14')](function(_0x554bf6){logger[_0xd8ca('0x15')](_0xd8ca('0x16'),_0x225d7a,_0xd8ca('0x17'));logger[_0xd8ca('0x18')](_0xd8ca('0x19'),_0x225d7a,_0xd8ca('0x17'),JSON[_0xd8ca('0x1a')](_0x554bf6));if(_0x554bf6[_0xd8ca('0x1b')]){if(_0x554bf6[_0xd8ca('0x1b')]['code']===0x1f4){logger[_0xd8ca('0x1b')](_0xd8ca('0x16'),_0x225d7a,_0x554bf6[_0xd8ca('0x1b')][_0xd8ca('0x1c')]);return _0x38fa7e(_0x554bf6[_0xd8ca('0x1b')][_0xd8ca('0x1c')]);}logger[_0xd8ca('0x1b')](_0xd8ca('0x16'),_0x225d7a,_0x554bf6[_0xd8ca('0x1b')][_0xd8ca('0x1c')]);return _0x1f41d8(_0x554bf6['error'][_0xd8ca('0x1c')]);}else{logger[_0xd8ca('0x15')](_0xd8ca('0x16'),_0x225d7a,_0xd8ca('0x17'));_0x1f41d8(_0x554bf6['result']['message']);}})[_0xd8ca('0x1d')](function(_0x570b65){logger[_0xd8ca('0x1b')](_0xd8ca('0x16'),_0x225d7a,_0x570b65);_0x38fa7e(_0x570b65);});});}exports[_0xd8ca('0x1e')]=function(_0x35bb60){var _0x3063e1=this;return new Promise(function(_0x1cd349,_0x56ea7e){return db[_0xd8ca('0x1f')][_0xd8ca('0x20')](_0x35bb60[_0xd8ca('0x21')],{'raw':_0x35bb60[_0xd8ca('0x22')]?_0x35bb60['options'][_0xd8ca('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35bb60[_0xd8ca('0x22')]?_0x35bb60[_0xd8ca('0x22')]['where']||null:null,'attributes':_0x35bb60[_0xd8ca('0x22')]?_0x35bb60[_0xd8ca('0x22')][_0xd8ca('0x24')]||null:null,'limit':_0x35bb60[_0xd8ca('0x22')]?_0x35bb60[_0xd8ca('0x22')][_0xd8ca('0x25')]||null:null})[_0xd8ca('0x14')](function(_0x508562){logger[_0xd8ca('0x15')](_0xd8ca('0x1e'),_0x35bb60);logger['debug'](_0xd8ca('0x1e'),_0x35bb60,JSON[_0xd8ca('0x1a')](_0x508562));_0x1cd349(_0x508562);})[_0xd8ca('0x1d')](function(_0xaeff64){logger[_0xd8ca('0x1b')](_0xd8ca('0x1e'),_0xaeff64['message'],_0x35bb60);_0x56ea7e(_0x3063e1[_0xd8ca('0x1b')](0x1f4,_0xaeff64['message']));});});};exports[_0xd8ca('0x26')]=function(_0x440a6a){return new Promise(function(_0x508dab,_0x5260c3){return db[_0xd8ca('0x1f')][_0xd8ca('0x27')]({'where':_0x440a6a[_0xd8ca('0x22')]?_0x440a6a[_0xd8ca('0x22')][_0xd8ca('0x28')]||null:null})[_0xd8ca('0x14')](function(_0x1eca24){if(_0x1eca24){return _0x1eca24[_0xd8ca('0x29')](_0x440a6a['body'][_0xd8ca('0x2a')],_[_0xd8ca('0x2b')](_0x440a6a[_0xd8ca('0x21')],['ids','id'])||{});}})['spread'](function(_0xbab65){logger[_0xd8ca('0x15')](_0xd8ca('0x2c'),_0x440a6a);logger[_0xd8ca('0x18')](_0xd8ca('0x2c'),_0x440a6a,JSON[_0xd8ca('0x1a')](_0xbab65));_0x508dab(_0xbab65);})[_0xd8ca('0x1d')](function(_0x127cc6){logger['error'](_0xd8ca('0x2c'),_0x127cc6[_0xd8ca('0x1c')],_0x440a6a);_0x5260c3(_this[_0xd8ca('0x1b')](0x1f4,_0x127cc6[_0xd8ca('0x1c')]));});});}; \ No newline at end of file +var _0x4b5b=['../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','MailInteraction','body','options','raw','where','limit','UpdateMailInteraction','AddTagsToMailInteraction','omit','ids','spread','AddTags','stringify','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x39bbf3,_0x12e715){var _0x478028=function(_0x3d7f55){while(--_0x3d7f55){_0x39bbf3['push'](_0x39bbf3['shift']());}};_0x478028(++_0x12e715);}(_0x4b5b,0x1c1));var _0xb4b5=function(_0x3b167a,_0x48e8e3){_0x3b167a=_0x3b167a-0x0;var _0x43509d=_0x4b5b[_0x3b167a];return _0x43509d;};'use strict';var _=require('lodash');var util=require(_0xb4b5('0x0'));var moment=require(_0xb4b5('0x1'));var BPromise=require(_0xb4b5('0x2'));var rs=require(_0xb4b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb4b5('0x4'));var logger=require(_0xb4b5('0x5'))(_0xb4b5('0x6'));var config=require(_0xb4b5('0x7'));var jayson=require(_0xb4b5('0x8'));var client=jayson['client'][_0xb4b5('0x9')]({'port':0x232a});config[_0xb4b5('0xa')]=_[_0xb4b5('0xb')](config[_0xb4b5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb4b5('0xc'))(new Redis(config[_0xb4b5('0xa')]));require(_0xb4b5('0xd'))[_0xb4b5('0xe')](socket);function respondWithRpcPromise(_0x53c9f8,_0x59d6e0,_0x2c404c){return new BPromise(function(_0x4e7fb2,_0x43d056){return client[_0xb4b5('0xf')](_0x53c9f8,_0x2c404c)[_0xb4b5('0x10')](function(_0x261404){logger[_0xb4b5('0x11')](_0xb4b5('0x12'),_0x59d6e0,_0xb4b5('0x13'));logger[_0xb4b5('0x14')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x59d6e0,_0xb4b5('0x13'),JSON['stringify'](_0x261404));if(_0x261404[_0xb4b5('0x15')]){if(_0x261404[_0xb4b5('0x15')][_0xb4b5('0x16')]===0x1f4){logger['error'](_0xb4b5('0x12'),_0x59d6e0,_0x261404[_0xb4b5('0x15')]['message']);return _0x43d056(_0x261404[_0xb4b5('0x15')]['message']);}logger[_0xb4b5('0x15')](_0xb4b5('0x12'),_0x59d6e0,_0x261404[_0xb4b5('0x15')][_0xb4b5('0x17')]);return _0x4e7fb2(_0x261404[_0xb4b5('0x15')][_0xb4b5('0x17')]);}else{logger[_0xb4b5('0x11')]('MailInteraction,\x20%s,\x20%s',_0x59d6e0,_0xb4b5('0x13'));_0x4e7fb2(_0x261404['result'][_0xb4b5('0x17')]);}})[_0xb4b5('0x18')](function(_0x3e5a9a){logger[_0xb4b5('0x15')](_0xb4b5('0x12'),_0x59d6e0,_0x3e5a9a);_0x43d056(_0x3e5a9a);});});}exports['UpdateMailInteraction']=function(_0x5a3d11){var _0x17bb0d=this;return new Promise(function(_0x224e60,_0x52f964){return db[_0xb4b5('0x19')]['update'](_0x5a3d11[_0xb4b5('0x1a')],{'raw':_0x5a3d11[_0xb4b5('0x1b')]?_0x5a3d11['options'][_0xb4b5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a3d11['options']?_0x5a3d11[_0xb4b5('0x1b')][_0xb4b5('0x1d')]||null:null,'attributes':_0x5a3d11[_0xb4b5('0x1b')]?_0x5a3d11[_0xb4b5('0x1b')]['attributes']||null:null,'limit':_0x5a3d11['options']?_0x5a3d11['options'][_0xb4b5('0x1e')]||null:null})[_0xb4b5('0x10')](function(_0x11e864){logger['info']('UpdateMailInteraction',_0x5a3d11);logger[_0xb4b5('0x14')](_0xb4b5('0x1f'),_0x5a3d11,JSON['stringify'](_0x11e864));_0x224e60(_0x11e864);})['catch'](function(_0x36cac0){logger[_0xb4b5('0x15')]('UpdateMailInteraction',_0x36cac0['message'],_0x5a3d11);_0x52f964(_0x17bb0d[_0xb4b5('0x15')](0x1f4,_0x36cac0[_0xb4b5('0x17')]));});});};exports[_0xb4b5('0x20')]=function(_0x560abb){return new Promise(function(_0x192b96,_0x3987ae){return db['MailInteraction']['find']({'where':_0x560abb['options']?_0x560abb[_0xb4b5('0x1b')]['where']||null:null})[_0xb4b5('0x10')](function(_0x3072da){if(_0x3072da){return _0x3072da['addTags'](_0x560abb['body']['ids'],_[_0xb4b5('0x21')](_0x560abb[_0xb4b5('0x1a')],[_0xb4b5('0x22'),'id'])||{});}})[_0xb4b5('0x23')](function(_0x2385de){logger[_0xb4b5('0x11')](_0xb4b5('0x24'),_0x560abb);logger[_0xb4b5('0x14')](_0xb4b5('0x24'),_0x560abb,JSON[_0xb4b5('0x25')](_0x2385de));_0x192b96(_0x2385de);})['catch'](function(_0x2e4d56){logger[_0xb4b5('0x15')](_0xb4b5('0x24'),_0x2e4d56['message'],_0x560abb);_0x3987ae(_this[_0xb4b5('0x15')](0x1f4,_0x2e4d56['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a047421..db49f53 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 _0x6697=['update','emit','removeListener','register','length','mailInteraction:','remove'];(function(_0x5b1b8a,_0x53defb){var _0x1f8207=function(_0x2ea1af){while(--_0x2ea1af){_0x5b1b8a['push'](_0x5b1b8a['shift']());}};_0x1f8207(++_0x53defb);}(_0x6697,0x19c));var _0x7669=function(_0x340d75,_0x561cb0){_0x340d75=_0x340d75-0x0;var _0x3f1114=_0x6697[_0x340d75];return _0x3f1114;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0x7669('0x0'),_0x7669('0x1')];function createListener(_0x21e4a2,_0x2b6593){return function(_0x1670cc){_0x2b6593[_0x7669('0x2')](_0x21e4a2,_0x1670cc);};}function removeListener(_0x4b7b43,_0x1dec4f){return function(){MailInteractionEvents[_0x7669('0x3')](_0x4b7b43,_0x1dec4f);};}exports[_0x7669('0x4')]=function(_0x193511){for(var _0x1bfb19=0x0,_0x5bbf73=events[_0x7669('0x5')];_0x1bfb19<_0x5bbf73;_0x1bfb19++){var _0x2c2740=events[_0x1bfb19];var _0x346700=createListener(_0x7669('0x6')+_0x2c2740,_0x193511);MailInteractionEvents['on'](_0x2c2740,_0x346700);}}; \ No newline at end of file +var _0xe21c=['remove','update','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0xe21c,0x141));var _0xce21=function(_0x3f465d,_0xbd2037){_0x3f465d=_0x3f465d-0x0;var _0x121ad1=_0xe21c[_0x3f465d];return _0x121ad1;};'use strict';var MailInteractionEvents=require(_0xce21('0x0'));var events=['save',_0xce21('0x1'),_0xce21('0x2')];function createListener(_0x2ee475,_0x1f649a){return function(_0x50d841){_0x1f649a['emit'](_0x2ee475,_0x50d841);};}function removeListener(_0x427900,_0x280216){return function(){MailInteractionEvents[_0xce21('0x3')](_0x427900,_0x280216);};}exports[_0xce21('0x4')]=function(_0x1f89b4){for(var _0x176e6f=0x0,_0x380718=events[_0xce21('0x5')];_0x176e6f<_0x380718;_0x176e6f++){var _0x199f64=events[_0x176e6f];var _0x38012e=createListener(_0xce21('0x6')+_0x199f64,_0x1f89b4);MailInteractionEvents['on'](_0x199f64,_0x38012e);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 4bb85c7..0c7b8ba 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 _0xc8ce=['fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0xc8ce,0x176));var _0xec8c=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc8ce[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xec8c('0x0'));var util=require('util');var path=require(_0xec8c('0x1'));var timeout=require(_0xec8c('0x2'));var express=require('express');var router=express[_0xec8c('0x3')]();var fs_extra=require(_0xec8c('0x4'));var auth=require(_0xec8c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xec8c('0x6'));var controller=require(_0xec8c('0x7'));router[_0xec8c('0x8')]('/',auth[_0xec8c('0x9')](),controller['index']);router['get'](_0xec8c('0xa'),auth[_0xec8c('0x9')](),controller[_0xec8c('0xb')]);router[_0xec8c('0x8')](_0xec8c('0xc'),auth[_0xec8c('0x9')](),controller[_0xec8c('0xd')]);router[_0xec8c('0x8')](_0xec8c('0xe'),auth[_0xec8c('0x9')](),controller[_0xec8c('0xf')]);router[_0xec8c('0x10')]('/',auth[_0xec8c('0x9')](),interaction[_0xec8c('0x11')](_0xec8c('0x12'),_0xec8c('0x13')),controller['create']);router[_0xec8c('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xec8c('0x15')]);router[_0xec8c('0x14')](_0xec8c('0x16'),auth[_0xec8c('0x9')](),controller['accept']);router[_0xec8c('0x14')](_0xec8c('0x17'),auth[_0xec8c('0x9')](),controller[_0xec8c('0x18')]);router['delete']('/:id',auth[_0xec8c('0x9')](),controller[_0xec8c('0x19')]);module[_0xec8c('0x1a')]=router; \ No newline at end of file +var _0x9010=['show','/:id/download','download','post','tracked','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x558fdd,_0x3fefc4){var _0x5cfa52=function(_0x35ab84){while(--_0x35ab84){_0x558fdd['push'](_0x558fdd['shift']());}};_0x5cfa52(++_0x3fefc4);}(_0x9010,0xdf));var _0x0901=function(_0x54b847,_0x3f240f){_0x54b847=_0x54b847-0x0;var _0x1b21c9=_0x9010[_0x54b847];return _0x1b21c9;};'use strict';var multer=require(_0x0901('0x0'));var util=require(_0x0901('0x1'));var path=require(_0x0901('0x2'));var timeout=require(_0x0901('0x3'));var express=require(_0x0901('0x4'));var router=express[_0x0901('0x5')]();var fs_extra=require(_0x0901('0x6'));var auth=require(_0x0901('0x7'));var interaction=require(_0x0901('0x8'));var config=require(_0x0901('0x9'));var controller=require(_0x0901('0xa'));router['get']('/',auth[_0x0901('0xb')](),controller[_0x0901('0xc')]);router[_0x0901('0xd')](_0x0901('0xe'),auth[_0x0901('0xb')](),controller[_0x0901('0xf')]);router['get'](_0x0901('0x10'),auth['isAuthenticated'](),controller[_0x0901('0x11')]);router['get'](_0x0901('0x12'),auth[_0x0901('0xb')](),controller[_0x0901('0x13')]);router[_0x0901('0x14')]('/',auth[_0x0901('0xb')](),interaction[_0x0901('0x15')]('mail','mailmessage:create'),controller['create']);router[_0x0901('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0901('0x17')]);router[_0x0901('0x16')](_0x0901('0x18'),auth[_0x0901('0xb')](),controller[_0x0901('0x19')]);router[_0x0901('0x16')](_0x0901('0x1a'),auth[_0x0901('0xb')](),controller['reject']);router[_0x0901('0x1b')](_0x0901('0x10'),auth['isAuthenticated'](),controller[_0x0901('0x1c')]);module[_0x0901('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index c8efff5..0d2ea8f 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 _0x63a1=['Email','Chat','lodash','exports','TEXT','long','medium','BOOLEAN','out','STRING','DATE','INTEGER','ENUM'];(function(_0x4473be,_0x529ba7){var _0x4a2ede=function(_0x422651){while(--_0x422651){_0x4473be['push'](_0x4473be['shift']());}};_0x4a2ede(++_0x529ba7);}(_0x63a1,0xdf));var _0x163a=function(_0xbe1df4,_0x3a637c){_0xbe1df4=_0xbe1df4-0x0;var _0x42f469=_0x63a1[_0xbe1df4];return _0x42f469;};'use strict';var Sequelize=require('sequelize');var _=require(_0x163a('0x0'));module[_0x163a('0x1')]={'body':{'type':Sequelize[_0x163a('0x2')](_0x163a('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x163a('0x4'))},'read':{'type':Sequelize[_0x163a('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x163a('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x163a('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x163a('0x3'))},'cc':{'type':Sequelize[_0x163a('0x2')]('long')},'bcc':{'type':Sequelize['TEXT'](_0x163a('0x3'))},'subject':{'type':Sequelize[_0x163a('0x2')]},'sentAt':{'type':Sequelize[_0x163a('0x8')]},'attach':{'type':Sequelize[_0x163a('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x163a('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x163a('0x8')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x163a('0x2')](_0x163a('0x3'))},'originChannel':{'type':Sequelize[_0x163a('0xa')](_0x163a('0xb'),_0x163a('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xe630=['exports','long','TEXT','medium','BOOLEAN','ENUM','out','STRING','INTEGER','DATE','Email','Chat','sequelize'];(function(_0x4d62eb,_0x44af16){var _0x563662=function(_0x131b16){while(--_0x131b16){_0x4d62eb['push'](_0x4d62eb['shift']());}};_0x563662(++_0x44af16);}(_0xe630,0xb5));var _0x0e63=function(_0x23e9d4,_0x1063fd){_0x23e9d4=_0x23e9d4-0x0;var _0x4ab2b0=_0xe630[_0x23e9d4];return _0x4ab2b0;};'use strict';var Sequelize=require(_0x0e63('0x0'));var _=require('lodash');module[_0x0e63('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0e63('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x0e63('0x3')](_0x0e63('0x4'))},'read':{'type':Sequelize[_0x0e63('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0e63('0x6')]('in','out'),'defaultValue':_0x0e63('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0e63('0x8')](0x1fe)},'from':{'type':Sequelize[_0x0e63('0x8')]},'to':{'type':Sequelize[_0x0e63('0x3')](_0x0e63('0x2'))},'cc':{'type':Sequelize[_0x0e63('0x3')](_0x0e63('0x2'))},'bcc':{'type':Sequelize[_0x0e63('0x3')](_0x0e63('0x2'))},'subject':{'type':Sequelize[_0x0e63('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x0e63('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x0e63('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x0e63('0xa')]},'originTo':{'type':Sequelize[_0x0e63('0x3')]('long')},'originCc':{'type':Sequelize[_0x0e63('0x3')](_0x0e63('0x2'))},'originChannel':{'type':Sequelize[_0x0e63('0x6')](_0x0e63('0xb'),_0x0e63('0xc')),'defaultValue':_0x0e63('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 6b8937d..68c4361 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 _0xe92e=['length','model','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','MailMessage','include','findAll','show','params','keys','fields','find','body','describe','create','direction','out','secret','MailAccount','MailAccountId','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','host','port','secure','authentication','auth','user','pass','service','attachments','join','root','server/files/attachments','basename','defaults','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','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','stringify','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','User','interface','rejectmessage','unix','toString','server','tmp','files','format','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','util','lodash','html-to-text','api','../../config/logger','redis','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','offset','undefined','limit','count','json','update','destroy','status','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes'];(function(_0x42bc9b,_0x58e21e){var _0x3a2c5a=function(_0x3822c6){while(--_0x3822c6){_0x42bc9b['push'](_0x42bc9b['shift']());}};_0x3a2c5a(++_0x58e21e);}(_0xe92e,0x1b6));var _0xee92=function(_0x1ac86e,_0x3bdb36){_0x1ac86e=_0x1ac86e-0x0;var _0x95909f=_0xe92e[_0x1ac86e];return _0x95909f;};'use strict';var emlformat=require(_0xee92('0x0'));var moment=require(_0xee92('0x1'));var BPromise=require('bluebird');var util=require(_0xee92('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xee92('0x3'));var Redis=require('ioredis');var htmlToText=require(_0xee92('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xee92('0x5'));var interaction_log=require(_0xee92('0x6'))('mail-interactions');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xee92('0x7')]=_['defaults'](config[_0xee92('0x7')],{'host':_0xee92('0x8'),'port':0x18eb});var socket=require(_0xee92('0x9'))(new Redis(config['redis']));require(_0xee92('0xa'))['register'](socket);var jayson=require(_0xee92('0xb'));var client=jayson[_0xee92('0xc')][_0xee92('0xd')]({'port':0x232c});var client9003=jayson[_0xee92('0xc')][_0xee92('0xd')]({'port':0x232b});var client9002=jayson[_0xee92('0xc')][_0xee92('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x567060,_0x27ffce,_0x1c9a7b,_0x419431){return new BPromise(function(_0x805e9,_0x551d62){var _0x2d2bb4=_0x419431||client;return _0x2d2bb4[_0xee92('0xe')](_0x567060,_0x1c9a7b)[_0xee92('0xf')](function(_0x1ad28b){logger[_0xee92('0x10')](_0xee92('0x11'),_0x27ffce,_0xee92('0x12'));logger['debug'](_0xee92('0x13'),_0x27ffce,_0xee92('0x12'),JSON['stringify'](_0x1ad28b));if(_0x1ad28b[_0xee92('0x14')]){if(_0x1ad28b[_0xee92('0x14')]['code']===0x1f4){logger[_0xee92('0x14')](_0xee92('0x11'),_0x27ffce,_0x1ad28b[_0xee92('0x14')]['message']);return _0x551d62(_0x1ad28b[_0xee92('0x14')][_0xee92('0x15')]);}logger[_0xee92('0x14')](_0xee92('0x11'),_0x27ffce,_0x1ad28b['error'][_0xee92('0x15')]);return _0x805e9(_0x1ad28b[_0xee92('0x14')][_0xee92('0x15')]);}else{logger[_0xee92('0x10')](_0xee92('0x11'),_0x27ffce,'request\x20sent');_0x805e9(_0x1ad28b[_0xee92('0x16')][_0xee92('0x15')]);}})[_0xee92('0x17')](function(_0xd911eb){logger[_0xee92('0x14')]('MailMessage,\x20%s,\x20%s',_0x27ffce,_0xd911eb);_0x551d62(_0xd911eb);});});}function respondWithResult(_0x13cc30,_0x112d67){_0x112d67=_0x112d67||0xc8;return function(_0x2551cf){if(_0x2551cf){return _0x13cc30['status'](_0x112d67)['json'](_0x2551cf);}};}function respondWithFilteredResult(_0x34eb5f,_0x327a30){return function(_0x1c184e){if(_0x1c184e){var _0x1e948a=typeof _0x327a30[_0xee92('0x18')]===_0xee92('0x19')&&typeof _0x327a30[_0xee92('0x1a')]===_0xee92('0x19');var _0x22eb60=_0x1c184e[_0xee92('0x1b')];var _0x505cb9=_0x1e948a?0x0:_0x327a30['offset'];var _0x284cac=_0x1e948a?_0x1c184e[_0xee92('0x1b')]:_0x327a30[_0xee92('0x18')]+_0x327a30[_0xee92('0x1a')];var _0x1568c3;if(_0x284cac>=_0x22eb60){_0x284cac=_0x22eb60;_0x1568c3=0xc8;}else{_0x1568c3=0xce;}_0x34eb5f['status'](_0x1568c3);return _0x34eb5f['set']('Content-Range',_0x505cb9+'-'+_0x284cac+'/'+_0x22eb60)[_0xee92('0x1c')](_0x1c184e);}return null;};}function saveUpdates(_0x50198a){return function(_0x20f871){if(_0x20f871){return _0x20f871[_0xee92('0x1d')](_0x50198a)['then'](function(_0x10a7aa){return _0x10a7aa;});}return null;};}function removeEntity(_0x41bfd3){return function(_0x5af790){if(_0x5af790){return _0x5af790[_0xee92('0x1e')]()[_0xee92('0xf')](function(){_0x41bfd3[_0xee92('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1347f7){return function(_0x4bd3ea){if(!_0x4bd3ea){_0x1347f7['sendStatus'](0x194);}return _0x4bd3ea;};}function handleError(_0x20e74d,_0x1028d0){_0x1028d0=_0x1028d0||0x1f4;return function(_0x2df2cc){logger[_0xee92('0x14')](_0x2df2cc[_0xee92('0x20')]);if(_0x2df2cc['name']){delete _0x2df2cc[_0xee92('0x21')];}_0x20e74d[_0xee92('0x1f')](_0x1028d0)[_0xee92('0x22')](_0x2df2cc);};}exports[_0xee92('0x23')]=function(_0x1e595c,_0x37e2cf){var _0x19401b={},_0x706511={},_0x2136d1={'count':0x0,'rows':[]};var _0x165747=_[_0xee92('0x24')](db['MailMessage'][_0xee92('0x25')],function(_0x39c026){return{'name':_0x39c026[_0xee92('0x26')],'type':_0x39c026[_0xee92('0x27')][_0xee92('0x28')]};});_0x706511['model']=_[_0xee92('0x24')](_0x165747,_0xee92('0x21'));_0x706511[_0xee92('0x29')]=_['keys'](_0x1e595c[_0xee92('0x29')]);_0x706511[_0xee92('0x2a')]=_[_0xee92('0x2b')](_0x706511['model'],_0x706511['query']);_0x19401b[_0xee92('0x2c')]=_[_0xee92('0x2b')](_0x706511['model'],qs['fields'](_0x1e595c['query']['fields']));_0x19401b[_0xee92('0x2c')]=_0x19401b['attributes'][_0xee92('0x2d')]?_0x19401b[_0xee92('0x2c')]:_0x706511[_0xee92('0x2e')];if(!_0x1e595c[_0xee92('0x29')][_0xee92('0x2f')]('nolimit')){_0x19401b['limit']=qs[_0xee92('0x1a')](_0x1e595c[_0xee92('0x29')][_0xee92('0x1a')]);_0x19401b[_0xee92('0x18')]=qs[_0xee92('0x18')](_0x1e595c[_0xee92('0x29')][_0xee92('0x18')]);}_0x19401b[_0xee92('0x30')]=qs[_0xee92('0x31')](_0x1e595c['query'][_0xee92('0x31')]);_0x19401b[_0xee92('0x32')]=qs['filters'](_['pick'](_0x1e595c[_0xee92('0x29')],_0x706511[_0xee92('0x2a')]),_0x165747);if(_0x1e595c[_0xee92('0x29')]['filter']){_0x19401b[_0xee92('0x32')]=_[_0xee92('0x33')](_0x19401b[_0xee92('0x32')],{'$or':_[_0xee92('0x24')](_0x165747,function(_0x294251){if(_0x294251[_0xee92('0x27')]!==_0xee92('0x34')){var _0x4944a9={};_0x4944a9[_0x294251['name']]={'$like':'%'+_0x1e595c[_0xee92('0x29')][_0xee92('0x35')]+'%'};return _0x4944a9;}})});}_0x19401b=_[_0xee92('0x33')]({},_0x19401b,_0x1e595c[_0xee92('0x36')]);var _0x54a865={'where':_0x19401b[_0xee92('0x32')]};return db[_0xee92('0x37')][_0xee92('0x1b')](_0x54a865)[_0xee92('0xf')](function(_0x375a96){_0x2136d1[_0xee92('0x1b')]=_0x375a96;if(_0x1e595c['query']['includeAll']){_0x19401b[_0xee92('0x38')]=[{'all':!![]}];}return db[_0xee92('0x37')][_0xee92('0x39')](_0x19401b);})[_0xee92('0xf')](function(_0x77a999){_0x2136d1['rows']=_0x77a999;return _0x2136d1;})[_0xee92('0xf')](respondWithFilteredResult(_0x37e2cf,_0x19401b))[_0xee92('0x17')](handleError(_0x37e2cf,null));};exports[_0xee92('0x3a')]=function(_0x2ae8be,_0x5bb546){var _0x8fa95d={'raw':!![],'where':{'id':_0x2ae8be[_0xee92('0x3b')]['id']}},_0x1549d6={};_0x1549d6[_0xee92('0x2e')]=_[_0xee92('0x3c')](db['MailMessage'][_0xee92('0x25')]);_0x1549d6[_0xee92('0x29')]=_['keys'](_0x2ae8be[_0xee92('0x29')]);_0x1549d6[_0xee92('0x2a')]=_[_0xee92('0x2b')](_0x1549d6['model'],_0x1549d6[_0xee92('0x29')]);_0x8fa95d[_0xee92('0x2c')]=_[_0xee92('0x2b')](_0x1549d6[_0xee92('0x2e')],qs[_0xee92('0x3d')](_0x2ae8be[_0xee92('0x29')]['fields']));_0x8fa95d[_0xee92('0x2c')]=_0x8fa95d[_0xee92('0x2c')][_0xee92('0x2d')]?_0x8fa95d[_0xee92('0x2c')]:_0x1549d6[_0xee92('0x2e')];if(_0x2ae8be[_0xee92('0x29')]['includeAll']){_0x8fa95d[_0xee92('0x38')]=[{'all':!![]}];}_0x8fa95d=_[_0xee92('0x33')]({},_0x8fa95d,_0x2ae8be[_0xee92('0x36')]);return db[_0xee92('0x37')][_0xee92('0x3e')](_0x8fa95d)[_0xee92('0xf')](handleEntityNotFound(_0x5bb546,null))['then'](respondWithResult(_0x5bb546,null))['catch'](handleError(_0x5bb546,null));};exports['update']=function(_0x2c9dbe,_0x1c9707){if(_0x2c9dbe[_0xee92('0x3f')]['id']){delete _0x2c9dbe[_0xee92('0x3f')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x2c9dbe[_0xee92('0x3b')]['id']}})[_0xee92('0xf')](handleEntityNotFound(_0x1c9707,null))[_0xee92('0xf')](saveUpdates(_0x2c9dbe[_0xee92('0x3f')],null))['then'](respondWithResult(_0x1c9707,null))[_0xee92('0x17')](handleError(_0x1c9707,null));};exports[_0xee92('0x1e')]=function(_0x12d1ff,_0x5af254){return db[_0xee92('0x37')]['find']({'where':{'id':_0x12d1ff[_0xee92('0x3b')]['id']}})[_0xee92('0xf')](handleEntityNotFound(_0x5af254,null))[_0xee92('0xf')](removeEntity(_0x5af254,null))[_0xee92('0x17')](handleError(_0x5af254,null));};exports[_0xee92('0x40')]=function(_0x12e6a8,_0x51d1b6){return db['MailMessage'][_0xee92('0x40')]()[_0xee92('0xf')](respondWithResult(_0x51d1b6,null))['catch'](handleError(_0x51d1b6,null));};exports['create']=function(_0x3bdce0,_0x3c97ac){return db[_0xee92('0x37')][_0xee92('0x41')](_0x3bdce0[_0xee92('0x3f')])[_0xee92('0xf')](function(_0x163576){if(_0x163576){if(_0x163576[_0xee92('0x42')]===_0xee92('0x43')&&!_0x163576[_0xee92('0x44')]){var _0x148d4d,_0x233da7,_0x295c44;if(_0x3bdce0['body']['to']){_0x233da7=_0x3bdce0['body']['to']['split'](',')[0x0];}return db[_0xee92('0x45')]['findOne']({'where':{'id':_0x163576[_0xee92('0x46')]},'include':[{'model':db['CmList'],'as':_0xee92('0x47'),'include':[{'model':db['CmContact'],'as':_0xee92('0x48'),'where':{'email':_0x233da7},'limit':0x1,'order':[[_0xee92('0x49'),_0xee92('0x4a')]]}]},{'model':db[_0xee92('0x4b')],'as':'Smtp','raw':!![]}]})[_0xee92('0xf')](function(_0xed2594){_0x148d4d=_0xed2594;if(_0x148d4d&&_0x148d4d[_0xee92('0x4c')]){var _0x5ddaf2={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x148d4d[_0xee92('0x4c')]['service'])){_0x5ddaf2[_0xee92('0x4d')]=_0x148d4d['Smtp']['host'];_0x5ddaf2[_0xee92('0x4e')]=_0x148d4d['Smtp'][_0xee92('0x4e')];_0x5ddaf2[_0xee92('0x4f')]=_0x148d4d[_0xee92('0x4c')]['secure'];if(_0x148d4d[_0xee92('0x4c')][_0xee92('0x50')]){_0x5ddaf2[_0xee92('0x51')]={'user':_0x148d4d[_0xee92('0x4c')][_0xee92('0x52')],'pass':_0x148d4d['Smtp'][_0xee92('0x53')]};}}else{_0x5ddaf2[_0xee92('0x54')]=_0x148d4d['Smtp'][_0xee92('0x54')];_0x5ddaf2[_0xee92('0x51')]={'user':_0x148d4d[_0xee92('0x4c')]['user'],'pass':_0x148d4d[_0xee92('0x4c')]['pass']};_0x5ddaf2[_0xee92('0x4f')]=_0x148d4d['Smtp'][_0xee92('0x4f')];}if(_0x3bdce0['body'][_0xee92('0x55')]&&_0x3bdce0[_0xee92('0x3f')][_0xee92('0x55')]['length']){for(var _0xc56747=0x0;_0xc56747<_0x3bdce0[_0xee92('0x3f')][_0xee92('0x55')][_0xee92('0x2d')];_0xc56747+=0x1){_0x3bdce0[_0xee92('0x3f')][_0xee92('0x55')][_0xc56747]={'filename':_0x3bdce0[_0xee92('0x3f')][_0xee92('0x55')][_0xc56747][_0xee92('0x21')],'path':path[_0xee92('0x56')](config[_0xee92('0x57')],_0xee92('0x58'),_0x3bdce0[_0xee92('0x3f')][_0xee92('0x55')][_0xc56747][_0xee92('0x59')])};}}_0x295c44={'account':_0x5ddaf2,'message':_0x3bdce0[_0xee92('0x3f')]};return;}})['then'](function(){if(_0x148d4d[_0xee92('0x47')]){if(_0x148d4d[_0xee92('0x47')][_0xee92('0x48')][_0xee92('0x2d')]){return _0x148d4d[_0xee92('0x47')][_0xee92('0x48')][0x0];}else{return db['CmContact'][_0xee92('0x41')](_[_0xee92('0x5a')](_0x3bdce0[_0xee92('0x3f')],{'firstName':_0x3bdce0['body']['to'],'email':_0x3bdce0[_0xee92('0x3f')]['to'],'phone':_0x3bdce0[_0xee92('0x3f')]['to'],'ListId':_0x148d4d['ListId']}));}}else{throw new Error(_0xee92('0x5b'));}})[_0xee92('0xf')](function(){if(_0x295c44){return respondWithRpcPromise(_0xee92('0x5c'),_0xee92('0x5d'),_0x295c44,client9003)[_0xee92('0xf')](function(_0x39de2d){return _0x163576[_0xee92('0x1d')]({'read':!![],'messageId':_0x39de2d[_0xee92('0x5e')],'sentAt':moment()['format'](_0xee92('0x5f'))});})[_0xee92('0x17')](function(_0x580b8c){logger['error']('%s',JSON['stringify'](_0x580b8c));return _0x163576;});}return _0x163576;});}return _0x163576;}})[_0xee92('0xf')](respondWithResult(_0x3c97ac,0xc9))[_0xee92('0x17')](handleError(_0x3c97ac,null));};exports[_0xee92('0x60')]=function(_0x3393cf,_0x3dd48b){var _0x1720ea={'agent':{},'channel':_0xee92('0x61')};if(_0x3393cf[_0xee92('0x3f')]['id']){delete _0x3393cf[_0xee92('0x3f')]['id'];}_0x3393cf[_0xee92('0x3f')][_0xee92('0x62')]=!![];_0x3393cf[_0xee92('0x3f')][_0xee92('0x63')]=moment()['format'](_0xee92('0x5f'));_0x3393cf[_0xee92('0x3f')][_0xee92('0x64')]=_0x3393cf[_0xee92('0x3f')]['UserId']||_0x3393cf[_0xee92('0x52')]['id'];_0x1720ea[_0xee92('0x65')]['id']=_0x3393cf[_0xee92('0x3f')][_0xee92('0x64')];return db[_0xee92('0x37')][_0xee92('0x3e')]({'where':{'id':_0x3393cf[_0xee92('0x3b')]['id'],'UserId':null}})[_0xee92('0xf')](handleEntityNotFound(_0x3dd48b,null))[_0xee92('0xf')](saveUpdates(_0x3393cf[_0xee92('0x3f')],null))[_0xee92('0xf')](function(_0x4899b8){if(_0x4899b8){_0x1720ea[_0xee92('0x15')]=_0x4899b8[_0xee92('0x66')]({'plain':!![]});return db[_0xee92('0x67')][_0xee92('0x3e')]({'where':{'id':_0x4899b8[_0xee92('0x68')]}});}return null;})[_0xee92('0xf')](handleEntityNotFound(_0x3dd48b,null))[_0xee92('0xf')](function(_0x4a80ce){if(_0x4a80ce){return _0x4a80ce['update']({'UserId':_0x3393cf[_0xee92('0x3f')][_0xee92('0x64')],'read1stAt':_[_0xee92('0x69')](_0x4a80ce[_0xee92('0x6a')])?moment()['format'](_0xee92('0x5f')):undefined});}return null;})[_0xee92('0xf')](function(_0x17b4b5){if(_0x17b4b5){_0x1720ea['interaction']=_0x17b4b5[_0xee92('0x66')]({'plain':!![]});interaction_log[_0xee92('0x10')](_0xee92('0x6b'),_0x3393cf[_0xee92('0x52')]['id'],_0x3393cf[_0xee92('0x52')][_0xee92('0x21')],_0x3393cf['user'][_0xee92('0x6c')],_0x1720ea[_0xee92('0x6d')]['id'],_0x3393cf[_0xee92('0x3f')]?JSON['stringify'](_0x3393cf[_0xee92('0x3f')]):'null');return respondWithRpcPromise(_0xee92('0x6e'),_0xee92('0x6f'),_0x1720ea);}return null;})[_0xee92('0xf')](function(_0x26043c){var _0x36b9e4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x26043c['message'][_0xee92('0x70')];return db[_0xee92('0x71')][_0xee92('0x29')](_0x36b9e4,{'type':db[_0xee92('0x72')][_0xee92('0x73')][_0xee92('0x74')],'raw':!![]})[_0xee92('0xf')](function(_0x5b583d){return _0x5b583d;});})[_0xee92('0xf')](function(_0x50c855){if(_0x50c855){_0x1720ea['message'][_0xee92('0x75')]=_0x50c855[0x0];if(!_0x3393cf[_0xee92('0x3f')][_0xee92('0x64')])return;return db['User']['find']({'where':{'id':_0x3393cf[_0xee92('0x3f')]['UserId'],'role':_0xee92('0x65')},'attributes':['id',_0xee92('0x21'),_0xee92('0x76'),_0xee92('0x77'),_0xee92('0x78')],'raw':!![]});}return null;})['then'](function(_0x3177d7){if(!_0x3177d7)return null;_0x1720ea['message'][_0xee92('0x65')]=_0x3177d7;return _0x1720ea;})[_0xee92('0xf')](function(_0x36a063){if(_0x36a063){if(_0x3393cf[_0xee92('0x3f')][_0xee92('0x79')]){_0x1720ea['message']['interface']=util['format'](_0xee92('0x7a'),_0x3393cf[_0xee92('0x52')][_0xee92('0x21')]);_0x1720ea[_0xee92('0x15')][_0xee92('0x7b')]=_0x1720ea['channel'];_0x1720ea['message'][_0xee92('0x7c')]=_0x1720ea['channel'];_0x1720ea[_0xee92('0x15')][_0xee92('0x7d')]=_0xee92('0x60');_0x1720ea[_0xee92('0x15')][_0xee92('0x3f')]=htmlToText[_0xee92('0x7e')](_0x1720ea[_0xee92('0x15')]['body']);return respondWithRpcPromise(_0xee92('0x7f'),_0xee92('0x7f'),{'event':_0xee92('0x80'),'message':_0x1720ea['message']},client9002)[_0xee92('0xf')](function(){return _0x1720ea;});}return _0x1720ea;}return null;})[_0xee92('0xf')](respondWithResult(_0x3dd48b,null))[_0xee92('0x17')](handleError(_0x3dd48b,null));};exports[_0xee92('0x81')]=function(_0x44f0d5,_0x308dd4){var _0x9d89cd={'agent':{},'channel':'mail'};if(_0x44f0d5[_0xee92('0x3f')]['id']){delete _0x44f0d5['body']['id'];}_0x44f0d5[_0xee92('0x3f')]['UserId']=_0x44f0d5[_0xee92('0x3f')][_0xee92('0x64')]||_0x44f0d5[_0xee92('0x52')]['id'];_0x9d89cd[_0xee92('0x65')]['id']=_0x44f0d5[_0xee92('0x3f')]['UserId'];return db[_0xee92('0x37')]['find']({'where':{'id':_0x44f0d5['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x308dd4,null))[_0xee92('0xf')](function(_0x448193){if(_0x448193){_0x9d89cd['message']=_0x448193[_0xee92('0x66')]({'plain':!![]});return db['MailInteraction'][_0xee92('0x3e')]({'where':{'id':_0x448193[_0xee92('0x68')]}});}return null;})[_0xee92('0xf')](handleEntityNotFound(_0x308dd4,null))['then'](function(_0x41e5ca){if(_0x41e5ca){_0x9d89cd[_0xee92('0x6d')]=_0x41e5ca[_0xee92('0x66')]({'plain':!![]});interaction_log[_0xee92('0x10')](_0xee92('0x82'),_0x44f0d5[_0xee92('0x52')]['id'],_0x44f0d5[_0xee92('0x52')][_0xee92('0x21')],_0x44f0d5[_0xee92('0x52')]['role'],_0x9d89cd[_0xee92('0x6d')]['id'],_0x44f0d5[_0xee92('0x3f')]?JSON[_0xee92('0x83')](_0x44f0d5[_0xee92('0x3f')]):_0xee92('0x84'));return respondWithRpcPromise(_0xee92('0x85'),_0xee92('0x86'),_0x9d89cd);}return null;})['then'](function(_0x1f030f){var _0x2895df=_0xee92('0x87')+_0x1f030f[_0xee92('0x15')][_0xee92('0x70')];return db[_0xee92('0x71')]['query'](_0x2895df,{'type':db[_0xee92('0x72')][_0xee92('0x73')][_0xee92('0x74')],'raw':!![]})[_0xee92('0xf')](function(_0x12226b){return _0x12226b;});})[_0xee92('0xf')](function(_0xe8b49d){if(_0xe8b49d){_0x9d89cd[_0xee92('0x15')][_0xee92('0x75')]=_0xe8b49d[0x0];if(!_0x44f0d5[_0xee92('0x3f')]['UserId'])return;return db[_0xee92('0x88')]['find']({'where':{'id':_0x44f0d5[_0xee92('0x3f')][_0xee92('0x64')],'role':'agent'},'attributes':['id','name',_0xee92('0x76'),'email','internal'],'raw':!![]});}return null;})[_0xee92('0xf')](function(_0x276fb5){if(!_0x276fb5)return null;_0x9d89cd['message'][_0xee92('0x65')]=_0x276fb5;return _0x9d89cd;})[_0xee92('0xf')](function(_0x2b07a1){if(_0x2b07a1){_0x2b07a1['message'][_0xee92('0x89')]=util['format'](_0xee92('0x7a'),_0x44f0d5[_0xee92('0x52')][_0xee92('0x21')]);_0x2b07a1[_0xee92('0x15')][_0xee92('0x7b')]=_0x9d89cd[_0xee92('0x7b')];_0x2b07a1[_0xee92('0x15')][_0xee92('0x7c')]=_0x9d89cd[_0xee92('0x7b')];_0x2b07a1['message'][_0xee92('0x7d')]=_0xee92('0x81');_0x2b07a1[_0xee92('0x15')]['body']=htmlToText['fromString'](_0x9d89cd[_0xee92('0x15')][_0xee92('0x3f')]);respondWithRpcPromise(_0xee92('0x7f'),_0xee92('0x7f'),{'event':_0xee92('0x8a'),'message':_0x2b07a1[_0xee92('0x15')]},client9002);return _0x9d89cd;}return null;})['then'](respondWithResult(_0x308dd4,null))['catch'](handleError(_0x308dd4,null));};exports['download']=function(_0x5d135b,_0xf5dd24){var _0x13c114=moment()[_0xee92('0x8b')]()[_0xee92('0x8c')]();var _0x5cf8a0=path[_0xee92('0x56')](config[_0xee92('0x57')],_0xee92('0x8d'),'files',_0xee92('0x8e'));var _0x5bbc1d=path['join'](config[_0xee92('0x57')],_0xee92('0x8d'),_0xee92('0x8f'),_0xee92('0x55'));var _0x284ae8=util[_0xee92('0x90')](_0xee92('0x91'),_0x13c114);return db[_0xee92('0x37')][_0xee92('0x3e')]({'where':{'id':_0x5d135b[_0xee92('0x3b')]['id']},'attributes':['id',_0xee92('0x3f'),_0xee92('0x92'),'to','cc',_0xee92('0x93'),'subject',_0xee92('0x94')],'include':_0x5d135b[_0xee92('0x29')][_0xee92('0x55')]?[{'model':db[_0xee92('0x95')],'as':_0xee92('0x96')}]:undefined})[_0xee92('0xf')](handleEntityNotFound(_0xf5dd24,null))[_0xee92('0xf')](function(_0x3b3440){if(_0x3b3440){var _0xc997cb=_0x3b3440;var _0x25841d={'from':_0xc997cb[_0xee92('0x92')],'to':_0xc997cb['to'],'subject':_0xc997cb['subject'],'html':_0xc997cb[_0xee92('0x3f')],'headers':{'Date':moment(_0xc997cb[_0xee92('0x94')])[_0xee92('0x90')](_0xee92('0x97'))},'attachments':[]};if(_0x3b3440['cc']){_0x25841d['headers']['Cc']=_0x3b3440['cc'];}if(_0x3b3440[_0xee92('0x93')]){_0x25841d[_0xee92('0x98')][_0xee92('0x99')]=_0x3b3440['bcc'];}return new BPromise(function(_0x4afb09,_0x26a9b6){if(_0x3b3440[_0xee92('0x96')]){for(var _0x1343e2=0x0;_0x1343e2<_0x3b3440[_0xee92('0x96')][_0xee92('0x2d')];_0x1343e2++){var _0x13891c=_0x3b3440[_0xee92('0x96')][_0x1343e2];var _0x573723=path[_0xee92('0x56')](_0x5bbc1d,_0x13891c['basename']);if(fs[_0xee92('0x9a')](_0x573723)){_0x25841d['attachments'][_0xee92('0x9b')]({'name':_0x13891c['name'],'contentType':_0x13891c[_0xee92('0x27')],'data':fs[_0xee92('0x9c')](_0x573723)});}}}emlformat[_0xee92('0x9d')](_0x25841d,function(_0x25057e,_0x50c013){if(_0x25057e)return _0x26a9b6(_0x25057e);fs[_0xee92('0x9e')](path[_0xee92('0x56')](_0x5cf8a0,_0x284ae8),_0x50c013);return _0x4afb09(_0x50c013);});});}})[_0xee92('0xf')](function(_0x5a34d0){if(_0x5a34d0){return _0xf5dd24[_0xee92('0x9f')](path[_0xee92('0x56')](_0x5cf8a0,_0x284ae8),_0x284ae8,function(_0x311f06){if(!_0x311f06)fs[_0xee92('0xa0')](path[_0xee92('0x56')](_0x5cf8a0,_0x284ae8));});}})[_0xee92('0x17')](handleError(_0xf5dd24,null));}; \ No newline at end of file +var _0xe0b1=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','MailMessage','includeAll','include','findAll','rows','params','keys','rawAttributes','intersection','find','body','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','format','UserId','agent','get','MailInteractionId','read1stAt','interaction','[MAILMESSAGE: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','User','email','internal','manual','interface','SIP/%s','motionChannel','channel','event','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','fullname','reject','rejectmessage','unix','toString','server','tmp','from','bcc','Attachment','Attachments','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','key','model','query','filters','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0b1,0x77));var _0x1e0b=function(_0x2cacef,_0xba1573){_0x2cacef=_0x2cacef-0x0;var _0x289ba6=_0xe0b1[_0x2cacef];return _0x289ba6;};'use strict';var emlformat=require(_0x1e0b('0x0'));var moment=require(_0x1e0b('0x1'));var BPromise=require(_0x1e0b('0x2'));var util=require(_0x1e0b('0x3'));var path=require(_0x1e0b('0x4'));var fs=require('fs');var _=require(_0x1e0b('0x5'));var Redis=require(_0x1e0b('0x6'));var htmlToText=require(_0x1e0b('0x7'));var qs=require(_0x1e0b('0x8'));var logger=require(_0x1e0b('0x9'))(_0x1e0b('0xa'));var interaction_log=require('../../config/logger')(_0x1e0b('0xb'));var config=require(_0x1e0b('0xc'));var db=require(_0x1e0b('0xd'))['db'];config[_0x1e0b('0xe')]=_[_0x1e0b('0xf')](config[_0x1e0b('0xe')],{'host':_0x1e0b('0x10'),'port':0x18eb});var socket=require(_0x1e0b('0x11'))(new Redis(config[_0x1e0b('0xe')]));require(_0x1e0b('0x12'))[_0x1e0b('0x13')](socket);var jayson=require(_0x1e0b('0x14'));var client=jayson[_0x1e0b('0x15')][_0x1e0b('0x16')]({'port':0x232c});var client9003=jayson[_0x1e0b('0x15')][_0x1e0b('0x16')]({'port':0x232b});var client9002=jayson[_0x1e0b('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29e20d,_0x41593c,_0x2455a3,_0x2fc505){return new BPromise(function(_0xe0a4ba,_0x21be47){var _0x343134=_0x2fc505||client;return _0x343134[_0x1e0b('0x17')](_0x29e20d,_0x2455a3)['then'](function(_0x38597e){logger[_0x1e0b('0x18')](_0x1e0b('0x19'),_0x41593c,'request\x20sent');logger[_0x1e0b('0x1a')](_0x1e0b('0x1b'),_0x41593c,_0x1e0b('0x1c'),JSON[_0x1e0b('0x1d')](_0x38597e));if(_0x38597e[_0x1e0b('0x1e')]){if(_0x38597e['error'][_0x1e0b('0x1f')]===0x1f4){logger[_0x1e0b('0x1e')]('MailMessage,\x20%s,\x20%s',_0x41593c,_0x38597e[_0x1e0b('0x1e')]['message']);return _0x21be47(_0x38597e['error'][_0x1e0b('0x20')]);}logger[_0x1e0b('0x1e')](_0x1e0b('0x19'),_0x41593c,_0x38597e[_0x1e0b('0x1e')][_0x1e0b('0x20')]);return _0xe0a4ba(_0x38597e[_0x1e0b('0x1e')][_0x1e0b('0x20')]);}else{logger[_0x1e0b('0x18')](_0x1e0b('0x19'),_0x41593c,_0x1e0b('0x1c'));_0xe0a4ba(_0x38597e['result'][_0x1e0b('0x20')]);}})[_0x1e0b('0x21')](function(_0x262e66){logger['error'](_0x1e0b('0x19'),_0x41593c,_0x262e66);_0x21be47(_0x262e66);});});}function respondWithResult(_0x334b67,_0x145ae4){_0x145ae4=_0x145ae4||0xc8;return function(_0x3ab096){if(_0x3ab096){return _0x334b67[_0x1e0b('0x22')](_0x145ae4)[_0x1e0b('0x23')](_0x3ab096);}};}function respondWithFilteredResult(_0xfa4aa6,_0x346c6){return function(_0x18345d){if(_0x18345d){var _0x4cf936=typeof _0x346c6[_0x1e0b('0x24')]===_0x1e0b('0x25')&&typeof _0x346c6[_0x1e0b('0x26')]===_0x1e0b('0x25');var _0x48eb8f=_0x18345d[_0x1e0b('0x27')];var _0x43ca95=_0x4cf936?0x0:_0x346c6[_0x1e0b('0x24')];var _0x4e1ad4=_0x4cf936?_0x18345d[_0x1e0b('0x27')]:_0x346c6['offset']+_0x346c6['limit'];var _0x16f0b8;if(_0x4e1ad4>=_0x48eb8f){_0x4e1ad4=_0x48eb8f;_0x16f0b8=0xc8;}else{_0x16f0b8=0xce;}_0xfa4aa6['status'](_0x16f0b8);return _0xfa4aa6[_0x1e0b('0x28')](_0x1e0b('0x29'),_0x43ca95+'-'+_0x4e1ad4+'/'+_0x48eb8f)[_0x1e0b('0x23')](_0x18345d);}return null;};}function saveUpdates(_0x1a3877){return function(_0x24a37a){if(_0x24a37a){return _0x24a37a[_0x1e0b('0x2a')](_0x1a3877)[_0x1e0b('0x2b')](function(_0x5d2de4){return _0x5d2de4;});}return null;};}function removeEntity(_0x1598be){return function(_0x49fcaa){if(_0x49fcaa){return _0x49fcaa[_0x1e0b('0x2c')]()[_0x1e0b('0x2b')](function(){_0x1598be[_0x1e0b('0x22')](0xcc)[_0x1e0b('0x2d')]();});}};}function handleEntityNotFound(_0xecb111){return function(_0x259001){if(!_0x259001){_0xecb111['sendStatus'](0x194);}return _0x259001;};}function handleError(_0x215377,_0x335301){_0x335301=_0x335301||0x1f4;return function(_0x30f6bf){logger[_0x1e0b('0x1e')](_0x30f6bf[_0x1e0b('0x2e')]);if(_0x30f6bf['name']){delete _0x30f6bf[_0x1e0b('0x2f')];}_0x215377[_0x1e0b('0x22')](_0x335301)[_0x1e0b('0x30')](_0x30f6bf);};}exports[_0x1e0b('0x31')]=function(_0x512379,_0x5bb6c6){var _0x368c68={},_0x56b26d={},_0x36e9cd={'count':0x0,'rows':[]};var _0x4a9ccb=_[_0x1e0b('0x32')](db['MailMessage']['rawAttributes'],function(_0x29fe67){return{'name':_0x29fe67['fieldName'],'type':_0x29fe67['type'][_0x1e0b('0x33')]};});_0x56b26d[_0x1e0b('0x34')]=_[_0x1e0b('0x32')](_0x4a9ccb,_0x1e0b('0x2f'));_0x56b26d['query']=_['keys'](_0x512379[_0x1e0b('0x35')]);_0x56b26d[_0x1e0b('0x36')]=_['intersection'](_0x56b26d[_0x1e0b('0x34')],_0x56b26d[_0x1e0b('0x35')]);_0x368c68[_0x1e0b('0x37')]=_['intersection'](_0x56b26d['model'],qs[_0x1e0b('0x38')](_0x512379['query'][_0x1e0b('0x38')]));_0x368c68[_0x1e0b('0x37')]=_0x368c68[_0x1e0b('0x37')][_0x1e0b('0x39')]?_0x368c68[_0x1e0b('0x37')]:_0x56b26d['model'];if(!_0x512379[_0x1e0b('0x35')][_0x1e0b('0x3a')](_0x1e0b('0x3b'))){_0x368c68[_0x1e0b('0x26')]=qs[_0x1e0b('0x26')](_0x512379[_0x1e0b('0x35')][_0x1e0b('0x26')]);_0x368c68['offset']=qs['offset'](_0x512379[_0x1e0b('0x35')][_0x1e0b('0x24')]);}_0x368c68[_0x1e0b('0x3c')]=qs[_0x1e0b('0x3d')](_0x512379['query'][_0x1e0b('0x3d')]);_0x368c68[_0x1e0b('0x3e')]=qs[_0x1e0b('0x36')](_[_0x1e0b('0x3f')](_0x512379[_0x1e0b('0x35')],_0x56b26d[_0x1e0b('0x36')]),_0x4a9ccb);if(_0x512379['query'][_0x1e0b('0x40')]){_0x368c68[_0x1e0b('0x3e')]=_[_0x1e0b('0x41')](_0x368c68[_0x1e0b('0x3e')],{'$or':_[_0x1e0b('0x32')](_0x4a9ccb,function(_0x21da90){if(_0x21da90[_0x1e0b('0x42')]!==_0x1e0b('0x43')){var _0x5dac46={};_0x5dac46[_0x21da90[_0x1e0b('0x2f')]]={'$like':'%'+_0x512379[_0x1e0b('0x35')][_0x1e0b('0x40')]+'%'};return _0x5dac46;}})});}_0x368c68=_[_0x1e0b('0x41')]({},_0x368c68,_0x512379[_0x1e0b('0x44')]);var _0x1d3060={'where':_0x368c68[_0x1e0b('0x3e')]};return db[_0x1e0b('0x45')][_0x1e0b('0x27')](_0x1d3060)[_0x1e0b('0x2b')](function(_0x1ae0ab){_0x36e9cd[_0x1e0b('0x27')]=_0x1ae0ab;if(_0x512379['query'][_0x1e0b('0x46')]){_0x368c68[_0x1e0b('0x47')]=[{'all':!![]}];}return db['MailMessage'][_0x1e0b('0x48')](_0x368c68);})[_0x1e0b('0x2b')](function(_0x3fd1b6){_0x36e9cd[_0x1e0b('0x49')]=_0x3fd1b6;return _0x36e9cd;})[_0x1e0b('0x2b')](respondWithFilteredResult(_0x5bb6c6,_0x368c68))[_0x1e0b('0x21')](handleError(_0x5bb6c6,null));};exports['show']=function(_0x452bed,_0x2c303b){var _0x4be154={'raw':!![],'where':{'id':_0x452bed[_0x1e0b('0x4a')]['id']}},_0x3f03cd={};_0x3f03cd[_0x1e0b('0x34')]=_[_0x1e0b('0x4b')](db[_0x1e0b('0x45')][_0x1e0b('0x4c')]);_0x3f03cd[_0x1e0b('0x35')]=_[_0x1e0b('0x4b')](_0x452bed[_0x1e0b('0x35')]);_0x3f03cd[_0x1e0b('0x36')]=_[_0x1e0b('0x4d')](_0x3f03cd['model'],_0x3f03cd[_0x1e0b('0x35')]);_0x4be154[_0x1e0b('0x37')]=_[_0x1e0b('0x4d')](_0x3f03cd['model'],qs[_0x1e0b('0x38')](_0x452bed[_0x1e0b('0x35')][_0x1e0b('0x38')]));_0x4be154['attributes']=_0x4be154[_0x1e0b('0x37')][_0x1e0b('0x39')]?_0x4be154[_0x1e0b('0x37')]:_0x3f03cd[_0x1e0b('0x34')];if(_0x452bed[_0x1e0b('0x35')][_0x1e0b('0x46')]){_0x4be154[_0x1e0b('0x47')]=[{'all':!![]}];}_0x4be154=_[_0x1e0b('0x41')]({},_0x4be154,_0x452bed[_0x1e0b('0x44')]);return db[_0x1e0b('0x45')][_0x1e0b('0x4e')](_0x4be154)[_0x1e0b('0x2b')](handleEntityNotFound(_0x2c303b,null))['then'](respondWithResult(_0x2c303b,null))[_0x1e0b('0x21')](handleError(_0x2c303b,null));};exports[_0x1e0b('0x2a')]=function(_0x531f86,_0x317a1e){if(_0x531f86['body']['id']){delete _0x531f86[_0x1e0b('0x4f')]['id'];}return db[_0x1e0b('0x45')][_0x1e0b('0x4e')]({'where':{'id':_0x531f86[_0x1e0b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x317a1e,null))['then'](saveUpdates(_0x531f86[_0x1e0b('0x4f')],null))['then'](respondWithResult(_0x317a1e,null))[_0x1e0b('0x21')](handleError(_0x317a1e,null));};exports['destroy']=function(_0x31483d,_0x29fa28){return db['MailMessage'][_0x1e0b('0x4e')]({'where':{'id':_0x31483d[_0x1e0b('0x4a')]['id']}})[_0x1e0b('0x2b')](handleEntityNotFound(_0x29fa28,null))['then'](removeEntity(_0x29fa28,null))[_0x1e0b('0x21')](handleError(_0x29fa28,null));};exports[_0x1e0b('0x50')]=function(_0x4d17f6,_0x3873e0){return db[_0x1e0b('0x45')][_0x1e0b('0x50')]()[_0x1e0b('0x2b')](respondWithResult(_0x3873e0,null))[_0x1e0b('0x21')](handleError(_0x3873e0,null));};exports[_0x1e0b('0x51')]=function(_0x1cfd2d,_0x4e19ab){return db[_0x1e0b('0x45')][_0x1e0b('0x51')](_0x1cfd2d['body'])[_0x1e0b('0x2b')](function(_0x270c65){if(_0x270c65){if(_0x270c65[_0x1e0b('0x52')]===_0x1e0b('0x53')&&!_0x270c65[_0x1e0b('0x54')]){var _0x406c00,_0x43c7dd,_0x2c16e8;if(_0x1cfd2d[_0x1e0b('0x4f')]['to']){_0x43c7dd=_0x1cfd2d['body']['to']['split'](',')[0x0];}return db[_0x1e0b('0x55')][_0x1e0b('0x56')]({'where':{'id':_0x270c65[_0x1e0b('0x57')]},'include':[{'model':db[_0x1e0b('0x58')],'as':_0x1e0b('0x59'),'include':[{'model':db['CmContact'],'as':_0x1e0b('0x5a'),'where':{'email':_0x43c7dd},'limit':0x1,'order':[[_0x1e0b('0x5b'),_0x1e0b('0x5c')]]}]},{'model':db[_0x1e0b('0x5d')],'as':_0x1e0b('0x5e'),'raw':!![]}]})[_0x1e0b('0x2b')](function(_0x4306e4){_0x406c00=_0x4306e4;if(_0x406c00&&_0x406c00[_0x1e0b('0x5e')]){var _0x7f857c={'tls':{'rejectUnauthorized':![]}};if(_[_0x1e0b('0x5f')](_0x406c00['Smtp'][_0x1e0b('0x60')])){_0x7f857c[_0x1e0b('0x61')]=_0x406c00['Smtp'][_0x1e0b('0x61')];_0x7f857c[_0x1e0b('0x62')]=_0x406c00[_0x1e0b('0x5e')][_0x1e0b('0x62')];_0x7f857c[_0x1e0b('0x63')]=_0x406c00[_0x1e0b('0x5e')][_0x1e0b('0x63')];if(_0x406c00[_0x1e0b('0x5e')][_0x1e0b('0x64')]){_0x7f857c[_0x1e0b('0x65')]={'user':_0x406c00[_0x1e0b('0x5e')][_0x1e0b('0x66')],'pass':_0x406c00[_0x1e0b('0x5e')][_0x1e0b('0x67')]};}}else{_0x7f857c[_0x1e0b('0x60')]=_0x406c00[_0x1e0b('0x5e')][_0x1e0b('0x60')];_0x7f857c[_0x1e0b('0x65')]={'user':_0x406c00[_0x1e0b('0x5e')][_0x1e0b('0x66')],'pass':_0x406c00['Smtp'][_0x1e0b('0x67')]};_0x7f857c['secure']=_0x406c00[_0x1e0b('0x5e')][_0x1e0b('0x63')];}if(_0x1cfd2d[_0x1e0b('0x4f')]['attachments']&&_0x1cfd2d[_0x1e0b('0x4f')][_0x1e0b('0x68')][_0x1e0b('0x39')]){for(var _0x57f18d=0x0;_0x57f18d<_0x1cfd2d[_0x1e0b('0x4f')][_0x1e0b('0x68')][_0x1e0b('0x39')];_0x57f18d+=0x1){_0x1cfd2d[_0x1e0b('0x4f')][_0x1e0b('0x68')][_0x57f18d]={'filename':_0x1cfd2d[_0x1e0b('0x4f')][_0x1e0b('0x68')][_0x57f18d][_0x1e0b('0x2f')],'path':path[_0x1e0b('0x69')](config[_0x1e0b('0x6a')],_0x1e0b('0x6b'),_0x1cfd2d[_0x1e0b('0x4f')]['attachments'][_0x57f18d][_0x1e0b('0x6c')])};}}_0x2c16e8={'account':_0x7f857c,'message':_0x1cfd2d['body']};return;}})[_0x1e0b('0x2b')](function(){if(_0x406c00['List']){if(_0x406c00[_0x1e0b('0x59')][_0x1e0b('0x5a')]['length']){return _0x406c00[_0x1e0b('0x59')]['Contacts'][0x0];}else{return db[_0x1e0b('0x6d')]['create'](_[_0x1e0b('0xf')](_0x1cfd2d[_0x1e0b('0x4f')],{'firstName':_0x1cfd2d[_0x1e0b('0x4f')]['to'],'email':_0x1cfd2d[_0x1e0b('0x4f')]['to'],'phone':_0x1cfd2d[_0x1e0b('0x4f')]['to'],'ListId':_0x406c00[_0x1e0b('0x6e')]}));}}else{throw new Error(_0x1e0b('0x6f'));}})['then'](function(){if(_0x2c16e8){return respondWithRpcPromise(_0x1e0b('0x70'),_0x1e0b('0x71'),_0x2c16e8,client9003)[_0x1e0b('0x2b')](function(_0x1c5536){return _0x270c65['update']({'read':!![],'messageId':_0x1c5536[_0x1e0b('0x72')],'sentAt':moment()['format'](_0x1e0b('0x73'))});})[_0x1e0b('0x21')](function(_0x40db8c){logger[_0x1e0b('0x1e')]('%s',JSON[_0x1e0b('0x1d')](_0x40db8c));return _0x270c65;});}return _0x270c65;});}return _0x270c65;}})[_0x1e0b('0x2b')](respondWithResult(_0x4e19ab,0xc9))[_0x1e0b('0x21')](handleError(_0x4e19ab,null));};exports[_0x1e0b('0x74')]=function(_0xb01a36,_0x5096ab){var _0x529d39={'agent':{},'channel':_0x1e0b('0x75')};if(_0xb01a36[_0x1e0b('0x4f')]['id']){delete _0xb01a36[_0x1e0b('0x4f')]['id'];}_0xb01a36[_0x1e0b('0x4f')][_0x1e0b('0x76')]=!![];_0xb01a36[_0x1e0b('0x4f')][_0x1e0b('0x77')]=moment()[_0x1e0b('0x78')](_0x1e0b('0x73'));_0xb01a36['body']['UserId']=_0xb01a36[_0x1e0b('0x4f')][_0x1e0b('0x79')]||_0xb01a36[_0x1e0b('0x66')]['id'];_0x529d39[_0x1e0b('0x7a')]['id']=_0xb01a36[_0x1e0b('0x4f')][_0x1e0b('0x79')];return db[_0x1e0b('0x45')][_0x1e0b('0x4e')]({'where':{'id':_0xb01a36[_0x1e0b('0x4a')]['id'],'UserId':null}})[_0x1e0b('0x2b')](handleEntityNotFound(_0x5096ab,null))[_0x1e0b('0x2b')](saveUpdates(_0xb01a36[_0x1e0b('0x4f')],null))['then'](function(_0x23090f){if(_0x23090f){_0x529d39[_0x1e0b('0x20')]=_0x23090f[_0x1e0b('0x7b')]({'plain':!![]});return db['MailInteraction'][_0x1e0b('0x4e')]({'where':{'id':_0x23090f[_0x1e0b('0x7c')]}});}return null;})[_0x1e0b('0x2b')](handleEntityNotFound(_0x5096ab,null))['then'](function(_0x48d642){if(_0x48d642){return _0x48d642[_0x1e0b('0x2a')]({'UserId':_0xb01a36['body'][_0x1e0b('0x79')],'read1stAt':_['isNil'](_0x48d642[_0x1e0b('0x7d')])?moment()[_0x1e0b('0x78')](_0x1e0b('0x73')):undefined});}return null;})[_0x1e0b('0x2b')](function(_0x546d26){if(_0x546d26){_0x529d39[_0x1e0b('0x7e')]=_0x546d26['get']({'plain':!![]});interaction_log[_0x1e0b('0x18')](_0x1e0b('0x7f'),_0xb01a36[_0x1e0b('0x66')]['id'],_0xb01a36[_0x1e0b('0x66')]['name'],_0xb01a36[_0x1e0b('0x66')][_0x1e0b('0x80')],_0x529d39[_0x1e0b('0x7e')]['id'],_0xb01a36[_0x1e0b('0x4f')]?JSON[_0x1e0b('0x1d')](_0xb01a36[_0x1e0b('0x4f')]):_0x1e0b('0x81'));return respondWithRpcPromise(_0x1e0b('0x82'),'acceptMessage',_0x529d39);}return null;})[_0x1e0b('0x2b')](function(_0x2e276f){var _0x19f945=_0x1e0b('0x83')+_0x2e276f[_0x1e0b('0x20')][_0x1e0b('0x84')];return db[_0x1e0b('0x85')][_0x1e0b('0x35')](_0x19f945,{'type':db[_0x1e0b('0x86')][_0x1e0b('0x87')][_0x1e0b('0x88')],'raw':!![]})[_0x1e0b('0x2b')](function(_0x32636f){return _0x32636f;});})[_0x1e0b('0x2b')](function(_0x1ec2b9){if(_0x1ec2b9){_0x529d39['message']['contact']=_0x1ec2b9[0x0];if(!_0xb01a36[_0x1e0b('0x4f')][_0x1e0b('0x79')])return;return db[_0x1e0b('0x89')]['find']({'where':{'id':_0xb01a36[_0x1e0b('0x4f')][_0x1e0b('0x79')],'role':_0x1e0b('0x7a')},'attributes':['id',_0x1e0b('0x2f'),'fullname',_0x1e0b('0x8a'),_0x1e0b('0x8b')],'raw':!![]});}return null;})['then'](function(_0x4f8c49){if(!_0x4f8c49)return null;_0x529d39[_0x1e0b('0x20')]['agent']=_0x4f8c49;return _0x529d39;})[_0x1e0b('0x2b')](function(_0x4b3ece){if(_0x4b3ece){if(_0xb01a36[_0x1e0b('0x4f')][_0x1e0b('0x8c')]){_0x529d39['message'][_0x1e0b('0x8d')]=util[_0x1e0b('0x78')](_0x1e0b('0x8e'),_0xb01a36['user']['name']);_0x529d39[_0x1e0b('0x20')]['channel']=_0x529d39['channel'];_0x529d39['message'][_0x1e0b('0x8f')]=_0x529d39[_0x1e0b('0x90')];_0x529d39[_0x1e0b('0x20')][_0x1e0b('0x91')]=_0x1e0b('0x74');_0x529d39[_0x1e0b('0x20')][_0x1e0b('0x4f')]=htmlToText[_0x1e0b('0x92')](_0x529d39[_0x1e0b('0x20')][_0x1e0b('0x4f')]);return respondWithRpcPromise(_0x1e0b('0x93'),'EventManager',{'event':_0x1e0b('0x94'),'message':_0x529d39[_0x1e0b('0x20')]},client9002)[_0x1e0b('0x2b')](function(){return _0x529d39;});}return _0x529d39;}return null;})['then'](respondWithResult(_0x5096ab,null))['catch'](handleError(_0x5096ab,null));};exports['reject']=function(_0x526fd8,_0x54255c){var _0x14b826={'agent':{},'channel':'mail'};if(_0x526fd8['body']['id']){delete _0x526fd8[_0x1e0b('0x4f')]['id'];}_0x526fd8[_0x1e0b('0x4f')]['UserId']=_0x526fd8['body'][_0x1e0b('0x79')]||_0x526fd8[_0x1e0b('0x66')]['id'];_0x14b826[_0x1e0b('0x7a')]['id']=_0x526fd8[_0x1e0b('0x4f')][_0x1e0b('0x79')];return db[_0x1e0b('0x45')][_0x1e0b('0x4e')]({'where':{'id':_0x526fd8[_0x1e0b('0x4a')]['id'],'UserId':null}})[_0x1e0b('0x2b')](handleEntityNotFound(_0x54255c,null))[_0x1e0b('0x2b')](function(_0x330a85){if(_0x330a85){_0x14b826['message']=_0x330a85['get']({'plain':!![]});return db['MailInteraction'][_0x1e0b('0x4e')]({'where':{'id':_0x330a85['MailInteractionId']}});}return null;})[_0x1e0b('0x2b')](handleEntityNotFound(_0x54255c,null))['then'](function(_0x3cef13){if(_0x3cef13){_0x14b826[_0x1e0b('0x7e')]=_0x3cef13[_0x1e0b('0x7b')]({'plain':!![]});interaction_log[_0x1e0b('0x18')](_0x1e0b('0x95'),_0x526fd8[_0x1e0b('0x66')]['id'],_0x526fd8[_0x1e0b('0x66')][_0x1e0b('0x2f')],_0x526fd8['user'][_0x1e0b('0x80')],_0x14b826[_0x1e0b('0x7e')]['id'],_0x526fd8['body']?JSON['stringify'](_0x526fd8['body']):_0x1e0b('0x81'));return respondWithRpcPromise(_0x1e0b('0x96'),_0x1e0b('0x97'),_0x14b826);}return null;})[_0x1e0b('0x2b')](function(_0x4cf4c4){var _0x2ef67b=_0x1e0b('0x83')+_0x4cf4c4[_0x1e0b('0x20')][_0x1e0b('0x84')];return db[_0x1e0b('0x85')][_0x1e0b('0x35')](_0x2ef67b,{'type':db[_0x1e0b('0x86')]['QueryTypes']['SELECT'],'raw':!![]})[_0x1e0b('0x2b')](function(_0x254737){return _0x254737;});})['then'](function(_0x2d2a6e){if(_0x2d2a6e){_0x14b826[_0x1e0b('0x20')][_0x1e0b('0x98')]=_0x2d2a6e[0x0];if(!_0x526fd8[_0x1e0b('0x4f')][_0x1e0b('0x79')])return;return db[_0x1e0b('0x89')]['find']({'where':{'id':_0x526fd8[_0x1e0b('0x4f')][_0x1e0b('0x79')],'role':'agent'},'attributes':['id',_0x1e0b('0x2f'),_0x1e0b('0x99'),_0x1e0b('0x8a'),_0x1e0b('0x8b')],'raw':!![]});}return null;})[_0x1e0b('0x2b')](function(_0x56302c){if(!_0x56302c)return null;_0x14b826[_0x1e0b('0x20')][_0x1e0b('0x7a')]=_0x56302c;return _0x14b826;})[_0x1e0b('0x2b')](function(_0x1a5e09){if(_0x1a5e09){_0x1a5e09[_0x1e0b('0x20')][_0x1e0b('0x8d')]=util['format'](_0x1e0b('0x8e'),_0x526fd8[_0x1e0b('0x66')]['name']);_0x1a5e09[_0x1e0b('0x20')][_0x1e0b('0x90')]=_0x14b826[_0x1e0b('0x90')];_0x1a5e09[_0x1e0b('0x20')][_0x1e0b('0x8f')]=_0x14b826['channel'];_0x1a5e09['message'][_0x1e0b('0x91')]=_0x1e0b('0x9a');_0x1a5e09[_0x1e0b('0x20')][_0x1e0b('0x4f')]=htmlToText['fromString'](_0x14b826[_0x1e0b('0x20')][_0x1e0b('0x4f')]);respondWithRpcPromise('EventManager',_0x1e0b('0x93'),{'event':_0x1e0b('0x9b'),'message':_0x1a5e09[_0x1e0b('0x20')]},client9002);return _0x14b826;}return null;})[_0x1e0b('0x2b')](respondWithResult(_0x54255c,null))['catch'](handleError(_0x54255c,null));};exports['download']=function(_0x390695,_0x32a335){var _0x91e432=moment()[_0x1e0b('0x9c')]()[_0x1e0b('0x9d')]();var _0x51bc8f=path[_0x1e0b('0x69')](config['root'],_0x1e0b('0x9e'),'files',_0x1e0b('0x9f'));var _0x17c3dc=path[_0x1e0b('0x69')](config[_0x1e0b('0x6a')],_0x1e0b('0x9e'),'files',_0x1e0b('0x68'));var _0x58c324=util['format']('message-%s.eml',_0x91e432);return db[_0x1e0b('0x45')][_0x1e0b('0x4e')]({'where':{'id':_0x390695[_0x1e0b('0x4a')]['id']},'attributes':['id',_0x1e0b('0x4f'),_0x1e0b('0xa0'),'to','cc',_0x1e0b('0xa1'),'subject','createdAt'],'include':_0x390695['query'][_0x1e0b('0x68')]?[{'model':db[_0x1e0b('0xa2')],'as':_0x1e0b('0xa3')}]:undefined})[_0x1e0b('0x2b')](handleEntityNotFound(_0x32a335,null))['then'](function(_0x242237){if(_0x242237){var _0x33dcf9=_0x242237;var _0x3fa003={'from':_0x33dcf9[_0x1e0b('0xa0')],'to':_0x33dcf9['to'],'subject':_0x33dcf9[_0x1e0b('0xa4')],'html':_0x33dcf9[_0x1e0b('0x4f')],'headers':{'Date':moment(_0x33dcf9[_0x1e0b('0xa5')])[_0x1e0b('0x78')](_0x1e0b('0xa6'))},'attachments':[]};if(_0x242237['cc']){_0x3fa003[_0x1e0b('0xa7')]['Cc']=_0x242237['cc'];}if(_0x242237[_0x1e0b('0xa1')]){_0x3fa003[_0x1e0b('0xa7')][_0x1e0b('0xa8')]=_0x242237[_0x1e0b('0xa1')];}return new BPromise(function(_0x4bdf80,_0x2020d8){if(_0x242237[_0x1e0b('0xa3')]){for(var _0x284895=0x0;_0x284895<_0x242237[_0x1e0b('0xa3')][_0x1e0b('0x39')];_0x284895++){var _0x50df8b=_0x242237[_0x1e0b('0xa3')][_0x284895];var _0xc6cddd=path[_0x1e0b('0x69')](_0x17c3dc,_0x50df8b['basename']);if(fs[_0x1e0b('0xa9')](_0xc6cddd)){_0x3fa003['attachments'][_0x1e0b('0xaa')]({'name':_0x50df8b[_0x1e0b('0x2f')],'contentType':_0x50df8b[_0x1e0b('0x42')],'data':fs['readFileSync'](_0xc6cddd)});}}}emlformat[_0x1e0b('0xab')](_0x3fa003,function(_0x4f55c5,_0x5f08ae){if(_0x4f55c5)return _0x2020d8(_0x4f55c5);fs[_0x1e0b('0xac')](path[_0x1e0b('0x69')](_0x51bc8f,_0x58c324),_0x5f08ae);return _0x4bdf80(_0x5f08ae);});});}})[_0x1e0b('0x2b')](function(_0xfbfd97){if(_0xfbfd97){return _0x32a335[_0x1e0b('0xad')](path['join'](_0x51bc8f,_0x58c324),_0x58c324,function(_0x22e543){if(!_0x22e543)fs[_0x1e0b('0xae')](path[_0x1e0b('0x69')](_0x51bc8f,_0x58c324));});}})[_0x1e0b('0x21')](handleError(_0x32a335,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index a035ab9..23db3f6 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 _0xa324=['exports','../../mysqldb','MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xa324,0x121));var _0x4a32=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xa324[_0x16b9ed];return _0x66b1f8;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x4a32('0x0'))['db'][_0x4a32('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x4a32('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4a32('0x3'),'afterDestroy':_0x4a32('0x4')};function emitEvent(_0x1e7f2b){return function(_0x3bd756,_0x28bcfd,_0x5bcff5){MailMessageEvents[_0x4a32('0x5')](_0x1e7f2b+':'+_0x3bd756['id'],_0x3bd756);MailMessageEvents[_0x4a32('0x5')](_0x1e7f2b,_0x3bd756);_0x5bcff5(null);};}for(var e in events){if(events[_0x4a32('0x6')](e)){var event=events[e];MailMessage[_0x4a32('0x7')](e,emitEvent(event));}}module[_0x4a32('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x7fca=['events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4d3033,_0x2dff9b){var _0x596dc5=function(_0x39efbd){while(--_0x39efbd){_0x4d3033['push'](_0x4d3033['shift']());}};_0x596dc5(++_0x2dff9b);}(_0x7fca,0x11e));var _0xa7fc=function(_0x3b64cc,_0x322643){_0x3b64cc=_0x3b64cc-0x0;var _0x282e3b=_0x7fca[_0x3b64cc];return _0x282e3b;};'use strict';var EventEmitter=require(_0xa7fc('0x0'));var MailMessage=require(_0xa7fc('0x1'))['db'][_0xa7fc('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xa7fc('0x3')](0x0);var events={'afterCreate':_0xa7fc('0x4'),'afterUpdate':_0xa7fc('0x5'),'afterDestroy':_0xa7fc('0x6')};function emitEvent(_0x66e401){return function(_0x2c686c,_0x2f8f0d,_0x481ac4){MailMessageEvents[_0xa7fc('0x7')](_0x66e401+':'+_0x2c686c['id'],_0x2c686c);MailMessageEvents['emit'](_0x66e401,_0x2c686c);_0x481ac4(null);};}for(var e in events){if(events[_0xa7fc('0x8')](e)){var event=events[e];MailMessage[_0xa7fc('0x9')](e,emitEvent(event));}}module[_0xa7fc('0xa')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index d446a62..6572913 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 _0xcd18=['request-promise','html-to-text','path','rimraf','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','isNil','UserId','MailInteraction','findOne','then','update','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird'];(function(_0x409fd4,_0x193777){var _0x5649da=function(_0x287695){while(--_0x287695){_0x409fd4['push'](_0x409fd4['shift']());}};_0x5649da(++_0x193777);}(_0xcd18,0x11c));var _0x8cd1=function(_0x375382,_0x132b7e){_0x375382=_0x375382-0x0;var _0x243723=_0xcd18[_0x375382];return _0x243723;};'use strict';var _=require(_0x8cd1('0x0'));var util=require('util');var logger=require(_0x8cd1('0x1'))('api');var moment=require(_0x8cd1('0x2'));var BPromise=require(_0x8cd1('0x3'));var rp=require(_0x8cd1('0x4'));var htmlToText=require(_0x8cd1('0x5'));var fs=require('fs');var path=require(_0x8cd1('0x6'));var rimraf=require(_0x8cd1('0x7'));var config=require('../../config/environment');var attributes=require(_0x8cd1('0x8'));module[_0x8cd1('0x9')]=function(_0xcf7c10,_0x350819){return _0xcf7c10[_0x8cd1('0xa')]('MailMessage',attributes,{'tableName':_0x8cd1('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x8cd1('0xc')]},{'name':_0x8cd1('0xd'),'fields':[_0x8cd1('0xe'),'subject'],'type':_0x8cd1('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x176b5b,_0x1995ed,_0x21a53d){if(_0x176b5b[_0x8cd1('0x10')]){_0x176b5b[_0x8cd1('0xe')]=htmlToText[_0x8cd1('0x11')](_0x176b5b[_0x8cd1('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x21a53d(null,_0x1995ed);},'afterCreate':function(_0x3c439c,_0x279e41,_0x319fbf){var _0x35421c=_0xcf7c10[_0x8cd1('0x12')];var _0x27954b=_0x3c439c[_0x8cd1('0x13')]({'plain':!![]});if(_0x27954b[_0x8cd1('0x14')][_0x8cd1('0x15')]()==='in'||_0x27954b[_0x8cd1('0x14')][_0x8cd1('0x15')]()===_0x8cd1('0x16')&&!_0x27954b['secret']&&!_[_0x8cd1('0x17')](_0x27954b[_0x8cd1('0x18')])){_0x35421c[_0x8cd1('0x19')][_0x8cd1('0x1a')]({'where':{'id':_0x27954b['MailInteractionId']}})[_0x8cd1('0x1b')](function(_0x253853){if(_0x253853){_0x253853[_0x8cd1('0x1c')]({'lastMsgAt':_0x27954b['createdAt'],'lastMsgDirection':_0x27954b[_0x8cd1('0x14')][_0x8cd1('0x15')]()});}})[_0x8cd1('0x1d')](function(_0x3016f6){console[_0x8cd1('0x1e')](_0x3016f6);});}_0x319fbf();}},'charset':'utf8mb4','collate':_0x8cd1('0x1f')});}; \ No newline at end of file +var _0xafb0=['MailInteraction','findOne','MailInteractionId','then','update','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','mail_messages','messageId','FULLTEXT','body','plainBody','fromString','models','get','toLowerCase','secret','isNil','UserId'];(function(_0x53baa9,_0x49e0f8){var _0x37c9c5=function(_0x3db0f3){while(--_0x3db0f3){_0x53baa9['push'](_0x53baa9['shift']());}};_0x37c9c5(++_0x49e0f8);}(_0xafb0,0x1b7));var _0x0afb=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xafb0[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0x0afb('0x0'));var util=require(_0x0afb('0x1'));var logger=require(_0x0afb('0x2'))(_0x0afb('0x3'));var moment=require(_0x0afb('0x4'));var BPromise=require(_0x0afb('0x5'));var rp=require(_0x0afb('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x0afb('0x7'));var rimraf=require(_0x0afb('0x8'));var config=require(_0x0afb('0x9'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x1b95bd,_0x21f9b1){return _0x1b95bd[_0x0afb('0xa')]('MailMessage',attributes,{'tableName':_0x0afb('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x0afb('0xc')]},{'name':'fti_mail_messages','fields':['plainBody','subject'],'type':_0x0afb('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x338436,_0x537bbf,_0x1902b6){if(_0x338436[_0x0afb('0xe')]){_0x338436[_0x0afb('0xf')]=htmlToText[_0x0afb('0x10')](_0x338436[_0x0afb('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1902b6(null,_0x537bbf);},'afterCreate':function(_0x3b7e2d,_0xa1a01c,_0x4bbe2b){var _0x4840a2=_0x1b95bd[_0x0afb('0x11')];var _0x4fab9a=_0x3b7e2d[_0x0afb('0x12')]({'plain':!![]});if(_0x4fab9a['direction'][_0x0afb('0x13')]()==='in'||_0x4fab9a['direction'][_0x0afb('0x13')]()==='out'&&!_0x4fab9a[_0x0afb('0x14')]&&!_[_0x0afb('0x15')](_0x4fab9a[_0x0afb('0x16')])){_0x4840a2[_0x0afb('0x17')][_0x0afb('0x18')]({'where':{'id':_0x4fab9a[_0x0afb('0x19')]}})[_0x0afb('0x1a')](function(_0x1febe5){if(_0x1febe5){_0x1febe5[_0x0afb('0x1b')]({'lastMsgAt':_0x4fab9a['createdAt'],'lastMsgDirection':_0x4fab9a[_0x0afb('0x1c')][_0x0afb('0x13')]()});}})[_0x0afb('0x1d')](function(_0x54f056){console[_0x0afb('0x1e')](_0x54f056);});}_0x4bbe2b();}},'charset':_0x0afb('0x1f'),'collate':_0x0afb('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 8def094..e68f5b3 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 _0x6343=['jayson/promise','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','moment','bluebird','../../config/logger','rpc'];(function(_0x3df4b7,_0x2dacb9){var _0x20bcb7=function(_0x1ec66c){while(--_0x1ec66c){_0x3df4b7['push'](_0x3df4b7['shift']());}};_0x20bcb7(++_0x2dacb9);}(_0x6343,0x168));var _0x3634=function(_0x11375c,_0x194b53){_0x11375c=_0x11375c-0x0;var _0x393980=_0x6343[_0x11375c];return _0x393980;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3634('0x0'));var BPromise=require(_0x3634('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3634('0x2'))(_0x3634('0x3'));var config=require('../../config/environment');var jayson=require(_0x3634('0x4'));var client=jayson[_0x3634('0x5')]['http']({'port':0x232a});config[_0x3634('0x6')]=_[_0x3634('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3634('0x8'))(new Redis(config[_0x3634('0x6')]));require(_0x3634('0x9'))[_0x3634('0xa')](socket);function respondWithRpcPromise(_0x2e8e8b,_0x43f681,_0x5e907a){return new BPromise(function(_0x4b965a,_0x31bcfc){return client[_0x3634('0xb')](_0x2e8e8b,_0x5e907a)['then'](function(_0x2bb4db){logger[_0x3634('0xc')](_0x3634('0xd'),_0x43f681,_0x3634('0xe'));logger[_0x3634('0xf')](_0x3634('0x10'),_0x43f681,_0x3634('0xe'),JSON[_0x3634('0x11')](_0x2bb4db));if(_0x2bb4db[_0x3634('0x12')]){if(_0x2bb4db[_0x3634('0x12')][_0x3634('0x13')]===0x1f4){logger[_0x3634('0x12')](_0x3634('0xd'),_0x43f681,_0x2bb4db[_0x3634('0x12')]['message']);return _0x31bcfc(_0x2bb4db[_0x3634('0x12')]['message']);}logger[_0x3634('0x12')](_0x3634('0xd'),_0x43f681,_0x2bb4db[_0x3634('0x12')][_0x3634('0x14')]);return _0x4b965a(_0x2bb4db[_0x3634('0x12')]['message']);}else{logger[_0x3634('0xc')]('MailMessage,\x20%s,\x20%s',_0x43f681,'request\x20sent');_0x4b965a(_0x2bb4db[_0x3634('0x15')]['message']);}})[_0x3634('0x16')](function(_0x32e3c6){logger[_0x3634('0x12')]('MailMessage,\x20%s,\x20%s',_0x43f681,_0x32e3c6);_0x31bcfc(_0x32e3c6);});});}exports[_0x3634('0x17')]=function(_0x4366bc){var _0x577a6c=this;return new Promise(function(_0xeb9231,_0x506281){return db[_0x3634('0x18')][_0x3634('0x19')](_0x4366bc['body'],{'raw':_0x4366bc[_0x3634('0x1a')]?_0x4366bc[_0x3634('0x1a')][_0x3634('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x22b7ef){logger[_0x3634('0xc')]('CreateMailMessage',_0x4366bc);logger[_0x3634('0xf')]('CreateMailMessage',_0x4366bc,JSON['stringify'](_0x22b7ef));_0xeb9231(_0x22b7ef);})[_0x3634('0x16')](function(_0x862ab5){logger['error'](_0x3634('0x17'),_0x862ab5[_0x3634('0x14')],_0x4366bc);_0x506281(_0x577a6c[_0x3634('0x12')](0x1f4,_0x862ab5[_0x3634('0x14')]));});});}; \ No newline at end of file +var _0x8952=['error','message','MailMessage,\x20%s,\x20%s','result','catch','create','body','options','raw','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','then','info','request\x20sent','debug','stringify','code'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8952,0x17e));var _0x2895=function(_0x4d3b7c,_0x15f349){_0x4d3b7c=_0x4d3b7c-0x0;var _0x101e08=_0x8952[_0x4d3b7c];return _0x101e08;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2895('0xb')],{'host':_0x2895('0xc'),'port':0x18eb});var socket=require(_0x2895('0xd'))(new Redis(config[_0x2895('0xb')]));require(_0x2895('0xe'))['register'](socket);function respondWithRpcPromise(_0x14fb67,_0x5f2632,_0x428772){return new BPromise(function(_0x5af454,_0x5e66fc){return client['request'](_0x14fb67,_0x428772)[_0x2895('0xf')](function(_0x1829a2){logger[_0x2895('0x10')]('MailMessage,\x20%s,\x20%s',_0x5f2632,_0x2895('0x11'));logger[_0x2895('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5f2632,_0x2895('0x11'),JSON[_0x2895('0x13')](_0x1829a2));if(_0x1829a2['error']){if(_0x1829a2['error'][_0x2895('0x14')]===0x1f4){logger[_0x2895('0x15')]('MailMessage,\x20%s,\x20%s',_0x5f2632,_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);return _0x5e66fc(_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);}logger[_0x2895('0x15')](_0x2895('0x17'),_0x5f2632,_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);return _0x5af454(_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);}else{logger[_0x2895('0x10')](_0x2895('0x17'),_0x5f2632,_0x2895('0x11'));_0x5af454(_0x1829a2[_0x2895('0x18')][_0x2895('0x16')]);}})[_0x2895('0x19')](function(_0x2fe8fe){logger[_0x2895('0x15')]('MailMessage,\x20%s,\x20%s',_0x5f2632,_0x2fe8fe);_0x5e66fc(_0x2fe8fe);});});}exports['CreateMailMessage']=function(_0x493851){var _0x442cfa=this;return new Promise(function(_0x12c2fb,_0x3ec4da){return db['MailMessage'][_0x2895('0x1a')](_0x493851[_0x2895('0x1b')],{'raw':_0x493851[_0x2895('0x1c')]?_0x493851[_0x2895('0x1c')][_0x2895('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x30c6c3){logger[_0x2895('0x10')]('CreateMailMessage',_0x493851);logger[_0x2895('0x12')](_0x2895('0x1e'),_0x493851,JSON[_0x2895('0x13')](_0x30c6c3));_0x12c2fb(_0x30c6c3);})['catch'](function(_0x4e884f){logger[_0x2895('0x15')](_0x2895('0x1e'),_0x4e884f[_0x2895('0x16')],_0x493851);_0x3ec4da(_0x442cfa['error'](0x1f4,_0x4e884f[_0x2895('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index d685998..96358c4 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 _0x6c76=['remove','register','mailMessage:','./mailMessage.events','save'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0x6c76,0x184));var _0x66c7=function(_0x23a1f0,_0x36c8fd){_0x23a1f0=_0x23a1f0-0x0;var _0x2cf328=_0x6c76[_0x23a1f0];return _0x2cf328;};'use strict';var MailMessageEvents=require(_0x66c7('0x0'));var events=[_0x66c7('0x1'),_0x66c7('0x2'),'update'];function createListener(_0x203e75,_0xd49f21){return function(_0x519756){_0xd49f21['emit'](_0x203e75,_0x519756);};}function removeListener(_0x2f6db7,_0x2b7cf3){return function(){MailMessageEvents['removeListener'](_0x2f6db7,_0x2b7cf3);};}exports[_0x66c7('0x3')]=function(_0x45b0a5){for(var _0x52f71b=0x0,_0x23408c=events['length'];_0x52f71b<_0x23408c;_0x52f71b++){var _0x4fa6ce=events[_0x52f71b];var _0x208d06=createListener(_0x66c7('0x4')+_0x4fa6ce,_0x45b0a5);MailMessageEvents['on'](_0x4fa6ce,_0x208d06);}}; \ No newline at end of file +var _0xfc30=['./mailMessage.events','save','remove','emit','removeListener','register','length','mailMessage:'];(function(_0xae5d09,_0x539dc0){var _0xc673ab=function(_0x4cff4b){while(--_0x4cff4b){_0xae5d09['push'](_0xae5d09['shift']());}};_0xc673ab(++_0x539dc0);}(_0xfc30,0xd8));var _0x0fc3=function(_0x1ce0ff,_0x1d224c){_0x1ce0ff=_0x1ce0ff-0x0;var _0x448b56=_0xfc30[_0x1ce0ff];return _0x448b56;};'use strict';var MailMessageEvents=require(_0x0fc3('0x0'));var events=[_0x0fc3('0x1'),_0x0fc3('0x2'),'update'];function createListener(_0x5b8286,_0x36fd79){return function(_0x347fed){_0x36fd79[_0x0fc3('0x3')](_0x5b8286,_0x347fed);};}function removeListener(_0x4e6ad2,_0x38795a){return function(){MailMessageEvents[_0x0fc3('0x4')](_0x4e6ad2,_0x38795a);};}exports[_0x0fc3('0x5')]=function(_0x587989){for(var _0x5ab15d=0x0,_0x37a381=events[_0x0fc3('0x6')];_0x5ab15d<_0x37a381;_0x5ab15d++){var _0x3c458c=events[_0x5ab15d];var _0x369fc1=createListener(_0x0fc3('0x7')+_0x3c458c,_0x587989);MailMessageEvents['on'](_0x3c458c,_0x369fc1);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index dd9e91a..2508d57 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 _0x44aa=['../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','addTeams','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xceda04,_0x53030a){var _0x46ad47=function(_0x345266){while(--_0x345266){_0xceda04['push'](_0xceda04['shift']());}};_0x46ad47(++_0x53030a);}(_0x44aa,0x96));var _0xa44a=function(_0x5f4cad,_0x1af233){_0x5f4cad=_0x5f4cad-0x0;var _0x4ee7ac=_0x44aa[_0x5f4cad];return _0x4ee7ac;};'use strict';var multer=require(_0xa44a('0x0'));var util=require('util');var path=require(_0xa44a('0x1'));var timeout=require(_0xa44a('0x2'));var express=require(_0xa44a('0x3'));var router=express[_0xa44a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa44a('0x5'));var interaction=require(_0xa44a('0x6'));var config=require('../../config/environment');var controller=require(_0xa44a('0x7'));router[_0xa44a('0x8')]('/',auth[_0xa44a('0x9')](),controller[_0xa44a('0xa')]);router['get'](_0xa44a('0xb'),auth[_0xa44a('0x9')](),controller[_0xa44a('0xc')]);router[_0xa44a('0x8')]('/:id',auth[_0xa44a('0x9')](),controller[_0xa44a('0xd')]);router[_0xa44a('0x8')](_0xa44a('0xe'),auth[_0xa44a('0x9')](),controller[_0xa44a('0xf')]);router['get'](_0xa44a('0x10'),auth[_0xa44a('0x9')](),controller['getTeams']);router[_0xa44a('0x8')](_0xa44a('0x11'),auth[_0xa44a('0x9')](),controller[_0xa44a('0x12')]);router['post']('/',auth[_0xa44a('0x9')](),controller['create']);router['post'](_0xa44a('0x10'),auth[_0xa44a('0x9')](),controller[_0xa44a('0x13')]);router['post']('/:id/users',auth[_0xa44a('0x9')](),controller['addAgents']);router[_0xa44a('0x14')]('/:id',auth[_0xa44a('0x9')](),controller[_0xa44a('0x15')]);router[_0xa44a('0x16')]('/:id',auth[_0xa44a('0x9')](),controller[_0xa44a('0x17')]);router[_0xa44a('0x16')](_0xa44a('0x10'),auth[_0xa44a('0x9')](),controller[_0xa44a('0x18')]);router[_0xa44a('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xa44a('0x19')]);module['exports']=router; \ No newline at end of file +var _0xacfb=['util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','removeTeams','exports'];(function(_0x53ed9f,_0x29a4af){var _0x478db8=function(_0x587e90){while(--_0x587e90){_0x53ed9f['push'](_0x53ed9f['shift']());}};_0x478db8(++_0x29a4af);}(_0xacfb,0x90));var _0xbacf=function(_0xeeaa49,_0x101fe2){_0xeeaa49=_0xeeaa49-0x0;var _0xfa0a12=_0xacfb[_0xeeaa49];return _0xfa0a12;};'use strict';var multer=require('multer');var util=require(_0xbacf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xbacf('0x1'));var auth=require(_0xbacf('0x2'));var interaction=require(_0xbacf('0x3'));var config=require(_0xbacf('0x4'));var controller=require(_0xbacf('0x5'));router[_0xbacf('0x6')]('/',auth[_0xbacf('0x7')](),controller[_0xbacf('0x8')]);router[_0xbacf('0x6')]('/describe',auth[_0xbacf('0x7')](),controller['describe']);router[_0xbacf('0x6')](_0xbacf('0x9'),auth[_0xbacf('0x7')](),controller[_0xbacf('0xa')]);router['get'](_0xbacf('0xb'),auth[_0xbacf('0x7')](),controller['getMembers']);router['get'](_0xbacf('0xc'),auth[_0xbacf('0x7')](),controller[_0xbacf('0xd')]);router[_0xbacf('0x6')](_0xbacf('0xe'),auth[_0xbacf('0x7')](),controller[_0xbacf('0xf')]);router[_0xbacf('0x10')]('/',auth[_0xbacf('0x7')](),controller[_0xbacf('0x11')]);router[_0xbacf('0x10')](_0xbacf('0xc'),auth[_0xbacf('0x7')](),controller[_0xbacf('0x12')]);router[_0xbacf('0x10')](_0xbacf('0xe'),auth['isAuthenticated'](),controller[_0xbacf('0x13')]);router[_0xbacf('0x14')](_0xbacf('0x9'),auth[_0xbacf('0x7')](),controller['update']);router[_0xbacf('0x15')](_0xbacf('0x9'),auth[_0xbacf('0x7')](),controller['destroy']);router['delete'](_0xbacf('0xc'),auth[_0xbacf('0x7')](),controller[_0xbacf('0x16')]);router[_0xbacf('0x15')]('/:id/users',auth[_0xbacf('0x7')](),controller['removeAgents']);module[_0xbacf('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 3b80b31..4c6ef09 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 _0x407f=['rrmemory','beepall','roundrobin','exports','STRING','INTEGER','ENUM'];(function(_0xa5d031,_0x3d5bd4){var _0x31250f=function(_0x3538b0){while(--_0x3538b0){_0xa5d031['push'](_0xa5d031['shift']());}};_0x31250f(++_0x3d5bd4);}(_0x407f,0x14c));var _0xf407=function(_0x367353,_0x29d448){_0x367353=_0x367353-0x0;var _0x1bd728=_0x407f[_0x367353];return _0x1bd728;};'use strict';var Sequelize=require('sequelize');module[_0xf407('0x0')]={'name':{'type':Sequelize[_0xf407('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf407('0x1')]},'timeout':{'type':Sequelize[_0xf407('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf407('0x3')](_0xf407('0x4'),_0xf407('0x5'),_0xf407('0x6'))}}; \ No newline at end of file +var _0x075d=['exports','name','STRING','INTEGER','ENUM','roundrobin','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x075d,0xbc));var _0xd075=function(_0xf15a33,_0xb58e5e){_0xf15a33=_0xf15a33-0x0;var _0xfa14ac=_0x075d[_0xf15a33];return _0xfa14ac;};'use strict';var Sequelize=require(_0xd075('0x0'));module[_0xd075('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd075('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd075('0x3')]},'timeout':{'type':Sequelize[_0xd075('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd075('0x5')]('rrmemory','beepall',_0xd075('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 9d943c0..cd152b2 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 _0xec53=['query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','MailQueue','include','rows','catch','show','params','rawAttributes','keys','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','UserMailQueue','pick','MailQueueId','findAll','User','UserId','agent','mailPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','addTeams','Agents','online','voicePause','flatMap','transaction','each','forEach','userMailQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','sequelize','every','TeamId','all','compact','isEmpty','removeAgents','emit','userMailQueue:remove','omit','isArray','getAgents','zip-dir','request-promise','moment','mustache','util','sox','to-csv','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','get','MailQueues','UserProfileResource','then','end','stack','name','send','index','map','fieldName','type','key'];(function(_0x2f0c4e,_0x1354da){var _0x55f193=function(_0xa12b2){while(--_0xa12b2){_0x2f0c4e['push'](_0x2f0c4e['shift']());}};_0x55f193(++_0x1354da);}(_0xec53,0x1e6));var _0x3ec5=function(_0x4d493f,_0x2a093b){_0x4d493f=_0x4d493f-0x0;var _0x2ba541=_0xec53[_0x4d493f];return _0x2ba541;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3ec5('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ec5('0x1'));var moment=require(_0x3ec5('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3ec5('0x3'));var util=require(_0x3ec5('0x4'));var path=require('path');var sox=require(_0x3ec5('0x5'));var csv=require(_0x3ec5('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3ec5('0x7'));var deskjs=require(_0x3ec5('0x8'));var toCsv=require(_0x3ec5('0x6'));var querystring=require(_0x3ec5('0x9'));var Papa=require(_0x3ec5('0xa'));var Redis=require(_0x3ec5('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x3ec5('0xc'));var as=require(_0x3ec5('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ec5('0xe'))(_0x3ec5('0xf'));var utils=require(_0x3ec5('0x10'));var config=require(_0x3ec5('0x11'));var licenseUtil=require(_0x3ec5('0x12'));var db=require(_0x3ec5('0x13'))['db'];config[_0x3ec5('0x14')]=_[_0x3ec5('0x15')](config[_0x3ec5('0x14')],{'host':_0x3ec5('0x16'),'port':0x18eb});var socket=require(_0x3ec5('0x17'))(new Redis(config['redis']));require(_0x3ec5('0x18'))[_0x3ec5('0x19')](socket);function respondWithStatusCode(_0x81c785,_0x565f95){_0x565f95=_0x565f95||0xcc;return function(_0x5cf63f){if(_0x5cf63f){return _0x81c785['sendStatus'](_0x565f95);}return _0x81c785[_0x3ec5('0x1a')](_0x565f95)['end']();};}function respondWithResult(_0x285eec,_0xf1332e){_0xf1332e=_0xf1332e||0xc8;return function(_0x2f7c2c){if(_0x2f7c2c){return _0x285eec[_0x3ec5('0x1a')](_0xf1332e)['json'](_0x2f7c2c);}};}function respondWithFilteredResult(_0x1af72d,_0x1557d1){return function(_0x265358){if(_0x265358){var _0x3ff54f=typeof _0x1557d1[_0x3ec5('0x1b')]===_0x3ec5('0x1c')&&typeof _0x1557d1['limit']===_0x3ec5('0x1c');var _0x528ebc=_0x265358[_0x3ec5('0x1d')];var _0xd3c582=_0x3ff54f?0x0:_0x1557d1[_0x3ec5('0x1b')];var _0x461802=_0x3ff54f?_0x265358[_0x3ec5('0x1d')]:_0x1557d1[_0x3ec5('0x1b')]+_0x1557d1[_0x3ec5('0x1e')];var _0x4a6f13;if(_0x461802>=_0x528ebc){_0x461802=_0x528ebc;_0x4a6f13=0xc8;}else{_0x4a6f13=0xce;}_0x1af72d[_0x3ec5('0x1a')](_0x4a6f13);return _0x1af72d['set'](_0x3ec5('0x1f'),_0xd3c582+'-'+_0x461802+'/'+_0x528ebc)[_0x3ec5('0x20')](_0x265358);}return null;};}function patchUpdates(_0x5a58c7){return function(_0x5e7b47){try{jsonpatch[_0x3ec5('0x21')](_0x5e7b47,_0x5a58c7,!![]);}catch(_0x48fad6){return BPromise[_0x3ec5('0x22')](_0x48fad6);}return _0x5e7b47[_0x3ec5('0x23')]();};}function saveUpdates(_0x34ac5c,_0x51af32){return function(_0x286db2){if(_0x286db2){return _0x286db2[_0x3ec5('0x24')](_0x34ac5c)['then'](function(_0x5790ce){return _0x5790ce;});}return null;};}function removeEntity(_0x15b3ac,_0x321c62){return function(_0x4bb7b4){if(_0x4bb7b4){return _0x4bb7b4['destroy']()['then'](function(){var _0x1caac2=_0x4bb7b4[_0x3ec5('0x25')]({'plain':!![]});var _0x5d0d1e=_0x3ec5('0x26');return db[_0x3ec5('0x27')]['destroy']({'where':{'type':_0x5d0d1e,'resourceId':_0x1caac2['id']}})[_0x3ec5('0x28')](function(){return _0x4bb7b4;});})[_0x3ec5('0x28')](function(){_0x15b3ac[_0x3ec5('0x1a')](0xcc)[_0x3ec5('0x29')]();});}};}function handleEntityNotFound(_0x65da43,_0x5d505d){return function(_0x59d7b7){if(!_0x59d7b7){_0x65da43['sendStatus'](0x194);}return _0x59d7b7;};}function handleError(_0x1ffd06,_0x2cde2d){_0x2cde2d=_0x2cde2d||0x1f4;return function(_0x5d05a2){logger['error'](_0x5d05a2[_0x3ec5('0x2a')]);if(_0x5d05a2[_0x3ec5('0x2b')]){delete _0x5d05a2[_0x3ec5('0x2b')];}_0x1ffd06[_0x3ec5('0x1a')](_0x2cde2d)[_0x3ec5('0x2c')](_0x5d05a2);};}exports[_0x3ec5('0x2d')]=function(_0x2ecc61,_0x1fdad9){var _0x51dcf9={},_0x5cb75a={},_0x4d9395={'count':0x0,'rows':[]};var _0x241cd1=_[_0x3ec5('0x2e')](db['MailQueue']['rawAttributes'],function(_0x83f712){return{'name':_0x83f712[_0x3ec5('0x2f')],'type':_0x83f712[_0x3ec5('0x30')][_0x3ec5('0x31')]};});_0x5cb75a['model']=_[_0x3ec5('0x2e')](_0x241cd1,_0x3ec5('0x2b'));_0x5cb75a[_0x3ec5('0x32')]=_['keys'](_0x2ecc61[_0x3ec5('0x32')]);_0x5cb75a[_0x3ec5('0x33')]=_[_0x3ec5('0x34')](_0x5cb75a[_0x3ec5('0x35')],_0x5cb75a['query']);_0x51dcf9[_0x3ec5('0x36')]=_[_0x3ec5('0x34')](_0x5cb75a[_0x3ec5('0x35')],qs[_0x3ec5('0x37')](_0x2ecc61[_0x3ec5('0x32')][_0x3ec5('0x37')]));_0x51dcf9['attributes']=_0x51dcf9[_0x3ec5('0x36')][_0x3ec5('0x38')]?_0x51dcf9['attributes']:_0x5cb75a[_0x3ec5('0x35')];if(!_0x2ecc61['query'][_0x3ec5('0x39')](_0x3ec5('0x3a'))){_0x51dcf9[_0x3ec5('0x1e')]=qs[_0x3ec5('0x1e')](_0x2ecc61[_0x3ec5('0x32')][_0x3ec5('0x1e')]);_0x51dcf9[_0x3ec5('0x1b')]=qs['offset'](_0x2ecc61[_0x3ec5('0x32')][_0x3ec5('0x1b')]);}_0x51dcf9[_0x3ec5('0x3b')]=qs[_0x3ec5('0x3c')](_0x2ecc61[_0x3ec5('0x32')]['sort']);_0x51dcf9[_0x3ec5('0x3d')]=qs[_0x3ec5('0x33')](_['pick'](_0x2ecc61['query'],_0x5cb75a[_0x3ec5('0x33')]),_0x241cd1);if(_0x2ecc61[_0x3ec5('0x32')][_0x3ec5('0x3e')]){_0x51dcf9['where']=_[_0x3ec5('0x3f')](_0x51dcf9[_0x3ec5('0x3d')],{'$or':_['map'](_0x241cd1,function(_0x12b015){if(_0x12b015['type']!==_0x3ec5('0x40')){var _0x1db591={};_0x1db591[_0x12b015[_0x3ec5('0x2b')]]={'$like':'%'+_0x2ecc61['query'][_0x3ec5('0x3e')]+'%'};return _0x1db591;}})});}_0x51dcf9=_['merge']({},_0x51dcf9,_0x2ecc61[_0x3ec5('0x41')]);var _0x144897={'where':_0x51dcf9[_0x3ec5('0x3d')]};return db[_0x3ec5('0x42')][_0x3ec5('0x1d')](_0x144897)[_0x3ec5('0x28')](function(_0x50d0a3){_0x4d9395[_0x3ec5('0x1d')]=_0x50d0a3;if(_0x2ecc61[_0x3ec5('0x32')]['includeAll']){_0x51dcf9[_0x3ec5('0x43')]=[{'all':!![]}];}return db[_0x3ec5('0x42')]['findAll'](_0x51dcf9);})[_0x3ec5('0x28')](function(_0x245f91){_0x4d9395[_0x3ec5('0x44')]=_0x245f91;return _0x4d9395;})[_0x3ec5('0x28')](respondWithFilteredResult(_0x1fdad9,_0x51dcf9))[_0x3ec5('0x45')](handleError(_0x1fdad9,null));};exports[_0x3ec5('0x46')]=function(_0x2743da,_0x1a9270){var _0x2e7664={'raw':!![],'where':{'id':_0x2743da[_0x3ec5('0x47')]['id']}},_0x2587fb={};_0x2587fb['model']=_['keys'](db['MailQueue'][_0x3ec5('0x48')]);_0x2587fb[_0x3ec5('0x32')]=_[_0x3ec5('0x49')](_0x2743da['query']);_0x2587fb[_0x3ec5('0x33')]=_[_0x3ec5('0x34')](_0x2587fb['model'],_0x2587fb[_0x3ec5('0x32')]);_0x2e7664[_0x3ec5('0x36')]=_[_0x3ec5('0x34')](_0x2587fb[_0x3ec5('0x35')],qs[_0x3ec5('0x37')](_0x2743da[_0x3ec5('0x32')][_0x3ec5('0x37')]));_0x2e7664[_0x3ec5('0x36')]=_0x2e7664['attributes'][_0x3ec5('0x38')]?_0x2e7664[_0x3ec5('0x36')]:_0x2587fb['model'];if(_0x2743da['query'][_0x3ec5('0x4a')]){_0x2e7664[_0x3ec5('0x43')]=[{'all':!![]}];}_0x2e7664=_[_0x3ec5('0x3f')]({},_0x2e7664,_0x2743da[_0x3ec5('0x41')]);return db[_0x3ec5('0x42')][_0x3ec5('0x4b')](_0x2e7664)[_0x3ec5('0x28')](handleEntityNotFound(_0x1a9270,null))['then'](respondWithResult(_0x1a9270,null))['catch'](handleError(_0x1a9270,null));};exports[_0x3ec5('0x4c')]=function(_0x5c7347,_0x7c06ae){return db[_0x3ec5('0x42')][_0x3ec5('0x4c')](_0x5c7347['body'],{})[_0x3ec5('0x28')](function(_0x106384){var _0x2b4b7e=_0x5c7347['user'][_0x3ec5('0x25')]({'plain':!![]});if(!_0x2b4b7e)throw new Error(_0x3ec5('0x4d'));if(_0x2b4b7e['role']==='user'){var _0x193f21=_0x106384[_0x3ec5('0x25')]({'plain':!![]});var _0x3247b1=_0x3ec5('0x26');return db[_0x3ec5('0x4e')]['find']({'where':{'name':_0x3247b1,'userProfileId':_0x2b4b7e['userProfileId']},'raw':!![]})[_0x3ec5('0x28')](function(_0x1dec97){if(_0x1dec97&&_0x1dec97[_0x3ec5('0x4f')]===0x0){return db[_0x3ec5('0x27')][_0x3ec5('0x4c')]({'name':_0x193f21['name'],'resourceId':_0x193f21['id'],'type':_0x1dec97[_0x3ec5('0x2b')],'sectionId':_0x1dec97['id']},{})[_0x3ec5('0x28')](function(){return _0x106384;});}else{return _0x106384;}})[_0x3ec5('0x45')](function(_0xa81490){logger[_0x3ec5('0x50')](_0x3ec5('0x51'),_0xa81490);throw _0xa81490;});}return _0x106384;})[_0x3ec5('0x28')](respondWithResult(_0x7c06ae,0xc9))[_0x3ec5('0x45')](handleError(_0x7c06ae,null));};exports[_0x3ec5('0x24')]=function(_0x23ed07,_0x51edba){if(_0x23ed07['body']['id']){delete _0x23ed07['body']['id'];}return db['MailQueue'][_0x3ec5('0x4b')]({'where':{'id':_0x23ed07[_0x3ec5('0x47')]['id']}})[_0x3ec5('0x28')](handleEntityNotFound(_0x51edba,null))[_0x3ec5('0x28')](saveUpdates(_0x23ed07[_0x3ec5('0x52')],null))[_0x3ec5('0x28')](respondWithResult(_0x51edba,null))[_0x3ec5('0x45')](handleError(_0x51edba,null));};exports[_0x3ec5('0x53')]=function(_0x342841,_0x3ce2ec){return db['MailQueue'][_0x3ec5('0x4b')]({'where':{'id':_0x342841[_0x3ec5('0x47')]['id']}})[_0x3ec5('0x28')](handleEntityNotFound(_0x3ce2ec,null))[_0x3ec5('0x28')](removeEntity(_0x3ce2ec,null))[_0x3ec5('0x45')](handleError(_0x3ce2ec,null));};exports[_0x3ec5('0x54')]=function(_0x52cd50,_0x261c36){return db[_0x3ec5('0x42')][_0x3ec5('0x54')]()['then'](respondWithResult(_0x261c36,null))['catch'](handleError(_0x261c36,null));};exports[_0x3ec5('0x55')]=function(_0x57fe16,_0x2a03b3,_0xe5fa9a){var _0x314caa={'raw':!![],'where':{}},_0x4498ff={},_0x4aa14a;return db[_0x3ec5('0x42')][_0x3ec5('0x56')]({'where':{'id':_0x57fe16[_0x3ec5('0x47')]['id']}})[_0x3ec5('0x28')](handleEntityNotFound(_0x2a03b3,null))[_0x3ec5('0x28')](function(_0x518224){if(_0x518224){_0x4aa14a=_0x518224[_0x3ec5('0x25')]({'plain':!![]});_0x4498ff[_0x3ec5('0x35')]=_[_0x3ec5('0x49')](db[_0x3ec5('0x57')]['rawAttributes']);_0x4498ff['query']=_['keys'](_0x57fe16[_0x3ec5('0x32')]);_0x4498ff[_0x3ec5('0x33')]=_['intersection'](_0x4498ff['model'],_0x4498ff[_0x3ec5('0x32')]);_0x314caa['attributes']=_[_0x3ec5('0x34')](_0x4498ff[_0x3ec5('0x35')],qs[_0x3ec5('0x37')](_0x57fe16[_0x3ec5('0x32')][_0x3ec5('0x37')]));_0x314caa['attributes']=_0x314caa[_0x3ec5('0x36')]['length']?_0x314caa['attributes']:_0x4498ff[_0x3ec5('0x35')];if(!_0x57fe16['query'][_0x3ec5('0x39')](_0x3ec5('0x3a'))){_0x314caa[_0x3ec5('0x1e')]=qs[_0x3ec5('0x1e')](_0x57fe16['query'][_0x3ec5('0x1e')]);_0x314caa[_0x3ec5('0x1b')]=qs['offset'](_0x57fe16[_0x3ec5('0x32')]['offset']);}_0x314caa[_0x3ec5('0x3b')]=qs[_0x3ec5('0x3c')](_0x57fe16[_0x3ec5('0x32')]['sort']);_0x314caa[_0x3ec5('0x3d')]=qs['filters'](_[_0x3ec5('0x58')](_0x57fe16[_0x3ec5('0x32')],_0x4498ff[_0x3ec5('0x33')]));_0x314caa['where'][_0x3ec5('0x59')]=_0x518224['id'];if(_0x57fe16[_0x3ec5('0x32')][_0x3ec5('0x3e')]){_0x314caa['where']=_['merge'](_0x314caa[_0x3ec5('0x3d')],{'$or':_[_0x3ec5('0x2e')](_0x314caa[_0x3ec5('0x36')],function(_0x59787c){var _0xa5d895={};_0xa5d895[_0x59787c]={'$like':'%'+_0x57fe16[_0x3ec5('0x32')][_0x3ec5('0x3e')]+'%'};return _0xa5d895;})});}_0x314caa=_[_0x3ec5('0x3f')]({},_0x314caa,_0x57fe16[_0x3ec5('0x41')]);return db[_0x3ec5('0x57')][_0x3ec5('0x5a')](_0x314caa);}})[_0x3ec5('0x28')](function(_0x559618){if(_0x559618){return db[_0x3ec5('0x5b')]['findAndCountAll']({'where':{'id':_[_0x3ec5('0x2e')](_0x559618,_0x3ec5('0x5c')),'role':_0x3ec5('0x5d')},'attributes':['id','name',_0x3ec5('0x5e'),'updatedAt','createdAt']});}})[_0x3ec5('0x28')](function(_0x5a153e){if(_0x5a153e){return{'count':_0x5a153e['count'],'rows':_[_0x3ec5('0x2e')](_0x5a153e[_0x3ec5('0x44')],function(_0x3a05c1){return{'membername':_0x3a05c1[_0x3ec5('0x2b')],'UserId':_0x3a05c1['id'],'queue_name':_0x4aa14a[_0x3ec5('0x2b')],'MailQueueId':_0x4aa14a['id'],'interface':util[_0x3ec5('0x5f')](_0x3ec5('0x60'),_0x3ec5('0x61'),_0x3a05c1[_0x3ec5('0x2b')]),'penalty':0x0,'paused':_0x3a05c1['mailPause'],'createdAt':_0x3a05c1[_0x3ec5('0x62')],'updatedAt':_0x3a05c1[_0x3ec5('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3ec5('0x28')](respondWithFilteredResult(_0x2a03b3,_0x314caa))[_0x3ec5('0x45')](handleError(_0x2a03b3,null));};exports[_0x3ec5('0x64')]=function(_0x36bac7,_0x185b02,_0x4d2abe){var _0x1ae3fb={};var _0x1ff69b={};var _0x33fbfc;var _0x12d0f4;return db[_0x3ec5('0x42')][_0x3ec5('0x56')]({'where':{'id':_0x36bac7[_0x3ec5('0x47')]['id']}})[_0x3ec5('0x28')](handleEntityNotFound(_0x185b02,null))['then'](function(_0x5d1e04){if(_0x5d1e04){_0x33fbfc=_0x5d1e04;_0x1ff69b[_0x3ec5('0x35')]=_[_0x3ec5('0x49')](db[_0x3ec5('0x65')]['rawAttributes']);_0x1ff69b[_0x3ec5('0x32')]=_[_0x3ec5('0x49')](_0x36bac7['query']);_0x1ff69b[_0x3ec5('0x33')]=_[_0x3ec5('0x34')](_0x1ff69b[_0x3ec5('0x35')],_0x1ff69b['query']);_0x1ae3fb[_0x3ec5('0x36')]=_['intersection'](_0x1ff69b[_0x3ec5('0x35')],qs[_0x3ec5('0x37')](_0x36bac7[_0x3ec5('0x32')][_0x3ec5('0x37')]));_0x1ae3fb[_0x3ec5('0x36')]=_0x1ae3fb[_0x3ec5('0x36')][_0x3ec5('0x38')]?_0x1ae3fb['attributes']:_0x1ff69b['model'];_0x1ae3fb['order']=qs[_0x3ec5('0x3c')](_0x36bac7[_0x3ec5('0x32')][_0x3ec5('0x3c')]);_0x1ae3fb[_0x3ec5('0x3d')]=qs[_0x3ec5('0x33')](_[_0x3ec5('0x58')](_0x36bac7[_0x3ec5('0x32')],_0x1ff69b[_0x3ec5('0x33')]));if(_0x36bac7[_0x3ec5('0x32')]['filter']){_0x1ae3fb[_0x3ec5('0x3d')]=_['merge'](_0x1ae3fb['where'],{'$or':_['map'](_0x1ae3fb[_0x3ec5('0x36')],function(_0x5dccd1){var _0x53d03c={};_0x53d03c[_0x5dccd1]={'$like':'%'+_0x36bac7[_0x3ec5('0x32')][_0x3ec5('0x3e')]+'%'};return _0x53d03c;})});}_0x1ae3fb=_['merge']({},_0x1ae3fb,_0x36bac7[_0x3ec5('0x41')]);return _0x33fbfc[_0x3ec5('0x64')](_0x1ae3fb);}})[_0x3ec5('0x28')](function(_0xa28688){if(_0xa28688){_0x12d0f4=_0xa28688[_0x3ec5('0x38')];if(!_0x36bac7[_0x3ec5('0x32')][_0x3ec5('0x39')](_0x3ec5('0x3a'))){_0x1ae3fb[_0x3ec5('0x1e')]=qs[_0x3ec5('0x1e')](_0x36bac7[_0x3ec5('0x32')][_0x3ec5('0x1e')]);_0x1ae3fb[_0x3ec5('0x1b')]=qs[_0x3ec5('0x1b')](_0x36bac7['query'][_0x3ec5('0x1b')]);}return _0x33fbfc[_0x3ec5('0x64')](_0x1ae3fb);}})['then'](function(_0x11926e){if(_0x11926e){return _0x11926e?{'count':_0x12d0f4,'rows':_0x11926e}:null;}})[_0x3ec5('0x28')](respondWithResult(_0x185b02,null))[_0x3ec5('0x45')](handleError(_0x185b02,null));};exports[_0x3ec5('0x66')]=function(_0x5a6b65,_0x118626,_0x44a05e){var _0x45a75=_0x5a6b65[_0x3ec5('0x52')]['ids'];return db[_0x3ec5('0x65')]['findAll']({'where':{'id':_0x45a75},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3ec5('0x67'),'attributes':['id','name',_0x3ec5('0x68'),_0x3ec5('0x69'),'interface'],'raw':!![]}]})['then'](function(_0x2b0d19){if(_0x2b0d19){var _0x4939dd=_[_0x3ec5('0x6a')](_0x2b0d19,function(_0xa042f1){var _0x18a6bb=_0xa042f1[_0x3ec5('0x25')]({'plain':!![]});return _0x18a6bb[_0x3ec5('0x67')];});return db[_0x3ec5('0x42')][_0x3ec5('0x4b')]({'where':{'id':_0x5a6b65[_0x3ec5('0x47')]['id']}})['then'](function(_0x75c894){return db['sequelize'][_0x3ec5('0x6b')](function(_0xdac96a){return _0x75c894[_0x3ec5('0x66')](_0x45a75,{'transaction':_0xdac96a})[_0x3ec5('0x28')](function(){return BPromise[_0x3ec5('0x6c')](_0x4939dd,function(_0x133842){return db[_0x3ec5('0x57')]['findOrCreate']({'where':{'UserId':_0x133842['id'],'MailQueueId':_0x5a6b65[_0x3ec5('0x47')]['id']},'transaction':_0xdac96a});});})[_0x3ec5('0x28')](function(){_0x4939dd[_0x3ec5('0x6d')](function(_0x43f116){socket['emit'](_0x3ec5('0x6e'),{'UserId':_0x43f116['id'],'MailQueueId':_0x75c894['id']});});});});});}})[_0x3ec5('0x28')](respondWithStatusCode(_0x118626,null))[_0x3ec5('0x45')](handleError(_0x118626,null));};exports[_0x3ec5('0x6f')]=function(_0x260c53,_0xe62d7c,_0x1bf159){return db[_0x3ec5('0x65')][_0x3ec5('0x5a')]({'where':{'id':_0x260c53[_0x3ec5('0x32')][_0x3ec5('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3ec5('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xe62d7c,null))[_0x3ec5('0x28')](function(_0x5e587e){var _0x121201=_['map'](_0x5e587e,'id');var _0x5745b1=[];var _0x334dd7=[];var _0x45cd6b=squel['select']();_0x45cd6b[_0x3ec5('0x71')](_0x3ec5('0x72'))[_0x3ec5('0x73')](_0x3ec5('0x74'),'tq')[_0x3ec5('0x75')](_0x3ec5('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3ec5('0x3d')]('MailQueueId\x20=\x20?',_0x260c53[_0x3ec5('0x47')]['id']);for(var _0x3d14df=0x0;_0x3d14df<_0x5e587e[_0x3ec5('0x38')];_0x3d14df+=0x1){let _0x453f75=_0x5e587e[_0x3d14df];for(var _0x112729=0x0;_0x112729<_0x453f75['Agents'][_0x3ec5('0x38')];_0x112729+=0x1){let _0x20cfce=_0x453f75[_0x3ec5('0x67')][_0x112729];var _0xf5a401=_0x45cd6b[_0x3ec5('0x77')]();_0xf5a401[_0x3ec5('0x3d')](_0x3ec5('0x78'),_0x20cfce['id']);_0x334dd7[_0x3ec5('0x79')](db['sequelize'][_0x3ec5('0x32')](_0xf5a401['toString'](),{'type':db[_0x3ec5('0x7a')]['QueryTypes']['SELECT']})[_0x3ec5('0x28')](function(_0x47c0cd){if(_0x47c0cd[_0x3ec5('0x38')]===0x1){return _0x20cfce['id'];}else{var _0x14366e=_[_0x3ec5('0x7b')](_[_0x3ec5('0x2e')](_0x47c0cd,_0x3ec5('0x7c')),function(_0x19b79f){return _['includes'](_0x121201,_0x19b79f);});if(_0x14366e){return _0x20cfce['id'];}}}));}}return BPromise[_0x3ec5('0x7d')](_0x334dd7)[_0x3ec5('0x28')](function(_0x53bcd9){_0x5745b1=_(_0x5745b1)['union'](_0x53bcd9)[_0x3ec5('0x7e')]()['value']();return db[_0x3ec5('0x42')][_0x3ec5('0x4b')]({'where':{'id':_0x260c53[_0x3ec5('0x47')]['id']}})[_0x3ec5('0x28')](function(_0x17c38a){return db[_0x3ec5('0x7a')][_0x3ec5('0x6b')](function(_0x361594){return _0x17c38a['removeTeams'](_0x260c53[_0x3ec5('0x32')][_0x3ec5('0x70')],{'transaction':_0x361594})[_0x3ec5('0x28')](function(){if(!_[_0x3ec5('0x7f')](_0x5745b1)){return _0x17c38a[_0x3ec5('0x80')](_0x5745b1,{'transaction':_0x361594});}})[_0x3ec5('0x28')](function(){_0x5745b1['forEach'](function(_0x599799){socket[_0x3ec5('0x81')](_0x3ec5('0x82'),{'UserId':_0x599799,'MailQueueId':_0x17c38a['id']});});});});});});})[_0x3ec5('0x28')](respondWithStatusCode(_0xe62d7c,null))[_0x3ec5('0x45')](handleError(_0xe62d7c,null));};exports['addAgents']=function(_0x2f72f0,_0x19938e,_0x24a6fa){return db[_0x3ec5('0x42')][_0x3ec5('0x4b')]({'where':{'id':_0x2f72f0[_0x3ec5('0x47')]['id']}})[_0x3ec5('0x28')](handleEntityNotFound(_0x19938e,null))[_0x3ec5('0x28')](function(_0x2b9bef){if(_0x2b9bef){return _0x2b9bef['addAgents'](_0x2f72f0['body'][_0x3ec5('0x70')],_[_0x3ec5('0x83')](_0x2f72f0[_0x3ec5('0x52')],[_0x3ec5('0x70'),'id'])||{})['spread'](function(_0x40e088){for(var _0x5d5725=0x0;_0x5d5725<_0x2f72f0[_0x3ec5('0x52')]['ids'][_0x3ec5('0x38')];_0x5d5725+=0x1){socket[_0x3ec5('0x81')](_0x3ec5('0x6e'),{'UserId':Number(_0x2f72f0['body']['ids'][_0x5d5725]),'MailQueueId':Number(_0x2f72f0[_0x3ec5('0x47')]['id'])});}return _0x40e088;});}})[_0x3ec5('0x28')](respondWithResult(_0x19938e,null))[_0x3ec5('0x45')](handleError(_0x19938e,null));};exports['removeAgents']=function(_0x152236,_0xd1ec7,_0x37cdf0){return db['MailQueue']['find']({'where':{'id':_0x152236[_0x3ec5('0x47')]['id']}})[_0x3ec5('0x28')](handleEntityNotFound(_0xd1ec7,null))[_0x3ec5('0x28')](function(_0x4840ed){if(_0x4840ed){return _0x4840ed['removeAgents'](_0x152236['query'][_0x3ec5('0x70')])[_0x3ec5('0x28')](function(){if(_[_0x3ec5('0x84')](_0x152236[_0x3ec5('0x32')][_0x3ec5('0x70')])){for(var _0x2016ef=0x0;_0x2016ef<_0x152236['query'][_0x3ec5('0x70')][_0x3ec5('0x38')];_0x2016ef+=0x1){socket[_0x3ec5('0x81')](_0x3ec5('0x82'),{'UserId':Number(_0x152236['query'][_0x3ec5('0x70')][_0x2016ef]),'MailQueueId':Number(_0x152236[_0x3ec5('0x47')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x152236[_0x3ec5('0x32')]['ids']),'MailQueueId':Number(_0x152236[_0x3ec5('0x47')]['id'])});}});}})[_0x3ec5('0x28')](respondWithStatusCode(_0xd1ec7,null))[_0x3ec5('0x45')](handleError(_0xd1ec7,null));};exports[_0x3ec5('0x85')]=function(_0x245872,_0x4c9351,_0x238bf5){var _0x520206={};var _0x4ac897={};var _0x21a5b2;var _0x24dd0b;return db[_0x3ec5('0x42')][_0x3ec5('0x56')]({'where':{'id':_0x245872[_0x3ec5('0x47')]['id']}})['then'](handleEntityNotFound(_0x4c9351,null))[_0x3ec5('0x28')](function(_0x1296d0){if(_0x1296d0){_0x21a5b2=_0x1296d0;_0x4ac897[_0x3ec5('0x35')]=_[_0x3ec5('0x49')](db[_0x3ec5('0x5b')][_0x3ec5('0x48')]);_0x4ac897[_0x3ec5('0x32')]=_[_0x3ec5('0x49')](_0x245872[_0x3ec5('0x32')]);_0x4ac897['filters']=_[_0x3ec5('0x34')](_0x4ac897[_0x3ec5('0x35')],_0x4ac897['query']);_0x520206['attributes']=_[_0x3ec5('0x34')](_0x4ac897[_0x3ec5('0x35')],qs[_0x3ec5('0x37')](_0x245872[_0x3ec5('0x32')]['fields']));_0x520206[_0x3ec5('0x36')]=_0x520206[_0x3ec5('0x36')][_0x3ec5('0x38')]?_0x520206[_0x3ec5('0x36')]:_0x4ac897[_0x3ec5('0x35')];_0x520206['order']=qs['sort'](_0x245872[_0x3ec5('0x32')][_0x3ec5('0x3c')]);_0x520206[_0x3ec5('0x3d')]=qs['filters'](_[_0x3ec5('0x58')](_0x245872[_0x3ec5('0x32')],_0x4ac897['filters']));if(_0x245872['query'][_0x3ec5('0x3e')]){_0x520206[_0x3ec5('0x3d')]=_['merge'](_0x520206[_0x3ec5('0x3d')],{'$or':_['map'](_0x520206[_0x3ec5('0x36')],function(_0x25b192){var _0x44b54c={};_0x44b54c[_0x25b192]={'$like':'%'+_0x245872[_0x3ec5('0x32')][_0x3ec5('0x3e')]+'%'};return _0x44b54c;})});}_0x520206=_['merge']({},_0x520206,_0x245872[_0x3ec5('0x41')]);return _0x21a5b2['getAgents'](_0x520206);}})['then'](function(_0x192bcd){if(_0x192bcd){_0x24dd0b=_0x192bcd[_0x3ec5('0x38')];if(!_0x245872[_0x3ec5('0x32')][_0x3ec5('0x39')](_0x3ec5('0x3a'))){_0x520206[_0x3ec5('0x1e')]=qs['limit'](_0x245872[_0x3ec5('0x32')][_0x3ec5('0x1e')]);_0x520206['offset']=qs[_0x3ec5('0x1b')](_0x245872[_0x3ec5('0x32')][_0x3ec5('0x1b')]);}return _0x21a5b2[_0x3ec5('0x85')](_0x520206);}})[_0x3ec5('0x28')](function(_0x55de32){if(_0x55de32){return _0x55de32?{'count':_0x24dd0b,'rows':_0x55de32}:null;}})['then'](respondWithResult(_0x4c9351,null))['catch'](handleError(_0x4c9351,null));}; \ No newline at end of file +var _0xb821=['ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','ids','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','get','MailQueues','UserProfileResource','end','sendStatus','error','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','order','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb821,0xa7));var _0x1b82=function(_0x43356f,_0x464ed6){_0x43356f=_0x43356f-0x0;var _0xc7dbea=_0xb821[_0x43356f];return _0xc7dbea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];config[_0x1b82('0x18')]=_[_0x1b82('0x19')](config[_0x1b82('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b82('0x1a'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x1b82('0x1b')](socket);function respondWithStatusCode(_0x4bf75b,_0x1cffd1){_0x1cffd1=_0x1cffd1||0xcc;return function(_0xe1d608){if(_0xe1d608){return _0x4bf75b['sendStatus'](_0x1cffd1);}return _0x4bf75b[_0x1b82('0x1c')](_0x1cffd1)['end']();};}function respondWithResult(_0x563261,_0x1b115b){_0x1b115b=_0x1b115b||0xc8;return function(_0x5eb8ed){if(_0x5eb8ed){return _0x563261[_0x1b82('0x1c')](_0x1b115b)[_0x1b82('0x1d')](_0x5eb8ed);}};}function respondWithFilteredResult(_0xf42818,_0x4a09a2){return function(_0x514082){if(_0x514082){var _0x415dff=typeof _0x4a09a2['offset']===_0x1b82('0x1e')&&typeof _0x4a09a2[_0x1b82('0x1f')]===_0x1b82('0x1e');var _0x594a63=_0x514082[_0x1b82('0x20')];var _0x2b6ee8=_0x415dff?0x0:_0x4a09a2[_0x1b82('0x21')];var _0x46e5e2=_0x415dff?_0x514082[_0x1b82('0x20')]:_0x4a09a2['offset']+_0x4a09a2[_0x1b82('0x1f')];var _0x1892b0;if(_0x46e5e2>=_0x594a63){_0x46e5e2=_0x594a63;_0x1892b0=0xc8;}else{_0x1892b0=0xce;}_0xf42818[_0x1b82('0x1c')](_0x1892b0);return _0xf42818[_0x1b82('0x22')](_0x1b82('0x23'),_0x2b6ee8+'-'+_0x46e5e2+'/'+_0x594a63)[_0x1b82('0x1d')](_0x514082);}return null;};}function patchUpdates(_0x2d07f4){return function(_0x486e92){try{jsonpatch[_0x1b82('0x24')](_0x486e92,_0x2d07f4,!![]);}catch(_0x233740){return BPromise['reject'](_0x233740);}return _0x486e92[_0x1b82('0x25')]();};}function saveUpdates(_0x225b81,_0x1ad9d6){return function(_0x4bbbbf){if(_0x4bbbbf){return _0x4bbbbf[_0x1b82('0x26')](_0x225b81)['then'](function(_0x5cd458){return _0x5cd458;});}return null;};}function removeEntity(_0x5f556b,_0xf2e556){return function(_0x149d0f){if(_0x149d0f){return _0x149d0f[_0x1b82('0x27')]()[_0x1b82('0x28')](function(){var _0x548a3b=_0x149d0f[_0x1b82('0x29')]({'plain':!![]});var _0x165b45=_0x1b82('0x2a');return db[_0x1b82('0x2b')][_0x1b82('0x27')]({'where':{'type':_0x165b45,'resourceId':_0x548a3b['id']}})[_0x1b82('0x28')](function(){return _0x149d0f;});})[_0x1b82('0x28')](function(){_0x5f556b[_0x1b82('0x1c')](0xcc)[_0x1b82('0x2c')]();});}};}function handleEntityNotFound(_0x1f9c6b,_0x2fe45d){return function(_0x37275f){if(!_0x37275f){_0x1f9c6b[_0x1b82('0x2d')](0x194);}return _0x37275f;};}function handleError(_0x5ea890,_0x17b3aa){_0x17b3aa=_0x17b3aa||0x1f4;return function(_0x2931d0){logger[_0x1b82('0x2e')](_0x2931d0[_0x1b82('0x2f')]);if(_0x2931d0[_0x1b82('0x30')]){delete _0x2931d0[_0x1b82('0x30')];}_0x5ea890[_0x1b82('0x1c')](_0x17b3aa)[_0x1b82('0x31')](_0x2931d0);};}exports[_0x1b82('0x32')]=function(_0x362657,_0x501ab0){var _0x225c06={},_0x29a31e={},_0xe2301={'count':0x0,'rows':[]};var _0xc98ee2=_['map'](db[_0x1b82('0x33')][_0x1b82('0x34')],function(_0x544bd5){return{'name':_0x544bd5[_0x1b82('0x35')],'type':_0x544bd5[_0x1b82('0x36')][_0x1b82('0x37')]};});_0x29a31e['model']=_['map'](_0xc98ee2,_0x1b82('0x30'));_0x29a31e['query']=_['keys'](_0x362657[_0x1b82('0x38')]);_0x29a31e[_0x1b82('0x39')]=_[_0x1b82('0x3a')](_0x29a31e['model'],_0x29a31e[_0x1b82('0x38')]);_0x225c06[_0x1b82('0x3b')]=_[_0x1b82('0x3a')](_0x29a31e[_0x1b82('0x3c')],qs['fields'](_0x362657[_0x1b82('0x38')][_0x1b82('0x3d')]));_0x225c06[_0x1b82('0x3b')]=_0x225c06['attributes']['length']?_0x225c06[_0x1b82('0x3b')]:_0x29a31e['model'];if(!_0x362657[_0x1b82('0x38')][_0x1b82('0x3e')](_0x1b82('0x3f'))){_0x225c06[_0x1b82('0x1f')]=qs[_0x1b82('0x1f')](_0x362657[_0x1b82('0x38')][_0x1b82('0x1f')]);_0x225c06[_0x1b82('0x21')]=qs['offset'](_0x362657['query'][_0x1b82('0x21')]);}_0x225c06['order']=qs[_0x1b82('0x40')](_0x362657['query'][_0x1b82('0x40')]);_0x225c06[_0x1b82('0x41')]=qs[_0x1b82('0x39')](_[_0x1b82('0x42')](_0x362657[_0x1b82('0x38')],_0x29a31e[_0x1b82('0x39')]),_0xc98ee2);if(_0x362657['query'][_0x1b82('0x43')]){_0x225c06['where']=_[_0x1b82('0x44')](_0x225c06['where'],{'$or':_[_0x1b82('0x45')](_0xc98ee2,function(_0x4edc17){if(_0x4edc17['type']!==_0x1b82('0x46')){var _0x388d14={};_0x388d14[_0x4edc17[_0x1b82('0x30')]]={'$like':'%'+_0x362657[_0x1b82('0x38')][_0x1b82('0x43')]+'%'};return _0x388d14;}})});}_0x225c06=_['merge']({},_0x225c06,_0x362657[_0x1b82('0x47')]);var _0x4ffa9e={'where':_0x225c06[_0x1b82('0x41')]};return db[_0x1b82('0x33')][_0x1b82('0x20')](_0x4ffa9e)[_0x1b82('0x28')](function(_0x365ab4){_0xe2301['count']=_0x365ab4;if(_0x362657[_0x1b82('0x38')]['includeAll']){_0x225c06[_0x1b82('0x48')]=[{'all':!![]}];}return db[_0x1b82('0x33')]['findAll'](_0x225c06);})[_0x1b82('0x28')](function(_0x225f6b){_0xe2301[_0x1b82('0x49')]=_0x225f6b;return _0xe2301;})[_0x1b82('0x28')](respondWithFilteredResult(_0x501ab0,_0x225c06))[_0x1b82('0x4a')](handleError(_0x501ab0,null));};exports[_0x1b82('0x4b')]=function(_0x34adfa,_0x498b0f){var _0xb4ea29={'raw':!![],'where':{'id':_0x34adfa[_0x1b82('0x4c')]['id']}},_0x5868b9={};_0x5868b9[_0x1b82('0x3c')]=_[_0x1b82('0x4d')](db[_0x1b82('0x33')][_0x1b82('0x34')]);_0x5868b9[_0x1b82('0x38')]=_[_0x1b82('0x4d')](_0x34adfa[_0x1b82('0x38')]);_0x5868b9[_0x1b82('0x39')]=_[_0x1b82('0x3a')](_0x5868b9[_0x1b82('0x3c')],_0x5868b9[_0x1b82('0x38')]);_0xb4ea29[_0x1b82('0x3b')]=_[_0x1b82('0x3a')](_0x5868b9['model'],qs['fields'](_0x34adfa[_0x1b82('0x38')]['fields']));_0xb4ea29[_0x1b82('0x3b')]=_0xb4ea29[_0x1b82('0x3b')][_0x1b82('0x4e')]?_0xb4ea29['attributes']:_0x5868b9[_0x1b82('0x3c')];if(_0x34adfa['query']['includeAll']){_0xb4ea29[_0x1b82('0x48')]=[{'all':!![]}];}_0xb4ea29=_[_0x1b82('0x44')]({},_0xb4ea29,_0x34adfa[_0x1b82('0x47')]);return db['MailQueue'][_0x1b82('0x4f')](_0xb4ea29)[_0x1b82('0x28')](handleEntityNotFound(_0x498b0f,null))['then'](respondWithResult(_0x498b0f,null))['catch'](handleError(_0x498b0f,null));};exports[_0x1b82('0x50')]=function(_0x2e676a,_0x2dc53e){return db['MailQueue'][_0x1b82('0x50')](_0x2e676a[_0x1b82('0x51')],{})[_0x1b82('0x28')](function(_0x29f9ae){var _0xbba448=_0x2e676a[_0x1b82('0x52')]['get']({'plain':!![]});if(!_0xbba448)throw new Error(_0x1b82('0x53'));if(_0xbba448['role']===_0x1b82('0x52')){var _0x247cb7=_0x29f9ae['get']({'plain':!![]});var _0x44ce1c='MailQueues';return db[_0x1b82('0x54')][_0x1b82('0x4f')]({'where':{'name':_0x44ce1c,'userProfileId':_0xbba448[_0x1b82('0x55')]},'raw':!![]})[_0x1b82('0x28')](function(_0xd46842){if(_0xd46842&&_0xd46842[_0x1b82('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x247cb7[_0x1b82('0x30')],'resourceId':_0x247cb7['id'],'type':_0xd46842[_0x1b82('0x30')],'sectionId':_0xd46842['id']},{})[_0x1b82('0x28')](function(){return _0x29f9ae;});}else{return _0x29f9ae;}})[_0x1b82('0x4a')](function(_0x3db460){logger[_0x1b82('0x2e')](_0x1b82('0x57'),_0x3db460);throw _0x3db460;});}return _0x29f9ae;})[_0x1b82('0x28')](respondWithResult(_0x2dc53e,0xc9))['catch'](handleError(_0x2dc53e,null));};exports['update']=function(_0x4b8b3e,_0x2658b5){if(_0x4b8b3e[_0x1b82('0x51')]['id']){delete _0x4b8b3e[_0x1b82('0x51')]['id'];}return db[_0x1b82('0x33')][_0x1b82('0x4f')]({'where':{'id':_0x4b8b3e[_0x1b82('0x4c')]['id']}})[_0x1b82('0x28')](handleEntityNotFound(_0x2658b5,null))['then'](saveUpdates(_0x4b8b3e[_0x1b82('0x51')],null))[_0x1b82('0x28')](respondWithResult(_0x2658b5,null))[_0x1b82('0x4a')](handleError(_0x2658b5,null));};exports[_0x1b82('0x27')]=function(_0xc318ae,_0x443ea0){return db[_0x1b82('0x33')][_0x1b82('0x4f')]({'where':{'id':_0xc318ae['params']['id']}})[_0x1b82('0x28')](handleEntityNotFound(_0x443ea0,null))[_0x1b82('0x28')](removeEntity(_0x443ea0,null))[_0x1b82('0x4a')](handleError(_0x443ea0,null));};exports[_0x1b82('0x58')]=function(_0x2bce47,_0x4b5dbc){return db['MailQueue'][_0x1b82('0x58')]()[_0x1b82('0x28')](respondWithResult(_0x4b5dbc,null))[_0x1b82('0x4a')](handleError(_0x4b5dbc,null));};exports[_0x1b82('0x59')]=function(_0x5663df,_0x170905,_0x352603){var _0x1ee2c8={'raw':!![],'where':{}},_0x26ad1c={},_0x152f84;return db[_0x1b82('0x33')][_0x1b82('0x5a')]({'where':{'id':_0x5663df[_0x1b82('0x4c')]['id']}})[_0x1b82('0x28')](handleEntityNotFound(_0x170905,null))[_0x1b82('0x28')](function(_0x483a82){if(_0x483a82){_0x152f84=_0x483a82[_0x1b82('0x29')]({'plain':!![]});_0x26ad1c[_0x1b82('0x3c')]=_['keys'](db[_0x1b82('0x5b')][_0x1b82('0x34')]);_0x26ad1c[_0x1b82('0x38')]=_[_0x1b82('0x4d')](_0x5663df['query']);_0x26ad1c[_0x1b82('0x39')]=_[_0x1b82('0x3a')](_0x26ad1c[_0x1b82('0x3c')],_0x26ad1c[_0x1b82('0x38')]);_0x1ee2c8[_0x1b82('0x3b')]=_[_0x1b82('0x3a')](_0x26ad1c['model'],qs[_0x1b82('0x3d')](_0x5663df['query'][_0x1b82('0x3d')]));_0x1ee2c8['attributes']=_0x1ee2c8[_0x1b82('0x3b')][_0x1b82('0x4e')]?_0x1ee2c8[_0x1b82('0x3b')]:_0x26ad1c[_0x1b82('0x3c')];if(!_0x5663df[_0x1b82('0x38')][_0x1b82('0x3e')](_0x1b82('0x3f'))){_0x1ee2c8['limit']=qs[_0x1b82('0x1f')](_0x5663df[_0x1b82('0x38')][_0x1b82('0x1f')]);_0x1ee2c8[_0x1b82('0x21')]=qs[_0x1b82('0x21')](_0x5663df[_0x1b82('0x38')][_0x1b82('0x21')]);}_0x1ee2c8[_0x1b82('0x5c')]=qs[_0x1b82('0x40')](_0x5663df[_0x1b82('0x38')][_0x1b82('0x40')]);_0x1ee2c8[_0x1b82('0x41')]=qs[_0x1b82('0x39')](_['pick'](_0x5663df[_0x1b82('0x38')],_0x26ad1c[_0x1b82('0x39')]));_0x1ee2c8[_0x1b82('0x41')]['MailQueueId']=_0x483a82['id'];if(_0x5663df[_0x1b82('0x38')][_0x1b82('0x43')]){_0x1ee2c8['where']=_[_0x1b82('0x44')](_0x1ee2c8[_0x1b82('0x41')],{'$or':_[_0x1b82('0x45')](_0x1ee2c8['attributes'],function(_0x4fcefe){var _0x414f1f={};_0x414f1f[_0x4fcefe]={'$like':'%'+_0x5663df[_0x1b82('0x38')][_0x1b82('0x43')]+'%'};return _0x414f1f;})});}_0x1ee2c8=_[_0x1b82('0x44')]({},_0x1ee2c8,_0x5663df[_0x1b82('0x47')]);return db['UserMailQueue'][_0x1b82('0x5d')](_0x1ee2c8);}})['then'](function(_0x143689){if(_0x143689){return db[_0x1b82('0x5e')][_0x1b82('0x5f')]({'where':{'id':_[_0x1b82('0x45')](_0x143689,_0x1b82('0x60')),'role':_0x1b82('0x61')},'attributes':['id',_0x1b82('0x30'),_0x1b82('0x62'),_0x1b82('0x63'),_0x1b82('0x64')]});}})[_0x1b82('0x28')](function(_0x5e23ca){if(_0x5e23ca){return{'count':_0x5e23ca[_0x1b82('0x20')],'rows':_['map'](_0x5e23ca['rows'],function(_0x16834e){return{'membername':_0x16834e[_0x1b82('0x30')],'UserId':_0x16834e['id'],'queue_name':_0x152f84[_0x1b82('0x30')],'MailQueueId':_0x152f84['id'],'interface':util[_0x1b82('0x65')](_0x1b82('0x66'),_0x1b82('0x67'),_0x16834e[_0x1b82('0x30')]),'penalty':0x0,'paused':_0x16834e[_0x1b82('0x62')],'createdAt':_0x16834e[_0x1b82('0x64')],'updatedAt':_0x16834e[_0x1b82('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x170905,_0x1ee2c8))[_0x1b82('0x4a')](handleError(_0x170905,null));};exports['getTeams']=function(_0x2d2860,_0x4d2528,_0x3bd27c){var _0x3253e9={};var _0xe9a367={};var _0x24b328;var _0x1d3b4b;return db['MailQueue'][_0x1b82('0x5a')]({'where':{'id':_0x2d2860['params']['id']}})['then'](handleEntityNotFound(_0x4d2528,null))[_0x1b82('0x28')](function(_0x4437af){if(_0x4437af){_0x24b328=_0x4437af;_0xe9a367[_0x1b82('0x3c')]=_['keys'](db[_0x1b82('0x68')]['rawAttributes']);_0xe9a367[_0x1b82('0x38')]=_['keys'](_0x2d2860[_0x1b82('0x38')]);_0xe9a367[_0x1b82('0x39')]=_[_0x1b82('0x3a')](_0xe9a367[_0x1b82('0x3c')],_0xe9a367['query']);_0x3253e9[_0x1b82('0x3b')]=_['intersection'](_0xe9a367[_0x1b82('0x3c')],qs[_0x1b82('0x3d')](_0x2d2860[_0x1b82('0x38')][_0x1b82('0x3d')]));_0x3253e9[_0x1b82('0x3b')]=_0x3253e9['attributes'][_0x1b82('0x4e')]?_0x3253e9['attributes']:_0xe9a367[_0x1b82('0x3c')];_0x3253e9['order']=qs[_0x1b82('0x40')](_0x2d2860[_0x1b82('0x38')][_0x1b82('0x40')]);_0x3253e9['where']=qs[_0x1b82('0x39')](_[_0x1b82('0x42')](_0x2d2860[_0x1b82('0x38')],_0xe9a367['filters']));if(_0x2d2860[_0x1b82('0x38')][_0x1b82('0x43')]){_0x3253e9[_0x1b82('0x41')]=_[_0x1b82('0x44')](_0x3253e9[_0x1b82('0x41')],{'$or':_['map'](_0x3253e9[_0x1b82('0x3b')],function(_0x4939ee){var _0x5d94fa={};_0x5d94fa[_0x4939ee]={'$like':'%'+_0x2d2860[_0x1b82('0x38')]['filter']+'%'};return _0x5d94fa;})});}_0x3253e9=_[_0x1b82('0x44')]({},_0x3253e9,_0x2d2860[_0x1b82('0x47')]);return _0x24b328['getTeams'](_0x3253e9);}})[_0x1b82('0x28')](function(_0x391207){if(_0x391207){_0x1d3b4b=_0x391207['length'];if(!_0x2d2860['query']['hasOwnProperty']('nolimit')){_0x3253e9[_0x1b82('0x1f')]=qs[_0x1b82('0x1f')](_0x2d2860[_0x1b82('0x38')]['limit']);_0x3253e9[_0x1b82('0x21')]=qs['offset'](_0x2d2860[_0x1b82('0x38')][_0x1b82('0x21')]);}return _0x24b328[_0x1b82('0x69')](_0x3253e9);}})[_0x1b82('0x28')](function(_0x5cc705){if(_0x5cc705){return _0x5cc705?{'count':_0x1d3b4b,'rows':_0x5cc705}:null;}})[_0x1b82('0x28')](respondWithResult(_0x4d2528,null))[_0x1b82('0x4a')](handleError(_0x4d2528,null));};exports[_0x1b82('0x6a')]=function(_0x76d76f,_0x346b6d,_0x3a4e7d){var _0x2dbcdb=_0x76d76f['body']['ids'];return db[_0x1b82('0x68')]['findAll']({'where':{'id':_0x2dbcdb},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1b82('0x6b'),'attributes':['id',_0x1b82('0x30'),_0x1b82('0x6c'),'voicePause',_0x1b82('0x6d')],'raw':!![]}]})['then'](function(_0x385c2d){if(_0x385c2d){var _0x2361f8=_[_0x1b82('0x6e')](_0x385c2d,function(_0x1cd3fd){var _0x525e4e=_0x1cd3fd[_0x1b82('0x29')]({'plain':!![]});return _0x525e4e['Agents'];});return db[_0x1b82('0x33')][_0x1b82('0x4f')]({'where':{'id':_0x76d76f[_0x1b82('0x4c')]['id']}})['then'](function(_0x5b1d77){return db[_0x1b82('0x6f')][_0x1b82('0x70')](function(_0x40c319){return _0x5b1d77['addTeams'](_0x2dbcdb,{'transaction':_0x40c319})['then'](function(){return BPromise[_0x1b82('0x71')](_0x2361f8,function(_0x24cb75){return db[_0x1b82('0x5b')][_0x1b82('0x72')]({'where':{'UserId':_0x24cb75['id'],'MailQueueId':_0x76d76f['params']['id']},'transaction':_0x40c319});});})[_0x1b82('0x28')](function(){_0x2361f8[_0x1b82('0x73')](function(_0x4a1b01){socket['emit'](_0x1b82('0x74'),{'UserId':_0x4a1b01['id'],'MailQueueId':_0x5b1d77['id']});});});});});}})[_0x1b82('0x28')](respondWithStatusCode(_0x346b6d,null))[_0x1b82('0x4a')](handleError(_0x346b6d,null));};exports[_0x1b82('0x75')]=function(_0x109104,_0x84a04d,_0x52fe7b){return db[_0x1b82('0x68')]['findAll']({'where':{'id':_0x109104[_0x1b82('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1b82('0x5e')],'as':_0x1b82('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x1b82('0x28')](handleEntityNotFound(_0x84a04d,null))[_0x1b82('0x28')](function(_0x1baa93){var _0x4cd010=_[_0x1b82('0x45')](_0x1baa93,'id');var _0x5a3320=[];var _0x452645=[];var _0x523639=squel[_0x1b82('0x76')]();_0x523639[_0x1b82('0x77')](_0x1b82('0x78'))['from'](_0x1b82('0x79'),'tq')[_0x1b82('0x7a')](_0x1b82('0x7b'),'ut',_0x1b82('0x7c'))['where'](_0x1b82('0x7d'),_0x109104[_0x1b82('0x4c')]['id']);for(var _0x276405=0x0;_0x276405<_0x1baa93[_0x1b82('0x4e')];_0x276405+=0x1){let _0x446e42=_0x1baa93[_0x276405];for(var _0x3facb5=0x0;_0x3facb5<_0x446e42[_0x1b82('0x6b')][_0x1b82('0x4e')];_0x3facb5+=0x1){let _0x5da90b=_0x446e42[_0x1b82('0x6b')][_0x3facb5];var _0xd4a253=_0x523639[_0x1b82('0x7e')]();_0xd4a253[_0x1b82('0x41')](_0x1b82('0x7f'),_0x5da90b['id']);_0x452645[_0x1b82('0x80')](db[_0x1b82('0x6f')][_0x1b82('0x38')](_0xd4a253[_0x1b82('0x81')](),{'type':db['sequelize'][_0x1b82('0x82')][_0x1b82('0x83')]})[_0x1b82('0x28')](function(_0x4e08a2){if(_0x4e08a2[_0x1b82('0x4e')]===0x1){return _0x5da90b['id'];}else{var _0x1e76d0=_[_0x1b82('0x84')](_['map'](_0x4e08a2,_0x1b82('0x85')),function(_0x4dec93){return _[_0x1b82('0x86')](_0x4cd010,_0x4dec93);});if(_0x1e76d0){return _0x5da90b['id'];}}}));}}return BPromise['all'](_0x452645)[_0x1b82('0x28')](function(_0x1345be){_0x5a3320=_(_0x5a3320)['union'](_0x1345be)[_0x1b82('0x87')]()[_0x1b82('0x88')]();return db[_0x1b82('0x33')]['find']({'where':{'id':_0x109104[_0x1b82('0x4c')]['id']}})[_0x1b82('0x28')](function(_0x5b08d0){return db[_0x1b82('0x6f')][_0x1b82('0x70')](function(_0x12a932){return _0x5b08d0[_0x1b82('0x75')](_0x109104['query'][_0x1b82('0x89')],{'transaction':_0x12a932})[_0x1b82('0x28')](function(){if(!_[_0x1b82('0x8a')](_0x5a3320)){return _0x5b08d0[_0x1b82('0x8b')](_0x5a3320,{'transaction':_0x12a932});}})[_0x1b82('0x28')](function(){_0x5a3320['forEach'](function(_0x3511a7){socket[_0x1b82('0x8c')](_0x1b82('0x8d'),{'UserId':_0x3511a7,'MailQueueId':_0x5b08d0['id']});});});});});});})[_0x1b82('0x28')](respondWithStatusCode(_0x84a04d,null))[_0x1b82('0x4a')](handleError(_0x84a04d,null));};exports[_0x1b82('0x8e')]=function(_0x277f02,_0xd9e116,_0x5ef041){return db[_0x1b82('0x33')]['find']({'where':{'id':_0x277f02[_0x1b82('0x4c')]['id']}})['then'](handleEntityNotFound(_0xd9e116,null))[_0x1b82('0x28')](function(_0x2b50c0){if(_0x2b50c0){return _0x2b50c0['addAgents'](_0x277f02['body'][_0x1b82('0x89')],_[_0x1b82('0x8f')](_0x277f02['body'],['ids','id'])||{})[_0x1b82('0x90')](function(_0x5275c9){for(var _0x588deb=0x0;_0x588deb<_0x277f02[_0x1b82('0x51')][_0x1b82('0x89')][_0x1b82('0x4e')];_0x588deb+=0x1){socket[_0x1b82('0x8c')](_0x1b82('0x74'),{'UserId':Number(_0x277f02[_0x1b82('0x51')][_0x1b82('0x89')][_0x588deb]),'MailQueueId':Number(_0x277f02[_0x1b82('0x4c')]['id'])});}return _0x5275c9;});}})[_0x1b82('0x28')](respondWithResult(_0xd9e116,null))['catch'](handleError(_0xd9e116,null));};exports[_0x1b82('0x8b')]=function(_0x3f98ed,_0x14fea4,_0x34c8f7){return db[_0x1b82('0x33')][_0x1b82('0x4f')]({'where':{'id':_0x3f98ed['params']['id']}})[_0x1b82('0x28')](handleEntityNotFound(_0x14fea4,null))[_0x1b82('0x28')](function(_0x550d68){if(_0x550d68){return _0x550d68[_0x1b82('0x8b')](_0x3f98ed['query'][_0x1b82('0x89')])[_0x1b82('0x28')](function(){if(_[_0x1b82('0x91')](_0x3f98ed[_0x1b82('0x38')][_0x1b82('0x89')])){for(var _0x3ae292=0x0;_0x3ae292<_0x3f98ed[_0x1b82('0x38')][_0x1b82('0x89')]['length'];_0x3ae292+=0x1){socket[_0x1b82('0x8c')](_0x1b82('0x8d'),{'UserId':Number(_0x3f98ed[_0x1b82('0x38')][_0x1b82('0x89')][_0x3ae292]),'MailQueueId':Number(_0x3f98ed[_0x1b82('0x4c')]['id'])});}}else{socket[_0x1b82('0x8c')](_0x1b82('0x8d'),{'UserId':Number(_0x3f98ed['query'][_0x1b82('0x89')]),'MailQueueId':Number(_0x3f98ed[_0x1b82('0x4c')]['id'])});}});}})[_0x1b82('0x28')](respondWithStatusCode(_0x14fea4,null))[_0x1b82('0x4a')](handleError(_0x14fea4,null));};exports[_0x1b82('0x92')]=function(_0x56ce3c,_0x5aad3c,_0x5dedcc){var _0x22af45={};var _0x275433={};var _0x10f714;var _0x4175d1;return db[_0x1b82('0x33')][_0x1b82('0x5a')]({'where':{'id':_0x56ce3c[_0x1b82('0x4c')]['id']}})[_0x1b82('0x28')](handleEntityNotFound(_0x5aad3c,null))[_0x1b82('0x28')](function(_0xc90263){if(_0xc90263){_0x10f714=_0xc90263;_0x275433[_0x1b82('0x3c')]=_['keys'](db[_0x1b82('0x5e')][_0x1b82('0x34')]);_0x275433['query']=_[_0x1b82('0x4d')](_0x56ce3c['query']);_0x275433[_0x1b82('0x39')]=_[_0x1b82('0x3a')](_0x275433[_0x1b82('0x3c')],_0x275433['query']);_0x22af45[_0x1b82('0x3b')]=_[_0x1b82('0x3a')](_0x275433[_0x1b82('0x3c')],qs[_0x1b82('0x3d')](_0x56ce3c[_0x1b82('0x38')][_0x1b82('0x3d')]));_0x22af45['attributes']=_0x22af45[_0x1b82('0x3b')][_0x1b82('0x4e')]?_0x22af45['attributes']:_0x275433[_0x1b82('0x3c')];_0x22af45[_0x1b82('0x5c')]=qs['sort'](_0x56ce3c[_0x1b82('0x38')][_0x1b82('0x40')]);_0x22af45['where']=qs[_0x1b82('0x39')](_[_0x1b82('0x42')](_0x56ce3c[_0x1b82('0x38')],_0x275433[_0x1b82('0x39')]));if(_0x56ce3c[_0x1b82('0x38')]['filter']){_0x22af45[_0x1b82('0x41')]=_['merge'](_0x22af45[_0x1b82('0x41')],{'$or':_[_0x1b82('0x45')](_0x22af45[_0x1b82('0x3b')],function(_0x5eef11){var _0x169ddd={};_0x169ddd[_0x5eef11]={'$like':'%'+_0x56ce3c[_0x1b82('0x38')][_0x1b82('0x43')]+'%'};return _0x169ddd;})});}_0x22af45=_[_0x1b82('0x44')]({},_0x22af45,_0x56ce3c[_0x1b82('0x47')]);return _0x10f714[_0x1b82('0x92')](_0x22af45);}})['then'](function(_0x1ef017){if(_0x1ef017){_0x4175d1=_0x1ef017[_0x1b82('0x4e')];if(!_0x56ce3c[_0x1b82('0x38')][_0x1b82('0x3e')](_0x1b82('0x3f'))){_0x22af45['limit']=qs[_0x1b82('0x1f')](_0x56ce3c[_0x1b82('0x38')]['limit']);_0x22af45[_0x1b82('0x21')]=qs['offset'](_0x56ce3c['query'][_0x1b82('0x21')]);}return _0x10f714['getAgents'](_0x22af45);}})[_0x1b82('0x28')](function(_0x1281ee){if(_0x1281ee){return _0x1281ee?{'count':_0x4175d1,'rows':_0x1281ee}:null;}})[_0x1b82('0x28')](respondWithResult(_0x5aad3c,null))[_0x1b82('0x4a')](handleError(_0x5aad3c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 981125b..8971e9a 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 _0x65f4=['hasOwnProperty','events','setMaxListeners','save','update','remove','emit'];(function(_0x536d35,_0x525a96){var _0x5e2d9a=function(_0x503b2a){while(--_0x503b2a){_0x536d35['push'](_0x536d35['shift']());}};_0x5e2d9a(++_0x525a96);}(_0x65f4,0xb0));var _0x465f=function(_0x45299c,_0x6930ca){_0x45299c=_0x45299c-0x0;var _0x5f9ba4=_0x65f4[_0x45299c];return _0x5f9ba4;};'use strict';var EventEmitter=require(_0x465f('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x465f('0x1')](0x0);var events={'afterCreate':_0x465f('0x2'),'afterUpdate':_0x465f('0x3'),'afterDestroy':_0x465f('0x4')};function emitEvent(_0x564937){return function(_0x454f3f,_0x40996c,_0xcf7ba4){MailQueueEvents[_0x465f('0x5')](_0x564937+':'+_0x454f3f['id'],_0x454f3f);MailQueueEvents[_0x465f('0x5')](_0x564937,_0x454f3f);_0xcf7ba4(null);};}for(var e in events){if(events[_0x465f('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x1161=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0x3bfdde,_0x306be4){var _0x3f752a=function(_0x3b6751){while(--_0x3b6751){_0x3bfdde['push'](_0x3bfdde['shift']());}};_0x3f752a(++_0x306be4);}(_0x1161,0xb8));var _0x1116=function(_0x41227c,_0x5485f2){_0x41227c=_0x41227c-0x0;var _0x47f3a8=_0x1161[_0x41227c];return _0x47f3a8;};'use strict';var EventEmitter=require(_0x1116('0x0'));var MailQueue=require(_0x1116('0x1'))['db'][_0x1116('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1116('0x3')](0x0);var events={'afterCreate':_0x1116('0x4'),'afterUpdate':_0x1116('0x5'),'afterDestroy':_0x1116('0x6')};function emitEvent(_0x3bee00){return function(_0x545f5f,_0x7e6198,_0x594f93){MailQueueEvents['emit'](_0x3bee00+':'+_0x545f5f['id'],_0x545f5f);MailQueueEvents[_0x1116('0x7')](_0x3bee00,_0x545f5f);_0x594f93(null);};}for(var e in events){if(events[_0x1116('0x8')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x1116('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 b9aea76..2b53a6c 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 _0x2986=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x2986,0x6f));var _0x6298=function(_0x4ee456,_0x5a9dc3){_0x4ee456=_0x4ee456-0x0;var _0xc89f4e=_0x2986[_0x4ee456];return _0xc89f4e;};'use strict';var _=require(_0x6298('0x0'));var util=require(_0x6298('0x1'));var logger=require(_0x6298('0x2'))(_0x6298('0x3'));var moment=require(_0x6298('0x4'));var BPromise=require(_0x6298('0x5'));var rp=require(_0x6298('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6298('0x7'));var config=require(_0x6298('0x8'));var attributes=require(_0x6298('0x9'));module[_0x6298('0xa')]=function(_0x4c05e2,_0x5caeb7){return _0x4c05e2[_0x6298('0xb')](_0x6298('0xc'),attributes,{'tableName':_0x6298('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39b8=['../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','MailQueue','util'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x39b8,0x12b));var _0x839b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x39b8[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x839b('0x0'));var logger=require(_0x839b('0x1'))(_0x839b('0x2'));var moment=require(_0x839b('0x3'));var BPromise=require('bluebird');var rp=require(_0x839b('0x4'));var fs=require('fs');var path=require(_0x839b('0x5'));var rimraf=require('rimraf');var config=require(_0x839b('0x6'));var attributes=require('./mailQueue.attributes');module[_0x839b('0x7')]=function(_0x863402,_0x368cdb){return _0x863402[_0x839b('0x8')](_0x839b('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index abd9644..362da69 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 _0xaf4c=['GetMailQueue','MailQueue','findAll','options','raw','attributes','include','map','model','ShowMailQueue','find','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','stringify','error','code','message','MailQueue,\x20%s,\x20%s','result','catch'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x148d5a,_0x382c0a){_0x148d5a=_0x148d5a-0x0;var _0x22fbcd=_0xaf4c[_0x148d5a];return _0x22fbcd;};'use strict';var _=require('lodash');var util=require(_0xcaf4('0x0'));var moment=require(_0xcaf4('0x1'));var BPromise=require('bluebird');var rs=require(_0xcaf4('0x2'));var fs=require('fs');var Redis=require(_0xcaf4('0x3'));var db=require(_0xcaf4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcaf4('0x5'))(_0xcaf4('0x6'));var config=require(_0xcaf4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcaf4('0x8')]['http']({'port':0x232a});config[_0xcaf4('0x9')]=_[_0xcaf4('0xa')](config[_0xcaf4('0x9')],{'host':_0xcaf4('0xb'),'port':0x18eb});var socket=require(_0xcaf4('0xc'))(new Redis(config[_0xcaf4('0x9')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2191f5,_0x30773e,_0x154e38){return new BPromise(function(_0x1c411e,_0x27930f){return client[_0xcaf4('0xd')](_0x2191f5,_0x154e38)[_0xcaf4('0xe')](function(_0x13a6d2){logger[_0xcaf4('0xf')]('MailQueue,\x20%s,\x20%s',_0x30773e,_0xcaf4('0x10'));logger[_0xcaf4('0x11')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x30773e,_0xcaf4('0x10'),JSON[_0xcaf4('0x12')](_0x13a6d2));if(_0x13a6d2[_0xcaf4('0x13')]){if(_0x13a6d2['error'][_0xcaf4('0x14')]===0x1f4){logger[_0xcaf4('0x13')]('MailQueue,\x20%s,\x20%s',_0x30773e,_0x13a6d2[_0xcaf4('0x13')]['message']);return _0x27930f(_0x13a6d2[_0xcaf4('0x13')][_0xcaf4('0x15')]);}logger[_0xcaf4('0x13')](_0xcaf4('0x16'),_0x30773e,_0x13a6d2[_0xcaf4('0x13')][_0xcaf4('0x15')]);return _0x1c411e(_0x13a6d2['error'][_0xcaf4('0x15')]);}else{logger['info'](_0xcaf4('0x16'),_0x30773e,'request\x20sent');_0x1c411e(_0x13a6d2[_0xcaf4('0x17')][_0xcaf4('0x15')]);}})[_0xcaf4('0x18')](function(_0x4e174d){logger['error'](_0xcaf4('0x16'),_0x30773e,_0x4e174d);_0x27930f(_0x4e174d);});});}exports[_0xcaf4('0x19')]=function(_0x23db74){var _0x2c4b02=this;return new Promise(function(_0x28b378,_0x596997){return db[_0xcaf4('0x1a')][_0xcaf4('0x1b')]({'raw':_0x23db74[_0xcaf4('0x1c')]?_0x23db74['options'][_0xcaf4('0x1d')]===undefined?!![]:![]:!![],'where':_0x23db74[_0xcaf4('0x1c')]?_0x23db74[_0xcaf4('0x1c')]['where']||null:null,'attributes':_0x23db74[_0xcaf4('0x1c')]?_0x23db74['options'][_0xcaf4('0x1e')]||null:null,'limit':_0x23db74[_0xcaf4('0x1c')]?_0x23db74[_0xcaf4('0x1c')]['limit']||null:null,'include':_0x23db74[_0xcaf4('0x1c')]?_0x23db74[_0xcaf4('0x1c')][_0xcaf4('0x1f')]?_[_0xcaf4('0x20')](_0x23db74['options'][_0xcaf4('0x1f')],function(_0xf9fe54){return{'model':db[_0xf9fe54['model']],'as':_0xf9fe54['as'],'attributes':_0xf9fe54[_0xcaf4('0x1e')],'include':_0xf9fe54[_0xcaf4('0x1f')]?_[_0xcaf4('0x20')](_0xf9fe54[_0xcaf4('0x1f')],function(_0x25beed){return{'model':db[_0x25beed[_0xcaf4('0x21')]],'as':_0x25beed['as'],'attributes':_0x25beed[_0xcaf4('0x1e')],'include':_0x25beed['include']?_[_0xcaf4('0x20')](_0x25beed[_0xcaf4('0x1f')],function(_0x237077){return{'model':db[_0x237077['model']],'as':_0x237077['as'],'attributes':_0x237077[_0xcaf4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcaf4('0xe')](function(_0x1fca09){logger[_0xcaf4('0xf')](_0xcaf4('0x19'),_0x23db74);logger[_0xcaf4('0x11')](_0xcaf4('0x19'),_0x23db74,JSON['stringify'](_0x1fca09));_0x28b378(_0x1fca09);})[_0xcaf4('0x18')](function(_0x5c355e){logger['error'](_0xcaf4('0x19'),_0x5c355e['message'],_0x23db74);_0x596997(_0x2c4b02[_0xcaf4('0x13')](0x1f4,_0x5c355e['message']));});});};exports[_0xcaf4('0x22')]=function(_0x5141bf){var _0x3d101a=this;return new Promise(function(_0xac02f,_0x252d4a){return db[_0xcaf4('0x1a')][_0xcaf4('0x23')]({'raw':_0x5141bf[_0xcaf4('0x1c')]?_0x5141bf[_0xcaf4('0x1c')][_0xcaf4('0x1d')]===undefined?!![]:![]:!![],'where':_0x5141bf['options']?_0x5141bf[_0xcaf4('0x1c')][_0xcaf4('0x24')]||null:null,'attributes':_0x5141bf[_0xcaf4('0x1c')]?_0x5141bf[_0xcaf4('0x1c')][_0xcaf4('0x1e')]||null:null,'include':_0x5141bf['options']?_0x5141bf['options']['include']?_['map'](_0x5141bf['options'][_0xcaf4('0x1f')],function(_0x37ed8f){return{'model':db[_0x37ed8f[_0xcaf4('0x21')]],'as':_0x37ed8f['as'],'attributes':_0x37ed8f['attributes'],'include':_0x37ed8f[_0xcaf4('0x1f')]?_[_0xcaf4('0x20')](_0x37ed8f[_0xcaf4('0x1f')],function(_0x363e6f){return{'model':db[_0x363e6f['model']],'as':_0x363e6f['as'],'attributes':_0x363e6f['attributes'],'include':_0x363e6f['include']?_['map'](_0x363e6f['include'],function(_0x297cfd){return{'model':db[_0x297cfd[_0xcaf4('0x21')]],'as':_0x297cfd['as'],'attributes':_0x297cfd['attributes']};}):[]};}):[]};}):[]:[]})[_0xcaf4('0xe')](function(_0xc78b8c){logger['info'](_0xcaf4('0x22'),_0x5141bf);logger[_0xcaf4('0x11')](_0xcaf4('0x22'),_0x5141bf,JSON['stringify'](_0xc78b8c));_0xac02f(_0xc78b8c);})['catch'](function(_0x1c1841){logger[_0xcaf4('0x13')](_0xcaf4('0x22'),_0x1c1841[_0xcaf4('0x15')],_0x5141bf);_0x252d4a(_0x3d101a['error'](0x1f4,_0x1c1841[_0xcaf4('0x15')]));});});}; \ No newline at end of file +var _0x20a9=['debug','stringify','error','code','message','info','result','catch','GetMailQueue','MailQueue','options','where','limit','include','model','attributes','map','ShowMailQueue','find','raw','lodash','util','moment','../../mysqldb','../../config/utils','rpc','redis','defaults','localhost','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x59c084,_0x34393f){var _0x5bc844=function(_0x2b5331){while(--_0x2b5331){_0x59c084['push'](_0x59c084['shift']());}};_0x5bc844(++_0x34393f);}(_0x20a9,0x14f));var _0x920a=function(_0x514260,_0x1891e1){_0x514260=_0x514260-0x0;var _0x4ac81b=_0x20a9[_0x514260];return _0x4ac81b;};'use strict';var _=require(_0x920a('0x0'));var util=require(_0x920a('0x1'));var moment=require(_0x920a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x920a('0x3'))['db'];var utils=require(_0x920a('0x4'));var logger=require('../../config/logger')(_0x920a('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x920a('0x6')]=_[_0x920a('0x7')](config[_0x920a('0x6')],{'host':_0x920a('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x920a('0x9'))[_0x920a('0xa')](socket);function respondWithRpcPromise(_0x32a3e9,_0xb20522,_0x249541){return new BPromise(function(_0x3f4216,_0x1384f5){return client[_0x920a('0xb')](_0x32a3e9,_0x249541)[_0x920a('0xc')](function(_0x259820){logger['info'](_0x920a('0xd'),_0xb20522,_0x920a('0xe'));logger[_0x920a('0xf')]('MailQueue,\x20%s,\x20%s,\x20%s',_0xb20522,_0x920a('0xe'),JSON[_0x920a('0x10')](_0x259820));if(_0x259820[_0x920a('0x11')]){if(_0x259820['error'][_0x920a('0x12')]===0x1f4){logger[_0x920a('0x11')]('MailQueue,\x20%s,\x20%s',_0xb20522,_0x259820[_0x920a('0x11')][_0x920a('0x13')]);return _0x1384f5(_0x259820[_0x920a('0x11')][_0x920a('0x13')]);}logger['error'](_0x920a('0xd'),_0xb20522,_0x259820[_0x920a('0x11')][_0x920a('0x13')]);return _0x3f4216(_0x259820[_0x920a('0x11')][_0x920a('0x13')]);}else{logger[_0x920a('0x14')](_0x920a('0xd'),_0xb20522,_0x920a('0xe'));_0x3f4216(_0x259820[_0x920a('0x15')][_0x920a('0x13')]);}})[_0x920a('0x16')](function(_0x3630b3){logger[_0x920a('0x11')](_0x920a('0xd'),_0xb20522,_0x3630b3);_0x1384f5(_0x3630b3);});});}exports[_0x920a('0x17')]=function(_0x14e693){var _0x480f18=this;return new Promise(function(_0x4ba63b,_0x2d0785){return db[_0x920a('0x18')]['findAll']({'raw':_0x14e693[_0x920a('0x19')]?_0x14e693[_0x920a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x14e693['options']?_0x14e693[_0x920a('0x19')][_0x920a('0x1a')]||null:null,'attributes':_0x14e693[_0x920a('0x19')]?_0x14e693[_0x920a('0x19')]['attributes']||null:null,'limit':_0x14e693['options']?_0x14e693['options'][_0x920a('0x1b')]||null:null,'include':_0x14e693[_0x920a('0x19')]?_0x14e693[_0x920a('0x19')][_0x920a('0x1c')]?_['map'](_0x14e693[_0x920a('0x19')][_0x920a('0x1c')],function(_0x5aed35){return{'model':db[_0x5aed35[_0x920a('0x1d')]],'as':_0x5aed35['as'],'attributes':_0x5aed35[_0x920a('0x1e')],'include':_0x5aed35[_0x920a('0x1c')]?_['map'](_0x5aed35[_0x920a('0x1c')],function(_0x548cc4){return{'model':db[_0x548cc4['model']],'as':_0x548cc4['as'],'attributes':_0x548cc4[_0x920a('0x1e')],'include':_0x548cc4[_0x920a('0x1c')]?_[_0x920a('0x1f')](_0x548cc4[_0x920a('0x1c')],function(_0x17f979){return{'model':db[_0x17f979[_0x920a('0x1d')]],'as':_0x17f979['as'],'attributes':_0x17f979['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x221a5f){logger[_0x920a('0x14')]('GetMailQueue',_0x14e693);logger['debug'](_0x920a('0x17'),_0x14e693,JSON[_0x920a('0x10')](_0x221a5f));_0x4ba63b(_0x221a5f);})['catch'](function(_0x28295f){logger['error'](_0x920a('0x17'),_0x28295f[_0x920a('0x13')],_0x14e693);_0x2d0785(_0x480f18[_0x920a('0x11')](0x1f4,_0x28295f[_0x920a('0x13')]));});});};exports[_0x920a('0x20')]=function(_0x3b89a6){var _0x3bc653=this;return new Promise(function(_0x18af6c,_0xa67626){return db[_0x920a('0x18')][_0x920a('0x21')]({'raw':_0x3b89a6[_0x920a('0x19')]?_0x3b89a6['options'][_0x920a('0x22')]===undefined?!![]:![]:!![],'where':_0x3b89a6['options']?_0x3b89a6[_0x920a('0x19')]['where']||null:null,'attributes':_0x3b89a6['options']?_0x3b89a6['options'][_0x920a('0x1e')]||null:null,'include':_0x3b89a6[_0x920a('0x19')]?_0x3b89a6[_0x920a('0x19')]['include']?_[_0x920a('0x1f')](_0x3b89a6[_0x920a('0x19')][_0x920a('0x1c')],function(_0x3dbf04){return{'model':db[_0x3dbf04[_0x920a('0x1d')]],'as':_0x3dbf04['as'],'attributes':_0x3dbf04[_0x920a('0x1e')],'include':_0x3dbf04[_0x920a('0x1c')]?_[_0x920a('0x1f')](_0x3dbf04[_0x920a('0x1c')],function(_0x18775c){return{'model':db[_0x18775c[_0x920a('0x1d')]],'as':_0x18775c['as'],'attributes':_0x18775c[_0x920a('0x1e')],'include':_0x18775c[_0x920a('0x1c')]?_['map'](_0x18775c[_0x920a('0x1c')],function(_0xc6fa27){return{'model':db[_0xc6fa27[_0x920a('0x1d')]],'as':_0xc6fa27['as'],'attributes':_0xc6fa27[_0x920a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x920a('0xc')](function(_0x40c793){logger['info'](_0x920a('0x20'),_0x3b89a6);logger[_0x920a('0xf')](_0x920a('0x20'),_0x3b89a6,JSON['stringify'](_0x40c793));_0x18af6c(_0x40c793);})[_0x920a('0x16')](function(_0x38f6ca){logger[_0x920a('0x11')](_0x920a('0x20'),_0x38f6ca[_0x920a('0x13')],_0x3b89a6);_0xa67626(_0x3bc653['error'](0x1f4,_0x38f6ca[_0x920a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 05f8612..55668d7 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 _0xd958=['length','mailQueue:','./mailQueue.events','save','emit','removeListener','register'];(function(_0x29b4d5,_0x5b94c7){var _0x241d61=function(_0x127991){while(--_0x127991){_0x29b4d5['push'](_0x29b4d5['shift']());}};_0x241d61(++_0x5b94c7);}(_0xd958,0xb8));var _0x8d95=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xd958[_0x51c819];return _0x15c5d2;};'use strict';var MailQueueEvents=require(_0x8d95('0x0'));var events=[_0x8d95('0x1'),'remove','update'];function createListener(_0x3a27c4,_0x52d095){return function(_0x453616){_0x52d095[_0x8d95('0x2')](_0x3a27c4,_0x453616);};}function removeListener(_0x1be3cf,_0x36032d){return function(){MailQueueEvents[_0x8d95('0x3')](_0x1be3cf,_0x36032d);};}exports[_0x8d95('0x4')]=function(_0x42e704){for(var _0x27f972=0x0,_0x4cc162=events[_0x8d95('0x5')];_0x27f972<_0x4cc162;_0x27f972++){var _0xf80e9a=events[_0x27f972];var _0x2e6506=createListener(_0x8d95('0x6')+_0xf80e9a,_0x42e704);MailQueueEvents['on'](_0xf80e9a,_0x2e6506);}}; \ No newline at end of file +var _0xdc64=['length','mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x34d897,_0x3b471){var _0x471186=function(_0x125675){while(--_0x125675){_0x34d897['push'](_0x34d897['shift']());}};_0x471186(++_0x3b471);}(_0xdc64,0x80));var _0x4dc6=function(_0xfec8ef,_0x37ff77){_0xfec8ef=_0xfec8ef-0x0;var _0x2be8bb=_0xdc64[_0xfec8ef];return _0x2be8bb;};'use strict';var MailQueueEvents=require(_0x4dc6('0x0'));var events=[_0x4dc6('0x1'),_0x4dc6('0x2'),_0x4dc6('0x3')];function createListener(_0x588791,_0x3eb4e2){return function(_0xfd418c){_0x3eb4e2[_0x4dc6('0x4')](_0x588791,_0xfd418c);};}function removeListener(_0x6a357f,_0x425b2c){return function(){MailQueueEvents[_0x4dc6('0x5')](_0x6a357f,_0x425b2c);};}exports[_0x4dc6('0x6')]=function(_0x2858c3){for(var _0x263fcd=0x0,_0x469d65=events[_0x4dc6('0x7')];_0x263fcd<_0x469d65;_0x263fcd++){var _0x9656e8=events[_0x263fcd];var _0x293005=createListener(_0x4dc6('0x8')+_0x9656e8,_0x2858c3);MailQueueEvents['on'](_0x9656e8,_0x293005);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 3bf64e5..bade360 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 _0x0c21=['create','update','delete','destroy','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x571f06,_0x31a440){var _0xcaf966=function(_0x8b59a2){while(--_0x8b59a2){_0x571f06['push'](_0x571f06['shift']());}};_0xcaf966(++_0x31a440);}(_0x0c21,0xdd));var _0x10c2=function(_0x48f1ed,_0x541f2a){_0x48f1ed=_0x48f1ed-0x0;var _0x1ceaf7=_0x0c21[_0x48f1ed];return _0x1ceaf7;};'use strict';var multer=require(_0x10c2('0x0'));var util=require('util');var path=require(_0x10c2('0x1'));var timeout=require(_0x10c2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x10c2('0x3'));var config=require(_0x10c2('0x4'));var controller=require(_0x10c2('0x5'));router[_0x10c2('0x6')]('/',auth[_0x10c2('0x7')](),controller[_0x10c2('0x8')]);router[_0x10c2('0x6')](_0x10c2('0x9'),auth[_0x10c2('0x7')](),controller[_0x10c2('0xa')]);router[_0x10c2('0x6')](_0x10c2('0xb'),auth[_0x10c2('0x7')](),controller[_0x10c2('0xc')]);router['post']('/',auth[_0x10c2('0x7')](),controller[_0x10c2('0xd')]);router['put'](_0x10c2('0xb'),auth[_0x10c2('0x7')](),controller[_0x10c2('0xe')]);router[_0x10c2('0xf')](_0x10c2('0xb'),auth['isAuthenticated'](),controller[_0x10c2('0x10')]);module[_0x10c2('0x11')]=router; \ No newline at end of file +var _0x2266=['../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x34fc8d,_0x2ee8c4){var _0x46c791=function(_0x2475da){while(--_0x2475da){_0x34fc8d['push'](_0x34fc8d['shift']());}};_0x46c791(++_0x2ee8c4);}(_0x2266,0x189));var _0x6226=function(_0x2b341f,_0x5bd3b8){_0x2b341f=_0x2b341f-0x0;var _0x4a4f94=_0x2266[_0x2b341f];return _0x4a4f94;};'use strict';var multer=require(_0x6226('0x0'));var util=require(_0x6226('0x1'));var path=require('path');var timeout=require(_0x6226('0x2'));var express=require(_0x6226('0x3'));var router=express[_0x6226('0x4')]();var fs_extra=require(_0x6226('0x5'));var auth=require(_0x6226('0x6'));var interaction=require(_0x6226('0x7'));var config=require('../../config/environment');var controller=require(_0x6226('0x8'));router['get']('/',auth[_0x6226('0x9')](),controller[_0x6226('0xa')]);router[_0x6226('0xb')](_0x6226('0xc'),auth[_0x6226('0x9')](),controller[_0x6226('0xd')]);router[_0x6226('0xb')](_0x6226('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x6226('0xf')]('/',auth[_0x6226('0x9')](),controller[_0x6226('0x10')]);router[_0x6226('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6226('0x12')]);router[_0x6226('0x13')]('/:id',auth[_0x6226('0x9')](),controller[_0x6226('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 47aa871..f9084a7 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 _0x14ce=['sequelize','exports','STRING','DATE','moment'];(function(_0x3712a0,_0x1a42f7){var _0x491d44=function(_0x2ae544){while(--_0x2ae544){_0x3712a0['push'](_0x3712a0['shift']());}};_0x491d44(++_0x1a42f7);}(_0x14ce,0xea));var _0xe14c=function(_0x5aefd2,_0x56c676){_0x5aefd2=_0x5aefd2-0x0;var _0xc943f4=_0x14ce[_0x5aefd2];return _0xc943f4;};'use strict';var moment=require(_0xe14c('0x0'));var Sequelize=require(_0xe14c('0x1'));module[_0xe14c('0x2')]={'uniqueid':{'type':Sequelize[_0xe14c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe14c('0x3')]},'joinAt':{'type':Sequelize[_0xe14c('0x4')]},'leaveAt':{'type':Sequelize[_0xe14c('0x4')]},'acceptAt':{'type':Sequelize[_0xe14c('0x4')]},'exitAt':{'type':Sequelize[_0xe14c('0x4')]},'reason':{'type':Sequelize[_0xe14c('0x3')]}}; \ No newline at end of file +var _0xfa2d=['sequelize','exports','STRING','DATE','moment'];(function(_0x4eaa4c,_0x2f7422){var _0x15aec6=function(_0x23efc9){while(--_0x23efc9){_0x4eaa4c['push'](_0x4eaa4c['shift']());}};_0x15aec6(++_0x2f7422);}(_0xfa2d,0x112));var _0xdfa2=function(_0x21c93d,_0x3b2632){_0x21c93d=_0x21c93d-0x0;var _0x1274ad=_0xfa2d[_0x21c93d];return _0x1274ad;};'use strict';var moment=require(_0xdfa2('0x0'));var Sequelize=require(_0xdfa2('0x1'));module[_0xdfa2('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdfa2('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xdfa2('0x4')]},'exitAt':{'type':Sequelize[_0xdfa2('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index be55bf5..0b170fe 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 _0x32f4=['destroy','then','end','error','stack','name','send','map','MailQueueReport','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','fields','length','model','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x32f4,0x154));var _0x432f=function(_0xbf341d,_0x4105da){_0xbf341d=_0xbf341d-0x0;var _0x553fa2=_0x32f4[_0xbf341d];return _0x553fa2;};'use strict';var emlformat=require(_0x432f('0x0'));var rimraf=require(_0x432f('0x1'));var zipdir=require(_0x432f('0x2'));var jsonpatch=require(_0x432f('0x3'));var rp=require('request-promise');var moment=require(_0x432f('0x4'));var BPromise=require(_0x432f('0x5'));var Mustache=require('mustache');var util=require(_0x432f('0x6'));var path=require(_0x432f('0x7'));var sox=require(_0x432f('0x8'));var csv=require(_0x432f('0x9'));var ejs=require(_0x432f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x432f('0xb'));var crypto=require(_0x432f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x432f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x432f('0xe'));var Papa=require(_0x432f('0xf'));var Redis=require(_0x432f('0x10'));var authService=require(_0x432f('0x11'));var qs=require(_0x432f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x432f('0x13'));var logger=require('../../config/logger')(_0x432f('0x14'));var utils=require('../../config/utils');var config=require(_0x432f('0x15'));var licenseUtil=require(_0x432f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x457389,_0x29f7d2){_0x29f7d2=_0x29f7d2||0xcc;return function(_0x52e40f){if(_0x52e40f){return _0x457389[_0x432f('0x17')](_0x29f7d2);}return _0x457389[_0x432f('0x18')](_0x29f7d2)['end']();};}function respondWithResult(_0x48a4db,_0x28d9e9){_0x28d9e9=_0x28d9e9||0xc8;return function(_0x44756d){if(_0x44756d){return _0x48a4db[_0x432f('0x18')](_0x28d9e9)[_0x432f('0x19')](_0x44756d);}};}function respondWithFilteredResult(_0x419bfe,_0x4f91c5){return function(_0x175ba7){if(_0x175ba7){var _0x2f0708=typeof _0x4f91c5[_0x432f('0x1a')]===_0x432f('0x1b')&&typeof _0x4f91c5['limit']===_0x432f('0x1b');var _0x30f231=_0x175ba7[_0x432f('0x1c')];var _0x243cf=_0x2f0708?0x0:_0x4f91c5[_0x432f('0x1a')];var _0x129582=_0x2f0708?_0x175ba7['count']:_0x4f91c5[_0x432f('0x1a')]+_0x4f91c5['limit'];var _0x3d545d;if(_0x129582>=_0x30f231){_0x129582=_0x30f231;_0x3d545d=0xc8;}else{_0x3d545d=0xce;}_0x419bfe[_0x432f('0x18')](_0x3d545d);return _0x419bfe[_0x432f('0x1d')](_0x432f('0x1e'),_0x243cf+'-'+_0x129582+'/'+_0x30f231)[_0x432f('0x19')](_0x175ba7);}return null;};}function patchUpdates(_0xf1f5d){return function(_0x10f39b){try{jsonpatch[_0x432f('0x1f')](_0x10f39b,_0xf1f5d,!![]);}catch(_0x693eb3){return BPromise[_0x432f('0x20')](_0x693eb3);}return _0x10f39b[_0x432f('0x21')]();};}function saveUpdates(_0x3446fd,_0x4dd230){return function(_0x5940bd){if(_0x5940bd){return _0x5940bd[_0x432f('0x22')](_0x3446fd)['then'](function(_0x28968e){return _0x28968e;});}return null;};}function removeEntity(_0x5b9c70,_0x37f136){return function(_0x175d1b){if(_0x175d1b){return _0x175d1b[_0x432f('0x23')]()[_0x432f('0x24')](function(){_0x5b9c70[_0x432f('0x18')](0xcc)[_0x432f('0x25')]();});}};}function handleEntityNotFound(_0x59f352,_0x252b3b){return function(_0x33edec){if(!_0x33edec){_0x59f352['sendStatus'](0x194);}return _0x33edec;};}function handleError(_0x2cbde9,_0x3e37ec){_0x3e37ec=_0x3e37ec||0x1f4;return function(_0x2bcbb4){logger[_0x432f('0x26')](_0x2bcbb4[_0x432f('0x27')]);if(_0x2bcbb4[_0x432f('0x28')]){delete _0x2bcbb4[_0x432f('0x28')];}_0x2cbde9['status'](_0x3e37ec)[_0x432f('0x29')](_0x2bcbb4);};}exports['index']=function(_0x1f1fdd,_0x573cc5){var _0x20404d={},_0x5a2c14={},_0x3f768b={'count':0x0,'rows':[]};var _0x489ba6=_[_0x432f('0x2a')](db[_0x432f('0x2b')][_0x432f('0x2c')],function(_0x59c1ab){return{'name':_0x59c1ab[_0x432f('0x2d')],'type':_0x59c1ab[_0x432f('0x2e')]['key']};});_0x5a2c14['model']=_[_0x432f('0x2a')](_0x489ba6,_0x432f('0x28'));_0x5a2c14[_0x432f('0x2f')]=_[_0x432f('0x30')](_0x1f1fdd[_0x432f('0x2f')]);_0x5a2c14[_0x432f('0x31')]=_['intersection'](_0x5a2c14['model'],_0x5a2c14[_0x432f('0x2f')]);_0x20404d[_0x432f('0x32')]=_[_0x432f('0x33')](_0x5a2c14['model'],qs[_0x432f('0x34')](_0x1f1fdd[_0x432f('0x2f')][_0x432f('0x34')]));_0x20404d[_0x432f('0x32')]=_0x20404d[_0x432f('0x32')][_0x432f('0x35')]?_0x20404d[_0x432f('0x32')]:_0x5a2c14[_0x432f('0x36')];if(!_0x1f1fdd['query']['hasOwnProperty'](_0x432f('0x37'))){_0x20404d[_0x432f('0x38')]=qs['limit'](_0x1f1fdd['query']['limit']);_0x20404d[_0x432f('0x1a')]=qs[_0x432f('0x1a')](_0x1f1fdd['query'][_0x432f('0x1a')]);}_0x20404d[_0x432f('0x39')]=qs[_0x432f('0x3a')](_0x1f1fdd['query'][_0x432f('0x3a')]);_0x20404d[_0x432f('0x3b')]=qs['filters'](_[_0x432f('0x3c')](_0x1f1fdd[_0x432f('0x2f')],_0x5a2c14['filters']),_0x489ba6);if(_0x1f1fdd[_0x432f('0x2f')][_0x432f('0x3d')]){_0x20404d[_0x432f('0x3b')]=_[_0x432f('0x3e')](_0x20404d[_0x432f('0x3b')],{'$or':_[_0x432f('0x2a')](_0x489ba6,function(_0xbef36e){if(_0xbef36e[_0x432f('0x2e')]!==_0x432f('0x3f')){var _0x2545b7={};_0x2545b7[_0xbef36e[_0x432f('0x28')]]={'$like':'%'+_0x1f1fdd['query'][_0x432f('0x3d')]+'%'};return _0x2545b7;}})});}_0x20404d=_['merge']({},_0x20404d,_0x1f1fdd[_0x432f('0x40')]);var _0x3e8a0a={'where':_0x20404d['where']};return db[_0x432f('0x2b')]['count'](_0x3e8a0a)[_0x432f('0x24')](function(_0x3aca68){_0x3f768b['count']=_0x3aca68;if(_0x1f1fdd['query'][_0x432f('0x41')]){_0x20404d[_0x432f('0x42')]=[{'all':!![]}];}return db[_0x432f('0x2b')][_0x432f('0x43')](_0x20404d);})[_0x432f('0x24')](function(_0x513a57){_0x3f768b['rows']=_0x513a57;return _0x3f768b;})['then'](respondWithFilteredResult(_0x573cc5,_0x20404d))[_0x432f('0x44')](handleError(_0x573cc5,null));};exports[_0x432f('0x45')]=function(_0x55d64c,_0x1f58af){var _0x841572={'raw':!![],'where':{'id':_0x55d64c[_0x432f('0x46')]['id']}},_0x41c90c={};_0x41c90c[_0x432f('0x36')]=_[_0x432f('0x30')](db[_0x432f('0x2b')][_0x432f('0x2c')]);_0x41c90c[_0x432f('0x2f')]=_['keys'](_0x55d64c[_0x432f('0x2f')]);_0x41c90c[_0x432f('0x31')]=_['intersection'](_0x41c90c[_0x432f('0x36')],_0x41c90c[_0x432f('0x2f')]);_0x841572[_0x432f('0x32')]=_[_0x432f('0x33')](_0x41c90c[_0x432f('0x36')],qs[_0x432f('0x34')](_0x55d64c[_0x432f('0x2f')][_0x432f('0x34')]));_0x841572[_0x432f('0x32')]=_0x841572[_0x432f('0x32')][_0x432f('0x35')]?_0x841572[_0x432f('0x32')]:_0x41c90c[_0x432f('0x36')];if(_0x55d64c[_0x432f('0x2f')]['includeAll']){_0x841572['include']=[{'all':!![]}];}_0x841572=_[_0x432f('0x3e')]({},_0x841572,_0x55d64c[_0x432f('0x40')]);return db[_0x432f('0x2b')][_0x432f('0x47')](_0x841572)[_0x432f('0x24')](handleEntityNotFound(_0x1f58af,null))['then'](respondWithResult(_0x1f58af,null))[_0x432f('0x44')](handleError(_0x1f58af,null));};exports[_0x432f('0x48')]=function(_0x46c5ee,_0x2f88d6){return db[_0x432f('0x2b')][_0x432f('0x48')](_0x46c5ee[_0x432f('0x49')],{})['then'](respondWithResult(_0x2f88d6,0xc9))[_0x432f('0x44')](handleError(_0x2f88d6,null));};exports[_0x432f('0x22')]=function(_0x359853,_0x547bd0){if(_0x359853[_0x432f('0x49')]['id']){delete _0x359853[_0x432f('0x49')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x359853[_0x432f('0x46')]['id']}})[_0x432f('0x24')](handleEntityNotFound(_0x547bd0,null))['then'](saveUpdates(_0x359853['body'],null))[_0x432f('0x24')](respondWithResult(_0x547bd0,null))['catch'](handleError(_0x547bd0,null));};exports[_0x432f('0x23')]=function(_0x66b80e,_0x5df9b3){return db[_0x432f('0x2b')]['find']({'where':{'id':_0x66b80e[_0x432f('0x46')]['id']}})[_0x432f('0x24')](handleEntityNotFound(_0x5df9b3,null))[_0x432f('0x24')](removeEntity(_0x5df9b3,null))[_0x432f('0x44')](handleError(_0x5df9b3,null));};exports[_0x432f('0x4a')]=function(_0x2a4d36,_0x56f526){return db[_0x432f('0x2b')]['describe']()[_0x432f('0x24')](respondWithResult(_0x56f526,null))[_0x432f('0x44')](handleError(_0x56f526,null));}; \ No newline at end of file +var _0x2da6=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','MailQueueReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','intersection','find','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox'];(function(_0x2c5c30,_0x21e856){var _0x22137c=function(_0x40a954){while(--_0x40a954){_0x2c5c30['push'](_0x2c5c30['shift']());}};_0x22137c(++_0x21e856);}(_0x2da6,0x1dd));var _0x62da=function(_0x4a9058,_0x2ed6e3){_0x4a9058=_0x4a9058-0x0;var _0x180d8f=_0x2da6[_0x4a9058];return _0x180d8f;};'use strict';var emlformat=require(_0x62da('0x0'));var rimraf=require(_0x62da('0x1'));var zipdir=require(_0x62da('0x2'));var jsonpatch=require(_0x62da('0x3'));var rp=require(_0x62da('0x4'));var moment=require(_0x62da('0x5'));var BPromise=require(_0x62da('0x6'));var Mustache=require(_0x62da('0x7'));var util=require('util');var path=require('path');var sox=require(_0x62da('0x8'));var csv=require(_0x62da('0x9'));var ejs=require(_0x62da('0xa'));var fs=require('fs');var fs_extra=require(_0x62da('0xb'));var _=require(_0x62da('0xc'));var squel=require(_0x62da('0xd'));var crypto=require(_0x62da('0xe'));var jsforce=require(_0x62da('0xf'));var deskjs=require(_0x62da('0x10'));var toCsv=require('to-csv');var querystring=require(_0x62da('0x11'));var Papa=require(_0x62da('0x12'));var Redis=require(_0x62da('0x13'));var authService=require(_0x62da('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x62da('0x15'));var hardwareService=require(_0x62da('0x16'));var logger=require(_0x62da('0x17'))(_0x62da('0x18'));var utils=require(_0x62da('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x62da('0x1a'));var db=require(_0x62da('0x1b'))['db'];function respondWithStatusCode(_0xd27693,_0x362eeb){_0x362eeb=_0x362eeb||0xcc;return function(_0x37ba2e){if(_0x37ba2e){return _0xd27693['sendStatus'](_0x362eeb);}return _0xd27693['status'](_0x362eeb)[_0x62da('0x1c')]();};}function respondWithResult(_0x27a000,_0x1bd7f9){_0x1bd7f9=_0x1bd7f9||0xc8;return function(_0x191ed5){if(_0x191ed5){return _0x27a000[_0x62da('0x1d')](_0x1bd7f9)[_0x62da('0x1e')](_0x191ed5);}};}function respondWithFilteredResult(_0x3c6498,_0x624a1c){return function(_0x2cbdf6){if(_0x2cbdf6){var _0xcc1a25=typeof _0x624a1c[_0x62da('0x1f')]===_0x62da('0x20')&&typeof _0x624a1c[_0x62da('0x21')]===_0x62da('0x20');var _0x4bdab9=_0x2cbdf6['count'];var _0xa7050b=_0xcc1a25?0x0:_0x624a1c['offset'];var _0x4d6482=_0xcc1a25?_0x2cbdf6[_0x62da('0x22')]:_0x624a1c[_0x62da('0x1f')]+_0x624a1c['limit'];var _0x29191b;if(_0x4d6482>=_0x4bdab9){_0x4d6482=_0x4bdab9;_0x29191b=0xc8;}else{_0x29191b=0xce;}_0x3c6498['status'](_0x29191b);return _0x3c6498[_0x62da('0x23')](_0x62da('0x24'),_0xa7050b+'-'+_0x4d6482+'/'+_0x4bdab9)[_0x62da('0x1e')](_0x2cbdf6);}return null;};}function patchUpdates(_0x2f7b01){return function(_0x3d015f){try{jsonpatch[_0x62da('0x25')](_0x3d015f,_0x2f7b01,!![]);}catch(_0x183033){return BPromise[_0x62da('0x26')](_0x183033);}return _0x3d015f[_0x62da('0x27')]();};}function saveUpdates(_0x583fc0,_0x13bf6d){return function(_0x866a76){if(_0x866a76){return _0x866a76[_0x62da('0x28')](_0x583fc0)[_0x62da('0x29')](function(_0x35f687){return _0x35f687;});}return null;};}function removeEntity(_0x54b936,_0x24298a){return function(_0x50ed6b){if(_0x50ed6b){return _0x50ed6b['destroy']()['then'](function(){_0x54b936[_0x62da('0x1d')](0xcc)[_0x62da('0x1c')]();});}};}function handleEntityNotFound(_0x14897c,_0x3f6fc9){return function(_0x4b1237){if(!_0x4b1237){_0x14897c[_0x62da('0x2a')](0x194);}return _0x4b1237;};}function handleError(_0x3b9c06,_0x5f0a9c){_0x5f0a9c=_0x5f0a9c||0x1f4;return function(_0x3ccf96){logger[_0x62da('0x2b')](_0x3ccf96[_0x62da('0x2c')]);if(_0x3ccf96['name']){delete _0x3ccf96[_0x62da('0x2d')];}_0x3b9c06[_0x62da('0x1d')](_0x5f0a9c)[_0x62da('0x2e')](_0x3ccf96);};}exports['index']=function(_0x4f5657,_0x3c6274){var _0x301e3d={},_0x220ffc={},_0x594c5a={'count':0x0,'rows':[]};var _0x45f67a=_[_0x62da('0x2f')](db[_0x62da('0x30')][_0x62da('0x31')],function(_0xd8cf3b){return{'name':_0xd8cf3b[_0x62da('0x32')],'type':_0xd8cf3b['type'][_0x62da('0x33')]};});_0x220ffc['model']=_[_0x62da('0x2f')](_0x45f67a,_0x62da('0x2d'));_0x220ffc[_0x62da('0x34')]=_[_0x62da('0x35')](_0x4f5657[_0x62da('0x34')]);_0x220ffc[_0x62da('0x36')]=_['intersection'](_0x220ffc[_0x62da('0x37')],_0x220ffc[_0x62da('0x34')]);_0x301e3d[_0x62da('0x38')]=_['intersection'](_0x220ffc[_0x62da('0x37')],qs[_0x62da('0x39')](_0x4f5657[_0x62da('0x34')]['fields']));_0x301e3d[_0x62da('0x38')]=_0x301e3d[_0x62da('0x38')]['length']?_0x301e3d[_0x62da('0x38')]:_0x220ffc[_0x62da('0x37')];if(!_0x4f5657['query'][_0x62da('0x3a')](_0x62da('0x3b'))){_0x301e3d[_0x62da('0x21')]=qs[_0x62da('0x21')](_0x4f5657[_0x62da('0x34')][_0x62da('0x21')]);_0x301e3d[_0x62da('0x1f')]=qs[_0x62da('0x1f')](_0x4f5657[_0x62da('0x34')][_0x62da('0x1f')]);}_0x301e3d[_0x62da('0x3c')]=qs[_0x62da('0x3d')](_0x4f5657[_0x62da('0x34')][_0x62da('0x3d')]);_0x301e3d[_0x62da('0x3e')]=qs[_0x62da('0x36')](_[_0x62da('0x3f')](_0x4f5657['query'],_0x220ffc[_0x62da('0x36')]),_0x45f67a);if(_0x4f5657['query'][_0x62da('0x40')]){_0x301e3d[_0x62da('0x3e')]=_[_0x62da('0x41')](_0x301e3d['where'],{'$or':_[_0x62da('0x2f')](_0x45f67a,function(_0xecf52d){if(_0xecf52d[_0x62da('0x42')]!==_0x62da('0x43')){var _0x5093c1={};_0x5093c1[_0xecf52d[_0x62da('0x2d')]]={'$like':'%'+_0x4f5657[_0x62da('0x34')][_0x62da('0x40')]+'%'};return _0x5093c1;}})});}_0x301e3d=_[_0x62da('0x41')]({},_0x301e3d,_0x4f5657[_0x62da('0x44')]);var _0x203815={'where':_0x301e3d[_0x62da('0x3e')]};return db[_0x62da('0x30')][_0x62da('0x22')](_0x203815)['then'](function(_0x29d2c2){_0x594c5a[_0x62da('0x22')]=_0x29d2c2;if(_0x4f5657['query'][_0x62da('0x45')]){_0x301e3d[_0x62da('0x46')]=[{'all':!![]}];}return db[_0x62da('0x30')][_0x62da('0x47')](_0x301e3d);})[_0x62da('0x29')](function(_0xde827d){_0x594c5a[_0x62da('0x48')]=_0xde827d;return _0x594c5a;})[_0x62da('0x29')](respondWithFilteredResult(_0x3c6274,_0x301e3d))['catch'](handleError(_0x3c6274,null));};exports['show']=function(_0x4bd1b8,_0x40d0af){var _0x54b49c={'raw':!![],'where':{'id':_0x4bd1b8['params']['id']}},_0x86f5a8={};_0x86f5a8['model']=_['keys'](db[_0x62da('0x30')][_0x62da('0x31')]);_0x86f5a8['query']=_[_0x62da('0x35')](_0x4bd1b8['query']);_0x86f5a8[_0x62da('0x36')]=_['intersection'](_0x86f5a8['model'],_0x86f5a8[_0x62da('0x34')]);_0x54b49c[_0x62da('0x38')]=_[_0x62da('0x49')](_0x86f5a8['model'],qs[_0x62da('0x39')](_0x4bd1b8[_0x62da('0x34')][_0x62da('0x39')]));_0x54b49c[_0x62da('0x38')]=_0x54b49c[_0x62da('0x38')]['length']?_0x54b49c['attributes']:_0x86f5a8[_0x62da('0x37')];if(_0x4bd1b8[_0x62da('0x34')][_0x62da('0x45')]){_0x54b49c[_0x62da('0x46')]=[{'all':!![]}];}_0x54b49c=_[_0x62da('0x41')]({},_0x54b49c,_0x4bd1b8['options']);return db['MailQueueReport'][_0x62da('0x4a')](_0x54b49c)[_0x62da('0x29')](handleEntityNotFound(_0x40d0af,null))['then'](respondWithResult(_0x40d0af,null))[_0x62da('0x4b')](handleError(_0x40d0af,null));};exports[_0x62da('0x4c')]=function(_0x454cc0,_0x29153f){return db[_0x62da('0x30')]['create'](_0x454cc0[_0x62da('0x4d')],{})[_0x62da('0x29')](respondWithResult(_0x29153f,0xc9))[_0x62da('0x4b')](handleError(_0x29153f,null));};exports[_0x62da('0x28')]=function(_0x4d3ec0,_0x1f2ab5){if(_0x4d3ec0[_0x62da('0x4d')]['id']){delete _0x4d3ec0[_0x62da('0x4d')]['id'];}return db[_0x62da('0x30')]['find']({'where':{'id':_0x4d3ec0[_0x62da('0x4e')]['id']}})[_0x62da('0x29')](handleEntityNotFound(_0x1f2ab5,null))['then'](saveUpdates(_0x4d3ec0['body'],null))['then'](respondWithResult(_0x1f2ab5,null))[_0x62da('0x4b')](handleError(_0x1f2ab5,null));};exports[_0x62da('0x4f')]=function(_0x33fbfc,_0x5cd1a9){return db[_0x62da('0x30')][_0x62da('0x4a')]({'where':{'id':_0x33fbfc[_0x62da('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5cd1a9,null))[_0x62da('0x29')](removeEntity(_0x5cd1a9,null))[_0x62da('0x4b')](handleError(_0x5cd1a9,null));};exports[_0x62da('0x50')]=function(_0x420697,_0x4bb439){return db[_0x62da('0x30')][_0x62da('0x50')]()[_0x62da('0x29')](respondWithResult(_0x4bb439,null))[_0x62da('0x4b')](handleError(_0x4bb439,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index f01f906..05f2bf7 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 _0x7a8a=['../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','moment','request-promise','rimraf'];(function(_0x3cac0d,_0x416c50){var _0x258c26=function(_0x282ebd){while(--_0x282ebd){_0x3cac0d['push'](_0x3cac0d['shift']());}};_0x258c26(++_0x416c50);}(_0x7a8a,0x173));var _0xa7a8=function(_0xca5f55,_0x44379f){_0xca5f55=_0xca5f55-0x0;var _0x278fc0=_0x7a8a[_0xca5f55];return _0x278fc0;};'use strict';var _=require(_0xa7a8('0x0'));var util=require(_0xa7a8('0x1'));var logger=require('../../config/logger')(_0xa7a8('0x2'));var moment=require(_0xa7a8('0x3'));var BPromise=require('bluebird');var rp=require(_0xa7a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa7a8('0x5'));var config=require(_0xa7a8('0x6'));var attributes=require(_0xa7a8('0x7'));module[_0xa7a8('0x8')]=function(_0x122c9d,_0x1c579d){return _0x122c9d[_0xa7a8('0x9')](_0xa7a8('0xa'),attributes,{'tableName':_0xa7a8('0xb'),'paranoid':![],'indexes':[{'name':_0xa7a8('0xc'),'fields':[_0xa7a8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb72=['uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','MailQueueReport'];(function(_0x56f43b,_0x12f74b){var _0x2a81de=function(_0x3e22c4){while(--_0x3e22c4){_0x56f43b['push'](_0x56f43b['shift']());}};_0x2a81de(++_0x12f74b);}(_0xfb72,0x1c3));var _0x2fb7=function(_0x33a48c,_0x4676f1){_0x33a48c=_0x33a48c-0x0;var _0x512897=_0xfb72[_0x33a48c];return _0x512897;};'use strict';var _=require(_0x2fb7('0x0'));var util=require('util');var logger=require(_0x2fb7('0x1'))(_0x2fb7('0x2'));var moment=require('moment');var BPromise=require(_0x2fb7('0x3'));var rp=require(_0x2fb7('0x4'));var fs=require('fs');var path=require(_0x2fb7('0x5'));var rimraf=require(_0x2fb7('0x6'));var config=require('../../config/environment');var attributes=require(_0x2fb7('0x7'));module['exports']=function(_0x5dc931,_0x2e0040){return _0x5dc931['define'](_0x2fb7('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x2fb7('0x9'),'fields':[_0x2fb7('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 78eb281..408f07b 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0xaf7de0,_0x1500f5){var _0x422e72=function(_0x585ce9){while(--_0x585ce9){_0xaf7de0['push'](_0xaf7de0['shift']());}};_0x422e72(++_0x1500f5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a07a6,_0x450fd0){_0x5a07a6=_0x5a07a6-0x0;var _0x5461bc=_0x5f2f[_0x5a07a6];return _0x5461bc;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x5c49f3,_0x11f89e){var _0x126d04=function(_0x246aa0){while(--_0x246aa0){_0x5c49f3['push'](_0x5c49f3['shift']());}};_0x126d04(++_0x11f89e);}(_0x7a54,0x106));var _0x47a5=function(_0x28657c,_0x75a22){_0x28657c=_0x28657c-0x0;var _0x33c171=_0x7a54[_0x28657c];return _0x33c171;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 6f0d24d..2dfd811 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1953fb,_0x1cfe46){var _0x1b0ebf=function(_0x1a9207){while(--_0x1a9207){_0x1953fb['push'](_0x1953fb['shift']());}};_0x1b0ebf(++_0x1cfe46);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4aa3da,_0x488de9){var _0x441072=function(_0x357dae){while(--_0x357dae){_0x4aa3da['push'](_0x4aa3da['shift']());}};_0x441072(++_0x488de9);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 64848e1..a328eb4 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 _0xcecc=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x1afa1,_0x2f3ac2){var _0x5cc6d3=function(_0xd37611){while(--_0xd37611){_0x1afa1['push'](_0x1afa1['shift']());}};_0x5cc6d3(++_0x2f3ac2);}(_0xcecc,0x186));var _0xccec=function(_0x4cef68,_0x4fe1e9){_0x4cef68=_0x4cef68-0x0;var _0x5de58e=_0xcecc[_0x4cef68];return _0x5de58e;};'use strict';var Sequelize=require(_0xccec('0x0'));module['exports']={'description':{'type':Sequelize[_0xccec('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xccec('0x1')]},'password':{'type':Sequelize[_0xccec('0x1')]},'port':{'type':Sequelize[_0xccec('0x2')]},'tls':{'type':Sequelize[_0xccec('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xccec('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xccec('0x1')]}}; \ No newline at end of file +var _0xb9be=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x3d5f84,_0x569548){var _0x1981b8=function(_0x3bf9f3){while(--_0x3bf9f3){_0x3d5f84['push'](_0x3d5f84['shift']());}};_0x1981b8(++_0x569548);}(_0xb9be,0xc5));var _0xeb9b=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xb9be[_0x485b5a];return _0xd2b34d;};'use strict';var Sequelize=require(_0xeb9b('0x0'));module[_0xeb9b('0x1')]={'description':{'type':Sequelize[_0xeb9b('0x2')]},'host':{'type':Sequelize[_0xeb9b('0x2')]},'authentication':{'type':Sequelize[_0xeb9b('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xeb9b('0x2')]},'password':{'type':Sequelize[_0xeb9b('0x2')]},'port':{'type':Sequelize[_0xeb9b('0x4')]},'tls':{'type':Sequelize[_0xeb9b('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xeb9b('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 6e5bf67..2d02485 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 _0x32d6=['./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x32d6,0x101));var _0x632d=function(_0x4fda31,_0x127a2a){_0x4fda31=_0x4fda31-0x0;var _0x49d7ec=_0x32d6[_0x4fda31];return _0x49d7ec;};'use strict';var _=require(_0x632d('0x0'));var util=require('util');var logger=require(_0x632d('0x1'))('api');var moment=require(_0x632d('0x2'));var BPromise=require(_0x632d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x632d('0x4'));var rimraf=require(_0x632d('0x5'));var config=require(_0x632d('0x6'));var attributes=require(_0x632d('0x7'));module[_0x632d('0x8')]=function(_0x1aae83,_0x4eba16){return _0x1aae83[_0x632d('0x9')](_0x632d('0xa'),attributes,{'tableName':_0x632d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb95a=['exports','define','MailServerIn','mail_servers_in','util','../../config/logger','moment','bluebird','path','../../config/environment','./mailServerIn.attributes'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb95a,0x9e));var _0xab95=function(_0x4b96c9,_0x399145){_0x4b96c9=_0x4b96c9-0x0;var _0x46dbf5=_0xb95a[_0x4b96c9];return _0x46dbf5;};'use strict';var _=require('lodash');var util=require(_0xab95('0x0'));var logger=require(_0xab95('0x1'))('api');var moment=require(_0xab95('0x2'));var BPromise=require(_0xab95('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab95('0x4'));var rimraf=require('rimraf');var config=require(_0xab95('0x5'));var attributes=require(_0xab95('0x6'));module[_0xab95('0x7')]=function(_0x73df38,_0x5cd426){return _0x73df38[_0xab95('0x8')](_0xab95('0x9'),attributes,{'tableName':_0xab95('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 7f6be79..4d7c8cc 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 _0x5959=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','limit','include','map','model','then','lodash','util','moment','randomstring'];(function(_0x5a3664,_0x2b7852){var _0x2b6b53=function(_0x5bae5c){while(--_0x5bae5c){_0x5a3664['push'](_0x5a3664['shift']());}};_0x2b6b53(++_0x2b7852);}(_0x5959,0x17c));var _0x9595=function(_0x26e89e,_0xacad9){_0x26e89e=_0x26e89e-0x0;var _0x5bf1d3=_0x5959[_0x26e89e];return _0x5bf1d3;};'use strict';var _=require(_0x9595('0x0'));var util=require(_0x9595('0x1'));var moment=require(_0x9595('0x2'));var BPromise=require('bluebird');var rs=require(_0x9595('0x3'));var fs=require('fs');var Redis=require(_0x9595('0x4'));var db=require(_0x9595('0x5'))['db'];var utils=require(_0x9595('0x6'));var logger=require(_0x9595('0x7'))(_0x9595('0x8'));var config=require(_0x9595('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9595('0xa')][_0x9595('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c92e4,_0x2b14cc,_0x2ec6a5){return new BPromise(function(_0x24cbea,_0x4a1a6f){return client['request'](_0x5c92e4,_0x2ec6a5)['then'](function(_0x4abda4){logger[_0x9595('0xc')](_0x9595('0xd'),_0x2b14cc,_0x9595('0xe'));logger[_0x9595('0xf')](_0x9595('0x10'),_0x2b14cc,_0x9595('0xe'),JSON[_0x9595('0x11')](_0x4abda4));if(_0x4abda4[_0x9595('0x12')]){if(_0x4abda4[_0x9595('0x12')][_0x9595('0x13')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x2b14cc,_0x4abda4['error'][_0x9595('0x14')]);return _0x4a1a6f(_0x4abda4[_0x9595('0x12')][_0x9595('0x14')]);}logger['error'](_0x9595('0xd'),_0x2b14cc,_0x4abda4[_0x9595('0x12')][_0x9595('0x14')]);return _0x24cbea(_0x4abda4[_0x9595('0x12')]['message']);}else{logger[_0x9595('0xc')]('MailServerIn,\x20%s,\x20%s',_0x2b14cc,_0x9595('0xe'));_0x24cbea(_0x4abda4['result']['message']);}})[_0x9595('0x15')](function(_0x32c655){logger[_0x9595('0x12')](_0x9595('0xd'),_0x2b14cc,_0x32c655);_0x4a1a6f(_0x32c655);});});}exports[_0x9595('0x16')]=function(_0x1d6e8a){var _0x19b0ea=this;return new Promise(function(_0x5db1a5,_0x2d204a){return db[_0x9595('0x17')][_0x9595('0x18')]({'raw':_0x1d6e8a[_0x9595('0x19')]?_0x1d6e8a[_0x9595('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1d6e8a[_0x9595('0x19')]?_0x1d6e8a[_0x9595('0x19')]['where']||null:null,'attributes':_0x1d6e8a[_0x9595('0x19')]?_0x1d6e8a[_0x9595('0x19')][_0x9595('0x1a')]||null:null,'limit':_0x1d6e8a[_0x9595('0x19')]?_0x1d6e8a['options'][_0x9595('0x1b')]||null:null,'include':_0x1d6e8a[_0x9595('0x19')]?_0x1d6e8a[_0x9595('0x19')][_0x9595('0x1c')]?_[_0x9595('0x1d')](_0x1d6e8a[_0x9595('0x19')][_0x9595('0x1c')],function(_0x543c85){return{'model':db[_0x543c85[_0x9595('0x1e')]],'as':_0x543c85['as'],'attributes':_0x543c85[_0x9595('0x1a')],'include':_0x543c85[_0x9595('0x1c')]?_[_0x9595('0x1d')](_0x543c85['include'],function(_0x5ac206){return{'model':db[_0x5ac206['model']],'as':_0x5ac206['as'],'attributes':_0x5ac206[_0x9595('0x1a')],'include':_0x5ac206['include']?_[_0x9595('0x1d')](_0x5ac206[_0x9595('0x1c')],function(_0x1d4f0b){return{'model':db[_0x1d4f0b[_0x9595('0x1e')]],'as':_0x1d4f0b['as'],'attributes':_0x1d4f0b[_0x9595('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9595('0x1f')](function(_0x2b3ee2){logger['info'](_0x9595('0x16'),_0x1d6e8a);logger[_0x9595('0xf')]('GetMailServerIn',_0x1d6e8a,JSON[_0x9595('0x11')](_0x2b3ee2));_0x5db1a5(_0x2b3ee2);})[_0x9595('0x15')](function(_0x1da52a){logger[_0x9595('0x12')](_0x9595('0x16'),_0x1da52a['message'],_0x1d6e8a);_0x2d204a(_0x19b0ea['error'](0x1f4,_0x1da52a[_0x9595('0x14')]));});});}; \ No newline at end of file +var _0xd770=['http','request','then','info','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','result','MailServerIn','findAll','options','raw','limit','include','map','attributes','model','GetMailServerIn','debug','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0xd770,0x1e5));var _0x0d77=function(_0x430713,_0x1d0766){_0x430713=_0x430713-0x0;var _0x3badf3=_0xd770[_0x430713];return _0x3badf3;};'use strict';var _=require('lodash');var util=require(_0x0d77('0x0'));var moment=require(_0x0d77('0x1'));var BPromise=require(_0x0d77('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d77('0x3'));var db=require(_0x0d77('0x4'))['db'];var utils=require(_0x0d77('0x5'));var logger=require(_0x0d77('0x6'))(_0x0d77('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d77('0x8'));var client=jayson[_0x0d77('0x9')][_0x0d77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x556b15,_0x4ad970,_0x18bb0d){return new BPromise(function(_0x3cede5,_0x60076b){return client[_0x0d77('0xb')](_0x556b15,_0x18bb0d)[_0x0d77('0xc')](function(_0x26668d){logger[_0x0d77('0xd')]('MailServerIn,\x20%s,\x20%s',_0x4ad970,_0x0d77('0xe'));logger['debug'](_0x0d77('0xf'),_0x4ad970,'request\x20sent',JSON[_0x0d77('0x10')](_0x26668d));if(_0x26668d['error']){if(_0x26668d[_0x0d77('0x11')]['code']===0x1f4){logger[_0x0d77('0x11')](_0x0d77('0x12'),_0x4ad970,_0x26668d[_0x0d77('0x11')][_0x0d77('0x13')]);return _0x60076b(_0x26668d[_0x0d77('0x11')][_0x0d77('0x13')]);}logger[_0x0d77('0x11')](_0x0d77('0x12'),_0x4ad970,_0x26668d[_0x0d77('0x11')][_0x0d77('0x13')]);return _0x3cede5(_0x26668d['error']['message']);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x4ad970,_0x0d77('0xe'));_0x3cede5(_0x26668d[_0x0d77('0x14')][_0x0d77('0x13')]);}})['catch'](function(_0x1daff4){logger[_0x0d77('0x11')](_0x0d77('0x12'),_0x4ad970,_0x1daff4);_0x60076b(_0x1daff4);});});}exports['GetMailServerIn']=function(_0x380282){var _0x12d0f9=this;return new Promise(function(_0x3f12ab,_0x2e0290){return db[_0x0d77('0x15')][_0x0d77('0x16')]({'raw':_0x380282[_0x0d77('0x17')]?_0x380282['options'][_0x0d77('0x18')]===undefined?!![]:![]:!![],'where':_0x380282[_0x0d77('0x17')]?_0x380282[_0x0d77('0x17')]['where']||null:null,'attributes':_0x380282[_0x0d77('0x17')]?_0x380282['options']['attributes']||null:null,'limit':_0x380282['options']?_0x380282['options'][_0x0d77('0x19')]||null:null,'include':_0x380282['options']?_0x380282[_0x0d77('0x17')][_0x0d77('0x1a')]?_[_0x0d77('0x1b')](_0x380282['options'][_0x0d77('0x1a')],function(_0x3b875a){return{'model':db[_0x3b875a['model']],'as':_0x3b875a['as'],'attributes':_0x3b875a[_0x0d77('0x1c')],'include':_0x3b875a['include']?_['map'](_0x3b875a[_0x0d77('0x1a')],function(_0x1a46ba){return{'model':db[_0x1a46ba[_0x0d77('0x1d')]],'as':_0x1a46ba['as'],'attributes':_0x1a46ba[_0x0d77('0x1c')],'include':_0x1a46ba['include']?_[_0x0d77('0x1b')](_0x1a46ba['include'],function(_0x5beb7e){return{'model':db[_0x5beb7e['model']],'as':_0x5beb7e['as'],'attributes':_0x5beb7e[_0x0d77('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37d4d8){logger[_0x0d77('0xd')](_0x0d77('0x1e'),_0x380282);logger[_0x0d77('0x1f')](_0x0d77('0x1e'),_0x380282,JSON[_0x0d77('0x10')](_0x37d4d8));_0x3f12ab(_0x37d4d8);})[_0x0d77('0x20')](function(_0x27b508){logger[_0x0d77('0x11')](_0x0d77('0x1e'),_0x27b508[_0x0d77('0x13')],_0x380282);_0x2e0290(_0x12d0f9[_0x0d77('0x11')](0x1f4,_0x27b508[_0x0d77('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 44eb67f..1093cdf 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(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +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(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x7a54,0x106));var _0x47a5=function(_0x294e68,_0x33c5ab){_0x294e68=_0x294e68-0x0;var _0xccddfd=_0x7a54[_0x294e68];return _0xccddfd;};'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 87cc2a8..498687e 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 _0xd11c=['sequelize','exports','STRING','INTEGER'];(function(_0x1a2f3c,_0x2e6251){var _0x3cf63b=function(_0x3bf94b){while(--_0x3bf94b){_0x1a2f3c['push'](_0x1a2f3c['shift']());}};_0x3cf63b(++_0x2e6251);}(_0xd11c,0x64));var _0xcd11=function(_0x5909a7,_0xc90814){_0x5909a7=_0x5909a7-0x0;var _0x18c67f=_0xd11c[_0x5909a7];return _0x18c67f;};'use strict';var Sequelize=require(_0xcd11('0x0'));module[_0xcd11('0x1')]={'description':{'type':Sequelize[_0xcd11('0x2')]},'host':{'type':Sequelize[_0xcd11('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xcd11('0x2')]},'port':{'type':Sequelize[_0xcd11('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xcd11('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x71b3=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x71b3,0x137));var _0x371b=function(_0x317ed1,_0x281708){_0x317ed1=_0x317ed1-0x0;var _0x3b81a4=_0x71b3[_0x317ed1];return _0x3b81a4;};'use strict';var Sequelize=require(_0x371b('0x0'));module['exports']={'description':{'type':Sequelize[_0x371b('0x1')]},'host':{'type':Sequelize[_0x371b('0x1')]},'user':{'type':Sequelize[_0x371b('0x1')]},'pass':{'type':Sequelize[_0x371b('0x1')]},'port':{'type':Sequelize[_0x371b('0x2')]},'secure':{'type':Sequelize[_0x371b('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x371b('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 3168392..5dd0d02 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 _0x9903=['destroy','stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','include','catch','show','params','length','includeAll','options','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then'];(function(_0x2013d1,_0x4e2986){var _0x3147c6=function(_0x36ef7f){while(--_0x36ef7f){_0x2013d1['push'](_0x2013d1['shift']());}};_0x3147c6(++_0x4e2986);}(_0x9903,0x1c8));var _0x3990=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9903[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3990('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3990('0x1'));var jsonpatch=require(_0x3990('0x2'));var rp=require(_0x3990('0x3'));var moment=require('moment');var BPromise=require(_0x3990('0x4'));var Mustache=require(_0x3990('0x5'));var util=require('util');var path=require(_0x3990('0x6'));var sox=require('sox');var csv=require(_0x3990('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3990('0x8'));var _=require('lodash');var squel=require(_0x3990('0x9'));var crypto=require(_0x3990('0xa'));var jsforce=require(_0x3990('0xb'));var deskjs=require(_0x3990('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3990('0xd'));var Papa=require(_0x3990('0xe'));var Redis=require(_0x3990('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3990('0x10'));var as=require(_0x3990('0x11'));var hardwareService=require(_0x3990('0x12'));var logger=require('../../config/logger')(_0x3990('0x13'));var utils=require(_0x3990('0x14'));var config=require(_0x3990('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x467c71,_0x7cc417){_0x7cc417=_0x7cc417||0xcc;return function(_0x1787f3){if(_0x1787f3){return _0x467c71[_0x3990('0x16')](_0x7cc417);}return _0x467c71[_0x3990('0x17')](_0x7cc417)[_0x3990('0x18')]();};}function respondWithResult(_0x5ea64f,_0x4fd8bb){_0x4fd8bb=_0x4fd8bb||0xc8;return function(_0x3a1753){if(_0x3a1753){return _0x5ea64f[_0x3990('0x17')](_0x4fd8bb)[_0x3990('0x19')](_0x3a1753);}};}function respondWithFilteredResult(_0x1425cf,_0x449299){return function(_0x37eb8c){if(_0x37eb8c){var _0x452bc7=typeof _0x449299[_0x3990('0x1a')]===_0x3990('0x1b')&&typeof _0x449299[_0x3990('0x1c')]===_0x3990('0x1b');var _0x433abf=_0x37eb8c[_0x3990('0x1d')];var _0x2c4b7d=_0x452bc7?0x0:_0x449299[_0x3990('0x1a')];var _0x22189b=_0x452bc7?_0x37eb8c['count']:_0x449299[_0x3990('0x1a')]+_0x449299[_0x3990('0x1c')];var _0x17ef52;if(_0x22189b>=_0x433abf){_0x22189b=_0x433abf;_0x17ef52=0xc8;}else{_0x17ef52=0xce;}_0x1425cf[_0x3990('0x17')](_0x17ef52);return _0x1425cf['set'](_0x3990('0x1e'),_0x2c4b7d+'-'+_0x22189b+'/'+_0x433abf)['json'](_0x37eb8c);}return null;};}function patchUpdates(_0x4bb694){return function(_0x52d2f1){try{jsonpatch[_0x3990('0x1f')](_0x52d2f1,_0x4bb694,!![]);}catch(_0x5e0226){return BPromise['reject'](_0x5e0226);}return _0x52d2f1[_0x3990('0x20')]();};}function saveUpdates(_0x24acea,_0x422e14){return function(_0x43f54b){if(_0x43f54b){return _0x43f54b['update'](_0x24acea)[_0x3990('0x21')](function(_0x402719){return _0x402719;});}return null;};}function removeEntity(_0x2050a7,_0x190f53){return function(_0x422f9b){if(_0x422f9b){return _0x422f9b[_0x3990('0x22')]()['then'](function(){_0x2050a7[_0x3990('0x17')](0xcc)[_0x3990('0x18')]();});}};}function handleEntityNotFound(_0x993951,_0x5e2b20){return function(_0x48a3f4){if(!_0x48a3f4){_0x993951[_0x3990('0x16')](0x194);}return _0x48a3f4;};}function handleError(_0xbc3fd2,_0x440278){_0x440278=_0x440278||0x1f4;return function(_0x234e31){logger['error'](_0x234e31[_0x3990('0x23')]);if(_0x234e31[_0x3990('0x24')]){delete _0x234e31['name'];}_0xbc3fd2[_0x3990('0x17')](_0x440278)['send'](_0x234e31);};}exports[_0x3990('0x25')]=function(_0x525018,_0x3381d9){var _0x2a800d={},_0x4f0d4d={},_0x2d48db={'count':0x0,'rows':[]};var _0x326682=_[_0x3990('0x26')](db[_0x3990('0x27')][_0x3990('0x28')],function(_0x26be90){return{'name':_0x26be90[_0x3990('0x29')],'type':_0x26be90[_0x3990('0x2a')]['key']};});_0x4f0d4d[_0x3990('0x2b')]=_['map'](_0x326682,_0x3990('0x24'));_0x4f0d4d['query']=_[_0x3990('0x2c')](_0x525018[_0x3990('0x2d')]);_0x4f0d4d['filters']=_[_0x3990('0x2e')](_0x4f0d4d['model'],_0x4f0d4d[_0x3990('0x2d')]);_0x2a800d[_0x3990('0x2f')]=_[_0x3990('0x2e')](_0x4f0d4d[_0x3990('0x2b')],qs[_0x3990('0x30')](_0x525018[_0x3990('0x2d')][_0x3990('0x30')]));_0x2a800d[_0x3990('0x2f')]=_0x2a800d[_0x3990('0x2f')]['length']?_0x2a800d[_0x3990('0x2f')]:_0x4f0d4d[_0x3990('0x2b')];if(!_0x525018[_0x3990('0x2d')][_0x3990('0x31')](_0x3990('0x32'))){_0x2a800d[_0x3990('0x1c')]=qs[_0x3990('0x1c')](_0x525018['query'][_0x3990('0x1c')]);_0x2a800d['offset']=qs[_0x3990('0x1a')](_0x525018['query'][_0x3990('0x1a')]);}_0x2a800d[_0x3990('0x33')]=qs['sort'](_0x525018[_0x3990('0x2d')][_0x3990('0x34')]);_0x2a800d['where']=qs['filters'](_[_0x3990('0x35')](_0x525018['query'],_0x4f0d4d[_0x3990('0x36')]),_0x326682);if(_0x525018[_0x3990('0x2d')][_0x3990('0x37')]){_0x2a800d[_0x3990('0x38')]=_[_0x3990('0x39')](_0x2a800d[_0x3990('0x38')],{'$or':_[_0x3990('0x26')](_0x326682,function(_0x10ca75){if(_0x10ca75[_0x3990('0x2a')]!==_0x3990('0x3a')){var _0x1061ed={};_0x1061ed[_0x10ca75[_0x3990('0x24')]]={'$like':'%'+_0x525018[_0x3990('0x2d')][_0x3990('0x37')]+'%'};return _0x1061ed;}})});}_0x2a800d=_[_0x3990('0x39')]({},_0x2a800d,_0x525018['options']);var _0x60b7e9={'where':_0x2a800d['where']};return db[_0x3990('0x27')][_0x3990('0x1d')](_0x60b7e9)[_0x3990('0x21')](function(_0x3b2c28){_0x2d48db['count']=_0x3b2c28;if(_0x525018[_0x3990('0x2d')]['includeAll']){_0x2a800d[_0x3990('0x3b')]=[{'all':!![]}];}return db[_0x3990('0x27')]['findAll'](_0x2a800d);})[_0x3990('0x21')](function(_0x6f6e0b){_0x2d48db['rows']=_0x6f6e0b;return _0x2d48db;})[_0x3990('0x21')](respondWithFilteredResult(_0x3381d9,_0x2a800d))[_0x3990('0x3c')](handleError(_0x3381d9,null));};exports[_0x3990('0x3d')]=function(_0x1755a0,_0x9e4ded){var _0x4442e6={'raw':!![],'where':{'id':_0x1755a0[_0x3990('0x3e')]['id']}},_0x531844={};_0x531844[_0x3990('0x2b')]=_[_0x3990('0x2c')](db[_0x3990('0x27')]['rawAttributes']);_0x531844[_0x3990('0x2d')]=_[_0x3990('0x2c')](_0x1755a0[_0x3990('0x2d')]);_0x531844[_0x3990('0x36')]=_['intersection'](_0x531844[_0x3990('0x2b')],_0x531844[_0x3990('0x2d')]);_0x4442e6[_0x3990('0x2f')]=_[_0x3990('0x2e')](_0x531844['model'],qs['fields'](_0x1755a0['query']['fields']));_0x4442e6[_0x3990('0x2f')]=_0x4442e6[_0x3990('0x2f')][_0x3990('0x3f')]?_0x4442e6[_0x3990('0x2f')]:_0x531844[_0x3990('0x2b')];if(_0x1755a0['query'][_0x3990('0x40')]){_0x4442e6['include']=[{'all':!![]}];}_0x4442e6=_[_0x3990('0x39')]({},_0x4442e6,_0x1755a0[_0x3990('0x41')]);return db[_0x3990('0x27')][_0x3990('0x42')](_0x4442e6)[_0x3990('0x21')](handleEntityNotFound(_0x9e4ded,null))[_0x3990('0x21')](respondWithResult(_0x9e4ded,null))[_0x3990('0x3c')](handleError(_0x9e4ded,null));};exports[_0x3990('0x43')]=function(_0x2a3696,_0x57a016){return db[_0x3990('0x27')][_0x3990('0x43')](_0x2a3696[_0x3990('0x44')],{})[_0x3990('0x21')](respondWithResult(_0x57a016,0xc9))[_0x3990('0x3c')](handleError(_0x57a016,null));};exports[_0x3990('0x45')]=function(_0xa94845,_0x5135da){if(_0xa94845[_0x3990('0x44')]['id']){delete _0xa94845[_0x3990('0x44')]['id'];}return db[_0x3990('0x27')]['find']({'where':{'id':_0xa94845['params']['id']}})[_0x3990('0x21')](handleEntityNotFound(_0x5135da,null))[_0x3990('0x21')](saveUpdates(_0xa94845[_0x3990('0x44')],null))['then'](respondWithResult(_0x5135da,null))[_0x3990('0x3c')](handleError(_0x5135da,null));};exports[_0x3990('0x22')]=function(_0x4db22b,_0x304fc3){return db[_0x3990('0x27')][_0x3990('0x42')]({'where':{'id':_0x4db22b[_0x3990('0x3e')]['id']}})[_0x3990('0x21')](handleEntityNotFound(_0x304fc3,null))['then'](removeEntity(_0x304fc3,null))[_0x3990('0x3c')](handleError(_0x304fc3,null));}; \ No newline at end of file +var _0xa805=['../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','MailServerOut','fieldName','key','model','query','keys','filters','fields','attributes','length','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','intersection','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x57a258,_0x36a175){var _0x2f68ec=function(_0x33a86d){while(--_0x33a86d){_0x57a258['push'](_0x57a258['shift']());}};_0x2f68ec(++_0x36a175);}(_0xa805,0x199));var _0x5a80=function(_0x1f9d7b,_0x2f88b1){_0x1f9d7b=_0x1f9d7b-0x0;var _0x38d49b=_0xa805[_0x1f9d7b];return _0x38d49b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a80('0x0'));var zipdir=require(_0x5a80('0x1'));var jsonpatch=require(_0x5a80('0x2'));var rp=require(_0x5a80('0x3'));var moment=require(_0x5a80('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5a80('0x5'));var util=require('util');var path=require(_0x5a80('0x6'));var sox=require(_0x5a80('0x7'));var csv=require(_0x5a80('0x8'));var ejs=require(_0x5a80('0x9'));var fs=require('fs');var fs_extra=require(_0x5a80('0xa'));var _=require(_0x5a80('0xb'));var squel=require(_0x5a80('0xc'));var crypto=require(_0x5a80('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5a80('0x8'));var querystring=require('querystring');var Papa=require(_0x5a80('0xe'));var Redis=require(_0x5a80('0xf'));var authService=require(_0x5a80('0x10'));var qs=require(_0x5a80('0x11'));var as=require(_0x5a80('0x12'));var hardwareService=require(_0x5a80('0x13'));var logger=require(_0x5a80('0x14'))(_0x5a80('0x15'));var utils=require(_0x5a80('0x16'));var config=require(_0x5a80('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a80('0x18'))['db'];function respondWithStatusCode(_0x31abf5,_0x570cea){_0x570cea=_0x570cea||0xcc;return function(_0x30b9da){if(_0x30b9da){return _0x31abf5[_0x5a80('0x19')](_0x570cea);}return _0x31abf5['status'](_0x570cea)['end']();};}function respondWithResult(_0x1f3d14,_0x21883c){_0x21883c=_0x21883c||0xc8;return function(_0x494cf5){if(_0x494cf5){return _0x1f3d14[_0x5a80('0x1a')](_0x21883c)[_0x5a80('0x1b')](_0x494cf5);}};}function respondWithFilteredResult(_0x4a289b,_0x2a89eb){return function(_0x24379c){if(_0x24379c){var _0x54e057=typeof _0x2a89eb['offset']===_0x5a80('0x1c')&&typeof _0x2a89eb[_0x5a80('0x1d')]===_0x5a80('0x1c');var _0x5ea364=_0x24379c[_0x5a80('0x1e')];var _0x936e4a=_0x54e057?0x0:_0x2a89eb[_0x5a80('0x1f')];var _0x529e75=_0x54e057?_0x24379c[_0x5a80('0x1e')]:_0x2a89eb[_0x5a80('0x1f')]+_0x2a89eb[_0x5a80('0x1d')];var _0x157424;if(_0x529e75>=_0x5ea364){_0x529e75=_0x5ea364;_0x157424=0xc8;}else{_0x157424=0xce;}_0x4a289b['status'](_0x157424);return _0x4a289b[_0x5a80('0x20')](_0x5a80('0x21'),_0x936e4a+'-'+_0x529e75+'/'+_0x5ea364)['json'](_0x24379c);}return null;};}function patchUpdates(_0x205936){return function(_0x32a935){try{jsonpatch[_0x5a80('0x22')](_0x32a935,_0x205936,!![]);}catch(_0x3b580d){return BPromise[_0x5a80('0x23')](_0x3b580d);}return _0x32a935['save']();};}function saveUpdates(_0x8e490,_0x5c9caa){return function(_0x5ed3f2){if(_0x5ed3f2){return _0x5ed3f2[_0x5a80('0x24')](_0x8e490)[_0x5a80('0x25')](function(_0x4ee6ce){return _0x4ee6ce;});}return null;};}function removeEntity(_0xad1792,_0x57826a){return function(_0x300860){if(_0x300860){return _0x300860[_0x5a80('0x26')]()[_0x5a80('0x25')](function(){_0xad1792[_0x5a80('0x1a')](0xcc)[_0x5a80('0x27')]();});}};}function handleEntityNotFound(_0x137d1a,_0x473beb){return function(_0x54f24a){if(!_0x54f24a){_0x137d1a[_0x5a80('0x19')](0x194);}return _0x54f24a;};}function handleError(_0x316fca,_0x7d341d){_0x7d341d=_0x7d341d||0x1f4;return function(_0x293265){logger[_0x5a80('0x28')](_0x293265[_0x5a80('0x29')]);if(_0x293265['name']){delete _0x293265[_0x5a80('0x2a')];}_0x316fca['status'](_0x7d341d)['send'](_0x293265);};}exports[_0x5a80('0x2b')]=function(_0x2aaeb0,_0x321b49){var _0x3daf66={},_0x57c554={},_0xbebe28={'count':0x0,'rows':[]};var _0x5cd902=_['map'](db[_0x5a80('0x2c')]['rawAttributes'],function(_0x3da80e){return{'name':_0x3da80e[_0x5a80('0x2d')],'type':_0x3da80e['type'][_0x5a80('0x2e')]};});_0x57c554[_0x5a80('0x2f')]=_['map'](_0x5cd902,_0x5a80('0x2a'));_0x57c554[_0x5a80('0x30')]=_[_0x5a80('0x31')](_0x2aaeb0[_0x5a80('0x30')]);_0x57c554[_0x5a80('0x32')]=_['intersection'](_0x57c554[_0x5a80('0x2f')],_0x57c554[_0x5a80('0x30')]);_0x3daf66['attributes']=_['intersection'](_0x57c554['model'],qs[_0x5a80('0x33')](_0x2aaeb0['query'][_0x5a80('0x33')]));_0x3daf66['attributes']=_0x3daf66[_0x5a80('0x34')][_0x5a80('0x35')]?_0x3daf66[_0x5a80('0x34')]:_0x57c554[_0x5a80('0x2f')];if(!_0x2aaeb0[_0x5a80('0x30')]['hasOwnProperty']('nolimit')){_0x3daf66[_0x5a80('0x1d')]=qs[_0x5a80('0x1d')](_0x2aaeb0[_0x5a80('0x30')][_0x5a80('0x1d')]);_0x3daf66['offset']=qs[_0x5a80('0x1f')](_0x2aaeb0[_0x5a80('0x30')][_0x5a80('0x1f')]);}_0x3daf66['order']=qs['sort'](_0x2aaeb0[_0x5a80('0x30')]['sort']);_0x3daf66[_0x5a80('0x36')]=qs[_0x5a80('0x32')](_[_0x5a80('0x37')](_0x2aaeb0[_0x5a80('0x30')],_0x57c554['filters']),_0x5cd902);if(_0x2aaeb0['query'][_0x5a80('0x38')]){_0x3daf66[_0x5a80('0x36')]=_[_0x5a80('0x39')](_0x3daf66[_0x5a80('0x36')],{'$or':_[_0x5a80('0x3a')](_0x5cd902,function(_0x1612db){if(_0x1612db[_0x5a80('0x3b')]!==_0x5a80('0x3c')){var _0x511834={};_0x511834[_0x1612db['name']]={'$like':'%'+_0x2aaeb0[_0x5a80('0x30')][_0x5a80('0x38')]+'%'};return _0x511834;}})});}_0x3daf66=_['merge']({},_0x3daf66,_0x2aaeb0[_0x5a80('0x3d')]);var _0x16d1ad={'where':_0x3daf66['where']};return db[_0x5a80('0x2c')][_0x5a80('0x1e')](_0x16d1ad)[_0x5a80('0x25')](function(_0x1d7a10){_0xbebe28[_0x5a80('0x1e')]=_0x1d7a10;if(_0x2aaeb0[_0x5a80('0x30')][_0x5a80('0x3e')]){_0x3daf66[_0x5a80('0x3f')]=[{'all':!![]}];}return db[_0x5a80('0x2c')][_0x5a80('0x40')](_0x3daf66);})[_0x5a80('0x25')](function(_0x16b0ab){_0xbebe28['rows']=_0x16b0ab;return _0xbebe28;})[_0x5a80('0x25')](respondWithFilteredResult(_0x321b49,_0x3daf66))[_0x5a80('0x41')](handleError(_0x321b49,null));};exports['show']=function(_0x2d6936,_0x4df4fd){var _0x658cc2={'raw':!![],'where':{'id':_0x2d6936[_0x5a80('0x42')]['id']}},_0xd394fc={};_0xd394fc['model']=_[_0x5a80('0x31')](db['MailServerOut'][_0x5a80('0x43')]);_0xd394fc['query']=_[_0x5a80('0x31')](_0x2d6936['query']);_0xd394fc['filters']=_['intersection'](_0xd394fc['model'],_0xd394fc[_0x5a80('0x30')]);_0x658cc2[_0x5a80('0x34')]=_[_0x5a80('0x44')](_0xd394fc['model'],qs[_0x5a80('0x33')](_0x2d6936['query'][_0x5a80('0x33')]));_0x658cc2[_0x5a80('0x34')]=_0x658cc2[_0x5a80('0x34')][_0x5a80('0x35')]?_0x658cc2[_0x5a80('0x34')]:_0xd394fc[_0x5a80('0x2f')];if(_0x2d6936[_0x5a80('0x30')]['includeAll']){_0x658cc2[_0x5a80('0x3f')]=[{'all':!![]}];}_0x658cc2=_[_0x5a80('0x39')]({},_0x658cc2,_0x2d6936['options']);return db[_0x5a80('0x2c')][_0x5a80('0x45')](_0x658cc2)['then'](handleEntityNotFound(_0x4df4fd,null))[_0x5a80('0x25')](respondWithResult(_0x4df4fd,null))['catch'](handleError(_0x4df4fd,null));};exports['create']=function(_0x40f032,_0x36be9d){return db['MailServerOut'][_0x5a80('0x46')](_0x40f032[_0x5a80('0x47')],{})[_0x5a80('0x25')](respondWithResult(_0x36be9d,0xc9))['catch'](handleError(_0x36be9d,null));};exports['update']=function(_0x3d60c2,_0x2f06a5){if(_0x3d60c2[_0x5a80('0x47')]['id']){delete _0x3d60c2[_0x5a80('0x47')]['id'];}return db[_0x5a80('0x2c')]['find']({'where':{'id':_0x3d60c2['params']['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x2f06a5,null))[_0x5a80('0x25')](saveUpdates(_0x3d60c2[_0x5a80('0x47')],null))[_0x5a80('0x25')](respondWithResult(_0x2f06a5,null))[_0x5a80('0x41')](handleError(_0x2f06a5,null));};exports[_0x5a80('0x26')]=function(_0x5d4530,_0x361ea3){return db[_0x5a80('0x2c')]['find']({'where':{'id':_0x5d4530['params']['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x361ea3,null))[_0x5a80('0x25')](removeEntity(_0x361ea3,null))['catch'](handleError(_0x361ea3,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 6b6e842..c1fb073 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 _0xb143=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x2d1aa6,_0x263e57){var _0x3f5529=function(_0x4fe588){while(--_0x4fe588){_0x2d1aa6['push'](_0x2d1aa6['shift']());}};_0x3f5529(++_0x263e57);}(_0xb143,0x1d4));var _0x3b14=function(_0x226c96,_0x4ca425){_0x226c96=_0x226c96-0x0;var _0x531e12=_0xb143[_0x226c96];return _0x531e12;};'use strict';var _=require(_0x3b14('0x0'));var util=require(_0x3b14('0x1'));var logger=require(_0x3b14('0x2'))(_0x3b14('0x3'));var moment=require(_0x3b14('0x4'));var BPromise=require(_0x3b14('0x5'));var rp=require(_0x3b14('0x6'));var fs=require('fs');var path=require(_0x3b14('0x7'));var rimraf=require(_0x3b14('0x8'));var config=require(_0x3b14('0x9'));var attributes=require('./mailServerOut.attributes');module[_0x3b14('0xa')]=function(_0x2fb6db,_0xc7d9f0){return _0x2fb6db[_0x3b14('0xb')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16ce=['../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x1ae3ec,_0x141e75){var _0x53cd42=function(_0x306bb0){while(--_0x306bb0){_0x1ae3ec['push'](_0x1ae3ec['shift']());}};_0x53cd42(++_0x141e75);}(_0x16ce,0x1e6));var _0xe16c=function(_0x459aae,_0x2d66f9){_0x459aae=_0x459aae-0x0;var _0x3fd1c0=_0x16ce[_0x459aae];return _0x3fd1c0;};'use strict';var _=require(_0xe16c('0x0'));var util=require('util');var logger=require(_0xe16c('0x1'))(_0xe16c('0x2'));var moment=require(_0xe16c('0x3'));var BPromise=require('bluebird');var rp=require(_0xe16c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe16c('0x5'));var config=require(_0xe16c('0x6'));var attributes=require(_0xe16c('0x7'));module[_0xe16c('0x8')]=function(_0x1cc3c2,_0x208c27){return _0x1cc3c2[_0xe16c('0x9')](_0xe16c('0xa'),attributes,{'tableName':_0xe16c('0xb'),'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 c5efaf9..bcecff8 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x121985,_0x252db3){var _0x20bc79=function(_0x30889b){while(--_0x30889b){_0x121985['push'](_0x121985['shift']());}};_0x20bc79(++_0x252db3);}(_0x2ef3,0xba));var _0x32ef=function(_0x5bcba5,_0x2e1e96){_0x5bcba5=_0x5bcba5-0x0;var _0x2ae341=_0x2ef3[_0x5bcba5];return _0x2ae341;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x265d98,_0x217bed){_0x265d98=_0x265d98-0x0;var _0x186554=_0x7a54[_0x265d98];return _0x186554;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 3daba20..e355971 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 _0x25c9=['index','/describe','describe','post','create','/:id','update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated'];(function(_0x3e3349,_0x23926b){var _0x17ba93=function(_0x1382c5){while(--_0x1382c5){_0x3e3349['push'](_0x3e3349['shift']());}};_0x17ba93(++_0x23926b);}(_0x25c9,0x112));var _0x925c=function(_0x2ebc40,_0x40fd5e){_0x2ebc40=_0x2ebc40-0x0;var _0x36421e=_0x25c9[_0x2ebc40];return _0x36421e;};'use strict';var multer=require(_0x925c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x925c('0x1'));var express=require(_0x925c('0x2'));var router=express[_0x925c('0x3')]();var fs_extra=require(_0x925c('0x4'));var auth=require(_0x925c('0x5'));var interaction=require(_0x925c('0x6'));var config=require(_0x925c('0x7'));var controller=require(_0x925c('0x8'));router[_0x925c('0x9')]('/',auth[_0x925c('0xa')](),controller[_0x925c('0xb')]);router[_0x925c('0x9')](_0x925c('0xc'),auth[_0x925c('0xa')](),controller[_0x925c('0xd')]);router[_0x925c('0x9')]('/:id',auth[_0x925c('0xa')](),controller['show']);router[_0x925c('0xe')]('/',auth[_0x925c('0xa')](),controller[_0x925c('0xf')]);router['put'](_0x925c('0x10'),auth[_0x925c('0xa')](),controller[_0x925c('0x11')]);router['delete'](_0x925c('0x10'),auth[_0x925c('0xa')](),controller[_0x925c('0x12')]);module['exports']=router; \ No newline at end of file +var _0xec23=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x874f24,_0xe8f155){var _0x451bd1=function(_0x2ab6a1){while(--_0x2ab6a1){_0x874f24['push'](_0x874f24['shift']());}};_0x451bd1(++_0xe8f155);}(_0xec23,0xd0));var _0x3ec2=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0xec23[_0x4c4042];return _0xbd10dc;};'use strict';var multer=require(_0x3ec2('0x0'));var util=require(_0x3ec2('0x1'));var path=require(_0x3ec2('0x2'));var timeout=require(_0x3ec2('0x3'));var express=require(_0x3ec2('0x4'));var router=express[_0x3ec2('0x5')]();var fs_extra=require(_0x3ec2('0x6'));var auth=require(_0x3ec2('0x7'));var interaction=require(_0x3ec2('0x8'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x3ec2('0x9')]('/',auth[_0x3ec2('0xa')](),controller[_0x3ec2('0xb')]);router[_0x3ec2('0x9')](_0x3ec2('0xc'),auth['isAuthenticated'](),controller[_0x3ec2('0xd')]);router[_0x3ec2('0x9')](_0x3ec2('0xe'),auth[_0x3ec2('0xa')](),controller[_0x3ec2('0xf')]);router[_0x3ec2('0x10')]('/',auth['isAuthenticated'](),controller[_0x3ec2('0x11')]);router[_0x3ec2('0x12')](_0x3ec2('0xe'),auth[_0x3ec2('0xa')](),controller[_0x3ec2('0x13')]);router[_0x3ec2('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3ec2('0x15')]);module[_0x3ec2('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 6f18b46..7935c07 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 _0xcd59=['exports','STRING','name','sequelize'];(function(_0x2e655a,_0x6d5799){var _0x26f13b=function(_0x2dd535){while(--_0x2dd535){_0x2e655a['push'](_0x2e655a['shift']());}};_0x26f13b(++_0x6d5799);}(_0xcd59,0x14b));var _0x9cd5=function(_0x420746,_0x26dd66){_0x420746=_0x420746-0x0;var _0x1c6de2=_0xcd59[_0x420746];return _0x1c6de2;};'use strict';var Sequelize=require(_0x9cd5('0x0'));module[_0x9cd5('0x1')]={'name':{'type':Sequelize[_0x9cd5('0x2')],'unique':_0x9cd5('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9cd5('0x2')]}}; \ No newline at end of file +var _0xc21e=['STRING','name','exports'];(function(_0x1bbce7,_0x581b65){var _0xe3a3ef=function(_0x58c0c7){while(--_0x58c0c7){_0x1bbce7['push'](_0x1bbce7['shift']());}};_0xe3a3ef(++_0x581b65);}(_0xc21e,0x1ca));var _0xec21=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc21e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xec21('0x0')]={'name':{'type':Sequelize[_0xec21('0x1')],'unique':_0xec21('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xec21('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 071796d..02c8c24 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 _0x8e93=['body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','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','stack','name','send','index','MailSubstatus','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create'];(function(_0x19c24c,_0x1dde3a){var _0x3f2639=function(_0x117c61){while(--_0x117c61){_0x19c24c['push'](_0x19c24c['shift']());}};_0x3f2639(++_0x1dde3a);}(_0x8e93,0x189));var _0x38e9=function(_0x693056,_0x1fd3a7){_0x693056=_0x693056-0x0;var _0xe432ce=_0x8e93[_0x693056];return _0xe432ce;};'use strict';var emlformat=require(_0x38e9('0x0'));var rimraf=require(_0x38e9('0x1'));var zipdir=require(_0x38e9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x38e9('0x3'));var moment=require(_0x38e9('0x4'));var BPromise=require(_0x38e9('0x5'));var Mustache=require(_0x38e9('0x6'));var util=require(_0x38e9('0x7'));var path=require(_0x38e9('0x8'));var sox=require(_0x38e9('0x9'));var csv=require('to-csv');var ejs=require(_0x38e9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38e9('0xb'));var squel=require(_0x38e9('0xc'));var crypto=require(_0x38e9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x38e9('0xe'));var toCsv=require(_0x38e9('0xf'));var querystring=require(_0x38e9('0x10'));var Papa=require(_0x38e9('0x11'));var Redis=require(_0x38e9('0x12'));var authService=require(_0x38e9('0x13'));var qs=require(_0x38e9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x38e9('0x15'));var utils=require(_0x38e9('0x16'));var config=require(_0x38e9('0x17'));var licenseUtil=require(_0x38e9('0x18'));var db=require(_0x38e9('0x19'))['db'];function respondWithStatusCode(_0x57d0aa,_0x521fba){_0x521fba=_0x521fba||0xcc;return function(_0x77e598){if(_0x77e598){return _0x57d0aa[_0x38e9('0x1a')](_0x521fba);}return _0x57d0aa[_0x38e9('0x1b')](_0x521fba)[_0x38e9('0x1c')]();};}function respondWithResult(_0x203a4a,_0x4cd83c){_0x4cd83c=_0x4cd83c||0xc8;return function(_0x50a856){if(_0x50a856){return _0x203a4a[_0x38e9('0x1b')](_0x4cd83c)[_0x38e9('0x1d')](_0x50a856);}};}function respondWithFilteredResult(_0x268581,_0x34636a){return function(_0x32270f){if(_0x32270f){var _0xafc1f2=typeof _0x34636a[_0x38e9('0x1e')]===_0x38e9('0x1f')&&typeof _0x34636a['limit']===_0x38e9('0x1f');var _0x2df600=_0x32270f[_0x38e9('0x20')];var _0x432642=_0xafc1f2?0x0:_0x34636a['offset'];var _0x161d56=_0xafc1f2?_0x32270f[_0x38e9('0x20')]:_0x34636a['offset']+_0x34636a[_0x38e9('0x21')];var _0x37186f;if(_0x161d56>=_0x2df600){_0x161d56=_0x2df600;_0x37186f=0xc8;}else{_0x37186f=0xce;}_0x268581[_0x38e9('0x1b')](_0x37186f);return _0x268581[_0x38e9('0x22')](_0x38e9('0x23'),_0x432642+'-'+_0x161d56+'/'+_0x2df600)[_0x38e9('0x1d')](_0x32270f);}return null;};}function patchUpdates(_0xe4bdd4){return function(_0x9d9ecd){try{jsonpatch[_0x38e9('0x24')](_0x9d9ecd,_0xe4bdd4,!![]);}catch(_0x2ee163){return BPromise[_0x38e9('0x25')](_0x2ee163);}return _0x9d9ecd[_0x38e9('0x26')]();};}function saveUpdates(_0x1da1d1,_0x4eddb4){return function(_0x52038e){if(_0x52038e){return _0x52038e[_0x38e9('0x27')](_0x1da1d1)[_0x38e9('0x28')](function(_0x1d784b){return _0x1d784b;});}return null;};}function removeEntity(_0x59d39a,_0x2007bc){return function(_0x4c1ab6){if(_0x4c1ab6){return _0x4c1ab6[_0x38e9('0x29')]()[_0x38e9('0x28')](function(){_0x59d39a['status'](0xcc)[_0x38e9('0x1c')]();});}};}function handleEntityNotFound(_0x1d0425,_0x25faec){return function(_0x150bb4){if(!_0x150bb4){_0x1d0425['sendStatus'](0x194);}return _0x150bb4;};}function handleError(_0x2d24b9,_0x23301f){_0x23301f=_0x23301f||0x1f4;return function(_0x415d62){logger['error'](_0x415d62[_0x38e9('0x2a')]);if(_0x415d62[_0x38e9('0x2b')]){delete _0x415d62[_0x38e9('0x2b')];}_0x2d24b9['status'](_0x23301f)[_0x38e9('0x2c')](_0x415d62);};}exports[_0x38e9('0x2d')]=function(_0x45a6fe,_0x5cb2a6){var _0x3841a6={},_0x5d7e6a={},_0x3a8662={'count':0x0,'rows':[]};var _0xb1294=_['map'](db[_0x38e9('0x2e')]['rawAttributes'],function(_0x5b6b6c){return{'name':_0x5b6b6c[_0x38e9('0x2f')],'type':_0x5b6b6c['type'][_0x38e9('0x30')]};});_0x5d7e6a[_0x38e9('0x31')]=_[_0x38e9('0x32')](_0xb1294,_0x38e9('0x2b'));_0x5d7e6a[_0x38e9('0x33')]=_[_0x38e9('0x34')](_0x45a6fe[_0x38e9('0x33')]);_0x5d7e6a['filters']=_[_0x38e9('0x35')](_0x5d7e6a[_0x38e9('0x31')],_0x5d7e6a['query']);_0x3841a6[_0x38e9('0x36')]=_['intersection'](_0x5d7e6a[_0x38e9('0x31')],qs[_0x38e9('0x37')](_0x45a6fe['query'][_0x38e9('0x37')]));_0x3841a6[_0x38e9('0x36')]=_0x3841a6[_0x38e9('0x36')][_0x38e9('0x38')]?_0x3841a6['attributes']:_0x5d7e6a[_0x38e9('0x31')];if(!_0x45a6fe[_0x38e9('0x33')]['hasOwnProperty']('nolimit')){_0x3841a6['limit']=qs[_0x38e9('0x21')](_0x45a6fe[_0x38e9('0x33')][_0x38e9('0x21')]);_0x3841a6['offset']=qs[_0x38e9('0x1e')](_0x45a6fe[_0x38e9('0x33')][_0x38e9('0x1e')]);}_0x3841a6[_0x38e9('0x39')]=qs['sort'](_0x45a6fe[_0x38e9('0x33')][_0x38e9('0x3a')]);_0x3841a6['where']=qs[_0x38e9('0x3b')](_[_0x38e9('0x3c')](_0x45a6fe[_0x38e9('0x33')],_0x5d7e6a[_0x38e9('0x3b')]),_0xb1294);if(_0x45a6fe[_0x38e9('0x33')][_0x38e9('0x3d')]){_0x3841a6[_0x38e9('0x3e')]=_[_0x38e9('0x3f')](_0x3841a6[_0x38e9('0x3e')],{'$or':_['map'](_0xb1294,function(_0x76fdde){if(_0x76fdde[_0x38e9('0x40')]!==_0x38e9('0x41')){var _0x3dcff3={};_0x3dcff3[_0x76fdde['name']]={'$like':'%'+_0x45a6fe[_0x38e9('0x33')][_0x38e9('0x3d')]+'%'};return _0x3dcff3;}})});}_0x3841a6=_[_0x38e9('0x3f')]({},_0x3841a6,_0x45a6fe[_0x38e9('0x42')]);var _0x3b94bc={'where':_0x3841a6[_0x38e9('0x3e')]};return db[_0x38e9('0x2e')][_0x38e9('0x20')](_0x3b94bc)[_0x38e9('0x28')](function(_0x4466e3){_0x3a8662['count']=_0x4466e3;if(_0x45a6fe['query'][_0x38e9('0x43')]){_0x3841a6['include']=[{'all':!![]}];}return db[_0x38e9('0x2e')][_0x38e9('0x44')](_0x3841a6);})[_0x38e9('0x28')](function(_0x492bdd){_0x3a8662[_0x38e9('0x45')]=_0x492bdd;return _0x3a8662;})['then'](respondWithFilteredResult(_0x5cb2a6,_0x3841a6))[_0x38e9('0x46')](handleError(_0x5cb2a6,null));};exports[_0x38e9('0x47')]=function(_0x4caea1,_0x4d7b18){var _0x4af14f={'raw':!![],'where':{'id':_0x4caea1[_0x38e9('0x48')]['id']}},_0x1a51b0={};_0x1a51b0['model']=_[_0x38e9('0x34')](db['MailSubstatus']['rawAttributes']);_0x1a51b0['query']=_['keys'](_0x4caea1[_0x38e9('0x33')]);_0x1a51b0['filters']=_[_0x38e9('0x35')](_0x1a51b0['model'],_0x1a51b0[_0x38e9('0x33')]);_0x4af14f[_0x38e9('0x36')]=_[_0x38e9('0x35')](_0x1a51b0['model'],qs['fields'](_0x4caea1[_0x38e9('0x33')][_0x38e9('0x37')]));_0x4af14f[_0x38e9('0x36')]=_0x4af14f[_0x38e9('0x36')][_0x38e9('0x38')]?_0x4af14f[_0x38e9('0x36')]:_0x1a51b0[_0x38e9('0x31')];if(_0x4caea1['query'][_0x38e9('0x43')]){_0x4af14f[_0x38e9('0x49')]=[{'all':!![]}];}_0x4af14f=_[_0x38e9('0x3f')]({},_0x4af14f,_0x4caea1[_0x38e9('0x42')]);return db[_0x38e9('0x2e')]['find'](_0x4af14f)[_0x38e9('0x28')](handleEntityNotFound(_0x4d7b18,null))[_0x38e9('0x28')](respondWithResult(_0x4d7b18,null))[_0x38e9('0x46')](handleError(_0x4d7b18,null));};exports['create']=function(_0x142aed,_0x2a3374){return db[_0x38e9('0x2e')][_0x38e9('0x4a')](_0x142aed[_0x38e9('0x4b')],{})[_0x38e9('0x28')](respondWithResult(_0x2a3374,0xc9))[_0x38e9('0x46')](handleError(_0x2a3374,null));};exports[_0x38e9('0x27')]=function(_0x4afda8,_0x294820){if(_0x4afda8[_0x38e9('0x4b')]['id']){delete _0x4afda8['body']['id'];}return db[_0x38e9('0x2e')][_0x38e9('0x4c')]({'where':{'id':_0x4afda8[_0x38e9('0x48')]['id']}})[_0x38e9('0x28')](handleEntityNotFound(_0x294820,null))[_0x38e9('0x28')](saveUpdates(_0x4afda8['body'],null))[_0x38e9('0x28')](respondWithResult(_0x294820,null))[_0x38e9('0x46')](handleError(_0x294820,null));};exports[_0x38e9('0x29')]=function(_0x3aeafe,_0x569098){return db[_0x38e9('0x2e')][_0x38e9('0x4c')]({'where':{'id':_0x3aeafe[_0x38e9('0x48')]['id']}})[_0x38e9('0x28')](handleEntityNotFound(_0x569098,null))['then'](removeEntity(_0x569098,null))[_0x38e9('0x46')](handleError(_0x569098,null));};exports[_0x38e9('0x4d')]=function(_0x1fbb18,_0x2eb2ef){return db[_0x38e9('0x2e')][_0x38e9('0x4d')]()[_0x38e9('0x28')](respondWithResult(_0x2eb2ef,null))[_0x38e9('0x46')](handleError(_0x2eb2ef,null));}; \ No newline at end of file +var _0xbf84=['params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','apply','reject','then','end','stack','name','send','index','map','MailSubstatus','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','include','findAll','catch','show','includeAll','options','find','create','body','update','destroy'];(function(_0x51b177,_0x545b8e){var _0x18e416=function(_0x46827d){while(--_0x46827d){_0x51b177['push'](_0x51b177['shift']());}};_0x18e416(++_0x545b8e);}(_0xbf84,0x16a));var _0x4bf8=function(_0x39e1d8,_0x136940){_0x39e1d8=_0x39e1d8-0x0;var _0x11dbaf=_0xbf84[_0x39e1d8];return _0x11dbaf;};'use strict';var emlformat=require(_0x4bf8('0x0'));var rimraf=require(_0x4bf8('0x1'));var zipdir=require(_0x4bf8('0x2'));var jsonpatch=require(_0x4bf8('0x3'));var rp=require('request-promise');var moment=require(_0x4bf8('0x4'));var BPromise=require(_0x4bf8('0x5'));var Mustache=require(_0x4bf8('0x6'));var util=require(_0x4bf8('0x7'));var path=require(_0x4bf8('0x8'));var sox=require(_0x4bf8('0x9'));var csv=require(_0x4bf8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4bf8('0xb'));var _=require('lodash');var squel=require(_0x4bf8('0xc'));var crypto=require('crypto');var jsforce=require(_0x4bf8('0xd'));var deskjs=require(_0x4bf8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4bf8('0xf'));var Papa=require(_0x4bf8('0x10'));var Redis=require(_0x4bf8('0x11'));var authService=require(_0x4bf8('0x12'));var qs=require(_0x4bf8('0x13'));var as=require(_0x4bf8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4bf8('0x15'))(_0x4bf8('0x16'));var utils=require('../../config/utils');var config=require(_0x4bf8('0x17'));var licenseUtil=require(_0x4bf8('0x18'));var db=require(_0x4bf8('0x19'))['db'];function respondWithStatusCode(_0x2492ec,_0x30392e){_0x30392e=_0x30392e||0xcc;return function(_0x5d743c){if(_0x5d743c){return _0x2492ec[_0x4bf8('0x1a')](_0x30392e);}return _0x2492ec['status'](_0x30392e)['end']();};}function respondWithResult(_0x5dcd2c,_0x279bfe){_0x279bfe=_0x279bfe||0xc8;return function(_0x534099){if(_0x534099){return _0x5dcd2c[_0x4bf8('0x1b')](_0x279bfe)[_0x4bf8('0x1c')](_0x534099);}};}function respondWithFilteredResult(_0x396e19,_0x5f39f5){return function(_0x3db8c8){if(_0x3db8c8){var _0x49db5c=typeof _0x5f39f5['offset']==='undefined'&&typeof _0x5f39f5[_0x4bf8('0x1d')]===_0x4bf8('0x1e');var _0x18060f=_0x3db8c8['count'];var _0x50ff1=_0x49db5c?0x0:_0x5f39f5[_0x4bf8('0x1f')];var _0x59c12f=_0x49db5c?_0x3db8c8[_0x4bf8('0x20')]:_0x5f39f5[_0x4bf8('0x1f')]+_0x5f39f5[_0x4bf8('0x1d')];var _0x4761da;if(_0x59c12f>=_0x18060f){_0x59c12f=_0x18060f;_0x4761da=0xc8;}else{_0x4761da=0xce;}_0x396e19[_0x4bf8('0x1b')](_0x4761da);return _0x396e19['set']('Content-Range',_0x50ff1+'-'+_0x59c12f+'/'+_0x18060f)[_0x4bf8('0x1c')](_0x3db8c8);}return null;};}function patchUpdates(_0x43fef6){return function(_0x5aabe1){try{jsonpatch[_0x4bf8('0x21')](_0x5aabe1,_0x43fef6,!![]);}catch(_0x5161b0){return BPromise[_0x4bf8('0x22')](_0x5161b0);}return _0x5aabe1['save']();};}function saveUpdates(_0x4fd457,_0x35323a){return function(_0x4acf97){if(_0x4acf97){return _0x4acf97['update'](_0x4fd457)[_0x4bf8('0x23')](function(_0x5b7047){return _0x5b7047;});}return null;};}function removeEntity(_0xa7cd65,_0x4b0f6e){return function(_0x1371fe){if(_0x1371fe){return _0x1371fe['destroy']()[_0x4bf8('0x23')](function(){_0xa7cd65[_0x4bf8('0x1b')](0xcc)[_0x4bf8('0x24')]();});}};}function handleEntityNotFound(_0x508992,_0xa75382){return function(_0x55f295){if(!_0x55f295){_0x508992['sendStatus'](0x194);}return _0x55f295;};}function handleError(_0xad716e,_0x420036){_0x420036=_0x420036||0x1f4;return function(_0x1b4da7){logger['error'](_0x1b4da7[_0x4bf8('0x25')]);if(_0x1b4da7[_0x4bf8('0x26')]){delete _0x1b4da7[_0x4bf8('0x26')];}_0xad716e[_0x4bf8('0x1b')](_0x420036)[_0x4bf8('0x27')](_0x1b4da7);};}exports[_0x4bf8('0x28')]=function(_0x2a3e7a,_0x3cb708){var _0xe3ece={},_0x4229bd={},_0xcfe892={'count':0x0,'rows':[]};var _0x763682=_[_0x4bf8('0x29')](db[_0x4bf8('0x2a')]['rawAttributes'],function(_0x33028d){return{'name':_0x33028d[_0x4bf8('0x2b')],'type':_0x33028d['type']['key']};});_0x4229bd['model']=_[_0x4bf8('0x29')](_0x763682,_0x4bf8('0x26'));_0x4229bd[_0x4bf8('0x2c')]=_[_0x4bf8('0x2d')](_0x2a3e7a[_0x4bf8('0x2c')]);_0x4229bd[_0x4bf8('0x2e')]=_[_0x4bf8('0x2f')](_0x4229bd[_0x4bf8('0x30')],_0x4229bd['query']);_0xe3ece[_0x4bf8('0x31')]=_[_0x4bf8('0x2f')](_0x4229bd['model'],qs[_0x4bf8('0x32')](_0x2a3e7a[_0x4bf8('0x2c')]['fields']));_0xe3ece['attributes']=_0xe3ece['attributes']['length']?_0xe3ece[_0x4bf8('0x31')]:_0x4229bd[_0x4bf8('0x30')];if(!_0x2a3e7a[_0x4bf8('0x2c')][_0x4bf8('0x33')](_0x4bf8('0x34'))){_0xe3ece['limit']=qs['limit'](_0x2a3e7a[_0x4bf8('0x2c')][_0x4bf8('0x1d')]);_0xe3ece['offset']=qs[_0x4bf8('0x1f')](_0x2a3e7a[_0x4bf8('0x2c')]['offset']);}_0xe3ece['order']=qs[_0x4bf8('0x35')](_0x2a3e7a[_0x4bf8('0x2c')][_0x4bf8('0x35')]);_0xe3ece['where']=qs[_0x4bf8('0x2e')](_[_0x4bf8('0x36')](_0x2a3e7a[_0x4bf8('0x2c')],_0x4229bd[_0x4bf8('0x2e')]),_0x763682);if(_0x2a3e7a[_0x4bf8('0x2c')]['filter']){_0xe3ece[_0x4bf8('0x37')]=_[_0x4bf8('0x38')](_0xe3ece[_0x4bf8('0x37')],{'$or':_[_0x4bf8('0x29')](_0x763682,function(_0x355add){if(_0x355add['type']!==_0x4bf8('0x39')){var _0x61909e={};_0x61909e[_0x355add[_0x4bf8('0x26')]]={'$like':'%'+_0x2a3e7a[_0x4bf8('0x2c')][_0x4bf8('0x3a')]+'%'};return _0x61909e;}})});}_0xe3ece=_['merge']({},_0xe3ece,_0x2a3e7a['options']);var _0x3f09c5={'where':_0xe3ece['where']};return db[_0x4bf8('0x2a')][_0x4bf8('0x20')](_0x3f09c5)['then'](function(_0x732401){_0xcfe892[_0x4bf8('0x20')]=_0x732401;if(_0x2a3e7a[_0x4bf8('0x2c')]['includeAll']){_0xe3ece[_0x4bf8('0x3b')]=[{'all':!![]}];}return db[_0x4bf8('0x2a')][_0x4bf8('0x3c')](_0xe3ece);})['then'](function(_0x35c836){_0xcfe892['rows']=_0x35c836;return _0xcfe892;})[_0x4bf8('0x23')](respondWithFilteredResult(_0x3cb708,_0xe3ece))[_0x4bf8('0x3d')](handleError(_0x3cb708,null));};exports[_0x4bf8('0x3e')]=function(_0xe24a33,_0x52913b){var _0x49668a={'raw':!![],'where':{'id':_0xe24a33['params']['id']}},_0x36002e={};_0x36002e[_0x4bf8('0x30')]=_['keys'](db['MailSubstatus']['rawAttributes']);_0x36002e[_0x4bf8('0x2c')]=_['keys'](_0xe24a33['query']);_0x36002e[_0x4bf8('0x2e')]=_['intersection'](_0x36002e['model'],_0x36002e['query']);_0x49668a[_0x4bf8('0x31')]=_[_0x4bf8('0x2f')](_0x36002e['model'],qs['fields'](_0xe24a33[_0x4bf8('0x2c')][_0x4bf8('0x32')]));_0x49668a[_0x4bf8('0x31')]=_0x49668a[_0x4bf8('0x31')]['length']?_0x49668a[_0x4bf8('0x31')]:_0x36002e['model'];if(_0xe24a33[_0x4bf8('0x2c')][_0x4bf8('0x3f')]){_0x49668a[_0x4bf8('0x3b')]=[{'all':!![]}];}_0x49668a=_[_0x4bf8('0x38')]({},_0x49668a,_0xe24a33[_0x4bf8('0x40')]);return db[_0x4bf8('0x2a')][_0x4bf8('0x41')](_0x49668a)[_0x4bf8('0x23')](handleEntityNotFound(_0x52913b,null))[_0x4bf8('0x23')](respondWithResult(_0x52913b,null))[_0x4bf8('0x3d')](handleError(_0x52913b,null));};exports[_0x4bf8('0x42')]=function(_0x24f4bd,_0x16211e){return db[_0x4bf8('0x2a')][_0x4bf8('0x42')](_0x24f4bd[_0x4bf8('0x43')],{})[_0x4bf8('0x23')](respondWithResult(_0x16211e,0xc9))[_0x4bf8('0x3d')](handleError(_0x16211e,null));};exports[_0x4bf8('0x44')]=function(_0x6cb2e8,_0x1a4d51){if(_0x6cb2e8[_0x4bf8('0x43')]['id']){delete _0x6cb2e8[_0x4bf8('0x43')]['id'];}return db[_0x4bf8('0x2a')][_0x4bf8('0x41')]({'where':{'id':_0x6cb2e8['params']['id']}})[_0x4bf8('0x23')](handleEntityNotFound(_0x1a4d51,null))[_0x4bf8('0x23')](saveUpdates(_0x6cb2e8['body'],null))[_0x4bf8('0x23')](respondWithResult(_0x1a4d51,null))[_0x4bf8('0x3d')](handleError(_0x1a4d51,null));};exports[_0x4bf8('0x45')]=function(_0x18fe83,_0x40a281){return db[_0x4bf8('0x2a')]['find']({'where':{'id':_0x18fe83[_0x4bf8('0x46')]['id']}})[_0x4bf8('0x23')](handleEntityNotFound(_0x40a281,null))[_0x4bf8('0x23')](removeEntity(_0x40a281,null))['catch'](handleError(_0x40a281,null));};exports[_0x4bf8('0x47')]=function(_0x319cce,_0x4ebb09){return db['MailSubstatus'][_0x4bf8('0x47')]()[_0x4bf8('0x23')](respondWithResult(_0x4ebb09,null))[_0x4bf8('0x3d')](handleError(_0x4ebb09,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 5f00420..42deb0e 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 _0x0b76=['mail_substatuses','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0b76,0xb7));var _0x60b7=function(_0x5bd8fe,_0x50cbe7){_0x5bd8fe=_0x5bd8fe-0x0;var _0x2cd41b=_0x0b76[_0x5bd8fe];return _0x2cd41b;};'use strict';var _=require(_0x60b7('0x0'));var util=require(_0x60b7('0x1'));var logger=require('../../config/logger')(_0x60b7('0x2'));var moment=require(_0x60b7('0x3'));var BPromise=require('bluebird');var rp=require(_0x60b7('0x4'));var fs=require('fs');var path=require(_0x60b7('0x5'));var rimraf=require(_0x60b7('0x6'));var config=require(_0x60b7('0x7'));var attributes=require(_0x60b7('0x8'));module[_0x60b7('0x9')]=function(_0x25f05f,_0x21002c){return _0x25f05f[_0x60b7('0xa')](_0x60b7('0xb'),attributes,{'tableName':_0x60b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6740=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailSubstatus','lodash'];(function(_0x4734d8,_0x479950){var _0x3b1120=function(_0x4a5d1c){while(--_0x4a5d1c){_0x4734d8['push'](_0x4734d8['shift']());}};_0x3b1120(++_0x479950);}(_0x6740,0x1eb));var _0x0674=function(_0x4d20c0,_0x33210c){_0x4d20c0=_0x4d20c0-0x0;var _0x1afcc3=_0x6740[_0x4d20c0];return _0x1afcc3;};'use strict';var _=require(_0x0674('0x0'));var util=require(_0x0674('0x1'));var logger=require(_0x0674('0x2'))(_0x0674('0x3'));var moment=require(_0x0674('0x4'));var BPromise=require(_0x0674('0x5'));var rp=require(_0x0674('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0674('0x7'));var config=require(_0x0674('0x8'));var attributes=require('./mailSubstatus.attributes');module[_0x0674('0x9')]=function(_0x581d41,_0x13ff6c){return _0x581d41[_0x0674('0xa')](_0x0674('0xb'),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 416a88e..1738a84 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 _0x7bf4=['../../config/environment','http','then','info','request\x20sent','debug','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xf5cf8b,_0x4698bd){var _0x38216e=function(_0x52b583){while(--_0x52b583){_0xf5cf8b['push'](_0xf5cf8b['shift']());}};_0x38216e(++_0x4698bd);}(_0x7bf4,0x78));var _0x47bf=function(_0x7ad32c,_0x23a534){_0x7ad32c=_0x7ad32c-0x0;var _0x57b891=_0x7bf4[_0x7ad32c];return _0x57b891;};'use strict';var _=require('lodash');var util=require(_0x47bf('0x0'));var moment=require(_0x47bf('0x1'));var BPromise=require(_0x47bf('0x2'));var rs=require(_0x47bf('0x3'));var fs=require('fs');var Redis=require(_0x47bf('0x4'));var db=require(_0x47bf('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x47bf('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x47bf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ac758,_0x4b8e17,_0x46f508){return new BPromise(function(_0x4ecfd0,_0x3c8d4b){return client['request'](_0x1ac758,_0x46f508)[_0x47bf('0x8')](function(_0x1eb378){logger[_0x47bf('0x9')]('MailSubstatus,\x20%s,\x20%s',_0x4b8e17,_0x47bf('0xa'));logger[_0x47bf('0xb')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4b8e17,'request\x20sent',JSON[_0x47bf('0xc')](_0x1eb378));if(_0x1eb378[_0x47bf('0xd')]){if(_0x1eb378[_0x47bf('0xd')][_0x47bf('0xe')]===0x1f4){logger[_0x47bf('0xd')](_0x47bf('0xf'),_0x4b8e17,_0x1eb378[_0x47bf('0xd')]['message']);return _0x3c8d4b(_0x1eb378[_0x47bf('0xd')][_0x47bf('0x10')]);}logger[_0x47bf('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x4b8e17,_0x1eb378[_0x47bf('0xd')][_0x47bf('0x10')]);return _0x4ecfd0(_0x1eb378['error'][_0x47bf('0x10')]);}else{logger[_0x47bf('0x9')](_0x47bf('0xf'),_0x4b8e17,_0x47bf('0xa'));_0x4ecfd0(_0x1eb378['result'][_0x47bf('0x10')]);}})[_0x47bf('0x11')](function(_0x33fd65){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x4b8e17,_0x33fd65);_0x3c8d4b(_0x33fd65);});});} \ No newline at end of file +var _0x5a52=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x5a52,0x178));var _0x25a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a52[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x25a5('0x0'));var util=require(_0x25a5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x25a5('0x2'));var fs=require('fs');var Redis=require(_0x25a5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x25a5('0x4'))(_0x25a5('0x5'));var config=require(_0x25a5('0x6'));var jayson=require(_0x25a5('0x7'));var client=jayson[_0x25a5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a651c,_0x51ea4d,_0x5d1dbc){return new BPromise(function(_0x4b881e,_0x5916ae){return client[_0x25a5('0x9')](_0x5a651c,_0x5d1dbc)[_0x25a5('0xa')](function(_0x532f14){logger[_0x25a5('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x51ea4d,_0x25a5('0xc'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x51ea4d,_0x25a5('0xc'),JSON[_0x25a5('0xd')](_0x532f14));if(_0x532f14[_0x25a5('0xe')]){if(_0x532f14[_0x25a5('0xe')][_0x25a5('0xf')]===0x1f4){logger[_0x25a5('0xe')](_0x25a5('0x10'),_0x51ea4d,_0x532f14['error'][_0x25a5('0x11')]);return _0x5916ae(_0x532f14['error']['message']);}logger[_0x25a5('0xe')](_0x25a5('0x10'),_0x51ea4d,_0x532f14[_0x25a5('0xe')][_0x25a5('0x11')]);return _0x4b881e(_0x532f14[_0x25a5('0xe')][_0x25a5('0x11')]);}else{logger[_0x25a5('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x51ea4d,_0x25a5('0xc'));_0x4b881e(_0x532f14[_0x25a5('0x12')]['message']);}})['catch'](function(_0x40758b){logger[_0x25a5('0xe')](_0x25a5('0x10'),_0x51ea4d,_0x40758b);_0x5916ae(_0x40758b);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 273f3df..06c92bb 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 _0xbbef=['isAuthenticated','describe','/:id','show','create','put','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get'];(function(_0x41d4a3,_0x3d1bd9){var _0x206f47=function(_0x5360fb){while(--_0x5360fb){_0x41d4a3['push'](_0x41d4a3['shift']());}};_0x206f47(++_0x3d1bd9);}(_0xbbef,0xa1));var _0xfbbe=function(_0x4b8491,_0x3e8732){_0x4b8491=_0x4b8491-0x0;var _0x247b05=_0xbbef[_0x4b8491];return _0x247b05;};'use strict';var multer=require(_0xfbbe('0x0'));var util=require(_0xfbbe('0x1'));var path=require('path');var timeout=require(_0xfbbe('0x2'));var express=require('express');var router=express[_0xfbbe('0x3')]();var fs_extra=require(_0xfbbe('0x4'));var auth=require(_0xfbbe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfbbe('0x6'));var controller=require(_0xfbbe('0x7'));router[_0xfbbe('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfbbe('0x8')]('/describe',auth[_0xfbbe('0x9')](),controller[_0xfbbe('0xa')]);router[_0xfbbe('0x8')](_0xfbbe('0xb'),auth[_0xfbbe('0x9')](),controller[_0xfbbe('0xc')]);router['post']('/',auth[_0xfbbe('0x9')](),controller[_0xfbbe('0xd')]);router[_0xfbbe('0xe')]('/:id',auth[_0xfbbe('0x9')](),controller['update']);router[_0xfbbe('0xf')](_0xfbbe('0xb'),auth[_0xfbbe('0x9')](),controller[_0xfbbe('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0314=['put','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0x11e598,_0x4130ab){var _0x33125b=function(_0x58a394){while(--_0x58a394){_0x11e598['push'](_0x11e598['shift']());}};_0x33125b(++_0x4130ab);}(_0x0314,0x1e5));var _0x4031=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0314[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4031('0x0'));var util=require(_0x4031('0x1'));var path=require(_0x4031('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4031('0x3')]();var fs_extra=require(_0x4031('0x4'));var auth=require(_0x4031('0x5'));var interaction=require(_0x4031('0x6'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x4031('0x7')]('/',auth[_0x4031('0x8')](),controller[_0x4031('0x9')]);router[_0x4031('0x7')](_0x4031('0xa'),auth[_0x4031('0x8')](),controller[_0x4031('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4031('0xc')]);router[_0x4031('0xd')]('/',auth['isAuthenticated'](),controller[_0x4031('0xe')]);router[_0x4031('0xf')](_0x4031('0x10'),auth[_0x4031('0x8')](),controller[_0x4031('0x11')]);router[_0x4031('0x12')](_0x4031('0x10'),auth[_0x4031('0x8')](),controller['destroy']);module[_0x4031('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 724eeab..f8c7cbd 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4c736a,_0x3ca126){_0x4c736a=_0x4c736a-0x0;var _0x2e18fc=_0xb43b[_0x4c736a];return _0x2e18fc;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x3d3d96,_0x28998e){var _0x2e479a=function(_0x1349ba){while(--_0x1349ba){_0x3d3d96['push'](_0x3d3d96['shift']());}};_0x2e479a(++_0x28998e);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 9dbfc49..46e0955 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 _0x9458=['sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','error','stack','name','send','index','map','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','MailTransferReport','include','findAll','rows','catch','show','includeAll','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9458,0xd1));var _0x8945=function(_0x3b42e4,_0x139bcd){_0x3b42e4=_0x3b42e4-0x0;var _0x468dfb=_0x9458[_0x3b42e4];return _0x468dfb;};'use strict';var emlformat=require(_0x8945('0x0'));var rimraf=require(_0x8945('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8945('0x2'));var rp=require(_0x8945('0x3'));var moment=require(_0x8945('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8945('0x5'));var util=require('util');var path=require(_0x8945('0x6'));var sox=require(_0x8945('0x7'));var csv=require(_0x8945('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8945('0x9'));var _=require(_0x8945('0xa'));var squel=require(_0x8945('0xb'));var crypto=require(_0x8945('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8945('0xd'));var toCsv=require(_0x8945('0x8'));var querystring=require('querystring');var Papa=require(_0x8945('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8945('0xf'));var as=require(_0x8945('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8945('0x11'))(_0x8945('0x12'));var utils=require(_0x8945('0x13'));var config=require(_0x8945('0x14'));var licenseUtil=require(_0x8945('0x15'));var db=require(_0x8945('0x16'))['db'];function respondWithStatusCode(_0x1a8c97,_0x39d9a2){_0x39d9a2=_0x39d9a2||0xcc;return function(_0x11557f){if(_0x11557f){return _0x1a8c97[_0x8945('0x17')](_0x39d9a2);}return _0x1a8c97[_0x8945('0x18')](_0x39d9a2)[_0x8945('0x19')]();};}function respondWithResult(_0x2c112d,_0x52a21e){_0x52a21e=_0x52a21e||0xc8;return function(_0x161d27){if(_0x161d27){return _0x2c112d[_0x8945('0x18')](_0x52a21e)[_0x8945('0x1a')](_0x161d27);}};}function respondWithFilteredResult(_0x2e7c6e,_0x5726fa){return function(_0x52002f){if(_0x52002f){var _0x4f5437=typeof _0x5726fa[_0x8945('0x1b')]===_0x8945('0x1c')&&typeof _0x5726fa[_0x8945('0x1d')]==='undefined';var _0x1019ff=_0x52002f[_0x8945('0x1e')];var _0x333de8=_0x4f5437?0x0:_0x5726fa[_0x8945('0x1b')];var _0xf8f3e9=_0x4f5437?_0x52002f['count']:_0x5726fa[_0x8945('0x1b')]+_0x5726fa[_0x8945('0x1d')];var _0x309c88;if(_0xf8f3e9>=_0x1019ff){_0xf8f3e9=_0x1019ff;_0x309c88=0xc8;}else{_0x309c88=0xce;}_0x2e7c6e[_0x8945('0x18')](_0x309c88);return _0x2e7c6e[_0x8945('0x1f')]('Content-Range',_0x333de8+'-'+_0xf8f3e9+'/'+_0x1019ff)[_0x8945('0x1a')](_0x52002f);}return null;};}function patchUpdates(_0x779630){return function(_0x4b73e8){try{jsonpatch['apply'](_0x4b73e8,_0x779630,!![]);}catch(_0x20752f){return BPromise['reject'](_0x20752f);}return _0x4b73e8['save']();};}function saveUpdates(_0x2bc29f,_0x334f6b){return function(_0x143b8e){if(_0x143b8e){return _0x143b8e[_0x8945('0x20')](_0x2bc29f)[_0x8945('0x21')](function(_0x29b2ff){return _0x29b2ff;});}return null;};}function removeEntity(_0x2ad95b,_0x37bc08){return function(_0x3a5842){if(_0x3a5842){return _0x3a5842[_0x8945('0x22')]()[_0x8945('0x21')](function(){_0x2ad95b['status'](0xcc)[_0x8945('0x19')]();});}};}function handleEntityNotFound(_0x139abe,_0x1f4174){return function(_0x399161){if(!_0x399161){_0x139abe[_0x8945('0x17')](0x194);}return _0x399161;};}function handleError(_0x29f786,_0x8ffca0){_0x8ffca0=_0x8ffca0||0x1f4;return function(_0x3c837d){logger[_0x8945('0x23')](_0x3c837d[_0x8945('0x24')]);if(_0x3c837d[_0x8945('0x25')]){delete _0x3c837d[_0x8945('0x25')];}_0x29f786[_0x8945('0x18')](_0x8ffca0)[_0x8945('0x26')](_0x3c837d);};}exports[_0x8945('0x27')]=function(_0x7e1b74,_0x14fa46){var _0x26ebf3={},_0x42e787={},_0x208012={'count':0x0,'rows':[]};var _0x3d6bc0=_[_0x8945('0x28')](db['MailTransferReport']['rawAttributes'],function(_0x45c397){return{'name':_0x45c397['fieldName'],'type':_0x45c397[_0x8945('0x29')][_0x8945('0x2a')]};});_0x42e787[_0x8945('0x2b')]=_[_0x8945('0x28')](_0x3d6bc0,_0x8945('0x25'));_0x42e787['query']=_[_0x8945('0x2c')](_0x7e1b74[_0x8945('0x2d')]);_0x42e787[_0x8945('0x2e')]=_[_0x8945('0x2f')](_0x42e787[_0x8945('0x2b')],_0x42e787['query']);_0x26ebf3[_0x8945('0x30')]=_[_0x8945('0x2f')](_0x42e787[_0x8945('0x2b')],qs[_0x8945('0x31')](_0x7e1b74['query']['fields']));_0x26ebf3['attributes']=_0x26ebf3['attributes'][_0x8945('0x32')]?_0x26ebf3[_0x8945('0x30')]:_0x42e787[_0x8945('0x2b')];if(!_0x7e1b74[_0x8945('0x2d')]['hasOwnProperty'](_0x8945('0x33'))){_0x26ebf3[_0x8945('0x1d')]=qs[_0x8945('0x1d')](_0x7e1b74[_0x8945('0x2d')]['limit']);_0x26ebf3[_0x8945('0x1b')]=qs['offset'](_0x7e1b74['query']['offset']);}_0x26ebf3[_0x8945('0x34')]=qs[_0x8945('0x35')](_0x7e1b74[_0x8945('0x2d')][_0x8945('0x35')]);_0x26ebf3['where']=qs['filters'](_[_0x8945('0x36')](_0x7e1b74['query'],_0x42e787[_0x8945('0x2e')]),_0x3d6bc0);if(_0x7e1b74[_0x8945('0x2d')][_0x8945('0x37')]){_0x26ebf3[_0x8945('0x38')]=_[_0x8945('0x39')](_0x26ebf3[_0x8945('0x38')],{'$or':_[_0x8945('0x28')](_0x3d6bc0,function(_0x1317e9){if(_0x1317e9[_0x8945('0x29')]!==_0x8945('0x3a')){var _0x672ec4={};_0x672ec4[_0x1317e9['name']]={'$like':'%'+_0x7e1b74[_0x8945('0x2d')]['filter']+'%'};return _0x672ec4;}})});}_0x26ebf3=_['merge']({},_0x26ebf3,_0x7e1b74[_0x8945('0x3b')]);var _0x29d4f0={'where':_0x26ebf3[_0x8945('0x38')]};return db[_0x8945('0x3c')]['count'](_0x29d4f0)['then'](function(_0x1c55eb){_0x208012[_0x8945('0x1e')]=_0x1c55eb;if(_0x7e1b74[_0x8945('0x2d')]['includeAll']){_0x26ebf3[_0x8945('0x3d')]=[{'all':!![]}];}return db[_0x8945('0x3c')][_0x8945('0x3e')](_0x26ebf3);})[_0x8945('0x21')](function(_0x3a81f7){_0x208012[_0x8945('0x3f')]=_0x3a81f7;return _0x208012;})['then'](respondWithFilteredResult(_0x14fa46,_0x26ebf3))[_0x8945('0x40')](handleError(_0x14fa46,null));};exports[_0x8945('0x41')]=function(_0x5df613,_0x417a4b){var _0x58f3b9={'raw':!![],'where':{'id':_0x5df613['params']['id']}},_0x1b68f1={};_0x1b68f1[_0x8945('0x2b')]=_[_0x8945('0x2c')](db[_0x8945('0x3c')]['rawAttributes']);_0x1b68f1['query']=_[_0x8945('0x2c')](_0x5df613['query']);_0x1b68f1['filters']=_['intersection'](_0x1b68f1[_0x8945('0x2b')],_0x1b68f1[_0x8945('0x2d')]);_0x58f3b9[_0x8945('0x30')]=_[_0x8945('0x2f')](_0x1b68f1[_0x8945('0x2b')],qs['fields'](_0x5df613[_0x8945('0x2d')][_0x8945('0x31')]));_0x58f3b9[_0x8945('0x30')]=_0x58f3b9[_0x8945('0x30')][_0x8945('0x32')]?_0x58f3b9[_0x8945('0x30')]:_0x1b68f1[_0x8945('0x2b')];if(_0x5df613[_0x8945('0x2d')][_0x8945('0x42')]){_0x58f3b9[_0x8945('0x3d')]=[{'all':!![]}];}_0x58f3b9=_['merge']({},_0x58f3b9,_0x5df613[_0x8945('0x3b')]);return db['MailTransferReport']['find'](_0x58f3b9)[_0x8945('0x21')](handleEntityNotFound(_0x417a4b,null))[_0x8945('0x21')](respondWithResult(_0x417a4b,null))[_0x8945('0x40')](handleError(_0x417a4b,null));};exports[_0x8945('0x43')]=function(_0x5de356,_0x276af8){return db['MailTransferReport']['create'](_0x5de356[_0x8945('0x44')],{})['then'](respondWithResult(_0x276af8,0xc9))['catch'](handleError(_0x276af8,null));};exports[_0x8945('0x20')]=function(_0x575c70,_0xd0a5cf){if(_0x575c70[_0x8945('0x44')]['id']){delete _0x575c70[_0x8945('0x44')]['id'];}return db[_0x8945('0x3c')][_0x8945('0x45')]({'where':{'id':_0x575c70['params']['id']}})[_0x8945('0x21')](handleEntityNotFound(_0xd0a5cf,null))[_0x8945('0x21')](saveUpdates(_0x575c70[_0x8945('0x44')],null))[_0x8945('0x21')](respondWithResult(_0xd0a5cf,null))[_0x8945('0x40')](handleError(_0xd0a5cf,null));};exports[_0x8945('0x22')]=function(_0x5e92be,_0x29d26c){return db[_0x8945('0x3c')]['find']({'where':{'id':_0x5e92be[_0x8945('0x46')]['id']}})['then'](handleEntityNotFound(_0x29d26c,null))[_0x8945('0x21')](removeEntity(_0x29d26c,null))[_0x8945('0x40')](handleError(_0x29d26c,null));};exports[_0x8945('0x47')]=function(_0x2423ba,_0x151108){return db[_0x8945('0x3c')]['describe']()[_0x8945('0x21')](respondWithResult(_0x151108,null))['catch'](handleError(_0x151108,null));}; \ No newline at end of file +var _0xccab=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','show','keys','length','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','status','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','model'];(function(_0x295a3d,_0x56d487){var _0x23a732=function(_0x15cfc2){while(--_0x15cfc2){_0x295a3d['push'](_0x295a3d['shift']());}};_0x23a732(++_0x56d487);}(_0xccab,0x189));var _0xbcca=function(_0x39d07f,_0x2971dd){_0x39d07f=_0x39d07f-0x0;var _0x5720e7=_0xccab[_0x39d07f];return _0x5720e7;};'use strict';var emlformat=require(_0xbcca('0x0'));var rimraf=require(_0xbcca('0x1'));var zipdir=require(_0xbcca('0x2'));var jsonpatch=require(_0xbcca('0x3'));var rp=require(_0xbcca('0x4'));var moment=require(_0xbcca('0x5'));var BPromise=require(_0xbcca('0x6'));var Mustache=require(_0xbcca('0x7'));var util=require('util');var path=require(_0xbcca('0x8'));var sox=require(_0xbcca('0x9'));var csv=require(_0xbcca('0xa'));var ejs=require(_0xbcca('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbcca('0xc'));var crypto=require('crypto');var jsforce=require(_0xbcca('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbcca('0xa'));var querystring=require(_0xbcca('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbcca('0xf'));var as=require(_0xbcca('0x10'));var hardwareService=require(_0xbcca('0x11'));var logger=require(_0xbcca('0x12'))('api');var utils=require(_0xbcca('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbcca('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x515507,_0x3dcf68){_0x3dcf68=_0x3dcf68||0xcc;return function(_0xfb565e){if(_0xfb565e){return _0x515507['sendStatus'](_0x3dcf68);}return _0x515507['status'](_0x3dcf68)[_0xbcca('0x15')]();};}function respondWithResult(_0x328f4b,_0x2f65ff){_0x2f65ff=_0x2f65ff||0xc8;return function(_0x21ebf0){if(_0x21ebf0){return _0x328f4b[_0xbcca('0x16')](_0x2f65ff)['json'](_0x21ebf0);}};}function respondWithFilteredResult(_0x50bb88,_0x25ce3c){return function(_0xfbd611){if(_0xfbd611){var _0x448631=typeof _0x25ce3c['offset']===_0xbcca('0x17')&&typeof _0x25ce3c['limit']===_0xbcca('0x17');var _0x39cafb=_0xfbd611[_0xbcca('0x18')];var _0x1609a0=_0x448631?0x0:_0x25ce3c['offset'];var _0x3857a2=_0x448631?_0xfbd611[_0xbcca('0x18')]:_0x25ce3c['offset']+_0x25ce3c[_0xbcca('0x19')];var _0xc590de;if(_0x3857a2>=_0x39cafb){_0x3857a2=_0x39cafb;_0xc590de=0xc8;}else{_0xc590de=0xce;}_0x50bb88[_0xbcca('0x16')](_0xc590de);return _0x50bb88[_0xbcca('0x1a')]('Content-Range',_0x1609a0+'-'+_0x3857a2+'/'+_0x39cafb)[_0xbcca('0x1b')](_0xfbd611);}return null;};}function patchUpdates(_0x34ec54){return function(_0x89b2fd){try{jsonpatch[_0xbcca('0x1c')](_0x89b2fd,_0x34ec54,!![]);}catch(_0x4e3b6e){return BPromise[_0xbcca('0x1d')](_0x4e3b6e);}return _0x89b2fd[_0xbcca('0x1e')]();};}function saveUpdates(_0x1ab1b3,_0x172fc5){return function(_0x19bdde){if(_0x19bdde){return _0x19bdde[_0xbcca('0x1f')](_0x1ab1b3)[_0xbcca('0x20')](function(_0x4480e1){return _0x4480e1;});}return null;};}function removeEntity(_0x280ef3,_0x20e1e0){return function(_0x9f7741){if(_0x9f7741){return _0x9f7741[_0xbcca('0x21')]()['then'](function(){_0x280ef3[_0xbcca('0x16')](0xcc)[_0xbcca('0x15')]();});}};}function handleEntityNotFound(_0x274dd2,_0x78274a){return function(_0xb01999){if(!_0xb01999){_0x274dd2['sendStatus'](0x194);}return _0xb01999;};}function handleError(_0xfbbd8b,_0x40732f){_0x40732f=_0x40732f||0x1f4;return function(_0x321e38){logger[_0xbcca('0x22')](_0x321e38[_0xbcca('0x23')]);if(_0x321e38['name']){delete _0x321e38[_0xbcca('0x24')];}_0xfbbd8b[_0xbcca('0x16')](_0x40732f)[_0xbcca('0x25')](_0x321e38);};}exports['index']=function(_0x55faea,_0x59aade){var _0x5d61bb={},_0x4e3946={},_0x281328={'count':0x0,'rows':[]};var _0x3ab831=_[_0xbcca('0x26')](db[_0xbcca('0x27')][_0xbcca('0x28')],function(_0x52634e){return{'name':_0x52634e[_0xbcca('0x29')],'type':_0x52634e[_0xbcca('0x2a')][_0xbcca('0x2b')]};});_0x4e3946[_0xbcca('0x2c')]=_[_0xbcca('0x26')](_0x3ab831,'name');_0x4e3946[_0xbcca('0x2d')]=_['keys'](_0x55faea['query']);_0x4e3946[_0xbcca('0x2e')]=_[_0xbcca('0x2f')](_0x4e3946[_0xbcca('0x2c')],_0x4e3946[_0xbcca('0x2d')]);_0x5d61bb[_0xbcca('0x30')]=_[_0xbcca('0x2f')](_0x4e3946['model'],qs[_0xbcca('0x31')](_0x55faea[_0xbcca('0x2d')][_0xbcca('0x31')]));_0x5d61bb[_0xbcca('0x30')]=_0x5d61bb[_0xbcca('0x30')]['length']?_0x5d61bb[_0xbcca('0x30')]:_0x4e3946[_0xbcca('0x2c')];if(!_0x55faea[_0xbcca('0x2d')][_0xbcca('0x32')](_0xbcca('0x33'))){_0x5d61bb['limit']=qs[_0xbcca('0x19')](_0x55faea[_0xbcca('0x2d')][_0xbcca('0x19')]);_0x5d61bb['offset']=qs['offset'](_0x55faea['query'][_0xbcca('0x34')]);}_0x5d61bb[_0xbcca('0x35')]=qs[_0xbcca('0x36')](_0x55faea[_0xbcca('0x2d')][_0xbcca('0x36')]);_0x5d61bb[_0xbcca('0x37')]=qs[_0xbcca('0x2e')](_[_0xbcca('0x38')](_0x55faea['query'],_0x4e3946['filters']),_0x3ab831);if(_0x55faea[_0xbcca('0x2d')][_0xbcca('0x39')]){_0x5d61bb['where']=_['merge'](_0x5d61bb[_0xbcca('0x37')],{'$or':_[_0xbcca('0x26')](_0x3ab831,function(_0x2111df){if(_0x2111df[_0xbcca('0x2a')]!==_0xbcca('0x3a')){var _0x3eff7d={};_0x3eff7d[_0x2111df[_0xbcca('0x24')]]={'$like':'%'+_0x55faea['query'][_0xbcca('0x39')]+'%'};return _0x3eff7d;}})});}_0x5d61bb=_[_0xbcca('0x3b')]({},_0x5d61bb,_0x55faea[_0xbcca('0x3c')]);var _0x56a9cf={'where':_0x5d61bb[_0xbcca('0x37')]};return db[_0xbcca('0x27')][_0xbcca('0x18')](_0x56a9cf)['then'](function(_0x555d74){_0x281328[_0xbcca('0x18')]=_0x555d74;if(_0x55faea[_0xbcca('0x2d')][_0xbcca('0x3d')]){_0x5d61bb['include']=[{'all':!![]}];}return db[_0xbcca('0x27')]['findAll'](_0x5d61bb);})[_0xbcca('0x20')](function(_0x4223ff){_0x281328[_0xbcca('0x3e')]=_0x4223ff;return _0x281328;})['then'](respondWithFilteredResult(_0x59aade,_0x5d61bb))[_0xbcca('0x3f')](handleError(_0x59aade,null));};exports[_0xbcca('0x40')]=function(_0x337706,_0x355242){var _0x41e805={'raw':!![],'where':{'id':_0x337706['params']['id']}},_0x49a713={};_0x49a713['model']=_[_0xbcca('0x41')](db[_0xbcca('0x27')][_0xbcca('0x28')]);_0x49a713[_0xbcca('0x2d')]=_[_0xbcca('0x41')](_0x337706[_0xbcca('0x2d')]);_0x49a713[_0xbcca('0x2e')]=_[_0xbcca('0x2f')](_0x49a713[_0xbcca('0x2c')],_0x49a713[_0xbcca('0x2d')]);_0x41e805['attributes']=_[_0xbcca('0x2f')](_0x49a713[_0xbcca('0x2c')],qs[_0xbcca('0x31')](_0x337706[_0xbcca('0x2d')]['fields']));_0x41e805[_0xbcca('0x30')]=_0x41e805[_0xbcca('0x30')][_0xbcca('0x42')]?_0x41e805[_0xbcca('0x30')]:_0x49a713[_0xbcca('0x2c')];if(_0x337706['query'][_0xbcca('0x3d')]){_0x41e805[_0xbcca('0x43')]=[{'all':!![]}];}_0x41e805=_['merge']({},_0x41e805,_0x337706[_0xbcca('0x3c')]);return db[_0xbcca('0x27')][_0xbcca('0x44')](_0x41e805)[_0xbcca('0x20')](handleEntityNotFound(_0x355242,null))[_0xbcca('0x20')](respondWithResult(_0x355242,null))[_0xbcca('0x3f')](handleError(_0x355242,null));};exports[_0xbcca('0x45')]=function(_0x8a27ec,_0x3e23fe){return db[_0xbcca('0x27')][_0xbcca('0x45')](_0x8a27ec[_0xbcca('0x46')],{})[_0xbcca('0x20')](respondWithResult(_0x3e23fe,0xc9))[_0xbcca('0x3f')](handleError(_0x3e23fe,null));};exports['update']=function(_0x5b97b7,_0x202ea9){if(_0x5b97b7['body']['id']){delete _0x5b97b7['body']['id'];}return db[_0xbcca('0x27')][_0xbcca('0x44')]({'where':{'id':_0x5b97b7[_0xbcca('0x47')]['id']}})[_0xbcca('0x20')](handleEntityNotFound(_0x202ea9,null))['then'](saveUpdates(_0x5b97b7[_0xbcca('0x46')],null))['then'](respondWithResult(_0x202ea9,null))['catch'](handleError(_0x202ea9,null));};exports['destroy']=function(_0x1c72f7,_0x2e7f9b){return db['MailTransferReport'][_0xbcca('0x44')]({'where':{'id':_0x1c72f7[_0xbcca('0x47')]['id']}})[_0xbcca('0x20')](handleEntityNotFound(_0x2e7f9b,null))[_0xbcca('0x20')](removeEntity(_0x2e7f9b,null))[_0xbcca('0x3f')](handleError(_0x2e7f9b,null));};exports['describe']=function(_0x3072ba,_0x1ac8f2){return db[_0xbcca('0x27')][_0xbcca('0x48')]()[_0xbcca('0x20')](respondWithResult(_0x1ac8f2,null))[_0xbcca('0x3f')](handleError(_0x1ac8f2,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index fa3a68e..d04b50b 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 _0xc737=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','MailTransferReport','lodash'];(function(_0x4e43be,_0x1e2396){var _0x567e68=function(_0x1bd7f7){while(--_0x1bd7f7){_0x4e43be['push'](_0x4e43be['shift']());}};_0x567e68(++_0x1e2396);}(_0xc737,0x8e));var _0x7c73=function(_0x378521,_0x2d38ca){_0x378521=_0x378521-0x0;var _0x565f03=_0xc737[_0x378521];return _0x565f03;};'use strict';var _=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var logger=require('../../config/logger')(_0x7c73('0x2'));var moment=require(_0x7c73('0x3'));var BPromise=require(_0x7c73('0x4'));var rp=require(_0x7c73('0x5'));var fs=require('fs');var path=require(_0x7c73('0x6'));var rimraf=require(_0x7c73('0x7'));var config=require(_0x7c73('0x8'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x1eb29f,_0x2f09f7){return _0x1eb29f[_0x7c73('0x9')](_0x7c73('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xba6c=['report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','MailTransferReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba6c,0x113));var _0xcba6=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0xba6c[_0x5a2d95];return _0x2c3986;};'use strict';var _=require(_0xcba6('0x0'));var util=require('util');var logger=require(_0xcba6('0x1'))(_0xcba6('0x2'));var moment=require(_0xcba6('0x3'));var BPromise=require(_0xcba6('0x4'));var rp=require(_0xcba6('0x5'));var fs=require('fs');var path=require(_0xcba6('0x6'));var rimraf=require(_0xcba6('0x7'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0xcba6('0x8')]=function(_0x1fd901,_0x34d35d){return _0x1fd901[_0xcba6('0x9')](_0xcba6('0xa'),attributes,{'tableName':_0xcba6('0xb'),'paranoid':![],'indexes':[{'name':_0xcba6('0xc'),'fields':[_0xcba6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index adc06bd..f3b7a50 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 _0x1b06=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0x1b06,0x1ea));var _0x61b0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1b06[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x61b0('0x0'));var util=require(_0x61b0('0x1'));var moment=require(_0x61b0('0x2'));var BPromise=require(_0x61b0('0x3'));var rs=require(_0x61b0('0x4'));var fs=require('fs');var Redis=require(_0x61b0('0x5'));var db=require(_0x61b0('0x6'))['db'];var utils=require(_0x61b0('0x7'));var logger=require(_0x61b0('0x8'))(_0x61b0('0x9'));var config=require(_0x61b0('0xa'));var jayson=require(_0x61b0('0xb'));var client=jayson[_0x61b0('0xc')][_0x61b0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x371f4c,_0x4542f4,_0x1b1301){return new BPromise(function(_0x303530,_0x11a9a2){return client[_0x61b0('0xe')](_0x371f4c,_0x1b1301)[_0x61b0('0xf')](function(_0x171b21){logger[_0x61b0('0x10')](_0x61b0('0x11'),_0x4542f4,_0x61b0('0x12'));logger[_0x61b0('0x13')](_0x61b0('0x14'),_0x4542f4,'request\x20sent',JSON[_0x61b0('0x15')](_0x171b21));if(_0x171b21[_0x61b0('0x16')]){if(_0x171b21[_0x61b0('0x16')]['code']===0x1f4){logger[_0x61b0('0x16')](_0x61b0('0x11'),_0x4542f4,_0x171b21[_0x61b0('0x16')]['message']);return _0x11a9a2(_0x171b21['error'][_0x61b0('0x17')]);}logger[_0x61b0('0x16')](_0x61b0('0x11'),_0x4542f4,_0x171b21[_0x61b0('0x16')][_0x61b0('0x17')]);return _0x303530(_0x171b21['error'][_0x61b0('0x17')]);}else{logger[_0x61b0('0x10')](_0x61b0('0x11'),_0x4542f4,_0x61b0('0x12'));_0x303530(_0x171b21[_0x61b0('0x18')][_0x61b0('0x17')]);}})[_0x61b0('0x19')](function(_0x289747){logger[_0x61b0('0x16')]('MailTransferReport,\x20%s,\x20%s',_0x4542f4,_0x289747);_0x11a9a2(_0x289747);});});} \ No newline at end of file +var _0xaac2=['result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xaac2,0xde));var _0x2aac=function(_0xe87fba,_0x4ea6f9){_0xe87fba=_0xe87fba-0x0;var _0x2b2ed0=_0xaac2[_0xe87fba];return _0x2b2ed0;};'use strict';var _=require(_0x2aac('0x0'));var util=require(_0x2aac('0x1'));var moment=require('moment');var BPromise=require(_0x2aac('0x2'));var rs=require(_0x2aac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2aac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2aac('0x5'))(_0x2aac('0x6'));var config=require(_0x2aac('0x7'));var jayson=require(_0x2aac('0x8'));var client=jayson[_0x2aac('0x9')][_0x2aac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a116b,_0x457281,_0x262a2c){return new BPromise(function(_0xc4a7a,_0x25198e){return client[_0x2aac('0xb')](_0x1a116b,_0x262a2c)[_0x2aac('0xc')](function(_0x4e0ac2){logger['info'](_0x2aac('0xd'),_0x457281,'request\x20sent');logger[_0x2aac('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x457281,'request\x20sent',JSON[_0x2aac('0xf')](_0x4e0ac2));if(_0x4e0ac2[_0x2aac('0x10')]){if(_0x4e0ac2[_0x2aac('0x10')][_0x2aac('0x11')]===0x1f4){logger[_0x2aac('0x10')](_0x2aac('0xd'),_0x457281,_0x4e0ac2['error']['message']);return _0x25198e(_0x4e0ac2[_0x2aac('0x10')][_0x2aac('0x12')]);}logger[_0x2aac('0x10')](_0x2aac('0xd'),_0x457281,_0x4e0ac2[_0x2aac('0x10')][_0x2aac('0x12')]);return _0xc4a7a(_0x4e0ac2[_0x2aac('0x10')][_0x2aac('0x12')]);}else{logger['info'](_0x2aac('0xd'),_0x457281,_0x2aac('0x13'));_0xc4a7a(_0x4e0ac2[_0x2aac('0x14')][_0x2aac('0x12')]);}})[_0x2aac('0x15')](function(_0x5f1cea){logger[_0x2aac('0x10')](_0x2aac('0xd'),_0x457281,_0x5f1cea);_0x25198e(_0x5f1cea);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index d45b806..a3ad116 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 _0xe6fd=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x5baec5,_0x3bb3ec){var _0x5506b4=function(_0x54aca3){while(--_0x54aca3){_0x5baec5['push'](_0x5baec5['shift']());}};_0x5506b4(++_0x3bb3ec);}(_0xe6fd,0x1a3));var _0xde6f=function(_0x1dab19,_0x3ac052){_0x1dab19=_0x1dab19-0x0;var _0x1f5fcc=_0xe6fd[_0x1dab19];return _0x1f5fcc;};'use strict';var multer=require(_0xde6f('0x0'));var util=require(_0xde6f('0x1'));var path=require(_0xde6f('0x2'));var timeout=require(_0xde6f('0x3'));var express=require(_0xde6f('0x4'));var router=express[_0xde6f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xde6f('0x6'));var interaction=require(_0xde6f('0x7'));var config=require(_0xde6f('0x8'));var controller=require(_0xde6f('0x9'));router[_0xde6f('0xa')]('/',auth[_0xde6f('0xb')](),controller[_0xde6f('0xc')]);router[_0xde6f('0xa')](_0xde6f('0xd'),auth['isAuthenticated'](),controller[_0xde6f('0xe')]);router[_0xde6f('0xa')](_0xde6f('0xf'),auth[_0xde6f('0xb')](),controller[_0xde6f('0x10')]);router[_0xde6f('0x11')]('/',auth[_0xde6f('0xb')](),controller[_0xde6f('0x12')]);router[_0xde6f('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xde6f('0x14')](_0xde6f('0xf'),auth[_0xde6f('0xb')](),controller[_0xde6f('0x15')]);module[_0xde6f('0x16')]=router; \ No newline at end of file +var _0x4c3d=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4c3d,0xa4));var _0xd4c3=function(_0x562140,_0x391fd0){_0x562140=_0x562140-0x0;var _0x3b51b2=_0x4c3d[_0x562140];return _0x3b51b2;};'use strict';var multer=require('multer');var util=require(_0xd4c3('0x0'));var path=require(_0xd4c3('0x1'));var timeout=require(_0xd4c3('0x2'));var express=require(_0xd4c3('0x3'));var router=express[_0xd4c3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd4c3('0x5'));var interaction=require(_0xd4c3('0x6'));var config=require(_0xd4c3('0x7'));var controller=require(_0xd4c3('0x8'));router[_0xd4c3('0x9')]('/',auth[_0xd4c3('0xa')](),controller[_0xd4c3('0xb')]);router[_0xd4c3('0x9')](_0xd4c3('0xc'),auth[_0xd4c3('0xa')](),controller[_0xd4c3('0xd')]);router[_0xd4c3('0x9')](_0xd4c3('0xe'),auth[_0xd4c3('0xa')](),controller[_0xd4c3('0xf')]);router[_0xd4c3('0x10')]('/',auth[_0xd4c3('0xa')](),controller[_0xd4c3('0x11')]);router[_0xd4c3('0x12')](_0xd4c3('0xe'),auth[_0xd4c3('0xa')](),controller[_0xd4c3('0x13')]);router[_0xd4c3('0x14')](_0xd4c3('0xe'),auth[_0xd4c3('0xa')](),controller[_0xd4c3('0x15')]);module[_0xd4c3('0x16')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index b736c34..de80ee0 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 _0xe739=['setDataValue','exitAt','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds'];(function(_0x3b7991,_0x54bd04){var _0x3941c6=function(_0x53bd0a){while(--_0x53bd0a){_0x3b7991['push'](_0x3b7991['shift']());}};_0x3941c6(++_0x54bd04);}(_0xe739,0x105));var _0x9e73=function(_0x3797b9,_0x42409d){_0x3797b9=_0x3797b9-0x0;var _0x42fee5=_0xe739[_0x3797b9];return _0x42fee5;};'use strict';var Sequelize=require(_0x9e73('0x0'));var moment=require('moment');module[_0x9e73('0x1')]={'channel':{'type':Sequelize[_0x9e73('0x2')]},'membername':{'type':Sequelize[_0x9e73('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x9e73('0x3')},'duration':{'type':Sequelize[_0x9e73('0x4')]},'enterAt':{'type':Sequelize[_0x9e73('0x5')]},'exitAt':{'type':Sequelize[_0x9e73('0x5')],'set':function(_0x4cb2ed){var _0x3db8fa=moment(_0x4cb2ed);var _0x26cb5b=moment(this[_0x9e73('0x6')]('enterAt'));var _0xa49f86=_0x3db8fa[_0x9e73('0x7')](_0x26cb5b,_0x9e73('0x8'));this[_0x9e73('0x9')](_0x9e73('0xa'),_0x4cb2ed);this[_0x9e73('0x9')]('duration',_0xa49f86||null);}},'data1':{'type':Sequelize[_0x9e73('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x9e73('0xb')},'data3':{'type':Sequelize['STRING'],'comment':_0x9e73('0xc')},'data4':{'type':Sequelize[_0x9e73('0x2')],'comment':_0x9e73('0xd')},'data5':{'type':Sequelize['STRING'],'comment':_0x9e73('0xe')},'role':{'type':Sequelize[_0x9e73('0x2')]},'internal':{'type':Sequelize[_0x9e73('0x4')]},'uniqueid':{'type':Sequelize[_0x9e73('0x2')]}}; \ No newline at end of file +var _0x2948=['LOGIN,\x20PAUSE,\x20TALKING','DATE','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE'];(function(_0x2d3664,_0x25af46){var _0x57525f=function(_0x2feaaf){while(--_0x2feaaf){_0x2d3664['push'](_0x2d3664['shift']());}};_0x57525f(++_0x25af46);}(_0x2948,0xcb));var _0x8294=function(_0x12512d,_0x490cfc){_0x12512d=_0x12512d-0x0;var _0x1f7362=_0x2948[_0x12512d];return _0x1f7362;};'use strict';var Sequelize=require(_0x8294('0x0'));var moment=require(_0x8294('0x1'));module[_0x8294('0x2')]={'channel':{'type':Sequelize[_0x8294('0x3')]},'membername':{'type':Sequelize[_0x8294('0x3')]},'interface':{'type':Sequelize[_0x8294('0x3')]},'type':{'type':Sequelize[_0x8294('0x3')],'defaultValue':_0x8294('0x4'),'comment':_0x8294('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x8294('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x11c415){var _0x26128c=moment(_0x11c415);var _0x39aa65=moment(this['getDataValue']('enterAt'));var _0x56f7c8=_0x26128c['diff'](_0x39aa65,_0x8294('0x7'));this[_0x8294('0x8')]('exitAt',_0x11c415);this[_0x8294('0x8')](_0x8294('0x9'),_0x56f7c8||null);}},'data1':{'type':Sequelize[_0x8294('0x3')],'comment':_0x8294('0xa')},'data2':{'type':Sequelize[_0x8294('0x3')],'comment':_0x8294('0xb')},'data3':{'type':Sequelize['STRING'],'comment':_0x8294('0xc')},'data4':{'type':Sequelize[_0x8294('0x3')],'comment':_0x8294('0xd')},'data5':{'type':Sequelize[_0x8294('0x3')],'comment':_0x8294('0xe')},'role':{'type':Sequelize[_0x8294('0x3')]},'internal':{'type':Sequelize[_0x8294('0xf')]},'uniqueid':{'type':Sequelize[_0x8294('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 1899bc4..b74af0c 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x2eefd2,_0x3489cb){var _0xbc4f2=function(_0x130930){while(--_0x130930){_0x2eefd2['push'](_0x2eefd2['shift']());}};_0xbc4f2(++_0x3489cb);}(_0x3e74,0x175));var _0x43e7=function(_0x2aaf8c,_0x904177){_0x2aaf8c=_0x2aaf8c-0x0;var _0x10db05=_0x3e74[_0x2aaf8c];return _0x10db05;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','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','../../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','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x338b0a,_0x429367){var _0x14d141=function(_0x409e26){while(--_0x409e26){_0x338b0a['push'](_0x338b0a['shift']());}};_0x14d141(++_0x429367);}(_0x7217,0x19e));var _0x7721=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x7217[_0x2bf141];return _0x48277b;};'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={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index df7a90a..4f05059 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 _0x40b7=['define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x40b7,0x1e2));var _0x740b=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x40b7[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0x740b('0x0'));var util=require(_0x740b('0x1'));var logger=require(_0x740b('0x2'))(_0x740b('0x3'));var moment=require(_0x740b('0x4'));var BPromise=require('bluebird');var rp=require(_0x740b('0x5'));var fs=require('fs');var path=require(_0x740b('0x6'));var rimraf=require(_0x740b('0x7'));var config=require(_0x740b('0x8'));var attributes=require(_0x740b('0x9'));module[_0x740b('0xa')]=function(_0x551015,_0x2c68c0){return _0x551015[_0x740b('0xb')](_0x740b('0xc'),attributes,{'tableName':_0x740b('0xd'),'paranoid':![],'indexes':[{'name':_0x740b('0xe'),'fields':[_0x740b('0xf'),_0x740b('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c34=['membername','interface','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface'];(function(_0x3099a9,_0x418933){var _0x551c54=function(_0x4855fc){while(--_0x4855fc){_0x3099a9['push'](_0x3099a9['shift']());}};_0x551c54(++_0x418933);}(_0x3c34,0x14c));var _0x43c3=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0x3c34[_0x5ecadc];return _0x565037;};'use strict';var _=require(_0x43c3('0x0'));var util=require(_0x43c3('0x1'));var logger=require(_0x43c3('0x2'))(_0x43c3('0x3'));var moment=require(_0x43c3('0x4'));var BPromise=require(_0x43c3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x43c3('0x6'));var config=require(_0x43c3('0x7'));var attributes=require(_0x43c3('0x8'));module[_0x43c3('0x9')]=function(_0x3b7cdd,_0x49135e){return _0x3b7cdd['define'](_0x43c3('0xa'),attributes,{'tableName':_0x43c3('0xb'),'paranoid':![],'indexes':[{'name':_0x43c3('0xc'),'fields':[_0x43c3('0xd'),_0x43c3('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 386a0bc..f9462d6 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 _0xa1aa=['jayson/promise','http','request','then','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','catch','CreateMemberReport','body','update','UpdateMemberReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x490a0e,_0x48281d){var _0x1fed23=function(_0x5a62f8){while(--_0x5a62f8){_0x490a0e['push'](_0x490a0e['shift']());}};_0x1fed23(++_0x48281d);}(_0xa1aa,0x88));var _0xaa1a=function(_0x57b53f,_0x84cd4e){_0x57b53f=_0x57b53f-0x0;var _0xfff606=_0xa1aa[_0x57b53f];return _0xfff606;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa1a('0x0'));var BPromise=require(_0xaa1a('0x1'));var rs=require(_0xaa1a('0x2'));var fs=require('fs');var Redis=require(_0xaa1a('0x3'));var db=require(_0xaa1a('0x4'))['db'];var utils=require(_0xaa1a('0x5'));var logger=require(_0xaa1a('0x6'))('rpc');var config=require(_0xaa1a('0x7'));var jayson=require(_0xaa1a('0x8'));var client=jayson['client'][_0xaa1a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15b767,_0x3e2ff3,_0x1a289d){return new BPromise(function(_0x253dc7,_0x413732){return client[_0xaa1a('0xa')](_0x15b767,_0x1a289d)[_0xaa1a('0xb')](function(_0x2220ec){logger['info'](_0xaa1a('0xc'),_0x3e2ff3,'request\x20sent');logger[_0xaa1a('0xd')](_0xaa1a('0xe'),_0x3e2ff3,_0xaa1a('0xf'),JSON[_0xaa1a('0x10')](_0x2220ec));if(_0x2220ec[_0xaa1a('0x11')]){if(_0x2220ec[_0xaa1a('0x11')][_0xaa1a('0x12')]===0x1f4){logger[_0xaa1a('0x11')](_0xaa1a('0xc'),_0x3e2ff3,_0x2220ec[_0xaa1a('0x11')][_0xaa1a('0x13')]);return _0x413732(_0x2220ec['error']['message']);}logger[_0xaa1a('0x11')](_0xaa1a('0xc'),_0x3e2ff3,_0x2220ec[_0xaa1a('0x11')][_0xaa1a('0x13')]);return _0x253dc7(_0x2220ec[_0xaa1a('0x11')][_0xaa1a('0x13')]);}else{logger['info'](_0xaa1a('0xc'),_0x3e2ff3,_0xaa1a('0xf'));_0x253dc7(_0x2220ec['result'][_0xaa1a('0x13')]);}})['catch'](function(_0x4f2807){logger[_0xaa1a('0x11')](_0xaa1a('0xc'),_0x3e2ff3,_0x4f2807);_0x413732(_0x4f2807);});});}exports[_0xaa1a('0x14')]=function(_0x123ab4){var _0x2c45f1=this;return new Promise(function(_0x35e9d5,_0x2cc43f){return db[_0xaa1a('0x15')][_0xaa1a('0x16')]({'raw':_0x123ab4[_0xaa1a('0x17')]?_0x123ab4['options'][_0xaa1a('0x18')]===undefined?!![]:![]:!![],'where':_0x123ab4[_0xaa1a('0x17')]?_0x123ab4[_0xaa1a('0x17')][_0xaa1a('0x19')]||null:null,'attributes':_0x123ab4[_0xaa1a('0x17')]?_0x123ab4[_0xaa1a('0x17')][_0xaa1a('0x1a')]||null:null,'limit':_0x123ab4[_0xaa1a('0x17')]?_0x123ab4['options'][_0xaa1a('0x1b')]||null:null,'include':_0x123ab4[_0xaa1a('0x17')]?_0x123ab4[_0xaa1a('0x17')][_0xaa1a('0x1c')]?_[_0xaa1a('0x1d')](_0x123ab4[_0xaa1a('0x17')][_0xaa1a('0x1c')],function(_0x221409){return{'model':db[_0x221409[_0xaa1a('0x1e')]],'as':_0x221409['as'],'attributes':_0x221409['attributes'],'include':_0x221409[_0xaa1a('0x1c')]?_['map'](_0x221409[_0xaa1a('0x1c')],function(_0x408773){return{'model':db[_0x408773[_0xaa1a('0x1e')]],'as':_0x408773['as'],'attributes':_0x408773[_0xaa1a('0x1a')],'include':_0x408773[_0xaa1a('0x1c')]?_[_0xaa1a('0x1d')](_0x408773[_0xaa1a('0x1c')],function(_0x5523fa){return{'model':db[_0x5523fa[_0xaa1a('0x1e')]],'as':_0x5523fa['as'],'attributes':_0x5523fa[_0xaa1a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x232c73){logger['info'](_0xaa1a('0x14'),_0x123ab4);logger[_0xaa1a('0xd')](_0xaa1a('0x14'),_0x123ab4,JSON['stringify'](_0x232c73));_0x35e9d5(_0x232c73);})[_0xaa1a('0x1f')](function(_0x2de205){logger[_0xaa1a('0x11')](_0xaa1a('0x14'),_0x2de205['message'],_0x123ab4);_0x2cc43f(_0x2c45f1['error'](0x1f4,_0x2de205[_0xaa1a('0x13')]));});});};exports[_0xaa1a('0x20')]=function(_0x33ca45){var _0x3d10c7=this;return new Promise(function(_0x14a4d6,_0x3fcf7a){return db['MemberReport']['create'](_0x33ca45[_0xaa1a('0x21')],{'raw':_0x33ca45[_0xaa1a('0x17')]?_0x33ca45[_0xaa1a('0x17')][_0xaa1a('0x18')]===undefined?!![]:![]:!![]})[_0xaa1a('0xb')](function(_0xcee2d9){logger['info'](_0xaa1a('0x20'),_0x33ca45);logger[_0xaa1a('0xd')](_0xaa1a('0x20'),_0x33ca45,JSON[_0xaa1a('0x10')](_0xcee2d9));_0x14a4d6(_0xcee2d9);})[_0xaa1a('0x1f')](function(_0x471e8f){logger[_0xaa1a('0x11')](_0xaa1a('0x20'),_0x471e8f[_0xaa1a('0x13')],_0x33ca45);_0x3fcf7a(_0x3d10c7[_0xaa1a('0x11')](0x1f4,_0x471e8f[_0xaa1a('0x13')]));});});};exports['UpdateMemberReport']=function(_0x1e76d4){var _0x53be22=this;return new Promise(function(_0x42c57e,_0x1231f6){return db['MemberReport'][_0xaa1a('0x22')](_0x1e76d4[_0xaa1a('0x21')],{'raw':_0x1e76d4[_0xaa1a('0x17')]?_0x1e76d4['options'][_0xaa1a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e76d4[_0xaa1a('0x17')]?_0x1e76d4[_0xaa1a('0x17')][_0xaa1a('0x19')]||null:null,'attributes':_0x1e76d4[_0xaa1a('0x17')]?_0x1e76d4[_0xaa1a('0x17')][_0xaa1a('0x1a')]||null:null,'limit':_0x1e76d4['options']?_0x1e76d4[_0xaa1a('0x17')]['limit']||null:null})[_0xaa1a('0xb')](function(_0x22a4ef){logger['info'](_0xaa1a('0x23'),_0x1e76d4);logger[_0xaa1a('0xd')](_0xaa1a('0x23'),_0x1e76d4,JSON[_0xaa1a('0x10')](_0x22a4ef));_0x42c57e(_0x22a4ef);})[_0xaa1a('0x1f')](function(_0x4004c1){logger[_0xaa1a('0x11')](_0xaa1a('0x23'),_0x4004c1[_0xaa1a('0x13')],_0x1e76d4);_0x1231f6(_0x53be22[_0xaa1a('0x11')](0x1f4,_0x4004c1[_0xaa1a('0x13')]));});});}; \ No newline at end of file +var _0x187d=['model','create','body','then','CreateMemberReport','UpdateMemberReport','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','include'];(function(_0x1f33db,_0x3263f3){var _0x4c1a6e=function(_0x388fe6){while(--_0x388fe6){_0x1f33db['push'](_0x1f33db['shift']());}};_0x4c1a6e(++_0x3263f3);}(_0x187d,0x93));var _0xd187=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x187d[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('MemberReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});}exports[_0xd187('0x15')]=function(_0x374fe0){var _0x10d9fd=this;return new Promise(function(_0x21df74,_0x253a7e){return db[_0xd187('0x16')][_0xd187('0x17')]({'raw':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')][_0xd187('0x19')]===undefined?!![]:![]:!![],'where':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')]['where']||null:null,'attributes':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')][_0xd187('0x1a')]||null:null,'limit':_0x374fe0['options']?_0x374fe0['options']['limit']||null:null,'include':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')][_0xd187('0x1b')]?_['map'](_0x374fe0[_0xd187('0x18')]['include'],function(_0x145771){return{'model':db[_0x145771['model']],'as':_0x145771['as'],'attributes':_0x145771[_0xd187('0x1a')],'include':_0x145771['include']?_['map'](_0x145771[_0xd187('0x1b')],function(_0x4d992b){return{'model':db[_0x4d992b[_0xd187('0x1c')]],'as':_0x4d992b['as'],'attributes':_0x4d992b[_0xd187('0x1a')],'include':_0x4d992b['include']?_['map'](_0x4d992b[_0xd187('0x1b')],function(_0xeff822){return{'model':db[_0xeff822[_0xd187('0x1c')]],'as':_0xeff822['as'],'attributes':_0xeff822[_0xd187('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a20ed){logger[_0xd187('0xc')]('GetMemberReport',_0x374fe0);logger[_0xd187('0xf')](_0xd187('0x15'),_0x374fe0,JSON[_0xd187('0x11')](_0x2a20ed));_0x21df74(_0x2a20ed);})['catch'](function(_0x15e2e8){logger['error'](_0xd187('0x15'),_0x15e2e8[_0xd187('0x13')],_0x374fe0);_0x253a7e(_0x10d9fd[_0xd187('0x12')](0x1f4,_0x15e2e8[_0xd187('0x13')]));});});};exports['CreateMemberReport']=function(_0x140e54){var _0xb38778=this;return new Promise(function(_0x5bba10,_0x4cc587){return db[_0xd187('0x16')][_0xd187('0x1d')](_0x140e54[_0xd187('0x1e')],{'raw':_0x140e54[_0xd187('0x18')]?_0x140e54[_0xd187('0x18')][_0xd187('0x19')]===undefined?!![]:![]:!![]})[_0xd187('0x1f')](function(_0x4713df){logger['info'](_0xd187('0x20'),_0x140e54);logger[_0xd187('0xf')](_0xd187('0x20'),_0x140e54,JSON['stringify'](_0x4713df));_0x5bba10(_0x4713df);})[_0xd187('0x14')](function(_0x5393c5){logger[_0xd187('0x12')](_0xd187('0x20'),_0x5393c5[_0xd187('0x13')],_0x140e54);_0x4cc587(_0xb38778['error'](0x1f4,_0x5393c5['message']));});});};exports[_0xd187('0x21')]=function(_0x260549){var _0x549c6a=this;return new Promise(function(_0x4591e0,_0xa54b9e){return db[_0xd187('0x16')]['update'](_0x260549['body'],{'raw':_0x260549[_0xd187('0x18')]?_0x260549[_0xd187('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x260549['options']?_0x260549['options'][_0xd187('0x22')]||null:null,'attributes':_0x260549['options']?_0x260549[_0xd187('0x18')][_0xd187('0x1a')]||null:null,'limit':_0x260549['options']?_0x260549[_0xd187('0x18')]['limit']||null:null})[_0xd187('0x1f')](function(_0x2db36e){logger['info'](_0xd187('0x21'),_0x260549);logger[_0xd187('0xf')]('UpdateMemberReport',_0x260549,JSON[_0xd187('0x11')](_0x2db36e));_0x4591e0(_0x2db36e);})['catch'](function(_0x5f01b7){logger[_0xd187('0x12')](_0xd187('0x21'),_0x5f01b7[_0xd187('0x13')],_0x260549);_0xa54b9e(_0x549c6a[_0xd187('0x12')](0x1f4,_0x5f01b7[_0xd187('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index bf5cded..3696dae 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 _0x3697=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','util'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3697,0x1ea));var _0x7369=function(_0x14b558,_0x5a68d1){_0x14b558=_0x14b558-0x0;var _0x3f359f=_0x3697[_0x14b558];return _0x3f359f;};'use strict';var multer=require(_0x7369('0x0'));var util=require(_0x7369('0x1'));var path=require(_0x7369('0x2'));var timeout=require(_0x7369('0x3'));var express=require(_0x7369('0x4'));var router=express['Router']();var fs_extra=require(_0x7369('0x5'));var auth=require(_0x7369('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7369('0x7'));var controller=require(_0x7369('0x8'));router[_0x7369('0x9')]('/',controller[_0x7369('0xa')]);module[_0x7369('0xb')]=router; \ No newline at end of file +var _0x35b5=['./migration.controller','index','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x572f57,_0x2feb1c){var _0x42f1ec=function(_0x4e963){while(--_0x4e963){_0x572f57['push'](_0x572f57['shift']());}};_0x42f1ec(++_0x2feb1c);}(_0x35b5,0x1c4));var _0x535b=function(_0x5cda80,_0x303fa7){_0x5cda80=_0x5cda80-0x0;var _0x13b8b6=_0x35b5[_0x5cda80];return _0x13b8b6;};'use strict';var multer=require(_0x535b('0x0'));var util=require('util');var path=require(_0x535b('0x1'));var timeout=require(_0x535b('0x2'));var express=require(_0x535b('0x3'));var router=express[_0x535b('0x4')]();var fs_extra=require(_0x535b('0x5'));var auth=require(_0x535b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x535b('0x7'));var controller=require(_0x535b('0x8'));router['get']('/',controller[_0x535b('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 0c34c5a..84e9364 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 _0x3d31=['exports','STRING','version','sequelize'];(function(_0x36bd98,_0x4168ed){var _0x28ec9c=function(_0x4b029e){while(--_0x4b029e){_0x36bd98['push'](_0x36bd98['shift']());}};_0x28ec9c(++_0x4168ed);}(_0x3d31,0xe7));var _0x13d3=function(_0x556714,_0x491877){_0x556714=_0x556714-0x0;var _0x595daf=_0x3d31[_0x556714];return _0x595daf;};'use strict';var Sequelize=require(_0x13d3('0x0'));module[_0x13d3('0x1')]={'version':{'type':Sequelize[_0x13d3('0x2')],'unique':_0x13d3('0x3')}}; \ No newline at end of file +var _0xec50=['version','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec50,0x121));var _0x0ec5=function(_0x4d593e,_0x131776){_0x4d593e=_0x4d593e-0x0;var _0x31e2df=_0xec50[_0x4d593e];return _0x31e2df;};'use strict';var Sequelize=require('sequelize');module[_0x0ec5('0x0')]={'version':{'type':Sequelize[_0x0ec5('0x1')],'unique':_0x0ec5('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 1267e1d..f2afb4f 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 _0x8bce=['request-promise','moment','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','name','send','index','Migration','rawAttributes','fieldName','type','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x10c5f7,_0x45e07d){var _0x3e6ff9=function(_0x2109a7){while(--_0x2109a7){_0x10c5f7['push'](_0x10c5f7['shift']());}};_0x3e6ff9(++_0x45e07d);}(_0x8bce,0x1d1));var _0xe8bc=function(_0x2be71d,_0x5d4da5){_0x2be71d=_0x2be71d-0x0;var _0x496419=_0x8bce[_0x2be71d];return _0x496419;};'use strict';var emlformat=require(_0xe8bc('0x0'));var rimraf=require(_0xe8bc('0x1'));var zipdir=require(_0xe8bc('0x2'));var jsonpatch=require(_0xe8bc('0x3'));var rp=require(_0xe8bc('0x4'));var moment=require(_0xe8bc('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe8bc('0x6'));var path=require(_0xe8bc('0x7'));var sox=require(_0xe8bc('0x8'));var csv=require('to-csv');var ejs=require(_0xe8bc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe8bc('0xa'));var jsforce=require(_0xe8bc('0xb'));var deskjs=require(_0xe8bc('0xc'));var toCsv=require(_0xe8bc('0xd'));var querystring=require(_0xe8bc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe8bc('0xf'));var qs=require(_0xe8bc('0x10'));var as=require(_0xe8bc('0x11'));var hardwareService=require(_0xe8bc('0x12'));var logger=require('../../config/logger')(_0xe8bc('0x13'));var utils=require(_0xe8bc('0x14'));var config=require(_0xe8bc('0x15'));var licenseUtil=require(_0xe8bc('0x16'));var db=require(_0xe8bc('0x17'))['db'];function respondWithStatusCode(_0x12f7d6,_0xc34bc8){_0xc34bc8=_0xc34bc8||0xcc;return function(_0xf5e58f){if(_0xf5e58f){return _0x12f7d6[_0xe8bc('0x18')](_0xc34bc8);}return _0x12f7d6['status'](_0xc34bc8)[_0xe8bc('0x19')]();};}function respondWithResult(_0x231cc8,_0x428d59){_0x428d59=_0x428d59||0xc8;return function(_0x54356b){if(_0x54356b){return _0x231cc8[_0xe8bc('0x1a')](_0x428d59)['json'](_0x54356b);}};}function respondWithFilteredResult(_0x2650fa,_0x69850c){return function(_0x3e1ee6){if(_0x3e1ee6){var _0x2632f3=typeof _0x69850c[_0xe8bc('0x1b')]===_0xe8bc('0x1c')&&typeof _0x69850c[_0xe8bc('0x1d')]===_0xe8bc('0x1c');var _0xd9d89e=_0x3e1ee6[_0xe8bc('0x1e')];var _0x5f4a9c=_0x2632f3?0x0:_0x69850c['offset'];var _0x1de8e7=_0x2632f3?_0x3e1ee6[_0xe8bc('0x1e')]:_0x69850c[_0xe8bc('0x1b')]+_0x69850c[_0xe8bc('0x1d')];var _0x5e2cee;if(_0x1de8e7>=_0xd9d89e){_0x1de8e7=_0xd9d89e;_0x5e2cee=0xc8;}else{_0x5e2cee=0xce;}_0x2650fa[_0xe8bc('0x1a')](_0x5e2cee);return _0x2650fa[_0xe8bc('0x1f')](_0xe8bc('0x20'),_0x5f4a9c+'-'+_0x1de8e7+'/'+_0xd9d89e)[_0xe8bc('0x21')](_0x3e1ee6);}return null;};}function patchUpdates(_0x39e621){return function(_0x1bfb55){try{jsonpatch[_0xe8bc('0x22')](_0x1bfb55,_0x39e621,!![]);}catch(_0x11d1de){return BPromise['reject'](_0x11d1de);}return _0x1bfb55[_0xe8bc('0x23')]();};}function saveUpdates(_0x4d1ce8,_0x3cad72){return function(_0x26f39d){if(_0x26f39d){return _0x26f39d[_0xe8bc('0x24')](_0x4d1ce8)[_0xe8bc('0x25')](function(_0x10a04d){return _0x10a04d;});}return null;};}function removeEntity(_0x2c0ac4,_0x11bcc2){return function(_0x17e1de){if(_0x17e1de){return _0x17e1de[_0xe8bc('0x26')]()[_0xe8bc('0x25')](function(){_0x2c0ac4[_0xe8bc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x504eb0,_0x5b1674){return function(_0x4da5e9){if(!_0x4da5e9){_0x504eb0[_0xe8bc('0x18')](0x194);}return _0x4da5e9;};}function handleError(_0x3ed4a6,_0x559cc8){_0x559cc8=_0x559cc8||0x1f4;return function(_0x48aac7){logger['error'](_0x48aac7['stack']);if(_0x48aac7[_0xe8bc('0x27')]){delete _0x48aac7[_0xe8bc('0x27')];}_0x3ed4a6[_0xe8bc('0x1a')](_0x559cc8)[_0xe8bc('0x28')](_0x48aac7);};}exports[_0xe8bc('0x29')]=function(_0xa1b195,_0x2f4e3a){var _0x502bde={},_0x2e2ca1={},_0x4a729b={'count':0x0,'rows':[]};var _0x2da684=_['map'](db[_0xe8bc('0x2a')][_0xe8bc('0x2b')],function(_0x49ca28){return{'name':_0x49ca28[_0xe8bc('0x2c')],'type':_0x49ca28[_0xe8bc('0x2d')]['key']};});_0x2e2ca1[_0xe8bc('0x2e')]=_[_0xe8bc('0x2f')](_0x2da684,_0xe8bc('0x27'));_0x2e2ca1['query']=_[_0xe8bc('0x30')](_0xa1b195[_0xe8bc('0x31')]);_0x2e2ca1['filters']=_[_0xe8bc('0x32')](_0x2e2ca1[_0xe8bc('0x2e')],_0x2e2ca1[_0xe8bc('0x31')]);_0x502bde[_0xe8bc('0x33')]=_['intersection'](_0x2e2ca1['model'],qs[_0xe8bc('0x34')](_0xa1b195[_0xe8bc('0x31')][_0xe8bc('0x34')]));_0x502bde[_0xe8bc('0x33')]=_0x502bde['attributes'][_0xe8bc('0x35')]?_0x502bde[_0xe8bc('0x33')]:_0x2e2ca1[_0xe8bc('0x2e')];if(!_0xa1b195[_0xe8bc('0x31')][_0xe8bc('0x36')]('nolimit')){_0x502bde[_0xe8bc('0x1d')]=qs[_0xe8bc('0x1d')](_0xa1b195['query'][_0xe8bc('0x1d')]);_0x502bde[_0xe8bc('0x1b')]=qs[_0xe8bc('0x1b')](_0xa1b195[_0xe8bc('0x31')][_0xe8bc('0x1b')]);}_0x502bde[_0xe8bc('0x37')]=qs[_0xe8bc('0x38')](_0xa1b195[_0xe8bc('0x31')][_0xe8bc('0x38')]);_0x502bde['where']=qs[_0xe8bc('0x39')](_[_0xe8bc('0x3a')](_0xa1b195[_0xe8bc('0x31')],_0x2e2ca1[_0xe8bc('0x39')]),_0x2da684);if(_0xa1b195[_0xe8bc('0x31')][_0xe8bc('0x3b')]){_0x502bde[_0xe8bc('0x3c')]=_[_0xe8bc('0x3d')](_0x502bde[_0xe8bc('0x3c')],{'$or':_['map'](_0x2da684,function(_0x516d00){if(_0x516d00['type']!==_0xe8bc('0x3e')){var _0x1dec35={};_0x1dec35[_0x516d00[_0xe8bc('0x27')]]={'$like':'%'+_0xa1b195[_0xe8bc('0x31')][_0xe8bc('0x3b')]+'%'};return _0x1dec35;}})});}_0x502bde=_[_0xe8bc('0x3d')]({},_0x502bde,_0xa1b195[_0xe8bc('0x3f')]);var _0x2f5a37={'where':_0x502bde['where']};return db[_0xe8bc('0x2a')][_0xe8bc('0x1e')](_0x2f5a37)[_0xe8bc('0x25')](function(_0x22d7ed){_0x4a729b[_0xe8bc('0x1e')]=_0x22d7ed;if(_0xa1b195[_0xe8bc('0x31')][_0xe8bc('0x40')]){_0x502bde['include']=[{'all':!![]}];}return db[_0xe8bc('0x2a')][_0xe8bc('0x41')](_0x502bde);})[_0xe8bc('0x25')](function(_0x54808e){_0x4a729b['rows']=_0x54808e;return _0x4a729b;})[_0xe8bc('0x25')](respondWithFilteredResult(_0x2f4e3a,_0x502bde))[_0xe8bc('0x42')](handleError(_0x2f4e3a,null));}; \ No newline at end of file +var _0x37e2=['limit','undefined','count','set','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset'];(function(_0x15fb14,_0x56c859){var _0x571786=function(_0x10c2b3){while(--_0x10c2b3){_0x15fb14['push'](_0x15fb14['shift']());}};_0x571786(++_0x56c859);}(_0x37e2,0x17a));var _0x237e=function(_0x1db3ae,_0x21302e){_0x1db3ae=_0x1db3ae-0x0;var _0x3643ea=_0x37e2[_0x1db3ae];return _0x3643ea;};'use strict';var emlformat=require(_0x237e('0x0'));var rimraf=require(_0x237e('0x1'));var zipdir=require(_0x237e('0x2'));var jsonpatch=require(_0x237e('0x3'));var rp=require(_0x237e('0x4'));var moment=require(_0x237e('0x5'));var BPromise=require(_0x237e('0x6'));var Mustache=require(_0x237e('0x7'));var util=require(_0x237e('0x8'));var path=require(_0x237e('0x9'));var sox=require(_0x237e('0xa'));var csv=require(_0x237e('0xb'));var ejs=require(_0x237e('0xc'));var fs=require('fs');var fs_extra=require(_0x237e('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x237e('0xe'));var jsforce=require(_0x237e('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x237e('0x10'));var Papa=require(_0x237e('0x11'));var Redis=require(_0x237e('0x12'));var authService=require(_0x237e('0x13'));var qs=require(_0x237e('0x14'));var as=require(_0x237e('0x15'));var hardwareService=require(_0x237e('0x16'));var logger=require(_0x237e('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x237e('0x18'));var licenseUtil=require(_0x237e('0x19'));var db=require(_0x237e('0x1a'))['db'];function respondWithStatusCode(_0x496047,_0x35ccee){_0x35ccee=_0x35ccee||0xcc;return function(_0x116290){if(_0x116290){return _0x496047['sendStatus'](_0x35ccee);}return _0x496047[_0x237e('0x1b')](_0x35ccee)[_0x237e('0x1c')]();};}function respondWithResult(_0x2775cc,_0x56ffd0){_0x56ffd0=_0x56ffd0||0xc8;return function(_0x7377ee){if(_0x7377ee){return _0x2775cc[_0x237e('0x1b')](_0x56ffd0)['json'](_0x7377ee);}};}function respondWithFilteredResult(_0x3affbc,_0x9e8030){return function(_0x2a3203){if(_0x2a3203){var _0x153dfe=typeof _0x9e8030[_0x237e('0x1d')]==='undefined'&&typeof _0x9e8030[_0x237e('0x1e')]===_0x237e('0x1f');var _0x33e9bc=_0x2a3203['count'];var _0x57dff0=_0x153dfe?0x0:_0x9e8030['offset'];var _0x1e8b12=_0x153dfe?_0x2a3203[_0x237e('0x20')]:_0x9e8030[_0x237e('0x1d')]+_0x9e8030[_0x237e('0x1e')];var _0x356dd7;if(_0x1e8b12>=_0x33e9bc){_0x1e8b12=_0x33e9bc;_0x356dd7=0xc8;}else{_0x356dd7=0xce;}_0x3affbc[_0x237e('0x1b')](_0x356dd7);return _0x3affbc[_0x237e('0x21')]('Content-Range',_0x57dff0+'-'+_0x1e8b12+'/'+_0x33e9bc)[_0x237e('0x22')](_0x2a3203);}return null;};}function patchUpdates(_0x28b7f3){return function(_0x2f9192){try{jsonpatch[_0x237e('0x23')](_0x2f9192,_0x28b7f3,!![]);}catch(_0x554f29){return BPromise[_0x237e('0x24')](_0x554f29);}return _0x2f9192[_0x237e('0x25')]();};}function saveUpdates(_0x256830,_0x15f146){return function(_0x19cd6e){if(_0x19cd6e){return _0x19cd6e[_0x237e('0x26')](_0x256830)[_0x237e('0x27')](function(_0x133ece){return _0x133ece;});}return null;};}function removeEntity(_0x1c345d,_0x50a5f){return function(_0xfbad20){if(_0xfbad20){return _0xfbad20['destroy']()['then'](function(){_0x1c345d['status'](0xcc)[_0x237e('0x1c')]();});}};}function handleEntityNotFound(_0x2acd06,_0x15feac){return function(_0x5d6694){if(!_0x5d6694){_0x2acd06[_0x237e('0x28')](0x194);}return _0x5d6694;};}function handleError(_0x4ac0e7,_0x339b77){_0x339b77=_0x339b77||0x1f4;return function(_0x420e14){logger[_0x237e('0x29')](_0x420e14[_0x237e('0x2a')]);if(_0x420e14[_0x237e('0x2b')]){delete _0x420e14[_0x237e('0x2b')];}_0x4ac0e7[_0x237e('0x1b')](_0x339b77)[_0x237e('0x2c')](_0x420e14);};}exports[_0x237e('0x2d')]=function(_0x480403,_0x4447dc){var _0x46c58d={},_0x40a14a={},_0x2d9ed3={'count':0x0,'rows':[]};var _0x428dc0=_[_0x237e('0x2e')](db[_0x237e('0x2f')][_0x237e('0x30')],function(_0xead93f){return{'name':_0xead93f[_0x237e('0x31')],'type':_0xead93f['type']['key']};});_0x40a14a[_0x237e('0x32')]=_[_0x237e('0x2e')](_0x428dc0,_0x237e('0x2b'));_0x40a14a[_0x237e('0x33')]=_[_0x237e('0x34')](_0x480403[_0x237e('0x33')]);_0x40a14a[_0x237e('0x35')]=_['intersection'](_0x40a14a[_0x237e('0x32')],_0x40a14a['query']);_0x46c58d[_0x237e('0x36')]=_['intersection'](_0x40a14a[_0x237e('0x32')],qs[_0x237e('0x37')](_0x480403['query'][_0x237e('0x37')]));_0x46c58d['attributes']=_0x46c58d[_0x237e('0x36')]['length']?_0x46c58d[_0x237e('0x36')]:_0x40a14a[_0x237e('0x32')];if(!_0x480403['query']['hasOwnProperty']('nolimit')){_0x46c58d[_0x237e('0x1e')]=qs[_0x237e('0x1e')](_0x480403[_0x237e('0x33')][_0x237e('0x1e')]);_0x46c58d['offset']=qs[_0x237e('0x1d')](_0x480403[_0x237e('0x33')]['offset']);}_0x46c58d['order']=qs[_0x237e('0x38')](_0x480403[_0x237e('0x33')][_0x237e('0x38')]);_0x46c58d[_0x237e('0x39')]=qs[_0x237e('0x35')](_[_0x237e('0x3a')](_0x480403[_0x237e('0x33')],_0x40a14a[_0x237e('0x35')]),_0x428dc0);if(_0x480403['query'][_0x237e('0x3b')]){_0x46c58d[_0x237e('0x39')]=_[_0x237e('0x3c')](_0x46c58d[_0x237e('0x39')],{'$or':_['map'](_0x428dc0,function(_0x132ab5){if(_0x132ab5['type']!==_0x237e('0x3d')){var _0x586105={};_0x586105[_0x132ab5['name']]={'$like':'%'+_0x480403[_0x237e('0x33')][_0x237e('0x3b')]+'%'};return _0x586105;}})});}_0x46c58d=_['merge']({},_0x46c58d,_0x480403[_0x237e('0x3e')]);var _0x3b6371={'where':_0x46c58d['where']};return db[_0x237e('0x2f')][_0x237e('0x20')](_0x3b6371)[_0x237e('0x27')](function(_0x2bff30){_0x2d9ed3[_0x237e('0x20')]=_0x2bff30;if(_0x480403[_0x237e('0x33')][_0x237e('0x3f')]){_0x46c58d[_0x237e('0x40')]=[{'all':!![]}];}return db['Migration'][_0x237e('0x41')](_0x46c58d);})[_0x237e('0x27')](function(_0x518b3d){_0x2d9ed3[_0x237e('0x42')]=_0x518b3d;return _0x2d9ed3;})[_0x237e('0x27')](respondWithFilteredResult(_0x4447dc,_0x46c58d))[_0x237e('0x43')](handleError(_0x4447dc,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b7832ac..d4cd162 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 _0xeb97=['migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration'];(function(_0x2fc6ec,_0x21660c){var _0x1daab9=function(_0x180799){while(--_0x180799){_0x2fc6ec['push'](_0x2fc6ec['shift']());}};_0x1daab9(++_0x21660c);}(_0xeb97,0x88));var _0x7eb9=function(_0x4ff712,_0x1d225e){_0x4ff712=_0x4ff712-0x0;var _0x49c743=_0xeb97[_0x4ff712];return _0x49c743;};'use strict';var _=require(_0x7eb9('0x0'));var util=require(_0x7eb9('0x1'));var logger=require(_0x7eb9('0x2'))(_0x7eb9('0x3'));var moment=require(_0x7eb9('0x4'));var BPromise=require(_0x7eb9('0x5'));var rp=require(_0x7eb9('0x6'));var fs=require('fs');var path=require(_0x7eb9('0x7'));var rimraf=require(_0x7eb9('0x8'));var config=require(_0x7eb9('0x9'));var attributes=require(_0x7eb9('0xa'));module[_0x7eb9('0xb')]=function(_0x206612,_0x4a1b73){return _0x206612[_0x7eb9('0xc')](_0x7eb9('0xd'),attributes,{'tableName':_0x7eb9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x878f=['exports','Migration','migrations','lodash','moment','bluebird','path','../../config/environment','./migration.attributes'];(function(_0x4834f0,_0x488c5e){var _0x5569a3=function(_0x52b858){while(--_0x52b858){_0x4834f0['push'](_0x4834f0['shift']());}};_0x5569a3(++_0x488c5e);}(_0x878f,0x12c));var _0xf878=function(_0x1ae28c,_0x42a9b3){_0x1ae28c=_0x1ae28c-0x0;var _0x3b2a9e=_0x878f[_0x1ae28c];return _0x3b2a9e;};'use strict';var _=require(_0xf878('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf878('0x3'));var rimraf=require('rimraf');var config=require(_0xf878('0x4'));var attributes=require(_0xf878('0x5'));module[_0xf878('0x6')]=function(_0x385080,_0x5ec413){return _0x385080['define'](_0xf878('0x7'),attributes,{'tableName':_0xf878('0x8'),'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 fe36d18..43e40a1 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 _0x9c5e=['result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x1447d0,_0x116a20){_0x1447d0=_0x1447d0-0x0;var _0x270ec2=_0x9c5e[_0x1447d0];return _0x270ec2;};'use strict';var _=require(_0xe9c5('0x0'));var util=require(_0xe9c5('0x1'));var moment=require(_0xe9c5('0x2'));var BPromise=require(_0xe9c5('0x3'));var rs=require(_0xe9c5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe9c5('0x5'))(_0xe9c5('0x6'));var config=require('../../config/environment');var jayson=require(_0xe9c5('0x7'));var client=jayson[_0xe9c5('0x8')][_0xe9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6f6045,_0x5b1c04,_0x2fa290){return new BPromise(function(_0x34ee69,_0x228ef3){return client[_0xe9c5('0xa')](_0x6f6045,_0x2fa290)['then'](function(_0x596f4c){logger[_0xe9c5('0xb')](_0xe9c5('0xc'),_0x5b1c04,_0xe9c5('0xd'));logger[_0xe9c5('0xe')](_0xe9c5('0xf'),_0x5b1c04,_0xe9c5('0xd'),JSON[_0xe9c5('0x10')](_0x596f4c));if(_0x596f4c[_0xe9c5('0x11')]){if(_0x596f4c[_0xe9c5('0x11')][_0xe9c5('0x12')]===0x1f4){logger[_0xe9c5('0x11')](_0xe9c5('0xc'),_0x5b1c04,_0x596f4c[_0xe9c5('0x11')][_0xe9c5('0x13')]);return _0x228ef3(_0x596f4c[_0xe9c5('0x11')][_0xe9c5('0x13')]);}logger['error'](_0xe9c5('0xc'),_0x5b1c04,_0x596f4c[_0xe9c5('0x11')][_0xe9c5('0x13')]);return _0x34ee69(_0x596f4c[_0xe9c5('0x11')][_0xe9c5('0x13')]);}else{logger[_0xe9c5('0xb')]('Migration,\x20%s,\x20%s',_0x5b1c04,_0xe9c5('0xd'));_0x34ee69(_0x596f4c[_0xe9c5('0x14')]['message']);}})[_0xe9c5('0x15')](function(_0x45d18d){logger[_0xe9c5('0x11')](_0xe9c5('0xc'),_0x5b1c04,_0x45d18d);_0x228ef3(_0x45d18d);});});} \ No newline at end of file +var _0xe3ee=['Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','../../mysqldb','rpc','jayson/promise','client','http','then','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0xe3ee,0x116));var _0xee3e=function(_0x129ea0,_0x5b1d66){_0x129ea0=_0x129ea0-0x0;var _0x5cb50b=_0xe3ee[_0x129ea0];return _0x5cb50b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xee3e('0x0'));var BPromise=require(_0xee3e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee3e('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xee3e('0x3'));var config=require('../../config/environment');var jayson=require(_0xee3e('0x4'));var client=jayson[_0xee3e('0x5')][_0xee3e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xd893ca,_0x42d135,_0x39a770){return new BPromise(function(_0x43ab67,_0x17fba1){return client['request'](_0xd893ca,_0x39a770)[_0xee3e('0x7')](function(_0x2f6153){logger['info'](_0xee3e('0x8'),_0x42d135,_0xee3e('0x9'));logger['debug'](_0xee3e('0xa'),_0x42d135,_0xee3e('0x9'),JSON[_0xee3e('0xb')](_0x2f6153));if(_0x2f6153[_0xee3e('0xc')]){if(_0x2f6153[_0xee3e('0xc')][_0xee3e('0xd')]===0x1f4){logger[_0xee3e('0xc')](_0xee3e('0x8'),_0x42d135,_0x2f6153['error']['message']);return _0x17fba1(_0x2f6153[_0xee3e('0xc')][_0xee3e('0xe')]);}logger['error'](_0xee3e('0x8'),_0x42d135,_0x2f6153[_0xee3e('0xc')][_0xee3e('0xe')]);return _0x43ab67(_0x2f6153['error'][_0xee3e('0xe')]);}else{logger[_0xee3e('0xf')]('Migration,\x20%s,\x20%s',_0x42d135,'request\x20sent');_0x43ab67(_0x2f6153[_0xee3e('0x10')][_0xee3e('0xe')]);}})[_0xee3e('0x11')](function(_0x512609){logger['error']('Migration,\x20%s,\x20%s',_0x42d135,_0x512609);_0x17fba1(_0x512609);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index a5aadff..3e60e34 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 _0x1e7c=['multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x3cc6eb,_0x516a84){var _0x445ea1=function(_0x30e4f8){while(--_0x30e4f8){_0x3cc6eb['push'](_0x3cc6eb['shift']());}};_0x445ea1(++_0x516a84);}(_0x1e7c,0x132));var _0xc1e7=function(_0x4b3316,_0xa35cf0){_0x4b3316=_0x4b3316-0x0;var _0x27ab7c=_0x1e7c[_0x4b3316];return _0x27ab7c;};'use strict';var multer=require(_0xc1e7('0x0'));var util=require('util');var path=require(_0xc1e7('0x1'));var timeout=require('connect-timeout');var express=require(_0xc1e7('0x2'));var router=express[_0xc1e7('0x3')]();var fs_extra=require(_0xc1e7('0x4'));var auth=require(_0xc1e7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc1e7('0x6'));var controller=require('./network.controller');router[_0xc1e7('0x7')]('/',auth[_0xc1e7('0x8')](),controller[_0xc1e7('0x9')]);router[_0xc1e7('0x7')](_0xc1e7('0xa'),auth['isAuthenticated'](),controller[_0xc1e7('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc1e7('0xc')]);router[_0xc1e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc1e7('0xe')]);router[_0xc1e7('0xf')](_0xc1e7('0xa'),auth[_0xc1e7('0x8')](),controller[_0xc1e7('0x10')]);module[_0xc1e7('0x11')]=router; \ No newline at end of file +var _0xd3e7=['/:id','create','put','update','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0xd3e7,0xe3));var _0x7d3e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd3e7[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x7d3e('0x0'));var util=require('util');var path=require(_0x7d3e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7d3e('0x2')]();var fs_extra=require(_0x7d3e('0x3'));var auth=require(_0x7d3e('0x4'));var interaction=require(_0x7d3e('0x5'));var config=require(_0x7d3e('0x6'));var controller=require(_0x7d3e('0x7'));router[_0x7d3e('0x8')]('/',auth[_0x7d3e('0x9')](),controller[_0x7d3e('0xa')]);router[_0x7d3e('0x8')](_0x7d3e('0xb'),auth[_0x7d3e('0x9')](),controller['show']);router['post']('/',auth[_0x7d3e('0x9')](),controller[_0x7d3e('0xc')]);router[_0x7d3e('0xd')](_0x7d3e('0xb'),auth[_0x7d3e('0x9')](),controller[_0x7d3e('0xe')]);router['delete']('/:id',auth[_0x7d3e('0x9')](),controller[_0x7d3e('0xf')]);module[_0x7d3e('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 2d23d2e..36fa130 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 _0x127b=['exports','ENUM','externip','STRING','sequelize'];(function(_0x48da90,_0x4152f3){var _0x4d572f=function(_0x6c8efb){while(--_0x6c8efb){_0x48da90['push'](_0x48da90['shift']());}};_0x4d572f(++_0x4152f3);}(_0x127b,0xae));var _0xb127=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x127b[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require(_0xb127('0x0'));module[_0xb127('0x1')]={'type':{'type':Sequelize[_0xb127('0x2')]('localnet',_0xb127('0x3'),'stun','turn')},'value':{'type':Sequelize[_0xb127('0x4')]},'username':{'type':Sequelize[_0xb127('0x4')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x171c=['ENUM','externip','stun','turn','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x171c,0x19a));var _0xc171=function(_0x2493c6,_0x5ef25a){_0x2493c6=_0x2493c6-0x0;var _0x5ed96f=_0x171c[_0x2493c6];return _0x5ed96f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xc171('0x0')]('localnet',_0xc171('0x1'),_0xc171('0x2'),_0xc171('0x3'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc171('0x4')]},'password':{'type':Sequelize[_0xc171('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 8c030f5..8df84e2 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 _0x7879=['count','limit','set','Content-Range','json','reject','save','stack','name','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','find','create','transaction','body','STUN','join','utf8','render','writeFileSync','Reload','res_stun_monitor.so','toUpperCase','TURN','readFileSync','root','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','update','params','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','toLowerCase','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined'];(function(_0x292131,_0x254075){var _0x5aeffa=function(_0x18309d){while(--_0x18309d){_0x292131['push'](_0x292131['shift']());}};_0x5aeffa(++_0x254075);}(_0x7879,0xa8));var _0x9787=function(_0x2ae8d2,_0x59a7bc){_0x2ae8d2=_0x2ae8d2-0x0;var _0x359b41=_0x7879[_0x2ae8d2];return _0x359b41;};'use strict';var emlformat=require(_0x9787('0x0'));var rimraf=require(_0x9787('0x1'));var zipdir=require(_0x9787('0x2'));var jsonpatch=require(_0x9787('0x3'));var rp=require(_0x9787('0x4'));var moment=require(_0x9787('0x5'));var BPromise=require(_0x9787('0x6'));var Mustache=require(_0x9787('0x7'));var util=require(_0x9787('0x8'));var path=require(_0x9787('0x9'));var sox=require(_0x9787('0xa'));var csv=require(_0x9787('0xb'));var ejs=require(_0x9787('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9787('0xd'));var squel=require(_0x9787('0xe'));var crypto=require(_0x9787('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9787('0x10'));var toCsv=require(_0x9787('0xb'));var querystring=require(_0x9787('0x11'));var Papa=require('papaparse');var Redis=require(_0x9787('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9787('0x13'));var as=require(_0x9787('0x14'));var hardwareService=require(_0x9787('0x15'));var logger=require(_0x9787('0x16'))(_0x9787('0x17'));var utils=require(_0x9787('0x18'));var config=require(_0x9787('0x19'));var licenseUtil=require(_0x9787('0x1a'));var db=require(_0x9787('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9787('0x1c')][_0x9787('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1a8318,_0x31e54a,_0x3db4a4,_0x49ffb4){return new BPromise(function(_0x7a6d27,_0x40a7c1){var _0x5b3316=_0x49ffb4||client;return _0x5b3316[_0x9787('0x1e')](_0x1a8318,_0x3db4a4)[_0x9787('0x1f')](function(_0x2923b4){logger[_0x9787('0x20')](_0x9787('0x21'),_0x31e54a,_0x9787('0x22'));logger['debug'](_0x9787('0x23'),_0x31e54a,_0x9787('0x22'),JSON[_0x9787('0x24')](_0x2923b4));if(_0x2923b4['error']){if(_0x2923b4[_0x9787('0x25')][_0x9787('0x26')]===0x1f4){logger[_0x9787('0x25')](_0x9787('0x21'),_0x31e54a,_0x2923b4[_0x9787('0x25')][_0x9787('0x27')]);return _0x40a7c1(_0x2923b4['error'][_0x9787('0x27')]);}logger[_0x9787('0x25')](_0x9787('0x21'),_0x31e54a,_0x2923b4[_0x9787('0x25')][_0x9787('0x27')]);return _0x7a6d27(_0x2923b4[_0x9787('0x25')][_0x9787('0x27')]);}else{logger[_0x9787('0x20')](_0x9787('0x21'),_0x31e54a,_0x9787('0x22'));_0x7a6d27(_0x2923b4[_0x9787('0x28')][_0x9787('0x27')]);}})[_0x9787('0x29')](function(_0x2e9bd3){logger['error']('Network,\x20%s,\x20%s',_0x31e54a,_0x2e9bd3);_0x40a7c1(_0x2e9bd3);});});}function respondWithStatusCode(_0x4464c5,_0x13d164){_0x13d164=_0x13d164||0xcc;return function(_0x2b8d21){if(_0x2b8d21){return _0x4464c5[_0x9787('0x2a')](_0x13d164);}return _0x4464c5[_0x9787('0x2b')](_0x13d164)['end']();};}function respondWithResult(_0xc1291f,_0x280482){_0x280482=_0x280482||0xc8;return function(_0x1792d0){if(_0x1792d0){return _0xc1291f['status'](_0x280482)['json'](_0x1792d0);}};}function respondWithFilteredResult(_0x321d9b,_0x34dbcc){return function(_0x415667){if(_0x415667){var _0x5c5061=typeof _0x34dbcc[_0x9787('0x2c')]===_0x9787('0x2d')&&typeof _0x34dbcc['limit']===_0x9787('0x2d');var _0x22b178=_0x415667[_0x9787('0x2e')];var _0x17ee32=_0x5c5061?0x0:_0x34dbcc['offset'];var _0x15947f=_0x5c5061?_0x415667['count']:_0x34dbcc[_0x9787('0x2c')]+_0x34dbcc[_0x9787('0x2f')];var _0x2161e1;if(_0x15947f>=_0x22b178){_0x15947f=_0x22b178;_0x2161e1=0xc8;}else{_0x2161e1=0xce;}_0x321d9b['status'](_0x2161e1);return _0x321d9b[_0x9787('0x30')](_0x9787('0x31'),_0x17ee32+'-'+_0x15947f+'/'+_0x22b178)[_0x9787('0x32')](_0x415667);}return null;};}function patchUpdates(_0x5efb08){return function(_0x17d946){try{jsonpatch['apply'](_0x17d946,_0x5efb08,!![]);}catch(_0x174a4a){return BPromise[_0x9787('0x33')](_0x174a4a);}return _0x17d946[_0x9787('0x34')]();};}function saveUpdates(_0x21a726,_0x424d55){return function(_0x318549){if(_0x318549){return _0x318549['update'](_0x21a726)[_0x9787('0x1f')](function(_0x204141){return _0x204141;});}return null;};}function removeEntity(_0x10b511,_0x3b4bf1){return function(_0x1cb865){if(_0x1cb865){return _0x1cb865['destroy']()[_0x9787('0x1f')](function(){_0x10b511['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d9dd0,_0x587c59){return function(_0x562354){if(!_0x562354){_0x5d9dd0[_0x9787('0x2a')](0x194);}return _0x562354;};}function handleError(_0x2011a5,_0x3e1a8f){_0x3e1a8f=_0x3e1a8f||0x1f4;return function(_0x14f14f){logger[_0x9787('0x25')](_0x14f14f[_0x9787('0x35')]);if(_0x14f14f[_0x9787('0x36')]){delete _0x14f14f[_0x9787('0x36')];}_0x2011a5[_0x9787('0x2b')](_0x3e1a8f)['send'](_0x14f14f);};}exports[_0x9787('0x37')]=function(_0x24c072,_0x8e55e0){var _0x25aacc={},_0x2aa001={},_0x5d82ce={'count':0x0,'rows':[]};var _0x13bfe2=_[_0x9787('0x38')](db[_0x9787('0x39')][_0x9787('0x3a')],function(_0xf7307b){return{'name':_0xf7307b[_0x9787('0x3b')],'type':_0xf7307b[_0x9787('0x3c')][_0x9787('0x3d')]};});_0x2aa001[_0x9787('0x3e')]=_[_0x9787('0x38')](_0x13bfe2,_0x9787('0x36'));_0x2aa001[_0x9787('0x3f')]=_[_0x9787('0x40')](_0x24c072['query']);_0x2aa001[_0x9787('0x41')]=_['intersection'](_0x2aa001[_0x9787('0x3e')],_0x2aa001[_0x9787('0x3f')]);_0x25aacc[_0x9787('0x42')]=_['intersection'](_0x2aa001[_0x9787('0x3e')],qs[_0x9787('0x43')](_0x24c072[_0x9787('0x3f')][_0x9787('0x43')]));_0x25aacc[_0x9787('0x42')]=_0x25aacc[_0x9787('0x42')][_0x9787('0x44')]?_0x25aacc[_0x9787('0x42')]:_0x2aa001['model'];if(!_0x24c072[_0x9787('0x3f')][_0x9787('0x45')](_0x9787('0x46'))){_0x25aacc[_0x9787('0x2f')]=qs['limit'](_0x24c072[_0x9787('0x3f')][_0x9787('0x2f')]);_0x25aacc[_0x9787('0x2c')]=qs[_0x9787('0x2c')](_0x24c072['query'][_0x9787('0x2c')]);}_0x25aacc['order']=qs[_0x9787('0x47')](_0x24c072[_0x9787('0x3f')][_0x9787('0x47')]);_0x25aacc[_0x9787('0x48')]=qs[_0x9787('0x41')](_[_0x9787('0x49')](_0x24c072[_0x9787('0x3f')],_0x2aa001['filters']),_0x13bfe2);if(_0x24c072[_0x9787('0x3f')][_0x9787('0x4a')]){_0x25aacc[_0x9787('0x48')]=_[_0x9787('0x4b')](_0x25aacc[_0x9787('0x48')],{'$or':_[_0x9787('0x38')](_0x13bfe2,function(_0x3128e8){if(_0x3128e8[_0x9787('0x3c')]!==_0x9787('0x4c')){var _0x4db695={};_0x4db695[_0x3128e8['name']]={'$like':'%'+_0x24c072[_0x9787('0x3f')][_0x9787('0x4a')]+'%'};return _0x4db695;}})});}_0x25aacc=_[_0x9787('0x4b')]({},_0x25aacc,_0x24c072['options']);var _0x133cc0={'where':_0x25aacc['where']};return db[_0x9787('0x39')][_0x9787('0x2e')](_0x133cc0)[_0x9787('0x1f')](function(_0x55ffca){_0x5d82ce[_0x9787('0x2e')]=_0x55ffca;if(_0x24c072[_0x9787('0x3f')]['includeAll']){_0x25aacc[_0x9787('0x4d')]=[{'all':!![]}];}return db['Network'][_0x9787('0x4e')](_0x25aacc);})[_0x9787('0x1f')](function(_0x3cc28e){_0x5d82ce[_0x9787('0x4f')]=_0x3cc28e;return _0x5d82ce;})[_0x9787('0x1f')](respondWithFilteredResult(_0x8e55e0,_0x25aacc))[_0x9787('0x29')](handleError(_0x8e55e0,null));};exports['show']=function(_0x3824a5,_0x49b77d){var _0x30d1ed={'raw':!![],'where':{'id':_0x3824a5['params']['id']}},_0x3d1b09={};_0x3d1b09[_0x9787('0x3e')]=_[_0x9787('0x40')](db['Network'][_0x9787('0x3a')]);_0x3d1b09[_0x9787('0x3f')]=_[_0x9787('0x40')](_0x3824a5[_0x9787('0x3f')]);_0x3d1b09[_0x9787('0x41')]=_['intersection'](_0x3d1b09['model'],_0x3d1b09[_0x9787('0x3f')]);_0x30d1ed['attributes']=_['intersection'](_0x3d1b09[_0x9787('0x3e')],qs[_0x9787('0x43')](_0x3824a5[_0x9787('0x3f')][_0x9787('0x43')]));_0x30d1ed['attributes']=_0x30d1ed[_0x9787('0x42')][_0x9787('0x44')]?_0x30d1ed['attributes']:_0x3d1b09['model'];if(_0x3824a5[_0x9787('0x3f')]['includeAll']){_0x30d1ed[_0x9787('0x4d')]=[{'all':!![]}];}_0x30d1ed=_[_0x9787('0x4b')]({},_0x30d1ed,_0x3824a5['options']);return db[_0x9787('0x39')][_0x9787('0x50')](_0x30d1ed)[_0x9787('0x1f')](handleEntityNotFound(_0x49b77d,null))['then'](respondWithResult(_0x49b77d,null))[_0x9787('0x29')](handleError(_0x49b77d,null));};exports[_0x9787('0x51')]=function(_0x4590e6,_0x50b1e3,_0x6029cc){var _0x1136e1;return db['sequelize'][_0x9787('0x52')](function(_0x34718c){return db['Network'][_0x9787('0x51')](_0x4590e6['body'],{'raw':!![]})['then'](function(_0x16a5c9){_0x1136e1=_0x16a5c9;return db[_0x9787('0x39')][_0x9787('0x4e')]({'where':{'type':_0x4590e6[_0x9787('0x53')]['type']},'raw':!![]});})[_0x9787('0x1f')](function(_0x34c8e8){if(_0x1136e1[_0x9787('0x3c')]['toUpperCase']()==_0x9787('0x54')){var _0xabecef=fs['readFileSync'](path[_0x9787('0x55')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x9787('0x56'));var _0x4d9a55=ejs[_0x9787('0x57')](_0xabecef,{'networks':_0x34c8e8||[]});fs[_0x9787('0x58')]('/etc/asterisk/stun_xcally.conf',_0x4d9a55);return respondWithRpcPromise(_0x9787('0x59'),'create',{'module':_0x9787('0x5a')});}else if(_0x1136e1[_0x9787('0x3c')][_0x9787('0x5b')]()==_0x9787('0x5c')){var _0x1f7e32=fs[_0x9787('0x5d')](path['join'](config[_0x9787('0x5e')],'server/files/templates/turn_multiple.ejs'),_0x9787('0x56'));var _0x5eaee8=ejs['render'](_0x1f7e32,{'networks':_0x34c8e8||[]});fs[_0x9787('0x58')](_0x9787('0x5f'),_0x5eaee8);return respondWithRpcPromise(_0x9787('0x59'),_0x9787('0x51'),{'module':_0x9787('0x5a')});}else{var _0x39845b=fs['readFileSync'](path[_0x9787('0x55')](config[_0x9787('0x5e')],_0x9787('0x60')),_0x9787('0x56'));var _0x27eef1=ejs['render'](_0x39845b,{'networks':_0x34c8e8||[]});fs[_0x9787('0x58')](util[_0x9787('0x61')](_0x9787('0x62'),_0x4590e6[_0x9787('0x53')][_0x9787('0x3c')]['toLowerCase']()),_0x27eef1);return respondWithRpcPromise(_0x9787('0x59'),_0x9787('0x51'),{'module':_0x9787('0x63')});}return null;})['then'](function(){return _0x1136e1;});})['then'](respondWithResult(_0x50b1e3,0xc9))[_0x9787('0x29')](handleError(_0x50b1e3,null));};exports[_0x9787('0x64')]=function(_0x71c90f,_0xc94615,_0x5921d0){var _0x129431;return db['sequelize'][_0x9787('0x52')](function(_0x191314){return db[_0x9787('0x39')]['find']({'where':{'id':_0x71c90f[_0x9787('0x65')]['id']}})[_0x9787('0x1f')](handleEntityNotFound(_0xc94615,null))[_0x9787('0x1f')](saveUpdates(_0x71c90f[_0x9787('0x53')],null))[_0x9787('0x1f')](function(_0x6cc741){if(_0x6cc741){_0x129431=_0x6cc741;return db[_0x9787('0x39')][_0x9787('0x4e')]({'where':{'type':_0x129431[_0x9787('0x3c')]},'raw':!![]});}return null;})[_0x9787('0x1f')](function(_0x4164cd){if(_0x129431[_0x9787('0x3c')][_0x9787('0x5b')]()=='STUN'){var _0x5a74a9=fs[_0x9787('0x5d')](path['join'](config['root'],_0x9787('0x66')),_0x9787('0x56'));var _0x194a83=ejs[_0x9787('0x57')](_0x5a74a9,{'networks':_0x4164cd||[]});fs[_0x9787('0x58')](_0x9787('0x67'),_0x194a83);return respondWithRpcPromise(_0x9787('0x59'),'update',{'module':_0x9787('0x5a')});}else if(_0x129431[_0x9787('0x3c')][_0x9787('0x5b')]()==_0x9787('0x5c')){var _0x1bd91d=fs[_0x9787('0x5d')](path['join'](config[_0x9787('0x5e')],_0x9787('0x68')),'utf8');var _0x1d6aec=ejs[_0x9787('0x57')](_0x1bd91d,{'networks':_0x4164cd||[]});fs['writeFileSync'](_0x9787('0x5f'),_0x1d6aec);return respondWithRpcPromise('Reload',_0x9787('0x64'),{'module':_0x9787('0x5a')});}else{var _0x3ced5a=fs[_0x9787('0x5d')](path[_0x9787('0x55')](config[_0x9787('0x5e')],_0x9787('0x60')),'utf8');var _0x3b7674=ejs[_0x9787('0x57')](_0x3ced5a,{'networks':_0x4164cd||[]});fs[_0x9787('0x58')](util['format'](_0x9787('0x62'),_0x71c90f[_0x9787('0x53')][_0x9787('0x3c')][_0x9787('0x69')]()),_0x3b7674);return respondWithRpcPromise(_0x9787('0x59'),_0x9787('0x64'),{'module':'chan_sip.so'});}return null;})[_0x9787('0x1f')](function(_0x302c16){if(_0x302c16){return _0x129431;}return null;});})[_0x9787('0x1f')](respondWithResult(_0xc94615,null))[_0x9787('0x29')](handleError(_0xc94615,null));};exports[_0x9787('0x6a')]=function(_0x7184cc,_0x5b39fd,_0x293aeb){var _0x17b3d8;return db[_0x9787('0x39')][_0x9787('0x50')]({'where':{'id':_0x7184cc[_0x9787('0x65')]['id']}})[_0x9787('0x1f')](function(_0x3f5e70){_0x17b3d8=_0x3f5e70;return _0x3f5e70;})[_0x9787('0x1f')](handleEntityNotFound(_0x5b39fd,null))[_0x9787('0x1f')](removeEntity(_0x5b39fd,null))[_0x9787('0x1f')](function(){if(_0x17b3d8){return db['Network'][_0x9787('0x4e')]({'where':{'type':_0x17b3d8['type']},'raw':!![]});}})[_0x9787('0x1f')](function(_0x183cf5){if(_0x17b3d8['type'][_0x9787('0x5b')]()==_0x9787('0x54')){var _0x29a6b8=fs[_0x9787('0x5d')](path[_0x9787('0x55')](config[_0x9787('0x5e')],_0x9787('0x66')),_0x9787('0x56'));var _0x51980c=ejs[_0x9787('0x57')](_0x29a6b8,{'networks':_0x183cf5||[]});fs[_0x9787('0x58')]('/etc/asterisk/stun_xcally.conf',_0x51980c);return respondWithRpcPromise('Reload',_0x9787('0x6a'),{'module':_0x9787('0x5a')});}else if(_0x17b3d8[_0x9787('0x3c')]['toUpperCase']()==_0x9787('0x5c')){var _0x18a943=fs[_0x9787('0x5d')](path['join'](config[_0x9787('0x5e')],_0x9787('0x68')),_0x9787('0x56'));var _0x96c4bc=ejs['render'](_0x18a943,{'networks':_0x183cf5||[]});fs[_0x9787('0x58')](_0x9787('0x5f'),_0x96c4bc);return respondWithRpcPromise(_0x9787('0x59'),_0x9787('0x6a'),{'module':_0x9787('0x5a')});}else{var _0x34ce8f=fs[_0x9787('0x5d')](path[_0x9787('0x55')](config['root'],'server/files/templates/network.ejs'),_0x9787('0x56'));var _0x459fed=ejs[_0x9787('0x57')](_0x34ce8f,{'networks':_0x183cf5||[]});fs[_0x9787('0x58')](util[_0x9787('0x61')]('/etc/asterisk/sip_xcally_%s.conf',_0x7184cc['body'][_0x9787('0x3c')][_0x9787('0x69')]()),_0x459fed);return respondWithRpcPromise('Reload',_0x9787('0x6a'),{'module':_0x9787('0x63')});}return null;})[_0x9787('0x29')](handleError(_0x5b39fd,null));}; \ No newline at end of file +var _0x4670=['include','findAll','rows','params','find','create','sequelize','transaction','body','toUpperCase','STUN','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/stun_multiple.ejs','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','jayson/promise','client','request','info','request\x20sent','stringify','error','Network,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll'];(function(_0x49f38c,_0x2e1793){var _0x2e4559=function(_0x22a545){while(--_0x22a545){_0x49f38c['push'](_0x49f38c['shift']());}};_0x2e4559(++_0x2e1793);}(_0x4670,0xf0));var _0x0467=function(_0x5a296e,_0x222442){_0x5a296e=_0x5a296e-0x0;var _0x28687c=_0x4670[_0x5a296e];return _0x28687c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0467('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0467('0x1'));var Mustache=require(_0x0467('0x2'));var util=require(_0x0467('0x3'));var path=require(_0x0467('0x4'));var sox=require(_0x0467('0x5'));var csv=require(_0x0467('0x6'));var ejs=require(_0x0467('0x7'));var fs=require('fs');var fs_extra=require(_0x0467('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0467('0x9'));var jsforce=require(_0x0467('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0467('0xb'));var Papa=require(_0x0467('0xc'));var Redis=require(_0x0467('0xd'));var authService=require(_0x0467('0xe'));var qs=require(_0x0467('0xf'));var as=require(_0x0467('0x10'));var hardwareService=require(_0x0467('0x11'));var logger=require(_0x0467('0x12'))(_0x0467('0x13'));var utils=require('../../config/utils');var config=require(_0x0467('0x14'));var licenseUtil=require(_0x0467('0x15'));var db=require(_0x0467('0x16'))['db'];var jayson=require(_0x0467('0x17'));var client=jayson[_0x0467('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x585897,_0x48fcd8,_0x3d3b51,_0x5b430b){return new BPromise(function(_0x387911,_0x10ced6){var _0x30f4f8=_0x5b430b||client;return _0x30f4f8[_0x0467('0x19')](_0x585897,_0x3d3b51)['then'](function(_0x2453d3){logger[_0x0467('0x1a')]('Network,\x20%s,\x20%s',_0x48fcd8,_0x0467('0x1b'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x48fcd8,_0x0467('0x1b'),JSON[_0x0467('0x1c')](_0x2453d3));if(_0x2453d3[_0x0467('0x1d')]){if(_0x2453d3['error']['code']===0x1f4){logger[_0x0467('0x1d')](_0x0467('0x1e'),_0x48fcd8,_0x2453d3['error']['message']);return _0x10ced6(_0x2453d3['error'][_0x0467('0x1f')]);}logger[_0x0467('0x1d')](_0x0467('0x1e'),_0x48fcd8,_0x2453d3[_0x0467('0x1d')][_0x0467('0x1f')]);return _0x387911(_0x2453d3[_0x0467('0x1d')][_0x0467('0x1f')]);}else{logger['info'](_0x0467('0x1e'),_0x48fcd8,_0x0467('0x1b'));_0x387911(_0x2453d3[_0x0467('0x20')][_0x0467('0x1f')]);}})[_0x0467('0x21')](function(_0x1f47a0){logger[_0x0467('0x1d')]('Network,\x20%s,\x20%s',_0x48fcd8,_0x1f47a0);_0x10ced6(_0x1f47a0);});});}function respondWithStatusCode(_0x271595,_0x584747){_0x584747=_0x584747||0xcc;return function(_0xde2fe){if(_0xde2fe){return _0x271595[_0x0467('0x22')](_0x584747);}return _0x271595[_0x0467('0x23')](_0x584747)[_0x0467('0x24')]();};}function respondWithResult(_0x315688,_0x519de9){_0x519de9=_0x519de9||0xc8;return function(_0x3fc4f0){if(_0x3fc4f0){return _0x315688[_0x0467('0x23')](_0x519de9)['json'](_0x3fc4f0);}};}function respondWithFilteredResult(_0x56371a,_0x530e4c){return function(_0x263b58){if(_0x263b58){var _0x1ac4e4=typeof _0x530e4c[_0x0467('0x25')]===_0x0467('0x26')&&typeof _0x530e4c[_0x0467('0x27')]===_0x0467('0x26');var _0xbc637a=_0x263b58[_0x0467('0x28')];var _0xe2966f=_0x1ac4e4?0x0:_0x530e4c['offset'];var _0x365243=_0x1ac4e4?_0x263b58[_0x0467('0x28')]:_0x530e4c[_0x0467('0x25')]+_0x530e4c[_0x0467('0x27')];var _0x22e8b6;if(_0x365243>=_0xbc637a){_0x365243=_0xbc637a;_0x22e8b6=0xc8;}else{_0x22e8b6=0xce;}_0x56371a[_0x0467('0x23')](_0x22e8b6);return _0x56371a[_0x0467('0x29')](_0x0467('0x2a'),_0xe2966f+'-'+_0x365243+'/'+_0xbc637a)[_0x0467('0x2b')](_0x263b58);}return null;};}function patchUpdates(_0x3f13eb){return function(_0xe48638){try{jsonpatch[_0x0467('0x2c')](_0xe48638,_0x3f13eb,!![]);}catch(_0x567b39){return BPromise[_0x0467('0x2d')](_0x567b39);}return _0xe48638[_0x0467('0x2e')]();};}function saveUpdates(_0x327e0b,_0x5c6669){return function(_0xefaaef){if(_0xefaaef){return _0xefaaef[_0x0467('0x2f')](_0x327e0b)[_0x0467('0x30')](function(_0x1157b5){return _0x1157b5;});}return null;};}function removeEntity(_0x6d1875,_0x14eb93){return function(_0x2a8220){if(_0x2a8220){return _0x2a8220[_0x0467('0x31')]()[_0x0467('0x30')](function(){_0x6d1875['status'](0xcc)[_0x0467('0x24')]();});}};}function handleEntityNotFound(_0x478839,_0x14ef4e){return function(_0x39d05f){if(!_0x39d05f){_0x478839['sendStatus'](0x194);}return _0x39d05f;};}function handleError(_0x37a4a1,_0x44878c){_0x44878c=_0x44878c||0x1f4;return function(_0x3e454f){logger[_0x0467('0x1d')](_0x3e454f[_0x0467('0x32')]);if(_0x3e454f[_0x0467('0x33')]){delete _0x3e454f[_0x0467('0x33')];}_0x37a4a1[_0x0467('0x23')](_0x44878c)[_0x0467('0x34')](_0x3e454f);};}exports[_0x0467('0x35')]=function(_0x4a7044,_0x5a424d){var _0x2ba946={},_0x5b72ac={},_0x4e82e9={'count':0x0,'rows':[]};var _0xf902cf=_[_0x0467('0x36')](db[_0x0467('0x37')][_0x0467('0x38')],function(_0x15f5b5){return{'name':_0x15f5b5[_0x0467('0x39')],'type':_0x15f5b5[_0x0467('0x3a')][_0x0467('0x3b')]};});_0x5b72ac[_0x0467('0x3c')]=_['map'](_0xf902cf,_0x0467('0x33'));_0x5b72ac[_0x0467('0x3d')]=_[_0x0467('0x3e')](_0x4a7044[_0x0467('0x3d')]);_0x5b72ac[_0x0467('0x3f')]=_[_0x0467('0x40')](_0x5b72ac[_0x0467('0x3c')],_0x5b72ac['query']);_0x2ba946['attributes']=_[_0x0467('0x40')](_0x5b72ac['model'],qs['fields'](_0x4a7044[_0x0467('0x3d')][_0x0467('0x41')]));_0x2ba946['attributes']=_0x2ba946[_0x0467('0x42')][_0x0467('0x43')]?_0x2ba946[_0x0467('0x42')]:_0x5b72ac[_0x0467('0x3c')];if(!_0x4a7044[_0x0467('0x3d')][_0x0467('0x44')](_0x0467('0x45'))){_0x2ba946['limit']=qs['limit'](_0x4a7044[_0x0467('0x3d')][_0x0467('0x27')]);_0x2ba946[_0x0467('0x25')]=qs[_0x0467('0x25')](_0x4a7044[_0x0467('0x3d')][_0x0467('0x25')]);}_0x2ba946[_0x0467('0x46')]=qs[_0x0467('0x47')](_0x4a7044[_0x0467('0x3d')]['sort']);_0x2ba946[_0x0467('0x48')]=qs['filters'](_[_0x0467('0x49')](_0x4a7044[_0x0467('0x3d')],_0x5b72ac[_0x0467('0x3f')]),_0xf902cf);if(_0x4a7044['query'][_0x0467('0x4a')]){_0x2ba946[_0x0467('0x48')]=_[_0x0467('0x4b')](_0x2ba946[_0x0467('0x48')],{'$or':_[_0x0467('0x36')](_0xf902cf,function(_0x229fc9){if(_0x229fc9['type']!=='VIRTUAL'){var _0x1451b3={};_0x1451b3[_0x229fc9[_0x0467('0x33')]]={'$like':'%'+_0x4a7044['query'][_0x0467('0x4a')]+'%'};return _0x1451b3;}})});}_0x2ba946=_[_0x0467('0x4b')]({},_0x2ba946,_0x4a7044[_0x0467('0x4c')]);var _0x4f45c3={'where':_0x2ba946[_0x0467('0x48')]};return db[_0x0467('0x37')][_0x0467('0x28')](_0x4f45c3)[_0x0467('0x30')](function(_0x519164){_0x4e82e9[_0x0467('0x28')]=_0x519164;if(_0x4a7044[_0x0467('0x3d')][_0x0467('0x4d')]){_0x2ba946[_0x0467('0x4e')]=[{'all':!![]}];}return db[_0x0467('0x37')][_0x0467('0x4f')](_0x2ba946);})[_0x0467('0x30')](function(_0x3cb034){_0x4e82e9[_0x0467('0x50')]=_0x3cb034;return _0x4e82e9;})[_0x0467('0x30')](respondWithFilteredResult(_0x5a424d,_0x2ba946))[_0x0467('0x21')](handleError(_0x5a424d,null));};exports['show']=function(_0x670ede,_0x2f9ded){var _0x23aeea={'raw':!![],'where':{'id':_0x670ede[_0x0467('0x51')]['id']}},_0x2802ee={};_0x2802ee['model']=_[_0x0467('0x3e')](db['Network']['rawAttributes']);_0x2802ee[_0x0467('0x3d')]=_[_0x0467('0x3e')](_0x670ede[_0x0467('0x3d')]);_0x2802ee[_0x0467('0x3f')]=_[_0x0467('0x40')](_0x2802ee[_0x0467('0x3c')],_0x2802ee['query']);_0x23aeea[_0x0467('0x42')]=_[_0x0467('0x40')](_0x2802ee[_0x0467('0x3c')],qs[_0x0467('0x41')](_0x670ede[_0x0467('0x3d')][_0x0467('0x41')]));_0x23aeea[_0x0467('0x42')]=_0x23aeea['attributes'][_0x0467('0x43')]?_0x23aeea[_0x0467('0x42')]:_0x2802ee[_0x0467('0x3c')];if(_0x670ede['query'][_0x0467('0x4d')]){_0x23aeea[_0x0467('0x4e')]=[{'all':!![]}];}_0x23aeea=_['merge']({},_0x23aeea,_0x670ede[_0x0467('0x4c')]);return db[_0x0467('0x37')][_0x0467('0x52')](_0x23aeea)[_0x0467('0x30')](handleEntityNotFound(_0x2f9ded,null))[_0x0467('0x30')](respondWithResult(_0x2f9ded,null))['catch'](handleError(_0x2f9ded,null));};exports[_0x0467('0x53')]=function(_0x5cc59c,_0x5dbcc3,_0x8d2af5){var _0xbb03f0;return db[_0x0467('0x54')][_0x0467('0x55')](function(_0x511b2a){return db['Network'][_0x0467('0x53')](_0x5cc59c[_0x0467('0x56')],{'raw':!![]})['then'](function(_0x568b2c){_0xbb03f0=_0x568b2c;return db['Network'][_0x0467('0x4f')]({'where':{'type':_0x5cc59c[_0x0467('0x56')][_0x0467('0x3a')]},'raw':!![]});})['then'](function(_0x379541){if(_0xbb03f0[_0x0467('0x3a')][_0x0467('0x57')]()==_0x0467('0x58')){var _0x633bec=fs['readFileSync'](path[_0x0467('0x59')](config[_0x0467('0x5a')],'server/files/templates/stun_multiple.ejs'),_0x0467('0x5b'));var _0x3e6595=ejs[_0x0467('0x5c')](_0x633bec,{'networks':_0x379541||[]});fs[_0x0467('0x5d')](_0x0467('0x5e'),_0x3e6595);return respondWithRpcPromise(_0x0467('0x5f'),_0x0467('0x53'),{'module':_0x0467('0x60')});}else if(_0xbb03f0['type'][_0x0467('0x57')]()==_0x0467('0x61')){var _0x30cfe3=fs[_0x0467('0x62')](path[_0x0467('0x59')](config[_0x0467('0x5a')],_0x0467('0x63')),_0x0467('0x5b'));var _0x118e54=ejs[_0x0467('0x5c')](_0x30cfe3,{'networks':_0x379541||[]});fs[_0x0467('0x5d')](_0x0467('0x64'),_0x118e54);return respondWithRpcPromise(_0x0467('0x5f'),_0x0467('0x53'),{'module':'res_stun_monitor.so'});}else{var _0x2541ac=fs[_0x0467('0x62')](path[_0x0467('0x59')](config[_0x0467('0x5a')],_0x0467('0x65')),_0x0467('0x5b'));var _0x1d4ae8=ejs[_0x0467('0x5c')](_0x2541ac,{'networks':_0x379541||[]});fs[_0x0467('0x5d')](util['format'](_0x0467('0x66'),_0x5cc59c[_0x0467('0x56')][_0x0467('0x3a')][_0x0467('0x67')]()),_0x1d4ae8);return respondWithRpcPromise('Reload',_0x0467('0x53'),{'module':_0x0467('0x68')});}return null;})[_0x0467('0x30')](function(){return _0xbb03f0;});})[_0x0467('0x30')](respondWithResult(_0x5dbcc3,0xc9))[_0x0467('0x21')](handleError(_0x5dbcc3,null));};exports[_0x0467('0x2f')]=function(_0x24c711,_0x8d0e52,_0x382c60){var _0x5dd848;return db['sequelize']['transaction'](function(_0x3871c){return db['Network'][_0x0467('0x52')]({'where':{'id':_0x24c711['params']['id']}})[_0x0467('0x30')](handleEntityNotFound(_0x8d0e52,null))['then'](saveUpdates(_0x24c711[_0x0467('0x56')],null))[_0x0467('0x30')](function(_0x4ccef7){if(_0x4ccef7){_0x5dd848=_0x4ccef7;return db[_0x0467('0x37')][_0x0467('0x4f')]({'where':{'type':_0x5dd848[_0x0467('0x3a')]},'raw':!![]});}return null;})[_0x0467('0x30')](function(_0x58817c){if(_0x5dd848[_0x0467('0x3a')][_0x0467('0x57')]()==_0x0467('0x58')){var _0x55844f=fs['readFileSync'](path[_0x0467('0x59')](config[_0x0467('0x5a')],'server/files/templates/stun_multiple.ejs'),_0x0467('0x5b'));var _0x103488=ejs[_0x0467('0x5c')](_0x55844f,{'networks':_0x58817c||[]});fs[_0x0467('0x5d')](_0x0467('0x5e'),_0x103488);return respondWithRpcPromise(_0x0467('0x5f'),_0x0467('0x2f'),{'module':'res_stun_monitor.so'});}else if(_0x5dd848[_0x0467('0x3a')][_0x0467('0x57')]()==_0x0467('0x61')){var _0x4e7c68=fs[_0x0467('0x62')](path[_0x0467('0x59')](config[_0x0467('0x5a')],_0x0467('0x63')),_0x0467('0x5b'));var _0x2b6f58=ejs['render'](_0x4e7c68,{'networks':_0x58817c||[]});fs['writeFileSync'](_0x0467('0x64'),_0x2b6f58);return respondWithRpcPromise('Reload',_0x0467('0x2f'),{'module':'res_stun_monitor.so'});}else{var _0x2ef0fb=fs[_0x0467('0x62')](path[_0x0467('0x59')](config[_0x0467('0x5a')],_0x0467('0x65')),_0x0467('0x5b'));var _0x2c1886=ejs['render'](_0x2ef0fb,{'networks':_0x58817c||[]});fs[_0x0467('0x5d')](util['format'](_0x0467('0x66'),_0x24c711[_0x0467('0x56')]['type']['toLowerCase']()),_0x2c1886);return respondWithRpcPromise(_0x0467('0x5f'),_0x0467('0x2f'),{'module':'chan_sip.so'});}return null;})[_0x0467('0x30')](function(_0x2d309b){if(_0x2d309b){return _0x5dd848;}return null;});})[_0x0467('0x30')](respondWithResult(_0x8d0e52,null))[_0x0467('0x21')](handleError(_0x8d0e52,null));};exports[_0x0467('0x31')]=function(_0x16401e,_0x1da455,_0x1bc6c4){var _0x12eb88;return db[_0x0467('0x37')][_0x0467('0x52')]({'where':{'id':_0x16401e[_0x0467('0x51')]['id']}})[_0x0467('0x30')](function(_0x497db4){_0x12eb88=_0x497db4;return _0x497db4;})['then'](handleEntityNotFound(_0x1da455,null))[_0x0467('0x30')](removeEntity(_0x1da455,null))[_0x0467('0x30')](function(){if(_0x12eb88){return db['Network'][_0x0467('0x4f')]({'where':{'type':_0x12eb88[_0x0467('0x3a')]},'raw':!![]});}})['then'](function(_0x13781c){if(_0x12eb88[_0x0467('0x3a')][_0x0467('0x57')]()==_0x0467('0x58')){var _0x1e0ae2=fs[_0x0467('0x62')](path[_0x0467('0x59')](config[_0x0467('0x5a')],_0x0467('0x69')),'utf8');var _0x576024=ejs[_0x0467('0x5c')](_0x1e0ae2,{'networks':_0x13781c||[]});fs['writeFileSync'](_0x0467('0x5e'),_0x576024);return respondWithRpcPromise(_0x0467('0x5f'),'destroy',{'module':_0x0467('0x60')});}else if(_0x12eb88[_0x0467('0x3a')][_0x0467('0x57')]()==_0x0467('0x61')){var _0x4598f9=fs[_0x0467('0x62')](path[_0x0467('0x59')](config[_0x0467('0x5a')],_0x0467('0x63')),_0x0467('0x5b'));var _0x233de2=ejs[_0x0467('0x5c')](_0x4598f9,{'networks':_0x13781c||[]});fs['writeFileSync'](_0x0467('0x64'),_0x233de2);return respondWithRpcPromise(_0x0467('0x5f'),'destroy',{'module':_0x0467('0x60')});}else{var _0x3f7f99=fs[_0x0467('0x62')](path[_0x0467('0x59')](config[_0x0467('0x5a')],_0x0467('0x65')),_0x0467('0x5b'));var _0x5e0729=ejs['render'](_0x3f7f99,{'networks':_0x13781c||[]});fs[_0x0467('0x5d')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x16401e[_0x0467('0x56')][_0x0467('0x3a')][_0x0467('0x67')]()),_0x5e0729);return respondWithRpcPromise(_0x0467('0x5f'),_0x0467('0x31'),{'module':_0x0467('0x68')});}return null;})['catch'](handleError(_0x1da455,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 54d71e7..0066e5f 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 _0xeffd=['request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xeffd,0x6b));var _0xdeff=function(_0x1dfc89,_0x51136b){_0x1dfc89=_0x1dfc89-0x0;var _0x516fbd=_0xeffd[_0x1dfc89];return _0x516fbd;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var logger=require(_0xdeff('0x1'))(_0xdeff('0x2'));var moment=require(_0xdeff('0x3'));var BPromise=require(_0xdeff('0x4'));var rp=require(_0xdeff('0x5'));var fs=require('fs');var path=require(_0xdeff('0x6'));var rimraf=require(_0xdeff('0x7'));var config=require(_0xdeff('0x8'));var attributes=require(_0xdeff('0x9'));module[_0xdeff('0xa')]=function(_0x1ed641,_0x132631){return _0x1ed641[_0xdeff('0xb')](_0xdeff('0xc'),attributes,{'tableName':_0xdeff('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6324=['define','network','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports'];(function(_0x45d471,_0x1bfd12){var _0x3a8fd6=function(_0x7d1102){while(--_0x7d1102){_0x45d471['push'](_0x45d471['shift']());}};_0x3a8fd6(++_0x1bfd12);}(_0x6324,0x142));var _0x4632=function(_0x5c3834,_0x2f4bcc){_0x5c3834=_0x5c3834-0x0;var _0x415f97=_0x6324[_0x5c3834];return _0x415f97;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var logger=require(_0x4632('0x2'))(_0x4632('0x3'));var moment=require('moment');var BPromise=require(_0x4632('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4632('0x5'));var rimraf=require('rimraf');var config=require(_0x4632('0x6'));var attributes=require('./network.attributes');module[_0x4632('0x7')]=function(_0x24aba6,_0x1f3077){return _0x24aba6[_0x4632('0x8')]('Network',attributes,{'tableName':_0x4632('0x9'),'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 c61d1f3..8bb383c 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x521e4e,_0x58a877){var _0x496bd3=function(_0x38f9c2){while(--_0x38f9c2){_0x521e4e['push'](_0x521e4e['shift']());}};_0x496bd3(++_0x58a877);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x2bfde2,_0x45e471){_0x2bfde2=_0x2bfde2-0x0;var _0x2a2a3d=_0x7a54[_0x2bfde2];return _0x2a2a3d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 39f0276..0ebbfad 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 _0x55e6=['/:id/notify','notify','addAgents','/:id/send','send','update','delete','destroy','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer'];(function(_0x4c71fb,_0x3519ef){var _0x38fda3=function(_0x54ff06){while(--_0x54ff06){_0x4c71fb['push'](_0x4c71fb['shift']());}};_0x38fda3(++_0x3519ef);}(_0x55e6,0x160));var _0x655e=function(_0x354e55,_0x501a93){_0x354e55=_0x354e55-0x0;var _0x2c2d59=_0x55e6[_0x354e55];return _0x2c2d59;};'use strict';var multer=require(_0x655e('0x0'));var util=require(_0x655e('0x1'));var path=require(_0x655e('0x2'));var timeout=require('connect-timeout');var express=require(_0x655e('0x3'));var router=express[_0x655e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x655e('0x5'));var interaction=require(_0x655e('0x6'));var config=require(_0x655e('0x7'));var controller=require(_0x655e('0x8'));router['get']('/',auth[_0x655e('0x9')](),controller[_0x655e('0xa')]);router[_0x655e('0xb')]('/describe',auth[_0x655e('0x9')](),controller[_0x655e('0xc')]);router[_0x655e('0xb')](_0x655e('0xd'),auth[_0x655e('0x9')](),controller[_0x655e('0xe')]);router[_0x655e('0xb')](_0x655e('0xf'),auth[_0x655e('0x9')](),controller[_0x655e('0x10')]);router[_0x655e('0xb')](_0x655e('0x11'),auth['isAuthenticated'](),controller[_0x655e('0x12')]);router[_0x655e('0xb')]('/:id/applications',auth[_0x655e('0x9')](),controller[_0x655e('0x13')]);router[_0x655e('0xb')](_0x655e('0x14'),auth[_0x655e('0x9')](),controller[_0x655e('0x15')]);router[_0x655e('0xb')](_0x655e('0x16'),auth['isAuthenticated'](),controller[_0x655e('0x17')]);router['post']('/',auth[_0x655e('0x9')](),controller[_0x655e('0x18')]);router[_0x655e('0x19')]('/:id/dispositions',auth[_0x655e('0x9')](),controller[_0x655e('0x1a')]);router[_0x655e('0x19')](_0x655e('0x11'),auth['isAuthenticated'](),controller[_0x655e('0x1b')]);router[_0x655e('0x19')](_0x655e('0x1c'),controller[_0x655e('0x1d')]);router[_0x655e('0x19')]('/:id/applications',auth[_0x655e('0x9')](),controller['addApplications']);router[_0x655e('0x19')]('/:id/users',auth[_0x655e('0x9')](),controller[_0x655e('0x1e')]);router[_0x655e('0x19')](_0x655e('0x1f'),auth[_0x655e('0x9')](),controller[_0x655e('0x20')]);router['put'](_0x655e('0xd'),auth[_0x655e('0x9')](),controller[_0x655e('0x21')]);router[_0x655e('0x22')](_0x655e('0xd'),auth['isAuthenticated'](),controller[_0x655e('0x23')]);router['delete'](_0x655e('0xf'),auth[_0x655e('0x9')](),controller['removeDispositions']);router[_0x655e('0x22')](_0x655e('0x11'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x655e('0x22')](_0x655e('0x16'),auth[_0x655e('0x9')](),controller[_0x655e('0x24')]);module[_0x655e('0x25')]=router; \ No newline at end of file +var _0x845e=['../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','notify','/:id/applications','addAgents','/:id/send','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xa3400,_0x3a980a){var _0x33dba2=function(_0x5e988b){while(--_0x5e988b){_0xa3400['push'](_0xa3400['shift']());}};_0x33dba2(++_0x3a980a);}(_0x845e,0x1f2));var _0xe845=function(_0x5c4c7b,_0x2b2508){_0x5c4c7b=_0x5c4c7b-0x0;var _0x2cdf03=_0x845e[_0x5c4c7b];return _0x2cdf03;};'use strict';var multer=require(_0xe845('0x0'));var util=require('util');var path=require(_0xe845('0x1'));var timeout=require(_0xe845('0x2'));var express=require(_0xe845('0x3'));var router=express[_0xe845('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe845('0x5'));var interaction=require(_0xe845('0x6'));var config=require(_0xe845('0x7'));var controller=require(_0xe845('0x8'));router[_0xe845('0x9')]('/',auth['isAuthenticated'](),controller[_0xe845('0xa')]);router['get']('/describe',auth[_0xe845('0xb')](),controller[_0xe845('0xc')]);router[_0xe845('0x9')](_0xe845('0xd'),auth[_0xe845('0xb')](),controller[_0xe845('0xe')]);router[_0xe845('0x9')](_0xe845('0xf'),auth[_0xe845('0xb')](),controller[_0xe845('0x10')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0xe845('0x9')]('/:id/applications',auth[_0xe845('0xb')](),controller[_0xe845('0x11')]);router['get'](_0xe845('0x12'),auth[_0xe845('0xb')](),controller[_0xe845('0x13')]);router[_0xe845('0x9')](_0xe845('0x14'),auth[_0xe845('0xb')](),controller[_0xe845('0x15')]);router['post']('/',auth[_0xe845('0xb')](),controller[_0xe845('0x16')]);router[_0xe845('0x17')](_0xe845('0xf'),auth[_0xe845('0xb')](),controller[_0xe845('0x18')]);router[_0xe845('0x17')]('/:id/canned_answers',auth[_0xe845('0xb')](),controller['addAnswer']);router[_0xe845('0x17')]('/:id/notify',controller[_0xe845('0x19')]);router[_0xe845('0x17')](_0xe845('0x1a'),auth[_0xe845('0xb')](),controller['addApplications']);router[_0xe845('0x17')](_0xe845('0x14'),auth['isAuthenticated'](),controller[_0xe845('0x1b')]);router[_0xe845('0x17')](_0xe845('0x1c'),auth['isAuthenticated'](),controller['send']);router[_0xe845('0x1d')](_0xe845('0xd'),auth['isAuthenticated'](),controller[_0xe845('0x1e')]);router[_0xe845('0x1f')](_0xe845('0xd'),auth['isAuthenticated'](),controller[_0xe845('0x20')]);router[_0xe845('0x1f')](_0xe845('0xf'),auth[_0xe845('0xb')](),controller[_0xe845('0x21')]);router[_0xe845('0x1f')]('/:id/canned_answers',auth[_0xe845('0xb')](),controller['removeAnswers']);router[_0xe845('0x1f')]('/:id/users',auth[_0xe845('0xb')](),controller[_0xe845('0x22')]);module[_0xe845('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 5af4151..be145ef 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 _0x6d78=['generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6d78,0x17c));var _0x86d7=function(_0xed195e,_0x329101){_0xed195e=_0xed195e-0x0;var _0x4ffbbc=_0x6d78[_0xed195e];return _0x4ffbbc;};'use strict';var Sequelize=require(_0x86d7('0x0'));var rs=require(_0x86d7('0x1'));module[_0x86d7('0x2')]={'name':{'type':Sequelize[_0x86d7('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x86d7('0x3')]},'token':{'type':Sequelize[_0x86d7('0x3')],'defaultValue':function(){return rs[_0x86d7('0x4')]();}},'replyUri':{'type':Sequelize[_0x86d7('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x86d7('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x86d7('0x5')],'defaultValue':function(){return _0x86d7('0x6');}},'notificationSound':{'type':Sequelize[_0x86d7('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x86d7('0x3')]},'queueTransfer':{'type':Sequelize[_0x86d7('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x86d7('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x86d7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x86d7('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x86d7('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x86d7('0xa'),'set':function(_0x2d901c){if(!_0x2d901c)this[_0x86d7('0xb')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x2d901c);}}}; \ No newline at end of file +var _0x4cf8=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x22111e,_0x1687ec){var _0x5ec63f=function(_0x27d615){while(--_0x27d615){_0x22111e['push'](_0x22111e['shift']());}};_0x5ec63f(++_0x1687ec);}(_0x4cf8,0xf3));var _0x84cf=function(_0x4df69e,_0x5131d5){_0x4df69e=_0x4df69e-0x0;var _0x1f9041=_0x4cf8[_0x4df69e];return _0x1f9041;};'use strict';var Sequelize=require(_0x84cf('0x0'));var rs=require(_0x84cf('0x1'));module[_0x84cf('0x2')]={'name':{'type':Sequelize[_0x84cf('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x84cf('0x3')],'defaultValue':function(){return rs[_0x84cf('0x4')]();}},'replyUri':{'type':Sequelize[_0x84cf('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x84cf('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x84cf('0x5')],'defaultValue':function(){return _0x84cf('0x6');}},'notificationSound':{'type':Sequelize[_0x84cf('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x84cf('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x84cf('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x84cf('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x84cf('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x84cf('0x7')],'defaultValue':![],'comment':_0x84cf('0xa'),'set':function(_0x12ee6d){if(!_0x12ee6d)this[_0x84cf('0xb')](_0x84cf('0xc'),null);this['setDataValue'](_0x84cf('0xd'),_0x12ee6d);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index b0e0737..ce7188e 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 _0x30ac=['ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','asc','Contacts','defaults','contact','firstName','OpenchannelInteraction','threadId','externalUrl','ContactId','spread','lastName','messageId','interaction','autoclose','*,*,*,*','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','findOne','transaction','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','Messages','OpenchannelMessage','dataValues','push','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','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','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','undefined','count','offset','set','json','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','type','filter','merge','includeAll','include','findAll','show','mandatoryDispositionPause','keys','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','pick','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','options','rows','notify','openchannel','CmContact','Sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x30ac,0x1bb));var _0xc30a=function(_0x235112,_0x5b5018){_0x235112=_0x235112-0x0;var _0xec8fa=_0x30ac[_0x235112];return _0xec8fa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc30a('0x0'));var rp=require('request-promise');var moment=require(_0xc30a('0x1'));var BPromise=require(_0xc30a('0x2'));var Mustache=require(_0xc30a('0x3'));var util=require(_0xc30a('0x4'));var path=require('path');var sox=require(_0xc30a('0x5'));var csv=require(_0xc30a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc30a('0x7'));var _=require(_0xc30a('0x8'));var squel=require('squel');var crypto=require(_0xc30a('0x9'));var jsforce=require(_0xc30a('0xa'));var deskjs=require(_0xc30a('0xb'));var toCsv=require(_0xc30a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc30a('0xc'));var authService=require(_0xc30a('0xd'));var qs=require(_0xc30a('0xe'));var as=require(_0xc30a('0xf'));var hardwareService=require(_0xc30a('0x10'));var logger=require(_0xc30a('0x11'))(_0xc30a('0x12'));var utils=require(_0xc30a('0x13'));var config=require(_0xc30a('0x14'));var licenseUtil=require(_0xc30a('0x15'));var db=require(_0xc30a('0x16'))['db'];config[_0xc30a('0x17')]=_['defaults'](config[_0xc30a('0x17')],{'host':_0xc30a('0x18'),'port':0x18eb});var socket=require(_0xc30a('0x19'))(new Redis(config[_0xc30a('0x17')]));require('./openchannelAccount.socket')[_0xc30a('0x1a')](socket);var jayson=require(_0xc30a('0x1b'));var client=jayson[_0xc30a('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xc30a('0x1c')][_0xc30a('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x179853,_0x400626,_0x31da84,_0x310542){return new BPromise(function(_0x5d8989,_0x90e763){var _0x20dd3d=_0x310542||client;return _0x20dd3d[_0xc30a('0x1e')](_0x179853,_0x31da84)[_0xc30a('0x1f')](function(_0x3c0c1d){logger[_0xc30a('0x20')](_0xc30a('0x21'),_0x400626,'request\x20sent');logger[_0xc30a('0x22')](_0xc30a('0x23'),_0x400626,_0xc30a('0x24'),JSON[_0xc30a('0x25')](_0x3c0c1d));if(_0x3c0c1d[_0xc30a('0x26')]){if(_0x3c0c1d[_0xc30a('0x26')]['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x400626,_0x3c0c1d[_0xc30a('0x26')][_0xc30a('0x27')]);return _0x90e763(_0x3c0c1d['error'][_0xc30a('0x27')]);}logger[_0xc30a('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x400626,_0x3c0c1d[_0xc30a('0x26')][_0xc30a('0x27')]);return _0x5d8989(_0x3c0c1d['error'][_0xc30a('0x27')]);}else{logger[_0xc30a('0x20')](_0xc30a('0x21'),_0x400626,_0xc30a('0x24'));_0x5d8989(_0x3c0c1d[_0xc30a('0x28')]['message']);}})[_0xc30a('0x29')](function(_0x49f451){logger[_0xc30a('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x400626,_0x49f451);_0x90e763(_0x49f451);});});}function respondWithStatusCode(_0x4450eb,_0x2ec00a){_0x2ec00a=_0x2ec00a||0xcc;return function(_0x1058fe){if(_0x1058fe){return _0x4450eb[_0xc30a('0x2a')](_0x2ec00a);}return _0x4450eb['status'](_0x2ec00a)[_0xc30a('0x2b')]();};}function respondWithResult(_0x25c7d4,_0x39709a){_0x39709a=_0x39709a||0xc8;return function(_0x277efb){if(_0x277efb){return _0x25c7d4[_0xc30a('0x2c')](_0x39709a)['json'](_0x277efb);}};}function respondWithFilteredResult(_0x6cf9a,_0x14729b){return function(_0x2ee0ba){if(_0x2ee0ba){var _0x2c2212=typeof _0x14729b['offset']===_0xc30a('0x2d')&&typeof _0x14729b['limit']===_0xc30a('0x2d');var _0x45d87a=_0x2ee0ba[_0xc30a('0x2e')];var _0xf2da5b=_0x2c2212?0x0:_0x14729b[_0xc30a('0x2f')];var _0x3b3a54=_0x2c2212?_0x2ee0ba[_0xc30a('0x2e')]:_0x14729b[_0xc30a('0x2f')]+_0x14729b['limit'];var _0x35cd44;if(_0x3b3a54>=_0x45d87a){_0x3b3a54=_0x45d87a;_0x35cd44=0xc8;}else{_0x35cd44=0xce;}_0x6cf9a[_0xc30a('0x2c')](_0x35cd44);return _0x6cf9a[_0xc30a('0x30')]('Content-Range',_0xf2da5b+'-'+_0x3b3a54+'/'+_0x45d87a)[_0xc30a('0x31')](_0x2ee0ba);}return null;};}function patchUpdates(_0x49f23b){return function(_0xd03f7e){try{jsonpatch[_0xc30a('0x32')](_0xd03f7e,_0x49f23b,!![]);}catch(_0xb2f26b){return BPromise[_0xc30a('0x33')](_0xb2f26b);}return _0xd03f7e[_0xc30a('0x34')]();};}function saveUpdates(_0xb60e25,_0xc5cc23){return function(_0x429a97){if(_0x429a97){return _0x429a97[_0xc30a('0x35')](_0xb60e25)['then'](function(_0x399248){return _0x399248;});}return null;};}function removeEntity(_0x4ec7ea,_0x597a0c){return function(_0x4810b3){if(_0x4810b3){return _0x4810b3[_0xc30a('0x36')]()[_0xc30a('0x1f')](function(){var _0x5c9c6c=_0x4810b3[_0xc30a('0x37')]({'plain':!![]});var _0x355b46=_0xc30a('0x38');return db[_0xc30a('0x39')][_0xc30a('0x36')]({'where':{'type':_0x355b46,'resourceId':_0x5c9c6c['id']}})[_0xc30a('0x1f')](function(){return _0x4810b3;});})[_0xc30a('0x1f')](function(){_0x4ec7ea[_0xc30a('0x2c')](0xcc)[_0xc30a('0x2b')]();});}};}function handleEntityNotFound(_0x28643c,_0x150ca3){return function(_0x3cc694){if(!_0x3cc694){_0x28643c['sendStatus'](0x194);}return _0x3cc694;};}function handleError(_0x395931,_0x647afd){_0x647afd=_0x647afd||0x1f4;return function(_0xe3caa3){logger[_0xc30a('0x26')](_0xe3caa3[_0xc30a('0x3a')]);if(_0xe3caa3['name']){delete _0xe3caa3[_0xc30a('0x3b')];}_0x395931[_0xc30a('0x2c')](_0x647afd)['send'](_0xe3caa3);};}exports[_0xc30a('0x3c')]=function(_0x4953f1,_0x46bdc4){var _0x296394={'include':[{'model':db[_0xc30a('0x3d')],'as':'mandatoryDispositionPause'}]},_0x5c99cc={},_0x564292={'count':0x0,'rows':[]};var _0x4099b9=_[_0xc30a('0x3e')](db[_0xc30a('0x3f')][_0xc30a('0x40')],function(_0x1d3bf9){return{'name':_0x1d3bf9[_0xc30a('0x41')],'type':_0x1d3bf9['type']['key']};});_0x5c99cc[_0xc30a('0x42')]=_[_0xc30a('0x3e')](_0x4099b9,_0xc30a('0x3b'));_0x5c99cc[_0xc30a('0x43')]=_['keys'](_0x4953f1[_0xc30a('0x43')]);_0x5c99cc[_0xc30a('0x44')]=_[_0xc30a('0x45')](_0x5c99cc['model'],_0x5c99cc[_0xc30a('0x43')]);_0x296394[_0xc30a('0x46')]=_[_0xc30a('0x45')](_0x5c99cc['model'],qs['fields'](_0x4953f1[_0xc30a('0x43')][_0xc30a('0x47')]));_0x296394[_0xc30a('0x46')]=_0x296394['attributes']['length']?_0x296394[_0xc30a('0x46')]:_0x5c99cc[_0xc30a('0x42')];if(!_0x4953f1[_0xc30a('0x43')][_0xc30a('0x48')]('nolimit')){_0x296394[_0xc30a('0x49')]=qs[_0xc30a('0x49')](_0x4953f1[_0xc30a('0x43')]['limit']);_0x296394['offset']=qs[_0xc30a('0x2f')](_0x4953f1[_0xc30a('0x43')][_0xc30a('0x2f')]);}_0x296394[_0xc30a('0x4a')]=qs[_0xc30a('0x4b')](_0x4953f1[_0xc30a('0x43')][_0xc30a('0x4b')]);_0x296394[_0xc30a('0x4c')]=qs[_0xc30a('0x44')](_['pick'](_0x4953f1['query'],_0x5c99cc[_0xc30a('0x44')]),_0x4099b9);if(_0x4953f1[_0xc30a('0x43')]['filter']){_0x296394['where']=_['merge'](_0x296394[_0xc30a('0x4c')],{'$or':_[_0xc30a('0x3e')](_0x4099b9,function(_0x57ee91){if(_0x57ee91[_0xc30a('0x4d')]!=='VIRTUAL'){var _0x2e59f8={};_0x2e59f8[_0x57ee91[_0xc30a('0x3b')]]={'$like':'%'+_0x4953f1[_0xc30a('0x43')][_0xc30a('0x4e')]+'%'};return _0x2e59f8;}})});}_0x296394=_[_0xc30a('0x4f')]({},_0x296394,_0x4953f1['options']);var _0x250514={'where':_0x296394[_0xc30a('0x4c')]};return db[_0xc30a('0x3f')][_0xc30a('0x2e')](_0x250514)[_0xc30a('0x1f')](function(_0x55f4be){_0x564292[_0xc30a('0x2e')]=_0x55f4be;if(_0x4953f1[_0xc30a('0x43')][_0xc30a('0x50')]){_0x296394[_0xc30a('0x51')]=[{'all':!![]}];}return db[_0xc30a('0x3f')][_0xc30a('0x52')](_0x296394);})[_0xc30a('0x1f')](function(_0xbba22b){_0x564292['rows']=_0xbba22b;return _0x564292;})[_0xc30a('0x1f')](respondWithFilteredResult(_0x46bdc4,_0x296394))['catch'](handleError(_0x46bdc4,null));};exports[_0xc30a('0x53')]=function(_0x518e09,_0x44912c){var _0x496b00={'raw':![],'where':{'id':_0x518e09['params']['id']},'include':[{'model':db[_0xc30a('0x3d')],'as':_0xc30a('0x54')}]},_0x40e554={};_0x40e554['model']=_[_0xc30a('0x55')](db['OpenchannelAccount'][_0xc30a('0x40')]);_0x40e554[_0xc30a('0x43')]=_[_0xc30a('0x55')](_0x518e09['query']);_0x40e554[_0xc30a('0x44')]=_[_0xc30a('0x45')](_0x40e554[_0xc30a('0x42')],_0x40e554[_0xc30a('0x43')]);_0x496b00[_0xc30a('0x46')]=_[_0xc30a('0x45')](_0x40e554[_0xc30a('0x42')],qs[_0xc30a('0x47')](_0x518e09['query'][_0xc30a('0x47')]));_0x496b00[_0xc30a('0x46')]=_0x496b00[_0xc30a('0x46')][_0xc30a('0x56')]?_0x496b00['attributes']:_0x40e554[_0xc30a('0x42')];if(_0x518e09[_0xc30a('0x43')]['includeAll']){_0x496b00[_0xc30a('0x51')]=[{'all':!![]}];}_0x496b00=_[_0xc30a('0x4f')]({},_0x496b00,_0x518e09['options']);return db['OpenchannelAccount'][_0xc30a('0x57')](_0x496b00)['then'](handleEntityNotFound(_0x44912c,null))[_0xc30a('0x1f')](respondWithResult(_0x44912c,null))[_0xc30a('0x29')](handleError(_0x44912c,null));};exports[_0xc30a('0x58')]=function(_0x2a93c9,_0x5b147d){return db[_0xc30a('0x3f')][_0xc30a('0x58')](_0x2a93c9[_0xc30a('0x59')],{})['then'](function(_0x3a2a93){var _0x1a0d79=_0x2a93c9[_0xc30a('0x5a')]['get']({'plain':!![]});if(!_0x1a0d79)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a0d79[_0xc30a('0x5b')]==='user'){var _0x143aa8=_0x3a2a93[_0xc30a('0x37')]({'plain':!![]});var _0x5ae95e='OpenchannelAccounts';return db[_0xc30a('0x5c')]['find']({'where':{'name':_0x5ae95e,'userProfileId':_0x1a0d79[_0xc30a('0x5d')]},'raw':!![]})[_0xc30a('0x1f')](function(_0x556043){if(_0x556043&&_0x556043[_0xc30a('0x5e')]===0x0){return db[_0xc30a('0x39')][_0xc30a('0x58')]({'name':_0x143aa8[_0xc30a('0x3b')],'resourceId':_0x143aa8['id'],'type':_0x556043[_0xc30a('0x3b')],'sectionId':_0x556043['id']},{})[_0xc30a('0x1f')](function(){return _0x3a2a93;});}else{return _0x3a2a93;}})[_0xc30a('0x29')](function(_0x2f5876){logger['error'](_0xc30a('0x5f'),_0x2f5876);throw _0x2f5876;});}return _0x3a2a93;})[_0xc30a('0x1f')](respondWithResult(_0x5b147d,0xc9))[_0xc30a('0x29')](handleError(_0x5b147d,null));};exports[_0xc30a('0x35')]=function(_0x5233f2,_0x557c03){if(_0x5233f2[_0xc30a('0x59')]['id']){delete _0x5233f2['body']['id'];}return db['OpenchannelAccount'][_0xc30a('0x57')]({'where':{'id':_0x5233f2[_0xc30a('0x60')]['id']},'include':[{'model':db[_0xc30a('0x3d')],'as':_0xc30a('0x54')}]})[_0xc30a('0x1f')](handleEntityNotFound(_0x557c03,null))[_0xc30a('0x1f')](saveUpdates(_0x5233f2['body'],null))[_0xc30a('0x1f')](respondWithResult(_0x557c03,null))['catch'](handleError(_0x557c03,null));};exports[_0xc30a('0x36')]=function(_0x2add9b,_0x473fa7){return db[_0xc30a('0x3f')]['find']({'where':{'id':_0x2add9b[_0xc30a('0x60')]['id']}})[_0xc30a('0x1f')](handleEntityNotFound(_0x473fa7,null))[_0xc30a('0x1f')](removeEntity(_0x473fa7,null))[_0xc30a('0x29')](handleError(_0x473fa7,null));};exports[_0xc30a('0x61')]=function(_0x4f0982,_0x464ae8){return db[_0xc30a('0x3f')][_0xc30a('0x61')]()['then'](respondWithResult(_0x464ae8,null))[_0xc30a('0x29')](handleError(_0x464ae8,null));};exports[_0xc30a('0x62')]=function(_0x428d9e,_0x3155d2,_0x1935a5){if(_0x428d9e['body']['id']){delete _0x428d9e['body']['id'];}return db[_0xc30a('0x3f')]['find']({'where':{'id':_0x428d9e['params']['id']}})[_0xc30a('0x1f')](handleEntityNotFound(_0x3155d2,null))['then'](function(_0x6be584){if(_0x6be584){_0x428d9e[_0xc30a('0x59')]['OpenchannelAccountId']=_0x6be584['id'];return db[_0xc30a('0x63')][_0xc30a('0x58')](_0x428d9e[_0xc30a('0x59')]);}})[_0xc30a('0x1f')](respondWithResult(_0x3155d2,null))['catch'](handleError(_0x3155d2,null));};exports[_0xc30a('0x64')]=function(_0x4e4df0,_0xd44487,_0x4e901a){var _0x2b9f30={'raw':![],'where':{}};var _0x1a7b79={};var _0x58a640={'count':0x0,'rows':[]};return db[_0xc30a('0x3f')]['findOne']({'where':{'id':_0x4e4df0['params']['id']}})[_0xc30a('0x1f')](handleEntityNotFound(_0xd44487,null))[_0xc30a('0x1f')](function(_0x20e2b0){if(_0x20e2b0){_0x1a7b79[_0xc30a('0x42')]=_[_0xc30a('0x55')](db[_0xc30a('0x63')][_0xc30a('0x40')]);_0x1a7b79[_0xc30a('0x43')]=_[_0xc30a('0x55')](_0x4e4df0[_0xc30a('0x43')]);_0x1a7b79[_0xc30a('0x44')]=_[_0xc30a('0x45')](_0x1a7b79['model'],_0x1a7b79[_0xc30a('0x43')]);_0x2b9f30[_0xc30a('0x46')]=_[_0xc30a('0x45')](_0x1a7b79[_0xc30a('0x42')],qs[_0xc30a('0x47')](_0x4e4df0[_0xc30a('0x43')][_0xc30a('0x47')]));_0x2b9f30[_0xc30a('0x46')]=_0x2b9f30[_0xc30a('0x46')][_0xc30a('0x56')]?_0x2b9f30[_0xc30a('0x46')]:_0x1a7b79[_0xc30a('0x42')];if(!_0x4e4df0['query'][_0xc30a('0x48')]('nolimit')){_0x2b9f30[_0xc30a('0x49')]=qs[_0xc30a('0x49')](_0x4e4df0[_0xc30a('0x43')][_0xc30a('0x49')]);_0x2b9f30[_0xc30a('0x2f')]=qs[_0xc30a('0x2f')](_0x4e4df0[_0xc30a('0x43')][_0xc30a('0x2f')]);}_0x2b9f30['order']=qs[_0xc30a('0x4b')](_0x4e4df0['query'][_0xc30a('0x4b')]);_0x2b9f30[_0xc30a('0x4c')]=qs['filters'](_[_0xc30a('0x65')](_0x4e4df0[_0xc30a('0x43')],_0x1a7b79[_0xc30a('0x44')]));_0x2b9f30[_0xc30a('0x4c')][_0xc30a('0x66')]=_0x20e2b0['id'];if(_0x4e4df0[_0xc30a('0x43')][_0xc30a('0x4e')]){_0x2b9f30[_0xc30a('0x4c')]=_[_0xc30a('0x4f')](_0x2b9f30[_0xc30a('0x4c')],{'$or':_[_0xc30a('0x3e')](_0x2b9f30[_0xc30a('0x46')],function(_0x583bce){var _0x5328af={};_0x5328af[_0x583bce]={'$like':'%'+_0x4e4df0[_0xc30a('0x43')][_0xc30a('0x4e')]+'%'};return _0x5328af;})});}_0x2b9f30=_[_0xc30a('0x4f')]({},_0x2b9f30,_0x4e4df0['options']);return db[_0xc30a('0x63')][_0xc30a('0x2e')]({'where':_0x2b9f30[_0xc30a('0x4c')]})[_0xc30a('0x1f')](function(_0xda8f12){_0x58a640['count']=_0xda8f12;if(_0x4e4df0[_0xc30a('0x43')][_0xc30a('0x50')]){_0x2b9f30['include']=[{'all':!![]}];}return db['Disposition'][_0xc30a('0x52')](_0x2b9f30);})['then'](function(_0x4f830a){_0x58a640['rows']=_0x4f830a;return _0x58a640;});}})[_0xc30a('0x1f')](respondWithFilteredResult(_0xd44487,_0x2b9f30))[_0xc30a('0x29')](handleError(_0xd44487,null));};exports[_0xc30a('0x67')]=function(_0x1de589,_0x5008ea,_0x1223d8){return db['OpenchannelAccount']['find']({'where':{'id':_0x1de589[_0xc30a('0x60')]['id']}})[_0xc30a('0x1f')](handleEntityNotFound(_0x5008ea,null))[_0xc30a('0x1f')](function(_0x141302){if(_0x141302){return _0x141302['removeDispositions'](_0x1de589['query'][_0xc30a('0x68')]);}})[_0xc30a('0x1f')](respondWithStatusCode(_0x5008ea,null))[_0xc30a('0x29')](handleError(_0x5008ea,null));};exports[_0xc30a('0x69')]=function(_0x380dbe,_0x51e1d3,_0x228366){if(_0x380dbe['body']['id']){delete _0x380dbe['body']['id'];}return db[_0xc30a('0x3f')][_0xc30a('0x57')]({'where':{'id':_0x380dbe['params']['id']}})[_0xc30a('0x1f')](handleEntityNotFound(_0x51e1d3,null))[_0xc30a('0x1f')](function(_0x51ff2d){if(_0x51ff2d){_0x380dbe[_0xc30a('0x59')][_0xc30a('0x66')]=_0x51ff2d['id'];return db[_0xc30a('0x6a')][_0xc30a('0x58')](_0x380dbe[_0xc30a('0x59')]);}})[_0xc30a('0x1f')](respondWithResult(_0x51e1d3,null))[_0xc30a('0x29')](handleError(_0x51e1d3,null));};exports[_0xc30a('0x6b')]=function(_0x340f3a,_0x17f44d,_0x25674f){var _0x53cd97={'raw':![],'where':{}};var _0x582e66={};var _0x331297={'count':0x0,'rows':[]};return db[_0xc30a('0x3f')]['findOne']({'where':{'id':_0x340f3a['params']['id']}})[_0xc30a('0x1f')](handleEntityNotFound(_0x17f44d,null))[_0xc30a('0x1f')](function(_0x3ff39b){if(_0x3ff39b){_0x582e66[_0xc30a('0x42')]=_['keys'](db[_0xc30a('0x6a')][_0xc30a('0x40')]);_0x582e66[_0xc30a('0x43')]=_[_0xc30a('0x55')](_0x340f3a['query']);_0x582e66['filters']=_[_0xc30a('0x45')](_0x582e66[_0xc30a('0x42')],_0x582e66[_0xc30a('0x43')]);_0x53cd97[_0xc30a('0x46')]=_['intersection'](_0x582e66['model'],qs[_0xc30a('0x47')](_0x340f3a[_0xc30a('0x43')][_0xc30a('0x47')]));_0x53cd97[_0xc30a('0x46')]=_0x53cd97['attributes'][_0xc30a('0x56')]?_0x53cd97[_0xc30a('0x46')]:_0x582e66[_0xc30a('0x42')];if(!_0x340f3a[_0xc30a('0x43')]['hasOwnProperty'](_0xc30a('0x6c'))){_0x53cd97[_0xc30a('0x49')]=qs['limit'](_0x340f3a[_0xc30a('0x43')]['limit']);_0x53cd97[_0xc30a('0x2f')]=qs[_0xc30a('0x2f')](_0x340f3a[_0xc30a('0x43')][_0xc30a('0x2f')]);}_0x53cd97[_0xc30a('0x4a')]=qs[_0xc30a('0x4b')](_0x340f3a[_0xc30a('0x43')][_0xc30a('0x4b')]);_0x53cd97['where']=qs[_0xc30a('0x44')](_[_0xc30a('0x65')](_0x340f3a[_0xc30a('0x43')],_0x582e66[_0xc30a('0x44')]));_0x53cd97[_0xc30a('0x4c')][_0xc30a('0x66')]=_0x3ff39b['id'];if(_0x340f3a['query'][_0xc30a('0x4e')]){_0x53cd97[_0xc30a('0x4c')]=_[_0xc30a('0x4f')](_0x53cd97[_0xc30a('0x4c')],{'$or':_[_0xc30a('0x3e')](_0x53cd97[_0xc30a('0x46')],function(_0x553a6a){var _0x3094c5={};_0x3094c5[_0x553a6a]={'$like':'%'+_0x340f3a['query'][_0xc30a('0x4e')]+'%'};return _0x3094c5;})});}_0x53cd97=_[_0xc30a('0x4f')]({},_0x53cd97,_0x340f3a[_0xc30a('0x6d')]);return db[_0xc30a('0x6a')][_0xc30a('0x2e')]({'where':_0x53cd97[_0xc30a('0x4c')]})[_0xc30a('0x1f')](function(_0xff3e7d){_0x331297[_0xc30a('0x2e')]=_0xff3e7d;if(_0x340f3a['query'][_0xc30a('0x50')]){_0x53cd97['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x53cd97);})[_0xc30a('0x1f')](function(_0x4e65d1){_0x331297[_0xc30a('0x6e')]=_0x4e65d1;return _0x331297;});}})[_0xc30a('0x1f')](respondWithFilteredResult(_0x17f44d,_0x53cd97))[_0xc30a('0x29')](handleError(_0x17f44d,null));};exports['removeAnswers']=function(_0x3041f7,_0x5978a5,_0xa6d50b){return db[_0xc30a('0x3f')][_0xc30a('0x57')]({'where':{'id':_0x3041f7[_0xc30a('0x60')]['id']}})[_0xc30a('0x1f')](handleEntityNotFound(_0x5978a5,null))[_0xc30a('0x1f')](function(_0x160da8){if(_0x160da8){return _0x160da8['removeAnswers'](_0x3041f7['query'][_0xc30a('0x68')]);}})['then'](respondWithStatusCode(_0x5978a5,null))[_0xc30a('0x29')](handleError(_0x5978a5,null));};exports[_0xc30a('0x6f')]=function(_0x2f12aa,_0x3867ac,_0x2f0bf6){var _0x22d795={'body':_0x2f12aa['body'],'channel':_0xc30a('0x70')};var _0x30f447=[];var _0x588adc=[];var _0x25d665={};var _0x47b485=![];return db[_0xc30a('0x71')][_0xc30a('0x61')]()['then'](function(_0x5858e3){if(!_0x5858e3){throw new db[(_0xc30a('0x72'))][(_0xc30a('0x73'))](_0xc30a('0x74'));}_0x30f447=_[_0xc30a('0x75')](_[_0xc30a('0x55')](_0x5858e3),[_0xc30a('0x76'),'updatedAt']);_0x588adc=_[_0xc30a('0x75')](_['keys'](_0x5858e3),[_0xc30a('0x76'),_0xc30a('0x77'),_0xc30a('0x78'),_0xc30a('0x79')]);if(_0x2f12aa['body']['id']){delete _0x2f12aa[_0xc30a('0x59')]['id'];}if(_['isNil'](_0x2f12aa['body'][_0xc30a('0x7a')])){throw new db[(_0xc30a('0x72'))][(_0xc30a('0x73'))](_0xc30a('0x7b'));}if(_[_0xc30a('0x7c')](_0x2f12aa['body']['body'])||_0x2f12aa['body'][_0xc30a('0x59')]===''){throw new db[(_0xc30a('0x72'))][(_0xc30a('0x73'))](_0xc30a('0x7d'));}if(_[_0xc30a('0x7c')](_0x2f12aa[_0xc30a('0x59')]['mapKey'])){throw new db['Sequelize'][(_0xc30a('0x73'))](_0xc30a('0x7e')+_0x588adc);}if(!_['includes'](_0x588adc,_0x2f12aa[_0xc30a('0x59')][_0xc30a('0x7f')])){throw new db['Sequelize'][(_0xc30a('0x73'))](_0xc30a('0x80')+_0x588adc);}_0x25d665[_0x2f12aa[_0xc30a('0x59')][_0xc30a('0x7f')]]=_0x2f12aa[_0xc30a('0x59')]['from'];})['then'](function(){return db[_0xc30a('0x3f')][_0xc30a('0x57')]({'where':{'id':_0x2f12aa[_0xc30a('0x60')]['id']},'include':[{'model':db[_0xc30a('0x81')],'as':_0xc30a('0x82'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x25d665,'limit':0x1,'order':[[_0xc30a('0x77'),_0xc30a('0x83')]]}]},{'model':db[_0xc30a('0x84')],'as':_0xc30a('0x85')}]});})[_0xc30a('0x1f')](handleEntityNotFound(_0x3867ac,null))['then'](function(_0x3a5e0d){if(_0x3a5e0d&&_0x3a5e0d[_0xc30a('0x82')]){_0x22d795[_0xc30a('0x86')]=_0x3a5e0d;_0x22d795[_0xc30a('0x87')]=_0x3a5e0d['Applications'];_0x22d795[_0xc30a('0x88')]=_0x3a5e0d['List'];_0x22d795['applications']=_[_0xc30a('0x89')](_0x22d795[_0xc30a('0x87')],['priority'],[_0xc30a('0x8a')]);if(_0x22d795['account'][_0xc30a('0x85')]){delete _0x22d795[_0xc30a('0x86')][_0xc30a('0x85')];}if(_0x22d795[_0xc30a('0x86')][_0xc30a('0x82')]&&_0x22d795[_0xc30a('0x86')][_0xc30a('0x82')][_0xc30a('0x8b')]['length']){return _0x22d795[_0xc30a('0x86')]['List'][_0xc30a('0x8b')][0x0];}var _0x578e99=_[_0xc30a('0x8c')](_0x2f12aa[_0xc30a('0x59')],{'firstName':_0x2f12aa[_0xc30a('0x59')]['from'],'ListId':_0x3a5e0d[_0xc30a('0x79')]});_0x578e99[_0x2f12aa['body'][_0xc30a('0x7f')]]=_0x2f12aa['body'][_0xc30a('0x7a')];return db[_0xc30a('0x71')][_0xc30a('0x58')](_0x578e99,{'fields':_0x30f447,'raw':!![]});}})['then'](handleEntityNotFound(_0x3867ac,null))[_0xc30a('0x1f')](function(_0x546f4d){_0x22d795[_0xc30a('0x8d')]=_0x546f4d;if(_0x546f4d){var _0x267237={'ContactId':_0x546f4d['id'],'OpenchannelAccountId':_0x2f12aa[_0xc30a('0x60')]['id'],'from':(_0x546f4d[_0xc30a('0x8e')]||'')+'\x20'+(_0x546f4d['lastName']||'')};var _0x120a5c={'OpenchannelAccountId':_0x2f12aa[_0xc30a('0x60')]['id'],'closed':![]};if(_0x2f12aa[_0xc30a('0x59')]['threadId']){_0x120a5c['threadId']=_0x2f12aa[_0xc30a('0x59')]['threadId'];return db[_0xc30a('0x8f')][_0xc30a('0x57')]({'where':_0x120a5c})[_0xc30a('0x1f')](function(_0x331596){if(_0x331596){return[_0x331596,![]];}_0x267237[_0xc30a('0x90')]=_0x2f12aa[_0xc30a('0x59')][_0xc30a('0x90')];_0x267237[_0xc30a('0x91')]=_0x2f12aa[_0xc30a('0x59')][_0xc30a('0x91')];return db[_0xc30a('0x8f')][_0xc30a('0x58')](_0x267237)[_0xc30a('0x1f')](function(_0x1f334f){return[_0x1f334f,!![]];});});}else{_0x120a5c[_0xc30a('0x90')]=null;}_0x120a5c[_0xc30a('0x92')]=_0x546f4d['id'];return db[_0xc30a('0x8f')][_0xc30a('0x57')]({'where':_0x120a5c})['then'](function(_0x127d36){if(_0x127d36){return[_0x127d36,![]];}return db['OpenchannelInteraction'][_0xc30a('0x58')](_0x267237)[_0xc30a('0x1f')](function(_0x127fbd){return[_0x127fbd,!![]];});});}})[_0xc30a('0x93')](function(_0x4cca3c,_0x5b7163){if(_0x4cca3c){_0x47b485=_0x5b7163;if(!_0x5b7163){var _0x2955fb={'from':(_0x22d795[_0xc30a('0x8d')][_0xc30a('0x8e')]||'')+'\x20'+(_0x22d795[_0xc30a('0x8d')][_0xc30a('0x94')]||'')};if(_0x2f12aa[_0xc30a('0x59')]['threadId']&&_0x2f12aa['body']['messageId']&&_0x2f12aa['body'][_0xc30a('0x90')]!=_0x2f12aa[_0xc30a('0x59')][_0xc30a('0x95')]){_0x2955fb[_0xc30a('0x90')]=_0x2f12aa[_0xc30a('0x59')][_0xc30a('0x95')];}return _0x4cca3c[_0xc30a('0x35')](_0x2955fb);}else{return _0x4cca3c;}}})[_0xc30a('0x1f')](function(_0x20e477){_0x22d795[_0xc30a('0x96')]=_0x20e477['get']({'plain':!![]});_0x22d795['interaction']['created']=_0x47b485;if(_0x22d795[_0xc30a('0x96')]['created']){if(_0x22d795[_0xc30a('0x86')][_0xc30a('0x97')]){_0x22d795[_0xc30a('0x87')]['push']({'id':0x0,'priority':_0x22d795['applications'][_0xc30a('0x56')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xc30a('0x98')});}}return db['OpenchannelMessage'][_0xc30a('0x58')]({'body':_0x2f12aa[_0xc30a('0x59')][_0xc30a('0x59')],'OpenchannelAccountId':_0x2f12aa['params']['id'],'OpenchannelInteractionId':_0x20e477['id'],'direction':'in','ContactId':_0x22d795[_0xc30a('0x8d')]['id'],'AttachmentId':_0x2f12aa[_0xc30a('0x59')][_0xc30a('0x99')]});})[_0xc30a('0x1f')](function(_0x3601ad){_0x22d795[_0xc30a('0x27')]=_0x3601ad;if(_0x22d795[_0xc30a('0x96')]['UserId']){return db['User'][_0xc30a('0x57')]({'attributes':['id',_0xc30a('0x3b')],'where':{'id':_0x22d795[_0xc30a('0x96')][_0xc30a('0x9a')]}})[_0xc30a('0x1f')](function(_0x5fd369){if(_0x5fd369){_0x22d795[_0xc30a('0x87')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc30a('0x9b'),'appdata':_0x5fd369[_0xc30a('0x3b')]+','+(_0x22d795[_0xc30a('0x86')][_0xc30a('0x9c')]||0xa),'interval':'*,*,*,*'});_0x22d795[_0xc30a('0x9d')]=![];}return respondWithRpcPromise(_0xc30a('0x9e'),'startRouting',_0x22d795);});}return respondWithRpcPromise(_0xc30a('0x9e'),_0xc30a('0x9f'),_0x22d795);})[_0xc30a('0x1f')](function(_0x405a50){respondWithRpcPromise(_0xc30a('0xa0'),_0xc30a('0xa0'),{'event':_0xc30a('0x6f'),'message':_0x405a50},client9002);return _0x405a50;})[_0xc30a('0x1f')](respondWithResult(_0x3867ac,null))[_0xc30a('0x29')](handleError(_0x3867ac,null));};exports[_0xc30a('0xa1')]=function(_0x20fcce,_0x22c54d,_0x266443){return db[_0xc30a('0x3f')][_0xc30a('0xa2')]({'where':{'id':_0x20fcce['params']['id']}})['then'](handleEntityNotFound(_0x22c54d,null))[_0xc30a('0x1f')](function(_0x3955bb){if(_0x3955bb){return db['sequelize'][_0xc30a('0xa3')](function(_0x4f158f){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x20fcce[_0xc30a('0x60')]['id']},'transaction':_0x4f158f})[_0xc30a('0x1f')](function(_0x45cc3e){var _0x17ced8=_[_0xc30a('0x3e')](_0x20fcce[_0xc30a('0x59')],function(_0x4c51dc){_0x4c51dc[_0xc30a('0x66')]=_0x20fcce[_0xc30a('0x60')]['id'];return _0x4c51dc;});return db[_0xc30a('0x84')]['bulkCreate'](_0x17ced8,{'transaction':_0x4f158f});});})[_0xc30a('0x1f')](function(){return db['OpenchannelApplication'][_0xc30a('0xa4')]({'where':{'OpenchannelAccountId':_0x20fcce['params']['id']},'order':_0xc30a('0xa5')});});}})[_0xc30a('0x1f')](respondWithResult(_0x22c54d,null))[_0xc30a('0x29')](handleError(_0x22c54d,null));};exports[_0xc30a('0xa6')]=function(_0x26d01a,_0x2df07e,_0x12f923){var _0x3f6741={};var _0x7d1dbf={};var _0x4d4bab;var _0x5f0aa9;return db['OpenchannelAccount'][_0xc30a('0xa2')]({'where':{'id':_0x26d01a[_0xc30a('0x60')]['id']}})[_0xc30a('0x1f')](handleEntityNotFound(_0x2df07e,null))['then'](function(_0x5b4660){if(_0x5b4660){_0x4d4bab=_0x5b4660;_0x7d1dbf[_0xc30a('0x42')]=_[_0xc30a('0x55')](db[_0xc30a('0x84')][_0xc30a('0x40')]);_0x7d1dbf['query']=_[_0xc30a('0x55')](_0x26d01a['query']);_0x7d1dbf[_0xc30a('0x44')]=_[_0xc30a('0x45')](_0x7d1dbf['model'],_0x7d1dbf['query']);_0x3f6741[_0xc30a('0x46')]=_[_0xc30a('0x45')](_0x7d1dbf[_0xc30a('0x42')],qs[_0xc30a('0x47')](_0x26d01a['query']['fields']));_0x3f6741[_0xc30a('0x46')]=_0x3f6741[_0xc30a('0x46')][_0xc30a('0x56')]?_0x3f6741[_0xc30a('0x46')]:_0x7d1dbf[_0xc30a('0x42')];_0x3f6741['order']=qs[_0xc30a('0x4b')](_0x26d01a[_0xc30a('0x43')]['sort']);_0x3f6741[_0xc30a('0x4c')]=qs[_0xc30a('0x44')](_[_0xc30a('0x65')](_0x26d01a[_0xc30a('0x43')],_0x7d1dbf['filters']));if(_0x26d01a[_0xc30a('0x43')][_0xc30a('0x4e')]){_0x3f6741[_0xc30a('0x4c')]=_[_0xc30a('0x4f')](_0x3f6741['where'],{'$or':_[_0xc30a('0x3e')](_0x3f6741[_0xc30a('0x46')],function(_0x43ba77){var _0x3e9b86={};_0x3e9b86[_0x43ba77]={'$like':'%'+_0x26d01a[_0xc30a('0x43')]['filter']+'%'};return _0x3e9b86;})});}_0x3f6741=_[_0xc30a('0x4f')]({},_0x3f6741,_0x26d01a[_0xc30a('0x6d')]);return _0x4d4bab[_0xc30a('0xa6')](_0x3f6741);}})[_0xc30a('0x1f')](function(_0x48d5a0){if(_0x48d5a0){_0x5f0aa9=_0x48d5a0['length'];if(!_0x26d01a[_0xc30a('0x43')][_0xc30a('0x48')](_0xc30a('0x6c'))){_0x3f6741[_0xc30a('0x49')]=qs['limit'](_0x26d01a[_0xc30a('0x43')]['limit']);_0x3f6741[_0xc30a('0x2f')]=qs[_0xc30a('0x2f')](_0x26d01a[_0xc30a('0x43')][_0xc30a('0x2f')]);}return _0x4d4bab[_0xc30a('0xa6')](_0x3f6741);}})[_0xc30a('0x1f')](function(_0x3da2ac){if(_0x3da2ac){return _0x3da2ac?{'count':_0x5f0aa9,'rows':_0x3da2ac}:null;}})['then'](respondWithResult(_0x2df07e,null))[_0xc30a('0x29')](handleError(_0x2df07e,null));};exports[_0xc30a('0xa7')]=function(_0x48d295,_0x16227d,_0xca9bcf){var _0x2b2b54={'raw':![],'where':{}};var _0x2e2295={};var _0x1d7641={'count':0x0,'rows':[]};return db[_0xc30a('0x3f')][_0xc30a('0xa2')]({'where':{'id':_0x48d295[_0xc30a('0x60')]['id']}})[_0xc30a('0x1f')](handleEntityNotFound(_0x16227d,null))[_0xc30a('0x1f')](function(_0xeb53d6){if(_0xeb53d6){_0x2e2295[_0xc30a('0x42')]=_[_0xc30a('0x55')](db[_0xc30a('0x8f')]['rawAttributes']);_0x2e2295[_0xc30a('0x43')]=_[_0xc30a('0x55')](_0x48d295['query']);_0x2e2295[_0xc30a('0x44')]=_[_0xc30a('0x45')](_0x2e2295[_0xc30a('0x42')],_0x2e2295['query']);_0x2b2b54[_0xc30a('0x46')]=_[_0xc30a('0x45')](_0x2e2295['model'],qs['fields'](_0x48d295['query'][_0xc30a('0x47')]));_0x2b2b54[_0xc30a('0x46')]=_0x2b2b54[_0xc30a('0x46')][_0xc30a('0x56')]?_0x2b2b54[_0xc30a('0x46')]:_0x2e2295[_0xc30a('0x42')];if(!_0x48d295['query']['hasOwnProperty'](_0xc30a('0x6c'))){_0x2b2b54[_0xc30a('0x49')]=qs[_0xc30a('0x49')](_0x48d295['query'][_0xc30a('0x49')]);_0x2b2b54[_0xc30a('0x2f')]=qs[_0xc30a('0x2f')](_0x48d295[_0xc30a('0x43')][_0xc30a('0x2f')]);}_0x2b2b54[_0xc30a('0x4a')]=qs[_0xc30a('0x4b')](_0x48d295['query'][_0xc30a('0x4b')]);_0x2b2b54[_0xc30a('0x4c')]=qs[_0xc30a('0x44')](_[_0xc30a('0x65')](_0x48d295[_0xc30a('0x43')],_0x2e2295['filters']));_0x2b2b54['where'][_0xc30a('0x66')]=_0xeb53d6['id'];if(_0x48d295[_0xc30a('0x43')]['filter']){_0x2b2b54[_0xc30a('0x4c')]=_[_0xc30a('0x4f')](_0x2b2b54[_0xc30a('0x4c')],{'$or':_[_0xc30a('0x3e')](_0x2b2b54[_0xc30a('0x46')],function(_0x5c51a6){var _0x446dc8={};_0x446dc8[_0x5c51a6]={'$like':'%'+_0x48d295[_0xc30a('0x43')][_0xc30a('0x4e')]+'%'};return _0x446dc8;})});}_0x2b2b54=_[_0xc30a('0x4f')]({},_0x2b2b54,_0x48d295[_0xc30a('0x6d')]);return db[_0xc30a('0x8f')][_0xc30a('0x2e')]({'where':_0x2b2b54[_0xc30a('0x4c')]})['then'](function(_0xb5d1b7){_0x1d7641['count']=_0xb5d1b7;if(_0x48d295[_0xc30a('0x43')]['includeAll']){_0x2b2b54[_0xc30a('0x51')]=[{'model':db[_0xc30a('0x71')],'as':_0xc30a('0xa8'),'required':![]},{'model':db['User'],'as':_0xc30a('0xa9'),'attributes':[_0xc30a('0x3b'),_0xc30a('0xaa'),_0xc30a('0xab')],'required':![]},{'model':db[_0xc30a('0xac')],'as':'Tags','attributes':['id',_0xc30a('0x3b'),'color'],'where':_0x48d295[_0xc30a('0x43')]['tag']?{'id':_0x48d295[_0xc30a('0x43')][_0xc30a('0xad')]}:undefined,'required':_0x48d295[_0xc30a('0x43')][_0xc30a('0xad')]?!![]:![]}];}return db[_0xc30a('0x8f')]['findAll'](_0x2b2b54);})[_0xc30a('0x1f')](function(_0x19543f){_0x1d7641[_0xc30a('0x6e')]=_0x19543f;return _0x1d7641;});}})['then'](respondWithFilteredResult(_0x16227d,_0x2b2b54))[_0xc30a('0x29')](handleError(_0x16227d,null));};exports[_0xc30a('0xae')]=function(_0x2c581f,_0x16d55a,_0x4cac77){return db[_0xc30a('0x3f')]['find']({'where':{'id':_0x2c581f[_0xc30a('0x60')]['id']}})['then'](handleEntityNotFound(_0x16d55a,null))['then'](function(_0x1585d8){if(_0x1585d8){return _0x1585d8[_0xc30a('0xae')](_0x2c581f[_0xc30a('0x59')][_0xc30a('0x68')],_['omit'](_0x2c581f[_0xc30a('0x59')],[_0xc30a('0x68'),'id'])||{})[_0xc30a('0x93')](function(_0x229f8a){for(var _0x3deee9=0x0;_0x3deee9<_0x2c581f[_0xc30a('0x59')]['ids'][_0xc30a('0x56')];_0x3deee9+=0x1){socket[_0xc30a('0xaf')](_0xc30a('0xb0'),{'UserId':Number(_0x2c581f['body'][_0xc30a('0x68')][_0x3deee9]),'OpenchannelAccountId':Number(_0x2c581f['params']['id'])});}return _0x229f8a;});}})['then'](respondWithResult(_0x16d55a,null))[_0xc30a('0x29')](handleError(_0x16d55a,null));};exports[_0xc30a('0xb1')]=function(_0x5f045d,_0xe434af,_0x119717){return db[_0xc30a('0x3f')]['find']({'where':{'id':_0x5f045d[_0xc30a('0x60')]['id']}})[_0xc30a('0x1f')](handleEntityNotFound(_0xe434af,null))[_0xc30a('0x1f')](function(_0x4d0d73){if(_0x4d0d73){return _0x4d0d73[_0xc30a('0xb1')](_0x5f045d[_0xc30a('0x43')][_0xc30a('0x68')])[_0xc30a('0x1f')](function(){if(_[_0xc30a('0xb2')](_0x5f045d['query'][_0xc30a('0x68')])){for(var _0x1ba5b6=0x0;_0x1ba5b6<_0x5f045d['query']['ids'][_0xc30a('0x56')];_0x1ba5b6+=0x1){socket['emit'](_0xc30a('0xb3'),{'UserId':Number(_0x5f045d[_0xc30a('0x43')]['ids'][_0x1ba5b6]),'OpenchannelAccountId':Number(_0x5f045d['params']['id'])});}}else{socket['emit'](_0xc30a('0xb3'),{'UserId':Number(_0x5f045d[_0xc30a('0x43')][_0xc30a('0x68')]),'OpenchannelAccountId':Number(_0x5f045d[_0xc30a('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0xe434af,null))[_0xc30a('0x29')](handleError(_0xe434af,null));};exports[_0xc30a('0xb4')]=function(_0x37c817,_0x5c666b,_0xb271ee){var _0x56a019={};var _0x4d2c3a={};var _0x1e2f6e;var _0x259f3f;return db[_0xc30a('0x3f')][_0xc30a('0xa2')]({'where':{'id':_0x37c817['params']['id']}})[_0xc30a('0x1f')](handleEntityNotFound(_0x5c666b,null))['then'](function(_0x15826a){if(_0x15826a){_0x1e2f6e=_0x15826a;_0x4d2c3a[_0xc30a('0x42')]=_['keys'](db[_0xc30a('0xb5')][_0xc30a('0x40')]);_0x4d2c3a[_0xc30a('0x43')]=_[_0xc30a('0x55')](_0x37c817[_0xc30a('0x43')]);_0x4d2c3a[_0xc30a('0x44')]=_[_0xc30a('0x45')](_0x4d2c3a[_0xc30a('0x42')],_0x4d2c3a[_0xc30a('0x43')]);_0x56a019['attributes']=_[_0xc30a('0x45')](_0x4d2c3a[_0xc30a('0x42')],qs['fields'](_0x37c817[_0xc30a('0x43')][_0xc30a('0x47')]));_0x56a019[_0xc30a('0x46')]=_0x56a019['attributes'][_0xc30a('0x56')]?_0x56a019['attributes']:_0x4d2c3a[_0xc30a('0x42')];_0x56a019['order']=qs[_0xc30a('0x4b')](_0x37c817[_0xc30a('0x43')][_0xc30a('0x4b')]);_0x56a019[_0xc30a('0x4c')]=qs['filters'](_[_0xc30a('0x65')](_0x37c817[_0xc30a('0x43')],_0x4d2c3a[_0xc30a('0x44')]));if(_0x37c817[_0xc30a('0x43')]['filter']){_0x56a019[_0xc30a('0x4c')]=_[_0xc30a('0x4f')](_0x56a019[_0xc30a('0x4c')],{'$or':_['map'](_0x56a019[_0xc30a('0x46')],function(_0x22ad6e){var _0x49de86={};_0x49de86[_0x22ad6e]={'$like':'%'+_0x37c817[_0xc30a('0x43')]['filter']+'%'};return _0x49de86;})});}_0x56a019=_[_0xc30a('0x4f')]({},_0x56a019,_0x37c817['options']);return _0x1e2f6e[_0xc30a('0xb4')](_0x56a019);}})[_0xc30a('0x1f')](function(_0x582a03){if(_0x582a03){_0x259f3f=_0x582a03[_0xc30a('0x56')];if(!_0x37c817['query']['hasOwnProperty'](_0xc30a('0x6c'))){_0x56a019[_0xc30a('0x49')]=qs[_0xc30a('0x49')](_0x37c817[_0xc30a('0x43')][_0xc30a('0x49')]);_0x56a019[_0xc30a('0x2f')]=qs[_0xc30a('0x2f')](_0x37c817[_0xc30a('0x43')][_0xc30a('0x2f')]);}return _0x1e2f6e[_0xc30a('0xb4')](_0x56a019);}})[_0xc30a('0x1f')](function(_0x252673){if(_0x252673){return _0x252673?{'count':_0x259f3f,'rows':_0x252673}:null;}})[_0xc30a('0x1f')](respondWithResult(_0x5c666b,null))[_0xc30a('0x29')](handleError(_0x5c666b,null));};exports['send']=function(_0x394da8,_0xe5c883,_0x468d31){var _0x5040a7,_0x4e1991,_0x35c954;if(_['isNil'](_0x394da8[_0xc30a('0x59')][_0xc30a('0x59')])||_0x394da8[_0xc30a('0x59')]['body']===''){throw new db[(_0xc30a('0x72'))][(_0xc30a('0x73'))](_0xc30a('0x7d'));}if(_[_0xc30a('0x7c')](_0x394da8['body']['to'])){}_0x5040a7=_0x394da8['body']['to'];return db[_0xc30a('0x3f')][_0xc30a('0xa2')]({'where':{'id':_0x394da8['params']['id']}})[_0xc30a('0x1f')](handleEntityNotFound(_0xe5c883,null))[_0xc30a('0x1f')](function(_0x17f6d1){if(_0x17f6d1){return db['OpenchannelAccount'][_0xc30a('0x57')]({'where':{'id':_0x17f6d1['id']},'include':[{'model':db[_0xc30a('0x81')],'as':_0xc30a('0x82'),'include':[{'model':db['CmContact'],'as':_0xc30a('0x8b'),'where':{[_0x17f6d1[_0xc30a('0x7f')]]:_0x5040a7},'limit':0x1,'order':[[_0xc30a('0x77'),_0xc30a('0x83')]]}]}]})[_0xc30a('0x1f')](handleEntityNotFound(_0xe5c883,null))[_0xc30a('0x1f')](function(_0x19aee3){if(_0x19aee3&&_0x19aee3[_0xc30a('0x82')]){_0x4e1991=_0x19aee3[_0xc30a('0x37')]({'plain':!![]});if(_0x4e1991[_0xc30a('0x82')]&&_0x4e1991['List']['Contacts'][_0xc30a('0x56')]){return _0x4e1991[_0xc30a('0x82')][_0xc30a('0x8b')][0x0];}return db[_0xc30a('0x71')][_0xc30a('0x58')](_[_0xc30a('0x8c')](_0x394da8[_0xc30a('0x59')],{'firstName':_0x5040a7,[_0x19aee3['mapKey']]:_0x5040a7,'phone':_0x5040a7,'ListId':_0x4e1991[_0xc30a('0x79')]}));}})[_0xc30a('0x1f')](handleEntityNotFound(_0xe5c883,null))[_0xc30a('0x1f')](function(_0x2840f9){if(_0x2840f9){_0x35c954=_0x2840f9;return db[_0xc30a('0x8f')]['find']({'where':{'ContactId':_0x35c954['id'],'closed':![],'OpenchannelAccountId':_0x4e1991['id']}})[_0xc30a('0x1f')](function(_0x3eb637){if(_0x3eb637){return[_0x3eb637,![]];}return db[_0xc30a('0x8f')][_0xc30a('0x58')]({'UserId':_0x394da8[_0xc30a('0x5a')]['id'],'ContactId':_0x35c954['id'],'OpenchannelAccountId':_0x4e1991['id'],'lastMsgDirection':'out','Messages':[_[_0xc30a('0x4f')](_0x394da8[_0xc30a('0x59')],{'read':![],'body':_0x394da8['body'][_0xc30a('0x59')],'OpenchannelAccountId':_0x4e1991['id'],'UserId':_0x394da8[_0xc30a('0x5a')]['id'],'ContactId':_0x35c954['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xc30a('0xb6')}]})[_0xc30a('0x1f')](function(_0x4c7fcf){return[_0x4c7fcf,!![]];});});}})[_0xc30a('0x93')](function(_0x13cb3f,_0x6b62e1){if(_0x6b62e1){return _0x13cb3f;}return db[_0xc30a('0xb7')]['create'](_[_0xc30a('0x4f')](_0x394da8[_0xc30a('0x59')],{'read':![],'body':_0x394da8['body']['body'],'OpenchannelAccountId':_0x4e1991['id'],'OpenchannelInteractionId':_0x13cb3f['id'],'UserId':_0x394da8[_0xc30a('0x5a')]['id'],'ContactId':_0x35c954['id']}))['then'](function(_0xfda258){_0x13cb3f[_0xc30a('0xb8')][_0xc30a('0xb6')]=[];_0x13cb3f[_0xc30a('0xb8')]['Messages'][_0xc30a('0xb9')](_0xfda258[_0xc30a('0xb8')]);return _0x13cb3f;});});}})[_0xc30a('0x1f')](respondWithResult(_0xe5c883,null))[_0xc30a('0x29')](handleError(_0xe5c883,null));}; \ No newline at end of file +var _0xb786=['getAgents','DESC','out','OpenchannelMessage','Messages','dataValues','push','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','get','OpenchannelAccounts','UserProfileResource','destroy','end','stack','name','send','index','Pause','OpenchannelAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','mandatoryDispositionPause','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','length','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','difference','createdAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','updatedAt','account','applications','Applications','list','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','close','unmanaged','*,*,*,*','UserId','User','unshift','agent','forcedOwnership','startRouting','EventManager','addApplications','sequelize','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','emit','userOpenchannelAccount:remove'];(function(_0x2f1e7d,_0x7513f4){var _0x139180=function(_0x29f6b4){while(--_0x29f6b4){_0x2f1e7d['push'](_0x2f1e7d['shift']());}};_0x139180(++_0x7513f4);}(_0xb786,0xc1));var _0x6b78=function(_0x2d0b84,_0x34682d){_0x2d0b84=_0x2d0b84-0x0;var _0x8d0088=_0xb786[_0x2d0b84];return _0x8d0088;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b78('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b78('0x1'));var moment=require(_0x6b78('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6b78('0x3'));var util=require(_0x6b78('0x4'));var path=require('path');var sox=require(_0x6b78('0x5'));var csv=require(_0x6b78('0x6'));var ejs=require(_0x6b78('0x7'));var fs=require('fs');var fs_extra=require(_0x6b78('0x8'));var _=require('lodash');var squel=require(_0x6b78('0x9'));var crypto=require(_0x6b78('0xa'));var jsforce=require(_0x6b78('0xb'));var deskjs=require(_0x6b78('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6b78('0xd'));var Papa=require(_0x6b78('0xe'));var Redis=require(_0x6b78('0xf'));var authService=require(_0x6b78('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6b78('0x11'));var hardwareService=require(_0x6b78('0x12'));var logger=require('../../config/logger')(_0x6b78('0x13'));var utils=require(_0x6b78('0x14'));var config=require(_0x6b78('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x6b78('0x16')](config[_0x6b78('0x17')],{'host':_0x6b78('0x18'),'port':0x18eb});var socket=require(_0x6b78('0x19'))(new Redis(config[_0x6b78('0x17')]));require(_0x6b78('0x1a'))['register'](socket);var jayson=require(_0x6b78('0x1b'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20ebcc,_0x4a6912,_0x4c8803,_0x38469b){return new BPromise(function(_0x4f5557,_0x38a15f){var _0x1e2762=_0x38469b||client;return _0x1e2762[_0x6b78('0x1c')](_0x20ebcc,_0x4c8803)[_0x6b78('0x1d')](function(_0x4d1d2d){logger[_0x6b78('0x1e')](_0x6b78('0x1f'),_0x4a6912,_0x6b78('0x20'));logger[_0x6b78('0x21')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4a6912,'request\x20sent',JSON[_0x6b78('0x22')](_0x4d1d2d));if(_0x4d1d2d[_0x6b78('0x23')]){if(_0x4d1d2d[_0x6b78('0x23')][_0x6b78('0x24')]===0x1f4){logger[_0x6b78('0x23')](_0x6b78('0x1f'),_0x4a6912,_0x4d1d2d[_0x6b78('0x23')]['message']);return _0x38a15f(_0x4d1d2d['error'][_0x6b78('0x25')]);}logger[_0x6b78('0x23')](_0x6b78('0x1f'),_0x4a6912,_0x4d1d2d[_0x6b78('0x23')][_0x6b78('0x25')]);return _0x4f5557(_0x4d1d2d[_0x6b78('0x23')][_0x6b78('0x25')]);}else{logger[_0x6b78('0x1e')](_0x6b78('0x1f'),_0x4a6912,_0x6b78('0x20'));_0x4f5557(_0x4d1d2d['result']['message']);}})[_0x6b78('0x26')](function(_0x595aca){logger['error'](_0x6b78('0x1f'),_0x4a6912,_0x595aca);_0x38a15f(_0x595aca);});});}function respondWithStatusCode(_0x277d7a,_0x57d493){_0x57d493=_0x57d493||0xcc;return function(_0x2b45c5){if(_0x2b45c5){return _0x277d7a[_0x6b78('0x27')](_0x57d493);}return _0x277d7a[_0x6b78('0x28')](_0x57d493)['end']();};}function respondWithResult(_0x4c8e1e,_0x316214){_0x316214=_0x316214||0xc8;return function(_0x553350){if(_0x553350){return _0x4c8e1e[_0x6b78('0x28')](_0x316214)['json'](_0x553350);}};}function respondWithFilteredResult(_0x557b5d,_0x1320cc){return function(_0x3923a6){if(_0x3923a6){var _0x4c150f=typeof _0x1320cc[_0x6b78('0x29')]==='undefined'&&typeof _0x1320cc['limit']===_0x6b78('0x2a');var _0x280ea1=_0x3923a6[_0x6b78('0x2b')];var _0x524161=_0x4c150f?0x0:_0x1320cc['offset'];var _0x5163ab=_0x4c150f?_0x3923a6['count']:_0x1320cc[_0x6b78('0x29')]+_0x1320cc[_0x6b78('0x2c')];var _0x552489;if(_0x5163ab>=_0x280ea1){_0x5163ab=_0x280ea1;_0x552489=0xc8;}else{_0x552489=0xce;}_0x557b5d[_0x6b78('0x28')](_0x552489);return _0x557b5d[_0x6b78('0x2d')](_0x6b78('0x2e'),_0x524161+'-'+_0x5163ab+'/'+_0x280ea1)[_0x6b78('0x2f')](_0x3923a6);}return null;};}function patchUpdates(_0x1cdc3a){return function(_0x1660e8){try{jsonpatch[_0x6b78('0x30')](_0x1660e8,_0x1cdc3a,!![]);}catch(_0x2a7c11){return BPromise[_0x6b78('0x31')](_0x2a7c11);}return _0x1660e8[_0x6b78('0x32')]();};}function saveUpdates(_0x3b80fa,_0x59e9a6){return function(_0x51ab2d){if(_0x51ab2d){return _0x51ab2d['update'](_0x3b80fa)[_0x6b78('0x1d')](function(_0x13271e){return _0x13271e;});}return null;};}function removeEntity(_0x4c1a94,_0x20015b){return function(_0x152dbc){if(_0x152dbc){return _0x152dbc['destroy']()[_0x6b78('0x1d')](function(){var _0x6b58b1=_0x152dbc[_0x6b78('0x33')]({'plain':!![]});var _0x5eaf69=_0x6b78('0x34');return db[_0x6b78('0x35')][_0x6b78('0x36')]({'where':{'type':_0x5eaf69,'resourceId':_0x6b58b1['id']}})[_0x6b78('0x1d')](function(){return _0x152dbc;});})[_0x6b78('0x1d')](function(){_0x4c1a94[_0x6b78('0x28')](0xcc)[_0x6b78('0x37')]();});}};}function handleEntityNotFound(_0x37047f,_0x24a580){return function(_0x3c6cdc){if(!_0x3c6cdc){_0x37047f['sendStatus'](0x194);}return _0x3c6cdc;};}function handleError(_0x420073,_0x39e5da){_0x39e5da=_0x39e5da||0x1f4;return function(_0x3a57cc){logger[_0x6b78('0x23')](_0x3a57cc[_0x6b78('0x38')]);if(_0x3a57cc[_0x6b78('0x39')]){delete _0x3a57cc[_0x6b78('0x39')];}_0x420073['status'](_0x39e5da)[_0x6b78('0x3a')](_0x3a57cc);};}exports[_0x6b78('0x3b')]=function(_0x30bb3f,_0x4a040e){var _0x5b81dd={'include':[{'model':db[_0x6b78('0x3c')],'as':'mandatoryDispositionPause'}]},_0x26767e={},_0x220939={'count':0x0,'rows':[]};var _0x2a0779=_['map'](db[_0x6b78('0x3d')][_0x6b78('0x3e')],function(_0x4e64cf){return{'name':_0x4e64cf[_0x6b78('0x3f')],'type':_0x4e64cf[_0x6b78('0x40')]['key']};});_0x26767e[_0x6b78('0x41')]=_[_0x6b78('0x42')](_0x2a0779,_0x6b78('0x39'));_0x26767e[_0x6b78('0x43')]=_[_0x6b78('0x44')](_0x30bb3f['query']);_0x26767e[_0x6b78('0x45')]=_[_0x6b78('0x46')](_0x26767e[_0x6b78('0x41')],_0x26767e['query']);_0x5b81dd[_0x6b78('0x47')]=_[_0x6b78('0x46')](_0x26767e[_0x6b78('0x41')],qs[_0x6b78('0x48')](_0x30bb3f[_0x6b78('0x43')][_0x6b78('0x48')]));_0x5b81dd['attributes']=_0x5b81dd[_0x6b78('0x47')]['length']?_0x5b81dd[_0x6b78('0x47')]:_0x26767e['model'];if(!_0x30bb3f['query'][_0x6b78('0x49')](_0x6b78('0x4a'))){_0x5b81dd[_0x6b78('0x2c')]=qs[_0x6b78('0x2c')](_0x30bb3f[_0x6b78('0x43')]['limit']);_0x5b81dd['offset']=qs[_0x6b78('0x29')](_0x30bb3f[_0x6b78('0x43')][_0x6b78('0x29')]);}_0x5b81dd[_0x6b78('0x4b')]=qs[_0x6b78('0x4c')](_0x30bb3f[_0x6b78('0x43')][_0x6b78('0x4c')]);_0x5b81dd[_0x6b78('0x4d')]=qs['filters'](_[_0x6b78('0x4e')](_0x30bb3f[_0x6b78('0x43')],_0x26767e[_0x6b78('0x45')]),_0x2a0779);if(_0x30bb3f[_0x6b78('0x43')][_0x6b78('0x4f')]){_0x5b81dd[_0x6b78('0x4d')]=_['merge'](_0x5b81dd['where'],{'$or':_['map'](_0x2a0779,function(_0x5b4d6f){if(_0x5b4d6f[_0x6b78('0x40')]!==_0x6b78('0x50')){var _0x4aa1c6={};_0x4aa1c6[_0x5b4d6f['name']]={'$like':'%'+_0x30bb3f[_0x6b78('0x43')][_0x6b78('0x4f')]+'%'};return _0x4aa1c6;}})});}_0x5b81dd=_[_0x6b78('0x51')]({},_0x5b81dd,_0x30bb3f['options']);var _0x13ca8f={'where':_0x5b81dd[_0x6b78('0x4d')]};return db[_0x6b78('0x3d')][_0x6b78('0x2b')](_0x13ca8f)[_0x6b78('0x1d')](function(_0x91b587){_0x220939[_0x6b78('0x2b')]=_0x91b587;if(_0x30bb3f[_0x6b78('0x43')][_0x6b78('0x52')]){_0x5b81dd[_0x6b78('0x53')]=[{'all':!![]}];}return db[_0x6b78('0x3d')][_0x6b78('0x54')](_0x5b81dd);})[_0x6b78('0x1d')](function(_0x33ff2d){_0x220939[_0x6b78('0x55')]=_0x33ff2d;return _0x220939;})[_0x6b78('0x1d')](respondWithFilteredResult(_0x4a040e,_0x5b81dd))[_0x6b78('0x26')](handleError(_0x4a040e,null));};exports[_0x6b78('0x56')]=function(_0x576dc5,_0x74f2d2){var _0x2949d3={'raw':![],'where':{'id':_0x576dc5['params']['id']},'include':[{'model':db[_0x6b78('0x3c')],'as':_0x6b78('0x57')}]},_0x12144c={};_0x12144c['model']=_['keys'](db[_0x6b78('0x3d')][_0x6b78('0x3e')]);_0x12144c[_0x6b78('0x43')]=_['keys'](_0x576dc5[_0x6b78('0x43')]);_0x12144c[_0x6b78('0x45')]=_['intersection'](_0x12144c[_0x6b78('0x41')],_0x12144c[_0x6b78('0x43')]);_0x2949d3[_0x6b78('0x47')]=_[_0x6b78('0x46')](_0x12144c['model'],qs[_0x6b78('0x48')](_0x576dc5[_0x6b78('0x43')][_0x6b78('0x48')]));_0x2949d3[_0x6b78('0x47')]=_0x2949d3[_0x6b78('0x47')]['length']?_0x2949d3[_0x6b78('0x47')]:_0x12144c[_0x6b78('0x41')];if(_0x576dc5[_0x6b78('0x43')][_0x6b78('0x52')]){_0x2949d3[_0x6b78('0x53')]=[{'all':!![]}];}_0x2949d3=_[_0x6b78('0x51')]({},_0x2949d3,_0x576dc5['options']);return db[_0x6b78('0x3d')][_0x6b78('0x58')](_0x2949d3)[_0x6b78('0x1d')](handleEntityNotFound(_0x74f2d2,null))[_0x6b78('0x1d')](respondWithResult(_0x74f2d2,null))[_0x6b78('0x26')](handleError(_0x74f2d2,null));};exports['create']=function(_0x342c9f,_0x15d3ac){return db['OpenchannelAccount'][_0x6b78('0x59')](_0x342c9f['body'],{})[_0x6b78('0x1d')](function(_0x17b0e1){var _0x1e41b0=_0x342c9f[_0x6b78('0x5a')][_0x6b78('0x33')]({'plain':!![]});if(!_0x1e41b0)throw new Error(_0x6b78('0x5b'));if(_0x1e41b0[_0x6b78('0x5c')]===_0x6b78('0x5a')){var _0x4cc0fe=_0x17b0e1[_0x6b78('0x33')]({'plain':!![]});var _0x358463=_0x6b78('0x34');return db[_0x6b78('0x5d')][_0x6b78('0x58')]({'where':{'name':_0x358463,'userProfileId':_0x1e41b0[_0x6b78('0x5e')]},'raw':!![]})[_0x6b78('0x1d')](function(_0x2bac3c){if(_0x2bac3c&&_0x2bac3c[_0x6b78('0x5f')]===0x0){return db[_0x6b78('0x35')][_0x6b78('0x59')]({'name':_0x4cc0fe[_0x6b78('0x39')],'resourceId':_0x4cc0fe['id'],'type':_0x2bac3c['name'],'sectionId':_0x2bac3c['id']},{})[_0x6b78('0x1d')](function(){return _0x17b0e1;});}else{return _0x17b0e1;}})[_0x6b78('0x26')](function(_0x24e1e5){logger[_0x6b78('0x23')](_0x6b78('0x60'),_0x24e1e5);throw _0x24e1e5;});}return _0x17b0e1;})[_0x6b78('0x1d')](respondWithResult(_0x15d3ac,0xc9))[_0x6b78('0x26')](handleError(_0x15d3ac,null));};exports['update']=function(_0x332b5d,_0x5e5c18){if(_0x332b5d[_0x6b78('0x61')]['id']){delete _0x332b5d[_0x6b78('0x61')]['id'];}return db[_0x6b78('0x3d')][_0x6b78('0x58')]({'where':{'id':_0x332b5d[_0x6b78('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0x6b78('0x57')}]})[_0x6b78('0x1d')](handleEntityNotFound(_0x5e5c18,null))[_0x6b78('0x1d')](saveUpdates(_0x332b5d[_0x6b78('0x61')],null))[_0x6b78('0x1d')](respondWithResult(_0x5e5c18,null))[_0x6b78('0x26')](handleError(_0x5e5c18,null));};exports[_0x6b78('0x36')]=function(_0x4d7af4,_0x41f4d6){return db[_0x6b78('0x3d')]['find']({'where':{'id':_0x4d7af4[_0x6b78('0x62')]['id']}})[_0x6b78('0x1d')](handleEntityNotFound(_0x41f4d6,null))['then'](removeEntity(_0x41f4d6,null))[_0x6b78('0x26')](handleError(_0x41f4d6,null));};exports[_0x6b78('0x63')]=function(_0x1a5901,_0xae9019){return db[_0x6b78('0x3d')]['describe']()['then'](respondWithResult(_0xae9019,null))[_0x6b78('0x26')](handleError(_0xae9019,null));};exports[_0x6b78('0x64')]=function(_0x19cc03,_0x5a661c,_0x4ea028){if(_0x19cc03[_0x6b78('0x61')]['id']){delete _0x19cc03[_0x6b78('0x61')]['id'];}return db['OpenchannelAccount'][_0x6b78('0x58')]({'where':{'id':_0x19cc03[_0x6b78('0x62')]['id']}})[_0x6b78('0x1d')](handleEntityNotFound(_0x5a661c,null))[_0x6b78('0x1d')](function(_0x15588e){if(_0x15588e){_0x19cc03[_0x6b78('0x61')][_0x6b78('0x65')]=_0x15588e['id'];return db['Disposition']['create'](_0x19cc03[_0x6b78('0x61')]);}})['then'](respondWithResult(_0x5a661c,null))[_0x6b78('0x26')](handleError(_0x5a661c,null));};exports[_0x6b78('0x66')]=function(_0x1ef782,_0x3d7c1c,_0x2a5f60){var _0x526f5f={'raw':![],'where':{}};var _0x37780f={};var _0x1880a4={'count':0x0,'rows':[]};return db[_0x6b78('0x3d')][_0x6b78('0x67')]({'where':{'id':_0x1ef782[_0x6b78('0x62')]['id']}})['then'](handleEntityNotFound(_0x3d7c1c,null))[_0x6b78('0x1d')](function(_0x1dc161){if(_0x1dc161){_0x37780f[_0x6b78('0x41')]=_['keys'](db[_0x6b78('0x68')][_0x6b78('0x3e')]);_0x37780f[_0x6b78('0x43')]=_[_0x6b78('0x44')](_0x1ef782[_0x6b78('0x43')]);_0x37780f['filters']=_[_0x6b78('0x46')](_0x37780f[_0x6b78('0x41')],_0x37780f[_0x6b78('0x43')]);_0x526f5f[_0x6b78('0x47')]=_[_0x6b78('0x46')](_0x37780f[_0x6b78('0x41')],qs[_0x6b78('0x48')](_0x1ef782['query'][_0x6b78('0x48')]));_0x526f5f[_0x6b78('0x47')]=_0x526f5f[_0x6b78('0x47')][_0x6b78('0x69')]?_0x526f5f['attributes']:_0x37780f[_0x6b78('0x41')];if(!_0x1ef782[_0x6b78('0x43')]['hasOwnProperty']('nolimit')){_0x526f5f[_0x6b78('0x2c')]=qs[_0x6b78('0x2c')](_0x1ef782['query'][_0x6b78('0x2c')]);_0x526f5f[_0x6b78('0x29')]=qs[_0x6b78('0x29')](_0x1ef782[_0x6b78('0x43')][_0x6b78('0x29')]);}_0x526f5f['order']=qs[_0x6b78('0x4c')](_0x1ef782[_0x6b78('0x43')][_0x6b78('0x4c')]);_0x526f5f[_0x6b78('0x4d')]=qs[_0x6b78('0x45')](_['pick'](_0x1ef782['query'],_0x37780f['filters']));_0x526f5f[_0x6b78('0x4d')][_0x6b78('0x65')]=_0x1dc161['id'];if(_0x1ef782[_0x6b78('0x43')][_0x6b78('0x4f')]){_0x526f5f[_0x6b78('0x4d')]=_['merge'](_0x526f5f[_0x6b78('0x4d')],{'$or':_['map'](_0x526f5f[_0x6b78('0x47')],function(_0x4cfaf8){var _0xbf44f5={};_0xbf44f5[_0x4cfaf8]={'$like':'%'+_0x1ef782[_0x6b78('0x43')][_0x6b78('0x4f')]+'%'};return _0xbf44f5;})});}_0x526f5f=_[_0x6b78('0x51')]({},_0x526f5f,_0x1ef782[_0x6b78('0x6a')]);return db['Disposition']['count']({'where':_0x526f5f[_0x6b78('0x4d')]})['then'](function(_0x1a5e2e){_0x1880a4[_0x6b78('0x2b')]=_0x1a5e2e;if(_0x1ef782[_0x6b78('0x43')][_0x6b78('0x52')]){_0x526f5f[_0x6b78('0x53')]=[{'all':!![]}];}return db[_0x6b78('0x68')][_0x6b78('0x54')](_0x526f5f);})[_0x6b78('0x1d')](function(_0x43bdb1){_0x1880a4[_0x6b78('0x55')]=_0x43bdb1;return _0x1880a4;});}})[_0x6b78('0x1d')](respondWithFilteredResult(_0x3d7c1c,_0x526f5f))['catch'](handleError(_0x3d7c1c,null));};exports[_0x6b78('0x6b')]=function(_0x305ac3,_0xd12edb,_0x231e89){return db[_0x6b78('0x3d')]['find']({'where':{'id':_0x305ac3[_0x6b78('0x62')]['id']}})[_0x6b78('0x1d')](handleEntityNotFound(_0xd12edb,null))[_0x6b78('0x1d')](function(_0x18e1f4){if(_0x18e1f4){return _0x18e1f4[_0x6b78('0x6b')](_0x305ac3[_0x6b78('0x43')][_0x6b78('0x6c')]);}})[_0x6b78('0x1d')](respondWithStatusCode(_0xd12edb,null))[_0x6b78('0x26')](handleError(_0xd12edb,null));};exports[_0x6b78('0x6d')]=function(_0x2d542e,_0x5834e8,_0x566454){if(_0x2d542e[_0x6b78('0x61')]['id']){delete _0x2d542e[_0x6b78('0x61')]['id'];}return db[_0x6b78('0x3d')][_0x6b78('0x58')]({'where':{'id':_0x2d542e[_0x6b78('0x62')]['id']}})['then'](handleEntityNotFound(_0x5834e8,null))['then'](function(_0x79dd8a){if(_0x79dd8a){_0x2d542e[_0x6b78('0x61')][_0x6b78('0x65')]=_0x79dd8a['id'];return db[_0x6b78('0x6e')][_0x6b78('0x59')](_0x2d542e[_0x6b78('0x61')]);}})[_0x6b78('0x1d')](respondWithResult(_0x5834e8,null))[_0x6b78('0x26')](handleError(_0x5834e8,null));};exports[_0x6b78('0x6f')]=function(_0x1526d1,_0x2485dc,_0x31ecd7){var _0x51253f={'raw':![],'where':{}};var _0x5eecf1={};var _0x1dee20={'count':0x0,'rows':[]};return db[_0x6b78('0x3d')]['findOne']({'where':{'id':_0x1526d1[_0x6b78('0x62')]['id']}})[_0x6b78('0x1d')](handleEntityNotFound(_0x2485dc,null))[_0x6b78('0x1d')](function(_0x3b0c7a){if(_0x3b0c7a){_0x5eecf1[_0x6b78('0x41')]=_[_0x6b78('0x44')](db['CannedAnswer'][_0x6b78('0x3e')]);_0x5eecf1[_0x6b78('0x43')]=_[_0x6b78('0x44')](_0x1526d1[_0x6b78('0x43')]);_0x5eecf1[_0x6b78('0x45')]=_[_0x6b78('0x46')](_0x5eecf1[_0x6b78('0x41')],_0x5eecf1['query']);_0x51253f['attributes']=_[_0x6b78('0x46')](_0x5eecf1[_0x6b78('0x41')],qs['fields'](_0x1526d1[_0x6b78('0x43')][_0x6b78('0x48')]));_0x51253f[_0x6b78('0x47')]=_0x51253f[_0x6b78('0x47')][_0x6b78('0x69')]?_0x51253f['attributes']:_0x5eecf1['model'];if(!_0x1526d1[_0x6b78('0x43')]['hasOwnProperty'](_0x6b78('0x4a'))){_0x51253f[_0x6b78('0x2c')]=qs[_0x6b78('0x2c')](_0x1526d1['query'][_0x6b78('0x2c')]);_0x51253f[_0x6b78('0x29')]=qs[_0x6b78('0x29')](_0x1526d1['query'][_0x6b78('0x29')]);}_0x51253f[_0x6b78('0x4b')]=qs['sort'](_0x1526d1['query'][_0x6b78('0x4c')]);_0x51253f[_0x6b78('0x4d')]=qs[_0x6b78('0x45')](_[_0x6b78('0x4e')](_0x1526d1['query'],_0x5eecf1[_0x6b78('0x45')]));_0x51253f['where']['OpenchannelAccountId']=_0x3b0c7a['id'];if(_0x1526d1[_0x6b78('0x43')]['filter']){_0x51253f[_0x6b78('0x4d')]=_[_0x6b78('0x51')](_0x51253f[_0x6b78('0x4d')],{'$or':_[_0x6b78('0x42')](_0x51253f[_0x6b78('0x47')],function(_0x317144){var _0x269df5={};_0x269df5[_0x317144]={'$like':'%'+_0x1526d1[_0x6b78('0x43')][_0x6b78('0x4f')]+'%'};return _0x269df5;})});}_0x51253f=_[_0x6b78('0x51')]({},_0x51253f,_0x1526d1[_0x6b78('0x6a')]);return db[_0x6b78('0x6e')][_0x6b78('0x2b')]({'where':_0x51253f[_0x6b78('0x4d')]})[_0x6b78('0x1d')](function(_0x2fa673){_0x1dee20[_0x6b78('0x2b')]=_0x2fa673;if(_0x1526d1[_0x6b78('0x43')][_0x6b78('0x52')]){_0x51253f[_0x6b78('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6b78('0x54')](_0x51253f);})[_0x6b78('0x1d')](function(_0x59589a){_0x1dee20[_0x6b78('0x55')]=_0x59589a;return _0x1dee20;});}})[_0x6b78('0x1d')](respondWithFilteredResult(_0x2485dc,_0x51253f))[_0x6b78('0x26')](handleError(_0x2485dc,null));};exports[_0x6b78('0x70')]=function(_0x18c721,_0x286a55,_0x15aef6){return db['OpenchannelAccount'][_0x6b78('0x58')]({'where':{'id':_0x18c721[_0x6b78('0x62')]['id']}})[_0x6b78('0x1d')](handleEntityNotFound(_0x286a55,null))['then'](function(_0x469569){if(_0x469569){return _0x469569[_0x6b78('0x70')](_0x18c721[_0x6b78('0x43')][_0x6b78('0x6c')]);}})['then'](respondWithStatusCode(_0x286a55,null))[_0x6b78('0x26')](handleError(_0x286a55,null));};exports[_0x6b78('0x71')]=function(_0x2e0e70,_0x45284a,_0x502d1d){var _0x155c16={'body':_0x2e0e70['body'],'channel':_0x6b78('0x72')};var _0x4e2b7f=[];var _0x4b30fb=[];var _0x3127c6={};var _0x3b77af=![];return db[_0x6b78('0x73')][_0x6b78('0x63')]()[_0x6b78('0x1d')](function(_0x13fe00){if(!_0x13fe00){throw new db[(_0x6b78('0x74'))]['ValidationError']('no\x20available\x20attributes');}_0x4e2b7f=_[_0x6b78('0x75')](_['keys'](_0x13fe00),['createdAt','updatedAt']);_0x4b30fb=_[_0x6b78('0x75')](_['keys'](_0x13fe00),[_0x6b78('0x76'),'updatedAt',_0x6b78('0x77'),_0x6b78('0x78')]);if(_0x2e0e70[_0x6b78('0x61')]['id']){delete _0x2e0e70[_0x6b78('0x61')]['id'];}if(_[_0x6b78('0x79')](_0x2e0e70['body'][_0x6b78('0x7a')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x2e0e70['body'][_0x6b78('0x61')])||_0x2e0e70[_0x6b78('0x61')][_0x6b78('0x61')]===''){throw new db['Sequelize']['ValidationError'](_0x6b78('0x7b'));}if(_['isNil'](_0x2e0e70[_0x6b78('0x61')]['mapKey'])){throw new db[(_0x6b78('0x74'))][(_0x6b78('0x7c'))](_0x6b78('0x7d')+_0x4b30fb);}if(!_[_0x6b78('0x7e')](_0x4b30fb,_0x2e0e70[_0x6b78('0x61')][_0x6b78('0x7f')])){throw new db[(_0x6b78('0x74'))][(_0x6b78('0x7c'))](_0x6b78('0x80')+_0x4b30fb);}_0x3127c6[_0x2e0e70[_0x6b78('0x61')][_0x6b78('0x7f')]]=_0x2e0e70[_0x6b78('0x61')][_0x6b78('0x7a')];})['then'](function(){return db[_0x6b78('0x3d')]['find']({'where':{'id':_0x2e0e70[_0x6b78('0x62')]['id']},'include':[{'model':db[_0x6b78('0x81')],'as':_0x6b78('0x82'),'include':[{'model':db[_0x6b78('0x73')],'as':_0x6b78('0x83'),'where':_0x3127c6,'limit':0x1,'order':[[_0x6b78('0x84'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0x6b78('0x1d')](handleEntityNotFound(_0x45284a,null))['then'](function(_0x1d61e8){if(_0x1d61e8&&_0x1d61e8[_0x6b78('0x82')]){_0x155c16[_0x6b78('0x85')]=_0x1d61e8;_0x155c16[_0x6b78('0x86')]=_0x1d61e8[_0x6b78('0x87')];_0x155c16[_0x6b78('0x88')]=_0x1d61e8[_0x6b78('0x82')];_0x155c16[_0x6b78('0x86')]=_['orderBy'](_0x155c16[_0x6b78('0x86')],[_0x6b78('0x89')],[_0x6b78('0x8a')]);if(_0x155c16[_0x6b78('0x85')][_0x6b78('0x87')]){delete _0x155c16[_0x6b78('0x85')][_0x6b78('0x87')];}if(_0x155c16['account'][_0x6b78('0x82')]&&_0x155c16[_0x6b78('0x85')]['List'][_0x6b78('0x83')]['length']){return _0x155c16[_0x6b78('0x85')][_0x6b78('0x82')][_0x6b78('0x83')][0x0];}var _0x556bfe=_[_0x6b78('0x16')](_0x2e0e70[_0x6b78('0x61')],{'firstName':_0x2e0e70[_0x6b78('0x61')][_0x6b78('0x7a')],'ListId':_0x1d61e8[_0x6b78('0x78')]});_0x556bfe[_0x2e0e70['body'][_0x6b78('0x7f')]]=_0x2e0e70[_0x6b78('0x61')][_0x6b78('0x7a')];return db[_0x6b78('0x73')][_0x6b78('0x59')](_0x556bfe,{'fields':_0x4e2b7f,'raw':!![]});}})['then'](handleEntityNotFound(_0x45284a,null))[_0x6b78('0x1d')](function(_0xa919e8){_0x155c16[_0x6b78('0x8b')]=_0xa919e8;if(_0xa919e8){var _0x40f036={'ContactId':_0xa919e8['id'],'OpenchannelAccountId':_0x2e0e70['params']['id'],'from':(_0xa919e8[_0x6b78('0x8c')]||'')+'\x20'+(_0xa919e8[_0x6b78('0x8d')]||'')};var _0x26393a={'OpenchannelAccountId':_0x2e0e70['params']['id'],'closed':![]};if(_0x2e0e70['body'][_0x6b78('0x8e')]){_0x26393a['threadId']=_0x2e0e70[_0x6b78('0x61')][_0x6b78('0x8e')];return db[_0x6b78('0x8f')][_0x6b78('0x58')]({'where':_0x26393a})[_0x6b78('0x1d')](function(_0x3753db){if(_0x3753db){return[_0x3753db,![]];}_0x40f036[_0x6b78('0x8e')]=_0x2e0e70[_0x6b78('0x61')]['threadId'];_0x40f036[_0x6b78('0x90')]=_0x2e0e70[_0x6b78('0x61')][_0x6b78('0x90')];return db['OpenchannelInteraction'][_0x6b78('0x59')](_0x40f036)['then'](function(_0x2cbbcc){return[_0x2cbbcc,!![]];});});}else{_0x26393a[_0x6b78('0x8e')]=null;}_0x26393a[_0x6b78('0x91')]=_0xa919e8['id'];return db[_0x6b78('0x8f')][_0x6b78('0x58')]({'where':_0x26393a})['then'](function(_0x4d24a6){if(_0x4d24a6){return[_0x4d24a6,![]];}return db[_0x6b78('0x8f')][_0x6b78('0x59')](_0x40f036)['then'](function(_0x19787a){return[_0x19787a,!![]];});});}})[_0x6b78('0x92')](function(_0x17c43e,_0x58e854){if(_0x17c43e){_0x3b77af=_0x58e854;if(!_0x58e854){var _0x10c904={'from':(_0x155c16[_0x6b78('0x8b')]['firstName']||'')+'\x20'+(_0x155c16['contact']['lastName']||'')};if(_0x2e0e70[_0x6b78('0x61')][_0x6b78('0x8e')]&&_0x2e0e70[_0x6b78('0x61')][_0x6b78('0x93')]&&_0x2e0e70['body']['threadId']!=_0x2e0e70[_0x6b78('0x61')][_0x6b78('0x93')]){_0x10c904[_0x6b78('0x8e')]=_0x2e0e70[_0x6b78('0x61')][_0x6b78('0x93')];}return _0x17c43e['update'](_0x10c904);}else{return _0x17c43e;}}})[_0x6b78('0x1d')](function(_0x5a0a73){_0x155c16['interaction']=_0x5a0a73[_0x6b78('0x33')]({'plain':!![]});_0x155c16[_0x6b78('0x94')]['created']=_0x3b77af;if(_0x155c16[_0x6b78('0x94')][_0x6b78('0x95')]){if(_0x155c16[_0x6b78('0x85')]['autoclose']){_0x155c16[_0x6b78('0x86')]['push']({'id':0x0,'priority':_0x155c16[_0x6b78('0x86')][_0x6b78('0x69')]+0x1,'app':_0x6b78('0x96'),'appdata':_0x6b78('0x97'),'interval':_0x6b78('0x98')});}}return db['OpenchannelMessage'][_0x6b78('0x59')]({'body':_0x2e0e70[_0x6b78('0x61')][_0x6b78('0x61')],'OpenchannelAccountId':_0x2e0e70['params']['id'],'OpenchannelInteractionId':_0x5a0a73['id'],'direction':'in','ContactId':_0x155c16[_0x6b78('0x8b')]['id'],'AttachmentId':_0x2e0e70['body']['AttachmentId']});})[_0x6b78('0x1d')](function(_0x43439c){_0x155c16[_0x6b78('0x25')]=_0x43439c;if(_0x155c16[_0x6b78('0x94')][_0x6b78('0x99')]){return db[_0x6b78('0x9a')][_0x6b78('0x58')]({'attributes':['id',_0x6b78('0x39')],'where':{'id':_0x155c16[_0x6b78('0x94')][_0x6b78('0x99')]}})[_0x6b78('0x1d')](function(_0x3ed450){if(_0x3ed450){_0x155c16[_0x6b78('0x86')][_0x6b78('0x9b')]({'id':0x0,'priority':0x0,'app':_0x6b78('0x9c'),'appdata':_0x3ed450[_0x6b78('0x39')]+','+(_0x155c16[_0x6b78('0x85')]['waitForTheAssignedAgent']||0xa),'interval':_0x6b78('0x98')});_0x155c16[_0x6b78('0x9d')]=![];}return respondWithRpcPromise('Start',_0x6b78('0x9e'),_0x155c16);});}return respondWithRpcPromise('Start',_0x6b78('0x9e'),_0x155c16);})[_0x6b78('0x1d')](function(_0x5da021){respondWithRpcPromise(_0x6b78('0x9f'),_0x6b78('0x9f'),{'event':'notify','message':_0x5da021},client9002);return _0x5da021;})['then'](respondWithResult(_0x45284a,null))[_0x6b78('0x26')](handleError(_0x45284a,null));};exports[_0x6b78('0xa0')]=function(_0x547842,_0x14d7e9,_0x13ab79){return db[_0x6b78('0x3d')][_0x6b78('0x67')]({'where':{'id':_0x547842[_0x6b78('0x62')]['id']}})['then'](handleEntityNotFound(_0x14d7e9,null))[_0x6b78('0x1d')](function(_0xf3418b){if(_0xf3418b){return db[_0x6b78('0xa1')]['transaction'](function(_0x5d2208){return db[_0x6b78('0xa2')][_0x6b78('0x36')]({'where':{'OpenchannelAccountId':_0x547842[_0x6b78('0x62')]['id']},'transaction':_0x5d2208})[_0x6b78('0x1d')](function(_0x26aaef){var _0x828f56=_[_0x6b78('0x42')](_0x547842['body'],function(_0x318dcb){_0x318dcb['OpenchannelAccountId']=_0x547842[_0x6b78('0x62')]['id'];return _0x318dcb;});return db[_0x6b78('0xa2')][_0x6b78('0xa3')](_0x828f56,{'transaction':_0x5d2208});});})['then'](function(){return db[_0x6b78('0xa2')][_0x6b78('0xa4')]({'where':{'OpenchannelAccountId':_0x547842['params']['id']},'order':'priority'});});}})[_0x6b78('0x1d')](respondWithResult(_0x14d7e9,null))[_0x6b78('0x26')](handleError(_0x14d7e9,null));};exports[_0x6b78('0xa5')]=function(_0x3585c0,_0x2a084c,_0x518a2e){var _0x339d52={};var _0x528326={};var _0x5e7fcd;var _0x536853;return db[_0x6b78('0x3d')][_0x6b78('0x67')]({'where':{'id':_0x3585c0[_0x6b78('0x62')]['id']}})[_0x6b78('0x1d')](handleEntityNotFound(_0x2a084c,null))[_0x6b78('0x1d')](function(_0x7a013d){if(_0x7a013d){_0x5e7fcd=_0x7a013d;_0x528326[_0x6b78('0x41')]=_[_0x6b78('0x44')](db[_0x6b78('0xa2')]['rawAttributes']);_0x528326[_0x6b78('0x43')]=_[_0x6b78('0x44')](_0x3585c0[_0x6b78('0x43')]);_0x528326[_0x6b78('0x45')]=_[_0x6b78('0x46')](_0x528326[_0x6b78('0x41')],_0x528326[_0x6b78('0x43')]);_0x339d52['attributes']=_[_0x6b78('0x46')](_0x528326[_0x6b78('0x41')],qs[_0x6b78('0x48')](_0x3585c0['query'][_0x6b78('0x48')]));_0x339d52['attributes']=_0x339d52[_0x6b78('0x47')][_0x6b78('0x69')]?_0x339d52[_0x6b78('0x47')]:_0x528326[_0x6b78('0x41')];_0x339d52[_0x6b78('0x4b')]=qs['sort'](_0x3585c0[_0x6b78('0x43')][_0x6b78('0x4c')]);_0x339d52[_0x6b78('0x4d')]=qs[_0x6b78('0x45')](_[_0x6b78('0x4e')](_0x3585c0[_0x6b78('0x43')],_0x528326[_0x6b78('0x45')]));if(_0x3585c0[_0x6b78('0x43')][_0x6b78('0x4f')]){_0x339d52[_0x6b78('0x4d')]=_['merge'](_0x339d52[_0x6b78('0x4d')],{'$or':_['map'](_0x339d52[_0x6b78('0x47')],function(_0x207479){var _0x2bdc6b={};_0x2bdc6b[_0x207479]={'$like':'%'+_0x3585c0[_0x6b78('0x43')]['filter']+'%'};return _0x2bdc6b;})});}_0x339d52=_['merge']({},_0x339d52,_0x3585c0[_0x6b78('0x6a')]);return _0x5e7fcd[_0x6b78('0xa5')](_0x339d52);}})[_0x6b78('0x1d')](function(_0x46ac48){if(_0x46ac48){_0x536853=_0x46ac48[_0x6b78('0x69')];if(!_0x3585c0[_0x6b78('0x43')][_0x6b78('0x49')]('nolimit')){_0x339d52[_0x6b78('0x2c')]=qs[_0x6b78('0x2c')](_0x3585c0[_0x6b78('0x43')][_0x6b78('0x2c')]);_0x339d52[_0x6b78('0x29')]=qs[_0x6b78('0x29')](_0x3585c0['query'][_0x6b78('0x29')]);}return _0x5e7fcd[_0x6b78('0xa5')](_0x339d52);}})[_0x6b78('0x1d')](function(_0x22d33c){if(_0x22d33c){return _0x22d33c?{'count':_0x536853,'rows':_0x22d33c}:null;}})[_0x6b78('0x1d')](respondWithResult(_0x2a084c,null))['catch'](handleError(_0x2a084c,null));};exports['getInteractions']=function(_0x402dfe,_0x9031f9,_0x12c7ec){var _0x5e6998={'raw':![],'where':{}};var _0x4be6ce={};var _0x5edd24={'count':0x0,'rows':[]};return db[_0x6b78('0x3d')][_0x6b78('0x67')]({'where':{'id':_0x402dfe[_0x6b78('0x62')]['id']}})[_0x6b78('0x1d')](handleEntityNotFound(_0x9031f9,null))[_0x6b78('0x1d')](function(_0x414c4f){if(_0x414c4f){_0x4be6ce[_0x6b78('0x41')]=_[_0x6b78('0x44')](db[_0x6b78('0x8f')][_0x6b78('0x3e')]);_0x4be6ce[_0x6b78('0x43')]=_[_0x6b78('0x44')](_0x402dfe['query']);_0x4be6ce[_0x6b78('0x45')]=_[_0x6b78('0x46')](_0x4be6ce[_0x6b78('0x41')],_0x4be6ce['query']);_0x5e6998['attributes']=_['intersection'](_0x4be6ce[_0x6b78('0x41')],qs[_0x6b78('0x48')](_0x402dfe[_0x6b78('0x43')]['fields']));_0x5e6998['attributes']=_0x5e6998[_0x6b78('0x47')]['length']?_0x5e6998[_0x6b78('0x47')]:_0x4be6ce[_0x6b78('0x41')];if(!_0x402dfe[_0x6b78('0x43')][_0x6b78('0x49')](_0x6b78('0x4a'))){_0x5e6998['limit']=qs[_0x6b78('0x2c')](_0x402dfe['query']['limit']);_0x5e6998[_0x6b78('0x29')]=qs['offset'](_0x402dfe[_0x6b78('0x43')]['offset']);}_0x5e6998['order']=qs['sort'](_0x402dfe[_0x6b78('0x43')]['sort']);_0x5e6998[_0x6b78('0x4d')]=qs['filters'](_[_0x6b78('0x4e')](_0x402dfe[_0x6b78('0x43')],_0x4be6ce[_0x6b78('0x45')]));_0x5e6998['where'][_0x6b78('0x65')]=_0x414c4f['id'];if(_0x402dfe[_0x6b78('0x43')][_0x6b78('0x4f')]){_0x5e6998['where']=_['merge'](_0x5e6998[_0x6b78('0x4d')],{'$or':_[_0x6b78('0x42')](_0x5e6998[_0x6b78('0x47')],function(_0x486465){var _0x306188={};_0x306188[_0x486465]={'$like':'%'+_0x402dfe['query'][_0x6b78('0x4f')]+'%'};return _0x306188;})});}_0x5e6998=_[_0x6b78('0x51')]({},_0x5e6998,_0x402dfe['options']);return db[_0x6b78('0x8f')][_0x6b78('0x2b')]({'where':_0x5e6998[_0x6b78('0x4d')]})[_0x6b78('0x1d')](function(_0x53b73d){_0x5edd24[_0x6b78('0x2b')]=_0x53b73d;if(_0x402dfe['query'][_0x6b78('0x52')]){_0x5e6998[_0x6b78('0x53')]=[{'model':db[_0x6b78('0x73')],'as':'Contact','required':![]},{'model':db[_0x6b78('0x9a')],'as':_0x6b78('0xa6'),'attributes':[_0x6b78('0x39'),_0x6b78('0xa7'),_0x6b78('0xa8')],'required':![]},{'model':db[_0x6b78('0xa9')],'as':_0x6b78('0xaa'),'attributes':['id',_0x6b78('0x39'),_0x6b78('0xab')],'where':_0x402dfe[_0x6b78('0x43')][_0x6b78('0xac')]?{'id':_0x402dfe['query'][_0x6b78('0xac')]}:undefined,'required':_0x402dfe[_0x6b78('0x43')][_0x6b78('0xac')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x5e6998);})['then'](function(_0x12fc87){_0x5edd24['rows']=_0x12fc87;return _0x5edd24;});}})[_0x6b78('0x1d')](respondWithFilteredResult(_0x9031f9,_0x5e6998))['catch'](handleError(_0x9031f9,null));};exports[_0x6b78('0xad')]=function(_0x122b51,_0x4260a8,_0x4699d3){return db[_0x6b78('0x3d')][_0x6b78('0x58')]({'where':{'id':_0x122b51[_0x6b78('0x62')]['id']}})[_0x6b78('0x1d')](handleEntityNotFound(_0x4260a8,null))[_0x6b78('0x1d')](function(_0x301797){if(_0x301797){return _0x301797['addAgents'](_0x122b51[_0x6b78('0x61')]['ids'],_[_0x6b78('0xae')](_0x122b51['body'],[_0x6b78('0x6c'),'id'])||{})[_0x6b78('0x92')](function(_0x587a66){for(var _0xf390eb=0x0;_0xf390eb<_0x122b51[_0x6b78('0x61')]['ids'][_0x6b78('0x69')];_0xf390eb+=0x1){socket['emit'](_0x6b78('0xaf'),{'UserId':Number(_0x122b51[_0x6b78('0x61')]['ids'][_0xf390eb]),'OpenchannelAccountId':Number(_0x122b51[_0x6b78('0x62')]['id'])});}return _0x587a66;});}})[_0x6b78('0x1d')](respondWithResult(_0x4260a8,null))[_0x6b78('0x26')](handleError(_0x4260a8,null));};exports[_0x6b78('0xb0')]=function(_0x55cfb8,_0x8ea5c9,_0x5536f7){return db['OpenchannelAccount'][_0x6b78('0x58')]({'where':{'id':_0x55cfb8[_0x6b78('0x62')]['id']}})[_0x6b78('0x1d')](handleEntityNotFound(_0x8ea5c9,null))[_0x6b78('0x1d')](function(_0x4abb6a){if(_0x4abb6a){return _0x4abb6a[_0x6b78('0xb0')](_0x55cfb8[_0x6b78('0x43')][_0x6b78('0x6c')])[_0x6b78('0x1d')](function(){if(_['isArray'](_0x55cfb8['query'][_0x6b78('0x6c')])){for(var _0x2b07af=0x0;_0x2b07af<_0x55cfb8[_0x6b78('0x43')][_0x6b78('0x6c')][_0x6b78('0x69')];_0x2b07af+=0x1){socket[_0x6b78('0xb1')]('userOpenchannelAccount:remove',{'UserId':Number(_0x55cfb8['query'][_0x6b78('0x6c')][_0x2b07af]),'OpenchannelAccountId':Number(_0x55cfb8[_0x6b78('0x62')]['id'])});}}else{socket['emit'](_0x6b78('0xb2'),{'UserId':Number(_0x55cfb8[_0x6b78('0x43')][_0x6b78('0x6c')]),'OpenchannelAccountId':Number(_0x55cfb8[_0x6b78('0x62')]['id'])});}});}})[_0x6b78('0x1d')](respondWithStatusCode(_0x8ea5c9,null))[_0x6b78('0x26')](handleError(_0x8ea5c9,null));};exports[_0x6b78('0xb3')]=function(_0x25778f,_0x4fcb8f,_0x48fa85){var _0x2c9bbc={};var _0x3dc24a={};var _0x35ca5e;var _0x1b8ee1;return db[_0x6b78('0x3d')][_0x6b78('0x67')]({'where':{'id':_0x25778f['params']['id']}})[_0x6b78('0x1d')](handleEntityNotFound(_0x4fcb8f,null))['then'](function(_0x56e137){if(_0x56e137){_0x35ca5e=_0x56e137;_0x3dc24a[_0x6b78('0x41')]=_[_0x6b78('0x44')](db[_0x6b78('0x9a')]['rawAttributes']);_0x3dc24a[_0x6b78('0x43')]=_[_0x6b78('0x44')](_0x25778f['query']);_0x3dc24a['filters']=_[_0x6b78('0x46')](_0x3dc24a[_0x6b78('0x41')],_0x3dc24a[_0x6b78('0x43')]);_0x2c9bbc[_0x6b78('0x47')]=_['intersection'](_0x3dc24a[_0x6b78('0x41')],qs[_0x6b78('0x48')](_0x25778f[_0x6b78('0x43')][_0x6b78('0x48')]));_0x2c9bbc['attributes']=_0x2c9bbc['attributes']['length']?_0x2c9bbc[_0x6b78('0x47')]:_0x3dc24a['model'];_0x2c9bbc['order']=qs[_0x6b78('0x4c')](_0x25778f[_0x6b78('0x43')][_0x6b78('0x4c')]);_0x2c9bbc[_0x6b78('0x4d')]=qs[_0x6b78('0x45')](_[_0x6b78('0x4e')](_0x25778f[_0x6b78('0x43')],_0x3dc24a[_0x6b78('0x45')]));if(_0x25778f[_0x6b78('0x43')][_0x6b78('0x4f')]){_0x2c9bbc['where']=_['merge'](_0x2c9bbc[_0x6b78('0x4d')],{'$or':_[_0x6b78('0x42')](_0x2c9bbc[_0x6b78('0x47')],function(_0x2d3e29){var _0x50c5f6={};_0x50c5f6[_0x2d3e29]={'$like':'%'+_0x25778f[_0x6b78('0x43')][_0x6b78('0x4f')]+'%'};return _0x50c5f6;})});}_0x2c9bbc=_[_0x6b78('0x51')]({},_0x2c9bbc,_0x25778f[_0x6b78('0x6a')]);return _0x35ca5e[_0x6b78('0xb3')](_0x2c9bbc);}})[_0x6b78('0x1d')](function(_0x4ebe70){if(_0x4ebe70){_0x1b8ee1=_0x4ebe70[_0x6b78('0x69')];if(!_0x25778f[_0x6b78('0x43')][_0x6b78('0x49')](_0x6b78('0x4a'))){_0x2c9bbc[_0x6b78('0x2c')]=qs[_0x6b78('0x2c')](_0x25778f[_0x6b78('0x43')][_0x6b78('0x2c')]);_0x2c9bbc[_0x6b78('0x29')]=qs[_0x6b78('0x29')](_0x25778f[_0x6b78('0x43')][_0x6b78('0x29')]);}return _0x35ca5e[_0x6b78('0xb3')](_0x2c9bbc);}})[_0x6b78('0x1d')](function(_0x478fc9){if(_0x478fc9){return _0x478fc9?{'count':_0x1b8ee1,'rows':_0x478fc9}:null;}})[_0x6b78('0x1d')](respondWithResult(_0x4fcb8f,null))['catch'](handleError(_0x4fcb8f,null));};exports[_0x6b78('0x3a')]=function(_0x53e23f,_0x22de36,_0x5140c3){var _0x17e40f,_0x523fe3,_0x3ce11d;if(_['isNil'](_0x53e23f[_0x6b78('0x61')][_0x6b78('0x61')])||_0x53e23f[_0x6b78('0x61')]['body']===''){throw new db[(_0x6b78('0x74'))][(_0x6b78('0x7c'))](_0x6b78('0x7b'));}if(_[_0x6b78('0x79')](_0x53e23f['body']['to'])){}_0x17e40f=_0x53e23f[_0x6b78('0x61')]['to'];return db[_0x6b78('0x3d')][_0x6b78('0x67')]({'where':{'id':_0x53e23f[_0x6b78('0x62')]['id']}})[_0x6b78('0x1d')](handleEntityNotFound(_0x22de36,null))['then'](function(_0x61b0b0){if(_0x61b0b0){return db[_0x6b78('0x3d')]['find']({'where':{'id':_0x61b0b0['id']},'include':[{'model':db[_0x6b78('0x81')],'as':_0x6b78('0x82'),'include':[{'model':db[_0x6b78('0x73')],'as':'Contacts','where':{[_0x61b0b0[_0x6b78('0x7f')]]:_0x17e40f},'limit':0x1,'order':[['updatedAt',_0x6b78('0xb4')]]}]}]})[_0x6b78('0x1d')](handleEntityNotFound(_0x22de36,null))[_0x6b78('0x1d')](function(_0x3256b0){if(_0x3256b0&&_0x3256b0['List']){_0x523fe3=_0x3256b0[_0x6b78('0x33')]({'plain':!![]});if(_0x523fe3[_0x6b78('0x82')]&&_0x523fe3[_0x6b78('0x82')]['Contacts'][_0x6b78('0x69')]){return _0x523fe3['List'][_0x6b78('0x83')][0x0];}return db[_0x6b78('0x73')][_0x6b78('0x59')](_['defaults'](_0x53e23f[_0x6b78('0x61')],{'firstName':_0x17e40f,[_0x3256b0['mapKey']]:_0x17e40f,'phone':_0x17e40f,'ListId':_0x523fe3[_0x6b78('0x78')]}));}})[_0x6b78('0x1d')](handleEntityNotFound(_0x22de36,null))[_0x6b78('0x1d')](function(_0xd27525){if(_0xd27525){_0x3ce11d=_0xd27525;return db[_0x6b78('0x8f')]['find']({'where':{'ContactId':_0x3ce11d['id'],'closed':![],'OpenchannelAccountId':_0x523fe3['id']}})[_0x6b78('0x1d')](function(_0x246729){if(_0x246729){return[_0x246729,![]];}return db[_0x6b78('0x8f')][_0x6b78('0x59')]({'UserId':_0x53e23f[_0x6b78('0x5a')]['id'],'ContactId':_0x3ce11d['id'],'OpenchannelAccountId':_0x523fe3['id'],'lastMsgDirection':_0x6b78('0xb5'),'Messages':[_[_0x6b78('0x51')](_0x53e23f[_0x6b78('0x61')],{'read':![],'body':_0x53e23f['body']['body'],'OpenchannelAccountId':_0x523fe3['id'],'UserId':_0x53e23f[_0x6b78('0x5a')]['id'],'ContactId':_0x3ce11d['id']})]},{'include':[{'model':db[_0x6b78('0xb6')],'as':_0x6b78('0xb7')}]})['then'](function(_0x1f6432){return[_0x1f6432,!![]];});});}})[_0x6b78('0x92')](function(_0x16fdf1,_0x19d70d){if(_0x19d70d){return _0x16fdf1;}return db[_0x6b78('0xb6')][_0x6b78('0x59')](_['merge'](_0x53e23f['body'],{'read':![],'body':_0x53e23f[_0x6b78('0x61')]['body'],'OpenchannelAccountId':_0x523fe3['id'],'OpenchannelInteractionId':_0x16fdf1['id'],'UserId':_0x53e23f[_0x6b78('0x5a')]['id'],'ContactId':_0x3ce11d['id']}))['then'](function(_0x15b350){_0x16fdf1[_0x6b78('0xb8')][_0x6b78('0xb7')]=[];_0x16fdf1[_0x6b78('0xb8')][_0x6b78('0xb7')][_0x6b78('0xb9')](_0x15b350['dataValues']);return _0x16fdf1;});});}})[_0x6b78('0x1d')](respondWithResult(_0x22de36,null))[_0x6b78('0x26')](handleError(_0x22de36,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index bb05e37..c64e0a7 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 _0x99e9=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4e3f20,_0x45b49c){var _0x264ebf=function(_0x595376){while(--_0x595376){_0x4e3f20['push'](_0x4e3f20['shift']());}};_0x264ebf(++_0x45b49c);}(_0x99e9,0xb4));var _0x999e=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0x99e9[_0x31172e];return _0x414ada;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x999e('0x0'))['db'][_0x999e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x999e('0x2')](0x0);var events={'afterCreate':_0x999e('0x3'),'afterUpdate':'update','afterDestroy':_0x999e('0x4')};function emitEvent(_0x2f803e){return function(_0x3aac27,_0x4e2112,_0x296411){OpenchannelAccountEvents['emit'](_0x2f803e+':'+_0x3aac27['id'],_0x3aac27);OpenchannelAccountEvents[_0x999e('0x5')](_0x2f803e,_0x3aac27);_0x296411(null);};}for(var e in events){if(events[_0x999e('0x6')](e)){var event=events[e];OpenchannelAccount[_0x999e('0x7')](e,emitEvent(event));}}module[_0x999e('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x702d=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount'];(function(_0xbfc2b2,_0x409e41){var _0x13e1b0=function(_0x479213){while(--_0x479213){_0xbfc2b2['push'](_0xbfc2b2['shift']());}};_0x13e1b0(++_0x409e41);}(_0x702d,0x147));var _0xd702=function(_0x5152f3,_0x2b411e){_0x5152f3=_0x5152f3-0x0;var _0x41a6d7=_0x702d[_0x5152f3];return _0x41a6d7;};'use strict';var EventEmitter=require(_0xd702('0x0'));var OpenchannelAccount=require(_0xd702('0x1'))['db'][_0xd702('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xd702('0x3')](0x0);var events={'afterCreate':_0xd702('0x4'),'afterUpdate':'update','afterDestroy':_0xd702('0x5')};function emitEvent(_0xebbd7c){return function(_0x27b260,_0x1c5a32,_0x481ee0){OpenchannelAccountEvents[_0xd702('0x6')](_0xebbd7c+':'+_0x27b260['id'],_0x27b260);OpenchannelAccountEvents['emit'](_0xebbd7c,_0x27b260);_0x481ee0(null);};}for(var e in events){if(events[_0xd702('0x7')](e)){var event=events[e];OpenchannelAccount[_0xd702('0x8')](e,emitEvent(event));}}module[_0xd702('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 482dde6..9016f94 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(_0x110c05,_0x32d88f){var _0x3a59ba=function(_0x134c23){while(--_0x134c23){_0x110c05['push'](_0x110c05['shift']());}};_0x3a59ba(++_0x32d88f);}(_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 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(_0x33a992,_0x299c82){var _0x3f1586=function(_0x498c25){while(--_0x498c25){_0x33a992['push'](_0x33a992['shift']());}};_0x3f1586(++_0x299c82);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 8154762..5b7a3be 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 _0xb574=['info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','socket.io-emitter','redis','./openchannelAccount.socket','register','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x341f8a,_0x42a1c5){var _0x2518ba=function(_0xd9eaf1){while(--_0xd9eaf1){_0x341f8a['push'](_0x341f8a['shift']());}};_0x2518ba(++_0x42a1c5);}(_0xb574,0x106));var _0x4b57=function(_0x1418c6,_0x17ab21){_0x1418c6=_0x1418c6-0x0;var _0x357a19=_0xb574[_0x1418c6];return _0x357a19;};'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});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4b57('0xa'))(new Redis(config[_0x4b57('0xb')]));require(_0x4b57('0xc'))[_0x4b57('0xd')](socket);function respondWithRpcPromise(_0xce47ad,_0x116958,_0x1db79a){return new BPromise(function(_0x43b108,_0x5593b8){return client[_0x4b57('0xe')](_0xce47ad,_0x1db79a)[_0x4b57('0xf')](function(_0x274912){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x116958,_0x4b57('0x10'));logger[_0x4b57('0x11')](_0x4b57('0x12'),_0x116958,_0x4b57('0x10'),JSON[_0x4b57('0x13')](_0x274912));if(_0x274912[_0x4b57('0x14')]){if(_0x274912[_0x4b57('0x14')][_0x4b57('0x15')]===0x1f4){logger[_0x4b57('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x116958,_0x274912['error'][_0x4b57('0x16')]);return _0x5593b8(_0x274912[_0x4b57('0x14')][_0x4b57('0x16')]);}logger['error'](_0x4b57('0x17'),_0x116958,_0x274912['error'][_0x4b57('0x16')]);return _0x43b108(_0x274912[_0x4b57('0x14')][_0x4b57('0x16')]);}else{logger[_0x4b57('0x18')](_0x4b57('0x17'),_0x116958,_0x4b57('0x10'));_0x43b108(_0x274912['result'][_0x4b57('0x16')]);}})[_0x4b57('0x19')](function(_0x53f29a){logger[_0x4b57('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x116958,_0x53f29a);_0x5593b8(_0x53f29a);});});} \ No newline at end of file +var _0xfc03=['jayson/promise','client','http','redis','socket.io-emitter','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x427d02,_0xe0553c){var _0x262e9b=function(_0x5cacd0){while(--_0x5cacd0){_0x427d02['push'](_0x427d02['shift']());}};_0x262e9b(++_0xe0553c);}(_0xfc03,0x16f));var _0x3fc0=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xfc03[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x3fc0('0x0'));var util=require('util');var moment=require(_0x3fc0('0x1'));var BPromise=require(_0x3fc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fc0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fc0('0x4'));var logger=require(_0x3fc0('0x5'))(_0x3fc0('0x6'));var config=require(_0x3fc0('0x7'));var jayson=require(_0x3fc0('0x8'));var client=jayson[_0x3fc0('0x9')][_0x3fc0('0xa')]({'port':0x232a});config[_0x3fc0('0xb')]=_['defaults'](config[_0x3fc0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3fc0('0xc'))(new Redis(config[_0x3fc0('0xb')]));require(_0x3fc0('0xd'))[_0x3fc0('0xe')](socket);function respondWithRpcPromise(_0x5ef417,_0x1ee428,_0x929f8f){return new BPromise(function(_0xe9d431,_0x43faa8){return client[_0x3fc0('0xf')](_0x5ef417,_0x929f8f)['then'](function(_0x1f476c){logger[_0x3fc0('0x10')](_0x3fc0('0x11'),_0x1ee428,'request\x20sent');logger[_0x3fc0('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x1ee428,_0x3fc0('0x13'),JSON[_0x3fc0('0x14')](_0x1f476c));if(_0x1f476c['error']){if(_0x1f476c[_0x3fc0('0x15')][_0x3fc0('0x16')]===0x1f4){logger[_0x3fc0('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x1ee428,_0x1f476c[_0x3fc0('0x15')][_0x3fc0('0x17')]);return _0x43faa8(_0x1f476c[_0x3fc0('0x15')][_0x3fc0('0x17')]);}logger['error'](_0x3fc0('0x11'),_0x1ee428,_0x1f476c[_0x3fc0('0x15')][_0x3fc0('0x17')]);return _0xe9d431(_0x1f476c['error'][_0x3fc0('0x17')]);}else{logger['info'](_0x3fc0('0x11'),_0x1ee428,_0x3fc0('0x13'));_0xe9d431(_0x1f476c['result'][_0x3fc0('0x17')]);}})[_0x3fc0('0x18')](function(_0x1c33c8){logger[_0x3fc0('0x15')](_0x3fc0('0x11'),_0x1ee428,_0x1c33c8);_0x43faa8(_0x1c33c8);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 929dfba..efdb0e7 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 _0xa9e5=['length','openchannelAccount:','./openchannelAccount.events','save','update','emit','removeListener','register'];(function(_0xddeac9,_0x2ebf8c){var _0x65fa72=function(_0x795e4f){while(--_0x795e4f){_0xddeac9['push'](_0xddeac9['shift']());}};_0x65fa72(++_0x2ebf8c);}(_0xa9e5,0x8a));var _0x5a9e=function(_0x457336,_0x1c6c86){_0x457336=_0x457336-0x0;var _0xb4ba60=_0xa9e5[_0x457336];return _0xb4ba60;};'use strict';var OpenchannelAccountEvents=require(_0x5a9e('0x0'));var events=[_0x5a9e('0x1'),'remove',_0x5a9e('0x2')];function createListener(_0x4153cc,_0x31f045){return function(_0x1dc619){_0x31f045[_0x5a9e('0x3')](_0x4153cc,_0x1dc619);};}function removeListener(_0x2fdfab,_0x3ce605){return function(){OpenchannelAccountEvents[_0x5a9e('0x4')](_0x2fdfab,_0x3ce605);};}exports[_0x5a9e('0x5')]=function(_0x34a9ed){for(var _0x1fb122=0x0,_0x36831b=events[_0x5a9e('0x6')];_0x1fb122<_0x36831b;_0x1fb122++){var _0xa3e37b=events[_0x1fb122];var _0x4e1213=createListener(_0x5a9e('0x7')+_0xa3e37b,_0x34a9ed);OpenchannelAccountEvents['on'](_0xa3e37b,_0x4e1213);}}; \ No newline at end of file +var _0x4746=['length','openchannelAccount:','./openchannelAccount.events','save','update','emit','register'];(function(_0x487e2d,_0x1fe8ba){var _0xe4457c=function(_0x394c39){while(--_0x394c39){_0x487e2d['push'](_0x487e2d['shift']());}};_0xe4457c(++_0x1fe8ba);}(_0x4746,0xc6));var _0x6474=function(_0x12310c,_0x437f93){_0x12310c=_0x12310c-0x0;var _0x44cbdb=_0x4746[_0x12310c];return _0x44cbdb;};'use strict';var OpenchannelAccountEvents=require(_0x6474('0x0'));var events=[_0x6474('0x1'),'remove',_0x6474('0x2')];function createListener(_0x59b95a,_0xd115f7){return function(_0x244bc5){_0xd115f7[_0x6474('0x3')](_0x59b95a,_0x244bc5);};}function removeListener(_0x156374,_0x1314f4){return function(){OpenchannelAccountEvents['removeListener'](_0x156374,_0x1314f4);};}exports[_0x6474('0x4')]=function(_0x2bcf7c){for(var _0x4cadd7=0x0,_0x433af9=events[_0x6474('0x5')];_0x4cadd7<_0x433af9;_0x4cadd7++){var _0xcd065e=events[_0x4cadd7];var _0xec3cda=createListener(_0x6474('0x6')+_0xcd065e,_0x2bcf7c);OpenchannelAccountEvents['on'](_0xcd065e,_0xec3cda);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 681157e..609cb69 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 _0xc78e=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','get','/:id','show','create','put','update','delete','destroy'];(function(_0x404c6e,_0x4a24a7){var _0x40611b=function(_0x3eef9f){while(--_0x3eef9f){_0x404c6e['push'](_0x404c6e['shift']());}};_0x40611b(++_0x4a24a7);}(_0xc78e,0x1c3));var _0xec78=function(_0x5e418d,_0x110765){_0x5e418d=_0x5e418d-0x0;var _0x2b9ae2=_0xc78e[_0x5e418d];return _0x2b9ae2;};'use strict';var multer=require(_0xec78('0x0'));var util=require(_0xec78('0x1'));var path=require(_0xec78('0x2'));var timeout=require(_0xec78('0x3'));var express=require(_0xec78('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xec78('0x5'));var config=require(_0xec78('0x6'));var controller=require(_0xec78('0x7'));router['get']('/',auth[_0xec78('0x8')](),controller['index']);router[_0xec78('0x9')](_0xec78('0xa'),auth[_0xec78('0x8')](),controller[_0xec78('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xec78('0xc')]);router[_0xec78('0xd')]('/:id',auth[_0xec78('0x8')](),controller[_0xec78('0xe')]);router[_0xec78('0xf')](_0xec78('0xa'),auth[_0xec78('0x8')](),controller[_0xec78('0x10')]);module[_0xec78('0x11')]=router; \ No newline at end of file +var _0x53c5=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer'];(function(_0x743b49,_0x2ed209){var _0x3b209a=function(_0x4eac28){while(--_0x4eac28){_0x743b49['push'](_0x743b49['shift']());}};_0x3b209a(++_0x2ed209);}(_0x53c5,0xdb));var _0x553c=function(_0xae84d9,_0x1c6a59){_0xae84d9=_0xae84d9-0x0;var _0x389b5c=_0x53c5[_0xae84d9];return _0x389b5c;};'use strict';var multer=require(_0x553c('0x0'));var util=require(_0x553c('0x1'));var path=require(_0x553c('0x2'));var timeout=require('connect-timeout');var express=require(_0x553c('0x3'));var router=express[_0x553c('0x4')]();var fs_extra=require(_0x553c('0x5'));var auth=require(_0x553c('0x6'));var interaction=require(_0x553c('0x7'));var config=require(_0x553c('0x8'));var controller=require('./openchannelApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x553c('0x9')]);router[_0x553c('0xa')](_0x553c('0xb'),auth[_0x553c('0xc')](),controller[_0x553c('0xd')]);router[_0x553c('0xe')]('/',auth[_0x553c('0xc')](),controller['create']);router[_0x553c('0xf')]('/:id',auth[_0x553c('0xc')](),controller[_0x553c('0x10')]);router[_0x553c('0x11')](_0x553c('0xb'),auth[_0x553c('0xc')](),controller[_0x553c('0x12')]);module[_0x553c('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 89d6eb5..00e511e 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 _0x87b9=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x87b9,0x15f));var _0x987b=function(_0x3fc358,_0x3956dd){_0x3fc358=_0x3fc358-0x0;var _0x5e3733=_0x87b9[_0x3fc358];return _0x5e3733;};'use strict';var Sequelize=require('sequelize');module[_0x987b('0x0')]={'priority':{'type':Sequelize[_0x987b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x987b('0x2')],'allowNull':![],'defaultValue':_0x987b('0x3')},'appdata':{'type':Sequelize[_0x987b('0x4')]()},'description':{'type':Sequelize[_0x987b('0x2')]},'interval':{'type':Sequelize[_0x987b('0x2')],'defaultValue':_0x987b('0x5')}}; \ No newline at end of file +var _0xaba5=['INTEGER','STRING','TEXT','*,*,*,*','exports'];(function(_0x505f50,_0x1f6978){var _0x235de6=function(_0x17d657){while(--_0x17d657){_0x505f50['push'](_0x505f50['shift']());}};_0x235de6(++_0x1f6978);}(_0xaba5,0x1f3));var _0x5aba=function(_0xd5290a,_0x149a81){_0xd5290a=_0xd5290a-0x0;var _0x25e69c=_0xaba5[_0xd5290a];return _0x25e69c;};'use strict';var Sequelize=require('sequelize');module[_0x5aba('0x0')]={'priority':{'type':Sequelize[_0x5aba('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5aba('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5aba('0x3')]()},'description':{'type':Sequelize[_0x5aba('0x2')]},'interval':{'type':Sequelize[_0x5aba('0x2')],'defaultValue':_0x5aba('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e1926ee..ac49ae3 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 _0x4bd2=['merge','VIRTUAL','options','OpenchannelApplication','includeAll','include','findAll','catch','show','params','intersection','find','create','body','destroy','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','end','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x484b1e,_0x1a4245){var _0x2611a3=function(_0x12f62e){while(--_0x12f62e){_0x484b1e['push'](_0x484b1e['shift']());}};_0x2611a3(++_0x1a4245);}(_0x4bd2,0x12f));var _0x24bd=function(_0x3750e4,_0x37d122){_0x3750e4=_0x3750e4-0x0;var _0x56bba4=_0x4bd2[_0x3750e4];return _0x56bba4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x24bd('0x0'));var jsonpatch=require(_0x24bd('0x1'));var rp=require('request-promise');var moment=require(_0x24bd('0x2'));var BPromise=require(_0x24bd('0x3'));var Mustache=require('mustache');var util=require(_0x24bd('0x4'));var path=require(_0x24bd('0x5'));var sox=require(_0x24bd('0x6'));var csv=require(_0x24bd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x24bd('0x8'));var _=require(_0x24bd('0x9'));var squel=require(_0x24bd('0xa'));var crypto=require(_0x24bd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x24bd('0xc'));var toCsv=require('to-csv');var querystring=require(_0x24bd('0xd'));var Papa=require(_0x24bd('0xe'));var Redis=require(_0x24bd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x24bd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24bd('0x11'));var logger=require(_0x24bd('0x12'))(_0x24bd('0x13'));var utils=require('../../config/utils');var config=require(_0x24bd('0x14'));var licenseUtil=require(_0x24bd('0x15'));var db=require(_0x24bd('0x16'))['db'];function respondWithStatusCode(_0x12572f,_0x28b06e){_0x28b06e=_0x28b06e||0xcc;return function(_0x207f42){if(_0x207f42){return _0x12572f[_0x24bd('0x17')](_0x28b06e);}return _0x12572f['status'](_0x28b06e)['end']();};}function respondWithResult(_0x379944,_0x3bd787){_0x3bd787=_0x3bd787||0xc8;return function(_0x205e52){if(_0x205e52){return _0x379944[_0x24bd('0x18')](_0x3bd787)[_0x24bd('0x19')](_0x205e52);}};}function respondWithFilteredResult(_0x5f3841,_0x2b495a){return function(_0x2ce124){if(_0x2ce124){var _0x471d62=typeof _0x2b495a[_0x24bd('0x1a')]===_0x24bd('0x1b')&&typeof _0x2b495a['limit']===_0x24bd('0x1b');var _0x59e77b=_0x2ce124[_0x24bd('0x1c')];var _0x235076=_0x471d62?0x0:_0x2b495a[_0x24bd('0x1a')];var _0x1df328=_0x471d62?_0x2ce124[_0x24bd('0x1c')]:_0x2b495a[_0x24bd('0x1a')]+_0x2b495a[_0x24bd('0x1d')];var _0x38b81d;if(_0x1df328>=_0x59e77b){_0x1df328=_0x59e77b;_0x38b81d=0xc8;}else{_0x38b81d=0xce;}_0x5f3841[_0x24bd('0x18')](_0x38b81d);return _0x5f3841[_0x24bd('0x1e')](_0x24bd('0x1f'),_0x235076+'-'+_0x1df328+'/'+_0x59e77b)[_0x24bd('0x19')](_0x2ce124);}return null;};}function patchUpdates(_0x3f5745){return function(_0x3e7bd5){try{jsonpatch[_0x24bd('0x20')](_0x3e7bd5,_0x3f5745,!![]);}catch(_0x104afc){return BPromise[_0x24bd('0x21')](_0x104afc);}return _0x3e7bd5['save']();};}function saveUpdates(_0x45a4b8,_0x27ea3c){return function(_0x18412c){if(_0x18412c){return _0x18412c[_0x24bd('0x22')](_0x45a4b8)[_0x24bd('0x23')](function(_0x99ec76){return _0x99ec76;});}return null;};}function removeEntity(_0x2dac1f,_0x5cc2db){return function(_0x4b7125){if(_0x4b7125){return _0x4b7125['destroy']()[_0x24bd('0x23')](function(){_0x2dac1f[_0x24bd('0x18')](0xcc)[_0x24bd('0x24')]();});}};}function handleEntityNotFound(_0x9fad0f,_0x23cd31){return function(_0xbc248c){if(!_0xbc248c){_0x9fad0f[_0x24bd('0x17')](0x194);}return _0xbc248c;};}function handleError(_0x252efb,_0x4a64ff){_0x4a64ff=_0x4a64ff||0x1f4;return function(_0x55879b){logger[_0x24bd('0x25')](_0x55879b['stack']);if(_0x55879b[_0x24bd('0x26')]){delete _0x55879b[_0x24bd('0x26')];}_0x252efb[_0x24bd('0x18')](_0x4a64ff)[_0x24bd('0x27')](_0x55879b);};}exports[_0x24bd('0x28')]=function(_0x552f45,_0x4193ac){var _0x445886={},_0x3fa571={},_0x220fef={'count':0x0,'rows':[]};var _0x26beaa=_[_0x24bd('0x29')](db['OpenchannelApplication'][_0x24bd('0x2a')],function(_0x2615e7){return{'name':_0x2615e7[_0x24bd('0x2b')],'type':_0x2615e7[_0x24bd('0x2c')]['key']};});_0x3fa571[_0x24bd('0x2d')]=_['map'](_0x26beaa,'name');_0x3fa571[_0x24bd('0x2e')]=_[_0x24bd('0x2f')](_0x552f45[_0x24bd('0x2e')]);_0x3fa571[_0x24bd('0x30')]=_['intersection'](_0x3fa571[_0x24bd('0x2d')],_0x3fa571[_0x24bd('0x2e')]);_0x445886['attributes']=_['intersection'](_0x3fa571[_0x24bd('0x2d')],qs[_0x24bd('0x31')](_0x552f45[_0x24bd('0x2e')][_0x24bd('0x31')]));_0x445886[_0x24bd('0x32')]=_0x445886[_0x24bd('0x32')]['length']?_0x445886[_0x24bd('0x32')]:_0x3fa571['model'];if(!_0x552f45[_0x24bd('0x2e')][_0x24bd('0x33')](_0x24bd('0x34'))){_0x445886[_0x24bd('0x1d')]=qs[_0x24bd('0x1d')](_0x552f45[_0x24bd('0x2e')]['limit']);_0x445886[_0x24bd('0x1a')]=qs[_0x24bd('0x1a')](_0x552f45[_0x24bd('0x2e')][_0x24bd('0x1a')]);}_0x445886['order']=qs[_0x24bd('0x35')](_0x552f45[_0x24bd('0x2e')][_0x24bd('0x35')]);_0x445886[_0x24bd('0x36')]=qs[_0x24bd('0x30')](_[_0x24bd('0x37')](_0x552f45['query'],_0x3fa571[_0x24bd('0x30')]),_0x26beaa);if(_0x552f45[_0x24bd('0x2e')][_0x24bd('0x38')]){_0x445886['where']=_[_0x24bd('0x39')](_0x445886[_0x24bd('0x36')],{'$or':_[_0x24bd('0x29')](_0x26beaa,function(_0x564db9){if(_0x564db9[_0x24bd('0x2c')]!==_0x24bd('0x3a')){var _0xb4ae6b={};_0xb4ae6b[_0x564db9[_0x24bd('0x26')]]={'$like':'%'+_0x552f45['query'][_0x24bd('0x38')]+'%'};return _0xb4ae6b;}})});}_0x445886=_[_0x24bd('0x39')]({},_0x445886,_0x552f45[_0x24bd('0x3b')]);var _0x865310={'where':_0x445886[_0x24bd('0x36')]};return db[_0x24bd('0x3c')][_0x24bd('0x1c')](_0x865310)[_0x24bd('0x23')](function(_0x45c63e){_0x220fef[_0x24bd('0x1c')]=_0x45c63e;if(_0x552f45[_0x24bd('0x2e')][_0x24bd('0x3d')]){_0x445886[_0x24bd('0x3e')]=[{'all':!![]}];}return db[_0x24bd('0x3c')][_0x24bd('0x3f')](_0x445886);})[_0x24bd('0x23')](function(_0x831909){_0x220fef['rows']=_0x831909;return _0x220fef;})[_0x24bd('0x23')](respondWithFilteredResult(_0x4193ac,_0x445886))[_0x24bd('0x40')](handleError(_0x4193ac,null));};exports[_0x24bd('0x41')]=function(_0x32c1bd,_0x214a63){var _0x1b1e64={'raw':!![],'where':{'id':_0x32c1bd[_0x24bd('0x42')]['id']}},_0x3d992e={};_0x3d992e[_0x24bd('0x2d')]=_[_0x24bd('0x2f')](db[_0x24bd('0x3c')]['rawAttributes']);_0x3d992e[_0x24bd('0x2e')]=_['keys'](_0x32c1bd[_0x24bd('0x2e')]);_0x3d992e[_0x24bd('0x30')]=_[_0x24bd('0x43')](_0x3d992e[_0x24bd('0x2d')],_0x3d992e[_0x24bd('0x2e')]);_0x1b1e64[_0x24bd('0x32')]=_[_0x24bd('0x43')](_0x3d992e[_0x24bd('0x2d')],qs[_0x24bd('0x31')](_0x32c1bd[_0x24bd('0x2e')][_0x24bd('0x31')]));_0x1b1e64[_0x24bd('0x32')]=_0x1b1e64[_0x24bd('0x32')]['length']?_0x1b1e64[_0x24bd('0x32')]:_0x3d992e[_0x24bd('0x2d')];if(_0x32c1bd[_0x24bd('0x2e')][_0x24bd('0x3d')]){_0x1b1e64[_0x24bd('0x3e')]=[{'all':!![]}];}_0x1b1e64=_[_0x24bd('0x39')]({},_0x1b1e64,_0x32c1bd[_0x24bd('0x3b')]);return db[_0x24bd('0x3c')][_0x24bd('0x44')](_0x1b1e64)[_0x24bd('0x23')](handleEntityNotFound(_0x214a63,null))[_0x24bd('0x23')](respondWithResult(_0x214a63,null))['catch'](handleError(_0x214a63,null));};exports[_0x24bd('0x45')]=function(_0x3dbd71,_0x4a02ab){return db[_0x24bd('0x3c')][_0x24bd('0x45')](_0x3dbd71[_0x24bd('0x46')],{})[_0x24bd('0x23')](respondWithResult(_0x4a02ab,0xc9))[_0x24bd('0x40')](handleError(_0x4a02ab,null));};exports[_0x24bd('0x22')]=function(_0x53a7ea,_0x3c26c1){if(_0x53a7ea[_0x24bd('0x46')]['id']){delete _0x53a7ea[_0x24bd('0x46')]['id'];}return db[_0x24bd('0x3c')]['find']({'where':{'id':_0x53a7ea[_0x24bd('0x42')]['id']}})[_0x24bd('0x23')](handleEntityNotFound(_0x3c26c1,null))[_0x24bd('0x23')](saveUpdates(_0x53a7ea['body'],null))['then'](respondWithResult(_0x3c26c1,null))[_0x24bd('0x40')](handleError(_0x3c26c1,null));};exports[_0x24bd('0x47')]=function(_0x5cea5a,_0x366ff4){return db[_0x24bd('0x3c')][_0x24bd('0x44')]({'where':{'id':_0x5cea5a['params']['id']}})[_0x24bd('0x23')](handleEntityNotFound(_0x366ff4,null))[_0x24bd('0x23')](removeEntity(_0x366ff4,null))[_0x24bd('0x40')](handleError(_0x366ff4,null));}; \ No newline at end of file +var _0xd0f0=['index','OpenchannelApplication','rawAttributes','fieldName','key','model','name','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','map','options','count','includeAll','include','findAll','rows','catch','show','create','body','params','find','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack'];(function(_0x562cd7,_0x5ae8e7){var _0x30f50d=function(_0x43b995){while(--_0x43b995){_0x562cd7['push'](_0x562cd7['shift']());}};_0x30f50d(++_0x5ae8e7);}(_0xd0f0,0xf3));var _0x0d0f=function(_0x4307d0,_0x31ae0){_0x4307d0=_0x4307d0-0x0;var _0x4bb86f=_0xd0f0[_0x4307d0];return _0x4bb86f;};'use strict';var emlformat=require(_0x0d0f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d0f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d0f('0x2'));var moment=require(_0x0d0f('0x3'));var BPromise=require(_0x0d0f('0x4'));var Mustache=require('mustache');var util=require(_0x0d0f('0x5'));var path=require(_0x0d0f('0x6'));var sox=require(_0x0d0f('0x7'));var csv=require(_0x0d0f('0x8'));var ejs=require(_0x0d0f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0d0f('0xa'));var crypto=require('crypto');var jsforce=require(_0x0d0f('0xb'));var deskjs=require(_0x0d0f('0xc'));var toCsv=require(_0x0d0f('0x8'));var querystring=require('querystring');var Papa=require(_0x0d0f('0xd'));var Redis=require(_0x0d0f('0xe'));var authService=require(_0x0d0f('0xf'));var qs=require(_0x0d0f('0x10'));var as=require(_0x0d0f('0x11'));var hardwareService=require(_0x0d0f('0x12'));var logger=require('../../config/logger')(_0x0d0f('0x13'));var utils=require(_0x0d0f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd65258,_0x2b0c41){_0x2b0c41=_0x2b0c41||0xcc;return function(_0x106005){if(_0x106005){return _0xd65258[_0x0d0f('0x15')](_0x2b0c41);}return _0xd65258['status'](_0x2b0c41)[_0x0d0f('0x16')]();};}function respondWithResult(_0x40bf7f,_0x6082fd){_0x6082fd=_0x6082fd||0xc8;return function(_0x4273ed){if(_0x4273ed){return _0x40bf7f[_0x0d0f('0x17')](_0x6082fd)[_0x0d0f('0x18')](_0x4273ed);}};}function respondWithFilteredResult(_0x22c8f6,_0x179e46){return function(_0x48ccf2){if(_0x48ccf2){var _0x3b4792=typeof _0x179e46[_0x0d0f('0x19')]===_0x0d0f('0x1a')&&typeof _0x179e46[_0x0d0f('0x1b')]==='undefined';var _0x5ba7bf=_0x48ccf2['count'];var _0x117295=_0x3b4792?0x0:_0x179e46[_0x0d0f('0x19')];var _0x87b392=_0x3b4792?_0x48ccf2['count']:_0x179e46[_0x0d0f('0x19')]+_0x179e46[_0x0d0f('0x1b')];var _0x390b64;if(_0x87b392>=_0x5ba7bf){_0x87b392=_0x5ba7bf;_0x390b64=0xc8;}else{_0x390b64=0xce;}_0x22c8f6[_0x0d0f('0x17')](_0x390b64);return _0x22c8f6['set'](_0x0d0f('0x1c'),_0x117295+'-'+_0x87b392+'/'+_0x5ba7bf)[_0x0d0f('0x18')](_0x48ccf2);}return null;};}function patchUpdates(_0x15d900){return function(_0x4afa52){try{jsonpatch[_0x0d0f('0x1d')](_0x4afa52,_0x15d900,!![]);}catch(_0x4463b2){return BPromise[_0x0d0f('0x1e')](_0x4463b2);}return _0x4afa52[_0x0d0f('0x1f')]();};}function saveUpdates(_0x3a2a41,_0x2291ac){return function(_0x4f4afa){if(_0x4f4afa){return _0x4f4afa[_0x0d0f('0x20')](_0x3a2a41)['then'](function(_0x5c1e9e){return _0x5c1e9e;});}return null;};}function removeEntity(_0x36ce25,_0x430b0f){return function(_0x4ceda4){if(_0x4ceda4){return _0x4ceda4[_0x0d0f('0x21')]()[_0x0d0f('0x22')](function(){_0x36ce25[_0x0d0f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45c1b5,_0x4496bd){return function(_0xdbb1ac){if(!_0xdbb1ac){_0x45c1b5[_0x0d0f('0x15')](0x194);}return _0xdbb1ac;};}function handleError(_0x1697c9,_0x5ae076){_0x5ae076=_0x5ae076||0x1f4;return function(_0x59e715){logger[_0x0d0f('0x23')](_0x59e715[_0x0d0f('0x24')]);if(_0x59e715['name']){delete _0x59e715['name'];}_0x1697c9[_0x0d0f('0x17')](_0x5ae076)['send'](_0x59e715);};}exports[_0x0d0f('0x25')]=function(_0x660013,_0x59b139){var _0x34838a={},_0x4669a9={},_0x4f314e={'count':0x0,'rows':[]};var _0x29e2bf=_['map'](db[_0x0d0f('0x26')][_0x0d0f('0x27')],function(_0x64a6c6){return{'name':_0x64a6c6[_0x0d0f('0x28')],'type':_0x64a6c6['type'][_0x0d0f('0x29')]};});_0x4669a9[_0x0d0f('0x2a')]=_['map'](_0x29e2bf,_0x0d0f('0x2b'));_0x4669a9['query']=_[_0x0d0f('0x2c')](_0x660013[_0x0d0f('0x2d')]);_0x4669a9['filters']=_[_0x0d0f('0x2e')](_0x4669a9[_0x0d0f('0x2a')],_0x4669a9[_0x0d0f('0x2d')]);_0x34838a['attributes']=_['intersection'](_0x4669a9[_0x0d0f('0x2a')],qs[_0x0d0f('0x2f')](_0x660013['query'][_0x0d0f('0x2f')]));_0x34838a[_0x0d0f('0x30')]=_0x34838a[_0x0d0f('0x30')][_0x0d0f('0x31')]?_0x34838a['attributes']:_0x4669a9[_0x0d0f('0x2a')];if(!_0x660013[_0x0d0f('0x2d')]['hasOwnProperty'](_0x0d0f('0x32'))){_0x34838a['limit']=qs[_0x0d0f('0x1b')](_0x660013[_0x0d0f('0x2d')][_0x0d0f('0x1b')]);_0x34838a[_0x0d0f('0x19')]=qs[_0x0d0f('0x19')](_0x660013[_0x0d0f('0x2d')][_0x0d0f('0x19')]);}_0x34838a[_0x0d0f('0x33')]=qs[_0x0d0f('0x34')](_0x660013[_0x0d0f('0x2d')]['sort']);_0x34838a[_0x0d0f('0x35')]=qs[_0x0d0f('0x36')](_['pick'](_0x660013[_0x0d0f('0x2d')],_0x4669a9[_0x0d0f('0x36')]),_0x29e2bf);if(_0x660013[_0x0d0f('0x2d')][_0x0d0f('0x37')]){_0x34838a[_0x0d0f('0x35')]=_[_0x0d0f('0x38')](_0x34838a['where'],{'$or':_[_0x0d0f('0x39')](_0x29e2bf,function(_0x52f591){if(_0x52f591['type']!=='VIRTUAL'){var _0x27593={};_0x27593[_0x52f591[_0x0d0f('0x2b')]]={'$like':'%'+_0x660013[_0x0d0f('0x2d')][_0x0d0f('0x37')]+'%'};return _0x27593;}})});}_0x34838a=_[_0x0d0f('0x38')]({},_0x34838a,_0x660013[_0x0d0f('0x3a')]);var _0x16c85f={'where':_0x34838a['where']};return db[_0x0d0f('0x26')][_0x0d0f('0x3b')](_0x16c85f)[_0x0d0f('0x22')](function(_0x304bc7){_0x4f314e[_0x0d0f('0x3b')]=_0x304bc7;if(_0x660013['query'][_0x0d0f('0x3c')]){_0x34838a[_0x0d0f('0x3d')]=[{'all':!![]}];}return db[_0x0d0f('0x26')][_0x0d0f('0x3e')](_0x34838a);})['then'](function(_0xc326e7){_0x4f314e[_0x0d0f('0x3f')]=_0xc326e7;return _0x4f314e;})[_0x0d0f('0x22')](respondWithFilteredResult(_0x59b139,_0x34838a))[_0x0d0f('0x40')](handleError(_0x59b139,null));};exports[_0x0d0f('0x41')]=function(_0x256af1,_0x14b309){var _0x45e127={'raw':!![],'where':{'id':_0x256af1['params']['id']}},_0x1f1534={};_0x1f1534[_0x0d0f('0x2a')]=_[_0x0d0f('0x2c')](db[_0x0d0f('0x26')][_0x0d0f('0x27')]);_0x1f1534[_0x0d0f('0x2d')]=_[_0x0d0f('0x2c')](_0x256af1[_0x0d0f('0x2d')]);_0x1f1534[_0x0d0f('0x36')]=_[_0x0d0f('0x2e')](_0x1f1534['model'],_0x1f1534[_0x0d0f('0x2d')]);_0x45e127[_0x0d0f('0x30')]=_[_0x0d0f('0x2e')](_0x1f1534[_0x0d0f('0x2a')],qs[_0x0d0f('0x2f')](_0x256af1[_0x0d0f('0x2d')][_0x0d0f('0x2f')]));_0x45e127[_0x0d0f('0x30')]=_0x45e127[_0x0d0f('0x30')][_0x0d0f('0x31')]?_0x45e127[_0x0d0f('0x30')]:_0x1f1534[_0x0d0f('0x2a')];if(_0x256af1[_0x0d0f('0x2d')][_0x0d0f('0x3c')]){_0x45e127[_0x0d0f('0x3d')]=[{'all':!![]}];}_0x45e127=_[_0x0d0f('0x38')]({},_0x45e127,_0x256af1[_0x0d0f('0x3a')]);return db['OpenchannelApplication']['find'](_0x45e127)['then'](handleEntityNotFound(_0x14b309,null))[_0x0d0f('0x22')](respondWithResult(_0x14b309,null))[_0x0d0f('0x40')](handleError(_0x14b309,null));};exports[_0x0d0f('0x42')]=function(_0x45a2aa,_0x3b204a){return db[_0x0d0f('0x26')][_0x0d0f('0x42')](_0x45a2aa[_0x0d0f('0x43')],{})['then'](respondWithResult(_0x3b204a,0xc9))[_0x0d0f('0x40')](handleError(_0x3b204a,null));};exports[_0x0d0f('0x20')]=function(_0x4eab2d,_0x137f73){if(_0x4eab2d[_0x0d0f('0x43')]['id']){delete _0x4eab2d['body']['id'];}return db[_0x0d0f('0x26')]['find']({'where':{'id':_0x4eab2d[_0x0d0f('0x44')]['id']}})[_0x0d0f('0x22')](handleEntityNotFound(_0x137f73,null))['then'](saveUpdates(_0x4eab2d['body'],null))[_0x0d0f('0x22')](respondWithResult(_0x137f73,null))[_0x0d0f('0x40')](handleError(_0x137f73,null));};exports[_0x0d0f('0x21')]=function(_0x56051a,_0x4fb20e){return db['OpenchannelApplication'][_0x0d0f('0x45')]({'where':{'id':_0x56051a[_0x0d0f('0x44')]['id']}})[_0x0d0f('0x22')](handleEntityNotFound(_0x4fb20e,null))['then'](removeEntity(_0x4fb20e,null))['catch'](handleError(_0x4fb20e,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 4f31a97..89a2cd8 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 _0xce43=['request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5a3e69,_0x346f71){var _0x27073b=function(_0x36283e){while(--_0x36283e){_0x5a3e69['push'](_0x5a3e69['shift']());}};_0x27073b(++_0x346f71);}(_0xce43,0x1e4));var _0x3ce4=function(_0x11369f,_0x44f6ed){_0x11369f=_0x11369f-0x0;var _0x417890=_0xce43[_0x11369f];return _0x417890;};'use strict';var _=require(_0x3ce4('0x0'));var util=require(_0x3ce4('0x1'));var logger=require(_0x3ce4('0x2'))(_0x3ce4('0x3'));var moment=require(_0x3ce4('0x4'));var BPromise=require(_0x3ce4('0x5'));var rp=require(_0x3ce4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ce4('0x7'));var config=require(_0x3ce4('0x8'));var attributes=require(_0x3ce4('0x9'));module[_0x3ce4('0xa')]=function(_0xb5296a,_0x49e37d){return _0xb5296a['define'](_0x3ce4('0xb'),attributes,{'tableName':_0x3ce4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3ce4('0xd')});}; \ No newline at end of file +var _0xd5aa=['bluebird','request-promise','path','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','util','../../config/logger','api','moment'];(function(_0x28af34,_0x1d3cde){var _0x24f313=function(_0x5342cd){while(--_0x5342cd){_0x28af34['push'](_0x28af34['shift']());}};_0x24f313(++_0x1d3cde);}(_0xd5aa,0x134));var _0xad5a=function(_0xf2a98b,_0x4f677c){_0xf2a98b=_0xf2a98b-0x0;var _0x3a15c0=_0xd5aa[_0xf2a98b];return _0x3a15c0;};'use strict';var _=require('lodash');var util=require(_0xad5a('0x0'));var logger=require(_0xad5a('0x1'))(_0xad5a('0x2'));var moment=require(_0xad5a('0x3'));var BPromise=require(_0xad5a('0x4'));var rp=require(_0xad5a('0x5'));var fs=require('fs');var path=require(_0xad5a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xad5a('0x7'));module[_0xad5a('0x8')]=function(_0x56c6c3,_0x4075e8){return _0x56c6c3['define'](_0xad5a('0x9'),attributes,{'tableName':_0xad5a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xad5a('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 27c71c2..4809691 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 _0x09da=['message','result','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','attributes','debug','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x09da,0x184));var _0xa09d=function(_0x216429,_0x513576){_0x216429=_0x216429-0x0;var _0x537534=_0x09da[_0x216429];return _0x537534;};'use strict';var _=require(_0xa09d('0x0'));var util=require(_0xa09d('0x1'));var moment=require('moment');var BPromise=require(_0xa09d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa09d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa09d('0x4'))(_0xa09d('0x5'));var config=require(_0xa09d('0x6'));var jayson=require(_0xa09d('0x7'));var client=jayson[_0xa09d('0x8')][_0xa09d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f50ff,_0x58fd4f,_0x550a82){return new BPromise(function(_0x8eadbe,_0x3270ea){return client[_0xa09d('0xa')](_0x1f50ff,_0x550a82)[_0xa09d('0xb')](function(_0x57c52a){logger[_0xa09d('0xc')](_0xa09d('0xd'),_0x58fd4f,'request\x20sent');logger['debug'](_0xa09d('0xe'),_0x58fd4f,_0xa09d('0xf'),JSON['stringify'](_0x57c52a));if(_0x57c52a[_0xa09d('0x10')]){if(_0x57c52a[_0xa09d('0x10')][_0xa09d('0x11')]===0x1f4){logger[_0xa09d('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x58fd4f,_0x57c52a[_0xa09d('0x10')][_0xa09d('0x12')]);return _0x3270ea(_0x57c52a[_0xa09d('0x10')][_0xa09d('0x12')]);}logger[_0xa09d('0x10')](_0xa09d('0xd'),_0x58fd4f,_0x57c52a[_0xa09d('0x10')][_0xa09d('0x12')]);return _0x8eadbe(_0x57c52a[_0xa09d('0x10')]['message']);}else{logger[_0xa09d('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x58fd4f,'request\x20sent');_0x8eadbe(_0x57c52a[_0xa09d('0x13')][_0xa09d('0x12')]);}})['catch'](function(_0x26259a){logger[_0xa09d('0x10')](_0xa09d('0xd'),_0x58fd4f,_0x26259a);_0x3270ea(_0x26259a);});});}exports[_0xa09d('0x14')]=function(_0x465019){var _0x2b1acd=this;return new Promise(function(_0x43f28e,_0x548307){return db[_0xa09d('0x15')]['update'](_0x465019[_0xa09d('0x16')],{'raw':_0x465019[_0xa09d('0x17')]?_0x465019[_0xa09d('0x17')][_0xa09d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x465019[_0xa09d('0x17')]?_0x465019[_0xa09d('0x17')][_0xa09d('0x19')]||null:null,'attributes':_0x465019[_0xa09d('0x17')]?_0x465019[_0xa09d('0x17')][_0xa09d('0x1a')]||null:null,'limit':_0x465019['options']?_0x465019[_0xa09d('0x17')]['limit']||null:null})[_0xa09d('0xb')](function(_0x1f5300){logger['info'](_0xa09d('0x14'),_0x465019);logger[_0xa09d('0x1b')]('UpdateOpenchannelApplication',_0x465019,JSON['stringify'](_0x1f5300));_0x43f28e(_0x1f5300);})[_0xa09d('0x1c')](function(_0x1a5b8f){logger[_0xa09d('0x10')](_0xa09d('0x14'),_0x1a5b8f[_0xa09d('0x12')],_0x465019);_0x548307(_0x2b1acd[_0xa09d('0x10')](0x1f4,_0x1a5b8f[_0xa09d('0x12')]));});});}; \ No newline at end of file +var _0x4960=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','limit','info','util'];(function(_0x257017,_0x330627){var _0x38536d=function(_0xdf92e){while(--_0xdf92e){_0x257017['push'](_0x257017['shift']());}};_0x38536d(++_0x330627);}(_0x4960,0x73));var _0x0496=function(_0x2788bd,_0x13e518){_0x2788bd=_0x2788bd-0x0;var _0xd76641=_0x4960[_0x2788bd];return _0xd76641;};'use strict';var _=require('lodash');var util=require(_0x0496('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0496('0x1'));var fs=require('fs');var Redis=require(_0x0496('0x2'));var db=require(_0x0496('0x3'))['db'];var utils=require(_0x0496('0x4'));var logger=require(_0x0496('0x5'))('rpc');var config=require(_0x0496('0x6'));var jayson=require(_0x0496('0x7'));var client=jayson['client'][_0x0496('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x379e2,_0x30e08b,_0x50991a){return new BPromise(function(_0xe3ecb8,_0x47e174){return client[_0x0496('0x9')](_0x379e2,_0x50991a)[_0x0496('0xa')](function(_0x31ec39){logger['info'](_0x0496('0xb'),_0x30e08b,_0x0496('0xc'));logger[_0x0496('0xd')](_0x0496('0xe'),_0x30e08b,_0x0496('0xc'),JSON[_0x0496('0xf')](_0x31ec39));if(_0x31ec39[_0x0496('0x10')]){if(_0x31ec39[_0x0496('0x10')]['code']===0x1f4){logger['error'](_0x0496('0xb'),_0x30e08b,_0x31ec39['error'][_0x0496('0x11')]);return _0x47e174(_0x31ec39[_0x0496('0x10')][_0x0496('0x11')]);}logger[_0x0496('0x10')](_0x0496('0xb'),_0x30e08b,_0x31ec39['error']['message']);return _0xe3ecb8(_0x31ec39[_0x0496('0x10')][_0x0496('0x11')]);}else{logger['info'](_0x0496('0xb'),_0x30e08b,_0x0496('0xc'));_0xe3ecb8(_0x31ec39[_0x0496('0x12')][_0x0496('0x11')]);}})[_0x0496('0x13')](function(_0x1b84c2){logger[_0x0496('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x30e08b,_0x1b84c2);_0x47e174(_0x1b84c2);});});}exports[_0x0496('0x14')]=function(_0x2e5857){var _0x44ce96=this;return new Promise(function(_0x14a8ce,_0x14a62f){return db[_0x0496('0x15')][_0x0496('0x16')](_0x2e5857[_0x0496('0x17')],{'raw':_0x2e5857[_0x0496('0x18')]?_0x2e5857[_0x0496('0x18')][_0x0496('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e5857[_0x0496('0x18')]?_0x2e5857[_0x0496('0x18')][_0x0496('0x1a')]||null:null,'attributes':_0x2e5857[_0x0496('0x18')]?_0x2e5857['options']['attributes']||null:null,'limit':_0x2e5857[_0x0496('0x18')]?_0x2e5857[_0x0496('0x18')][_0x0496('0x1b')]||null:null})[_0x0496('0xa')](function(_0x243499){logger[_0x0496('0x1c')](_0x0496('0x14'),_0x2e5857);logger[_0x0496('0xd')](_0x0496('0x14'),_0x2e5857,JSON[_0x0496('0xf')](_0x243499));_0x14a8ce(_0x243499);})[_0x0496('0x13')](function(_0x3ae81c){logger['error'](_0x0496('0x14'),_0x3ae81c[_0x0496('0x11')],_0x2e5857);_0x14a62f(_0x44ce96[_0x0496('0x10')](0x1f4,_0x3ae81c['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 41a9574..0059421 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 _0x940a=['post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getMessages','/:id/download','download'];(function(_0x3ded72,_0x165768){var _0x1b265f=function(_0x1f1981){while(--_0x1f1981){_0x3ded72['push'](_0x3ded72['shift']());}};_0x1b265f(++_0x165768);}(_0x940a,0x1bf));var _0xa940=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x940a[_0x4bf96c];return _0x281d09;};'use strict';var multer=require(_0xa940('0x0'));var util=require('util');var path=require(_0xa940('0x1'));var timeout=require('connect-timeout');var express=require(_0xa940('0x2'));var router=express[_0xa940('0x3')]();var fs_extra=require(_0xa940('0x4'));var auth=require(_0xa940('0x5'));var interaction=require(_0xa940('0x6'));var config=require('../../config/environment');var controller=require(_0xa940('0x7'));router['get']('/',auth[_0xa940('0x8')](),controller[_0xa940('0x9')]);router[_0xa940('0xa')](_0xa940('0xb'),auth['isAuthenticated'](),controller[_0xa940('0xc')]);router[_0xa940('0xa')](_0xa940('0xd'),auth['isAuthenticated'](),controller[_0xa940('0xe')]);router[_0xa940('0xa')]('/:id/messages',auth[_0xa940('0x8')](),controller[_0xa940('0xf')]);router[_0xa940('0xa')](_0xa940('0x10'),auth[_0xa940('0x8')](),controller[_0xa940('0x11')]);router[_0xa940('0x12')]('/',auth[_0xa940('0x8')](),controller[_0xa940('0x13')]);router[_0xa940('0x12')](_0xa940('0x14'),auth[_0xa940('0x8')](),controller[_0xa940('0x15')]);router['post'](_0xa940('0x16'),auth[_0xa940('0x8')](),interaction[_0xa940('0x17')](_0xa940('0x18'),_0xa940('0x19')),controller['addTags']);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xa940('0x18'),'openchannelinteraction:update'),controller['update']);router[_0xa940('0x1a')](_0xa940('0xd'),auth[_0xa940('0x8')](),interaction['tracked'](_0xa940('0x18'),_0xa940('0x1b')),controller[_0xa940('0x1c')]);router[_0xa940('0x1a')](_0xa940('0x16'),auth['isAuthenticated'](),controller[_0xa940('0x1d')]);module[_0xa940('0x1e')]=router; \ No newline at end of file +var _0xbf27=['removeTags','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xbf27,0xea));var _0x7bf2=function(_0x49a011,_0x2bf067){_0x49a011=_0x49a011-0x0;var _0xe98851=_0xbf27[_0x49a011];return _0xe98851;};'use strict';var multer=require(_0x7bf2('0x0'));var util=require('util');var path=require(_0x7bf2('0x1'));var timeout=require('connect-timeout');var express=require(_0x7bf2('0x2'));var router=express[_0x7bf2('0x3')]();var fs_extra=require(_0x7bf2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7bf2('0x5'));var config=require('../../config/environment');var controller=require(_0x7bf2('0x6'));router[_0x7bf2('0x7')]('/',auth[_0x7bf2('0x8')](),controller['index']);router[_0x7bf2('0x7')](_0x7bf2('0x9'),auth[_0x7bf2('0x8')](),controller[_0x7bf2('0xa')]);router[_0x7bf2('0x7')](_0x7bf2('0xb'),auth[_0x7bf2('0x8')](),controller[_0x7bf2('0xc')]);router[_0x7bf2('0x7')]('/:id/messages',auth[_0x7bf2('0x8')](),controller['getMessages']);router[_0x7bf2('0x7')](_0x7bf2('0xd'),auth[_0x7bf2('0x8')](),controller['download']);router[_0x7bf2('0xe')]('/',auth['isAuthenticated'](),controller[_0x7bf2('0xf')]);router[_0x7bf2('0xe')]('/:id/messages',auth['isAuthenticated'](),controller[_0x7bf2('0x10')]);router[_0x7bf2('0xe')](_0x7bf2('0x11'),auth[_0x7bf2('0x8')](),interaction[_0x7bf2('0x12')](_0x7bf2('0x13'),_0x7bf2('0x14')),controller['addTags']);router[_0x7bf2('0x15')](_0x7bf2('0xb'),auth[_0x7bf2('0x8')](),interaction[_0x7bf2('0x12')](_0x7bf2('0x13'),_0x7bf2('0x16')),controller[_0x7bf2('0x17')]);router[_0x7bf2('0x18')](_0x7bf2('0xb'),auth[_0x7bf2('0x8')](),interaction[_0x7bf2('0x12')]('openchannel',_0x7bf2('0x19')),controller[_0x7bf2('0x1a')]);router[_0x7bf2('0x18')](_0x7bf2('0x11'),auth[_0x7bf2('0x8')](),controller[_0x7bf2('0x1b')]);module[_0x7bf2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 34f2b59..f3c972c 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 _0xd420=['STRING','ENUM','out','BOOLEAN','sequelize','exports','DATE'];(function(_0x3639a8,_0x42af4d){var _0x309482=function(_0x321ebe){while(--_0x321ebe){_0x3639a8['push'](_0x3639a8['shift']());}};_0x309482(++_0x42af4d);}(_0xd420,0x1d9));var _0x0d42=function(_0x2df027,_0x1b303c){_0x2df027=_0x2df027-0x0;var _0x29e8a2=_0xd420[_0x2df027];return _0x29e8a2;};'use strict';var Sequelize=require(_0x0d42('0x0'));module[_0x0d42('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0d42('0x2')]},'disposition':{'type':Sequelize[_0x0d42('0x3')]},'secondDisposition':{'type':Sequelize[_0x0d42('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0d42('0x3')]},'read1stAt':{'type':Sequelize[_0x0d42('0x2')]},'threadId':{'type':Sequelize[_0x0d42('0x3')]},'externalUrl':{'type':Sequelize[_0x0d42('0x3')]},'lastMsgAt':{'type':Sequelize[_0x0d42('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x0d42('0x4')]('in',_0x0d42('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0d42('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x0d42('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xe1dc=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x47ef7b,_0x433019){var _0x595d6f=function(_0x295091){while(--_0x295091){_0x47ef7b['push'](_0x47ef7b['shift']());}};_0x595d6f(++_0x433019);}(_0xe1dc,0x8a));var _0xce1d=function(_0x9f4a7,_0x4b5432){_0x9f4a7=_0x9f4a7-0x0;var _0x59771d=_0xe1dc[_0x9f4a7];return _0x59771d;};'use strict';var Sequelize=require(_0xce1d('0x0'));module[_0xce1d('0x1')]={'closed':{'type':Sequelize[_0xce1d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xce1d('0x3')]},'disposition':{'type':Sequelize[_0xce1d('0x4')]},'secondDisposition':{'type':Sequelize[_0xce1d('0x4')]},'thirdDisposition':{'type':Sequelize[_0xce1d('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xce1d('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xce1d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xce1d('0x5')]('in',_0xce1d('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xce1d('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xce1d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 50516c3..114abac 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 _0x4936=['t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','all','rows','catch','params','includeAll','include','merge','options','create','update','destroy','describe','OpenchannelMessage','addMessage','ids','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','omit','spread','emit','openchannelInteractionTags:save','download','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Attachment','direction','OpenchannelAccount','Account','Owner','get','N.A.','closed','closedAt','disposition','threadId','Private','Messages','basename','existsSync','pipe','createWriteStream','out','secret','read','views','.pdf','Openchannel','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','json','save','then','end','sendStatus','error','stack','name','Users','fullname','TagIds','Tags','split','push','OpenchannelInteraction','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','users','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','isEmpty','forEach','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','`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','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName'];(function(_0x57ef18,_0x2fcf7){var _0x4f029b=function(_0xf7315a){while(--_0xf7315a){_0x57ef18['push'](_0x57ef18['shift']());}};_0x4f029b(++_0x2fcf7);}(_0x4936,0x149));var _0x6493=function(_0x32dca2,_0x590c26){_0x32dca2=_0x32dca2-0x0;var _0x25aba3=_0x4936[_0x32dca2];return _0x25aba3;};'use strict';var emlformat=require(_0x6493('0x0'));var rimraf=require(_0x6493('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6493('0x2'));var rp=require(_0x6493('0x3'));var moment=require(_0x6493('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6493('0x5'));var util=require(_0x6493('0x6'));var path=require(_0x6493('0x7'));var sox=require(_0x6493('0x8'));var csv=require(_0x6493('0x9'));var ejs=require(_0x6493('0xa'));var fs=require('fs');var fs_extra=require(_0x6493('0xb'));var _=require(_0x6493('0xc'));var squel=require(_0x6493('0xd'));var crypto=require(_0x6493('0xe'));var jsforce=require(_0x6493('0xf'));var deskjs=require(_0x6493('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6493('0x11'));var Papa=require(_0x6493('0x12'));var Redis=require('ioredis');var authService=require(_0x6493('0x13'));var qs=require(_0x6493('0x14'));var as=require(_0x6493('0x15'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6493('0x16'))(_0x6493('0x17'));var utils=require(_0x6493('0x18'));var config=require(_0x6493('0x19'));var licenseUtil=require(_0x6493('0x1a'));var db=require(_0x6493('0x1b'))['db'];config[_0x6493('0x1c')]=_['defaults'](config[_0x6493('0x1c')],{'host':_0x6493('0x1d'),'port':0x18eb});var socket=require(_0x6493('0x1e'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x6493('0x1f')](socket);function respondWithStatusCode(_0x3ded0c,_0x27705e){_0x27705e=_0x27705e||0xcc;return function(_0x56b81a){if(_0x56b81a){return _0x3ded0c['sendStatus'](_0x27705e);}return _0x3ded0c['status'](_0x27705e)['end']();};}function respondWithResult(_0x1899c3,_0x475c30){_0x475c30=_0x475c30||0xc8;return function(_0x59eb81){if(_0x59eb81){return _0x1899c3[_0x6493('0x20')](_0x475c30)['json'](_0x59eb81);}};}function respondWithFilteredResult(_0x132bea,_0x223d27){return function(_0x9a25e2){if(_0x9a25e2){var _0x14898d=typeof _0x223d27[_0x6493('0x21')]===_0x6493('0x22')&&typeof _0x223d27[_0x6493('0x23')]===_0x6493('0x22');var _0x3c8a35=_0x9a25e2[_0x6493('0x24')];var _0x49b5d4=_0x14898d?0x0:_0x223d27['offset'];var _0x11a666=_0x14898d?_0x9a25e2[_0x6493('0x24')]:_0x223d27[_0x6493('0x21')]+_0x223d27[_0x6493('0x23')];var _0x456056;if(_0x11a666>=_0x3c8a35){_0x11a666=_0x3c8a35;_0x456056=0xc8;}else{_0x456056=0xce;}_0x132bea[_0x6493('0x20')](_0x456056);return _0x132bea[_0x6493('0x25')]('Content-Range',_0x49b5d4+'-'+_0x11a666+'/'+_0x3c8a35)[_0x6493('0x26')](_0x9a25e2);}return null;};}function patchUpdates(_0xebdd97){return function(_0x474b6d){try{jsonpatch['apply'](_0x474b6d,_0xebdd97,!![]);}catch(_0x111da1){return BPromise['reject'](_0x111da1);}return _0x474b6d[_0x6493('0x27')]();};}function saveUpdates(_0x1d8f58,_0x13e6f7){return function(_0x15db06){if(_0x15db06){return _0x15db06['update'](_0x1d8f58)[_0x6493('0x28')](function(_0x12b603){return _0x12b603;});}return null;};}function removeEntity(_0x4d0c89,_0x585ffe){return function(_0x5fe904){if(_0x5fe904){return _0x5fe904['destroy']()['then'](function(){_0x4d0c89[_0x6493('0x20')](0xcc)[_0x6493('0x29')]();});}};}function handleEntityNotFound(_0x3d6e1d,_0x9f6097){return function(_0x4bccb0){if(!_0x4bccb0){_0x3d6e1d[_0x6493('0x2a')](0x194);}return _0x4bccb0;};}function handleError(_0x63c8b3,_0x19ff17){_0x19ff17=_0x19ff17||0x1f4;return function(_0x13dbbb){logger[_0x6493('0x2b')](_0x13dbbb[_0x6493('0x2c')]);if(_0x13dbbb[_0x6493('0x2d')]){delete _0x13dbbb[_0x6493('0x2d')];}_0x63c8b3[_0x6493('0x20')](_0x19ff17)['send'](_0x13dbbb);};}function getInteractionUsers(_0x481687,_0x4c1c42){return new BPromise(function(_0x52c3b8,_0x95f31f){try{if(_0x4c1c42[_0x481687['id']]){_0x481687[_0x6493('0x2e')]=_['map'](_0x4c1c42[_0x481687['id']],function(_0x565608){return{'id':_0x565608['id'],'fullname':_0x565608[_0x6493('0x2f')]};});}}catch(_0x430e2e){_0x95f31f(_0x430e2e);}_0x52c3b8(_0x481687);});}function getInteractionTags(_0x52ba83,_0x74136b){return new BPromise(function(_0x517578,_0x3f47c0){try{if(_0x52ba83[_0x6493('0x30')]){_0x52ba83[_0x6493('0x31')]=[];_0x52ba83[_0x6493('0x30')][_0x6493('0x32')](',')['forEach'](function(_0x340e89){_0x52ba83[_0x6493('0x31')][_0x6493('0x33')](_0x74136b[_0x340e89]);});}delete _0x52ba83[_0x6493('0x30')];}catch(_0x17d2d0){_0x3f47c0(_0x17d2d0);}_0x517578(_0x52ba83);});}function updateOpenchannelInteraction(_0x1f9c2f,_0x2973aa,_0x2d9f71){return new BPromise(function(_0x319712,_0x26b21c){return getInteractionUsers(_0x1f9c2f,_0x2d9f71)[_0x6493('0x28')](function(_0x1a080b){return getInteractionTags(_0x1a080b,_0x2973aa);})[_0x6493('0x28')](function(_0x3d7b68){_0x319712(_0x3d7b68);})['catch'](function(_0x34d7fe){_0x26b21c(_0x34d7fe);});});}exports['index']=function(_0xd5a344,_0xb6f443){var _0x5b3349={},_0xc74d61={},_0x2b8eb9={'count':0x0,'rows':[]};var _0x43565c=_['map'](db[_0x6493('0x34')][_0x6493('0x35')],function(_0x46b43e){return{'name':_0x46b43e['fieldName'],'type':_0x46b43e[_0x6493('0x36')][_0x6493('0x37')]};});_0xc74d61[_0x6493('0x38')]=_[_0x6493('0x39')](_0x43565c,_0x6493('0x2d'));_0xc74d61[_0x6493('0x3a')]=_[_0x6493('0x3b')](_0xd5a344[_0x6493('0x3a')]);_0xc74d61[_0x6493('0x3c')]=_[_0x6493('0x3d')](_0xc74d61[_0x6493('0x38')],_0xc74d61['query']);_0x5b3349['attributes']=_['intersection'](_0xc74d61[_0x6493('0x38')],qs[_0x6493('0x3e')](_0xd5a344[_0x6493('0x3a')][_0x6493('0x3e')]));_0x5b3349[_0x6493('0x3f')]=_0x5b3349[_0x6493('0x3f')][_0x6493('0x40')]?_0x5b3349['attributes']:_0xc74d61[_0x6493('0x38')];if(!_0xd5a344[_0x6493('0x3a')][_0x6493('0x41')]('nolimit')){_0x5b3349['limit']=qs[_0x6493('0x23')](_0xd5a344[_0x6493('0x3a')][_0x6493('0x23')]);_0x5b3349[_0x6493('0x21')]=qs[_0x6493('0x21')](_0xd5a344[_0x6493('0x3a')]['offset']);}_0x5b3349[_0x6493('0x42')]=qs[_0x6493('0x43')](_0xd5a344[_0x6493('0x3a')][_0x6493('0x43')]);_0x5b3349[_0x6493('0x44')]=qs[_0x6493('0x3c')](_[_0x6493('0x45')](_0xd5a344['query'],_0xc74d61['filters']),_0x43565c);var _0x970027=[];var _0x341500=squel[_0x6493('0x46')]()[_0x6493('0x47')]('id')[_0x6493('0x47')](_0x6493('0x2d'))[_0x6493('0x47')](_0x6493('0x48'))[_0x6493('0x49')](_0x6493('0x4a'));var _0x48fe52=squel['select']()[_0x6493('0x47')](_0x6493('0x4b'))[_0x6493('0x47')](_0x6493('0x4c'))['field'](_0x6493('0x4d'))[_0x6493('0x49')]('user_has_openchannel_interactions','ui')[_0x6493('0x4e')](_0x6493('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x1dbc91=squel[_0x6493('0x46')]()[_0x6493('0x49')](_0x6493('0x50'),'i')[_0x6493('0x4e')](_0x6493('0x51'),'c',_0x6493('0x52'))[_0x6493('0x4e')](_0x6493('0x4f'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x6493('0x53'),'a',_0x6493('0x54'))['left_join']('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x6493('0x4e')](_0x6493('0x55'),'it',_0x6493('0x56'))[_0x6493('0x4e')](_0x6493('0x4a'),'t',_0x6493('0x57'));var _0x5d3b8c=squel['expr']();var _0x30bb31=[];var _0xd1b95c=squel[_0x6493('0x58')]();var _0x103f80;if(_0xd5a344['query'][_0x6493('0x59')]){_0x103f80=as[_0x6493('0x5a')](_0xd5a344['query'][_0x6493('0x59')]);var _0x275873=_0x103f80[_0x6493('0x5b')];for(var _0x23696e=0x0;_0x23696e<_0x103f80[_0x6493('0x5c')][_0x6493('0x40')];_0x23696e++){var _0x2d464a=_0x103f80[_0x6493('0x5c')][_0x23696e];var _0x18812c='i';var _0x4f303f=_['find'](_0x43565c,[_0x6493('0x2d'),_0x2d464a[_0x6493('0x47')]]);if(!_0x4f303f){switch(_0x2d464a['field']){case _0x6493('0x5d'):if(_0x2d464a[_0x6493('0x5e')]==0x1){_0x1dbc91[_0x6493('0x5f')]('`'+_0x2d464a[_0x6493('0x47')]+_0x6493('0x60'));}else{_0x1dbc91['having']('`'+_0x2d464a[_0x6493('0x47')]+'`\x20>\x200');}break;case'Contact':if(_0x2d464a[_0x6493('0x61')]===_0x6493('0x62')){if(_0x2d464a[_0x6493('0x5e')][_0x6493('0x32')]('\x20')[_0x6493('0x40')]>0x1){_0x5d3b8c[_0x275873](_0x6493('0x63'),qs[_0x6493('0x64')](_0x2d464a[_0x6493('0x5e')]),null);}else{var _0x59218b='%'+_0x2d464a[_0x6493('0x5e')]+'%';_0x5d3b8c[_0x275873](_0x6493('0x65'),_0x59218b,_0x59218b,_0x59218b);}}else{_0x4f303f=_[_0x6493('0x66')](_0x43565c,[_0x6493('0x2d'),'ContactId']);_0x2d464a[_0x6493('0x47')]=_0x6493('0x67');_0xf0e1e4=as['buildExpression'](_0x18812c,_0x4f303f[_0x6493('0x36')],_0x2d464a);_0x5d3b8c[_0x275873](_0xf0e1e4[_0x6493('0x68')],_0xf0e1e4[_0x6493('0x5e')][_0x6493('0x69')],_0xf0e1e4[_0x6493('0x5e')][_0x6493('0x29')]);}break;case _0x6493('0x6a'):var _0x43431e=_0x2d464a[_0x6493('0x5e')][_0x6493('0x32')](',')['map'](function(_0xa6d457){return Number(_0xa6d457);});_0x43431e['forEach'](function(_0x5bc92b){_0xd1b95c['or'](_0x6493('0x6b'),'%,'+_0x5bc92b+',%');});_0x30bb31=_[_0x6493('0x6c')](_0x30bb31,_0x43431e);break;case _0x6493('0x6d'):if(_0x2d464a['operator']===_0x6493('0x62')){_0x5d3b8c[_0x275873](_0x6493('0x6e'),'%'+_0x2d464a[_0x6493('0x5e')]+'%',null);}else{_0x4f303f=_[_0x6493('0x66')](_0x43565c,[_0x6493('0x2d'),_0x6493('0x6f')]);_0x2d464a['field']=_0x6493('0x6f');_0xf0e1e4=as[_0x6493('0x70')](_0x18812c,_0x4f303f[_0x6493('0x36')],_0x2d464a);_0x5d3b8c[_0x275873](_0xf0e1e4[_0x6493('0x68')],_0xf0e1e4[_0x6493('0x5e')][_0x6493('0x69')],_0xf0e1e4['value'][_0x6493('0x29')]);}break;case _0x6493('0x71'):_0xf0e1e4=as[_0x6493('0x70')]('me',null,_0x2d464a);_0x5d3b8c[_0x275873](_0xf0e1e4['text'],_0xf0e1e4[_0x6493('0x5e')][_0x6493('0x69')],_0xf0e1e4['value'][_0x6493('0x29')]);break;}}else{var _0xf0e1e4=as[_0x6493('0x70')](_0x18812c,_0x4f303f[_0x6493('0x36')],_0x2d464a);_0x5d3b8c[_0x275873](_0xf0e1e4[_0x6493('0x68')],_0xf0e1e4[_0x6493('0x5e')]['start'],_0xf0e1e4[_0x6493('0x5e')][_0x6493('0x29')]);}}}else{var _0x492201=_(_0xd5a344['query'])[_0x6493('0x3b')]()[_0x6493('0x39')](function(_0x28313d){return _['some'](_0x43565c,[_0x6493('0x2d'),_0x28313d])?_0x28313d:undefined;})['compact']()[_0x6493('0x5e')]();if(!_[_0x6493('0x72')](_0x492201)){_0x492201[_0x6493('0x73')](function(_0x4085aa){if(_0x4085aa===_0x6493('0x74')){_0x1dbc91[_0x6493('0x44')](_0x6493('0x75'),[][_0x6493('0x76')](_0xd5a344[_0x6493('0x3a')][_0x4085aa]));}else if(_0x4085aa===_0x6493('0x77')){var _0x5389e6=JSON[_0x6493('0x78')](_0xd5a344[_0x6493('0x3a')][_0x4085aa])[_0x6493('0x79')];var _0x368147=JSON[_0x6493('0x78')](_0xd5a344[_0x6493('0x3a')][_0x4085aa])['$lte'];_0x1dbc91[_0x6493('0x44')](_0x6493('0x7a'),_0x5389e6,_0x368147);}else{if(_0xd5a344[_0x6493('0x3a')][_0x4085aa]==='null'){_0x1dbc91[_0x6493('0x44')]('i.'+_0x4085aa+_0x6493('0x7b'));}else{_0x1dbc91[_0x6493('0x44')]('i.'+_0x4085aa+_0x6493('0x7c'),_0xd5a344[_0x6493('0x3a')][_0x4085aa]);}}});}if(_0xd5a344[_0x6493('0x3a')]['read']){if(_0xd5a344[_0x6493('0x3a')]['read']==0x1){_0x1dbc91[_0x6493('0x5f')](_0x6493('0x7d'));}else{_0x1dbc91[_0x6493('0x5f')](_0x6493('0x7e'));}}if(_0xd5a344[_0x6493('0x3a')]['tag']){_0x30bb31=_['isArray'](_0xd5a344['query'][_0x6493('0x7f')])?_0xd5a344['query'][_0x6493('0x7f')]:new Array(_0xd5a344[_0x6493('0x3a')][_0x6493('0x7f')]);_0x30bb31[_0x6493('0x73')](function(_0xa76f45){_0xd1b95c['or'](_0x6493('0x6b'),'%,'+_0xa76f45+',%');});}if(_0xd5a344[_0x6493('0x3a')][_0x6493('0x80')]){var _0x299b12=_0xd5a344[_0x6493('0x3a')]['filter']['replace']('\x5c','\x5c\x5c')[_0x6493('0x81')](/'/g,'\x27\x27');if(qs[_0x6493('0x82')](_0x299b12)){_0x5d3b8c['or']('i.id\x20LIKE\x20?',_0x299b12+'%');}else{_0x5d3b8c['or'](_0x6493('0x83'),qs['getFullTextValue'](_0x299b12))['or'](_0x6493('0x84'),_0x299b12+'%')['or'](_0x6493('0x85'),_0x299b12+'%');}}}_0x1dbc91[_0x6493('0x44')](_0x5d3b8c);_0x1dbc91[_0x6493('0x86')](_0x6493('0x87'));var _0x1bc9d5={'type':db[_0x6493('0x88')][_0x6493('0x89')][_0x6493('0x8a')],'raw':!![]};var _0x12f01b=_0x1dbc91['clone']();_0x12f01b[_0x6493('0x47')]('i.id');_0x12f01b[_0x6493('0x47')](_0x6493('0x8b'),_0x6493('0x5d'));if(_0x5b3349[_0x6493('0x42')]){_0x5b3349[_0x6493('0x42')][_0x6493('0x73')](function(_0x32474d){var _0x51ab5a=_0x32474d[0x0]===_0x6493('0x8c')?_0x32474d[0x0]:'i.'+_0x32474d[0x0];_0x1dbc91[_0x6493('0x42')](_0x51ab5a,_0x32474d[0x1]==='DESC'?![]:!![]);});}if(!_[_0x6493('0x72')](_0x30bb31)){_0x1dbc91[_0x6493('0x5f')](_0xd1b95c);_0x12f01b['where'](_0x6493('0x8d'),_0x30bb31);}BPromise[_0x6493('0x8e')]()[_0x6493('0x28')](function(){if(!_0x103f80){if(_0xd5a344[_0x6493('0x3a')][_0x6493('0x74')])return;_0x12f01b[_0x6493('0x44')](_0x6493('0x8f'));_0x1dbc91[_0x6493('0x44')](_0x6493('0x8f'));return;}if(_0xd5a344[_0x6493('0x90')][_0x6493('0x91')]!==_0x6493('0x92'))return;return _0xd5a344['user'][_0x6493('0x93')]({'attributes':['id'],'raw':!![]})[_0x6493('0x28')](function(_0xe64fcc){if(_[_0x6493('0x72')](_0xe64fcc)){_0x12f01b[_0x6493('0x44')](_0x6493('0x94'));_0x1dbc91[_0x6493('0x44')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x12f01b[_0x6493('0x44')](_0x6493('0x75'),_['map'](_0xe64fcc,'id'));_0x1dbc91[_0x6493('0x44')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x6493('0x39')](_0xe64fcc,'id'));}});})[_0x6493('0x28')](function(){if(_0xd5a344[_0x6493('0x90')][_0x6493('0x91')]==='agent'&&!_0x103f80&&!_0xd5a344[_0x6493('0x3a')][_0x6493('0x74')])return[];return db[_0x6493('0x95')][_0x6493('0x3a')](_0x12f01b[_0x6493('0x96')](),_0x1bc9d5);})[_0x6493('0x28')](function(_0x671df3){_0x2b8eb9[_0x6493('0x24')]=_0x671df3[_0x6493('0x40')];if(_0x2b8eb9[_0x6493('0x24')]===0x0)return[];return db['sequelize']['query'](_0x341500['toString'](),_0x1bc9d5)[_0x6493('0x28')](function(_0x1768c4){_0x970027=_['keyBy'](_0x1768c4,'id');_0x1bc9d5=_['merge'](_0x1bc9d5,{'model':db[_0x6493('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xd5a344[_0x6493('0x3a')][_0x6493('0x3e')]){_0x5b3349[_0x6493('0x3f')][_0x6493('0x73')](function(_0x40f2dc){_0x1dbc91['field']('i.'+_0x40f2dc);});}else{_0x1dbc91[_0x6493('0x47')](_0x6493('0x8b'),'unreadMessages');_0x1dbc91[_0x6493('0x47')](_0x6493('0x97'),_0x6493('0x98'));_0x1dbc91[_0x6493('0x47')](_0x6493('0x99'),'Account.mandatoryDisposition');_0x1dbc91[_0x6493('0x47')]('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');_0x1dbc91[_0x6493('0x47')](_0x6493('0x9a'));_0x1dbc91[_0x6493('0x47')]('c.firstName',_0x6493('0x9b'));_0x1dbc91[_0x6493('0x47')](_0x6493('0x9c'),_0x6493('0x9d'));_0x1dbc91['field'](_0x6493('0x9e'),_0x6493('0x9f'));_0x1dbc91[_0x6493('0x47')](_0x6493('0xa0'),_0x6493('0xa1'));_0x1dbc91['field'](_0x6493('0xa2'),_0x6493('0xa3'));_0x1dbc91['field'](_0x6493('0xa4'),'Contact.fax');_0x1dbc91[_0x6493('0x47')](_0x6493('0xa5'),_0x6493('0xa6'));_0x1dbc91[_0x6493('0x47')](_0x6493('0xa7'),_0x6493('0xa8'));_0x1dbc91['field'](_0x6493('0xa9'),_0x6493('0x30'));}if(_0x5b3349[_0x6493('0x23')])_0x1dbc91['limit'](_0x5b3349[_0x6493('0x23')]);if(_0x5b3349['offset'])_0x1dbc91[_0x6493('0x21')](_0x5b3349[_0x6493('0x21')]);return db[_0x6493('0x95')][_0x6493('0x3a')](_0x1dbc91[_0x6493('0x96')](),_0x1bc9d5);})[_0x6493('0x28')](function(_0x1a8dfe){if(_0x1a8dfe['length']>0x0)_0x48fe52[_0x6493('0x44')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x6493('0x39')](_0x1a8dfe,'id'));return db[_0x6493('0x95')][_0x6493('0x3a')](_0x48fe52[_0x6493('0x96')](),_0x1bc9d5)['then'](function(_0x53d33f){var _0xdbd7ad=_[_0x6493('0xaa')](_0x53d33f,_0x6493('0xab'));var _0x4758cf=[];_0x1a8dfe[_0x6493('0x73')](function(_0x5a073e){_0x4758cf[_0x6493('0x33')](updateOpenchannelInteraction(_0x5a073e,_0x970027,_0xdbd7ad));});return BPromise[_0x6493('0xac')](_0x4758cf);});});})['then'](function(_0x32d275){_0x2b8eb9[_0x6493('0xad')]=_0x32d275;return _0x2b8eb9;})[_0x6493('0x28')](respondWithFilteredResult(_0xb6f443,_0x5b3349))[_0x6493('0xae')](handleError(_0xb6f443,null));};exports['show']=function(_0x1c3688,_0x2ffe05){var _0x2be380={};if(_0x1c3688['query']['type']&&_0x1c3688[_0x6493('0x3a')][_0x6493('0x36')]===_0x6493('0x49')){_0x2be380[_0x6493('0x49')]=_0x1c3688[_0x6493('0xaf')]['id'];}else{_0x2be380['id']=_0x1c3688['params']['id'];}var _0x4eff5f={'raw':![],'where':_0x2be380},_0xd762a={};_0xd762a[_0x6493('0x38')]=_['keys'](db['OpenchannelInteraction'][_0x6493('0x35')]);_0xd762a[_0x6493('0x3a')]=_['keys'](_0x1c3688[_0x6493('0x3a')]);_0xd762a[_0x6493('0x3c')]=_[_0x6493('0x3d')](_0xd762a['model'],_0xd762a[_0x6493('0x3a')]);_0x4eff5f[_0x6493('0x3f')]=_[_0x6493('0x3d')](_0xd762a[_0x6493('0x38')],qs[_0x6493('0x3e')](_0x1c3688[_0x6493('0x3a')]['fields']));_0x4eff5f[_0x6493('0x3f')]=_0x4eff5f[_0x6493('0x3f')][_0x6493('0x40')]?_0x4eff5f[_0x6493('0x3f')]:_0xd762a['model'];if(_0x1c3688[_0x6493('0x3a')][_0x6493('0xb0')]){_0x4eff5f[_0x6493('0xb1')]=[{'all':!![]}];}_0x4eff5f=_[_0x6493('0xb2')]({},_0x4eff5f,_0x1c3688[_0x6493('0xb3')]);return db['OpenchannelInteraction'][_0x6493('0x66')](_0x4eff5f)['then'](handleEntityNotFound(_0x2ffe05,null))[_0x6493('0x28')](respondWithResult(_0x2ffe05,null))[_0x6493('0xae')](handleError(_0x2ffe05,null));};exports[_0x6493('0xb4')]=function(_0x258480,_0x3f4fb3){return db[_0x6493('0x34')][_0x6493('0xb4')](_0x258480['body'],{})[_0x6493('0x28')](respondWithResult(_0x3f4fb3,0xc9))['catch'](handleError(_0x3f4fb3,null));};exports[_0x6493('0xb5')]=function(_0x38ea8d,_0xa8fc32){if(_0x38ea8d[_0x6493('0x71')]['id']){delete _0x38ea8d[_0x6493('0x71')]['id'];}return db[_0x6493('0x34')][_0x6493('0x66')]({'where':{'id':_0x38ea8d[_0x6493('0xaf')]['id']}})[_0x6493('0x28')](handleEntityNotFound(_0xa8fc32,null))['then'](saveUpdates(_0x38ea8d[_0x6493('0x71')],null))[_0x6493('0x28')](respondWithResult(_0xa8fc32,null))[_0x6493('0xae')](handleError(_0xa8fc32,null));};exports[_0x6493('0xb6')]=function(_0x45780d,_0x11bcd8){return db[_0x6493('0x34')][_0x6493('0x66')]({'where':{'id':_0x45780d[_0x6493('0xaf')]['id']}})[_0x6493('0x28')](handleEntityNotFound(_0x11bcd8,null))['then'](removeEntity(_0x11bcd8,null))['catch'](handleError(_0x11bcd8,null));};exports[_0x6493('0xb7')]=function(_0x4cb724,_0x4c5187){return db[_0x6493('0x34')][_0x6493('0xb7')]()[_0x6493('0x28')](respondWithResult(_0x4c5187,null))[_0x6493('0xae')](handleError(_0x4c5187,null));};exports['addMessage']=function(_0x29ce98,_0xd81c9d,_0x4d3506){return db[_0x6493('0xb8')][_0x6493('0x66')]({'where':{'id':_0x29ce98[_0x6493('0xaf')]['id']}})[_0x6493('0x28')](handleEntityNotFound(_0xd81c9d,null))[_0x6493('0x28')](function(_0x444f7d){if(_0x444f7d){return _0x444f7d[_0x6493('0xb9')](_0x29ce98[_0x6493('0x71')][_0x6493('0xba')],_['omit'](_0x29ce98[_0x6493('0x71')],[_0x6493('0xba'),'id'])||{});}})['then'](respondWithResult(_0xd81c9d,null))['catch'](handleError(_0xd81c9d,null));};exports['getMessages']=function(_0x50ea70,_0xdc1689,_0x3e179f){var _0x7e702a={'raw':![],'where':{}};var _0x5cfee2={};var _0x59ec9c={'count':0x0,'rows':[]};return db[_0x6493('0x34')][_0x6493('0xbb')]({'where':{'id':_0x50ea70[_0x6493('0xaf')]['id']}})[_0x6493('0x28')](handleEntityNotFound(_0xdc1689,null))[_0x6493('0x28')](function(_0x11b978){if(_0x11b978){_0x5cfee2['model']=_[_0x6493('0x3b')](db[_0x6493('0xb8')][_0x6493('0x35')]);_0x5cfee2[_0x6493('0x3a')]=_['keys'](_0x50ea70[_0x6493('0x3a')]);_0x5cfee2[_0x6493('0x3c')]=_['intersection'](_0x5cfee2[_0x6493('0x38')],_0x5cfee2['query']);_0x7e702a[_0x6493('0x3f')]=_[_0x6493('0x3d')](_0x5cfee2['model'],qs['fields'](_0x50ea70['query'][_0x6493('0x3e')]));_0x7e702a[_0x6493('0x3f')]=_0x7e702a[_0x6493('0x3f')][_0x6493('0x40')]?_0x7e702a['attributes']:_0x5cfee2[_0x6493('0x38')];if(!_0x50ea70[_0x6493('0x3a')][_0x6493('0x41')](_0x6493('0xbc'))){_0x7e702a[_0x6493('0x23')]=qs[_0x6493('0x23')](_0x50ea70[_0x6493('0x3a')][_0x6493('0x23')]);_0x7e702a[_0x6493('0x21')]=qs['offset'](_0x50ea70['query']['offset']);}_0x7e702a[_0x6493('0x42')]=qs[_0x6493('0x43')](_0x50ea70[_0x6493('0x3a')]['sort']);_0x7e702a[_0x6493('0x44')]=qs[_0x6493('0x3c')](_[_0x6493('0x45')](_0x50ea70[_0x6493('0x3a')],_0x5cfee2['filters']));_0x7e702a[_0x6493('0x44')][_0x6493('0xab')]=_0x11b978['id'];if(_0x50ea70[_0x6493('0x3a')][_0x6493('0x80')]){_0x7e702a[_0x6493('0x44')]=_[_0x6493('0xb2')](_0x7e702a['where'],{'$or':_[_0x6493('0x39')](_0x7e702a[_0x6493('0x3f')],function(_0x430b34){var _0x49505f={};_0x49505f[_0x430b34]={'$like':'%'+_0x50ea70[_0x6493('0x3a')][_0x6493('0x80')]+'%'};return _0x49505f;})});}if(_0x50ea70[_0x6493('0x3a')][_0x6493('0x79')]){var _0x204df7=_0x50ea70[_0x6493('0x3a')][_0x6493('0x79')][_0x6493('0x32')](',');var _0x4eeefc={};_0x4eeefc[_0x204df7[0x0]]={'$gte':moment(_0x204df7[0x1])[_0x6493('0xbd')](_0x6493('0xbe'))};_0x7e702a[_0x6493('0x44')]=_[_0x6493('0xb2')](_0x7e702a[_0x6493('0x44')],_0x4eeefc);}_0x7e702a=_[_0x6493('0xb2')]({},_0x7e702a,_0x50ea70['options']);return db[_0x6493('0xb8')]['count']({'where':_0x7e702a[_0x6493('0x44')]})[_0x6493('0x28')](function(_0x5c2842){_0x59ec9c[_0x6493('0x24')]=_0x5c2842;if(_0x50ea70[_0x6493('0x3a')]['includeAll']){_0x7e702a[_0x6493('0xb1')]=[{'all':!![]}];}return db[_0x6493('0xb8')][_0x6493('0xbf')](_0x7e702a);})[_0x6493('0x28')](function(_0x1a2be8){_0x59ec9c[_0x6493('0xad')]=_0x1a2be8;return _0x59ec9c;});}})['then'](respondWithFilteredResult(_0xdc1689,_0x7e702a))[_0x6493('0xae')](handleError(_0xdc1689,null));};exports['addTags']=function(_0x43dfe4,_0x191abb,_0x4f97b9){return db[_0x6493('0x34')][_0x6493('0x66')]({'where':{'id':_0x43dfe4[_0x6493('0xaf')]['id']}})[_0x6493('0x28')](handleEntityNotFound(_0x191abb,null))[_0x6493('0x28')](function(_0x5e3b4d){if(_0x5e3b4d){return _0x5e3b4d[_0x6493('0xc0')](_0x43dfe4['body'][_0x6493('0xba')],_[_0x6493('0xc1')](_0x43dfe4[_0x6493('0x71')],[_0x6493('0xba'),'id'])||{})[_0x6493('0xc2')](function(){return db['Tag'][_0x6493('0xbf')]({'attributes':['id',_0x6493('0x2d'),_0x6493('0x48')],'where':{'id':_0x43dfe4[_0x6493('0x71')]['ids']}});})[_0x6493('0x28')](function(_0x49441d){socket[_0x6493('0xc3')](_0x6493('0xc4'),{'id':Number(_0x43dfe4[_0x6493('0xaf')]['id']),'tags':_0x49441d||[]});return{'id':Number(_0x43dfe4[_0x6493('0xaf')]['id']),'tags':_0x49441d||[]};});}})[_0x6493('0x28')](respondWithResult(_0x191abb,null))[_0x6493('0xae')](handleError(_0x191abb,null));};exports['removeTags']=function(_0x194dfb,_0x47e228,_0x192945){return db[_0x6493('0x34')][_0x6493('0x66')]({'where':{'id':_0x194dfb['params']['id']}})[_0x6493('0x28')](handleEntityNotFound(_0x47e228,null))['then'](function(_0x1fff0a){if(_0x1fff0a){return _0x1fff0a['removeTags'](_0x194dfb['query']['ids']);}})['then'](respondWithStatusCode(_0x47e228,null))['catch'](handleError(_0x47e228,null));};exports[_0x6493('0xc5')]=function(_0x235985,_0x1b2176){var _0x28fea8=moment()['unix']()[_0x6493('0x96')]();var _0x169111=path['join'](config[_0x6493('0xc6')],_0x6493('0xc7'),'files',_0x6493('0xc8'));var _0x11bcf3=path[_0x6493('0xc9')](config[_0x6493('0xc6')],_0x6493('0xc7'),_0x6493('0xca'),_0x6493('0xcb'));var _0x809c5d=path[_0x6493('0xc9')](_0x169111,_0x28fea8);var _0x4703fa=util['format'](_0x6493('0xcc'),_0x235985[_0x6493('0xaf')]['id'],_0x28fea8);var _0x4163f2=path[_0x6493('0xc9')](_0x169111,_0x4703fa);var _0x359664=[];_0x359664['push']({'model':db[_0x6493('0x6d')],'as':_0x6493('0x6d'),'attributes':['id',_0x6493('0x2f')],'raw':!![]});_0x359664[_0x6493('0x33')]({'model':db[_0x6493('0xcd')],'as':_0x6493('0xce'),'attributes':['id',_0x6493('0xcf'),_0x6493('0xd0')],'raw':!![]});if(_0x235985['query']['attachments']){_0x359664[_0x6493('0x33')]({'model':db[_0x6493('0xd1')],'as':'Attachment','raw':!![]});}var _0x4e0b18=[{'model':db[_0x6493('0xb8')],'as':'Messages','attributes':['id',_0x6493('0x71'),_0x6493('0x77'),_0x6493('0xd2'),'secret','read'],'include':_0x359664}];_0x4e0b18['push']({'model':db[_0x6493('0xd3')],'as':_0x6493('0xd4'),'attributes':['id',_0x6493('0x2d')]});_0x4e0b18['push']({'model':db['User'],'as':_0x6493('0xd5'),'attributes':['id',_0x6493('0x2f')]});return db[_0x6493('0x34')][_0x6493('0x66')]({'where':{'id':_0x235985[_0x6493('0xaf')]['id']},'include':_0x4e0b18})[_0x6493('0x28')](handleEntityNotFound(_0x1b2176,null))[_0x6493('0x28')](function(_0x5619e1){if(_0x5619e1){var _0x54f6cf=_0x5619e1[_0x6493('0xd6')]({'plain':!![]});fs['mkdirSync'](_0x809c5d);var _0x48e95e={'channel':'Openchannel','account':_0x54f6cf['Account'][_0x6493('0x2d')],'agent':_0x54f6cf[_0x6493('0xd5')]?_0x54f6cf[_0x6493('0xd5')][_0x6493('0x2f')]:_0x6493('0xd7'),'createdAt':moment(_0x54f6cf[_0x6493('0x77')])[_0x6493('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6493('0x96')](),'closedAt':_0x54f6cf[_0x6493('0xd8')]?moment(_0x54f6cf[_0x6493('0xd9')])[_0x6493('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6493('0x96')]():'','disposition':_0x54f6cf[_0x6493('0xda')],'visibility':_0x54f6cf[_0x6493('0xdb')]?'Public':_0x6493('0xdc'),'messages':_(_0x54f6cf[_0x6493('0xdd')])[_0x6493('0x80')]({'secret':![]})[_0x6493('0x39')](function(_0x53cadc){if(_0x53cadc['Attachment']){var _0x3bcf4a=path[_0x6493('0xc9')](_0x11bcf3,_0x53cadc[_0x6493('0xd1')][_0x6493('0xde')]);if(fs[_0x6493('0xdf')](_0x3bcf4a)){fs['createReadStream'](_0x3bcf4a)[_0x6493('0xe0')](fs[_0x6493('0xe1')](path[_0x6493('0xc9')](_0x809c5d,_0x53cadc[_0x6493('0xd1')]['basename'])));}}return{'date':moment(_0x53cadc[_0x6493('0x77')])[_0x6493('0xbd')](_0x6493('0xbe'))[_0x6493('0x96')](),'sender':_0x53cadc[_0x6493('0xd2')]===_0x6493('0xe2')?_0x53cadc[_0x6493('0x6d')]?_0x53cadc['User'][_0x6493('0x2f')]:'System':_0x53cadc['Contact'][_0x6493('0xcf')]+(_0x53cadc[_0x6493('0xce')][_0x6493('0xd0')]?'\x20'+_0x53cadc[_0x6493('0xce')][_0x6493('0xd0')]:''),'body':_0x53cadc['Attachment']?_0x53cadc[_0x6493('0xd1')][_0x6493('0xde')]:_0x53cadc[_0x6493('0x71')],'direction':_0x53cadc[_0x6493('0xd2')]===_0x6493('0xe2')?'A':'C','secret':_0x53cadc[_0x6493('0xe3')],'read':_0x53cadc[_0x6493('0xe4')],'attachment':_0x53cadc[_0x6493('0xd1')]};})['value']()};return ejs['renderFile'](path[_0x6493('0xc9')](config[_0x6493('0xc6')],_0x6493('0xc7'),_0x6493('0xe5'),'downloadInteraction.ejs'),{'interaction':_0x48e95e})[_0x6493('0x28')](function(_0x3eb4be){var _0x35e728=path[_0x6493('0xc9')](_0x809c5d,'transcript-'+_0x54f6cf['id']+'-'+_0x28fea8+_0x6493('0xe6'));var _0x753d54={'path':_0x35e728,'channel':_0x6493('0xe7'),'interactionId':_0x54f6cf['id']};return pdf[_0x6493('0xe8')](_0x3eb4be,_0x753d54);})[_0x6493('0x28')](function(){return new BPromise(function(_0x1a8484,_0x374f5f){zipdir(_0x809c5d,{'saveTo':_0x4163f2},function(_0x355c84,_0x144366){if(_0x355c84)return _0x374f5f(_0x355c84);return _0x1a8484(_0x144366);});})[_0x6493('0x28')](function(){return new BPromise(function(_0x38c149,_0x47c29a){rimraf(_0x809c5d,function(_0x485567){if(_0x485567)_0x47c29a(_0x485567);return _0x38c149();});});})['then'](function(){return _0x1b2176['download'](_0x4163f2,_0x4703fa,function(_0x8dbb8e){if(_0x8dbb8e){console['log'](_0x6493('0xe9'),_0x8dbb8e);}else{fs[_0x6493('0xea')](_0x4163f2);}});});});}else{return _0x1b2176[_0x6493('0x2a')](0xc8);}})[_0x6493('0xae')](handleError(_0x1b2176,null));}; \ No newline at end of file +var _0x2f12=['model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','field','color','tools_tags','select','u.id','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','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?','find','buildExpression','text','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','user','getOpenchannelAccounts','isEmpty','i.OpenchannelAccountId\x20IS\x20NULL','OpenchannelAccountId','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.internal','sequelize','groupBy','OpenchannelInteractionId','all','rows','params','includeAll','options','create','update','describe','OpenchannelMessage','addMessage','ids','omit','findOne','sort','format','YYYY-MM-DD\x20HH:mm:ss','include','setTags','spread','findAll','emit','removeTags','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','direction','secret','Account','Owner','Openchannel','closed','closedAt','threadId','Public','existsSync','createWriteStream','out','System','lastName','basename','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','OpenchannelInteraction','rawAttributes','fieldName','type','key'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x2f12,0xaa));var _0x22f1=function(_0x12a0cc,_0x67c53b){_0x12a0cc=_0x12a0cc-0x0;var _0x35cfc0=_0x2f12[_0x12a0cc];return _0x35cfc0;};'use strict';var emlformat=require(_0x22f1('0x0'));var rimraf=require(_0x22f1('0x1'));var zipdir=require(_0x22f1('0x2'));var jsonpatch=require(_0x22f1('0x3'));var rp=require(_0x22f1('0x4'));var moment=require(_0x22f1('0x5'));var BPromise=require(_0x22f1('0x6'));var Mustache=require(_0x22f1('0x7'));var util=require(_0x22f1('0x8'));var path=require(_0x22f1('0x9'));var sox=require(_0x22f1('0xa'));var csv=require('to-csv');var ejs=require(_0x22f1('0xb'));var fs=require('fs');var fs_extra=require(_0x22f1('0xc'));var _=require(_0x22f1('0xd'));var squel=require(_0x22f1('0xe'));var crypto=require('crypto');var jsforce=require(_0x22f1('0xf'));var deskjs=require(_0x22f1('0x10'));var toCsv=require(_0x22f1('0x11'));var querystring=require(_0x22f1('0x12'));var Papa=require('papaparse');var Redis=require(_0x22f1('0x13'));var authService=require(_0x22f1('0x14'));var qs=require(_0x22f1('0x15'));var as=require(_0x22f1('0x16'));var pdf=require(_0x22f1('0x17'));var hardwareService=require(_0x22f1('0x18'));var logger=require('../../config/logger')(_0x22f1('0x19'));var utils=require(_0x22f1('0x1a'));var config=require(_0x22f1('0x1b'));var licenseUtil=require(_0x22f1('0x1c'));var db=require(_0x22f1('0x1d'))['db'];config['redis']=_[_0x22f1('0x1e')](config[_0x22f1('0x1f')],{'host':_0x22f1('0x20'),'port':0x18eb});var socket=require(_0x22f1('0x21'))(new Redis(config[_0x22f1('0x1f')]));require(_0x22f1('0x22'))[_0x22f1('0x23')](socket);function respondWithStatusCode(_0x45b29c,_0x321be7){_0x321be7=_0x321be7||0xcc;return function(_0x9e3735){if(_0x9e3735){return _0x45b29c[_0x22f1('0x24')](_0x321be7);}return _0x45b29c[_0x22f1('0x25')](_0x321be7)['end']();};}function respondWithResult(_0x351b6d,_0x26da0f){_0x26da0f=_0x26da0f||0xc8;return function(_0x64837d){if(_0x64837d){return _0x351b6d[_0x22f1('0x25')](_0x26da0f)[_0x22f1('0x26')](_0x64837d);}};}function respondWithFilteredResult(_0x34aaff,_0x3f4f60){return function(_0x154ec6){if(_0x154ec6){var _0x13e539=typeof _0x3f4f60[_0x22f1('0x27')]===_0x22f1('0x28')&&typeof _0x3f4f60['limit']===_0x22f1('0x28');var _0x1d654f=_0x154ec6[_0x22f1('0x29')];var _0x1dcbf9=_0x13e539?0x0:_0x3f4f60[_0x22f1('0x27')];var _0x17957b=_0x13e539?_0x154ec6[_0x22f1('0x29')]:_0x3f4f60[_0x22f1('0x27')]+_0x3f4f60[_0x22f1('0x2a')];var _0x8ec872;if(_0x17957b>=_0x1d654f){_0x17957b=_0x1d654f;_0x8ec872=0xc8;}else{_0x8ec872=0xce;}_0x34aaff['status'](_0x8ec872);return _0x34aaff['set']('Content-Range',_0x1dcbf9+'-'+_0x17957b+'/'+_0x1d654f)[_0x22f1('0x26')](_0x154ec6);}return null;};}function patchUpdates(_0x50151b){return function(_0x416fe9){try{jsonpatch[_0x22f1('0x2b')](_0x416fe9,_0x50151b,!![]);}catch(_0xe968b9){return BPromise[_0x22f1('0x2c')](_0xe968b9);}return _0x416fe9[_0x22f1('0x2d')]();};}function saveUpdates(_0x4c5b9f,_0x492423){return function(_0x3df258){if(_0x3df258){return _0x3df258['update'](_0x4c5b9f)[_0x22f1('0x2e')](function(_0x108a69){return _0x108a69;});}return null;};}function removeEntity(_0x16e07f,_0x3f93af){return function(_0x553dd8){if(_0x553dd8){return _0x553dd8[_0x22f1('0x2f')]()['then'](function(){_0x16e07f[_0x22f1('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x410e1b,_0xdb471e){return function(_0x4b55bb){if(!_0x4b55bb){_0x410e1b[_0x22f1('0x24')](0x194);}return _0x4b55bb;};}function handleError(_0x24bfb3,_0x1ed1c3){_0x1ed1c3=_0x1ed1c3||0x1f4;return function(_0x445d1c){logger[_0x22f1('0x30')](_0x445d1c[_0x22f1('0x31')]);if(_0x445d1c[_0x22f1('0x32')]){delete _0x445d1c[_0x22f1('0x32')];}_0x24bfb3[_0x22f1('0x25')](_0x1ed1c3)[_0x22f1('0x33')](_0x445d1c);};}function getInteractionUsers(_0x100d83,_0x256e59){return new BPromise(function(_0x7f192c,_0x3ff59f){try{if(_0x256e59[_0x100d83['id']]){_0x100d83[_0x22f1('0x34')]=_[_0x22f1('0x35')](_0x256e59[_0x100d83['id']],function(_0x371399){return{'id':_0x371399['id'],'fullname':_0x371399[_0x22f1('0x36')]};});}}catch(_0x66826e){_0x3ff59f(_0x66826e);}_0x7f192c(_0x100d83);});}function getInteractionTags(_0x24143a,_0x44c698){return new BPromise(function(_0x3a78e8,_0xf7a6a6){try{if(_0x24143a[_0x22f1('0x37')]){_0x24143a[_0x22f1('0x38')]=[];_0x24143a['TagIds'][_0x22f1('0x39')](',')[_0x22f1('0x3a')](function(_0x189d1b){_0x24143a[_0x22f1('0x38')][_0x22f1('0x3b')](_0x44c698[_0x189d1b]);});}delete _0x24143a[_0x22f1('0x37')];}catch(_0x394c69){_0xf7a6a6(_0x394c69);}_0x3a78e8(_0x24143a);});}function updateOpenchannelInteraction(_0x122386,_0x5baced,_0x13a882){return new BPromise(function(_0x5e8f34,_0x56a56b){return getInteractionUsers(_0x122386,_0x13a882)[_0x22f1('0x2e')](function(_0x238f31){return getInteractionTags(_0x238f31,_0x5baced);})['then'](function(_0x12eea3){_0x5e8f34(_0x12eea3);})[_0x22f1('0x3c')](function(_0x5c3ef4){_0x56a56b(_0x5c3ef4);});});}exports['index']=function(_0x431fa9,_0x5201a1){var _0x421489={},_0x1cce64={},_0x234a10={'count':0x0,'rows':[]};var _0x47c638=_[_0x22f1('0x35')](db[_0x22f1('0x3d')][_0x22f1('0x3e')],function(_0x23e98e){return{'name':_0x23e98e[_0x22f1('0x3f')],'type':_0x23e98e[_0x22f1('0x40')][_0x22f1('0x41')]};});_0x1cce64[_0x22f1('0x42')]=_['map'](_0x47c638,_0x22f1('0x32'));_0x1cce64['query']=_[_0x22f1('0x43')](_0x431fa9[_0x22f1('0x44')]);_0x1cce64[_0x22f1('0x45')]=_['intersection'](_0x1cce64[_0x22f1('0x42')],_0x1cce64[_0x22f1('0x44')]);_0x421489['attributes']=_[_0x22f1('0x46')](_0x1cce64['model'],qs[_0x22f1('0x47')](_0x431fa9['query'][_0x22f1('0x47')]));_0x421489[_0x22f1('0x48')]=_0x421489['attributes'][_0x22f1('0x49')]?_0x421489['attributes']:_0x1cce64['model'];if(!_0x431fa9['query'][_0x22f1('0x4a')](_0x22f1('0x4b'))){_0x421489[_0x22f1('0x2a')]=qs[_0x22f1('0x2a')](_0x431fa9['query']['limit']);_0x421489[_0x22f1('0x27')]=qs['offset'](_0x431fa9[_0x22f1('0x44')][_0x22f1('0x27')]);}_0x421489[_0x22f1('0x4c')]=qs['sort'](_0x431fa9['query']['sort']);_0x421489['where']=qs['filters'](_[_0x22f1('0x4d')](_0x431fa9[_0x22f1('0x44')],_0x1cce64[_0x22f1('0x45')]),_0x47c638);var _0x12082a=[];var _0xd31d65=squel['select']()[_0x22f1('0x4e')]('id')[_0x22f1('0x4e')](_0x22f1('0x32'))[_0x22f1('0x4e')](_0x22f1('0x4f'))['from'](_0x22f1('0x50'));var _0x559b85=squel[_0x22f1('0x51')]()['field'](_0x22f1('0x52'))['field']('u.fullname')[_0x22f1('0x4e')](_0x22f1('0x53'))[_0x22f1('0x54')](_0x22f1('0x55'),'ui')[_0x22f1('0x56')]('users','u','u.id\x20=\x20ui.UserId');var _0x1fb13b=squel[_0x22f1('0x51')]()[_0x22f1('0x54')]('openchannel_interactions','i')['left_join'](_0x22f1('0x57'),'c',_0x22f1('0x58'))[_0x22f1('0x56')](_0x22f1('0x59'),'o','o.id\x20=\x20i.UserId')[_0x22f1('0x56')](_0x22f1('0x5a'),'a',_0x22f1('0x5b'))[_0x22f1('0x56')]('openchannel_messages','me',_0x22f1('0x5c'))[_0x22f1('0x56')](_0x22f1('0x5d'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0x22f1('0x50'),'t',_0x22f1('0x5e'));var _0xd63613=squel[_0x22f1('0x5f')]();var _0x234f3f=[];var _0xf3e660=squel[_0x22f1('0x5f')]();var _0x114c37;if(_0x431fa9[_0x22f1('0x44')][_0x22f1('0x60')]){_0x114c37=as[_0x22f1('0x61')](_0x431fa9[_0x22f1('0x44')][_0x22f1('0x60')]);var _0x59c958=_0x114c37['sqlOperator'];for(var _0x168551=0x0;_0x168551<_0x114c37[_0x22f1('0x62')][_0x22f1('0x49')];_0x168551++){var _0x40a537=_0x114c37[_0x22f1('0x62')][_0x168551];var _0x3b766d='i';var _0x55b4ba=_['find'](_0x47c638,[_0x22f1('0x32'),_0x40a537[_0x22f1('0x4e')]]);if(!_0x55b4ba){switch(_0x40a537['field']){case'unreadMessages':if(_0x40a537[_0x22f1('0x63')]==0x1){_0x1fb13b[_0x22f1('0x64')]('`'+_0x40a537[_0x22f1('0x4e')]+_0x22f1('0x65'));}else{_0x1fb13b[_0x22f1('0x64')]('`'+_0x40a537[_0x22f1('0x4e')]+_0x22f1('0x66'));}break;case _0x22f1('0x67'):if(_0x40a537[_0x22f1('0x68')]===_0x22f1('0x69')){if(_0x40a537[_0x22f1('0x63')]['split']('\x20')[_0x22f1('0x49')]>0x1){_0xd63613[_0x59c958](_0x22f1('0x6a'),qs[_0x22f1('0x6b')](_0x40a537['value']),null);}else{var _0x17d3f1='%'+_0x40a537[_0x22f1('0x63')]+'%';_0xd63613[_0x59c958](_0x22f1('0x6c'),_0x17d3f1,_0x17d3f1,_0x17d3f1);}}else{_0x55b4ba=_[_0x22f1('0x6d')](_0x47c638,[_0x22f1('0x32'),'ContactId']);_0x40a537['field']='ContactId';_0x40f85e=as[_0x22f1('0x6e')](_0x3b766d,_0x55b4ba['type'],_0x40a537);_0xd63613[_0x59c958](_0x40f85e[_0x22f1('0x6f')],_0x40f85e[_0x22f1('0x63')]['start'],_0x40f85e[_0x22f1('0x63')][_0x22f1('0x70')]);}break;case _0x22f1('0x71'):var _0x3e3668=_0x40a537['value']['split'](',')[_0x22f1('0x35')](function(_0x55ebc6){return Number(_0x55ebc6);});_0x3e3668[_0x22f1('0x3a')](function(_0x54f8d5){_0xf3e660['or'](_0x22f1('0x72'),'%,'+_0x54f8d5+',%');});_0x234f3f=_[_0x22f1('0x73')](_0x234f3f,_0x3e3668);break;case _0x22f1('0x74'):if(_0x40a537['operator']===_0x22f1('0x69')){_0xd63613[_0x59c958](_0x22f1('0x75'),'%'+_0x40a537[_0x22f1('0x63')]+'%',null);}else{_0x55b4ba=_[_0x22f1('0x6d')](_0x47c638,[_0x22f1('0x32'),_0x22f1('0x76')]);_0x40a537[_0x22f1('0x4e')]=_0x22f1('0x76');_0x40f85e=as['buildExpression'](_0x3b766d,_0x55b4ba[_0x22f1('0x40')],_0x40a537);_0xd63613[_0x59c958](_0x40f85e[_0x22f1('0x6f')],_0x40f85e[_0x22f1('0x63')][_0x22f1('0x77')],_0x40f85e[_0x22f1('0x63')][_0x22f1('0x70')]);}break;case _0x22f1('0x78'):_0x40f85e=as[_0x22f1('0x6e')]('me',null,_0x40a537);_0xd63613[_0x59c958](_0x40f85e['text'],_0x40f85e['value'][_0x22f1('0x77')],_0x40f85e[_0x22f1('0x63')][_0x22f1('0x70')]);break;}}else{var _0x40f85e=as['buildExpression'](_0x3b766d,_0x55b4ba[_0x22f1('0x40')],_0x40a537);_0xd63613[_0x59c958](_0x40f85e[_0x22f1('0x6f')],_0x40f85e[_0x22f1('0x63')]['start'],_0x40f85e[_0x22f1('0x63')][_0x22f1('0x70')]);}}}else{var _0x22363e=_(_0x431fa9[_0x22f1('0x44')])['keys']()['map'](function(_0x5b2546){return _['some'](_0x47c638,['name',_0x5b2546])?_0x5b2546:undefined;})['compact']()[_0x22f1('0x63')]();if(!_['isEmpty'](_0x22363e)){_0x22363e[_0x22f1('0x3a')](function(_0x23a35e){if(_0x23a35e==='OpenchannelAccountId'){_0x1fb13b[_0x22f1('0x79')](_0x22f1('0x7a'),[][_0x22f1('0x7b')](_0x431fa9['query'][_0x23a35e]));}else if(_0x23a35e===_0x22f1('0x7c')){var _0x4f5031=JSON[_0x22f1('0x7d')](_0x431fa9[_0x22f1('0x44')][_0x23a35e])[_0x22f1('0x7e')];var _0x25f827=JSON[_0x22f1('0x7d')](_0x431fa9[_0x22f1('0x44')][_0x23a35e])[_0x22f1('0x7f')];_0x1fb13b[_0x22f1('0x79')](_0x22f1('0x80'),_0x4f5031,_0x25f827);}else{if(_0x431fa9['query'][_0x23a35e]===_0x22f1('0x81')){_0x1fb13b[_0x22f1('0x79')]('i.'+_0x23a35e+_0x22f1('0x82'));}else{_0x1fb13b[_0x22f1('0x79')]('i.'+_0x23a35e+_0x22f1('0x83'),_0x431fa9[_0x22f1('0x44')][_0x23a35e]);}}});}if(_0x431fa9[_0x22f1('0x44')]['read']){if(_0x431fa9['query'][_0x22f1('0x84')]==0x1){_0x1fb13b['having'](_0x22f1('0x85'));}else{_0x1fb13b[_0x22f1('0x64')](_0x22f1('0x86'));}}if(_0x431fa9[_0x22f1('0x44')]['tag']){_0x234f3f=_['isArray'](_0x431fa9[_0x22f1('0x44')][_0x22f1('0x87')])?_0x431fa9[_0x22f1('0x44')][_0x22f1('0x87')]:new Array(_0x431fa9[_0x22f1('0x44')][_0x22f1('0x87')]);_0x234f3f['forEach'](function(_0xd149a8){_0xf3e660['or'](_0x22f1('0x72'),'%,'+_0xd149a8+',%');});}if(_0x431fa9[_0x22f1('0x44')][_0x22f1('0x88')]){var _0x2c921e=_0x431fa9[_0x22f1('0x44')][_0x22f1('0x88')][_0x22f1('0x89')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x22f1('0x8a')](_0x2c921e)){_0xd63613['or'](_0x22f1('0x8b'),_0x2c921e+'%');}else{_0xd63613['or'](_0x22f1('0x8c'),qs[_0x22f1('0x6b')](_0x2c921e))['or'](_0x22f1('0x8d'),_0x2c921e+'%')['or'](_0x22f1('0x8e'),_0x2c921e+'%');}}}_0x1fb13b[_0x22f1('0x79')](_0xd63613);_0x1fb13b[_0x22f1('0x8f')](_0x22f1('0x90'));var _0x2a2533={'type':db[_0x22f1('0x91')][_0x22f1('0x92')][_0x22f1('0x93')],'raw':!![]};var _0x279961=_0x1fb13b[_0x22f1('0x94')]();_0x279961[_0x22f1('0x4e')](_0x22f1('0x90'));_0x279961['field'](_0x22f1('0x95'),_0x22f1('0x96'));if(_0x421489[_0x22f1('0x4c')]){_0x421489['order'][_0x22f1('0x3a')](function(_0x326c26){var _0x1f80c7=_0x326c26[0x0]===_0x22f1('0x97')?_0x326c26[0x0]:'i.'+_0x326c26[0x0];_0x1fb13b[_0x22f1('0x4c')](_0x1f80c7,_0x326c26[0x1]===_0x22f1('0x98')?![]:!![]);});}if(!_['isEmpty'](_0x234f3f)){_0x1fb13b['having'](_0xf3e660);_0x279961['where'](_0x22f1('0x99'),_0x234f3f);}BPromise['resolve']()[_0x22f1('0x2e')](function(){if(!_0x114c37){if(_0x431fa9['query']['OpenchannelAccountId'])return;_0x279961[_0x22f1('0x79')](_0x22f1('0x9a'));_0x1fb13b['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x431fa9['user']['role']!==_0x22f1('0x9b'))return;return _0x431fa9[_0x22f1('0x9c')][_0x22f1('0x9d')]({'attributes':['id'],'raw':!![]})[_0x22f1('0x2e')](function(_0x519bfd){if(_[_0x22f1('0x9e')](_0x519bfd)){_0x279961[_0x22f1('0x79')](_0x22f1('0x9f'));_0x1fb13b[_0x22f1('0x79')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x279961[_0x22f1('0x79')](_0x22f1('0x7a'),_[_0x22f1('0x35')](_0x519bfd,'id'));_0x1fb13b['where'](_0x22f1('0x7a'),_[_0x22f1('0x35')](_0x519bfd,'id'));}});})[_0x22f1('0x2e')](function(){if(_0x431fa9['user']['role']==='agent'&&!_0x114c37&&!_0x431fa9['query'][_0x22f1('0xa0')])return[];return db['sequelize']['query'](_0x279961[_0x22f1('0xa1')](),_0x2a2533);})[_0x22f1('0x2e')](function(_0x566b92){_0x234a10[_0x22f1('0x29')]=_0x566b92[_0x22f1('0x49')];if(_0x234a10[_0x22f1('0x29')]===0x0)return[];return db['sequelize'][_0x22f1('0x44')](_0xd31d65[_0x22f1('0xa1')](),_0x2a2533)[_0x22f1('0x2e')](function(_0x4273c6){_0x12082a=_[_0x22f1('0xa2')](_0x4273c6,'id');_0x2a2533=_[_0x22f1('0xa3')](_0x2a2533,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x431fa9['query'][_0x22f1('0x47')]){_0x421489['attributes'][_0x22f1('0x3a')](function(_0x19d8bf){_0x1fb13b[_0x22f1('0x4e')]('i.'+_0x19d8bf);});}else{_0x1fb13b[_0x22f1('0x4e')](_0x22f1('0x95'),_0x22f1('0x96'));_0x1fb13b[_0x22f1('0x4e')](_0x22f1('0xa4'),_0x22f1('0xa5'));_0x1fb13b['field'](_0x22f1('0xa6'),_0x22f1('0xa7'));_0x1fb13b[_0x22f1('0x4e')](_0x22f1('0xa8'),_0x22f1('0x97'));_0x1fb13b[_0x22f1('0x4e')](_0x22f1('0xa9'));_0x1fb13b[_0x22f1('0x4e')]('c.firstName',_0x22f1('0xaa'));_0x1fb13b[_0x22f1('0x4e')](_0x22f1('0xab'),'Contact.lastName');_0x1fb13b['field']('c.email','Contact.email');_0x1fb13b[_0x22f1('0x4e')]('c.phone',_0x22f1('0xac'));_0x1fb13b[_0x22f1('0x4e')]('c.mobile',_0x22f1('0xad'));_0x1fb13b[_0x22f1('0x4e')](_0x22f1('0xae'),_0x22f1('0xaf'));_0x1fb13b['field']('o.fullname','Owner.fullname');_0x1fb13b['field']('o.internal',_0x22f1('0xb0'));_0x1fb13b[_0x22f1('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x22f1('0x37'));}if(_0x421489[_0x22f1('0x2a')])_0x1fb13b[_0x22f1('0x2a')](_0x421489[_0x22f1('0x2a')]);if(_0x421489[_0x22f1('0x27')])_0x1fb13b[_0x22f1('0x27')](_0x421489[_0x22f1('0x27')]);return db[_0x22f1('0xb1')][_0x22f1('0x44')](_0x1fb13b[_0x22f1('0xa1')](),_0x2a2533);})['then'](function(_0x5de005){if(_0x5de005['length']>0x0)_0x559b85[_0x22f1('0x79')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x22f1('0x35')](_0x5de005,'id'));return db['sequelize'][_0x22f1('0x44')](_0x559b85[_0x22f1('0xa1')](),_0x2a2533)['then'](function(_0x2c2d7f){var _0x57411d=_[_0x22f1('0xb2')](_0x2c2d7f,_0x22f1('0xb3'));var _0x1a6cdd=[];_0x5de005[_0x22f1('0x3a')](function(_0x7e76f){_0x1a6cdd[_0x22f1('0x3b')](updateOpenchannelInteraction(_0x7e76f,_0x12082a,_0x57411d));});return BPromise[_0x22f1('0xb4')](_0x1a6cdd);});});})['then'](function(_0x5a5db9){_0x234a10[_0x22f1('0xb5')]=_0x5a5db9;return _0x234a10;})['then'](respondWithFilteredResult(_0x5201a1,_0x421489))[_0x22f1('0x3c')](handleError(_0x5201a1,null));};exports['show']=function(_0x237324,_0x3e7dc2){var _0x5b5d86={};if(_0x237324[_0x22f1('0x44')][_0x22f1('0x40')]&&_0x237324[_0x22f1('0x44')]['type']===_0x22f1('0x54')){_0x5b5d86[_0x22f1('0x54')]=_0x237324[_0x22f1('0xb6')]['id'];}else{_0x5b5d86['id']=_0x237324[_0x22f1('0xb6')]['id'];}var _0x512887={'raw':![],'where':_0x5b5d86},_0x1d78f2={};_0x1d78f2[_0x22f1('0x42')]=_['keys'](db[_0x22f1('0x3d')]['rawAttributes']);_0x1d78f2[_0x22f1('0x44')]=_[_0x22f1('0x43')](_0x237324['query']);_0x1d78f2[_0x22f1('0x45')]=_[_0x22f1('0x46')](_0x1d78f2['model'],_0x1d78f2[_0x22f1('0x44')]);_0x512887['attributes']=_[_0x22f1('0x46')](_0x1d78f2[_0x22f1('0x42')],qs[_0x22f1('0x47')](_0x237324[_0x22f1('0x44')][_0x22f1('0x47')]));_0x512887['attributes']=_0x512887[_0x22f1('0x48')][_0x22f1('0x49')]?_0x512887[_0x22f1('0x48')]:_0x1d78f2['model'];if(_0x237324['query'][_0x22f1('0xb7')]){_0x512887['include']=[{'all':!![]}];}_0x512887=_['merge']({},_0x512887,_0x237324[_0x22f1('0xb8')]);return db[_0x22f1('0x3d')][_0x22f1('0x6d')](_0x512887)[_0x22f1('0x2e')](handleEntityNotFound(_0x3e7dc2,null))[_0x22f1('0x2e')](respondWithResult(_0x3e7dc2,null))[_0x22f1('0x3c')](handleError(_0x3e7dc2,null));};exports[_0x22f1('0xb9')]=function(_0x4e1ae5,_0xfb54a9){return db[_0x22f1('0x3d')][_0x22f1('0xb9')](_0x4e1ae5[_0x22f1('0x78')],{})[_0x22f1('0x2e')](respondWithResult(_0xfb54a9,0xc9))[_0x22f1('0x3c')](handleError(_0xfb54a9,null));};exports[_0x22f1('0xba')]=function(_0x367cb1,_0x4bd16e){if(_0x367cb1['body']['id']){delete _0x367cb1[_0x22f1('0x78')]['id'];}return db[_0x22f1('0x3d')][_0x22f1('0x6d')]({'where':{'id':_0x367cb1[_0x22f1('0xb6')]['id']}})[_0x22f1('0x2e')](handleEntityNotFound(_0x4bd16e,null))['then'](saveUpdates(_0x367cb1[_0x22f1('0x78')],null))[_0x22f1('0x2e')](respondWithResult(_0x4bd16e,null))[_0x22f1('0x3c')](handleError(_0x4bd16e,null));};exports[_0x22f1('0x2f')]=function(_0x171eaa,_0x462894){return db[_0x22f1('0x3d')]['find']({'where':{'id':_0x171eaa[_0x22f1('0xb6')]['id']}})[_0x22f1('0x2e')](handleEntityNotFound(_0x462894,null))['then'](removeEntity(_0x462894,null))[_0x22f1('0x3c')](handleError(_0x462894,null));};exports['describe']=function(_0x44c3bd,_0x50b110){return db[_0x22f1('0x3d')][_0x22f1('0xbb')]()['then'](respondWithResult(_0x50b110,null))['catch'](handleError(_0x50b110,null));};exports['addMessage']=function(_0x41492b,_0x196d2c,_0xb7164){return db[_0x22f1('0xbc')][_0x22f1('0x6d')]({'where':{'id':_0x41492b[_0x22f1('0xb6')]['id']}})[_0x22f1('0x2e')](handleEntityNotFound(_0x196d2c,null))[_0x22f1('0x2e')](function(_0x5ca1ed){if(_0x5ca1ed){return _0x5ca1ed[_0x22f1('0xbd')](_0x41492b['body'][_0x22f1('0xbe')],_[_0x22f1('0xbf')](_0x41492b['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x196d2c,null))[_0x22f1('0x3c')](handleError(_0x196d2c,null));};exports['getMessages']=function(_0x2b5c49,_0x22e56d,_0xba034e){var _0x5bf40c={'raw':![],'where':{}};var _0x58c08e={};var _0x3e11df={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x22f1('0xc0')]({'where':{'id':_0x2b5c49[_0x22f1('0xb6')]['id']}})[_0x22f1('0x2e')](handleEntityNotFound(_0x22e56d,null))[_0x22f1('0x2e')](function(_0x3e9311){if(_0x3e9311){_0x58c08e[_0x22f1('0x42')]=_[_0x22f1('0x43')](db[_0x22f1('0xbc')][_0x22f1('0x3e')]);_0x58c08e['query']=_[_0x22f1('0x43')](_0x2b5c49['query']);_0x58c08e[_0x22f1('0x45')]=_[_0x22f1('0x46')](_0x58c08e[_0x22f1('0x42')],_0x58c08e[_0x22f1('0x44')]);_0x5bf40c[_0x22f1('0x48')]=_[_0x22f1('0x46')](_0x58c08e['model'],qs[_0x22f1('0x47')](_0x2b5c49[_0x22f1('0x44')][_0x22f1('0x47')]));_0x5bf40c[_0x22f1('0x48')]=_0x5bf40c[_0x22f1('0x48')][_0x22f1('0x49')]?_0x5bf40c[_0x22f1('0x48')]:_0x58c08e['model'];if(!_0x2b5c49[_0x22f1('0x44')]['hasOwnProperty'](_0x22f1('0x4b'))){_0x5bf40c[_0x22f1('0x2a')]=qs[_0x22f1('0x2a')](_0x2b5c49[_0x22f1('0x44')][_0x22f1('0x2a')]);_0x5bf40c[_0x22f1('0x27')]=qs[_0x22f1('0x27')](_0x2b5c49[_0x22f1('0x44')]['offset']);}_0x5bf40c[_0x22f1('0x4c')]=qs[_0x22f1('0xc1')](_0x2b5c49[_0x22f1('0x44')][_0x22f1('0xc1')]);_0x5bf40c[_0x22f1('0x79')]=qs[_0x22f1('0x45')](_[_0x22f1('0x4d')](_0x2b5c49[_0x22f1('0x44')],_0x58c08e[_0x22f1('0x45')]));_0x5bf40c[_0x22f1('0x79')][_0x22f1('0xb3')]=_0x3e9311['id'];if(_0x2b5c49[_0x22f1('0x44')]['filter']){_0x5bf40c[_0x22f1('0x79')]=_[_0x22f1('0xa3')](_0x5bf40c[_0x22f1('0x79')],{'$or':_[_0x22f1('0x35')](_0x5bf40c['attributes'],function(_0x4111b4){var _0x2659f6={};_0x2659f6[_0x4111b4]={'$like':'%'+_0x2b5c49[_0x22f1('0x44')][_0x22f1('0x88')]+'%'};return _0x2659f6;})});}if(_0x2b5c49['query'][_0x22f1('0x7e')]){var _0x21b774=_0x2b5c49[_0x22f1('0x44')][_0x22f1('0x7e')][_0x22f1('0x39')](',');var _0x5d2ad7={};_0x5d2ad7[_0x21b774[0x0]]={'$gte':moment(_0x21b774[0x1])[_0x22f1('0xc2')](_0x22f1('0xc3'))};_0x5bf40c['where']=_['merge'](_0x5bf40c[_0x22f1('0x79')],_0x5d2ad7);}_0x5bf40c=_[_0x22f1('0xa3')]({},_0x5bf40c,_0x2b5c49[_0x22f1('0xb8')]);return db['OpenchannelMessage'][_0x22f1('0x29')]({'where':_0x5bf40c['where']})[_0x22f1('0x2e')](function(_0x301cb8){_0x3e11df[_0x22f1('0x29')]=_0x301cb8;if(_0x2b5c49['query'][_0x22f1('0xb7')]){_0x5bf40c[_0x22f1('0xc4')]=[{'all':!![]}];}return db[_0x22f1('0xbc')]['findAll'](_0x5bf40c);})[_0x22f1('0x2e')](function(_0x169a98){_0x3e11df[_0x22f1('0xb5')]=_0x169a98;return _0x3e11df;});}})[_0x22f1('0x2e')](respondWithFilteredResult(_0x22e56d,_0x5bf40c))[_0x22f1('0x3c')](handleError(_0x22e56d,null));};exports['addTags']=function(_0x308874,_0x47aa27,_0x399665){return db['OpenchannelInteraction'][_0x22f1('0x6d')]({'where':{'id':_0x308874[_0x22f1('0xb6')]['id']}})[_0x22f1('0x2e')](handleEntityNotFound(_0x47aa27,null))[_0x22f1('0x2e')](function(_0x1f28e4){if(_0x1f28e4){return _0x1f28e4[_0x22f1('0xc5')](_0x308874[_0x22f1('0x78')][_0x22f1('0xbe')],_[_0x22f1('0xbf')](_0x308874[_0x22f1('0x78')],[_0x22f1('0xbe'),'id'])||{})[_0x22f1('0xc6')](function(){return db[_0x22f1('0x71')][_0x22f1('0xc7')]({'attributes':['id',_0x22f1('0x32'),_0x22f1('0x4f')],'where':{'id':_0x308874[_0x22f1('0x78')][_0x22f1('0xbe')]}});})[_0x22f1('0x2e')](function(_0x2feee9){socket[_0x22f1('0xc8')]('openchannelInteractionTags:save',{'id':Number(_0x308874[_0x22f1('0xb6')]['id']),'tags':_0x2feee9||[]});return{'id':Number(_0x308874['params']['id']),'tags':_0x2feee9||[]};});}})[_0x22f1('0x2e')](respondWithResult(_0x47aa27,null))[_0x22f1('0x3c')](handleError(_0x47aa27,null));};exports[_0x22f1('0xc9')]=function(_0x1733e4,_0x3f15c5,_0x2aa2b8){return db['OpenchannelInteraction'][_0x22f1('0x6d')]({'where':{'id':_0x1733e4[_0x22f1('0xb6')]['id']}})[_0x22f1('0x2e')](handleEntityNotFound(_0x3f15c5,null))[_0x22f1('0x2e')](function(_0x4f3727){if(_0x4f3727){return _0x4f3727['removeTags'](_0x1733e4[_0x22f1('0x44')][_0x22f1('0xbe')]);}})[_0x22f1('0x2e')](respondWithStatusCode(_0x3f15c5,null))[_0x22f1('0x3c')](handleError(_0x3f15c5,null));};exports['download']=function(_0x2dc00a,_0xf86051){var _0x5ea8cc=moment()[_0x22f1('0xca')]()[_0x22f1('0xa1')]();var _0x45078e=path[_0x22f1('0xcb')](config['root'],_0x22f1('0xcc'),_0x22f1('0xcd'),_0x22f1('0xce'));var _0x5d3b7a=path[_0x22f1('0xcb')](config[_0x22f1('0xcf')],_0x22f1('0xcc'),_0x22f1('0xcd'),_0x22f1('0xd0'));var _0x474285=path['join'](_0x45078e,_0x5ea8cc);var _0x3c4ddb=util[_0x22f1('0xc2')](_0x22f1('0xd1'),_0x2dc00a[_0x22f1('0xb6')]['id'],_0x5ea8cc);var _0x389371=path[_0x22f1('0xcb')](_0x45078e,_0x3c4ddb);var _0x35be48=[];_0x35be48[_0x22f1('0x3b')]({'model':db[_0x22f1('0x74')],'as':_0x22f1('0x74'),'attributes':['id',_0x22f1('0x36')],'raw':!![]});_0x35be48[_0x22f1('0x3b')]({'model':db[_0x22f1('0xd2')],'as':_0x22f1('0x67'),'attributes':['id',_0x22f1('0xd3'),'lastName'],'raw':!![]});if(_0x2dc00a[_0x22f1('0x44')][_0x22f1('0xd0')]){_0x35be48[_0x22f1('0x3b')]({'model':db['Attachment'],'as':_0x22f1('0xd4'),'raw':!![]});}var _0xa0635f=[{'model':db[_0x22f1('0xbc')],'as':_0x22f1('0xd5'),'attributes':['id',_0x22f1('0x78'),'createdAt',_0x22f1('0xd6'),_0x22f1('0xd7'),_0x22f1('0x84')],'include':_0x35be48}];_0xa0635f[_0x22f1('0x3b')]({'model':db['OpenchannelAccount'],'as':_0x22f1('0xd8'),'attributes':['id','name']});_0xa0635f[_0x22f1('0x3b')]({'model':db[_0x22f1('0x74')],'as':_0x22f1('0xd9'),'attributes':['id',_0x22f1('0x36')]});return db[_0x22f1('0x3d')][_0x22f1('0x6d')]({'where':{'id':_0x2dc00a[_0x22f1('0xb6')]['id']},'include':_0xa0635f})[_0x22f1('0x2e')](handleEntityNotFound(_0xf86051,null))[_0x22f1('0x2e')](function(_0x2f9257){if(_0x2f9257){var _0x25576a=_0x2f9257['get']({'plain':!![]});fs['mkdirSync'](_0x474285);var _0x4091d4={'channel':_0x22f1('0xda'),'account':_0x25576a[_0x22f1('0xd8')][_0x22f1('0x32')],'agent':_0x25576a[_0x22f1('0xd9')]?_0x25576a[_0x22f1('0xd9')][_0x22f1('0x36')]:'N.A.','createdAt':moment(_0x25576a[_0x22f1('0x7c')])[_0x22f1('0xc2')](_0x22f1('0xc3'))[_0x22f1('0xa1')](),'closedAt':_0x25576a[_0x22f1('0xdb')]?moment(_0x25576a[_0x22f1('0xdc')])['format'](_0x22f1('0xc3'))[_0x22f1('0xa1')]():'','disposition':_0x25576a['disposition'],'visibility':_0x25576a[_0x22f1('0xdd')]?_0x22f1('0xde'):'Private','messages':_(_0x25576a[_0x22f1('0xd5')])[_0x22f1('0x88')]({'secret':![]})[_0x22f1('0x35')](function(_0x1d0bcf){if(_0x1d0bcf[_0x22f1('0xd4')]){var _0x19a453=path[_0x22f1('0xcb')](_0x5d3b7a,_0x1d0bcf['Attachment']['basename']);if(fs[_0x22f1('0xdf')](_0x19a453)){fs['createReadStream'](_0x19a453)['pipe'](fs[_0x22f1('0xe0')](path[_0x22f1('0xcb')](_0x474285,_0x1d0bcf[_0x22f1('0xd4')]['basename'])));}}return{'date':moment(_0x1d0bcf[_0x22f1('0x7c')])[_0x22f1('0xc2')](_0x22f1('0xc3'))['toString'](),'sender':_0x1d0bcf[_0x22f1('0xd6')]===_0x22f1('0xe1')?_0x1d0bcf['User']?_0x1d0bcf[_0x22f1('0x74')]['fullname']:_0x22f1('0xe2'):_0x1d0bcf[_0x22f1('0x67')][_0x22f1('0xd3')]+(_0x1d0bcf['Contact'][_0x22f1('0xe3')]?'\x20'+_0x1d0bcf['Contact'][_0x22f1('0xe3')]:''),'body':_0x1d0bcf['Attachment']?_0x1d0bcf[_0x22f1('0xd4')][_0x22f1('0xe4')]:_0x1d0bcf[_0x22f1('0x78')],'direction':_0x1d0bcf[_0x22f1('0xd6')]===_0x22f1('0xe1')?'A':'C','secret':_0x1d0bcf[_0x22f1('0xd7')],'read':_0x1d0bcf[_0x22f1('0x84')],'attachment':_0x1d0bcf[_0x22f1('0xd4')]};})['value']()};return ejs[_0x22f1('0xe5')](path[_0x22f1('0xcb')](config['root'],_0x22f1('0xcc'),_0x22f1('0xe6'),_0x22f1('0xe7')),{'interaction':_0x4091d4})[_0x22f1('0x2e')](function(_0x1f58a7){var _0x47ff8a=path[_0x22f1('0xcb')](_0x474285,_0x22f1('0xe8')+_0x25576a['id']+'-'+_0x5ea8cc+'.pdf');var _0x14d732={'path':_0x47ff8a,'channel':_0x22f1('0xda'),'interactionId':_0x25576a['id']};return pdf[_0x22f1('0xe9')](_0x1f58a7,_0x14d732);})[_0x22f1('0x2e')](function(){return new BPromise(function(_0x11fbf5,_0x159fd1){zipdir(_0x474285,{'saveTo':_0x389371},function(_0x501f75,_0x479ca9){if(_0x501f75)return _0x159fd1(_0x501f75);return _0x11fbf5(_0x479ca9);});})[_0x22f1('0x2e')](function(){return new BPromise(function(_0x3d5c49,_0x1c5db5){rimraf(_0x474285,function(_0x319b3a){if(_0x319b3a)_0x1c5db5(_0x319b3a);return _0x3d5c49();});});})[_0x22f1('0x2e')](function(){return _0xf86051[_0x22f1('0xea')](_0x389371,_0x3c4ddb,function(_0x4a8c0d){if(_0x4a8c0d){console['log']('err',_0x4a8c0d);}else{fs[_0x22f1('0xeb')](_0x389371);}});});});}else{return _0xf86051['sendStatus'](0xc8);}})[_0x22f1('0x3c')](handleError(_0xf86051,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 67069cc..f1a13ff 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 _0x976f=['remove','then','setDataValue','findAll','unreadMessages','length','emit','catch','hook','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x37b6c4,_0x4a522e){var _0x54cfcc=function(_0x5dff62){while(--_0x5dff62){_0x37b6c4['push'](_0x37b6c4['shift']());}};_0x54cfcc(++_0x4a522e);}(_0x976f,0x122));var _0xf976=function(_0x1f40a3,_0x1508ac){_0x1f40a3=_0x1f40a3-0x0;var _0x1a99ed=_0x976f[_0x1f40a3];return _0x1a99ed;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xf976('0x0'))['db'][_0xf976('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xf976('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf976('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf976('0x4')};function emitEvent(_0x84c794){return function(_0x2f06e3,_0x263dae,_0xdbb036){_0x2f06e3['getUsers']({'attributes':['id'],'raw':!![]})[_0xf976('0x5')](function(_0x4076d2){_0x2f06e3[_0xf976('0x6')]('Users',_0x4076d2['map'](function(_0x2f826b){return{'id':_0x2f826b['id']};}));return OpenchannelMessage[_0xf976('0x7')]({'where':{'OpenchannelInteractionId':_0x2f06e3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf976('0x5')](function(_0x2dd519){_0x2f06e3[_0xf976('0x6')](_0xf976('0x8'),_0x2dd519[_0xf976('0x9')]);OpenchannelInteractionEvents[_0xf976('0xa')](_0x84c794+':'+_0x2f06e3['id'],_0x2f06e3);OpenchannelInteractionEvents[_0xf976('0xa')](_0x84c794,_0x2f06e3);_0xdbb036(null);})[_0xf976('0xb')](_0xdbb036(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xf976('0xc')](e,emitEvent(event));}}module[_0xf976('0xd')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x69d9=['then','setDataValue','Users','length','emit','catch','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update'];(function(_0x591171,_0x510bf7){var _0x1a47bf=function(_0x5b43b3){while(--_0x5b43b3){_0x591171['push'](_0x591171['shift']());}};_0x1a47bf(++_0x510bf7);}(_0x69d9,0x10c));var _0x969d=function(_0x4a0f16,_0x21ba18){_0x4a0f16=_0x4a0f16-0x0;var _0x45d653=_0x69d9[_0x4a0f16];return _0x45d653;};'use strict';var EventEmitter=require(_0x969d('0x0'));var OpenchannelInteraction=require(_0x969d('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x969d('0x1'))['db'][_0x969d('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x969d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x969d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x30380b){return function(_0xf7353e,_0x24ea0a,_0x1f2f2a){_0xf7353e['getUsers']({'attributes':['id'],'raw':!![]})[_0x969d('0x5')](function(_0x5de8f2){_0xf7353e[_0x969d('0x6')](_0x969d('0x7'),_0x5de8f2['map'](function(_0x110081){return{'id':_0x110081['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0xf7353e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x969d('0x5')](function(_0x421898){_0xf7353e[_0x969d('0x6')]('unreadMessages',_0x421898[_0x969d('0x8')]);OpenchannelInteractionEvents[_0x969d('0x9')](_0x30380b+':'+_0xf7353e['id'],_0xf7353e);OpenchannelInteractionEvents[_0x969d('0x9')](_0x30380b,_0xf7353e);_0x1f2f2a(null);})[_0x969d('0xa')](_0x1f2f2a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x969d('0xb')](e,emitEvent(event));}}module[_0x969d('0xc')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index a451acc..6d4d601 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 _0x2006=['openchannel_interactions','utf8mb4','changed','closed','closedAt','format','lodash','util','api','moment','request-promise','../../config/environment','exports','OpenchannelInteraction'];(function(_0x50fd77,_0x4f0246){var _0x28f142=function(_0x506a94){while(--_0x506a94){_0x50fd77['push'](_0x50fd77['shift']());}};_0x28f142(++_0x4f0246);}(_0x2006,0x156));var _0x6200=function(_0x224c90,_0x1dcfe9){_0x224c90=_0x224c90-0x0;var _0x31bc1b=_0x2006[_0x224c90];return _0x31bc1b;};'use strict';var _=require(_0x6200('0x0'));var util=require(_0x6200('0x1'));var logger=require('../../config/logger')(_0x6200('0x2'));var moment=require(_0x6200('0x3'));var BPromise=require('bluebird');var rp=require(_0x6200('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6200('0x5'));var attributes=require('./openchannelInteraction.attributes');module[_0x6200('0x6')]=function(_0x21a734,_0x43745a){return _0x21a734['define'](_0x6200('0x7'),attributes,{'tableName':_0x6200('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6200('0x9'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x30d3b9,_0x23afa5,_0x4ea301){if(_0x30d3b9[_0x6200('0xa')](_0x6200('0xb'))){_0x30d3b9[_0x6200('0xc')]=moment()[_0x6200('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4ea301(null,_0x30d3b9);}}});}; \ No newline at end of file +var _0xa3db=['./openchannelInteraction.attributes','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x23295b,_0x3dab66){var _0x359acb=function(_0x5d9968){while(--_0x5d9968){_0x23295b['push'](_0x23295b['shift']());}};_0x359acb(++_0x3dab66);}(_0xa3db,0x183));var _0xba3d=function(_0x597d6b,_0x4bc394){_0x597d6b=_0x597d6b-0x0;var _0x25de74=_0xa3db[_0x597d6b];return _0x25de74;};'use strict';var _=require(_0xba3d('0x0'));var util=require(_0xba3d('0x1'));var logger=require(_0xba3d('0x2'))(_0xba3d('0x3'));var moment=require(_0xba3d('0x4'));var BPromise=require(_0xba3d('0x5'));var rp=require(_0xba3d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba3d('0x7'));var config=require(_0xba3d('0x8'));var attributes=require(_0xba3d('0x9'));module['exports']=function(_0x3f13ba,_0x3fc87e){return _0x3f13ba[_0xba3d('0xa')](_0xba3d('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xba3d('0xc'),'collate':_0xba3d('0xd'),'hooks':{'beforeUpdate':function(_0x81f675,_0xcfdd19,_0x45b7ac){if(_0x81f675[_0xba3d('0xe')](_0xba3d('0xf'))){_0x81f675[_0xba3d('0x10')]=moment()[_0xba3d('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x45b7ac(null,_0x81f675);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 879bd7d..043016c 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 _0xa731=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','OpenchannelInteraction','update','options','where','attributes','limit','UpdateOpenchannelInteraction','find','addTags','body','ids','AddTags','lodash','moment','bluebird','randomstring','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent'];(function(_0x31ddba,_0x28ec26){var _0x3f014c=function(_0x24aa10){while(--_0x24aa10){_0x31ddba['push'](_0x31ddba['shift']());}};_0x3f014c(++_0x28ec26);}(_0xa731,0x1dd));var _0x1a73=function(_0x2ef922,_0x326e3d){_0x2ef922=_0x2ef922-0x0;var _0x461327=_0xa731[_0x2ef922];return _0x461327;};'use strict';var _=require(_0x1a73('0x0'));var util=require('util');var moment=require(_0x1a73('0x1'));var BPromise=require(_0x1a73('0x2'));var rs=require(_0x1a73('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1a73('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1a73('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1a73('0x6')][_0x1a73('0x7')]({'port':0x232a});config[_0x1a73('0x8')]=_[_0x1a73('0x9')](config[_0x1a73('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a73('0xa'))(new Redis(config[_0x1a73('0x8')]));require(_0x1a73('0xb'))[_0x1a73('0xc')](socket);function respondWithRpcPromise(_0x3e7b88,_0x489076,_0x4ae72e){return new BPromise(function(_0x3c287c,_0x4896f3){return client[_0x1a73('0xd')](_0x3e7b88,_0x4ae72e)[_0x1a73('0xe')](function(_0x1b0e64){logger[_0x1a73('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x489076,_0x1a73('0x10'));logger[_0x1a73('0x11')](_0x1a73('0x12'),_0x489076,_0x1a73('0x10'),JSON[_0x1a73('0x13')](_0x1b0e64));if(_0x1b0e64[_0x1a73('0x14')]){if(_0x1b0e64['error'][_0x1a73('0x15')]===0x1f4){logger[_0x1a73('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x489076,_0x1b0e64[_0x1a73('0x14')]['message']);return _0x4896f3(_0x1b0e64['error'][_0x1a73('0x16')]);}logger[_0x1a73('0x14')](_0x1a73('0x17'),_0x489076,_0x1b0e64['error'][_0x1a73('0x16')]);return _0x3c287c(_0x1b0e64['error'][_0x1a73('0x16')]);}else{logger[_0x1a73('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x489076,'request\x20sent');_0x3c287c(_0x1b0e64[_0x1a73('0x18')]['message']);}})[_0x1a73('0x19')](function(_0x86f632){logger[_0x1a73('0x14')](_0x1a73('0x17'),_0x489076,_0x86f632);_0x4896f3(_0x86f632);});});}exports['UpdateOpenchannelInteraction']=function(_0x4b3ce7){var _0x5b6cfa=this;return new Promise(function(_0x3a4a6f,_0x34ea59){return db[_0x1a73('0x1a')][_0x1a73('0x1b')](_0x4b3ce7['body'],{'raw':_0x4b3ce7[_0x1a73('0x1c')]?_0x4b3ce7[_0x1a73('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b3ce7[_0x1a73('0x1c')]?_0x4b3ce7[_0x1a73('0x1c')][_0x1a73('0x1d')]||null:null,'attributes':_0x4b3ce7[_0x1a73('0x1c')]?_0x4b3ce7[_0x1a73('0x1c')][_0x1a73('0x1e')]||null:null,'limit':_0x4b3ce7[_0x1a73('0x1c')]?_0x4b3ce7[_0x1a73('0x1c')][_0x1a73('0x1f')]||null:null})[_0x1a73('0xe')](function(_0x58b993){logger[_0x1a73('0xf')](_0x1a73('0x20'),_0x4b3ce7);logger[_0x1a73('0x11')](_0x1a73('0x20'),_0x4b3ce7,JSON[_0x1a73('0x13')](_0x58b993));_0x3a4a6f(_0x58b993);})[_0x1a73('0x19')](function(_0x5c7c4a){logger[_0x1a73('0x14')](_0x1a73('0x20'),_0x5c7c4a[_0x1a73('0x16')],_0x4b3ce7);_0x34ea59(_0x5b6cfa['error'](0x1f4,_0x5c7c4a[_0x1a73('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x2ae5fc){return new Promise(function(_0x3edc65,_0xa7ef91){return db[_0x1a73('0x1a')][_0x1a73('0x21')]({'where':_0x2ae5fc[_0x1a73('0x1c')]?_0x2ae5fc[_0x1a73('0x1c')]['where']||null:null})[_0x1a73('0xe')](function(_0x11e723){if(_0x11e723){return _0x11e723[_0x1a73('0x22')](_0x2ae5fc[_0x1a73('0x23')][_0x1a73('0x24')],_['omit'](_0x2ae5fc[_0x1a73('0x23')],['ids','id'])||{});}})['spread'](function(_0x3eae73){logger[_0x1a73('0xf')](_0x1a73('0x25'),_0x2ae5fc);logger[_0x1a73('0x11')](_0x1a73('0x25'),_0x2ae5fc,JSON[_0x1a73('0x13')](_0x3eae73));_0x3edc65(_0x3eae73);})[_0x1a73('0x19')](function(_0x3c1d33){logger[_0x1a73('0x14')](_0x1a73('0x25'),_0x3c1d33[_0x1a73('0x16')],_0x2ae5fc);_0xa7ef91(_this[_0x1a73('0x14')](0x1f4,_0x3c1d33[_0x1a73('0x16')]));});});}; \ No newline at end of file +var _0x6314=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateOpenchannelInteraction','update','body','options','raw','where','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','spread','AddTags','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6314,0x1ce));var _0x4631=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x6314[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x4631('0x0'));var util=require(_0x4631('0x1'));var moment=require(_0x4631('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4631('0x3'));var db=require(_0x4631('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4631('0x5'));var config=require(_0x4631('0x6'));var jayson=require(_0x4631('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x4631('0x8')](config[_0x4631('0x9')],{'host':_0x4631('0xa'),'port':0x18eb});var socket=require(_0x4631('0xb'))(new Redis(config[_0x4631('0x9')]));require(_0x4631('0xc'))[_0x4631('0xd')](socket);function respondWithRpcPromise(_0x4f2d45,_0x104372,_0x1eeae9){return new BPromise(function(_0x1df441,_0x460b02){return client[_0x4631('0xe')](_0x4f2d45,_0x1eeae9)[_0x4631('0xf')](function(_0x3dc853){logger['info'](_0x4631('0x10'),_0x104372,_0x4631('0x11'));logger[_0x4631('0x12')](_0x4631('0x13'),_0x104372,_0x4631('0x11'),JSON[_0x4631('0x14')](_0x3dc853));if(_0x3dc853[_0x4631('0x15')]){if(_0x3dc853[_0x4631('0x15')][_0x4631('0x16')]===0x1f4){logger[_0x4631('0x15')](_0x4631('0x10'),_0x104372,_0x3dc853[_0x4631('0x15')]['message']);return _0x460b02(_0x3dc853['error'][_0x4631('0x17')]);}logger[_0x4631('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x104372,_0x3dc853['error'][_0x4631('0x17')]);return _0x1df441(_0x3dc853[_0x4631('0x15')][_0x4631('0x17')]);}else{logger[_0x4631('0x18')](_0x4631('0x10'),_0x104372,_0x4631('0x11'));_0x1df441(_0x3dc853[_0x4631('0x19')][_0x4631('0x17')]);}})['catch'](function(_0x88d437){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x104372,_0x88d437);_0x460b02(_0x88d437);});});}exports[_0x4631('0x1a')]=function(_0x12475f){var _0x453630=this;return new Promise(function(_0x2dfd5e,_0x184f1a){return db['OpenchannelInteraction'][_0x4631('0x1b')](_0x12475f[_0x4631('0x1c')],{'raw':_0x12475f[_0x4631('0x1d')]?_0x12475f['options'][_0x4631('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12475f[_0x4631('0x1d')]?_0x12475f[_0x4631('0x1d')][_0x4631('0x1f')]||null:null,'attributes':_0x12475f['options']?_0x12475f[_0x4631('0x1d')]['attributes']||null:null,'limit':_0x12475f[_0x4631('0x1d')]?_0x12475f[_0x4631('0x1d')]['limit']||null:null})[_0x4631('0xf')](function(_0x1423c9){logger['info'](_0x4631('0x1a'),_0x12475f);logger['debug'](_0x4631('0x1a'),_0x12475f,JSON[_0x4631('0x14')](_0x1423c9));_0x2dfd5e(_0x1423c9);})['catch'](function(_0x3ca2de){logger[_0x4631('0x15')](_0x4631('0x1a'),_0x3ca2de['message'],_0x12475f);_0x184f1a(_0x453630[_0x4631('0x15')](0x1f4,_0x3ca2de['message']));});});};exports[_0x4631('0x20')]=function(_0x5223e9){return new Promise(function(_0x1cf00f,_0x588eac){return db[_0x4631('0x21')][_0x4631('0x22')]({'where':_0x5223e9[_0x4631('0x1d')]?_0x5223e9['options'][_0x4631('0x1f')]||null:null})[_0x4631('0xf')](function(_0x174f3a){if(_0x174f3a){return _0x174f3a[_0x4631('0x23')](_0x5223e9['body'][_0x4631('0x24')],_['omit'](_0x5223e9[_0x4631('0x1c')],['ids','id'])||{});}})[_0x4631('0x25')](function(_0x467b9d){logger[_0x4631('0x18')](_0x4631('0x26'),_0x5223e9);logger[_0x4631('0x12')]('AddTags',_0x5223e9,JSON['stringify'](_0x467b9d));_0x1cf00f(_0x467b9d);})[_0x4631('0x27')](function(_0x4053fc){logger[_0x4631('0x15')](_0x4631('0x26'),_0x4053fc[_0x4631('0x17')],_0x5223e9);_0x588eac(_this[_0x4631('0x15')](0x1f4,_0x4053fc['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index be329f6..bee67e3 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 _0x761a=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','removeListener','register','length'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x761a,0x179));var _0xa761=function(_0x310003,_0x22016a){_0x310003=_0x310003-0x0;var _0x536745=_0x761a[_0x310003];return _0x536745;};'use strict';var OpenchannelInteractionEvents=require(_0xa761('0x0'));var events=[_0xa761('0x1'),_0xa761('0x2'),_0xa761('0x3')];function createListener(_0x3f2788,_0x4cabf8){return function(_0x581b77){_0x4cabf8['emit'](_0x3f2788,_0x581b77);};}function removeListener(_0x5b9771,_0x38b51a){return function(){OpenchannelInteractionEvents[_0xa761('0x4')](_0x5b9771,_0x38b51a);};}exports[_0xa761('0x5')]=function(_0x14d6af){for(var _0x524f69=0x0,_0x46bd4c=events[_0xa761('0x6')];_0x524f69<_0x46bd4c;_0x524f69++){var _0x4416f6=events[_0x524f69];var _0x1820c5=createListener(_0xa761('0x7')+_0x4416f6,_0x14d6af);OpenchannelInteractionEvents['on'](_0x4416f6,_0x1820c5);}}; \ No newline at end of file +var _0x740b=['update','removeListener','register','openchannelInteraction:','save'];(function(_0xa5791f,_0x20cbcf){var _0xea1de5=function(_0x406401){while(--_0x406401){_0xa5791f['push'](_0xa5791f['shift']());}};_0xea1de5(++_0x20cbcf);}(_0x740b,0xf4));var _0xb740=function(_0x16e3dd,_0x4c6dd4){_0x16e3dd=_0x16e3dd-0x0;var _0x4f963d=_0x740b[_0x16e3dd];return _0x4f963d;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xb740('0x0'),'remove',_0xb740('0x1')];function createListener(_0x3b8acc,_0x53b25b){return function(_0x396f90){_0x53b25b['emit'](_0x3b8acc,_0x396f90);};}function removeListener(_0x3c4d62,_0x13501c){return function(){OpenchannelInteractionEvents[_0xb740('0x2')](_0x3c4d62,_0x13501c);};}exports[_0xb740('0x3')]=function(_0x19928f){for(var _0x2bdeea=0x0,_0x56e9f7=events['length'];_0x2bdeea<_0x56e9f7;_0x2bdeea++){var _0x4cbb2c=events[_0x2bdeea];var _0x1f1f50=createListener(_0xb740('0x4')+_0x4cbb2c,_0x19928f);OpenchannelInteractionEvents['on'](_0x4cbb2c,_0x1f1f50);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 23b2c5f..c25ee93 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(_0x1ca882,_0x14f6e6){var _0x357d7e=function(_0x41bb23){while(--_0x41bb23){_0x1ca882['push'](_0x1ca882['shift']());}};_0x357d7e(++_0x14f6e6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./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 _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0x2e5c9d,_0x6a1bbc){_0x2e5c9d=_0x2e5c9d-0x0;var _0x2a9b98=_0x70e0[_0x2e5c9d];return _0x2a9b98;};'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');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);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 6193711..666d629 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 _0xd5fc=['sequelize','BOOLEAN','ENUM','out','DATE','TEXT'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd5fc,0xae));var _0xcd5f=function(_0x2f5c3a,_0x5e944c){_0x2f5c3a=_0x2f5c3a-0x0;var _0x59471f=_0xd5fc[_0x2f5c3a];return _0x59471f;};'use strict';var Sequelize=require(_0xcd5f('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xcd5f('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xcd5f('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcd5f('0x2')]('in',_0xcd5f('0x3')),'defaultValue':_0xcd5f('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xcd5f('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xcd5f('0x5')]}}; \ No newline at end of file +var _0x6a95=['ENUM','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x2b1c48,_0x4292d6){var _0x13bac3=function(_0xbb5219){while(--_0xbb5219){_0x2b1c48['push'](_0x2b1c48['shift']());}};_0x13bac3(++_0x4292d6);}(_0x6a95,0x1db));var _0x56a9=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x6a95[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'body':{'type':Sequelize[_0x56a9('0x2')](_0x56a9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x56a9('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x56a9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x56a9('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x56a9('0x6')]},'providerName':{'type':Sequelize[_0x56a9('0x7')]},'providerResponse':{'type':Sequelize[_0x56a9('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 349ddb2..a6c45b9 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 _0xed5f=['./openchannelMessage.socket','jayson/promise','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','save','update','destroy','stack','name','index','map','OpenchannelMessage','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','params','length','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','RejectMessage','rejectMessage','email','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0x31e3e4,_0x5c795a){var _0x4ee39e=function(_0x21ee01){while(--_0x21ee01){_0x31e3e4['push'](_0x31e3e4['shift']());}};_0x4ee39e(++_0x5c795a);}(_0xed5f,0x1de));var _0xfed5=function(_0x4e217d,_0x220229){_0x4e217d=_0x4e217d-0x0;var _0x1274a4=_0xed5f[_0x4e217d];return _0x1274a4;};'use strict';var emlformat=require(_0xfed5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfed5('0x1'));var jsonpatch=require(_0xfed5('0x2'));var rp=require(_0xfed5('0x3'));var moment=require(_0xfed5('0x4'));var BPromise=require(_0xfed5('0x5'));var Mustache=require('mustache');var util=require(_0xfed5('0x6'));var path=require(_0xfed5('0x7'));var sox=require(_0xfed5('0x8'));var csv=require(_0xfed5('0x9'));var ejs=require(_0xfed5('0xa'));var fs=require('fs');var fs_extra=require(_0xfed5('0xb'));var _=require(_0xfed5('0xc'));var squel=require(_0xfed5('0xd'));var crypto=require(_0xfed5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfed5('0xf'));var toCsv=require(_0xfed5('0x9'));var querystring=require(_0xfed5('0x10'));var Papa=require('papaparse');var Redis=require(_0xfed5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfed5('0x12'));var as=require(_0xfed5('0x13'));var hardwareService=require(_0xfed5('0x14'));var logger=require(_0xfed5('0x15'))(_0xfed5('0x16'));var utils=require(_0xfed5('0x17'));var config=require(_0xfed5('0x18'));var licenseUtil=require(_0xfed5('0x19'));var db=require(_0xfed5('0x1a'))['db'];config[_0xfed5('0x1b')]=_[_0xfed5('0x1c')](config[_0xfed5('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xfed5('0x1d'))(new Redis(config[_0xfed5('0x1b')]));require(_0xfed5('0x1e'))['register'](socket);var jayson=require(_0xfed5('0x1f'));var client=jayson['client'][_0xfed5('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x572c20,_0x2f18d2,_0x3c83cf,_0x5bc1d2){return new BPromise(function(_0x4bae21,_0x56351f){var _0x6366a=_0x5bc1d2||client;return _0x6366a[_0xfed5('0x21')](_0x572c20,_0x3c83cf)[_0xfed5('0x22')](function(_0x32b9af){logger['info'](_0xfed5('0x23'),_0x2f18d2,_0xfed5('0x24'));logger[_0xfed5('0x25')](_0xfed5('0x26'),_0x2f18d2,_0xfed5('0x24'),JSON[_0xfed5('0x27')](_0x32b9af));if(_0x32b9af[_0xfed5('0x28')]){if(_0x32b9af[_0xfed5('0x28')][_0xfed5('0x29')]===0x1f4){logger['error'](_0xfed5('0x23'),_0x2f18d2,_0x32b9af[_0xfed5('0x28')][_0xfed5('0x2a')]);return _0x56351f(_0x32b9af['error']['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x2f18d2,_0x32b9af[_0xfed5('0x28')][_0xfed5('0x2a')]);return _0x4bae21(_0x32b9af[_0xfed5('0x28')][_0xfed5('0x2a')]);}else{logger[_0xfed5('0x2b')]('OpenchannelMessage,\x20%s,\x20%s',_0x2f18d2,'request\x20sent');_0x4bae21(_0x32b9af['result'][_0xfed5('0x2a')]);}})[_0xfed5('0x2c')](function(_0x1ceaae){logger[_0xfed5('0x28')](_0xfed5('0x23'),_0x2f18d2,_0x1ceaae);_0x56351f(_0x1ceaae);});});}function respondWithStatusCode(_0x196a7c,_0x20d453){_0x20d453=_0x20d453||0xcc;return function(_0x5d4766){if(_0x5d4766){return _0x196a7c[_0xfed5('0x2d')](_0x20d453);}return _0x196a7c[_0xfed5('0x2e')](_0x20d453)[_0xfed5('0x2f')]();};}function respondWithResult(_0x2666db,_0x9ac6d7){_0x9ac6d7=_0x9ac6d7||0xc8;return function(_0x4fd57f){if(_0x4fd57f){return _0x2666db[_0xfed5('0x2e')](_0x9ac6d7)[_0xfed5('0x30')](_0x4fd57f);}};}function respondWithFilteredResult(_0x2c7613,_0x37280f){return function(_0x150a3b){if(_0x150a3b){var _0x2b4669=typeof _0x37280f[_0xfed5('0x31')]===_0xfed5('0x32')&&typeof _0x37280f[_0xfed5('0x33')]===_0xfed5('0x32');var _0x226aa6=_0x150a3b[_0xfed5('0x34')];var _0x4e8add=_0x2b4669?0x0:_0x37280f[_0xfed5('0x31')];var _0x2fb584=_0x2b4669?_0x150a3b[_0xfed5('0x34')]:_0x37280f[_0xfed5('0x31')]+_0x37280f['limit'];var _0x33656d;if(_0x2fb584>=_0x226aa6){_0x2fb584=_0x226aa6;_0x33656d=0xc8;}else{_0x33656d=0xce;}_0x2c7613['status'](_0x33656d);return _0x2c7613['set']('Content-Range',_0x4e8add+'-'+_0x2fb584+'/'+_0x226aa6)[_0xfed5('0x30')](_0x150a3b);}return null;};}function patchUpdates(_0x417350){return function(_0xca4172){try{jsonpatch['apply'](_0xca4172,_0x417350,!![]);}catch(_0x373f24){return BPromise['reject'](_0x373f24);}return _0xca4172[_0xfed5('0x35')]();};}function saveUpdates(_0x48fac8,_0x3a769d){return function(_0x4aa835){if(_0x4aa835){return _0x4aa835[_0xfed5('0x36')](_0x48fac8)[_0xfed5('0x22')](function(_0x4184a2){return _0x4184a2;});}return null;};}function removeEntity(_0x54ecce,_0xb99f87){return function(_0x3b9851){if(_0x3b9851){return _0x3b9851[_0xfed5('0x37')]()[_0xfed5('0x22')](function(){_0x54ecce[_0xfed5('0x2e')](0xcc)[_0xfed5('0x2f')]();});}};}function handleEntityNotFound(_0x2b5cee,_0x2d53a7){return function(_0x556bb9){if(!_0x556bb9){_0x2b5cee[_0xfed5('0x2d')](0x194);}return _0x556bb9;};}function handleError(_0x384d6d,_0x34799d){_0x34799d=_0x34799d||0x1f4;return function(_0x2ea8f7){logger[_0xfed5('0x28')](_0x2ea8f7[_0xfed5('0x38')]);if(_0x2ea8f7[_0xfed5('0x39')]){delete _0x2ea8f7[_0xfed5('0x39')];}_0x384d6d['status'](_0x34799d)['send'](_0x2ea8f7);};}exports[_0xfed5('0x3a')]=function(_0x27879e,_0x5a19d7){var _0xb3affe={},_0x2ea18c={},_0x2f7bdf={'count':0x0,'rows':[]};var _0x2e8966=_[_0xfed5('0x3b')](db[_0xfed5('0x3c')]['rawAttributes'],function(_0x5c40ea){return{'name':_0x5c40ea[_0xfed5('0x3d')],'type':_0x5c40ea[_0xfed5('0x3e')][_0xfed5('0x3f')]};});_0x2ea18c[_0xfed5('0x40')]=_[_0xfed5('0x3b')](_0x2e8966,_0xfed5('0x39'));_0x2ea18c[_0xfed5('0x41')]=_['keys'](_0x27879e[_0xfed5('0x41')]);_0x2ea18c['filters']=_[_0xfed5('0x42')](_0x2ea18c[_0xfed5('0x40')],_0x2ea18c[_0xfed5('0x41')]);_0xb3affe[_0xfed5('0x43')]=_[_0xfed5('0x42')](_0x2ea18c[_0xfed5('0x40')],qs[_0xfed5('0x44')](_0x27879e[_0xfed5('0x41')][_0xfed5('0x44')]));_0xb3affe[_0xfed5('0x43')]=_0xb3affe[_0xfed5('0x43')]['length']?_0xb3affe[_0xfed5('0x43')]:_0x2ea18c[_0xfed5('0x40')];if(!_0x27879e[_0xfed5('0x41')]['hasOwnProperty'](_0xfed5('0x45'))){_0xb3affe['limit']=qs[_0xfed5('0x33')](_0x27879e['query'][_0xfed5('0x33')]);_0xb3affe[_0xfed5('0x31')]=qs[_0xfed5('0x31')](_0x27879e[_0xfed5('0x41')][_0xfed5('0x31')]);}_0xb3affe[_0xfed5('0x46')]=qs[_0xfed5('0x47')](_0x27879e[_0xfed5('0x41')][_0xfed5('0x47')]);_0xb3affe['where']=qs[_0xfed5('0x48')](_[_0xfed5('0x49')](_0x27879e[_0xfed5('0x41')],_0x2ea18c[_0xfed5('0x48')]),_0x2e8966);if(_0x27879e['query'][_0xfed5('0x4a')]){_0xb3affe[_0xfed5('0x4b')]=_[_0xfed5('0x4c')](_0xb3affe['where'],{'$or':_['map'](_0x2e8966,function(_0x23f0c7){if(_0x23f0c7[_0xfed5('0x3e')]!==_0xfed5('0x4d')){var _0x40e77b={};_0x40e77b[_0x23f0c7[_0xfed5('0x39')]]={'$like':'%'+_0x27879e[_0xfed5('0x41')]['filter']+'%'};return _0x40e77b;}})});}_0xb3affe=_[_0xfed5('0x4c')]({},_0xb3affe,_0x27879e[_0xfed5('0x4e')]);var _0x2667e3={'where':_0xb3affe[_0xfed5('0x4b')]};return db[_0xfed5('0x3c')][_0xfed5('0x34')](_0x2667e3)['then'](function(_0x4ad64f){_0x2f7bdf[_0xfed5('0x34')]=_0x4ad64f;if(_0x27879e['query'][_0xfed5('0x4f')]){_0xb3affe[_0xfed5('0x50')]=[{'all':!![]}];}return db[_0xfed5('0x3c')][_0xfed5('0x51')](_0xb3affe);})[_0xfed5('0x22')](function(_0x1954cd){_0x2f7bdf['rows']=_0x1954cd;return _0x2f7bdf;})[_0xfed5('0x22')](respondWithFilteredResult(_0x5a19d7,_0xb3affe))['catch'](handleError(_0x5a19d7,null));};exports['show']=function(_0x52dc30,_0x1ed90d){var _0x4fea94={'raw':!![],'where':{'id':_0x52dc30[_0xfed5('0x52')]['id']}},_0x307dda={};_0x307dda['model']=_['keys'](db[_0xfed5('0x3c')]['rawAttributes']);_0x307dda['query']=_['keys'](_0x52dc30['query']);_0x307dda[_0xfed5('0x48')]=_[_0xfed5('0x42')](_0x307dda[_0xfed5('0x40')],_0x307dda[_0xfed5('0x41')]);_0x4fea94['attributes']=_[_0xfed5('0x42')](_0x307dda[_0xfed5('0x40')],qs['fields'](_0x52dc30[_0xfed5('0x41')][_0xfed5('0x44')]));_0x4fea94[_0xfed5('0x43')]=_0x4fea94[_0xfed5('0x43')][_0xfed5('0x53')]?_0x4fea94[_0xfed5('0x43')]:_0x307dda[_0xfed5('0x40')];if(_0x52dc30[_0xfed5('0x41')]['includeAll']){_0x4fea94[_0xfed5('0x50')]=[{'all':!![]}];}_0x4fea94=_['merge']({},_0x4fea94,_0x52dc30[_0xfed5('0x4e')]);return db[_0xfed5('0x3c')][_0xfed5('0x54')](_0x4fea94)['then'](handleEntityNotFound(_0x1ed90d,null))[_0xfed5('0x22')](respondWithResult(_0x1ed90d,null))[_0xfed5('0x2c')](handleError(_0x1ed90d,null));};exports[_0xfed5('0x55')]=function(_0x44f0e5,_0x58fde6){return db[_0xfed5('0x3c')][_0xfed5('0x55')](_0x44f0e5['body'],{})[_0xfed5('0x22')](respondWithResult(_0x58fde6,0xc9))[_0xfed5('0x2c')](handleError(_0x58fde6,null));};exports[_0xfed5('0x36')]=function(_0x545da6,_0x13a5f2){if(_0x545da6[_0xfed5('0x56')]['id']){delete _0x545da6['body']['id'];}return db[_0xfed5('0x3c')]['find']({'where':{'id':_0x545da6['params']['id']}})[_0xfed5('0x22')](handleEntityNotFound(_0x13a5f2,null))[_0xfed5('0x22')](saveUpdates(_0x545da6['body'],null))['then'](respondWithResult(_0x13a5f2,null))[_0xfed5('0x2c')](handleError(_0x13a5f2,null));};exports[_0xfed5('0x37')]=function(_0x27dc9f,_0x5a837f){return db['OpenchannelMessage'][_0xfed5('0x54')]({'where':{'id':_0x27dc9f[_0xfed5('0x52')]['id']}})['then'](handleEntityNotFound(_0x5a837f,null))[_0xfed5('0x22')](removeEntity(_0x5a837f,null))[_0xfed5('0x2c')](handleError(_0x5a837f,null));};exports[_0xfed5('0x57')]=function(_0x6e84fa,_0x4e60f7){return db[_0xfed5('0x3c')][_0xfed5('0x57')]()[_0xfed5('0x22')](respondWithResult(_0x4e60f7,null))[_0xfed5('0x2c')](handleError(_0x4e60f7,null));};var interaction_log=require('../../config/logger')(_0xfed5('0x58'));exports[_0xfed5('0x59')]=function(_0x2904a6,_0x307d7c,_0x1f4ef1){var _0x15c25c={'agent':{},'channel':_0xfed5('0x5a')};if(_0x2904a6['body']['id']){delete _0x2904a6['body']['id'];}_0x2904a6['body'][_0xfed5('0x5b')]=!![];_0x2904a6['body'][_0xfed5('0x5c')]=moment()[_0xfed5('0x5d')](_0xfed5('0x5e'));_0x2904a6[_0xfed5('0x56')][_0xfed5('0x5f')]=_0x2904a6['body'][_0xfed5('0x5f')]||_0x2904a6['user']['id'];_0x15c25c[_0xfed5('0x60')]['id']=_0x2904a6['body'][_0xfed5('0x5f')];return db['OpenchannelMessage'][_0xfed5('0x54')]({'where':{'id':_0x2904a6['params']['id'],'UserId':null}})[_0xfed5('0x22')](handleEntityNotFound(_0x307d7c,null))[_0xfed5('0x22')](saveUpdates(_0x2904a6['body'],null))['then'](function(_0x5ad093){if(_0x5ad093){_0x15c25c[_0xfed5('0x2a')]=_0x5ad093['get']({'plain':!![]});return db[_0xfed5('0x61')][_0xfed5('0x54')]({'where':{'id':_0x5ad093[_0xfed5('0x62')]}});}return null;})[_0xfed5('0x22')](handleEntityNotFound(_0x307d7c,null))[_0xfed5('0x22')](function(_0x1f0f56){if(_0x1f0f56){return _0x1f0f56[_0xfed5('0x36')]({'UserId':_0x2904a6[_0xfed5('0x56')][_0xfed5('0x5f')],'read1stAt':_[_0xfed5('0x63')](_0x1f0f56[_0xfed5('0x64')])?moment()[_0xfed5('0x5d')](_0xfed5('0x5e')):undefined});}return null;})['then'](function(_0x395874){if(_0x395874){_0x15c25c[_0xfed5('0x65')]=_0x395874[_0xfed5('0x66')]({'plain':!![]});interaction_log[_0xfed5('0x2b')](_0xfed5('0x67'),_0x2904a6[_0xfed5('0x68')]['id'],_0x2904a6[_0xfed5('0x68')][_0xfed5('0x39')],_0x2904a6[_0xfed5('0x68')][_0xfed5('0x69')],_0x15c25c[_0xfed5('0x65')]['id'],_0x2904a6[_0xfed5('0x56')]?JSON[_0xfed5('0x27')](_0x2904a6['body']):_0xfed5('0x6a'));return respondWithRpcPromise(_0xfed5('0x6b'),'acceptMessage',_0x15c25c);}return null;})[_0xfed5('0x22')](function(_0x2c0aa5){var _0x45420f=_0xfed5('0x6c')+_0x2c0aa5[_0xfed5('0x2a')][_0xfed5('0x6d')];return db[_0xfed5('0x6e')][_0xfed5('0x41')](_0x45420f,{'type':db[_0xfed5('0x6f')][_0xfed5('0x70')][_0xfed5('0x71')],'raw':!![]})[_0xfed5('0x22')](function(_0x421b17){return _0x421b17;});})[_0xfed5('0x22')](function(_0x52553f){if(_0x52553f){_0x15c25c[_0xfed5('0x2a')][_0xfed5('0x72')]=_0x52553f[0x0];if(!_0x2904a6[_0xfed5('0x56')][_0xfed5('0x5f')])return;return db[_0xfed5('0x73')][_0xfed5('0x54')]({'where':{'id':_0x2904a6[_0xfed5('0x56')]['UserId'],'role':'agent'},'attributes':['id',_0xfed5('0x39'),_0xfed5('0x74'),'email',_0xfed5('0x75')],'raw':!![]});}return null;})[_0xfed5('0x22')](function(_0x10fa40){if(!_0x10fa40)return null;_0x15c25c[_0xfed5('0x2a')][_0xfed5('0x60')]=_0x10fa40;return _0x15c25c;})['then'](function(_0xca3945){if(_0xca3945){if(_0x2904a6['body'][_0xfed5('0x76')]){_0x15c25c[_0xfed5('0x2a')]['interface']=util['format'](_0xfed5('0x77'),_0x2904a6[_0xfed5('0x68')][_0xfed5('0x39')]);_0x15c25c[_0xfed5('0x2a')][_0xfed5('0x78')]=_0x15c25c[_0xfed5('0x78')];_0x15c25c[_0xfed5('0x2a')][_0xfed5('0x79')]=_0x15c25c[_0xfed5('0x78')];_0x15c25c[_0xfed5('0x2a')][_0xfed5('0x7a')]=_0xfed5('0x59');return respondWithRpcPromise(_0xfed5('0x7b'),_0xfed5('0x7b'),{'event':'acceptmessage','message':_0x15c25c[_0xfed5('0x2a')]},client9002)[_0xfed5('0x22')](function(){return _0x15c25c;});}return _0x15c25c;}return null;})[_0xfed5('0x22')](respondWithResult(_0x307d7c,null))[_0xfed5('0x2c')](handleError(_0x307d7c,null));};var interaction_log=require(_0xfed5('0x15'))('openchannel-interactions');exports['reject']=function(_0x27b229,_0x5c4f7c,_0x46269c){var _0x36a77c={'agent':{},'channel':'openchannel'};if(_0x27b229['body']['id']){delete _0x27b229[_0xfed5('0x56')]['id'];}_0x27b229[_0xfed5('0x56')][_0xfed5('0x5f')]=_0x27b229[_0xfed5('0x56')][_0xfed5('0x5f')]||_0x27b229[_0xfed5('0x68')]['id'];_0x36a77c[_0xfed5('0x60')]['id']=_0x27b229[_0xfed5('0x56')][_0xfed5('0x5f')];return db['OpenchannelMessage'][_0xfed5('0x54')]({'where':{'id':_0x27b229[_0xfed5('0x52')]['id'],'UserId':null}})[_0xfed5('0x22')](handleEntityNotFound(_0x5c4f7c,null))[_0xfed5('0x22')](function(_0x16fe97){if(_0x16fe97){_0x36a77c['message']=_0x16fe97[_0xfed5('0x66')]({'plain':!![]});return db[_0xfed5('0x61')]['find']({'where':{'id':_0x16fe97[_0xfed5('0x62')]}});}return null;})[_0xfed5('0x22')](handleEntityNotFound(_0x5c4f7c,null))[_0xfed5('0x22')](function(_0x283341){if(_0x283341){_0x36a77c[_0xfed5('0x65')]=_0x283341[_0xfed5('0x66')]({'plain':!![]});interaction_log[_0xfed5('0x2b')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x27b229[_0xfed5('0x68')]['id'],_0x27b229['user'][_0xfed5('0x39')],_0x27b229[_0xfed5('0x68')][_0xfed5('0x69')],_0x36a77c[_0xfed5('0x65')]['id'],_0x27b229[_0xfed5('0x56')]?JSON[_0xfed5('0x27')](_0x27b229['body']):'null');return respondWithRpcPromise(_0xfed5('0x7c'),_0xfed5('0x7d'),_0x36a77c);}return null;})[_0xfed5('0x22')](function(_0x21aa52){var _0x493e98='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x21aa52['message'][_0xfed5('0x6d')];return db[_0xfed5('0x6e')]['query'](_0x493e98,{'type':db[_0xfed5('0x6f')][_0xfed5('0x70')][_0xfed5('0x71')],'raw':!![]})['then'](function(_0x4a2811){return _0x4a2811;});})[_0xfed5('0x22')](function(_0x1a1921){if(_0x1a1921){_0x36a77c[_0xfed5('0x2a')][_0xfed5('0x72')]=_0x1a1921[0x0];if(!_0x27b229[_0xfed5('0x56')][_0xfed5('0x5f')])return;return db[_0xfed5('0x73')][_0xfed5('0x54')]({'where':{'id':_0x27b229['body'][_0xfed5('0x5f')],'role':_0xfed5('0x60')},'attributes':['id','name',_0xfed5('0x74'),_0xfed5('0x7e'),_0xfed5('0x75')],'raw':!![]});}return null;})[_0xfed5('0x22')](function(_0x287057){if(!_0x287057)return null;_0x36a77c[_0xfed5('0x2a')]['agent']=_0x287057;return _0x36a77c;})[_0xfed5('0x22')](function(_0x2b33b8){if(_0x2b33b8){_0x2b33b8[_0xfed5('0x2a')]['interface']=util[_0xfed5('0x5d')](_0xfed5('0x77'),_0x27b229[_0xfed5('0x68')]['name']);_0x2b33b8[_0xfed5('0x2a')][_0xfed5('0x78')]=_0x36a77c['channel'];_0x2b33b8[_0xfed5('0x2a')][_0xfed5('0x79')]=_0x36a77c[_0xfed5('0x78')];_0x2b33b8[_0xfed5('0x2a')][_0xfed5('0x7a')]='reject';respondWithRpcPromise(_0xfed5('0x7b'),'EventManager',{'event':'rejectmessage','message':_0x2b33b8[_0xfed5('0x2a')]},client9002);return _0x36a77c;}return null;})[_0xfed5('0x22')](respondWithResult(_0x5c4f7c,null))[_0xfed5('0x2c')](handleError(_0x5c4f7c,null));}; \ No newline at end of file +var _0x5559=['interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','email','rejectmessage','eml-format','rimraf','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','create','body','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt'];(function(_0x443dc9,_0xa05541){var _0x417348=function(_0x5537d7){while(--_0x5537d7){_0x443dc9['push'](_0x443dc9['shift']());}};_0x417348(++_0xa05541);}(_0x5559,0x1af));var _0x9555=function(_0x50ce64,_0x251401){_0x50ce64=_0x50ce64-0x0;var _0x240ae1=_0x5559[_0x50ce64];return _0x240ae1;};'use strict';var emlformat=require(_0x9555('0x0'));var rimraf=require(_0x9555('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9555('0x2'));var util=require(_0x9555('0x3'));var path=require(_0x9555('0x4'));var sox=require('sox');var csv=require(_0x9555('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9555('0x6'));var squel=require(_0x9555('0x7'));var crypto=require(_0x9555('0x8'));var jsforce=require(_0x9555('0x9'));var deskjs=require(_0x9555('0xa'));var toCsv=require(_0x9555('0x5'));var querystring=require('querystring');var Papa=require(_0x9555('0xb'));var Redis=require(_0x9555('0xc'));var authService=require(_0x9555('0xd'));var qs=require(_0x9555('0xe'));var as=require(_0x9555('0xf'));var hardwareService=require(_0x9555('0x10'));var logger=require(_0x9555('0x11'))('api');var utils=require(_0x9555('0x12'));var config=require(_0x9555('0x13'));var licenseUtil=require(_0x9555('0x14'));var db=require(_0x9555('0x15'))['db'];config['redis']=_[_0x9555('0x16')](config[_0x9555('0x17')],{'host':_0x9555('0x18'),'port':0x18eb});var socket=require(_0x9555('0x19'))(new Redis(config[_0x9555('0x17')]));require(_0x9555('0x1a'))['register'](socket);var jayson=require(_0x9555('0x1b'));var client=jayson[_0x9555('0x1c')]['http']({'port':0x232c});var client9002=jayson['client'][_0x9555('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1374fc,_0x4e640c,_0x52df79,_0x4eb579){return new BPromise(function(_0x16caee,_0x59046a){var _0x15be05=_0x4eb579||client;return _0x15be05[_0x9555('0x1e')](_0x1374fc,_0x52df79)[_0x9555('0x1f')](function(_0x1c3192){logger[_0x9555('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x4e640c,_0x9555('0x21'));logger[_0x9555('0x22')](_0x9555('0x23'),_0x4e640c,_0x9555('0x21'),JSON[_0x9555('0x24')](_0x1c3192));if(_0x1c3192[_0x9555('0x25')]){if(_0x1c3192[_0x9555('0x25')][_0x9555('0x26')]===0x1f4){logger[_0x9555('0x25')](_0x9555('0x27'),_0x4e640c,_0x1c3192[_0x9555('0x25')][_0x9555('0x28')]);return _0x59046a(_0x1c3192[_0x9555('0x25')][_0x9555('0x28')]);}logger[_0x9555('0x25')](_0x9555('0x27'),_0x4e640c,_0x1c3192['error']['message']);return _0x16caee(_0x1c3192[_0x9555('0x25')][_0x9555('0x28')]);}else{logger[_0x9555('0x20')](_0x9555('0x27'),_0x4e640c,_0x9555('0x21'));_0x16caee(_0x1c3192[_0x9555('0x29')]['message']);}})['catch'](function(_0x5c408d){logger[_0x9555('0x25')](_0x9555('0x27'),_0x4e640c,_0x5c408d);_0x59046a(_0x5c408d);});});}function respondWithStatusCode(_0x1a99e0,_0x304ba5){_0x304ba5=_0x304ba5||0xcc;return function(_0x5c95ed){if(_0x5c95ed){return _0x1a99e0[_0x9555('0x2a')](_0x304ba5);}return _0x1a99e0[_0x9555('0x2b')](_0x304ba5)[_0x9555('0x2c')]();};}function respondWithResult(_0x47040c,_0x1a24b5){_0x1a24b5=_0x1a24b5||0xc8;return function(_0x4c7c87){if(_0x4c7c87){return _0x47040c[_0x9555('0x2b')](_0x1a24b5)[_0x9555('0x2d')](_0x4c7c87);}};}function respondWithFilteredResult(_0x473bd0,_0x2ad3ac){return function(_0x3b4a3e){if(_0x3b4a3e){var _0x527334=typeof _0x2ad3ac[_0x9555('0x2e')]===_0x9555('0x2f')&&typeof _0x2ad3ac[_0x9555('0x30')]===_0x9555('0x2f');var _0x5b6f50=_0x3b4a3e[_0x9555('0x31')];var _0x2f9f8d=_0x527334?0x0:_0x2ad3ac[_0x9555('0x2e')];var _0x3f3025=_0x527334?_0x3b4a3e[_0x9555('0x31')]:_0x2ad3ac[_0x9555('0x2e')]+_0x2ad3ac['limit'];var _0x401b81;if(_0x3f3025>=_0x5b6f50){_0x3f3025=_0x5b6f50;_0x401b81=0xc8;}else{_0x401b81=0xce;}_0x473bd0[_0x9555('0x2b')](_0x401b81);return _0x473bd0[_0x9555('0x32')](_0x9555('0x33'),_0x2f9f8d+'-'+_0x3f3025+'/'+_0x5b6f50)[_0x9555('0x2d')](_0x3b4a3e);}return null;};}function patchUpdates(_0x51cf6e){return function(_0x23bd42){try{jsonpatch[_0x9555('0x34')](_0x23bd42,_0x51cf6e,!![]);}catch(_0xec7786){return BPromise[_0x9555('0x35')](_0xec7786);}return _0x23bd42[_0x9555('0x36')]();};}function saveUpdates(_0x5b511b,_0x699b2){return function(_0x22dd54){if(_0x22dd54){return _0x22dd54[_0x9555('0x37')](_0x5b511b)['then'](function(_0x3fc54a){return _0x3fc54a;});}return null;};}function removeEntity(_0x4fbc5b,_0x20f46d){return function(_0x473b36){if(_0x473b36){return _0x473b36[_0x9555('0x38')]()[_0x9555('0x1f')](function(){_0x4fbc5b['status'](0xcc)[_0x9555('0x2c')]();});}};}function handleEntityNotFound(_0x30f299,_0x54a47e){return function(_0xd5c8be){if(!_0xd5c8be){_0x30f299[_0x9555('0x2a')](0x194);}return _0xd5c8be;};}function handleError(_0x5e3edc,_0x39936a){_0x39936a=_0x39936a||0x1f4;return function(_0x276121){logger[_0x9555('0x25')](_0x276121[_0x9555('0x39')]);if(_0x276121[_0x9555('0x3a')]){delete _0x276121[_0x9555('0x3a')];}_0x5e3edc['status'](_0x39936a)[_0x9555('0x3b')](_0x276121);};}exports[_0x9555('0x3c')]=function(_0x517e9b,_0x2871ec){var _0x549382={},_0x267e8e={},_0x268814={'count':0x0,'rows':[]};var _0x5c4d7e=_[_0x9555('0x3d')](db[_0x9555('0x3e')][_0x9555('0x3f')],function(_0x60ab49){return{'name':_0x60ab49[_0x9555('0x40')],'type':_0x60ab49[_0x9555('0x41')][_0x9555('0x42')]};});_0x267e8e[_0x9555('0x43')]=_['map'](_0x5c4d7e,_0x9555('0x3a'));_0x267e8e[_0x9555('0x44')]=_[_0x9555('0x45')](_0x517e9b[_0x9555('0x44')]);_0x267e8e[_0x9555('0x46')]=_[_0x9555('0x47')](_0x267e8e[_0x9555('0x43')],_0x267e8e[_0x9555('0x44')]);_0x549382['attributes']=_['intersection'](_0x267e8e[_0x9555('0x43')],qs['fields'](_0x517e9b[_0x9555('0x44')][_0x9555('0x48')]));_0x549382[_0x9555('0x49')]=_0x549382[_0x9555('0x49')][_0x9555('0x4a')]?_0x549382[_0x9555('0x49')]:_0x267e8e[_0x9555('0x43')];if(!_0x517e9b[_0x9555('0x44')][_0x9555('0x4b')]('nolimit')){_0x549382[_0x9555('0x30')]=qs[_0x9555('0x30')](_0x517e9b[_0x9555('0x44')][_0x9555('0x30')]);_0x549382[_0x9555('0x2e')]=qs['offset'](_0x517e9b[_0x9555('0x44')]['offset']);}_0x549382[_0x9555('0x4c')]=qs['sort'](_0x517e9b[_0x9555('0x44')][_0x9555('0x4d')]);_0x549382[_0x9555('0x4e')]=qs['filters'](_[_0x9555('0x4f')](_0x517e9b[_0x9555('0x44')],_0x267e8e[_0x9555('0x46')]),_0x5c4d7e);if(_0x517e9b[_0x9555('0x44')][_0x9555('0x50')]){_0x549382[_0x9555('0x4e')]=_['merge'](_0x549382[_0x9555('0x4e')],{'$or':_[_0x9555('0x3d')](_0x5c4d7e,function(_0x4e5bcc){if(_0x4e5bcc[_0x9555('0x41')]!==_0x9555('0x51')){var _0x35d13c={};_0x35d13c[_0x4e5bcc[_0x9555('0x3a')]]={'$like':'%'+_0x517e9b[_0x9555('0x44')]['filter']+'%'};return _0x35d13c;}})});}_0x549382=_[_0x9555('0x52')]({},_0x549382,_0x517e9b[_0x9555('0x53')]);var _0x20f84c={'where':_0x549382[_0x9555('0x4e')]};return db[_0x9555('0x3e')][_0x9555('0x31')](_0x20f84c)['then'](function(_0x127a94){_0x268814[_0x9555('0x31')]=_0x127a94;if(_0x517e9b[_0x9555('0x44')][_0x9555('0x54')]){_0x549382[_0x9555('0x55')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x9555('0x56')](_0x549382);})[_0x9555('0x1f')](function(_0x1faeef){_0x268814['rows']=_0x1faeef;return _0x268814;})[_0x9555('0x1f')](respondWithFilteredResult(_0x2871ec,_0x549382))[_0x9555('0x57')](handleError(_0x2871ec,null));};exports['show']=function(_0x27792f,_0x306307){var _0xd658c7={'raw':!![],'where':{'id':_0x27792f[_0x9555('0x58')]['id']}},_0xff1723={};_0xff1723[_0x9555('0x43')]=_['keys'](db[_0x9555('0x3e')]['rawAttributes']);_0xff1723[_0x9555('0x44')]=_[_0x9555('0x45')](_0x27792f[_0x9555('0x44')]);_0xff1723['filters']=_[_0x9555('0x47')](_0xff1723[_0x9555('0x43')],_0xff1723[_0x9555('0x44')]);_0xd658c7[_0x9555('0x49')]=_[_0x9555('0x47')](_0xff1723[_0x9555('0x43')],qs[_0x9555('0x48')](_0x27792f[_0x9555('0x44')][_0x9555('0x48')]));_0xd658c7[_0x9555('0x49')]=_0xd658c7[_0x9555('0x49')][_0x9555('0x4a')]?_0xd658c7['attributes']:_0xff1723[_0x9555('0x43')];if(_0x27792f[_0x9555('0x44')][_0x9555('0x54')]){_0xd658c7['include']=[{'all':!![]}];}_0xd658c7=_[_0x9555('0x52')]({},_0xd658c7,_0x27792f[_0x9555('0x53')]);return db[_0x9555('0x3e')][_0x9555('0x59')](_0xd658c7)[_0x9555('0x1f')](handleEntityNotFound(_0x306307,null))[_0x9555('0x1f')](respondWithResult(_0x306307,null))['catch'](handleError(_0x306307,null));};exports[_0x9555('0x5a')]=function(_0xe61f86,_0x20bb03){return db[_0x9555('0x3e')][_0x9555('0x5a')](_0xe61f86[_0x9555('0x5b')],{})[_0x9555('0x1f')](respondWithResult(_0x20bb03,0xc9))[_0x9555('0x57')](handleError(_0x20bb03,null));};exports[_0x9555('0x37')]=function(_0xbef7a7,_0x6ff0b3){if(_0xbef7a7[_0x9555('0x5b')]['id']){delete _0xbef7a7[_0x9555('0x5b')]['id'];}return db['OpenchannelMessage'][_0x9555('0x59')]({'where':{'id':_0xbef7a7[_0x9555('0x58')]['id']}})[_0x9555('0x1f')](handleEntityNotFound(_0x6ff0b3,null))['then'](saveUpdates(_0xbef7a7[_0x9555('0x5b')],null))['then'](respondWithResult(_0x6ff0b3,null))[_0x9555('0x57')](handleError(_0x6ff0b3,null));};exports[_0x9555('0x38')]=function(_0x4558ea,_0x48589a){return db['OpenchannelMessage'][_0x9555('0x59')]({'where':{'id':_0x4558ea[_0x9555('0x58')]['id']}})[_0x9555('0x1f')](handleEntityNotFound(_0x48589a,null))[_0x9555('0x1f')](removeEntity(_0x48589a,null))[_0x9555('0x57')](handleError(_0x48589a,null));};exports['describe']=function(_0x138ef5,_0x4174f1){return db[_0x9555('0x3e')]['describe']()[_0x9555('0x1f')](respondWithResult(_0x4174f1,null))[_0x9555('0x57')](handleError(_0x4174f1,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['accept']=function(_0x4378f9,_0x1063e6,_0x5362c9){var _0x14cf2e={'agent':{},'channel':_0x9555('0x5c')};if(_0x4378f9[_0x9555('0x5b')]['id']){delete _0x4378f9[_0x9555('0x5b')]['id'];}_0x4378f9[_0x9555('0x5b')][_0x9555('0x5d')]=!![];_0x4378f9[_0x9555('0x5b')][_0x9555('0x5e')]=moment()[_0x9555('0x5f')](_0x9555('0x60'));_0x4378f9['body']['UserId']=_0x4378f9['body']['UserId']||_0x4378f9[_0x9555('0x61')]['id'];_0x14cf2e[_0x9555('0x62')]['id']=_0x4378f9['body'][_0x9555('0x63')];return db[_0x9555('0x3e')]['find']({'where':{'id':_0x4378f9[_0x9555('0x58')]['id'],'UserId':null}})[_0x9555('0x1f')](handleEntityNotFound(_0x1063e6,null))['then'](saveUpdates(_0x4378f9[_0x9555('0x5b')],null))['then'](function(_0x478f77){if(_0x478f77){_0x14cf2e[_0x9555('0x28')]=_0x478f77[_0x9555('0x64')]({'plain':!![]});return db[_0x9555('0x65')][_0x9555('0x59')]({'where':{'id':_0x478f77[_0x9555('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x1063e6,null))['then'](function(_0x6e2637){if(_0x6e2637){return _0x6e2637[_0x9555('0x37')]({'UserId':_0x4378f9[_0x9555('0x5b')][_0x9555('0x63')],'read1stAt':_[_0x9555('0x67')](_0x6e2637[_0x9555('0x68')])?moment()['format'](_0x9555('0x60')):undefined});}return null;})[_0x9555('0x1f')](function(_0xdaa663){if(_0xdaa663){_0x14cf2e[_0x9555('0x69')]=_0xdaa663[_0x9555('0x64')]({'plain':!![]});interaction_log['info'](_0x9555('0x6a'),_0x4378f9[_0x9555('0x61')]['id'],_0x4378f9[_0x9555('0x61')][_0x9555('0x3a')],_0x4378f9['user'][_0x9555('0x6b')],_0x14cf2e[_0x9555('0x69')]['id'],_0x4378f9[_0x9555('0x5b')]?JSON[_0x9555('0x24')](_0x4378f9['body']):_0x9555('0x6c'));return respondWithRpcPromise(_0x9555('0x6d'),_0x9555('0x6e'),_0x14cf2e);}return null;})[_0x9555('0x1f')](function(_0x105147){var _0x5993d6=_0x9555('0x6f')+_0x105147[_0x9555('0x28')]['ContactId'];return db[_0x9555('0x70')]['query'](_0x5993d6,{'type':db[_0x9555('0x71')][_0x9555('0x72')][_0x9555('0x73')],'raw':!![]})[_0x9555('0x1f')](function(_0x249bf){return _0x249bf;});})['then'](function(_0x57779e){if(_0x57779e){_0x14cf2e[_0x9555('0x28')][_0x9555('0x74')]=_0x57779e[0x0];if(!_0x4378f9['body'][_0x9555('0x63')])return;return db[_0x9555('0x75')]['find']({'where':{'id':_0x4378f9[_0x9555('0x5b')][_0x9555('0x63')],'role':_0x9555('0x62')},'attributes':['id','name',_0x9555('0x76'),'email',_0x9555('0x77')],'raw':!![]});}return null;})[_0x9555('0x1f')](function(_0x477e27){if(!_0x477e27)return null;_0x14cf2e[_0x9555('0x28')][_0x9555('0x62')]=_0x477e27;return _0x14cf2e;})[_0x9555('0x1f')](function(_0x2f9c7f){if(_0x2f9c7f){if(_0x4378f9[_0x9555('0x5b')][_0x9555('0x78')]){_0x14cf2e[_0x9555('0x28')][_0x9555('0x79')]=util[_0x9555('0x5f')](_0x9555('0x7a'),_0x4378f9[_0x9555('0x61')][_0x9555('0x3a')]);_0x14cf2e[_0x9555('0x28')][_0x9555('0x7b')]=_0x14cf2e[_0x9555('0x7b')];_0x14cf2e['message'][_0x9555('0x7c')]=_0x14cf2e[_0x9555('0x7b')];_0x14cf2e[_0x9555('0x28')]['event']=_0x9555('0x7d');return respondWithRpcPromise(_0x9555('0x7e'),_0x9555('0x7e'),{'event':_0x9555('0x7f'),'message':_0x14cf2e[_0x9555('0x28')]},client9002)['then'](function(){return _0x14cf2e;});}return _0x14cf2e;}return null;})[_0x9555('0x1f')](respondWithResult(_0x1063e6,null))[_0x9555('0x57')](handleError(_0x1063e6,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['reject']=function(_0x1ed247,_0x32e7a7,_0x11f7ac){var _0x50dedd={'agent':{},'channel':_0x9555('0x5c')};if(_0x1ed247[_0x9555('0x5b')]['id']){delete _0x1ed247[_0x9555('0x5b')]['id'];}_0x1ed247[_0x9555('0x5b')]['UserId']=_0x1ed247[_0x9555('0x5b')]['UserId']||_0x1ed247[_0x9555('0x61')]['id'];_0x50dedd[_0x9555('0x62')]['id']=_0x1ed247['body']['UserId'];return db[_0x9555('0x3e')][_0x9555('0x59')]({'where':{'id':_0x1ed247[_0x9555('0x58')]['id'],'UserId':null}})[_0x9555('0x1f')](handleEntityNotFound(_0x32e7a7,null))[_0x9555('0x1f')](function(_0x14e6db){if(_0x14e6db){_0x50dedd[_0x9555('0x28')]=_0x14e6db[_0x9555('0x64')]({'plain':!![]});return db['OpenchannelInteraction'][_0x9555('0x59')]({'where':{'id':_0x14e6db[_0x9555('0x66')]}});}return null;})[_0x9555('0x1f')](handleEntityNotFound(_0x32e7a7,null))[_0x9555('0x1f')](function(_0x5bc406){if(_0x5bc406){_0x50dedd[_0x9555('0x69')]=_0x5bc406[_0x9555('0x64')]({'plain':!![]});interaction_log[_0x9555('0x20')](_0x9555('0x80'),_0x1ed247[_0x9555('0x61')]['id'],_0x1ed247[_0x9555('0x61')][_0x9555('0x3a')],_0x1ed247[_0x9555('0x61')][_0x9555('0x6b')],_0x50dedd['interaction']['id'],_0x1ed247[_0x9555('0x5b')]?JSON[_0x9555('0x24')](_0x1ed247[_0x9555('0x5b')]):_0x9555('0x6c'));return respondWithRpcPromise(_0x9555('0x81'),_0x9555('0x82'),_0x50dedd);}return null;})[_0x9555('0x1f')](function(_0x3683f2){var _0x1e0891=_0x9555('0x6f')+_0x3683f2['message'][_0x9555('0x83')];return db[_0x9555('0x70')][_0x9555('0x44')](_0x1e0891,{'type':db[_0x9555('0x71')][_0x9555('0x72')][_0x9555('0x73')],'raw':!![]})['then'](function(_0x19fce6){return _0x19fce6;});})[_0x9555('0x1f')](function(_0x34ddea){if(_0x34ddea){_0x50dedd['message'][_0x9555('0x74')]=_0x34ddea[0x0];if(!_0x1ed247['body'][_0x9555('0x63')])return;return db['User'][_0x9555('0x59')]({'where':{'id':_0x1ed247[_0x9555('0x5b')]['UserId'],'role':'agent'},'attributes':['id',_0x9555('0x3a'),'fullname',_0x9555('0x84'),_0x9555('0x77')],'raw':!![]});}return null;})[_0x9555('0x1f')](function(_0x35b463){if(!_0x35b463)return null;_0x50dedd[_0x9555('0x28')][_0x9555('0x62')]=_0x35b463;return _0x50dedd;})['then'](function(_0x8d781){if(_0x8d781){_0x8d781[_0x9555('0x28')][_0x9555('0x79')]=util['format'](_0x9555('0x7a'),_0x1ed247[_0x9555('0x61')]['name']);_0x8d781['message'][_0x9555('0x7b')]=_0x50dedd[_0x9555('0x7b')];_0x8d781['message'][_0x9555('0x7c')]=_0x50dedd['channel'];_0x8d781[_0x9555('0x28')]['event']='reject';respondWithRpcPromise(_0x9555('0x7e'),'EventManager',{'event':_0x9555('0x85'),'message':_0x8d781[_0x9555('0x28')]},client9002);return _0x50dedd;}return null;})[_0x9555('0x1f')](respondWithResult(_0x32e7a7,null))[_0x9555('0x57')](handleError(_0x32e7a7,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index dc2a5d2..85473ac 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 _0xe860=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xe860,0x18a));var _0x0e86=function(_0x8916b3,_0x181f0d){_0x8916b3=_0x8916b3-0x0;var _0x20bd58=_0xe860[_0x8916b3];return _0x20bd58;};'use strict';var EventEmitter=require(_0x0e86('0x0'));var OpenchannelMessage=require(_0x0e86('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0e86('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0e86('0x3'),'afterDestroy':'remove'};function emitEvent(_0x179d81){return function(_0x1c632b,_0x26530c,_0x1a66ec){OpenchannelMessageEvents[_0x0e86('0x4')](_0x179d81+':'+_0x1c632b['id'],_0x1c632b);OpenchannelMessageEvents[_0x0e86('0x4')](_0x179d81,_0x1c632b);_0x1a66ec(null);};}for(var e in events){if(events[_0x0e86('0x5')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x0e86('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xb40b=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x23c9d2,_0x68407){var _0x498c9c=function(_0x4f3f2f){while(--_0x4f3f2f){_0x23c9d2['push'](_0x23c9d2['shift']());}};_0x498c9c(++_0x68407);}(_0xb40b,0x196));var _0xbb40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb40b[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xbb40('0x0'));var OpenchannelMessage=require(_0xbb40('0x1'))['db'][_0xbb40('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xbb40('0x3')](0x0);var events={'afterCreate':_0xbb40('0x4'),'afterUpdate':'update','afterDestroy':_0xbb40('0x5')};function emitEvent(_0x29d919){return function(_0x53f733,_0xf76a74,_0x187ea0){OpenchannelMessageEvents[_0xbb40('0x6')](_0x29d919+':'+_0x53f733['id'],_0x53f733);OpenchannelMessageEvents[_0xbb40('0x6')](_0x29d919,_0x53f733);_0x187ea0(null);};}for(var e in events){if(events[_0xbb40('0x7')](e)){var event=events[e];OpenchannelMessage[_0xbb40('0x8')](e,emitEvent(event));}}module[_0xbb40('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index cf94a65..563091b 100644 --- a/server/api/openchannelMessage/openchannelMessage.model.js +++ b/server/api/openchannelMessage/openchannelMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['fti_openchannel_messages','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','inspect','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages'];(function(_0x3751fe,_0x30a5e5){var _0x522663=function(_0x161875){while(--_0x161875){_0x3751fe['push'](_0x3751fe['shift']());}};_0x522663(++_0x30a5e5);}(_0x14a0,0x8e));var _0x014a=function(_0x4b6249,_0x5944a1){_0x4b6249=_0x4b6249-0x0;var _0x368bc0=_0x14a0[_0x4b6249];return _0x368bc0;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var moment=require(_0x014a('0x3'));var BPromise=require(_0x014a('0x4'));var rp=require(_0x014a('0x5'));var fs=require('fs');var path=require(_0x014a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x014a('0x7'));module[_0x014a('0x8')]=function(_0x38a22c,_0x5ec84d){return _0x38a22c['define'](_0x014a('0x9'),attributes,{'tableName':_0x014a('0xa'),'paranoid':![],'indexes':[{'name':_0x014a('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2519e3,_0x4f5506,_0x490ea2){var _0x5aa52f=_0x38a22c['models'];var _0x330469=_0x2519e3['get']({'plain':!![]});if(_0x330469[_0x014a('0xc')][_0x014a('0xd')]()==='in'||_0x330469['direction'][_0x014a('0xd')]()===_0x014a('0xe')&&!_0x330469[_0x014a('0xf')]&&!_[_0x014a('0x10')](_0x330469[_0x014a('0x11')])){_0x5aa52f[_0x014a('0x12')][_0x014a('0x13')]({'where':{'id':_0x330469[_0x014a('0x14')]}})[_0x014a('0x15')](function(_0x71535d){if(_0x71535d){_0x71535d[_0x014a('0x16')]({'lastMsgAt':_0x330469[_0x014a('0x17')],'lastMsgDirection':_0x330469['direction'][_0x014a('0xd')]()});}})[_0x014a('0x18')](function(_0x59f207){console[_0x014a('0x19')](_0x59f207);});}if(_0x330469[_0x014a('0xc')]==='out'&&!_0x330469[_0x014a('0xf')]){var _0x17e4be;_0x5aa52f[_0x014a('0x1a')][_0x014a('0x1b')]()[_0x014a('0x15')](function(_0x12d339){return _0x5aa52f[_0x014a('0x1c')][_0x014a('0x1d')]({'where':{'id':_0x330469[_0x014a('0x1e')]},'include':[{'model':_0x5aa52f[_0x014a('0x12')],'as':_0x014a('0x1f'),'where':{'id':_0x330469[_0x014a('0x14')]},'limit':0x1,'include':[{'model':_0x5aa52f[_0x014a('0x1a')],'as':_0x014a('0x20'),'attributes':_['keys'](_0x12d339)}]}]});})[_0x014a('0x15')](function(_0x109a9c){_0x17e4be=_0x109a9c[_0x014a('0x21')]({'plain':!![]});if(_0x17e4be&&_0x17e4be[_0x014a('0x22')]){logger[_0x014a('0x23')](_0x014a('0x24'),_0x014a('0x25'),util[_0x014a('0x26')](_0x014a('0x27'),_0x330469['id'],_0x17e4be['replyUri']));if(_0x17e4be[_0x014a('0x1f')]&&_0x17e4be['Interactions'][_0x014a('0x28')]){_0x330469[_0x014a('0x29')]=_[_0x014a('0x2a')](_0x17e4be[_0x014a('0x1f')][0x0],_0x014a('0x20'));_0x330469[_0x014a('0x20')]=_0x17e4be[_0x014a('0x1f')][0x0][_0x014a('0x20')];}var _0x4f5506={'method':'POST','uri':encodeURI(_0x17e4be[_0x014a('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4f5506['method']){case _0x014a('0x2b'):_0x4f5506['qs']=_0x330469;break;case _0x014a('0x2c'):_0x4f5506['body']=_0x330469;break;}return rp(_0x4f5506)['then'](function(_0x9a901f){logger[_0x014a('0x23')](_0x014a('0x24'),'afterCreate',util[_0x014a('0x26')](_0x014a('0x2d'),_0x330469['id'],_0x17e4be['replyUri']));if(_0x9a901f[_0x014a('0x2e')][_0x014a('0x2f')]&&_0x9a901f['body']['threadId']!=_0x330469[_0x014a('0x29')][_0x014a('0x2f')]){return _0x5aa52f[_0x014a('0x12')][_0x014a('0x16')]({'threadId':_0x9a901f['body'][_0x014a('0x2f')]},{'logging':!![],'where':{'id':_0x330469[_0x014a('0x29')]['id']}});}else{return;}})[_0x014a('0x15')](function(){return _0x2519e3[_0x014a('0x16')]({'read':!![]});})[_0x014a('0x18')](function(_0x1eb007){logger[_0x014a('0x19')](_0x014a('0x24'),_0x014a('0x25'),util[_0x014a('0x30')](_0x1eb007,{'showHidden':![],'depth':null}));_0x490ea2();});}else{_0x490ea2();}})[_0x014a('0x31')](function(){_0x490ea2();});}else{_0x490ea2();}}},'charset':'utf8mb4','collate':_0x014a('0x32')});}; \ No newline at end of file +var _0x80ed=['find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','keys','then','replyUri','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','Contact','GET','info','OpenchannelMessage,\x20%s,\x20%s','threadId','Interaction','OpenchannelInteraction','catch','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','update','createdAt','error','CmContact','describe','OpenchannelAccount'];(function(_0x12c076,_0x5bef17){var _0x2ddd18=function(_0x436336){while(--_0x436336){_0x12c076['push'](_0x12c076['shift']());}};_0x2ddd18(++_0x5bef17);}(_0x80ed,0x11c));var _0xd80e=function(_0x59acb7,_0x5527ca){_0x59acb7=_0x59acb7-0x0;var _0x63a91a=_0x80ed[_0x59acb7];return _0x63a91a;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var logger=require(_0xd80e('0x1'))(_0xd80e('0x2'));var moment=require(_0xd80e('0x3'));var BPromise=require('bluebird');var rp=require(_0xd80e('0x4'));var fs=require('fs');var path=require(_0xd80e('0x5'));var rimraf=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0xd80e('0x8')]=function(_0x2b4742,_0x252fec){return _0x2b4742['define'](_0xd80e('0x9'),attributes,{'tableName':_0xd80e('0xa'),'paranoid':![],'indexes':[{'name':_0xd80e('0xb'),'fields':[_0xd80e('0xc')],'type':_0xd80e('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x298c29,_0x3063ff,_0x2457f5){var _0x68625=_0x2b4742[_0xd80e('0xe')];var _0x4eee08=_0x298c29[_0xd80e('0xf')]({'plain':!![]});if(_0x4eee08[_0xd80e('0x10')][_0xd80e('0x11')]()==='in'||_0x4eee08[_0xd80e('0x10')][_0xd80e('0x11')]()===_0xd80e('0x12')&&!_0x4eee08[_0xd80e('0x13')]&&!_[_0xd80e('0x14')](_0x4eee08[_0xd80e('0x15')])){_0x68625['OpenchannelInteraction']['findOne']({'where':{'id':_0x4eee08['OpenchannelInteractionId']}})['then'](function(_0x145766){if(_0x145766){_0x145766[_0xd80e('0x16')]({'lastMsgAt':_0x4eee08[_0xd80e('0x17')],'lastMsgDirection':_0x4eee08[_0xd80e('0x10')][_0xd80e('0x11')]()});}})['catch'](function(_0x595683){console[_0xd80e('0x18')](_0x595683);});}if(_0x4eee08[_0xd80e('0x10')]===_0xd80e('0x12')&&!_0x4eee08[_0xd80e('0x13')]){var _0xc25d82;_0x68625[_0xd80e('0x19')][_0xd80e('0x1a')]()['then'](function(_0x21ceec){return _0x68625[_0xd80e('0x1b')][_0xd80e('0x1c')]({'where':{'id':_0x4eee08[_0xd80e('0x1d')]},'include':[{'model':_0x68625['OpenchannelInteraction'],'as':_0xd80e('0x1e'),'where':{'id':_0x4eee08[_0xd80e('0x1f')]},'limit':0x1,'include':[{'model':_0x68625[_0xd80e('0x19')],'as':'Contact','attributes':_[_0xd80e('0x20')](_0x21ceec)}]}]});})[_0xd80e('0x21')](function(_0x2765ea){_0xc25d82=_0x2765ea[_0xd80e('0xf')]({'plain':!![]});if(_0xc25d82&&_0xc25d82[_0xd80e('0x22')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xd80e('0x23'),util[_0xd80e('0x24')](_0xd80e('0x25'),_0x4eee08['id'],_0xc25d82[_0xd80e('0x22')]));if(_0xc25d82[_0xd80e('0x1e')]&&_0xc25d82[_0xd80e('0x1e')][_0xd80e('0x26')]){_0x4eee08['Interaction']=_[_0xd80e('0x27')](_0xc25d82[_0xd80e('0x1e')][0x0],_0xd80e('0x28'));_0x4eee08['Contact']=_0xc25d82[_0xd80e('0x1e')][0x0][_0xd80e('0x28')];}var _0x3063ff={'method':'POST','uri':encodeURI(_0xc25d82['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3063ff['method']){case _0xd80e('0x29'):_0x3063ff['qs']=_0x4eee08;break;case'POST':_0x3063ff[_0xd80e('0xc')]=_0x4eee08;break;}return rp(_0x3063ff)[_0xd80e('0x21')](function(_0x4e8ed9){logger[_0xd80e('0x2a')](_0xd80e('0x2b'),_0xd80e('0x23'),util[_0xd80e('0x24')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x4eee08['id'],_0xc25d82[_0xd80e('0x22')]));if(_0x4e8ed9[_0xd80e('0xc')][_0xd80e('0x2c')]&&_0x4e8ed9[_0xd80e('0xc')][_0xd80e('0x2c')]!=_0x4eee08[_0xd80e('0x2d')][_0xd80e('0x2c')]){return _0x68625[_0xd80e('0x2e')]['update']({'threadId':_0x4e8ed9['body'][_0xd80e('0x2c')]},{'logging':!![],'where':{'id':_0x4eee08[_0xd80e('0x2d')]['id']}});}else{return;}})[_0xd80e('0x21')](function(){return _0x298c29[_0xd80e('0x16')]({'read':!![]});})[_0xd80e('0x2f')](function(_0x44b440){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xd80e('0x23'),util[_0xd80e('0x30')](_0x44b440,{'showHidden':![],'depth':null}));_0x2457f5();});}else{_0x2457f5();}})[_0xd80e('0x31')](function(){_0x2457f5();});}else{_0x2457f5();}}},'charset':_0xd80e('0x32'),'collate':_0xd80e('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 2c290f6..4959ef7 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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x52fef0,_0x5059a8){var _0x191fe4=function(_0x32a3d0){while(--_0x32a3d0){_0x52fef0['push'](_0x52fef0['shift']());}};_0x191fe4(++_0x5059a8);}(_0x7a54,0x106));var _0x47a5=function(_0x50e5fc,_0x1e4efa){_0x50e5fc=_0x50e5fc-0x0;var _0x46c335=_0x7a54[_0x50e5fc];return _0x46c335;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14420b,_0x508f25){var _0x56ff09=function(_0x9cbe1c){while(--_0x9cbe1c){_0x14420b['push'](_0x14420b['shift']());}};_0x56ff09(++_0x508f25);}(_0x5f2f,0x73));var _0xf5f2=function(_0x47cd9c,_0x5393dc){_0x47cd9c=_0x47cd9c-0x0;var _0x26ef4c=_0x5f2f[_0x47cd9c];return _0x26ef4c;};'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});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 672bdae..4c6ae24 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 _0xf0a2=['emit','removeListener','openchannelMessage:','./openchannelMessage.events','save','remove','update'];(function(_0x2ca5e2,_0x4fba69){var _0x1b4881=function(_0x2b13a2){while(--_0x2b13a2){_0x2ca5e2['push'](_0x2ca5e2['shift']());}};_0x1b4881(++_0x4fba69);}(_0xf0a2,0x1ca));var _0x2f0a=function(_0x3b885f,_0x265272){_0x3b885f=_0x3b885f-0x0;var _0x33d23e=_0xf0a2[_0x3b885f];return _0x33d23e;};'use strict';var OpenchannelMessageEvents=require(_0x2f0a('0x0'));var events=[_0x2f0a('0x1'),_0x2f0a('0x2'),_0x2f0a('0x3')];function createListener(_0x16b593,_0x4dddda){return function(_0x2ab063){_0x4dddda[_0x2f0a('0x4')](_0x16b593,_0x2ab063);};}function removeListener(_0x57dc92,_0x579f9a){return function(){OpenchannelMessageEvents[_0x2f0a('0x5')](_0x57dc92,_0x579f9a);};}exports['register']=function(_0x58a2e3){for(var _0x482671=0x0,_0xaf3b1b=events['length'];_0x482671<_0xaf3b1b;_0x482671++){var _0xd55679=events[_0x482671];var _0x51bdbb=createListener(_0x2f0a('0x6')+_0xd55679,_0x58a2e3);OpenchannelMessageEvents['on'](_0xd55679,_0x51bdbb);}}; \ No newline at end of file +var _0x16a6=['removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','update','emit'];(function(_0x24a6da,_0x55706d){var _0x54dbca=function(_0x4299cc){while(--_0x4299cc){_0x24a6da['push'](_0x24a6da['shift']());}};_0x54dbca(++_0x55706d);}(_0x16a6,0x15c));var _0x616a=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x16a6[_0x5a2d95];return _0x2c3986;};'use strict';var OpenchannelMessageEvents=require(_0x616a('0x0'));var events=[_0x616a('0x1'),'remove',_0x616a('0x2')];function createListener(_0x44b602,_0x13f2fe){return function(_0x255d72){_0x13f2fe[_0x616a('0x3')](_0x44b602,_0x255d72);};}function removeListener(_0x13cbc6,_0x59fc7e){return function(){OpenchannelMessageEvents[_0x616a('0x4')](_0x13cbc6,_0x59fc7e);};}exports[_0x616a('0x5')]=function(_0x4c1641){for(var _0x56eaab=0x0,_0x938824=events[_0x616a('0x6')];_0x56eaab<_0x938824;_0x56eaab++){var _0x574141=events[_0x56eaab];var _0x4ef45c=createListener(_0x616a('0x7')+_0x574141,_0x4c1641);OpenchannelMessageEvents['on'](_0x574141,_0x4ef45c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index b7bb19f..bdf517f 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 _0x89b0=['Router','fs-extra','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','update','delete','/:id','removeTeams','/:id/users','exports','multer','util','path','connect-timeout','express'];(function(_0x22b535,_0x216056){var _0x4418e3=function(_0x256617){while(--_0x256617){_0x22b535['push'](_0x22b535['shift']());}};_0x4418e3(++_0x216056);}(_0x89b0,0xa9));var _0x089b=function(_0x3341a5,_0xee8867){_0x3341a5=_0x3341a5-0x0;var _0x3af5c9=_0x89b0[_0x3341a5];return _0x3af5c9;};'use strict';var multer=require(_0x089b('0x0'));var util=require(_0x089b('0x1'));var path=require(_0x089b('0x2'));var timeout=require(_0x089b('0x3'));var express=require(_0x089b('0x4'));var router=express[_0x089b('0x5')]();var fs_extra=require(_0x089b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x089b('0x7'));var config=require('../../config/environment');var controller=require(_0x089b('0x8'));router[_0x089b('0x9')]('/',auth[_0x089b('0xa')](),controller[_0x089b('0xb')]);router['get']('/describe',auth[_0x089b('0xa')](),controller[_0x089b('0xc')]);router[_0x089b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x089b('0xd')]);router['get'](_0x089b('0xe'),auth[_0x089b('0xa')](),controller[_0x089b('0xf')]);router[_0x089b('0x9')](_0x089b('0x10'),auth['isAuthenticated'](),controller[_0x089b('0x11')]);router[_0x089b('0x9')]('/:id/users',auth[_0x089b('0xa')](),controller[_0x089b('0x12')]);router[_0x089b('0x13')]('/',auth[_0x089b('0xa')](),controller['create']);router['post']('/:id/teams',auth[_0x089b('0xa')](),controller[_0x089b('0x14')]);router[_0x089b('0x13')]('/:id/users',auth[_0x089b('0xa')](),controller[_0x089b('0x15')]);router[_0x089b('0x16')]('/:id',auth[_0x089b('0xa')](),controller[_0x089b('0x17')]);router[_0x089b('0x18')](_0x089b('0x19'),auth['isAuthenticated'](),controller['destroy']);router[_0x089b('0x18')]('/:id/teams',auth[_0x089b('0xa')](),controller[_0x089b('0x1a')]);router[_0x089b('0x18')](_0x089b('0x1b'),auth[_0x089b('0xa')](),controller['removeAgents']);module[_0x089b('0x1c')]=router; \ No newline at end of file +var _0x8f0e=['describe','/:id','show','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x27032d,_0xbdcf36){var _0x36796b=function(_0x2bb4ab){while(--_0x2bb4ab){_0x27032d['push'](_0x27032d['shift']());}};_0x36796b(++_0xbdcf36);}(_0x8f0e,0x1d2));var _0xe8f0=function(_0x50c9d2,_0x3c9412){_0x50c9d2=_0x50c9d2-0x0;var _0x41eb3e=_0x8f0e[_0x50c9d2];return _0x41eb3e;};'use strict';var multer=require(_0xe8f0('0x0'));var util=require(_0xe8f0('0x1'));var path=require(_0xe8f0('0x2'));var timeout=require(_0xe8f0('0x3'));var express=require(_0xe8f0('0x4'));var router=express[_0xe8f0('0x5')]();var fs_extra=require(_0xe8f0('0x6'));var auth=require(_0xe8f0('0x7'));var interaction=require(_0xe8f0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8f0('0x9'));router[_0xe8f0('0xa')]('/',auth[_0xe8f0('0xb')](),controller[_0xe8f0('0xc')]);router[_0xe8f0('0xa')](_0xe8f0('0xd'),auth[_0xe8f0('0xb')](),controller[_0xe8f0('0xe')]);router[_0xe8f0('0xa')](_0xe8f0('0xf'),auth['isAuthenticated'](),controller[_0xe8f0('0x10')]);router[_0xe8f0('0xa')]('/:id/members',auth[_0xe8f0('0xb')](),controller[_0xe8f0('0x11')]);router[_0xe8f0('0xa')]('/:id/teams',auth[_0xe8f0('0xb')](),controller[_0xe8f0('0x12')]);router[_0xe8f0('0xa')](_0xe8f0('0x13'),auth['isAuthenticated'](),controller[_0xe8f0('0x14')]);router[_0xe8f0('0x15')]('/',auth[_0xe8f0('0xb')](),controller[_0xe8f0('0x16')]);router['post'](_0xe8f0('0x17'),auth[_0xe8f0('0xb')](),controller[_0xe8f0('0x18')]);router['post'](_0xe8f0('0x13'),auth[_0xe8f0('0xb')](),controller[_0xe8f0('0x19')]);router[_0xe8f0('0x1a')](_0xe8f0('0xf'),auth[_0xe8f0('0xb')](),controller[_0xe8f0('0x1b')]);router[_0xe8f0('0x1c')]('/:id',auth[_0xe8f0('0xb')](),controller['destroy']);router[_0xe8f0('0x1c')](_0xe8f0('0x17'),auth[_0xe8f0('0xb')](),controller[_0xe8f0('0x1d')]);router['delete'](_0xe8f0('0x13'),auth[_0xe8f0('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 6451a27..2e6b698 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 _0x7d93=['exports','STRING','name','INTEGER','roundrobin'];(function(_0x3a5f1f,_0x5cae82){var _0x51bb9e=function(_0x51dcfd){while(--_0x51dcfd){_0x3a5f1f['push'](_0x3a5f1f['shift']());}};_0x51bb9e(++_0x5cae82);}(_0x7d93,0x73));var _0x37d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d93[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x37d9('0x0')]={'name':{'type':Sequelize[_0x37d9('0x1')],'unique':_0x37d9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x37d9('0x1')]},'timeout':{'type':Sequelize[_0x37d9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0x37d9('0x4'))}}; \ No newline at end of file +var _0xe685=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING'];(function(_0x5ac509,_0x367067){var _0x467489=function(_0x36eb4c){while(--_0x36eb4c){_0x5ac509['push'](_0x5ac509['shift']());}};_0x467489(++_0x367067);}(_0xe685,0xac));var _0x5e68=function(_0x34b85e,_0x2888b4){_0x34b85e=_0x34b85e-0x0;var _0x97caf9=_0xe685[_0x34b85e];return _0x97caf9;};'use strict';var Sequelize=require(_0x5e68('0x0'));module[_0x5e68('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5e68('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5e68('0x3')]},'timeout':{'type':Sequelize[_0x5e68('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5e68('0x5'),_0x5e68('0x6'),_0x5e68('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 9186f67..4bfff1b 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 _0x79a0=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','spread','isArray','getAgents','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','OpenchannelQueues','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','OpenchannelQueue','includeAll','include','findAll','rows','show','params','intersection','fields','length','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','error'];(function(_0x1b5a7c,_0x3a825e){var _0x1807f5=function(_0x883a40){while(--_0x883a40){_0x1b5a7c['push'](_0x1b5a7c['shift']());}};_0x1807f5(++_0x3a825e);}(_0x79a0,0xc6));var _0x079a=function(_0x2a5fea,_0x5ba030){_0x2a5fea=_0x2a5fea-0x0;var _0x4299f6=_0x79a0[_0x2a5fea];return _0x4299f6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x079a('0x0'));var BPromise=require(_0x079a('0x1'));var Mustache=require(_0x079a('0x2'));var util=require(_0x079a('0x3'));var path=require(_0x079a('0x4'));var sox=require(_0x079a('0x5'));var csv=require('to-csv');var ejs=require(_0x079a('0x6'));var fs=require('fs');var fs_extra=require(_0x079a('0x7'));var _=require(_0x079a('0x8'));var squel=require(_0x079a('0x9'));var crypto=require(_0x079a('0xa'));var jsforce=require(_0x079a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x079a('0xc'));var Papa=require(_0x079a('0xd'));var Redis=require('ioredis');var authService=require(_0x079a('0xe'));var qs=require(_0x079a('0xf'));var as=require(_0x079a('0x10'));var hardwareService=require(_0x079a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x079a('0x12'));var config=require(_0x079a('0x13'));var licenseUtil=require(_0x079a('0x14'));var db=require(_0x079a('0x15'))['db'];config[_0x079a('0x16')]=_[_0x079a('0x17')](config[_0x079a('0x16')],{'host':_0x079a('0x18'),'port':0x18eb});var socket=require(_0x079a('0x19'))(new Redis(config[_0x079a('0x16')]));require(_0x079a('0x1a'))['register'](socket);function respondWithStatusCode(_0x489060,_0x463a6c){_0x463a6c=_0x463a6c||0xcc;return function(_0x17d1fe){if(_0x17d1fe){return _0x489060[_0x079a('0x1b')](_0x463a6c);}return _0x489060['status'](_0x463a6c)[_0x079a('0x1c')]();};}function respondWithResult(_0x4492e4,_0x28c03b){_0x28c03b=_0x28c03b||0xc8;return function(_0xcd8f36){if(_0xcd8f36){return _0x4492e4[_0x079a('0x1d')](_0x28c03b)[_0x079a('0x1e')](_0xcd8f36);}};}function respondWithFilteredResult(_0x21831b,_0x384436){return function(_0x5be00e){if(_0x5be00e){var _0x156ca1=typeof _0x384436[_0x079a('0x1f')]===_0x079a('0x20')&&typeof _0x384436['limit']==='undefined';var _0x215af8=_0x5be00e[_0x079a('0x21')];var _0x470a60=_0x156ca1?0x0:_0x384436[_0x079a('0x1f')];var _0x57ea8b=_0x156ca1?_0x5be00e['count']:_0x384436[_0x079a('0x1f')]+_0x384436[_0x079a('0x22')];var _0x552df7;if(_0x57ea8b>=_0x215af8){_0x57ea8b=_0x215af8;_0x552df7=0xc8;}else{_0x552df7=0xce;}_0x21831b[_0x079a('0x1d')](_0x552df7);return _0x21831b[_0x079a('0x23')](_0x079a('0x24'),_0x470a60+'-'+_0x57ea8b+'/'+_0x215af8)[_0x079a('0x1e')](_0x5be00e);}return null;};}function patchUpdates(_0x122c65){return function(_0x531940){try{jsonpatch['apply'](_0x531940,_0x122c65,!![]);}catch(_0xce7501){return BPromise[_0x079a('0x25')](_0xce7501);}return _0x531940['save']();};}function saveUpdates(_0x2616a9,_0x441c41){return function(_0x47ef24){if(_0x47ef24){return _0x47ef24[_0x079a('0x26')](_0x2616a9)[_0x079a('0x27')](function(_0x55bd18){return _0x55bd18;});}return null;};}function removeEntity(_0x401466,_0x49251d){return function(_0x83c049){if(_0x83c049){return _0x83c049[_0x079a('0x28')]()[_0x079a('0x27')](function(){var _0x3e359f=_0x83c049['get']({'plain':!![]});var _0x527dda=_0x079a('0x29');return db['UserProfileResource'][_0x079a('0x28')]({'where':{'type':_0x527dda,'resourceId':_0x3e359f['id']}})[_0x079a('0x27')](function(){return _0x83c049;});})['then'](function(){_0x401466[_0x079a('0x1d')](0xcc)[_0x079a('0x1c')]();});}};}function handleEntityNotFound(_0xcd7f72,_0x52f165){return function(_0x269306){if(!_0x269306){_0xcd7f72['sendStatus'](0x194);}return _0x269306;};}function handleError(_0x4bb6ce,_0xa26477){_0xa26477=_0xa26477||0x1f4;return function(_0x821113){logger['error'](_0x821113[_0x079a('0x2a')]);if(_0x821113[_0x079a('0x2b')]){delete _0x821113[_0x079a('0x2b')];}_0x4bb6ce[_0x079a('0x1d')](_0xa26477)[_0x079a('0x2c')](_0x821113);};}exports[_0x079a('0x2d')]=function(_0x39d151,_0x32823e){var _0x240003={},_0x1348df={},_0x3f6d48={'count':0x0,'rows':[]};var _0x5c2f3d=_[_0x079a('0x2e')](db['OpenchannelQueue'][_0x079a('0x2f')],function(_0x226c05){return{'name':_0x226c05['fieldName'],'type':_0x226c05[_0x079a('0x30')][_0x079a('0x31')]};});_0x1348df['model']=_[_0x079a('0x2e')](_0x5c2f3d,'name');_0x1348df[_0x079a('0x32')]=_[_0x079a('0x33')](_0x39d151[_0x079a('0x32')]);_0x1348df[_0x079a('0x34')]=_['intersection'](_0x1348df[_0x079a('0x35')],_0x1348df[_0x079a('0x32')]);_0x240003[_0x079a('0x36')]=_['intersection'](_0x1348df[_0x079a('0x35')],qs['fields'](_0x39d151[_0x079a('0x32')]['fields']));_0x240003[_0x079a('0x36')]=_0x240003['attributes']['length']?_0x240003[_0x079a('0x36')]:_0x1348df[_0x079a('0x35')];if(!_0x39d151[_0x079a('0x32')][_0x079a('0x37')](_0x079a('0x38'))){_0x240003[_0x079a('0x22')]=qs[_0x079a('0x22')](_0x39d151[_0x079a('0x32')][_0x079a('0x22')]);_0x240003[_0x079a('0x1f')]=qs[_0x079a('0x1f')](_0x39d151[_0x079a('0x32')][_0x079a('0x1f')]);}_0x240003[_0x079a('0x39')]=qs[_0x079a('0x3a')](_0x39d151[_0x079a('0x32')][_0x079a('0x3a')]);_0x240003[_0x079a('0x3b')]=qs[_0x079a('0x34')](_[_0x079a('0x3c')](_0x39d151[_0x079a('0x32')],_0x1348df[_0x079a('0x34')]),_0x5c2f3d);if(_0x39d151[_0x079a('0x32')][_0x079a('0x3d')]){_0x240003['where']=_['merge'](_0x240003[_0x079a('0x3b')],{'$or':_['map'](_0x5c2f3d,function(_0xe6ac17){if(_0xe6ac17[_0x079a('0x30')]!==_0x079a('0x3e')){var _0x1b2b22={};_0x1b2b22[_0xe6ac17['name']]={'$like':'%'+_0x39d151[_0x079a('0x32')][_0x079a('0x3d')]+'%'};return _0x1b2b22;}})});}_0x240003=_[_0x079a('0x3f')]({},_0x240003,_0x39d151[_0x079a('0x40')]);var _0x67295d={'where':_0x240003['where']};return db[_0x079a('0x41')][_0x079a('0x21')](_0x67295d)[_0x079a('0x27')](function(_0x3bd21d){_0x3f6d48[_0x079a('0x21')]=_0x3bd21d;if(_0x39d151[_0x079a('0x32')][_0x079a('0x42')]){_0x240003[_0x079a('0x43')]=[{'all':!![]}];}return db[_0x079a('0x41')][_0x079a('0x44')](_0x240003);})[_0x079a('0x27')](function(_0xb402e2){_0x3f6d48[_0x079a('0x45')]=_0xb402e2;return _0x3f6d48;})[_0x079a('0x27')](respondWithFilteredResult(_0x32823e,_0x240003))['catch'](handleError(_0x32823e,null));};exports[_0x079a('0x46')]=function(_0x2babf0,_0x389c94){var _0x161f7a={'raw':!![],'where':{'id':_0x2babf0[_0x079a('0x47')]['id']}},_0x3f5bb5={};_0x3f5bb5['model']=_[_0x079a('0x33')](db['OpenchannelQueue'][_0x079a('0x2f')]);_0x3f5bb5['query']=_['keys'](_0x2babf0[_0x079a('0x32')]);_0x3f5bb5[_0x079a('0x34')]=_[_0x079a('0x48')](_0x3f5bb5[_0x079a('0x35')],_0x3f5bb5['query']);_0x161f7a['attributes']=_[_0x079a('0x48')](_0x3f5bb5[_0x079a('0x35')],qs[_0x079a('0x49')](_0x2babf0['query']['fields']));_0x161f7a[_0x079a('0x36')]=_0x161f7a[_0x079a('0x36')][_0x079a('0x4a')]?_0x161f7a[_0x079a('0x36')]:_0x3f5bb5[_0x079a('0x35')];if(_0x2babf0['query']['includeAll']){_0x161f7a[_0x079a('0x43')]=[{'all':!![]}];}_0x161f7a=_[_0x079a('0x3f')]({},_0x161f7a,_0x2babf0['options']);return db[_0x079a('0x41')][_0x079a('0x4b')](_0x161f7a)[_0x079a('0x27')](handleEntityNotFound(_0x389c94,null))[_0x079a('0x27')](respondWithResult(_0x389c94,null))[_0x079a('0x4c')](handleError(_0x389c94,null));};exports[_0x079a('0x4d')]=function(_0x591963,_0x5b1575){return db[_0x079a('0x41')][_0x079a('0x4d')](_0x591963['body'],{})[_0x079a('0x27')](function(_0x1003fb){var _0x39dd4c=_0x591963[_0x079a('0x4e')][_0x079a('0x4f')]({'plain':!![]});if(!_0x39dd4c)throw new Error(_0x079a('0x50'));if(_0x39dd4c[_0x079a('0x51')]===_0x079a('0x4e')){var _0x107c2c=_0x1003fb[_0x079a('0x4f')]({'plain':!![]});var _0x5ddb21=_0x079a('0x29');return db[_0x079a('0x52')]['find']({'where':{'name':_0x5ddb21,'userProfileId':_0x39dd4c[_0x079a('0x53')]},'raw':!![]})[_0x079a('0x27')](function(_0x472151){if(_0x472151&&_0x472151['autoAssociation']===0x0){return db[_0x079a('0x54')][_0x079a('0x4d')]({'name':_0x107c2c[_0x079a('0x2b')],'resourceId':_0x107c2c['id'],'type':_0x472151['name'],'sectionId':_0x472151['id']},{})[_0x079a('0x27')](function(){return _0x1003fb;});}else{return _0x1003fb;}})[_0x079a('0x4c')](function(_0x19e359){logger[_0x079a('0x55')](_0x079a('0x56'),_0x19e359);throw _0x19e359;});}return _0x1003fb;})[_0x079a('0x27')](respondWithResult(_0x5b1575,0xc9))[_0x079a('0x4c')](handleError(_0x5b1575,null));};exports[_0x079a('0x26')]=function(_0x567a36,_0x46e9e7){if(_0x567a36[_0x079a('0x57')]['id']){delete _0x567a36[_0x079a('0x57')]['id'];}return db[_0x079a('0x41')]['find']({'where':{'id':_0x567a36['params']['id']}})[_0x079a('0x27')](handleEntityNotFound(_0x46e9e7,null))[_0x079a('0x27')](saveUpdates(_0x567a36[_0x079a('0x57')],null))[_0x079a('0x27')](respondWithResult(_0x46e9e7,null))[_0x079a('0x4c')](handleError(_0x46e9e7,null));};exports[_0x079a('0x28')]=function(_0x2821cd,_0x31782c){return db[_0x079a('0x41')][_0x079a('0x4b')]({'where':{'id':_0x2821cd[_0x079a('0x47')]['id']}})[_0x079a('0x27')](handleEntityNotFound(_0x31782c,null))[_0x079a('0x27')](removeEntity(_0x31782c,null))[_0x079a('0x4c')](handleError(_0x31782c,null));};exports[_0x079a('0x58')]=function(_0x2d46ff,_0xea65e3){return db[_0x079a('0x41')]['describe']()[_0x079a('0x27')](respondWithResult(_0xea65e3,null))[_0x079a('0x4c')](handleError(_0xea65e3,null));};exports['getMembers']=function(_0x4cfb79,_0x2f3603,_0x199ed3){var _0x4f99da={'raw':!![],'where':{}},_0x2194e4={},_0x19dcf1;return db[_0x079a('0x41')][_0x079a('0x59')]({'where':{'id':_0x4cfb79[_0x079a('0x47')]['id']}})[_0x079a('0x27')](handleEntityNotFound(_0x2f3603,null))['then'](function(_0x59741f){if(_0x59741f){_0x19dcf1=_0x59741f['get']({'plain':!![]});_0x2194e4[_0x079a('0x35')]=_[_0x079a('0x33')](db[_0x079a('0x5a')][_0x079a('0x2f')]);_0x2194e4[_0x079a('0x32')]=_[_0x079a('0x33')](_0x4cfb79[_0x079a('0x32')]);_0x2194e4[_0x079a('0x34')]=_['intersection'](_0x2194e4[_0x079a('0x35')],_0x2194e4[_0x079a('0x32')]);_0x4f99da[_0x079a('0x36')]=_[_0x079a('0x48')](_0x2194e4[_0x079a('0x35')],qs['fields'](_0x4cfb79[_0x079a('0x32')][_0x079a('0x49')]));_0x4f99da[_0x079a('0x36')]=_0x4f99da['attributes'][_0x079a('0x4a')]?_0x4f99da[_0x079a('0x36')]:_0x2194e4['model'];if(!_0x4cfb79['query'][_0x079a('0x37')](_0x079a('0x38'))){_0x4f99da['limit']=qs[_0x079a('0x22')](_0x4cfb79[_0x079a('0x32')][_0x079a('0x22')]);_0x4f99da[_0x079a('0x1f')]=qs[_0x079a('0x1f')](_0x4cfb79['query'][_0x079a('0x1f')]);}_0x4f99da[_0x079a('0x39')]=qs['sort'](_0x4cfb79[_0x079a('0x32')][_0x079a('0x3a')]);_0x4f99da[_0x079a('0x3b')]=qs[_0x079a('0x34')](_[_0x079a('0x3c')](_0x4cfb79[_0x079a('0x32')],_0x2194e4[_0x079a('0x34')]));_0x4f99da['where'][_0x079a('0x5b')]=_0x59741f['id'];if(_0x4cfb79[_0x079a('0x32')][_0x079a('0x3d')]){_0x4f99da[_0x079a('0x3b')]=_[_0x079a('0x3f')](_0x4f99da[_0x079a('0x3b')],{'$or':_[_0x079a('0x2e')](_0x4f99da[_0x079a('0x36')],function(_0x560706){var _0x100ec7={};_0x100ec7[_0x560706]={'$like':'%'+_0x4cfb79[_0x079a('0x32')][_0x079a('0x3d')]+'%'};return _0x100ec7;})});}_0x4f99da=_['merge']({},_0x4f99da,_0x4cfb79[_0x079a('0x40')]);return db[_0x079a('0x5a')][_0x079a('0x44')](_0x4f99da);}})['then'](function(_0x5dc8c7){if(_0x5dc8c7){return db[_0x079a('0x5c')][_0x079a('0x5d')]({'where':{'id':_[_0x079a('0x2e')](_0x5dc8c7,_0x079a('0x5e')),'role':_0x079a('0x5f')},'attributes':['id',_0x079a('0x2b'),_0x079a('0x60'),_0x079a('0x61'),_0x079a('0x62')]});}})['then'](function(_0x5c472e){if(_0x5c472e){return{'count':_0x5c472e['count'],'rows':_['map'](_0x5c472e[_0x079a('0x45')],function(_0x2daf1e){return{'membername':_0x2daf1e['name'],'UserId':_0x2daf1e['id'],'queue_name':_0x19dcf1[_0x079a('0x2b')],'OpenchannelQueueId':_0x19dcf1['id'],'interface':util[_0x079a('0x63')](_0x079a('0x64'),'SIP',_0x2daf1e[_0x079a('0x2b')]),'penalty':0x0,'paused':_0x2daf1e[_0x079a('0x60')],'createdAt':_0x2daf1e[_0x079a('0x62')],'updatedAt':_0x2daf1e[_0x079a('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2f3603,_0x4f99da))[_0x079a('0x4c')](handleError(_0x2f3603,null));};exports[_0x079a('0x65')]=function(_0x3f80e2,_0x50969f,_0x5ab070){var _0x3f8471={};var _0x5a7b80={};var _0x5b60ff;var _0x3be1a2;return db[_0x079a('0x41')][_0x079a('0x59')]({'where':{'id':_0x3f80e2['params']['id']}})[_0x079a('0x27')](handleEntityNotFound(_0x50969f,null))['then'](function(_0x47af2a){if(_0x47af2a){_0x5b60ff=_0x47af2a;_0x5a7b80[_0x079a('0x35')]=_[_0x079a('0x33')](db[_0x079a('0x66')]['rawAttributes']);_0x5a7b80[_0x079a('0x32')]=_[_0x079a('0x33')](_0x3f80e2[_0x079a('0x32')]);_0x5a7b80[_0x079a('0x34')]=_[_0x079a('0x48')](_0x5a7b80['model'],_0x5a7b80[_0x079a('0x32')]);_0x3f8471[_0x079a('0x36')]=_[_0x079a('0x48')](_0x5a7b80[_0x079a('0x35')],qs[_0x079a('0x49')](_0x3f80e2[_0x079a('0x32')][_0x079a('0x49')]));_0x3f8471[_0x079a('0x36')]=_0x3f8471[_0x079a('0x36')][_0x079a('0x4a')]?_0x3f8471[_0x079a('0x36')]:_0x5a7b80[_0x079a('0x35')];_0x3f8471[_0x079a('0x39')]=qs[_0x079a('0x3a')](_0x3f80e2[_0x079a('0x32')]['sort']);_0x3f8471[_0x079a('0x3b')]=qs['filters'](_[_0x079a('0x3c')](_0x3f80e2['query'],_0x5a7b80[_0x079a('0x34')]));if(_0x3f80e2[_0x079a('0x32')][_0x079a('0x3d')]){_0x3f8471['where']=_[_0x079a('0x3f')](_0x3f8471[_0x079a('0x3b')],{'$or':_[_0x079a('0x2e')](_0x3f8471[_0x079a('0x36')],function(_0x4f6ac2){var _0x44427c={};_0x44427c[_0x4f6ac2]={'$like':'%'+_0x3f80e2[_0x079a('0x32')]['filter']+'%'};return _0x44427c;})});}_0x3f8471=_[_0x079a('0x3f')]({},_0x3f8471,_0x3f80e2[_0x079a('0x40')]);return _0x5b60ff['getTeams'](_0x3f8471);}})[_0x079a('0x27')](function(_0x143b15){if(_0x143b15){_0x3be1a2=_0x143b15[_0x079a('0x4a')];if(!_0x3f80e2[_0x079a('0x32')][_0x079a('0x37')](_0x079a('0x38'))){_0x3f8471[_0x079a('0x22')]=qs[_0x079a('0x22')](_0x3f80e2[_0x079a('0x32')]['limit']);_0x3f8471[_0x079a('0x1f')]=qs['offset'](_0x3f80e2[_0x079a('0x32')][_0x079a('0x1f')]);}return _0x5b60ff['getTeams'](_0x3f8471);}})[_0x079a('0x27')](function(_0x42000d){if(_0x42000d){return _0x42000d?{'count':_0x3be1a2,'rows':_0x42000d}:null;}})[_0x079a('0x27')](respondWithResult(_0x50969f,null))[_0x079a('0x4c')](handleError(_0x50969f,null));};exports[_0x079a('0x67')]=function(_0x37803f,_0xf69e17,_0x10dbd5){var _0x3d9629=_0x37803f['body'][_0x079a('0x68')];return db[_0x079a('0x66')][_0x079a('0x44')]({'where':{'id':_0x3d9629},'attributes':['id'],'include':[{'model':db[_0x079a('0x5c')],'as':_0x079a('0x69'),'attributes':['id','name',_0x079a('0x6a'),_0x079a('0x6b'),_0x079a('0x6c')],'raw':!![]}]})[_0x079a('0x27')](function(_0x479720){if(_0x479720){var _0x3507f4=_[_0x079a('0x6d')](_0x479720,function(_0x315311){var _0x56d689=_0x315311['get']({'plain':!![]});return _0x56d689[_0x079a('0x69')];});return db[_0x079a('0x41')][_0x079a('0x4b')]({'where':{'id':_0x37803f[_0x079a('0x47')]['id']}})['then'](function(_0x551061){return db[_0x079a('0x6e')][_0x079a('0x6f')](function(_0x1c2780){return _0x551061['addTeams'](_0x3d9629,{'transaction':_0x1c2780})[_0x079a('0x27')](function(){return BPromise[_0x079a('0x70')](_0x3507f4,function(_0x1fa032){return db[_0x079a('0x5a')]['findOrCreate']({'where':{'UserId':_0x1fa032['id'],'OpenchannelQueueId':_0x37803f[_0x079a('0x47')]['id']},'transaction':_0x1c2780});});})['then'](function(){_0x3507f4[_0x079a('0x71')](function(_0x1a5c5e){socket[_0x079a('0x72')](_0x079a('0x73'),{'UserId':_0x1a5c5e['id'],'OpenchannelQueueId':_0x551061['id']});});});});});}})[_0x079a('0x27')](respondWithStatusCode(_0xf69e17,null))['catch'](handleError(_0xf69e17,null));};exports[_0x079a('0x74')]=function(_0x5995fb,_0x482fc5,_0x536f23){return db[_0x079a('0x66')][_0x079a('0x44')]({'where':{'id':_0x5995fb[_0x079a('0x32')][_0x079a('0x68')]},'attributes':['id'],'include':[{'model':db[_0x079a('0x5c')],'as':_0x079a('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x482fc5,null))['then'](function(_0x4c18ed){var _0x3a804b=_[_0x079a('0x2e')](_0x4c18ed,'id');var _0x16ad13=[];var _0x8b671d=[];var _0x1ac3ca=squel[_0x079a('0x75')]();_0x1ac3ca[_0x079a('0x76')](_0x079a('0x77'))[_0x079a('0x78')]('team_has_openchannel_queues','tq')[_0x079a('0x79')](_0x079a('0x7a'),'ut',_0x079a('0x7b'))[_0x079a('0x3b')](_0x079a('0x7c'),_0x5995fb[_0x079a('0x47')]['id']);for(var _0x2e0bee=0x0;_0x2e0bee<_0x4c18ed[_0x079a('0x4a')];_0x2e0bee+=0x1){let _0x47a707=_0x4c18ed[_0x2e0bee];for(var _0x297232=0x0;_0x297232<_0x47a707['Agents']['length'];_0x297232+=0x1){let _0x2fb7af=_0x47a707[_0x079a('0x69')][_0x297232];var _0x3736a9=_0x1ac3ca[_0x079a('0x7d')]();_0x3736a9[_0x079a('0x3b')](_0x079a('0x7e'),_0x2fb7af['id']);_0x8b671d[_0x079a('0x7f')](db['sequelize'][_0x079a('0x32')](_0x3736a9[_0x079a('0x80')](),{'type':db[_0x079a('0x6e')][_0x079a('0x81')][_0x079a('0x82')]})['then'](function(_0x1d27a2){if(_0x1d27a2[_0x079a('0x4a')]===0x1){return _0x2fb7af['id'];}else{var _0xe71872=_[_0x079a('0x83')](_[_0x079a('0x2e')](_0x1d27a2,_0x079a('0x84')),function(_0xe1f97a){return _['includes'](_0x3a804b,_0xe1f97a);});if(_0xe71872){return _0x2fb7af['id'];}}}));}}return BPromise['all'](_0x8b671d)[_0x079a('0x27')](function(_0x13deee){_0x16ad13=_(_0x16ad13)[_0x079a('0x85')](_0x13deee)[_0x079a('0x86')]()[_0x079a('0x87')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x5995fb[_0x079a('0x47')]['id']}})[_0x079a('0x27')](function(_0x324ecf){return db['sequelize']['transaction'](function(_0x3ccb01){return _0x324ecf['removeTeams'](_0x5995fb[_0x079a('0x32')][_0x079a('0x68')],{'transaction':_0x3ccb01})[_0x079a('0x27')](function(){if(!_[_0x079a('0x88')](_0x16ad13)){return _0x324ecf[_0x079a('0x89')](_0x16ad13,{'transaction':_0x3ccb01});}})[_0x079a('0x27')](function(){_0x16ad13[_0x079a('0x71')](function(_0x2f4e69){socket['emit'](_0x079a('0x8a'),{'UserId':_0x2f4e69,'OpenchannelQueueId':_0x324ecf['id']});});});});});});})[_0x079a('0x27')](respondWithStatusCode(_0x482fc5,null))['catch'](handleError(_0x482fc5,null));};exports['addAgents']=function(_0x1eb9f2,_0x45a64e,_0x4b0114){return db['OpenchannelQueue'][_0x079a('0x4b')]({'where':{'id':_0x1eb9f2[_0x079a('0x47')]['id']}})[_0x079a('0x27')](handleEntityNotFound(_0x45a64e,null))[_0x079a('0x27')](function(_0x34ca2c){if(_0x34ca2c){return _0x34ca2c['addAgents'](_0x1eb9f2[_0x079a('0x57')]['ids'],_['omit'](_0x1eb9f2['body'],[_0x079a('0x68'),'id'])||{})[_0x079a('0x8b')](function(_0x4063b5){for(var _0x25acb3=0x0;_0x25acb3<_0x1eb9f2[_0x079a('0x57')][_0x079a('0x68')][_0x079a('0x4a')];_0x25acb3+=0x1){socket[_0x079a('0x72')](_0x079a('0x73'),{'UserId':Number(_0x1eb9f2[_0x079a('0x57')][_0x079a('0x68')][_0x25acb3]),'OpenchannelQueueId':Number(_0x1eb9f2[_0x079a('0x47')]['id'])});}return _0x4063b5;});}})[_0x079a('0x27')](respondWithResult(_0x45a64e,null))[_0x079a('0x4c')](handleError(_0x45a64e,null));};exports['removeAgents']=function(_0x7cff5d,_0x4a7f6c,_0x58a361){return db[_0x079a('0x41')][_0x079a('0x4b')]({'where':{'id':_0x7cff5d['params']['id']}})[_0x079a('0x27')](handleEntityNotFound(_0x4a7f6c,null))[_0x079a('0x27')](function(_0xcc4e6e){if(_0xcc4e6e){return _0xcc4e6e[_0x079a('0x89')](_0x7cff5d[_0x079a('0x32')][_0x079a('0x68')])['then'](function(){if(_[_0x079a('0x8c')](_0x7cff5d[_0x079a('0x32')][_0x079a('0x68')])){for(var _0x3528e1=0x0;_0x3528e1<_0x7cff5d[_0x079a('0x32')][_0x079a('0x68')][_0x079a('0x4a')];_0x3528e1+=0x1){socket[_0x079a('0x72')](_0x079a('0x8a'),{'UserId':Number(_0x7cff5d[_0x079a('0x32')][_0x079a('0x68')][_0x3528e1]),'OpenchannelQueueId':Number(_0x7cff5d['params']['id'])});}}else{socket[_0x079a('0x72')](_0x079a('0x8a'),{'UserId':Number(_0x7cff5d[_0x079a('0x32')]['ids']),'OpenchannelQueueId':Number(_0x7cff5d[_0x079a('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x4a7f6c,null))[_0x079a('0x4c')](handleError(_0x4a7f6c,null));};exports['getAgents']=function(_0x1e1dca,_0xc98fa4,_0x5cb8f5){var _0x3f6a3e={};var _0xb2cd9e={};var _0x27394f;var _0x1486d9;return db['OpenchannelQueue'][_0x079a('0x59')]({'where':{'id':_0x1e1dca[_0x079a('0x47')]['id']}})['then'](handleEntityNotFound(_0xc98fa4,null))[_0x079a('0x27')](function(_0x19d99c){if(_0x19d99c){_0x27394f=_0x19d99c;_0xb2cd9e[_0x079a('0x35')]=_[_0x079a('0x33')](db['User'][_0x079a('0x2f')]);_0xb2cd9e[_0x079a('0x32')]=_['keys'](_0x1e1dca['query']);_0xb2cd9e[_0x079a('0x34')]=_[_0x079a('0x48')](_0xb2cd9e[_0x079a('0x35')],_0xb2cd9e[_0x079a('0x32')]);_0x3f6a3e[_0x079a('0x36')]=_[_0x079a('0x48')](_0xb2cd9e['model'],qs[_0x079a('0x49')](_0x1e1dca[_0x079a('0x32')]['fields']));_0x3f6a3e['attributes']=_0x3f6a3e[_0x079a('0x36')][_0x079a('0x4a')]?_0x3f6a3e['attributes']:_0xb2cd9e[_0x079a('0x35')];_0x3f6a3e[_0x079a('0x39')]=qs[_0x079a('0x3a')](_0x1e1dca[_0x079a('0x32')][_0x079a('0x3a')]);_0x3f6a3e[_0x079a('0x3b')]=qs[_0x079a('0x34')](_[_0x079a('0x3c')](_0x1e1dca['query'],_0xb2cd9e[_0x079a('0x34')]));if(_0x1e1dca[_0x079a('0x32')]['filter']){_0x3f6a3e['where']=_[_0x079a('0x3f')](_0x3f6a3e[_0x079a('0x3b')],{'$or':_[_0x079a('0x2e')](_0x3f6a3e['attributes'],function(_0x18a639){var _0x451704={};_0x451704[_0x18a639]={'$like':'%'+_0x1e1dca['query'][_0x079a('0x3d')]+'%'};return _0x451704;})});}_0x3f6a3e=_[_0x079a('0x3f')]({},_0x3f6a3e,_0x1e1dca[_0x079a('0x40')]);return _0x27394f[_0x079a('0x8d')](_0x3f6a3e);}})[_0x079a('0x27')](function(_0x1364b0){if(_0x1364b0){_0x1486d9=_0x1364b0[_0x079a('0x4a')];if(!_0x1e1dca['query'][_0x079a('0x37')](_0x079a('0x38'))){_0x3f6a3e[_0x079a('0x22')]=qs[_0x079a('0x22')](_0x1e1dca[_0x079a('0x32')][_0x079a('0x22')]);_0x3f6a3e[_0x079a('0x1f')]=qs['offset'](_0x1e1dca[_0x079a('0x32')][_0x079a('0x1f')]);}return _0x27394f[_0x079a('0x8d')](_0x3f6a3e);}})[_0x079a('0x27')](function(_0x48337d){if(_0x48337d){return _0x48337d?{'count':_0x1486d9,'rows':_0x48337d}:null;}})[_0x079a('0x27')](respondWithResult(_0xc98fa4,null))['catch'](handleError(_0xc98fa4,null));}; \ No newline at end of file +var _0xbae7=['%s/%s','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','User','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','save','update','then','UserProfileResource','destroy','error','stack','name','index','OpenchannelQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','OpenchannelQueues','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format'];(function(_0x162f62,_0x1a0ab1){var _0x26c56e=function(_0x1ae1ac){while(--_0x1ae1ac){_0x162f62['push'](_0x162f62['shift']());}};_0x26c56e(++_0x1a0ab1);}(_0xbae7,0x14a));var _0x7bae=function(_0x4d9d88,_0x7088fd){_0x4d9d88=_0x4d9d88-0x0;var _0x4dba70=_0xbae7[_0x4d9d88];return _0x4dba70;};'use strict';var emlformat=require(_0x7bae('0x0'));var rimraf=require(_0x7bae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bae('0x2'));var rp=require(_0x7bae('0x3'));var moment=require('moment');var BPromise=require(_0x7bae('0x4'));var Mustache=require(_0x7bae('0x5'));var util=require('util');var path=require(_0x7bae('0x6'));var sox=require(_0x7bae('0x7'));var csv=require(_0x7bae('0x8'));var ejs=require(_0x7bae('0x9'));var fs=require('fs');var fs_extra=require(_0x7bae('0xa'));var _=require('lodash');var squel=require(_0x7bae('0xb'));var crypto=require(_0x7bae('0xc'));var jsforce=require(_0x7bae('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7bae('0xe'));var Papa=require(_0x7bae('0xf'));var Redis=require(_0x7bae('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7bae('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bae('0x12'));var logger=require(_0x7bae('0x13'))(_0x7bae('0x14'));var utils=require('../../config/utils');var config=require(_0x7bae('0x15'));var licenseUtil=require(_0x7bae('0x16'));var db=require(_0x7bae('0x17'))['db'];config['redis']=_[_0x7bae('0x18')](config['redis'],{'host':_0x7bae('0x19'),'port':0x18eb});var socket=require(_0x7bae('0x1a'))(new Redis(config[_0x7bae('0x1b')]));require(_0x7bae('0x1c'))[_0x7bae('0x1d')](socket);function respondWithStatusCode(_0x2aef6f,_0x2e877a){_0x2e877a=_0x2e877a||0xcc;return function(_0x2dec75){if(_0x2dec75){return _0x2aef6f[_0x7bae('0x1e')](_0x2e877a);}return _0x2aef6f['status'](_0x2e877a)[_0x7bae('0x1f')]();};}function respondWithResult(_0x10d7fa,_0x766b36){_0x766b36=_0x766b36||0xc8;return function(_0x1d24bc){if(_0x1d24bc){return _0x10d7fa['status'](_0x766b36)[_0x7bae('0x20')](_0x1d24bc);}};}function respondWithFilteredResult(_0x1b79f5,_0x2aa878){return function(_0x3df5ae){if(_0x3df5ae){var _0x434f76=typeof _0x2aa878[_0x7bae('0x21')]===_0x7bae('0x22')&&typeof _0x2aa878[_0x7bae('0x23')]===_0x7bae('0x22');var _0x3145fa=_0x3df5ae[_0x7bae('0x24')];var _0x50b170=_0x434f76?0x0:_0x2aa878[_0x7bae('0x21')];var _0x414687=_0x434f76?_0x3df5ae[_0x7bae('0x24')]:_0x2aa878[_0x7bae('0x21')]+_0x2aa878['limit'];var _0x1b20a1;if(_0x414687>=_0x3145fa){_0x414687=_0x3145fa;_0x1b20a1=0xc8;}else{_0x1b20a1=0xce;}_0x1b79f5[_0x7bae('0x25')](_0x1b20a1);return _0x1b79f5[_0x7bae('0x26')](_0x7bae('0x27'),_0x50b170+'-'+_0x414687+'/'+_0x3145fa)[_0x7bae('0x20')](_0x3df5ae);}return null;};}function patchUpdates(_0x597a19){return function(_0x2fc8d0){try{jsonpatch['apply'](_0x2fc8d0,_0x597a19,!![]);}catch(_0x3cdac6){return BPromise['reject'](_0x3cdac6);}return _0x2fc8d0[_0x7bae('0x28')]();};}function saveUpdates(_0x1b2800,_0x2d1f57){return function(_0x1cdbfe){if(_0x1cdbfe){return _0x1cdbfe[_0x7bae('0x29')](_0x1b2800)[_0x7bae('0x2a')](function(_0x5597d8){return _0x5597d8;});}return null;};}function removeEntity(_0x35dd66,_0x232f29){return function(_0x301ae2){if(_0x301ae2){return _0x301ae2['destroy']()['then'](function(){var _0x540e6e=_0x301ae2['get']({'plain':!![]});var _0x38c6fb='OpenchannelQueues';return db[_0x7bae('0x2b')][_0x7bae('0x2c')]({'where':{'type':_0x38c6fb,'resourceId':_0x540e6e['id']}})['then'](function(){return _0x301ae2;});})[_0x7bae('0x2a')](function(){_0x35dd66[_0x7bae('0x25')](0xcc)[_0x7bae('0x1f')]();});}};}function handleEntityNotFound(_0x141d40,_0x130ec7){return function(_0x345351){if(!_0x345351){_0x141d40['sendStatus'](0x194);}return _0x345351;};}function handleError(_0x1f7ae3,_0x7e898b){_0x7e898b=_0x7e898b||0x1f4;return function(_0x569076){logger[_0x7bae('0x2d')](_0x569076[_0x7bae('0x2e')]);if(_0x569076[_0x7bae('0x2f')]){delete _0x569076[_0x7bae('0x2f')];}_0x1f7ae3['status'](_0x7e898b)['send'](_0x569076);};}exports[_0x7bae('0x30')]=function(_0x522fbb,_0x53442c){var _0x503974={},_0x3c8eab={},_0xa60093={'count':0x0,'rows':[]};var _0x1ce95b=_['map'](db[_0x7bae('0x31')][_0x7bae('0x32')],function(_0x5c641b){return{'name':_0x5c641b[_0x7bae('0x33')],'type':_0x5c641b[_0x7bae('0x34')][_0x7bae('0x35')]};});_0x3c8eab[_0x7bae('0x36')]=_[_0x7bae('0x37')](_0x1ce95b,_0x7bae('0x2f'));_0x3c8eab[_0x7bae('0x38')]=_[_0x7bae('0x39')](_0x522fbb[_0x7bae('0x38')]);_0x3c8eab[_0x7bae('0x3a')]=_[_0x7bae('0x3b')](_0x3c8eab[_0x7bae('0x36')],_0x3c8eab[_0x7bae('0x38')]);_0x503974[_0x7bae('0x3c')]=_[_0x7bae('0x3b')](_0x3c8eab[_0x7bae('0x36')],qs[_0x7bae('0x3d')](_0x522fbb[_0x7bae('0x38')][_0x7bae('0x3d')]));_0x503974[_0x7bae('0x3c')]=_0x503974[_0x7bae('0x3c')][_0x7bae('0x3e')]?_0x503974[_0x7bae('0x3c')]:_0x3c8eab[_0x7bae('0x36')];if(!_0x522fbb[_0x7bae('0x38')][_0x7bae('0x3f')](_0x7bae('0x40'))){_0x503974[_0x7bae('0x23')]=qs[_0x7bae('0x23')](_0x522fbb[_0x7bae('0x38')][_0x7bae('0x23')]);_0x503974[_0x7bae('0x21')]=qs['offset'](_0x522fbb[_0x7bae('0x38')][_0x7bae('0x21')]);}_0x503974[_0x7bae('0x41')]=qs[_0x7bae('0x42')](_0x522fbb['query'][_0x7bae('0x42')]);_0x503974[_0x7bae('0x43')]=qs[_0x7bae('0x3a')](_[_0x7bae('0x44')](_0x522fbb[_0x7bae('0x38')],_0x3c8eab[_0x7bae('0x3a')]),_0x1ce95b);if(_0x522fbb[_0x7bae('0x38')]['filter']){_0x503974[_0x7bae('0x43')]=_[_0x7bae('0x45')](_0x503974['where'],{'$or':_['map'](_0x1ce95b,function(_0x5ab172){if(_0x5ab172[_0x7bae('0x34')]!==_0x7bae('0x46')){var _0x1d4c61={};_0x1d4c61[_0x5ab172[_0x7bae('0x2f')]]={'$like':'%'+_0x522fbb[_0x7bae('0x38')][_0x7bae('0x47')]+'%'};return _0x1d4c61;}})});}_0x503974=_[_0x7bae('0x45')]({},_0x503974,_0x522fbb['options']);var _0x146c10={'where':_0x503974[_0x7bae('0x43')]};return db[_0x7bae('0x31')][_0x7bae('0x24')](_0x146c10)[_0x7bae('0x2a')](function(_0x1090a7){_0xa60093[_0x7bae('0x24')]=_0x1090a7;if(_0x522fbb[_0x7bae('0x38')][_0x7bae('0x48')]){_0x503974['include']=[{'all':!![]}];}return db[_0x7bae('0x31')][_0x7bae('0x49')](_0x503974);})['then'](function(_0x1ea64a){_0xa60093[_0x7bae('0x4a')]=_0x1ea64a;return _0xa60093;})[_0x7bae('0x2a')](respondWithFilteredResult(_0x53442c,_0x503974))[_0x7bae('0x4b')](handleError(_0x53442c,null));};exports[_0x7bae('0x4c')]=function(_0x5c92f0,_0x1475b2){var _0x5de7c6={'raw':!![],'where':{'id':_0x5c92f0[_0x7bae('0x4d')]['id']}},_0x3e8c2a={};_0x3e8c2a['model']=_[_0x7bae('0x39')](db[_0x7bae('0x31')]['rawAttributes']);_0x3e8c2a[_0x7bae('0x38')]=_[_0x7bae('0x39')](_0x5c92f0[_0x7bae('0x38')]);_0x3e8c2a['filters']=_['intersection'](_0x3e8c2a[_0x7bae('0x36')],_0x3e8c2a['query']);_0x5de7c6['attributes']=_[_0x7bae('0x3b')](_0x3e8c2a[_0x7bae('0x36')],qs[_0x7bae('0x3d')](_0x5c92f0[_0x7bae('0x38')]['fields']));_0x5de7c6[_0x7bae('0x3c')]=_0x5de7c6[_0x7bae('0x3c')]['length']?_0x5de7c6[_0x7bae('0x3c')]:_0x3e8c2a[_0x7bae('0x36')];if(_0x5c92f0[_0x7bae('0x38')][_0x7bae('0x48')]){_0x5de7c6[_0x7bae('0x4e')]=[{'all':!![]}];}_0x5de7c6=_[_0x7bae('0x45')]({},_0x5de7c6,_0x5c92f0[_0x7bae('0x4f')]);return db[_0x7bae('0x31')][_0x7bae('0x50')](_0x5de7c6)[_0x7bae('0x2a')](handleEntityNotFound(_0x1475b2,null))[_0x7bae('0x2a')](respondWithResult(_0x1475b2,null))[_0x7bae('0x4b')](handleError(_0x1475b2,null));};exports['create']=function(_0x4b75b0,_0x2a147e){return db['OpenchannelQueue'][_0x7bae('0x51')](_0x4b75b0[_0x7bae('0x52')],{})[_0x7bae('0x2a')](function(_0x1f7c44){var _0x38b165=_0x4b75b0[_0x7bae('0x53')]['get']({'plain':!![]});if(!_0x38b165)throw new Error(_0x7bae('0x54'));if(_0x38b165['role']===_0x7bae('0x53')){var _0x3ace54=_0x1f7c44[_0x7bae('0x55')]({'plain':!![]});var _0xae95fa=_0x7bae('0x56');return db['UserProfileSection'][_0x7bae('0x50')]({'where':{'name':_0xae95fa,'userProfileId':_0x38b165['userProfileId']},'raw':!![]})[_0x7bae('0x2a')](function(_0x217366){if(_0x217366&&_0x217366[_0x7bae('0x57')]===0x0){return db['UserProfileResource'][_0x7bae('0x51')]({'name':_0x3ace54['name'],'resourceId':_0x3ace54['id'],'type':_0x217366[_0x7bae('0x2f')],'sectionId':_0x217366['id']},{})[_0x7bae('0x2a')](function(){return _0x1f7c44;});}else{return _0x1f7c44;}})[_0x7bae('0x4b')](function(_0x5229cc){logger['error'](_0x7bae('0x58'),_0x5229cc);throw _0x5229cc;});}return _0x1f7c44;})[_0x7bae('0x2a')](respondWithResult(_0x2a147e,0xc9))[_0x7bae('0x4b')](handleError(_0x2a147e,null));};exports[_0x7bae('0x29')]=function(_0x45d4b7,_0x3f8556){if(_0x45d4b7['body']['id']){delete _0x45d4b7['body']['id'];}return db[_0x7bae('0x31')][_0x7bae('0x50')]({'where':{'id':_0x45d4b7[_0x7bae('0x4d')]['id']}})[_0x7bae('0x2a')](handleEntityNotFound(_0x3f8556,null))[_0x7bae('0x2a')](saveUpdates(_0x45d4b7[_0x7bae('0x52')],null))[_0x7bae('0x2a')](respondWithResult(_0x3f8556,null))[_0x7bae('0x4b')](handleError(_0x3f8556,null));};exports[_0x7bae('0x2c')]=function(_0x4bf662,_0x27ea28){return db[_0x7bae('0x31')][_0x7bae('0x50')]({'where':{'id':_0x4bf662[_0x7bae('0x4d')]['id']}})[_0x7bae('0x2a')](handleEntityNotFound(_0x27ea28,null))[_0x7bae('0x2a')](removeEntity(_0x27ea28,null))['catch'](handleError(_0x27ea28,null));};exports[_0x7bae('0x59')]=function(_0x54c796,_0x3e5cad){return db[_0x7bae('0x31')][_0x7bae('0x59')]()[_0x7bae('0x2a')](respondWithResult(_0x3e5cad,null))[_0x7bae('0x4b')](handleError(_0x3e5cad,null));};exports[_0x7bae('0x5a')]=function(_0x1f7afe,_0x212ecf,_0x245d58){var _0x36e003={'raw':!![],'where':{}},_0x12eba0={},_0x4d9e58;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x1f7afe[_0x7bae('0x4d')]['id']}})[_0x7bae('0x2a')](handleEntityNotFound(_0x212ecf,null))[_0x7bae('0x2a')](function(_0x50fee0){if(_0x50fee0){_0x4d9e58=_0x50fee0[_0x7bae('0x55')]({'plain':!![]});_0x12eba0[_0x7bae('0x36')]=_['keys'](db[_0x7bae('0x5b')][_0x7bae('0x32')]);_0x12eba0[_0x7bae('0x38')]=_[_0x7bae('0x39')](_0x1f7afe['query']);_0x12eba0[_0x7bae('0x3a')]=_[_0x7bae('0x3b')](_0x12eba0[_0x7bae('0x36')],_0x12eba0[_0x7bae('0x38')]);_0x36e003[_0x7bae('0x3c')]=_[_0x7bae('0x3b')](_0x12eba0[_0x7bae('0x36')],qs[_0x7bae('0x3d')](_0x1f7afe[_0x7bae('0x38')]['fields']));_0x36e003['attributes']=_0x36e003[_0x7bae('0x3c')][_0x7bae('0x3e')]?_0x36e003[_0x7bae('0x3c')]:_0x12eba0[_0x7bae('0x36')];if(!_0x1f7afe['query'][_0x7bae('0x3f')](_0x7bae('0x40'))){_0x36e003[_0x7bae('0x23')]=qs[_0x7bae('0x23')](_0x1f7afe[_0x7bae('0x38')][_0x7bae('0x23')]);_0x36e003['offset']=qs[_0x7bae('0x21')](_0x1f7afe[_0x7bae('0x38')][_0x7bae('0x21')]);}_0x36e003['order']=qs[_0x7bae('0x42')](_0x1f7afe[_0x7bae('0x38')][_0x7bae('0x42')]);_0x36e003[_0x7bae('0x43')]=qs['filters'](_[_0x7bae('0x44')](_0x1f7afe[_0x7bae('0x38')],_0x12eba0[_0x7bae('0x3a')]));_0x36e003['where']['OpenchannelQueueId']=_0x50fee0['id'];if(_0x1f7afe[_0x7bae('0x38')][_0x7bae('0x47')]){_0x36e003[_0x7bae('0x43')]=_['merge'](_0x36e003[_0x7bae('0x43')],{'$or':_['map'](_0x36e003[_0x7bae('0x3c')],function(_0x571bb9){var _0x257728={};_0x257728[_0x571bb9]={'$like':'%'+_0x1f7afe[_0x7bae('0x38')][_0x7bae('0x47')]+'%'};return _0x257728;})});}_0x36e003=_[_0x7bae('0x45')]({},_0x36e003,_0x1f7afe['options']);return db[_0x7bae('0x5b')][_0x7bae('0x49')](_0x36e003);}})[_0x7bae('0x2a')](function(_0x496b3d){if(_0x496b3d){return db['User'][_0x7bae('0x5c')]({'where':{'id':_[_0x7bae('0x37')](_0x496b3d,_0x7bae('0x5d')),'role':_0x7bae('0x5e')},'attributes':['id',_0x7bae('0x2f'),_0x7bae('0x5f'),_0x7bae('0x60'),_0x7bae('0x61')]});}})[_0x7bae('0x2a')](function(_0x34573a){if(_0x34573a){return{'count':_0x34573a['count'],'rows':_['map'](_0x34573a[_0x7bae('0x4a')],function(_0x536116){return{'membername':_0x536116[_0x7bae('0x2f')],'UserId':_0x536116['id'],'queue_name':_0x4d9e58[_0x7bae('0x2f')],'OpenchannelQueueId':_0x4d9e58['id'],'interface':util[_0x7bae('0x62')](_0x7bae('0x63'),'SIP',_0x536116[_0x7bae('0x2f')]),'penalty':0x0,'paused':_0x536116[_0x7bae('0x5f')],'createdAt':_0x536116[_0x7bae('0x61')],'updatedAt':_0x536116[_0x7bae('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x212ecf,_0x36e003))[_0x7bae('0x4b')](handleError(_0x212ecf,null));};exports[_0x7bae('0x64')]=function(_0x11eb25,_0x50c2ef,_0x149cf0){var _0x54d607={};var _0x1df990={};var _0x52044c;var _0x3eab32;return db['OpenchannelQueue'][_0x7bae('0x65')]({'where':{'id':_0x11eb25['params']['id']}})[_0x7bae('0x2a')](handleEntityNotFound(_0x50c2ef,null))[_0x7bae('0x2a')](function(_0x120e72){if(_0x120e72){_0x52044c=_0x120e72;_0x1df990[_0x7bae('0x36')]=_[_0x7bae('0x39')](db[_0x7bae('0x66')][_0x7bae('0x32')]);_0x1df990[_0x7bae('0x38')]=_['keys'](_0x11eb25['query']);_0x1df990[_0x7bae('0x3a')]=_[_0x7bae('0x3b')](_0x1df990['model'],_0x1df990[_0x7bae('0x38')]);_0x54d607['attributes']=_[_0x7bae('0x3b')](_0x1df990[_0x7bae('0x36')],qs[_0x7bae('0x3d')](_0x11eb25['query'][_0x7bae('0x3d')]));_0x54d607[_0x7bae('0x3c')]=_0x54d607[_0x7bae('0x3c')][_0x7bae('0x3e')]?_0x54d607[_0x7bae('0x3c')]:_0x1df990[_0x7bae('0x36')];_0x54d607[_0x7bae('0x41')]=qs[_0x7bae('0x42')](_0x11eb25[_0x7bae('0x38')]['sort']);_0x54d607[_0x7bae('0x43')]=qs[_0x7bae('0x3a')](_[_0x7bae('0x44')](_0x11eb25[_0x7bae('0x38')],_0x1df990[_0x7bae('0x3a')]));if(_0x11eb25[_0x7bae('0x38')][_0x7bae('0x47')]){_0x54d607[_0x7bae('0x43')]=_[_0x7bae('0x45')](_0x54d607[_0x7bae('0x43')],{'$or':_[_0x7bae('0x37')](_0x54d607[_0x7bae('0x3c')],function(_0x165558){var _0x943652={};_0x943652[_0x165558]={'$like':'%'+_0x11eb25['query'][_0x7bae('0x47')]+'%'};return _0x943652;})});}_0x54d607=_[_0x7bae('0x45')]({},_0x54d607,_0x11eb25['options']);return _0x52044c[_0x7bae('0x64')](_0x54d607);}})['then'](function(_0x930e04){if(_0x930e04){_0x3eab32=_0x930e04['length'];if(!_0x11eb25[_0x7bae('0x38')][_0x7bae('0x3f')](_0x7bae('0x40'))){_0x54d607['limit']=qs['limit'](_0x11eb25[_0x7bae('0x38')]['limit']);_0x54d607[_0x7bae('0x21')]=qs[_0x7bae('0x21')](_0x11eb25['query'][_0x7bae('0x21')]);}return _0x52044c[_0x7bae('0x64')](_0x54d607);}})[_0x7bae('0x2a')](function(_0x8e0a44){if(_0x8e0a44){return _0x8e0a44?{'count':_0x3eab32,'rows':_0x8e0a44}:null;}})['then'](respondWithResult(_0x50c2ef,null))[_0x7bae('0x4b')](handleError(_0x50c2ef,null));};exports[_0x7bae('0x67')]=function(_0x270b5c,_0x1a04d5,_0x575932){var _0x34e0d6=_0x270b5c['body'][_0x7bae('0x68')];return db[_0x7bae('0x66')]['findAll']({'where':{'id':_0x34e0d6},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7bae('0x69'),'attributes':['id','name',_0x7bae('0x6a'),_0x7bae('0x6b'),'interface'],'raw':!![]}]})[_0x7bae('0x2a')](function(_0x4dc1a8){if(_0x4dc1a8){var _0x1bc34b=_[_0x7bae('0x6c')](_0x4dc1a8,function(_0xdba55b){var _0x1d7372=_0xdba55b['get']({'plain':!![]});return _0x1d7372[_0x7bae('0x69')];});return db[_0x7bae('0x31')][_0x7bae('0x50')]({'where':{'id':_0x270b5c[_0x7bae('0x4d')]['id']}})[_0x7bae('0x2a')](function(_0x42bb9b){return db['sequelize'][_0x7bae('0x6d')](function(_0x4990e7){return _0x42bb9b[_0x7bae('0x67')](_0x34e0d6,{'transaction':_0x4990e7})['then'](function(){return BPromise[_0x7bae('0x6e')](_0x1bc34b,function(_0x26ca41){return db[_0x7bae('0x5b')][_0x7bae('0x6f')]({'where':{'UserId':_0x26ca41['id'],'OpenchannelQueueId':_0x270b5c[_0x7bae('0x4d')]['id']},'transaction':_0x4990e7});});})['then'](function(){_0x1bc34b[_0x7bae('0x70')](function(_0x2cad02){socket[_0x7bae('0x71')](_0x7bae('0x72'),{'UserId':_0x2cad02['id'],'OpenchannelQueueId':_0x42bb9b['id']});});});});});}})[_0x7bae('0x2a')](respondWithStatusCode(_0x1a04d5,null))['catch'](handleError(_0x1a04d5,null));};exports[_0x7bae('0x73')]=function(_0xd61e14,_0x2530ec,_0x11f001){return db[_0x7bae('0x66')][_0x7bae('0x49')]({'where':{'id':_0xd61e14[_0x7bae('0x38')][_0x7bae('0x68')]},'attributes':['id'],'include':[{'model':db[_0x7bae('0x74')],'as':_0x7bae('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2530ec,null))[_0x7bae('0x2a')](function(_0xc1c224){var _0x376099=_['map'](_0xc1c224,'id');var _0x5ee280=[];var _0x3039a7=[];var _0x139725=squel['select']();_0x139725[_0x7bae('0x75')](_0x7bae('0x76'))[_0x7bae('0x77')](_0x7bae('0x78'),'tq')['join'](_0x7bae('0x79'),'ut',_0x7bae('0x7a'))[_0x7bae('0x43')](_0x7bae('0x7b'),_0xd61e14['params']['id']);for(var _0x572d17=0x0;_0x572d17<_0xc1c224[_0x7bae('0x3e')];_0x572d17+=0x1){let _0x199f7d=_0xc1c224[_0x572d17];for(var _0x92287d=0x0;_0x92287d<_0x199f7d[_0x7bae('0x69')]['length'];_0x92287d+=0x1){let _0x5e1741=_0x199f7d[_0x7bae('0x69')][_0x92287d];var _0x10bffd=_0x139725[_0x7bae('0x7c')]();_0x10bffd[_0x7bae('0x43')](_0x7bae('0x7d'),_0x5e1741['id']);_0x3039a7['push'](db[_0x7bae('0x7e')][_0x7bae('0x38')](_0x10bffd['toString'](),{'type':db['sequelize'][_0x7bae('0x7f')][_0x7bae('0x80')]})[_0x7bae('0x2a')](function(_0x2864ae){if(_0x2864ae[_0x7bae('0x3e')]===0x1){return _0x5e1741['id'];}else{var _0x4f2267=_[_0x7bae('0x81')](_[_0x7bae('0x37')](_0x2864ae,_0x7bae('0x82')),function(_0x52428a){return _[_0x7bae('0x83')](_0x376099,_0x52428a);});if(_0x4f2267){return _0x5e1741['id'];}}}));}}return BPromise['all'](_0x3039a7)[_0x7bae('0x2a')](function(_0xc93f46){_0x5ee280=_(_0x5ee280)[_0x7bae('0x84')](_0xc93f46)[_0x7bae('0x85')]()[_0x7bae('0x86')]();return db[_0x7bae('0x31')][_0x7bae('0x50')]({'where':{'id':_0xd61e14[_0x7bae('0x4d')]['id']}})[_0x7bae('0x2a')](function(_0x1de158){return db[_0x7bae('0x7e')][_0x7bae('0x6d')](function(_0x4a2806){return _0x1de158['removeTeams'](_0xd61e14[_0x7bae('0x38')][_0x7bae('0x68')],{'transaction':_0x4a2806})['then'](function(){if(!_[_0x7bae('0x87')](_0x5ee280)){return _0x1de158[_0x7bae('0x88')](_0x5ee280,{'transaction':_0x4a2806});}})['then'](function(){_0x5ee280[_0x7bae('0x70')](function(_0x153d7c){socket[_0x7bae('0x71')](_0x7bae('0x89'),{'UserId':_0x153d7c,'OpenchannelQueueId':_0x1de158['id']});});});});});});})[_0x7bae('0x2a')](respondWithStatusCode(_0x2530ec,null))[_0x7bae('0x4b')](handleError(_0x2530ec,null));};exports['addAgents']=function(_0x13d65c,_0x20e257,_0x5a405a){return db[_0x7bae('0x31')][_0x7bae('0x50')]({'where':{'id':_0x13d65c[_0x7bae('0x4d')]['id']}})[_0x7bae('0x2a')](handleEntityNotFound(_0x20e257,null))[_0x7bae('0x2a')](function(_0x329749){if(_0x329749){return _0x329749[_0x7bae('0x8a')](_0x13d65c[_0x7bae('0x52')]['ids'],_[_0x7bae('0x8b')](_0x13d65c[_0x7bae('0x52')],[_0x7bae('0x68'),'id'])||{})[_0x7bae('0x8c')](function(_0x68eea6){for(var _0x28396b=0x0;_0x28396b<_0x13d65c[_0x7bae('0x52')][_0x7bae('0x68')]['length'];_0x28396b+=0x1){socket[_0x7bae('0x71')](_0x7bae('0x72'),{'UserId':Number(_0x13d65c[_0x7bae('0x52')][_0x7bae('0x68')][_0x28396b]),'OpenchannelQueueId':Number(_0x13d65c[_0x7bae('0x4d')]['id'])});}return _0x68eea6;});}})[_0x7bae('0x2a')](respondWithResult(_0x20e257,null))[_0x7bae('0x4b')](handleError(_0x20e257,null));};exports[_0x7bae('0x88')]=function(_0x11bd2b,_0x18d4f7,_0xe5f244){return db['OpenchannelQueue'][_0x7bae('0x50')]({'where':{'id':_0x11bd2b[_0x7bae('0x4d')]['id']}})[_0x7bae('0x2a')](handleEntityNotFound(_0x18d4f7,null))['then'](function(_0x283c08){if(_0x283c08){return _0x283c08[_0x7bae('0x88')](_0x11bd2b[_0x7bae('0x38')]['ids'])[_0x7bae('0x2a')](function(){if(_[_0x7bae('0x8d')](_0x11bd2b[_0x7bae('0x38')][_0x7bae('0x68')])){for(var _0x5987ea=0x0;_0x5987ea<_0x11bd2b[_0x7bae('0x38')]['ids'][_0x7bae('0x3e')];_0x5987ea+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x11bd2b[_0x7bae('0x38')][_0x7bae('0x68')][_0x5987ea]),'OpenchannelQueueId':Number(_0x11bd2b[_0x7bae('0x4d')]['id'])});}}else{socket[_0x7bae('0x71')](_0x7bae('0x89'),{'UserId':Number(_0x11bd2b[_0x7bae('0x38')][_0x7bae('0x68')]),'OpenchannelQueueId':Number(_0x11bd2b[_0x7bae('0x4d')]['id'])});}});}})[_0x7bae('0x2a')](respondWithStatusCode(_0x18d4f7,null))['catch'](handleError(_0x18d4f7,null));};exports[_0x7bae('0x8e')]=function(_0x2e2e46,_0x4c9d6c,_0x353306){var _0x5a1aa7={};var _0x15d705={};var _0x4a61be;var _0x68a37a;return db['OpenchannelQueue'][_0x7bae('0x65')]({'where':{'id':_0x2e2e46[_0x7bae('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4c9d6c,null))[_0x7bae('0x2a')](function(_0x475ad0){if(_0x475ad0){_0x4a61be=_0x475ad0;_0x15d705[_0x7bae('0x36')]=_['keys'](db[_0x7bae('0x74')][_0x7bae('0x32')]);_0x15d705[_0x7bae('0x38')]=_['keys'](_0x2e2e46[_0x7bae('0x38')]);_0x15d705[_0x7bae('0x3a')]=_['intersection'](_0x15d705['model'],_0x15d705[_0x7bae('0x38')]);_0x5a1aa7[_0x7bae('0x3c')]=_['intersection'](_0x15d705[_0x7bae('0x36')],qs[_0x7bae('0x3d')](_0x2e2e46[_0x7bae('0x38')][_0x7bae('0x3d')]));_0x5a1aa7['attributes']=_0x5a1aa7[_0x7bae('0x3c')][_0x7bae('0x3e')]?_0x5a1aa7[_0x7bae('0x3c')]:_0x15d705['model'];_0x5a1aa7[_0x7bae('0x41')]=qs[_0x7bae('0x42')](_0x2e2e46[_0x7bae('0x38')][_0x7bae('0x42')]);_0x5a1aa7[_0x7bae('0x43')]=qs['filters'](_[_0x7bae('0x44')](_0x2e2e46[_0x7bae('0x38')],_0x15d705['filters']));if(_0x2e2e46[_0x7bae('0x38')]['filter']){_0x5a1aa7['where']=_[_0x7bae('0x45')](_0x5a1aa7[_0x7bae('0x43')],{'$or':_[_0x7bae('0x37')](_0x5a1aa7[_0x7bae('0x3c')],function(_0x1b536f){var _0x55b50e={};_0x55b50e[_0x1b536f]={'$like':'%'+_0x2e2e46[_0x7bae('0x38')][_0x7bae('0x47')]+'%'};return _0x55b50e;})});}_0x5a1aa7=_[_0x7bae('0x45')]({},_0x5a1aa7,_0x2e2e46[_0x7bae('0x4f')]);return _0x4a61be['getAgents'](_0x5a1aa7);}})['then'](function(_0x49b06f){if(_0x49b06f){_0x68a37a=_0x49b06f[_0x7bae('0x3e')];if(!_0x2e2e46[_0x7bae('0x38')]['hasOwnProperty'](_0x7bae('0x40'))){_0x5a1aa7['limit']=qs[_0x7bae('0x23')](_0x2e2e46['query'][_0x7bae('0x23')]);_0x5a1aa7['offset']=qs[_0x7bae('0x21')](_0x2e2e46[_0x7bae('0x38')][_0x7bae('0x21')]);}return _0x4a61be[_0x7bae('0x8e')](_0x5a1aa7);}})[_0x7bae('0x2a')](function(_0x40ff61){if(_0x40ff61){return _0x40ff61?{'count':_0x68a37a,'rows':_0x40ff61}:null;}})[_0x7bae('0x2a')](respondWithResult(_0x4c9d6c,null))[_0x7bae('0x4b')](handleError(_0x4c9d6c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 5e6ce4b..d7a19d3 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 _0x5d4b=['save','update','remove','hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5d4b,0x8d));var _0xb5d4=function(_0x577a2e,_0x3816f0){_0x577a2e=_0x577a2e-0x0;var _0x3ac138=_0x5d4b[_0x577a2e];return _0x3ac138;};'use strict';var EventEmitter=require(_0xb5d4('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xb5d4('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xb5d4('0x2')](0x0);var events={'afterCreate':_0xb5d4('0x3'),'afterUpdate':_0xb5d4('0x4'),'afterDestroy':_0xb5d4('0x5')};function emitEvent(_0x5dfe0f){return function(_0x4aecb6,_0x58f9a4,_0x4ff9f3){OpenchannelQueueEvents['emit'](_0x5dfe0f+':'+_0x4aecb6['id'],_0x4aecb6);OpenchannelQueueEvents['emit'](_0x5dfe0f,_0x4aecb6);_0x4ff9f3(null);};}for(var e in events){if(events[_0xb5d4('0x6')](e)){var event=events[e];OpenchannelQueue[_0xb5d4('0x7')](e,emitEvent(event));}}module[_0xb5d4('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x073d=['save','update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x214023,_0x553137){var _0x40199d=function(_0x28c976){while(--_0x28c976){_0x214023['push'](_0x214023['shift']());}};_0x40199d(++_0x553137);}(_0x073d,0x103));var _0xd073=function(_0x380356,_0x44304f){_0x380356=_0x380356-0x0;var _0x542fb4=_0x073d[_0x380356];return _0x542fb4;};'use strict';var EventEmitter=require(_0xd073('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd073('0x1')](0x0);var events={'afterCreate':_0xd073('0x2'),'afterUpdate':_0xd073('0x3'),'afterDestroy':_0xd073('0x4')};function emitEvent(_0x8c6c70){return function(_0x4946c4,_0x34f13b,_0x48de14){OpenchannelQueueEvents[_0xd073('0x5')](_0x8c6c70+':'+_0x4946c4['id'],_0x4946c4);OpenchannelQueueEvents[_0xd073('0x5')](_0x8c6c70,_0x4946c4);_0x48de14(null);};}for(var e in events){if(events[_0xd073('0x6')](e)){var event=events[e];OpenchannelQueue[_0xd073('0x7')](e,emitEvent(event));}}module[_0xd073('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 9c55746..08bdd7a 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 _0x1783=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x453e16,_0x429705){var _0x56506b=function(_0x9db9c3){while(--_0x9db9c3){_0x453e16['push'](_0x453e16['shift']());}};_0x56506b(++_0x429705);}(_0x1783,0x84));var _0x3178=function(_0x23466a,_0x22e75b){_0x23466a=_0x23466a-0x0;var _0xc3fa63=_0x1783[_0x23466a];return _0xc3fa63;};'use strict';var _=require('lodash');var util=require(_0x3178('0x0'));var logger=require(_0x3178('0x1'))(_0x3178('0x2'));var moment=require(_0x3178('0x3'));var BPromise=require(_0x3178('0x4'));var rp=require(_0x3178('0x5'));var fs=require('fs');var path=require(_0x3178('0x6'));var rimraf=require('rimraf');var config=require(_0x3178('0x7'));var attributes=require(_0x3178('0x8'));module[_0x3178('0x9')]=function(_0x306f7d,_0x2c787c){return _0x306f7d[_0x3178('0xa')](_0x3178('0xb'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x942f=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','../../config/logger','moment'];(function(_0x32c6b6,_0x24611b){var _0x44934a=function(_0x1a7c35){while(--_0x1a7c35){_0x32c6b6['push'](_0x32c6b6['shift']());}};_0x44934a(++_0x24611b);}(_0x942f,0x1de));var _0xf942=function(_0xda302e,_0xc8df91){_0xda302e=_0xda302e-0x0;var _0x16e42e=_0x942f[_0xda302e];return _0x16e42e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf942('0x0'))('api');var moment=require(_0xf942('0x1'));var BPromise=require(_0xf942('0x2'));var rp=require(_0xf942('0x3'));var fs=require('fs');var path=require(_0xf942('0x4'));var rimraf=require(_0xf942('0x5'));var config=require(_0xf942('0x6'));var attributes=require(_0xf942('0x7'));module[_0xf942('0x8')]=function(_0x22c8d1,_0x1deb43){return _0x22c8d1[_0xf942('0x9')](_0xf942('0xa'),attributes,{'tableName':_0xf942('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 f09bf1f..d8f3bae 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 _0x6103=['debug','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','OpenchannelQueue','findAll','options','raw','attributes','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','find','where','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent'];(function(_0x4a5237,_0x3d1a0d){var _0x1284d7=function(_0x9bb09c){while(--_0x9bb09c){_0x4a5237['push'](_0x4a5237['shift']());}};_0x1284d7(++_0x3d1a0d);}(_0x6103,0x17c));var _0x3610=function(_0x25aa79,_0x368153){_0x25aa79=_0x25aa79-0x0;var _0x5c3a0b=_0x6103[_0x25aa79];return _0x5c3a0b;};'use strict';var _=require(_0x3610('0x0'));var util=require(_0x3610('0x1'));var moment=require(_0x3610('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3610('0x3'));var db=require(_0x3610('0x4'))['db'];var utils=require(_0x3610('0x5'));var logger=require(_0x3610('0x6'))(_0x3610('0x7'));var config=require(_0x3610('0x8'));var jayson=require(_0x3610('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x3610('0xa')]=_[_0x3610('0xb')](config[_0x3610('0xa')],{'host':_0x3610('0xc'),'port':0x18eb});var socket=require(_0x3610('0xd'))(new Redis(config[_0x3610('0xa')]));require(_0x3610('0xe'))[_0x3610('0xf')](socket);function respondWithRpcPromise(_0x3bc945,_0x302f98,_0x37053b){return new BPromise(function(_0x3b5d67,_0x2bc98b){return client[_0x3610('0x10')](_0x3bc945,_0x37053b)[_0x3610('0x11')](function(_0x2e142e){logger[_0x3610('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x302f98,_0x3610('0x13'));logger[_0x3610('0x14')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x302f98,_0x3610('0x13'),JSON[_0x3610('0x15')](_0x2e142e));if(_0x2e142e[_0x3610('0x16')]){if(_0x2e142e[_0x3610('0x16')][_0x3610('0x17')]===0x1f4){logger[_0x3610('0x16')](_0x3610('0x18'),_0x302f98,_0x2e142e[_0x3610('0x16')][_0x3610('0x19')]);return _0x2bc98b(_0x2e142e[_0x3610('0x16')][_0x3610('0x19')]);}logger[_0x3610('0x16')](_0x3610('0x18'),_0x302f98,_0x2e142e['error'][_0x3610('0x19')]);return _0x3b5d67(_0x2e142e[_0x3610('0x16')][_0x3610('0x19')]);}else{logger[_0x3610('0x12')](_0x3610('0x18'),_0x302f98,_0x3610('0x13'));_0x3b5d67(_0x2e142e[_0x3610('0x1a')][_0x3610('0x19')]);}})[_0x3610('0x1b')](function(_0x5eac20){logger[_0x3610('0x16')](_0x3610('0x18'),_0x302f98,_0x5eac20);_0x2bc98b(_0x5eac20);});});}exports['GetOpenchannelQueue']=function(_0x3b8fde){var _0x1ee8c4=this;return new Promise(function(_0x1d9fc1,_0x279ec9){return db[_0x3610('0x1c')][_0x3610('0x1d')]({'raw':_0x3b8fde['options']?_0x3b8fde[_0x3610('0x1e')][_0x3610('0x1f')]===undefined?!![]:![]:!![],'where':_0x3b8fde[_0x3610('0x1e')]?_0x3b8fde['options']['where']||null:null,'attributes':_0x3b8fde[_0x3610('0x1e')]?_0x3b8fde['options'][_0x3610('0x20')]||null:null,'limit':_0x3b8fde['options']?_0x3b8fde[_0x3610('0x1e')]['limit']||null:null,'include':_0x3b8fde[_0x3610('0x1e')]?_0x3b8fde['options']['include']?_['map'](_0x3b8fde[_0x3610('0x1e')]['include'],function(_0x538511){return{'model':db[_0x538511['model']],'as':_0x538511['as'],'attributes':_0x538511[_0x3610('0x20')],'include':_0x538511[_0x3610('0x21')]?_[_0x3610('0x22')](_0x538511['include'],function(_0x30f748){return{'model':db[_0x30f748[_0x3610('0x23')]],'as':_0x30f748['as'],'attributes':_0x30f748[_0x3610('0x20')],'include':_0x30f748['include']?_[_0x3610('0x22')](_0x30f748['include'],function(_0x521a5a){return{'model':db[_0x521a5a['model']],'as':_0x521a5a['as'],'attributes':_0x521a5a['attributes']};}):[]};}):[]};}):[]:[]})[_0x3610('0x11')](function(_0x1d932c){logger[_0x3610('0x12')](_0x3610('0x24'),_0x3b8fde);logger[_0x3610('0x14')]('GetOpenchannelQueue',_0x3b8fde,JSON[_0x3610('0x15')](_0x1d932c));_0x1d9fc1(_0x1d932c);})['catch'](function(_0x5bf160){logger[_0x3610('0x16')]('GetOpenchannelQueue',_0x5bf160[_0x3610('0x19')],_0x3b8fde);_0x279ec9(_0x1ee8c4[_0x3610('0x16')](0x1f4,_0x5bf160[_0x3610('0x19')]));});});};exports[_0x3610('0x25')]=function(_0x1cfcd8){var _0x49aa95=this;return new Promise(function(_0x2c2b88,_0xaa2e0){return db['OpenchannelQueue'][_0x3610('0x26')]({'raw':_0x1cfcd8['options']?_0x1cfcd8[_0x3610('0x1e')][_0x3610('0x1f')]===undefined?!![]:![]:!![],'where':_0x1cfcd8[_0x3610('0x1e')]?_0x1cfcd8[_0x3610('0x1e')][_0x3610('0x27')]||null:null,'attributes':_0x1cfcd8[_0x3610('0x1e')]?_0x1cfcd8[_0x3610('0x1e')][_0x3610('0x20')]||null:null,'include':_0x1cfcd8[_0x3610('0x1e')]?_0x1cfcd8[_0x3610('0x1e')][_0x3610('0x21')]?_[_0x3610('0x22')](_0x1cfcd8[_0x3610('0x1e')][_0x3610('0x21')],function(_0x574c08){return{'model':db[_0x574c08[_0x3610('0x23')]],'as':_0x574c08['as'],'attributes':_0x574c08['attributes'],'include':_0x574c08['include']?_[_0x3610('0x22')](_0x574c08[_0x3610('0x21')],function(_0x2d1794){return{'model':db[_0x2d1794[_0x3610('0x23')]],'as':_0x2d1794['as'],'attributes':_0x2d1794[_0x3610('0x20')],'include':_0x2d1794[_0x3610('0x21')]?_[_0x3610('0x22')](_0x2d1794[_0x3610('0x21')],function(_0x180c7b){return{'model':db[_0x180c7b[_0x3610('0x23')]],'as':_0x180c7b['as'],'attributes':_0x180c7b[_0x3610('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3610('0x11')](function(_0x197b7c){logger[_0x3610('0x12')]('ShowOpenchannelQueue',_0x1cfcd8);logger[_0x3610('0x14')]('ShowOpenchannelQueue',_0x1cfcd8,JSON[_0x3610('0x15')](_0x197b7c));_0x2c2b88(_0x197b7c);})[_0x3610('0x1b')](function(_0x4fa166){logger['error'](_0x3610('0x25'),_0x4fa166[_0x3610('0x19')],_0x1cfcd8);_0xaa2e0(_0x49aa95['error'](0x1f4,_0x4fa166['message']));});});}; \ No newline at end of file +var _0xffd3=['redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','ShowOpenchannelQueue','where','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xffd3,0x97));var _0x3ffd=function(_0x46aa48,_0x58555d){_0x46aa48=_0x46aa48-0x0;var _0x3afba4=_0xffd3[_0x46aa48];return _0x3afba4;};'use strict';var _=require(_0x3ffd('0x0'));var util=require('util');var moment=require(_0x3ffd('0x1'));var BPromise=require('bluebird');var rs=require(_0x3ffd('0x2'));var fs=require('fs');var Redis=require(_0x3ffd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ffd('0x4'));var logger=require(_0x3ffd('0x5'))(_0x3ffd('0x6'));var config=require(_0x3ffd('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3ffd('0x8')]({'port':0x232a});config[_0x3ffd('0x9')]=_[_0x3ffd('0xa')](config['redis'],{'host':_0x3ffd('0xb'),'port':0x18eb});var socket=require(_0x3ffd('0xc'))(new Redis(config[_0x3ffd('0x9')]));require(_0x3ffd('0xd'))[_0x3ffd('0xe')](socket);function respondWithRpcPromise(_0x3d6cfa,_0x48c526,_0x2dcbbd){return new BPromise(function(_0x5afa8e,_0x832d9a){return client[_0x3ffd('0xf')](_0x3d6cfa,_0x2dcbbd)[_0x3ffd('0x10')](function(_0x2c24f4){logger[_0x3ffd('0x11')](_0x3ffd('0x12'),_0x48c526,_0x3ffd('0x13'));logger[_0x3ffd('0x14')](_0x3ffd('0x15'),_0x48c526,_0x3ffd('0x13'),JSON[_0x3ffd('0x16')](_0x2c24f4));if(_0x2c24f4[_0x3ffd('0x17')]){if(_0x2c24f4['error'][_0x3ffd('0x18')]===0x1f4){logger['error'](_0x3ffd('0x12'),_0x48c526,_0x2c24f4[_0x3ffd('0x17')]['message']);return _0x832d9a(_0x2c24f4[_0x3ffd('0x17')][_0x3ffd('0x19')]);}logger[_0x3ffd('0x17')](_0x3ffd('0x12'),_0x48c526,_0x2c24f4['error'][_0x3ffd('0x19')]);return _0x5afa8e(_0x2c24f4[_0x3ffd('0x17')]['message']);}else{logger[_0x3ffd('0x11')](_0x3ffd('0x12'),_0x48c526,_0x3ffd('0x13'));_0x5afa8e(_0x2c24f4[_0x3ffd('0x1a')][_0x3ffd('0x19')]);}})['catch'](function(_0x2217b5){logger['error'](_0x3ffd('0x12'),_0x48c526,_0x2217b5);_0x832d9a(_0x2217b5);});});}exports[_0x3ffd('0x1b')]=function(_0x3b2091){var _0x3bcbe2=this;return new Promise(function(_0x503e89,_0x545849){return db[_0x3ffd('0x1c')][_0x3ffd('0x1d')]({'raw':_0x3b2091[_0x3ffd('0x1e')]?_0x3b2091['options'][_0x3ffd('0x1f')]===undefined?!![]:![]:!![],'where':_0x3b2091[_0x3ffd('0x1e')]?_0x3b2091[_0x3ffd('0x1e')]['where']||null:null,'attributes':_0x3b2091[_0x3ffd('0x1e')]?_0x3b2091[_0x3ffd('0x1e')][_0x3ffd('0x20')]||null:null,'limit':_0x3b2091['options']?_0x3b2091['options'][_0x3ffd('0x21')]||null:null,'include':_0x3b2091[_0x3ffd('0x1e')]?_0x3b2091[_0x3ffd('0x1e')][_0x3ffd('0x22')]?_[_0x3ffd('0x23')](_0x3b2091[_0x3ffd('0x1e')]['include'],function(_0x277a38){return{'model':db[_0x277a38[_0x3ffd('0x24')]],'as':_0x277a38['as'],'attributes':_0x277a38['attributes'],'include':_0x277a38[_0x3ffd('0x22')]?_[_0x3ffd('0x23')](_0x277a38[_0x3ffd('0x22')],function(_0x2609b2){return{'model':db[_0x2609b2[_0x3ffd('0x24')]],'as':_0x2609b2['as'],'attributes':_0x2609b2['attributes'],'include':_0x2609b2[_0x3ffd('0x22')]?_[_0x3ffd('0x23')](_0x2609b2[_0x3ffd('0x22')],function(_0x17d4fd){return{'model':db[_0x17d4fd[_0x3ffd('0x24')]],'as':_0x17d4fd['as'],'attributes':_0x17d4fd[_0x3ffd('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3ffd('0x10')](function(_0x49278d){logger[_0x3ffd('0x11')](_0x3ffd('0x1b'),_0x3b2091);logger[_0x3ffd('0x14')](_0x3ffd('0x1b'),_0x3b2091,JSON['stringify'](_0x49278d));_0x503e89(_0x49278d);})['catch'](function(_0xb7f175){logger[_0x3ffd('0x17')]('GetOpenchannelQueue',_0xb7f175[_0x3ffd('0x19')],_0x3b2091);_0x545849(_0x3bcbe2[_0x3ffd('0x17')](0x1f4,_0xb7f175[_0x3ffd('0x19')]));});});};exports[_0x3ffd('0x25')]=function(_0xe5ddba){var _0x466a44=this;return new Promise(function(_0x29ea67,_0x2defff){return db[_0x3ffd('0x1c')]['find']({'raw':_0xe5ddba[_0x3ffd('0x1e')]?_0xe5ddba[_0x3ffd('0x1e')][_0x3ffd('0x1f')]===undefined?!![]:![]:!![],'where':_0xe5ddba[_0x3ffd('0x1e')]?_0xe5ddba[_0x3ffd('0x1e')][_0x3ffd('0x26')]||null:null,'attributes':_0xe5ddba[_0x3ffd('0x1e')]?_0xe5ddba[_0x3ffd('0x1e')]['attributes']||null:null,'include':_0xe5ddba[_0x3ffd('0x1e')]?_0xe5ddba[_0x3ffd('0x1e')][_0x3ffd('0x22')]?_[_0x3ffd('0x23')](_0xe5ddba['options'][_0x3ffd('0x22')],function(_0x1918f8){return{'model':db[_0x1918f8[_0x3ffd('0x24')]],'as':_0x1918f8['as'],'attributes':_0x1918f8[_0x3ffd('0x20')],'include':_0x1918f8['include']?_['map'](_0x1918f8['include'],function(_0x167cfb){return{'model':db[_0x167cfb[_0x3ffd('0x24')]],'as':_0x167cfb['as'],'attributes':_0x167cfb[_0x3ffd('0x20')],'include':_0x167cfb[_0x3ffd('0x22')]?_['map'](_0x167cfb['include'],function(_0x39ee57){return{'model':db[_0x39ee57['model']],'as':_0x39ee57['as'],'attributes':_0x39ee57[_0x3ffd('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3ffd('0x10')](function(_0x17baa3){logger[_0x3ffd('0x11')](_0x3ffd('0x25'),_0xe5ddba);logger[_0x3ffd('0x14')]('ShowOpenchannelQueue',_0xe5ddba,JSON[_0x3ffd('0x16')](_0x17baa3));_0x29ea67(_0x17baa3);})[_0x3ffd('0x27')](function(_0x2db903){logger[_0x3ffd('0x17')](_0x3ffd('0x25'),_0x2db903['message'],_0xe5ddba);_0x2defff(_0x466a44[_0x3ffd('0x17')](0x1f4,_0x2db903[_0x3ffd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 1546015..d7a3e97 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 _0x3b32=['length','openchannelQueue:','./openchannelQueue.events','remove','update','emit','removeListener'];(function(_0x3f563c,_0x1a71d9){var _0x4ebeb6=function(_0x1459ba){while(--_0x1459ba){_0x3f563c['push'](_0x3f563c['shift']());}};_0x4ebeb6(++_0x1a71d9);}(_0x3b32,0x1d0));var _0x23b3=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x3b32[_0x42bdad];return _0x122626;};'use strict';var OpenchannelQueueEvents=require(_0x23b3('0x0'));var events=['save',_0x23b3('0x1'),_0x23b3('0x2')];function createListener(_0x3a995a,_0x3aa359){return function(_0x2472d7){_0x3aa359[_0x23b3('0x3')](_0x3a995a,_0x2472d7);};}function removeListener(_0x1cb912,_0x3c9ba5){return function(){OpenchannelQueueEvents[_0x23b3('0x4')](_0x1cb912,_0x3c9ba5);};}exports['register']=function(_0x3401c2){for(var _0x445137=0x0,_0x13a4cc=events[_0x23b3('0x5')];_0x445137<_0x13a4cc;_0x445137++){var _0x4ce6c8=events[_0x445137];var _0x5a7091=createListener(_0x23b3('0x6')+_0x4ce6c8,_0x3401c2);OpenchannelQueueEvents['on'](_0x4ce6c8,_0x5a7091);}}; \ No newline at end of file +var _0x46ee=['save','remove','update','emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x46ee,0x182));var _0xe46e=function(_0x27c6e7,_0x33e457){_0x27c6e7=_0x27c6e7-0x0;var _0x579ccf=_0x46ee[_0x27c6e7];return _0x579ccf;};'use strict';var OpenchannelQueueEvents=require(_0xe46e('0x0'));var events=[_0xe46e('0x1'),_0xe46e('0x2'),_0xe46e('0x3')];function createListener(_0x11d5c7,_0x47810f){return function(_0x590580){_0x47810f[_0xe46e('0x4')](_0x11d5c7,_0x590580);};}function removeListener(_0xd9d6be,_0x53c11c){return function(){OpenchannelQueueEvents[_0xe46e('0x5')](_0xd9d6be,_0x53c11c);};}exports[_0xe46e('0x6')]=function(_0x4b7f5d){for(var _0x288a02=0x0,_0x265e0b=events[_0xe46e('0x7')];_0x288a02<_0x265e0b;_0x288a02++){var _0x49fcc1=events[_0x288a02];var _0x4e7927=createListener(_0xe46e('0x8')+_0x49fcc1,_0x4b7f5d);OpenchannelQueueEvents['on'](_0x49fcc1,_0x4e7927);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 50cc52c..c557c06 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 _0x529b=['fs-extra','../../components/interaction/service','get','isAuthenticated','/describe','describe','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x529b,0x1b0));var _0xb529=function(_0xebcd86,_0x1f366a){_0xebcd86=_0xebcd86-0x0;var _0x1f199e=_0x529b[_0xebcd86];return _0x1f199e;};'use strict';var multer=require(_0xb529('0x0'));var util=require('util');var path=require(_0xb529('0x1'));var timeout=require(_0xb529('0x2'));var express=require(_0xb529('0x3'));var router=express[_0xb529('0x4')]();var fs_extra=require(_0xb529('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb529('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0xb529('0x7')]('/',auth[_0xb529('0x8')](),controller['index']);router[_0xb529('0x7')](_0xb529('0x9'),auth[_0xb529('0x8')](),controller[_0xb529('0xa')]);router[_0xb529('0x7')]('/:id',auth[_0xb529('0x8')](),controller['show']);router[_0xb529('0xb')]('/',auth[_0xb529('0x8')](),controller[_0xb529('0xc')]);router[_0xb529('0xd')](_0xb529('0xe'),auth[_0xb529('0x8')](),controller[_0xb529('0xf')]);router[_0xb529('0x10')](_0xb529('0xe'),auth['isAuthenticated'](),controller[_0xb529('0x11')]);module[_0xb529('0x12')]=router; \ No newline at end of file +var _0x4e86=['index','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller'];(function(_0x15fe68,_0x4ac44b){var _0x76bf42=function(_0x5c9e8a){while(--_0x5c9e8a){_0x15fe68['push'](_0x15fe68['shift']());}};_0x76bf42(++_0x4ac44b);}(_0x4e86,0x14f));var _0x64e8=function(_0x3412bb,_0x1bfeff){_0x3412bb=_0x3412bb-0x0;var _0x3f973f=_0x4e86[_0x3412bb];return _0x3f973f;};'use strict';var multer=require(_0x64e8('0x0'));var util=require('util');var path=require(_0x64e8('0x1'));var timeout=require(_0x64e8('0x2'));var express=require(_0x64e8('0x3'));var router=express[_0x64e8('0x4')]();var fs_extra=require(_0x64e8('0x5'));var auth=require(_0x64e8('0x6'));var interaction=require(_0x64e8('0x7'));var config=require(_0x64e8('0x8'));var controller=require(_0x64e8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x64e8('0xa')]);router[_0x64e8('0xb')](_0x64e8('0xc'),auth[_0x64e8('0xd')](),controller[_0x64e8('0xe')]);router[_0x64e8('0xb')](_0x64e8('0xf'),auth[_0x64e8('0xd')](),controller['show']);router[_0x64e8('0x10')]('/',auth[_0x64e8('0xd')](),controller[_0x64e8('0x11')]);router[_0x64e8('0x12')]('/:id',auth[_0x64e8('0xd')](),controller[_0x64e8('0x13')]);router[_0x64e8('0x14')](_0x64e8('0xf'),auth[_0x64e8('0xd')](),controller[_0x64e8('0x15')]);module[_0x64e8('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index d686485..74611d2 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 _0xf28c=['exports','STRING','DATE','moment','sequelize'];(function(_0x1ac69e,_0x49749e){var _0x11990d=function(_0x4455df){while(--_0x4455df){_0x1ac69e['push'](_0x1ac69e['shift']());}};_0x11990d(++_0x49749e);}(_0xf28c,0x148));var _0xcf28=function(_0x135ef2,_0x2225b7){_0x135ef2=_0x135ef2-0x0;var _0xfdc6f4=_0xf28c[_0x135ef2];return _0xfdc6f4;};'use strict';var moment=require(_0xcf28('0x0'));var Sequelize=require(_0xcf28('0x1'));module[_0xcf28('0x2')]={'uniqueid':{'type':Sequelize[_0xcf28('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xcf28('0x3')]},'joinAt':{'type':Sequelize[_0xcf28('0x4')]},'leaveAt':{'type':Sequelize[_0xcf28('0x4')]},'acceptAt':{'type':Sequelize[_0xcf28('0x4')]},'exitAt':{'type':Sequelize[_0xcf28('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2aa0=['moment','sequelize','STRING','DATE'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x2aa0,0x6c));var _0x02aa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2aa0[_0x57b54c];return _0x59cc19;};'use strict';var moment=require(_0x02aa('0x0'));var Sequelize=require(_0x02aa('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x02aa('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x02aa('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x02aa('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x02aa('0x3')]},'reason':{'type':Sequelize[_0x02aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 073bc13..f082708 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 _0xa356=['create','body','params','destroy','describe','rimraf','zip-dir','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','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','find'];(function(_0x27cbaf,_0x4f0a16){var _0x5514b3=function(_0x38bae4){while(--_0x38bae4){_0x27cbaf['push'](_0x27cbaf['shift']());}};_0x5514b3(++_0x4f0a16);}(_0xa356,0xa1));var _0x6a35=function(_0x2a1287,_0x1645dc){_0x2a1287=_0x2a1287-0x0;var _0x50a9ad=_0xa356[_0x2a1287];return _0x50a9ad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a35('0x0'));var zipdir=require(_0x6a35('0x1'));var jsonpatch=require(_0x6a35('0x2'));var rp=require(_0x6a35('0x3'));var moment=require(_0x6a35('0x4'));var BPromise=require(_0x6a35('0x5'));var Mustache=require(_0x6a35('0x6'));var util=require(_0x6a35('0x7'));var path=require(_0x6a35('0x8'));var sox=require(_0x6a35('0x9'));var csv=require(_0x6a35('0xa'));var ejs=require(_0x6a35('0xb'));var fs=require('fs');var fs_extra=require(_0x6a35('0xc'));var _=require(_0x6a35('0xd'));var squel=require('squel');var crypto=require(_0x6a35('0xe'));var jsforce=require(_0x6a35('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6a35('0xa'));var querystring=require(_0x6a35('0x10'));var Papa=require(_0x6a35('0x11'));var Redis=require(_0x6a35('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6a35('0x13'));var as=require(_0x6a35('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a35('0x15'))(_0x6a35('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6a35('0x17'));var db=require(_0x6a35('0x18'))['db'];function respondWithStatusCode(_0x17aa7f,_0x380332){_0x380332=_0x380332||0xcc;return function(_0x18d17b){if(_0x18d17b){return _0x17aa7f[_0x6a35('0x19')](_0x380332);}return _0x17aa7f['status'](_0x380332)[_0x6a35('0x1a')]();};}function respondWithResult(_0x172398,_0x40d679){_0x40d679=_0x40d679||0xc8;return function(_0x2214d8){if(_0x2214d8){return _0x172398[_0x6a35('0x1b')](_0x40d679)[_0x6a35('0x1c')](_0x2214d8);}};}function respondWithFilteredResult(_0x51e966,_0x5818c3){return function(_0x38a02b){if(_0x38a02b){var _0x3cb7be=typeof _0x5818c3[_0x6a35('0x1d')]==='undefined'&&typeof _0x5818c3['limit']===_0x6a35('0x1e');var _0x115717=_0x38a02b[_0x6a35('0x1f')];var _0x3e2bfc=_0x3cb7be?0x0:_0x5818c3[_0x6a35('0x1d')];var _0x28fa71=_0x3cb7be?_0x38a02b['count']:_0x5818c3['offset']+_0x5818c3[_0x6a35('0x20')];var _0x2416fb;if(_0x28fa71>=_0x115717){_0x28fa71=_0x115717;_0x2416fb=0xc8;}else{_0x2416fb=0xce;}_0x51e966[_0x6a35('0x1b')](_0x2416fb);return _0x51e966['set'](_0x6a35('0x21'),_0x3e2bfc+'-'+_0x28fa71+'/'+_0x115717)[_0x6a35('0x1c')](_0x38a02b);}return null;};}function patchUpdates(_0x2ab73b){return function(_0x17127f){try{jsonpatch[_0x6a35('0x22')](_0x17127f,_0x2ab73b,!![]);}catch(_0x58a149){return BPromise['reject'](_0x58a149);}return _0x17127f[_0x6a35('0x23')]();};}function saveUpdates(_0x1e9a35,_0x22809b){return function(_0x20fedb){if(_0x20fedb){return _0x20fedb[_0x6a35('0x24')](_0x1e9a35)[_0x6a35('0x25')](function(_0xd9b34d){return _0xd9b34d;});}return null;};}function removeEntity(_0x408c16,_0x49fcec){return function(_0xc58068){if(_0xc58068){return _0xc58068['destroy']()['then'](function(){_0x408c16['status'](0xcc)[_0x6a35('0x1a')]();});}};}function handleEntityNotFound(_0x4afc13,_0x38aa45){return function(_0x45a413){if(!_0x45a413){_0x4afc13[_0x6a35('0x19')](0x194);}return _0x45a413;};}function handleError(_0x2e1a03,_0x33982b){_0x33982b=_0x33982b||0x1f4;return function(_0x11641c){logger[_0x6a35('0x26')](_0x11641c[_0x6a35('0x27')]);if(_0x11641c[_0x6a35('0x28')]){delete _0x11641c[_0x6a35('0x28')];}_0x2e1a03['status'](_0x33982b)[_0x6a35('0x29')](_0x11641c);};}exports['index']=function(_0x5196e9,_0x307415){var _0x3ae70a={},_0x4288c3={},_0x50b2f4={'count':0x0,'rows':[]};var _0x20e823=_[_0x6a35('0x2a')](db['OpenchannelQueueReport'][_0x6a35('0x2b')],function(_0x945059){return{'name':_0x945059[_0x6a35('0x2c')],'type':_0x945059[_0x6a35('0x2d')][_0x6a35('0x2e')]};});_0x4288c3[_0x6a35('0x2f')]=_['map'](_0x20e823,_0x6a35('0x28'));_0x4288c3[_0x6a35('0x30')]=_[_0x6a35('0x31')](_0x5196e9[_0x6a35('0x30')]);_0x4288c3[_0x6a35('0x32')]=_[_0x6a35('0x33')](_0x4288c3[_0x6a35('0x2f')],_0x4288c3[_0x6a35('0x30')]);_0x3ae70a['attributes']=_['intersection'](_0x4288c3[_0x6a35('0x2f')],qs['fields'](_0x5196e9[_0x6a35('0x30')][_0x6a35('0x34')]));_0x3ae70a[_0x6a35('0x35')]=_0x3ae70a[_0x6a35('0x35')][_0x6a35('0x36')]?_0x3ae70a[_0x6a35('0x35')]:_0x4288c3[_0x6a35('0x2f')];if(!_0x5196e9['query'][_0x6a35('0x37')](_0x6a35('0x38'))){_0x3ae70a[_0x6a35('0x20')]=qs[_0x6a35('0x20')](_0x5196e9['query'][_0x6a35('0x20')]);_0x3ae70a[_0x6a35('0x1d')]=qs[_0x6a35('0x1d')](_0x5196e9[_0x6a35('0x30')][_0x6a35('0x1d')]);}_0x3ae70a[_0x6a35('0x39')]=qs[_0x6a35('0x3a')](_0x5196e9['query'][_0x6a35('0x3a')]);_0x3ae70a[_0x6a35('0x3b')]=qs[_0x6a35('0x32')](_[_0x6a35('0x3c')](_0x5196e9[_0x6a35('0x30')],_0x4288c3[_0x6a35('0x32')]),_0x20e823);if(_0x5196e9[_0x6a35('0x30')][_0x6a35('0x3d')]){_0x3ae70a[_0x6a35('0x3b')]=_[_0x6a35('0x3e')](_0x3ae70a['where'],{'$or':_['map'](_0x20e823,function(_0x4da9a6){if(_0x4da9a6[_0x6a35('0x2d')]!==_0x6a35('0x3f')){var _0xf5d752={};_0xf5d752[_0x4da9a6[_0x6a35('0x28')]]={'$like':'%'+_0x5196e9[_0x6a35('0x30')][_0x6a35('0x3d')]+'%'};return _0xf5d752;}})});}_0x3ae70a=_[_0x6a35('0x3e')]({},_0x3ae70a,_0x5196e9[_0x6a35('0x40')]);var _0x1d034f={'where':_0x3ae70a[_0x6a35('0x3b')]};return db[_0x6a35('0x41')][_0x6a35('0x1f')](_0x1d034f)[_0x6a35('0x25')](function(_0x94ee3a){_0x50b2f4[_0x6a35('0x1f')]=_0x94ee3a;if(_0x5196e9[_0x6a35('0x30')][_0x6a35('0x42')]){_0x3ae70a[_0x6a35('0x43')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x6a35('0x44')](_0x3ae70a);})['then'](function(_0x213f14){_0x50b2f4[_0x6a35('0x45')]=_0x213f14;return _0x50b2f4;})['then'](respondWithFilteredResult(_0x307415,_0x3ae70a))[_0x6a35('0x46')](handleError(_0x307415,null));};exports[_0x6a35('0x47')]=function(_0x2ce2e1,_0x5490d0){var _0x229951={'raw':!![],'where':{'id':_0x2ce2e1['params']['id']}},_0x187771={};_0x187771[_0x6a35('0x2f')]=_[_0x6a35('0x31')](db['OpenchannelQueueReport'][_0x6a35('0x2b')]);_0x187771[_0x6a35('0x30')]=_['keys'](_0x2ce2e1[_0x6a35('0x30')]);_0x187771[_0x6a35('0x32')]=_[_0x6a35('0x33')](_0x187771[_0x6a35('0x2f')],_0x187771[_0x6a35('0x30')]);_0x229951['attributes']=_[_0x6a35('0x33')](_0x187771[_0x6a35('0x2f')],qs['fields'](_0x2ce2e1['query']['fields']));_0x229951[_0x6a35('0x35')]=_0x229951[_0x6a35('0x35')]['length']?_0x229951[_0x6a35('0x35')]:_0x187771['model'];if(_0x2ce2e1['query'][_0x6a35('0x42')]){_0x229951[_0x6a35('0x43')]=[{'all':!![]}];}_0x229951=_[_0x6a35('0x3e')]({},_0x229951,_0x2ce2e1[_0x6a35('0x40')]);return db[_0x6a35('0x41')][_0x6a35('0x48')](_0x229951)[_0x6a35('0x25')](handleEntityNotFound(_0x5490d0,null))[_0x6a35('0x25')](respondWithResult(_0x5490d0,null))[_0x6a35('0x46')](handleError(_0x5490d0,null));};exports[_0x6a35('0x49')]=function(_0x9fd291,_0x3eea84){return db[_0x6a35('0x41')][_0x6a35('0x49')](_0x9fd291['body'],{})['then'](respondWithResult(_0x3eea84,0xc9))[_0x6a35('0x46')](handleError(_0x3eea84,null));};exports['update']=function(_0x379e7a,_0x518dca){if(_0x379e7a['body']['id']){delete _0x379e7a[_0x6a35('0x4a')]['id'];}return db['OpenchannelQueueReport'][_0x6a35('0x48')]({'where':{'id':_0x379e7a[_0x6a35('0x4b')]['id']}})[_0x6a35('0x25')](handleEntityNotFound(_0x518dca,null))[_0x6a35('0x25')](saveUpdates(_0x379e7a[_0x6a35('0x4a')],null))['then'](respondWithResult(_0x518dca,null))[_0x6a35('0x46')](handleError(_0x518dca,null));};exports[_0x6a35('0x4c')]=function(_0x50e98a,_0x2641ad){return db[_0x6a35('0x41')][_0x6a35('0x48')]({'where':{'id':_0x50e98a[_0x6a35('0x4b')]['id']}})[_0x6a35('0x25')](handleEntityNotFound(_0x2641ad,null))[_0x6a35('0x25')](removeEntity(_0x2641ad,null))[_0x6a35('0x46')](handleError(_0x2641ad,null));};exports['describe']=function(_0x167a3c,_0xbfffb){return db[_0x6a35('0x41')][_0x6a35('0x4d')]()[_0x6a35('0x25')](respondWithResult(_0xbfffb,null))[_0x6a35('0x46')](handleError(_0xbfffb,null));}; \ No newline at end of file +var _0x760e=['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/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x760e,0x16c));var _0xe760=function(_0x31a0c0,_0x249c5e){_0x31a0c0=_0x31a0c0-0x0;var _0x52ca6a=_0x760e[_0x31a0c0];return _0x52ca6a;};'use strict';var emlformat=require(_0xe760('0x0'));var rimraf=require(_0xe760('0x1'));var zipdir=require(_0xe760('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe760('0x3'));var moment=require(_0xe760('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe760('0x5'));var util=require('util');var path=require(_0xe760('0x6'));var sox=require(_0xe760('0x7'));var csv=require(_0xe760('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe760('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe760('0xa'));var jsforce=require(_0xe760('0xb'));var deskjs=require(_0xe760('0xc'));var toCsv=require(_0xe760('0x8'));var querystring=require(_0xe760('0xd'));var Papa=require(_0xe760('0xe'));var Redis=require(_0xe760('0xf'));var authService=require(_0xe760('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe760('0x11'));var hardwareService=require(_0xe760('0x12'));var logger=require(_0xe760('0x13'))(_0xe760('0x14'));var utils=require(_0xe760('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe760('0x16'));var db=require(_0xe760('0x17'))['db'];function respondWithStatusCode(_0x3b8d16,_0x4bfb59){_0x4bfb59=_0x4bfb59||0xcc;return function(_0xb67727){if(_0xb67727){return _0x3b8d16[_0xe760('0x18')](_0x4bfb59);}return _0x3b8d16['status'](_0x4bfb59)[_0xe760('0x19')]();};}function respondWithResult(_0x15d198,_0x4a4a1e){_0x4a4a1e=_0x4a4a1e||0xc8;return function(_0x10c707){if(_0x10c707){return _0x15d198[_0xe760('0x1a')](_0x4a4a1e)[_0xe760('0x1b')](_0x10c707);}};}function respondWithFilteredResult(_0x11486e,_0x35087c){return function(_0x5adc6b){if(_0x5adc6b){var _0x21835c=typeof _0x35087c[_0xe760('0x1c')]==='undefined'&&typeof _0x35087c[_0xe760('0x1d')]===_0xe760('0x1e');var _0x29f79b=_0x5adc6b[_0xe760('0x1f')];var _0x1a85db=_0x21835c?0x0:_0x35087c[_0xe760('0x1c')];var _0x452927=_0x21835c?_0x5adc6b[_0xe760('0x1f')]:_0x35087c[_0xe760('0x1c')]+_0x35087c[_0xe760('0x1d')];var _0x3d6720;if(_0x452927>=_0x29f79b){_0x452927=_0x29f79b;_0x3d6720=0xc8;}else{_0x3d6720=0xce;}_0x11486e[_0xe760('0x1a')](_0x3d6720);return _0x11486e[_0xe760('0x20')]('Content-Range',_0x1a85db+'-'+_0x452927+'/'+_0x29f79b)[_0xe760('0x1b')](_0x5adc6b);}return null;};}function patchUpdates(_0x463972){return function(_0x41c2fc){try{jsonpatch[_0xe760('0x21')](_0x41c2fc,_0x463972,!![]);}catch(_0x2a7782){return BPromise['reject'](_0x2a7782);}return _0x41c2fc[_0xe760('0x22')]();};}function saveUpdates(_0x4aa3e7,_0x199739){return function(_0x24be5d){if(_0x24be5d){return _0x24be5d[_0xe760('0x23')](_0x4aa3e7)[_0xe760('0x24')](function(_0x4ac989){return _0x4ac989;});}return null;};}function removeEntity(_0x40f663,_0x2e594f){return function(_0x54388d){if(_0x54388d){return _0x54388d[_0xe760('0x25')]()[_0xe760('0x24')](function(){_0x40f663[_0xe760('0x1a')](0xcc)[_0xe760('0x19')]();});}};}function handleEntityNotFound(_0x5d2c8d,_0x58342d){return function(_0x2d82d1){if(!_0x2d82d1){_0x5d2c8d[_0xe760('0x18')](0x194);}return _0x2d82d1;};}function handleError(_0x331f17,_0x1bc6d5){_0x1bc6d5=_0x1bc6d5||0x1f4;return function(_0x420925){logger[_0xe760('0x26')](_0x420925[_0xe760('0x27')]);if(_0x420925[_0xe760('0x28')]){delete _0x420925[_0xe760('0x28')];}_0x331f17[_0xe760('0x1a')](_0x1bc6d5)[_0xe760('0x29')](_0x420925);};}exports['index']=function(_0x478e97,_0x42fb1f){var _0x5806f6={},_0x112a1c={},_0x5d8555={'count':0x0,'rows':[]};var _0xd80839=_[_0xe760('0x2a')](db['OpenchannelQueueReport'][_0xe760('0x2b')],function(_0x29ae41){return{'name':_0x29ae41['fieldName'],'type':_0x29ae41[_0xe760('0x2c')][_0xe760('0x2d')]};});_0x112a1c[_0xe760('0x2e')]=_[_0xe760('0x2a')](_0xd80839,_0xe760('0x28'));_0x112a1c[_0xe760('0x2f')]=_['keys'](_0x478e97[_0xe760('0x2f')]);_0x112a1c[_0xe760('0x30')]=_[_0xe760('0x31')](_0x112a1c[_0xe760('0x2e')],_0x112a1c[_0xe760('0x2f')]);_0x5806f6['attributes']=_[_0xe760('0x31')](_0x112a1c['model'],qs[_0xe760('0x32')](_0x478e97[_0xe760('0x2f')][_0xe760('0x32')]));_0x5806f6[_0xe760('0x33')]=_0x5806f6['attributes'][_0xe760('0x34')]?_0x5806f6['attributes']:_0x112a1c[_0xe760('0x2e')];if(!_0x478e97[_0xe760('0x2f')][_0xe760('0x35')](_0xe760('0x36'))){_0x5806f6[_0xe760('0x1d')]=qs[_0xe760('0x1d')](_0x478e97['query'][_0xe760('0x1d')]);_0x5806f6[_0xe760('0x1c')]=qs[_0xe760('0x1c')](_0x478e97[_0xe760('0x2f')][_0xe760('0x1c')]);}_0x5806f6[_0xe760('0x37')]=qs[_0xe760('0x38')](_0x478e97[_0xe760('0x2f')]['sort']);_0x5806f6[_0xe760('0x39')]=qs['filters'](_['pick'](_0x478e97[_0xe760('0x2f')],_0x112a1c[_0xe760('0x30')]),_0xd80839);if(_0x478e97[_0xe760('0x2f')][_0xe760('0x3a')]){_0x5806f6[_0xe760('0x39')]=_[_0xe760('0x3b')](_0x5806f6['where'],{'$or':_[_0xe760('0x2a')](_0xd80839,function(_0x10044f){if(_0x10044f[_0xe760('0x2c')]!==_0xe760('0x3c')){var _0x540879={};_0x540879[_0x10044f['name']]={'$like':'%'+_0x478e97[_0xe760('0x2f')]['filter']+'%'};return _0x540879;}})});}_0x5806f6=_[_0xe760('0x3b')]({},_0x5806f6,_0x478e97[_0xe760('0x3d')]);var _0x5794c9={'where':_0x5806f6['where']};return db[_0xe760('0x3e')][_0xe760('0x1f')](_0x5794c9)['then'](function(_0xfbf410){_0x5d8555[_0xe760('0x1f')]=_0xfbf410;if(_0x478e97[_0xe760('0x2f')][_0xe760('0x3f')]){_0x5806f6[_0xe760('0x40')]=[{'all':!![]}];}return db[_0xe760('0x3e')][_0xe760('0x41')](_0x5806f6);})[_0xe760('0x24')](function(_0x49b207){_0x5d8555[_0xe760('0x42')]=_0x49b207;return _0x5d8555;})['then'](respondWithFilteredResult(_0x42fb1f,_0x5806f6))[_0xe760('0x43')](handleError(_0x42fb1f,null));};exports['show']=function(_0x261fad,_0x26a970){var _0x358c91={'raw':!![],'where':{'id':_0x261fad[_0xe760('0x44')]['id']}},_0x99d33={};_0x99d33[_0xe760('0x2e')]=_[_0xe760('0x45')](db['OpenchannelQueueReport'][_0xe760('0x2b')]);_0x99d33[_0xe760('0x2f')]=_[_0xe760('0x45')](_0x261fad['query']);_0x99d33[_0xe760('0x30')]=_[_0xe760('0x31')](_0x99d33[_0xe760('0x2e')],_0x99d33[_0xe760('0x2f')]);_0x358c91[_0xe760('0x33')]=_[_0xe760('0x31')](_0x99d33[_0xe760('0x2e')],qs[_0xe760('0x32')](_0x261fad['query'][_0xe760('0x32')]));_0x358c91['attributes']=_0x358c91[_0xe760('0x33')][_0xe760('0x34')]?_0x358c91[_0xe760('0x33')]:_0x99d33['model'];if(_0x261fad[_0xe760('0x2f')][_0xe760('0x3f')]){_0x358c91[_0xe760('0x40')]=[{'all':!![]}];}_0x358c91=_[_0xe760('0x3b')]({},_0x358c91,_0x261fad[_0xe760('0x3d')]);return db[_0xe760('0x3e')][_0xe760('0x46')](_0x358c91)[_0xe760('0x24')](handleEntityNotFound(_0x26a970,null))['then'](respondWithResult(_0x26a970,null))[_0xe760('0x43')](handleError(_0x26a970,null));};exports[_0xe760('0x47')]=function(_0x30ac08,_0x45a177){return db[_0xe760('0x3e')][_0xe760('0x47')](_0x30ac08[_0xe760('0x48')],{})['then'](respondWithResult(_0x45a177,0xc9))[_0xe760('0x43')](handleError(_0x45a177,null));};exports['update']=function(_0x36f8cc,_0x3a5bdb){if(_0x36f8cc['body']['id']){delete _0x36f8cc[_0xe760('0x48')]['id'];}return db[_0xe760('0x3e')][_0xe760('0x46')]({'where':{'id':_0x36f8cc['params']['id']}})[_0xe760('0x24')](handleEntityNotFound(_0x3a5bdb,null))['then'](saveUpdates(_0x36f8cc[_0xe760('0x48')],null))[_0xe760('0x24')](respondWithResult(_0x3a5bdb,null))[_0xe760('0x43')](handleError(_0x3a5bdb,null));};exports[_0xe760('0x25')]=function(_0x4fed15,_0x134d10){return db[_0xe760('0x3e')][_0xe760('0x46')]({'where':{'id':_0x4fed15[_0xe760('0x44')]['id']}})[_0xe760('0x24')](handleEntityNotFound(_0x134d10,null))['then'](removeEntity(_0x134d10,null))[_0xe760('0x43')](handleError(_0x134d10,null));};exports[_0xe760('0x49')]=function(_0x2eeddc,_0x10a5e9){return db['OpenchannelQueueReport'][_0xe760('0x49')]()[_0xe760('0x24')](respondWithResult(_0x10a5e9,null))[_0xe760('0x43')](handleError(_0x10a5e9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 75f3c83..e51ca13 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x43e1d2,_0x47594e){var _0x12e592=function(_0x3235b4){while(--_0x3235b4){_0x43e1d2['push'](_0x43e1d2['shift']());}};_0x12e592(++_0x47594e);}(_0x7a54,0x106));var _0x47a5=function(_0x1e39f0,_0x19ea75){_0x1e39f0=_0x1e39f0-0x0;var _0x3ab924=_0x7a54[_0x1e39f0];return _0x3ab924;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x476c6f,_0x5dc8b9){var _0x53e534=function(_0x344f0d){while(--_0x344f0d){_0x476c6f['push'](_0x476c6f['shift']());}};_0x53e534(++_0x5dc8b9);}(_0xe14b,0x93));var _0xbe14=function(_0x1f49c2,_0xeb4570){_0x1f49c2=_0x1f49c2-0x0;var _0x11bb4d=_0xe14b[_0x1f49c2];return _0x11bb4d;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 5730a15..c19ae35 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 _0x4325=['result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','update','where','attributes','UpdateOpenchannelQueueReport','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info'];(function(_0x5112da,_0x5affc7){var _0x4fdd9f=function(_0x5c5492){while(--_0x5c5492){_0x5112da['push'](_0x5112da['shift']());}};_0x4fdd9f(++_0x5affc7);}(_0x4325,0x1da));var _0x5432=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4325[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});}exports[_0x5432('0x17')]=function(_0x32fe60){var _0x4221a8=this;return new Promise(function(_0x5f011f,_0x3f3873){return db[_0x5432('0x18')][_0x5432('0x19')](_0x32fe60[_0x5432('0x1a')],{'raw':_0x32fe60[_0x5432('0x1b')]?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x66911a){logger[_0x5432('0x14')](_0x5432('0x17'),_0x32fe60);logger[_0x5432('0xd')](_0x5432('0x17'),_0x32fe60,JSON['stringify'](_0x66911a));_0x5f011f(_0x66911a);})['catch'](function(_0x4d09cd){logger[_0x5432('0x12')](_0x5432('0x17'),_0x4d09cd[_0x5432('0x13')],_0x32fe60);_0x3f3873(_0x4221a8[_0x5432('0x12')](0x1f4,_0x4d09cd['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3e0b66){var _0x8ed74b=this;return new Promise(function(_0x4a40fc,_0x19e6b2){return db[_0x5432('0x18')][_0x5432('0x1d')](_0x3e0b66['body'],{'raw':_0x3e0b66[_0x5432('0x1b')]?_0x3e0b66[_0x5432('0x1b')][_0x5432('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e0b66['options']?_0x3e0b66['options'][_0x5432('0x1e')]||null:null,'attributes':_0x3e0b66[_0x5432('0x1b')]?_0x3e0b66['options'][_0x5432('0x1f')]||null:null,'limit':_0x3e0b66[_0x5432('0x1b')]?_0x3e0b66[_0x5432('0x1b')]['limit']||null:null})[_0x5432('0xb')](function(_0x5be867){logger['info'](_0x5432('0x20'),_0x3e0b66);logger['debug'](_0x5432('0x20'),_0x3e0b66,JSON['stringify'](_0x5be867));_0x4a40fc(_0x5be867);})['catch'](function(_0x465a09){logger[_0x5432('0x12')](_0x5432('0x20'),_0x465a09['message'],_0x3e0b66);_0x19e6b2(_0x8ed74b[_0x5432('0x12')](0x1f4,_0x465a09[_0x5432('0x13')]));});});}; \ No newline at end of file +var _0x19e1=['where','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update'];(function(_0x365908,_0x15d8c8){var _0x53c2d5=function(_0x17f7a5){while(--_0x17f7a5){_0x365908['push'](_0x365908['shift']());}};_0x53c2d5(++_0x15d8c8);}(_0x19e1,0x163));var _0x119e=function(_0x4e90e3,_0x570a1d){_0x4e90e3=_0x4e90e3-0x0;var _0x295e5b=_0x19e1[_0x4e90e3];return _0x295e5b;};'use strict';var _=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var moment=require(_0x119e('0x2'));var BPromise=require(_0x119e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x119e('0x4'))['db'];var utils=require(_0x119e('0x5'));var logger=require('../../config/logger')(_0x119e('0x6'));var config=require(_0x119e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x119e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5306,_0x25e166,_0x16a2ee){return new BPromise(function(_0x1b3797,_0x53d5b7){return client[_0x119e('0x9')](_0x1b5306,_0x16a2ee)[_0x119e('0xa')](function(_0x1a6747){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x25e166,_0x119e('0xb'));logger[_0x119e('0xc')](_0x119e('0xd'),_0x25e166,_0x119e('0xb'),JSON[_0x119e('0xe')](_0x1a6747));if(_0x1a6747[_0x119e('0xf')]){if(_0x1a6747[_0x119e('0xf')]['code']===0x1f4){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x53d5b7(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}logger['error'](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x1b3797(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}else{logger[_0x119e('0x12')](_0x119e('0x10'),_0x25e166,_0x119e('0xb'));_0x1b3797(_0x1a6747[_0x119e('0x13')][_0x119e('0x11')]);}})[_0x119e('0x14')](function(_0x54c326){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x54c326);_0x53d5b7(_0x54c326);});});}exports[_0x119e('0x15')]=function(_0xb3375c){var _0x348ae3=this;return new Promise(function(_0xedc945,_0x2848fa){return db[_0x119e('0x16')][_0x119e('0x17')](_0xb3375c[_0x119e('0x18')],{'raw':_0xb3375c[_0x119e('0x19')]?_0xb3375c['options'][_0x119e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xd4c2d5){logger['info'](_0x119e('0x15'),_0xb3375c);logger[_0x119e('0xc')]('CreateOpenchannelQueueReport',_0xb3375c,JSON['stringify'](_0xd4c2d5));_0xedc945(_0xd4c2d5);})[_0x119e('0x14')](function(_0x29de19){logger[_0x119e('0xf')]('CreateOpenchannelQueueReport',_0x29de19['message'],_0xb3375c);_0x2848fa(_0x348ae3[_0x119e('0xf')](0x1f4,_0x29de19['message']));});});};exports[_0x119e('0x1b')]=function(_0x21fb19){var _0x198f7b=this;return new Promise(function(_0x596dfb,_0x1e4c98){return db['OpenchannelQueueReport'][_0x119e('0x1c')](_0x21fb19['body'],{'raw':_0x21fb19['options']?_0x21fb19[_0x119e('0x19')][_0x119e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21fb19[_0x119e('0x19')]?_0x21fb19[_0x119e('0x19')][_0x119e('0x1d')]||null:null,'attributes':_0x21fb19[_0x119e('0x19')]?_0x21fb19['options'][_0x119e('0x1e')]||null:null,'limit':_0x21fb19[_0x119e('0x19')]?_0x21fb19['options'][_0x119e('0x1f')]||null:null})[_0x119e('0xa')](function(_0x49b965){logger[_0x119e('0x12')]('UpdateOpenchannelQueueReport',_0x21fb19);logger[_0x119e('0xc')](_0x119e('0x1b'),_0x21fb19,JSON[_0x119e('0xe')](_0x49b965));_0x596dfb(_0x49b965);})[_0x119e('0x14')](function(_0x3df7e9){logger['error'](_0x119e('0x1b'),_0x3df7e9[_0x119e('0x11')],_0x21fb19);_0x1e4c98(_0x198f7b[_0x119e('0xf')](0x1f4,_0x3df7e9[_0x119e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index cc6ffc9..97c9025 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 _0xce7c=['../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xce7c,0x139));var _0xcce7=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0xce7c[_0x5cc8b9];return _0x58892e;};'use strict';var multer=require(_0xcce7('0x0'));var util=require(_0xcce7('0x1'));var path=require(_0xcce7('0x2'));var timeout=require(_0xcce7('0x3'));var express=require(_0xcce7('0x4'));var router=express[_0xcce7('0x5')]();var fs_extra=require(_0xcce7('0x6'));var auth=require(_0xcce7('0x7'));var interaction=require(_0xcce7('0x8'));var config=require(_0xcce7('0x9'));var controller=require(_0xcce7('0xa'));router[_0xcce7('0xb')]('/',auth[_0xcce7('0xc')](),controller[_0xcce7('0xd')]);router[_0xcce7('0xb')](_0xcce7('0xe'),auth[_0xcce7('0xc')](),controller[_0xcce7('0xf')]);router['get'](_0xcce7('0x10'),auth[_0xcce7('0xc')](),controller[_0xcce7('0x11')]);router[_0xcce7('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcce7('0x13')](_0xcce7('0x10'),auth[_0xcce7('0xc')](),controller[_0xcce7('0x14')]);router['delete'](_0xcce7('0x10'),auth[_0xcce7('0xc')](),controller[_0xcce7('0x15')]);module[_0xcce7('0x16')]=router; \ No newline at end of file +var _0x0875=['isAuthenticated','index','get','/:id','show','put','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x166d1b,_0x4483f7){var _0x351c48=function(_0x298eed){while(--_0x298eed){_0x166d1b['push'](_0x166d1b['shift']());}};_0x351c48(++_0x4483f7);}(_0x0875,0x107));var _0x5087=function(_0x58eae9,_0x70c5bc){_0x58eae9=_0x58eae9-0x0;var _0x239e2b=_0x0875[_0x58eae9];return _0x239e2b;};'use strict';var multer=require(_0x5087('0x0'));var util=require(_0x5087('0x1'));var path=require(_0x5087('0x2'));var timeout=require(_0x5087('0x3'));var express=require('express');var router=express[_0x5087('0x4')]();var fs_extra=require(_0x5087('0x5'));var auth=require(_0x5087('0x6'));var interaction=require(_0x5087('0x7'));var config=require(_0x5087('0x8'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0x5087('0x9')](),controller[_0x5087('0xa')]);router['get']('/describe',auth[_0x5087('0x9')](),controller['describe']);router[_0x5087('0xb')](_0x5087('0xc'),auth[_0x5087('0x9')](),controller[_0x5087('0xd')]);router['post']('/',auth[_0x5087('0x9')](),controller['create']);router[_0x5087('0xe')]('/:id',auth[_0x5087('0x9')](),controller[_0x5087('0xf')]);router['delete'](_0x5087('0xc'),auth[_0x5087('0x9')](),controller[_0x5087('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index b3b9150..3ae9d59 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x9e29c2,_0x309a13){var _0x44e61e=function(_0x3f2f62){while(--_0x3f2f62){_0x9e29c2['push'](_0x9e29c2['shift']());}};_0x44e61e(++_0x309a13);}(_0x70e0,0x17b));var _0x070e=function(_0x284eed,_0x3ece19){_0x284eed=_0x284eed-0x0;var _0x39b6f4=_0x70e0[_0x284eed];return _0x39b6f4;};'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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x1dbc0b,_0x3a7169){var _0x2b48e8=function(_0x55c3dd){while(--_0x55c3dd){_0x1dbc0b['push'](_0x1dbc0b['shift']());}};_0x2b48e8(++_0x3a7169);}(_0xedd9,0xfc));var _0x9edd=function(_0x1e0ce6,_0x193cdc){_0x1e0ce6=_0x1e0ce6-0x0;var _0x12f74d=_0xedd9[_0x1e0ce6];return _0x12f74d;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 8ac4e0b..34fcd57 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 _0x228c=['filters','model','attributes','fields','length','nolimit','order','sort','where','merge','include','findAll','rows','catch','show','params','intersection','includeAll','create','body','find','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','keys'];(function(_0x45830c,_0x43544d){var _0x551f1e=function(_0x19cfb4){while(--_0x19cfb4){_0x45830c['push'](_0x45830c['shift']());}};_0x551f1e(++_0x43544d);}(_0x228c,0x192));var _0xc228=function(_0x6d7997,_0xc468f7){_0x6d7997=_0x6d7997-0x0;var _0x509854=_0x228c[_0x6d7997];return _0x509854;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc228('0x0'));var rp=require(_0xc228('0x1'));var moment=require(_0xc228('0x2'));var BPromise=require(_0xc228('0x3'));var Mustache=require(_0xc228('0x4'));var util=require(_0xc228('0x5'));var path=require(_0xc228('0x6'));var sox=require(_0xc228('0x7'));var csv=require(_0xc228('0x8'));var ejs=require(_0xc228('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc228('0xa'));var squel=require('squel');var crypto=require(_0xc228('0xb'));var jsforce=require(_0xc228('0xc'));var deskjs=require(_0xc228('0xd'));var toCsv=require(_0xc228('0x8'));var querystring=require(_0xc228('0xe'));var Papa=require(_0xc228('0xf'));var Redis=require('ioredis');var authService=require(_0xc228('0x10'));var qs=require(_0xc228('0x11'));var as=require(_0xc228('0x12'));var hardwareService=require(_0xc228('0x13'));var logger=require(_0xc228('0x14'))('api');var utils=require(_0xc228('0x15'));var config=require(_0xc228('0x16'));var licenseUtil=require(_0xc228('0x17'));var db=require(_0xc228('0x18'))['db'];function respondWithStatusCode(_0x32ba0c,_0x33823c){_0x33823c=_0x33823c||0xcc;return function(_0x57c962){if(_0x57c962){return _0x32ba0c[_0xc228('0x19')](_0x33823c);}return _0x32ba0c[_0xc228('0x1a')](_0x33823c)[_0xc228('0x1b')]();};}function respondWithResult(_0x39336b,_0x3f920b){_0x3f920b=_0x3f920b||0xc8;return function(_0x2d0f24){if(_0x2d0f24){return _0x39336b[_0xc228('0x1a')](_0x3f920b)[_0xc228('0x1c')](_0x2d0f24);}};}function respondWithFilteredResult(_0x1ac219,_0x2c72ed){return function(_0x27a053){if(_0x27a053){var _0x3dc36e=typeof _0x2c72ed[_0xc228('0x1d')]===_0xc228('0x1e')&&typeof _0x2c72ed[_0xc228('0x1f')]==='undefined';var _0x24106f=_0x27a053[_0xc228('0x20')];var _0x50aed6=_0x3dc36e?0x0:_0x2c72ed[_0xc228('0x1d')];var _0x560057=_0x3dc36e?_0x27a053[_0xc228('0x20')]:_0x2c72ed[_0xc228('0x1d')]+_0x2c72ed[_0xc228('0x1f')];var _0x47c724;if(_0x560057>=_0x24106f){_0x560057=_0x24106f;_0x47c724=0xc8;}else{_0x47c724=0xce;}_0x1ac219[_0xc228('0x1a')](_0x47c724);return _0x1ac219[_0xc228('0x21')](_0xc228('0x22'),_0x50aed6+'-'+_0x560057+'/'+_0x24106f)[_0xc228('0x1c')](_0x27a053);}return null;};}function patchUpdates(_0xf51b1d){return function(_0x12eb12){try{jsonpatch[_0xc228('0x23')](_0x12eb12,_0xf51b1d,!![]);}catch(_0x45d4d4){return BPromise[_0xc228('0x24')](_0x45d4d4);}return _0x12eb12[_0xc228('0x25')]();};}function saveUpdates(_0x14f858,_0xe39bb1){return function(_0x2237da){if(_0x2237da){return _0x2237da[_0xc228('0x26')](_0x14f858)[_0xc228('0x27')](function(_0x42f505){return _0x42f505;});}return null;};}function removeEntity(_0x4931ea,_0x58148f){return function(_0x388c94){if(_0x388c94){return _0x388c94[_0xc228('0x28')]()[_0xc228('0x27')](function(){_0x4931ea[_0xc228('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb0fa,_0x5ae8bc){return function(_0x3a56a2){if(!_0x3a56a2){_0x2bb0fa[_0xc228('0x19')](0x194);}return _0x3a56a2;};}function handleError(_0x5001ad,_0x4086eb){_0x4086eb=_0x4086eb||0x1f4;return function(_0x6a8ccd){logger[_0xc228('0x29')](_0x6a8ccd[_0xc228('0x2a')]);if(_0x6a8ccd[_0xc228('0x2b')]){delete _0x6a8ccd[_0xc228('0x2b')];}_0x5001ad[_0xc228('0x1a')](_0x4086eb)[_0xc228('0x2c')](_0x6a8ccd);};}exports[_0xc228('0x2d')]=function(_0x5842dd,_0x450f5d){var _0x6584cc={},_0x55c98b={},_0x4a3f97={'count':0x0,'rows':[]};var _0x2fde09=_[_0xc228('0x2e')](db[_0xc228('0x2f')][_0xc228('0x30')],function(_0x3edc64){return{'name':_0x3edc64[_0xc228('0x31')],'type':_0x3edc64[_0xc228('0x32')][_0xc228('0x33')]};});_0x55c98b['model']=_[_0xc228('0x2e')](_0x2fde09,_0xc228('0x2b'));_0x55c98b[_0xc228('0x34')]=_[_0xc228('0x35')](_0x5842dd[_0xc228('0x34')]);_0x55c98b[_0xc228('0x36')]=_['intersection'](_0x55c98b[_0xc228('0x37')],_0x55c98b['query']);_0x6584cc[_0xc228('0x38')]=_['intersection'](_0x55c98b[_0xc228('0x37')],qs[_0xc228('0x39')](_0x5842dd[_0xc228('0x34')]['fields']));_0x6584cc['attributes']=_0x6584cc['attributes'][_0xc228('0x3a')]?_0x6584cc[_0xc228('0x38')]:_0x55c98b[_0xc228('0x37')];if(!_0x5842dd[_0xc228('0x34')]['hasOwnProperty'](_0xc228('0x3b'))){_0x6584cc[_0xc228('0x1f')]=qs[_0xc228('0x1f')](_0x5842dd['query'][_0xc228('0x1f')]);_0x6584cc[_0xc228('0x1d')]=qs[_0xc228('0x1d')](_0x5842dd[_0xc228('0x34')]['offset']);}_0x6584cc[_0xc228('0x3c')]=qs[_0xc228('0x3d')](_0x5842dd[_0xc228('0x34')]['sort']);_0x6584cc[_0xc228('0x3e')]=qs['filters'](_['pick'](_0x5842dd[_0xc228('0x34')],_0x55c98b[_0xc228('0x36')]),_0x2fde09);if(_0x5842dd[_0xc228('0x34')]['filter']){_0x6584cc[_0xc228('0x3e')]=_[_0xc228('0x3f')](_0x6584cc[_0xc228('0x3e')],{'$or':_['map'](_0x2fde09,function(_0xefba21){if(_0xefba21['type']!=='VIRTUAL'){var _0x192acf={};_0x192acf[_0xefba21[_0xc228('0x2b')]]={'$like':'%'+_0x5842dd[_0xc228('0x34')]['filter']+'%'};return _0x192acf;}})});}_0x6584cc=_[_0xc228('0x3f')]({},_0x6584cc,_0x5842dd['options']);var _0x228c67={'where':_0x6584cc[_0xc228('0x3e')]};return db['OpenchannelTransferReport']['count'](_0x228c67)['then'](function(_0x96c0ab){_0x4a3f97[_0xc228('0x20')]=_0x96c0ab;if(_0x5842dd['query']['includeAll']){_0x6584cc[_0xc228('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xc228('0x41')](_0x6584cc);})[_0xc228('0x27')](function(_0x44f783){_0x4a3f97[_0xc228('0x42')]=_0x44f783;return _0x4a3f97;})[_0xc228('0x27')](respondWithFilteredResult(_0x450f5d,_0x6584cc))[_0xc228('0x43')](handleError(_0x450f5d,null));};exports[_0xc228('0x44')]=function(_0x5b0e0b,_0x47ae46){var _0x2278a6={'raw':!![],'where':{'id':_0x5b0e0b[_0xc228('0x45')]['id']}},_0x5a0150={};_0x5a0150[_0xc228('0x37')]=_[_0xc228('0x35')](db['OpenchannelTransferReport'][_0xc228('0x30')]);_0x5a0150[_0xc228('0x34')]=_[_0xc228('0x35')](_0x5b0e0b['query']);_0x5a0150[_0xc228('0x36')]=_[_0xc228('0x46')](_0x5a0150[_0xc228('0x37')],_0x5a0150[_0xc228('0x34')]);_0x2278a6[_0xc228('0x38')]=_[_0xc228('0x46')](_0x5a0150['model'],qs[_0xc228('0x39')](_0x5b0e0b[_0xc228('0x34')][_0xc228('0x39')]));_0x2278a6[_0xc228('0x38')]=_0x2278a6[_0xc228('0x38')][_0xc228('0x3a')]?_0x2278a6[_0xc228('0x38')]:_0x5a0150[_0xc228('0x37')];if(_0x5b0e0b[_0xc228('0x34')][_0xc228('0x47')]){_0x2278a6[_0xc228('0x40')]=[{'all':!![]}];}_0x2278a6=_[_0xc228('0x3f')]({},_0x2278a6,_0x5b0e0b['options']);return db[_0xc228('0x2f')]['find'](_0x2278a6)[_0xc228('0x27')](handleEntityNotFound(_0x47ae46,null))[_0xc228('0x27')](respondWithResult(_0x47ae46,null))[_0xc228('0x43')](handleError(_0x47ae46,null));};exports['create']=function(_0x1c0814,_0x4371f9){return db['OpenchannelTransferReport'][_0xc228('0x48')](_0x1c0814[_0xc228('0x49')],{})[_0xc228('0x27')](respondWithResult(_0x4371f9,0xc9))[_0xc228('0x43')](handleError(_0x4371f9,null));};exports[_0xc228('0x26')]=function(_0xad17c9,_0x48a369){if(_0xad17c9[_0xc228('0x49')]['id']){delete _0xad17c9[_0xc228('0x49')]['id'];}return db['OpenchannelTransferReport'][_0xc228('0x4a')]({'where':{'id':_0xad17c9[_0xc228('0x45')]['id']}})['then'](handleEntityNotFound(_0x48a369,null))[_0xc228('0x27')](saveUpdates(_0xad17c9[_0xc228('0x49')],null))[_0xc228('0x27')](respondWithResult(_0x48a369,null))[_0xc228('0x43')](handleError(_0x48a369,null));};exports[_0xc228('0x28')]=function(_0x5d06f9,_0x70484d){return db[_0xc228('0x2f')][_0xc228('0x4a')]({'where':{'id':_0x5d06f9[_0xc228('0x45')]['id']}})[_0xc228('0x27')](handleEntityNotFound(_0x70484d,null))[_0xc228('0x27')](removeEntity(_0x70484d,null))[_0xc228('0x43')](handleError(_0x70484d,null));};exports[_0xc228('0x4b')]=function(_0x10bb3f,_0x44c70a){return db[_0xc228('0x2f')][_0xc228('0x4b')]()[_0xc228('0x27')](respondWithResult(_0x44c70a,null))['catch'](handleError(_0x44c70a,null));}; \ No newline at end of file +var _0xca38=['include','rows','catch','show','params','rawAttributes','keys','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','limit','Content-Range','reject','save','update','destroy','then','stack','name','index','map','OpenchannelTransferReport','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x22696d,_0x174330){var _0x35e9b9=function(_0x2fd472){while(--_0x2fd472){_0x22696d['push'](_0x22696d['shift']());}};_0x35e9b9(++_0x174330);}(_0xca38,0x127));var _0x8ca3=function(_0x606a15,_0x172191){_0x606a15=_0x606a15-0x0;var _0x238702=_0xca38[_0x606a15];return _0x238702;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ca3('0x0'));var zipdir=require(_0x8ca3('0x1'));var jsonpatch=require(_0x8ca3('0x2'));var rp=require(_0x8ca3('0x3'));var moment=require('moment');var BPromise=require(_0x8ca3('0x4'));var Mustache=require(_0x8ca3('0x5'));var util=require(_0x8ca3('0x6'));var path=require(_0x8ca3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8ca3('0x8'));var fs=require('fs');var fs_extra=require(_0x8ca3('0x9'));var _=require(_0x8ca3('0xa'));var squel=require('squel');var crypto=require(_0x8ca3('0xb'));var jsforce=require(_0x8ca3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8ca3('0xd'));var querystring=require(_0x8ca3('0xe'));var Papa=require(_0x8ca3('0xf'));var Redis=require(_0x8ca3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8ca3('0x11'));var as=require(_0x8ca3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ca3('0x13'))('api');var utils=require(_0x8ca3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8ca3('0x15'));var db=require(_0x8ca3('0x16'))['db'];function respondWithStatusCode(_0x2432fe,_0x13266b){_0x13266b=_0x13266b||0xcc;return function(_0x4ce993){if(_0x4ce993){return _0x2432fe[_0x8ca3('0x17')](_0x13266b);}return _0x2432fe[_0x8ca3('0x18')](_0x13266b)['end']();};}function respondWithResult(_0x49620a,_0x121850){_0x121850=_0x121850||0xc8;return function(_0x5f26c9){if(_0x5f26c9){return _0x49620a[_0x8ca3('0x18')](_0x121850)[_0x8ca3('0x19')](_0x5f26c9);}};}function respondWithFilteredResult(_0x14a69c,_0x3e10af){return function(_0x165fac){if(_0x165fac){var _0xb0545c=typeof _0x3e10af['offset']===_0x8ca3('0x1a')&&typeof _0x3e10af['limit']==='undefined';var _0x5b0702=_0x165fac['count'];var _0x1275ac=_0xb0545c?0x0:_0x3e10af['offset'];var _0x4e1b45=_0xb0545c?_0x165fac[_0x8ca3('0x1b')]:_0x3e10af['offset']+_0x3e10af[_0x8ca3('0x1c')];var _0x5c57d6;if(_0x4e1b45>=_0x5b0702){_0x4e1b45=_0x5b0702;_0x5c57d6=0xc8;}else{_0x5c57d6=0xce;}_0x14a69c[_0x8ca3('0x18')](_0x5c57d6);return _0x14a69c['set'](_0x8ca3('0x1d'),_0x1275ac+'-'+_0x4e1b45+'/'+_0x5b0702)[_0x8ca3('0x19')](_0x165fac);}return null;};}function patchUpdates(_0x621ae8){return function(_0x37872a){try{jsonpatch['apply'](_0x37872a,_0x621ae8,!![]);}catch(_0x4e610f){return BPromise[_0x8ca3('0x1e')](_0x4e610f);}return _0x37872a[_0x8ca3('0x1f')]();};}function saveUpdates(_0x22ddfc,_0x5819ee){return function(_0x39e5b3){if(_0x39e5b3){return _0x39e5b3[_0x8ca3('0x20')](_0x22ddfc)['then'](function(_0x2867d2){return _0x2867d2;});}return null;};}function removeEntity(_0x25a1b7,_0x1ff305){return function(_0x2ab72d){if(_0x2ab72d){return _0x2ab72d[_0x8ca3('0x21')]()[_0x8ca3('0x22')](function(){_0x25a1b7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38941a,_0x8641a4){return function(_0x2c9507){if(!_0x2c9507){_0x38941a[_0x8ca3('0x17')](0x194);}return _0x2c9507;};}function handleError(_0x2068ad,_0x447f0e){_0x447f0e=_0x447f0e||0x1f4;return function(_0x4f431a){logger['error'](_0x4f431a[_0x8ca3('0x23')]);if(_0x4f431a[_0x8ca3('0x24')]){delete _0x4f431a[_0x8ca3('0x24')];}_0x2068ad['status'](_0x447f0e)['send'](_0x4f431a);};}exports[_0x8ca3('0x25')]=function(_0x20f2ad,_0x3c7c49){var _0x144673={},_0x1a8bf8={},_0x3f01b0={'count':0x0,'rows':[]};var _0x53dcc0=_[_0x8ca3('0x26')](db[_0x8ca3('0x27')]['rawAttributes'],function(_0x4b5d96){return{'name':_0x4b5d96[_0x8ca3('0x28')],'type':_0x4b5d96['type'][_0x8ca3('0x29')]};});_0x1a8bf8[_0x8ca3('0x2a')]=_[_0x8ca3('0x26')](_0x53dcc0,_0x8ca3('0x24'));_0x1a8bf8[_0x8ca3('0x2b')]=_['keys'](_0x20f2ad[_0x8ca3('0x2b')]);_0x1a8bf8[_0x8ca3('0x2c')]=_[_0x8ca3('0x2d')](_0x1a8bf8[_0x8ca3('0x2a')],_0x1a8bf8['query']);_0x144673[_0x8ca3('0x2e')]=_['intersection'](_0x1a8bf8[_0x8ca3('0x2a')],qs[_0x8ca3('0x2f')](_0x20f2ad[_0x8ca3('0x2b')][_0x8ca3('0x2f')]));_0x144673[_0x8ca3('0x2e')]=_0x144673[_0x8ca3('0x2e')][_0x8ca3('0x30')]?_0x144673['attributes']:_0x1a8bf8['model'];if(!_0x20f2ad['query'][_0x8ca3('0x31')]('nolimit')){_0x144673['limit']=qs[_0x8ca3('0x1c')](_0x20f2ad[_0x8ca3('0x2b')][_0x8ca3('0x1c')]);_0x144673['offset']=qs[_0x8ca3('0x32')](_0x20f2ad[_0x8ca3('0x2b')][_0x8ca3('0x32')]);}_0x144673[_0x8ca3('0x33')]=qs['sort'](_0x20f2ad['query'][_0x8ca3('0x34')]);_0x144673[_0x8ca3('0x35')]=qs[_0x8ca3('0x2c')](_[_0x8ca3('0x36')](_0x20f2ad[_0x8ca3('0x2b')],_0x1a8bf8[_0x8ca3('0x2c')]),_0x53dcc0);if(_0x20f2ad[_0x8ca3('0x2b')][_0x8ca3('0x37')]){_0x144673[_0x8ca3('0x35')]=_[_0x8ca3('0x38')](_0x144673['where'],{'$or':_[_0x8ca3('0x26')](_0x53dcc0,function(_0x5b0b08){if(_0x5b0b08['type']!==_0x8ca3('0x39')){var _0x54ae6d={};_0x54ae6d[_0x5b0b08['name']]={'$like':'%'+_0x20f2ad[_0x8ca3('0x2b')][_0x8ca3('0x37')]+'%'};return _0x54ae6d;}})});}_0x144673=_['merge']({},_0x144673,_0x20f2ad[_0x8ca3('0x3a')]);var _0x1bd82d={'where':_0x144673[_0x8ca3('0x35')]};return db[_0x8ca3('0x27')][_0x8ca3('0x1b')](_0x1bd82d)[_0x8ca3('0x22')](function(_0x11133d){_0x3f01b0[_0x8ca3('0x1b')]=_0x11133d;if(_0x20f2ad[_0x8ca3('0x2b')][_0x8ca3('0x3b')]){_0x144673[_0x8ca3('0x3c')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x144673);})['then'](function(_0x44293a){_0x3f01b0[_0x8ca3('0x3d')]=_0x44293a;return _0x3f01b0;})['then'](respondWithFilteredResult(_0x3c7c49,_0x144673))[_0x8ca3('0x3e')](handleError(_0x3c7c49,null));};exports[_0x8ca3('0x3f')]=function(_0x72789c,_0x263bc8){var _0x57117f={'raw':!![],'where':{'id':_0x72789c[_0x8ca3('0x40')]['id']}},_0x26aaf8={};_0x26aaf8[_0x8ca3('0x2a')]=_['keys'](db['OpenchannelTransferReport'][_0x8ca3('0x41')]);_0x26aaf8[_0x8ca3('0x2b')]=_[_0x8ca3('0x42')](_0x72789c[_0x8ca3('0x2b')]);_0x26aaf8[_0x8ca3('0x2c')]=_[_0x8ca3('0x2d')](_0x26aaf8[_0x8ca3('0x2a')],_0x26aaf8[_0x8ca3('0x2b')]);_0x57117f[_0x8ca3('0x2e')]=_[_0x8ca3('0x2d')](_0x26aaf8[_0x8ca3('0x2a')],qs[_0x8ca3('0x2f')](_0x72789c[_0x8ca3('0x2b')][_0x8ca3('0x2f')]));_0x57117f[_0x8ca3('0x2e')]=_0x57117f[_0x8ca3('0x2e')][_0x8ca3('0x30')]?_0x57117f[_0x8ca3('0x2e')]:_0x26aaf8[_0x8ca3('0x2a')];if(_0x72789c[_0x8ca3('0x2b')]['includeAll']){_0x57117f['include']=[{'all':!![]}];}_0x57117f=_[_0x8ca3('0x38')]({},_0x57117f,_0x72789c[_0x8ca3('0x3a')]);return db['OpenchannelTransferReport'][_0x8ca3('0x43')](_0x57117f)[_0x8ca3('0x22')](handleEntityNotFound(_0x263bc8,null))[_0x8ca3('0x22')](respondWithResult(_0x263bc8,null))[_0x8ca3('0x3e')](handleError(_0x263bc8,null));};exports['create']=function(_0x39fa84,_0x29e6a4){return db[_0x8ca3('0x27')][_0x8ca3('0x44')](_0x39fa84['body'],{})['then'](respondWithResult(_0x29e6a4,0xc9))['catch'](handleError(_0x29e6a4,null));};exports[_0x8ca3('0x20')]=function(_0x277b71,_0x442a9b){if(_0x277b71[_0x8ca3('0x45')]['id']){delete _0x277b71[_0x8ca3('0x45')]['id'];}return db[_0x8ca3('0x27')][_0x8ca3('0x43')]({'where':{'id':_0x277b71[_0x8ca3('0x40')]['id']}})['then'](handleEntityNotFound(_0x442a9b,null))['then'](saveUpdates(_0x277b71[_0x8ca3('0x45')],null))[_0x8ca3('0x22')](respondWithResult(_0x442a9b,null))[_0x8ca3('0x3e')](handleError(_0x442a9b,null));};exports[_0x8ca3('0x21')]=function(_0x2c049f,_0x1e6965){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x2c049f[_0x8ca3('0x40')]['id']}})['then'](handleEntityNotFound(_0x1e6965,null))[_0x8ca3('0x22')](removeEntity(_0x1e6965,null))[_0x8ca3('0x3e')](handleError(_0x1e6965,null));};exports[_0x8ca3('0x46')]=function(_0x7296e4,_0x150c41){return db['OpenchannelTransferReport'][_0x8ca3('0x46')]()['then'](respondWithResult(_0x150c41,null))['catch'](handleError(_0x150c41,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 7ffbc98..bd6970b 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 _0xc300=['./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5887c8,_0x4b2ac9){var _0x2f9bef=function(_0x3a5e6d){while(--_0x3a5e6d){_0x5887c8['push'](_0x5887c8['shift']());}};_0x2f9bef(++_0x4b2ac9);}(_0xc300,0x16f));var _0x0c30=function(_0x587dd2,_0x212891){_0x587dd2=_0x587dd2-0x0;var _0xe9b6f3=_0xc300[_0x587dd2];return _0xe9b6f3;};'use strict';var _=require('lodash');var util=require(_0x0c30('0x0'));var logger=require('../../config/logger')(_0x0c30('0x1'));var moment=require(_0x0c30('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c30('0x3'));var fs=require('fs');var path=require(_0x0c30('0x4'));var rimraf=require(_0x0c30('0x5'));var config=require(_0x0c30('0x6'));var attributes=require(_0x0c30('0x7'));module['exports']=function(_0x18403e,_0x5addc9){return _0x18403e['define'](_0x0c30('0x8'),attributes,{'tableName':_0x0c30('0x9'),'paranoid':![],'indexes':[{'name':_0x0c30('0xa'),'fields':[_0x0c30('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f02=['api','moment','bluebird','request-promise','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x5c2849,_0x423ad6){var _0x5e3d89=function(_0x342c07){while(--_0x342c07){_0x5c2849['push'](_0x5c2849['shift']());}};_0x5e3d89(++_0x423ad6);}(_0x5f02,0x1b7));var _0x25f0=function(_0x2f717c,_0x258dc8){_0x2f717c=_0x2f717c-0x0;var _0x3767a7=_0x5f02[_0x2f717c];return _0x3767a7;};'use strict';var _=require(_0x25f0('0x0'));var util=require(_0x25f0('0x1'));var logger=require(_0x25f0('0x2'))(_0x25f0('0x3'));var moment=require(_0x25f0('0x4'));var BPromise=require(_0x25f0('0x5'));var rp=require(_0x25f0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x25f0('0x7'));var attributes=require(_0x25f0('0x8'));module[_0x25f0('0x9')]=function(_0x28066b,_0x4ee0ab){return _0x28066b[_0x25f0('0xa')](_0x25f0('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x25f0('0xc'),'fields':[_0x25f0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index c76ce75..46e386b 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 _0x27c5=['message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2acf2b,_0x878c3a){var _0x35bb96=function(_0x33f3af){while(--_0x33f3af){_0x2acf2b['push'](_0x2acf2b['shift']());}};_0x35bb96(++_0x878c3a);}(_0x27c5,0x173));var _0x527c=function(_0x50811d,_0x17d91c){_0x50811d=_0x50811d-0x0;var _0x4f1582=_0x27c5[_0x50811d];return _0x4f1582;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x527c('0x0'));var BPromise=require(_0x527c('0x1'));var rs=require(_0x527c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x527c('0x3'))['db'];var utils=require(_0x527c('0x4'));var logger=require(_0x527c('0x5'))(_0x527c('0x6'));var config=require(_0x527c('0x7'));var jayson=require(_0x527c('0x8'));var client=jayson[_0x527c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18c413,_0x5a68e8,_0x2db820){return new BPromise(function(_0x5e07ba,_0x1071f5){return client[_0x527c('0xa')](_0x18c413,_0x2db820)[_0x527c('0xb')](function(_0x49465c){logger[_0x527c('0xc')](_0x527c('0xd'),_0x5a68e8,_0x527c('0xe'));logger[_0x527c('0xf')](_0x527c('0x10'),_0x5a68e8,_0x527c('0xe'),JSON[_0x527c('0x11')](_0x49465c));if(_0x49465c[_0x527c('0x12')]){if(_0x49465c[_0x527c('0x12')][_0x527c('0x13')]===0x1f4){logger[_0x527c('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5a68e8,_0x49465c['error'][_0x527c('0x14')]);return _0x1071f5(_0x49465c[_0x527c('0x12')][_0x527c('0x14')]);}logger[_0x527c('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5a68e8,_0x49465c[_0x527c('0x12')][_0x527c('0x14')]);return _0x5e07ba(_0x49465c['error']['message']);}else{logger[_0x527c('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5a68e8,'request\x20sent');_0x5e07ba(_0x49465c[_0x527c('0x15')][_0x527c('0x14')]);}})[_0x527c('0x16')](function(_0x5e987c){logger[_0x527c('0x12')](_0x527c('0xd'),_0x5a68e8,_0x5e987c);_0x1071f5(_0x5e987c);});});} \ No newline at end of file +var _0x0e17=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x1cffe2,_0x5383e8){var _0x57030e=function(_0xe9c73f){while(--_0xe9c73f){_0x1cffe2['push'](_0x1cffe2['shift']());}};_0x57030e(++_0x5383e8);}(_0x0e17,0xd6));var _0x70e1=function(_0x4c8f7b,_0x215e8c){_0x4c8f7b=_0x4c8f7b-0x0;var _0x359d61=_0x0e17[_0x4c8f7b];return _0x359d61;};'use strict';var _=require(_0x70e1('0x0'));var util=require(_0x70e1('0x1'));var moment=require(_0x70e1('0x2'));var BPromise=require(_0x70e1('0x3'));var rs=require(_0x70e1('0x4'));var fs=require('fs');var Redis=require(_0x70e1('0x5'));var db=require(_0x70e1('0x6'))['db'];var utils=require(_0x70e1('0x7'));var logger=require(_0x70e1('0x8'))(_0x70e1('0x9'));var config=require(_0x70e1('0xa'));var jayson=require(_0x70e1('0xb'));var client=jayson['client'][_0x70e1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x16a2ad,_0x191d53,_0x27f310){return new BPromise(function(_0x26218a,_0x2c45c3){return client['request'](_0x16a2ad,_0x27f310)['then'](function(_0xfe25b1){logger['info'](_0x70e1('0xd'),_0x191d53,_0x70e1('0xe'));logger['debug'](_0x70e1('0xf'),_0x191d53,_0x70e1('0xe'),JSON['stringify'](_0xfe25b1));if(_0xfe25b1[_0x70e1('0x10')]){if(_0xfe25b1['error'][_0x70e1('0x11')]===0x1f4){logger['error'](_0x70e1('0xd'),_0x191d53,_0xfe25b1[_0x70e1('0x10')][_0x70e1('0x12')]);return _0x2c45c3(_0xfe25b1[_0x70e1('0x10')][_0x70e1('0x12')]);}logger[_0x70e1('0x10')](_0x70e1('0xd'),_0x191d53,_0xfe25b1[_0x70e1('0x10')][_0x70e1('0x12')]);return _0x26218a(_0xfe25b1[_0x70e1('0x10')][_0x70e1('0x12')]);}else{logger['info'](_0x70e1('0xd'),_0x191d53,_0x70e1('0xe'));_0x26218a(_0xfe25b1[_0x70e1('0x13')][_0x70e1('0x12')]);}})[_0x70e1('0x14')](function(_0xc18a09){logger[_0x70e1('0x10')](_0x70e1('0xd'),_0x191d53,_0xc18a09);_0x2c45c3(_0xc18a09);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 7aae6a7..ba0bd5d 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 _0xac9e=['get','isAuthenticated','/:id','post','create','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./pause.controller'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xac9e,0x1b9));var _0xeac9=function(_0x2f647a,_0x225865){_0x2f647a=_0x2f647a-0x0;var _0x1c3e29=_0xac9e[_0x2f647a];return _0x1c3e29;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeac9('0x0'));var timeout=require(_0xeac9('0x1'));var express=require(_0xeac9('0x2'));var router=express[_0xeac9('0x3')]();var fs_extra=require(_0xeac9('0x4'));var auth=require(_0xeac9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeac9('0x6'));router[_0xeac9('0x7')]('/',auth[_0xeac9('0x8')](),controller['index']);router[_0xeac9('0x7')](_0xeac9('0x9'),auth[_0xeac9('0x8')](),controller['show']);router[_0xeac9('0xa')]('/',auth[_0xeac9('0x8')](),controller[_0xeac9('0xb')]);router['put'](_0xeac9('0x9'),auth['isAuthenticated'](),controller[_0xeac9('0xc')]);router[_0xeac9('0xd')](_0xeac9('0x9'),auth['isAuthenticated'](),controller[_0xeac9('0xe')]);module[_0xeac9('0xf')]=router; \ No newline at end of file +var _0xd4e5=['show','post','create','put','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4e5,0x85));var _0x5d4e=function(_0x440ad8,_0x213967){_0x440ad8=_0x440ad8-0x0;var _0x3baf3c=_0xd4e5[_0x440ad8];return _0x3baf3c;};'use strict';var multer=require(_0x5d4e('0x0'));var util=require(_0x5d4e('0x1'));var path=require(_0x5d4e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5d4e('0x3'));var auth=require(_0x5d4e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5d4e('0x5'));var controller=require(_0x5d4e('0x6'));router[_0x5d4e('0x7')]('/',auth[_0x5d4e('0x8')](),controller[_0x5d4e('0x9')]);router['get'](_0x5d4e('0xa'),auth['isAuthenticated'](),controller[_0x5d4e('0xb')]);router[_0x5d4e('0xc')]('/',auth[_0x5d4e('0x8')](),controller[_0x5d4e('0xd')]);router[_0x5d4e('0xe')](_0x5d4e('0xa'),auth[_0x5d4e('0x8')](),controller['update']);router[_0x5d4e('0xf')](_0x5d4e('0xa'),auth['isAuthenticated'](),controller[_0x5d4e('0x10')]);module[_0x5d4e('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 3a5d19f..40b9a01 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 _0xe6ef=['sequelize','exports','STRING','name'];(function(_0x11aa9a,_0x32f822){var _0x155def=function(_0x3eb1f0){while(--_0x3eb1f0){_0x11aa9a['push'](_0x11aa9a['shift']());}};_0x155def(++_0x32f822);}(_0xe6ef,0xb0));var _0xfe6e=function(_0x39c0f3,_0x1dfc97){_0x39c0f3=_0x39c0f3-0x0;var _0x2a3c72=_0xe6ef[_0x39c0f3];return _0x2a3c72;};'use strict';var Sequelize=require(_0xfe6e('0x0'));module[_0xfe6e('0x1')]={'name':{'type':Sequelize[_0xfe6e('0x2')],'unique':_0xfe6e('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xfe6e('0x2')]}}; \ No newline at end of file +var _0x4928=['exports','STRING','name','sequelize'];(function(_0xe67d1c,_0x1b21d1){var _0x11673c=function(_0x119660){while(--_0x119660){_0xe67d1c['push'](_0xe67d1c['shift']());}};_0x11673c(++_0x1b21d1);}(_0x4928,0x83));var _0x8492=function(_0x19a878,_0x193d33){_0x19a878=_0x19a878-0x0;var _0x1241b6=_0x4928[_0x19a878];return _0x1241b6;};'use strict';var Sequelize=require(_0x8492('0x0'));module[_0x8492('0x1')]={'name':{'type':Sequelize[_0x8492('0x2')],'unique':_0x8492('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 948792a..86ebe6b 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 _0xe015=['rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','length','create','body','user','find','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','apply','reject','save','then','destroy','get','Pauses','UserProfileResource','end','error','stack','name','map','Pause'];(function(_0x22e953,_0x10a297){var _0x2d4bdc=function(_0x3fc8f4){while(--_0x3fc8f4){_0x22e953['push'](_0x22e953['shift']());}};_0x2d4bdc(++_0x10a297);}(_0xe015,0x6c));var _0x5e01=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe015[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x5e01('0x0'));var rimraf=require(_0x5e01('0x1'));var zipdir=require(_0x5e01('0x2'));var jsonpatch=require(_0x5e01('0x3'));var rp=require('request-promise');var moment=require(_0x5e01('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5e01('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5e01('0x6'));var csv=require('to-csv');var ejs=require(_0x5e01('0x7'));var fs=require('fs');var fs_extra=require(_0x5e01('0x8'));var _=require(_0x5e01('0x9'));var squel=require(_0x5e01('0xa'));var crypto=require('crypto');var jsforce=require(_0x5e01('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5e01('0xc'));var querystring=require(_0x5e01('0xd'));var Papa=require(_0x5e01('0xe'));var Redis=require('ioredis');var authService=require(_0x5e01('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5e01('0x10'));var hardwareService=require(_0x5e01('0x11'));var logger=require(_0x5e01('0x12'))(_0x5e01('0x13'));var utils=require(_0x5e01('0x14'));var config=require(_0x5e01('0x15'));var licenseUtil=require(_0x5e01('0x16'));var db=require(_0x5e01('0x17'))['db'];function respondWithStatusCode(_0x281432,_0x36cc0f){_0x36cc0f=_0x36cc0f||0xcc;return function(_0x24e636){if(_0x24e636){return _0x281432['sendStatus'](_0x36cc0f);}return _0x281432[_0x5e01('0x18')](_0x36cc0f)['end']();};}function respondWithResult(_0x42b318,_0x546879){_0x546879=_0x546879||0xc8;return function(_0x5140bb){if(_0x5140bb){return _0x42b318[_0x5e01('0x18')](_0x546879)[_0x5e01('0x19')](_0x5140bb);}};}function respondWithFilteredResult(_0x290ebe,_0x1fb34c){return function(_0x252555){if(_0x252555){var _0xea9280=typeof _0x1fb34c[_0x5e01('0x1a')]==='undefined'&&typeof _0x1fb34c[_0x5e01('0x1b')]==='undefined';var _0x18bacc=_0x252555[_0x5e01('0x1c')];var _0x1e656a=_0xea9280?0x0:_0x1fb34c['offset'];var _0x4d4c20=_0xea9280?_0x252555[_0x5e01('0x1c')]:_0x1fb34c[_0x5e01('0x1a')]+_0x1fb34c[_0x5e01('0x1b')];var _0x8ccb65;if(_0x4d4c20>=_0x18bacc){_0x4d4c20=_0x18bacc;_0x8ccb65=0xc8;}else{_0x8ccb65=0xce;}_0x290ebe[_0x5e01('0x18')](_0x8ccb65);return _0x290ebe[_0x5e01('0x1d')]('Content-Range',_0x1e656a+'-'+_0x4d4c20+'/'+_0x18bacc)[_0x5e01('0x19')](_0x252555);}return null;};}function patchUpdates(_0x178c5d){return function(_0x1b30d2){try{jsonpatch[_0x5e01('0x1e')](_0x1b30d2,_0x178c5d,!![]);}catch(_0x97a3f1){return BPromise[_0x5e01('0x1f')](_0x97a3f1);}return _0x1b30d2[_0x5e01('0x20')]();};}function saveUpdates(_0x340b00,_0x3e3c45){return function(_0x593707){if(_0x593707){return _0x593707['update'](_0x340b00)[_0x5e01('0x21')](function(_0x1ef2e6){return _0x1ef2e6;});}return null;};}function removeEntity(_0x4ecb8a,_0x5938ca){return function(_0x4debab){if(_0x4debab){return _0x4debab[_0x5e01('0x22')]()[_0x5e01('0x21')](function(){var _0x3ad28f=_0x4debab[_0x5e01('0x23')]({'plain':!![]});var _0x3726c9=_0x5e01('0x24');return db[_0x5e01('0x25')]['destroy']({'where':{'type':_0x3726c9,'resourceId':_0x3ad28f['id']}})[_0x5e01('0x21')](function(){return _0x4debab;});})['then'](function(){_0x4ecb8a[_0x5e01('0x18')](0xcc)[_0x5e01('0x26')]();});}};}function handleEntityNotFound(_0x316b18,_0x430864){return function(_0x214a1f){if(!_0x214a1f){_0x316b18['sendStatus'](0x194);}return _0x214a1f;};}function handleError(_0x791b1b,_0x35e4b7){_0x35e4b7=_0x35e4b7||0x1f4;return function(_0x3e3615){logger[_0x5e01('0x27')](_0x3e3615[_0x5e01('0x28')]);if(_0x3e3615[_0x5e01('0x29')]){delete _0x3e3615[_0x5e01('0x29')];}_0x791b1b[_0x5e01('0x18')](_0x35e4b7)['send'](_0x3e3615);};}exports['index']=function(_0x7d3d64,_0x5b0fac){var _0xccdb4e={},_0x3b5a5c={},_0x246132={'count':0x0,'rows':[]};var _0xcc929a=_[_0x5e01('0x2a')](db[_0x5e01('0x2b')][_0x5e01('0x2c')],function(_0x257727){return{'name':_0x257727['fieldName'],'type':_0x257727[_0x5e01('0x2d')]['key']};});_0x3b5a5c['model']=_[_0x5e01('0x2a')](_0xcc929a,_0x5e01('0x29'));_0x3b5a5c[_0x5e01('0x2e')]=_[_0x5e01('0x2f')](_0x7d3d64[_0x5e01('0x2e')]);_0x3b5a5c[_0x5e01('0x30')]=_[_0x5e01('0x31')](_0x3b5a5c[_0x5e01('0x32')],_0x3b5a5c[_0x5e01('0x2e')]);_0xccdb4e[_0x5e01('0x33')]=_[_0x5e01('0x31')](_0x3b5a5c[_0x5e01('0x32')],qs[_0x5e01('0x34')](_0x7d3d64[_0x5e01('0x2e')][_0x5e01('0x34')]));_0xccdb4e['attributes']=_0xccdb4e[_0x5e01('0x33')]['length']?_0xccdb4e[_0x5e01('0x33')]:_0x3b5a5c[_0x5e01('0x32')];if(!_0x7d3d64[_0x5e01('0x2e')][_0x5e01('0x35')](_0x5e01('0x36'))){_0xccdb4e[_0x5e01('0x1b')]=qs[_0x5e01('0x1b')](_0x7d3d64[_0x5e01('0x2e')][_0x5e01('0x1b')]);_0xccdb4e[_0x5e01('0x1a')]=qs[_0x5e01('0x1a')](_0x7d3d64[_0x5e01('0x2e')][_0x5e01('0x1a')]);}_0xccdb4e['order']=qs[_0x5e01('0x37')](_0x7d3d64[_0x5e01('0x2e')][_0x5e01('0x37')]);_0xccdb4e['where']=qs[_0x5e01('0x30')](_[_0x5e01('0x38')](_0x7d3d64['query'],_0x3b5a5c['filters']),_0xcc929a);if(_0x7d3d64[_0x5e01('0x2e')][_0x5e01('0x39')]){_0xccdb4e[_0x5e01('0x3a')]=_['merge'](_0xccdb4e[_0x5e01('0x3a')],{'$or':_[_0x5e01('0x2a')](_0xcc929a,function(_0x42f4c4){if(_0x42f4c4[_0x5e01('0x2d')]!==_0x5e01('0x3b')){var _0x55a871={};_0x55a871[_0x42f4c4[_0x5e01('0x29')]]={'$like':'%'+_0x7d3d64[_0x5e01('0x2e')][_0x5e01('0x39')]+'%'};return _0x55a871;}})});}_0xccdb4e=_[_0x5e01('0x3c')]({},_0xccdb4e,_0x7d3d64[_0x5e01('0x3d')]);var _0xd6784={'where':_0xccdb4e['where']};return db['Pause']['count'](_0xd6784)[_0x5e01('0x21')](function(_0x1e14da){_0x246132[_0x5e01('0x1c')]=_0x1e14da;if(_0x7d3d64[_0x5e01('0x2e')][_0x5e01('0x3e')]){_0xccdb4e[_0x5e01('0x3f')]=[{'all':!![]}];}return db[_0x5e01('0x2b')][_0x5e01('0x40')](_0xccdb4e);})[_0x5e01('0x21')](function(_0x559562){_0x246132[_0x5e01('0x41')]=_0x559562;return _0x246132;})[_0x5e01('0x21')](respondWithFilteredResult(_0x5b0fac,_0xccdb4e))[_0x5e01('0x42')](handleError(_0x5b0fac,null));};exports[_0x5e01('0x43')]=function(_0x25348c,_0x40ab65){var _0x173d54={'raw':!![],'where':{'id':_0x25348c['params']['id']}},_0x1a81a5={};_0x1a81a5['model']=_[_0x5e01('0x2f')](db['Pause'][_0x5e01('0x2c')]);_0x1a81a5[_0x5e01('0x2e')]=_[_0x5e01('0x2f')](_0x25348c[_0x5e01('0x2e')]);_0x1a81a5[_0x5e01('0x30')]=_['intersection'](_0x1a81a5['model'],_0x1a81a5[_0x5e01('0x2e')]);_0x173d54[_0x5e01('0x33')]=_[_0x5e01('0x31')](_0x1a81a5[_0x5e01('0x32')],qs[_0x5e01('0x34')](_0x25348c[_0x5e01('0x2e')]['fields']));_0x173d54[_0x5e01('0x33')]=_0x173d54['attributes'][_0x5e01('0x44')]?_0x173d54[_0x5e01('0x33')]:_0x1a81a5['model'];if(_0x25348c[_0x5e01('0x2e')][_0x5e01('0x3e')]){_0x173d54[_0x5e01('0x3f')]=[{'all':!![]}];}_0x173d54=_[_0x5e01('0x3c')]({},_0x173d54,_0x25348c[_0x5e01('0x3d')]);return db['Pause']['find'](_0x173d54)[_0x5e01('0x21')](handleEntityNotFound(_0x40ab65,null))[_0x5e01('0x21')](respondWithResult(_0x40ab65,null))[_0x5e01('0x42')](handleError(_0x40ab65,null));};exports[_0x5e01('0x45')]=function(_0x2e4c0c,_0x28286c){return db['Pause'][_0x5e01('0x45')](_0x2e4c0c[_0x5e01('0x46')],{})[_0x5e01('0x21')](function(_0x191153){var _0x522b0d=_0x2e4c0c[_0x5e01('0x47')][_0x5e01('0x23')]({'plain':!![]});if(!_0x522b0d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x522b0d['role']===_0x5e01('0x47')){var _0x35037d=_0x191153[_0x5e01('0x23')]({'plain':!![]});var _0x51a8e7=_0x5e01('0x24');return db['UserProfileSection'][_0x5e01('0x48')]({'where':{'name':_0x51a8e7,'userProfileId':_0x522b0d[_0x5e01('0x49')]},'raw':!![]})['then'](function(_0x1836fa){if(_0x1836fa&&_0x1836fa[_0x5e01('0x4a')]===0x0){return db[_0x5e01('0x25')][_0x5e01('0x45')]({'name':_0x35037d[_0x5e01('0x29')],'resourceId':_0x35037d['id'],'type':_0x1836fa[_0x5e01('0x29')],'sectionId':_0x1836fa['id']},{})[_0x5e01('0x21')](function(){return _0x191153;});}else{return _0x191153;}})[_0x5e01('0x42')](function(_0x43e015){logger[_0x5e01('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43e015);throw _0x43e015;});}return _0x191153;})[_0x5e01('0x21')](respondWithResult(_0x28286c,0xc9))[_0x5e01('0x42')](handleError(_0x28286c,null));};exports['update']=function(_0x507071,_0x1c63e7){if(_0x507071[_0x5e01('0x46')]['id']){delete _0x507071[_0x5e01('0x46')]['id'];}return db[_0x5e01('0x2b')][_0x5e01('0x48')]({'where':{'id':_0x507071[_0x5e01('0x4b')]['id']}})[_0x5e01('0x21')](handleEntityNotFound(_0x1c63e7,null))[_0x5e01('0x21')](saveUpdates(_0x507071[_0x5e01('0x46')],null))[_0x5e01('0x21')](respondWithResult(_0x1c63e7,null))[_0x5e01('0x42')](handleError(_0x1c63e7,null));};exports[_0x5e01('0x22')]=function(_0x4c4319,_0x32314d){return db['Pause'][_0x5e01('0x48')]({'where':{'id':_0x4c4319[_0x5e01('0x4b')]['id']}})[_0x5e01('0x21')](handleEntityNotFound(_0x32314d,null))[_0x5e01('0x21')](removeEntity(_0x32314d,null))['catch'](handleError(_0x32314d,null));}; \ No newline at end of file +var _0x5c6e=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','includeAll','include','Pause','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','update','rimraf','moment','path','sox','to-csv','ejs','fs-extra','squel','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x7299c7,_0xf8a705){var _0x2ae4b2=function(_0x310398){while(--_0x310398){_0x7299c7['push'](_0x7299c7['shift']());}};_0x2ae4b2(++_0xf8a705);}(_0x5c6e,0x8b));var _0xe5c6=function(_0x4d521e,_0x58ba39){_0x4d521e=_0x4d521e-0x0;var _0x3beb42=_0x5c6e[_0x4d521e];return _0x3beb42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe5c6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe5c6('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe5c6('0x2'));var sox=require(_0xe5c6('0x3'));var csv=require(_0xe5c6('0x4'));var ejs=require(_0xe5c6('0x5'));var fs=require('fs');var fs_extra=require(_0xe5c6('0x6'));var _=require('lodash');var squel=require(_0xe5c6('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe5c6('0x8'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe5c6('0x9'));var qs=require(_0xe5c6('0xa'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe5c6('0xb'));var logger=require(_0xe5c6('0xc'))(_0xe5c6('0xd'));var utils=require(_0xe5c6('0xe'));var config=require(_0xe5c6('0xf'));var licenseUtil=require(_0xe5c6('0x10'));var db=require(_0xe5c6('0x11'))['db'];function respondWithStatusCode(_0x180eb3,_0x1c3738){_0x1c3738=_0x1c3738||0xcc;return function(_0x192f2f){if(_0x192f2f){return _0x180eb3[_0xe5c6('0x12')](_0x1c3738);}return _0x180eb3[_0xe5c6('0x13')](_0x1c3738)[_0xe5c6('0x14')]();};}function respondWithResult(_0x4c3cce,_0x3917c9){_0x3917c9=_0x3917c9||0xc8;return function(_0x57e761){if(_0x57e761){return _0x4c3cce[_0xe5c6('0x13')](_0x3917c9)[_0xe5c6('0x15')](_0x57e761);}};}function respondWithFilteredResult(_0x4e8278,_0x31606b){return function(_0xb90379){if(_0xb90379){var _0x24c4ac=typeof _0x31606b[_0xe5c6('0x16')]===_0xe5c6('0x17')&&typeof _0x31606b['limit']===_0xe5c6('0x17');var _0x2b724d=_0xb90379[_0xe5c6('0x18')];var _0x5390e9=_0x24c4ac?0x0:_0x31606b['offset'];var _0x5e2381=_0x24c4ac?_0xb90379[_0xe5c6('0x18')]:_0x31606b[_0xe5c6('0x16')]+_0x31606b[_0xe5c6('0x19')];var _0x201c58;if(_0x5e2381>=_0x2b724d){_0x5e2381=_0x2b724d;_0x201c58=0xc8;}else{_0x201c58=0xce;}_0x4e8278['status'](_0x201c58);return _0x4e8278[_0xe5c6('0x1a')](_0xe5c6('0x1b'),_0x5390e9+'-'+_0x5e2381+'/'+_0x2b724d)[_0xe5c6('0x15')](_0xb90379);}return null;};}function patchUpdates(_0x5e1caf){return function(_0x2e655c){try{jsonpatch[_0xe5c6('0x1c')](_0x2e655c,_0x5e1caf,!![]);}catch(_0x50f5db){return BPromise[_0xe5c6('0x1d')](_0x50f5db);}return _0x2e655c[_0xe5c6('0x1e')]();};}function saveUpdates(_0x322dfa,_0x2d1bce){return function(_0x353fa7){if(_0x353fa7){return _0x353fa7['update'](_0x322dfa)[_0xe5c6('0x1f')](function(_0x32e980){return _0x32e980;});}return null;};}function removeEntity(_0x5956fb,_0x5a72ad){return function(_0x5b109f){if(_0x5b109f){return _0x5b109f[_0xe5c6('0x20')]()[_0xe5c6('0x1f')](function(){var _0x1c5294=_0x5b109f[_0xe5c6('0x21')]({'plain':!![]});var _0x1bc66e=_0xe5c6('0x22');return db[_0xe5c6('0x23')][_0xe5c6('0x20')]({'where':{'type':_0x1bc66e,'resourceId':_0x1c5294['id']}})[_0xe5c6('0x1f')](function(){return _0x5b109f;});})[_0xe5c6('0x1f')](function(){_0x5956fb[_0xe5c6('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x367bb3,_0x211a08){return function(_0x4ac65d){if(!_0x4ac65d){_0x367bb3[_0xe5c6('0x12')](0x194);}return _0x4ac65d;};}function handleError(_0x56460a,_0x4ae896){_0x4ae896=_0x4ae896||0x1f4;return function(_0x4e40da){logger[_0xe5c6('0x24')](_0x4e40da[_0xe5c6('0x25')]);if(_0x4e40da['name']){delete _0x4e40da[_0xe5c6('0x26')];}_0x56460a[_0xe5c6('0x13')](_0x4ae896)[_0xe5c6('0x27')](_0x4e40da);};}exports[_0xe5c6('0x28')]=function(_0x31e420,_0xc35a51){var _0x52114d={},_0x3d8486={},_0x53fc20={'count':0x0,'rows':[]};var _0x1f9c78=_['map'](db['Pause'][_0xe5c6('0x29')],function(_0x2bfad3){return{'name':_0x2bfad3[_0xe5c6('0x2a')],'type':_0x2bfad3[_0xe5c6('0x2b')]['key']};});_0x3d8486[_0xe5c6('0x2c')]=_[_0xe5c6('0x2d')](_0x1f9c78,'name');_0x3d8486['query']=_[_0xe5c6('0x2e')](_0x31e420[_0xe5c6('0x2f')]);_0x3d8486[_0xe5c6('0x30')]=_[_0xe5c6('0x31')](_0x3d8486['model'],_0x3d8486[_0xe5c6('0x2f')]);_0x52114d[_0xe5c6('0x32')]=_[_0xe5c6('0x31')](_0x3d8486[_0xe5c6('0x2c')],qs[_0xe5c6('0x33')](_0x31e420[_0xe5c6('0x2f')][_0xe5c6('0x33')]));_0x52114d[_0xe5c6('0x32')]=_0x52114d[_0xe5c6('0x32')][_0xe5c6('0x34')]?_0x52114d[_0xe5c6('0x32')]:_0x3d8486['model'];if(!_0x31e420['query'][_0xe5c6('0x35')]('nolimit')){_0x52114d[_0xe5c6('0x19')]=qs[_0xe5c6('0x19')](_0x31e420[_0xe5c6('0x2f')][_0xe5c6('0x19')]);_0x52114d[_0xe5c6('0x16')]=qs[_0xe5c6('0x16')](_0x31e420['query'][_0xe5c6('0x16')]);}_0x52114d['order']=qs[_0xe5c6('0x36')](_0x31e420[_0xe5c6('0x2f')][_0xe5c6('0x36')]);_0x52114d[_0xe5c6('0x37')]=qs[_0xe5c6('0x30')](_[_0xe5c6('0x38')](_0x31e420[_0xe5c6('0x2f')],_0x3d8486[_0xe5c6('0x30')]),_0x1f9c78);if(_0x31e420[_0xe5c6('0x2f')][_0xe5c6('0x39')]){_0x52114d['where']=_['merge'](_0x52114d[_0xe5c6('0x37')],{'$or':_[_0xe5c6('0x2d')](_0x1f9c78,function(_0x1b9989){if(_0x1b9989[_0xe5c6('0x2b')]!==_0xe5c6('0x3a')){var _0xc6ddee={};_0xc6ddee[_0x1b9989[_0xe5c6('0x26')]]={'$like':'%'+_0x31e420['query'][_0xe5c6('0x39')]+'%'};return _0xc6ddee;}})});}_0x52114d=_['merge']({},_0x52114d,_0x31e420[_0xe5c6('0x3b')]);var _0xdba599={'where':_0x52114d[_0xe5c6('0x37')]};return db['Pause'][_0xe5c6('0x18')](_0xdba599)[_0xe5c6('0x1f')](function(_0x305452){_0x53fc20[_0xe5c6('0x18')]=_0x305452;if(_0x31e420['query'][_0xe5c6('0x3c')]){_0x52114d[_0xe5c6('0x3d')]=[{'all':!![]}];}return db[_0xe5c6('0x3e')][_0xe5c6('0x3f')](_0x52114d);})[_0xe5c6('0x1f')](function(_0x3f63ac){_0x53fc20[_0xe5c6('0x40')]=_0x3f63ac;return _0x53fc20;})[_0xe5c6('0x1f')](respondWithFilteredResult(_0xc35a51,_0x52114d))[_0xe5c6('0x41')](handleError(_0xc35a51,null));};exports[_0xe5c6('0x42')]=function(_0x2450d7,_0x338b5e){var _0x2745a0={'raw':!![],'where':{'id':_0x2450d7[_0xe5c6('0x43')]['id']}},_0x35c850={};_0x35c850[_0xe5c6('0x2c')]=_['keys'](db['Pause'][_0xe5c6('0x29')]);_0x35c850[_0xe5c6('0x2f')]=_['keys'](_0x2450d7[_0xe5c6('0x2f')]);_0x35c850['filters']=_[_0xe5c6('0x31')](_0x35c850[_0xe5c6('0x2c')],_0x35c850[_0xe5c6('0x2f')]);_0x2745a0['attributes']=_[_0xe5c6('0x31')](_0x35c850[_0xe5c6('0x2c')],qs['fields'](_0x2450d7[_0xe5c6('0x2f')][_0xe5c6('0x33')]));_0x2745a0[_0xe5c6('0x32')]=_0x2745a0[_0xe5c6('0x32')][_0xe5c6('0x34')]?_0x2745a0[_0xe5c6('0x32')]:_0x35c850[_0xe5c6('0x2c')];if(_0x2450d7[_0xe5c6('0x2f')]['includeAll']){_0x2745a0[_0xe5c6('0x3d')]=[{'all':!![]}];}_0x2745a0=_['merge']({},_0x2745a0,_0x2450d7[_0xe5c6('0x3b')]);return db[_0xe5c6('0x3e')][_0xe5c6('0x44')](_0x2745a0)[_0xe5c6('0x1f')](handleEntityNotFound(_0x338b5e,null))[_0xe5c6('0x1f')](respondWithResult(_0x338b5e,null))[_0xe5c6('0x41')](handleError(_0x338b5e,null));};exports[_0xe5c6('0x45')]=function(_0x36b46d,_0x3f81b4){return db['Pause'][_0xe5c6('0x45')](_0x36b46d[_0xe5c6('0x46')],{})[_0xe5c6('0x1f')](function(_0x3a470e){var _0x30ade5=_0x36b46d[_0xe5c6('0x47')][_0xe5c6('0x21')]({'plain':!![]});if(!_0x30ade5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30ade5[_0xe5c6('0x48')]==='user'){var _0x2381b8=_0x3a470e['get']({'plain':!![]});var _0x273eee=_0xe5c6('0x22');return db[_0xe5c6('0x49')][_0xe5c6('0x44')]({'where':{'name':_0x273eee,'userProfileId':_0x30ade5[_0xe5c6('0x4a')]},'raw':!![]})[_0xe5c6('0x1f')](function(_0x28e2fc){if(_0x28e2fc&&_0x28e2fc['autoAssociation']===0x0){return db[_0xe5c6('0x23')]['create']({'name':_0x2381b8[_0xe5c6('0x26')],'resourceId':_0x2381b8['id'],'type':_0x28e2fc[_0xe5c6('0x26')],'sectionId':_0x28e2fc['id']},{})[_0xe5c6('0x1f')](function(){return _0x3a470e;});}else{return _0x3a470e;}})[_0xe5c6('0x41')](function(_0x5a30b7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a30b7);throw _0x5a30b7;});}return _0x3a470e;})['then'](respondWithResult(_0x3f81b4,0xc9))['catch'](handleError(_0x3f81b4,null));};exports[_0xe5c6('0x4b')]=function(_0x324ce1,_0x21858b){if(_0x324ce1['body']['id']){delete _0x324ce1[_0xe5c6('0x46')]['id'];}return db['Pause']['find']({'where':{'id':_0x324ce1[_0xe5c6('0x43')]['id']}})['then'](handleEntityNotFound(_0x21858b,null))[_0xe5c6('0x1f')](saveUpdates(_0x324ce1['body'],null))[_0xe5c6('0x1f')](respondWithResult(_0x21858b,null))[_0xe5c6('0x41')](handleError(_0x21858b,null));};exports[_0xe5c6('0x20')]=function(_0x8c17f0,_0x28462f){return db[_0xe5c6('0x3e')]['find']({'where':{'id':_0x8c17f0[_0xe5c6('0x43')]['id']}})[_0xe5c6('0x1f')](handleEntityNotFound(_0x28462f,null))[_0xe5c6('0x1f')](removeEntity(_0x28462f,null))['catch'](handleError(_0x28462f,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 1a6f2d0..3f813aa 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5f0612,_0x33ab66){var _0x25ca78=function(_0x1d3847){while(--_0x1d3847){_0x5f0612['push'](_0x5f0612['shift']());}};_0x25ca78(++_0x33ab66);}(_0x1cb9,0x14e));var _0x91cb=function(_0x7d18c6,_0xaf3734){_0x7d18c6=_0x7d18c6-0x0;var _0x6c7f36=_0x1cb9[_0x7d18c6];return _0x6c7f36;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x2caebe,_0x214bb4){var _0x58d0a5=function(_0x5a3eb7){while(--_0x5a3eb7){_0x2caebe['push'](_0x2caebe['shift']());}};_0x58d0a5(++_0x214bb4);}(_0x5fc3,0xa8));var _0x35fc=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0x5fc3[_0x21af3a];return _0x268a49;};'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')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'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 0996629..ae5858d 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x3ddda4,_0x27ac2a){var _0x2278d5=function(_0x24ab90){while(--_0x24ab90){_0x3ddda4['push'](_0x3ddda4['shift']());}};_0x2278d5(++_0x27ac2a);}(_0x7a54,0x106));var _0x47a5=function(_0x141cce,_0x443ffa){_0x141cce=_0x141cce-0x0;var _0x11fc58=_0x7a54[_0x141cce];return _0x11fc58;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x4391ce,_0x329ebe){var _0x17ed46=function(_0x28e88d){while(--_0x28e88d){_0x4391ce['push'](_0x4391ce['shift']());}};_0x17ed46(++_0x329ebe);}(_0x7a54,0x106));var _0x47a5=function(_0x447efd,_0x717d2c){_0x447efd=_0x447efd-0x0;var _0x44a23a=_0x7a54[_0x447efd];return _0x44a23a;};'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 76fc09f..7c38c43 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 _0x0faf=['extname','now','post','single','file','webhookPost','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','basename'];(function(_0x3ee1fe,_0x59f2a1){var _0x1ae57a=function(_0x1ef0c4){while(--_0x1ef0c4){_0x3ee1fe['push'](_0x3ee1fe['shift']());}};_0x1ae57a(++_0x59f2a1);}(_0x0faf,0x132));var _0xf0fa=function(_0x119ded,_0x497e72){_0x119ded=_0x119ded-0x0;var _0x22108b=_0x0faf[_0x119ded];return _0x22108b;};'use strict';var multer=require(_0xf0fa('0x0'));var util=require('util');var path=require(_0xf0fa('0x1'));var timeout=require(_0xf0fa('0x2'));var express=require(_0xf0fa('0x3'));var router=express[_0xf0fa('0x4')]();var fs_extra=require(_0xf0fa('0x5'));var auth=require(_0xf0fa('0x6'));var interaction=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var controller=require(_0xf0fa('0x9'));router['get']('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0xb')]);router[_0xf0fa('0xc')](_0xf0fa('0xd'),controller[_0xf0fa('0xe')]);router['get'](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller['show']);router['get'](_0xf0fa('0x10'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x11')]);var upload=multer({'storage':multer[_0xf0fa('0x12')]({'destination':function(_0x2bd807,_0x1151ea,_0x379ff6){_0x379ff6(null,path[_0xf0fa('0x13')](config['root'],_0xf0fa('0x14')));},'filename':function(_0x5b38fa,_0x2f46ff,_0x521034){_0x2f46ff[_0xf0fa('0x15')]=_0x2f46ff[_0xf0fa('0x15')][_0xf0fa('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x521034(null,util['format']('%s-%s%s',path[_0xf0fa('0x17')](_0x2f46ff['originalname'],path[_0xf0fa('0x18')](_0x2f46ff[_0xf0fa('0x15')])),Date[_0xf0fa('0x19')](),path[_0xf0fa('0x18')](_0x2f46ff[_0xf0fa('0x15')])));}})});router[_0xf0fa('0x1a')]('/',upload[_0xf0fa('0x1b')](_0xf0fa('0x1c')),controller['upload']);router[_0xf0fa('0x1a')](_0xf0fa('0xd'),controller[_0xf0fa('0x1d')]);router[_0xf0fa('0x1e')](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller['update']);router['delete'](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x1f')]);module[_0xf0fa('0x20')]=router; \ No newline at end of file +var _0x6334=['../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','show','/:id/download','download','diskStorage','join','root','format','%s-%s%s','extname','now','originalname','post','file','upload','webhookPost','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2565a4,_0x59d749){var _0x524938=function(_0x578677){while(--_0x578677){_0x2565a4['push'](_0x2565a4['shift']());}};_0x524938(++_0x59d749);}(_0x6334,0x119));var _0x4633=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0x6334[_0x3dea7d];return _0x53919a;};'use strict';var multer=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var path=require(_0x4633('0x2'));var timeout=require(_0x4633('0x3'));var express=require(_0x4633('0x4'));var router=express[_0x4633('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4633('0x6'));var interaction=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var controller=require(_0x4633('0x9'));router[_0x4633('0xa')]('/',auth[_0x4633('0xb')](),controller[_0x4633('0xc')]);router['get'](_0x4633('0xd'),controller['webhookGet']);router[_0x4633('0xa')](_0x4633('0xe'),auth['isAuthenticated'](),controller[_0x4633('0xf')]);router[_0x4633('0xa')](_0x4633('0x10'),auth['isAuthenticated'](),controller[_0x4633('0x11')]);var upload=multer({'storage':multer[_0x4633('0x12')]({'destination':function(_0x5157a7,_0x6a63b,_0x3d5182){_0x3d5182(null,path[_0x4633('0x13')](config[_0x4633('0x14')],'server/files/plugins'));},'filename':function(_0x73b5e4,_0xad405,_0x438e87){_0xad405['originalname']=_0xad405['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x438e87(null,util[_0x4633('0x15')](_0x4633('0x16'),path['basename'](_0xad405['originalname'],path[_0x4633('0x17')](_0xad405['originalname'])),Date[_0x4633('0x18')](),path[_0x4633('0x17')](_0xad405[_0x4633('0x19')])));}})});router[_0x4633('0x1a')]('/',upload['single'](_0x4633('0x1b')),controller[_0x4633('0x1c')]);router[_0x4633('0x1a')]('/webhook',controller[_0x4633('0x1d')]);router[_0x4633('0x1e')](_0x4633('0xe'),auth[_0x4633('0xb')](),controller[_0x4633('0x1f')]);router['delete'](_0x4633('0xe'),auth[_0x4633('0xb')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index b762053..cef50fe 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 _0xa5ba=['ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','exports','STRING'];(function(_0x3b083a,_0x4a9d77){var _0x19f942=function(_0x4b852b){while(--_0x4b852b){_0x3b083a['push'](_0x3b083a['shift']());}};_0x19f942(++_0x4a9d77);}(_0xa5ba,0x1c5));var _0xaa5b=function(_0x44d30c,_0x4f1922){_0x44d30c=_0x44d30c-0x0;var _0x1ea7a7=_0xa5ba[_0x44d30c];return _0x1ea7a7;};'use strict';var Sequelize=require('sequelize');module[_0xaa5b('0x0')]={'name':{'type':Sequelize[_0xaa5b('0x1')]},'type':{'type':Sequelize[_0xaa5b('0x2')](_0xaa5b('0x3'),_0xaa5b('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xaa5b('0x5')]},'path':{'type':Sequelize[_0xaa5b('0x1')],'comment':_0xaa5b('0x6')},'active':{'type':Sequelize[_0xaa5b('0x7')],'defaultValue':0x0,'comment':_0xaa5b('0x8')},'sidebar':{'type':Sequelize[_0xaa5b('0x2')](_0xaa5b('0x9'),_0xaa5b('0xa'),_0xaa5b('0xb'),_0xaa5b('0xc')),'defaultValue':_0xaa5b('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xaa5b('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xaa5b('0x1')]},'scriptName':{'type':Sequelize[_0xaa5b('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa901=['ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING'];(function(_0x579db7,_0x1ec659){var _0x4d4daf=function(_0x167e9e){while(--_0x167e9e){_0x579db7['push'](_0x579db7['shift']());}};_0x4d4daf(++_0x1ec659);}(_0xa901,0x189));var _0x1a90=function(_0x1a688c,_0x54a96b){_0x1a688c=_0x1a688c-0x0;var _0x41e015=_0xa901[_0x1a688c];return _0x41e015;};'use strict';var Sequelize=require(_0x1a90('0x0'));module[_0x1a90('0x1')]={'name':{'type':Sequelize[_0x1a90('0x2')]},'type':{'type':Sequelize[_0x1a90('0x3')](_0x1a90('0x4'),_0x1a90('0x5'))},'description':{'type':Sequelize[_0x1a90('0x6')]},'version':{'type':Sequelize[_0x1a90('0x6')]},'path':{'type':Sequelize[_0x1a90('0x2')],'comment':_0x1a90('0x7')},'active':{'type':Sequelize[_0x1a90('0x8')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x1a90('0x3')]('adminOnly','agentOnly',_0x1a90('0x9'),'never'),'defaultValue':_0x1a90('0x9'),'comment':_0x1a90('0xa')},'icon':{'type':Sequelize[_0x1a90('0x2')]},'adminUrl':{'type':Sequelize[_0x1a90('0x2')]},'agentUrl':{'type':Sequelize[_0x1a90('0x2')]},'scriptName':{'type':Sequelize[_0x1a90('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 467f811..99c5420 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 _0x3bd5=['Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','html','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','resolve','port','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','%s%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./plugin.socket','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','then','end','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','length','find','params','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','dirname','basename','node_modules/**/*','close','Plugin\x20not\x20found','download','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','views','Invalid\x20manifest:\x20views\x20missing','agent','script'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x3bd5,0xd7));var _0x53bd=function(_0x49fe7f,_0x3e319c){_0x49fe7f=_0x49fe7f-0x0;var _0x1b2470=_0x3bd5[_0x49fe7f];return _0x1b2470;};'use strict';var emlformat=require(_0x53bd('0x0'));var rimraf=require(_0x53bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53bd('0x2'));var rp=require('request-promise');var moment=require(_0x53bd('0x3'));var BPromise=require(_0x53bd('0x4'));var Mustache=require(_0x53bd('0x5'));var util=require(_0x53bd('0x6'));var path=require(_0x53bd('0x7'));var sox=require(_0x53bd('0x8'));var csv=require(_0x53bd('0x9'));var ejs=require(_0x53bd('0xa'));var fs=require('fs');var fs_extra=require(_0x53bd('0xb'));var _=require(_0x53bd('0xc'));var squel=require(_0x53bd('0xd'));var crypto=require(_0x53bd('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x53bd('0x9'));var querystring=require(_0x53bd('0xf'));var Papa=require(_0x53bd('0x10'));var extract=require('extract-zip');var rimraf=require(_0x53bd('0x1'));var archiver=require(_0x53bd('0x11'));var Redis=require('ioredis');var authService=require(_0x53bd('0x12'));var qs=require(_0x53bd('0x13'));var as=require(_0x53bd('0x14'));var hardwareService=require(_0x53bd('0x15'));var logger=require(_0x53bd('0x16'))('api');var utils=require(_0x53bd('0x17'));var config=require(_0x53bd('0x18'));var licenseUtil=require(_0x53bd('0x19'));var db=require('../../mysqldb')['db'];config[_0x53bd('0x1a')]=_[_0x53bd('0x1b')](config[_0x53bd('0x1a')],{'host':_0x53bd('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x53bd('0x1a')]));require(_0x53bd('0x1d'))[_0x53bd('0x1e')](socket);function respondWithStatusCode(_0x2f5132,_0x2a589f){_0x2a589f=_0x2a589f||0xcc;return function(_0x15fe8b){if(_0x15fe8b){return _0x2f5132[_0x53bd('0x1f')](_0x2a589f);}return _0x2f5132[_0x53bd('0x20')](_0x2a589f)['end']();};}function respondWithResult(_0x1edffc,_0x597b82){_0x597b82=_0x597b82||0xc8;return function(_0x17e09c){if(_0x17e09c){return _0x1edffc[_0x53bd('0x20')](_0x597b82)['json'](_0x17e09c);}};}function respondWithFilteredResult(_0x11766e,_0x1ff103){return function(_0x5e5d4f){if(_0x5e5d4f){var _0x13dd9e=typeof _0x1ff103[_0x53bd('0x21')]===_0x53bd('0x22')&&typeof _0x1ff103['limit']===_0x53bd('0x22');var _0x2cf199=_0x5e5d4f[_0x53bd('0x23')];var _0x2de83f=_0x13dd9e?0x0:_0x1ff103[_0x53bd('0x21')];var _0x1df002=_0x13dd9e?_0x5e5d4f[_0x53bd('0x23')]:_0x1ff103[_0x53bd('0x21')]+_0x1ff103[_0x53bd('0x24')];var _0xa14601;if(_0x1df002>=_0x2cf199){_0x1df002=_0x2cf199;_0xa14601=0xc8;}else{_0xa14601=0xce;}_0x11766e[_0x53bd('0x20')](_0xa14601);return _0x11766e[_0x53bd('0x25')](_0x53bd('0x26'),_0x2de83f+'-'+_0x1df002+'/'+_0x2cf199)[_0x53bd('0x27')](_0x5e5d4f);}return null;};}function patchUpdates(_0x2f9c25){return function(_0x2b7754){try{jsonpatch[_0x53bd('0x28')](_0x2b7754,_0x2f9c25,!![]);}catch(_0x9bf2ea){return BPromise[_0x53bd('0x29')](_0x9bf2ea);}return _0x2b7754['save']();};}function saveUpdates(_0x54c67f,_0x1965bd){return function(_0x3dffe3){if(_0x3dffe3){return _0x3dffe3[_0x53bd('0x2a')](_0x54c67f)['then'](function(_0x2c508f){return _0x2c508f;});}return null;};}function removeEntity(_0x5c5aae,_0xc17000){return function(_0x427df1){if(_0x427df1){return _0x427df1[_0x53bd('0x2b')]()['then'](function(){var _0xd9e252=_0x427df1['get']({'plain':!![]});var _0x5d28bf='Plugins';return db['UserProfileResource'][_0x53bd('0x2b')]({'where':{'type':_0x5d28bf,'resourceId':_0xd9e252['id']}})[_0x53bd('0x2c')](function(){return _0x427df1;});})[_0x53bd('0x2c')](function(){_0x5c5aae[_0x53bd('0x20')](0xcc)[_0x53bd('0x2d')]();});}};}function handleEntityNotFound(_0x262e6d,_0x2c619d){return function(_0x47b197){if(!_0x47b197){_0x262e6d[_0x53bd('0x1f')](0x194);}return _0x47b197;};}function handleError(_0x2adecf,_0x2e714a){_0x2e714a=_0x2e714a||0x1f4;return function(_0x1abc92){logger['error'](_0x1abc92[_0x53bd('0x2e')]);if(_0x1abc92[_0x53bd('0x2f')]){delete _0x1abc92['name'];}_0x2adecf[_0x53bd('0x20')](_0x2e714a)[_0x53bd('0x30')](_0x1abc92);};}exports[_0x53bd('0x31')]=function(_0x96081b,_0x13156c){var _0x1f621d={},_0x1c2706={},_0x3e751b={'count':0x0,'rows':[]};var _0x227d40=_[_0x53bd('0x32')](db[_0x53bd('0x33')][_0x53bd('0x34')],function(_0x177d4a){return{'name':_0x177d4a[_0x53bd('0x35')],'type':_0x177d4a[_0x53bd('0x36')][_0x53bd('0x37')]};});_0x1c2706[_0x53bd('0x38')]=_[_0x53bd('0x32')](_0x227d40,'name');_0x1c2706[_0x53bd('0x39')]=_['keys'](_0x96081b[_0x53bd('0x39')]);_0x1c2706['filters']=_[_0x53bd('0x3a')](_0x1c2706[_0x53bd('0x38')],_0x1c2706['query']);_0x1f621d['attributes']=_['intersection'](_0x1c2706['model'],qs[_0x53bd('0x3b')](_0x96081b[_0x53bd('0x39')][_0x53bd('0x3b')]));_0x1f621d[_0x53bd('0x3c')]=_0x1f621d[_0x53bd('0x3c')]['length']?_0x1f621d[_0x53bd('0x3c')]:_0x1c2706['model'];if(!_0x96081b[_0x53bd('0x39')][_0x53bd('0x3d')](_0x53bd('0x3e'))){_0x1f621d[_0x53bd('0x24')]=qs[_0x53bd('0x24')](_0x96081b['query'][_0x53bd('0x24')]);_0x1f621d[_0x53bd('0x21')]=qs[_0x53bd('0x21')](_0x96081b[_0x53bd('0x39')][_0x53bd('0x21')]);}_0x1f621d[_0x53bd('0x3f')]=qs[_0x53bd('0x40')](_0x96081b['query'][_0x53bd('0x40')]);_0x1f621d['where']=qs[_0x53bd('0x41')](_[_0x53bd('0x42')](_0x96081b[_0x53bd('0x39')],_0x1c2706[_0x53bd('0x41')]),_0x227d40);if(_0x96081b[_0x53bd('0x39')][_0x53bd('0x43')]){_0x1f621d[_0x53bd('0x44')]=_[_0x53bd('0x45')](_0x1f621d['where'],{'$or':_[_0x53bd('0x32')](_0x227d40,function(_0x56f393){if(_0x56f393[_0x53bd('0x36')]!==_0x53bd('0x46')){var _0x1e224a={};_0x1e224a[_0x56f393[_0x53bd('0x2f')]]={'$like':'%'+_0x96081b[_0x53bd('0x39')]['filter']+'%'};return _0x1e224a;}})});}_0x1f621d=_[_0x53bd('0x45')]({},_0x1f621d,_0x96081b[_0x53bd('0x47')]);var _0x5b48fb={'where':_0x1f621d[_0x53bd('0x44')]};return db[_0x53bd('0x33')][_0x53bd('0x23')](_0x5b48fb)[_0x53bd('0x2c')](function(_0x2e3c8f){_0x3e751b[_0x53bd('0x23')]=_0x2e3c8f;if(_0x96081b[_0x53bd('0x39')][_0x53bd('0x48')]){_0x1f621d[_0x53bd('0x49')]=[{'all':!![]}];}return db['Plugin'][_0x53bd('0x4a')](_0x1f621d);})['then'](function(_0x353684){_0x3e751b[_0x53bd('0x4b')]=_0x353684;return _0x3e751b;})[_0x53bd('0x2c')](respondWithFilteredResult(_0x13156c,_0x1f621d))[_0x53bd('0x4c')](handleError(_0x13156c,null));};exports[_0x53bd('0x4d')]=function(_0x3c83af,_0x7e90ac){var _0x42ea17={'raw':!![],'where':{'id':_0x3c83af['params']['id']}},_0xc945f3={};_0xc945f3[_0x53bd('0x38')]=_[_0x53bd('0x4e')](db[_0x53bd('0x33')][_0x53bd('0x34')]);_0xc945f3[_0x53bd('0x39')]=_['keys'](_0x3c83af['query']);_0xc945f3['filters']=_[_0x53bd('0x3a')](_0xc945f3[_0x53bd('0x38')],_0xc945f3['query']);_0x42ea17[_0x53bd('0x3c')]=_['intersection'](_0xc945f3[_0x53bd('0x38')],qs[_0x53bd('0x3b')](_0x3c83af[_0x53bd('0x39')][_0x53bd('0x3b')]));_0x42ea17[_0x53bd('0x3c')]=_0x42ea17[_0x53bd('0x3c')][_0x53bd('0x4f')]?_0x42ea17[_0x53bd('0x3c')]:_0xc945f3[_0x53bd('0x38')];if(_0x3c83af[_0x53bd('0x39')][_0x53bd('0x48')]){_0x42ea17[_0x53bd('0x49')]=[{'all':!![]}];}_0x42ea17=_[_0x53bd('0x45')]({},_0x42ea17,_0x3c83af['options']);return db[_0x53bd('0x33')][_0x53bd('0x50')](_0x42ea17)[_0x53bd('0x2c')](handleEntityNotFound(_0x7e90ac,null))[_0x53bd('0x2c')](respondWithResult(_0x7e90ac,null))[_0x53bd('0x4c')](handleError(_0x7e90ac,null));};exports['download']=function(_0x4fe723,_0x4c007a,_0x3cacc9){return db['Plugin'][_0x53bd('0x50')]({'where':{'id':_0x4fe723[_0x53bd('0x51')]['id']},'attributes':[_0x53bd('0x2f'),_0x53bd('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x4c007a,null))['then'](function(_0x51977f){if(_0x51977f){var _0xb4c38d=path[_0x53bd('0x52')](config[_0x53bd('0x53')],_0x53bd('0x54'),util[_0x53bd('0x55')](_0x53bd('0x56'),path['basename'](_0x51977f['path'])));var _0x1e5fe5=fs[_0x53bd('0x57')](_0xb4c38d);var _0x2d09b7=archiver(_0x53bd('0x58'),{'zlib':{'level':0x9}});_0x2d09b7['on'](_0x53bd('0x59'),function(_0x1f1770){if(_0x1f1770[_0x53bd('0x5a')]===_0x53bd('0x5b')){logger[_0x53bd('0x5c')](_0x1f1770);}else{throw new db['Sequelize'][(_0x53bd('0x5d'))](_0x53bd('0x5e'));}});_0x2d09b7['on'](_0x53bd('0x5c'),function(_0xcc7b10){throw new db[(_0x53bd('0x5f'))][(_0x53bd('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2d09b7[_0x53bd('0x60')](_0x1e5fe5);_0x2d09b7[_0x53bd('0x61')]('**/*',{'cwd':path[_0x53bd('0x52')](config[_0x53bd('0x53')],_0x53bd('0x54'),path[_0x53bd('0x62')](_0x51977f['path'])),'ignore':[path[_0x53bd('0x52')](path[_0x53bd('0x63')](_0x51977f[_0x53bd('0x7')]),_0x53bd('0x64')),path['join'](path['basename'](_0x51977f[_0x53bd('0x7')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x1e5fe5['on'](_0x53bd('0x65'),function(){if(!fs['existsSync'](_0xb4c38d)){throw new db[(_0x53bd('0x5f'))][(_0x53bd('0x5d'))](_0x53bd('0x66'));}return _0x4c007a[_0x53bd('0x67')](_0xb4c38d,util[_0x53bd('0x55')](_0x53bd('0x56'),path[_0x53bd('0x63')](_0x51977f['path'])),function(_0x4d032d){if(_0x4d032d){throw new db[(_0x53bd('0x5f'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x53bd('0x68')](_0xb4c38d);logger['info'](_0x53bd('0x69'));logger[_0x53bd('0x6a')](_0x53bd('0x6b'));});});}return null;})[_0x53bd('0x4c')](handleError(_0x4c007a,null));};exports['upload']=function(_0x14124c,_0x2834e7,_0x418d20){var _0x4bda36=path[_0x53bd('0x63')](_0x14124c[_0x53bd('0x6c')]['filename'],path[_0x53bd('0x6d')](_0x14124c[_0x53bd('0x6c')][_0x53bd('0x6e')]));var _0x4c2fe2=path['join'](config['root'],_0x53bd('0x54'),_0x14124c['file'][_0x53bd('0x6e')]);var _0x136885=path[_0x53bd('0x52')](config[_0x53bd('0x53')],_0x53bd('0x54'),_0x4bda36);logger[_0x53bd('0x6a')](_0x53bd('0x6f'),_0x4c2fe2);logger['info'](_0x53bd('0x70'),_0x136885);try{fs['chmodSync'](_0x4c2fe2,parseInt(_0x53bd('0x71'),0x8));extract(_0x4c2fe2,{'dir':_0x136885},function(_0x3de55e){if(_0x3de55e){logger['error'](_0x3de55e);handleError(_0x3de55e,!![]);};var _0x152744=fs['readdirSync'](_0x136885);if(_0x152744[_0x53bd('0x4f')]>0x1){removeReferences(_0x4c2fe2,_0x136885);logger[_0x53bd('0x5c')](_0x53bd('0x72'));return _0x418d20(new Error(_0x53bd('0x72')));}var _0x5ce3aa=fs[_0x53bd('0x73')](path[_0x53bd('0x52')](_0x136885,_0x152744[0x0]));if(_0x5ce3aa['isFile']()){removeReferences(_0x4c2fe2,_0x136885);logger[_0x53bd('0x5c')](_0x53bd('0x72'));return _0x418d20(new Error('Invalid\x20plugin\x20structure'));}if(_0x5ce3aa['isDirectory']()){var _0x19804d=fs[_0x53bd('0x74')](path[_0x53bd('0x52')](_0x136885,_0x152744[0x0]));if(_0x19804d[_0x53bd('0x4f')]===0x0){removeReferences(_0x4c2fe2,_0x136885);logger[_0x53bd('0x5c')]('Invalid\x20plugin\x20structure');return _0x418d20(new Error(_0x53bd('0x72')));}var _0x5a57a1=_0x19804d[_0x53bd('0x75')](function(_0x42c171){return _0x42c171===_0x53bd('0x76');});if(!_0x5a57a1){return _0x418d20(new Error(_0x53bd('0x77')));}var _0x1cff9a=fs[_0x53bd('0x78')](path[_0x53bd('0x52')](_0x136885,_0x152744[0x0],_0x53bd('0x76')));var _0x11b42f=JSON[_0x53bd('0x79')](_0x1cff9a);if(_0x53bd('0x22')==typeof _0x11b42f[_0x53bd('0x2f')]){return _0x418d20(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x53bd('0x22')==typeof _0x11b42f['type']){return _0x418d20(new Error(_0x53bd('0x7a')));}if(_0x53bd('0x22')==typeof _0x11b42f[_0x53bd('0x7b')]){return _0x418d20(new Error(_0x53bd('0x7c')));}if(_0x53bd('0x22')==typeof _0x11b42f['parameters']){return _0x418d20(new Error(_0x53bd('0x7d')));}if(_0x11b42f[_0x53bd('0x36')]==='html'){if(_0x53bd('0x22')==typeof _0x11b42f[_0x53bd('0x7e')][_0x53bd('0x7f')]){return _0x418d20(new Error(_0x53bd('0x80')));}if(_0x53bd('0x22')==typeof _0x11b42f[_0x53bd('0x7e')][_0x53bd('0x7f')]['admin']&&_0x53bd('0x22')==typeof _0x11b42f[_0x53bd('0x7e')][_0x53bd('0x7f')][_0x53bd('0x81')]){return _0x418d20(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x11b42f[_0x53bd('0x36')]===_0x53bd('0x82')){if(_0x53bd('0x22')==typeof _0x11b42f[_0x53bd('0x7e')]['scriptName']){return _0x418d20(new Error(_0x53bd('0x83')));}if(_0x53bd('0x22')==typeof _0x11b42f[_0x53bd('0x7e')][_0x53bd('0x84')]){return _0x418d20(new Error(_0x53bd('0x85')));}}else{return _0x418d20(new Error(_0x53bd('0x86')));}var _0x32725f=_0x11b42f[_0x53bd('0x2f')];var _0x23ddbc=_0x11b42f[_0x53bd('0x87')];var _0x4517cb=_0x11b42f[_0x53bd('0x36')];var _0x15d8de=_0x11b42f[_0x53bd('0x88')]?_0x11b42f['sidebar']:_0x53bd('0x89');var _0x162ee9=_0x11b42f[_0x53bd('0x8a')]?_0x11b42f[_0x53bd('0x8a')]:_0x53bd('0x8b');var _0x24cfb8='';var _0x2adb8b='';var _0x574e63='';var _0x44024c='';var _0x4922e6=_0x11b42f['version'];if(_0x4517cb===_0x53bd('0x8c')){if(_0x53bd('0x22')!=typeof _0x11b42f[_0x53bd('0x7e')][_0x53bd('0x7f')][_0x53bd('0x8d')]){var _0x26ec75=_0x11b42f['parameters'][_0x53bd('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x53bd('0x8e')](_0x26ec75)){_0x24cfb8=path[_0x53bd('0x52')](_0x53bd('0x8f'),_0x4bda36,_0x152744[0x0],_0x26ec75);}else{_0x24cfb8=_0x26ec75;}}else{logger['info'](_0x53bd('0x90'));}if(_0x53bd('0x22')!=typeof _0x11b42f[_0x53bd('0x7e')][_0x53bd('0x7f')][_0x53bd('0x81')]){var _0x5ed546=_0x11b42f[_0x53bd('0x7e')][_0x53bd('0x7f')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x53bd('0x8e')](_0x5ed546)){_0x2adb8b=path['join'](_0x53bd('0x8f'),_0x4bda36,_0x152744[0x0],_0x5ed546);}else{_0x2adb8b=_0x5ed546;}}else{logger[_0x53bd('0x6a')](_0x53bd('0x91'));}}else if(_0x4517cb==='script'){_0x574e63=_0x11b42f[_0x53bd('0x7e')]['scriptName'];_0x44024c=_0x11b42f['parameters'][_0x53bd('0x84')];if(_0x53bd('0x22')!=typeof _0x11b42f[_0x53bd('0x7e')][_0x53bd('0x7f')]){if('undefined'!=typeof _0x11b42f[_0x53bd('0x7e')][_0x53bd('0x7f')][_0x53bd('0x8d')]){var _0x26ec75=_0x11b42f[_0x53bd('0x7e')][_0x53bd('0x7f')][_0x53bd('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x53bd('0x8e')](_0x26ec75)){_0x24cfb8=path[_0x53bd('0x52')](_0x53bd('0x8f'),_0x4bda36,_0x152744[0x0],_0x26ec75);}else{_0x24cfb8=_0x26ec75;}}if(_0x53bd('0x22')!=typeof _0x11b42f[_0x53bd('0x7e')][_0x53bd('0x7f')][_0x53bd('0x81')]){var _0x5ed546=_0x11b42f[_0x53bd('0x7e')][_0x53bd('0x7f')][_0x53bd('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x53bd('0x8e')](_0x5ed546)){_0x2adb8b=path[_0x53bd('0x52')]('plugins',_0x4bda36,_0x152744[0x0],_0x5ed546);}else{_0x2adb8b=_0x5ed546;}}}}var _0x5783fc={'name':_0x32725f,'description':_0x23ddbc,'path':path['join'](_0x4bda36,_0x152744[0x0]),'type':_0x4517cb,'sidebar':_0x15d8de,'icon':_0x162ee9,'adminUrl':_0x24cfb8,'agentUrl':_0x2adb8b,'scriptName':_0x574e63,'scriptPath':_0x44024c,'version':_0x4922e6};removeReferences(_0x4c2fe2,null);return db[_0x53bd('0x33')][_0x53bd('0x92')](_0x5783fc)['then'](function(_0x280dfd){var _0x1fc003={'role':_0x14124c[_0x53bd('0x93')][_0x53bd('0x94')],'userProfileId':_0x14124c[_0x53bd('0x93')][_0x53bd('0x95')]};if(!_0x1fc003)throw new Error(_0x53bd('0x96'));if(_0x1fc003['role']===_0x53bd('0x97')){var _0x131fe9=_0x280dfd[_0x53bd('0x98')]({'plain':!![]});return db[_0x53bd('0x99')][_0x53bd('0x50')]({'where':{'name':'Plugins','userProfileId':_0x1fc003[_0x53bd('0x95')]},'raw':!![]})['then'](function(_0x57b1f6){if(_0x57b1f6&&_0x57b1f6[_0x53bd('0x9a')]===0x0){return db[_0x53bd('0x9b')][_0x53bd('0x92')]({'name':_0x131fe9[_0x53bd('0x2f')],'resourceId':_0x131fe9['id'],'type':_0x57b1f6['name'],'sectionId':_0x57b1f6['id']},{})['then'](function(){return _0x280dfd;});}else{return _0x280dfd;}})[_0x53bd('0x4c')](function(_0x556f53){logger[_0x53bd('0x5c')](_0x53bd('0x9c'),_0x556f53);throw _0x556f53;});}return _0x280dfd;})[_0x53bd('0x2c')](respondWithResult(_0x2834e7,null))[_0x53bd('0x4c')](handleError(_0x2834e7,null));}});}catch(_0x466026){_0x2834e7[_0x53bd('0x20')](0x1f4)['send'](_0x466026);}};function removeReferences(_0x580f4e,_0x1e9a97){try{if(_0x580f4e){fs['unlinkSync'](_0x580f4e);logger['info'](_0x53bd('0x9d'));}if(_0x1e9a97){rimraf(_0x1e9a97,function(){});logger[_0x53bd('0x6a')]('Extracted\x20folder\x20removed');}}catch(_0xbb58b8){logger[_0x53bd('0x5c')](_0xbb58b8);}}exports[_0x53bd('0x2a')]=function(_0x45d3f3,_0xbf6dec,_0x52ab90){return db[_0x53bd('0x33')]['find']({'where':{'id':_0x45d3f3[_0x53bd('0x51')]['id']}})[_0x53bd('0x2c')](handleEntityNotFound(_0xbf6dec,null))[_0x53bd('0x2c')](saveUpdates(_0x45d3f3['body'],null))[_0x53bd('0x2c')](respondWithResult(_0xbf6dec,null))['catch'](handleError(_0xbf6dec,null));};exports[_0x53bd('0x9e')]=function(_0x8366b3,_0x2c88d9,_0x1e7e6f){return db[_0x53bd('0x33')]['find']({'where':{'id':_0x8366b3[_0x53bd('0x51')]['id']}})['then'](function(_0x582805){if(_0x582805){return _0x582805[_0x53bd('0x2b')]();}})[_0x53bd('0x2c')](function(_0x1d34a5){rimraf(path[_0x53bd('0x52')](config['root'],_0x53bd('0x54'),path['dirname'](_0x1d34a5[_0x53bd('0x7')])),function(){});return _0x1d34a5;})[_0x53bd('0x2c')](handleEntityNotFound(_0x2c88d9,null))[_0x53bd('0x2c')](respondWithStatusCode(_0x2c88d9,null))[_0x53bd('0x4c')](handleError(_0x2c88d9,null));};exports['webhookGet']=function(_0x57f87c,_0x42144b,_0x11d912){return BPromise[_0x53bd('0x9f')]()[_0x53bd('0x2c')](function(){if(!_0x57f87c[_0x53bd('0x39')][_0x53bd('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x57f87c['query'][_0x53bd('0xa0')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x31cfea=_0x57f87c[_0x53bd('0x39')][_0x53bd('0xa1')]?_0x57f87c[_0x53bd('0x39')][_0x53bd('0xa1')]+':'+_0x57f87c[_0x53bd('0x39')][_0x53bd('0xa0')]:_0x53bd('0xa2')+_0x57f87c[_0x53bd('0x39')][_0x53bd('0xa0')];var _0x23b9a2=_0x57f87c['query']['json']?_0x57f87c['query'][_0x53bd('0x27')]:!![];var _0x53f885=_0x57f87c[_0x53bd('0x39')][_0x53bd('0xa3')]?_0x57f87c[_0x53bd('0x39')][_0x53bd('0xa3')]:null;var _0x3fa84f={'method':_0x57f87c[_0x53bd('0xa4')],'uri':util[_0x53bd('0x55')]('%s%s',_0x31cfea,_0x57f87c[_0x53bd('0x39')][_0x53bd('0x7')]),'json':_0x23b9a2,'resolveWithFullResponse':!![],'encoding':_0x53f885,'qs':_0x57f87c[_0x53bd('0x39')]};if(_0x57f87c[_0x53bd('0xa5')]){_0x3fa84f[_0x53bd('0xa5')]=_0x57f87c[_0x53bd('0xa5')];if(_0x3fa84f[_0x53bd('0xa5')][_0x53bd('0xa6')]){delete _0x3fa84f['headers'][_0x53bd('0xa6')];}}if(_0x3fa84f['headers'][_0x53bd('0xa7')]){delete _0x3fa84f[_0x53bd('0xa5')]['content-type'];}return rp(_0x3fa84f);})[_0x53bd('0x2c')](function(_0x527a6d){if(_0x527a6d){_0x42144b[_0x53bd('0x25')](_0x527a6d[_0x53bd('0xa5')]);logger[_0x53bd('0x6a')](_0x527a6d[_0x53bd('0x93')]);if(_[_0x53bd('0xa8')](_0x57f87c[_0x53bd('0x39')][_0x53bd('0x7')],'download')&&_0x527a6d[_0x53bd('0xa9')]==0x1f4){return _0x42144b[_0x53bd('0x1f')](_0x527a6d[_0x53bd('0xa9')]);}else{return _0x42144b['status'](_0x527a6d[_0x53bd('0xa9')])[_0x53bd('0x30')](_0x527a6d[_0x53bd('0x93')]);}}else{return _0x42144b['sendStatus'](0xc8);}})[_0x53bd('0x4c')](handleError(_0x42144b,null));};exports['webhookPost']=function(_0x14249d,_0x353c64,_0x249bc0){return BPromise[_0x53bd('0x9f')]()[_0x53bd('0x2c')](function(){if(!_0x14249d[_0x53bd('0x39')][_0x53bd('0x7')]){throw new Error(_0x53bd('0xaa'));}if(!_0x14249d['query']['port']){throw new Error(_0x53bd('0xab'));}var _0x1d8063=_0x14249d[_0x53bd('0x39')][_0x53bd('0xa1')]?_0x14249d[_0x53bd('0x39')][_0x53bd('0xa1')]+':'+_0x14249d[_0x53bd('0x39')][_0x53bd('0xa0')]:'http://localhost:'+_0x14249d['query']['port'];var _0x538aa6=_0x14249d[_0x53bd('0x39')][_0x53bd('0x27')]?_0x14249d[_0x53bd('0x39')]['json']:!![];var _0x200230=_0x14249d['query'][_0x53bd('0xa3')]?_0x14249d[_0x53bd('0x39')][_0x53bd('0xa3')]:null;var _0x2e08e3={'method':_0x14249d[_0x53bd('0xa4')],'uri':util[_0x53bd('0x55')](_0x53bd('0xac'),_0x1d8063,_0x14249d['query'][_0x53bd('0x7')]),'json':_0x538aa6,'resolveWithFullResponse':!![],'encoding':_0x200230,'body':_0x14249d[_0x53bd('0x93')]};if(_0x14249d[_0x53bd('0xa5')]){_0x2e08e3['headers']=_0x14249d[_0x53bd('0xa5')];if(_0x2e08e3[_0x53bd('0xa5')][_0x53bd('0xa6')]){delete _0x2e08e3[_0x53bd('0xa5')][_0x53bd('0xa6')];}}if(_0x2e08e3[_0x53bd('0xa5')]['content-type']){delete _0x2e08e3[_0x53bd('0xa5')][_0x53bd('0xa7')];}return rp(_0x2e08e3);})['then'](function(_0x12fcf0){if(_0x12fcf0){_0x353c64[_0x53bd('0x25')](_0x12fcf0[_0x53bd('0xa5')]);logger[_0x53bd('0x6a')](_0x12fcf0['body']);return _0x353c64[_0x53bd('0x20')](_0x12fcf0[_0x53bd('0xa9')])[_0x53bd('0x30')](_0x12fcf0['body']);}else{return _0x353c64[_0x53bd('0x1f')](0xc8);}})[_0x53bd('0x4c')](handleError(_0x353c64,null));}; \ No newline at end of file +var _0x3748=['include','findAll','rows','catch','show','params','length','find','download','path','join','root','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','glob','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','set','statusCode','sendStatus','webhookPost','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','status','end','json','offset','limit','undefined','count','apply','save','then','destroy','get','Plugins','error','stack','name','index','map','Plugin','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0x3748,0x106));var _0x8374=function(_0x17827c,_0x1254cd){_0x17827c=_0x17827c-0x0;var _0xe65b8c=_0x3748[_0x17827c];return _0xe65b8c;};'use strict';var emlformat=require(_0x8374('0x0'));var rimraf=require(_0x8374('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8374('0x2'));var rp=require(_0x8374('0x3'));var moment=require(_0x8374('0x4'));var BPromise=require(_0x8374('0x5'));var Mustache=require(_0x8374('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8374('0x7'));var csv=require(_0x8374('0x8'));var ejs=require(_0x8374('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8374('0xa'));var squel=require('squel');var crypto=require(_0x8374('0xb'));var jsforce=require(_0x8374('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8374('0x8'));var querystring=require('querystring');var Papa=require(_0x8374('0xd'));var extract=require(_0x8374('0xe'));var rimraf=require(_0x8374('0x1'));var archiver=require(_0x8374('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8374('0x10'));var as=require(_0x8374('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8374('0x12'))(_0x8374('0x13'));var utils=require(_0x8374('0x14'));var config=require(_0x8374('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8374('0x16'))['db'];config[_0x8374('0x17')]=_[_0x8374('0x18')](config[_0x8374('0x17')],{'host':_0x8374('0x19'),'port':0x18eb});var socket=require(_0x8374('0x1a'))(new Redis(config[_0x8374('0x17')]));require(_0x8374('0x1b'))['register'](socket);function respondWithStatusCode(_0x2a6ee5,_0x243a6c){_0x243a6c=_0x243a6c||0xcc;return function(_0x50e630){if(_0x50e630){return _0x2a6ee5['sendStatus'](_0x243a6c);}return _0x2a6ee5[_0x8374('0x1c')](_0x243a6c)[_0x8374('0x1d')]();};}function respondWithResult(_0xb36be1,_0x4c205d){_0x4c205d=_0x4c205d||0xc8;return function(_0x5df6a7){if(_0x5df6a7){return _0xb36be1[_0x8374('0x1c')](_0x4c205d)[_0x8374('0x1e')](_0x5df6a7);}};}function respondWithFilteredResult(_0x152761,_0x2eccbd){return function(_0x1add02){if(_0x1add02){var _0x2be566=typeof _0x2eccbd[_0x8374('0x1f')]==='undefined'&&typeof _0x2eccbd[_0x8374('0x20')]===_0x8374('0x21');var _0x3a203a=_0x1add02[_0x8374('0x22')];var _0x10e994=_0x2be566?0x0:_0x2eccbd[_0x8374('0x1f')];var _0x468206=_0x2be566?_0x1add02[_0x8374('0x22')]:_0x2eccbd['offset']+_0x2eccbd[_0x8374('0x20')];var _0x14b11f;if(_0x468206>=_0x3a203a){_0x468206=_0x3a203a;_0x14b11f=0xc8;}else{_0x14b11f=0xce;}_0x152761[_0x8374('0x1c')](_0x14b11f);return _0x152761['set']('Content-Range',_0x10e994+'-'+_0x468206+'/'+_0x3a203a)[_0x8374('0x1e')](_0x1add02);}return null;};}function patchUpdates(_0x14fc4f){return function(_0x21f6f5){try{jsonpatch[_0x8374('0x23')](_0x21f6f5,_0x14fc4f,!![]);}catch(_0x941597){return BPromise['reject'](_0x941597);}return _0x21f6f5[_0x8374('0x24')]();};}function saveUpdates(_0x1436c7,_0x1d984f){return function(_0x52e2cf){if(_0x52e2cf){return _0x52e2cf['update'](_0x1436c7)[_0x8374('0x25')](function(_0x5d5144){return _0x5d5144;});}return null;};}function removeEntity(_0x105e90,_0x431796){return function(_0x57c615){if(_0x57c615){return _0x57c615[_0x8374('0x26')]()[_0x8374('0x25')](function(){var _0x226ec0=_0x57c615[_0x8374('0x27')]({'plain':!![]});var _0x580391=_0x8374('0x28');return db['UserProfileResource'][_0x8374('0x26')]({'where':{'type':_0x580391,'resourceId':_0x226ec0['id']}})[_0x8374('0x25')](function(){return _0x57c615;});})[_0x8374('0x25')](function(){_0x105e90['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xdb549d,_0x2eae8d){return function(_0x38a14f){if(!_0x38a14f){_0xdb549d['sendStatus'](0x194);}return _0x38a14f;};}function handleError(_0x45439d,_0x57640c){_0x57640c=_0x57640c||0x1f4;return function(_0x37719a){logger[_0x8374('0x29')](_0x37719a[_0x8374('0x2a')]);if(_0x37719a[_0x8374('0x2b')]){delete _0x37719a[_0x8374('0x2b')];}_0x45439d['status'](_0x57640c)['send'](_0x37719a);};}exports[_0x8374('0x2c')]=function(_0x8dec06,_0x634e51){var _0x4e96b0={},_0x6a9c58={},_0x2dabc2={'count':0x0,'rows':[]};var _0x28c840=_[_0x8374('0x2d')](db[_0x8374('0x2e')]['rawAttributes'],function(_0x251e8a){return{'name':_0x251e8a[_0x8374('0x2f')],'type':_0x251e8a[_0x8374('0x30')][_0x8374('0x31')]};});_0x6a9c58['model']=_[_0x8374('0x2d')](_0x28c840,_0x8374('0x2b'));_0x6a9c58[_0x8374('0x32')]=_[_0x8374('0x33')](_0x8dec06['query']);_0x6a9c58[_0x8374('0x34')]=_[_0x8374('0x35')](_0x6a9c58['model'],_0x6a9c58['query']);_0x4e96b0[_0x8374('0x36')]=_[_0x8374('0x35')](_0x6a9c58[_0x8374('0x37')],qs[_0x8374('0x38')](_0x8dec06[_0x8374('0x32')][_0x8374('0x38')]));_0x4e96b0[_0x8374('0x36')]=_0x4e96b0[_0x8374('0x36')]['length']?_0x4e96b0[_0x8374('0x36')]:_0x6a9c58['model'];if(!_0x8dec06[_0x8374('0x32')][_0x8374('0x39')](_0x8374('0x3a'))){_0x4e96b0[_0x8374('0x20')]=qs['limit'](_0x8dec06[_0x8374('0x32')]['limit']);_0x4e96b0[_0x8374('0x1f')]=qs[_0x8374('0x1f')](_0x8dec06[_0x8374('0x32')][_0x8374('0x1f')]);}_0x4e96b0[_0x8374('0x3b')]=qs[_0x8374('0x3c')](_0x8dec06[_0x8374('0x32')][_0x8374('0x3c')]);_0x4e96b0['where']=qs['filters'](_['pick'](_0x8dec06[_0x8374('0x32')],_0x6a9c58['filters']),_0x28c840);if(_0x8dec06[_0x8374('0x32')][_0x8374('0x3d')]){_0x4e96b0[_0x8374('0x3e')]=_[_0x8374('0x3f')](_0x4e96b0[_0x8374('0x3e')],{'$or':_[_0x8374('0x2d')](_0x28c840,function(_0x23f0f2){if(_0x23f0f2[_0x8374('0x30')]!==_0x8374('0x40')){var _0x37caf5={};_0x37caf5[_0x23f0f2[_0x8374('0x2b')]]={'$like':'%'+_0x8dec06[_0x8374('0x32')][_0x8374('0x3d')]+'%'};return _0x37caf5;}})});}_0x4e96b0=_[_0x8374('0x3f')]({},_0x4e96b0,_0x8dec06[_0x8374('0x41')]);var _0x12a8ee={'where':_0x4e96b0[_0x8374('0x3e')]};return db[_0x8374('0x2e')][_0x8374('0x22')](_0x12a8ee)[_0x8374('0x25')](function(_0x518fd6){_0x2dabc2['count']=_0x518fd6;if(_0x8dec06[_0x8374('0x32')]['includeAll']){_0x4e96b0[_0x8374('0x42')]=[{'all':!![]}];}return db['Plugin'][_0x8374('0x43')](_0x4e96b0);})['then'](function(_0x1bec7d){_0x2dabc2[_0x8374('0x44')]=_0x1bec7d;return _0x2dabc2;})[_0x8374('0x25')](respondWithFilteredResult(_0x634e51,_0x4e96b0))[_0x8374('0x45')](handleError(_0x634e51,null));};exports[_0x8374('0x46')]=function(_0x220bff,_0x486963){var _0x1f147b={'raw':!![],'where':{'id':_0x220bff[_0x8374('0x47')]['id']}},_0x3c8516={};_0x3c8516[_0x8374('0x37')]=_[_0x8374('0x33')](db[_0x8374('0x2e')]['rawAttributes']);_0x3c8516[_0x8374('0x32')]=_['keys'](_0x220bff[_0x8374('0x32')]);_0x3c8516[_0x8374('0x34')]=_[_0x8374('0x35')](_0x3c8516[_0x8374('0x37')],_0x3c8516[_0x8374('0x32')]);_0x1f147b[_0x8374('0x36')]=_['intersection'](_0x3c8516[_0x8374('0x37')],qs[_0x8374('0x38')](_0x220bff[_0x8374('0x32')][_0x8374('0x38')]));_0x1f147b[_0x8374('0x36')]=_0x1f147b[_0x8374('0x36')][_0x8374('0x48')]?_0x1f147b[_0x8374('0x36')]:_0x3c8516[_0x8374('0x37')];if(_0x220bff[_0x8374('0x32')]['includeAll']){_0x1f147b[_0x8374('0x42')]=[{'all':!![]}];}_0x1f147b=_[_0x8374('0x3f')]({},_0x1f147b,_0x220bff[_0x8374('0x41')]);return db[_0x8374('0x2e')][_0x8374('0x49')](_0x1f147b)[_0x8374('0x25')](handleEntityNotFound(_0x486963,null))[_0x8374('0x25')](respondWithResult(_0x486963,null))[_0x8374('0x45')](handleError(_0x486963,null));};exports[_0x8374('0x4a')]=function(_0x27e8fe,_0x307942,_0x2a37d4){return db[_0x8374('0x2e')][_0x8374('0x49')]({'where':{'id':_0x27e8fe[_0x8374('0x47')]['id']},'attributes':['name',_0x8374('0x4b')],'raw':!![]})[_0x8374('0x25')](handleEntityNotFound(_0x307942,null))[_0x8374('0x25')](function(_0x36502f){if(_0x36502f){var _0x233eec=path[_0x8374('0x4c')](config[_0x8374('0x4d')],'server/files/plugins',util['format'](_0x8374('0x4e'),path[_0x8374('0x4f')](_0x36502f['path'])));var _0x5595d4=fs[_0x8374('0x50')](_0x233eec);var _0x23166a=archiver(_0x8374('0x51'),{'zlib':{'level':0x9}});_0x23166a['on'](_0x8374('0x52'),function(_0x14d675){if(_0x14d675[_0x8374('0x53')]===_0x8374('0x54')){logger[_0x8374('0x29')](_0x14d675);}else{throw new db['Sequelize']['Error'](_0x8374('0x55'));}});_0x23166a['on'](_0x8374('0x29'),function(_0x2e0ebd){throw new db[(_0x8374('0x56'))][(_0x8374('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x23166a['pipe'](_0x5595d4);_0x23166a[_0x8374('0x58')]('**/*',{'cwd':path['join'](config[_0x8374('0x4d')],_0x8374('0x59'),path[_0x8374('0x5a')](_0x36502f['path'])),'ignore':[path[_0x8374('0x4c')](path[_0x8374('0x4f')](_0x36502f['path']),_0x8374('0x5b')),path[_0x8374('0x4c')](path['basename'](_0x36502f[_0x8374('0x4b')]),_0x8374('0x5c'))],'nodir':!![]})[_0x8374('0x5d')]();_0x5595d4['on'](_0x8374('0x5e'),function(){if(!fs[_0x8374('0x5f')](_0x233eec)){throw new db[(_0x8374('0x56'))][(_0x8374('0x57'))](_0x8374('0x60'));}return _0x307942[_0x8374('0x4a')](_0x233eec,util[_0x8374('0x61')](_0x8374('0x4e'),path[_0x8374('0x4f')](_0x36502f[_0x8374('0x4b')])),function(_0x1b7cc1){if(_0x1b7cc1){throw new db[(_0x8374('0x56'))][(_0x8374('0x57'))](_0x8374('0x62'));}fs[_0x8374('0x63')](_0x233eec);logger['info'](_0x8374('0x64'));logger[_0x8374('0x65')](_0x8374('0x66'));});});}return null;})['catch'](handleError(_0x307942,null));};exports['upload']=function(_0x17ecb0,_0x5aac76,_0x54886a){var _0x465776=path['basename'](_0x17ecb0[_0x8374('0x67')][_0x8374('0x68')],path['extname'](_0x17ecb0[_0x8374('0x67')][_0x8374('0x68')]));var _0x1da810=path[_0x8374('0x4c')](config['root'],'server/files/plugins',_0x17ecb0['file']['filename']);var _0x19cfc2=path[_0x8374('0x4c')](config[_0x8374('0x4d')],_0x8374('0x59'),_0x465776);logger[_0x8374('0x65')]('Plugin\x20upload\x20filepath:\x20%s',_0x1da810);logger[_0x8374('0x65')](_0x8374('0x69'),_0x19cfc2);try{fs[_0x8374('0x6a')](_0x1da810,parseInt(_0x8374('0x6b'),0x8));extract(_0x1da810,{'dir':_0x19cfc2},function(_0xefc801){if(_0xefc801){logger[_0x8374('0x29')](_0xefc801);handleError(_0xefc801,!![]);};var _0x3ecbcf=fs['readdirSync'](_0x19cfc2);if(_0x3ecbcf['length']>0x1){removeReferences(_0x1da810,_0x19cfc2);logger[_0x8374('0x29')](_0x8374('0x6c'));return _0x54886a(new Error('Invalid\x20plugin\x20structure'));}var _0x55adee=fs[_0x8374('0x6d')](path[_0x8374('0x4c')](_0x19cfc2,_0x3ecbcf[0x0]));if(_0x55adee[_0x8374('0x6e')]()){removeReferences(_0x1da810,_0x19cfc2);logger[_0x8374('0x29')](_0x8374('0x6c'));return _0x54886a(new Error(_0x8374('0x6c')));}if(_0x55adee[_0x8374('0x6f')]()){var _0x2e24de=fs[_0x8374('0x70')](path['join'](_0x19cfc2,_0x3ecbcf[0x0]));if(_0x2e24de['length']===0x0){removeReferences(_0x1da810,_0x19cfc2);logger[_0x8374('0x29')](_0x8374('0x6c'));return _0x54886a(new Error(_0x8374('0x6c')));}var _0x2b8c56=_0x2e24de[_0x8374('0x71')](function(_0x2ded2d){return _0x2ded2d===_0x8374('0x72');});if(!_0x2b8c56){return _0x54886a(new Error(_0x8374('0x73')));}var _0x372990=fs[_0x8374('0x74')](path[_0x8374('0x4c')](_0x19cfc2,_0x3ecbcf[0x0],_0x8374('0x72')));var _0x3fedf0=JSON['parse'](_0x372990);if(_0x8374('0x21')==typeof _0x3fedf0[_0x8374('0x2b')]){return _0x54886a(new Error(_0x8374('0x75')));}if(_0x8374('0x21')==typeof _0x3fedf0['type']){return _0x54886a(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x8374('0x21')==typeof _0x3fedf0[_0x8374('0x76')]){return _0x54886a(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x3fedf0[_0x8374('0x77')]){return _0x54886a(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x3fedf0[_0x8374('0x30')]==='html'){if(_0x8374('0x21')==typeof _0x3fedf0[_0x8374('0x77')]['views']){return _0x54886a(new Error(_0x8374('0x78')));}if(_0x8374('0x21')==typeof _0x3fedf0[_0x8374('0x77')][_0x8374('0x79')][_0x8374('0x7a')]&&'undefined'==typeof _0x3fedf0[_0x8374('0x77')][_0x8374('0x79')][_0x8374('0x7b')]){return _0x54886a(new Error(_0x8374('0x7c')));}}else if(_0x3fedf0[_0x8374('0x30')]===_0x8374('0x7d')){if(_0x8374('0x21')==typeof _0x3fedf0[_0x8374('0x77')]['scriptName']){return _0x54886a(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x8374('0x21')==typeof _0x3fedf0[_0x8374('0x77')][_0x8374('0x7e')]){return _0x54886a(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x54886a(new Error(_0x8374('0x7f')));}var _0x4918ce=_0x3fedf0[_0x8374('0x2b')];var _0x2fdb0c=_0x3fedf0[_0x8374('0x80')];var _0x2bf43c=_0x3fedf0[_0x8374('0x30')];var _0x1affaf=_0x3fedf0['sidebar']?_0x3fedf0['sidebar']:'always';var _0x5ef47b=_0x3fedf0[_0x8374('0x81')]?_0x3fedf0[_0x8374('0x81')]:_0x8374('0x82');var _0x4810df='';var _0x29d2a0='';var _0x12bd8c='';var _0x130972='';var _0x1a7d57=_0x3fedf0[_0x8374('0x76')];if(_0x2bf43c==='html'){if('undefined'!=typeof _0x3fedf0['parameters'][_0x8374('0x79')]['admin']){var _0x3d61be=_0x3fedf0[_0x8374('0x77')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x8374('0x83')](_0x3d61be)){_0x4810df=path[_0x8374('0x4c')]('plugins',_0x465776,_0x3ecbcf[0x0],_0x3d61be);}else{_0x4810df=_0x3d61be;}}else{logger[_0x8374('0x65')](_0x8374('0x84'));}if('undefined'!=typeof _0x3fedf0[_0x8374('0x77')][_0x8374('0x79')][_0x8374('0x7b')]){var _0x2a7f53=_0x3fedf0[_0x8374('0x77')][_0x8374('0x79')][_0x8374('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x8374('0x83')](_0x2a7f53)){_0x29d2a0=path[_0x8374('0x4c')](_0x8374('0x85'),_0x465776,_0x3ecbcf[0x0],_0x2a7f53);}else{_0x29d2a0=_0x2a7f53;}}else{logger[_0x8374('0x65')](_0x8374('0x86'));}}else if(_0x2bf43c===_0x8374('0x7d')){_0x12bd8c=_0x3fedf0[_0x8374('0x77')][_0x8374('0x87')];_0x130972=_0x3fedf0[_0x8374('0x77')][_0x8374('0x7e')];if(_0x8374('0x21')!=typeof _0x3fedf0['parameters'][_0x8374('0x79')]){if(_0x8374('0x21')!=typeof _0x3fedf0[_0x8374('0x77')][_0x8374('0x79')][_0x8374('0x7a')]){var _0x3d61be=_0x3fedf0[_0x8374('0x77')][_0x8374('0x79')][_0x8374('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x8374('0x83')](_0x3d61be)){_0x4810df=path[_0x8374('0x4c')](_0x8374('0x85'),_0x465776,_0x3ecbcf[0x0],_0x3d61be);}else{_0x4810df=_0x3d61be;}}if('undefined'!=typeof _0x3fedf0[_0x8374('0x77')][_0x8374('0x79')][_0x8374('0x7b')]){var _0x2a7f53=_0x3fedf0[_0x8374('0x77')][_0x8374('0x79')][_0x8374('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x8374('0x83')](_0x2a7f53)){_0x29d2a0=path[_0x8374('0x4c')](_0x8374('0x85'),_0x465776,_0x3ecbcf[0x0],_0x2a7f53);}else{_0x29d2a0=_0x2a7f53;}}}}var _0x35472b={'name':_0x4918ce,'description':_0x2fdb0c,'path':path[_0x8374('0x4c')](_0x465776,_0x3ecbcf[0x0]),'type':_0x2bf43c,'sidebar':_0x1affaf,'icon':_0x5ef47b,'adminUrl':_0x4810df,'agentUrl':_0x29d2a0,'scriptName':_0x12bd8c,'scriptPath':_0x130972,'version':_0x1a7d57};removeReferences(_0x1da810,null);return db[_0x8374('0x2e')][_0x8374('0x88')](_0x35472b)['then'](function(_0x1ce9e7){var _0x33cbda={'role':_0x17ecb0[_0x8374('0x89')][_0x8374('0x8a')],'userProfileId':_0x17ecb0[_0x8374('0x89')]['userProfileId']};if(!_0x33cbda)throw new Error(_0x8374('0x8b'));if(_0x33cbda[_0x8374('0x8a')]===_0x8374('0x8c')){var _0x5c956c=_0x1ce9e7[_0x8374('0x27')]({'plain':!![]});return db[_0x8374('0x8d')][_0x8374('0x49')]({'where':{'name':_0x8374('0x28'),'userProfileId':_0x33cbda[_0x8374('0x8e')]},'raw':!![]})[_0x8374('0x25')](function(_0x28688c){if(_0x28688c&&_0x28688c[_0x8374('0x8f')]===0x0){return db[_0x8374('0x90')]['create']({'name':_0x5c956c[_0x8374('0x2b')],'resourceId':_0x5c956c['id'],'type':_0x28688c[_0x8374('0x2b')],'sectionId':_0x28688c['id']},{})[_0x8374('0x25')](function(){return _0x1ce9e7;});}else{return _0x1ce9e7;}})[_0x8374('0x45')](function(_0x1af5c0){logger[_0x8374('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1af5c0);throw _0x1af5c0;});}return _0x1ce9e7;})[_0x8374('0x25')](respondWithResult(_0x5aac76,null))[_0x8374('0x45')](handleError(_0x5aac76,null));}});}catch(_0x3e399e){_0x5aac76[_0x8374('0x1c')](0x1f4)[_0x8374('0x91')](_0x3e399e);}};function removeReferences(_0x5b4758,_0x48e19e){try{if(_0x5b4758){fs[_0x8374('0x63')](_0x5b4758);logger[_0x8374('0x65')](_0x8374('0x92'));}if(_0x48e19e){rimraf(_0x48e19e,function(){});logger[_0x8374('0x65')](_0x8374('0x93'));}}catch(_0x1bcfa2){logger['error'](_0x1bcfa2);}}exports[_0x8374('0x94')]=function(_0x2e9ac1,_0x285a35,_0x1ca119){return db[_0x8374('0x2e')][_0x8374('0x49')]({'where':{'id':_0x2e9ac1[_0x8374('0x47')]['id']}})[_0x8374('0x25')](handleEntityNotFound(_0x285a35,null))[_0x8374('0x25')](saveUpdates(_0x2e9ac1[_0x8374('0x89')],null))[_0x8374('0x25')](respondWithResult(_0x285a35,null))['catch'](handleError(_0x285a35,null));};exports[_0x8374('0x95')]=function(_0x2b8f75,_0x4afecb,_0x2ce62c){return db[_0x8374('0x2e')][_0x8374('0x49')]({'where':{'id':_0x2b8f75[_0x8374('0x47')]['id']}})['then'](function(_0x6cbaa3){if(_0x6cbaa3){return _0x6cbaa3['destroy']();}})['then'](function(_0x584557){rimraf(path[_0x8374('0x4c')](config['root'],'server/files/plugins',path[_0x8374('0x5a')](_0x584557[_0x8374('0x4b')])),function(){});return _0x584557;})[_0x8374('0x25')](handleEntityNotFound(_0x4afecb,null))[_0x8374('0x25')](respondWithStatusCode(_0x4afecb,null))[_0x8374('0x45')](handleError(_0x4afecb,null));};exports['webhookGet']=function(_0x76faa0,_0x6a433b,_0x22688f){return BPromise[_0x8374('0x96')]()[_0x8374('0x25')](function(){if(!_0x76faa0[_0x8374('0x32')][_0x8374('0x4b')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x76faa0['query'][_0x8374('0x97')]){throw new Error(_0x8374('0x98'));}var _0x322a76=_0x76faa0[_0x8374('0x32')]['hostname']?_0x76faa0[_0x8374('0x32')][_0x8374('0x99')]+':'+_0x76faa0[_0x8374('0x32')]['port']:'http://localhost:'+_0x76faa0[_0x8374('0x32')][_0x8374('0x97')];var _0x370bee=_0x76faa0[_0x8374('0x32')]['json']?_0x76faa0[_0x8374('0x32')][_0x8374('0x1e')]:!![];var _0x4aa183=_0x76faa0[_0x8374('0x32')][_0x8374('0x9a')]?_0x76faa0[_0x8374('0x32')][_0x8374('0x9a')]:null;var _0x294e9a={'method':_0x76faa0[_0x8374('0x9b')],'uri':util[_0x8374('0x61')](_0x8374('0x9c'),_0x322a76,_0x76faa0[_0x8374('0x32')]['path']),'json':_0x370bee,'resolveWithFullResponse':!![],'encoding':_0x4aa183,'qs':_0x76faa0[_0x8374('0x32')]};if(_0x76faa0['headers']){_0x294e9a[_0x8374('0x9d')]=_0x76faa0[_0x8374('0x9d')];if(_0x294e9a[_0x8374('0x9d')][_0x8374('0x9e')]){delete _0x294e9a[_0x8374('0x9d')][_0x8374('0x9e')];}}if(_0x294e9a['headers'][_0x8374('0x9f')]){delete _0x294e9a[_0x8374('0x9d')][_0x8374('0x9f')];}return rp(_0x294e9a);})[_0x8374('0x25')](function(_0x3ad8e5){if(_0x3ad8e5){_0x6a433b[_0x8374('0xa0')](_0x3ad8e5[_0x8374('0x9d')]);logger[_0x8374('0x65')](_0x3ad8e5[_0x8374('0x89')]);if(_['endsWith'](_0x76faa0[_0x8374('0x32')][_0x8374('0x4b')],_0x8374('0x4a'))&&_0x3ad8e5[_0x8374('0xa1')]==0x1f4){return _0x6a433b[_0x8374('0xa2')](_0x3ad8e5['statusCode']);}else{return _0x6a433b[_0x8374('0x1c')](_0x3ad8e5[_0x8374('0xa1')])[_0x8374('0x91')](_0x3ad8e5['body']);}}else{return _0x6a433b[_0x8374('0xa2')](0xc8);}})[_0x8374('0x45')](handleError(_0x6a433b,null));};exports[_0x8374('0xa3')]=function(_0x2240ce,_0x2ea983,_0x59ea19){return BPromise[_0x8374('0x96')]()['then'](function(){if(!_0x2240ce[_0x8374('0x32')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2240ce[_0x8374('0x32')][_0x8374('0x97')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1a69e5=_0x2240ce[_0x8374('0x32')][_0x8374('0x99')]?_0x2240ce[_0x8374('0x32')]['hostname']+':'+_0x2240ce[_0x8374('0x32')]['port']:'http://localhost:'+_0x2240ce[_0x8374('0x32')][_0x8374('0x97')];var _0x34b1e3=_0x2240ce[_0x8374('0x32')][_0x8374('0x1e')]?_0x2240ce[_0x8374('0x32')][_0x8374('0x1e')]:!![];var _0x8c86ab=_0x2240ce[_0x8374('0x32')][_0x8374('0x9a')]?_0x2240ce['query']['encoding']:null;var _0x2ac95a={'method':_0x2240ce[_0x8374('0x9b')],'uri':util[_0x8374('0x61')](_0x8374('0x9c'),_0x1a69e5,_0x2240ce[_0x8374('0x32')][_0x8374('0x4b')]),'json':_0x34b1e3,'resolveWithFullResponse':!![],'encoding':_0x8c86ab,'body':_0x2240ce['body']};if(_0x2240ce[_0x8374('0x9d')]){_0x2ac95a['headers']=_0x2240ce[_0x8374('0x9d')];if(_0x2ac95a[_0x8374('0x9d')]['content-length']){delete _0x2ac95a[_0x8374('0x9d')][_0x8374('0x9e')];}}if(_0x2ac95a[_0x8374('0x9d')]['content-type']){delete _0x2ac95a[_0x8374('0x9d')][_0x8374('0x9f')];}return rp(_0x2ac95a);})['then'](function(_0x2e181f){if(_0x2e181f){_0x2ea983['set'](_0x2e181f[_0x8374('0x9d')]);logger[_0x8374('0x65')](_0x2e181f['body']);return _0x2ea983[_0x8374('0x1c')](_0x2e181f[_0x8374('0xa1')])['send'](_0x2e181f['body']);}else{return _0x2ea983[_0x8374('0xa2')](0xc8);}})['catch'](handleError(_0x2ea983,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 341c887..a34abf0 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 _0xc1dc=['../../mysqldb','Plugin','save','remove','emit','hasOwnProperty','events'];(function(_0x289b93,_0x43c689){var _0x5c1e5f=function(_0x20d567){while(--_0x20d567){_0x289b93['push'](_0x289b93['shift']());}};_0x5c1e5f(++_0x43c689);}(_0xc1dc,0x84));var _0xcc1d=function(_0x4c9a7e,_0x43233a){_0x4c9a7e=_0x4c9a7e-0x0;var _0x2fb2b1=_0xc1dc[_0x4c9a7e];return _0x2fb2b1;};'use strict';var EventEmitter=require(_0xcc1d('0x0'));var Plugin=require(_0xcc1d('0x1'))['db'][_0xcc1d('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcc1d('0x3'),'afterUpdate':'update','afterDestroy':_0xcc1d('0x4')};function emitEvent(_0x3f14d6){return function(_0x48011a,_0x14741b,_0x35ffe8){PluginEvents[_0xcc1d('0x5')](_0x3f14d6+':'+_0x48011a['id'],_0x48011a);PluginEvents[_0xcc1d('0x5')](_0x3f14d6,_0x48011a);_0x35ffe8(null);};}for(var e in events){if(events[_0xcc1d('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x52ad=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','Plugin','setMaxListeners','update'];(function(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_0x52ad,0x1d8));var _0xd52a=function(_0x48f39d,_0x147a91){_0x48f39d=_0x48f39d-0x0;var _0x2782c6=_0x52ad[_0x48f39d];return _0x2782c6;};'use strict';var EventEmitter=require(_0xd52a('0x0'));var Plugin=require(_0xd52a('0x1'))['db'][_0xd52a('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xd52a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd52a('0x4'),'afterDestroy':_0xd52a('0x5')};function emitEvent(_0x2dbf7a){return function(_0xf1d12e,_0x69fd93,_0xc135cb){PluginEvents[_0xd52a('0x6')](_0x2dbf7a+':'+_0xf1d12e['id'],_0xf1d12e);PluginEvents[_0xd52a('0x6')](_0x2dbf7a,_0xf1d12e);_0xc135cb(null);};}for(var e in events){if(events[_0xd52a('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xd52a('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 4b1dc49..c53ce87 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 _0x1c81=['api','bluebird','request-promise','path','rimraf','exports','Plugin','lodash','util'];(function(_0x5d31c8,_0x4cb7a4){var _0x1a4456=function(_0x9c66cf){while(--_0x9c66cf){_0x5d31c8['push'](_0x5d31c8['shift']());}};_0x1a4456(++_0x4cb7a4);}(_0x1c81,0xcd));var _0x11c8=function(_0x4d8724,_0x417b55){_0x4d8724=_0x4d8724-0x0;var _0x5af83f=_0x1c81[_0x4d8724];return _0x5af83f;};'use strict';var _=require(_0x11c8('0x0'));var util=require(_0x11c8('0x1'));var logger=require('../../config/logger')(_0x11c8('0x2'));var moment=require('moment');var BPromise=require(_0x11c8('0x3'));var rp=require(_0x11c8('0x4'));var fs=require('fs');var path=require(_0x11c8('0x5'));var rimraf=require(_0x11c8('0x6'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x11c8('0x7')]=function(_0x338f03,_0x2f884f){return _0x338f03['define'](_0x11c8('0x8'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0609=['bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','moment'];(function(_0x239786,_0x471f27){var _0x3f15e2=function(_0x1c3781){while(--_0x1c3781){_0x239786['push'](_0x239786['shift']());}};_0x3f15e2(++_0x471f27);}(_0x0609,0x159));var _0x9060=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x0609[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x9060('0x0'));var util=require(_0x9060('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9060('0x2'));var BPromise=require(_0x9060('0x3'));var rp=require(_0x9060('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9060('0x5'));var config=require(_0x9060('0x6'));var attributes=require(_0x9060('0x7'));module[_0x9060('0x8')]=function(_0x59def0,_0x515207){return _0x59def0[_0x9060('0x9')](_0x9060('0xa'),attributes,{'tableName':_0x9060('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 5d0218e..296dd98 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 _0xcf2b=['debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreatePlugin','create','body','options','raw','randomstring','ioredis','../../mysqldb','rpc','client','http','redis','defaults','localhost','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent'];(function(_0x47458a,_0x2dd86f){var _0x8db277=function(_0x2fea01){while(--_0x2fea01){_0x47458a['push'](_0x47458a['shift']());}};_0x8db277(++_0x2dd86f);}(_0xcf2b,0x77));var _0xbcf2=function(_0x514846,_0x34ac8d){_0x514846=_0x514846-0x0;var _0x2627a8=_0xcf2b[_0x514846];return _0x2627a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbcf2('0x0'));var fs=require('fs');var Redis=require(_0xbcf2('0x1'));var db=require(_0xbcf2('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbcf2('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbcf2('0x4')][_0xbcf2('0x5')]({'port':0x232a});config[_0xbcf2('0x6')]=_[_0xbcf2('0x7')](config[_0xbcf2('0x6')],{'host':_0xbcf2('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbcf2('0x6')]));require(_0xbcf2('0x9'))[_0xbcf2('0xa')](socket);function respondWithRpcPromise(_0x20bfd5,_0x2d8ea3,_0x40d6d4){return new BPromise(function(_0x25e00a,_0x54fee3){return client[_0xbcf2('0xb')](_0x20bfd5,_0x40d6d4)[_0xbcf2('0xc')](function(_0x8b3e02){logger[_0xbcf2('0xd')](_0xbcf2('0xe'),_0x2d8ea3,_0xbcf2('0xf'));logger[_0xbcf2('0x10')](_0xbcf2('0x11'),_0x2d8ea3,_0xbcf2('0xf'),JSON['stringify'](_0x8b3e02));if(_0x8b3e02[_0xbcf2('0x12')]){if(_0x8b3e02[_0xbcf2('0x12')]['code']===0x1f4){logger[_0xbcf2('0x12')](_0xbcf2('0xe'),_0x2d8ea3,_0x8b3e02[_0xbcf2('0x12')][_0xbcf2('0x13')]);return _0x54fee3(_0x8b3e02[_0xbcf2('0x12')][_0xbcf2('0x13')]);}logger[_0xbcf2('0x12')](_0xbcf2('0xe'),_0x2d8ea3,_0x8b3e02[_0xbcf2('0x12')][_0xbcf2('0x13')]);return _0x25e00a(_0x8b3e02[_0xbcf2('0x12')][_0xbcf2('0x13')]);}else{logger[_0xbcf2('0xd')](_0xbcf2('0xe'),_0x2d8ea3,_0xbcf2('0xf'));_0x25e00a(_0x8b3e02[_0xbcf2('0x14')][_0xbcf2('0x13')]);}})[_0xbcf2('0x15')](function(_0x1701d2){logger[_0xbcf2('0x12')](_0xbcf2('0xe'),_0x2d8ea3,_0x1701d2);_0x54fee3(_0x1701d2);});});}exports[_0xbcf2('0x16')]=function(_0x3dc94d){var _0x291896=this;return new Promise(function(_0x495c59,_0x5861d5){return db['Plugin'][_0xbcf2('0x17')](_0x3dc94d[_0xbcf2('0x18')],{'raw':_0x3dc94d[_0xbcf2('0x19')]?_0x3dc94d[_0xbcf2('0x19')][_0xbcf2('0x1a')]===undefined?!![]:![]:!![]})[_0xbcf2('0xc')](function(_0x13ab26){logger[_0xbcf2('0xd')](_0xbcf2('0x16'),_0x3dc94d);logger[_0xbcf2('0x10')](_0xbcf2('0x16'),_0x3dc94d,JSON['stringify'](_0x13ab26));_0x495c59(_0x13ab26);})[_0xbcf2('0x15')](function(_0x11b5fa){logger[_0xbcf2('0x12')](_0xbcf2('0x16'),_0x11b5fa['message'],_0x3dc94d);_0x5861d5(_0x291896[_0xbcf2('0x12')](0x1f4,_0x11b5fa[_0xbcf2('0x13')]));});});}; \ No newline at end of file +var _0x23f2=['raw','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','Plugin,\x20%s,\x20%s','message','result','CreatePlugin','Plugin','create','body','options'];(function(_0x79279c,_0x4e1671){var _0x3d0c5e=function(_0x2cc3a3){while(--_0x2cc3a3){_0x79279c['push'](_0x79279c['shift']());}};_0x3d0c5e(++_0x4e1671);}(_0x23f2,0x1a2));var _0x223f=function(_0x4ddb25,_0x1e23d9){_0x4ddb25=_0x4ddb25-0x0;var _0x575ab2=_0x23f2[_0x4ddb25];return _0x575ab2;};'use strict';var _=require(_0x223f('0x0'));var util=require(_0x223f('0x1'));var moment=require(_0x223f('0x2'));var BPromise=require('bluebird');var rs=require(_0x223f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x223f('0x4'));var logger=require('../../config/logger')(_0x223f('0x5'));var config=require(_0x223f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x223f('0x7')][_0x223f('0x8')]({'port':0x232a});config[_0x223f('0x9')]=_[_0x223f('0xa')](config[_0x223f('0x9')],{'host':_0x223f('0xb'),'port':0x18eb});var socket=require(_0x223f('0xc'))(new Redis(config['redis']));require(_0x223f('0xd'))[_0x223f('0xe')](socket);function respondWithRpcPromise(_0x5ae7e2,_0x139eae,_0x312109){return new BPromise(function(_0x1f0296,_0x323507){return client[_0x223f('0xf')](_0x5ae7e2,_0x312109)[_0x223f('0x10')](function(_0x17ce52){logger[_0x223f('0x11')]('Plugin,\x20%s,\x20%s',_0x139eae,_0x223f('0x12'));logger['debug'](_0x223f('0x13'),_0x139eae,_0x223f('0x12'),JSON[_0x223f('0x14')](_0x17ce52));if(_0x17ce52['error']){if(_0x17ce52[_0x223f('0x15')]['code']===0x1f4){logger[_0x223f('0x15')](_0x223f('0x16'),_0x139eae,_0x17ce52[_0x223f('0x15')][_0x223f('0x17')]);return _0x323507(_0x17ce52[_0x223f('0x15')][_0x223f('0x17')]);}logger[_0x223f('0x15')](_0x223f('0x16'),_0x139eae,_0x17ce52[_0x223f('0x15')][_0x223f('0x17')]);return _0x1f0296(_0x17ce52[_0x223f('0x15')][_0x223f('0x17')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x139eae,'request\x20sent');_0x1f0296(_0x17ce52[_0x223f('0x18')][_0x223f('0x17')]);}})['catch'](function(_0xf84fab){logger[_0x223f('0x15')]('Plugin,\x20%s,\x20%s',_0x139eae,_0xf84fab);_0x323507(_0xf84fab);});});}exports[_0x223f('0x19')]=function(_0x5198fb){var _0x51ec08=this;return new Promise(function(_0x1afac0,_0xb03ed0){return db[_0x223f('0x1a')][_0x223f('0x1b')](_0x5198fb[_0x223f('0x1c')],{'raw':_0x5198fb[_0x223f('0x1d')]?_0x5198fb[_0x223f('0x1d')][_0x223f('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x4fc400){logger[_0x223f('0x11')](_0x223f('0x19'),_0x5198fb);logger['debug'](_0x223f('0x19'),_0x5198fb,JSON[_0x223f('0x14')](_0x4fc400));_0x1afac0(_0x4fc400);})[_0x223f('0x1f')](function(_0x11d308){logger['error'](_0x223f('0x19'),_0x11d308['message'],_0x5198fb);_0xb03ed0(_0x51ec08[_0x223f('0x15')](0x1f4,_0x11d308['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 6fe85d8..5514ae6 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 _0xcc4a=['register','length','plugin:','./plugin.events','save','remove','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc4a,0x14c));var _0xacc4=function(_0x5c9ddf,_0x202e38){_0x5c9ddf=_0x5c9ddf-0x0;var _0x392b84=_0xcc4a[_0x5c9ddf];return _0x392b84;};'use strict';var PluginEvents=require(_0xacc4('0x0'));var events=[_0xacc4('0x1'),_0xacc4('0x2'),'update'];function createListener(_0xb6f1f,_0x1bec4c){return function(_0x521da6){_0x1bec4c['emit'](_0xb6f1f,_0x521da6);};}function removeListener(_0x4e9f0b,_0x311f56){return function(){PluginEvents[_0xacc4('0x3')](_0x4e9f0b,_0x311f56);};}exports[_0xacc4('0x4')]=function(_0x5f09ed){for(var _0x401d0b=0x0,_0x171ced=events[_0xacc4('0x5')];_0x401d0b<_0x171ced;_0x401d0b++){var _0x189719=events[_0x401d0b];var _0x268b69=createListener(_0xacc4('0x6')+_0x189719,_0x5f09ed);PluginEvents['on'](_0x189719,_0x268b69);}}; \ No newline at end of file +var _0x0121=['emit','removeListener','register','length','plugin:','save','remove','update'];(function(_0x7bb41b,_0x2ed7b8){var _0x3f321b=function(_0x3de9b9){while(--_0x3de9b9){_0x7bb41b['push'](_0x7bb41b['shift']());}};_0x3f321b(++_0x2ed7b8);}(_0x0121,0x1ed));var _0x1012=function(_0x2f0ff0,_0x36cae2){_0x2f0ff0=_0x2f0ff0-0x0;var _0x1cfc4a=_0x0121[_0x2f0ff0];return _0x1cfc4a;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x1012('0x0'),_0x1012('0x1'),_0x1012('0x2')];function createListener(_0x4bfaa8,_0x473adc){return function(_0x488d45){_0x473adc[_0x1012('0x3')](_0x4bfaa8,_0x488d45);};}function removeListener(_0x5620e2,_0xb2116d){return function(){PluginEvents[_0x1012('0x4')](_0x5620e2,_0xb2116d);};}exports[_0x1012('0x5')]=function(_0x216dd9){for(var _0x43a9e6=0x0,_0x279759=events[_0x1012('0x6')];_0x43a9e6<_0x279759;_0x43a9e6++){var _0x1adca8=events[_0x43a9e6];var _0x870cfd=createListener(_0x1012('0x7')+_0x1adca8,_0x216dd9);PluginEvents['on'](_0x1adca8,_0x870cfd);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 08ce5a9..17a4527 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(_0x37727b,_0x3f25f3){var _0xc7c4ec=function(_0x27cd1b){while(--_0x27cd1b){_0x37727b['push'](_0x37727b['shift']());}};_0xc7c4ec(++_0x3f25f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x49a354,_0x5297d4){var _0x4cdf0b=function(_0xe84f06){while(--_0xe84f06){_0x49a354['push'](_0x49a354['shift']());}};_0x4cdf0b(++_0x5297d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 6b2d993..1807a1e 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 _0x593e=['start','dump','update','stop','Unknown\x20status','destroy','params','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','index','list','motion2','length','then','catch','show','describe','create','body','script','../../files/plugins','cwd','dirname','chdir'];(function(_0x182e54,_0x239de3){var _0x314e33=function(_0x69d734){while(--_0x69d734){_0x182e54['push'](_0x182e54['shift']());}};_0x314e33(++_0x239de3);}(_0x593e,0xcb));var _0xe593=function(_0x14a883,_0x2eec0e){_0x14a883=_0x14a883-0x0;var _0x4f3b6b=_0x593e[_0x14a883];return _0x4f3b6b;};'use strict';var _=require(_0xe593('0x0'));var pm2=require(_0xe593('0x1'));var logger=require(_0xe593('0x2'))(_0xe593('0x3'));var path=require(_0xe593('0x4'));var exec=require(_0xe593('0x5'))[_0xe593('0x6')];var BPromise=require(_0xe593('0x7'));function handleEntityNotFound(_0x550574,_0x8a87e8){return function(_0x2475f5){if(!_0x2475f5){_0x550574[_0xe593('0x8')](0x194);;}return _0x2475f5;};}function respondWithResult(_0x1e50d3,_0x3b7082){_0x3b7082=_0x3b7082||0xc8;return function(_0x14cff3){if(_0x14cff3){return _0x1e50d3[_0xe593('0x9')](_0x3b7082)[_0xe593('0xa')](_0x14cff3);}return null;};}function handleError(_0x169c08,_0x265099){_0x265099=_0x265099||0x1f4;return function(_0x51b862){logger[_0xe593('0xb')](_0x51b862[_0xe593('0xc')]);if(_0x51b862[_0xe593('0xd')]){delete _0x51b862['name'];}_0x169c08['status'](_0x265099)[_0xe593('0xe')](_0x51b862);};}function execChildProcess(){return new BPromise(function(_0xeefe30,_0xaa42f7){exec('npm\x20install',function(_0x6a5d4f,_0x6bc1b8,_0x137f0b){logger[_0xe593('0xf')](_0x6bc1b8);logger[_0xe593('0xf')](_0x137f0b);if(_0x6a5d4f){logger[_0xe593('0xb')](_0x6a5d4f);return _0xaa42f7(_0x6a5d4f);}return _0xeefe30(_0x6bc1b8);});});}exports[_0xe593('0x10')]=function(_0xa4d5e9,_0x328a5a){return pm2[_0xe593('0x11')]()['then'](function(_0x2907e4){if(_0x2907e4){var _0x1de391=_['reject'](_0x2907e4,function(_0x38418c){return _0x38418c[_0xe593('0xd')]==='express'||_0x38418c[_0xe593('0xd')]===_0xe593('0x12');});return{'rows':_0x1de391,'count':_0x1de391[_0xe593('0x13')]};}return null;})[_0xe593('0x14')](respondWithResult(_0x328a5a,null))[_0xe593('0x15')](handleError(_0x328a5a,null));};exports[_0xe593('0x16')]=function(_0x48f3b4,_0xfbc79f){return pm2[_0xe593('0x17')](_0x48f3b4['params']['id'])[_0xe593('0x14')](respondWithResult(_0xfbc79f,null))[_0xe593('0x14')](handleEntityNotFound(_0xfbc79f,null))['catch'](handleError(_0xfbc79f,null));};exports[_0xe593('0x18')]=function(_0x3dba1b,_0x862672){if(_0x3dba1b[_0xe593('0x19')][_0xe593('0xd')]&&_0x3dba1b[_0xe593('0x19')][_0xe593('0x1a')]){var _0x4ea53f=path['join'](__dirname,_0xe593('0x1b'),_0x3dba1b['body']['script']);var _0x1bb8e8=process[_0xe593('0x1c')]();process['chdir'](path[_0xe593('0x1d')](_0x4ea53f));return execChildProcess()['then'](function(_0x1672bf){process[_0xe593('0x1e')](_0x1bb8e8);return pm2[_0xe593('0x1f')]({'name':_0x3dba1b[_0xe593('0x19')][_0xe593('0xd')],'script':_0x4ea53f});})[_0xe593('0x14')](function(_0x20a098){pm2[_0xe593('0x20')]();return _0x20a098[0x0];})['then'](respondWithResult(_0x862672,0xc9))[_0xe593('0x15')](handleError(_0x862672,null));}else{return _0x862672[_0xe593('0x9')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xe593('0x21')]=function(_0x25238f,_0x21eefc){if(_0x25238f[_0xe593('0x19')]['id']){delete _0x25238f[_0xe593('0x19')]['id'];}var _0x27a3d2={'online':'restart','stopped':_0xe593('0x22')};if(_0x27a3d2['hasOwnProperty'](_0x25238f[_0xe593('0x19')][_0xe593('0x9')])){return pm2[_0x27a3d2[_0x25238f['body'][_0xe593('0x9')]]](_0x25238f['params']['id'])[_0xe593('0x14')](respondWithResult(_0x21eefc,0xc8))[_0xe593('0x15')](handleError(_0x21eefc,null));}else{return _0x21eefc[_0xe593('0x9')](0x1f4)['send']({'message':_0xe593('0x23')});}};exports[_0xe593('0x24')]=function(_0x3066ed,_0x338222){if(_0x3066ed[_0xe593('0x19')]['id']){delete _0x3066ed[_0xe593('0x19')]['id'];}if(_0x3066ed[_0xe593('0x25')]['id']){return pm2['delete'](_0x3066ed[_0xe593('0x25')]['id'])[_0xe593('0x14')](function(_0x4e8448){pm2[_0xe593('0x20')]();return _0x4e8448[0x0];})['then'](respondWithResult(_0x338222,null))[_0xe593('0x15')](handleError(_0x338222,null));}else{return _0x338222[_0xe593('0x9')](0x1f4)[_0xe593('0xe')]({'message':_0xe593('0x26')});}}; \ No newline at end of file +var _0x4522=['length','then','catch','body','name','script','join','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','params','send','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','error','stack','npm\x20install','info','list','reject','express','motion2'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4522,0x1a0));var _0x2452=function(_0x35b44b,_0x2d33b8){_0x35b44b=_0x35b44b-0x0;var _0x1ccf6a=_0x4522[_0x35b44b];return _0x1ccf6a;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x2452('0x0'))(_0x2452('0x1'));var path=require(_0x2452('0x2'));var exec=require('child_process')[_0x2452('0x3')];var BPromise=require(_0x2452('0x4'));function handleEntityNotFound(_0x35e30a,_0x2f21dc){return function(_0x34ff44){if(!_0x34ff44){_0x35e30a[_0x2452('0x5')](0x194);;}return _0x34ff44;};}function respondWithResult(_0x15fc69,_0x226578){_0x226578=_0x226578||0xc8;return function(_0x2f0139){if(_0x2f0139){return _0x15fc69[_0x2452('0x6')](_0x226578)[_0x2452('0x7')](_0x2f0139);}return null;};}function handleError(_0x33b935,_0x24073f){_0x24073f=_0x24073f||0x1f4;return function(_0x365b1f){logger[_0x2452('0x8')](_0x365b1f[_0x2452('0x9')]);if(_0x365b1f['name']){delete _0x365b1f['name'];}_0x33b935[_0x2452('0x6')](_0x24073f)['send'](_0x365b1f);};}function execChildProcess(){return new BPromise(function(_0x4d665c,_0x2534bb){exec(_0x2452('0xa'),function(_0x1086ef,_0x3ad6c9,_0x1a7489){logger[_0x2452('0xb')](_0x3ad6c9);logger[_0x2452('0xb')](_0x1a7489);if(_0x1086ef){logger[_0x2452('0x8')](_0x1086ef);return _0x2534bb(_0x1086ef);}return _0x4d665c(_0x3ad6c9);});});}exports['index']=function(_0x529fb2,_0x5315ed){return pm2[_0x2452('0xc')]()['then'](function(_0x33e592){if(_0x33e592){var _0x506cd4=_[_0x2452('0xd')](_0x33e592,function(_0x42efdf){return _0x42efdf['name']===_0x2452('0xe')||_0x42efdf['name']===_0x2452('0xf');});return{'rows':_0x506cd4,'count':_0x506cd4[_0x2452('0x10')]};}return null;})[_0x2452('0x11')](respondWithResult(_0x5315ed,null))[_0x2452('0x12')](handleError(_0x5315ed,null));};exports['show']=function(_0x2108e4,_0x16e33a){return pm2['describe'](_0x2108e4['params']['id'])[_0x2452('0x11')](respondWithResult(_0x16e33a,null))[_0x2452('0x11')](handleEntityNotFound(_0x16e33a,null))[_0x2452('0x12')](handleError(_0x16e33a,null));};exports['create']=function(_0x914d2b,_0x467963){if(_0x914d2b[_0x2452('0x13')][_0x2452('0x14')]&&_0x914d2b[_0x2452('0x13')][_0x2452('0x15')]){var _0x3f48c2=path[_0x2452('0x16')](__dirname,'../../files/plugins',_0x914d2b['body'][_0x2452('0x15')]);var _0x32dfe7=process['cwd']();process[_0x2452('0x17')](path[_0x2452('0x18')](_0x3f48c2));return execChildProcess()[_0x2452('0x11')](function(_0x617ba7){process[_0x2452('0x17')](_0x32dfe7);return pm2[_0x2452('0x19')]({'name':_0x914d2b[_0x2452('0x13')]['name'],'script':_0x3f48c2});})[_0x2452('0x11')](function(_0x27d049){pm2[_0x2452('0x1a')]();return _0x27d049[0x0];})[_0x2452('0x11')](respondWithResult(_0x467963,0xc9))[_0x2452('0x12')](handleError(_0x467963,null));}else{return _0x467963['status'](0x1f4)['send']({'message':_0x2452('0x1b')});}};exports[_0x2452('0x1c')]=function(_0x46fcbb,_0x3a183c){if(_0x46fcbb[_0x2452('0x13')]['id']){delete _0x46fcbb['body']['id'];}var _0x3fba00={'online':_0x2452('0x1d'),'stopped':'stop'};if(_0x3fba00['hasOwnProperty'](_0x46fcbb[_0x2452('0x13')][_0x2452('0x6')])){return pm2[_0x3fba00[_0x46fcbb[_0x2452('0x13')][_0x2452('0x6')]]](_0x46fcbb[_0x2452('0x1e')]['id'])[_0x2452('0x11')](respondWithResult(_0x3a183c,0xc8))['catch'](handleError(_0x3a183c,null));}else{return _0x3a183c['status'](0x1f4)[_0x2452('0x1f')]({'message':_0x2452('0x20')});}};exports[_0x2452('0x21')]=function(_0x5c36aa,_0x2fb2ae){if(_0x5c36aa[_0x2452('0x13')]['id']){delete _0x5c36aa['body']['id'];}if(_0x5c36aa[_0x2452('0x1e')]['id']){return pm2[_0x2452('0x22')](_0x5c36aa[_0x2452('0x1e')]['id'])[_0x2452('0x11')](function(_0x334aba){pm2[_0x2452('0x1a')]();return _0x334aba[0x0];})[_0x2452('0x11')](respondWithResult(_0x2fb2ae,null))[_0x2452('0x12')](handleError(_0x2fb2ae,null));}else{return _0x2fb2ae[_0x2452('0x6')](0x1f4)[_0x2452('0x1f')]({'message':_0x2452('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index aecc306..4f13ea0 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 _0x5302=['exports','../../components/auth/service','./realtime.controller','isAuthenticated'];(function(_0x46ed43,_0x286814){var _0x4b5a9c=function(_0x559e2c){while(--_0x559e2c){_0x46ed43['push'](_0x46ed43['shift']());}};_0x4b5a9c(++_0x286814);}(_0x5302,0x1b5));var _0x2530=function(_0x48c19b,_0x3a1721){_0x48c19b=_0x48c19b-0x0;var _0x7b88f=_0x5302[_0x48c19b];return _0x7b88f;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x2530('0x0'));var controller=require(_0x2530('0x1'));router['get']('/queues',auth[_0x2530('0x2')](),controller['getQueues']);module[_0x2530('0x3')]=router; \ No newline at end of file +var _0x4f3d=['./realtime.controller','get','/queues','isAuthenticated','exports','express','../../components/auth/service'];(function(_0x2b7681,_0x31a940){var _0x338a7e=function(_0x34b725){while(--_0x34b725){_0x2b7681['push'](_0x2b7681['shift']());}};_0x338a7e(++_0x31a940);}(_0x4f3d,0x171));var _0xd4f3=function(_0x5d00cf,_0x45467a){_0x5d00cf=_0x5d00cf-0x0;var _0x50438a=_0x4f3d[_0x5d00cf];return _0x50438a;};'use strict';var express=require(_0xd4f3('0x0'));var router=express['Router']();var auth=require(_0xd4f3('0x1'));var controller=require(_0xd4f3('0x2'));router[_0xd4f3('0x3')](_0xd4f3('0x4'),auth[_0xd4f3('0x5')](),controller['getQueues']);module[_0xd4f3('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 2cd5cd3..72156bb 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 _0x4745=['count','limit','status','Content-Range','json','error','stack','name','send','getQueues','openchannel','fax','whatsapp','resolve','then','query','channel','includes','Invalid\x20channel','startCase','Queue','map','rawAttributes','fieldName','type','key','getOptions','user','voice','outbound','filter','getResources','findAndCountAll','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','paused','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','waiting','talking','find','merge','online','getMembers','UserId','agents','push','Pause','QueueId','User','agent','loggedInDb','all','catch','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','undefined','offset'];(function(_0x404ce2,_0x5675ad){var _0x20d521=function(_0x16a6e6){while(--_0x16a6e6){_0x404ce2['push'](_0x404ce2['shift']());}};_0x20d521(++_0x5675ad);}(_0x4745,0x1e7));var _0x5474=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x4745[_0x53cf8e];return _0x459197;};'use strict';var util=require(_0x5474('0x0'));var _=require(_0x5474('0x1'));var jayson=require(_0x5474('0x2'));var qs=require(_0x5474('0x3'));var logger=require(_0x5474('0x4'))(_0x5474('0x5'));var db=require(_0x5474('0x6'))['db'];var client=jayson[_0x5474('0x7')][_0x5474('0x8')]({'port':0x232a});var routingClient=jayson[_0x5474('0x7')][_0x5474('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x34f89b,_0x4e7ce7){return function(_0x3d1e1){if(_0x3d1e1){var _0x431f81=typeof _0x4e7ce7['offset']===_0x5474('0x9')&&typeof _0x4e7ce7['limit']===_0x5474('0x9');var _0x3c8860=_0x3d1e1['count'];var _0xf876f8=_0x431f81?0x0:_0x4e7ce7[_0x5474('0xa')];var _0x46b4b3=_0x431f81?_0x3d1e1[_0x5474('0xb')]:_0x4e7ce7[_0x5474('0xa')]+_0x4e7ce7[_0x5474('0xc')];var _0x3f729f;if(_0x46b4b3>=_0x3c8860){_0x46b4b3=_0x3c8860;_0x3f729f=0xc8;}else{_0x3f729f=0xce;}_0x34f89b[_0x5474('0xd')](_0x3f729f);return _0x34f89b['set'](_0x5474('0xe'),_0xf876f8+'-'+_0x46b4b3+'/'+_0x3c8860)[_0x5474('0xf')](_0x3d1e1);}return null;};}function handleError(_0xdc4c23,_0x12cd7f){_0x12cd7f=_0x12cd7f||0x1f4;return function(_0x10eac7){logger[_0x5474('0x10')](_0x10eac7[_0x5474('0x11')]);if(_0x10eac7[_0x5474('0x12')]){delete _0x10eac7[_0x5474('0x12')];}_0xdc4c23['status'](_0x12cd7f)[_0x5474('0x13')](_0x10eac7);};}exports[_0x5474('0x14')]=function(_0x2ce218,_0x1790eb){var _0x5a6353=['mail','chat','sms',_0x5474('0x15'),_0x5474('0x16'),_0x5474('0x17'),'voice'];var _0x3da004={'count':0x0,'rows':[]},_0x2be746={},_0x56dbfa;Promise[_0x5474('0x18')]()[_0x5474('0x19')](function(){if(_0x2ce218[_0x5474('0x1a')][_0x5474('0x1b')]){if(!_[_0x5474('0x1c')](_0x5a6353,_0x2ce218['query'][_0x5474('0x1b')]['toLowerCase']()))throw new Error(_0x5474('0x1d'));_0x56dbfa=_0x2ce218[_0x5474('0x1a')]['channel']['toLowerCase']();}var _0x563539=_[_0x5474('0x1e')](_0x56dbfa)+_0x5474('0x1f');var _0x475374=_[_0x5474('0x20')](db[_0x563539][_0x5474('0x21')],function(_0x24db35){return{'name':_0x24db35[_0x5474('0x22')],'type':_0x24db35[_0x5474('0x23')][_0x5474('0x24')]};});_0x2be746=qs[_0x5474('0x25')](_0x475374,_0x2ce218);if(_0x2ce218['user']['role']===_0x5474('0x26')){var _0x266465={'params':{'id':_0x2ce218[_0x5474('0x26')]['userProfileId']},'query':{'section':_0x56dbfa===_0x5474('0x27')&&_0x2ce218['query'][_0x5474('0x23')]===_0x5474('0x28')?'QueueCampaigns':_[_0x5474('0x1e')](_0x56dbfa)+'Queues','type':_0x2ce218[_0x5474('0x1a')]['type'],'nolimit':!![],'sort':_0x5474('0x12'),'filter':_0x2ce218[_0x5474('0x1a')][_0x5474('0x29')]}};return db['UserProfile'][_0x5474('0x2a')](_0x266465);}return db[_0x563539][_0x5474('0x2b')](_0x2be746);})['then'](function(_0x57731b){_0x3da004['count']=_0x57731b['count'];var _0x168dee=_0x56dbfa===_0x5474('0x27')?client:routingClient;return _0x168dee['request'](_[_0x5474('0x1e')](_0x56dbfa)+'Queues',_0x2ce218)[_0x5474('0x19')](function(_0x58f27a){if(_0x58f27a[_0x5474('0x10')])throw new Error(util['format'](_0x5474('0x2c'),_0x56dbfa));var _0x596221=_0x58f27a[_0x5474('0x2d')];var _0x46418e=[_0x5474('0x2e'),_0x5474('0x2f'),'waiting','talking',_0x5474('0x30')];if(_0x56dbfa===_0x5474('0x27')&&_0x2ce218[_0x5474('0x1a')][_0x5474('0x23')]==='outbound'){_0x46418e['push'](_0x5474('0x31'),_0x5474('0x32'),'message',_0x5474('0x33'),_0x5474('0x34'),_0x5474('0x35'),_0x5474('0x36'),'startProgressive',_0x5474('0x37'),_0x5474('0x38'),_0x5474('0x39'),'erlangBusyFactor',_0x5474('0x3a'),_0x5474('0x3b'),_0x5474('0x3c'),_0x5474('0x3d'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls',_0x5474('0x3e'),_0x5474('0x3f'),_0x5474('0x40'),_0x5474('0x41'));}var _0x5cca16=_0x57731b[_0x5474('0x42')][_0x5474('0x20')](function(_0x13b56b){var _0x22009e=_0x13b56b['get']({'plain':!![]});_0x22009e['paused']=0x0;_0x22009e['loggedInDb']=0x0;_0x22009e[_0x5474('0x2e')]=0x0;_0x22009e['available']=0x0;_0x22009e[_0x5474('0x30')]=0x0;_0x22009e[_0x5474('0x43')]=0x0;if(_0x56dbfa===_0x5474('0x27')){_0x22009e[_0x5474('0x44')]=0x0;if(_0x2ce218[_0x5474('0x1a')][_0x5474('0x23')]===_0x5474('0x28')){_0x22009e[_0x5474('0x31')]=0x0;_0x22009e[_0x5474('0x32')]=0x0;}}_0x22009e['agents']=[];var _0x15250c=_[_0x5474('0x45')](_0x596221[_0x5474('0x42')],['id',_0x22009e['id']]);if(_0x15250c)_[_0x5474('0x46')](_0x22009e,_['pick'](_0x15250c,_0x46418e));if(_0x56dbfa===_0x5474('0x27')){return _0x13b56b['getAgents']({'attributes':['id',_0x5474('0x12'),_0x5474('0x47')],'joinTableAttributes':[],'raw':!![]})['then'](function(_0x1f64fb){return _0x13b56b[_0x5474('0x48')]({'raw':!![]})['then'](function(_0x2d4b11){for(var _0x222d07=0x0;_0x222d07<_0x1f64fb['length'];_0x222d07++){var _0x24692d=_['find'](_0x2d4b11,[_0x5474('0x49'),_0x1f64fb[_0x222d07]['id']]);var _0x291999={'id':_0x1f64fb[_0x222d07]['id'],'name':_0x1f64fb[_0x222d07]['name'],'online':Boolean(_0x1f64fb[_0x222d07][_0x5474('0x47')]),'paused':_0x24692d?Boolean(_0x24692d[_0x5474('0x30')]):![]};if(_0x291999[_0x5474('0x47')])_0x22009e['loggedInDb']++;if(_0x291999[_0x5474('0x30')])_0x22009e[_0x5474('0x30')]++;_0x22009e[_0x5474('0x4a')][_0x5474('0x4b')](_0x291999);}return _0x22009e;});});}else{var _0x5a8fae='User'+_[_0x5474('0x1e')](_0x56dbfa)+'Queue';var _0x180eba=_0x56dbfa+_0x5474('0x4c');return db[_0x5a8fae]['findAll']({'where':{[_[_0x5474('0x1e')](_0x56dbfa)+_0x5474('0x4d')]:_0x13b56b['id']},'raw':!![]})['then'](function(_0x2db201){return db[_0x5474('0x4e')]['findAll']({'attributes':['id','name',_0x5474('0x47'),_0x180eba],'where':{'id':_[_0x5474('0x20')](_0x2db201,'UserId'),'role':_0x5474('0x4f')},'raw':!![]});})[_0x5474('0x19')](function(_0x14f4d3){for(var _0x46bde7=0x0;_0x46bde7<_0x14f4d3['length'];_0x46bde7++){var _0x1b423c={'id':_0x14f4d3[_0x46bde7]['id'],'name':_0x14f4d3[_0x46bde7][_0x5474('0x12')],'online':Boolean(_0x14f4d3[_0x46bde7]['online']),'paused':Boolean(_0x14f4d3[_0x46bde7][_0x180eba])};if(_0x1b423c[_0x5474('0x47')])_0x22009e[_0x5474('0x50')]++;if(_0x1b423c[_0x5474('0x30')])_0x22009e[_0x5474('0x30')]++;_0x22009e[_0x5474('0x4a')][_0x5474('0x4b')](_0x1b423c);}return _0x22009e;});}});return Promise[_0x5474('0x51')](_0x5cca16);});})[_0x5474('0x19')](function(_0x4327d9){_0x3da004[_0x5474('0x42')]=_0x4327d9;return _0x3da004;})[_0x5474('0x19')](respondWithFilteredResult(_0x1790eb,_0x2be746))[_0x5474('0x52')](handleError(_0x1790eb,null));}; \ No newline at end of file +var _0x7046=['fieldName','type','key','user','role','userProfileId','outbound','QueueCampaigns','Queues','filter','UserProfile','findAndCountAll','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','waiting','talking','paused','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','map','loggedInDb','agents','find','merge','pick','online','getMembers','UserId','User','Pause','findAll','agent','length','all','util','lodash','jayson/promise','../../components/parsers/qs','api','../../mysqldb','client','http','offset','undefined','count','limit','status','Content-Range','json','error','stack','name','send','getQueues','mail','sms','openchannel','fax','whatsapp','voice','resolve','then','query','includes','channel','toLowerCase','Invalid\x20channel','startCase','Queue','rawAttributes'];(function(_0x1cb86d,_0x202738){var _0x4130c3=function(_0xa77dec){while(--_0xa77dec){_0x1cb86d['push'](_0x1cb86d['shift']());}};_0x4130c3(++_0x202738);}(_0x7046,0x144));var _0x6704=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7046[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0x6704('0x0'));var _=require(_0x6704('0x1'));var jayson=require(_0x6704('0x2'));var qs=require(_0x6704('0x3'));var logger=require('../../config/logger')(_0x6704('0x4'));var db=require(_0x6704('0x5'))['db'];var client=jayson[_0x6704('0x6')]['http']({'port':0x232a});var routingClient=jayson[_0x6704('0x6')][_0x6704('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x3f4169,_0x626a14){return function(_0x2917be){if(_0x2917be){var _0x4badf8=typeof _0x626a14[_0x6704('0x8')]==='undefined'&&typeof _0x626a14['limit']===_0x6704('0x9');var _0x510221=_0x2917be['count'];var _0x3ca599=_0x4badf8?0x0:_0x626a14[_0x6704('0x8')];var _0x37a1ad=_0x4badf8?_0x2917be[_0x6704('0xa')]:_0x626a14[_0x6704('0x8')]+_0x626a14[_0x6704('0xb')];var _0x3dfda4;if(_0x37a1ad>=_0x510221){_0x37a1ad=_0x510221;_0x3dfda4=0xc8;}else{_0x3dfda4=0xce;}_0x3f4169[_0x6704('0xc')](_0x3dfda4);return _0x3f4169['set'](_0x6704('0xd'),_0x3ca599+'-'+_0x37a1ad+'/'+_0x510221)[_0x6704('0xe')](_0x2917be);}return null;};}function handleError(_0x575aa6,_0x2feb52){_0x2feb52=_0x2feb52||0x1f4;return function(_0x1db0ad){logger[_0x6704('0xf')](_0x1db0ad[_0x6704('0x10')]);if(_0x1db0ad[_0x6704('0x11')]){delete _0x1db0ad[_0x6704('0x11')];}_0x575aa6[_0x6704('0xc')](_0x2feb52)[_0x6704('0x12')](_0x1db0ad);};}exports[_0x6704('0x13')]=function(_0x49048f,_0x168258){var _0x1752bc=[_0x6704('0x14'),'chat',_0x6704('0x15'),_0x6704('0x16'),_0x6704('0x17'),_0x6704('0x18'),_0x6704('0x19')];var _0x5adb35={'count':0x0,'rows':[]},_0x1e5f6e={},_0x31d732;Promise[_0x6704('0x1a')]()[_0x6704('0x1b')](function(){if(_0x49048f[_0x6704('0x1c')]['channel']){if(!_[_0x6704('0x1d')](_0x1752bc,_0x49048f[_0x6704('0x1c')][_0x6704('0x1e')][_0x6704('0x1f')]()))throw new Error(_0x6704('0x20'));_0x31d732=_0x49048f[_0x6704('0x1c')][_0x6704('0x1e')]['toLowerCase']();}var _0x1df6d7=_[_0x6704('0x21')](_0x31d732)+_0x6704('0x22');var _0x59dc43=_['map'](db[_0x1df6d7][_0x6704('0x23')],function(_0x3e183b){return{'name':_0x3e183b[_0x6704('0x24')],'type':_0x3e183b[_0x6704('0x25')][_0x6704('0x26')]};});_0x1e5f6e=qs['getOptions'](_0x59dc43,_0x49048f);if(_0x49048f[_0x6704('0x27')][_0x6704('0x28')]===_0x6704('0x27')){var _0x348fcb={'params':{'id':_0x49048f[_0x6704('0x27')][_0x6704('0x29')]},'query':{'section':_0x31d732===_0x6704('0x19')&&_0x49048f[_0x6704('0x1c')][_0x6704('0x25')]===_0x6704('0x2a')?_0x6704('0x2b'):_[_0x6704('0x21')](_0x31d732)+_0x6704('0x2c'),'type':_0x49048f['query']['type'],'nolimit':!![],'sort':_0x6704('0x11'),'filter':_0x49048f[_0x6704('0x1c')][_0x6704('0x2d')]}};return db[_0x6704('0x2e')]['getResources'](_0x348fcb);}return db[_0x1df6d7][_0x6704('0x2f')](_0x1e5f6e);})[_0x6704('0x1b')](function(_0x5c229d){_0x5adb35['count']=_0x5c229d[_0x6704('0xa')];var _0x5363c9=_0x31d732===_0x6704('0x19')?client:routingClient;return _0x5363c9['request'](_['startCase'](_0x31d732)+_0x6704('0x2c'),_0x49048f)[_0x6704('0x1b')](function(_0x45a286){if(_0x45a286['error'])throw new Error(util[_0x6704('0x30')](_0x6704('0x31'),_0x31d732));var _0x3c8263=_0x45a286[_0x6704('0x32')];var _0x920914=[_0x6704('0x33'),_0x6704('0x34'),_0x6704('0x35'),_0x6704('0x36'),_0x6704('0x37')];if(_0x31d732===_0x6704('0x19')&&_0x49048f[_0x6704('0x1c')][_0x6704('0x25')]===_0x6704('0x2a')){_0x920914[_0x6704('0x38')](_0x6704('0x39'),_0x6704('0x3a'),_0x6704('0x3b'),_0x6704('0x3c'),_0x6704('0x3d'),_0x6704('0x3e'),_0x6704('0x3f'),_0x6704('0x40'),_0x6704('0x41'),_0x6704('0x42'),'erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval',_0x6704('0x43'),_0x6704('0x44'),_0x6704('0x45'),'predictiveIntervalTotalCalls',_0x6704('0x46'),'predictiveIntervalDroppedCallsTimeout',_0x6704('0x47'),_0x6704('0x48'),_0x6704('0x49'));}var _0x18a118=_0x5c229d[_0x6704('0x4a')][_0x6704('0x4b')](function(_0x39d92c){var _0x2fba31=_0x39d92c['get']({'plain':!![]});_0x2fba31['paused']=0x0;_0x2fba31[_0x6704('0x4c')]=0x0;_0x2fba31[_0x6704('0x33')]=0x0;_0x2fba31['available']=0x0;_0x2fba31['paused']=0x0;_0x2fba31[_0x6704('0x35')]=0x0;if(_0x31d732==='voice'){_0x2fba31[_0x6704('0x36')]=0x0;if(_0x49048f[_0x6704('0x1c')][_0x6704('0x25')]===_0x6704('0x2a')){_0x2fba31['pTalking']=0x0;_0x2fba31[_0x6704('0x3a')]=0x0;}}_0x2fba31[_0x6704('0x4d')]=[];var _0x5630b7=_[_0x6704('0x4e')](_0x3c8263['rows'],['id',_0x2fba31['id']]);if(_0x5630b7)_[_0x6704('0x4f')](_0x2fba31,_[_0x6704('0x50')](_0x5630b7,_0x920914));if(_0x31d732===_0x6704('0x19')){return _0x39d92c['getAgents']({'attributes':['id',_0x6704('0x11'),_0x6704('0x51')],'joinTableAttributes':[],'raw':!![]})[_0x6704('0x1b')](function(_0x5c04fe){return _0x39d92c[_0x6704('0x52')]({'raw':!![]})[_0x6704('0x1b')](function(_0x336ef2){for(var _0xf12c3f=0x0;_0xf12c3f<_0x5c04fe['length'];_0xf12c3f++){var _0x29ad03=_['find'](_0x336ef2,[_0x6704('0x53'),_0x5c04fe[_0xf12c3f]['id']]);var _0x45a217={'id':_0x5c04fe[_0xf12c3f]['id'],'name':_0x5c04fe[_0xf12c3f][_0x6704('0x11')],'online':Boolean(_0x5c04fe[_0xf12c3f][_0x6704('0x51')]),'paused':_0x29ad03?Boolean(_0x29ad03['paused']):![]};if(_0x45a217['online'])_0x2fba31['loggedInDb']++;if(_0x45a217[_0x6704('0x37')])_0x2fba31['paused']++;_0x2fba31[_0x6704('0x4d')]['push'](_0x45a217);}return _0x2fba31;});});}else{var _0x3e8e48=_0x6704('0x54')+_['startCase'](_0x31d732)+_0x6704('0x22');var _0x19ddb9=_0x31d732+_0x6704('0x55');return db[_0x3e8e48][_0x6704('0x56')]({'where':{[_[_0x6704('0x21')](_0x31d732)+'QueueId']:_0x39d92c['id']},'raw':!![]})[_0x6704('0x1b')](function(_0x4ff7a8){return db[_0x6704('0x54')][_0x6704('0x56')]({'attributes':['id',_0x6704('0x11'),'online',_0x19ddb9],'where':{'id':_[_0x6704('0x4b')](_0x4ff7a8,'UserId'),'role':_0x6704('0x57')},'raw':!![]});})[_0x6704('0x1b')](function(_0x2ee518){for(var _0x207595=0x0;_0x207595<_0x2ee518[_0x6704('0x58')];_0x207595++){var _0x50f5da={'id':_0x2ee518[_0x207595]['id'],'name':_0x2ee518[_0x207595][_0x6704('0x11')],'online':Boolean(_0x2ee518[_0x207595][_0x6704('0x51')]),'paused':Boolean(_0x2ee518[_0x207595][_0x19ddb9])};if(_0x50f5da['online'])_0x2fba31[_0x6704('0x4c')]++;if(_0x50f5da[_0x6704('0x37')])_0x2fba31[_0x6704('0x37')]++;_0x2fba31[_0x6704('0x4d')][_0x6704('0x38')](_0x50f5da);}return _0x2fba31;});}});return Promise[_0x6704('0x59')](_0x18a118);});})['then'](function(_0x237f59){_0x5adb35['rows']=_0x237f59;return _0x5adb35;})[_0x6704('0x1b')](respondWithFilteredResult(_0x168258,_0x1e5f6e))['catch'](handleError(_0x168258,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 6ea70d7..c4cde5f 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(_0x7d41fa,_0x15aa0b){var _0x440b11=function(_0x534919){while(--_0x534919){_0x7d41fa['push'](_0x7d41fa['shift']());}};_0x440b11(++_0x15aa0b);}(_0xe706,0xa3));var _0x6e70=function(_0x1135b1,_0x644ab2){_0x1135b1=_0x1135b1-0x0;var _0x387f6b=_0xe706[_0x1135b1];return _0x387f6b;};'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(_0x54caab,_0x13105f){var _0x490ed6=function(_0x2aafdf){while(--_0x2aafdf){_0x54caab['push'](_0x54caab['shift']());}};_0x490ed6(++_0x13105f);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 82028f5..b06e170 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 _0xc9b9=['INTEGER','STRING','DATE'];(function(_0x238480,_0x28eb64){var _0x3b435d=function(_0x2407c7){while(--_0x2407c7){_0x238480['push'](_0x238480['shift']());}};_0x3b435d(++_0x28eb64);}(_0xc9b9,0x18f));var _0x9c9b=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0xc9b9[_0x3e8cae];return _0x45c4d6;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x9c9b('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x9c9b('0x1')]},'scheduledat':{'type':Sequelize[_0x9c9b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9c9b('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x14f5=['DATE','INTEGER','exports','STRING'];(function(_0x1501d7,_0x2c6b1e){var _0x1e06c5=function(_0x160951){while(--_0x160951){_0x1501d7['push'](_0x1501d7['shift']());}};_0x1e06c5(++_0x2c6b1e);}(_0x14f5,0xae));var _0x514f=function(_0x56ac6c,_0x472c9b){_0x56ac6c=_0x56ac6c-0x0;var _0x4fb5ec=_0x14f5[_0x56ac6c];return _0x4fb5ec;};'use strict';var Sequelize=require('sequelize');module[_0x514f('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x514f('0x1')]},'scheduledat':{'type':Sequelize[_0x514f('0x2')]},'uniqueid':{'type':Sequelize[_0x514f('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x514f('0x2')]},'ringtime':{'type':Sequelize[_0x514f('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x514f('0x1')]},'membername':{'type':Sequelize[_0x514f('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 4d38aed..9b04537 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 _0xdce9=['bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','../../config/logger','api','moment'];(function(_0xb2e670,_0x436e56){var _0x598b6b=function(_0x5ecdd8){while(--_0x5ecdd8){_0xb2e670['push'](_0xb2e670['shift']());}};_0x598b6b(++_0x436e56);}(_0xdce9,0x182));var _0x9dce=function(_0x4fede9,_0x495738){_0x4fede9=_0x4fede9-0x0;var _0x32adb4=_0xdce9[_0x4fede9];return _0x32adb4;};'use strict';var _=require(_0x9dce('0x0'));var util=require('util');var logger=require(_0x9dce('0x1'))(_0x9dce('0x2'));var moment=require(_0x9dce('0x3'));var BPromise=require(_0x9dce('0x4'));var rp=require(_0x9dce('0x5'));var fs=require('fs');var path=require(_0x9dce('0x6'));var rimraf=require(_0x9dce('0x7'));var config=require(_0x9dce('0x8'));var attributes=require(_0x9dce('0x9'));module[_0x9dce('0xa')]=function(_0x26f0ce,_0x3209ec){return _0x26f0ce[_0x9dce('0xb')]('ReportAgentPreview',attributes,{'tableName':_0x9dce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbe7=['path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','../../config/logger','api','moment','bluebird'];(function(_0x2f6799,_0x4e7f00){var _0x3cb26f=function(_0x3c5a3d){while(--_0x3c5a3d){_0x2f6799['push'](_0x2f6799['shift']());}};_0x3cb26f(++_0x4e7f00);}(_0xcbe7,0x1f4));var _0x7cbe=function(_0x11d2f7,_0x182c56){_0x11d2f7=_0x11d2f7-0x0;var _0x15ecc2=_0xcbe7[_0x11d2f7];return _0x15ecc2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7cbe('0x0'))(_0x7cbe('0x1'));var moment=require(_0x7cbe('0x2'));var BPromise=require(_0x7cbe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cbe('0x4'));var rimraf=require(_0x7cbe('0x5'));var config=require(_0x7cbe('0x6'));var attributes=require(_0x7cbe('0x7'));module[_0x7cbe('0x8')]=function(_0x2f0bd3,_0x5d8709){return _0x2f0bd3[_0x7cbe('0x9')](_0x7cbe('0xa'),attributes,{'tableName':_0x7cbe('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 6d7398b..d2213a2 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 _0x2a03=['catch','ReportAgentPreview','create','body','options','CreateReportAgentPreview','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','client','http','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2a03,0xf6));var _0x32a0=function(_0x169ca0,_0x48d215){_0x169ca0=_0x169ca0-0x0;var _0x2ce4df=_0x2a03[_0x169ca0];return _0x2ce4df;};'use strict';var _=require(_0x32a0('0x0'));var util=require(_0x32a0('0x1'));var moment=require('moment');var BPromise=require(_0x32a0('0x2'));var rs=require(_0x32a0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x32a0('0x4'))('rpc');var config=require(_0x32a0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x32a0('0x6')][_0x32a0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x41e797,_0x314347,_0x2513e3){return new BPromise(function(_0x198054,_0x4b4555){return client['request'](_0x41e797,_0x2513e3)[_0x32a0('0x8')](function(_0x5a63d9){logger['info'](_0x32a0('0x9'),_0x314347,_0x32a0('0xa'));logger[_0x32a0('0xb')](_0x32a0('0xc'),_0x314347,_0x32a0('0xa'),JSON[_0x32a0('0xd')](_0x5a63d9));if(_0x5a63d9[_0x32a0('0xe')]){if(_0x5a63d9['error'][_0x32a0('0xf')]===0x1f4){logger[_0x32a0('0xe')](_0x32a0('0x9'),_0x314347,_0x5a63d9[_0x32a0('0xe')][_0x32a0('0x10')]);return _0x4b4555(_0x5a63d9[_0x32a0('0xe')][_0x32a0('0x10')]);}logger[_0x32a0('0xe')](_0x32a0('0x9'),_0x314347,_0x5a63d9[_0x32a0('0xe')][_0x32a0('0x10')]);return _0x198054(_0x5a63d9[_0x32a0('0xe')][_0x32a0('0x10')]);}else{logger[_0x32a0('0x11')](_0x32a0('0x9'),_0x314347,'request\x20sent');_0x198054(_0x5a63d9['result'][_0x32a0('0x10')]);}})[_0x32a0('0x12')](function(_0x531bf7){logger[_0x32a0('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x314347,_0x531bf7);_0x4b4555(_0x531bf7);});});}exports['CreateReportAgentPreview']=function(_0x50907f){var _0x372904=this;return new Promise(function(_0x4e4016,_0xac2c10){return db[_0x32a0('0x13')][_0x32a0('0x14')](_0x50907f[_0x32a0('0x15')],{'raw':_0x50907f[_0x32a0('0x16')]?_0x50907f[_0x32a0('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x37a9a6){logger['info']('CreateReportAgentPreview',_0x50907f);logger[_0x32a0('0xb')](_0x32a0('0x17'),_0x50907f,JSON['stringify'](_0x37a9a6));_0x4e4016(_0x37a9a6);})[_0x32a0('0x12')](function(_0xdb85e5){logger[_0x32a0('0xe')](_0x32a0('0x17'),_0xdb85e5[_0x32a0('0x10')],_0x50907f);_0xac2c10(_0x372904['error'](0x1f4,_0xdb85e5[_0x32a0('0x10')]));});});}; \ No newline at end of file +var _0x4ac9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options'];(function(_0x519cf5,_0x2e2c2c){var _0xb36a78=function(_0x1516f6){while(--_0x1516f6){_0x519cf5['push'](_0x519cf5['shift']());}};_0xb36a78(++_0x2e2c2c);}(_0x4ac9,0x9c));var _0x94ac=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x4ac9[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x94ac('0x0'));var BPromise=require(_0x94ac('0x1'));var rs=require(_0x94ac('0x2'));var fs=require('fs');var Redis=require(_0x94ac('0x3'));var db=require(_0x94ac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x94ac('0x5'))(_0x94ac('0x6'));var config=require(_0x94ac('0x7'));var jayson=require(_0x94ac('0x8'));var client=jayson['client'][_0x94ac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46c2f9,_0x350b2f,_0x166227){return new BPromise(function(_0x3eaf31,_0x1fc44b){return client[_0x94ac('0xa')](_0x46c2f9,_0x166227)[_0x94ac('0xb')](function(_0x3e817e){logger[_0x94ac('0xc')](_0x94ac('0xd'),_0x350b2f,'request\x20sent');logger[_0x94ac('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x350b2f,_0x94ac('0xf'),JSON[_0x94ac('0x10')](_0x3e817e));if(_0x3e817e[_0x94ac('0x11')]){if(_0x3e817e[_0x94ac('0x11')][_0x94ac('0x12')]===0x1f4){logger[_0x94ac('0x11')](_0x94ac('0xd'),_0x350b2f,_0x3e817e[_0x94ac('0x11')][_0x94ac('0x13')]);return _0x1fc44b(_0x3e817e[_0x94ac('0x11')][_0x94ac('0x13')]);}logger[_0x94ac('0x11')](_0x94ac('0xd'),_0x350b2f,_0x3e817e['error'][_0x94ac('0x13')]);return _0x3eaf31(_0x3e817e[_0x94ac('0x11')][_0x94ac('0x13')]);}else{logger[_0x94ac('0xc')](_0x94ac('0xd'),_0x350b2f,_0x94ac('0xf'));_0x3eaf31(_0x3e817e[_0x94ac('0x14')][_0x94ac('0x13')]);}})['catch'](function(_0x4ca6b9){logger[_0x94ac('0x11')](_0x94ac('0xd'),_0x350b2f,_0x4ca6b9);_0x1fc44b(_0x4ca6b9);});});}exports[_0x94ac('0x15')]=function(_0x45009c){var _0xdcb175=this;return new Promise(function(_0x42b2e9,_0x56b030){return db[_0x94ac('0x16')][_0x94ac('0x17')](_0x45009c[_0x94ac('0x18')],{'raw':_0x45009c[_0x94ac('0x19')]?_0x45009c[_0x94ac('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x458521){logger[_0x94ac('0xc')]('CreateReportAgentPreview',_0x45009c);logger[_0x94ac('0xe')](_0x94ac('0x15'),_0x45009c,JSON[_0x94ac('0x10')](_0x458521));_0x42b2e9(_0x458521);})['catch'](function(_0x4e60ee){logger[_0x94ac('0x11')]('CreateReportAgentPreview',_0x4e60ee[_0x94ac('0x13')],_0x45009c);_0x56b030(_0xdcb175[_0x94ac('0x11')](0x1f4,_0x4e60ee[_0x94ac('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 9c8f0c0..7c189fb 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 _0xfe51=['mailAccounts','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','outbound','outboundChannels','/agents','agents','put','agentCapacity','/telephones','telephones','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','/mail/accounts'];(function(_0x58450c,_0x42e716){var _0x44821d=function(_0x5d2c6c){while(--_0x5d2c6c){_0x58450c['push'](_0x58450c['shift']());}};_0x44821d(++_0x42e716);}(_0xfe51,0x173));var _0x1fe5=function(_0x5bda50,_0x1375ac){_0x5bda50=_0x5bda50-0x0;var _0x8916c7=_0xfe51[_0x5bda50];return _0x8916c7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1fe5('0x0'));var express=require(_0x1fe5('0x1'));var router=express[_0x1fe5('0x2')]();var auth=require(_0x1fe5('0x3'));var controller=require(_0x1fe5('0x4'));router[_0x1fe5('0x5')](_0x1fe5('0x6'),auth[_0x1fe5('0x7')](),controller['voiceChannels']);router[_0x1fe5('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x8')]);router['get'](_0x1fe5('0x9'),auth[_0x1fe5('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0x1fe5('0x5')](_0x1fe5('0xa'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0xb')]);router[_0x1fe5('0x5')](_0x1fe5('0xc'),auth['isAuthenticated'](),controller['chatQueues']);router[_0x1fe5('0x5')]('/mail/queues',auth['isAuthenticated'](),controller['mailQueues']);router[_0x1fe5('0x5')](_0x1fe5('0xd'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0xe')]);router['get']('/openchannel/queues',auth[_0x1fe5('0x7')](),controller[_0x1fe5('0xf')]);router[_0x1fe5('0x5')](_0x1fe5('0x10'),auth[_0x1fe5('0x7')](),controller['smsQueues']);router[_0x1fe5('0x5')](_0x1fe5('0x11'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x12')]);router[_0x1fe5('0x5')](_0x1fe5('0x13'),auth['isAuthenticated'](),controller['faxQueues']);router[_0x1fe5('0x5')]('/voice/queues/preview/:id',auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x14')]);router['get'](_0x1fe5('0x15'),auth[_0x1fe5('0x7')](),controller['voiceQueuesChannels']);router[_0x1fe5('0x5')](_0x1fe5('0x16'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x17')]);router[_0x1fe5('0x5')](_0x1fe5('0x18'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x19')]);router[_0x1fe5('0x5')](_0x1fe5('0x1a'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0x1fe5('0x5')](_0x1fe5('0x1b'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x1c')]);router['put'](_0x1fe5('0x1b'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x1d')]);router[_0x1fe5('0x5')]('/outbound',auth['isAuthenticated'](),controller[_0x1fe5('0x1e')]);router[_0x1fe5('0x5')]('/outbound/channels',auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x1f')]);router['get'](_0x1fe5('0x20'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x21')]);router[_0x1fe5('0x22')]('/agents/:id/capacity',auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x23')]);router[_0x1fe5('0x5')](_0x1fe5('0x24'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x25')]);router['get']('/trunks',auth[_0x1fe5('0x7')](),controller['trunks']);router[_0x1fe5('0x5')](_0x1fe5('0x26'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x27')]);router[_0x1fe5('0x5')](_0x1fe5('0x28'),auth[_0x1fe5('0x7')](),controller['faxAccounts']);router['get'](_0x1fe5('0x29'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x2a')]);router[_0x1fe5('0x5')](_0x1fe5('0x2b'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x2c')]);router[_0x1fe5('0x5')](_0x1fe5('0x2d'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x2e')]);router[_0x1fe5('0x5')](_0x1fe5('0x2f'),auth['isAuthenticated'](),controller[_0x1fe5('0x30')]);router['get'](_0x1fe5('0x31'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x32')]);router['get'](_0x1fe5('0x33'),auth[_0x1fe5('0x7')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0x1fe5('0x34'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x35')]);router[_0x1fe5('0x36')]('/mail/queues/:id/notify',auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x37')](_0x1fe5('0x38')));router[_0x1fe5('0x5')](_0x1fe5('0x39'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x3a')]);router[_0x1fe5('0x36')](_0x1fe5('0x3b'),auth[_0x1fe5('0x7')](),controller['queueNotify'](_0x1fe5('0x3c')));router[_0x1fe5('0x5')](_0x1fe5('0x3d'),auth['isAuthenticated'](),controller[_0x1fe5('0x3e')]);router[_0x1fe5('0x36')](_0x1fe5('0x3f'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x37')](_0x1fe5('0x40')));router['get']('/fax/queues/:id',auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x41')]);router[_0x1fe5('0x36')]('/openchannel/queues/:id/notify',auth[_0x1fe5('0x7')](),controller['queueNotify'](_0x1fe5('0x42')));router[_0x1fe5('0x5')](_0x1fe5('0x43'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x44')]);router['post'](_0x1fe5('0x45'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x37')]('sms'));router[_0x1fe5('0x36')](_0x1fe5('0x46'),auth[_0x1fe5('0x7')](),controller['queueNotify'](_0x1fe5('0x47')));router['get'](_0x1fe5('0x48'),auth['isAuthenticated'](),controller[_0x1fe5('0x49')]);router['get'](_0x1fe5('0x4a'),auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x4b')]);router[_0x1fe5('0x36')]('/agents/:id/notify',auth[_0x1fe5('0x7')](),controller[_0x1fe5('0x4c')]);module['exports']=router; \ No newline at end of file +var _0xaca6=['showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels','/agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','openchannel','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id'];(function(_0x28660a,_0x1672b5){var _0x458fa9=function(_0x2ff4e7){while(--_0x2ff4e7){_0x28660a['push'](_0x28660a['shift']());}};_0x458fa9(++_0x1672b5);}(_0xaca6,0x136));var _0x6aca=function(_0x12c1c7,_0x441f14){_0x12c1c7=_0x12c1c7-0x0;var _0x4cf7be=_0xaca6[_0x12c1c7];return _0x4cf7be;};'use strict';var multer=require(_0x6aca('0x0'));var util=require(_0x6aca('0x1'));var path=require(_0x6aca('0x2'));var express=require(_0x6aca('0x3'));var router=express[_0x6aca('0x4')]();var auth=require(_0x6aca('0x5'));var controller=require('./rpc.controller');router[_0x6aca('0x6')](_0x6aca('0x7'),auth['isAuthenticated'](),controller[_0x6aca('0x8')]);router[_0x6aca('0x6')](_0x6aca('0x9'),auth[_0x6aca('0xa')](),controller[_0x6aca('0xb')]);router[_0x6aca('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0x6aca('0x6')](_0x6aca('0xc'),auth[_0x6aca('0xa')](),controller[_0x6aca('0xd')]);router[_0x6aca('0x6')](_0x6aca('0xe'),auth[_0x6aca('0xa')](),controller['chatQueues']);router[_0x6aca('0x6')](_0x6aca('0xf'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x10')]);router['get'](_0x6aca('0x11'),auth[_0x6aca('0xa')](),controller['mailAccounts']);router['get'](_0x6aca('0x12'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x13')]);router[_0x6aca('0x6')](_0x6aca('0x14'),auth[_0x6aca('0xa')](),controller['smsQueues']);router['get'](_0x6aca('0x15'),auth['isAuthenticated'](),controller[_0x6aca('0x16')]);router[_0x6aca('0x6')](_0x6aca('0x17'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x18')]);router[_0x6aca('0x6')](_0x6aca('0x19'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x1a')]);router[_0x6aca('0x6')](_0x6aca('0x1b'),auth['isAuthenticated'](),controller[_0x6aca('0x1c')]);router[_0x6aca('0x6')](_0x6aca('0x1d'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x1e')]);router[_0x6aca('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x6aca('0x1f')]);router[_0x6aca('0x6')](_0x6aca('0x20'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x21')]);router[_0x6aca('0x6')](_0x6aca('0x22'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x23')]);router['put']('/voice/queues/:id',auth[_0x6aca('0xa')](),controller[_0x6aca('0x24')]);router[_0x6aca('0x6')](_0x6aca('0x25'),auth['isAuthenticated'](),controller['outbound']);router['get'](_0x6aca('0x26'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x27')]);router[_0x6aca('0x6')](_0x6aca('0x28'),auth[_0x6aca('0xa')](),controller['agents']);router[_0x6aca('0x29')](_0x6aca('0x2a'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x2b')]);router[_0x6aca('0x6')](_0x6aca('0x2c'),auth['isAuthenticated'](),controller[_0x6aca('0x2d')]);router[_0x6aca('0x6')](_0x6aca('0x2e'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x2f')]);router[_0x6aca('0x6')]('/campaigns',auth[_0x6aca('0xa')](),controller['campaigns']);router['get']('/fax/accounts',auth['isAuthenticated'](),controller['faxAccounts']);router[_0x6aca('0x6')](_0x6aca('0x30'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x31')]);router[_0x6aca('0x6')](_0x6aca('0x32'),auth[_0x6aca('0xa')](),controller['mailQueuesWaitingInteractions']);router['get'](_0x6aca('0x33'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x34')]);router[_0x6aca('0x6')](_0x6aca('0x35'),auth[_0x6aca('0xa')](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0x6aca('0x36'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x37')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x6aca('0xa')](),controller[_0x6aca('0x38')]);router[_0x6aca('0x6')](_0x6aca('0x39'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x3a')]);router[_0x6aca('0x3b')]('/mail/queues/:id/notify',auth[_0x6aca('0xa')](),controller[_0x6aca('0x3c')]('mail'));router[_0x6aca('0x6')](_0x6aca('0x3d'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x3e')]);router[_0x6aca('0x3b')](_0x6aca('0x3f'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x3c')](_0x6aca('0x40')));router['get']('/chat/queues/:id',auth[_0x6aca('0xa')](),controller['showChatQueues']);router['post']('/fax/queues/:id/notify',auth[_0x6aca('0xa')](),controller[_0x6aca('0x3c')]('fax'));router[_0x6aca('0x6')]('/fax/queues/:id',auth[_0x6aca('0xa')](),controller['showFaxQueues']);router[_0x6aca('0x3b')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x6aca('0x3c')](_0x6aca('0x41')));router[_0x6aca('0x6')]('/openchannel/queues/:id',auth[_0x6aca('0xa')](),controller['showOpenchannelQueues']);router[_0x6aca('0x3b')](_0x6aca('0x42'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x3c')](_0x6aca('0x43')));router[_0x6aca('0x3b')](_0x6aca('0x44'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x3c')]('whatsapp'));router['get'](_0x6aca('0x45'),auth['isAuthenticated'](),controller[_0x6aca('0x46')]);router[_0x6aca('0x6')](_0x6aca('0x47'),auth['isAuthenticated'](),controller[_0x6aca('0x48')]);router[_0x6aca('0x3b')](_0x6aca('0x49'),auth[_0x6aca('0xa')](),controller[_0x6aca('0x4a')]);module[_0x6aca('0x4b')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 2b2f37d..a29970a 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 _0x33c5=['VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','merge','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','INTERACTION','length','format','updateAttributes','findOrCreate','SIP/%s','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Account','findOne','Message','messageId','Interaction','update','queue','InteractionId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','Agent\x20not\x20found','\x20Message\x20not\x20found','TransferReport','create','agentTransferTimeout','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x33c5,0xe6));var _0x533c=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0x33c5[_0x53b53e];return _0xbb6179;};'use strict';var BPromise=require('bluebird');var moment=require(_0x533c('0x0'));var _=require(_0x533c('0x1'));var util=require('util');var db=require(_0x533c('0x2'))['db'];var logger=require(_0x533c('0x3'))(_0x533c('0x4'));var jayson=require(_0x533c('0x5'));var amiClient=jayson[_0x533c('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x533c('0x6')][_0x533c('0x7')]({'port':0x232b});var routingClient=jayson[_0x533c('0x6')][_0x533c('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x34ca89,_0x1699d5,_0x3a009b){return new BPromise(function(_0x36d74e,_0x2c297c){var _0x1b929b=_0x3a009b?_0x3a009b:amiClient;return _0x1b929b[_0x533c('0x8')](_0x34ca89,_0x1699d5)[_0x533c('0x9')](function(_0x2c0214){if(_0x2c0214[_0x533c('0xa')]){if(_0x2c0214[_0x533c('0xa')][_0x533c('0xb')]===0x1f4){return _0x2c297c(_0x2c0214['error'][_0x533c('0xc')]);}return _0x36d74e(_0x2c0214[_0x533c('0xa')][_0x533c('0xc')]);}else{_0x36d74e(_0x2c0214[_0x533c('0xd')]);}})[_0x533c('0xe')](function(_0x346e0f){_0x2c297c(_0x346e0f);});});}function respondWithResult(_0x530e10,_0x5c9462){_0x5c9462=_0x5c9462||0xc8;return function(_0xf93007){if(_0xf93007){return _0x530e10[_0x533c('0xf')](_0x5c9462)[_0x533c('0x10')](_0xf93007);}return _0x530e10[_0x533c('0x11')](0x194);};}function handleError(_0x1a2a83,_0x8d7c66){_0x8d7c66=_0x8d7c66||0x1f4;return function(_0xa616ca){logger['error'](_0xa616ca[_0x533c('0x12')]);if(_0xa616ca[_0x533c('0x13')]){delete _0xa616ca[_0x533c('0x13')];}_0x1a2a83[_0x533c('0xf')](_0x8d7c66)['send'](_0xa616ca);};}function findById(_0x1031e7){return function(_0x1ed6ba){if(!_[_0x533c('0x14')](_0x1031e7)&&!_[_0x533c('0x14')](_0x1ed6ba)&&!_[_0x533c('0x14')](_0x1ed6ba[_0x533c('0x15')])){return _[_0x533c('0x16')](_0x1ed6ba[_0x533c('0x15')],function(_0x1f9f85){return _0x1f9f85['id']==_0x1031e7;});}return null;};}exports[_0x533c('0x17')]=function(_0x287b9e,_0x2c41e9){return respondWithRpcPromise(_0x533c('0x18'),_0x287b9e[_0x533c('0x19')])[_0x533c('0x9')](respondWithResult(_0x2c41e9,null))[_0x533c('0xe')](handleError(_0x2c41e9,null));};exports[_0x533c('0x1a')]=function(_0x2bc58f,_0x4ba0bd){return respondWithRpcPromise(_0x533c('0x1b'),_['merge'](_0x2bc58f['query'],_0x2bc58f[_0x533c('0x1c')]))[_0x533c('0x9')](respondWithResult(_0x4ba0bd,null))['catch'](handleError(_0x4ba0bd,null));};exports[_0x533c('0x1d')]=function(_0x37651e,_0x3839fe){return respondWithRpcPromise(_0x533c('0x1e'),_['merge'](_0x37651e[_0x533c('0x19')],_0x37651e[_0x533c('0x1c')]))[_0x533c('0x9')](respondWithResult(_0x3839fe,null))[_0x533c('0xe')](handleError(_0x3839fe,null));};exports[_0x533c('0x1f')]=function(_0x140269,_0xb51a5){return respondWithRpcPromise(_0x533c('0x20'),_0x140269[_0x533c('0x19')])[_0x533c('0x9')](respondWithResult(_0xb51a5,null))['catch'](handleError(_0xb51a5,null));};exports[_0x533c('0x21')]=function(_0xfab4da,_0x503c2e){return respondWithRpcPromise(_0x533c('0x20'),_0xfab4da['query'])[_0x533c('0x9')](findById(_0xfab4da[_0x533c('0x1c')]['id']))[_0x533c('0x9')](respondWithResult(_0x503c2e,null))[_0x533c('0xe')](handleError(_0x503c2e,null));};exports[_0x533c('0x22')]=function(_0x146a8e,_0x212d1b){return respondWithRpcPromise(_0x533c('0x23'),_[_0x533c('0x24')](_0x146a8e[_0x533c('0x25')],_0x146a8e[_0x533c('0x1c')]))[_0x533c('0x9')](respondWithResult(_0x212d1b,null))['catch'](handleError(_0x212d1b,null));};exports[_0x533c('0x26')]=function(_0x591499,_0x3290de){return respondWithRpcPromise(_0x533c('0x27'),_[_0x533c('0x24')](_0x591499[_0x533c('0x19')],_0x591499[_0x533c('0x1c')]))[_0x533c('0x9')](respondWithResult(_0x3290de,null))[_0x533c('0xe')](handleError(_0x3290de,null));};exports[_0x533c('0x28')]=function(_0x287ee5,_0x47831f){return respondWithRpcPromise(_0x533c('0x29'),_0x287ee5[_0x533c('0x19')])[_0x533c('0x9')](respondWithResult(_0x47831f,null))[_0x533c('0xe')](handleError(_0x47831f,null));};exports[_0x533c('0x2a')]=function(_0x5ac6b4,_0x2b801e){return respondWithRpcPromise(_0x533c('0x2b'),_[_0x533c('0x24')](_0x5ac6b4[_0x533c('0x19')],_0x5ac6b4['params']))[_0x533c('0x9')](respondWithResult(_0x2b801e,null))[_0x533c('0xe')](handleError(_0x2b801e,null));};exports[_0x533c('0x2c')]=function(_0x40f077,_0x1255b1){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x40f077['query'],_0x40f077['params']))['then'](respondWithResult(_0x1255b1,null))[_0x533c('0xe')](handleError(_0x1255b1,null));};exports['voiceQueuesChannelRedirect']=function(_0x42994d,_0x55726a){return respondWithRpcPromise(_0x533c('0x2d'),_[_0x533c('0x24')](_0x42994d[_0x533c('0x19')],_0x42994d['params']))[_0x533c('0x9')](respondWithResult(_0x55726a,null))[_0x533c('0xe')](handleError(_0x55726a,null));};exports[_0x533c('0x2e')]=function(_0x55b010,_0x160d4b){return respondWithRpcPromise(_0x533c('0x2f'),_0x55b010[_0x533c('0x19')])['then'](respondWithResult(_0x160d4b,null))[_0x533c('0xe')](handleError(_0x160d4b,null));};exports[_0x533c('0x30')]=function(_0x2cd02f,_0x3f2b53){return respondWithRpcPromise(_0x533c('0x31'),_0x2cd02f[_0x533c('0x19')])[_0x533c('0x9')](respondWithResult(_0x3f2b53,null))[_0x533c('0xe')](handleError(_0x3f2b53,null));};exports[_0x533c('0x32')]=function(_0x2c03fa,_0x298cea){var _0x55af6e;return respondWithRpcPromise(_0x533c('0x33'),_0x2c03fa[_0x533c('0x19')])[_0x533c('0x9')](function(_0x3562b8){_0x55af6e=_0x3562b8;return respondWithRpcPromise(_0x533c('0x33'),_0x2c03fa[_0x533c('0x19')],routingClient);})['then'](function(_0x88ea5d){return _[_0x533c('0x24')]({},_0x88ea5d,_0x55af6e);})[_0x533c('0x9')](respondWithResult(_0x298cea,null))['catch'](handleError(_0x298cea,null));};exports[_0x533c('0x34')]=function(_0x4170e4,_0x315e67){if(_0x4170e4[_0x533c('0x25')]&&_0x4170e4['body'][_0x533c('0x35')]&&_0x4170e4['user']&&_0x4170e4[_0x533c('0x36')][_0x533c('0x13')]){for(var _0x55a372 in _0x4170e4[_0x533c('0x25')][_0x533c('0x35')]){if(_0x4170e4[_0x533c('0x25')]['interaction']['hasOwnProperty'](_0x55a372)){db['MemberReport']['findAll']({'where':{'channel':_0x55a372,'membername':_0x4170e4[_0x533c('0x36')]['name'],'type':_0x533c('0x37'),'exitAt':null,'uniqueid':_0x4170e4['body'][_0x533c('0x35')][_0x55a372]&&_0x4170e4['body'][_0x533c('0x35')][_0x55a372][_0x533c('0x38')]?{'$notIn':_0x4170e4['body'][_0x533c('0x35')][_0x55a372]}:{'$ne':null}}})[_0x533c('0x9')](function(_0x27ac8e){var _0x10e374=moment()[_0x533c('0x39')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x47cca7=0x0,_0x22dc87=_0x27ac8e[_0x533c('0x38')];_0x47cca7<_0x22dc87;_0x47cca7+=0x1){_0x27ac8e[_0x47cca7][_0x533c('0x3a')]({'exitAt':_0x10e374});}});for(var _0x4fcdc5=0x0;_0x4fcdc5<_0x4170e4[_0x533c('0x25')][_0x533c('0x35')][_0x55a372]['length'];_0x4fcdc5+=0x1){db['MemberReport'][_0x533c('0x3b')]({'where':{'channel':_0x55a372,'membername':_0x4170e4['user'][_0x533c('0x13')],'type':_0x533c('0x37'),'uniqueid':_0x4170e4[_0x533c('0x25')][_0x533c('0x35')][_0x55a372][_0x4fcdc5],'exitAt':null},'defaults':{'channel':_0x55a372,'membername':_0x4170e4[_0x533c('0x36')][_0x533c('0x13')],'interface':_[_0x533c('0x14')](_0x4170e4[_0x533c('0x36')]['interface'])?util[_0x533c('0x39')](_0x533c('0x3c'),_0x4170e4[_0x533c('0x36')]['name']):_0x4170e4[_0x533c('0x36')][_0x533c('0x3d')],'type':'INTERACTION','enterAt':moment()[_0x533c('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x533c('0x3e'),'internal':_0x4170e4[_0x533c('0x36')][_0x533c('0x3f')],'uniqueid':_0x4170e4[_0x533c('0x25')][_0x533c('0x35')][_0x55a372][_0x4fcdc5]}});}}}}return respondWithRpcPromise(_0x533c('0x40'),{'id':_0x4170e4[_0x533c('0x1c')]['id'],'capacity':_0x4170e4['body'][_0x533c('0x41')]},routingClient)[_0x533c('0x9')](respondWithResult(_0x315e67,null))[_0x533c('0xe')](handleError(_0x315e67,null));};exports[_0x533c('0x42')]=function(_0x24ca50,_0x1558ef){return respondWithRpcPromise(_0x533c('0x43'),_0x24ca50['query'])['then'](respondWithResult(_0x1558ef,null))['catch'](handleError(_0x1558ef,null));};exports['trunks']=function(_0xc99f96,_0x4434a1){return respondWithRpcPromise('Trunks',_0xc99f96[_0x533c('0x19')])[_0x533c('0x9')](respondWithResult(_0x4434a1,null))[_0x533c('0xe')](handleError(_0x4434a1,null));};exports['campaigns']=function(_0x1de19e,_0x564a31){return respondWithRpcPromise('Campaigns',_0x1de19e[_0x533c('0x19')])[_0x533c('0x9')](respondWithResult(_0x564a31,null))[_0x533c('0xe')](handleError(_0x564a31,null));};exports[_0x533c('0x44')]=function(_0x381544,_0x3bb176){return respondWithRpcPromise(_0x533c('0x45'),_0x381544['query'],routingClient)[_0x533c('0x9')](respondWithResult(_0x3bb176,null))['catch'](handleError(_0x3bb176,null));};exports[_0x533c('0x46')]=function(_0x26645d,_0x274686){return respondWithRpcPromise(_0x533c('0x45'),_0x26645d[_0x533c('0x19')],routingClient)[_0x533c('0x9')](findById(_0x26645d[_0x533c('0x1c')]['id']))[_0x533c('0x9')](respondWithResult(_0x274686,null))['catch'](handleError(_0x274686,null));};exports[_0x533c('0x47')]=function(_0x43a333,_0x163563){return respondWithRpcPromise(_0x533c('0x48'),_0x43a333[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x163563,null))['catch'](handleError(_0x163563,null));};exports[_0x533c('0x49')]=function(_0x554a9f,_0x43383e){return respondWithRpcPromise(_0x533c('0x48'),_0x554a9f[_0x533c('0x19')],routingClient)[_0x533c('0x9')](findById(_0x554a9f[_0x533c('0x1c')]['id']))[_0x533c('0x9')](respondWithResult(_0x43383e,null))['catch'](handleError(_0x43383e,null));};exports['mailAccounts']=function(_0x1005a6,_0x376619){return respondWithRpcPromise(_0x533c('0x4a'),_0x1005a6[_0x533c('0x19')],mailClient)['then'](respondWithResult(_0x376619,null))[_0x533c('0xe')](handleError(_0x376619,null));};exports[_0x533c('0x4b')]=function(_0x8e04c7,_0x352e07){return respondWithRpcPromise(_0x533c('0x4c'),_0x8e04c7[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x352e07,null))[_0x533c('0xe')](handleError(_0x352e07,null));};exports[_0x533c('0x4d')]=function(_0x3aba19,_0x404a93){return respondWithRpcPromise(_0x533c('0x4c'),_0x3aba19[_0x533c('0x19')],routingClient)[_0x533c('0x9')](findById(_0x3aba19[_0x533c('0x1c')]['id']))[_0x533c('0x9')](respondWithResult(_0x404a93,null))[_0x533c('0xe')](handleError(_0x404a93,null));};exports['smsQueues']=function(_0x31bba1,_0x5206ad){return respondWithRpcPromise('SmsQueues',_0x31bba1[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x5206ad,null))[_0x533c('0xe')](handleError(_0x5206ad,null));};exports[_0x533c('0x4e')]=function(_0x417158,_0x1eaf34){return respondWithRpcPromise(_0x533c('0x4f'),_0x417158['query'],routingClient)[_0x533c('0x9')](findById(_0x417158[_0x533c('0x1c')]['id']))['then'](respondWithResult(_0x1eaf34,null))[_0x533c('0xe')](handleError(_0x1eaf34,null));};exports[_0x533c('0x50')]=function(_0x8174d0,_0x3e3b25){return respondWithRpcPromise('WhatsappQueues',_0x8174d0[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x3e3b25,null))['catch'](handleError(_0x3e3b25,null));};exports[_0x533c('0x51')]=function(_0x3e8d57,_0x5f2b8b){return respondWithRpcPromise(_0x533c('0x52'),_0x3e8d57[_0x533c('0x19')],routingClient)['then'](findById(_0x3e8d57[_0x533c('0x1c')]['id']))['then'](respondWithResult(_0x5f2b8b,null))['catch'](handleError(_0x5f2b8b,null));};exports[_0x533c('0x53')]=function(_0x28239c,_0x451def){return respondWithRpcPromise(_0x533c('0x54'),_0x28239c['query'],routingClient)[_0x533c('0x9')](respondWithResult(_0x451def,null))[_0x533c('0xe')](handleError(_0x451def,null));};exports[_0x533c('0x55')]=function(_0x245792,_0x20d344){return respondWithRpcPromise('FaxQueues',_0x245792[_0x533c('0x19')],routingClient)['then'](findById(_0x245792[_0x533c('0x1c')]['id']))['then'](respondWithResult(_0x20d344,null))[_0x533c('0xe')](handleError(_0x20d344,null));};exports['faxAccounts']=function(_0x4bd014,_0x511f74){return respondWithRpcPromise(_0x533c('0x56'),_0x4bd014[_0x533c('0x19')])[_0x533c('0x9')](respondWithResult(_0x511f74,null))['catch'](handleError(_0x511f74,null));};exports[_0x533c('0x57')]=function(_0x24a00c,_0x3fbb08){return respondWithRpcPromise(_0x533c('0x58'),_0x24a00c[_0x533c('0x19')],routingClient)['then'](respondWithResult(_0x3fbb08,null))['catch'](handleError(_0x3fbb08,null));};exports[_0x533c('0x59')]=function(_0x313fa5,_0x2c0f59){return respondWithRpcPromise(_0x533c('0x5a'),_0x313fa5[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x2c0f59,null))[_0x533c('0xe')](handleError(_0x2c0f59,null));};exports[_0x533c('0x5b')]=function(_0x45c4ca,_0x4f0961){return respondWithRpcPromise(_0x533c('0x5c'),_0x45c4ca[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x4f0961,null))[_0x533c('0xe')](handleError(_0x4f0961,null));};exports[_0x533c('0x5d')]=function(_0x18102b,_0x1b9816){return respondWithRpcPromise(_0x533c('0x5c'),_0x18102b[_0x533c('0x19')],routingClient)[_0x533c('0x9')](function(_0xfd598d){if(_0x18102b[_0x533c('0x19')][_0x533c('0x5e')]!==undefined){var _0x452915=_(_0xfd598d[_0x533c('0x15')])[_0x533c('0x5f')]([_0x18102b[_0x533c('0x19')]['type'],_0x18102b[_0x533c('0x1c')]['id']])[_0x533c('0x60')]('queue_id')['uniq']()[_0x533c('0x61')]();return _0xfd598d['rows'][_0x533c('0x5f')](function(_0x307fe5){return _0x452915[_0x533c('0x62')](_0x307fe5[_0x533c('0x63')])>-0x1;});}else{return _0xfd598d[_0x533c('0x15')]['filter'](function(_0x275db2){return _0x275db2[_0x533c('0x63')]===parseInt(_0x18102b[_0x533c('0x1c')]['id']);});}})[_0x533c('0x9')](respondWithResult(_0x1b9816,null))[_0x533c('0xe')](handleError(_0x1b9816,null));};exports[_0x533c('0x64')]=function(_0x1aa938,_0x248ede){return respondWithRpcPromise(_0x533c('0x65'),_0x1aa938[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x248ede,null))[_0x533c('0xe')](handleError(_0x248ede,null));};exports[_0x533c('0x66')]=function(_0x452759,_0x9c8d2){return respondWithRpcPromise(_0x533c('0x67'),_0x452759[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x9c8d2,null))['catch'](handleError(_0x9c8d2,null));};exports[_0x533c('0x68')]=function(_0x15d09a,_0x247915){return respondWithRpcPromise(_0x533c('0x69'),_0x15d09a['query'],routingClient)[_0x533c('0x9')](respondWithResult(_0x247915,null))[_0x533c('0xe')](handleError(_0x247915,null));};exports['queueNotify']=function(_0x411f86){return function(_0x5b8ead,_0x291be3){var _0x4be94e,_0x11654c;var _0x33a661=_[_0x533c('0x6a')](_0x411f86);var _0x5c938c=_0x411f86==='chat'?'Website':_0x533c('0x6b');return db[_0x33a661+'Queue'][_0x533c('0x6c')]({'raw':!![],'where':{'id':_0x5b8ead[_0x533c('0x1c')]['id']}})[_0x533c('0x9')](function(_0x450152){if(_['isNil'](_0x450152)){throw new Error(_0x33a661+'\x20Queue\x20not\x20found');}_0x4be94e=_0x450152;return db[_0x33a661+_0x533c('0x6d')]['findOne']({'where':{'id':_0x5b8ead[_0x533c('0x25')][_0x533c('0x6e')]},'include':[{'model':db[_0x33a661+_0x533c('0x6f')],'as':'Interaction'},{'model':db[_0x33a661+_0x5c938c],'as':_0x533c('0x6b')}]});})['then'](function(_0x6e0d38){if(_[_0x533c('0x14')](_0x6e0d38)){throw new Error(_0x33a661+'\x20Message\x20not\x20found');}_0x11654c=_0x6e0d38;return _0x6e0d38[_0x533c('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0x533c('0x9')](function(){var _0x1c9381={'uniqueid':_0x411f86+'.'+_0x11654c['id']+'.'+_0x11654c[_0x533c('0x6f')]['id'],'FromUserId':_0x5b8ead[_0x533c('0x36')]['id'],'type':_0x533c('0x71')};_0x1c9381[_0x33a661+'MessageId']=_0x11654c['id'];_0x1c9381[_0x33a661+_0x533c('0x72')]=_0x11654c[_0x533c('0x6f')]['id'];_0x1c9381[_0x533c('0x73')+_0x33a661+_0x5c938c+'Id']=_0x11654c['Account']['id'];_0x1c9381['To'+_0x33a661+_0x533c('0x74')]=_0x4be94e['id'];return db[_0x33a661+'TransferReport']['create'](_0x1c9381);})[_0x533c('0x9')](function(){return respondWithRpcPromise(_0x533c('0x75'),{'channel':_0x411f86,'interaction':_0x11654c['Interaction'],'message':_0x11654c,'account':_0x11654c[_0x533c('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x533c('0x71'),'appdata':_0x4be94e[_0x533c('0x13')]+','+(_0x11654c[_0x533c('0x6b')][_0x533c('0x76')]||0x12c),'interval':_0x533c('0x77')}]},routingClient);})[_0x533c('0x9')](respondWithResult(_0x291be3,null))[_0x533c('0xe')](handleError(_0x291be3,null));};};exports[_0x533c('0x78')]=function(_0x299f43,_0x14db14){var _0x243d1a,_0x368552;if(_['isNil'](_0x299f43[_0x533c('0x25')][_0x533c('0x79')])){throw new Error(_0x533c('0x7a'));}var _0x4c3f6d=_0x299f43[_0x533c('0x25')]['channel'];var _0x2c7faf=_[_0x533c('0x6a')](_0x4c3f6d);var _0x2377a3=_0x4c3f6d==='chat'?_0x533c('0x7b'):_0x533c('0x6b');return db[_0x533c('0x7c')]['findOne']({'raw':!![],'where':{'id':_0x299f43['params']['id'],'role':_0x533c('0x3e')}})['then'](function(_0x392968){if(_['isNil'](_0x392968)){throw new Error(_0x533c('0x7d'));}_0x243d1a=_0x392968;return db[_0x2c7faf+_0x533c('0x6d')][_0x533c('0x6c')]({'where':{'id':_0x299f43['body']['messageId']},'include':[{'model':db[_0x2c7faf+_0x533c('0x6f')],'as':_0x533c('0x6f')},{'model':db[_0x2c7faf+_0x2377a3],'as':_0x533c('0x6b')}]});})[_0x533c('0x9')](function(_0x313916){if(_[_0x533c('0x14')](_0x313916)){throw new Error(_0x2c7faf+_0x533c('0x7e'));}_0x368552=_0x313916;return _0x313916[_0x533c('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0x533c('0x9')](function(){var _0x5307b3={'uniqueid':_0x4c3f6d+'.'+_0x368552['id']+'.'+_0x368552[_0x533c('0x6f')]['id'],'FromUserId':_0x299f43[_0x533c('0x36')]['id'],'type':_0x533c('0x71'),'ToUserId':_0x243d1a['id']};_0x5307b3[_0x2c7faf+'MessageId']=_0x368552['id'];_0x5307b3[_0x2c7faf+_0x533c('0x72')]=_0x368552[_0x533c('0x6f')]['id'];_0x5307b3[_0x533c('0x73')+_0x2c7faf+_0x2377a3+'Id']=_0x368552[_0x533c('0x6b')]['id'];return db[_0x2c7faf+_0x533c('0x7f')][_0x533c('0x80')](_0x5307b3);})[_0x533c('0x9')](function(){return respondWithRpcPromise(_0x533c('0x75'),{'channel':_0x4c3f6d,'interaction':_0x368552[_0x533c('0x6f')],'message':_0x368552,'account':_0x368552[_0x533c('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x533c('0x3e'),'appdata':_0x243d1a[_0x533c('0x13')]+','+(_0x368552['Account'][_0x533c('0x81')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x533c('0x9')](respondWithResult(_0x14db14,null))[_0x533c('0xe')](handleError(_0x14db14,null));}; \ No newline at end of file +var _0x5fc3=['openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','value','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','chat','User','\x20Message\x20not\x20found','Start','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','then','error','code','message','result','catch','status','json','sendStatus','name','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','format','length','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions'];(function(_0x3baae6,_0x243c79){var _0x5bdd33=function(_0x5677c6){while(--_0x5677c6){_0x3baae6['push'](_0x3baae6['shift']());}};_0x5bdd33(++_0x243c79);}(_0x5fc3,0xa8));var _0x35fc=function(_0x375492,_0x4ed149){_0x375492=_0x375492-0x0;var _0x18ba5b=_0x5fc3[_0x375492];return _0x18ba5b;};'use strict';var BPromise=require(_0x35fc('0x0'));var moment=require(_0x35fc('0x1'));var _=require('lodash');var util=require(_0x35fc('0x2'));var db=require(_0x35fc('0x3'))['db'];var logger=require(_0x35fc('0x4'))(_0x35fc('0x5'));var jayson=require(_0x35fc('0x6'));var amiClient=jayson['client'][_0x35fc('0x7')]({'port':0x232a});var mailClient=jayson[_0x35fc('0x8')][_0x35fc('0x7')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){var _0x1e5f90=_0x16e153?_0x16e153:amiClient;return _0x1e5f90[_0x35fc('0x9')](_0x19a0d1,_0x508b32)[_0x35fc('0xa')](function(_0x2051ab){if(_0x2051ab['error']){if(_0x2051ab[_0x35fc('0xb')][_0x35fc('0xc')]===0x1f4){return _0xc72d93(_0x2051ab['error'][_0x35fc('0xd')]);}return _0x27524f(_0x2051ab[_0x35fc('0xb')]['message']);}else{_0x27524f(_0x2051ab[_0x35fc('0xe')]);}})[_0x35fc('0xf')](function(_0x5469f5){_0xc72d93(_0x5469f5);});});}function respondWithResult(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xc8;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x10')](_0x409357)[_0x35fc('0x11')](_0x5d462a);}return _0x4cbe74[_0x35fc('0x12')](0x194);};}function handleError(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0x1f4;return function(_0x5cfe94){logger['error'](_0x5cfe94['stack']);if(_0x5cfe94['name']){delete _0x5cfe94[_0x35fc('0x13')];}_0x29730f[_0x35fc('0x10')](_0x38d9f2)[_0x35fc('0x14')](_0x5cfe94);};}function findById(_0x154958){return function(_0x227a49){if(!_[_0x35fc('0x15')](_0x154958)&&!_['isNil'](_0x227a49)&&!_[_0x35fc('0x15')](_0x227a49[_0x35fc('0x16')])){return _['find'](_0x227a49[_0x35fc('0x16')],function(_0x363e47){return _0x363e47['id']==_0x154958;});}return null;};}exports[_0x35fc('0x17')]=function(_0x5f56c6,_0x1a86e9){return respondWithRpcPromise(_0x35fc('0x18'),_0x5f56c6[_0x35fc('0x19')])['then'](respondWithResult(_0x1a86e9,null))[_0x35fc('0xf')](handleError(_0x1a86e9,null));};exports[_0x35fc('0x1a')]=function(_0x3229d1,_0x251a1f){return respondWithRpcPromise(_0x35fc('0x1b'),_[_0x35fc('0x1c')](_0x3229d1[_0x35fc('0x19')],_0x3229d1[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x251a1f,null))[_0x35fc('0xf')](handleError(_0x251a1f,null));};exports['voiceChannelStopMixMonitor']=function(_0x323aee,_0xd5399f){return respondWithRpcPromise(_0x35fc('0x1e'),_[_0x35fc('0x1c')](_0x323aee[_0x35fc('0x19')],_0x323aee['params']))[_0x35fc('0xa')](respondWithResult(_0xd5399f,null))[_0x35fc('0xf')](handleError(_0xd5399f,null));};exports['voiceQueues']=function(_0x265324,_0x5a93df){return respondWithRpcPromise(_0x35fc('0x1f'),_0x265324['query'])[_0x35fc('0xa')](respondWithResult(_0x5a93df,null))['catch'](handleError(_0x5a93df,null));};exports[_0x35fc('0x20')]=function(_0xdfab9f,_0x5cb986){return respondWithRpcPromise('VoiceQueues',_0xdfab9f[_0x35fc('0x19')])['then'](findById(_0xdfab9f[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x5cb986,null))['catch'](handleError(_0x5cb986,null));};exports[_0x35fc('0x21')]=function(_0x645eac,_0x383837){return respondWithRpcPromise(_0x35fc('0x22'),_[_0x35fc('0x1c')](_0x645eac[_0x35fc('0x23')],_0x645eac[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x383837,null))['catch'](handleError(_0x383837,null));};exports[_0x35fc('0x24')]=function(_0x220931,_0x22af18){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x35fc('0x1c')](_0x220931[_0x35fc('0x19')],_0x220931[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x22af18,null))[_0x35fc('0xf')](handleError(_0x22af18,null));};exports[_0x35fc('0x25')]=function(_0x222ddb,_0x37b435){return respondWithRpcPromise(_0x35fc('0x26'),_0x222ddb[_0x35fc('0x19')])['then'](respondWithResult(_0x37b435,null))['catch'](handleError(_0x37b435,null));};exports[_0x35fc('0x27')]=function(_0x4af5fe,_0x37b394){return respondWithRpcPromise(_0x35fc('0x28'),_[_0x35fc('0x1c')](_0x4af5fe[_0x35fc('0x19')],_0x4af5fe[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x37b394,null))['catch'](handleError(_0x37b394,null));};exports[_0x35fc('0x29')]=function(_0x330a14,_0x46b9ef){return respondWithRpcPromise(_0x35fc('0x2a'),_[_0x35fc('0x1c')](_0x330a14[_0x35fc('0x19')],_0x330a14['params']))[_0x35fc('0xa')](respondWithResult(_0x46b9ef,null))[_0x35fc('0xf')](handleError(_0x46b9ef,null));};exports[_0x35fc('0x2b')]=function(_0x52f53d,_0x2c657d){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x35fc('0x1c')](_0x52f53d[_0x35fc('0x19')],_0x52f53d[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x2c657d,null))['catch'](handleError(_0x2c657d,null));};exports['outbound']=function(_0x59e4fb,_0x20f5fe){return respondWithRpcPromise('Outbound',_0x59e4fb[_0x35fc('0x19')])['then'](respondWithResult(_0x20f5fe,null))[_0x35fc('0xf')](handleError(_0x20f5fe,null));};exports[_0x35fc('0x2c')]=function(_0x2ca9ac,_0x22b724){return respondWithRpcPromise(_0x35fc('0x2d'),_0x2ca9ac[_0x35fc('0x19')])[_0x35fc('0xa')](respondWithResult(_0x22b724,null))['catch'](handleError(_0x22b724,null));};exports[_0x35fc('0x2e')]=function(_0x16087d,_0x4e0ce3){var _0x1feda5;return respondWithRpcPromise(_0x35fc('0x2f'),_0x16087d[_0x35fc('0x19')])[_0x35fc('0xa')](function(_0x813866){_0x1feda5=_0x813866;return respondWithRpcPromise(_0x35fc('0x2f'),_0x16087d['query'],routingClient);})[_0x35fc('0xa')](function(_0x267858){return _[_0x35fc('0x1c')]({},_0x267858,_0x1feda5);})['then'](respondWithResult(_0x4e0ce3,null))[_0x35fc('0xf')](handleError(_0x4e0ce3,null));};exports[_0x35fc('0x30')]=function(_0x596919,_0x237548){if(_0x596919[_0x35fc('0x23')]&&_0x596919[_0x35fc('0x23')][_0x35fc('0x31')]&&_0x596919[_0x35fc('0x32')]&&_0x596919[_0x35fc('0x32')][_0x35fc('0x13')]){for(var _0x3ec51f in _0x596919['body']['interaction']){if(_0x596919[_0x35fc('0x23')][_0x35fc('0x31')]['hasOwnProperty'](_0x3ec51f)){db['MemberReport']['findAll']({'where':{'channel':_0x3ec51f,'membername':_0x596919[_0x35fc('0x32')][_0x35fc('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]&&_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]['length']?{'$notIn':_0x596919['body']['interaction'][_0x3ec51f]}:{'$ne':null}}})['then'](function(_0x56bdb9){var _0xb26e3f=moment()[_0x35fc('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x119925=0x0,_0x56cf1f=_0x56bdb9[_0x35fc('0x34')];_0x119925<_0x56cf1f;_0x119925+=0x1){_0x56bdb9[_0x119925][_0x35fc('0x35')]({'exitAt':_0xb26e3f});}});for(var _0x350237=0x0;_0x350237<_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]['length'];_0x350237+=0x1){db[_0x35fc('0x36')][_0x35fc('0x37')]({'where':{'channel':_0x3ec51f,'membername':_0x596919['user'][_0x35fc('0x13')],'type':_0x35fc('0x38'),'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f][_0x350237],'exitAt':null},'defaults':{'channel':_0x3ec51f,'membername':_0x596919['user'][_0x35fc('0x13')],'interface':_['isNil'](_0x596919['user'][_0x35fc('0x39')])?util[_0x35fc('0x33')](_0x35fc('0x3a'),_0x596919[_0x35fc('0x32')][_0x35fc('0x13')]):_0x596919[_0x35fc('0x32')][_0x35fc('0x39')],'type':_0x35fc('0x38'),'enterAt':moment()['format'](_0x35fc('0x3b')),'role':_0x35fc('0x3c'),'internal':_0x596919[_0x35fc('0x32')][_0x35fc('0x3d')],'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f][_0x350237]}});}}}}return respondWithRpcPromise(_0x35fc('0x3e'),{'id':_0x596919[_0x35fc('0x1d')]['id'],'capacity':_0x596919[_0x35fc('0x23')][_0x35fc('0x3f')]},routingClient)[_0x35fc('0xa')](respondWithResult(_0x237548,null))[_0x35fc('0xf')](handleError(_0x237548,null));};exports[_0x35fc('0x40')]=function(_0x3146e2,_0x59c666){return respondWithRpcPromise('Telephones',_0x3146e2[_0x35fc('0x19')])[_0x35fc('0xa')](respondWithResult(_0x59c666,null))[_0x35fc('0xf')](handleError(_0x59c666,null));};exports[_0x35fc('0x41')]=function(_0x3ee296,_0x3e6494){return respondWithRpcPromise('Trunks',_0x3ee296['query'])[_0x35fc('0xa')](respondWithResult(_0x3e6494,null))[_0x35fc('0xf')](handleError(_0x3e6494,null));};exports[_0x35fc('0x42')]=function(_0x38bc78,_0x5b2595){return respondWithRpcPromise(_0x35fc('0x43'),_0x38bc78[_0x35fc('0x19')])['then'](respondWithResult(_0x5b2595,null))[_0x35fc('0xf')](handleError(_0x5b2595,null));};exports[_0x35fc('0x44')]=function(_0x590faa,_0x3e12e4){return respondWithRpcPromise(_0x35fc('0x45'),_0x590faa[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x3e12e4,null))['catch'](handleError(_0x3e12e4,null));};exports['showChatQueues']=function(_0x502a15,_0x240338){return respondWithRpcPromise(_0x35fc('0x45'),_0x502a15['query'],routingClient)[_0x35fc('0xa')](findById(_0x502a15[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x240338,null))[_0x35fc('0xf')](handleError(_0x240338,null));};exports[_0x35fc('0x46')]=function(_0x538be0,_0x2d9d45){return respondWithRpcPromise(_0x35fc('0x47'),_0x538be0[_0x35fc('0x19')],routingClient)['then'](respondWithResult(_0x2d9d45,null))[_0x35fc('0xf')](handleError(_0x2d9d45,null));};exports[_0x35fc('0x48')]=function(_0x47fb1a,_0x35a676){return respondWithRpcPromise(_0x35fc('0x47'),_0x47fb1a[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](findById(_0x47fb1a[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x35a676,null))[_0x35fc('0xf')](handleError(_0x35a676,null));};exports[_0x35fc('0x49')]=function(_0x53a79d,_0x10a5b8){return respondWithRpcPromise(_0x35fc('0x4a'),_0x53a79d[_0x35fc('0x19')],mailClient)['then'](respondWithResult(_0x10a5b8,null))[_0x35fc('0xf')](handleError(_0x10a5b8,null));};exports['openchannelQueues']=function(_0x4ceacc,_0x5d4a39){return respondWithRpcPromise(_0x35fc('0x4b'),_0x4ceacc[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x5d4a39,null))[_0x35fc('0xf')](handleError(_0x5d4a39,null));};exports[_0x35fc('0x4c')]=function(_0x4bbea0,_0x579f5a){return respondWithRpcPromise('OpenchannelQueues',_0x4bbea0['query'],routingClient)['then'](findById(_0x4bbea0[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x579f5a,null))[_0x35fc('0xf')](handleError(_0x579f5a,null));};exports[_0x35fc('0x4d')]=function(_0x511e8b,_0x458eb8){return respondWithRpcPromise(_0x35fc('0x4e'),_0x511e8b[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x458eb8,null))[_0x35fc('0xf')](handleError(_0x458eb8,null));};exports[_0x35fc('0x4f')]=function(_0x27071b,_0x2127e0){return respondWithRpcPromise(_0x35fc('0x4e'),_0x27071b['query'],routingClient)[_0x35fc('0xa')](findById(_0x27071b['params']['id']))[_0x35fc('0xa')](respondWithResult(_0x2127e0,null))[_0x35fc('0xf')](handleError(_0x2127e0,null));};exports[_0x35fc('0x50')]=function(_0x2bc76c,_0x4bdde7){return respondWithRpcPromise(_0x35fc('0x51'),_0x2bc76c['query'],routingClient)['then'](respondWithResult(_0x4bdde7,null))['catch'](handleError(_0x4bdde7,null));};exports[_0x35fc('0x52')]=function(_0x5dfeb7,_0x3c9027){return respondWithRpcPromise('WhatsappQueues',_0x5dfeb7[_0x35fc('0x19')],routingClient)['then'](findById(_0x5dfeb7[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x3c9027,null))[_0x35fc('0xf')](handleError(_0x3c9027,null));};exports[_0x35fc('0x53')]=function(_0x5c2ec0,_0x3d0ecc){return respondWithRpcPromise(_0x35fc('0x54'),_0x5c2ec0[_0x35fc('0x19')],routingClient)['then'](respondWithResult(_0x3d0ecc,null))[_0x35fc('0xf')](handleError(_0x3d0ecc,null));};exports[_0x35fc('0x55')]=function(_0x37764b,_0x3c1b56){return respondWithRpcPromise(_0x35fc('0x54'),_0x37764b[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](findById(_0x37764b[_0x35fc('0x1d')]['id']))['then'](respondWithResult(_0x3c1b56,null))[_0x35fc('0xf')](handleError(_0x3c1b56,null));};exports[_0x35fc('0x56')]=function(_0x2600d2,_0x4a926d){return respondWithRpcPromise(_0x35fc('0x57'),_0x2600d2[_0x35fc('0x19')])['then'](respondWithResult(_0x4a926d,null))['catch'](handleError(_0x4a926d,null));};exports[_0x35fc('0x58')]=function(_0x4835c2,_0x223ad3){return respondWithRpcPromise(_0x35fc('0x59'),_0x4835c2[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x223ad3,null))[_0x35fc('0xf')](handleError(_0x223ad3,null));};exports[_0x35fc('0x5a')]=function(_0x13f602,_0x104b1d){return respondWithRpcPromise(_0x35fc('0x5b'),_0x13f602[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x104b1d,null))[_0x35fc('0xf')](handleError(_0x104b1d,null));};exports[_0x35fc('0x5c')]=function(_0x9f034e,_0x184f28){return respondWithRpcPromise(_0x35fc('0x5d'),_0x9f034e[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x184f28,null))[_0x35fc('0xf')](handleError(_0x184f28,null));};exports[_0x35fc('0x5e')]=function(_0x4ba1b0,_0x1797d0){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4ba1b0[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](function(_0x2185ce){if(_0x4ba1b0[_0x35fc('0x19')][_0x35fc('0x5f')]!==undefined){var _0x3f56f4=_(_0x2185ce[_0x35fc('0x16')])[_0x35fc('0x60')]([_0x4ba1b0[_0x35fc('0x19')][_0x35fc('0x5f')],_0x4ba1b0[_0x35fc('0x1d')]['id']])['map'](_0x35fc('0x61'))[_0x35fc('0x62')]()[_0x35fc('0x63')]();return _0x2185ce[_0x35fc('0x16')][_0x35fc('0x60')](function(_0x41a6de){return _0x3f56f4['indexOf'](_0x41a6de[_0x35fc('0x61')])>-0x1;});}else{return _0x2185ce[_0x35fc('0x16')][_0x35fc('0x60')](function(_0x23206d){return _0x23206d[_0x35fc('0x61')]===parseInt(_0x4ba1b0[_0x35fc('0x1d')]['id']);});}})[_0x35fc('0xa')](respondWithResult(_0x1797d0,null))[_0x35fc('0xf')](handleError(_0x1797d0,null));};exports[_0x35fc('0x64')]=function(_0x5f23d8,_0x28f02b){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x5f23d8[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x28f02b,null))['catch'](handleError(_0x28f02b,null));};exports[_0x35fc('0x65')]=function(_0x41002a,_0xcaa49){return respondWithRpcPromise(_0x35fc('0x66'),_0x41002a[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0xcaa49,null))[_0x35fc('0xf')](handleError(_0xcaa49,null));};exports[_0x35fc('0x67')]=function(_0x25ee61,_0x5806bf){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x25ee61['query'],routingClient)['then'](respondWithResult(_0x5806bf,null))[_0x35fc('0xf')](handleError(_0x5806bf,null));};exports[_0x35fc('0x68')]=function(_0x8fc410){return function(_0x1f5cbc,_0x35ef53){var _0x4f535a,_0x226fdf;var _0x19682e=_[_0x35fc('0x69')](_0x8fc410);var _0x169ea2=_0x8fc410==='chat'?_0x35fc('0x6a'):_0x35fc('0x6b');return db[_0x19682e+_0x35fc('0x6c')]['findOne']({'raw':!![],'where':{'id':_0x1f5cbc[_0x35fc('0x1d')]['id']}})[_0x35fc('0xa')](function(_0x319033){if(_[_0x35fc('0x15')](_0x319033)){throw new Error(_0x19682e+_0x35fc('0x6d'));}_0x4f535a=_0x319033;return db[_0x19682e+_0x35fc('0x6e')][_0x35fc('0x6f')]({'where':{'id':_0x1f5cbc[_0x35fc('0x23')]['messageId']},'include':[{'model':db[_0x19682e+_0x35fc('0x70')],'as':_0x35fc('0x70')},{'model':db[_0x19682e+_0x169ea2],'as':_0x35fc('0x6b')}]});})[_0x35fc('0xa')](function(_0x221c5b){if(_[_0x35fc('0x15')](_0x221c5b)){throw new Error(_0x19682e+'\x20Message\x20not\x20found');}_0x226fdf=_0x221c5b;return _0x221c5b[_0x35fc('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4855ee={'uniqueid':_0x8fc410+'.'+_0x226fdf['id']+'.'+_0x226fdf[_0x35fc('0x70')]['id'],'FromUserId':_0x1f5cbc['user']['id'],'type':_0x35fc('0x72')};_0x4855ee[_0x19682e+_0x35fc('0x73')]=_0x226fdf['id'];_0x4855ee[_0x19682e+_0x35fc('0x74')]=_0x226fdf['Interaction']['id'];_0x4855ee[_0x35fc('0x75')+_0x19682e+_0x169ea2+'Id']=_0x226fdf[_0x35fc('0x6b')]['id'];_0x4855ee['To'+_0x19682e+_0x35fc('0x76')]=_0x4f535a['id'];return db[_0x19682e+_0x35fc('0x77')][_0x35fc('0x78')](_0x4855ee);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x8fc410,'interaction':_0x226fdf['Interaction'],'message':_0x226fdf,'account':_0x226fdf[_0x35fc('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4f535a[_0x35fc('0x13')]+','+(_0x226fdf[_0x35fc('0x6b')][_0x35fc('0x79')]||0x12c),'interval':_0x35fc('0x7a')}]},routingClient);})['then'](respondWithResult(_0x35ef53,null))[_0x35fc('0xf')](handleError(_0x35ef53,null));};};exports[_0x35fc('0x7b')]=function(_0x312827,_0x47c507){var _0x128286,_0x175cc7;if(_[_0x35fc('0x15')](_0x312827['body']['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x32b9e1=_0x312827[_0x35fc('0x23')][_0x35fc('0x7c')];var _0x3858a9=_['capitalize'](_0x32b9e1);var _0x3ead4e=_0x32b9e1===_0x35fc('0x7d')?'Website':'Account';return db[_0x35fc('0x7e')][_0x35fc('0x6f')]({'raw':!![],'where':{'id':_0x312827[_0x35fc('0x1d')]['id'],'role':'agent'}})['then'](function(_0x134e60){if(_[_0x35fc('0x15')](_0x134e60)){throw new Error('Agent\x20not\x20found');}_0x128286=_0x134e60;return db[_0x3858a9+_0x35fc('0x6e')][_0x35fc('0x6f')]({'where':{'id':_0x312827[_0x35fc('0x23')]['messageId']},'include':[{'model':db[_0x3858a9+_0x35fc('0x70')],'as':_0x35fc('0x70')},{'model':db[_0x3858a9+_0x3ead4e],'as':_0x35fc('0x6b')}]});})[_0x35fc('0xa')](function(_0x4fd676){if(_[_0x35fc('0x15')](_0x4fd676)){throw new Error(_0x3858a9+_0x35fc('0x7f'));}_0x175cc7=_0x4fd676;return _0x4fd676[_0x35fc('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x96dfc={'uniqueid':_0x32b9e1+'.'+_0x175cc7['id']+'.'+_0x175cc7[_0x35fc('0x70')]['id'],'FromUserId':_0x312827[_0x35fc('0x32')]['id'],'type':'queue','ToUserId':_0x128286['id']};_0x96dfc[_0x3858a9+_0x35fc('0x73')]=_0x175cc7['id'];_0x96dfc[_0x3858a9+_0x35fc('0x74')]=_0x175cc7['Interaction']['id'];_0x96dfc[_0x35fc('0x75')+_0x3858a9+_0x3ead4e+'Id']=_0x175cc7[_0x35fc('0x6b')]['id'];return db[_0x3858a9+_0x35fc('0x77')][_0x35fc('0x78')](_0x96dfc);})[_0x35fc('0xa')](function(){return respondWithRpcPromise(_0x35fc('0x80'),{'channel':_0x32b9e1,'interaction':_0x175cc7[_0x35fc('0x70')],'message':_0x175cc7,'account':_0x175cc7[_0x35fc('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x35fc('0x3c'),'appdata':_0x128286['name']+','+(_0x175cc7[_0x35fc('0x6b')][_0x35fc('0x81')]||0x12c),'interval':_0x35fc('0x7a')}]},routingClient);})[_0x35fc('0xa')](respondWithResult(_0x47c507,null))['catch'](handleError(_0x47c507,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 04bf367..7e213e4 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 _0xa5bf=['../../components/interaction/service','./schedule.controller','get','index','/:id','isAuthenticated','/:id/run','post','create','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x4287e9,_0x31f01c){var _0x2f8390=function(_0xb41856){while(--_0xb41856){_0x4287e9['push'](_0x4287e9['shift']());}};_0x2f8390(++_0x31f01c);}(_0xa5bf,0x8a));var _0xfa5b=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa5bf[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0xfa5b('0x0'));var util=require(_0xfa5b('0x1'));var path=require(_0xfa5b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa5b('0x3')]();var fs_extra=require(_0xfa5b('0x4'));var auth=require(_0xfa5b('0x5'));var interaction=require(_0xfa5b('0x6'));var config=require('../../config/environment');var controller=require(_0xfa5b('0x7'));router[_0xfa5b('0x8')]('/',auth['isAuthenticated'](),controller[_0xfa5b('0x9')]);router[_0xfa5b('0x8')](_0xfa5b('0xa'),auth[_0xfa5b('0xb')](),controller['show']);router['get'](_0xfa5b('0xc'),auth[_0xfa5b('0xb')](),controller['run']);router[_0xfa5b('0xd')]('/',auth['isAuthenticated'](),controller[_0xfa5b('0xe')]);router['put'](_0xfa5b('0xa'),auth[_0xfa5b('0xb')](),controller[_0xfa5b('0xf')]);router['delete'](_0xfa5b('0xa'),auth[_0xfa5b('0xb')](),controller[_0xfa5b('0x10')]);module[_0xfa5b('0x11')]=router; \ No newline at end of file +var _0xcfee=['run','post','create','put','/:id','update','delete','multer','util','path','express','Router','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','show','/:id/run'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xcfee,0xc5));var _0xecfe=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xcfee[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0xecfe('0x0'));var util=require(_0xecfe('0x1'));var path=require(_0xecfe('0x2'));var timeout=require('connect-timeout');var express=require(_0xecfe('0x3'));var router=express[_0xecfe('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xecfe('0x5'));var config=require('../../config/environment');var controller=require(_0xecfe('0x6'));router[_0xecfe('0x7')]('/',auth[_0xecfe('0x8')](),controller[_0xecfe('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xecfe('0xa')]);router[_0xecfe('0x7')](_0xecfe('0xb'),auth[_0xecfe('0x8')](),controller[_0xecfe('0xc')]);router[_0xecfe('0xd')]('/',auth[_0xecfe('0x8')](),controller[_0xecfe('0xe')]);router[_0xecfe('0xf')](_0xecfe('0x10'),auth[_0xecfe('0x8')](),controller[_0xecfe('0x11')]);router[_0xecfe('0x12')](_0xecfe('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e2d3565..7cefdc8 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 _0xe9d4=['years','weeks','hours','csv','xlsx','custom','default','TEXT','BOOLEAN','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x34bf03,_0x7ebc65){var _0x478925=function(_0x46508c){while(--_0x46508c){_0x34bf03['push'](_0x34bf03['shift']());}};_0x478925(++_0x7ebc65);}(_0xe9d4,0x1a9));var _0x4e9d=function(_0x1474f8,_0x442f7f){_0x1474f8=_0x1474f8-0x0;var _0x1239e1=_0xe9d4[_0x1474f8];return _0x1239e1;};'use strict';var Sequelize=require(_0x4e9d('0x0'));module[_0x4e9d('0x1')]={'name':{'type':Sequelize[_0x4e9d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4e9d('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4e9d('0x3')},'startAt':{'type':Sequelize[_0x4e9d('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x4e9d('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4e9d('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x4e9d('0x6')](_0x4e9d('0x7'),'quarters','months',_0x4e9d('0x8'),'days',_0x4e9d('0x9'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0x4e9d('0xa'),'pdf',_0x4e9d('0xb')),'allowNull':![],'defaultValue':_0x4e9d('0xa')},'type':{'type':Sequelize['ENUM'](_0x4e9d('0xc'),_0x4e9d('0xd')),'allowNull':![],'defaultValue':_0x4e9d('0xc')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x4e9d('0x2')]},'cc':{'type':Sequelize[_0x4e9d('0xe')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x4e9d('0xf')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb1fb=['sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months','weeks','days','csv','pdf','xlsx','custom','default','BOOLEAN','TEXT'];(function(_0x78db5e,_0x3b9804){var _0x250b88=function(_0x20a40f){while(--_0x20a40f){_0x78db5e['push'](_0x78db5e['shift']());}};_0x250b88(++_0x3b9804);}(_0xb1fb,0x6c));var _0xbb1f=function(_0x161b83,_0x523463){_0x161b83=_0x161b83-0x0;var _0x127739=_0xb1fb[_0x161b83];return _0x127739;};'use strict';var Sequelize=require(_0xbb1f('0x0'));module[_0xbb1f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xbb1f('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xbb1f('0x2')],'allowNull':![],'defaultValue':_0xbb1f('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xbb1f('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xbb1f('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xbb1f('0x6')](_0xbb1f('0x7'),'quarters',_0xbb1f('0x8'),_0xbb1f('0x9'),_0xbb1f('0xa'),'hours','minutes'),'allowNull':![],'defaultValue':_0xbb1f('0xa')},'output':{'type':Sequelize['ENUM'](_0xbb1f('0xb'),_0xbb1f('0xc'),_0xbb1f('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0xbb1f('0xe'),_0xbb1f('0xf')),'allowNull':![],'defaultValue':_0xbb1f('0xe')},'sendMail':{'type':Sequelize[_0xbb1f('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0xbb1f('0x2')]},'cc':{'type':Sequelize[_0xbb1f('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xbb1f('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 34d4e1d..345c3b1 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 _0xcdfe=['model','query','keys','filters','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','intersection','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','querystring','../../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','undefined','count','limit','set','Content-Range','apply','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','map','Schedule','rawAttributes','fieldName','type','key'];(function(_0x731a89,_0x26a5f0){var _0x12e6f4=function(_0x93af26){while(--_0x93af26){_0x731a89['push'](_0x731a89['shift']());}};_0x12e6f4(++_0x26a5f0);}(_0xcdfe,0x119));var _0xecdf=function(_0x44a7ea,_0x187d83){_0x44a7ea=_0x44a7ea-0x0;var _0x4a7a91=_0xcdfe[_0x44a7ea];return _0x4a7a91;};'use strict';var emlformat=require(_0xecdf('0x0'));var rimraf=require(_0xecdf('0x1'));var zipdir=require(_0xecdf('0x2'));var jsonpatch=require(_0xecdf('0x3'));var rp=require('request-promise');var moment=require(_0xecdf('0x4'));var BPromise=require(_0xecdf('0x5'));var Mustache=require(_0xecdf('0x6'));var util=require(_0xecdf('0x7'));var path=require(_0xecdf('0x8'));var sox=require('sox');var csv=require(_0xecdf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xecdf('0xa'));var _=require(_0xecdf('0xb'));var squel=require(_0xecdf('0xc'));var crypto=require(_0xecdf('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xecdf('0x9'));var querystring=require(_0xecdf('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xecdf('0xf'));var qs=require(_0xecdf('0x10'));var as=require(_0xecdf('0x11'));var hardwareService=require(_0xecdf('0x12'));var logger=require(_0xecdf('0x13'))('api');var utils=require(_0xecdf('0x14'));var config=require(_0xecdf('0x15'));var licenseUtil=require(_0xecdf('0x16'));var db=require(_0xecdf('0x17'))['db'];function respondWithStatusCode(_0x39a9c2,_0x5d204a){_0x5d204a=_0x5d204a||0xcc;return function(_0x4a1c63){if(_0x4a1c63){return _0x39a9c2[_0xecdf('0x18')](_0x5d204a);}return _0x39a9c2[_0xecdf('0x19')](_0x5d204a)[_0xecdf('0x1a')]();};}function respondWithResult(_0x1c35c3,_0x52e2d5){_0x52e2d5=_0x52e2d5||0xc8;return function(_0x256320){if(_0x256320){return _0x1c35c3[_0xecdf('0x19')](_0x52e2d5)[_0xecdf('0x1b')](_0x256320);}};}function respondWithFilteredResult(_0x22b1fe,_0x1c002f){return function(_0x3530d2){if(_0x3530d2){var _0xb47be2=typeof _0x1c002f[_0xecdf('0x1c')]===_0xecdf('0x1d')&&typeof _0x1c002f['limit']===_0xecdf('0x1d');var _0x1f4a1b=_0x3530d2[_0xecdf('0x1e')];var _0x34336b=_0xb47be2?0x0:_0x1c002f[_0xecdf('0x1c')];var _0x4aaa84=_0xb47be2?_0x3530d2[_0xecdf('0x1e')]:_0x1c002f[_0xecdf('0x1c')]+_0x1c002f[_0xecdf('0x1f')];var _0x34c52b;if(_0x4aaa84>=_0x1f4a1b){_0x4aaa84=_0x1f4a1b;_0x34c52b=0xc8;}else{_0x34c52b=0xce;}_0x22b1fe['status'](_0x34c52b);return _0x22b1fe[_0xecdf('0x20')](_0xecdf('0x21'),_0x34336b+'-'+_0x4aaa84+'/'+_0x1f4a1b)[_0xecdf('0x1b')](_0x3530d2);}return null;};}function patchUpdates(_0x2c504d){return function(_0x5ed38e){try{jsonpatch[_0xecdf('0x22')](_0x5ed38e,_0x2c504d,!![]);}catch(_0x3f5286){return BPromise['reject'](_0x3f5286);}return _0x5ed38e['save']();};}function saveUpdates(_0x34823c,_0x5eb286){return function(_0x31398d){if(_0x31398d){return _0x31398d[_0xecdf('0x23')](_0x34823c)[_0xecdf('0x24')](function(_0x18c4d2){return _0x18c4d2;});}return null;};}function removeEntity(_0x2ceba2,_0x4c7928){return function(_0x495354){if(_0x495354){return _0x495354[_0xecdf('0x25')]()[_0xecdf('0x24')](function(){var _0x5a554d=_0x495354[_0xecdf('0x26')]({'plain':!![]});var _0x2aeacd=_0xecdf('0x27');return db[_0xecdf('0x28')][_0xecdf('0x25')]({'where':{'type':_0x2aeacd,'resourceId':_0x5a554d['id']}})['then'](function(){return _0x495354;});})[_0xecdf('0x24')](function(){_0x2ceba2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45254e,_0x4bdad6){return function(_0x2f93b3){if(!_0x2f93b3){_0x45254e[_0xecdf('0x18')](0x194);}return _0x2f93b3;};}function handleError(_0x49a580,_0xe9d0b5){_0xe9d0b5=_0xe9d0b5||0x1f4;return function(_0x55f058){logger[_0xecdf('0x29')](_0x55f058[_0xecdf('0x2a')]);if(_0x55f058[_0xecdf('0x2b')]){delete _0x55f058[_0xecdf('0x2b')];}_0x49a580[_0xecdf('0x19')](_0xe9d0b5)[_0xecdf('0x2c')](_0x55f058);};}exports['index']=function(_0x3374a4,_0xc2b404){var _0x1aa109={},_0x1f168f={},_0x609f49={'count':0x0,'rows':[]};var _0x11a38c=_[_0xecdf('0x2d')](db[_0xecdf('0x2e')][_0xecdf('0x2f')],function(_0x1f6db1){return{'name':_0x1f6db1[_0xecdf('0x30')],'type':_0x1f6db1[_0xecdf('0x31')][_0xecdf('0x32')]};});_0x1f168f[_0xecdf('0x33')]=_[_0xecdf('0x2d')](_0x11a38c,_0xecdf('0x2b'));_0x1f168f[_0xecdf('0x34')]=_[_0xecdf('0x35')](_0x3374a4[_0xecdf('0x34')]);_0x1f168f[_0xecdf('0x36')]=_['intersection'](_0x1f168f[_0xecdf('0x33')],_0x1f168f[_0xecdf('0x34')]);_0x1aa109[_0xecdf('0x37')]=_['intersection'](_0x1f168f[_0xecdf('0x33')],qs[_0xecdf('0x38')](_0x3374a4[_0xecdf('0x34')]['fields']));_0x1aa109[_0xecdf('0x37')]=_0x1aa109['attributes']['length']?_0x1aa109[_0xecdf('0x37')]:_0x1f168f[_0xecdf('0x33')];if(!_0x3374a4[_0xecdf('0x34')]['hasOwnProperty'](_0xecdf('0x39'))){_0x1aa109[_0xecdf('0x1f')]=qs[_0xecdf('0x1f')](_0x3374a4[_0xecdf('0x34')][_0xecdf('0x1f')]);_0x1aa109[_0xecdf('0x1c')]=qs[_0xecdf('0x1c')](_0x3374a4[_0xecdf('0x34')][_0xecdf('0x1c')]);}_0x1aa109['order']=qs[_0xecdf('0x3a')](_0x3374a4['query'][_0xecdf('0x3a')]);_0x1aa109[_0xecdf('0x3b')]=qs[_0xecdf('0x36')](_[_0xecdf('0x3c')](_0x3374a4['query'],_0x1f168f['filters']),_0x11a38c);if(_0x3374a4[_0xecdf('0x34')][_0xecdf('0x3d')]){_0x1aa109['where']=_[_0xecdf('0x3e')](_0x1aa109[_0xecdf('0x3b')],{'$or':_[_0xecdf('0x2d')](_0x11a38c,function(_0x35aeaf){if(_0x35aeaf[_0xecdf('0x31')]!==_0xecdf('0x3f')){var _0x357757={};_0x357757[_0x35aeaf['name']]={'$like':'%'+_0x3374a4['query'][_0xecdf('0x3d')]+'%'};return _0x357757;}})});}_0x1aa109=_['merge']({},_0x1aa109,_0x3374a4['options']);var _0x59b268={'where':_0x1aa109['where']};return db[_0xecdf('0x2e')][_0xecdf('0x1e')](_0x59b268)['then'](function(_0x311b89){_0x609f49[_0xecdf('0x1e')]=_0x311b89;if(_0x3374a4['query'][_0xecdf('0x40')]){_0x1aa109[_0xecdf('0x41')]=[{'all':!![]}];}return db[_0xecdf('0x2e')][_0xecdf('0x42')](_0x1aa109);})[_0xecdf('0x24')](function(_0xe9d347){_0x609f49[_0xecdf('0x43')]=_0xe9d347;return _0x609f49;})[_0xecdf('0x24')](respondWithFilteredResult(_0xc2b404,_0x1aa109))[_0xecdf('0x44')](handleError(_0xc2b404,null));};exports['show']=function(_0x2ec317,_0x19a9c8){var _0x1dd0eb={'raw':![],'where':{'id':_0x2ec317[_0xecdf('0x45')]['id']}},_0x13b685={};_0x13b685[_0xecdf('0x33')]=_[_0xecdf('0x35')](db[_0xecdf('0x2e')]['rawAttributes']);_0x13b685['query']=_[_0xecdf('0x35')](_0x2ec317[_0xecdf('0x34')]);_0x13b685[_0xecdf('0x36')]=_[_0xecdf('0x46')](_0x13b685['model'],_0x13b685[_0xecdf('0x34')]);_0x1dd0eb[_0xecdf('0x37')]=_[_0xecdf('0x46')](_0x13b685[_0xecdf('0x33')],qs[_0xecdf('0x38')](_0x2ec317[_0xecdf('0x34')][_0xecdf('0x38')]));_0x1dd0eb['attributes']=_0x1dd0eb[_0xecdf('0x37')][_0xecdf('0x47')]?_0x1dd0eb[_0xecdf('0x37')]:_0x13b685[_0xecdf('0x33')];if(_0x2ec317[_0xecdf('0x34')][_0xecdf('0x40')]){_0x1dd0eb[_0xecdf('0x41')]=[{'all':!![]}];}_0x1dd0eb=_['merge']({},_0x1dd0eb,_0x2ec317['options']);return db[_0xecdf('0x2e')][_0xecdf('0x48')](_0x1dd0eb)[_0xecdf('0x24')](handleEntityNotFound(_0x19a9c8,null))['then'](respondWithResult(_0x19a9c8,null))[_0xecdf('0x44')](handleError(_0x19a9c8,null));};exports[_0xecdf('0x49')]=function(_0x2c46db,_0x8fc384){return db[_0xecdf('0x2e')][_0xecdf('0x49')](_0x2c46db[_0xecdf('0x4a')],{})['then'](function(_0x21f177){var _0x4b49f0=_0x2c46db[_0xecdf('0x4b')][_0xecdf('0x26')]({'plain':!![]});if(!_0x4b49f0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b49f0[_0xecdf('0x4c')]==='user'){var _0x21a2e2=_0x21f177['get']({'plain':!![]});var _0x3fb4cd=_0xecdf('0x27');return db[_0xecdf('0x4d')]['find']({'where':{'name':_0x3fb4cd,'userProfileId':_0x4b49f0[_0xecdf('0x4e')]},'raw':!![]})[_0xecdf('0x24')](function(_0x2413ff){if(_0x2413ff&&_0x2413ff[_0xecdf('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x21a2e2[_0xecdf('0x2b')],'resourceId':_0x21a2e2['id'],'type':_0x2413ff['name'],'sectionId':_0x2413ff['id']},{})['then'](function(){return _0x21f177;});}else{return _0x21f177;}})[_0xecdf('0x44')](function(_0x450c1b){logger[_0xecdf('0x29')](_0xecdf('0x50'),_0x450c1b);throw _0x450c1b;});}return _0x21f177;})[_0xecdf('0x24')](respondWithResult(_0x8fc384,0xc9))[_0xecdf('0x44')](handleError(_0x8fc384,null));};exports['update']=function(_0x11d2f7,_0xedbc99){if(_0x11d2f7[_0xecdf('0x4a')]['id']){delete _0x11d2f7[_0xecdf('0x4a')]['id'];}return db[_0xecdf('0x2e')][_0xecdf('0x48')]({'where':{'id':_0x11d2f7[_0xecdf('0x45')]['id']}})[_0xecdf('0x24')](handleEntityNotFound(_0xedbc99,null))['then'](saveUpdates(_0x11d2f7[_0xecdf('0x4a')],null))[_0xecdf('0x24')](respondWithResult(_0xedbc99,null))[_0xecdf('0x44')](handleError(_0xedbc99,null));};exports[_0xecdf('0x25')]=function(_0x278df4,_0x1c9012){return db[_0xecdf('0x2e')][_0xecdf('0x48')]({'where':{'id':_0x278df4[_0xecdf('0x45')]['id']}})[_0xecdf('0x24')](handleEntityNotFound(_0x1c9012,null))[_0xecdf('0x24')](removeEntity(_0x1c9012,null))[_0xecdf('0x44')](handleError(_0x1c9012,null));};exports[_0xecdf('0x51')]=function(_0x410d21,_0x336146,_0x5ed322){var _0x340e76=require(_0xecdf('0x52'));return db[_0xecdf('0x2e')][_0xecdf('0x48')]({'where':{'id':_0x410d21[_0xecdf('0x45')]['id']},'raw':!![]})[_0xecdf('0x24')](handleEntityNotFound(_0x336146,null))[_0xecdf('0x24')](function(){_0x340e76[_0xecdf('0x51')](_0x410d21[_0xecdf('0x45')]['id']);})[_0xecdf('0x24')](respondWithStatusCode(_0x336146,null))[_0xecdf('0x44')](handleError(_0x336146,null));}; \ No newline at end of file +var _0x2799=['sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','Scheduler','UserProfileResource','error','stack','name','send','index','Schedule','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path'];(function(_0x1b9aab,_0x20d674){var _0x29e352=function(_0x57ae0b){while(--_0x57ae0b){_0x1b9aab['push'](_0x1b9aab['shift']());}};_0x29e352(++_0x20d674);}(_0x2799,0x1ac));var _0x9279=function(_0x36bfd7,_0x2c7e4e){_0x36bfd7=_0x36bfd7-0x0;var _0x2f3735=_0x2799[_0x36bfd7];return _0x2f3735;};'use strict';var emlformat=require(_0x9279('0x0'));var rimraf=require(_0x9279('0x1'));var zipdir=require(_0x9279('0x2'));var jsonpatch=require(_0x9279('0x3'));var rp=require(_0x9279('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9279('0x5'));var path=require(_0x9279('0x6'));var sox=require(_0x9279('0x7'));var csv=require(_0x9279('0x8'));var ejs=require(_0x9279('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9279('0xa'));var jsforce=require(_0x9279('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9279('0x8'));var querystring=require(_0x9279('0xc'));var Papa=require(_0x9279('0xd'));var Redis=require(_0x9279('0xe'));var authService=require(_0x9279('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9279('0x10'));var hardwareService=require(_0x9279('0x11'));var logger=require(_0x9279('0x12'))(_0x9279('0x13'));var utils=require(_0x9279('0x14'));var config=require(_0x9279('0x15'));var licenseUtil=require(_0x9279('0x16'));var db=require(_0x9279('0x17'))['db'];function respondWithStatusCode(_0x556154,_0x35ef9d){_0x35ef9d=_0x35ef9d||0xcc;return function(_0x25eb52){if(_0x25eb52){return _0x556154[_0x9279('0x18')](_0x35ef9d);}return _0x556154[_0x9279('0x19')](_0x35ef9d)[_0x9279('0x1a')]();};}function respondWithResult(_0x54e38b,_0x412618){_0x412618=_0x412618||0xc8;return function(_0x2540c9){if(_0x2540c9){return _0x54e38b[_0x9279('0x19')](_0x412618)['json'](_0x2540c9);}};}function respondWithFilteredResult(_0x9e7c9e,_0x367df0){return function(_0x1fd0f4){if(_0x1fd0f4){var _0x27edc6=typeof _0x367df0['offset']===_0x9279('0x1b')&&typeof _0x367df0[_0x9279('0x1c')]===_0x9279('0x1b');var _0x255eb2=_0x1fd0f4[_0x9279('0x1d')];var _0xd5db95=_0x27edc6?0x0:_0x367df0['offset'];var _0x157308=_0x27edc6?_0x1fd0f4[_0x9279('0x1d')]:_0x367df0[_0x9279('0x1e')]+_0x367df0[_0x9279('0x1c')];var _0x53e218;if(_0x157308>=_0x255eb2){_0x157308=_0x255eb2;_0x53e218=0xc8;}else{_0x53e218=0xce;}_0x9e7c9e[_0x9279('0x19')](_0x53e218);return _0x9e7c9e[_0x9279('0x1f')](_0x9279('0x20'),_0xd5db95+'-'+_0x157308+'/'+_0x255eb2)[_0x9279('0x21')](_0x1fd0f4);}return null;};}function patchUpdates(_0x2293da){return function(_0x2f1205){try{jsonpatch[_0x9279('0x22')](_0x2f1205,_0x2293da,!![]);}catch(_0x3be71f){return BPromise[_0x9279('0x23')](_0x3be71f);}return _0x2f1205[_0x9279('0x24')]();};}function saveUpdates(_0x40c321,_0x1c3585){return function(_0x2aa844){if(_0x2aa844){return _0x2aa844[_0x9279('0x25')](_0x40c321)[_0x9279('0x26')](function(_0x4e8d9e){return _0x4e8d9e;});}return null;};}function removeEntity(_0xf07871,_0x318c83){return function(_0x5cd6f0){if(_0x5cd6f0){return _0x5cd6f0[_0x9279('0x27')]()[_0x9279('0x26')](function(){var _0x2b8b65=_0x5cd6f0['get']({'plain':!![]});var _0x41b17c=_0x9279('0x28');return db[_0x9279('0x29')][_0x9279('0x27')]({'where':{'type':_0x41b17c,'resourceId':_0x2b8b65['id']}})['then'](function(){return _0x5cd6f0;});})['then'](function(){_0xf07871[_0x9279('0x19')](0xcc)[_0x9279('0x1a')]();});}};}function handleEntityNotFound(_0x11addc,_0x20ac10){return function(_0x24a24e){if(!_0x24a24e){_0x11addc['sendStatus'](0x194);}return _0x24a24e;};}function handleError(_0x2bf67c,_0x449a07){_0x449a07=_0x449a07||0x1f4;return function(_0x1715a7){logger[_0x9279('0x2a')](_0x1715a7[_0x9279('0x2b')]);if(_0x1715a7['name']){delete _0x1715a7[_0x9279('0x2c')];}_0x2bf67c[_0x9279('0x19')](_0x449a07)[_0x9279('0x2d')](_0x1715a7);};}exports[_0x9279('0x2e')]=function(_0x33e670,_0x1f3734){var _0x1cdb79={},_0x1e4faf={},_0x1c4fd4={'count':0x0,'rows':[]};var _0x271d11=_['map'](db[_0x9279('0x2f')][_0x9279('0x30')],function(_0x1bdd17){return{'name':_0x1bdd17[_0x9279('0x31')],'type':_0x1bdd17['type'][_0x9279('0x32')]};});_0x1e4faf[_0x9279('0x33')]=_['map'](_0x271d11,_0x9279('0x2c'));_0x1e4faf[_0x9279('0x34')]=_['keys'](_0x33e670['query']);_0x1e4faf[_0x9279('0x35')]=_[_0x9279('0x36')](_0x1e4faf[_0x9279('0x33')],_0x1e4faf['query']);_0x1cdb79['attributes']=_[_0x9279('0x36')](_0x1e4faf[_0x9279('0x33')],qs[_0x9279('0x37')](_0x33e670[_0x9279('0x34')][_0x9279('0x37')]));_0x1cdb79['attributes']=_0x1cdb79[_0x9279('0x38')][_0x9279('0x39')]?_0x1cdb79[_0x9279('0x38')]:_0x1e4faf['model'];if(!_0x33e670['query'][_0x9279('0x3a')]('nolimit')){_0x1cdb79[_0x9279('0x1c')]=qs[_0x9279('0x1c')](_0x33e670[_0x9279('0x34')][_0x9279('0x1c')]);_0x1cdb79[_0x9279('0x1e')]=qs[_0x9279('0x1e')](_0x33e670[_0x9279('0x34')][_0x9279('0x1e')]);}_0x1cdb79['order']=qs[_0x9279('0x3b')](_0x33e670['query'][_0x9279('0x3b')]);_0x1cdb79[_0x9279('0x3c')]=qs[_0x9279('0x35')](_['pick'](_0x33e670[_0x9279('0x34')],_0x1e4faf[_0x9279('0x35')]),_0x271d11);if(_0x33e670['query'][_0x9279('0x3d')]){_0x1cdb79['where']=_['merge'](_0x1cdb79['where'],{'$or':_[_0x9279('0x3e')](_0x271d11,function(_0x5b4700){if(_0x5b4700['type']!==_0x9279('0x3f')){var _0x14eb0a={};_0x14eb0a[_0x5b4700[_0x9279('0x2c')]]={'$like':'%'+_0x33e670[_0x9279('0x34')][_0x9279('0x3d')]+'%'};return _0x14eb0a;}})});}_0x1cdb79=_[_0x9279('0x40')]({},_0x1cdb79,_0x33e670[_0x9279('0x41')]);var _0x4fc781={'where':_0x1cdb79[_0x9279('0x3c')]};return db[_0x9279('0x2f')]['count'](_0x4fc781)[_0x9279('0x26')](function(_0x9c1db8){_0x1c4fd4[_0x9279('0x1d')]=_0x9c1db8;if(_0x33e670[_0x9279('0x34')][_0x9279('0x42')]){_0x1cdb79[_0x9279('0x43')]=[{'all':!![]}];}return db[_0x9279('0x2f')][_0x9279('0x44')](_0x1cdb79);})['then'](function(_0x304fde){_0x1c4fd4[_0x9279('0x45')]=_0x304fde;return _0x1c4fd4;})['then'](respondWithFilteredResult(_0x1f3734,_0x1cdb79))['catch'](handleError(_0x1f3734,null));};exports[_0x9279('0x46')]=function(_0x201355,_0x14d5a0){var _0x23e6d8={'raw':![],'where':{'id':_0x201355[_0x9279('0x47')]['id']}},_0x575a41={};_0x575a41[_0x9279('0x33')]=_[_0x9279('0x48')](db[_0x9279('0x2f')]['rawAttributes']);_0x575a41[_0x9279('0x34')]=_[_0x9279('0x48')](_0x201355[_0x9279('0x34')]);_0x575a41[_0x9279('0x35')]=_[_0x9279('0x36')](_0x575a41['model'],_0x575a41[_0x9279('0x34')]);_0x23e6d8[_0x9279('0x38')]=_[_0x9279('0x36')](_0x575a41[_0x9279('0x33')],qs['fields'](_0x201355[_0x9279('0x34')][_0x9279('0x37')]));_0x23e6d8['attributes']=_0x23e6d8[_0x9279('0x38')][_0x9279('0x39')]?_0x23e6d8[_0x9279('0x38')]:_0x575a41[_0x9279('0x33')];if(_0x201355[_0x9279('0x34')]['includeAll']){_0x23e6d8['include']=[{'all':!![]}];}_0x23e6d8=_[_0x9279('0x40')]({},_0x23e6d8,_0x201355['options']);return db[_0x9279('0x2f')]['find'](_0x23e6d8)[_0x9279('0x26')](handleEntityNotFound(_0x14d5a0,null))['then'](respondWithResult(_0x14d5a0,null))[_0x9279('0x49')](handleError(_0x14d5a0,null));};exports[_0x9279('0x4a')]=function(_0x473807,_0x1efb7c){return db[_0x9279('0x2f')]['create'](_0x473807[_0x9279('0x4b')],{})['then'](function(_0xd24129){var _0x8f0582=_0x473807[_0x9279('0x4c')][_0x9279('0x4d')]({'plain':!![]});if(!_0x8f0582)throw new Error(_0x9279('0x4e'));if(_0x8f0582[_0x9279('0x4f')]===_0x9279('0x4c')){var _0x361656=_0xd24129['get']({'plain':!![]});var _0x2ca6f9=_0x9279('0x28');return db[_0x9279('0x50')]['find']({'where':{'name':_0x2ca6f9,'userProfileId':_0x8f0582[_0x9279('0x51')]},'raw':!![]})[_0x9279('0x26')](function(_0x50f51d){if(_0x50f51d&&_0x50f51d[_0x9279('0x52')]===0x0){return db[_0x9279('0x29')][_0x9279('0x4a')]({'name':_0x361656[_0x9279('0x2c')],'resourceId':_0x361656['id'],'type':_0x50f51d[_0x9279('0x2c')],'sectionId':_0x50f51d['id']},{})[_0x9279('0x26')](function(){return _0xd24129;});}else{return _0xd24129;}})[_0x9279('0x49')](function(_0x46bf53){logger['error'](_0x9279('0x53'),_0x46bf53);throw _0x46bf53;});}return _0xd24129;})[_0x9279('0x26')](respondWithResult(_0x1efb7c,0xc9))[_0x9279('0x49')](handleError(_0x1efb7c,null));};exports[_0x9279('0x25')]=function(_0x5e6da6,_0x1ee805){if(_0x5e6da6[_0x9279('0x4b')]['id']){delete _0x5e6da6[_0x9279('0x4b')]['id'];}return db[_0x9279('0x2f')][_0x9279('0x54')]({'where':{'id':_0x5e6da6[_0x9279('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ee805,null))[_0x9279('0x26')](saveUpdates(_0x5e6da6[_0x9279('0x4b')],null))[_0x9279('0x26')](respondWithResult(_0x1ee805,null))[_0x9279('0x49')](handleError(_0x1ee805,null));};exports[_0x9279('0x27')]=function(_0x22bece,_0x5b34e5){return db[_0x9279('0x2f')][_0x9279('0x54')]({'where':{'id':_0x22bece[_0x9279('0x47')]['id']}})[_0x9279('0x26')](handleEntityNotFound(_0x5b34e5,null))[_0x9279('0x26')](removeEntity(_0x5b34e5,null))[_0x9279('0x49')](handleError(_0x5b34e5,null));};exports[_0x9279('0x55')]=function(_0x530da8,_0x31fced,_0x14be2d){var _0x3972b1=require(_0x9279('0x56'));return db[_0x9279('0x2f')][_0x9279('0x54')]({'where':{'id':_0x530da8[_0x9279('0x47')]['id']},'raw':!![]})[_0x9279('0x26')](handleEntityNotFound(_0x31fced,null))['then'](function(){_0x3972b1['run'](_0x530da8[_0x9279('0x47')]['id']);})[_0x9279('0x26')](respondWithStatusCode(_0x31fced,null))[_0x9279('0x49')](handleError(_0x31fced,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 66bc4a8..333550c 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 _0x2d22=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash'];(function(_0x581542,_0x467036){var _0x252c80=function(_0x468c05){while(--_0x468c05){_0x581542['push'](_0x581542['shift']());}};_0x252c80(++_0x467036);}(_0x2d22,0x144));var _0x22d2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2d22[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x22d2('0x0'));var util=require(_0x22d2('0x1'));var logger=require('../../config/logger')(_0x22d2('0x2'));var moment=require(_0x22d2('0x3'));var BPromise=require(_0x22d2('0x4'));var rp=require(_0x22d2('0x5'));var fs=require('fs');var path=require(_0x22d2('0x6'));var rimraf=require(_0x22d2('0x7'));var config=require(_0x22d2('0x8'));var attributes=require(_0x22d2('0x9'));module[_0x22d2('0xa')]=function(_0x860e1b,_0x47cd2f){return _0x860e1b[_0x22d2('0xb')]('Schedule',attributes,{'tableName':_0x22d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bf0=['rimraf','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules','api','moment','bluebird','request-promise','path'];(function(_0x4121e9,_0x3b2034){var _0x59df50=function(_0x5a13d1){while(--_0x5a13d1){_0x4121e9['push'](_0x4121e9['shift']());}};_0x59df50(++_0x3b2034);}(_0x8bf0,0xe2));var _0x08bf=function(_0x4026a3,_0x41cc0e){_0x4026a3=_0x4026a3-0x0;var _0x57123e=_0x8bf0[_0x4026a3];return _0x57123e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x08bf('0x0'));var moment=require(_0x08bf('0x1'));var BPromise=require(_0x08bf('0x2'));var rp=require(_0x08bf('0x3'));var fs=require('fs');var path=require(_0x08bf('0x4'));var rimraf=require(_0x08bf('0x5'));var config=require(_0x08bf('0x6'));var attributes=require(_0x08bf('0x7'));module['exports']=function(_0x28c783,_0x2cc9e1){return _0x28c783[_0x08bf('0x8')](_0x08bf('0x9'),attributes,{'tableName':_0x08bf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 4cd97ec..9cd940f 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 _0xb825=['client','http','request','info','request\x20sent','debug','stringify','error','Schedule,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xb5fc3e,_0x234703){var _0x2efc3c=function(_0x4e4e44){while(--_0x4e4e44){_0xb5fc3e['push'](_0xb5fc3e['shift']());}};_0x2efc3c(++_0x234703);}(_0xb825,0x10f));var _0x5b82=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb825[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x5b82('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5b82('0x1'));var rs=require(_0x5b82('0x2'));var fs=require('fs');var Redis=require(_0x5b82('0x3'));var db=require(_0x5b82('0x4'))['db'];var utils=require(_0x5b82('0x5'));var logger=require(_0x5b82('0x6'))('rpc');var config=require(_0x5b82('0x7'));var jayson=require(_0x5b82('0x8'));var client=jayson[_0x5b82('0x9')][_0x5b82('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d26e5,_0x53d225,_0x516e6f){return new BPromise(function(_0x52b352,_0x168fbd){return client[_0x5b82('0xb')](_0x3d26e5,_0x516e6f)['then'](function(_0x42e6fb){logger[_0x5b82('0xc')]('Schedule,\x20%s,\x20%s',_0x53d225,_0x5b82('0xd'));logger[_0x5b82('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x53d225,'request\x20sent',JSON[_0x5b82('0xf')](_0x42e6fb));if(_0x42e6fb[_0x5b82('0x10')]){if(_0x42e6fb[_0x5b82('0x10')]['code']===0x1f4){logger[_0x5b82('0x10')](_0x5b82('0x11'),_0x53d225,_0x42e6fb[_0x5b82('0x10')][_0x5b82('0x12')]);return _0x168fbd(_0x42e6fb[_0x5b82('0x10')][_0x5b82('0x12')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x53d225,_0x42e6fb[_0x5b82('0x10')]['message']);return _0x52b352(_0x42e6fb[_0x5b82('0x10')][_0x5b82('0x12')]);}else{logger[_0x5b82('0xc')](_0x5b82('0x11'),_0x53d225,_0x5b82('0xd'));_0x52b352(_0x42e6fb['result'][_0x5b82('0x12')]);}})[_0x5b82('0x13')](function(_0x10eed1){logger[_0x5b82('0x10')]('Schedule,\x20%s,\x20%s',_0x53d225,_0x10eed1);_0x168fbd(_0x10eed1);});});} \ No newline at end of file +var _0x9315=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20aa03,_0x4ef3d5){var _0x10cf93=function(_0x54fbcc){while(--_0x54fbcc){_0x20aa03['push'](_0x20aa03['shift']());}};_0x10cf93(++_0x4ef3d5);}(_0x9315,0x19f));var _0x5931=function(_0x2e7caf,_0x131716){_0x2e7caf=_0x2e7caf-0x0;var _0x5958d9=_0x9315[_0x2e7caf];return _0x5958d9;};'use strict';var _=require('lodash');var util=require(_0x5931('0x0'));var moment=require('moment');var BPromise=require(_0x5931('0x1'));var rs=require(_0x5931('0x2'));var fs=require('fs');var Redis=require(_0x5931('0x3'));var db=require(_0x5931('0x4'))['db'];var utils=require(_0x5931('0x5'));var logger=require(_0x5931('0x6'))('rpc');var config=require(_0x5931('0x7'));var jayson=require(_0x5931('0x8'));var client=jayson[_0x5931('0x9')][_0x5931('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf496a8,_0x567cb8,_0xb5ef0){return new BPromise(function(_0x18bf8c,_0x56035c){return client[_0x5931('0xb')](_0xf496a8,_0xb5ef0)['then'](function(_0x1c4ba8){logger['info'](_0x5931('0xc'),_0x567cb8,_0x5931('0xd'));logger[_0x5931('0xe')](_0x5931('0xf'),_0x567cb8,_0x5931('0xd'),JSON[_0x5931('0x10')](_0x1c4ba8));if(_0x1c4ba8['error']){if(_0x1c4ba8[_0x5931('0x11')]['code']===0x1f4){logger[_0x5931('0x11')](_0x5931('0xc'),_0x567cb8,_0x1c4ba8['error'][_0x5931('0x12')]);return _0x56035c(_0x1c4ba8[_0x5931('0x11')]['message']);}logger[_0x5931('0x11')](_0x5931('0xc'),_0x567cb8,_0x1c4ba8[_0x5931('0x11')][_0x5931('0x12')]);return _0x18bf8c(_0x1c4ba8[_0x5931('0x11')][_0x5931('0x12')]);}else{logger[_0x5931('0x13')](_0x5931('0xc'),_0x567cb8,'request\x20sent');_0x18bf8c(_0x1c4ba8['result'][_0x5931('0x12')]);}})[_0x5931('0x14')](function(_0xcff070){logger[_0x5931('0x11')](_0x5931('0xc'),_0x567cb8,_0xcff070);_0x56035c(_0xcff070);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index a50d6a7..19264a3 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 _0x1233=['show','/:id/download','download','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1233,0x13d));var _0x3123=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x1233[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x3123('0x0'));var util=require(_0x3123('0x1'));var path=require(_0x3123('0x2'));var timeout=require('connect-timeout');var express=require(_0x3123('0x3'));var router=express[_0x3123('0x4')]();var fs_extra=require(_0x3123('0x5'));var auth=require(_0x3123('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3123('0x7'));var controller=require('./screenRecording.controller');router[_0x3123('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3123('0x9'),auth[_0x3123('0xa')](),controller[_0x3123('0xb')]);router[_0x3123('0x8')](_0x3123('0xc'),auth[_0x3123('0xa')](),controller[_0x3123('0xd')]);router[_0x3123('0x8')](_0x3123('0xe'),auth[_0x3123('0xa')](),controller[_0x3123('0xf')]);router[_0x3123('0x10')]('/',auth[_0x3123('0xa')](),controller[_0x3123('0x11')]);router[_0x3123('0x12')](_0x3123('0xc'),auth[_0x3123('0xa')](),controller['update']);router[_0x3123('0x13')](_0x3123('0xc'),auth[_0x3123('0xa')](),controller[_0x3123('0x14')]);module[_0x3123('0x15')]=router; \ No newline at end of file +var _0x4639=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','/:id/download','download','post','create','put'];(function(_0x187ad3,_0x5f5ce6){var _0x50e4b9=function(_0xc43aae){while(--_0xc43aae){_0x187ad3['push'](_0x187ad3['shift']());}};_0x50e4b9(++_0x5f5ce6);}(_0x4639,0x115));var _0x9463=function(_0x928b87,_0x53480a){_0x928b87=_0x928b87-0x0;var _0x1e7638=_0x4639[_0x928b87];return _0x1e7638;};'use strict';var multer=require(_0x9463('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9463('0x1'));var express=require(_0x9463('0x2'));var router=express[_0x9463('0x3')]();var fs_extra=require(_0x9463('0x4'));var auth=require(_0x9463('0x5'));var interaction=require(_0x9463('0x6'));var config=require(_0x9463('0x7'));var controller=require('./screenRecording.controller');router[_0x9463('0x8')]('/',auth[_0x9463('0x9')](),controller['index']);router['get'](_0x9463('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x9463('0x8')](_0x9463('0xb'),auth[_0x9463('0x9')](),controller['show']);router[_0x9463('0x8')](_0x9463('0xc'),auth[_0x9463('0x9')](),controller[_0x9463('0xd')]);router[_0x9463('0xe')]('/',auth[_0x9463('0x9')](),controller[_0x9463('0xf')]);router[_0x9463('0x10')](_0x9463('0xb'),auth[_0x9463('0x9')](),controller[_0x9463('0x11')]);router[_0x9463('0x12')](_0x9463('0xb'),auth[_0x9463('0x9')](),controller[_0x9463('0x13')]);module[_0x9463('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 4ae2fd0..7bc8cde 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 _0x86dc=['exports','VIRTUAL','getDataValue','extname','value','STRING','replace','INTEGER','setDataValue','startedAt','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','../../config/environment'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0x86dc,0x13e));var _0xc86d=function(_0x1081a4,_0x23f56c){_0x1081a4=_0x1081a4-0x0;var _0x4fb521=_0x86dc[_0x1081a4];return _0x4fb521;};'use strict';var Sequelize=require(_0xc86d('0x0'));var moment=require('moment');var path=require('path');var config=require(_0xc86d('0x1'));module[_0xc86d('0x2')]={'format':{'type':Sequelize[_0xc86d('0x3')],'get':function(){return this[_0xc86d('0x4')]('value')?path[_0xc86d('0x5')](this['getDataValue'](_0xc86d('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc86d('0x7')]},'value':{'type':Sequelize[_0xc86d('0x7')],'set':function(_0x21114c){var _0x56ac0e=_0x21114c[_0xc86d('0x8')](/\\/g,'/');this['setDataValue'](_0xc86d('0x6'),_0x56ac0e);}},'rating':{'type':Sequelize[_0xc86d('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x5078d8){this[_0xc86d('0xa')](_0xc86d('0xb'),moment()['subtract'](_0x5078d8,'ms'));this[_0xc86d('0xa')](_0xc86d('0xc'),moment());this[_0xc86d('0xa')](_0xc86d('0xd'),_0x5078d8);}},'startedAt':{'type':Sequelize[_0xc86d('0xe')],'get':function(){return moment(this[_0xc86d('0x4')](_0xc86d('0xb')))[_0xc86d('0xf')](_0xc86d('0x10'))[_0xc86d('0x11')]();}},'closedAt':{'type':Sequelize[_0xc86d('0xe')],'get':function(){return moment(this[_0xc86d('0x4')](_0xc86d('0xc')))[_0xc86d('0xf')](_0xc86d('0x10'))[_0xc86d('0x11')]();}},'createdAt':{'type':Sequelize[_0xc86d('0xe')],'get':function(){return moment(this[_0xc86d('0x4')](_0xc86d('0x12')))[_0xc86d('0xf')](_0xc86d('0x10'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xc86d('0x13')))[_0xc86d('0xf')](_0xc86d('0x10'))[_0xc86d('0x11')]();}}}; \ No newline at end of file +var _0x3746=['../../config/environment','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','MM-DD-YYYY\x20HH:mm','toString','DATE','format','updatedAt','sequelize','moment'];(function(_0x4fa0ea,_0x2cd534){var _0x51d027=function(_0xe67342){while(--_0xe67342){_0x4fa0ea['push'](_0x4fa0ea['shift']());}};_0x51d027(++_0x2cd534);}(_0x3746,0xa9));var _0x6374=function(_0x19be65,_0x51fe3e){_0x19be65=_0x19be65-0x0;var _0x87d155=_0x3746[_0x19be65];return _0x87d155;};'use strict';var Sequelize=require(_0x6374('0x0'));var moment=require(_0x6374('0x1'));var path=require('path');var config=require(_0x6374('0x2'));module['exports']={'format':{'type':Sequelize[_0x6374('0x3')],'get':function(){return this[_0x6374('0x4')]('value')?path['extname'](this[_0x6374('0x4')](_0x6374('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x6374('0x6')]},'channel':{'type':Sequelize[_0x6374('0x6')]},'value':{'type':Sequelize[_0x6374('0x6')],'set':function(_0x46841a){var _0x2e8717=_0x46841a[_0x6374('0x7')](/\\/g,'/');this[_0x6374('0x8')](_0x6374('0x5'),_0x2e8717);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x6374('0x9')],'set':function(_0x5bd695){this[_0x6374('0x8')](_0x6374('0xa'),moment()[_0x6374('0xb')](_0x5bd695,'ms'));this['setDataValue'](_0x6374('0xc'),moment());this[_0x6374('0x8')](_0x6374('0xd'),_0x5bd695);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x6374('0x4')](_0x6374('0xa')))['format'](_0x6374('0xe'))[_0x6374('0xf')]();}},'closedAt':{'type':Sequelize[_0x6374('0x10')],'get':function(){return moment(this['getDataValue'](_0x6374('0xc')))[_0x6374('0x11')](_0x6374('0xe'))['toString']();}},'createdAt':{'type':Sequelize[_0x6374('0x10')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x6374('0x11')]('MM-DD-YYYY\x20HH:mm')[_0x6374('0xf')]();}},'updatedAt':{'type':Sequelize[_0x6374('0x10')],'get':function(){return moment(this[_0x6374('0x4')](_0x6374('0x12')))[_0x6374('0x11')](_0x6374('0xe'))[_0x6374('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 81bccd5..0caaeb7 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 _0x81bd=['Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','duration','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','root','%s.cypher','existsSync','secrets','recording','join','server/files/screen_recordings'];(function(_0x2ac2f8,_0x38391c){var _0x2af1b7=function(_0x314ca1){while(--_0x314ca1){_0x2ac2f8['push'](_0x2ac2f8['shift']());}};_0x2af1b7(++_0x38391c);}(_0x81bd,0x7c));var _0xd81b=function(_0x496cba,_0x92dd1f){_0x496cba=_0x496cba-0x0;var _0x248927=_0x81bd[_0x496cba];return _0x248927;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2ccedf,_0x1bf351){return function(_0x596389){if(!_0x596389){_0x2ccedf[_0xd81b('0x1b')](0x194);}return _0x596389;};}function handleError(_0x99dbc9,_0xe3637a){_0xe3637a=_0xe3637a||0x1f4;return function(_0x31b9fd){logger[_0xd81b('0x2a')](_0x31b9fd[_0xd81b('0x2b')]);if(_0x31b9fd[_0xd81b('0x2c')]){delete _0x31b9fd[_0xd81b('0x2c')];}_0x99dbc9[_0xd81b('0x1d')](_0xe3637a)['send'](_0x31b9fd);};}exports[_0xd81b('0x2d')]=function(_0x4e2eff,_0x5c8aee){var _0xb9ff9f={},_0x260310={},_0x5141e6={'count':0x0,'rows':[]};var _0x481454=_[_0xd81b('0x2e')](db[_0xd81b('0x2f')][_0xd81b('0x30')],function(_0x289f54){return{'name':_0x289f54[_0xd81b('0x31')],'type':_0x289f54[_0xd81b('0x32')]['key']};});_0x260310[_0xd81b('0x33')]=_[_0xd81b('0x34')](_['map'](_0x481454,'name'),[_0xd81b('0x35')]);_0x260310[_0xd81b('0x36')]=_['keys'](_0x4e2eff['query']);_0x260310['filters']=_[_0xd81b('0x37')](_0x260310[_0xd81b('0x33')],_0x260310[_0xd81b('0x36')]);_0xb9ff9f[_0xd81b('0x38')]=_[_0xd81b('0x37')](_0x260310[_0xd81b('0x33')],qs[_0xd81b('0x39')](_0x4e2eff['query'][_0xd81b('0x39')]));_0xb9ff9f['attributes']=_0xb9ff9f[_0xd81b('0x38')][_0xd81b('0x3a')]?_0xb9ff9f[_0xd81b('0x38')]:_0x260310[_0xd81b('0x33')];if(!_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x3b')](_0xd81b('0x3c'))){_0xb9ff9f[_0xd81b('0x20')]=qs[_0xd81b('0x20')](_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x20')]);_0xb9ff9f[_0xd81b('0x22')]=qs[_0xd81b('0x22')](_0x4e2eff['query']['offset']);}_0xb9ff9f[_0xd81b('0x3d')]=qs[_0xd81b('0x3e')](_0x4e2eff[_0xd81b('0x36')]['sort']);_0xb9ff9f[_0xd81b('0x3f')]=qs[_0xd81b('0x40')](_['pick'](_0x4e2eff[_0xd81b('0x36')],_0x260310[_0xd81b('0x40')]),_0x481454);if(_0x4e2eff['query'][_0xd81b('0x41')]){_0xb9ff9f['where']=_[_0xd81b('0x42')](_0xb9ff9f[_0xd81b('0x3f')],{'$or':_[_0xd81b('0x2e')](_0x481454,function(_0x3f6deb){if(_0x3f6deb['type']!==_0xd81b('0x43')){var _0x3444d4={};_0x3444d4[_0x3f6deb[_0xd81b('0x2c')]]={'$like':'%'+_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x41')]+'%'};return _0x3444d4;}})});}_0xb9ff9f=_[_0xd81b('0x42')]({},_0xb9ff9f,_0x4e2eff[_0xd81b('0x44')]);var _0x532ada={'where':_0xb9ff9f[_0xd81b('0x3f')]};return db[_0xd81b('0x2f')][_0xd81b('0x21')](_0x532ada)['then'](function(_0x3bea7d){_0x5141e6[_0xd81b('0x21')]=_0x3bea7d;if(_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x45')]){_0xb9ff9f[_0xd81b('0x46')]=[{'all':!![]}];}return db['ScreenRecording'][_0xd81b('0x47')](_0xb9ff9f);})[_0xd81b('0x28')](function(_0x448e24){_0x5141e6[_0xd81b('0x48')]=_0x448e24;return _0x5141e6;})[_0xd81b('0x28')](respondWithFilteredResult(_0x5c8aee,_0xb9ff9f))[_0xd81b('0x49')](handleError(_0x5c8aee,null));};exports[_0xd81b('0x4a')]=function(_0x486f0d,_0x4405a8){var _0x3ba339={'raw':![],'where':{'id':_0x486f0d['params']['id']}},_0x1e3690={};_0x1e3690[_0xd81b('0x33')]=_[_0xd81b('0x4b')](db[_0xd81b('0x2f')][_0xd81b('0x30')]);_0x1e3690[_0xd81b('0x36')]=_[_0xd81b('0x4b')](_0x486f0d[_0xd81b('0x36')]);_0x1e3690[_0xd81b('0x40')]=_['intersection'](_0x1e3690['model'],_0x1e3690[_0xd81b('0x36')]);_0x3ba339[_0xd81b('0x38')]=_[_0xd81b('0x37')](_0x1e3690[_0xd81b('0x33')],qs[_0xd81b('0x39')](_0x486f0d[_0xd81b('0x36')][_0xd81b('0x39')]));_0x3ba339[_0xd81b('0x38')]=_0x3ba339[_0xd81b('0x38')][_0xd81b('0x3a')]?_0x3ba339[_0xd81b('0x38')]:_0x1e3690[_0xd81b('0x33')];if(_0x486f0d['query'][_0xd81b('0x45')]){_0x3ba339[_0xd81b('0x46')]=[{'all':!![]}];}_0x3ba339=_[_0xd81b('0x42')]({},_0x3ba339,_0x486f0d[_0xd81b('0x44')]);return db[_0xd81b('0x2f')][_0xd81b('0x4c')](_0x3ba339)[_0xd81b('0x28')](handleEntityNotFound(_0x4405a8,null))[_0xd81b('0x28')](respondWithResult(_0x4405a8,null))[_0xd81b('0x49')](handleError(_0x4405a8,null));};exports['create']=function(_0xf401e0,_0x2368dd){return db[_0xd81b('0x2f')][_0xd81b('0x4d')](_0xf401e0['body'],{})[_0xd81b('0x28')](respondWithResult(_0x2368dd,0xc9))[_0xd81b('0x49')](handleError(_0x2368dd,null));};exports[_0xd81b('0x27')]=function(_0xe874b6,_0x2699e6){if(_0xe874b6[_0xd81b('0x4e')]['id']){delete _0xe874b6[_0xd81b('0x4e')]['id'];}delete _0xe874b6[_0xd81b('0x4e')][_0xd81b('0x4f')];delete _0xe874b6['body']['createdAt'];delete _0xe874b6[_0xd81b('0x4e')][_0xd81b('0x50')];delete _0xe874b6[_0xd81b('0x4e')][_0xd81b('0x51')];return db[_0xd81b('0x2f')][_0xd81b('0x4c')]({'where':{'id':_0xe874b6[_0xd81b('0x52')]['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2699e6,null))['then'](saveUpdates(_0xe874b6[_0xd81b('0x4e')],null))[_0xd81b('0x28')](respondWithResult(_0x2699e6,null))[_0xd81b('0x49')](handleError(_0x2699e6,null));};exports[_0xd81b('0x53')]=function(_0x4651d3,_0x59b13b){return db[_0xd81b('0x2f')][_0xd81b('0x53')]()['then'](respondWithResult(_0x59b13b,null))[_0xd81b('0x49')](handleError(_0x59b13b,null));};exports[_0xd81b('0x54')]=function(_0x100319,_0x3b7ed7,_0x21cd71){var _0xa366c8=require(_0xd81b('0x55'));var _0x22f588=![];var _0x3ed626={};if(_0x100319[_0xd81b('0x36')][_0xd81b('0x32')]&&_0x100319['query'][_0xd81b('0x32')]==='uniqueid'){_0x3ed626[_0xd81b('0x56')]=_0x100319[_0xd81b('0x52')]['id'];}else{_0x3ed626['id']=_0x100319[_0xd81b('0x52')]['id'];}return db[_0xd81b('0x2f')][_0xd81b('0x4c')]({'where':_0x3ed626,'attributes':['id',_0xd81b('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x3b7ed7,null))[_0xd81b('0x28')](function(_0xe0c9c6){if(_0xe0c9c6){var _0x51f5a1=path['join'](config[_0xd81b('0x57')],'server/files/screen_recordings',_0xe0c9c6[_0xd81b('0x51')]);var _0x51f066=util[_0xd81b('0x35')](_0xd81b('0x58'),_0x51f5a1);if(fs[_0xd81b('0x59')](_0x51f066)){_0x22f588=!![];return _0xa366c8['decryptFile'](_0x51f066,_0x51f5a1,config[_0xd81b('0x5a')][_0xd81b('0x5b')])['then'](function(){return _0xe0c9c6;});}return _0xe0c9c6;}})[_0xd81b('0x28')](function(_0x108aaf){if(_0x108aaf){var _0x5951ec=path[_0xd81b('0x5c')](config['root'],_0xd81b('0x5d'),_0x108aaf[_0xd81b('0x51')]);if(!fs[_0xd81b('0x59')](_0x5951ec)){throw new db[(_0xd81b('0x5e'))][(_0xd81b('0x5f'))](_0xd81b('0x60'));}if(_0x108aaf[_0xd81b('0x61')]){return _0x3b7ed7[_0xd81b('0x54')](_0x5951ec,_0x108aaf[_0xd81b('0x61')]+path[_0xd81b('0x62')](_0x5951ec),function(){if(_0x22f588){fs['unlink'](_0x5951ec);}});}else{return _0x3b7ed7[_0xd81b('0x54')](_0x5951ec,function(_0x434434){if(_0x22f588){fs[_0xd81b('0x63')](_0x5951ec);}});}}})[_0xd81b('0x49')](function(_0x1bdf37){if(_0x1bdf37[_0xd81b('0x64')]===_0xd81b('0x60')){_0x3b7ed7['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x3b7ed7,null);}});};exports[_0xd81b('0x29')]=function(_0x12b0bf,_0x37507e){return db[_0xd81b('0x2f')][_0xd81b('0x4c')]({'where':{'id':_0x12b0bf[_0xd81b('0x52')]['id']}})[_0xd81b('0x28')](function(_0x5afecf){if(_[_0xd81b('0x65')](_0x5afecf)){throw new ReferenceError(_0xd81b('0x66'));}return _0x5afecf;})[_0xd81b('0x28')](function(_0x2090e9){var _0x41719b=path[_0xd81b('0x5c')](config[_0xd81b('0x57')],'server/files/screen_recordings',_0x2090e9[_0xd81b('0x51')]);logger[_0xd81b('0x67')](_0xd81b('0x68'),_0x41719b);if(!_[_0xd81b('0x65')](_0x2090e9[_0xd81b('0x51')])&&fs[_0xd81b('0x59')](_0x41719b)){logger[_0xd81b('0x67')](_0xd81b('0x69')+_0x41719b+_0xd81b('0x6a'));fs[_0xd81b('0x6b')](_0x41719b);}_0x41719b=_0x41719b+_0xd81b('0x6c');if(!_[_0xd81b('0x65')](_0x2090e9['value'])&&fs[_0xd81b('0x59')](_0x41719b)){logger['info'](_0xd81b('0x69')+_0x41719b+_0xd81b('0x6a'));fs[_0xd81b('0x6b')](_0x41719b);}return _0x2090e9;})[_0xd81b('0x28')](function(_0xb94a69){if(!_0xb94a69)throw new InternalError();return _0xb94a69[_0xd81b('0x29')]();})[_0xd81b('0x28')](function(){_0x37507e[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();})[_0xd81b('0x49')](handleError(_0x37507e,null));}; \ No newline at end of file +var _0x55ca=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','moment','bluebird','util','path'];(function(_0x2b2538,_0x62cea8){var _0x3143d5=function(_0x40e200){while(--_0x40e200){_0x2b2538['push'](_0x2b2538['shift']());}};_0x3143d5(++_0x62cea8);}(_0x55ca,0x126));var _0xa55c=function(_0x2211d4,_0x592254){_0x2211d4=_0x2211d4-0x0;var _0x565b56=_0x55ca[_0x2211d4];return _0x565b56;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x2d')](_['map'](_0x201941,_0xa55c('0x25')),[_0xa55c('0x2e')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x906caa[_0xa55c('0x2f')]);_0x22f6b6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2f')]);_0x1377b0[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x22f6b6['model'],qs['fields'](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x1377b0['attributes']=_0x1377b0[_0xa55c('0x33')][_0xa55c('0x35')]?_0x1377b0[_0xa55c('0x33')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2f')][_0xa55c('0x36')](_0xa55c('0x37'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa['query']['limit']);_0x1377b0['offset']=qs[_0xa55c('0x1a')](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x1a')]);}_0x1377b0['order']=qs[_0xa55c('0x38')](_0x906caa['query'][_0xa55c('0x38')]);_0x1377b0['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x39')](_0x906caa[_0xa55c('0x2f')],_0x22f6b6['filters']),_0x201941);if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3a')]){_0x1377b0['where']=_[_0xa55c('0x3b')](_0x1377b0[_0xa55c('0x3c')],{'$or':_['map'](_0x201941,function(_0x529ff8){if(_0x529ff8[_0xa55c('0x2a')]!=='VIRTUAL'){var _0x1e75dc={};_0x1e75dc[_0x529ff8[_0xa55c('0x25')]]={'$like':'%'+_0x906caa['query']['filter']+'%'};return _0x1e75dc;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x3b3308={'where':_0x1377b0[_0xa55c('0x3c')]};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x3b3308)[_0xa55c('0x20')](function(_0x56d17c){_0x1b8388[_0xa55c('0x1d')]=_0x56d17c;if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3d')]){_0x1377b0[_0xa55c('0x3e')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0x1377b0);})['then'](function(_0x386e34){_0x1b8388['rows']=_0x386e34;return _0x1b8388;})['then'](respondWithFilteredResult(_0x5d940d,_0x1377b0))[_0xa55c('0x40')](handleError(_0x5d940d,null));};exports[_0xa55c('0x41')]=function(_0x496920,_0x2bd98b){var _0x508bd3={'raw':![],'where':{'id':_0x496920[_0xa55c('0x42')]['id']}},_0x5f25f7={};_0x5f25f7[_0xa55c('0x2c')]=_[_0xa55c('0x30')](db['ScreenRecording'][_0xa55c('0x43')]);_0x5f25f7[_0xa55c('0x2f')]=_['keys'](_0x496920[_0xa55c('0x2f')]);_0x5f25f7['filters']=_[_0xa55c('0x32')](_0x5f25f7[_0xa55c('0x2c')],_0x5f25f7['query']);_0x508bd3[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5f25f7['model'],qs[_0xa55c('0x34')](_0x496920[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x508bd3['attributes']=_0x508bd3[_0xa55c('0x33')]['length']?_0x508bd3[_0xa55c('0x33')]:_0x5f25f7[_0xa55c('0x2c')];if(_0x496920[_0xa55c('0x2f')]['includeAll']){_0x508bd3[_0xa55c('0x3e')]=[{'all':!![]}];}_0x508bd3=_[_0xa55c('0x3b')]({},_0x508bd3,_0x496920['options']);return db[_0xa55c('0x29')][_0xa55c('0x44')](_0x508bd3)['then'](handleEntityNotFound(_0x2bd98b,null))[_0xa55c('0x20')](respondWithResult(_0x2bd98b,null))[_0xa55c('0x40')](handleError(_0x2bd98b,null));};exports['create']=function(_0x46f839,_0x81cee8){return db[_0xa55c('0x29')][_0xa55c('0x45')](_0x46f839['body'],{})[_0xa55c('0x20')](respondWithResult(_0x81cee8,0xc9))['catch'](handleError(_0x81cee8,null));};exports[_0xa55c('0x1f')]=function(_0x213100,_0x194a79){if(_0x213100['body']['id']){delete _0x213100[_0xa55c('0x46')]['id'];}delete _0x213100[_0xa55c('0x46')]['duration'];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x47')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x48')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x49')];return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x213100[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x194a79,null))['then'](saveUpdates(_0x213100[_0xa55c('0x46')],null))[_0xa55c('0x20')](respondWithResult(_0x194a79,null))[_0xa55c('0x40')](handleError(_0x194a79,null));};exports['describe']=function(_0x4c3095,_0x35bf0a){return db['ScreenRecording'][_0xa55c('0x4a')]()['then'](respondWithResult(_0x35bf0a,null))[_0xa55c('0x40')](handleError(_0x35bf0a,null));};exports[_0xa55c('0x4b')]=function(_0x181802,_0x3f9313,_0x2ecf79){var _0x5b1cf3=require(_0xa55c('0x4c'));var _0x4607ca=![];var _0x4b85cc={};if(_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]&&_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]==='uniqueid'){_0x4b85cc['uniqueid']=_0x181802[_0xa55c('0x42')]['id'];}else{_0x4b85cc['id']=_0x181802[_0xa55c('0x42')]['id'];}return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':_0x4b85cc,'attributes':['id','value'],'raw':!![]})[_0xa55c('0x20')](handleEntityNotFound(_0x3f9313,null))['then'](function(_0x2742e4){if(_0x2742e4){var _0x437ced=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x2742e4['value']);var _0x1cb73b=util['format'](_0xa55c('0x50'),_0x437ced);if(fs[_0xa55c('0x51')](_0x1cb73b)){_0x4607ca=!![];return _0x5b1cf3[_0xa55c('0x52')](_0x1cb73b,_0x437ced,config[_0xa55c('0x53')][_0xa55c('0x54')])[_0xa55c('0x20')](function(){return _0x2742e4;});}return _0x2742e4;}})[_0xa55c('0x20')](function(_0x53e2be){if(_0x53e2be){var _0x450567=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x53e2be[_0xa55c('0x49')]);if(!fs['existsSync'](_0x450567)){throw new db[(_0xa55c('0x55'))][(_0xa55c('0x56'))](_0xa55c('0x57'));}if(_0x53e2be[_0xa55c('0x58')]){return _0x3f9313[_0xa55c('0x4b')](_0x450567,_0x53e2be['filename']+path[_0xa55c('0x59')](_0x450567),function(){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}else{return _0x3f9313[_0xa55c('0x4b')](_0x450567,function(_0x16d9b2){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}}})['catch'](function(_0x419fc3){if(_0x419fc3['message']===_0xa55c('0x57')){_0x3f9313['status'](0x194)[_0xa55c('0x26')]('Not\x20found');}else{return handleError(_0x3f9313,null);}});};exports[_0xa55c('0x5b')]=function(_0x1333da,_0x21d6b4){return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x1333da[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](function(_0x2f2226){if(_[_0xa55c('0x5c')](_0x2f2226)){throw new ReferenceError(_0xa55c('0x5d'));}return _0x2f2226;})['then'](function(_0x150a07){var _0x311bb9=path['join'](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x150a07[_0xa55c('0x49')]);logger[_0xa55c('0x5e')](_0xa55c('0x5f'),_0x311bb9);if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger['info'](_0xa55c('0x60')+_0x311bb9+_0xa55c('0x61'));fs[_0xa55c('0x62')](_0x311bb9);}_0x311bb9=_0x311bb9+_0xa55c('0x63');if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger[_0xa55c('0x5e')](_0xa55c('0x60')+_0x311bb9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa55c('0x62')](_0x311bb9);}return _0x150a07;})[_0xa55c('0x20')](function(_0x40c56a){if(!_0x40c56a)throw new InternalError();return _0x40c56a[_0xa55c('0x5b')]();})[_0xa55c('0x20')](function(){_0x21d6b4[_0xa55c('0x18')](0xcc)[_0xa55c('0x21')]();})[_0xa55c('0x40')](handleError(_0x21d6b4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 5e8caa5..fd00dc5 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 _0xdcd0=['rimraf','../../config/environment','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2421a6,_0x588e4e){var _0x239a6e=function(_0x254f69){while(--_0x254f69){_0x2421a6['push'](_0x2421a6['shift']());}};_0x239a6e(++_0x588e4e);}(_0xdcd0,0x164));var _0x0dcd=function(_0x3c99dd,_0x409d27){_0x3c99dd=_0x3c99dd-0x0;var _0xa0d3a9=_0xdcd0[_0x3c99dd];return _0xa0d3a9;};'use strict';var _=require(_0x0dcd('0x0'));var util=require(_0x0dcd('0x1'));var logger=require(_0x0dcd('0x2'))(_0x0dcd('0x3'));var moment=require(_0x0dcd('0x4'));var BPromise=require(_0x0dcd('0x5'));var rp=require(_0x0dcd('0x6'));var fs=require('fs');var path=require(_0x0dcd('0x7'));var rimraf=require(_0x0dcd('0x8'));var config=require(_0x0dcd('0x9'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x1ea7cd,_0x26e853){return _0x1ea7cd[_0x0dcd('0xa')](_0x0dcd('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x0dcd('0xc'),'fields':[_0x0dcd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf66=['rimraf','../../config/environment','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','bluebird','path'];(function(_0x73e730,_0x2d3393){var _0x2b5932=function(_0xa45930){while(--_0xa45930){_0x73e730['push'](_0x73e730['shift']());}};_0x2b5932(++_0x2d3393);}(_0xaf66,0x1ea));var _0x6af6=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0xaf66[_0x34232c];return _0x4d4f4e;};'use strict';var _=require('lodash');var util=require(_0x6af6('0x0'));var logger=require(_0x6af6('0x1'))(_0x6af6('0x2'));var moment=require('moment');var BPromise=require(_0x6af6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6af6('0x4'));var rimraf=require(_0x6af6('0x5'));var config=require(_0x6af6('0x6'));var attributes=require(_0x6af6('0x7'));module['exports']=function(_0x57fc8e,_0x214840){return _0x57fc8e['define'](_0x6af6('0x8'),attributes,{'tableName':_0x6af6('0x9'),'paranoid':![],'indexes':[{'name':_0x6af6('0xa'),'fields':[_0x6af6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 047b7d3..9dee705 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 _0x777c=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','moment','randomstring','../../mysqldb'];(function(_0x53b67d,_0x251707){var _0xff73e7=function(_0x5bafe4){while(--_0x5bafe4){_0x53b67d['push'](_0x53b67d['shift']());}};_0xff73e7(++_0x251707);}(_0x777c,0x1f4));var _0xc777=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x777c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc777('0x0'));var util=require('util');var moment=require(_0xc777('0x1'));var BPromise=require('bluebird');var rs=require(_0xc777('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc777('0x3'))['db'];var utils=require(_0xc777('0x4'));var logger=require(_0xc777('0x5'))(_0xc777('0x6'));var config=require('../../config/environment');var jayson=require(_0xc777('0x7'));var client=jayson['client'][_0xc777('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b4f46,_0x4eb48f,_0x3d320c){return new BPromise(function(_0x2360f6,_0x57ea2c){return client[_0xc777('0x9')](_0x1b4f46,_0x3d320c)[_0xc777('0xa')](function(_0x1cd51a){logger['info'](_0xc777('0xb'),_0x4eb48f,_0xc777('0xc'));logger['debug'](_0xc777('0xd'),_0x4eb48f,_0xc777('0xc'),JSON['stringify'](_0x1cd51a));if(_0x1cd51a[_0xc777('0xe')]){if(_0x1cd51a['error'][_0xc777('0xf')]===0x1f4){logger['error'](_0xc777('0xb'),_0x4eb48f,_0x1cd51a[_0xc777('0xe')][_0xc777('0x10')]);return _0x57ea2c(_0x1cd51a[_0xc777('0xe')][_0xc777('0x10')]);}logger[_0xc777('0xe')](_0xc777('0xb'),_0x4eb48f,_0x1cd51a[_0xc777('0xe')][_0xc777('0x10')]);return _0x2360f6(_0x1cd51a[_0xc777('0xe')]['message']);}else{logger[_0xc777('0x11')](_0xc777('0xb'),_0x4eb48f,_0xc777('0xc'));_0x2360f6(_0x1cd51a['result'][_0xc777('0x10')]);}})['catch'](function(_0x16a5ee){logger[_0xc777('0xe')](_0xc777('0xb'),_0x4eb48f,_0x16a5ee);_0x57ea2c(_0x16a5ee);});});} \ No newline at end of file +var _0xcc67=['ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x21b2d0,_0x832e75){var _0x2e4f83=function(_0x45980c){while(--_0x45980c){_0x21b2d0['push'](_0x21b2d0['shift']());}};_0x2e4f83(++_0x832e75);}(_0xcc67,0xd7));var _0x7cc6=function(_0x2d778e,_0x4f3fd2){_0x2d778e=_0x2d778e-0x0;var _0x223d07=_0xcc67[_0x2d778e];return _0x223d07;};'use strict';var _=require(_0x7cc6('0x0'));var util=require(_0x7cc6('0x1'));var moment=require('moment');var BPromise=require(_0x7cc6('0x2'));var rs=require(_0x7cc6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cc6('0x4'))['db'];var utils=require(_0x7cc6('0x5'));var logger=require(_0x7cc6('0x6'))(_0x7cc6('0x7'));var config=require(_0x7cc6('0x8'));var jayson=require(_0x7cc6('0x9'));var client=jayson['client'][_0x7cc6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38be9d,_0x2a02ba,_0x3522ce){return new BPromise(function(_0x5dbe9e,_0x3de44c){return client[_0x7cc6('0xb')](_0x38be9d,_0x3522ce)['then'](function(_0x29f7ca){logger[_0x7cc6('0xc')](_0x7cc6('0xd'),_0x2a02ba,_0x7cc6('0xe'));logger[_0x7cc6('0xf')](_0x7cc6('0x10'),_0x2a02ba,_0x7cc6('0xe'),JSON[_0x7cc6('0x11')](_0x29f7ca));if(_0x29f7ca[_0x7cc6('0x12')]){if(_0x29f7ca[_0x7cc6('0x12')]['code']===0x1f4){logger[_0x7cc6('0x12')](_0x7cc6('0xd'),_0x2a02ba,_0x29f7ca[_0x7cc6('0x12')]['message']);return _0x3de44c(_0x29f7ca['error'][_0x7cc6('0x13')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x2a02ba,_0x29f7ca[_0x7cc6('0x12')]['message']);return _0x5dbe9e(_0x29f7ca[_0x7cc6('0x12')]['message']);}else{logger['info'](_0x7cc6('0xd'),_0x2a02ba,'request\x20sent');_0x5dbe9e(_0x29f7ca['result'][_0x7cc6('0x13')]);}})[_0x7cc6('0x14')](function(_0x395181){logger['error'](_0x7cc6('0xd'),_0x2a02ba,_0x395181);_0x3de44c(_0x395181);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 7411d49..10677c2 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 _0x51f9=['preferred','addPreferred','favicon','extname','addFavicon','put','/:id','update','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','format','logo','originalname','post','single','file','addLogo','diskStorage','server/files/images/logos/','%s%s','logologin','addLogoLogin'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x51f9,0xb8));var _0x951f=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0x51f9[_0xd299c3];return _0x376574;};'use strict';var multer=require(_0x951f('0x0'));var util=require('util');var path=require(_0x951f('0x1'));var timeout=require('connect-timeout');var express=require(_0x951f('0x2'));var router=express[_0x951f('0x3')]();var fs_extra=require(_0x951f('0x4'));var auth=require(_0x951f('0x5'));var interaction=require(_0x951f('0x6'));var config=require(_0x951f('0x7'));var controller=require('./setting.controller');router[_0x951f('0x8')]('/',auth[_0x951f('0x9')](),controller['index']);router['get'](_0x951f('0xa'),controller[_0x951f('0xb')]);router['get']('/:id',controller[_0x951f('0xc')]);router[_0x951f('0x8')](_0x951f('0xd'),controller[_0x951f('0xe')]);router[_0x951f('0x8')](_0x951f('0xf'),controller['getLogoLogin']);router['get'](_0x951f('0x10'),controller[_0x951f('0x11')]);router['get'](_0x951f('0x12'),controller[_0x951f('0x13')]);router[_0x951f('0x8')](_0x951f('0x14'),controller[_0x951f('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x367d39,_0x2f1308,_0x151731){_0x151731(null,path[_0x951f('0x16')](config[_0x951f('0x17')],'server/files/images/logos/'));},'filename':function(_0x4638c2,_0x29ff1f,_0x1a9353){_0x1a9353(null,util[_0x951f('0x18')]('%s%s',_0x951f('0x19'),path['extname'](_0x29ff1f[_0x951f('0x1a')])));}})});router[_0x951f('0x1b')](_0x951f('0xd'),upload[_0x951f('0x1c')](_0x951f('0x1d')),controller[_0x951f('0x1e')]);var upload=multer({'storage':multer[_0x951f('0x1f')]({'destination':function(_0x499bdf,_0x3fc349,_0x592c23){_0x592c23(null,path[_0x951f('0x16')](config[_0x951f('0x17')],_0x951f('0x20')));},'filename':function(_0x57b54d,_0x341185,_0x491937){_0x491937(null,util['format'](_0x951f('0x21'),_0x951f('0x22'),path['extname'](_0x341185['originalname'])));}})});router[_0x951f('0x1b')](_0x951f('0xf'),upload[_0x951f('0x1c')](_0x951f('0x1d')),controller[_0x951f('0x23')]);var upload=multer({'storage':multer[_0x951f('0x1f')]({'destination':function(_0xef93c6,_0x19e743,_0x5f268c){_0x5f268c(null,path[_0x951f('0x16')](config[_0x951f('0x17')],_0x951f('0x20')));},'filename':function(_0x47e22e,_0x167a14,_0x25e3b4){_0x25e3b4(null,util[_0x951f('0x18')](_0x951f('0x21'),_0x951f('0x24'),path['extname'](_0x167a14[_0x951f('0x1a')])));}})});router[_0x951f('0x1b')]('/:id/preferred',upload[_0x951f('0x1c')](_0x951f('0x1d')),controller[_0x951f('0x25')]);var upload=multer({'storage':multer[_0x951f('0x1f')]({'destination':function(_0x3613e0,_0x1415cd,_0x1bbf83){_0x1bbf83(null,path[_0x951f('0x16')](config['root'],_0x951f('0x20')));},'filename':function(_0xab247f,_0x3a291b,_0x110168){_0x110168(null,util[_0x951f('0x18')](_0x951f('0x21'),_0x951f('0x26'),path[_0x951f('0x27')](_0x3a291b[_0x951f('0x1a')])));}})});router[_0x951f('0x1b')]('/:id/favicon',upload[_0x951f('0x1c')](_0x951f('0x1d')),controller[_0x951f('0x28')]);router[_0x951f('0x29')](_0x951f('0x2a'),auth['isAuthenticated'](),controller[_0x951f('0x2b')]);module['exports']=router; \ No newline at end of file +var _0xef0e=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','join','addPreferred','favicon','addFavicon','put','isAuthenticated','exports','multer'];(function(_0x24e6bb,_0x33402e){var _0x373f25=function(_0x34083c){while(--_0x34083c){_0x24e6bb['push'](_0x24e6bb['shift']());}};_0x373f25(++_0x33402e);}(_0xef0e,0xd6));var _0xeef0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xef0e[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xeef0('0x0'));var util=require(_0xeef0('0x1'));var path=require(_0xeef0('0x2'));var timeout=require(_0xeef0('0x3'));var express=require('express');var router=express[_0xeef0('0x4')]();var fs_extra=require(_0xeef0('0x5'));var auth=require(_0xeef0('0x6'));var interaction=require(_0xeef0('0x7'));var config=require('../../config/environment');var controller=require(_0xeef0('0x8'));router[_0xeef0('0x9')]('/',auth['isAuthenticated'](),controller[_0xeef0('0xa')]);router[_0xeef0('0x9')](_0xeef0('0xb'),controller[_0xeef0('0xc')]);router[_0xeef0('0x9')](_0xeef0('0xd'),controller[_0xeef0('0xe')]);router['get'](_0xeef0('0xf'),controller['getLogo']);router['get'](_0xeef0('0x10'),controller[_0xeef0('0x11')]);router[_0xeef0('0x9')](_0xeef0('0x12'),controller[_0xeef0('0x13')]);router[_0xeef0('0x9')](_0xeef0('0x14'),controller[_0xeef0('0x15')]);router[_0xeef0('0x9')](_0xeef0('0x16'),controller[_0xeef0('0x17')]);var upload=multer({'storage':multer[_0xeef0('0x18')]({'destination':function(_0x449354,_0x17c328,_0x2e7650){_0x2e7650(null,path['join'](config[_0xeef0('0x19')],_0xeef0('0x1a')));},'filename':function(_0x4df307,_0x428ddb,_0x4671dd){_0x4671dd(null,util[_0xeef0('0x1b')](_0xeef0('0x1c'),_0xeef0('0x1d'),path[_0xeef0('0x1e')](_0x428ddb[_0xeef0('0x1f')])));}})});router[_0xeef0('0x20')]('/:id/logo',upload[_0xeef0('0x21')](_0xeef0('0x22')),controller[_0xeef0('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x350aad,_0x31504a,_0x21826b){_0x21826b(null,path[_0xeef0('0x24')](config[_0xeef0('0x19')],_0xeef0('0x1a')));},'filename':function(_0xa70b40,_0x5820c8,_0x11f266){_0x11f266(null,util['format']('%s%s','logologin',path[_0xeef0('0x1e')](_0x5820c8[_0xeef0('0x1f')])));}})});router[_0xeef0('0x20')](_0xeef0('0x10'),upload[_0xeef0('0x21')](_0xeef0('0x22')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xeef0('0x18')]({'destination':function(_0x28f00f,_0x1fa55c,_0x22bc9e){_0x22bc9e(null,path['join'](config[_0xeef0('0x19')],_0xeef0('0x1a')));},'filename':function(_0x4cda52,_0x289d64,_0x3434db){_0x3434db(null,util[_0xeef0('0x1b')](_0xeef0('0x1c'),'preferred',path[_0xeef0('0x1e')](_0x289d64[_0xeef0('0x1f')])));}})});router[_0xeef0('0x20')](_0xeef0('0x14'),upload[_0xeef0('0x21')](_0xeef0('0x22')),controller[_0xeef0('0x25')]);var upload=multer({'storage':multer[_0xeef0('0x18')]({'destination':function(_0x42c815,_0x25ba45,_0x5c216a){_0x5c216a(null,path['join'](config[_0xeef0('0x19')],_0xeef0('0x1a')));},'filename':function(_0x49cfdb,_0x4874d5,_0x104780){_0x104780(null,util[_0xeef0('0x1b')](_0xeef0('0x1c'),_0xeef0('0x26'),path[_0xeef0('0x1e')](_0x4874d5[_0xeef0('0x1f')])));}})});router[_0xeef0('0x20')]('/:id/favicon',upload[_0xeef0('0x21')](_0xeef0('0x22')),controller[_0xeef0('0x27')]);router[_0xeef0('0x28')]('/:id',auth[_0xeef0('0x29')](),controller['update']);module[_0xeef0('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index e707e61..e9d4885 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 _0x5f66=['STRING','BOOLEAN','UNSIGNED','exports','min_internal','INTEGER','min_mailbox'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x65f6('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x65f6('0x2')](0xb),'unique':_0x65f6('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnusername':{'type':Sequelize[_0x65f6('0x4')]},'turnpassword':{'type':Sequelize[_0x65f6('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x65f6('0x4')]},'defaultPreferred':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x65f6('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x65f6('0x4')]},'defaultFavicon':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x65f6('0x4')]},'sentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x65f6('0x2')]},'sentimentRegion':{'type':Sequelize[_0x65f6('0x4')]},'language':{'type':Sequelize[_0x65f6('0x4')]},'bucket':{'type':Sequelize[_0x65f6('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x65f6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7a54=['UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate'];(function(_0x1e5884,_0x430c0e){var _0x23b143=function(_0x5de0a7){while(--_0x5de0a7){_0x1e5884['push'](_0x1e5884['shift']());}};_0x23b143(++_0x430c0e);}(_0x7a54,0x106));var _0x47a5=function(_0x1912b6,_0x54618f){_0x1912b6=_0x1912b6-0x0;var _0x278282=_0x7a54[_0x1912b6];return _0x278282;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'min_internal':{'type':Sequelize[_0x47a5('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x47a5('0x2')](0xb),'unique':_0x47a5('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':_0x47a5('0x5')},'logo':{'type':Sequelize[_0x47a5('0x4')]},'defaultLogo':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x47a5('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x47a5('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x47a5('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':_0x47a5('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x47a5('0x4')]},'defaultPreferred':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x47a5('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x47a5('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x47a5('0x2')]},'transcribeRegion':{'type':Sequelize[_0x47a5('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x47a5('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x47a5('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index a4314f5..af701e4 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 _0x19da=['merge','find','body','addLogo','file','logo','filename','addLogoLogin','getLogo','getLicense','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','custom','default_logo.svg','ValidationError','getLogoLogin','server/files/images/logos','loginLogo','preferred','defaultLoginLogo','default_loginLogo.svg','upperFirst','Sequelize','\x20not\x20found','download','gdpr','securePassword','addPreferred','default_preferred.png','default_favicon.ico','utcOffset','now','format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','findAll','rows','show','params','include'];(function(_0x240cce,_0x3a6b02){var _0x11de77=function(_0x5801cf){while(--_0x5801cf){_0x240cce['push'](_0x240cce['shift']());}};_0x11de77(++_0x3a6b02);}(_0x19da,0x9f));var _0xa19d=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0x19da[_0x413727];return _0x5f46d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa19d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa19d('0x1'));var rp=require('request-promise');var moment=require(_0xa19d('0x2'));var BPromise=require(_0xa19d('0x3'));var Mustache=require('mustache');var util=require(_0xa19d('0x4'));var path=require(_0xa19d('0x5'));var sox=require('sox');var csv=require(_0xa19d('0x6'));var ejs=require(_0xa19d('0x7'));var fs=require('fs');var fs_extra=require(_0xa19d('0x8'));var _=require(_0xa19d('0x9'));var squel=require(_0xa19d('0xa'));var crypto=require(_0xa19d('0xb'));var jsforce=require(_0xa19d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa19d('0x6'));var querystring=require(_0xa19d('0xd'));var Papa=require(_0xa19d('0xe'));var Redis=require('ioredis');var authService=require(_0xa19d('0xf'));var qs=require(_0xa19d('0x10'));var as=require(_0xa19d('0x11'));var hardwareService=require(_0xa19d('0x12'));var logger=require(_0xa19d('0x13'))(_0xa19d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa19d('0x15'));var db=require(_0xa19d('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa19d('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xf675b1,_0x4adf98,_0x32059b,_0x15438b){return new BPromise(function(_0x464b54,_0x4c8fff){var _0x4160fe=_0x15438b||client;return _0x4160fe['request'](_0xf675b1,_0x32059b)[_0xa19d('0x18')](function(_0x34a7d2){logger[_0xa19d('0x19')](_0xa19d('0x1a'),_0x4adf98,_0xa19d('0x1b'));logger[_0xa19d('0x1c')](_0xa19d('0x1d'),_0x4adf98,_0xa19d('0x1b'),JSON['stringify'](_0x34a7d2));if(_0x34a7d2[_0xa19d('0x1e')]){if(_0x34a7d2['error'][_0xa19d('0x1f')]===0x1f4){logger[_0xa19d('0x1e')](_0xa19d('0x1a'),_0x4adf98,_0x34a7d2[_0xa19d('0x1e')][_0xa19d('0x20')]);return _0x4c8fff(_0x34a7d2[_0xa19d('0x1e')][_0xa19d('0x20')]);}logger['error'](_0xa19d('0x1a'),_0x4adf98,_0x34a7d2[_0xa19d('0x1e')][_0xa19d('0x20')]);return _0x464b54(_0x34a7d2[_0xa19d('0x1e')][_0xa19d('0x20')]);}else{logger[_0xa19d('0x19')](_0xa19d('0x1a'),_0x4adf98,_0xa19d('0x1b'));_0x464b54(_0x34a7d2[_0xa19d('0x21')]['message']);}})[_0xa19d('0x22')](function(_0x53c103){logger[_0xa19d('0x1e')](_0xa19d('0x1a'),_0x4adf98,_0x53c103);_0x4c8fff(_0x53c103);});});}function respondWithStatusCode(_0x23efc1,_0x206e88){_0x206e88=_0x206e88||0xcc;return function(_0x1fcfd7){if(_0x1fcfd7){return _0x23efc1[_0xa19d('0x23')](_0x206e88);}return _0x23efc1[_0xa19d('0x24')](_0x206e88)[_0xa19d('0x25')]();};}function respondWithResult(_0x39127e,_0x43afdc){_0x43afdc=_0x43afdc||0xc8;return function(_0x2da56c){if(_0x2da56c){return _0x39127e[_0xa19d('0x24')](_0x43afdc)[_0xa19d('0x26')](_0x2da56c);}};}function respondWithFilteredResult(_0x441134,_0x118e03){return function(_0x2f4df8){if(_0x2f4df8){var _0x1971d8=typeof _0x118e03[_0xa19d('0x27')]===_0xa19d('0x28')&&typeof _0x118e03[_0xa19d('0x29')]===_0xa19d('0x28');var _0x574011=_0x2f4df8['count'];var _0x5c6537=_0x1971d8?0x0:_0x118e03[_0xa19d('0x27')];var _0x21b63b=_0x1971d8?_0x2f4df8[_0xa19d('0x2a')]:_0x118e03[_0xa19d('0x27')]+_0x118e03[_0xa19d('0x29')];var _0x4a5e15;if(_0x21b63b>=_0x574011){_0x21b63b=_0x574011;_0x4a5e15=0xc8;}else{_0x4a5e15=0xce;}_0x441134[_0xa19d('0x24')](_0x4a5e15);return _0x441134[_0xa19d('0x2b')](_0xa19d('0x2c'),_0x5c6537+'-'+_0x21b63b+'/'+_0x574011)[_0xa19d('0x26')](_0x2f4df8);}return null;};}function patchUpdates(_0x57f03e){return function(_0x340ca4){try{jsonpatch[_0xa19d('0x2d')](_0x340ca4,_0x57f03e,!![]);}catch(_0xe9f6f6){return BPromise['reject'](_0xe9f6f6);}return _0x340ca4['save']();};}function saveUpdates(_0x2e11ef,_0x124df6){return function(_0x49a1e0){if(_0x49a1e0){return _0x49a1e0[_0xa19d('0x2e')](_0x2e11ef)[_0xa19d('0x18')](function(_0x592234){return _0x592234;});}return null;};}function removeEntity(_0x163501,_0x1495a8){return function(_0x33a5b0){if(_0x33a5b0){return _0x33a5b0[_0xa19d('0x2f')]()[_0xa19d('0x18')](function(){_0x163501['status'](0xcc)[_0xa19d('0x25')]();});}};}function handleEntityNotFound(_0x2f7e0a,_0x132ec2){return function(_0x33ae7a){if(!_0x33ae7a){_0x2f7e0a[_0xa19d('0x23')](0x194);}return _0x33ae7a;};}function handleError(_0x508bd5,_0x2e223b){_0x2e223b=_0x2e223b||0x1f4;return function(_0xccb72f){logger[_0xa19d('0x1e')](_0xccb72f[_0xa19d('0x30')]);if(_0xccb72f[_0xa19d('0x31')]){delete _0xccb72f[_0xa19d('0x31')];}_0x508bd5[_0xa19d('0x24')](_0x2e223b)[_0xa19d('0x32')](_0xccb72f);};}exports['index']=function(_0x53a902,_0x12318a){var _0x539087={},_0x392a1a={},_0x3e6852={'count':0x0,'rows':[]};var _0x4a5bd7=_[_0xa19d('0x33')](db[_0xa19d('0x34')][_0xa19d('0x35')],function(_0x59fee1){return{'name':_0x59fee1[_0xa19d('0x36')],'type':_0x59fee1[_0xa19d('0x37')][_0xa19d('0x38')]};});_0x392a1a['model']=_[_0xa19d('0x33')](_0x4a5bd7,_0xa19d('0x31'));_0x392a1a[_0xa19d('0x39')]=_[_0xa19d('0x3a')](_0x53a902[_0xa19d('0x39')]);_0x392a1a[_0xa19d('0x3b')]=_[_0xa19d('0x3c')](_0x392a1a[_0xa19d('0x3d')],_0x392a1a[_0xa19d('0x39')]);_0x539087[_0xa19d('0x3e')]=_[_0xa19d('0x3c')](_0x392a1a['model'],qs[_0xa19d('0x3f')](_0x53a902[_0xa19d('0x39')]['fields']));_0x539087[_0xa19d('0x3e')]=_0x539087[_0xa19d('0x3e')][_0xa19d('0x40')]?_0x539087[_0xa19d('0x3e')]:_0x392a1a[_0xa19d('0x3d')];if(!_0x53a902[_0xa19d('0x39')][_0xa19d('0x41')](_0xa19d('0x42'))){_0x539087[_0xa19d('0x29')]=qs[_0xa19d('0x29')](_0x53a902['query'][_0xa19d('0x29')]);_0x539087[_0xa19d('0x27')]=qs[_0xa19d('0x27')](_0x53a902[_0xa19d('0x39')][_0xa19d('0x27')]);}_0x539087[_0xa19d('0x43')]=qs[_0xa19d('0x44')](_0x53a902['query']['sort']);_0x539087['where']=qs['filters'](_['pick'](_0x53a902['query'],_0x392a1a[_0xa19d('0x3b')]),_0x4a5bd7);if(_0x53a902['query'][_0xa19d('0x45')]){_0x539087[_0xa19d('0x46')]=_['merge'](_0x539087[_0xa19d('0x46')],{'$or':_[_0xa19d('0x33')](_0x4a5bd7,function(_0x50a128){if(_0x50a128[_0xa19d('0x37')]!==_0xa19d('0x47')){var _0x2c3d44={};_0x2c3d44[_0x50a128[_0xa19d('0x31')]]={'$like':'%'+_0x53a902['query'][_0xa19d('0x45')]+'%'};return _0x2c3d44;}})});}_0x539087=_['merge']({},_0x539087,_0x53a902[_0xa19d('0x48')]);var _0x58c93a={'where':_0x539087[_0xa19d('0x46')]};return db[_0xa19d('0x34')][_0xa19d('0x2a')](_0x58c93a)[_0xa19d('0x18')](function(_0x2a43f4){_0x3e6852['count']=_0x2a43f4;if(_0x53a902[_0xa19d('0x39')][_0xa19d('0x49')]){_0x539087['include']=[{'all':!![]}];}return db[_0xa19d('0x34')][_0xa19d('0x4a')](_0x539087);})[_0xa19d('0x18')](function(_0xfeae0e){_0x3e6852[_0xa19d('0x4b')]=_0xfeae0e;return _0x3e6852;})['then'](respondWithFilteredResult(_0x12318a,_0x539087))[_0xa19d('0x22')](handleError(_0x12318a,null));};exports[_0xa19d('0x4c')]=function(_0x164c66,_0x391d7c){var _0x40d60b={'raw':![],'where':{'id':_0x164c66[_0xa19d('0x4d')]['id']}},_0x15904f={};_0x15904f[_0xa19d('0x3d')]=_[_0xa19d('0x3a')](db[_0xa19d('0x34')][_0xa19d('0x35')]);_0x15904f['query']=_['keys'](_0x164c66[_0xa19d('0x39')]);_0x15904f['filters']=_[_0xa19d('0x3c')](_0x15904f[_0xa19d('0x3d')],_0x15904f['query']);_0x40d60b[_0xa19d('0x3e')]=_[_0xa19d('0x3c')](_0x15904f['model'],qs[_0xa19d('0x3f')](_0x164c66[_0xa19d('0x39')]['fields']));_0x40d60b[_0xa19d('0x3e')]=_0x40d60b[_0xa19d('0x3e')]['length']?_0x40d60b[_0xa19d('0x3e')]:_0x15904f[_0xa19d('0x3d')];if(_0x164c66[_0xa19d('0x39')][_0xa19d('0x49')]){_0x40d60b[_0xa19d('0x4e')]=[{'all':!![]}];}_0x40d60b=_[_0xa19d('0x4f')]({},_0x40d60b,_0x164c66[_0xa19d('0x48')]);return db['Setting'][_0xa19d('0x50')](_0x40d60b)[_0xa19d('0x18')](handleEntityNotFound(_0x391d7c,null))[_0xa19d('0x18')](respondWithResult(_0x391d7c,null))[_0xa19d('0x22')](handleError(_0x391d7c,null));};exports[_0xa19d('0x2e')]=function(_0x4702d6,_0x73168f){if(_0x4702d6[_0xa19d('0x51')]['id']){delete _0x4702d6[_0xa19d('0x51')]['id'];}return db[_0xa19d('0x34')][_0xa19d('0x50')]({'where':{'id':_0x4702d6[_0xa19d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x73168f,null))[_0xa19d('0x18')](saveUpdates(_0x4702d6['body'],null))[_0xa19d('0x18')](respondWithResult(_0x73168f,null))[_0xa19d('0x22')](handleError(_0x73168f,null));};exports[_0xa19d('0x52')]=function(_0x3ae94c,_0xd78de8,_0xe6d631){if(_0x3ae94c[_0xa19d('0x53')]&&_0x3ae94c[_0xa19d('0x53')]['filename']){_0x3ae94c[_0xa19d('0x51')][_0xa19d('0x54')]=_0x3ae94c[_0xa19d('0x53')][_0xa19d('0x55')];}return db[_0xa19d('0x34')][_0xa19d('0x50')]({'where':{'id':_0x3ae94c[_0xa19d('0x4d')]['id']}})[_0xa19d('0x18')](handleEntityNotFound(_0xd78de8,null))[_0xa19d('0x18')](saveUpdates(_0x3ae94c[_0xa19d('0x51')],null))[_0xa19d('0x18')](respondWithResult(_0xd78de8,null))[_0xa19d('0x22')](handleError(_0xd78de8,null));};exports[_0xa19d('0x56')]=function(_0x5c1025,_0x41ae91,_0x271c04){if(_0x5c1025[_0xa19d('0x53')]&&_0x5c1025[_0xa19d('0x53')][_0xa19d('0x55')]){_0x5c1025[_0xa19d('0x51')]['loginLogo']=_0x5c1025[_0xa19d('0x53')][_0xa19d('0x55')];}return db[_0xa19d('0x34')][_0xa19d('0x50')]({'where':{'id':_0x5c1025[_0xa19d('0x4d')]['id']}})[_0xa19d('0x18')](handleEntityNotFound(_0x41ae91,null))[_0xa19d('0x18')](saveUpdates(_0x5c1025[_0xa19d('0x51')],null))['then'](respondWithResult(_0x41ae91,null))[_0xa19d('0x22')](handleError(_0x41ae91,null));};var utilLicense=require(_0xa19d('0x15'));exports[_0xa19d('0x57')]=function(_0x4f0829,_0x1c7e9d,_0x6b3e90){var _0x186c16='server/files/images/logos';var _0x54b403={'custom':![]};return utilLicense[_0xa19d('0x58')]()['then'](function(_0x316855){if(_0x316855){_0x54b403=_0x316855;}return db[_0xa19d('0x34')][_0xa19d('0x50')]({'where':{'id':_0x4f0829[_0xa19d('0x4d')]['id']},'attributes':[_0xa19d('0x54'),'loginLogo','preferred',_0xa19d('0x59'),_0xa19d('0x5a'),'defaultLoginLogo',_0xa19d('0x5b'),_0xa19d('0x5c')],'raw':!![]});})[_0xa19d('0x18')](handleEntityNotFound(_0x1c7e9d,null))[_0xa19d('0x18')](function(_0x2a0d5b){if(_0x2a0d5b){var _0x1bd91c=_0x2a0d5b[_0xa19d('0x54')]&&fs[_0xa19d('0x5d')](path[_0xa19d('0x5e')](config[_0xa19d('0x5f')],_0x186c16,_[_0xa19d('0x60')](_0x2a0d5b[_0xa19d('0x54')])))?path[_0xa19d('0x5e')](config[_0xa19d('0x5f')],_0x186c16,_['toLower'](_0x2a0d5b[_0xa19d('0x54')])):path[_0xa19d('0x5e')](config[_0xa19d('0x5f')],_0x186c16,_[_0xa19d('0x60')]('default_logo.svg'));var _0x1e2bf4=_0xa19d('0x61')+_['upperFirst'](_0xa19d('0x54'));if(_0x2a0d5b[_0x1e2bf4]||!_0x54b403[_0xa19d('0x62')]){_0x1bd91c=path[_0xa19d('0x5e')](config[_0xa19d('0x5f')],_0x186c16,_[_0xa19d('0x60')](_0xa19d('0x63')));}if(!fs[_0xa19d('0x5d')](_0x1bd91c)){throw new db['Sequelize'][(_0xa19d('0x64'))](_['upperFirst']('logo')+'\x20not\x20found');}return _0x1c7e9d['download'](_0x1bd91c);}})['catch'](handleError(_0x1c7e9d,null));};var utilLicense=require(_0xa19d('0x15'));exports[_0xa19d('0x65')]=function(_0x5e6c7b,_0x517f46,_0x1f13be){var _0x5d7630=_0xa19d('0x66');var _0x3a65b4={'custom':![]};return utilLicense[_0xa19d('0x58')]()[_0xa19d('0x18')](function(_0x2f0a52){if(_0x2f0a52){_0x3a65b4=_0x2f0a52;}return db[_0xa19d('0x34')][_0xa19d('0x50')]({'where':{'id':_0x5e6c7b[_0xa19d('0x4d')]['id']},'attributes':[_0xa19d('0x54'),_0xa19d('0x67'),_0xa19d('0x68'),_0xa19d('0x59'),_0xa19d('0x5a'),_0xa19d('0x69'),_0xa19d('0x5b'),'defaultFavicon'],'raw':!![]});})[_0xa19d('0x18')](handleEntityNotFound(_0x517f46,null))[_0xa19d('0x18')](function(_0x31ce46){if(_0x31ce46){var _0x1142a6=_0x31ce46[_0xa19d('0x67')]&&fs[_0xa19d('0x5d')](path['join'](config[_0xa19d('0x5f')],_0x5d7630,_[_0xa19d('0x60')](_0x31ce46[_0xa19d('0x67')])))?path[_0xa19d('0x5e')](config['root'],_0x5d7630,_[_0xa19d('0x60')](_0x31ce46['loginLogo'])):path[_0xa19d('0x5e')](config[_0xa19d('0x5f')],_0x5d7630,_[_0xa19d('0x60')](_0xa19d('0x6a')));var _0x2939d5='default'+_[_0xa19d('0x6b')](_0xa19d('0x67'));if(_0x31ce46[_0x2939d5]||!_0x3a65b4[_0xa19d('0x62')]){_0x1142a6=path[_0xa19d('0x5e')](config['root'],_0x5d7630,_[_0xa19d('0x60')](_0xa19d('0x6a')));}if(!fs['existsSync'](_0x1142a6)){throw new db[(_0xa19d('0x6c'))][(_0xa19d('0x64'))](_[_0xa19d('0x6b')](_0xa19d('0x67'))+_0xa19d('0x6d'));}return _0x517f46[_0xa19d('0x6e')](_0x1142a6);}})[_0xa19d('0x22')](handleError(_0x517f46,null));};exports[_0xa19d('0x6f')]=function(_0x5dbc27,_0x565398){return db[_0xa19d('0x34')][_0xa19d('0x50')]({'where':{'id':_0x5dbc27[_0xa19d('0x4d')]['id']},'attributes':[_0xa19d('0x70')]})['then'](respondWithResult(_0x565398,null))['catch'](handleError(_0x565398,null));};exports[_0xa19d('0x71')]=function(_0x214cbe,_0x4480c6,_0x15f26a){if(_0x214cbe['file']&&_0x214cbe[_0xa19d('0x53')][_0xa19d('0x55')]){_0x214cbe['body'][_0xa19d('0x68')]=_0x214cbe['file'][_0xa19d('0x55')];}return db[_0xa19d('0x34')]['find']({'where':{'id':_0x214cbe[_0xa19d('0x4d')]['id']}})[_0xa19d('0x18')](handleEntityNotFound(_0x4480c6,null))['then'](saveUpdates(_0x214cbe[_0xa19d('0x51')],null))[_0xa19d('0x18')](respondWithResult(_0x4480c6,null))['catch'](handleError(_0x4480c6,null));};var utilLicense=require(_0xa19d('0x15'));exports['getPreferred']=function(_0x266ed4,_0x52caa1,_0x20b4a7){var _0x486090='server/files/images/logos';var _0x3777d2={'custom':![]};return utilLicense[_0xa19d('0x58')]()[_0xa19d('0x18')](function(_0x299117){if(_0x299117){_0x3777d2=_0x299117;}return db['Setting'][_0xa19d('0x50')]({'where':{'id':_0x266ed4['params']['id']},'attributes':[_0xa19d('0x54'),_0xa19d('0x67'),_0xa19d('0x68'),_0xa19d('0x59'),_0xa19d('0x5a'),'defaultLoginLogo','defaultPreferred',_0xa19d('0x5c')],'raw':!![]});})[_0xa19d('0x18')](handleEntityNotFound(_0x52caa1,null))['then'](function(_0x579794){if(_0x579794){var _0x3a80bd=_0x579794['preferred']&&fs[_0xa19d('0x5d')](path[_0xa19d('0x5e')](config['root'],_0x486090,_['toLower'](_0x579794['preferred'])))?path[_0xa19d('0x5e')](config[_0xa19d('0x5f')],_0x486090,_['toLower'](_0x579794['preferred'])):path[_0xa19d('0x5e')](config[_0xa19d('0x5f')],_0x486090,_[_0xa19d('0x60')](_0xa19d('0x72')));var _0x2bbf47=_0xa19d('0x61')+_['upperFirst'](_0xa19d('0x68'));if(_0x579794[_0x2bbf47]||!_0x3777d2[_0xa19d('0x62')]||!_0x3777d2[_0xa19d('0x68')]){_0x3a80bd=path[_0xa19d('0x5e')](config[_0xa19d('0x5f')],_0x486090,_[_0xa19d('0x60')](_0xa19d('0x72')));}if(!fs[_0xa19d('0x5d')](_0x3a80bd)){throw new db[(_0xa19d('0x6c'))][(_0xa19d('0x64'))](_[_0xa19d('0x6b')]('preferred')+_0xa19d('0x6d'));}return _0x52caa1[_0xa19d('0x6e')](_0x3a80bd);}})['catch'](handleError(_0x52caa1,null));};exports['addFavicon']=function(_0x2c3a17,_0x157582,_0xedf912){if(_0x2c3a17[_0xa19d('0x53')]&&_0x2c3a17[_0xa19d('0x53')][_0xa19d('0x55')]){_0x2c3a17[_0xa19d('0x51')][_0xa19d('0x59')]=_0x2c3a17[_0xa19d('0x53')]['filename'];}return db[_0xa19d('0x34')][_0xa19d('0x50')]({'where':{'id':_0x2c3a17[_0xa19d('0x4d')]['id']}})[_0xa19d('0x18')](handleEntityNotFound(_0x157582,null))[_0xa19d('0x18')](saveUpdates(_0x2c3a17['body'],null))['then'](respondWithResult(_0x157582,null))[_0xa19d('0x22')](handleError(_0x157582,null));};var utilLicense=require(_0xa19d('0x15'));exports['getFavicon']=function(_0x1f0a30,_0x41399b,_0x1e0fc6){var _0xf35f20='server/files/images/logos';var _0x14057a={'custom':![]};return utilLicense[_0xa19d('0x58')]()['then'](function(_0xd47dff){if(_0xd47dff){_0x14057a=_0xd47dff;}return db[_0xa19d('0x34')][_0xa19d('0x50')]({'where':{'id':_0x1f0a30[_0xa19d('0x4d')]['id']},'attributes':[_0xa19d('0x54'),_0xa19d('0x67'),_0xa19d('0x68'),_0xa19d('0x59'),_0xa19d('0x5a'),_0xa19d('0x69'),_0xa19d('0x5b'),_0xa19d('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x41399b,null))[_0xa19d('0x18')](function(_0xb04b5c){if(_0xb04b5c){var _0x28c540=_0xb04b5c[_0xa19d('0x59')]&&fs[_0xa19d('0x5d')](path[_0xa19d('0x5e')](config['root'],_0xf35f20,_[_0xa19d('0x60')](_0xb04b5c[_0xa19d('0x59')])))?path['join'](config['root'],_0xf35f20,_[_0xa19d('0x60')](_0xb04b5c['favicon'])):path['join'](config[_0xa19d('0x5f')],_0xf35f20,_[_0xa19d('0x60')](_0xa19d('0x73')));var _0xc3043c=_0xa19d('0x61')+_['upperFirst'](_0xa19d('0x59'));if(_0xb04b5c[_0xc3043c]||!_0x14057a[_0xa19d('0x62')]){_0x28c540=path[_0xa19d('0x5e')](config[_0xa19d('0x5f')],_0xf35f20,_[_0xa19d('0x60')](_0xa19d('0x73')));}if(!fs[_0xa19d('0x5d')](_0x28c540)){throw new db[(_0xa19d('0x6c'))][(_0xa19d('0x64'))](_[_0xa19d('0x6b')](_0xa19d('0x59'))+_0xa19d('0x6d'));}return _0x41399b[_0xa19d('0x6e')](_0x28c540);}})['catch'](handleError(_0x41399b,null));};exports['getDate']=function(_0x3e10dc,_0x575e5a){var _0x5c73c9={'offset':moment()[_0xa19d('0x74')]()};_0x5c73c9[_0xa19d('0x75')]=moment()[_0xa19d('0x74')](_0x5c73c9[_0xa19d('0x27')])[_0xa19d('0x76')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x575e5a['status'](0xc8)[_0xa19d('0x32')](_0x5c73c9);}; \ No newline at end of file +var _0xee81=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','rows','show','params','keys','length','include','find','body','addLogo','file','filename','logo','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultFavicon','join','toLower','root','default','custom','default_logo.svg','Sequelize','upperFirst','\x20not\x20found','download','defaultLogo','defaultPreferred','existsSync','default_loginLogo.svg','ValidationError','gdpr','securePassword','getPreferred','defaultLoginLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3136be,_0xa2211d){var _0x283a2d=function(_0x2d390a){while(--_0x2d390a){_0x3136be['push'](_0x3136be['shift']());}};_0x283a2d(++_0xa2211d);}(_0xee81,0x15e));var _0x1ee8=function(_0x572085,_0x24eda9){_0x572085=_0x572085-0x0;var _0x3da37f=_0xee81[_0x572085];return _0x3da37f;};'use strict';var emlformat=require(_0x1ee8('0x0'));var rimraf=require(_0x1ee8('0x1'));var zipdir=require(_0x1ee8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1ee8('0x3'));var BPromise=require(_0x1ee8('0x4'));var Mustache=require('mustache');var util=require(_0x1ee8('0x5'));var path=require(_0x1ee8('0x6'));var sox=require('sox');var csv=require(_0x1ee8('0x7'));var ejs=require(_0x1ee8('0x8'));var fs=require('fs');var fs_extra=require(_0x1ee8('0x9'));var _=require(_0x1ee8('0xa'));var squel=require(_0x1ee8('0xb'));var crypto=require(_0x1ee8('0xc'));var jsforce=require(_0x1ee8('0xd'));var deskjs=require(_0x1ee8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ee8('0xf'));var Papa=require(_0x1ee8('0x10'));var Redis=require(_0x1ee8('0x11'));var authService=require(_0x1ee8('0x12'));var qs=require(_0x1ee8('0x13'));var as=require(_0x1ee8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ee8('0x15'))('api');var utils=require(_0x1ee8('0x16'));var config=require(_0x1ee8('0x17'));var licenseUtil=require(_0x1ee8('0x18'));var db=require(_0x1ee8('0x19'))['db'];var jayson=require(_0x1ee8('0x1a'));var client=jayson[_0x1ee8('0x1b')][_0x1ee8('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x40110a,_0x1ca389,_0x43ea5a,_0x523a18){return new BPromise(function(_0x57427a,_0x26634e){var _0x36c5f7=_0x523a18||client;return _0x36c5f7[_0x1ee8('0x1d')](_0x40110a,_0x43ea5a)['then'](function(_0x5754d5){logger['info']('Setting,\x20%s,\x20%s',_0x1ca389,_0x1ee8('0x1e'));logger[_0x1ee8('0x1f')](_0x1ee8('0x20'),_0x1ca389,_0x1ee8('0x1e'),JSON[_0x1ee8('0x21')](_0x5754d5));if(_0x5754d5[_0x1ee8('0x22')]){if(_0x5754d5['error'][_0x1ee8('0x23')]===0x1f4){logger['error'](_0x1ee8('0x24'),_0x1ca389,_0x5754d5['error'][_0x1ee8('0x25')]);return _0x26634e(_0x5754d5[_0x1ee8('0x22')][_0x1ee8('0x25')]);}logger[_0x1ee8('0x22')](_0x1ee8('0x24'),_0x1ca389,_0x5754d5[_0x1ee8('0x22')][_0x1ee8('0x25')]);return _0x57427a(_0x5754d5[_0x1ee8('0x22')][_0x1ee8('0x25')]);}else{logger['info'](_0x1ee8('0x24'),_0x1ca389,_0x1ee8('0x1e'));_0x57427a(_0x5754d5[_0x1ee8('0x26')]['message']);}})[_0x1ee8('0x27')](function(_0x8371bb){logger[_0x1ee8('0x22')](_0x1ee8('0x24'),_0x1ca389,_0x8371bb);_0x26634e(_0x8371bb);});});}function respondWithStatusCode(_0x25dc72,_0x224d4a){_0x224d4a=_0x224d4a||0xcc;return function(_0x55b042){if(_0x55b042){return _0x25dc72[_0x1ee8('0x28')](_0x224d4a);}return _0x25dc72[_0x1ee8('0x29')](_0x224d4a)['end']();};}function respondWithResult(_0x26c5d4,_0x70e2e1){_0x70e2e1=_0x70e2e1||0xc8;return function(_0x11888c){if(_0x11888c){return _0x26c5d4['status'](_0x70e2e1)[_0x1ee8('0x2a')](_0x11888c);}};}function respondWithFilteredResult(_0x2d22eb,_0x38caff){return function(_0x38a2ee){if(_0x38a2ee){var _0x85b1d1=typeof _0x38caff[_0x1ee8('0x2b')]===_0x1ee8('0x2c')&&typeof _0x38caff[_0x1ee8('0x2d')]===_0x1ee8('0x2c');var _0x295e94=_0x38a2ee[_0x1ee8('0x2e')];var _0x60ca74=_0x85b1d1?0x0:_0x38caff[_0x1ee8('0x2b')];var _0x327485=_0x85b1d1?_0x38a2ee[_0x1ee8('0x2e')]:_0x38caff[_0x1ee8('0x2b')]+_0x38caff['limit'];var _0x4d0398;if(_0x327485>=_0x295e94){_0x327485=_0x295e94;_0x4d0398=0xc8;}else{_0x4d0398=0xce;}_0x2d22eb[_0x1ee8('0x29')](_0x4d0398);return _0x2d22eb['set'](_0x1ee8('0x2f'),_0x60ca74+'-'+_0x327485+'/'+_0x295e94)['json'](_0x38a2ee);}return null;};}function patchUpdates(_0x5f2aa1){return function(_0x71b1e8){try{jsonpatch[_0x1ee8('0x30')](_0x71b1e8,_0x5f2aa1,!![]);}catch(_0x2af208){return BPromise[_0x1ee8('0x31')](_0x2af208);}return _0x71b1e8[_0x1ee8('0x32')]();};}function saveUpdates(_0x4a7d3c,_0x35bf92){return function(_0x1e13f4){if(_0x1e13f4){return _0x1e13f4[_0x1ee8('0x33')](_0x4a7d3c)['then'](function(_0x4b23db){return _0x4b23db;});}return null;};}function removeEntity(_0x3c3f83,_0x41b1f7){return function(_0x61bf69){if(_0x61bf69){return _0x61bf69[_0x1ee8('0x34')]()['then'](function(){_0x3c3f83[_0x1ee8('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5431bb,_0x41a71a){return function(_0x375e72){if(!_0x375e72){_0x5431bb[_0x1ee8('0x28')](0x194);}return _0x375e72;};}function handleError(_0x5ba2d7,_0x1b7532){_0x1b7532=_0x1b7532||0x1f4;return function(_0x44d041){logger[_0x1ee8('0x22')](_0x44d041[_0x1ee8('0x35')]);if(_0x44d041['name']){delete _0x44d041[_0x1ee8('0x36')];}_0x5ba2d7[_0x1ee8('0x29')](_0x1b7532)[_0x1ee8('0x37')](_0x44d041);};}exports['index']=function(_0x51b935,_0x30047f){var _0x21a019={},_0x2667cd={},_0x28b6c9={'count':0x0,'rows':[]};var _0x41a1c4=_[_0x1ee8('0x38')](db[_0x1ee8('0x39')][_0x1ee8('0x3a')],function(_0x56095a){return{'name':_0x56095a[_0x1ee8('0x3b')],'type':_0x56095a[_0x1ee8('0x3c')][_0x1ee8('0x3d')]};});_0x2667cd[_0x1ee8('0x3e')]=_[_0x1ee8('0x38')](_0x41a1c4,_0x1ee8('0x36'));_0x2667cd['query']=_['keys'](_0x51b935[_0x1ee8('0x3f')]);_0x2667cd[_0x1ee8('0x40')]=_[_0x1ee8('0x41')](_0x2667cd[_0x1ee8('0x3e')],_0x2667cd[_0x1ee8('0x3f')]);_0x21a019[_0x1ee8('0x42')]=_[_0x1ee8('0x41')](_0x2667cd[_0x1ee8('0x3e')],qs[_0x1ee8('0x43')](_0x51b935[_0x1ee8('0x3f')][_0x1ee8('0x43')]));_0x21a019[_0x1ee8('0x42')]=_0x21a019['attributes']['length']?_0x21a019[_0x1ee8('0x42')]:_0x2667cd['model'];if(!_0x51b935['query']['hasOwnProperty'](_0x1ee8('0x44'))){_0x21a019['limit']=qs['limit'](_0x51b935[_0x1ee8('0x3f')]['limit']);_0x21a019[_0x1ee8('0x2b')]=qs[_0x1ee8('0x2b')](_0x51b935[_0x1ee8('0x3f')]['offset']);}_0x21a019[_0x1ee8('0x45')]=qs[_0x1ee8('0x46')](_0x51b935[_0x1ee8('0x3f')][_0x1ee8('0x46')]);_0x21a019[_0x1ee8('0x47')]=qs[_0x1ee8('0x40')](_[_0x1ee8('0x48')](_0x51b935[_0x1ee8('0x3f')],_0x2667cd['filters']),_0x41a1c4);if(_0x51b935[_0x1ee8('0x3f')][_0x1ee8('0x49')]){_0x21a019[_0x1ee8('0x47')]=_[_0x1ee8('0x4a')](_0x21a019[_0x1ee8('0x47')],{'$or':_[_0x1ee8('0x38')](_0x41a1c4,function(_0x927a7c){if(_0x927a7c[_0x1ee8('0x3c')]!==_0x1ee8('0x4b')){var _0x447663={};_0x447663[_0x927a7c['name']]={'$like':'%'+_0x51b935[_0x1ee8('0x3f')][_0x1ee8('0x49')]+'%'};return _0x447663;}})});}_0x21a019=_['merge']({},_0x21a019,_0x51b935[_0x1ee8('0x4c')]);var _0x56d49a={'where':_0x21a019[_0x1ee8('0x47')]};return db[_0x1ee8('0x39')][_0x1ee8('0x2e')](_0x56d49a)[_0x1ee8('0x4d')](function(_0x4d6ac7){_0x28b6c9['count']=_0x4d6ac7;if(_0x51b935[_0x1ee8('0x3f')][_0x1ee8('0x4e')]){_0x21a019['include']=[{'all':!![]}];}return db['Setting']['findAll'](_0x21a019);})['then'](function(_0x141d44){_0x28b6c9[_0x1ee8('0x4f')]=_0x141d44;return _0x28b6c9;})[_0x1ee8('0x4d')](respondWithFilteredResult(_0x30047f,_0x21a019))[_0x1ee8('0x27')](handleError(_0x30047f,null));};exports[_0x1ee8('0x50')]=function(_0x4bdcfc,_0x2085d9){var _0x4487ff={'raw':![],'where':{'id':_0x4bdcfc[_0x1ee8('0x51')]['id']}},_0x1ce1c4={};_0x1ce1c4[_0x1ee8('0x3e')]=_[_0x1ee8('0x52')](db[_0x1ee8('0x39')][_0x1ee8('0x3a')]);_0x1ce1c4['query']=_[_0x1ee8('0x52')](_0x4bdcfc[_0x1ee8('0x3f')]);_0x1ce1c4[_0x1ee8('0x40')]=_[_0x1ee8('0x41')](_0x1ce1c4[_0x1ee8('0x3e')],_0x1ce1c4[_0x1ee8('0x3f')]);_0x4487ff[_0x1ee8('0x42')]=_[_0x1ee8('0x41')](_0x1ce1c4[_0x1ee8('0x3e')],qs[_0x1ee8('0x43')](_0x4bdcfc['query'][_0x1ee8('0x43')]));_0x4487ff[_0x1ee8('0x42')]=_0x4487ff[_0x1ee8('0x42')][_0x1ee8('0x53')]?_0x4487ff[_0x1ee8('0x42')]:_0x1ce1c4[_0x1ee8('0x3e')];if(_0x4bdcfc[_0x1ee8('0x3f')][_0x1ee8('0x4e')]){_0x4487ff[_0x1ee8('0x54')]=[{'all':!![]}];}_0x4487ff=_['merge']({},_0x4487ff,_0x4bdcfc[_0x1ee8('0x4c')]);return db['Setting'][_0x1ee8('0x55')](_0x4487ff)['then'](handleEntityNotFound(_0x2085d9,null))[_0x1ee8('0x4d')](respondWithResult(_0x2085d9,null))[_0x1ee8('0x27')](handleError(_0x2085d9,null));};exports[_0x1ee8('0x33')]=function(_0x1094d6,_0x2e7466){if(_0x1094d6[_0x1ee8('0x56')]['id']){delete _0x1094d6[_0x1ee8('0x56')]['id'];}return db[_0x1ee8('0x39')]['find']({'where':{'id':_0x1094d6[_0x1ee8('0x51')]['id']}})[_0x1ee8('0x4d')](handleEntityNotFound(_0x2e7466,null))['then'](saveUpdates(_0x1094d6[_0x1ee8('0x56')],null))[_0x1ee8('0x4d')](respondWithResult(_0x2e7466,null))[_0x1ee8('0x27')](handleError(_0x2e7466,null));};exports[_0x1ee8('0x57')]=function(_0x6c5e3d,_0x12c755,_0x3514ca){if(_0x6c5e3d[_0x1ee8('0x58')]&&_0x6c5e3d[_0x1ee8('0x58')][_0x1ee8('0x59')]){_0x6c5e3d[_0x1ee8('0x56')][_0x1ee8('0x5a')]=_0x6c5e3d['file'][_0x1ee8('0x59')];}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x6c5e3d['params']['id']}})[_0x1ee8('0x4d')](handleEntityNotFound(_0x12c755,null))[_0x1ee8('0x4d')](saveUpdates(_0x6c5e3d['body'],null))[_0x1ee8('0x4d')](respondWithResult(_0x12c755,null))[_0x1ee8('0x27')](handleError(_0x12c755,null));};exports['addLogoLogin']=function(_0x1e56bf,_0x3e7a26,_0x2e7612){if(_0x1e56bf[_0x1ee8('0x58')]&&_0x1e56bf[_0x1ee8('0x58')][_0x1ee8('0x59')]){_0x1e56bf[_0x1ee8('0x56')][_0x1ee8('0x5b')]=_0x1e56bf[_0x1ee8('0x58')][_0x1ee8('0x59')];}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x1e56bf['params']['id']}})[_0x1ee8('0x4d')](handleEntityNotFound(_0x3e7a26,null))[_0x1ee8('0x4d')](saveUpdates(_0x1e56bf[_0x1ee8('0x56')],null))[_0x1ee8('0x4d')](respondWithResult(_0x3e7a26,null))[_0x1ee8('0x27')](handleError(_0x3e7a26,null));};var utilLicense=require(_0x1ee8('0x18'));exports['getLogo']=function(_0x46202a,_0x405a7e,_0x21bee3){var _0xa3fab2=_0x1ee8('0x5c');var _0xb5a62d={'custom':![]};return utilLicense[_0x1ee8('0x5d')]()[_0x1ee8('0x4d')](function(_0x13de81){if(_0x13de81){_0xb5a62d=_0x13de81;}return db['Setting'][_0x1ee8('0x55')]({'where':{'id':_0x46202a['params']['id']},'attributes':[_0x1ee8('0x5a'),_0x1ee8('0x5b'),_0x1ee8('0x5e'),_0x1ee8('0x5f'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x1ee8('0x60')],'raw':!![]});})[_0x1ee8('0x4d')](handleEntityNotFound(_0x405a7e,null))[_0x1ee8('0x4d')](function(_0x1633c0){if(_0x1633c0){var _0x21b898=_0x1633c0[_0x1ee8('0x5a')]&&fs['existsSync'](path[_0x1ee8('0x61')](config['root'],_0xa3fab2,_[_0x1ee8('0x62')](_0x1633c0[_0x1ee8('0x5a')])))?path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0xa3fab2,_[_0x1ee8('0x62')](_0x1633c0[_0x1ee8('0x5a')])):path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0xa3fab2,_[_0x1ee8('0x62')]('default_logo.svg'));var _0x2b5cca=_0x1ee8('0x64')+_['upperFirst'](_0x1ee8('0x5a'));if(_0x1633c0[_0x2b5cca]||!_0xb5a62d[_0x1ee8('0x65')]){_0x21b898=path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0xa3fab2,_['toLower'](_0x1ee8('0x66')));}if(!fs['existsSync'](_0x21b898)){throw new db[(_0x1ee8('0x67'))]['ValidationError'](_[_0x1ee8('0x68')](_0x1ee8('0x5a'))+_0x1ee8('0x69'));}return _0x405a7e[_0x1ee8('0x6a')](_0x21b898);}})[_0x1ee8('0x27')](handleError(_0x405a7e,null));};var utilLicense=require(_0x1ee8('0x18'));exports['getLogoLogin']=function(_0x5c0d8e,_0x246f3b,_0x541136){var _0x1efe6f=_0x1ee8('0x5c');var _0x5d2633={'custom':![]};return utilLicense[_0x1ee8('0x5d')]()['then'](function(_0x48de77){if(_0x48de77){_0x5d2633=_0x48de77;}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x5c0d8e[_0x1ee8('0x51')]['id']},'attributes':[_0x1ee8('0x5a'),_0x1ee8('0x5b'),_0x1ee8('0x5e'),_0x1ee8('0x5f'),_0x1ee8('0x6b'),'defaultLoginLogo',_0x1ee8('0x6c'),_0x1ee8('0x60')],'raw':!![]});})[_0x1ee8('0x4d')](handleEntityNotFound(_0x246f3b,null))[_0x1ee8('0x4d')](function(_0x2b7d68){if(_0x2b7d68){var _0x500757=_0x2b7d68[_0x1ee8('0x5b')]&&fs[_0x1ee8('0x6d')](path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0x1efe6f,_[_0x1ee8('0x62')](_0x2b7d68[_0x1ee8('0x5b')])))?path[_0x1ee8('0x61')](config['root'],_0x1efe6f,_[_0x1ee8('0x62')](_0x2b7d68['loginLogo'])):path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0x1efe6f,_[_0x1ee8('0x62')]('default_loginLogo.svg'));var _0x1e3a62=_0x1ee8('0x64')+_[_0x1ee8('0x68')](_0x1ee8('0x5b'));if(_0x2b7d68[_0x1e3a62]||!_0x5d2633[_0x1ee8('0x65')]){_0x500757=path['join'](config[_0x1ee8('0x63')],_0x1efe6f,_['toLower'](_0x1ee8('0x6e')));}if(!fs[_0x1ee8('0x6d')](_0x500757)){throw new db[(_0x1ee8('0x67'))][(_0x1ee8('0x6f'))](_[_0x1ee8('0x68')](_0x1ee8('0x5b'))+_0x1ee8('0x69'));}return _0x246f3b[_0x1ee8('0x6a')](_0x500757);}})['catch'](handleError(_0x246f3b,null));};exports[_0x1ee8('0x70')]=function(_0x4953c2,_0x26fa9b){return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x4953c2['params']['id']},'attributes':[_0x1ee8('0x71')]})['then'](respondWithResult(_0x26fa9b,null))[_0x1ee8('0x27')](handleError(_0x26fa9b,null));};exports['addPreferred']=function(_0xf71d8f,_0x2bf3c4,_0x293338){if(_0xf71d8f['file']&&_0xf71d8f[_0x1ee8('0x58')][_0x1ee8('0x59')]){_0xf71d8f[_0x1ee8('0x56')][_0x1ee8('0x5e')]=_0xf71d8f[_0x1ee8('0x58')][_0x1ee8('0x59')];}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0xf71d8f[_0x1ee8('0x51')]['id']}})['then'](handleEntityNotFound(_0x2bf3c4,null))['then'](saveUpdates(_0xf71d8f['body'],null))[_0x1ee8('0x4d')](respondWithResult(_0x2bf3c4,null))['catch'](handleError(_0x2bf3c4,null));};var utilLicense=require(_0x1ee8('0x18'));exports[_0x1ee8('0x72')]=function(_0x3408ea,_0x555eec,_0x4d0d1b){var _0x5112d1='server/files/images/logos';var _0x10079b={'custom':![]};return utilLicense[_0x1ee8('0x5d')]()[_0x1ee8('0x4d')](function(_0x1056f3){if(_0x1056f3){_0x10079b=_0x1056f3;}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x3408ea[_0x1ee8('0x51')]['id']},'attributes':[_0x1ee8('0x5a'),_0x1ee8('0x5b'),_0x1ee8('0x5e'),_0x1ee8('0x5f'),'defaultLogo',_0x1ee8('0x73'),_0x1ee8('0x6c'),'defaultFavicon'],'raw':!![]});})[_0x1ee8('0x4d')](handleEntityNotFound(_0x555eec,null))[_0x1ee8('0x4d')](function(_0x4bb765){if(_0x4bb765){var _0x1ee247=_0x4bb765['preferred']&&fs[_0x1ee8('0x6d')](path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0x5112d1,_[_0x1ee8('0x62')](_0x4bb765[_0x1ee8('0x5e')])))?path['join'](config['root'],_0x5112d1,_[_0x1ee8('0x62')](_0x4bb765['preferred'])):path[_0x1ee8('0x61')](config['root'],_0x5112d1,_['toLower'](_0x1ee8('0x74')));var _0x5b3645=_0x1ee8('0x64')+_['upperFirst'](_0x1ee8('0x5e'));if(_0x4bb765[_0x5b3645]||!_0x10079b[_0x1ee8('0x65')]||!_0x10079b[_0x1ee8('0x5e')]){_0x1ee247=path['join'](config[_0x1ee8('0x63')],_0x5112d1,_[_0x1ee8('0x62')]('default_preferred.png'));}if(!fs[_0x1ee8('0x6d')](_0x1ee247)){throw new db[(_0x1ee8('0x67'))][(_0x1ee8('0x6f'))](_[_0x1ee8('0x68')](_0x1ee8('0x5e'))+_0x1ee8('0x69'));}return _0x555eec[_0x1ee8('0x6a')](_0x1ee247);}})[_0x1ee8('0x27')](handleError(_0x555eec,null));};exports[_0x1ee8('0x75')]=function(_0x4e0067,_0x4d3f43,_0x5bac10){if(_0x4e0067['file']&&_0x4e0067['file'][_0x1ee8('0x59')]){_0x4e0067['body']['favicon']=_0x4e0067[_0x1ee8('0x58')][_0x1ee8('0x59')];}return db['Setting'][_0x1ee8('0x55')]({'where':{'id':_0x4e0067[_0x1ee8('0x51')]['id']}})[_0x1ee8('0x4d')](handleEntityNotFound(_0x4d3f43,null))[_0x1ee8('0x4d')](saveUpdates(_0x4e0067[_0x1ee8('0x56')],null))[_0x1ee8('0x4d')](respondWithResult(_0x4d3f43,null))['catch'](handleError(_0x4d3f43,null));};var utilLicense=require('../../config/license/util');exports[_0x1ee8('0x76')]=function(_0x279c90,_0x51a5dd,_0x144257){var _0x2750ca=_0x1ee8('0x5c');var _0x5d8c5e={'custom':![]};return utilLicense[_0x1ee8('0x5d')]()[_0x1ee8('0x4d')](function(_0x24ba36){if(_0x24ba36){_0x5d8c5e=_0x24ba36;}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x279c90[_0x1ee8('0x51')]['id']},'attributes':['logo','loginLogo','preferred',_0x1ee8('0x5f'),_0x1ee8('0x6b'),_0x1ee8('0x73'),_0x1ee8('0x6c'),_0x1ee8('0x60')],'raw':!![]});})[_0x1ee8('0x4d')](handleEntityNotFound(_0x51a5dd,null))[_0x1ee8('0x4d')](function(_0x3ac2c2){if(_0x3ac2c2){var _0x33f7c2=_0x3ac2c2[_0x1ee8('0x5f')]&&fs['existsSync'](path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0x2750ca,_[_0x1ee8('0x62')](_0x3ac2c2[_0x1ee8('0x5f')])))?path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0x2750ca,_[_0x1ee8('0x62')](_0x3ac2c2[_0x1ee8('0x5f')])):path[_0x1ee8('0x61')](config['root'],_0x2750ca,_[_0x1ee8('0x62')](_0x1ee8('0x77')));var _0x10d5eb=_0x1ee8('0x64')+_[_0x1ee8('0x68')](_0x1ee8('0x5f'));if(_0x3ac2c2[_0x10d5eb]||!_0x5d8c5e[_0x1ee8('0x65')]){_0x33f7c2=path['join'](config['root'],_0x2750ca,_[_0x1ee8('0x62')](_0x1ee8('0x77')));}if(!fs[_0x1ee8('0x6d')](_0x33f7c2)){throw new db[(_0x1ee8('0x67'))][(_0x1ee8('0x6f'))](_[_0x1ee8('0x68')](_0x1ee8('0x5f'))+_0x1ee8('0x69'));}return _0x51a5dd['download'](_0x33f7c2);}})[_0x1ee8('0x27')](handleError(_0x51a5dd,null));};exports[_0x1ee8('0x78')]=function(_0x45d0e6,_0x481945){var _0x389c96={'offset':moment()[_0x1ee8('0x79')]()};_0x389c96['now']=moment()[_0x1ee8('0x79')](_0x389c96[_0x1ee8('0x2b')])['format'](_0x1ee8('0x7a'));return _0x481945[_0x1ee8('0x29')](0xc8)['send'](_0x389c96);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 3d329bd..75f047b 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(_0x1c16a4,_0xbba97c){var _0xa47eb7=function(_0x3f4893){while(--_0x3f4893){_0x1c16a4['push'](_0x1c16a4['shift']());}};_0xa47eb7(++_0xbba97c);}(_0x008c,0x188));var _0xc008=function(_0x30562d,_0x522b66){_0x30562d=_0x30562d-0x0;var _0x1f6ced=_0x008c[_0x30562d];return _0x1f6ced;};'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(_0x4e0115,_0x1692ea){var _0x45a16a=function(_0x2324e6){while(--_0x2324e6){_0x4e0115['push'](_0x4e0115['shift']());}};_0x45a16a(++_0x1692ea);}(_0x3e74,0x175));var _0x43e7=function(_0x566a92,_0x1072c6){_0x566a92=_0x566a92-0x0;var _0xfd3612=_0x3e74[_0x566a92];return _0xfd3612;};'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 cc21319..c8a9e18 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 _0xd92c=['map','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','model'];(function(_0x4c3584,_0x2b53ff){var _0x508a39=function(_0x5635d9){while(--_0x5635d9){_0x4c3584['push'](_0x4c3584['shift']());}};_0x508a39(++_0x2b53ff);}(_0xd92c,0x1d0));var _0xcd92=function(_0xbe5218,_0x1ba294){_0xbe5218=_0xbe5218-0x0;var _0x2fc66a=_0xd92c[_0xbe5218];return _0x2fc66a;};'use strict';var _=require(_0xcd92('0x0'));var util=require(_0xcd92('0x1'));var moment=require(_0xcd92('0x2'));var BPromise=require(_0xcd92('0x3'));var rs=require(_0xcd92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd92('0x5'))['db'];var utils=require(_0xcd92('0x6'));var logger=require(_0xcd92('0x7'))(_0xcd92('0x8'));var config=require(_0xcd92('0x9'));var jayson=require(_0xcd92('0xa'));var client=jayson['client'][_0xcd92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c4c33,_0x5e04dc,_0x351ca4){return new BPromise(function(_0x49a540,_0x2a5087){return client['request'](_0x4c4c33,_0x351ca4)[_0xcd92('0xc')](function(_0x59807c){logger[_0xcd92('0xd')](_0xcd92('0xe'),_0x5e04dc,'request\x20sent');logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x5e04dc,_0xcd92('0xf'),JSON[_0xcd92('0x10')](_0x59807c));if(_0x59807c['error']){if(_0x59807c[_0xcd92('0x11')][_0xcd92('0x12')]===0x1f4){logger[_0xcd92('0x11')](_0xcd92('0xe'),_0x5e04dc,_0x59807c[_0xcd92('0x11')][_0xcd92('0x13')]);return _0x2a5087(_0x59807c[_0xcd92('0x11')][_0xcd92('0x13')]);}logger['error'](_0xcd92('0xe'),_0x5e04dc,_0x59807c[_0xcd92('0x11')][_0xcd92('0x13')]);return _0x49a540(_0x59807c[_0xcd92('0x11')]['message']);}else{logger[_0xcd92('0xd')]('Setting,\x20%s,\x20%s',_0x5e04dc,'request\x20sent');_0x49a540(_0x59807c[_0xcd92('0x14')]['message']);}})[_0xcd92('0x15')](function(_0x40a62a){logger[_0xcd92('0x11')](_0xcd92('0xe'),_0x5e04dc,_0x40a62a);_0x2a5087(_0x40a62a);});});}exports[_0xcd92('0x16')]=function(_0x43af5d){var _0x1ab6a8=this;return new Promise(function(_0x3ba0cb,_0x50f770){return db[_0xcd92('0x17')][_0xcd92('0x18')]({'raw':_0x43af5d[_0xcd92('0x19')]?_0x43af5d[_0xcd92('0x19')][_0xcd92('0x1a')]===undefined?!![]:![]:!![],'where':_0x43af5d[_0xcd92('0x19')]?_0x43af5d[_0xcd92('0x19')][_0xcd92('0x1b')]||null:null,'attributes':_0x43af5d[_0xcd92('0x19')]?_0x43af5d[_0xcd92('0x19')][_0xcd92('0x1c')]||null:null,'include':_0x43af5d[_0xcd92('0x19')]?_0x43af5d[_0xcd92('0x19')]['include']?_['map'](_0x43af5d[_0xcd92('0x19')][_0xcd92('0x1d')],function(_0x53b420){return{'model':db[_0x53b420[_0xcd92('0x1e')]],'as':_0x53b420['as'],'attributes':_0x53b420[_0xcd92('0x1c')],'include':_0x53b420[_0xcd92('0x1d')]?_[_0xcd92('0x1f')](_0x53b420['include'],function(_0x57b973){return{'model':db[_0x57b973[_0xcd92('0x1e')]],'as':_0x57b973['as'],'attributes':_0x57b973[_0xcd92('0x1c')],'include':_0x57b973[_0xcd92('0x1d')]?_['map'](_0x57b973[_0xcd92('0x1d')],function(_0x1241c3){return{'model':db[_0x1241c3[_0xcd92('0x1e')]],'as':_0x1241c3['as'],'attributes':_0x1241c3['attributes']};}):[]};}):[]};}):[]:[]})[_0xcd92('0xc')](function(_0x19214c){logger[_0xcd92('0xd')](_0xcd92('0x16'),_0x43af5d);logger[_0xcd92('0x20')](_0xcd92('0x16'),_0x43af5d,JSON[_0xcd92('0x10')](_0x19214c));_0x3ba0cb(_0x19214c);})[_0xcd92('0x15')](function(_0x352371){logger[_0xcd92('0x11')]('ShowSetting',_0x352371[_0xcd92('0x13')],_0x43af5d);_0x50f770(_0x1ab6a8[_0xcd92('0x11')](0x1f4,_0x352371[_0xcd92('0x13')]));});});}; \ No newline at end of file +var _0xc91c=['raw','options','where','attributes','include','map','model','then','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','ShowSetting','find'];(function(_0x3c81a4,_0x29e2bc){var _0x3f874d=function(_0x2759cb){while(--_0x2759cb){_0x3c81a4['push'](_0x3c81a4['shift']());}};_0x3f874d(++_0x29e2bc);}(_0xc91c,0x135));var _0xcc91=function(_0x4b4277,_0x22676f){_0x4b4277=_0x4b4277-0x0;var _0x1ff405=_0xc91c[_0x4b4277];return _0x1ff405;};'use strict';var _=require(_0xcc91('0x0'));var util=require(_0xcc91('0x1'));var moment=require(_0xcc91('0x2'));var BPromise=require('bluebird');var rs=require(_0xcc91('0x3'));var fs=require('fs');var Redis=require(_0xcc91('0x4'));var db=require(_0xcc91('0x5'))['db'];var utils=require(_0xcc91('0x6'));var logger=require('../../config/logger')(_0xcc91('0x7'));var config=require('../../config/environment');var jayson=require(_0xcc91('0x8'));var client=jayson['client'][_0xcc91('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cc467,_0x45df81,_0x50b99b){return new BPromise(function(_0x2d22fc,_0x3ed524){return client[_0xcc91('0xa')](_0x3cc467,_0x50b99b)['then'](function(_0xc69836){logger['info'](_0xcc91('0xb'),_0x45df81,_0xcc91('0xc'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x45df81,_0xcc91('0xc'),JSON[_0xcc91('0xd')](_0xc69836));if(_0xc69836['error']){if(_0xc69836[_0xcc91('0xe')]['code']===0x1f4){logger[_0xcc91('0xe')](_0xcc91('0xb'),_0x45df81,_0xc69836[_0xcc91('0xe')][_0xcc91('0xf')]);return _0x3ed524(_0xc69836[_0xcc91('0xe')][_0xcc91('0xf')]);}logger[_0xcc91('0xe')](_0xcc91('0xb'),_0x45df81,_0xc69836[_0xcc91('0xe')]['message']);return _0x2d22fc(_0xc69836[_0xcc91('0xe')][_0xcc91('0xf')]);}else{logger[_0xcc91('0x10')]('Setting,\x20%s,\x20%s',_0x45df81,_0xcc91('0xc'));_0x2d22fc(_0xc69836[_0xcc91('0x11')][_0xcc91('0xf')]);}})[_0xcc91('0x12')](function(_0x1ad760){logger[_0xcc91('0xe')](_0xcc91('0xb'),_0x45df81,_0x1ad760);_0x3ed524(_0x1ad760);});});}exports[_0xcc91('0x13')]=function(_0x4979cd){var _0x427d53=this;return new Promise(function(_0x907b0f,_0x48408c){return db['Setting'][_0xcc91('0x14')]({'raw':_0x4979cd['options']?_0x4979cd['options'][_0xcc91('0x15')]===undefined?!![]:![]:!![],'where':_0x4979cd[_0xcc91('0x16')]?_0x4979cd[_0xcc91('0x16')][_0xcc91('0x17')]||null:null,'attributes':_0x4979cd['options']?_0x4979cd[_0xcc91('0x16')][_0xcc91('0x18')]||null:null,'include':_0x4979cd[_0xcc91('0x16')]?_0x4979cd[_0xcc91('0x16')][_0xcc91('0x19')]?_[_0xcc91('0x1a')](_0x4979cd[_0xcc91('0x16')][_0xcc91('0x19')],function(_0x1efce2){return{'model':db[_0x1efce2[_0xcc91('0x1b')]],'as':_0x1efce2['as'],'attributes':_0x1efce2['attributes'],'include':_0x1efce2[_0xcc91('0x19')]?_['map'](_0x1efce2[_0xcc91('0x19')],function(_0x3fd98f){return{'model':db[_0x3fd98f[_0xcc91('0x1b')]],'as':_0x3fd98f['as'],'attributes':_0x3fd98f[_0xcc91('0x18')],'include':_0x3fd98f[_0xcc91('0x19')]?_[_0xcc91('0x1a')](_0x3fd98f['include'],function(_0x22936a){return{'model':db[_0x22936a[_0xcc91('0x1b')]],'as':_0x22936a['as'],'attributes':_0x22936a[_0xcc91('0x18')]};}):[]};}):[]};}):[]:[]})[_0xcc91('0x1c')](function(_0x53eefa){logger[_0xcc91('0x10')](_0xcc91('0x13'),_0x4979cd);logger[_0xcc91('0x1d')]('ShowSetting',_0x4979cd,JSON[_0xcc91('0xd')](_0x53eefa));_0x907b0f(_0x53eefa);})[_0xcc91('0x12')](function(_0x3d033b){logger[_0xcc91('0xe')](_0xcc91('0x13'),_0x3d033b[_0xcc91('0xf')],_0x4979cd);_0x48408c(_0x427d53[_0xcc91('0xe')](0x1f4,_0x3d033b[_0xcc91('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 721c083..829d744 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 _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x175290,_0x42e572){var _0x52bd78=function(_0xea7cc7){while(--_0xea7cc7){_0x175290['push'](_0x175290['shift']());}};_0x52bd78(++_0x42e572);}(_0x814b,0x1a2));var _0xb814=function(_0xc83285,_0x3860f3){_0xc83285=_0xc83285-0x0;var _0x59ef36=_0x814b[_0xc83285];return _0x59ef36;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file +var _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf494,0x1c6));var _0x4f49=function(_0x1eca7a,_0x5be6b5){_0x1eca7a=_0x1eca7a-0x0;var _0x143fb1=_0xf494[_0x1eca7a];return _0x143fb1;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index ccc5b70..9c1a9d8 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 _0xe21b=['name','generate','ENUM','connectel','plivo','clickatell','bandwidth','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING'];(function(_0x2b7d8a,_0x3ae57d){var _0x533d53=function(_0x23a7b9){while(--_0x23a7b9){_0x2b7d8a['push'](_0x2b7d8a['shift']());}};_0x533d53(++_0x3ae57d);}(_0xe21b,0x179));var _0xbe21=function(_0x1922e6,_0x25f413){_0x1922e6=_0x1922e6-0x0;var _0x56bb80=_0xe21b[_0x1922e6];return _0x56bb80;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xbe21('0x0'));module[_0xbe21('0x1')]={'name':{'type':Sequelize[_0xbe21('0x2')],'unique':_0xbe21('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xbe21('0x2')],'defaultValue':function(){return rs[_0xbe21('0x4')]();}},'phone':{'type':Sequelize[_0xbe21('0x2')]},'type':{'type':Sequelize[_0xbe21('0x5')]('twilio','skebby',_0xbe21('0x6'),'clicksend',_0xbe21('0x7'),_0xbe21('0x8'),_0xbe21('0x9'),'csc','infobip',_0xbe21('0xa'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xbe21('0x2')]},'authToken':{'type':Sequelize[_0xbe21('0x2')]},'smsMethod':{'type':Sequelize[_0xbe21('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xbe21('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xbe21('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xbe21('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xbe21('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0xbe21('0x2')]},'notificationTemplate':{'type':Sequelize[_0xbe21('0xc')],'defaultValue':function(){return _0xbe21('0xd');}},'notificationSound':{'type':Sequelize[_0xbe21('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbe21('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbe21('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbe21('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbe21('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbe21('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbe21('0xe')],'comment':_0xbe21('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x34e65e){if(!_0x34e65e)this[_0xbe21('0x10')](_0xbe21('0x11'),null);this[_0xbe21('0x10')](_0xbe21('0x12'),_0x34e65e);}}}; \ No newline at end of file +var _0x1d53=['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','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth','csc','infobip','BOOLEAN','TEXT'];(function(_0x44008d,_0x3458c3){var _0xe25e4d=function(_0x4cf0f7){while(--_0x4cf0f7){_0x44008d['push'](_0x44008d['shift']());}};_0xe25e4d(++_0x3458c3);}(_0x1d53,0xc7));var _0x31d5=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1d53[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x31d5('0x0'));var rs=require(_0x31d5('0x1'));module[_0x31d5('0x2')]={'name':{'type':Sequelize[_0x31d5('0x3')],'unique':_0x31d5('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x31d5('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x31d5('0x3')],'defaultValue':function(){return rs[_0x31d5('0x5')]();}},'phone':{'type':Sequelize[_0x31d5('0x3')]},'type':{'type':Sequelize[_0x31d5('0x6')](_0x31d5('0x7'),_0x31d5('0x8'),'connectel',_0x31d5('0x9'),_0x31d5('0xa'),_0x31d5('0xb'),_0x31d5('0xc'),_0x31d5('0xd'),_0x31d5('0xe'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x31d5('0x3')]},'authToken':{'type':Sequelize[_0x31d5('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x31d5('0x3')]},'password':{'type':Sequelize[_0x31d5('0x3')]},'apiKey':{'type':Sequelize[_0x31d5('0x3')]},'applicationId':{'type':Sequelize[_0x31d5('0x3')]},'accountId':{'type':Sequelize[_0x31d5('0x3')]},'senderString':{'type':Sequelize[_0x31d5('0x3')]},'deliveryReport':{'type':Sequelize[_0x31d5('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x31d5('0x10')],'defaultValue':function(){return _0x31d5('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x31d5('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x31d5('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x31d5('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x31d5('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x31d5('0x12')],'comment':_0x31d5('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x31d5('0x14'),'set':function(_0x1875c0){if(!_0x1875c0)this[_0x31d5('0x15')](_0x31d5('0x16'),null);this[_0x31d5('0x15')](_0x31d5('0x17'),_0x1875c0);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 97e498e..25476f9 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 _0xe7b8=['account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','Body','MessageSid','skebby','from','text','connectel','clicksend','messageId','message_id','plivo','Text','MessageUUID','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','spread','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','addApplications','transaction','bulkCreate','findOne','getApplications','getInteractions','SmsInteraction','Contact','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','bandwidth','redif','DELIVERED','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','intelepeer','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','http','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','VIRTUAL','merge','options','where','include','findAll','rows','show','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','params','Disposition','getDispositions','hasOwnProperty','SmsAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc'];(function(_0x180297,_0x3d41c1){var _0x1e6180=function(_0x55ad30){while(--_0x55ad30){_0x180297['push'](_0x180297['shift']());}};_0x1e6180(++_0x3d41c1);}(_0xe7b8,0x6f));var _0x8e7b=function(_0x32b937,_0x549db2){_0x32b937=_0x32b937-0x0;var _0x47fe07=_0xe7b8[_0x32b937];return _0x47fe07;};'use strict';var emlformat=require(_0x8e7b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e7b('0x1'));var jsonpatch=require(_0x8e7b('0x2'));var rp=require(_0x8e7b('0x3'));var moment=require('moment');var BPromise=require(_0x8e7b('0x4'));var Mustache=require(_0x8e7b('0x5'));var util=require('util');var path=require(_0x8e7b('0x6'));var sox=require(_0x8e7b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e7b('0x8'));var _=require(_0x8e7b('0x9'));var squel=require(_0x8e7b('0xa'));var crypto=require(_0x8e7b('0xb'));var jsforce=require(_0x8e7b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8e7b('0xd'));var querystring=require(_0x8e7b('0xe'));var Papa=require('papaparse');var Redis=require(_0x8e7b('0xf'));var authService=require(_0x8e7b('0x10'));var qs=require(_0x8e7b('0x11'));var as=require(_0x8e7b('0x12'));var hardwareService=require(_0x8e7b('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8e7b('0x14'));var config=require(_0x8e7b('0x15'));var licenseUtil=require(_0x8e7b('0x16'));var db=require(_0x8e7b('0x17'))['db'];config[_0x8e7b('0x18')]=_[_0x8e7b('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8e7b('0x1a'))(new Redis(config[_0x8e7b('0x18')]));require('./smsAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8e7b('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0xcebbdc,_0x2b78a9,_0x1d17d5,_0x367b6c){return new BPromise(function(_0x5f275f,_0x159b13){var _0x19902d=_0x367b6c||client;return _0x19902d[_0x8e7b('0x1c')](_0xcebbdc,_0x1d17d5)[_0x8e7b('0x1d')](function(_0x1b2aee){logger[_0x8e7b('0x1e')](_0x8e7b('0x1f'),_0x2b78a9,'request\x20sent');logger['debug'](_0x8e7b('0x20'),_0x2b78a9,_0x8e7b('0x21'),JSON[_0x8e7b('0x22')](_0x1b2aee));if(_0x1b2aee['error']){if(_0x1b2aee[_0x8e7b('0x23')][_0x8e7b('0x24')]===0x1f4){logger[_0x8e7b('0x23')](_0x8e7b('0x1f'),_0x2b78a9,_0x1b2aee[_0x8e7b('0x23')]['message']);return _0x159b13(_0x1b2aee['error'][_0x8e7b('0x25')]);}logger[_0x8e7b('0x23')](_0x8e7b('0x1f'),_0x2b78a9,_0x1b2aee[_0x8e7b('0x23')][_0x8e7b('0x25')]);return _0x5f275f(_0x1b2aee[_0x8e7b('0x23')][_0x8e7b('0x25')]);}else{logger[_0x8e7b('0x1e')](_0x8e7b('0x1f'),_0x2b78a9,'request\x20sent');_0x5f275f(_0x1b2aee[_0x8e7b('0x26')]['message']);}})[_0x8e7b('0x27')](function(_0xe496a){logger[_0x8e7b('0x23')](_0x8e7b('0x1f'),_0x2b78a9,_0xe496a);_0x159b13(_0xe496a);});});}function respondWithStatusCode(_0x534e2e,_0x1db34f){_0x1db34f=_0x1db34f||0xcc;return function(_0x4fba91){if(_0x4fba91){return _0x534e2e[_0x8e7b('0x28')](_0x1db34f);}return _0x534e2e[_0x8e7b('0x29')](_0x1db34f)[_0x8e7b('0x2a')]();};}function respondWithResult(_0x13b5f2,_0x502daa){_0x502daa=_0x502daa||0xc8;return function(_0x10b6b7){if(_0x10b6b7){return _0x13b5f2[_0x8e7b('0x29')](_0x502daa)['json'](_0x10b6b7);}};}function respondWithFilteredResult(_0x4625d8,_0x25a346){return function(_0x2cc6f0){if(_0x2cc6f0){var _0x5bdb73=typeof _0x25a346[_0x8e7b('0x2b')]==='undefined'&&typeof _0x25a346[_0x8e7b('0x2c')]===_0x8e7b('0x2d');var _0x210ad1=_0x2cc6f0[_0x8e7b('0x2e')];var _0x300e18=_0x5bdb73?0x0:_0x25a346['offset'];var _0x172ea9=_0x5bdb73?_0x2cc6f0['count']:_0x25a346[_0x8e7b('0x2b')]+_0x25a346['limit'];var _0x1ef9d8;if(_0x172ea9>=_0x210ad1){_0x172ea9=_0x210ad1;_0x1ef9d8=0xc8;}else{_0x1ef9d8=0xce;}_0x4625d8[_0x8e7b('0x29')](_0x1ef9d8);return _0x4625d8[_0x8e7b('0x2f')](_0x8e7b('0x30'),_0x300e18+'-'+_0x172ea9+'/'+_0x210ad1)[_0x8e7b('0x31')](_0x2cc6f0);}return null;};}function patchUpdates(_0xb3b26d){return function(_0x12c873){try{jsonpatch[_0x8e7b('0x32')](_0x12c873,_0xb3b26d,!![]);}catch(_0x39605d){return BPromise[_0x8e7b('0x33')](_0x39605d);}return _0x12c873[_0x8e7b('0x34')]();};}function saveUpdates(_0x34533f,_0x34bf33){return function(_0xba2321){if(_0xba2321){return _0xba2321[_0x8e7b('0x35')](_0x34533f)[_0x8e7b('0x1d')](function(_0x5ef696){return _0x5ef696;});}return null;};}function removeEntity(_0xbc0b37,_0x392c08){return function(_0x507604){if(_0x507604){return _0x507604['destroy']()[_0x8e7b('0x1d')](function(){var _0x2ab4d4=_0x507604['get']({'plain':!![]});var _0x42597e='SmsAccounts';return db[_0x8e7b('0x36')][_0x8e7b('0x37')]({'where':{'type':_0x42597e,'resourceId':_0x2ab4d4['id']}})[_0x8e7b('0x1d')](function(){return _0x507604;});})['then'](function(){_0xbc0b37['status'](0xcc)[_0x8e7b('0x2a')]();});}};}function handleEntityNotFound(_0x1eb610,_0x16c2e9){return function(_0x95a748){if(!_0x95a748){_0x1eb610[_0x8e7b('0x28')](0x194);}return _0x95a748;};}function handleError(_0x1311db,_0x89de41){_0x89de41=_0x89de41||0x1f4;return function(_0x471fba){logger[_0x8e7b('0x23')](_0x471fba[_0x8e7b('0x38')]);if(_0x471fba[_0x8e7b('0x39')]){delete _0x471fba['name'];}_0x1311db[_0x8e7b('0x29')](_0x89de41)[_0x8e7b('0x3a')](_0x471fba);};}exports[_0x8e7b('0x3b')]=function(_0xf250eb,_0x17671f){var _0x16d740={'include':[{'model':db[_0x8e7b('0x3c')],'as':_0x8e7b('0x3d')}]},_0x436f3e={},_0xeb064e={'count':0x0,'rows':[]};var _0x20ceef=_['map'](db[_0x8e7b('0x3e')][_0x8e7b('0x3f')],function(_0x37382f){return{'name':_0x37382f[_0x8e7b('0x40')],'type':_0x37382f[_0x8e7b('0x41')][_0x8e7b('0x42')]};});_0x436f3e[_0x8e7b('0x43')]=_[_0x8e7b('0x44')](_0x20ceef,'name');_0x436f3e[_0x8e7b('0x45')]=_[_0x8e7b('0x46')](_0xf250eb[_0x8e7b('0x45')]);_0x436f3e[_0x8e7b('0x47')]=_[_0x8e7b('0x48')](_0x436f3e[_0x8e7b('0x43')],_0x436f3e[_0x8e7b('0x45')]);_0x16d740[_0x8e7b('0x49')]=_[_0x8e7b('0x48')](_0x436f3e['model'],qs[_0x8e7b('0x4a')](_0xf250eb[_0x8e7b('0x45')]['fields']));_0x16d740['attributes']=_0x16d740['attributes'][_0x8e7b('0x4b')]?_0x16d740[_0x8e7b('0x49')]:_0x436f3e[_0x8e7b('0x43')];if(!_0xf250eb[_0x8e7b('0x45')]['hasOwnProperty'](_0x8e7b('0x4c'))){_0x16d740['limit']=qs[_0x8e7b('0x2c')](_0xf250eb[_0x8e7b('0x45')][_0x8e7b('0x2c')]);_0x16d740[_0x8e7b('0x2b')]=qs['offset'](_0xf250eb['query'][_0x8e7b('0x2b')]);}_0x16d740[_0x8e7b('0x4d')]=qs[_0x8e7b('0x4e')](_0xf250eb[_0x8e7b('0x45')][_0x8e7b('0x4e')]);_0x16d740['where']=qs[_0x8e7b('0x47')](_[_0x8e7b('0x4f')](_0xf250eb[_0x8e7b('0x45')],_0x436f3e[_0x8e7b('0x47')]),_0x20ceef);if(_0xf250eb[_0x8e7b('0x45')][_0x8e7b('0x50')]){_0x16d740['where']=_['merge'](_0x16d740['where'],{'$or':_[_0x8e7b('0x44')](_0x20ceef,function(_0x3cbe31){if(_0x3cbe31[_0x8e7b('0x41')]!==_0x8e7b('0x51')){var _0x4d9a54={};_0x4d9a54[_0x3cbe31[_0x8e7b('0x39')]]={'$like':'%'+_0xf250eb['query'][_0x8e7b('0x50')]+'%'};return _0x4d9a54;}})});}_0x16d740=_[_0x8e7b('0x52')]({},_0x16d740,_0xf250eb[_0x8e7b('0x53')]);var _0x2c1fb8={'where':_0x16d740[_0x8e7b('0x54')]};return db[_0x8e7b('0x3e')][_0x8e7b('0x2e')](_0x2c1fb8)[_0x8e7b('0x1d')](function(_0x367100){_0xeb064e[_0x8e7b('0x2e')]=_0x367100;if(_0xf250eb[_0x8e7b('0x45')]['includeAll']){_0x16d740[_0x8e7b('0x55')]=[{'all':!![]}];}return db[_0x8e7b('0x3e')][_0x8e7b('0x56')](_0x16d740);})[_0x8e7b('0x1d')](function(_0x111bcf){_0xeb064e[_0x8e7b('0x57')]=_0x111bcf;return _0xeb064e;})[_0x8e7b('0x1d')](respondWithFilteredResult(_0x17671f,_0x16d740))[_0x8e7b('0x27')](handleError(_0x17671f,null));};exports[_0x8e7b('0x58')]=function(_0x1fd446,_0x503539){var _0x13aba1={'raw':![],'where':{'id':_0x1fd446['params']['id']},'include':[{'model':db[_0x8e7b('0x3c')],'as':_0x8e7b('0x3d')}]},_0x492cec={};_0x492cec['model']=_[_0x8e7b('0x46')](db[_0x8e7b('0x3e')][_0x8e7b('0x3f')]);_0x492cec['query']=_[_0x8e7b('0x46')](_0x1fd446[_0x8e7b('0x45')]);_0x492cec[_0x8e7b('0x47')]=_[_0x8e7b('0x48')](_0x492cec[_0x8e7b('0x43')],_0x492cec['query']);_0x13aba1['attributes']=_[_0x8e7b('0x48')](_0x492cec['model'],qs[_0x8e7b('0x4a')](_0x1fd446[_0x8e7b('0x45')][_0x8e7b('0x4a')]));_0x13aba1['attributes']=_0x13aba1[_0x8e7b('0x49')][_0x8e7b('0x4b')]?_0x13aba1[_0x8e7b('0x49')]:_0x492cec[_0x8e7b('0x43')];if(_0x1fd446[_0x8e7b('0x45')][_0x8e7b('0x59')]){_0x13aba1['include']=[{'all':!![]}];}_0x13aba1=_[_0x8e7b('0x52')]({},_0x13aba1,_0x1fd446[_0x8e7b('0x53')]);return db[_0x8e7b('0x3e')][_0x8e7b('0x5a')](_0x13aba1)['then'](handleEntityNotFound(_0x503539,null))[_0x8e7b('0x1d')](respondWithResult(_0x503539,null))[_0x8e7b('0x27')](handleError(_0x503539,null));};exports[_0x8e7b('0x5b')]=function(_0x178a7d,_0x5261c1){return db[_0x8e7b('0x3e')][_0x8e7b('0x5b')](_0x178a7d[_0x8e7b('0x5c')],{})['then'](function(_0x1850be){var _0x130ac0=_0x178a7d[_0x8e7b('0x5d')][_0x8e7b('0x5e')]({'plain':!![]});if(!_0x130ac0)throw new Error(_0x8e7b('0x5f'));if(_0x130ac0[_0x8e7b('0x60')]===_0x8e7b('0x5d')){var _0x10d570=_0x1850be['get']({'plain':!![]});var _0x46e94e=_0x8e7b('0x61');return db[_0x8e7b('0x62')]['find']({'where':{'name':_0x46e94e,'userProfileId':_0x130ac0['userProfileId']},'raw':!![]})['then'](function(_0xc7dec3){if(_0xc7dec3&&_0xc7dec3[_0x8e7b('0x63')]===0x0){return db[_0x8e7b('0x36')][_0x8e7b('0x5b')]({'name':_0x10d570[_0x8e7b('0x39')],'resourceId':_0x10d570['id'],'type':_0xc7dec3[_0x8e7b('0x39')],'sectionId':_0xc7dec3['id']},{})[_0x8e7b('0x1d')](function(){return _0x1850be;});}else{return _0x1850be;}})[_0x8e7b('0x27')](function(_0x1be826){logger[_0x8e7b('0x23')](_0x8e7b('0x64'),_0x1be826);throw _0x1be826;});}return _0x1850be;})[_0x8e7b('0x1d')](respondWithResult(_0x5261c1,0xc9))[_0x8e7b('0x27')](handleError(_0x5261c1,null));};exports[_0x8e7b('0x35')]=function(_0x486c35,_0x29cfd3){if(_0x486c35[_0x8e7b('0x5c')]['id']){delete _0x486c35[_0x8e7b('0x5c')]['id'];}return db['SmsAccount'][_0x8e7b('0x5a')]({'where':{'id':_0x486c35['params']['id']},'include':[{'model':db[_0x8e7b('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x8e7b('0x1d')](handleEntityNotFound(_0x29cfd3,null))[_0x8e7b('0x1d')](saveUpdates(_0x486c35[_0x8e7b('0x5c')],null))['then'](respondWithResult(_0x29cfd3,null))['catch'](handleError(_0x29cfd3,null));};exports['destroy']=function(_0x634ede,_0x3009a6){return db['SmsAccount']['find']({'where':{'id':_0x634ede['params']['id']}})['then'](handleEntityNotFound(_0x3009a6,null))[_0x8e7b('0x1d')](removeEntity(_0x3009a6,null))[_0x8e7b('0x27')](handleError(_0x3009a6,null));};exports[_0x8e7b('0x65')]=function(_0x49a467,_0x1a3e1e){return db['SmsAccount'][_0x8e7b('0x65')]()['then'](respondWithResult(_0x1a3e1e,null))[_0x8e7b('0x27')](handleError(_0x1a3e1e,null));};exports[_0x8e7b('0x66')]=function(_0x357e81,_0x1b7570,_0x18d7ea){if(_0x357e81[_0x8e7b('0x5c')]['id']){delete _0x357e81[_0x8e7b('0x5c')]['id'];}return db['SmsAccount'][_0x8e7b('0x5a')]({'where':{'id':_0x357e81[_0x8e7b('0x67')]['id']}})[_0x8e7b('0x1d')](handleEntityNotFound(_0x1b7570,null))[_0x8e7b('0x1d')](function(_0x245cad){if(_0x245cad){_0x357e81[_0x8e7b('0x5c')]['SmsAccountId']=_0x245cad['id'];return db[_0x8e7b('0x68')][_0x8e7b('0x5b')](_0x357e81[_0x8e7b('0x5c')]);}})[_0x8e7b('0x1d')](respondWithResult(_0x1b7570,null))[_0x8e7b('0x27')](handleError(_0x1b7570,null));};exports[_0x8e7b('0x69')]=function(_0x2a587f,_0x2afee6,_0x58c2d7){var _0xe10109={'raw':![],'where':{}};var _0x24a55e={};var _0x6d0286={'count':0x0,'rows':[]};return db[_0x8e7b('0x3e')]['findOne']({'where':{'id':_0x2a587f[_0x8e7b('0x67')]['id']}})[_0x8e7b('0x1d')](handleEntityNotFound(_0x2afee6,null))[_0x8e7b('0x1d')](function(_0x1da6ad){if(_0x1da6ad){_0x24a55e['model']=_[_0x8e7b('0x46')](db[_0x8e7b('0x68')]['rawAttributes']);_0x24a55e['query']=_[_0x8e7b('0x46')](_0x2a587f[_0x8e7b('0x45')]);_0x24a55e[_0x8e7b('0x47')]=_[_0x8e7b('0x48')](_0x24a55e[_0x8e7b('0x43')],_0x24a55e[_0x8e7b('0x45')]);_0xe10109['attributes']=_[_0x8e7b('0x48')](_0x24a55e[_0x8e7b('0x43')],qs[_0x8e7b('0x4a')](_0x2a587f[_0x8e7b('0x45')][_0x8e7b('0x4a')]));_0xe10109[_0x8e7b('0x49')]=_0xe10109[_0x8e7b('0x49')]['length']?_0xe10109[_0x8e7b('0x49')]:_0x24a55e[_0x8e7b('0x43')];if(!_0x2a587f[_0x8e7b('0x45')][_0x8e7b('0x6a')](_0x8e7b('0x4c'))){_0xe10109[_0x8e7b('0x2c')]=qs[_0x8e7b('0x2c')](_0x2a587f[_0x8e7b('0x45')][_0x8e7b('0x2c')]);_0xe10109[_0x8e7b('0x2b')]=qs[_0x8e7b('0x2b')](_0x2a587f[_0x8e7b('0x45')]['offset']);}_0xe10109[_0x8e7b('0x4d')]=qs['sort'](_0x2a587f[_0x8e7b('0x45')][_0x8e7b('0x4e')]);_0xe10109['where']=qs[_0x8e7b('0x47')](_['pick'](_0x2a587f[_0x8e7b('0x45')],_0x24a55e[_0x8e7b('0x47')]));_0xe10109['where'][_0x8e7b('0x6b')]=_0x1da6ad['id'];if(_0x2a587f[_0x8e7b('0x45')]['filter']){_0xe10109[_0x8e7b('0x54')]=_[_0x8e7b('0x52')](_0xe10109[_0x8e7b('0x54')],{'$or':_[_0x8e7b('0x44')](_0xe10109[_0x8e7b('0x49')],function(_0x1f7eec){var _0x14cc56={};_0x14cc56[_0x1f7eec]={'$like':'%'+_0x2a587f['query'][_0x8e7b('0x50')]+'%'};return _0x14cc56;})});}_0xe10109=_[_0x8e7b('0x52')]({},_0xe10109,_0x2a587f[_0x8e7b('0x53')]);return db[_0x8e7b('0x68')][_0x8e7b('0x2e')]({'where':_0xe10109['where']})[_0x8e7b('0x1d')](function(_0x1a3156){_0x6d0286[_0x8e7b('0x2e')]=_0x1a3156;if(_0x2a587f[_0x8e7b('0x45')]['includeAll']){_0xe10109[_0x8e7b('0x55')]=[{'all':!![]}];}return db[_0x8e7b('0x68')][_0x8e7b('0x56')](_0xe10109);})[_0x8e7b('0x1d')](function(_0x155f6d){_0x6d0286['rows']=_0x155f6d;return _0x6d0286;});}})[_0x8e7b('0x1d')](respondWithFilteredResult(_0x2afee6,_0xe10109))['catch'](handleError(_0x2afee6,null));};exports['removeDispositions']=function(_0xbd4563,_0x4993d7,_0x2d6607){return db[_0x8e7b('0x3e')][_0x8e7b('0x5a')]({'where':{'id':_0xbd4563[_0x8e7b('0x67')]['id']}})['then'](handleEntityNotFound(_0x4993d7,null))['then'](function(_0x3e02c0){if(_0x3e02c0){return _0x3e02c0[_0x8e7b('0x6c')](_0xbd4563[_0x8e7b('0x45')]['ids']);}})[_0x8e7b('0x1d')](respondWithStatusCode(_0x4993d7,null))[_0x8e7b('0x27')](handleError(_0x4993d7,null));};exports[_0x8e7b('0x6d')]=function(_0x169f80,_0x2b97f4,_0x5b3696){if(_0x169f80['body']['id']){delete _0x169f80['body']['id'];}return db['SmsAccount'][_0x8e7b('0x5a')]({'where':{'id':_0x169f80[_0x8e7b('0x67')]['id']}})[_0x8e7b('0x1d')](handleEntityNotFound(_0x2b97f4,null))[_0x8e7b('0x1d')](function(_0x23ae03){if(_0x23ae03){_0x169f80['body'][_0x8e7b('0x6b')]=_0x23ae03['id'];return db[_0x8e7b('0x6e')][_0x8e7b('0x5b')](_0x169f80[_0x8e7b('0x5c')]);}})['then'](respondWithResult(_0x2b97f4,null))['catch'](handleError(_0x2b97f4,null));};exports[_0x8e7b('0x6f')]=function(_0x4cede6,_0x1d8461,_0x441e93){var _0x33e993={'raw':![],'where':{}};var _0x45f8b8={};var _0x33f8d9={'count':0x0,'rows':[]};return db[_0x8e7b('0x3e')]['findOne']({'where':{'id':_0x4cede6[_0x8e7b('0x67')]['id']}})[_0x8e7b('0x1d')](handleEntityNotFound(_0x1d8461,null))[_0x8e7b('0x1d')](function(_0x5aafe0){if(_0x5aafe0){_0x45f8b8[_0x8e7b('0x43')]=_[_0x8e7b('0x46')](db['CannedAnswer']['rawAttributes']);_0x45f8b8[_0x8e7b('0x45')]=_[_0x8e7b('0x46')](_0x4cede6[_0x8e7b('0x45')]);_0x45f8b8[_0x8e7b('0x47')]=_[_0x8e7b('0x48')](_0x45f8b8['model'],_0x45f8b8[_0x8e7b('0x45')]);_0x33e993['attributes']=_[_0x8e7b('0x48')](_0x45f8b8[_0x8e7b('0x43')],qs[_0x8e7b('0x4a')](_0x4cede6[_0x8e7b('0x45')][_0x8e7b('0x4a')]));_0x33e993[_0x8e7b('0x49')]=_0x33e993[_0x8e7b('0x49')][_0x8e7b('0x4b')]?_0x33e993[_0x8e7b('0x49')]:_0x45f8b8[_0x8e7b('0x43')];if(!_0x4cede6[_0x8e7b('0x45')][_0x8e7b('0x6a')]('nolimit')){_0x33e993[_0x8e7b('0x2c')]=qs[_0x8e7b('0x2c')](_0x4cede6[_0x8e7b('0x45')]['limit']);_0x33e993[_0x8e7b('0x2b')]=qs[_0x8e7b('0x2b')](_0x4cede6[_0x8e7b('0x45')][_0x8e7b('0x2b')]);}_0x33e993[_0x8e7b('0x4d')]=qs[_0x8e7b('0x4e')](_0x4cede6[_0x8e7b('0x45')][_0x8e7b('0x4e')]);_0x33e993[_0x8e7b('0x54')]=qs[_0x8e7b('0x47')](_['pick'](_0x4cede6[_0x8e7b('0x45')],_0x45f8b8[_0x8e7b('0x47')]));_0x33e993[_0x8e7b('0x54')][_0x8e7b('0x6b')]=_0x5aafe0['id'];if(_0x4cede6[_0x8e7b('0x45')]['filter']){_0x33e993[_0x8e7b('0x54')]=_[_0x8e7b('0x52')](_0x33e993['where'],{'$or':_[_0x8e7b('0x44')](_0x33e993[_0x8e7b('0x49')],function(_0x51b54c){var _0x5ee98a={};_0x5ee98a[_0x51b54c]={'$like':'%'+_0x4cede6[_0x8e7b('0x45')]['filter']+'%'};return _0x5ee98a;})});}_0x33e993=_[_0x8e7b('0x52')]({},_0x33e993,_0x4cede6['options']);return db['CannedAnswer'][_0x8e7b('0x2e')]({'where':_0x33e993['where']})[_0x8e7b('0x1d')](function(_0x2d49f5){_0x33f8d9[_0x8e7b('0x2e')]=_0x2d49f5;if(_0x4cede6[_0x8e7b('0x45')][_0x8e7b('0x59')]){_0x33e993['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x33e993);})[_0x8e7b('0x1d')](function(_0x1bfb0f){_0x33f8d9[_0x8e7b('0x57')]=_0x1bfb0f;return _0x33f8d9;});}})[_0x8e7b('0x1d')](respondWithFilteredResult(_0x1d8461,_0x33e993))['catch'](handleError(_0x1d8461,null));};exports['removeAnswers']=function(_0x2742e0,_0x3e1ab5,_0x4dfa66){return db['SmsAccount'][_0x8e7b('0x5a')]({'where':{'id':_0x2742e0['params']['id']}})[_0x8e7b('0x1d')](handleEntityNotFound(_0x3e1ab5,null))[_0x8e7b('0x1d')](function(_0x238129){if(_0x238129){return _0x238129[_0x8e7b('0x70')](_0x2742e0['query'][_0x8e7b('0x71')]);}})[_0x8e7b('0x1d')](respondWithStatusCode(_0x3e1ab5,null))[_0x8e7b('0x27')](handleError(_0x3e1ab5,null));};exports[_0x8e7b('0x72')]=function(_0x2c4c89,_0xee0663,_0x3596b1){var _0xa12cb={'channel':_0x8e7b('0x73')};var _0x38e697=[];var _0x470de2=[];var _0x13425d={};return db[_0x8e7b('0x3e')][_0x8e7b('0x5a')]({'where':{'id':_0x2c4c89['params']['id']},'include':[{'model':db[_0x8e7b('0x74')],'as':_0x8e7b('0x75')}]})['then'](handleEntityNotFound(_0xee0663,null))[_0x8e7b('0x1d')](function(_0x1f00df){_0xa12cb['account']=_0x1f00df;_0xa12cb[_0x8e7b('0x76')]=_[_0x8e7b('0x77')](_0x1f00df['Applications'],[_0x8e7b('0x78')],[_0x8e7b('0x79')]);if(_0xa12cb[_0x8e7b('0x7a')][_0x8e7b('0x75')]){delete _0xa12cb['account'][_0x8e7b('0x75')];}return db[_0x8e7b('0x7b')][_0x8e7b('0x65')]();})[_0x8e7b('0x1d')](function(_0x939407){if(!_0x939407){throw new db[(_0x8e7b('0x7c'))][(_0x8e7b('0x7d'))](_0x8e7b('0x7e'));}_0x38e697=_[_0x8e7b('0x7f')](_['keys'](_0x939407),[_0x8e7b('0x80'),_0x8e7b('0x81')]);_0x470de2=_[_0x8e7b('0x7f')](_[_0x8e7b('0x46')](_0x939407),['createdAt',_0x8e7b('0x81'),_0x8e7b('0x82'),_0x8e7b('0x83')]);_0xa12cb['body']={'mapKey':_0x8e7b('0x84')};if(_0xa12cb[_0x8e7b('0x7a')]['type']){switch(_0xa12cb[_0x8e7b('0x7a')][_0x8e7b('0x41')]){case _0x8e7b('0x85'):_0xa12cb[_0x8e7b('0x5c')]['from']=_0x2c4c89[_0x8e7b('0x5c')][_0x8e7b('0x86')];_0xa12cb['body'][_0x8e7b('0x5c')]=_0x2c4c89['body'][_0x8e7b('0x87')];_0xa12cb[_0x8e7b('0x5c')]['messageId']=_0x2c4c89['body'][_0x8e7b('0x88')];break;case _0x8e7b('0x89'):_0xa12cb['body'][_0x8e7b('0x8a')]='+'+_0x2c4c89[_0x8e7b('0x5c')]['sender'];_0xa12cb[_0x8e7b('0x5c')]['body']=_0x2c4c89[_0x8e7b('0x5c')][_0x8e7b('0x8b')];break;case _0x8e7b('0x8c'):_0xa12cb['body'][_0x8e7b('0x8a')]=_0x2c4c89['body'][_0x8e7b('0x8a')];_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x5c')]=_0x2c4c89[_0x8e7b('0x5c')][_0x8e7b('0x25')];break;case _0x8e7b('0x8d'):_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8a')]=_0x2c4c89[_0x8e7b('0x5c')]['from'];_0xa12cb[_0x8e7b('0x5c')]['body']=_0x2c4c89[_0x8e7b('0x5c')]['body'];_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8e')]=_0x2c4c89[_0x8e7b('0x5c')][_0x8e7b('0x8f')];break;case _0x8e7b('0x90'):_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8a')]=_0x2c4c89[_0x8e7b('0x5c')][_0x8e7b('0x86')];_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x5c')]=_0x2c4c89[_0x8e7b('0x5c')][_0x8e7b('0x91')];_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8e')]=_0x2c4c89['body'][_0x8e7b('0x92')];break;case'infobip':_0xa12cb['body'][_0x8e7b('0x8a')]='+'+_0x2c4c89[_0x8e7b('0x5c')]['results'][0x0]['from'];_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x5c')]=_0x2c4c89[_0x8e7b('0x5c')][_0x8e7b('0x93')][0x0][_0x8e7b('0x8b')];_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8e')]=_0x2c4c89[_0x8e7b('0x5c')][_0x8e7b('0x93')][0x0][_0x8e7b('0x8e')];break;case _0x8e7b('0x94'):_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8a')]=_0x2c4c89[_0x8e7b('0x5c')]['originatingAddress'];_0xa12cb['body'][_0x8e7b('0x5c')]=_0x2c4c89[_0x8e7b('0x5c')][_0x8e7b('0x95')][_0x8e7b('0x25')];break;case _0x8e7b('0x96'):_0xa12cb['body'][_0x8e7b('0x8a')]=_0x2c4c89[_0x8e7b('0x5c')][_0x8e7b('0x97')];_0xa12cb['body']['body']=_0x2c4c89[_0x8e7b('0x5c')][_0x8e7b('0x8b')];_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8e')]=_0x2c4c89[_0x8e7b('0x5c')][_0x8e7b('0x98')];break;case'bandwidth':_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8e')]=_0x2c4c89['body'][0x0][_0x8e7b('0x25')]['id'];_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8a')]=_0x2c4c89[_0x8e7b('0x5c')][0x0]['message'][_0x8e7b('0x8a')];_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x5c')]=_0x2c4c89['body'][0x0]['message']['text'];break;case'intelepeer':_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8a')]=_0x2c4c89[_0x8e7b('0x5c')][_0x8e7b('0x8a')];_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x5c')]=_0x2c4c89['body'][_0x8e7b('0x25')];_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8e')]=_0x2c4c89[_0x8e7b('0x5c')]['refid'];break;}}if(_0xa12cb[_0x8e7b('0x5c')]['id']){delete _0xa12cb[_0x8e7b('0x5c')]['id'];}if(_['isNil'](_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8a')])){throw new db['Sequelize']['ValidationError'](_0x8e7b('0x99'));}if(_[_0x8e7b('0x9a')](_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x5c')])||_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x5c')]===''){throw new db['Sequelize'][(_0x8e7b('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8e7b('0x9a')](_0xa12cb[_0x8e7b('0x5c')]['mapKey'])){throw new db[(_0x8e7b('0x7c'))]['ValidationError'](_0x8e7b('0x9b')+_0x470de2);}if(!_[_0x8e7b('0x9c')](_0x470de2,_0xa12cb['body'][_0x8e7b('0x9d')])){throw new db[(_0x8e7b('0x7c'))][(_0x8e7b('0x7d'))](_0x8e7b('0x9e')+_0x470de2);}_0x13425d[_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x9d')]]=_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8a')];return db[_0x8e7b('0x9f')][_0x8e7b('0x5a')]({'where':{'id':_0xa12cb[_0x8e7b('0x7a')][_0x8e7b('0x83')]},'include':[{'model':db['CmContact'],'as':_0x8e7b('0xa0'),'where':_0x13425d,'limit':0x1,'order':[['updatedAt',_0x8e7b('0xa1')]]}]});})['then'](handleEntityNotFound(_0xee0663,null))[_0x8e7b('0x1d')](function(_0x1b2845){if(_0x1b2845){_0xa12cb[_0x8e7b('0xa2')]=_[_0x8e7b('0xa3')](_0x1b2845,['Contacts']);if(_0x1b2845[_0x8e7b('0xa0')][_0x8e7b('0x4b')]){return _0x1b2845['Contacts'][0x0];}var _0xb5ed59=_[_0x8e7b('0x19')](_0xa12cb[_0x8e7b('0x5c')],{'firstName':_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8a')],'ListId':_0x1b2845['id']});_0xb5ed59[_0xa12cb['body'][_0x8e7b('0x9d')]]=_0xa12cb[_0x8e7b('0x5c')]['from'];return db[_0x8e7b('0x7b')][_0x8e7b('0x5b')](_0xb5ed59,{'fields':_0x38e697,'raw':!![]});}})['then'](handleEntityNotFound(_0xee0663,null))[_0x8e7b('0x1d')](function(_0x12bc3b){if(_0x12bc3b){_0xa12cb[_0x8e7b('0xa4')]=_0x12bc3b;var _0x44b1f5={'ContactId':_0x12bc3b['id'],'phone':_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8a')],'SmsAccountId':_0x2c4c89[_0x8e7b('0x67')]['id']};var _0x165ec4={'ContactId':_0x12bc3b['id'],'SmsAccountId':_0x2c4c89[_0x8e7b('0x67')]['id'],'closed':![]};return db['SmsInteraction'][_0x8e7b('0x5a')]({'where':_0x165ec4})[_0x8e7b('0x1d')](function(_0x7e4a2a){if(_0x7e4a2a){return[_0x7e4a2a,![]];}return db['SmsInteraction'][_0x8e7b('0x5b')](_0x44b1f5)[_0x8e7b('0x1d')](function(_0x195b7e){return[_0x195b7e,!![]];});});}})[_0x8e7b('0xa5')](function(_0x1aa262,_0x364592){_0xa12cb[_0x8e7b('0xa6')]=_0x1aa262[_0x8e7b('0x5e')]({'plain':!![]});_0xa12cb['interaction'][_0x8e7b('0xa7')]=![];if(_0x364592){if(_0xa12cb[_0x8e7b('0x7a')]['autoclose']){_0xa12cb[_0x8e7b('0x76')][_0x8e7b('0xa8')]({'id':0x0,'priority':_0xa12cb[_0x8e7b('0x76')][_0x8e7b('0x4b')]+0x1,'app':_0x8e7b('0xa9'),'appdata':_0x8e7b('0xaa'),'interval':_0x8e7b('0xab')});}_0xa12cb['interaction'][_0x8e7b('0xa7')]=!![];}return db['SmsMessage'][_0x8e7b('0x5b')]({'phone':_0xa12cb['body'][_0x8e7b('0x8a')],'messageId':_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x8e')],'body':_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0x5c')],'SmsAccountId':_0x2c4c89[_0x8e7b('0x67')]['id'],'SmsInteractionId':_0x1aa262['id'],'direction':'in','ContactId':_0x1aa262[_0x8e7b('0xac')],'AttachmentId':_0xa12cb[_0x8e7b('0x5c')][_0x8e7b('0xad')]});})['then'](function(_0x43df46){_0xa12cb[_0x8e7b('0x25')]=_0x43df46;if(_0xa12cb['interaction'][_0x8e7b('0xae')]){return db[_0x8e7b('0xaf')][_0x8e7b('0x5a')]({'attributes':['id',_0x8e7b('0x39')],'where':{'id':_0xa12cb[_0x8e7b('0xa6')]['UserId']}})[_0x8e7b('0x1d')](function(_0x1b784c){if(_0x1b784c){_0xa12cb[_0x8e7b('0x76')][_0x8e7b('0xb0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1b784c['name']+','+(_0xa12cb['account'][_0x8e7b('0xb1')]||0xa),'interval':_0x8e7b('0xab')});}return respondWithRpcPromise('Start','startRouting',_0xa12cb);});}return respondWithRpcPromise(_0x8e7b('0xb2'),'startRouting',_0xa12cb);})[_0x8e7b('0x1d')](function(_0x4bb7bb){if(_0x4bb7bb){var _0x4696e4=0xc8;var _0x1c6c29=_0x8e7b('0xb3');logger[_0x8e7b('0x1e')](_0x8e7b('0x20'),_0x1c6c29,_0x4696e4,_0x8e7b('0xb4'));logger[_0x8e7b('0xb5')](_0x8e7b('0xb6'),_0x1c6c29,_0x4696e4,'entity\x20found',JSON[_0x8e7b('0x22')](_0x4bb7bb));if(_0xa12cb[_0x8e7b('0x7a')][_0x8e7b('0x41')]===_0x8e7b('0x85')){return _0xee0663['status'](_0x4696e4)[_0x8e7b('0x2f')]('Content-Type',_0x8e7b('0xb7'))[_0x8e7b('0x3a')](_0x8e7b('0xb8'));}else{return _0xee0663['status'](_0x4696e4)[_0x8e7b('0x31')](_0x4bb7bb);}}})['catch'](handleError(_0xee0663,null));};exports[_0x8e7b('0xb9')]=function(_0x45df7e,_0x344b60,_0x500921){return db[_0x8e7b('0x3e')]['findOne']({'where':{'id':_0x45df7e[_0x8e7b('0x67')]['id']}})['then'](handleEntityNotFound(_0x344b60,null))['then'](function(_0x4d434e){if(_0x4d434e){return db['sequelize'][_0x8e7b('0xba')](function(_0x166b09){return db[_0x8e7b('0x74')][_0x8e7b('0x37')]({'where':{'SmsAccountId':_0x45df7e[_0x8e7b('0x67')]['id']},'transaction':_0x166b09})['then'](function(_0x317c57){var _0x207833=_[_0x8e7b('0x44')](_0x45df7e['body'],function(_0x4b16d2){_0x4b16d2[_0x8e7b('0x6b')]=_0x45df7e[_0x8e7b('0x67')]['id'];return _0x4b16d2;});return db[_0x8e7b('0x74')][_0x8e7b('0xbb')](_0x207833,{'transaction':_0x166b09});});})['then'](function(){return db[_0x8e7b('0x74')]['findAndCountAll']({'where':{'SmsAccountId':_0x45df7e[_0x8e7b('0x67')]['id']},'order':_0x8e7b('0x78')});});}})['then'](respondWithResult(_0x344b60,null))[_0x8e7b('0x27')](handleError(_0x344b60,null));};exports['getApplications']=function(_0x3ee830,_0x87a7f8,_0x5aa959){var _0x1cc82a={};var _0x50f329={};var _0x2da218;var _0xc92958;return db[_0x8e7b('0x3e')][_0x8e7b('0xbc')]({'where':{'id':_0x3ee830['params']['id']}})[_0x8e7b('0x1d')](handleEntityNotFound(_0x87a7f8,null))[_0x8e7b('0x1d')](function(_0x5abe6d){if(_0x5abe6d){_0x2da218=_0x5abe6d;_0x50f329[_0x8e7b('0x43')]=_['keys'](db[_0x8e7b('0x74')][_0x8e7b('0x3f')]);_0x50f329[_0x8e7b('0x45')]=_[_0x8e7b('0x46')](_0x3ee830[_0x8e7b('0x45')]);_0x50f329[_0x8e7b('0x47')]=_[_0x8e7b('0x48')](_0x50f329[_0x8e7b('0x43')],_0x50f329[_0x8e7b('0x45')]);_0x1cc82a[_0x8e7b('0x49')]=_['intersection'](_0x50f329[_0x8e7b('0x43')],qs[_0x8e7b('0x4a')](_0x3ee830[_0x8e7b('0x45')][_0x8e7b('0x4a')]));_0x1cc82a[_0x8e7b('0x49')]=_0x1cc82a[_0x8e7b('0x49')][_0x8e7b('0x4b')]?_0x1cc82a[_0x8e7b('0x49')]:_0x50f329[_0x8e7b('0x43')];_0x1cc82a[_0x8e7b('0x4d')]=qs[_0x8e7b('0x4e')](_0x3ee830[_0x8e7b('0x45')]['sort']);_0x1cc82a[_0x8e7b('0x54')]=qs[_0x8e7b('0x47')](_[_0x8e7b('0x4f')](_0x3ee830[_0x8e7b('0x45')],_0x50f329[_0x8e7b('0x47')]));if(_0x3ee830[_0x8e7b('0x45')][_0x8e7b('0x50')]){_0x1cc82a[_0x8e7b('0x54')]=_[_0x8e7b('0x52')](_0x1cc82a['where'],{'$or':_[_0x8e7b('0x44')](_0x1cc82a[_0x8e7b('0x49')],function(_0xecfae){var _0x349437={};_0x349437[_0xecfae]={'$like':'%'+_0x3ee830[_0x8e7b('0x45')][_0x8e7b('0x50')]+'%'};return _0x349437;})});}_0x1cc82a=_[_0x8e7b('0x52')]({},_0x1cc82a,_0x3ee830['options']);return _0x2da218[_0x8e7b('0xbd')](_0x1cc82a);}})['then'](function(_0x37fe1b){if(_0x37fe1b){_0xc92958=_0x37fe1b['length'];if(!_0x3ee830[_0x8e7b('0x45')][_0x8e7b('0x6a')](_0x8e7b('0x4c'))){_0x1cc82a[_0x8e7b('0x2c')]=qs[_0x8e7b('0x2c')](_0x3ee830[_0x8e7b('0x45')]['limit']);_0x1cc82a[_0x8e7b('0x2b')]=qs['offset'](_0x3ee830[_0x8e7b('0x45')]['offset']);}return _0x2da218[_0x8e7b('0xbd')](_0x1cc82a);}})[_0x8e7b('0x1d')](function(_0x4b4754){if(_0x4b4754){return _0x4b4754?{'count':_0xc92958,'rows':_0x4b4754}:null;}})['then'](respondWithResult(_0x87a7f8,null))['catch'](handleError(_0x87a7f8,null));};exports[_0x8e7b('0xbe')]=function(_0x5b3a1e,_0x1d12be,_0x45bfe7){var _0x321f49={'raw':![],'where':{}};var _0xabb14a={};var _0x467487={'count':0x0,'rows':[]};return db[_0x8e7b('0x3e')][_0x8e7b('0xbc')]({'where':{'id':_0x5b3a1e[_0x8e7b('0x67')]['id']}})[_0x8e7b('0x1d')](handleEntityNotFound(_0x1d12be,null))[_0x8e7b('0x1d')](function(_0x22aff7){if(_0x22aff7){_0xabb14a[_0x8e7b('0x43')]=_[_0x8e7b('0x46')](db[_0x8e7b('0xbf')][_0x8e7b('0x3f')]);_0xabb14a[_0x8e7b('0x45')]=_[_0x8e7b('0x46')](_0x5b3a1e[_0x8e7b('0x45')]);_0xabb14a[_0x8e7b('0x47')]=_[_0x8e7b('0x48')](_0xabb14a[_0x8e7b('0x43')],_0xabb14a[_0x8e7b('0x45')]);_0x321f49[_0x8e7b('0x49')]=_[_0x8e7b('0x48')](_0xabb14a['model'],qs[_0x8e7b('0x4a')](_0x5b3a1e[_0x8e7b('0x45')][_0x8e7b('0x4a')]));_0x321f49[_0x8e7b('0x49')]=_0x321f49[_0x8e7b('0x49')][_0x8e7b('0x4b')]?_0x321f49[_0x8e7b('0x49')]:_0xabb14a[_0x8e7b('0x43')];if(!_0x5b3a1e[_0x8e7b('0x45')][_0x8e7b('0x6a')](_0x8e7b('0x4c'))){_0x321f49[_0x8e7b('0x2c')]=qs[_0x8e7b('0x2c')](_0x5b3a1e[_0x8e7b('0x45')][_0x8e7b('0x2c')]);_0x321f49[_0x8e7b('0x2b')]=qs['offset'](_0x5b3a1e[_0x8e7b('0x45')][_0x8e7b('0x2b')]);}_0x321f49[_0x8e7b('0x4d')]=qs['sort'](_0x5b3a1e['query'][_0x8e7b('0x4e')]);_0x321f49['where']=qs['filters'](_['pick'](_0x5b3a1e[_0x8e7b('0x45')],_0xabb14a[_0x8e7b('0x47')]));_0x321f49[_0x8e7b('0x54')][_0x8e7b('0x6b')]=_0x22aff7['id'];if(_0x5b3a1e[_0x8e7b('0x45')][_0x8e7b('0x50')]){_0x321f49[_0x8e7b('0x54')]=_[_0x8e7b('0x52')](_0x321f49['where'],{'$or':_[_0x8e7b('0x44')](_0x321f49['attributes'],function(_0x1a614b){var _0x26445a={};_0x26445a[_0x1a614b]={'$like':'%'+_0x5b3a1e[_0x8e7b('0x45')]['filter']+'%'};return _0x26445a;})});}_0x321f49=_[_0x8e7b('0x52')]({},_0x321f49,_0x5b3a1e[_0x8e7b('0x53')]);return db[_0x8e7b('0xbf')][_0x8e7b('0x2e')]({'where':_0x321f49[_0x8e7b('0x54')]})[_0x8e7b('0x1d')](function(_0x1586cd){_0x467487[_0x8e7b('0x2e')]=_0x1586cd;if(_0x5b3a1e[_0x8e7b('0x45')][_0x8e7b('0x59')]){_0x321f49[_0x8e7b('0x55')]=[{'model':db[_0x8e7b('0x7b')],'as':_0x8e7b('0xc0'),'required':![]},{'model':db[_0x8e7b('0xaf')],'as':_0x8e7b('0xc1'),'attributes':[_0x8e7b('0x39'),_0x8e7b('0xc2'),_0x8e7b('0xc3')],'required':![]},{'model':db[_0x8e7b('0xc4')],'as':_0x8e7b('0xc5'),'attributes':['id',_0x8e7b('0x39'),_0x8e7b('0xc6')],'where':_0x5b3a1e[_0x8e7b('0x45')][_0x8e7b('0xc7')]?{'id':_0x5b3a1e['query'][_0x8e7b('0xc7')]}:undefined,'required':_0x5b3a1e[_0x8e7b('0x45')][_0x8e7b('0xc7')]?!![]:![]}];}return db[_0x8e7b('0xbf')][_0x8e7b('0x56')](_0x321f49);})[_0x8e7b('0x1d')](function(_0x25aacb){_0x467487[_0x8e7b('0x57')]=_0x25aacb;return _0x467487;});}})[_0x8e7b('0x1d')](respondWithFilteredResult(_0x1d12be,_0x321f49))[_0x8e7b('0x27')](handleError(_0x1d12be,null));};exports[_0x8e7b('0x3a')]=function(_0x54ba6e,_0x7a094,_0x2d50e4){var _0xdff6b0,_0x9e8e6b,_0x3faa30;if(_[_0x8e7b('0x9a')](_0x54ba6e[_0x8e7b('0x5c')][_0x8e7b('0x5c')])||_0x54ba6e[_0x8e7b('0x5c')][_0x8e7b('0x5c')]===''){throw new db[(_0x8e7b('0x7c'))][(_0x8e7b('0x7d'))](_0x8e7b('0xc8'));}if(_['isNil'](_0x54ba6e[_0x8e7b('0x5c')]['to'])){throw new db[(_0x8e7b('0x7c'))]['ValidationError']('to\x20is\x20mandatory');}_0xdff6b0=_0x54ba6e['body']['to'];return db[_0x8e7b('0x3e')][_0x8e7b('0x5a')]({'where':{'id':_0x54ba6e[_0x8e7b('0x67')]['id']},'include':[{'model':db[_0x8e7b('0x9f')],'as':_0x8e7b('0xc9'),'include':[{'model':db[_0x8e7b('0x7b')],'as':_0x8e7b('0xa0'),'where':{'mobile':_0xdff6b0},'limit':0x1,'order':[[_0x8e7b('0x81'),'DESC']]}]}]})[_0x8e7b('0x1d')](handleEntityNotFound(_0x7a094,null))[_0x8e7b('0x1d')](function(_0xdc9122){if(_0xdc9122&&_0xdc9122[_0x8e7b('0xc9')]){_0x9e8e6b=_0xdc9122[_0x8e7b('0x5e')]({'plain':!![]});if(_0x9e8e6b[_0x8e7b('0xc9')]&&_0x9e8e6b[_0x8e7b('0xc9')][_0x8e7b('0xa0')][_0x8e7b('0x4b')]){return _0x9e8e6b[_0x8e7b('0xc9')][_0x8e7b('0xa0')][0x0];}return db['CmContact'][_0x8e7b('0x5b')](_[_0x8e7b('0x19')](_0x54ba6e[_0x8e7b('0x5c')],{'firstName':_0xdff6b0,'mobile':_0xdff6b0,'phone':_0xdff6b0,'ListId':_0x9e8e6b['ListId']}));}})[_0x8e7b('0x1d')](handleEntityNotFound(_0x7a094,null))[_0x8e7b('0x1d')](function(_0x22f86f){if(_0x22f86f){_0x3faa30=_0x22f86f;return db[_0x8e7b('0xbf')][_0x8e7b('0x5a')]({'where':{'ContactId':_0x3faa30['id'],'closed':![],'SmsAccountId':_0x9e8e6b['id']}})[_0x8e7b('0x1d')](function(_0x115aaa){if(_0x115aaa){return[_0x115aaa,![]];}return db[_0x8e7b('0xbf')][_0x8e7b('0x5b')]({'UserId':_0x54ba6e['user']['id'],'ContactId':_0x3faa30['id'],'SmsAccountId':_0x9e8e6b['id'],'phone':_0xdff6b0,'firstMsgDirection':'out','Messages':[_['merge'](_0x54ba6e[_0x8e7b('0x5c')],{'read':![],'body':_0x54ba6e[_0x8e7b('0x5c')][_0x8e7b('0x5c')],'phone':_0xdff6b0,'SmsAccountId':_0x9e8e6b['id'],'UserId':_0x54ba6e[_0x8e7b('0x5d')]['id'],'ContactId':_0x3faa30['id']})]},{'include':[{'model':db[_0x8e7b('0xca')],'as':_0x8e7b('0xcb')}]})[_0x8e7b('0x1d')](function(_0x4da6a5){return[_0x4da6a5,!![]];});});}})[_0x8e7b('0xa5')](function(_0xa8bd42,_0x29c8b3){if(_0x29c8b3){return _0xa8bd42;}return db[_0x8e7b('0xca')][_0x8e7b('0x5b')](_[_0x8e7b('0x52')](_0x54ba6e['body'],{'read':![],'body':_0x54ba6e['body'][_0x8e7b('0x5c')],'phone':_0xdff6b0,'SmsAccountId':_0x9e8e6b['id'],'SmsInteractionId':_0xa8bd42['id'],'UserId':_0x54ba6e[_0x8e7b('0x5d')]['id'],'ContactId':_0x3faa30['id']}))['then'](function(_0x2d3a90){_0xa8bd42[_0x8e7b('0xcc')][_0x8e7b('0xcb')]=[];_0xa8bd42['dataValues'][_0x8e7b('0xcb')][_0x8e7b('0xa8')](_0x2d3a90[_0x8e7b('0xcc')]);return _0xa8bd42;});})['then'](respondWithResult(_0x7a094,null))[_0x8e7b('0x27')](handleError(_0x7a094,null));};exports['status']=function(_0xdb984d,_0x569802,_0x301136){if(_0xdb984d[_0x8e7b('0x5c')]['id']){delete _0xdb984d[_0x8e7b('0x5c')]['id'];}var _0x4168eb,_0x5ae18a,_0x3faa43;return db[_0x8e7b('0x3e')][_0x8e7b('0x5a')]({'where':{'id':_0xdb984d[_0x8e7b('0x67')]['id']}})[_0x8e7b('0x1d')](handleEntityNotFound(_0x569802,null))[_0x8e7b('0x1d')](function(_0x12e19e){if(_0x12e19e){_0x3faa43=_0x12e19e;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x8e7b('0xcd'),_0x12e19e[_0x8e7b('0x41')],util['inspect'](_0xdb984d['body'],{'showHidden':![],'depth':null}));switch(_0x12e19e[_0x8e7b('0x41')]){case _0x8e7b('0x89'):if(_0xdb984d['body'][_0x8e7b('0xce')]&&_0xdb984d['body'][_0x8e7b('0x29')]){_0x5ae18a=_0xdb984d['body']['status'];return db['SmsMessage'][_0x8e7b('0x5a')]({'where':{'messageId':_0xdb984d['body']['skebby_dispatch_id']}});}break;case _0x8e7b('0x8c'):if(_0xdb984d['body'][_0x8e7b('0xcf')]&&_0xdb984d[_0x8e7b('0x5c')][_0x8e7b('0xd0')]){_0x5ae18a=_0xdb984d[_0x8e7b('0x5c')]['statusInt'];return db['SmsMessage'][_0x8e7b('0x5a')]({'where':{'messageId':_0xdb984d[_0x8e7b('0x5c')]['requestid']}});}break;case _0x8e7b('0x8d'):if(_0xdb984d[_0x8e7b('0x5c')]['message_id']&&_0xdb984d[_0x8e7b('0x5c')]['status_code']){_0x5ae18a=_0xdb984d[_0x8e7b('0x5c')][_0x8e7b('0xd1')];return db[_0x8e7b('0xca')]['find']({'where':{'messageId':_0xdb984d['body']['message_id']}});}break;case _0x8e7b('0xd2'):var _0x4ecf00=_0xdb984d['body']['results'][0x0];if(_0x4ecf00[_0x8e7b('0x8e')]&&_0x4ecf00[_0x8e7b('0x29')][_0x8e7b('0xd3')]==='DELIVERED'){_0x5ae18a=_0x4ecf00['status'][_0x8e7b('0xd3')];return db['SmsMessage'][_0x8e7b('0x5a')]({'where':{'messageId':_0x4ecf00[_0x8e7b('0x8e')]}});}break;case _0x8e7b('0x96'):if(_0xdb984d[_0x8e7b('0x5c')][_0x8e7b('0x8e')]&&_0xdb984d[_0x8e7b('0x5c')][_0x8e7b('0x29')]){_0x5ae18a=_0xdb984d[_0x8e7b('0x5c')][_0x8e7b('0x29')];return db[_0x8e7b('0xca')][_0x8e7b('0x5a')]({'where':{'messageId':_0xdb984d[_0x8e7b('0x5c')][_0x8e7b('0x8e')]}});}break;case _0x8e7b('0xd4'):if(_0xdb984d[_0x8e7b('0x5c')][0x0][_0x8e7b('0x25')]['id']){_0x5ae18a=_0xdb984d[_0x8e7b('0x5c')][0x0][_0x8e7b('0x41')];return db[_0x8e7b('0xca')][_0x8e7b('0x5a')]({'where':{'messageId':_0xdb984d[_0x8e7b('0x5c')][0x0][_0x8e7b('0x25')]['id']}});}break;case'intelepeer':if(_0xdb984d['body']['redif']&&_0xdb984d[_0x8e7b('0x5c')]['status']){_0x5ae18a=_0xdb984d[_0x8e7b('0x5c')]['status'];return db[_0x8e7b('0xca')][_0x8e7b('0x5a')]({'where':{'messageId':_0xdb984d[_0x8e7b('0x5c')][_0x8e7b('0xd5')]}});}break;}}})[_0x8e7b('0x1d')](handleEntityNotFound(_0x569802,null))[_0x8e7b('0x1d')](function(_0x150f9c){if(_0x150f9c){_0x4168eb=_0x150f9c;switch(_0x3faa43[_0x8e7b('0x41')]){case _0x8e7b('0x89'):if(_0x5ae18a===_0x8e7b('0xd6')){return _0x4168eb[_0x8e7b('0x35')]({'read':!![]});}else{logger['error'](_0x8e7b('0x20'),_0x8e7b('0x29'),_0x8e7b('0x89'),util['inspect'](_0xdb984d['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x5ae18a==='1'){return _0x4168eb[_0x8e7b('0x35')]({'read':!![]});}else{logger[_0x8e7b('0x23')](_0x8e7b('0x20'),_0x8e7b('0x29'),'skebby',util[_0x8e7b('0xd7')](_0xdb984d[_0x8e7b('0x5c')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0xdb984d[_0x8e7b('0x5c')][_0x8e7b('0xd8')]&&_0x5ae18a>=0xc8&&_0x5ae18a<=0xce){return _0x4168eb[_0x8e7b('0x35')]({'read':!![]});}else{logger[_0x8e7b('0x23')](_0x8e7b('0x20'),'status',_0x8e7b('0x8d'),util['inspect'](_0xdb984d[_0x8e7b('0x5c')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xe8846=_0xdb984d[_0x8e7b('0x5c')][_0x8e7b('0x93')][0x0];if(_0xe8846[_0x8e7b('0x29')][_0x8e7b('0xd3')]==='DELIVERED'){return _0x4168eb['update']({'read':!![]});}else{logger['error'](_0x8e7b('0x20'),_0x8e7b('0x29'),_0x8e7b('0xd2'),util[_0x8e7b('0xd7')](_0xdb984d['body'],{'showHidden':![],'depth':null}));}break;case _0x8e7b('0x96'):if(_0x5ae18a==_0x8e7b('0xd9')||_0x5ae18a==_0x8e7b('0xda')){return _0x4168eb[_0x8e7b('0x35')]({'read':!![]});}else{logger[_0x8e7b('0x23')](_0x8e7b('0x20'),_0x8e7b('0x29'),_0x8e7b('0x96'),util[_0x8e7b('0xd7')](_0xdb984d[_0x8e7b('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x8e7b('0xd4'):if(_0x5ae18a==_0x8e7b('0xdb')){return _0x4168eb[_0x8e7b('0x35')]({'read':!![]});}else{logger['error'](_0x8e7b('0x20'),_0x8e7b('0x29'),_0x8e7b('0xd4'),util[_0x8e7b('0xd7')](_0xdb984d[_0x8e7b('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x8e7b('0xdc'):if(_0x5ae18a===_0x8e7b('0xdd')||_0x5ae18a===_0x8e7b('0xde')){return _0x4168eb[_0x8e7b('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8e7b('0x29'),'intelepeer',util[_0x8e7b('0xd7')](_0xdb984d['body'],{'showHidden':![],'depth':null}));}break;}return _0x4168eb;}})[_0x8e7b('0x1d')](respondWithResult(_0x569802,null))[_0x8e7b('0x27')](handleError(_0x569802,null));};exports[_0x8e7b('0xdf')]=function(_0x592367,_0x2e5257,_0x2f82df){var _0x4452b8,_0xd3f30,_0x1a733c;return db[_0x8e7b('0x3e')][_0x8e7b('0x5a')]({'where':{'id':_0x592367[_0x8e7b('0x67')]['id']}})[_0x8e7b('0x1d')](handleEntityNotFound(_0x2e5257,null))[_0x8e7b('0x1d')](function(_0x1a749d){if(_0x1a749d){_0x1a733c=_0x1a749d;logger['debug'](_0x8e7b('0x20'),'status',_0x8e7b('0xcd'),_0x1a749d[_0x8e7b('0x41')],util[_0x8e7b('0xd7')](_0x592367[_0x8e7b('0x45')],{'showHidden':![],'depth':null}));switch(_0x1a749d[_0x8e7b('0x41')]){case _0x8e7b('0x94'):if(_0x592367[_0x8e7b('0x45')][_0x8e7b('0xe0')]&&_0x592367[_0x8e7b('0x45')][_0x8e7b('0xe1')]){_0xd3f30=_0x592367[_0x8e7b('0x45')][_0x8e7b('0xe1')];return db['SmsMessage']['find']({'where':{'messageId':_0x592367[_0x8e7b('0x45')][_0x8e7b('0xe0')]}});}break;}}})[_0x8e7b('0x1d')](handleEntityNotFound(_0x2e5257,null))['then'](function(_0x4ddd4f){if(_0x4ddd4f){_0x4452b8=_0x4ddd4f;switch(_0x1a733c[_0x8e7b('0x41')]){case _0x8e7b('0x94'):if(_0xd3f30==='2'||_0xd3f30==='6'){return _0x4452b8[_0x8e7b('0x35')]({'read':!![]});}else{logger['error'](_0x8e7b('0x20'),_0x8e7b('0x29'),_0x8e7b('0x94'),util[_0x8e7b('0xd7')](_0x592367[_0x8e7b('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x4452b8;}})['then'](respondWithResult(_0x2e5257,null))[_0x8e7b('0x27')](handleError(_0x2e5257,null));};exports['addAgents']=function(_0x15057b,_0x3c02c0,_0x250610){return db['SmsAccount'][_0x8e7b('0x5a')]({'where':{'id':_0x15057b['params']['id']}})['then'](handleEntityNotFound(_0x3c02c0,null))[_0x8e7b('0x1d')](function(_0x552815){if(_0x552815){return _0x552815[_0x8e7b('0xe2')](_0x15057b['body'][_0x8e7b('0x71')],_[_0x8e7b('0xa3')](_0x15057b[_0x8e7b('0x5c')],[_0x8e7b('0x71'),'id'])||{})['spread'](function(_0x124737){for(var _0x5151f3=0x0;_0x5151f3<_0x15057b[_0x8e7b('0x5c')]['ids']['length'];_0x5151f3+=0x1){socket[_0x8e7b('0xe3')](_0x8e7b('0xe4'),{'UserId':Number(_0x15057b['body'][_0x8e7b('0x71')][_0x5151f3]),'SmsAccountId':Number(_0x15057b[_0x8e7b('0x67')]['id'])});}return _0x124737;});}})[_0x8e7b('0x1d')](respondWithResult(_0x3c02c0,null))['catch'](handleError(_0x3c02c0,null));};exports[_0x8e7b('0xe5')]=function(_0x543c7a,_0x542be1,_0x166f05){return db[_0x8e7b('0x3e')]['find']({'where':{'id':_0x543c7a['params']['id']}})[_0x8e7b('0x1d')](handleEntityNotFound(_0x542be1,null))[_0x8e7b('0x1d')](function(_0x4cdc21){if(_0x4cdc21){return _0x4cdc21[_0x8e7b('0xe5')](_0x543c7a[_0x8e7b('0x45')]['ids'])[_0x8e7b('0x1d')](function(){if(_[_0x8e7b('0xe6')](_0x543c7a['query'][_0x8e7b('0x71')])){for(var _0x11ea42=0x0;_0x11ea42<_0x543c7a[_0x8e7b('0x45')][_0x8e7b('0x71')]['length'];_0x11ea42+=0x1){socket[_0x8e7b('0xe3')](_0x8e7b('0xe7'),{'UserId':Number(_0x543c7a['query'][_0x8e7b('0x71')][_0x11ea42]),'SmsAccountId':Number(_0x543c7a[_0x8e7b('0x67')]['id'])});}}else{socket[_0x8e7b('0xe3')](_0x8e7b('0xe7'),{'UserId':Number(_0x543c7a['query'][_0x8e7b('0x71')]),'SmsAccountId':Number(_0x543c7a[_0x8e7b('0x67')]['id'])});}});}})[_0x8e7b('0x1d')](respondWithStatusCode(_0x542be1,null))[_0x8e7b('0x27')](handleError(_0x542be1,null));};exports[_0x8e7b('0xe8')]=function(_0x24a01c,_0x4d28c7,_0x1ff289){var _0x13fb78={};var _0x31dc5d={};var _0xbbace6;var _0x581055;return db[_0x8e7b('0x3e')][_0x8e7b('0xbc')]({'where':{'id':_0x24a01c['params']['id']}})[_0x8e7b('0x1d')](handleEntityNotFound(_0x4d28c7,null))[_0x8e7b('0x1d')](function(_0x4177d7){if(_0x4177d7){_0xbbace6=_0x4177d7;_0x31dc5d[_0x8e7b('0x43')]=_[_0x8e7b('0x46')](db['User'][_0x8e7b('0x3f')]);_0x31dc5d['query']=_[_0x8e7b('0x46')](_0x24a01c['query']);_0x31dc5d[_0x8e7b('0x47')]=_[_0x8e7b('0x48')](_0x31dc5d[_0x8e7b('0x43')],_0x31dc5d[_0x8e7b('0x45')]);_0x13fb78[_0x8e7b('0x49')]=_[_0x8e7b('0x48')](_0x31dc5d[_0x8e7b('0x43')],qs['fields'](_0x24a01c[_0x8e7b('0x45')][_0x8e7b('0x4a')]));_0x13fb78[_0x8e7b('0x49')]=_0x13fb78[_0x8e7b('0x49')][_0x8e7b('0x4b')]?_0x13fb78[_0x8e7b('0x49')]:_0x31dc5d['model'];_0x13fb78['order']=qs[_0x8e7b('0x4e')](_0x24a01c['query']['sort']);_0x13fb78[_0x8e7b('0x54')]=qs[_0x8e7b('0x47')](_[_0x8e7b('0x4f')](_0x24a01c['query'],_0x31dc5d[_0x8e7b('0x47')]));if(_0x24a01c[_0x8e7b('0x45')][_0x8e7b('0x50')]){_0x13fb78[_0x8e7b('0x54')]=_[_0x8e7b('0x52')](_0x13fb78['where'],{'$or':_[_0x8e7b('0x44')](_0x13fb78[_0x8e7b('0x49')],function(_0x4c53eb){var _0x209137={};_0x209137[_0x4c53eb]={'$like':'%'+_0x24a01c['query'][_0x8e7b('0x50')]+'%'};return _0x209137;})});}_0x13fb78=_[_0x8e7b('0x52')]({},_0x13fb78,_0x24a01c[_0x8e7b('0x53')]);return _0xbbace6[_0x8e7b('0xe8')](_0x13fb78);}})[_0x8e7b('0x1d')](function(_0x342589){if(_0x342589){_0x581055=_0x342589[_0x8e7b('0x4b')];if(!_0x24a01c[_0x8e7b('0x45')][_0x8e7b('0x6a')]('nolimit')){_0x13fb78[_0x8e7b('0x2c')]=qs['limit'](_0x24a01c[_0x8e7b('0x45')][_0x8e7b('0x2c')]);_0x13fb78[_0x8e7b('0x2b')]=qs['offset'](_0x24a01c[_0x8e7b('0x45')]['offset']);}return _0xbbace6[_0x8e7b('0xe8')](_0x13fb78);}})[_0x8e7b('0x1d')](function(_0x54b6a5){if(_0x54b6a5){return _0x54b6a5?{'count':_0x581055,'rows':_0x54b6a5}:null;}})[_0x8e7b('0x1d')](respondWithResult(_0x4d28c7,null))[_0x8e7b('0x27')](handleError(_0x4d28c7,null));}; \ No newline at end of file +var _0x1f73=['apply','reject','save','update','get','SmsAccounts','UserProfileResource','destroy','name','send','index','mandatoryDispositionPause','map','SmsAccount','fieldName','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','includeAll','findAll','rows','show','rawAttributes','keys','intersection','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','SmsAccountId','findOne','Disposition','pick','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','Applications','account','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','message_id','Text','MessageUUID','infobip','results','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','*,*,*,*','User','UserId','unshift','agent','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','redif','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','moment','mustache','util','path','sox','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','SmsAccount,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x47bd60,_0x22f024){var _0x523729=function(_0x9b333a){while(--_0x9b333a){_0x47bd60['push'](_0x47bd60['shift']());}};_0x523729(++_0x22f024);}(_0x1f73,0x191));var _0x31f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1f73[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x31f7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x31f7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x31f7('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x31f7('0x3'));var util=require(_0x31f7('0x4'));var path=require(_0x31f7('0x5'));var sox=require(_0x31f7('0x6'));var csv=require(_0x31f7('0x7'));var ejs=require(_0x31f7('0x8'));var fs=require('fs');var fs_extra=require(_0x31f7('0x9'));var _=require(_0x31f7('0xa'));var squel=require('squel');var crypto=require(_0x31f7('0xb'));var jsforce=require(_0x31f7('0xc'));var deskjs=require(_0x31f7('0xd'));var toCsv=require(_0x31f7('0x7'));var querystring=require(_0x31f7('0xe'));var Papa=require(_0x31f7('0xf'));var Redis=require(_0x31f7('0x10'));var authService=require(_0x31f7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x31f7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x31f7('0x13'))(_0x31f7('0x14'));var utils=require(_0x31f7('0x15'));var config=require(_0x31f7('0x16'));var licenseUtil=require(_0x31f7('0x17'));var db=require(_0x31f7('0x18'))['db'];config[_0x31f7('0x19')]=_[_0x31f7('0x1a')](config[_0x31f7('0x19')],{'host':_0x31f7('0x1b'),'port':0x18eb});var socket=require(_0x31f7('0x1c'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x31f7('0x1d')](socket);var jayson=require(_0x31f7('0x1e'));var client=jayson[_0x31f7('0x1f')][_0x31f7('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x51452a,_0x2f053a,_0x2d7803,_0x52ace0){return new BPromise(function(_0x4f70e2,_0x3127ae){var _0x28286f=_0x52ace0||client;return _0x28286f[_0x31f7('0x21')](_0x51452a,_0x2d7803)[_0x31f7('0x22')](function(_0x2965f9){logger['info']('SmsAccount,\x20%s,\x20%s',_0x2f053a,_0x31f7('0x23'));logger[_0x31f7('0x24')](_0x31f7('0x25'),_0x2f053a,_0x31f7('0x23'),JSON['stringify'](_0x2965f9));if(_0x2965f9[_0x31f7('0x26')]){if(_0x2965f9[_0x31f7('0x26')][_0x31f7('0x27')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x2f053a,_0x2965f9[_0x31f7('0x26')][_0x31f7('0x28')]);return _0x3127ae(_0x2965f9[_0x31f7('0x26')][_0x31f7('0x28')]);}logger[_0x31f7('0x26')](_0x31f7('0x29'),_0x2f053a,_0x2965f9[_0x31f7('0x26')][_0x31f7('0x28')]);return _0x4f70e2(_0x2965f9['error']['message']);}else{logger[_0x31f7('0x2a')](_0x31f7('0x29'),_0x2f053a,_0x31f7('0x23'));_0x4f70e2(_0x2965f9[_0x31f7('0x2b')]['message']);}})[_0x31f7('0x2c')](function(_0x4eddb6){logger[_0x31f7('0x26')](_0x31f7('0x29'),_0x2f053a,_0x4eddb6);_0x3127ae(_0x4eddb6);});});}function respondWithStatusCode(_0x5c9b6d,_0x2f8aa4){_0x2f8aa4=_0x2f8aa4||0xcc;return function(_0x12837a){if(_0x12837a){return _0x5c9b6d[_0x31f7('0x2d')](_0x2f8aa4);}return _0x5c9b6d[_0x31f7('0x2e')](_0x2f8aa4)[_0x31f7('0x2f')]();};}function respondWithResult(_0x4473a4,_0x3e7aa9){_0x3e7aa9=_0x3e7aa9||0xc8;return function(_0x4c656c){if(_0x4c656c){return _0x4473a4[_0x31f7('0x2e')](_0x3e7aa9)[_0x31f7('0x30')](_0x4c656c);}};}function respondWithFilteredResult(_0x4472b0,_0x53da00){return function(_0x3be376){if(_0x3be376){var _0x4ae1bb=typeof _0x53da00['offset']===_0x31f7('0x31')&&typeof _0x53da00[_0x31f7('0x32')]===_0x31f7('0x31');var _0x21d470=_0x3be376[_0x31f7('0x33')];var _0x4b7875=_0x4ae1bb?0x0:_0x53da00[_0x31f7('0x34')];var _0x4d14f7=_0x4ae1bb?_0x3be376[_0x31f7('0x33')]:_0x53da00[_0x31f7('0x34')]+_0x53da00[_0x31f7('0x32')];var _0x4f9f5e;if(_0x4d14f7>=_0x21d470){_0x4d14f7=_0x21d470;_0x4f9f5e=0xc8;}else{_0x4f9f5e=0xce;}_0x4472b0['status'](_0x4f9f5e);return _0x4472b0[_0x31f7('0x35')](_0x31f7('0x36'),_0x4b7875+'-'+_0x4d14f7+'/'+_0x21d470)[_0x31f7('0x30')](_0x3be376);}return null;};}function patchUpdates(_0x56ac46){return function(_0x52442d){try{jsonpatch[_0x31f7('0x37')](_0x52442d,_0x56ac46,!![]);}catch(_0x264ffc){return BPromise[_0x31f7('0x38')](_0x264ffc);}return _0x52442d[_0x31f7('0x39')]();};}function saveUpdates(_0x524907,_0x4ab2d0){return function(_0x43cb26){if(_0x43cb26){return _0x43cb26[_0x31f7('0x3a')](_0x524907)[_0x31f7('0x22')](function(_0xbe864b){return _0xbe864b;});}return null;};}function removeEntity(_0x2aa52a,_0xb516a6){return function(_0xa7185c){if(_0xa7185c){return _0xa7185c['destroy']()['then'](function(){var _0x5d3d31=_0xa7185c[_0x31f7('0x3b')]({'plain':!![]});var _0x2c074b=_0x31f7('0x3c');return db[_0x31f7('0x3d')][_0x31f7('0x3e')]({'where':{'type':_0x2c074b,'resourceId':_0x5d3d31['id']}})[_0x31f7('0x22')](function(){return _0xa7185c;});})['then'](function(){_0x2aa52a[_0x31f7('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35b98a,_0x29a060){return function(_0x16a2e4){if(!_0x16a2e4){_0x35b98a[_0x31f7('0x2d')](0x194);}return _0x16a2e4;};}function handleError(_0x4a103f,_0x5f1c17){_0x5f1c17=_0x5f1c17||0x1f4;return function(_0x25a0f6){logger['error'](_0x25a0f6['stack']);if(_0x25a0f6[_0x31f7('0x3f')]){delete _0x25a0f6['name'];}_0x4a103f['status'](_0x5f1c17)[_0x31f7('0x40')](_0x25a0f6);};}exports[_0x31f7('0x41')]=function(_0x40dd1d,_0x2d7cc3){var _0x1868a4={'include':[{'model':db['Pause'],'as':_0x31f7('0x42')}]},_0x4e367e={},_0x1466ff={'count':0x0,'rows':[]};var _0x3bf041=_[_0x31f7('0x43')](db[_0x31f7('0x44')]['rawAttributes'],function(_0x4de90b){return{'name':_0x4de90b[_0x31f7('0x45')],'type':_0x4de90b['type']['key']};});_0x4e367e['model']=_[_0x31f7('0x43')](_0x3bf041,_0x31f7('0x3f'));_0x4e367e[_0x31f7('0x46')]=_['keys'](_0x40dd1d[_0x31f7('0x46')]);_0x4e367e[_0x31f7('0x47')]=_['intersection'](_0x4e367e[_0x31f7('0x48')],_0x4e367e[_0x31f7('0x46')]);_0x1868a4[_0x31f7('0x49')]=_['intersection'](_0x4e367e[_0x31f7('0x48')],qs[_0x31f7('0x4a')](_0x40dd1d['query']['fields']));_0x1868a4['attributes']=_0x1868a4[_0x31f7('0x49')][_0x31f7('0x4b')]?_0x1868a4['attributes']:_0x4e367e[_0x31f7('0x48')];if(!_0x40dd1d[_0x31f7('0x46')][_0x31f7('0x4c')](_0x31f7('0x4d'))){_0x1868a4[_0x31f7('0x32')]=qs['limit'](_0x40dd1d['query'][_0x31f7('0x32')]);_0x1868a4[_0x31f7('0x34')]=qs[_0x31f7('0x34')](_0x40dd1d[_0x31f7('0x46')][_0x31f7('0x34')]);}_0x1868a4[_0x31f7('0x4e')]=qs[_0x31f7('0x4f')](_0x40dd1d[_0x31f7('0x46')][_0x31f7('0x4f')]);_0x1868a4[_0x31f7('0x50')]=qs[_0x31f7('0x47')](_['pick'](_0x40dd1d[_0x31f7('0x46')],_0x4e367e['filters']),_0x3bf041);if(_0x40dd1d['query'][_0x31f7('0x51')]){_0x1868a4[_0x31f7('0x50')]=_['merge'](_0x1868a4[_0x31f7('0x50')],{'$or':_[_0x31f7('0x43')](_0x3bf041,function(_0x183f2d){if(_0x183f2d[_0x31f7('0x52')]!=='VIRTUAL'){var _0x414ec3={};_0x414ec3[_0x183f2d['name']]={'$like':'%'+_0x40dd1d[_0x31f7('0x46')][_0x31f7('0x51')]+'%'};return _0x414ec3;}})});}_0x1868a4=_[_0x31f7('0x53')]({},_0x1868a4,_0x40dd1d['options']);var _0x40aea3={'where':_0x1868a4[_0x31f7('0x50')]};return db[_0x31f7('0x44')][_0x31f7('0x33')](_0x40aea3)['then'](function(_0x542954){_0x1466ff[_0x31f7('0x33')]=_0x542954;if(_0x40dd1d[_0x31f7('0x46')][_0x31f7('0x54')]){_0x1868a4['include']=[{'all':!![]}];}return db[_0x31f7('0x44')][_0x31f7('0x55')](_0x1868a4);})['then'](function(_0x4aa065){_0x1466ff[_0x31f7('0x56')]=_0x4aa065;return _0x1466ff;})[_0x31f7('0x22')](respondWithFilteredResult(_0x2d7cc3,_0x1868a4))[_0x31f7('0x2c')](handleError(_0x2d7cc3,null));};exports[_0x31f7('0x57')]=function(_0x493569,_0x414a79){var _0x5cd588={'raw':![],'where':{'id':_0x493569['params']['id']},'include':[{'model':db['Pause'],'as':_0x31f7('0x42')}]},_0x4ac484={};_0x4ac484[_0x31f7('0x48')]=_['keys'](db[_0x31f7('0x44')][_0x31f7('0x58')]);_0x4ac484[_0x31f7('0x46')]=_[_0x31f7('0x59')](_0x493569['query']);_0x4ac484[_0x31f7('0x47')]=_['intersection'](_0x4ac484[_0x31f7('0x48')],_0x4ac484['query']);_0x5cd588[_0x31f7('0x49')]=_[_0x31f7('0x5a')](_0x4ac484[_0x31f7('0x48')],qs[_0x31f7('0x4a')](_0x493569[_0x31f7('0x46')]['fields']));_0x5cd588[_0x31f7('0x49')]=_0x5cd588['attributes'][_0x31f7('0x4b')]?_0x5cd588[_0x31f7('0x49')]:_0x4ac484[_0x31f7('0x48')];if(_0x493569[_0x31f7('0x46')][_0x31f7('0x54')]){_0x5cd588[_0x31f7('0x5b')]=[{'all':!![]}];}_0x5cd588=_[_0x31f7('0x53')]({},_0x5cd588,_0x493569[_0x31f7('0x5c')]);return db[_0x31f7('0x44')][_0x31f7('0x5d')](_0x5cd588)['then'](handleEntityNotFound(_0x414a79,null))[_0x31f7('0x22')](respondWithResult(_0x414a79,null))['catch'](handleError(_0x414a79,null));};exports[_0x31f7('0x5e')]=function(_0xd1c1a7,_0x15fbfe){return db[_0x31f7('0x44')][_0x31f7('0x5e')](_0xd1c1a7['body'],{})[_0x31f7('0x22')](function(_0x4671db){var _0x288ace=_0xd1c1a7[_0x31f7('0x5f')][_0x31f7('0x3b')]({'plain':!![]});if(!_0x288ace)throw new Error(_0x31f7('0x60'));if(_0x288ace[_0x31f7('0x61')]==='user'){var _0x21ec89=_0x4671db['get']({'plain':!![]});var _0x1662de=_0x31f7('0x3c');return db[_0x31f7('0x62')][_0x31f7('0x5d')]({'where':{'name':_0x1662de,'userProfileId':_0x288ace[_0x31f7('0x63')]},'raw':!![]})['then'](function(_0x31c218){if(_0x31c218&&_0x31c218[_0x31f7('0x64')]===0x0){return db[_0x31f7('0x3d')][_0x31f7('0x5e')]({'name':_0x21ec89[_0x31f7('0x3f')],'resourceId':_0x21ec89['id'],'type':_0x31c218[_0x31f7('0x3f')],'sectionId':_0x31c218['id']},{})[_0x31f7('0x22')](function(){return _0x4671db;});}else{return _0x4671db;}})[_0x31f7('0x2c')](function(_0x259d01){logger[_0x31f7('0x26')](_0x31f7('0x65'),_0x259d01);throw _0x259d01;});}return _0x4671db;})[_0x31f7('0x22')](respondWithResult(_0x15fbfe,0xc9))[_0x31f7('0x2c')](handleError(_0x15fbfe,null));};exports[_0x31f7('0x3a')]=function(_0x198850,_0x23c517){if(_0x198850[_0x31f7('0x66')]['id']){delete _0x198850[_0x31f7('0x66')]['id'];}return db[_0x31f7('0x44')][_0x31f7('0x5d')]({'where':{'id':_0x198850['params']['id']},'include':[{'model':db['Pause'],'as':_0x31f7('0x42')}]})[_0x31f7('0x22')](handleEntityNotFound(_0x23c517,null))['then'](saveUpdates(_0x198850[_0x31f7('0x66')],null))[_0x31f7('0x22')](respondWithResult(_0x23c517,null))[_0x31f7('0x2c')](handleError(_0x23c517,null));};exports['destroy']=function(_0x40f9eb,_0x3f56cb){return db[_0x31f7('0x44')][_0x31f7('0x5d')]({'where':{'id':_0x40f9eb[_0x31f7('0x67')]['id']}})[_0x31f7('0x22')](handleEntityNotFound(_0x3f56cb,null))[_0x31f7('0x22')](removeEntity(_0x3f56cb,null))['catch'](handleError(_0x3f56cb,null));};exports[_0x31f7('0x68')]=function(_0x182373,_0x1978d1){return db[_0x31f7('0x44')][_0x31f7('0x68')]()[_0x31f7('0x22')](respondWithResult(_0x1978d1,null))[_0x31f7('0x2c')](handleError(_0x1978d1,null));};exports[_0x31f7('0x69')]=function(_0x35a0d0,_0x545066,_0x4001a5){if(_0x35a0d0['body']['id']){delete _0x35a0d0[_0x31f7('0x66')]['id'];}return db[_0x31f7('0x44')][_0x31f7('0x5d')]({'where':{'id':_0x35a0d0[_0x31f7('0x67')]['id']}})[_0x31f7('0x22')](handleEntityNotFound(_0x545066,null))[_0x31f7('0x22')](function(_0x20fca0){if(_0x20fca0){_0x35a0d0[_0x31f7('0x66')][_0x31f7('0x6a')]=_0x20fca0['id'];return db['Disposition'][_0x31f7('0x5e')](_0x35a0d0[_0x31f7('0x66')]);}})[_0x31f7('0x22')](respondWithResult(_0x545066,null))[_0x31f7('0x2c')](handleError(_0x545066,null));};exports['getDispositions']=function(_0xa94327,_0x2abfd6,_0x192670){var _0x326ab4={'raw':![],'where':{}};var _0x164263={};var _0x1361dd={'count':0x0,'rows':[]};return db[_0x31f7('0x44')][_0x31f7('0x6b')]({'where':{'id':_0xa94327[_0x31f7('0x67')]['id']}})[_0x31f7('0x22')](handleEntityNotFound(_0x2abfd6,null))[_0x31f7('0x22')](function(_0x2aa7f5){if(_0x2aa7f5){_0x164263[_0x31f7('0x48')]=_['keys'](db[_0x31f7('0x6c')][_0x31f7('0x58')]);_0x164263[_0x31f7('0x46')]=_[_0x31f7('0x59')](_0xa94327[_0x31f7('0x46')]);_0x164263[_0x31f7('0x47')]=_[_0x31f7('0x5a')](_0x164263[_0x31f7('0x48')],_0x164263['query']);_0x326ab4['attributes']=_[_0x31f7('0x5a')](_0x164263[_0x31f7('0x48')],qs[_0x31f7('0x4a')](_0xa94327[_0x31f7('0x46')][_0x31f7('0x4a')]));_0x326ab4[_0x31f7('0x49')]=_0x326ab4[_0x31f7('0x49')]['length']?_0x326ab4[_0x31f7('0x49')]:_0x164263[_0x31f7('0x48')];if(!_0xa94327[_0x31f7('0x46')][_0x31f7('0x4c')]('nolimit')){_0x326ab4['limit']=qs[_0x31f7('0x32')](_0xa94327['query'][_0x31f7('0x32')]);_0x326ab4[_0x31f7('0x34')]=qs[_0x31f7('0x34')](_0xa94327[_0x31f7('0x46')][_0x31f7('0x34')]);}_0x326ab4['order']=qs[_0x31f7('0x4f')](_0xa94327[_0x31f7('0x46')][_0x31f7('0x4f')]);_0x326ab4[_0x31f7('0x50')]=qs[_0x31f7('0x47')](_[_0x31f7('0x6d')](_0xa94327[_0x31f7('0x46')],_0x164263[_0x31f7('0x47')]));_0x326ab4['where'][_0x31f7('0x6a')]=_0x2aa7f5['id'];if(_0xa94327[_0x31f7('0x46')][_0x31f7('0x51')]){_0x326ab4[_0x31f7('0x50')]=_[_0x31f7('0x53')](_0x326ab4[_0x31f7('0x50')],{'$or':_[_0x31f7('0x43')](_0x326ab4[_0x31f7('0x49')],function(_0x5afb41){var _0x24c72a={};_0x24c72a[_0x5afb41]={'$like':'%'+_0xa94327[_0x31f7('0x46')][_0x31f7('0x51')]+'%'};return _0x24c72a;})});}_0x326ab4=_[_0x31f7('0x53')]({},_0x326ab4,_0xa94327[_0x31f7('0x5c')]);return db[_0x31f7('0x6c')][_0x31f7('0x33')]({'where':_0x326ab4[_0x31f7('0x50')]})[_0x31f7('0x22')](function(_0x5af209){_0x1361dd[_0x31f7('0x33')]=_0x5af209;if(_0xa94327[_0x31f7('0x46')][_0x31f7('0x54')]){_0x326ab4[_0x31f7('0x5b')]=[{'all':!![]}];}return db['Disposition'][_0x31f7('0x55')](_0x326ab4);})['then'](function(_0x508c27){_0x1361dd[_0x31f7('0x56')]=_0x508c27;return _0x1361dd;});}})[_0x31f7('0x22')](respondWithFilteredResult(_0x2abfd6,_0x326ab4))[_0x31f7('0x2c')](handleError(_0x2abfd6,null));};exports[_0x31f7('0x6e')]=function(_0x3a343a,_0x5e220e,_0x4d195a){return db['SmsAccount']['find']({'where':{'id':_0x3a343a[_0x31f7('0x67')]['id']}})['then'](handleEntityNotFound(_0x5e220e,null))['then'](function(_0x3e63cf){if(_0x3e63cf){return _0x3e63cf[_0x31f7('0x6e')](_0x3a343a[_0x31f7('0x46')][_0x31f7('0x6f')]);}})[_0x31f7('0x22')](respondWithStatusCode(_0x5e220e,null))[_0x31f7('0x2c')](handleError(_0x5e220e,null));};exports['addAnswer']=function(_0x227629,_0x18024b,_0x5bc9ee){if(_0x227629[_0x31f7('0x66')]['id']){delete _0x227629[_0x31f7('0x66')]['id'];}return db[_0x31f7('0x44')][_0x31f7('0x5d')]({'where':{'id':_0x227629[_0x31f7('0x67')]['id']}})['then'](handleEntityNotFound(_0x18024b,null))[_0x31f7('0x22')](function(_0x5b150c){if(_0x5b150c){_0x227629[_0x31f7('0x66')][_0x31f7('0x6a')]=_0x5b150c['id'];return db[_0x31f7('0x70')][_0x31f7('0x5e')](_0x227629[_0x31f7('0x66')]);}})['then'](respondWithResult(_0x18024b,null))[_0x31f7('0x2c')](handleError(_0x18024b,null));};exports[_0x31f7('0x71')]=function(_0x5d5fab,_0x410937,_0x3702d6){var _0x107c32={'raw':![],'where':{}};var _0x2b912c={};var _0x5e3f51={'count':0x0,'rows':[]};return db['SmsAccount'][_0x31f7('0x6b')]({'where':{'id':_0x5d5fab[_0x31f7('0x67')]['id']}})['then'](handleEntityNotFound(_0x410937,null))[_0x31f7('0x22')](function(_0x648239){if(_0x648239){_0x2b912c[_0x31f7('0x48')]=_[_0x31f7('0x59')](db[_0x31f7('0x70')]['rawAttributes']);_0x2b912c[_0x31f7('0x46')]=_[_0x31f7('0x59')](_0x5d5fab['query']);_0x2b912c[_0x31f7('0x47')]=_['intersection'](_0x2b912c[_0x31f7('0x48')],_0x2b912c[_0x31f7('0x46')]);_0x107c32[_0x31f7('0x49')]=_['intersection'](_0x2b912c[_0x31f7('0x48')],qs[_0x31f7('0x4a')](_0x5d5fab[_0x31f7('0x46')][_0x31f7('0x4a')]));_0x107c32[_0x31f7('0x49')]=_0x107c32['attributes']['length']?_0x107c32[_0x31f7('0x49')]:_0x2b912c[_0x31f7('0x48')];if(!_0x5d5fab[_0x31f7('0x46')][_0x31f7('0x4c')](_0x31f7('0x4d'))){_0x107c32[_0x31f7('0x32')]=qs[_0x31f7('0x32')](_0x5d5fab[_0x31f7('0x46')][_0x31f7('0x32')]);_0x107c32[_0x31f7('0x34')]=qs['offset'](_0x5d5fab[_0x31f7('0x46')]['offset']);}_0x107c32[_0x31f7('0x4e')]=qs['sort'](_0x5d5fab[_0x31f7('0x46')][_0x31f7('0x4f')]);_0x107c32[_0x31f7('0x50')]=qs[_0x31f7('0x47')](_['pick'](_0x5d5fab[_0x31f7('0x46')],_0x2b912c[_0x31f7('0x47')]));_0x107c32[_0x31f7('0x50')][_0x31f7('0x6a')]=_0x648239['id'];if(_0x5d5fab[_0x31f7('0x46')][_0x31f7('0x51')]){_0x107c32[_0x31f7('0x50')]=_[_0x31f7('0x53')](_0x107c32[_0x31f7('0x50')],{'$or':_[_0x31f7('0x43')](_0x107c32[_0x31f7('0x49')],function(_0x5418fa){var _0x208822={};_0x208822[_0x5418fa]={'$like':'%'+_0x5d5fab['query'][_0x31f7('0x51')]+'%'};return _0x208822;})});}_0x107c32=_[_0x31f7('0x53')]({},_0x107c32,_0x5d5fab[_0x31f7('0x5c')]);return db['CannedAnswer']['count']({'where':_0x107c32[_0x31f7('0x50')]})['then'](function(_0x1ce7e7){_0x5e3f51[_0x31f7('0x33')]=_0x1ce7e7;if(_0x5d5fab[_0x31f7('0x46')][_0x31f7('0x54')]){_0x107c32['include']=[{'all':!![]}];}return db[_0x31f7('0x70')]['findAll'](_0x107c32);})[_0x31f7('0x22')](function(_0xa98e49){_0x5e3f51['rows']=_0xa98e49;return _0x5e3f51;});}})[_0x31f7('0x22')](respondWithFilteredResult(_0x410937,_0x107c32))[_0x31f7('0x2c')](handleError(_0x410937,null));};exports['removeAnswers']=function(_0x164e38,_0x48f163,_0x2e1a23){return db[_0x31f7('0x44')]['find']({'where':{'id':_0x164e38[_0x31f7('0x67')]['id']}})[_0x31f7('0x22')](handleEntityNotFound(_0x48f163,null))[_0x31f7('0x22')](function(_0x59ee66){if(_0x59ee66){return _0x59ee66[_0x31f7('0x72')](_0x164e38[_0x31f7('0x46')][_0x31f7('0x6f')]);}})[_0x31f7('0x22')](respondWithStatusCode(_0x48f163,null))[_0x31f7('0x2c')](handleError(_0x48f163,null));};exports[_0x31f7('0x73')]=function(_0x498302,_0xdc3e42,_0x15c40b){var _0x11a2e3={'channel':'sms'};var _0x1ef99e=[];var _0x5781ca=[];var _0x278f64={};return db['SmsAccount'][_0x31f7('0x5d')]({'where':{'id':_0x498302[_0x31f7('0x67')]['id']},'include':[{'model':db[_0x31f7('0x74')],'as':_0x31f7('0x75')}]})[_0x31f7('0x22')](handleEntityNotFound(_0xdc3e42,null))[_0x31f7('0x22')](function(_0x2bdcf0){_0x11a2e3[_0x31f7('0x76')]=_0x2bdcf0;_0x11a2e3['applications']=_['orderBy'](_0x2bdcf0['Applications'],[_0x31f7('0x77')],[_0x31f7('0x78')]);if(_0x11a2e3[_0x31f7('0x76')][_0x31f7('0x75')]){delete _0x11a2e3[_0x31f7('0x76')][_0x31f7('0x75')];}return db['CmContact']['describe']();})[_0x31f7('0x22')](function(_0x6e1afb){if(!_0x6e1afb){throw new db[(_0x31f7('0x79'))][(_0x31f7('0x7a'))](_0x31f7('0x7b'));}_0x1ef99e=_[_0x31f7('0x7c')](_['keys'](_0x6e1afb),['createdAt',_0x31f7('0x7d')]);_0x5781ca=_[_0x31f7('0x7c')](_[_0x31f7('0x59')](_0x6e1afb),[_0x31f7('0x7e'),_0x31f7('0x7d'),_0x31f7('0x7f'),_0x31f7('0x80')]);_0x11a2e3[_0x31f7('0x66')]={'mapKey':'mobile'};if(_0x11a2e3[_0x31f7('0x76')][_0x31f7('0x52')]){switch(_0x11a2e3[_0x31f7('0x76')]['type']){case _0x31f7('0x81'):_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x82')]=_0x498302[_0x31f7('0x66')][_0x31f7('0x83')];_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x66')]=_0x498302['body'][_0x31f7('0x84')];_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x85')]=_0x498302[_0x31f7('0x66')][_0x31f7('0x86')];break;case _0x31f7('0x87'):_0x11a2e3['body'][_0x31f7('0x82')]='+'+_0x498302[_0x31f7('0x66')][_0x31f7('0x88')];_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x66')]=_0x498302[_0x31f7('0x66')][_0x31f7('0x89')];break;case _0x31f7('0x8a'):_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x82')]=_0x498302[_0x31f7('0x66')][_0x31f7('0x82')];_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x66')]=_0x498302[_0x31f7('0x66')][_0x31f7('0x28')];break;case'clicksend':_0x11a2e3[_0x31f7('0x66')]['from']=_0x498302[_0x31f7('0x66')][_0x31f7('0x82')];_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x66')]=_0x498302[_0x31f7('0x66')][_0x31f7('0x66')];_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x85')]=_0x498302[_0x31f7('0x66')][_0x31f7('0x8b')];break;case'plivo':_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x82')]=_0x498302['body'][_0x31f7('0x83')];_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x66')]=_0x498302[_0x31f7('0x66')][_0x31f7('0x8c')];_0x11a2e3[_0x31f7('0x66')]['messageId']=_0x498302['body'][_0x31f7('0x8d')];break;case _0x31f7('0x8e'):_0x11a2e3['body'][_0x31f7('0x82')]='+'+_0x498302[_0x31f7('0x66')][_0x31f7('0x8f')][0x0]['from'];_0x11a2e3['body']['body']=_0x498302[_0x31f7('0x66')][_0x31f7('0x8f')][0x0][_0x31f7('0x89')];_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x85')]=_0x498302[_0x31f7('0x66')]['results'][0x0][_0x31f7('0x85')];break;case'csc':_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x82')]=_0x498302[_0x31f7('0x66')][_0x31f7('0x90')];_0x11a2e3['body'][_0x31f7('0x66')]=_0x498302[_0x31f7('0x66')]['segmentedMessage'][_0x31f7('0x28')];break;case _0x31f7('0x91'):_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x82')]=_0x498302[_0x31f7('0x66')][_0x31f7('0x92')];_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x66')]=_0x498302[_0x31f7('0x66')][_0x31f7('0x89')];_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x85')]=_0x498302['body'][_0x31f7('0x93')];break;case _0x31f7('0x94'):_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x85')]=_0x498302[_0x31f7('0x66')][0x0][_0x31f7('0x28')]['id'];_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x82')]=_0x498302[_0x31f7('0x66')][0x0][_0x31f7('0x28')]['from'];_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x66')]=_0x498302[_0x31f7('0x66')][0x0][_0x31f7('0x28')]['text'];break;case _0x31f7('0x95'):_0x11a2e3['body'][_0x31f7('0x82')]=_0x498302[_0x31f7('0x66')][_0x31f7('0x82')];_0x11a2e3[_0x31f7('0x66')]['body']=_0x498302[_0x31f7('0x66')][_0x31f7('0x28')];_0x11a2e3[_0x31f7('0x66')]['messageId']=_0x498302['body'][_0x31f7('0x96')];break;}}if(_0x11a2e3[_0x31f7('0x66')]['id']){delete _0x11a2e3[_0x31f7('0x66')]['id'];}if(_['isNil'](_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x82')])){throw new db[(_0x31f7('0x79'))][(_0x31f7('0x7a'))](_0x31f7('0x97'));}if(_[_0x31f7('0x98')](_0x11a2e3[_0x31f7('0x66')]['body'])||_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x66')]===''){throw new db[(_0x31f7('0x79'))]['ValidationError'](_0x31f7('0x99'));}if(_['isNil'](_0x11a2e3['body'][_0x31f7('0x9a')])){throw new db['Sequelize'][(_0x31f7('0x7a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5781ca);}if(!_[_0x31f7('0x9b')](_0x5781ca,_0x11a2e3[_0x31f7('0x66')]['mapKey'])){throw new db[(_0x31f7('0x79'))][(_0x31f7('0x7a'))](_0x31f7('0x9c')+_0x5781ca);}_0x278f64[_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x9a')]]=_0x11a2e3[_0x31f7('0x66')]['from'];return db[_0x31f7('0x9d')][_0x31f7('0x5d')]({'where':{'id':_0x11a2e3['account'][_0x31f7('0x80')]},'include':[{'model':db[_0x31f7('0x9e')],'as':'Contacts','where':_0x278f64,'limit':0x1,'order':[[_0x31f7('0x7d'),_0x31f7('0x9f')]]}]});})['then'](handleEntityNotFound(_0xdc3e42,null))[_0x31f7('0x22')](function(_0x3c277f){if(_0x3c277f){_0x11a2e3[_0x31f7('0xa0')]=_[_0x31f7('0xa1')](_0x3c277f,['Contacts']);if(_0x3c277f['Contacts']['length']){return _0x3c277f[_0x31f7('0xa2')][0x0];}var _0x260c93=_[_0x31f7('0x1a')](_0x11a2e3[_0x31f7('0x66')],{'firstName':_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x82')],'ListId':_0x3c277f['id']});_0x260c93[_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x9a')]]=_0x11a2e3['body'][_0x31f7('0x82')];return db[_0x31f7('0x9e')][_0x31f7('0x5e')](_0x260c93,{'fields':_0x1ef99e,'raw':!![]});}})[_0x31f7('0x22')](handleEntityNotFound(_0xdc3e42,null))[_0x31f7('0x22')](function(_0x222546){if(_0x222546){_0x11a2e3[_0x31f7('0xa3')]=_0x222546;var _0x5cbece={'ContactId':_0x222546['id'],'phone':_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x82')],'SmsAccountId':_0x498302[_0x31f7('0x67')]['id']};var _0x4ffa06={'ContactId':_0x222546['id'],'SmsAccountId':_0x498302[_0x31f7('0x67')]['id'],'closed':![]};return db[_0x31f7('0xa4')][_0x31f7('0x5d')]({'where':_0x4ffa06})[_0x31f7('0x22')](function(_0x29c6a0){if(_0x29c6a0){return[_0x29c6a0,![]];}return db[_0x31f7('0xa4')][_0x31f7('0x5e')](_0x5cbece)[_0x31f7('0x22')](function(_0x5b8316){return[_0x5b8316,!![]];});});}})[_0x31f7('0xa5')](function(_0x16c324,_0xeb4cd4){_0x11a2e3[_0x31f7('0xa6')]=_0x16c324[_0x31f7('0x3b')]({'plain':!![]});_0x11a2e3['interaction'][_0x31f7('0xa7')]=![];if(_0xeb4cd4){if(_0x11a2e3['account'][_0x31f7('0xa8')]){_0x11a2e3[_0x31f7('0xa9')][_0x31f7('0xaa')]({'id':0x0,'priority':_0x11a2e3[_0x31f7('0xa9')]['length']+0x1,'app':_0x31f7('0xab'),'appdata':'unmanaged','interval':_0x31f7('0xac')});}_0x11a2e3[_0x31f7('0xa6')][_0x31f7('0xa7')]=!![];}return db['SmsMessage'][_0x31f7('0x5e')]({'phone':_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x82')],'messageId':_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x85')],'body':_0x11a2e3[_0x31f7('0x66')][_0x31f7('0x66')],'SmsAccountId':_0x498302[_0x31f7('0x67')]['id'],'SmsInteractionId':_0x16c324['id'],'direction':'in','ContactId':_0x16c324['ContactId'],'AttachmentId':_0x11a2e3[_0x31f7('0x66')]['AttachmentId']});})['then'](function(_0x80c135){_0x11a2e3[_0x31f7('0x28')]=_0x80c135;if(_0x11a2e3[_0x31f7('0xa6')]['UserId']){return db[_0x31f7('0xad')][_0x31f7('0x5d')]({'attributes':['id',_0x31f7('0x3f')],'where':{'id':_0x11a2e3[_0x31f7('0xa6')][_0x31f7('0xae')]}})[_0x31f7('0x22')](function(_0xf8dd0f){if(_0xf8dd0f){_0x11a2e3[_0x31f7('0xa9')][_0x31f7('0xaf')]({'id':0x0,'priority':0x0,'app':_0x31f7('0xb0'),'appdata':_0xf8dd0f['name']+','+(_0x11a2e3[_0x31f7('0x76')]['waitForTheAssignedAgent']||0xa),'interval':_0x31f7('0xac')});}return respondWithRpcPromise(_0x31f7('0xb1'),_0x31f7('0xb2'),_0x11a2e3);});}return respondWithRpcPromise(_0x31f7('0xb1'),_0x31f7('0xb2'),_0x11a2e3);})[_0x31f7('0x22')](function(_0x135a94){if(_0x135a94){var _0x2eb68c=0xc8;var _0x69b0ff='receiveMessage';logger[_0x31f7('0x2a')](_0x31f7('0x25'),_0x69b0ff,_0x2eb68c,_0x31f7('0xb3'));logger[_0x31f7('0x24')](_0x31f7('0xb4'),_0x69b0ff,_0x2eb68c,_0x31f7('0xb3'),JSON['stringify'](_0x135a94));if(_0x11a2e3['account'][_0x31f7('0x52')]===_0x31f7('0x81')){return _0xdc3e42[_0x31f7('0x2e')](_0x2eb68c)[_0x31f7('0x35')](_0x31f7('0xb5'),_0x31f7('0xb6'))[_0x31f7('0x40')]('\x0a');}else{return _0xdc3e42['status'](_0x2eb68c)[_0x31f7('0x30')](_0x135a94);}}})[_0x31f7('0x2c')](handleError(_0xdc3e42,null));};exports['addApplications']=function(_0x384ea9,_0x20cd61,_0x561ad6){return db['SmsAccount']['findOne']({'where':{'id':_0x384ea9[_0x31f7('0x67')]['id']}})[_0x31f7('0x22')](handleEntityNotFound(_0x20cd61,null))[_0x31f7('0x22')](function(_0x431a25){if(_0x431a25){return db[_0x31f7('0xb7')][_0x31f7('0xb8')](function(_0xd0c4c0){return db[_0x31f7('0x74')][_0x31f7('0x3e')]({'where':{'SmsAccountId':_0x384ea9[_0x31f7('0x67')]['id']},'transaction':_0xd0c4c0})[_0x31f7('0x22')](function(_0x7430e1){var _0x178c06=_[_0x31f7('0x43')](_0x384ea9[_0x31f7('0x66')],function(_0xb4985b){_0xb4985b[_0x31f7('0x6a')]=_0x384ea9[_0x31f7('0x67')]['id'];return _0xb4985b;});return db[_0x31f7('0x74')][_0x31f7('0xb9')](_0x178c06,{'transaction':_0xd0c4c0});});})[_0x31f7('0x22')](function(){return db[_0x31f7('0x74')][_0x31f7('0xba')]({'where':{'SmsAccountId':_0x384ea9['params']['id']},'order':_0x31f7('0x77')});});}})['then'](respondWithResult(_0x20cd61,null))[_0x31f7('0x2c')](handleError(_0x20cd61,null));};exports[_0x31f7('0xbb')]=function(_0x32d31d,_0x3319f3,_0x3c0055){var _0xa70e2e={};var _0x45a9e4={};var _0xc2831c;var _0x4e189b;return db['SmsAccount'][_0x31f7('0x6b')]({'where':{'id':_0x32d31d[_0x31f7('0x67')]['id']}})['then'](handleEntityNotFound(_0x3319f3,null))[_0x31f7('0x22')](function(_0x2108d4){if(_0x2108d4){_0xc2831c=_0x2108d4;_0x45a9e4[_0x31f7('0x48')]=_[_0x31f7('0x59')](db[_0x31f7('0x74')][_0x31f7('0x58')]);_0x45a9e4[_0x31f7('0x46')]=_[_0x31f7('0x59')](_0x32d31d['query']);_0x45a9e4['filters']=_[_0x31f7('0x5a')](_0x45a9e4['model'],_0x45a9e4[_0x31f7('0x46')]);_0xa70e2e['attributes']=_[_0x31f7('0x5a')](_0x45a9e4[_0x31f7('0x48')],qs[_0x31f7('0x4a')](_0x32d31d[_0x31f7('0x46')]['fields']));_0xa70e2e[_0x31f7('0x49')]=_0xa70e2e['attributes'][_0x31f7('0x4b')]?_0xa70e2e[_0x31f7('0x49')]:_0x45a9e4[_0x31f7('0x48')];_0xa70e2e[_0x31f7('0x4e')]=qs[_0x31f7('0x4f')](_0x32d31d['query'][_0x31f7('0x4f')]);_0xa70e2e[_0x31f7('0x50')]=qs['filters'](_[_0x31f7('0x6d')](_0x32d31d[_0x31f7('0x46')],_0x45a9e4[_0x31f7('0x47')]));if(_0x32d31d[_0x31f7('0x46')][_0x31f7('0x51')]){_0xa70e2e['where']=_[_0x31f7('0x53')](_0xa70e2e[_0x31f7('0x50')],{'$or':_[_0x31f7('0x43')](_0xa70e2e['attributes'],function(_0x1b93ef){var _0x598958={};_0x598958[_0x1b93ef]={'$like':'%'+_0x32d31d[_0x31f7('0x46')]['filter']+'%'};return _0x598958;})});}_0xa70e2e=_['merge']({},_0xa70e2e,_0x32d31d[_0x31f7('0x5c')]);return _0xc2831c[_0x31f7('0xbb')](_0xa70e2e);}})[_0x31f7('0x22')](function(_0x41dc8d){if(_0x41dc8d){_0x4e189b=_0x41dc8d['length'];if(!_0x32d31d[_0x31f7('0x46')][_0x31f7('0x4c')]('nolimit')){_0xa70e2e[_0x31f7('0x32')]=qs[_0x31f7('0x32')](_0x32d31d['query'][_0x31f7('0x32')]);_0xa70e2e[_0x31f7('0x34')]=qs[_0x31f7('0x34')](_0x32d31d['query'][_0x31f7('0x34')]);}return _0xc2831c[_0x31f7('0xbb')](_0xa70e2e);}})[_0x31f7('0x22')](function(_0x3709d5){if(_0x3709d5){return _0x3709d5?{'count':_0x4e189b,'rows':_0x3709d5}:null;}})[_0x31f7('0x22')](respondWithResult(_0x3319f3,null))[_0x31f7('0x2c')](handleError(_0x3319f3,null));};exports[_0x31f7('0xbc')]=function(_0x436c74,_0x256b74,_0x55b4bb){var _0x4a847b={'raw':![],'where':{}};var _0x5a7d53={};var _0x3bd2a3={'count':0x0,'rows':[]};return db[_0x31f7('0x44')][_0x31f7('0x6b')]({'where':{'id':_0x436c74['params']['id']}})[_0x31f7('0x22')](handleEntityNotFound(_0x256b74,null))[_0x31f7('0x22')](function(_0x2747f8){if(_0x2747f8){_0x5a7d53['model']=_[_0x31f7('0x59')](db['SmsInteraction'][_0x31f7('0x58')]);_0x5a7d53[_0x31f7('0x46')]=_[_0x31f7('0x59')](_0x436c74['query']);_0x5a7d53[_0x31f7('0x47')]=_[_0x31f7('0x5a')](_0x5a7d53[_0x31f7('0x48')],_0x5a7d53[_0x31f7('0x46')]);_0x4a847b[_0x31f7('0x49')]=_['intersection'](_0x5a7d53[_0x31f7('0x48')],qs[_0x31f7('0x4a')](_0x436c74['query']['fields']));_0x4a847b[_0x31f7('0x49')]=_0x4a847b[_0x31f7('0x49')]['length']?_0x4a847b[_0x31f7('0x49')]:_0x5a7d53['model'];if(!_0x436c74[_0x31f7('0x46')][_0x31f7('0x4c')](_0x31f7('0x4d'))){_0x4a847b[_0x31f7('0x32')]=qs[_0x31f7('0x32')](_0x436c74[_0x31f7('0x46')][_0x31f7('0x32')]);_0x4a847b[_0x31f7('0x34')]=qs[_0x31f7('0x34')](_0x436c74[_0x31f7('0x46')][_0x31f7('0x34')]);}_0x4a847b[_0x31f7('0x4e')]=qs[_0x31f7('0x4f')](_0x436c74[_0x31f7('0x46')]['sort']);_0x4a847b[_0x31f7('0x50')]=qs[_0x31f7('0x47')](_[_0x31f7('0x6d')](_0x436c74[_0x31f7('0x46')],_0x5a7d53[_0x31f7('0x47')]));_0x4a847b[_0x31f7('0x50')][_0x31f7('0x6a')]=_0x2747f8['id'];if(_0x436c74[_0x31f7('0x46')][_0x31f7('0x51')]){_0x4a847b[_0x31f7('0x50')]=_[_0x31f7('0x53')](_0x4a847b[_0x31f7('0x50')],{'$or':_[_0x31f7('0x43')](_0x4a847b[_0x31f7('0x49')],function(_0x3c0240){var _0x597bd8={};_0x597bd8[_0x3c0240]={'$like':'%'+_0x436c74[_0x31f7('0x46')]['filter']+'%'};return _0x597bd8;})});}_0x4a847b=_[_0x31f7('0x53')]({},_0x4a847b,_0x436c74['options']);return db['SmsInteraction'][_0x31f7('0x33')]({'where':_0x4a847b[_0x31f7('0x50')]})[_0x31f7('0x22')](function(_0x58e2dd){_0x3bd2a3[_0x31f7('0x33')]=_0x58e2dd;if(_0x436c74['query'][_0x31f7('0x54')]){_0x4a847b['include']=[{'model':db[_0x31f7('0x9e')],'as':_0x31f7('0xbd'),'required':![]},{'model':db[_0x31f7('0xad')],'as':_0x31f7('0xbe'),'attributes':['name',_0x31f7('0xbf'),_0x31f7('0xc0')],'required':![]},{'model':db[_0x31f7('0xc1')],'as':_0x31f7('0xc2'),'attributes':['id','name',_0x31f7('0xc3')],'where':_0x436c74[_0x31f7('0x46')]['tag']?{'id':_0x436c74['query'][_0x31f7('0xc4')]}:undefined,'required':_0x436c74[_0x31f7('0x46')][_0x31f7('0xc4')]?!![]:![]}];}return db[_0x31f7('0xa4')]['findAll'](_0x4a847b);})['then'](function(_0x318663){_0x3bd2a3[_0x31f7('0x56')]=_0x318663;return _0x3bd2a3;});}})[_0x31f7('0x22')](respondWithFilteredResult(_0x256b74,_0x4a847b))['catch'](handleError(_0x256b74,null));};exports[_0x31f7('0x40')]=function(_0xf9f49e,_0x4c30c5,_0x50bf0e){var _0x226bc2,_0x2ed930,_0x52c35f;if(_['isNil'](_0xf9f49e['body'][_0x31f7('0x66')])||_0xf9f49e[_0x31f7('0x66')][_0x31f7('0x66')]===''){throw new db['Sequelize']['ValidationError'](_0x31f7('0x99'));}if(_[_0x31f7('0x98')](_0xf9f49e[_0x31f7('0x66')]['to'])){throw new db[(_0x31f7('0x79'))][(_0x31f7('0x7a'))](_0x31f7('0xc5'));}_0x226bc2=_0xf9f49e[_0x31f7('0x66')]['to'];return db['SmsAccount']['find']({'where':{'id':_0xf9f49e[_0x31f7('0x67')]['id']},'include':[{'model':db[_0x31f7('0x9d')],'as':_0x31f7('0xc6'),'include':[{'model':db['CmContact'],'as':_0x31f7('0xa2'),'where':{'mobile':_0x226bc2},'limit':0x1,'order':[[_0x31f7('0x7d'),_0x31f7('0x9f')]]}]}]})[_0x31f7('0x22')](handleEntityNotFound(_0x4c30c5,null))[_0x31f7('0x22')](function(_0x487f8b){if(_0x487f8b&&_0x487f8b[_0x31f7('0xc6')]){_0x2ed930=_0x487f8b['get']({'plain':!![]});if(_0x2ed930[_0x31f7('0xc6')]&&_0x2ed930['List'][_0x31f7('0xa2')][_0x31f7('0x4b')]){return _0x2ed930[_0x31f7('0xc6')][_0x31f7('0xa2')][0x0];}return db[_0x31f7('0x9e')]['create'](_[_0x31f7('0x1a')](_0xf9f49e[_0x31f7('0x66')],{'firstName':_0x226bc2,'mobile':_0x226bc2,'phone':_0x226bc2,'ListId':_0x2ed930[_0x31f7('0x80')]}));}})[_0x31f7('0x22')](handleEntityNotFound(_0x4c30c5,null))[_0x31f7('0x22')](function(_0x25fba4){if(_0x25fba4){_0x52c35f=_0x25fba4;return db['SmsInteraction'][_0x31f7('0x5d')]({'where':{'ContactId':_0x52c35f['id'],'closed':![],'SmsAccountId':_0x2ed930['id']}})[_0x31f7('0x22')](function(_0x5a986d){if(_0x5a986d){return[_0x5a986d,![]];}return db['SmsInteraction']['create']({'UserId':_0xf9f49e['user']['id'],'ContactId':_0x52c35f['id'],'SmsAccountId':_0x2ed930['id'],'phone':_0x226bc2,'firstMsgDirection':_0x31f7('0xc7'),'Messages':[_[_0x31f7('0x53')](_0xf9f49e[_0x31f7('0x66')],{'read':![],'body':_0xf9f49e['body'][_0x31f7('0x66')],'phone':_0x226bc2,'SmsAccountId':_0x2ed930['id'],'UserId':_0xf9f49e[_0x31f7('0x5f')]['id'],'ContactId':_0x52c35f['id']})]},{'include':[{'model':db[_0x31f7('0xc8')],'as':_0x31f7('0xc9')}]})[_0x31f7('0x22')](function(_0x33b853){return[_0x33b853,!![]];});});}})[_0x31f7('0xa5')](function(_0x15cfeb,_0x2575b9){if(_0x2575b9){return _0x15cfeb;}return db['SmsMessage']['create'](_['merge'](_0xf9f49e[_0x31f7('0x66')],{'read':![],'body':_0xf9f49e[_0x31f7('0x66')][_0x31f7('0x66')],'phone':_0x226bc2,'SmsAccountId':_0x2ed930['id'],'SmsInteractionId':_0x15cfeb['id'],'UserId':_0xf9f49e[_0x31f7('0x5f')]['id'],'ContactId':_0x52c35f['id']}))[_0x31f7('0x22')](function(_0x3e8baf){_0x15cfeb[_0x31f7('0xca')][_0x31f7('0xc9')]=[];_0x15cfeb[_0x31f7('0xca')][_0x31f7('0xc9')][_0x31f7('0xaa')](_0x3e8baf[_0x31f7('0xca')]);return _0x15cfeb;});})[_0x31f7('0x22')](respondWithResult(_0x4c30c5,null))[_0x31f7('0x2c')](handleError(_0x4c30c5,null));};exports[_0x31f7('0x2e')]=function(_0x1e6ba3,_0x362768,_0x5aec0d){if(_0x1e6ba3['body']['id']){delete _0x1e6ba3[_0x31f7('0x66')]['id'];}var _0x25e89a,_0x3930d3,_0x1292cc;return db['SmsAccount'][_0x31f7('0x5d')]({'where':{'id':_0x1e6ba3['params']['id']}})[_0x31f7('0x22')](handleEntityNotFound(_0x362768,null))[_0x31f7('0x22')](function(_0x234051){if(_0x234051){_0x1292cc=_0x234051;logger['debug'](_0x31f7('0x25'),_0x31f7('0x2e'),_0x31f7('0xcb'),_0x234051[_0x31f7('0x52')],util[_0x31f7('0xcc')](_0x1e6ba3[_0x31f7('0x66')],{'showHidden':![],'depth':null}));switch(_0x234051['type']){case _0x31f7('0x87'):if(_0x1e6ba3['body']['skebby_dispatch_id']&&_0x1e6ba3[_0x31f7('0x66')][_0x31f7('0x2e')]){_0x3930d3=_0x1e6ba3[_0x31f7('0x66')][_0x31f7('0x2e')];return db['SmsMessage'][_0x31f7('0x5d')]({'where':{'messageId':_0x1e6ba3[_0x31f7('0x66')][_0x31f7('0xcd')]}});}break;case _0x31f7('0x8a'):if(_0x1e6ba3[_0x31f7('0x66')][_0x31f7('0xce')]&&_0x1e6ba3[_0x31f7('0x66')][_0x31f7('0xcf')]){_0x3930d3=_0x1e6ba3[_0x31f7('0x66')][_0x31f7('0xcf')];return db[_0x31f7('0xc8')][_0x31f7('0x5d')]({'where':{'messageId':_0x1e6ba3[_0x31f7('0x66')][_0x31f7('0xce')]}});}break;case _0x31f7('0xd0'):if(_0x1e6ba3[_0x31f7('0x66')][_0x31f7('0x8b')]&&_0x1e6ba3[_0x31f7('0x66')][_0x31f7('0xd1')]){_0x3930d3=_0x1e6ba3[_0x31f7('0x66')][_0x31f7('0xd1')];return db[_0x31f7('0xc8')][_0x31f7('0x5d')]({'where':{'messageId':_0x1e6ba3['body'][_0x31f7('0x8b')]}});}break;case _0x31f7('0x8e'):var _0x1b9368=_0x1e6ba3[_0x31f7('0x66')]['results'][0x0];if(_0x1b9368[_0x31f7('0x85')]&&_0x1b9368[_0x31f7('0x2e')][_0x31f7('0xd2')]==='DELIVERED'){_0x3930d3=_0x1b9368[_0x31f7('0x2e')][_0x31f7('0xd2')];return db[_0x31f7('0xc8')][_0x31f7('0x5d')]({'where':{'messageId':_0x1b9368[_0x31f7('0x85')]}});}break;case _0x31f7('0x91'):if(_0x1e6ba3[_0x31f7('0x66')][_0x31f7('0x85')]&&_0x1e6ba3['body'][_0x31f7('0x2e')]){_0x3930d3=_0x1e6ba3['body'][_0x31f7('0x2e')];return db[_0x31f7('0xc8')]['find']({'where':{'messageId':_0x1e6ba3['body'][_0x31f7('0x85')]}});}break;case'bandwidth':if(_0x1e6ba3[_0x31f7('0x66')][0x0][_0x31f7('0x28')]['id']){_0x3930d3=_0x1e6ba3[_0x31f7('0x66')][0x0]['type'];return db[_0x31f7('0xc8')]['find']({'where':{'messageId':_0x1e6ba3[_0x31f7('0x66')][0x0][_0x31f7('0x28')]['id']}});}break;case _0x31f7('0x95'):if(_0x1e6ba3[_0x31f7('0x66')]['redif']&&_0x1e6ba3[_0x31f7('0x66')][_0x31f7('0x2e')]){_0x3930d3=_0x1e6ba3[_0x31f7('0x66')][_0x31f7('0x2e')];return db[_0x31f7('0xc8')][_0x31f7('0x5d')]({'where':{'messageId':_0x1e6ba3[_0x31f7('0x66')][_0x31f7('0xd3')]}});}break;}}})[_0x31f7('0x22')](handleEntityNotFound(_0x362768,null))[_0x31f7('0x22')](function(_0x4518ef){if(_0x4518ef){_0x25e89a=_0x4518ef;switch(_0x1292cc[_0x31f7('0x52')]){case _0x31f7('0x87'):if(_0x3930d3===_0x31f7('0xd4')){return _0x25e89a[_0x31f7('0x3a')]({'read':!![]});}else{logger['error'](_0x31f7('0x25'),'status','skebby',util[_0x31f7('0xcc')](_0x1e6ba3[_0x31f7('0x66')],{'showHidden':![],'depth':null}));}break;case _0x31f7('0x8a'):if(_0x3930d3==='1'){return _0x25e89a[_0x31f7('0x3a')]({'read':!![]});}else{logger[_0x31f7('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x31f7('0x2e'),_0x31f7('0x87'),util[_0x31f7('0xcc')](_0x1e6ba3['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x1e6ba3[_0x31f7('0x66')]['error_code']&&_0x3930d3>=0xc8&&_0x3930d3<=0xce){return _0x25e89a['update']({'read':!![]});}else{logger[_0x31f7('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x31f7('0x2e'),_0x31f7('0xd0'),util[_0x31f7('0xcc')](_0x1e6ba3[_0x31f7('0x66')],{'showHidden':![],'depth':null}));}break;case _0x31f7('0x8e'):var _0x47a16e=_0x1e6ba3['body'][_0x31f7('0x8f')][0x0];if(_0x47a16e['status'][_0x31f7('0xd2')]===_0x31f7('0xd4')){return _0x25e89a[_0x31f7('0x3a')]({'read':!![]});}else{logger[_0x31f7('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x31f7('0x8e'),util['inspect'](_0x1e6ba3[_0x31f7('0x66')],{'showHidden':![],'depth':null}));}break;case _0x31f7('0x91'):if(_0x3930d3==_0x31f7('0xd5')||_0x3930d3==_0x31f7('0xd6')){return _0x25e89a['update']({'read':!![]});}else{logger[_0x31f7('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x31f7('0x91'),util[_0x31f7('0xcc')](_0x1e6ba3[_0x31f7('0x66')],{'showHidden':![],'depth':null}));}break;case _0x31f7('0x94'):if(_0x3930d3==_0x31f7('0xd7')){return _0x25e89a[_0x31f7('0x3a')]({'read':!![]});}else{logger[_0x31f7('0x26')](_0x31f7('0x25'),_0x31f7('0x2e'),_0x31f7('0x94'),util[_0x31f7('0xcc')](_0x1e6ba3['body'],{'showHidden':![],'depth':null}));}break;case _0x31f7('0x95'):if(_0x3930d3===_0x31f7('0xd8')||_0x3930d3==='ACCEPTD'){return _0x25e89a[_0x31f7('0x3a')]({'read':!![]});}else{logger[_0x31f7('0x26')](_0x31f7('0x25'),_0x31f7('0x2e'),'intelepeer',util[_0x31f7('0xcc')](_0x1e6ba3[_0x31f7('0x66')],{'showHidden':![],'depth':null}));}break;}return _0x25e89a;}})[_0x31f7('0x22')](respondWithResult(_0x362768,null))[_0x31f7('0x2c')](handleError(_0x362768,null));};exports[_0x31f7('0xd9')]=function(_0x428fb4,_0x5602b1,_0x3a3ee4){var _0x446786,_0x88c85c,_0x1ce6b4;return db['SmsAccount'][_0x31f7('0x5d')]({'where':{'id':_0x428fb4[_0x31f7('0x67')]['id']}})[_0x31f7('0x22')](handleEntityNotFound(_0x5602b1,null))[_0x31f7('0x22')](function(_0x12035b){if(_0x12035b){_0x1ce6b4=_0x12035b;logger[_0x31f7('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x31f7('0xcb'),_0x12035b[_0x31f7('0x52')],util[_0x31f7('0xcc')](_0x428fb4['query'],{'showHidden':![],'depth':null}));switch(_0x12035b[_0x31f7('0x52')]){case _0x31f7('0xda'):if(_0x428fb4['query'][_0x31f7('0xdb')]&&_0x428fb4[_0x31f7('0x46')]['state']){_0x88c85c=_0x428fb4[_0x31f7('0x46')][_0x31f7('0xdc')];return db[_0x31f7('0xc8')]['find']({'where':{'messageId':_0x428fb4[_0x31f7('0x46')]['message-id']}});}break;}}})[_0x31f7('0x22')](handleEntityNotFound(_0x5602b1,null))['then'](function(_0x313752){if(_0x313752){_0x446786=_0x313752;switch(_0x1ce6b4[_0x31f7('0x52')]){case _0x31f7('0xda'):if(_0x88c85c==='2'||_0x88c85c==='6'){return _0x446786[_0x31f7('0x3a')]({'read':!![]});}else{logger[_0x31f7('0x26')](_0x31f7('0x25'),_0x31f7('0x2e'),'csc',util[_0x31f7('0xcc')](_0x428fb4[_0x31f7('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x446786;}})[_0x31f7('0x22')](respondWithResult(_0x5602b1,null))[_0x31f7('0x2c')](handleError(_0x5602b1,null));};exports[_0x31f7('0xdd')]=function(_0x364f16,_0x288695,_0x258851){return db[_0x31f7('0x44')][_0x31f7('0x5d')]({'where':{'id':_0x364f16[_0x31f7('0x67')]['id']}})[_0x31f7('0x22')](handleEntityNotFound(_0x288695,null))[_0x31f7('0x22')](function(_0x197723){if(_0x197723){return _0x197723[_0x31f7('0xdd')](_0x364f16[_0x31f7('0x66')][_0x31f7('0x6f')],_[_0x31f7('0xa1')](_0x364f16['body'],[_0x31f7('0x6f'),'id'])||{})[_0x31f7('0xa5')](function(_0x4b0411){for(var _0x342b7d=0x0;_0x342b7d<_0x364f16[_0x31f7('0x66')][_0x31f7('0x6f')][_0x31f7('0x4b')];_0x342b7d+=0x1){socket[_0x31f7('0xde')](_0x31f7('0xdf'),{'UserId':Number(_0x364f16[_0x31f7('0x66')][_0x31f7('0x6f')][_0x342b7d]),'SmsAccountId':Number(_0x364f16[_0x31f7('0x67')]['id'])});}return _0x4b0411;});}})['then'](respondWithResult(_0x288695,null))['catch'](handleError(_0x288695,null));};exports[_0x31f7('0xe0')]=function(_0x557e4d,_0x384e73,_0x187c7f){return db[_0x31f7('0x44')][_0x31f7('0x5d')]({'where':{'id':_0x557e4d[_0x31f7('0x67')]['id']}})[_0x31f7('0x22')](handleEntityNotFound(_0x384e73,null))[_0x31f7('0x22')](function(_0x1c4324){if(_0x1c4324){return _0x1c4324[_0x31f7('0xe0')](_0x557e4d['query'][_0x31f7('0x6f')])[_0x31f7('0x22')](function(){if(_[_0x31f7('0xe1')](_0x557e4d[_0x31f7('0x46')][_0x31f7('0x6f')])){for(var _0x197781=0x0;_0x197781<_0x557e4d[_0x31f7('0x46')][_0x31f7('0x6f')]['length'];_0x197781+=0x1){socket[_0x31f7('0xde')]('userSmsAccount:remove',{'UserId':Number(_0x557e4d[_0x31f7('0x46')][_0x31f7('0x6f')][_0x197781]),'SmsAccountId':Number(_0x557e4d[_0x31f7('0x67')]['id'])});}}else{socket[_0x31f7('0xde')](_0x31f7('0xe2'),{'UserId':Number(_0x557e4d['query'][_0x31f7('0x6f')]),'SmsAccountId':Number(_0x557e4d[_0x31f7('0x67')]['id'])});}});}})['then'](respondWithStatusCode(_0x384e73,null))[_0x31f7('0x2c')](handleError(_0x384e73,null));};exports[_0x31f7('0xe3')]=function(_0x1b8d44,_0x4e4531,_0x20e0df){var _0x470f14={};var _0x4df0f4={};var _0x2bccc8;var _0x12a5df;return db[_0x31f7('0x44')]['findOne']({'where':{'id':_0x1b8d44[_0x31f7('0x67')]['id']}})['then'](handleEntityNotFound(_0x4e4531,null))[_0x31f7('0x22')](function(_0x4d46c4){if(_0x4d46c4){_0x2bccc8=_0x4d46c4;_0x4df0f4['model']=_['keys'](db[_0x31f7('0xad')][_0x31f7('0x58')]);_0x4df0f4[_0x31f7('0x46')]=_[_0x31f7('0x59')](_0x1b8d44[_0x31f7('0x46')]);_0x4df0f4[_0x31f7('0x47')]=_['intersection'](_0x4df0f4[_0x31f7('0x48')],_0x4df0f4[_0x31f7('0x46')]);_0x470f14[_0x31f7('0x49')]=_[_0x31f7('0x5a')](_0x4df0f4['model'],qs[_0x31f7('0x4a')](_0x1b8d44[_0x31f7('0x46')][_0x31f7('0x4a')]));_0x470f14[_0x31f7('0x49')]=_0x470f14[_0x31f7('0x49')]['length']?_0x470f14[_0x31f7('0x49')]:_0x4df0f4[_0x31f7('0x48')];_0x470f14['order']=qs[_0x31f7('0x4f')](_0x1b8d44[_0x31f7('0x46')][_0x31f7('0x4f')]);_0x470f14[_0x31f7('0x50')]=qs['filters'](_[_0x31f7('0x6d')](_0x1b8d44[_0x31f7('0x46')],_0x4df0f4['filters']));if(_0x1b8d44[_0x31f7('0x46')][_0x31f7('0x51')]){_0x470f14[_0x31f7('0x50')]=_[_0x31f7('0x53')](_0x470f14['where'],{'$or':_[_0x31f7('0x43')](_0x470f14['attributes'],function(_0x5818df){var _0x507242={};_0x507242[_0x5818df]={'$like':'%'+_0x1b8d44['query'][_0x31f7('0x51')]+'%'};return _0x507242;})});}_0x470f14=_[_0x31f7('0x53')]({},_0x470f14,_0x1b8d44[_0x31f7('0x5c')]);return _0x2bccc8[_0x31f7('0xe3')](_0x470f14);}})['then'](function(_0x128d15){if(_0x128d15){_0x12a5df=_0x128d15['length'];if(!_0x1b8d44[_0x31f7('0x46')][_0x31f7('0x4c')](_0x31f7('0x4d'))){_0x470f14[_0x31f7('0x32')]=qs['limit'](_0x1b8d44[_0x31f7('0x46')]['limit']);_0x470f14[_0x31f7('0x34')]=qs[_0x31f7('0x34')](_0x1b8d44[_0x31f7('0x46')][_0x31f7('0x34')]);}return _0x2bccc8[_0x31f7('0xe3')](_0x470f14);}})[_0x31f7('0x22')](function(_0x15f83e){if(_0x15f83e){return _0x15f83e?{'count':_0x12a5df,'rows':_0x15f83e}:null;}})['then'](respondWithResult(_0x4e4531,null))['catch'](handleError(_0x4e4531,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 419f5fb..14acf63 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 _0xc557=['events','../../mysqldb','SmsAccount','setMaxListeners','save','hasOwnProperty','hook','exports'];(function(_0x2891be,_0x319999){var _0x3f3305=function(_0x4f1435){while(--_0x4f1435){_0x2891be['push'](_0x2891be['shift']());}};_0x3f3305(++_0x319999);}(_0xc557,0x138));var _0x7c55=function(_0x33d63e,_0x3268e5){_0x33d63e=_0x33d63e-0x0;var _0x30ed75=_0xc557[_0x33d63e];return _0x30ed75;};'use strict';var EventEmitter=require(_0x7c55('0x0'));var SmsAccount=require(_0x7c55('0x1'))['db'][_0x7c55('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7c55('0x3')](0x0);var events={'afterCreate':_0x7c55('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1dc3d5){return function(_0x47b2bf,_0x175b72,_0x3859bc){SmsAccountEvents['emit'](_0x1dc3d5+':'+_0x47b2bf['id'],_0x47b2bf);SmsAccountEvents['emit'](_0x1dc3d5,_0x47b2bf);_0x3859bc(null);};}for(var e in events){if(events[_0x7c55('0x5')](e)){var event=events[e];SmsAccount[_0x7c55('0x6')](e,emitEvent(event));}}module[_0x7c55('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0xadae=['emit','hasOwnProperty','hook','exports','../../mysqldb','SmsAccount','save','update','remove'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xadae,0x1bd));var _0xeada=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xadae[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xeada('0x0'))['db'][_0xeada('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeada('0x2'),'afterUpdate':_0xeada('0x3'),'afterDestroy':_0xeada('0x4')};function emitEvent(_0x96c66d){return function(_0x336e64,_0x28f390,_0x5bbe06){SmsAccountEvents[_0xeada('0x5')](_0x96c66d+':'+_0x336e64['id'],_0x336e64);SmsAccountEvents['emit'](_0x96c66d,_0x336e64);_0x5bbe06(null);};}for(var e in events){if(events[_0xeada('0x6')](e)){var event=events[e];SmsAccount[_0xeada('0x7')](e,emitEvent(event));}}module[_0xeada('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index bc58536..e0992db 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 _0xcccc=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','../../config/logger','api','moment','path'];(function(_0x42c341,_0x31d467){var _0x43621b=function(_0x54be74){while(--_0x54be74){_0x42c341['push'](_0x42c341['shift']());}};_0x43621b(++_0x31d467);}(_0xcccc,0xeb));var _0xcccc=function(_0x24f9d9,_0x6b4d81){_0x24f9d9=_0x24f9d9-0x0;var _0x392b6c=_0xcccc[_0x24f9d9];return _0x392b6c;};'use strict';var _=require(_0xcccc('0x0'));var util=require('util');var logger=require(_0xcccc('0x1'))(_0xcccc('0x2'));var moment=require(_0xcccc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcccc('0x4'));var rimraf=require('rimraf');var config=require(_0xcccc('0x5'));var attributes=require(_0xcccc('0x6'));module[_0xcccc('0x7')]=function(_0x5980b9,_0xdc5630){return _0x5980b9[_0xcccc('0x8')](_0xcccc('0x9'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc138=['define','sms_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0x7b7b9d,_0x2bda49){var _0x523496=function(_0x562a70){while(--_0x562a70){_0x7b7b9d['push'](_0x7b7b9d['shift']());}};_0x523496(++_0x2bda49);}(_0xc138,0x1bc));var _0x8c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc138[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8c13('0x0'));var util=require('util');var logger=require(_0x8c13('0x1'))(_0x8c13('0x2'));var moment=require(_0x8c13('0x3'));var BPromise=require(_0x8c13('0x4'));var rp=require(_0x8c13('0x5'));var fs=require('fs');var path=require(_0x8c13('0x6'));var rimraf=require(_0x8c13('0x7'));var config=require(_0x8c13('0x8'));var attributes=require(_0x8c13('0x9'));module[_0x8c13('0xa')]=function(_0x4444ba,_0x144b70){return _0x4444ba[_0x8c13('0xb')]('SmsAccount',attributes,{'tableName':_0x8c13('0xc'),'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 adc25fe..0e75486 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 _0x28ab=['request','then','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','ShowSmsAccount','SmsAccount','options','raw','where','include','model','attributes','map','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register'];(function(_0x5c1cdc,_0x322014){var _0x2e8317=function(_0x2e9dfa){while(--_0x2e9dfa){_0x5c1cdc['push'](_0x5c1cdc['shift']());}};_0x2e8317(++_0x322014);}(_0x28ab,0x118));var _0xb28a=function(_0x502bb4,_0x406ced){_0x502bb4=_0x502bb4-0x0;var _0x450e04=_0x28ab[_0x502bb4];return _0x450e04;};'use strict';var _=require(_0xb28a('0x0'));var util=require(_0xb28a('0x1'));var moment=require(_0xb28a('0x2'));var BPromise=require('bluebird');var rs=require(_0xb28a('0x3'));var fs=require('fs');var Redis=require(_0xb28a('0x4'));var db=require(_0xb28a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb28a('0x6'));var config=require(_0xb28a('0x7'));var jayson=require(_0xb28a('0x8'));var client=jayson['client'][_0xb28a('0x9')]({'port':0x232a});config[_0xb28a('0xa')]=_[_0xb28a('0xb')](config['redis'],{'host':_0xb28a('0xc'),'port':0x18eb});var socket=require(_0xb28a('0xd'))(new Redis(config[_0xb28a('0xa')]));require(_0xb28a('0xe'))[_0xb28a('0xf')](socket);function respondWithRpcPromise(_0x41ba68,_0x4e7151,_0x5bba3a){return new BPromise(function(_0x4bf112,_0x4dac43){return client[_0xb28a('0x10')](_0x41ba68,_0x5bba3a)[_0xb28a('0x11')](function(_0x25fde4){logger['info'](_0xb28a('0x12'),_0x4e7151,'request\x20sent');logger[_0xb28a('0x13')](_0xb28a('0x14'),_0x4e7151,_0xb28a('0x15'),JSON[_0xb28a('0x16')](_0x25fde4));if(_0x25fde4[_0xb28a('0x17')]){if(_0x25fde4['error'][_0xb28a('0x18')]===0x1f4){logger[_0xb28a('0x17')](_0xb28a('0x12'),_0x4e7151,_0x25fde4['error'][_0xb28a('0x19')]);return _0x4dac43(_0x25fde4[_0xb28a('0x17')][_0xb28a('0x19')]);}logger['error'](_0xb28a('0x12'),_0x4e7151,_0x25fde4[_0xb28a('0x17')][_0xb28a('0x19')]);return _0x4bf112(_0x25fde4[_0xb28a('0x17')][_0xb28a('0x19')]);}else{logger[_0xb28a('0x1a')](_0xb28a('0x12'),_0x4e7151,_0xb28a('0x15'));_0x4bf112(_0x25fde4['result'][_0xb28a('0x19')]);}})[_0xb28a('0x1b')](function(_0x599c3e){logger[_0xb28a('0x17')](_0xb28a('0x12'),_0x4e7151,_0x599c3e);_0x4dac43(_0x599c3e);});});}exports[_0xb28a('0x1c')]=function(_0x74b56b){var _0x2f4447=this;return new Promise(function(_0xaffa0e,_0xd792f9){return db[_0xb28a('0x1d')]['find']({'raw':_0x74b56b[_0xb28a('0x1e')]?_0x74b56b[_0xb28a('0x1e')][_0xb28a('0x1f')]===undefined?!![]:![]:!![],'where':_0x74b56b['options']?_0x74b56b['options'][_0xb28a('0x20')]||null:null,'attributes':_0x74b56b['options']?_0x74b56b[_0xb28a('0x1e')]['attributes']||null:null,'include':_0x74b56b[_0xb28a('0x1e')]?_0x74b56b[_0xb28a('0x1e')][_0xb28a('0x21')]?_['map'](_0x74b56b[_0xb28a('0x1e')][_0xb28a('0x21')],function(_0x4191aa){return{'model':db[_0x4191aa[_0xb28a('0x22')]],'as':_0x4191aa['as'],'attributes':_0x4191aa[_0xb28a('0x23')],'include':_0x4191aa[_0xb28a('0x21')]?_[_0xb28a('0x24')](_0x4191aa[_0xb28a('0x21')],function(_0x255425){return{'model':db[_0x255425['model']],'as':_0x255425['as'],'attributes':_0x255425['attributes'],'include':_0x255425[_0xb28a('0x21')]?_[_0xb28a('0x24')](_0x255425['include'],function(_0x2902ae){return{'model':db[_0x2902ae[_0xb28a('0x22')]],'as':_0x2902ae['as'],'attributes':_0x2902ae[_0xb28a('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb28a('0x11')](function(_0x1d7716){logger[_0xb28a('0x1a')](_0xb28a('0x1c'),_0x74b56b);logger['debug'](_0xb28a('0x1c'),_0x74b56b,JSON[_0xb28a('0x16')](_0x1d7716));_0xaffa0e(_0x1d7716);})['catch'](function(_0x2a5df8){logger['error'](_0xb28a('0x1c'),_0x2a5df8[_0xb28a('0x19')],_0x74b56b);_0xd792f9(_0x2f4447[_0xb28a('0x17')](0x1f4,_0x2a5df8['message']));});});}; \ No newline at end of file +var _0x3c5d=['../../mysqldb','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','ShowSmsAccount','SmsAccount','find','options','raw','map','model','include','attributes','stringify','catch','lodash','randomstring','ioredis'];(function(_0x3ca35a,_0x33d738){var _0xdcfd82=function(_0x53a745){while(--_0x53a745){_0x3ca35a['push'](_0x3ca35a['shift']());}};_0xdcfd82(++_0x33d738);}(_0x3c5d,0x1b7));var _0xd3c5=function(_0x2a56e0,_0x45bc5f){_0x2a56e0=_0x2a56e0-0x0;var _0x161672=_0x3c5d[_0x2a56e0];return _0x161672;};'use strict';var _=require(_0xd3c5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd3c5('0x1'));var fs=require('fs');var Redis=require(_0xd3c5('0x2'));var db=require(_0xd3c5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd3c5('0x4'));var config=require('../../config/environment');var jayson=require(_0xd3c5('0x5'));var client=jayson['client'][_0xd3c5('0x6')]({'port':0x232a});config[_0xd3c5('0x7')]=_[_0xd3c5('0x8')](config[_0xd3c5('0x7')],{'host':_0xd3c5('0x9'),'port':0x18eb});var socket=require(_0xd3c5('0xa'))(new Redis(config[_0xd3c5('0x7')]));require(_0xd3c5('0xb'))[_0xd3c5('0xc')](socket);function respondWithRpcPromise(_0x35f53a,_0x4d4516,_0x5edefd){return new BPromise(function(_0x30f6da,_0x233e18){return client[_0xd3c5('0xd')](_0x35f53a,_0x5edefd)[_0xd3c5('0xe')](function(_0x550f23){logger['info'](_0xd3c5('0xf'),_0x4d4516,_0xd3c5('0x10'));logger[_0xd3c5('0x11')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4d4516,'request\x20sent',JSON['stringify'](_0x550f23));if(_0x550f23[_0xd3c5('0x12')]){if(_0x550f23[_0xd3c5('0x12')][_0xd3c5('0x13')]===0x1f4){logger[_0xd3c5('0x12')](_0xd3c5('0xf'),_0x4d4516,_0x550f23[_0xd3c5('0x12')][_0xd3c5('0x14')]);return _0x233e18(_0x550f23[_0xd3c5('0x12')][_0xd3c5('0x14')]);}logger[_0xd3c5('0x12')]('SmsAccount,\x20%s,\x20%s',_0x4d4516,_0x550f23['error'][_0xd3c5('0x14')]);return _0x30f6da(_0x550f23[_0xd3c5('0x12')][_0xd3c5('0x14')]);}else{logger[_0xd3c5('0x15')](_0xd3c5('0xf'),_0x4d4516,_0xd3c5('0x10'));_0x30f6da(_0x550f23[_0xd3c5('0x16')]['message']);}})['catch'](function(_0x277e9f){logger[_0xd3c5('0x12')]('SmsAccount,\x20%s,\x20%s',_0x4d4516,_0x277e9f);_0x233e18(_0x277e9f);});});}exports[_0xd3c5('0x17')]=function(_0x43b01f){var _0x37a2ce=this;return new Promise(function(_0x5ac1f2,_0xdfc075){return db[_0xd3c5('0x18')][_0xd3c5('0x19')]({'raw':_0x43b01f[_0xd3c5('0x1a')]?_0x43b01f[_0xd3c5('0x1a')][_0xd3c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x43b01f[_0xd3c5('0x1a')]?_0x43b01f[_0xd3c5('0x1a')]['where']||null:null,'attributes':_0x43b01f[_0xd3c5('0x1a')]?_0x43b01f[_0xd3c5('0x1a')]['attributes']||null:null,'include':_0x43b01f[_0xd3c5('0x1a')]?_0x43b01f[_0xd3c5('0x1a')]['include']?_[_0xd3c5('0x1c')](_0x43b01f[_0xd3c5('0x1a')]['include'],function(_0x2116ec){return{'model':db[_0x2116ec[_0xd3c5('0x1d')]],'as':_0x2116ec['as'],'attributes':_0x2116ec['attributes'],'include':_0x2116ec[_0xd3c5('0x1e')]?_[_0xd3c5('0x1c')](_0x2116ec[_0xd3c5('0x1e')],function(_0x44ebcd){return{'model':db[_0x44ebcd[_0xd3c5('0x1d')]],'as':_0x44ebcd['as'],'attributes':_0x44ebcd[_0xd3c5('0x1f')],'include':_0x44ebcd['include']?_['map'](_0x44ebcd[_0xd3c5('0x1e')],function(_0x3b2b3a){return{'model':db[_0x3b2b3a['model']],'as':_0x3b2b3a['as'],'attributes':_0x3b2b3a['attributes']};}):[]};}):[]};}):[]:[]})[_0xd3c5('0xe')](function(_0x4dbc02){logger[_0xd3c5('0x15')](_0xd3c5('0x17'),_0x43b01f);logger[_0xd3c5('0x11')](_0xd3c5('0x17'),_0x43b01f,JSON[_0xd3c5('0x20')](_0x4dbc02));_0x5ac1f2(_0x4dbc02);})[_0xd3c5('0x21')](function(_0x489703){logger[_0xd3c5('0x12')](_0xd3c5('0x17'),_0x489703[_0xd3c5('0x14')],_0x43b01f);_0xdfc075(_0x37a2ce['error'](0x1f4,_0x489703['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index d861e84..163e3be 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 148e0f8..a4105fa 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x587fee,_0x43f066){var _0x23a3d0=function(_0x2ae7aa){while(--_0x2ae7aa){_0x587fee['push'](_0x587fee['shift']());}};_0x23a3d0(++_0x43f066);}(_0x008c,0x188));var _0xc008=function(_0x24a4dd,_0xb58e96){_0x24a4dd=_0x24a4dd-0x0;var _0x5e75c4=_0x008c[_0x24a4dd];return _0x5e75c4;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x11e2f6,_0x19dca4){var _0x198671=function(_0xf76502){while(--_0xf76502){_0x11e2f6['push'](_0x11e2f6['shift']());}};_0x198671(++_0x19dca4);}(_0x008c,0x188));var _0xc008=function(_0x8ad45d,_0x2c14cd){_0x8ad45d=_0x8ad45d-0x0;var _0x1c31b0=_0x008c[_0x8ad45d];return _0x1c31b0;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index b39d8d3..17dadf2 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 _0xc20e=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x6b280,_0x291f02){var _0x20ecf2=function(_0x286a1a){while(--_0x286a1a){_0x6b280['push'](_0x6b280['shift']());}};_0x20ecf2(++_0x291f02);}(_0xc20e,0x156));var _0xec20=function(_0x5a1c25,_0xcf1bbc){_0x5a1c25=_0x5a1c25-0x0;var _0x597554=_0xc20e[_0x5a1c25];return _0x597554;};'use strict';var Sequelize=require(_0xec20('0x0'));module[_0xec20('0x1')]={'priority':{'type':Sequelize[_0xec20('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xec20('0x3')],'allowNull':![],'defaultValue':_0xec20('0x4')},'appdata':{'type':Sequelize[_0xec20('0x5')]()},'description':{'type':Sequelize[_0xec20('0x3')]},'interval':{'type':Sequelize[_0xec20('0x3')],'defaultValue':_0xec20('0x6')}}; \ No newline at end of file +var _0x743e=['TEXT','STRING','*,*,*,*','exports'];(function(_0x53a0ce,_0x5eaa86){var _0x491112=function(_0xb4b450){while(--_0xb4b450){_0x53a0ce['push'](_0x53a0ce['shift']());}};_0x491112(++_0x5eaa86);}(_0x743e,0x167));var _0xe743=function(_0x118f43,_0x3db25a){_0x118f43=_0x118f43-0x0;var _0x3109ea=_0x743e[_0x118f43];return _0x3109ea;};'use strict';var Sequelize=require('sequelize');module[_0xe743('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe743('0x1')]()},'description':{'type':Sequelize[_0xe743('0x2')]},'interval':{'type':Sequelize[_0xe743('0x2')],'defaultValue':_0xe743('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 1909c78..5c7f593 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 _0x429d=['Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','SmsApplication','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x429d,0x1cc));var _0xd429=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x429d[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd429('0x0'));var rp=require(_0xd429('0x1'));var moment=require(_0xd429('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd429('0x3'));var util=require(_0xd429('0x4'));var path=require(_0xd429('0x5'));var sox=require(_0xd429('0x6'));var csv=require(_0xd429('0x7'));var ejs=require(_0xd429('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd429('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd429('0xa'));var toCsv=require('to-csv');var querystring=require(_0xd429('0xb'));var Papa=require(_0xd429('0xc'));var Redis=require('ioredis');var authService=require(_0xd429('0xd'));var qs=require(_0xd429('0xe'));var as=require(_0xd429('0xf'));var hardwareService=require(_0xd429('0x10'));var logger=require('../../config/logger')(_0xd429('0x11'));var utils=require(_0xd429('0x12'));var config=require(_0xd429('0x13'));var licenseUtil=require(_0xd429('0x14'));var db=require(_0xd429('0x15'))['db'];function respondWithStatusCode(_0x188a80,_0x161c02){_0x161c02=_0x161c02||0xcc;return function(_0x88eaac){if(_0x88eaac){return _0x188a80[_0xd429('0x16')](_0x161c02);}return _0x188a80[_0xd429('0x17')](_0x161c02)[_0xd429('0x18')]();};}function respondWithResult(_0x4026fc,_0x23f447){_0x23f447=_0x23f447||0xc8;return function(_0x131c9e){if(_0x131c9e){return _0x4026fc[_0xd429('0x17')](_0x23f447)[_0xd429('0x19')](_0x131c9e);}};}function respondWithFilteredResult(_0x5bc9db,_0x23358f){return function(_0x1fdbe4){if(_0x1fdbe4){var _0x198017=typeof _0x23358f['offset']===_0xd429('0x1a')&&typeof _0x23358f[_0xd429('0x1b')]===_0xd429('0x1a');var _0x2ed698=_0x1fdbe4[_0xd429('0x1c')];var _0x379f29=_0x198017?0x0:_0x23358f['offset'];var _0xcaa90c=_0x198017?_0x1fdbe4[_0xd429('0x1c')]:_0x23358f[_0xd429('0x1d')]+_0x23358f[_0xd429('0x1b')];var _0x78559f;if(_0xcaa90c>=_0x2ed698){_0xcaa90c=_0x2ed698;_0x78559f=0xc8;}else{_0x78559f=0xce;}_0x5bc9db[_0xd429('0x17')](_0x78559f);return _0x5bc9db['set'](_0xd429('0x1e'),_0x379f29+'-'+_0xcaa90c+'/'+_0x2ed698)['json'](_0x1fdbe4);}return null;};}function patchUpdates(_0x23ffcf){return function(_0x1831de){try{jsonpatch[_0xd429('0x1f')](_0x1831de,_0x23ffcf,!![]);}catch(_0x452095){return BPromise[_0xd429('0x20')](_0x452095);}return _0x1831de[_0xd429('0x21')]();};}function saveUpdates(_0x532e7c,_0xeace91){return function(_0x36e4c5){if(_0x36e4c5){return _0x36e4c5[_0xd429('0x22')](_0x532e7c)['then'](function(_0x47e440){return _0x47e440;});}return null;};}function removeEntity(_0x65a8fa,_0x17b014){return function(_0x437934){if(_0x437934){return _0x437934[_0xd429('0x23')]()[_0xd429('0x24')](function(){_0x65a8fa[_0xd429('0x17')](0xcc)[_0xd429('0x18')]();});}};}function handleEntityNotFound(_0x5d5469,_0x17cb31){return function(_0x2ffd6b){if(!_0x2ffd6b){_0x5d5469[_0xd429('0x16')](0x194);}return _0x2ffd6b;};}function handleError(_0x5225c5,_0x21f02c){_0x21f02c=_0x21f02c||0x1f4;return function(_0x27cff2){logger['error'](_0x27cff2['stack']);if(_0x27cff2[_0xd429('0x25')]){delete _0x27cff2['name'];}_0x5225c5['status'](_0x21f02c)[_0xd429('0x26')](_0x27cff2);};}exports[_0xd429('0x27')]=function(_0x3161a3,_0x2a4250){var _0x488b6e={},_0x3072fc={},_0x26ad8c={'count':0x0,'rows':[]};var _0x24a3f6=_[_0xd429('0x28')](db[_0xd429('0x29')]['rawAttributes'],function(_0x1eeee6){return{'name':_0x1eeee6[_0xd429('0x2a')],'type':_0x1eeee6[_0xd429('0x2b')][_0xd429('0x2c')]};});_0x3072fc[_0xd429('0x2d')]=_[_0xd429('0x28')](_0x24a3f6,_0xd429('0x25'));_0x3072fc[_0xd429('0x2e')]=_[_0xd429('0x2f')](_0x3161a3[_0xd429('0x2e')]);_0x3072fc['filters']=_[_0xd429('0x30')](_0x3072fc[_0xd429('0x2d')],_0x3072fc[_0xd429('0x2e')]);_0x488b6e['attributes']=_[_0xd429('0x30')](_0x3072fc['model'],qs['fields'](_0x3161a3[_0xd429('0x2e')][_0xd429('0x31')]));_0x488b6e[_0xd429('0x32')]=_0x488b6e[_0xd429('0x32')]['length']?_0x488b6e[_0xd429('0x32')]:_0x3072fc[_0xd429('0x2d')];if(!_0x3161a3[_0xd429('0x2e')][_0xd429('0x33')]('nolimit')){_0x488b6e[_0xd429('0x1b')]=qs['limit'](_0x3161a3[_0xd429('0x2e')][_0xd429('0x1b')]);_0x488b6e['offset']=qs[_0xd429('0x1d')](_0x3161a3[_0xd429('0x2e')][_0xd429('0x1d')]);}_0x488b6e['order']=qs[_0xd429('0x34')](_0x3161a3['query']['sort']);_0x488b6e[_0xd429('0x35')]=qs[_0xd429('0x36')](_[_0xd429('0x37')](_0x3161a3['query'],_0x3072fc[_0xd429('0x36')]),_0x24a3f6);if(_0x3161a3[_0xd429('0x2e')][_0xd429('0x38')]){_0x488b6e['where']=_[_0xd429('0x39')](_0x488b6e[_0xd429('0x35')],{'$or':_[_0xd429('0x28')](_0x24a3f6,function(_0x5903b4){if(_0x5903b4[_0xd429('0x2b')]!==_0xd429('0x3a')){var _0x29d922={};_0x29d922[_0x5903b4['name']]={'$like':'%'+_0x3161a3[_0xd429('0x2e')][_0xd429('0x38')]+'%'};return _0x29d922;}})});}_0x488b6e=_[_0xd429('0x39')]({},_0x488b6e,_0x3161a3['options']);var _0x1af69e={'where':_0x488b6e[_0xd429('0x35')]};return db['SmsApplication'][_0xd429('0x1c')](_0x1af69e)[_0xd429('0x24')](function(_0x8ea23b){_0x26ad8c['count']=_0x8ea23b;if(_0x3161a3['query'][_0xd429('0x3b')]){_0x488b6e[_0xd429('0x3c')]=[{'all':!![]}];}return db[_0xd429('0x29')][_0xd429('0x3d')](_0x488b6e);})[_0xd429('0x24')](function(_0x12ddb9){_0x26ad8c['rows']=_0x12ddb9;return _0x26ad8c;})[_0xd429('0x24')](respondWithFilteredResult(_0x2a4250,_0x488b6e))[_0xd429('0x3e')](handleError(_0x2a4250,null));};exports[_0xd429('0x3f')]=function(_0x6d8e53,_0x3eb523){var _0x1cfe51={'raw':!![],'where':{'id':_0x6d8e53[_0xd429('0x40')]['id']}},_0x389a4b={};_0x389a4b[_0xd429('0x2d')]=_[_0xd429('0x2f')](db['SmsApplication'][_0xd429('0x41')]);_0x389a4b[_0xd429('0x2e')]=_[_0xd429('0x2f')](_0x6d8e53['query']);_0x389a4b['filters']=_[_0xd429('0x30')](_0x389a4b[_0xd429('0x2d')],_0x389a4b[_0xd429('0x2e')]);_0x1cfe51[_0xd429('0x32')]=_[_0xd429('0x30')](_0x389a4b[_0xd429('0x2d')],qs[_0xd429('0x31')](_0x6d8e53[_0xd429('0x2e')]['fields']));_0x1cfe51['attributes']=_0x1cfe51['attributes'][_0xd429('0x42')]?_0x1cfe51[_0xd429('0x32')]:_0x389a4b[_0xd429('0x2d')];if(_0x6d8e53['query'][_0xd429('0x3b')]){_0x1cfe51[_0xd429('0x3c')]=[{'all':!![]}];}_0x1cfe51=_[_0xd429('0x39')]({},_0x1cfe51,_0x6d8e53['options']);return db[_0xd429('0x29')][_0xd429('0x43')](_0x1cfe51)[_0xd429('0x24')](handleEntityNotFound(_0x3eb523,null))[_0xd429('0x24')](respondWithResult(_0x3eb523,null))['catch'](handleError(_0x3eb523,null));};exports['create']=function(_0x43fdee,_0x5e940d){return db[_0xd429('0x29')][_0xd429('0x44')](_0x43fdee['body'],{})[_0xd429('0x24')](respondWithResult(_0x5e940d,0xc9))[_0xd429('0x3e')](handleError(_0x5e940d,null));};exports[_0xd429('0x22')]=function(_0x2abb5e,_0x4f94df){if(_0x2abb5e[_0xd429('0x45')]['id']){delete _0x2abb5e[_0xd429('0x45')]['id'];}return db[_0xd429('0x29')][_0xd429('0x43')]({'where':{'id':_0x2abb5e[_0xd429('0x40')]['id']}})[_0xd429('0x24')](handleEntityNotFound(_0x4f94df,null))[_0xd429('0x24')](saveUpdates(_0x2abb5e['body'],null))[_0xd429('0x24')](respondWithResult(_0x4f94df,null))['catch'](handleError(_0x4f94df,null));};exports[_0xd429('0x23')]=function(_0x15df33,_0x37a478){return db[_0xd429('0x29')]['find']({'where':{'id':_0x15df33[_0xd429('0x40')]['id']}})['then'](handleEntityNotFound(_0x37a478,null))[_0xd429('0x24')](removeEntity(_0x37a478,null))[_0xd429('0x3e')](handleError(_0x37a478,null));}; \ No newline at end of file +var _0x844d=['eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','params','keys','options','find','create','body'];(function(_0x25b4a4,_0x2e081b){var _0x707267=function(_0x440123){while(--_0x440123){_0x25b4a4['push'](_0x25b4a4['shift']());}};_0x707267(++_0x2e081b);}(_0x844d,0xcf));var _0xd844=function(_0x3a8d5a,_0xe54840){_0x3a8d5a=_0x3a8d5a-0x0;var _0x308361=_0x844d[_0x3a8d5a];return _0x308361;};'use strict';var emlformat=require(_0xd844('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd844('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd844('0x2'));var moment=require(_0xd844('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd844('0x4'));var util=require('util');var path=require('path');var sox=require(_0xd844('0x5'));var csv=require(_0xd844('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd844('0x7'));var crypto=require('crypto');var jsforce=require(_0xd844('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xd844('0x6'));var querystring=require(_0xd844('0x9'));var Papa=require(_0xd844('0xa'));var Redis=require(_0xd844('0xb'));var authService=require(_0xd844('0xc'));var qs=require(_0xd844('0xd'));var as=require(_0xd844('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd844('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xd844('0x10'));var licenseUtil=require(_0xd844('0x11'));var db=require(_0xd844('0x12'))['db'];function respondWithStatusCode(_0xca77bb,_0x3df829){_0x3df829=_0x3df829||0xcc;return function(_0x2c854b){if(_0x2c854b){return _0xca77bb[_0xd844('0x13')](_0x3df829);}return _0xca77bb[_0xd844('0x14')](_0x3df829)[_0xd844('0x15')]();};}function respondWithResult(_0x4076aa,_0x2e81ce){_0x2e81ce=_0x2e81ce||0xc8;return function(_0x189301){if(_0x189301){return _0x4076aa[_0xd844('0x14')](_0x2e81ce)[_0xd844('0x16')](_0x189301);}};}function respondWithFilteredResult(_0xeb4d29,_0x1f60a7){return function(_0x393077){if(_0x393077){var _0x5e937a=typeof _0x1f60a7['offset']===_0xd844('0x17')&&typeof _0x1f60a7['limit']===_0xd844('0x17');var _0x15c1ca=_0x393077[_0xd844('0x18')];var _0x315dd9=_0x5e937a?0x0:_0x1f60a7[_0xd844('0x19')];var _0x37777d=_0x5e937a?_0x393077['count']:_0x1f60a7[_0xd844('0x19')]+_0x1f60a7[_0xd844('0x1a')];var _0x16fc42;if(_0x37777d>=_0x15c1ca){_0x37777d=_0x15c1ca;_0x16fc42=0xc8;}else{_0x16fc42=0xce;}_0xeb4d29[_0xd844('0x14')](_0x16fc42);return _0xeb4d29['set'](_0xd844('0x1b'),_0x315dd9+'-'+_0x37777d+'/'+_0x15c1ca)[_0xd844('0x16')](_0x393077);}return null;};}function patchUpdates(_0x43e448){return function(_0x5b6822){try{jsonpatch[_0xd844('0x1c')](_0x5b6822,_0x43e448,!![]);}catch(_0x51c580){return BPromise[_0xd844('0x1d')](_0x51c580);}return _0x5b6822[_0xd844('0x1e')]();};}function saveUpdates(_0x35d197,_0x90594b){return function(_0x48fa34){if(_0x48fa34){return _0x48fa34[_0xd844('0x1f')](_0x35d197)['then'](function(_0x4b5d92){return _0x4b5d92;});}return null;};}function removeEntity(_0x2c0bf9,_0x515507){return function(_0x28be1b){if(_0x28be1b){return _0x28be1b[_0xd844('0x20')]()[_0xd844('0x21')](function(){_0x2c0bf9[_0xd844('0x14')](0xcc)[_0xd844('0x15')]();});}};}function handleEntityNotFound(_0x462c05,_0x220510){return function(_0x4afff2){if(!_0x4afff2){_0x462c05['sendStatus'](0x194);}return _0x4afff2;};}function handleError(_0x559b2c,_0x385abd){_0x385abd=_0x385abd||0x1f4;return function(_0x4a90e8){logger[_0xd844('0x22')](_0x4a90e8[_0xd844('0x23')]);if(_0x4a90e8[_0xd844('0x24')]){delete _0x4a90e8[_0xd844('0x24')];}_0x559b2c[_0xd844('0x14')](_0x385abd)[_0xd844('0x25')](_0x4a90e8);};}exports['index']=function(_0x5daaf4,_0x4c5468){var _0xff5bb0={},_0x35d5a8={},_0x19ff8c={'count':0x0,'rows':[]};var _0x5aef56=_[_0xd844('0x26')](db[_0xd844('0x27')][_0xd844('0x28')],function(_0x5afae5){return{'name':_0x5afae5[_0xd844('0x29')],'type':_0x5afae5[_0xd844('0x2a')][_0xd844('0x2b')]};});_0x35d5a8[_0xd844('0x2c')]=_[_0xd844('0x26')](_0x5aef56,'name');_0x35d5a8['query']=_['keys'](_0x5daaf4[_0xd844('0x2d')]);_0x35d5a8[_0xd844('0x2e')]=_[_0xd844('0x2f')](_0x35d5a8[_0xd844('0x2c')],_0x35d5a8[_0xd844('0x2d')]);_0xff5bb0[_0xd844('0x30')]=_[_0xd844('0x2f')](_0x35d5a8[_0xd844('0x2c')],qs['fields'](_0x5daaf4[_0xd844('0x2d')][_0xd844('0x31')]));_0xff5bb0['attributes']=_0xff5bb0[_0xd844('0x30')]['length']?_0xff5bb0['attributes']:_0x35d5a8[_0xd844('0x2c')];if(!_0x5daaf4['query']['hasOwnProperty'](_0xd844('0x32'))){_0xff5bb0['limit']=qs[_0xd844('0x1a')](_0x5daaf4['query']['limit']);_0xff5bb0['offset']=qs['offset'](_0x5daaf4[_0xd844('0x2d')][_0xd844('0x19')]);}_0xff5bb0[_0xd844('0x33')]=qs[_0xd844('0x34')](_0x5daaf4[_0xd844('0x2d')][_0xd844('0x34')]);_0xff5bb0[_0xd844('0x35')]=qs[_0xd844('0x2e')](_[_0xd844('0x36')](_0x5daaf4[_0xd844('0x2d')],_0x35d5a8['filters']),_0x5aef56);if(_0x5daaf4[_0xd844('0x2d')]['filter']){_0xff5bb0[_0xd844('0x35')]=_['merge'](_0xff5bb0['where'],{'$or':_[_0xd844('0x26')](_0x5aef56,function(_0x9a70ec){if(_0x9a70ec[_0xd844('0x2a')]!==_0xd844('0x37')){var _0x25d70f={};_0x25d70f[_0x9a70ec['name']]={'$like':'%'+_0x5daaf4[_0xd844('0x2d')][_0xd844('0x38')]+'%'};return _0x25d70f;}})});}_0xff5bb0=_[_0xd844('0x39')]({},_0xff5bb0,_0x5daaf4['options']);var _0x4c6831={'where':_0xff5bb0[_0xd844('0x35')]};return db[_0xd844('0x27')]['count'](_0x4c6831)[_0xd844('0x21')](function(_0x1fdf58){_0x19ff8c[_0xd844('0x18')]=_0x1fdf58;if(_0x5daaf4['query'][_0xd844('0x3a')]){_0xff5bb0[_0xd844('0x3b')]=[{'all':!![]}];}return db[_0xd844('0x27')][_0xd844('0x3c')](_0xff5bb0);})['then'](function(_0x2573fa){_0x19ff8c['rows']=_0x2573fa;return _0x19ff8c;})[_0xd844('0x21')](respondWithFilteredResult(_0x4c5468,_0xff5bb0))[_0xd844('0x3d')](handleError(_0x4c5468,null));};exports[_0xd844('0x3e')]=function(_0x1bcfdd,_0x4c7e63){var _0x44d5d8={'raw':!![],'where':{'id':_0x1bcfdd[_0xd844('0x3f')]['id']}},_0x1b4ff3={};_0x1b4ff3[_0xd844('0x2c')]=_['keys'](db[_0xd844('0x27')]['rawAttributes']);_0x1b4ff3[_0xd844('0x2d')]=_[_0xd844('0x40')](_0x1bcfdd['query']);_0x1b4ff3['filters']=_[_0xd844('0x2f')](_0x1b4ff3[_0xd844('0x2c')],_0x1b4ff3[_0xd844('0x2d')]);_0x44d5d8[_0xd844('0x30')]=_[_0xd844('0x2f')](_0x1b4ff3[_0xd844('0x2c')],qs['fields'](_0x1bcfdd['query']['fields']));_0x44d5d8[_0xd844('0x30')]=_0x44d5d8[_0xd844('0x30')]['length']?_0x44d5d8[_0xd844('0x30')]:_0x1b4ff3[_0xd844('0x2c')];if(_0x1bcfdd[_0xd844('0x2d')][_0xd844('0x3a')]){_0x44d5d8[_0xd844('0x3b')]=[{'all':!![]}];}_0x44d5d8=_[_0xd844('0x39')]({},_0x44d5d8,_0x1bcfdd[_0xd844('0x41')]);return db[_0xd844('0x27')][_0xd844('0x42')](_0x44d5d8)['then'](handleEntityNotFound(_0x4c7e63,null))['then'](respondWithResult(_0x4c7e63,null))[_0xd844('0x3d')](handleError(_0x4c7e63,null));};exports[_0xd844('0x43')]=function(_0x521ec4,_0x25002f){return db['SmsApplication'][_0xd844('0x43')](_0x521ec4['body'],{})[_0xd844('0x21')](respondWithResult(_0x25002f,0xc9))[_0xd844('0x3d')](handleError(_0x25002f,null));};exports[_0xd844('0x1f')]=function(_0x3d3c35,_0x292e4b){if(_0x3d3c35[_0xd844('0x44')]['id']){delete _0x3d3c35[_0xd844('0x44')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x3d3c35[_0xd844('0x3f')]['id']}})[_0xd844('0x21')](handleEntityNotFound(_0x292e4b,null))['then'](saveUpdates(_0x3d3c35[_0xd844('0x44')],null))[_0xd844('0x21')](respondWithResult(_0x292e4b,null))[_0xd844('0x3d')](handleError(_0x292e4b,null));};exports['destroy']=function(_0x51fd92,_0x474a5d){return db[_0xd844('0x27')][_0xd844('0x42')]({'where':{'id':_0x51fd92[_0xd844('0x3f')]['id']}})[_0xd844('0x21')](handleEntityNotFound(_0x474a5d,null))[_0xd844('0x21')](removeEntity(_0x474a5d,null))[_0xd844('0x3d')](handleError(_0x474a5d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index aefb51d..16b7765 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 _0x4cce=['api','moment','bluebird','request-promise','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x2d3c60,_0x4df458){var _0x560041=function(_0x5568af){while(--_0x5568af){_0x2d3c60['push'](_0x2d3c60['shift']());}};_0x560041(++_0x4df458);}(_0x4cce,0x193));var _0xe4cc=function(_0x1f0f43,_0xf3efd){_0x1f0f43=_0x1f0f43-0x0;var _0x188d58=_0x4cce[_0x1f0f43];return _0x188d58;};'use strict';var _=require(_0xe4cc('0x0'));var util=require(_0xe4cc('0x1'));var logger=require(_0xe4cc('0x2'))(_0xe4cc('0x3'));var moment=require(_0xe4cc('0x4'));var BPromise=require(_0xe4cc('0x5'));var rp=require(_0xe4cc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe4cc('0x7'));var attributes=require(_0xe4cc('0x8'));module[_0xe4cc('0x9')]=function(_0x31f7c1,_0x49d890){return _0x31f7c1['define'](_0xe4cc('0xa'),attributes,{'tableName':_0xe4cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe4cc('0xc'),'collate':_0xe4cc('0xd')});}; \ No newline at end of file +var _0x330c=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0xe56865,_0x125547){var _0x3376ae=function(_0x50df30){while(--_0x50df30){_0xe56865['push'](_0xe56865['shift']());}};_0x3376ae(++_0x125547);}(_0x330c,0x186));var _0xc330=function(_0x1dd1a0,_0x374ed6){_0x1dd1a0=_0x1dd1a0-0x0;var _0x4f5b36=_0x330c[_0x1dd1a0];return _0x4f5b36;};'use strict';var _=require(_0xc330('0x0'));var util=require(_0xc330('0x1'));var logger=require(_0xc330('0x2'))(_0xc330('0x3'));var moment=require('moment');var BPromise=require(_0xc330('0x4'));var rp=require(_0xc330('0x5'));var fs=require('fs');var path=require(_0xc330('0x6'));var rimraf=require(_0xc330('0x7'));var config=require(_0xc330('0x8'));var attributes=require(_0xc330('0x9'));module['exports']=function(_0x4f49fb,_0x53d0ca){return _0x4f49fb[_0xc330('0xa')](_0xc330('0xb'),attributes,{'tableName':_0xc330('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc330('0xd'),'collate':_0xc330('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 3b9ce46..3970f08 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 _0x63a6=['../../config/environment','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1e01fb,_0xc83656){var _0x3bb8a6=function(_0x190e73){while(--_0x190e73){_0x1e01fb['push'](_0x1e01fb['shift']());}};_0x3bb8a6(++_0xc83656);}(_0x63a6,0x1c7));var _0x663a=function(_0x149cf0,_0x3746f2){_0x149cf0=_0x149cf0-0x0;var _0x2ee2c8=_0x63a6[_0x149cf0];return _0x2ee2c8;};'use strict';var _=require('lodash');var util=require(_0x663a('0x0'));var moment=require(_0x663a('0x1'));var BPromise=require('bluebird');var rs=require(_0x663a('0x2'));var fs=require('fs');var Redis=require(_0x663a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x663a('0x4'));var logger=require(_0x663a('0x5'))(_0x663a('0x6'));var config=require(_0x663a('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14b552,_0x20203b,_0x4b1314){return new BPromise(function(_0x4d4249,_0x326b53){return client[_0x663a('0x8')](_0x14b552,_0x4b1314)[_0x663a('0x9')](function(_0x4aa93a){logger['info'](_0x663a('0xa'),_0x20203b,_0x663a('0xb'));logger[_0x663a('0xc')](_0x663a('0xd'),_0x20203b,_0x663a('0xb'),JSON[_0x663a('0xe')](_0x4aa93a));if(_0x4aa93a['error']){if(_0x4aa93a[_0x663a('0xf')][_0x663a('0x10')]===0x1f4){logger[_0x663a('0xf')]('SmsApplication,\x20%s,\x20%s',_0x20203b,_0x4aa93a['error'][_0x663a('0x11')]);return _0x326b53(_0x4aa93a['error']['message']);}logger[_0x663a('0xf')](_0x663a('0xa'),_0x20203b,_0x4aa93a['error'][_0x663a('0x11')]);return _0x4d4249(_0x4aa93a['error'][_0x663a('0x11')]);}else{logger[_0x663a('0x12')](_0x663a('0xa'),_0x20203b,_0x663a('0xb'));_0x4d4249(_0x4aa93a[_0x663a('0x13')]['message']);}})[_0x663a('0x14')](function(_0x5cc6ab){logger[_0x663a('0xf')](_0x663a('0xa'),_0x20203b,_0x5cc6ab);_0x326b53(_0x5cc6ab);});});} \ No newline at end of file +var _0xf811=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x48ace8,_0x531c3d){var _0x44f313=function(_0x43d6ed){while(--_0x43d6ed){_0x48ace8['push'](_0x48ace8['shift']());}};_0x44f313(++_0x531c3d);}(_0xf811,0x6f));var _0x1f81=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xf811[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x1f81('0x0'));var util=require(_0x1f81('0x1'));var moment=require(_0x1f81('0x2'));var BPromise=require(_0x1f81('0x3'));var rs=require(_0x1f81('0x4'));var fs=require('fs');var Redis=require(_0x1f81('0x5'));var db=require(_0x1f81('0x6'))['db'];var utils=require(_0x1f81('0x7'));var logger=require(_0x1f81('0x8'))(_0x1f81('0x9'));var config=require(_0x1f81('0xa'));var jayson=require(_0x1f81('0xb'));var client=jayson[_0x1f81('0xc')][_0x1f81('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x57c512,_0x2238b2,_0x42b31b){return new BPromise(function(_0x3635bf,_0x5e6256){return client[_0x1f81('0xe')](_0x57c512,_0x42b31b)[_0x1f81('0xf')](function(_0x4af394){logger[_0x1f81('0x10')]('SmsApplication,\x20%s,\x20%s',_0x2238b2,_0x1f81('0x11'));logger[_0x1f81('0x12')](_0x1f81('0x13'),_0x2238b2,_0x1f81('0x11'),JSON[_0x1f81('0x14')](_0x4af394));if(_0x4af394[_0x1f81('0x15')]){if(_0x4af394[_0x1f81('0x15')][_0x1f81('0x16')]===0x1f4){logger[_0x1f81('0x15')](_0x1f81('0x17'),_0x2238b2,_0x4af394[_0x1f81('0x15')][_0x1f81('0x18')]);return _0x5e6256(_0x4af394[_0x1f81('0x15')][_0x1f81('0x18')]);}logger[_0x1f81('0x15')](_0x1f81('0x17'),_0x2238b2,_0x4af394['error'][_0x1f81('0x18')]);return _0x3635bf(_0x4af394[_0x1f81('0x15')]['message']);}else{logger['info'](_0x1f81('0x17'),_0x2238b2,_0x1f81('0x11'));_0x3635bf(_0x4af394['result'][_0x1f81('0x18')]);}})[_0x1f81('0x19')](function(_0x37434a){logger[_0x1f81('0x15')]('SmsApplication,\x20%s,\x20%s',_0x2238b2,_0x37434a);_0x5e6256(_0x37434a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 59dfe65..f837775 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7708=['removeTags','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','delete'];(function(_0x2fbd2b,_0x17c378){var _0x1fa4d0=function(_0x27552c){while(--_0x27552c){_0x2fbd2b['push'](_0x2fbd2b['shift']());}};_0x1fa4d0(++_0x17c378);}(_0x7708,0x188));var _0x8770=function(_0x285c85,_0x132c21){_0x285c85=_0x285c85-0x0;var _0x2f81cd=_0x7708[_0x285c85];return _0x2f81cd;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./smsInteraction.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['download']);router[_0x8770('0xf')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x10')]);router['post'](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0xf')](_0x8770('0x12'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:addtags'),controller[_0x8770('0x15')]);router[_0x8770('0x16')]('/:id',auth[_0x8770('0x8')](),interaction['tracked'](_0x8770('0x14'),'smsinteraction:update'),controller['update']);router['delete'](_0x8770('0xa'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:destroy'),controller['destroy']);router[_0x8770('0x17')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x18')]);module[_0x8770('0x19')]=router; \ No newline at end of file +var _0x2032=['./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','/:id/tags','sms','smsinteraction:addtags','addTags','put','/:id','tracked','smsinteraction:update','update','smsinteraction:destroy','delete','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x2032,0xd9));var _0x2203=function(_0x4f9cd6,_0x50d041){_0x4f9cd6=_0x4f9cd6-0x0;var _0x25f67a=_0x2032[_0x4f9cd6];return _0x25f67a;};'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('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x2203('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction[_0x2203('0x19')](_0x2203('0x14'),_0x2203('0x1a')),controller[_0x2203('0x1b')]);router['delete'](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x1c')),controller['destroy']);router[_0x2203('0x1d')]('/:id/tags',auth[_0x2203('0x9')](),controller[_0x2203('0x1e')]);module[_0x2203('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index ddd0e07..981dae6 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 _0x13f5=['DATE','ENUM','out','sequelize','moment','exports','BOOLEAN','STRING'];(function(_0x528d4f,_0x19b4f9){var _0x3df605=function(_0x18ed9d){while(--_0x18ed9d){_0x528d4f['push'](_0x528d4f['shift']());}};_0x3df605(++_0x19b4f9);}(_0x13f5,0xc3));var _0x513f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13f5[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x513f('0x0'));var moment=require(_0x513f('0x1'));module[_0x513f('0x2')]={'closed':{'type':Sequelize[_0x513f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x513f('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x513f('0x4')]},'phone':{'type':Sequelize[_0x513f('0x4')]},'read1stAt':{'type':Sequelize[_0x513f('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x513f('0x6')]('in',_0x513f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x513f('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x513f('0x6')]('in',_0x513f('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x513f('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe0ae=['BOOLEAN','STRING','DATE','ENUM','out','exports'];(function(_0xca06e,_0x25a203){var _0x32bb7e=function(_0x9362f6){while(--_0x9362f6){_0xca06e['push'](_0xca06e['shift']());}};_0x32bb7e(++_0x25a203);}(_0xe0ae,0xa1));var _0xee0a=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0xe0ae[_0x31b5a5];return _0x364cc9;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xee0a('0x0')]={'closed':{'type':Sequelize[_0xee0a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xee0a('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xee0a('0x2')]},'note':{'type':Sequelize[_0xee0a('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xee0a('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xee0a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xee0a('0x4')]('in',_0xee0a('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xee0a('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index e22a69d..896c20f 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 _0xb238=['status','end','offset','limit','undefined','count','Content-Range','json','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','SmsInteraction','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','start','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','keys','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','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?','group','Sequelize','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','agent','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','catch','show','params','includeAll','create','body','describe','addMessage','SmsMessage','ids','findOne','rawAttributes','SmsInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','omit','spread','Tag','emit','smsInteractionTags:save','removeTags','unix','join','root','server','tmp','files','format','CmContact','Messages','secret','Owner','get','Sms','Account','N.A.','createdAt','closed','closedAt','disposition','direction','out','System','firstName','lastName','renderFile','views','createPdfFromHTML','download','log','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus'];(function(_0x238773,_0x38aa6f){var _0x5d7cc8=function(_0x568e27){while(--_0x568e27){_0x238773['push'](_0x238773['shift']());}};_0x5d7cc8(++_0x38aa6f);}(_0xb238,0x1af));var _0x8b23=function(_0x49293c,_0x504fc4){_0x49293c=_0x49293c-0x0;var _0x3c42b8=_0xb238[_0x49293c];return _0x3c42b8;};'use strict';var emlformat=require(_0x8b23('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b23('0x1'));var jsonpatch=require(_0x8b23('0x2'));var rp=require('request-promise');var moment=require(_0x8b23('0x3'));var BPromise=require(_0x8b23('0x4'));var Mustache=require(_0x8b23('0x5'));var util=require(_0x8b23('0x6'));var path=require(_0x8b23('0x7'));var sox=require(_0x8b23('0x8'));var csv=require(_0x8b23('0x9'));var ejs=require(_0x8b23('0xa'));var fs=require('fs');var fs_extra=require(_0x8b23('0xb'));var _=require(_0x8b23('0xc'));var squel=require('squel');var crypto=require(_0x8b23('0xd'));var jsforce=require(_0x8b23('0xe'));var deskjs=require(_0x8b23('0xf'));var toCsv=require(_0x8b23('0x9'));var querystring=require('querystring');var Papa=require(_0x8b23('0x10'));var Redis=require(_0x8b23('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8b23('0x12'));var pdf=require(_0x8b23('0x13'));var hardwareService=require(_0x8b23('0x14'));var logger=require(_0x8b23('0x15'))(_0x8b23('0x16'));var utils=require(_0x8b23('0x17'));var config=require(_0x8b23('0x18'));var licenseUtil=require(_0x8b23('0x19'));var db=require('../../mysqldb')['db'];config[_0x8b23('0x1a')]=_[_0x8b23('0x1b')](config['redis'],{'host':_0x8b23('0x1c'),'port':0x18eb});var socket=require(_0x8b23('0x1d'))(new Redis(config[_0x8b23('0x1a')]));require(_0x8b23('0x1e'))[_0x8b23('0x1f')](socket);function respondWithStatusCode(_0xa20726,_0x244614){_0x244614=_0x244614||0xcc;return function(_0x387d8e){if(_0x387d8e){return _0xa20726[_0x8b23('0x20')](_0x244614);}return _0xa20726[_0x8b23('0x21')](_0x244614)[_0x8b23('0x22')]();};}function respondWithResult(_0x4834bb,_0x51e5a4){_0x51e5a4=_0x51e5a4||0xc8;return function(_0x3d9cf2){if(_0x3d9cf2){return _0x4834bb['status'](_0x51e5a4)['json'](_0x3d9cf2);}};}function respondWithFilteredResult(_0xb4fa5c,_0xcd5a71){return function(_0x7d01ee){if(_0x7d01ee){var _0x4f78f7=typeof _0xcd5a71[_0x8b23('0x23')]==='undefined'&&typeof _0xcd5a71[_0x8b23('0x24')]===_0x8b23('0x25');var _0x86f4b1=_0x7d01ee[_0x8b23('0x26')];var _0x3ecb11=_0x4f78f7?0x0:_0xcd5a71[_0x8b23('0x23')];var _0x31037c=_0x4f78f7?_0x7d01ee[_0x8b23('0x26')]:_0xcd5a71[_0x8b23('0x23')]+_0xcd5a71[_0x8b23('0x24')];var _0x10b16e;if(_0x31037c>=_0x86f4b1){_0x31037c=_0x86f4b1;_0x10b16e=0xc8;}else{_0x10b16e=0xce;}_0xb4fa5c[_0x8b23('0x21')](_0x10b16e);return _0xb4fa5c['set'](_0x8b23('0x27'),_0x3ecb11+'-'+_0x31037c+'/'+_0x86f4b1)[_0x8b23('0x28')](_0x7d01ee);}return null;};}function patchUpdates(_0x5e8bb5){return function(_0x1a2db3){try{jsonpatch['apply'](_0x1a2db3,_0x5e8bb5,!![]);}catch(_0x5e02f7){return BPromise['reject'](_0x5e02f7);}return _0x1a2db3[_0x8b23('0x29')]();};}function saveUpdates(_0x53f65f,_0x249b0d){return function(_0x5a94fa){if(_0x5a94fa){return _0x5a94fa[_0x8b23('0x2a')](_0x53f65f)[_0x8b23('0x2b')](function(_0xd4ea14){return _0xd4ea14;});}return null;};}function removeEntity(_0x55d614,_0x11d769){return function(_0x2bf153){if(_0x2bf153){return _0x2bf153[_0x8b23('0x2c')]()[_0x8b23('0x2b')](function(){_0x55d614[_0x8b23('0x21')](0xcc)[_0x8b23('0x22')]();});}};}function handleEntityNotFound(_0xb1f672,_0x4bb62c){return function(_0x293fc4){if(!_0x293fc4){_0xb1f672['sendStatus'](0x194);}return _0x293fc4;};}function handleError(_0x235a27,_0x3a54fa){_0x3a54fa=_0x3a54fa||0x1f4;return function(_0x4571d1){logger[_0x8b23('0x2d')](_0x4571d1[_0x8b23('0x2e')]);if(_0x4571d1[_0x8b23('0x2f')]){delete _0x4571d1[_0x8b23('0x2f')];}_0x235a27[_0x8b23('0x21')](_0x3a54fa)[_0x8b23('0x30')](_0x4571d1);};}function getInteractionUsers(_0x17859e,_0x114bf0){return new BPromise(function(_0x5a8fdf,_0x364df1){try{if(_0x114bf0[_0x17859e['id']]){_0x17859e['Users']=_[_0x8b23('0x31')](_0x114bf0[_0x17859e['id']],function(_0xfdbdb1){return{'id':_0xfdbdb1['id'],'fullname':_0xfdbdb1[_0x8b23('0x32')]};});}}catch(_0x35b8e7){_0x364df1(_0x35b8e7);}_0x5a8fdf(_0x17859e);});}function getInteractionTags(_0x5714d2,_0x12ecf5){return new BPromise(function(_0x2f3096,_0x165949){try{if(_0x5714d2[_0x8b23('0x33')]){_0x5714d2[_0x8b23('0x34')]=[];_0x5714d2[_0x8b23('0x33')][_0x8b23('0x35')](',')[_0x8b23('0x36')](function(_0x45c882){_0x5714d2[_0x8b23('0x34')][_0x8b23('0x37')](_0x12ecf5[_0x45c882]);});}delete _0x5714d2[_0x8b23('0x33')];}catch(_0x5c2973){_0x165949(_0x5c2973);}_0x2f3096(_0x5714d2);});}function updateSmsInteraction(_0x11b7da,_0x1c8058,_0x184b77){return new BPromise(function(_0xc1ef7e,_0x2783db){return getInteractionUsers(_0x11b7da,_0x184b77)[_0x8b23('0x2b')](function(_0x43912f){return getInteractionTags(_0x43912f,_0x1c8058);})[_0x8b23('0x2b')](function(_0x104a7a){_0xc1ef7e(_0x104a7a);})['catch'](function(_0x201acd){_0x2783db(_0x201acd);});});}exports['index']=function(_0x3ea6bf,_0xf4d69e){var _0x5429ea={},_0x3f8273={},_0x43c712={'count':0x0,'rows':[]};var _0x351101=_['map'](db[_0x8b23('0x38')]['rawAttributes'],function(_0x51874f){return{'name':_0x51874f['fieldName'],'type':_0x51874f[_0x8b23('0x39')][_0x8b23('0x3a')]};});_0x3f8273[_0x8b23('0x3b')]=_['map'](_0x351101,_0x8b23('0x2f'));_0x3f8273[_0x8b23('0x3c')]=_['keys'](_0x3ea6bf[_0x8b23('0x3c')]);_0x3f8273[_0x8b23('0x3d')]=_['intersection'](_0x3f8273[_0x8b23('0x3b')],_0x3f8273[_0x8b23('0x3c')]);_0x5429ea['attributes']=_[_0x8b23('0x3e')](_0x3f8273[_0x8b23('0x3b')],qs[_0x8b23('0x3f')](_0x3ea6bf[_0x8b23('0x3c')][_0x8b23('0x3f')]));_0x5429ea['attributes']=_0x5429ea[_0x8b23('0x40')]['length']?_0x5429ea[_0x8b23('0x40')]:_0x3f8273[_0x8b23('0x3b')];if(!_0x3ea6bf[_0x8b23('0x3c')][_0x8b23('0x41')](_0x8b23('0x42'))){_0x5429ea[_0x8b23('0x24')]=qs['limit'](_0x3ea6bf[_0x8b23('0x3c')][_0x8b23('0x24')]);_0x5429ea['offset']=qs[_0x8b23('0x23')](_0x3ea6bf[_0x8b23('0x3c')]['offset']);}_0x5429ea[_0x8b23('0x43')]=qs[_0x8b23('0x44')](_0x3ea6bf[_0x8b23('0x3c')][_0x8b23('0x44')]);_0x5429ea[_0x8b23('0x45')]=qs['filters'](_[_0x8b23('0x46')](_0x3ea6bf[_0x8b23('0x3c')],_0x3f8273[_0x8b23('0x3d')]),_0x351101);var _0x26270e=[];var _0x1450a1=squel[_0x8b23('0x47')]()['field']('id')['field']('name')[_0x8b23('0x48')](_0x8b23('0x49'))[_0x8b23('0x4a')](_0x8b23('0x4b'));var _0x2ca549=squel['select']()['field'](_0x8b23('0x4c'))[_0x8b23('0x48')](_0x8b23('0x4d'))[_0x8b23('0x48')](_0x8b23('0x4e'))['from'](_0x8b23('0x4f'),'ui')['left_join'](_0x8b23('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x4ed249=squel[_0x8b23('0x47')]()['from']('sms_interactions','i')[_0x8b23('0x51')](_0x8b23('0x52'),'c',_0x8b23('0x53'))[_0x8b23('0x51')](_0x8b23('0x50'),'o',_0x8b23('0x54'))['left_join'](_0x8b23('0x55'),'a','a.id\x20=\x20i.SmsAccountId')[_0x8b23('0x51')](_0x8b23('0x56'),'me',_0x8b23('0x57'))['left_join']('sms_interaction_has_tags','it',_0x8b23('0x58'))['left_join'](_0x8b23('0x4b'),'t',_0x8b23('0x59'));var _0x48a6de=squel[_0x8b23('0x5a')]();var _0x22effc=[];var _0x20ba4c=squel[_0x8b23('0x5a')]();var _0x185a1e;if(_0x3ea6bf['query'][_0x8b23('0x5b')]){_0x185a1e=as[_0x8b23('0x5c')](_0x3ea6bf[_0x8b23('0x3c')][_0x8b23('0x5b')]);var _0x3e84b4=_0x185a1e[_0x8b23('0x5d')];for(var _0x3f0c85=0x0;_0x3f0c85<_0x185a1e[_0x8b23('0x5e')][_0x8b23('0x5f')];_0x3f0c85++){var _0x29e2b3=_0x185a1e[_0x8b23('0x5e')][_0x3f0c85];var _0x3ce069='i';var _0x5e3e3a=_[_0x8b23('0x60')](_0x351101,[_0x8b23('0x2f'),_0x29e2b3['field']]);if(!_0x5e3e3a){switch(_0x29e2b3[_0x8b23('0x48')]){case _0x8b23('0x61'):if(_0x29e2b3['value']==0x1){_0x4ed249[_0x8b23('0x62')]('`'+_0x29e2b3['field']+_0x8b23('0x63'));}else{_0x4ed249[_0x8b23('0x62')]('`'+_0x29e2b3['field']+'`\x20>\x200');}break;case _0x8b23('0x64'):if(_0x29e2b3[_0x8b23('0x65')]===_0x8b23('0x66')){if(_0x29e2b3[_0x8b23('0x67')][_0x8b23('0x35')]('\x20')[_0x8b23('0x5f')]>0x1){_0x48a6de[_0x3e84b4](_0x8b23('0x68'),qs[_0x8b23('0x69')](_0x29e2b3[_0x8b23('0x67')]),null);}else{var _0x307409='%'+_0x29e2b3['value']+'%';_0x48a6de[_0x3e84b4]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x307409,_0x307409,_0x307409);}}else{_0x5e3e3a=_[_0x8b23('0x60')](_0x351101,['name','ContactId']);_0x29e2b3['field']=_0x8b23('0x6a');_0x1f1468=as[_0x8b23('0x6b')](_0x3ce069,_0x5e3e3a[_0x8b23('0x39')],_0x29e2b3);_0x48a6de[_0x3e84b4](_0x1f1468['text'],_0x1f1468[_0x8b23('0x67')][_0x8b23('0x6c')],_0x1f1468[_0x8b23('0x67')][_0x8b23('0x22')]);}break;case'Tag':var _0x343f95=_0x29e2b3[_0x8b23('0x67')][_0x8b23('0x35')](',')[_0x8b23('0x31')](function(_0x5532c2){return Number(_0x5532c2);});_0x343f95[_0x8b23('0x36')](function(_0x4fef9f){_0x20ba4c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4fef9f+',%');});_0x22effc=_[_0x8b23('0x6d')](_0x22effc,_0x343f95);break;case _0x8b23('0x6e'):if(_0x29e2b3[_0x8b23('0x65')]===_0x8b23('0x66')){_0x48a6de[_0x3e84b4](_0x8b23('0x6f'),'%'+_0x29e2b3[_0x8b23('0x67')]+'%',null);}else{_0x5e3e3a=_['find'](_0x351101,[_0x8b23('0x2f'),'UserId']);_0x29e2b3[_0x8b23('0x48')]=_0x8b23('0x70');_0x1f1468=as[_0x8b23('0x6b')](_0x3ce069,_0x5e3e3a[_0x8b23('0x39')],_0x29e2b3);_0x48a6de[_0x3e84b4](_0x1f1468['text'],_0x1f1468['value']['start'],_0x1f1468[_0x8b23('0x67')][_0x8b23('0x22')]);}break;case'body':_0x1f1468=as[_0x8b23('0x6b')]('me',null,_0x29e2b3);_0x48a6de[_0x3e84b4](_0x1f1468['text'],_0x1f1468[_0x8b23('0x67')][_0x8b23('0x6c')],_0x1f1468[_0x8b23('0x67')][_0x8b23('0x22')]);break;}}else{var _0x1f1468=as[_0x8b23('0x6b')](_0x3ce069,_0x5e3e3a[_0x8b23('0x39')],_0x29e2b3);_0x48a6de[_0x3e84b4](_0x1f1468[_0x8b23('0x71')],_0x1f1468[_0x8b23('0x67')][_0x8b23('0x6c')],_0x1f1468['value']['end']);}}}else{var _0x54a436=_(_0x3ea6bf['query'])[_0x8b23('0x72')]()['map'](function(_0x58254a){return _[_0x8b23('0x73')](_0x351101,[_0x8b23('0x2f'),_0x58254a])?_0x58254a:undefined;})[_0x8b23('0x74')]()[_0x8b23('0x67')]();if(!_[_0x8b23('0x75')](_0x54a436)){_0x54a436[_0x8b23('0x36')](function(_0x5cecf7){if(_0x5cecf7===_0x8b23('0x76')){_0x4ed249[_0x8b23('0x45')](_0x8b23('0x77'),[][_0x8b23('0x78')](_0x3ea6bf[_0x8b23('0x3c')][_0x5cecf7]));}else if(_0x5cecf7==='createdAt'){var _0xe0fe38=JSON[_0x8b23('0x79')](_0x3ea6bf[_0x8b23('0x3c')][_0x5cecf7])[_0x8b23('0x7a')];var _0x452ec9=JSON[_0x8b23('0x79')](_0x3ea6bf['query'][_0x5cecf7])[_0x8b23('0x7b')];_0x4ed249[_0x8b23('0x45')](_0x8b23('0x7c'),_0xe0fe38,_0x452ec9);}else{if(_0x3ea6bf[_0x8b23('0x3c')][_0x5cecf7]==='null'){_0x4ed249[_0x8b23('0x45')]('i.'+_0x5cecf7+_0x8b23('0x7d'));}else{_0x4ed249[_0x8b23('0x45')]('i.'+_0x5cecf7+_0x8b23('0x7e'),_0x3ea6bf[_0x8b23('0x3c')][_0x5cecf7]);}}});}if(_0x3ea6bf[_0x8b23('0x3c')][_0x8b23('0x7f')]){if(_0x3ea6bf[_0x8b23('0x3c')][_0x8b23('0x7f')]==0x1){_0x4ed249[_0x8b23('0x62')](_0x8b23('0x80'));}else{_0x4ed249[_0x8b23('0x62')](_0x8b23('0x81'));}}if(_0x3ea6bf[_0x8b23('0x3c')][_0x8b23('0x82')]){_0x22effc=_[_0x8b23('0x83')](_0x3ea6bf[_0x8b23('0x3c')][_0x8b23('0x82')])?_0x3ea6bf[_0x8b23('0x3c')]['tag']:new Array(_0x3ea6bf['query'][_0x8b23('0x82')]);_0x22effc['forEach'](function(_0x4202f6){_0x20ba4c['or'](_0x8b23('0x84'),'%,'+_0x4202f6+',%');});}if(_0x3ea6bf['query'][_0x8b23('0x85')]){var _0x52000a=_0x3ea6bf[_0x8b23('0x3c')]['filter']['replace']('\x5c','\x5c\x5c')[_0x8b23('0x86')](/'/g,'\x27\x27');if(qs[_0x8b23('0x87')](_0x52000a)){_0x48a6de['or'](_0x8b23('0x88'),_0x52000a+'%')['or'](_0x8b23('0x89'),_0x52000a+'%');}else{_0x48a6de['or'](_0x8b23('0x8a'),qs['getFullTextValue'](_0x52000a))['or'](_0x8b23('0x8b'),_0x52000a+'%');}}}_0x4ed249[_0x8b23('0x45')](_0x48a6de);_0x4ed249[_0x8b23('0x8c')]('i.id');var _0x4a3142={'type':db[_0x8b23('0x8d')]['QueryTypes'][_0x8b23('0x8e')],'raw':!![]};var _0x4b301b=_0x4ed249[_0x8b23('0x8f')]();_0x4b301b['field'](_0x8b23('0x90'));_0x4b301b[_0x8b23('0x48')](_0x8b23('0x91'),_0x8b23('0x61'));if(_0x5429ea[_0x8b23('0x43')]){_0x5429ea[_0x8b23('0x43')][_0x8b23('0x36')](function(_0x3c8d5e){var _0x14b1f7=_0x3c8d5e[0x0]==='contactName'?_0x3c8d5e[0x0]:'i.'+_0x3c8d5e[0x0];_0x4ed249[_0x8b23('0x43')](_0x14b1f7,_0x3c8d5e[0x1]===_0x8b23('0x92')?![]:!![]);});}if(!_['isEmpty'](_0x22effc)){_0x4ed249[_0x8b23('0x62')](_0x20ba4c);_0x4b301b[_0x8b23('0x45')](_0x8b23('0x93'),_0x22effc);}BPromise[_0x8b23('0x94')]()['then'](function(){if(!_0x185a1e){if(_0x3ea6bf[_0x8b23('0x3c')][_0x8b23('0x76')])return;_0x4b301b[_0x8b23('0x45')](_0x8b23('0x95'));_0x4ed249[_0x8b23('0x45')](_0x8b23('0x95'));return;}if(_0x3ea6bf[_0x8b23('0x96')]['role']!=='agent')return;return _0x3ea6bf[_0x8b23('0x96')][_0x8b23('0x97')]({'attributes':['id'],'raw':!![]})[_0x8b23('0x2b')](function(_0x15eb26){if(_[_0x8b23('0x75')](_0x15eb26)){_0x4b301b[_0x8b23('0x45')](_0x8b23('0x98'));_0x4ed249[_0x8b23('0x45')](_0x8b23('0x98'));}else{_0x4b301b[_0x8b23('0x45')]('i.SmsAccountId\x20IN\x20?',_[_0x8b23('0x31')](_0x15eb26,'id'));_0x4ed249[_0x8b23('0x45')](_0x8b23('0x77'),_[_0x8b23('0x31')](_0x15eb26,'id'));}});})[_0x8b23('0x2b')](function(){if(_0x3ea6bf[_0x8b23('0x96')][_0x8b23('0x99')]===_0x8b23('0x9a')&&!_0x185a1e&&!_0x3ea6bf['query'][_0x8b23('0x76')])return[];return db[_0x8b23('0x9b')]['query'](_0x4b301b[_0x8b23('0x9c')](),_0x4a3142);})[_0x8b23('0x2b')](function(_0x4031d9){_0x43c712['count']=_0x4031d9[_0x8b23('0x5f')];if(_0x43c712[_0x8b23('0x26')]===0x0)return[];return db[_0x8b23('0x9b')][_0x8b23('0x3c')](_0x1450a1[_0x8b23('0x9c')](),_0x4a3142)['then'](function(_0x2cba36){_0x26270e=_[_0x8b23('0x9d')](_0x2cba36,'id');_0x4a3142=_[_0x8b23('0x9e')](_0x4a3142,{'model':db[_0x8b23('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ea6bf['query']['fields']){_0x5429ea['attributes'][_0x8b23('0x36')](function(_0x89f7cf){_0x4ed249['field']('i.'+_0x89f7cf);});}else{_0x4ed249['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8b23('0x61'));_0x4ed249[_0x8b23('0x48')](_0x8b23('0x9f'),_0x8b23('0xa0'));_0x4ed249[_0x8b23('0x48')](_0x8b23('0xa1'),_0x8b23('0xa2'));_0x4ed249['field'](_0x8b23('0xa3'),_0x8b23('0xa4'));_0x4ed249[_0x8b23('0x48')](_0x8b23('0xa5'));_0x4ed249['field'](_0x8b23('0xa6'),_0x8b23('0xa7'));_0x4ed249[_0x8b23('0x48')]('c.lastName',_0x8b23('0xa8'));_0x4ed249['field'](_0x8b23('0xa9'),'Contact.email');_0x4ed249[_0x8b23('0x48')](_0x8b23('0xaa'),_0x8b23('0xab'));_0x4ed249[_0x8b23('0x48')](_0x8b23('0xac'),_0x8b23('0xad'));_0x4ed249['field'](_0x8b23('0xae'),'Contact.fax');_0x4ed249['field'](_0x8b23('0xaf'),_0x8b23('0xb0'));_0x4ed249[_0x8b23('0x48')](_0x8b23('0xb1'),_0x8b23('0xb2'));_0x4ed249[_0x8b23('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8b23('0x33'));}if(_0x5429ea[_0x8b23('0x24')])_0x4ed249['limit'](_0x5429ea[_0x8b23('0x24')]);if(_0x5429ea[_0x8b23('0x23')])_0x4ed249[_0x8b23('0x23')](_0x5429ea[_0x8b23('0x23')]);return db['sequelize']['query'](_0x4ed249[_0x8b23('0x9c')](),_0x4a3142);})['then'](function(_0x3549a0){if(_0x3549a0[_0x8b23('0x5f')]>0x0)_0x2ca549[_0x8b23('0x45')](_0x8b23('0xb3'),_[_0x8b23('0x31')](_0x3549a0,'id'));return db[_0x8b23('0x9b')]['query'](_0x2ca549['toString'](),_0x4a3142)[_0x8b23('0x2b')](function(_0x2da872){var _0xf62a35=_[_0x8b23('0xb4')](_0x2da872,'SmsInteractionId');var _0x27d497=[];_0x3549a0[_0x8b23('0x36')](function(_0x367bb2){_0x27d497[_0x8b23('0x37')](updateSmsInteraction(_0x367bb2,_0x26270e,_0xf62a35));});return BPromise['all'](_0x27d497);});});})[_0x8b23('0x2b')](function(_0x51ea98){_0x43c712['rows']=_0x51ea98;return _0x43c712;})['then'](respondWithFilteredResult(_0xf4d69e,_0x5429ea))[_0x8b23('0xb5')](handleError(_0xf4d69e,null));};exports[_0x8b23('0xb6')]=function(_0xfa263,_0x596afc){var _0x191272={'raw':![],'where':{'id':_0xfa263[_0x8b23('0xb7')]['id']}},_0x5ae77f={};_0x5ae77f[_0x8b23('0x3b')]=_[_0x8b23('0x72')](db[_0x8b23('0x38')]['rawAttributes']);_0x5ae77f['query']=_[_0x8b23('0x72')](_0xfa263[_0x8b23('0x3c')]);_0x5ae77f['filters']=_[_0x8b23('0x3e')](_0x5ae77f[_0x8b23('0x3b')],_0x5ae77f[_0x8b23('0x3c')]);_0x191272[_0x8b23('0x40')]=_[_0x8b23('0x3e')](_0x5ae77f[_0x8b23('0x3b')],qs[_0x8b23('0x3f')](_0xfa263[_0x8b23('0x3c')][_0x8b23('0x3f')]));_0x191272['attributes']=_0x191272[_0x8b23('0x40')]['length']?_0x191272['attributes']:_0x5ae77f['model'];if(_0xfa263[_0x8b23('0x3c')][_0x8b23('0xb8')]){_0x191272['include']=[{'all':!![]}];}_0x191272=_['merge']({},_0x191272,_0xfa263['options']);return db['SmsInteraction'][_0x8b23('0x60')](_0x191272)[_0x8b23('0x2b')](handleEntityNotFound(_0x596afc,null))[_0x8b23('0x2b')](respondWithResult(_0x596afc,null))[_0x8b23('0xb5')](handleError(_0x596afc,null));};exports[_0x8b23('0xb9')]=function(_0x3ebd5d,_0x4ac77e){return db[_0x8b23('0x38')][_0x8b23('0xb9')](_0x3ebd5d[_0x8b23('0xba')],{})[_0x8b23('0x2b')](respondWithResult(_0x4ac77e,0xc9))[_0x8b23('0xb5')](handleError(_0x4ac77e,null));};exports[_0x8b23('0x2a')]=function(_0x3c6973,_0x40ec37){if(_0x3c6973['body']['id']){delete _0x3c6973['body']['id'];}return db[_0x8b23('0x38')][_0x8b23('0x60')]({'where':{'id':_0x3c6973[_0x8b23('0xb7')]['id']}})[_0x8b23('0x2b')](handleEntityNotFound(_0x40ec37,null))['then'](saveUpdates(_0x3c6973['body'],null))['then'](respondWithResult(_0x40ec37,null))['catch'](handleError(_0x40ec37,null));};exports[_0x8b23('0x2c')]=function(_0x2835d0,_0x2148d5){return db['SmsInteraction'][_0x8b23('0x60')]({'where':{'id':_0x2835d0[_0x8b23('0xb7')]['id']}})[_0x8b23('0x2b')](handleEntityNotFound(_0x2148d5,null))[_0x8b23('0x2b')](removeEntity(_0x2148d5,null))[_0x8b23('0xb5')](handleError(_0x2148d5,null));};exports[_0x8b23('0xbb')]=function(_0x327485,_0x1d91f3){return db[_0x8b23('0x38')][_0x8b23('0xbb')]()[_0x8b23('0x2b')](respondWithResult(_0x1d91f3,null))[_0x8b23('0xb5')](handleError(_0x1d91f3,null));};exports[_0x8b23('0xbc')]=function(_0x148f4e,_0x704455,_0x504700){return db[_0x8b23('0xbd')]['find']({'where':{'id':_0x148f4e[_0x8b23('0xb7')]['id']}})[_0x8b23('0x2b')](handleEntityNotFound(_0x704455,null))['then'](function(_0x586ade){if(_0x586ade){return _0x586ade['addMessage'](_0x148f4e['body'][_0x8b23('0xbe')],_['omit'](_0x148f4e[_0x8b23('0xba')],[_0x8b23('0xbe'),'id'])||{});}})[_0x8b23('0x2b')](respondWithResult(_0x704455,null))[_0x8b23('0xb5')](handleError(_0x704455,null));};exports['getMessages']=function(_0x3ae8c5,_0x2b86d4,_0x5aa48a){var _0x2281d6={'raw':![],'where':{}};var _0x44cc8b={};var _0x26554a={'count':0x0,'rows':[]};return db[_0x8b23('0x38')][_0x8b23('0xbf')]({'where':{'id':_0x3ae8c5[_0x8b23('0xb7')]['id']}})[_0x8b23('0x2b')](handleEntityNotFound(_0x2b86d4,null))['then'](function(_0xb80fb){if(_0xb80fb){_0x44cc8b[_0x8b23('0x3b')]=_[_0x8b23('0x72')](db[_0x8b23('0xbd')][_0x8b23('0xc0')]);_0x44cc8b[_0x8b23('0x3c')]=_[_0x8b23('0x72')](_0x3ae8c5[_0x8b23('0x3c')]);_0x44cc8b[_0x8b23('0x3d')]=_['intersection'](_0x44cc8b[_0x8b23('0x3b')],_0x44cc8b[_0x8b23('0x3c')]);_0x2281d6[_0x8b23('0x40')]=_[_0x8b23('0x3e')](_0x44cc8b['model'],qs[_0x8b23('0x3f')](_0x3ae8c5[_0x8b23('0x3c')]['fields']));_0x2281d6[_0x8b23('0x40')]=_0x2281d6[_0x8b23('0x40')]['length']?_0x2281d6['attributes']:_0x44cc8b[_0x8b23('0x3b')];if(!_0x3ae8c5[_0x8b23('0x3c')]['hasOwnProperty'](_0x8b23('0x42'))){_0x2281d6[_0x8b23('0x24')]=qs[_0x8b23('0x24')](_0x3ae8c5[_0x8b23('0x3c')][_0x8b23('0x24')]);_0x2281d6[_0x8b23('0x23')]=qs[_0x8b23('0x23')](_0x3ae8c5['query'][_0x8b23('0x23')]);}_0x2281d6[_0x8b23('0x43')]=qs[_0x8b23('0x44')](_0x3ae8c5[_0x8b23('0x3c')][_0x8b23('0x44')]);_0x2281d6[_0x8b23('0x45')]=qs[_0x8b23('0x3d')](_[_0x8b23('0x46')](_0x3ae8c5[_0x8b23('0x3c')],_0x44cc8b['filters']));_0x2281d6[_0x8b23('0x45')][_0x8b23('0xc1')]=_0xb80fb['id'];if(_0x3ae8c5[_0x8b23('0x3c')]['filter']){_0x2281d6[_0x8b23('0x45')]=_[_0x8b23('0x9e')](_0x2281d6['where'],{'$or':_[_0x8b23('0x31')](_0x2281d6['attributes'],function(_0x45e603){var _0xf33789={};_0xf33789[_0x45e603]={'$like':'%'+_0x3ae8c5['query']['filter']+'%'};return _0xf33789;})});}if(_0x3ae8c5['query'][_0x8b23('0x7a')]){var _0x5a184d=_0x3ae8c5[_0x8b23('0x3c')]['$gte'][_0x8b23('0x35')](',');var _0x3b577b={};_0x3b577b[_0x5a184d[0x0]]={'$gte':moment(_0x5a184d[0x1])['format'](_0x8b23('0xc2'))};_0x2281d6[_0x8b23('0x45')]=_[_0x8b23('0x9e')](_0x2281d6[_0x8b23('0x45')],_0x3b577b);}_0x2281d6=_[_0x8b23('0x9e')]({},_0x2281d6,_0x3ae8c5['options']);return db[_0x8b23('0xbd')][_0x8b23('0x26')]({'where':_0x2281d6[_0x8b23('0x45')]})[_0x8b23('0x2b')](function(_0x16844e){_0x26554a['count']=_0x16844e;if(_0x3ae8c5['query'][_0x8b23('0xb8')]){_0x2281d6['include']=[{'all':!![]}];}return db[_0x8b23('0xbd')][_0x8b23('0xc3')](_0x2281d6);})[_0x8b23('0x2b')](function(_0x2622d6){_0x26554a['rows']=_0x2622d6;return _0x26554a;});}})[_0x8b23('0x2b')](respondWithFilteredResult(_0x2b86d4,_0x2281d6))[_0x8b23('0xb5')](handleError(_0x2b86d4,null));};exports['addTags']=function(_0x4fab58,_0x36f236,_0x213717){return db['SmsInteraction']['find']({'where':{'id':_0x4fab58[_0x8b23('0xb7')]['id']}})['then'](handleEntityNotFound(_0x36f236,null))[_0x8b23('0x2b')](function(_0x2231e4){if(_0x2231e4){return _0x2231e4[_0x8b23('0xc4')](_0x4fab58['body'][_0x8b23('0xbe')],_[_0x8b23('0xc5')](_0x4fab58[_0x8b23('0xba')],['ids','id'])||{})[_0x8b23('0xc6')](function(){return db[_0x8b23('0xc7')][_0x8b23('0xc3')]({'attributes':['id','name',_0x8b23('0x49')],'where':{'id':_0x4fab58[_0x8b23('0xba')][_0x8b23('0xbe')]}});})[_0x8b23('0x2b')](function(_0x29ec96){socket[_0x8b23('0xc8')](_0x8b23('0xc9'),{'id':Number(_0x4fab58[_0x8b23('0xb7')]['id']),'tags':_0x29ec96||[]});return{'id':Number(_0x4fab58[_0x8b23('0xb7')]['id']),'tags':_0x29ec96||[]};});}})[_0x8b23('0x2b')](respondWithResult(_0x36f236,null))[_0x8b23('0xb5')](handleError(_0x36f236,null));};exports['removeTags']=function(_0x266306,_0xa567e2,_0x3b4452){return db[_0x8b23('0x38')]['find']({'where':{'id':_0x266306['params']['id']}})['then'](handleEntityNotFound(_0xa567e2,null))[_0x8b23('0x2b')](function(_0x45ae72){if(_0x45ae72){return _0x45ae72[_0x8b23('0xca')](_0x266306[_0x8b23('0x3c')][_0x8b23('0xbe')]);}})[_0x8b23('0x2b')](respondWithStatusCode(_0xa567e2,null))['catch'](handleError(_0xa567e2,null));};exports['download']=function(_0x189fbe,_0x19a0a8){var _0x23c74b=moment()[_0x8b23('0xcb')]()[_0x8b23('0x9c')]();var _0x1c5331=path[_0x8b23('0xcc')](config[_0x8b23('0xcd')],_0x8b23('0xce'),'files',_0x8b23('0xcf'));var _0x370517=path['join'](config[_0x8b23('0xcd')],'server',_0x8b23('0xd0'),'attachments');var _0xb17782=path[_0x8b23('0xcc')](_0x1c5331,_0x23c74b);var _0x4de665=util[_0x8b23('0xd1')]('transcript-%d-%s.zip',_0x189fbe['params']['id'],_0x23c74b);var _0x269c65=path[_0x8b23('0xcc')](_0x1c5331,_0x4de665);var _0x5ec687=[];_0x5ec687[_0x8b23('0x37')]({'model':db[_0x8b23('0x6e')],'as':_0x8b23('0x6e'),'attributes':['id',_0x8b23('0x32')],'raw':!![]});_0x5ec687['push']({'model':db[_0x8b23('0xd2')],'as':_0x8b23('0x64'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x944975=[{'model':db[_0x8b23('0xbd')],'as':_0x8b23('0xd3'),'attributes':['id','body','createdAt','direction',_0x8b23('0xd4'),_0x8b23('0x7f')],'include':_0x5ec687}];_0x944975[_0x8b23('0x37')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x944975['push']({'model':db['User'],'as':_0x8b23('0xd5'),'attributes':['id',_0x8b23('0x32')]});return db[_0x8b23('0x38')]['find']({'where':{'id':_0x189fbe[_0x8b23('0xb7')]['id']},'include':_0x944975})['then'](handleEntityNotFound(_0x19a0a8,null))['then'](function(_0x27a2b7){if(_0x27a2b7){var _0x12d9c6=_0x27a2b7[_0x8b23('0xd6')]({'plain':!![]});fs['mkdirSync'](_0xb17782);var _0x203a7c={'channel':_0x8b23('0xd7'),'account':_0x12d9c6[_0x8b23('0xd8')][_0x8b23('0x2f')],'agent':_0x12d9c6[_0x8b23('0xd5')]?_0x12d9c6['Owner']['fullname']:_0x8b23('0xd9'),'createdAt':moment(_0x12d9c6[_0x8b23('0xda')])[_0x8b23('0xd1')](_0x8b23('0xc2'))['toString'](),'closedAt':_0x12d9c6[_0x8b23('0xdb')]?moment(_0x12d9c6[_0x8b23('0xdc')])['format'](_0x8b23('0xc2'))['toString']():'','disposition':_0x12d9c6[_0x8b23('0xdd')],'messages':_(_0x12d9c6[_0x8b23('0xd3')])[_0x8b23('0x85')]({'secret':![]})['map'](function(_0x24f54c){return{'date':moment(_0x24f54c[_0x8b23('0xda')])[_0x8b23('0xd1')](_0x8b23('0xc2'))['toString'](),'sender':_0x24f54c[_0x8b23('0xde')]===_0x8b23('0xdf')?_0x24f54c[_0x8b23('0x6e')]?_0x24f54c[_0x8b23('0x6e')][_0x8b23('0x32')]:_0x8b23('0xe0'):_0x24f54c['Contact'][_0x8b23('0xe1')]+(_0x24f54c['Contact'][_0x8b23('0xe2')]?'\x20'+_0x24f54c[_0x8b23('0x64')][_0x8b23('0xe2')]:''),'body':_0x24f54c['body'],'direction':_0x24f54c[_0x8b23('0xde')]===_0x8b23('0xdf')?'A':'C','secret':_0x24f54c[_0x8b23('0xd4')],'read':_0x24f54c[_0x8b23('0x7f')]};})[_0x8b23('0x67')]()};return ejs[_0x8b23('0xe3')](path['join'](config['root'],'server',_0x8b23('0xe4'),'downloadInteraction.ejs'),{'interaction':_0x203a7c})[_0x8b23('0x2b')](function(_0x29284f){var _0x13516b=path['join'](_0xb17782,'transcript-'+_0x12d9c6['id']+'-'+_0x23c74b+'.pdf');var _0x364287={'path':_0x13516b,'channel':_0x8b23('0xd7'),'interactionId':_0x12d9c6['id']};return pdf[_0x8b23('0xe5')](_0x29284f,_0x364287);})['then'](function(){return new BPromise(function(_0x2b7340,_0x9764d0){zipdir(_0xb17782,{'saveTo':_0x269c65},function(_0x4bfb9c,_0x4206eb){if(_0x4bfb9c)return _0x9764d0(_0x4bfb9c);return _0x2b7340(_0x4206eb);});})[_0x8b23('0x2b')](function(){return new BPromise(function(_0x434ab7,_0x105a7f){rimraf(_0xb17782,function(_0x597b0e){if(_0x597b0e)_0x105a7f(_0x597b0e);return _0x434ab7();});});})['then'](function(){return _0x19a0a8[_0x8b23('0xe6')](_0x269c65,_0x4de665,function(_0x5921fd){if(_0x5921fd){console[_0x8b23('0xe7')]('err',_0x5921fd);}else{fs['unlinkSync'](_0x269c65);}});});});}else{return _0x19a0a8[_0x8b23('0x20')](0xc8);}})[_0x8b23('0xb5')](handleError(_0x19a0a8,null));}; \ No newline at end of file +var _0x4a65=['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?','find','ContactId','buildExpression','text','start','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.SmsAccountId\x20IS\x20NULL','SmsAccountId','toString','sequelize','keyBy','merge','SmsInteraction','fields','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','params','includeAll','include','options','create','update','destroy','describe','addMessage','ids','getMessages','SmsMessage','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','omit','spread','Tag','smsInteractionTags:save','removeTags','download','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closed','closedAt','disposition','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','socket.io-emitter','./smsInteraction.socket','sendStatus','status','json','offset','undefined','count','limit','reject','then','end','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','index','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','field','from','select','u.id','u.fullname','user_has_sms_interactions','left_join','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','value'];(function(_0x2de2b3,_0x70ef00){var _0x321095=function(_0x17f5c0){while(--_0x17f5c0){_0x2de2b3['push'](_0x2de2b3['shift']());}};_0x321095(++_0x70ef00);}(_0x4a65,0x16f));var _0x54a6=function(_0x4e0dd6,_0x1f4954){_0x4e0dd6=_0x4e0dd6-0x0;var _0x3be3de=_0x4a65[_0x4e0dd6];return _0x3be3de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x54a6('0x0'));var zipdir=require(_0x54a6('0x1'));var jsonpatch=require(_0x54a6('0x2'));var rp=require(_0x54a6('0x3'));var moment=require(_0x54a6('0x4'));var BPromise=require(_0x54a6('0x5'));var Mustache=require('mustache');var util=require(_0x54a6('0x6'));var path=require(_0x54a6('0x7'));var sox=require(_0x54a6('0x8'));var csv=require(_0x54a6('0x9'));var ejs=require(_0x54a6('0xa'));var fs=require('fs');var fs_extra=require(_0x54a6('0xb'));var _=require(_0x54a6('0xc'));var squel=require(_0x54a6('0xd'));var crypto=require(_0x54a6('0xe'));var jsforce=require(_0x54a6('0xf'));var deskjs=require(_0x54a6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x54a6('0x11'));var Papa=require(_0x54a6('0x12'));var Redis=require('ioredis');var authService=require(_0x54a6('0x13'));var qs=require(_0x54a6('0x14'));var as=require(_0x54a6('0x15'));var pdf=require(_0x54a6('0x16'));var hardwareService=require(_0x54a6('0x17'));var logger=require(_0x54a6('0x18'))(_0x54a6('0x19'));var utils=require(_0x54a6('0x1a'));var config=require(_0x54a6('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x54a6('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x54a6('0x1d'))(new Redis(config['redis']));require(_0x54a6('0x1e'))['register'](socket);function respondWithStatusCode(_0x2cc119,_0x512962){_0x512962=_0x512962||0xcc;return function(_0x1020ff){if(_0x1020ff){return _0x2cc119[_0x54a6('0x1f')](_0x512962);}return _0x2cc119[_0x54a6('0x20')](_0x512962)['end']();};}function respondWithResult(_0x30c3ad,_0x484990){_0x484990=_0x484990||0xc8;return function(_0x1e18f6){if(_0x1e18f6){return _0x30c3ad['status'](_0x484990)[_0x54a6('0x21')](_0x1e18f6);}};}function respondWithFilteredResult(_0x2b3384,_0x1d0ad5){return function(_0x554f2f){if(_0x554f2f){var _0x34ef9c=typeof _0x1d0ad5[_0x54a6('0x22')]===_0x54a6('0x23')&&typeof _0x1d0ad5['limit']==='undefined';var _0x242e9b=_0x554f2f[_0x54a6('0x24')];var _0x513909=_0x34ef9c?0x0:_0x1d0ad5['offset'];var _0x430292=_0x34ef9c?_0x554f2f[_0x54a6('0x24')]:_0x1d0ad5[_0x54a6('0x22')]+_0x1d0ad5[_0x54a6('0x25')];var _0x191416;if(_0x430292>=_0x242e9b){_0x430292=_0x242e9b;_0x191416=0xc8;}else{_0x191416=0xce;}_0x2b3384['status'](_0x191416);return _0x2b3384['set']('Content-Range',_0x513909+'-'+_0x430292+'/'+_0x242e9b)['json'](_0x554f2f);}return null;};}function patchUpdates(_0x434b0c){return function(_0x2292e2){try{jsonpatch['apply'](_0x2292e2,_0x434b0c,!![]);}catch(_0x5edcda){return BPromise[_0x54a6('0x26')](_0x5edcda);}return _0x2292e2['save']();};}function saveUpdates(_0x511bd3,_0x4b2ed0){return function(_0x10ca94){if(_0x10ca94){return _0x10ca94['update'](_0x511bd3)[_0x54a6('0x27')](function(_0x479087){return _0x479087;});}return null;};}function removeEntity(_0x5b13ee,_0x558b92){return function(_0x40aca5){if(_0x40aca5){return _0x40aca5['destroy']()[_0x54a6('0x27')](function(){_0x5b13ee['status'](0xcc)[_0x54a6('0x28')]();});}};}function handleEntityNotFound(_0x247440,_0x1c35e5){return function(_0x24e914){if(!_0x24e914){_0x247440['sendStatus'](0x194);}return _0x24e914;};}function handleError(_0x682fc0,_0x34808a){_0x34808a=_0x34808a||0x1f4;return function(_0x5a85a7){logger[_0x54a6('0x29')](_0x5a85a7[_0x54a6('0x2a')]);if(_0x5a85a7[_0x54a6('0x2b')]){delete _0x5a85a7[_0x54a6('0x2b')];}_0x682fc0[_0x54a6('0x20')](_0x34808a)[_0x54a6('0x2c')](_0x5a85a7);};}function getInteractionUsers(_0x4fe736,_0x3d40b9){return new BPromise(function(_0x1fcb39,_0x53691e){try{if(_0x3d40b9[_0x4fe736['id']]){_0x4fe736[_0x54a6('0x2d')]=_[_0x54a6('0x2e')](_0x3d40b9[_0x4fe736['id']],function(_0x423622){return{'id':_0x423622['id'],'fullname':_0x423622[_0x54a6('0x2f')]};});}}catch(_0x39a27f){_0x53691e(_0x39a27f);}_0x1fcb39(_0x4fe736);});}function getInteractionTags(_0x3a641b,_0x309d56){return new BPromise(function(_0x58cd28,_0x57abd3){try{if(_0x3a641b['TagIds']){_0x3a641b[_0x54a6('0x30')]=[];_0x3a641b[_0x54a6('0x31')][_0x54a6('0x32')](',')[_0x54a6('0x33')](function(_0x112cbc){_0x3a641b['Tags'][_0x54a6('0x34')](_0x309d56[_0x112cbc]);});}delete _0x3a641b[_0x54a6('0x31')];}catch(_0x16cb55){_0x57abd3(_0x16cb55);}_0x58cd28(_0x3a641b);});}function updateSmsInteraction(_0x25088f,_0x588492,_0x1e5e6b){return new BPromise(function(_0x21cf97,_0x662f0e){return getInteractionUsers(_0x25088f,_0x1e5e6b)[_0x54a6('0x27')](function(_0x4cb836){return getInteractionTags(_0x4cb836,_0x588492);})[_0x54a6('0x27')](function(_0x191cae){_0x21cf97(_0x191cae);})[_0x54a6('0x35')](function(_0x41ac41){_0x662f0e(_0x41ac41);});});}exports[_0x54a6('0x36')]=function(_0x4c225d,_0xc944f9){var _0xc15afd={},_0x29b4e0={},_0x3c9ddc={'count':0x0,'rows':[]};var _0x4b7495=_[_0x54a6('0x2e')](db['SmsInteraction'][_0x54a6('0x37')],function(_0x1a17cb){return{'name':_0x1a17cb[_0x54a6('0x38')],'type':_0x1a17cb[_0x54a6('0x39')][_0x54a6('0x3a')]};});_0x29b4e0['model']=_[_0x54a6('0x2e')](_0x4b7495,'name');_0x29b4e0[_0x54a6('0x3b')]=_[_0x54a6('0x3c')](_0x4c225d[_0x54a6('0x3b')]);_0x29b4e0['filters']=_[_0x54a6('0x3d')](_0x29b4e0['model'],_0x29b4e0[_0x54a6('0x3b')]);_0xc15afd[_0x54a6('0x3e')]=_[_0x54a6('0x3d')](_0x29b4e0['model'],qs['fields'](_0x4c225d[_0x54a6('0x3b')]['fields']));_0xc15afd[_0x54a6('0x3e')]=_0xc15afd[_0x54a6('0x3e')][_0x54a6('0x3f')]?_0xc15afd[_0x54a6('0x3e')]:_0x29b4e0[_0x54a6('0x40')];if(!_0x4c225d[_0x54a6('0x3b')][_0x54a6('0x41')](_0x54a6('0x42'))){_0xc15afd[_0x54a6('0x25')]=qs['limit'](_0x4c225d[_0x54a6('0x3b')][_0x54a6('0x25')]);_0xc15afd['offset']=qs[_0x54a6('0x22')](_0x4c225d[_0x54a6('0x3b')][_0x54a6('0x22')]);}_0xc15afd[_0x54a6('0x43')]=qs['sort'](_0x4c225d[_0x54a6('0x3b')][_0x54a6('0x44')]);_0xc15afd[_0x54a6('0x45')]=qs[_0x54a6('0x46')](_[_0x54a6('0x47')](_0x4c225d[_0x54a6('0x3b')],_0x29b4e0[_0x54a6('0x46')]),_0x4b7495);var _0x47a88f=[];var _0x43fcd7=squel['select']()['field']('id')[_0x54a6('0x48')]('name')[_0x54a6('0x48')]('color')[_0x54a6('0x49')]('tools_tags');var _0x5c2a8c=squel[_0x54a6('0x4a')]()[_0x54a6('0x48')](_0x54a6('0x4b'))[_0x54a6('0x48')](_0x54a6('0x4c'))[_0x54a6('0x48')]('ui.SmsInteractionId')[_0x54a6('0x49')](_0x54a6('0x4d'),'ui')[_0x54a6('0x4e')]('users','u','u.id\x20=\x20ui.UserId');var _0x3fb2be=squel[_0x54a6('0x4a')]()[_0x54a6('0x49')]('sms_interactions','i')[_0x54a6('0x4e')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x54a6('0x4e')]('users','o',_0x54a6('0x4f'))[_0x54a6('0x4e')](_0x54a6('0x50'),'a',_0x54a6('0x51'))[_0x54a6('0x4e')]('sms_messages','me',_0x54a6('0x52'))[_0x54a6('0x4e')](_0x54a6('0x53'),'it',_0x54a6('0x54'))['left_join']('tools_tags','t',_0x54a6('0x55'));var _0x59015c=squel[_0x54a6('0x56')]();var _0x5360d6=[];var _0x38f87e=squel[_0x54a6('0x56')]();var _0x198075;if(_0x4c225d[_0x54a6('0x3b')]['search']){_0x198075=as[_0x54a6('0x57')](_0x4c225d['query']['search']);var _0x5631ff=_0x198075[_0x54a6('0x58')];for(var _0x4fc709=0x0;_0x4fc709<_0x198075['conditions'][_0x54a6('0x3f')];_0x4fc709++){var _0x56a7b5=_0x198075[_0x54a6('0x59')][_0x4fc709];var _0x4cbf72='i';var _0x3042cb=_['find'](_0x4b7495,[_0x54a6('0x2b'),_0x56a7b5['field']]);if(!_0x3042cb){switch(_0x56a7b5[_0x54a6('0x48')]){case'unreadMessages':if(_0x56a7b5[_0x54a6('0x5a')]==0x1){_0x3fb2be[_0x54a6('0x5b')]('`'+_0x56a7b5[_0x54a6('0x48')]+_0x54a6('0x5c'));}else{_0x3fb2be['having']('`'+_0x56a7b5[_0x54a6('0x48')]+_0x54a6('0x5d'));}break;case _0x54a6('0x5e'):if(_0x56a7b5[_0x54a6('0x5f')]===_0x54a6('0x60')){if(_0x56a7b5['value'][_0x54a6('0x32')]('\x20')[_0x54a6('0x3f')]>0x1){_0x59015c[_0x5631ff](_0x54a6('0x61'),qs[_0x54a6('0x62')](_0x56a7b5[_0x54a6('0x5a')]),null);}else{var _0x42f1a5='%'+_0x56a7b5[_0x54a6('0x5a')]+'%';_0x59015c[_0x5631ff](_0x54a6('0x63'),_0x42f1a5,_0x42f1a5,_0x42f1a5);}}else{_0x3042cb=_[_0x54a6('0x64')](_0x4b7495,['name',_0x54a6('0x65')]);_0x56a7b5['field']=_0x54a6('0x65');_0x167fb3=as[_0x54a6('0x66')](_0x4cbf72,_0x3042cb['type'],_0x56a7b5);_0x59015c[_0x5631ff](_0x167fb3[_0x54a6('0x67')],_0x167fb3['value'][_0x54a6('0x68')],_0x167fb3['value']['end']);}break;case'Tag':var _0x1678d5=_0x56a7b5[_0x54a6('0x5a')][_0x54a6('0x32')](',')[_0x54a6('0x2e')](function(_0x542bb3){return Number(_0x542bb3);});_0x1678d5[_0x54a6('0x33')](function(_0x1d0e0a){_0x38f87e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1d0e0a+',%');});_0x5360d6=_[_0x54a6('0x69')](_0x5360d6,_0x1678d5);break;case _0x54a6('0x6a'):if(_0x56a7b5[_0x54a6('0x5f')]===_0x54a6('0x60')){_0x59015c[_0x5631ff](_0x54a6('0x6b'),'%'+_0x56a7b5[_0x54a6('0x5a')]+'%',null);}else{_0x3042cb=_[_0x54a6('0x64')](_0x4b7495,[_0x54a6('0x2b'),_0x54a6('0x6c')]);_0x56a7b5['field']=_0x54a6('0x6c');_0x167fb3=as[_0x54a6('0x66')](_0x4cbf72,_0x3042cb[_0x54a6('0x39')],_0x56a7b5);_0x59015c[_0x5631ff](_0x167fb3[_0x54a6('0x67')],_0x167fb3[_0x54a6('0x5a')][_0x54a6('0x68')],_0x167fb3[_0x54a6('0x5a')][_0x54a6('0x28')]);}break;case _0x54a6('0x6d'):_0x167fb3=as[_0x54a6('0x66')]('me',null,_0x56a7b5);_0x59015c[_0x5631ff](_0x167fb3['text'],_0x167fb3[_0x54a6('0x5a')][_0x54a6('0x68')],_0x167fb3[_0x54a6('0x5a')][_0x54a6('0x28')]);break;}}else{var _0x167fb3=as['buildExpression'](_0x4cbf72,_0x3042cb[_0x54a6('0x39')],_0x56a7b5);_0x59015c[_0x5631ff](_0x167fb3[_0x54a6('0x67')],_0x167fb3['value'][_0x54a6('0x68')],_0x167fb3[_0x54a6('0x5a')][_0x54a6('0x28')]);}}}else{var _0x1a912d=_(_0x4c225d[_0x54a6('0x3b')])['keys']()[_0x54a6('0x2e')](function(_0x190517){return _[_0x54a6('0x6e')](_0x4b7495,[_0x54a6('0x2b'),_0x190517])?_0x190517:undefined;})[_0x54a6('0x6f')]()[_0x54a6('0x5a')]();if(!_['isEmpty'](_0x1a912d)){_0x1a912d['forEach'](function(_0x50cd68){if(_0x50cd68==='SmsAccountId'){_0x3fb2be['where'](_0x54a6('0x70'),[][_0x54a6('0x71')](_0x4c225d['query'][_0x50cd68]));}else if(_0x50cd68===_0x54a6('0x72')){var _0x3a7215=JSON[_0x54a6('0x73')](_0x4c225d[_0x54a6('0x3b')][_0x50cd68])[_0x54a6('0x74')];var _0x267f7d=JSON[_0x54a6('0x73')](_0x4c225d[_0x54a6('0x3b')][_0x50cd68])['$lte'];_0x3fb2be[_0x54a6('0x45')](_0x54a6('0x75'),_0x3a7215,_0x267f7d);}else{if(_0x4c225d[_0x54a6('0x3b')][_0x50cd68]==='null'){_0x3fb2be[_0x54a6('0x45')]('i.'+_0x50cd68+_0x54a6('0x76'));}else{_0x3fb2be[_0x54a6('0x45')]('i.'+_0x50cd68+_0x54a6('0x77'),_0x4c225d['query'][_0x50cd68]);}}});}if(_0x4c225d[_0x54a6('0x3b')]['read']){if(_0x4c225d[_0x54a6('0x3b')]['read']==0x1){_0x3fb2be['having'](_0x54a6('0x78'));}else{_0x3fb2be[_0x54a6('0x5b')](_0x54a6('0x79'));}}if(_0x4c225d[_0x54a6('0x3b')][_0x54a6('0x7a')]){_0x5360d6=_[_0x54a6('0x7b')](_0x4c225d['query']['tag'])?_0x4c225d[_0x54a6('0x3b')][_0x54a6('0x7a')]:new Array(_0x4c225d[_0x54a6('0x3b')][_0x54a6('0x7a')]);_0x5360d6[_0x54a6('0x33')](function(_0xdf7987){_0x38f87e['or'](_0x54a6('0x7c'),'%,'+_0xdf7987+',%');});}if(_0x4c225d[_0x54a6('0x3b')][_0x54a6('0x7d')]){var _0x3ae32a=_0x4c225d[_0x54a6('0x3b')][_0x54a6('0x7d')][_0x54a6('0x7e')]('\x5c','\x5c\x5c')[_0x54a6('0x7e')](/'/g,'\x27\x27');if(qs[_0x54a6('0x7f')](_0x3ae32a)){_0x59015c['or'](_0x54a6('0x80'),_0x3ae32a+'%')['or'](_0x54a6('0x81'),_0x3ae32a+'%');}else{_0x59015c['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3ae32a))['or'](_0x54a6('0x82'),_0x3ae32a+'%');}}}_0x3fb2be[_0x54a6('0x45')](_0x59015c);_0x3fb2be[_0x54a6('0x83')](_0x54a6('0x84'));var _0x573813={'type':db[_0x54a6('0x85')][_0x54a6('0x86')][_0x54a6('0x87')],'raw':!![]};var _0x2513cd=_0x3fb2be[_0x54a6('0x88')]();_0x2513cd['field'](_0x54a6('0x84'));_0x2513cd[_0x54a6('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x54a6('0x89'));if(_0xc15afd[_0x54a6('0x43')]){_0xc15afd['order']['forEach'](function(_0x46521d){var _0x149d83=_0x46521d[0x0]===_0x54a6('0x8a')?_0x46521d[0x0]:'i.'+_0x46521d[0x0];_0x3fb2be['order'](_0x149d83,_0x46521d[0x1]===_0x54a6('0x8b')?![]:!![]);});}if(!_[_0x54a6('0x8c')](_0x5360d6)){_0x3fb2be[_0x54a6('0x5b')](_0x38f87e);_0x2513cd['where'](_0x54a6('0x8d'),_0x5360d6);}BPromise[_0x54a6('0x8e')]()[_0x54a6('0x27')](function(){if(!_0x198075){if(_0x4c225d[_0x54a6('0x3b')]['SmsAccountId'])return;_0x2513cd[_0x54a6('0x45')](_0x54a6('0x8f'));_0x3fb2be[_0x54a6('0x45')](_0x54a6('0x8f'));return;}if(_0x4c225d['user'][_0x54a6('0x90')]!==_0x54a6('0x91'))return;return _0x4c225d[_0x54a6('0x92')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x54a6('0x27')](function(_0x54058c){if(_[_0x54a6('0x8c')](_0x54058c)){_0x2513cd[_0x54a6('0x45')](_0x54a6('0x93'));_0x3fb2be[_0x54a6('0x45')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x2513cd[_0x54a6('0x45')]('i.SmsAccountId\x20IN\x20?',_[_0x54a6('0x2e')](_0x54058c,'id'));_0x3fb2be['where'](_0x54a6('0x70'),_[_0x54a6('0x2e')](_0x54058c,'id'));}});})[_0x54a6('0x27')](function(){if(_0x4c225d[_0x54a6('0x92')]['role']===_0x54a6('0x91')&&!_0x198075&&!_0x4c225d['query'][_0x54a6('0x94')])return[];return db['sequelize'][_0x54a6('0x3b')](_0x2513cd[_0x54a6('0x95')](),_0x573813);})[_0x54a6('0x27')](function(_0x1af13e){_0x3c9ddc[_0x54a6('0x24')]=_0x1af13e['length'];if(_0x3c9ddc[_0x54a6('0x24')]===0x0)return[];return db[_0x54a6('0x96')][_0x54a6('0x3b')](_0x43fcd7[_0x54a6('0x95')](),_0x573813)[_0x54a6('0x27')](function(_0x313428){_0x47a88f=_[_0x54a6('0x97')](_0x313428,'id');_0x573813=_[_0x54a6('0x98')](_0x573813,{'model':db[_0x54a6('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c225d[_0x54a6('0x3b')][_0x54a6('0x9a')]){_0xc15afd['attributes'][_0x54a6('0x33')](function(_0x4c08b4){_0x3fb2be['field']('i.'+_0x4c08b4);});}else{_0x3fb2be[_0x54a6('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x3fb2be[_0x54a6('0x48')](_0x54a6('0x9b'),_0x54a6('0x9c'));_0x3fb2be[_0x54a6('0x48')]('a.mandatoryDisposition',_0x54a6('0x9d'));_0x3fb2be[_0x54a6('0x48')](_0x54a6('0x9e'),_0x54a6('0x8a'));_0x3fb2be[_0x54a6('0x48')](_0x54a6('0x9f'));_0x3fb2be[_0x54a6('0x48')]('c.firstName',_0x54a6('0xa0'));_0x3fb2be[_0x54a6('0x48')]('c.lastName',_0x54a6('0xa1'));_0x3fb2be[_0x54a6('0x48')]('c.email',_0x54a6('0xa2'));_0x3fb2be[_0x54a6('0x48')]('c.phone','Contact.phone');_0x3fb2be[_0x54a6('0x48')](_0x54a6('0xa3'),_0x54a6('0xa4'));_0x3fb2be[_0x54a6('0x48')](_0x54a6('0xa5'),_0x54a6('0xa6'));_0x3fb2be[_0x54a6('0x48')]('o.fullname','Owner.fullname');_0x3fb2be['field']('o.internal','Owner.internal');_0x3fb2be[_0x54a6('0x48')](_0x54a6('0xa7'),_0x54a6('0x31'));}if(_0xc15afd['limit'])_0x3fb2be[_0x54a6('0x25')](_0xc15afd[_0x54a6('0x25')]);if(_0xc15afd[_0x54a6('0x22')])_0x3fb2be['offset'](_0xc15afd['offset']);return db[_0x54a6('0x96')][_0x54a6('0x3b')](_0x3fb2be[_0x54a6('0x95')](),_0x573813);})[_0x54a6('0x27')](function(_0x1562e2){if(_0x1562e2[_0x54a6('0x3f')]>0x0)_0x5c2a8c['where'](_0x54a6('0xa8'),_[_0x54a6('0x2e')](_0x1562e2,'id'));return db[_0x54a6('0x96')][_0x54a6('0x3b')](_0x5c2a8c[_0x54a6('0x95')](),_0x573813)[_0x54a6('0x27')](function(_0xe16ed6){var _0x1f7066=_[_0x54a6('0xa9')](_0xe16ed6,_0x54a6('0xaa'));var _0x5e71be=[];_0x1562e2[_0x54a6('0x33')](function(_0x59b7de){_0x5e71be['push'](updateSmsInteraction(_0x59b7de,_0x47a88f,_0x1f7066));});return BPromise[_0x54a6('0xab')](_0x5e71be);});});})[_0x54a6('0x27')](function(_0x19d682){_0x3c9ddc['rows']=_0x19d682;return _0x3c9ddc;})['then'](respondWithFilteredResult(_0xc944f9,_0xc15afd))[_0x54a6('0x35')](handleError(_0xc944f9,null));};exports['show']=function(_0x1e8ab4,_0x2d472f){var _0x3655f6={'raw':![],'where':{'id':_0x1e8ab4[_0x54a6('0xac')]['id']}},_0x48e1ba={};_0x48e1ba[_0x54a6('0x40')]=_[_0x54a6('0x3c')](db[_0x54a6('0x99')][_0x54a6('0x37')]);_0x48e1ba['query']=_['keys'](_0x1e8ab4[_0x54a6('0x3b')]);_0x48e1ba[_0x54a6('0x46')]=_[_0x54a6('0x3d')](_0x48e1ba[_0x54a6('0x40')],_0x48e1ba[_0x54a6('0x3b')]);_0x3655f6[_0x54a6('0x3e')]=_[_0x54a6('0x3d')](_0x48e1ba[_0x54a6('0x40')],qs['fields'](_0x1e8ab4['query'][_0x54a6('0x9a')]));_0x3655f6[_0x54a6('0x3e')]=_0x3655f6[_0x54a6('0x3e')][_0x54a6('0x3f')]?_0x3655f6[_0x54a6('0x3e')]:_0x48e1ba[_0x54a6('0x40')];if(_0x1e8ab4[_0x54a6('0x3b')][_0x54a6('0xad')]){_0x3655f6[_0x54a6('0xae')]=[{'all':!![]}];}_0x3655f6=_[_0x54a6('0x98')]({},_0x3655f6,_0x1e8ab4[_0x54a6('0xaf')]);return db[_0x54a6('0x99')]['find'](_0x3655f6)[_0x54a6('0x27')](handleEntityNotFound(_0x2d472f,null))[_0x54a6('0x27')](respondWithResult(_0x2d472f,null))[_0x54a6('0x35')](handleError(_0x2d472f,null));};exports['create']=function(_0x3fa1b0,_0x5dfb63){return db[_0x54a6('0x99')][_0x54a6('0xb0')](_0x3fa1b0[_0x54a6('0x6d')],{})[_0x54a6('0x27')](respondWithResult(_0x5dfb63,0xc9))[_0x54a6('0x35')](handleError(_0x5dfb63,null));};exports[_0x54a6('0xb1')]=function(_0x3f1764,_0x28bc8b){if(_0x3f1764[_0x54a6('0x6d')]['id']){delete _0x3f1764[_0x54a6('0x6d')]['id'];}return db[_0x54a6('0x99')]['find']({'where':{'id':_0x3f1764[_0x54a6('0xac')]['id']}})[_0x54a6('0x27')](handleEntityNotFound(_0x28bc8b,null))[_0x54a6('0x27')](saveUpdates(_0x3f1764[_0x54a6('0x6d')],null))['then'](respondWithResult(_0x28bc8b,null))[_0x54a6('0x35')](handleError(_0x28bc8b,null));};exports[_0x54a6('0xb2')]=function(_0x442d54,_0x56081c){return db[_0x54a6('0x99')][_0x54a6('0x64')]({'where':{'id':_0x442d54['params']['id']}})['then'](handleEntityNotFound(_0x56081c,null))[_0x54a6('0x27')](removeEntity(_0x56081c,null))[_0x54a6('0x35')](handleError(_0x56081c,null));};exports[_0x54a6('0xb3')]=function(_0x2f39cc,_0x1ae0c5){return db[_0x54a6('0x99')]['describe']()[_0x54a6('0x27')](respondWithResult(_0x1ae0c5,null))['catch'](handleError(_0x1ae0c5,null));};exports[_0x54a6('0xb4')]=function(_0x168bad,_0x7c693e,_0xe79a7d){return db['SmsMessage'][_0x54a6('0x64')]({'where':{'id':_0x168bad[_0x54a6('0xac')]['id']}})[_0x54a6('0x27')](handleEntityNotFound(_0x7c693e,null))[_0x54a6('0x27')](function(_0x2bb25e){if(_0x2bb25e){return _0x2bb25e['addMessage'](_0x168bad['body'][_0x54a6('0xb5')],_['omit'](_0x168bad[_0x54a6('0x6d')],[_0x54a6('0xb5'),'id'])||{});}})['then'](respondWithResult(_0x7c693e,null))[_0x54a6('0x35')](handleError(_0x7c693e,null));};exports[_0x54a6('0xb6')]=function(_0x14b339,_0x9f931a,_0x595a8d){var _0x45fd78={'raw':![],'where':{}};var _0x56d489={};var _0x2ce394={'count':0x0,'rows':[]};return db[_0x54a6('0x99')]['findOne']({'where':{'id':_0x14b339['params']['id']}})['then'](handleEntityNotFound(_0x9f931a,null))[_0x54a6('0x27')](function(_0x5d707b){if(_0x5d707b){_0x56d489[_0x54a6('0x40')]=_[_0x54a6('0x3c')](db[_0x54a6('0xb7')][_0x54a6('0x37')]);_0x56d489[_0x54a6('0x3b')]=_['keys'](_0x14b339[_0x54a6('0x3b')]);_0x56d489[_0x54a6('0x46')]=_[_0x54a6('0x3d')](_0x56d489[_0x54a6('0x40')],_0x56d489[_0x54a6('0x3b')]);_0x45fd78[_0x54a6('0x3e')]=_['intersection'](_0x56d489['model'],qs[_0x54a6('0x9a')](_0x14b339[_0x54a6('0x3b')][_0x54a6('0x9a')]));_0x45fd78[_0x54a6('0x3e')]=_0x45fd78[_0x54a6('0x3e')]['length']?_0x45fd78[_0x54a6('0x3e')]:_0x56d489['model'];if(!_0x14b339[_0x54a6('0x3b')][_0x54a6('0x41')]('nolimit')){_0x45fd78[_0x54a6('0x25')]=qs[_0x54a6('0x25')](_0x14b339[_0x54a6('0x3b')]['limit']);_0x45fd78[_0x54a6('0x22')]=qs[_0x54a6('0x22')](_0x14b339[_0x54a6('0x3b')][_0x54a6('0x22')]);}_0x45fd78[_0x54a6('0x43')]=qs[_0x54a6('0x44')](_0x14b339[_0x54a6('0x3b')][_0x54a6('0x44')]);_0x45fd78[_0x54a6('0x45')]=qs[_0x54a6('0x46')](_[_0x54a6('0x47')](_0x14b339[_0x54a6('0x3b')],_0x56d489[_0x54a6('0x46')]));_0x45fd78[_0x54a6('0x45')][_0x54a6('0xaa')]=_0x5d707b['id'];if(_0x14b339[_0x54a6('0x3b')][_0x54a6('0x7d')]){_0x45fd78[_0x54a6('0x45')]=_[_0x54a6('0x98')](_0x45fd78[_0x54a6('0x45')],{'$or':_[_0x54a6('0x2e')](_0x45fd78[_0x54a6('0x3e')],function(_0xf3cc65){var _0x4126a6={};_0x4126a6[_0xf3cc65]={'$like':'%'+_0x14b339[_0x54a6('0x3b')][_0x54a6('0x7d')]+'%'};return _0x4126a6;})});}if(_0x14b339['query'][_0x54a6('0x74')]){var _0x4dc1be=_0x14b339[_0x54a6('0x3b')][_0x54a6('0x74')][_0x54a6('0x32')](',');var _0x173d6f={};_0x173d6f[_0x4dc1be[0x0]]={'$gte':moment(_0x4dc1be[0x1])[_0x54a6('0xb8')](_0x54a6('0xb9'))};_0x45fd78[_0x54a6('0x45')]=_[_0x54a6('0x98')](_0x45fd78[_0x54a6('0x45')],_0x173d6f);}_0x45fd78=_[_0x54a6('0x98')]({},_0x45fd78,_0x14b339[_0x54a6('0xaf')]);return db[_0x54a6('0xb7')][_0x54a6('0x24')]({'where':_0x45fd78['where']})['then'](function(_0x148f14){_0x2ce394[_0x54a6('0x24')]=_0x148f14;if(_0x14b339[_0x54a6('0x3b')]['includeAll']){_0x45fd78[_0x54a6('0xae')]=[{'all':!![]}];}return db[_0x54a6('0xb7')][_0x54a6('0xba')](_0x45fd78);})[_0x54a6('0x27')](function(_0x2230c6){_0x2ce394[_0x54a6('0xbb')]=_0x2230c6;return _0x2ce394;});}})['then'](respondWithFilteredResult(_0x9f931a,_0x45fd78))[_0x54a6('0x35')](handleError(_0x9f931a,null));};exports[_0x54a6('0xbc')]=function(_0x3eb621,_0x1c1e2e,_0x2843aa){return db[_0x54a6('0x99')][_0x54a6('0x64')]({'where':{'id':_0x3eb621['params']['id']}})[_0x54a6('0x27')](handleEntityNotFound(_0x1c1e2e,null))[_0x54a6('0x27')](function(_0x48edc6){if(_0x48edc6){return _0x48edc6[_0x54a6('0xbd')](_0x3eb621[_0x54a6('0x6d')][_0x54a6('0xb5')],_[_0x54a6('0xbe')](_0x3eb621[_0x54a6('0x6d')],[_0x54a6('0xb5'),'id'])||{})[_0x54a6('0xbf')](function(){return db[_0x54a6('0xc0')][_0x54a6('0xba')]({'attributes':['id','name','color'],'where':{'id':_0x3eb621[_0x54a6('0x6d')]['ids']}});})[_0x54a6('0x27')](function(_0x6fba49){socket['emit'](_0x54a6('0xc1'),{'id':Number(_0x3eb621[_0x54a6('0xac')]['id']),'tags':_0x6fba49||[]});return{'id':Number(_0x3eb621[_0x54a6('0xac')]['id']),'tags':_0x6fba49||[]};});}})[_0x54a6('0x27')](respondWithResult(_0x1c1e2e,null))['catch'](handleError(_0x1c1e2e,null));};exports[_0x54a6('0xc2')]=function(_0x42e9e4,_0x5da741,_0x3c6fc5){return db[_0x54a6('0x99')][_0x54a6('0x64')]({'where':{'id':_0x42e9e4[_0x54a6('0xac')]['id']}})[_0x54a6('0x27')](handleEntityNotFound(_0x5da741,null))['then'](function(_0x24acb3){if(_0x24acb3){return _0x24acb3[_0x54a6('0xc2')](_0x42e9e4[_0x54a6('0x3b')][_0x54a6('0xb5')]);}})['then'](respondWithStatusCode(_0x5da741,null))[_0x54a6('0x35')](handleError(_0x5da741,null));};exports[_0x54a6('0xc3')]=function(_0x1e4735,_0x57926a){var _0x2e982f=moment()['unix']()[_0x54a6('0x95')]();var _0x61a518=path[_0x54a6('0xc4')](config['root'],_0x54a6('0xc5'),_0x54a6('0xc6'),_0x54a6('0xc7'));var _0x306778=path[_0x54a6('0xc4')](config[_0x54a6('0xc8')],_0x54a6('0xc5'),'files',_0x54a6('0xc9'));var _0x4c2bf6=path[_0x54a6('0xc4')](_0x61a518,_0x2e982f);var _0xbe33af=util[_0x54a6('0xb8')](_0x54a6('0xca'),_0x1e4735[_0x54a6('0xac')]['id'],_0x2e982f);var _0x36a31c=path[_0x54a6('0xc4')](_0x61a518,_0xbe33af);var _0xf40f03=[];_0xf40f03[_0x54a6('0x34')]({'model':db[_0x54a6('0x6a')],'as':_0x54a6('0x6a'),'attributes':['id',_0x54a6('0x2f')],'raw':!![]});_0xf40f03[_0x54a6('0x34')]({'model':db[_0x54a6('0xcb')],'as':_0x54a6('0x5e'),'attributes':['id',_0x54a6('0xcc'),_0x54a6('0xcd')],'raw':!![]});var _0x4c84d8=[{'model':db['SmsMessage'],'as':_0x54a6('0xce'),'attributes':['id',_0x54a6('0x6d'),_0x54a6('0x72'),_0x54a6('0xcf'),_0x54a6('0xd0'),'read'],'include':_0xf40f03}];_0x4c84d8[_0x54a6('0x34')]({'model':db[_0x54a6('0xd1')],'as':_0x54a6('0xd2'),'attributes':['id',_0x54a6('0x2b')]});_0x4c84d8[_0x54a6('0x34')]({'model':db[_0x54a6('0x6a')],'as':_0x54a6('0xd3'),'attributes':['id',_0x54a6('0x2f')]});return db['SmsInteraction']['find']({'where':{'id':_0x1e4735[_0x54a6('0xac')]['id']},'include':_0x4c84d8})[_0x54a6('0x27')](handleEntityNotFound(_0x57926a,null))[_0x54a6('0x27')](function(_0x2c83a3){if(_0x2c83a3){var _0x6bbf53=_0x2c83a3[_0x54a6('0xd4')]({'plain':!![]});fs[_0x54a6('0xd5')](_0x4c2bf6);var _0x554b96={'channel':_0x54a6('0xd6'),'account':_0x6bbf53[_0x54a6('0xd2')][_0x54a6('0x2b')],'agent':_0x6bbf53[_0x54a6('0xd3')]?_0x6bbf53[_0x54a6('0xd3')][_0x54a6('0x2f')]:_0x54a6('0xd7'),'createdAt':moment(_0x6bbf53[_0x54a6('0x72')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x54a6('0x95')](),'closedAt':_0x6bbf53[_0x54a6('0xd8')]?moment(_0x6bbf53[_0x54a6('0xd9')])['format'](_0x54a6('0xb9'))[_0x54a6('0x95')]():'','disposition':_0x6bbf53[_0x54a6('0xda')],'messages':_(_0x6bbf53['Messages'])[_0x54a6('0x7d')]({'secret':![]})['map'](function(_0x59f5eb){return{'date':moment(_0x59f5eb[_0x54a6('0x72')])['format'](_0x54a6('0xb9'))[_0x54a6('0x95')](),'sender':_0x59f5eb['direction']===_0x54a6('0xdb')?_0x59f5eb[_0x54a6('0x6a')]?_0x59f5eb[_0x54a6('0x6a')]['fullname']:_0x54a6('0xdc'):_0x59f5eb[_0x54a6('0x5e')][_0x54a6('0xcc')]+(_0x59f5eb[_0x54a6('0x5e')][_0x54a6('0xcd')]?'\x20'+_0x59f5eb[_0x54a6('0x5e')][_0x54a6('0xcd')]:''),'body':_0x59f5eb[_0x54a6('0x6d')],'direction':_0x59f5eb[_0x54a6('0xcf')]==='out'?'A':'C','secret':_0x59f5eb['secret'],'read':_0x59f5eb['read']};})[_0x54a6('0x5a')]()};return ejs[_0x54a6('0xdd')](path[_0x54a6('0xc4')](config[_0x54a6('0xc8')],'server',_0x54a6('0xde'),_0x54a6('0xdf')),{'interaction':_0x554b96})[_0x54a6('0x27')](function(_0x284842){var _0x4911f5=path[_0x54a6('0xc4')](_0x4c2bf6,_0x54a6('0xe0')+_0x6bbf53['id']+'-'+_0x2e982f+_0x54a6('0xe1'));var _0x1ce6f2={'path':_0x4911f5,'channel':_0x54a6('0xd6'),'interactionId':_0x6bbf53['id']};return pdf[_0x54a6('0xe2')](_0x284842,_0x1ce6f2);})['then'](function(){return new BPromise(function(_0x30dca6,_0x148392){zipdir(_0x4c2bf6,{'saveTo':_0x36a31c},function(_0x5e7a9b,_0x4c8589){if(_0x5e7a9b)return _0x148392(_0x5e7a9b);return _0x30dca6(_0x4c8589);});})[_0x54a6('0x27')](function(){return new BPromise(function(_0xed3e38,_0x2554e3){rimraf(_0x4c2bf6,function(_0x5b607b){if(_0x5b607b)_0x2554e3(_0x5b607b);return _0xed3e38();});});})[_0x54a6('0x27')](function(){return _0x57926a['download'](_0x36a31c,_0xbe33af,function(_0x44b067){if(_0x44b067){console['log'](_0x54a6('0xe3'),_0x44b067);}else{fs[_0x54a6('0xe4')](_0x36a31c);}});});});}else{return _0x57926a['sendStatus'](0xc8);}})['catch'](handleError(_0x57926a,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 09e6f29..be15bc7 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 _0x1775=['map','findAll','length','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x1968b4,_0x238e9e){var _0xc4d955=function(_0x3d2519){while(--_0x3d2519){_0x1968b4['push'](_0x1968b4['shift']());}};_0xc4d955(++_0x238e9e);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5177('0x0'))['db'][_0x5177('0x1')];var SmsMessage=require(_0x5177('0x0'))['db'][_0x5177('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5177('0x3')](0x0);var events={'afterCreate':_0x5177('0x4'),'afterUpdate':_0x5177('0x5'),'afterDestroy':_0x5177('0x6')};function emitEvent(_0x359401){return function(_0x51275f,_0x159a20,_0x2c5c42){_0x51275f[_0x5177('0x7')]({'attributes':['id'],'raw':!![]})[_0x5177('0x8')](function(_0x300b43){_0x51275f[_0x5177('0x9')](_0x5177('0xa'),_0x300b43[_0x5177('0xb')](function(_0x16e7a7){return{'id':_0x16e7a7['id']};}));return SmsMessage[_0x5177('0xc')]({'where':{'SmsInteractionId':_0x51275f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5177('0x8')](function(_0x206035){_0x51275f['setDataValue']('unreadMessages',_0x206035[_0x5177('0xd')]);SmsInteractionEvents[_0x5177('0xe')](_0x359401+':'+_0x51275f['id'],_0x51275f);SmsInteractionEvents[_0x5177('0xe')](_0x359401,_0x51275f);_0x2c5c42(null);})[_0x5177('0xf')](_0x2c5c42(null));};}for(var e in events){if(events[_0x5177('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5177('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x8603=['update','remove','getUsers','then','setDataValue','findAll','unreadMessages','emit','hasOwnProperty','hook','../../mysqldb','SmsInteraction','save'];(function(_0x351e95,_0x56ebbd){var _0x187444=function(_0x2476e9){while(--_0x2476e9){_0x351e95['push'](_0x351e95['shift']());}};_0x187444(++_0x56ebbd);}(_0x8603,0x190));var _0x3860=function(_0x42d42a,_0x518c7e){_0x42d42a=_0x42d42a-0x0;var _0x56bacf=_0x8603[_0x42d42a];return _0x56bacf;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x3860('0x0'))['db'][_0x3860('0x1')];var SmsMessage=require(_0x3860('0x0'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3860('0x2'),'afterUpdate':_0x3860('0x3'),'afterDestroy':_0x3860('0x4')};function emitEvent(_0x490262){return function(_0x2fc97a,_0x56f8c5,_0xb0fc24){_0x2fc97a[_0x3860('0x5')]({'attributes':['id'],'raw':!![]})[_0x3860('0x6')](function(_0xd3ce26){_0x2fc97a[_0x3860('0x7')]('Users',_0xd3ce26['map'](function(_0x5b1ac8){return{'id':_0x5b1ac8['id']};}));return SmsMessage[_0x3860('0x8')]({'where':{'SmsInteractionId':_0x2fc97a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3860('0x6')](function(_0x52c277){_0x2fc97a[_0x3860('0x7')](_0x3860('0x9'),_0x52c277['length']);SmsInteractionEvents[_0x3860('0xa')](_0x490262+':'+_0x2fc97a['id'],_0x2fc97a);SmsInteractionEvents[_0x3860('0xa')](_0x490262,_0x2fc97a);_0xb0fc24(null);})['catch'](_0xb0fc24(null));};}for(var e in events){if(events[_0x3860('0xb')](e)){var event=events[e];SmsInteraction[_0x3860('0xc')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index a310039..896ecd9 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 _0x793e=['SmsInteraction','sms_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','request-promise','path','exports','define'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x793e,0xf5));var _0xe793=function(_0x1d50a3,_0x3213ff){_0x1d50a3=_0x1d50a3-0x0;var _0x4d8902=_0x793e[_0x1d50a3];return _0x4d8902;};'use strict';var _=require('lodash');var util=require(_0xe793('0x0'));var logger=require(_0xe793('0x1'))('api');var moment=require(_0xe793('0x2'));var BPromise=require('bluebird');var rp=require(_0xe793('0x3'));var fs=require('fs');var path=require(_0xe793('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0xe793('0x5')]=function(_0x3ded6c,_0x188236){return _0x3ded6c[_0xe793('0x6')](_0xe793('0x7'),attributes,{'tableName':_0xe793('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc192fe,_0x168ca7,_0x58a3ab){if(_0xc192fe['changed'](_0xe793('0x9'))){_0xc192fe['closedAt']=moment()[_0xe793('0xa')](_0xe793('0xb'));}_0x58a3ab(null,_0xc192fe);}}});}; \ No newline at end of file +var _0x7376=['define','SmsInteraction','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports'];(function(_0x3e5904,_0x1f9a0f){var _0x53d109=function(_0x59a909){while(--_0x59a909){_0x3e5904['push'](_0x3e5904['shift']());}};_0x53d109(++_0x1f9a0f);}(_0x7376,0x122));var _0x6737=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x7376[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0x6737('0x0'));var util=require(_0x6737('0x1'));var logger=require(_0x6737('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6737('0x3'));var rp=require(_0x6737('0x4'));var fs=require('fs');var path=require(_0x6737('0x5'));var rimraf=require(_0x6737('0x6'));var config=require(_0x6737('0x7'));var attributes=require(_0x6737('0x8'));module[_0x6737('0x9')]=function(_0x386cb1,_0x3fe1e9){return _0x386cb1[_0x6737('0xa')](_0x6737('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x263c9d,_0x242f76,_0x54f557){if(_0x263c9d['changed'](_0x6737('0xc'))){_0x263c9d[_0x6737('0xd')]=moment()['format'](_0x6737('0xe'));}_0x54f557(null,_0x263c9d);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 59d77d4..2d5f065 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 _0x2a48=['error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','then','addTags','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','register','request','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4413cf,_0x3f70e8){var _0x9a1479=function(_0x5b4b2b){while(--_0x5b4b2b){_0x4413cf['push'](_0x4413cf['shift']());}};_0x9a1479(++_0x3f70e8);}(_0x2a48,0x65));var _0x82a4=function(_0x358232,_0x43d4b6){_0x358232=_0x358232-0x0;var _0x1700fd=_0x2a48[_0x358232];return _0x1700fd;};'use strict';var _=require('lodash');var util=require(_0x82a4('0x0'));var moment=require(_0x82a4('0x1'));var BPromise=require(_0x82a4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82a4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x82a4('0x4'))('rpc');var config=require(_0x82a4('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x82a4('0x6')]['http']({'port':0x232a});config['redis']=_[_0x82a4('0x7')](config[_0x82a4('0x8')],{'host':_0x82a4('0x9'),'port':0x18eb});var socket=require(_0x82a4('0xa'))(new Redis(config[_0x82a4('0x8')]));require('./smsInteraction.socket')[_0x82a4('0xb')](socket);function respondWithRpcPromise(_0x55d495,_0x1408b0,_0x5e0f20){return new BPromise(function(_0x57c96b,_0x285528){return client[_0x82a4('0xc')](_0x55d495,_0x5e0f20)['then'](function(_0x494e2b){logger[_0x82a4('0xd')](_0x82a4('0xe'),_0x1408b0,'request\x20sent');logger[_0x82a4('0xf')](_0x82a4('0x10'),_0x1408b0,_0x82a4('0x11'),JSON[_0x82a4('0x12')](_0x494e2b));if(_0x494e2b[_0x82a4('0x13')]){if(_0x494e2b[_0x82a4('0x13')][_0x82a4('0x14')]===0x1f4){logger[_0x82a4('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x1408b0,_0x494e2b[_0x82a4('0x13')][_0x82a4('0x15')]);return _0x285528(_0x494e2b[_0x82a4('0x13')][_0x82a4('0x15')]);}logger[_0x82a4('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x1408b0,_0x494e2b[_0x82a4('0x13')]['message']);return _0x57c96b(_0x494e2b[_0x82a4('0x13')][_0x82a4('0x15')]);}else{logger[_0x82a4('0xd')](_0x82a4('0xe'),_0x1408b0,'request\x20sent');_0x57c96b(_0x494e2b[_0x82a4('0x16')]['message']);}})[_0x82a4('0x17')](function(_0x31931a){logger[_0x82a4('0x13')](_0x82a4('0xe'),_0x1408b0,_0x31931a);_0x285528(_0x31931a);});});}exports[_0x82a4('0x18')]=function(_0xacfc6e){var _0x42b8eb=this;return new Promise(function(_0x1fe989,_0x46f45e){return db[_0x82a4('0x19')]['update'](_0xacfc6e[_0x82a4('0x1a')],{'raw':_0xacfc6e[_0x82a4('0x1b')]?_0xacfc6e['options'][_0x82a4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xacfc6e[_0x82a4('0x1b')]?_0xacfc6e[_0x82a4('0x1b')][_0x82a4('0x1d')]||null:null,'attributes':_0xacfc6e[_0x82a4('0x1b')]?_0xacfc6e[_0x82a4('0x1b')][_0x82a4('0x1e')]||null:null,'limit':_0xacfc6e[_0x82a4('0x1b')]?_0xacfc6e[_0x82a4('0x1b')][_0x82a4('0x1f')]||null:null})['then'](function(_0x4d0dc9){logger[_0x82a4('0xd')](_0x82a4('0x18'),_0xacfc6e);logger['debug']('UpdateSmsInteraction',_0xacfc6e,JSON[_0x82a4('0x12')](_0x4d0dc9));_0x1fe989(_0x4d0dc9);})[_0x82a4('0x17')](function(_0x2d25b4){logger[_0x82a4('0x13')](_0x82a4('0x18'),_0x2d25b4[_0x82a4('0x15')],_0xacfc6e);_0x46f45e(_0x42b8eb[_0x82a4('0x13')](0x1f4,_0x2d25b4[_0x82a4('0x15')]));});});};exports[_0x82a4('0x20')]=function(_0x5f46ce){return new Promise(function(_0x545d52,_0x10c4f4){return db[_0x82a4('0x19')][_0x82a4('0x21')]({'where':_0x5f46ce['options']?_0x5f46ce[_0x82a4('0x1b')][_0x82a4('0x1d')]||null:null})[_0x82a4('0x22')](function(_0x49c976){if(_0x49c976){return _0x49c976[_0x82a4('0x23')](_0x5f46ce[_0x82a4('0x1a')][_0x82a4('0x24')],_[_0x82a4('0x25')](_0x5f46ce[_0x82a4('0x1a')],['ids','id'])||{});}})[_0x82a4('0x26')](function(_0x385ae3){logger[_0x82a4('0xd')](_0x82a4('0x27'),_0x5f46ce);logger[_0x82a4('0xf')]('AddTags',_0x5f46ce,JSON[_0x82a4('0x12')](_0x385ae3));_0x545d52(_0x385ae3);})[_0x82a4('0x17')](function(_0x175282){logger['error'](_0x82a4('0x27'),_0x175282[_0x82a4('0x15')],_0x5f46ce);_0x10c4f4(_this[_0x82a4('0x13')](0x1f4,_0x175282[_0x82a4('0x15')]));});});}; \ No newline at end of file +var _0x1dd6=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','attributes','limit','AddTagsToSmsInteraction','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird'];(function(_0x146bef,_0x5b2ef3){var _0x56c371=function(_0x29c7f8){while(--_0x29c7f8){_0x146bef['push'](_0x146bef['shift']());}};_0x56c371(++_0x5b2ef3);}(_0x1dd6,0xb5));var _0x61dd=function(_0x49e0d4,_0x1b7d6c){_0x49e0d4=_0x49e0d4-0x0;var _0x4fe3a0=_0x1dd6[_0x49e0d4];return _0x4fe3a0;};'use strict';var _=require(_0x61dd('0x0'));var util=require(_0x61dd('0x1'));var moment=require(_0x61dd('0x2'));var BPromise=require(_0x61dd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61dd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x61dd('0x5'));var logger=require('../../config/logger')(_0x61dd('0x6'));var config=require(_0x61dd('0x7'));var jayson=require(_0x61dd('0x8'));var client=jayson[_0x61dd('0x9')]['http']({'port':0x232a});config[_0x61dd('0xa')]=_['defaults'](config[_0x61dd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x61dd('0xb'))(new Redis(config[_0x61dd('0xa')]));require('./smsInteraction.socket')[_0x61dd('0xc')](socket);function respondWithRpcPromise(_0x43cd9b,_0xe67a5d,_0x4fa666){return new BPromise(function(_0x247fe3,_0x2e0407){return client[_0x61dd('0xd')](_0x43cd9b,_0x4fa666)[_0x61dd('0xe')](function(_0x300eb1){logger['info'](_0x61dd('0xf'),_0xe67a5d,_0x61dd('0x10'));logger[_0x61dd('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0xe67a5d,_0x61dd('0x10'),JSON[_0x61dd('0x12')](_0x300eb1));if(_0x300eb1[_0x61dd('0x13')]){if(_0x300eb1[_0x61dd('0x13')][_0x61dd('0x14')]===0x1f4){logger[_0x61dd('0x13')](_0x61dd('0xf'),_0xe67a5d,_0x300eb1[_0x61dd('0x13')][_0x61dd('0x15')]);return _0x2e0407(_0x300eb1['error']['message']);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0xe67a5d,_0x300eb1[_0x61dd('0x13')][_0x61dd('0x15')]);return _0x247fe3(_0x300eb1[_0x61dd('0x13')]['message']);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0xe67a5d,'request\x20sent');_0x247fe3(_0x300eb1[_0x61dd('0x16')][_0x61dd('0x15')]);}})[_0x61dd('0x17')](function(_0x4a9d82){logger[_0x61dd('0x13')](_0x61dd('0xf'),_0xe67a5d,_0x4a9d82);_0x2e0407(_0x4a9d82);});});}exports[_0x61dd('0x18')]=function(_0x30b4c7){var _0x473c9b=this;return new Promise(function(_0x25de87,_0x24e5e5){return db[_0x61dd('0x19')][_0x61dd('0x1a')](_0x30b4c7['body'],{'raw':_0x30b4c7[_0x61dd('0x1b')]?_0x30b4c7['options'][_0x61dd('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30b4c7['options']?_0x30b4c7[_0x61dd('0x1b')]['where']||null:null,'attributes':_0x30b4c7[_0x61dd('0x1b')]?_0x30b4c7[_0x61dd('0x1b')][_0x61dd('0x1d')]||null:null,'limit':_0x30b4c7['options']?_0x30b4c7['options'][_0x61dd('0x1e')]||null:null})[_0x61dd('0xe')](function(_0x4f13c8){logger['info'](_0x61dd('0x18'),_0x30b4c7);logger[_0x61dd('0x11')](_0x61dd('0x18'),_0x30b4c7,JSON[_0x61dd('0x12')](_0x4f13c8));_0x25de87(_0x4f13c8);})[_0x61dd('0x17')](function(_0x4ccdac){logger[_0x61dd('0x13')](_0x61dd('0x18'),_0x4ccdac[_0x61dd('0x15')],_0x30b4c7);_0x24e5e5(_0x473c9b['error'](0x1f4,_0x4ccdac[_0x61dd('0x15')]));});});};exports[_0x61dd('0x1f')]=function(_0x35d38d){return new Promise(function(_0x29beec,_0x2d17d3){return db[_0x61dd('0x19')]['find']({'where':_0x35d38d[_0x61dd('0x1b')]?_0x35d38d[_0x61dd('0x1b')]['where']||null:null})[_0x61dd('0xe')](function(_0x3bfefb){if(_0x3bfefb){return _0x3bfefb[_0x61dd('0x20')](_0x35d38d[_0x61dd('0x21')][_0x61dd('0x22')],_['omit'](_0x35d38d[_0x61dd('0x21')],[_0x61dd('0x22'),'id'])||{});}})[_0x61dd('0x23')](function(_0x47b594){logger['info'](_0x61dd('0x24'),_0x35d38d);logger[_0x61dd('0x11')](_0x61dd('0x24'),_0x35d38d,JSON['stringify'](_0x47b594));_0x29beec(_0x47b594);})[_0x61dd('0x17')](function(_0x56b110){logger[_0x61dd('0x13')](_0x61dd('0x24'),_0x56b110[_0x61dd('0x15')],_0x35d38d);_0x2d17d3(_this[_0x61dd('0x13')](0x1f4,_0x56b110[_0x61dd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 8164bce..8cca106 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 _0xb63a=['register','length','smsInteraction:','save','update','emit','removeListener'];(function(_0x505082,_0x3d5d45){var _0x5a0954=function(_0xe222e7){while(--_0xe222e7){_0x505082['push'](_0x505082['shift']());}};_0x5a0954(++_0x3d5d45);}(_0xb63a,0x1e6));var _0xab63=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xb63a[_0x3740fe];return _0x55492b;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xab63('0x0'),'remove',_0xab63('0x1')];function createListener(_0x4c91e1,_0x5d273b){return function(_0x4c494c){_0x5d273b[_0xab63('0x2')](_0x4c91e1,_0x4c494c);};}function removeListener(_0x56d845,_0x59aa0c){return function(){SmsInteractionEvents[_0xab63('0x3')](_0x56d845,_0x59aa0c);};}exports[_0xab63('0x4')]=function(_0x3d7343){for(var _0x3a8f77=0x0,_0x3438d6=events[_0xab63('0x5')];_0x3a8f77<_0x3438d6;_0x3a8f77++){var _0x4a267f=events[_0x3a8f77];var _0x4225e5=createListener(_0xab63('0x6')+_0x4a267f,_0x3d7343);SmsInteractionEvents['on'](_0x4a267f,_0x4225e5);}}; \ No newline at end of file +var _0xd239=['./smsInteraction.events','save','remove','update','emit','removeListener','smsInteraction:'];(function(_0x3d5ad4,_0x550f14){var _0x542183=function(_0x416c18){while(--_0x416c18){_0x3d5ad4['push'](_0x3d5ad4['shift']());}};_0x542183(++_0x550f14);}(_0xd239,0x1c0));var _0x9d23=function(_0x112534,_0xdff29){_0x112534=_0x112534-0x0;var _0x5b07da=_0xd239[_0x112534];return _0x5b07da;};'use strict';var SmsInteractionEvents=require(_0x9d23('0x0'));var events=[_0x9d23('0x1'),_0x9d23('0x2'),_0x9d23('0x3')];function createListener(_0x1fd5a5,_0xdf1934){return function(_0x10edd8){_0xdf1934[_0x9d23('0x4')](_0x1fd5a5,_0x10edd8);};}function removeListener(_0x1ac43c,_0x2da0e0){return function(){SmsInteractionEvents[_0x9d23('0x5')](_0x1ac43c,_0x2da0e0);};}exports['register']=function(_0x398deb){for(var _0x39527f=0x0,_0x1f065a=events['length'];_0x39527f<_0x1f065a;_0x39527f++){var _0x48fc9a=events[_0x39527f];var _0x49bb85=createListener(_0x9d23('0x6')+_0x48fc9a,_0x398deb);SmsInteractionEvents['on'](_0x48fc9a,_0x49bb85);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 7644f83..8b045a3 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 _0x9c1d=['/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','sms','smsmessage:create','/:id/status','status','/:id','update','put','/:id/accept','accept'];(function(_0x1256b8,_0x1bba73){var _0x52bc82=function(_0x145fc0){while(--_0x145fc0){_0x1256b8['push'](_0x1256b8['shift']());}};_0x52bc82(++_0x1bba73);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x25b679,_0x2b28dd){_0x25b679=_0x25b679-0x0;var _0x278b46=_0x9c1d[_0x25b679];return _0x278b46;};'use strict';var multer=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var path=require(_0xd9c1('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9c1('0x3'));var router=express[_0xd9c1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd9c1('0x5'));var interaction=require(_0xd9c1('0x6'));var config=require('../../config/environment');var controller=require(_0xd9c1('0x7'));router[_0xd9c1('0x8')]('/',auth[_0xd9c1('0x9')](),controller[_0xd9c1('0xa')]);router[_0xd9c1('0x8')](_0xd9c1('0xb'),auth[_0xd9c1('0x9')](),controller[_0xd9c1('0xc')]);router[_0xd9c1('0x8')]('/:id',auth[_0xd9c1('0x9')](),controller[_0xd9c1('0xd')]);router[_0xd9c1('0xe')]('/',auth[_0xd9c1('0x9')](),interaction[_0xd9c1('0xf')](_0xd9c1('0x10'),_0xd9c1('0x11')),controller['create']);router[_0xd9c1('0xe')](_0xd9c1('0x12'),controller[_0xd9c1('0x13')]);router['put'](_0xd9c1('0x14'),auth['isAuthenticated'](),controller[_0xd9c1('0x15')]);router[_0xd9c1('0x16')](_0xd9c1('0x17'),auth[_0xd9c1('0x9')](),controller[_0xd9c1('0x18')]);router[_0xd9c1('0x16')](_0xd9c1('0x19'),auth[_0xd9c1('0x9')](),controller[_0xd9c1('0x1a')]);router[_0xd9c1('0x1b')](_0xd9c1('0x14'),auth[_0xd9c1('0x9')](),controller[_0xd9c1('0x1c')]);module[_0xd9c1('0x1d')]=router; \ No newline at end of file +var _0x63f4=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','post','tracked','smsmessage:create','/:id/status','status','put','update','/:id/accept','reject','delete','/:id','destroy','multer','util','path','Router'];(function(_0xc0638b,_0x2fccf4){var _0xd57dfa=function(_0x322fba){while(--_0x322fba){_0xc0638b['push'](_0xc0638b['shift']());}};_0xd57dfa(++_0x2fccf4);}(_0x63f4,0xcb));var _0x463f=function(_0x57fd5c,_0x3f47fe){_0x57fd5c=_0x57fd5c-0x0;var _0x1b5630=_0x63f4[_0x57fd5c];return _0x1b5630;};'use strict';var multer=require(_0x463f('0x0'));var util=require(_0x463f('0x1'));var path=require(_0x463f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x463f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x463f('0x4'));var interaction=require(_0x463f('0x5'));var config=require(_0x463f('0x6'));var controller=require('./smsMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x463f('0x7')](_0x463f('0x8'),auth[_0x463f('0x9')](),controller[_0x463f('0xa')]);router[_0x463f('0x7')]('/:id',auth[_0x463f('0x9')](),controller['show']);router[_0x463f('0xb')]('/',auth[_0x463f('0x9')](),interaction[_0x463f('0xc')]('sms',_0x463f('0xd')),controller['create']);router[_0x463f('0xb')](_0x463f('0xe'),controller[_0x463f('0xf')]);router[_0x463f('0x10')]('/:id',auth[_0x463f('0x9')](),controller[_0x463f('0x11')]);router['put'](_0x463f('0x12'),auth[_0x463f('0x9')](),controller['accept']);router[_0x463f('0x10')]('/:id/reject',auth[_0x463f('0x9')](),controller[_0x463f('0x13')]);router[_0x463f('0x14')](_0x463f('0x15'),auth['isAuthenticated'](),controller[_0x463f('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index d702ce7..4311b95 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 _0x68b8=['out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium','ENUM'];(function(_0x5286af,_0x121fd1){var _0x15b0bf=function(_0x19dcff){while(--_0x19dcff){_0x5286af['push'](_0x5286af['shift']());}};_0x15b0bf(++_0x121fd1);}(_0x68b8,0x1d8));var _0x868b=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0x68b8[_0x33154d];return _0x3b2f03;};'use strict';var Sequelize=require(_0x868b('0x0'));module[_0x868b('0x1')]={'body':{'type':Sequelize[_0x868b('0x2')](_0x868b('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x868b('0x4')]('in',_0x868b('0x5')),'defaultValue':_0x868b('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x868b('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x868b('0x7')]},'secret':{'type':Sequelize[_0x868b('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x868b('0x2')]}}; \ No newline at end of file +var _0x8994=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT'];(function(_0x5b71a7,_0x3340af){var _0x40033a=function(_0x13cbd9){while(--_0x13cbd9){_0x5b71a7['push'](_0x5b71a7['shift']());}};_0x40033a(++_0x3340af);}(_0x8994,0xe6));var _0x4899=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x8994[_0x2aa0e7];return _0x1472c0;};'use strict';var Sequelize=require(_0x4899('0x0'));module['exports']={'body':{'type':Sequelize[_0x4899('0x1')](_0x4899('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4899('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4899('0x4')]('in',_0x4899('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x4899('0x6')](0xbe)},'phone':{'type':Sequelize[_0x4899('0x6')]},'readAt':{'type':Sequelize[_0x4899('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4899('0x6')]},'providerResponse':{'type':Sequelize[_0x4899('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index b35ca1c..fae4cbe 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 _0x5943=['pick','merge','VIRTUAL','filter','options','includeAll','rows','show','params','intersection','include','body','find','sms-interactions','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','isNil','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','accept','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','EventManager','rejectmessage','SmsAccount','SmsAccountId','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','inspect','infobip','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','sort','where','filters'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x5943,0x1f2));var _0x3594=function(_0xab0d25,_0xb3e62c){_0xab0d25=_0xab0d25-0x0;var _0x296ed2=_0x5943[_0xab0d25];return _0x296ed2;};'use strict';var emlformat=require(_0x3594('0x0'));var rimraf=require(_0x3594('0x1'));var zipdir=require(_0x3594('0x2'));var jsonpatch=require(_0x3594('0x3'));var rp=require(_0x3594('0x4'));var moment=require(_0x3594('0x5'));var BPromise=require(_0x3594('0x6'));var Mustache=require(_0x3594('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3594('0x8'));var csv=require('to-csv');var ejs=require(_0x3594('0x9'));var fs=require('fs');var fs_extra=require(_0x3594('0xa'));var _=require(_0x3594('0xb'));var squel=require(_0x3594('0xc'));var crypto=require(_0x3594('0xd'));var jsforce=require(_0x3594('0xe'));var deskjs=require(_0x3594('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3594('0x10'));var authService=require(_0x3594('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3594('0x12'));var hardwareService=require(_0x3594('0x13'));var logger=require(_0x3594('0x14'))(_0x3594('0x15'));var utils=require(_0x3594('0x16'));var config=require(_0x3594('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3594('0x18'))['db'];config[_0x3594('0x19')]=_[_0x3594('0x1a')](config[_0x3594('0x19')],{'host':_0x3594('0x1b'),'port':0x18eb});var socket=require(_0x3594('0x1c'))(new Redis(config[_0x3594('0x19')]));require('./smsMessage.socket')[_0x3594('0x1d')](socket);var jayson=require(_0x3594('0x1e'));var client=jayson[_0x3594('0x1f')][_0x3594('0x20')]({'port':0x232c});var client9002=jayson[_0x3594('0x1f')][_0x3594('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x425115,_0x531835,_0x1929fa,_0x2211dc){return new BPromise(function(_0x1605b3,_0x1f78eb){var _0x5eb6de=_0x2211dc||client;return _0x5eb6de[_0x3594('0x21')](_0x425115,_0x1929fa)[_0x3594('0x22')](function(_0x5720fe){logger[_0x3594('0x23')](_0x3594('0x24'),_0x531835,_0x3594('0x25'));logger[_0x3594('0x26')](_0x3594('0x27'),_0x531835,'request\x20sent',JSON[_0x3594('0x28')](_0x5720fe));if(_0x5720fe['error']){if(_0x5720fe['error'][_0x3594('0x29')]===0x1f4){logger[_0x3594('0x2a')](_0x3594('0x24'),_0x531835,_0x5720fe['error'][_0x3594('0x2b')]);return _0x1f78eb(_0x5720fe[_0x3594('0x2a')][_0x3594('0x2b')]);}logger[_0x3594('0x2a')](_0x3594('0x24'),_0x531835,_0x5720fe[_0x3594('0x2a')]['message']);return _0x1605b3(_0x5720fe['error'][_0x3594('0x2b')]);}else{logger[_0x3594('0x23')](_0x3594('0x24'),_0x531835,_0x3594('0x25'));_0x1605b3(_0x5720fe['result'][_0x3594('0x2b')]);}})[_0x3594('0x2c')](function(_0x4ce52b){logger['error'](_0x3594('0x24'),_0x531835,_0x4ce52b);_0x1f78eb(_0x4ce52b);});});}function respondWithStatusCode(_0x4b0f2b,_0x29e8ff){_0x29e8ff=_0x29e8ff||0xcc;return function(_0x53008d){if(_0x53008d){return _0x4b0f2b[_0x3594('0x2d')](_0x29e8ff);}return _0x4b0f2b['status'](_0x29e8ff)[_0x3594('0x2e')]();};}function respondWithResult(_0x393453,_0xefcc61){_0xefcc61=_0xefcc61||0xc8;return function(_0x3996a0){if(_0x3996a0){return _0x393453[_0x3594('0x2f')](_0xefcc61)[_0x3594('0x30')](_0x3996a0);}};}function respondWithFilteredResult(_0x15f446,_0x4a4f56){return function(_0x123d41){if(_0x123d41){var _0x3bc7d5=typeof _0x4a4f56['offset']===_0x3594('0x31')&&typeof _0x4a4f56[_0x3594('0x32')]===_0x3594('0x31');var _0x5921a6=_0x123d41[_0x3594('0x33')];var _0x24b56a=_0x3bc7d5?0x0:_0x4a4f56[_0x3594('0x34')];var _0x194554=_0x3bc7d5?_0x123d41[_0x3594('0x33')]:_0x4a4f56['offset']+_0x4a4f56[_0x3594('0x32')];var _0x2c90a0;if(_0x194554>=_0x5921a6){_0x194554=_0x5921a6;_0x2c90a0=0xc8;}else{_0x2c90a0=0xce;}_0x15f446['status'](_0x2c90a0);return _0x15f446[_0x3594('0x35')](_0x3594('0x36'),_0x24b56a+'-'+_0x194554+'/'+_0x5921a6)[_0x3594('0x30')](_0x123d41);}return null;};}function patchUpdates(_0x4141e4){return function(_0x1e814f){try{jsonpatch['apply'](_0x1e814f,_0x4141e4,!![]);}catch(_0x3f3f66){return BPromise[_0x3594('0x37')](_0x3f3f66);}return _0x1e814f[_0x3594('0x38')]();};}function saveUpdates(_0x30cade,_0x58aa03){return function(_0x1b4695){if(_0x1b4695){return _0x1b4695[_0x3594('0x39')](_0x30cade)['then'](function(_0x35912e){return _0x35912e;});}return null;};}function removeEntity(_0x523714,_0x31b34d){return function(_0x6de4b7){if(_0x6de4b7){return _0x6de4b7[_0x3594('0x3a')]()['then'](function(){_0x523714[_0x3594('0x2f')](0xcc)[_0x3594('0x2e')]();});}};}function handleEntityNotFound(_0x71ce09,_0x1d8a81){return function(_0x341d47){if(!_0x341d47){_0x71ce09[_0x3594('0x2d')](0x194);}return _0x341d47;};}function handleError(_0xa6b531,_0x4fa828){_0x4fa828=_0x4fa828||0x1f4;return function(_0x11eb47){logger[_0x3594('0x2a')](_0x11eb47['stack']);if(_0x11eb47[_0x3594('0x3b')]){delete _0x11eb47[_0x3594('0x3b')];}_0xa6b531[_0x3594('0x2f')](_0x4fa828)[_0x3594('0x3c')](_0x11eb47);};}exports[_0x3594('0x3d')]=function(_0x3b2c27,_0x4f1e9d){var _0x367f3b={},_0x12cc8f={},_0x4c0cf4={'count':0x0,'rows':[]};var _0x1dbe89=_[_0x3594('0x3e')](db[_0x3594('0x3f')][_0x3594('0x40')],function(_0x2bb025){return{'name':_0x2bb025[_0x3594('0x41')],'type':_0x2bb025[_0x3594('0x42')][_0x3594('0x43')]};});_0x12cc8f[_0x3594('0x44')]=_[_0x3594('0x3e')](_0x1dbe89,_0x3594('0x3b'));_0x12cc8f[_0x3594('0x45')]=_[_0x3594('0x46')](_0x3b2c27[_0x3594('0x45')]);_0x12cc8f['filters']=_['intersection'](_0x12cc8f[_0x3594('0x44')],_0x12cc8f[_0x3594('0x45')]);_0x367f3b[_0x3594('0x47')]=_['intersection'](_0x12cc8f[_0x3594('0x44')],qs['fields'](_0x3b2c27[_0x3594('0x45')][_0x3594('0x48')]));_0x367f3b[_0x3594('0x47')]=_0x367f3b['attributes'][_0x3594('0x49')]?_0x367f3b[_0x3594('0x47')]:_0x12cc8f['model'];if(!_0x3b2c27[_0x3594('0x45')][_0x3594('0x4a')]('nolimit')){_0x367f3b[_0x3594('0x32')]=qs[_0x3594('0x32')](_0x3b2c27['query']['limit']);_0x367f3b['offset']=qs['offset'](_0x3b2c27[_0x3594('0x45')][_0x3594('0x34')]);}_0x367f3b['order']=qs['sort'](_0x3b2c27[_0x3594('0x45')][_0x3594('0x4b')]);_0x367f3b[_0x3594('0x4c')]=qs[_0x3594('0x4d')](_[_0x3594('0x4e')](_0x3b2c27[_0x3594('0x45')],_0x12cc8f[_0x3594('0x4d')]),_0x1dbe89);if(_0x3b2c27[_0x3594('0x45')]['filter']){_0x367f3b['where']=_[_0x3594('0x4f')](_0x367f3b[_0x3594('0x4c')],{'$or':_[_0x3594('0x3e')](_0x1dbe89,function(_0x53f6e0){if(_0x53f6e0[_0x3594('0x42')]!==_0x3594('0x50')){var _0x382cc7={};_0x382cc7[_0x53f6e0['name']]={'$like':'%'+_0x3b2c27[_0x3594('0x45')][_0x3594('0x51')]+'%'};return _0x382cc7;}})});}_0x367f3b=_[_0x3594('0x4f')]({},_0x367f3b,_0x3b2c27[_0x3594('0x52')]);var _0x352178={'where':_0x367f3b[_0x3594('0x4c')]};return db[_0x3594('0x3f')][_0x3594('0x33')](_0x352178)['then'](function(_0x2bb16e){_0x4c0cf4['count']=_0x2bb16e;if(_0x3b2c27['query'][_0x3594('0x53')]){_0x367f3b['include']=[{'all':!![]}];}return db[_0x3594('0x3f')]['findAll'](_0x367f3b);})[_0x3594('0x22')](function(_0x8a5e6){_0x4c0cf4[_0x3594('0x54')]=_0x8a5e6;return _0x4c0cf4;})['then'](respondWithFilteredResult(_0x4f1e9d,_0x367f3b))['catch'](handleError(_0x4f1e9d,null));};exports[_0x3594('0x55')]=function(_0x3b8935,_0x41d26c){var _0x51ce4c={'raw':!![],'where':{'id':_0x3b8935[_0x3594('0x56')]['id']}},_0xece52b={};_0xece52b[_0x3594('0x44')]=_['keys'](db[_0x3594('0x3f')]['rawAttributes']);_0xece52b[_0x3594('0x45')]=_['keys'](_0x3b8935[_0x3594('0x45')]);_0xece52b[_0x3594('0x4d')]=_[_0x3594('0x57')](_0xece52b['model'],_0xece52b[_0x3594('0x45')]);_0x51ce4c[_0x3594('0x47')]=_['intersection'](_0xece52b[_0x3594('0x44')],qs['fields'](_0x3b8935[_0x3594('0x45')][_0x3594('0x48')]));_0x51ce4c[_0x3594('0x47')]=_0x51ce4c[_0x3594('0x47')][_0x3594('0x49')]?_0x51ce4c[_0x3594('0x47')]:_0xece52b[_0x3594('0x44')];if(_0x3b8935[_0x3594('0x45')][_0x3594('0x53')]){_0x51ce4c[_0x3594('0x58')]=[{'all':!![]}];}_0x51ce4c=_['merge']({},_0x51ce4c,_0x3b8935['options']);return db[_0x3594('0x3f')]['find'](_0x51ce4c)[_0x3594('0x22')](handleEntityNotFound(_0x41d26c,null))[_0x3594('0x22')](respondWithResult(_0x41d26c,null))[_0x3594('0x2c')](handleError(_0x41d26c,null));};exports['create']=function(_0x330608,_0x26702c){return db[_0x3594('0x3f')]['create'](_0x330608['body'],{})[_0x3594('0x22')](respondWithResult(_0x26702c,0xc9))[_0x3594('0x2c')](handleError(_0x26702c,null));};exports[_0x3594('0x39')]=function(_0x704405,_0xf0c615){if(_0x704405[_0x3594('0x59')]['id']){delete _0x704405[_0x3594('0x59')]['id'];}return db[_0x3594('0x3f')]['find']({'where':{'id':_0x704405['params']['id']}})[_0x3594('0x22')](handleEntityNotFound(_0xf0c615,null))['then'](saveUpdates(_0x704405[_0x3594('0x59')],null))[_0x3594('0x22')](respondWithResult(_0xf0c615,null))[_0x3594('0x2c')](handleError(_0xf0c615,null));};exports[_0x3594('0x3a')]=function(_0x50c9ca,_0x5c5f0a){return db[_0x3594('0x3f')][_0x3594('0x5a')]({'where':{'id':_0x50c9ca[_0x3594('0x56')]['id']}})['then'](handleEntityNotFound(_0x5c5f0a,null))[_0x3594('0x22')](removeEntity(_0x5c5f0a,null))[_0x3594('0x2c')](handleError(_0x5c5f0a,null));};exports['describe']=function(_0x54e496,_0x4291bd){return db[_0x3594('0x3f')]['describe']()[_0x3594('0x22')](respondWithResult(_0x4291bd,null))[_0x3594('0x2c')](handleError(_0x4291bd,null));};var interaction_log=require('../../config/logger')(_0x3594('0x5b'));exports['accept']=function(_0x3a90f6,_0x4545fb,_0x534e57){var _0x57fdfb={'agent':{},'channel':_0x3594('0x5c')};if(_0x3a90f6[_0x3594('0x59')]['id']){delete _0x3a90f6['body']['id'];}_0x3a90f6[_0x3594('0x59')]['read']=!![];_0x3a90f6['body'][_0x3594('0x5d')]=moment()[_0x3594('0x5e')](_0x3594('0x5f'));_0x3a90f6['body'][_0x3594('0x60')]=_0x3a90f6[_0x3594('0x59')][_0x3594('0x60')]||_0x3a90f6['user']['id'];_0x57fdfb['agent']['id']=_0x3a90f6[_0x3594('0x59')][_0x3594('0x60')];return db['SmsMessage'][_0x3594('0x5a')]({'where':{'id':_0x3a90f6[_0x3594('0x56')]['id'],'UserId':null}})[_0x3594('0x22')](handleEntityNotFound(_0x4545fb,null))[_0x3594('0x22')](saveUpdates(_0x3a90f6[_0x3594('0x59')],null))[_0x3594('0x22')](function(_0x45cdc0){if(_0x45cdc0){_0x57fdfb['message']=_0x45cdc0['get']({'plain':!![]});return db['SmsInteraction'][_0x3594('0x5a')]({'where':{'id':_0x45cdc0['SmsInteractionId']}});}return null;})[_0x3594('0x22')](handleEntityNotFound(_0x4545fb,null))[_0x3594('0x22')](function(_0x1b26b6){if(_0x1b26b6){return _0x1b26b6[_0x3594('0x39')]({'UserId':_0x3a90f6[_0x3594('0x59')][_0x3594('0x60')],'read1stAt':_[_0x3594('0x61')](_0x1b26b6['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4720bc){if(_0x4720bc){_0x57fdfb[_0x3594('0x62')]=_0x4720bc[_0x3594('0x63')]({'plain':!![]});interaction_log[_0x3594('0x23')](_0x3594('0x64'),_0x3a90f6[_0x3594('0x65')]['id'],_0x3a90f6[_0x3594('0x65')][_0x3594('0x3b')],_0x3a90f6[_0x3594('0x65')][_0x3594('0x66')],_0x57fdfb['interaction']['id'],_0x3a90f6[_0x3594('0x59')]?JSON['stringify'](_0x3a90f6[_0x3594('0x59')]):'null');return respondWithRpcPromise(_0x3594('0x67'),_0x3594('0x68'),_0x57fdfb);}return null;})[_0x3594('0x22')](function(_0x486a4b){var _0xc20c24=_0x3594('0x69')+_0x486a4b['message'][_0x3594('0x6a')];return db[_0x3594('0x6b')][_0x3594('0x45')](_0xc20c24,{'type':db[_0x3594('0x6c')][_0x3594('0x6d')][_0x3594('0x6e')],'raw':!![]})[_0x3594('0x22')](function(_0x5f5159){return _0x5f5159;});})[_0x3594('0x22')](function(_0x4ce80b){if(_0x4ce80b){_0x57fdfb['message'][_0x3594('0x6f')]=_0x4ce80b[0x0];if(!_0x3a90f6[_0x3594('0x59')][_0x3594('0x60')])return;return db[_0x3594('0x70')]['find']({'where':{'id':_0x3a90f6[_0x3594('0x59')][_0x3594('0x60')],'role':_0x3594('0x71')},'attributes':['id','name',_0x3594('0x72'),_0x3594('0x73'),'internal'],'raw':!![]});}return null;})[_0x3594('0x22')](function(_0x2c9735){if(!_0x2c9735)return null;_0x57fdfb[_0x3594('0x2b')][_0x3594('0x71')]=_0x2c9735;return _0x57fdfb;})[_0x3594('0x22')](function(_0x13e47b){if(_0x13e47b){if(_0x3a90f6[_0x3594('0x59')][_0x3594('0x74')]){_0x57fdfb[_0x3594('0x2b')][_0x3594('0x75')]=util['format'](_0x3594('0x76'),_0x3a90f6['user'][_0x3594('0x3b')]);_0x57fdfb[_0x3594('0x2b')][_0x3594('0x77')]=_0x57fdfb['channel'];_0x57fdfb[_0x3594('0x2b')][_0x3594('0x78')]=_0x57fdfb[_0x3594('0x77')];_0x57fdfb['message']['event']=_0x3594('0x79');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x57fdfb[_0x3594('0x2b')]},client9002)['then'](function(){return _0x57fdfb;});}return _0x57fdfb;}return null;})[_0x3594('0x22')](respondWithResult(_0x4545fb,null))[_0x3594('0x2c')](handleError(_0x4545fb,null));};var interaction_log=require('../../config/logger')(_0x3594('0x5b'));exports[_0x3594('0x37')]=function(_0x542458,_0x1c21f5,_0x1dcbbe){var _0x2dffba={'agent':{},'channel':_0x3594('0x5c')};if(_0x542458[_0x3594('0x59')]['id']){delete _0x542458[_0x3594('0x59')]['id'];}_0x542458[_0x3594('0x59')][_0x3594('0x60')]=_0x542458[_0x3594('0x59')][_0x3594('0x60')]||_0x542458[_0x3594('0x65')]['id'];_0x2dffba[_0x3594('0x71')]['id']=_0x542458[_0x3594('0x59')][_0x3594('0x60')];return db[_0x3594('0x3f')][_0x3594('0x5a')]({'where':{'id':_0x542458[_0x3594('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1c21f5,null))[_0x3594('0x22')](function(_0x20714b){if(_0x20714b){_0x2dffba['message']=_0x20714b[_0x3594('0x63')]({'plain':!![]});return db[_0x3594('0x7a')][_0x3594('0x5a')]({'where':{'id':_0x20714b['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1c21f5,null))[_0x3594('0x22')](function(_0x1eb718){if(_0x1eb718){_0x2dffba[_0x3594('0x62')]=_0x1eb718[_0x3594('0x63')]({'plain':!![]});interaction_log[_0x3594('0x23')](_0x3594('0x7b'),_0x542458[_0x3594('0x65')]['id'],_0x542458[_0x3594('0x65')][_0x3594('0x3b')],_0x542458[_0x3594('0x65')][_0x3594('0x66')],_0x2dffba[_0x3594('0x62')]['id'],_0x542458[_0x3594('0x59')]?JSON[_0x3594('0x28')](_0x542458[_0x3594('0x59')]):'null');return respondWithRpcPromise(_0x3594('0x7c'),_0x3594('0x7d'),_0x2dffba);}return null;})['then'](function(_0xf59141){var _0x5b1e03=_0x3594('0x69')+_0xf59141[_0x3594('0x2b')][_0x3594('0x6a')];return db[_0x3594('0x6b')][_0x3594('0x45')](_0x5b1e03,{'type':db[_0x3594('0x6c')]['QueryTypes'][_0x3594('0x6e')],'raw':!![]})[_0x3594('0x22')](function(_0x66446c){return _0x66446c;});})['then'](function(_0x47607d){if(_0x47607d){_0x2dffba[_0x3594('0x2b')]['contact']=_0x47607d[0x0];if(!_0x542458[_0x3594('0x59')]['UserId'])return;return db['User'][_0x3594('0x5a')]({'where':{'id':_0x542458[_0x3594('0x59')]['UserId'],'role':'agent'},'attributes':['id','name',_0x3594('0x72'),_0x3594('0x73'),'internal'],'raw':!![]});}return null;})[_0x3594('0x22')](function(_0x3806a2){if(!_0x3806a2)return null;_0x2dffba[_0x3594('0x2b')][_0x3594('0x71')]=_0x3806a2;return _0x2dffba;})[_0x3594('0x22')](function(_0x53cba0){if(_0x53cba0){_0x53cba0[_0x3594('0x2b')][_0x3594('0x75')]=util[_0x3594('0x5e')]('SIP/%s',_0x542458['user'][_0x3594('0x3b')]);_0x53cba0[_0x3594('0x2b')]['channel']=_0x2dffba[_0x3594('0x77')];_0x53cba0['message'][_0x3594('0x78')]=_0x2dffba[_0x3594('0x77')];_0x53cba0['message'][_0x3594('0x7e')]=_0x3594('0x37');respondWithRpcPromise(_0x3594('0x7f'),'EventManager',{'event':_0x3594('0x80'),'message':_0x53cba0[_0x3594('0x2b')]},client9002);return _0x2dffba;}return null;})[_0x3594('0x22')](respondWithResult(_0x1c21f5,null))[_0x3594('0x2c')](handleError(_0x1c21f5,null));};exports[_0x3594('0x2f')]=function(_0x1b78ba,_0x4f1af0,_0x7eb211){if(_0x1b78ba[_0x3594('0x59')]['id']){delete _0x1b78ba[_0x3594('0x59')]['id'];}var _0x1b73bd;return db['SmsMessage']['find']({'where':{'id':_0x1b78ba[_0x3594('0x56')]['id']}})[_0x3594('0x22')](handleEntityNotFound(_0x4f1af0,null))[_0x3594('0x22')](function(_0x4a2869){if(_0x4a2869){_0x1b73bd=_0x4a2869;return db[_0x3594('0x81')][_0x3594('0x5a')]({'where':{'id':_0x4a2869[_0x3594('0x82')]}});}})[_0x3594('0x22')](handleEntityNotFound(_0x4f1af0,null))['then'](function(_0x2eaff1){if(_0x2eaff1){logger[_0x3594('0x26')](_0x3594('0x27'),_0x3594('0x2f'),'received\x20delivery\x20report\x20from',_0x2eaff1[_0x3594('0x42')],util['inspect'](_0x1b78ba[_0x3594('0x59')],{'showHidden':![],'depth':null}));switch(_0x2eaff1[_0x3594('0x42')]){case _0x3594('0x83'):if(_0x1b78ba[_0x3594('0x59')]['MessageSid']&&_0x1b78ba[_0x3594('0x59')][_0x3594('0x84')]===_0x1b73bd[_0x3594('0x85')]){return _0x1b73bd[_0x3594('0x39')]({'read':!![]});}else{logger[_0x3594('0x2a')](_0x3594('0x86'),'status',_0x3594('0x83'),util['inspect'](_0x1b78ba[_0x3594('0x59')],{'showHidden':![],'depth':null}));}break;case _0x3594('0x87'):if(_0x1b78ba[_0x3594('0x59')][_0x3594('0x88')]&&_0x1b78ba[_0x3594('0x59')]['MessageUUID']===_0x1b73bd[_0x3594('0x85')]&&_[_0x3594('0x89')]([_0x3594('0x8a'),_0x3594('0x8b')],_0x1b78ba[_0x3594('0x59')][_0x3594('0x8c')])>=0x0){return _0x1b73bd['update']({'read':!![]});}else{logger[_0x3594('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3594('0x2f'),_0x3594('0x8d'),util[_0x3594('0x8e')](_0x1b78ba[_0x3594('0x59')],{'showHidden':![],'depth':null}));}break;case _0x3594('0x8f'):var _0x4ea855=_0x1b78ba['body']['results'][0x0];if(_0x4ea855[_0x3594('0x2f')]['groupName']==='DELIVERED'){return _0x1b73bd[_0x3594('0x39')]({'read':!![]});}else{logger[_0x3594('0x2a')](_0x3594('0x86'),'status',_0x3594('0x8f'),util['inspect'](_0x1b78ba[_0x3594('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x1b73bd;}})[_0x3594('0x22')](respondWithResult(_0x4f1af0,null))[_0x3594('0x2c')](handleError(_0x4f1af0,null));}; \ No newline at end of file +var _0x866a=['include','findAll','show','params','options','find','body','destroy','describe','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','user','role','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','email','internal','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','sms-interactions','RejectMessage','rejectMessage','User','fullname','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','delivered','infobip','results','groupName','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','json','offset','limit','undefined','count','status','Content-Range','apply','reject','save','update','end','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x2af1a8,_0x2151ab){var _0x488f5b=function(_0x21ef73){while(--_0x21ef73){_0x2af1a8['push'](_0x2af1a8['shift']());}};_0x488f5b(++_0x2151ab);}(_0x866a,0x156));var _0xa866=function(_0x551be0,_0x3372c1){_0x551be0=_0x551be0-0x0;var _0x112d08=_0x866a[_0x551be0];return _0x112d08;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa866('0x0'));var zipdir=require(_0xa866('0x1'));var jsonpatch=require(_0xa866('0x2'));var rp=require(_0xa866('0x3'));var moment=require(_0xa866('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa866('0x5'));var util=require(_0xa866('0x6'));var path=require(_0xa866('0x7'));var sox=require('sox');var csv=require(_0xa866('0x8'));var ejs=require(_0xa866('0x9'));var fs=require('fs');var fs_extra=require(_0xa866('0xa'));var _=require(_0xa866('0xb'));var squel=require(_0xa866('0xc'));var crypto=require(_0xa866('0xd'));var jsforce=require(_0xa866('0xe'));var deskjs=require(_0xa866('0xf'));var toCsv=require(_0xa866('0x8'));var querystring=require(_0xa866('0x10'));var Papa=require('papaparse');var Redis=require(_0xa866('0x11'));var authService=require(_0xa866('0x12'));var qs=require(_0xa866('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa866('0x14'));var logger=require(_0xa866('0x15'))(_0xa866('0x16'));var utils=require(_0xa866('0x17'));var config=require(_0xa866('0x18'));var licenseUtil=require(_0xa866('0x19'));var db=require('../../mysqldb')['db'];config[_0xa866('0x1a')]=_[_0xa866('0x1b')](config[_0xa866('0x1a')],{'host':_0xa866('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa866('0x1a')]));require('./smsMessage.socket')[_0xa866('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa866('0x1e')][_0xa866('0x1f')]({'port':0x232c});var client9002=jayson[_0xa866('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x251095,_0x1afbe4,_0x5847ae,_0x2d492d){return new BPromise(function(_0x1e2211,_0xe30e66){var _0x34ca55=_0x2d492d||client;return _0x34ca55[_0xa866('0x20')](_0x251095,_0x5847ae)[_0xa866('0x21')](function(_0x48fd82){logger[_0xa866('0x22')](_0xa866('0x23'),_0x1afbe4,_0xa866('0x24'));logger[_0xa866('0x25')](_0xa866('0x26'),_0x1afbe4,_0xa866('0x24'),JSON[_0xa866('0x27')](_0x48fd82));if(_0x48fd82['error']){if(_0x48fd82[_0xa866('0x28')]['code']===0x1f4){logger['error'](_0xa866('0x23'),_0x1afbe4,_0x48fd82['error'][_0xa866('0x29')]);return _0xe30e66(_0x48fd82[_0xa866('0x28')][_0xa866('0x29')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x1afbe4,_0x48fd82[_0xa866('0x28')][_0xa866('0x29')]);return _0x1e2211(_0x48fd82['error'][_0xa866('0x29')]);}else{logger[_0xa866('0x22')](_0xa866('0x23'),_0x1afbe4,_0xa866('0x24'));_0x1e2211(_0x48fd82['result'][_0xa866('0x29')]);}})[_0xa866('0x2a')](function(_0x35a83d){logger[_0xa866('0x28')](_0xa866('0x23'),_0x1afbe4,_0x35a83d);_0xe30e66(_0x35a83d);});});}function respondWithStatusCode(_0x262ea5,_0x4ed77e){_0x4ed77e=_0x4ed77e||0xcc;return function(_0x34620d){if(_0x34620d){return _0x262ea5[_0xa866('0x2b')](_0x4ed77e);}return _0x262ea5['status'](_0x4ed77e)['end']();};}function respondWithResult(_0x243a3d,_0x25f236){_0x25f236=_0x25f236||0xc8;return function(_0x5c14b2){if(_0x5c14b2){return _0x243a3d['status'](_0x25f236)[_0xa866('0x2c')](_0x5c14b2);}};}function respondWithFilteredResult(_0x1e27ed,_0x47f42b){return function(_0xe83620){if(_0xe83620){var _0x36e73b=typeof _0x47f42b[_0xa866('0x2d')]==='undefined'&&typeof _0x47f42b[_0xa866('0x2e')]===_0xa866('0x2f');var _0x92f73b=_0xe83620[_0xa866('0x30')];var _0x11ec00=_0x36e73b?0x0:_0x47f42b['offset'];var _0x4eb663=_0x36e73b?_0xe83620[_0xa866('0x30')]:_0x47f42b[_0xa866('0x2d')]+_0x47f42b[_0xa866('0x2e')];var _0x2b9c61;if(_0x4eb663>=_0x92f73b){_0x4eb663=_0x92f73b;_0x2b9c61=0xc8;}else{_0x2b9c61=0xce;}_0x1e27ed[_0xa866('0x31')](_0x2b9c61);return _0x1e27ed['set'](_0xa866('0x32'),_0x11ec00+'-'+_0x4eb663+'/'+_0x92f73b)[_0xa866('0x2c')](_0xe83620);}return null;};}function patchUpdates(_0x592100){return function(_0x208fed){try{jsonpatch[_0xa866('0x33')](_0x208fed,_0x592100,!![]);}catch(_0x5c36ad){return BPromise[_0xa866('0x34')](_0x5c36ad);}return _0x208fed[_0xa866('0x35')]();};}function saveUpdates(_0x1abf04,_0x449ce3){return function(_0x46d324){if(_0x46d324){return _0x46d324[_0xa866('0x36')](_0x1abf04)[_0xa866('0x21')](function(_0x171958){return _0x171958;});}return null;};}function removeEntity(_0x1a0453,_0x420b1c){return function(_0x4aaba9){if(_0x4aaba9){return _0x4aaba9['destroy']()[_0xa866('0x21')](function(){_0x1a0453[_0xa866('0x31')](0xcc)[_0xa866('0x37')]();});}};}function handleEntityNotFound(_0x3596fd,_0x3636ed){return function(_0x5de401){if(!_0x5de401){_0x3596fd[_0xa866('0x2b')](0x194);}return _0x5de401;};}function handleError(_0x1ceb57,_0x81655){_0x81655=_0x81655||0x1f4;return function(_0x27c3c3){logger['error'](_0x27c3c3[_0xa866('0x38')]);if(_0x27c3c3[_0xa866('0x39')]){delete _0x27c3c3[_0xa866('0x39')];}_0x1ceb57['status'](_0x81655)[_0xa866('0x3a')](_0x27c3c3);};}exports[_0xa866('0x3b')]=function(_0x69624c,_0x2c2bbf){var _0x592df2={},_0x264e5b={},_0x560efe={'count':0x0,'rows':[]};var _0x2eb8c5=_[_0xa866('0x3c')](db[_0xa866('0x3d')][_0xa866('0x3e')],function(_0x44a0d7){return{'name':_0x44a0d7[_0xa866('0x3f')],'type':_0x44a0d7[_0xa866('0x40')][_0xa866('0x41')]};});_0x264e5b['model']=_[_0xa866('0x3c')](_0x2eb8c5,'name');_0x264e5b[_0xa866('0x42')]=_[_0xa866('0x43')](_0x69624c[_0xa866('0x42')]);_0x264e5b[_0xa866('0x44')]=_[_0xa866('0x45')](_0x264e5b[_0xa866('0x46')],_0x264e5b[_0xa866('0x42')]);_0x592df2['attributes']=_[_0xa866('0x45')](_0x264e5b[_0xa866('0x46')],qs[_0xa866('0x47')](_0x69624c['query'][_0xa866('0x47')]));_0x592df2['attributes']=_0x592df2[_0xa866('0x48')][_0xa866('0x49')]?_0x592df2[_0xa866('0x48')]:_0x264e5b['model'];if(!_0x69624c['query'][_0xa866('0x4a')](_0xa866('0x4b'))){_0x592df2[_0xa866('0x2e')]=qs[_0xa866('0x2e')](_0x69624c['query'][_0xa866('0x2e')]);_0x592df2[_0xa866('0x2d')]=qs[_0xa866('0x2d')](_0x69624c[_0xa866('0x42')][_0xa866('0x2d')]);}_0x592df2[_0xa866('0x4c')]=qs['sort'](_0x69624c[_0xa866('0x42')][_0xa866('0x4d')]);_0x592df2[_0xa866('0x4e')]=qs[_0xa866('0x44')](_[_0xa866('0x4f')](_0x69624c[_0xa866('0x42')],_0x264e5b['filters']),_0x2eb8c5);if(_0x69624c[_0xa866('0x42')][_0xa866('0x50')]){_0x592df2[_0xa866('0x4e')]=_[_0xa866('0x51')](_0x592df2[_0xa866('0x4e')],{'$or':_[_0xa866('0x3c')](_0x2eb8c5,function(_0x5c3ac2){if(_0x5c3ac2[_0xa866('0x40')]!==_0xa866('0x52')){var _0x32d67a={};_0x32d67a[_0x5c3ac2[_0xa866('0x39')]]={'$like':'%'+_0x69624c[_0xa866('0x42')][_0xa866('0x50')]+'%'};return _0x32d67a;}})});}_0x592df2=_[_0xa866('0x51')]({},_0x592df2,_0x69624c['options']);var _0x29d7e1={'where':_0x592df2[_0xa866('0x4e')]};return db['SmsMessage'][_0xa866('0x30')](_0x29d7e1)[_0xa866('0x21')](function(_0x10e782){_0x560efe[_0xa866('0x30')]=_0x10e782;if(_0x69624c[_0xa866('0x42')][_0xa866('0x53')]){_0x592df2[_0xa866('0x54')]=[{'all':!![]}];}return db['SmsMessage'][_0xa866('0x55')](_0x592df2);})[_0xa866('0x21')](function(_0x5ea9fe){_0x560efe['rows']=_0x5ea9fe;return _0x560efe;})['then'](respondWithFilteredResult(_0x2c2bbf,_0x592df2))[_0xa866('0x2a')](handleError(_0x2c2bbf,null));};exports[_0xa866('0x56')]=function(_0x314f9b,_0x2f68d2){var _0x50c88b={'raw':!![],'where':{'id':_0x314f9b[_0xa866('0x57')]['id']}},_0x2f52b1={};_0x2f52b1[_0xa866('0x46')]=_[_0xa866('0x43')](db[_0xa866('0x3d')]['rawAttributes']);_0x2f52b1[_0xa866('0x42')]=_[_0xa866('0x43')](_0x314f9b[_0xa866('0x42')]);_0x2f52b1[_0xa866('0x44')]=_[_0xa866('0x45')](_0x2f52b1[_0xa866('0x46')],_0x2f52b1[_0xa866('0x42')]);_0x50c88b['attributes']=_[_0xa866('0x45')](_0x2f52b1[_0xa866('0x46')],qs[_0xa866('0x47')](_0x314f9b[_0xa866('0x42')][_0xa866('0x47')]));_0x50c88b[_0xa866('0x48')]=_0x50c88b[_0xa866('0x48')]['length']?_0x50c88b[_0xa866('0x48')]:_0x2f52b1[_0xa866('0x46')];if(_0x314f9b[_0xa866('0x42')][_0xa866('0x53')]){_0x50c88b[_0xa866('0x54')]=[{'all':!![]}];}_0x50c88b=_['merge']({},_0x50c88b,_0x314f9b[_0xa866('0x58')]);return db[_0xa866('0x3d')][_0xa866('0x59')](_0x50c88b)['then'](handleEntityNotFound(_0x2f68d2,null))[_0xa866('0x21')](respondWithResult(_0x2f68d2,null))[_0xa866('0x2a')](handleError(_0x2f68d2,null));};exports['create']=function(_0x4b5b7d,_0x5ece26){return db[_0xa866('0x3d')]['create'](_0x4b5b7d[_0xa866('0x5a')],{})[_0xa866('0x21')](respondWithResult(_0x5ece26,0xc9))[_0xa866('0x2a')](handleError(_0x5ece26,null));};exports['update']=function(_0x4ce7cf,_0x4812f9){if(_0x4ce7cf[_0xa866('0x5a')]['id']){delete _0x4ce7cf[_0xa866('0x5a')]['id'];}return db[_0xa866('0x3d')][_0xa866('0x59')]({'where':{'id':_0x4ce7cf['params']['id']}})[_0xa866('0x21')](handleEntityNotFound(_0x4812f9,null))['then'](saveUpdates(_0x4ce7cf[_0xa866('0x5a')],null))[_0xa866('0x21')](respondWithResult(_0x4812f9,null))[_0xa866('0x2a')](handleError(_0x4812f9,null));};exports[_0xa866('0x5b')]=function(_0x35f7c2,_0x1d34e0){return db['SmsMessage'][_0xa866('0x59')]({'where':{'id':_0x35f7c2[_0xa866('0x57')]['id']}})[_0xa866('0x21')](handleEntityNotFound(_0x1d34e0,null))[_0xa866('0x21')](removeEntity(_0x1d34e0,null))['catch'](handleError(_0x1d34e0,null));};exports[_0xa866('0x5c')]=function(_0xc1252,_0x5d1898){return db[_0xa866('0x3d')]['describe']()[_0xa866('0x21')](respondWithResult(_0x5d1898,null))[_0xa866('0x2a')](handleError(_0x5d1898,null));};var interaction_log=require(_0xa866('0x15'))('sms-interactions');exports['accept']=function(_0x312969,_0x1a901a,_0x1e095d){var _0x558091={'agent':{},'channel':_0xa866('0x5d')};if(_0x312969[_0xa866('0x5a')]['id']){delete _0x312969['body']['id'];}_0x312969[_0xa866('0x5a')][_0xa866('0x5e')]=!![];_0x312969[_0xa866('0x5a')]['readAt']=moment()[_0xa866('0x5f')](_0xa866('0x60'));_0x312969[_0xa866('0x5a')][_0xa866('0x61')]=_0x312969[_0xa866('0x5a')][_0xa866('0x61')]||_0x312969['user']['id'];_0x558091['agent']['id']=_0x312969[_0xa866('0x5a')][_0xa866('0x61')];return db[_0xa866('0x3d')][_0xa866('0x59')]({'where':{'id':_0x312969[_0xa866('0x57')]['id'],'UserId':null}})[_0xa866('0x21')](handleEntityNotFound(_0x1a901a,null))[_0xa866('0x21')](saveUpdates(_0x312969['body'],null))[_0xa866('0x21')](function(_0x1e6c71){if(_0x1e6c71){_0x558091[_0xa866('0x29')]=_0x1e6c71[_0xa866('0x62')]({'plain':!![]});return db[_0xa866('0x63')][_0xa866('0x59')]({'where':{'id':_0x1e6c71[_0xa866('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x1a901a,null))['then'](function(_0x583ff4){if(_0x583ff4){return _0x583ff4[_0xa866('0x36')]({'UserId':_0x312969['body'][_0xa866('0x61')],'read1stAt':_[_0xa866('0x65')](_0x583ff4[_0xa866('0x66')])?moment()[_0xa866('0x5f')](_0xa866('0x60')):undefined});}return null;})[_0xa866('0x21')](function(_0x3ea5b3){if(_0x3ea5b3){_0x558091[_0xa866('0x67')]=_0x3ea5b3[_0xa866('0x62')]({'plain':!![]});interaction_log[_0xa866('0x22')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x312969[_0xa866('0x68')]['id'],_0x312969[_0xa866('0x68')]['name'],_0x312969[_0xa866('0x68')][_0xa866('0x69')],_0x558091[_0xa866('0x67')]['id'],_0x312969['body']?JSON[_0xa866('0x27')](_0x312969[_0xa866('0x5a')]):'null');return respondWithRpcPromise(_0xa866('0x6a'),'acceptMessage',_0x558091);}return null;})[_0xa866('0x21')](function(_0x3550ca){var _0x1718e1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3550ca[_0xa866('0x29')][_0xa866('0x6b')];return db[_0xa866('0x6c')][_0xa866('0x42')](_0x1718e1,{'type':db[_0xa866('0x6d')][_0xa866('0x6e')][_0xa866('0x6f')],'raw':!![]})[_0xa866('0x21')](function(_0x452955){return _0x452955;});})[_0xa866('0x21')](function(_0x4cc5d0){if(_0x4cc5d0){_0x558091[_0xa866('0x29')][_0xa866('0x70')]=_0x4cc5d0[0x0];if(!_0x312969[_0xa866('0x5a')][_0xa866('0x61')])return;return db['User'][_0xa866('0x59')]({'where':{'id':_0x312969['body'][_0xa866('0x61')],'role':_0xa866('0x71')},'attributes':['id',_0xa866('0x39'),'fullname',_0xa866('0x72'),_0xa866('0x73')],'raw':!![]});}return null;})[_0xa866('0x21')](function(_0x33c70f){if(!_0x33c70f)return null;_0x558091['message'][_0xa866('0x71')]=_0x33c70f;return _0x558091;})[_0xa866('0x21')](function(_0x24bfa4){if(_0x24bfa4){if(_0x312969[_0xa866('0x5a')]['manual']){_0x558091[_0xa866('0x29')]['interface']=util[_0xa866('0x5f')](_0xa866('0x74'),_0x312969[_0xa866('0x68')][_0xa866('0x39')]);_0x558091[_0xa866('0x29')][_0xa866('0x75')]=_0x558091[_0xa866('0x75')];_0x558091[_0xa866('0x29')][_0xa866('0x76')]=_0x558091[_0xa866('0x75')];_0x558091['message'][_0xa866('0x77')]=_0xa866('0x78');return respondWithRpcPromise('EventManager',_0xa866('0x79'),{'event':_0xa866('0x7a'),'message':_0x558091['message']},client9002)[_0xa866('0x21')](function(){return _0x558091;});}return _0x558091;}return null;})['then'](respondWithResult(_0x1a901a,null))[_0xa866('0x2a')](handleError(_0x1a901a,null));};var interaction_log=require('../../config/logger')(_0xa866('0x7b'));exports[_0xa866('0x34')]=function(_0x255f5b,_0x11b3ab,_0x215a8e){var _0x32452b={'agent':{},'channel':'sms'};if(_0x255f5b[_0xa866('0x5a')]['id']){delete _0x255f5b[_0xa866('0x5a')]['id'];}_0x255f5b['body'][_0xa866('0x61')]=_0x255f5b[_0xa866('0x5a')]['UserId']||_0x255f5b[_0xa866('0x68')]['id'];_0x32452b[_0xa866('0x71')]['id']=_0x255f5b['body'][_0xa866('0x61')];return db[_0xa866('0x3d')][_0xa866('0x59')]({'where':{'id':_0x255f5b[_0xa866('0x57')]['id'],'UserId':null}})[_0xa866('0x21')](handleEntityNotFound(_0x11b3ab,null))[_0xa866('0x21')](function(_0x4c375a){if(_0x4c375a){_0x32452b['message']=_0x4c375a[_0xa866('0x62')]({'plain':!![]});return db[_0xa866('0x63')][_0xa866('0x59')]({'where':{'id':_0x4c375a[_0xa866('0x64')]}});}return null;})[_0xa866('0x21')](handleEntityNotFound(_0x11b3ab,null))['then'](function(_0x5bb986){if(_0x5bb986){_0x32452b[_0xa866('0x67')]=_0x5bb986['get']({'plain':!![]});interaction_log[_0xa866('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x255f5b[_0xa866('0x68')]['id'],_0x255f5b[_0xa866('0x68')][_0xa866('0x39')],_0x255f5b[_0xa866('0x68')][_0xa866('0x69')],_0x32452b[_0xa866('0x67')]['id'],_0x255f5b[_0xa866('0x5a')]?JSON[_0xa866('0x27')](_0x255f5b['body']):'null');return respondWithRpcPromise(_0xa866('0x7c'),_0xa866('0x7d'),_0x32452b);}return null;})[_0xa866('0x21')](function(_0x4c363b){var _0x5c096d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4c363b['message']['ContactId'];return db[_0xa866('0x6c')][_0xa866('0x42')](_0x5c096d,{'type':db[_0xa866('0x6d')][_0xa866('0x6e')][_0xa866('0x6f')],'raw':!![]})[_0xa866('0x21')](function(_0x4eb597){return _0x4eb597;});})[_0xa866('0x21')](function(_0x49b145){if(_0x49b145){_0x32452b[_0xa866('0x29')][_0xa866('0x70')]=_0x49b145[0x0];if(!_0x255f5b[_0xa866('0x5a')]['UserId'])return;return db[_0xa866('0x7e')][_0xa866('0x59')]({'where':{'id':_0x255f5b[_0xa866('0x5a')]['UserId'],'role':_0xa866('0x71')},'attributes':['id',_0xa866('0x39'),_0xa866('0x7f'),_0xa866('0x72'),_0xa866('0x73')],'raw':!![]});}return null;})[_0xa866('0x21')](function(_0x5237e2){if(!_0x5237e2)return null;_0x32452b[_0xa866('0x29')][_0xa866('0x71')]=_0x5237e2;return _0x32452b;})['then'](function(_0x21c4ca){if(_0x21c4ca){_0x21c4ca[_0xa866('0x29')]['interface']=util[_0xa866('0x5f')](_0xa866('0x74'),_0x255f5b['user'][_0xa866('0x39')]);_0x21c4ca['message'][_0xa866('0x75')]=_0x32452b[_0xa866('0x75')];_0x21c4ca['message'][_0xa866('0x76')]=_0x32452b[_0xa866('0x75')];_0x21c4ca[_0xa866('0x29')][_0xa866('0x77')]=_0xa866('0x34');respondWithRpcPromise('EventManager',_0xa866('0x79'),{'event':_0xa866('0x80'),'message':_0x21c4ca[_0xa866('0x29')]},client9002);return _0x32452b;}return null;})['then'](respondWithResult(_0x11b3ab,null))[_0xa866('0x2a')](handleError(_0x11b3ab,null));};exports[_0xa866('0x31')]=function(_0x209e1c,_0x47b0cc,_0x3a6044){if(_0x209e1c[_0xa866('0x5a')]['id']){delete _0x209e1c[_0xa866('0x5a')]['id'];}var _0x569012;return db[_0xa866('0x3d')][_0xa866('0x59')]({'where':{'id':_0x209e1c[_0xa866('0x57')]['id']}})[_0xa866('0x21')](handleEntityNotFound(_0x47b0cc,null))[_0xa866('0x21')](function(_0x9bc8a3){if(_0x9bc8a3){_0x569012=_0x9bc8a3;return db['SmsAccount'][_0xa866('0x59')]({'where':{'id':_0x9bc8a3[_0xa866('0x81')]}});}})[_0xa866('0x21')](handleEntityNotFound(_0x47b0cc,null))[_0xa866('0x21')](function(_0x21aeba){if(_0x21aeba){logger[_0xa866('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa866('0x31'),_0xa866('0x82'),_0x21aeba[_0xa866('0x40')],util[_0xa866('0x83')](_0x209e1c[_0xa866('0x5a')],{'showHidden':![],'depth':null}));switch(_0x21aeba[_0xa866('0x40')]){case _0xa866('0x84'):if(_0x209e1c[_0xa866('0x5a')]['MessageSid']&&_0x209e1c[_0xa866('0x5a')][_0xa866('0x85')]===_0x569012[_0xa866('0x86')]){return _0x569012['update']({'read':!![]});}else{logger['error'](_0xa866('0x87'),_0xa866('0x31'),_0xa866('0x84'),util[_0xa866('0x83')](_0x209e1c[_0xa866('0x5a')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x209e1c[_0xa866('0x5a')][_0xa866('0x88')]&&_0x209e1c['body']['MessageUUID']===_0x569012[_0xa866('0x86')]&&_[_0xa866('0x89')](['sent',_0xa866('0x8a')],_0x209e1c[_0xa866('0x5a')]['Status'])>=0x0){return _0x569012['update']({'read':!![]});}else{logger[_0xa866('0x28')](_0xa866('0x87'),_0xa866('0x31'),'plivio',util[_0xa866('0x83')](_0x209e1c[_0xa866('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xa866('0x8b'):var _0x16a101=_0x209e1c['body'][_0xa866('0x8c')][0x0];if(_0x16a101['status'][_0xa866('0x8d')]==='DELIVERED'){return _0x569012['update']({'read':!![]});}else{logger[_0xa866('0x28')](_0xa866('0x87'),_0xa866('0x31'),'infobip',util['inspect'](_0x209e1c[_0xa866('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x569012;}})['then'](respondWithResult(_0x47b0cc,null))[_0xa866('0x2a')](handleError(_0x47b0cc,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 52eecfc..ef49528 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 _0x4657=['events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hook'];(function(_0x55787c,_0x1b2a34){var _0xb524e1=function(_0x585e04){while(--_0x585e04){_0x55787c['push'](_0x55787c['shift']());}};_0xb524e1(++_0x1b2a34);}(_0x4657,0x156));var _0x7465=function(_0x2621ac,_0x4d8774){_0x2621ac=_0x2621ac-0x0;var _0x57bc8c=_0x4657[_0x2621ac];return _0x57bc8c;};'use strict';var EventEmitter=require(_0x7465('0x0'));var SmsMessage=require(_0x7465('0x1'))['db'][_0x7465('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7465('0x3')](0x0);var events={'afterCreate':_0x7465('0x4'),'afterUpdate':_0x7465('0x5'),'afterDestroy':_0x7465('0x6')};function emitEvent(_0x396f39){return function(_0x1620bb,_0x505608,_0x470061){SmsMessageEvents[_0x7465('0x7')](_0x396f39+':'+_0x1620bb['id'],_0x1620bb);SmsMessageEvents['emit'](_0x396f39,_0x1620bb);_0x470061(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x7465('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xb491=['events','../../mysqldb','SmsMessage','setMaxListeners','save','remove','emit','hook'];(function(_0x358b19,_0x3350cb){var _0x2dc3b6=function(_0x1636ff){while(--_0x1636ff){_0x358b19['push'](_0x358b19['shift']());}};_0x2dc3b6(++_0x3350cb);}(_0xb491,0x1e8));var _0x1b49=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0xb491[_0x1b4002];return _0x1716f3;};'use strict';var EventEmitter=require(_0x1b49('0x0'));var SmsMessage=require(_0x1b49('0x1'))['db'][_0x1b49('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x1b49('0x3')](0x0);var events={'afterCreate':_0x1b49('0x4'),'afterUpdate':'update','afterDestroy':_0x1b49('0x5')};function emitEvent(_0x5d7006){return function(_0x28bbe8,_0x445e1b,_0x3e3195){SmsMessageEvents[_0x1b49('0x6')](_0x5d7006+':'+_0x28bbe8['id'],_0x28bbe8);SmsMessageEvents[_0x1b49('0x6')](_0x5d7006,_0x28bbe8);_0x3e3195(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x1b49('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d8e87f7..e23db8f 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 _0x5825=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','isNil','findOne','SmsInteractionId','update','error','out','secret','SmsAccount','find','SmsAccountId','then','type','twilio','authToken','phone','accountSid','messages','create','remote','/status?token=','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','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','afterCreate','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','token','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','length','createHash','digest','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','Basic\x20%s','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','status','refid','Token\x20not\x20received','utf8mb4'];(function(_0x1aa7b1,_0xe9e31d){var _0x5d4ff4=function(_0x1b3036){while(--_0x1b3036){_0x1aa7b1['push'](_0x1aa7b1['shift']());}};_0x5d4ff4(++_0xe9e31d);}(_0x5825,0x78));var _0x5582=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5825[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x5582('0x0'));var util=require(_0x5582('0x1'));var logger=require(_0x5582('0x2'))(_0x5582('0x3'));var moment=require('moment');var BPromise=require(_0x5582('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5582('0x5'));var rimraf=require(_0x5582('0x6'));var config=require(_0x5582('0x7'));var attributes=require(_0x5582('0x8'));module[_0x5582('0x9')]=function(_0x11eb87,_0x17a897){return _0x11eb87['define'](_0x5582('0xa'),attributes,{'tableName':_0x5582('0xb'),'paranoid':![],'indexes':[{'name':_0x5582('0xc'),'fields':[_0x5582('0xc')]},{'name':'fti_sms_messages','fields':[_0x5582('0xd')],'type':_0x5582('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24413f,_0x4eacaa,_0x40215a){var _0xd1cc57=_0x11eb87[_0x5582('0xf')];var _0x5537eb=_0x24413f[_0x5582('0x10')]({'plain':!![]});if(_0x5537eb[_0x5582('0x11')]['toLowerCase']()==='in'||_0x5537eb[_0x5582('0x11')][_0x5582('0x12')]()==='out'&&!_0x5537eb['secret']&&!_[_0x5582('0x13')](_0x5537eb['UserId'])){_0xd1cc57['SmsInteraction'][_0x5582('0x14')]({'where':{'id':_0x5537eb[_0x5582('0x15')]}})['then'](function(_0x245cd7){if(_0x245cd7){_0x245cd7[_0x5582('0x16')]({'lastMsgAt':_0x5537eb['createdAt'],'lastMsgDirection':_0x5537eb[_0x5582('0x11')][_0x5582('0x12')]()});}})['catch'](function(_0x511268){console[_0x5582('0x17')](_0x511268);});}if(_0x5537eb['direction']===_0x5582('0x18')&&!_0x5537eb[_0x5582('0x19')]){var _0x181bd7;_0xd1cc57[_0x5582('0x1a')][_0x5582('0x1b')]({'where':{'id':_0x5537eb[_0x5582('0x1c')]},'raw':!![]})[_0x5582('0x1d')](function(_0x154fda){_0x181bd7=_0x154fda;if(_0x181bd7&&_0x181bd7['type']){switch(_0x181bd7[_0x5582('0x1e')]){case _0x5582('0x1f'):var _0x3047cc=require(_0x5582('0x1f'));if(_0x181bd7['accountSid']&&_0x181bd7[_0x5582('0x20')]&&_0x181bd7[_0x5582('0x21')]){var _0x140b60=new _0x3047cc(_0x181bd7[_0x5582('0x22')],_0x181bd7[_0x5582('0x20')]);_0x140b60[_0x5582('0x23')][_0x5582('0x24')]({'body':_0x5537eb[_0x5582('0xd')],'to':_0x5537eb[_0x5582('0x21')],'from':_0x181bd7['phone'],'statusCallback':_0x181bd7[_0x5582('0x25')]+'/api/sms/messages/'+_0x5537eb['id']+_0x5582('0x26')+_0x181bd7['token']})[_0x5582('0x1d')](function(_0x4b775f){if(_0x4b775f['sid']){return _0x24413f[_0x5582('0x16')]({'messageId':_0x4b775f[_0x5582('0x27')]});}})[_0x5582('0x28')](function(_0x4b178f){logger[_0x5582('0x17')](_0x5582('0x29'),'afterCreate',_0x5582('0x1f'),util['inspect'](_0x4b178f,{'showHidden':![],'depth':null}));});}else{logger[_0x5582('0x17')](_0x5582('0x29'),'afterCreate',_0x5582('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x5582('0x2a'):var _0x151939=_0x5582('0x2b');if(_0x181bd7[_0x5582('0x2c')]&&_0x181bd7[_0x5582('0x2d')]){var _0x37bba3={'recipient':[_0x5537eb[_0x5582('0x21')]],'message':_0x5537eb[_0x5582('0xd')],'message_type':_0x181bd7[_0x5582('0x2e')]};if(_0x181bd7['smsMethod']&&_0x181bd7[_0x5582('0x2e')]!=='SI'){_0x37bba3[_0x5582('0x2f')]=_0x181bd7[_0x5582('0x21')];}var _0x492fd9={'url':_0x151939+_0x5582('0x30')+_0x181bd7[_0x5582('0x2c')]+_0x5582('0x31')+_0x181bd7[_0x5582('0x2d')],'method':'GET'};rp(_0x492fd9)[_0x5582('0x1d')](function(_0x1fc030){var _0x1241ba=_0x1fc030[_0x5582('0x32')](';');var _0x5b91ea={'user_key':_0x1241ba[0x0],'session_key':_0x1241ba[0x1]};_0x492fd9={'url':_0x151939+_0x5582('0x33'),'method':_0x5582('0x34'),'headers':{'user_key':_0x5b91ea['user_key'],'Session_key':_0x5b91ea[_0x5582('0x35')]},'json':!![],'body':_0x37bba3};return rp(_0x492fd9);})['then'](function(_0x2d7c63){if(_0x2d7c63[_0x5582('0x36')]>=0x1){var _0x4add04={'messageId':_0x2d7c63[_0x5582('0x37')]};if(_0x181bd7[_0x5582('0x2e')]!=='GP'||!_0x181bd7[_0x5582('0x38')]){_0x4add04[_0x5582('0x39')]=!![];}return _0x24413f[_0x5582('0x16')](_0x4add04);}else{return logger[_0x5582('0x17')](_0x5582('0x29'),'afterCreate','skebby',util[_0x5582('0x3a')](_0x2d7c63,{'showHidden':![],'depth':null}));}})[_0x5582('0x28')](function(_0x73adc9){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0x5582('0x3a')](_0x73adc9,{'showHidden':![],'depth':null}));});}else{logger[_0x5582('0x17')](_0x5582('0x29'),_0x5582('0x3b'),_0x5582('0x2a'),_0x5582('0x3c'));}break;case'connectel':if(_0x181bd7['authToken']){var _0x33b0d6={'recipient':_0x5537eb[_0x5582('0x21')],'message':_0x5537eb[_0x5582('0xd')],'sender':_0x181bd7[_0x5582('0x3d')]||_0x181bd7[_0x5582('0x21')],'authorization':_0x181bd7[_0x5582('0x20')]};var _0x4eacaa={'method':_0x5582('0x34'),'uri':_0x5582('0x3e'),'body':_0x33b0d6,'json':!![]};rp(_0x4eacaa)[_0x5582('0x1d')](function(_0xa91b3d){var _0x5448e2={'messageId':_0xa91b3d['requestid']};if(!_0x181bd7[_0x5582('0x38')]){_0x5448e2['read']=!![];}return _0x24413f['update'](_0x5448e2);})[_0x5582('0x28')](function(_0x5f07ba){logger[_0x5582('0x17')](_0x5582('0x29'),_0x5582('0x3b'),_0x5582('0x3f'),util[_0x5582('0x3a')](_0x5f07ba,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5582('0x29'),_0x5582('0x3b'),'connectel',_0x5582('0x40'));}break;case _0x5582('0x41'):if(_0x181bd7[_0x5582('0x2c')]&&_0x181bd7['password']){var _0x33b0d6={'messages':[{'source':_0x5582('0x42'),'to':_0x5537eb[_0x5582('0x21')],'body':_0x5537eb[_0x5582('0xd')],'from':_0x181bd7[_0x5582('0x3d')]||_0x181bd7[_0x5582('0x21')]}]};var _0x28422e=util[_0x5582('0x43')](_0x5582('0x44'),_0x181bd7['username'],_0x181bd7['password']);var _0x4eacaa={'method':_0x5582('0x34'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x33b0d6,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x28422e)[_0x5582('0x45')](_0x5582('0x46')))},'json':!![]};rp(_0x4eacaa)[_0x5582('0x1d')](function(_0x323cb6){if(_0x323cb6[_0x5582('0x47')]>=0xc8&&_0x323cb6['http_code']<=0xce){if(_0x323cb6[_0x5582('0x48')]&&_0x323cb6[_0x5582('0x48')][_0x5582('0x49')]>0x0){var _0x2b86b1=_[_0x5582('0x4a')](_0x323cb6[_0x5582('0x48')]['messages']);var _0x39b497={'messageId':_0x2b86b1[_0x5582('0x4b')]};if(!_0x181bd7[_0x5582('0x38')]){_0x39b497[_0x5582('0x39')]=!![];}return _0x24413f[_0x5582('0x16')](_0x39b497);}else{logger[_0x5582('0x17')](_0x5582('0x29'),_0x5582('0x3b'),_0x5582('0x4c'),util[_0x5582('0x3a')](_0x323cb6,{'showHidden':![],'depth':null}));}}else{logger[_0x5582('0x17')](_0x5582('0x29'),'afterCreate',_0x5582('0x4c'),util[_0x5582('0x3a')](_0x323cb6,{'showHidden':![],'depth':null}));}})[_0x5582('0x28')](function(_0x399072){logger[_0x5582('0x17')](_0x5582('0x29'),_0x5582('0x3b'),'clickSend',util['inspect'](_0x399072,{'showHidden':![],'depth':null}));});}else{logger[_0x5582('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5582('0x3b'),_0x5582('0x4c'),_0x5582('0x3c'));}break;case'plivo':if(_0x181bd7[_0x5582('0x4d')]&&_0x181bd7['authToken']){var _0x33b0d6={'dst':_0x5537eb['phone'],'text':_0x5537eb[_0x5582('0xd')],'src':_0x181bd7[_0x5582('0x3d')]||_0x181bd7[_0x5582('0x21')],'url':_0x181bd7['remote']+_0x5582('0x4e')+_0x5537eb['id']+_0x5582('0x26')+_0x181bd7['token']};var _0x28422e=util[_0x5582('0x43')](_0x5582('0x44'),_0x181bd7[_0x5582('0x4d')],_0x181bd7['authToken']);var _0x4eacaa={'method':_0x5582('0x34'),'uri':util[_0x5582('0x43')](_0x5582('0x4f'),_0x181bd7[_0x5582('0x4d')]),'body':_0x33b0d6,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x28422e)['toString'](_0x5582('0x46')))},'json':!![]};rp(_0x4eacaa)['then'](function(_0xf18800){var _0x4e1785={'messageId':_0xf18800[_0x5582('0x50')][0x0]};return _0x24413f[_0x5582('0x16')](_0x4e1785);})[_0x5582('0x28')](function(_0x3cc160){logger[_0x5582('0x17')](_0x5582('0x29'),_0x5582('0x3b'),_0x5582('0x51'),util[_0x5582('0x3a')](_0x3cc160,{'showHidden':![],'depth':null}));});}else{logger[_0x5582('0x17')](_0x5582('0x29'),'afterCreate',_0x5582('0x51'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x5582('0x52'):if(_0x181bd7[_0x5582('0x2c')]&&_0x181bd7[_0x5582('0x2d')]){if(_0x181bd7[_0x5582('0x53')]){var _0x9805dd={'method':_0x5582('0x34'),'uri':_0x181bd7[_0x5582('0x53')]+_0x5582('0x54'),'body':{'username':_0x181bd7[_0x5582('0x2c')],'password':_0x181bd7[_0x5582('0x2d')]},'json':!![]};return rp(_0x9805dd)[_0x5582('0x1d')](function(_0x5012fe){var _0x3cbc55={'method':'POST','uri':_0x181bd7['baseUrl']+_0x5582('0x55'),'body':{'messages':[{'from':_0x181bd7[_0x5582('0x21')],'destinations':[{'to':_0x5537eb[_0x5582('0x21')]}],'text':_0x5537eb[_0x5582('0xd')],'notifyUrl':_0x181bd7['remote']+_0x5582('0x4e')+_0x5537eb['id']+_0x5582('0x26')+_0x181bd7[_0x5582('0x56')],'notifyContentType':_0x5582('0x57'),'callbackData':_0x181bd7[_0x5582('0x21')]+';'+_0x5537eb[_0x5582('0xd')]}]},'headers':{'Authorization':_0x5582('0x58')+_0x5012fe[_0x5582('0x56')]},'json':!![]};return rp(_0x3cbc55)[_0x5582('0x1d')](function(_0x3bb2bb){if(_0x3bb2bb[_0x5582('0x23')]){var _0x3016e8={'messageId':_0x3bb2bb[_0x5582('0x23')][0x0][_0x5582('0xc')]};if(!_0x181bd7['deliveryReport']){_0x3016e8['read']=!![];}return _0x24413f[_0x5582('0x16')](_0x3016e8);}else{return logger[_0x5582('0x17')](_0x5582('0x29'),'afterCreate',_0x5582('0x52'),util['inspect'](_0x3bb2bb,{'showHidden':![],'depth':null}));}});})[_0x5582('0x28')](function(_0x568df6){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util['inspect'](_0x568df6,{'showHidden':![],'depth':null}));});}else{logger[_0x5582('0x17')](_0x5582('0x29'),_0x5582('0x3b'),_0x5582('0x52'),_0x5582('0x59'));}}else{logger[_0x5582('0x17')](_0x5582('0x29'),_0x5582('0x3b'),_0x5582('0x52'),_0x5582('0x3c'));}break;case _0x5582('0x5a'):var _0x17133f=require(_0x5582('0x5b'));if(_0x181bd7[_0x5582('0x5c')]){var _0x49606f={};_0x49606f[_0x5582('0x5d')]=_0x181bd7[_0x5582('0x2c')];_0x49606f[_0x5582('0x21')]=_0x5537eb['phone'];_0x49606f[_0x5582('0x2f')]=_0x181bd7['phone'];_0x49606f[_0x5582('0x5e')]=_0x5537eb[_0x5582('0xd')];_0x49606f[_0x5582('0x5f')]=+new Date();var _0x52edc4='';var _0x5e6e11='';var _0xe0085e=Object['keys'](_0x49606f);_0xe0085e['sort']();for(var _0x15a60b=0x0;_0x15a60b<_0xe0085e[_0x5582('0x60')];_0x15a60b++){if(_0x52edc4!=''){_0x52edc4+='&';}_0x52edc4+=_0xe0085e[_0x15a60b]+'='+encodeURIComponent(_0x49606f[_0xe0085e[_0x15a60b]]);_0x5e6e11+=_0x49606f[_0xe0085e[_0x15a60b]];}_0x5e6e11+=_0x181bd7[_0x5582('0x5c')];_0x5e6e11=_0x17133f[_0x5582('0x61')]('md5')['update'](_0x5e6e11)[_0x5582('0x62')]('hex');if(_0x52edc4!==''){_0x52edc4+='&';}_0x52edc4+='signature='+_0x5e6e11;var _0x492fd9={'method':'GET','uri':_0x181bd7[_0x5582('0x53')]+_0x5582('0x63')+_0x52edc4,'json':!![]};return rp(_0x492fd9)[_0x5582('0x1d')](function(_0x597508){var _0x2c0c97=Object[_0x5582('0x64')](_0x597508);if(_0x597508[_0x2c0c97[0x0]][_0x5582('0x17')]&&parseInt(_0x597508[_0x2c0c97[0x0]][_0x5582('0x17')])===0x0){var _0x231b8c={'messageId':_0x597508[_0x2c0c97[0x0]][_0x5582('0x65')]};if(!_0x181bd7['deliveryReport']){_0x231b8c[_0x5582('0x39')]=!![];}return _0x24413f[_0x5582('0x16')](_0x231b8c);}else{return logger[_0x5582('0x17')](_0x5582('0x29'),_0x5582('0x3b'),_0x5582('0x5a'),util['inspect'](_0x597508[_0x5582('0x17')],{'showHidden':![],'depth':null}));}})[_0x5582('0x28')](function(_0x355fc5){return logger[_0x5582('0x17')](_0x5582('0x29'),_0x5582('0x3b'),'csc',util['inspect'](_0x355fc5,{'showHidden':![],'depth':null}));});}else{logger[_0x5582('0x17')](_0x5582('0x29'),_0x5582('0x3b'),'csc',_0x5582('0x66'));}break;case _0x5582('0x67'):if(_0x181bd7[_0x5582('0x5c')]){var _0x4f28ea={'method':_0x5582('0x34'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x181bd7['apiKey']},'body':{'content':_0x5537eb[_0x5582('0xd')],'to':[_0x5537eb['phone']],'from':_0x181bd7['phone'],'binary':![],'clientMessageId':_0x5582('0x68'),'charset':'UTF-8'},'json':!![]};rp(_0x4f28ea)[_0x5582('0x1d')](function(_0x5f2e43){if(!_0x5f2e43[_0x5582('0x17')]){var _0x32b276={'messageId':_0x5f2e43[_0x5582('0x23')][0x0]['apiMessageId']};if(!_0x181bd7[_0x5582('0x38')]){_0x32b276['read']=!![];}return _0x24413f['update'](_0x32b276);}else{return logger[_0x5582('0x17')](_0x5582('0x29'),'afterCreate',_0x5582('0x67'),util[_0x5582('0x3a')](_0x5f2e43['error'],{'showHidden':![],'depth':null}));}})[_0x5582('0x28')](function(_0x32d71c){return logger[_0x5582('0x17')](_0x5582('0x29'),_0x5582('0x3b'),_0x5582('0x67'),util['inspect'](_0x32d71c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5582('0x29'),_0x5582('0x3b'),_0x5582('0x67'),_0x5582('0x66'));}break;case _0x5582('0x69'):if(_0x181bd7['username']&&_0x181bd7[_0x5582('0x2d')]){var _0x28422e=util[_0x5582('0x43')](_0x5582('0x44'),_0x181bd7[_0x5582('0x2c')],_0x181bd7['password']);var _0x4eacaa={'method':'POST','uri':_0x5582('0x6a')+_0x181bd7['accountId']+_0x5582('0x6b'),'body':{'to':[_0x5537eb[_0x5582('0x21')]],'text':_0x5537eb['body'],'from':_0x181bd7[_0x5582('0x21')],'applicationId':_0x181bd7[_0x5582('0x6c')]},'headers':{'Authorization':util[_0x5582('0x43')](_0x5582('0x6d'),new Buffer(_0x28422e)['toString'](_0x5582('0x46')))},'json':!![]};rp(_0x4eacaa)[_0x5582('0x1d')](function(_0x1b8d08){if(_0x1b8d08['id']){var _0x5b8985={'messageId':_0x1b8d08['id']};return _0x24413f[_0x5582('0x16')](_0x5b8985);}else{logger[_0x5582('0x17')](_0x5582('0x29'),_0x5582('0x3b'),_0x5582('0x69'),util['inspect'](_0x1b8d08,{'showHidden':![],'depth':null}));}})[_0x5582('0x28')](function(_0x306542){logger['error'](_0x5582('0x29'),'afterCreate','bandwidth',util[_0x5582('0x3a')](_0x306542,{'showHidden':![],'depth':null}));});}else{logger[_0x5582('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5582('0x69'),_0x5582('0x3c'));}break;case _0x5582('0x6e'):if(_0x181bd7[_0x5582('0x5c')]){var _0x2c4845={};var _0x492fd9={'method':'POST','uri':_0x5582('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x181bd7[_0x5582('0x5c')],'Content-Type':'application/json'},'body':{'from':_0x181bd7[_0x5582('0x21')],'to':_0x5537eb['phone'],'text':_0x5537eb[_0x5582('0xd')]},'json':!![]};return rp(_0x492fd9)[_0x5582('0x1d')](function(_0x1f81f9){if(_0x1f81f9[_0x5582('0x70')]==0xca){_0x2c4845[_0x5582('0x71')]=_0x1f81f9;var _0x1466d6={'method':_0x5582('0x34'),'uri':_0x5582('0x72'),'headers':{'Authorization':_0x5582('0x73')+_0x181bd7[_0x5582('0x5c')],'Content-Type':_0x5582('0x57')},'body':{'refid':_0x2c4845['message']['refid']},'json':!![]};return rp(_0x1466d6)[_0x5582('0x1d')](function(_0x45a416){_0x2c4845[_0x5582('0x74')]=_0x45a416;var _0x337d2c={'messageId':_0x2c4845[_0x5582('0x71')][_0x5582('0x75')],'read':!![]};return _0x24413f[_0x5582('0x16')](_0x337d2c);});}else{return logger['error'](_0x5582('0x29'),_0x5582('0x3b'),_0x5582('0x6e'),util[_0x5582('0x3a')](_0x1f81f9,{'showHidden':![],'depth':null}));}})[_0x5582('0x28')](function(_0x5eb772){return logger[_0x5582('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5582('0x3b'),_0x5582('0x6e'),util[_0x5582('0x3a')](_0x5eb772,{'showHidden':![],'depth':null}));});}else{return logger[_0x5582('0x17')](_0x5582('0x29'),_0x5582('0x3b'),_0x5582('0x6e'),_0x5582('0x76'));}break;}}})['finally'](function(){_0x40215a();});}else{_0x40215a();}}},'charset':_0x5582('0x77'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4058=['https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','authId','remote','%s:%s','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','md5','digest','signature=','/external/get/send.php?','id_sms','clickatell','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','get','out','SmsInteractionId','then','update','createdAt','direction','toLowerCase','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','/api/sms/messages/','/status?token=','token','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','password','smsMethod','sender','login?username=','username','&password=','GET','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format'];(function(_0x45e48c,_0x5d2cb6){var _0x259f8a=function(_0x3cdfdc){while(--_0x3cdfdc){_0x45e48c['push'](_0x45e48c['shift']());}};_0x259f8a(++_0x5d2cb6);}(_0x4058,0x129));var _0x8405=function(_0x3fd7ab,_0x3dd0bc){_0x3fd7ab=_0x3fd7ab-0x0;var _0x56cb4b=_0x4058[_0x3fd7ab];return _0x56cb4b;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var logger=require(_0x8405('0x2'))(_0x8405('0x3'));var moment=require(_0x8405('0x4'));var BPromise=require(_0x8405('0x5'));var rp=require(_0x8405('0x6'));var fs=require('fs');var path=require(_0x8405('0x7'));var rimraf=require(_0x8405('0x8'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module['exports']=function(_0x1db7ea,_0x257d43){return _0x1db7ea[_0x8405('0x9')](_0x8405('0xa'),attributes,{'tableName':_0x8405('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x8405('0xc')]},{'name':_0x8405('0xd'),'fields':[_0x8405('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x30705f,_0x5e132b,_0x6979fd){var _0xb442=_0x1db7ea['models'];var _0xff90a4=_0x30705f[_0x8405('0xf')]({'plain':!![]});if(_0xff90a4['direction']['toLowerCase']()==='in'||_0xff90a4['direction']['toLowerCase']()===_0x8405('0x10')&&!_0xff90a4['secret']&&!_['isNil'](_0xff90a4['UserId'])){_0xb442['SmsInteraction']['findOne']({'where':{'id':_0xff90a4[_0x8405('0x11')]}})[_0x8405('0x12')](function(_0x5a3776){if(_0x5a3776){_0x5a3776[_0x8405('0x13')]({'lastMsgAt':_0xff90a4[_0x8405('0x14')],'lastMsgDirection':_0xff90a4[_0x8405('0x15')][_0x8405('0x16')]()});}})['catch'](function(_0x218fe7){console[_0x8405('0x17')](_0x218fe7);});}if(_0xff90a4[_0x8405('0x15')]===_0x8405('0x10')&&!_0xff90a4[_0x8405('0x18')]){var _0x15a189;_0xb442[_0x8405('0x19')][_0x8405('0x1a')]({'where':{'id':_0xff90a4[_0x8405('0x1b')]},'raw':!![]})[_0x8405('0x12')](function(_0x34c79c){_0x15a189=_0x34c79c;if(_0x15a189&&_0x15a189[_0x8405('0x1c')]){switch(_0x15a189[_0x8405('0x1c')]){case _0x8405('0x1d'):var _0x3c0352=require(_0x8405('0x1d'));if(_0x15a189[_0x8405('0x1e')]&&_0x15a189[_0x8405('0x1f')]&&_0x15a189[_0x8405('0x20')]){var _0x1f42e5=new _0x3c0352(_0x15a189[_0x8405('0x1e')],_0x15a189[_0x8405('0x1f')]);_0x1f42e5[_0x8405('0x21')][_0x8405('0x22')]({'body':_0xff90a4[_0x8405('0xe')],'to':_0xff90a4[_0x8405('0x20')],'from':_0x15a189['phone'],'statusCallback':_0x15a189['remote']+_0x8405('0x23')+_0xff90a4['id']+_0x8405('0x24')+_0x15a189[_0x8405('0x25')]})['then'](function(_0x5e3849){if(_0x5e3849['sid']){return _0x30705f[_0x8405('0x13')]({'messageId':_0x5e3849['sid']});}})[_0x8405('0x26')](function(_0x162c03){logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x1d'),util[_0x8405('0x29')](_0x162c03,{'showHidden':![],'depth':null}));});}else{logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x1d'),_0x8405('0x2a'));}break;case'skebby':var _0x132c0f='https://api.skebby.it/API/v1.0/REST/';if(_0x15a189['username']&&_0x15a189[_0x8405('0x2b')]){var _0x41f06a={'recipient':[_0xff90a4[_0x8405('0x20')]],'message':_0xff90a4[_0x8405('0xe')],'message_type':_0x15a189[_0x8405('0x2c')]};if(_0x15a189[_0x8405('0x2c')]&&_0x15a189[_0x8405('0x2c')]!=='SI'){_0x41f06a[_0x8405('0x2d')]=_0x15a189[_0x8405('0x20')];}var _0x1f6114={'url':_0x132c0f+_0x8405('0x2e')+_0x15a189[_0x8405('0x2f')]+_0x8405('0x30')+_0x15a189['password'],'method':_0x8405('0x31')};rp(_0x1f6114)[_0x8405('0x12')](function(_0x52bac7){var _0x3c12e3=_0x52bac7[_0x8405('0x32')](';');var _0x1bcfa5={'user_key':_0x3c12e3[0x0],'session_key':_0x3c12e3[0x1]};_0x1f6114={'url':_0x132c0f+'sms','method':_0x8405('0x33'),'headers':{'user_key':_0x1bcfa5[_0x8405('0x34')],'Session_key':_0x1bcfa5[_0x8405('0x35')]},'json':!![],'body':_0x41f06a};return rp(_0x1f6114);})['then'](function(_0x66139d){if(_0x66139d[_0x8405('0x36')]>=0x1){var _0x50c891={'messageId':_0x66139d[_0x8405('0x37')]};if(_0x15a189['smsMethod']!=='GP'||!_0x15a189[_0x8405('0x38')]){_0x50c891[_0x8405('0x39')]=!![];}return _0x30705f[_0x8405('0x13')](_0x50c891);}else{return logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x3a'),util[_0x8405('0x29')](_0x66139d,{'showHidden':![],'depth':null}));}})[_0x8405('0x26')](function(_0x298b3f){return logger[_0x8405('0x17')](_0x8405('0x27'),'afterCreate',_0x8405('0x3a'),util['inspect'](_0x298b3f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8405('0x27'),_0x8405('0x28'),'skebby',_0x8405('0x3b'));}break;case _0x8405('0x3c'):if(_0x15a189[_0x8405('0x1f')]){var _0x5d733d={'recipient':_0xff90a4[_0x8405('0x20')],'message':_0xff90a4['body'],'sender':_0x15a189[_0x8405('0x3d')]||_0x15a189[_0x8405('0x20')],'authorization':_0x15a189[_0x8405('0x1f')]};var _0x5e132b={'method':_0x8405('0x33'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x5d733d,'json':!![]};rp(_0x5e132b)[_0x8405('0x12')](function(_0x27a6ec){var _0xac5f4b={'messageId':_0x27a6ec[_0x8405('0x3e')]};if(!_0x15a189[_0x8405('0x38')]){_0xac5f4b[_0x8405('0x39')]=!![];}return _0x30705f['update'](_0xac5f4b);})[_0x8405('0x26')](function(_0x37ea80){logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x3c'),util[_0x8405('0x29')](_0x37ea80,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8405('0x27'),'afterCreate',_0x8405('0x3c'),_0x8405('0x3f'));}break;case'clicksend':if(_0x15a189[_0x8405('0x2f')]&&_0x15a189[_0x8405('0x2b')]){var _0x5d733d={'messages':[{'source':_0x8405('0x40'),'to':_0xff90a4[_0x8405('0x20')],'body':_0xff90a4[_0x8405('0xe')],'from':_0x15a189[_0x8405('0x3d')]||_0x15a189[_0x8405('0x20')]}]};var _0x27c3e1=util[_0x8405('0x41')]('%s:%s',_0x15a189['username'],_0x15a189[_0x8405('0x2b')]);var _0x5e132b={'method':_0x8405('0x33'),'uri':_0x8405('0x42'),'body':_0x5d733d,'headers':{'Authorization':util[_0x8405('0x41')]('Basic\x20%s',new Buffer(_0x27c3e1)[_0x8405('0x43')](_0x8405('0x44')))},'json':!![]};rp(_0x5e132b)['then'](function(_0x15c121){if(_0x15c121[_0x8405('0x45')]>=0xc8&&_0x15c121[_0x8405('0x45')]<=0xce){if(_0x15c121[_0x8405('0x46')]&&_0x15c121[_0x8405('0x46')][_0x8405('0x47')]>0x0){var _0x336927=_['head'](_0x15c121['data']['messages']);var _0x84020b={'messageId':_0x336927[_0x8405('0x48')]};if(!_0x15a189[_0x8405('0x38')]){_0x84020b[_0x8405('0x39')]=!![];}return _0x30705f['update'](_0x84020b);}else{logger['error'](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x49'),util[_0x8405('0x29')](_0x15c121,{'showHidden':![],'depth':null}));}}else{logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x49'),util['inspect'](_0x15c121,{'showHidden':![],'depth':null}));}})[_0x8405('0x26')](function(_0x4e9c9e){logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x49'),util[_0x8405('0x29')](_0x4e9c9e,{'showHidden':![],'depth':null}));});}else{logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),'clickSend',_0x8405('0x3b'));}break;case _0x8405('0x4a'):if(_0x15a189[_0x8405('0x4b')]&&_0x15a189[_0x8405('0x1f')]){var _0x5d733d={'dst':_0xff90a4['phone'],'text':_0xff90a4[_0x8405('0xe')],'src':_0x15a189[_0x8405('0x3d')]||_0x15a189[_0x8405('0x20')],'url':_0x15a189[_0x8405('0x4c')]+_0x8405('0x23')+_0xff90a4['id']+_0x8405('0x24')+_0x15a189[_0x8405('0x25')]};var _0x27c3e1=util['format'](_0x8405('0x4d'),_0x15a189['authId'],_0x15a189[_0x8405('0x1f')]);var _0x5e132b={'method':_0x8405('0x33'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x15a189[_0x8405('0x4b')]),'body':_0x5d733d,'headers':{'Authorization':util['format'](_0x8405('0x4e'),new Buffer(_0x27c3e1)[_0x8405('0x43')](_0x8405('0x44')))},'json':!![]};rp(_0x5e132b)[_0x8405('0x12')](function(_0x225a92){var _0x302abc={'messageId':_0x225a92[_0x8405('0x4f')][0x0]};return _0x30705f[_0x8405('0x13')](_0x302abc);})[_0x8405('0x26')](function(_0x59c3cf){logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x4a'),util['inspect'](_0x59c3cf,{'showHidden':![],'depth':null}));});}else{logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x4a'),_0x8405('0x50'));}break;case _0x8405('0x51'):if(_0x15a189['username']&&_0x15a189[_0x8405('0x2b')]){if(_0x15a189[_0x8405('0x52')]){var _0x4c25bc={'method':'POST','uri':_0x15a189[_0x8405('0x52')]+_0x8405('0x53'),'body':{'username':_0x15a189[_0x8405('0x2f')],'password':_0x15a189[_0x8405('0x2b')]},'json':!![]};return rp(_0x4c25bc)[_0x8405('0x12')](function(_0x3bbdc5){var _0x283dcb={'method':_0x8405('0x33'),'uri':_0x15a189[_0x8405('0x52')]+_0x8405('0x54'),'body':{'messages':[{'from':_0x15a189['phone'],'destinations':[{'to':_0xff90a4[_0x8405('0x20')]}],'text':_0xff90a4['body'],'notifyUrl':_0x15a189[_0x8405('0x4c')]+'/api/sms/messages/'+_0xff90a4['id']+_0x8405('0x24')+_0x15a189[_0x8405('0x25')],'notifyContentType':_0x8405('0x55'),'callbackData':_0x15a189[_0x8405('0x20')]+';'+_0xff90a4[_0x8405('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x3bbdc5[_0x8405('0x25')]},'json':!![]};return rp(_0x283dcb)['then'](function(_0x58fe94){if(_0x58fe94[_0x8405('0x21')]){var _0x5309be={'messageId':_0x58fe94[_0x8405('0x21')][0x0][_0x8405('0xc')]};if(!_0x15a189[_0x8405('0x38')]){_0x5309be['read']=!![];}return _0x30705f[_0x8405('0x13')](_0x5309be);}else{return logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x51'),util[_0x8405('0x29')](_0x58fe94,{'showHidden':![],'depth':null}));}});})['catch'](function(_0xd153b7){return logger[_0x8405('0x17')](_0x8405('0x27'),'afterCreate','infobip',util[_0x8405('0x29')](_0xd153b7,{'showHidden':![],'depth':null}));});}else{logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x51'),'Missing\x20parameters:\x20base_url');}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8405('0x28'),_0x8405('0x51'),_0x8405('0x3b'));}break;case _0x8405('0x56'):var _0x3d4d55=require(_0x8405('0x57'));if(_0x15a189[_0x8405('0x58')]){var _0x22ce58={};_0x22ce58[_0x8405('0x59')]=_0x15a189[_0x8405('0x2f')];_0x22ce58[_0x8405('0x20')]=_0xff90a4[_0x8405('0x20')];_0x22ce58['sender']=_0x15a189[_0x8405('0x20')];_0x22ce58[_0x8405('0x5a')]=_0xff90a4['body'];_0x22ce58[_0x8405('0x5b')]=+new Date();var _0x2a54bb='';var _0x2c0413='';var _0x3fd943=Object[_0x8405('0x5c')](_0x22ce58);_0x3fd943[_0x8405('0x5d')]();for(var _0x18bddb=0x0;_0x18bddb<_0x3fd943[_0x8405('0x5e')];_0x18bddb++){if(_0x2a54bb!=''){_0x2a54bb+='&';}_0x2a54bb+=_0x3fd943[_0x18bddb]+'='+encodeURIComponent(_0x22ce58[_0x3fd943[_0x18bddb]]);_0x2c0413+=_0x22ce58[_0x3fd943[_0x18bddb]];}_0x2c0413+=_0x15a189[_0x8405('0x58')];_0x2c0413=_0x3d4d55['createHash'](_0x8405('0x5f'))[_0x8405('0x13')](_0x2c0413)[_0x8405('0x60')]('hex');if(_0x2a54bb!==''){_0x2a54bb+='&';}_0x2a54bb+=_0x8405('0x61')+_0x2c0413;var _0x1f6114={'method':_0x8405('0x31'),'uri':_0x15a189[_0x8405('0x52')]+_0x8405('0x62')+_0x2a54bb,'json':!![]};return rp(_0x1f6114)['then'](function(_0x19c66a){var _0x373aa2=Object[_0x8405('0x5c')](_0x19c66a);if(_0x19c66a[_0x373aa2[0x0]][_0x8405('0x17')]&&parseInt(_0x19c66a[_0x373aa2[0x0]][_0x8405('0x17')])===0x0){var _0xc554dc={'messageId':_0x19c66a[_0x373aa2[0x0]][_0x8405('0x63')]};if(!_0x15a189[_0x8405('0x38')]){_0xc554dc[_0x8405('0x39')]=!![];}return _0x30705f['update'](_0xc554dc);}else{return logger[_0x8405('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8405('0x28'),_0x8405('0x56'),util['inspect'](_0x19c66a['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4a99b8){return logger[_0x8405('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8405('0x28'),_0x8405('0x56'),util[_0x8405('0x29')](_0x4a99b8,{'showHidden':![],'depth':null}));});}else{logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x56'),'Missing\x20parameters:\x20apiKey');}break;case _0x8405('0x64'):if(_0x15a189[_0x8405('0x58')]){var _0x538556={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x15a189['apiKey']},'body':{'content':_0xff90a4['body'],'to':[_0xff90a4['phone']],'from':_0x15a189[_0x8405('0x20')],'binary':![],'clientMessageId':_0x8405('0x65'),'charset':_0x8405('0x66')},'json':!![]};rp(_0x538556)[_0x8405('0x12')](function(_0x329fcc){if(!_0x329fcc['error']){var _0x3c17a8={'messageId':_0x329fcc[_0x8405('0x21')][0x0][_0x8405('0x67')]};if(!_0x15a189[_0x8405('0x38')]){_0x3c17a8[_0x8405('0x39')]=!![];}return _0x30705f['update'](_0x3c17a8);}else{return logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x64'),util[_0x8405('0x29')](_0x329fcc[_0x8405('0x17')],{'showHidden':![],'depth':null}));}})[_0x8405('0x26')](function(_0x1b2737){return logger['error'](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x64'),util[_0x8405('0x29')](_0x1b2737,{'showHidden':![],'depth':null}));});}else{logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x64'),_0x8405('0x68'));}break;case _0x8405('0x69'):if(_0x15a189[_0x8405('0x2f')]&&_0x15a189[_0x8405('0x2b')]){var _0x27c3e1=util[_0x8405('0x41')](_0x8405('0x4d'),_0x15a189[_0x8405('0x2f')],_0x15a189['password']);var _0x5e132b={'method':_0x8405('0x33'),'uri':_0x8405('0x6a')+_0x15a189['accountId']+_0x8405('0x6b'),'body':{'to':[_0xff90a4[_0x8405('0x20')]],'text':_0xff90a4[_0x8405('0xe')],'from':_0x15a189[_0x8405('0x20')],'applicationId':_0x15a189[_0x8405('0x6c')]},'headers':{'Authorization':util[_0x8405('0x41')](_0x8405('0x4e'),new Buffer(_0x27c3e1)[_0x8405('0x43')](_0x8405('0x44')))},'json':!![]};rp(_0x5e132b)[_0x8405('0x12')](function(_0x5be58d){if(_0x5be58d['id']){var _0x48ab26={'messageId':_0x5be58d['id']};return _0x30705f[_0x8405('0x13')](_0x48ab26);}else{logger[_0x8405('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8405('0x28'),_0x8405('0x69'),util[_0x8405('0x29')](_0x5be58d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x537624){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8405('0x28'),_0x8405('0x69'),util[_0x8405('0x29')](_0x537624,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x69'),_0x8405('0x3b'));}break;case'intelepeer':if(_0x15a189['apiKey']){var _0x31b673={};var _0x1f6114={'method':'POST','uri':_0x8405('0x6d'),'headers':{'Authorization':_0x8405('0x6e')+_0x15a189[_0x8405('0x58')],'Content-Type':'application/json'},'body':{'from':_0x15a189[_0x8405('0x20')],'to':_0xff90a4[_0x8405('0x20')],'text':_0xff90a4[_0x8405('0xe')]},'json':!![]};return rp(_0x1f6114)[_0x8405('0x12')](function(_0x42496c){if(_0x42496c[_0x8405('0x6f')]==0xca){_0x31b673[_0x8405('0x70')]=_0x42496c;var _0x2ca863={'method':_0x8405('0x33'),'uri':_0x8405('0x71'),'headers':{'Authorization':'Bearer\x20'+_0x15a189[_0x8405('0x58')],'Content-Type':_0x8405('0x55')},'body':{'refid':_0x31b673[_0x8405('0x70')]['refid']},'json':!![]};return rp(_0x2ca863)['then'](function(_0x572981){_0x31b673[_0x8405('0x72')]=_0x572981;var _0x305f8d={'messageId':_0x31b673[_0x8405('0x70')][_0x8405('0x73')],'read':!![]};return _0x30705f['update'](_0x305f8d);});}else{return logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x74'),util[_0x8405('0x29')](_0x42496c,{'showHidden':![],'depth':null}));}})[_0x8405('0x26')](function(_0xbd79a0){return logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),'intelepeer',util['inspect'](_0xbd79a0,{'showHidden':![],'depth':null}));});}else{return logger[_0x8405('0x17')](_0x8405('0x27'),_0x8405('0x28'),_0x8405('0x74'),_0x8405('0x75'));}break;}}})[_0x8405('0x76')](function(){_0x6979fd();});}else{_0x6979fd();}}},'charset':_0x8405('0x77'),'collate':_0x8405('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 7d50c1d..f238e30 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 _0x7ca9=['options','raw','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','CreateSmsMessage','create','body'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7ca9,0x1e0));var _0x97ca=function(_0x35d3a8,_0x44406a){_0x35d3a8=_0x35d3a8-0x0;var _0x182378=_0x7ca9[_0x35d3a8];return _0x182378;};'use strict';var _=require(_0x97ca('0x0'));var util=require(_0x97ca('0x1'));var moment=require(_0x97ca('0x2'));var BPromise=require(_0x97ca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97ca('0x4'));var db=require(_0x97ca('0x5'))['db'];var utils=require(_0x97ca('0x6'));var logger=require(_0x97ca('0x7'))(_0x97ca('0x8'));var config=require('../../config/environment');var jayson=require(_0x97ca('0x9'));var client=jayson[_0x97ca('0xa')][_0x97ca('0xb')]({'port':0x232a});config[_0x97ca('0xc')]=_[_0x97ca('0xd')](config['redis'],{'host':_0x97ca('0xe'),'port':0x18eb});var socket=require(_0x97ca('0xf'))(new Redis(config[_0x97ca('0xc')]));require('./smsMessage.socket')[_0x97ca('0x10')](socket);function respondWithRpcPromise(_0x3f1e00,_0x139b0c,_0x4f7380){return new BPromise(function(_0x1a17e4,_0x2461fe){return client[_0x97ca('0x11')](_0x3f1e00,_0x4f7380)['then'](function(_0x24c5b3){logger[_0x97ca('0x12')](_0x97ca('0x13'),_0x139b0c,_0x97ca('0x14'));logger[_0x97ca('0x15')](_0x97ca('0x16'),_0x139b0c,_0x97ca('0x14'),JSON['stringify'](_0x24c5b3));if(_0x24c5b3['error']){if(_0x24c5b3['error'][_0x97ca('0x17')]===0x1f4){logger['error'](_0x97ca('0x13'),_0x139b0c,_0x24c5b3[_0x97ca('0x18')]['message']);return _0x2461fe(_0x24c5b3[_0x97ca('0x18')]['message']);}logger[_0x97ca('0x18')](_0x97ca('0x13'),_0x139b0c,_0x24c5b3[_0x97ca('0x18')][_0x97ca('0x19')]);return _0x1a17e4(_0x24c5b3[_0x97ca('0x18')]['message']);}else{logger['info'](_0x97ca('0x13'),_0x139b0c,_0x97ca('0x14'));_0x1a17e4(_0x24c5b3[_0x97ca('0x1a')][_0x97ca('0x19')]);}})['catch'](function(_0x1e4a85){logger[_0x97ca('0x18')]('SmsMessage,\x20%s,\x20%s',_0x139b0c,_0x1e4a85);_0x2461fe(_0x1e4a85);});});}exports[_0x97ca('0x1b')]=function(_0xdab394){var _0x46f2ff=this;return new Promise(function(_0x2e5ff0,_0x44f7e7){return db['SmsMessage'][_0x97ca('0x1c')](_0xdab394[_0x97ca('0x1d')],{'raw':_0xdab394[_0x97ca('0x1e')]?_0xdab394[_0x97ca('0x1e')][_0x97ca('0x1f')]===undefined?!![]:![]:!![]})[_0x97ca('0x20')](function(_0x5229ac){logger['info']('CreateSmsMessage',_0xdab394);logger['debug'](_0x97ca('0x1b'),_0xdab394,JSON['stringify'](_0x5229ac));_0x2e5ff0(_0x5229ac);})[_0x97ca('0x21')](function(_0x33d58a){logger['error'](_0x97ca('0x1b'),_0x33d58a[_0x97ca('0x19')],_0xdab394);_0x44f7e7(_0x46f2ff[_0x97ca('0x18')](0x1f4,_0x33d58a[_0x97ca('0x19')]));});});}; \ No newline at end of file +var _0xd39c=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','then','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x25f684,_0x32675b){var _0x372fce=function(_0x5ea9c9){while(--_0x5ea9c9){_0x25f684['push'](_0x25f684['shift']());}};_0x372fce(++_0x32675b);}(_0xd39c,0x155));var _0xcd39=function(_0x56a8de,_0x2df185){_0x56a8de=_0x56a8de-0x0;var _0x4e5746=_0xd39c[_0x56a8de];return _0x4e5746;};'use strict';var _=require(_0xcd39('0x0'));var util=require('util');var moment=require(_0xcd39('0x1'));var BPromise=require(_0xcd39('0x2'));var rs=require(_0xcd39('0x3'));var fs=require('fs');var Redis=require(_0xcd39('0x4'));var db=require(_0xcd39('0x5'))['db'];var utils=require(_0xcd39('0x6'));var logger=require(_0xcd39('0x7'))(_0xcd39('0x8'));var config=require('../../config/environment');var jayson=require(_0xcd39('0x9'));var client=jayson[_0xcd39('0xa')][_0xcd39('0xb')]({'port':0x232a});config[_0xcd39('0xc')]=_[_0xcd39('0xd')](config[_0xcd39('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd39('0xe'))(new Redis(config[_0xcd39('0xc')]));require(_0xcd39('0xf'))[_0xcd39('0x10')](socket);function respondWithRpcPromise(_0x4e68c5,_0x595744,_0x138753){return new BPromise(function(_0x5c7344,_0x1a5c10){return client[_0xcd39('0x11')](_0x4e68c5,_0x138753)['then'](function(_0x5a0824){logger[_0xcd39('0x12')](_0xcd39('0x13'),_0x595744,_0xcd39('0x14'));logger['debug'](_0xcd39('0x15'),_0x595744,_0xcd39('0x14'),JSON[_0xcd39('0x16')](_0x5a0824));if(_0x5a0824[_0xcd39('0x17')]){if(_0x5a0824[_0xcd39('0x17')][_0xcd39('0x18')]===0x1f4){logger['error'](_0xcd39('0x13'),_0x595744,_0x5a0824[_0xcd39('0x17')][_0xcd39('0x19')]);return _0x1a5c10(_0x5a0824['error'][_0xcd39('0x19')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x595744,_0x5a0824['error']['message']);return _0x5c7344(_0x5a0824[_0xcd39('0x17')][_0xcd39('0x19')]);}else{logger['info'](_0xcd39('0x13'),_0x595744,_0xcd39('0x14'));_0x5c7344(_0x5a0824[_0xcd39('0x1a')]['message']);}})[_0xcd39('0x1b')](function(_0x55a9d0){logger[_0xcd39('0x17')]('SmsMessage,\x20%s,\x20%s',_0x595744,_0x55a9d0);_0x1a5c10(_0x55a9d0);});});}exports[_0xcd39('0x1c')]=function(_0x16e6bd){var _0x5b418e=this;return new Promise(function(_0x4caa39,_0x4da654){return db[_0xcd39('0x1d')][_0xcd39('0x1e')](_0x16e6bd[_0xcd39('0x1f')],{'raw':_0x16e6bd[_0xcd39('0x20')]?_0x16e6bd['options']['raw']===undefined?!![]:![]:!![]})[_0xcd39('0x21')](function(_0x3e8a5c){logger['info'](_0xcd39('0x1c'),_0x16e6bd);logger[_0xcd39('0x22')](_0xcd39('0x1c'),_0x16e6bd,JSON[_0xcd39('0x16')](_0x3e8a5c));_0x4caa39(_0x3e8a5c);})[_0xcd39('0x1b')](function(_0x21d080){logger[_0xcd39('0x17')](_0xcd39('0x1c'),_0x21d080['message'],_0x16e6bd);_0x4da654(_0x5b418e['error'](0x1f4,_0x21d080[_0xcd39('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 5e18025..4d0c6cf 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 _0x794d=['emit','register','length','smsMessage:','save','remove','update'];(function(_0x27bcf5,_0x236765){var _0x4ce4cf=function(_0x4864ea){while(--_0x4864ea){_0x27bcf5['push'](_0x27bcf5['shift']());}};_0x4ce4cf(++_0x236765);}(_0x794d,0x1e0));var _0xd794=function(_0x3968c9,_0x346c1b){_0x3968c9=_0x3968c9-0x0;var _0x790570=_0x794d[_0x3968c9];return _0x790570;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xd794('0x0'),_0xd794('0x1'),_0xd794('0x2')];function createListener(_0x3b6eb0,_0xf01edf){return function(_0x5a7120){_0xf01edf[_0xd794('0x3')](_0x3b6eb0,_0x5a7120);};}function removeListener(_0xcb2043,_0x481859){return function(){SmsMessageEvents['removeListener'](_0xcb2043,_0x481859);};}exports[_0xd794('0x4')]=function(_0xa0ddd1){for(var _0x4b613c=0x0,_0x3910e8=events[_0xd794('0x5')];_0x4b613c<_0x3910e8;_0x4b613c++){var _0x193f1d=events[_0x4b613c];var _0x29337b=createListener(_0xd794('0x6')+_0x193f1d,_0xa0ddd1);SmsMessageEvents['on'](_0x193f1d,_0x29337b);}}; \ No newline at end of file +var _0xcc89=['removeListener','register','smsMessage:','./smsMessage.events','save','update'];(function(_0x450434,_0x4d287b){var _0x3517bf=function(_0x3e646b){while(--_0x3e646b){_0x450434['push'](_0x450434['shift']());}};_0x3517bf(++_0x4d287b);}(_0xcc89,0x19b));var _0x9cc8=function(_0x242e40,_0x5dd054){_0x242e40=_0x242e40-0x0;var _0x3af01d=_0xcc89[_0x242e40];return _0x3af01d;};'use strict';var SmsMessageEvents=require(_0x9cc8('0x0'));var events=[_0x9cc8('0x1'),'remove',_0x9cc8('0x2')];function createListener(_0x29e5fc,_0x2b283f){return function(_0x257d12){_0x2b283f['emit'](_0x29e5fc,_0x257d12);};}function removeListener(_0x4d4ed8,_0x19f551){return function(){SmsMessageEvents[_0x9cc8('0x3')](_0x4d4ed8,_0x19f551);};}exports[_0x9cc8('0x4')]=function(_0x11b277){for(var _0x3c3a41=0x0,_0x2dba33=events['length'];_0x3c3a41<_0x2dba33;_0x3c3a41++){var _0x256b8e=events[_0x3c3a41];var _0x442e74=createListener(_0x9cc8('0x5')+_0x256b8e,_0x11b277);SmsMessageEvents['on'](_0x256b8e,_0x442e74);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 8d73654..ed58abd 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 _0x749a=['post','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create'];(function(_0x12d44c,_0xf11296){var _0x4fde20=function(_0x3c1ad6){while(--_0x3c1ad6){_0x12d44c['push'](_0x12d44c['shift']());}};_0x4fde20(++_0xf11296);}(_0x749a,0xd4));var _0xa749=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x749a[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xa749('0x0'));var util=require(_0xa749('0x1'));var path=require('path');var timeout=require(_0xa749('0x2'));var express=require(_0xa749('0x3'));var router=express[_0xa749('0x4')]();var fs_extra=require(_0xa749('0x5'));var auth=require(_0xa749('0x6'));var interaction=require(_0xa749('0x7'));var config=require(_0xa749('0x8'));var controller=require('./smsQueue.controller');router[_0xa749('0x9')]('/',auth[_0xa749('0xa')](),controller[_0xa749('0xb')]);router[_0xa749('0x9')](_0xa749('0xc'),auth[_0xa749('0xa')](),controller[_0xa749('0xd')]);router[_0xa749('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa749('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xa749('0xe')]);router['get'](_0xa749('0xf'),auth[_0xa749('0xa')](),controller[_0xa749('0x10')]);router[_0xa749('0x9')](_0xa749('0x11'),auth[_0xa749('0xa')](),controller[_0xa749('0x12')]);router['post']('/',auth[_0xa749('0xa')](),controller[_0xa749('0x13')]);router[_0xa749('0x14')](_0xa749('0xf'),auth[_0xa749('0xa')](),controller[_0xa749('0x15')]);router[_0xa749('0x14')](_0xa749('0x11'),auth[_0xa749('0xa')](),controller[_0xa749('0x16')]);router[_0xa749('0x17')](_0xa749('0x18'),auth['isAuthenticated'](),controller[_0xa749('0x19')]);router[_0xa749('0x1a')]('/:id',auth[_0xa749('0xa')](),controller[_0xa749('0x1b')]);router[_0xa749('0x1a')]('/:id/teams',auth['isAuthenticated'](),controller[_0xa749('0x1c')]);router[_0xa749('0x1a')](_0xa749('0x11'),auth[_0xa749('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x4994=['get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addAgents','put','update','/:id/users','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x1b629e,_0x53f535){var _0x5d5893=function(_0x3d3657){while(--_0x3d3657){_0x1b629e['push'](_0x1b629e['shift']());}};_0x5d5893(++_0x53f535);}(_0x4994,0x82));var _0x4499=function(_0x2725a9,_0x2266b6){_0x2725a9=_0x2725a9-0x0;var _0x521098=_0x4994[_0x2725a9];return _0x521098;};'use strict';var multer=require('multer');var util=require(_0x4499('0x0'));var path=require(_0x4499('0x1'));var timeout=require(_0x4499('0x2'));var express=require(_0x4499('0x3'));var router=express[_0x4499('0x4')]();var fs_extra=require(_0x4499('0x5'));var auth=require(_0x4499('0x6'));var interaction=require(_0x4499('0x7'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router['get']('/',auth[_0x4499('0x8')](),controller[_0x4499('0x9')]);router[_0x4499('0xa')](_0x4499('0xb'),auth[_0x4499('0x8')](),controller[_0x4499('0xc')]);router[_0x4499('0xa')](_0x4499('0xd'),auth['isAuthenticated'](),controller[_0x4499('0xe')]);router[_0x4499('0xa')](_0x4499('0xf'),auth[_0x4499('0x8')](),controller[_0x4499('0x10')]);router[_0x4499('0xa')](_0x4499('0x11'),auth['isAuthenticated'](),controller[_0x4499('0x12')]);router[_0x4499('0xa')]('/:id/users',auth[_0x4499('0x8')](),controller[_0x4499('0x13')]);router[_0x4499('0x14')]('/',auth[_0x4499('0x8')](),controller[_0x4499('0x15')]);router[_0x4499('0x14')](_0x4499('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0x4499('0x14')]('/:id/users',auth[_0x4499('0x8')](),controller[_0x4499('0x16')]);router[_0x4499('0x17')](_0x4499('0xd'),auth['isAuthenticated'](),controller[_0x4499('0x18')]);router['delete'](_0x4499('0xd'),auth[_0x4499('0x8')](),controller['destroy']);router['delete']('/:id/teams',auth[_0x4499('0x8')](),controller['removeTeams']);router['delete'](_0x4499('0x19'),auth[_0x4499('0x8')](),controller[_0x4499('0x1a')]);module[_0x4499('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7bed0e1..76b203f 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 _0xa90e=['sequelize','exports','name','STRING','INTEGER','ENUM','beepall','roundrobin'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0xa90e,0xf0));var _0xea90=function(_0x103e86,_0x1fc923){_0x103e86=_0x103e86-0x0;var _0x2113eb=_0xa90e[_0x103e86];return _0x2113eb;};'use strict';var Sequelize=require(_0xea90('0x0'));module[_0xea90('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xea90('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea90('0x3')]},'timeout':{'type':Sequelize[_0xea90('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xea90('0x5')]('rrmemory',_0xea90('0x6'),_0xea90('0x7'))}}; \ No newline at end of file +var _0xac6d=['rrmemory','sequelize','exports','STRING','name'];(function(_0x566c7d,_0x363df7){var _0x165a34=function(_0x4a718f){while(--_0x4a718f){_0x566c7d['push'](_0x566c7d['shift']());}};_0x165a34(++_0x363df7);}(_0xac6d,0xa6));var _0xdac6=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0xac6d[_0x3f0b30];return _0x2748a5;};'use strict';var Sequelize=require(_0xdac6('0x0'));module[_0xdac6('0x1')]={'name':{'type':Sequelize[_0xdac6('0x2')],'unique':_0xdac6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdac6('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xdac6('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 55b27ce..47e37b0 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 _0x92ac=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','findOne','UserSmsQueue','SmsQueueId','options','findAndCountAll','UserId','smsPause','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','User','select','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','compact','value','userSmsQueue:remove','addAgents','omit','ids','removeAgents','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','status','undefined','limit','count','offset','set','json','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','sendStatus','error','stack','name','send','SmsQueue','fieldName','type','key','query','filters','intersection','model','attributes','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x92ac,0x151));var _0xc92a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x92ac[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xc92a('0x0'));var rimraf=require(_0xc92a('0x1'));var zipdir=require(_0xc92a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc92a('0x3'));var BPromise=require(_0xc92a('0x4'));var Mustache=require(_0xc92a('0x5'));var util=require(_0xc92a('0x6'));var path=require(_0xc92a('0x7'));var sox=require(_0xc92a('0x8'));var csv=require('to-csv');var ejs=require(_0xc92a('0x9'));var fs=require('fs');var fs_extra=require(_0xc92a('0xa'));var _=require(_0xc92a('0xb'));var squel=require(_0xc92a('0xc'));var crypto=require(_0xc92a('0xd'));var jsforce=require(_0xc92a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc92a('0xf'));var Redis=require(_0xc92a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc92a('0x11'));var as=require(_0xc92a('0x12'));var hardwareService=require(_0xc92a('0x13'));var logger=require('../../config/logger')(_0xc92a('0x14'));var utils=require(_0xc92a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc92a('0x16'));var db=require(_0xc92a('0x17'))['db'];config['redis']=_['defaults'](config[_0xc92a('0x18')],{'host':_0xc92a('0x19'),'port':0x18eb});var socket=require(_0xc92a('0x1a'))(new Redis(config[_0xc92a('0x18')]));require(_0xc92a('0x1b'))[_0xc92a('0x1c')](socket);function respondWithStatusCode(_0x47d18b,_0x20c3a0){_0x20c3a0=_0x20c3a0||0xcc;return function(_0x513db4){if(_0x513db4){return _0x47d18b['sendStatus'](_0x20c3a0);}return _0x47d18b[_0xc92a('0x1d')](_0x20c3a0)['end']();};}function respondWithResult(_0x265c10,_0x5b7855){_0x5b7855=_0x5b7855||0xc8;return function(_0x373dcf){if(_0x373dcf){return _0x265c10[_0xc92a('0x1d')](_0x5b7855)['json'](_0x373dcf);}};}function respondWithFilteredResult(_0x41a86b,_0x57a792){return function(_0x32fbf0){if(_0x32fbf0){var _0x482448=typeof _0x57a792['offset']===_0xc92a('0x1e')&&typeof _0x57a792[_0xc92a('0x1f')]===_0xc92a('0x1e');var _0x394135=_0x32fbf0[_0xc92a('0x20')];var _0x1c879a=_0x482448?0x0:_0x57a792[_0xc92a('0x21')];var _0x5f3a1a=_0x482448?_0x32fbf0['count']:_0x57a792['offset']+_0x57a792[_0xc92a('0x1f')];var _0x4119c3;if(_0x5f3a1a>=_0x394135){_0x5f3a1a=_0x394135;_0x4119c3=0xc8;}else{_0x4119c3=0xce;}_0x41a86b[_0xc92a('0x1d')](_0x4119c3);return _0x41a86b[_0xc92a('0x22')]('Content-Range',_0x1c879a+'-'+_0x5f3a1a+'/'+_0x394135)[_0xc92a('0x23')](_0x32fbf0);}return null;};}function patchUpdates(_0x271b7a){return function(_0x319e0a){try{jsonpatch['apply'](_0x319e0a,_0x271b7a,!![]);}catch(_0x796e55){return BPromise[_0xc92a('0x24')](_0x796e55);}return _0x319e0a[_0xc92a('0x25')]();};}function saveUpdates(_0x36736d,_0x3367d4){return function(_0x240e9e){if(_0x240e9e){return _0x240e9e[_0xc92a('0x26')](_0x36736d)[_0xc92a('0x27')](function(_0x39cbf7){return _0x39cbf7;});}return null;};}function removeEntity(_0x2a42a2,_0x211fe0){return function(_0x4b16d5){if(_0x4b16d5){return _0x4b16d5[_0xc92a('0x28')]()[_0xc92a('0x27')](function(){var _0x1f7d65=_0x4b16d5[_0xc92a('0x29')]({'plain':!![]});var _0x599673=_0xc92a('0x2a');return db[_0xc92a('0x2b')][_0xc92a('0x28')]({'where':{'type':_0x599673,'resourceId':_0x1f7d65['id']}})[_0xc92a('0x27')](function(){return _0x4b16d5;});})[_0xc92a('0x27')](function(){_0x2a42a2[_0xc92a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x628123,_0x337cd3){return function(_0x5835a8){if(!_0x5835a8){_0x628123[_0xc92a('0x2c')](0x194);}return _0x5835a8;};}function handleError(_0x2b2557,_0x4a0a7c){_0x4a0a7c=_0x4a0a7c||0x1f4;return function(_0x59070f){logger[_0xc92a('0x2d')](_0x59070f[_0xc92a('0x2e')]);if(_0x59070f[_0xc92a('0x2f')]){delete _0x59070f[_0xc92a('0x2f')];}_0x2b2557[_0xc92a('0x1d')](_0x4a0a7c)[_0xc92a('0x30')](_0x59070f);};}exports['index']=function(_0x3224a9,_0x40af82){var _0xcf4e12={},_0x40976b={},_0x45dabc={'count':0x0,'rows':[]};var _0x5705d8=_['map'](db[_0xc92a('0x31')]['rawAttributes'],function(_0x122220){return{'name':_0x122220[_0xc92a('0x32')],'type':_0x122220[_0xc92a('0x33')][_0xc92a('0x34')]};});_0x40976b['model']=_['map'](_0x5705d8,'name');_0x40976b[_0xc92a('0x35')]=_['keys'](_0x3224a9['query']);_0x40976b[_0xc92a('0x36')]=_[_0xc92a('0x37')](_0x40976b[_0xc92a('0x38')],_0x40976b[_0xc92a('0x35')]);_0xcf4e12[_0xc92a('0x39')]=_[_0xc92a('0x37')](_0x40976b[_0xc92a('0x38')],qs[_0xc92a('0x3a')](_0x3224a9[_0xc92a('0x35')][_0xc92a('0x3a')]));_0xcf4e12[_0xc92a('0x39')]=_0xcf4e12[_0xc92a('0x39')][_0xc92a('0x3b')]?_0xcf4e12[_0xc92a('0x39')]:_0x40976b[_0xc92a('0x38')];if(!_0x3224a9[_0xc92a('0x35')][_0xc92a('0x3c')](_0xc92a('0x3d'))){_0xcf4e12[_0xc92a('0x1f')]=qs[_0xc92a('0x1f')](_0x3224a9['query'][_0xc92a('0x1f')]);_0xcf4e12[_0xc92a('0x21')]=qs['offset'](_0x3224a9['query'][_0xc92a('0x21')]);}_0xcf4e12[_0xc92a('0x3e')]=qs[_0xc92a('0x3f')](_0x3224a9[_0xc92a('0x35')]['sort']);_0xcf4e12[_0xc92a('0x40')]=qs[_0xc92a('0x36')](_[_0xc92a('0x41')](_0x3224a9[_0xc92a('0x35')],_0x40976b[_0xc92a('0x36')]),_0x5705d8);if(_0x3224a9['query'][_0xc92a('0x42')]){_0xcf4e12[_0xc92a('0x40')]=_['merge'](_0xcf4e12[_0xc92a('0x40')],{'$or':_[_0xc92a('0x43')](_0x5705d8,function(_0x362269){if(_0x362269[_0xc92a('0x33')]!==_0xc92a('0x44')){var _0x1203d3={};_0x1203d3[_0x362269[_0xc92a('0x2f')]]={'$like':'%'+_0x3224a9[_0xc92a('0x35')][_0xc92a('0x42')]+'%'};return _0x1203d3;}})});}_0xcf4e12=_[_0xc92a('0x45')]({},_0xcf4e12,_0x3224a9['options']);var _0x1436b0={'where':_0xcf4e12['where']};return db[_0xc92a('0x31')][_0xc92a('0x20')](_0x1436b0)[_0xc92a('0x27')](function(_0x564a19){_0x45dabc[_0xc92a('0x20')]=_0x564a19;if(_0x3224a9[_0xc92a('0x35')][_0xc92a('0x46')]){_0xcf4e12[_0xc92a('0x47')]=[{'all':!![]}];}return db[_0xc92a('0x31')][_0xc92a('0x48')](_0xcf4e12);})[_0xc92a('0x27')](function(_0x56a1cb){_0x45dabc[_0xc92a('0x49')]=_0x56a1cb;return _0x45dabc;})[_0xc92a('0x27')](respondWithFilteredResult(_0x40af82,_0xcf4e12))[_0xc92a('0x4a')](handleError(_0x40af82,null));};exports['show']=function(_0x45777c,_0x3f1ab4){var _0x26e2bd={'raw':!![],'where':{'id':_0x45777c[_0xc92a('0x4b')]['id']}},_0x4e13f4={};_0x4e13f4[_0xc92a('0x38')]=_[_0xc92a('0x4c')](db[_0xc92a('0x31')][_0xc92a('0x4d')]);_0x4e13f4[_0xc92a('0x35')]=_[_0xc92a('0x4c')](_0x45777c['query']);_0x4e13f4['filters']=_[_0xc92a('0x37')](_0x4e13f4[_0xc92a('0x38')],_0x4e13f4[_0xc92a('0x35')]);_0x26e2bd[_0xc92a('0x39')]=_['intersection'](_0x4e13f4[_0xc92a('0x38')],qs['fields'](_0x45777c[_0xc92a('0x35')][_0xc92a('0x3a')]));_0x26e2bd[_0xc92a('0x39')]=_0x26e2bd[_0xc92a('0x39')][_0xc92a('0x3b')]?_0x26e2bd[_0xc92a('0x39')]:_0x4e13f4[_0xc92a('0x38')];if(_0x45777c['query'][_0xc92a('0x46')]){_0x26e2bd[_0xc92a('0x47')]=[{'all':!![]}];}_0x26e2bd=_[_0xc92a('0x45')]({},_0x26e2bd,_0x45777c['options']);return db[_0xc92a('0x31')]['find'](_0x26e2bd)[_0xc92a('0x27')](handleEntityNotFound(_0x3f1ab4,null))[_0xc92a('0x27')](respondWithResult(_0x3f1ab4,null))[_0xc92a('0x4a')](handleError(_0x3f1ab4,null));};exports[_0xc92a('0x4e')]=function(_0x57b042,_0x177c70){return db[_0xc92a('0x31')][_0xc92a('0x4e')](_0x57b042[_0xc92a('0x4f')],{})[_0xc92a('0x27')](function(_0x238009){var _0x4276e2=_0x57b042[_0xc92a('0x50')][_0xc92a('0x29')]({'plain':!![]});if(!_0x4276e2)throw new Error(_0xc92a('0x51'));if(_0x4276e2['role']===_0xc92a('0x50')){var _0x487972=_0x238009[_0xc92a('0x29')]({'plain':!![]});var _0x573a22=_0xc92a('0x2a');return db[_0xc92a('0x52')]['find']({'where':{'name':_0x573a22,'userProfileId':_0x4276e2[_0xc92a('0x53')]},'raw':!![]})['then'](function(_0xbfd5d3){if(_0xbfd5d3&&_0xbfd5d3[_0xc92a('0x54')]===0x0){return db[_0xc92a('0x2b')][_0xc92a('0x4e')]({'name':_0x487972[_0xc92a('0x2f')],'resourceId':_0x487972['id'],'type':_0xbfd5d3[_0xc92a('0x2f')],'sectionId':_0xbfd5d3['id']},{})[_0xc92a('0x27')](function(){return _0x238009;});}else{return _0x238009;}})['catch'](function(_0x40f91f){logger[_0xc92a('0x2d')](_0xc92a('0x55'),_0x40f91f);throw _0x40f91f;});}return _0x238009;})[_0xc92a('0x27')](respondWithResult(_0x177c70,0xc9))[_0xc92a('0x4a')](handleError(_0x177c70,null));};exports[_0xc92a('0x26')]=function(_0x319bf4,_0x22c5f0){if(_0x319bf4[_0xc92a('0x4f')]['id']){delete _0x319bf4[_0xc92a('0x4f')]['id'];}return db[_0xc92a('0x31')][_0xc92a('0x56')]({'where':{'id':_0x319bf4[_0xc92a('0x4b')]['id']}})[_0xc92a('0x27')](handleEntityNotFound(_0x22c5f0,null))[_0xc92a('0x27')](saveUpdates(_0x319bf4[_0xc92a('0x4f')],null))['then'](respondWithResult(_0x22c5f0,null))[_0xc92a('0x4a')](handleError(_0x22c5f0,null));};exports[_0xc92a('0x28')]=function(_0x5f5678,_0x25b2d0){return db[_0xc92a('0x31')]['find']({'where':{'id':_0x5f5678[_0xc92a('0x4b')]['id']}})[_0xc92a('0x27')](handleEntityNotFound(_0x25b2d0,null))[_0xc92a('0x27')](removeEntity(_0x25b2d0,null))[_0xc92a('0x4a')](handleError(_0x25b2d0,null));};exports[_0xc92a('0x57')]=function(_0x1ad0ab,_0xa9c0a0){return db['SmsQueue'][_0xc92a('0x57')]()['then'](respondWithResult(_0xa9c0a0,null))['catch'](handleError(_0xa9c0a0,null));};exports['getMembers']=function(_0x5c11e5,_0x1bd93d,_0x35a5a6){var _0x4e87fd={'raw':!![],'where':{}},_0x592b9e={},_0x2611bb;return db[_0xc92a('0x31')][_0xc92a('0x58')]({'where':{'id':_0x5c11e5['params']['id']}})[_0xc92a('0x27')](handleEntityNotFound(_0x1bd93d,null))[_0xc92a('0x27')](function(_0x2d3451){if(_0x2d3451){_0x2611bb=_0x2d3451[_0xc92a('0x29')]({'plain':!![]});_0x592b9e[_0xc92a('0x38')]=_[_0xc92a('0x4c')](db[_0xc92a('0x59')][_0xc92a('0x4d')]);_0x592b9e['query']=_[_0xc92a('0x4c')](_0x5c11e5[_0xc92a('0x35')]);_0x592b9e[_0xc92a('0x36')]=_[_0xc92a('0x37')](_0x592b9e[_0xc92a('0x38')],_0x592b9e[_0xc92a('0x35')]);_0x4e87fd[_0xc92a('0x39')]=_[_0xc92a('0x37')](_0x592b9e[_0xc92a('0x38')],qs[_0xc92a('0x3a')](_0x5c11e5[_0xc92a('0x35')][_0xc92a('0x3a')]));_0x4e87fd[_0xc92a('0x39')]=_0x4e87fd[_0xc92a('0x39')][_0xc92a('0x3b')]?_0x4e87fd[_0xc92a('0x39')]:_0x592b9e[_0xc92a('0x38')];if(!_0x5c11e5[_0xc92a('0x35')][_0xc92a('0x3c')](_0xc92a('0x3d'))){_0x4e87fd[_0xc92a('0x1f')]=qs[_0xc92a('0x1f')](_0x5c11e5[_0xc92a('0x35')][_0xc92a('0x1f')]);_0x4e87fd[_0xc92a('0x21')]=qs[_0xc92a('0x21')](_0x5c11e5[_0xc92a('0x35')][_0xc92a('0x21')]);}_0x4e87fd[_0xc92a('0x3e')]=qs[_0xc92a('0x3f')](_0x5c11e5['query'][_0xc92a('0x3f')]);_0x4e87fd[_0xc92a('0x40')]=qs['filters'](_[_0xc92a('0x41')](_0x5c11e5['query'],_0x592b9e[_0xc92a('0x36')]));_0x4e87fd[_0xc92a('0x40')][_0xc92a('0x5a')]=_0x2d3451['id'];if(_0x5c11e5['query'][_0xc92a('0x42')]){_0x4e87fd['where']=_[_0xc92a('0x45')](_0x4e87fd[_0xc92a('0x40')],{'$or':_[_0xc92a('0x43')](_0x4e87fd[_0xc92a('0x39')],function(_0x5ac00d){var _0x310fd0={};_0x310fd0[_0x5ac00d]={'$like':'%'+_0x5c11e5[_0xc92a('0x35')][_0xc92a('0x42')]+'%'};return _0x310fd0;})});}_0x4e87fd=_[_0xc92a('0x45')]({},_0x4e87fd,_0x5c11e5[_0xc92a('0x5b')]);return db[_0xc92a('0x59')][_0xc92a('0x48')](_0x4e87fd);}})[_0xc92a('0x27')](function(_0x27d82c){if(_0x27d82c){return db['User'][_0xc92a('0x5c')]({'where':{'id':_[_0xc92a('0x43')](_0x27d82c,_0xc92a('0x5d')),'role':'agent'},'attributes':['id','name',_0xc92a('0x5e'),'updatedAt','createdAt']});}})['then'](function(_0x2717fd){if(_0x2717fd){return{'count':_0x2717fd['count'],'rows':_[_0xc92a('0x43')](_0x2717fd[_0xc92a('0x49')],function(_0x5f3974){return{'membername':_0x5f3974[_0xc92a('0x2f')],'UserId':_0x5f3974['id'],'queue_name':_0x2611bb[_0xc92a('0x2f')],'SmsQueueId':_0x2611bb['id'],'interface':util[_0xc92a('0x5f')](_0xc92a('0x60'),_0xc92a('0x61'),_0x5f3974[_0xc92a('0x2f')]),'penalty':0x0,'paused':_0x5f3974['smsPause'],'createdAt':_0x5f3974[_0xc92a('0x62')],'updatedAt':_0x5f3974['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc92a('0x27')](respondWithFilteredResult(_0x1bd93d,_0x4e87fd))['catch'](handleError(_0x1bd93d,null));};exports[_0xc92a('0x63')]=function(_0x1ce03a,_0x646fb2,_0x89a1d){var _0x581c42={};var _0x4c5fc9={};var _0x2f7161;var _0x4c10d0;return db['SmsQueue'][_0xc92a('0x58')]({'where':{'id':_0x1ce03a[_0xc92a('0x4b')]['id']}})[_0xc92a('0x27')](handleEntityNotFound(_0x646fb2,null))[_0xc92a('0x27')](function(_0x332e42){if(_0x332e42){_0x2f7161=_0x332e42;_0x4c5fc9[_0xc92a('0x38')]=_[_0xc92a('0x4c')](db[_0xc92a('0x64')][_0xc92a('0x4d')]);_0x4c5fc9['query']=_[_0xc92a('0x4c')](_0x1ce03a[_0xc92a('0x35')]);_0x4c5fc9[_0xc92a('0x36')]=_[_0xc92a('0x37')](_0x4c5fc9[_0xc92a('0x38')],_0x4c5fc9[_0xc92a('0x35')]);_0x581c42[_0xc92a('0x39')]=_[_0xc92a('0x37')](_0x4c5fc9[_0xc92a('0x38')],qs['fields'](_0x1ce03a[_0xc92a('0x35')][_0xc92a('0x3a')]));_0x581c42[_0xc92a('0x39')]=_0x581c42[_0xc92a('0x39')]['length']?_0x581c42[_0xc92a('0x39')]:_0x4c5fc9[_0xc92a('0x38')];_0x581c42[_0xc92a('0x3e')]=qs['sort'](_0x1ce03a['query'][_0xc92a('0x3f')]);_0x581c42['where']=qs[_0xc92a('0x36')](_[_0xc92a('0x41')](_0x1ce03a['query'],_0x4c5fc9['filters']));if(_0x1ce03a[_0xc92a('0x35')][_0xc92a('0x42')]){_0x581c42[_0xc92a('0x40')]=_[_0xc92a('0x45')](_0x581c42[_0xc92a('0x40')],{'$or':_[_0xc92a('0x43')](_0x581c42[_0xc92a('0x39')],function(_0x36b1ef){var _0x25bb65={};_0x25bb65[_0x36b1ef]={'$like':'%'+_0x1ce03a[_0xc92a('0x35')][_0xc92a('0x42')]+'%'};return _0x25bb65;})});}_0x581c42=_[_0xc92a('0x45')]({},_0x581c42,_0x1ce03a[_0xc92a('0x5b')]);return _0x2f7161[_0xc92a('0x63')](_0x581c42);}})[_0xc92a('0x27')](function(_0x5ee54e){if(_0x5ee54e){_0x4c10d0=_0x5ee54e[_0xc92a('0x3b')];if(!_0x1ce03a['query'][_0xc92a('0x3c')]('nolimit')){_0x581c42[_0xc92a('0x1f')]=qs[_0xc92a('0x1f')](_0x1ce03a['query'][_0xc92a('0x1f')]);_0x581c42[_0xc92a('0x21')]=qs[_0xc92a('0x21')](_0x1ce03a['query'][_0xc92a('0x21')]);}return _0x2f7161[_0xc92a('0x63')](_0x581c42);}})['then'](function(_0x5999d8){if(_0x5999d8){return _0x5999d8?{'count':_0x4c10d0,'rows':_0x5999d8}:null;}})[_0xc92a('0x27')](respondWithResult(_0x646fb2,null))['catch'](handleError(_0x646fb2,null));};exports[_0xc92a('0x65')]=function(_0x45428b,_0x343fc9,_0x1fdb5e){var _0x1bf700=_0x45428b[_0xc92a('0x4f')]['ids'];return db['Team']['findAll']({'where':{'id':_0x1bf700},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc92a('0x66'),'attributes':['id','name','online',_0xc92a('0x67'),_0xc92a('0x68')],'raw':!![]}]})[_0xc92a('0x27')](function(_0x492f63){if(_0x492f63){var _0x3c5801=_[_0xc92a('0x69')](_0x492f63,function(_0x1693d3){var _0xc7a257=_0x1693d3[_0xc92a('0x29')]({'plain':!![]});return _0xc7a257[_0xc92a('0x66')];});return db[_0xc92a('0x31')][_0xc92a('0x56')]({'where':{'id':_0x45428b['params']['id']}})[_0xc92a('0x27')](function(_0x5f15f5){return db[_0xc92a('0x6a')][_0xc92a('0x6b')](function(_0x51db6e){return _0x5f15f5[_0xc92a('0x65')](_0x1bf700,{'transaction':_0x51db6e})[_0xc92a('0x27')](function(){return BPromise[_0xc92a('0x6c')](_0x3c5801,function(_0x403cf4){return db[_0xc92a('0x59')][_0xc92a('0x6d')]({'where':{'UserId':_0x403cf4['id'],'SmsQueueId':_0x45428b[_0xc92a('0x4b')]['id']},'transaction':_0x51db6e});});})[_0xc92a('0x27')](function(){_0x3c5801[_0xc92a('0x6e')](function(_0x25eaae){socket[_0xc92a('0x6f')](_0xc92a('0x70'),{'UserId':_0x25eaae['id'],'SmsQueueId':_0x5f15f5['id']});});});});});}})[_0xc92a('0x27')](respondWithStatusCode(_0x343fc9,null))[_0xc92a('0x4a')](handleError(_0x343fc9,null));};exports['removeTeams']=function(_0x31a074,_0x48e05c,_0x3a3c55){return db[_0xc92a('0x64')][_0xc92a('0x48')]({'where':{'id':_0x31a074['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xc92a('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc92a('0x27')](handleEntityNotFound(_0x48e05c,null))['then'](function(_0x14c2d2){var _0x49cd4b=_[_0xc92a('0x43')](_0x14c2d2,'id');var _0x2ff9b6=[];var _0x409ec7=[];var _0x3378fb=squel[_0xc92a('0x72')]();_0x3378fb['field']('tq.TeamId')['from'](_0xc92a('0x73'),'tq')[_0xc92a('0x74')](_0xc92a('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xc92a('0x76'),_0x31a074[_0xc92a('0x4b')]['id']);for(var _0x303172=0x0;_0x303172<_0x14c2d2[_0xc92a('0x3b')];_0x303172+=0x1){let _0x2cde12=_0x14c2d2[_0x303172];for(var _0x3be7c1=0x0;_0x3be7c1<_0x2cde12[_0xc92a('0x66')][_0xc92a('0x3b')];_0x3be7c1+=0x1){let _0xfd4132=_0x2cde12[_0xc92a('0x66')][_0x3be7c1];var _0x1ec6a0=_0x3378fb['clone']();_0x1ec6a0['where']('ut.UserId\x20=\x20?',_0xfd4132['id']);_0x409ec7['push'](db[_0xc92a('0x6a')]['query'](_0x1ec6a0[_0xc92a('0x77')](),{'type':db[_0xc92a('0x6a')][_0xc92a('0x78')][_0xc92a('0x79')]})[_0xc92a('0x27')](function(_0xebe839){if(_0xebe839[_0xc92a('0x3b')]===0x1){return _0xfd4132['id'];}else{var _0x2c54b0=_[_0xc92a('0x7a')](_['map'](_0xebe839,_0xc92a('0x7b')),function(_0x2d41b6){return _['includes'](_0x49cd4b,_0x2d41b6);});if(_0x2c54b0){return _0xfd4132['id'];}}}));}}return BPromise['all'](_0x409ec7)['then'](function(_0x33b128){_0x2ff9b6=_(_0x2ff9b6)['union'](_0x33b128)[_0xc92a('0x7c')]()[_0xc92a('0x7d')]();return db[_0xc92a('0x31')][_0xc92a('0x56')]({'where':{'id':_0x31a074[_0xc92a('0x4b')]['id']}})['then'](function(_0x5ea4a1){return db[_0xc92a('0x6a')]['transaction'](function(_0x5b9072){return _0x5ea4a1['removeTeams'](_0x31a074['query']['ids'],{'transaction':_0x5b9072})[_0xc92a('0x27')](function(){if(!_['isEmpty'](_0x2ff9b6)){return _0x5ea4a1['removeAgents'](_0x2ff9b6,{'transaction':_0x5b9072});}})['then'](function(){_0x2ff9b6[_0xc92a('0x6e')](function(_0x49b825){socket[_0xc92a('0x6f')](_0xc92a('0x7e'),{'UserId':_0x49b825,'SmsQueueId':_0x5ea4a1['id']});});});});});});})['then'](respondWithStatusCode(_0x48e05c,null))[_0xc92a('0x4a')](handleError(_0x48e05c,null));};exports[_0xc92a('0x7f')]=function(_0x102563,_0xcba7e1,_0x45ad38){return db[_0xc92a('0x31')][_0xc92a('0x56')]({'where':{'id':_0x102563[_0xc92a('0x4b')]['id']}})[_0xc92a('0x27')](handleEntityNotFound(_0xcba7e1,null))['then'](function(_0x237bdc){if(_0x237bdc){return _0x237bdc[_0xc92a('0x7f')](_0x102563[_0xc92a('0x4f')]['ids'],_[_0xc92a('0x80')](_0x102563[_0xc92a('0x4f')],['ids','id'])||{})['spread'](function(_0x4414f1){for(var _0x286d3c=0x0;_0x286d3c<_0x102563[_0xc92a('0x4f')][_0xc92a('0x81')][_0xc92a('0x3b')];_0x286d3c+=0x1){socket[_0xc92a('0x6f')](_0xc92a('0x70'),{'UserId':Number(_0x102563[_0xc92a('0x4f')][_0xc92a('0x81')][_0x286d3c]),'SmsQueueId':Number(_0x102563[_0xc92a('0x4b')]['id'])});}return _0x4414f1;});}})['then'](respondWithResult(_0xcba7e1,null))[_0xc92a('0x4a')](handleError(_0xcba7e1,null));};exports[_0xc92a('0x82')]=function(_0x20d60e,_0x18034a,_0x28f848){return db[_0xc92a('0x31')][_0xc92a('0x56')]({'where':{'id':_0x20d60e['params']['id']}})[_0xc92a('0x27')](handleEntityNotFound(_0x18034a,null))['then'](function(_0x20019d){if(_0x20019d){return _0x20019d[_0xc92a('0x82')](_0x20d60e['query']['ids'])[_0xc92a('0x27')](function(){if(_['isArray'](_0x20d60e[_0xc92a('0x35')][_0xc92a('0x81')])){for(var _0x5aeb7d=0x0;_0x5aeb7d<_0x20d60e[_0xc92a('0x35')][_0xc92a('0x81')][_0xc92a('0x3b')];_0x5aeb7d+=0x1){socket[_0xc92a('0x6f')](_0xc92a('0x7e'),{'UserId':Number(_0x20d60e[_0xc92a('0x35')][_0xc92a('0x81')][_0x5aeb7d]),'SmsQueueId':Number(_0x20d60e[_0xc92a('0x4b')]['id'])});}}else{socket[_0xc92a('0x6f')](_0xc92a('0x7e'),{'UserId':Number(_0x20d60e['query'][_0xc92a('0x81')]),'SmsQueueId':Number(_0x20d60e[_0xc92a('0x4b')]['id'])});}});}})[_0xc92a('0x27')](respondWithStatusCode(_0x18034a,null))[_0xc92a('0x4a')](handleError(_0x18034a,null));};exports[_0xc92a('0x83')]=function(_0x5e0d6e,_0x3adf17,_0x221d3c){var _0x5e15b7={};var _0x8219b8={};var _0x4499c7;var _0x412d79;return db['SmsQueue'][_0xc92a('0x58')]({'where':{'id':_0x5e0d6e[_0xc92a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3adf17,null))[_0xc92a('0x27')](function(_0x593bf9){if(_0x593bf9){_0x4499c7=_0x593bf9;_0x8219b8[_0xc92a('0x38')]=_[_0xc92a('0x4c')](db[_0xc92a('0x71')][_0xc92a('0x4d')]);_0x8219b8['query']=_[_0xc92a('0x4c')](_0x5e0d6e[_0xc92a('0x35')]);_0x8219b8['filters']=_[_0xc92a('0x37')](_0x8219b8[_0xc92a('0x38')],_0x8219b8['query']);_0x5e15b7[_0xc92a('0x39')]=_[_0xc92a('0x37')](_0x8219b8[_0xc92a('0x38')],qs[_0xc92a('0x3a')](_0x5e0d6e[_0xc92a('0x35')][_0xc92a('0x3a')]));_0x5e15b7[_0xc92a('0x39')]=_0x5e15b7['attributes']['length']?_0x5e15b7[_0xc92a('0x39')]:_0x8219b8[_0xc92a('0x38')];_0x5e15b7[_0xc92a('0x3e')]=qs['sort'](_0x5e0d6e[_0xc92a('0x35')][_0xc92a('0x3f')]);_0x5e15b7[_0xc92a('0x40')]=qs[_0xc92a('0x36')](_[_0xc92a('0x41')](_0x5e0d6e['query'],_0x8219b8[_0xc92a('0x36')]));if(_0x5e0d6e[_0xc92a('0x35')][_0xc92a('0x42')]){_0x5e15b7[_0xc92a('0x40')]=_['merge'](_0x5e15b7[_0xc92a('0x40')],{'$or':_[_0xc92a('0x43')](_0x5e15b7[_0xc92a('0x39')],function(_0x3502d6){var _0x3cb99b={};_0x3cb99b[_0x3502d6]={'$like':'%'+_0x5e0d6e[_0xc92a('0x35')][_0xc92a('0x42')]+'%'};return _0x3cb99b;})});}_0x5e15b7=_[_0xc92a('0x45')]({},_0x5e15b7,_0x5e0d6e[_0xc92a('0x5b')]);return _0x4499c7[_0xc92a('0x83')](_0x5e15b7);}})[_0xc92a('0x27')](function(_0x920b9){if(_0x920b9){_0x412d79=_0x920b9[_0xc92a('0x3b')];if(!_0x5e0d6e[_0xc92a('0x35')][_0xc92a('0x3c')](_0xc92a('0x3d'))){_0x5e15b7[_0xc92a('0x1f')]=qs[_0xc92a('0x1f')](_0x5e0d6e['query'][_0xc92a('0x1f')]);_0x5e15b7[_0xc92a('0x21')]=qs[_0xc92a('0x21')](_0x5e0d6e[_0xc92a('0x35')][_0xc92a('0x21')]);}return _0x4499c7['getAgents'](_0x5e15b7);}})[_0xc92a('0x27')](function(_0x56564b){if(_0x56564b){return _0x56564b?{'count':_0x412d79,'rows':_0x56564b}:null;}})[_0xc92a('0x27')](respondWithResult(_0x3adf17,null))[_0xc92a('0x4a')](handleError(_0x3adf17,null));}; \ No newline at end of file +var _0xb725=['sox','to-csv','ejs','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','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','SmsQueues','UserProfileResource','destroy','stack','name','send','index','SmsQueue','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserSmsQueue','order','pick','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','Team','getTeams','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','all','compact','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x196475,_0x53b54b){var _0x50f5eb=function(_0x465185){while(--_0x465185){_0x196475['push'](_0x196475['shift']());}};_0x50f5eb(++_0x53b54b);}(_0xb725,0x86));var _0x5b72=function(_0x36dd01,_0x5996a4){_0x36dd01=_0x36dd01-0x0;var _0x52c520=_0xb725[_0x36dd01];return _0x52c520;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b72('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b72('0x1'));var rp=require(_0x5b72('0x2'));var moment=require(_0x5b72('0x3'));var BPromise=require(_0x5b72('0x4'));var Mustache=require(_0x5b72('0x5'));var util=require(_0x5b72('0x6'));var path=require(_0x5b72('0x7'));var sox=require(_0x5b72('0x8'));var csv=require(_0x5b72('0x9'));var ejs=require(_0x5b72('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b72('0xb'));var squel=require(_0x5b72('0xc'));var crypto=require(_0x5b72('0xd'));var jsforce=require(_0x5b72('0xe'));var deskjs=require(_0x5b72('0xf'));var toCsv=require(_0x5b72('0x9'));var querystring=require(_0x5b72('0x10'));var Papa=require('papaparse');var Redis=require(_0x5b72('0x11'));var authService=require(_0x5b72('0x12'));var qs=require(_0x5b72('0x13'));var as=require(_0x5b72('0x14'));var hardwareService=require(_0x5b72('0x15'));var logger=require(_0x5b72('0x16'))(_0x5b72('0x17'));var utils=require(_0x5b72('0x18'));var config=require(_0x5b72('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5b72('0x1a')]=_['defaults'](config[_0x5b72('0x1a')],{'host':_0x5b72('0x1b'),'port':0x18eb});var socket=require(_0x5b72('0x1c'))(new Redis(config[_0x5b72('0x1a')]));require(_0x5b72('0x1d'))[_0x5b72('0x1e')](socket);function respondWithStatusCode(_0x5f5614,_0x1b187f){_0x1b187f=_0x1b187f||0xcc;return function(_0x23765e){if(_0x23765e){return _0x5f5614[_0x5b72('0x1f')](_0x1b187f);}return _0x5f5614[_0x5b72('0x20')](_0x1b187f)[_0x5b72('0x21')]();};}function respondWithResult(_0x1422a8,_0x9258a6){_0x9258a6=_0x9258a6||0xc8;return function(_0x69bb0){if(_0x69bb0){return _0x1422a8[_0x5b72('0x20')](_0x9258a6)[_0x5b72('0x22')](_0x69bb0);}};}function respondWithFilteredResult(_0x49f5f1,_0x4bb5c9){return function(_0x56c23f){if(_0x56c23f){var _0x271bdd=typeof _0x4bb5c9['offset']===_0x5b72('0x23')&&typeof _0x4bb5c9[_0x5b72('0x24')]===_0x5b72('0x23');var _0x49d951=_0x56c23f[_0x5b72('0x25')];var _0x70bf4f=_0x271bdd?0x0:_0x4bb5c9[_0x5b72('0x26')];var _0x33575d=_0x271bdd?_0x56c23f['count']:_0x4bb5c9['offset']+_0x4bb5c9[_0x5b72('0x24')];var _0x527121;if(_0x33575d>=_0x49d951){_0x33575d=_0x49d951;_0x527121=0xc8;}else{_0x527121=0xce;}_0x49f5f1['status'](_0x527121);return _0x49f5f1[_0x5b72('0x27')](_0x5b72('0x28'),_0x70bf4f+'-'+_0x33575d+'/'+_0x49d951)[_0x5b72('0x22')](_0x56c23f);}return null;};}function patchUpdates(_0x519d4a){return function(_0x1457b4){try{jsonpatch[_0x5b72('0x29')](_0x1457b4,_0x519d4a,!![]);}catch(_0x21b12a){return BPromise[_0x5b72('0x2a')](_0x21b12a);}return _0x1457b4[_0x5b72('0x2b')]();};}function saveUpdates(_0x553c76,_0x29e7bb){return function(_0xd776ba){if(_0xd776ba){return _0xd776ba['update'](_0x553c76)['then'](function(_0x52fc1d){return _0x52fc1d;});}return null;};}function removeEntity(_0x46d9c6,_0x60e802){return function(_0x544857){if(_0x544857){return _0x544857['destroy']()[_0x5b72('0x2c')](function(){var _0x1ac7a7=_0x544857[_0x5b72('0x2d')]({'plain':!![]});var _0x4c8ab2=_0x5b72('0x2e');return db[_0x5b72('0x2f')][_0x5b72('0x30')]({'where':{'type':_0x4c8ab2,'resourceId':_0x1ac7a7['id']}})[_0x5b72('0x2c')](function(){return _0x544857;});})[_0x5b72('0x2c')](function(){_0x46d9c6['status'](0xcc)[_0x5b72('0x21')]();});}};}function handleEntityNotFound(_0x3b6848,_0x2919a4){return function(_0x2e500d){if(!_0x2e500d){_0x3b6848['sendStatus'](0x194);}return _0x2e500d;};}function handleError(_0x26fde1,_0x36eaa9){_0x36eaa9=_0x36eaa9||0x1f4;return function(_0xcd266e){logger['error'](_0xcd266e[_0x5b72('0x31')]);if(_0xcd266e['name']){delete _0xcd266e[_0x5b72('0x32')];}_0x26fde1['status'](_0x36eaa9)[_0x5b72('0x33')](_0xcd266e);};}exports[_0x5b72('0x34')]=function(_0x54edda,_0x5c984d){var _0x45504a={},_0x41c8a9={},_0x52ce09={'count':0x0,'rows':[]};var _0xe99aa=_['map'](db[_0x5b72('0x35')][_0x5b72('0x36')],function(_0x321dbd){return{'name':_0x321dbd[_0x5b72('0x37')],'type':_0x321dbd['type'][_0x5b72('0x38')]};});_0x41c8a9['model']=_[_0x5b72('0x39')](_0xe99aa,'name');_0x41c8a9['query']=_['keys'](_0x54edda[_0x5b72('0x3a')]);_0x41c8a9[_0x5b72('0x3b')]=_[_0x5b72('0x3c')](_0x41c8a9[_0x5b72('0x3d')],_0x41c8a9['query']);_0x45504a[_0x5b72('0x3e')]=_[_0x5b72('0x3c')](_0x41c8a9['model'],qs['fields'](_0x54edda[_0x5b72('0x3a')]['fields']));_0x45504a[_0x5b72('0x3e')]=_0x45504a[_0x5b72('0x3e')][_0x5b72('0x3f')]?_0x45504a[_0x5b72('0x3e')]:_0x41c8a9[_0x5b72('0x3d')];if(!_0x54edda['query'][_0x5b72('0x40')](_0x5b72('0x41'))){_0x45504a['limit']=qs[_0x5b72('0x24')](_0x54edda[_0x5b72('0x3a')]['limit']);_0x45504a['offset']=qs[_0x5b72('0x26')](_0x54edda['query'][_0x5b72('0x26')]);}_0x45504a['order']=qs['sort'](_0x54edda[_0x5b72('0x3a')][_0x5b72('0x42')]);_0x45504a[_0x5b72('0x43')]=qs[_0x5b72('0x3b')](_['pick'](_0x54edda[_0x5b72('0x3a')],_0x41c8a9['filters']),_0xe99aa);if(_0x54edda[_0x5b72('0x3a')][_0x5b72('0x44')]){_0x45504a[_0x5b72('0x43')]=_[_0x5b72('0x45')](_0x45504a[_0x5b72('0x43')],{'$or':_[_0x5b72('0x39')](_0xe99aa,function(_0x59652b){if(_0x59652b['type']!==_0x5b72('0x46')){var _0x4ecb17={};_0x4ecb17[_0x59652b[_0x5b72('0x32')]]={'$like':'%'+_0x54edda[_0x5b72('0x3a')][_0x5b72('0x44')]+'%'};return _0x4ecb17;}})});}_0x45504a=_[_0x5b72('0x45')]({},_0x45504a,_0x54edda[_0x5b72('0x47')]);var _0x4677e1={'where':_0x45504a[_0x5b72('0x43')]};return db['SmsQueue']['count'](_0x4677e1)[_0x5b72('0x2c')](function(_0x1de9f1){_0x52ce09['count']=_0x1de9f1;if(_0x54edda[_0x5b72('0x3a')][_0x5b72('0x48')]){_0x45504a[_0x5b72('0x49')]=[{'all':!![]}];}return db['SmsQueue'][_0x5b72('0x4a')](_0x45504a);})[_0x5b72('0x2c')](function(_0x43a33c){_0x52ce09[_0x5b72('0x4b')]=_0x43a33c;return _0x52ce09;})['then'](respondWithFilteredResult(_0x5c984d,_0x45504a))[_0x5b72('0x4c')](handleError(_0x5c984d,null));};exports[_0x5b72('0x4d')]=function(_0x48db3c,_0x305696){var _0x429746={'raw':!![],'where':{'id':_0x48db3c[_0x5b72('0x4e')]['id']}},_0x465f81={};_0x465f81[_0x5b72('0x3d')]=_['keys'](db[_0x5b72('0x35')][_0x5b72('0x36')]);_0x465f81[_0x5b72('0x3a')]=_[_0x5b72('0x4f')](_0x48db3c['query']);_0x465f81[_0x5b72('0x3b')]=_[_0x5b72('0x3c')](_0x465f81['model'],_0x465f81[_0x5b72('0x3a')]);_0x429746[_0x5b72('0x3e')]=_[_0x5b72('0x3c')](_0x465f81[_0x5b72('0x3d')],qs['fields'](_0x48db3c[_0x5b72('0x3a')][_0x5b72('0x50')]));_0x429746[_0x5b72('0x3e')]=_0x429746[_0x5b72('0x3e')]['length']?_0x429746[_0x5b72('0x3e')]:_0x465f81['model'];if(_0x48db3c['query'][_0x5b72('0x48')]){_0x429746[_0x5b72('0x49')]=[{'all':!![]}];}_0x429746=_[_0x5b72('0x45')]({},_0x429746,_0x48db3c[_0x5b72('0x47')]);return db[_0x5b72('0x35')]['find'](_0x429746)[_0x5b72('0x2c')](handleEntityNotFound(_0x305696,null))[_0x5b72('0x2c')](respondWithResult(_0x305696,null))[_0x5b72('0x4c')](handleError(_0x305696,null));};exports[_0x5b72('0x51')]=function(_0x12c0a9,_0x5c730f){return db[_0x5b72('0x35')]['create'](_0x12c0a9[_0x5b72('0x52')],{})['then'](function(_0x2ad8b5){var _0x22022f=_0x12c0a9['user'][_0x5b72('0x2d')]({'plain':!![]});if(!_0x22022f)throw new Error(_0x5b72('0x53'));if(_0x22022f['role']===_0x5b72('0x54')){var _0x270de3=_0x2ad8b5['get']({'plain':!![]});var _0x1b947e=_0x5b72('0x2e');return db[_0x5b72('0x55')][_0x5b72('0x56')]({'where':{'name':_0x1b947e,'userProfileId':_0x22022f['userProfileId']},'raw':!![]})[_0x5b72('0x2c')](function(_0xb424b1){if(_0xb424b1&&_0xb424b1['autoAssociation']===0x0){return db[_0x5b72('0x2f')][_0x5b72('0x51')]({'name':_0x270de3[_0x5b72('0x32')],'resourceId':_0x270de3['id'],'type':_0xb424b1['name'],'sectionId':_0xb424b1['id']},{})[_0x5b72('0x2c')](function(){return _0x2ad8b5;});}else{return _0x2ad8b5;}})[_0x5b72('0x4c')](function(_0x3e51ba){logger[_0x5b72('0x57')](_0x5b72('0x58'),_0x3e51ba);throw _0x3e51ba;});}return _0x2ad8b5;})[_0x5b72('0x2c')](respondWithResult(_0x5c730f,0xc9))['catch'](handleError(_0x5c730f,null));};exports[_0x5b72('0x59')]=function(_0x1c353f,_0x39d6a7){if(_0x1c353f['body']['id']){delete _0x1c353f['body']['id'];}return db[_0x5b72('0x35')][_0x5b72('0x56')]({'where':{'id':_0x1c353f[_0x5b72('0x4e')]['id']}})['then'](handleEntityNotFound(_0x39d6a7,null))[_0x5b72('0x2c')](saveUpdates(_0x1c353f[_0x5b72('0x52')],null))[_0x5b72('0x2c')](respondWithResult(_0x39d6a7,null))['catch'](handleError(_0x39d6a7,null));};exports[_0x5b72('0x30')]=function(_0x55684b,_0x5c17f2){return db['SmsQueue'][_0x5b72('0x56')]({'where':{'id':_0x55684b[_0x5b72('0x4e')]['id']}})[_0x5b72('0x2c')](handleEntityNotFound(_0x5c17f2,null))[_0x5b72('0x2c')](removeEntity(_0x5c17f2,null))[_0x5b72('0x4c')](handleError(_0x5c17f2,null));};exports[_0x5b72('0x5a')]=function(_0x2d85f5,_0x20efdd){return db[_0x5b72('0x35')][_0x5b72('0x5a')]()['then'](respondWithResult(_0x20efdd,null))[_0x5b72('0x4c')](handleError(_0x20efdd,null));};exports[_0x5b72('0x5b')]=function(_0x227d6f,_0x255933,_0x5df84b){var _0x20ca8a={'raw':!![],'where':{}},_0xf3eb17={},_0x4a2ebe;return db[_0x5b72('0x35')][_0x5b72('0x5c')]({'where':{'id':_0x227d6f['params']['id']}})[_0x5b72('0x2c')](handleEntityNotFound(_0x255933,null))[_0x5b72('0x2c')](function(_0x527d21){if(_0x527d21){_0x4a2ebe=_0x527d21[_0x5b72('0x2d')]({'plain':!![]});_0xf3eb17[_0x5b72('0x3d')]=_[_0x5b72('0x4f')](db[_0x5b72('0x5d')][_0x5b72('0x36')]);_0xf3eb17[_0x5b72('0x3a')]=_[_0x5b72('0x4f')](_0x227d6f['query']);_0xf3eb17[_0x5b72('0x3b')]=_['intersection'](_0xf3eb17['model'],_0xf3eb17[_0x5b72('0x3a')]);_0x20ca8a[_0x5b72('0x3e')]=_[_0x5b72('0x3c')](_0xf3eb17[_0x5b72('0x3d')],qs['fields'](_0x227d6f['query']['fields']));_0x20ca8a['attributes']=_0x20ca8a[_0x5b72('0x3e')]['length']?_0x20ca8a[_0x5b72('0x3e')]:_0xf3eb17[_0x5b72('0x3d')];if(!_0x227d6f[_0x5b72('0x3a')][_0x5b72('0x40')](_0x5b72('0x41'))){_0x20ca8a[_0x5b72('0x24')]=qs[_0x5b72('0x24')](_0x227d6f[_0x5b72('0x3a')][_0x5b72('0x24')]);_0x20ca8a[_0x5b72('0x26')]=qs[_0x5b72('0x26')](_0x227d6f[_0x5b72('0x3a')][_0x5b72('0x26')]);}_0x20ca8a[_0x5b72('0x5e')]=qs[_0x5b72('0x42')](_0x227d6f['query']['sort']);_0x20ca8a[_0x5b72('0x43')]=qs['filters'](_[_0x5b72('0x5f')](_0x227d6f[_0x5b72('0x3a')],_0xf3eb17[_0x5b72('0x3b')]));_0x20ca8a[_0x5b72('0x43')][_0x5b72('0x60')]=_0x527d21['id'];if(_0x227d6f[_0x5b72('0x3a')][_0x5b72('0x44')]){_0x20ca8a['where']=_[_0x5b72('0x45')](_0x20ca8a[_0x5b72('0x43')],{'$or':_['map'](_0x20ca8a[_0x5b72('0x3e')],function(_0x36e781){var _0x58bb5f={};_0x58bb5f[_0x36e781]={'$like':'%'+_0x227d6f[_0x5b72('0x3a')][_0x5b72('0x44')]+'%'};return _0x58bb5f;})});}_0x20ca8a=_[_0x5b72('0x45')]({},_0x20ca8a,_0x227d6f['options']);return db[_0x5b72('0x5d')][_0x5b72('0x4a')](_0x20ca8a);}})[_0x5b72('0x2c')](function(_0x38e7da){if(_0x38e7da){return db[_0x5b72('0x61')][_0x5b72('0x62')]({'where':{'id':_[_0x5b72('0x39')](_0x38e7da,_0x5b72('0x63')),'role':_0x5b72('0x64')},'attributes':['id',_0x5b72('0x32'),_0x5b72('0x65'),_0x5b72('0x66'),_0x5b72('0x67')]});}})[_0x5b72('0x2c')](function(_0xcbff2f){if(_0xcbff2f){return{'count':_0xcbff2f['count'],'rows':_[_0x5b72('0x39')](_0xcbff2f[_0x5b72('0x4b')],function(_0x157c93){return{'membername':_0x157c93[_0x5b72('0x32')],'UserId':_0x157c93['id'],'queue_name':_0x4a2ebe[_0x5b72('0x32')],'SmsQueueId':_0x4a2ebe['id'],'interface':util[_0x5b72('0x68')](_0x5b72('0x69'),'SIP',_0x157c93[_0x5b72('0x32')]),'penalty':0x0,'paused':_0x157c93[_0x5b72('0x65')],'createdAt':_0x157c93[_0x5b72('0x67')],'updatedAt':_0x157c93['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5b72('0x2c')](respondWithFilteredResult(_0x255933,_0x20ca8a))['catch'](handleError(_0x255933,null));};exports['getTeams']=function(_0x495ead,_0x18ed8d,_0xb7e8ff){var _0x335b08={};var _0x312605={};var _0x394a6c;var _0x24c742;return db['SmsQueue']['findOne']({'where':{'id':_0x495ead[_0x5b72('0x4e')]['id']}})[_0x5b72('0x2c')](handleEntityNotFound(_0x18ed8d,null))[_0x5b72('0x2c')](function(_0x37771d){if(_0x37771d){_0x394a6c=_0x37771d;_0x312605[_0x5b72('0x3d')]=_[_0x5b72('0x4f')](db[_0x5b72('0x6a')][_0x5b72('0x36')]);_0x312605[_0x5b72('0x3a')]=_[_0x5b72('0x4f')](_0x495ead['query']);_0x312605[_0x5b72('0x3b')]=_[_0x5b72('0x3c')](_0x312605[_0x5b72('0x3d')],_0x312605[_0x5b72('0x3a')]);_0x335b08[_0x5b72('0x3e')]=_[_0x5b72('0x3c')](_0x312605[_0x5b72('0x3d')],qs[_0x5b72('0x50')](_0x495ead[_0x5b72('0x3a')]['fields']));_0x335b08[_0x5b72('0x3e')]=_0x335b08['attributes'][_0x5b72('0x3f')]?_0x335b08[_0x5b72('0x3e')]:_0x312605[_0x5b72('0x3d')];_0x335b08['order']=qs[_0x5b72('0x42')](_0x495ead[_0x5b72('0x3a')][_0x5b72('0x42')]);_0x335b08[_0x5b72('0x43')]=qs[_0x5b72('0x3b')](_[_0x5b72('0x5f')](_0x495ead[_0x5b72('0x3a')],_0x312605[_0x5b72('0x3b')]));if(_0x495ead[_0x5b72('0x3a')][_0x5b72('0x44')]){_0x335b08[_0x5b72('0x43')]=_[_0x5b72('0x45')](_0x335b08[_0x5b72('0x43')],{'$or':_[_0x5b72('0x39')](_0x335b08[_0x5b72('0x3e')],function(_0x4f4e30){var _0x2d8a3f={};_0x2d8a3f[_0x4f4e30]={'$like':'%'+_0x495ead[_0x5b72('0x3a')]['filter']+'%'};return _0x2d8a3f;})});}_0x335b08=_[_0x5b72('0x45')]({},_0x335b08,_0x495ead[_0x5b72('0x47')]);return _0x394a6c[_0x5b72('0x6b')](_0x335b08);}})[_0x5b72('0x2c')](function(_0x2026ab){if(_0x2026ab){_0x24c742=_0x2026ab[_0x5b72('0x3f')];if(!_0x495ead[_0x5b72('0x3a')]['hasOwnProperty'](_0x5b72('0x41'))){_0x335b08[_0x5b72('0x24')]=qs['limit'](_0x495ead[_0x5b72('0x3a')][_0x5b72('0x24')]);_0x335b08['offset']=qs['offset'](_0x495ead[_0x5b72('0x3a')][_0x5b72('0x26')]);}return _0x394a6c[_0x5b72('0x6b')](_0x335b08);}})[_0x5b72('0x2c')](function(_0x5d07e4){if(_0x5d07e4){return _0x5d07e4?{'count':_0x24c742,'rows':_0x5d07e4}:null;}})[_0x5b72('0x2c')](respondWithResult(_0x18ed8d,null))[_0x5b72('0x4c')](handleError(_0x18ed8d,null));};exports[_0x5b72('0x6c')]=function(_0xfe0cec,_0x10ea25,_0x4c48da){var _0x41e2bc=_0xfe0cec[_0x5b72('0x52')][_0x5b72('0x6d')];return db[_0x5b72('0x6a')]['findAll']({'where':{'id':_0x41e2bc},'attributes':['id'],'include':[{'model':db[_0x5b72('0x61')],'as':_0x5b72('0x6e'),'attributes':['id',_0x5b72('0x32'),_0x5b72('0x6f'),'voicePause',_0x5b72('0x70')],'raw':!![]}]})[_0x5b72('0x2c')](function(_0x1e500c){if(_0x1e500c){var _0x4cdc53=_[_0x5b72('0x71')](_0x1e500c,function(_0x28dfe9){var _0x3ce152=_0x28dfe9[_0x5b72('0x2d')]({'plain':!![]});return _0x3ce152['Agents'];});return db[_0x5b72('0x35')][_0x5b72('0x56')]({'where':{'id':_0xfe0cec[_0x5b72('0x4e')]['id']}})[_0x5b72('0x2c')](function(_0x326385){return db[_0x5b72('0x72')][_0x5b72('0x73')](function(_0x8b2c4c){return _0x326385['addTeams'](_0x41e2bc,{'transaction':_0x8b2c4c})['then'](function(){return BPromise[_0x5b72('0x74')](_0x4cdc53,function(_0x3f2bec){return db[_0x5b72('0x5d')][_0x5b72('0x75')]({'where':{'UserId':_0x3f2bec['id'],'SmsQueueId':_0xfe0cec[_0x5b72('0x4e')]['id']},'transaction':_0x8b2c4c});});})['then'](function(){_0x4cdc53[_0x5b72('0x76')](function(_0x44c8d1){socket[_0x5b72('0x77')](_0x5b72('0x78'),{'UserId':_0x44c8d1['id'],'SmsQueueId':_0x326385['id']});});});});});}})[_0x5b72('0x2c')](respondWithStatusCode(_0x10ea25,null))[_0x5b72('0x4c')](handleError(_0x10ea25,null));};exports['removeTeams']=function(_0x4894b3,_0x5ca512,_0x47fe88){return db['Team'][_0x5b72('0x4a')]({'where':{'id':_0x4894b3[_0x5b72('0x3a')][_0x5b72('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x5b72('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5b72('0x2c')](handleEntityNotFound(_0x5ca512,null))[_0x5b72('0x2c')](function(_0x4c9deb){var _0x4a6a1b=_[_0x5b72('0x39')](_0x4c9deb,'id');var _0x29022c=[];var _0x1e8f95=[];var _0x2648b3=squel['select']();_0x2648b3['field']('tq.TeamId')[_0x5b72('0x79')]('team_has_sms_queues','tq')[_0x5b72('0x7a')](_0x5b72('0x7b'),'ut',_0x5b72('0x7c'))['where'](_0x5b72('0x7d'),_0x4894b3[_0x5b72('0x4e')]['id']);for(var _0x48a63f=0x0;_0x48a63f<_0x4c9deb['length'];_0x48a63f+=0x1){let _0x151d54=_0x4c9deb[_0x48a63f];for(var _0x4e7eed=0x0;_0x4e7eed<_0x151d54[_0x5b72('0x6e')]['length'];_0x4e7eed+=0x1){let _0xd70c3a=_0x151d54[_0x5b72('0x6e')][_0x4e7eed];var _0x384601=_0x2648b3['clone']();_0x384601[_0x5b72('0x43')](_0x5b72('0x7e'),_0xd70c3a['id']);_0x1e8f95['push'](db[_0x5b72('0x72')][_0x5b72('0x3a')](_0x384601[_0x5b72('0x7f')](),{'type':db[_0x5b72('0x72')][_0x5b72('0x80')][_0x5b72('0x81')]})['then'](function(_0x4b4857){if(_0x4b4857[_0x5b72('0x3f')]===0x1){return _0xd70c3a['id'];}else{var _0x4acfc0=_[_0x5b72('0x82')](_[_0x5b72('0x39')](_0x4b4857,'TeamId'),function(_0x28e8ad){return _['includes'](_0x4a6a1b,_0x28e8ad);});if(_0x4acfc0){return _0xd70c3a['id'];}}}));}}return BPromise[_0x5b72('0x83')](_0x1e8f95)[_0x5b72('0x2c')](function(_0x5936c0){_0x29022c=_(_0x29022c)['union'](_0x5936c0)[_0x5b72('0x84')]()[_0x5b72('0x85')]();return db[_0x5b72('0x35')]['find']({'where':{'id':_0x4894b3[_0x5b72('0x4e')]['id']}})[_0x5b72('0x2c')](function(_0x7341b8){return db[_0x5b72('0x72')][_0x5b72('0x73')](function(_0x1e6ade){return _0x7341b8[_0x5b72('0x86')](_0x4894b3[_0x5b72('0x3a')][_0x5b72('0x6d')],{'transaction':_0x1e6ade})[_0x5b72('0x2c')](function(){if(!_[_0x5b72('0x87')](_0x29022c)){return _0x7341b8[_0x5b72('0x88')](_0x29022c,{'transaction':_0x1e6ade});}})[_0x5b72('0x2c')](function(){_0x29022c[_0x5b72('0x76')](function(_0xa3b804){socket[_0x5b72('0x77')](_0x5b72('0x89'),{'UserId':_0xa3b804,'SmsQueueId':_0x7341b8['id']});});});});});});})['then'](respondWithStatusCode(_0x5ca512,null))[_0x5b72('0x4c')](handleError(_0x5ca512,null));};exports[_0x5b72('0x8a')]=function(_0x2d7a5e,_0x7237e5,_0x1a16fb){return db[_0x5b72('0x35')]['find']({'where':{'id':_0x2d7a5e[_0x5b72('0x4e')]['id']}})[_0x5b72('0x2c')](handleEntityNotFound(_0x7237e5,null))[_0x5b72('0x2c')](function(_0x5711e2){if(_0x5711e2){return _0x5711e2[_0x5b72('0x8a')](_0x2d7a5e[_0x5b72('0x52')][_0x5b72('0x6d')],_[_0x5b72('0x8b')](_0x2d7a5e[_0x5b72('0x52')],[_0x5b72('0x6d'),'id'])||{})[_0x5b72('0x8c')](function(_0x3c637e){for(var _0x2ebc74=0x0;_0x2ebc74<_0x2d7a5e[_0x5b72('0x52')]['ids'][_0x5b72('0x3f')];_0x2ebc74+=0x1){socket[_0x5b72('0x77')](_0x5b72('0x78'),{'UserId':Number(_0x2d7a5e[_0x5b72('0x52')][_0x5b72('0x6d')][_0x2ebc74]),'SmsQueueId':Number(_0x2d7a5e[_0x5b72('0x4e')]['id'])});}return _0x3c637e;});}})['then'](respondWithResult(_0x7237e5,null))[_0x5b72('0x4c')](handleError(_0x7237e5,null));};exports['removeAgents']=function(_0x1c2347,_0x51935a,_0x2fb5c5){return db['SmsQueue']['find']({'where':{'id':_0x1c2347[_0x5b72('0x4e')]['id']}})['then'](handleEntityNotFound(_0x51935a,null))['then'](function(_0x5985d7){if(_0x5985d7){return _0x5985d7[_0x5b72('0x88')](_0x1c2347[_0x5b72('0x3a')]['ids'])[_0x5b72('0x2c')](function(){if(_['isArray'](_0x1c2347[_0x5b72('0x3a')][_0x5b72('0x6d')])){for(var _0x35c47b=0x0;_0x35c47b<_0x1c2347[_0x5b72('0x3a')][_0x5b72('0x6d')]['length'];_0x35c47b+=0x1){socket[_0x5b72('0x77')]('userSmsQueue:remove',{'UserId':Number(_0x1c2347[_0x5b72('0x3a')][_0x5b72('0x6d')][_0x35c47b]),'SmsQueueId':Number(_0x1c2347[_0x5b72('0x4e')]['id'])});}}else{socket[_0x5b72('0x77')](_0x5b72('0x89'),{'UserId':Number(_0x1c2347[_0x5b72('0x3a')]['ids']),'SmsQueueId':Number(_0x1c2347[_0x5b72('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x51935a,null))[_0x5b72('0x4c')](handleError(_0x51935a,null));};exports[_0x5b72('0x8d')]=function(_0x306bad,_0x6c2337,_0x4df7b0){var _0xf30fea={};var _0x1514e1={};var _0x4d9154;var _0xe6ca3b;return db[_0x5b72('0x35')][_0x5b72('0x5c')]({'where':{'id':_0x306bad[_0x5b72('0x4e')]['id']}})[_0x5b72('0x2c')](handleEntityNotFound(_0x6c2337,null))['then'](function(_0x1a22e8){if(_0x1a22e8){_0x4d9154=_0x1a22e8;_0x1514e1[_0x5b72('0x3d')]=_[_0x5b72('0x4f')](db['User'][_0x5b72('0x36')]);_0x1514e1[_0x5b72('0x3a')]=_[_0x5b72('0x4f')](_0x306bad[_0x5b72('0x3a')]);_0x1514e1[_0x5b72('0x3b')]=_[_0x5b72('0x3c')](_0x1514e1['model'],_0x1514e1['query']);_0xf30fea['attributes']=_[_0x5b72('0x3c')](_0x1514e1[_0x5b72('0x3d')],qs[_0x5b72('0x50')](_0x306bad[_0x5b72('0x3a')]['fields']));_0xf30fea[_0x5b72('0x3e')]=_0xf30fea[_0x5b72('0x3e')]['length']?_0xf30fea[_0x5b72('0x3e')]:_0x1514e1[_0x5b72('0x3d')];_0xf30fea[_0x5b72('0x5e')]=qs[_0x5b72('0x42')](_0x306bad[_0x5b72('0x3a')][_0x5b72('0x42')]);_0xf30fea[_0x5b72('0x43')]=qs['filters'](_[_0x5b72('0x5f')](_0x306bad[_0x5b72('0x3a')],_0x1514e1[_0x5b72('0x3b')]));if(_0x306bad['query']['filter']){_0xf30fea['where']=_['merge'](_0xf30fea[_0x5b72('0x43')],{'$or':_[_0x5b72('0x39')](_0xf30fea['attributes'],function(_0xb68c80){var _0x410ccc={};_0x410ccc[_0xb68c80]={'$like':'%'+_0x306bad[_0x5b72('0x3a')][_0x5b72('0x44')]+'%'};return _0x410ccc;})});}_0xf30fea=_[_0x5b72('0x45')]({},_0xf30fea,_0x306bad['options']);return _0x4d9154[_0x5b72('0x8d')](_0xf30fea);}})['then'](function(_0x1a3da8){if(_0x1a3da8){_0xe6ca3b=_0x1a3da8[_0x5b72('0x3f')];if(!_0x306bad['query'][_0x5b72('0x40')](_0x5b72('0x41'))){_0xf30fea[_0x5b72('0x24')]=qs[_0x5b72('0x24')](_0x306bad['query'][_0x5b72('0x24')]);_0xf30fea['offset']=qs[_0x5b72('0x26')](_0x306bad[_0x5b72('0x3a')][_0x5b72('0x26')]);}return _0x4d9154[_0x5b72('0x8d')](_0xf30fea);}})[_0x5b72('0x2c')](function(_0x2af4d7){if(_0x2af4d7){return _0x2af4d7?{'count':_0xe6ca3b,'rows':_0x2af4d7}:null;}})['then'](respondWithResult(_0x6c2337,null))['catch'](handleError(_0x6c2337,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 6a533c5..5e55fc4 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 _0xf49a=['remove','hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf49a,0xb8));var _0xaf49=function(_0x221eae,_0x2a3fa6){_0x221eae=_0x221eae-0x0;var _0x86f9f3=_0xf49a[_0x221eae];return _0x86f9f3;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xaf49('0x0'))['db'][_0xaf49('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xaf49('0x2')](0x0);var events={'afterCreate':_0xaf49('0x3'),'afterUpdate':_0xaf49('0x4'),'afterDestroy':_0xaf49('0x5')};function emitEvent(_0x37bdef){return function(_0x5a0dc8,_0x348529,_0x50c6ec){SmsQueueEvents['emit'](_0x37bdef+':'+_0x5a0dc8['id'],_0x5a0dc8);SmsQueueEvents['emit'](_0x37bdef,_0x5a0dc8);_0x50c6ec(null);};}for(var e in events){if(events[_0xaf49('0x6')](e)){var event=events[e];SmsQueue[_0xaf49('0x7')](e,emitEvent(event));}}module[_0xaf49('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x1578=['hook','exports','events','save','remove','emit'];(function(_0x27ec50,_0x1d8698){var _0x2da0f5=function(_0x206a3e){while(--_0x206a3e){_0x27ec50['push'](_0x27ec50['shift']());}};_0x2da0f5(++_0x1d8698);}(_0x1578,0x1e8));var _0x8157=function(_0x35142f,_0x2423fb){_0x35142f=_0x35142f-0x0;var _0xa6c876=_0x1578[_0x35142f];return _0xa6c876;};'use strict';var EventEmitter=require(_0x8157('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8157('0x1'),'afterUpdate':'update','afterDestroy':_0x8157('0x2')};function emitEvent(_0x2a47dd){return function(_0x1bcc9c,_0x192502,_0x4bd6bb){SmsQueueEvents[_0x8157('0x3')](_0x2a47dd+':'+_0x1bcc9c['id'],_0x1bcc9c);SmsQueueEvents['emit'](_0x2a47dd,_0x1bcc9c);_0x4bd6bb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x8157('0x4')](e,emitEvent(event));}}module[_0x8157('0x5')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 4b14f94..6f697f3 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 _0xd61c=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues'];(function(_0x439718,_0x1635cc){var _0xb369e0=function(_0x18db5a){while(--_0x18db5a){_0x439718['push'](_0x439718['shift']());}};_0xb369e0(++_0x1635cc);}(_0xd61c,0xdd));var _0xcd61=function(_0x360dc3,_0x34ca1a){_0x360dc3=_0x360dc3-0x0;var _0x1f9e2e=_0xd61c[_0x360dc3];return _0x1f9e2e;};'use strict';var _=require(_0xcd61('0x0'));var util=require(_0xcd61('0x1'));var logger=require(_0xcd61('0x2'))(_0xcd61('0x3'));var moment=require(_0xcd61('0x4'));var BPromise=require('bluebird');var rp=require(_0xcd61('0x5'));var fs=require('fs');var path=require(_0xcd61('0x6'));var rimraf=require(_0xcd61('0x7'));var config=require(_0xcd61('0x8'));var attributes=require(_0xcd61('0x9'));module[_0xcd61('0xa')]=function(_0xeb7306,_0x291ec5){return _0xeb7306['define'](_0xcd61('0xb'),attributes,{'tableName':_0xcd61('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc296=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./smsQueue.attributes','define','sms_queues','lodash'];(function(_0x3b952f,_0x28567b){var _0x3eaff0=function(_0x392236){while(--_0x392236){_0x3b952f['push'](_0x3b952f['shift']());}};_0x3eaff0(++_0x28567b);}(_0xc296,0x154));var _0x6c29=function(_0xa4bdb0,_0xf2db97){_0xa4bdb0=_0xa4bdb0-0x0;var _0x5aa65d=_0xc296[_0xa4bdb0];return _0x5aa65d;};'use strict';var _=require(_0x6c29('0x0'));var util=require(_0x6c29('0x1'));var logger=require(_0x6c29('0x2'))(_0x6c29('0x3'));var moment=require('moment');var BPromise=require(_0x6c29('0x4'));var rp=require(_0x6c29('0x5'));var fs=require('fs');var path=require(_0x6c29('0x6'));var rimraf=require(_0x6c29('0x7'));var config=require('../../config/environment');var attributes=require(_0x6c29('0x8'));module['exports']=function(_0x4d1268,_0x19b4e7){return _0x4d1268[_0x6c29('0x9')]('SmsQueue',attributes,{'tableName':_0x6c29('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 8137181..c3538f0 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 _0x81b8=['../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./smsQueue.socket','register','request','SmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetSmsQueue','debug','catch','ShowSmsQueue','find','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x59d369,_0x56a533){var _0x58c3eb=function(_0x2acb03){while(--_0x2acb03){_0x59d369['push'](_0x59d369['shift']());}};_0x58c3eb(++_0x56a533);}(_0x81b8,0xef));var _0x881b=function(_0x4d9a73,_0xa38557){_0x4d9a73=_0x4d9a73-0x0;var _0x3bdb16=_0x81b8[_0x4d9a73];return _0x3bdb16;};'use strict';var _=require(_0x881b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x881b('0x1'));var rs=require(_0x881b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x881b('0x3'))['db'];var utils=require(_0x881b('0x4'));var logger=require(_0x881b('0x5'))(_0x881b('0x6'));var config=require(_0x881b('0x7'));var jayson=require(_0x881b('0x8'));var client=jayson[_0x881b('0x9')][_0x881b('0xa')]({'port':0x232a});config['redis']=_[_0x881b('0xb')](config['redis'],{'host':_0x881b('0xc'),'port':0x18eb});var socket=require(_0x881b('0xd'))(new Redis(config[_0x881b('0xe')]));require(_0x881b('0xf'))[_0x881b('0x10')](socket);function respondWithRpcPromise(_0x15e8ae,_0xabdf6b,_0x28b1f3){return new BPromise(function(_0x4301f9,_0x1b5b2f){return client[_0x881b('0x11')](_0x15e8ae,_0x28b1f3)['then'](function(_0x3c0db7){logger['info'](_0x881b('0x12'),_0xabdf6b,_0x881b('0x13'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0xabdf6b,_0x881b('0x13'),JSON[_0x881b('0x14')](_0x3c0db7));if(_0x3c0db7['error']){if(_0x3c0db7[_0x881b('0x15')]['code']===0x1f4){logger[_0x881b('0x15')](_0x881b('0x12'),_0xabdf6b,_0x3c0db7['error'][_0x881b('0x16')]);return _0x1b5b2f(_0x3c0db7[_0x881b('0x15')][_0x881b('0x16')]);}logger[_0x881b('0x15')](_0x881b('0x12'),_0xabdf6b,_0x3c0db7[_0x881b('0x15')]['message']);return _0x4301f9(_0x3c0db7[_0x881b('0x15')]['message']);}else{logger[_0x881b('0x17')](_0x881b('0x12'),_0xabdf6b,_0x881b('0x13'));_0x4301f9(_0x3c0db7[_0x881b('0x18')][_0x881b('0x16')]);}})['catch'](function(_0x28671){logger[_0x881b('0x15')]('SmsQueue,\x20%s,\x20%s',_0xabdf6b,_0x28671);_0x1b5b2f(_0x28671);});});}exports['GetSmsQueue']=function(_0x1f1a04){var _0x6986e2=this;return new Promise(function(_0x3425fd,_0x4f0b28){return db[_0x881b('0x19')][_0x881b('0x1a')]({'raw':_0x1f1a04[_0x881b('0x1b')]?_0x1f1a04[_0x881b('0x1b')][_0x881b('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f1a04[_0x881b('0x1b')]?_0x1f1a04[_0x881b('0x1b')][_0x881b('0x1d')]||null:null,'attributes':_0x1f1a04['options']?_0x1f1a04[_0x881b('0x1b')][_0x881b('0x1e')]||null:null,'limit':_0x1f1a04[_0x881b('0x1b')]?_0x1f1a04[_0x881b('0x1b')][_0x881b('0x1f')]||null:null,'include':_0x1f1a04['options']?_0x1f1a04[_0x881b('0x1b')][_0x881b('0x20')]?_[_0x881b('0x21')](_0x1f1a04['options'][_0x881b('0x20')],function(_0xb1e0e3){return{'model':db[_0xb1e0e3[_0x881b('0x22')]],'as':_0xb1e0e3['as'],'attributes':_0xb1e0e3[_0x881b('0x1e')],'include':_0xb1e0e3[_0x881b('0x20')]?_[_0x881b('0x21')](_0xb1e0e3[_0x881b('0x20')],function(_0x49c728){return{'model':db[_0x49c728[_0x881b('0x22')]],'as':_0x49c728['as'],'attributes':_0x49c728[_0x881b('0x1e')],'include':_0x49c728[_0x881b('0x20')]?_[_0x881b('0x21')](_0x49c728[_0x881b('0x20')],function(_0x21abb1){return{'model':db[_0x21abb1[_0x881b('0x22')]],'as':_0x21abb1['as'],'attributes':_0x21abb1[_0x881b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x881b('0x23')](function(_0x3e1b39){logger[_0x881b('0x17')](_0x881b('0x24'),_0x1f1a04);logger[_0x881b('0x25')]('GetSmsQueue',_0x1f1a04,JSON[_0x881b('0x14')](_0x3e1b39));_0x3425fd(_0x3e1b39);})[_0x881b('0x26')](function(_0x1d36fe){logger[_0x881b('0x15')](_0x881b('0x24'),_0x1d36fe[_0x881b('0x16')],_0x1f1a04);_0x4f0b28(_0x6986e2[_0x881b('0x15')](0x1f4,_0x1d36fe[_0x881b('0x16')]));});});};exports[_0x881b('0x27')]=function(_0x40a46d){var _0x4ecfa2=this;return new Promise(function(_0x508455,_0x406dbe){return db[_0x881b('0x19')][_0x881b('0x28')]({'raw':_0x40a46d[_0x881b('0x1b')]?_0x40a46d[_0x881b('0x1b')][_0x881b('0x1c')]===undefined?!![]:![]:!![],'where':_0x40a46d[_0x881b('0x1b')]?_0x40a46d['options'][_0x881b('0x1d')]||null:null,'attributes':_0x40a46d['options']?_0x40a46d[_0x881b('0x1b')]['attributes']||null:null,'include':_0x40a46d['options']?_0x40a46d[_0x881b('0x1b')]['include']?_['map'](_0x40a46d[_0x881b('0x1b')][_0x881b('0x20')],function(_0x101f22){return{'model':db[_0x101f22[_0x881b('0x22')]],'as':_0x101f22['as'],'attributes':_0x101f22['attributes'],'include':_0x101f22['include']?_['map'](_0x101f22['include'],function(_0x3d7af5){return{'model':db[_0x3d7af5[_0x881b('0x22')]],'as':_0x3d7af5['as'],'attributes':_0x3d7af5['attributes'],'include':_0x3d7af5[_0x881b('0x20')]?_['map'](_0x3d7af5[_0x881b('0x20')],function(_0x512202){return{'model':db[_0x512202[_0x881b('0x22')]],'as':_0x512202['as'],'attributes':_0x512202[_0x881b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x881b('0x23')](function(_0x300a9f){logger['info']('ShowSmsQueue',_0x40a46d);logger['debug']('ShowSmsQueue',_0x40a46d,JSON[_0x881b('0x14')](_0x300a9f));_0x508455(_0x300a9f);})[_0x881b('0x26')](function(_0x23fc40){logger[_0x881b('0x15')]('ShowSmsQueue',_0x23fc40[_0x881b('0x16')],_0x40a46d);_0x406dbe(_0x4ecfa2[_0x881b('0x15')](0x1f4,_0x23fc40['message']));});});}; \ No newline at end of file +var _0xa508=['ShowSmsQueue','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','SmsQueue','findAll','options','where','attributes','limit','include','map','model','GetSmsQueue','find','raw'];(function(_0x3c6ae2,_0x5c52d8){var _0x4edda=function(_0x5593eb){while(--_0x5593eb){_0x3c6ae2['push'](_0x3c6ae2['shift']());}};_0x4edda(++_0x5c52d8);}(_0xa508,0x17d));var _0x8a50=function(_0x41485e,_0x19c24){_0x41485e=_0x41485e-0x0;var _0xb532dd=_0xa508[_0x41485e];return _0xb532dd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8a50('0x0'));var BPromise=require(_0x8a50('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a50('0x2'));var db=require(_0x8a50('0x3'))['db'];var utils=require(_0x8a50('0x4'));var logger=require(_0x8a50('0x5'))(_0x8a50('0x6'));var config=require(_0x8a50('0x7'));var jayson=require(_0x8a50('0x8'));var client=jayson[_0x8a50('0x9')][_0x8a50('0xa')]({'port':0x232a});config[_0x8a50('0xb')]=_[_0x8a50('0xc')](config[_0x8a50('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')[_0x8a50('0xd')](socket);function respondWithRpcPromise(_0x12f045,_0x1677f5,_0x233ab5){return new BPromise(function(_0x113bde,_0xd4aea){return client[_0x8a50('0xe')](_0x12f045,_0x233ab5)[_0x8a50('0xf')](function(_0x23d295){logger[_0x8a50('0x10')](_0x8a50('0x11'),_0x1677f5,'request\x20sent');logger[_0x8a50('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x1677f5,_0x8a50('0x13'),JSON['stringify'](_0x23d295));if(_0x23d295['error']){if(_0x23d295[_0x8a50('0x14')][_0x8a50('0x15')]===0x1f4){logger[_0x8a50('0x14')](_0x8a50('0x11'),_0x1677f5,_0x23d295[_0x8a50('0x14')][_0x8a50('0x16')]);return _0xd4aea(_0x23d295[_0x8a50('0x14')][_0x8a50('0x16')]);}logger[_0x8a50('0x14')]('SmsQueue,\x20%s,\x20%s',_0x1677f5,_0x23d295[_0x8a50('0x14')][_0x8a50('0x16')]);return _0x113bde(_0x23d295[_0x8a50('0x14')][_0x8a50('0x16')]);}else{logger[_0x8a50('0x10')]('SmsQueue,\x20%s,\x20%s',_0x1677f5,_0x8a50('0x13'));_0x113bde(_0x23d295[_0x8a50('0x17')][_0x8a50('0x16')]);}})[_0x8a50('0x18')](function(_0x50d89c){logger[_0x8a50('0x14')]('SmsQueue,\x20%s,\x20%s',_0x1677f5,_0x50d89c);_0xd4aea(_0x50d89c);});});}exports['GetSmsQueue']=function(_0x2890da){var _0x221719=this;return new Promise(function(_0x178a58,_0x7d6d86){return db[_0x8a50('0x19')][_0x8a50('0x1a')]({'raw':_0x2890da[_0x8a50('0x1b')]?_0x2890da['options']['raw']===undefined?!![]:![]:!![],'where':_0x2890da[_0x8a50('0x1b')]?_0x2890da[_0x8a50('0x1b')][_0x8a50('0x1c')]||null:null,'attributes':_0x2890da[_0x8a50('0x1b')]?_0x2890da[_0x8a50('0x1b')][_0x8a50('0x1d')]||null:null,'limit':_0x2890da[_0x8a50('0x1b')]?_0x2890da['options'][_0x8a50('0x1e')]||null:null,'include':_0x2890da[_0x8a50('0x1b')]?_0x2890da['options'][_0x8a50('0x1f')]?_[_0x8a50('0x20')](_0x2890da[_0x8a50('0x1b')][_0x8a50('0x1f')],function(_0x56ed35){return{'model':db[_0x56ed35[_0x8a50('0x21')]],'as':_0x56ed35['as'],'attributes':_0x56ed35[_0x8a50('0x1d')],'include':_0x56ed35[_0x8a50('0x1f')]?_[_0x8a50('0x20')](_0x56ed35[_0x8a50('0x1f')],function(_0x3b08e7){return{'model':db[_0x3b08e7[_0x8a50('0x21')]],'as':_0x3b08e7['as'],'attributes':_0x3b08e7[_0x8a50('0x1d')],'include':_0x3b08e7['include']?_[_0x8a50('0x20')](_0x3b08e7[_0x8a50('0x1f')],function(_0x376496){return{'model':db[_0x376496[_0x8a50('0x21')]],'as':_0x376496['as'],'attributes':_0x376496[_0x8a50('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8a50('0xf')](function(_0x18ad55){logger[_0x8a50('0x10')]('GetSmsQueue',_0x2890da);logger[_0x8a50('0x12')](_0x8a50('0x22'),_0x2890da,JSON['stringify'](_0x18ad55));_0x178a58(_0x18ad55);})[_0x8a50('0x18')](function(_0xdbb55e){logger[_0x8a50('0x14')](_0x8a50('0x22'),_0xdbb55e[_0x8a50('0x16')],_0x2890da);_0x7d6d86(_0x221719[_0x8a50('0x14')](0x1f4,_0xdbb55e[_0x8a50('0x16')]));});});};exports['ShowSmsQueue']=function(_0x20eb1b){var _0x5987fb=this;return new Promise(function(_0x3c5e5c,_0x44f3a9){return db[_0x8a50('0x19')][_0x8a50('0x23')]({'raw':_0x20eb1b[_0x8a50('0x1b')]?_0x20eb1b[_0x8a50('0x1b')][_0x8a50('0x24')]===undefined?!![]:![]:!![],'where':_0x20eb1b['options']?_0x20eb1b[_0x8a50('0x1b')][_0x8a50('0x1c')]||null:null,'attributes':_0x20eb1b[_0x8a50('0x1b')]?_0x20eb1b['options'][_0x8a50('0x1d')]||null:null,'include':_0x20eb1b[_0x8a50('0x1b')]?_0x20eb1b[_0x8a50('0x1b')]['include']?_['map'](_0x20eb1b[_0x8a50('0x1b')][_0x8a50('0x1f')],function(_0x1ba2f1){return{'model':db[_0x1ba2f1[_0x8a50('0x21')]],'as':_0x1ba2f1['as'],'attributes':_0x1ba2f1[_0x8a50('0x1d')],'include':_0x1ba2f1['include']?_[_0x8a50('0x20')](_0x1ba2f1['include'],function(_0x553890){return{'model':db[_0x553890['model']],'as':_0x553890['as'],'attributes':_0x553890[_0x8a50('0x1d')],'include':_0x553890[_0x8a50('0x1f')]?_[_0x8a50('0x20')](_0x553890[_0x8a50('0x1f')],function(_0x39946d){return{'model':db[_0x39946d[_0x8a50('0x21')]],'as':_0x39946d['as'],'attributes':_0x39946d['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a50('0xf')](function(_0x353fa8){logger[_0x8a50('0x10')](_0x8a50('0x25'),_0x20eb1b);logger[_0x8a50('0x12')](_0x8a50('0x25'),_0x20eb1b,JSON['stringify'](_0x353fa8));_0x3c5e5c(_0x353fa8);})[_0x8a50('0x18')](function(_0x2b023e){logger[_0x8a50('0x14')](_0x8a50('0x25'),_0x2b023e[_0x8a50('0x16')],_0x20eb1b);_0x44f3a9(_0x5987fb[_0x8a50('0x14')](0x1f4,_0x2b023e[_0x8a50('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 3c9e315..2dfc2ee 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 _0xe5bd=['length','smsQueue:','save','remove','update','emit','removeListener','register'];(function(_0x5337df,_0x13d978){var _0x5cca83=function(_0x515d04){while(--_0x515d04){_0x5337df['push'](_0x5337df['shift']());}};_0x5cca83(++_0x13d978);}(_0xe5bd,0x1ea));var _0xde5b=function(_0x46dea8,_0x53bb5c){_0x46dea8=_0x46dea8-0x0;var _0x136ea5=_0xe5bd[_0x46dea8];return _0x136ea5;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xde5b('0x0'),_0xde5b('0x1'),_0xde5b('0x2')];function createListener(_0x3fad13,_0x1d109f){return function(_0x2b041c){_0x1d109f[_0xde5b('0x3')](_0x3fad13,_0x2b041c);};}function removeListener(_0x70cdd4,_0x3f2ee1){return function(){SmsQueueEvents[_0xde5b('0x4')](_0x70cdd4,_0x3f2ee1);};}exports[_0xde5b('0x5')]=function(_0x2ed610){for(var _0x1bd908=0x0,_0x23bce7=events[_0xde5b('0x6')];_0x1bd908<_0x23bce7;_0x1bd908++){var _0x7c63e1=events[_0x1bd908];var _0x56cea6=createListener(_0xde5b('0x7')+_0x7c63e1,_0x2ed610);SmsQueueEvents['on'](_0x7c63e1,_0x56cea6);}}; \ No newline at end of file +var _0x6648=['smsQueue:','./smsQueue.events','save','update','removeListener','length'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x6648,0x8b));var _0x8664=function(_0x3f6134,_0x3bf3e1){_0x3f6134=_0x3f6134-0x0;var _0x5c17bf=_0x6648[_0x3f6134];return _0x5c17bf;};'use strict';var SmsQueueEvents=require(_0x8664('0x0'));var events=[_0x8664('0x1'),'remove',_0x8664('0x2')];function createListener(_0x1bebed,_0x3f3973){return function(_0x463f70){_0x3f3973['emit'](_0x1bebed,_0x463f70);};}function removeListener(_0x3e8832,_0xac1b1c){return function(){SmsQueueEvents[_0x8664('0x3')](_0x3e8832,_0xac1b1c);};}exports['register']=function(_0xd9c8a9){for(var _0x45ab37=0x0,_0x4c51e5=events[_0x8664('0x4')];_0x45ab37<_0x4c51e5;_0x45ab37++){var _0x1df30f=events[_0x45ab37];var _0x60c6f=createListener(_0x8664('0x5')+_0x1df30f,_0xd9c8a9);SmsQueueEvents['on'](_0x1df30f,_0x60c6f);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 84c5e9b..111ca40 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 _0xe64b=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x5136a7,_0x157cfa){var _0xeed00=function(_0x15e922){while(--_0x15e922){_0x5136a7['push'](_0x5136a7['shift']());}};_0xeed00(++_0x157cfa);}(_0xe64b,0xc4));var _0xbe64=function(_0x1c616f,_0x49fc48){_0x1c616f=_0x1c616f-0x0;var _0x43627a=_0xe64b[_0x1c616f];return _0x43627a;};'use strict';var multer=require(_0xbe64('0x0'));var util=require('util');var path=require(_0xbe64('0x1'));var timeout=require(_0xbe64('0x2'));var express=require('express');var router=express[_0xbe64('0x3')]();var fs_extra=require(_0xbe64('0x4'));var auth=require(_0xbe64('0x5'));var interaction=require(_0xbe64('0x6'));var config=require(_0xbe64('0x7'));var controller=require(_0xbe64('0x8'));router[_0xbe64('0x9')]('/',auth[_0xbe64('0xa')](),controller['index']);router[_0xbe64('0x9')](_0xbe64('0xb'),auth['isAuthenticated'](),controller[_0xbe64('0xc')]);router[_0xbe64('0x9')](_0xbe64('0xd'),auth['isAuthenticated'](),controller[_0xbe64('0xe')]);router[_0xbe64('0xf')]('/',auth[_0xbe64('0xa')](),controller[_0xbe64('0x10')]);router[_0xbe64('0x11')](_0xbe64('0xd'),auth[_0xbe64('0xa')](),controller[_0xbe64('0x12')]);router[_0xbe64('0x13')](_0xbe64('0xd'),auth[_0xbe64('0xa')](),controller[_0xbe64('0x14')]);module[_0xbe64('0x15')]=router; \ No newline at end of file +var _0x589b=['put','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','create'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x589b,0x1b2));var _0xb589=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x589b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb589('0x0'));var util=require(_0xb589('0x1'));var path=require('path');var timeout=require(_0xb589('0x2'));var express=require(_0xb589('0x3'));var router=express[_0xb589('0x4')]();var fs_extra=require(_0xb589('0x5'));var auth=require(_0xb589('0x6'));var interaction=require(_0xb589('0x7'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0xb589('0x8')]('/',auth['isAuthenticated'](),controller[_0xb589('0x9')]);router[_0xb589('0x8')](_0xb589('0xa'),auth[_0xb589('0xb')](),controller[_0xb589('0xc')]);router['get'](_0xb589('0xd'),auth[_0xb589('0xb')](),controller[_0xb589('0xe')]);router['post']('/',auth[_0xb589('0xb')](),controller[_0xb589('0xf')]);router[_0xb589('0x10')]('/:id',auth[_0xb589('0xb')](),controller['update']);router['delete'](_0xb589('0xd'),auth[_0xb589('0xb')](),controller[_0xb589('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 6a33ca2..131ae43 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 _0x9cf1=['DATE','sequelize','STRING'];(function(_0xdbb69f,_0x1a0860){var _0x4fd322=function(_0x483261){while(--_0x483261){_0xdbb69f['push'](_0xdbb69f['shift']());}};_0x4fd322(++_0x1a0860);}(_0x9cf1,0xc1));var _0x19cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cf1[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x19cf('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x19cf('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x19cf('0x1')]},'joinAt':{'type':Sequelize[_0x19cf('0x2')]},'leaveAt':{'type':Sequelize[_0x19cf('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x19cf('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcad8=['DATE','moment','sequelize','exports','STRING'];(function(_0x492c02,_0x3fac0e){var _0x471da7=function(_0x48ed4a){while(--_0x48ed4a){_0x492c02['push'](_0x492c02['shift']());}};_0x471da7(++_0x3fac0e);}(_0xcad8,0x114));var _0x8cad=function(_0x1d765e,_0x41d941){_0x1d765e=_0x1d765e-0x0;var _0x75e259=_0xcad8[_0x1d765e];return _0x75e259;};'use strict';var moment=require(_0x8cad('0x0'));var Sequelize=require(_0x8cad('0x1'));module[_0x8cad('0x2')]={'uniqueid':{'type':Sequelize[_0x8cad('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8cad('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8cad('0x4')]},'exitAt':{'type':Sequelize[_0x8cad('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index f907206..e792dbe 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 _0x7bf5=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','end','error','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','SmsQueueReport','findAll','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1b5c20,_0x14de97){var _0x3d1f17=function(_0x36b7be){while(--_0x36b7be){_0x1b5c20['push'](_0x1b5c20['shift']());}};_0x3d1f17(++_0x14de97);}(_0x7bf5,0xc2));var _0x57bf=function(_0xbf10ab,_0x5f5ba4){_0xbf10ab=_0xbf10ab-0x0;var _0x2c5fb3=_0x7bf5[_0xbf10ab];return _0x2c5fb3;};'use strict';var emlformat=require(_0x57bf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x57bf('0x1'));var jsonpatch=require(_0x57bf('0x2'));var rp=require(_0x57bf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x57bf('0x4'));var util=require(_0x57bf('0x5'));var path=require(_0x57bf('0x6'));var sox=require('sox');var csv=require(_0x57bf('0x7'));var ejs=require(_0x57bf('0x8'));var fs=require('fs');var fs_extra=require(_0x57bf('0x9'));var _=require(_0x57bf('0xa'));var squel=require(_0x57bf('0xb'));var crypto=require(_0x57bf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x57bf('0xd'));var toCsv=require(_0x57bf('0x7'));var querystring=require(_0x57bf('0xe'));var Papa=require(_0x57bf('0xf'));var Redis=require(_0x57bf('0x10'));var authService=require(_0x57bf('0x11'));var qs=require(_0x57bf('0x12'));var as=require(_0x57bf('0x13'));var hardwareService=require(_0x57bf('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x57bf('0x15'));var licenseUtil=require(_0x57bf('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d88ea,_0x52ea9f){_0x52ea9f=_0x52ea9f||0xcc;return function(_0x521174){if(_0x521174){return _0x5d88ea[_0x57bf('0x17')](_0x52ea9f);}return _0x5d88ea[_0x57bf('0x18')](_0x52ea9f)['end']();};}function respondWithResult(_0xac074,_0x400678){_0x400678=_0x400678||0xc8;return function(_0x41f402){if(_0x41f402){return _0xac074['status'](_0x400678)[_0x57bf('0x19')](_0x41f402);}};}function respondWithFilteredResult(_0x2d7afc,_0x2aad04){return function(_0x32d14b){if(_0x32d14b){var _0x463c33=typeof _0x2aad04['offset']==='undefined'&&typeof _0x2aad04[_0x57bf('0x1a')]===_0x57bf('0x1b');var _0x459082=_0x32d14b[_0x57bf('0x1c')];var _0x27a6b1=_0x463c33?0x0:_0x2aad04['offset'];var _0x214075=_0x463c33?_0x32d14b['count']:_0x2aad04[_0x57bf('0x1d')]+_0x2aad04['limit'];var _0x1ae53d;if(_0x214075>=_0x459082){_0x214075=_0x459082;_0x1ae53d=0xc8;}else{_0x1ae53d=0xce;}_0x2d7afc['status'](_0x1ae53d);return _0x2d7afc['set'](_0x57bf('0x1e'),_0x27a6b1+'-'+_0x214075+'/'+_0x459082)[_0x57bf('0x19')](_0x32d14b);}return null;};}function patchUpdates(_0x39fa4a){return function(_0x6ccff6){try{jsonpatch[_0x57bf('0x1f')](_0x6ccff6,_0x39fa4a,!![]);}catch(_0x4b3ab6){return BPromise[_0x57bf('0x20')](_0x4b3ab6);}return _0x6ccff6['save']();};}function saveUpdates(_0x4825e4,_0x161c2d){return function(_0x2a5e49){if(_0x2a5e49){return _0x2a5e49[_0x57bf('0x21')](_0x4825e4)[_0x57bf('0x22')](function(_0x1ef621){return _0x1ef621;});}return null;};}function removeEntity(_0x3414ed,_0x52b1a4){return function(_0x420dbc){if(_0x420dbc){return _0x420dbc[_0x57bf('0x23')]()[_0x57bf('0x22')](function(){_0x3414ed[_0x57bf('0x18')](0xcc)[_0x57bf('0x24')]();});}};}function handleEntityNotFound(_0x29b002,_0x48f0c0){return function(_0x2ce27){if(!_0x2ce27){_0x29b002[_0x57bf('0x17')](0x194);}return _0x2ce27;};}function handleError(_0x438efb,_0x2fba72){_0x2fba72=_0x2fba72||0x1f4;return function(_0x2550d1){logger[_0x57bf('0x25')](_0x2550d1['stack']);if(_0x2550d1['name']){delete _0x2550d1[_0x57bf('0x26')];}_0x438efb[_0x57bf('0x18')](_0x2fba72)['send'](_0x2550d1);};}exports[_0x57bf('0x27')]=function(_0x1a0260,_0xc3ca0d){var _0x61be65={},_0x184eb4={},_0x19bbec={'count':0x0,'rows':[]};var _0x115e18=_['map'](db['SmsQueueReport'][_0x57bf('0x28')],function(_0x1c441c){return{'name':_0x1c441c[_0x57bf('0x29')],'type':_0x1c441c[_0x57bf('0x2a')][_0x57bf('0x2b')]};});_0x184eb4[_0x57bf('0x2c')]=_['map'](_0x115e18,'name');_0x184eb4[_0x57bf('0x2d')]=_[_0x57bf('0x2e')](_0x1a0260[_0x57bf('0x2d')]);_0x184eb4[_0x57bf('0x2f')]=_[_0x57bf('0x30')](_0x184eb4[_0x57bf('0x2c')],_0x184eb4[_0x57bf('0x2d')]);_0x61be65['attributes']=_[_0x57bf('0x30')](_0x184eb4[_0x57bf('0x2c')],qs[_0x57bf('0x31')](_0x1a0260[_0x57bf('0x2d')]['fields']));_0x61be65[_0x57bf('0x32')]=_0x61be65['attributes'][_0x57bf('0x33')]?_0x61be65[_0x57bf('0x32')]:_0x184eb4[_0x57bf('0x2c')];if(!_0x1a0260[_0x57bf('0x2d')][_0x57bf('0x34')](_0x57bf('0x35'))){_0x61be65[_0x57bf('0x1a')]=qs[_0x57bf('0x1a')](_0x1a0260[_0x57bf('0x2d')][_0x57bf('0x1a')]);_0x61be65[_0x57bf('0x1d')]=qs[_0x57bf('0x1d')](_0x1a0260[_0x57bf('0x2d')]['offset']);}_0x61be65['order']=qs[_0x57bf('0x36')](_0x1a0260[_0x57bf('0x2d')][_0x57bf('0x36')]);_0x61be65[_0x57bf('0x37')]=qs[_0x57bf('0x2f')](_['pick'](_0x1a0260['query'],_0x184eb4[_0x57bf('0x2f')]),_0x115e18);if(_0x1a0260[_0x57bf('0x2d')][_0x57bf('0x38')]){_0x61be65[_0x57bf('0x37')]=_['merge'](_0x61be65[_0x57bf('0x37')],{'$or':_['map'](_0x115e18,function(_0x352291){if(_0x352291[_0x57bf('0x2a')]!==_0x57bf('0x39')){var _0x387a60={};_0x387a60[_0x352291[_0x57bf('0x26')]]={'$like':'%'+_0x1a0260[_0x57bf('0x2d')][_0x57bf('0x38')]+'%'};return _0x387a60;}})});}_0x61be65=_[_0x57bf('0x3a')]({},_0x61be65,_0x1a0260[_0x57bf('0x3b')]);var _0x7fc802={'where':_0x61be65[_0x57bf('0x37')]};return db['SmsQueueReport'][_0x57bf('0x1c')](_0x7fc802)['then'](function(_0x39bcc5){_0x19bbec[_0x57bf('0x1c')]=_0x39bcc5;if(_0x1a0260[_0x57bf('0x2d')][_0x57bf('0x3c')]){_0x61be65[_0x57bf('0x3d')]=[{'all':!![]}];}return db[_0x57bf('0x3e')][_0x57bf('0x3f')](_0x61be65);})[_0x57bf('0x22')](function(_0x3e99bf){_0x19bbec['rows']=_0x3e99bf;return _0x19bbec;})[_0x57bf('0x22')](respondWithFilteredResult(_0xc3ca0d,_0x61be65))[_0x57bf('0x40')](handleError(_0xc3ca0d,null));};exports[_0x57bf('0x41')]=function(_0xf9aa56,_0x5e8477){var _0x3a1bea={'raw':!![],'where':{'id':_0xf9aa56[_0x57bf('0x42')]['id']}},_0xb43a0c={};_0xb43a0c[_0x57bf('0x2c')]=_[_0x57bf('0x2e')](db[_0x57bf('0x3e')][_0x57bf('0x28')]);_0xb43a0c['query']=_[_0x57bf('0x2e')](_0xf9aa56[_0x57bf('0x2d')]);_0xb43a0c['filters']=_[_0x57bf('0x30')](_0xb43a0c['model'],_0xb43a0c[_0x57bf('0x2d')]);_0x3a1bea[_0x57bf('0x32')]=_[_0x57bf('0x30')](_0xb43a0c['model'],qs[_0x57bf('0x31')](_0xf9aa56['query'][_0x57bf('0x31')]));_0x3a1bea[_0x57bf('0x32')]=_0x3a1bea[_0x57bf('0x32')]['length']?_0x3a1bea[_0x57bf('0x32')]:_0xb43a0c[_0x57bf('0x2c')];if(_0xf9aa56[_0x57bf('0x2d')]['includeAll']){_0x3a1bea[_0x57bf('0x3d')]=[{'all':!![]}];}_0x3a1bea=_[_0x57bf('0x3a')]({},_0x3a1bea,_0xf9aa56[_0x57bf('0x3b')]);return db[_0x57bf('0x3e')][_0x57bf('0x43')](_0x3a1bea)[_0x57bf('0x22')](handleEntityNotFound(_0x5e8477,null))['then'](respondWithResult(_0x5e8477,null))[_0x57bf('0x40')](handleError(_0x5e8477,null));};exports[_0x57bf('0x44')]=function(_0x1928e9,_0x34e809){return db[_0x57bf('0x3e')][_0x57bf('0x44')](_0x1928e9['body'],{})['then'](respondWithResult(_0x34e809,0xc9))[_0x57bf('0x40')](handleError(_0x34e809,null));};exports[_0x57bf('0x21')]=function(_0x5bf828,_0x1ab01a){if(_0x5bf828['body']['id']){delete _0x5bf828[_0x57bf('0x45')]['id'];}return db[_0x57bf('0x3e')]['find']({'where':{'id':_0x5bf828[_0x57bf('0x42')]['id']}})[_0x57bf('0x22')](handleEntityNotFound(_0x1ab01a,null))[_0x57bf('0x22')](saveUpdates(_0x5bf828[_0x57bf('0x45')],null))['then'](respondWithResult(_0x1ab01a,null))[_0x57bf('0x40')](handleError(_0x1ab01a,null));};exports[_0x57bf('0x23')]=function(_0x36404a,_0x5172c8){return db[_0x57bf('0x3e')][_0x57bf('0x43')]({'where':{'id':_0x36404a['params']['id']}})[_0x57bf('0x22')](handleEntityNotFound(_0x5172c8,null))['then'](removeEntity(_0x5172c8,null))[_0x57bf('0x40')](handleError(_0x5172c8,null));};exports[_0x57bf('0x46')]=function(_0x3eafdf,_0x1b1a85){return db[_0x57bf('0x3e')][_0x57bf('0x46')]()[_0x57bf('0x22')](respondWithResult(_0x1b1a85,null))[_0x57bf('0x40')](handleError(_0x1b1a85,null));}; \ No newline at end of file +var _0xf6ba=['query','attributes','fields','length','sort','pick','filter','merge','where','type','VIRTUAL','options','SmsQueueReport','then','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','json','offset','limit','count','status','set','Content-Range','save','end','error','stack','name','index','map','rawAttributes','fieldName','filters','intersection','model'];(function(_0x51b948,_0x4b7e0c){var _0x1e7ba9=function(_0x28c894){while(--_0x28c894){_0x51b948['push'](_0x51b948['shift']());}};_0x1e7ba9(++_0x4b7e0c);}(_0xf6ba,0x1ac));var _0xaf6b=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xf6ba[_0x122096];return _0x3d1966;};'use strict';var emlformat=require(_0xaf6b('0x0'));var rimraf=require(_0xaf6b('0x1'));var zipdir=require(_0xaf6b('0x2'));var jsonpatch=require(_0xaf6b('0x3'));var rp=require(_0xaf6b('0x4'));var moment=require(_0xaf6b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaf6b('0x6'));var util=require('util');var path=require(_0xaf6b('0x7'));var sox=require(_0xaf6b('0x8'));var csv=require(_0xaf6b('0x9'));var ejs=require(_0xaf6b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf6b('0xb'));var squel=require(_0xaf6b('0xc'));var crypto=require(_0xaf6b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaf6b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaf6b('0xf'));var authService=require(_0xaf6b('0x10'));var qs=require(_0xaf6b('0x11'));var as=require(_0xaf6b('0x12'));var hardwareService=require(_0xaf6b('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf6b('0x14'));var config=require(_0xaf6b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x428b9f,_0x400a49){_0x400a49=_0x400a49||0xcc;return function(_0x4ecbcf){if(_0x4ecbcf){return _0x428b9f['sendStatus'](_0x400a49);}return _0x428b9f['status'](_0x400a49)['end']();};}function respondWithResult(_0x3d7879,_0xad028d){_0xad028d=_0xad028d||0xc8;return function(_0xe49615){if(_0xe49615){return _0x3d7879['status'](_0xad028d)[_0xaf6b('0x16')](_0xe49615);}};}function respondWithFilteredResult(_0x16459f,_0x5a72e9){return function(_0x17b01d){if(_0x17b01d){var _0x21f124=typeof _0x5a72e9[_0xaf6b('0x17')]==='undefined'&&typeof _0x5a72e9[_0xaf6b('0x18')]==='undefined';var _0x41f7bf=_0x17b01d[_0xaf6b('0x19')];var _0x106566=_0x21f124?0x0:_0x5a72e9[_0xaf6b('0x17')];var _0x4b4bd6=_0x21f124?_0x17b01d[_0xaf6b('0x19')]:_0x5a72e9['offset']+_0x5a72e9[_0xaf6b('0x18')];var _0x1bb33a;if(_0x4b4bd6>=_0x41f7bf){_0x4b4bd6=_0x41f7bf;_0x1bb33a=0xc8;}else{_0x1bb33a=0xce;}_0x16459f[_0xaf6b('0x1a')](_0x1bb33a);return _0x16459f[_0xaf6b('0x1b')](_0xaf6b('0x1c'),_0x106566+'-'+_0x4b4bd6+'/'+_0x41f7bf)[_0xaf6b('0x16')](_0x17b01d);}return null;};}function patchUpdates(_0x17bc49){return function(_0x4c341b){try{jsonpatch['apply'](_0x4c341b,_0x17bc49,!![]);}catch(_0x13753f){return BPromise['reject'](_0x13753f);}return _0x4c341b[_0xaf6b('0x1d')]();};}function saveUpdates(_0x4ef16a,_0x3b0117){return function(_0x41c019){if(_0x41c019){return _0x41c019['update'](_0x4ef16a)['then'](function(_0x22a5a6){return _0x22a5a6;});}return null;};}function removeEntity(_0x257565,_0x4e752c){return function(_0x378c81){if(_0x378c81){return _0x378c81['destroy']()['then'](function(){_0x257565[_0xaf6b('0x1a')](0xcc)[_0xaf6b('0x1e')]();});}};}function handleEntityNotFound(_0x1b278d,_0x3493c1){return function(_0x110975){if(!_0x110975){_0x1b278d['sendStatus'](0x194);}return _0x110975;};}function handleError(_0x55f4f5,_0x2b57a4){_0x2b57a4=_0x2b57a4||0x1f4;return function(_0x1a638c){logger[_0xaf6b('0x1f')](_0x1a638c[_0xaf6b('0x20')]);if(_0x1a638c[_0xaf6b('0x21')]){delete _0x1a638c[_0xaf6b('0x21')];}_0x55f4f5[_0xaf6b('0x1a')](_0x2b57a4)['send'](_0x1a638c);};}exports[_0xaf6b('0x22')]=function(_0x3192ae,_0x29c625){var _0x11160e={},_0x455a44={},_0x5048e9={'count':0x0,'rows':[]};var _0x38dc56=_[_0xaf6b('0x23')](db['SmsQueueReport'][_0xaf6b('0x24')],function(_0x5a0a86){return{'name':_0x5a0a86[_0xaf6b('0x25')],'type':_0x5a0a86['type']['key']};});_0x455a44['model']=_['map'](_0x38dc56,_0xaf6b('0x21'));_0x455a44['query']=_['keys'](_0x3192ae['query']);_0x455a44[_0xaf6b('0x26')]=_[_0xaf6b('0x27')](_0x455a44[_0xaf6b('0x28')],_0x455a44[_0xaf6b('0x29')]);_0x11160e[_0xaf6b('0x2a')]=_[_0xaf6b('0x27')](_0x455a44[_0xaf6b('0x28')],qs['fields'](_0x3192ae[_0xaf6b('0x29')][_0xaf6b('0x2b')]));_0x11160e[_0xaf6b('0x2a')]=_0x11160e[_0xaf6b('0x2a')][_0xaf6b('0x2c')]?_0x11160e[_0xaf6b('0x2a')]:_0x455a44[_0xaf6b('0x28')];if(!_0x3192ae[_0xaf6b('0x29')]['hasOwnProperty']('nolimit')){_0x11160e[_0xaf6b('0x18')]=qs['limit'](_0x3192ae['query'][_0xaf6b('0x18')]);_0x11160e['offset']=qs[_0xaf6b('0x17')](_0x3192ae[_0xaf6b('0x29')][_0xaf6b('0x17')]);}_0x11160e['order']=qs[_0xaf6b('0x2d')](_0x3192ae[_0xaf6b('0x29')][_0xaf6b('0x2d')]);_0x11160e['where']=qs[_0xaf6b('0x26')](_[_0xaf6b('0x2e')](_0x3192ae[_0xaf6b('0x29')],_0x455a44[_0xaf6b('0x26')]),_0x38dc56);if(_0x3192ae[_0xaf6b('0x29')][_0xaf6b('0x2f')]){_0x11160e['where']=_[_0xaf6b('0x30')](_0x11160e[_0xaf6b('0x31')],{'$or':_[_0xaf6b('0x23')](_0x38dc56,function(_0x487dac){if(_0x487dac[_0xaf6b('0x32')]!==_0xaf6b('0x33')){var _0x1cf8d1={};_0x1cf8d1[_0x487dac[_0xaf6b('0x21')]]={'$like':'%'+_0x3192ae['query'][_0xaf6b('0x2f')]+'%'};return _0x1cf8d1;}})});}_0x11160e=_['merge']({},_0x11160e,_0x3192ae[_0xaf6b('0x34')]);var _0x45a831={'where':_0x11160e[_0xaf6b('0x31')]};return db[_0xaf6b('0x35')][_0xaf6b('0x19')](_0x45a831)[_0xaf6b('0x36')](function(_0x71e7db){_0x5048e9[_0xaf6b('0x19')]=_0x71e7db;if(_0x3192ae['query'][_0xaf6b('0x37')]){_0x11160e[_0xaf6b('0x38')]=[{'all':!![]}];}return db[_0xaf6b('0x35')][_0xaf6b('0x39')](_0x11160e);})[_0xaf6b('0x36')](function(_0x30968c){_0x5048e9['rows']=_0x30968c;return _0x5048e9;})['then'](respondWithFilteredResult(_0x29c625,_0x11160e))[_0xaf6b('0x3a')](handleError(_0x29c625,null));};exports[_0xaf6b('0x3b')]=function(_0x123eff,_0x3a1073){var _0x4610f2={'raw':!![],'where':{'id':_0x123eff[_0xaf6b('0x3c')]['id']}},_0x373112={};_0x373112['model']=_[_0xaf6b('0x3d')](db[_0xaf6b('0x35')][_0xaf6b('0x24')]);_0x373112[_0xaf6b('0x29')]=_[_0xaf6b('0x3d')](_0x123eff[_0xaf6b('0x29')]);_0x373112[_0xaf6b('0x26')]=_['intersection'](_0x373112[_0xaf6b('0x28')],_0x373112[_0xaf6b('0x29')]);_0x4610f2[_0xaf6b('0x2a')]=_[_0xaf6b('0x27')](_0x373112[_0xaf6b('0x28')],qs[_0xaf6b('0x2b')](_0x123eff[_0xaf6b('0x29')][_0xaf6b('0x2b')]));_0x4610f2[_0xaf6b('0x2a')]=_0x4610f2['attributes']['length']?_0x4610f2['attributes']:_0x373112[_0xaf6b('0x28')];if(_0x123eff['query'][_0xaf6b('0x37')]){_0x4610f2[_0xaf6b('0x38')]=[{'all':!![]}];}_0x4610f2=_[_0xaf6b('0x30')]({},_0x4610f2,_0x123eff['options']);return db[_0xaf6b('0x35')][_0xaf6b('0x3e')](_0x4610f2)['then'](handleEntityNotFound(_0x3a1073,null))['then'](respondWithResult(_0x3a1073,null))[_0xaf6b('0x3a')](handleError(_0x3a1073,null));};exports[_0xaf6b('0x3f')]=function(_0x1b7467,_0x5af9f5){return db[_0xaf6b('0x35')][_0xaf6b('0x3f')](_0x1b7467[_0xaf6b('0x40')],{})[_0xaf6b('0x36')](respondWithResult(_0x5af9f5,0xc9))[_0xaf6b('0x3a')](handleError(_0x5af9f5,null));};exports['update']=function(_0xf4781e,_0x3db3a1){if(_0xf4781e[_0xaf6b('0x40')]['id']){delete _0xf4781e['body']['id'];}return db[_0xaf6b('0x35')][_0xaf6b('0x3e')]({'where':{'id':_0xf4781e[_0xaf6b('0x3c')]['id']}})[_0xaf6b('0x36')](handleEntityNotFound(_0x3db3a1,null))['then'](saveUpdates(_0xf4781e[_0xaf6b('0x40')],null))[_0xaf6b('0x36')](respondWithResult(_0x3db3a1,null))['catch'](handleError(_0x3db3a1,null));};exports[_0xaf6b('0x41')]=function(_0x1ac092,_0x4974bf){return db[_0xaf6b('0x35')][_0xaf6b('0x3e')]({'where':{'id':_0x1ac092[_0xaf6b('0x3c')]['id']}})[_0xaf6b('0x36')](handleEntityNotFound(_0x4974bf,null))['then'](removeEntity(_0x4974bf,null))[_0xaf6b('0x3a')](handleError(_0x4974bf,null));};exports[_0xaf6b('0x42')]=function(_0x471c6b,_0x5b6a7b){return db[_0xaf6b('0x35')]['describe']()[_0xaf6b('0x36')](respondWithResult(_0x5b6a7b,null))[_0xaf6b('0x3a')](handleError(_0x5b6a7b,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 11625be..6f992c1 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 _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x5698d9,_0x3a2195){var _0x1408cb=function(_0x9d19d9){while(--_0x9d19d9){_0x5698d9['push'](_0x5698d9['shift']());}};_0x1408cb(++_0x3a2195);}(_0x70e0,0x17b));var _0x070e=function(_0x5367ca,_0x32daaf){_0x5367ca=_0x5367ca-0x0;var _0x10af8d=_0x70e0[_0x5367ca];return _0x10af8d;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 d392037..e4aff07 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 _0x4b7d=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','catch','CreateSmsQueueReport','body','options','raw','UpdateSmsQueueReport','SmsQueueReport','where','limit'];(function(_0x202135,_0xf4dd33){var _0x375e49=function(_0x36ffdb){while(--_0x36ffdb){_0x202135['push'](_0x202135['shift']());}};_0x375e49(++_0xf4dd33);}(_0x4b7d,0x10e));var _0xd4b7=function(_0x3c7610,_0x5de187){_0x3c7610=_0x3c7610-0x0;var _0x875763=_0x4b7d[_0x3c7610];return _0x875763;};'use strict';var _=require(_0xd4b7('0x0'));var util=require(_0xd4b7('0x1'));var moment=require(_0xd4b7('0x2'));var BPromise=require(_0xd4b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4b7('0x4'));var db=require(_0xd4b7('0x5'))['db'];var utils=require(_0xd4b7('0x6'));var logger=require(_0xd4b7('0x7'))(_0xd4b7('0x8'));var config=require('../../config/environment');var jayson=require(_0xd4b7('0x9'));var client=jayson[_0xd4b7('0xa')][_0xd4b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ad630,_0x5b5113,_0x276b48){return new BPromise(function(_0xe24442,_0x56a384){return client[_0xd4b7('0xc')](_0x2ad630,_0x276b48)[_0xd4b7('0xd')](function(_0x2e8dec){logger['info'](_0xd4b7('0xe'),_0x5b5113,'request\x20sent');logger[_0xd4b7('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x5b5113,_0xd4b7('0x10'),JSON[_0xd4b7('0x11')](_0x2e8dec));if(_0x2e8dec['error']){if(_0x2e8dec['error'][_0xd4b7('0x12')]===0x1f4){logger[_0xd4b7('0x13')](_0xd4b7('0xe'),_0x5b5113,_0x2e8dec['error'][_0xd4b7('0x14')]);return _0x56a384(_0x2e8dec[_0xd4b7('0x13')]['message']);}logger['error'](_0xd4b7('0xe'),_0x5b5113,_0x2e8dec[_0xd4b7('0x13')][_0xd4b7('0x14')]);return _0xe24442(_0x2e8dec[_0xd4b7('0x13')][_0xd4b7('0x14')]);}else{logger['info'](_0xd4b7('0xe'),_0x5b5113,_0xd4b7('0x10'));_0xe24442(_0x2e8dec['result'][_0xd4b7('0x14')]);}})[_0xd4b7('0x15')](function(_0x4dea3b){logger[_0xd4b7('0x13')](_0xd4b7('0xe'),_0x5b5113,_0x4dea3b);_0x56a384(_0x4dea3b);});});}exports[_0xd4b7('0x16')]=function(_0x2ad7f){var _0x492ad8=this;return new Promise(function(_0x27f936,_0x43a711){return db['SmsQueueReport']['create'](_0x2ad7f[_0xd4b7('0x17')],{'raw':_0x2ad7f['options']?_0x2ad7f[_0xd4b7('0x18')][_0xd4b7('0x19')]===undefined?!![]:![]:!![]})[_0xd4b7('0xd')](function(_0x6e869d){logger['info'](_0xd4b7('0x16'),_0x2ad7f);logger[_0xd4b7('0xf')](_0xd4b7('0x16'),_0x2ad7f,JSON['stringify'](_0x6e869d));_0x27f936(_0x6e869d);})['catch'](function(_0x922e07){logger[_0xd4b7('0x13')](_0xd4b7('0x16'),_0x922e07['message'],_0x2ad7f);_0x43a711(_0x492ad8[_0xd4b7('0x13')](0x1f4,_0x922e07[_0xd4b7('0x14')]));});});};exports[_0xd4b7('0x1a')]=function(_0x11e1c1){var _0xa1ad6d=this;return new Promise(function(_0x55da54,_0x2effc0){return db[_0xd4b7('0x1b')]['update'](_0x11e1c1[_0xd4b7('0x17')],{'raw':_0x11e1c1['options']?_0x11e1c1[_0xd4b7('0x18')][_0xd4b7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11e1c1[_0xd4b7('0x18')]?_0x11e1c1[_0xd4b7('0x18')][_0xd4b7('0x1c')]||null:null,'attributes':_0x11e1c1[_0xd4b7('0x18')]?_0x11e1c1['options']['attributes']||null:null,'limit':_0x11e1c1['options']?_0x11e1c1['options'][_0xd4b7('0x1d')]||null:null})[_0xd4b7('0xd')](function(_0x1d80c6){logger['info'](_0xd4b7('0x1a'),_0x11e1c1);logger['debug'](_0xd4b7('0x1a'),_0x11e1c1,JSON[_0xd4b7('0x11')](_0x1d80c6));_0x55da54(_0x1d80c6);})[_0xd4b7('0x15')](function(_0x526b32){logger[_0xd4b7('0x13')](_0xd4b7('0x1a'),_0x526b32[_0xd4b7('0x14')],_0x11e1c1);_0x2effc0(_0xa1ad6d[_0xd4b7('0x13')](0x1f4,_0x526b32['message']));});});}; \ No newline at end of file +var _0x4abc=['update','where','attributes','util','moment','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','SmsQueueReport,\x20%s,\x20%s','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport'];(function(_0x313657,_0x482da9){var _0x368270=function(_0x5ca19c){while(--_0x5ca19c){_0x313657['push'](_0x313657['shift']());}};_0x368270(++_0x482da9);}(_0x4abc,0xc0));var _0xc4ab=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x4abc[_0x44946b];return _0x249bc4;};'use strict';var _=require('lodash');var util=require(_0xc4ab('0x0'));var moment=require(_0xc4ab('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4ab('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc4ab('0x3'));var jayson=require(_0xc4ab('0x4'));var client=jayson[_0xc4ab('0x5')][_0xc4ab('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5db560,_0x3988e6,_0x49863a){return new BPromise(function(_0x324c97,_0x453c4e){return client[_0xc4ab('0x7')](_0x5db560,_0x49863a)[_0xc4ab('0x8')](function(_0x5cbc71){logger[_0xc4ab('0x9')]('SmsQueueReport,\x20%s,\x20%s',_0x3988e6,_0xc4ab('0xa'));logger[_0xc4ab('0xb')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3988e6,_0xc4ab('0xa'),JSON[_0xc4ab('0xc')](_0x5cbc71));if(_0x5cbc71[_0xc4ab('0xd')]){if(_0x5cbc71['error']['code']===0x1f4){logger[_0xc4ab('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x3988e6,_0x5cbc71[_0xc4ab('0xd')]['message']);return _0x453c4e(_0x5cbc71[_0xc4ab('0xd')][_0xc4ab('0xe')]);}logger[_0xc4ab('0xd')](_0xc4ab('0xf'),_0x3988e6,_0x5cbc71['error']['message']);return _0x324c97(_0x5cbc71[_0xc4ab('0xd')][_0xc4ab('0xe')]);}else{logger[_0xc4ab('0x9')](_0xc4ab('0xf'),_0x3988e6,_0xc4ab('0xa'));_0x324c97(_0x5cbc71['result']['message']);}})[_0xc4ab('0x10')](function(_0xaebff3){logger[_0xc4ab('0xd')](_0xc4ab('0xf'),_0x3988e6,_0xaebff3);_0x453c4e(_0xaebff3);});});}exports[_0xc4ab('0x11')]=function(_0x1cc030){var _0x11e362=this;return new Promise(function(_0x1aacb4,_0x221aad){return db[_0xc4ab('0x12')][_0xc4ab('0x13')](_0x1cc030[_0xc4ab('0x14')],{'raw':_0x1cc030[_0xc4ab('0x15')]?_0x1cc030[_0xc4ab('0x15')][_0xc4ab('0x16')]===undefined?!![]:![]:!![]})[_0xc4ab('0x8')](function(_0x3eacbe){logger[_0xc4ab('0x9')](_0xc4ab('0x11'),_0x1cc030);logger['debug'](_0xc4ab('0x11'),_0x1cc030,JSON['stringify'](_0x3eacbe));_0x1aacb4(_0x3eacbe);})[_0xc4ab('0x10')](function(_0x6cf201){logger['error'](_0xc4ab('0x11'),_0x6cf201[_0xc4ab('0xe')],_0x1cc030);_0x221aad(_0x11e362[_0xc4ab('0xd')](0x1f4,_0x6cf201[_0xc4ab('0xe')]));});});};exports[_0xc4ab('0x17')]=function(_0x2e2b38){var _0x3b9b92=this;return new Promise(function(_0x5685a2,_0x32198c){return db['SmsQueueReport'][_0xc4ab('0x18')](_0x2e2b38['body'],{'raw':_0x2e2b38['options']?_0x2e2b38['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e2b38[_0xc4ab('0x15')]?_0x2e2b38[_0xc4ab('0x15')][_0xc4ab('0x19')]||null:null,'attributes':_0x2e2b38[_0xc4ab('0x15')]?_0x2e2b38[_0xc4ab('0x15')][_0xc4ab('0x1a')]||null:null,'limit':_0x2e2b38[_0xc4ab('0x15')]?_0x2e2b38[_0xc4ab('0x15')]['limit']||null:null})['then'](function(_0x2b3a70){logger['info']('UpdateSmsQueueReport',_0x2e2b38);logger['debug']('UpdateSmsQueueReport',_0x2e2b38,JSON[_0xc4ab('0xc')](_0x2b3a70));_0x5685a2(_0x2b3a70);})[_0xc4ab('0x10')](function(_0x405324){logger['error'](_0xc4ab('0x17'),_0x405324['message'],_0x2e2b38);_0x32198c(_0x3b9b92[_0xc4ab('0xd')](0x1f4,_0x405324['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index d06320c..7529230 100644 --- a/server/api/smsTransferReport/index.js +++ b/server/api/smsTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c7b=['./smsTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','update','delete','destroy','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x4028c7,_0x5b5e3b){_0x4028c7=_0x4028c7-0x0;var _0x3c8285=_0x6c7b[_0x4028c7];return _0x3c8285;};'use strict';var multer=require(_0xb6c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb6c7('0x1'));var router=express['Router']();var fs_extra=require(_0xb6c7('0x2'));var auth=require(_0xb6c7('0x3'));var interaction=require(_0xb6c7('0x4'));var config=require('../../config/environment');var controller=require(_0xb6c7('0x5'));router[_0xb6c7('0x6')]('/',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x8')]);router[_0xb6c7('0x6')]('/describe',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x9')]);router[_0xb6c7('0x6')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xb')]);router[_0xb6c7('0xc')]('/',auth[_0xb6c7('0x7')](),controller['create']);router['put'](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xd')]);router[_0xb6c7('0xe')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6f47=['path','express','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','util'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0x6f47,0xc7));var _0x76f4=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x6f47[_0x376b45];return _0x2341b3;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var fs_extra=require(_0x76f4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var controller=require(_0x76f4('0x6'));router[_0x76f4('0x7')]('/',auth['isAuthenticated'](),controller[_0x76f4('0x8')]);router[_0x76f4('0x7')](_0x76f4('0x9'),auth['isAuthenticated'](),controller[_0x76f4('0xa')]);router[_0x76f4('0x7')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x76f4('0xe')]);router[_0x76f4('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x76f4('0x10')]);router[_0x76f4('0x11')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0x12')]);module[_0x76f4('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 9edf07c..cd22154 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x512b83,_0x4a3382){_0x512b83=_0x512b83-0x0;var _0x181abc=_0x9bde[_0x512b83];return _0x181abc;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0xe3be75,_0x27bae4){var _0x1a2477=function(_0x43e917){while(--_0x43e917){_0xe3be75['push'](_0xe3be75['shift']());}};_0x1a2477(++_0x27bae4);}(_0xaa88,0x137));var _0x8aa8=function(_0x553150,_0x589ff3){_0x553150=_0x553150-0x0;var _0x18193d=_0xaa88[_0x553150];return _0x18193d;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 8515d50..69adbb7 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 _0xfea7=['name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','rows','catch','show','length','includeAll','include','find','create','body','params','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','stack'];(function(_0x5c2e65,_0x20e630){var _0x445359=function(_0x2588d4){while(--_0x2588d4){_0x5c2e65['push'](_0x5c2e65['shift']());}};_0x445359(++_0x20e630);}(_0xfea7,0x150));var _0x7fea=function(_0x55fd89,_0x28096d){_0x55fd89=_0x55fd89-0x0;var _0x28fa12=_0xfea7[_0x55fd89];return _0x28fa12;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fea('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7fea('0x1'));var rp=require(_0x7fea('0x2'));var moment=require('moment');var BPromise=require(_0x7fea('0x3'));var Mustache=require(_0x7fea('0x4'));var util=require(_0x7fea('0x5'));var path=require('path');var sox=require(_0x7fea('0x6'));var csv=require('to-csv');var ejs=require(_0x7fea('0x7'));var fs=require('fs');var fs_extra=require(_0x7fea('0x8'));var _=require(_0x7fea('0x9'));var squel=require('squel');var crypto=require(_0x7fea('0xa'));var jsforce=require(_0x7fea('0xb'));var deskjs=require(_0x7fea('0xc'));var toCsv=require(_0x7fea('0xd'));var querystring=require(_0x7fea('0xe'));var Papa=require(_0x7fea('0xf'));var Redis=require(_0x7fea('0x10'));var authService=require(_0x7fea('0x11'));var qs=require(_0x7fea('0x12'));var as=require(_0x7fea('0x13'));var hardwareService=require(_0x7fea('0x14'));var logger=require(_0x7fea('0x15'))(_0x7fea('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7fea('0x17'));var db=require(_0x7fea('0x18'))['db'];function respondWithStatusCode(_0x173407,_0x51c456){_0x51c456=_0x51c456||0xcc;return function(_0x49e690){if(_0x49e690){return _0x173407[_0x7fea('0x19')](_0x51c456);}return _0x173407[_0x7fea('0x1a')](_0x51c456)[_0x7fea('0x1b')]();};}function respondWithResult(_0x482785,_0x1e597f){_0x1e597f=_0x1e597f||0xc8;return function(_0x226f4e){if(_0x226f4e){return _0x482785[_0x7fea('0x1a')](_0x1e597f)['json'](_0x226f4e);}};}function respondWithFilteredResult(_0x48b1e3,_0x4cb987){return function(_0x46305b){if(_0x46305b){var _0x3f6ef4=typeof _0x4cb987['offset']===_0x7fea('0x1c')&&typeof _0x4cb987[_0x7fea('0x1d')]===_0x7fea('0x1c');var _0x18dfc9=_0x46305b[_0x7fea('0x1e')];var _0x16dfb9=_0x3f6ef4?0x0:_0x4cb987[_0x7fea('0x1f')];var _0x293f2f=_0x3f6ef4?_0x46305b['count']:_0x4cb987['offset']+_0x4cb987['limit'];var _0x16cda7;if(_0x293f2f>=_0x18dfc9){_0x293f2f=_0x18dfc9;_0x16cda7=0xc8;}else{_0x16cda7=0xce;}_0x48b1e3[_0x7fea('0x1a')](_0x16cda7);return _0x48b1e3['set'](_0x7fea('0x20'),_0x16dfb9+'-'+_0x293f2f+'/'+_0x18dfc9)['json'](_0x46305b);}return null;};}function patchUpdates(_0x55e5c0){return function(_0x25016a){try{jsonpatch[_0x7fea('0x21')](_0x25016a,_0x55e5c0,!![]);}catch(_0x17deaf){return BPromise['reject'](_0x17deaf);}return _0x25016a[_0x7fea('0x22')]();};}function saveUpdates(_0xa8bacb,_0x589055){return function(_0x346fe2){if(_0x346fe2){return _0x346fe2[_0x7fea('0x23')](_0xa8bacb)[_0x7fea('0x24')](function(_0x38a44f){return _0x38a44f;});}return null;};}function removeEntity(_0x34c311,_0x1bd713){return function(_0x432a9d){if(_0x432a9d){return _0x432a9d[_0x7fea('0x25')]()[_0x7fea('0x24')](function(){_0x34c311['status'](0xcc)[_0x7fea('0x1b')]();});}};}function handleEntityNotFound(_0x500524,_0x789b2c){return function(_0x4626d5){if(!_0x4626d5){_0x500524[_0x7fea('0x19')](0x194);}return _0x4626d5;};}function handleError(_0x2c30cf,_0x140645){_0x140645=_0x140645||0x1f4;return function(_0x5c3ec4){logger['error'](_0x5c3ec4[_0x7fea('0x26')]);if(_0x5c3ec4[_0x7fea('0x27')]){delete _0x5c3ec4[_0x7fea('0x27')];}_0x2c30cf[_0x7fea('0x1a')](_0x140645)[_0x7fea('0x28')](_0x5c3ec4);};}exports[_0x7fea('0x29')]=function(_0x1ef88b,_0x5ac57b){var _0x329739={},_0x4ced97={},_0x4c99f4={'count':0x0,'rows':[]};var _0x2d6274=_[_0x7fea('0x2a')](db[_0x7fea('0x2b')][_0x7fea('0x2c')],function(_0x33f776){return{'name':_0x33f776[_0x7fea('0x2d')],'type':_0x33f776[_0x7fea('0x2e')][_0x7fea('0x2f')]};});_0x4ced97[_0x7fea('0x30')]=_[_0x7fea('0x2a')](_0x2d6274,_0x7fea('0x27'));_0x4ced97[_0x7fea('0x31')]=_[_0x7fea('0x32')](_0x1ef88b[_0x7fea('0x31')]);_0x4ced97['filters']=_[_0x7fea('0x33')](_0x4ced97[_0x7fea('0x30')],_0x4ced97['query']);_0x329739[_0x7fea('0x34')]=_[_0x7fea('0x33')](_0x4ced97[_0x7fea('0x30')],qs[_0x7fea('0x35')](_0x1ef88b[_0x7fea('0x31')][_0x7fea('0x35')]));_0x329739[_0x7fea('0x34')]=_0x329739[_0x7fea('0x34')]['length']?_0x329739['attributes']:_0x4ced97['model'];if(!_0x1ef88b['query'][_0x7fea('0x36')](_0x7fea('0x37'))){_0x329739[_0x7fea('0x1d')]=qs['limit'](_0x1ef88b[_0x7fea('0x31')]['limit']);_0x329739['offset']=qs[_0x7fea('0x1f')](_0x1ef88b[_0x7fea('0x31')][_0x7fea('0x1f')]);}_0x329739[_0x7fea('0x38')]=qs['sort'](_0x1ef88b[_0x7fea('0x31')]['sort']);_0x329739[_0x7fea('0x39')]=qs[_0x7fea('0x3a')](_[_0x7fea('0x3b')](_0x1ef88b[_0x7fea('0x31')],_0x4ced97[_0x7fea('0x3a')]),_0x2d6274);if(_0x1ef88b[_0x7fea('0x31')][_0x7fea('0x3c')]){_0x329739[_0x7fea('0x39')]=_[_0x7fea('0x3d')](_0x329739[_0x7fea('0x39')],{'$or':_[_0x7fea('0x2a')](_0x2d6274,function(_0x1ade20){if(_0x1ade20['type']!==_0x7fea('0x3e')){var _0x1d6783={};_0x1d6783[_0x1ade20[_0x7fea('0x27')]]={'$like':'%'+_0x1ef88b[_0x7fea('0x31')][_0x7fea('0x3c')]+'%'};return _0x1d6783;}})});}_0x329739=_['merge']({},_0x329739,_0x1ef88b[_0x7fea('0x3f')]);var _0x47b0bf={'where':_0x329739[_0x7fea('0x39')]};return db['SmsTransferReport']['count'](_0x47b0bf)[_0x7fea('0x24')](function(_0x33b170){_0x4c99f4[_0x7fea('0x1e')]=_0x33b170;if(_0x1ef88b['query']['includeAll']){_0x329739['include']=[{'all':!![]}];}return db[_0x7fea('0x2b')]['findAll'](_0x329739);})['then'](function(_0x50a415){_0x4c99f4[_0x7fea('0x40')]=_0x50a415;return _0x4c99f4;})[_0x7fea('0x24')](respondWithFilteredResult(_0x5ac57b,_0x329739))[_0x7fea('0x41')](handleError(_0x5ac57b,null));};exports[_0x7fea('0x42')]=function(_0x315970,_0xe77b56){var _0x58573b={'raw':!![],'where':{'id':_0x315970['params']['id']}},_0x4afbd4={};_0x4afbd4[_0x7fea('0x30')]=_['keys'](db[_0x7fea('0x2b')][_0x7fea('0x2c')]);_0x4afbd4['query']=_[_0x7fea('0x32')](_0x315970[_0x7fea('0x31')]);_0x4afbd4[_0x7fea('0x3a')]=_[_0x7fea('0x33')](_0x4afbd4[_0x7fea('0x30')],_0x4afbd4[_0x7fea('0x31')]);_0x58573b[_0x7fea('0x34')]=_[_0x7fea('0x33')](_0x4afbd4[_0x7fea('0x30')],qs[_0x7fea('0x35')](_0x315970[_0x7fea('0x31')][_0x7fea('0x35')]));_0x58573b[_0x7fea('0x34')]=_0x58573b[_0x7fea('0x34')][_0x7fea('0x43')]?_0x58573b['attributes']:_0x4afbd4['model'];if(_0x315970[_0x7fea('0x31')][_0x7fea('0x44')]){_0x58573b[_0x7fea('0x45')]=[{'all':!![]}];}_0x58573b=_[_0x7fea('0x3d')]({},_0x58573b,_0x315970['options']);return db[_0x7fea('0x2b')][_0x7fea('0x46')](_0x58573b)[_0x7fea('0x24')](handleEntityNotFound(_0xe77b56,null))['then'](respondWithResult(_0xe77b56,null))[_0x7fea('0x41')](handleError(_0xe77b56,null));};exports['create']=function(_0x249ab8,_0x34c27e){return db[_0x7fea('0x2b')][_0x7fea('0x47')](_0x249ab8[_0x7fea('0x48')],{})['then'](respondWithResult(_0x34c27e,0xc9))[_0x7fea('0x41')](handleError(_0x34c27e,null));};exports[_0x7fea('0x23')]=function(_0x36b729,_0x1fc701){if(_0x36b729['body']['id']){delete _0x36b729[_0x7fea('0x48')]['id'];}return db[_0x7fea('0x2b')]['find']({'where':{'id':_0x36b729[_0x7fea('0x49')]['id']}})[_0x7fea('0x24')](handleEntityNotFound(_0x1fc701,null))[_0x7fea('0x24')](saveUpdates(_0x36b729[_0x7fea('0x48')],null))[_0x7fea('0x24')](respondWithResult(_0x1fc701,null))[_0x7fea('0x41')](handleError(_0x1fc701,null));};exports[_0x7fea('0x25')]=function(_0x3fe82a,_0x48c50a){return db[_0x7fea('0x2b')][_0x7fea('0x46')]({'where':{'id':_0x3fe82a[_0x7fea('0x49')]['id']}})[_0x7fea('0x24')](handleEntityNotFound(_0x48c50a,null))[_0x7fea('0x24')](removeEntity(_0x48c50a,null))[_0x7fea('0x41')](handleError(_0x48c50a,null));};exports[_0x7fea('0x4a')]=function(_0x5f1e14,_0x2cafd8){return db[_0x7fea('0x2b')]['describe']()['then'](respondWithResult(_0x2cafd8,null))[_0x7fea('0x41')](handleError(_0x2cafd8,null));}; \ No newline at end of file +var _0x45a4=['stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','update','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','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','../../mysqldb','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','then','sendStatus'];(function(_0x327b31,_0x3a1d22){var _0x3f3f8a=function(_0x222632){while(--_0x222632){_0x327b31['push'](_0x327b31['shift']());}};_0x3f3f8a(++_0x3a1d22);}(_0x45a4,0xc3));var _0x445a=function(_0x1943bb,_0x127b71){_0x1943bb=_0x1943bb-0x0;var _0x641252=_0x45a4[_0x1943bb];return _0x641252;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x445a('0x0'));var zipdir=require(_0x445a('0x1'));var jsonpatch=require(_0x445a('0x2'));var rp=require(_0x445a('0x3'));var moment=require(_0x445a('0x4'));var BPromise=require(_0x445a('0x5'));var Mustache=require(_0x445a('0x6'));var util=require(_0x445a('0x7'));var path=require(_0x445a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x445a('0x9'));var fs=require('fs');var fs_extra=require(_0x445a('0xa'));var _=require('lodash');var squel=require(_0x445a('0xb'));var crypto=require(_0x445a('0xc'));var jsforce=require(_0x445a('0xd'));var deskjs=require(_0x445a('0xe'));var toCsv=require(_0x445a('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x445a('0x10'));var authService=require(_0x445a('0x11'));var qs=require(_0x445a('0x12'));var as=require(_0x445a('0x13'));var hardwareService=require(_0x445a('0x14'));var logger=require(_0x445a('0x15'))(_0x445a('0x16'));var utils=require(_0x445a('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x445a('0x18'))['db'];function respondWithStatusCode(_0x33f326,_0x1225ec){_0x1225ec=_0x1225ec||0xcc;return function(_0x97bd25){if(_0x97bd25){return _0x33f326['sendStatus'](_0x1225ec);}return _0x33f326[_0x445a('0x19')](_0x1225ec)[_0x445a('0x1a')]();};}function respondWithResult(_0x22ec78,_0x3f7156){_0x3f7156=_0x3f7156||0xc8;return function(_0x2783e9){if(_0x2783e9){return _0x22ec78[_0x445a('0x19')](_0x3f7156)[_0x445a('0x1b')](_0x2783e9);}};}function respondWithFilteredResult(_0x55a7ea,_0x13a3fe){return function(_0x80b5e0){if(_0x80b5e0){var _0x179f5a=typeof _0x13a3fe['offset']==='undefined'&&typeof _0x13a3fe['limit']===_0x445a('0x1c');var _0x530ab1=_0x80b5e0['count'];var _0x49620e=_0x179f5a?0x0:_0x13a3fe[_0x445a('0x1d')];var _0x546259=_0x179f5a?_0x80b5e0[_0x445a('0x1e')]:_0x13a3fe[_0x445a('0x1d')]+_0x13a3fe[_0x445a('0x1f')];var _0x4dd7e6;if(_0x546259>=_0x530ab1){_0x546259=_0x530ab1;_0x4dd7e6=0xc8;}else{_0x4dd7e6=0xce;}_0x55a7ea['status'](_0x4dd7e6);return _0x55a7ea[_0x445a('0x20')](_0x445a('0x21'),_0x49620e+'-'+_0x546259+'/'+_0x530ab1)[_0x445a('0x1b')](_0x80b5e0);}return null;};}function patchUpdates(_0x5cce56){return function(_0x5b8592){try{jsonpatch[_0x445a('0x22')](_0x5b8592,_0x5cce56,!![]);}catch(_0x19db6f){return BPromise[_0x445a('0x23')](_0x19db6f);}return _0x5b8592[_0x445a('0x24')]();};}function saveUpdates(_0xe3a16e,_0x144b94){return function(_0x243dcd){if(_0x243dcd){return _0x243dcd['update'](_0xe3a16e)['then'](function(_0x495b11){return _0x495b11;});}return null;};}function removeEntity(_0x3477f1,_0x1e0e76){return function(_0x38b0c7){if(_0x38b0c7){return _0x38b0c7['destroy']()[_0x445a('0x25')](function(){_0x3477f1[_0x445a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46d5f1,_0x4a0f4b){return function(_0x260968){if(!_0x260968){_0x46d5f1[_0x445a('0x26')](0x194);}return _0x260968;};}function handleError(_0x3ec840,_0x50f1a7){_0x50f1a7=_0x50f1a7||0x1f4;return function(_0x5683a5){logger['error'](_0x5683a5[_0x445a('0x27')]);if(_0x5683a5[_0x445a('0x28')]){delete _0x5683a5['name'];}_0x3ec840[_0x445a('0x19')](_0x50f1a7)[_0x445a('0x29')](_0x5683a5);};}exports[_0x445a('0x2a')]=function(_0xf5fc10,_0x2b68eb){var _0x42a533={},_0x24f5a8={},_0x2cd4ca={'count':0x0,'rows':[]};var _0x50fb83=_[_0x445a('0x2b')](db[_0x445a('0x2c')][_0x445a('0x2d')],function(_0x21731a){return{'name':_0x21731a[_0x445a('0x2e')],'type':_0x21731a[_0x445a('0x2f')]['key']};});_0x24f5a8[_0x445a('0x30')]=_[_0x445a('0x2b')](_0x50fb83,_0x445a('0x28'));_0x24f5a8['query']=_[_0x445a('0x31')](_0xf5fc10[_0x445a('0x32')]);_0x24f5a8[_0x445a('0x33')]=_['intersection'](_0x24f5a8[_0x445a('0x30')],_0x24f5a8['query']);_0x42a533['attributes']=_[_0x445a('0x34')](_0x24f5a8['model'],qs[_0x445a('0x35')](_0xf5fc10[_0x445a('0x32')][_0x445a('0x35')]));_0x42a533['attributes']=_0x42a533[_0x445a('0x36')][_0x445a('0x37')]?_0x42a533[_0x445a('0x36')]:_0x24f5a8[_0x445a('0x30')];if(!_0xf5fc10['query']['hasOwnProperty'](_0x445a('0x38'))){_0x42a533[_0x445a('0x1f')]=qs[_0x445a('0x1f')](_0xf5fc10[_0x445a('0x32')][_0x445a('0x1f')]);_0x42a533[_0x445a('0x1d')]=qs[_0x445a('0x1d')](_0xf5fc10[_0x445a('0x32')][_0x445a('0x1d')]);}_0x42a533[_0x445a('0x39')]=qs[_0x445a('0x3a')](_0xf5fc10[_0x445a('0x32')]['sort']);_0x42a533[_0x445a('0x3b')]=qs['filters'](_[_0x445a('0x3c')](_0xf5fc10['query'],_0x24f5a8[_0x445a('0x33')]),_0x50fb83);if(_0xf5fc10[_0x445a('0x32')][_0x445a('0x3d')]){_0x42a533[_0x445a('0x3b')]=_[_0x445a('0x3e')](_0x42a533[_0x445a('0x3b')],{'$or':_[_0x445a('0x2b')](_0x50fb83,function(_0x1adec3){if(_0x1adec3[_0x445a('0x2f')]!==_0x445a('0x3f')){var _0x3f46ca={};_0x3f46ca[_0x1adec3[_0x445a('0x28')]]={'$like':'%'+_0xf5fc10['query'][_0x445a('0x3d')]+'%'};return _0x3f46ca;}})});}_0x42a533=_[_0x445a('0x3e')]({},_0x42a533,_0xf5fc10[_0x445a('0x40')]);var _0x31514b={'where':_0x42a533[_0x445a('0x3b')]};return db[_0x445a('0x2c')][_0x445a('0x1e')](_0x31514b)['then'](function(_0x4a8a9d){_0x2cd4ca[_0x445a('0x1e')]=_0x4a8a9d;if(_0xf5fc10[_0x445a('0x32')]['includeAll']){_0x42a533[_0x445a('0x41')]=[{'all':!![]}];}return db[_0x445a('0x2c')][_0x445a('0x42')](_0x42a533);})[_0x445a('0x25')](function(_0x3cb42a){_0x2cd4ca[_0x445a('0x43')]=_0x3cb42a;return _0x2cd4ca;})[_0x445a('0x25')](respondWithFilteredResult(_0x2b68eb,_0x42a533))[_0x445a('0x44')](handleError(_0x2b68eb,null));};exports[_0x445a('0x45')]=function(_0x35e7c0,_0x284a52){var _0xcc2a8f={'raw':!![],'where':{'id':_0x35e7c0[_0x445a('0x46')]['id']}},_0x5cf2ad={};_0x5cf2ad[_0x445a('0x30')]=_[_0x445a('0x31')](db[_0x445a('0x2c')]['rawAttributes']);_0x5cf2ad[_0x445a('0x32')]=_[_0x445a('0x31')](_0x35e7c0['query']);_0x5cf2ad[_0x445a('0x33')]=_['intersection'](_0x5cf2ad[_0x445a('0x30')],_0x5cf2ad[_0x445a('0x32')]);_0xcc2a8f[_0x445a('0x36')]=_[_0x445a('0x34')](_0x5cf2ad[_0x445a('0x30')],qs[_0x445a('0x35')](_0x35e7c0['query'][_0x445a('0x35')]));_0xcc2a8f[_0x445a('0x36')]=_0xcc2a8f['attributes'][_0x445a('0x37')]?_0xcc2a8f[_0x445a('0x36')]:_0x5cf2ad['model'];if(_0x35e7c0['query'][_0x445a('0x47')]){_0xcc2a8f[_0x445a('0x41')]=[{'all':!![]}];}_0xcc2a8f=_['merge']({},_0xcc2a8f,_0x35e7c0[_0x445a('0x40')]);return db[_0x445a('0x2c')]['find'](_0xcc2a8f)[_0x445a('0x25')](handleEntityNotFound(_0x284a52,null))[_0x445a('0x25')](respondWithResult(_0x284a52,null))[_0x445a('0x44')](handleError(_0x284a52,null));};exports['create']=function(_0x4e71d6,_0x529e7f){return db[_0x445a('0x2c')][_0x445a('0x48')](_0x4e71d6[_0x445a('0x49')],{})[_0x445a('0x25')](respondWithResult(_0x529e7f,0xc9))[_0x445a('0x44')](handleError(_0x529e7f,null));};exports[_0x445a('0x4a')]=function(_0x282b57,_0x3df274){if(_0x282b57[_0x445a('0x49')]['id']){delete _0x282b57[_0x445a('0x49')]['id'];}return db[_0x445a('0x2c')]['find']({'where':{'id':_0x282b57['params']['id']}})[_0x445a('0x25')](handleEntityNotFound(_0x3df274,null))[_0x445a('0x25')](saveUpdates(_0x282b57[_0x445a('0x49')],null))[_0x445a('0x25')](respondWithResult(_0x3df274,null))[_0x445a('0x44')](handleError(_0x3df274,null));};exports[_0x445a('0x4b')]=function(_0x1c17a3,_0x2aac54){return db[_0x445a('0x2c')][_0x445a('0x4c')]({'where':{'id':_0x1c17a3['params']['id']}})[_0x445a('0x25')](handleEntityNotFound(_0x2aac54,null))[_0x445a('0x25')](removeEntity(_0x2aac54,null))[_0x445a('0x44')](handleError(_0x2aac54,null));};exports['describe']=function(_0x13e928,_0x1007e5){return db[_0x445a('0x2c')][_0x445a('0x4d')]()[_0x445a('0x25')](respondWithResult(_0x1007e5,null))[_0x445a('0x44')](handleError(_0x1007e5,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index dc5ae8a..80e1f5c 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 _0xf9fd=['lodash','util','../../config/logger','moment','bluebird','path','./smsTransferReport.attributes','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x19e998,_0x171067){var _0x37262a=function(_0x10228c){while(--_0x10228c){_0x19e998['push'](_0x19e998['shift']());}};_0x37262a(++_0x171067);}(_0xf9fd,0x118));var _0xdf9f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf9fd[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xdf9f('0x0'));var util=require(_0xdf9f('0x1'));var logger=require(_0xdf9f('0x2'))('api');var moment=require(_0xdf9f('0x3'));var BPromise=require(_0xdf9f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf9f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdf9f('0x6'));module['exports']=function(_0x2de026,_0x2e45bb){return _0x2de026['define'](_0xdf9f('0x7'),attributes,{'tableName':_0xdf9f('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xdf9f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8fb7=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./smsTransferReport.attributes','exports','uniqueid'];(function(_0x25c2e1,_0x3a031e){var _0x3f60c1=function(_0x512717){while(--_0x512717){_0x25c2e1['push'](_0x25c2e1['shift']());}};_0x3f60c1(++_0x3a031e);}(_0x8fb7,0x1a4));var _0x78fb=function(_0x428def,_0x111eef){_0x428def=_0x428def-0x0;var _0x316eb0=_0x8fb7[_0x428def];return _0x316eb0;};'use strict';var _=require(_0x78fb('0x0'));var util=require(_0x78fb('0x1'));var logger=require(_0x78fb('0x2'))(_0x78fb('0x3'));var moment=require('moment');var BPromise=require(_0x78fb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x78fb('0x5'));var rimraf=require('rimraf');var config=require(_0x78fb('0x6'));var attributes=require(_0x78fb('0x7'));module[_0x78fb('0x8')]=function(_0x1d16bd,_0x2fd1ba){return _0x1d16bd['define']('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x78fb('0x9'),'fields':[_0x78fb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 1b62a94..58ceb4d 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 _0xbe52=['stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xbe52,0x164));var _0x2be5=function(_0x4fa386,_0x45c511){_0x4fa386=_0x4fa386-0x0;var _0x267283=_0xbe52[_0x4fa386];return _0x267283;};'use strict';var _=require(_0x2be5('0x0'));var util=require(_0x2be5('0x1'));var moment=require(_0x2be5('0x2'));var BPromise=require(_0x2be5('0x3'));var rs=require(_0x2be5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2be5('0x5'))['db'];var utils=require(_0x2be5('0x6'));var logger=require(_0x2be5('0x7'))(_0x2be5('0x8'));var config=require(_0x2be5('0x9'));var jayson=require(_0x2be5('0xa'));var client=jayson[_0x2be5('0xb')][_0x2be5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ca6a7,_0x58980d,_0x1f346a){return new BPromise(function(_0x3169b3,_0x4a86d1){return client[_0x2be5('0xd')](_0x2ca6a7,_0x1f346a)[_0x2be5('0xe')](function(_0x3bdce2){logger['info'](_0x2be5('0xf'),_0x58980d,'request\x20sent');logger['debug'](_0x2be5('0x10'),_0x58980d,_0x2be5('0x11'),JSON[_0x2be5('0x12')](_0x3bdce2));if(_0x3bdce2[_0x2be5('0x13')]){if(_0x3bdce2['error'][_0x2be5('0x14')]===0x1f4){logger[_0x2be5('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x58980d,_0x3bdce2['error'][_0x2be5('0x15')]);return _0x4a86d1(_0x3bdce2[_0x2be5('0x13')]['message']);}logger[_0x2be5('0x13')](_0x2be5('0xf'),_0x58980d,_0x3bdce2[_0x2be5('0x13')][_0x2be5('0x15')]);return _0x3169b3(_0x3bdce2[_0x2be5('0x13')][_0x2be5('0x15')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x58980d,_0x2be5('0x11'));_0x3169b3(_0x3bdce2['result'][_0x2be5('0x15')]);}})['catch'](function(_0x31bcbc){logger[_0x2be5('0x13')](_0x2be5('0xf'),_0x58980d,_0x31bcbc);_0x4a86d1(_0x31bcbc);});});} \ No newline at end of file +var _0xd846=['request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','ioredis','../../config/logger','rpc','jayson/promise','request','then','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x33bc53,_0x4daf35){var _0x10531a=function(_0x546610){while(--_0x546610){_0x33bc53['push'](_0x33bc53['shift']());}};_0x10531a(++_0x4daf35);}(_0xd846,0x195));var _0x6d84=function(_0x18b9f5,_0x112f6e){_0x18b9f5=_0x18b9f5-0x0;var _0x1623b9=_0xd846[_0x18b9f5];return _0x1623b9;};'use strict';var _=require(_0x6d84('0x0'));var util=require(_0x6d84('0x1'));var moment=require(_0x6d84('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d84('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d84('0x4'))(_0x6d84('0x5'));var config=require('../../config/environment');var jayson=require(_0x6d84('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ae0a3,_0x417efe,_0x7b9556){return new BPromise(function(_0x3577cf,_0x20f36c){return client[_0x6d84('0x7')](_0x3ae0a3,_0x7b9556)[_0x6d84('0x8')](function(_0x224b60){logger[_0x6d84('0x9')](_0x6d84('0xa'),_0x417efe,_0x6d84('0xb'));logger['debug'](_0x6d84('0xc'),_0x417efe,'request\x20sent',JSON['stringify'](_0x224b60));if(_0x224b60[_0x6d84('0xd')]){if(_0x224b60[_0x6d84('0xd')]['code']===0x1f4){logger['error'](_0x6d84('0xa'),_0x417efe,_0x224b60[_0x6d84('0xd')][_0x6d84('0xe')]);return _0x20f36c(_0x224b60[_0x6d84('0xd')][_0x6d84('0xe')]);}logger[_0x6d84('0xd')](_0x6d84('0xa'),_0x417efe,_0x224b60[_0x6d84('0xd')][_0x6d84('0xe')]);return _0x3577cf(_0x224b60[_0x6d84('0xd')][_0x6d84('0xe')]);}else{logger[_0x6d84('0x9')](_0x6d84('0xa'),_0x417efe,'request\x20sent');_0x3577cf(_0x224b60[_0x6d84('0xf')][_0x6d84('0xe')]);}})['catch'](function(_0xa26940){logger[_0x6d84('0xd')](_0x6d84('0xa'),_0x417efe,_0xa26940);_0x20f36c(_0xa26940);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index ff0148c..49e2a34 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 _0x6c75=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','single','file','create','put','update','delete'];(function(_0x47032a,_0x3750d3){var _0x5609ba=function(_0x4428ce){while(--_0x4428ce){_0x47032a['push'](_0x47032a['shift']());}};_0x5609ba(++_0x3750d3);}(_0x6c75,0xef));var _0x56c7=function(_0x47afc5,_0x54c65b){_0x47afc5=_0x47afc5-0x0;var _0x5db85f=_0x6c75[_0x47afc5];return _0x5db85f;};'use strict';var multer=require(_0x56c7('0x0'));var util=require(_0x56c7('0x1'));var path=require('path');var timeout=require(_0x56c7('0x2'));var express=require(_0x56c7('0x3'));var router=express[_0x56c7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x56c7('0x5'));var interaction=require(_0x56c7('0x6'));var config=require(_0x56c7('0x7'));var controller=require(_0x56c7('0x8'));router[_0x56c7('0x9')]('/',auth[_0x56c7('0xa')](),controller[_0x56c7('0xb')]);router['get'](_0x56c7('0xc'),auth[_0x56c7('0xa')](),controller[_0x56c7('0xd')]);router[_0x56c7('0x9')](_0x56c7('0xe'),auth[_0x56c7('0xa')](),controller[_0x56c7('0xf')]);var upload=multer({'storage':multer[_0x56c7('0x10')]({'destination':function(_0x384bed,_0x1df655,_0x284482){_0x284482(null,path[_0x56c7('0x11')](config[_0x56c7('0x12')],_0x56c7('0x13')));},'filename':function(_0x3a701e,_0x3773b9,_0x142ef5){_0x3773b9[_0x56c7('0x14')]=_0x3773b9[_0x56c7('0x14')][_0x56c7('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x142ef5(null,util[_0x56c7('0x16')]('%s-%s%s',path[_0x56c7('0x17')](_0x3773b9[_0x56c7('0x14')],path[_0x56c7('0x18')](_0x3773b9[_0x56c7('0x14')])),Date[_0x56c7('0x19')](),path[_0x56c7('0x18')](_0x3773b9[_0x56c7('0x14')])));}})});router[_0x56c7('0x1a')]('/',upload[_0x56c7('0x1b')](_0x56c7('0x1c')),controller[_0x56c7('0x1d')]);router[_0x56c7('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x56c7('0x1f')]);router[_0x56c7('0x20')]('/:id',auth[_0x56c7('0xa')](),controller[_0x56c7('0x20')]);module[_0x56c7('0x21')]=router; \ No newline at end of file +var _0x2fe7=['exports','util','path','express','Router','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','single','file','create','put','update'];(function(_0x2a5aa7,_0x1ed6ed){var _0xf6f328=function(_0x5e86e8){while(--_0x5e86e8){_0x2a5aa7['push'](_0x2a5aa7['shift']());}};_0xf6f328(++_0x1ed6ed);}(_0x2fe7,0x1ee));var _0x72fe=function(_0x237ffd,_0x2752b5){_0x237ffd=_0x237ffd-0x0;var _0x1229f9=_0x2fe7[_0x237ffd];return _0x1229f9;};'use strict';var multer=require('multer');var util=require(_0x72fe('0x0'));var path=require(_0x72fe('0x1'));var timeout=require('connect-timeout');var express=require(_0x72fe('0x2'));var router=express[_0x72fe('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x72fe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x72fe('0x5'));var controller=require(_0x72fe('0x6'));router[_0x72fe('0x7')]('/',auth[_0x72fe('0x8')](),controller[_0x72fe('0x9')]);router[_0x72fe('0x7')](_0x72fe('0xa'),auth[_0x72fe('0x8')](),controller[_0x72fe('0xb')]);router['get'](_0x72fe('0xc'),auth[_0x72fe('0x8')](),controller[_0x72fe('0xd')]);var upload=multer({'storage':multer[_0x72fe('0xe')]({'destination':function(_0x3ea635,_0x167062,_0x3ef700){_0x3ef700(null,path['join'](config['root'],_0x72fe('0xf')));},'filename':function(_0x3cf85d,_0x54064b,_0x1e2e61){_0x54064b[_0x72fe('0x10')]=_0x54064b['originalname'][_0x72fe('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1e2e61(null,util[_0x72fe('0x12')]('%s-%s%s',path[_0x72fe('0x13')](_0x54064b['originalname'],path[_0x72fe('0x14')](_0x54064b[_0x72fe('0x10')])),Date[_0x72fe('0x15')](),path[_0x72fe('0x14')](_0x54064b[_0x72fe('0x10')])));}})});router[_0x72fe('0x16')]('/',upload[_0x72fe('0x17')](_0x72fe('0x18')),controller[_0x72fe('0x19')]);router[_0x72fe('0x1a')](_0x72fe('0xa'),auth[_0x72fe('0x8')](),controller[_0x72fe('0x1b')]);router['delete'](_0x72fe('0xa'),auth[_0x72fe('0x8')](),controller['delete']);module[_0x72fe('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index de2d1fd..ccb821b 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 _0xcb91=['BIGINT','INTEGER','FLOAT','exports','STRING'];(function(_0x577ab6,_0x3e1f47){var _0x3e583f=function(_0x4e7f68){while(--_0x4e7f68){_0x577ab6['push'](_0x577ab6['shift']());}};_0x3e583f(++_0x3e1f47);}(_0xcb91,0x1e3));var _0x1cb9=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0xcb91[_0x10c16d];return _0x5896f4;};'use strict';var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'name':{'type':Sequelize[_0x1cb9('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x1cb9('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x1cb9('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x1cb9('0x2')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x1cb9('0x2')]},'original_sampleRate':{'type':Sequelize[_0x1cb9('0x3')]},'converted_format':{'type':Sequelize[_0x1cb9('0x1')]},'converted_duration':{'type':Sequelize[_0x1cb9('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x1cb9('0x2')]},'converted_channelCount':{'type':Sequelize[_0x1cb9('0x3')]},'converted_bitRate':{'type':Sequelize[_0x1cb9('0x2')]},'converted_sampleRate':{'type':Sequelize[_0x1cb9('0x3')]}}; \ No newline at end of file +var _0xf34c=['INTEGER','BIGINT','STRING','name','FLOAT'];(function(_0x10d95e,_0x19d4a3){var _0x45c2b3=function(_0x54ec0c){while(--_0x54ec0c){_0x10d95e['push'](_0x10d95e['shift']());}};_0x45c2b3(++_0x19d4a3);}(_0xf34c,0x1d8));var _0xcf34=function(_0x30eebf,_0x5d689b){_0x30eebf=_0x30eebf-0x0;var _0x289519=_0xf34c[_0x30eebf];return _0x289519;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcf34('0x0')],'unique':_0xcf34('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xcf34('0x0')]},'display_name':{'type':Sequelize[_0xcf34('0x0')],'defaultValue':''},'description':{'type':Sequelize[_0xcf34('0x0')]},'original_format':{'type':Sequelize[_0xcf34('0x0')]},'original_duration':{'type':Sequelize[_0xcf34('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xcf34('0x3')]},'converted_format':{'type':Sequelize[_0xcf34('0x0')]},'converted_duration':{'type':Sequelize[_0xcf34('0x2')]},'converted_sampleCount':{'type':Sequelize[_0xcf34('0x4')]},'converted_channelCount':{'type':Sequelize[_0xcf34('0x3')]},'converted_bitRate':{'type':Sequelize[_0xcf34('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xcf34('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index ec7616e..0bdd1bc 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 _0xb75b=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','Sounds','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Sound','includeAll','findAll','rows','catch','show','length','include','download','find','params','save_name','converted_format','existsSync','join','root','Sequelize','Sound\x20not\x20found','server/files/sounds/converted','%s.%s','basename','file','extname','originalname','filename','substring','wav','server/files/sounds/original','format','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','transcode','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_bitRate','converted_sampleRate','0777','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','rimraf','bluebird'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0xb75b,0x183));var _0xbb75=function(_0x58fc5d,_0x121850){_0x58fc5d=_0x58fc5d-0x0;var _0x31e74c=_0xb75b[_0x58fc5d];return _0x31e74c;};'use strict';var emlformat=require(_0xbb75('0x0'));var rimraf=require(_0xbb75('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbb75('0x2'));var Mustache=require(_0xbb75('0x3'));var util=require(_0xbb75('0x4'));var path=require(_0xbb75('0x5'));var sox=require('sox');var csv=require(_0xbb75('0x6'));var ejs=require(_0xbb75('0x7'));var fs=require('fs');var fs_extra=require(_0xbb75('0x8'));var _=require(_0xbb75('0x9'));var squel=require(_0xbb75('0xa'));var crypto=require(_0xbb75('0xb'));var jsforce=require(_0xbb75('0xc'));var deskjs=require(_0xbb75('0xd'));var toCsv=require(_0xbb75('0x6'));var querystring=require(_0xbb75('0xe'));var Papa=require('papaparse');var Redis=require(_0xbb75('0xf'));var authService=require(_0xbb75('0x10'));var qs=require(_0xbb75('0x11'));var as=require(_0xbb75('0x12'));var hardwareService=require(_0xbb75('0x13'));var logger=require(_0xbb75('0x14'))(_0xbb75('0x15'));var utils=require(_0xbb75('0x16'));var config=require(_0xbb75('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb75('0x18'))['db'];function respondWithStatusCode(_0x5906e3,_0x1b6693){_0x1b6693=_0x1b6693||0xcc;return function(_0x47fbf8){if(_0x47fbf8){return _0x5906e3[_0xbb75('0x19')](_0x1b6693);}return _0x5906e3['status'](_0x1b6693)['end']();};}function respondWithResult(_0x4058b4,_0x173d7d){_0x173d7d=_0x173d7d||0xc8;return function(_0x48b708){if(_0x48b708){return _0x4058b4[_0xbb75('0x1a')](_0x173d7d)['json'](_0x48b708);}};}function respondWithFilteredResult(_0x1ffb03,_0x1b361d){return function(_0x5ddc19){if(_0x5ddc19){var _0x250643=typeof _0x1b361d[_0xbb75('0x1b')]===_0xbb75('0x1c')&&typeof _0x1b361d['limit']===_0xbb75('0x1c');var _0xb96a34=_0x5ddc19[_0xbb75('0x1d')];var _0x548da3=_0x250643?0x0:_0x1b361d['offset'];var _0x270408=_0x250643?_0x5ddc19[_0xbb75('0x1d')]:_0x1b361d[_0xbb75('0x1b')]+_0x1b361d[_0xbb75('0x1e')];var _0xe56c5f;if(_0x270408>=_0xb96a34){_0x270408=_0xb96a34;_0xe56c5f=0xc8;}else{_0xe56c5f=0xce;}_0x1ffb03[_0xbb75('0x1a')](_0xe56c5f);return _0x1ffb03[_0xbb75('0x1f')]('Content-Range',_0x548da3+'-'+_0x270408+'/'+_0xb96a34)[_0xbb75('0x20')](_0x5ddc19);}return null;};}function patchUpdates(_0x4e22dc){return function(_0x45e524){try{jsonpatch[_0xbb75('0x21')](_0x45e524,_0x4e22dc,!![]);}catch(_0x5020b3){return BPromise[_0xbb75('0x22')](_0x5020b3);}return _0x45e524[_0xbb75('0x23')]();};}function saveUpdates(_0x5ceb67,_0x5fe689){return function(_0x277589){if(_0x277589){return _0x277589[_0xbb75('0x24')](_0x5ceb67)[_0xbb75('0x25')](function(_0x326526){return _0x326526;});}return null;};}function removeEntity(_0xd61312,_0x3cce68){return function(_0x34d71b){if(_0x34d71b){return _0x34d71b[_0xbb75('0x26')]()[_0xbb75('0x25')](function(){var _0x2666da=_0x34d71b['get']({'plain':!![]});var _0x39bcb4=_0xbb75('0x27');return db['UserProfileResource'][_0xbb75('0x26')]({'where':{'type':_0x39bcb4,'resourceId':_0x2666da['id']}})[_0xbb75('0x25')](function(){return _0x34d71b;});})[_0xbb75('0x25')](function(){_0xd61312['status'](0xcc)[_0xbb75('0x28')]();});}};}function handleEntityNotFound(_0x274aeb,_0x44e2fa){return function(_0x1db9c8){if(!_0x1db9c8){_0x274aeb[_0xbb75('0x19')](0x194);}return _0x1db9c8;};}function handleError(_0x5afcd3,_0x2b9e23){_0x2b9e23=_0x2b9e23||0x1f4;return function(_0x3adcd0){logger[_0xbb75('0x29')](_0x3adcd0[_0xbb75('0x2a')]);if(_0x3adcd0[_0xbb75('0x2b')]){delete _0x3adcd0[_0xbb75('0x2b')];}_0x5afcd3[_0xbb75('0x1a')](_0x2b9e23)['send'](_0x3adcd0);};}exports[_0xbb75('0x2c')]=function(_0x25b7cb,_0xecce21){var _0x5445b2={},_0x127656={},_0x553cd8={'count':0x0,'rows':[]};var _0x2c5658=_[_0xbb75('0x2d')](db['Sound'][_0xbb75('0x2e')],function(_0x30d27a){return{'name':_0x30d27a[_0xbb75('0x2f')],'type':_0x30d27a[_0xbb75('0x30')][_0xbb75('0x31')]};});_0x127656[_0xbb75('0x32')]=_[_0xbb75('0x2d')](_0x2c5658,_0xbb75('0x2b'));_0x127656[_0xbb75('0x33')]=_[_0xbb75('0x34')](_0x25b7cb[_0xbb75('0x33')]);_0x127656[_0xbb75('0x35')]=_[_0xbb75('0x36')](_0x127656[_0xbb75('0x32')],_0x127656[_0xbb75('0x33')]);_0x5445b2['attributes']=_[_0xbb75('0x36')](_0x127656['model'],qs['fields'](_0x25b7cb[_0xbb75('0x33')][_0xbb75('0x37')]));_0x5445b2[_0xbb75('0x38')]=_0x5445b2['attributes']['length']?_0x5445b2[_0xbb75('0x38')]:_0x127656[_0xbb75('0x32')];if(!_0x25b7cb[_0xbb75('0x33')][_0xbb75('0x39')]('nolimit')){_0x5445b2[_0xbb75('0x1e')]=qs['limit'](_0x25b7cb[_0xbb75('0x33')][_0xbb75('0x1e')]);_0x5445b2[_0xbb75('0x1b')]=qs[_0xbb75('0x1b')](_0x25b7cb[_0xbb75('0x33')]['offset']);}_0x5445b2[_0xbb75('0x3a')]=qs[_0xbb75('0x3b')](_0x25b7cb[_0xbb75('0x33')][_0xbb75('0x3b')]);_0x5445b2[_0xbb75('0x3c')]=qs['filters'](_[_0xbb75('0x3d')](_0x25b7cb[_0xbb75('0x33')],_0x127656['filters']),_0x2c5658);if(_0x25b7cb[_0xbb75('0x33')][_0xbb75('0x3e')]){_0x5445b2[_0xbb75('0x3c')]=_[_0xbb75('0x3f')](_0x5445b2[_0xbb75('0x3c')],{'$or':_[_0xbb75('0x2d')](_0x2c5658,function(_0xb8d13a){if(_0xb8d13a[_0xbb75('0x30')]!==_0xbb75('0x40')){var _0x1259c3={};_0x1259c3[_0xb8d13a[_0xbb75('0x2b')]]={'$like':'%'+_0x25b7cb[_0xbb75('0x33')][_0xbb75('0x3e')]+'%'};return _0x1259c3;}})});}_0x5445b2=_[_0xbb75('0x3f')]({},_0x5445b2,_0x25b7cb[_0xbb75('0x41')]);var _0x20bc34={'where':_0x5445b2['where']};return db[_0xbb75('0x42')]['count'](_0x20bc34)[_0xbb75('0x25')](function(_0x10ddd3){_0x553cd8[_0xbb75('0x1d')]=_0x10ddd3;if(_0x25b7cb[_0xbb75('0x33')][_0xbb75('0x43')]){_0x5445b2['include']=[{'all':!![]}];}return db['Sound'][_0xbb75('0x44')](_0x5445b2);})[_0xbb75('0x25')](function(_0x1220c3){_0x553cd8[_0xbb75('0x45')]=_0x1220c3;return _0x553cd8;})[_0xbb75('0x25')](respondWithFilteredResult(_0xecce21,_0x5445b2))[_0xbb75('0x46')](handleError(_0xecce21,null));};exports[_0xbb75('0x47')]=function(_0x205d58,_0x4635b4){var _0x2b33fe={'raw':!![],'where':{'id':_0x205d58['params']['id']}},_0x1dd4dd={};_0x1dd4dd[_0xbb75('0x32')]=_[_0xbb75('0x34')](db[_0xbb75('0x42')]['rawAttributes']);_0x1dd4dd[_0xbb75('0x33')]=_[_0xbb75('0x34')](_0x205d58[_0xbb75('0x33')]);_0x1dd4dd[_0xbb75('0x35')]=_[_0xbb75('0x36')](_0x1dd4dd[_0xbb75('0x32')],_0x1dd4dd[_0xbb75('0x33')]);_0x2b33fe['attributes']=_[_0xbb75('0x36')](_0x1dd4dd['model'],qs[_0xbb75('0x37')](_0x205d58[_0xbb75('0x33')][_0xbb75('0x37')]));_0x2b33fe[_0xbb75('0x38')]=_0x2b33fe[_0xbb75('0x38')][_0xbb75('0x48')]?_0x2b33fe[_0xbb75('0x38')]:_0x1dd4dd[_0xbb75('0x32')];if(_0x205d58[_0xbb75('0x33')]['includeAll']){_0x2b33fe[_0xbb75('0x49')]=[{'all':!![]}];}_0x2b33fe=_[_0xbb75('0x3f')]({},_0x2b33fe,_0x205d58[_0xbb75('0x41')]);return db[_0xbb75('0x42')]['find'](_0x2b33fe)[_0xbb75('0x25')](handleEntityNotFound(_0x4635b4,null))['then'](respondWithResult(_0x4635b4,null))[_0xbb75('0x46')](handleError(_0x4635b4,null));};exports[_0xbb75('0x4a')]=function(_0x388e96,_0x5d6c5f,_0x2d5e86){return db['Sound'][_0xbb75('0x4b')]({'where':{'id':_0x388e96[_0xbb75('0x4c')]['id']},'attributes':[_0xbb75('0x2b'),_0xbb75('0x4d'),_0xbb75('0x4e')],'raw':!![]})[_0xbb75('0x25')](handleEntityNotFound(_0x5d6c5f,null))[_0xbb75('0x25')](function(_0x54b0eb){if(_0x54b0eb){if(!fs[_0xbb75('0x4f')](path[_0xbb75('0x50')](config[_0xbb75('0x51')],'server/files/sounds/converted',_0x54b0eb[_0xbb75('0x4d')]+'.'+_0x54b0eb[_0xbb75('0x4e')]))){throw new db[(_0xbb75('0x52'))]['ValidationError'](_0xbb75('0x53'));}return _0x5d6c5f[_0xbb75('0x4a')](path['join'](config['root'],_0xbb75('0x54'),util['format'](_0xbb75('0x55'),_0x54b0eb['save_name'],_0x54b0eb['converted_format'])),util['format']('%s.%s',_0x54b0eb[_0xbb75('0x2b')],_0x54b0eb[_0xbb75('0x4e')]));}return null;})[_0xbb75('0x46')](handleError(_0x5d6c5f,null));};exports['create']=function(_0x1434a9,_0x135269,_0x54cc02){var _0x373742={'name':path[_0xbb75('0x56')](_0x1434a9[_0xbb75('0x57')]['originalname'],path[_0xbb75('0x58')](_0x1434a9['file'][_0xbb75('0x59')])),'save_name':path[_0xbb75('0x56')](_0x1434a9[_0xbb75('0x57')][_0xbb75('0x5a')],path['extname'](_0x1434a9['file'][_0xbb75('0x5a')])),'original_format':path['extname'](_0x1434a9[_0xbb75('0x57')][_0xbb75('0x59')])[_0xbb75('0x5b')](0x1),'converted_format':_0xbb75('0x5c')};var _0x48b7ea=path[_0xbb75('0x50')](config[_0xbb75('0x51')],_0xbb75('0x5d'),_0x1434a9[_0xbb75('0x57')][_0xbb75('0x5a')]);var _0x32ba53=path[_0xbb75('0x50')](config[_0xbb75('0x51')],'server/files/sounds/converted',util[_0xbb75('0x5e')]('%s.%s',path[_0xbb75('0x56')](_0x1434a9[_0xbb75('0x57')][_0xbb75('0x5a')],path[_0xbb75('0x58')](_0x1434a9[_0xbb75('0x57')][_0xbb75('0x5a')])),_0x373742[_0xbb75('0x4e')]));logger[_0xbb75('0x5f')](_0xbb75('0x60'),_0x48b7ea);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x32ba53);try{fs[_0xbb75('0x61')](_0x48b7ea,parseInt('0777',0x8));var _0x388af7=sox[_0xbb75('0x62')](_0x48b7ea,_0x32ba53,{'sampleRate':0x1f40,'format':_0xbb75('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x388af7['on'](_0xbb75('0x29'),function(_0x3e569b){fs[_0xbb75('0x63')](_0x48b7ea);_0x135269[_0xbb75('0x1a')](0x1f4)[_0xbb75('0x64')](_0x3e569b);});_0x388af7['on'](_0xbb75('0x65'),function(_0x379387){_0x373742[_0xbb75('0x66')]=isNaN(_0x379387[_0xbb75('0x67')])?null:_0x379387[_0xbb75('0x67')]*0x3e8;_0x373742[_0xbb75('0x68')]=isNaN(_0x379387[_0xbb75('0x69')])?null:_0x379387[_0xbb75('0x69')];_0x373742[_0xbb75('0x6a')]=isNaN(_0x379387[_0xbb75('0x6b')])?null:_0x379387[_0xbb75('0x6b')];_0x373742[_0xbb75('0x6c')]=isNaN(_0x379387[_0xbb75('0x6d')])?null:_0x379387['bitRate'];_0x373742[_0xbb75('0x6e')]=isNaN(_0x379387[_0xbb75('0x6f')])?null:_0x379387[_0xbb75('0x6f')];});_0x388af7['on'](_0xbb75('0x70'),function(_0x1febf4){_0x373742['converted_duration']=isNaN(_0x1febf4[_0xbb75('0x67')])?null:_0x1febf4[_0xbb75('0x67')]*0x3e8;_0x373742[_0xbb75('0x71')]=isNaN(_0x1febf4[_0xbb75('0x69')])?null:_0x1febf4[_0xbb75('0x69')];_0x373742['converted_channelCount']=isNaN(_0x1febf4['channelCount'])?null:_0x1febf4[_0xbb75('0x6b')];_0x373742[_0xbb75('0x72')]=isNaN(_0x1febf4['bitRate'])?null:_0x1febf4[_0xbb75('0x6d')];_0x373742[_0xbb75('0x73')]=isNaN(_0x1febf4[_0xbb75('0x6f')])?null:_0x1febf4['sampleRate'];});_0x388af7['on']('end',function(){fs[_0xbb75('0x61')](_0x32ba53,parseInt(_0xbb75('0x74'),0x8));return db['Sound']['create'](_0x373742)[_0xbb75('0x25')](function(_0x5c405d){var _0xa0c4ab={'role':_0x1434a9['body'][_0xbb75('0x75')],'userProfileId':_0x1434a9[_0xbb75('0x76')][_0xbb75('0x77')]};if(!_0xa0c4ab)throw new Error(_0xbb75('0x78'));if(_0xa0c4ab[_0xbb75('0x75')]===_0xbb75('0x79')){var _0xe68cf1=_0x5c405d[_0xbb75('0x7a')]({'plain':!![]});return db[_0xbb75('0x7b')]['find']({'where':{'name':'Sounds','userProfileId':_0xa0c4ab[_0xbb75('0x77')]},'raw':!![]})[_0xbb75('0x25')](function(_0x1e0825){if(_0x1e0825&&_0x1e0825['autoAssociation']===0x0){return db[_0xbb75('0x7c')]['create']({'name':_0xe68cf1[_0xbb75('0x2b')],'resourceId':_0xe68cf1['id'],'type':_0x1e0825[_0xbb75('0x2b')],'sectionId':_0x1e0825['id']},{})[_0xbb75('0x25')](function(){return _0x5c405d;});}else{return _0x5c405d;}})[_0xbb75('0x46')](function(_0x3f6c28){logger['error'](_0xbb75('0x7d'),_0x3f6c28);throw _0x3f6c28;});}return _0x5c405d;})['then'](respondWithResult(_0x135269,null))[_0xbb75('0x46')](handleError(_0x135269,null));});_0x388af7[_0xbb75('0x7e')]();}catch(_0x1ed2d7){_0x135269[_0xbb75('0x1a')](0x1f4)[_0xbb75('0x64')](_0x1ed2d7);}};exports['update']=function(_0x305b52,_0x468c15,_0x2275bd){return db['Sound'][_0xbb75('0x4b')]({'where':{'id':_0x305b52[_0xbb75('0x4c')]['id']}})[_0xbb75('0x25')](handleEntityNotFound(_0x468c15,null))[_0xbb75('0x25')](saveUpdates(_[_0xbb75('0x3d')](_0x305b52[_0xbb75('0x76')],[_0xbb75('0x2b'),_0xbb75('0x7f')]),null))[_0xbb75('0x25')](respondWithResult(_0x468c15,null))['catch'](handleError(_0x468c15,null));};exports[_0xbb75('0x80')]=function(_0x129f41,_0x11bad2,_0x28819b){return db[_0xbb75('0x42')][_0xbb75('0x4b')]({'where':{'id':_0x129f41[_0xbb75('0x4c')]['id']}})[_0xbb75('0x25')](function(_0x4f6bc4){if(_0x4f6bc4){return _0x4f6bc4[_0xbb75('0x26')]();}})[_0xbb75('0x25')](function(_0x14e6b1){var _0x1ecfda=path[_0xbb75('0x50')](config[_0xbb75('0x51')],_0xbb75('0x5d'),util[_0xbb75('0x5e')](_0xbb75('0x55'),_0x14e6b1[_0xbb75('0x4d')],_0x14e6b1[_0xbb75('0x81')]));var _0x19abd3=path[_0xbb75('0x50')](config[_0xbb75('0x51')],_0xbb75('0x54'),util[_0xbb75('0x5e')](_0xbb75('0x55'),_0x14e6b1[_0xbb75('0x4d')],_0x14e6b1[_0xbb75('0x4e')]));fs[_0xbb75('0x63')](_0x1ecfda);fs[_0xbb75('0x63')](_0x19abd3);return _0x14e6b1;})['then'](function(_0x266e3c){if(_0x266e3c){return _0x11bad2[_0xbb75('0x1a')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x11bad2,null))[_0xbb75('0x46')](handleError(_0x11bad2,null));}; \ No newline at end of file +var _0x14fc=['model','map','keys','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','download','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','basename','file','originalname','filename','extname','substring','wav','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','error','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','start','pick','body','description','delete','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','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','offset','undefined','count','limit','set','json','reject','update','destroy','then','Sounds','UserProfileResource','stack','name','index','Sound','rawAttributes','type','key'];(function(_0x38e558,_0x2937e9){var _0x2b1048=function(_0x5f23cd){while(--_0x5f23cd){_0x38e558['push'](_0x38e558['shift']());}};_0x2b1048(++_0x2937e9);}(_0x14fc,0x146));var _0xc14f=function(_0x262baa,_0x283058){_0x262baa=_0x262baa-0x0;var _0x4f2257=_0x14fc[_0x262baa];return _0x4f2257;};'use strict';var emlformat=require(_0xc14f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc14f('0x1'));var jsonpatch=require(_0xc14f('0x2'));var rp=require(_0xc14f('0x3'));var moment=require('moment');var BPromise=require(_0xc14f('0x4'));var Mustache=require(_0xc14f('0x5'));var util=require(_0xc14f('0x6'));var path=require(_0xc14f('0x7'));var sox=require(_0xc14f('0x8'));var csv=require(_0xc14f('0x9'));var ejs=require(_0xc14f('0xa'));var fs=require('fs');var fs_extra=require(_0xc14f('0xb'));var _=require('lodash');var squel=require(_0xc14f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc14f('0x9'));var querystring=require(_0xc14f('0xd'));var Papa=require(_0xc14f('0xe'));var Redis=require('ioredis');var authService=require(_0xc14f('0xf'));var qs=require(_0xc14f('0x10'));var as=require(_0xc14f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc14f('0x12'))(_0xc14f('0x13'));var utils=require(_0xc14f('0x14'));var config=require(_0xc14f('0x15'));var licenseUtil=require(_0xc14f('0x16'));var db=require(_0xc14f('0x17'))['db'];function respondWithStatusCode(_0x51419e,_0x58bb7a){_0x58bb7a=_0x58bb7a||0xcc;return function(_0x179d80){if(_0x179d80){return _0x51419e[_0xc14f('0x18')](_0x58bb7a);}return _0x51419e[_0xc14f('0x19')](_0x58bb7a)[_0xc14f('0x1a')]();};}function respondWithResult(_0xeebe72,_0x12ab87){_0x12ab87=_0x12ab87||0xc8;return function(_0x3b20ac){if(_0x3b20ac){return _0xeebe72[_0xc14f('0x19')](_0x12ab87)['json'](_0x3b20ac);}};}function respondWithFilteredResult(_0x3c231d,_0x2faf87){return function(_0x221823){if(_0x221823){var _0x4fffd3=typeof _0x2faf87[_0xc14f('0x1b')]===_0xc14f('0x1c')&&typeof _0x2faf87['limit']===_0xc14f('0x1c');var _0x2a4098=_0x221823[_0xc14f('0x1d')];var _0x47281e=_0x4fffd3?0x0:_0x2faf87['offset'];var _0x5f3893=_0x4fffd3?_0x221823[_0xc14f('0x1d')]:_0x2faf87[_0xc14f('0x1b')]+_0x2faf87[_0xc14f('0x1e')];var _0x50becb;if(_0x5f3893>=_0x2a4098){_0x5f3893=_0x2a4098;_0x50becb=0xc8;}else{_0x50becb=0xce;}_0x3c231d['status'](_0x50becb);return _0x3c231d[_0xc14f('0x1f')]('Content-Range',_0x47281e+'-'+_0x5f3893+'/'+_0x2a4098)[_0xc14f('0x20')](_0x221823);}return null;};}function patchUpdates(_0x28b6f3){return function(_0x495eb5){try{jsonpatch['apply'](_0x495eb5,_0x28b6f3,!![]);}catch(_0x4fece1){return BPromise[_0xc14f('0x21')](_0x4fece1);}return _0x495eb5['save']();};}function saveUpdates(_0x522f33,_0x525594){return function(_0x281627){if(_0x281627){return _0x281627[_0xc14f('0x22')](_0x522f33)['then'](function(_0x190741){return _0x190741;});}return null;};}function removeEntity(_0x50a4f2,_0x1afa76){return function(_0x51b899){if(_0x51b899){return _0x51b899[_0xc14f('0x23')]()[_0xc14f('0x24')](function(){var _0x128e6c=_0x51b899['get']({'plain':!![]});var _0x121700=_0xc14f('0x25');return db[_0xc14f('0x26')][_0xc14f('0x23')]({'where':{'type':_0x121700,'resourceId':_0x128e6c['id']}})[_0xc14f('0x24')](function(){return _0x51b899;});})[_0xc14f('0x24')](function(){_0x50a4f2[_0xc14f('0x19')](0xcc)[_0xc14f('0x1a')]();});}};}function handleEntityNotFound(_0xffa221,_0x45175f){return function(_0x463274){if(!_0x463274){_0xffa221[_0xc14f('0x18')](0x194);}return _0x463274;};}function handleError(_0x2cf1d0,_0x1268bc){_0x1268bc=_0x1268bc||0x1f4;return function(_0x3dfea1){logger['error'](_0x3dfea1[_0xc14f('0x27')]);if(_0x3dfea1[_0xc14f('0x28')]){delete _0x3dfea1[_0xc14f('0x28')];}_0x2cf1d0[_0xc14f('0x19')](_0x1268bc)['send'](_0x3dfea1);};}exports[_0xc14f('0x29')]=function(_0x204712,_0x5f1660){var _0x21d0bb={},_0x1cb9c6={},_0x469b12={'count':0x0,'rows':[]};var _0x214305=_['map'](db[_0xc14f('0x2a')][_0xc14f('0x2b')],function(_0x555598){return{'name':_0x555598['fieldName'],'type':_0x555598[_0xc14f('0x2c')][_0xc14f('0x2d')]};});_0x1cb9c6[_0xc14f('0x2e')]=_[_0xc14f('0x2f')](_0x214305,_0xc14f('0x28'));_0x1cb9c6['query']=_[_0xc14f('0x30')](_0x204712[_0xc14f('0x31')]);_0x1cb9c6[_0xc14f('0x32')]=_[_0xc14f('0x33')](_0x1cb9c6[_0xc14f('0x2e')],_0x1cb9c6[_0xc14f('0x31')]);_0x21d0bb[_0xc14f('0x34')]=_[_0xc14f('0x33')](_0x1cb9c6[_0xc14f('0x2e')],qs[_0xc14f('0x35')](_0x204712[_0xc14f('0x31')][_0xc14f('0x35')]));_0x21d0bb['attributes']=_0x21d0bb[_0xc14f('0x34')][_0xc14f('0x36')]?_0x21d0bb['attributes']:_0x1cb9c6[_0xc14f('0x2e')];if(!_0x204712['query']['hasOwnProperty']('nolimit')){_0x21d0bb['limit']=qs[_0xc14f('0x1e')](_0x204712[_0xc14f('0x31')][_0xc14f('0x1e')]);_0x21d0bb[_0xc14f('0x1b')]=qs[_0xc14f('0x1b')](_0x204712[_0xc14f('0x31')][_0xc14f('0x1b')]);}_0x21d0bb[_0xc14f('0x37')]=qs[_0xc14f('0x38')](_0x204712[_0xc14f('0x31')]['sort']);_0x21d0bb[_0xc14f('0x39')]=qs['filters'](_['pick'](_0x204712['query'],_0x1cb9c6[_0xc14f('0x32')]),_0x214305);if(_0x204712[_0xc14f('0x31')][_0xc14f('0x3a')]){_0x21d0bb[_0xc14f('0x39')]=_[_0xc14f('0x3b')](_0x21d0bb[_0xc14f('0x39')],{'$or':_[_0xc14f('0x2f')](_0x214305,function(_0x4595ea){if(_0x4595ea[_0xc14f('0x2c')]!==_0xc14f('0x3c')){var _0x210dc3={};_0x210dc3[_0x4595ea['name']]={'$like':'%'+_0x204712[_0xc14f('0x31')][_0xc14f('0x3a')]+'%'};return _0x210dc3;}})});}_0x21d0bb=_['merge']({},_0x21d0bb,_0x204712[_0xc14f('0x3d')]);var _0xf0fb94={'where':_0x21d0bb[_0xc14f('0x39')]};return db[_0xc14f('0x2a')][_0xc14f('0x1d')](_0xf0fb94)['then'](function(_0x2b7723){_0x469b12[_0xc14f('0x1d')]=_0x2b7723;if(_0x204712['query'][_0xc14f('0x3e')]){_0x21d0bb['include']=[{'all':!![]}];}return db[_0xc14f('0x2a')][_0xc14f('0x3f')](_0x21d0bb);})['then'](function(_0x342457){_0x469b12[_0xc14f('0x40')]=_0x342457;return _0x469b12;})[_0xc14f('0x24')](respondWithFilteredResult(_0x5f1660,_0x21d0bb))[_0xc14f('0x41')](handleError(_0x5f1660,null));};exports[_0xc14f('0x42')]=function(_0x1836ca,_0x2beec7){var _0x2418bc={'raw':!![],'where':{'id':_0x1836ca[_0xc14f('0x43')]['id']}},_0x505931={};_0x505931['model']=_['keys'](db[_0xc14f('0x2a')][_0xc14f('0x2b')]);_0x505931[_0xc14f('0x31')]=_[_0xc14f('0x30')](_0x1836ca[_0xc14f('0x31')]);_0x505931['filters']=_[_0xc14f('0x33')](_0x505931[_0xc14f('0x2e')],_0x505931[_0xc14f('0x31')]);_0x2418bc['attributes']=_[_0xc14f('0x33')](_0x505931[_0xc14f('0x2e')],qs[_0xc14f('0x35')](_0x1836ca[_0xc14f('0x31')][_0xc14f('0x35')]));_0x2418bc[_0xc14f('0x34')]=_0x2418bc['attributes'][_0xc14f('0x36')]?_0x2418bc[_0xc14f('0x34')]:_0x505931['model'];if(_0x1836ca[_0xc14f('0x31')][_0xc14f('0x3e')]){_0x2418bc['include']=[{'all':!![]}];}_0x2418bc=_['merge']({},_0x2418bc,_0x1836ca[_0xc14f('0x3d')]);return db['Sound'][_0xc14f('0x44')](_0x2418bc)[_0xc14f('0x24')](handleEntityNotFound(_0x2beec7,null))[_0xc14f('0x24')](respondWithResult(_0x2beec7,null))[_0xc14f('0x41')](handleError(_0x2beec7,null));};exports[_0xc14f('0x45')]=function(_0x95b1eb,_0x24de23,_0x5a3947){return db[_0xc14f('0x2a')][_0xc14f('0x44')]({'where':{'id':_0x95b1eb[_0xc14f('0x43')]['id']},'attributes':[_0xc14f('0x28'),'save_name',_0xc14f('0x46')],'raw':!![]})[_0xc14f('0x24')](handleEntityNotFound(_0x24de23,null))[_0xc14f('0x24')](function(_0x35f161){if(_0x35f161){if(!fs[_0xc14f('0x47')](path[_0xc14f('0x48')](config[_0xc14f('0x49')],_0xc14f('0x4a'),_0x35f161[_0xc14f('0x4b')]+'.'+_0x35f161['converted_format']))){throw new db[(_0xc14f('0x4c'))][(_0xc14f('0x4d'))](_0xc14f('0x4e'));}return _0x24de23[_0xc14f('0x45')](path[_0xc14f('0x48')](config[_0xc14f('0x49')],_0xc14f('0x4a'),util['format'](_0xc14f('0x4f'),_0x35f161[_0xc14f('0x4b')],_0x35f161[_0xc14f('0x46')])),util[_0xc14f('0x50')](_0xc14f('0x4f'),_0x35f161['name'],_0x35f161[_0xc14f('0x46')]));}return null;})[_0xc14f('0x41')](handleError(_0x24de23,null));};exports['create']=function(_0x3f8cde,_0x144917,_0x3914f8){var _0x31d993={'name':path[_0xc14f('0x51')](_0x3f8cde[_0xc14f('0x52')][_0xc14f('0x53')],path['extname'](_0x3f8cde[_0xc14f('0x52')][_0xc14f('0x53')])),'save_name':path[_0xc14f('0x51')](_0x3f8cde[_0xc14f('0x52')][_0xc14f('0x54')],path[_0xc14f('0x55')](_0x3f8cde['file'][_0xc14f('0x54')])),'original_format':path[_0xc14f('0x55')](_0x3f8cde[_0xc14f('0x52')]['originalname'])[_0xc14f('0x56')](0x1),'converted_format':_0xc14f('0x57')};var _0x1f2fa4=path['join'](config[_0xc14f('0x49')],'server/files/sounds/original',_0x3f8cde[_0xc14f('0x52')][_0xc14f('0x54')]);var _0x3edeab=path[_0xc14f('0x48')](config[_0xc14f('0x49')],'server/files/sounds/converted',util[_0xc14f('0x50')]('%s.%s',path['basename'](_0x3f8cde[_0xc14f('0x52')]['filename'],path[_0xc14f('0x55')](_0x3f8cde[_0xc14f('0x52')][_0xc14f('0x54')])),_0x31d993[_0xc14f('0x46')]));logger['info'](_0xc14f('0x58'),_0x1f2fa4);logger[_0xc14f('0x59')](_0xc14f('0x5a'),_0x3edeab);try{fs['chmodSync'](_0x1f2fa4,parseInt(_0xc14f('0x5b'),0x8));var _0xae703e=sox[_0xc14f('0x5c')](_0x1f2fa4,_0x3edeab,{'sampleRate':0x1f40,'format':_0xc14f('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xae703e['on'](_0xc14f('0x5d'),function(_0x4d6d31){fs[_0xc14f('0x5e')](_0x1f2fa4);_0x144917['status'](0x1f4)[_0xc14f('0x5f')](_0x4d6d31);});_0xae703e['on'](_0xc14f('0x60'),function(_0x494fa8){_0x31d993[_0xc14f('0x61')]=isNaN(_0x494fa8[_0xc14f('0x62')])?null:_0x494fa8[_0xc14f('0x62')]*0x3e8;_0x31d993[_0xc14f('0x63')]=isNaN(_0x494fa8[_0xc14f('0x64')])?null:_0x494fa8[_0xc14f('0x64')];_0x31d993[_0xc14f('0x65')]=isNaN(_0x494fa8[_0xc14f('0x66')])?null:_0x494fa8[_0xc14f('0x66')];_0x31d993[_0xc14f('0x67')]=isNaN(_0x494fa8[_0xc14f('0x68')])?null:_0x494fa8['bitRate'];_0x31d993[_0xc14f('0x69')]=isNaN(_0x494fa8[_0xc14f('0x6a')])?null:_0x494fa8[_0xc14f('0x6a')];});_0xae703e['on'](_0xc14f('0x6b'),function(_0x3810db){_0x31d993['converted_duration']=isNaN(_0x3810db[_0xc14f('0x62')])?null:_0x3810db[_0xc14f('0x62')]*0x3e8;_0x31d993['converted_sampleCount']=isNaN(_0x3810db[_0xc14f('0x64')])?null:_0x3810db[_0xc14f('0x64')];_0x31d993[_0xc14f('0x6c')]=isNaN(_0x3810db['channelCount'])?null:_0x3810db[_0xc14f('0x66')];_0x31d993[_0xc14f('0x6d')]=isNaN(_0x3810db[_0xc14f('0x68')])?null:_0x3810db['bitRate'];_0x31d993[_0xc14f('0x6e')]=isNaN(_0x3810db[_0xc14f('0x6a')])?null:_0x3810db[_0xc14f('0x6a')];});_0xae703e['on']('end',function(){fs[_0xc14f('0x6f')](_0x3edeab,parseInt(_0xc14f('0x5b'),0x8));return db[_0xc14f('0x2a')][_0xc14f('0x70')](_0x31d993)[_0xc14f('0x24')](function(_0x4cf412){var _0x3173f4={'role':_0x3f8cde['body'][_0xc14f('0x71')],'userProfileId':_0x3f8cde['body'][_0xc14f('0x72')]};if(!_0x3173f4)throw new Error(_0xc14f('0x73'));if(_0x3173f4[_0xc14f('0x71')]===_0xc14f('0x74')){var _0x12bbf5=_0x4cf412['get']({'plain':!![]});return db[_0xc14f('0x75')][_0xc14f('0x44')]({'where':{'name':_0xc14f('0x25'),'userProfileId':_0x3173f4['userProfileId']},'raw':!![]})[_0xc14f('0x24')](function(_0x41e09b){if(_0x41e09b&&_0x41e09b[_0xc14f('0x76')]===0x0){return db[_0xc14f('0x26')]['create']({'name':_0x12bbf5[_0xc14f('0x28')],'resourceId':_0x12bbf5['id'],'type':_0x41e09b[_0xc14f('0x28')],'sectionId':_0x41e09b['id']},{})[_0xc14f('0x24')](function(){return _0x4cf412;});}else{return _0x4cf412;}})[_0xc14f('0x41')](function(_0x499cd9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x499cd9);throw _0x499cd9;});}return _0x4cf412;})['then'](respondWithResult(_0x144917,null))[_0xc14f('0x41')](handleError(_0x144917,null));});_0xae703e[_0xc14f('0x77')]();}catch(_0x3261b6){_0x144917[_0xc14f('0x19')](0x1f4)[_0xc14f('0x5f')](_0x3261b6);}};exports['update']=function(_0x3d8ec5,_0x34ef52,_0x5009a7){return db[_0xc14f('0x2a')][_0xc14f('0x44')]({'where':{'id':_0x3d8ec5['params']['id']}})[_0xc14f('0x24')](handleEntityNotFound(_0x34ef52,null))[_0xc14f('0x24')](saveUpdates(_[_0xc14f('0x78')](_0x3d8ec5[_0xc14f('0x79')],[_0xc14f('0x28'),_0xc14f('0x7a')]),null))[_0xc14f('0x24')](respondWithResult(_0x34ef52,null))[_0xc14f('0x41')](handleError(_0x34ef52,null));};exports[_0xc14f('0x7b')]=function(_0x37412d,_0x3e8d6f,_0x552788){return db[_0xc14f('0x2a')][_0xc14f('0x44')]({'where':{'id':_0x37412d[_0xc14f('0x43')]['id']}})[_0xc14f('0x24')](function(_0x2e66fa){if(_0x2e66fa){return _0x2e66fa[_0xc14f('0x23')]();}})['then'](function(_0x22713a){var _0x31106a=path[_0xc14f('0x48')](config['root'],'server/files/sounds/original',util[_0xc14f('0x50')](_0xc14f('0x4f'),_0x22713a[_0xc14f('0x4b')],_0x22713a['original_format']));var _0x4453b3=path[_0xc14f('0x48')](config[_0xc14f('0x49')],_0xc14f('0x4a'),util[_0xc14f('0x50')](_0xc14f('0x4f'),_0x22713a['save_name'],_0x22713a[_0xc14f('0x46')]));fs['unlinkSync'](_0x31106a);fs[_0xc14f('0x5e')](_0x4453b3);return _0x22713a;})[_0xc14f('0x24')](function(_0x156b72){if(_0x156b72){return _0x3e8d6f['status'](0xcc)[_0xc14f('0x1a')]();}})[_0xc14f('0x24')](handleEntityNotFound(_0x3e8d6f,null))[_0xc14f('0x41')](handleError(_0x3e8d6f,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 30b3854..668d734 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 _0x27c7=['request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','tools_sounds','util','../../config/logger','api','moment','bluebird'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0x27c7,0x70));var _0x727c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x27c7[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x727c('0x0'));var logger=require(_0x727c('0x1'))(_0x727c('0x2'));var moment=require(_0x727c('0x3'));var BPromise=require(_0x727c('0x4'));var rp=require(_0x727c('0x5'));var fs=require('fs');var path=require(_0x727c('0x6'));var rimraf=require(_0x727c('0x7'));var config=require(_0x727c('0x8'));var attributes=require(_0x727c('0x9'));module[_0x727c('0xa')]=function(_0x4fa38a,_0x2133f4){return _0x4fa38a[_0x727c('0xb')]('Sound',attributes,{'tableName':_0x727c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x883d=['moment','request-promise','path','rimraf','./sound.attributes','exports','define','Sound','lodash','util','../../config/logger'];(function(_0x5f668c,_0x5da5cd){var _0x1788ce=function(_0x52b32f){while(--_0x52b32f){_0x5f668c['push'](_0x5f668c['shift']());}};_0x1788ce(++_0x5da5cd);}(_0x883d,0x76));var _0xd883=function(_0x1c080c,_0x2b7235){_0x1c080c=_0x1c080c-0x0;var _0x513e33=_0x883d[_0x1c080c];return _0x513e33;};'use strict';var _=require(_0xd883('0x0'));var util=require(_0xd883('0x1'));var logger=require(_0xd883('0x2'))('api');var moment=require(_0xd883('0x3'));var BPromise=require('bluebird');var rp=require(_0xd883('0x4'));var fs=require('fs');var path=require(_0xd883('0x5'));var rimraf=require(_0xd883('0x6'));var config=require('../../config/environment');var attributes=require(_0xd883('0x7'));module[_0xd883('0x8')]=function(_0x163339,_0x3da4b4){return _0x163339[_0xd883('0x9')](_0xd883('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index a83184e..741defc 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 _0x25fe=['../../config/utils','../../config/environment','jayson/promise','client','http','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSound','find','options','raw','where','attributes','include','map','model','then','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3aaf97,_0x4fa2e8){var _0xeba75e=function(_0xf7f986){while(--_0xf7f986){_0x3aaf97['push'](_0x3aaf97['shift']());}};_0xeba75e(++_0x4fa2e8);}(_0x25fe,0xf2));var _0xe25f=function(_0x3a16d4,_0x23ecda){_0x3a16d4=_0x3a16d4-0x0;var _0x31ea9c=_0x25fe[_0x3a16d4];return _0x31ea9c;};'use strict';var _=require(_0xe25f('0x0'));var util=require('util');var moment=require(_0xe25f('0x1'));var BPromise=require(_0xe25f('0x2'));var rs=require(_0xe25f('0x3'));var fs=require('fs');var Redis=require(_0xe25f('0x4'));var db=require(_0xe25f('0x5'))['db'];var utils=require(_0xe25f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe25f('0x7'));var jayson=require(_0xe25f('0x8'));var client=jayson[_0xe25f('0x9')][_0xe25f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5612e7,_0x3b3f22,_0x16597d){return new BPromise(function(_0x149cbc,_0x4c47d1){return client['request'](_0x5612e7,_0x16597d)['then'](function(_0x57b61b){logger[_0xe25f('0xb')](_0xe25f('0xc'),_0x3b3f22,_0xe25f('0xd'));logger[_0xe25f('0xe')](_0xe25f('0xf'),_0x3b3f22,_0xe25f('0xd'),JSON[_0xe25f('0x10')](_0x57b61b));if(_0x57b61b['error']){if(_0x57b61b[_0xe25f('0x11')][_0xe25f('0x12')]===0x1f4){logger[_0xe25f('0x11')](_0xe25f('0xc'),_0x3b3f22,_0x57b61b['error'][_0xe25f('0x13')]);return _0x4c47d1(_0x57b61b['error'][_0xe25f('0x13')]);}logger[_0xe25f('0x11')](_0xe25f('0xc'),_0x3b3f22,_0x57b61b[_0xe25f('0x11')]['message']);return _0x149cbc(_0x57b61b[_0xe25f('0x11')][_0xe25f('0x13')]);}else{logger[_0xe25f('0xb')](_0xe25f('0xc'),_0x3b3f22,_0xe25f('0xd'));_0x149cbc(_0x57b61b['result'][_0xe25f('0x13')]);}})['catch'](function(_0x502aa1){logger[_0xe25f('0x11')](_0xe25f('0xc'),_0x3b3f22,_0x502aa1);_0x4c47d1(_0x502aa1);});});}exports[_0xe25f('0x14')]=function(_0x1a89df){var _0xf3d168=this;return new Promise(function(_0x365758,_0x351ed3){return db['Sound'][_0xe25f('0x15')]({'raw':_0x1a89df[_0xe25f('0x16')]?_0x1a89df[_0xe25f('0x16')][_0xe25f('0x17')]===undefined?!![]:![]:!![],'where':_0x1a89df['options']?_0x1a89df[_0xe25f('0x16')][_0xe25f('0x18')]||null:null,'attributes':_0x1a89df[_0xe25f('0x16')]?_0x1a89df['options'][_0xe25f('0x19')]||null:null,'include':_0x1a89df[_0xe25f('0x16')]?_0x1a89df[_0xe25f('0x16')][_0xe25f('0x1a')]?_[_0xe25f('0x1b')](_0x1a89df[_0xe25f('0x16')][_0xe25f('0x1a')],function(_0x45fb53){return{'model':db[_0x45fb53[_0xe25f('0x1c')]],'as':_0x45fb53['as'],'attributes':_0x45fb53['attributes'],'include':_0x45fb53[_0xe25f('0x1a')]?_[_0xe25f('0x1b')](_0x45fb53[_0xe25f('0x1a')],function(_0x434d1f){return{'model':db[_0x434d1f[_0xe25f('0x1c')]],'as':_0x434d1f['as'],'attributes':_0x434d1f[_0xe25f('0x19')],'include':_0x434d1f[_0xe25f('0x1a')]?_[_0xe25f('0x1b')](_0x434d1f[_0xe25f('0x1a')],function(_0x17def6){return{'model':db[_0x17def6[_0xe25f('0x1c')]],'as':_0x17def6['as'],'attributes':_0x17def6[_0xe25f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe25f('0x1d')](function(_0x1957e5){logger['info'](_0xe25f('0x14'),_0x1a89df);logger[_0xe25f('0xe')](_0xe25f('0x14'),_0x1a89df,JSON[_0xe25f('0x10')](_0x1957e5));_0x365758(_0x1957e5);})[_0xe25f('0x1e')](function(_0x52be1a){logger[_0xe25f('0x11')](_0xe25f('0x14'),_0x52be1a[_0xe25f('0x13')],_0x1a89df);_0x351ed3(_0xf3d168[_0xe25f('0x11')](0x1f4,_0x52be1a[_0xe25f('0x13')]));});});}; \ No newline at end of file +var _0xa9c9=['request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowSound','find','options','raw','where','attributes','include','map','model','debug','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s'];(function(_0x56c54e,_0x32f931){var _0x2b89ba=function(_0xbc683f){while(--_0xbc683f){_0x56c54e['push'](_0x56c54e['shift']());}};_0x2b89ba(++_0x32f931);}(_0xa9c9,0x75));var _0x9a9c=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xa9c9[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x9a9c('0x0'));var util=require('util');var moment=require(_0x9a9c('0x1'));var BPromise=require(_0x9a9c('0x2'));var rs=require(_0x9a9c('0x3'));var fs=require('fs');var Redis=require(_0x9a9c('0x4'));var db=require(_0x9a9c('0x5'))['db'];var utils=require(_0x9a9c('0x6'));var logger=require('../../config/logger')(_0x9a9c('0x7'));var config=require(_0x9a9c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9a9c('0x9')][_0x9a9c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2aab0b,_0x3879c6,_0x5ca967){return new BPromise(function(_0xb62027,_0x1af2af){return client[_0x9a9c('0xb')](_0x2aab0b,_0x5ca967)[_0x9a9c('0xc')](function(_0x4b97fd){logger[_0x9a9c('0xd')](_0x9a9c('0xe'),_0x3879c6,_0x9a9c('0xf'));logger['debug'](_0x9a9c('0x10'),_0x3879c6,'request\x20sent',JSON['stringify'](_0x4b97fd));if(_0x4b97fd[_0x9a9c('0x11')]){if(_0x4b97fd['error'][_0x9a9c('0x12')]===0x1f4){logger[_0x9a9c('0x11')](_0x9a9c('0xe'),_0x3879c6,_0x4b97fd['error'][_0x9a9c('0x13')]);return _0x1af2af(_0x4b97fd[_0x9a9c('0x11')][_0x9a9c('0x13')]);}logger[_0x9a9c('0x11')](_0x9a9c('0xe'),_0x3879c6,_0x4b97fd['error'][_0x9a9c('0x13')]);return _0xb62027(_0x4b97fd[_0x9a9c('0x11')][_0x9a9c('0x13')]);}else{logger[_0x9a9c('0xd')]('Sound,\x20%s,\x20%s',_0x3879c6,'request\x20sent');_0xb62027(_0x4b97fd[_0x9a9c('0x14')][_0x9a9c('0x13')]);}})['catch'](function(_0x56e99b){logger['error'](_0x9a9c('0xe'),_0x3879c6,_0x56e99b);_0x1af2af(_0x56e99b);});});}exports[_0x9a9c('0x15')]=function(_0xae804){var _0x2de018=this;return new Promise(function(_0x4ee2ae,_0x586b33){return db['Sound'][_0x9a9c('0x16')]({'raw':_0xae804[_0x9a9c('0x17')]?_0xae804[_0x9a9c('0x17')][_0x9a9c('0x18')]===undefined?!![]:![]:!![],'where':_0xae804[_0x9a9c('0x17')]?_0xae804[_0x9a9c('0x17')][_0x9a9c('0x19')]||null:null,'attributes':_0xae804['options']?_0xae804[_0x9a9c('0x17')][_0x9a9c('0x1a')]||null:null,'include':_0xae804['options']?_0xae804[_0x9a9c('0x17')][_0x9a9c('0x1b')]?_[_0x9a9c('0x1c')](_0xae804[_0x9a9c('0x17')][_0x9a9c('0x1b')],function(_0x129411){return{'model':db[_0x129411[_0x9a9c('0x1d')]],'as':_0x129411['as'],'attributes':_0x129411[_0x9a9c('0x1a')],'include':_0x129411[_0x9a9c('0x1b')]?_['map'](_0x129411[_0x9a9c('0x1b')],function(_0x4660c6){return{'model':db[_0x4660c6[_0x9a9c('0x1d')]],'as':_0x4660c6['as'],'attributes':_0x4660c6[_0x9a9c('0x1a')],'include':_0x4660c6[_0x9a9c('0x1b')]?_[_0x9a9c('0x1c')](_0x4660c6[_0x9a9c('0x1b')],function(_0x3fd77a){return{'model':db[_0x3fd77a[_0x9a9c('0x1d')]],'as':_0x3fd77a['as'],'attributes':_0x3fd77a[_0x9a9c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9a9c('0xc')](function(_0x54cac2){logger['info']('ShowSound',_0xae804);logger[_0x9a9c('0x1e')](_0x9a9c('0x15'),_0xae804,JSON[_0x9a9c('0x1f')](_0x54cac2));_0x4ee2ae(_0x54cac2);})[_0x9a9c('0x20')](function(_0x609cad){logger[_0x9a9c('0x11')](_0x9a9c('0x15'),_0x609cad['message'],_0xae804);_0x586b33(_0x2de018[_0x9a9c('0x11')](0x1f4,_0x609cad['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 9a86097..b90941c 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x165775,_0x9a1f86){var _0x23f574=function(_0x291ea3){while(--_0x291ea3){_0x165775['push'](_0x165775['shift']());}};_0x23f574(++_0x9a1f86);}(_0xac4a,0x13f));var _0xaac4=function(_0x24e374,_0x2ce8b8){_0x24e374=_0x24e374-0x0;var _0x4212da=_0xac4a[_0x24e374];return _0x4212da;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x4f3cd1,_0x4b666e){var _0x4f304d=function(_0x5691ad){while(--_0x5691ad){_0x4f3cd1['push'](_0x4f3cd1['shift']());}};_0x4f304d(++_0x4b666e);}(_0x8603,0x190));var _0x3860=function(_0x1abede,_0x1be81c){_0x1abede=_0x1abede-0x0;var _0x17405f=_0x8603[_0x1abede];return _0x17405f;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 0461402..a304c70 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 _0x2d83=['out','sequelize','STRING','TEXT','ENUM'];(function(_0x2ada13,_0xe92bf1){var _0x5bf50a=function(_0x51c87a){while(--_0x51c87a){_0x2ada13['push'](_0x2ada13['shift']());}};_0x5bf50a(++_0xe92bf1);}(_0x2d83,0xc4));var _0x32d8=function(_0x501065,_0x320e25){_0x501065=_0x501065-0x0;var _0x163340=_0x2d83[_0x501065];return _0x163340;};'use strict';var Sequelize=require(_0x32d8('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x32d8('0x1')]},'body':{'type':Sequelize[_0x32d8('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x32d8('0x3')]('in',_0x32d8('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x32d8('0x2')]}}; \ No newline at end of file +var _0x0506=['TEXT','ENUM','out','sequelize','exports','STRING'];(function(_0x151de5,_0x3915de){var _0x11c518=function(_0x21fe9f){while(--_0x21fe9f){_0x151de5['push'](_0x151de5['shift']());}};_0x11c518(++_0x3915de);}(_0x0506,0x135));var _0x6050=function(_0x360a5b,_0xbb6156){_0x360a5b=_0x360a5b-0x0;var _0xbc6408=_0x0506[_0x360a5b];return _0xbc6408;};'use strict';var Sequelize=require(_0x6050('0x0'));module[_0x6050('0x1')]={'uniqueid':{'type':Sequelize[_0x6050('0x2')]},'body':{'type':Sequelize[_0x6050('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x6050('0x4')]('in',_0x6050('0x5')),'defaultValue':_0x6050('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6050('0x2')]},'providerResponse':{'type':Sequelize[_0x6050('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index fae0265..0fe9f41 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 _0x0060=['lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','destroy','then','end','error','stack','name','send','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0060,0x11e));var _0x0006=function(_0xaf0b0f,_0x209e37){_0xaf0b0f=_0xaf0b0f-0x0;var _0x9ed5e9=_0x0060[_0xaf0b0f];return _0x9ed5e9;};'use strict';var emlformat=require(_0x0006('0x0'));var rimraf=require(_0x0006('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0006('0x2'));var rp=require(_0x0006('0x3'));var moment=require('moment');var BPromise=require(_0x0006('0x4'));var Mustache=require(_0x0006('0x5'));var util=require(_0x0006('0x6'));var path=require('path');var sox=require(_0x0006('0x7'));var csv=require(_0x0006('0x8'));var ejs=require(_0x0006('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0006('0xa'));var squel=require('squel');var crypto=require(_0x0006('0xb'));var jsforce=require(_0x0006('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0006('0x8'));var querystring=require(_0x0006('0xd'));var Papa=require(_0x0006('0xe'));var Redis=require(_0x0006('0xf'));var authService=require(_0x0006('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0006('0x11'));var hardwareService=require(_0x0006('0x12'));var logger=require('../../config/logger')(_0x0006('0x13'));var utils=require(_0x0006('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0006('0x15'));var db=require(_0x0006('0x16'))['db'];function respondWithStatusCode(_0x12f434,_0x200871){_0x200871=_0x200871||0xcc;return function(_0x5eb74a){if(_0x5eb74a){return _0x12f434[_0x0006('0x17')](_0x200871);}return _0x12f434['status'](_0x200871)['end']();};}function respondWithResult(_0x34bb98,_0x1e0afa){_0x1e0afa=_0x1e0afa||0xc8;return function(_0x2d4712){if(_0x2d4712){return _0x34bb98[_0x0006('0x18')](_0x1e0afa)[_0x0006('0x19')](_0x2d4712);}};}function respondWithFilteredResult(_0x397d5a,_0x3bba76){return function(_0x24d922){if(_0x24d922){var _0x13efec=typeof _0x3bba76[_0x0006('0x1a')]===_0x0006('0x1b')&&typeof _0x3bba76['limit']==='undefined';var _0x56db0f=_0x24d922['count'];var _0x2a9170=_0x13efec?0x0:_0x3bba76[_0x0006('0x1a')];var _0x15ff19=_0x13efec?_0x24d922[_0x0006('0x1c')]:_0x3bba76[_0x0006('0x1a')]+_0x3bba76[_0x0006('0x1d')];var _0x8cac8c;if(_0x15ff19>=_0x56db0f){_0x15ff19=_0x56db0f;_0x8cac8c=0xc8;}else{_0x8cac8c=0xce;}_0x397d5a['status'](_0x8cac8c);return _0x397d5a[_0x0006('0x1e')]('Content-Range',_0x2a9170+'-'+_0x15ff19+'/'+_0x56db0f)[_0x0006('0x19')](_0x24d922);}return null;};}function patchUpdates(_0x4c517c){return function(_0x50b1eb){try{jsonpatch[_0x0006('0x1f')](_0x50b1eb,_0x4c517c,!![]);}catch(_0x3ff5ae){return BPromise[_0x0006('0x20')](_0x3ff5ae);}return _0x50b1eb['save']();};}function saveUpdates(_0x6a575f,_0x5e09cf){return function(_0x527510){if(_0x527510){return _0x527510[_0x0006('0x21')](_0x6a575f)['then'](function(_0x4f40ee){return _0x4f40ee;});}return null;};}function removeEntity(_0x5e63f8,_0x520368){return function(_0x5c37ed){if(_0x5c37ed){return _0x5c37ed[_0x0006('0x22')]()[_0x0006('0x23')](function(){_0x5e63f8[_0x0006('0x18')](0xcc)[_0x0006('0x24')]();});}};}function handleEntityNotFound(_0x9a33e5,_0x3a8a8e){return function(_0x4295b7){if(!_0x4295b7){_0x9a33e5[_0x0006('0x17')](0x194);}return _0x4295b7;};}function handleError(_0x4a4abe,_0x2345c3){_0x2345c3=_0x2345c3||0x1f4;return function(_0x51d8d2){logger[_0x0006('0x25')](_0x51d8d2[_0x0006('0x26')]);if(_0x51d8d2[_0x0006('0x27')]){delete _0x51d8d2[_0x0006('0x27')];}_0x4a4abe[_0x0006('0x18')](_0x2345c3)[_0x0006('0x28')](_0x51d8d2);};}exports['index']=function(_0x18fb47,_0x374a4e){var _0x11ed6f={},_0xe3aa24={},_0x4c1a96={'count':0x0,'rows':[]};var _0x52e06e=_[_0x0006('0x29')](db[_0x0006('0x2a')][_0x0006('0x2b')],function(_0x58ae44){return{'name':_0x58ae44[_0x0006('0x2c')],'type':_0x58ae44[_0x0006('0x2d')][_0x0006('0x2e')]};});_0xe3aa24[_0x0006('0x2f')]=_[_0x0006('0x29')](_0x52e06e,'name');_0xe3aa24[_0x0006('0x30')]=_[_0x0006('0x31')](_0x18fb47[_0x0006('0x30')]);_0xe3aa24[_0x0006('0x32')]=_[_0x0006('0x33')](_0xe3aa24[_0x0006('0x2f')],_0xe3aa24[_0x0006('0x30')]);_0x11ed6f[_0x0006('0x34')]=_['intersection'](_0xe3aa24[_0x0006('0x2f')],qs['fields'](_0x18fb47['query'][_0x0006('0x35')]));_0x11ed6f[_0x0006('0x34')]=_0x11ed6f[_0x0006('0x34')][_0x0006('0x36')]?_0x11ed6f[_0x0006('0x34')]:_0xe3aa24[_0x0006('0x2f')];if(!_0x18fb47['query'][_0x0006('0x37')](_0x0006('0x38'))){_0x11ed6f[_0x0006('0x1d')]=qs[_0x0006('0x1d')](_0x18fb47['query'][_0x0006('0x1d')]);_0x11ed6f[_0x0006('0x1a')]=qs[_0x0006('0x1a')](_0x18fb47[_0x0006('0x30')][_0x0006('0x1a')]);}_0x11ed6f[_0x0006('0x39')]=qs[_0x0006('0x3a')](_0x18fb47[_0x0006('0x30')][_0x0006('0x3a')]);_0x11ed6f[_0x0006('0x3b')]=qs[_0x0006('0x32')](_[_0x0006('0x3c')](_0x18fb47[_0x0006('0x30')],_0xe3aa24[_0x0006('0x32')]),_0x52e06e);if(_0x18fb47['query']['filter']){_0x11ed6f['where']=_[_0x0006('0x3d')](_0x11ed6f[_0x0006('0x3b')],{'$or':_['map'](_0x52e06e,function(_0x3549d8){if(_0x3549d8[_0x0006('0x2d')]!==_0x0006('0x3e')){var _0x5811d2={};_0x5811d2[_0x3549d8['name']]={'$like':'%'+_0x18fb47[_0x0006('0x30')]['filter']+'%'};return _0x5811d2;}})});}_0x11ed6f=_[_0x0006('0x3d')]({},_0x11ed6f,_0x18fb47[_0x0006('0x3f')]);var _0x4a3226={'where':_0x11ed6f[_0x0006('0x3b')]};return db['SquareMessage'][_0x0006('0x1c')](_0x4a3226)['then'](function(_0x38cf7f){_0x4c1a96[_0x0006('0x1c')]=_0x38cf7f;if(_0x18fb47[_0x0006('0x30')][_0x0006('0x40')]){_0x11ed6f[_0x0006('0x41')]=[{'all':!![]}];}return db[_0x0006('0x2a')][_0x0006('0x42')](_0x11ed6f);})['then'](function(_0x401a2d){_0x4c1a96[_0x0006('0x43')]=_0x401a2d;return _0x4c1a96;})[_0x0006('0x23')](respondWithFilteredResult(_0x374a4e,_0x11ed6f))[_0x0006('0x44')](handleError(_0x374a4e,null));};exports[_0x0006('0x45')]=function(_0x5127dc,_0x5a87d2){var _0x184a17={'raw':!![],'where':{'id':_0x5127dc[_0x0006('0x46')]['id']}},_0x1fb271={};_0x1fb271[_0x0006('0x2f')]=_[_0x0006('0x31')](db[_0x0006('0x2a')][_0x0006('0x2b')]);_0x1fb271[_0x0006('0x30')]=_['keys'](_0x5127dc['query']);_0x1fb271['filters']=_[_0x0006('0x33')](_0x1fb271[_0x0006('0x2f')],_0x1fb271[_0x0006('0x30')]);_0x184a17['attributes']=_[_0x0006('0x33')](_0x1fb271[_0x0006('0x2f')],qs[_0x0006('0x35')](_0x5127dc[_0x0006('0x30')]['fields']));_0x184a17[_0x0006('0x34')]=_0x184a17[_0x0006('0x34')][_0x0006('0x36')]?_0x184a17[_0x0006('0x34')]:_0x1fb271[_0x0006('0x2f')];if(_0x5127dc[_0x0006('0x30')]['includeAll']){_0x184a17['include']=[{'all':!![]}];}_0x184a17=_['merge']({},_0x184a17,_0x5127dc['options']);return db[_0x0006('0x2a')][_0x0006('0x47')](_0x184a17)[_0x0006('0x23')](handleEntityNotFound(_0x5a87d2,null))['then'](respondWithResult(_0x5a87d2,null))[_0x0006('0x44')](handleError(_0x5a87d2,null));};exports['create']=function(_0x161f79,_0x5340a5){return db[_0x0006('0x2a')][_0x0006('0x48')](_0x161f79[_0x0006('0x49')],{})[_0x0006('0x23')](respondWithResult(_0x5340a5,0xc9))[_0x0006('0x44')](handleError(_0x5340a5,null));};exports[_0x0006('0x21')]=function(_0xd34bbf,_0x48ad8e){if(_0xd34bbf[_0x0006('0x49')]['id']){delete _0xd34bbf[_0x0006('0x49')]['id'];}return db['SquareMessage'][_0x0006('0x47')]({'where':{'id':_0xd34bbf[_0x0006('0x46')]['id']}})['then'](handleEntityNotFound(_0x48ad8e,null))[_0x0006('0x23')](saveUpdates(_0xd34bbf[_0x0006('0x49')],null))['then'](respondWithResult(_0x48ad8e,null))[_0x0006('0x44')](handleError(_0x48ad8e,null));};exports[_0x0006('0x22')]=function(_0x43ec6f,_0x129fed){return db[_0x0006('0x2a')][_0x0006('0x47')]({'where':{'id':_0x43ec6f[_0x0006('0x46')]['id']}})[_0x0006('0x23')](handleEntityNotFound(_0x129fed,null))[_0x0006('0x23')](removeEntity(_0x129fed,null))[_0x0006('0x44')](handleError(_0x129fed,null));}; \ No newline at end of file +var _0x5b0d=['save','update','then','destroy','status','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','offset','order','sort','pick','where','merge','VIRTUAL','filter','options','count','include','findAll','catch','show','params','includeAll','find','create','body','rimraf','fast-json-patch','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined','limit','set','Content-Range','json','apply','reject'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x5b0d,0x153));var _0xd5b0=function(_0x27b423,_0x312583){_0x27b423=_0x27b423-0x0;var _0x5c11b8=_0x5b0d[_0x27b423];return _0x5c11b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd5b0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd5b0('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd5b0('0x2'));var util=require('util');var path=require(_0xd5b0('0x3'));var sox=require(_0xd5b0('0x4'));var csv=require(_0xd5b0('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5b0('0x6'));var squel=require(_0xd5b0('0x7'));var crypto=require(_0xd5b0('0x8'));var jsforce=require(_0xd5b0('0x9'));var deskjs=require(_0xd5b0('0xa'));var toCsv=require(_0xd5b0('0x5'));var querystring=require(_0xd5b0('0xb'));var Papa=require('papaparse');var Redis=require(_0xd5b0('0xc'));var authService=require(_0xd5b0('0xd'));var qs=require(_0xd5b0('0xe'));var as=require(_0xd5b0('0xf'));var hardwareService=require(_0xd5b0('0x10'));var logger=require('../../config/logger')(_0xd5b0('0x11'));var utils=require(_0xd5b0('0x12'));var config=require(_0xd5b0('0x13'));var licenseUtil=require(_0xd5b0('0x14'));var db=require(_0xd5b0('0x15'))['db'];function respondWithStatusCode(_0x353d69,_0x457da2){_0x457da2=_0x457da2||0xcc;return function(_0x4840b0){if(_0x4840b0){return _0x353d69[_0xd5b0('0x16')](_0x457da2);}return _0x353d69['status'](_0x457da2)[_0xd5b0('0x17')]();};}function respondWithResult(_0x59f83f,_0x51d039){_0x51d039=_0x51d039||0xc8;return function(_0x15ab15){if(_0x15ab15){return _0x59f83f['status'](_0x51d039)['json'](_0x15ab15);}};}function respondWithFilteredResult(_0x54e788,_0x344338){return function(_0x19d39c){if(_0x19d39c){var _0x4bd442=typeof _0x344338['offset']===_0xd5b0('0x18')&&typeof _0x344338[_0xd5b0('0x19')]===_0xd5b0('0x18');var _0x353d1b=_0x19d39c['count'];var _0x329edf=_0x4bd442?0x0:_0x344338['offset'];var _0x1ab360=_0x4bd442?_0x19d39c['count']:_0x344338['offset']+_0x344338[_0xd5b0('0x19')];var _0x2cc6fc;if(_0x1ab360>=_0x353d1b){_0x1ab360=_0x353d1b;_0x2cc6fc=0xc8;}else{_0x2cc6fc=0xce;}_0x54e788['status'](_0x2cc6fc);return _0x54e788[_0xd5b0('0x1a')](_0xd5b0('0x1b'),_0x329edf+'-'+_0x1ab360+'/'+_0x353d1b)[_0xd5b0('0x1c')](_0x19d39c);}return null;};}function patchUpdates(_0x48f84e){return function(_0x45610e){try{jsonpatch[_0xd5b0('0x1d')](_0x45610e,_0x48f84e,!![]);}catch(_0x1973d0){return BPromise[_0xd5b0('0x1e')](_0x1973d0);}return _0x45610e[_0xd5b0('0x1f')]();};}function saveUpdates(_0x4e767a,_0x2153fc){return function(_0xbf3ab9){if(_0xbf3ab9){return _0xbf3ab9[_0xd5b0('0x20')](_0x4e767a)[_0xd5b0('0x21')](function(_0x140e9b){return _0x140e9b;});}return null;};}function removeEntity(_0x129726,_0x53ea42){return function(_0x4c83ee){if(_0x4c83ee){return _0x4c83ee[_0xd5b0('0x22')]()[_0xd5b0('0x21')](function(){_0x129726[_0xd5b0('0x23')](0xcc)[_0xd5b0('0x17')]();});}};}function handleEntityNotFound(_0x3b039a,_0xc6dae4){return function(_0x36590c){if(!_0x36590c){_0x3b039a[_0xd5b0('0x16')](0x194);}return _0x36590c;};}function handleError(_0x504a8c,_0x34723c){_0x34723c=_0x34723c||0x1f4;return function(_0x4284a9){logger[_0xd5b0('0x24')](_0x4284a9[_0xd5b0('0x25')]);if(_0x4284a9[_0xd5b0('0x26')]){delete _0x4284a9[_0xd5b0('0x26')];}_0x504a8c[_0xd5b0('0x23')](_0x34723c)[_0xd5b0('0x27')](_0x4284a9);};}exports[_0xd5b0('0x28')]=function(_0x4b7298,_0x173b1f){var _0x5c33c1={},_0x319716={},_0x2ce25d={'count':0x0,'rows':[]};var _0x19335e=_[_0xd5b0('0x29')](db[_0xd5b0('0x2a')][_0xd5b0('0x2b')],function(_0x5b0b45){return{'name':_0x5b0b45[_0xd5b0('0x2c')],'type':_0x5b0b45[_0xd5b0('0x2d')][_0xd5b0('0x2e')]};});_0x319716[_0xd5b0('0x2f')]=_['map'](_0x19335e,'name');_0x319716[_0xd5b0('0x30')]=_[_0xd5b0('0x31')](_0x4b7298['query']);_0x319716[_0xd5b0('0x32')]=_[_0xd5b0('0x33')](_0x319716[_0xd5b0('0x2f')],_0x319716[_0xd5b0('0x30')]);_0x5c33c1['attributes']=_[_0xd5b0('0x33')](_0x319716[_0xd5b0('0x2f')],qs[_0xd5b0('0x34')](_0x4b7298[_0xd5b0('0x30')][_0xd5b0('0x34')]));_0x5c33c1[_0xd5b0('0x35')]=_0x5c33c1['attributes']['length']?_0x5c33c1[_0xd5b0('0x35')]:_0x319716[_0xd5b0('0x2f')];if(!_0x4b7298[_0xd5b0('0x30')]['hasOwnProperty'](_0xd5b0('0x36'))){_0x5c33c1[_0xd5b0('0x19')]=qs['limit'](_0x4b7298[_0xd5b0('0x30')][_0xd5b0('0x19')]);_0x5c33c1[_0xd5b0('0x37')]=qs[_0xd5b0('0x37')](_0x4b7298[_0xd5b0('0x30')][_0xd5b0('0x37')]);}_0x5c33c1[_0xd5b0('0x38')]=qs[_0xd5b0('0x39')](_0x4b7298[_0xd5b0('0x30')][_0xd5b0('0x39')]);_0x5c33c1['where']=qs[_0xd5b0('0x32')](_[_0xd5b0('0x3a')](_0x4b7298['query'],_0x319716[_0xd5b0('0x32')]),_0x19335e);if(_0x4b7298[_0xd5b0('0x30')]['filter']){_0x5c33c1[_0xd5b0('0x3b')]=_[_0xd5b0('0x3c')](_0x5c33c1[_0xd5b0('0x3b')],{'$or':_[_0xd5b0('0x29')](_0x19335e,function(_0x482b9e){if(_0x482b9e[_0xd5b0('0x2d')]!==_0xd5b0('0x3d')){var _0x55342d={};_0x55342d[_0x482b9e[_0xd5b0('0x26')]]={'$like':'%'+_0x4b7298[_0xd5b0('0x30')][_0xd5b0('0x3e')]+'%'};return _0x55342d;}})});}_0x5c33c1=_[_0xd5b0('0x3c')]({},_0x5c33c1,_0x4b7298[_0xd5b0('0x3f')]);var _0x16737a={'where':_0x5c33c1[_0xd5b0('0x3b')]};return db['SquareMessage']['count'](_0x16737a)[_0xd5b0('0x21')](function(_0x173248){_0x2ce25d[_0xd5b0('0x40')]=_0x173248;if(_0x4b7298[_0xd5b0('0x30')]['includeAll']){_0x5c33c1[_0xd5b0('0x41')]=[{'all':!![]}];}return db[_0xd5b0('0x2a')][_0xd5b0('0x42')](_0x5c33c1);})['then'](function(_0x2aec44){_0x2ce25d['rows']=_0x2aec44;return _0x2ce25d;})[_0xd5b0('0x21')](respondWithFilteredResult(_0x173b1f,_0x5c33c1))[_0xd5b0('0x43')](handleError(_0x173b1f,null));};exports[_0xd5b0('0x44')]=function(_0x3eac73,_0x53d6ca){var _0x3b3db4={'raw':!![],'where':{'id':_0x3eac73[_0xd5b0('0x45')]['id']}},_0x8956cc={};_0x8956cc[_0xd5b0('0x2f')]=_[_0xd5b0('0x31')](db['SquareMessage'][_0xd5b0('0x2b')]);_0x8956cc[_0xd5b0('0x30')]=_['keys'](_0x3eac73['query']);_0x8956cc[_0xd5b0('0x32')]=_['intersection'](_0x8956cc[_0xd5b0('0x2f')],_0x8956cc[_0xd5b0('0x30')]);_0x3b3db4[_0xd5b0('0x35')]=_[_0xd5b0('0x33')](_0x8956cc[_0xd5b0('0x2f')],qs[_0xd5b0('0x34')](_0x3eac73[_0xd5b0('0x30')]['fields']));_0x3b3db4[_0xd5b0('0x35')]=_0x3b3db4['attributes']['length']?_0x3b3db4[_0xd5b0('0x35')]:_0x8956cc[_0xd5b0('0x2f')];if(_0x3eac73[_0xd5b0('0x30')][_0xd5b0('0x46')]){_0x3b3db4[_0xd5b0('0x41')]=[{'all':!![]}];}_0x3b3db4=_[_0xd5b0('0x3c')]({},_0x3b3db4,_0x3eac73[_0xd5b0('0x3f')]);return db[_0xd5b0('0x2a')][_0xd5b0('0x47')](_0x3b3db4)[_0xd5b0('0x21')](handleEntityNotFound(_0x53d6ca,null))[_0xd5b0('0x21')](respondWithResult(_0x53d6ca,null))[_0xd5b0('0x43')](handleError(_0x53d6ca,null));};exports['create']=function(_0x17ac3c,_0x323444){return db[_0xd5b0('0x2a')][_0xd5b0('0x48')](_0x17ac3c['body'],{})[_0xd5b0('0x21')](respondWithResult(_0x323444,0xc9))['catch'](handleError(_0x323444,null));};exports['update']=function(_0x45b136,_0x108124){if(_0x45b136['body']['id']){delete _0x45b136['body']['id'];}return db[_0xd5b0('0x2a')][_0xd5b0('0x47')]({'where':{'id':_0x45b136[_0xd5b0('0x45')]['id']}})[_0xd5b0('0x21')](handleEntityNotFound(_0x108124,null))['then'](saveUpdates(_0x45b136[_0xd5b0('0x49')],null))['then'](respondWithResult(_0x108124,null))[_0xd5b0('0x43')](handleError(_0x108124,null));};exports[_0xd5b0('0x22')]=function(_0x345cfe,_0x947644){return db[_0xd5b0('0x2a')][_0xd5b0('0x47')]({'where':{'id':_0x345cfe[_0xd5b0('0x45')]['id']}})[_0xd5b0('0x21')](handleEntityNotFound(_0x947644,null))['then'](removeEntity(_0x947644,null))[_0xd5b0('0x43')](handleError(_0x947644,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 5063efe..428b1ab 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 _0x0cc3=['request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','api','bluebird'];(function(_0xedab5c,_0x5de304){var _0x127c7b=function(_0x1d40c8){while(--_0x1d40c8){_0xedab5c['push'](_0xedab5c['shift']());}};_0x127c7b(++_0x5de304);}(_0x0cc3,0x195));var _0x30cc=function(_0x52c34f,_0x35c712){_0x52c34f=_0x52c34f-0x0;var _0x204b79=_0x0cc3[_0x52c34f];return _0x204b79;};'use strict';var _=require(_0x30cc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x30cc('0x1'));var moment=require('moment');var BPromise=require(_0x30cc('0x2'));var rp=require(_0x30cc('0x3'));var fs=require('fs');var path=require(_0x30cc('0x4'));var rimraf=require(_0x30cc('0x5'));var config=require(_0x30cc('0x6'));var attributes=require(_0x30cc('0x7'));module[_0x30cc('0x8')]=function(_0x56b7b6,_0x255ccf){return _0x56b7b6[_0x30cc('0x9')](_0x30cc('0xa'),attributes,{'tableName':_0x30cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ce8=['bluebird','request-promise','path','rimraf','./squareMessage.attributes','define','lodash','util','../../config/logger','api','moment'];(function(_0x6ee9cc,_0x22fe8a){var _0x1bce8c=function(_0x3346ae){while(--_0x3346ae){_0x6ee9cc['push'](_0x6ee9cc['shift']());}};_0x1bce8c(++_0x22fe8a);}(_0x1ce8,0x17c));var _0x81ce=function(_0x3ca30b,_0x416e7c){_0x3ca30b=_0x3ca30b-0x0;var _0xabe3d5=_0x1ce8[_0x3ca30b];return _0xabe3d5;};'use strict';var _=require(_0x81ce('0x0'));var util=require(_0x81ce('0x1'));var logger=require(_0x81ce('0x2'))(_0x81ce('0x3'));var moment=require(_0x81ce('0x4'));var BPromise=require(_0x81ce('0x5'));var rp=require(_0x81ce('0x6'));var fs=require('fs');var path=require(_0x81ce('0x7'));var rimraf=require(_0x81ce('0x8'));var config=require('../../config/environment');var attributes=require(_0x81ce('0x9'));module['exports']=function(_0x818ac,_0x5abc9d){return _0x818ac[_0x81ce('0xa')]('SquareMessage',attributes,{'tableName':'square_messages','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 e919096..384b365 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 _0xcb29=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','debug','util','moment','bluebird','ioredis'];(function(_0x10aabf,_0x255f32){var _0x419630=function(_0x6d21cb){while(--_0x6d21cb){_0x10aabf['push'](_0x10aabf['shift']());}};_0x419630(++_0x255f32);}(_0xcb29,0x125));var _0x9cb2=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xcb29[_0x4a3898];return _0x25ceb0;};'use strict';var _=require('lodash');var util=require(_0x9cb2('0x0'));var moment=require(_0x9cb2('0x1'));var BPromise=require(_0x9cb2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cb2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9cb2('0x4'));var logger=require(_0x9cb2('0x5'))(_0x9cb2('0x6'));var config=require(_0x9cb2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9cb2('0x8')][_0x9cb2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bd303,_0x40e7c8,_0x3d76ac){return new BPromise(function(_0x1e5ed5,_0x44f2ef){return client['request'](_0x4bd303,_0x3d76ac)[_0x9cb2('0xa')](function(_0x4e1abe){logger[_0x9cb2('0xb')]('SquareMessage,\x20%s,\x20%s',_0x40e7c8,_0x9cb2('0xc'));logger['debug'](_0x9cb2('0xd'),_0x40e7c8,_0x9cb2('0xc'),JSON[_0x9cb2('0xe')](_0x4e1abe));if(_0x4e1abe[_0x9cb2('0xf')]){if(_0x4e1abe['error'][_0x9cb2('0x10')]===0x1f4){logger[_0x9cb2('0xf')](_0x9cb2('0x11'),_0x40e7c8,_0x4e1abe['error'][_0x9cb2('0x12')]);return _0x44f2ef(_0x4e1abe[_0x9cb2('0xf')][_0x9cb2('0x12')]);}logger[_0x9cb2('0xf')]('SquareMessage,\x20%s,\x20%s',_0x40e7c8,_0x4e1abe[_0x9cb2('0xf')][_0x9cb2('0x12')]);return _0x1e5ed5(_0x4e1abe[_0x9cb2('0xf')]['message']);}else{logger[_0x9cb2('0xb')](_0x9cb2('0x11'),_0x40e7c8,_0x9cb2('0xc'));_0x1e5ed5(_0x4e1abe['result'][_0x9cb2('0x12')]);}})[_0x9cb2('0x13')](function(_0x1ad647){logger[_0x9cb2('0xf')](_0x9cb2('0x11'),_0x40e7c8,_0x1ad647);_0x44f2ef(_0x1ad647);});});}exports[_0x9cb2('0x14')]=function(_0x5607fd){var _0x1d7f65=this;return new Promise(function(_0x5963d3,_0x216d01){return db[_0x9cb2('0x15')][_0x9cb2('0x16')](_0x5607fd[_0x9cb2('0x17')],{'raw':_0x5607fd[_0x9cb2('0x18')]?_0x5607fd[_0x9cb2('0x18')][_0x9cb2('0x19')]===undefined?!![]:![]:!![]})[_0x9cb2('0xa')](function(_0x3f2a92){logger[_0x9cb2('0xb')](_0x9cb2('0x14'),_0x5607fd);logger[_0x9cb2('0x1a')](_0x9cb2('0x14'),_0x5607fd,JSON['stringify'](_0x3f2a92));_0x5963d3(_0x3f2a92);})[_0x9cb2('0x13')](function(_0x592ab9){logger[_0x9cb2('0xf')](_0x9cb2('0x14'),_0x592ab9[_0x9cb2('0x12')],_0x5607fd);_0x216d01(_0x1d7f65[_0x9cb2('0xf')](0x1f4,_0x592ab9[_0x9cb2('0x12')]));});});}; \ No newline at end of file +var _0xc608=['moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','SquareMessage','options','raw','then','info','CreateSquareMessage','catch','lodash'];(function(_0x8b6c32,_0x2ea25b){var _0x57942e=function(_0x40d749){while(--_0x40d749){_0x8b6c32['push'](_0x8b6c32['shift']());}};_0x57942e(++_0x2ea25b);}(_0xc608,0xd7));var _0x8c60=function(_0x450c50,_0x2602f5){_0x450c50=_0x450c50-0x0;var _0x48b0ee=_0xc608[_0x450c50];return _0x48b0ee;};'use strict';var _=require(_0x8c60('0x0'));var util=require('util');var moment=require(_0x8c60('0x1'));var BPromise=require(_0x8c60('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c60('0x3'))['db'];var utils=require(_0x8c60('0x4'));var logger=require('../../config/logger')(_0x8c60('0x5'));var config=require(_0x8c60('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8c60('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23e825,_0x405f8b,_0x18cb9e){return new BPromise(function(_0x21d734,_0xc36da0){return client['request'](_0x23e825,_0x18cb9e)['then'](function(_0x2f4ead){logger['info'](_0x8c60('0x8'),_0x405f8b,'request\x20sent');logger[_0x8c60('0x9')](_0x8c60('0xa'),_0x405f8b,_0x8c60('0xb'),JSON[_0x8c60('0xc')](_0x2f4ead));if(_0x2f4ead['error']){if(_0x2f4ead[_0x8c60('0xd')][_0x8c60('0xe')]===0x1f4){logger[_0x8c60('0xd')]('SquareMessage,\x20%s,\x20%s',_0x405f8b,_0x2f4ead[_0x8c60('0xd')][_0x8c60('0xf')]);return _0xc36da0(_0x2f4ead[_0x8c60('0xd')]['message']);}logger[_0x8c60('0xd')](_0x8c60('0x8'),_0x405f8b,_0x2f4ead[_0x8c60('0xd')]['message']);return _0x21d734(_0x2f4ead['error'][_0x8c60('0xf')]);}else{logger['info'](_0x8c60('0x8'),_0x405f8b,_0x8c60('0xb'));_0x21d734(_0x2f4ead[_0x8c60('0x10')][_0x8c60('0xf')]);}})['catch'](function(_0x1859b5){logger[_0x8c60('0xd')](_0x8c60('0x8'),_0x405f8b,_0x1859b5);_0xc36da0(_0x1859b5);});});}exports['CreateSquareMessage']=function(_0x198964){var _0x88b2de=this;return new Promise(function(_0x3a8fd2,_0xc2cf2){return db[_0x8c60('0x11')]['create'](_0x198964['body'],{'raw':_0x198964[_0x8c60('0x12')]?_0x198964[_0x8c60('0x12')][_0x8c60('0x13')]===undefined?!![]:![]:!![]})[_0x8c60('0x14')](function(_0x496586){logger[_0x8c60('0x15')](_0x8c60('0x16'),_0x198964);logger[_0x8c60('0x9')](_0x8c60('0x16'),_0x198964,JSON['stringify'](_0x496586));_0x3a8fd2(_0x496586);})[_0x8c60('0x17')](function(_0x19efea){logger[_0x8c60('0xd')](_0x8c60('0x16'),_0x19efea[_0x8c60('0xf')],_0x198964);_0xc2cf2(_0x88b2de['error'](0x1f4,_0x19efea['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 257bd0d..2f7fdee 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 _0xd2dc=['./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','test','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x23fc4e,_0x33f253){var _0x215829=function(_0x545f0){while(--_0x545f0){_0x23fc4e['push'](_0x23fc4e['shift']());}};_0x215829(++_0x33f253);}(_0xd2dc,0x150));var _0xcd2d=function(_0x3d418e,_0xe70f7d){_0x3d418e=_0x3d418e-0x0;var _0x840b2a=_0xd2dc[_0x3d418e];return _0x840b2a;};'use strict';var multer=require(_0xcd2d('0x0'));var util=require(_0xcd2d('0x1'));var path=require(_0xcd2d('0x2'));var timeout=require(_0xcd2d('0x3'));var express=require('express');var router=express[_0xcd2d('0x4')]();var fs_extra=require(_0xcd2d('0x5'));var auth=require(_0xcd2d('0x6'));var interaction=require(_0xcd2d('0x7'));var config=require(_0xcd2d('0x8'));var controller=require(_0xcd2d('0x9'));router[_0xcd2d('0xa')]('/',auth[_0xcd2d('0xb')](),controller['index']);router[_0xcd2d('0xa')](_0xcd2d('0xc'),auth[_0xcd2d('0xb')](),controller[_0xcd2d('0xd')]);router['get'](_0xcd2d('0xe'),auth[_0xcd2d('0xb')](),timeout(_0xcd2d('0xf')),controller[_0xcd2d('0x10')]);router[_0xcd2d('0x11')]('/',auth['isAuthenticated'](),controller[_0xcd2d('0x12')]);router[_0xcd2d('0x13')](_0xcd2d('0xc'),auth['isAuthenticated'](),controller[_0xcd2d('0x14')]);router[_0xcd2d('0x15')](_0xcd2d('0xc'),auth[_0xcd2d('0xb')](),controller['destroy']);module[_0xcd2d('0x16')]=router; \ No newline at end of file +var _0x916f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','test','post','put','/:id','update','destroy','multer','path'];(function(_0x2458f0,_0xf805c){var _0x2b4fd9=function(_0x57deeb){while(--_0x57deeb){_0x2458f0['push'](_0x2458f0['shift']());}};_0x2b4fd9(++_0xf805c);}(_0x916f,0x1b6));var _0xf916=function(_0x4e0881,_0xba4002){_0x4e0881=_0x4e0881-0x0;var _0x3276a5=_0x916f[_0x4e0881];return _0x3276a5;};'use strict';var multer=require(_0xf916('0x0'));var util=require('util');var path=require(_0xf916('0x1'));var timeout=require(_0xf916('0x2'));var express=require(_0xf916('0x3'));var router=express[_0xf916('0x4')]();var fs_extra=require(_0xf916('0x5'));var auth=require(_0xf916('0x6'));var interaction=require(_0xf916('0x7'));var config=require('../../config/environment');var controller=require(_0xf916('0x8'));router[_0xf916('0x9')]('/',auth[_0xf916('0xa')](),controller[_0xf916('0xb')]);router[_0xf916('0x9')]('/:id',auth[_0xf916('0xa')](),controller[_0xf916('0xc')]);router['get'](_0xf916('0xd'),auth[_0xf916('0xa')](),timeout('15s'),controller[_0xf916('0xe')]);router[_0xf916('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf916('0x10')](_0xf916('0x11'),auth[_0xf916('0xa')](),controller[_0xf916('0x12')]);router['delete'](_0xf916('0x11'),auth[_0xf916('0xa')](),controller[_0xf916('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 809c20c..5c3ab51 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 _0x4424=['name','STRING','exports'];(function(_0xf8a2be,_0x1f7254){var _0x15c7ad=function(_0x3c47b2){while(--_0x3c47b2){_0xf8a2be['push'](_0xf8a2be['shift']());}};_0x15c7ad(++_0x1f7254);}(_0x4424,0x1cd));var _0x4442=function(_0x1a68f1,_0x5ba08c){_0x1a68f1=_0x1a68f1-0x0;var _0x1adcdd=_0x4424[_0x1a68f1];return _0x1adcdd;};'use strict';var Sequelize=require('sequelize');module[_0x4442('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x4442('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4442('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0a79=['STRING','name','exports'];(function(_0x263b0e,_0xc6479f){var _0x113fee=function(_0x803881){while(--_0x803881){_0x263b0e['push'](_0x263b0e['shift']());}};_0x113fee(++_0xc6479f);}(_0x0a79,0x1af));var _0x90a7=function(_0x2dd5de,_0x545195){_0x2dd5de=_0x2dd5de-0x0;var _0x51a108=_0x0a79[_0x2dd5de];return _0x51a108;};'use strict';var Sequelize=require('sequelize');module[_0x90a7('0x0')]={'name':{'type':Sequelize[_0x90a7('0x1')],'unique':_0x90a7('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x90a7('0x1')]},'description':{'type':Sequelize[_0x90a7('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index aee7884..b6ba845 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 _0x9a90=['closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','ODBC','UserProfileResource','error','stack','index','map','SquareOdbc','fieldName','type','key','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','test','dsn','odbc','openSync'];(function(_0x480c7d,_0x2007ec){var _0x3dfb4b=function(_0x396c25){while(--_0x396c25){_0x480c7d['push'](_0x480c7d['shift']());}};_0x3dfb4b(++_0x2007ec);}(_0x9a90,0x1b9));var _0x09a9=function(_0x11a8f1,_0x193acb){_0x11a8f1=_0x11a8f1-0x0;var _0x2a91ed=_0x9a90[_0x11a8f1];return _0x2a91ed;};'use strict';var emlformat=require(_0x09a9('0x0'));var rimraf=require(_0x09a9('0x1'));var zipdir=require(_0x09a9('0x2'));var jsonpatch=require(_0x09a9('0x3'));var rp=require(_0x09a9('0x4'));var moment=require(_0x09a9('0x5'));var BPromise=require(_0x09a9('0x6'));var Mustache=require(_0x09a9('0x7'));var util=require(_0x09a9('0x8'));var path=require(_0x09a9('0x9'));var sox=require(_0x09a9('0xa'));var csv=require(_0x09a9('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09a9('0xc'));var _=require(_0x09a9('0xd'));var squel=require(_0x09a9('0xe'));var crypto=require(_0x09a9('0xf'));var jsforce=require(_0x09a9('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x09a9('0x11'));var Papa=require('papaparse');var Redis=require(_0x09a9('0x12'));var authService=require(_0x09a9('0x13'));var qs=require(_0x09a9('0x14'));var as=require(_0x09a9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x09a9('0x16'));var utils=require('../../config/utils');var config=require(_0x09a9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x09a9('0x18'))['db'];function respondWithStatusCode(_0x8ecc8a,_0x23c618){_0x23c618=_0x23c618||0xcc;return function(_0x62e381){if(_0x62e381){return _0x8ecc8a[_0x09a9('0x19')](_0x23c618);}return _0x8ecc8a[_0x09a9('0x1a')](_0x23c618)[_0x09a9('0x1b')]();};}function respondWithResult(_0x383e06,_0x1e5f48){_0x1e5f48=_0x1e5f48||0xc8;return function(_0x49cf1b){if(_0x49cf1b){return _0x383e06[_0x09a9('0x1a')](_0x1e5f48)['json'](_0x49cf1b);}};}function respondWithFilteredResult(_0x41886d,_0x1457e1){return function(_0x18f639){if(_0x18f639){var _0x2f7ae5=typeof _0x1457e1[_0x09a9('0x1c')]===_0x09a9('0x1d')&&typeof _0x1457e1[_0x09a9('0x1e')]===_0x09a9('0x1d');var _0x266f07=_0x18f639[_0x09a9('0x1f')];var _0x51dfc4=_0x2f7ae5?0x0:_0x1457e1['offset'];var _0x3813f2=_0x2f7ae5?_0x18f639[_0x09a9('0x1f')]:_0x1457e1[_0x09a9('0x1c')]+_0x1457e1[_0x09a9('0x1e')];var _0x27dd3c;if(_0x3813f2>=_0x266f07){_0x3813f2=_0x266f07;_0x27dd3c=0xc8;}else{_0x27dd3c=0xce;}_0x41886d[_0x09a9('0x1a')](_0x27dd3c);return _0x41886d[_0x09a9('0x20')](_0x09a9('0x21'),_0x51dfc4+'-'+_0x3813f2+'/'+_0x266f07)['json'](_0x18f639);}return null;};}function patchUpdates(_0x5daab0){return function(_0x2a0f09){try{jsonpatch['apply'](_0x2a0f09,_0x5daab0,!![]);}catch(_0x5b9bf2){return BPromise['reject'](_0x5b9bf2);}return _0x2a0f09[_0x09a9('0x22')]();};}function saveUpdates(_0xe311a,_0x338a54){return function(_0x1b95d2){if(_0x1b95d2){return _0x1b95d2[_0x09a9('0x23')](_0xe311a)[_0x09a9('0x24')](function(_0x4e9a7b){return _0x4e9a7b;});}return null;};}function removeEntity(_0x40f45b,_0x121447){return function(_0x20e5ff){if(_0x20e5ff){return _0x20e5ff[_0x09a9('0x25')]()[_0x09a9('0x24')](function(){var _0xa19e0b=_0x20e5ff['get']({'plain':!![]});var _0x51d7e1=_0x09a9('0x26');return db[_0x09a9('0x27')][_0x09a9('0x25')]({'where':{'type':_0x51d7e1,'resourceId':_0xa19e0b['id']}})['then'](function(){return _0x20e5ff;});})['then'](function(){_0x40f45b[_0x09a9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x327100,_0x11b51e){return function(_0x21d6f3){if(!_0x21d6f3){_0x327100[_0x09a9('0x19')](0x194);}return _0x21d6f3;};}function handleError(_0x1aa0c2,_0x25715b){_0x25715b=_0x25715b||0x1f4;return function(_0x20e166){logger[_0x09a9('0x28')](_0x20e166[_0x09a9('0x29')]);if(_0x20e166['name']){delete _0x20e166['name'];}_0x1aa0c2[_0x09a9('0x1a')](_0x25715b)['send'](_0x20e166);};}exports[_0x09a9('0x2a')]=function(_0x573e8d,_0x2da13f){var _0x348637={},_0x4d33e5={},_0x1fe908={'count':0x0,'rows':[]};var _0x860257=_[_0x09a9('0x2b')](db[_0x09a9('0x2c')]['rawAttributes'],function(_0x1ca610){return{'name':_0x1ca610[_0x09a9('0x2d')],'type':_0x1ca610[_0x09a9('0x2e')][_0x09a9('0x2f')]};});_0x4d33e5['model']=_['map'](_0x860257,_0x09a9('0x30'));_0x4d33e5[_0x09a9('0x31')]=_[_0x09a9('0x32')](_0x573e8d[_0x09a9('0x31')]);_0x4d33e5['filters']=_[_0x09a9('0x33')](_0x4d33e5[_0x09a9('0x34')],_0x4d33e5[_0x09a9('0x31')]);_0x348637[_0x09a9('0x35')]=_[_0x09a9('0x33')](_0x4d33e5[_0x09a9('0x34')],qs[_0x09a9('0x36')](_0x573e8d[_0x09a9('0x31')]['fields']));_0x348637[_0x09a9('0x35')]=_0x348637[_0x09a9('0x35')][_0x09a9('0x37')]?_0x348637['attributes']:_0x4d33e5[_0x09a9('0x34')];if(!_0x573e8d[_0x09a9('0x31')][_0x09a9('0x38')](_0x09a9('0x39'))){_0x348637[_0x09a9('0x1e')]=qs[_0x09a9('0x1e')](_0x573e8d[_0x09a9('0x31')][_0x09a9('0x1e')]);_0x348637['offset']=qs[_0x09a9('0x1c')](_0x573e8d[_0x09a9('0x31')]['offset']);}_0x348637[_0x09a9('0x3a')]=qs['sort'](_0x573e8d[_0x09a9('0x31')][_0x09a9('0x3b')]);_0x348637[_0x09a9('0x3c')]=qs['filters'](_[_0x09a9('0x3d')](_0x573e8d[_0x09a9('0x31')],_0x4d33e5['filters']),_0x860257);if(_0x573e8d[_0x09a9('0x31')][_0x09a9('0x3e')]){_0x348637[_0x09a9('0x3c')]=_[_0x09a9('0x3f')](_0x348637[_0x09a9('0x3c')],{'$or':_[_0x09a9('0x2b')](_0x860257,function(_0x4046bc){if(_0x4046bc[_0x09a9('0x2e')]!==_0x09a9('0x40')){var _0xd4b24b={};_0xd4b24b[_0x4046bc[_0x09a9('0x30')]]={'$like':'%'+_0x573e8d[_0x09a9('0x31')][_0x09a9('0x3e')]+'%'};return _0xd4b24b;}})});}_0x348637=_[_0x09a9('0x3f')]({},_0x348637,_0x573e8d[_0x09a9('0x41')]);var _0x1fafa5={'where':_0x348637[_0x09a9('0x3c')]};return db['SquareOdbc'][_0x09a9('0x1f')](_0x1fafa5)[_0x09a9('0x24')](function(_0x5b7b9b){_0x1fe908['count']=_0x5b7b9b;if(_0x573e8d[_0x09a9('0x31')][_0x09a9('0x42')]){_0x348637[_0x09a9('0x43')]=[{'all':!![]}];}return db['SquareOdbc'][_0x09a9('0x44')](_0x348637);})[_0x09a9('0x24')](function(_0x130ecf){_0x1fe908[_0x09a9('0x45')]=_0x130ecf;return _0x1fe908;})[_0x09a9('0x24')](respondWithFilteredResult(_0x2da13f,_0x348637))[_0x09a9('0x46')](handleError(_0x2da13f,null));};exports[_0x09a9('0x47')]=function(_0x2dd259,_0x4f57fe){var _0x5cf568={'raw':!![],'where':{'id':_0x2dd259[_0x09a9('0x48')]['id']}},_0x1e5301={};_0x1e5301[_0x09a9('0x34')]=_[_0x09a9('0x32')](db[_0x09a9('0x2c')]['rawAttributes']);_0x1e5301['query']=_[_0x09a9('0x32')](_0x2dd259['query']);_0x1e5301[_0x09a9('0x49')]=_[_0x09a9('0x33')](_0x1e5301[_0x09a9('0x34')],_0x1e5301[_0x09a9('0x31')]);_0x5cf568[_0x09a9('0x35')]=_[_0x09a9('0x33')](_0x1e5301[_0x09a9('0x34')],qs[_0x09a9('0x36')](_0x2dd259[_0x09a9('0x31')]['fields']));_0x5cf568[_0x09a9('0x35')]=_0x5cf568[_0x09a9('0x35')][_0x09a9('0x37')]?_0x5cf568[_0x09a9('0x35')]:_0x1e5301[_0x09a9('0x34')];if(_0x2dd259[_0x09a9('0x31')]['includeAll']){_0x5cf568['include']=[{'all':!![]}];}_0x5cf568=_['merge']({},_0x5cf568,_0x2dd259['options']);return db['SquareOdbc'][_0x09a9('0x4a')](_0x5cf568)[_0x09a9('0x24')](handleEntityNotFound(_0x4f57fe,null))[_0x09a9('0x24')](respondWithResult(_0x4f57fe,null))[_0x09a9('0x46')](handleError(_0x4f57fe,null));};exports[_0x09a9('0x4b')]=function(_0x5b4483,_0x5807f3){return db[_0x09a9('0x2c')][_0x09a9('0x4b')](_0x5b4483[_0x09a9('0x4c')],{})[_0x09a9('0x24')](function(_0x22dc97){var _0x408db2=_0x5b4483[_0x09a9('0x4d')]['get']({'plain':!![]});if(!_0x408db2)throw new Error(_0x09a9('0x4e'));if(_0x408db2[_0x09a9('0x4f')]==='user'){var _0xe8b0f3=_0x22dc97['get']({'plain':!![]});var _0x1736e3=_0x09a9('0x26');return db[_0x09a9('0x50')][_0x09a9('0x4a')]({'where':{'name':_0x1736e3,'userProfileId':_0x408db2[_0x09a9('0x51')]},'raw':!![]})[_0x09a9('0x24')](function(_0x492b48){if(_0x492b48&&_0x492b48[_0x09a9('0x52')]===0x0){return db[_0x09a9('0x27')][_0x09a9('0x4b')]({'name':_0xe8b0f3[_0x09a9('0x30')],'resourceId':_0xe8b0f3['id'],'type':_0x492b48[_0x09a9('0x30')],'sectionId':_0x492b48['id']},{})['then'](function(){return _0x22dc97;});}else{return _0x22dc97;}})[_0x09a9('0x46')](function(_0x764014){logger[_0x09a9('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x764014);throw _0x764014;});}return _0x22dc97;})[_0x09a9('0x24')](respondWithResult(_0x5807f3,0xc9))[_0x09a9('0x46')](handleError(_0x5807f3,null));};exports[_0x09a9('0x23')]=function(_0x1e5568,_0x4782b3){if(_0x1e5568[_0x09a9('0x4c')]['id']){delete _0x1e5568['body']['id'];}return db[_0x09a9('0x2c')][_0x09a9('0x4a')]({'where':{'id':_0x1e5568['params']['id']}})[_0x09a9('0x24')](handleEntityNotFound(_0x4782b3,null))[_0x09a9('0x24')](saveUpdates(_0x1e5568['body'],null))['then'](respondWithResult(_0x4782b3,null))[_0x09a9('0x46')](handleError(_0x4782b3,null));};exports['destroy']=function(_0x375ca6,_0x3a1d0d){return db['SquareOdbc'][_0x09a9('0x4a')]({'where':{'id':_0x375ca6[_0x09a9('0x48')]['id']}})[_0x09a9('0x24')](handleEntityNotFound(_0x3a1d0d,null))[_0x09a9('0x24')](removeEntity(_0x3a1d0d,null))[_0x09a9('0x46')](handleError(_0x3a1d0d,null));};exports[_0x09a9('0x53')]=function(_0x3c0e3e,_0x19e997,_0x4b6f89){var _0x65064d;return db[_0x09a9('0x2c')][_0x09a9('0x4a')]({'where':{'id':_0x3c0e3e[_0x09a9('0x48')]['id']},'attributes':['id',_0x09a9('0x54')]})[_0x09a9('0x24')](handleEntityNotFound(_0x19e997,null))[_0x09a9('0x24')](function(_0x2c72c3){if(_0x2c72c3){var _0x490038=require(_0x09a9('0x55'))();_0x490038[_0x09a9('0x56')](_0x2c72c3[_0x09a9('0x54')]);_0x490038[_0x09a9('0x57')]();return _0x2c72c3;}})[_0x09a9('0x24')](respondWithResult(_0x19e997,null))[_0x09a9('0x46')](handleError(_0x19e997,null));}; \ No newline at end of file +var _0xcd64=['pick','filter','type','VIRTUAL','merge','options','SquareOdbc','includeAll','findAll','rows','catch','show','params','find','create','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','ODBC','UserProfileResource','stack','map','rawAttributes','fieldName','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x5c619e,_0x1bccdf){var _0x445cf8=function(_0x2eaa64){while(--_0x2eaa64){_0x5c619e['push'](_0x5c619e['shift']());}};_0x445cf8(++_0x1bccdf);}(_0xcd64,0x179));var _0x4cd6=function(_0x1c9f29,_0x5270cc){_0x1c9f29=_0x1c9f29-0x0;var _0x451d71=_0xcd64[_0x1c9f29];return _0x451d71;};'use strict';var emlformat=require(_0x4cd6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4cd6('0x1'));var jsonpatch=require(_0x4cd6('0x2'));var rp=require(_0x4cd6('0x3'));var moment=require(_0x4cd6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4cd6('0x5'));var util=require(_0x4cd6('0x6'));var path=require('path');var sox=require(_0x4cd6('0x7'));var csv=require(_0x4cd6('0x8'));var ejs=require(_0x4cd6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4cd6('0xa'));var crypto=require(_0x4cd6('0xb'));var jsforce=require(_0x4cd6('0xc'));var deskjs=require(_0x4cd6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4cd6('0xe'));var Redis=require(_0x4cd6('0xf'));var authService=require(_0x4cd6('0x10'));var qs=require(_0x4cd6('0x11'));var as=require(_0x4cd6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4cd6('0x13'));var utils=require(_0x4cd6('0x14'));var config=require(_0x4cd6('0x15'));var licenseUtil=require(_0x4cd6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x253f36,_0x3a6167){_0x3a6167=_0x3a6167||0xcc;return function(_0x4f2874){if(_0x4f2874){return _0x253f36[_0x4cd6('0x17')](_0x3a6167);}return _0x253f36[_0x4cd6('0x18')](_0x3a6167)[_0x4cd6('0x19')]();};}function respondWithResult(_0x14e982,_0x1c2f6c){_0x1c2f6c=_0x1c2f6c||0xc8;return function(_0x5f445c){if(_0x5f445c){return _0x14e982[_0x4cd6('0x18')](_0x1c2f6c)[_0x4cd6('0x1a')](_0x5f445c);}};}function respondWithFilteredResult(_0x20c615,_0xd139cf){return function(_0x4a49ff){if(_0x4a49ff){var _0x3a1009=typeof _0xd139cf['offset']===_0x4cd6('0x1b')&&typeof _0xd139cf[_0x4cd6('0x1c')]===_0x4cd6('0x1b');var _0x3b22ed=_0x4a49ff[_0x4cd6('0x1d')];var _0x13cb4d=_0x3a1009?0x0:_0xd139cf[_0x4cd6('0x1e')];var _0x40fa9e=_0x3a1009?_0x4a49ff[_0x4cd6('0x1d')]:_0xd139cf[_0x4cd6('0x1e')]+_0xd139cf[_0x4cd6('0x1c')];var _0x280f9b;if(_0x40fa9e>=_0x3b22ed){_0x40fa9e=_0x3b22ed;_0x280f9b=0xc8;}else{_0x280f9b=0xce;}_0x20c615[_0x4cd6('0x18')](_0x280f9b);return _0x20c615[_0x4cd6('0x1f')](_0x4cd6('0x20'),_0x13cb4d+'-'+_0x40fa9e+'/'+_0x3b22ed)[_0x4cd6('0x1a')](_0x4a49ff);}return null;};}function patchUpdates(_0x56f0e3){return function(_0x5dcb46){try{jsonpatch[_0x4cd6('0x21')](_0x5dcb46,_0x56f0e3,!![]);}catch(_0x584523){return BPromise[_0x4cd6('0x22')](_0x584523);}return _0x5dcb46[_0x4cd6('0x23')]();};}function saveUpdates(_0x203249,_0x4b32e9){return function(_0x41138a){if(_0x41138a){return _0x41138a[_0x4cd6('0x24')](_0x203249)[_0x4cd6('0x25')](function(_0x3fc303){return _0x3fc303;});}return null;};}function removeEntity(_0xf8bed1,_0x4caa96){return function(_0x5efe91){if(_0x5efe91){return _0x5efe91[_0x4cd6('0x26')]()[_0x4cd6('0x25')](function(){var _0x513d75=_0x5efe91['get']({'plain':!![]});var _0x490f57=_0x4cd6('0x27');return db[_0x4cd6('0x28')][_0x4cd6('0x26')]({'where':{'type':_0x490f57,'resourceId':_0x513d75['id']}})[_0x4cd6('0x25')](function(){return _0x5efe91;});})[_0x4cd6('0x25')](function(){_0xf8bed1['status'](0xcc)[_0x4cd6('0x19')]();});}};}function handleEntityNotFound(_0x190883,_0xe07d80){return function(_0x31538c){if(!_0x31538c){_0x190883[_0x4cd6('0x17')](0x194);}return _0x31538c;};}function handleError(_0x405118,_0x537602){_0x537602=_0x537602||0x1f4;return function(_0x280f98){logger['error'](_0x280f98[_0x4cd6('0x29')]);if(_0x280f98['name']){delete _0x280f98['name'];}_0x405118[_0x4cd6('0x18')](_0x537602)['send'](_0x280f98);};}exports['index']=function(_0x3e914c,_0x2d65c9){var _0x104250={},_0x452df5={},_0x81ae7c={'count':0x0,'rows':[]};var _0x3bcc6a=_[_0x4cd6('0x2a')](db['SquareOdbc'][_0x4cd6('0x2b')],function(_0x11a51b){return{'name':_0x11a51b[_0x4cd6('0x2c')],'type':_0x11a51b['type']['key']};});_0x452df5[_0x4cd6('0x2d')]=_[_0x4cd6('0x2a')](_0x3bcc6a,_0x4cd6('0x2e'));_0x452df5[_0x4cd6('0x2f')]=_[_0x4cd6('0x30')](_0x3e914c[_0x4cd6('0x2f')]);_0x452df5['filters']=_['intersection'](_0x452df5[_0x4cd6('0x2d')],_0x452df5[_0x4cd6('0x2f')]);_0x104250[_0x4cd6('0x31')]=_[_0x4cd6('0x32')](_0x452df5[_0x4cd6('0x2d')],qs['fields'](_0x3e914c[_0x4cd6('0x2f')][_0x4cd6('0x33')]));_0x104250[_0x4cd6('0x31')]=_0x104250[_0x4cd6('0x31')][_0x4cd6('0x34')]?_0x104250[_0x4cd6('0x31')]:_0x452df5[_0x4cd6('0x2d')];if(!_0x3e914c[_0x4cd6('0x2f')][_0x4cd6('0x35')](_0x4cd6('0x36'))){_0x104250[_0x4cd6('0x1c')]=qs[_0x4cd6('0x1c')](_0x3e914c['query'][_0x4cd6('0x1c')]);_0x104250[_0x4cd6('0x1e')]=qs[_0x4cd6('0x1e')](_0x3e914c['query'][_0x4cd6('0x1e')]);}_0x104250['order']=qs[_0x4cd6('0x37')](_0x3e914c[_0x4cd6('0x2f')][_0x4cd6('0x37')]);_0x104250[_0x4cd6('0x38')]=qs[_0x4cd6('0x39')](_[_0x4cd6('0x3a')](_0x3e914c[_0x4cd6('0x2f')],_0x452df5['filters']),_0x3bcc6a);if(_0x3e914c[_0x4cd6('0x2f')][_0x4cd6('0x3b')]){_0x104250[_0x4cd6('0x38')]=_['merge'](_0x104250[_0x4cd6('0x38')],{'$or':_[_0x4cd6('0x2a')](_0x3bcc6a,function(_0x584385){if(_0x584385[_0x4cd6('0x3c')]!==_0x4cd6('0x3d')){var _0x496a29={};_0x496a29[_0x584385[_0x4cd6('0x2e')]]={'$like':'%'+_0x3e914c['query']['filter']+'%'};return _0x496a29;}})});}_0x104250=_[_0x4cd6('0x3e')]({},_0x104250,_0x3e914c[_0x4cd6('0x3f')]);var _0x2315a6={'where':_0x104250[_0x4cd6('0x38')]};return db[_0x4cd6('0x40')]['count'](_0x2315a6)[_0x4cd6('0x25')](function(_0x1c1aae){_0x81ae7c[_0x4cd6('0x1d')]=_0x1c1aae;if(_0x3e914c[_0x4cd6('0x2f')][_0x4cd6('0x41')]){_0x104250['include']=[{'all':!![]}];}return db[_0x4cd6('0x40')][_0x4cd6('0x42')](_0x104250);})[_0x4cd6('0x25')](function(_0x357a43){_0x81ae7c[_0x4cd6('0x43')]=_0x357a43;return _0x81ae7c;})[_0x4cd6('0x25')](respondWithFilteredResult(_0x2d65c9,_0x104250))[_0x4cd6('0x44')](handleError(_0x2d65c9,null));};exports[_0x4cd6('0x45')]=function(_0x116a7c,_0x598b6a){var _0x3bab7e={'raw':!![],'where':{'id':_0x116a7c[_0x4cd6('0x46')]['id']}},_0x830b94={};_0x830b94['model']=_[_0x4cd6('0x30')](db[_0x4cd6('0x40')][_0x4cd6('0x2b')]);_0x830b94['query']=_['keys'](_0x116a7c['query']);_0x830b94['filters']=_['intersection'](_0x830b94['model'],_0x830b94['query']);_0x3bab7e[_0x4cd6('0x31')]=_[_0x4cd6('0x32')](_0x830b94[_0x4cd6('0x2d')],qs[_0x4cd6('0x33')](_0x116a7c[_0x4cd6('0x2f')][_0x4cd6('0x33')]));_0x3bab7e['attributes']=_0x3bab7e[_0x4cd6('0x31')][_0x4cd6('0x34')]?_0x3bab7e['attributes']:_0x830b94[_0x4cd6('0x2d')];if(_0x116a7c[_0x4cd6('0x2f')]['includeAll']){_0x3bab7e['include']=[{'all':!![]}];}_0x3bab7e=_[_0x4cd6('0x3e')]({},_0x3bab7e,_0x116a7c[_0x4cd6('0x3f')]);return db[_0x4cd6('0x40')][_0x4cd6('0x47')](_0x3bab7e)['then'](handleEntityNotFound(_0x598b6a,null))[_0x4cd6('0x25')](respondWithResult(_0x598b6a,null))[_0x4cd6('0x44')](handleError(_0x598b6a,null));};exports[_0x4cd6('0x48')]=function(_0x540ff1,_0x37f078){return db[_0x4cd6('0x40')][_0x4cd6('0x48')](_0x540ff1[_0x4cd6('0x49')],{})[_0x4cd6('0x25')](function(_0xf0fa1b){var _0x943629=_0x540ff1[_0x4cd6('0x4a')]['get']({'plain':!![]});if(!_0x943629)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x943629[_0x4cd6('0x4b')]===_0x4cd6('0x4a')){var _0x561122=_0xf0fa1b[_0x4cd6('0x4c')]({'plain':!![]});var _0x1979c7=_0x4cd6('0x27');return db[_0x4cd6('0x4d')][_0x4cd6('0x47')]({'where':{'name':_0x1979c7,'userProfileId':_0x943629[_0x4cd6('0x4e')]},'raw':!![]})[_0x4cd6('0x25')](function(_0xe9fcc8){if(_0xe9fcc8&&_0xe9fcc8[_0x4cd6('0x4f')]===0x0){return db['UserProfileResource'][_0x4cd6('0x48')]({'name':_0x561122[_0x4cd6('0x2e')],'resourceId':_0x561122['id'],'type':_0xe9fcc8[_0x4cd6('0x2e')],'sectionId':_0xe9fcc8['id']},{})[_0x4cd6('0x25')](function(){return _0xf0fa1b;});}else{return _0xf0fa1b;}})[_0x4cd6('0x44')](function(_0x42b81b){logger[_0x4cd6('0x50')](_0x4cd6('0x51'),_0x42b81b);throw _0x42b81b;});}return _0xf0fa1b;})['then'](respondWithResult(_0x37f078,0xc9))[_0x4cd6('0x44')](handleError(_0x37f078,null));};exports[_0x4cd6('0x24')]=function(_0x5e5ccd,_0x3f5705){if(_0x5e5ccd[_0x4cd6('0x49')]['id']){delete _0x5e5ccd[_0x4cd6('0x49')]['id'];}return db['SquareOdbc'][_0x4cd6('0x47')]({'where':{'id':_0x5e5ccd[_0x4cd6('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f5705,null))['then'](saveUpdates(_0x5e5ccd['body'],null))[_0x4cd6('0x25')](respondWithResult(_0x3f5705,null))['catch'](handleError(_0x3f5705,null));};exports[_0x4cd6('0x26')]=function(_0x699a84,_0x5f03d8){return db[_0x4cd6('0x40')]['find']({'where':{'id':_0x699a84[_0x4cd6('0x46')]['id']}})[_0x4cd6('0x25')](handleEntityNotFound(_0x5f03d8,null))['then'](removeEntity(_0x5f03d8,null))[_0x4cd6('0x44')](handleError(_0x5f03d8,null));};exports[_0x4cd6('0x52')]=function(_0x35d381,_0x1f0545,_0x475624){var _0x4be2b2;return db[_0x4cd6('0x40')][_0x4cd6('0x47')]({'where':{'id':_0x35d381[_0x4cd6('0x46')]['id']},'attributes':['id',_0x4cd6('0x53')]})[_0x4cd6('0x25')](handleEntityNotFound(_0x1f0545,null))[_0x4cd6('0x25')](function(_0x3187da){if(_0x3187da){var _0x549833=require(_0x4cd6('0x54'))();_0x549833[_0x4cd6('0x55')](_0x3187da[_0x4cd6('0x53')]);_0x549833[_0x4cd6('0x56')]();return _0x3187da;}})['then'](respondWithResult(_0x1f0545,null))[_0x4cd6('0x44')](handleError(_0x1f0545,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 1d78b6a..1d257da 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 _0xf0e6=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','square_odbc','util'];(function(_0x5c8505,_0x241de6){var _0x121270=function(_0x3b0c95){while(--_0x3b0c95){_0x5c8505['push'](_0x5c8505['shift']());}};_0x121270(++_0x241de6);}(_0xf0e6,0x95));var _0x6f0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf0e6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6f0e('0x0'));var logger=require(_0x6f0e('0x1'))(_0x6f0e('0x2'));var moment=require(_0x6f0e('0x3'));var BPromise=require(_0x6f0e('0x4'));var rp=require(_0x6f0e('0x5'));var fs=require('fs');var path=require(_0x6f0e('0x6'));var rimraf=require('rimraf');var config=require(_0x6f0e('0x7'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x4b8770,_0x45c0ce){return _0x4b8770[_0x6f0e('0x8')]('SquareOdbc',attributes,{'tableName':_0x6f0e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2ed=['bluebird','request-promise','path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe2ed,0x95));var _0xde2e=function(_0x12d8c5,_0x4348be){_0x12d8c5=_0x12d8c5-0x0;var _0x2f6686=_0xe2ed[_0x12d8c5];return _0x2f6686;};'use strict';var _=require(_0xde2e('0x0'));var util=require(_0xde2e('0x1'));var logger=require(_0xde2e('0x2'))(_0xde2e('0x3'));var moment=require(_0xde2e('0x4'));var BPromise=require(_0xde2e('0x5'));var rp=require(_0xde2e('0x6'));var fs=require('fs');var path=require(_0xde2e('0x7'));var rimraf=require(_0xde2e('0x8'));var config=require('../../config/environment');var attributes=require(_0xde2e('0x9'));module[_0xde2e('0xa')]=function(_0x4404ff,_0x1c3cd6){return _0x4404ff[_0xde2e('0xb')](_0xde2e('0xc'),attributes,{'tableName':_0xde2e('0xd'),'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 3e868fc..1e35b35 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 _0xe1a5=['error','code','message','result','catch','SquareOdbc','find','options','raw','attributes','map','include','model','ShowSquareOdbc','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x2b6f49,_0x3f5a45){var _0x26d444=function(_0x3c9bc9){while(--_0x3c9bc9){_0x2b6f49['push'](_0x2b6f49['shift']());}};_0x26d444(++_0x3f5a45);}(_0xe1a5,0x93));var _0x5e1a=function(_0x201c97,_0x117a05){_0x201c97=_0x201c97-0x0;var _0x191946=_0xe1a5[_0x201c97];return _0x191946;};'use strict';var _=require(_0x5e1a('0x0'));var util=require(_0x5e1a('0x1'));var moment=require(_0x5e1a('0x2'));var BPromise=require(_0x5e1a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e1a('0x4'));var db=require(_0x5e1a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e1a('0x6'))(_0x5e1a('0x7'));var config=require('../../config/environment');var jayson=require(_0x5e1a('0x8'));var client=jayson[_0x5e1a('0x9')][_0x5e1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39c340,_0x366ef1,_0x3d9a0b){return new BPromise(function(_0x3c7f88,_0x5310d2){return client[_0x5e1a('0xb')](_0x39c340,_0x3d9a0b)[_0x5e1a('0xc')](function(_0x4282f9){logger[_0x5e1a('0xd')](_0x5e1a('0xe'),_0x366ef1,_0x5e1a('0xf'));logger[_0x5e1a('0x10')](_0x5e1a('0x11'),_0x366ef1,_0x5e1a('0xf'),JSON['stringify'](_0x4282f9));if(_0x4282f9[_0x5e1a('0x12')]){if(_0x4282f9[_0x5e1a('0x12')][_0x5e1a('0x13')]===0x1f4){logger[_0x5e1a('0x12')](_0x5e1a('0xe'),_0x366ef1,_0x4282f9[_0x5e1a('0x12')][_0x5e1a('0x14')]);return _0x5310d2(_0x4282f9[_0x5e1a('0x12')][_0x5e1a('0x14')]);}logger[_0x5e1a('0x12')](_0x5e1a('0xe'),_0x366ef1,_0x4282f9[_0x5e1a('0x12')][_0x5e1a('0x14')]);return _0x3c7f88(_0x4282f9[_0x5e1a('0x12')][_0x5e1a('0x14')]);}else{logger[_0x5e1a('0xd')](_0x5e1a('0xe'),_0x366ef1,_0x5e1a('0xf'));_0x3c7f88(_0x4282f9[_0x5e1a('0x15')][_0x5e1a('0x14')]);}})[_0x5e1a('0x16')](function(_0x12cc0d){logger[_0x5e1a('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x366ef1,_0x12cc0d);_0x5310d2(_0x12cc0d);});});}exports['ShowSquareOdbc']=function(_0x47ec00){var _0x25f867=this;return new Promise(function(_0x3b021d,_0x1ad36e){return db[_0x5e1a('0x17')][_0x5e1a('0x18')]({'raw':_0x47ec00[_0x5e1a('0x19')]?_0x47ec00[_0x5e1a('0x19')][_0x5e1a('0x1a')]===undefined?!![]:![]:!![],'where':_0x47ec00[_0x5e1a('0x19')]?_0x47ec00['options']['where']||null:null,'attributes':_0x47ec00[_0x5e1a('0x19')]?_0x47ec00[_0x5e1a('0x19')][_0x5e1a('0x1b')]||null:null,'include':_0x47ec00[_0x5e1a('0x19')]?_0x47ec00[_0x5e1a('0x19')]['include']?_[_0x5e1a('0x1c')](_0x47ec00[_0x5e1a('0x19')][_0x5e1a('0x1d')],function(_0x24da10){return{'model':db[_0x24da10[_0x5e1a('0x1e')]],'as':_0x24da10['as'],'attributes':_0x24da10[_0x5e1a('0x1b')],'include':_0x24da10[_0x5e1a('0x1d')]?_[_0x5e1a('0x1c')](_0x24da10[_0x5e1a('0x1d')],function(_0x2e896a){return{'model':db[_0x2e896a[_0x5e1a('0x1e')]],'as':_0x2e896a['as'],'attributes':_0x2e896a['attributes'],'include':_0x2e896a[_0x5e1a('0x1d')]?_[_0x5e1a('0x1c')](_0x2e896a[_0x5e1a('0x1d')],function(_0xb22efb){return{'model':db[_0xb22efb[_0x5e1a('0x1e')]],'as':_0xb22efb['as'],'attributes':_0xb22efb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1decce){logger[_0x5e1a('0xd')](_0x5e1a('0x1f'),_0x47ec00);logger[_0x5e1a('0x10')]('ShowSquareOdbc',_0x47ec00,JSON[_0x5e1a('0x20')](_0x1decce));_0x3b021d(_0x1decce);})['catch'](function(_0x56afa4){logger[_0x5e1a('0x12')](_0x5e1a('0x1f'),_0x56afa4[_0x5e1a('0x14')],_0x47ec00);_0x1ad36e(_0x25f867['error'](0x1f4,_0x56afa4[_0x5e1a('0x14')]));});});}; \ No newline at end of file +var _0xead0=['debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','map','model','attributes','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','SquareOdbc,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xead0,0x8b));var _0x0ead=function(_0x2a75cd,_0x247962){_0x2a75cd=_0x2a75cd-0x0;var _0x2319bc=_0xead0[_0x2a75cd];return _0x2319bc;};'use strict';var _=require(_0x0ead('0x0'));var util=require(_0x0ead('0x1'));var moment=require(_0x0ead('0x2'));var BPromise=require(_0x0ead('0x3'));var rs=require(_0x0ead('0x4'));var fs=require('fs');var Redis=require(_0x0ead('0x5'));var db=require(_0x0ead('0x6'))['db'];var utils=require(_0x0ead('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0ead('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0ead('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e3894,_0x4edc7b,_0x13678){return new BPromise(function(_0x47ce32,_0x4e5484){return client['request'](_0x4e3894,_0x13678)['then'](function(_0x2353fb){logger['info'](_0x0ead('0xa'),_0x4edc7b,'request\x20sent');logger[_0x0ead('0xb')](_0x0ead('0xc'),_0x4edc7b,'request\x20sent',JSON[_0x0ead('0xd')](_0x2353fb));if(_0x2353fb[_0x0ead('0xe')]){if(_0x2353fb[_0x0ead('0xe')][_0x0ead('0xf')]===0x1f4){logger[_0x0ead('0xe')](_0x0ead('0xa'),_0x4edc7b,_0x2353fb[_0x0ead('0xe')][_0x0ead('0x10')]);return _0x4e5484(_0x2353fb[_0x0ead('0xe')][_0x0ead('0x10')]);}logger[_0x0ead('0xe')](_0x0ead('0xa'),_0x4edc7b,_0x2353fb[_0x0ead('0xe')]['message']);return _0x47ce32(_0x2353fb[_0x0ead('0xe')][_0x0ead('0x10')]);}else{logger['info'](_0x0ead('0xa'),_0x4edc7b,_0x0ead('0x11'));_0x47ce32(_0x2353fb['result'][_0x0ead('0x10')]);}})[_0x0ead('0x12')](function(_0x54b945){logger[_0x0ead('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x4edc7b,_0x54b945);_0x4e5484(_0x54b945);});});}exports[_0x0ead('0x13')]=function(_0x279b72){var _0x4fab1e=this;return new Promise(function(_0x393594,_0x516be7){return db[_0x0ead('0x14')][_0x0ead('0x15')]({'raw':_0x279b72[_0x0ead('0x16')]?_0x279b72[_0x0ead('0x16')][_0x0ead('0x17')]===undefined?!![]:![]:!![],'where':_0x279b72[_0x0ead('0x16')]?_0x279b72[_0x0ead('0x16')][_0x0ead('0x18')]||null:null,'attributes':_0x279b72[_0x0ead('0x16')]?_0x279b72[_0x0ead('0x16')]['attributes']||null:null,'include':_0x279b72[_0x0ead('0x16')]?_0x279b72[_0x0ead('0x16')][_0x0ead('0x19')]?_[_0x0ead('0x1a')](_0x279b72[_0x0ead('0x16')]['include'],function(_0x11192d){return{'model':db[_0x11192d[_0x0ead('0x1b')]],'as':_0x11192d['as'],'attributes':_0x11192d[_0x0ead('0x1c')],'include':_0x11192d[_0x0ead('0x19')]?_[_0x0ead('0x1a')](_0x11192d['include'],function(_0x3cc8df){return{'model':db[_0x3cc8df['model']],'as':_0x3cc8df['as'],'attributes':_0x3cc8df[_0x0ead('0x1c')],'include':_0x3cc8df['include']?_[_0x0ead('0x1a')](_0x3cc8df[_0x0ead('0x19')],function(_0x2b8a65){return{'model':db[_0x2b8a65[_0x0ead('0x1b')]],'as':_0x2b8a65['as'],'attributes':_0x2b8a65['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x471fed){logger[_0x0ead('0x1d')]('ShowSquareOdbc',_0x279b72);logger['debug']('ShowSquareOdbc',_0x279b72,JSON['stringify'](_0x471fed));_0x393594(_0x471fed);})[_0x0ead('0x12')](function(_0x35dacd){logger['error'](_0x0ead('0x13'),_0x35dacd[_0x0ead('0x10')],_0x279b72);_0x516be7(_0x4fab1e[_0x0ead('0xe')](0x1f4,_0x35dacd[_0x0ead('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index c3725c4..e6a6489 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 _0x416b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','/:id/users','post','create','update','delete','destroy','removeUsers','exports','multer','util','express','fs-extra'];(function(_0xa19e00,_0x224bbd){var _0xa111a1=function(_0x33daa0){while(--_0x33daa0){_0xa19e00['push'](_0xa19e00['shift']());}};_0xa111a1(++_0x224bbd);}(_0x416b,0x1c8));var _0xb416=function(_0x449a38,_0x3f8271){_0x449a38=_0x449a38-0x0;var _0x38a415=_0x416b[_0x449a38];return _0x38a415;};'use strict';var multer=require(_0xb416('0x0'));var util=require(_0xb416('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb416('0x2'));var router=express['Router']();var fs_extra=require(_0xb416('0x3'));var auth=require(_0xb416('0x4'));var interaction=require(_0xb416('0x5'));var config=require(_0xb416('0x6'));var controller=require(_0xb416('0x7'));router[_0xb416('0x8')]('/',auth[_0xb416('0x9')](),controller[_0xb416('0xa')]);router[_0xb416('0x8')](_0xb416('0xb'),auth[_0xb416('0x9')](),controller['show']);router[_0xb416('0x8')](_0xb416('0xc'),auth[_0xb416('0x9')](),controller['getUsers']);router[_0xb416('0xd')]('/',auth[_0xb416('0x9')](),controller[_0xb416('0xe')]);router[_0xb416('0xd')](_0xb416('0xc'),auth['isAuthenticated'](),controller['addUsers']);router['put'](_0xb416('0xb'),auth[_0xb416('0x9')](),controller[_0xb416('0xf')]);router[_0xb416('0x10')]('/:id',auth[_0xb416('0x9')](),controller[_0xb416('0x11')]);router['delete'](_0xb416('0xc'),auth['isAuthenticated'](),controller[_0xb416('0x12')]);module[_0xb416('0x13')]=router; \ No newline at end of file +var _0x4628=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id/users','post','create','put','/:id','update','destroy','delete','removeUsers'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x4628,0xd3));var _0x8462=function(_0xb5def4,_0x2665a1){_0xb5def4=_0xb5def4-0x0;var _0x260548=_0x4628[_0xb5def4];return _0x260548;};'use strict';var multer=require(_0x8462('0x0'));var util=require(_0x8462('0x1'));var path=require('path');var timeout=require(_0x8462('0x2'));var express=require(_0x8462('0x3'));var router=express[_0x8462('0x4')]();var fs_extra=require(_0x8462('0x5'));var auth=require(_0x8462('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8462('0x7'));var controller=require(_0x8462('0x8'));router[_0x8462('0x9')]('/',auth[_0x8462('0xa')](),controller['index']);router[_0x8462('0x9')]('/:id',auth[_0x8462('0xa')](),controller['show']);router[_0x8462('0x9')](_0x8462('0xb'),auth['isAuthenticated'](),controller['getUsers']);router[_0x8462('0xc')]('/',auth[_0x8462('0xa')](),controller[_0x8462('0xd')]);router[_0x8462('0xc')](_0x8462('0xb'),auth[_0x8462('0xa')](),controller['addUsers']);router[_0x8462('0xe')](_0x8462('0xf'),auth['isAuthenticated'](),controller[_0x8462('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8462('0x11')]);router[_0x8462('0x12')](_0x8462('0xb'),auth['isAuthenticated'](),controller[_0x8462('0x13')]);module[_0x8462('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 1b54c23..42ed0cb 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 _0xc2ec=['long','getDataValue','preproduction','toString','utf8','production','DATE','exports','STRING','name','TEXT','BLOB'];(function(_0x2e1952,_0x567598){var _0x3788eb=function(_0xebd732){while(--_0xebd732){_0x2e1952['push'](_0x2e1952['shift']());}};_0x3788eb(++_0x567598);}(_0xc2ec,0x13f));var _0xcc2e=function(_0x4f24f8,_0x493dd0){_0x4f24f8=_0x4f24f8-0x0;var _0x2cc440=_0xc2ec[_0x4f24f8];return _0x2cc440;};'use strict';var Sequelize=require('sequelize');module[_0xcc2e('0x0')]={'name':{'type':Sequelize[_0xcc2e('0x1')],'unique':_0xcc2e('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xcc2e('0x1')]},'notes':{'type':Sequelize[_0xcc2e('0x3')]},'preproduction':{'type':Sequelize[_0xcc2e('0x4')](_0xcc2e('0x5')),'get':function(){if(this[_0xcc2e('0x6')]('preproduction')){return this['getDataValue'](_0xcc2e('0x7'))[_0xcc2e('0x8')](_0xcc2e('0x9'));}}},'production':{'type':Sequelize[_0xcc2e('0x4')](_0xcc2e('0x5')),'get':function(){if(this[_0xcc2e('0x6')](_0xcc2e('0xa'))){return this['getDataValue'](_0xcc2e('0xa'))[_0xcc2e('0x8')](_0xcc2e('0x9'));}}},'savedAt':{'type':Sequelize[_0xcc2e('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xf628=['name','long','getDataValue','preproduction','utf8','production','toString','sequelize','exports','STRING'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0xf628,0x7f));var _0x8f62=function(_0x1d5370,_0x57be7e){_0x1d5370=_0x1d5370-0x0;var _0x7fbccb=_0xf628[_0x1d5370];return _0x7fbccb;};'use strict';var Sequelize=require(_0x8f62('0x0'));module[_0x8f62('0x1')]={'name':{'type':Sequelize[_0x8f62('0x2')],'unique':_0x8f62('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x8f62('0x4')),'get':function(){if(this[_0x8f62('0x5')](_0x8f62('0x6'))){return this[_0x8f62('0x5')](_0x8f62('0x6'))['toString'](_0x8f62('0x7'));}}},'production':{'type':Sequelize['BLOB'](_0x8f62('0x4')),'get':function(){if(this[_0x8f62('0x5')]('production')){return this[_0x8f62('0x5')](_0x8f62('0x8'))[_0x8f62('0x9')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 70e57e1..9f4318c 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 _0x4e7a=['zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','SquareProject','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','params','addUsers','ids','omit','removeUsers','length','emit','userSquareProject:remove','getUsers','findOne','nolimit','eml-format','rimraf'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0x4e7a,0x1d9));var _0xa4e7=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0x4e7a[_0x3861f7];return _0x50879f;};'use strict';var emlformat=require(_0xa4e7('0x0'));var rimraf=require(_0xa4e7('0x1'));var zipdir=require(_0xa4e7('0x2'));var jsonpatch=require(_0xa4e7('0x3'));var rp=require('request-promise');var moment=require(_0xa4e7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa4e7('0x5'));var util=require(_0xa4e7('0x6'));var path=require('path');var sox=require(_0xa4e7('0x7'));var csv=require(_0xa4e7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa4e7('0x9'));var squel=require(_0xa4e7('0xa'));var crypto=require(_0xa4e7('0xb'));var jsforce=require(_0xa4e7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa4e7('0x8'));var querystring=require(_0xa4e7('0xd'));var Papa=require('papaparse');var Redis=require(_0xa4e7('0xe'));var authService=require(_0xa4e7('0xf'));var qs=require(_0xa4e7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa4e7('0x11'));var logger=require('../../config/logger')(_0xa4e7('0x12'));var utils=require(_0xa4e7('0x13'));var config=require(_0xa4e7('0x14'));var licenseUtil=require(_0xa4e7('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xa4e7('0x16')],{'host':_0xa4e7('0x17'),'port':0x18eb});var socket=require(_0xa4e7('0x18'))(new Redis(config[_0xa4e7('0x16')]));require('./squareProject.socket')[_0xa4e7('0x19')](socket);function respondWithStatusCode(_0xcf9bc1,_0x2a8b96){_0x2a8b96=_0x2a8b96||0xcc;return function(_0x34246f){if(_0x34246f){return _0xcf9bc1['sendStatus'](_0x2a8b96);}return _0xcf9bc1['status'](_0x2a8b96)['end']();};}function respondWithResult(_0x1e045b,_0x983648){_0x983648=_0x983648||0xc8;return function(_0xc82956){if(_0xc82956){return _0x1e045b[_0xa4e7('0x1a')](_0x983648)[_0xa4e7('0x1b')](_0xc82956);}};}function respondWithFilteredResult(_0x1ac923,_0xc2e6c){return function(_0x149d84){if(_0x149d84){var _0x46e9cb=typeof _0xc2e6c[_0xa4e7('0x1c')]===_0xa4e7('0x1d')&&typeof _0xc2e6c[_0xa4e7('0x1e')]===_0xa4e7('0x1d');var _0x43e9ae=_0x149d84[_0xa4e7('0x1f')];var _0x45cb4=_0x46e9cb?0x0:_0xc2e6c[_0xa4e7('0x1c')];var _0x2adbf4=_0x46e9cb?_0x149d84[_0xa4e7('0x1f')]:_0xc2e6c['offset']+_0xc2e6c[_0xa4e7('0x1e')];var _0x183080;if(_0x2adbf4>=_0x43e9ae){_0x2adbf4=_0x43e9ae;_0x183080=0xc8;}else{_0x183080=0xce;}_0x1ac923[_0xa4e7('0x1a')](_0x183080);return _0x1ac923[_0xa4e7('0x20')](_0xa4e7('0x21'),_0x45cb4+'-'+_0x2adbf4+'/'+_0x43e9ae)[_0xa4e7('0x1b')](_0x149d84);}return null;};}function patchUpdates(_0x5d3bb3){return function(_0x4dc073){try{jsonpatch['apply'](_0x4dc073,_0x5d3bb3,!![]);}catch(_0x465711){return BPromise[_0xa4e7('0x22')](_0x465711);}return _0x4dc073[_0xa4e7('0x23')]();};}function saveUpdates(_0x4f0dc8,_0x2513f3){return function(_0x54d16f){if(_0x54d16f){return _0x54d16f[_0xa4e7('0x24')](_0x4f0dc8)[_0xa4e7('0x25')](function(_0x144815){return _0x144815;});}return null;};}function removeEntity(_0x97bf7f,_0x264912){return function(_0x5edde3){if(_0x5edde3){return _0x5edde3['destroy']()[_0xa4e7('0x25')](function(){var _0x3e9fdd=_0x5edde3[_0xa4e7('0x26')]({'plain':!![]});var _0x33cc62='SquareProjects';return db[_0xa4e7('0x27')][_0xa4e7('0x28')]({'where':{'type':_0x33cc62,'resourceId':_0x3e9fdd['id']}})['then'](function(){return _0x5edde3;});})[_0xa4e7('0x25')](function(){_0x97bf7f[_0xa4e7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x555eb0,_0x40390e){return function(_0x1853d1){if(!_0x1853d1){_0x555eb0[_0xa4e7('0x29')](0x194);}return _0x1853d1;};}function handleError(_0x19f874,_0x4ddb02){_0x4ddb02=_0x4ddb02||0x1f4;return function(_0x3d66d4){logger[_0xa4e7('0x2a')](_0x3d66d4[_0xa4e7('0x2b')]);if(_0x3d66d4[_0xa4e7('0x2c')]){delete _0x3d66d4['name'];}_0x19f874[_0xa4e7('0x1a')](_0x4ddb02)[_0xa4e7('0x2d')](_0x3d66d4);};}exports[_0xa4e7('0x2e')]=function(_0x3b0abf,_0x1fce49){var _0x28e2f6={},_0x12ea1a={},_0x44a8cc={'count':0x0,'rows':[]};var _0x2f6342=_[_0xa4e7('0x2f')](db[_0xa4e7('0x30')]['rawAttributes'],function(_0x2ba211){return{'name':_0x2ba211[_0xa4e7('0x31')],'type':_0x2ba211[_0xa4e7('0x32')][_0xa4e7('0x33')]};});_0x12ea1a[_0xa4e7('0x34')]=_[_0xa4e7('0x2f')](_0x2f6342,_0xa4e7('0x2c'));_0x12ea1a[_0xa4e7('0x35')]=_[_0xa4e7('0x36')](_0x3b0abf[_0xa4e7('0x35')]);_0x12ea1a[_0xa4e7('0x37')]=_['intersection'](_0x12ea1a[_0xa4e7('0x34')],_0x12ea1a['query']);_0x28e2f6[_0xa4e7('0x38')]=_[_0xa4e7('0x39')](_0x12ea1a[_0xa4e7('0x34')],qs[_0xa4e7('0x3a')](_0x3b0abf['query']['fields']));_0x28e2f6[_0xa4e7('0x38')]=_0x28e2f6[_0xa4e7('0x38')]['length']?_0x28e2f6[_0xa4e7('0x38')]:_0x12ea1a[_0xa4e7('0x34')];if(!_0x3b0abf['query'][_0xa4e7('0x3b')]('nolimit')){_0x28e2f6[_0xa4e7('0x1e')]=qs[_0xa4e7('0x1e')](_0x3b0abf[_0xa4e7('0x35')][_0xa4e7('0x1e')]);_0x28e2f6[_0xa4e7('0x1c')]=qs[_0xa4e7('0x1c')](_0x3b0abf[_0xa4e7('0x35')][_0xa4e7('0x1c')]);}_0x28e2f6[_0xa4e7('0x3c')]=qs['sort'](_0x3b0abf[_0xa4e7('0x35')][_0xa4e7('0x3d')]);_0x28e2f6[_0xa4e7('0x3e')]=qs[_0xa4e7('0x37')](_[_0xa4e7('0x3f')](_0x3b0abf['query'],_0x12ea1a[_0xa4e7('0x37')]),_0x2f6342);if(_0x3b0abf[_0xa4e7('0x35')]['filter']){_0x28e2f6[_0xa4e7('0x3e')]=_[_0xa4e7('0x40')](_0x28e2f6['where'],{'$or':_[_0xa4e7('0x2f')](_0x2f6342,function(_0x35527e){if(_0x35527e[_0xa4e7('0x32')]!==_0xa4e7('0x41')){var _0x18e7c5={};_0x18e7c5[_0x35527e['name']]={'$like':'%'+_0x3b0abf[_0xa4e7('0x35')][_0xa4e7('0x42')]+'%'};return _0x18e7c5;}})});}_0x28e2f6=_[_0xa4e7('0x40')]({},_0x28e2f6,_0x3b0abf[_0xa4e7('0x43')]);var _0x27220d={'where':_0x28e2f6['where']};return db[_0xa4e7('0x30')][_0xa4e7('0x1f')](_0x27220d)['then'](function(_0x51bc10){_0x44a8cc[_0xa4e7('0x1f')]=_0x51bc10;if(_0x3b0abf[_0xa4e7('0x35')][_0xa4e7('0x44')]){_0x28e2f6[_0xa4e7('0x45')]=[{'all':!![]}];}return db[_0xa4e7('0x30')][_0xa4e7('0x46')](_0x28e2f6);})['then'](function(_0x8f49a9){_0x44a8cc[_0xa4e7('0x47')]=_0x8f49a9;return _0x44a8cc;})[_0xa4e7('0x25')](respondWithFilteredResult(_0x1fce49,_0x28e2f6))[_0xa4e7('0x48')](handleError(_0x1fce49,null));};exports[_0xa4e7('0x49')]=function(_0x33cb10,_0x67d5da){var _0x243613={'raw':![],'where':{'id':_0x33cb10['params']['id']}},_0x20b636={};_0x20b636[_0xa4e7('0x34')]=_[_0xa4e7('0x36')](db[_0xa4e7('0x30')][_0xa4e7('0x4a')]);_0x20b636[_0xa4e7('0x35')]=_['keys'](_0x33cb10[_0xa4e7('0x35')]);_0x20b636[_0xa4e7('0x37')]=_[_0xa4e7('0x39')](_0x20b636[_0xa4e7('0x34')],_0x20b636['query']);_0x243613[_0xa4e7('0x38')]=_[_0xa4e7('0x39')](_0x20b636[_0xa4e7('0x34')],qs[_0xa4e7('0x3a')](_0x33cb10[_0xa4e7('0x35')][_0xa4e7('0x3a')]));_0x243613[_0xa4e7('0x38')]=_0x243613[_0xa4e7('0x38')]['length']?_0x243613[_0xa4e7('0x38')]:_0x20b636[_0xa4e7('0x34')];if(_0x33cb10['query'][_0xa4e7('0x44')]){_0x243613['include']=[{'all':!![]}];}_0x243613=_[_0xa4e7('0x40')]({},_0x243613,_0x33cb10[_0xa4e7('0x43')]);return db[_0xa4e7('0x30')][_0xa4e7('0x4b')](_0x243613)[_0xa4e7('0x25')](handleEntityNotFound(_0x67d5da,null))[_0xa4e7('0x25')](respondWithResult(_0x67d5da,null))[_0xa4e7('0x48')](handleError(_0x67d5da,null));};exports[_0xa4e7('0x4c')]=function(_0x5b4b82,_0x5405a6){return db[_0xa4e7('0x30')][_0xa4e7('0x4c')](_0x5b4b82[_0xa4e7('0x4d')],{})[_0xa4e7('0x25')](function(_0x499fb0){var _0x2f82ea=_0x5b4b82[_0xa4e7('0x4e')][_0xa4e7('0x26')]({'plain':!![]});if(!_0x2f82ea)throw new Error(_0xa4e7('0x4f'));if(_0x2f82ea['role']===_0xa4e7('0x4e')){var _0x46afec=_0x499fb0[_0xa4e7('0x26')]({'plain':!![]});var _0x2c879c=_0xa4e7('0x50');return db[_0xa4e7('0x51')]['find']({'where':{'name':_0x2c879c,'userProfileId':_0x2f82ea[_0xa4e7('0x52')]},'raw':!![]})['then'](function(_0x2db7a1){if(_0x2db7a1&&_0x2db7a1[_0xa4e7('0x53')]===0x0){return db['UserProfileResource'][_0xa4e7('0x4c')]({'name':_0x46afec[_0xa4e7('0x2c')],'resourceId':_0x46afec['id'],'type':_0x2db7a1[_0xa4e7('0x2c')],'sectionId':_0x2db7a1['id']},{})[_0xa4e7('0x25')](function(){return _0x499fb0;});}else{return _0x499fb0;}})[_0xa4e7('0x48')](function(_0xc156f0){logger[_0xa4e7('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc156f0);throw _0xc156f0;});}return _0x499fb0;})['then'](respondWithResult(_0x5405a6,0xc9))[_0xa4e7('0x48')](handleError(_0x5405a6,null));};exports['update']=function(_0x29031b,_0x1d7fcf){if(_0x29031b[_0xa4e7('0x4d')]['id']){delete _0x29031b[_0xa4e7('0x4d')]['id'];}return db[_0xa4e7('0x30')][_0xa4e7('0x4b')]({'where':{'id':_0x29031b[_0xa4e7('0x54')]['id']}})[_0xa4e7('0x25')](handleEntityNotFound(_0x1d7fcf,null))[_0xa4e7('0x25')](saveUpdates(_0x29031b[_0xa4e7('0x4d')],null))[_0xa4e7('0x25')](respondWithResult(_0x1d7fcf,null))[_0xa4e7('0x48')](handleError(_0x1d7fcf,null));};exports[_0xa4e7('0x28')]=function(_0x1cc0fc,_0x20d5bf){return db['SquareProject'][_0xa4e7('0x4b')]({'where':{'id':_0x1cc0fc[_0xa4e7('0x54')]['id']}})[_0xa4e7('0x25')](handleEntityNotFound(_0x20d5bf,null))[_0xa4e7('0x25')](removeEntity(_0x20d5bf,null))[_0xa4e7('0x48')](handleError(_0x20d5bf,null));};exports[_0xa4e7('0x55')]=function(_0x337c36,_0x35d0a7,_0x51f69){return db['SquareProject']['find']({'where':{'id':_0x337c36[_0xa4e7('0x54')]['id']}})['then'](handleEntityNotFound(_0x35d0a7,null))[_0xa4e7('0x25')](function(_0x1e88cd){if(_0x1e88cd){return _0x1e88cd[_0xa4e7('0x55')](_0x337c36[_0xa4e7('0x4d')][_0xa4e7('0x56')],_[_0xa4e7('0x57')](_0x337c36[_0xa4e7('0x4d')],[_0xa4e7('0x56'),'id'])||{});}})[_0xa4e7('0x25')](respondWithResult(_0x35d0a7,null))[_0xa4e7('0x48')](handleError(_0x35d0a7,null));};exports[_0xa4e7('0x58')]=function(_0x349986,_0x2873ca,_0x302fe0){return db[_0xa4e7('0x30')][_0xa4e7('0x4b')]({'where':{'id':_0x349986[_0xa4e7('0x54')]['id']}})['then'](handleEntityNotFound(_0x2873ca,null))[_0xa4e7('0x25')](function(_0x140e3b){if(_0x140e3b){return _0x140e3b[_0xa4e7('0x58')](_0x349986['query'][_0xa4e7('0x56')])['then'](function(){if(_['isArray'](_0x349986[_0xa4e7('0x35')][_0xa4e7('0x56')])){for(var _0x439184=0x0;_0x439184<_0x349986[_0xa4e7('0x35')]['ids'][_0xa4e7('0x59')];_0x439184+=0x1){socket[_0xa4e7('0x5a')](_0xa4e7('0x5b'),{'UserId':Number(_0x349986[_0xa4e7('0x35')][_0xa4e7('0x56')][_0x439184]),'SquareProjectId':Number(_0x349986[_0xa4e7('0x54')]['id'])});}}else{socket[_0xa4e7('0x5a')](_0xa4e7('0x5b'),{'UserId':Number(_0x349986[_0xa4e7('0x35')][_0xa4e7('0x56')]),'SquareProjectId':Number(_0x349986['params']['id'])});}});}})[_0xa4e7('0x25')](respondWithStatusCode(_0x2873ca,null))[_0xa4e7('0x48')](handleError(_0x2873ca,null));};exports[_0xa4e7('0x5c')]=function(_0x3ad43f,_0x1ab867,_0x1a9651){var _0x33ea66={};var _0x52145f={};var _0x464e3b;var _0xc17646;return db[_0xa4e7('0x30')][_0xa4e7('0x5d')]({'where':{'id':_0x3ad43f['params']['id']}})[_0xa4e7('0x25')](handleEntityNotFound(_0x1ab867,null))['then'](function(_0x5e75f9){if(_0x5e75f9){_0x464e3b=_0x5e75f9;_0x52145f[_0xa4e7('0x34')]=_['keys'](db['User'][_0xa4e7('0x4a')]);_0x52145f['query']=_[_0xa4e7('0x36')](_0x3ad43f[_0xa4e7('0x35')]);_0x52145f['filters']=_['intersection'](_0x52145f['model'],_0x52145f[_0xa4e7('0x35')]);_0x33ea66[_0xa4e7('0x38')]=_['intersection'](_0x52145f[_0xa4e7('0x34')],qs[_0xa4e7('0x3a')](_0x3ad43f[_0xa4e7('0x35')][_0xa4e7('0x3a')]));_0x33ea66['attributes']=_0x33ea66[_0xa4e7('0x38')][_0xa4e7('0x59')]?_0x33ea66[_0xa4e7('0x38')]:_0x52145f['model'];_0x33ea66[_0xa4e7('0x3c')]=qs[_0xa4e7('0x3d')](_0x3ad43f[_0xa4e7('0x35')][_0xa4e7('0x3d')]);_0x33ea66[_0xa4e7('0x3e')]=qs[_0xa4e7('0x37')](_[_0xa4e7('0x3f')](_0x3ad43f[_0xa4e7('0x35')],_0x52145f[_0xa4e7('0x37')]));if(_0x3ad43f[_0xa4e7('0x35')][_0xa4e7('0x42')]){_0x33ea66[_0xa4e7('0x3e')]=_[_0xa4e7('0x40')](_0x33ea66[_0xa4e7('0x3e')],{'$or':_[_0xa4e7('0x2f')](_0x33ea66[_0xa4e7('0x38')],function(_0x5bd934){var _0x32a5cd={};_0x32a5cd[_0x5bd934]={'$like':'%'+_0x3ad43f['query'][_0xa4e7('0x42')]+'%'};return _0x32a5cd;})});}_0x33ea66=_[_0xa4e7('0x40')]({},_0x33ea66,_0x3ad43f[_0xa4e7('0x43')]);return _0x464e3b[_0xa4e7('0x5c')](_0x33ea66);}})[_0xa4e7('0x25')](function(_0x53d68b){if(_0x53d68b){_0xc17646=_0x53d68b[_0xa4e7('0x59')];if(!_0x3ad43f[_0xa4e7('0x35')][_0xa4e7('0x3b')](_0xa4e7('0x5e'))){_0x33ea66[_0xa4e7('0x1e')]=qs[_0xa4e7('0x1e')](_0x3ad43f['query'][_0xa4e7('0x1e')]);_0x33ea66[_0xa4e7('0x1c')]=qs['offset'](_0x3ad43f[_0xa4e7('0x35')][_0xa4e7('0x1c')]);}return _0x464e3b[_0xa4e7('0x5c')](_0x33ea66);}})[_0xa4e7('0x25')](function(_0x2240ad){if(_0x2240ad){return _0x2240ad?{'count':_0xc17646,'rows':_0x2240ad}:null;}})[_0xa4e7('0x25')](respondWithResult(_0x1ab867,null))[_0xa4e7('0x48')](handleError(_0x1ab867,null));}; \ No newline at end of file +var _0x871f=['get','UserProfileResource','destroy','error','name','map','SquareProject','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SquareProjects','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','findOne','User','nolimit','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then'];(function(_0x59147c,_0x4d55b5){var _0xf30c0e=function(_0x30b737){while(--_0x30b737){_0x59147c['push'](_0x59147c['shift']());}};_0xf30c0e(++_0x4d55b5);}(_0x871f,0x92));var _0xf871=function(_0x9ba445,_0x3c7b78){_0x9ba445=_0x9ba445-0x0;var _0x14c4ad=_0x871f[_0x9ba445];return _0x14c4ad;};'use strict';var emlformat=require(_0xf871('0x0'));var rimraf=require(_0xf871('0x1'));var zipdir=require(_0xf871('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf871('0x3'));var moment=require('moment');var BPromise=require(_0xf871('0x4'));var Mustache=require('mustache');var util=require(_0xf871('0x5'));var path=require(_0xf871('0x6'));var sox=require(_0xf871('0x7'));var csv=require(_0xf871('0x8'));var ejs=require(_0xf871('0x9'));var fs=require('fs');var fs_extra=require(_0xf871('0xa'));var _=require(_0xf871('0xb'));var squel=require(_0xf871('0xc'));var crypto=require(_0xf871('0xd'));var jsforce=require(_0xf871('0xe'));var deskjs=require(_0xf871('0xf'));var toCsv=require(_0xf871('0x8'));var querystring=require(_0xf871('0x10'));var Papa=require(_0xf871('0x11'));var Redis=require('ioredis');var authService=require(_0xf871('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf871('0x13'));var hardwareService=require(_0xf871('0x14'));var logger=require(_0xf871('0x15'))('api');var utils=require(_0xf871('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf871('0x17'));var db=require(_0xf871('0x18'))['db'];config[_0xf871('0x19')]=_[_0xf871('0x1a')](config[_0xf871('0x19')],{'host':_0xf871('0x1b'),'port':0x18eb});var socket=require(_0xf871('0x1c'))(new Redis(config[_0xf871('0x19')]));require(_0xf871('0x1d'))[_0xf871('0x1e')](socket);function respondWithStatusCode(_0x5336e7,_0x851ac5){_0x851ac5=_0x851ac5||0xcc;return function(_0x18afa2){if(_0x18afa2){return _0x5336e7[_0xf871('0x1f')](_0x851ac5);}return _0x5336e7[_0xf871('0x20')](_0x851ac5)[_0xf871('0x21')]();};}function respondWithResult(_0x41b3d5,_0x39a5ef){_0x39a5ef=_0x39a5ef||0xc8;return function(_0x446a61){if(_0x446a61){return _0x41b3d5[_0xf871('0x20')](_0x39a5ef)[_0xf871('0x22')](_0x446a61);}};}function respondWithFilteredResult(_0x7af68c,_0x4005ae){return function(_0x16dc9f){if(_0x16dc9f){var _0x2a991a=typeof _0x4005ae[_0xf871('0x23')]===_0xf871('0x24')&&typeof _0x4005ae[_0xf871('0x25')]===_0xf871('0x24');var _0x34daf9=_0x16dc9f['count'];var _0x3833c0=_0x2a991a?0x0:_0x4005ae[_0xf871('0x23')];var _0x7d50d5=_0x2a991a?_0x16dc9f[_0xf871('0x26')]:_0x4005ae['offset']+_0x4005ae[_0xf871('0x25')];var _0x3968de;if(_0x7d50d5>=_0x34daf9){_0x7d50d5=_0x34daf9;_0x3968de=0xc8;}else{_0x3968de=0xce;}_0x7af68c[_0xf871('0x20')](_0x3968de);return _0x7af68c[_0xf871('0x27')]('Content-Range',_0x3833c0+'-'+_0x7d50d5+'/'+_0x34daf9)[_0xf871('0x22')](_0x16dc9f);}return null;};}function patchUpdates(_0x20adde){return function(_0x5a5d5e){try{jsonpatch[_0xf871('0x28')](_0x5a5d5e,_0x20adde,!![]);}catch(_0x1e9e00){return BPromise[_0xf871('0x29')](_0x1e9e00);}return _0x5a5d5e['save']();};}function saveUpdates(_0x58f9dd,_0x5f29bd){return function(_0x55fa04){if(_0x55fa04){return _0x55fa04[_0xf871('0x2a')](_0x58f9dd)[_0xf871('0x2b')](function(_0x55ba76){return _0x55ba76;});}return null;};}function removeEntity(_0x5100c7,_0xf19bd2){return function(_0x299e10){if(_0x299e10){return _0x299e10['destroy']()[_0xf871('0x2b')](function(){var _0x42c170=_0x299e10[_0xf871('0x2c')]({'plain':!![]});var _0x532f2e='SquareProjects';return db[_0xf871('0x2d')][_0xf871('0x2e')]({'where':{'type':_0x532f2e,'resourceId':_0x42c170['id']}})[_0xf871('0x2b')](function(){return _0x299e10;});})[_0xf871('0x2b')](function(){_0x5100c7['status'](0xcc)[_0xf871('0x21')]();});}};}function handleEntityNotFound(_0x4a0e27,_0x241aeb){return function(_0x388c7b){if(!_0x388c7b){_0x4a0e27[_0xf871('0x1f')](0x194);}return _0x388c7b;};}function handleError(_0x450b8a,_0x278540){_0x278540=_0x278540||0x1f4;return function(_0x38014f){logger[_0xf871('0x2f')](_0x38014f['stack']);if(_0x38014f[_0xf871('0x30')]){delete _0x38014f[_0xf871('0x30')];}_0x450b8a['status'](_0x278540)['send'](_0x38014f);};}exports['index']=function(_0xce446a,_0x631363){var _0x1a35f3={},_0x2437f4={},_0x23aa77={'count':0x0,'rows':[]};var _0x403e76=_[_0xf871('0x31')](db[_0xf871('0x32')][_0xf871('0x33')],function(_0x2365c7){return{'name':_0x2365c7['fieldName'],'type':_0x2365c7['type']['key']};});_0x2437f4[_0xf871('0x34')]=_[_0xf871('0x31')](_0x403e76,_0xf871('0x30'));_0x2437f4[_0xf871('0x35')]=_[_0xf871('0x36')](_0xce446a['query']);_0x2437f4[_0xf871('0x37')]=_['intersection'](_0x2437f4['model'],_0x2437f4['query']);_0x1a35f3[_0xf871('0x38')]=_[_0xf871('0x39')](_0x2437f4[_0xf871('0x34')],qs['fields'](_0xce446a[_0xf871('0x35')][_0xf871('0x3a')]));_0x1a35f3['attributes']=_0x1a35f3[_0xf871('0x38')][_0xf871('0x3b')]?_0x1a35f3['attributes']:_0x2437f4[_0xf871('0x34')];if(!_0xce446a[_0xf871('0x35')][_0xf871('0x3c')]('nolimit')){_0x1a35f3[_0xf871('0x25')]=qs[_0xf871('0x25')](_0xce446a[_0xf871('0x35')][_0xf871('0x25')]);_0x1a35f3['offset']=qs[_0xf871('0x23')](_0xce446a['query'][_0xf871('0x23')]);}_0x1a35f3[_0xf871('0x3d')]=qs[_0xf871('0x3e')](_0xce446a[_0xf871('0x35')][_0xf871('0x3e')]);_0x1a35f3[_0xf871('0x3f')]=qs[_0xf871('0x37')](_[_0xf871('0x40')](_0xce446a[_0xf871('0x35')],_0x2437f4[_0xf871('0x37')]),_0x403e76);if(_0xce446a[_0xf871('0x35')]['filter']){_0x1a35f3['where']=_[_0xf871('0x41')](_0x1a35f3[_0xf871('0x3f')],{'$or':_[_0xf871('0x31')](_0x403e76,function(_0x5a8bde){if(_0x5a8bde[_0xf871('0x42')]!==_0xf871('0x43')){var _0x876c8a={};_0x876c8a[_0x5a8bde[_0xf871('0x30')]]={'$like':'%'+_0xce446a[_0xf871('0x35')][_0xf871('0x44')]+'%'};return _0x876c8a;}})});}_0x1a35f3=_['merge']({},_0x1a35f3,_0xce446a[_0xf871('0x45')]);var _0x205473={'where':_0x1a35f3['where']};return db[_0xf871('0x32')][_0xf871('0x26')](_0x205473)[_0xf871('0x2b')](function(_0x134329){_0x23aa77[_0xf871('0x26')]=_0x134329;if(_0xce446a[_0xf871('0x35')][_0xf871('0x46')]){_0x1a35f3['include']=[{'all':!![]}];}return db[_0xf871('0x32')]['findAll'](_0x1a35f3);})[_0xf871('0x2b')](function(_0x4abb48){_0x23aa77[_0xf871('0x47')]=_0x4abb48;return _0x23aa77;})['then'](respondWithFilteredResult(_0x631363,_0x1a35f3))[_0xf871('0x48')](handleError(_0x631363,null));};exports[_0xf871('0x49')]=function(_0x3ff065,_0x304e89){var _0x540d15={'raw':![],'where':{'id':_0x3ff065[_0xf871('0x4a')]['id']}},_0x598a0a={};_0x598a0a[_0xf871('0x34')]=_[_0xf871('0x36')](db[_0xf871('0x32')][_0xf871('0x33')]);_0x598a0a['query']=_['keys'](_0x3ff065[_0xf871('0x35')]);_0x598a0a[_0xf871('0x37')]=_[_0xf871('0x39')](_0x598a0a[_0xf871('0x34')],_0x598a0a['query']);_0x540d15[_0xf871('0x38')]=_[_0xf871('0x39')](_0x598a0a[_0xf871('0x34')],qs[_0xf871('0x3a')](_0x3ff065[_0xf871('0x35')][_0xf871('0x3a')]));_0x540d15[_0xf871('0x38')]=_0x540d15['attributes']['length']?_0x540d15['attributes']:_0x598a0a[_0xf871('0x34')];if(_0x3ff065[_0xf871('0x35')][_0xf871('0x46')]){_0x540d15[_0xf871('0x4b')]=[{'all':!![]}];}_0x540d15=_[_0xf871('0x41')]({},_0x540d15,_0x3ff065[_0xf871('0x45')]);return db['SquareProject'][_0xf871('0x4c')](_0x540d15)[_0xf871('0x2b')](handleEntityNotFound(_0x304e89,null))[_0xf871('0x2b')](respondWithResult(_0x304e89,null))[_0xf871('0x48')](handleError(_0x304e89,null));};exports['create']=function(_0x39f692,_0x3afa26){return db[_0xf871('0x32')][_0xf871('0x4d')](_0x39f692[_0xf871('0x4e')],{})[_0xf871('0x2b')](function(_0x11d21c){var _0x2d6506=_0x39f692['user']['get']({'plain':!![]});if(!_0x2d6506)throw new Error(_0xf871('0x4f'));if(_0x2d6506[_0xf871('0x50')]===_0xf871('0x51')){var _0x2a4094=_0x11d21c[_0xf871('0x2c')]({'plain':!![]});var _0x5c6725=_0xf871('0x52');return db[_0xf871('0x53')][_0xf871('0x4c')]({'where':{'name':_0x5c6725,'userProfileId':_0x2d6506['userProfileId']},'raw':!![]})[_0xf871('0x2b')](function(_0x1bb21e){if(_0x1bb21e&&_0x1bb21e[_0xf871('0x54')]===0x0){return db['UserProfileResource'][_0xf871('0x4d')]({'name':_0x2a4094['name'],'resourceId':_0x2a4094['id'],'type':_0x1bb21e[_0xf871('0x30')],'sectionId':_0x1bb21e['id']},{})[_0xf871('0x2b')](function(){return _0x11d21c;});}else{return _0x11d21c;}})[_0xf871('0x48')](function(_0x132f80){logger['error'](_0xf871('0x55'),_0x132f80);throw _0x132f80;});}return _0x11d21c;})[_0xf871('0x2b')](respondWithResult(_0x3afa26,0xc9))[_0xf871('0x48')](handleError(_0x3afa26,null));};exports['update']=function(_0x23ea54,_0xa07229){if(_0x23ea54['body']['id']){delete _0x23ea54['body']['id'];}return db['SquareProject'][_0xf871('0x4c')]({'where':{'id':_0x23ea54[_0xf871('0x4a')]['id']}})[_0xf871('0x2b')](handleEntityNotFound(_0xa07229,null))[_0xf871('0x2b')](saveUpdates(_0x23ea54[_0xf871('0x4e')],null))['then'](respondWithResult(_0xa07229,null))[_0xf871('0x48')](handleError(_0xa07229,null));};exports[_0xf871('0x2e')]=function(_0x868c58,_0x156199){return db['SquareProject'][_0xf871('0x4c')]({'where':{'id':_0x868c58[_0xf871('0x4a')]['id']}})[_0xf871('0x2b')](handleEntityNotFound(_0x156199,null))[_0xf871('0x2b')](removeEntity(_0x156199,null))[_0xf871('0x48')](handleError(_0x156199,null));};exports['addUsers']=function(_0x48fb78,_0x1d809a,_0x37642a){return db[_0xf871('0x32')][_0xf871('0x4c')]({'where':{'id':_0x48fb78[_0xf871('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d809a,null))[_0xf871('0x2b')](function(_0x1eca4b){if(_0x1eca4b){return _0x1eca4b['addUsers'](_0x48fb78['body'][_0xf871('0x56')],_[_0xf871('0x57')](_0x48fb78['body'],[_0xf871('0x56'),'id'])||{});}})[_0xf871('0x2b')](respondWithResult(_0x1d809a,null))['catch'](handleError(_0x1d809a,null));};exports[_0xf871('0x58')]=function(_0x10e9e2,_0x190bf1,_0x4de4d0){return db[_0xf871('0x32')]['find']({'where':{'id':_0x10e9e2[_0xf871('0x4a')]['id']}})['then'](handleEntityNotFound(_0x190bf1,null))[_0xf871('0x2b')](function(_0x4d7e43){if(_0x4d7e43){return _0x4d7e43[_0xf871('0x58')](_0x10e9e2[_0xf871('0x35')][_0xf871('0x56')])[_0xf871('0x2b')](function(){if(_['isArray'](_0x10e9e2[_0xf871('0x35')][_0xf871('0x56')])){for(var _0x4a1940=0x0;_0x4a1940<_0x10e9e2[_0xf871('0x35')]['ids']['length'];_0x4a1940+=0x1){socket[_0xf871('0x59')](_0xf871('0x5a'),{'UserId':Number(_0x10e9e2[_0xf871('0x35')][_0xf871('0x56')][_0x4a1940]),'SquareProjectId':Number(_0x10e9e2[_0xf871('0x4a')]['id'])});}}else{socket[_0xf871('0x59')](_0xf871('0x5a'),{'UserId':Number(_0x10e9e2[_0xf871('0x35')][_0xf871('0x56')]),'SquareProjectId':Number(_0x10e9e2['params']['id'])});}});}})[_0xf871('0x2b')](respondWithStatusCode(_0x190bf1,null))[_0xf871('0x48')](handleError(_0x190bf1,null));};exports[_0xf871('0x5b')]=function(_0x4aff2e,_0x72209,_0x24be18){var _0x2ac476={};var _0x35f913={};var _0x419c8f;var _0x51b2eb;return db['SquareProject'][_0xf871('0x5c')]({'where':{'id':_0x4aff2e[_0xf871('0x4a')]['id']}})['then'](handleEntityNotFound(_0x72209,null))[_0xf871('0x2b')](function(_0x1ebb64){if(_0x1ebb64){_0x419c8f=_0x1ebb64;_0x35f913[_0xf871('0x34')]=_['keys'](db[_0xf871('0x5d')][_0xf871('0x33')]);_0x35f913[_0xf871('0x35')]=_[_0xf871('0x36')](_0x4aff2e[_0xf871('0x35')]);_0x35f913[_0xf871('0x37')]=_[_0xf871('0x39')](_0x35f913[_0xf871('0x34')],_0x35f913[_0xf871('0x35')]);_0x2ac476[_0xf871('0x38')]=_['intersection'](_0x35f913[_0xf871('0x34')],qs[_0xf871('0x3a')](_0x4aff2e[_0xf871('0x35')][_0xf871('0x3a')]));_0x2ac476[_0xf871('0x38')]=_0x2ac476['attributes'][_0xf871('0x3b')]?_0x2ac476[_0xf871('0x38')]:_0x35f913[_0xf871('0x34')];_0x2ac476[_0xf871('0x3d')]=qs[_0xf871('0x3e')](_0x4aff2e[_0xf871('0x35')][_0xf871('0x3e')]);_0x2ac476[_0xf871('0x3f')]=qs[_0xf871('0x37')](_[_0xf871('0x40')](_0x4aff2e['query'],_0x35f913['filters']));if(_0x4aff2e[_0xf871('0x35')][_0xf871('0x44')]){_0x2ac476[_0xf871('0x3f')]=_['merge'](_0x2ac476['where'],{'$or':_['map'](_0x2ac476[_0xf871('0x38')],function(_0x4574cf){var _0x59e67e={};_0x59e67e[_0x4574cf]={'$like':'%'+_0x4aff2e['query'][_0xf871('0x44')]+'%'};return _0x59e67e;})});}_0x2ac476=_[_0xf871('0x41')]({},_0x2ac476,_0x4aff2e[_0xf871('0x45')]);return _0x419c8f[_0xf871('0x5b')](_0x2ac476);}})[_0xf871('0x2b')](function(_0xaff788){if(_0xaff788){_0x51b2eb=_0xaff788[_0xf871('0x3b')];if(!_0x4aff2e[_0xf871('0x35')][_0xf871('0x3c')](_0xf871('0x5e'))){_0x2ac476[_0xf871('0x25')]=qs[_0xf871('0x25')](_0x4aff2e[_0xf871('0x35')]['limit']);_0x2ac476['offset']=qs[_0xf871('0x23')](_0x4aff2e[_0xf871('0x35')][_0xf871('0x23')]);}return _0x419c8f[_0xf871('0x5b')](_0x2ac476);}})[_0xf871('0x2b')](function(_0x38d670){if(_0x38d670){return _0x38d670?{'count':_0x51b2eb,'rows':_0x38d670}:null;}})[_0xf871('0x2b')](respondWithResult(_0x72209,null))[_0xf871('0x48')](handleError(_0x72209,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 5f35c89..0a0ca08 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 _0x8772=['../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x238fab,_0x383650){var _0x3dc6ea=function(_0x2ede01){while(--_0x2ede01){_0x238fab['push'](_0x238fab['shift']());}};_0x3dc6ea(++_0x383650);}(_0x8772,0x1af));var _0x2877=function(_0x2009c8,_0x407d34){_0x2009c8=_0x2009c8-0x0;var _0x2560c4=_0x8772[_0x2009c8];return _0x2560c4;};'use strict';var EventEmitter=require(_0x2877('0x0'));var SquareProject=require(_0x2877('0x1'))['db'][_0x2877('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x2877('0x3')](0x0);var events={'afterCreate':_0x2877('0x4'),'afterUpdate':_0x2877('0x5'),'afterDestroy':_0x2877('0x6')};function emitEvent(_0x46508f){return function(_0x51362e,_0x36ca46,_0x8a2189){SquareProjectEvents[_0x2877('0x7')](_0x46508f+':'+_0x51362e['id'],_0x51362e);SquareProjectEvents[_0x2877('0x7')](_0x46508f,_0x51362e);_0x8a2189(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x2877('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xd3e8=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x1c2ae4,_0x17b6ee){var _0x1f2c2f=function(_0x4142c3){while(--_0x4142c3){_0x1c2ae4['push'](_0x1c2ae4['shift']());}};_0x1f2c2f(++_0x17b6ee);}(_0xd3e8,0x1dc));var _0x8d3e=function(_0x3e74f4,_0x3e9c91){_0x3e74f4=_0x3e74f4-0x0;var _0x489758=_0xd3e8[_0x3e74f4];return _0x489758;};'use strict';var EventEmitter=require(_0x8d3e('0x0'));var SquareProject=require(_0x8d3e('0x1'))['db'][_0x8d3e('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8d3e('0x3')](0x0);var events={'afterCreate':_0x8d3e('0x4'),'afterUpdate':_0x8d3e('0x5'),'afterDestroy':_0x8d3e('0x6')};function emitEvent(_0x42c766){return function(_0x3db279,_0x45a2f9,_0x140473){SquareProjectEvents[_0x8d3e('0x7')](_0x42c766+':'+_0x3db279['id'],_0x3db279);SquareProjectEvents['emit'](_0x42c766,_0x3db279);_0x140473(null);};}for(var e in events){if(events[_0x8d3e('0x8')](e)){var event=events[e];SquareProject[_0x8d3e('0x9')](e,emitEvent(event));}}module[_0x8d3e('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index d4be009..3cc3070 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 _0xc5a3=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt'];(function(_0x1a9390,_0x3339e6){var _0x2b4514=function(_0x1c07d5){while(--_0x1c07d5){_0x1a9390['push'](_0x1a9390['shift']());}};_0x2b4514(++_0x3339e6);}(_0xc5a3,0x17a));var _0x3c5a=function(_0x52b695,_0x16b7e6){_0x52b695=_0x52b695-0x0;var _0x2071a2=_0xc5a3[_0x52b695];return _0x2071a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c5a('0x0'))(_0x3c5a('0x1'));var moment=require('moment');var BPromise=require(_0x3c5a('0x2'));var rp=require(_0x3c5a('0x3'));var fs=require('fs');var path=require(_0x3c5a('0x4'));var rimraf=require(_0x3c5a('0x5'));var config=require(_0x3c5a('0x6'));var attributes=require(_0x3c5a('0x7'));module['exports']=function(_0x3a7b2d,_0xff19f4){return _0x3a7b2d[_0x3c5a('0x8')](_0x3c5a('0x9'),attributes,{'tableName':_0x3c5a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x6887d3,_0x36c037,_0x2b607f){if(_0x6887d3['changed'](_0x3c5a('0xb'))){_0x6887d3[_0x3c5a('0xc')]=moment()[_0x3c5a('0xd')](_0x3c5a('0xe'));}if(_0x6887d3[_0x3c5a('0xf')](_0x3c5a('0x10'))){_0x6887d3[_0x3c5a('0x11')]=moment()[_0x3c5a('0xd')](_0x3c5a('0xe'));}_0x2b607f(null,_0x6887d3);}}});}; \ No newline at end of file +var _0x595c=['preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','format','lodash','util','api','bluebird','request-promise','path','rimraf','exports','define','square_projects','changed'];(function(_0x87a722,_0x30ebf1){var _0x5532a7=function(_0x33be9e){while(--_0x33be9e){_0x87a722['push'](_0x87a722['shift']());}};_0x5532a7(++_0x30ebf1);}(_0x595c,0x75));var _0xc595=function(_0x2e2ba,_0x1a6067){_0x2e2ba=_0x2e2ba-0x0;var _0x252d85=_0x595c[_0x2e2ba];return _0x252d85;};'use strict';var _=require(_0xc595('0x0'));var util=require(_0xc595('0x1'));var logger=require('../../config/logger')(_0xc595('0x2'));var moment=require('moment');var BPromise=require(_0xc595('0x3'));var rp=require(_0xc595('0x4'));var fs=require('fs');var path=require(_0xc595('0x5'));var rimraf=require(_0xc595('0x6'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0xc595('0x7')]=function(_0x2c6615,_0x5dfc4c){return _0x2c6615[_0xc595('0x8')]('SquareProject',attributes,{'tableName':_0xc595('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x495fa7,_0x111408,_0x1f5f2c){if(_0x495fa7[_0xc595('0xa')](_0xc595('0xb'))){_0x495fa7[_0xc595('0xc')]=moment()['format'](_0xc595('0xd'));}if(_0x495fa7[_0xc595('0xa')](_0xc595('0xe'))){_0x495fa7['publishedAt']=moment()[_0xc595('0xf')](_0xc595('0xd'));}_0x1f5f2c(null,_0x495fa7);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 09e6e82..8e81ad6 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 _0x008a=['redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','ShowSquareProject','SquareProject','find','options','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x008a,0x143));var _0xa008=function(_0x4d8eba,_0x57fb27){_0x4d8eba=_0x4d8eba-0x0;var _0x4ff749=_0x008a[_0x4d8eba];return _0x4ff749;};'use strict';var _=require('lodash');var util=require(_0xa008('0x0'));var moment=require(_0xa008('0x1'));var BPromise=require(_0xa008('0x2'));var rs=require(_0xa008('0x3'));var fs=require('fs');var Redis=require(_0xa008('0x4'));var db=require(_0xa008('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa008('0x6'))(_0xa008('0x7'));var config=require('../../config/environment');var jayson=require(_0xa008('0x8'));var client=jayson['client'][_0xa008('0x9')]({'port':0x232a});config[_0xa008('0xa')]=_[_0xa008('0xb')](config[_0xa008('0xa')],{'host':_0xa008('0xc'),'port':0x18eb});var socket=require(_0xa008('0xd'))(new Redis(config['redis']));require(_0xa008('0xe'))[_0xa008('0xf')](socket);function respondWithRpcPromise(_0x125963,_0x2c6c69,_0x3828b7){return new BPromise(function(_0x3c14bd,_0x5ea3f2){return client[_0xa008('0x10')](_0x125963,_0x3828b7)[_0xa008('0x11')](function(_0x347b85){logger['info'](_0xa008('0x12'),_0x2c6c69,_0xa008('0x13'));logger[_0xa008('0x14')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x2c6c69,_0xa008('0x13'),JSON[_0xa008('0x15')](_0x347b85));if(_0x347b85['error']){if(_0x347b85['error'][_0xa008('0x16')]===0x1f4){logger['error'](_0xa008('0x12'),_0x2c6c69,_0x347b85[_0xa008('0x17')][_0xa008('0x18')]);return _0x5ea3f2(_0x347b85[_0xa008('0x17')][_0xa008('0x18')]);}logger[_0xa008('0x17')](_0xa008('0x12'),_0x2c6c69,_0x347b85['error']['message']);return _0x3c14bd(_0x347b85[_0xa008('0x17')][_0xa008('0x18')]);}else{logger[_0xa008('0x19')](_0xa008('0x12'),_0x2c6c69,'request\x20sent');_0x3c14bd(_0x347b85[_0xa008('0x1a')][_0xa008('0x18')]);}})[_0xa008('0x1b')](function(_0x3f5cd6){logger[_0xa008('0x17')]('SquareProject,\x20%s,\x20%s',_0x2c6c69,_0x3f5cd6);_0x5ea3f2(_0x3f5cd6);});});}exports[_0xa008('0x1c')]=function(_0x53496d){var _0x4418bc=this;return new Promise(function(_0x3a34e7,_0x456533){return db[_0xa008('0x1d')][_0xa008('0x1e')]({'raw':_0x53496d[_0xa008('0x1f')]?_0x53496d[_0xa008('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x53496d[_0xa008('0x1f')]?_0x53496d['options'][_0xa008('0x20')]||null:null,'attributes':_0x53496d[_0xa008('0x1f')]?_0x53496d[_0xa008('0x1f')][_0xa008('0x21')]||null:null,'include':_0x53496d[_0xa008('0x1f')]?_0x53496d[_0xa008('0x1f')][_0xa008('0x22')]?_[_0xa008('0x23')](_0x53496d[_0xa008('0x1f')][_0xa008('0x22')],function(_0x21d2dd){return{'model':db[_0x21d2dd[_0xa008('0x24')]],'as':_0x21d2dd['as'],'attributes':_0x21d2dd['attributes'],'include':_0x21d2dd[_0xa008('0x22')]?_[_0xa008('0x23')](_0x21d2dd[_0xa008('0x22')],function(_0x50e06a){return{'model':db[_0x50e06a[_0xa008('0x24')]],'as':_0x50e06a['as'],'attributes':_0x50e06a[_0xa008('0x21')],'include':_0x50e06a[_0xa008('0x22')]?_['map'](_0x50e06a[_0xa008('0x22')],function(_0x1c76ca){return{'model':db[_0x1c76ca[_0xa008('0x24')]],'as':_0x1c76ca['as'],'attributes':_0x1c76ca['attributes']};}):[]};}):[]};}):[]:[]})[_0xa008('0x11')](function(_0x25fef1){logger[_0xa008('0x19')](_0xa008('0x1c'),_0x53496d);logger[_0xa008('0x14')]('ShowSquareProject',_0x53496d,JSON[_0xa008('0x15')](_0x25fef1));_0x3a34e7(_0x25fef1);})[_0xa008('0x1b')](function(_0x50268f){logger[_0xa008('0x17')](_0xa008('0x1c'),_0x50268f['message'],_0x53496d);_0x456533(_0x4418bc['error'](0x1f4,_0x50268f[_0xa008('0x18')]));});});}; \ No newline at end of file +var _0xab7b=['error','message','info','result','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','model','map','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x461f41,_0x405481){var _0x22c772=function(_0x1b5823){while(--_0x1b5823){_0x461f41['push'](_0x461f41['shift']());}};_0x22c772(++_0x405481);}(_0xab7b,0x12f));var _0xbab7=function(_0x5877b7,_0x57d044){_0x5877b7=_0x5877b7-0x0;var _0x3a22af=_0xab7b[_0x5877b7];return _0x3a22af;};'use strict';var _=require(_0xbab7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbab7('0x1'));var rs=require(_0xbab7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbab7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbab7('0x4'))(_0xbab7('0x5'));var config=require(_0xbab7('0x6'));var jayson=require(_0xbab7('0x7'));var client=jayson['client'][_0xbab7('0x8')]({'port':0x232a});config['redis']=_[_0xbab7('0x9')](config[_0xbab7('0xa')],{'host':_0xbab7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbab7('0xa')]));require(_0xbab7('0xc'))[_0xbab7('0xd')](socket);function respondWithRpcPromise(_0x289fa3,_0x3d31af,_0x1387e5){return new BPromise(function(_0x436ec7,_0x294d6a){return client[_0xbab7('0xe')](_0x289fa3,_0x1387e5)[_0xbab7('0xf')](function(_0x1cacf7){logger['info'](_0xbab7('0x10'),_0x3d31af,_0xbab7('0x11'));logger[_0xbab7('0x12')](_0xbab7('0x13'),_0x3d31af,_0xbab7('0x11'),JSON[_0xbab7('0x14')](_0x1cacf7));if(_0x1cacf7[_0xbab7('0x15')]){if(_0x1cacf7[_0xbab7('0x15')]['code']===0x1f4){logger['error'](_0xbab7('0x10'),_0x3d31af,_0x1cacf7[_0xbab7('0x15')][_0xbab7('0x16')]);return _0x294d6a(_0x1cacf7[_0xbab7('0x15')][_0xbab7('0x16')]);}logger[_0xbab7('0x15')](_0xbab7('0x10'),_0x3d31af,_0x1cacf7['error'][_0xbab7('0x16')]);return _0x436ec7(_0x1cacf7['error'][_0xbab7('0x16')]);}else{logger[_0xbab7('0x17')](_0xbab7('0x10'),_0x3d31af,_0xbab7('0x11'));_0x436ec7(_0x1cacf7[_0xbab7('0x18')][_0xbab7('0x16')]);}})['catch'](function(_0x234424){logger[_0xbab7('0x15')](_0xbab7('0x10'),_0x3d31af,_0x234424);_0x294d6a(_0x234424);});});}exports[_0xbab7('0x19')]=function(_0x272996){var _0x2e68ea=this;return new Promise(function(_0x4cd9b1,_0x5be767){return db[_0xbab7('0x1a')][_0xbab7('0x1b')]({'raw':_0x272996[_0xbab7('0x1c')]?_0x272996['options'][_0xbab7('0x1d')]===undefined?!![]:![]:!![],'where':_0x272996[_0xbab7('0x1c')]?_0x272996['options'][_0xbab7('0x1e')]||null:null,'attributes':_0x272996[_0xbab7('0x1c')]?_0x272996[_0xbab7('0x1c')][_0xbab7('0x1f')]||null:null,'include':_0x272996[_0xbab7('0x1c')]?_0x272996[_0xbab7('0x1c')][_0xbab7('0x20')]?_['map'](_0x272996[_0xbab7('0x1c')][_0xbab7('0x20')],function(_0xe282c){return{'model':db[_0xe282c[_0xbab7('0x21')]],'as':_0xe282c['as'],'attributes':_0xe282c['attributes'],'include':_0xe282c[_0xbab7('0x20')]?_[_0xbab7('0x22')](_0xe282c['include'],function(_0x5bb177){return{'model':db[_0x5bb177[_0xbab7('0x21')]],'as':_0x5bb177['as'],'attributes':_0x5bb177[_0xbab7('0x1f')],'include':_0x5bb177[_0xbab7('0x20')]?_[_0xbab7('0x22')](_0x5bb177[_0xbab7('0x20')],function(_0x1a4440){return{'model':db[_0x1a4440[_0xbab7('0x21')]],'as':_0x1a4440['as'],'attributes':_0x1a4440[_0xbab7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d7e3a){logger['info'](_0xbab7('0x19'),_0x272996);logger['debug'](_0xbab7('0x19'),_0x272996,JSON[_0xbab7('0x14')](_0x5d7e3a));_0x4cd9b1(_0x5d7e3a);})[_0xbab7('0x23')](function(_0x5156c6){logger['error'](_0xbab7('0x19'),_0x5156c6[_0xbab7('0x16')],_0x272996);_0x5be767(_0x2e68ea[_0xbab7('0x15')](0x1f4,_0x5156c6[_0xbab7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index da106bc..a529dd4 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 _0x055a=['./squareProject.events','save','remove','emit','removeListener','register','squareProject:'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0x055a,0x13b));var _0xa055=function(_0x3f8309,_0x38eb50){_0x3f8309=_0x3f8309-0x0;var _0xa496c7=_0x055a[_0x3f8309];return _0xa496c7;};'use strict';var SquareProjectEvents=require(_0xa055('0x0'));var events=[_0xa055('0x1'),_0xa055('0x2'),'update'];function createListener(_0x55f08d,_0x44dd57){return function(_0x5936bb){_0x44dd57[_0xa055('0x3')](_0x55f08d,_0x5936bb);};}function removeListener(_0x11731e,_0x5ad4d1){return function(){SquareProjectEvents[_0xa055('0x4')](_0x11731e,_0x5ad4d1);};}exports[_0xa055('0x5')]=function(_0x2b827a){for(var _0x5720c7=0x0,_0x468c88=events['length'];_0x5720c7<_0x468c88;_0x5720c7++){var _0x55c71d=events[_0x5720c7];var _0x374002=createListener(_0xa055('0x6')+_0x55c71d,_0x2b827a);SquareProjectEvents['on'](_0x55c71d,_0x374002);}}; \ No newline at end of file +var _0x930a=['removeListener','register','length','remove','update'];(function(_0x24811f,_0x37652e){var _0x2fa890=function(_0x2021a3){while(--_0x2021a3){_0x24811f['push'](_0x24811f['shift']());}};_0x2fa890(++_0x37652e);}(_0x930a,0xa3));var _0xa930=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x930a[_0x25e7cb];return _0x375d92;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0xa930('0x0'),_0xa930('0x1')];function createListener(_0x1ba776,_0x4f62be){return function(_0x43b5a7){_0x4f62be['emit'](_0x1ba776,_0x43b5a7);};}function removeListener(_0xfd3920,_0x14ed1a){return function(){SquareProjectEvents[_0xa930('0x2')](_0xfd3920,_0x14ed1a);};}exports[_0xa930('0x3')]=function(_0x56a034){for(var _0x1ee1b1=0x0,_0x20bd27=events[_0xa930('0x4')];_0x1ee1b1<_0x20bd27;_0x1ee1b1++){var _0x49b57a=events[_0x1ee1b1];var _0x1c2673=createListener('squareProject:'+_0x49b57a,_0x56a034);SquareProjectEvents['on'](_0x49b57a,_0x1c2673);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index c34e25a..451c54f 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 _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x57a45b,_0x3da44f){var _0x163311=function(_0x3bbc1d){while(--_0x3bbc1d){_0x57a45b['push'](_0x57a45b['shift']());}};_0x163311(++_0x3da44f);}(_0x814b,0x1a2));var _0xb814=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x814b[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file +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(_0x5bda82,_0x2687d4){var _0x41f30f=function(_0x1d1c33){while(--_0x1d1c33){_0x5bda82['push'](_0x5bda82['shift']());}};_0x41f30f(++_0x2687d4);}(_0x5fc3,0xa8));var _0x35fc=function(_0x54d49e,_0x5d9911){_0x54d49e=_0x54d49e-0x0;var _0x4af0f1=_0x5fc3[_0x54d49e];return _0x4af0f1;};'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 diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index f17cdee..c14bf17 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 _0x7c09=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x109cd6,_0x327d6d){var _0x1b193d=function(_0x295101){while(--_0x295101){_0x109cd6['push'](_0x109cd6['shift']());}};_0x1b193d(++_0x327d6d);}(_0x7c09,0x102));var _0x97c0=function(_0x1a51f7,_0x571c0b){_0x1a51f7=_0x1a51f7-0x0;var _0x3e0e80=_0x7c09[_0x1a51f7];return _0x3e0e80;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'uniqueid':{'type':Sequelize[_0x97c0('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97c0('0x1')]},'context':{'type':Sequelize[_0x97c0('0x1')]},'extension':{'type':Sequelize[_0x97c0('0x1')]},'priority':{'type':Sequelize[_0x97c0('0x1')]},'accountcode':{'type':Sequelize[_0x97c0('0x1')]},'dnid':{'type':Sequelize[_0x97c0('0x1')]},'projectName':{'type':Sequelize[_0x97c0('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x97c0('0x2')],'get':function(){var _0x42c6c7='';var _0x2c19fa=this[_0x97c0('0x3')](_0x97c0('0x4'));if(_0x2c19fa){_0x42c6c7=_0x2c19fa['substring'](_0x2c19fa[_0x97c0('0x5')]('.'));}return _0x42c6c7;}}}; \ No newline at end of file +var _0x5fd1=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize'];(function(_0x2e231c,_0x5de4f9){var _0x255be7=function(_0x4b9d9d){while(--_0x4b9d9d){_0x2e231c['push'](_0x2e231c['shift']());}};_0x255be7(++_0x5de4f9);}(_0x5fd1,0x155));var _0x15fd=function(_0x5d253e,_0x472b51){_0x5d253e=_0x5d253e-0x0;var _0x310122=_0x5fd1[_0x5d253e];return _0x310122;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'callerid':{'type':Sequelize[_0x15fd('0x1')]},'calleridname':{'type':Sequelize[_0x15fd('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x15fd('0x1')]},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'dnid':{'type':Sequelize[_0x15fd('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x15fd('0x1')]},'filename':{'type':Sequelize[_0x15fd('0x1')]},'savePath':{'type':Sequelize[_0x15fd('0x1')]},'format':{'type':Sequelize[_0x15fd('0x2')],'get':function(){var _0x225728='';var _0x534e63=this[_0x15fd('0x3')](_0x15fd('0x4'));if(_0x534e63){_0x225728=_0x534e63[_0x15fd('0x5')](_0x534e63['lastIndexOf']('.'));}return _0x225728;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a2c4aea..bba1670 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 _0xaa70=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined','count','offset','limit','status','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','SquareRecording','fieldName','type','key','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','body','download','../../components/encryptor','uniqueid','savePath','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x3b6f4c,_0x26e349){var _0x294f32=function(_0x1db9b8){while(--_0x1db9b8){_0x3b6f4c['push'](_0x3b6f4c['shift']());}};_0x294f32(++_0x26e349);}(_0xaa70,0x1eb));var _0x0aa7=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0xaa70[_0x39772f];return _0xc9edbf;};'use strict';var emlformat=require(_0x0aa7('0x0'));var rimraf=require(_0x0aa7('0x1'));var zipdir=require(_0x0aa7('0x2'));var jsonpatch=require(_0x0aa7('0x3'));var rp=require(_0x0aa7('0x4'));var moment=require(_0x0aa7('0x5'));var BPromise=require(_0x0aa7('0x6'));var Mustache=require(_0x0aa7('0x7'));var util=require(_0x0aa7('0x8'));var path=require(_0x0aa7('0x9'));var sox=require(_0x0aa7('0xa'));var csv=require(_0x0aa7('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0aa7('0xc'));var _=require('lodash');var squel=require(_0x0aa7('0xd'));var crypto=require(_0x0aa7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0aa7('0xf'));var toCsv=require(_0x0aa7('0xb'));var querystring=require(_0x0aa7('0x10'));var Papa=require(_0x0aa7('0x11'));var Redis=require(_0x0aa7('0x12'));var authService=require(_0x0aa7('0x13'));var qs=require(_0x0aa7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0aa7('0x15'));var logger=require(_0x0aa7('0x16'))(_0x0aa7('0x17'));var utils=require(_0x0aa7('0x18'));var config=require(_0x0aa7('0x19'));var licenseUtil=require(_0x0aa7('0x1a'));var db=require(_0x0aa7('0x1b'))['db'];function respondWithStatusCode(_0x3bc69b,_0x5d1f69){_0x5d1f69=_0x5d1f69||0xcc;return function(_0x3ef8d1){if(_0x3ef8d1){return _0x3bc69b[_0x0aa7('0x1c')](_0x5d1f69);}return _0x3bc69b['status'](_0x5d1f69)[_0x0aa7('0x1d')]();};}function respondWithResult(_0x26dffd,_0x15ea0c){_0x15ea0c=_0x15ea0c||0xc8;return function(_0x4736d3){if(_0x4736d3){return _0x26dffd['status'](_0x15ea0c)['json'](_0x4736d3);}};}function respondWithFilteredResult(_0x67a717,_0x1a8d9f){return function(_0x50ddad){if(_0x50ddad){var _0x5e1525=typeof _0x1a8d9f['offset']===_0x0aa7('0x1e')&&typeof _0x1a8d9f['limit']===_0x0aa7('0x1e');var _0x404004=_0x50ddad[_0x0aa7('0x1f')];var _0x54589d=_0x5e1525?0x0:_0x1a8d9f[_0x0aa7('0x20')];var _0x55e2e6=_0x5e1525?_0x50ddad[_0x0aa7('0x1f')]:_0x1a8d9f['offset']+_0x1a8d9f[_0x0aa7('0x21')];var _0x4a8fbe;if(_0x55e2e6>=_0x404004){_0x55e2e6=_0x404004;_0x4a8fbe=0xc8;}else{_0x4a8fbe=0xce;}_0x67a717[_0x0aa7('0x22')](_0x4a8fbe);return _0x67a717[_0x0aa7('0x23')](_0x0aa7('0x24'),_0x54589d+'-'+_0x55e2e6+'/'+_0x404004)[_0x0aa7('0x25')](_0x50ddad);}return null;};}function patchUpdates(_0x5f6c16){return function(_0x5f3a5a){try{jsonpatch[_0x0aa7('0x26')](_0x5f3a5a,_0x5f6c16,!![]);}catch(_0xf19826){return BPromise[_0x0aa7('0x27')](_0xf19826);}return _0x5f3a5a['save']();};}function saveUpdates(_0x59b8cc,_0x2ef133){return function(_0x2ff5cf){if(_0x2ff5cf){return _0x2ff5cf[_0x0aa7('0x28')](_0x59b8cc)[_0x0aa7('0x29')](function(_0x30a40e){return _0x30a40e;});}return null;};}function removeEntity(_0x3da164,_0x1d862f){return function(_0x1c763b){if(_0x1c763b){return _0x1c763b[_0x0aa7('0x2a')]()['then'](function(){_0x3da164[_0x0aa7('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x93aa4b,_0x5551d7){return function(_0x59f576){if(!_0x59f576){_0x93aa4b['sendStatus'](0x194);}return _0x59f576;};}function handleError(_0x3e8138,_0x4e837e){_0x4e837e=_0x4e837e||0x1f4;return function(_0x1469da){logger[_0x0aa7('0x2b')](_0x1469da[_0x0aa7('0x2c')]);if(_0x1469da['name']){delete _0x1469da[_0x0aa7('0x2d')];}_0x3e8138[_0x0aa7('0x22')](_0x4e837e)[_0x0aa7('0x2e')](_0x1469da);};}exports[_0x0aa7('0x2f')]=function(_0xfc1694,_0x2875fe){var _0x1f6985={},_0xe90142={},_0x5f4ac3={'count':0x0,'rows':[]};var _0x500d48=_[_0x0aa7('0x30')](db[_0x0aa7('0x31')]['rawAttributes'],function(_0x2487e8){return{'name':_0x2487e8[_0x0aa7('0x32')],'type':_0x2487e8[_0x0aa7('0x33')][_0x0aa7('0x34')]};});_0xe90142['model']=_[_0x0aa7('0x30')](_0x500d48,_0x0aa7('0x2d'));_0xe90142[_0x0aa7('0x35')]=_['keys'](_0xfc1694['query']);_0xe90142['filters']=_['intersection'](_0xe90142[_0x0aa7('0x36')],_0xe90142[_0x0aa7('0x35')]);_0x1f6985['attributes']=_[_0x0aa7('0x37')](_0xe90142[_0x0aa7('0x36')],qs['fields'](_0xfc1694[_0x0aa7('0x35')][_0x0aa7('0x38')]));_0x1f6985['attributes']=_0x1f6985[_0x0aa7('0x39')][_0x0aa7('0x3a')]?_0x1f6985[_0x0aa7('0x39')]:_0xe90142[_0x0aa7('0x36')];if(!_0xfc1694[_0x0aa7('0x35')][_0x0aa7('0x3b')](_0x0aa7('0x3c'))){_0x1f6985[_0x0aa7('0x21')]=qs[_0x0aa7('0x21')](_0xfc1694[_0x0aa7('0x35')][_0x0aa7('0x21')]);_0x1f6985['offset']=qs[_0x0aa7('0x20')](_0xfc1694[_0x0aa7('0x35')][_0x0aa7('0x20')]);}_0x1f6985[_0x0aa7('0x3d')]=qs[_0x0aa7('0x3e')](_0xfc1694[_0x0aa7('0x35')]['sort']);_0x1f6985[_0x0aa7('0x3f')]=qs['filters'](_[_0x0aa7('0x40')](_0xfc1694['query'],_0xe90142[_0x0aa7('0x41')]),_0x500d48);if(_0xfc1694[_0x0aa7('0x35')][_0x0aa7('0x42')]){_0x1f6985[_0x0aa7('0x3f')]=_[_0x0aa7('0x43')](_0x1f6985[_0x0aa7('0x3f')],{'$or':_[_0x0aa7('0x30')](_0x500d48,function(_0x90ead2){if(_0x90ead2[_0x0aa7('0x33')]!==_0x0aa7('0x44')){var _0x39b0f7={};_0x39b0f7[_0x90ead2[_0x0aa7('0x2d')]]={'$like':'%'+_0xfc1694['query']['filter']+'%'};return _0x39b0f7;}})});}_0x1f6985=_[_0x0aa7('0x43')]({},_0x1f6985,_0xfc1694[_0x0aa7('0x45')]);var _0x1aadb6={'where':_0x1f6985['where']};return db[_0x0aa7('0x31')]['count'](_0x1aadb6)[_0x0aa7('0x29')](function(_0x4f1344){_0x5f4ac3['count']=_0x4f1344;if(_0xfc1694[_0x0aa7('0x35')][_0x0aa7('0x46')]){_0x1f6985[_0x0aa7('0x47')]=[{'all':!![]}];}return db[_0x0aa7('0x31')]['findAll'](_0x1f6985);})[_0x0aa7('0x29')](function(_0x14aa69){_0x5f4ac3[_0x0aa7('0x48')]=_0x14aa69;return _0x5f4ac3;})[_0x0aa7('0x29')](respondWithFilteredResult(_0x2875fe,_0x1f6985))[_0x0aa7('0x49')](handleError(_0x2875fe,null));};exports[_0x0aa7('0x4a')]=function(_0x15f58c,_0x1449ee){var _0x4cd5ae={'raw':!![],'where':{'id':_0x15f58c[_0x0aa7('0x4b')]['id']}},_0x5aabed={};_0x5aabed[_0x0aa7('0x36')]=_[_0x0aa7('0x4c')](db[_0x0aa7('0x31')][_0x0aa7('0x4d')]);_0x5aabed[_0x0aa7('0x35')]=_[_0x0aa7('0x4c')](_0x15f58c['query']);_0x5aabed[_0x0aa7('0x41')]=_[_0x0aa7('0x37')](_0x5aabed[_0x0aa7('0x36')],_0x5aabed[_0x0aa7('0x35')]);_0x4cd5ae[_0x0aa7('0x39')]=_[_0x0aa7('0x37')](_0x5aabed[_0x0aa7('0x36')],qs[_0x0aa7('0x38')](_0x15f58c[_0x0aa7('0x35')]['fields']));_0x4cd5ae[_0x0aa7('0x39')]=_0x4cd5ae[_0x0aa7('0x39')][_0x0aa7('0x3a')]?_0x4cd5ae[_0x0aa7('0x39')]:_0x5aabed[_0x0aa7('0x36')];if(_0x15f58c[_0x0aa7('0x35')][_0x0aa7('0x46')]){_0x4cd5ae[_0x0aa7('0x47')]=[{'all':!![]}];}_0x4cd5ae=_['merge']({},_0x4cd5ae,_0x15f58c[_0x0aa7('0x45')]);return db[_0x0aa7('0x31')][_0x0aa7('0x4e')](_0x4cd5ae)[_0x0aa7('0x29')](handleEntityNotFound(_0x1449ee,null))[_0x0aa7('0x29')](respondWithResult(_0x1449ee,null))[_0x0aa7('0x49')](handleError(_0x1449ee,null));};exports['create']=function(_0x25e465,_0xa3078f){return db[_0x0aa7('0x31')]['create'](_0x25e465[_0x0aa7('0x4f')],{})['then'](respondWithResult(_0xa3078f,0xc9))['catch'](handleError(_0xa3078f,null));};exports[_0x0aa7('0x28')]=function(_0x3af985,_0x426f17){if(_0x3af985[_0x0aa7('0x4f')]['id']){delete _0x3af985[_0x0aa7('0x4f')]['id'];}return db[_0x0aa7('0x31')][_0x0aa7('0x4e')]({'where':{'id':_0x3af985['params']['id']}})[_0x0aa7('0x29')](handleEntityNotFound(_0x426f17,null))[_0x0aa7('0x29')](saveUpdates(_0x3af985[_0x0aa7('0x4f')],null))[_0x0aa7('0x29')](respondWithResult(_0x426f17,null))[_0x0aa7('0x49')](handleError(_0x426f17,null));};exports[_0x0aa7('0x50')]=function(_0x2ee1e1,_0x20c145,_0x585172){var _0x2a70d4=require(_0x0aa7('0x51'));var _0x2f3958=![];var _0x22187={};if(_0x2ee1e1['query'][_0x0aa7('0x33')]&&_0x2ee1e1[_0x0aa7('0x35')][_0x0aa7('0x33')]===_0x0aa7('0x52')){_0x22187['uniqueid']=_0x2ee1e1[_0x0aa7('0x4b')]['id'];}else{_0x22187['id']=_0x2ee1e1[_0x0aa7('0x4b')]['id'];}return db[_0x0aa7('0x31')][_0x0aa7('0x4e')]({'where':_0x22187,'attributes':['id',_0x0aa7('0x53'),'filename'],'raw':!![]})[_0x0aa7('0x29')](handleEntityNotFound(_0x20c145,null))[_0x0aa7('0x29')](function(_0x3e16c3){if(_0x3e16c3){var _0x27f50d=_0x3e16c3[_0x0aa7('0x53')];var _0x5b35e9=util['format'](_0x0aa7('0x54'),_0x27f50d);if(fs[_0x0aa7('0x55')](_0x5b35e9)){_0x2f3958=!![];return _0x2a70d4[_0x0aa7('0x56')](_0x5b35e9,_0x27f50d,config[_0x0aa7('0x57')][_0x0aa7('0x58')])['then'](function(){return _0x3e16c3;});}return _0x3e16c3;}})[_0x0aa7('0x29')](function(_0x341ae2){if(_0x341ae2){var _0x34347f=_0x341ae2[_0x0aa7('0x53')];if(!fs[_0x0aa7('0x55')](_0x34347f)){throw new db[(_0x0aa7('0x59'))][(_0x0aa7('0x5a'))](_0x0aa7('0x5b'));}if(_0x341ae2[_0x0aa7('0x5c')]){return _0x20c145['download'](_0x34347f,_0x341ae2[_0x0aa7('0x5c')]+path[_0x0aa7('0x5d')](_0x34347f),function(){if(_0x2f3958){fs[_0x0aa7('0x5e')](_0x34347f);}});}else{return _0x20c145['download'](_0x34347f,function(_0xc9a6f5){if(_0x2f3958){fs[_0x0aa7('0x5e')](_0x34347f);}});}}})[_0x0aa7('0x49')](function(_0x44a792){if(_0x44a792['message']===_0x0aa7('0x5b')){_0x20c145[_0x0aa7('0x22')](0x194)['send'](_0x0aa7('0x5f'));}else{return handleError(_0x20c145,null);}});};exports[_0x0aa7('0x2a')]=function(_0x14d5c0,_0x14bcbf){return db[_0x0aa7('0x31')]['find']({'where':{'id':_0x14d5c0[_0x0aa7('0x4b')]['id']}})[_0x0aa7('0x29')](function(_0x5a87e0){if(_[_0x0aa7('0x60')](_0x5a87e0)){throw new ReferenceError(_0x0aa7('0x61'));}return _0x5a87e0;})[_0x0aa7('0x29')](function(_0x19b7f5){var _0x134f35=_0x19b7f5['savePath'];logger[_0x0aa7('0x62')](_0x0aa7('0x63'),_0x134f35);if(!_[_0x0aa7('0x60')](_0x19b7f5['savePath'])&&fs[_0x0aa7('0x55')](_0x134f35)){logger[_0x0aa7('0x62')]('File:\x20\x22'+_0x134f35+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0aa7('0x64')](_0x134f35);}_0x134f35=_0x134f35+'.cypher';if(!_[_0x0aa7('0x60')](_0x19b7f5[_0x0aa7('0x53')])&&fs[_0x0aa7('0x55')](_0x134f35)){logger[_0x0aa7('0x62')](_0x0aa7('0x65')+_0x134f35+_0x0aa7('0x66'));fs[_0x0aa7('0x64')](_0x134f35);}return _0x19b7f5;})['then'](function(_0x325c63){if(!_0x325c63)throw new InternalError();return _0x325c63['destroy']();})[_0x0aa7('0x29')](function(){_0x14bcbf[_0x0aa7('0x22')](0xcc)[_0x0aa7('0x1d')]();})[_0x0aa7('0x49')](handleError(_0x14bcbf,null));}; \ No newline at end of file +var _0xdc41=['savePath','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','destroy','error','stack','name','index','map','SquareRecording','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','then','include','findAll','params','includeAll','create','body','catch','find','download','../../components/encryptor','uniqueid','filename'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xdc41,0x124));var _0x1dc4=function(_0x243b9b,_0x4bea6f){_0x243b9b=_0x243b9b-0x0;var _0x54c065=_0xdc41[_0x243b9b];return _0x54c065;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1dc4('0x0'));var zipdir=require(_0x1dc4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1dc4('0x2'));var moment=require('moment');var BPromise=require(_0x1dc4('0x3'));var Mustache=require(_0x1dc4('0x4'));var util=require('util');var path=require(_0x1dc4('0x5'));var sox=require('sox');var csv=require(_0x1dc4('0x6'));var ejs=require(_0x1dc4('0x7'));var fs=require('fs');var fs_extra=require(_0x1dc4('0x8'));var _=require(_0x1dc4('0x9'));var squel=require(_0x1dc4('0xa'));var crypto=require(_0x1dc4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1dc4('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1dc4('0xd'));var authService=require(_0x1dc4('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1dc4('0xf'));var logger=require(_0x1dc4('0x10'))(_0x1dc4('0x11'));var utils=require(_0x1dc4('0x12'));var config=require(_0x1dc4('0x13'));var licenseUtil=require(_0x1dc4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x571fb5,_0x29a151){_0x29a151=_0x29a151||0xcc;return function(_0x54f9cf){if(_0x54f9cf){return _0x571fb5[_0x1dc4('0x15')](_0x29a151);}return _0x571fb5[_0x1dc4('0x16')](_0x29a151)[_0x1dc4('0x17')]();};}function respondWithResult(_0x33ada2,_0x4f04e5){_0x4f04e5=_0x4f04e5||0xc8;return function(_0x2d4e1d){if(_0x2d4e1d){return _0x33ada2[_0x1dc4('0x16')](_0x4f04e5)['json'](_0x2d4e1d);}};}function respondWithFilteredResult(_0x169555,_0x235a4f){return function(_0x31f1e0){if(_0x31f1e0){var _0x4ac4c2=typeof _0x235a4f[_0x1dc4('0x18')]===_0x1dc4('0x19')&&typeof _0x235a4f[_0x1dc4('0x1a')]===_0x1dc4('0x19');var _0x48310c=_0x31f1e0[_0x1dc4('0x1b')];var _0x59e2de=_0x4ac4c2?0x0:_0x235a4f[_0x1dc4('0x18')];var _0x1daaee=_0x4ac4c2?_0x31f1e0[_0x1dc4('0x1b')]:_0x235a4f['offset']+_0x235a4f[_0x1dc4('0x1a')];var _0x124305;if(_0x1daaee>=_0x48310c){_0x1daaee=_0x48310c;_0x124305=0xc8;}else{_0x124305=0xce;}_0x169555[_0x1dc4('0x16')](_0x124305);return _0x169555[_0x1dc4('0x1c')](_0x1dc4('0x1d'),_0x59e2de+'-'+_0x1daaee+'/'+_0x48310c)[_0x1dc4('0x1e')](_0x31f1e0);}return null;};}function patchUpdates(_0x182476){return function(_0x2cb9fd){try{jsonpatch[_0x1dc4('0x1f')](_0x2cb9fd,_0x182476,!![]);}catch(_0x3ce92d){return BPromise['reject'](_0x3ce92d);}return _0x2cb9fd['save']();};}function saveUpdates(_0x1f4c4f,_0x4320eb){return function(_0x2f9248){if(_0x2f9248){return _0x2f9248[_0x1dc4('0x20')](_0x1f4c4f)['then'](function(_0x3a38ad){return _0x3a38ad;});}return null;};}function removeEntity(_0x18d021,_0x2ba824){return function(_0x59e3bf){if(_0x59e3bf){return _0x59e3bf[_0x1dc4('0x21')]()['then'](function(){_0x18d021[_0x1dc4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f91c3,_0x528c79){return function(_0x566e6a){if(!_0x566e6a){_0x1f91c3[_0x1dc4('0x15')](0x194);}return _0x566e6a;};}function handleError(_0x1c8355,_0x2efdc3){_0x2efdc3=_0x2efdc3||0x1f4;return function(_0x162ac6){logger[_0x1dc4('0x22')](_0x162ac6[_0x1dc4('0x23')]);if(_0x162ac6['name']){delete _0x162ac6[_0x1dc4('0x24')];}_0x1c8355[_0x1dc4('0x16')](_0x2efdc3)['send'](_0x162ac6);};}exports[_0x1dc4('0x25')]=function(_0xd9324b,_0xac9a83){var _0x4bc55b={},_0x4a41d9={},_0x160e84={'count':0x0,'rows':[]};var _0x5f335d=_[_0x1dc4('0x26')](db[_0x1dc4('0x27')][_0x1dc4('0x28')],function(_0x2f4e71){return{'name':_0x2f4e71['fieldName'],'type':_0x2f4e71[_0x1dc4('0x29')][_0x1dc4('0x2a')]};});_0x4a41d9[_0x1dc4('0x2b')]=_[_0x1dc4('0x26')](_0x5f335d,_0x1dc4('0x24'));_0x4a41d9['query']=_[_0x1dc4('0x2c')](_0xd9324b[_0x1dc4('0x2d')]);_0x4a41d9[_0x1dc4('0x2e')]=_['intersection'](_0x4a41d9[_0x1dc4('0x2b')],_0x4a41d9[_0x1dc4('0x2d')]);_0x4bc55b[_0x1dc4('0x2f')]=_[_0x1dc4('0x30')](_0x4a41d9[_0x1dc4('0x2b')],qs['fields'](_0xd9324b[_0x1dc4('0x2d')][_0x1dc4('0x31')]));_0x4bc55b[_0x1dc4('0x2f')]=_0x4bc55b['attributes'][_0x1dc4('0x32')]?_0x4bc55b['attributes']:_0x4a41d9[_0x1dc4('0x2b')];if(!_0xd9324b[_0x1dc4('0x2d')]['hasOwnProperty'](_0x1dc4('0x33'))){_0x4bc55b[_0x1dc4('0x1a')]=qs['limit'](_0xd9324b['query'][_0x1dc4('0x1a')]);_0x4bc55b[_0x1dc4('0x18')]=qs['offset'](_0xd9324b[_0x1dc4('0x2d')][_0x1dc4('0x18')]);}_0x4bc55b[_0x1dc4('0x34')]=qs[_0x1dc4('0x35')](_0xd9324b[_0x1dc4('0x2d')]['sort']);_0x4bc55b[_0x1dc4('0x36')]=qs['filters'](_[_0x1dc4('0x37')](_0xd9324b[_0x1dc4('0x2d')],_0x4a41d9[_0x1dc4('0x2e')]),_0x5f335d);if(_0xd9324b['query'][_0x1dc4('0x38')]){_0x4bc55b[_0x1dc4('0x36')]=_[_0x1dc4('0x39')](_0x4bc55b[_0x1dc4('0x36')],{'$or':_[_0x1dc4('0x26')](_0x5f335d,function(_0x371a0c){if(_0x371a0c[_0x1dc4('0x29')]!=='VIRTUAL'){var _0x5511b1={};_0x5511b1[_0x371a0c['name']]={'$like':'%'+_0xd9324b[_0x1dc4('0x2d')][_0x1dc4('0x38')]+'%'};return _0x5511b1;}})});}_0x4bc55b=_['merge']({},_0x4bc55b,_0xd9324b[_0x1dc4('0x3a')]);var _0x76c012={'where':_0x4bc55b['where']};return db[_0x1dc4('0x27')][_0x1dc4('0x1b')](_0x76c012)[_0x1dc4('0x3b')](function(_0x3c9a5a){_0x160e84[_0x1dc4('0x1b')]=_0x3c9a5a;if(_0xd9324b[_0x1dc4('0x2d')]['includeAll']){_0x4bc55b[_0x1dc4('0x3c')]=[{'all':!![]}];}return db[_0x1dc4('0x27')][_0x1dc4('0x3d')](_0x4bc55b);})[_0x1dc4('0x3b')](function(_0x4ddd0c){_0x160e84['rows']=_0x4ddd0c;return _0x160e84;})[_0x1dc4('0x3b')](respondWithFilteredResult(_0xac9a83,_0x4bc55b))['catch'](handleError(_0xac9a83,null));};exports['show']=function(_0x51e737,_0x1da8d3){var _0x295bc4={'raw':!![],'where':{'id':_0x51e737[_0x1dc4('0x3e')]['id']}},_0x1905d7={};_0x1905d7[_0x1dc4('0x2b')]=_[_0x1dc4('0x2c')](db[_0x1dc4('0x27')][_0x1dc4('0x28')]);_0x1905d7[_0x1dc4('0x2d')]=_['keys'](_0x51e737['query']);_0x1905d7['filters']=_[_0x1dc4('0x30')](_0x1905d7[_0x1dc4('0x2b')],_0x1905d7[_0x1dc4('0x2d')]);_0x295bc4[_0x1dc4('0x2f')]=_['intersection'](_0x1905d7[_0x1dc4('0x2b')],qs['fields'](_0x51e737[_0x1dc4('0x2d')][_0x1dc4('0x31')]));_0x295bc4['attributes']=_0x295bc4[_0x1dc4('0x2f')][_0x1dc4('0x32')]?_0x295bc4[_0x1dc4('0x2f')]:_0x1905d7['model'];if(_0x51e737[_0x1dc4('0x2d')][_0x1dc4('0x3f')]){_0x295bc4['include']=[{'all':!![]}];}_0x295bc4=_[_0x1dc4('0x39')]({},_0x295bc4,_0x51e737[_0x1dc4('0x3a')]);return db[_0x1dc4('0x27')]['find'](_0x295bc4)[_0x1dc4('0x3b')](handleEntityNotFound(_0x1da8d3,null))[_0x1dc4('0x3b')](respondWithResult(_0x1da8d3,null))['catch'](handleError(_0x1da8d3,null));};exports[_0x1dc4('0x40')]=function(_0x6ba0cd,_0x3fc868){return db[_0x1dc4('0x27')][_0x1dc4('0x40')](_0x6ba0cd[_0x1dc4('0x41')],{})[_0x1dc4('0x3b')](respondWithResult(_0x3fc868,0xc9))[_0x1dc4('0x42')](handleError(_0x3fc868,null));};exports[_0x1dc4('0x20')]=function(_0x54fd6a,_0x3a6520){if(_0x54fd6a['body']['id']){delete _0x54fd6a['body']['id'];}return db[_0x1dc4('0x27')][_0x1dc4('0x43')]({'where':{'id':_0x54fd6a[_0x1dc4('0x3e')]['id']}})[_0x1dc4('0x3b')](handleEntityNotFound(_0x3a6520,null))['then'](saveUpdates(_0x54fd6a[_0x1dc4('0x41')],null))[_0x1dc4('0x3b')](respondWithResult(_0x3a6520,null))[_0x1dc4('0x42')](handleError(_0x3a6520,null));};exports[_0x1dc4('0x44')]=function(_0x975773,_0x3fb5ba,_0x11eab2){var _0x2f995d=require(_0x1dc4('0x45'));var _0x4e3db9=![];var _0x54f17d={};if(_0x975773[_0x1dc4('0x2d')]['type']&&_0x975773[_0x1dc4('0x2d')][_0x1dc4('0x29')]===_0x1dc4('0x46')){_0x54f17d[_0x1dc4('0x46')]=_0x975773['params']['id'];}else{_0x54f17d['id']=_0x975773[_0x1dc4('0x3e')]['id'];}return db[_0x1dc4('0x27')]['find']({'where':_0x54f17d,'attributes':['id','savePath',_0x1dc4('0x47')],'raw':!![]})[_0x1dc4('0x3b')](handleEntityNotFound(_0x3fb5ba,null))[_0x1dc4('0x3b')](function(_0x6138f9){if(_0x6138f9){var _0x553b9b=_0x6138f9[_0x1dc4('0x48')];var _0xca3c1b=util['format'](_0x1dc4('0x49'),_0x553b9b);if(fs[_0x1dc4('0x4a')](_0xca3c1b)){_0x4e3db9=!![];return _0x2f995d[_0x1dc4('0x4b')](_0xca3c1b,_0x553b9b,config[_0x1dc4('0x4c')][_0x1dc4('0x4d')])['then'](function(){return _0x6138f9;});}return _0x6138f9;}})['then'](function(_0x1d0bba){if(_0x1d0bba){var _0x73d2c6=_0x1d0bba[_0x1dc4('0x48')];if(!fs[_0x1dc4('0x4a')](_0x73d2c6)){throw new db[(_0x1dc4('0x4e'))][(_0x1dc4('0x4f'))](_0x1dc4('0x50'));}if(_0x1d0bba[_0x1dc4('0x47')]){return _0x3fb5ba[_0x1dc4('0x44')](_0x73d2c6,_0x1d0bba[_0x1dc4('0x47')]+path['extname'](_0x73d2c6),function(){if(_0x4e3db9){fs['unlink'](_0x73d2c6);}});}else{return _0x3fb5ba['download'](_0x73d2c6,function(_0x4e781c){if(_0x4e3db9){fs[_0x1dc4('0x51')](_0x73d2c6);}});}}})[_0x1dc4('0x42')](function(_0x2588d5){if(_0x2588d5[_0x1dc4('0x52')]==='SquareRecording\x20not\x20found'){_0x3fb5ba[_0x1dc4('0x16')](0x194)['send'](_0x1dc4('0x53'));}else{return handleError(_0x3fb5ba,null);}});};exports[_0x1dc4('0x21')]=function(_0xe03dc1,_0x281b6b){return db[_0x1dc4('0x27')][_0x1dc4('0x43')]({'where':{'id':_0xe03dc1[_0x1dc4('0x3e')]['id']}})[_0x1dc4('0x3b')](function(_0xd14423){if(_[_0x1dc4('0x54')](_0xd14423)){throw new ReferenceError(_0x1dc4('0x55'));}return _0xd14423;})[_0x1dc4('0x3b')](function(_0x49aec1){var _0x2f969b=_0x49aec1[_0x1dc4('0x48')];logger[_0x1dc4('0x56')](_0x1dc4('0x57'),_0x2f969b);if(!_[_0x1dc4('0x54')](_0x49aec1[_0x1dc4('0x48')])&&fs['existsSync'](_0x2f969b)){logger['info'](_0x1dc4('0x58')+_0x2f969b+_0x1dc4('0x59'));fs['unlinkSync'](_0x2f969b);}_0x2f969b=_0x2f969b+_0x1dc4('0x5a');if(!_['isNil'](_0x49aec1[_0x1dc4('0x48')])&&fs['existsSync'](_0x2f969b)){logger[_0x1dc4('0x56')](_0x1dc4('0x58')+_0x2f969b+_0x1dc4('0x59'));fs['unlinkSync'](_0x2f969b);}return _0x49aec1;})['then'](function(_0x4321f1){if(!_0x4321f1)throw new InternalError();return _0x4321f1[_0x1dc4('0x21')]();})[_0x1dc4('0x3b')](function(){_0x281b6b[_0x1dc4('0x16')](0xcc)['end']();})[_0x1dc4('0x42')](handleError(_0x281b6b,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 8249593..6229bf9 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 _0x4d49=['request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','util','api','moment','bluebird'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x4d49,0x141));var _0x94d4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4d49[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x94d4('0x0'));var logger=require('../../config/logger')(_0x94d4('0x1'));var moment=require(_0x94d4('0x2'));var BPromise=require(_0x94d4('0x3'));var rp=require(_0x94d4('0x4'));var fs=require('fs');var path=require(_0x94d4('0x5'));var rimraf=require(_0x94d4('0x6'));var config=require(_0x94d4('0x7'));var attributes=require(_0x94d4('0x8'));module[_0x94d4('0x9')]=function(_0x4dd133,_0x2b3127){return _0x4dd133[_0x94d4('0xa')](_0x94d4('0xb'),attributes,{'tableName':_0x94d4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd2e=['./squareRecording.attributes','square_recordings','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x225684,_0x5caaa3){var _0x18a08e=function(_0x302732){while(--_0x302732){_0x225684['push'](_0x225684['shift']());}};_0x18a08e(++_0x5caaa3);}(_0xfd2e,0x6e));var _0xefd2=function(_0x233d8f,_0x92e5de){_0x233d8f=_0x233d8f-0x0;var _0x121b7b=_0xfd2e[_0x233d8f];return _0x121b7b;};'use strict';var _=require(_0xefd2('0x0'));var util=require('util');var logger=require(_0xefd2('0x1'))('api');var moment=require(_0xefd2('0x2'));var BPromise=require('bluebird');var rp=require(_0xefd2('0x3'));var fs=require('fs');var path=require(_0xefd2('0x4'));var rimraf=require(_0xefd2('0x5'));var config=require(_0xefd2('0x6'));var attributes=require(_0xefd2('0x7'));module['exports']=function(_0x5124c6,_0x40e76c){return _0x5124c6['define']('SquareRecording',attributes,{'tableName':_0xefd2('0x8'),'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 5eb980e..9c6d759 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 _0x9f2a=['info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateSquareRecording','create','body','options','raw','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0x9f2a,0xc5));var _0xa9f2=function(_0x57656e,_0x34f039){_0x57656e=_0x57656e-0x0;var _0x104de6=_0x9f2a[_0x57656e];return _0x104de6;};'use strict';var _=require(_0xa9f2('0x0'));var util=require('util');var moment=require(_0xa9f2('0x1'));var BPromise=require(_0xa9f2('0x2'));var rs=require(_0xa9f2('0x3'));var fs=require('fs');var Redis=require(_0xa9f2('0x4'));var db=require(_0xa9f2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa9f2('0x6'));var jayson=require(_0xa9f2('0x7'));var client=jayson[_0xa9f2('0x8')][_0xa9f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4efe06,_0x4d8fd3,_0x3ffd20){return new BPromise(function(_0x1eb68f,_0x423538){return client['request'](_0x4efe06,_0x3ffd20)[_0xa9f2('0xa')](function(_0x522acc){logger[_0xa9f2('0xb')](_0xa9f2('0xc'),_0x4d8fd3,_0xa9f2('0xd'));logger[_0xa9f2('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x4d8fd3,_0xa9f2('0xd'),JSON[_0xa9f2('0xf')](_0x522acc));if(_0x522acc[_0xa9f2('0x10')]){if(_0x522acc[_0xa9f2('0x10')][_0xa9f2('0x11')]===0x1f4){logger[_0xa9f2('0x10')](_0xa9f2('0xc'),_0x4d8fd3,_0x522acc['error']['message']);return _0x423538(_0x522acc[_0xa9f2('0x10')][_0xa9f2('0x12')]);}logger[_0xa9f2('0x10')](_0xa9f2('0xc'),_0x4d8fd3,_0x522acc['error'][_0xa9f2('0x12')]);return _0x1eb68f(_0x522acc[_0xa9f2('0x10')][_0xa9f2('0x12')]);}else{logger[_0xa9f2('0xb')](_0xa9f2('0xc'),_0x4d8fd3,_0xa9f2('0xd'));_0x1eb68f(_0x522acc[_0xa9f2('0x13')]['message']);}})['catch'](function(_0x582a36){logger[_0xa9f2('0x10')](_0xa9f2('0xc'),_0x4d8fd3,_0x582a36);_0x423538(_0x582a36);});});}exports[_0xa9f2('0x14')]=function(_0x44e7de){var _0xb82775=this;return new Promise(function(_0x2aea25,_0x4b6429){return db['SquareRecording'][_0xa9f2('0x15')](_0x44e7de[_0xa9f2('0x16')],{'raw':_0x44e7de['options']?_0x44e7de[_0xa9f2('0x17')][_0xa9f2('0x18')]===undefined?!![]:![]:!![]})[_0xa9f2('0xa')](function(_0x44f441){logger[_0xa9f2('0xb')](_0xa9f2('0x14'),_0x44e7de);logger[_0xa9f2('0xe')](_0xa9f2('0x14'),_0x44e7de,JSON['stringify'](_0x44f441));_0x2aea25(_0x44f441);})[_0xa9f2('0x19')](function(_0x3c8dda){logger[_0xa9f2('0x10')](_0xa9f2('0x14'),_0x3c8dda['message'],_0x44e7de);_0x4b6429(_0xb82775[_0xa9f2('0x10')](0x1f4,_0x3c8dda[_0xa9f2('0x12')]));});});}; \ No newline at end of file +var _0x4281=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareRecording','body','options','moment','randomstring','ioredis'];(function(_0x342102,_0x1a71e9){var _0x49fc8f=function(_0x3b13ac){while(--_0x3b13ac){_0x342102['push'](_0x342102['shift']());}};_0x49fc8f(++_0x1a71e9);}(_0x4281,0x110));var _0x1428=function(_0x4d2263,_0x3fbf0d){_0x4d2263=_0x4d2263-0x0;var _0x24aba0=_0x4281[_0x4d2263];return _0x24aba0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1428('0x0'));var BPromise=require('bluebird');var rs=require(_0x1428('0x1'));var fs=require('fs');var Redis=require(_0x1428('0x2'));var db=require(_0x1428('0x3'))['db'];var utils=require(_0x1428('0x4'));var logger=require('../../config/logger')(_0x1428('0x5'));var config=require(_0x1428('0x6'));var jayson=require(_0x1428('0x7'));var client=jayson[_0x1428('0x8')][_0x1428('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x340c24,_0x5e07f2,_0x4d98c1){return new BPromise(function(_0x46e4a7,_0x17bb82){return client[_0x1428('0xa')](_0x340c24,_0x4d98c1)[_0x1428('0xb')](function(_0x3eb3fe){logger[_0x1428('0xc')](_0x1428('0xd'),_0x5e07f2,_0x1428('0xe'));logger[_0x1428('0xf')](_0x1428('0x10'),_0x5e07f2,'request\x20sent',JSON[_0x1428('0x11')](_0x3eb3fe));if(_0x3eb3fe['error']){if(_0x3eb3fe[_0x1428('0x12')]['code']===0x1f4){logger[_0x1428('0x12')](_0x1428('0xd'),_0x5e07f2,_0x3eb3fe[_0x1428('0x12')][_0x1428('0x13')]);return _0x17bb82(_0x3eb3fe[_0x1428('0x12')][_0x1428('0x13')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x5e07f2,_0x3eb3fe[_0x1428('0x12')][_0x1428('0x13')]);return _0x46e4a7(_0x3eb3fe['error'][_0x1428('0x13')]);}else{logger[_0x1428('0xc')](_0x1428('0xd'),_0x5e07f2,_0x1428('0xe'));_0x46e4a7(_0x3eb3fe[_0x1428('0x14')]['message']);}})[_0x1428('0x15')](function(_0x47ed6e){logger[_0x1428('0x12')](_0x1428('0xd'),_0x5e07f2,_0x47ed6e);_0x17bb82(_0x47ed6e);});});}exports[_0x1428('0x16')]=function(_0x431e4e){var _0x5e4d46=this;return new Promise(function(_0x5bacad,_0x1d6e8f){return db['SquareRecording']['create'](_0x431e4e[_0x1428('0x17')],{'raw':_0x431e4e['options']?_0x431e4e[_0x1428('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x58de89){logger[_0x1428('0xc')](_0x1428('0x16'),_0x431e4e);logger[_0x1428('0xf')](_0x1428('0x16'),_0x431e4e,JSON[_0x1428('0x11')](_0x58de89));_0x5bacad(_0x58de89);})[_0x1428('0x15')](function(_0x105a04){logger[_0x1428('0x12')](_0x1428('0x16'),_0x105a04['message'],_0x431e4e);_0x1d6e8f(_0x5e4d46[_0x1428('0x12')](0x1f4,_0x105a04[_0x1428('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index ee17245..5f434ba 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x1df73e,_0x242686){var _0x7e079=function(_0x2585f0){while(--_0x2585f0){_0x1df73e['push'](_0x1df73e['shift']());}};_0x7e079(++_0x242686);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _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(_0x1e5b8b,_0x4937be){var _0x59393f=function(_0x14dc81){while(--_0x14dc81){_0x1e5b8b['push'](_0x1e5b8b['shift']());}};_0x59393f(++_0x4937be);}(_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('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 50977e8..c6544f2 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 _0x6826=['sequelize','STRING','DATE'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x6826,0x75));var _0x6682=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0x6826[_0x236c89];return _0x3b2a15;};'use strict';var Sequelize=require(_0x6682('0x0'));module['exports']={'network':{'type':Sequelize[_0x6682('0x1')]},'network_script':{'type':Sequelize[_0x6682('0x1')]},'request':{'type':Sequelize[_0x6682('0x1')]},'channel':{'type':Sequelize[_0x6682('0x1')]},'language':{'type':Sequelize[_0x6682('0x1')]},'type':{'type':Sequelize[_0x6682('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x6682('0x1')]},'calleridname':{'type':Sequelize[_0x6682('0x1')]},'callingpres':{'type':Sequelize[_0x6682('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x6682('0x1')]},'callingtns':{'type':Sequelize[_0x6682('0x1')]},'dnid':{'type':Sequelize[_0x6682('0x1')]},'rdnis':{'type':Sequelize[_0x6682('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x6682('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x6682('0x1')]},'accountcode':{'type':Sequelize[_0x6682('0x1')]},'threadid':{'type':Sequelize[_0x6682('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6682('0x2')]},'leaveAt':{'type':Sequelize[_0x6682('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc047=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x3cb064,_0x3867f8){var _0x1c9580=function(_0x321088){while(--_0x321088){_0x3cb064['push'](_0x3cb064['shift']());}};_0x1c9580(++_0x3867f8);}(_0xc047,0x140));var _0x7c04=function(_0x4c3d9b,_0x5628ee){_0x4c3d9b=_0x4c3d9b-0x0;var _0x2a68ba=_0xc047[_0x4c3d9b];return _0x2a68ba;};'use strict';var Sequelize=require(_0x7c04('0x0'));module[_0x7c04('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x7c04('0x2')]},'request':{'type':Sequelize[_0x7c04('0x2')]},'channel':{'type':Sequelize[_0x7c04('0x2')]},'language':{'type':Sequelize[_0x7c04('0x2')]},'type':{'type':Sequelize[_0x7c04('0x2')]},'uniqueid':{'type':Sequelize[_0x7c04('0x2')]},'version':{'type':Sequelize[_0x7c04('0x2')]},'callerid':{'type':Sequelize[_0x7c04('0x2')]},'calleridname':{'type':Sequelize[_0x7c04('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x7c04('0x2')]},'callingtns':{'type':Sequelize[_0x7c04('0x2')]},'dnid':{'type':Sequelize[_0x7c04('0x2')]},'rdnis':{'type':Sequelize[_0x7c04('0x2')]},'context':{'type':Sequelize[_0x7c04('0x2')]},'extension':{'type':Sequelize[_0x7c04('0x2')]},'priority':{'type':Sequelize[_0x7c04('0x2')]},'enhanced':{'type':Sequelize[_0x7c04('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x7c04('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7c04('0x3')]},'leaveAt':{'type':Sequelize[_0x7c04('0x3')]},'bot':{'type':Sequelize[_0x7c04('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 06a77f4..33dcf0d 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 _0x73d0=['keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name','send','index','map','SquareReport','rawAttributes','type','key','model','query'];(function(_0x185920,_0x105770){var _0x116019=function(_0x35417d){while(--_0x35417d){_0x185920['push'](_0x185920['shift']());}};_0x116019(++_0x105770);}(_0x73d0,0xfc));var _0x073d=function(_0x518df1,_0x2f01ab){_0x518df1=_0x518df1-0x0;var _0x4880f6=_0x73d0[_0x518df1];return _0x4880f6;};'use strict';var emlformat=require(_0x073d('0x0'));var rimraf=require(_0x073d('0x1'));var zipdir=require(_0x073d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x073d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x073d('0x4'));var path=require(_0x073d('0x5'));var sox=require(_0x073d('0x6'));var csv=require(_0x073d('0x7'));var ejs=require(_0x073d('0x8'));var fs=require('fs');var fs_extra=require(_0x073d('0x9'));var _=require(_0x073d('0xa'));var squel=require(_0x073d('0xb'));var crypto=require(_0x073d('0xc'));var jsforce=require(_0x073d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x073d('0x7'));var querystring=require(_0x073d('0xe'));var Papa=require('papaparse');var Redis=require(_0x073d('0xf'));var authService=require(_0x073d('0x10'));var qs=require(_0x073d('0x11'));var as=require(_0x073d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x073d('0x13'));var utils=require(_0x073d('0x14'));var config=require(_0x073d('0x15'));var licenseUtil=require(_0x073d('0x16'));var db=require(_0x073d('0x17'))['db'];function respondWithStatusCode(_0x2ae375,_0x40f9b8){_0x40f9b8=_0x40f9b8||0xcc;return function(_0x3f681c){if(_0x3f681c){return _0x2ae375['sendStatus'](_0x40f9b8);}return _0x2ae375[_0x073d('0x18')](_0x40f9b8)[_0x073d('0x19')]();};}function respondWithResult(_0x4004a9,_0x4c86f6){_0x4c86f6=_0x4c86f6||0xc8;return function(_0x3190e8){if(_0x3190e8){return _0x4004a9['status'](_0x4c86f6)[_0x073d('0x1a')](_0x3190e8);}};}function respondWithFilteredResult(_0x29cd4f,_0x28370d){return function(_0x418969){if(_0x418969){var _0x24adfa=typeof _0x28370d[_0x073d('0x1b')]===_0x073d('0x1c')&&typeof _0x28370d['limit']===_0x073d('0x1c');var _0x3b9177=_0x418969[_0x073d('0x1d')];var _0x36dee1=_0x24adfa?0x0:_0x28370d[_0x073d('0x1b')];var _0x5b0162=_0x24adfa?_0x418969[_0x073d('0x1d')]:_0x28370d[_0x073d('0x1b')]+_0x28370d[_0x073d('0x1e')];var _0x26e683;if(_0x5b0162>=_0x3b9177){_0x5b0162=_0x3b9177;_0x26e683=0xc8;}else{_0x26e683=0xce;}_0x29cd4f[_0x073d('0x18')](_0x26e683);return _0x29cd4f[_0x073d('0x1f')]('Content-Range',_0x36dee1+'-'+_0x5b0162+'/'+_0x3b9177)[_0x073d('0x1a')](_0x418969);}return null;};}function patchUpdates(_0x2b0190){return function(_0x5319cc){try{jsonpatch[_0x073d('0x20')](_0x5319cc,_0x2b0190,!![]);}catch(_0x5c3c74){return BPromise[_0x073d('0x21')](_0x5c3c74);}return _0x5319cc[_0x073d('0x22')]();};}function saveUpdates(_0x46cd79,_0x306165){return function(_0x1d5eed){if(_0x1d5eed){return _0x1d5eed[_0x073d('0x23')](_0x46cd79)[_0x073d('0x24')](function(_0x46c007){return _0x46c007;});}return null;};}function removeEntity(_0x34a665,_0x42f438){return function(_0xeb0bc7){if(_0xeb0bc7){return _0xeb0bc7['destroy']()['then'](function(){_0x34a665[_0x073d('0x18')](0xcc)[_0x073d('0x19')]();});}};}function handleEntityNotFound(_0x5da26d,_0x4710a4){return function(_0x5c4ff4){if(!_0x5c4ff4){_0x5da26d['sendStatus'](0x194);}return _0x5c4ff4;};}function handleError(_0x42de62,_0x35581f){_0x35581f=_0x35581f||0x1f4;return function(_0x5699f3){logger['error'](_0x5699f3[_0x073d('0x25')]);if(_0x5699f3[_0x073d('0x26')]){delete _0x5699f3[_0x073d('0x26')];}_0x42de62[_0x073d('0x18')](_0x35581f)[_0x073d('0x27')](_0x5699f3);};}exports[_0x073d('0x28')]=function(_0x1857fc,_0x175fd7){var _0x3a76db={},_0x9e304b={},_0x525ad8={'count':0x0,'rows':[]};var _0x1544f4=_[_0x073d('0x29')](db[_0x073d('0x2a')][_0x073d('0x2b')],function(_0x2bf81a){return{'name':_0x2bf81a['fieldName'],'type':_0x2bf81a[_0x073d('0x2c')][_0x073d('0x2d')]};});_0x9e304b[_0x073d('0x2e')]=_[_0x073d('0x29')](_0x1544f4,'name');_0x9e304b[_0x073d('0x2f')]=_[_0x073d('0x30')](_0x1857fc[_0x073d('0x2f')]);_0x9e304b['filters']=_['intersection'](_0x9e304b[_0x073d('0x2e')],_0x9e304b[_0x073d('0x2f')]);_0x3a76db['attributes']=_[_0x073d('0x31')](_0x9e304b[_0x073d('0x2e')],qs[_0x073d('0x32')](_0x1857fc[_0x073d('0x2f')][_0x073d('0x32')]));_0x3a76db[_0x073d('0x33')]=_0x3a76db['attributes'][_0x073d('0x34')]?_0x3a76db[_0x073d('0x33')]:_0x9e304b[_0x073d('0x2e')];if(!_0x1857fc['query'][_0x073d('0x35')](_0x073d('0x36'))){_0x3a76db[_0x073d('0x1e')]=qs[_0x073d('0x1e')](_0x1857fc[_0x073d('0x2f')]['limit']);_0x3a76db['offset']=qs['offset'](_0x1857fc['query'][_0x073d('0x1b')]);}_0x3a76db[_0x073d('0x37')]=qs[_0x073d('0x38')](_0x1857fc[_0x073d('0x2f')][_0x073d('0x38')]);_0x3a76db['where']=qs[_0x073d('0x39')](_[_0x073d('0x3a')](_0x1857fc[_0x073d('0x2f')],_0x9e304b[_0x073d('0x39')]),_0x1544f4);if(_0x1857fc[_0x073d('0x2f')][_0x073d('0x3b')]){_0x3a76db[_0x073d('0x3c')]=_['merge'](_0x3a76db['where'],{'$or':_['map'](_0x1544f4,function(_0x5332b4){if(_0x5332b4[_0x073d('0x2c')]!=='VIRTUAL'){var _0x3289fd={};_0x3289fd[_0x5332b4[_0x073d('0x26')]]={'$like':'%'+_0x1857fc[_0x073d('0x2f')][_0x073d('0x3b')]+'%'};return _0x3289fd;}})});}_0x3a76db=_[_0x073d('0x3d')]({},_0x3a76db,_0x1857fc[_0x073d('0x3e')]);var _0x248e83={'where':_0x3a76db[_0x073d('0x3c')]};return db['SquareReport'][_0x073d('0x1d')](_0x248e83)[_0x073d('0x24')](function(_0x3101da){_0x525ad8[_0x073d('0x1d')]=_0x3101da;if(_0x1857fc['query'][_0x073d('0x3f')]){_0x3a76db['include']=[{'all':!![]}];}return db[_0x073d('0x2a')][_0x073d('0x40')](_0x3a76db);})[_0x073d('0x24')](function(_0x6055a4){_0x525ad8[_0x073d('0x41')]=_0x6055a4;return _0x525ad8;})['then'](respondWithFilteredResult(_0x175fd7,_0x3a76db))[_0x073d('0x42')](handleError(_0x175fd7,null));};exports[_0x073d('0x43')]=function(_0x91ce90,_0x3e5ff2){var _0x1acdb8={'raw':!![],'where':{'id':_0x91ce90[_0x073d('0x44')]['id']}},_0x28019c={};_0x28019c[_0x073d('0x2e')]=_[_0x073d('0x30')](db[_0x073d('0x2a')][_0x073d('0x2b')]);_0x28019c['query']=_['keys'](_0x91ce90['query']);_0x28019c[_0x073d('0x39')]=_['intersection'](_0x28019c[_0x073d('0x2e')],_0x28019c[_0x073d('0x2f')]);_0x1acdb8['attributes']=_[_0x073d('0x31')](_0x28019c['model'],qs[_0x073d('0x32')](_0x91ce90[_0x073d('0x2f')][_0x073d('0x32')]));_0x1acdb8[_0x073d('0x33')]=_0x1acdb8['attributes'][_0x073d('0x34')]?_0x1acdb8['attributes']:_0x28019c[_0x073d('0x2e')];if(_0x91ce90['query'][_0x073d('0x3f')]){_0x1acdb8[_0x073d('0x45')]=[{'all':!![]}];}_0x1acdb8=_[_0x073d('0x3d')]({},_0x1acdb8,_0x91ce90[_0x073d('0x3e')]);return db['SquareReport']['find'](_0x1acdb8)[_0x073d('0x24')](handleEntityNotFound(_0x3e5ff2,null))[_0x073d('0x24')](respondWithResult(_0x3e5ff2,null))[_0x073d('0x42')](handleError(_0x3e5ff2,null));};exports['create']=function(_0x1c83a1,_0x32b91e){return db['SquareReport'][_0x073d('0x46')](_0x1c83a1[_0x073d('0x47')],{})[_0x073d('0x24')](respondWithResult(_0x32b91e,0xc9))[_0x073d('0x42')](handleError(_0x32b91e,null));};exports[_0x073d('0x23')]=function(_0x42a2b3,_0xc598f9){if(_0x42a2b3['body']['id']){delete _0x42a2b3[_0x073d('0x47')]['id'];}return db[_0x073d('0x2a')][_0x073d('0x48')]({'where':{'id':_0x42a2b3[_0x073d('0x44')]['id']}})[_0x073d('0x24')](handleEntityNotFound(_0xc598f9,null))[_0x073d('0x24')](saveUpdates(_0x42a2b3['body'],null))[_0x073d('0x24')](respondWithResult(_0xc598f9,null))[_0x073d('0x42')](handleError(_0xc598f9,null));};exports[_0x073d('0x49')]=function(_0x49bdce,_0xd42d4a){return db[_0x073d('0x2a')][_0x073d('0x48')]({'where':{'id':_0x49bdce[_0x073d('0x44')]['id']}})[_0x073d('0x24')](handleEntityNotFound(_0xd42d4a,null))[_0x073d('0x24')](removeEntity(_0xd42d4a,null))[_0x073d('0x42')](handleError(_0xd42d4a,null));};exports['describe']=function(_0x37af5e,_0x4ee83e){return db[_0x073d('0x2a')][_0x073d('0x4a')]()['then'](respondWithResult(_0x4ee83e,null))['catch'](handleError(_0x4ee83e,null));}; \ No newline at end of file +var _0xab62=['Content-Range','json','apply','reject','update','destroy','then','name','send','index','map','SquareReport','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xab62,0x70));var _0x2ab6=function(_0x2a3fbf,_0x3dd0d4){_0x2a3fbf=_0x2a3fbf-0x0;var _0x5d9c95=_0xab62[_0x2a3fbf];return _0x5d9c95;};'use strict';var emlformat=require(_0x2ab6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2ab6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2ab6('0x2'));var moment=require(_0x2ab6('0x3'));var BPromise=require(_0x2ab6('0x4'));var Mustache=require(_0x2ab6('0x5'));var util=require('util');var path=require(_0x2ab6('0x6'));var sox=require(_0x2ab6('0x7'));var csv=require(_0x2ab6('0x8'));var ejs=require(_0x2ab6('0x9'));var fs=require('fs');var fs_extra=require(_0x2ab6('0xa'));var _=require(_0x2ab6('0xb'));var squel=require(_0x2ab6('0xc'));var crypto=require(_0x2ab6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2ab6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2ab6('0xf'));var Redis=require(_0x2ab6('0x10'));var authService=require(_0x2ab6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2ab6('0x12'));var hardwareService=require(_0x2ab6('0x13'));var logger=require(_0x2ab6('0x14'))(_0x2ab6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2ab6('0x16'));var db=require(_0x2ab6('0x17'))['db'];function respondWithStatusCode(_0x20bdff,_0x33cf62){_0x33cf62=_0x33cf62||0xcc;return function(_0x33334d){if(_0x33334d){return _0x20bdff[_0x2ab6('0x18')](_0x33cf62);}return _0x20bdff[_0x2ab6('0x19')](_0x33cf62)[_0x2ab6('0x1a')]();};}function respondWithResult(_0x37adc9,_0x74bc3d){_0x74bc3d=_0x74bc3d||0xc8;return function(_0x404f1b){if(_0x404f1b){return _0x37adc9[_0x2ab6('0x19')](_0x74bc3d)['json'](_0x404f1b);}};}function respondWithFilteredResult(_0x386de4,_0xbe8dc9){return function(_0x7eb9d8){if(_0x7eb9d8){var _0x5d4db4=typeof _0xbe8dc9[_0x2ab6('0x1b')]===_0x2ab6('0x1c')&&typeof _0xbe8dc9[_0x2ab6('0x1d')]==='undefined';var _0x5be6e4=_0x7eb9d8[_0x2ab6('0x1e')];var _0x2682d2=_0x5d4db4?0x0:_0xbe8dc9[_0x2ab6('0x1b')];var _0x1a995d=_0x5d4db4?_0x7eb9d8['count']:_0xbe8dc9['offset']+_0xbe8dc9[_0x2ab6('0x1d')];var _0xaf4512;if(_0x1a995d>=_0x5be6e4){_0x1a995d=_0x5be6e4;_0xaf4512=0xc8;}else{_0xaf4512=0xce;}_0x386de4[_0x2ab6('0x19')](_0xaf4512);return _0x386de4[_0x2ab6('0x1f')](_0x2ab6('0x20'),_0x2682d2+'-'+_0x1a995d+'/'+_0x5be6e4)[_0x2ab6('0x21')](_0x7eb9d8);}return null;};}function patchUpdates(_0x21a567){return function(_0x2a8944){try{jsonpatch[_0x2ab6('0x22')](_0x2a8944,_0x21a567,!![]);}catch(_0x2dc6b0){return BPromise[_0x2ab6('0x23')](_0x2dc6b0);}return _0x2a8944['save']();};}function saveUpdates(_0x50b90b,_0x16c604){return function(_0x2bafe2){if(_0x2bafe2){return _0x2bafe2[_0x2ab6('0x24')](_0x50b90b)['then'](function(_0x36398f){return _0x36398f;});}return null;};}function removeEntity(_0x5baa18,_0x11c3fd){return function(_0x15c907){if(_0x15c907){return _0x15c907[_0x2ab6('0x25')]()[_0x2ab6('0x26')](function(){_0x5baa18[_0x2ab6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17bcd5,_0x377d26){return function(_0x38e319){if(!_0x38e319){_0x17bcd5[_0x2ab6('0x18')](0x194);}return _0x38e319;};}function handleError(_0x1de6cb,_0x264f51){_0x264f51=_0x264f51||0x1f4;return function(_0x513bc1){logger['error'](_0x513bc1['stack']);if(_0x513bc1['name']){delete _0x513bc1[_0x2ab6('0x27')];}_0x1de6cb[_0x2ab6('0x19')](_0x264f51)[_0x2ab6('0x28')](_0x513bc1);};}exports[_0x2ab6('0x29')]=function(_0x120a95,_0x3947f8){var _0x5df16a={},_0x1e341c={},_0x33264b={'count':0x0,'rows':[]};var _0x5651a4=_[_0x2ab6('0x2a')](db[_0x2ab6('0x2b')][_0x2ab6('0x2c')],function(_0x19ae05){return{'name':_0x19ae05['fieldName'],'type':_0x19ae05[_0x2ab6('0x2d')][_0x2ab6('0x2e')]};});_0x1e341c[_0x2ab6('0x2f')]=_[_0x2ab6('0x2a')](_0x5651a4,_0x2ab6('0x27'));_0x1e341c[_0x2ab6('0x30')]=_['keys'](_0x120a95[_0x2ab6('0x30')]);_0x1e341c[_0x2ab6('0x31')]=_['intersection'](_0x1e341c[_0x2ab6('0x2f')],_0x1e341c['query']);_0x5df16a[_0x2ab6('0x32')]=_[_0x2ab6('0x33')](_0x1e341c[_0x2ab6('0x2f')],qs[_0x2ab6('0x34')](_0x120a95[_0x2ab6('0x30')][_0x2ab6('0x34')]));_0x5df16a['attributes']=_0x5df16a[_0x2ab6('0x32')][_0x2ab6('0x35')]?_0x5df16a[_0x2ab6('0x32')]:_0x1e341c['model'];if(!_0x120a95[_0x2ab6('0x30')]['hasOwnProperty'](_0x2ab6('0x36'))){_0x5df16a['limit']=qs[_0x2ab6('0x1d')](_0x120a95[_0x2ab6('0x30')][_0x2ab6('0x1d')]);_0x5df16a[_0x2ab6('0x1b')]=qs['offset'](_0x120a95[_0x2ab6('0x30')][_0x2ab6('0x1b')]);}_0x5df16a[_0x2ab6('0x37')]=qs[_0x2ab6('0x38')](_0x120a95[_0x2ab6('0x30')][_0x2ab6('0x38')]);_0x5df16a['where']=qs[_0x2ab6('0x31')](_['pick'](_0x120a95[_0x2ab6('0x30')],_0x1e341c['filters']),_0x5651a4);if(_0x120a95[_0x2ab6('0x30')][_0x2ab6('0x39')]){_0x5df16a[_0x2ab6('0x3a')]=_[_0x2ab6('0x3b')](_0x5df16a[_0x2ab6('0x3a')],{'$or':_['map'](_0x5651a4,function(_0x279b6e){if(_0x279b6e[_0x2ab6('0x2d')]!==_0x2ab6('0x3c')){var _0x32f3d3={};_0x32f3d3[_0x279b6e[_0x2ab6('0x27')]]={'$like':'%'+_0x120a95['query'][_0x2ab6('0x39')]+'%'};return _0x32f3d3;}})});}_0x5df16a=_['merge']({},_0x5df16a,_0x120a95[_0x2ab6('0x3d')]);var _0x48223b={'where':_0x5df16a[_0x2ab6('0x3a')]};return db[_0x2ab6('0x2b')][_0x2ab6('0x1e')](_0x48223b)[_0x2ab6('0x26')](function(_0x57355d){_0x33264b[_0x2ab6('0x1e')]=_0x57355d;if(_0x120a95[_0x2ab6('0x30')][_0x2ab6('0x3e')]){_0x5df16a[_0x2ab6('0x3f')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x5df16a);})[_0x2ab6('0x26')](function(_0x2e14a6){_0x33264b[_0x2ab6('0x40')]=_0x2e14a6;return _0x33264b;})[_0x2ab6('0x26')](respondWithFilteredResult(_0x3947f8,_0x5df16a))[_0x2ab6('0x41')](handleError(_0x3947f8,null));};exports['show']=function(_0x5bc099,_0x4db46c){var _0x33a980={'raw':!![],'where':{'id':_0x5bc099[_0x2ab6('0x42')]['id']}},_0x34d192={};_0x34d192[_0x2ab6('0x2f')]=_[_0x2ab6('0x43')](db[_0x2ab6('0x2b')][_0x2ab6('0x2c')]);_0x34d192[_0x2ab6('0x30')]=_[_0x2ab6('0x43')](_0x5bc099[_0x2ab6('0x30')]);_0x34d192[_0x2ab6('0x31')]=_[_0x2ab6('0x33')](_0x34d192[_0x2ab6('0x2f')],_0x34d192[_0x2ab6('0x30')]);_0x33a980[_0x2ab6('0x32')]=_[_0x2ab6('0x33')](_0x34d192[_0x2ab6('0x2f')],qs[_0x2ab6('0x34')](_0x5bc099[_0x2ab6('0x30')][_0x2ab6('0x34')]));_0x33a980[_0x2ab6('0x32')]=_0x33a980[_0x2ab6('0x32')][_0x2ab6('0x35')]?_0x33a980[_0x2ab6('0x32')]:_0x34d192[_0x2ab6('0x2f')];if(_0x5bc099[_0x2ab6('0x30')][_0x2ab6('0x3e')]){_0x33a980[_0x2ab6('0x3f')]=[{'all':!![]}];}_0x33a980=_['merge']({},_0x33a980,_0x5bc099[_0x2ab6('0x3d')]);return db[_0x2ab6('0x2b')]['find'](_0x33a980)[_0x2ab6('0x26')](handleEntityNotFound(_0x4db46c,null))['then'](respondWithResult(_0x4db46c,null))['catch'](handleError(_0x4db46c,null));};exports[_0x2ab6('0x44')]=function(_0x51a8db,_0x1be8df){return db[_0x2ab6('0x2b')][_0x2ab6('0x44')](_0x51a8db[_0x2ab6('0x45')],{})[_0x2ab6('0x26')](respondWithResult(_0x1be8df,0xc9))['catch'](handleError(_0x1be8df,null));};exports['update']=function(_0x32f3e2,_0x2d8fd7){if(_0x32f3e2[_0x2ab6('0x45')]['id']){delete _0x32f3e2[_0x2ab6('0x45')]['id'];}return db['SquareReport'][_0x2ab6('0x46')]({'where':{'id':_0x32f3e2[_0x2ab6('0x42')]['id']}})[_0x2ab6('0x26')](handleEntityNotFound(_0x2d8fd7,null))['then'](saveUpdates(_0x32f3e2['body'],null))[_0x2ab6('0x26')](respondWithResult(_0x2d8fd7,null))['catch'](handleError(_0x2d8fd7,null));};exports[_0x2ab6('0x25')]=function(_0x498073,_0x3f1b05){return db[_0x2ab6('0x2b')]['find']({'where':{'id':_0x498073[_0x2ab6('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f1b05,null))[_0x2ab6('0x26')](removeEntity(_0x3f1b05,null))[_0x2ab6('0x41')](handleError(_0x3f1b05,null));};exports['describe']=function(_0xa9403c,_0x4f7b81){return db[_0x2ab6('0x2b')][_0x2ab6('0x47')]()[_0x2ab6('0x26')](respondWithResult(_0x4f7b81,null))['catch'](handleError(_0x4f7b81,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index a38aa10..ca3061b 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 _0x3280=['uniqueid','project_name','leaveAt','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname'];(function(_0x5cc477,_0x2c237c){var _0x1a66e0=function(_0x381bf1){while(--_0x381bf1){_0x5cc477['push'](_0x5cc477['shift']());}};_0x1a66e0(++_0x2c237c);}(_0x3280,0x83));var _0x0328=function(_0x49d280,_0x33d68f){_0x49d280=_0x49d280-0x0;var _0x25274a=_0x3280[_0x49d280];return _0x25274a;};'use strict';var _=require(_0x0328('0x0'));var util=require('util');var logger=require(_0x0328('0x1'))(_0x0328('0x2'));var moment=require('moment');var BPromise=require(_0x0328('0x3'));var rp=require(_0x0328('0x4'));var fs=require('fs');var path=require(_0x0328('0x5'));var rimraf=require(_0x0328('0x6'));var config=require('../../config/environment');var attributes=require(_0x0328('0x7'));module[_0x0328('0x8')]=function(_0x5aed5a,_0x5d472c){return _0x5aed5a[_0x0328('0x9')](_0x0328('0xa'),attributes,{'tableName':_0x0328('0xb'),'paranoid':![],'indexes':[{'name':_0x0328('0xc'),'fields':[_0x0328('0xd'),_0x0328('0xe')]},{'name':_0x0328('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ac2=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt'];(function(_0x2fdf82,_0x322e7c){var _0x2382f5=function(_0x4d6951){while(--_0x4d6951){_0x2fdf82['push'](_0x2fdf82['shift']());}};_0x2382f5(++_0x322e7c);}(_0x1ac2,0xc0));var _0x21ac=function(_0x3f4b5f,_0x2ebd71){_0x3f4b5f=_0x3f4b5f-0x0;var _0x98fe52=_0x1ac2[_0x3f4b5f];return _0x98fe52;};'use strict';var _=require(_0x21ac('0x0'));var util=require(_0x21ac('0x1'));var logger=require('../../config/logger')(_0x21ac('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x21ac('0x3'));var fs=require('fs');var path=require(_0x21ac('0x4'));var rimraf=require(_0x21ac('0x5'));var config=require(_0x21ac('0x6'));var attributes=require(_0x21ac('0x7'));module[_0x21ac('0x8')]=function(_0x1dff25,_0x576d36){return _0x1dff25[_0x21ac('0x9')](_0x21ac('0xa'),attributes,{'tableName':_0x21ac('0xb'),'paranoid':![],'indexes':[{'name':_0x21ac('0xc'),'fields':[_0x21ac('0xd'),_0x21ac('0xe')]},{'name':_0x21ac('0xf'),'fields':[_0x21ac('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 b6f9be0..5768f83 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 _0x481c=['info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','CreateSquareReport','SquareReport','body','options','raw','stringify','UpdateSquareReport','where','attributes','limit','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','then'];(function(_0x25d71d,_0x14ddf9){var _0x4b4418=function(_0x17ce7a){while(--_0x17ce7a){_0x25d71d['push'](_0x25d71d['shift']());}};_0x4b4418(++_0x14ddf9);}(_0x481c,0x140));var _0xc481=function(_0x56d853,_0x3feb8d){_0x56d853=_0x56d853-0x0;var _0x5f201f=_0x481c[_0x56d853];return _0x5f201f;};'use strict';var _=require(_0xc481('0x0'));var util=require(_0xc481('0x1'));var moment=require('moment');var BPromise=require(_0xc481('0x2'));var rs=require(_0xc481('0x3'));var fs=require('fs');var Redis=require(_0xc481('0x4'));var db=require(_0xc481('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc481('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc481('0x7')][_0xc481('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e8dcc,_0x12cd0d,_0x3609de){return new BPromise(function(_0x126775,_0x1dd080){return client['request'](_0x4e8dcc,_0x3609de)[_0xc481('0x9')](function(_0x4b8d2f){logger[_0xc481('0xa')](_0xc481('0xb'),_0x12cd0d,'request\x20sent');logger[_0xc481('0xc')](_0xc481('0xd'),_0x12cd0d,'request\x20sent',JSON['stringify'](_0x4b8d2f));if(_0x4b8d2f[_0xc481('0xe')]){if(_0x4b8d2f['error'][_0xc481('0xf')]===0x1f4){logger[_0xc481('0xe')](_0xc481('0xb'),_0x12cd0d,_0x4b8d2f[_0xc481('0xe')]['message']);return _0x1dd080(_0x4b8d2f[_0xc481('0xe')][_0xc481('0x10')]);}logger[_0xc481('0xe')]('SquareReport,\x20%s,\x20%s',_0x12cd0d,_0x4b8d2f[_0xc481('0xe')][_0xc481('0x10')]);return _0x126775(_0x4b8d2f['error'][_0xc481('0x10')]);}else{logger[_0xc481('0xa')](_0xc481('0xb'),_0x12cd0d,_0xc481('0x11'));_0x126775(_0x4b8d2f[_0xc481('0x12')][_0xc481('0x10')]);}})['catch'](function(_0xed9619){logger['error'](_0xc481('0xb'),_0x12cd0d,_0xed9619);_0x1dd080(_0xed9619);});});}exports[_0xc481('0x13')]=function(_0x3e7ed7){var _0x1d5391=this;return new Promise(function(_0x310f3e,_0x242a95){return db[_0xc481('0x14')]['create'](_0x3e7ed7[_0xc481('0x15')],{'raw':_0x3e7ed7[_0xc481('0x16')]?_0x3e7ed7[_0xc481('0x16')][_0xc481('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x516795){logger[_0xc481('0xa')]('CreateSquareReport',_0x3e7ed7);logger[_0xc481('0xc')](_0xc481('0x13'),_0x3e7ed7,JSON[_0xc481('0x18')](_0x516795));_0x310f3e(_0x516795);})['catch'](function(_0x4fff54){logger[_0xc481('0xe')](_0xc481('0x13'),_0x4fff54['message'],_0x3e7ed7);_0x242a95(_0x1d5391[_0xc481('0xe')](0x1f4,_0x4fff54['message']));});});};exports[_0xc481('0x19')]=function(_0xeb3acb){var _0xc7c673=this;return new Promise(function(_0x39b258,_0x287fb9){return db[_0xc481('0x14')]['update'](_0xeb3acb[_0xc481('0x15')],{'raw':_0xeb3acb[_0xc481('0x16')]?_0xeb3acb['options'][_0xc481('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xeb3acb[_0xc481('0x16')]?_0xeb3acb[_0xc481('0x16')][_0xc481('0x1a')]||null:null,'attributes':_0xeb3acb[_0xc481('0x16')]?_0xeb3acb[_0xc481('0x16')][_0xc481('0x1b')]||null:null,'limit':_0xeb3acb[_0xc481('0x16')]?_0xeb3acb['options'][_0xc481('0x1c')]||null:null})[_0xc481('0x9')](function(_0x5379e1){logger[_0xc481('0xa')](_0xc481('0x19'),_0xeb3acb);logger[_0xc481('0xc')](_0xc481('0x19'),_0xeb3acb,JSON[_0xc481('0x18')](_0x5379e1));_0x39b258(_0x5379e1);})[_0xc481('0x1d')](function(_0x12f4b8){logger['error']('UpdateSquareReport',_0x12f4b8['message'],_0xeb3acb);_0x287fb9(_0xc7c673[_0xc481('0xe')](0x1f4,_0x12f4b8[_0xc481('0x10')]));});});}; \ No newline at end of file +var _0xfb04=['jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','update','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x406bd1,_0x1e8a7d){var _0xd72a82=function(_0x14a676){while(--_0x14a676){_0x406bd1['push'](_0x406bd1['shift']());}};_0xd72a82(++_0x1e8a7d);}(_0xfb04,0xd6));var _0x4fb0=function(_0x2f1ff8,_0x5d485c){_0x2f1ff8=_0x2f1ff8-0x0;var _0x15008a=_0xfb04[_0x2f1ff8];return _0x15008a;};'use strict';var _=require(_0x4fb0('0x0'));var util=require(_0x4fb0('0x1'));var moment=require(_0x4fb0('0x2'));var BPromise=require(_0x4fb0('0x3'));var rs=require(_0x4fb0('0x4'));var fs=require('fs');var Redis=require(_0x4fb0('0x5'));var db=require(_0x4fb0('0x6'))['db'];var utils=require(_0x4fb0('0x7'));var logger=require('../../config/logger')(_0x4fb0('0x8'));var config=require(_0x4fb0('0x9'));var jayson=require(_0x4fb0('0xa'));var client=jayson['client'][_0x4fb0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x234362,_0x1b8278,_0x5487bf){return new BPromise(function(_0x1d2a7d,_0x3299fb){return client[_0x4fb0('0xc')](_0x234362,_0x5487bf)[_0x4fb0('0xd')](function(_0x557f99){logger[_0x4fb0('0xe')](_0x4fb0('0xf'),_0x1b8278,_0x4fb0('0x10'));logger[_0x4fb0('0x11')](_0x4fb0('0x12'),_0x1b8278,_0x4fb0('0x10'),JSON[_0x4fb0('0x13')](_0x557f99));if(_0x557f99['error']){if(_0x557f99[_0x4fb0('0x14')]['code']===0x1f4){logger['error'](_0x4fb0('0xf'),_0x1b8278,_0x557f99[_0x4fb0('0x14')]['message']);return _0x3299fb(_0x557f99[_0x4fb0('0x14')]['message']);}logger[_0x4fb0('0x14')](_0x4fb0('0xf'),_0x1b8278,_0x557f99[_0x4fb0('0x14')][_0x4fb0('0x15')]);return _0x1d2a7d(_0x557f99[_0x4fb0('0x14')][_0x4fb0('0x15')]);}else{logger[_0x4fb0('0xe')](_0x4fb0('0xf'),_0x1b8278,_0x4fb0('0x10'));_0x1d2a7d(_0x557f99[_0x4fb0('0x16')][_0x4fb0('0x15')]);}})[_0x4fb0('0x17')](function(_0x5ad3fb){logger['error'](_0x4fb0('0xf'),_0x1b8278,_0x5ad3fb);_0x3299fb(_0x5ad3fb);});});}exports[_0x4fb0('0x18')]=function(_0x12914b){var _0x594bf9=this;return new Promise(function(_0x5568ed,_0x305bef){return db[_0x4fb0('0x19')][_0x4fb0('0x1a')](_0x12914b[_0x4fb0('0x1b')],{'raw':_0x12914b[_0x4fb0('0x1c')]?_0x12914b[_0x4fb0('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x4fb0('0xd')](function(_0x57ce62){logger['info']('CreateSquareReport',_0x12914b);logger[_0x4fb0('0x11')]('CreateSquareReport',_0x12914b,JSON[_0x4fb0('0x13')](_0x57ce62));_0x5568ed(_0x57ce62);})['catch'](function(_0x17fa80){logger[_0x4fb0('0x14')]('CreateSquareReport',_0x17fa80['message'],_0x12914b);_0x305bef(_0x594bf9['error'](0x1f4,_0x17fa80[_0x4fb0('0x15')]));});});};exports[_0x4fb0('0x1d')]=function(_0x3d6fee){var _0x2234c8=this;return new Promise(function(_0x48ca48,_0x512a93){return db[_0x4fb0('0x19')][_0x4fb0('0x1e')](_0x3d6fee['body'],{'raw':_0x3d6fee['options']?_0x3d6fee[_0x4fb0('0x1c')][_0x4fb0('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d6fee[_0x4fb0('0x1c')]?_0x3d6fee['options']['where']||null:null,'attributes':_0x3d6fee['options']?_0x3d6fee['options']['attributes']||null:null,'limit':_0x3d6fee['options']?_0x3d6fee['options']['limit']||null:null})[_0x4fb0('0xd')](function(_0x11b69f){logger[_0x4fb0('0xe')](_0x4fb0('0x1d'),_0x3d6fee);logger[_0x4fb0('0x11')](_0x4fb0('0x1d'),_0x3d6fee,JSON[_0x4fb0('0x13')](_0x11b69f));_0x48ca48(_0x11b69f);})['catch'](function(_0x23ef0f){logger[_0x4fb0('0x14')](_0x4fb0('0x1d'),_0x23ef0f[_0x4fb0('0x15')],_0x3d6fee);_0x512a93(_0x2234c8[_0x4fb0('0x14')](0x1f4,_0x23ef0f[_0x4fb0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index f15d166..b9295c9 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 _0x38fa=['isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','Router','../../components/auth/service','../../config/environment','get'];(function(_0x442f5b,_0x39d79d){var _0x19fd96=function(_0x419b3f){while(--_0x419b3f){_0x442f5b['push'](_0x442f5b['shift']());}};_0x19fd96(++_0x39d79d);}(_0x38fa,0x171));var _0xa38f=function(_0x56c3aa,_0x213575){_0x56c3aa=_0x56c3aa-0x0;var _0x2ac297=_0x38fa[_0x56c3aa];return _0x2ac297;};'use strict';var multer=require(_0xa38f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa38f('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xa38f('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xa38f('0x3'));var controller=require('./squareReportDetail.controller');router[_0xa38f('0x4')]('/',auth[_0xa38f('0x5')](),controller[_0xa38f('0x6')]);router[_0xa38f('0x4')](_0xa38f('0x7'),auth[_0xa38f('0x5')](),controller[_0xa38f('0x8')]);router['get'](_0xa38f('0x9'),auth[_0xa38f('0x5')](),controller[_0xa38f('0xa')]);router[_0xa38f('0xb')]('/',auth[_0xa38f('0x5')](),controller['create']);router[_0xa38f('0xc')]('/:id',auth[_0xa38f('0x5')](),controller[_0xa38f('0xd')]);router[_0xa38f('0xe')](_0xa38f('0x9'),auth[_0xa38f('0x5')](),controller[_0xa38f('0xf')]);module[_0xa38f('0x10')]=router; \ No newline at end of file +var _0x8238=['get','/describe','describe','/:id','show','post','put','update','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index'];(function(_0x391b1b,_0x4e1154){var _0x5a4b57=function(_0x226882){while(--_0x226882){_0x391b1b['push'](_0x391b1b['shift']());}};_0x5a4b57(++_0x4e1154);}(_0x8238,0xb4));var _0x8823=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8238[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x8823('0x0'));var util=require('util');var path=require(_0x8823('0x1'));var timeout=require(_0x8823('0x2'));var express=require('express');var router=express[_0x8823('0x3')]();var fs_extra=require(_0x8823('0x4'));var auth=require(_0x8823('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8823('0x6'));var controller=require(_0x8823('0x7'));router['get']('/',auth[_0x8823('0x8')](),controller[_0x8823('0x9')]);router[_0x8823('0xa')](_0x8823('0xb'),auth['isAuthenticated'](),controller[_0x8823('0xc')]);router['get'](_0x8823('0xd'),auth['isAuthenticated'](),controller[_0x8823('0xe')]);router[_0x8823('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8823('0x10')]('/:id',auth[_0x8823('0x8')](),controller[_0x8823('0x11')]);router['delete'](_0x8823('0xd'),auth[_0x8823('0x8')](),controller[_0x8823('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index c799027..6b12486 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 _0x55e0=['TEXT','sequelize','exports','STRING'];(function(_0x5147f0,_0x58a197){var _0x547de1=function(_0x45fbe7){while(--_0x45fbe7){_0x5147f0['push'](_0x5147f0['shift']());}};_0x547de1(++_0x58a197);}(_0x55e0,0x131));var _0x055e=function(_0x198e46,_0x14a36e){_0x198e46=_0x198e46-0x0;var _0x4f7300=_0x55e0[_0x198e46];return _0x4f7300;};'use strict';var Sequelize=require(_0x055e('0x0'));module[_0x055e('0x1')]={'uniqueid':{'type':Sequelize[_0x055e('0x2')]},'node':{'type':Sequelize[_0x055e('0x2')]},'application':{'type':Sequelize[_0x055e('0x2')]},'data':{'type':Sequelize[_0x055e('0x3')]},'project_name':{'type':Sequelize[_0x055e('0x2')]},'callerid':{'type':Sequelize[_0x055e('0x2')]}}; \ No newline at end of file +var _0xa363=['STRING','TEXT','sequelize','exports'];(function(_0x277e15,_0x39d3e6){var _0x52cd01=function(_0x5f3662){while(--_0x5f3662){_0x277e15['push'](_0x277e15['shift']());}};_0x52cd01(++_0x39d3e6);}(_0xa363,0x142));var _0x3a36=function(_0x16957f,_0x33143b){_0x16957f=_0x16957f-0x0;var _0x155bf0=_0xa363[_0x16957f];return _0x155bf0;};'use strict';var Sequelize=require(_0x3a36('0x0'));module[_0x3a36('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x3a36('0x2')]},'application':{'type':Sequelize[_0x3a36('0x2')]},'data':{'type':Sequelize[_0x3a36('0x3')]},'project_name':{'type':Sequelize[_0x3a36('0x2')]},'callerid':{'type':Sequelize[_0x3a36('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index ac872fc..edd81c4 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 _0xeaa2=['eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeaa2,0xd5));var _0x2eaa=function(_0x5426d0,_0x4a4f10){_0x5426d0=_0x5426d0-0x0;var _0x37be89=_0xeaa2[_0x5426d0];return _0x37be89;};'use strict';var emlformat=require(_0x2eaa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2eaa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2eaa('0x2'));var BPromise=require(_0x2eaa('0x3'));var Mustache=require(_0x2eaa('0x4'));var util=require('util');var path=require(_0x2eaa('0x5'));var sox=require('sox');var csv=require(_0x2eaa('0x6'));var ejs=require(_0x2eaa('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2eaa('0x8'));var crypto=require(_0x2eaa('0x9'));var jsforce=require(_0x2eaa('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2eaa('0x6'));var querystring=require(_0x2eaa('0xb'));var Papa=require(_0x2eaa('0xc'));var Redis=require(_0x2eaa('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2eaa('0xe'));var as=require(_0x2eaa('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2eaa('0x10'))(_0x2eaa('0x11'));var utils=require(_0x2eaa('0x12'));var config=require(_0x2eaa('0x13'));var licenseUtil=require(_0x2eaa('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a7b0b,_0x5ae08e){_0x5ae08e=_0x5ae08e||0xcc;return function(_0x27dcc5){if(_0x27dcc5){return _0x4a7b0b[_0x2eaa('0x15')](_0x5ae08e);}return _0x4a7b0b['status'](_0x5ae08e)[_0x2eaa('0x16')]();};}function respondWithResult(_0x5959bf,_0x567d5f){_0x567d5f=_0x567d5f||0xc8;return function(_0x5f082a){if(_0x5f082a){return _0x5959bf['status'](_0x567d5f)['json'](_0x5f082a);}};}function respondWithFilteredResult(_0xa3d36d,_0x292181){return function(_0x46ddd8){if(_0x46ddd8){var _0x4a2b8e=typeof _0x292181[_0x2eaa('0x17')]===_0x2eaa('0x18')&&typeof _0x292181[_0x2eaa('0x19')]===_0x2eaa('0x18');var _0x494574=_0x46ddd8[_0x2eaa('0x1a')];var _0x40e455=_0x4a2b8e?0x0:_0x292181[_0x2eaa('0x17')];var _0x3882eb=_0x4a2b8e?_0x46ddd8[_0x2eaa('0x1a')]:_0x292181[_0x2eaa('0x17')]+_0x292181[_0x2eaa('0x19')];var _0xa60413;if(_0x3882eb>=_0x494574){_0x3882eb=_0x494574;_0xa60413=0xc8;}else{_0xa60413=0xce;}_0xa3d36d[_0x2eaa('0x1b')](_0xa60413);return _0xa3d36d[_0x2eaa('0x1c')]('Content-Range',_0x40e455+'-'+_0x3882eb+'/'+_0x494574)['json'](_0x46ddd8);}return null;};}function patchUpdates(_0x32ad7e){return function(_0x386882){try{jsonpatch[_0x2eaa('0x1d')](_0x386882,_0x32ad7e,!![]);}catch(_0x5dde97){return BPromise[_0x2eaa('0x1e')](_0x5dde97);}return _0x386882['save']();};}function saveUpdates(_0x350334,_0x1c10de){return function(_0x5373e5){if(_0x5373e5){return _0x5373e5[_0x2eaa('0x1f')](_0x350334)[_0x2eaa('0x20')](function(_0x239f0e){return _0x239f0e;});}return null;};}function removeEntity(_0xc90fce,_0x4bf3dc){return function(_0x192f40){if(_0x192f40){return _0x192f40[_0x2eaa('0x21')]()[_0x2eaa('0x20')](function(){_0xc90fce['status'](0xcc)[_0x2eaa('0x16')]();});}};}function handleEntityNotFound(_0x2a37ea,_0x387ee1){return function(_0x2d1206){if(!_0x2d1206){_0x2a37ea[_0x2eaa('0x15')](0x194);}return _0x2d1206;};}function handleError(_0x33234f,_0x5e8f1f){_0x5e8f1f=_0x5e8f1f||0x1f4;return function(_0x2f9dcd){logger[_0x2eaa('0x22')](_0x2f9dcd[_0x2eaa('0x23')]);if(_0x2f9dcd[_0x2eaa('0x24')]){delete _0x2f9dcd[_0x2eaa('0x24')];}_0x33234f[_0x2eaa('0x1b')](_0x5e8f1f)[_0x2eaa('0x25')](_0x2f9dcd);};}exports[_0x2eaa('0x26')]=function(_0xd6e896,_0x331ed5){var _0x229803={},_0x1df61b={},_0x131e06={'count':0x0,'rows':[]};var _0x80e0fa=_[_0x2eaa('0x27')](db[_0x2eaa('0x28')]['rawAttributes'],function(_0x120a32){return{'name':_0x120a32[_0x2eaa('0x29')],'type':_0x120a32[_0x2eaa('0x2a')][_0x2eaa('0x2b')]};});_0x1df61b['model']=_[_0x2eaa('0x27')](_0x80e0fa,_0x2eaa('0x24'));_0x1df61b[_0x2eaa('0x2c')]=_[_0x2eaa('0x2d')](_0xd6e896[_0x2eaa('0x2c')]);_0x1df61b['filters']=_['intersection'](_0x1df61b[_0x2eaa('0x2e')],_0x1df61b[_0x2eaa('0x2c')]);_0x229803['attributes']=_[_0x2eaa('0x2f')](_0x1df61b['model'],qs[_0x2eaa('0x30')](_0xd6e896[_0x2eaa('0x2c')]['fields']));_0x229803['attributes']=_0x229803[_0x2eaa('0x31')][_0x2eaa('0x32')]?_0x229803[_0x2eaa('0x31')]:_0x1df61b['model'];if(!_0xd6e896[_0x2eaa('0x2c')][_0x2eaa('0x33')](_0x2eaa('0x34'))){_0x229803['limit']=qs[_0x2eaa('0x19')](_0xd6e896[_0x2eaa('0x2c')][_0x2eaa('0x19')]);_0x229803[_0x2eaa('0x17')]=qs['offset'](_0xd6e896['query'][_0x2eaa('0x17')]);}_0x229803['order']=qs[_0x2eaa('0x35')](_0xd6e896[_0x2eaa('0x2c')][_0x2eaa('0x35')]);_0x229803[_0x2eaa('0x36')]=qs['filters'](_[_0x2eaa('0x37')](_0xd6e896['query'],_0x1df61b[_0x2eaa('0x38')]),_0x80e0fa);if(_0xd6e896[_0x2eaa('0x2c')][_0x2eaa('0x39')]){_0x229803['where']=_[_0x2eaa('0x3a')](_0x229803['where'],{'$or':_[_0x2eaa('0x27')](_0x80e0fa,function(_0x239086){if(_0x239086[_0x2eaa('0x2a')]!=='VIRTUAL'){var _0x14b9a3={};_0x14b9a3[_0x239086['name']]={'$like':'%'+_0xd6e896[_0x2eaa('0x2c')][_0x2eaa('0x39')]+'%'};return _0x14b9a3;}})});}_0x229803=_[_0x2eaa('0x3a')]({},_0x229803,_0xd6e896[_0x2eaa('0x3b')]);var _0x580940={'where':_0x229803[_0x2eaa('0x36')]};return db[_0x2eaa('0x28')][_0x2eaa('0x1a')](_0x580940)['then'](function(_0x591c4f){_0x131e06[_0x2eaa('0x1a')]=_0x591c4f;if(_0xd6e896[_0x2eaa('0x2c')][_0x2eaa('0x3c')]){_0x229803[_0x2eaa('0x3d')]=[{'all':!![]}];}return db[_0x2eaa('0x28')][_0x2eaa('0x3e')](_0x229803);})[_0x2eaa('0x20')](function(_0x5074e0){_0x131e06[_0x2eaa('0x3f')]=_0x5074e0;return _0x131e06;})[_0x2eaa('0x20')](respondWithFilteredResult(_0x331ed5,_0x229803))[_0x2eaa('0x40')](handleError(_0x331ed5,null));};exports[_0x2eaa('0x41')]=function(_0x4db065,_0x5c0ab0){var _0x1042a8={'raw':!![],'where':{'id':_0x4db065[_0x2eaa('0x42')]['id']}},_0x28d48c={};_0x28d48c['model']=_[_0x2eaa('0x2d')](db[_0x2eaa('0x28')]['rawAttributes']);_0x28d48c[_0x2eaa('0x2c')]=_['keys'](_0x4db065['query']);_0x28d48c['filters']=_['intersection'](_0x28d48c[_0x2eaa('0x2e')],_0x28d48c['query']);_0x1042a8[_0x2eaa('0x31')]=_[_0x2eaa('0x2f')](_0x28d48c[_0x2eaa('0x2e')],qs[_0x2eaa('0x30')](_0x4db065['query'][_0x2eaa('0x30')]));_0x1042a8[_0x2eaa('0x31')]=_0x1042a8[_0x2eaa('0x31')][_0x2eaa('0x32')]?_0x1042a8[_0x2eaa('0x31')]:_0x28d48c[_0x2eaa('0x2e')];if(_0x4db065[_0x2eaa('0x2c')][_0x2eaa('0x3c')]){_0x1042a8[_0x2eaa('0x3d')]=[{'all':!![]}];}_0x1042a8=_[_0x2eaa('0x3a')]({},_0x1042a8,_0x4db065[_0x2eaa('0x3b')]);return db[_0x2eaa('0x28')][_0x2eaa('0x43')](_0x1042a8)[_0x2eaa('0x20')](handleEntityNotFound(_0x5c0ab0,null))[_0x2eaa('0x20')](respondWithResult(_0x5c0ab0,null))[_0x2eaa('0x40')](handleError(_0x5c0ab0,null));};exports['create']=function(_0x563fee,_0x19fb56){return db[_0x2eaa('0x28')][_0x2eaa('0x44')](_0x563fee['body'],{})[_0x2eaa('0x20')](respondWithResult(_0x19fb56,0xc9))['catch'](handleError(_0x19fb56,null));};exports[_0x2eaa('0x1f')]=function(_0x546907,_0x54e099){if(_0x546907[_0x2eaa('0x45')]['id']){delete _0x546907[_0x2eaa('0x45')]['id'];}return db[_0x2eaa('0x28')]['find']({'where':{'id':_0x546907['params']['id']}})['then'](handleEntityNotFound(_0x54e099,null))['then'](saveUpdates(_0x546907[_0x2eaa('0x45')],null))[_0x2eaa('0x20')](respondWithResult(_0x54e099,null))[_0x2eaa('0x40')](handleError(_0x54e099,null));};exports['destroy']=function(_0x56d388,_0x11b2f9){return db[_0x2eaa('0x28')]['find']({'where':{'id':_0x56d388[_0x2eaa('0x42')]['id']}})[_0x2eaa('0x20')](handleEntityNotFound(_0x11b2f9,null))[_0x2eaa('0x20')](removeEntity(_0x11b2f9,null))[_0x2eaa('0x40')](handleError(_0x11b2f9,null));};exports[_0x2eaa('0x46')]=function(_0x3194a8,_0x579a1b){return db[_0x2eaa('0x28')][_0x2eaa('0x46')]()[_0x2eaa('0x20')](respondWithResult(_0x579a1b,null))['catch'](handleError(_0x579a1b,null));}; \ No newline at end of file +var _0x1ae0=['update','then','destroy','error','stack','name','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','catch','create','body','describe','eml-format','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/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','undefined','count','limit','set','apply','reject','save'];(function(_0x2d1a78,_0x15bc95){var _0x37ac99=function(_0x323211){while(--_0x323211){_0x2d1a78['push'](_0x2d1a78['shift']());}};_0x37ac99(++_0x15bc95);}(_0x1ae0,0xc8));var _0x01ae=function(_0x353a35,_0x1cf2bc){_0x353a35=_0x353a35-0x0;var _0x557ed2=_0x1ae0[_0x353a35];return _0x557ed2;};'use strict';var emlformat=require(_0x01ae('0x0'));var rimraf=require(_0x01ae('0x1'));var zipdir=require(_0x01ae('0x2'));var jsonpatch=require(_0x01ae('0x3'));var rp=require(_0x01ae('0x4'));var moment=require(_0x01ae('0x5'));var BPromise=require(_0x01ae('0x6'));var Mustache=require(_0x01ae('0x7'));var util=require(_0x01ae('0x8'));var path=require(_0x01ae('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x01ae('0xa'));var fs=require('fs');var fs_extra=require(_0x01ae('0xb'));var _=require(_0x01ae('0xc'));var squel=require(_0x01ae('0xd'));var crypto=require(_0x01ae('0xe'));var jsforce=require(_0x01ae('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x01ae('0x10'));var querystring=require('querystring');var Papa=require(_0x01ae('0x11'));var Redis=require(_0x01ae('0x12'));var authService=require(_0x01ae('0x13'));var qs=require(_0x01ae('0x14'));var as=require(_0x01ae('0x15'));var hardwareService=require(_0x01ae('0x16'));var logger=require(_0x01ae('0x17'))(_0x01ae('0x18'));var utils=require('../../config/utils');var config=require(_0x01ae('0x19'));var licenseUtil=require(_0x01ae('0x1a'));var db=require(_0x01ae('0x1b'))['db'];function respondWithStatusCode(_0x51c8a4,_0x461c39){_0x461c39=_0x461c39||0xcc;return function(_0x3d4a97){if(_0x3d4a97){return _0x51c8a4[_0x01ae('0x1c')](_0x461c39);}return _0x51c8a4[_0x01ae('0x1d')](_0x461c39)[_0x01ae('0x1e')]();};}function respondWithResult(_0x547662,_0x354ead){_0x354ead=_0x354ead||0xc8;return function(_0x526977){if(_0x526977){return _0x547662['status'](_0x354ead)[_0x01ae('0x1f')](_0x526977);}};}function respondWithFilteredResult(_0x598191,_0x1b72db){return function(_0x313e5c){if(_0x313e5c){var _0x4f4451=typeof _0x1b72db[_0x01ae('0x20')]==='undefined'&&typeof _0x1b72db['limit']===_0x01ae('0x21');var _0x3ce458=_0x313e5c[_0x01ae('0x22')];var _0x5c87e1=_0x4f4451?0x0:_0x1b72db[_0x01ae('0x20')];var _0x32e41a=_0x4f4451?_0x313e5c[_0x01ae('0x22')]:_0x1b72db[_0x01ae('0x20')]+_0x1b72db[_0x01ae('0x23')];var _0x41f8d1;if(_0x32e41a>=_0x3ce458){_0x32e41a=_0x3ce458;_0x41f8d1=0xc8;}else{_0x41f8d1=0xce;}_0x598191[_0x01ae('0x1d')](_0x41f8d1);return _0x598191[_0x01ae('0x24')]('Content-Range',_0x5c87e1+'-'+_0x32e41a+'/'+_0x3ce458)['json'](_0x313e5c);}return null;};}function patchUpdates(_0x5d0ca0){return function(_0x46c5f6){try{jsonpatch[_0x01ae('0x25')](_0x46c5f6,_0x5d0ca0,!![]);}catch(_0x1a10f5){return BPromise[_0x01ae('0x26')](_0x1a10f5);}return _0x46c5f6[_0x01ae('0x27')]();};}function saveUpdates(_0x119b2d,_0xcf704b){return function(_0x5bde6a){if(_0x5bde6a){return _0x5bde6a[_0x01ae('0x28')](_0x119b2d)[_0x01ae('0x29')](function(_0x5dcb41){return _0x5dcb41;});}return null;};}function removeEntity(_0x3d290a,_0x653005){return function(_0x39618c){if(_0x39618c){return _0x39618c[_0x01ae('0x2a')]()['then'](function(){_0x3d290a[_0x01ae('0x1d')](0xcc)[_0x01ae('0x1e')]();});}};}function handleEntityNotFound(_0x361d2f,_0x18f180){return function(_0x1e644d){if(!_0x1e644d){_0x361d2f[_0x01ae('0x1c')](0x194);}return _0x1e644d;};}function handleError(_0x2cbc25,_0x1aebd3){_0x1aebd3=_0x1aebd3||0x1f4;return function(_0x38c938){logger[_0x01ae('0x2b')](_0x38c938[_0x01ae('0x2c')]);if(_0x38c938[_0x01ae('0x2d')]){delete _0x38c938[_0x01ae('0x2d')];}_0x2cbc25[_0x01ae('0x1d')](_0x1aebd3)['send'](_0x38c938);};}exports[_0x01ae('0x2e')]=function(_0x5aeb23,_0x5c54e4){var _0x57252b={},_0x110dbc={},_0x2c3e79={'count':0x0,'rows':[]};var _0x57fd4c=_[_0x01ae('0x2f')](db[_0x01ae('0x30')][_0x01ae('0x31')],function(_0x6c7d){return{'name':_0x6c7d['fieldName'],'type':_0x6c7d[_0x01ae('0x32')][_0x01ae('0x33')]};});_0x110dbc[_0x01ae('0x34')]=_[_0x01ae('0x2f')](_0x57fd4c,_0x01ae('0x2d'));_0x110dbc[_0x01ae('0x35')]=_[_0x01ae('0x36')](_0x5aeb23['query']);_0x110dbc['filters']=_[_0x01ae('0x37')](_0x110dbc[_0x01ae('0x34')],_0x110dbc[_0x01ae('0x35')]);_0x57252b['attributes']=_[_0x01ae('0x37')](_0x110dbc[_0x01ae('0x34')],qs[_0x01ae('0x38')](_0x5aeb23[_0x01ae('0x35')]['fields']));_0x57252b['attributes']=_0x57252b[_0x01ae('0x39')][_0x01ae('0x3a')]?_0x57252b[_0x01ae('0x39')]:_0x110dbc['model'];if(!_0x5aeb23[_0x01ae('0x35')][_0x01ae('0x3b')](_0x01ae('0x3c'))){_0x57252b['limit']=qs[_0x01ae('0x23')](_0x5aeb23[_0x01ae('0x35')][_0x01ae('0x23')]);_0x57252b[_0x01ae('0x20')]=qs['offset'](_0x5aeb23[_0x01ae('0x35')][_0x01ae('0x20')]);}_0x57252b[_0x01ae('0x3d')]=qs[_0x01ae('0x3e')](_0x5aeb23[_0x01ae('0x35')][_0x01ae('0x3e')]);_0x57252b[_0x01ae('0x3f')]=qs[_0x01ae('0x40')](_[_0x01ae('0x41')](_0x5aeb23[_0x01ae('0x35')],_0x110dbc[_0x01ae('0x40')]),_0x57fd4c);if(_0x5aeb23['query'][_0x01ae('0x42')]){_0x57252b[_0x01ae('0x3f')]=_[_0x01ae('0x43')](_0x57252b[_0x01ae('0x3f')],{'$or':_[_0x01ae('0x2f')](_0x57fd4c,function(_0x5aadc5){if(_0x5aadc5['type']!==_0x01ae('0x44')){var _0x40fbba={};_0x40fbba[_0x5aadc5['name']]={'$like':'%'+_0x5aeb23[_0x01ae('0x35')]['filter']+'%'};return _0x40fbba;}})});}_0x57252b=_[_0x01ae('0x43')]({},_0x57252b,_0x5aeb23[_0x01ae('0x45')]);var _0x1bb7f4={'where':_0x57252b[_0x01ae('0x3f')]};return db[_0x01ae('0x30')][_0x01ae('0x22')](_0x1bb7f4)[_0x01ae('0x29')](function(_0x367ac9){_0x2c3e79[_0x01ae('0x22')]=_0x367ac9;if(_0x5aeb23[_0x01ae('0x35')]['includeAll']){_0x57252b[_0x01ae('0x46')]=[{'all':!![]}];}return db[_0x01ae('0x30')][_0x01ae('0x47')](_0x57252b);})['then'](function(_0x582ec1){_0x2c3e79[_0x01ae('0x48')]=_0x582ec1;return _0x2c3e79;})['then'](respondWithFilteredResult(_0x5c54e4,_0x57252b))['catch'](handleError(_0x5c54e4,null));};exports['show']=function(_0x58f900,_0xbbdf49){var _0x350342={'raw':!![],'where':{'id':_0x58f900[_0x01ae('0x49')]['id']}},_0x17cd30={};_0x17cd30[_0x01ae('0x34')]=_[_0x01ae('0x36')](db[_0x01ae('0x30')][_0x01ae('0x31')]);_0x17cd30['query']=_[_0x01ae('0x36')](_0x58f900[_0x01ae('0x35')]);_0x17cd30[_0x01ae('0x40')]=_[_0x01ae('0x37')](_0x17cd30[_0x01ae('0x34')],_0x17cd30[_0x01ae('0x35')]);_0x350342[_0x01ae('0x39')]=_[_0x01ae('0x37')](_0x17cd30[_0x01ae('0x34')],qs[_0x01ae('0x38')](_0x58f900[_0x01ae('0x35')][_0x01ae('0x38')]));_0x350342['attributes']=_0x350342[_0x01ae('0x39')][_0x01ae('0x3a')]?_0x350342[_0x01ae('0x39')]:_0x17cd30[_0x01ae('0x34')];if(_0x58f900[_0x01ae('0x35')][_0x01ae('0x4a')]){_0x350342[_0x01ae('0x46')]=[{'all':!![]}];}_0x350342=_[_0x01ae('0x43')]({},_0x350342,_0x58f900[_0x01ae('0x45')]);return db['SquareDetailsReport'][_0x01ae('0x4b')](_0x350342)['then'](handleEntityNotFound(_0xbbdf49,null))['then'](respondWithResult(_0xbbdf49,null))[_0x01ae('0x4c')](handleError(_0xbbdf49,null));};exports[_0x01ae('0x4d')]=function(_0x5a0fde,_0x5b3c1f){return db['SquareDetailsReport'][_0x01ae('0x4d')](_0x5a0fde[_0x01ae('0x4e')],{})[_0x01ae('0x29')](respondWithResult(_0x5b3c1f,0xc9))[_0x01ae('0x4c')](handleError(_0x5b3c1f,null));};exports[_0x01ae('0x28')]=function(_0x25abd7,_0xdaa19f){if(_0x25abd7[_0x01ae('0x4e')]['id']){delete _0x25abd7[_0x01ae('0x4e')]['id'];}return db[_0x01ae('0x30')][_0x01ae('0x4b')]({'where':{'id':_0x25abd7[_0x01ae('0x49')]['id']}})[_0x01ae('0x29')](handleEntityNotFound(_0xdaa19f,null))[_0x01ae('0x29')](saveUpdates(_0x25abd7[_0x01ae('0x4e')],null))[_0x01ae('0x29')](respondWithResult(_0xdaa19f,null))[_0x01ae('0x4c')](handleError(_0xdaa19f,null));};exports[_0x01ae('0x2a')]=function(_0x531c57,_0x3ecae4){return db['SquareDetailsReport'][_0x01ae('0x4b')]({'where':{'id':_0x531c57[_0x01ae('0x49')]['id']}})[_0x01ae('0x29')](handleEntityNotFound(_0x3ecae4,null))[_0x01ae('0x29')](removeEntity(_0x3ecae4,null))['catch'](handleError(_0x3ecae4,null));};exports[_0x01ae('0x4f')]=function(_0x40c889,_0x42ca35){return db[_0x01ae('0x30')][_0x01ae('0x4f')]()[_0x01ae('0x29')](respondWithResult(_0x42ca35,null))[_0x01ae('0x4c')](handleError(_0x42ca35,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 4584a9f..977586d 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 _0xcc78=['SquareDetailsReport','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','define'];(function(_0x1d00b8,_0x58d541){var _0x43b805=function(_0x4a972e){while(--_0x4a972e){_0x1d00b8['push'](_0x1d00b8['shift']());}};_0x43b805(++_0x58d541);}(_0xcc78,0x64));var _0x8cc7=function(_0x10807e,_0x2bba67){_0x10807e=_0x10807e-0x0;var _0xa69618=_0xcc78[_0x10807e];return _0xa69618;};'use strict';var _=require(_0x8cc7('0x0'));var util=require('util');var logger=require(_0x8cc7('0x1'))(_0x8cc7('0x2'));var moment=require('moment');var BPromise=require(_0x8cc7('0x3'));var rp=require(_0x8cc7('0x4'));var fs=require('fs');var path=require(_0x8cc7('0x5'));var rimraf=require('rimraf');var config=require(_0x8cc7('0x6'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x3c53e0,_0x11dc93){return _0x3c53e0[_0x8cc7('0x7')](_0x8cc7('0x8'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eff=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','lodash','util','moment','bluebird'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x2eff,0xd4));var _0xf2ef=function(_0x14e7a3,_0x4f853c){_0x14e7a3=_0x14e7a3-0x0;var _0x40380a=_0x2eff[_0x14e7a3];return _0x40380a;};'use strict';var _=require(_0xf2ef('0x0'));var util=require(_0xf2ef('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf2ef('0x2'));var BPromise=require(_0xf2ef('0x3'));var rp=require(_0xf2ef('0x4'));var fs=require('fs');var path=require(_0xf2ef('0x5'));var rimraf=require(_0xf2ef('0x6'));var config=require(_0xf2ef('0x7'));var attributes=require(_0xf2ef('0x8'));module[_0xf2ef('0x9')]=function(_0x390cd9,_0x138b75){return _0x390cd9['define'](_0xf2ef('0xa'),attributes,{'tableName':_0xf2ef('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 59a5042..06d0f3b 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 _0xdc91=['create','body','options','raw','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport'];(function(_0x25d0c0,_0x36d327){var _0x15c24a=function(_0x581553){while(--_0x581553){_0x25d0c0['push'](_0x25d0c0['shift']());}};_0x15c24a(++_0x36d327);}(_0xdc91,0x8b));var _0x1dc9=function(_0x9ffdd8,_0x414bbd){_0x9ffdd8=_0x9ffdd8-0x0;var _0x222710=_0xdc91[_0x9ffdd8];return _0x222710;};'use strict';var _=require(_0x1dc9('0x0'));var util=require(_0x1dc9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dc9('0x2'))['db'];var utils=require(_0x1dc9('0x3'));var logger=require(_0x1dc9('0x4'))(_0x1dc9('0x5'));var config=require(_0x1dc9('0x6'));var jayson=require(_0x1dc9('0x7'));var client=jayson[_0x1dc9('0x8')][_0x1dc9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ac058,_0x2c6e6c,_0x25a752){return new BPromise(function(_0x316995,_0x3d1772){return client[_0x1dc9('0xa')](_0x5ac058,_0x25a752)[_0x1dc9('0xb')](function(_0x43c405){logger[_0x1dc9('0xc')](_0x1dc9('0xd'),_0x2c6e6c,_0x1dc9('0xe'));logger['debug'](_0x1dc9('0xf'),_0x2c6e6c,'request\x20sent',JSON[_0x1dc9('0x10')](_0x43c405));if(_0x43c405['error']){if(_0x43c405[_0x1dc9('0x11')][_0x1dc9('0x12')]===0x1f4){logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x43c405['error'][_0x1dc9('0x13')]);return _0x3d1772(_0x43c405[_0x1dc9('0x11')]['message']);}logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x43c405['error']['message']);return _0x316995(_0x43c405[_0x1dc9('0x11')][_0x1dc9('0x13')]);}else{logger[_0x1dc9('0xc')](_0x1dc9('0xd'),_0x2c6e6c,'request\x20sent');_0x316995(_0x43c405['result'][_0x1dc9('0x13')]);}})[_0x1dc9('0x14')](function(_0x5cccb9){logger[_0x1dc9('0x11')](_0x1dc9('0xd'),_0x2c6e6c,_0x5cccb9);_0x3d1772(_0x5cccb9);});});}exports[_0x1dc9('0x15')]=function(_0x197bcd){var _0x335590=this;return new Promise(function(_0x1e845a,_0x2442d0){return db[_0x1dc9('0x16')][_0x1dc9('0x17')](_0x197bcd[_0x1dc9('0x18')],{'raw':_0x197bcd[_0x1dc9('0x19')]?_0x197bcd[_0x1dc9('0x19')][_0x1dc9('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x49bd5b){logger[_0x1dc9('0xc')]('CreateSquareDetailsReport',_0x197bcd);logger['debug']('CreateSquareDetailsReport',_0x197bcd,JSON[_0x1dc9('0x10')](_0x49bd5b));_0x1e845a(_0x49bd5b);})[_0x1dc9('0x14')](function(_0x277499){logger[_0x1dc9('0x11')](_0x1dc9('0x15'),_0x277499[_0x1dc9('0x13')],_0x197bcd);_0x2442d0(_0x335590[_0x1dc9('0x11')](0x1f4,_0x277499['message']));});});}; \ No newline at end of file +var _0x9f4d=['options','CreateSquareDetailsReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareDetailsReport','create','body'];(function(_0x441014,_0x222e94){var _0x174974=function(_0x441c6f){while(--_0x441c6f){_0x441014['push'](_0x441014['shift']());}};_0x174974(++_0x222e94);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x257896,_0x8de612){_0x257896=_0x257896-0x0;var _0x1ff242=_0x9f4d[_0x257896];return _0x1ff242;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var moment=require(_0xd9f4('0x2'));var BPromise=require(_0xd9f4('0x3'));var rs=require(_0xd9f4('0x4'));var fs=require('fs');var Redis=require(_0xd9f4('0x5'));var db=require(_0xd9f4('0x6'))['db'];var utils=require(_0xd9f4('0x7'));var logger=require(_0xd9f4('0x8'))('rpc');var config=require(_0xd9f4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd9f4('0xa')][_0xd9f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cc036,_0x366b9d,_0x5cf448){return new BPromise(function(_0x6b13b5,_0x18305f){return client['request'](_0x2cc036,_0x5cf448)[_0xd9f4('0xc')](function(_0x47d52f){logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));logger[_0xd9f4('0x10')](_0xd9f4('0x11'),_0x366b9d,'request\x20sent',JSON[_0xd9f4('0x12')](_0x47d52f));if(_0x47d52f[_0xd9f4('0x13')]){if(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x14')]===0x1f4){logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x18305f(_0x47d52f['error'][_0xd9f4('0x15')]);}logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x6b13b5(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);}else{logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));_0x6b13b5(_0x47d52f[_0xd9f4('0x16')][_0xd9f4('0x15')]);}})[_0xd9f4('0x17')](function(_0x5e7da1){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x366b9d,_0x5e7da1);_0x18305f(_0x5e7da1);});});}exports['CreateSquareDetailsReport']=function(_0x25a7fe){var _0x2d7cb2=this;return new Promise(function(_0xc01934,_0x4a5ecf){return db[_0xd9f4('0x18')][_0xd9f4('0x19')](_0x25a7fe[_0xd9f4('0x1a')],{'raw':_0x25a7fe['options']?_0x25a7fe[_0xd9f4('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xd9f4('0xc')](function(_0x93e8df){logger[_0xd9f4('0xd')]('CreateSquareDetailsReport',_0x25a7fe);logger[_0xd9f4('0x10')](_0xd9f4('0x1c'),_0x25a7fe,JSON['stringify'](_0x93e8df));_0xc01934(_0x93e8df);})['catch'](function(_0x7196ab){logger['error'](_0xd9f4('0x1c'),_0x7196ab[_0xd9f4('0x15')],_0x25a7fe);_0x4a5ecf(_0x2d7cb2[_0xd9f4('0x13')](0x1f4,_0x7196ab[_0xd9f4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 384f9aa..3746b92 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 _0xda82=['./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess','exports','Router','../../components/auth/service'];(function(_0x5d6483,_0x16c777){var _0x8ce268=function(_0x2a1d87){while(--_0x2a1d87){_0x5d6483['push'](_0x5d6483['shift']());}};_0x8ce268(++_0x16c777);}(_0xda82,0x142));var _0x2da8=function(_0x5b5043,_0x5a0820){_0x5b5043=_0x5b5043-0x0;var _0x57699f=_0xda82[_0x5b5043];return _0x57699f;};'use strict';var express=require('express');var router=express[_0x2da8('0x0')]();var auth=require(_0x2da8('0x1'));var controller=require(_0x2da8('0x2'));router[_0x2da8('0x3')]('/',auth['isAuthenticated'](),controller[_0x2da8('0x4')]);router[_0x2da8('0x3')](_0x2da8('0x5'),auth[_0x2da8('0x6')](),controller[_0x2da8('0x7')]);module[_0x2da8('0x8')]=router; \ No newline at end of file +var _0x7a63=['killProcess','exports','Router','../../components/auth/service','get','index'];(function(_0x2c0e63,_0x2efe0a){var _0x9845e3=function(_0x421b59){while(--_0x421b59){_0x2c0e63['push'](_0x2c0e63['shift']());}};_0x9845e3(++_0x2efe0a);}(_0x7a63,0x8c));var _0x37a6=function(_0xb591d2,_0x3ff722){_0xb591d2=_0xb591d2-0x0;var _0x4c33f2=_0x7a63[_0xb591d2];return _0x4c33f2;};'use strict';var express=require('express');var router=express[_0x37a6('0x0')]();var auth=require(_0x37a6('0x1'));var controller=require('./system.controller');router[_0x37a6('0x2')]('/',auth['isAuthenticated'](),controller[_0x37a6('0x3')]);router[_0x37a6('0x2')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x37a6('0x4')]);module[_0x37a6('0x5')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index d584fef..300940b 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 _0x5539=['kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','send','index','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(_0x36f792,_0x2bad8d){var _0x114b91=function(_0x336b5e){while(--_0x336b5e){_0x36f792['push'](_0x36f792['shift']());}};_0x114b91(++_0x2bad8d);}(_0x5539,0x16f));var _0x9553=function(_0x2d4bdf,_0x1fe3e4){_0x2d4bdf=_0x2d4bdf-0x0;var _0x3bb2c8=_0x5539[_0x2d4bdf];return _0x3bb2c8;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x9553('0x0')];var logger=require(_0x9553('0x1'))(_0x9553('0x2'));var util=require(_0x9553('0x3'));var BPromise=require(_0x9553('0x4'));var _=require(_0x9553('0x5'));function handleError(_0x3bd011,_0xd3c41c,_0x3adb08){_0xd3c41c=_0xd3c41c||0x1f4;return function(_0x4d5e8d){logger[_0x9553('0x6')](_0x9553('0x7'),_0x3adb08,_0xd3c41c,util['inspect'](_0x4d5e8d,{'showHidden':![],'depth':null}));delete _0x4d5e8d[_0x9553('0x8')];_0x3bd011['status'](_0xd3c41c)[_0x9553('0x9')](_0x4d5e8d);};}exports[_0x9553('0xa')]=function(_0x54b514,_0x36f1cd){return info['getAllData']()[_0x9553('0xb')](function(_0x525924){return _0x36f1cd[_0x9553('0xc')](0xc8)[_0x9553('0xd')](_0x525924);})['catch'](function(_0x5e070c){return _0x36f1cd[_0x9553('0xc')](0x1f4)[_0x9553('0xd')](_0x5e070c);});};exports[_0x9553('0xe')]=function(_0x53bd90,_0x23b3b2){var _0x4aac4a=[_0x9553('0xf')];return new BPromise(function(_0x2557a1,_0x41130e){return exec(util[_0x9553('0x10')](_0x9553('0x11'),_0x53bd90[_0x9553('0x12')][_0x9553('0x13')]),function(_0x13bb1e,_0x5ab349,_0x309e14){if(_0x13bb1e){return _0x41130e(_0x13bb1e);}return _0x2557a1(_0x5ab349);});})[_0x9553('0xb')](function(_0x1eefd9){var _0x2aef77=![];var _0x15446d=_0x1eefd9[_0x9553('0x14')](/\n/);for(var _0x1c1098=0x0,_0x1b48c5=_0x4aac4a['length'];_0x1c1098<_0x1b48c5,_0x2aef77===![];_0x1c1098+=0x1){if(_0x1eefd9[_0x9553('0x15')](_0x4aac4a[_0x1c1098])>=0x0){_0x2aef77=!![];}}if(!_0x2aef77){throw new Error(util[_0x9553('0x10')](_0x9553('0x16'),_0x53bd90['params']['pid']));}process[_0x9553('0x17')](_0x53bd90[_0x9553('0x12')]['pid'],_0x9553('0x18'));return _0x23b3b2[_0x9553('0xc')](0xc8)[_0x9553('0xd')]({'message':util[_0x9553('0x10')](_0x9553('0x19'),_0x53bd90['params'][_0x9553('0x13')])});})['catch'](handleError(_0x23b3b2,null,_0x9553('0xe')));}; \ No newline at end of file +var _0xc79e=['catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','then','split','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','params','SIGINT','killProcess','exec','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','json'];(function(_0x57acfc,_0x9872af){var _0xca9c18=function(_0x464c1e){while(--_0x464c1e){_0x57acfc['push'](_0x57acfc['shift']());}};_0xca9c18(++_0x9872af);}(_0xc79e,0xcc));var _0xec79=function(_0x44d6a1,_0x3498f3){_0x44d6a1=_0x44d6a1-0x0;var _0x3c6f24=_0xc79e[_0x44d6a1];return _0x3c6f24;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0xec79('0x0')];var logger=require('../../config/logger')(_0xec79('0x1'));var util=require(_0xec79('0x2'));var BPromise=require('bluebird');var _=require(_0xec79('0x3'));function handleError(_0x3a2c53,_0x22803d,_0x3c61f9){_0x22803d=_0x22803d||0x1f4;return function(_0x1a8d9d){logger[_0xec79('0x4')](_0xec79('0x5'),_0x3c61f9,_0x22803d,util['inspect'](_0x1a8d9d,{'showHidden':![],'depth':null}));delete _0x1a8d9d[_0xec79('0x6')];_0x3a2c53[_0xec79('0x7')](_0x22803d)[_0xec79('0x8')](_0x1a8d9d);};}exports[_0xec79('0x9')]=function(_0x302504,_0x3c8782){return info[_0xec79('0xa')]()['then'](function(_0x3647b2){return _0x3c8782[_0xec79('0x7')](0xc8)[_0xec79('0xb')](_0x3647b2);})[_0xec79('0xc')](function(_0x1bf4b5){return _0x3c8782[_0xec79('0x7')](0x1f4)['json'](_0x1bf4b5);});};exports['killProcess']=function(_0x4c6c31,_0xd1af62){var _0x3d9cef=[_0xec79('0xd')];return new BPromise(function(_0x53d619,_0x221b14){return exec(util[_0xec79('0xe')](_0xec79('0xf'),_0x4c6c31['params']['pid']),function(_0x33d2ea,_0x221e02,_0x57fa56){if(_0x33d2ea){return _0x221b14(_0x33d2ea);}return _0x53d619(_0x221e02);});})[_0xec79('0x10')](function(_0x25dbec){var _0x541a77=![];var _0x47e89f=_0x25dbec[_0xec79('0x11')](/\n/);for(var _0x363610=0x0,_0xd185e6=_0x3d9cef['length'];_0x363610<_0xd185e6,_0x541a77===![];_0x363610+=0x1){if(_0x25dbec['indexOf'](_0x3d9cef[_0x363610])>=0x0){_0x541a77=!![];}}if(!_0x541a77){throw new Error(util[_0xec79('0xe')](_0xec79('0x12'),_0x4c6c31['params'][_0xec79('0x13')]));}process[_0xec79('0x14')](_0x4c6c31[_0xec79('0x15')][_0xec79('0x13')],_0xec79('0x16'));return _0xd1af62[_0xec79('0x7')](0xc8)[_0xec79('0xb')]({'message':util[_0xec79('0xe')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4c6c31['params']['pid'])});})[_0xec79('0xc')](handleError(_0xd1af62,null,_0xec79('0x17')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 4cd473c..f8c1a8d 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 _0x9782=['update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index','isAuthenticated','show','post','put'];(function(_0x4de4e5,_0x4d9c5c){var _0x4ea839=function(_0x3a1c90){while(--_0x3a1c90){_0x4de4e5['push'](_0x4de4e5['shift']());}};_0x4ea839(++_0x4d9c5c);}(_0x9782,0x73));var _0x2978=function(_0x101a61,_0x43011c){_0x101a61=_0x101a61-0x0;var _0x51d456=_0x9782[_0x101a61];return _0x51d456;};'use strict';var multer=require(_0x2978('0x0'));var util=require(_0x2978('0x1'));var path=require(_0x2978('0x2'));var timeout=require(_0x2978('0x3'));var express=require(_0x2978('0x4'));var router=express[_0x2978('0x5')]();var fs_extra=require(_0x2978('0x6'));var auth=require(_0x2978('0x7'));var interaction=require(_0x2978('0x8'));var config=require(_0x2978('0x9'));var controller=require(_0x2978('0xa'));router[_0x2978('0xb')]('/',auth['isAuthenticated'](),controller[_0x2978('0xc')]);router[_0x2978('0xb')]('/:id',auth[_0x2978('0xd')](),controller[_0x2978('0xe')]);router[_0x2978('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2978('0x10')]('/:id',auth[_0x2978('0xd')](),controller[_0x2978('0x11')]);router[_0x2978('0x12')](_0x2978('0x13'),auth['isAuthenticated'](),controller[_0x2978('0x14')]);module[_0x2978('0x15')]=router; \ No newline at end of file +var _0x09f5=['fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x49dd26,_0x44f262){var _0x44c691=function(_0x3f6f23){while(--_0x3f6f23){_0x49dd26['push'](_0x49dd26['shift']());}};_0x44c691(++_0x44f262);}(_0x09f5,0x1b0));var _0x509f=function(_0x326ae1,_0x559742){_0x326ae1=_0x326ae1-0x0;var _0x616d33=_0x09f5[_0x326ae1];return _0x616d33;};'use strict';var multer=require(_0x509f('0x0'));var util=require('util');var path=require(_0x509f('0x1'));var timeout=require(_0x509f('0x2'));var express=require(_0x509f('0x3'));var router=express[_0x509f('0x4')]();var fs_extra=require(_0x509f('0x5'));var auth=require(_0x509f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x509f('0x7'));var controller=require(_0x509f('0x8'));router[_0x509f('0x9')]('/',auth[_0x509f('0xa')](),controller[_0x509f('0xb')]);router[_0x509f('0x9')](_0x509f('0xc'),auth[_0x509f('0xa')](),controller[_0x509f('0xd')]);router['post']('/',auth[_0x509f('0xa')](),controller[_0x509f('0xe')]);router['put']('/:id',auth[_0x509f('0xa')](),controller[_0x509f('0xf')]);router[_0x509f('0x10')]('/:id',auth[_0x509f('0xa')](),controller[_0x509f('0x11')]);module[_0x509f('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index b767a13..6d03ebd 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 _0x5eb8=['name','#0091EA','STRING'];(function(_0x4f0dd2,_0x3c85f3){var _0x4ce9c8=function(_0xe77bb4){while(--_0xe77bb4){_0x4f0dd2['push'](_0x4f0dd2['shift']());}};_0x4ce9c8(++_0x3c85f3);}(_0x5eb8,0xb0));var _0x85eb=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x5eb8[_0xa45395];return _0x3c83d2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x85eb('0x0')],'unique':_0x85eb('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':_0x85eb('0x2')},'description':{'type':Sequelize[_0x85eb('0x0')]}}; \ No newline at end of file +var _0xf089=['exports','STRING','#0091EA'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0xf089,0xba));var _0x9f08=function(_0xc4be05,_0x40f270){_0xc4be05=_0xc4be05-0x0;var _0x26def8=_0xf089[_0xc4be05];return _0x26def8;};'use strict';var Sequelize=require('sequelize');module[_0x9f08('0x0')]={'name':{'type':Sequelize[_0x9f08('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x9f08('0x1')],'defaultValue':_0x9f08('0x2')},'description':{'type':Sequelize[_0x9f08('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 8b3bc87..c861386 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 _0x01fe=['where','filters','pick','filter','merge','options','includeAll','include','catch','show','rawAttributes','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Tags','UserProfileResource','stack','name','send','index','map','Tag','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x1f1614,_0x116f70){var _0x5c0a95=function(_0x377ed1){while(--_0x377ed1){_0x1f1614['push'](_0x1f1614['shift']());}};_0x5c0a95(++_0x116f70);}(_0x01fe,0x102));var _0xe01f=function(_0x5bee4b,_0x2a9e73){_0x5bee4b=_0x5bee4b-0x0;var _0xa5ad48=_0x01fe[_0x5bee4b];return _0xa5ad48;};'use strict';var emlformat=require(_0xe01f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe01f('0x1'));var jsonpatch=require(_0xe01f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe01f('0x3'));var Mustache=require(_0xe01f('0x4'));var util=require(_0xe01f('0x5'));var path=require(_0xe01f('0x6'));var sox=require('sox');var csv=require(_0xe01f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe01f('0x8'));var _=require(_0xe01f('0x9'));var squel=require(_0xe01f('0xa'));var crypto=require(_0xe01f('0xb'));var jsforce=require(_0xe01f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe01f('0x7'));var querystring=require(_0xe01f('0xd'));var Papa=require('papaparse');var Redis=require(_0xe01f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe01f('0xf'));var as=require(_0xe01f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe01f('0x11'))('api');var utils=require(_0xe01f('0x12'));var config=require(_0xe01f('0x13'));var licenseUtil=require(_0xe01f('0x14'));var db=require(_0xe01f('0x15'))['db'];function respondWithStatusCode(_0x2d3162,_0x94e3d8){_0x94e3d8=_0x94e3d8||0xcc;return function(_0x81aef3){if(_0x81aef3){return _0x2d3162[_0xe01f('0x16')](_0x94e3d8);}return _0x2d3162['status'](_0x94e3d8)[_0xe01f('0x17')]();};}function respondWithResult(_0x3a9b4b,_0x2d55c8){_0x2d55c8=_0x2d55c8||0xc8;return function(_0x3cb8ac){if(_0x3cb8ac){return _0x3a9b4b[_0xe01f('0x18')](_0x2d55c8)[_0xe01f('0x19')](_0x3cb8ac);}};}function respondWithFilteredResult(_0x664fbb,_0x5e5e30){return function(_0x53d3a1){if(_0x53d3a1){var _0x5e3877=typeof _0x5e5e30[_0xe01f('0x1a')]===_0xe01f('0x1b')&&typeof _0x5e5e30[_0xe01f('0x1c')]===_0xe01f('0x1b');var _0x26cd4c=_0x53d3a1[_0xe01f('0x1d')];var _0x144eef=_0x5e3877?0x0:_0x5e5e30[_0xe01f('0x1a')];var _0x9ee4b5=_0x5e3877?_0x53d3a1[_0xe01f('0x1d')]:_0x5e5e30['offset']+_0x5e5e30[_0xe01f('0x1c')];var _0x5ca305;if(_0x9ee4b5>=_0x26cd4c){_0x9ee4b5=_0x26cd4c;_0x5ca305=0xc8;}else{_0x5ca305=0xce;}_0x664fbb[_0xe01f('0x18')](_0x5ca305);return _0x664fbb[_0xe01f('0x1e')](_0xe01f('0x1f'),_0x144eef+'-'+_0x9ee4b5+'/'+_0x26cd4c)[_0xe01f('0x19')](_0x53d3a1);}return null;};}function patchUpdates(_0x5e9523){return function(_0x32a6b9){try{jsonpatch[_0xe01f('0x20')](_0x32a6b9,_0x5e9523,!![]);}catch(_0xccaf80){return BPromise[_0xe01f('0x21')](_0xccaf80);}return _0x32a6b9[_0xe01f('0x22')]();};}function saveUpdates(_0x3c34fa,_0x570d48){return function(_0x1faeb8){if(_0x1faeb8){return _0x1faeb8[_0xe01f('0x23')](_0x3c34fa)[_0xe01f('0x24')](function(_0xa6da95){return _0xa6da95;});}return null;};}function removeEntity(_0x2480ec,_0x38efcc){return function(_0x1ea55b){if(_0x1ea55b){return _0x1ea55b[_0xe01f('0x25')]()[_0xe01f('0x24')](function(){var _0x4b44b6=_0x1ea55b['get']({'plain':!![]});var _0x3138d3=_0xe01f('0x26');return db[_0xe01f('0x27')][_0xe01f('0x25')]({'where':{'type':_0x3138d3,'resourceId':_0x4b44b6['id']}})['then'](function(){return _0x1ea55b;});})[_0xe01f('0x24')](function(){_0x2480ec[_0xe01f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x378c93,_0x5b9c5e){return function(_0x1b77c8){if(!_0x1b77c8){_0x378c93[_0xe01f('0x16')](0x194);}return _0x1b77c8;};}function handleError(_0x13dcd4,_0x4b85b8){_0x4b85b8=_0x4b85b8||0x1f4;return function(_0x940cb6){logger['error'](_0x940cb6[_0xe01f('0x28')]);if(_0x940cb6[_0xe01f('0x29')]){delete _0x940cb6[_0xe01f('0x29')];}_0x13dcd4[_0xe01f('0x18')](_0x4b85b8)[_0xe01f('0x2a')](_0x940cb6);};}exports[_0xe01f('0x2b')]=function(_0x11386e,_0x41d13d){var _0x1bdfcf={},_0x590598={},_0x3f725a={'count':0x0,'rows':[]};var _0x4bc3c8=_[_0xe01f('0x2c')](db[_0xe01f('0x2d')]['rawAttributes'],function(_0x15f98f){return{'name':_0x15f98f[_0xe01f('0x2e')],'type':_0x15f98f[_0xe01f('0x2f')]['key']};});_0x590598[_0xe01f('0x30')]=_[_0xe01f('0x2c')](_0x4bc3c8,_0xe01f('0x29'));_0x590598[_0xe01f('0x31')]=_[_0xe01f('0x32')](_0x11386e['query']);_0x590598['filters']=_['intersection'](_0x590598[_0xe01f('0x30')],_0x590598['query']);_0x1bdfcf[_0xe01f('0x33')]=_[_0xe01f('0x34')](_0x590598[_0xe01f('0x30')],qs[_0xe01f('0x35')](_0x11386e[_0xe01f('0x31')][_0xe01f('0x35')]));_0x1bdfcf[_0xe01f('0x33')]=_0x1bdfcf[_0xe01f('0x33')]['length']?_0x1bdfcf['attributes']:_0x590598[_0xe01f('0x30')];if(!_0x11386e[_0xe01f('0x31')][_0xe01f('0x36')](_0xe01f('0x37'))){_0x1bdfcf['limit']=qs[_0xe01f('0x1c')](_0x11386e[_0xe01f('0x31')][_0xe01f('0x1c')]);_0x1bdfcf['offset']=qs[_0xe01f('0x1a')](_0x11386e[_0xe01f('0x31')][_0xe01f('0x1a')]);}_0x1bdfcf[_0xe01f('0x38')]=qs[_0xe01f('0x39')](_0x11386e[_0xe01f('0x31')][_0xe01f('0x39')]);_0x1bdfcf[_0xe01f('0x3a')]=qs[_0xe01f('0x3b')](_[_0xe01f('0x3c')](_0x11386e[_0xe01f('0x31')],_0x590598[_0xe01f('0x3b')]),_0x4bc3c8);if(_0x11386e[_0xe01f('0x31')][_0xe01f('0x3d')]){_0x1bdfcf[_0xe01f('0x3a')]=_['merge'](_0x1bdfcf[_0xe01f('0x3a')],{'$or':_[_0xe01f('0x2c')](_0x4bc3c8,function(_0x1deac7){if(_0x1deac7[_0xe01f('0x2f')]!=='VIRTUAL'){var _0x36783f={};_0x36783f[_0x1deac7[_0xe01f('0x29')]]={'$like':'%'+_0x11386e[_0xe01f('0x31')][_0xe01f('0x3d')]+'%'};return _0x36783f;}})});}_0x1bdfcf=_[_0xe01f('0x3e')]({},_0x1bdfcf,_0x11386e[_0xe01f('0x3f')]);var _0x4fbb62={'where':_0x1bdfcf[_0xe01f('0x3a')]};return db[_0xe01f('0x2d')][_0xe01f('0x1d')](_0x4fbb62)[_0xe01f('0x24')](function(_0x20421f){_0x3f725a[_0xe01f('0x1d')]=_0x20421f;if(_0x11386e[_0xe01f('0x31')][_0xe01f('0x40')]){_0x1bdfcf[_0xe01f('0x41')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x1bdfcf);})[_0xe01f('0x24')](function(_0x50b47){_0x3f725a['rows']=_0x50b47;return _0x3f725a;})[_0xe01f('0x24')](respondWithFilteredResult(_0x41d13d,_0x1bdfcf))[_0xe01f('0x42')](handleError(_0x41d13d,null));};exports[_0xe01f('0x43')]=function(_0x5625d8,_0x2eb993){var _0x2da2e9={'raw':!![],'where':{'id':_0x5625d8['params']['id']}},_0x56785b={};_0x56785b['model']=_[_0xe01f('0x32')](db['Tag'][_0xe01f('0x44')]);_0x56785b['query']=_[_0xe01f('0x32')](_0x5625d8[_0xe01f('0x31')]);_0x56785b[_0xe01f('0x3b')]=_[_0xe01f('0x34')](_0x56785b[_0xe01f('0x30')],_0x56785b[_0xe01f('0x31')]);_0x2da2e9[_0xe01f('0x33')]=_[_0xe01f('0x34')](_0x56785b[_0xe01f('0x30')],qs[_0xe01f('0x35')](_0x5625d8[_0xe01f('0x31')]['fields']));_0x2da2e9[_0xe01f('0x33')]=_0x2da2e9[_0xe01f('0x33')][_0xe01f('0x45')]?_0x2da2e9[_0xe01f('0x33')]:_0x56785b[_0xe01f('0x30')];if(_0x5625d8['query'][_0xe01f('0x40')]){_0x2da2e9['include']=[{'all':!![]}];}_0x2da2e9=_['merge']({},_0x2da2e9,_0x5625d8[_0xe01f('0x3f')]);return db[_0xe01f('0x2d')][_0xe01f('0x46')](_0x2da2e9)[_0xe01f('0x24')](handleEntityNotFound(_0x2eb993,null))[_0xe01f('0x24')](respondWithResult(_0x2eb993,null))['catch'](handleError(_0x2eb993,null));};exports[_0xe01f('0x47')]=function(_0x337c5d,_0x3bb3b7){return db[_0xe01f('0x2d')][_0xe01f('0x47')](_0x337c5d[_0xe01f('0x48')],{})[_0xe01f('0x24')](function(_0x5a511c){var _0x3f4ae0=_0x337c5d['user'][_0xe01f('0x49')]({'plain':!![]});if(!_0x3f4ae0)throw new Error(_0xe01f('0x4a'));if(_0x3f4ae0['role']===_0xe01f('0x4b')){var _0x100742=_0x5a511c[_0xe01f('0x49')]({'plain':!![]});var _0xea4320=_0xe01f('0x26');return db[_0xe01f('0x4c')]['find']({'where':{'name':_0xea4320,'userProfileId':_0x3f4ae0['userProfileId']},'raw':!![]})[_0xe01f('0x24')](function(_0x216f69){if(_0x216f69&&_0x216f69['autoAssociation']===0x0){return db[_0xe01f('0x27')][_0xe01f('0x47')]({'name':_0x100742[_0xe01f('0x29')],'resourceId':_0x100742['id'],'type':_0x216f69[_0xe01f('0x29')],'sectionId':_0x216f69['id']},{})[_0xe01f('0x24')](function(){return _0x5a511c;});}else{return _0x5a511c;}})[_0xe01f('0x42')](function(_0x4ffa43){logger[_0xe01f('0x4d')](_0xe01f('0x4e'),_0x4ffa43);throw _0x4ffa43;});}return _0x5a511c;})['then'](respondWithResult(_0x3bb3b7,0xc9))[_0xe01f('0x42')](handleError(_0x3bb3b7,null));};exports[_0xe01f('0x23')]=function(_0x33b9a8,_0x47089f){if(_0x33b9a8[_0xe01f('0x48')]['id']){delete _0x33b9a8[_0xe01f('0x48')]['id'];}return db['Tag'][_0xe01f('0x46')]({'where':{'id':_0x33b9a8['params']['id']}})['then'](handleEntityNotFound(_0x47089f,null))[_0xe01f('0x24')](saveUpdates(_0x33b9a8[_0xe01f('0x48')],null))[_0xe01f('0x24')](respondWithResult(_0x47089f,null))[_0xe01f('0x42')](handleError(_0x47089f,null));};exports[_0xe01f('0x25')]=function(_0x3b0ab1,_0x3949e1){return db[_0xe01f('0x2d')]['find']({'where':{'id':_0x3b0ab1['params']['id']}})[_0xe01f('0x24')](handleEntityNotFound(_0x3949e1,null))['then'](removeEntity(_0x3949e1,null))[_0xe01f('0x42')](handleError(_0x3949e1,null));}; \ No newline at end of file +var _0x750a=['filter','options','Tag','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','body','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','offset','undefined','count','set','json','destroy','then','get','Tags','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x750a,0x140));var _0xa750=function(_0x47197f,_0x30af6a){_0x47197f=_0x47197f-0x0;var _0x2f9eba=_0x750a[_0x47197f];return _0x2f9eba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa750('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa750('0x1'));var moment=require(_0xa750('0x2'));var BPromise=require(_0xa750('0x3'));var Mustache=require(_0xa750('0x4'));var util=require(_0xa750('0x5'));var path=require(_0xa750('0x6'));var sox=require(_0xa750('0x7'));var csv=require(_0xa750('0x8'));var ejs=require(_0xa750('0x9'));var fs=require('fs');var fs_extra=require(_0xa750('0xa'));var _=require(_0xa750('0xb'));var squel=require(_0xa750('0xc'));var crypto=require(_0xa750('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa750('0x8'));var querystring=require('querystring');var Papa=require(_0xa750('0xe'));var Redis=require(_0xa750('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa750('0x10'));var as=require(_0xa750('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa750('0x12'));var utils=require('../../config/utils');var config=require(_0xa750('0x13'));var licenseUtil=require(_0xa750('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ec62,_0x1c5657){_0x1c5657=_0x1c5657||0xcc;return function(_0x344c67){if(_0x344c67){return _0x24ec62['sendStatus'](_0x1c5657);}return _0x24ec62[_0xa750('0x15')](_0x1c5657)[_0xa750('0x16')]();};}function respondWithResult(_0x2d3421,_0x24e48a){_0x24e48a=_0x24e48a||0xc8;return function(_0xa66181){if(_0xa66181){return _0x2d3421[_0xa750('0x15')](_0x24e48a)['json'](_0xa66181);}};}function respondWithFilteredResult(_0x3ae2a1,_0x8488ea){return function(_0x290d46){if(_0x290d46){var _0x49fe3b=typeof _0x8488ea[_0xa750('0x17')]===_0xa750('0x18')&&typeof _0x8488ea['limit']==='undefined';var _0x321eb2=_0x290d46['count'];var _0x433dbd=_0x49fe3b?0x0:_0x8488ea[_0xa750('0x17')];var _0x4f1faa=_0x49fe3b?_0x290d46[_0xa750('0x19')]:_0x8488ea['offset']+_0x8488ea['limit'];var _0x25e335;if(_0x4f1faa>=_0x321eb2){_0x4f1faa=_0x321eb2;_0x25e335=0xc8;}else{_0x25e335=0xce;}_0x3ae2a1['status'](_0x25e335);return _0x3ae2a1[_0xa750('0x1a')]('Content-Range',_0x433dbd+'-'+_0x4f1faa+'/'+_0x321eb2)[_0xa750('0x1b')](_0x290d46);}return null;};}function patchUpdates(_0x4a007d){return function(_0x3dc7f1){try{jsonpatch['apply'](_0x3dc7f1,_0x4a007d,!![]);}catch(_0x1efb68){return BPromise['reject'](_0x1efb68);}return _0x3dc7f1['save']();};}function saveUpdates(_0xaa9d3e,_0x52da84){return function(_0x216fbf){if(_0x216fbf){return _0x216fbf['update'](_0xaa9d3e)['then'](function(_0x5b433d){return _0x5b433d;});}return null;};}function removeEntity(_0x5d758e,_0x15d72f){return function(_0x2ec6c4){if(_0x2ec6c4){return _0x2ec6c4[_0xa750('0x1c')]()[_0xa750('0x1d')](function(){var _0x1b80a5=_0x2ec6c4[_0xa750('0x1e')]({'plain':!![]});var _0x3001bc=_0xa750('0x1f');return db[_0xa750('0x20')][_0xa750('0x1c')]({'where':{'type':_0x3001bc,'resourceId':_0x1b80a5['id']}})[_0xa750('0x1d')](function(){return _0x2ec6c4;});})[_0xa750('0x1d')](function(){_0x5d758e[_0xa750('0x15')](0xcc)[_0xa750('0x16')]();});}};}function handleEntityNotFound(_0x310e2d,_0x4ffff4){return function(_0x3d3923){if(!_0x3d3923){_0x310e2d[_0xa750('0x21')](0x194);}return _0x3d3923;};}function handleError(_0x21cd2c,_0x4cceee){_0x4cceee=_0x4cceee||0x1f4;return function(_0x35ab53){logger[_0xa750('0x22')](_0x35ab53[_0xa750('0x23')]);if(_0x35ab53[_0xa750('0x24')]){delete _0x35ab53['name'];}_0x21cd2c[_0xa750('0x15')](_0x4cceee)[_0xa750('0x25')](_0x35ab53);};}exports[_0xa750('0x26')]=function(_0x2aef3a,_0x2c5253){var _0x59ab33={},_0x46cc11={},_0x4c2c9e={'count':0x0,'rows':[]};var _0x2d0e93=_[_0xa750('0x27')](db['Tag'][_0xa750('0x28')],function(_0x6bc25d){return{'name':_0x6bc25d[_0xa750('0x29')],'type':_0x6bc25d[_0xa750('0x2a')][_0xa750('0x2b')]};});_0x46cc11[_0xa750('0x2c')]=_[_0xa750('0x27')](_0x2d0e93,_0xa750('0x24'));_0x46cc11['query']=_[_0xa750('0x2d')](_0x2aef3a['query']);_0x46cc11[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],_0x46cc11[_0xa750('0x30')]);_0x59ab33['attributes']=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],qs['fields'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x31')]));_0x59ab33[_0xa750('0x32')]=_0x59ab33[_0xa750('0x32')]['length']?_0x59ab33[_0xa750('0x32')]:_0x46cc11['model'];if(!_0x2aef3a['query'][_0xa750('0x33')](_0xa750('0x34'))){_0x59ab33[_0xa750('0x35')]=qs['limit'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x35')]);_0x59ab33[_0xa750('0x17')]=qs['offset'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x17')]);}_0x59ab33[_0xa750('0x36')]=qs['sort'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x37')]);_0x59ab33[_0xa750('0x38')]=qs['filters'](_[_0xa750('0x39')](_0x2aef3a[_0xa750('0x30')],_0x46cc11[_0xa750('0x2e')]),_0x2d0e93);if(_0x2aef3a[_0xa750('0x30')]['filter']){_0x59ab33['where']=_[_0xa750('0x3a')](_0x59ab33[_0xa750('0x38')],{'$or':_['map'](_0x2d0e93,function(_0x43dc3a){if(_0x43dc3a[_0xa750('0x2a')]!==_0xa750('0x3b')){var _0x1166ff={};_0x1166ff[_0x43dc3a[_0xa750('0x24')]]={'$like':'%'+_0x2aef3a['query'][_0xa750('0x3c')]+'%'};return _0x1166ff;}})});}_0x59ab33=_[_0xa750('0x3a')]({},_0x59ab33,_0x2aef3a[_0xa750('0x3d')]);var _0x134874={'where':_0x59ab33[_0xa750('0x38')]};return db[_0xa750('0x3e')][_0xa750('0x19')](_0x134874)['then'](function(_0x3daa38){_0x4c2c9e['count']=_0x3daa38;if(_0x2aef3a[_0xa750('0x30')]['includeAll']){_0x59ab33[_0xa750('0x3f')]=[{'all':!![]}];}return db[_0xa750('0x3e')][_0xa750('0x40')](_0x59ab33);})[_0xa750('0x1d')](function(_0x430d60){_0x4c2c9e[_0xa750('0x41')]=_0x430d60;return _0x4c2c9e;})[_0xa750('0x1d')](respondWithFilteredResult(_0x2c5253,_0x59ab33))[_0xa750('0x42')](handleError(_0x2c5253,null));};exports[_0xa750('0x43')]=function(_0x108a1a,_0x36a8d6){var _0x1458f1={'raw':!![],'where':{'id':_0x108a1a[_0xa750('0x44')]['id']}},_0x3ec860={};_0x3ec860[_0xa750('0x2c')]=_[_0xa750('0x2d')](db[_0xa750('0x3e')][_0xa750('0x28')]);_0x3ec860[_0xa750('0x30')]=_[_0xa750('0x2d')](_0x108a1a['query']);_0x3ec860[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],_0x3ec860[_0xa750('0x30')]);_0x1458f1[_0xa750('0x32')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],qs[_0xa750('0x31')](_0x108a1a[_0xa750('0x30')]['fields']));_0x1458f1[_0xa750('0x32')]=_0x1458f1[_0xa750('0x32')]['length']?_0x1458f1[_0xa750('0x32')]:_0x3ec860[_0xa750('0x2c')];if(_0x108a1a[_0xa750('0x30')][_0xa750('0x45')]){_0x1458f1[_0xa750('0x3f')]=[{'all':!![]}];}_0x1458f1=_[_0xa750('0x3a')]({},_0x1458f1,_0x108a1a[_0xa750('0x3d')]);return db[_0xa750('0x3e')][_0xa750('0x46')](_0x1458f1)[_0xa750('0x1d')](handleEntityNotFound(_0x36a8d6,null))['then'](respondWithResult(_0x36a8d6,null))[_0xa750('0x42')](handleError(_0x36a8d6,null));};exports[_0xa750('0x47')]=function(_0x58afd2,_0x93e49f){return db[_0xa750('0x3e')][_0xa750('0x47')](_0x58afd2['body'],{})[_0xa750('0x1d')](function(_0x3fc623){var _0x1e5a9a=_0x58afd2[_0xa750('0x48')]['get']({'plain':!![]});if(!_0x1e5a9a)throw new Error(_0xa750('0x49'));if(_0x1e5a9a[_0xa750('0x4a')]===_0xa750('0x48')){var _0xed4f88=_0x3fc623['get']({'plain':!![]});var _0x203f2a=_0xa750('0x1f');return db['UserProfileSection'][_0xa750('0x46')]({'where':{'name':_0x203f2a,'userProfileId':_0x1e5a9a['userProfileId']},'raw':!![]})[_0xa750('0x1d')](function(_0x69995b){if(_0x69995b&&_0x69995b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xed4f88[_0xa750('0x24')],'resourceId':_0xed4f88['id'],'type':_0x69995b[_0xa750('0x24')],'sectionId':_0x69995b['id']},{})['then'](function(){return _0x3fc623;});}else{return _0x3fc623;}})[_0xa750('0x42')](function(_0x1a79a9){logger[_0xa750('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a79a9);throw _0x1a79a9;});}return _0x3fc623;})['then'](respondWithResult(_0x93e49f,0xc9))['catch'](handleError(_0x93e49f,null));};exports['update']=function(_0x3c34d4,_0x4a1b5d){if(_0x3c34d4[_0xa750('0x4b')]['id']){delete _0x3c34d4[_0xa750('0x4b')]['id'];}return db['Tag'][_0xa750('0x46')]({'where':{'id':_0x3c34d4['params']['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x4a1b5d,null))['then'](saveUpdates(_0x3c34d4['body'],null))['then'](respondWithResult(_0x4a1b5d,null))['catch'](handleError(_0x4a1b5d,null));};exports[_0xa750('0x1c')]=function(_0x40dac2,_0x5f1313){return db['Tag']['find']({'where':{'id':_0x40dac2[_0xa750('0x44')]['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x5f1313,null))[_0xa750('0x1d')](removeEntity(_0x5f1313,null))[_0xa750('0x42')](handleError(_0x5f1313,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index dd947b5..5110320 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 _0x7b4a=['../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7b4a,0x119));var _0xa7b4=function(_0x1fc4b8,_0x56613e){_0x1fc4b8=_0x1fc4b8-0x0;var _0x160ab5=_0x7b4a[_0x1fc4b8];return _0x160ab5;};'use strict';var _=require(_0xa7b4('0x0'));var util=require('util');var logger=require(_0xa7b4('0x1'))('api');var moment=require(_0xa7b4('0x2'));var BPromise=require(_0xa7b4('0x3'));var rp=require(_0xa7b4('0x4'));var fs=require('fs');var path=require(_0xa7b4('0x5'));var rimraf=require(_0xa7b4('0x6'));var config=require(_0xa7b4('0x7'));var attributes=require(_0xa7b4('0x8'));module['exports']=function(_0x5a98d8,_0x54ace7){return _0x5a98d8[_0xa7b4('0x9')](_0xa7b4('0xa'),attributes,{'tableName':_0xa7b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c2b=['tools_tags','util','../../config/logger','api','request-promise','rimraf','exports','define','Tag'];(function(_0x57413f,_0x4f0325){var _0x359a2f=function(_0xab823b){while(--_0xab823b){_0x57413f['push'](_0x57413f['shift']());}};_0x359a2f(++_0x4f0325);}(_0x2c2b,0x1b1));var _0xb2c2=function(_0xef9f7f,_0x259a17){_0xef9f7f=_0xef9f7f-0x0;var _0x6ca606=_0x2c2b[_0xef9f7f];return _0x6ca606;};'use strict';var _=require('lodash');var util=require(_0xb2c2('0x0'));var logger=require(_0xb2c2('0x1'))(_0xb2c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb2c2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2c2('0x4'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0xb2c2('0x5')]=function(_0x103254,_0x5d42f4){return _0x103254[_0xb2c2('0x6')](_0xb2c2('0x7'),attributes,{'tableName':_0xb2c2('0x8'),'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 6f0f5a4..3a238e0 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 _0x1af3=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x8508f7,_0x5a3f16){var _0x4d7dca=function(_0x98c346){while(--_0x98c346){_0x8508f7['push'](_0x8508f7['shift']());}};_0x4d7dca(++_0x5a3f16);}(_0x1af3,0x1ca));var _0x31af=function(_0x260b48,_0x117977){_0x260b48=_0x260b48-0x0;var _0x3f730b=_0x1af3[_0x260b48];return _0x3f730b;};'use strict';var _=require(_0x31af('0x0'));var util=require(_0x31af('0x1'));var moment=require(_0x31af('0x2'));var BPromise=require(_0x31af('0x3'));var rs=require(_0x31af('0x4'));var fs=require('fs');var Redis=require(_0x31af('0x5'));var db=require(_0x31af('0x6'))['db'];var utils=require(_0x31af('0x7'));var logger=require(_0x31af('0x8'))(_0x31af('0x9'));var config=require('../../config/environment');var jayson=require(_0x31af('0xa'));var client=jayson[_0x31af('0xb')][_0x31af('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21ddc5,_0x485717,_0x6be8e9){return new BPromise(function(_0x1833de,_0x406dd8){return client['request'](_0x21ddc5,_0x6be8e9)[_0x31af('0xd')](function(_0x2f1973){logger[_0x31af('0xe')](_0x31af('0xf'),_0x485717,_0x31af('0x10'));logger[_0x31af('0x11')](_0x31af('0x12'),_0x485717,_0x31af('0x10'),JSON['stringify'](_0x2f1973));if(_0x2f1973[_0x31af('0x13')]){if(_0x2f1973[_0x31af('0x13')][_0x31af('0x14')]===0x1f4){logger[_0x31af('0x13')](_0x31af('0xf'),_0x485717,_0x2f1973['error'][_0x31af('0x15')]);return _0x406dd8(_0x2f1973[_0x31af('0x13')]['message']);}logger['error'](_0x31af('0xf'),_0x485717,_0x2f1973[_0x31af('0x13')][_0x31af('0x15')]);return _0x1833de(_0x2f1973[_0x31af('0x13')][_0x31af('0x15')]);}else{logger[_0x31af('0xe')](_0x31af('0xf'),_0x485717,_0x31af('0x10'));_0x1833de(_0x2f1973[_0x31af('0x16')][_0x31af('0x15')]);}})[_0x31af('0x17')](function(_0x51bae2){logger[_0x31af('0x13')](_0x31af('0xf'),_0x485717,_0x51bae2);_0x406dd8(_0x51bae2);});});} \ No newline at end of file +var _0x7bae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7bae,0x13b));var _0xe7ba=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7bae[_0x1ac595];return _0x455fff;};'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});function respondWithRpcPromise(_0x3c5e59,_0x10b307,_0x34fb18){return new BPromise(function(_0x160565,_0x27b1d5){return client[_0xe7ba('0xa')](_0x3c5e59,_0x34fb18)[_0xe7ba('0xb')](function(_0x588f08){logger[_0xe7ba('0xc')](_0xe7ba('0xd'),_0x10b307,_0xe7ba('0xe'));logger[_0xe7ba('0xf')](_0xe7ba('0x10'),_0x10b307,_0xe7ba('0xe'),JSON[_0xe7ba('0x11')](_0x588f08));if(_0x588f08[_0xe7ba('0x12')]){if(_0x588f08[_0xe7ba('0x12')]['code']===0x1f4){logger[_0xe7ba('0x12')]('Tag,\x20%s,\x20%s',_0x10b307,_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);return _0x27b1d5(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}logger[_0xe7ba('0x12')](_0xe7ba('0xd'),_0x10b307,_0x588f08['error']['message']);return _0x160565(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}else{logger[_0xe7ba('0xc')]('Tag,\x20%s,\x20%s',_0x10b307,_0xe7ba('0xe'));_0x160565(_0x588f08['result']['message']);}})['catch'](function(_0x393f75){logger['error'](_0xe7ba('0xd'),_0x10b307,_0x393f75);_0x27b1d5(_0x393f75);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 6eb1c97..73fb24b 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(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 8dd8111..2a53dc1 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 _0xe706=['STRING','sequelize','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe706,0xa3));var _0x6e70=function(_0x5f5495,_0x30d087){_0x5f5495=_0x5f5495-0x0;var _0x14d8a3=_0xe706[_0x5f5495];return _0x14d8a3;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 50a6c1a..e0b21ef 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 _0xc7f5=['UserVoicePrefix','VoicePrefixId','spread','removeAgents','Queue:remove','UserVoiceQueueRt','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','Teams','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','Sequelize','add','ids','removeQueues','isValidChannel','remove','addAgents','isArray','Chat','Mail','Sms','Openchannel','sequelize','transaction','Voice','through','penalty','findOrCreate','emit','QueueId','User','online','voicePause','interface','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix'];(function(_0x2a08c,_0x6513d3){var _0x13a31d=function(_0x3db497){while(--_0x3db497){_0x2a08c['push'](_0x2a08c['shift']());}};_0x13a31d(++_0x6513d3);}(_0xc7f5,0x95));var _0x5c7f=function(_0x367751,_0x238bb3){_0x367751=_0x367751-0x0;var _0x221124=_0xc7f5[_0x367751];return _0x221124;};'use strict';var emlformat=require(_0x5c7f('0x0'));var rimraf=require(_0x5c7f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c7f('0x2'));var rp=require(_0x5c7f('0x3'));var moment=require(_0x5c7f('0x4'));var BPromise=require(_0x5c7f('0x5'));var Mustache=require(_0x5c7f('0x6'));var util=require(_0x5c7f('0x7'));var path=require(_0x5c7f('0x8'));var sox=require(_0x5c7f('0x9'));var csv=require(_0x5c7f('0xa'));var ejs=require(_0x5c7f('0xb'));var fs=require('fs');var fs_extra=require(_0x5c7f('0xc'));var _=require(_0x5c7f('0xd'));var squel=require('squel');var crypto=require(_0x5c7f('0xe'));var jsforce=require(_0x5c7f('0xf'));var deskjs=require(_0x5c7f('0x10'));var toCsv=require(_0x5c7f('0xa'));var querystring=require(_0x5c7f('0x11'));var Papa=require(_0x5c7f('0x12'));var Redis=require('ioredis');var authService=require(_0x5c7f('0x13'));var qs=require(_0x5c7f('0x14'));var as=require(_0x5c7f('0x15'));var hardwareService=require(_0x5c7f('0x16'));var logger=require(_0x5c7f('0x17'))('api');var utils=require(_0x5c7f('0x18'));var config=require(_0x5c7f('0x19'));var licenseUtil=require(_0x5c7f('0x1a'));var db=require(_0x5c7f('0x1b'))['db'];config[_0x5c7f('0x1c')]=_[_0x5c7f('0x1d')](config[_0x5c7f('0x1c')],{'host':_0x5c7f('0x1e'),'port':0x18eb});var socket=require(_0x5c7f('0x1f'))(new Redis(config[_0x5c7f('0x1c')]));require(_0x5c7f('0x20'))[_0x5c7f('0x21')](socket);function respondWithStatusCode(_0x4a09f0,_0x1e7c76){_0x1e7c76=_0x1e7c76||0xcc;return function(_0x301d29){if(_0x301d29){return _0x4a09f0[_0x5c7f('0x22')](_0x1e7c76);}return _0x4a09f0['status'](_0x1e7c76)[_0x5c7f('0x23')]();};}function respondWithResult(_0x425fcd,_0x12186f){_0x12186f=_0x12186f||0xc8;return function(_0x1197f1){if(_0x1197f1){return _0x425fcd[_0x5c7f('0x24')](_0x12186f)['json'](_0x1197f1);}};}function respondWithFilteredResult(_0x3a8843,_0x4882ca){return function(_0x5830e2){if(_0x5830e2){var _0x44c68b=typeof _0x4882ca[_0x5c7f('0x25')]===_0x5c7f('0x26')&&typeof _0x4882ca[_0x5c7f('0x27')]===_0x5c7f('0x26');var _0x488c11=_0x5830e2[_0x5c7f('0x28')];var _0x20c17e=_0x44c68b?0x0:_0x4882ca[_0x5c7f('0x25')];var _0x3f5c42=_0x44c68b?_0x5830e2['count']:_0x4882ca[_0x5c7f('0x25')]+_0x4882ca[_0x5c7f('0x27')];var _0x41a3c7;if(_0x3f5c42>=_0x488c11){_0x3f5c42=_0x488c11;_0x41a3c7=0xc8;}else{_0x41a3c7=0xce;}_0x3a8843[_0x5c7f('0x24')](_0x41a3c7);return _0x3a8843[_0x5c7f('0x29')]('Content-Range',_0x20c17e+'-'+_0x3f5c42+'/'+_0x488c11)[_0x5c7f('0x2a')](_0x5830e2);}return null;};}function patchUpdates(_0x2accaa){return function(_0xcab4ac){try{jsonpatch[_0x5c7f('0x2b')](_0xcab4ac,_0x2accaa,!![]);}catch(_0x4c8495){return BPromise[_0x5c7f('0x2c')](_0x4c8495);}return _0xcab4ac['save']();};}function saveUpdates(_0x5b551d,_0x2039b0){return function(_0x57d0ae){if(_0x57d0ae){return _0x57d0ae[_0x5c7f('0x2d')](_0x5b551d)[_0x5c7f('0x2e')](function(_0x37ba2a){return _0x37ba2a;});}return null;};}function removeEntity(_0x148a8d,_0x354dfc){return function(_0x449275){if(_0x449275){return _0x449275[_0x5c7f('0x2f')]()['then'](function(){var _0x5b6376=_0x449275['get']({'plain':!![]});var _0x521c5f=_0x5c7f('0x30');return db['UserProfileResource'][_0x5c7f('0x2f')]({'where':{'type':_0x521c5f,'resourceId':_0x5b6376['id']}})[_0x5c7f('0x2e')](function(){return _0x449275;});})[_0x5c7f('0x2e')](function(){_0x148a8d[_0x5c7f('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56b588,_0x5141ad){return function(_0x27c410){if(!_0x27c410){_0x56b588[_0x5c7f('0x22')](0x194);}return _0x27c410;};}function handleError(_0xcfe6a2,_0x2063a9){_0x2063a9=_0x2063a9||0x1f4;return function(_0x4b6dfa){logger[_0x5c7f('0x31')](_0x4b6dfa[_0x5c7f('0x32')]);if(_0x4b6dfa[_0x5c7f('0x33')]){delete _0x4b6dfa['name'];}_0xcfe6a2[_0x5c7f('0x24')](_0x2063a9)[_0x5c7f('0x34')](_0x4b6dfa);};}exports[_0x5c7f('0x35')]=function(_0x47f20d,_0x28449a){var _0x2a90aa={},_0x123b83={},_0x4aeeaa={'count':0x0,'rows':[]};var _0xc0ae6e=_[_0x5c7f('0x36')](db[_0x5c7f('0x37')][_0x5c7f('0x38')],function(_0x43ccf1){return{'name':_0x43ccf1[_0x5c7f('0x39')],'type':_0x43ccf1[_0x5c7f('0x3a')][_0x5c7f('0x3b')]};});_0x123b83[_0x5c7f('0x3c')]=_[_0x5c7f('0x36')](_0xc0ae6e,_0x5c7f('0x33'));_0x123b83[_0x5c7f('0x3d')]=_['keys'](_0x47f20d[_0x5c7f('0x3d')]);_0x123b83[_0x5c7f('0x3e')]=_[_0x5c7f('0x3f')](_0x123b83[_0x5c7f('0x3c')],_0x123b83[_0x5c7f('0x3d')]);_0x2a90aa[_0x5c7f('0x40')]=_[_0x5c7f('0x3f')](_0x123b83[_0x5c7f('0x3c')],qs[_0x5c7f('0x41')](_0x47f20d[_0x5c7f('0x3d')][_0x5c7f('0x41')]));_0x2a90aa['attributes']=_0x2a90aa[_0x5c7f('0x40')][_0x5c7f('0x42')]?_0x2a90aa[_0x5c7f('0x40')]:_0x123b83[_0x5c7f('0x3c')];if(!_0x47f20d[_0x5c7f('0x3d')][_0x5c7f('0x43')](_0x5c7f('0x44'))){_0x2a90aa[_0x5c7f('0x27')]=qs[_0x5c7f('0x27')](_0x47f20d[_0x5c7f('0x3d')][_0x5c7f('0x27')]);_0x2a90aa[_0x5c7f('0x25')]=qs[_0x5c7f('0x25')](_0x47f20d[_0x5c7f('0x3d')][_0x5c7f('0x25')]);}_0x2a90aa[_0x5c7f('0x45')]=qs[_0x5c7f('0x46')](_0x47f20d[_0x5c7f('0x3d')][_0x5c7f('0x46')]);_0x2a90aa['where']=qs['filters'](_[_0x5c7f('0x47')](_0x47f20d[_0x5c7f('0x3d')],_0x123b83[_0x5c7f('0x3e')]),_0xc0ae6e);if(_0x47f20d['query'][_0x5c7f('0x48')]){_0x2a90aa['where']=_['merge'](_0x2a90aa[_0x5c7f('0x49')],{'$or':_[_0x5c7f('0x36')](_0xc0ae6e,function(_0x50d722){if(_0x50d722[_0x5c7f('0x3a')]!=='VIRTUAL'){var _0x43283e={};_0x43283e[_0x50d722[_0x5c7f('0x33')]]={'$like':'%'+_0x47f20d['query'][_0x5c7f('0x48')]+'%'};return _0x43283e;}})});}_0x2a90aa=_[_0x5c7f('0x4a')]({},_0x2a90aa,_0x47f20d[_0x5c7f('0x4b')]);var _0xf3694b={'where':_0x2a90aa['where']};return db[_0x5c7f('0x37')][_0x5c7f('0x28')](_0xf3694b)[_0x5c7f('0x2e')](function(_0x1d46f7){_0x4aeeaa[_0x5c7f('0x28')]=_0x1d46f7;if(_0x47f20d[_0x5c7f('0x3d')][_0x5c7f('0x4c')]){_0x2a90aa[_0x5c7f('0x4d')]=[{'all':!![]}];}return db[_0x5c7f('0x37')][_0x5c7f('0x4e')](_0x2a90aa);})[_0x5c7f('0x2e')](function(_0x123b82){_0x4aeeaa[_0x5c7f('0x4f')]=_0x123b82;return _0x4aeeaa;})[_0x5c7f('0x2e')](respondWithFilteredResult(_0x28449a,_0x2a90aa))[_0x5c7f('0x50')](handleError(_0x28449a,null));};exports[_0x5c7f('0x51')]=function(_0x351a6b,_0x33e35b){var _0x7371bb={'raw':![],'where':{'id':_0x351a6b[_0x5c7f('0x52')]['id']}},_0xd7af3c={};_0xd7af3c[_0x5c7f('0x3c')]=_['keys'](db[_0x5c7f('0x37')]['rawAttributes']);_0xd7af3c['query']=_[_0x5c7f('0x53')](_0x351a6b[_0x5c7f('0x3d')]);_0xd7af3c[_0x5c7f('0x3e')]=_[_0x5c7f('0x3f')](_0xd7af3c[_0x5c7f('0x3c')],_0xd7af3c[_0x5c7f('0x3d')]);_0x7371bb[_0x5c7f('0x40')]=_[_0x5c7f('0x3f')](_0xd7af3c[_0x5c7f('0x3c')],qs['fields'](_0x351a6b['query']['fields']));_0x7371bb[_0x5c7f('0x40')]=_0x7371bb['attributes'][_0x5c7f('0x42')]?_0x7371bb[_0x5c7f('0x40')]:_0xd7af3c[_0x5c7f('0x3c')];if(_0x351a6b[_0x5c7f('0x3d')][_0x5c7f('0x4c')]){_0x7371bb[_0x5c7f('0x4d')]=[{'all':!![]}];}_0x7371bb=_[_0x5c7f('0x4a')]({},_0x7371bb,_0x351a6b[_0x5c7f('0x4b')]);return db[_0x5c7f('0x37')][_0x5c7f('0x54')](_0x7371bb)['then'](handleEntityNotFound(_0x33e35b,null))['then'](respondWithResult(_0x33e35b,null))['catch'](handleError(_0x33e35b,null));};exports[_0x5c7f('0x55')]=function(_0x1611d1,_0x400dfc){return db[_0x5c7f('0x37')][_0x5c7f('0x55')](_0x1611d1[_0x5c7f('0x56')],{})[_0x5c7f('0x2e')](function(_0x3099e0){var _0x435ced=_0x1611d1[_0x5c7f('0x57')][_0x5c7f('0x58')]({'plain':!![]});if(!_0x435ced)throw new Error(_0x5c7f('0x59'));if(_0x435ced['role']===_0x5c7f('0x57')){var _0x524e57=_0x3099e0['get']({'plain':!![]});var _0x3c2629='Teams';return db[_0x5c7f('0x5a')][_0x5c7f('0x54')]({'where':{'name':_0x3c2629,'userProfileId':_0x435ced[_0x5c7f('0x5b')]},'raw':!![]})[_0x5c7f('0x2e')](function(_0x1f41e2){if(_0x1f41e2&&_0x1f41e2[_0x5c7f('0x5c')]===0x0){return db['UserProfileResource'][_0x5c7f('0x55')]({'name':_0x524e57[_0x5c7f('0x33')],'resourceId':_0x524e57['id'],'type':_0x1f41e2[_0x5c7f('0x33')],'sectionId':_0x1f41e2['id']},{})[_0x5c7f('0x2e')](function(){return _0x3099e0;});}else{return _0x3099e0;}})['catch'](function(_0x5d5b03){logger['error'](_0x5c7f('0x5d'),_0x5d5b03);throw _0x5d5b03;});}return _0x3099e0;})[_0x5c7f('0x2e')](respondWithResult(_0x400dfc,0xc9))[_0x5c7f('0x50')](handleError(_0x400dfc,null));};exports['update']=function(_0x23d320,_0x5e68a9){if(_0x23d320[_0x5c7f('0x56')]['id']){delete _0x23d320[_0x5c7f('0x56')]['id'];}return db[_0x5c7f('0x37')][_0x5c7f('0x54')]({'where':{'id':_0x23d320[_0x5c7f('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e68a9,null))['then'](saveUpdates(_0x23d320['body'],null))['then'](respondWithResult(_0x5e68a9,null))[_0x5c7f('0x50')](handleError(_0x5e68a9,null));};exports['destroy']=function(_0x3bb050,_0x4c7afe){return db[_0x5c7f('0x37')][_0x5c7f('0x54')]({'where':{'id':_0x3bb050['params']['id']}})[_0x5c7f('0x2e')](handleEntityNotFound(_0x4c7afe,null))['then'](removeEntity(_0x4c7afe,null))[_0x5c7f('0x50')](handleError(_0x4c7afe,null));};exports[_0x5c7f('0x5e')]=function(_0x218d2b,_0x4c3166,_0x575c86){return db[_0x5c7f('0x37')][_0x5c7f('0x5f')]({'where':{'id':_0x218d2b[_0x5c7f('0x52')]['id']}})[_0x5c7f('0x2e')](handleEntityNotFound(_0x4c3166,null))[_0x5c7f('0x2e')](function(_0x1ba800){if(!_0x218d2b[_0x5c7f('0x3d')][_0x5c7f('0x60')]||!utils['isValidChannel'](_0x218d2b[_0x5c7f('0x3d')][_0x5c7f('0x60')])){throw new db['Sequelize'][(_0x5c7f('0x61'))](_0x5c7f('0x62'));}var _0x5a1e51={};var _0x193b34={};_0x193b34[_0x5c7f('0x3c')]=_[_0x5c7f('0x53')](db[_[_0x5c7f('0x63')](_0x218d2b[_0x5c7f('0x3d')][_0x5c7f('0x60')][_0x5c7f('0x64')]())+_0x5c7f('0x65')]['rawAttributes']);_0x193b34[_0x5c7f('0x3d')]=_[_0x5c7f('0x53')](_0x218d2b['query']);_0x193b34[_0x5c7f('0x3e')]=_[_0x5c7f('0x3f')](_0x193b34[_0x5c7f('0x3c')],_0x193b34['query']);_0x5a1e51[_0x5c7f('0x40')]=_[_0x5c7f('0x3f')](_0x193b34['model'],qs['fields'](_0x218d2b['query'][_0x5c7f('0x41')]));_0x5a1e51['attributes']=_0x5a1e51[_0x5c7f('0x40')]['length']?_0x5a1e51[_0x5c7f('0x40')]:_0x193b34[_0x5c7f('0x3c')];_0x5a1e51[_0x5c7f('0x27')]=qs[_0x5c7f('0x27')](_0x218d2b[_0x5c7f('0x3d')][_0x5c7f('0x27')]);_0x5a1e51[_0x5c7f('0x25')]=qs[_0x5c7f('0x25')](_0x218d2b[_0x5c7f('0x3d')]['offset']);_0x5a1e51[_0x5c7f('0x45')]=qs[_0x5c7f('0x46')](_0x218d2b[_0x5c7f('0x3d')][_0x5c7f('0x46')]);_0x5a1e51[_0x5c7f('0x49')]=qs['filters'](_[_0x5c7f('0x47')](_0x218d2b['query'],_0x193b34['filters']));_0x5a1e51=_['merge']({},_0x5a1e51,_0x218d2b[_0x5c7f('0x4b')]);return _0x1ba800[_0x5c7f('0x58')+_['capitalize'](_0x218d2b['query'][_0x5c7f('0x60')][_0x5c7f('0x64')]())+_0x5c7f('0x66')](_0x5a1e51);})['then'](respondWithResult(_0x4c3166,null))[_0x5c7f('0x50')](handleError(_0x4c3166,null));};exports[_0x5c7f('0x67')]=function(_0x640771,_0x24bf51,_0x4d053a){return db['Team']['findOne']({'where':{'id':_0x640771[_0x5c7f('0x52')]['id']}})['then'](function(_0x3f271a){if(_0x3f271a){if(!_0x640771[_0x5c7f('0x56')][_0x5c7f('0x60')]||!utils['isValidChannel'](_0x640771[_0x5c7f('0x56')]['channel'])){throw new db[(_0x5c7f('0x68'))][(_0x5c7f('0x61'))](_0x5c7f('0x62'));}return _0x3f271a[_0x5c7f('0x69')+_[_0x5c7f('0x63')](_0x640771[_0x5c7f('0x56')][_0x5c7f('0x60')]['toLowerCase']())+_0x5c7f('0x66')](_0x640771['body'][_0x5c7f('0x6a')]);}return null;})[_0x5c7f('0x2e')](handleEntityNotFound(_0x24bf51,null))['then'](respondWithStatusCode(_0x24bf51,null))[_0x5c7f('0x50')](handleError(_0x24bf51,null));};exports[_0x5c7f('0x6b')]=function(_0x1e3938,_0x11f5f0,_0x2ea003){return db['Team'][_0x5c7f('0x5f')]({'where':{'id':_0x1e3938[_0x5c7f('0x52')]['id']}})['then'](function(_0x2eb1ef){if(_0x2eb1ef){if(!_0x1e3938[_0x5c7f('0x3d')][_0x5c7f('0x60')]||!utils[_0x5c7f('0x6c')](_0x1e3938[_0x5c7f('0x3d')][_0x5c7f('0x60')])){throw new db[(_0x5c7f('0x68'))]['ValidationError'](_0x5c7f('0x62'));}return _0x2eb1ef[_0x5c7f('0x6d')+_[_0x5c7f('0x63')](_0x1e3938[_0x5c7f('0x3d')][_0x5c7f('0x60')]['toLowerCase']())+_0x5c7f('0x66')](_0x1e3938[_0x5c7f('0x3d')][_0x5c7f('0x6a')]);}return null;})[_0x5c7f('0x2e')](handleEntityNotFound(_0x11f5f0,null))[_0x5c7f('0x2e')](respondWithStatusCode(_0x11f5f0,null))['catch'](handleError(_0x11f5f0,null));};exports[_0x5c7f('0x6e')]=function(_0x415f3e,_0x580f2b){var _0x41b430=_[_0x5c7f('0x6f')](_0x415f3e[_0x5c7f('0x56')][_0x5c7f('0x6a')])?_0x415f3e['body']['ids']:[_0x415f3e[_0x5c7f('0x56')][_0x5c7f('0x6a')]];var _0x54f878=_0x415f3e['params']['id'];return db[_0x5c7f('0x37')][_0x5c7f('0x54')]({'where':{'id':_0x54f878}})['then'](handleEntityNotFound(_0x580f2b,null))[_0x5c7f('0x2e')](function(_0x18aafd){if(_0x18aafd){var _0x136864=['Voice',_0x5c7f('0x70'),_0x5c7f('0x71'),_0x5c7f('0x72'),'Fax',_0x5c7f('0x73'),'Whatsapp'];return db[_0x5c7f('0x74')][_0x5c7f('0x75')](function(_0x367f44){var _0x45872c=_[_0x5c7f('0x36')](_0x136864,function(_0x5c4562){var _0xf781d9={'attributes':['id',_0x5c7f('0x33')]};if(_0x5c4562===_0x5c7f('0x76')){_0xf781d9[_0x5c7f('0x77')]={'attributes':[_0x5c7f('0x78')]};}return _0x18aafd['get'+_0x5c4562+'Queues'](_0xf781d9)[_0x5c7f('0x2e')](function(_0x4c7e53){var _0x3139e3=_[_0x5c7f('0x36')](_0x4c7e53,function(_0x269021){var _0x2dd7ee=_[_0x5c7f('0x36')](_0x41b430,function(_0x21cffc){var _0x2793c8={'where':{'UserId':_0x21cffc,[_0x5c4562+'QueueId']:_0x269021['id']},'transaction':_0x367f44};if(_0x5c4562===_0x5c7f('0x76')){_0x2793c8[_0x5c7f('0x1d')]={'penalty':_0x269021['TeamVoiceQueue']['penalty']};}return db['User'+_0x5c4562+'Queue'][_0x5c7f('0x79')](_0x2793c8)[_0x5c7f('0x2e')](function(){socket[_0x5c7f('0x7a')]('user'+_0x5c4562+'Queue:save',{'UserId':_0x21cffc,[_0x5c4562+_0x5c7f('0x7b')]:_0x269021['id']});if(_0x5c4562!==_0x5c7f('0x76')){return;}return db[_0x5c7f('0x7c')][_0x5c7f('0x4e')]({'where':{'id':_0x41b430,'online':0x1},'attributes':['id',_0x5c7f('0x33'),_0x5c7f('0x7d'),_0x5c7f('0x7e'),_0x5c7f('0x7f')],'raw':!![]})[_0x5c7f('0x2e')](function(_0x33a730){var _0x394ffe=_[_0x5c7f('0x36')](_0x33a730,function(_0x3de05e){return db['UserVoiceQueueRt'][_0x5c7f('0x80')]({'membername':_0x3de05e['name'],'UserId':_0x3de05e['id'],'queue_name':_0x269021[_0x5c7f('0x33')],'VoiceQueueId':_0x269021['id'],'interface':_[_0x5c7f('0x81')](_0x3de05e[_0x5c7f('0x7f')])?util[_0x5c7f('0x82')](_0x5c7f('0x83'),_0x3de05e['name']):_0x3de05e[_0x5c7f('0x7f')],'paused':_0x3de05e['voicePause']||![],'penalty':_0x269021[_0x5c7f('0x84')][_0x5c7f('0x78')]},{'transaction':_0x367f44});});return Promise['all'](_0x394ffe);});});});return Promise[_0x5c7f('0x85')](_0x2dd7ee);});return Promise[_0x5c7f('0x85')](_0x3139e3);})[_0x5c7f('0x2e')](function(){return db[_0x5c7f('0x86')]['findOne']({'where':{'teamId':_0x54f878}})['then'](function(_0x53ae2c){if(_0x53ae2c){var _0x3959d7=_[_0x5c7f('0x36')](_0x41b430,function(_0x47e3a7){db[_0x5c7f('0x87')][_0x5c7f('0x80')]({'UserId':_0x47e3a7,'VoicePrefixId':_0x53ae2c[_0x5c7f('0x88')]});});return Promise[_0x5c7f('0x85')](_0x3959d7);}});});});return Promise['all'](_0x45872c)[_0x5c7f('0x2e')](function(){return _0x18aafd['addAgents'](_0x41b430,{'transaction':_0x367f44})[_0x5c7f('0x89')](function(_0x2428db){return _0x2428db;});});});}})['then'](respondWithResult(_0x580f2b,null))['catch'](handleError(_0x580f2b,null));};exports[_0x5c7f('0x8a')]=function(_0x23bf0f,_0x1069a7){var _0x40b3d4=_[_0x5c7f('0x6f')](_0x23bf0f[_0x5c7f('0x3d')]['ids'])?_0x23bf0f[_0x5c7f('0x3d')][_0x5c7f('0x6a')]:[_0x23bf0f[_0x5c7f('0x3d')][_0x5c7f('0x6a')]];var _0x189f97=_0x23bf0f[_0x5c7f('0x52')]['id'];return db['Team'][_0x5c7f('0x54')]({'where':{'id':_0x189f97}})['then'](handleEntityNotFound(_0x1069a7,null))['then'](function(_0x1c18c0){if(_0x1c18c0){var _0x3354fe=[_0x5c7f('0x76'),_0x5c7f('0x70'),_0x5c7f('0x71'),_0x5c7f('0x72'),'Fax',_0x5c7f('0x73'),'Whatsapp'];return db[_0x5c7f('0x74')][_0x5c7f('0x75')](function(_0x55a0b3){var _0x4d858b=_[_0x5c7f('0x36')](_0x3354fe,function(_0x2d4e1d){var _0x117c73={'attributes':['id',_0x5c7f('0x33')]};return _0x1c18c0[_0x5c7f('0x58')+_0x2d4e1d+_0x5c7f('0x66')](_0x117c73)['then'](function(_0xa85ae5){var _0x579cef=_[_0x5c7f('0x36')](_0xa85ae5,function(_0x187990){return _0x187990['removeAgents'](_0x40b3d4,{'transaction':_0x55a0b3})[_0x5c7f('0x2e')](function(){var _0x218f12=_[_0x5c7f('0x36')](_0x40b3d4,function(_0x2ed7ef){socket[_0x5c7f('0x7a')]('user'+_0x2d4e1d+_0x5c7f('0x8b'),{'UserId':Number(_0x2ed7ef),[_0x2d4e1d+_0x5c7f('0x7b')]:_0x187990['id']});if(_0x2d4e1d!==_0x5c7f('0x76')){return;}return db[_0x5c7f('0x8c')][_0x5c7f('0x2f')]({'where':{'VoiceQueueId':_0x187990['id'],'UserId':_0x2ed7ef},'transaction':_0x55a0b3});});return Promise[_0x5c7f('0x85')](_0x218f12);});});return Promise[_0x5c7f('0x85')](_0x579cef);});});return Promise[_0x5c7f('0x85')](_0x4d858b)[_0x5c7f('0x2e')](function(){return _0x1c18c0['removeAgents'](_0x40b3d4,{'transaction':_0x55a0b3});})[_0x5c7f('0x2e')](function(){return db[_0x5c7f('0x86')][_0x5c7f('0x5f')]({'where':{'teamId':_0x189f97}})[_0x5c7f('0x2e')](function(_0x3188ad){if(_0x3188ad){var _0x26e2a5=_[_0x5c7f('0x36')](_0x40b3d4,function(_0x54a636){db[_0x5c7f('0x87')][_0x5c7f('0x2f')]({'where':{'UserId':_0x54a636,'VoicePrefixId':_0x3188ad[_0x5c7f('0x88')]}});});return Promise[_0x5c7f('0x85')](_0x26e2a5);}});});});}})[_0x5c7f('0x2e')](respondWithStatusCode(_0x1069a7,null))[_0x5c7f('0x50')](handleError(_0x1069a7,null));};exports[_0x5c7f('0x8d')]=function(_0x53187e,_0x58caa6,_0x3ad450){var _0x215651={};var _0xb65569={};var _0x120abb;var _0xd35ab3;return db[_0x5c7f('0x37')][_0x5c7f('0x5f')]({'where':{'id':_0x53187e[_0x5c7f('0x52')]['id']}})[_0x5c7f('0x2e')](handleEntityNotFound(_0x58caa6,null))[_0x5c7f('0x2e')](function(_0x5d9d0f){if(_0x5d9d0f){_0x120abb=_0x5d9d0f;_0xb65569['model']=_['keys'](db[_0x5c7f('0x7c')]['rawAttributes']);_0xb65569[_0x5c7f('0x3d')]=_[_0x5c7f('0x53')](_0x53187e[_0x5c7f('0x3d')]);_0xb65569[_0x5c7f('0x3e')]=_['intersection'](_0xb65569[_0x5c7f('0x3c')],_0xb65569['query']);_0x215651[_0x5c7f('0x40')]=_['intersection'](_0xb65569[_0x5c7f('0x3c')],qs[_0x5c7f('0x41')](_0x53187e[_0x5c7f('0x3d')]['fields']));_0x215651['attributes']=_0x215651[_0x5c7f('0x40')][_0x5c7f('0x42')]?_0x215651['attributes']:_0xb65569['model'];_0x215651[_0x5c7f('0x45')]=qs[_0x5c7f('0x46')](_0x53187e[_0x5c7f('0x3d')][_0x5c7f('0x46')]);_0x215651[_0x5c7f('0x49')]=qs[_0x5c7f('0x3e')](_[_0x5c7f('0x47')](_0x53187e[_0x5c7f('0x3d')],_0xb65569[_0x5c7f('0x3e')]));if(_0x53187e[_0x5c7f('0x3d')][_0x5c7f('0x48')]){_0x215651[_0x5c7f('0x49')]=_[_0x5c7f('0x4a')](_0x215651[_0x5c7f('0x49')],{'$or':_[_0x5c7f('0x36')](_0x215651[_0x5c7f('0x40')],function(_0x2883a0){var _0x3a7ef2={};_0x3a7ef2[_0x2883a0]={'$like':'%'+_0x53187e['query'][_0x5c7f('0x48')]+'%'};return _0x3a7ef2;})});}_0x215651=_[_0x5c7f('0x4a')]({},_0x215651,_0x53187e[_0x5c7f('0x4b')]);return _0x120abb[_0x5c7f('0x8d')](_0x215651);}})['then'](function(_0x3b8d86){if(_0x3b8d86){_0xd35ab3=_0x3b8d86[_0x5c7f('0x42')];if(!_0x53187e[_0x5c7f('0x3d')][_0x5c7f('0x43')](_0x5c7f('0x44'))){_0x215651[_0x5c7f('0x27')]=qs[_0x5c7f('0x27')](_0x53187e[_0x5c7f('0x3d')][_0x5c7f('0x27')]);_0x215651['offset']=qs[_0x5c7f('0x25')](_0x53187e['query'][_0x5c7f('0x25')]);}return _0x120abb['getAgents'](_0x215651);}})[_0x5c7f('0x2e')](function(_0x58f34b){if(_0x58f34b){return _0x58f34b?{'count':_0xd35ab3,'rows':_0x58f34b}:null;}})[_0x5c7f('0x2e')](respondWithResult(_0x58caa6,null))[_0x5c7f('0x50')](handleError(_0x58caa6,null));}; \ No newline at end of file +var _0x1669=['ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./team.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Teams','sendStatus','error','name','send','map','Team','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','UserProfileResource','create','getQueues','findOne','channel','Sequelize','Unknown\x20channel','toLowerCase','pick','capitalize','Queues','addQueues','ValidationError','add','ids','removeQueues','addAgents','Chat','Mail','Sms','Openchannel','Whatsapp','transaction','Voice','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','online','interface','UserVoiceQueueRt','format','SIP/%s','voicePause','all','UserVoicePrefix','upsert','VoicePrefixId','spread','removeAgents','Fax','Queue:remove','TeamVoicePrefix','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x2deac4,_0xc27a2b){var _0x1c0bda=function(_0x1deceb){while(--_0x1deceb){_0x2deac4['push'](_0x2deac4['shift']());}};_0x1c0bda(++_0xc27a2b);}(_0x1669,0x18d));var _0x9166=function(_0x150467,_0x449244){_0x150467=_0x150467-0x0;var _0x29a44b=_0x1669[_0x150467];return _0x29a44b;};'use strict';var emlformat=require(_0x9166('0x0'));var rimraf=require(_0x9166('0x1'));var zipdir=require(_0x9166('0x2'));var jsonpatch=require(_0x9166('0x3'));var rp=require(_0x9166('0x4'));var moment=require(_0x9166('0x5'));var BPromise=require(_0x9166('0x6'));var Mustache=require(_0x9166('0x7'));var util=require(_0x9166('0x8'));var path=require(_0x9166('0x9'));var sox=require('sox');var csv=require(_0x9166('0xa'));var ejs=require(_0x9166('0xb'));var fs=require('fs');var fs_extra=require(_0x9166('0xc'));var _=require(_0x9166('0xd'));var squel=require(_0x9166('0xe'));var crypto=require(_0x9166('0xf'));var jsforce=require(_0x9166('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9166('0x11'));var Papa=require(_0x9166('0x12'));var Redis=require('ioredis');var authService=require(_0x9166('0x13'));var qs=require(_0x9166('0x14'));var as=require(_0x9166('0x15'));var hardwareService=require(_0x9166('0x16'));var logger=require(_0x9166('0x17'))('api');var utils=require(_0x9166('0x18'));var config=require(_0x9166('0x19'));var licenseUtil=require(_0x9166('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9166('0x1b')](config[_0x9166('0x1c')],{'host':_0x9166('0x1d'),'port':0x18eb});var socket=require(_0x9166('0x1e'))(new Redis(config['redis']));require(_0x9166('0x1f'))[_0x9166('0x20')](socket);function respondWithStatusCode(_0x45cc02,_0x4e852e){_0x4e852e=_0x4e852e||0xcc;return function(_0x2394fd){if(_0x2394fd){return _0x45cc02['sendStatus'](_0x4e852e);}return _0x45cc02[_0x9166('0x21')](_0x4e852e)[_0x9166('0x22')]();};}function respondWithResult(_0x58b6dd,_0x5b494f){_0x5b494f=_0x5b494f||0xc8;return function(_0x3707c1){if(_0x3707c1){return _0x58b6dd[_0x9166('0x21')](_0x5b494f)['json'](_0x3707c1);}};}function respondWithFilteredResult(_0x11f98e,_0x24550b){return function(_0x23be48){if(_0x23be48){var _0x46b026=typeof _0x24550b[_0x9166('0x23')]===_0x9166('0x24')&&typeof _0x24550b[_0x9166('0x25')]==='undefined';var _0x47b3b0=_0x23be48[_0x9166('0x26')];var _0xfa71c2=_0x46b026?0x0:_0x24550b[_0x9166('0x23')];var _0x4d4331=_0x46b026?_0x23be48['count']:_0x24550b['offset']+_0x24550b[_0x9166('0x25')];var _0x20961f;if(_0x4d4331>=_0x47b3b0){_0x4d4331=_0x47b3b0;_0x20961f=0xc8;}else{_0x20961f=0xce;}_0x11f98e['status'](_0x20961f);return _0x11f98e[_0x9166('0x27')](_0x9166('0x28'),_0xfa71c2+'-'+_0x4d4331+'/'+_0x47b3b0)['json'](_0x23be48);}return null;};}function patchUpdates(_0x39f6b5){return function(_0xaf5aea){try{jsonpatch[_0x9166('0x29')](_0xaf5aea,_0x39f6b5,!![]);}catch(_0x1373f1){return BPromise[_0x9166('0x2a')](_0x1373f1);}return _0xaf5aea[_0x9166('0x2b')]();};}function saveUpdates(_0x38e54d,_0x46db43){return function(_0x2a8922){if(_0x2a8922){return _0x2a8922[_0x9166('0x2c')](_0x38e54d)[_0x9166('0x2d')](function(_0x25ebfe){return _0x25ebfe;});}return null;};}function removeEntity(_0x2026c2,_0x2f7cb1){return function(_0x64683e){if(_0x64683e){return _0x64683e[_0x9166('0x2e')]()[_0x9166('0x2d')](function(){var _0x5667a8=_0x64683e[_0x9166('0x2f')]({'plain':!![]});var _0x2d5d39=_0x9166('0x30');return db['UserProfileResource']['destroy']({'where':{'type':_0x2d5d39,'resourceId':_0x5667a8['id']}})[_0x9166('0x2d')](function(){return _0x64683e;});})[_0x9166('0x2d')](function(){_0x2026c2['status'](0xcc)[_0x9166('0x22')]();});}};}function handleEntityNotFound(_0x1e2eab,_0x35767b){return function(_0x173a9a){if(!_0x173a9a){_0x1e2eab[_0x9166('0x31')](0x194);}return _0x173a9a;};}function handleError(_0x23190c,_0x2aeb09){_0x2aeb09=_0x2aeb09||0x1f4;return function(_0x1268dc){logger[_0x9166('0x32')](_0x1268dc['stack']);if(_0x1268dc[_0x9166('0x33')]){delete _0x1268dc[_0x9166('0x33')];}_0x23190c['status'](_0x2aeb09)[_0x9166('0x34')](_0x1268dc);};}exports['index']=function(_0xb1a7f,_0x4d16c6){var _0x5185b8={},_0x2ea63d={},_0x404284={'count':0x0,'rows':[]};var _0x24da68=_[_0x9166('0x35')](db[_0x9166('0x36')][_0x9166('0x37')],function(_0x4f1995){return{'name':_0x4f1995[_0x9166('0x38')],'type':_0x4f1995[_0x9166('0x39')]['key']};});_0x2ea63d[_0x9166('0x3a')]=_[_0x9166('0x35')](_0x24da68,_0x9166('0x33'));_0x2ea63d[_0x9166('0x3b')]=_['keys'](_0xb1a7f['query']);_0x2ea63d['filters']=_[_0x9166('0x3c')](_0x2ea63d[_0x9166('0x3a')],_0x2ea63d[_0x9166('0x3b')]);_0x5185b8['attributes']=_['intersection'](_0x2ea63d[_0x9166('0x3a')],qs[_0x9166('0x3d')](_0xb1a7f[_0x9166('0x3b')][_0x9166('0x3d')]));_0x5185b8[_0x9166('0x3e')]=_0x5185b8['attributes'][_0x9166('0x3f')]?_0x5185b8[_0x9166('0x3e')]:_0x2ea63d['model'];if(!_0xb1a7f[_0x9166('0x3b')][_0x9166('0x40')](_0x9166('0x41'))){_0x5185b8['limit']=qs[_0x9166('0x25')](_0xb1a7f[_0x9166('0x3b')]['limit']);_0x5185b8[_0x9166('0x23')]=qs['offset'](_0xb1a7f[_0x9166('0x3b')][_0x9166('0x23')]);}_0x5185b8[_0x9166('0x42')]=qs[_0x9166('0x43')](_0xb1a7f[_0x9166('0x3b')][_0x9166('0x43')]);_0x5185b8[_0x9166('0x44')]=qs[_0x9166('0x45')](_['pick'](_0xb1a7f['query'],_0x2ea63d[_0x9166('0x45')]),_0x24da68);if(_0xb1a7f[_0x9166('0x3b')][_0x9166('0x46')]){_0x5185b8['where']=_[_0x9166('0x47')](_0x5185b8[_0x9166('0x44')],{'$or':_[_0x9166('0x35')](_0x24da68,function(_0x45b809){if(_0x45b809[_0x9166('0x39')]!==_0x9166('0x48')){var _0x3548e6={};_0x3548e6[_0x45b809[_0x9166('0x33')]]={'$like':'%'+_0xb1a7f[_0x9166('0x3b')][_0x9166('0x46')]+'%'};return _0x3548e6;}})});}_0x5185b8=_[_0x9166('0x47')]({},_0x5185b8,_0xb1a7f[_0x9166('0x49')]);var _0x27f210={'where':_0x5185b8[_0x9166('0x44')]};return db['Team'][_0x9166('0x26')](_0x27f210)['then'](function(_0x417bc4){_0x404284[_0x9166('0x26')]=_0x417bc4;if(_0xb1a7f[_0x9166('0x3b')][_0x9166('0x4a')]){_0x5185b8[_0x9166('0x4b')]=[{'all':!![]}];}return db[_0x9166('0x36')][_0x9166('0x4c')](_0x5185b8);})[_0x9166('0x2d')](function(_0x16b446){_0x404284[_0x9166('0x4d')]=_0x16b446;return _0x404284;})['then'](respondWithFilteredResult(_0x4d16c6,_0x5185b8))[_0x9166('0x4e')](handleError(_0x4d16c6,null));};exports[_0x9166('0x4f')]=function(_0x127c9c,_0x4ccdc2){var _0x53fa9a={'raw':![],'where':{'id':_0x127c9c[_0x9166('0x50')]['id']}},_0x15d6d9={};_0x15d6d9[_0x9166('0x3a')]=_[_0x9166('0x51')](db[_0x9166('0x36')][_0x9166('0x37')]);_0x15d6d9[_0x9166('0x3b')]=_['keys'](_0x127c9c[_0x9166('0x3b')]);_0x15d6d9['filters']=_['intersection'](_0x15d6d9[_0x9166('0x3a')],_0x15d6d9['query']);_0x53fa9a[_0x9166('0x3e')]=_[_0x9166('0x3c')](_0x15d6d9[_0x9166('0x3a')],qs[_0x9166('0x3d')](_0x127c9c[_0x9166('0x3b')][_0x9166('0x3d')]));_0x53fa9a[_0x9166('0x3e')]=_0x53fa9a[_0x9166('0x3e')][_0x9166('0x3f')]?_0x53fa9a[_0x9166('0x3e')]:_0x15d6d9[_0x9166('0x3a')];if(_0x127c9c[_0x9166('0x3b')][_0x9166('0x4a')]){_0x53fa9a[_0x9166('0x4b')]=[{'all':!![]}];}_0x53fa9a=_[_0x9166('0x47')]({},_0x53fa9a,_0x127c9c[_0x9166('0x49')]);return db[_0x9166('0x36')]['find'](_0x53fa9a)[_0x9166('0x2d')](handleEntityNotFound(_0x4ccdc2,null))[_0x9166('0x2d')](respondWithResult(_0x4ccdc2,null))[_0x9166('0x4e')](handleError(_0x4ccdc2,null));};exports['create']=function(_0x9164d5,_0x36ae2a){return db['Team']['create'](_0x9164d5[_0x9166('0x52')],{})['then'](function(_0x373bef){var _0x15da24=_0x9164d5['user'][_0x9166('0x2f')]({'plain':!![]});if(!_0x15da24)throw new Error(_0x9166('0x53'));if(_0x15da24[_0x9166('0x54')]===_0x9166('0x55')){var _0x1576b6=_0x373bef['get']({'plain':!![]});var _0x902b38='Teams';return db['UserProfileSection'][_0x9166('0x56')]({'where':{'name':_0x902b38,'userProfileId':_0x15da24[_0x9166('0x57')]},'raw':!![]})[_0x9166('0x2d')](function(_0x34108d){if(_0x34108d&&_0x34108d[_0x9166('0x58')]===0x0){return db[_0x9166('0x59')][_0x9166('0x5a')]({'name':_0x1576b6['name'],'resourceId':_0x1576b6['id'],'type':_0x34108d[_0x9166('0x33')],'sectionId':_0x34108d['id']},{})['then'](function(){return _0x373bef;});}else{return _0x373bef;}})[_0x9166('0x4e')](function(_0x404dd9){logger[_0x9166('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x404dd9);throw _0x404dd9;});}return _0x373bef;})['then'](respondWithResult(_0x36ae2a,0xc9))[_0x9166('0x4e')](handleError(_0x36ae2a,null));};exports[_0x9166('0x2c')]=function(_0x2bb43f,_0x1aa2bd){if(_0x2bb43f[_0x9166('0x52')]['id']){delete _0x2bb43f[_0x9166('0x52')]['id'];}return db[_0x9166('0x36')]['find']({'where':{'id':_0x2bb43f[_0x9166('0x50')]['id']}})[_0x9166('0x2d')](handleEntityNotFound(_0x1aa2bd,null))[_0x9166('0x2d')](saveUpdates(_0x2bb43f[_0x9166('0x52')],null))[_0x9166('0x2d')](respondWithResult(_0x1aa2bd,null))[_0x9166('0x4e')](handleError(_0x1aa2bd,null));};exports[_0x9166('0x2e')]=function(_0x207ba6,_0x58a698){return db[_0x9166('0x36')][_0x9166('0x56')]({'where':{'id':_0x207ba6[_0x9166('0x50')]['id']}})[_0x9166('0x2d')](handleEntityNotFound(_0x58a698,null))[_0x9166('0x2d')](removeEntity(_0x58a698,null))[_0x9166('0x4e')](handleError(_0x58a698,null));};exports[_0x9166('0x5b')]=function(_0x1d543b,_0x2e5d1e,_0x46e4b5){return db[_0x9166('0x36')][_0x9166('0x5c')]({'where':{'id':_0x1d543b['params']['id']}})[_0x9166('0x2d')](handleEntityNotFound(_0x2e5d1e,null))[_0x9166('0x2d')](function(_0x5029ed){if(!_0x1d543b[_0x9166('0x3b')]['channel']||!utils['isValidChannel'](_0x1d543b[_0x9166('0x3b')][_0x9166('0x5d')])){throw new db[(_0x9166('0x5e'))]['ValidationError'](_0x9166('0x5f'));}var _0x1d6c4a={};var _0x183a7f={};_0x183a7f[_0x9166('0x3a')]=_['keys'](db[_['capitalize'](_0x1d543b[_0x9166('0x3b')][_0x9166('0x5d')][_0x9166('0x60')]())+'Queue']['rawAttributes']);_0x183a7f['query']=_['keys'](_0x1d543b[_0x9166('0x3b')]);_0x183a7f[_0x9166('0x45')]=_[_0x9166('0x3c')](_0x183a7f[_0x9166('0x3a')],_0x183a7f[_0x9166('0x3b')]);_0x1d6c4a[_0x9166('0x3e')]=_[_0x9166('0x3c')](_0x183a7f['model'],qs[_0x9166('0x3d')](_0x1d543b['query'][_0x9166('0x3d')]));_0x1d6c4a['attributes']=_0x1d6c4a[_0x9166('0x3e')][_0x9166('0x3f')]?_0x1d6c4a[_0x9166('0x3e')]:_0x183a7f[_0x9166('0x3a')];_0x1d6c4a[_0x9166('0x25')]=qs['limit'](_0x1d543b[_0x9166('0x3b')][_0x9166('0x25')]);_0x1d6c4a[_0x9166('0x23')]=qs[_0x9166('0x23')](_0x1d543b[_0x9166('0x3b')]['offset']);_0x1d6c4a[_0x9166('0x42')]=qs[_0x9166('0x43')](_0x1d543b[_0x9166('0x3b')][_0x9166('0x43')]);_0x1d6c4a[_0x9166('0x44')]=qs[_0x9166('0x45')](_[_0x9166('0x61')](_0x1d543b[_0x9166('0x3b')],_0x183a7f['filters']));_0x1d6c4a=_['merge']({},_0x1d6c4a,_0x1d543b[_0x9166('0x49')]);return _0x5029ed[_0x9166('0x2f')+_[_0x9166('0x62')](_0x1d543b['query']['channel'][_0x9166('0x60')]())+_0x9166('0x63')](_0x1d6c4a);})[_0x9166('0x2d')](respondWithResult(_0x2e5d1e,null))[_0x9166('0x4e')](handleError(_0x2e5d1e,null));};exports[_0x9166('0x64')]=function(_0x367431,_0xb64092,_0x3c71c8){return db[_0x9166('0x36')]['findOne']({'where':{'id':_0x367431['params']['id']}})[_0x9166('0x2d')](function(_0x276375){if(_0x276375){if(!_0x367431[_0x9166('0x52')][_0x9166('0x5d')]||!utils['isValidChannel'](_0x367431['body'][_0x9166('0x5d')])){throw new db[(_0x9166('0x5e'))][(_0x9166('0x65'))]('Unknown\x20channel');}return _0x276375[_0x9166('0x66')+_['capitalize'](_0x367431[_0x9166('0x52')][_0x9166('0x5d')][_0x9166('0x60')]())+'Queues'](_0x367431['body'][_0x9166('0x67')]);}return null;})[_0x9166('0x2d')](handleEntityNotFound(_0xb64092,null))[_0x9166('0x2d')](respondWithStatusCode(_0xb64092,null))[_0x9166('0x4e')](handleError(_0xb64092,null));};exports[_0x9166('0x68')]=function(_0x340f9a,_0x13ac7e,_0x4cce72){return db[_0x9166('0x36')][_0x9166('0x5c')]({'where':{'id':_0x340f9a[_0x9166('0x50')]['id']}})[_0x9166('0x2d')](function(_0x55d706){if(_0x55d706){if(!_0x340f9a[_0x9166('0x3b')]['channel']||!utils['isValidChannel'](_0x340f9a[_0x9166('0x3b')][_0x9166('0x5d')])){throw new db[(_0x9166('0x5e'))]['ValidationError'](_0x9166('0x5f'));}return _0x55d706['remove'+_[_0x9166('0x62')](_0x340f9a[_0x9166('0x3b')][_0x9166('0x5d')][_0x9166('0x60')]())+_0x9166('0x63')](_0x340f9a[_0x9166('0x3b')][_0x9166('0x67')]);}return null;})[_0x9166('0x2d')](handleEntityNotFound(_0x13ac7e,null))[_0x9166('0x2d')](respondWithStatusCode(_0x13ac7e,null))[_0x9166('0x4e')](handleError(_0x13ac7e,null));};exports[_0x9166('0x69')]=function(_0x1c08fb,_0x218b5e){var _0x372a23=_['isArray'](_0x1c08fb['body'][_0x9166('0x67')])?_0x1c08fb['body'][_0x9166('0x67')]:[_0x1c08fb[_0x9166('0x52')][_0x9166('0x67')]];var _0x5a4094=_0x1c08fb['params']['id'];return db[_0x9166('0x36')][_0x9166('0x56')]({'where':{'id':_0x5a4094}})[_0x9166('0x2d')](handleEntityNotFound(_0x218b5e,null))[_0x9166('0x2d')](function(_0x2ce5dd){if(_0x2ce5dd){var _0x177e3c=['Voice',_0x9166('0x6a'),_0x9166('0x6b'),_0x9166('0x6c'),'Fax',_0x9166('0x6d'),_0x9166('0x6e')];return db['sequelize'][_0x9166('0x6f')](function(_0x5c5bac){var _0x532673=_[_0x9166('0x35')](_0x177e3c,function(_0x3f4b1d){var _0x5b2364={'attributes':['id',_0x9166('0x33')]};if(_0x3f4b1d===_0x9166('0x70')){_0x5b2364[_0x9166('0x71')]={'attributes':[_0x9166('0x72')]};}return _0x2ce5dd[_0x9166('0x2f')+_0x3f4b1d+'Queues'](_0x5b2364)[_0x9166('0x2d')](function(_0x5a0394){var _0x543465=_['map'](_0x5a0394,function(_0x2e5d3e){var _0x5a33c3=_['map'](_0x372a23,function(_0x55084e){var _0x12bf16={'where':{'UserId':_0x55084e,[_0x3f4b1d+_0x9166('0x73')]:_0x2e5d3e['id']},'transaction':_0x5c5bac};if(_0x3f4b1d===_0x9166('0x70')){_0x12bf16[_0x9166('0x1b')]={'penalty':_0x2e5d3e[_0x9166('0x74')][_0x9166('0x72')]};}return db[_0x9166('0x75')+_0x3f4b1d+'Queue'][_0x9166('0x76')](_0x12bf16)[_0x9166('0x2d')](function(){socket[_0x9166('0x77')](_0x9166('0x55')+_0x3f4b1d+'Queue:save',{'UserId':_0x55084e,[_0x3f4b1d+'QueueId']:_0x2e5d3e['id']});if(_0x3f4b1d!==_0x9166('0x70')){return;}return db['User'][_0x9166('0x4c')]({'where':{'id':_0x372a23,'online':0x1},'attributes':['id',_0x9166('0x33'),_0x9166('0x78'),'voicePause',_0x9166('0x79')],'raw':!![]})[_0x9166('0x2d')](function(_0x3e5514){var _0x4b38c2=_[_0x9166('0x35')](_0x3e5514,function(_0x3313c7){return db[_0x9166('0x7a')]['upsert']({'membername':_0x3313c7[_0x9166('0x33')],'UserId':_0x3313c7['id'],'queue_name':_0x2e5d3e[_0x9166('0x33')],'VoiceQueueId':_0x2e5d3e['id'],'interface':_['isNil'](_0x3313c7['interface'])?util[_0x9166('0x7b')](_0x9166('0x7c'),_0x3313c7[_0x9166('0x33')]):_0x3313c7[_0x9166('0x79')],'paused':_0x3313c7[_0x9166('0x7d')]||![],'penalty':_0x2e5d3e['TeamVoiceQueue'][_0x9166('0x72')]},{'transaction':_0x5c5bac});});return Promise['all'](_0x4b38c2);});});});return Promise[_0x9166('0x7e')](_0x5a33c3);});return Promise[_0x9166('0x7e')](_0x543465);})[_0x9166('0x2d')](function(){return db['TeamVoicePrefix'][_0x9166('0x5c')]({'where':{'teamId':_0x5a4094}})[_0x9166('0x2d')](function(_0x4a14e1){if(_0x4a14e1){var _0x36444c=_['map'](_0x372a23,function(_0x5399da){db[_0x9166('0x7f')][_0x9166('0x80')]({'UserId':_0x5399da,'VoicePrefixId':_0x4a14e1[_0x9166('0x81')]});});return Promise[_0x9166('0x7e')](_0x36444c);}});});});return Promise['all'](_0x532673)['then'](function(){return _0x2ce5dd['addAgents'](_0x372a23,{'transaction':_0x5c5bac})[_0x9166('0x82')](function(_0x3956e4){return _0x3956e4;});});});}})[_0x9166('0x2d')](respondWithResult(_0x218b5e,null))[_0x9166('0x4e')](handleError(_0x218b5e,null));};exports[_0x9166('0x83')]=function(_0x510cb4,_0x4e88c3){var _0x2b6068=_['isArray'](_0x510cb4[_0x9166('0x3b')]['ids'])?_0x510cb4[_0x9166('0x3b')][_0x9166('0x67')]:[_0x510cb4[_0x9166('0x3b')][_0x9166('0x67')]];var _0x2a1b60=_0x510cb4[_0x9166('0x50')]['id'];return db['Team'][_0x9166('0x56')]({'where':{'id':_0x2a1b60}})[_0x9166('0x2d')](handleEntityNotFound(_0x4e88c3,null))[_0x9166('0x2d')](function(_0x48d50f){if(_0x48d50f){var _0x10f61b=[_0x9166('0x70'),_0x9166('0x6a'),_0x9166('0x6b'),'Sms',_0x9166('0x84'),_0x9166('0x6d'),_0x9166('0x6e')];return db['sequelize'][_0x9166('0x6f')](function(_0x2bf86d){var _0x20284b=_[_0x9166('0x35')](_0x10f61b,function(_0x21d8dd){var _0x5f5cf3={'attributes':['id','name']};return _0x48d50f[_0x9166('0x2f')+_0x21d8dd+_0x9166('0x63')](_0x5f5cf3)[_0x9166('0x2d')](function(_0x28e0b7){var _0x143b31=_[_0x9166('0x35')](_0x28e0b7,function(_0x111199){return _0x111199['removeAgents'](_0x2b6068,{'transaction':_0x2bf86d})['then'](function(){var _0x47b5e7=_['map'](_0x2b6068,function(_0xda6eef){socket[_0x9166('0x77')]('user'+_0x21d8dd+_0x9166('0x85'),{'UserId':Number(_0xda6eef),[_0x21d8dd+_0x9166('0x73')]:_0x111199['id']});if(_0x21d8dd!=='Voice'){return;}return db[_0x9166('0x7a')][_0x9166('0x2e')]({'where':{'VoiceQueueId':_0x111199['id'],'UserId':_0xda6eef},'transaction':_0x2bf86d});});return Promise[_0x9166('0x7e')](_0x47b5e7);});});return Promise[_0x9166('0x7e')](_0x143b31);});});return Promise['all'](_0x20284b)[_0x9166('0x2d')](function(){return _0x48d50f['removeAgents'](_0x2b6068,{'transaction':_0x2bf86d});})[_0x9166('0x2d')](function(){return db[_0x9166('0x86')][_0x9166('0x5c')]({'where':{'teamId':_0x2a1b60}})[_0x9166('0x2d')](function(_0x11f495){if(_0x11f495){var _0x4b6a15=_[_0x9166('0x35')](_0x2b6068,function(_0x13e536){db[_0x9166('0x7f')][_0x9166('0x2e')]({'where':{'UserId':_0x13e536,'VoicePrefixId':_0x11f495[_0x9166('0x81')]}});});return Promise['all'](_0x4b6a15);}});});});}})[_0x9166('0x2d')](respondWithStatusCode(_0x4e88c3,null))[_0x9166('0x4e')](handleError(_0x4e88c3,null));};exports[_0x9166('0x87')]=function(_0x5e685f,_0x3f0a2f,_0x30d1ae){var _0x572a3e={};var _0x92892c={};var _0x5705f0;var _0x4f318e;return db[_0x9166('0x36')][_0x9166('0x5c')]({'where':{'id':_0x5e685f[_0x9166('0x50')]['id']}})[_0x9166('0x2d')](handleEntityNotFound(_0x3f0a2f,null))[_0x9166('0x2d')](function(_0x4a16a2){if(_0x4a16a2){_0x5705f0=_0x4a16a2;_0x92892c[_0x9166('0x3a')]=_['keys'](db['User'][_0x9166('0x37')]);_0x92892c['query']=_[_0x9166('0x51')](_0x5e685f[_0x9166('0x3b')]);_0x92892c[_0x9166('0x45')]=_[_0x9166('0x3c')](_0x92892c[_0x9166('0x3a')],_0x92892c['query']);_0x572a3e['attributes']=_[_0x9166('0x3c')](_0x92892c[_0x9166('0x3a')],qs[_0x9166('0x3d')](_0x5e685f['query'][_0x9166('0x3d')]));_0x572a3e['attributes']=_0x572a3e['attributes'][_0x9166('0x3f')]?_0x572a3e['attributes']:_0x92892c['model'];_0x572a3e[_0x9166('0x42')]=qs[_0x9166('0x43')](_0x5e685f[_0x9166('0x3b')][_0x9166('0x43')]);_0x572a3e[_0x9166('0x44')]=qs[_0x9166('0x45')](_[_0x9166('0x61')](_0x5e685f[_0x9166('0x3b')],_0x92892c[_0x9166('0x45')]));if(_0x5e685f['query'][_0x9166('0x46')]){_0x572a3e['where']=_[_0x9166('0x47')](_0x572a3e[_0x9166('0x44')],{'$or':_['map'](_0x572a3e[_0x9166('0x3e')],function(_0x4ef5a5){var _0x3a1dd9={};_0x3a1dd9[_0x4ef5a5]={'$like':'%'+_0x5e685f[_0x9166('0x3b')][_0x9166('0x46')]+'%'};return _0x3a1dd9;})});}_0x572a3e=_[_0x9166('0x47')]({},_0x572a3e,_0x5e685f[_0x9166('0x49')]);return _0x5705f0[_0x9166('0x87')](_0x572a3e);}})[_0x9166('0x2d')](function(_0xb77643){if(_0xb77643){_0x4f318e=_0xb77643[_0x9166('0x3f')];if(!_0x5e685f[_0x9166('0x3b')]['hasOwnProperty'](_0x9166('0x41'))){_0x572a3e[_0x9166('0x25')]=qs['limit'](_0x5e685f[_0x9166('0x3b')][_0x9166('0x25')]);_0x572a3e['offset']=qs[_0x9166('0x23')](_0x5e685f['query'][_0x9166('0x23')]);}return _0x5705f0[_0x9166('0x87')](_0x572a3e);}})[_0x9166('0x2d')](function(_0x741017){if(_0x741017){return _0x741017?{'count':_0x4f318e,'rows':_0x741017}:null;}})[_0x9166('0x2d')](respondWithResult(_0x3f0a2f,null))['catch'](handleError(_0x3f0a2f,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index e1894b0..5f9affb 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 _0xb5bb=['Team','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x43cc69,_0x401eea){var _0xde43ae=function(_0x43608f){while(--_0x43608f){_0x43cc69['push'](_0x43cc69['shift']());}};_0xde43ae(++_0x401eea);}(_0xb5bb,0x8a));var _0xbb5b=function(_0x549a0d,_0x2443b8){_0x549a0d=_0x549a0d-0x0;var _0x129fe0=_0xb5bb[_0x549a0d];return _0x129fe0;};'use strict';var EventEmitter=require(_0xbb5b('0x0'));var Team=require(_0xbb5b('0x1'))['db'][_0xbb5b('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xbb5b('0x3')](0x0);var events={'afterCreate':_0xbb5b('0x4'),'afterUpdate':_0xbb5b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x50c231){return function(_0x211833,_0x4e6ae3,_0xbfdae7){TeamEvents[_0xbb5b('0x6')](_0x50c231+':'+_0x211833['id'],_0x211833);TeamEvents[_0xbb5b('0x6')](_0x50c231,_0x211833);_0xbfdae7(null);};}for(var e in events){if(events[_0xbb5b('0x7')](e)){var event=events[e];Team[_0xbb5b('0x8')](e,emitEvent(event));}}module[_0xbb5b('0x9')]=TeamEvents; \ No newline at end of file +var _0x5719=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x225f57,_0x29169f){var _0x5852e1=function(_0x297ed3){while(--_0x297ed3){_0x225f57['push'](_0x225f57['shift']());}};_0x5852e1(++_0x29169f);}(_0x5719,0x18a));var _0x9571=function(_0x11e866,_0x4c6a1f){_0x11e866=_0x11e866-0x0;var _0x13188b=_0x5719[_0x11e866];return _0x13188b;};'use strict';var EventEmitter=require(_0x9571('0x0'));var Team=require(_0x9571('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x9571('0x2')](0x0);var events={'afterCreate':_0x9571('0x3'),'afterUpdate':_0x9571('0x4'),'afterDestroy':_0x9571('0x5')};function emitEvent(_0x440542){return function(_0x1b930e,_0x5dc589,_0x1b7524){TeamEvents[_0x9571('0x6')](_0x440542+':'+_0x1b930e['id'],_0x1b930e);TeamEvents['emit'](_0x440542,_0x1b930e);_0x1b7524(null);};}for(var e in events){if(events[_0x9571('0x7')](e)){var event=events[e];Team[_0x9571('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index fdc4d55..2bec65f 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 _0xefaa=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','Team','teams','lodash','util','../../config/logger','api'];(function(_0x4fc56c,_0x58860a){var _0x3e9a66=function(_0x15b6a8){while(--_0x15b6a8){_0x4fc56c['push'](_0x4fc56c['shift']());}};_0x3e9a66(++_0x58860a);}(_0xefaa,0x8b));var _0xaefa=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xefaa[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xaefa('0x0'));var util=require(_0xaefa('0x1'));var logger=require(_0xaefa('0x2'))(_0xaefa('0x3'));var moment=require(_0xaefa('0x4'));var BPromise=require(_0xaefa('0x5'));var rp=require(_0xaefa('0x6'));var fs=require('fs');var path=require(_0xaefa('0x7'));var rimraf=require(_0xaefa('0x8'));var config=require(_0xaefa('0x9'));var attributes=require(_0xaefa('0xa'));module['exports']=function(_0x28691f,_0x407658){return _0x28691f['define'](_0xaefa('0xb'),attributes,{'tableName':_0xaefa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2939=['../../config/environment','./team.attributes','exports','define','Team','teams','util','../../config/logger','moment','path'];(function(_0x19997d,_0x2c92a4){var _0x49be7f=function(_0x2e5d31){while(--_0x2e5d31){_0x19997d['push'](_0x19997d['shift']());}};_0x49be7f(++_0x2c92a4);}(_0x2939,0x88));var _0x9293=function(_0x550396,_0x5b9cd3){_0x550396=_0x550396-0x0;var _0x182947=_0x2939[_0x550396];return _0x182947;};'use strict';var _=require('lodash');var util=require(_0x9293('0x0'));var logger=require(_0x9293('0x1'))('api');var moment=require(_0x9293('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9293('0x3'));var rimraf=require('rimraf');var config=require(_0x9293('0x4'));var attributes=require(_0x9293('0x5'));module[_0x9293('0x6')]=function(_0x273ceb,_0x223a19){return _0x273ceb[_0x9293('0x7')](_0x9293('0x8'),attributes,{'tableName':_0x9293('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 14e34f1..7be8f08 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 _0xcc02=['redis','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','stringify','error','code','Team,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x40f412,_0x29cfff){var _0x49f3ca=function(_0x1aa91f){while(--_0x1aa91f){_0x40f412['push'](_0x40f412['shift']());}};_0x49f3ca(++_0x29cfff);}(_0xcc02,0xaa));var _0x2cc0=function(_0x35d8fd,_0x2fe732){_0x35d8fd=_0x35d8fd-0x0;var _0x132099=_0xcc02[_0x35d8fd];return _0x132099;};'use strict';var _=require(_0x2cc0('0x0'));var util=require(_0x2cc0('0x1'));var moment=require(_0x2cc0('0x2'));var BPromise=require(_0x2cc0('0x3'));var rs=require(_0x2cc0('0x4'));var fs=require('fs');var Redis=require(_0x2cc0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2cc0('0x6'));var logger=require(_0x2cc0('0x7'))(_0x2cc0('0x8'));var config=require(_0x2cc0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2cc0('0xa')][_0x2cc0('0xb')]({'port':0x232a});config[_0x2cc0('0xc')]=_['defaults'](config[_0x2cc0('0xc')],{'host':_0x2cc0('0xd'),'port':0x18eb});var socket=require(_0x2cc0('0xe'))(new Redis(config[_0x2cc0('0xc')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x49ecd8,_0x3c72b3,_0x524dd8){return new BPromise(function(_0x246ba5,_0x4108fa){return client[_0x2cc0('0xf')](_0x49ecd8,_0x524dd8)[_0x2cc0('0x10')](function(_0x41f9fe){logger[_0x2cc0('0x11')]('Team,\x20%s,\x20%s',_0x3c72b3,_0x2cc0('0x12'));logger[_0x2cc0('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x3c72b3,_0x2cc0('0x12'),JSON[_0x2cc0('0x14')](_0x41f9fe));if(_0x41f9fe[_0x2cc0('0x15')]){if(_0x41f9fe[_0x2cc0('0x15')][_0x2cc0('0x16')]===0x1f4){logger['error'](_0x2cc0('0x17'),_0x3c72b3,_0x41f9fe['error']['message']);return _0x4108fa(_0x41f9fe[_0x2cc0('0x15')][_0x2cc0('0x18')]);}logger[_0x2cc0('0x15')]('Team,\x20%s,\x20%s',_0x3c72b3,_0x41f9fe['error'][_0x2cc0('0x18')]);return _0x246ba5(_0x41f9fe['error'][_0x2cc0('0x18')]);}else{logger[_0x2cc0('0x11')]('Team,\x20%s,\x20%s',_0x3c72b3,_0x2cc0('0x12'));_0x246ba5(_0x41f9fe['result']['message']);}})[_0x2cc0('0x19')](function(_0x42bdb5){logger[_0x2cc0('0x15')](_0x2cc0('0x17'),_0x3c72b3,_0x42bdb5);_0x4108fa(_0x42bdb5);});});} \ No newline at end of file +var _0x285b=['./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x1bfe35,_0x346fec){var _0x2ac387=function(_0x581258){while(--_0x581258){_0x1bfe35['push'](_0x1bfe35['shift']());}};_0x2ac387(++_0x346fec);}(_0x285b,0x8b));var _0xb285=function(_0x42330e,_0x1372c0){_0x42330e=_0x42330e-0x0;var _0x495b56=_0x285b[_0x42330e];return _0x495b56;};'use strict';var _=require('lodash');var util=require(_0xb285('0x0'));var moment=require('moment');var BPromise=require(_0xb285('0x1'));var rs=require(_0xb285('0x2'));var fs=require('fs');var Redis=require(_0xb285('0x3'));var db=require(_0xb285('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb285('0x5'));var jayson=require(_0xb285('0x6'));var client=jayson['client'][_0xb285('0x7')]({'port':0x232a});config[_0xb285('0x8')]=_['defaults'](config[_0xb285('0x8')],{'host':_0xb285('0x9'),'port':0x18eb});var socket=require(_0xb285('0xa'))(new Redis(config[_0xb285('0x8')]));require(_0xb285('0xb'))[_0xb285('0xc')](socket);function respondWithRpcPromise(_0x32c0fe,_0x8dbee8,_0x2d38f8){return new BPromise(function(_0xfae264,_0x1410e3){return client[_0xb285('0xd')](_0x32c0fe,_0x2d38f8)[_0xb285('0xe')](function(_0x34d3d0){logger['info'](_0xb285('0xf'),_0x8dbee8,_0xb285('0x10'));logger[_0xb285('0x11')](_0xb285('0x12'),_0x8dbee8,_0xb285('0x10'),JSON[_0xb285('0x13')](_0x34d3d0));if(_0x34d3d0[_0xb285('0x14')]){if(_0x34d3d0[_0xb285('0x14')][_0xb285('0x15')]===0x1f4){logger[_0xb285('0x14')](_0xb285('0xf'),_0x8dbee8,_0x34d3d0[_0xb285('0x14')][_0xb285('0x16')]);return _0x1410e3(_0x34d3d0['error'][_0xb285('0x16')]);}logger[_0xb285('0x14')](_0xb285('0xf'),_0x8dbee8,_0x34d3d0[_0xb285('0x14')]['message']);return _0xfae264(_0x34d3d0[_0xb285('0x14')]['message']);}else{logger['info'](_0xb285('0xf'),_0x8dbee8,_0xb285('0x10'));_0xfae264(_0x34d3d0[_0xb285('0x17')][_0xb285('0x16')]);}})[_0xb285('0x18')](function(_0x253277){logger[_0xb285('0x14')](_0xb285('0xf'),_0x8dbee8,_0x253277);_0x1410e3(_0x253277);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 392e681..ba61b70 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 _0xe235=['emit','register','length','team:','./team.events','save','remove','update'];(function(_0x5374a2,_0x4947d8){var _0x343822=function(_0x3e00a5){while(--_0x3e00a5){_0x5374a2['push'](_0x5374a2['shift']());}};_0x343822(++_0x4947d8);}(_0xe235,0xe4));var _0x5e23=function(_0x482490,_0x246343){_0x482490=_0x482490-0x0;var _0x2a34d7=_0xe235[_0x482490];return _0x2a34d7;};'use strict';var TeamEvents=require(_0x5e23('0x0'));var events=[_0x5e23('0x1'),_0x5e23('0x2'),_0x5e23('0x3')];function createListener(_0x49fc1b,_0x57e9e8){return function(_0x31faa4){_0x57e9e8[_0x5e23('0x4')](_0x49fc1b,_0x31faa4);};}function removeListener(_0x14eee2,_0x5ba17a){return function(){TeamEvents['removeListener'](_0x14eee2,_0x5ba17a);};}exports[_0x5e23('0x5')]=function(_0x37c8a7){for(var _0x1b49b2=0x0,_0x1c9b2b=events[_0x5e23('0x6')];_0x1b49b2<_0x1c9b2b;_0x1b49b2++){var _0xd7f262=events[_0x1b49b2];var _0x1f0008=createListener(_0x5e23('0x7')+_0xd7f262,_0x37c8a7);TeamEvents['on'](_0xd7f262,_0x1f0008);}}; \ No newline at end of file +var _0xbb90=['removeListener','register','length','team:','./team.events','remove','emit'];(function(_0x504fa6,_0x27561c){var _0xebef5d=function(_0x1138fe){while(--_0x1138fe){_0x504fa6['push'](_0x504fa6['shift']());}};_0xebef5d(++_0x27561c);}(_0xbb90,0x193));var _0x0bb9=function(_0x3ea980,_0x54fdfd){_0x3ea980=_0x3ea980-0x0;var _0x5a58fd=_0xbb90[_0x3ea980];return _0x5a58fd;};'use strict';var TeamEvents=require(_0x0bb9('0x0'));var events=['save',_0x0bb9('0x1'),'update'];function createListener(_0x34fd9b,_0x75b03d){return function(_0x12c517){_0x75b03d[_0x0bb9('0x2')](_0x34fd9b,_0x12c517);};}function removeListener(_0x4b866f,_0x5a9c50){return function(){TeamEvents[_0x0bb9('0x3')](_0x4b866f,_0x5a9c50);};}exports[_0x0bb9('0x4')]=function(_0x4ab1ac){for(var _0x5d1fc4=0x0,_0x115f8a=events[_0x0bb9('0x5')];_0x5d1fc4<_0x115f8a;_0x5d1fc4++){var _0x52dde8=events[_0x5d1fc4];var _0xc46bf9=createListener(_0x0bb9('0x6')+_0x52dde8,_0x4ab1ac);TeamEvents['on'](_0x52dde8,_0xc46bf9);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index b81d536..0cfd8d3 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 _0xe40a=['exports','INTEGER','sequelize'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0xe40a,0x7d));var _0xae40=function(_0x12b137,_0xa2ad7a){_0x12b137=_0x12b137-0x0;var _0x16c6a3=_0xe40a[_0x12b137];return _0x16c6a3;};'use strict';var Sequelize=require(_0xae40('0x0'));module[_0xae40('0x1')]={'TeamId':{'type':Sequelize[_0xae40('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfaa4=['INTEGER','sequelize','exports'];(function(_0x414eda,_0x302b3d){var _0x51188f=function(_0x2022c7){while(--_0x2022c7){_0x414eda['push'](_0x414eda['shift']());}};_0x51188f(++_0x302b3d);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x44e64f,_0x38cff6){_0x44e64f=_0x44e64f-0x0;var _0x547145=_0xfaa4[_0x44e64f];return _0x547145;};'use strict';var Sequelize=require(_0x4faa('0x0'));module[_0x4faa('0x1')]={'TeamId':{'type':Sequelize[_0x4faa('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x4faa('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 43e55d0..836499d 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 _0x1d2d=['../../config/logger','api','moment','request-promise','../../config/environment','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','lodash','util'];(function(_0x333b9b,_0x435dd2){var _0x3b1853=function(_0x394aa0){while(--_0x394aa0){_0x333b9b['push'](_0x333b9b['shift']());}};_0x3b1853(++_0x435dd2);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x10349f,_0x42a305){_0x10349f=_0x10349f-0x0;var _0x45162f=_0x1d2d[_0x10349f];return _0x45162f;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var logger=require(_0xd1d2('0x2'))(_0xd1d2('0x3'));var moment=require(_0xd1d2('0x4'));var BPromise=require('bluebird');var rp=require(_0xd1d2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd1d2('0x6'));var attributes=require(_0xd1d2('0x7'));module[_0xd1d2('0x8')]=function(_0x269613,_0x2f930d){return _0x269613[_0xd1d2('0x9')]('TeamVoicePrefix',attributes,{'tableName':_0xd1d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce8=['team_has_voice_prefixes','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix'];(function(_0x2cb58b,_0x5a879d){var _0xe9dd9c=function(_0x11e835){while(--_0x11e835){_0x2cb58b['push'](_0x2cb58b['shift']());}};_0xe9dd9c(++_0x5a879d);}(_0x8ce8,0xd3));var _0x88ce=function(_0x3af770,_0x1a957a){_0x3af770=_0x3af770-0x0;var _0x42c9a9=_0x8ce8[_0x3af770];return _0x42c9a9;};'use strict';var _=require(_0x88ce('0x0'));var util=require('util');var logger=require(_0x88ce('0x1'))(_0x88ce('0x2'));var moment=require(_0x88ce('0x3'));var BPromise=require(_0x88ce('0x4'));var rp=require(_0x88ce('0x5'));var fs=require('fs');var path=require(_0x88ce('0x6'));var rimraf=require(_0x88ce('0x7'));var config=require(_0x88ce('0x8'));var attributes=require(_0x88ce('0x9'));module[_0x88ce('0xa')]=function(_0x530921,_0x58e101){return _0x530921[_0x88ce('0xb')](_0x88ce('0xc'),attributes,{'tableName':_0x88ce('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index ba17974..dbd9512 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x19b9f5,_0x2ff200){var _0x89c067=function(_0x523a93){while(--_0x523a93){_0x19b9f5['push'](_0x19b9f5['shift']());}};_0x89c067(++_0x2ff200);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1bd693,_0x5644b1){var _0x8a1acb=function(_0x5a8f08){while(--_0x5a8f08){_0x1bd693['push'](_0x1bd693['shift']());}};_0x8a1acb(++_0x5644b1);}(_0xe706,0xa3));var _0x6e70=function(_0x13992d,_0x3029ea){_0x13992d=_0x13992d-0x0;var _0x3d15bf=_0xe706[_0x13992d];return _0x3d15bf;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 6c1fdc5..3b49c36 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 _0xe0d6=['INTEGER','exports'];(function(_0x33ca22,_0xbcc94){var _0x1790c3=function(_0x448b06){while(--_0x448b06){_0x33ca22['push'](_0x33ca22['shift']());}};_0x1790c3(++_0xbcc94);}(_0xe0d6,0x13f));var _0x6e0d=function(_0x14cd69,_0x37d054){_0x14cd69=_0x14cd69-0x0;var _0x338f92=_0xe0d6[_0x14cd69];return _0x338f92;};'use strict';var Sequelize=require('sequelize');module[_0x6e0d('0x0')]={'penalty':{'type':Sequelize[_0x6e0d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x673b=['INTEGER','sequelize','exports'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x673b,0xb8));var _0xb673=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x673b[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0xb673('0x0'));module[_0xb673('0x1')]={'penalty':{'type':Sequelize[_0xb673('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 e017fd4..636c3c3 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 _0xf7f3=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','lodash','util'];(function(_0x2b6858,_0x6830e){var _0x436b37=function(_0x1aad9a){while(--_0x1aad9a){_0x2b6858['push'](_0x2b6858['shift']());}};_0x436b37(++_0x6830e);}(_0xf7f3,0x12a));var _0x3f7f=function(_0x69981,_0x5a4e00){_0x69981=_0x69981-0x0;var _0x26eee2=_0xf7f3[_0x69981];return _0x26eee2;};'use strict';var _=require(_0x3f7f('0x0'));var util=require(_0x3f7f('0x1'));var logger=require(_0x3f7f('0x2'))(_0x3f7f('0x3'));var moment=require(_0x3f7f('0x4'));var BPromise=require(_0x3f7f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3f7f('0x6'));var config=require(_0x3f7f('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0x3f7f('0x8')]=function(_0x4876e8,_0x2198f7){return _0x4876e8[_0x3f7f('0x9')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83f1=['./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x83f1,0x1cc));var _0x183f=function(_0x27bcbf,_0x33a0eb){_0x27bcbf=_0x27bcbf-0x0;var _0x3bb530=_0x83f1[_0x27bcbf];return _0x3bb530;};'use strict';var _=require(_0x183f('0x0'));var util=require(_0x183f('0x1'));var logger=require(_0x183f('0x2'))(_0x183f('0x3'));var moment=require(_0x183f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x183f('0x5'));var rimraf=require(_0x183f('0x6'));var config=require(_0x183f('0x7'));var attributes=require(_0x183f('0x8'));module[_0x183f('0x9')]=function(_0x5381b2,_0x5c1cbd){return _0x5381b2[_0x183f('0xa')](_0x183f('0xb'),attributes,{'tableName':'team_has_voice_queues','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 c77d7f4..2e6226f 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x395554,_0x35fd44){var _0x4019ee=function(_0x4e3a8){while(--_0x4e3a8){_0x395554['push'](_0x395554['shift']());}};_0x4019ee(++_0x35fd44);}(_0xb43b,0x1b2));var _0xbb43=function(_0x702cf9,_0x8edf3d){_0x702cf9=_0x702cf9-0x0;var _0x29a4fc=_0xb43b[_0x702cf9];return _0x29a4fc;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0x83d3=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','TeamVoiceQueue,\x20%s,\x20%s','message','result'];(function(_0x2b506c,_0x5d3dd9){var _0x37071c=function(_0x4905b6){while(--_0x4905b6){_0x2b506c['push'](_0x2b506c['shift']());}};_0x37071c(++_0x5d3dd9);}(_0x83d3,0x17c));var _0x383d=function(_0x9f3e89,_0x39b12c){_0x9f3e89=_0x9f3e89-0x0;var _0x12d365=_0x83d3[_0x9f3e89];return _0x12d365;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var moment=require(_0x383d('0x2'));var BPromise=require(_0x383d('0x3'));var rs=require(_0x383d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x383d('0x5'))['db'];var utils=require(_0x383d('0x6'));var logger=require(_0x383d('0x7'))(_0x383d('0x8'));var config=require('../../config/environment');var jayson=require(_0x383d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xbc074b,_0x2c3cab,_0x360bee){return new BPromise(function(_0x5641df,_0x303c1d){return client['request'](_0xbc074b,_0x360bee)['then'](function(_0x221079){logger[_0x383d('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2c3cab,_0x383d('0xb'));logger[_0x383d('0xc')](_0x383d('0xd'),_0x2c3cab,_0x383d('0xb'),JSON[_0x383d('0xe')](_0x221079));if(_0x221079[_0x383d('0xf')]){if(_0x221079['error']['code']===0x1f4){logger['error'](_0x383d('0x10'),_0x2c3cab,_0x221079['error'][_0x383d('0x11')]);return _0x303c1d(_0x221079[_0x383d('0xf')][_0x383d('0x11')]);}logger[_0x383d('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2c3cab,_0x221079['error'][_0x383d('0x11')]);return _0x5641df(_0x221079['error'][_0x383d('0x11')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x2c3cab,_0x383d('0xb'));_0x5641df(_0x221079[_0x383d('0x12')]['message']);}})['catch'](function(_0x11c1f9){logger[_0x383d('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2c3cab,_0x11c1f9);_0x303c1d(_0x11c1f9);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 30c2671..44d5700 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 _0xcaaf=['Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','put','destroy','exports','multer','path'];(function(_0x196cbb,_0x229c4a){var _0x3ebb1c=function(_0x27810a){while(--_0x27810a){_0x196cbb['push'](_0x196cbb['shift']());}};_0x3ebb1c(++_0x229c4a);}(_0xcaaf,0x66));var _0xfcaa=function(_0x5e2c0a,_0x1467e0){_0x5e2c0a=_0x5e2c0a-0x0;var _0x3145e5=_0xcaaf[_0x5e2c0a];return _0x3145e5;};'use strict';var multer=require(_0xfcaa('0x0'));var util=require('util');var path=require(_0xfcaa('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfcaa('0x2')]();var fs_extra=require(_0xfcaa('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfcaa('0x4'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0xfcaa('0x5')]('/',auth[_0xfcaa('0x6')](),controller[_0xfcaa('0x7')]);router[_0xfcaa('0x5')](_0xfcaa('0x8'),auth[_0xfcaa('0x6')](),controller[_0xfcaa('0x9')]);router['post']('/',auth[_0xfcaa('0x6')](),controller['create']);router[_0xfcaa('0xa')]('/:id',auth[_0xfcaa('0x6')](),controller['update']);router['delete'](_0xfcaa('0x8'),auth['isAuthenticated'](),controller[_0xfcaa('0xb')]);module[_0xfcaa('0xc')]=router; \ No newline at end of file +var _0xb145=['./template.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3500a3,_0x536438){var _0x548c25=function(_0x2bc0e4){while(--_0x2bc0e4){_0x3500a3['push'](_0x3500a3['shift']());}};_0x548c25(++_0x536438);}(_0xb145,0xa3));var _0x5b14=function(_0x14c032,_0x32e9d6){_0x14c032=_0x14c032-0x0;var _0x27475d=_0xb145[_0x14c032];return _0x27475d;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var fs_extra=require(_0x5b14('0x5'));var auth=require(_0x5b14('0x6'));var interaction=require(_0x5b14('0x7'));var config=require('../../config/environment');var controller=require(_0x5b14('0x8'));router[_0x5b14('0x9')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0xb')]);router['get'](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0xd')]);router[_0x5b14('0xe')]('/',auth[_0x5b14('0xa')](),controller['create']);router[_0x5b14('0xf')](_0x5b14('0xc'),auth['isAuthenticated'](),controller[_0x5b14('0x10')]);router[_0x5b14('0x11')](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 316c94f..12a89e0 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 _0x538c=['sequelize','exports','STRING','TEXT'];(function(_0x1ae4c2,_0x2315b6){var _0x186ddc=function(_0x391efd){while(--_0x391efd){_0x1ae4c2['push'](_0x1ae4c2['shift']());}};_0x186ddc(++_0x2315b6);}(_0x538c,0xcc));var _0xc538=function(_0x58a190,_0xaf0549){_0x58a190=_0x58a190-0x0;var _0x2dd4c5=_0x538c[_0x58a190];return _0x2dd4c5;};'use strict';var Sequelize=require(_0xc538('0x0'));module[_0xc538('0x1')]={'name':{'type':Sequelize[_0xc538('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xc538('0x3')]}}; \ No newline at end of file +var _0xb153=['STRING','sequelize','exports'];(function(_0x4655a7,_0x152a7f){var _0x55d71f=function(_0xde127c){while(--_0xde127c){_0x4655a7['push'](_0x4655a7['shift']());}};_0x55d71f(++_0x152a7f);}(_0xb153,0x1e7));var _0x3b15=function(_0x4cda8c,_0x238d21){_0x4cda8c=_0x4cda8c-0x0;var _0x515f0f=_0xb153[_0x4cda8c];return _0x515f0f;};'use strict';var Sequelize=require(_0x3b15('0x0'));module[_0x3b15('0x1')]={'name':{'type':Sequelize[_0x3b15('0x2')]},'description':{'type':Sequelize[_0x3b15('0x2')]},'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 cd1fcc3..b991df0 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 _0x2ec1=['options','Template','includeAll','include','findAll','show','params','length','find','catch','create','body','user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','Templates','UserProfileResource','destroy','name','map','rawAttributes','query','keys','intersection','attributes','model','fields','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL'];(function(_0x24d709,_0x812b9c){var _0x4931fd=function(_0x4ca964){while(--_0x4ca964){_0x24d709['push'](_0x24d709['shift']());}};_0x4931fd(++_0x812b9c);}(_0x2ec1,0x1e6));var _0x12ec=function(_0x205328,_0x12c15a){_0x205328=_0x205328-0x0;var _0x4a30eb=_0x2ec1[_0x205328];return _0x4a30eb;};'use strict';var emlformat=require(_0x12ec('0x0'));var rimraf=require(_0x12ec('0x1'));var zipdir=require(_0x12ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x12ec('0x3'));var moment=require(_0x12ec('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x12ec('0x5'));var util=require(_0x12ec('0x6'));var path=require(_0x12ec('0x7'));var sox=require(_0x12ec('0x8'));var csv=require('to-csv');var ejs=require(_0x12ec('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x12ec('0xa'));var squel=require(_0x12ec('0xb'));var crypto=require(_0x12ec('0xc'));var jsforce=require(_0x12ec('0xd'));var deskjs=require(_0x12ec('0xe'));var toCsv=require('to-csv');var querystring=require(_0x12ec('0xf'));var Papa=require('papaparse');var Redis=require(_0x12ec('0x10'));var authService=require(_0x12ec('0x11'));var qs=require(_0x12ec('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12ec('0x13'));var logger=require('../../config/logger')(_0x12ec('0x14'));var utils=require(_0x12ec('0x15'));var config=require(_0x12ec('0x16'));var licenseUtil=require(_0x12ec('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x321eef,_0x473fe7){_0x473fe7=_0x473fe7||0xcc;return function(_0x3c40fd){if(_0x3c40fd){return _0x321eef[_0x12ec('0x18')](_0x473fe7);}return _0x321eef[_0x12ec('0x19')](_0x473fe7)[_0x12ec('0x1a')]();};}function respondWithResult(_0x2ee6c8,_0x1ee68b){_0x1ee68b=_0x1ee68b||0xc8;return function(_0x53c2c7){if(_0x53c2c7){return _0x2ee6c8['status'](_0x1ee68b)[_0x12ec('0x1b')](_0x53c2c7);}};}function respondWithFilteredResult(_0x427089,_0x5554fd){return function(_0x55c3b3){if(_0x55c3b3){var _0x5b6cf2=typeof _0x5554fd[_0x12ec('0x1c')]==='undefined'&&typeof _0x5554fd[_0x12ec('0x1d')]===_0x12ec('0x1e');var _0xdd835a=_0x55c3b3[_0x12ec('0x1f')];var _0x5823d3=_0x5b6cf2?0x0:_0x5554fd['offset'];var _0xcebeae=_0x5b6cf2?_0x55c3b3[_0x12ec('0x1f')]:_0x5554fd[_0x12ec('0x1c')]+_0x5554fd[_0x12ec('0x1d')];var _0x503c7f;if(_0xcebeae>=_0xdd835a){_0xcebeae=_0xdd835a;_0x503c7f=0xc8;}else{_0x503c7f=0xce;}_0x427089[_0x12ec('0x19')](_0x503c7f);return _0x427089[_0x12ec('0x20')](_0x12ec('0x21'),_0x5823d3+'-'+_0xcebeae+'/'+_0xdd835a)[_0x12ec('0x1b')](_0x55c3b3);}return null;};}function patchUpdates(_0x306462){return function(_0x4a4cf5){try{jsonpatch['apply'](_0x4a4cf5,_0x306462,!![]);}catch(_0x10ef2e){return BPromise[_0x12ec('0x22')](_0x10ef2e);}return _0x4a4cf5[_0x12ec('0x23')]();};}function saveUpdates(_0x14c4f1,_0x5eaad2){return function(_0xd6420e){if(_0xd6420e){return _0xd6420e[_0x12ec('0x24')](_0x14c4f1)['then'](function(_0x10f7ce){return _0x10f7ce;});}return null;};}function removeEntity(_0x58fa63,_0x2d992d){return function(_0x59e179){if(_0x59e179){return _0x59e179['destroy']()[_0x12ec('0x25')](function(){var _0x2c694e=_0x59e179[_0x12ec('0x26')]({'plain':!![]});var _0x180094=_0x12ec('0x27');return db[_0x12ec('0x28')][_0x12ec('0x29')]({'where':{'type':_0x180094,'resourceId':_0x2c694e['id']}})[_0x12ec('0x25')](function(){return _0x59e179;});})[_0x12ec('0x25')](function(){_0x58fa63[_0x12ec('0x19')](0xcc)[_0x12ec('0x1a')]();});}};}function handleEntityNotFound(_0x1aa427,_0x886278){return function(_0xbb4e75){if(!_0xbb4e75){_0x1aa427[_0x12ec('0x18')](0x194);}return _0xbb4e75;};}function handleError(_0x4c99e6,_0x3bea30){_0x3bea30=_0x3bea30||0x1f4;return function(_0x4ecd24){logger['error'](_0x4ecd24['stack']);if(_0x4ecd24[_0x12ec('0x2a')]){delete _0x4ecd24[_0x12ec('0x2a')];}_0x4c99e6[_0x12ec('0x19')](_0x3bea30)['send'](_0x4ecd24);};}exports['index']=function(_0x51353a,_0x1f165e){var _0x387b49={},_0x38904f={},_0x5ddad3={'count':0x0,'rows':[]};var _0x2c2a5e=_[_0x12ec('0x2b')](db['Template'][_0x12ec('0x2c')],function(_0x2ed32d){return{'name':_0x2ed32d['fieldName'],'type':_0x2ed32d['type']['key']};});_0x38904f['model']=_[_0x12ec('0x2b')](_0x2c2a5e,'name');_0x38904f[_0x12ec('0x2d')]=_[_0x12ec('0x2e')](_0x51353a[_0x12ec('0x2d')]);_0x38904f['filters']=_[_0x12ec('0x2f')](_0x38904f['model'],_0x38904f[_0x12ec('0x2d')]);_0x387b49[_0x12ec('0x30')]=_['intersection'](_0x38904f[_0x12ec('0x31')],qs[_0x12ec('0x32')](_0x51353a[_0x12ec('0x2d')][_0x12ec('0x32')]));_0x387b49[_0x12ec('0x30')]=_0x387b49[_0x12ec('0x30')]['length']?_0x387b49[_0x12ec('0x30')]:_0x38904f[_0x12ec('0x31')];if(!_0x51353a[_0x12ec('0x2d')]['hasOwnProperty'](_0x12ec('0x33'))){_0x387b49[_0x12ec('0x1d')]=qs[_0x12ec('0x1d')](_0x51353a[_0x12ec('0x2d')]['limit']);_0x387b49[_0x12ec('0x1c')]=qs[_0x12ec('0x1c')](_0x51353a[_0x12ec('0x2d')][_0x12ec('0x1c')]);}_0x387b49[_0x12ec('0x34')]=qs['sort'](_0x51353a[_0x12ec('0x2d')][_0x12ec('0x35')]);_0x387b49['where']=qs[_0x12ec('0x36')](_[_0x12ec('0x37')](_0x51353a[_0x12ec('0x2d')],_0x38904f[_0x12ec('0x36')]),_0x2c2a5e);if(_0x51353a[_0x12ec('0x2d')][_0x12ec('0x38')]){_0x387b49[_0x12ec('0x39')]=_[_0x12ec('0x3a')](_0x387b49[_0x12ec('0x39')],{'$or':_['map'](_0x2c2a5e,function(_0xd5af76){if(_0xd5af76['type']!==_0x12ec('0x3b')){var _0xd35079={};_0xd35079[_0xd5af76[_0x12ec('0x2a')]]={'$like':'%'+_0x51353a[_0x12ec('0x2d')][_0x12ec('0x38')]+'%'};return _0xd35079;}})});}_0x387b49=_[_0x12ec('0x3a')]({},_0x387b49,_0x51353a[_0x12ec('0x3c')]);var _0x16fc51={'where':_0x387b49[_0x12ec('0x39')]};return db[_0x12ec('0x3d')]['count'](_0x16fc51)[_0x12ec('0x25')](function(_0x8c6a13){_0x5ddad3['count']=_0x8c6a13;if(_0x51353a['query'][_0x12ec('0x3e')]){_0x387b49[_0x12ec('0x3f')]=[{'all':!![]}];}return db[_0x12ec('0x3d')][_0x12ec('0x40')](_0x387b49);})[_0x12ec('0x25')](function(_0x2bf8cb){_0x5ddad3['rows']=_0x2bf8cb;return _0x5ddad3;})[_0x12ec('0x25')](respondWithFilteredResult(_0x1f165e,_0x387b49))['catch'](handleError(_0x1f165e,null));};exports[_0x12ec('0x41')]=function(_0x47b07f,_0x43536a){var _0x27f58b={'raw':!![],'where':{'id':_0x47b07f[_0x12ec('0x42')]['id']}},_0x30df33={};_0x30df33[_0x12ec('0x31')]=_['keys'](db[_0x12ec('0x3d')][_0x12ec('0x2c')]);_0x30df33[_0x12ec('0x2d')]=_[_0x12ec('0x2e')](_0x47b07f[_0x12ec('0x2d')]);_0x30df33[_0x12ec('0x36')]=_['intersection'](_0x30df33[_0x12ec('0x31')],_0x30df33[_0x12ec('0x2d')]);_0x27f58b[_0x12ec('0x30')]=_[_0x12ec('0x2f')](_0x30df33[_0x12ec('0x31')],qs[_0x12ec('0x32')](_0x47b07f[_0x12ec('0x2d')][_0x12ec('0x32')]));_0x27f58b[_0x12ec('0x30')]=_0x27f58b[_0x12ec('0x30')][_0x12ec('0x43')]?_0x27f58b[_0x12ec('0x30')]:_0x30df33[_0x12ec('0x31')];if(_0x47b07f[_0x12ec('0x2d')][_0x12ec('0x3e')]){_0x27f58b[_0x12ec('0x3f')]=[{'all':!![]}];}_0x27f58b=_[_0x12ec('0x3a')]({},_0x27f58b,_0x47b07f['options']);return db[_0x12ec('0x3d')][_0x12ec('0x44')](_0x27f58b)[_0x12ec('0x25')](handleEntityNotFound(_0x43536a,null))['then'](respondWithResult(_0x43536a,null))[_0x12ec('0x45')](handleError(_0x43536a,null));};exports[_0x12ec('0x46')]=function(_0x332239,_0x11d34c){return db[_0x12ec('0x3d')][_0x12ec('0x46')](_0x332239[_0x12ec('0x47')],{})[_0x12ec('0x25')](function(_0xf788fe){var _0x47ae4a=_0x332239[_0x12ec('0x48')][_0x12ec('0x26')]({'plain':!![]});if(!_0x47ae4a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47ae4a[_0x12ec('0x49')]===_0x12ec('0x48')){var _0x5f22be=_0xf788fe['get']({'plain':!![]});var _0x5ba716=_0x12ec('0x27');return db[_0x12ec('0x4a')][_0x12ec('0x44')]({'where':{'name':_0x5ba716,'userProfileId':_0x47ae4a['userProfileId']},'raw':!![]})[_0x12ec('0x25')](function(_0x972b53){if(_0x972b53&&_0x972b53[_0x12ec('0x4b')]===0x0){return db[_0x12ec('0x28')][_0x12ec('0x46')]({'name':_0x5f22be[_0x12ec('0x2a')],'resourceId':_0x5f22be['id'],'type':_0x972b53[_0x12ec('0x2a')],'sectionId':_0x972b53['id']},{})['then'](function(){return _0xf788fe;});}else{return _0xf788fe;}})[_0x12ec('0x45')](function(_0x3e405a){logger[_0x12ec('0x4c')](_0x12ec('0x4d'),_0x3e405a);throw _0x3e405a;});}return _0xf788fe;})['then'](respondWithResult(_0x11d34c,0xc9))[_0x12ec('0x45')](handleError(_0x11d34c,null));};exports[_0x12ec('0x24')]=function(_0x59c8d8,_0x25b691){if(_0x59c8d8[_0x12ec('0x47')]['id']){delete _0x59c8d8[_0x12ec('0x47')]['id'];}return db['Template'][_0x12ec('0x44')]({'where':{'id':_0x59c8d8[_0x12ec('0x42')]['id']}})[_0x12ec('0x25')](handleEntityNotFound(_0x25b691,null))[_0x12ec('0x25')](saveUpdates(_0x59c8d8[_0x12ec('0x47')],null))['then'](respondWithResult(_0x25b691,null))[_0x12ec('0x45')](handleError(_0x25b691,null));};exports['destroy']=function(_0x1648a3,_0x12f287){return db[_0x12ec('0x3d')][_0x12ec('0x44')]({'where':{'id':_0x1648a3['params']['id']}})['then'](handleEntityNotFound(_0x12f287,null))[_0x12ec('0x25')](removeEntity(_0x12f287,null))[_0x12ec('0x45')](handleError(_0x12f287,null));}; \ No newline at end of file +var _0x0c63=['count','status','set','Content-Range','apply','reject','then','destroy','Templates','UserProfileResource','end','error','stack','name','index','map','Template','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','VIRTUAL','merge','options','include','rows','show','params','includeAll','find','catch','create','body','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','json','undefined','limit','offset'];(function(_0x4c7a46,_0x55171b){var _0x101dca=function(_0x368b30){while(--_0x368b30){_0x4c7a46['push'](_0x4c7a46['shift']());}};_0x101dca(++_0x55171b);}(_0x0c63,0x1a3));var _0x30c6=function(_0x57d608,_0x3d2e3a){_0x57d608=_0x57d608-0x0;var _0x44bee5=_0x0c63[_0x57d608];return _0x44bee5;};'use strict';var emlformat=require(_0x30c6('0x0'));var rimraf=require(_0x30c6('0x1'));var zipdir=require(_0x30c6('0x2'));var jsonpatch=require(_0x30c6('0x3'));var rp=require('request-promise');var moment=require(_0x30c6('0x4'));var BPromise=require(_0x30c6('0x5'));var Mustache=require(_0x30c6('0x6'));var util=require('util');var path=require(_0x30c6('0x7'));var sox=require(_0x30c6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30c6('0x9'));var _=require(_0x30c6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x30c6('0xb'));var deskjs=require(_0x30c6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x30c6('0xd'));var Papa=require(_0x30c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x30c6('0xf'));var hardwareService=require(_0x30c6('0x10'));var logger=require(_0x30c6('0x11'))('api');var utils=require(_0x30c6('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x30c6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x374b10,_0x175d15){_0x175d15=_0x175d15||0xcc;return function(_0x318d72){if(_0x318d72){return _0x374b10[_0x30c6('0x14')](_0x175d15);}return _0x374b10['status'](_0x175d15)['end']();};}function respondWithResult(_0x16bf0c,_0x371267){_0x371267=_0x371267||0xc8;return function(_0x49a863){if(_0x49a863){return _0x16bf0c['status'](_0x371267)[_0x30c6('0x15')](_0x49a863);}};}function respondWithFilteredResult(_0x394e35,_0x20c154){return function(_0x4b6387){if(_0x4b6387){var _0x2d6e54=typeof _0x20c154['offset']===_0x30c6('0x16')&&typeof _0x20c154[_0x30c6('0x17')]===_0x30c6('0x16');var _0x59a203=_0x4b6387['count'];var _0x4f02b6=_0x2d6e54?0x0:_0x20c154[_0x30c6('0x18')];var _0x108792=_0x2d6e54?_0x4b6387[_0x30c6('0x19')]:_0x20c154[_0x30c6('0x18')]+_0x20c154[_0x30c6('0x17')];var _0x3bdf40;if(_0x108792>=_0x59a203){_0x108792=_0x59a203;_0x3bdf40=0xc8;}else{_0x3bdf40=0xce;}_0x394e35[_0x30c6('0x1a')](_0x3bdf40);return _0x394e35[_0x30c6('0x1b')](_0x30c6('0x1c'),_0x4f02b6+'-'+_0x108792+'/'+_0x59a203)['json'](_0x4b6387);}return null;};}function patchUpdates(_0x14924d){return function(_0x5c2743){try{jsonpatch[_0x30c6('0x1d')](_0x5c2743,_0x14924d,!![]);}catch(_0x286dab){return BPromise[_0x30c6('0x1e')](_0x286dab);}return _0x5c2743['save']();};}function saveUpdates(_0x3bdc3a,_0x13bbfc){return function(_0x589036){if(_0x589036){return _0x589036['update'](_0x3bdc3a)[_0x30c6('0x1f')](function(_0x466cdd){return _0x466cdd;});}return null;};}function removeEntity(_0x150d3b,_0x46d05b){return function(_0x486fd9){if(_0x486fd9){return _0x486fd9[_0x30c6('0x20')]()[_0x30c6('0x1f')](function(){var _0x2cb3c4=_0x486fd9['get']({'plain':!![]});var _0xb52f16=_0x30c6('0x21');return db[_0x30c6('0x22')][_0x30c6('0x20')]({'where':{'type':_0xb52f16,'resourceId':_0x2cb3c4['id']}})[_0x30c6('0x1f')](function(){return _0x486fd9;});})['then'](function(){_0x150d3b['status'](0xcc)[_0x30c6('0x23')]();});}};}function handleEntityNotFound(_0x45d155,_0x45b92a){return function(_0x3bf977){if(!_0x3bf977){_0x45d155['sendStatus'](0x194);}return _0x3bf977;};}function handleError(_0xde78bb,_0x1c1c2c){_0x1c1c2c=_0x1c1c2c||0x1f4;return function(_0x19e5bb){logger[_0x30c6('0x24')](_0x19e5bb[_0x30c6('0x25')]);if(_0x19e5bb[_0x30c6('0x26')]){delete _0x19e5bb[_0x30c6('0x26')];}_0xde78bb[_0x30c6('0x1a')](_0x1c1c2c)['send'](_0x19e5bb);};}exports[_0x30c6('0x27')]=function(_0x4cd9ab,_0x59aeb2){var _0x2fa7f2={},_0x2f6367={},_0x59035d={'count':0x0,'rows':[]};var _0x249cb1=_[_0x30c6('0x28')](db[_0x30c6('0x29')][_0x30c6('0x2a')],function(_0x3c4055){return{'name':_0x3c4055['fieldName'],'type':_0x3c4055[_0x30c6('0x2b')]['key']};});_0x2f6367[_0x30c6('0x2c')]=_[_0x30c6('0x28')](_0x249cb1,_0x30c6('0x26'));_0x2f6367['query']=_[_0x30c6('0x2d')](_0x4cd9ab[_0x30c6('0x2e')]);_0x2f6367['filters']=_[_0x30c6('0x2f')](_0x2f6367[_0x30c6('0x2c')],_0x2f6367[_0x30c6('0x2e')]);_0x2fa7f2[_0x30c6('0x30')]=_['intersection'](_0x2f6367[_0x30c6('0x2c')],qs['fields'](_0x4cd9ab['query'][_0x30c6('0x31')]));_0x2fa7f2[_0x30c6('0x30')]=_0x2fa7f2[_0x30c6('0x30')][_0x30c6('0x32')]?_0x2fa7f2['attributes']:_0x2f6367[_0x30c6('0x2c')];if(!_0x4cd9ab['query']['hasOwnProperty'](_0x30c6('0x33'))){_0x2fa7f2[_0x30c6('0x17')]=qs['limit'](_0x4cd9ab['query']['limit']);_0x2fa7f2[_0x30c6('0x18')]=qs['offset'](_0x4cd9ab[_0x30c6('0x2e')]['offset']);}_0x2fa7f2[_0x30c6('0x34')]=qs['sort'](_0x4cd9ab[_0x30c6('0x2e')]['sort']);_0x2fa7f2[_0x30c6('0x35')]=qs[_0x30c6('0x36')](_[_0x30c6('0x37')](_0x4cd9ab['query'],_0x2f6367['filters']),_0x249cb1);if(_0x4cd9ab[_0x30c6('0x2e')][_0x30c6('0x38')]){_0x2fa7f2[_0x30c6('0x35')]=_['merge'](_0x2fa7f2[_0x30c6('0x35')],{'$or':_[_0x30c6('0x28')](_0x249cb1,function(_0x33bed3){if(_0x33bed3['type']!==_0x30c6('0x39')){var _0x3c9c29={};_0x3c9c29[_0x33bed3[_0x30c6('0x26')]]={'$like':'%'+_0x4cd9ab[_0x30c6('0x2e')][_0x30c6('0x38')]+'%'};return _0x3c9c29;}})});}_0x2fa7f2=_[_0x30c6('0x3a')]({},_0x2fa7f2,_0x4cd9ab[_0x30c6('0x3b')]);var _0x28aaea={'where':_0x2fa7f2['where']};return db[_0x30c6('0x29')][_0x30c6('0x19')](_0x28aaea)[_0x30c6('0x1f')](function(_0x4fa5a5){_0x59035d[_0x30c6('0x19')]=_0x4fa5a5;if(_0x4cd9ab[_0x30c6('0x2e')]['includeAll']){_0x2fa7f2[_0x30c6('0x3c')]=[{'all':!![]}];}return db[_0x30c6('0x29')]['findAll'](_0x2fa7f2);})[_0x30c6('0x1f')](function(_0x45bdab){_0x59035d[_0x30c6('0x3d')]=_0x45bdab;return _0x59035d;})[_0x30c6('0x1f')](respondWithFilteredResult(_0x59aeb2,_0x2fa7f2))['catch'](handleError(_0x59aeb2,null));};exports[_0x30c6('0x3e')]=function(_0x12636d,_0x348df4){var _0x1bf5f4={'raw':!![],'where':{'id':_0x12636d[_0x30c6('0x3f')]['id']}},_0xb65bf7={};_0xb65bf7[_0x30c6('0x2c')]=_[_0x30c6('0x2d')](db[_0x30c6('0x29')]['rawAttributes']);_0xb65bf7[_0x30c6('0x2e')]=_[_0x30c6('0x2d')](_0x12636d[_0x30c6('0x2e')]);_0xb65bf7[_0x30c6('0x36')]=_[_0x30c6('0x2f')](_0xb65bf7[_0x30c6('0x2c')],_0xb65bf7['query']);_0x1bf5f4[_0x30c6('0x30')]=_[_0x30c6('0x2f')](_0xb65bf7[_0x30c6('0x2c')],qs['fields'](_0x12636d['query']['fields']));_0x1bf5f4['attributes']=_0x1bf5f4['attributes'][_0x30c6('0x32')]?_0x1bf5f4[_0x30c6('0x30')]:_0xb65bf7['model'];if(_0x12636d[_0x30c6('0x2e')][_0x30c6('0x40')]){_0x1bf5f4[_0x30c6('0x3c')]=[{'all':!![]}];}_0x1bf5f4=_[_0x30c6('0x3a')]({},_0x1bf5f4,_0x12636d[_0x30c6('0x3b')]);return db[_0x30c6('0x29')][_0x30c6('0x41')](_0x1bf5f4)[_0x30c6('0x1f')](handleEntityNotFound(_0x348df4,null))[_0x30c6('0x1f')](respondWithResult(_0x348df4,null))[_0x30c6('0x42')](handleError(_0x348df4,null));};exports[_0x30c6('0x43')]=function(_0x3a07cc,_0x4a49c2){return db['Template'][_0x30c6('0x43')](_0x3a07cc[_0x30c6('0x44')],{})[_0x30c6('0x1f')](function(_0x36f77b){var _0x3f136a=_0x3a07cc[_0x30c6('0x45')][_0x30c6('0x46')]({'plain':!![]});if(!_0x3f136a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f136a['role']===_0x30c6('0x45')){var _0x2b6180=_0x36f77b[_0x30c6('0x46')]({'plain':!![]});var _0x4bda1=_0x30c6('0x21');return db[_0x30c6('0x47')][_0x30c6('0x41')]({'where':{'name':_0x4bda1,'userProfileId':_0x3f136a['userProfileId']},'raw':!![]})[_0x30c6('0x1f')](function(_0x1c3e69){if(_0x1c3e69&&_0x1c3e69[_0x30c6('0x48')]===0x0){return db[_0x30c6('0x22')][_0x30c6('0x43')]({'name':_0x2b6180[_0x30c6('0x26')],'resourceId':_0x2b6180['id'],'type':_0x1c3e69[_0x30c6('0x26')],'sectionId':_0x1c3e69['id']},{})[_0x30c6('0x1f')](function(){return _0x36f77b;});}else{return _0x36f77b;}})[_0x30c6('0x42')](function(_0x11e375){logger['error'](_0x30c6('0x49'),_0x11e375);throw _0x11e375;});}return _0x36f77b;})[_0x30c6('0x1f')](respondWithResult(_0x4a49c2,0xc9))[_0x30c6('0x42')](handleError(_0x4a49c2,null));};exports['update']=function(_0x9683f7,_0x4a0fe9){if(_0x9683f7[_0x30c6('0x44')]['id']){delete _0x9683f7[_0x30c6('0x44')]['id'];}return db['Template'][_0x30c6('0x41')]({'where':{'id':_0x9683f7['params']['id']}})['then'](handleEntityNotFound(_0x4a0fe9,null))['then'](saveUpdates(_0x9683f7[_0x30c6('0x44')],null))[_0x30c6('0x1f')](respondWithResult(_0x4a0fe9,null))[_0x30c6('0x42')](handleError(_0x4a0fe9,null));};exports[_0x30c6('0x20')]=function(_0x29177a,_0x362399){return db['Template']['find']({'where':{'id':_0x29177a[_0x30c6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x362399,null))[_0x30c6('0x1f')](removeEntity(_0x362399,null))[_0x30c6('0x42')](handleError(_0x362399,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 67b3590..0fa36e6 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 _0x8662=['request-promise','path','../../config/environment','./template.attributes','exports','define','Template','lodash','util','../../config/logger','api','moment'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x8662,0x1f3));var _0x2866=function(_0x461b9d,_0x470961){_0x461b9d=_0x461b9d-0x0;var _0x5eca43=_0x8662[_0x461b9d];return _0x5eca43;};'use strict';var _=require(_0x2866('0x0'));var util=require(_0x2866('0x1'));var logger=require(_0x2866('0x2'))(_0x2866('0x3'));var moment=require(_0x2866('0x4'));var BPromise=require('bluebird');var rp=require(_0x2866('0x5'));var fs=require('fs');var path=require(_0x2866('0x6'));var rimraf=require('rimraf');var config=require(_0x2866('0x7'));var attributes=require(_0x2866('0x8'));module[_0x2866('0x9')]=function(_0x4e5e55,_0xbdd13){return _0x4e5e55[_0x2866('0xa')](_0x2866('0xb'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb49a=['tools_templates','lodash','util','../../config/logger','api','path','../../config/environment','./template.attributes','exports','Template'];(function(_0x935dc5,_0x18e1a7){var _0x567087=function(_0x148eb4){while(--_0x148eb4){_0x935dc5['push'](_0x935dc5['shift']());}};_0x567087(++_0x18e1a7);}(_0xb49a,0x141));var _0xab49=function(_0x1d3fdc,_0x2b5c54){_0x1d3fdc=_0x1d3fdc-0x0;var _0x128bb0=_0xb49a[_0x1d3fdc];return _0x128bb0;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var logger=require(_0xab49('0x2'))(_0xab49('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab49('0x4'));var rimraf=require('rimraf');var config=require(_0xab49('0x5'));var attributes=require(_0xab49('0x6'));module[_0xab49('0x7')]=function(_0x4282a3,_0x189684){return _0x4282a3['define'](_0xab49('0x8'),attributes,{'tableName':_0xab49('0x9'),'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 4dfedac..f141fe7 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 _0x2171=['where','attributes','limit','map','include','model','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','findAll','options','raw'];(function(_0x4eb4c0,_0x3a228f){var _0xf21d77=function(_0x48bb2d){while(--_0x48bb2d){_0x4eb4c0['push'](_0x4eb4c0['shift']());}};_0xf21d77(++_0x3a228f);}(_0x2171,0x15c));var _0x1217=function(_0xe45948,_0x5eb5e9){_0xe45948=_0xe45948-0x0;var _0x38e52b=_0x2171[_0xe45948];return _0x38e52b;};'use strict';var _=require(_0x1217('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1217('0x1'));var rs=require(_0x1217('0x2'));var fs=require('fs');var Redis=require(_0x1217('0x3'));var db=require(_0x1217('0x4'))['db'];var utils=require(_0x1217('0x5'));var logger=require('../../config/logger')(_0x1217('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1217('0x7')][_0x1217('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26f219,_0x116e86,_0x577f05){return new BPromise(function(_0x45164a,_0x44b6e2){return client['request'](_0x26f219,_0x577f05)[_0x1217('0x9')](function(_0x23a9f8){logger[_0x1217('0xa')](_0x1217('0xb'),_0x116e86,_0x1217('0xc'));logger['debug'](_0x1217('0xd'),_0x116e86,_0x1217('0xc'),JSON[_0x1217('0xe')](_0x23a9f8));if(_0x23a9f8[_0x1217('0xf')]){if(_0x23a9f8[_0x1217('0xf')][_0x1217('0x10')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x116e86,_0x23a9f8[_0x1217('0xf')][_0x1217('0x11')]);return _0x44b6e2(_0x23a9f8[_0x1217('0xf')][_0x1217('0x11')]);}logger['error'](_0x1217('0xb'),_0x116e86,_0x23a9f8[_0x1217('0xf')][_0x1217('0x11')]);return _0x45164a(_0x23a9f8[_0x1217('0xf')][_0x1217('0x11')]);}else{logger[_0x1217('0xa')](_0x1217('0xb'),_0x116e86,_0x1217('0xc'));_0x45164a(_0x23a9f8[_0x1217('0x12')][_0x1217('0x11')]);}})[_0x1217('0x13')](function(_0x52d47e){logger['error']('Template,\x20%s,\x20%s',_0x116e86,_0x52d47e);_0x44b6e2(_0x52d47e);});});}exports[_0x1217('0x14')]=function(_0x43e104){var _0x56ba6f=this;return new Promise(function(_0x30eb36,_0x2dfd34){return db['Template'][_0x1217('0x15')]({'raw':_0x43e104['options']?_0x43e104[_0x1217('0x16')][_0x1217('0x17')]===undefined?!![]:![]:!![],'where':_0x43e104[_0x1217('0x16')]?_0x43e104[_0x1217('0x16')][_0x1217('0x18')]||null:null,'attributes':_0x43e104['options']?_0x43e104[_0x1217('0x16')][_0x1217('0x19')]||null:null,'limit':_0x43e104[_0x1217('0x16')]?_0x43e104[_0x1217('0x16')][_0x1217('0x1a')]||null:null,'include':_0x43e104[_0x1217('0x16')]?_0x43e104[_0x1217('0x16')]['include']?_[_0x1217('0x1b')](_0x43e104[_0x1217('0x16')]['include'],function(_0x50baaf){return{'model':db[_0x50baaf['model']],'as':_0x50baaf['as'],'attributes':_0x50baaf['attributes'],'include':_0x50baaf['include']?_[_0x1217('0x1b')](_0x50baaf[_0x1217('0x1c')],function(_0x330665){return{'model':db[_0x330665[_0x1217('0x1d')]],'as':_0x330665['as'],'attributes':_0x330665[_0x1217('0x19')],'include':_0x330665[_0x1217('0x1c')]?_[_0x1217('0x1b')](_0x330665[_0x1217('0x1c')],function(_0x42dd8b){return{'model':db[_0x42dd8b[_0x1217('0x1d')]],'as':_0x42dd8b['as'],'attributes':_0x42dd8b[_0x1217('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1217('0x9')](function(_0x77758c){logger[_0x1217('0xa')](_0x1217('0x14'),_0x43e104);logger[_0x1217('0x1e')](_0x1217('0x14'),_0x43e104,JSON[_0x1217('0xe')](_0x77758c));_0x30eb36(_0x77758c);})[_0x1217('0x13')](function(_0x2cc11b){logger[_0x1217('0xf')](_0x1217('0x14'),_0x2cc11b['message'],_0x43e104);_0x2dfd34(_0x56ba6f['error'](0x1f4,_0x2cc11b['message']));});});}; \ No newline at end of file +var _0x2f62=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetTemplate','Template','findAll','options','raw','attributes','limit','include','map','model','catch'];(function(_0x4fc8c8,_0x254fef){var _0x535129=function(_0x427b9a){while(--_0x427b9a){_0x4fc8c8['push'](_0x4fc8c8['shift']());}};_0x535129(++_0x254fef);}(_0x2f62,0x1ad));var _0x22f6=function(_0x3552ef,_0x462d6c){_0x3552ef=_0x3552ef-0x0;var _0x5a6def=_0x2f62[_0x3552ef];return _0x5a6def;};'use strict';var _=require(_0x22f6('0x0'));var util=require(_0x22f6('0x1'));var moment=require(_0x22f6('0x2'));var BPromise=require('bluebird');var rs=require(_0x22f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22f6('0x4'))['db'];var utils=require(_0x22f6('0x5'));var logger=require(_0x22f6('0x6'))('rpc');var config=require(_0x22f6('0x7'));var jayson=require(_0x22f6('0x8'));var client=jayson[_0x22f6('0x9')][_0x22f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50bab9,_0x2a7fa0,_0x481325){return new BPromise(function(_0x414a69,_0x476b14){return client['request'](_0x50bab9,_0x481325)[_0x22f6('0xb')](function(_0x4b249a){logger[_0x22f6('0xc')](_0x22f6('0xd'),_0x2a7fa0,'request\x20sent');logger[_0x22f6('0xe')](_0x22f6('0xf'),_0x2a7fa0,_0x22f6('0x10'),JSON[_0x22f6('0x11')](_0x4b249a));if(_0x4b249a[_0x22f6('0x12')]){if(_0x4b249a[_0x22f6('0x12')][_0x22f6('0x13')]===0x1f4){logger[_0x22f6('0x12')]('Template,\x20%s,\x20%s',_0x2a7fa0,_0x4b249a['error'][_0x22f6('0x14')]);return _0x476b14(_0x4b249a['error'][_0x22f6('0x14')]);}logger[_0x22f6('0x12')]('Template,\x20%s,\x20%s',_0x2a7fa0,_0x4b249a[_0x22f6('0x12')][_0x22f6('0x14')]);return _0x414a69(_0x4b249a[_0x22f6('0x12')]['message']);}else{logger[_0x22f6('0xc')](_0x22f6('0xd'),_0x2a7fa0,_0x22f6('0x10'));_0x414a69(_0x4b249a[_0x22f6('0x15')]['message']);}})['catch'](function(_0x44f779){logger[_0x22f6('0x12')](_0x22f6('0xd'),_0x2a7fa0,_0x44f779);_0x476b14(_0x44f779);});});}exports[_0x22f6('0x16')]=function(_0x375858){var _0x59a410=this;return new Promise(function(_0x4d298d,_0x4aeafd){return db[_0x22f6('0x17')][_0x22f6('0x18')]({'raw':_0x375858[_0x22f6('0x19')]?_0x375858['options'][_0x22f6('0x1a')]===undefined?!![]:![]:!![],'where':_0x375858[_0x22f6('0x19')]?_0x375858[_0x22f6('0x19')]['where']||null:null,'attributes':_0x375858[_0x22f6('0x19')]?_0x375858[_0x22f6('0x19')][_0x22f6('0x1b')]||null:null,'limit':_0x375858['options']?_0x375858[_0x22f6('0x19')][_0x22f6('0x1c')]||null:null,'include':_0x375858['options']?_0x375858[_0x22f6('0x19')][_0x22f6('0x1d')]?_[_0x22f6('0x1e')](_0x375858['options'][_0x22f6('0x1d')],function(_0x158c09){return{'model':db[_0x158c09[_0x22f6('0x1f')]],'as':_0x158c09['as'],'attributes':_0x158c09['attributes'],'include':_0x158c09[_0x22f6('0x1d')]?_[_0x22f6('0x1e')](_0x158c09[_0x22f6('0x1d')],function(_0x29280a){return{'model':db[_0x29280a['model']],'as':_0x29280a['as'],'attributes':_0x29280a[_0x22f6('0x1b')],'include':_0x29280a[_0x22f6('0x1d')]?_[_0x22f6('0x1e')](_0x29280a[_0x22f6('0x1d')],function(_0x3fe6a4){return{'model':db[_0x3fe6a4[_0x22f6('0x1f')]],'as':_0x3fe6a4['as'],'attributes':_0x3fe6a4['attributes']};}):[]};}):[]};}):[]:[]})[_0x22f6('0xb')](function(_0x10800e){logger['info'](_0x22f6('0x16'),_0x375858);logger['debug'](_0x22f6('0x16'),_0x375858,JSON['stringify'](_0x10800e));_0x4d298d(_0x10800e);})[_0x22f6('0x20')](function(_0x4474c8){logger[_0x22f6('0x12')](_0x22f6('0x16'),_0x4474c8['message'],_0x375858);_0x4aeafd(_0x59a410[_0x22f6('0x12')](0x1f4,_0x4474c8[_0x22f6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 37757c1..af84d3c 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 _0xcbf0=['create','post','addAction','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions'];(function(_0x2ba709,_0x3593f9){var _0x283ab4=function(_0x57a7b2){while(--_0x57a7b2){_0x2ba709['push'](_0x2ba709['shift']());}};_0x283ab4(++_0x3593f9);}(_0xcbf0,0xc1));var _0x0cbf=function(_0x41ac0f,_0x14ce8a){_0x41ac0f=_0x41ac0f-0x0;var _0x297c71=_0xcbf0[_0x41ac0f];return _0x297c71;};'use strict';var multer=require(_0x0cbf('0x0'));var util=require(_0x0cbf('0x1'));var path=require(_0x0cbf('0x2'));var timeout=require(_0x0cbf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0cbf('0x4'));var auth=require(_0x0cbf('0x5'));var interaction=require(_0x0cbf('0x6'));var config=require(_0x0cbf('0x7'));var controller=require(_0x0cbf('0x8'));router[_0x0cbf('0x9')]('/',auth[_0x0cbf('0xa')](),controller['index']);router['get']('/:id',auth[_0x0cbf('0xa')](),controller['show']);router[_0x0cbf('0x9')](_0x0cbf('0xb'),auth['isAuthenticated'](),controller[_0x0cbf('0xc')]);router[_0x0cbf('0x9')](_0x0cbf('0xd'),auth[_0x0cbf('0xa')](),controller[_0x0cbf('0xe')]);router[_0x0cbf('0x9')](_0x0cbf('0xf'),auth[_0x0cbf('0xa')](),controller[_0x0cbf('0x10')]);router['post']('/',auth[_0x0cbf('0xa')](),controller[_0x0cbf('0x11')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller['addAllCondition']);router[_0x0cbf('0x12')](_0x0cbf('0xd'),auth[_0x0cbf('0xa')](),controller['addAnyCondition']);router['post'](_0x0cbf('0xf'),auth[_0x0cbf('0xa')](),controller[_0x0cbf('0x13')]);router['put']('/:id',auth[_0x0cbf('0xa')](),controller['update']);router[_0x0cbf('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7bee=['post','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','/:id/any_conditions','/:id/actions','getActions'];(function(_0x4b18c8,_0x324200){var _0x426406=function(_0x3019c2){while(--_0x3019c2){_0x4b18c8['push'](_0x4b18c8['shift']());}};_0x426406(++_0x324200);}(_0x7bee,0x168));var _0xe7be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7bee[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe7be('0x0'));var util=require(_0xe7be('0x1'));var path=require(_0xe7be('0x2'));var timeout=require(_0xe7be('0x3'));var express=require(_0xe7be('0x4'));var router=express[_0xe7be('0x5')]();var fs_extra=require(_0xe7be('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe7be('0x7'));var controller=require(_0xe7be('0x8'));router[_0xe7be('0x9')]('/',auth[_0xe7be('0xa')](),controller[_0xe7be('0xb')]);router[_0xe7be('0x9')](_0xe7be('0xc'),auth[_0xe7be('0xa')](),controller[_0xe7be('0xd')]);router[_0xe7be('0x9')](_0xe7be('0xe'),auth[_0xe7be('0xa')](),controller['getAllConditions']);router[_0xe7be('0x9')](_0xe7be('0xf'),auth[_0xe7be('0xa')](),controller['getAnyConditions']);router[_0xe7be('0x9')](_0xe7be('0x10'),auth[_0xe7be('0xa')](),controller[_0xe7be('0x11')]);router['post']('/',auth[_0xe7be('0xa')](),controller['create']);router[_0xe7be('0x12')](_0xe7be('0xe'),auth[_0xe7be('0xa')](),controller[_0xe7be('0x13')]);router['post'](_0xe7be('0xf'),auth[_0xe7be('0xa')](),controller[_0xe7be('0x14')]);router[_0xe7be('0x12')](_0xe7be('0x10'),auth['isAuthenticated'](),controller[_0xe7be('0x15')]);router[_0xe7be('0x16')](_0xe7be('0xc'),auth[_0xe7be('0xa')](),controller[_0xe7be('0x17')]);router[_0xe7be('0x18')](_0xe7be('0xc'),auth['isAuthenticated'](),controller[_0xe7be('0x19')]);module[_0xe7be('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index da291aa..3be694f 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 _0x6e1a=['STRING'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x6e1a,0x6d));var _0xa6e1=function(_0x21fa6e,_0x29bb16){_0x21fa6e=_0x21fa6e-0x0;var _0x380fd0=_0x6e1a[_0x21fa6e];return _0x380fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa6e1('0x0')]},'channel':{'type':Sequelize[_0xa6e1('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5807=['sequelize','exports','STRING','BOOLEAN'];(function(_0x29e8d2,_0x164277){var _0x70f012=function(_0x4bedd3){while(--_0x4bedd3){_0x29e8d2['push'](_0x29e8d2['shift']());}};_0x70f012(++_0x164277);}(_0x5807,0xb8));var _0x7580=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0x5807[_0x3f2d02];return _0x54092b;};'use strict';var Sequelize=require(_0x7580('0x0'));module[_0x7580('0x1')]={'name':{'type':Sequelize[_0x7580('0x2')]},'channel':{'type':Sequelize[_0x7580('0x2')]},'description':{'type':Sequelize[_0x7580('0x2')]},'status':{'type':Sequelize[_0x7580('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 6f6f59d..bead7b4 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 _0x0937=['findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0937,0x1dc));var _0x7093=function(_0x572c0d,_0x178632){_0x572c0d=_0x572c0d-0x0;var _0x39e800=_0x0937[_0x572c0d];return _0x39e800;};'use strict';var emlformat=require(_0x7093('0x0'));var rimraf=require(_0x7093('0x1'));var zipdir=require(_0x7093('0x2'));var jsonpatch=require(_0x7093('0x3'));var rp=require(_0x7093('0x4'));var moment=require(_0x7093('0x5'));var BPromise=require(_0x7093('0x6'));var Mustache=require(_0x7093('0x7'));var util=require('util');var path=require(_0x7093('0x8'));var sox=require(_0x7093('0x9'));var csv=require(_0x7093('0xa'));var ejs=require(_0x7093('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7093('0xc'));var crypto=require(_0x7093('0xd'));var jsforce=require(_0x7093('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7093('0xa'));var querystring=require(_0x7093('0xf'));var Papa=require('papaparse');var Redis=require(_0x7093('0x10'));var authService=require(_0x7093('0x11'));var qs=require(_0x7093('0x12'));var as=require(_0x7093('0x13'));var hardwareService=require(_0x7093('0x14'));var logger=require(_0x7093('0x15'))(_0x7093('0x16'));var utils=require('../../config/utils');var config=require(_0x7093('0x17'));var licenseUtil=require(_0x7093('0x18'));var db=require(_0x7093('0x19'))['db'];function respondWithStatusCode(_0x4b3359,_0x2f75cd){_0x2f75cd=_0x2f75cd||0xcc;return function(_0x1e65b0){if(_0x1e65b0){return _0x4b3359[_0x7093('0x1a')](_0x2f75cd);}return _0x4b3359[_0x7093('0x1b')](_0x2f75cd)['end']();};}function respondWithResult(_0x29a185,_0x2984e5){_0x2984e5=_0x2984e5||0xc8;return function(_0xe9064f){if(_0xe9064f){return _0x29a185[_0x7093('0x1b')](_0x2984e5)['json'](_0xe9064f);}};}function respondWithFilteredResult(_0x2bca65,_0x14cd5d){return function(_0x4b09dd){if(_0x4b09dd){var _0x25e936=typeof _0x14cd5d[_0x7093('0x1c')]==='undefined'&&typeof _0x14cd5d[_0x7093('0x1d')]===_0x7093('0x1e');var _0x30396b=_0x4b09dd[_0x7093('0x1f')];var _0x1e5437=_0x25e936?0x0:_0x14cd5d[_0x7093('0x1c')];var _0x4687f0=_0x25e936?_0x4b09dd[_0x7093('0x1f')]:_0x14cd5d[_0x7093('0x1c')]+_0x14cd5d['limit'];var _0x11e08c;if(_0x4687f0>=_0x30396b){_0x4687f0=_0x30396b;_0x11e08c=0xc8;}else{_0x11e08c=0xce;}_0x2bca65[_0x7093('0x1b')](_0x11e08c);return _0x2bca65[_0x7093('0x20')](_0x7093('0x21'),_0x1e5437+'-'+_0x4687f0+'/'+_0x30396b)[_0x7093('0x22')](_0x4b09dd);}return null;};}function patchUpdates(_0xff1fe7){return function(_0xce40ce){try{jsonpatch[_0x7093('0x23')](_0xce40ce,_0xff1fe7,!![]);}catch(_0x32d236){return BPromise[_0x7093('0x24')](_0x32d236);}return _0xce40ce[_0x7093('0x25')]();};}function saveUpdates(_0x5e6dda,_0x5c363f){return function(_0x4ebe33){if(_0x4ebe33){return _0x4ebe33[_0x7093('0x26')](_0x5e6dda)[_0x7093('0x27')](function(_0x4b9c6c){return _0x4b9c6c;});}return null;};}function removeEntity(_0x2f80a3,_0x397ad5){return function(_0x216dc5){if(_0x216dc5){return _0x216dc5[_0x7093('0x28')]()['then'](function(){var _0x2679af=_0x216dc5[_0x7093('0x29')]({'plain':!![]});var _0x366a09='Triggers';return db['UserProfileResource'][_0x7093('0x28')]({'where':{'type':_0x366a09,'resourceId':_0x2679af['id']}})[_0x7093('0x27')](function(){return _0x216dc5;});})['then'](function(){_0x2f80a3[_0x7093('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b49ec,_0x1bfd89){return function(_0x549ec4){if(!_0x549ec4){_0x4b49ec[_0x7093('0x1a')](0x194);}return _0x549ec4;};}function handleError(_0x325b8c,_0x42a000){_0x42a000=_0x42a000||0x1f4;return function(_0x3bf535){logger[_0x7093('0x2a')](_0x3bf535[_0x7093('0x2b')]);if(_0x3bf535[_0x7093('0x2c')]){delete _0x3bf535[_0x7093('0x2c')];}_0x325b8c['status'](_0x42a000)[_0x7093('0x2d')](_0x3bf535);};}exports[_0x7093('0x2e')]=function(_0x3788a6,_0x3ba0b6){var _0x37a16d={},_0x4e90a3={},_0x265936={'count':0x0,'rows':[]};var _0x476b93=_[_0x7093('0x2f')](db[_0x7093('0x30')][_0x7093('0x31')],function(_0x258b1e){return{'name':_0x258b1e[_0x7093('0x32')],'type':_0x258b1e['type'][_0x7093('0x33')]};});_0x4e90a3[_0x7093('0x34')]=_['map'](_0x476b93,_0x7093('0x2c'));_0x4e90a3['query']=_[_0x7093('0x35')](_0x3788a6[_0x7093('0x36')]);_0x4e90a3[_0x7093('0x37')]=_[_0x7093('0x38')](_0x4e90a3[_0x7093('0x34')],_0x4e90a3[_0x7093('0x36')]);_0x37a16d[_0x7093('0x39')]=_[_0x7093('0x38')](_0x4e90a3['model'],qs['fields'](_0x3788a6[_0x7093('0x36')][_0x7093('0x3a')]));_0x37a16d[_0x7093('0x39')]=_0x37a16d[_0x7093('0x39')][_0x7093('0x3b')]?_0x37a16d['attributes']:_0x4e90a3['model'];if(!_0x3788a6[_0x7093('0x36')][_0x7093('0x3c')](_0x7093('0x3d'))){_0x37a16d[_0x7093('0x1d')]=qs[_0x7093('0x1d')](_0x3788a6[_0x7093('0x36')][_0x7093('0x1d')]);_0x37a16d[_0x7093('0x1c')]=qs[_0x7093('0x1c')](_0x3788a6[_0x7093('0x36')][_0x7093('0x1c')]);}_0x37a16d[_0x7093('0x3e')]=qs['sort'](_0x3788a6[_0x7093('0x36')][_0x7093('0x3f')]);_0x37a16d[_0x7093('0x40')]=qs[_0x7093('0x37')](_[_0x7093('0x41')](_0x3788a6[_0x7093('0x36')],_0x4e90a3['filters']),_0x476b93);if(_0x3788a6[_0x7093('0x36')][_0x7093('0x42')]){_0x37a16d['where']=_[_0x7093('0x43')](_0x37a16d[_0x7093('0x40')],{'$or':_[_0x7093('0x2f')](_0x476b93,function(_0x5de32d){if(_0x5de32d['type']!=='VIRTUAL'){var _0x4c2119={};_0x4c2119[_0x5de32d[_0x7093('0x2c')]]={'$like':'%'+_0x3788a6['query'][_0x7093('0x42')]+'%'};return _0x4c2119;}})});}_0x37a16d=_[_0x7093('0x43')]({},_0x37a16d,_0x3788a6[_0x7093('0x44')]);var _0x5692c={'where':_0x37a16d['where']};return db['Trigger'][_0x7093('0x1f')](_0x5692c)[_0x7093('0x27')](function(_0x214e01){_0x265936['count']=_0x214e01;if(_0x3788a6['query'][_0x7093('0x45')]){_0x37a16d[_0x7093('0x46')]=[{'all':!![]}];}return db[_0x7093('0x30')][_0x7093('0x47')](_0x37a16d);})[_0x7093('0x27')](function(_0x1eb4c6){_0x265936['rows']=_0x1eb4c6;return _0x265936;})['then'](respondWithFilteredResult(_0x3ba0b6,_0x37a16d))[_0x7093('0x48')](handleError(_0x3ba0b6,null));};exports[_0x7093('0x49')]=function(_0x8683ac,_0x3fa95d){var _0x2168d3={'raw':![],'where':{'id':_0x8683ac[_0x7093('0x4a')]['id']}},_0x58248b={};_0x58248b[_0x7093('0x34')]=_[_0x7093('0x35')](db[_0x7093('0x30')][_0x7093('0x31')]);_0x58248b[_0x7093('0x36')]=_[_0x7093('0x35')](_0x8683ac[_0x7093('0x36')]);_0x58248b[_0x7093('0x37')]=_[_0x7093('0x38')](_0x58248b[_0x7093('0x34')],_0x58248b[_0x7093('0x36')]);_0x2168d3['attributes']=_[_0x7093('0x38')](_0x58248b['model'],qs[_0x7093('0x3a')](_0x8683ac[_0x7093('0x36')][_0x7093('0x3a')]));_0x2168d3[_0x7093('0x39')]=_0x2168d3[_0x7093('0x39')][_0x7093('0x3b')]?_0x2168d3[_0x7093('0x39')]:_0x58248b[_0x7093('0x34')];if(_0x8683ac[_0x7093('0x36')]['includeAll']){_0x2168d3['include']=[{'all':!![]}];}_0x2168d3=_[_0x7093('0x43')]({},_0x2168d3,_0x8683ac['options']);return db['Trigger'][_0x7093('0x4b')](_0x2168d3)[_0x7093('0x27')](handleEntityNotFound(_0x3fa95d,null))['then'](respondWithResult(_0x3fa95d,null))['catch'](handleError(_0x3fa95d,null));};exports['create']=function(_0x4c4dd4,_0x3deb85){return db[_0x7093('0x30')][_0x7093('0x4c')](_0x4c4dd4[_0x7093('0x4d')],{})[_0x7093('0x27')](function(_0x4d8ada){var _0x4e11cc=_0x4c4dd4['user']['get']({'plain':!![]});if(!_0x4e11cc)throw new Error(_0x7093('0x4e'));if(_0x4e11cc['role']===_0x7093('0x4f')){var _0x367cdc=_0x4d8ada[_0x7093('0x29')]({'plain':!![]});var _0x21f2b6='Triggers';return db[_0x7093('0x50')]['find']({'where':{'name':_0x21f2b6,'userProfileId':_0x4e11cc[_0x7093('0x51')]},'raw':!![]})[_0x7093('0x27')](function(_0x4357af){if(_0x4357af&&_0x4357af['autoAssociation']===0x0){return db[_0x7093('0x52')][_0x7093('0x4c')]({'name':_0x367cdc[_0x7093('0x2c')],'resourceId':_0x367cdc['id'],'type':_0x4357af['name'],'sectionId':_0x4357af['id']},{})[_0x7093('0x27')](function(){return _0x4d8ada;});}else{return _0x4d8ada;}})[_0x7093('0x48')](function(_0x47374e){logger[_0x7093('0x2a')](_0x7093('0x53'),_0x47374e);throw _0x47374e;});}return _0x4d8ada;})[_0x7093('0x27')](respondWithResult(_0x3deb85,0xc9))[_0x7093('0x48')](handleError(_0x3deb85,null));};exports[_0x7093('0x26')]=function(_0x13e257,_0x2c8200){if(_0x13e257[_0x7093('0x4d')]['id']){delete _0x13e257[_0x7093('0x4d')]['id'];}return db[_0x7093('0x30')][_0x7093('0x4b')]({'where':{'id':_0x13e257[_0x7093('0x4a')]['id']}})[_0x7093('0x27')](handleEntityNotFound(_0x2c8200,null))['then'](saveUpdates(_0x13e257['body'],null))[_0x7093('0x27')](respondWithResult(_0x2c8200,null))['catch'](handleError(_0x2c8200,null));};exports['destroy']=function(_0x515ec7,_0x224de9){return db[_0x7093('0x30')][_0x7093('0x4b')]({'where':{'id':_0x515ec7[_0x7093('0x4a')]['id']}})['then'](handleEntityNotFound(_0x224de9,null))[_0x7093('0x27')](removeEntity(_0x224de9,null))[_0x7093('0x48')](handleError(_0x224de9,null));};exports[_0x7093('0x54')]=function(_0xea90f4,_0x35a130,_0x5052c2){if(_0xea90f4[_0x7093('0x4d')]['id']){delete _0xea90f4[_0x7093('0x4d')]['id'];}return db[_0x7093('0x30')]['find']({'where':{'id':_0xea90f4[_0x7093('0x4a')]['id']}})[_0x7093('0x27')](handleEntityNotFound(_0x35a130,null))[_0x7093('0x27')](function(_0x20137e){if(_0x20137e){_0xea90f4[_0x7093('0x4d')][_0x7093('0x55')]=_0x20137e['id'];return db[_0x7093('0x56')]['create'](_0xea90f4[_0x7093('0x4d')]);}})[_0x7093('0x27')](respondWithResult(_0x35a130,null))[_0x7093('0x48')](handleError(_0x35a130,null));};exports[_0x7093('0x57')]=function(_0x3fafd9,_0x24cda3,_0xe68f22){if(_0x3fafd9['body']['id']){delete _0x3fafd9[_0x7093('0x4d')]['id'];}return db[_0x7093('0x30')][_0x7093('0x4b')]({'where':{'id':_0x3fafd9[_0x7093('0x4a')]['id']}})[_0x7093('0x27')](handleEntityNotFound(_0x24cda3,null))[_0x7093('0x27')](function(_0x5d6e90){if(_0x5d6e90){_0x3fafd9['body']['TriggerAnyId']=_0x5d6e90['id'];return db[_0x7093('0x56')][_0x7093('0x4c')](_0x3fafd9[_0x7093('0x4d')]);}})[_0x7093('0x27')](respondWithResult(_0x24cda3,null))[_0x7093('0x48')](handleError(_0x24cda3,null));};exports['getAllConditions']=function(_0x3fcda1,_0x2ebc87,_0xef79f7){var _0x49929a={};var _0x45f6c0={};var _0x272d31;var _0x1f6f9a;return db['Trigger']['findOne']({'where':{'id':_0x3fcda1[_0x7093('0x4a')]['id']}})[_0x7093('0x27')](handleEntityNotFound(_0x2ebc87,null))[_0x7093('0x27')](function(_0x5a0e88){if(_0x5a0e88){_0x272d31=_0x5a0e88;_0x45f6c0['model']=_[_0x7093('0x35')](db['Condition'][_0x7093('0x31')]);_0x45f6c0[_0x7093('0x36')]=_[_0x7093('0x35')](_0x3fcda1['query']);_0x45f6c0[_0x7093('0x37')]=_[_0x7093('0x38')](_0x45f6c0[_0x7093('0x34')],_0x45f6c0[_0x7093('0x36')]);_0x49929a[_0x7093('0x39')]=_[_0x7093('0x38')](_0x45f6c0['model'],qs[_0x7093('0x3a')](_0x3fcda1['query']['fields']));_0x49929a[_0x7093('0x39')]=_0x49929a[_0x7093('0x39')][_0x7093('0x3b')]?_0x49929a['attributes']:_0x45f6c0[_0x7093('0x34')];_0x49929a[_0x7093('0x3e')]=qs[_0x7093('0x3f')](_0x3fcda1[_0x7093('0x36')]['sort']);_0x49929a[_0x7093('0x40')]=qs[_0x7093('0x37')](_[_0x7093('0x41')](_0x3fcda1['query'],_0x45f6c0[_0x7093('0x37')]));if(_0x3fcda1['query'][_0x7093('0x42')]){_0x49929a['where']=_['merge'](_0x49929a['where'],{'$or':_[_0x7093('0x2f')](_0x49929a[_0x7093('0x39')],function(_0x4cbe4d){var _0x3ca355={};_0x3ca355[_0x4cbe4d]={'$like':'%'+_0x3fcda1['query'][_0x7093('0x42')]+'%'};return _0x3ca355;})});}_0x49929a=_[_0x7093('0x43')]({},_0x49929a,_0x3fcda1[_0x7093('0x44')]);return _0x272d31[_0x7093('0x58')](_0x49929a);}})[_0x7093('0x27')](function(_0x4c3198){if(_0x4c3198){_0x1f6f9a=_0x4c3198[_0x7093('0x3b')];if(!_0x3fcda1[_0x7093('0x36')][_0x7093('0x3c')]('nolimit')){_0x49929a['limit']=qs[_0x7093('0x1d')](_0x3fcda1[_0x7093('0x36')]['limit']);_0x49929a['offset']=qs[_0x7093('0x1c')](_0x3fcda1[_0x7093('0x36')]['offset']);}return _0x272d31['getAllConditions'](_0x49929a);}})['then'](function(_0x58a8ff){if(_0x58a8ff){return _0x58a8ff?{'count':_0x1f6f9a,'rows':_0x58a8ff}:null;}})[_0x7093('0x27')](respondWithResult(_0x2ebc87,null))['catch'](handleError(_0x2ebc87,null));};exports['getAnyConditions']=function(_0x13d85e,_0x1797f7,_0x5875b4){var _0x5e10b3={};var _0x48ce90={};var _0x456249;var _0x47e88d;return db[_0x7093('0x30')]['findOne']({'where':{'id':_0x13d85e[_0x7093('0x4a')]['id']}})[_0x7093('0x27')](handleEntityNotFound(_0x1797f7,null))[_0x7093('0x27')](function(_0x2b8791){if(_0x2b8791){_0x456249=_0x2b8791;_0x48ce90[_0x7093('0x34')]=_['keys'](db[_0x7093('0x56')][_0x7093('0x31')]);_0x48ce90[_0x7093('0x36')]=_[_0x7093('0x35')](_0x13d85e[_0x7093('0x36')]);_0x48ce90['filters']=_[_0x7093('0x38')](_0x48ce90[_0x7093('0x34')],_0x48ce90[_0x7093('0x36')]);_0x5e10b3[_0x7093('0x39')]=_[_0x7093('0x38')](_0x48ce90['model'],qs['fields'](_0x13d85e[_0x7093('0x36')][_0x7093('0x3a')]));_0x5e10b3[_0x7093('0x39')]=_0x5e10b3['attributes'][_0x7093('0x3b')]?_0x5e10b3[_0x7093('0x39')]:_0x48ce90[_0x7093('0x34')];_0x5e10b3[_0x7093('0x3e')]=qs[_0x7093('0x3f')](_0x13d85e['query']['sort']);_0x5e10b3['where']=qs[_0x7093('0x37')](_[_0x7093('0x41')](_0x13d85e[_0x7093('0x36')],_0x48ce90[_0x7093('0x37')]));if(_0x13d85e[_0x7093('0x36')][_0x7093('0x42')]){_0x5e10b3[_0x7093('0x40')]=_[_0x7093('0x43')](_0x5e10b3['where'],{'$or':_['map'](_0x5e10b3['attributes'],function(_0x227188){var _0x15b061={};_0x15b061[_0x227188]={'$like':'%'+_0x13d85e['query'][_0x7093('0x42')]+'%'};return _0x15b061;})});}_0x5e10b3=_[_0x7093('0x43')]({},_0x5e10b3,_0x13d85e[_0x7093('0x44')]);return _0x456249['getAnyConditions'](_0x5e10b3);}})['then'](function(_0x446cd2){if(_0x446cd2){_0x47e88d=_0x446cd2['length'];if(!_0x13d85e[_0x7093('0x36')][_0x7093('0x3c')](_0x7093('0x3d'))){_0x5e10b3[_0x7093('0x1d')]=qs[_0x7093('0x1d')](_0x13d85e[_0x7093('0x36')]['limit']);_0x5e10b3[_0x7093('0x1c')]=qs[_0x7093('0x1c')](_0x13d85e['query'][_0x7093('0x1c')]);}return _0x456249[_0x7093('0x59')](_0x5e10b3);}})['then'](function(_0x2ff3a7){if(_0x2ff3a7){return _0x2ff3a7?{'count':_0x47e88d,'rows':_0x2ff3a7}:null;}})['then'](respondWithResult(_0x1797f7,null))[_0x7093('0x48')](handleError(_0x1797f7,null));};exports[_0x7093('0x5a')]=function(_0x142629,_0x353991,_0x168805){if(_0x142629[_0x7093('0x4d')]['id']){delete _0x142629['body']['id'];}return db[_0x7093('0x30')][_0x7093('0x4b')]({'where':{'id':_0x142629[_0x7093('0x4a')]['id']}})[_0x7093('0x27')](handleEntityNotFound(_0x353991,null))[_0x7093('0x27')](function(_0x1f899e){if(_0x1f899e){_0x142629[_0x7093('0x4d')][_0x7093('0x5b')]=_0x1f899e['id'];return db[_0x7093('0x5c')][_0x7093('0x4c')](_0x142629[_0x7093('0x4d')]);}})[_0x7093('0x27')](respondWithResult(_0x353991,null))[_0x7093('0x48')](handleError(_0x353991,null));};exports[_0x7093('0x5d')]=function(_0x4fe1a4,_0x21e9bf,_0x55f7bf){var _0x4d6015={};var _0x4811f9={};var _0x10c747;var _0x5f3d64;return db[_0x7093('0x30')][_0x7093('0x5e')]({'where':{'id':_0x4fe1a4['params']['id']}})[_0x7093('0x27')](handleEntityNotFound(_0x21e9bf,null))[_0x7093('0x27')](function(_0x37ef2e){if(_0x37ef2e){_0x10c747=_0x37ef2e;_0x4811f9[_0x7093('0x34')]=_[_0x7093('0x35')](db[_0x7093('0x5c')]['rawAttributes']);_0x4811f9['query']=_[_0x7093('0x35')](_0x4fe1a4[_0x7093('0x36')]);_0x4811f9[_0x7093('0x37')]=_[_0x7093('0x38')](_0x4811f9[_0x7093('0x34')],_0x4811f9[_0x7093('0x36')]);_0x4d6015[_0x7093('0x39')]=_[_0x7093('0x38')](_0x4811f9[_0x7093('0x34')],qs['fields'](_0x4fe1a4['query'][_0x7093('0x3a')]));_0x4d6015[_0x7093('0x39')]=_0x4d6015['attributes'][_0x7093('0x3b')]?_0x4d6015[_0x7093('0x39')]:_0x4811f9[_0x7093('0x34')];_0x4d6015['order']=qs['sort'](_0x4fe1a4[_0x7093('0x36')]['sort']);_0x4d6015[_0x7093('0x40')]=qs[_0x7093('0x37')](_[_0x7093('0x41')](_0x4fe1a4['query'],_0x4811f9[_0x7093('0x37')]));if(_0x4fe1a4['query'][_0x7093('0x42')]){_0x4d6015[_0x7093('0x40')]=_[_0x7093('0x43')](_0x4d6015[_0x7093('0x40')],{'$or':_[_0x7093('0x2f')](_0x4d6015[_0x7093('0x39')],function(_0x580a8c){var _0x44ff0d={};_0x44ff0d[_0x580a8c]={'$like':'%'+_0x4fe1a4[_0x7093('0x36')][_0x7093('0x42')]+'%'};return _0x44ff0d;})});}_0x4d6015=_[_0x7093('0x43')]({},_0x4d6015,_0x4fe1a4['options']);return _0x10c747['getActions'](_0x4d6015);}})['then'](function(_0x2a1d60){if(_0x2a1d60){_0x5f3d64=_0x2a1d60[_0x7093('0x3b')];if(!_0x4fe1a4['query'][_0x7093('0x3c')](_0x7093('0x3d'))){_0x4d6015[_0x7093('0x1d')]=qs[_0x7093('0x1d')](_0x4fe1a4[_0x7093('0x36')][_0x7093('0x1d')]);_0x4d6015[_0x7093('0x1c')]=qs[_0x7093('0x1c')](_0x4fe1a4['query'][_0x7093('0x1c')]);}return _0x10c747[_0x7093('0x5d')](_0x4d6015);}})[_0x7093('0x27')](function(_0x24bddc){if(_0x24bddc){return _0x24bddc?{'count':_0x5f3d64,'rows':_0x24bddc}:null;}})[_0x7093('0x27')](respondWithResult(_0x21e9bf,null))[_0x7093('0x48')](handleError(_0x21e9bf,null));}; \ No newline at end of file +var _0x1488=['findAll','rows','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','TriggerAllId','addAnyCondition','TriggerAnyId','getAllConditions','sort','nolimit','getAnyConditions','findOne','Condition','addAction','Action','getActions','pick','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','then','destroy','get','UserProfileResource','error','stack','send','index','map','Trigger','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','filter','merge','options','include'];(function(_0x2aa832,_0x233fd7){var _0x49ec5c=function(_0x41a59f){while(--_0x41a59f){_0x2aa832['push'](_0x2aa832['shift']());}};_0x49ec5c(++_0x233fd7);}(_0x1488,0x7c));var _0x8148=function(_0x47e7dd,_0x51b041){_0x47e7dd=_0x47e7dd-0x0;var _0x38501f=_0x1488[_0x47e7dd];return _0x38501f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8148('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8148('0x1'));var rp=require(_0x8148('0x2'));var moment=require(_0x8148('0x3'));var BPromise=require(_0x8148('0x4'));var Mustache=require(_0x8148('0x5'));var util=require('util');var path=require(_0x8148('0x6'));var sox=require(_0x8148('0x7'));var csv=require(_0x8148('0x8'));var ejs=require(_0x8148('0x9'));var fs=require('fs');var fs_extra=require(_0x8148('0xa'));var _=require('lodash');var squel=require(_0x8148('0xb'));var crypto=require('crypto');var jsforce=require(_0x8148('0xc'));var deskjs=require(_0x8148('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8148('0xe'));var Papa=require(_0x8148('0xf'));var Redis=require(_0x8148('0x10'));var authService=require(_0x8148('0x11'));var qs=require(_0x8148('0x12'));var as=require(_0x8148('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8148('0x14'));var utils=require('../../config/utils');var config=require(_0x8148('0x15'));var licenseUtil=require(_0x8148('0x16'));var db=require(_0x8148('0x17'))['db'];function respondWithStatusCode(_0x80388,_0x223f88){_0x223f88=_0x223f88||0xcc;return function(_0x401a34){if(_0x401a34){return _0x80388[_0x8148('0x18')](_0x223f88);}return _0x80388['status'](_0x223f88)[_0x8148('0x19')]();};}function respondWithResult(_0x32acc1,_0x1d72e6){_0x1d72e6=_0x1d72e6||0xc8;return function(_0x545aaa){if(_0x545aaa){return _0x32acc1[_0x8148('0x1a')](_0x1d72e6)[_0x8148('0x1b')](_0x545aaa);}};}function respondWithFilteredResult(_0x32d3d2,_0xdecaf3){return function(_0x2ffc68){if(_0x2ffc68){var _0x42bfff=typeof _0xdecaf3[_0x8148('0x1c')]===_0x8148('0x1d')&&typeof _0xdecaf3[_0x8148('0x1e')]===_0x8148('0x1d');var _0x316e24=_0x2ffc68[_0x8148('0x1f')];var _0x326798=_0x42bfff?0x0:_0xdecaf3[_0x8148('0x1c')];var _0x44a7c3=_0x42bfff?_0x2ffc68[_0x8148('0x1f')]:_0xdecaf3['offset']+_0xdecaf3[_0x8148('0x1e')];var _0x4ef25c;if(_0x44a7c3>=_0x316e24){_0x44a7c3=_0x316e24;_0x4ef25c=0xc8;}else{_0x4ef25c=0xce;}_0x32d3d2[_0x8148('0x1a')](_0x4ef25c);return _0x32d3d2[_0x8148('0x20')]('Content-Range',_0x326798+'-'+_0x44a7c3+'/'+_0x316e24)['json'](_0x2ffc68);}return null;};}function patchUpdates(_0x130d83){return function(_0xc92ef6){try{jsonpatch[_0x8148('0x21')](_0xc92ef6,_0x130d83,!![]);}catch(_0x53782e){return BPromise[_0x8148('0x22')](_0x53782e);}return _0xc92ef6['save']();};}function saveUpdates(_0x58acb3,_0x1921b6){return function(_0x28800c){if(_0x28800c){return _0x28800c['update'](_0x58acb3)[_0x8148('0x23')](function(_0x14ad34){return _0x14ad34;});}return null;};}function removeEntity(_0x37ef8f,_0x2a7c82){return function(_0x55984f){if(_0x55984f){return _0x55984f[_0x8148('0x24')]()[_0x8148('0x23')](function(){var _0x3930e4=_0x55984f[_0x8148('0x25')]({'plain':!![]});var _0xc52bc1='Triggers';return db[_0x8148('0x26')][_0x8148('0x24')]({'where':{'type':_0xc52bc1,'resourceId':_0x3930e4['id']}})[_0x8148('0x23')](function(){return _0x55984f;});})[_0x8148('0x23')](function(){_0x37ef8f[_0x8148('0x1a')](0xcc)[_0x8148('0x19')]();});}};}function handleEntityNotFound(_0x1442b4,_0x45cc2b){return function(_0x4c3a9c){if(!_0x4c3a9c){_0x1442b4[_0x8148('0x18')](0x194);}return _0x4c3a9c;};}function handleError(_0x358f8e,_0x10491d){_0x10491d=_0x10491d||0x1f4;return function(_0x2436f5){logger[_0x8148('0x27')](_0x2436f5[_0x8148('0x28')]);if(_0x2436f5['name']){delete _0x2436f5['name'];}_0x358f8e['status'](_0x10491d)[_0x8148('0x29')](_0x2436f5);};}exports[_0x8148('0x2a')]=function(_0x4cbaad,_0x30ddfb){var _0x10a70c={},_0x3ea86f={},_0x339d54={'count':0x0,'rows':[]};var _0x4c2db3=_[_0x8148('0x2b')](db[_0x8148('0x2c')][_0x8148('0x2d')],function(_0x91b7f8){return{'name':_0x91b7f8[_0x8148('0x2e')],'type':_0x91b7f8[_0x8148('0x2f')][_0x8148('0x30')]};});_0x3ea86f['model']=_['map'](_0x4c2db3,_0x8148('0x31'));_0x3ea86f['query']=_['keys'](_0x4cbaad[_0x8148('0x32')]);_0x3ea86f[_0x8148('0x33')]=_[_0x8148('0x34')](_0x3ea86f[_0x8148('0x35')],_0x3ea86f[_0x8148('0x32')]);_0x10a70c[_0x8148('0x36')]=_['intersection'](_0x3ea86f['model'],qs['fields'](_0x4cbaad[_0x8148('0x32')][_0x8148('0x37')]));_0x10a70c['attributes']=_0x10a70c[_0x8148('0x36')][_0x8148('0x38')]?_0x10a70c[_0x8148('0x36')]:_0x3ea86f[_0x8148('0x35')];if(!_0x4cbaad[_0x8148('0x32')][_0x8148('0x39')]('nolimit')){_0x10a70c['limit']=qs[_0x8148('0x1e')](_0x4cbaad['query'][_0x8148('0x1e')]);_0x10a70c[_0x8148('0x1c')]=qs['offset'](_0x4cbaad[_0x8148('0x32')]['offset']);}_0x10a70c[_0x8148('0x3a')]=qs['sort'](_0x4cbaad[_0x8148('0x32')]['sort']);_0x10a70c[_0x8148('0x3b')]=qs[_0x8148('0x33')](_['pick'](_0x4cbaad[_0x8148('0x32')],_0x3ea86f['filters']),_0x4c2db3);if(_0x4cbaad[_0x8148('0x32')][_0x8148('0x3c')]){_0x10a70c[_0x8148('0x3b')]=_[_0x8148('0x3d')](_0x10a70c[_0x8148('0x3b')],{'$or':_['map'](_0x4c2db3,function(_0x33136f){if(_0x33136f[_0x8148('0x2f')]!=='VIRTUAL'){var _0xb5aaac={};_0xb5aaac[_0x33136f[_0x8148('0x31')]]={'$like':'%'+_0x4cbaad[_0x8148('0x32')]['filter']+'%'};return _0xb5aaac;}})});}_0x10a70c=_[_0x8148('0x3d')]({},_0x10a70c,_0x4cbaad[_0x8148('0x3e')]);var _0x16fb8d={'where':_0x10a70c[_0x8148('0x3b')]};return db[_0x8148('0x2c')]['count'](_0x16fb8d)[_0x8148('0x23')](function(_0x46f84a){_0x339d54[_0x8148('0x1f')]=_0x46f84a;if(_0x4cbaad[_0x8148('0x32')]['includeAll']){_0x10a70c[_0x8148('0x3f')]=[{'all':!![]}];}return db[_0x8148('0x2c')][_0x8148('0x40')](_0x10a70c);})[_0x8148('0x23')](function(_0x5e98fc){_0x339d54[_0x8148('0x41')]=_0x5e98fc;return _0x339d54;})['then'](respondWithFilteredResult(_0x30ddfb,_0x10a70c))['catch'](handleError(_0x30ddfb,null));};exports[_0x8148('0x42')]=function(_0x5e90f5,_0x22c9e3){var _0x3a9467={'raw':![],'where':{'id':_0x5e90f5[_0x8148('0x43')]['id']}},_0x5384f7={};_0x5384f7[_0x8148('0x35')]=_[_0x8148('0x44')](db[_0x8148('0x2c')][_0x8148('0x2d')]);_0x5384f7['query']=_[_0x8148('0x44')](_0x5e90f5[_0x8148('0x32')]);_0x5384f7[_0x8148('0x33')]=_[_0x8148('0x34')](_0x5384f7['model'],_0x5384f7[_0x8148('0x32')]);_0x3a9467[_0x8148('0x36')]=_[_0x8148('0x34')](_0x5384f7[_0x8148('0x35')],qs[_0x8148('0x37')](_0x5e90f5['query'][_0x8148('0x37')]));_0x3a9467[_0x8148('0x36')]=_0x3a9467['attributes']['length']?_0x3a9467[_0x8148('0x36')]:_0x5384f7[_0x8148('0x35')];if(_0x5e90f5[_0x8148('0x32')][_0x8148('0x45')]){_0x3a9467[_0x8148('0x3f')]=[{'all':!![]}];}_0x3a9467=_[_0x8148('0x3d')]({},_0x3a9467,_0x5e90f5['options']);return db[_0x8148('0x2c')][_0x8148('0x46')](_0x3a9467)[_0x8148('0x23')](handleEntityNotFound(_0x22c9e3,null))[_0x8148('0x23')](respondWithResult(_0x22c9e3,null))['catch'](handleError(_0x22c9e3,null));};exports[_0x8148('0x47')]=function(_0x41061c,_0x30df45){return db[_0x8148('0x2c')][_0x8148('0x47')](_0x41061c[_0x8148('0x48')],{})[_0x8148('0x23')](function(_0x1ffafe){var _0x21849e=_0x41061c[_0x8148('0x49')]['get']({'plain':!![]});if(!_0x21849e)throw new Error(_0x8148('0x4a'));if(_0x21849e[_0x8148('0x4b')]===_0x8148('0x49')){var _0x1f195e=_0x1ffafe[_0x8148('0x25')]({'plain':!![]});var _0x19662f='Triggers';return db[_0x8148('0x4c')][_0x8148('0x46')]({'where':{'name':_0x19662f,'userProfileId':_0x21849e['userProfileId']},'raw':!![]})[_0x8148('0x23')](function(_0x23608e){if(_0x23608e&&_0x23608e[_0x8148('0x4d')]===0x0){return db[_0x8148('0x26')]['create']({'name':_0x1f195e[_0x8148('0x31')],'resourceId':_0x1f195e['id'],'type':_0x23608e[_0x8148('0x31')],'sectionId':_0x23608e['id']},{})[_0x8148('0x23')](function(){return _0x1ffafe;});}else{return _0x1ffafe;}})[_0x8148('0x4e')](function(_0x1a09cb){logger[_0x8148('0x27')](_0x8148('0x4f'),_0x1a09cb);throw _0x1a09cb;});}return _0x1ffafe;})[_0x8148('0x23')](respondWithResult(_0x30df45,0xc9))['catch'](handleError(_0x30df45,null));};exports[_0x8148('0x50')]=function(_0x4bced8,_0x227517){if(_0x4bced8['body']['id']){delete _0x4bced8['body']['id'];}return db['Trigger'][_0x8148('0x46')]({'where':{'id':_0x4bced8['params']['id']}})[_0x8148('0x23')](handleEntityNotFound(_0x227517,null))['then'](saveUpdates(_0x4bced8[_0x8148('0x48')],null))[_0x8148('0x23')](respondWithResult(_0x227517,null))[_0x8148('0x4e')](handleError(_0x227517,null));};exports[_0x8148('0x24')]=function(_0x1f4a67,_0x124c12){return db[_0x8148('0x2c')][_0x8148('0x46')]({'where':{'id':_0x1f4a67[_0x8148('0x43')]['id']}})[_0x8148('0x23')](handleEntityNotFound(_0x124c12,null))[_0x8148('0x23')](removeEntity(_0x124c12,null))[_0x8148('0x4e')](handleError(_0x124c12,null));};exports['addAllCondition']=function(_0x103f8d,_0x5a6068,_0x3a9988){if(_0x103f8d[_0x8148('0x48')]['id']){delete _0x103f8d[_0x8148('0x48')]['id'];}return db[_0x8148('0x2c')]['find']({'where':{'id':_0x103f8d[_0x8148('0x43')]['id']}})[_0x8148('0x23')](handleEntityNotFound(_0x5a6068,null))[_0x8148('0x23')](function(_0x4cadf6){if(_0x4cadf6){_0x103f8d[_0x8148('0x48')][_0x8148('0x51')]=_0x4cadf6['id'];return db['Condition'][_0x8148('0x47')](_0x103f8d[_0x8148('0x48')]);}})[_0x8148('0x23')](respondWithResult(_0x5a6068,null))[_0x8148('0x4e')](handleError(_0x5a6068,null));};exports[_0x8148('0x52')]=function(_0x37a4e2,_0x51bb66,_0x32d867){if(_0x37a4e2[_0x8148('0x48')]['id']){delete _0x37a4e2['body']['id'];}return db[_0x8148('0x2c')][_0x8148('0x46')]({'where':{'id':_0x37a4e2[_0x8148('0x43')]['id']}})['then'](handleEntityNotFound(_0x51bb66,null))[_0x8148('0x23')](function(_0x2dd1e6){if(_0x2dd1e6){_0x37a4e2[_0x8148('0x48')][_0x8148('0x53')]=_0x2dd1e6['id'];return db['Condition'][_0x8148('0x47')](_0x37a4e2['body']);}})[_0x8148('0x23')](respondWithResult(_0x51bb66,null))[_0x8148('0x4e')](handleError(_0x51bb66,null));};exports[_0x8148('0x54')]=function(_0x53bb08,_0x3f2295,_0x27a670){var _0x379431={};var _0x19ffe7={};var _0x164835;var _0x3c5c43;return db[_0x8148('0x2c')]['findOne']({'where':{'id':_0x53bb08[_0x8148('0x43')]['id']}})[_0x8148('0x23')](handleEntityNotFound(_0x3f2295,null))[_0x8148('0x23')](function(_0x2bb973){if(_0x2bb973){_0x164835=_0x2bb973;_0x19ffe7['model']=_[_0x8148('0x44')](db['Condition']['rawAttributes']);_0x19ffe7['query']=_[_0x8148('0x44')](_0x53bb08[_0x8148('0x32')]);_0x19ffe7['filters']=_[_0x8148('0x34')](_0x19ffe7[_0x8148('0x35')],_0x19ffe7[_0x8148('0x32')]);_0x379431[_0x8148('0x36')]=_[_0x8148('0x34')](_0x19ffe7['model'],qs[_0x8148('0x37')](_0x53bb08[_0x8148('0x32')][_0x8148('0x37')]));_0x379431[_0x8148('0x36')]=_0x379431['attributes']['length']?_0x379431['attributes']:_0x19ffe7['model'];_0x379431['order']=qs['sort'](_0x53bb08[_0x8148('0x32')][_0x8148('0x55')]);_0x379431[_0x8148('0x3b')]=qs['filters'](_['pick'](_0x53bb08['query'],_0x19ffe7['filters']));if(_0x53bb08['query'][_0x8148('0x3c')]){_0x379431['where']=_[_0x8148('0x3d')](_0x379431['where'],{'$or':_[_0x8148('0x2b')](_0x379431[_0x8148('0x36')],function(_0x4fb755){var _0x34fb6d={};_0x34fb6d[_0x4fb755]={'$like':'%'+_0x53bb08[_0x8148('0x32')][_0x8148('0x3c')]+'%'};return _0x34fb6d;})});}_0x379431=_[_0x8148('0x3d')]({},_0x379431,_0x53bb08[_0x8148('0x3e')]);return _0x164835[_0x8148('0x54')](_0x379431);}})['then'](function(_0x250582){if(_0x250582){_0x3c5c43=_0x250582[_0x8148('0x38')];if(!_0x53bb08[_0x8148('0x32')][_0x8148('0x39')](_0x8148('0x56'))){_0x379431[_0x8148('0x1e')]=qs[_0x8148('0x1e')](_0x53bb08[_0x8148('0x32')][_0x8148('0x1e')]);_0x379431[_0x8148('0x1c')]=qs[_0x8148('0x1c')](_0x53bb08[_0x8148('0x32')][_0x8148('0x1c')]);}return _0x164835[_0x8148('0x54')](_0x379431);}})[_0x8148('0x23')](function(_0x7d8309){if(_0x7d8309){return _0x7d8309?{'count':_0x3c5c43,'rows':_0x7d8309}:null;}})[_0x8148('0x23')](respondWithResult(_0x3f2295,null))['catch'](handleError(_0x3f2295,null));};exports[_0x8148('0x57')]=function(_0xf9da45,_0x1ee8fb,_0x512bb5){var _0x344ebc={};var _0x1fffd5={};var _0x5f3be8;var _0x401b33;return db[_0x8148('0x2c')][_0x8148('0x58')]({'where':{'id':_0xf9da45[_0x8148('0x43')]['id']}})[_0x8148('0x23')](handleEntityNotFound(_0x1ee8fb,null))['then'](function(_0xa770e9){if(_0xa770e9){_0x5f3be8=_0xa770e9;_0x1fffd5[_0x8148('0x35')]=_[_0x8148('0x44')](db[_0x8148('0x59')]['rawAttributes']);_0x1fffd5[_0x8148('0x32')]=_[_0x8148('0x44')](_0xf9da45[_0x8148('0x32')]);_0x1fffd5['filters']=_[_0x8148('0x34')](_0x1fffd5[_0x8148('0x35')],_0x1fffd5[_0x8148('0x32')]);_0x344ebc[_0x8148('0x36')]=_['intersection'](_0x1fffd5[_0x8148('0x35')],qs['fields'](_0xf9da45[_0x8148('0x32')]['fields']));_0x344ebc['attributes']=_0x344ebc[_0x8148('0x36')][_0x8148('0x38')]?_0x344ebc[_0x8148('0x36')]:_0x1fffd5[_0x8148('0x35')];_0x344ebc[_0x8148('0x3a')]=qs[_0x8148('0x55')](_0xf9da45[_0x8148('0x32')]['sort']);_0x344ebc[_0x8148('0x3b')]=qs[_0x8148('0x33')](_['pick'](_0xf9da45[_0x8148('0x32')],_0x1fffd5['filters']));if(_0xf9da45[_0x8148('0x32')]['filter']){_0x344ebc[_0x8148('0x3b')]=_[_0x8148('0x3d')](_0x344ebc[_0x8148('0x3b')],{'$or':_[_0x8148('0x2b')](_0x344ebc[_0x8148('0x36')],function(_0x54e5c5){var _0x30af8a={};_0x30af8a[_0x54e5c5]={'$like':'%'+_0xf9da45['query']['filter']+'%'};return _0x30af8a;})});}_0x344ebc=_[_0x8148('0x3d')]({},_0x344ebc,_0xf9da45['options']);return _0x5f3be8[_0x8148('0x57')](_0x344ebc);}})['then'](function(_0x48398a){if(_0x48398a){_0x401b33=_0x48398a[_0x8148('0x38')];if(!_0xf9da45[_0x8148('0x32')][_0x8148('0x39')](_0x8148('0x56'))){_0x344ebc['limit']=qs[_0x8148('0x1e')](_0xf9da45['query']['limit']);_0x344ebc[_0x8148('0x1c')]=qs['offset'](_0xf9da45['query'][_0x8148('0x1c')]);}return _0x5f3be8[_0x8148('0x57')](_0x344ebc);}})[_0x8148('0x23')](function(_0x190589){if(_0x190589){return _0x190589?{'count':_0x401b33,'rows':_0x190589}:null;}})[_0x8148('0x23')](respondWithResult(_0x1ee8fb,null))[_0x8148('0x4e')](handleError(_0x1ee8fb,null));};exports[_0x8148('0x5a')]=function(_0x307ec5,_0x1f94c1,_0x3b3604){if(_0x307ec5['body']['id']){delete _0x307ec5[_0x8148('0x48')]['id'];}return db['Trigger'][_0x8148('0x46')]({'where':{'id':_0x307ec5[_0x8148('0x43')]['id']}})[_0x8148('0x23')](handleEntityNotFound(_0x1f94c1,null))[_0x8148('0x23')](function(_0x207aa1){if(_0x207aa1){_0x307ec5[_0x8148('0x48')]['TriggerId']=_0x207aa1['id'];return db[_0x8148('0x5b')][_0x8148('0x47')](_0x307ec5[_0x8148('0x48')]);}})[_0x8148('0x23')](respondWithResult(_0x1f94c1,null))[_0x8148('0x4e')](handleError(_0x1f94c1,null));};exports[_0x8148('0x5c')]=function(_0x40860c,_0x55a8c1,_0x3bd9ae){var _0x5935e8={};var _0x5d26b3={};var _0x3695b3;var _0x5b7d0d;return db[_0x8148('0x2c')][_0x8148('0x58')]({'where':{'id':_0x40860c[_0x8148('0x43')]['id']}})['then'](handleEntityNotFound(_0x55a8c1,null))[_0x8148('0x23')](function(_0x5966d7){if(_0x5966d7){_0x3695b3=_0x5966d7;_0x5d26b3[_0x8148('0x35')]=_[_0x8148('0x44')](db[_0x8148('0x5b')][_0x8148('0x2d')]);_0x5d26b3[_0x8148('0x32')]=_['keys'](_0x40860c[_0x8148('0x32')]);_0x5d26b3['filters']=_['intersection'](_0x5d26b3['model'],_0x5d26b3[_0x8148('0x32')]);_0x5935e8[_0x8148('0x36')]=_[_0x8148('0x34')](_0x5d26b3[_0x8148('0x35')],qs[_0x8148('0x37')](_0x40860c[_0x8148('0x32')][_0x8148('0x37')]));_0x5935e8[_0x8148('0x36')]=_0x5935e8[_0x8148('0x36')][_0x8148('0x38')]?_0x5935e8[_0x8148('0x36')]:_0x5d26b3['model'];_0x5935e8[_0x8148('0x3a')]=qs['sort'](_0x40860c['query'][_0x8148('0x55')]);_0x5935e8[_0x8148('0x3b')]=qs[_0x8148('0x33')](_[_0x8148('0x5d')](_0x40860c['query'],_0x5d26b3[_0x8148('0x33')]));if(_0x40860c['query'][_0x8148('0x3c')]){_0x5935e8[_0x8148('0x3b')]=_[_0x8148('0x3d')](_0x5935e8[_0x8148('0x3b')],{'$or':_[_0x8148('0x2b')](_0x5935e8[_0x8148('0x36')],function(_0x34b604){var _0x64167={};_0x64167[_0x34b604]={'$like':'%'+_0x40860c[_0x8148('0x32')][_0x8148('0x3c')]+'%'};return _0x64167;})});}_0x5935e8=_[_0x8148('0x3d')]({},_0x5935e8,_0x40860c['options']);return _0x3695b3[_0x8148('0x5c')](_0x5935e8);}})[_0x8148('0x23')](function(_0x406d25){if(_0x406d25){_0x5b7d0d=_0x406d25[_0x8148('0x38')];if(!_0x40860c[_0x8148('0x32')][_0x8148('0x39')](_0x8148('0x56'))){_0x5935e8[_0x8148('0x1e')]=qs[_0x8148('0x1e')](_0x40860c['query']['limit']);_0x5935e8[_0x8148('0x1c')]=qs['offset'](_0x40860c['query'][_0x8148('0x1c')]);}return _0x3695b3[_0x8148('0x5c')](_0x5935e8);}})[_0x8148('0x23')](function(_0x5976f){if(_0x5976f){return _0x5976f?{'count':_0x5b7d0d,'rows':_0x5976f}:null;}})[_0x8148('0x23')](respondWithResult(_0x55a8c1,null))[_0x8148('0x4e')](handleError(_0x55a8c1,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 41c3e27..aa8a870 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 _0xe647=['./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x20ea22,_0x13abbf){var _0x10c222=function(_0x139b73){while(--_0x139b73){_0x20ea22['push'](_0x20ea22['shift']());}};_0x10c222(++_0x13abbf);}(_0xe647,0x16d));var _0x7e64=function(_0x191908,_0x299367){_0x191908=_0x191908-0x0;var _0x21e665=_0xe647[_0x191908];return _0x21e665;};'use strict';var _=require(_0x7e64('0x0'));var util=require(_0x7e64('0x1'));var logger=require('../../config/logger')(_0x7e64('0x2'));var moment=require(_0x7e64('0x3'));var BPromise=require(_0x7e64('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e64('0x5'));var config=require(_0x7e64('0x6'));var attributes=require(_0x7e64('0x7'));module[_0x7e64('0x8')]=function(_0x221235,_0x552ed3){return _0x221235[_0x7e64('0x9')](_0x7e64('0xa'),attributes,{'tableName':_0x7e64('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8743=['define','tools_triggers','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./trigger.attributes'];(function(_0x4d4337,_0x48cd36){var _0x5a4140=function(_0x502651){while(--_0x502651){_0x4d4337['push'](_0x4d4337['shift']());}};_0x5a4140(++_0x48cd36);}(_0x8743,0x7a));var _0x3874=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x8743[_0x411add];return _0x238242;};'use strict';var _=require(_0x3874('0x0'));var util=require(_0x3874('0x1'));var logger=require(_0x3874('0x2'))('api');var moment=require(_0x3874('0x3'));var BPromise=require(_0x3874('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3874('0x5'));var config=require(_0x3874('0x6'));var attributes=require(_0x3874('0x7'));module['exports']=function(_0x597a79,_0x4b242a){return _0x597a79[_0x3874('0x8')]('Trigger',attributes,{'tableName':_0x3874('0x9'),'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 c4fcc0e..ab462fc 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 _0xc9ea=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','map','include','attributes','model','ShowTrigger','find','lodash','moment'];(function(_0x8ca2c1,_0x42fe5d){var _0x51927e=function(_0x172b91){while(--_0x172b91){_0x8ca2c1['push'](_0x8ca2c1['shift']());}};_0x51927e(++_0x42fe5d);}(_0xc9ea,0x1d2));var _0xac9e=function(_0x1cfdbc,_0x5a8087){_0x1cfdbc=_0x1cfdbc-0x0;var _0x2acd2f=_0xc9ea[_0x1cfdbc];return _0x2acd2f;};'use strict';var _=require(_0xac9e('0x0'));var util=require('util');var moment=require(_0xac9e('0x1'));var BPromise=require(_0xac9e('0x2'));var rs=require(_0xac9e('0x3'));var fs=require('fs');var Redis=require(_0xac9e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xac9e('0x5'));var logger=require('../../config/logger')(_0xac9e('0x6'));var config=require(_0xac9e('0x7'));var jayson=require(_0xac9e('0x8'));var client=jayson[_0xac9e('0x9')][_0xac9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27ed91,_0x492918,_0x5cfb1c){return new BPromise(function(_0x149295,_0x43cead){return client[_0xac9e('0xb')](_0x27ed91,_0x5cfb1c)[_0xac9e('0xc')](function(_0x439ff1){logger[_0xac9e('0xd')](_0xac9e('0xe'),_0x492918,_0xac9e('0xf'));logger[_0xac9e('0x10')](_0xac9e('0x11'),_0x492918,_0xac9e('0xf'),JSON[_0xac9e('0x12')](_0x439ff1));if(_0x439ff1[_0xac9e('0x13')]){if(_0x439ff1[_0xac9e('0x13')][_0xac9e('0x14')]===0x1f4){logger[_0xac9e('0x13')](_0xac9e('0xe'),_0x492918,_0x439ff1['error']['message']);return _0x43cead(_0x439ff1[_0xac9e('0x13')]['message']);}logger[_0xac9e('0x13')](_0xac9e('0xe'),_0x492918,_0x439ff1[_0xac9e('0x13')][_0xac9e('0x15')]);return _0x149295(_0x439ff1[_0xac9e('0x13')][_0xac9e('0x15')]);}else{logger['info'](_0xac9e('0xe'),_0x492918,_0xac9e('0xf'));_0x149295(_0x439ff1[_0xac9e('0x16')][_0xac9e('0x15')]);}})[_0xac9e('0x17')](function(_0x52bf74){logger[_0xac9e('0x13')](_0xac9e('0xe'),_0x492918,_0x52bf74);_0x43cead(_0x52bf74);});});}exports[_0xac9e('0x18')]=function(_0x37d463){var _0x158f6e=this;return new Promise(function(_0x2c4db0,_0x1e8a31){return db[_0xac9e('0x19')][_0xac9e('0x1a')]({'raw':_0x37d463[_0xac9e('0x1b')]?_0x37d463[_0xac9e('0x1b')][_0xac9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x37d463['options']?_0x37d463[_0xac9e('0x1b')][_0xac9e('0x1d')]||null:null,'attributes':_0x37d463[_0xac9e('0x1b')]?_0x37d463[_0xac9e('0x1b')]['attributes']||null:null,'limit':_0x37d463[_0xac9e('0x1b')]?_0x37d463[_0xac9e('0x1b')]['limit']||null:null,'include':_0x37d463[_0xac9e('0x1b')]?_0x37d463[_0xac9e('0x1b')]['include']?_[_0xac9e('0x1e')](_0x37d463['options'][_0xac9e('0x1f')],function(_0x49fce1){return{'model':db[_0x49fce1['model']],'as':_0x49fce1['as'],'attributes':_0x49fce1[_0xac9e('0x20')],'include':_0x49fce1['include']?_[_0xac9e('0x1e')](_0x49fce1['include'],function(_0x3a8791){return{'model':db[_0x3a8791[_0xac9e('0x21')]],'as':_0x3a8791['as'],'attributes':_0x3a8791[_0xac9e('0x20')],'include':_0x3a8791['include']?_[_0xac9e('0x1e')](_0x3a8791['include'],function(_0x1be5a3){return{'model':db[_0x1be5a3['model']],'as':_0x1be5a3['as'],'attributes':_0x1be5a3[_0xac9e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xac9e('0xc')](function(_0xce163a){logger[_0xac9e('0xd')]('GetTrigger',_0x37d463);logger[_0xac9e('0x10')]('GetTrigger',_0x37d463,JSON[_0xac9e('0x12')](_0xce163a));_0x2c4db0(_0xce163a);})[_0xac9e('0x17')](function(_0x1c3cd0){logger[_0xac9e('0x13')](_0xac9e('0x18'),_0x1c3cd0[_0xac9e('0x15')],_0x37d463);_0x1e8a31(_0x158f6e['error'](0x1f4,_0x1c3cd0['message']));});});};exports[_0xac9e('0x22')]=function(_0x54e5ea){var _0x4c409a=this;return new Promise(function(_0x48a1a8,_0x284b07){return db[_0xac9e('0x19')][_0xac9e('0x23')]({'raw':_0x54e5ea[_0xac9e('0x1b')]?_0x54e5ea[_0xac9e('0x1b')][_0xac9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x54e5ea[_0xac9e('0x1b')]?_0x54e5ea[_0xac9e('0x1b')][_0xac9e('0x1d')]||null:null,'attributes':_0x54e5ea[_0xac9e('0x1b')]?_0x54e5ea['options'][_0xac9e('0x20')]||null:null,'include':_0x54e5ea[_0xac9e('0x1b')]?_0x54e5ea['options']['include']?_[_0xac9e('0x1e')](_0x54e5ea[_0xac9e('0x1b')][_0xac9e('0x1f')],function(_0x2daca3){return{'model':db[_0x2daca3[_0xac9e('0x21')]],'as':_0x2daca3['as'],'attributes':_0x2daca3[_0xac9e('0x20')],'include':_0x2daca3['include']?_['map'](_0x2daca3[_0xac9e('0x1f')],function(_0xb4f99d){return{'model':db[_0xb4f99d[_0xac9e('0x21')]],'as':_0xb4f99d['as'],'attributes':_0xb4f99d[_0xac9e('0x20')],'include':_0xb4f99d[_0xac9e('0x1f')]?_[_0xac9e('0x1e')](_0xb4f99d['include'],function(_0x23d67b){return{'model':db[_0x23d67b[_0xac9e('0x21')]],'as':_0x23d67b['as'],'attributes':_0x23d67b[_0xac9e('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32f344){logger[_0xac9e('0xd')]('ShowTrigger',_0x54e5ea);logger[_0xac9e('0x10')](_0xac9e('0x22'),_0x54e5ea,JSON[_0xac9e('0x12')](_0x32f344));_0x48a1a8(_0x32f344);})[_0xac9e('0x17')](function(_0x2d48a3){logger[_0xac9e('0x13')](_0xac9e('0x22'),_0x2d48a3['message'],_0x54e5ea);_0x284b07(_0x4c409a[_0xac9e('0x13')](0x1f4,_0x2d48a3[_0xac9e('0x15')]));});});}; \ No newline at end of file +var _0xbaf4=['jayson/promise','client','request','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTrigger','findAll','raw','options','where','attributes','include','map','model','then','ShowTrigger','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5ed5e3,_0x38d625){var _0x22bdb9=function(_0x542e42){while(--_0x542e42){_0x5ed5e3['push'](_0x5ed5e3['shift']());}};_0x22bdb9(++_0x38d625);}(_0xbaf4,0xa6));var _0x4baf=function(_0x440d90,_0xa73e90){_0x440d90=_0x440d90-0x0;var _0x446b92=_0xbaf4[_0x440d90];return _0x446b92;};'use strict';var _=require('lodash');var util=require(_0x4baf('0x0'));var moment=require(_0x4baf('0x1'));var BPromise=require(_0x4baf('0x2'));var rs=require(_0x4baf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4baf('0x4'))['db'];var utils=require(_0x4baf('0x5'));var logger=require(_0x4baf('0x6'))(_0x4baf('0x7'));var config=require(_0x4baf('0x8'));var jayson=require(_0x4baf('0x9'));var client=jayson[_0x4baf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4df751,_0x1a796a,_0x55daef){return new BPromise(function(_0x2cd2c4,_0xc5c3aa){return client[_0x4baf('0xb')](_0x4df751,_0x55daef)['then'](function(_0x3893bb){logger['info'](_0x4baf('0xc'),_0x1a796a,_0x4baf('0xd'));logger[_0x4baf('0xe')](_0x4baf('0xf'),_0x1a796a,'request\x20sent',JSON[_0x4baf('0x10')](_0x3893bb));if(_0x3893bb[_0x4baf('0x11')]){if(_0x3893bb[_0x4baf('0x11')][_0x4baf('0x12')]===0x1f4){logger[_0x4baf('0x11')]('Trigger,\x20%s,\x20%s',_0x1a796a,_0x3893bb[_0x4baf('0x11')]['message']);return _0xc5c3aa(_0x3893bb[_0x4baf('0x11')][_0x4baf('0x13')]);}logger['error'](_0x4baf('0xc'),_0x1a796a,_0x3893bb[_0x4baf('0x11')]['message']);return _0x2cd2c4(_0x3893bb['error'][_0x4baf('0x13')]);}else{logger[_0x4baf('0x14')](_0x4baf('0xc'),_0x1a796a,_0x4baf('0xd'));_0x2cd2c4(_0x3893bb[_0x4baf('0x15')]['message']);}})[_0x4baf('0x16')](function(_0x3c5b1d){logger[_0x4baf('0x11')](_0x4baf('0xc'),_0x1a796a,_0x3c5b1d);_0xc5c3aa(_0x3c5b1d);});});}exports[_0x4baf('0x17')]=function(_0x44889c){var _0x2b3ff1=this;return new Promise(function(_0x228d0a,_0x472952){return db['Trigger'][_0x4baf('0x18')]({'raw':_0x44889c['options']?_0x44889c['options'][_0x4baf('0x19')]===undefined?!![]:![]:!![],'where':_0x44889c['options']?_0x44889c[_0x4baf('0x1a')][_0x4baf('0x1b')]||null:null,'attributes':_0x44889c[_0x4baf('0x1a')]?_0x44889c[_0x4baf('0x1a')][_0x4baf('0x1c')]||null:null,'limit':_0x44889c[_0x4baf('0x1a')]?_0x44889c[_0x4baf('0x1a')]['limit']||null:null,'include':_0x44889c['options']?_0x44889c[_0x4baf('0x1a')][_0x4baf('0x1d')]?_[_0x4baf('0x1e')](_0x44889c[_0x4baf('0x1a')][_0x4baf('0x1d')],function(_0x52b5a0){return{'model':db[_0x52b5a0['model']],'as':_0x52b5a0['as'],'attributes':_0x52b5a0[_0x4baf('0x1c')],'include':_0x52b5a0['include']?_[_0x4baf('0x1e')](_0x52b5a0[_0x4baf('0x1d')],function(_0x1e80a6){return{'model':db[_0x1e80a6[_0x4baf('0x1f')]],'as':_0x1e80a6['as'],'attributes':_0x1e80a6[_0x4baf('0x1c')],'include':_0x1e80a6[_0x4baf('0x1d')]?_[_0x4baf('0x1e')](_0x1e80a6[_0x4baf('0x1d')],function(_0x1134e9){return{'model':db[_0x1134e9[_0x4baf('0x1f')]],'as':_0x1134e9['as'],'attributes':_0x1134e9[_0x4baf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4baf('0x20')](function(_0x8f81f8){logger[_0x4baf('0x14')](_0x4baf('0x17'),_0x44889c);logger[_0x4baf('0xe')](_0x4baf('0x17'),_0x44889c,JSON[_0x4baf('0x10')](_0x8f81f8));_0x228d0a(_0x8f81f8);})[_0x4baf('0x16')](function(_0x552f7d){logger[_0x4baf('0x11')]('GetTrigger',_0x552f7d[_0x4baf('0x13')],_0x44889c);_0x472952(_0x2b3ff1['error'](0x1f4,_0x552f7d[_0x4baf('0x13')]));});});};exports[_0x4baf('0x21')]=function(_0x19d725){var _0x380076=this;return new Promise(function(_0x20e934,_0x1eb487){return db['Trigger'][_0x4baf('0x22')]({'raw':_0x19d725['options']?_0x19d725[_0x4baf('0x1a')][_0x4baf('0x19')]===undefined?!![]:![]:!![],'where':_0x19d725[_0x4baf('0x1a')]?_0x19d725[_0x4baf('0x1a')][_0x4baf('0x1b')]||null:null,'attributes':_0x19d725[_0x4baf('0x1a')]?_0x19d725[_0x4baf('0x1a')]['attributes']||null:null,'include':_0x19d725[_0x4baf('0x1a')]?_0x19d725[_0x4baf('0x1a')][_0x4baf('0x1d')]?_[_0x4baf('0x1e')](_0x19d725['options'][_0x4baf('0x1d')],function(_0x21a95a){return{'model':db[_0x21a95a[_0x4baf('0x1f')]],'as':_0x21a95a['as'],'attributes':_0x21a95a[_0x4baf('0x1c')],'include':_0x21a95a['include']?_['map'](_0x21a95a[_0x4baf('0x1d')],function(_0x4b469b){return{'model':db[_0x4b469b[_0x4baf('0x1f')]],'as':_0x4b469b['as'],'attributes':_0x4b469b[_0x4baf('0x1c')],'include':_0x4b469b[_0x4baf('0x1d')]?_['map'](_0x4b469b[_0x4baf('0x1d')],function(_0x11e1f9){return{'model':db[_0x11e1f9[_0x4baf('0x1f')]],'as':_0x11e1f9['as'],'attributes':_0x11e1f9['attributes']};}):[]};}):[]};}):[]:[]})[_0x4baf('0x20')](function(_0x25db74){logger[_0x4baf('0x14')](_0x4baf('0x21'),_0x19d725);logger[_0x4baf('0xe')](_0x4baf('0x21'),_0x19d725,JSON[_0x4baf('0x10')](_0x25db74));_0x20e934(_0x25db74);})[_0x4baf('0x16')](function(_0x21719e){logger[_0x4baf('0x11')](_0x4baf('0x21'),_0x21719e[_0x4baf('0x13')],_0x19d725);_0x1eb487(_0x380076[_0x4baf('0x11')](0x1f4,_0x21719e['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index ee970a5..39c5cae 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 _0x32f9=['./trunk.controller','get','isAuthenticated','index','/:id','post','/:id/clone','clone','create','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0x32f9,0x187));var _0x932f=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x32f9[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require(_0x932f('0x0'));var util=require(_0x932f('0x1'));var path=require(_0x932f('0x2'));var timeout=require(_0x932f('0x3'));var express=require(_0x932f('0x4'));var router=express[_0x932f('0x5')]();var fs_extra=require(_0x932f('0x6'));var auth=require(_0x932f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x932f('0x8'));var controller=require(_0x932f('0x9'));router[_0x932f('0xa')]('/',auth[_0x932f('0xb')](),controller[_0x932f('0xc')]);router[_0x932f('0xa')](_0x932f('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x932f('0xe')](_0x932f('0xf'),auth[_0x932f('0xb')](),controller[_0x932f('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x932f('0x11')]);router[_0x932f('0x12')](_0x932f('0xd'),auth[_0x932f('0xb')](),controller['update']);router['delete'](_0x932f('0xd'),auth['isAuthenticated'](),controller[_0x932f('0x13')]);module['exports']=router; \ No newline at end of file +var _0x521f=['express','../../components/auth/service','./trunk.controller','index','get','/:id','isAuthenticated','/:id/clone','clone','post','create','put','delete','destroy','multer','connect-timeout'];(function(_0x10a0d0,_0x37a35a){var _0x2fab51=function(_0x5a2b2e){while(--_0x5a2b2e){_0x10a0d0['push'](_0x10a0d0['shift']());}};_0x2fab51(++_0x37a35a);}(_0x521f,0xfe));var _0xf521=function(_0x507c29,_0x482b32){_0x507c29=_0x507c29-0x0;var _0x467d7f=_0x521f[_0x507c29];return _0x467d7f;};'use strict';var multer=require(_0xf521('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf521('0x1'));var express=require(_0xf521('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf521('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf521('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xf521('0x5')]);router[_0xf521('0x6')](_0xf521('0x7'),auth[_0xf521('0x8')](),controller['show']);router['post'](_0xf521('0x9'),auth[_0xf521('0x8')](),controller[_0xf521('0xa')]);router[_0xf521('0xb')]('/',auth['isAuthenticated'](),controller[_0xf521('0xc')]);router[_0xf521('0xd')](_0xf521('0x7'),auth[_0xf521('0x8')](),controller['update']);router[_0xf521('0xe')](_0xf521('0x7'),auth[_0xf521('0x8')](),controller[_0xf521('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 2bd93f7..d598bb4 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 _0x5727=['STRING','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','rfc2833','info','inband','auto','yes','nonat','update','outgoing','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','BOOLEAN','sequelize','exports','friend','user'];(function(_0x1a1c4a,_0x505791){var _0x517f22=function(_0x274f69){while(--_0x274f69){_0x1a1c4a['push'](_0x1a1c4a['shift']());}};_0x517f22(++_0x505791);}(_0x5727,0x1c8));var _0x7572=function(_0x2cb03c,_0x37fefa){_0x2cb03c=_0x2cb03c-0x0;var _0x3deec4=_0x5727[_0x2cb03c];return _0x3deec4;};'use strict';var Sequelize=require(_0x7572('0x0'));module[_0x7572('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x7572('0x2'),_0x7572('0x3'),'peer'),'allowNull':![],'defaultValue':_0x7572('0x2')},'context':{'type':Sequelize[_0x7572('0x4')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x7572('0x5')](_0x7572('0x6'),_0x7572('0x7'),_0x7572('0x8'),_0x7572('0x9'),'PROHIB_NOT_SCREENED',_0x7572('0xa'),'PROHIB_FAILED_SCREEN',_0x7572('0xb'))},'deny':{'type':Sequelize[_0x7572('0x4')]},'permit':{'type':Sequelize[_0x7572('0x4')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x7572('0x4')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x7572('0x4')],'defaultValue':'udp','set':function(_0x4eb467){this[_0x7572('0xc')](_0x7572('0xd'),_0x4eb467?_0x4eb467[_0x7572('0xe')](','):null);},'get':function(){return this[_0x7572('0xf')](_0x7572('0xd'))?this[_0x7572('0xf')](_0x7572('0xd'))[_0x7572('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x7572('0x5')](_0x7572('0x11'),_0x7572('0x12'),'shortinfo',_0x7572('0x13'),_0x7572('0x14')),'defaultValue':_0x7572('0x11')},'directmedia':{'type':Sequelize[_0x7572('0x5')](_0x7572('0x15'),'no',_0x7572('0x16'),_0x7572('0x17'),_0x7572('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7572('0x5')](_0x7572('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7572('0x4')]},'directmediadeny':{'type':Sequelize[_0x7572('0x4')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x375c5f){this['setDataValue']('nat',_0x375c5f?_0x375c5f[_0x7572('0xe')](','):null);},'get':function(){return this[_0x7572('0xf')]('nat')?this[_0x7572('0xf')]('nat')[_0x7572('0x10')](','):null;},'comment':_0x7572('0x19')},'callgroup':{'type':Sequelize[_0x7572('0x4')]},'namedcallgroup':{'type':Sequelize[_0x7572('0x4')]},'pickupgroup':{'type':Sequelize[_0x7572('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x7572('0x4')]},'language':{'type':Sequelize[_0x7572('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7572('0x4')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7572('0x4')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x7572('0x4')],'allowNull':![],'defaultValue':_0x7572('0x1a'),'set':function(_0xd691e6){this['setDataValue'](_0x7572('0x1b'),_0xd691e6?_0xd691e6[_0x7572('0xe')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x7572('0x1b'))?this[_0x7572('0xf')]('allow')['split'](';'):null;},'comment':_0x7572('0x1c')},'autoframing':{'type':Sequelize['ENUM'](_0x7572('0x15'),'no')},'insecure':{'type':Sequelize[_0x7572('0x4')],'defaultValue':_0x7572('0x1d'),'set':function(_0x5ce9f0){this['setDataValue'](_0x7572('0x1e'),_0x5ce9f0?_0x5ce9f0[_0x7572('0xe')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x7572('0xf')]('insecure')[_0x7572('0x10')](','):null;},'comment':_0x7572('0x1f')},'trustrpid':{'type':Sequelize['ENUM'](_0x7572('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7572('0x5')](_0x7572('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7572('0x5')](_0x7572('0x15'),'no',_0x7572('0x20'))},'promiscredir':{'type':Sequelize[_0x7572('0x5')]('yes','no')},'useclientcode':{'type':Sequelize[_0x7572('0x5')]('yes','no')},'accountcode':{'type':Sequelize[_0x7572('0x21')](0xb)},'setvar':{'type':Sequelize[_0x7572('0x4')]},'callerid':{'type':Sequelize[_0x7572('0x4')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x7572('0x4')]},'callcounter':{'type':Sequelize[_0x7572('0x5')]('yes','no'),'defaultValue':_0x7572('0x15')},'busylevel':{'type':Sequelize[_0x7572('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x7572('0x5')](_0x7572('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0x7572('0x5')](_0x7572('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x7572('0x5')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x7572('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0x7572('0x4')]},'template':{'type':Sequelize[_0x7572('0x4')]},'videosupport':{'type':Sequelize[_0x7572('0x5')](_0x7572('0x15'),'no',_0x7572('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7572('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x7572('0x15'),'no')},'mailbox':{'type':Sequelize[_0x7572('0x4')]},'session_timers':{'type':Sequelize[_0x7572('0x5')](_0x7572('0x23'),_0x7572('0x24'),_0x7572('0x25'))},'session_expires':{'type':Sequelize[_0x7572('0x21')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x7572('0x26'),_0x7572('0x27')),'defaultValue':_0x7572('0x27')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x7572('0x4')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x7572('0x4')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x7572('0x5')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x7572('0x21')](0xb)},'defaultip':{'type':Sequelize[_0x7572('0x4')]},'defaultuser':{'type':Sequelize[_0x7572('0x4')]},'rtptimeout':{'type':Sequelize[_0x7572('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7572('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7572('0x21')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x7572('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7572('0x4')]},'callbackextension':{'type':Sequelize[_0x7572('0x4')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x7572('0x4')]},'contactdeny':{'type':Sequelize[_0x7572('0x4')]},'contactacl':{'type':Sequelize[_0x7572('0x4')]},'unsolicited_mailbox':{'type':Sequelize[_0x7572('0x4')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x7572('0x21')](0xb)},'encryption':{'type':Sequelize[_0x7572('0x5')](_0x7572('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x7572('0x15'),'no')},'force_avp':{'type':Sequelize[_0x7572('0x5')]('yes','no')},'icesupport':{'type':Sequelize[_0x7572('0x5')](_0x7572('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0x7572('0x5')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x7572('0x5')](_0x7572('0x15'),'no',_0x7572('0x29'),_0x7572('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x7572('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0x7572('0x4')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x7572('0x4')]},'dtlscapath':{'type':Sequelize[_0x7572('0x4')]},'dtlssetup':{'type':Sequelize[_0x7572('0x5')]('active',_0x7572('0x2b'),_0x7572('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7572('0x4')]},'usereqphone':{'type':Sequelize[_0x7572('0x5')](_0x7572('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7572('0x4')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x7572('0x15'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x7572('0x15'),'no')},'vmexten':{'type':Sequelize[_0x7572('0x4')]},'mohinterpret':{'type':Sequelize[_0x7572('0x4')]},'mohsuggest':{'type':Sequelize[_0x7572('0x4')]},'parkinglot':{'type':Sequelize[_0x7572('0x4')]},'description':{'type':Sequelize[_0x7572('0x4')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x7572('0x5')]('yes','no',_0x7572('0x16'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7572('0x4')]},'otherFields':{'type':Sequelize[_0x7572('0x4')]},'active':{'type':Sequelize[_0x7572('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7572('0x4')],'defaultValue':'no'}}; \ No newline at end of file +var _0x27af=['friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','originate','uac','uas','pai','fingerprint','active','actpass','dynamic','BOOLEAN','sequelize','STRING','name','ENUM'];(function(_0x31b254,_0x1d7a88){var _0xa56b18=function(_0x41e3d7){while(--_0x41e3d7){_0x31b254['push'](_0x31b254['shift']());}};_0xa56b18(++_0x1d7a88);}(_0x27af,0x128));var _0xf27a=function(_0xe120f6,_0x3e32ab){_0xe120f6=_0xe120f6-0x0;var _0x39ae22=_0x27af[_0xe120f6];return _0x39ae22;};'use strict';var Sequelize=require(_0xf27a('0x0'));module['exports']={'name':{'type':Sequelize[_0xf27a('0x1')],'allowNull':![],'unique':_0xf27a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x4'),_0xf27a('0x5'),_0xf27a('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xf27a('0x1')],'allowNull':![],'defaultValue':_0xf27a('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0xf27a('0x8'),_0xf27a('0x9'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0xf27a('0xa'),_0xf27a('0xb'),_0xf27a('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xf27a('0x1')]},'secret':{'type':Sequelize[_0xf27a('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xf27a('0x1')]},'transport':{'type':Sequelize[_0xf27a('0x1')],'defaultValue':_0xf27a('0xd'),'set':function(_0x157807){this[_0xf27a('0xe')](_0xf27a('0xf'),_0x157807?_0x157807[_0xf27a('0x10')](','):null);},'get':function(){return this[_0xf27a('0x11')](_0xf27a('0xf'))?this[_0xf27a('0x11')](_0xf27a('0xf'))[_0xf27a('0x12')](','):null;},'comment':_0xf27a('0x13')},'dtmfmode':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x14'),_0xf27a('0x15'),_0xf27a('0x16'),_0xf27a('0x17'),_0xf27a('0x18')),'defaultValue':_0xf27a('0x14')},'directmedia':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x19'),'no',_0xf27a('0x1a'),'update',_0xf27a('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xf27a('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf27a('0x1')]},'directmediadeny':{'type':Sequelize[_0xf27a('0x1')]},'nat':{'type':Sequelize[_0xf27a('0x1')],'defaultValue':_0xf27a('0x1c'),'set':function(_0x312a0b){this['setDataValue'](_0xf27a('0x1d'),_0x312a0b?_0x312a0b[_0xf27a('0x10')](','):null);},'get':function(){return this[_0xf27a('0x11')](_0xf27a('0x1d'))?this['getDataValue'](_0xf27a('0x1d'))[_0xf27a('0x12')](','):null;},'comment':_0xf27a('0x1e')},'callgroup':{'type':Sequelize[_0xf27a('0x1')]},'namedcallgroup':{'type':Sequelize[_0xf27a('0x1')]},'pickupgroup':{'type':Sequelize[_0xf27a('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xf27a('0x1')]},'language':{'type':Sequelize[_0xf27a('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf27a('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf27a('0x1')],'defaultValue':_0xf27a('0x1f')},'allow':{'type':Sequelize[_0xf27a('0x1')],'allowNull':![],'defaultValue':_0xf27a('0x20'),'set':function(_0x4980ff){this[_0xf27a('0xe')](_0xf27a('0x21'),_0x4980ff?_0x4980ff[_0xf27a('0x10')](';'):_0xf27a('0x20'));},'get':function(){return this[_0xf27a('0x11')](_0xf27a('0x21'))?this[_0xf27a('0x11')](_0xf27a('0x21'))[_0xf27a('0x12')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x19'),'no')},'insecure':{'type':Sequelize[_0xf27a('0x1')],'defaultValue':_0xf27a('0x22'),'set':function(_0x45d1d1){this['setDataValue'](_0xf27a('0x23'),_0x45d1d1?_0x45d1d1['join'](','):null);},'get':function(){return this['getDataValue'](_0xf27a('0x23'))?this[_0xf27a('0x11')](_0xf27a('0x23'))[_0xf27a('0x12')](','):null;},'comment':_0xf27a('0x24')},'trustrpid':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x19'),'no',_0xf27a('0x25'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0xf27a('0x19'),'no')},'accountcode':{'type':Sequelize[_0xf27a('0x26')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf27a('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x19'),'no'),'defaultValue':_0xf27a('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x19'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xf27a('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xf27a('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xf27a('0x1')]},'template':{'type':Sequelize[_0xf27a('0x1')]},'videosupport':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x19'),'no',_0xf27a('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x19'),'no')},'mailbox':{'type':Sequelize[_0xf27a('0x1')]},'session_timers':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x28'),'refuse',_0xf27a('0x29'))},'session_expires':{'type':Sequelize[_0xf27a('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xf27a('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x2a'),_0xf27a('0x2b')),'defaultValue':_0xf27a('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xf27a('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xf27a('0x1')]},'fromuser':{'type':Sequelize[_0xf27a('0x1')]},'port':{'type':Sequelize[_0xf27a('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xf27a('0x19'),'no'),'defaultValue':_0xf27a('0x19')},'keepalive':{'type':Sequelize[_0xf27a('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xf27a('0x1')]},'rtptimeout':{'type':Sequelize[_0xf27a('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf27a('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf27a('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x19'),'no',_0xf27a('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xf27a('0x1')]},'timert1':{'type':Sequelize[_0xf27a('0x26')](0xb)},'timerb':{'type':Sequelize[_0xf27a('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf27a('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xf27a('0x1')]},'contactdeny':{'type':Sequelize[_0xf27a('0x1')]},'contactacl':{'type':Sequelize[_0xf27a('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xf27a('0x1')]},'maxforwards':{'type':Sequelize[_0xf27a('0x26')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xf27a('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x19'),'no')},'force_avp':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x19'),'no')},'icesupport':{'type':Sequelize[_0xf27a('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x19'),'no',_0xf27a('0x2d'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xf27a('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xf27a('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xf27a('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x2e'),'passive',_0xf27a('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf27a('0x1')]},'usereqphone':{'type':Sequelize[_0xf27a('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf27a('0x1')]},'recordofffeature':{'type':Sequelize[_0xf27a('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf27a('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xf27a('0x19'),'no')},'vmexten':{'type':Sequelize[_0xf27a('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xf27a('0x1')]},'parkinglot':{'type':Sequelize[_0xf27a('0x1')]},'description':{'type':Sequelize[_0xf27a('0x1')]},'host':{'type':Sequelize[_0xf27a('0x1')],'defaultValue':_0xf27a('0x30')},'canreinvite':{'type':Sequelize[_0xf27a('0x3')](_0xf27a('0x19'),'no',_0xf27a('0x1a'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf27a('0x1')]},'otherFields':{'type':Sequelize[_0xf27a('0x1')]},'active':{'type':Sequelize[_0xf27a('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 2fbab74..577edd7 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 _0x9bde=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','Trunk','includeAll','findAll','rows','show','params','fields','include','options','clone','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','root','server/files/templates/trunk.ejs','writeFileSync','rimraf'];(function(_0x5e7ee9,_0x4dbc4b){var _0xadb900=function(_0x5eecb3){while(--_0x5eecb3){_0x5e7ee9['push'](_0x5e7ee9['shift']());}};_0xadb900(++_0x4dbc4b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1d1a20,_0x335f6e){_0x1d1a20=_0x1d1a20-0x0;var _0x50370a=_0x9bde[_0x1d1a20];return _0x50370a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file +var _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x57e9d2,_0x717c){var _0x1de8af=function(_0x58ac1d){while(--_0x58ac1d){_0x57e9d2['push'](_0x57e9d2['shift']());}};_0x1de8af(++_0x717c);}(_0xe14d,0x1ee));var _0xde14=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xe14d[_0x455c6c];return _0x488242;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 02c5a5f..ee51c67 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 _0x543c=['bluebird','request-promise','path','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment'];(function(_0x2e69e4,_0x33c9eb){var _0x4b19e2=function(_0x542eb8){while(--_0x542eb8){_0x2e69e4['push'](_0x2e69e4['shift']());}};_0x4b19e2(++_0x33c9eb);}(_0x543c,0x1c2));var _0xc543=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0x543c[_0x55a89e];return _0x3aa2bd;};'use strict';var _=require(_0xc543('0x0'));var util=require(_0xc543('0x1'));var logger=require(_0xc543('0x2'))(_0xc543('0x3'));var moment=require(_0xc543('0x4'));var BPromise=require(_0xc543('0x5'));var rp=require(_0xc543('0x6'));var fs=require('fs');var path=require(_0xc543('0x7'));var rimraf=require('rimraf');var config=require(_0xc543('0x8'));var attributes=require(_0xc543('0x9'));module[_0xc543('0xa')]=function(_0x1bab2b,_0x15c396){return _0x1bab2b['define'](_0xc543('0xb'),attributes,{'tableName':_0xc543('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26c1=['../../config/environment','./trunk.attributes','define','Trunk','util','../../config/logger','request-promise','path'];(function(_0x35bca2,_0x4ce50d){var _0x295d7a=function(_0x226e4d){while(--_0x226e4d){_0x35bca2['push'](_0x35bca2['shift']());}};_0x295d7a(++_0x4ce50d);}(_0x26c1,0xdc));var _0x126c=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0x26c1[_0x102b0c];return _0x9b15ca;};'use strict';var _=require('lodash');var util=require(_0x126c('0x0'));var logger=require(_0x126c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x126c('0x2'));var fs=require('fs');var path=require(_0x126c('0x3'));var rimraf=require('rimraf');var config=require(_0x126c('0x4'));var attributes=require(_0x126c('0x5'));module['exports']=function(_0x385910,_0xc92c38){return _0x385910[_0x126c('0x6')](_0x126c('0x7'),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 0a6ec3c..49b1559 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 _0xcf5e=['raw','ShowTrunk','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetTrunk','findAll','options','where','attributes','limit','include','map','model','Trunk'];(function(_0x5245ac,_0x51e284){var _0x5bf89b=function(_0x3b32e2){while(--_0x3b32e2){_0x5245ac['push'](_0x5245ac['shift']());}};_0x5bf89b(++_0x51e284);}(_0xcf5e,0xb1));var _0xecf5=function(_0x3a073a,_0xc6eddb){_0x3a073a=_0x3a073a-0x0;var _0x556c6f=_0xcf5e[_0x3a073a];return _0x556c6f;};'use strict';var _=require(_0xecf5('0x0'));var util=require(_0xecf5('0x1'));var moment=require(_0xecf5('0x2'));var BPromise=require('bluebird');var rs=require(_0xecf5('0x3'));var fs=require('fs');var Redis=require(_0xecf5('0x4'));var db=require(_0xecf5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xecf5('0x6'));var config=require(_0xecf5('0x7'));var jayson=require(_0xecf5('0x8'));var client=jayson[_0xecf5('0x9')][_0xecf5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x493ff3,_0x337d13,_0x146f20){return new BPromise(function(_0x79e2c,_0x18ca24){return client[_0xecf5('0xb')](_0x493ff3,_0x146f20)[_0xecf5('0xc')](function(_0x1b70df){logger['info'](_0xecf5('0xd'),_0x337d13,_0xecf5('0xe'));logger[_0xecf5('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x337d13,_0xecf5('0xe'),JSON[_0xecf5('0x10')](_0x1b70df));if(_0x1b70df[_0xecf5('0x11')]){if(_0x1b70df[_0xecf5('0x11')][_0xecf5('0x12')]===0x1f4){logger[_0xecf5('0x11')]('Trunk,\x20%s,\x20%s',_0x337d13,_0x1b70df[_0xecf5('0x11')][_0xecf5('0x13')]);return _0x18ca24(_0x1b70df[_0xecf5('0x11')][_0xecf5('0x13')]);}logger['error'](_0xecf5('0xd'),_0x337d13,_0x1b70df[_0xecf5('0x11')]['message']);return _0x79e2c(_0x1b70df[_0xecf5('0x11')][_0xecf5('0x13')]);}else{logger[_0xecf5('0x14')]('Trunk,\x20%s,\x20%s',_0x337d13,_0xecf5('0xe'));_0x79e2c(_0x1b70df[_0xecf5('0x15')][_0xecf5('0x13')]);}})[_0xecf5('0x16')](function(_0x3431cf){logger[_0xecf5('0x11')](_0xecf5('0xd'),_0x337d13,_0x3431cf);_0x18ca24(_0x3431cf);});});}exports[_0xecf5('0x17')]=function(_0x56ce7e){var _0x5d7cff=this;return new Promise(function(_0x45c060,_0x5b456e){return db['Trunk'][_0xecf5('0x18')]({'raw':_0x56ce7e[_0xecf5('0x19')]?_0x56ce7e[_0xecf5('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x56ce7e[_0xecf5('0x19')]?_0x56ce7e[_0xecf5('0x19')][_0xecf5('0x1a')]||null:null,'attributes':_0x56ce7e['options']?_0x56ce7e[_0xecf5('0x19')][_0xecf5('0x1b')]||null:null,'limit':_0x56ce7e[_0xecf5('0x19')]?_0x56ce7e[_0xecf5('0x19')][_0xecf5('0x1c')]||null:null,'include':_0x56ce7e[_0xecf5('0x19')]?_0x56ce7e[_0xecf5('0x19')][_0xecf5('0x1d')]?_[_0xecf5('0x1e')](_0x56ce7e[_0xecf5('0x19')][_0xecf5('0x1d')],function(_0x13699d){return{'model':db[_0x13699d[_0xecf5('0x1f')]],'as':_0x13699d['as'],'attributes':_0x13699d[_0xecf5('0x1b')],'include':_0x13699d[_0xecf5('0x1d')]?_[_0xecf5('0x1e')](_0x13699d[_0xecf5('0x1d')],function(_0x111211){return{'model':db[_0x111211[_0xecf5('0x1f')]],'as':_0x111211['as'],'attributes':_0x111211[_0xecf5('0x1b')],'include':_0x111211[_0xecf5('0x1d')]?_[_0xecf5('0x1e')](_0x111211[_0xecf5('0x1d')],function(_0x41b5eb){return{'model':db[_0x41b5eb[_0xecf5('0x1f')]],'as':_0x41b5eb['as'],'attributes':_0x41b5eb[_0xecf5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xecf5('0xc')](function(_0x4ac4b9){logger[_0xecf5('0x14')](_0xecf5('0x17'),_0x56ce7e);logger[_0xecf5('0xf')](_0xecf5('0x17'),_0x56ce7e,JSON[_0xecf5('0x10')](_0x4ac4b9));_0x45c060(_0x4ac4b9);})[_0xecf5('0x16')](function(_0x300523){logger['error'](_0xecf5('0x17'),_0x300523[_0xecf5('0x13')],_0x56ce7e);_0x5b456e(_0x5d7cff[_0xecf5('0x11')](0x1f4,_0x300523[_0xecf5('0x13')]));});});};exports['ShowTrunk']=function(_0x2fee29){var _0x499b98=this;return new Promise(function(_0x29644a,_0x2135a8){return db[_0xecf5('0x20')]['find']({'raw':_0x2fee29[_0xecf5('0x19')]?_0x2fee29['options'][_0xecf5('0x21')]===undefined?!![]:![]:!![],'where':_0x2fee29['options']?_0x2fee29['options'][_0xecf5('0x1a')]||null:null,'attributes':_0x2fee29[_0xecf5('0x19')]?_0x2fee29[_0xecf5('0x19')]['attributes']||null:null,'include':_0x2fee29[_0xecf5('0x19')]?_0x2fee29[_0xecf5('0x19')][_0xecf5('0x1d')]?_['map'](_0x2fee29[_0xecf5('0x19')]['include'],function(_0x18be52){return{'model':db[_0x18be52[_0xecf5('0x1f')]],'as':_0x18be52['as'],'attributes':_0x18be52[_0xecf5('0x1b')],'include':_0x18be52[_0xecf5('0x1d')]?_[_0xecf5('0x1e')](_0x18be52[_0xecf5('0x1d')],function(_0x5c3b31){return{'model':db[_0x5c3b31[_0xecf5('0x1f')]],'as':_0x5c3b31['as'],'attributes':_0x5c3b31[_0xecf5('0x1b')],'include':_0x5c3b31[_0xecf5('0x1d')]?_[_0xecf5('0x1e')](_0x5c3b31[_0xecf5('0x1d')],function(_0x488c53){return{'model':db[_0x488c53['model']],'as':_0x488c53['as'],'attributes':_0x488c53[_0xecf5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xecf5('0xc')](function(_0x174608){logger['info']('ShowTrunk',_0x2fee29);logger[_0xecf5('0xf')](_0xecf5('0x22'),_0x2fee29,JSON[_0xecf5('0x10')](_0x174608));_0x29644a(_0x174608);})[_0xecf5('0x16')](function(_0x4efc82){logger[_0xecf5('0x11')]('ShowTrunk',_0x4efc82[_0xecf5('0x13')],_0x2fee29);_0x2135a8(_0x499b98['error'](0x1f4,_0x4efc82[_0xecf5('0x13')]));});});}; \ No newline at end of file +var _0xfadb=['error','code','message','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowTrunk','find','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1a6214,_0x184438){var _0x368965=function(_0x4eaa98){while(--_0x4eaa98){_0x1a6214['push'](_0x1a6214['shift']());}};_0x368965(++_0x184438);}(_0xfadb,0x7b));var _0xbfad=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xfadb[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xbfad('0x0'));var util=require(_0xbfad('0x1'));var moment=require('moment');var BPromise=require(_0xbfad('0x2'));var rs=require(_0xbfad('0x3'));var fs=require('fs');var Redis=require(_0xbfad('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfad('0x5'));var logger=require(_0xbfad('0x6'))(_0xbfad('0x7'));var config=require(_0xbfad('0x8'));var jayson=require(_0xbfad('0x9'));var client=jayson[_0xbfad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f214b,_0xa92c9a,_0xe7b99d){return new BPromise(function(_0x899e89,_0x2b2679){return client[_0xbfad('0xb')](_0x5f214b,_0xe7b99d)[_0xbfad('0xc')](function(_0x4ea155){logger[_0xbfad('0xd')](_0xbfad('0xe'),_0xa92c9a,_0xbfad('0xf'));logger[_0xbfad('0x10')]('Trunk,\x20%s,\x20%s,\x20%s',_0xa92c9a,_0xbfad('0xf'),JSON['stringify'](_0x4ea155));if(_0x4ea155[_0xbfad('0x11')]){if(_0x4ea155['error'][_0xbfad('0x12')]===0x1f4){logger[_0xbfad('0x11')]('Trunk,\x20%s,\x20%s',_0xa92c9a,_0x4ea155['error']['message']);return _0x2b2679(_0x4ea155[_0xbfad('0x11')][_0xbfad('0x13')]);}logger[_0xbfad('0x11')](_0xbfad('0xe'),_0xa92c9a,_0x4ea155[_0xbfad('0x11')][_0xbfad('0x13')]);return _0x899e89(_0x4ea155[_0xbfad('0x11')][_0xbfad('0x13')]);}else{logger[_0xbfad('0xd')]('Trunk,\x20%s,\x20%s',_0xa92c9a,_0xbfad('0xf'));_0x899e89(_0x4ea155['result'][_0xbfad('0x13')]);}})['catch'](function(_0x43189c){logger[_0xbfad('0x11')](_0xbfad('0xe'),_0xa92c9a,_0x43189c);_0x2b2679(_0x43189c);});});}exports[_0xbfad('0x14')]=function(_0x5cefdb){var _0x5b6c2c=this;return new Promise(function(_0x3fed36,_0x46c5b3){return db[_0xbfad('0x15')][_0xbfad('0x16')]({'raw':_0x5cefdb[_0xbfad('0x17')]?_0x5cefdb[_0xbfad('0x17')][_0xbfad('0x18')]===undefined?!![]:![]:!![],'where':_0x5cefdb[_0xbfad('0x17')]?_0x5cefdb['options'][_0xbfad('0x19')]||null:null,'attributes':_0x5cefdb[_0xbfad('0x17')]?_0x5cefdb['options'][_0xbfad('0x1a')]||null:null,'limit':_0x5cefdb[_0xbfad('0x17')]?_0x5cefdb[_0xbfad('0x17')][_0xbfad('0x1b')]||null:null,'include':_0x5cefdb[_0xbfad('0x17')]?_0x5cefdb[_0xbfad('0x17')]['include']?_[_0xbfad('0x1c')](_0x5cefdb[_0xbfad('0x17')][_0xbfad('0x1d')],function(_0xebb1fd){return{'model':db[_0xebb1fd[_0xbfad('0x1e')]],'as':_0xebb1fd['as'],'attributes':_0xebb1fd[_0xbfad('0x1a')],'include':_0xebb1fd[_0xbfad('0x1d')]?_[_0xbfad('0x1c')](_0xebb1fd[_0xbfad('0x1d')],function(_0x29c81b){return{'model':db[_0x29c81b[_0xbfad('0x1e')]],'as':_0x29c81b['as'],'attributes':_0x29c81b['attributes'],'include':_0x29c81b[_0xbfad('0x1d')]?_[_0xbfad('0x1c')](_0x29c81b[_0xbfad('0x1d')],function(_0x3e26dd){return{'model':db[_0x3e26dd['model']],'as':_0x3e26dd['as'],'attributes':_0x3e26dd[_0xbfad('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbfad('0xc')](function(_0x50b8e7){logger[_0xbfad('0xd')](_0xbfad('0x14'),_0x5cefdb);logger['debug'](_0xbfad('0x14'),_0x5cefdb,JSON['stringify'](_0x50b8e7));_0x3fed36(_0x50b8e7);})[_0xbfad('0x1f')](function(_0x2ab85c){logger['error']('GetTrunk',_0x2ab85c['message'],_0x5cefdb);_0x46c5b3(_0x5b6c2c[_0xbfad('0x11')](0x1f4,_0x2ab85c[_0xbfad('0x13')]));});});};exports[_0xbfad('0x20')]=function(_0x50e804){var _0x5ce046=this;return new Promise(function(_0x356a27,_0x2b7e1e){return db[_0xbfad('0x15')][_0xbfad('0x21')]({'raw':_0x50e804[_0xbfad('0x17')]?_0x50e804[_0xbfad('0x17')][_0xbfad('0x18')]===undefined?!![]:![]:!![],'where':_0x50e804['options']?_0x50e804[_0xbfad('0x17')]['where']||null:null,'attributes':_0x50e804[_0xbfad('0x17')]?_0x50e804['options'][_0xbfad('0x1a')]||null:null,'include':_0x50e804[_0xbfad('0x17')]?_0x50e804[_0xbfad('0x17')][_0xbfad('0x1d')]?_['map'](_0x50e804[_0xbfad('0x17')]['include'],function(_0x34e82a){return{'model':db[_0x34e82a[_0xbfad('0x1e')]],'as':_0x34e82a['as'],'attributes':_0x34e82a[_0xbfad('0x1a')],'include':_0x34e82a[_0xbfad('0x1d')]?_[_0xbfad('0x1c')](_0x34e82a[_0xbfad('0x1d')],function(_0x312b33){return{'model':db[_0x312b33[_0xbfad('0x1e')]],'as':_0x312b33['as'],'attributes':_0x312b33[_0xbfad('0x1a')],'include':_0x312b33[_0xbfad('0x1d')]?_[_0xbfad('0x1c')](_0x312b33[_0xbfad('0x1d')],function(_0x5e7fe4){return{'model':db[_0x5e7fe4[_0xbfad('0x1e')]],'as':_0x5e7fe4['as'],'attributes':_0x5e7fe4[_0xbfad('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbfad('0xc')](function(_0x1c3202){logger[_0xbfad('0xd')]('ShowTrunk',_0x50e804);logger['debug']('ShowTrunk',_0x50e804,JSON[_0xbfad('0x22')](_0x1c3202));_0x356a27(_0x1c3202);})[_0xbfad('0x1f')](function(_0x57a880){logger[_0xbfad('0x11')](_0xbfad('0x20'),_0x57a880[_0xbfad('0x13')],_0x50e804);_0x2b7e1e(_0x5ce046['error'](0x1f4,_0x57a880[_0xbfad('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 661065d..4d04d9d 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 _0xb801=['createApiKey','put','/:id','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','/describe','describe','/whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','root','server/files/images/','%s-%s','now','originalname','single','file','addAvatar','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addSquareProjects'];(function(_0x1184ce,_0x451bf7){var _0x303f3f=function(_0xe854b0){while(--_0xe854b0){_0x1184ce['push'](_0x1184ce['shift']());}};_0x303f3f(++_0x451bf7);}(_0xb801,0xff));var _0x1b80=function(_0x2f58d6,_0xf21881){_0x2f58d6=_0x2f58d6-0x0;var _0x1e1594=_0xb801[_0x2f58d6];return _0x1e1594;};'use strict';var multer=require(_0x1b80('0x0'));var util=require('util');var path=require(_0x1b80('0x1'));var timeout=require(_0x1b80('0x2'));var express=require('express');var router=express[_0x1b80('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1b80('0x4'));var interaction=require(_0x1b80('0x5'));var config=require('../../config/environment');var controller=require(_0x1b80('0x6'));router[_0x1b80('0x7')]('/',auth[_0x1b80('0x8')](),controller['index']);router[_0x1b80('0x7')](_0x1b80('0x9'),auth[_0x1b80('0x8')](),controller[_0x1b80('0xa')]);router[_0x1b80('0x7')](_0x1b80('0xb'),auth[_0x1b80('0x8')](),controller['whoami']);router[_0x1b80('0x7')](_0x1b80('0xc'),auth['isAuthenticated'](),controller[_0x1b80('0xd')]);router[_0x1b80('0x7')]('/:id',auth[_0x1b80('0x8')](),controller[_0x1b80('0xe')]);router[_0x1b80('0x7')](_0x1b80('0xf'),controller[_0x1b80('0x10')]);router['get'](_0x1b80('0x11'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x12')]);router[_0x1b80('0x7')](_0x1b80('0x13'),auth[_0x1b80('0x8')](),controller['getContacts']);router[_0x1b80('0x7')]('/:id/queues',auth[_0x1b80('0x8')](),controller[_0x1b80('0x14')]);router[_0x1b80('0x7')](_0x1b80('0x15'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x16')]);router[_0x1b80('0x7')]('/:id/groups',auth['isAuthenticated'](),controller['getGroups']);router[_0x1b80('0x7')]('/:id/recordings',auth[_0x1b80('0x8')](),controller[_0x1b80('0x17')]);router[_0x1b80('0x7')](_0x1b80('0x18'),auth['isAuthenticated'](),controller[_0x1b80('0x19')]);router[_0x1b80('0x7')]('/:id/chat/interactions',auth[_0x1b80('0x8')](),controller[_0x1b80('0x1a')]);router[_0x1b80('0x7')](_0x1b80('0x1b'),auth[_0x1b80('0x8')](),controller['getOpenchannelInteractions']);router['get'](_0x1b80('0x1c'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x1d')]);router[_0x1b80('0x7')]('/:id/sms/interactions',auth[_0x1b80('0x8')](),controller[_0x1b80('0x1e')]);router[_0x1b80('0x7')]('/:id/fax/interactions',auth[_0x1b80('0x8')](),controller[_0x1b80('0x1f')]);router['get'](_0x1b80('0x20'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x21')]);router['get'](_0x1b80('0x22'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x23')]);router[_0x1b80('0x7')]('/:id/lists',auth['isAuthenticated'](),controller[_0x1b80('0x24')]);router[_0x1b80('0x7')](_0x1b80('0x25'),auth['isAuthenticated'](),controller[_0x1b80('0x26')]);router[_0x1b80('0x7')](_0x1b80('0x27'),auth['isAuthenticated'](),controller[_0x1b80('0x28')]);router[_0x1b80('0x7')](_0x1b80('0x29'),auth['isAuthenticated'](),controller[_0x1b80('0x2a')]);router[_0x1b80('0x7')](_0x1b80('0x2b'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x2c')]);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x1b80('0x2d')]);router[_0x1b80('0x7')](_0x1b80('0x2e'),auth['isAuthenticated'](),controller['getSmsAccounts']);router['get']('/:id/chat_websites',auth[_0x1b80('0x8')](),controller['getChatWebsites']);router['get'](_0x1b80('0x2f'),auth['isAuthenticated'](),controller[_0x1b80('0x30')]);router['get'](_0x1b80('0x31'),auth[_0x1b80('0x8')](),controller['getSquareProjects']);router['get'](_0x1b80('0x32'),auth[_0x1b80('0x8')](),controller['getScheduledCalls']);router[_0x1b80('0x7')](_0x1b80('0x33'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x34')]);router[_0x1b80('0x35')](_0x1b80('0x13'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x36')]);router[_0x1b80('0x35')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1b80('0x35')](_0x1b80('0x37'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x38')]);router['post'](_0x1b80('0x39'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x3a')]);var upload=multer({'storage':multer[_0x1b80('0x3b')]({'destination':function(_0x3133e8,_0x2568d1,_0x48ffe4){_0x48ffe4(null,path['join'](config[_0x1b80('0x3c')],_0x1b80('0x3d')));},'filename':function(_0x29a235,_0x2381fa,_0x2077df){_0x2077df(null,util['format'](_0x1b80('0x3e'),Date[_0x1b80('0x3f')](),_0x2381fa[_0x1b80('0x40')]));}})});router['post'](_0x1b80('0xf'),upload[_0x1b80('0x41')](_0x1b80('0x42')),controller[_0x1b80('0x43')]);router[_0x1b80('0x35')]('/:id/login',auth[_0x1b80('0x8')](),controller[_0x1b80('0x44')]);router[_0x1b80('0x35')](_0x1b80('0x45'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x46')]);router[_0x1b80('0x35')](_0x1b80('0x47'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x48')]);router[_0x1b80('0x35')](_0x1b80('0x49'),auth[_0x1b80('0x8')](),controller['unpause']);router[_0x1b80('0x35')](_0x1b80('0x22'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x4a')]);router[_0x1b80('0x35')](_0x1b80('0x4b'),auth['isAuthenticated'](),controller[_0x1b80('0x4c')]);router[_0x1b80('0x35')](_0x1b80('0x4d'),auth['isAuthenticated'](),controller[_0x1b80('0x4e')]);router[_0x1b80('0x35')](_0x1b80('0x4f'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x50')]);router[_0x1b80('0x35')](_0x1b80('0x51'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x52')]);router[_0x1b80('0x35')]('/:id/openchannel_interactions',auth[_0x1b80('0x8')](),controller[_0x1b80('0x53')]);router[_0x1b80('0x35')](_0x1b80('0x54'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x55')]);router['post'](_0x1b80('0x29'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x56')]);router[_0x1b80('0x35')](_0x1b80('0x2b'),auth['isAuthenticated'](),controller[_0x1b80('0x57')]);router['post'](_0x1b80('0x58'),auth[_0x1b80('0x8')](),controller['addOpenchannelAccounts']);router[_0x1b80('0x35')](_0x1b80('0x2e'),auth['isAuthenticated'](),controller[_0x1b80('0x59')]);router[_0x1b80('0x35')](_0x1b80('0x5a'),auth['isAuthenticated'](),controller[_0x1b80('0x5b')]);router[_0x1b80('0x35')](_0x1b80('0x2f'),auth[_0x1b80('0x8')](),controller['addWhatsappAccounts']);router[_0x1b80('0x35')](_0x1b80('0x31'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x5c')]);router['post'](_0x1b80('0x33'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x5d')]);router[_0x1b80('0x5e')](_0x1b80('0x5f'),auth[_0x1b80('0x8')](),controller['update']);router[_0x1b80('0x5e')](_0x1b80('0x60'),auth['isAuthenticated'](),controller[_0x1b80('0x61')]);router['delete'](_0x1b80('0x39'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x62')]);router[_0x1b80('0x63')](_0x1b80('0x22'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x64')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1b80('0x65')]);router[_0x1b80('0x63')](_0x1b80('0x4b'),auth[_0x1b80('0x8')](),controller['removeChatInteractions']);router[_0x1b80('0x63')]('/:id/mail_interactions',auth[_0x1b80('0x8')](),controller[_0x1b80('0x66')]);router[_0x1b80('0x63')](_0x1b80('0x4f'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x67')]);router[_0x1b80('0x63')](_0x1b80('0x51'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x68')]);router[_0x1b80('0x63')](_0x1b80('0x69'),auth['isAuthenticated'](),controller[_0x1b80('0x6a')]);router[_0x1b80('0x63')](_0x1b80('0x54'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router['delete'](_0x1b80('0x29'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x6b')]);router[_0x1b80('0x63')]('/:id/mail_accounts',auth[_0x1b80('0x8')](),controller[_0x1b80('0x6c')]);router['delete'](_0x1b80('0x58'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x6d')]);router[_0x1b80('0x63')](_0x1b80('0x2e'),auth['isAuthenticated'](),controller[_0x1b80('0x6e')]);router['delete']('/:id/chat_websites',auth[_0x1b80('0x8')](),controller[_0x1b80('0x6f')]);router[_0x1b80('0x63')]('/:id/whatsapp_accounts',auth[_0x1b80('0x8')](),controller[_0x1b80('0x70')]);router[_0x1b80('0x63')](_0x1b80('0x31'),auth['isAuthenticated'](),controller[_0x1b80('0x71')]);router[_0x1b80('0x63')](_0x1b80('0x33'),auth[_0x1b80('0x8')](),controller[_0x1b80('0x72')]);module[_0x1b80('0x73')]=router; \ No newline at end of file +var _0xc9b1=['/:id/password','changePassword','/:id/queues','removeQueues','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/square_projects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','index','isAuthenticated','describe','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','getQueues','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','addContacts','post','create','/create_many','bulkCreate','addQueues','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','unpause','/:id/teams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','update','put'];(function(_0x5b1c9f,_0x451dbc){var _0xa05a2c=function(_0x594b32){while(--_0x594b32){_0x5b1c9f['push'](_0x5b1c9f['shift']());}};_0xa05a2c(++_0x451dbc);}(_0xc9b1,0x94));var _0x1c9b=function(_0x453781,_0x59b6e9){_0x453781=_0x453781-0x0;var _0xfeb988=_0xc9b1[_0x453781];return _0xfeb988;};'use strict';var multer=require(_0x1c9b('0x0'));var util=require(_0x1c9b('0x1'));var path=require(_0x1c9b('0x2'));var timeout=require(_0x1c9b('0x3'));var express=require(_0x1c9b('0x4'));var router=express[_0x1c9b('0x5')]();var fs_extra=require(_0x1c9b('0x6'));var auth=require(_0x1c9b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1c9b('0x8'));var controller=require(_0x1c9b('0x9'));router[_0x1c9b('0xa')]('/',auth['isAuthenticated'](),controller[_0x1c9b('0xb')]);router[_0x1c9b('0xa')]('/describe',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0xd')]);router[_0x1c9b('0xa')]('/whoami',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0xe')]);router[_0x1c9b('0xa')](_0x1c9b('0xf'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x10')]);router[_0x1c9b('0xa')](_0x1c9b('0x11'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x12')]);router[_0x1c9b('0xa')](_0x1c9b('0x13'),controller[_0x1c9b('0x14')]);router[_0x1c9b('0xa')]('/:id/open_tabs',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x15')]);router[_0x1c9b('0xa')](_0x1c9b('0x16'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x17')]);router['get']('/:id/queues',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x18')]);router[_0x1c9b('0xa')]('/:id/queues_rt',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x19')]);router[_0x1c9b('0xa')](_0x1c9b('0x1a'),auth[_0x1c9b('0xc')](),controller['getGroups']);router[_0x1c9b('0xa')](_0x1c9b('0x1b'),auth['isAuthenticated'](),controller[_0x1c9b('0x1c')]);router[_0x1c9b('0xa')](_0x1c9b('0x1d'),auth['isAuthenticated'](),controller[_0x1c9b('0x1e')]);router[_0x1c9b('0xa')](_0x1c9b('0x1f'),auth['isAuthenticated'](),controller[_0x1c9b('0x20')]);router[_0x1c9b('0xa')](_0x1c9b('0x21'),auth[_0x1c9b('0xc')](),controller['getOpenchannelInteractions']);router['get'](_0x1c9b('0x22'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x1c9b('0xa')](_0x1c9b('0x23'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x24')]);router[_0x1c9b('0xa')](_0x1c9b('0x25'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x26')]);router['get'](_0x1c9b('0x27'),auth['isAuthenticated'](),controller[_0x1c9b('0x28')]);router[_0x1c9b('0xa')]('/:id/teams',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x29')]);router['get'](_0x1c9b('0x2a'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x2b')]);router[_0x1c9b('0xa')]('/:id/agents',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x2c')]);router[_0x1c9b('0xa')](_0x1c9b('0x2d'),auth['isAuthenticated'](),controller[_0x1c9b('0x2e')]);router[_0x1c9b('0xa')](_0x1c9b('0x2f'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x30')]);router['get'](_0x1c9b('0x31'),auth['isAuthenticated'](),controller[_0x1c9b('0x32')]);router[_0x1c9b('0xa')]('/:id/openchannel_accounts',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x33')]);router[_0x1c9b('0xa')](_0x1c9b('0x34'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x35')]);router[_0x1c9b('0xa')]('/:id/chat_websites',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x36')]);router[_0x1c9b('0xa')]('/:id/whatsapp_accounts',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x37')]);router[_0x1c9b('0xa')]('/:id/square_projects',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x38')]);router[_0x1c9b('0xa')](_0x1c9b('0x39'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x3a')]);router['get']('/:id/api_key',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x3b')]);router['post'](_0x1c9b('0x16'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x3c')]);router[_0x1c9b('0x3d')]('/',auth['isAuthenticated'](),controller[_0x1c9b('0x3e')]);router[_0x1c9b('0x3d')](_0x1c9b('0x3f'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x40')]);router['post']('/:id/queues',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x41')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x459ce0,_0x3d7ed6,_0x5656bf){_0x5656bf(null,path['join'](config[_0x1c9b('0x42')],_0x1c9b('0x43')));},'filename':function(_0x184bac,_0x3bbd68,_0x44cad6){_0x44cad6(null,util[_0x1c9b('0x44')](_0x1c9b('0x45'),Date[_0x1c9b('0x46')](),_0x3bbd68[_0x1c9b('0x47')]));}})});router['post'](_0x1c9b('0x13'),upload[_0x1c9b('0x48')](_0x1c9b('0x49')),controller[_0x1c9b('0x4a')]);router[_0x1c9b('0x3d')](_0x1c9b('0x4b'),auth['isAuthenticated'](),controller[_0x1c9b('0x4c')]);router[_0x1c9b('0x3d')](_0x1c9b('0x4d'),auth['isAuthenticated'](),controller[_0x1c9b('0x4e')]);router[_0x1c9b('0x3d')](_0x1c9b('0x4f'),auth[_0x1c9b('0xc')](),controller['pause']);router['post']('/:id/unpause',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x50')]);router[_0x1c9b('0x3d')](_0x1c9b('0x51'),auth[_0x1c9b('0xc')](),controller['addTeams']);router['post']('/:id/chat_interactions',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x52')]);router['post'](_0x1c9b('0x53'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x54')]);router[_0x1c9b('0x3d')](_0x1c9b('0x55'),auth[_0x1c9b('0xc')](),controller['addFaxInteractions']);router[_0x1c9b('0x3d')](_0x1c9b('0x56'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x57')]);router[_0x1c9b('0x3d')]('/:id/openchannel_interactions',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x58')]);router[_0x1c9b('0x3d')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x1c9b('0x59')]);router[_0x1c9b('0x3d')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x1c9b('0x5a')]);router[_0x1c9b('0x3d')](_0x1c9b('0x31'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x5b')]);router[_0x1c9b('0x3d')](_0x1c9b('0x5c'),auth['isAuthenticated'](),controller[_0x1c9b('0x5d')]);router[_0x1c9b('0x3d')](_0x1c9b('0x34'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x5e')]);router[_0x1c9b('0x3d')](_0x1c9b('0x5f'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x60')]);router[_0x1c9b('0x3d')](_0x1c9b('0x61'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x62')]);router[_0x1c9b('0x3d')]('/:id/square_projects',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x63')]);router[_0x1c9b('0x3d')](_0x1c9b('0x64'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x65')]);router['put'](_0x1c9b('0x11'),auth['isAuthenticated'](),controller[_0x1c9b('0x66')]);router[_0x1c9b('0x67')](_0x1c9b('0x68'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x69')]);router['delete'](_0x1c9b('0x6a'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x6b')]);router[_0x1c9b('0x6c')](_0x1c9b('0x51'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x6d')]);router[_0x1c9b('0x6c')]('/:id',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x6e')]);router['delete'](_0x1c9b('0x6f'),auth['isAuthenticated'](),controller[_0x1c9b('0x70')]);router['delete'](_0x1c9b('0x53'),auth[_0x1c9b('0xc')](),controller['removeMailInteractions']);router[_0x1c9b('0x6c')](_0x1c9b('0x55'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x71')]);router[_0x1c9b('0x6c')](_0x1c9b('0x56'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x72')]);router[_0x1c9b('0x6c')](_0x1c9b('0x73'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x74')]);router[_0x1c9b('0x6c')](_0x1c9b('0x75'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x76')]);router[_0x1c9b('0x6c')]('/:id/fax_accounts',auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x77')]);router[_0x1c9b('0x6c')](_0x1c9b('0x31'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x78')]);router['delete'](_0x1c9b('0x5c'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x79')]);router['delete'](_0x1c9b('0x34'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x7a')]);router[_0x1c9b('0x6c')]('/:id/chat_websites',auth[_0x1c9b('0xc')](),controller['removeChatWebsites']);router['delete'](_0x1c9b('0x61'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0x1c9b('0x6c')](_0x1c9b('0x7b'),auth[_0x1c9b('0xc')](),controller['removeSquareProjects']);router[_0x1c9b('0x6c')](_0x1c9b('0x64'),auth[_0x1c9b('0xc')](),controller[_0x1c9b('0x7c')]);module[_0x1c9b('0x7d')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 53a54e3..dfefd85 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 _0x6bb4=['from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','ulaw;alaw;gsm','allow','insecure','never','\x22\x22\x20<>','always','refuse','uac','fingerprint','certificate','passive','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','exports','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','\x22%s\x22\x20<%s>','getDataValue','email','ENUM','admin','user','telephone','local','internal','accountcode','callerid','BOOLEAN','DATE','INTEGER','dynamic','friend','peer'];(function(_0xa75505,_0x50012f){var _0x53dc72=function(_0x13d150){while(--_0x13d150){_0xa75505['push'](_0xa75505['shift']());}};_0x53dc72(++_0x50012f);}(_0x6bb4,0x1a7));var _0x46bb=function(_0x19cd7d,_0x216c4a){_0x19cd7d=_0x19cd7d-0x0;var _0x3f084b=_0x6bb4[_0x19cd7d];return _0x3f084b;};'use strict';var Sequelize=require(_0x46bb('0x0'));var moment=require(_0x46bb('0x1'));var util=require(_0x46bb('0x2'));var _=require('lodash');module[_0x46bb('0x3')]={'name':{'type':Sequelize[_0x46bb('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x74054){this[_0x46bb('0x5')](_0x46bb('0x6'),_0x74054);this[_0x46bb('0x5')](_0x46bb('0x7'),_0x74054);},'comment':_0x46bb('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x4fa5c4){this[_0x46bb('0x5')](_0x46bb('0x9'),_0x4fa5c4);this['setDataValue']('callerid',util['format'](_0x46bb('0xa'),_0x4fa5c4,this[_0x46bb('0xb')]('internal')));}},'alias':{'type':Sequelize[_0x46bb('0x4')]},'email':{'type':Sequelize[_0x46bb('0x4')],'allowNull':![],'unique':_0x46bb('0xc'),'validate':{'isEmail':!![]},'set':function(_0x4b7854){if(_0x4b7854){this[_0x46bb('0x5')](_0x46bb('0xc'),_0x4b7854['toLowerCase']());}}},'role':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0xe'),_0x46bb('0xf'),'agent',_0x46bb('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x46bb('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x46bb('0x12'),'set':function(_0x1c8850){this['setDataValue'](_0x46bb('0x12'),_0x1c8850);this['setDataValue'](_0x46bb('0x13'),_0x1c8850);this['setDataValue'](_0x46bb('0x14'),util['format']('\x22%s\x22\x20<%s>',this[_0x46bb('0xb')](_0x46bb('0x9')),_0x1c8850));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x46bb('0x4')]},'mobile':{'type':Sequelize[_0x46bb('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x46bb('0x4')]},'city':{'type':Sequelize[_0x46bb('0x4')]},'country':{'type':Sequelize[_0x46bb('0x4')]},'online':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x46bb('0x16')]},'voicePause':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x46bb('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x46bb('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x46bb('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x46bb('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x46bb('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![],'defaultValue':_0x46bb('0x18')},'ipaddr':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x46bb('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x46bb('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x46bb('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x46bb('0x19'),_0x46bb('0xf'),_0x46bb('0x1a')),'allowNull':!![],'defaultValue':_0x46bb('0x19')},'context':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![],'defaultValue':_0x46bb('0x1b')},'callingpres':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x1c'),_0x46bb('0x1d'),_0x46bb('0x1e'),_0x46bb('0x1f'),_0x46bb('0x20'),_0x46bb('0x21'),_0x46bb('0x22'),_0x46bb('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0xd69dd8){this['setDataValue'](_0x46bb('0x24'),_0xd69dd8?_0xd69dd8['join'](','):null);},'get':function(){return this[_0x46bb('0xb')](_0x46bb('0x24'))?this[_0x46bb('0xb')]('transport')[_0x46bb('0x25')](','):null;},'comment':_0x46bb('0x26')},'dtmfmode':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x27'),_0x46bb('0x28'),'shortinfo',_0x46bb('0x29'),_0x46bb('0x2a')),'allowNull':!![],'defaultValue':_0x46bb('0x27')},'directmedia':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no',_0x46bb('0x2c'),_0x46bb('0x2d'),_0x46bb('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![],'defaultValue':_0x46bb('0x2f'),'set':function(_0xc1f9b9){this[_0x46bb('0x5')](_0x46bb('0x30'),_0xc1f9b9?_0xc1f9b9[_0x46bb('0x31')](','):null);},'get':function(){return this[_0x46bb('0xb')](_0x46bb('0x30'))?this[_0x46bb('0xb')](_0x46bb('0x30'))[_0x46bb('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x46bb('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x46bb('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x46bb('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x46bb('0x32'),'set':function(_0x102ffb){this['setDataValue'](_0x46bb('0x33'),_0x102ffb?_0x102ffb['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x46bb('0xb')]('allow')?this[_0x46bb('0xb')](_0x46bb('0x33'))[_0x46bb('0x25')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![],'set':function(_0x4bf211){this[_0x46bb('0x5')](_0x46bb('0x34'),_0x4bf211?_0x4bf211[_0x46bb('0x31')](','):null);},'get':function(){return this[_0x46bb('0xb')](_0x46bb('0x34'))?this[_0x46bb('0xb')]('insecure')[_0x46bb('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x46bb('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x46bb('0xd')]('yes','no',_0x46bb('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x46bb('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![],'defaultValue':_0x46bb('0x36')},'amaflags':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x46bb('0x2b')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x46bb('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no',_0x46bb('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x46bb('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x46bb('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x46bb('0xd')]('accept',_0x46bb('0x38'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x46bb('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x39'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x46bb('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x46bb('0x2b')},'keepalive':{'type':Sequelize[_0x46bb('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x46bb('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x46bb('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x46bb('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x46bb('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x46bb('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x46bb('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no',_0x46bb('0x3a'),_0x46bb('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x46bb('0xd')]('active',_0x46bb('0x3c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x46bb('0xd')](_0x46bb('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x46bb('0xd')]('yes','no',_0x46bb('0x2c'),_0x46bb('0x2d'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x46bb('0x16')]},'passwordResetAt':{'type':Sequelize[_0x46bb('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x563ffe){this[_0x46bb('0x5')](_0x46bb('0x3d'),_0x563ffe);var _0x4e8166=this[_0x46bb('0x3e')]({'plain':!![]});switch(_0x563ffe){case 0x0:case 0x1:var _0x1736ce=_0x4e8166['transport']?_[_0x46bb('0x3f')](_0x4e8166[_0x46bb('0x24')])?_0x4e8166[_0x46bb('0x24')][_0x46bb('0x31')]():_0x4e8166[_0x46bb('0x24')]:'udp';if(_0x1736ce===_0x46bb('0x40')){_0x1736ce='udp';}this[_0x46bb('0x5')](_0x46bb('0x24'),_0x1736ce);this[_0x46bb('0x5')](_0x46bb('0x41'),'no');this[_0x46bb('0x5')](_0x46bb('0x42'),null);this[_0x46bb('0x5')](_0x46bb('0x43'),null);this[_0x46bb('0x5')](_0x46bb('0x44'),null);this[_0x46bb('0x5')](_0x46bb('0x45'),null);this[_0x46bb('0x5')](_0x46bb('0x46'),null);this[_0x46bb('0x5')](_0x46bb('0x47'),null);this[_0x46bb('0x5')](_0x46bb('0x48'),null);this[_0x46bb('0x5')](_0x46bb('0x49'),null);this[_0x46bb('0x5')](_0x46bb('0x4a'),'no');break;case 0x2:this['setDataValue'](_0x46bb('0x24'),'wss');this['setDataValue']('encryption',_0x46bb('0x2b'));this[_0x46bb('0x5')](_0x46bb('0x42'),_0x46bb('0x2b'));this[_0x46bb('0x5')](_0x46bb('0x43'),_0x46bb('0x2b'));this['setDataValue'](_0x46bb('0x44'),'yes');this[_0x46bb('0x5')]('dtlsenable','yes');this[_0x46bb('0x5')]('dtlsverify','no');this[_0x46bb('0x5')](_0x46bb('0x47'),'actpass');this[_0x46bb('0x5')]('dtlscertfile',_0x4e8166[_0x46bb('0x48')]||_0x46bb('0x4b'));this[_0x46bb('0x5')](_0x46bb('0x49'),_0x4e8166[_0x46bb('0x49')]||_0x46bb('0x4c'));this[_0x46bb('0x5')]('rtcp_mux',_0x46bb('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x46bb('0x4d')],'set':function(_0x23acce){this[_0x46bb('0x5')](_0x46bb('0x4e'),_0x23acce?_0x23acce[_0x46bb('0x31')](','):[]);},'get':function(){return this[_0x46bb('0xb')](_0x46bb('0x4e'))?_[_0x46bb('0x4f')](this['getDataValue'](_0x46bb('0x4e'))['split'](','),function(_0x3200af){return parseInt(_0x3200af,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x46bb('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x46bb('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x46bb('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x46bb('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x46bb('0x50')],'get':function(){return this[_0x46bb('0xb')](_0x46bb('0x51'))?this['getDataValue'](_0x46bb('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x46bb('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x46bb('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![],'set':function(_0x307227){if(typeof _0x307227===_0x46bb('0x52')){var _0x46b23f=_0x307227==='1'?!![]:_0x307227==='0'?![]:_0x307227===_0x46bb('0x53')?!![]:_0x307227===_0x46bb('0x54')?![]:![];this['setDataValue']('screenrecording',_0x46b23f);}else{this['setDataValue'](_0x46bb('0x55'),_0x307227);}}},'blocked':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![],'set':function(_0x3f093e){this['setDataValue'](_0x46bb('0x56'),_0x3f093e);if(_0x3f093e===!![]){this[_0x46bb('0x5')](_0x46bb('0x57'),moment());this[_0x46bb('0x5')](_0x46bb('0x58'),0x0);}else{this['setDataValue'](_0x46bb('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x46bb('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x46bb('0x17')](0x5)[_0x46bb('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x46bb('0x15')],'defaultValue':!![]}}; \ No newline at end of file +var _0x55c1=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','uas','fingerprint','certificate','active','passive','update,nonat','TEXT','get','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlsprivatekey','dtlsverify','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','getDataValue','internal','toLowerCase','ENUM','user','agent','local','callerid','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','transport','join','split'];(function(_0x3ed79c,_0x2336b0){var _0x18b420=function(_0x4bc8f4){while(--_0x4bc8f4){_0x3ed79c['push'](_0x3ed79c['shift']());}};_0x18b420(++_0x2336b0);}(_0x55c1,0x1e5));var _0x155c=function(_0x1c2fd7,_0x595cf1){_0x1c2fd7=_0x1c2fd7-0x0;var _0x369e9d=_0x55c1[_0x1c2fd7];return _0x369e9d;};'use strict';var Sequelize=require(_0x155c('0x0'));var moment=require(_0x155c('0x1'));var util=require('util');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x155c('0x2')],'allowNull':![],'unique':_0x155c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x30444a){this[_0x155c('0x4')](_0x155c('0x3'),_0x30444a);this['setDataValue'](_0x155c('0x5'),_0x30444a);},'comment':_0x155c('0x6')},'fullname':{'type':Sequelize[_0x155c('0x2')],'allowNull':![],'set':function(_0x4df902){this[_0x155c('0x4')](_0x155c('0x7'),_0x4df902);this[_0x155c('0x4')]('callerid',util['format']('\x22%s\x22\x20<%s>',_0x4df902,this[_0x155c('0x8')](_0x155c('0x9'))));}},'alias':{'type':Sequelize[_0x155c('0x2')]},'email':{'type':Sequelize[_0x155c('0x2')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x228de5){if(_0x228de5){this[_0x155c('0x4')]('email',_0x228de5[_0x155c('0xa')]());}}},'role':{'type':Sequelize[_0x155c('0xb')]('admin',_0x155c('0xc'),_0x155c('0xd'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x155c('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x155c('0x2')],'defaultValue':_0x155c('0xe')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x155c('0x9'),'set':function(_0x37903b){this[_0x155c('0x4')](_0x155c('0x9'),_0x37903b);this[_0x155c('0x4')]('accountcode',_0x37903b);this[_0x155c('0x4')](_0x155c('0xf'),util['format'](_0x155c('0x10'),this['getDataValue'](_0x155c('0x7')),_0x37903b));}},'salt':{'type':Sequelize[_0x155c('0x2')]},'phone':{'type':Sequelize[_0x155c('0x2')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x155c('0x2')]},'zipcode':{'type':Sequelize[_0x155c('0x2')]},'userpic':{'type':Sequelize[_0x155c('0x2')]},'city':{'type':Sequelize[_0x155c('0x2')]},'country':{'type':Sequelize[_0x155c('0x2')]},'online':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x155c('0x12')]},'voicePause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x155c('0x2')],'defaultValue':_0x155c('0x13')},'lastPauseAt':{'type':Sequelize[_0x155c('0x12')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x155c('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'description':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![],'defaultValue':_0x155c('0x15')},'ipaddr':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0x155c('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x155c('0x16'),'user','peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x155c('0x17')},'callingpres':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x18'),'ALLOWED_PASSED_SCREEN',_0x155c('0x19'),_0x155c('0x1a'),_0x155c('0x1b'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![],'defaultValue':'udp','set':function(_0x2a84e7){this['setDataValue'](_0x155c('0x1c'),_0x2a84e7?_0x2a84e7[_0x155c('0x1d')](','):null);},'get':function(){return this['getDataValue'](_0x155c('0x1c'))?this[_0x155c('0x8')]('transport')[_0x155c('0x1e')](','):null;},'comment':_0x155c('0x1f')},'dtmfmode':{'type':Sequelize['ENUM'](_0x155c('0x20'),_0x155c('0x21'),_0x155c('0x22'),_0x155c('0x23'),_0x155c('0x24')),'allowNull':!![],'defaultValue':_0x155c('0x20')},'directmedia':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no',_0x155c('0x26'),_0x155c('0x27'),_0x155c('0x28')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x155c('0x29'),'set':function(_0x2b9482){this['setDataValue']('nat',_0x2b9482?_0x2b9482[_0x155c('0x1d')](','):null);},'get':function(){return this[_0x155c('0x8')](_0x155c('0x2a'))?this['getDataValue'](_0x155c('0x2a'))[_0x155c('0x1e')](','):null;},'comment':_0x155c('0x2b')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x155c('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x155c('0x2')]},'language':{'type':Sequelize[_0x155c('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x155c('0x2')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x155c('0x2')],'allowNull':![],'defaultValue':_0x155c('0x2c'),'set':function(_0x22fe10){this['setDataValue'](_0x155c('0x2d'),_0x22fe10?_0x22fe10[_0x155c('0x1d')](';'):_0x155c('0x2c'));},'get':function(){return this[_0x155c('0x8')](_0x155c('0x2d'))?this['getDataValue']('allow')[_0x155c('0x1e')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x155c('0xb')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x3848e1){this[_0x155c('0x4')](_0x155c('0x2e'),_0x3848e1?_0x3848e1[_0x155c('0x1d')](','):null);},'get':function(){return this[_0x155c('0x8')]('insecure')?this[_0x155c('0x8')](_0x155c('0x2e'))[_0x155c('0x1e')](','):null;},'comment':_0x155c('0x2f')},'trustrpid':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no',_0x155c('0x30')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x155c('0xb')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![],'defaultValue':_0x155c('0x31')},'amaflags':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':_0x155c('0x25')},'busylevel':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x155c('0xb')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no',_0x155c('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x155c('0x33'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x155c('0xb')]('uac','uas'),'allowNull':!![],'defaultValue':_0x155c('0x34')},'t38pt_usertpsource':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':_0x155c('0x25')},'keepalive':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x155c('0xb')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no',_0x155c('0x35'),_0x155c('0x36')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x37'),_0x155c('0x38'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x155c('0xb')](_0x155c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x155c('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x155c('0xb')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x155c('0xb')]('yes','no','nonat',_0x155c('0x27'),_0x155c('0x39')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x155c('0x12')]},'passwordResetAt':{'type':Sequelize[_0x155c('0x12')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x155c('0x3a')]},'showWebBar':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0,'set':function(_0x3476b9){this[_0x155c('0x4')]('showWebBar',_0x3476b9);var _0x582220=this[_0x155c('0x3b')]({'plain':!![]});switch(_0x3476b9){case 0x0:case 0x1:var _0x165e9=_0x582220[_0x155c('0x1c')]?_['isArray'](_0x582220[_0x155c('0x1c')])?_0x582220[_0x155c('0x1c')][_0x155c('0x1d')]():_0x582220[_0x155c('0x1c')]:_0x155c('0x3c');if(_0x165e9==='wss'){_0x165e9=_0x155c('0x3c');}this[_0x155c('0x4')](_0x155c('0x1c'),_0x165e9);this[_0x155c('0x4')](_0x155c('0x3d'),'no');this['setDataValue'](_0x155c('0x3e'),null);this[_0x155c('0x4')](_0x155c('0x3f'),null);this['setDataValue'](_0x155c('0x40'),null);this['setDataValue'](_0x155c('0x41'),null);this[_0x155c('0x4')]('dtlsverify',null);this[_0x155c('0x4')](_0x155c('0x42'),null);this[_0x155c('0x4')]('dtlscertfile',null);this[_0x155c('0x4')](_0x155c('0x43'),null);this[_0x155c('0x4')]('rtcp_mux','no');break;case 0x2:this[_0x155c('0x4')](_0x155c('0x1c'),'wss');this[_0x155c('0x4')]('encryption',_0x155c('0x25'));this[_0x155c('0x4')](_0x155c('0x3e'),_0x155c('0x25'));this[_0x155c('0x4')]('force_avp',_0x155c('0x25'));this[_0x155c('0x4')]('icesupport',_0x155c('0x25'));this[_0x155c('0x4')](_0x155c('0x41'),_0x155c('0x25'));this['setDataValue'](_0x155c('0x44'),'no');this[_0x155c('0x4')]('dtlssetup',_0x155c('0x45'));this[_0x155c('0x4')](_0x155c('0x46'),_0x582220[_0x155c('0x46')]||_0x155c('0x47'));this[_0x155c('0x4')](_0x155c('0x43'),_0x582220['dtlsprivatekey']||_0x155c('0x48'));this[_0x155c('0x4')](_0x155c('0x49'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x31ca0f){this[_0x155c('0x4')](_0x155c('0x4a'),_0x31ca0f?_0x31ca0f['join'](','):[]);},'get':function(){return this['getDataValue'](_0x155c('0x4a'))?_[_0x155c('0x4b')](this['getDataValue'](_0x155c('0x4a'))[_0x155c('0x1e')](','),function(_0x690148){return parseInt(_0x690148,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x155c('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x155c('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0x155c('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x155c('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x155c('0x25'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x155c('0x4c')],'get':function(){return this[_0x155c('0x8')](_0x155c('0x4d'))?this[_0x155c('0x8')](_0x155c('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x155c('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![],'set':function(_0x15f172){if(typeof _0x15f172===_0x155c('0x4e')){var _0xb22afe=_0x15f172==='1'?!![]:_0x15f172==='0'?![]:_0x15f172===_0x155c('0x4f')?!![]:_0x15f172===_0x155c('0x50')?![]:![];this['setDataValue'](_0x155c('0x51'),_0xb22afe);}else{this['setDataValue'](_0x155c('0x51'),_0x15f172);}}},'blocked':{'type':Sequelize[_0x155c('0x11')],'defaultValue':![],'set':function(_0x1faa6e){this[_0x155c('0x4')](_0x155c('0x52'),_0x1faa6e);if(_0x1faa6e===!![]){this[_0x155c('0x4')](_0x155c('0x53'),moment());this[_0x155c('0x4')](_0x155c('0x54'),0x0);}else{this['setDataValue'](_0x155c('0x53'),null);}}},'blockedAt':{'type':Sequelize[_0x155c('0x12')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x155c('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x155c('0x14')](0x5)[_0x155c('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x155c('0x11')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 9b9716d..f061b92 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 _0x4888=['jayson/promise','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','register','redis','localhost','client','http','request','then','User,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','sendStatus','status','end','json','limit','count','offset','set','Content-Range','update','get','role','admin','user','Agents','agent','Telephones','telephone','filter','ignore','value','includes','name','destroy','stack','send','index','rawAttributes','map','fieldName','type','key','salt','where','User','includeAll','include','attributes','findAll','rows','query','openTabs','true','length','push','chat','dataValues','sms','fax','mail','openchannel','all','catch','show','params','model','differenceBy','keys','filters','intersection','fields','options','body','describe','addContacts','find','omit','ids','internal','findById','securePassword','validatePasswordPattern','max','min_internal','isNil','sequelize','QueryTypes','SELECT','from','voicemail','VoiceMail','password','email','permissions','101','102','103','113','110','104','105','106','108','111','114','115','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','each','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','Wrong\x20credentials','ValidationError','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','toLowerCase','penalty','spread','capitalize','QueueId','emit','Queue:save','voice','VoiceQueue','interface','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','channel','Queues','Queue:remove','addAvatar','file','filename','getAvatar','root','existsSync','join','userpic','download','server/files/images/','getOpenTabs','whatsapp','ChatOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','order','sort','pick','merge','hasOwnProperty','Tags','color','tag','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','LOCAL/%s@from-sip/n','intrf','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','DEFAULT\x20PAUSE','chatPause','faxPause','lastPauseAt','unpause','PAUSE','manual','%s%s','Pause','getTeams','addTeams','Team','setDataValue','Voice','getChatQueues','Chat','getMailQueues','getSmsQueues','Sms','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Mail','removeAgent','CmList','getLists','getAgents','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','concat','$and','$or','$gt','$gte','$ne','$eq','$not','$between','$notBetween','$notIn','$notILike','$like','$overlap','$contains','$contained','$any','firstName','lastName','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getPresence','teams','queues','inbound','col','toString','asc','desc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','InteractionId','field','ui.createdAt','_interactions','ui.UserId\x20=\x20?','OpenTabs','bluebird','util','path','lodash','squel'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x4888,0x198));var _0x8488=function(_0x40e1ed,_0x297e89){_0x40e1ed=_0x40e1ed-0x0;var _0x220ddd=_0x4888[_0x40e1ed];return _0x220ddd;};'use strict';var moment=require('moment');var BPromise=require(_0x8488('0x0'));var util=require(_0x8488('0x1'));var path=require(_0x8488('0x2'));var fs=require('fs');var _=require(_0x8488('0x3'));var squel=require(_0x8488('0x4'));var jayson=require(_0x8488('0x5'));var Redis=require(_0x8488('0x6'));var authService=require('../../components/auth/service');var qs=require(_0x8488('0x7'));var logger=require(_0x8488('0x8'))(_0x8488('0x9'));var utils=require(_0x8488('0xa'));var config=require(_0x8488('0xb'));var licenseUtil=require(_0x8488('0xc'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user.socket')[_0x8488('0xd')](socket);config[_0x8488('0xe')]=_['defaults'](config[_0x8488('0xe')],{'host':_0x8488('0xf'),'port':0x18eb});var client=jayson[_0x8488('0x10')][_0x8488('0x11')]({'port':0x232a});var values;function respondWithRpcPromise(_0x515ea8,_0x377d3b,_0x1909c9,_0x468896){return new BPromise(function(_0x256bab,_0x47146a){var _0x50ea94=_0x468896||client;return _0x50ea94[_0x8488('0x12')](_0x515ea8,_0x1909c9)[_0x8488('0x13')](function(_0x58f83d){logger['info'](_0x8488('0x14'),_0x377d3b,'request\x20sent');logger[_0x8488('0x15')]('User,\x20%s,\x20%s,\x20%s',_0x377d3b,'request\x20sent',JSON[_0x8488('0x16')](_0x58f83d));if(_0x58f83d[_0x8488('0x17')]){if(_0x58f83d[_0x8488('0x17')][_0x8488('0x18')]===0x1f4){logger[_0x8488('0x17')](_0x8488('0x14'),_0x377d3b,_0x58f83d[_0x8488('0x17')]['message']);return _0x47146a(_0x58f83d[_0x8488('0x17')][_0x8488('0x19')]);}logger[_0x8488('0x17')](_0x8488('0x14'),_0x377d3b,_0x58f83d[_0x8488('0x17')][_0x8488('0x19')]);return _0x256bab(_0x58f83d[_0x8488('0x17')][_0x8488('0x19')]);}else{logger[_0x8488('0x1a')](_0x8488('0x14'),_0x377d3b,_0x8488('0x1b'));_0x256bab(_0x58f83d[_0x8488('0x1c')][_0x8488('0x19')]);}})['catch'](function(_0x4a1b45){logger[_0x8488('0x17')](_0x8488('0x14'),_0x377d3b,_0x4a1b45);_0x47146a(_0x4a1b45);});});}function respondWithStatusCode(_0xbb10fe,_0x3c9fc2){_0x3c9fc2=_0x3c9fc2||0xcc;return function(_0x892236){if(_0x892236){return _0xbb10fe[_0x8488('0x1d')](_0x3c9fc2);}return _0xbb10fe[_0x8488('0x1e')](_0x3c9fc2)[_0x8488('0x1f')]();};}function respondWithResult(_0x39dd43,_0x5123d0){_0x5123d0=_0x5123d0||0xc8;return function(_0x476a14){if(_0x476a14){return _0x39dd43[_0x8488('0x1e')](_0x5123d0)[_0x8488('0x20')](_0x476a14);}};}function respondWithFilteredResult(_0x1361a6,_0x290b33){return function(_0x54ecda){if(_0x54ecda){var _0x577234=typeof _0x290b33['offset']==='undefined'&&typeof _0x290b33[_0x8488('0x21')]==='undefined';var _0x58057a=_0x54ecda[_0x8488('0x22')];var _0x2f350a=_0x577234?0x0:_0x290b33[_0x8488('0x23')];var _0x6ebee0=_0x577234?_0x54ecda[_0x8488('0x22')]:_0x290b33['offset']+_0x290b33[_0x8488('0x21')];var _0x38c137;if(_0x6ebee0>=_0x58057a){_0x6ebee0=_0x58057a;_0x38c137=0xc8;}else{_0x38c137=0xce;}_0x1361a6[_0x8488('0x1e')](_0x38c137);return _0x1361a6[_0x8488('0x24')](_0x8488('0x25'),_0x2f350a+'-'+_0x6ebee0+'/'+_0x58057a)[_0x8488('0x20')](_0x54ecda);}return null;};}function saveUpdates(_0x2c15ff){return function(_0x296b6c){if(_0x296b6c){return _0x296b6c[_0x8488('0x26')](_0x2c15ff)[_0x8488('0x13')](function(_0x888b24){return _0x888b24;});}return null;};}function removeEntity(_0x58d0cc){return function(_0x57ce3c){if(_0x57ce3c){return _0x57ce3c['destroy']()[_0x8488('0x13')](function(){var _0x408c36=_0x57ce3c[_0x8488('0x27')]({'plain':!![]});if(_0x408c36[_0x8488('0x28')]===_0x8488('0x29'))return;var _0x2f1399=[{'name':'Users','value':_0x8488('0x2a'),'ignore':!![]},{'name':_0x8488('0x2b'),'value':_0x8488('0x2c'),'ignore':![]},{'name':_0x8488('0x2d'),'value':_0x8488('0x2e'),'ignore':![]}];var _0x501981=_(_0x2f1399)[_0x8488('0x2f')](_0x8488('0x30'))['map'](_0x8488('0x31'))[_0x8488('0x31')]();if(_[_0x8488('0x32')](_0x501981,_0x408c36[_0x8488('0x28')])){return;}var _0x4555d0=_['find'](_0x2f1399,[_0x8488('0x31'),_0x408c36[_0x8488('0x28')]])[_0x8488('0x33')];return db['UserProfileResource'][_0x8488('0x34')]({'where':{'type':_0x4555d0,'resourceId':_0x408c36['id']}})['then'](function(){return _0x57ce3c;});})[_0x8488('0x13')](function(){_0x58d0cc[_0x8488('0x1e')](0xcc)[_0x8488('0x1f')]();});}};}function handleEntityNotFound(_0x16b0cd){return function(_0x4c3b59){if(!_0x4c3b59){_0x16b0cd[_0x8488('0x1d')](0x194);}return _0x4c3b59;};}function handleError(_0xe71bd9,_0x3939f2){_0x3939f2=_0x3939f2||0x1f4;return function(_0x583ece){logger[_0x8488('0x17')](_0x583ece[_0x8488('0x35')]);if(_0x583ece[_0x8488('0x33')]){delete _0x583ece[_0x8488('0x33')];}_0xe71bd9[_0x8488('0x1e')](_0x3939f2)[_0x8488('0x36')](_0x583ece);};}exports[_0x8488('0x37')]=function(_0x27ddb0,_0x1a8235){var _0x2171dc={},_0x3b6d07={'count':0x0,'rows':[]};var _0x4cb675=_(db['User'][_0x8488('0x38')])[_0x8488('0x39')](function(_0x3abb68){return{'name':_0x3abb68[_0x8488('0x3a')],'type':_0x3abb68[_0x8488('0x3b')][_0x8488('0x3c')]};})[_0x8488('0x2f')](function(_0x4481df){return!_[_0x8488('0x32')](['password',_0x8488('0x3d')],_0x4481df[_0x8488('0x33')]);})[_0x8488('0x31')]();_0x2171dc=qs['getOptions'](_0x4cb675,_0x27ddb0);var _0x207429={'where':_0x2171dc[_0x8488('0x3e')]};return db[_0x8488('0x3f')][_0x8488('0x22')](_0x207429)[_0x8488('0x13')](function(_0x156246){_0x3b6d07[_0x8488('0x22')]=_0x156246;if(_0x27ddb0['query'][_0x8488('0x40')]){_0x2171dc[_0x8488('0x41')]=[{'all':!![]}];}if(!_[_0x8488('0x32')](_0x2171dc['attributes'],'id')){_0x2171dc[_0x8488('0x42')]['push']('id');}return db[_0x8488('0x3f')][_0x8488('0x43')](_0x2171dc);})['then'](function(_0x22a3f3){_0x3b6d07[_0x8488('0x44')]=_0x22a3f3;if(_0x27ddb0[_0x8488('0x45')][_0x8488('0x46')]===_0x8488('0x47')){var _0x4e5c83=[];for(var _0x3724be=0x0;_0x3724be<_0x3b6d07['rows'][_0x8488('0x48')];_0x3724be++){_0x4e5c83[_0x8488('0x49')](get_open_tabs(_0x8488('0x4a'),_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));_0x4e5c83[_0x8488('0x49')](get_open_tabs(_0x8488('0x4c'),_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));_0x4e5c83[_0x8488('0x49')](get_open_tabs(_0x8488('0x4d'),_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));_0x4e5c83[_0x8488('0x49')](get_open_tabs(_0x8488('0x4e'),_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));_0x4e5c83['push'](get_open_tabs(_0x8488('0x4f'),_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));_0x4e5c83[_0x8488('0x49')](get_open_tabs('whatsapp',_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));}return BPromise[_0x8488('0x50')](_0x4e5c83)[_0x8488('0x13')](function(_0x52042c){return _0x3b6d07;});}else{return _0x3b6d07;}})[_0x8488('0x13')](respondWithFilteredResult(_0x1a8235,_0x2171dc))[_0x8488('0x51')](handleError(_0x1a8235,null));};exports[_0x8488('0x52')]=function(_0x33d6c9,_0x19a940){var _0x1157db={'raw':![],'where':{'id':_0x33d6c9[_0x8488('0x53')]['id']}},_0x886a9e={};_0x886a9e[_0x8488('0x54')]=_[_0x8488('0x55')](_[_0x8488('0x56')](db[_0x8488('0x3f')][_0x8488('0x38')]),['password','salt']);_0x886a9e[_0x8488('0x45')]=_[_0x8488('0x56')](_0x33d6c9[_0x8488('0x45')]);_0x886a9e[_0x8488('0x57')]=_[_0x8488('0x58')](_0x886a9e[_0x8488('0x54')],_0x886a9e[_0x8488('0x45')]);_0x1157db[_0x8488('0x42')]=_[_0x8488('0x58')](_0x886a9e['model'],qs[_0x8488('0x59')](_0x33d6c9[_0x8488('0x45')]['fields']));_0x1157db[_0x8488('0x42')]=_0x1157db[_0x8488('0x42')][_0x8488('0x48')]?_0x1157db[_0x8488('0x42')]:_0x886a9e['model'];if(_0x33d6c9[_0x8488('0x45')][_0x8488('0x40')]){_0x1157db[_0x8488('0x41')]=[{'all':!![]}];}_0x1157db=_['merge']({},_0x1157db,_0x33d6c9[_0x8488('0x5a')]);if(!_[_0x8488('0x32')](_0x1157db[_0x8488('0x42')],'id')){_0x1157db[_0x8488('0x42')]['push']('id');}return db[_0x8488('0x3f')]['find'](_0x1157db)['then'](handleEntityNotFound(_0x19a940,null))[_0x8488('0x13')](function(_0x5ca135){var _0x3453c7=[];values=_0x5ca135;if(_0x33d6c9[_0x8488('0x45')][_0x8488('0x46')]===_0x8488('0x47')){_0x3453c7[_0x8488('0x49')](get_open_tabs(_0x8488('0x4a'),_0x5ca135['dataValues']));_0x3453c7[_0x8488('0x49')](get_open_tabs(_0x8488('0x4c'),_0x5ca135[_0x8488('0x4b')]));_0x3453c7[_0x8488('0x49')](get_open_tabs(_0x8488('0x4f'),_0x5ca135['dataValues']));_0x3453c7[_0x8488('0x49')](get_open_tabs('whatsapp',_0x5ca135[_0x8488('0x4b')]));_0x3453c7[_0x8488('0x49')](get_open_tabs('fax',_0x5ca135[_0x8488('0x4b')]));_0x3453c7[_0x8488('0x49')](get_open_tabs(_0x8488('0x4e'),_0x5ca135[_0x8488('0x4b')]));return BPromise[_0x8488('0x50')](_0x3453c7);}else{return values;}})[_0x8488('0x13')](function(_0x59d0d4){return values;})[_0x8488('0x13')](respondWithResult(_0x19a940,null))['catch'](handleError(_0x19a940,null));};exports[_0x8488('0x26')]=function(_0x3fa6e2,_0x3c06a4){if(_0x3fa6e2[_0x8488('0x5b')]['id']){delete _0x3fa6e2[_0x8488('0x5b')]['id'];}delete _0x3fa6e2[_0x8488('0x5b')]['role'];return db[_0x8488('0x3f')]['find']({'where':{'id':_0x3fa6e2[_0x8488('0x53')]['id']}})[_0x8488('0x13')](handleEntityNotFound(_0x3c06a4,null))[_0x8488('0x13')](saveUpdates(_0x3fa6e2[_0x8488('0x5b')],null))[_0x8488('0x13')](respondWithResult(_0x3c06a4,null))[_0x8488('0x51')](handleError(_0x3c06a4,null));};exports['describe']=function(_0x5755af,_0x5c8310){return db[_0x8488('0x3f')][_0x8488('0x5c')]()[_0x8488('0x13')](respondWithResult(_0x5c8310,null))[_0x8488('0x51')](handleError(_0x5c8310,null));};exports[_0x8488('0x5d')]=function(_0x190e53,_0x2377db){return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x190e53[_0x8488('0x53')]['id']}})['then'](handleEntityNotFound(_0x2377db,null))[_0x8488('0x13')](function(_0x174c57){if(_0x174c57){return _0x174c57[_0x8488('0x5d')](_0x190e53['body']['ids'],_[_0x8488('0x5f')](_0x190e53[_0x8488('0x5b')],[_0x8488('0x60'),'id'])||{});}})[_0x8488('0x13')](respondWithResult(_0x2377db,null))['catch'](handleError(_0x2377db,null));};function validateUser(_0x4b7475){return new BPromise(function(_0x1577ce,_0x26e0cc){if(_0x4b7475[_0x8488('0x61')])return _0x1577ce(_0x4b7475);return db['Setting'][_0x8488('0x62')](0x1)[_0x8488('0x13')](function(_0x17149f){if(_0x17149f[_0x8488('0x63')])authService[_0x8488('0x64')](_0x4b7475['password']);db[_0x8488('0x3f')][_0x8488('0x65')]('internal')[_0x8488('0x13')](function(_0x1b981b){if(_['isNil'](_0x1b981b)){_0x4b7475[_0x8488('0x61')]=_0x17149f[_0x8488('0x66')]||0x1;return;}if(_[_0x8488('0x67')](_0x17149f[_0x8488('0x66')])||_0x17149f[_0x8488('0x66')]===_0x1b981b){_0x4b7475[_0x8488('0x61')]=_0x1b981b+0x1;return;}if(_0x17149f[_0x8488('0x66')]>_0x1b981b){_0x4b7475['internal']=_0x17149f[_0x8488('0x66')];return;}return db[_0x8488('0x68')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x8488('0x68')][_0x8488('0x69')][_0x8488('0x6a')]})['then'](function(_0xb85159){if(_0xb85159&&_0xb85159[_0x8488('0x48')]){for(var _0x56b35a=0x0,_0x42b5c5=_0xb85159['length'];_0x56b35a<_0x42b5c5&&_[_0x8488('0x67')](_0x4b7475[_0x8488('0x61')]);_0x56b35a++){if(_0x17149f[_0x8488('0x66')]<=_0xb85159[_0x56b35a]['from']){_0x4b7475[_0x8488('0x61')]=_0xb85159[_0x56b35a][_0x8488('0x6b')];}else if(_0x17149f['min_internal']>_0xb85159[_0x56b35a]['from']&&_0x17149f[_0x8488('0x66')]<=_0xb85159[_0x56b35a]['to']){_0x4b7475[_0x8488('0x61')]=_0x17149f[_0x8488('0x66')];}}}if(_[_0x8488('0x67')](_0x4b7475[_0x8488('0x61')])){_0x4b7475[_0x8488('0x61')]=_0x1b981b+0x1;}return _0x1577ce(_0x4b7475);});});})[_0x8488('0x51')](function(_0x4288ce){_0x26e0cc(_0x4288ce);});});}function updateUser(_0x1dee36){return new BPromise(function(_0x1ff111,_0x5da70b){try{if(_0x1dee36[_0x8488('0x6c')]){_0x1dee36['mailbox']=_0x1dee36[_0x8488('0x61')];_0x1dee36[_0x8488('0x6d')]={'mailbox':_0x1dee36[_0x8488('0x61')],'password':_0x1dee36[_0x8488('0x6e')],'fullname':_0x1dee36['fullname'],'email':_0x1dee36[_0x8488('0x6f')]};}if(_0x1dee36[_0x8488('0x28')]==='agent'){if(!_0x1dee36[_0x8488('0x70')])_0x1dee36['permissions']=[_0x8488('0x71'),_0x8488('0x72'),_0x8488('0x73'),_0x8488('0x74'),_0x8488('0x75'),_0x8488('0x76'),_0x8488('0x77'),_0x8488('0x78'),'107',_0x8488('0x79'),'109','100',_0x8488('0x7a'),_0x8488('0x7b'),_0x8488('0x7c')];}_0x1ff111(_0x1dee36);}catch(_0x481e4b){_0x5da70b(_0x481e4b);}});}exports['create']=function(_0x1f89f9,_0xee1aac){if(_0x1f89f9['user'][_0x8488('0x28')]===_0x8488('0x2c'))throw new Error(_0x8488('0x7d'));if(_0x1f89f9[_0x8488('0x5b')][_0x8488('0x28')]===_0x8488('0x2a')&&_0x1f89f9['user'][_0x8488('0x28')]!==_0x8488('0x29')){throw new Error(_0x8488('0x7e'));}if(_0x1f89f9['body'][_0x8488('0x28')]===_0x8488('0x29')&&_0x1f89f9[_0x8488('0x2a')]['role']!==_0x8488('0x29')){throw new Error(_0x8488('0x7f'));}return licenseUtil['checkUserLimits']([_0x1f89f9['body']])[_0x8488('0x13')](function(){return validateUser(_0x1f89f9[_0x8488('0x5b')]);})['then'](function(_0x353514){return updateUser(_0x353514)[_0x8488('0x13')](function(_0x5c63b1){if(_0x5c63b1['role']===_0x8488('0x29')){_0x5c63b1['settingsEnabled']=_0x1f89f9[_0x8488('0x2a')][_0x8488('0x80')];delete _0x5c63b1[_0x8488('0x81')];}return _0x5c63b1;});})[_0x8488('0x13')](function(_0x581ea2){return db[_0x8488('0x3f')]['create'](_0x581ea2,{'include':[{'model':db[_0x8488('0x6d')],'as':'VoiceMail'}]});})[_0x8488('0x13')](function(_0x1a3a2d){if(_0x1f89f9[_0x8488('0x5b')][_0x8488('0x28')]===_0x8488('0x2a'))return _0x1a3a2d;if(_0x1f89f9[_0x8488('0x2a')][_0x8488('0x28')]!==_0x8488('0x2a'))return _0x1a3a2d;return db[_0x8488('0x82')][_0x8488('0x5e')]({'where':{'name':_0x1a3a2d[_0x8488('0x28')]===_0x8488('0x2c')?_0x8488('0x2b'):_0x8488('0x2d'),'userProfileId':_0x1f89f9['user'][_0x8488('0x81')]},'raw':!![]})[_0x8488('0x13')](function(_0x55ddaf){if(!_0x55ddaf||_0x55ddaf[_0x8488('0x83')]!=0x0)return _0x1a3a2d;return db[_0x8488('0x84')][_0x8488('0x85')]({'name':_0x1a3a2d[_0x8488('0x33')],'resourceId':_0x1a3a2d['id'],'type':_0x55ddaf[_0x8488('0x33')],'sectionId':_0x55ddaf['id']},{})[_0x8488('0x13')](function(){return _0x1a3a2d;});})[_0x8488('0x51')](function(_0x42ce91){logger[_0x8488('0x17')](_0x8488('0x86'),_0x42ce91);throw _0x42ce91;});})[_0x8488('0x13')](respondWithResult(_0xee1aac,0xc9))['catch'](handleError(_0xee1aac,null));};exports[_0x8488('0x87')]=function(_0x1abac4,_0x51814e){var _0x1e509a=_0x1abac4[_0x8488('0x5b')];var _0x76c3c=[];if(_0x1abac4[_0x8488('0x2a')][_0x8488('0x28')]==='agent')throw new Error('Unauthorized');if(_[_0x8488('0x88')](_0x1e509a,[_0x8488('0x28'),_0x8488('0x2a')])&&_0x1abac4[_0x8488('0x2a')][_0x8488('0x28')]!==_0x8488('0x29')){throw new Error(_0x8488('0x7e'));}if(_[_0x8488('0x88')](_0x1e509a,[_0x8488('0x28'),_0x8488('0x29')])&&_0x1abac4[_0x8488('0x2a')][_0x8488('0x28')]!==_0x8488('0x29')){throw new Error(_0x8488('0x89'));}return licenseUtil[_0x8488('0x8a')](_0x1e509a)['then'](function(){return validateUser(_0x1e509a[0x0]);})[_0x8488('0x13')](function(){for(var _0x5d5234=0x1;_0x5d5234<_0x1e509a['length'];_0x5d5234++){var _0x1e25a3=_0x1e509a[_0x5d5234-0x1][_0x8488('0x61')];if(!_0x1e509a[_0x5d5234][_0x8488('0x61')])_0x1e509a[_0x5d5234][_0x8488('0x61')]=_0x1e25a3+0x1;_0x76c3c[_0x8488('0x49')](validateUser(_0x1e509a[_0x5d5234]));}return BPromise[_0x8488('0x50')](_0x76c3c);})[_0x8488('0x13')](function(){_0x76c3c=[];for(var _0x366eab=0x0;_0x366eab<_0x1e509a[_0x8488('0x48')];_0x366eab++){_0x76c3c[_0x8488('0x49')](updateUser(_0x1e509a[_0x366eab]));}return BPromise['all'](_0x76c3c);})[_0x8488('0x13')](function(){return BPromise[_0x8488('0x8b')](_0x1e509a,function(_0x179637){return db[_0x8488('0x3f')][_0x8488('0x85')](_0x179637,{'include':[{'model':db[_0x8488('0x6d')],'as':'VoiceMail'}]})[_0x8488('0x13')](function(_0x5b0d69){_0x179637['id']=_0x5b0d69['id'];return _0x179637;});});})[_0x8488('0x13')](function(_0x3936b6){if(_0x1abac4['body']['role']===_0x8488('0x2a'))return _0x3936b6;if(_0x1abac4[_0x8488('0x2a')][_0x8488('0x28')]!==_0x8488('0x2a'))return _0x3936b6;var _0xbec8a6=_['some'](_0x3936b6,function(_0x26fb11){return _0x26fb11[_0x8488('0x28')]==='agent'||_0x26fb11['role']===_0x8488('0x2e');});if(!_0xbec8a6)return _0x3936b6;return db[_0x8488('0x82')][_0x8488('0x43')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x1abac4[_0x8488('0x2a')][_0x8488('0x81')]},'raw':!![]})[_0x8488('0x13')](function(_0x57e71a){if(_[_0x8488('0x8c')](_0x57e71a)||!_[_0x8488('0x88')](_0x57e71a,[_0x8488('0x83'),0x0]))return _0x3936b6;_0x76c3c=[];var _0x39851c=_(_0x57e71a)[_0x8488('0x39')](function(_0xd6a03b){if(_0xd6a03b[_0x8488('0x83')]===0x1)return;return _0xd6a03b[_0x8488('0x33')]===_0x8488('0x2b')?_0x8488('0x2c'):_0x8488('0x2e');})[_0x8488('0x8d')]()[_0x8488('0x31')]();for(var _0x591a58=0x0;_0x591a58<_0x3936b6[_0x8488('0x48')];_0x591a58++){if(!_[_0x8488('0x32')](_0x39851c,_0x3936b6[_0x591a58][_0x8488('0x28')]))return;var _0x553785=_0x3936b6[_0x591a58][_0x8488('0x28')]==='agent'?_0x8488('0x2b'):'Telephones';_0x76c3c['push'](db[_0x8488('0x84')]['create']({'name':_0x3936b6[_0x591a58][_0x8488('0x33')],'resourceId':_0x3936b6[_0x591a58]['id'],'type':_0x553785,'sectionId':_[_0x8488('0x5e')](_0x57e71a,[_0x8488('0x33'),_0x553785])['id']},{}));}return BPromise[_0x8488('0x50')](_0x76c3c);});})['then'](respondWithResult(_0x51814e,0xc9))[_0x8488('0x51')](handleError(_0x51814e,null));};exports[_0x8488('0x8e')]=function(_0x477a86,_0x37ca73){if(_0x477a86['body']['id']){delete _0x477a86[_0x8488('0x5b')]['id'];}return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x477a86[_0x8488('0x53')]['id']}})[_0x8488('0x13')](function(_0x564c4d){if(!_0x564c4d)return null;if(_0x564c4d['id']===_0x477a86['user']['id']){if(!_0x477a86[_0x8488('0x5b')][_0x8488('0x8f')]||!_0x477a86[_0x8488('0x5b')][_0x8488('0x90')]){throw new db[(_0x8488('0x91'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x564c4d['authenticate'](_0x477a86[_0x8488('0x5b')][_0x8488('0x8f')])){throw new db[(_0x8488('0x91'))]['ValidationError'](_0x8488('0x92'));}if(_0x477a86[_0x8488('0x5b')]['oldPassword']===_0x477a86[_0x8488('0x5b')][_0x8488('0x90')]){throw new db[(_0x8488('0x91'))][(_0x8488('0x93'))](_0x8488('0x94'));}}else if(_0x477a86[_0x8488('0x2a')][_0x8488('0x28')]===_0x8488('0x29')){if(!_0x477a86[_0x8488('0x5b')][_0x8488('0x90')]){throw new db[(_0x8488('0x91'))][(_0x8488('0x93'))](_0x8488('0x95'));}}else if(_0x477a86['user'][_0x8488('0x28')]===_0x8488('0x2a')){if(!_0x477a86['body']['newPassword']){throw new db['Sequelize'][(_0x8488('0x93'))](_0x8488('0x95'));}if(_0x564c4d[_0x8488('0x28')]!=='agent'){throw new db[(_0x8488('0x91'))]['ValidationError'](_0x8488('0x7d'));}}else{throw new db[(_0x8488('0x91'))][(_0x8488('0x93'))](_0x8488('0x7d'));}return _0x564c4d;})[_0x8488('0x13')](handleEntityNotFound(_0x37ca73,null))['then'](function(_0x85093c){return db[_0x8488('0x96')][_0x8488('0x97')]({'attributes':['id',_0x8488('0x63'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x8488('0x13')](function(_0xfaf366){if(_0xfaf366[_0x8488('0x63')])authService[_0x8488('0x64')](_0x477a86[_0x8488('0x5b')][_0x8488('0x90')]);if(!_0xfaf366[_0x8488('0x98')]||!_0x85093c[_0x8488('0x99')])return _0x85093c;authService[_0x8488('0x9a')](_0x477a86[_0x8488('0x5b')][_0x8488('0x90')],_0x85093c[_0x8488('0x99')],_0xfaf366[_0x8488('0x9b')]);return _0x85093c;})[_0x8488('0x13')](saveUpdates({'password':_0x477a86['body']['newPassword'],'passwordResetAt':_0x477a86[_0x8488('0x2a')]['id']==_0x477a86[_0x8488('0x53')]['id']?moment():null,'previousPasswords':authService[_0x8488('0x9c')](_0x477a86[_0x8488('0x5b')][_0x8488('0x90')],_0x85093c[_0x8488('0x99')])},null));})[_0x8488('0x13')](respondWithResult(_0x37ca73,null))[_0x8488('0x51')](handleError(_0x37ca73,null));};exports[_0x8488('0x9d')]=function(_0x4d611a,_0x46195e){var _0x153c05=_0x4d611a[_0x8488('0x5b')]['channel'];return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x4d611a[_0x8488('0x53')]['id']},'attributes':['id',_0x8488('0x33'),_0x8488('0x28'),_0x8488('0x9e'),_0x8488('0x9f'),_0x8488('0xa0'),'interface']})['then'](handleEntityNotFound(_0x46195e,null))[_0x8488('0x13')](function(_0x215d7e){if(_0x215d7e){if(!utils[_0x8488('0xa1')](_0x153c05)){throw new db[(_0x8488('0x91'))][(_0x8488('0x93'))](_0x8488('0xa2'));}return _0x215d7e[_0x8488('0xa3')+_['capitalize'](_0x153c05[_0x8488('0xa4')]())+'Queues'](_0x4d611a[_0x8488('0x5b')][_0x8488('0x60')],{'penalty':_0x4d611a[_0x8488('0x5b')][_0x8488('0xa5')]||0x0})[_0x8488('0xa6')](function(_0x5eeb6d){for(var _0x27add0=0x0;_0x27add0<_0x4d611a[_0x8488('0x5b')][_0x8488('0x60')][_0x8488('0x48')];_0x27add0+=0x1){var _0x14e4a9={'UserId':Number(_0x4d611a[_0x8488('0x53')]['id'])};_0x14e4a9[_[_0x8488('0xa7')](_0x153c05['toLowerCase']())+_0x8488('0xa8')]=Number(_0x4d611a['body']['ids'][_0x27add0]);socket[_0x8488('0xa9')](_0x8488('0x2a')+_['capitalize'](_0x153c05[_0x8488('0xa4')]())+_0x8488('0xaa'),_0x14e4a9);}return _0x5eeb6d;})[_0x8488('0x13')](function(){if(_0x153c05===_0x8488('0xab')){return db[_0x8488('0xac')]['findAll']({'where':{'id':_0x4d611a['body'][_0x8488('0x60')]||[]},'raw':!![],'attributes':['id',_0x8488('0x33')]});}})[_0x8488('0x13')](function(_0x13abe8){var _0x3178fd=_0x215d7e['get']({'plain':!![]});var _0x4cfff4=[];if(_0x153c05===_0x8488('0xab')&&_0x3178fd[_0x8488('0x28')]===_0x8488('0x2c')&&_0x3178fd[_0x8488('0x9e')]){for(var _0x258985=0x0;_0x258985<_0x13abe8[_0x8488('0x48')];_0x258985+=0x1){_0x4cfff4[_0x8488('0x49')]({'membername':_0x3178fd[_0x8488('0x33')],'UserId':_0x3178fd['id'],'queue_name':_0x13abe8[_0x258985][_0x8488('0x33')],'VoiceQueueId':_0x13abe8[_0x258985]['id'],'interface':_[_0x8488('0x67')](_0x3178fd[_0x8488('0xad')])?util[_0x8488('0xae')](_0x8488('0xaf'),_0x3178fd[_0x8488('0x33')]):_0x3178fd['interface'],'paused':_0x3178fd[_0x8488('0xa0')]||![],'penalty':_0x4d611a[_0x8488('0x5b')][_0x8488('0xa5')]||0x0});}return BPromise['each'](_0x4cfff4,function(_0xfb02ed){return db[_0x8488('0xb0')][_0x8488('0xb1')](_0xfb02ed);});}return _0x215d7e;});}})['then'](respondWithStatusCode(_0x46195e,null))[_0x8488('0x51')](handleError(_0x46195e,null));};exports[_0x8488('0xb2')]=function(_0x5c7791,_0x310ffb){var _0x357136;return db['User'][_0x8488('0x5e')]({'where':{'id':_0x5c7791[_0x8488('0x53')]['id']},'attributes':['id',_0x8488('0x33'),_0x8488('0x28')]})[_0x8488('0x13')](handleEntityNotFound(_0x310ffb,null))[_0x8488('0x13')](function(_0x2ce70b){if(_0x2ce70b){_0x357136=_0x2ce70b;if(!_0x5c7791[_0x8488('0x45')][_0x8488('0xb3')]||!utils[_0x8488('0xa1')](_0x5c7791['query'][_0x8488('0xb3')])){throw new db[(_0x8488('0x91'))]['ValidationError'](_0x8488('0xa2'));}return _0x2ce70b['remove'+_[_0x8488('0xa7')](_0x5c7791[_0x8488('0x45')][_0x8488('0xb3')][_0x8488('0xa4')]())+_0x8488('0xb4')](_0x5c7791[_0x8488('0x45')]['ids']);}})[_0x8488('0x13')](function(_0x4da306){if(_['isArray'](_0x5c7791[_0x8488('0x45')][_0x8488('0x60')])){for(var _0x3dffa8=0x0;_0x3dffa8<_0x5c7791[_0x8488('0x45')]['ids']['length'];_0x3dffa8+=0x1){var _0x5ea079={'UserId':Number(_0x5c7791['params']['id'])};_0x5ea079[_[_0x8488('0xa7')](_0x5c7791[_0x8488('0x45')][_0x8488('0xb3')][_0x8488('0xa4')]())+_0x8488('0xa8')]=Number(_0x5c7791['query'][_0x8488('0x60')][_0x3dffa8]);socket[_0x8488('0xa9')](_0x8488('0x2a')+_['capitalize'](_0x5c7791['query'][_0x8488('0xb3')][_0x8488('0xa4')]())+'Queue:remove',_0x5ea079);}}else{var _0x5ea079={'UserId':Number(_0x5c7791[_0x8488('0x53')]['id'])};_0x5ea079[_[_0x8488('0xa7')](_0x5c7791[_0x8488('0x45')][_0x8488('0xb3')][_0x8488('0xa4')]())+_0x8488('0xa8')]=Number(_0x5c7791[_0x8488('0x45')][_0x8488('0x60')]);socket[_0x8488('0xa9')](_0x8488('0x2a')+_[_0x8488('0xa7')](_0x5c7791[_0x8488('0x45')][_0x8488('0xb3')][_0x8488('0xa4')]())+_0x8488('0xb5'),_0x5ea079);}return _0x4da306;})[_0x8488('0x13')](function(){if(_0x5c7791[_0x8488('0x45')]['channel']===_0x8488('0xab')){return db[_0x8488('0xb0')][_0x8488('0x34')]({'where':{'UserId':_0x5c7791['params']['id'],'VoiceQueueId':_0x5c7791[_0x8488('0x45')][_0x8488('0x60')]},'individualHooks':!![]})[_0x8488('0x13')](function(){return _0x357136;});}return _0x357136;})[_0x8488('0x13')](respondWithStatusCode(_0x310ffb,null))['catch'](handleError(_0x310ffb,null));};exports[_0x8488('0xb6')]=function(_0x479aca,_0xbd1f56){_0x479aca[_0x8488('0x5b')]['userpic']=_0x479aca[_0x8488('0xb7')][_0x8488('0xb8')];return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x479aca[_0x8488('0x53')]['id']}})[_0x8488('0x13')](handleEntityNotFound(_0xbd1f56,null))['then'](saveUpdates(_0x479aca['body'],null))[_0x8488('0x13')](respondWithResult(_0xbd1f56,null))[_0x8488('0x51')](handleError(_0xbd1f56,null));};exports[_0x8488('0xb9')]=function(_0x2628ba,_0x15a8de){var _0x590166=path['join'](config[_0x8488('0xba')],'server/files/images/logos/default_profile.png');return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x2628ba['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x8488('0x13')](handleEntityNotFound(_0x15a8de,null))[_0x8488('0x13')](function(_0x54ac42){if(_0x54ac42){if(_[_0x8488('0x67')](_0x54ac42['userpic'])){return _0x15a8de['download'](_0x590166);}else{if(!fs[_0x8488('0xbb')](path[_0x8488('0xbc')](config[_0x8488('0xba')],'server/files/images/',_0x54ac42[_0x8488('0xbd')]))){return _0x15a8de[_0x8488('0xbe')](_0x590166);}return _0x15a8de[_0x8488('0xbe')](path[_0x8488('0xbc')](config['root'],_0x8488('0xbf'),_0x54ac42[_0x8488('0xbd')]));}}})[_0x8488('0x51')](handleError(_0x15a8de,null));};exports[_0x8488('0xc0')]=function(_0x19f9ff,_0x778e6e){return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x19f9ff[_0x8488('0x53')]['id']},'attributes':['id']})[_0x8488('0x13')](handleEntityNotFound(_0x778e6e,null))[_0x8488('0x13')](function(_0x545002){var _0x4c94a2=[];values=_0x545002['dataValues'];_0x4c94a2[_0x8488('0x49')](get_open_tabs('chat',_0x545002[_0x8488('0x4b')]));_0x4c94a2['push'](get_open_tabs(_0x8488('0x4c'),_0x545002[_0x8488('0x4b')]));_0x4c94a2[_0x8488('0x49')](get_open_tabs(_0x8488('0x4f'),_0x545002['dataValues']));_0x4c94a2['push'](get_open_tabs(_0x8488('0xc1'),_0x545002['dataValues']));_0x4c94a2[_0x8488('0x49')](get_open_tabs('fax',_0x545002[_0x8488('0x4b')]));_0x4c94a2[_0x8488('0x49')](get_open_tabs('mail',_0x545002[_0x8488('0x4b')]));return BPromise[_0x8488('0x50')](_0x4c94a2);})[_0x8488('0x13')](function(_0x319912){var _0x63ed1c=[];if(_0x319912){for(var _0xd0ee30=0x0;_0xd0ee30=_0x2e1e63){_0x1a0acd=_0x2e1e63;_0x3a4fca=0xc8;}else{_0x3a4fca=0xce;}_0x4ca150[_0x5adb('0x1d')](_0x3a4fca);return _0x4ca150[_0x5adb('0x23')](_0x5adb('0x24'),_0x1feecf+'-'+_0x1a0acd+'/'+_0x2e1e63)['json'](_0x373cc3);}return null;};}function saveUpdates(_0x49992e){return function(_0x5d457e){if(_0x5d457e){return _0x5d457e[_0x5adb('0x25')](_0x49992e)[_0x5adb('0x26')](function(_0x60a672){return _0x60a672;});}return null;};}function removeEntity(_0x512bab){return function(_0x137a5c){if(_0x137a5c){return _0x137a5c['destroy']()[_0x5adb('0x26')](function(){var _0x34b793=_0x137a5c[_0x5adb('0x27')]({'plain':!![]});if(_0x34b793[_0x5adb('0x28')]===_0x5adb('0x29'))return;var _0x3145f2=[{'name':_0x5adb('0x2a'),'value':_0x5adb('0x2b'),'ignore':!![]},{'name':_0x5adb('0x2c'),'value':_0x5adb('0x2d'),'ignore':![]},{'name':'Telephones','value':_0x5adb('0x2e'),'ignore':![]}];var _0x4c8b2e=_(_0x3145f2)[_0x5adb('0x2f')](_0x5adb('0x30'))['map'](_0x5adb('0x31'))[_0x5adb('0x31')]();if(_[_0x5adb('0x32')](_0x4c8b2e,_0x34b793['role'])){return;}var _0x173789=_[_0x5adb('0x33')](_0x3145f2,['value',_0x34b793['role']])[_0x5adb('0x34')];return db['UserProfileResource'][_0x5adb('0x35')]({'where':{'type':_0x173789,'resourceId':_0x34b793['id']}})[_0x5adb('0x26')](function(){return _0x137a5c;});})[_0x5adb('0x26')](function(){_0x512bab[_0x5adb('0x1d')](0xcc)[_0x5adb('0x1e')]();});}};}function handleEntityNotFound(_0x5ece39){return function(_0x2f7abe){if(!_0x2f7abe){_0x5ece39[_0x5adb('0x36')](0x194);}return _0x2f7abe;};}function handleError(_0x1c3a5c,_0x54851b){_0x54851b=_0x54851b||0x1f4;return function(_0x4c8870){logger[_0x5adb('0x19')](_0x4c8870[_0x5adb('0x37')]);if(_0x4c8870['name']){delete _0x4c8870[_0x5adb('0x34')];}_0x1c3a5c['status'](_0x54851b)[_0x5adb('0x38')](_0x4c8870);};}exports['index']=function(_0x11cb37,_0x4d052f){var _0x1d9681={},_0x23a1db={'count':0x0,'rows':[]};var _0x4ccb27=_(db[_0x5adb('0x39')]['rawAttributes'])[_0x5adb('0x3a')](function(_0x34e828){return{'name':_0x34e828[_0x5adb('0x3b')],'type':_0x34e828['type'][_0x5adb('0x3c')]};})[_0x5adb('0x2f')](function(_0xcdaf8e){return!_[_0x5adb('0x32')]([_0x5adb('0x3d'),'salt'],_0xcdaf8e['name']);})['value']();_0x1d9681=qs['getOptions'](_0x4ccb27,_0x11cb37);var _0x427c71={'where':_0x1d9681[_0x5adb('0x3e')]};return db[_0x5adb('0x39')][_0x5adb('0x3f')](_0x427c71)[_0x5adb('0x26')](function(_0xd1c3c2){_0x23a1db[_0x5adb('0x3f')]=_0xd1c3c2;if(_0x11cb37[_0x5adb('0x40')]['includeAll']){_0x1d9681['include']=[{'all':!![]}];}if(!_[_0x5adb('0x32')](_0x1d9681['attributes'],'id')){_0x1d9681[_0x5adb('0x41')][_0x5adb('0x42')]('id');}return db[_0x5adb('0x39')][_0x5adb('0x43')](_0x1d9681);})[_0x5adb('0x26')](function(_0x522ee5){_0x23a1db[_0x5adb('0x44')]=_0x522ee5;if(_0x11cb37[_0x5adb('0x40')]['openTabs']===_0x5adb('0x45')){var _0x1a256c=[];for(var _0x5833c8=0x0;_0x5833c8<_0x23a1db[_0x5adb('0x44')][_0x5adb('0x46')];_0x5833c8++){_0x1a256c[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x47'),_0x23a1db[_0x5adb('0x44')][_0x5833c8][_0x5adb('0x48')]));_0x1a256c[_0x5adb('0x42')](get_open_tabs('sms',_0x23a1db['rows'][_0x5833c8][_0x5adb('0x48')]));_0x1a256c[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x49'),_0x23a1db[_0x5adb('0x44')][_0x5833c8]['dataValues']));_0x1a256c['push'](get_open_tabs(_0x5adb('0x4a'),_0x23a1db[_0x5adb('0x44')][_0x5833c8][_0x5adb('0x48')]));_0x1a256c[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x4b'),_0x23a1db['rows'][_0x5833c8][_0x5adb('0x48')]));_0x1a256c[_0x5adb('0x42')](get_open_tabs('whatsapp',_0x23a1db[_0x5adb('0x44')][_0x5833c8][_0x5adb('0x48')]));}return BPromise[_0x5adb('0x4c')](_0x1a256c)[_0x5adb('0x26')](function(_0x186bd2){return _0x23a1db;});}else{return _0x23a1db;}})[_0x5adb('0x26')](respondWithFilteredResult(_0x4d052f,_0x1d9681))[_0x5adb('0x1c')](handleError(_0x4d052f,null));};exports[_0x5adb('0x4d')]=function(_0x49e1a1,_0x3a925b){var _0x57dc8b={'raw':![],'where':{'id':_0x49e1a1['params']['id']}},_0x51bc49={};_0x51bc49[_0x5adb('0x4e')]=_[_0x5adb('0x4f')](_[_0x5adb('0x50')](db['User'][_0x5adb('0x51')]),['password',_0x5adb('0x52')]);_0x51bc49[_0x5adb('0x40')]=_[_0x5adb('0x50')](_0x49e1a1['query']);_0x51bc49[_0x5adb('0x53')]=_['intersection'](_0x51bc49[_0x5adb('0x4e')],_0x51bc49[_0x5adb('0x40')]);_0x57dc8b['attributes']=_[_0x5adb('0x54')](_0x51bc49[_0x5adb('0x4e')],qs[_0x5adb('0x55')](_0x49e1a1[_0x5adb('0x40')][_0x5adb('0x55')]));_0x57dc8b['attributes']=_0x57dc8b[_0x5adb('0x41')][_0x5adb('0x46')]?_0x57dc8b[_0x5adb('0x41')]:_0x51bc49[_0x5adb('0x4e')];if(_0x49e1a1['query'][_0x5adb('0x56')]){_0x57dc8b[_0x5adb('0x57')]=[{'all':!![]}];}_0x57dc8b=_[_0x5adb('0x58')]({},_0x57dc8b,_0x49e1a1['options']);if(!_[_0x5adb('0x32')](_0x57dc8b[_0x5adb('0x41')],'id')){_0x57dc8b[_0x5adb('0x41')][_0x5adb('0x42')]('id');}return db['User'][_0x5adb('0x33')](_0x57dc8b)[_0x5adb('0x26')](handleEntityNotFound(_0x3a925b,null))[_0x5adb('0x26')](function(_0x2cee37){var _0xa25ac3=[];values=_0x2cee37;if(_0x49e1a1['query'][_0x5adb('0x59')]==='true'){_0xa25ac3[_0x5adb('0x42')](get_open_tabs('chat',_0x2cee37[_0x5adb('0x48')]));_0xa25ac3[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x5a'),_0x2cee37[_0x5adb('0x48')]));_0xa25ac3['push'](get_open_tabs(_0x5adb('0x4b'),_0x2cee37[_0x5adb('0x48')]));_0xa25ac3[_0x5adb('0x42')](get_open_tabs('whatsapp',_0x2cee37['dataValues']));_0xa25ac3['push'](get_open_tabs(_0x5adb('0x49'),_0x2cee37[_0x5adb('0x48')]));_0xa25ac3[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x4a'),_0x2cee37[_0x5adb('0x48')]));return BPromise[_0x5adb('0x4c')](_0xa25ac3);}else{return values;}})[_0x5adb('0x26')](function(_0x8d7810){return values;})[_0x5adb('0x26')](respondWithResult(_0x3a925b,null))[_0x5adb('0x1c')](handleError(_0x3a925b,null));};exports[_0x5adb('0x25')]=function(_0x1df439,_0x2c2357){if(_0x1df439['body']['id']){delete _0x1df439['body']['id'];}delete _0x1df439[_0x5adb('0x5b')][_0x5adb('0x28')];return db[_0x5adb('0x39')][_0x5adb('0x33')]({'where':{'id':_0x1df439['params']['id']}})[_0x5adb('0x26')](handleEntityNotFound(_0x2c2357,null))[_0x5adb('0x26')](saveUpdates(_0x1df439['body'],null))[_0x5adb('0x26')](respondWithResult(_0x2c2357,null))[_0x5adb('0x1c')](handleError(_0x2c2357,null));};exports[_0x5adb('0x5c')]=function(_0x5edd60,_0x30d185){return db[_0x5adb('0x39')][_0x5adb('0x5c')]()[_0x5adb('0x26')](respondWithResult(_0x30d185,null))[_0x5adb('0x1c')](handleError(_0x30d185,null));};exports[_0x5adb('0x5d')]=function(_0x513f26,_0x836b91){return db[_0x5adb('0x39')][_0x5adb('0x33')]({'where':{'id':_0x513f26['params']['id']}})[_0x5adb('0x26')](handleEntityNotFound(_0x836b91,null))[_0x5adb('0x26')](function(_0x343aa4){if(_0x343aa4){return _0x343aa4['addContacts'](_0x513f26[_0x5adb('0x5b')]['ids'],_[_0x5adb('0x5e')](_0x513f26[_0x5adb('0x5b')],[_0x5adb('0x5f'),'id'])||{});}})['then'](respondWithResult(_0x836b91,null))[_0x5adb('0x1c')](handleError(_0x836b91,null));};function validateUser(_0x3627d1){return new BPromise(function(_0x539814,_0x12711e){if(_0x3627d1[_0x5adb('0x60')])return _0x539814(_0x3627d1);return db[_0x5adb('0x61')][_0x5adb('0x62')](0x1)['then'](function(_0x4290bb){if(_0x4290bb[_0x5adb('0x63')])authService[_0x5adb('0x64')](_0x3627d1[_0x5adb('0x3d')]);db['User']['max'](_0x5adb('0x60'))['then'](function(_0x4d635f){if(_['isNil'](_0x4d635f)){_0x3627d1[_0x5adb('0x60')]=_0x4290bb[_0x5adb('0x65')]||0x1;return;}if(_['isNil'](_0x4290bb[_0x5adb('0x65')])||_0x4290bb[_0x5adb('0x65')]===_0x4d635f){_0x3627d1[_0x5adb('0x60')]=_0x4d635f+0x1;return;}if(_0x4290bb[_0x5adb('0x65')]>_0x4d635f){_0x3627d1[_0x5adb('0x60')]=_0x4290bb[_0x5adb('0x65')];return;}return db[_0x5adb('0x66')][_0x5adb('0x40')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize']['QueryTypes'][_0x5adb('0x67')]})[_0x5adb('0x26')](function(_0x3a0d1b){if(_0x3a0d1b&&_0x3a0d1b[_0x5adb('0x46')]){for(var _0x1f59bb=0x0,_0x2f6ef7=_0x3a0d1b[_0x5adb('0x46')];_0x1f59bb<_0x2f6ef7&&_[_0x5adb('0x68')](_0x3627d1['internal']);_0x1f59bb++){if(_0x4290bb['min_internal']<=_0x3a0d1b[_0x1f59bb][_0x5adb('0x69')]){_0x3627d1[_0x5adb('0x60')]=_0x3a0d1b[_0x1f59bb][_0x5adb('0x69')];}else if(_0x4290bb[_0x5adb('0x65')]>_0x3a0d1b[_0x1f59bb][_0x5adb('0x69')]&&_0x4290bb[_0x5adb('0x65')]<=_0x3a0d1b[_0x1f59bb]['to']){_0x3627d1[_0x5adb('0x60')]=_0x4290bb[_0x5adb('0x65')];}}}if(_[_0x5adb('0x68')](_0x3627d1[_0x5adb('0x60')])){_0x3627d1['internal']=_0x4d635f+0x1;}return _0x539814(_0x3627d1);});});})[_0x5adb('0x1c')](function(_0x294a24){_0x12711e(_0x294a24);});});}function updateUser(_0x25ac26){return new BPromise(function(_0x5d3aa4,_0x31f041){try{if(_0x25ac26[_0x5adb('0x6a')]){_0x25ac26['mailbox']=_0x25ac26[_0x5adb('0x60')];_0x25ac26['VoiceMail']={'mailbox':_0x25ac26[_0x5adb('0x60')],'password':_0x25ac26[_0x5adb('0x3d')],'fullname':_0x25ac26['fullname'],'email':_0x25ac26[_0x5adb('0x6b')]};}if(_0x25ac26[_0x5adb('0x28')]===_0x5adb('0x2d')){if(!_0x25ac26[_0x5adb('0x6c')])_0x25ac26[_0x5adb('0x6c')]=[_0x5adb('0x6d'),_0x5adb('0x6e'),_0x5adb('0x6f'),'113',_0x5adb('0x70'),_0x5adb('0x71'),_0x5adb('0x72'),'106','107',_0x5adb('0x73'),'109',_0x5adb('0x74'),_0x5adb('0x75'),_0x5adb('0x76'),'115'];}_0x5d3aa4(_0x25ac26);}catch(_0x3a9735){_0x31f041(_0x3a9735);}});}exports[_0x5adb('0x77')]=function(_0x2e3df9,_0x3ecc56){if(_0x2e3df9[_0x5adb('0x2b')]['role']===_0x5adb('0x2d'))throw new Error(_0x5adb('0x78'));if(_0x2e3df9[_0x5adb('0x5b')][_0x5adb('0x28')]==='user'&&_0x2e3df9[_0x5adb('0x2b')][_0x5adb('0x28')]!==_0x5adb('0x29')){throw new Error(_0x5adb('0x79'));}if(_0x2e3df9[_0x5adb('0x5b')][_0x5adb('0x28')]===_0x5adb('0x29')&&_0x2e3df9['user'][_0x5adb('0x28')]!==_0x5adb('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x5adb('0x7a')]([_0x2e3df9[_0x5adb('0x5b')]])['then'](function(){return validateUser(_0x2e3df9[_0x5adb('0x5b')]);})['then'](function(_0x372354){return updateUser(_0x372354)[_0x5adb('0x26')](function(_0x4a2ebc){if(_0x4a2ebc[_0x5adb('0x28')]==='admin'){_0x4a2ebc[_0x5adb('0x7b')]=_0x2e3df9[_0x5adb('0x2b')][_0x5adb('0x7b')];delete _0x4a2ebc[_0x5adb('0x7c')];}return _0x4a2ebc;});})[_0x5adb('0x26')](function(_0x4dbcd9){return db[_0x5adb('0x39')][_0x5adb('0x77')](_0x4dbcd9,{'include':[{'model':db[_0x5adb('0x7d')],'as':_0x5adb('0x7d')}]});})['then'](function(_0x5e875c){if(_0x2e3df9[_0x5adb('0x5b')][_0x5adb('0x28')]===_0x5adb('0x2b'))return _0x5e875c;if(_0x2e3df9[_0x5adb('0x2b')][_0x5adb('0x28')]!==_0x5adb('0x2b'))return _0x5e875c;return db[_0x5adb('0x7e')]['find']({'where':{'name':_0x5e875c[_0x5adb('0x28')]===_0x5adb('0x2d')?_0x5adb('0x2c'):_0x5adb('0x7f'),'userProfileId':_0x2e3df9['user'][_0x5adb('0x7c')]},'raw':!![]})[_0x5adb('0x26')](function(_0x243016){if(!_0x243016||_0x243016[_0x5adb('0x80')]!=0x0)return _0x5e875c;return db[_0x5adb('0x81')][_0x5adb('0x77')]({'name':_0x5e875c[_0x5adb('0x34')],'resourceId':_0x5e875c['id'],'type':_0x243016[_0x5adb('0x34')],'sectionId':_0x243016['id']},{})[_0x5adb('0x26')](function(){return _0x5e875c;});})['catch'](function(_0x2a3e17){logger[_0x5adb('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a3e17);throw _0x2a3e17;});})[_0x5adb('0x26')](respondWithResult(_0x3ecc56,0xc9))[_0x5adb('0x1c')](handleError(_0x3ecc56,null));};exports[_0x5adb('0x82')]=function(_0x3bb3fc,_0x200221){var _0x1bbc2e=_0x3bb3fc[_0x5adb('0x5b')];var _0x350bb1=[];if(_0x3bb3fc['user'][_0x5adb('0x28')]===_0x5adb('0x2d'))throw new Error('Unauthorized');if(_[_0x5adb('0x83')](_0x1bbc2e,[_0x5adb('0x28'),_0x5adb('0x2b')])&&_0x3bb3fc['user']['role']!==_0x5adb('0x29')){throw new Error(_0x5adb('0x79'));}if(_[_0x5adb('0x83')](_0x1bbc2e,['role',_0x5adb('0x29')])&&_0x3bb3fc[_0x5adb('0x2b')][_0x5adb('0x28')]!==_0x5adb('0x29')){throw new Error(_0x5adb('0x84'));}return licenseUtil[_0x5adb('0x7a')](_0x1bbc2e)[_0x5adb('0x26')](function(){return validateUser(_0x1bbc2e[0x0]);})[_0x5adb('0x26')](function(){for(var _0x28bd33=0x1;_0x28bd33<_0x1bbc2e[_0x5adb('0x46')];_0x28bd33++){var _0x423b80=_0x1bbc2e[_0x28bd33-0x1][_0x5adb('0x60')];if(!_0x1bbc2e[_0x28bd33]['internal'])_0x1bbc2e[_0x28bd33]['internal']=_0x423b80+0x1;_0x350bb1[_0x5adb('0x42')](validateUser(_0x1bbc2e[_0x28bd33]));}return BPromise[_0x5adb('0x4c')](_0x350bb1);})['then'](function(){_0x350bb1=[];for(var _0x3f6975=0x0;_0x3f6975<_0x1bbc2e[_0x5adb('0x46')];_0x3f6975++){_0x350bb1[_0x5adb('0x42')](updateUser(_0x1bbc2e[_0x3f6975]));}return BPromise[_0x5adb('0x4c')](_0x350bb1);})[_0x5adb('0x26')](function(){return BPromise[_0x5adb('0x85')](_0x1bbc2e,function(_0x15626b){return db[_0x5adb('0x39')][_0x5adb('0x77')](_0x15626b,{'include':[{'model':db['VoiceMail'],'as':_0x5adb('0x7d')}]})[_0x5adb('0x26')](function(_0x273785){_0x15626b['id']=_0x273785['id'];return _0x15626b;});});})['then'](function(_0x312a90){if(_0x3bb3fc[_0x5adb('0x5b')][_0x5adb('0x28')]===_0x5adb('0x2b'))return _0x312a90;if(_0x3bb3fc[_0x5adb('0x2b')][_0x5adb('0x28')]!=='user')return _0x312a90;var _0x13a4aa=_[_0x5adb('0x83')](_0x312a90,function(_0x3fb91b){return _0x3fb91b[_0x5adb('0x28')]===_0x5adb('0x2d')||_0x3fb91b[_0x5adb('0x28')]===_0x5adb('0x2e');});if(!_0x13a4aa)return _0x312a90;return db[_0x5adb('0x7e')][_0x5adb('0x43')]({'where':{'name':{'$or':[_0x5adb('0x2c'),'Telephones']},'userProfileId':_0x3bb3fc[_0x5adb('0x2b')]['userProfileId']},'raw':!![]})[_0x5adb('0x26')](function(_0x2e0a49){if(_[_0x5adb('0x86')](_0x2e0a49)||!_[_0x5adb('0x83')](_0x2e0a49,[_0x5adb('0x80'),0x0]))return _0x312a90;_0x350bb1=[];var _0x5c7b1b=_(_0x2e0a49)['map'](function(_0x1aa301){if(_0x1aa301[_0x5adb('0x80')]===0x1)return;return _0x1aa301[_0x5adb('0x34')]===_0x5adb('0x2c')?_0x5adb('0x2d'):_0x5adb('0x2e');})['compact']()['value']();for(var _0x38c4a5=0x0;_0x38c4a5<_0x312a90[_0x5adb('0x46')];_0x38c4a5++){if(!_[_0x5adb('0x32')](_0x5c7b1b,_0x312a90[_0x38c4a5]['role']))return;var _0x542626=_0x312a90[_0x38c4a5][_0x5adb('0x28')]==='agent'?_0x5adb('0x2c'):_0x5adb('0x7f');_0x350bb1['push'](db['UserProfileResource'][_0x5adb('0x77')]({'name':_0x312a90[_0x38c4a5]['name'],'resourceId':_0x312a90[_0x38c4a5]['id'],'type':_0x542626,'sectionId':_['find'](_0x2e0a49,[_0x5adb('0x34'),_0x542626])['id']},{}));}return BPromise[_0x5adb('0x4c')](_0x350bb1);});})[_0x5adb('0x26')](respondWithResult(_0x200221,0xc9))[_0x5adb('0x1c')](handleError(_0x200221,null));};exports[_0x5adb('0x87')]=function(_0x133ea9,_0xa51ffc){if(_0x133ea9[_0x5adb('0x5b')]['id']){delete _0x133ea9[_0x5adb('0x5b')]['id'];}return db[_0x5adb('0x39')][_0x5adb('0x33')]({'where':{'id':_0x133ea9[_0x5adb('0x88')]['id']}})[_0x5adb('0x26')](function(_0x4f4898){if(!_0x4f4898)return null;if(_0x4f4898['id']===_0x133ea9[_0x5adb('0x2b')]['id']){if(!_0x133ea9['body'][_0x5adb('0x89')]||!_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')]){throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x8d'));}if(!_0x4f4898[_0x5adb('0x8e')](_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x89')])){throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x8f'));}if(_0x133ea9['body'][_0x5adb('0x89')]===_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')]){throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x90'));}}else if(_0x133ea9[_0x5adb('0x2b')][_0x5adb('0x28')]==='admin'){if(!_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')]){throw new db[(_0x5adb('0x8b'))]['ValidationError'](_0x5adb('0x91'));}}else if(_0x133ea9['user'][_0x5adb('0x28')]==='user'){if(!_0x133ea9['body'][_0x5adb('0x8a')]){throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x91'));}if(_0x4f4898[_0x5adb('0x28')]!==_0x5adb('0x2d')){throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x78'));}}else{throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x78'));}return _0x4f4898;})['then'](handleEntityNotFound(_0xa51ffc,null))[_0x5adb('0x26')](function(_0x521dde){return db[_0x5adb('0x61')][_0x5adb('0x92')]({'attributes':['id','securePassword',_0x5adb('0x93'),_0x5adb('0x94')]})['then'](function(_0x4b367d){if(_0x4b367d[_0x5adb('0x63')])authService[_0x5adb('0x64')](_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')]);if(!_0x4b367d[_0x5adb('0x93')]||!_0x521dde[_0x5adb('0x95')])return _0x521dde;authService['validatePasswordHistory'](_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')],_0x521dde[_0x5adb('0x95')],_0x4b367d[_0x5adb('0x94')]);return _0x521dde;})[_0x5adb('0x26')](saveUpdates({'password':_0x133ea9['body']['newPassword'],'passwordResetAt':_0x133ea9[_0x5adb('0x2b')]['id']==_0x133ea9[_0x5adb('0x88')]['id']?moment():null,'previousPasswords':authService[_0x5adb('0x96')](_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')],_0x521dde[_0x5adb('0x95')])},null));})[_0x5adb('0x26')](respondWithResult(_0xa51ffc,null))[_0x5adb('0x1c')](handleError(_0xa51ffc,null));};exports[_0x5adb('0x97')]=function(_0x4fedea,_0x2102f3){var _0x2d7264=_0x4fedea['body']['channel'];return db['User'][_0x5adb('0x33')]({'where':{'id':_0x4fedea[_0x5adb('0x88')]['id']},'attributes':['id',_0x5adb('0x34'),'role','online',_0x5adb('0x98'),_0x5adb('0x99'),_0x5adb('0x9a')]})[_0x5adb('0x26')](handleEntityNotFound(_0x2102f3,null))[_0x5adb('0x26')](function(_0x44cd22){if(_0x44cd22){if(!utils['isValidChannel'](_0x2d7264)){throw new db['Sequelize'][(_0x5adb('0x8c'))]('Unknown\x20channel');}return _0x44cd22[_0x5adb('0x9b')+_[_0x5adb('0x9c')](_0x2d7264['toLowerCase']())+_0x5adb('0x9d')](_0x4fedea[_0x5adb('0x5b')][_0x5adb('0x5f')],{'penalty':_0x4fedea[_0x5adb('0x5b')]['penalty']||0x0})[_0x5adb('0x9e')](function(_0x398188){for(var _0x21a51f=0x0;_0x21a51f<_0x4fedea[_0x5adb('0x5b')]['ids'][_0x5adb('0x46')];_0x21a51f+=0x1){var _0x559938={'UserId':Number(_0x4fedea[_0x5adb('0x88')]['id'])};_0x559938[_[_0x5adb('0x9c')](_0x2d7264[_0x5adb('0x9f')]())+_0x5adb('0xa0')]=Number(_0x4fedea[_0x5adb('0x5b')][_0x5adb('0x5f')][_0x21a51f]);socket['emit'](_0x5adb('0x2b')+_[_0x5adb('0x9c')](_0x2d7264[_0x5adb('0x9f')]())+_0x5adb('0xa1'),_0x559938);}return _0x398188;})['then'](function(){if(_0x2d7264===_0x5adb('0xa2')){return db['VoiceQueue']['findAll']({'where':{'id':_0x4fedea['body'][_0x5adb('0x5f')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x1d3771){var _0x143f33=_0x44cd22[_0x5adb('0x27')]({'plain':!![]});var _0x2d6898=[];if(_0x2d7264===_0x5adb('0xa2')&&_0x143f33[_0x5adb('0x28')]===_0x5adb('0x2d')&&_0x143f33['online']){for(var _0x59d227=0x0;_0x59d227<_0x1d3771[_0x5adb('0x46')];_0x59d227+=0x1){_0x2d6898['push']({'membername':_0x143f33[_0x5adb('0x34')],'UserId':_0x143f33['id'],'queue_name':_0x1d3771[_0x59d227][_0x5adb('0x34')],'VoiceQueueId':_0x1d3771[_0x59d227]['id'],'interface':_[_0x5adb('0x68')](_0x143f33[_0x5adb('0x9a')])?util[_0x5adb('0xa3')](_0x5adb('0xa4'),_0x143f33[_0x5adb('0x34')]):_0x143f33[_0x5adb('0x9a')],'paused':_0x143f33[_0x5adb('0x99')]||![],'penalty':_0x4fedea[_0x5adb('0x5b')][_0x5adb('0xa5')]||0x0});}return BPromise[_0x5adb('0x85')](_0x2d6898,function(_0x4871b1){return db['UserVoiceQueueRt'][_0x5adb('0xa6')](_0x4871b1);});}return _0x44cd22;});}})[_0x5adb('0x26')](respondWithStatusCode(_0x2102f3,null))[_0x5adb('0x1c')](handleError(_0x2102f3,null));};exports[_0x5adb('0xa7')]=function(_0x587101,_0x477b6d){var _0x380ccc;return db[_0x5adb('0x39')][_0x5adb('0x33')]({'where':{'id':_0x587101[_0x5adb('0x88')]['id']},'attributes':['id','name','role']})[_0x5adb('0x26')](handleEntityNotFound(_0x477b6d,null))['then'](function(_0x182975){if(_0x182975){_0x380ccc=_0x182975;if(!_0x587101[_0x5adb('0x40')][_0x5adb('0xa8')]||!utils[_0x5adb('0xa9')](_0x587101[_0x5adb('0x40')][_0x5adb('0xa8')])){throw new db['Sequelize'][(_0x5adb('0x8c'))](_0x5adb('0xaa'));}return _0x182975[_0x5adb('0xab')+_[_0x5adb('0x9c')](_0x587101[_0x5adb('0x40')][_0x5adb('0xa8')][_0x5adb('0x9f')]())+'Queues'](_0x587101['query']['ids']);}})[_0x5adb('0x26')](function(_0x5ae730){if(_[_0x5adb('0xac')](_0x587101['query']['ids'])){for(var _0x3420fa=0x0;_0x3420fa<_0x587101[_0x5adb('0x40')]['ids']['length'];_0x3420fa+=0x1){var _0x272f92={'UserId':Number(_0x587101[_0x5adb('0x88')]['id'])};_0x272f92[_[_0x5adb('0x9c')](_0x587101['query'][_0x5adb('0xa8')]['toLowerCase']())+'QueueId']=Number(_0x587101[_0x5adb('0x40')][_0x5adb('0x5f')][_0x3420fa]);socket[_0x5adb('0xad')]('user'+_['capitalize'](_0x587101[_0x5adb('0x40')][_0x5adb('0xa8')]['toLowerCase']())+'Queue:remove',_0x272f92);}}else{var _0x272f92={'UserId':Number(_0x587101[_0x5adb('0x88')]['id'])};_0x272f92[_['capitalize'](_0x587101[_0x5adb('0x40')]['channel'][_0x5adb('0x9f')]())+'QueueId']=Number(_0x587101[_0x5adb('0x40')][_0x5adb('0x5f')]);socket[_0x5adb('0xad')](_0x5adb('0x2b')+_[_0x5adb('0x9c')](_0x587101['query'][_0x5adb('0xa8')][_0x5adb('0x9f')]())+_0x5adb('0xae'),_0x272f92);}return _0x5ae730;})['then'](function(){if(_0x587101[_0x5adb('0x40')][_0x5adb('0xa8')]===_0x5adb('0xa2')){return db[_0x5adb('0xaf')]['destroy']({'where':{'UserId':_0x587101[_0x5adb('0x88')]['id'],'VoiceQueueId':_0x587101[_0x5adb('0x40')][_0x5adb('0x5f')]},'individualHooks':!![]})['then'](function(){return _0x380ccc;});}return _0x380ccc;})[_0x5adb('0x26')](respondWithStatusCode(_0x477b6d,null))['catch'](handleError(_0x477b6d,null));};exports[_0x5adb('0xb0')]=function(_0x2ccc31,_0x20ad43){_0x2ccc31[_0x5adb('0x5b')][_0x5adb('0xb1')]=_0x2ccc31['file']['filename'];return db['User'][_0x5adb('0x33')]({'where':{'id':_0x2ccc31['params']['id']}})['then'](handleEntityNotFound(_0x20ad43,null))[_0x5adb('0x26')](saveUpdates(_0x2ccc31[_0x5adb('0x5b')],null))[_0x5adb('0x26')](respondWithResult(_0x20ad43,null))[_0x5adb('0x1c')](handleError(_0x20ad43,null));};exports[_0x5adb('0xb2')]=function(_0x2d58b8,_0x2a9cc9){var _0x338404=path['join'](config[_0x5adb('0xb3')],_0x5adb('0xb4'));return db['User'][_0x5adb('0x33')]({'where':{'id':_0x2d58b8[_0x5adb('0x88')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x5adb('0x26')](handleEntityNotFound(_0x2a9cc9,null))['then'](function(_0x3bff0c){if(_0x3bff0c){if(_[_0x5adb('0x68')](_0x3bff0c[_0x5adb('0xb1')])){return _0x2a9cc9[_0x5adb('0xb5')](_0x338404);}else{if(!fs[_0x5adb('0xb6')](path[_0x5adb('0xb7')](config[_0x5adb('0xb3')],_0x5adb('0xb8'),_0x3bff0c['userpic']))){return _0x2a9cc9[_0x5adb('0xb5')](_0x338404);}return _0x2a9cc9['download'](path[_0x5adb('0xb7')](config['root'],_0x5adb('0xb8'),_0x3bff0c['userpic']));}}})[_0x5adb('0x1c')](handleError(_0x2a9cc9,null));};exports[_0x5adb('0xb9')]=function(_0x123e79,_0x759016){return db[_0x5adb('0x39')][_0x5adb('0x33')]({'where':{'id':_0x123e79[_0x5adb('0x88')]['id']},'attributes':['id']})[_0x5adb('0x26')](handleEntityNotFound(_0x759016,null))[_0x5adb('0x26')](function(_0x1ee4c8){var _0x35e182=[];values=_0x1ee4c8[_0x5adb('0x48')];_0x35e182[_0x5adb('0x42')](get_open_tabs('chat',_0x1ee4c8[_0x5adb('0x48')]));_0x35e182['push'](get_open_tabs(_0x5adb('0x5a'),_0x1ee4c8[_0x5adb('0x48')]));_0x35e182[_0x5adb('0x42')](get_open_tabs('openchannel',_0x1ee4c8['dataValues']));_0x35e182['push'](get_open_tabs('whatsapp',_0x1ee4c8[_0x5adb('0x48')]));_0x35e182[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x49'),_0x1ee4c8[_0x5adb('0x48')]));_0x35e182[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x4a'),_0x1ee4c8[_0x5adb('0x48')]));return BPromise[_0x5adb('0x4c')](_0x35e182);})[_0x5adb('0x26')](function(_0x5c6ef6){var _0x39bf82=[];if(_0x5c6ef6){for(var _0x5100a3=0x0;_0x5100a3=_0x46b225[_0xe490('0x51')]){throw new Error(_0xe490('0x52'));}})[_0xe490('0x10')](function(){if(_0x386e65){return db[_0xe490('0x2c')]['destroy']({'where':{'membername':_0x386e65[_0xe490('0x28')]},'individualHooks':!![]});}})[_0xe490('0x10')](function(){if(_0x386e65){return _0x386e65[_0xe490('0x53')]({'raw':!![]});}})['then'](function(_0x523d72){if(_0x386e65){if(_0x523d72){var _0x3b7382=[];_0x2f91d7=_0x523d72;if(_0x2f91d7[_0xe490('0x33')]){for(var _0x511edd=0x0;_0x511edd<_0x2f91d7['length'];_0x511edd++){_0x3b7382[_0xe490('0x48')](db[_0xe490('0x2c')][_0xe490('0x54')]({'membername':_0x386e65['name'],'UserId':_0x386e65['id'],'queue_name':_0x2f91d7[_0x511edd]['name'],'VoiceQueueId':_0x2f91d7[_0x511edd]['id'],'interface':_0x5e4398,'paused':_0x386e65[_0xe490('0x4e')]||![],'penalty':_0x2f91d7[_0x511edd][_0xe490('0x55')]||0x0}));}return BPromise[_0xe490('0x49')](_0x3b7382);}}}})[_0xe490('0x10')](function(){if(_0x386e65){return db[_0xe490('0x2e')][_0xe490('0x2f')]({'where':{'membername':_0x386e65[_0xe490('0x28')],'exitAt':null}});}})[_0xe490('0x10')](function(_0x34fb09){if(_0x386e65){if(_0x34fb09&&_0x34fb09[_0xe490('0x33')]){var _0x5b8821=[];_0x34fb09[_0xe490('0x35')](function(_0x2183ec){_0x5b8821[_0xe490('0x48')](_0x2183ec[_0xe490('0x2d')]({'exitAt':moment()['format'](_0xe490('0x32'))}));});return BPromise[_0xe490('0x49')](_0x5b8821);}}})[_0xe490('0x10')](function(_0x13dd3c){if(_0x386e65){var _0x55ba27=[];var _0x21ef66=[];var _0x2fc245=utils[_0xe490('0x56')]();var _0x4d563c={'membername':_0x386e65[_0xe490('0x28')],'interface':_0x5e4398,'enterAt':moment()[_0xe490('0x31')](_0xe490('0x32')),'role':_0x386e65[_0xe490('0x29')],'internal':_0x386e65[_0xe490('0x2a')]};_0x2fc245['forEach'](function(_0x31213f){_0x55ba27[_0xe490('0x48')](_[_0xe490('0x57')]({'channel':_0x31213f,'type':_0xe490('0x58'),'data1':_0xe490('0x59'),'data2':_0x5e4398},_0x4d563c));if(_0x386e65[_0xe490('0x4e')]){_0x21ef66[_0xe490('0x48')](_[_0xe490('0x57')]({'channel':_0x31213f,'type':_0xe490('0x30'),'data1':_0xe490('0x5a')},_0x4d563c));}});return db[_0xe490('0x2e')][_0xe490('0x3a')](_0x55ba27['concat'](_0x21ef66),{'individualHooks':!![]});}})[_0xe490('0x10')](function(){if(_0x386e65){return _0x386e65['update']({'online':!![],'lastLoginAt':moment()['format'](_0xe490('0x32')),'voicePause':_0x386e65[_0xe490('0x4e')]||![],'mailPause':_0x386e65[_0xe490('0x4e')]||![],'chatPause':_0x386e65[_0xe490('0x4e')]||![],'faxPause':_0x386e65['loginInPause']||![],'smsPause':_0x386e65[_0xe490('0x4e')]||![],'openchannelPause':_0x386e65[_0xe490('0x4e')]||![],'pauseType':_0x386e65[_0xe490('0x4e')]?_0xe490('0x5a'):null,'lastPauseAt':moment()[_0xe490('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x5e4398});}})[_0xe490('0x10')](function(_0x2c6f00){_0x4e19cf(_0x2c6f00);})[_0xe490('0x19')](function(_0x274b4c){_0x36c6d3(_0x256055['error'](0x1f4,_0x274b4c[_0xe490('0x17')]));});});}; \ No newline at end of file +var _0xc449=['then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','where','attributes','limit','include','map','model','GetUser','ShowUser','User','find','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','format','length','updateAttributes','push','isNil','SIP/%s','PAUSE','YYYY-MM-DD\x20HH:mm:ss','DEFAULT\x20PAUSE','uniqueid','bulkCreate','type','UnpauseUser','findOne','channel','isValidChannel','body','Unknown\x20channel','voice','system','mail','chat','fax','sms','openchannel','%s%s','findAll','forEach','all','LogoutUser','destroy','LoginUser','phone','loginInPause','count','../../config/license/util','getLicense','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','request'];(function(_0x2ddcd5,_0xd3229d){var _0x4e65f7=function(_0x51893d){while(--_0x51893d){_0x2ddcd5['push'](_0x2ddcd5['shift']());}};_0x4e65f7(++_0xd3229d);}(_0xc449,0x10f));var _0x9c44=function(_0x4ec421,_0x4d7562){_0x4ec421=_0x4ec421-0x0;var _0x2cda81=_0xc449[_0x4ec421];return _0x2cda81;};'use strict';var _=require(_0x9c44('0x0'));var util=require(_0x9c44('0x1'));var moment=require(_0x9c44('0x2'));var BPromise=require(_0x9c44('0x3'));var rs=require(_0x9c44('0x4'));var fs=require('fs');var Redis=require(_0x9c44('0x5'));var db=require(_0x9c44('0x6'))['db'];var utils=require(_0x9c44('0x7'));var logger=require('../../config/logger')(_0x9c44('0x8'));var config=require(_0x9c44('0x9'));var jayson=require(_0x9c44('0xa'));var client=jayson[_0x9c44('0xb')][_0x9c44('0xc')]({'port':0x232a});config[_0x9c44('0xd')]=_[_0x9c44('0xe')](config[_0x9c44('0xd')],{'host':_0x9c44('0xf'),'port':0x18eb});var socket=require(_0x9c44('0x10'))(new Redis(config[_0x9c44('0xd')]));require(_0x9c44('0x11'))[_0x9c44('0x12')](socket);function respondWithRpcPromise(_0xe85116,_0x57b636,_0x49091b){return new BPromise(function(_0x624acc,_0x24b3ce){return client[_0x9c44('0x13')](_0xe85116,_0x49091b)[_0x9c44('0x14')](function(_0xeb1d3){logger[_0x9c44('0x15')](_0x9c44('0x16'),_0x57b636,_0x9c44('0x17'));logger[_0x9c44('0x18')](_0x9c44('0x19'),_0x57b636,_0x9c44('0x17'),JSON[_0x9c44('0x1a')](_0xeb1d3));if(_0xeb1d3[_0x9c44('0x1b')]){if(_0xeb1d3['error'][_0x9c44('0x1c')]===0x1f4){logger['error'](_0x9c44('0x16'),_0x57b636,_0xeb1d3[_0x9c44('0x1b')][_0x9c44('0x1d')]);return _0x24b3ce(_0xeb1d3[_0x9c44('0x1b')]['message']);}logger[_0x9c44('0x1b')](_0x9c44('0x16'),_0x57b636,_0xeb1d3[_0x9c44('0x1b')]['message']);return _0x624acc(_0xeb1d3[_0x9c44('0x1b')][_0x9c44('0x1d')]);}else{logger[_0x9c44('0x15')](_0x9c44('0x16'),_0x57b636,_0x9c44('0x17'));_0x624acc(_0xeb1d3[_0x9c44('0x1e')]['message']);}})[_0x9c44('0x1f')](function(_0x4284cc){logger[_0x9c44('0x1b')](_0x9c44('0x16'),_0x57b636,_0x4284cc);_0x24b3ce(_0x4284cc);});});}exports['GetUser']=function(_0x3166bb){var _0xbfd0cc=this;return new Promise(function(_0x204d68,_0x24d82c){return db['User']['findAll']({'raw':_0x3166bb[_0x9c44('0x20')]?_0x3166bb[_0x9c44('0x20')][_0x9c44('0x21')]===undefined?!![]:![]:!![],'where':_0x3166bb[_0x9c44('0x20')]?_0x3166bb['options'][_0x9c44('0x22')]||null:null,'attributes':_0x3166bb[_0x9c44('0x20')]?_0x3166bb[_0x9c44('0x20')][_0x9c44('0x23')]||null:null,'limit':_0x3166bb[_0x9c44('0x20')]?_0x3166bb[_0x9c44('0x20')][_0x9c44('0x24')]||null:null,'include':_0x3166bb[_0x9c44('0x20')]?_0x3166bb[_0x9c44('0x20')][_0x9c44('0x25')]?_[_0x9c44('0x26')](_0x3166bb['options'][_0x9c44('0x25')],function(_0xb42810){return{'model':db[_0xb42810[_0x9c44('0x27')]],'as':_0xb42810['as'],'attributes':_0xb42810['attributes'],'include':_0xb42810[_0x9c44('0x25')]?_[_0x9c44('0x26')](_0xb42810[_0x9c44('0x25')],function(_0x583072){return{'model':db[_0x583072[_0x9c44('0x27')]],'as':_0x583072['as'],'attributes':_0x583072[_0x9c44('0x23')],'include':_0x583072['include']?_[_0x9c44('0x26')](_0x583072[_0x9c44('0x25')],function(_0x2b7fc0){return{'model':db[_0x2b7fc0['model']],'as':_0x2b7fc0['as'],'attributes':_0x2b7fc0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d2271){logger[_0x9c44('0x15')](_0x9c44('0x28'),_0x3166bb);logger['debug']('GetUser',_0x3166bb,JSON[_0x9c44('0x1a')](_0x5d2271));_0x204d68(_0x5d2271);})[_0x9c44('0x1f')](function(_0x1d759b){logger[_0x9c44('0x1b')](_0x9c44('0x28'),_0x1d759b[_0x9c44('0x1d')],_0x3166bb);_0x24d82c(_0xbfd0cc['error'](0x1f4,_0x1d759b['message']));});});};exports[_0x9c44('0x29')]=function(_0x1b3113){var _0x1933bd=this;return new Promise(function(_0x4b638,_0x4a5fd6){return db[_0x9c44('0x2a')]['find']({'raw':_0x1b3113['options']?_0x1b3113[_0x9c44('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x1b3113[_0x9c44('0x20')]?_0x1b3113[_0x9c44('0x20')][_0x9c44('0x22')]||null:null,'attributes':_0x1b3113[_0x9c44('0x20')]?_0x1b3113[_0x9c44('0x20')]['attributes']||null:null,'include':_0x1b3113[_0x9c44('0x20')]?_0x1b3113['options'][_0x9c44('0x25')]?_[_0x9c44('0x26')](_0x1b3113[_0x9c44('0x20')][_0x9c44('0x25')],function(_0x322b55){return{'model':db[_0x322b55[_0x9c44('0x27')]],'as':_0x322b55['as'],'attributes':_0x322b55[_0x9c44('0x23')],'include':_0x322b55['include']?_[_0x9c44('0x26')](_0x322b55[_0x9c44('0x25')],function(_0x4c947d){return{'model':db[_0x4c947d['model']],'as':_0x4c947d['as'],'attributes':_0x4c947d[_0x9c44('0x23')],'include':_0x4c947d[_0x9c44('0x25')]?_[_0x9c44('0x26')](_0x4c947d[_0x9c44('0x25')],function(_0x2c7046){return{'model':db[_0x2c7046[_0x9c44('0x27')]],'as':_0x2c7046['as'],'attributes':_0x2c7046[_0x9c44('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9c44('0x14')](function(_0x3b1309){logger[_0x9c44('0x15')](_0x9c44('0x29'),_0x1b3113);logger[_0x9c44('0x18')](_0x9c44('0x29'),_0x1b3113,JSON[_0x9c44('0x1a')](_0x3b1309));_0x4b638(_0x3b1309);})[_0x9c44('0x1f')](function(_0x5ed9e6){logger[_0x9c44('0x1b')](_0x9c44('0x29'),_0x5ed9e6['message'],_0x1b3113);_0x4a5fd6(_0x1933bd[_0x9c44('0x1b')](0x1f4,_0x5ed9e6[_0x9c44('0x1d')]));});});};exports['PauseUser']=function(_0x4f34d3){var _0x4c9100=this;return new Promise(function(_0x8e15db,_0x1f1c2a){var _0xf091cb;return db['User'][_0x9c44('0x2b')]({'where':_0x4f34d3['options'][_0x9c44('0x22')]||{},'attributes':['id',_0x9c44('0x2c'),_0x9c44('0x2d'),_0x9c44('0x2e'),_0x9c44('0x2f')]})[_0x9c44('0x14')](function(_0x3fe580){if(_0x3fe580){_0xf091cb=_0x3fe580;return db[_0x9c44('0x30')][_0x9c44('0x31')]({'paused':0x1},{'where':{'UserId':_0xf091cb['id']},'individualHooks':!![]});}})[_0x9c44('0x14')](function(){if(_0xf091cb){return db[_0x9c44('0x32')]['findAll']({'where':{'membername':_0xf091cb['name'],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x1452c6){if(_0xf091cb){if(_0x1452c6&&_0x1452c6['length']){var _0x413592=moment()[_0x9c44('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x46f93e=0x0,_0x5c6bdf=_0x1452c6[_0x9c44('0x34')];_0x46f93e<_0x5c6bdf;_0x46f93e++){_0x1452c6[_0x46f93e][_0x9c44('0x35')]({'exitAt':_0x413592});}}}})[_0x9c44('0x14')](function(){if(_0xf091cb){var _0x49f9b4=[];var _0x2cc164=utils['getChannels']();_0x2cc164['forEach'](function(_0x6b4b9){_0x49f9b4[_0x9c44('0x36')]({'channel':_0x6b4b9,'membername':_0xf091cb[_0x9c44('0x2c')],'interface':_[_0x9c44('0x37')](_0xf091cb['interface'])?util[_0x9c44('0x33')](_0x9c44('0x38'),_0xf091cb[_0x9c44('0x2c')]):_0xf091cb[_0x9c44('0x2f')],'type':_0x9c44('0x39'),'enterAt':moment()['format'](_0x9c44('0x3a')),'data1':_0x4f34d3['body']['type']||_0x9c44('0x3b'),'role':_0xf091cb[_0x9c44('0x2d')],'internal':_0xf091cb[_0x9c44('0x2e')],'uniqueid':_0x4f34d3['body'][_0x9c44('0x3c')]||null});});return db[_0x9c44('0x32')][_0x9c44('0x3d')](_0x49f9b4,{'individualHooks':!![]});}})[_0x9c44('0x14')](function(){if(_0xf091cb){return _0xf091cb[_0x9c44('0x31')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4f34d3['body'][_0x9c44('0x3e')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x9c44('0x33')](_0x9c44('0x3a'))});}})['then'](function(_0x2c3eb8){_0x8e15db(_0x2c3eb8);})[_0x9c44('0x1f')](function(_0x389beb){_0x1f1c2a(_0x4c9100[_0x9c44('0x1b')](0x1f4,_0x389beb[_0x9c44('0x1d')]));});});};exports[_0x9c44('0x3f')]=function(_0x127d51){var _0x7cae94=this;return new Promise(function(_0x26e1c2,_0x70c7cb){var _0x4c5904;return db['User'][_0x9c44('0x40')]({'where':_0x127d51[_0x9c44('0x20')][_0x9c44('0x22')]||{},'attributes':['id',_0x9c44('0x2c')]})[_0x9c44('0x14')](function(_0xce3436){if(_0xce3436){_0x4c5904=_0xce3436;if(_0x127d51['body'][_0x9c44('0x41')]&&!utils[_0x9c44('0x42')](_0x127d51[_0x9c44('0x43')][_0x9c44('0x41')])){throw new Error(_0x9c44('0x44'));}switch(_0x127d51['body']['channel']){case _0x9c44('0x45'):return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x4c5904['id']}})[_0x9c44('0x14')](function(){return db[_0x9c44('0x32')][_0x9c44('0x2b')]({'where':{'channel':_0x127d51[_0x9c44('0x43')]['channel'],'membername':_0x4c5904['name'],'type':_0x9c44('0x39'),'exitAt':null}});})['then'](function(_0x3cee21){if(_0x3cee21){return _0x3cee21[_0x9c44('0x31')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x9c44('0x46')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x4c5904[_0x9c44('0x31')]({'voicePause':![]});});case _0x9c44('0x47'):case _0x9c44('0x48'):case _0x9c44('0x49'):case _0x9c44('0x4a'):case _0x9c44('0x4b'):case'whatsapp':return db[_0x9c44('0x32')][_0x9c44('0x2b')]({'where':{'channel':_0x127d51[_0x9c44('0x43')][_0x9c44('0x41')],'membername':_0x4c5904[_0x9c44('0x2c')],'type':_0x9c44('0x39'),'exitAt':null}})[_0x9c44('0x14')](function(_0x11b30d){return _0x11b30d[_0x9c44('0x31')]({'exitAt':moment()[_0x9c44('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x9c44('0x46')},{'individualHooks':!![]});})[_0x9c44('0x14')](function(){var _0x51b374={};_['set'](_0x51b374,util[_0x9c44('0x33')](_0x9c44('0x4c'),_0x127d51[_0x9c44('0x43')][_0x9c44('0x41')],'Pause'),![]);return _0x4c5904['update'](_0x51b374);});default:return db[_0x9c44('0x30')][_0x9c44('0x31')]({'paused':0x0},{'where':{'UserId':_0x4c5904['id']}})['then'](function(){return db['MemberReport'][_0x9c44('0x4d')]({'where':{'membername':_0x4c5904[_0x9c44('0x2c')],'type':'PAUSE','exitAt':null}});})[_0x9c44('0x14')](function(_0x260362){var _0x34f695=[];_0x260362[_0x9c44('0x4e')](function(_0x26091c){_0x34f695[_0x9c44('0x36')](_0x26091c[_0x9c44('0x31')]({'exitAt':moment()[_0x9c44('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x9c44('0x46')}));});return BPromise[_0x9c44('0x4f')](_0x34f695);})[_0x9c44('0x14')](function(){return _0x4c5904[_0x9c44('0x31')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x9c44('0x14')](function(_0x45f236){_0x26e1c2(_0x45f236);})[_0x9c44('0x1f')](function(_0x517b10){_0x70c7cb(_0x7cae94[_0x9c44('0x1b')](0x1f4,_0x517b10[_0x9c44('0x1d')]));});});};exports[_0x9c44('0x50')]=function(_0x1411ca){var _0x2811ff=this;return new Promise(function(_0xfa578c,_0x17c327){var _0x270549;return db[_0x9c44('0x2a')][_0x9c44('0x40')]({'where':_0x1411ca[_0x9c44('0x20')]['where']||{},'attributes':['id',_0x9c44('0x2c')]})[_0x9c44('0x14')](function(_0x59829d){if(_0x59829d){_0x270549=_0x59829d;return db[_0x9c44('0x30')][_0x9c44('0x51')]({'where':{'membername':_0x270549['name']},'individualHooks':!![]});}})['then'](function(){if(_0x270549){return db[_0x9c44('0x32')][_0x9c44('0x4d')]({'where':{'membername':_0x270549[_0x9c44('0x2c')],'exitAt':null}});}})[_0x9c44('0x14')](function(_0x369ded){if(_0x270549){if(_0x369ded&&_0x369ded[_0x9c44('0x34')]){var _0x13cfc7=[];_0x369ded[_0x9c44('0x4e')](function(_0x13e1f5){_0x13cfc7['push'](_0x13e1f5[_0x9c44('0x31')]({'exitAt':moment()[_0x9c44('0x33')](_0x9c44('0x3a'))}));});return BPromise[_0x9c44('0x4f')](_0x13cfc7);}}})[_0x9c44('0x14')](function(){if(_0x270549){return _0x270549[_0x9c44('0x31')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x76e676){_0xfa578c(_0x76e676);})[_0x9c44('0x1f')](function(_0x3c53f3){_0x17c327(_0x2811ff['error'](0x1f4,_0x3c53f3[_0x9c44('0x1d')]));});});};exports[_0x9c44('0x52')]=function(_0x45ba8b){var _0xcbaa68=this;return new Promise(function(_0x20a7b2,_0x1906a6){var _0x47ad40;var _0x3d39af;var _0x13a1c0;var _0x218911;return db[_0x9c44('0x2a')][_0x9c44('0x40')]({'where':_0x45ba8b[_0x9c44('0x20')][_0x9c44('0x22')]||{},'attributes':['id',_0x9c44('0x2c'),_0x9c44('0x2d'),'mobile',_0x9c44('0x53'),'internal',_0x9c44('0x54'),_0x9c44('0x2f')]})[_0x9c44('0x14')](function(_0x90d62){if(_0x90d62){_0x47ad40=_0x90d62;_0x218911=_0x45ba8b[_0x9c44('0x43')]['interface']?_0x45ba8b[_0x9c44('0x43')]['interface']:util[_0x9c44('0x33')](_0x9c44('0x38'),_0x47ad40['name']);return db['User'][_0x9c44('0x55')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x47ad40['id']}}});}})[_0x9c44('0x14')](function(_0x2373aa){if(_0x2373aa){_0x13a1c0=_0x2373aa;return require(_0x9c44('0x56'))[_0x9c44('0x57')]();}})[_0x9c44('0x14')](function(_0x183656){if(_0x183656&&_0x183656['agents']&&_0x13a1c0>=_0x183656['agents']){throw new Error(_0x9c44('0x58'));}})[_0x9c44('0x14')](function(){if(_0x47ad40){return db[_0x9c44('0x30')]['destroy']({'where':{'membername':_0x47ad40[_0x9c44('0x2c')]},'individualHooks':!![]});}})['then'](function(){if(_0x47ad40){return _0x47ad40[_0x9c44('0x59')]({'raw':!![]});}})[_0x9c44('0x14')](function(_0x5ba338){if(_0x47ad40){if(_0x5ba338){var _0x2a6e04=[];_0x3d39af=_0x5ba338;if(_0x3d39af['length']){for(var _0x321df8=0x0;_0x321df8<_0x3d39af['length'];_0x321df8++){_0x2a6e04[_0x9c44('0x36')](db[_0x9c44('0x30')][_0x9c44('0x5a')]({'membername':_0x47ad40[_0x9c44('0x2c')],'UserId':_0x47ad40['id'],'queue_name':_0x3d39af[_0x321df8][_0x9c44('0x2c')],'VoiceQueueId':_0x3d39af[_0x321df8]['id'],'interface':_0x218911,'paused':_0x47ad40[_0x9c44('0x54')]||![],'penalty':_0x3d39af[_0x321df8][_0x9c44('0x5b')]||0x0}));}return BPromise['all'](_0x2a6e04);}}}})[_0x9c44('0x14')](function(){if(_0x47ad40){return db[_0x9c44('0x32')][_0x9c44('0x4d')]({'where':{'membername':_0x47ad40[_0x9c44('0x2c')],'exitAt':null}});}})['then'](function(_0x4e6a5f){if(_0x47ad40){if(_0x4e6a5f&&_0x4e6a5f[_0x9c44('0x34')]){var _0x40a8ce=[];_0x4e6a5f[_0x9c44('0x4e')](function(_0x1c3da5){_0x40a8ce[_0x9c44('0x36')](_0x1c3da5['update']({'exitAt':moment()[_0x9c44('0x33')](_0x9c44('0x3a'))}));});return BPromise[_0x9c44('0x4f')](_0x40a8ce);}}})[_0x9c44('0x14')](function(_0x426c81){if(_0x47ad40){var _0xb45196=[];var _0x225423=[];var _0x131fd4=utils[_0x9c44('0x5c')]();var _0x13579f={'membername':_0x47ad40[_0x9c44('0x2c')],'interface':_0x218911,'enterAt':moment()[_0x9c44('0x33')](_0x9c44('0x3a')),'role':_0x47ad40[_0x9c44('0x2d')],'internal':_0x47ad40[_0x9c44('0x2e')]};_0x131fd4[_0x9c44('0x4e')](function(_0x479357){_0xb45196[_0x9c44('0x36')](_[_0x9c44('0x5d')]({'channel':_0x479357,'type':_0x9c44('0x5e'),'data1':_0x9c44('0x5f'),'data2':_0x218911},_0x13579f));if(_0x47ad40[_0x9c44('0x54')]){_0x225423[_0x9c44('0x36')](_[_0x9c44('0x5d')]({'channel':_0x479357,'type':_0x9c44('0x39'),'data1':_0x9c44('0x60')},_0x13579f));}});return db[_0x9c44('0x32')][_0x9c44('0x3d')](_0xb45196['concat'](_0x225423),{'individualHooks':!![]});}})[_0x9c44('0x14')](function(){if(_0x47ad40){return _0x47ad40[_0x9c44('0x31')]({'online':!![],'lastLoginAt':moment()[_0x9c44('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x47ad40['loginInPause']||![],'mailPause':_0x47ad40[_0x9c44('0x54')]||![],'chatPause':_0x47ad40[_0x9c44('0x54')]||![],'faxPause':_0x47ad40[_0x9c44('0x54')]||![],'smsPause':_0x47ad40[_0x9c44('0x54')]||![],'openchannelPause':_0x47ad40['loginInPause']||![],'pauseType':_0x47ad40['loginInPause']?_0x9c44('0x60'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x218911});}})['then'](function(_0x5c71cc){_0x20a7b2(_0x5c71cc);})[_0x9c44('0x1f')](function(_0x10abd3){_0x1906a6(_0xcbaa68[_0x9c44('0x1b')](0x1f4,_0x10abd3['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 97509a3..ebf87c6 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 _0x5322=['emit','removeListener','length','./user.events','save','update'];(function(_0x1e6c81,_0x5187fb){var _0x50aed6=function(_0x1f12b5){while(--_0x1f12b5){_0x1e6c81['push'](_0x1e6c81['shift']());}};_0x50aed6(++_0x5187fb);}(_0x5322,0x195));var _0x2532=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0x5322[_0x12c280];return _0x3638d3;};'use strict';var UserEvents=require(_0x2532('0x0'));var events=[_0x2532('0x1'),'remove',_0x2532('0x2')];function createListener(_0x19f11e,_0x3bec3e){return function(_0x162a48){_0x3bec3e[_0x2532('0x3')](_0x19f11e,_0x162a48);};}function removeListener(_0x26f8ff,_0x3b52e5){return function(){UserEvents[_0x2532('0x4')](_0x26f8ff,_0x3b52e5);};}exports['register']=function(_0x38a85c){for(var _0x4057d4=0x0,_0xb173fc=events[_0x2532('0x5')];_0x4057d4<_0xb173fc;_0x4057d4++){var _0x28cc46=events[_0x4057d4];var _0x5132c7=createListener('user:'+_0x28cc46,_0x38a85c);UserEvents['on'](_0x28cc46,_0x5132c7);}}; \ No newline at end of file +var _0x9366=['length','user:','./user.events','remove','update','removeListener','register'];(function(_0x7f79fe,_0x54b609){var _0x36cce3=function(_0x39056d){while(--_0x39056d){_0x7f79fe['push'](_0x7f79fe['shift']());}};_0x36cce3(++_0x54b609);}(_0x9366,0x121));var _0x6936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9366[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require(_0x6936('0x0'));var events=['save',_0x6936('0x1'),_0x6936('0x2')];function createListener(_0x418112,_0x51fad9){return function(_0x55c255){_0x51fad9['emit'](_0x418112,_0x55c255);};}function removeListener(_0x5e9662,_0x25799f){return function(){UserEvents[_0x6936('0x3')](_0x5e9662,_0x25799f);};}exports[_0x6936('0x4')]=function(_0x379adf){for(var _0x19685f=0x0,_0x147bfc=events[_0x6936('0x5')];_0x19685f<_0x147bfc;_0x19685f++){var _0x40966f=events[_0x19685f];var _0x2aba00=createListener(_0x6936('0x6')+_0x40966f,_0x379adf);UserEvents['on'](_0x40966f,_0x2aba00);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 7b99b45..3d43c04 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2efc94,_0xeece5c){var _0x2bab39=function(_0x1e1eb6){while(--_0x1e1eb6){_0x2efc94['push'](_0x2efc94['shift']());}};_0x2bab39(++_0xeece5c);}(_0xedd9,0xfc));var _0x9edd=function(_0x1c73d1,_0x595c17){_0x1c73d1=_0x1c73d1-0x0;var _0x54648c=_0xedd9[_0x1c73d1];return _0x54648c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x50ce0c,_0x541b68){var _0x3c988c=function(_0x1684ee){while(--_0x1684ee){_0x50ce0c['push'](_0x50ce0c['shift']());}};_0x3c988c(++_0x541b68);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 3d122ef..ba4c47f 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 _0xe233=['sequelize'];(function(_0x26c3ce,_0x2b0887){var _0x1161f4=function(_0x511fef){while(--_0x511fef){_0x26c3ce['push'](_0x26c3ce['shift']());}};_0x1161f4(++_0x2b0887);}(_0xe233,0x15b));var _0x3e23=function(_0x176f4f,_0x35bfed){_0x176f4f=_0x176f4f-0x0;var _0x6185d2=_0xe233[_0x176f4f];return _0x6185d2;};'use strict';var Sequelize=require(_0x3e23('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0e8c=['INTEGER'];(function(_0x4ce885,_0x4a64c6){var _0x189899=function(_0x12ebb2){while(--_0x12ebb2){_0x4ce885['push'](_0x4ce885['shift']());}};_0x189899(++_0x4a64c6);}(_0x0e8c,0xf7));var _0xc0e8=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0e8c[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xc0e8('0x0')],'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 3aff8b1..c6cab79 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 _0xc992=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0xb54c3f,_0x45da32){var _0x4637fc=function(_0x274411){while(--_0x274411){_0xb54c3f['push'](_0xb54c3f['shift']());}};_0x4637fc(++_0x45da32);}(_0xc992,0x129));var _0x2c99=function(_0x23569e,_0x425d1b){_0x23569e=_0x23569e-0x0;var _0x4b8d32=_0xc992[_0x23569e];return _0x4b8d32;};'use strict';var _=require(_0x2c99('0x0'));var util=require(_0x2c99('0x1'));var logger=require(_0x2c99('0x2'))(_0x2c99('0x3'));var moment=require(_0x2c99('0x4'));var BPromise=require('bluebird');var rp=require(_0x2c99('0x5'));var fs=require('fs');var path=require(_0x2c99('0x6'));var rimraf=require(_0x2c99('0x7'));var config=require(_0x2c99('0x8'));var attributes=require(_0x2c99('0x9'));module[_0x2c99('0xa')]=function(_0x4cfda7,_0x5e2d1f){return _0x4cfda7['define']('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98e0=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','util'];(function(_0x444237,_0x19602f){var _0x2cc288=function(_0x42a491){while(--_0x42a491){_0x444237['push'](_0x444237['shift']());}};_0x2cc288(++_0x19602f);}(_0x98e0,0x1c6));var _0x098e=function(_0x336c45,_0x1bf5d3){_0x336c45=_0x336c45-0x0;var _0x51a6ae=_0x98e0[_0x336c45];return _0x51a6ae;};'use strict';var _=require(_0x098e('0x0'));var util=require(_0x098e('0x1'));var logger=require(_0x098e('0x2'))(_0x098e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x098e('0x4'));var fs=require('fs');var path=require(_0x098e('0x5'));var rimraf=require(_0x098e('0x6'));var config=require(_0x098e('0x7'));var attributes=require(_0x098e('0x8'));module[_0x098e('0x9')]=function(_0x5d9cf4,_0x246593){return _0x5d9cf4[_0x098e('0xa')]('UserChatQueue',attributes,{'tableName':_0x098e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index a61d57d..7e46f14 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 _0xacf1=['request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x37f2f5,_0x1a4841){var _0xec949a=function(_0x57def5){while(--_0x57def5){_0x37f2f5['push'](_0x37f2f5['shift']());}};_0xec949a(++_0x1a4841);}(_0xacf1,0x91));var _0x1acf=function(_0x1b61a8,_0xc6d9a){_0x1b61a8=_0x1b61a8-0x0;var _0x486fc5=_0xacf1[_0x1b61a8];return _0x486fc5;};'use strict';var _=require(_0x1acf('0x0'));var util=require(_0x1acf('0x1'));var moment=require(_0x1acf('0x2'));var BPromise=require(_0x1acf('0x3'));var rs=require(_0x1acf('0x4'));var fs=require('fs');var Redis=require(_0x1acf('0x5'));var db=require(_0x1acf('0x6'))['db'];var utils=require(_0x1acf('0x7'));var logger=require(_0x1acf('0x8'))(_0x1acf('0x9'));var config=require('../../config/environment');var jayson=require(_0x1acf('0xa'));var client=jayson['client'][_0x1acf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6ddfdd,_0x312140,_0x48f675){return new BPromise(function(_0x319ed9,_0x6d63be){return client[_0x1acf('0xc')](_0x6ddfdd,_0x48f675)[_0x1acf('0xd')](function(_0x5aa6c1){logger[_0x1acf('0xe')](_0x1acf('0xf'),_0x312140,_0x1acf('0x10'));logger['debug'](_0x1acf('0x11'),_0x312140,_0x1acf('0x10'),JSON[_0x1acf('0x12')](_0x5aa6c1));if(_0x5aa6c1[_0x1acf('0x13')]){if(_0x5aa6c1['error']['code']===0x1f4){logger[_0x1acf('0x13')](_0x1acf('0xf'),_0x312140,_0x5aa6c1[_0x1acf('0x13')][_0x1acf('0x14')]);return _0x6d63be(_0x5aa6c1[_0x1acf('0x13')][_0x1acf('0x14')]);}logger[_0x1acf('0x13')](_0x1acf('0xf'),_0x312140,_0x5aa6c1[_0x1acf('0x13')][_0x1acf('0x14')]);return _0x319ed9(_0x5aa6c1['error'][_0x1acf('0x14')]);}else{logger[_0x1acf('0xe')](_0x1acf('0xf'),_0x312140,_0x1acf('0x10'));_0x319ed9(_0x5aa6c1[_0x1acf('0x15')][_0x1acf('0x14')]);}})[_0x1acf('0x16')](function(_0x3c7a9a){logger['error'](_0x1acf('0xf'),_0x312140,_0x3c7a9a);_0x6d63be(_0x3c7a9a);});});} \ No newline at end of file +var _0xdc56=['randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0xdc56,0x6f));var _0x6dc5=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0xdc56[_0x8e8ca7];return _0x561381;};'use strict';var _=require(_0x6dc5('0x0'));var util=require('util');var moment=require(_0x6dc5('0x1'));var BPromise=require(_0x6dc5('0x2'));var rs=require(_0x6dc5('0x3'));var fs=require('fs');var Redis=require(_0x6dc5('0x4'));var db=require(_0x6dc5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6dc5('0x6'));var jayson=require(_0x6dc5('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5aecc4,_0x5b63a8,_0x33a607){return new BPromise(function(_0x33b8b8,_0x51bf59){return client[_0x6dc5('0x8')](_0x5aecc4,_0x33a607)[_0x6dc5('0x9')](function(_0x30f106){logger[_0x6dc5('0xa')](_0x6dc5('0xb'),_0x5b63a8,_0x6dc5('0xc'));logger['debug'](_0x6dc5('0xd'),_0x5b63a8,'request\x20sent',JSON[_0x6dc5('0xe')](_0x30f106));if(_0x30f106['error']){if(_0x30f106[_0x6dc5('0xf')]['code']===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x5b63a8,_0x30f106[_0x6dc5('0xf')][_0x6dc5('0x10')]);return _0x51bf59(_0x30f106[_0x6dc5('0xf')][_0x6dc5('0x10')]);}logger[_0x6dc5('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x5b63a8,_0x30f106[_0x6dc5('0xf')]['message']);return _0x33b8b8(_0x30f106[_0x6dc5('0xf')]['message']);}else{logger[_0x6dc5('0xa')](_0x6dc5('0xb'),_0x5b63a8,_0x6dc5('0xc'));_0x33b8b8(_0x30f106[_0x6dc5('0x11')][_0x6dc5('0x10')]);}})[_0x6dc5('0x12')](function(_0x49421e){logger[_0x6dc5('0xf')](_0x6dc5('0xb'),_0x5b63a8,_0x49421e);_0x51bf59(_0x49421e);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index ea880a8..6ed4b04 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x45399c,_0x23f340){var _0x1ee4bc=function(_0x1694e8){while(--_0x1694e8){_0x45399c['push'](_0x45399c['shift']());}};_0x1ee4bc(++_0x23f340);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x473060,_0x4e43ba){var _0x38e629=function(_0xad8d39){while(--_0xad8d39){_0x473060['push'](_0x473060['shift']());}};_0x38e629(++_0x4e43ba);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 0f316cc..b2aa8ca 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 _0xbac1=['STRING','INTEGER'];(function(_0x2b90af,_0x47d9b0){var _0x5016c9=function(_0x3f3f93){while(--_0x3f3f93){_0x2b90af['push'](_0x2b90af['shift']());}};_0x5016c9(++_0x47d9b0);}(_0xbac1,0xb7));var _0x1bac=function(_0x553d21,_0xba1c42){_0x553d21=_0x553d21-0x0;var _0x9b57d3=_0xbac1[_0x553d21];return _0x9b57d3;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x1bac('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1bac('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x1bac('0x1')]}}; \ No newline at end of file +var _0x6d1e=['exports','INTEGER','sequelize'];(function(_0x2a378b,_0x253bb5){var _0x4ac140=function(_0x14e5eb){while(--_0x14e5eb){_0x2a378b['push'](_0x2a378b['shift']());}};_0x4ac140(++_0x253bb5);}(_0x6d1e,0x125));var _0xe6d1=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x6d1e[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0xe6d1('0x0'));module[_0xe6d1('0x1')]={'penalty':{'type':Sequelize[_0xe6d1('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index a791bc2..876d356 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 _0x5dd6=['exports','define','user_has_fax_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4100e1,_0x21e036){var _0x1b4476=function(_0x30f12e){while(--_0x30f12e){_0x4100e1['push'](_0x4100e1['shift']());}};_0x1b4476(++_0x21e036);}(_0x5dd6,0x1b0));var _0x65dd=function(_0x2a8e20,_0x4ddd0c){_0x2a8e20=_0x2a8e20-0x0;var _0x1742c8=_0x5dd6[_0x2a8e20];return _0x1742c8;};'use strict';var _=require(_0x65dd('0x0'));var util=require(_0x65dd('0x1'));var logger=require(_0x65dd('0x2'))('api');var moment=require(_0x65dd('0x3'));var BPromise=require(_0x65dd('0x4'));var rp=require(_0x65dd('0x5'));var fs=require('fs');var path=require(_0x65dd('0x6'));var rimraf=require('rimraf');var config=require(_0x65dd('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x65dd('0x8')]=function(_0x4d7f3d,_0x1888db){return _0x4d7f3d[_0x65dd('0x9')]('UserFaxQueue',attributes,{'tableName':_0x65dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4437=['./userFaxQueue.attributes','define','UserFaxQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1e3b2c,_0x4dcc3c){var _0x1fb8c7=function(_0xba99a6){while(--_0xba99a6){_0x1e3b2c['push'](_0x1e3b2c['shift']());}};_0x1fb8c7(++_0x4dcc3c);}(_0x4437,0xfd));var _0x7443=function(_0x3f6bb4,_0x67511a){_0x3f6bb4=_0x3f6bb4-0x0;var _0x2e8c79=_0x4437[_0x3f6bb4];return _0x2e8c79;};'use strict';var _=require(_0x7443('0x0'));var util=require(_0x7443('0x1'));var logger=require(_0x7443('0x2'))('api');var moment=require(_0x7443('0x3'));var BPromise=require(_0x7443('0x4'));var rp=require(_0x7443('0x5'));var fs=require('fs');var path=require(_0x7443('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7443('0x7'));module['exports']=function(_0x22f4ff,_0x33eb26){return _0x22f4ff[_0x7443('0x8')](_0x7443('0x9'),attributes,{'tableName':'user_has_fax_queues','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 4a8b817..959d973 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 _0x56aa=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x56aa,0xab));var _0xa56a=function(_0x39b07e,_0x33b057){_0x39b07e=_0x39b07e-0x0;var _0x591dae=_0x56aa[_0x39b07e];return _0x591dae;};'use strict';var _=require(_0xa56a('0x0'));var util=require('util');var moment=require(_0xa56a('0x1'));var BPromise=require(_0xa56a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa56a('0x3'));var db=require(_0xa56a('0x4'))['db'];var utils=require(_0xa56a('0x5'));var logger=require('../../config/logger')(_0xa56a('0x6'));var config=require(_0xa56a('0x7'));var jayson=require(_0xa56a('0x8'));var client=jayson[_0xa56a('0x9')][_0xa56a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x90e6d8,_0x410922,_0x2f1a8d){return new BPromise(function(_0x43ec08,_0x2a8ad3){return client[_0xa56a('0xb')](_0x90e6d8,_0x2f1a8d)[_0xa56a('0xc')](function(_0x40d12d){logger[_0xa56a('0xd')](_0xa56a('0xe'),_0x410922,_0xa56a('0xf'));logger[_0xa56a('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x410922,_0xa56a('0xf'),JSON[_0xa56a('0x11')](_0x40d12d));if(_0x40d12d[_0xa56a('0x12')]){if(_0x40d12d[_0xa56a('0x12')][_0xa56a('0x13')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x410922,_0x40d12d[_0xa56a('0x12')][_0xa56a('0x14')]);return _0x2a8ad3(_0x40d12d[_0xa56a('0x12')][_0xa56a('0x14')]);}logger['error'](_0xa56a('0xe'),_0x410922,_0x40d12d[_0xa56a('0x12')][_0xa56a('0x14')]);return _0x43ec08(_0x40d12d[_0xa56a('0x12')][_0xa56a('0x14')]);}else{logger[_0xa56a('0xd')](_0xa56a('0xe'),_0x410922,_0xa56a('0xf'));_0x43ec08(_0x40d12d[_0xa56a('0x15')][_0xa56a('0x14')]);}})['catch'](function(_0x2c9dcf){logger[_0xa56a('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x410922,_0x2c9dcf);_0x2a8ad3(_0x2c9dcf);});});} \ No newline at end of file +var _0xf57f=['stringify','error','code','message','result','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x54c78a,_0x5bc1c8){var _0x14be02=function(_0x3877a7){while(--_0x3877a7){_0x54c78a['push'](_0x54c78a['shift']());}};_0x14be02(++_0x5bc1c8);}(_0xf57f,0x155));var _0xff57=function(_0x190e94,_0x117fc1){_0x190e94=_0x190e94-0x0;var _0x3012a0=_0xf57f[_0x190e94];return _0x3012a0;};'use strict';var _=require(_0xff57('0x0'));var util=require(_0xff57('0x1'));var moment=require(_0xff57('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff57('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xff57('0x4'));var logger=require(_0xff57('0x5'))(_0xff57('0x6'));var config=require(_0xff57('0x7'));var jayson=require(_0xff57('0x8'));var client=jayson[_0xff57('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5056f5,_0x44248f,_0x2c30eb){return new BPromise(function(_0x420933,_0x86aab0){return client[_0xff57('0xa')](_0x5056f5,_0x2c30eb)[_0xff57('0xb')](function(_0x494109){logger[_0xff57('0xc')](_0xff57('0xd'),_0x44248f,_0xff57('0xe'));logger['debug'](_0xff57('0xf'),_0x44248f,_0xff57('0xe'),JSON[_0xff57('0x10')](_0x494109));if(_0x494109[_0xff57('0x11')]){if(_0x494109[_0xff57('0x11')][_0xff57('0x12')]===0x1f4){logger[_0xff57('0x11')](_0xff57('0xd'),_0x44248f,_0x494109['error']['message']);return _0x86aab0(_0x494109[_0xff57('0x11')][_0xff57('0x13')]);}logger['error'](_0xff57('0xd'),_0x44248f,_0x494109[_0xff57('0x11')]['message']);return _0x420933(_0x494109[_0xff57('0x11')][_0xff57('0x13')]);}else{logger[_0xff57('0xc')](_0xff57('0xd'),_0x44248f,'request\x20sent');_0x420933(_0x494109[_0xff57('0x14')][_0xff57('0x13')]);}})['catch'](function(_0x4fcd56){logger[_0xff57('0x11')](_0xff57('0xd'),_0x44248f,_0x4fcd56);_0x86aab0(_0x4fcd56);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 013b56f..9cb584d 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x570236,_0x351c00){var _0xbed152=function(_0x140609){while(--_0x140609){_0x570236['push'](_0x570236['shift']());}};_0xbed152(++_0x351c00);}(_0x70e0,0x17b));var _0x070e=function(_0x5e42bc,_0x228488){_0x5e42bc=_0x5e42bc-0x0;var _0x3f0b39=_0x70e0[_0x5e42bc];return _0x3f0b39;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3fbf2c,_0x51cd95){var _0x272143=function(_0x4e6f40){while(--_0x4e6f40){_0x3fbf2c['push'](_0x3fbf2c['shift']());}};_0x272143(++_0x51cd95);}(_0x70e0,0x17b));var _0x070e=function(_0x3f300f,_0x2d75bf){_0x3f300f=_0x3f300f-0x0;var _0x12898c=_0x70e0[_0x3f300f];return _0x12898c;};'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 e13d90b..e0fffd3 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 _0x9cd7=['exports','INTEGER','sequelize'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x9cd7,0xcb));var _0x79cd=function(_0x151dee,_0x3f620f){_0x151dee=_0x151dee-0x0;var _0x36879b=_0x9cd7[_0x151dee];return _0x36879b;};'use strict';var Sequelize=require(_0x79cd('0x0'));module[_0x79cd('0x1')]={'penalty':{'type':Sequelize[_0x79cd('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x08da=['exports','INTEGER'];(function(_0x35c300,_0x284351){var _0x59e44b=function(_0x327e5c){while(--_0x327e5c){_0x35c300['push'](_0x35c300['shift']());}};_0x59e44b(++_0x284351);}(_0x08da,0x180));var _0xa08d=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x08da[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require('sequelize');module[_0xa08d('0x0')]={'penalty':{'type':Sequelize[_0xa08d('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 3a46bc2..f8ecc09 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 _0x1346=['user_has_mail_queues','util','api','bluebird','path','rimraf','./userMailQueue.attributes','define','UserMailQueue'];(function(_0x5366b7,_0x5934be){var _0x65f832=function(_0x447c1e){while(--_0x447c1e){_0x5366b7['push'](_0x5366b7['shift']());}};_0x65f832(++_0x5934be);}(_0x1346,0x157));var _0x6134=function(_0x4ee078,_0x45df89){_0x4ee078=_0x4ee078-0x0;var _0x35b32c=_0x1346[_0x4ee078];return _0x35b32c;};'use strict';var _=require('lodash');var util=require(_0x6134('0x0'));var logger=require('../../config/logger')(_0x6134('0x1'));var moment=require('moment');var BPromise=require(_0x6134('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6134('0x3'));var rimraf=require(_0x6134('0x4'));var config=require('../../config/environment');var attributes=require(_0x6134('0x5'));module['exports']=function(_0x5daa4a,_0x62793d){return _0x5daa4a[_0x6134('0x6')](_0x6134('0x7'),attributes,{'tableName':_0x6134('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x759d=['moment','bluebird','request-promise','path','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','api'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x759d,0xa6));var _0xd759=function(_0x544777,_0x4ae1b9){_0x544777=_0x544777-0x0;var _0x1ab32f=_0x759d[_0x544777];return _0x1ab32f;};'use strict';var _=require(_0xd759('0x0'));var util=require(_0xd759('0x1'));var logger=require('../../config/logger')(_0xd759('0x2'));var moment=require(_0xd759('0x3'));var BPromise=require(_0xd759('0x4'));var rp=require(_0xd759('0x5'));var fs=require('fs');var path=require(_0xd759('0x6'));var rimraf=require('rimraf');var config=require(_0xd759('0x7'));var attributes=require(_0xd759('0x8'));module[_0xd759('0x9')]=function(_0x1b13a9,_0x95a4c0){return _0x1b13a9[_0xd759('0xa')](_0xd759('0xb'),attributes,{'tableName':_0xd759('0xc'),'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 8937c4d..c01daa1 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x56dfe5,_0x2f55e6){var _0x48228c=function(_0x5c5a24){while(--_0x5c5a24){_0x56dfe5['push'](_0x56dfe5['shift']());}};_0x48228c(++_0x2f55e6);}(_0x34e8,0x12c));var _0x834e=function(_0x2de160,_0x31e303){_0x2de160=_0x2de160-0x0;var _0x3c330a=_0x34e8[_0x2de160];return _0x3c330a;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x532f96,_0x520655){var _0x49ff12=function(_0x2f355c){while(--_0x2f355c){_0x532f96['push'](_0x532f96['shift']());}};_0x49ff12(++_0x520655);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x646b70,_0x53d1e8){_0x646b70=_0x646b70-0x0;var _0x3c921a=_0x7fbe[_0x646b70];return _0x3c921a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 6b473c3..23aff72 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 _0x8f4f=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','sendUserNotification'];(function(_0x5e1ebe,_0x1e786b){var _0x586f68=function(_0x1f4adc){while(--_0x1f4adc){_0x5e1ebe['push'](_0x5e1ebe['shift']());}};_0x586f68(++_0x1e786b);}(_0x8f4f,0x181));var _0xf8f4=function(_0x4bdcf3,_0x87e434){_0x4bdcf3=_0x4bdcf3-0x0;var _0x4de5d3=_0x8f4f[_0x4bdcf3];return _0x4de5d3;};'use strict';var multer=require(_0xf8f4('0x0'));var util=require('util');var path=require(_0xf8f4('0x1'));var timeout=require('connect-timeout');var express=require(_0xf8f4('0x2'));var router=express[_0xf8f4('0x3')]();var fs_extra=require(_0xf8f4('0x4'));var auth=require(_0xf8f4('0x5'));var interaction=require(_0xf8f4('0x6'));var config=require(_0xf8f4('0x7'));var controller=require(_0xf8f4('0x8'));router[_0xf8f4('0x9')]('/',auth['isAuthenticated'](),controller[_0xf8f4('0xa')]);module[_0xf8f4('0xb')]=router; \ No newline at end of file +var _0xa703=['post','sendUserNotification','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x255b6e,_0x11fd56){var _0x39d84d=function(_0x47782a){while(--_0x47782a){_0x255b6e['push'](_0x255b6e['shift']());}};_0x39d84d(++_0x11fd56);}(_0xa703,0x10b));var _0x3a70=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa703[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x3a70('0x0'));var util=require(_0x3a70('0x1'));var path=require(_0x3a70('0x2'));var timeout=require(_0x3a70('0x3'));var express=require('express');var router=express[_0x3a70('0x4')]();var fs_extra=require(_0x3a70('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3a70('0x6'));var config=require(_0x3a70('0x7'));var controller=require(_0x3a70('0x8'));router[_0x3a70('0x9')]('/',auth['isAuthenticated'](),controller[_0x3a70('0xa')]);module[_0x3a70('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 5c885b2..ee73ec2 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 _0x7bfe=['sequelize','STRING','BOOLEAN'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x7bfe,0x1bf));var _0xe7bf=function(_0x540093,_0x40c102){_0x540093=_0x540093-0x0;var _0x50d00b=_0x7bfe[_0x540093];return _0x50d00b;};'use strict';var Sequelize=require(_0xe7bf('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xe7bf('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xe7bf('0x2')]}}; \ No newline at end of file +var _0x6151=['TEXT','STRING','exports'];(function(_0x555273,_0x5e29e7){var _0x1c5e52=function(_0x592c56){while(--_0x592c56){_0x555273['push'](_0x555273['shift']());}};_0x1c5e52(++_0x5e29e7);}(_0x6151,0x18e));var _0x1615=function(_0x58379a,_0x1840de){_0x58379a=_0x58379a-0x0;var _0xf88d78=_0x6151[_0x58379a];return _0xf88d78;};'use strict';var Sequelize=require('sequelize');module[_0x1615('0x0')]={'body':{'type':Sequelize[_0x1615('0x1')]},'senderName':{'type':Sequelize[_0x1615('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x1615('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 460fed7..9fbdc85 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 _0x02d7=['../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','SenderId','recipientsId','sortBy','sequelize','transaction','beep','forEach','recipient','emit','userNotification:send','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','User','union','ids','includes','queue','Queue','all','flatten','catch','getAgents','map','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2674ee,_0x54afc9){var _0x193c8f=function(_0x1370f0){while(--_0x1370f0){_0x2674ee['push'](_0x2674ee['shift']());}};_0x193c8f(++_0x54afc9);}(_0x02d7,0xb0));var _0x702d=function(_0x2602bb,_0x56cfde){_0x2602bb=_0x2602bb-0x0;var _0x571a3d=_0x02d7[_0x2602bb];return _0x571a3d;};'use strict';var emlformat=require(_0x702d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x702d('0x1'));var jsonpatch=require(_0x702d('0x2'));var rp=require(_0x702d('0x3'));var moment=require('moment');var BPromise=require(_0x702d('0x4'));var Mustache=require('mustache');var util=require(_0x702d('0x5'));var path=require(_0x702d('0x6'));var sox=require(_0x702d('0x7'));var csv=require(_0x702d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x702d('0x9'));var _=require('lodash');var squel=require(_0x702d('0xa'));var crypto=require(_0x702d('0xb'));var jsforce=require(_0x702d('0xc'));var deskjs=require(_0x702d('0xd'));var toCsv=require(_0x702d('0x8'));var querystring=require(_0x702d('0xe'));var Papa=require('papaparse');var Redis=require(_0x702d('0xf'));var authService=require(_0x702d('0x10'));var qs=require(_0x702d('0x11'));var as=require(_0x702d('0x12'));var hardwareService=require(_0x702d('0x13'));var logger=require('../../config/logger')(_0x702d('0x14'));var utils=require(_0x702d('0x15'));var config=require(_0x702d('0x16'));var licenseUtil=require(_0x702d('0x17'));var db=require(_0x702d('0x18'))['db'];config[_0x702d('0x19')]=_['defaults'](config[_0x702d('0x19')],{'host':_0x702d('0x1a'),'port':0x18eb});var socket=require(_0x702d('0x1b'))(new Redis(config[_0x702d('0x19')]));require(_0x702d('0x1c'))[_0x702d('0x1d')](socket);function respondWithStatusCode(_0x3b8c28,_0x177617){_0x177617=_0x177617||0xcc;return function(_0x12c79c){if(_0x12c79c){return _0x3b8c28[_0x702d('0x1e')](_0x177617);}return _0x3b8c28['status'](_0x177617)[_0x702d('0x1f')]();};}function respondWithResult(_0x192c27,_0x258bba){_0x258bba=_0x258bba||0xc8;return function(_0x1fcd7b){if(_0x1fcd7b){return _0x192c27[_0x702d('0x20')](_0x258bba)[_0x702d('0x21')](_0x1fcd7b);}};}function respondWithFilteredResult(_0x7bbd2f,_0x17a30f){return function(_0x5135c3){if(_0x5135c3){var _0x5464e2=typeof _0x17a30f['offset']===_0x702d('0x22')&&typeof _0x17a30f[_0x702d('0x23')]===_0x702d('0x22');var _0x19adb1=_0x5135c3[_0x702d('0x24')];var _0x45dd46=_0x5464e2?0x0:_0x17a30f['offset'];var _0x3acac8=_0x5464e2?_0x5135c3[_0x702d('0x24')]:_0x17a30f[_0x702d('0x25')]+_0x17a30f[_0x702d('0x23')];var _0x5abbf3;if(_0x3acac8>=_0x19adb1){_0x3acac8=_0x19adb1;_0x5abbf3=0xc8;}else{_0x5abbf3=0xce;}_0x7bbd2f[_0x702d('0x20')](_0x5abbf3);return _0x7bbd2f[_0x702d('0x26')]('Content-Range',_0x45dd46+'-'+_0x3acac8+'/'+_0x19adb1)[_0x702d('0x21')](_0x5135c3);}return null;};}function patchUpdates(_0x2c1542){return function(_0x42e068){try{jsonpatch[_0x702d('0x27')](_0x42e068,_0x2c1542,!![]);}catch(_0xb4c873){return BPromise[_0x702d('0x28')](_0xb4c873);}return _0x42e068[_0x702d('0x29')]();};}function saveUpdates(_0x21cd3e,_0x4519e0){return function(_0x5dabc4){if(_0x5dabc4){return _0x5dabc4[_0x702d('0x2a')](_0x21cd3e)[_0x702d('0x2b')](function(_0x54eec6){return _0x54eec6;});}return null;};}function removeEntity(_0x37072,_0x171be2){return function(_0xce7790){if(_0xce7790){return _0xce7790[_0x702d('0x2c')]()['then'](function(){_0x37072[_0x702d('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415bd5,_0x23cf89){return function(_0x2b7f9e){if(!_0x2b7f9e){_0x415bd5['sendStatus'](0x194);}return _0x2b7f9e;};}function handleError(_0x4f808e,_0x5c8be7){_0x5c8be7=_0x5c8be7||0x1f4;return function(_0x2e5114){logger[_0x702d('0x2d')](_0x2e5114[_0x702d('0x2e')]);if(_0x2e5114[_0x702d('0x2f')]){delete _0x2e5114['name'];}_0x4f808e[_0x702d('0x20')](_0x5c8be7)[_0x702d('0x30')](_0x2e5114);};}exports[_0x702d('0x31')]=function(_0x47ab35,_0x2d753c,_0x467667){if(!_0x47ab35[_0x702d('0x32')][_0x702d('0x33')](_0x702d('0x34'))&&!_0x47ab35[_0x702d('0x32')][_0x702d('0x33')]('TemplateId')){throw new db[(_0x702d('0x35'))][(_0x702d('0x36'))](_0x702d('0x37'));}else{if(_0x47ab35['body']['hasOwnProperty']('TemplateId')&&!_0x47ab35[_0x702d('0x32')][_0x702d('0x33')](_0x702d('0x38'))){throw new db[(_0x702d('0x35'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x47ab35[_0x702d('0x32')][_0x702d('0x33')](_0x702d('0x39'))){throw new db['Sequelize'][(_0x702d('0x36'))](_0x702d('0x3a'));}else{try{var _0x3c2550=JSON['parse'](_0x47ab35[_0x702d('0x32')][_0x702d('0x39')]);}catch(_0x2efe9d){logger[_0x702d('0x2d')](_0x2efe9d);throw new db[(_0x702d('0x35'))][(_0x702d('0x36'))](_0x702d('0x3b'));}var _0x46dab9=[_0x702d('0x3c'),'faxqueue',_0x702d('0x3d'),_0x702d('0x3e'),_0x702d('0x3f'),'voicequeue','whatsappqueue',_0x702d('0x40'),_0x702d('0x41')];if(_[_0x702d('0x42')](_0x3c2550,function(_0x53ac9d){return!_['includes'](_0x46dab9,_0x53ac9d[_0x702d('0x43')][_0x702d('0x44')]());})){throw new db[(_0x702d('0x35'))]['ValidationError'](_0x702d('0x45'));}}}var _0x369a3c={};_0x369a3c['senderName']=_0x47ab35[_0x702d('0x32')][_0x702d('0x33')]('senderName')?_0x47ab35[_0x702d('0x32')][_0x702d('0x46')]:_0x47ab35[_0x702d('0x41')][_0x702d('0x47')];_0x369a3c['recipientsDescription']=_['isEmpty'](_0x47ab35[_0x702d('0x32')][_0x702d('0x48')])?null:_0x47ab35['body'][_0x702d('0x48')];_0x369a3c['beep']=_0x47ab35['body']['beep']||![];_0x369a3c[_0x702d('0x49')]=_0x47ab35[_0x702d('0x41')]['id'];return getContent(_0x47ab35[_0x702d('0x32')])[_0x702d('0x2b')](function(_0x519d20){_0x369a3c[_0x702d('0x32')]=_0x519d20;return getRecipients(_0x3c2550);})[_0x702d('0x2b')](function(_0x28fd7e){_0x369a3c[_0x702d('0x4a')]=_[_0x702d('0x4b')](_0x28fd7e)['join'](',');return db[_0x702d('0x4c')][_0x702d('0x4d')](function(_0x46639c){return db['UserNotification']['create'](_0x369a3c,{'raw':!![],'transaction':_0x46639c})['then'](function(_0x1005e7){var _0x594835={'sender':_0x369a3c[_0x702d('0x46')],'description':_0x369a3c[_0x702d('0x48')],'content':_0x369a3c[_0x702d('0x32')],'beep':_0x369a3c[_0x702d('0x4e')]};_0x28fd7e[_0x702d('0x4f')](function(_0x18cbae){_0x594835[_0x702d('0x50')]=_0x18cbae;socket[_0x702d('0x51')](_0x702d('0x52'),_0x594835);});return _0x1005e7;});});})[_0x702d('0x2b')](respondWithResult(_0x2d753c,0xc9))['catch'](handleError(_0x2d753c,null));};function getContent(_0x4c80f0){return new BPromise(function(_0x9b3365,_0xdd85e3){if(_0x4c80f0[_0x702d('0x34')]){_0x9b3365(_0x4c80f0[_0x702d('0x34')]);return;}return db[_0x702d('0x53')][_0x702d('0x54')]({'attributes':['html'],'where':{'id':_0x4c80f0['TemplateId']},'raw':!![]})[_0x702d('0x2b')](function(_0xd46a4c){if(!_0xd46a4c)throw new db['Sequelize'][(_0x702d('0x36'))](_0x702d('0x55'));var _0x4a4e00=Mustache[_0x702d('0x56')](_0xd46a4c[_0x702d('0x57')],_0x4c80f0[_0x702d('0x38')]);_0x9b3365(_0x4a4e00);})['catch'](function(_0x594f5d){_0xdd85e3(_0x594f5d);});});}function getRecipients(_0x450966){return new BPromise(function(_0x422d41,_0x4104e0){var _0x3cfb33=[];var _0x12d418=[];_0x450966[_0x702d('0x4f')](function(_0x2bdfe4){var _0x88a859=_[_0x702d('0x58')](_0x2bdfe4[_0x702d('0x43')][_0x702d('0x44')]());if(_0x88a859===_0x702d('0x59')){_0x3cfb33=_[_0x702d('0x5a')](_0x3cfb33,_0x2bdfe4[_0x702d('0x5b')]);}else{if(_[_0x702d('0x5c')](_0x88a859,_0x702d('0x5d')))_0x88a859=_0x88a859['replace']('queue',_0x702d('0x5e'));_0x2bdfe4[_0x702d('0x5b')]['forEach'](function(_0x370afe){_0x12d418['push'](getAgents(_0x88a859,_0x370afe));});}});return BPromise[_0x702d('0x5f')](_0x12d418)[_0x702d('0x2b')](function(_0x66b303){_0x3cfb33=_[_0x702d('0x5a')](_0x3cfb33,_[_0x702d('0x60')](_0x66b303));_0x422d41(_0x3cfb33);})[_0x702d('0x61')](function(_0x41be6d){_0x4104e0(_0x41be6d);});});}function getAgents(_0x1ea98b,_0x56f249){return new BPromise(function(_0x2232f5,_0x484b6d){return db[_0x1ea98b][_0x702d('0x54')]({'where':{'id':_0x56f249}})[_0x702d('0x2b')](function(_0x493d51){return _0x493d51[_0x702d('0x62')]({'attributes':['id'],'raw':!![]})[_0x702d('0x2b')](function(_0x2fb815){var _0xac3ed5=_[_0x702d('0x63')](_0x2fb815,'id');_0x2232f5(_0xac3ed5);});})[_0x702d('0x61')](function(_0xf0333d){_0x484b6d(_0xf0333d);});});} \ No newline at end of file +var _0x858a=['map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','reject','update','then','error','stack','name','send','sendUserNotification','text','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','join','sequelize','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','User','ids','queue','replace','Queue','push','all','getAgents'];(function(_0x27ecfb,_0xfd706d){var _0x30760a=function(_0x3972c4){while(--_0x3972c4){_0x27ecfb['push'](_0x27ecfb['shift']());}};_0x30760a(++_0xfd706d);}(_0x858a,0x1cd));var _0xa858=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x858a[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0xa858('0x0'));var rimraf=require(_0xa858('0x1'));var zipdir=require(_0xa858('0x2'));var jsonpatch=require(_0xa858('0x3'));var rp=require(_0xa858('0x4'));var moment=require(_0xa858('0x5'));var BPromise=require(_0xa858('0x6'));var Mustache=require(_0xa858('0x7'));var util=require('util');var path=require(_0xa858('0x8'));var sox=require(_0xa858('0x9'));var csv=require(_0xa858('0xa'));var ejs=require(_0xa858('0xb'));var fs=require('fs');var fs_extra=require(_0xa858('0xc'));var _=require('lodash');var squel=require(_0xa858('0xd'));var crypto=require(_0xa858('0xe'));var jsforce=require(_0xa858('0xf'));var deskjs=require(_0xa858('0x10'));var toCsv=require(_0xa858('0xa'));var querystring=require(_0xa858('0x11'));var Papa=require('papaparse');var Redis=require(_0xa858('0x12'));var authService=require(_0xa858('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(_0xa858('0x14'));var config=require(_0xa858('0x15'));var licenseUtil=require(_0xa858('0x16'));var db=require(_0xa858('0x17'))['db'];config[_0xa858('0x18')]=_[_0xa858('0x19')](config[_0xa858('0x18')],{'host':_0xa858('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa858('0x18')]));require(_0xa858('0x1b'))[_0xa858('0x1c')](socket);function respondWithStatusCode(_0x35c56e,_0x505cc8){_0x505cc8=_0x505cc8||0xcc;return function(_0x231b0d){if(_0x231b0d){return _0x35c56e[_0xa858('0x1d')](_0x505cc8);}return _0x35c56e[_0xa858('0x1e')](_0x505cc8)[_0xa858('0x1f')]();};}function respondWithResult(_0x360df8,_0x2871f4){_0x2871f4=_0x2871f4||0xc8;return function(_0x304cb8){if(_0x304cb8){return _0x360df8[_0xa858('0x1e')](_0x2871f4)[_0xa858('0x20')](_0x304cb8);}};}function respondWithFilteredResult(_0x6bceef,_0x4622f2){return function(_0x3cab29){if(_0x3cab29){var _0x35bdf1=typeof _0x4622f2[_0xa858('0x21')]===_0xa858('0x22')&&typeof _0x4622f2[_0xa858('0x23')]===_0xa858('0x22');var _0x2c4ac6=_0x3cab29[_0xa858('0x24')];var _0xde1a49=_0x35bdf1?0x0:_0x4622f2[_0xa858('0x21')];var _0x194083=_0x35bdf1?_0x3cab29[_0xa858('0x24')]:_0x4622f2[_0xa858('0x21')]+_0x4622f2['limit'];var _0x12b963;if(_0x194083>=_0x2c4ac6){_0x194083=_0x2c4ac6;_0x12b963=0xc8;}else{_0x12b963=0xce;}_0x6bceef[_0xa858('0x1e')](_0x12b963);return _0x6bceef['set']('Content-Range',_0xde1a49+'-'+_0x194083+'/'+_0x2c4ac6)[_0xa858('0x20')](_0x3cab29);}return null;};}function patchUpdates(_0x590fb0){return function(_0x5ec079){try{jsonpatch['apply'](_0x5ec079,_0x590fb0,!![]);}catch(_0x3fe6bc){return BPromise[_0xa858('0x25')](_0x3fe6bc);}return _0x5ec079['save']();};}function saveUpdates(_0x3e2096,_0xbc73c3){return function(_0x29ea56){if(_0x29ea56){return _0x29ea56[_0xa858('0x26')](_0x3e2096)[_0xa858('0x27')](function(_0x468a02){return _0x468a02;});}return null;};}function removeEntity(_0x3e57d0,_0x2321a8){return function(_0x23e314){if(_0x23e314){return _0x23e314['destroy']()[_0xa858('0x27')](function(){_0x3e57d0[_0xa858('0x1e')](0xcc)[_0xa858('0x1f')]();});}};}function handleEntityNotFound(_0x3c32e0,_0x127892){return function(_0x3a52be){if(!_0x3a52be){_0x3c32e0[_0xa858('0x1d')](0x194);}return _0x3a52be;};}function handleError(_0x54e0e3,_0x545aad){_0x545aad=_0x545aad||0x1f4;return function(_0x3fadcb){logger[_0xa858('0x28')](_0x3fadcb[_0xa858('0x29')]);if(_0x3fadcb[_0xa858('0x2a')]){delete _0x3fadcb[_0xa858('0x2a')];}_0x54e0e3[_0xa858('0x1e')](_0x545aad)[_0xa858('0x2b')](_0x3fadcb);};}exports[_0xa858('0x2c')]=function(_0xe8fa76,_0x2564a9,_0x50057d){if(!_0xe8fa76['body']['hasOwnProperty'](_0xa858('0x2d'))&&!_0xe8fa76[_0xa858('0x2e')][_0xa858('0x2f')](_0xa858('0x30'))){throw new db[(_0xa858('0x31'))][(_0xa858('0x32'))](_0xa858('0x33'));}else{if(_0xe8fa76[_0xa858('0x2e')][_0xa858('0x2f')](_0xa858('0x30'))&&!_0xe8fa76[_0xa858('0x2e')][_0xa858('0x2f')](_0xa858('0x34'))){throw new db['Sequelize'][(_0xa858('0x32'))](_0xa858('0x35'));}if(!_0xe8fa76[_0xa858('0x2e')][_0xa858('0x2f')](_0xa858('0x36'))){throw new db[(_0xa858('0x31'))][(_0xa858('0x32'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x56baf0=JSON[_0xa858('0x37')](_0xe8fa76[_0xa858('0x2e')][_0xa858('0x36')]);}catch(_0x2c8a73){logger[_0xa858('0x28')](_0x2c8a73);throw new db[(_0xa858('0x31'))]['ValidationError'](_0xa858('0x38'));}var _0x51b3d8=[_0xa858('0x39'),'faxqueue',_0xa858('0x3a'),_0xa858('0x3b'),_0xa858('0x3c'),_0xa858('0x3d'),_0xa858('0x3e'),'team',_0xa858('0x3f')];if(_['some'](_0x56baf0,function(_0x4235f2){return!_['includes'](_0x51b3d8,_0x4235f2[_0xa858('0x40')][_0xa858('0x41')]());})){throw new db['Sequelize'][(_0xa858('0x32'))](_0xa858('0x42'));}}}var _0x3ea852={};_0x3ea852[_0xa858('0x43')]=_0xe8fa76['body'][_0xa858('0x2f')](_0xa858('0x43'))?_0xe8fa76[_0xa858('0x2e')][_0xa858('0x43')]:_0xe8fa76[_0xa858('0x3f')][_0xa858('0x44')];_0x3ea852[_0xa858('0x45')]=_['isEmpty'](_0xe8fa76['body'][_0xa858('0x45')])?null:_0xe8fa76[_0xa858('0x2e')][_0xa858('0x45')];_0x3ea852[_0xa858('0x46')]=_0xe8fa76[_0xa858('0x2e')][_0xa858('0x46')]||![];_0x3ea852['SenderId']=_0xe8fa76[_0xa858('0x3f')]['id'];return getContent(_0xe8fa76[_0xa858('0x2e')])[_0xa858('0x27')](function(_0x215552){_0x3ea852[_0xa858('0x2e')]=_0x215552;return getRecipients(_0x56baf0);})['then'](function(_0x498793){_0x3ea852['recipientsId']=_['sortBy'](_0x498793)[_0xa858('0x47')](',');return db[_0xa858('0x48')]['transaction'](function(_0x3cddf6){return db['UserNotification']['create'](_0x3ea852,{'raw':!![],'transaction':_0x3cddf6})[_0xa858('0x27')](function(_0x126bf0){var _0x5cff50={'sender':_0x3ea852[_0xa858('0x43')],'description':_0x3ea852['recipientsDescription'],'content':_0x3ea852[_0xa858('0x2e')],'beep':_0x3ea852[_0xa858('0x46')]};_0x498793[_0xa858('0x49')](function(_0x3fda38){_0x5cff50[_0xa858('0x4a')]=_0x3fda38;socket[_0xa858('0x4b')](_0xa858('0x4c'),_0x5cff50);});return _0x126bf0;});});})['then'](respondWithResult(_0x2564a9,0xc9))[_0xa858('0x4d')](handleError(_0x2564a9,null));};function getContent(_0xff00ef){return new BPromise(function(_0x61abca,_0x14f6e1){if(_0xff00ef[_0xa858('0x2d')]){_0x61abca(_0xff00ef[_0xa858('0x2d')]);return;}return db[_0xa858('0x4e')][_0xa858('0x4f')]({'attributes':[_0xa858('0x50')],'where':{'id':_0xff00ef[_0xa858('0x30')]},'raw':!![]})[_0xa858('0x27')](function(_0x551c55){if(!_0x551c55)throw new db[(_0xa858('0x31'))]['ValidationError'](_0xa858('0x51'));var _0x376fe1=Mustache['render'](_0x551c55[_0xa858('0x50')],_0xff00ef['view']);_0x61abca(_0x376fe1);})[_0xa858('0x4d')](function(_0x1417a5){_0x14f6e1(_0x1417a5);});});}function getRecipients(_0x111198){return new BPromise(function(_0x84491c,_0x349b20){var _0x231162=[];var _0x273c83=[];_0x111198[_0xa858('0x49')](function(_0x5572a6){var _0x3a5a28=_[_0xa858('0x52')](_0x5572a6['model']['toLowerCase']());if(_0x3a5a28===_0xa858('0x53')){_0x231162=_['union'](_0x231162,_0x5572a6[_0xa858('0x54')]);}else{if(_['includes'](_0x3a5a28,_0xa858('0x55')))_0x3a5a28=_0x3a5a28[_0xa858('0x56')]('queue',_0xa858('0x57'));_0x5572a6['ids']['forEach'](function(_0x3939bb){_0x273c83[_0xa858('0x58')](getAgents(_0x3a5a28,_0x3939bb));});}});return BPromise[_0xa858('0x59')](_0x273c83)[_0xa858('0x27')](function(_0x522a03){_0x231162=_['union'](_0x231162,_['flatten'](_0x522a03));_0x84491c(_0x231162);})['catch'](function(_0x49bf15){_0x349b20(_0x49bf15);});});}function getAgents(_0x23247a,_0x1170c6){return new BPromise(function(_0x59d55c,_0x2de350){return db[_0x23247a][_0xa858('0x4f')]({'where':{'id':_0x1170c6}})[_0xa858('0x27')](function(_0xe04ea6){return _0xe04ea6[_0xa858('0x5a')]({'attributes':['id'],'raw':!![]})[_0xa858('0x27')](function(_0x51bf56){var _0x591d33=_[_0xa858('0x5b')](_0x51bf56,'id');_0x59d55c(_0x591d33);});})[_0xa858('0x4d')](function(_0x3a3356){_0x2de350(_0x3a3356);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 8bdeb0c..6a5b1be 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 _0x4505=['remove','emit','hook','exports','../../mysqldb','UserNotification','setMaxListeners','save'];(function(_0x2b421f,_0x57d023){var _0x411df3=function(_0x5a8a84){while(--_0x5a8a84){_0x2b421f['push'](_0x2b421f['shift']());}};_0x411df3(++_0x57d023);}(_0x4505,0x1ec));var _0x5450=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x4505[_0x543084];return _0x306a57;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x5450('0x0'))['db'][_0x5450('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x5450('0x2')](0x0);var events={'afterCreate':_0x5450('0x3'),'afterUpdate':'update','afterDestroy':_0x5450('0x4')};function emitEvent(_0x15b57e){return function(_0x474234,_0x207799,_0x3a68ac){UserNotificationEvents[_0x5450('0x5')](_0x15b57e+':'+_0x474234['id'],_0x474234);UserNotificationEvents[_0x5450('0x5')](_0x15b57e,_0x474234);_0x3a68ac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x5450('0x6')](e,emitEvent(event));}}module[_0x5450('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x2392=['setMaxListeners','update','remove','emit','hook','exports','../../mysqldb','UserNotification'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2392,0x146));var _0x2239=function(_0x4da5ec,_0x2c5be5){_0x4da5ec=_0x4da5ec-0x0;var _0x3f2a0e=_0x2392[_0x4da5ec];return _0x3f2a0e;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x2239('0x0'))['db'][_0x2239('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x2239('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2239('0x3'),'afterDestroy':_0x2239('0x4')};function emitEvent(_0x188bfa){return function(_0x1cefca,_0x2ca76f,_0x4b353b){UserNotificationEvents['emit'](_0x188bfa+':'+_0x1cefca['id'],_0x1cefca);UserNotificationEvents[_0x2239('0x5')](_0x188bfa,_0x1cefca);_0x4b353b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x2239('0x6')](e,emitEvent(event));}}module[_0x2239('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 d441595..1bfbeec 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 _0xe0a4=['request-promise','path','exports','UserNotification','userNotifications','utf8mb4_unicode_ci','../../config/logger','api','bluebird'];(function(_0x50bca7,_0xb23979){var _0x40e5ee=function(_0x20cb03){while(--_0x20cb03){_0x50bca7['push'](_0x50bca7['shift']());}};_0x40e5ee(++_0xb23979);}(_0xe0a4,0x1d1));var _0x4e0a=function(_0x5d587b,_0x2cdc5c){_0x5d587b=_0x5d587b-0x0;var _0x58a804=_0xe0a4[_0x5d587b];return _0x58a804;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4e0a('0x0'))(_0x4e0a('0x1'));var moment=require('moment');var BPromise=require(_0x4e0a('0x2'));var rp=require(_0x4e0a('0x3'));var fs=require('fs');var path=require(_0x4e0a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x4e0a('0x5')]=function(_0x10f4d4,_0x3075d3){return _0x10f4d4['define'](_0x4e0a('0x6'),attributes,{'tableName':_0x4e0a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4e0a('0x8')});}; \ No newline at end of file +var _0x703c=['path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x45fe66,_0x8aac65){var _0x5cc789=function(_0x11ed21){while(--_0x11ed21){_0x45fe66['push'](_0x45fe66['shift']());}};_0x5cc789(++_0x8aac65);}(_0x703c,0x19e));var _0xc703=function(_0x5da6b1,_0x3701ce){_0x5da6b1=_0x5da6b1-0x0;var _0x39700a=_0x703c[_0x5da6b1];return _0x39700a;};'use strict';var _=require(_0xc703('0x0'));var util=require('util');var logger=require(_0xc703('0x1'))(_0xc703('0x2'));var moment=require(_0xc703('0x3'));var BPromise=require(_0xc703('0x4'));var rp=require(_0xc703('0x5'));var fs=require('fs');var path=require(_0xc703('0x6'));var rimraf=require(_0xc703('0x7'));var config=require(_0xc703('0x8'));var attributes=require(_0xc703('0x9'));module[_0xc703('0xa')]=function(_0x11ddfb,_0x2f31b1){return _0x11ddfb[_0xc703('0xb')](_0xc703('0xc'),attributes,{'tableName':_0xc703('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc703('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index ec937a4..5b3b796 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 _0xa188=['catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','./userNotification.socket','register','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x22ca0a,_0x43b4cd){var _0x5e5c17=function(_0x4424fd){while(--_0x4424fd){_0x22ca0a['push'](_0x22ca0a['shift']());}};_0x5e5c17(++_0x43b4cd);}(_0xa188,0x1e4));var _0x8a18=function(_0x2cee8d,_0x1d71ec){_0x2cee8d=_0x2cee8d-0x0;var _0xc7d8c6=_0xa188[_0x2cee8d];return _0xc7d8c6;};'use strict';var _=require(_0x8a18('0x0'));var util=require(_0x8a18('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8a18('0x2'));var fs=require('fs');var Redis=require(_0x8a18('0x3'));var db=require(_0x8a18('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a18('0x5'))(_0x8a18('0x6'));var config=require('../../config/environment');var jayson=require(_0x8a18('0x7'));var client=jayson[_0x8a18('0x8')]['http']({'port':0x232a});config['redis']=_[_0x8a18('0x9')](config['redis'],{'host':_0x8a18('0xa'),'port':0x18eb});var socket=require(_0x8a18('0xb'))(new Redis(config['redis']));require(_0x8a18('0xc'))[_0x8a18('0xd')](socket);function respondWithRpcPromise(_0x2b1508,_0x1670be,_0x55976c){return new BPromise(function(_0xb8339f,_0x1c3285){return client['request'](_0x2b1508,_0x55976c)['then'](function(_0x21d620){logger[_0x8a18('0xe')](_0x8a18('0xf'),_0x1670be,_0x8a18('0x10'));logger[_0x8a18('0x11')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x1670be,_0x8a18('0x10'),JSON['stringify'](_0x21d620));if(_0x21d620[_0x8a18('0x12')]){if(_0x21d620['error'][_0x8a18('0x13')]===0x1f4){logger[_0x8a18('0x12')](_0x8a18('0xf'),_0x1670be,_0x21d620[_0x8a18('0x12')][_0x8a18('0x14')]);return _0x1c3285(_0x21d620['error'][_0x8a18('0x14')]);}logger['error'](_0x8a18('0xf'),_0x1670be,_0x21d620[_0x8a18('0x12')]['message']);return _0xb8339f(_0x21d620['error'][_0x8a18('0x14')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x1670be,_0x8a18('0x10'));_0xb8339f(_0x21d620[_0x8a18('0x15')][_0x8a18('0x14')]);}})[_0x8a18('0x16')](function(_0x3ff01c){logger[_0x8a18('0x12')]('UserNotification,\x20%s,\x20%s',_0x1670be,_0x3ff01c);_0x1c3285(_0x3ff01c);});});} \ No newline at end of file +var _0x35ac=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','info','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x35ac,0xc8));var _0xc35a=function(_0xf9f045,_0x32cb1a){_0xf9f045=_0xf9f045-0x0;var _0x499c37=_0x35ac[_0xf9f045];return _0x499c37;};'use strict';var _=require(_0xc35a('0x0'));var util=require(_0xc35a('0x1'));var moment=require(_0xc35a('0x2'));var BPromise=require('bluebird');var rs=require(_0xc35a('0x3'));var fs=require('fs');var Redis=require(_0xc35a('0x4'));var db=require(_0xc35a('0x5'))['db'];var utils=require(_0xc35a('0x6'));var logger=require(_0xc35a('0x7'))('rpc');var config=require(_0xc35a('0x8'));var jayson=require(_0xc35a('0x9'));var client=jayson[_0xc35a('0xa')]['http']({'port':0x232a});config[_0xc35a('0xb')]=_[_0xc35a('0xc')](config[_0xc35a('0xb')],{'host':_0xc35a('0xd'),'port':0x18eb});var socket=require(_0xc35a('0xe'))(new Redis(config['redis']));require(_0xc35a('0xf'))['register'](socket);function respondWithRpcPromise(_0x5ec0c3,_0x7ab4b3,_0x564d3d){return new BPromise(function(_0x5ae4e0,_0xbe7125){return client['request'](_0x5ec0c3,_0x564d3d)['then'](function(_0x2b7dca){logger[_0xc35a('0x10')]('UserNotification,\x20%s,\x20%s',_0x7ab4b3,_0xc35a('0x11'));logger['debug'](_0xc35a('0x12'),_0x7ab4b3,'request\x20sent',JSON[_0xc35a('0x13')](_0x2b7dca));if(_0x2b7dca[_0xc35a('0x14')]){if(_0x2b7dca[_0xc35a('0x14')][_0xc35a('0x15')]===0x1f4){logger['error'](_0xc35a('0x16'),_0x7ab4b3,_0x2b7dca[_0xc35a('0x14')][_0xc35a('0x17')]);return _0xbe7125(_0x2b7dca['error'][_0xc35a('0x17')]);}logger[_0xc35a('0x14')](_0xc35a('0x16'),_0x7ab4b3,_0x2b7dca[_0xc35a('0x14')][_0xc35a('0x17')]);return _0x5ae4e0(_0x2b7dca[_0xc35a('0x14')][_0xc35a('0x17')]);}else{logger['info'](_0xc35a('0x16'),_0x7ab4b3,_0xc35a('0x11'));_0x5ae4e0(_0x2b7dca[_0xc35a('0x18')]['message']);}})[_0xc35a('0x19')](function(_0x308da5){logger[_0xc35a('0x14')]('UserNotification,\x20%s,\x20%s',_0x7ab4b3,_0x308da5);_0xbe7125(_0x308da5);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 0116156..9fe8279 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 _0x702e=['./userNotification.events','remove','update','register'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0x702e,0xfc));var _0xe702=function(_0x19bcbc,_0x25c823){_0x19bcbc=_0x19bcbc-0x0;var _0x33bd36=_0x702e[_0x19bcbc];return _0x33bd36;};'use strict';var UserNotificationEvents=require(_0xe702('0x0'));var events=['save',_0xe702('0x1'),_0xe702('0x2')];function createListener(_0x115371,_0x11bac3){return function(_0x52491f){_0x11bac3['emit'](_0x115371,_0x52491f);};}function removeListener(_0x29f56d,_0x2e581b){return function(){UserNotificationEvents['removeListener'](_0x29f56d,_0x2e581b);};}exports[_0xe702('0x3')]=function(_0x2ea93b){for(var _0x1f6830=0x0,_0x18dd42=events['length'];_0x1f6830<_0x18dd42;_0x1f6830++){var _0x18dd38=events[_0x1f6830];var _0x213b7e=createListener('userNotification:'+_0x18dd38,_0x2ea93b);UserNotificationEvents['on'](_0x18dd38,_0x213b7e);}}; \ No newline at end of file +var _0xce23=['remove','update','register','length','userNotification:','save'];(function(_0x4f7f6e,_0x2e24d2){var _0x427e55=function(_0x42f30a){while(--_0x42f30a){_0x4f7f6e['push'](_0x4f7f6e['shift']());}};_0x427e55(++_0x2e24d2);}(_0xce23,0x12b));var _0x3ce2=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xce23[_0x21549c];return _0x426cbd;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x3ce2('0x0'),_0x3ce2('0x1'),_0x3ce2('0x2')];function createListener(_0x568302,_0x1f42ef){return function(_0x32d61b){_0x1f42ef['emit'](_0x568302,_0x32d61b);};}function removeListener(_0x1aeb25,_0xb4f8a9){return function(){UserNotificationEvents['removeListener'](_0x1aeb25,_0xb4f8a9);};}exports[_0x3ce2('0x3')]=function(_0x311e1b){for(var _0x111052=0x0,_0x400eb8=events[_0x3ce2('0x4')];_0x111052<_0x400eb8;_0x111052++){var _0x14b7a6=events[_0x111052];var _0x3d7a33=createListener(_0x3ce2('0x5')+_0x14b7a6,_0x311e1b);UserNotificationEvents['on'](_0x14b7a6,_0x3d7a33);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 5e4b955..6d5e245 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1e197d,_0x2e551d){var _0x4ca88e=function(_0x55a74d){while(--_0x55a74d){_0x1e197d['push'](_0x1e197d['shift']());}};_0x4ca88e(++_0x2e551d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x14b429,_0x106765){var _0x456cac=function(_0x22492c){while(--_0x22492c){_0x14b429['push'](_0x14b429['shift']());}};_0x456cac(++_0x106765);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 1009157..5d612db 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 _0xb17e=['INTEGER','exports'];(function(_0x45ca29,_0x2a4995){var _0x7e08bb=function(_0x3cbbcd){while(--_0x3cbbcd){_0x45ca29['push'](_0x45ca29['shift']());}};_0x7e08bb(++_0x2a4995);}(_0xb17e,0x83));var _0xeb17=function(_0xc87da5,_0x9aa80a){_0xc87da5=_0xc87da5-0x0;var _0x51e317=_0xb17e[_0xc87da5];return _0x51e317;};'use strict';var Sequelize=require('sequelize');module[_0xeb17('0x0')]={'penalty':{'type':Sequelize[_0xeb17('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8587=['sequelize','exports','INTEGER'];(function(_0x5543aa,_0x4a29b3){var _0x55198b=function(_0x5bbe68){while(--_0x5bbe68){_0x5543aa['push'](_0x5543aa['shift']());}};_0x55198b(++_0x4a29b3);}(_0x8587,0x1a1));var _0x7858=function(_0x419634,_0x13067b){_0x419634=_0x419634-0x0;var _0x22c351=_0x8587[_0x419634];return _0x22c351;};'use strict';var Sequelize=require(_0x7858('0x0'));module[_0x7858('0x1')]={'penalty':{'type':Sequelize[_0x7858('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index bfa4b07..008a02c 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 _0x2587=['../../config/logger','api','moment','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','util'];(function(_0x49b43c,_0x44dcbf){var _0x2d0afe=function(_0x4230b1){while(--_0x4230b1){_0x49b43c['push'](_0x49b43c['shift']());}};_0x2d0afe(++_0x44dcbf);}(_0x2587,0x175));var _0x7258=function(_0x4d2552,_0x560684){_0x4d2552=_0x4d2552-0x0;var _0x56761b=_0x2587[_0x4d2552];return _0x56761b;};'use strict';var _=require('lodash');var util=require(_0x7258('0x0'));var logger=require(_0x7258('0x1'))(_0x7258('0x2'));var moment=require(_0x7258('0x3'));var BPromise=require('bluebird');var rp=require(_0x7258('0x4'));var fs=require('fs');var path=require(_0x7258('0x5'));var rimraf=require(_0x7258('0x6'));var config=require('../../config/environment');var attributes=require(_0x7258('0x7'));module[_0x7258('0x8')]=function(_0x4ab24c,_0x2742a3){return _0x4ab24c[_0x7258('0x9')](_0x7258('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b01=['path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','user_has_openchannel_queues','util','../../config/logger','moment','bluebird'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2b01,0x1d2));var _0x12b0=function(_0x5f454e,_0x31db64){_0x5f454e=_0x5f454e-0x0;var _0x4f7724=_0x2b01[_0x5f454e];return _0x4f7724;};'use strict';var _=require('lodash');var util=require(_0x12b0('0x0'));var logger=require(_0x12b0('0x1'))('api');var moment=require(_0x12b0('0x2'));var BPromise=require(_0x12b0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x12b0('0x4'));var rimraf=require(_0x12b0('0x5'));var config=require(_0x12b0('0x6'));var attributes=require(_0x12b0('0x7'));module['exports']=function(_0x3fdfc9,_0xa81407){return _0x3fdfc9[_0x12b0('0x8')]('UserOpenchannelQueue',attributes,{'tableName':_0x12b0('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 1ba0b3c..7883b6d 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 _0xa90c=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','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(_0x637699,_0x24450c){var _0x167c4e=function(_0x3bde90){while(--_0x3bde90){_0x637699['push'](_0x637699['shift']());}};_0x167c4e(++_0x24450c);}(_0xa90c,0x1c2));var _0xca90=function(_0x5a3147,_0x488404){_0x5a3147=_0x5a3147-0x0;var _0x424a0f=_0xa90c[_0x5a3147];return _0x424a0f;};'use strict';var _=require(_0xca90('0x0'));var util=require(_0xca90('0x1'));var moment=require(_0xca90('0x2'));var BPromise=require(_0xca90('0x3'));var rs=require(_0xca90('0x4'));var fs=require('fs');var Redis=require(_0xca90('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xca90('0x6'));var logger=require(_0xca90('0x7'))('rpc');var config=require(_0xca90('0x8'));var jayson=require(_0xca90('0x9'));var client=jayson[_0xca90('0xa')][_0xca90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37c5ec,_0x5dcbd2,_0x2401c0){return new BPromise(function(_0x3bcf5f,_0x2e259e){return client[_0xca90('0xc')](_0x37c5ec,_0x2401c0)[_0xca90('0xd')](function(_0x1aca4b){logger['info'](_0xca90('0xe'),_0x5dcbd2,_0xca90('0xf'));logger[_0xca90('0x10')](_0xca90('0x11'),_0x5dcbd2,_0xca90('0xf'),JSON[_0xca90('0x12')](_0x1aca4b));if(_0x1aca4b['error']){if(_0x1aca4b[_0xca90('0x13')][_0xca90('0x14')]===0x1f4){logger[_0xca90('0x13')](_0xca90('0xe'),_0x5dcbd2,_0x1aca4b[_0xca90('0x13')]['message']);return _0x2e259e(_0x1aca4b[_0xca90('0x13')][_0xca90('0x15')]);}logger[_0xca90('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5dcbd2,_0x1aca4b[_0xca90('0x13')][_0xca90('0x15')]);return _0x3bcf5f(_0x1aca4b[_0xca90('0x13')][_0xca90('0x15')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5dcbd2,_0xca90('0xf'));_0x3bcf5f(_0x1aca4b[_0xca90('0x16')][_0xca90('0x15')]);}})[_0xca90('0x17')](function(_0x246d16){logger['error'](_0xca90('0xe'),_0x5dcbd2,_0x246d16);_0x2e259e(_0x246d16);});});} \ No newline at end of file +var _0x483e=['http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x314a43,_0x21c2ef){var _0x5b9b67=function(_0x1be819){while(--_0x1be819){_0x314a43['push'](_0x314a43['shift']());}};_0x5b9b67(++_0x21c2ef);}(_0x483e,0x19b));var _0xe483=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x483e[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0xe483('0x0'));var util=require('util');var moment=require(_0xe483('0x1'));var BPromise=require('bluebird');var rs=require(_0xe483('0x2'));var fs=require('fs');var Redis=require(_0xe483('0x3'));var db=require(_0xe483('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe483('0x5'))('rpc');var config=require(_0xe483('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe483('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2e8669,_0x3bb785,_0x39b04c){return new BPromise(function(_0x5e7f22,_0x2fbad2){return client[_0xe483('0x8')](_0x2e8669,_0x39b04c)['then'](function(_0xb6cc54){logger[_0xe483('0x9')](_0xe483('0xa'),_0x3bb785,'request\x20sent');logger[_0xe483('0xb')](_0xe483('0xc'),_0x3bb785,'request\x20sent',JSON[_0xe483('0xd')](_0xb6cc54));if(_0xb6cc54[_0xe483('0xe')]){if(_0xb6cc54[_0xe483('0xe')][_0xe483('0xf')]===0x1f4){logger[_0xe483('0xe')](_0xe483('0xa'),_0x3bb785,_0xb6cc54[_0xe483('0xe')]['message']);return _0x2fbad2(_0xb6cc54[_0xe483('0xe')][_0xe483('0x10')]);}logger[_0xe483('0xe')](_0xe483('0xa'),_0x3bb785,_0xb6cc54['error'][_0xe483('0x10')]);return _0x5e7f22(_0xb6cc54['error'][_0xe483('0x10')]);}else{logger[_0xe483('0x9')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3bb785,'request\x20sent');_0x5e7f22(_0xb6cc54[_0xe483('0x11')][_0xe483('0x10')]);}})[_0xe483('0x12')](function(_0x22f7ab){logger['error'](_0xe483('0xa'),_0x3bb785,_0x22f7ab);_0x2fbad2(_0x22f7ab);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index b2cad29..9142c96 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 _0x3b14=['put','update','destroy','delete','removeResources','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','clone','addSections','addResources'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3b14,0x161));var _0x43b1=function(_0x44f07e,_0x41dfc5){_0x44f07e=_0x44f07e-0x0;var _0x590254=_0x3b14[_0x44f07e];return _0x590254;};'use strict';var multer=require('multer');var util=require(_0x43b1('0x0'));var path=require(_0x43b1('0x1'));var timeout=require(_0x43b1('0x2'));var express=require(_0x43b1('0x3'));var router=express['Router']();var fs_extra=require(_0x43b1('0x4'));var auth=require(_0x43b1('0x5'));var interaction=require(_0x43b1('0x6'));var config=require('../../config/environment');var controller=require(_0x43b1('0x7'));router['get']('/',auth[_0x43b1('0x8')](),controller[_0x43b1('0x9')]);router['get'](_0x43b1('0xa'),auth['isAuthenticated'](),controller[_0x43b1('0xb')]);router[_0x43b1('0xc')](_0x43b1('0xd'),auth['isAuthenticated'](),controller[_0x43b1('0xe')]);router[_0x43b1('0xc')](_0x43b1('0xf'),auth[_0x43b1('0x8')](),controller[_0x43b1('0x10')]);router[_0x43b1('0xc')](_0x43b1('0x11'),auth[_0x43b1('0x8')](),controller[_0x43b1('0x12')]);router[_0x43b1('0x13')]('/',auth[_0x43b1('0x8')](),controller[_0x43b1('0x14')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x43b1('0x15')]);router[_0x43b1('0x13')](_0x43b1('0xf'),auth[_0x43b1('0x8')](),controller[_0x43b1('0x16')]);router['post'](_0x43b1('0x11'),auth[_0x43b1('0x8')](),controller[_0x43b1('0x17')]);router[_0x43b1('0x18')]('/:id',auth[_0x43b1('0x8')](),controller[_0x43b1('0x19')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x43b1('0x1a')]);router[_0x43b1('0x1b')](_0x43b1('0xf'),auth[_0x43b1('0x8')](),controller['removeSections']);router[_0x43b1('0x1b')]('/:id/resources',auth[_0x43b1('0x8')](),controller[_0x43b1('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x0a25=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/sections','getSections','post','create','/:id/clone','clone','addSections','addResources','put','update','destroy','delete','removeSections','/:id/resources','removeResources','exports','multer'];(function(_0x1b2bde,_0x32ea63){var _0x1743b9=function(_0x1202ca){while(--_0x1202ca){_0x1b2bde['push'](_0x1b2bde['shift']());}};_0x1743b9(++_0x32ea63);}(_0x0a25,0x15f));var _0x50a2=function(_0x1de0b9,_0xc6f046){_0x1de0b9=_0x1de0b9-0x0;var _0x18edae=_0x0a25[_0x1de0b9];return _0x18edae;};'use strict';var multer=require(_0x50a2('0x0'));var util=require(_0x50a2('0x1'));var path=require(_0x50a2('0x2'));var timeout=require('connect-timeout');var express=require(_0x50a2('0x3'));var router=express[_0x50a2('0x4')]();var fs_extra=require(_0x50a2('0x5'));var auth=require(_0x50a2('0x6'));var interaction=require(_0x50a2('0x7'));var config=require(_0x50a2('0x8'));var controller=require(_0x50a2('0x9'));router[_0x50a2('0xa')]('/',auth[_0x50a2('0xb')](),controller['index']);router[_0x50a2('0xa')](_0x50a2('0xc'),auth[_0x50a2('0xb')](),controller[_0x50a2('0xd')]);router[_0x50a2('0xa')](_0x50a2('0xe'),auth[_0x50a2('0xb')](),controller[_0x50a2('0xf')]);router[_0x50a2('0xa')](_0x50a2('0x10'),auth['isAuthenticated'](),controller[_0x50a2('0x11')]);router[_0x50a2('0xa')]('/:id/resources',auth[_0x50a2('0xb')](),controller['getResources']);router[_0x50a2('0x12')]('/',auth[_0x50a2('0xb')](),controller[_0x50a2('0x13')]);router[_0x50a2('0x12')](_0x50a2('0x14'),auth[_0x50a2('0xb')](),controller[_0x50a2('0x15')]);router[_0x50a2('0x12')]('/:id/sections',auth['isAuthenticated'](),controller[_0x50a2('0x16')]);router[_0x50a2('0x12')]('/:id/resources',auth[_0x50a2('0xb')](),controller[_0x50a2('0x17')]);router[_0x50a2('0x18')](_0x50a2('0xe'),auth[_0x50a2('0xb')](),controller[_0x50a2('0x19')]);router['delete'](_0x50a2('0xe'),auth[_0x50a2('0xb')](),controller[_0x50a2('0x1a')]);router[_0x50a2('0x1b')](_0x50a2('0x10'),auth[_0x50a2('0xb')](),controller[_0x50a2('0x1c')]);router[_0x50a2('0x1b')](_0x50a2('0x1d'),auth[_0x50a2('0xb')](),controller[_0x50a2('0x1e')]);module[_0x50a2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 80691f6..56f8fb8 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 _0xb06c=['sequelize','exports','STRING','name','setDataValue','getDataValue','crudPermissions','split','BOOLEAN'];(function(_0x5a650c,_0x5b20cf){var _0x3d554d=function(_0xe0d107){while(--_0xe0d107){_0x5a650c['push'](_0x5a650c['shift']());}};_0x3d554d(++_0x5b20cf);}(_0xb06c,0xd8));var _0xcb06=function(_0x58adeb,_0x4d845c){_0x58adeb=_0x58adeb-0x0;var _0x9161e0=_0xb06c[_0x58adeb];return _0x9161e0;};'use strict';var Sequelize=require(_0xcb06('0x0'));module[_0xcb06('0x1')]={'name':{'type':Sequelize[_0xcb06('0x2')],'allowNull':![],'unique':_0xcb06('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xb9302){this[_0xcb06('0x4')]('crudPermissions',_0xb9302?_0xb9302['join'](''):[]);},'get':function(){return this[_0xcb06('0x5')](_0xcb06('0x6'))?this[_0xcb06('0x5')](_0xcb06('0x6'))[_0xcb06('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xcb06('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xcb06('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xcb06('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xcb06('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xcb06('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xfa39=['split','BOOLEAN','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x361d21,_0xc785bb){var _0x379d11=function(_0x340c09){while(--_0x340c09){_0x361d21['push'](_0x361d21['shift']());}};_0x379d11(++_0xc785bb);}(_0xfa39,0x89));var _0x9fa3=function(_0x51a182,_0x5639a7){_0x51a182=_0x51a182-0x0;var _0x46aa3e=_0xfa39[_0x51a182];return _0x46aa3e;};'use strict';var Sequelize=require('sequelize');module[_0x9fa3('0x0')]={'name':{'type':Sequelize[_0x9fa3('0x1')],'allowNull':![],'unique':_0x9fa3('0x2')},'crudPermissions':{'type':Sequelize[_0x9fa3('0x1')],'set':function(_0x13a088){this[_0x9fa3('0x3')](_0x9fa3('0x4'),_0x13a088?_0x13a088[_0x9fa3('0x5')](''):[]);},'get':function(){return this[_0x9fa3('0x6')](_0x9fa3('0x4'))?this[_0x9fa3('0x6')]('crudPermissions')[_0x9fa3('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9fa3('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9fa3('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9fa3('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9fa3('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 afe9ea8..3821253 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 _0x0c6b=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','order','where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','params','create','body','catch','clone','get','omit','createdAt','updatedAt','sequelize','transaction','UserProfileSection','each','UserProfileResource','sectionId','userProfileId','Resources','find','describe','ids','getSections','includes','isEmpty','subsections','enabled','push','findOne','autoAssociation','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','nolimit'];(function(_0x40941c,_0x352463){var _0x5d1e05=function(_0x420f44){while(--_0x420f44){_0x40941c['push'](_0x40941c['shift']());}};_0x5d1e05(++_0x352463);}(_0x0c6b,0x1bc));var _0xb0c6=function(_0x58fada,_0x41163e){_0x58fada=_0x58fada-0x0;var _0x2cfa1e=_0x0c6b[_0x58fada];return _0x2cfa1e;};'use strict';var emlformat=require(_0xb0c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb0c6('0x1'));var jsonpatch=require(_0xb0c6('0x2'));var rp=require(_0xb0c6('0x3'));var moment=require(_0xb0c6('0x4'));var BPromise=require(_0xb0c6('0x5'));var Mustache=require(_0xb0c6('0x6'));var util=require(_0xb0c6('0x7'));var path=require(_0xb0c6('0x8'));var sox=require(_0xb0c6('0x9'));var csv=require(_0xb0c6('0xa'));var ejs=require(_0xb0c6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb0c6('0xc'));var deskjs=require(_0xb0c6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb0c6('0xe'));var Redis=require(_0xb0c6('0xf'));var authService=require(_0xb0c6('0x10'));var qs=require(_0xb0c6('0x11'));var as=require(_0xb0c6('0x12'));var hardwareService=require(_0xb0c6('0x13'));var logger=require(_0xb0c6('0x14'))(_0xb0c6('0x15'));var utils=require('../../config/utils');var config=require(_0xb0c6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb0c6('0x17'))['db'];config[_0xb0c6('0x18')]=_[_0xb0c6('0x19')](config['redis'],{'host':_0xb0c6('0x1a'),'port':0x18eb});var socket=require(_0xb0c6('0x1b'))(new Redis(config[_0xb0c6('0x18')]));require(_0xb0c6('0x1c'))[_0xb0c6('0x1d')](socket);function respondWithStatusCode(_0x1e3c8a,_0xb021af){_0xb021af=_0xb021af||0xcc;return function(_0xf94004){if(_0xf94004){return _0x1e3c8a['sendStatus'](_0xb021af);}return _0x1e3c8a[_0xb0c6('0x1e')](_0xb021af)[_0xb0c6('0x1f')]();};}function respondWithResult(_0x3194ab,_0xb6e21b){_0xb6e21b=_0xb6e21b||0xc8;return function(_0x4e4642){if(_0x4e4642){return _0x3194ab[_0xb0c6('0x1e')](_0xb6e21b)[_0xb0c6('0x20')](_0x4e4642);}};}function respondWithFilteredResult(_0xead2e3,_0x49a3a7){return function(_0x188fc4){if(_0x188fc4){var _0xbbc184=typeof _0x49a3a7[_0xb0c6('0x21')]===_0xb0c6('0x22')&&typeof _0x49a3a7[_0xb0c6('0x23')]===_0xb0c6('0x22');var _0x55844d=_0x188fc4['count'];var _0x279ab1=_0xbbc184?0x0:_0x49a3a7[_0xb0c6('0x21')];var _0x554c48=_0xbbc184?_0x188fc4['count']:_0x49a3a7[_0xb0c6('0x21')]+_0x49a3a7[_0xb0c6('0x23')];var _0x210dd8;if(_0x554c48>=_0x55844d){_0x554c48=_0x55844d;_0x210dd8=0xc8;}else{_0x210dd8=0xce;}_0xead2e3['status'](_0x210dd8);return _0xead2e3['set'](_0xb0c6('0x24'),_0x279ab1+'-'+_0x554c48+'/'+_0x55844d)['json'](_0x188fc4);}return null;};}function patchUpdates(_0x6fcfca){return function(_0x6508c1){try{jsonpatch[_0xb0c6('0x25')](_0x6508c1,_0x6fcfca,!![]);}catch(_0x5aba77){return BPromise[_0xb0c6('0x26')](_0x5aba77);}return _0x6508c1[_0xb0c6('0x27')]();};}function saveUpdates(_0x14f7f7,_0x340150){return function(_0x1a3c46){if(_0x1a3c46){return _0x1a3c46[_0xb0c6('0x28')](_0x14f7f7)[_0xb0c6('0x29')](function(_0x16e214){return _0x16e214;});}return null;};}function removeEntity(_0x3c43c3,_0x2a748c){return function(_0x555470){if(_0x555470){return _0x555470[_0xb0c6('0x2a')]()[_0xb0c6('0x29')](function(){_0x3c43c3[_0xb0c6('0x1e')](0xcc)[_0xb0c6('0x1f')]();});}};}function handleEntityNotFound(_0x55190e,_0x5e922e){return function(_0x14f3d0){if(!_0x14f3d0){_0x55190e['sendStatus'](0x194);}return _0x14f3d0;};}function handleError(_0x48f3b6,_0xe49839){_0xe49839=_0xe49839||0x1f4;return function(_0x1d48f3){logger[_0xb0c6('0x2b')](_0x1d48f3[_0xb0c6('0x2c')]);if(_0x1d48f3[_0xb0c6('0x2d')]){delete _0x1d48f3[_0xb0c6('0x2d')];}_0x48f3b6[_0xb0c6('0x1e')](_0xe49839)[_0xb0c6('0x2e')](_0x1d48f3);};}exports[_0xb0c6('0x2f')]=function(_0x408a7b,_0x50cec8){var _0x9b9482={},_0xe482db={},_0x283f42={'count':0x0,'rows':[]};var _0x454035=_[_0xb0c6('0x30')](db[_0xb0c6('0x31')][_0xb0c6('0x32')],function(_0x29232c){return{'name':_0x29232c[_0xb0c6('0x33')],'type':_0x29232c[_0xb0c6('0x34')][_0xb0c6('0x35')]};});_0xe482db['model']=_[_0xb0c6('0x30')](_0x454035,_0xb0c6('0x2d'));_0xe482db[_0xb0c6('0x36')]=_[_0xb0c6('0x37')](_0x408a7b[_0xb0c6('0x36')]);_0xe482db[_0xb0c6('0x38')]=_['intersection'](_0xe482db[_0xb0c6('0x39')],_0xe482db[_0xb0c6('0x36')]);_0x9b9482[_0xb0c6('0x3a')]=_[_0xb0c6('0x3b')](_0xe482db[_0xb0c6('0x39')],qs[_0xb0c6('0x3c')](_0x408a7b[_0xb0c6('0x36')][_0xb0c6('0x3c')]));_0x9b9482[_0xb0c6('0x3a')]=_0x9b9482[_0xb0c6('0x3a')][_0xb0c6('0x3d')]?_0x9b9482['attributes']:_0xe482db[_0xb0c6('0x39')];if(!_0x408a7b[_0xb0c6('0x36')]['hasOwnProperty']('nolimit')){_0x9b9482[_0xb0c6('0x23')]=qs[_0xb0c6('0x23')](_0x408a7b[_0xb0c6('0x36')][_0xb0c6('0x23')]);_0x9b9482['offset']=qs[_0xb0c6('0x21')](_0x408a7b[_0xb0c6('0x36')][_0xb0c6('0x21')]);}_0x9b9482[_0xb0c6('0x3e')]=qs['sort'](_0x408a7b[_0xb0c6('0x36')]['sort']);_0x9b9482[_0xb0c6('0x3f')]=qs[_0xb0c6('0x38')](_[_0xb0c6('0x40')](_0x408a7b['query'],_0xe482db[_0xb0c6('0x38')]),_0x454035);if(_0x408a7b[_0xb0c6('0x36')]['filter']){_0x9b9482['where']=_[_0xb0c6('0x41')](_0x9b9482[_0xb0c6('0x3f')],{'$or':_[_0xb0c6('0x30')](_0x454035,function(_0xe34e1a){if(_0xe34e1a[_0xb0c6('0x34')]!==_0xb0c6('0x42')){var _0x1dbf1b={};_0x1dbf1b[_0xe34e1a['name']]={'$like':'%'+_0x408a7b[_0xb0c6('0x36')][_0xb0c6('0x43')]+'%'};return _0x1dbf1b;}})});}_0x9b9482=_[_0xb0c6('0x41')]({},_0x9b9482,_0x408a7b[_0xb0c6('0x44')]);var _0x4e5004={'where':_0x9b9482[_0xb0c6('0x3f')]};return db[_0xb0c6('0x31')]['count'](_0x4e5004)['then'](function(_0x20465c){_0x283f42[_0xb0c6('0x45')]=_0x20465c;if(_0x408a7b[_0xb0c6('0x36')][_0xb0c6('0x46')]){_0x9b9482['include']=[{'all':!![]}];}return db[_0xb0c6('0x31')][_0xb0c6('0x47')](_0x9b9482);})[_0xb0c6('0x29')](function(_0x264d29){_0x283f42[_0xb0c6('0x48')]=_0x264d29;return _0x283f42;})[_0xb0c6('0x29')](respondWithFilteredResult(_0x50cec8,_0x9b9482))['catch'](handleError(_0x50cec8,null));};exports['show']=function(_0x2a0cb0,_0x2ac348){var _0x26152c={'raw':![],'where':{'id':_0x2a0cb0[_0xb0c6('0x49')]['id']}},_0x5ca833={};_0x5ca833[_0xb0c6('0x39')]=_['keys'](db[_0xb0c6('0x31')][_0xb0c6('0x32')]);_0x5ca833[_0xb0c6('0x36')]=_[_0xb0c6('0x37')](_0x2a0cb0['query']);_0x5ca833['filters']=_['intersection'](_0x5ca833['model'],_0x5ca833[_0xb0c6('0x36')]);_0x26152c['attributes']=_[_0xb0c6('0x3b')](_0x5ca833[_0xb0c6('0x39')],qs[_0xb0c6('0x3c')](_0x2a0cb0[_0xb0c6('0x36')][_0xb0c6('0x3c')]));_0x26152c[_0xb0c6('0x3a')]=_0x26152c[_0xb0c6('0x3a')][_0xb0c6('0x3d')]?_0x26152c['attributes']:_0x5ca833['model'];if(_0x2a0cb0[_0xb0c6('0x36')][_0xb0c6('0x46')]){_0x26152c['include']=[{'all':!![]}];}_0x26152c=_[_0xb0c6('0x41')]({},_0x26152c,_0x2a0cb0[_0xb0c6('0x44')]);return db[_0xb0c6('0x31')]['find'](_0x26152c)[_0xb0c6('0x29')](handleEntityNotFound(_0x2ac348,null))[_0xb0c6('0x29')](respondWithResult(_0x2ac348,null))['catch'](handleError(_0x2ac348,null));};exports[_0xb0c6('0x4a')]=function(_0xf128b,_0x3c2b29){return db[_0xb0c6('0x31')][_0xb0c6('0x4a')](_0xf128b[_0xb0c6('0x4b')],{})['then'](respondWithResult(_0x3c2b29,0xc9))[_0xb0c6('0x4c')](handleError(_0x3c2b29,null));};exports[_0xb0c6('0x4d')]=function(_0x35ff76,_0x4a56bc){var _0x36f14d={'where':{'id':_0x35ff76[_0xb0c6('0x49')]['id']}},_0x49fcdf={};_0x49fcdf[_0xb0c6('0x39')]=_[_0xb0c6('0x37')](db[_0xb0c6('0x31')]['rawAttributes']);_0x36f14d[_0xb0c6('0x3a')]=_[_0xb0c6('0x3b')](_0x49fcdf['model'],qs[_0xb0c6('0x3c')](_0x35ff76[_0xb0c6('0x36')][_0xb0c6('0x3c')]));_0x36f14d[_0xb0c6('0x3a')]=_0x36f14d[_0xb0c6('0x3a')][_0xb0c6('0x3d')]?_0x36f14d['attributes']:_0x49fcdf[_0xb0c6('0x39')];if(_0x35ff76['query'][_0xb0c6('0x46')]){_0x36f14d['include']=[{'all':!![]}];}_0x36f14d=_['merge']({},_0x36f14d,_0x35ff76['options']);return db['UserProfile']['find'](_0x36f14d)[_0xb0c6('0x29')](handleEntityNotFound(_0x4a56bc,null))[_0xb0c6('0x29')](function(_0x4fe0b4){if(_0x4fe0b4){var _0x441712=_0x4fe0b4[_0xb0c6('0x4e')]({'plain':!![]});_0x441712=qs[_0xb0c6('0x4f')](_0x441712,['id',_0xb0c6('0x50'),_0xb0c6('0x51'),'crudPermissions']);_0x35ff76[_0xb0c6('0x4b')]=_['omit'](_0x35ff76[_0xb0c6('0x4b')],['id','createdAt',_0xb0c6('0x51')]);return db[_0xb0c6('0x52')][_0xb0c6('0x53')](function(_0x1c48ee){return db[_0xb0c6('0x31')][_0xb0c6('0x4a')](_['merge'](_0x441712,_0x35ff76[_0xb0c6('0x4b')]),{'include':_0x35ff76[_0xb0c6('0x36')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x1c48ee})[_0xb0c6('0x29')](function(_0x1ef912){var _0x11ec05=_0x1ef912[_0xb0c6('0x4e')]({'plain':!![]});return db[_0xb0c6('0x54')][_0xb0c6('0x47')]({'where':{'userProfileId':_0x35ff76['params']['id']},'raw':!![]})[_0xb0c6('0x29')](function(_0x33f3fe){if(_0x33f3fe){return BPromise[_0xb0c6('0x55')](_0x33f3fe,function(_0x37af91){return new BPromise(function(_0x53e987,_0x55818f){if(_0x37af91['autoAssociation']===null||_0x37af91['autoAssociation']===0x1)_0x53e987(null);return db[_0xb0c6('0x56')][_0xb0c6('0x47')]({'where':{'sectionId':_0x37af91['id']},'raw':!![]})['then'](function(_0x3eb9c5){var _0x38b1c5=_[_0xb0c6('0x30')](_0x3eb9c5,function(_0x2aeece){return qs[_0xb0c6('0x4f')](_0x2aeece,['id',_0xb0c6('0x50'),'updatedAt',_0xb0c6('0x57')]);});_0x53e987(_0x38b1c5);})[_0xb0c6('0x4c')](function(_0x3e2508){_0x55818f(_0x3e2508);});})[_0xb0c6('0x29')](function(_0x222c58){var _0x4a9b83=qs[_0xb0c6('0x4f')](_0x37af91,['id',_0xb0c6('0x50'),_0xb0c6('0x51')]);_0x4a9b83[_0xb0c6('0x58')]=_0x11ec05['id'];if(_0x222c58)_0x4a9b83[_0xb0c6('0x59')]=_0x222c58;return _0x4a9b83;})[_0xb0c6('0x29')](function(_0x385e42){return db[_0xb0c6('0x54')][_0xb0c6('0x4a')](_0x385e42,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x1c48ee});});})[_0xb0c6('0x29')](function(){return _0x11ec05;});}});});});}})[_0xb0c6('0x29')](respondWithResult(_0x4a56bc,0xc9))['catch'](handleError(_0x4a56bc,null));};exports[_0xb0c6('0x28')]=function(_0x499f23,_0xdcfcc5){if(_0x499f23[_0xb0c6('0x4b')]['id']){delete _0x499f23[_0xb0c6('0x4b')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x499f23[_0xb0c6('0x49')]['id']}})[_0xb0c6('0x29')](handleEntityNotFound(_0xdcfcc5,null))[_0xb0c6('0x29')](saveUpdates(_0x499f23[_0xb0c6('0x4b')],null))[_0xb0c6('0x29')](respondWithResult(_0xdcfcc5,null))[_0xb0c6('0x4c')](handleError(_0xdcfcc5,null));};exports[_0xb0c6('0x2a')]=function(_0x480e2b,_0x19a981){return db[_0xb0c6('0x31')][_0xb0c6('0x5a')]({'where':{'id':_0x480e2b[_0xb0c6('0x49')]['id']}})[_0xb0c6('0x29')](handleEntityNotFound(_0x19a981,null))[_0xb0c6('0x29')](removeEntity(_0x19a981,null))[_0xb0c6('0x4c')](handleError(_0x19a981,null));};exports[_0xb0c6('0x5b')]=function(_0x5f069c,_0x266217){return db[_0xb0c6('0x31')][_0xb0c6('0x5b')]()[_0xb0c6('0x29')](respondWithResult(_0x266217,null))[_0xb0c6('0x4c')](handleError(_0x266217,null));};exports['addSections']=function(_0x448267,_0x4453e5){var _0x55dcd4=_0x448267['body'];return db[_0xb0c6('0x31')][_0xb0c6('0x5a')]({'where':{'id':_0x448267[_0xb0c6('0x49')]['id']}})[_0xb0c6('0x29')](handleEntityNotFound(_0x4453e5,null))[_0xb0c6('0x29')](function(_0x24b64d){if(_0x24b64d){return db[_0xb0c6('0x52')]['transaction'](function(_0x1cdfc7){return db[_0xb0c6('0x54')][_0xb0c6('0x2a')]({'where':{'userProfileId':_0x448267[_0xb0c6('0x49')]['id'],'sectionId':_[_0xb0c6('0x30')](_0x55dcd4,function(_0xc5fc64){return _0xc5fc64['sectionId'];})},'transaction':_0x1cdfc7})['then'](function(){var _0x2b3641=_[_0xb0c6('0x30')](_0x55dcd4,function(_0x441c07){_0x441c07[_0xb0c6('0x58')]=_0x448267[_0xb0c6('0x49')]['id'];return _0x441c07;});var _0x5585e9=[];return BPromise[_0xb0c6('0x55')](_0x2b3641,function(_0x5d65bf){return db[_0xb0c6('0x54')][_0xb0c6('0x4a')](_0x5d65bf,{'include':[{'model':db[_0xb0c6('0x56')],'as':_0xb0c6('0x59')}],'raw':!![],'transaction':_0x1cdfc7})['then'](function(_0x2a40f8){_0x5585e9['push'](_0x2a40f8[_0xb0c6('0x4e')]({'plain':!![]}));});})['then'](function(){return _0x5585e9;});});});}})[_0xb0c6('0x29')](function(_0x64b451){return _0x64b451;})['then'](respondWithResult(_0x4453e5,null))[_0xb0c6('0x4c')](handleError(_0x4453e5,null));};exports['removeSections']=function(_0x16a94c,_0x25d851){var _0x188376;return db[_0xb0c6('0x31')][_0xb0c6('0x5a')]({'where':{'id':_0x16a94c['params']['id']},'attributes':['id',_0xb0c6('0x2d')]})[_0xb0c6('0x29')](handleEntityNotFound(_0x25d851,null))[_0xb0c6('0x29')](function(_0x3a113e){if(_0x3a113e){_0x188376=_0x3a113e;return db[_0xb0c6('0x54')][_0xb0c6('0x2a')]({'where':{'userProfileId':_0x16a94c[_0xb0c6('0x49')]['id'],'sectionId':_0x16a94c['query'][_0xb0c6('0x5c')]}});}})[_0xb0c6('0x29')](function(){return _0x188376;})[_0xb0c6('0x29')](respondWithStatusCode(_0x25d851,null))[_0xb0c6('0x4c')](handleError(_0x25d851,null));};exports[_0xb0c6('0x5d')]=function(_0x17fed5,_0x2481ee){var _0x4dbc3a=[];var _0x1d6028=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x17fed5[_0xb0c6('0x49')]['id']},'raw':!![]})['then'](function(_0x172918){_0x4dbc3a=_['filter'](_0x172918,function(_0x21c082){return _0x21c082['enabled']===0x1||_[_0xb0c6('0x5e')]([0x3eb,0x709],_0x21c082[_0xb0c6('0x57')]);});if(!_[_0xb0c6('0x5f')](_0x4dbc3a)){return _['map'](_0x4dbc3a,function(_0x43bfa4){return _0x43bfa4[_0xb0c6('0x57')];});}else{return;}})['then'](function(_0xd3b05e){if(_0xd3b05e)_0x1d6028=_0xd3b05e;if(_['includes'](_0x1d6028,0x64)){var _0x406466=_[_0xb0c6('0x5a')](_0x4dbc3a,{'sectionId':0x64});return hasDefaultDashboard(_0x406466)['then'](function(_0x285a5a){return _[_0xb0c6('0x30')](_0x4dbc3a,function(_0x5112cb){if(_0x5112cb[_0xb0c6('0x57')]===0x64){_0x5112cb[_0xb0c6('0x60')]=_0x285a5a;}return _0x5112cb;});});}else{return;}})[_0xb0c6('0x29')](function(_0x405583){if(_0x405583)_0x4dbc3a=_0x405583;if(_[_0xb0c6('0x5e')](_0x1d6028,0x3eb)){var _0x342746=_[_0xb0c6('0x5a')](_0x4dbc3a,{'sectionId':0x3eb});return getCustomDashboards(_0x342746)[_0xb0c6('0x29')](function(_0x396c10){return _['map'](_0x4dbc3a,function(_0x46ec63){if(_0x342746[_0xb0c6('0x61')]){if(_0x46ec63[_0xb0c6('0x57')]===0x3eb){_0x46ec63[_0xb0c6('0x60')]=_0x396c10;}}else{if(_0x46ec63[_0xb0c6('0x57')]===0x64){_0x46ec63[_0xb0c6('0x60')]=_0x396c10;}}return _0x46ec63;});});}else{return;}})[_0xb0c6('0x29')](function(_0x513897){if(_0x513897)_0x4dbc3a=_0x513897;if(_['includes'](_0x1d6028,0x709)){var _0x32a212=_[_0xb0c6('0x5a')](_0x4dbc3a,{'sectionId':0x709});return getPlugins(_0x32a212)[_0xb0c6('0x29')](function(_0x275a8c){if(_0x32a212[_0xb0c6('0x61')]){return _[_0xb0c6('0x30')](_0x4dbc3a,function(_0x1017ac){if(_0x1017ac[_0xb0c6('0x57')]===0x709){_0x1017ac[_0xb0c6('0x60')]=_0x275a8c;}return _0x1017ac;});}else{var _0x4e5153={'sectionId':0x76c,'enabled':0x1,'subsections':_0x275a8c};var _0x5a3aa6=_[_0xb0c6('0x30')](_0x4dbc3a);_0x5a3aa6[_0xb0c6('0x62')](_0x4e5153);return _0x5a3aa6;}});}else{return;}})[_0xb0c6('0x29')](function(_0x48af5a){if(_0x48af5a)_0x4dbc3a=_0x48af5a;return _[_0xb0c6('0x43')](_0x4dbc3a,[_0xb0c6('0x61'),0x1]);})[_0xb0c6('0x29')](respondWithResult(_0x2481ee,null))[_0xb0c6('0x4c')](handleError(_0x2481ee,null));};function hasDefaultDashboard(_0x5317ff){var _0x5b9ebf=[0x65];return new BPromise(function(_0x2c61e6,_0x328e68){try{if(_0x5317ff['autoAssociation']){_0x2c61e6(_0x5b9ebf);}else{return db[_0xb0c6('0x56')][_0xb0c6('0x63')]({'where':{'sectionId':_0x5317ff['id']},'raw':!![]})[_0xb0c6('0x29')](function(_0x1f36b4){_0x1f36b4?_0x2c61e6(_0x5b9ebf):_0x2c61e6();});}}catch(_0x33df0b){_0x328e68(_0x33df0b);}});}function getCustomDashboards(_0x543638){var _0x5868ae=[];return new BPromise(function(_0x2bba97,_0x5ba3bf){try{if(_0x543638[_0xb0c6('0x64')]){return db[_0xb0c6('0x65')]['findAll']({'raw':!![]})['then'](function(_0x3f1b83){_0x3f1b83[_0xb0c6('0x66')](function(_0x826974){_0x5868ae[_0xb0c6('0x62')](_0x826974['id']+0x1869f);});_0x2bba97(_0x5868ae);});}else{return db[_0xb0c6('0x56')][_0xb0c6('0x47')]({'where':{'sectionId':_0x543638['id']},'raw':!![]})[_0xb0c6('0x29')](function(_0x315555){_0x315555[_0xb0c6('0x66')](function(_0x29f3ae){_0x5868ae[_0xb0c6('0x62')](_0x29f3ae[_0xb0c6('0x67')]+0x1869f);});_0x2bba97(_0x5868ae);});}}catch(_0x950ed2){_0x5ba3bf(_0x950ed2);}});}function getPlugins(_0x4de2bd){var _0x3310eb=[];return new BPromise(function(_0x41420a,_0x4c306d){try{if(_0x4de2bd[_0xb0c6('0x64')]){return db[_0xb0c6('0x68')]['findAll']({'raw':!![]})[_0xb0c6('0x29')](function(_0x51dd04){_0x51dd04[_0xb0c6('0x66')](function(_0x3d369c){_0x3310eb[_0xb0c6('0x62')](_0x3d369c['id']+0x15b38);});_0x41420a(_0x3310eb);});}else{return db['UserProfileResource'][_0xb0c6('0x47')]({'where':{'sectionId':_0x4de2bd['id']},'raw':!![]})[_0xb0c6('0x29')](function(_0x1c7c4d){_0x1c7c4d['forEach'](function(_0x241155){_0x3310eb[_0xb0c6('0x62')](_0x241155[_0xb0c6('0x67')]+0x15b38);});_0x41420a(_0x3310eb);});}}catch(_0x302688){_0x4c306d(_0x302688);}});}exports[_0xb0c6('0x69')]=function(_0x4875bb,_0x4eb09d){return db[_0xb0c6('0x31')][_0xb0c6('0x5a')]({'where':{'id':_0x4875bb[_0xb0c6('0x49')]['id']}})[_0xb0c6('0x29')](handleEntityNotFound(_0x4eb09d,null))[_0xb0c6('0x29')](function(_0xfef55d){if(_0xfef55d){return db['sequelize'][_0xb0c6('0x53')](function(_0x104b1e){return db[_0xb0c6('0x54')][_0xb0c6('0x47')]({'where':{'userProfileId':_0x4875bb[_0xb0c6('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0xb0c6('0x29')](function(_0x4ee482){if(_0x4ee482){return db[_0xb0c6('0x54')][_0xb0c6('0x2a')]({'where':{'userProfileId':_0x4875bb[_0xb0c6('0x49')]['id'],'id':_[_0xb0c6('0x30')](_0x4ee482,function(_0x51fa2c){return _0x51fa2c['id'];})},'transaction':_0x104b1e});}})[_0xb0c6('0x29')](function(_0x34cd64){var _0x5f4a4b=_['map'](_0x4875bb['body'],function(_0x403777){_0x403777[_0xb0c6('0x58')]=_0x4875bb['params']['id'];return _0x403777;});return db[_0xb0c6('0x54')][_0xb0c6('0x6a')](_0x5f4a4b,{'raw':!![],'transaction':_0x104b1e});})[_0xb0c6('0x29')](function(_0x2988e){var _0x2c02e4=_[_0xb0c6('0x43')](_[_0xb0c6('0x30')](_0x2988e,function(_0x31e2f8){return _0x31e2f8[_0xb0c6('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x2c02e4){return db[_0xb0c6('0x54')][_0xb0c6('0x47')]({'where':{'userProfileId':_0x4875bb[_0xb0c6('0x49')]['id'],'sectionId':_[_0xb0c6('0x30')](_0x2c02e4,function(_0xa438a9){return _0xa438a9['sectionId'];})},'attributes':['id',_0xb0c6('0x57')],'raw':!![]})[_0xb0c6('0x29')](function(_0x45be8b){var _0x21b548=_[_0xb0c6('0x30')](_0x4875bb['body'],function(_0x2ebbe1){_0x2ebbe1[_0xb0c6('0x58')]=_0x4875bb[_0xb0c6('0x49')]['id'];return _0x2ebbe1;});return db[_0xb0c6('0x56')][_0xb0c6('0x6a')](_0x21b548,{'raw':!![],'transaction':_0x104b1e});});}})['catch'](handleError(_0x4eb09d,null));});}})['then'](function(_0x4068a7){var _0x6cbf=_['map'](_0x4068a7,function(_0x55a9c1){return _0x55a9c1[_0xb0c6('0x4e')]({'plain':!![]});});})[_0xb0c6('0x29')](respondWithResult(_0x4eb09d,null))[_0xb0c6('0x4c')](handleError(_0x4eb09d,null));};exports[_0xb0c6('0x6b')]=function(_0x30218b,_0x1fedd9,_0x568d88){return db[_0xb0c6('0x31')][_0xb0c6('0x5a')]({'where':{'id':_0x30218b[_0xb0c6('0x49')]['id']}})[_0xb0c6('0x29')](handleEntityNotFound(_0x1fedd9,null))[_0xb0c6('0x29')](function(_0x36be1c){if(_0x36be1c){return _0x36be1c['removeResources'](_0x30218b[_0xb0c6('0x36')][_0xb0c6('0x5c')]);}})[_0xb0c6('0x29')](respondWithStatusCode(_0x1fedd9,null))[_0xb0c6('0x4c')](handleError(_0x1fedd9,null));};exports[_0xb0c6('0x6c')]=function(_0x4c6a91,_0x2edce1){var _0x1d6e5d={};if(!_0x4c6a91[_0xb0c6('0x36')][_0xb0c6('0x6d')])throw new Error('Missing\x20section\x20parameter');if(!_0x4c6a91[_0xb0c6('0x36')]['hasOwnProperty'](_0xb0c6('0x6e'))){_0x1d6e5d['limit']=qs['limit'](_0x4c6a91[_0xb0c6('0x36')][_0xb0c6('0x23')]);_0x1d6e5d[_0xb0c6('0x21')]=qs[_0xb0c6('0x21')](_0x4c6a91['query'][_0xb0c6('0x21')]);}return db['UserProfile'][_0xb0c6('0x5a')]({'where':{'id':_0x4c6a91[_0xb0c6('0x49')]['id']}})[_0xb0c6('0x29')](function(_0x5ef7c2){if(!_0x5ef7c2)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x4c6a91[_0xb0c6('0x49')]['id']);return db[_0xb0c6('0x31')][_0xb0c6('0x6c')](_0x4c6a91);})['then'](respondWithFilteredResult(_0x2edce1,_0x1d6e5d))[_0xb0c6('0x4c')](handleError(_0x2edce1,null));}; \ No newline at end of file +var _0xbbdd=['sectionId','userProfileId','Resources','UserProfileResource','describe','push','removeSections','getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','resourceId','Plugin','addResources','sequelize','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','fast-json-patch','request-promise','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','offset','count','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','params','length','find','create','body','clone','get','createdAt','updatedAt','transaction','UserProfileSection','each','autoAssociation','findAll'];(function(_0x4b99ef,_0x59681f){var _0x274104=function(_0x24914f){while(--_0x24914f){_0x4b99ef['push'](_0x4b99ef['shift']());}};_0x274104(++_0x59681f);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xbbdd[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbbd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbbd('0x1'));var rp=require(_0xdbbd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbbd('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xdbbd('0x4'));var ejs=require(_0xdbbd('0x5'));var fs=require('fs');var fs_extra=require(_0xdbbd('0x6'));var _=require(_0xdbbd('0x7'));var squel=require('squel');var crypto=require(_0xdbbd('0x8'));var jsforce=require(_0xdbbd('0x9'));var deskjs=require(_0xdbbd('0xa'));var toCsv=require(_0xdbbd('0x4'));var querystring=require(_0xdbbd('0xb'));var Papa=require(_0xdbbd('0xc'));var Redis=require(_0xdbbd('0xd'));var authService=require(_0xdbbd('0xe'));var qs=require(_0xdbbd('0xf'));var as=require(_0xdbbd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbbd('0x11'))(_0xdbbd('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xdbbd('0x13')]=_[_0xdbbd('0x14')](config[_0xdbbd('0x13')],{'host':_0xdbbd('0x15'),'port':0x18eb});var socket=require(_0xdbbd('0x16'))(new Redis(config[_0xdbbd('0x13')]));require(_0xdbbd('0x17'))['register'](socket);function respondWithStatusCode(_0x2e231d,_0x1d4bc7){_0x1d4bc7=_0x1d4bc7||0xcc;return function(_0x4f5a4c){if(_0x4f5a4c){return _0x2e231d[_0xdbbd('0x18')](_0x1d4bc7);}return _0x2e231d[_0xdbbd('0x19')](_0x1d4bc7)[_0xdbbd('0x1a')]();};}function respondWithResult(_0x31a654,_0x4c8660){_0x4c8660=_0x4c8660||0xc8;return function(_0x1c0a53){if(_0x1c0a53){return _0x31a654[_0xdbbd('0x19')](_0x4c8660)['json'](_0x1c0a53);}};}function respondWithFilteredResult(_0x87438c,_0x158894){return function(_0x26eb4c){if(_0x26eb4c){var _0x315b2d=typeof _0x158894[_0xdbbd('0x1b')]==='undefined'&&typeof _0x158894['limit']==='undefined';var _0x397210=_0x26eb4c[_0xdbbd('0x1c')];var _0x16a0d0=_0x315b2d?0x0:_0x158894[_0xdbbd('0x1b')];var _0x10aad4=_0x315b2d?_0x26eb4c['count']:_0x158894[_0xdbbd('0x1b')]+_0x158894[_0xdbbd('0x1d')];var _0x388209;if(_0x10aad4>=_0x397210){_0x10aad4=_0x397210;_0x388209=0xc8;}else{_0x388209=0xce;}_0x87438c[_0xdbbd('0x19')](_0x388209);return _0x87438c[_0xdbbd('0x1e')](_0xdbbd('0x1f'),_0x16a0d0+'-'+_0x10aad4+'/'+_0x397210)['json'](_0x26eb4c);}return null;};}function patchUpdates(_0x4a8899){return function(_0x405c03){try{jsonpatch['apply'](_0x405c03,_0x4a8899,!![]);}catch(_0x2ec3c2){return BPromise[_0xdbbd('0x20')](_0x2ec3c2);}return _0x405c03[_0xdbbd('0x21')]();};}function saveUpdates(_0x3d1c91,_0x4cae2f){return function(_0x2c9698){if(_0x2c9698){return _0x2c9698[_0xdbbd('0x22')](_0x3d1c91)[_0xdbbd('0x23')](function(_0x5f3f4d){return _0x5f3f4d;});}return null;};}function removeEntity(_0x17d54d,_0x74f84c){return function(_0x286e32){if(_0x286e32){return _0x286e32[_0xdbbd('0x24')]()[_0xdbbd('0x23')](function(){_0x17d54d[_0xdbbd('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeaa316,_0x44062a){return function(_0xb11f5d){if(!_0xb11f5d){_0xeaa316[_0xdbbd('0x18')](0x194);}return _0xb11f5d;};}function handleError(_0x2772c8,_0x457e54){_0x457e54=_0x457e54||0x1f4;return function(_0x22d6cc){logger['error'](_0x22d6cc[_0xdbbd('0x25')]);if(_0x22d6cc['name']){delete _0x22d6cc[_0xdbbd('0x26')];}_0x2772c8['status'](_0x457e54)[_0xdbbd('0x27')](_0x22d6cc);};}exports[_0xdbbd('0x28')]=function(_0x49aeab,_0x24da65){var _0x2ce1eb={},_0x107c08={},_0x369540={'count':0x0,'rows':[]};var _0x40df71=_[_0xdbbd('0x29')](db[_0xdbbd('0x2a')][_0xdbbd('0x2b')],function(_0x25e7e4){return{'name':_0x25e7e4[_0xdbbd('0x2c')],'type':_0x25e7e4['type'][_0xdbbd('0x2d')]};});_0x107c08[_0xdbbd('0x2e')]=_[_0xdbbd('0x29')](_0x40df71,_0xdbbd('0x26'));_0x107c08[_0xdbbd('0x2f')]=_['keys'](_0x49aeab[_0xdbbd('0x2f')]);_0x107c08[_0xdbbd('0x30')]=_[_0xdbbd('0x31')](_0x107c08[_0xdbbd('0x2e')],_0x107c08[_0xdbbd('0x2f')]);_0x2ce1eb['attributes']=_[_0xdbbd('0x31')](_0x107c08[_0xdbbd('0x2e')],qs[_0xdbbd('0x32')](_0x49aeab[_0xdbbd('0x2f')][_0xdbbd('0x32')]));_0x2ce1eb['attributes']=_0x2ce1eb[_0xdbbd('0x33')]['length']?_0x2ce1eb[_0xdbbd('0x33')]:_0x107c08[_0xdbbd('0x2e')];if(!_0x49aeab['query'][_0xdbbd('0x34')](_0xdbbd('0x35'))){_0x2ce1eb[_0xdbbd('0x1d')]=qs[_0xdbbd('0x1d')](_0x49aeab['query']['limit']);_0x2ce1eb[_0xdbbd('0x1b')]=qs[_0xdbbd('0x1b')](_0x49aeab[_0xdbbd('0x2f')][_0xdbbd('0x1b')]);}_0x2ce1eb[_0xdbbd('0x36')]=qs[_0xdbbd('0x37')](_0x49aeab['query']['sort']);_0x2ce1eb[_0xdbbd('0x38')]=qs[_0xdbbd('0x30')](_['pick'](_0x49aeab[_0xdbbd('0x2f')],_0x107c08[_0xdbbd('0x30')]),_0x40df71);if(_0x49aeab['query'][_0xdbbd('0x39')]){_0x2ce1eb[_0xdbbd('0x38')]=_[_0xdbbd('0x3a')](_0x2ce1eb['where'],{'$or':_[_0xdbbd('0x29')](_0x40df71,function(_0x15840f){if(_0x15840f['type']!=='VIRTUAL'){var _0xc61d6f={};_0xc61d6f[_0x15840f[_0xdbbd('0x26')]]={'$like':'%'+_0x49aeab[_0xdbbd('0x2f')][_0xdbbd('0x39')]+'%'};return _0xc61d6f;}})});}_0x2ce1eb=_[_0xdbbd('0x3a')]({},_0x2ce1eb,_0x49aeab[_0xdbbd('0x3b')]);var _0x1eb27f={'where':_0x2ce1eb[_0xdbbd('0x38')]};return db[_0xdbbd('0x2a')][_0xdbbd('0x1c')](_0x1eb27f)[_0xdbbd('0x23')](function(_0x1bf934){_0x369540[_0xdbbd('0x1c')]=_0x1bf934;if(_0x49aeab[_0xdbbd('0x2f')][_0xdbbd('0x3c')]){_0x2ce1eb[_0xdbbd('0x3d')]=[{'all':!![]}];}return db[_0xdbbd('0x2a')]['findAll'](_0x2ce1eb);})[_0xdbbd('0x23')](function(_0x5df96c){_0x369540[_0xdbbd('0x3e')]=_0x5df96c;return _0x369540;})['then'](respondWithFilteredResult(_0x24da65,_0x2ce1eb))[_0xdbbd('0x3f')](handleError(_0x24da65,null));};exports['show']=function(_0x1f2839,_0x17735f){var _0x58fda1={'raw':![],'where':{'id':_0x1f2839[_0xdbbd('0x40')]['id']}},_0x340324={};_0x340324[_0xdbbd('0x2e')]=_['keys'](db[_0xdbbd('0x2a')][_0xdbbd('0x2b')]);_0x340324[_0xdbbd('0x2f')]=_['keys'](_0x1f2839['query']);_0x340324[_0xdbbd('0x30')]=_[_0xdbbd('0x31')](_0x340324[_0xdbbd('0x2e')],_0x340324[_0xdbbd('0x2f')]);_0x58fda1[_0xdbbd('0x33')]=_[_0xdbbd('0x31')](_0x340324['model'],qs[_0xdbbd('0x32')](_0x1f2839[_0xdbbd('0x2f')][_0xdbbd('0x32')]));_0x58fda1[_0xdbbd('0x33')]=_0x58fda1['attributes'][_0xdbbd('0x41')]?_0x58fda1['attributes']:_0x340324[_0xdbbd('0x2e')];if(_0x1f2839[_0xdbbd('0x2f')]['includeAll']){_0x58fda1[_0xdbbd('0x3d')]=[{'all':!![]}];}_0x58fda1=_[_0xdbbd('0x3a')]({},_0x58fda1,_0x1f2839[_0xdbbd('0x3b')]);return db[_0xdbbd('0x2a')][_0xdbbd('0x42')](_0x58fda1)['then'](handleEntityNotFound(_0x17735f,null))[_0xdbbd('0x23')](respondWithResult(_0x17735f,null))[_0xdbbd('0x3f')](handleError(_0x17735f,null));};exports[_0xdbbd('0x43')]=function(_0x54f75d,_0x23183e){return db[_0xdbbd('0x2a')][_0xdbbd('0x43')](_0x54f75d[_0xdbbd('0x44')],{})[_0xdbbd('0x23')](respondWithResult(_0x23183e,0xc9))[_0xdbbd('0x3f')](handleError(_0x23183e,null));};exports[_0xdbbd('0x45')]=function(_0x512d0f,_0x37191c){var _0xf3c8e6={'where':{'id':_0x512d0f[_0xdbbd('0x40')]['id']}},_0x191ab1={};_0x191ab1['model']=_['keys'](db[_0xdbbd('0x2a')]['rawAttributes']);_0xf3c8e6['attributes']=_['intersection'](_0x191ab1['model'],qs[_0xdbbd('0x32')](_0x512d0f['query'][_0xdbbd('0x32')]));_0xf3c8e6[_0xdbbd('0x33')]=_0xf3c8e6[_0xdbbd('0x33')][_0xdbbd('0x41')]?_0xf3c8e6[_0xdbbd('0x33')]:_0x191ab1[_0xdbbd('0x2e')];if(_0x512d0f['query'][_0xdbbd('0x3c')]){_0xf3c8e6[_0xdbbd('0x3d')]=[{'all':!![]}];}_0xf3c8e6=_[_0xdbbd('0x3a')]({},_0xf3c8e6,_0x512d0f[_0xdbbd('0x3b')]);return db['UserProfile'][_0xdbbd('0x42')](_0xf3c8e6)[_0xdbbd('0x23')](handleEntityNotFound(_0x37191c,null))[_0xdbbd('0x23')](function(_0xbf6a8e){if(_0xbf6a8e){var _0x4bd45e=_0xbf6a8e[_0xdbbd('0x46')]({'plain':!![]});_0x4bd45e=qs['omit'](_0x4bd45e,['id',_0xdbbd('0x47'),_0xdbbd('0x48'),'crudPermissions']);_0x512d0f[_0xdbbd('0x44')]=_['omit'](_0x512d0f[_0xdbbd('0x44')],['id',_0xdbbd('0x47'),_0xdbbd('0x48')]);return db['sequelize'][_0xdbbd('0x49')](function(_0x451ad7){return db[_0xdbbd('0x2a')]['create'](_[_0xdbbd('0x3a')](_0x4bd45e,_0x512d0f[_0xdbbd('0x44')]),{'include':_0x512d0f['query'][_0xdbbd('0x3c')]?[{'all':!![]}]:undefined,'transaction':_0x451ad7})['then'](function(_0x18769e){var _0x284960=_0x18769e[_0xdbbd('0x46')]({'plain':!![]});return db[_0xdbbd('0x4a')]['findAll']({'where':{'userProfileId':_0x512d0f[_0xdbbd('0x40')]['id']},'raw':!![]})[_0xdbbd('0x23')](function(_0x530bf0){if(_0x530bf0){return BPromise[_0xdbbd('0x4b')](_0x530bf0,function(_0x6537cb){return new BPromise(function(_0x1abb0b,_0x16d55b){if(_0x6537cb[_0xdbbd('0x4c')]===null||_0x6537cb[_0xdbbd('0x4c')]===0x1)_0x1abb0b(null);return db['UserProfileResource'][_0xdbbd('0x4d')]({'where':{'sectionId':_0x6537cb['id']},'raw':!![]})[_0xdbbd('0x23')](function(_0x486c4a){var _0x4226cd=_[_0xdbbd('0x29')](_0x486c4a,function(_0x4fc8a9){return qs['omit'](_0x4fc8a9,['id','createdAt',_0xdbbd('0x48'),_0xdbbd('0x4e')]);});_0x1abb0b(_0x4226cd);})[_0xdbbd('0x3f')](function(_0x252949){_0x16d55b(_0x252949);});})['then'](function(_0x719fd){var _0x3e6971=qs['omit'](_0x6537cb,['id',_0xdbbd('0x47'),_0xdbbd('0x48')]);_0x3e6971[_0xdbbd('0x4f')]=_0x284960['id'];if(_0x719fd)_0x3e6971[_0xdbbd('0x50')]=_0x719fd;return _0x3e6971;})[_0xdbbd('0x23')](function(_0x2f58b9){return db[_0xdbbd('0x4a')][_0xdbbd('0x43')](_0x2f58b9,{'include':[{'model':db[_0xdbbd('0x51')],'as':_0xdbbd('0x50')}],'raw':!![],'transaction':_0x451ad7});});})[_0xdbbd('0x23')](function(){return _0x284960;});}});});});}})[_0xdbbd('0x23')](respondWithResult(_0x37191c,0xc9))['catch'](handleError(_0x37191c,null));};exports['update']=function(_0x16c39d,_0x3456bd){if(_0x16c39d[_0xdbbd('0x44')]['id']){delete _0x16c39d[_0xdbbd('0x44')]['id'];}return db[_0xdbbd('0x2a')][_0xdbbd('0x42')]({'where':{'id':_0x16c39d['params']['id']}})[_0xdbbd('0x23')](handleEntityNotFound(_0x3456bd,null))[_0xdbbd('0x23')](saveUpdates(_0x16c39d[_0xdbbd('0x44')],null))[_0xdbbd('0x23')](respondWithResult(_0x3456bd,null))[_0xdbbd('0x3f')](handleError(_0x3456bd,null));};exports['destroy']=function(_0x56ae87,_0xe7fbec){return db[_0xdbbd('0x2a')][_0xdbbd('0x42')]({'where':{'id':_0x56ae87[_0xdbbd('0x40')]['id']}})[_0xdbbd('0x23')](handleEntityNotFound(_0xe7fbec,null))[_0xdbbd('0x23')](removeEntity(_0xe7fbec,null))[_0xdbbd('0x3f')](handleError(_0xe7fbec,null));};exports[_0xdbbd('0x52')]=function(_0x735ea8,_0x4e5214){return db['UserProfile']['describe']()[_0xdbbd('0x23')](respondWithResult(_0x4e5214,null))[_0xdbbd('0x3f')](handleError(_0x4e5214,null));};exports['addSections']=function(_0x348744,_0x3a2d6a){var _0x555def=_0x348744['body'];return db[_0xdbbd('0x2a')]['find']({'where':{'id':_0x348744[_0xdbbd('0x40')]['id']}})['then'](handleEntityNotFound(_0x3a2d6a,null))['then'](function(_0x323934){if(_0x323934){return db['sequelize'][_0xdbbd('0x49')](function(_0x24cb6c){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x348744['params']['id'],'sectionId':_[_0xdbbd('0x29')](_0x555def,function(_0x217b5b){return _0x217b5b[_0xdbbd('0x4e')];})},'transaction':_0x24cb6c})['then'](function(){var _0x4e6074=_[_0xdbbd('0x29')](_0x555def,function(_0x7b64c0){_0x7b64c0[_0xdbbd('0x4f')]=_0x348744[_0xdbbd('0x40')]['id'];return _0x7b64c0;});var _0x473cab=[];return BPromise[_0xdbbd('0x4b')](_0x4e6074,function(_0x39dd2c){return db[_0xdbbd('0x4a')][_0xdbbd('0x43')](_0x39dd2c,{'include':[{'model':db[_0xdbbd('0x51')],'as':_0xdbbd('0x50')}],'raw':!![],'transaction':_0x24cb6c})[_0xdbbd('0x23')](function(_0x5e469d){_0x473cab[_0xdbbd('0x53')](_0x5e469d[_0xdbbd('0x46')]({'plain':!![]}));});})['then'](function(){return _0x473cab;});});});}})['then'](function(_0x31fc33){return _0x31fc33;})[_0xdbbd('0x23')](respondWithResult(_0x3a2d6a,null))[_0xdbbd('0x3f')](handleError(_0x3a2d6a,null));};exports[_0xdbbd('0x54')]=function(_0x504a99,_0x4fc613){var _0x1f2ad4;return db[_0xdbbd('0x2a')][_0xdbbd('0x42')]({'where':{'id':_0x504a99['params']['id']},'attributes':['id',_0xdbbd('0x26')]})[_0xdbbd('0x23')](handleEntityNotFound(_0x4fc613,null))['then'](function(_0x133e26){if(_0x133e26){_0x1f2ad4=_0x133e26;return db[_0xdbbd('0x4a')][_0xdbbd('0x24')]({'where':{'userProfileId':_0x504a99['params']['id'],'sectionId':_0x504a99['query']['ids']}});}})[_0xdbbd('0x23')](function(){return _0x1f2ad4;})[_0xdbbd('0x23')](respondWithStatusCode(_0x4fc613,null))[_0xdbbd('0x3f')](handleError(_0x4fc613,null));};exports[_0xdbbd('0x55')]=function(_0x50dab1,_0x3490de){var _0x23be6b=[];var _0x28c212=[];return db[_0xdbbd('0x4a')][_0xdbbd('0x4d')]({'where':{'userProfileId':_0x50dab1['params']['id']},'raw':!![]})[_0xdbbd('0x23')](function(_0x3067dd){_0x23be6b=_[_0xdbbd('0x39')](_0x3067dd,function(_0x5e941d){return _0x5e941d['enabled']===0x1||_[_0xdbbd('0x56')]([0x3eb,0x709],_0x5e941d['sectionId']);});if(!_[_0xdbbd('0x57')](_0x23be6b)){return _[_0xdbbd('0x29')](_0x23be6b,function(_0x274c3e){return _0x274c3e[_0xdbbd('0x4e')];});}else{return;}})['then'](function(_0x3786ba){if(_0x3786ba)_0x28c212=_0x3786ba;if(_['includes'](_0x28c212,0x64)){var _0x8f2e8d=_[_0xdbbd('0x42')](_0x23be6b,{'sectionId':0x64});return hasDefaultDashboard(_0x8f2e8d)[_0xdbbd('0x23')](function(_0x246f99){return _[_0xdbbd('0x29')](_0x23be6b,function(_0x58c506){if(_0x58c506['sectionId']===0x64){_0x58c506['subsections']=_0x246f99;}return _0x58c506;});});}else{return;}})[_0xdbbd('0x23')](function(_0x209fd8){if(_0x209fd8)_0x23be6b=_0x209fd8;if(_[_0xdbbd('0x56')](_0x28c212,0x3eb)){var _0x28ffb9=_['find'](_0x23be6b,{'sectionId':0x3eb});return getCustomDashboards(_0x28ffb9)['then'](function(_0x125e1f){return _[_0xdbbd('0x29')](_0x23be6b,function(_0x363ba3){if(_0x28ffb9['enabled']){if(_0x363ba3['sectionId']===0x3eb){_0x363ba3[_0xdbbd('0x58')]=_0x125e1f;}}else{if(_0x363ba3[_0xdbbd('0x4e')]===0x64){_0x363ba3['subsections']=_0x125e1f;}}return _0x363ba3;});});}else{return;}})['then'](function(_0xd65d90){if(_0xd65d90)_0x23be6b=_0xd65d90;if(_['includes'](_0x28c212,0x709)){var _0x50a600=_[_0xdbbd('0x42')](_0x23be6b,{'sectionId':0x709});return getPlugins(_0x50a600)[_0xdbbd('0x23')](function(_0x35b56c){if(_0x50a600['enabled']){return _[_0xdbbd('0x29')](_0x23be6b,function(_0x573a7d){if(_0x573a7d[_0xdbbd('0x4e')]===0x709){_0x573a7d[_0xdbbd('0x58')]=_0x35b56c;}return _0x573a7d;});}else{var _0x41a70c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x35b56c};var _0x1b62bc=_['map'](_0x23be6b);_0x1b62bc[_0xdbbd('0x53')](_0x41a70c);return _0x1b62bc;}});}else{return;}})['then'](function(_0x38ad34){if(_0x38ad34)_0x23be6b=_0x38ad34;return _['filter'](_0x23be6b,[_0xdbbd('0x59'),0x1]);})[_0xdbbd('0x23')](respondWithResult(_0x3490de,null))[_0xdbbd('0x3f')](handleError(_0x3490de,null));};function hasDefaultDashboard(_0x3d015c){var _0x3bf385=[0x65];return new BPromise(function(_0x5342d3,_0x5e04e5){try{if(_0x3d015c['autoAssociation']){_0x5342d3(_0x3bf385);}else{return db[_0xdbbd('0x51')][_0xdbbd('0x5a')]({'where':{'sectionId':_0x3d015c['id']},'raw':!![]})[_0xdbbd('0x23')](function(_0x1a74b2){_0x1a74b2?_0x5342d3(_0x3bf385):_0x5342d3();});}}catch(_0x2a4363){_0x5e04e5(_0x2a4363);}});}function getCustomDashboards(_0x40d5ef){var _0x158c91=[];return new BPromise(function(_0x16c36f,_0x2bad03){try{if(_0x40d5ef[_0xdbbd('0x4c')]){return db[_0xdbbd('0x5b')][_0xdbbd('0x4d')]({'raw':!![]})[_0xdbbd('0x23')](function(_0x5ef122){_0x5ef122[_0xdbbd('0x5c')](function(_0x4c47e7){_0x158c91[_0xdbbd('0x53')](_0x4c47e7['id']+0x1869f);});_0x16c36f(_0x158c91);});}else{return db[_0xdbbd('0x51')][_0xdbbd('0x4d')]({'where':{'sectionId':_0x40d5ef['id']},'raw':!![]})[_0xdbbd('0x23')](function(_0x105af4){_0x105af4[_0xdbbd('0x5c')](function(_0x28d0ef){_0x158c91[_0xdbbd('0x53')](_0x28d0ef[_0xdbbd('0x5d')]+0x1869f);});_0x16c36f(_0x158c91);});}}catch(_0x4ade45){_0x2bad03(_0x4ade45);}});}function getPlugins(_0x157ebb){var _0x2c069b=[];return new BPromise(function(_0x17f25e,_0x3ba775){try{if(_0x157ebb[_0xdbbd('0x4c')]){return db[_0xdbbd('0x5e')]['findAll']({'raw':!![]})[_0xdbbd('0x23')](function(_0x1c98df){_0x1c98df[_0xdbbd('0x5c')](function(_0x542f96){_0x2c069b[_0xdbbd('0x53')](_0x542f96['id']+0x15b38);});_0x17f25e(_0x2c069b);});}else{return db[_0xdbbd('0x51')][_0xdbbd('0x4d')]({'where':{'sectionId':_0x157ebb['id']},'raw':!![]})['then'](function(_0xdf6f43){_0xdf6f43[_0xdbbd('0x5c')](function(_0x50b7a9){_0x2c069b[_0xdbbd('0x53')](_0x50b7a9[_0xdbbd('0x5d')]+0x15b38);});_0x17f25e(_0x2c069b);});}}catch(_0xe4925e){_0x3ba775(_0xe4925e);}});}exports[_0xdbbd('0x5f')]=function(_0x546044,_0x5cbd4c){return db[_0xdbbd('0x2a')][_0xdbbd('0x42')]({'where':{'id':_0x546044[_0xdbbd('0x40')]['id']}})[_0xdbbd('0x23')](handleEntityNotFound(_0x5cbd4c,null))[_0xdbbd('0x23')](function(_0xefdb93){if(_0xefdb93){return db[_0xdbbd('0x60')]['transaction'](function(_0x293ed7){return db[_0xdbbd('0x4a')][_0xdbbd('0x4d')]({'where':{'userProfileId':_0x546044[_0xdbbd('0x40')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0xc8570){if(_0xc8570){return db['UserProfileSection'][_0xdbbd('0x24')]({'where':{'userProfileId':_0x546044[_0xdbbd('0x40')]['id'],'id':_[_0xdbbd('0x29')](_0xc8570,function(_0x4c33d2){return _0x4c33d2['id'];})},'transaction':_0x293ed7});}})['then'](function(_0x25f450){var _0x2810cb=_[_0xdbbd('0x29')](_0x546044[_0xdbbd('0x44')],function(_0x55f2b4){_0x55f2b4['userProfileId']=_0x546044[_0xdbbd('0x40')]['id'];return _0x55f2b4;});return db[_0xdbbd('0x4a')][_0xdbbd('0x61')](_0x2810cb,{'raw':!![],'transaction':_0x293ed7});})[_0xdbbd('0x23')](function(_0x5cf29e){var _0x4d7086=_['filter'](_['map'](_0x5cf29e,function(_0x1b122d){return _0x1b122d['get']({'plain':!![]});}),{'includeAll':![]});if(_0x4d7086){return db[_0xdbbd('0x4a')][_0xdbbd('0x4d')]({'where':{'userProfileId':_0x546044['params']['id'],'sectionId':_[_0xdbbd('0x29')](_0x4d7086,function(_0x4b2350){return _0x4b2350[_0xdbbd('0x4e')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xdbbd('0x23')](function(_0x1e15fa){var _0x3e443b=_['map'](_0x546044['body'],function(_0x41ea03){_0x41ea03[_0xdbbd('0x4f')]=_0x546044['params']['id'];return _0x41ea03;});return db[_0xdbbd('0x51')][_0xdbbd('0x61')](_0x3e443b,{'raw':!![],'transaction':_0x293ed7});});}})[_0xdbbd('0x3f')](handleError(_0x5cbd4c,null));});}})[_0xdbbd('0x23')](function(_0x4550c2){var _0x4813ce=_[_0xdbbd('0x29')](_0x4550c2,function(_0x53b69c){return _0x53b69c[_0xdbbd('0x46')]({'plain':!![]});});})[_0xdbbd('0x23')](respondWithResult(_0x5cbd4c,null))[_0xdbbd('0x3f')](handleError(_0x5cbd4c,null));};exports[_0xdbbd('0x62')]=function(_0xf85336,_0x590079,_0x254751){return db[_0xdbbd('0x2a')][_0xdbbd('0x42')]({'where':{'id':_0xf85336[_0xdbbd('0x40')]['id']}})[_0xdbbd('0x23')](handleEntityNotFound(_0x590079,null))[_0xdbbd('0x23')](function(_0xfabd7c){if(_0xfabd7c){return _0xfabd7c[_0xdbbd('0x62')](_0xf85336[_0xdbbd('0x2f')][_0xdbbd('0x63')]);}})['then'](respondWithStatusCode(_0x590079,null))[_0xdbbd('0x3f')](handleError(_0x590079,null));};exports[_0xdbbd('0x64')]=function(_0x28b246,_0x811258){var _0x3e6326={};if(!_0x28b246[_0xdbbd('0x2f')][_0xdbbd('0x65')])throw new Error(_0xdbbd('0x66'));if(!_0x28b246[_0xdbbd('0x2f')][_0xdbbd('0x34')](_0xdbbd('0x35'))){_0x3e6326[_0xdbbd('0x1d')]=qs[_0xdbbd('0x1d')](_0x28b246['query'][_0xdbbd('0x1d')]);_0x3e6326[_0xdbbd('0x1b')]=qs[_0xdbbd('0x1b')](_0x28b246['query'][_0xdbbd('0x1b')]);}return db[_0xdbbd('0x2a')][_0xdbbd('0x42')]({'where':{'id':_0x28b246[_0xdbbd('0x40')]['id']}})[_0xdbbd('0x23')](function(_0x41252e){if(!_0x41252e)throw new Error(_0xdbbd('0x67')+_0x28b246[_0xdbbd('0x40')]['id']);return db['UserProfile'][_0xdbbd('0x64')](_0x28b246);})['then'](respondWithFilteredResult(_0x811258,_0x3e6326))[_0xdbbd('0x3f')](handleError(_0x811258,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 902a70a..19435a8 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 _0xacf4=['update','remove','emit','hasOwnProperty','hook','exports','UserProfile','setMaxListeners','save'];(function(_0x3ede0c,_0x3fb964){var _0x4817e0=function(_0x5282c6){while(--_0x5282c6){_0x3ede0c['push'](_0x3ede0c['shift']());}};_0x4817e0(++_0x3fb964);}(_0xacf4,0xe7));var _0x4acf=function(_0x59a3a2,_0x233d09){_0x59a3a2=_0x59a3a2-0x0;var _0x5144d0=_0xacf4[_0x59a3a2];return _0x5144d0;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db'][_0x4acf('0x0')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4acf('0x1')](0x0);var events={'afterCreate':_0x4acf('0x2'),'afterUpdate':_0x4acf('0x3'),'afterDestroy':_0x4acf('0x4')};function emitEvent(_0x4138f0){return function(_0x145264,_0x5cf22d,_0x380435){UserProfileEvents[_0x4acf('0x5')](_0x4138f0+':'+_0x145264['id'],_0x145264);UserProfileEvents['emit'](_0x4138f0,_0x145264);_0x380435(null);};}for(var e in events){if(events[_0x4acf('0x6')](e)){var event=events[e];UserProfile[_0x4acf('0x7')](e,emitEvent(event));}}module[_0x4acf('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x9f0e=['UserProfile','setMaxListeners','save','emit','hook','exports','events','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f0e,0x116));var _0xe9f0=function(_0x5a6a80,_0x466b3f){_0x5a6a80=_0x5a6a80-0x0;var _0xb468de=_0x9f0e[_0x5a6a80];return _0xb468de;};'use strict';var EventEmitter=require(_0xe9f0('0x0'));var UserProfile=require(_0xe9f0('0x1'))['db'][_0xe9f0('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe9f0('0x3')](0x0);var events={'afterCreate':_0xe9f0('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2325c6){return function(_0x150a03,_0x3c589d,_0x202d69){UserProfileEvents[_0xe9f0('0x5')](_0x2325c6+':'+_0x150a03['id'],_0x150a03);UserProfileEvents['emit'](_0x2325c6,_0x150a03);_0x202d69(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xe9f0('0x6')](e,emitEvent(event));}}module[_0xe9f0('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 9a7f449..df874cb 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 _0xafb9=['admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','scheduler','Schedule','Sound','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','from','user_has_','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','all','ignore','union','push','autoAssociation','rawAttributes','model','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','where','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','reportType','DefaultReports','custom','CustomReports','count','rows','Tag','Tags','color','tag','ThroughTags','include','true','dataValues','sms','fax','mail','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','field','filter','value','then','associatedResources','map','catch','findAll','name','resolve','AnalyticExtractedReport','resourceId','toLowerCase','childModel','SquareProject','SquareOdbc','squarerecordings','parentSections','JscriptyProject','contacts','CmContact','Lists','CmList','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','voicequeues','queuecampaigns','users','agents','telephones'];(function(_0x87f6d6,_0x5b8474){var _0x5dc547=function(_0x294c6e){while(--_0x294c6e){_0x87f6d6['push'](_0x87f6d6['shift']());}};_0x5dc547(++_0x5b8474);}(_0xafb9,0x68));var _0x9afb=function(_0x461623,_0x3b1761){_0x461623=_0x461623-0x0;var _0x3737d8=_0xafb9[_0x461623];return _0x3737d8;};'use strict';var _=require(_0x9afb('0x0'));var attributes=require(_0x9afb('0x1'));var qs=require(_0x9afb('0x2'));var squel=require(_0x9afb('0x3'));module[_0x9afb('0x4')]=function(_0x1a7c38){var _0x467aa3=_0x1a7c38[_0x9afb('0x5')];function _0xdaf0c6(_0x4e983d,_0x498463){return new Promise(function(_0x91ffa0,_0x56a139){if(!_0x498463)return _0x91ffa0(null);var _0x1ccf93=_0x498463['filter']?{[_0x498463['filter'][_0x9afb('0x6')]]:_0x498463[_0x9afb('0x7')][_0x9afb('0x8')]}:undefined;return _0x467aa3[_0x4e983d]['findAll']({'where':_0x1ccf93,'raw':!![]})[_0x9afb('0x9')](function(_0x3e0264){_0x498463[_0x9afb('0xa')]=_[_0x9afb('0xb')](_0x3e0264,'id');_0x91ffa0(_0x498463);})[_0x9afb('0xc')](function(_0x56f477){_0x56a139(_0x56f477);});});}function _0x5bb974(_0x2c0c02,_0x228811){return new Promise(function(_0x3e6a29,_0x31b574){var _0x1e611b=_0x2c0c02[_0x9afb('0x7')]?{[_0x2c0c02[_0x9afb('0x7')][_0x9afb('0x6')]]:_0x2c0c02[_0x9afb('0x7')][_0x9afb('0x8')]}:undefined;return _0x467aa3[_0x2c0c02['model']][_0x9afb('0xd')]({'where':_0x1e611b,'raw':!![]})['then'](function(_0x59fd82){_0x228811[_0x9afb('0xa')]=_[_0x9afb('0xb')](_0x59fd82,function(_0x3c8d2e){return _0x3c8d2e[_0x9afb('0xe')];});_0x3e6a29(_0x228811);})[_0x9afb('0xc')](function(_0x39cdf1){_0x31b574(_0x39cdf1);});});}function _0xd111f1(_0x4d31e3,_0x18505a,_0x2145c2){if(!_0x18505a)return Promise[_0x9afb('0xf')](null);return new Promise(function(_0x190cb8,_0x223aef){return _0x467aa3['UserProfileResource'][_0x9afb('0xd')]({'where':{'sectionId':_0x18505a['id']},'raw':!![]})['then'](function(_0x3fdb34){if(_0x4d31e3[_0x9afb('0x6')]&&_0x4d31e3['field']!=='id'){_0x18505a['associatedResources']=_[_0x9afb('0xb')](_0x3fdb34,function(_0x1217d9){return _0x1217d9[_0x4d31e3[_0x9afb('0x6')]];});}else{if(_0x2145c2===_0x9afb('0x10')){_0x18505a[_0x9afb('0xa')]=_['map'](_0x3fdb34,function(_0x105253){return{'id':_0x105253['resourceId'],'type':_0x105253['type']};});}else{_0x18505a[_0x9afb('0xa')]=_[_0x9afb('0xb')](_0x3fdb34,function(_0x3d67bb){return _0x3d67bb[_0x9afb('0x11')];});}}_0x190cb8(_0x18505a);})['catch'](function(_0x1e6f9c){_0x223aef(_0x1e6f9c);});});}function _0x725a04(_0x49ba5f,_0x571bd9){var _0x5b5dab={'parentSections':[]};switch(_0x49ba5f[_0x9afb('0x12')]()){case'squareprojects':_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x14');break;case'odbc':_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x15');break;case _0x9afb('0x16'):_0x5b5dab[_0x9afb('0x13')]='SquareRecording';_0x5b5dab[_0x9afb('0x17')]=[{'name':'SquareProjects','field':_0x9afb('0xe'),'foreignKey':'projectName'}];break;case'projects':_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x18');break;case _0x9afb('0x19'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x1a');_0x5b5dab[_0x9afb('0x17')]=[{'name':_0x9afb('0x1b'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x1c');break;case'companies':_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x1d');break;case'globalcustomfields':_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x1e');break;case _0x9afb('0x1f'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x20');break;case _0x9afb('0x21'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x22');break;case'faxqueues':_0x5b5dab['childModel']=_0x9afb('0x23');break;case _0x9afb('0x24'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x25');break;case _0x9afb('0x26'):case _0x9afb('0x27'):case _0x9afb('0x28'):_0x5b5dab['childModel']='VoiceExtension';break;case _0x9afb('0x29'):_0x5b5dab[_0x9afb('0x13')]='VoiceContext';break;case _0x9afb('0x2a'):_0x5b5dab['childModel']=_0x9afb('0x2b');break;case _0x9afb('0x2c'):_0x5b5dab['childModel']=_0x9afb('0x2d');_0x5b5dab['parentSections']=[{'name':_0x9afb('0x2e'),'field':_0x9afb('0xe'),'foreignKey':_0x9afb('0x2f'),'model':_0x9afb('0x30'),'filter':{'field':_0x9afb('0x31'),'value':[_0x9afb('0x32')]}},{'name':_0x9afb('0x33'),'field':_0x9afb('0xe'),'foreignKey':'membername','model':_0x9afb('0x30'),'filter':{'field':'role','value':[_0x9afb('0x34')]}},{'name':_0x9afb('0x35'),'field':_0x9afb('0xe'),'foreignKey':_0x9afb('0x36'),'model':_0x9afb('0x37'),'filter':{'field':_0x9afb('0x38'),'value':[_0x9afb('0x39')]}},{'name':_0x9afb('0x3a'),'field':_0x9afb('0xe'),'foreignKey':'queue','model':_0x9afb('0x37'),'filter':{'field':'type','value':[_0x9afb('0x3b')]}}];break;case _0x9afb('0x3c'):_0x5b5dab[_0x9afb('0x13')]='VoiceMusicOnHold';break;case _0x9afb('0x3d'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x3e');break;case _0x9afb('0x3f'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x40');break;case _0x9afb('0x41'):_0x5b5dab['childModel']=_0x9afb('0x42');break;case _0x9afb('0x43'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x44');break;case _0x9afb('0x45'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x46');break;case _0x9afb('0x47'):_0x5b5dab['childModel']=_0x9afb('0x48');break;case'openchannelqueues':_0x5b5dab['childModel']='OpenchannelQueue';break;case _0x9afb('0x49'):_0x5b5dab[_0x9afb('0x13')]='OpenchannelAccount';break;case _0x9afb('0x4a'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x4b');break;case _0x9afb('0x4c'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x4d');break;case _0x9afb('0x4e'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x4f');break;case'whatsappaccounts':_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x50');break;case _0x9afb('0x51'):_0x5b5dab[_0x9afb('0x13')]='Team';break;case _0x9afb('0x52'):case _0x9afb('0x53'):_0x5b5dab[_0x9afb('0x13')]='VoiceQueue';if(_0x571bd9){_0x5b5dab[_0x9afb('0x17')]=[{'name':_0x9afb('0x35')},{'name':_0x9afb('0x3a')}];}break;case _0x9afb('0x54'):case _0x9afb('0x55'):case _0x9afb('0x56'):_0x5b5dab[_0x9afb('0x13')]='User';if(_0x571bd9){_0x5b5dab['parentSections']=[{'name':'Users','filter':{'field':_0x9afb('0x31'),'value':[_0x9afb('0x57'),'user']},'ignore':!![]},{'name':_0x9afb('0x2e')},{'name':_0x9afb('0x33')}];}break;case _0x9afb('0x58'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x59');break;case _0x9afb('0x5a'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x5b');break;case _0x9afb('0x5c'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x5d');break;case'sugarcrmaccounts':_0x5b5dab['childModel']=_0x9afb('0x5e');break;case'deskaccounts':_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x5f');break;case _0x9afb('0x60'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x61');break;case'vtigeraccounts':_0x5b5dab[_0x9afb('0x13')]='User';break;case _0x9afb('0x62'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x63');break;case _0x9afb('0x64'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x65');break;case _0x9afb('0x66'):_0x5b5dab['childModel']=_0x9afb('0x67');break;case _0x9afb('0x68'):_0x5b5dab[_0x9afb('0x13')]='Interval';break;case _0x9afb('0x69'):_0x5b5dab[_0x9afb('0x13')]='Pause';break;case _0x9afb('0x6a'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x6b');break;case'sounds':_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x6c');break;case'tags':_0x5b5dab['childModel']='Tag';break;case _0x9afb('0x6d'):_0x5b5dab['childModel']=_0x9afb('0x6e');break;case'triggers':_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x6f');break;case _0x9afb('0x70'):_0x5b5dab['childModel']=_0x9afb('0x71');break;case _0x9afb('0x72'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x73');break;case _0x9afb('0x74'):_0x5b5dab[_0x9afb('0x13')]='Plugin';break;case _0x9afb('0x75'):_0x5b5dab[_0x9afb('0x13')]=_0x9afb('0x10');_0x5b5dab[_0x9afb('0x17')]=[{'name':'Reports','field':'id','foreignKey':_0x9afb('0x76')}];break;case _0x9afb('0x77'):_0x5b5dab['childModel']=_0x9afb('0x78');break;}return _0x5b5dab;}function _0x2ab4da(_0x3faf33,_0x55612b){var _0x347ce8=_0x3faf33[_0x9afb('0x79')](0x0)[_0x9afb('0x7a')]()+_0x3faf33[_0x9afb('0x7b')](0x1);var _0x23c96c={'type':_0x467aa3[_0x9afb('0x7c')][_0x9afb('0x7d')][_0x9afb('0x7e')],'raw':!![]};return new Promise(function(_0x25429d,_0xd6ba91){var _0x1769ac=squel[_0x9afb('0x7f')]()[_0x9afb('0x6')]('ui.'+_0x347ce8+_0x9afb('0x80'),'id')[_0x9afb('0x6')]('ui.createdAt')[_0x9afb('0x81')](_0x9afb('0x82')+_0x3faf33+'_interactions','ui')['where'](_0x9afb('0x83'),_0x55612b['id']);return _0x467aa3[_0x9afb('0x84')][_0x9afb('0x85')](_0x1769ac[_0x9afb('0x86')](),_0x23c96c)[_0x9afb('0x9')](function(_0x53edb7){_0x55612b[_0x347ce8+_0x9afb('0x87')]=_0x53edb7;_0x25429d(_0x53edb7);})[_0x9afb('0xc')](function(_0x1bcdf4){_0xd6ba91(_0x1bcdf4);});});}return _0x1a7c38[_0x9afb('0x88')](_0x9afb('0x89'),attributes,{'tableName':_0x9afb('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x169959){var _0x8b6303={'raw':![],'where':{}};var _0x572ca2={};var _0x16d7f5={'count':0x0,'rows':[]};var _0x5f2d69=_0x169959[_0x9afb('0x85')][_0x9afb('0x8b')];var _0x263ebb=_0x169959[_0x9afb('0x85')][_0x9afb('0x8c')]||![];var _0x5dd4ee=_0x725a04(_0x5f2d69,_0x263ebb);if(!_0x5dd4ee['childModel'])throw new Error(_0x9afb('0x8d')+_0x5f2d69+'\x27');var _0x35ea5a=[{'name':_0x5f2d69}];if(!_[_0x9afb('0x8e')](_0x5dd4ee[_0x9afb('0x17')]))_0x35ea5a=_0x5dd4ee[_0x9afb('0x17')];var _0x5113ec=[];for(var _0x4037b8=0x0;_0x4037b8<_0x35ea5a[_0x9afb('0x8f')];_0x4037b8++){_0x5113ec['push'](_0x467aa3[_0x9afb('0x90')][_0x9afb('0x91')]({'where':{'userProfileId':_0x169959['params']['id'],'name':_0x35ea5a[_0x4037b8][_0x9afb('0xe')]},'raw':!![]}));}return Promise[_0x9afb('0x92')](_0x5113ec)['then'](function(_0x722eb2){var _0x5d4578=_[_0x9afb('0x7')](_0x722eb2,function(_0x112359){return _0x112359?_0x112359:undefined;});var _0x5d71a3=_[_0x9afb('0x7')](_0x35ea5a,[_0x9afb('0x93'),!![]]);var _0x480ca1=_['isEmpty'](_0x5d4578)&&_[_0x9afb('0x8e')](_0x5d71a3)?null:_[_0x9afb('0x94')](_0x5d71a3,_0x5d4578);if(!_0x480ca1)return null;var _0x2ccbb9=[];for(var _0x483bf4=0x0;_0x483bf4<_0x480ca1[_0x9afb('0x8f')];_0x483bf4++){var _0x33060b=_[_0x9afb('0x91')](_0x35ea5a,function(_0x5357b4){return _0x480ca1[_0x483bf4]?_0x5357b4[_0x9afb('0xe')]===_0x480ca1[_0x483bf4][_0x9afb('0xe')]:null;});if(_0x33060b){if(_0x480ca1[_0x483bf4][_0x9afb('0x93')]){_0x2ccbb9[_0x9afb('0x95')](_0xdaf0c6(_0x5dd4ee[_0x9afb('0x13')],_0x480ca1[_0x483bf4]));}else{if(!_0x480ca1[_0x483bf4][_0x9afb('0x96')]){_0x2ccbb9['push'](_0xd111f1(_0x33060b,_0x480ca1[_0x483bf4],_0x5dd4ee[_0x9afb('0x13')]));}else{if(_0x33060b['model']){_0x2ccbb9[_0x9afb('0x95')](_0x5bb974(_0x33060b,_0x480ca1[_0x483bf4]));}}}}}return Promise[_0x9afb('0x92')](_0x2ccbb9);})[_0x9afb('0x9')](function(_0x4daa54){var _0x22c4e2=_0x4daa54;var _0x4e3c3d=null;if(_0x22c4e2){_0x4e3c3d=_0x22c4e2[_0x9afb('0x8f')]===0x1?_0x22c4e2[0x0]:null;}if(!_0x4e3c3d&&!_0x22c4e2)return _0x16d7f5;var _0x47735e=_0x467aa3[_0x5dd4ee['childModel']][_0x9afb('0x97')];_0x572ca2[_0x9afb('0x98')]=_[_0x9afb('0x99')](_0x47735e);_0x572ca2[_0x9afb('0x85')]=_['keys'](_0x169959[_0x9afb('0x85')]);_0x572ca2[_0x9afb('0x9a')]=_[_0x9afb('0x9b')](_0x572ca2[_0x9afb('0x98')],_0x572ca2[_0x9afb('0x85')]);_0x8b6303['attributes']=_[_0x9afb('0x9b')](_0x572ca2[_0x9afb('0x98')],qs['fields'](_0x169959[_0x9afb('0x85')][_0x9afb('0x9c')]));_0x8b6303[_0x9afb('0x9d')]=_0x8b6303[_0x9afb('0x9d')]['length']?_0x8b6303[_0x9afb('0x9d')]:_0x572ca2[_0x9afb('0x98')];if(!_0x169959[_0x9afb('0x85')][_0x9afb('0x9e')](_0x9afb('0x9f'))){_0x8b6303[_0x9afb('0xa0')]=qs['limit'](_0x169959[_0x9afb('0x85')]['limit']);_0x8b6303[_0x9afb('0xa1')]=qs[_0x9afb('0xa1')](_0x169959[_0x9afb('0x85')][_0x9afb('0xa1')]);}_0x8b6303[_0x9afb('0xa2')]=qs[_0x9afb('0xa3')](_0x169959[_0x9afb('0x85')][_0x9afb('0xa3')]);_0x8b6303['where']=qs[_0x9afb('0x9a')](_[_0x9afb('0xa4')](_0x169959[_0x9afb('0x85')],_0x572ca2[_0x9afb('0x9a')]));if(_0x169959[_0x9afb('0x85')][_0x9afb('0x7')]){_0x8b6303[_0x9afb('0xa5')]=_[_0x9afb('0xa6')](_0x8b6303[_0x9afb('0xa5')],{'$or':_['map'](_0x47735e,function(_0x12fde9){if(_0x12fde9[_0x9afb('0x38')][_0x9afb('0xa7')]!==_0x9afb('0xa8')){var _0x207180={};_0x207180[_0x12fde9[_0x9afb('0x6')]]={'$like':'%'+_0x169959['query'][_0x9afb('0x7')]+'%'};return _0x207180;}})});}var _0x2663ae=[];var _0x2a6595=null;var _0x1a58ff={};if(_0x4e3c3d){_0x2a6595=_['find'](_0x35ea5a,[_0x9afb('0xe'),_0x4e3c3d[_0x9afb('0xe')]]);if(_0x2a6595[_0x9afb('0x6')]){_0x1a58ff={};if(_0x5dd4ee[_0x9afb('0x13')]==='AnalyticExtractedReport'){_0x1a58ff[_0x2a6595[_0x9afb('0xa9')]]=_['map'](_0x4e3c3d[_0x9afb('0xa')],'id');}else{_0x1a58ff[_0x2a6595['foreignKey']]=_0x4e3c3d[_0x9afb('0xa')];}_0x2663ae[_0x9afb('0x95')](_0x1a58ff);}else{_0x8b6303[_0x9afb('0xa5')]['id']=_0x4e3c3d['associatedResources'];}}else{for(var _0x299af9=0x0;_0x299af9<_0x22c4e2['length'];_0x299af9++){_0x2a6595=_['find'](_0x35ea5a,[_0x9afb('0xe'),_0x22c4e2[_0x299af9]['name']]);if(_0x2a6595[_0x9afb('0x6')]){_0x1a58ff={};_0x1a58ff[_0x2a6595[_0x9afb('0xa9')]]=_0x22c4e2[_0x299af9]['associatedResources'];_0x2663ae['push'](_0x1a58ff);}else{if(!_0x8b6303[_0x9afb('0xa5')]['id'])_0x8b6303[_0x9afb('0xa5')]['id']=[];_0x22c4e2[_0x299af9]['associatedResources'][_0x9afb('0xaa')](function(_0x29f1f2){_0x8b6303[_0x9afb('0xa5')]['id']['push'](_0x29f1f2);});}}}if(!_['isEmpty'](_0x2663ae)){_0x8b6303[_0x9afb('0xa5')]=_[_0x9afb('0xa6')](_0x8b6303[_0x9afb('0xa5')],{'$and':{'$or':_0x2663ae}});}_0x8b6303=_[_0x9afb('0xa6')]({},_0x8b6303,_0x169959[_0x9afb('0xab')]);if(_0x4e3c3d&&!_0x4e3c3d[_0x9afb('0x96')]&&_0x5dd4ee[_0x9afb('0x13')]===_0x9afb('0x10')){if(_0x169959[_0x9afb('0x85')][_0x9afb('0xac')]){_0x8b6303['include']=[{'all':!![]}];}return _0x467aa3[_0x5dd4ee[_0x9afb('0x13')]][_0x9afb('0xd')](_0x8b6303)['then'](function(_0x29f047){var _0x54bd67=[];_0x29f047[_0x9afb('0xaa')](function(_0x27efdb){var _0x3ccba9;switch(_0x27efdb[_0x9afb('0xad')]){case'default':_0x3ccba9=_[_0x9afb('0x91')](_0x4e3c3d['associatedResources'],function(_0x3900c2){return _0x3900c2['id']===_0x27efdb[_0x9afb('0x76')]&&_0x3900c2[_0x9afb('0x38')]===_0x9afb('0xae');});break;case _0x9afb('0xaf'):_0x3ccba9=_['find'](_0x4e3c3d['associatedResources'],function(_0x225caa){return _0x225caa['id']===_0x27efdb['reportId']&&_0x225caa[_0x9afb('0x38')]===_0x9afb('0xb0');});break;}if(_0x3ccba9)_0x54bd67[_0x9afb('0x95')](_0x27efdb);});_0x16d7f5[_0x9afb('0xb1')]=_0x54bd67['length'];_0x16d7f5[_0x9afb('0xb2')]=_0x54bd67;return _0x16d7f5;});}else{return _0x467aa3[_0x5dd4ee[_0x9afb('0x13')]][_0x9afb('0xb1')]({'where':_0x8b6303['where']})[_0x9afb('0x9')](function(_0x9a7ee1){_0x16d7f5[_0x9afb('0xb1')]=_0x9a7ee1;if(_0x169959['query'][_0x9afb('0xac')]){if(_0x5dd4ee[_0x9afb('0x13')]==='CmContact'){_0x8b6303['include']=[{'model':_0x467aa3[_0x9afb('0xb3')],'as':_0x9afb('0xb4'),'attributes':['id',_0x9afb('0xe'),_0x9afb('0xb5')],'required':_0x169959['query'][_0x9afb('0xb6')]?!![]:![]},{'model':_0x467aa3[_0x9afb('0xb3')],'as':_0x9afb('0xb7'),'attributes':['id',_0x9afb('0xe'),_0x9afb('0xb5')],'through':_0x169959[_0x9afb('0x85')][_0x9afb('0xb6')]?{'attributes':[],'where':{'TagId':_0x169959[_0x9afb('0x85')]['tag']||undefined}}:{},'required':_0x169959[_0x9afb('0x85')][_0x9afb('0xb6')]?!![]:![]}];}else{_0x8b6303[_0x9afb('0xb8')]=[{'all':!![]}];}}return _0x467aa3[_0x5dd4ee[_0x9afb('0x13')]][_0x9afb('0xd')](_0x8b6303);})[_0x9afb('0x9')](function(_0x1faa74){_0x16d7f5[_0x9afb('0xb2')]=_0x1faa74;if(_0x5f2d69==='Agents'&&_0x169959[_0x9afb('0x85')]['openTabs']===_0x9afb('0xb9')){var _0x3c6761=[];for(var _0x3fb617=0x0;_0x3fb617<_0x16d7f5[_0x9afb('0xb2')]['length'];_0x3fb617++){_0x3c6761[_0x9afb('0x95')](_0x2ab4da('chat',_0x16d7f5[_0x9afb('0xb2')][_0x3fb617][_0x9afb('0xba')]));_0x3c6761['push'](_0x2ab4da(_0x9afb('0xbb'),_0x16d7f5[_0x9afb('0xb2')][_0x3fb617][_0x9afb('0xba')]));_0x3c6761[_0x9afb('0x95')](_0x2ab4da(_0x9afb('0xbc'),_0x16d7f5[_0x9afb('0xb2')][_0x3fb617][_0x9afb('0xba')]));_0x3c6761[_0x9afb('0x95')](_0x2ab4da(_0x9afb('0xbd'),_0x16d7f5[_0x9afb('0xb2')][_0x3fb617][_0x9afb('0xba')]));_0x3c6761[_0x9afb('0x95')](_0x2ab4da(_0x9afb('0xbe'),_0x16d7f5[_0x9afb('0xb2')][_0x3fb617]['dataValues']));_0x3c6761['push'](_0x2ab4da('whatsapp',_0x16d7f5[_0x9afb('0xb2')][_0x3fb617]['dataValues']));}return Promise['all'](_0x3c6761)['then'](function(){return _0x16d7f5;});}return _0x16d7f5;});}});}}});}; \ No newline at end of file +var _0x7880=['VoiceMail','VoiceRecording','parentSections','Agents','membername','role','Telephones','User','VoiceQueues','queue','QueueCampaigns','VoiceQueue','outbound','musiconholds','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','users','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Sound','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','_interactions','where','sequelize','query','toString','define','UserProfile','user_profiles','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','params','all','ignore','union','find','push','autoAssociation','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','include','forEach','reportType','default','DefaultReports','CustomReports','count','rows','includeAll','CmContact','Tags','color','tag','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','field','findAll','map','catch','model','then','name','associatedResources','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','odbc','childModel','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','voicemails'];(function(_0x43014f,_0x12d1fb){var _0xd0a9b3=function(_0x529df1){while(--_0x529df1){_0x43014f['push'](_0x43014f['shift']());}};_0xd0a9b3(++_0x12d1fb);}(_0x7880,0x1f4));var _0x0788=function(_0x1c74db,_0x474b8a){_0x1c74db=_0x1c74db-0x0;var _0x47b019=_0x7880[_0x1c74db];return _0x47b019;};'use strict';var _=require('lodash');var attributes=require(_0x0788('0x0'));var qs=require(_0x0788('0x1'));var squel=require(_0x0788('0x2'));module[_0x0788('0x3')]=function(_0x47dc20){var _0x446ded=_0x47dc20['models'];function _0x3925a6(_0x1e0814,_0x317885){return new Promise(function(_0xd53e7d,_0x262f5c){if(!_0x317885)return _0xd53e7d(null);var _0x775629=_0x317885[_0x0788('0x4')]?{[_0x317885[_0x0788('0x4')][_0x0788('0x5')]]:_0x317885[_0x0788('0x4')]['value']}:undefined;return _0x446ded[_0x1e0814][_0x0788('0x6')]({'where':_0x775629,'raw':!![]})['then'](function(_0xabaf81){_0x317885['associatedResources']=_[_0x0788('0x7')](_0xabaf81,'id');_0xd53e7d(_0x317885);})[_0x0788('0x8')](function(_0x1f9ff6){_0x262f5c(_0x1f9ff6);});});}function _0xee8670(_0x469ebe,_0x5d747c){return new Promise(function(_0x1920b3,_0x37560d){var _0x21c303=_0x469ebe[_0x0788('0x4')]?{[_0x469ebe[_0x0788('0x4')][_0x0788('0x5')]]:_0x469ebe[_0x0788('0x4')]['value']}:undefined;return _0x446ded[_0x469ebe[_0x0788('0x9')]][_0x0788('0x6')]({'where':_0x21c303,'raw':!![]})[_0x0788('0xa')](function(_0x13cf07){_0x5d747c['associatedResources']=_[_0x0788('0x7')](_0x13cf07,function(_0x4ed024){return _0x4ed024[_0x0788('0xb')];});_0x1920b3(_0x5d747c);})[_0x0788('0x8')](function(_0x3fd1e4){_0x37560d(_0x3fd1e4);});});}function _0xb406fb(_0x2ddd1a,_0x430e34,_0x5e1a29){if(!_0x430e34)return Promise['resolve'](null);return new Promise(function(_0x17d805,_0x461d9d){return _0x446ded['UserProfileResource'][_0x0788('0x6')]({'where':{'sectionId':_0x430e34['id']},'raw':!![]})[_0x0788('0xa')](function(_0x17ae59){if(_0x2ddd1a['field']&&_0x2ddd1a[_0x0788('0x5')]!=='id'){_0x430e34[_0x0788('0xc')]=_['map'](_0x17ae59,function(_0x11ea01){return _0x11ea01[_0x2ddd1a['field']];});}else{if(_0x5e1a29===_0x0788('0xd')){_0x430e34['associatedResources']=_[_0x0788('0x7')](_0x17ae59,function(_0x3c37ca){return{'id':_0x3c37ca[_0x0788('0xe')],'type':_0x3c37ca[_0x0788('0xf')]};});}else{_0x430e34[_0x0788('0xc')]=_['map'](_0x17ae59,function(_0x48ec43){return _0x48ec43[_0x0788('0xe')];});}}_0x17d805(_0x430e34);})[_0x0788('0x8')](function(_0x645320){_0x461d9d(_0x645320);});});}function _0x7a99a1(_0x5ba1da,_0x4d5c93){var _0x79204e={'parentSections':[]};switch(_0x5ba1da[_0x0788('0x10')]()){case _0x0788('0x11'):_0x79204e['childModel']='SquareProject';break;case _0x0788('0x12'):_0x79204e[_0x0788('0x13')]='SquareOdbc';break;case'squarerecordings':_0x79204e[_0x0788('0x13')]=_0x0788('0x14');_0x79204e['parentSections']=[{'name':_0x0788('0x15'),'field':_0x0788('0xb'),'foreignKey':_0x0788('0x16')}];break;case _0x0788('0x17'):_0x79204e[_0x0788('0x13')]=_0x0788('0x18');break;case _0x0788('0x19'):_0x79204e[_0x0788('0x13')]='CmContact';_0x79204e['parentSections']=[{'name':_0x0788('0x1a'),'field':'id','foreignKey':_0x0788('0x1b')}];break;case'lists':_0x79204e['childModel']=_0x0788('0x1c');break;case _0x0788('0x1d'):_0x79204e[_0x0788('0x13')]=_0x0788('0x1e');break;case _0x0788('0x1f'):_0x79204e[_0x0788('0x13')]=_0x0788('0x20');break;case _0x0788('0x21'):_0x79204e[_0x0788('0x13')]=_0x0788('0x22');break;case'chatwebsites':_0x79204e[_0x0788('0x13')]=_0x0788('0x23');break;case _0x0788('0x24'):_0x79204e[_0x0788('0x13')]=_0x0788('0x25');break;case _0x0788('0x26'):_0x79204e[_0x0788('0x13')]=_0x0788('0x27');break;case _0x0788('0x28'):case _0x0788('0x29'):case'outboundroutes':_0x79204e['childModel']='VoiceExtension';break;case'contexts':_0x79204e['childModel']='VoiceContext';break;case _0x0788('0x2a'):_0x79204e[_0x0788('0x13')]=_0x0788('0x2b');break;case'voicerecordings':_0x79204e[_0x0788('0x13')]=_0x0788('0x2c');_0x79204e[_0x0788('0x2d')]=[{'name':_0x0788('0x2e'),'field':'name','foreignKey':_0x0788('0x2f'),'model':'User','filter':{'field':_0x0788('0x30'),'value':['agent']}},{'name':_0x0788('0x31'),'field':_0x0788('0xb'),'foreignKey':'membername','model':_0x0788('0x32'),'filter':{'field':_0x0788('0x30'),'value':['telephone']}},{'name':_0x0788('0x33'),'field':'name','foreignKey':_0x0788('0x34'),'model':'VoiceQueue','filter':{'field':_0x0788('0xf'),'value':['inbound']}},{'name':_0x0788('0x35'),'field':'name','foreignKey':'queue','model':_0x0788('0x36'),'filter':{'field':_0x0788('0xf'),'value':[_0x0788('0x37')]}}];break;case _0x0788('0x38'):_0x79204e[_0x0788('0x13')]='VoiceMusicOnHold';break;case'chanspies':_0x79204e['childModel']='VoiceChanSpy';break;case _0x0788('0x39'):_0x79204e[_0x0788('0x13')]=_0x0788('0x3a');break;case _0x0788('0x3b'):_0x79204e[_0x0788('0x13')]='Campaign';break;case'mailqueues':_0x79204e[_0x0788('0x13')]=_0x0788('0x3c');break;case _0x0788('0x3d'):_0x79204e[_0x0788('0x13')]=_0x0788('0x3e');break;case _0x0788('0x3f'):_0x79204e[_0x0788('0x13')]=_0x0788('0x40');break;case _0x0788('0x41'):_0x79204e['childModel']='OpenchannelQueue';break;case _0x0788('0x42'):_0x79204e[_0x0788('0x13')]=_0x0788('0x43');break;case'smsqueues':_0x79204e['childModel']='SmsQueue';break;case _0x0788('0x44'):_0x79204e[_0x0788('0x13')]=_0x0788('0x45');break;case _0x0788('0x46'):_0x79204e[_0x0788('0x13')]=_0x0788('0x47');break;case _0x0788('0x48'):_0x79204e[_0x0788('0x13')]='WhatsappAccount';break;case _0x0788('0x49'):_0x79204e[_0x0788('0x13')]=_0x0788('0x4a');break;case _0x0788('0x4b'):case'queuecampaigns':_0x79204e[_0x0788('0x13')]=_0x0788('0x36');if(_0x4d5c93){_0x79204e['parentSections']=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x0788('0x4c'):case'agents':case _0x0788('0x4d'):_0x79204e[_0x0788('0x13')]=_0x0788('0x32');if(_0x4d5c93){_0x79204e[_0x0788('0x2d')]=[{'name':_0x0788('0x4e'),'filter':{'field':_0x0788('0x30'),'value':[_0x0788('0x4f'),_0x0788('0x50')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x0788('0x51'):_0x79204e[_0x0788('0x13')]=_0x0788('0x52');break;case'salesforceaccounts':_0x79204e[_0x0788('0x13')]=_0x0788('0x53');break;case _0x0788('0x54'):_0x79204e[_0x0788('0x13')]=_0x0788('0x55');break;case'sugarcrmaccounts':_0x79204e['childModel']=_0x0788('0x56');break;case _0x0788('0x57'):_0x79204e['childModel']=_0x0788('0x58');break;case'zohoaccounts':_0x79204e[_0x0788('0x13')]=_0x0788('0x59');break;case _0x0788('0x5a'):_0x79204e[_0x0788('0x13')]=_0x0788('0x32');break;case _0x0788('0x5b'):_0x79204e[_0x0788('0x13')]=_0x0788('0x5c');break;case'dispositions':_0x79204e[_0x0788('0x13')]=_0x0788('0x5d');break;case _0x0788('0x5e'):_0x79204e['childModel']=_0x0788('0x5f');break;case _0x0788('0x60'):_0x79204e['childModel']=_0x0788('0x61');break;case _0x0788('0x62'):_0x79204e[_0x0788('0x13')]=_0x0788('0x63');break;case _0x0788('0x64'):_0x79204e[_0x0788('0x13')]='Schedule';break;case'sounds':_0x79204e[_0x0788('0x13')]=_0x0788('0x65');break;case'tags':_0x79204e[_0x0788('0x13')]=_0x0788('0x66');break;case _0x0788('0x67'):_0x79204e[_0x0788('0x13')]=_0x0788('0x68');break;case _0x0788('0x69'):_0x79204e[_0x0788('0x13')]=_0x0788('0x6a');break;case _0x0788('0x6b'):_0x79204e[_0x0788('0x13')]=_0x0788('0x6c');break;case _0x0788('0x6d'):_0x79204e['childModel']=_0x0788('0x6e');break;case _0x0788('0x6f'):_0x79204e[_0x0788('0x13')]='Plugin';break;case _0x0788('0x70'):_0x79204e[_0x0788('0x13')]='AnalyticExtractedReport';_0x79204e['parentSections']=[{'name':_0x0788('0x71'),'field':'id','foreignKey':_0x0788('0x72')}];break;case _0x0788('0x73'):_0x79204e[_0x0788('0x13')]=_0x0788('0x74');break;}return _0x79204e;}function _0x4c08f9(_0x535648,_0x336d30){var _0x3be076=_0x535648[_0x0788('0x75')](0x0)['toUpperCase']()+_0x535648['slice'](0x1);var _0x3a25d3={'type':_0x446ded['Sequelize'][_0x0788('0x76')][_0x0788('0x77')],'raw':!![]};return new Promise(function(_0x223767,_0x13a021){var _0x101e8b=squel[_0x0788('0x78')]()[_0x0788('0x5')](_0x0788('0x79')+_0x3be076+_0x0788('0x7a'),'id')[_0x0788('0x5')]('ui.createdAt')[_0x0788('0x7b')](_0x0788('0x7c')+_0x535648+_0x0788('0x7d'),'ui')[_0x0788('0x7e')]('ui.UserId\x20=\x20?',_0x336d30['id']);return _0x446ded[_0x0788('0x7f')][_0x0788('0x80')](_0x101e8b[_0x0788('0x81')](),_0x3a25d3)[_0x0788('0xa')](function(_0x5a353f){_0x336d30[_0x3be076+'OpenTabs']=_0x5a353f;_0x223767(_0x5a353f);})[_0x0788('0x8')](function(_0x4aa3af){_0x13a021(_0x4aa3af);});});}return _0x47dc20[_0x0788('0x82')](_0x0788('0x83'),attributes,{'tableName':_0x0788('0x84'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x47f22c){var _0x3baf23={'raw':![],'where':{}};var _0x348cbf={};var _0xdc7103={'count':0x0,'rows':[]};var _0x150403=_0x47f22c[_0x0788('0x80')]['section'];var _0x25201f=_0x47f22c[_0x0788('0x80')][_0x0788('0x85')]||![];var _0x59a436=_0x7a99a1(_0x150403,_0x25201f);if(!_0x59a436['childModel'])throw new Error(_0x0788('0x86')+_0x150403+'\x27');var _0x1bb234=[{'name':_0x150403}];if(!_[_0x0788('0x87')](_0x59a436['parentSections']))_0x1bb234=_0x59a436[_0x0788('0x2d')];var _0x23f7d1=[];for(var _0x1eb4c9=0x0;_0x1eb4c9<_0x1bb234[_0x0788('0x88')];_0x1eb4c9++){_0x23f7d1['push'](_0x446ded['UserProfileSection']['find']({'where':{'userProfileId':_0x47f22c[_0x0788('0x89')]['id'],'name':_0x1bb234[_0x1eb4c9][_0x0788('0xb')]},'raw':!![]}));}return Promise[_0x0788('0x8a')](_0x23f7d1)['then'](function(_0x59b296){var _0xaa2d4d=_['filter'](_0x59b296,function(_0x955bfa){return _0x955bfa?_0x955bfa:undefined;});var _0x3d1181=_[_0x0788('0x4')](_0x1bb234,[_0x0788('0x8b'),!![]]);var _0x1834fb=_[_0x0788('0x87')](_0xaa2d4d)&&_[_0x0788('0x87')](_0x3d1181)?null:_[_0x0788('0x8c')](_0x3d1181,_0xaa2d4d);if(!_0x1834fb)return null;var _0x433c05=[];for(var _0x137a7a=0x0;_0x137a7a<_0x1834fb['length'];_0x137a7a++){var _0x240210=_[_0x0788('0x8d')](_0x1bb234,function(_0x52926f){return _0x1834fb[_0x137a7a]?_0x52926f['name']===_0x1834fb[_0x137a7a][_0x0788('0xb')]:null;});if(_0x240210){if(_0x1834fb[_0x137a7a][_0x0788('0x8b')]){_0x433c05[_0x0788('0x8e')](_0x3925a6(_0x59a436[_0x0788('0x13')],_0x1834fb[_0x137a7a]));}else{if(!_0x1834fb[_0x137a7a][_0x0788('0x8f')]){_0x433c05[_0x0788('0x8e')](_0xb406fb(_0x240210,_0x1834fb[_0x137a7a],_0x59a436['childModel']));}else{if(_0x240210[_0x0788('0x9')]){_0x433c05[_0x0788('0x8e')](_0xee8670(_0x240210,_0x1834fb[_0x137a7a]));}}}}}return Promise[_0x0788('0x8a')](_0x433c05);})[_0x0788('0xa')](function(_0x4e0282){var _0x35c612=_0x4e0282;var _0x2272e2=null;if(_0x35c612){_0x2272e2=_0x35c612[_0x0788('0x88')]===0x1?_0x35c612[0x0]:null;}if(!_0x2272e2&&!_0x35c612)return _0xdc7103;var _0x360476=_0x446ded[_0x59a436['childModel']]['rawAttributes'];_0x348cbf[_0x0788('0x9')]=_[_0x0788('0x90')](_0x360476);_0x348cbf[_0x0788('0x80')]=_[_0x0788('0x90')](_0x47f22c[_0x0788('0x80')]);_0x348cbf[_0x0788('0x91')]=_[_0x0788('0x92')](_0x348cbf[_0x0788('0x9')],_0x348cbf[_0x0788('0x80')]);_0x3baf23['attributes']=_[_0x0788('0x92')](_0x348cbf[_0x0788('0x9')],qs[_0x0788('0x93')](_0x47f22c['query']['fields']));_0x3baf23[_0x0788('0x94')]=_0x3baf23['attributes'][_0x0788('0x88')]?_0x3baf23[_0x0788('0x94')]:_0x348cbf[_0x0788('0x9')];if(!_0x47f22c[_0x0788('0x80')][_0x0788('0x95')](_0x0788('0x96'))){_0x3baf23[_0x0788('0x97')]=qs[_0x0788('0x97')](_0x47f22c[_0x0788('0x80')]['limit']);_0x3baf23[_0x0788('0x98')]=qs[_0x0788('0x98')](_0x47f22c[_0x0788('0x80')]['offset']);}_0x3baf23[_0x0788('0x99')]=qs[_0x0788('0x9a')](_0x47f22c[_0x0788('0x80')]['sort']);_0x3baf23[_0x0788('0x7e')]=qs[_0x0788('0x91')](_[_0x0788('0x9b')](_0x47f22c[_0x0788('0x80')],_0x348cbf[_0x0788('0x91')]));if(_0x47f22c[_0x0788('0x80')][_0x0788('0x4')]){_0x3baf23[_0x0788('0x7e')]=_[_0x0788('0x9c')](_0x3baf23['where'],{'$or':_[_0x0788('0x7')](_0x360476,function(_0x623d29){if(_0x623d29[_0x0788('0xf')][_0x0788('0x9d')]!==_0x0788('0x9e')){var _0x5749fc={};_0x5749fc[_0x623d29[_0x0788('0x5')]]={'$like':'%'+_0x47f22c[_0x0788('0x80')][_0x0788('0x4')]+'%'};return _0x5749fc;}})});}var _0x4fb7f7=[];var _0x1788d1=null;var _0x17430c={};if(_0x2272e2){_0x1788d1=_[_0x0788('0x8d')](_0x1bb234,[_0x0788('0xb'),_0x2272e2[_0x0788('0xb')]]);if(_0x1788d1['field']){_0x17430c={};if(_0x59a436[_0x0788('0x13')]===_0x0788('0xd')){_0x17430c[_0x1788d1['foreignKey']]=_[_0x0788('0x7')](_0x2272e2[_0x0788('0xc')],'id');}else{_0x17430c[_0x1788d1['foreignKey']]=_0x2272e2[_0x0788('0xc')];}_0x4fb7f7[_0x0788('0x8e')](_0x17430c);}else{_0x3baf23[_0x0788('0x7e')]['id']=_0x2272e2['associatedResources'];}}else{for(var _0x28ad96=0x0;_0x28ad96<_0x35c612[_0x0788('0x88')];_0x28ad96++){_0x1788d1=_[_0x0788('0x8d')](_0x1bb234,['name',_0x35c612[_0x28ad96][_0x0788('0xb')]]);if(_0x1788d1[_0x0788('0x5')]){_0x17430c={};_0x17430c[_0x1788d1[_0x0788('0x9f')]]=_0x35c612[_0x28ad96][_0x0788('0xc')];_0x4fb7f7[_0x0788('0x8e')](_0x17430c);}else{if(!_0x3baf23[_0x0788('0x7e')]['id'])_0x3baf23[_0x0788('0x7e')]['id']=[];_0x35c612[_0x28ad96][_0x0788('0xc')]['forEach'](function(_0x36ebc1){_0x3baf23[_0x0788('0x7e')]['id'][_0x0788('0x8e')](_0x36ebc1);});}}}if(!_[_0x0788('0x87')](_0x4fb7f7)){_0x3baf23['where']=_['merge'](_0x3baf23[_0x0788('0x7e')],{'$and':{'$or':_0x4fb7f7}});}_0x3baf23=_[_0x0788('0x9c')]({},_0x3baf23,_0x47f22c['options']);if(_0x2272e2&&!_0x2272e2[_0x0788('0x8f')]&&_0x59a436[_0x0788('0x13')]===_0x0788('0xd')){if(_0x47f22c['query']['includeAll']){_0x3baf23[_0x0788('0xa0')]=[{'all':!![]}];}return _0x446ded[_0x59a436[_0x0788('0x13')]]['findAll'](_0x3baf23)['then'](function(_0x4ace43){var _0x17ea6a=[];_0x4ace43[_0x0788('0xa1')](function(_0x59260c){var _0x1827e4;switch(_0x59260c[_0x0788('0xa2')]){case _0x0788('0xa3'):_0x1827e4=_[_0x0788('0x8d')](_0x2272e2[_0x0788('0xc')],function(_0x4864f5){return _0x4864f5['id']===_0x59260c[_0x0788('0x72')]&&_0x4864f5['type']===_0x0788('0xa4');});break;case'custom':_0x1827e4=_[_0x0788('0x8d')](_0x2272e2[_0x0788('0xc')],function(_0xbf1276){return _0xbf1276['id']===_0x59260c[_0x0788('0x72')]&&_0xbf1276[_0x0788('0xf')]===_0x0788('0xa5');});break;}if(_0x1827e4)_0x17ea6a[_0x0788('0x8e')](_0x59260c);});_0xdc7103[_0x0788('0xa6')]=_0x17ea6a[_0x0788('0x88')];_0xdc7103[_0x0788('0xa7')]=_0x17ea6a;return _0xdc7103;});}else{return _0x446ded[_0x59a436[_0x0788('0x13')]][_0x0788('0xa6')]({'where':_0x3baf23[_0x0788('0x7e')]})['then'](function(_0x55fe55){_0xdc7103['count']=_0x55fe55;if(_0x47f22c[_0x0788('0x80')][_0x0788('0xa8')]){if(_0x59a436[_0x0788('0x13')]===_0x0788('0xa9')){_0x3baf23[_0x0788('0xa0')]=[{'model':_0x446ded[_0x0788('0x66')],'as':_0x0788('0xaa'),'attributes':['id',_0x0788('0xb'),_0x0788('0xab')],'required':_0x47f22c[_0x0788('0x80')][_0x0788('0xac')]?!![]:![]},{'model':_0x446ded['Tag'],'as':'ThroughTags','attributes':['id',_0x0788('0xb'),_0x0788('0xab')],'through':_0x47f22c[_0x0788('0x80')][_0x0788('0xac')]?{'attributes':[],'where':{'TagId':_0x47f22c[_0x0788('0x80')][_0x0788('0xac')]||undefined}}:{},'required':_0x47f22c[_0x0788('0x80')][_0x0788('0xac')]?!![]:![]}];}else{_0x3baf23['include']=[{'all':!![]}];}}return _0x446ded[_0x59a436['childModel']][_0x0788('0x6')](_0x3baf23);})[_0x0788('0xa')](function(_0x285972){_0xdc7103[_0x0788('0xa7')]=_0x285972;if(_0x150403===_0x0788('0x2e')&&_0x47f22c[_0x0788('0x80')]['openTabs']===_0x0788('0xad')){var _0x1311d7=[];for(var _0x3ca412=0x0;_0x3ca412<_0xdc7103[_0x0788('0xa7')][_0x0788('0x88')];_0x3ca412++){_0x1311d7[_0x0788('0x8e')](_0x4c08f9(_0x0788('0xae'),_0xdc7103[_0x0788('0xa7')][_0x3ca412][_0x0788('0xaf')]));_0x1311d7['push'](_0x4c08f9(_0x0788('0xb0'),_0xdc7103[_0x0788('0xa7')][_0x3ca412][_0x0788('0xaf')]));_0x1311d7[_0x0788('0x8e')](_0x4c08f9(_0x0788('0xb1'),_0xdc7103[_0x0788('0xa7')][_0x3ca412]['dataValues']));_0x1311d7[_0x0788('0x8e')](_0x4c08f9(_0x0788('0xb2'),_0xdc7103[_0x0788('0xa7')][_0x3ca412][_0x0788('0xaf')]));_0x1311d7[_0x0788('0x8e')](_0x4c08f9(_0x0788('0xb3'),_0xdc7103[_0x0788('0xa7')][_0x3ca412][_0x0788('0xaf')]));_0x1311d7[_0x0788('0x8e')](_0x4c08f9(_0x0788('0xb4'),_0xdc7103['rows'][_0x3ca412][_0x0788('0xaf')]));}return Promise['all'](_0x1311d7)[_0x0788('0xa')](function(){return _0xdc7103;});}return _0xdc7103;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 8933930..aa8e54d 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 _0xa3eb=['./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0xa3eb,0x1ed));var _0xba3e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa3eb[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xba3e('0x0'));var util=require(_0xba3e('0x1'));var moment=require(_0xba3e('0x2'));var BPromise=require('bluebird');var rs=require(_0xba3e('0x3'));var fs=require('fs');var Redis=require(_0xba3e('0x4'));var db=require(_0xba3e('0x5'))['db'];var utils=require(_0xba3e('0x6'));var logger=require(_0xba3e('0x7'))(_0xba3e('0x8'));var config=require(_0xba3e('0x9'));var jayson=require(_0xba3e('0xa'));var client=jayson[_0xba3e('0xb')][_0xba3e('0xc')]({'port':0x232a});config[_0xba3e('0xd')]=_[_0xba3e('0xe')](config[_0xba3e('0xd')],{'host':_0xba3e('0xf'),'port':0x18eb});var socket=require(_0xba3e('0x10'))(new Redis(config[_0xba3e('0xd')]));require(_0xba3e('0x11'))[_0xba3e('0x12')](socket);function respondWithRpcPromise(_0x307c74,_0x49e6da,_0xbf982b){return new BPromise(function(_0x400389,_0x132dde){return client['request'](_0x307c74,_0xbf982b)[_0xba3e('0x13')](function(_0x1dd004){logger[_0xba3e('0x14')](_0xba3e('0x15'),_0x49e6da,_0xba3e('0x16'));logger[_0xba3e('0x17')](_0xba3e('0x18'),_0x49e6da,_0xba3e('0x16'),JSON['stringify'](_0x1dd004));if(_0x1dd004['error']){if(_0x1dd004[_0xba3e('0x19')][_0xba3e('0x1a')]===0x1f4){logger[_0xba3e('0x19')]('UserProfile,\x20%s,\x20%s',_0x49e6da,_0x1dd004[_0xba3e('0x19')][_0xba3e('0x1b')]);return _0x132dde(_0x1dd004['error'][_0xba3e('0x1b')]);}logger[_0xba3e('0x19')](_0xba3e('0x15'),_0x49e6da,_0x1dd004['error']['message']);return _0x400389(_0x1dd004[_0xba3e('0x19')]['message']);}else{logger[_0xba3e('0x14')](_0xba3e('0x15'),_0x49e6da,_0xba3e('0x16'));_0x400389(_0x1dd004[_0xba3e('0x1c')][_0xba3e('0x1b')]);}})[_0xba3e('0x1d')](function(_0xca91){logger[_0xba3e('0x19')]('UserProfile,\x20%s,\x20%s',_0x49e6da,_0xca91);_0x132dde(_0xca91);});});} \ No newline at end of file +var _0x8b8e=['error','code','message','result','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3e9402,_0x130b9e){var _0x1f5996=function(_0x5ad15c){while(--_0x5ad15c){_0x3e9402['push'](_0x3e9402['shift']());}};_0x1f5996(++_0x130b9e);}(_0x8b8e,0x108));var _0xe8b8=function(_0xca1e74,_0x5a438d){_0xca1e74=_0xca1e74-0x0;var _0x32d8ca=_0x8b8e[_0xca1e74];return _0x32d8ca;};'use strict';var _=require(_0xe8b8('0x0'));var util=require('util');var moment=require(_0xe8b8('0x1'));var BPromise=require('bluebird');var rs=require(_0xe8b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe8b8('0x3'));var logger=require(_0xe8b8('0x4'))(_0xe8b8('0x5'));var config=require(_0xe8b8('0x6'));var jayson=require(_0xe8b8('0x7'));var client=jayson[_0xe8b8('0x8')][_0xe8b8('0x9')]({'port':0x232a});config[_0xe8b8('0xa')]=_[_0xe8b8('0xb')](config[_0xe8b8('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe8b8('0xc'))(new Redis(config['redis']));require(_0xe8b8('0xd'))['register'](socket);function respondWithRpcPromise(_0x48b59f,_0x2ccbeb,_0xcf1e01){return new BPromise(function(_0x568241,_0x54eb14){return client[_0xe8b8('0xe')](_0x48b59f,_0xcf1e01)[_0xe8b8('0xf')](function(_0x886a64){logger[_0xe8b8('0x10')](_0xe8b8('0x11'),_0x2ccbeb,_0xe8b8('0x12'));logger[_0xe8b8('0x13')](_0xe8b8('0x14'),_0x2ccbeb,_0xe8b8('0x12'),JSON[_0xe8b8('0x15')](_0x886a64));if(_0x886a64[_0xe8b8('0x16')]){if(_0x886a64[_0xe8b8('0x16')][_0xe8b8('0x17')]===0x1f4){logger[_0xe8b8('0x16')]('UserProfile,\x20%s,\x20%s',_0x2ccbeb,_0x886a64[_0xe8b8('0x16')]['message']);return _0x54eb14(_0x886a64[_0xe8b8('0x16')][_0xe8b8('0x18')]);}logger[_0xe8b8('0x16')](_0xe8b8('0x11'),_0x2ccbeb,_0x886a64[_0xe8b8('0x16')][_0xe8b8('0x18')]);return _0x568241(_0x886a64[_0xe8b8('0x16')][_0xe8b8('0x18')]);}else{logger[_0xe8b8('0x10')](_0xe8b8('0x11'),_0x2ccbeb,'request\x20sent');_0x568241(_0x886a64[_0xe8b8('0x19')][_0xe8b8('0x18')]);}})['catch'](function(_0x35b573){logger[_0xe8b8('0x16')](_0xe8b8('0x11'),_0x2ccbeb,_0x35b573);_0x54eb14(_0x35b573);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index b91a71c..ebb9aaf 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 _0xfd68=['removeListener','length','userProfile:','save','remove','emit'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfd68,0xf9));var _0x8fd6=function(_0x124317,_0x113ad5){_0x124317=_0x124317-0x0;var _0x4a9924=_0xfd68[_0x124317];return _0x4a9924;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x8fd6('0x0'),_0x8fd6('0x1'),'update'];function createListener(_0x1641b9,_0x1b0c12){return function(_0x19bb25){_0x1b0c12[_0x8fd6('0x2')](_0x1641b9,_0x19bb25);};}function removeListener(_0x541b34,_0x4599f9){return function(){UserProfileEvents[_0x8fd6('0x3')](_0x541b34,_0x4599f9);};}exports['register']=function(_0x99d426){for(var _0x249655=0x0,_0x238349=events[_0x8fd6('0x4')];_0x249655<_0x238349;_0x249655++){var _0x1d59ed=events[_0x249655];var _0x32d793=createListener(_0x8fd6('0x5')+_0x1d59ed,_0x99d426);UserProfileEvents['on'](_0x1d59ed,_0x32d793);}}; \ No newline at end of file +var _0x4ead=['emit','removeListener','./userProfile.events','save'];(function(_0x48b4f9,_0xbbe897){var _0x30dda9=function(_0xddc3b6){while(--_0xddc3b6){_0x48b4f9['push'](_0x48b4f9['shift']());}};_0x30dda9(++_0xbbe897);}(_0x4ead,0xda));var _0xd4ea=function(_0x58ee19,_0xdf0765){_0x58ee19=_0x58ee19-0x0;var _0x49af25=_0x4ead[_0x58ee19];return _0x49af25;};'use strict';var UserProfileEvents=require(_0xd4ea('0x0'));var events=[_0xd4ea('0x1'),'remove','update'];function createListener(_0x12be93,_0x3022f2){return function(_0x300064){_0x3022f2[_0xd4ea('0x2')](_0x12be93,_0x300064);};}function removeListener(_0x5cc48d,_0x33a0a1){return function(){UserProfileEvents[_0xd4ea('0x3')](_0x5cc48d,_0x33a0a1);};}exports['register']=function(_0x5d9c85){for(var _0x13ead8=0x0,_0x3e3222=events['length'];_0x13ead8<_0x3e3222;_0x13ead8++){var _0x2e9441=events[_0x13ead8];var _0x233cd4=createListener('userProfile:'+_0x2e9441,_0x5d9c85);UserProfileEvents['on'](_0x2e9441,_0x233cd4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 8f94d7d..e9f349a 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 _0xe1e2=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put'];(function(_0xc7e53b,_0x5900b5){var _0x16b648=function(_0x18ee3d){while(--_0x18ee3d){_0xc7e53b['push'](_0xc7e53b['shift']());}};_0x16b648(++_0x5900b5);}(_0xe1e2,0x1e7));var _0x2e1e=function(_0x546261,_0x44b70f){_0x546261=_0x546261-0x0;var _0x1c6263=_0xe1e2[_0x546261];return _0x1c6263;};'use strict';var multer=require(_0x2e1e('0x0'));var util=require(_0x2e1e('0x1'));var path=require(_0x2e1e('0x2'));var timeout=require(_0x2e1e('0x3'));var express=require(_0x2e1e('0x4'));var router=express[_0x2e1e('0x5')]();var fs_extra=require(_0x2e1e('0x6'));var auth=require(_0x2e1e('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2e1e('0x8'));router[_0x2e1e('0x9')]('/',auth['isAuthenticated'](),controller[_0x2e1e('0xa')]);router[_0x2e1e('0x9')](_0x2e1e('0xb'),auth[_0x2e1e('0xc')](),controller[_0x2e1e('0xd')]);router[_0x2e1e('0x9')](_0x2e1e('0xe'),auth[_0x2e1e('0xc')](),controller['show']);router['post']('/',auth[_0x2e1e('0xc')](),controller[_0x2e1e('0xf')]);router[_0x2e1e('0x10')](_0x2e1e('0xe'),auth[_0x2e1e('0xc')](),controller[_0x2e1e('0x11')]);router[_0x2e1e('0x12')](_0x2e1e('0xe'),auth['isAuthenticated'](),controller[_0x2e1e('0x13')]);module[_0x2e1e('0x14')]=router; \ No newline at end of file +var _0x61ac=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x51e206,_0x49aeb4){var _0x436147=function(_0x24517f){while(--_0x24517f){_0x51e206['push'](_0x51e206['shift']());}};_0x436147(++_0x49aeb4);}(_0x61ac,0x19f));var _0xc61a=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x61ac[_0x257642];return _0x3d813b;};'use strict';var multer=require('multer');var util=require(_0xc61a('0x0'));var path=require(_0xc61a('0x1'));var timeout=require(_0xc61a('0x2'));var express=require(_0xc61a('0x3'));var router=express[_0xc61a('0x4')]();var fs_extra=require(_0xc61a('0x5'));var auth=require(_0xc61a('0x6'));var interaction=require(_0xc61a('0x7'));var config=require(_0xc61a('0x8'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xc61a('0x9')](),controller[_0xc61a('0xa')]);router[_0xc61a('0xb')](_0xc61a('0xc'),auth[_0xc61a('0x9')](),controller[_0xc61a('0xd')]);router[_0xc61a('0xb')](_0xc61a('0xe'),auth[_0xc61a('0x9')](),controller[_0xc61a('0xf')]);router[_0xc61a('0x10')]('/',auth['isAuthenticated'](),controller[_0xc61a('0x11')]);router[_0xc61a('0x12')](_0xc61a('0xe'),auth['isAuthenticated'](),controller[_0xc61a('0x13')]);router[_0xc61a('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xc61a('0x15')]);module[_0xc61a('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 6f44c7d..31d9e20 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 _0xf41a=['exports','INTEGER','STRING','sequelize'];(function(_0x2e55dd,_0x8672fd){var _0x3c62f3=function(_0x4daf29){while(--_0x4daf29){_0x2e55dd['push'](_0x2e55dd['shift']());}};_0x3c62f3(++_0x8672fd);}(_0xf41a,0x11f));var _0xaf41=function(_0x4f680c,_0x292aba){_0x4f680c=_0x4f680c-0x0;var _0x5326b2=_0xf41a[_0x4f680c];return _0x5326b2;};'use strict';var Sequelize=require(_0xaf41('0x0'));module[_0xaf41('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xaf41('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xaf41('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x72e4=['STRING','INTEGER','sequelize','exports'];(function(_0x44bdcf,_0x1d2637){var _0x348167=function(_0xb184c1){while(--_0xb184c1){_0x44bdcf['push'](_0x44bdcf['shift']());}};_0x348167(++_0x1d2637);}(_0x72e4,0xf2));var _0x472e=function(_0x4f99c6,_0x2cde9a){_0x4f99c6=_0x4f99c6-0x0;var _0x4c2d92=_0x72e4[_0x4f99c6];return _0x4c2d92;};'use strict';var Sequelize=require(_0x472e('0x0'));module[_0x472e('0x1')]={'name':{'type':Sequelize[_0x472e('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x472e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x472e('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 5323056..4030d2c 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 _0x430c=['status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','describe','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0x430c,0x1a1));var _0xc430=function(_0x8854f2,_0x79542c){_0x8854f2=_0x8854f2-0x0;var _0x38505d=_0x430c[_0x8854f2];return _0x38505d;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['create']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')](_0x10db27[_0xc430('0x45')],{})['then'](respondWithResult(_0x4eafae,0xc9))[_0xc430('0x40')](handleError(_0x4eafae,null));};exports[_0xc430('0x46')]=function(_0x19e563,_0x549400){if(_0x19e563[_0xc430('0x45')]['id']){delete _0x19e563[_0xc430('0x45')]['id'];}return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x19e563[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x549400,null))[_0xc430('0x1e')](saveUpdates(_0x19e563['body'],null))[_0xc430('0x1e')](respondWithResult(_0x549400,null))[_0xc430('0x40')](handleError(_0x549400,null));};exports[_0xc430('0x1f')]=function(_0x4e9aff,_0x23cb41){return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x4e9aff[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x23cb41,null))[_0xc430('0x1e')](removeEntity(_0x23cb41,null))['catch'](handleError(_0x23cb41,null));};exports[_0xc430('0x48')]=function(_0x214954,_0x2a5143){return db[_0xc430('0x25')][_0xc430('0x48')]()[_0xc430('0x1e')](respondWithResult(_0x2a5143,null))['catch'](handleError(_0x2a5143,null));}; \ No newline at end of file +var _0x4991=['hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','UserProfileResource','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x20eacd,_0x409c31){var _0x1a1c5e=function(_0x5b4e4d){while(--_0x5b4e4d){_0x20eacd['push'](_0x20eacd['shift']());}};_0x1a1c5e(++_0x409c31);}(_0x4991,0xf7));var _0x1499=function(_0x460666,_0x24bfa0){_0x460666=_0x460666-0x0;var _0x555cbf=_0x4991[_0x460666];return _0x555cbf;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3039ce,_0x274bc1){_0x274bc1=_0x274bc1||0xcc;return function(_0x34a928){if(_0x34a928){return _0x3039ce[_0x1499('0x17')](_0x274bc1);}return _0x3039ce[_0x1499('0x18')](_0x274bc1)['end']();};}function respondWithResult(_0x5f34f2,_0x308177){_0x308177=_0x308177||0xc8;return function(_0x4e5195){if(_0x4e5195){return _0x5f34f2[_0x1499('0x18')](_0x308177)[_0x1499('0x19')](_0x4e5195);}};}function respondWithFilteredResult(_0x308318,_0x3ab605){return function(_0x48f654){if(_0x48f654){var _0x1ed43b=typeof _0x3ab605[_0x1499('0x1a')]==='undefined'&&typeof _0x3ab605[_0x1499('0x1b')]===_0x1499('0x1c');var _0x46b364=_0x48f654[_0x1499('0x1d')];var _0x1e45a9=_0x1ed43b?0x0:_0x3ab605[_0x1499('0x1a')];var _0x5b9859=_0x1ed43b?_0x48f654['count']:_0x3ab605['offset']+_0x3ab605[_0x1499('0x1b')];var _0xad534b;if(_0x5b9859>=_0x46b364){_0x5b9859=_0x46b364;_0xad534b=0xc8;}else{_0xad534b=0xce;}_0x308318['status'](_0xad534b);return _0x308318[_0x1499('0x1e')](_0x1499('0x1f'),_0x1e45a9+'-'+_0x5b9859+'/'+_0x46b364)[_0x1499('0x19')](_0x48f654);}return null;};}function patchUpdates(_0x18e4a6){return function(_0x21e887){try{jsonpatch[_0x1499('0x20')](_0x21e887,_0x18e4a6,!![]);}catch(_0x2b0458){return BPromise[_0x1499('0x21')](_0x2b0458);}return _0x21e887[_0x1499('0x22')]();};}function saveUpdates(_0x15bcd4,_0x2bb71f){return function(_0x836081){if(_0x836081){return _0x836081[_0x1499('0x23')](_0x15bcd4)[_0x1499('0x24')](function(_0x4ec57a){return _0x4ec57a;});}return null;};}function removeEntity(_0x1e2c51,_0x2c7f57){return function(_0x5615b4){if(_0x5615b4){return _0x5615b4[_0x1499('0x25')]()[_0x1499('0x24')](function(){_0x1e2c51[_0x1499('0x18')](0xcc)[_0x1499('0x26')]();});}};}function handleEntityNotFound(_0x3968e0,_0x16d036){return function(_0x54f3c2){if(!_0x54f3c2){_0x3968e0['sendStatus'](0x194);}return _0x54f3c2;};}function handleError(_0x12739b,_0x3c9aca){_0x3c9aca=_0x3c9aca||0x1f4;return function(_0x3b9259){logger[_0x1499('0x27')](_0x3b9259[_0x1499('0x28')]);if(_0x3b9259['name']){delete _0x3b9259[_0x1499('0x29')];}_0x12739b['status'](_0x3c9aca)['send'](_0x3b9259);};}exports['index']=function(_0x21d204,_0x103efa){var _0x40932a={},_0x1b460b={},_0x3dad86={'count':0x0,'rows':[]};var _0x388513=_[_0x1499('0x2a')](db['UserProfileResource'][_0x1499('0x2b')],function(_0x1a2c99){return{'name':_0x1a2c99[_0x1499('0x2c')],'type':_0x1a2c99['type'][_0x1499('0x2d')]};});_0x1b460b[_0x1499('0x2e')]=_['map'](_0x388513,_0x1499('0x29'));_0x1b460b[_0x1499('0x2f')]=_['keys'](_0x21d204[_0x1499('0x2f')]);_0x1b460b[_0x1499('0x30')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],_0x1b460b[_0x1499('0x2f')]);_0x40932a[_0x1499('0x32')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x21d204[_0x1499('0x2f')][_0x1499('0x33')]));_0x40932a[_0x1499('0x32')]=_0x40932a[_0x1499('0x32')][_0x1499('0x34')]?_0x40932a[_0x1499('0x32')]:_0x1b460b[_0x1499('0x2e')];if(!_0x21d204[_0x1499('0x2f')][_0x1499('0x35')](_0x1499('0x36'))){_0x40932a[_0x1499('0x1b')]=qs['limit'](_0x21d204[_0x1499('0x2f')][_0x1499('0x1b')]);_0x40932a[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x21d204[_0x1499('0x2f')][_0x1499('0x1a')]);}_0x40932a[_0x1499('0x37')]=qs[_0x1499('0x38')](_0x21d204[_0x1499('0x2f')][_0x1499('0x38')]);_0x40932a[_0x1499('0x39')]=qs['filters'](_['pick'](_0x21d204[_0x1499('0x2f')],_0x1b460b['filters']),_0x388513);if(_0x21d204[_0x1499('0x2f')]['filter']){_0x40932a[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x40932a[_0x1499('0x39')],{'$or':_[_0x1499('0x2a')](_0x388513,function(_0x531933){if(_0x531933[_0x1499('0x3b')]!=='VIRTUAL'){var _0x2f9c59={};_0x2f9c59[_0x531933[_0x1499('0x29')]]={'$like':'%'+_0x21d204[_0x1499('0x2f')][_0x1499('0x3c')]+'%'};return _0x2f9c59;}})});}_0x40932a=_['merge']({},_0x40932a,_0x21d204[_0x1499('0x3d')]);var _0x815a99={'where':_0x40932a[_0x1499('0x39')]};return db[_0x1499('0x3e')]['count'](_0x815a99)[_0x1499('0x24')](function(_0x4cc411){_0x3dad86[_0x1499('0x1d')]=_0x4cc411;if(_0x21d204[_0x1499('0x2f')][_0x1499('0x3f')]){_0x40932a[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x3e')][_0x1499('0x41')](_0x40932a);})[_0x1499('0x24')](function(_0xcb85eb){_0x3dad86[_0x1499('0x42')]=_0xcb85eb;return _0x3dad86;})[_0x1499('0x24')](respondWithFilteredResult(_0x103efa,_0x40932a))['catch'](handleError(_0x103efa,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x2e')]=_[_0x1499('0x45')](db[_0x1499('0x3e')][_0x1499('0x2b')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2f')]);_0x5646cf[_0x1499('0x30')]=_['intersection'](_0x5646cf[_0x1499('0x2e')],_0x5646cf[_0x1499('0x2f')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x5dd36c[_0x1499('0x2f')]['fields']));_0x1af1a1[_0x1499('0x32')]=_0x1af1a1[_0x1499('0x32')][_0x1499('0x34')]?_0x1af1a1[_0x1499('0x32')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2f')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3a')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x3e')][_0x1499('0x46')](_0x1af1a1)[_0x1499('0x24')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x47')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x3e')][_0x1499('0x47')](_0x491777[_0x1499('0x48')],{})[_0x1499('0x24')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x49')](handleError(_0x7fa101,null));};exports[_0x1499('0x23')]=function(_0x591aa8,_0x420d16){if(_0x591aa8['body']['id']){delete _0x591aa8[_0x1499('0x48')]['id'];}return db[_0x1499('0x3e')]['find']({'where':{'id':_0x591aa8[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x420d16,null))[_0x1499('0x24')](saveUpdates(_0x591aa8['body'],null))[_0x1499('0x24')](respondWithResult(_0x420d16,null))[_0x1499('0x49')](handleError(_0x420d16,null));};exports[_0x1499('0x25')]=function(_0x29ac0f,_0x305599){return db[_0x1499('0x3e')][_0x1499('0x46')]({'where':{'id':_0x29ac0f[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x305599,null))[_0x1499('0x24')](removeEntity(_0x305599,null))['catch'](handleError(_0x305599,null));};exports[_0x1499('0x4a')]=function(_0x9f0520,_0x278178){return db['UserProfileResource'][_0x1499('0x4a')]()[_0x1499('0x24')](respondWithResult(_0x278178,null))['catch'](handleError(_0x278178,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index f9d993f..66572cf 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 _0x73a7=['request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','api','moment','bluebird'];(function(_0x444f14,_0x3a5898){var _0x3acc42=function(_0xe059a4){while(--_0xe059a4){_0x444f14['push'](_0x444f14['shift']());}};_0x3acc42(++_0x3a5898);}(_0x73a7,0x9b));var _0x773a=function(_0x3018e3,_0x3fef3b){_0x3018e3=_0x3018e3-0x0;var _0x3816c0=_0x73a7[_0x3018e3];return _0x3816c0;};'use strict';var _=require(_0x773a('0x0'));var util=require(_0x773a('0x1'));var logger=require('../../config/logger')(_0x773a('0x2'));var moment=require(_0x773a('0x3'));var BPromise=require(_0x773a('0x4'));var rp=require(_0x773a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x773a('0x6'));var config=require(_0x773a('0x7'));var attributes=require(_0x773a('0x8'));module[_0x773a('0x9')]=function(_0x212344,_0x3c8d1e){return _0x212344[_0x773a('0xa')](_0x773a('0xb'),attributes,{'tableName':_0x773a('0xc'),'paranoid':![],'indexes':[{'name':_0x773a('0xd'),'fields':[_0x773a('0xe'),_0x773a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb3a0=['resourceId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','UserProfileResource','user_profile_has_resources'];(function(_0x37dc21,_0x9ca740){var _0x1d4178=function(_0x3fd65b){while(--_0x3fd65b){_0x37dc21['push'](_0x37dc21['shift']());}};_0x1d4178(++_0x9ca740);}(_0xb3a0,0xfd));var _0x0b3a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb3a0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0b3a('0x0'));var logger=require(_0x0b3a('0x1'))(_0x0b3a('0x2'));var moment=require(_0x0b3a('0x3'));var BPromise=require('bluebird');var rp=require(_0x0b3a('0x4'));var fs=require('fs');var path=require(_0x0b3a('0x5'));var rimraf=require(_0x0b3a('0x6'));var config=require(_0x0b3a('0x7'));var attributes=require('./userProfileResource.attributes');module[_0x0b3a('0x8')]=function(_0x269cc3,_0x53b916){return _0x269cc3['define'](_0x0b3a('0x9'),attributes,{'tableName':_0x0b3a('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x0b3a('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 59fcf27..2104d4f 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 _0xfe01=['request\x20sent','debug','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xfe01,0xd1));var _0x1fe0=function(_0x3be14e,_0x34e1a4){_0x3be14e=_0x3be14e-0x0;var _0x403bd1=_0xfe01[_0x3be14e];return _0x403bd1;};'use strict';var _=require(_0x1fe0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1fe0('0x1'));var rs=require(_0x1fe0('0x2'));var fs=require('fs');var Redis=require(_0x1fe0('0x3'));var db=require(_0x1fe0('0x4'))['db'];var utils=require(_0x1fe0('0x5'));var logger=require('../../config/logger')(_0x1fe0('0x6'));var config=require(_0x1fe0('0x7'));var jayson=require(_0x1fe0('0x8'));var client=jayson[_0x1fe0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4741a4,_0xf904c1,_0x14cc8d){return new BPromise(function(_0x2cc617,_0x1d8f47){return client['request'](_0x4741a4,_0x14cc8d)[_0x1fe0('0xa')](function(_0x39848f){logger['info']('UserProfileResource,\x20%s,\x20%s',_0xf904c1,_0x1fe0('0xb'));logger[_0x1fe0('0xc')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0xf904c1,_0x1fe0('0xb'),JSON[_0x1fe0('0xd')](_0x39848f));if(_0x39848f['error']){if(_0x39848f[_0x1fe0('0xe')][_0x1fe0('0xf')]===0x1f4){logger['error'](_0x1fe0('0x10'),_0xf904c1,_0x39848f['error']['message']);return _0x1d8f47(_0x39848f['error'][_0x1fe0('0x11')]);}logger[_0x1fe0('0xe')]('UserProfileResource,\x20%s,\x20%s',_0xf904c1,_0x39848f[_0x1fe0('0xe')]['message']);return _0x2cc617(_0x39848f[_0x1fe0('0xe')]['message']);}else{logger[_0x1fe0('0x12')](_0x1fe0('0x10'),_0xf904c1,_0x1fe0('0xb'));_0x2cc617(_0x39848f[_0x1fe0('0x13')][_0x1fe0('0x11')]);}})['catch'](function(_0x177eac){logger[_0x1fe0('0xe')](_0x1fe0('0x10'),_0xf904c1,_0x177eac);_0x1d8f47(_0x177eac);});});} \ No newline at end of file +var _0xb508=['request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','UserProfileResource,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info'];(function(_0x50b16c,_0x5e9cce){var _0x4e939a=function(_0x9f560){while(--_0x9f560){_0x50b16c['push'](_0x50b16c['shift']());}};_0x4e939a(++_0x5e9cce);}(_0xb508,0x8c));var _0x8b50=function(_0x5427cd,_0x59f108){_0x5427cd=_0x5427cd-0x0;var _0x49482a=_0xb508[_0x5427cd];return _0x49482a;};'use strict';var _=require(_0x8b50('0x0'));var util=require(_0x8b50('0x1'));var moment=require(_0x8b50('0x2'));var BPromise=require('bluebird');var rs=require(_0x8b50('0x3'));var fs=require('fs');var Redis=require(_0x8b50('0x4'));var db=require(_0x8b50('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b50('0x6'))(_0x8b50('0x7'));var config=require(_0x8b50('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b50('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23a3c7,_0x409890,_0x5afede){return new BPromise(function(_0x144961,_0x40d3d8){return client[_0x8b50('0xa')](_0x23a3c7,_0x5afede)['then'](function(_0xdc5444){logger[_0x8b50('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x409890,_0x8b50('0xc'));logger[_0x8b50('0xd')](_0x8b50('0xe'),_0x409890,'request\x20sent',JSON['stringify'](_0xdc5444));if(_0xdc5444['error']){if(_0xdc5444[_0x8b50('0xf')][_0x8b50('0x10')]===0x1f4){logger[_0x8b50('0xf')](_0x8b50('0x11'),_0x409890,_0xdc5444[_0x8b50('0xf')][_0x8b50('0x12')]);return _0x40d3d8(_0xdc5444[_0x8b50('0xf')]['message']);}logger[_0x8b50('0xf')](_0x8b50('0x11'),_0x409890,_0xdc5444[_0x8b50('0xf')][_0x8b50('0x12')]);return _0x144961(_0xdc5444[_0x8b50('0xf')][_0x8b50('0x12')]);}else{logger[_0x8b50('0xb')](_0x8b50('0x11'),_0x409890,'request\x20sent');_0x144961(_0xdc5444['result']['message']);}})['catch'](function(_0x7830b8){logger[_0x8b50('0xf')](_0x8b50('0x11'),_0x409890,_0x7830b8);_0x40d3d8(_0x7830b8);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 773e6bf..5121a1b 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 _0x4da2=['./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4da2,0x1ec));var _0x24da=function(_0x465bcf,_0x2b0cf3){_0x465bcf=_0x465bcf-0x0;var _0x5a58c5=_0x4da2[_0x465bcf];return _0x5a58c5;};'use strict';var multer=require(_0x24da('0x0'));var util=require(_0x24da('0x1'));var path=require(_0x24da('0x2'));var timeout=require('connect-timeout');var express=require(_0x24da('0x3'));var router=express[_0x24da('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x24da('0x5'));var interaction=require(_0x24da('0x6'));var config=require(_0x24da('0x7'));var controller=require(_0x24da('0x8'));router[_0x24da('0x9')]('/',auth[_0x24da('0xa')](),controller[_0x24da('0xb')]);router[_0x24da('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x24da('0xc')]);router[_0x24da('0x9')](_0x24da('0xd'),auth[_0x24da('0xa')](),controller['show']);router[_0x24da('0xe')]('/',auth[_0x24da('0xa')](),controller[_0x24da('0xf')]);router[_0x24da('0x10')]('/:id',auth[_0x24da('0xa')](),controller['update']);router[_0x24da('0x11')](_0x24da('0xd'),auth[_0x24da('0xa')](),controller[_0x24da('0x12')]);module[_0x24da('0x13')]=router; \ No newline at end of file +var _0xfbb2=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','/:id','update','delete','destroy','exports','util','path'];(function(_0x50ac47,_0x3c9409){var _0x4220c0=function(_0x3c41df){while(--_0x3c41df){_0x50ac47['push'](_0x50ac47['shift']());}};_0x4220c0(++_0x3c9409);}(_0xfbb2,0x1e4));var _0x2fbb=function(_0xf40d11,_0xb4dd63){_0xf40d11=_0xf40d11-0x0;var _0x2c21c8=_0xfbb2[_0xf40d11];return _0x2c21c8;};'use strict';var multer=require('multer');var util=require(_0x2fbb('0x0'));var path=require(_0x2fbb('0x1'));var timeout=require(_0x2fbb('0x2'));var express=require(_0x2fbb('0x3'));var router=express[_0x2fbb('0x4')]();var fs_extra=require(_0x2fbb('0x5'));var auth=require(_0x2fbb('0x6'));var interaction=require(_0x2fbb('0x7'));var config=require(_0x2fbb('0x8'));var controller=require(_0x2fbb('0x9'));router[_0x2fbb('0xa')]('/',auth[_0x2fbb('0xb')](),controller['index']);router['get'](_0x2fbb('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x2fbb('0xa')](_0x2fbb('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x2fbb('0xb')](),controller['create']);router['put']('/:id',auth[_0x2fbb('0xb')](),controller[_0x2fbb('0xe')]);router[_0x2fbb('0xf')](_0x2fbb('0xd'),auth[_0x2fbb('0xb')](),controller[_0x2fbb('0x10')]);module[_0x2fbb('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 5a3d14e..eaa5b8e 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 _0x5423=['getDataValue','crudPermissions','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join'];(function(_0x13b54d,_0xf6599f){var _0x3f6969=function(_0x207f95){while(--_0x207f95){_0x13b54d['push'](_0x13b54d['shift']());}};_0x3f6969(++_0xf6599f);}(_0x5423,0xe3));var _0x3542=function(_0x57527e,_0x2a993b){_0x57527e=_0x57527e-0x0;var _0x4d50e5=_0x5423[_0x57527e];return _0x4d50e5;};'use strict';var Sequelize=require(_0x3542('0x0'));module[_0x3542('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x3542('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3542('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3542('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3542('0x2')],'set':function(_0xf0835){this[_0x3542('0x5')]('crudPermissions',_0xf0835?_0xf0835[_0x3542('0x6')](''):[]);},'get':function(){return this[_0x3542('0x7')](_0x3542('0x8'))?this[_0x3542('0x7')](_0x3542('0x8'))['split'](''):[];}}}; \ No newline at end of file +var _0x84a0=['STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x84a0,0x66));var _0x084a=function(_0x42855f,_0x3c26c1){_0x42855f=_0x42855f-0x0;var _0x38511b=_0x84a0[_0x42855f];return _0x38511b;};'use strict';var Sequelize=require(_0x084a('0x0'));module[_0x084a('0x1')]={'name':{'type':Sequelize[_0x084a('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x084a('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x084a('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x084a('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x58a814){this[_0x084a('0x4')](_0x084a('0x5'),_0x58a814?_0x58a814['join'](''):[]);},'get':function(){return this[_0x084a('0x6')](_0x084a('0x5'))?this[_0x084a('0x6')](_0x084a('0x5'))[_0x084a('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 7ced660..fe7e620 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 _0xc87b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','lodash','squel','desk.js','to-csv','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','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','UserProfileSection','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe'];(function(_0x2948f5,_0x4c5c5a){var _0x58d71b=function(_0x3ddc3f){while(--_0x3ddc3f){_0x2948f5['push'](_0x2948f5['shift']());}};_0x58d71b(++_0x4c5c5a);}(_0xc87b,0x1ce));var _0xbc87=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xc87b[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0xbc87('0x0'));var rimraf=require(_0xbc87('0x1'));var zipdir=require(_0xbc87('0x2'));var jsonpatch=require(_0xbc87('0x3'));var rp=require(_0xbc87('0x4'));var moment=require(_0xbc87('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbc87('0x6'));var path=require(_0xbc87('0x7'));var sox=require(_0xbc87('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc87('0x9'));var squel=require(_0xbc87('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbc87('0xb'));var toCsv=require(_0xbc87('0xc'));var querystring=require(_0xbc87('0xd'));var Papa=require(_0xbc87('0xe'));var Redis=require(_0xbc87('0xf'));var authService=require(_0xbc87('0x10'));var qs=require(_0xbc87('0x11'));var as=require(_0xbc87('0x12'));var hardwareService=require(_0xbc87('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbc87('0x14'));var config=require(_0xbc87('0x15'));var licenseUtil=require(_0xbc87('0x16'));var db=require(_0xbc87('0x17'))['db'];function respondWithStatusCode(_0xbe3b56,_0x10ad4f){_0x10ad4f=_0x10ad4f||0xcc;return function(_0x48e53d){if(_0x48e53d){return _0xbe3b56[_0xbc87('0x18')](_0x10ad4f);}return _0xbe3b56[_0xbc87('0x19')](_0x10ad4f)[_0xbc87('0x1a')]();};}function respondWithResult(_0x2deb9c,_0x3d7905){_0x3d7905=_0x3d7905||0xc8;return function(_0x2b53a5){if(_0x2b53a5){return _0x2deb9c['status'](_0x3d7905)['json'](_0x2b53a5);}};}function respondWithFilteredResult(_0x12b7e4,_0xee73a8){return function(_0x2945b8){if(_0x2945b8){var _0x2a9cab=typeof _0xee73a8['offset']===_0xbc87('0x1b')&&typeof _0xee73a8['limit']===_0xbc87('0x1b');var _0x464c4e=_0x2945b8[_0xbc87('0x1c')];var _0x42cf12=_0x2a9cab?0x0:_0xee73a8[_0xbc87('0x1d')];var _0x3251ac=_0x2a9cab?_0x2945b8[_0xbc87('0x1c')]:_0xee73a8[_0xbc87('0x1d')]+_0xee73a8['limit'];var _0x34f081;if(_0x3251ac>=_0x464c4e){_0x3251ac=_0x464c4e;_0x34f081=0xc8;}else{_0x34f081=0xce;}_0x12b7e4[_0xbc87('0x19')](_0x34f081);return _0x12b7e4[_0xbc87('0x1e')](_0xbc87('0x1f'),_0x42cf12+'-'+_0x3251ac+'/'+_0x464c4e)[_0xbc87('0x20')](_0x2945b8);}return null;};}function patchUpdates(_0x472d32){return function(_0x3d44d8){try{jsonpatch[_0xbc87('0x21')](_0x3d44d8,_0x472d32,!![]);}catch(_0x6f99dc){return BPromise[_0xbc87('0x22')](_0x6f99dc);}return _0x3d44d8[_0xbc87('0x23')]();};}function saveUpdates(_0x36b8e1,_0x2ed90b){return function(_0x37656e){if(_0x37656e){return _0x37656e[_0xbc87('0x24')](_0x36b8e1)[_0xbc87('0x25')](function(_0x2a3677){return _0x2a3677;});}return null;};}function removeEntity(_0x44e914,_0x5138c6){return function(_0x49eac9){if(_0x49eac9){return _0x49eac9[_0xbc87('0x26')]()[_0xbc87('0x25')](function(){_0x44e914['status'](0xcc)[_0xbc87('0x1a')]();});}};}function handleEntityNotFound(_0x8d5554,_0x189161){return function(_0x4c19c5){if(!_0x4c19c5){_0x8d5554['sendStatus'](0x194);}return _0x4c19c5;};}function handleError(_0x491bdf,_0x5bd561){_0x5bd561=_0x5bd561||0x1f4;return function(_0x22b86b){logger['error'](_0x22b86b[_0xbc87('0x27')]);if(_0x22b86b[_0xbc87('0x28')]){delete _0x22b86b[_0xbc87('0x28')];}_0x491bdf[_0xbc87('0x19')](_0x5bd561)[_0xbc87('0x29')](_0x22b86b);};}exports['index']=function(_0x483227,_0x2c1fdc){var _0x35dc62={},_0xb7df60={},_0x6754c9={'count':0x0,'rows':[]};var _0x486e3b=_[_0xbc87('0x2a')](db['UserProfileSection']['rawAttributes'],function(_0x2ac61b){return{'name':_0x2ac61b[_0xbc87('0x2b')],'type':_0x2ac61b['type'][_0xbc87('0x2c')]};});_0xb7df60[_0xbc87('0x2d')]=_[_0xbc87('0x2a')](_0x486e3b,_0xbc87('0x28'));_0xb7df60[_0xbc87('0x2e')]=_[_0xbc87('0x2f')](_0x483227[_0xbc87('0x2e')]);_0xb7df60[_0xbc87('0x30')]=_[_0xbc87('0x31')](_0xb7df60[_0xbc87('0x2d')],_0xb7df60['query']);_0x35dc62['attributes']=_[_0xbc87('0x31')](_0xb7df60['model'],qs[_0xbc87('0x32')](_0x483227[_0xbc87('0x2e')][_0xbc87('0x32')]));_0x35dc62[_0xbc87('0x33')]=_0x35dc62[_0xbc87('0x33')][_0xbc87('0x34')]?_0x35dc62[_0xbc87('0x33')]:_0xb7df60[_0xbc87('0x2d')];if(!_0x483227[_0xbc87('0x2e')][_0xbc87('0x35')](_0xbc87('0x36'))){_0x35dc62[_0xbc87('0x37')]=qs[_0xbc87('0x37')](_0x483227['query'][_0xbc87('0x37')]);_0x35dc62[_0xbc87('0x1d')]=qs[_0xbc87('0x1d')](_0x483227[_0xbc87('0x2e')][_0xbc87('0x1d')]);}_0x35dc62[_0xbc87('0x38')]=qs[_0xbc87('0x39')](_0x483227['query'][_0xbc87('0x39')]);_0x35dc62[_0xbc87('0x3a')]=qs[_0xbc87('0x30')](_[_0xbc87('0x3b')](_0x483227['query'],_0xb7df60['filters']),_0x486e3b);if(_0x483227[_0xbc87('0x2e')]['filter']){_0x35dc62[_0xbc87('0x3a')]=_[_0xbc87('0x3c')](_0x35dc62[_0xbc87('0x3a')],{'$or':_['map'](_0x486e3b,function(_0x4e5061){if(_0x4e5061[_0xbc87('0x3d')]!==_0xbc87('0x3e')){var _0x18b456={};_0x18b456[_0x4e5061[_0xbc87('0x28')]]={'$like':'%'+_0x483227['query'][_0xbc87('0x3f')]+'%'};return _0x18b456;}})});}_0x35dc62=_['merge']({},_0x35dc62,_0x483227['options']);var _0x4ca118={'where':_0x35dc62[_0xbc87('0x3a')]};return db[_0xbc87('0x40')]['count'](_0x4ca118)[_0xbc87('0x25')](function(_0x4a89e9){_0x6754c9[_0xbc87('0x1c')]=_0x4a89e9;if(_0x483227['query'][_0xbc87('0x41')]){_0x35dc62[_0xbc87('0x42')]=[{'all':!![]}];}return db[_0xbc87('0x40')][_0xbc87('0x43')](_0x35dc62);})['then'](function(_0x395a6d){_0x6754c9[_0xbc87('0x44')]=_0x395a6d;return _0x6754c9;})[_0xbc87('0x25')](respondWithFilteredResult(_0x2c1fdc,_0x35dc62))[_0xbc87('0x45')](handleError(_0x2c1fdc,null));};exports[_0xbc87('0x46')]=function(_0x2c9ce5,_0x4aa5a0){var _0x2a03a5={'raw':![],'where':{'id':_0x2c9ce5[_0xbc87('0x47')]['id']}},_0x1a3dd4={};_0x1a3dd4[_0xbc87('0x2d')]=_[_0xbc87('0x2f')](db[_0xbc87('0x40')]['rawAttributes']);_0x1a3dd4[_0xbc87('0x2e')]=_['keys'](_0x2c9ce5['query']);_0x1a3dd4['filters']=_[_0xbc87('0x31')](_0x1a3dd4[_0xbc87('0x2d')],_0x1a3dd4[_0xbc87('0x2e')]);_0x2a03a5['attributes']=_[_0xbc87('0x31')](_0x1a3dd4['model'],qs[_0xbc87('0x32')](_0x2c9ce5[_0xbc87('0x2e')]['fields']));_0x2a03a5[_0xbc87('0x33')]=_0x2a03a5[_0xbc87('0x33')][_0xbc87('0x34')]?_0x2a03a5[_0xbc87('0x33')]:_0x1a3dd4[_0xbc87('0x2d')];if(_0x2c9ce5[_0xbc87('0x2e')]['includeAll']){_0x2a03a5['include']=[{'all':!![]}];}_0x2a03a5=_[_0xbc87('0x3c')]({},_0x2a03a5,_0x2c9ce5[_0xbc87('0x48')]);return db[_0xbc87('0x40')][_0xbc87('0x49')](_0x2a03a5)['then'](handleEntityNotFound(_0x4aa5a0,null))[_0xbc87('0x25')](respondWithResult(_0x4aa5a0,null))['catch'](handleError(_0x4aa5a0,null));};exports[_0xbc87('0x4a')]=function(_0x38e60e,_0x3db820){return db[_0xbc87('0x40')]['create'](_0x38e60e['body'],{})[_0xbc87('0x25')](respondWithResult(_0x3db820,0xc9))['catch'](handleError(_0x3db820,null));};exports[_0xbc87('0x24')]=function(_0x46fce6,_0x4b3ae9){if(_0x46fce6[_0xbc87('0x4b')]['id']){delete _0x46fce6[_0xbc87('0x4b')]['id'];}return db[_0xbc87('0x40')][_0xbc87('0x49')]({'where':{'id':_0x46fce6[_0xbc87('0x47')]['id']}})[_0xbc87('0x25')](handleEntityNotFound(_0x4b3ae9,null))[_0xbc87('0x25')](saveUpdates(_0x46fce6[_0xbc87('0x4b')],null))[_0xbc87('0x25')](respondWithResult(_0x4b3ae9,null))['catch'](handleError(_0x4b3ae9,null));};exports[_0xbc87('0x26')]=function(_0x38c354,_0x5594ec){return db[_0xbc87('0x40')][_0xbc87('0x49')]({'where':{'id':_0x38c354['params']['id']}})['then'](handleEntityNotFound(_0x5594ec,null))[_0xbc87('0x25')](removeEntity(_0x5594ec,null))['catch'](handleError(_0x5594ec,null));};exports[_0xbc87('0x4c')]=function(_0x4f9c02,_0x422be9){return db['UserProfileSection'][_0xbc87('0x4c')]()['then'](respondWithResult(_0x422be9,null))['catch'](handleError(_0x422be9,null));}; \ No newline at end of file +var _0xbc90=['params','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch'];(function(_0x1ddcbc,_0x4e1a62){var _0x1e0014=function(_0x5e67bf){while(--_0x5e67bf){_0x1ddcbc['push'](_0x1ddcbc['shift']());}};_0x1e0014(++_0x4e1a62);}(_0xbc90,0xa1));var _0x0bc9=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xbc90[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require(_0x0bc9('0x0'));var rimraf=require(_0x0bc9('0x1'));var zipdir=require(_0x0bc9('0x2'));var jsonpatch=require(_0x0bc9('0x3'));var rp=require(_0x0bc9('0x4'));var moment=require(_0x0bc9('0x5'));var BPromise=require(_0x0bc9('0x6'));var Mustache=require(_0x0bc9('0x7'));var util=require(_0x0bc9('0x8'));var path=require(_0x0bc9('0x9'));var sox=require('sox');var csv=require(_0x0bc9('0xa'));var ejs=require(_0x0bc9('0xb'));var fs=require('fs');var fs_extra=require(_0x0bc9('0xc'));var _=require(_0x0bc9('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0bc9('0xe'));var deskjs=require(_0x0bc9('0xf'));var toCsv=require(_0x0bc9('0xa'));var querystring=require(_0x0bc9('0x10'));var Papa=require(_0x0bc9('0x11'));var Redis=require('ioredis');var authService=require(_0x0bc9('0x12'));var qs=require(_0x0bc9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bc9('0x14'));var logger=require(_0x0bc9('0x15'))(_0x0bc9('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0bc9('0x17'));var db=require(_0x0bc9('0x18'))['db'];function respondWithStatusCode(_0x518a0a,_0x1e9c8f){_0x1e9c8f=_0x1e9c8f||0xcc;return function(_0xe394eb){if(_0xe394eb){return _0x518a0a[_0x0bc9('0x19')](_0x1e9c8f);}return _0x518a0a[_0x0bc9('0x1a')](_0x1e9c8f)['end']();};}function respondWithResult(_0x1b3f74,_0x4c47d6){_0x4c47d6=_0x4c47d6||0xc8;return function(_0x5b3b4f){if(_0x5b3b4f){return _0x1b3f74['status'](_0x4c47d6)[_0x0bc9('0x1b')](_0x5b3b4f);}};}function respondWithFilteredResult(_0x44b61a,_0x188e1c){return function(_0x193356){if(_0x193356){var _0x2e3439=typeof _0x188e1c[_0x0bc9('0x1c')]===_0x0bc9('0x1d')&&typeof _0x188e1c[_0x0bc9('0x1e')]===_0x0bc9('0x1d');var _0x3dfc33=_0x193356[_0x0bc9('0x1f')];var _0x467d9a=_0x2e3439?0x0:_0x188e1c['offset'];var _0x5ec671=_0x2e3439?_0x193356[_0x0bc9('0x1f')]:_0x188e1c[_0x0bc9('0x1c')]+_0x188e1c[_0x0bc9('0x1e')];var _0x30e38b;if(_0x5ec671>=_0x3dfc33){_0x5ec671=_0x3dfc33;_0x30e38b=0xc8;}else{_0x30e38b=0xce;}_0x44b61a[_0x0bc9('0x1a')](_0x30e38b);return _0x44b61a[_0x0bc9('0x20')](_0x0bc9('0x21'),_0x467d9a+'-'+_0x5ec671+'/'+_0x3dfc33)[_0x0bc9('0x1b')](_0x193356);}return null;};}function patchUpdates(_0x575d40){return function(_0x2fbb6d){try{jsonpatch[_0x0bc9('0x22')](_0x2fbb6d,_0x575d40,!![]);}catch(_0x5708e3){return BPromise[_0x0bc9('0x23')](_0x5708e3);}return _0x2fbb6d[_0x0bc9('0x24')]();};}function saveUpdates(_0x32b2a8,_0x4e39c6){return function(_0x478ddd){if(_0x478ddd){return _0x478ddd[_0x0bc9('0x25')](_0x32b2a8)[_0x0bc9('0x26')](function(_0xe5dbd6){return _0xe5dbd6;});}return null;};}function removeEntity(_0x1a1171,_0x40be07){return function(_0x4e9c50){if(_0x4e9c50){return _0x4e9c50['destroy']()[_0x0bc9('0x26')](function(){_0x1a1171[_0x0bc9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x418795,_0x38322b){return function(_0x54b4bf){if(!_0x54b4bf){_0x418795[_0x0bc9('0x19')](0x194);}return _0x54b4bf;};}function handleError(_0x4700a2,_0x3c129f){_0x3c129f=_0x3c129f||0x1f4;return function(_0x209485){logger[_0x0bc9('0x27')](_0x209485[_0x0bc9('0x28')]);if(_0x209485['name']){delete _0x209485[_0x0bc9('0x29')];}_0x4700a2[_0x0bc9('0x1a')](_0x3c129f)[_0x0bc9('0x2a')](_0x209485);};}exports[_0x0bc9('0x2b')]=function(_0x44b035,_0x3c2260){var _0x1d92bf={},_0x4b277b={},_0x27b349={'count':0x0,'rows':[]};var _0x48960e=_[_0x0bc9('0x2c')](db[_0x0bc9('0x2d')][_0x0bc9('0x2e')],function(_0x24cb68){return{'name':_0x24cb68[_0x0bc9('0x2f')],'type':_0x24cb68[_0x0bc9('0x30')][_0x0bc9('0x31')]};});_0x4b277b['model']=_['map'](_0x48960e,_0x0bc9('0x29'));_0x4b277b[_0x0bc9('0x32')]=_[_0x0bc9('0x33')](_0x44b035[_0x0bc9('0x32')]);_0x4b277b[_0x0bc9('0x34')]=_[_0x0bc9('0x35')](_0x4b277b[_0x0bc9('0x36')],_0x4b277b['query']);_0x1d92bf[_0x0bc9('0x37')]=_[_0x0bc9('0x35')](_0x4b277b['model'],qs[_0x0bc9('0x38')](_0x44b035[_0x0bc9('0x32')][_0x0bc9('0x38')]));_0x1d92bf[_0x0bc9('0x37')]=_0x1d92bf[_0x0bc9('0x37')][_0x0bc9('0x39')]?_0x1d92bf[_0x0bc9('0x37')]:_0x4b277b[_0x0bc9('0x36')];if(!_0x44b035[_0x0bc9('0x32')]['hasOwnProperty'](_0x0bc9('0x3a'))){_0x1d92bf['limit']=qs[_0x0bc9('0x1e')](_0x44b035[_0x0bc9('0x32')][_0x0bc9('0x1e')]);_0x1d92bf[_0x0bc9('0x1c')]=qs[_0x0bc9('0x1c')](_0x44b035[_0x0bc9('0x32')][_0x0bc9('0x1c')]);}_0x1d92bf['order']=qs['sort'](_0x44b035[_0x0bc9('0x32')][_0x0bc9('0x3b')]);_0x1d92bf[_0x0bc9('0x3c')]=qs[_0x0bc9('0x34')](_[_0x0bc9('0x3d')](_0x44b035[_0x0bc9('0x32')],_0x4b277b[_0x0bc9('0x34')]),_0x48960e);if(_0x44b035[_0x0bc9('0x32')][_0x0bc9('0x3e')]){_0x1d92bf[_0x0bc9('0x3c')]=_['merge'](_0x1d92bf['where'],{'$or':_[_0x0bc9('0x2c')](_0x48960e,function(_0xd0b4e3){if(_0xd0b4e3[_0x0bc9('0x30')]!==_0x0bc9('0x3f')){var _0x55fe09={};_0x55fe09[_0xd0b4e3[_0x0bc9('0x29')]]={'$like':'%'+_0x44b035[_0x0bc9('0x32')]['filter']+'%'};return _0x55fe09;}})});}_0x1d92bf=_[_0x0bc9('0x40')]({},_0x1d92bf,_0x44b035['options']);var _0x570583={'where':_0x1d92bf[_0x0bc9('0x3c')]};return db[_0x0bc9('0x2d')][_0x0bc9('0x1f')](_0x570583)[_0x0bc9('0x26')](function(_0x468d81){_0x27b349['count']=_0x468d81;if(_0x44b035[_0x0bc9('0x32')][_0x0bc9('0x41')]){_0x1d92bf[_0x0bc9('0x42')]=[{'all':!![]}];}return db['UserProfileSection'][_0x0bc9('0x43')](_0x1d92bf);})[_0x0bc9('0x26')](function(_0x4d161c){_0x27b349[_0x0bc9('0x44')]=_0x4d161c;return _0x27b349;})[_0x0bc9('0x26')](respondWithFilteredResult(_0x3c2260,_0x1d92bf))[_0x0bc9('0x45')](handleError(_0x3c2260,null));};exports['show']=function(_0x14c3d7,_0x21cf2a){var _0x2f2906={'raw':![],'where':{'id':_0x14c3d7[_0x0bc9('0x46')]['id']}},_0x2881ea={};_0x2881ea[_0x0bc9('0x36')]=_[_0x0bc9('0x33')](db[_0x0bc9('0x2d')][_0x0bc9('0x2e')]);_0x2881ea[_0x0bc9('0x32')]=_['keys'](_0x14c3d7[_0x0bc9('0x32')]);_0x2881ea[_0x0bc9('0x34')]=_[_0x0bc9('0x35')](_0x2881ea['model'],_0x2881ea[_0x0bc9('0x32')]);_0x2f2906[_0x0bc9('0x37')]=_[_0x0bc9('0x35')](_0x2881ea['model'],qs[_0x0bc9('0x38')](_0x14c3d7[_0x0bc9('0x32')][_0x0bc9('0x38')]));_0x2f2906[_0x0bc9('0x37')]=_0x2f2906['attributes'][_0x0bc9('0x39')]?_0x2f2906['attributes']:_0x2881ea[_0x0bc9('0x36')];if(_0x14c3d7[_0x0bc9('0x32')][_0x0bc9('0x41')]){_0x2f2906['include']=[{'all':!![]}];}_0x2f2906=_['merge']({},_0x2f2906,_0x14c3d7[_0x0bc9('0x47')]);return db[_0x0bc9('0x2d')][_0x0bc9('0x48')](_0x2f2906)['then'](handleEntityNotFound(_0x21cf2a,null))['then'](respondWithResult(_0x21cf2a,null))[_0x0bc9('0x45')](handleError(_0x21cf2a,null));};exports[_0x0bc9('0x49')]=function(_0x33fd86,_0x4d9dc1){return db[_0x0bc9('0x2d')]['create'](_0x33fd86[_0x0bc9('0x4a')],{})[_0x0bc9('0x26')](respondWithResult(_0x4d9dc1,0xc9))[_0x0bc9('0x45')](handleError(_0x4d9dc1,null));};exports[_0x0bc9('0x25')]=function(_0x5aebd0,_0x32e83e){if(_0x5aebd0[_0x0bc9('0x4a')]['id']){delete _0x5aebd0['body']['id'];}return db[_0x0bc9('0x2d')]['find']({'where':{'id':_0x5aebd0[_0x0bc9('0x46')]['id']}})[_0x0bc9('0x26')](handleEntityNotFound(_0x32e83e,null))[_0x0bc9('0x26')](saveUpdates(_0x5aebd0[_0x0bc9('0x4a')],null))[_0x0bc9('0x26')](respondWithResult(_0x32e83e,null))['catch'](handleError(_0x32e83e,null));};exports[_0x0bc9('0x4b')]=function(_0x36fce0,_0x233b22){return db['UserProfileSection'][_0x0bc9('0x48')]({'where':{'id':_0x36fce0[_0x0bc9('0x46')]['id']}})[_0x0bc9('0x26')](handleEntityNotFound(_0x233b22,null))[_0x0bc9('0x26')](removeEntity(_0x233b22,null))[_0x0bc9('0x45')](handleError(_0x233b22,null));};exports[_0x0bc9('0x4c')]=function(_0x218a8b,_0x24af88){return db[_0x0bc9('0x2d')]['describe']()['then'](respondWithResult(_0x24af88,null))['catch'](handleError(_0x24af88,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 30d3149..e120cab 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 _0x961f=['../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','userProfileId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x961f,0x186));var _0xf961=function(_0x56a1f0,_0x211471){_0x56a1f0=_0x56a1f0-0x0;var _0xc48f6=_0x961f[_0x56a1f0];return _0xc48f6;};'use strict';var _=require(_0xf961('0x0'));var util=require(_0xf961('0x1'));var logger=require('../../config/logger')(_0xf961('0x2'));var moment=require(_0xf961('0x3'));var BPromise=require(_0xf961('0x4'));var rp=require(_0xf961('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf961('0x6'));var attributes=require(_0xf961('0x7'));module['exports']=function(_0x5ebe4b,_0x164a79){return _0x5ebe4b[_0xf961('0x8')](_0xf961('0x9'),attributes,{'tableName':_0xf961('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0xf961('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x46cb=['user_profile_has_sections','compositeIndex','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','define'];(function(_0x1efa06,_0x46a15a){var _0x3efede=function(_0x15b95c){while(--_0x15b95c){_0x1efa06['push'](_0x1efa06['shift']());}};_0x3efede(++_0x46a15a);}(_0x46cb,0x84));var _0xb46c=function(_0x2109a8,_0x3a7797){_0x2109a8=_0x2109a8-0x0;var _0x522094=_0x46cb[_0x2109a8];return _0x522094;};'use strict';var _=require(_0xb46c('0x0'));var util=require(_0xb46c('0x1'));var logger=require(_0xb46c('0x2'))(_0xb46c('0x3'));var moment=require('moment');var BPromise=require(_0xb46c('0x4'));var rp=require(_0xb46c('0x5'));var fs=require('fs');var path=require(_0xb46c('0x6'));var rimraf=require(_0xb46c('0x7'));var config=require('../../config/environment');var attributes=require(_0xb46c('0x8'));module[_0xb46c('0x9')]=function(_0x3a2fa2,_0x53bb7c){return _0x3a2fa2[_0xb46c('0xa')]('UserProfileSection',attributes,{'tableName':_0xb46c('0xb'),'paranoid':![],'indexes':[{'name':_0xb46c('0xc'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 560e3c9..092b9f0 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 _0x07bf=['then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x17f025,_0x8b8e2b){var _0x1befb1=function(_0x1f32aa){while(--_0x1f32aa){_0x17f025['push'](_0x17f025['shift']());}};_0x1befb1(++_0x8b8e2b);}(_0x07bf,0x1ed));var _0xf07b=function(_0x4e65ba,_0x13821d){_0x4e65ba=_0x4e65ba-0x0;var _0x33581b=_0x07bf[_0x4e65ba];return _0x33581b;};'use strict';var _=require(_0xf07b('0x0'));var util=require(_0xf07b('0x1'));var moment=require(_0xf07b('0x2'));var BPromise=require(_0xf07b('0x3'));var rs=require(_0xf07b('0x4'));var fs=require('fs');var Redis=require(_0xf07b('0x5'));var db=require(_0xf07b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf07b('0x7'))(_0xf07b('0x8'));var config=require(_0xf07b('0x9'));var jayson=require(_0xf07b('0xa'));var client=jayson[_0xf07b('0xb')][_0xf07b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f8a2d,_0x59cca0,_0x2b233c){return new BPromise(function(_0x506145,_0x44d40d){return client['request'](_0x2f8a2d,_0x2b233c)[_0xf07b('0xd')](function(_0xbdfa3a){logger[_0xf07b('0xe')](_0xf07b('0xf'),_0x59cca0,'request\x20sent');logger[_0xf07b('0x10')](_0xf07b('0x11'),_0x59cca0,'request\x20sent',JSON[_0xf07b('0x12')](_0xbdfa3a));if(_0xbdfa3a[_0xf07b('0x13')]){if(_0xbdfa3a['error'][_0xf07b('0x14')]===0x1f4){logger['error'](_0xf07b('0xf'),_0x59cca0,_0xbdfa3a[_0xf07b('0x13')][_0xf07b('0x15')]);return _0x44d40d(_0xbdfa3a[_0xf07b('0x13')][_0xf07b('0x15')]);}logger[_0xf07b('0x13')](_0xf07b('0xf'),_0x59cca0,_0xbdfa3a[_0xf07b('0x13')][_0xf07b('0x15')]);return _0x506145(_0xbdfa3a[_0xf07b('0x13')][_0xf07b('0x15')]);}else{logger[_0xf07b('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x59cca0,'request\x20sent');_0x506145(_0xbdfa3a['result'][_0xf07b('0x15')]);}})[_0xf07b('0x16')](function(_0x253182){logger[_0xf07b('0x13')](_0xf07b('0xf'),_0x59cca0,_0x253182);_0x44d40d(_0x253182);});});} \ No newline at end of file +var _0x7243=['jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4edaf1,_0x3c0639){var _0x4c4a2a=function(_0xc7556b){while(--_0xc7556b){_0x4edaf1['push'](_0x4edaf1['shift']());}};_0x4c4a2a(++_0x3c0639);}(_0x7243,0x7d));var _0x3724=function(_0xe5a394,_0x460b17){_0xe5a394=_0xe5a394-0x0;var _0x2e0398=_0x7243[_0xe5a394];return _0x2e0398;};'use strict';var _=require('lodash');var util=require(_0x3724('0x0'));var moment=require(_0x3724('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3724('0x2'));var db=require(_0x3724('0x3'))['db'];var utils=require(_0x3724('0x4'));var logger=require(_0x3724('0x5'))(_0x3724('0x6'));var config=require('../../config/environment');var jayson=require(_0x3724('0x7'));var client=jayson[_0x3724('0x8')][_0x3724('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6c74cb,_0x2b43f3,_0x218d39){return new BPromise(function(_0x5457ba,_0x2d2931){return client[_0x3724('0xa')](_0x6c74cb,_0x218d39)[_0x3724('0xb')](function(_0x8f8d9b){logger[_0x3724('0xc')](_0x3724('0xd'),_0x2b43f3,_0x3724('0xe'));logger[_0x3724('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2b43f3,_0x3724('0xe'),JSON[_0x3724('0x10')](_0x8f8d9b));if(_0x8f8d9b[_0x3724('0x11')]){if(_0x8f8d9b[_0x3724('0x11')][_0x3724('0x12')]===0x1f4){logger[_0x3724('0x11')](_0x3724('0xd'),_0x2b43f3,_0x8f8d9b[_0x3724('0x11')][_0x3724('0x13')]);return _0x2d2931(_0x8f8d9b[_0x3724('0x11')]['message']);}logger['error'](_0x3724('0xd'),_0x2b43f3,_0x8f8d9b['error']['message']);return _0x5457ba(_0x8f8d9b[_0x3724('0x11')][_0x3724('0x13')]);}else{logger[_0x3724('0xc')](_0x3724('0xd'),_0x2b43f3,'request\x20sent');_0x5457ba(_0x8f8d9b[_0x3724('0x14')][_0x3724('0x13')]);}})[_0x3724('0x15')](function(_0x15d475){logger[_0x3724('0x11')](_0x3724('0xd'),_0x2b43f3,_0x15d475);_0x2d2931(_0x15d475);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index b411da3..1bab812 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x40d728,_0x190ef2){var _0x207740=function(_0x116913){while(--_0x116913){_0x40d728['push'](_0x40d728['shift']());}};_0x207740(++_0x190ef2);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3c601b,_0x4e839f){var _0x24f02f=function(_0x6a5086){while(--_0x6a5086){_0x3c601b['push'](_0x3c601b['shift']());}};_0x24f02f(++_0x4e839f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 517375f..7519ca1 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 _0x4012=['exports','INTEGER','sequelize'];(function(_0xacc165,_0x373486){var _0x463eaf=function(_0x1ba768){while(--_0x1ba768){_0xacc165['push'](_0xacc165['shift']());}};_0x463eaf(++_0x373486);}(_0x4012,0x16a));var _0x2401=function(_0x490ba6,_0x15015f){_0x490ba6=_0x490ba6-0x0;var _0x42697c=_0x4012[_0x490ba6];return _0x42697c;};'use strict';var Sequelize=require(_0x2401('0x0'));module[_0x2401('0x1')]={'penalty':{'type':Sequelize[_0x2401('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x29e0=['sequelize','exports','INTEGER'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x29e0,0x1c8));var _0x029e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x029e('0x0'));module[_0x029e('0x1')]={'penalty':{'type':Sequelize[_0x029e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index a088824..085eceb 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 _0xb016=['../../config/environment','exports','user_has_sms_queues','lodash','util','moment','request-promise','path','rimraf'];(function(_0x4de1dd,_0x476489){var _0x54c052=function(_0x5b3a53){while(--_0x5b3a53){_0x4de1dd['push'](_0x4de1dd['shift']());}};_0x54c052(++_0x476489);}(_0xb016,0x159));var _0x6b01=function(_0x5c0420,_0x26da9d){_0x5c0420=_0x5c0420-0x0;var _0x340916=_0xb016[_0x5c0420];return _0x340916;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b01('0x2'));var BPromise=require('bluebird');var rp=require(_0x6b01('0x3'));var fs=require('fs');var path=require(_0x6b01('0x4'));var rimraf=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0x6b01('0x7')]=function(_0x65407a,_0x192b2d){return _0x65407a['define']('UserSmsQueue',attributes,{'tableName':_0x6b01('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb934=['exports','define','user_has_sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0xb934,0x92));var _0x4b93=function(_0x4b844c,_0x384d88){_0x4b844c=_0x4b844c-0x0;var _0x21681b=_0xb934[_0x4b844c];return _0x21681b;};'use strict';var _=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var logger=require(_0x4b93('0x2'))('api');var moment=require(_0x4b93('0x3'));var BPromise=require(_0x4b93('0x4'));var rp=require(_0x4b93('0x5'));var fs=require('fs');var path=require(_0x4b93('0x6'));var rimraf=require(_0x4b93('0x7'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0x4b93('0x8')]=function(_0x1fa8af,_0x2ea5ad){return _0x1fa8af[_0x4b93('0x9')]('UserSmsQueue',attributes,{'tableName':_0x4b93('0xa'),'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 6d267fe..18a39f1 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 _0xe192=['jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5b044c,_0xbf3f59){var _0x515140=function(_0xc6e2cb){while(--_0xc6e2cb){_0x5b044c['push'](_0x5b044c['shift']());}};_0x515140(++_0xbf3f59);}(_0xe192,0x10b));var _0x2e19=function(_0x53ccca,_0x15665a){_0x53ccca=_0x53ccca-0x0;var _0x4b7bca=_0xe192[_0x53ccca];return _0x4b7bca;};'use strict';var _=require(_0x2e19('0x0'));var util=require('util');var moment=require(_0x2e19('0x1'));var BPromise=require(_0x2e19('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e19('0x3'));var db=require(_0x2e19('0x4'))['db'];var utils=require(_0x2e19('0x5'));var logger=require(_0x2e19('0x6'))(_0x2e19('0x7'));var config=require(_0x2e19('0x8'));var jayson=require(_0x2e19('0x9'));var client=jayson[_0x2e19('0xa')][_0x2e19('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2aca36,_0x23d770,_0x2bd13f){return new BPromise(function(_0x5d4fa9,_0x3a2157){return client['request'](_0x2aca36,_0x2bd13f)[_0x2e19('0xc')](function(_0x2095b8){logger[_0x2e19('0xd')](_0x2e19('0xe'),_0x23d770,_0x2e19('0xf'));logger[_0x2e19('0x10')](_0x2e19('0x11'),_0x23d770,_0x2e19('0xf'),JSON['stringify'](_0x2095b8));if(_0x2095b8['error']){if(_0x2095b8['error'][_0x2e19('0x12')]===0x1f4){logger[_0x2e19('0x13')](_0x2e19('0xe'),_0x23d770,_0x2095b8['error']['message']);return _0x3a2157(_0x2095b8[_0x2e19('0x13')][_0x2e19('0x14')]);}logger[_0x2e19('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x23d770,_0x2095b8[_0x2e19('0x13')][_0x2e19('0x14')]);return _0x5d4fa9(_0x2095b8['error'][_0x2e19('0x14')]);}else{logger[_0x2e19('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x23d770,_0x2e19('0xf'));_0x5d4fa9(_0x2095b8[_0x2e19('0x15')]['message']);}})[_0x2e19('0x16')](function(_0x248fca){logger[_0x2e19('0x13')](_0x2e19('0xe'),_0x23d770,_0x248fca);_0x3a2157(_0x248fca);});});} \ No newline at end of file +var _0x652c=['info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x58284c,_0x52bfa7){var _0x4fc8bb=function(_0x284ab4){while(--_0x284ab4){_0x58284c['push'](_0x58284c['shift']());}};_0x4fc8bb(++_0x52bfa7);}(_0x652c,0xa1));var _0xc652=function(_0xdbd4e7,_0xa8b57a){_0xdbd4e7=_0xdbd4e7-0x0;var _0x27631c=_0x652c[_0xdbd4e7];return _0x27631c;};'use strict';var _=require(_0xc652('0x0'));var util=require(_0xc652('0x1'));var moment=require(_0xc652('0x2'));var BPromise=require(_0xc652('0x3'));var rs=require(_0xc652('0x4'));var fs=require('fs');var Redis=require(_0xc652('0x5'));var db=require(_0xc652('0x6'))['db'];var utils=require(_0xc652('0x7'));var logger=require(_0xc652('0x8'))(_0xc652('0x9'));var config=require(_0xc652('0xa'));var jayson=require(_0xc652('0xb'));var client=jayson[_0xc652('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a9410,_0x3a3d8f,_0x259d06){return new BPromise(function(_0x937a3c,_0x1fcd5d){return client[_0xc652('0xd')](_0x2a9410,_0x259d06)[_0xc652('0xe')](function(_0x4cf38e){logger[_0xc652('0xf')](_0xc652('0x10'),_0x3a3d8f,_0xc652('0x11'));logger['debug'](_0xc652('0x12'),_0x3a3d8f,_0xc652('0x11'),JSON['stringify'](_0x4cf38e));if(_0x4cf38e['error']){if(_0x4cf38e[_0xc652('0x13')]['code']===0x1f4){logger[_0xc652('0x13')](_0xc652('0x10'),_0x3a3d8f,_0x4cf38e[_0xc652('0x13')][_0xc652('0x14')]);return _0x1fcd5d(_0x4cf38e[_0xc652('0x13')]['message']);}logger[_0xc652('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x3a3d8f,_0x4cf38e[_0xc652('0x13')][_0xc652('0x14')]);return _0x937a3c(_0x4cf38e[_0xc652('0x13')][_0xc652('0x14')]);}else{logger['info'](_0xc652('0x10'),_0x3a3d8f,'request\x20sent');_0x937a3c(_0x4cf38e['result'][_0xc652('0x14')]);}})[_0xc652('0x15')](function(_0x41778d){logger['error'](_0xc652('0x10'),_0x3a3d8f,_0x41778d);_0x1fcd5d(_0x41778d);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 9a002cb..84ed368 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 _0x3eb3=['INTEGER','sequelize','exports'];(function(_0x3c28e7,_0x169024){var _0x557b3a=function(_0x42bf71){while(--_0x42bf71){_0x3c28e7['push'](_0x3c28e7['shift']());}};_0x557b3a(++_0x169024);}(_0x3eb3,0x16f));var _0x33eb=function(_0xe7bc16,_0x548085){_0xe7bc16=_0xe7bc16-0x0;var _0x1bc92e=_0x3eb3[_0xe7bc16];return _0x1bc92e;};'use strict';var Sequelize=require(_0x33eb('0x0'));module[_0x33eb('0x1')]={'UserId':{'type':Sequelize[_0x33eb('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x33eb('0x2')]}}; \ No newline at end of file +var _0x6068=['INTEGER','sequelize','exports'];(function(_0x570bdb,_0x125aff){var _0x4f4955=function(_0x5dcc2f){while(--_0x5dcc2f){_0x570bdb['push'](_0x570bdb['shift']());}};_0x4f4955(++_0x125aff);}(_0x6068,0xc7));var _0x8606=function(_0x269a6f,_0x4c43c5){_0x269a6f=_0x269a6f-0x0;var _0x29e1e6=_0x6068[_0x269a6f];return _0x29e1e6;};'use strict';var Sequelize=require(_0x8606('0x0'));module[_0x8606('0x1')]={'UserId':{'type':Sequelize[_0x8606('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x8606('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index f7b8e5c..d52b002 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(_0x121e4e,_0x3f8156){var _0x3a7de1=function(_0x81973e){while(--_0x81973e){_0x121e4e['push'](_0x121e4e['shift']());}};_0x3a7de1(++_0x3f8156);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0xc2cc5f,_0x5acdaa){var _0x5e628b=function(_0x47ad04){while(--_0x47ad04){_0xc2cc5f['push'](_0xc2cc5f['shift']());}};_0x5e628b(++_0x5acdaa);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 15bd4ca..cac8b24 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x401e62,_0x53bfd6){var _0x39c0e5=function(_0x1589e1){while(--_0x1589e1){_0x401e62['push'](_0x401e62['shift']());}};_0x39c0e5(++_0x53bfd6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x11fb47,_0x50fbf8){var _0xa0d270=function(_0x2d6c3e){while(--_0x2d6c3e){_0x11fb47['push'](_0x11fb47['shift']());}};_0xa0d270(++_0x50fbf8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index f65e8de..119a693 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 _0xc884=['sequelize','INTEGER'];(function(_0x2ad031,_0x8b7b00){var _0xbbcb9a=function(_0x2fb113){while(--_0x2fb113){_0x2ad031['push'](_0x2ad031['shift']());}};_0xbbcb9a(++_0x8b7b00);}(_0xc884,0x130));var _0x4c88=function(_0x54aa83,_0x19a58e){_0x54aa83=_0x54aa83-0x0;var _0x1d870c=_0xc884[_0x54aa83];return _0x1d870c;};'use strict';var Sequelize=require(_0x4c88('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4c88('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe020=['INTEGER','sequelize'];(function(_0x43b2aa,_0x38c827){var _0x1765da=function(_0x29e14c){while(--_0x29e14c){_0x43b2aa['push'](_0x43b2aa['shift']());}};_0x1765da(++_0x38c827);}(_0xe020,0x105));var _0x0e02=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xe020[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require(_0x0e02('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0e02('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 2b4220b..32c1fa5 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 _0xa92c=['define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x10848a,_0x531a91){var _0x138fed=function(_0x3e5c03){while(--_0x3e5c03){_0x10848a['push'](_0x10848a['shift']());}};_0x138fed(++_0x531a91);}(_0xa92c,0x18b));var _0xca92=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xa92c[_0x1992f1];return _0x413dfe;};'use strict';var _=require(_0xca92('0x0'));var util=require(_0xca92('0x1'));var logger=require(_0xca92('0x2'))(_0xca92('0x3'));var moment=require(_0xca92('0x4'));var BPromise=require('bluebird');var rp=require(_0xca92('0x5'));var fs=require('fs');var path=require(_0xca92('0x6'));var rimraf=require(_0xca92('0x7'));var config=require(_0xca92('0x8'));var attributes=require(_0xca92('0x9'));module[_0xca92('0xa')]=function(_0x33a6fe,_0x5f4341){return _0x33a6fe[_0xca92('0xb')](_0xca92('0xc'),attributes,{'tableName':_0xca92('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73e8=['bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','define','user_has_voice_queues','util','../../config/logger','api','moment'];(function(_0xcee193,_0x319b69){var _0x51c4be=function(_0x5f4874){while(--_0x5f4874){_0xcee193['push'](_0xcee193['shift']());}};_0x51c4be(++_0x319b69);}(_0x73e8,0x151));var _0x873e=function(_0x20bc39,_0x3f5e3e){_0x20bc39=_0x20bc39-0x0;var _0x1c5afd=_0x73e8[_0x20bc39];return _0x1c5afd;};'use strict';var _=require('lodash');var util=require(_0x873e('0x0'));var logger=require(_0x873e('0x1'))(_0x873e('0x2'));var moment=require(_0x873e('0x3'));var BPromise=require(_0x873e('0x4'));var rp=require(_0x873e('0x5'));var fs=require('fs');var path=require(_0x873e('0x6'));var rimraf=require(_0x873e('0x7'));var config=require('../../config/environment');var attributes=require(_0x873e('0x8'));module['exports']=function(_0x3b3f1d,_0xc2f882){return _0x3b3f1d[_0x873e('0x9')]('UserVoiceQueue',attributes,{'tableName':_0x873e('0xa'),'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 7e25838..c29dd27 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 _0x8040=['debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x524b2a,_0x13e281){var _0x176cc5=function(_0x5c9851){while(--_0x5c9851){_0x524b2a['push'](_0x524b2a['shift']());}};_0x176cc5(++_0x13e281);}(_0x8040,0x12d));var _0x0804=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x8040[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0804('0x0'));var util=require('util');var moment=require(_0x0804('0x1'));var BPromise=require(_0x0804('0x2'));var rs=require(_0x0804('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0804('0x4'))['db'];var utils=require(_0x0804('0x5'));var logger=require(_0x0804('0x6'))(_0x0804('0x7'));var config=require(_0x0804('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0804('0x9')][_0x0804('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2207a7,_0x76b949,_0x5ee1d5){return new BPromise(function(_0x55de1c,_0x324d57){return client['request'](_0x2207a7,_0x5ee1d5)['then'](function(_0x3418b7){logger[_0x0804('0xb')](_0x0804('0xc'),_0x76b949,_0x0804('0xd'));logger[_0x0804('0xe')](_0x0804('0xf'),_0x76b949,_0x0804('0xd'),JSON[_0x0804('0x10')](_0x3418b7));if(_0x3418b7[_0x0804('0x11')]){if(_0x3418b7['error'][_0x0804('0x12')]===0x1f4){logger['error'](_0x0804('0xc'),_0x76b949,_0x3418b7[_0x0804('0x11')][_0x0804('0x13')]);return _0x324d57(_0x3418b7[_0x0804('0x11')][_0x0804('0x13')]);}logger[_0x0804('0x11')](_0x0804('0xc'),_0x76b949,_0x3418b7[_0x0804('0x11')][_0x0804('0x13')]);return _0x55de1c(_0x3418b7[_0x0804('0x11')][_0x0804('0x13')]);}else{logger[_0x0804('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x76b949,'request\x20sent');_0x55de1c(_0x3418b7[_0x0804('0x14')][_0x0804('0x13')]);}})['catch'](function(_0x3c2cb7){logger['error'](_0x0804('0xc'),_0x76b949,_0x3c2cb7);_0x324d57(_0x3c2cb7);});});} \ No newline at end of file +var _0x02b0=['jayson/promise','client','http','request','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x1ea690,_0x5de03f){var _0x4c1975=function(_0x31bd8a){while(--_0x31bd8a){_0x1ea690['push'](_0x1ea690['shift']());}};_0x4c1975(++_0x5de03f);}(_0x02b0,0x67));var _0x002b=function(_0x1f8089,_0x39c32){_0x1f8089=_0x1f8089-0x0;var _0x205a59=_0x02b0[_0x1f8089];return _0x205a59;};'use strict';var _=require(_0x002b('0x0'));var util=require('util');var moment=require(_0x002b('0x1'));var BPromise=require(_0x002b('0x2'));var rs=require(_0x002b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x002b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x002b('0x5'))('rpc');var config=require(_0x002b('0x6'));var jayson=require(_0x002b('0x7'));var client=jayson[_0x002b('0x8')][_0x002b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39067b,_0x2fdb23,_0x404d77){return new BPromise(function(_0x361d99,_0x4b23aa){return client[_0x002b('0xa')](_0x39067b,_0x404d77)[_0x002b('0xb')](function(_0x283c82){logger[_0x002b('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x2fdb23,_0x002b('0xd'));logger[_0x002b('0xe')](_0x002b('0xf'),_0x2fdb23,_0x002b('0xd'),JSON[_0x002b('0x10')](_0x283c82));if(_0x283c82[_0x002b('0x11')]){if(_0x283c82['error'][_0x002b('0x12')]===0x1f4){logger[_0x002b('0x11')](_0x002b('0x13'),_0x2fdb23,_0x283c82['error'][_0x002b('0x14')]);return _0x4b23aa(_0x283c82[_0x002b('0x11')][_0x002b('0x14')]);}logger[_0x002b('0x11')](_0x002b('0x13'),_0x2fdb23,_0x283c82[_0x002b('0x11')]['message']);return _0x361d99(_0x283c82[_0x002b('0x11')][_0x002b('0x14')]);}else{logger[_0x002b('0xc')](_0x002b('0x13'),_0x2fdb23,_0x002b('0xd'));_0x361d99(_0x283c82['result'][_0x002b('0x14')]);}})[_0x002b('0x15')](function(_0x546db6){logger['error'](_0x002b('0x13'),_0x2fdb23,_0x546db6);_0x4b23aa(_0x546db6);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 7f6128d..7091d6c 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x43646b,_0x39f991){var _0x7e6739=function(_0x11e998){while(--_0x11e998){_0x43646b['push'](_0x43646b['shift']());}};_0x7e6739(++_0x39f991);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0xcb91[_0x16bb4b];return _0x8aeb84;};'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(_0x45eff2,_0x3f8a79){var _0xda4664=function(_0x706242){while(--_0x706242){_0x45eff2['push'](_0x45eff2['shift']());}};_0xda4664(++_0x3f8a79);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index cab0c9a..1ca6886 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 _0x0e8a=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x173f13,_0x4ea3cf){var _0x585942=function(_0x96d7d5){while(--_0x96d7d5){_0x173f13['push'](_0x173f13['shift']());}};_0x585942(++_0x4ea3cf);}(_0x0e8a,0x1c3));var _0xa0e8=function(_0x11f418,_0x16283a){_0x11f418=_0x11f418-0x0;var _0x5d7f70=_0x0e8a[_0x11f418];return _0x5d7f70;};'use strict';var Sequelize=require(_0xa0e8('0x0'));module[_0xa0e8('0x1')]={'uniqueid':{'type':Sequelize[_0xa0e8('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xa0e8('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xa0e8('0x3')},'UserId':{'type':Sequelize[_0xa0e8('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa0e8('0x4')],'allowNull':![],'unique':_0xa0e8('0x5'),'comment':_0xa0e8('0x3')},'VoiceQueueId':{'type':Sequelize[_0xa0e8('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa0e8('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xa0e8('0x2')](0xb),'defaultValue':0x0,'comment':_0xa0e8('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xa0e8('0x3')}}; \ No newline at end of file +var _0x3d59=['STRING','INTEGER','queue_interface','Required\x20by\x20Asterisk'];(function(_0x78414,_0x4c99a3){var _0x5a02fd=function(_0x44abcd){while(--_0x44abcd){_0x78414['push'](_0x78414['shift']());}};_0x5a02fd(++_0x4c99a3);}(_0x3d59,0x117));var _0x93d5=function(_0x1099b5,_0x46433d){_0x1099b5=_0x1099b5-0x0;var _0x437109=_0x3d59[_0x1099b5];return _0x437109;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x93d5('0x0')},'membername':{'type':Sequelize[_0x93d5('0x1')],'allowNull':![],'comment':_0x93d5('0x0')},'UserId':{'type':Sequelize[_0x93d5('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x93d5('0x1')],'allowNull':![],'unique':_0x93d5('0x3'),'comment':_0x93d5('0x0')},'VoiceQueueId':{'type':Sequelize[_0x93d5('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x93d5('0x1')],'allowNull':![],'unique':_0x93d5('0x3'),'comment':_0x93d5('0x0')},'penalty':{'type':Sequelize[_0x93d5('0x2')](0xb),'defaultValue':0x0,'comment':_0x93d5('0x0')},'paused':{'type':Sequelize[_0x93d5('0x2')](0xb),'defaultValue':0x0,'comment':_0x93d5('0x0')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 66d22d5..9ef1b3b 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 _0xff61=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x327d5a,_0x16bba0){var _0x49d8ff=function(_0x214620){while(--_0x214620){_0x327d5a['push'](_0x327d5a['shift']());}};_0x49d8ff(++_0x16bba0);}(_0xff61,0x12b));var _0x1ff6=function(_0x117af8,_0x3b7b51){_0x117af8=_0x117af8-0x0;var _0x329679=_0xff61[_0x117af8];return _0x329679;};'use strict';var EventEmitter=require(_0x1ff6('0x0'));var UserVoiceQueueRt=require(_0x1ff6('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1ff6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1ff6('0x3')};function emitEvent(_0x5eb6b1){return function(_0x2ddbc0,_0x3a4002,_0x5263ff){UserVoiceQueueRtEvents[_0x1ff6('0x4')](_0x5eb6b1+':'+_0x2ddbc0['id'],_0x2ddbc0);UserVoiceQueueRtEvents[_0x1ff6('0x4')](_0x5eb6b1,_0x2ddbc0);_0x5263ff(null);};}for(var e in events){if(events[_0x1ff6('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x1ff6('0x6')](e,emitEvent(event));}}module[_0x1ff6('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xc72b=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x3120cc,_0x31ff8b){var _0x554fed=function(_0x18f43d){while(--_0x18f43d){_0x3120cc['push'](_0x3120cc['shift']());}};_0x554fed(++_0x31ff8b);}(_0xc72b,0x9b));var _0xbc72=function(_0x152aa1,_0x307718){_0x152aa1=_0x152aa1-0x0;var _0x1bc01a=_0xc72b[_0x152aa1];return _0x1bc01a;};'use strict';var EventEmitter=require(_0xbc72('0x0'));var UserVoiceQueueRt=require(_0xbc72('0x1'))['db'][_0xbc72('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xbc72('0x3')](0x0);var events={'afterCreate':_0xbc72('0x4'),'afterUpdate':_0xbc72('0x5'),'afterDestroy':'remove'};function emitEvent(_0x10ff09){return function(_0x3de944,_0x54e774,_0x54406e){UserVoiceQueueRtEvents[_0xbc72('0x6')](_0x10ff09+':'+_0x3de944['id'],_0x3de944);UserVoiceQueueRtEvents[_0xbc72('0x6')](_0x10ff09,_0x3de944);_0x54406e(null);};}for(var e in events){if(events[_0xbc72('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xbc72('0x8')](e,emitEvent(event));}}module[_0xbc72('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index c6d6dfa..fd17801 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 _0x2f27=['./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x2f27,0x1a5));var _0x72f2=function(_0x2d4333,_0x5257de){_0x2d4333=_0x2d4333-0x0;var _0x2ae982=_0x2f27[_0x2d4333];return _0x2ae982;};'use strict';var _=require(_0x72f2('0x0'));var util=require(_0x72f2('0x1'));var logger=require(_0x72f2('0x2'))(_0x72f2('0x3'));var moment=require(_0x72f2('0x4'));var BPromise=require('bluebird');var rp=require(_0x72f2('0x5'));var fs=require('fs');var path=require(_0x72f2('0x6'));var rimraf=require(_0x72f2('0x7'));var config=require('../../config/environment');var attributes=require(_0x72f2('0x8'));module['exports']=function(_0x7ffad1,_0x207db6){return _0x7ffad1['define'](_0x72f2('0x9'),attributes,{'tableName':_0x72f2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9b9=['path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','bluebird'];(function(_0x312114,_0x3b2b79){var _0x42941c=function(_0x1790e4){while(--_0x1790e4){_0x312114['push'](_0x312114['shift']());}};_0x42941c(++_0x3b2b79);}(_0xe9b9,0x194));var _0x9e9b=function(_0x23005b,_0x4c8ca3){_0x23005b=_0x23005b-0x0;var _0x1a3c87=_0xe9b9[_0x23005b];return _0x1a3c87;};'use strict';var _=require(_0x9e9b('0x0'));var util=require('util');var logger=require(_0x9e9b('0x1'))(_0x9e9b('0x2'));var moment=require('moment');var BPromise=require(_0x9e9b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e9b('0x4'));var rimraf=require(_0x9e9b('0x5'));var config=require(_0x9e9b('0x6'));var attributes=require(_0x9e9b('0x7'));module[_0x9e9b('0x8')]=function(_0x4a27c6,_0x4647ac){return _0x4a27c6[_0x9e9b('0x9')](_0x9e9b('0xa'),attributes,{'tableName':_0x9e9b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index d393000..7eafc25 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 _0x211b=['register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket'];(function(_0x4955ae,_0x3df437){var _0x28dc19=function(_0xe3ae31){while(--_0xe3ae31){_0x4955ae['push'](_0x4955ae['shift']());}};_0x28dc19(++_0x3df437);}(_0x211b,0x1d5));var _0xb211=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x211b[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0xb211('0x0'));var util=require(_0xb211('0x1'));var moment=require(_0xb211('0x2'));var BPromise=require(_0xb211('0x3'));var rs=require(_0xb211('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb211('0x5'));var logger=require('../../config/logger')(_0xb211('0x6'));var config=require(_0xb211('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xb211('0x8')]=_[_0xb211('0x9')](config[_0xb211('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb211('0xa'))(new Redis(config['redis']));require(_0xb211('0xb'))[_0xb211('0xc')](socket);function respondWithRpcPromise(_0x88b798,_0x3deae8,_0x59e2ed){return new BPromise(function(_0x8b045f,_0x17cb7a){return client[_0xb211('0xd')](_0x88b798,_0x59e2ed)[_0xb211('0xe')](function(_0x1df5b4){logger[_0xb211('0xf')](_0xb211('0x10'),_0x3deae8,_0xb211('0x11'));logger[_0xb211('0x12')](_0xb211('0x13'),_0x3deae8,_0xb211('0x11'),JSON[_0xb211('0x14')](_0x1df5b4));if(_0x1df5b4['error']){if(_0x1df5b4[_0xb211('0x15')][_0xb211('0x16')]===0x1f4){logger['error'](_0xb211('0x10'),_0x3deae8,_0x1df5b4[_0xb211('0x15')][_0xb211('0x17')]);return _0x17cb7a(_0x1df5b4[_0xb211('0x15')][_0xb211('0x17')]);}logger[_0xb211('0x15')](_0xb211('0x10'),_0x3deae8,_0x1df5b4[_0xb211('0x15')][_0xb211('0x17')]);return _0x8b045f(_0x1df5b4[_0xb211('0x15')][_0xb211('0x17')]);}else{logger[_0xb211('0xf')](_0xb211('0x10'),_0x3deae8,_0xb211('0x11'));_0x8b045f(_0x1df5b4[_0xb211('0x18')]['message']);}})[_0xb211('0x19')](function(_0x42fe78){logger[_0xb211('0x15')](_0xb211('0x10'),_0x3deae8,_0x42fe78);_0x17cb7a(_0x42fe78);});});}exports[_0xb211('0x1a')]=function(_0x4b89fb){var _0x4e7ba5=this;return new Promise(function(_0x574635,_0x3f99b0){return db[_0xb211('0x1b')][_0xb211('0x1c')]({'raw':_0x4b89fb[_0xb211('0x1d')]?_0x4b89fb[_0xb211('0x1d')][_0xb211('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b89fb[_0xb211('0x1d')]?_0x4b89fb[_0xb211('0x1d')][_0xb211('0x1f')]||null:null,'attributes':[[db[_0xb211('0x20')]['fn'](_0xb211('0x21'),db[_0xb211('0x20')]['fn']('IF',db['sequelize'][_0xb211('0x22')](_0xb211('0x23')))),_0xb211('0x24')]]})[_0xb211('0xe')](function(_0x2a2c14){logger[_0xb211('0xf')](_0xb211('0x1a'),_0x4b89fb);logger[_0xb211('0x12')](_0xb211('0x1a'),_0x4b89fb,JSON[_0xb211('0x14')](_0x2a2c14));_0x574635(_0x2a2c14);})[_0xb211('0x19')](function(_0x37e4c2){logger[_0xb211('0x15')](_0xb211('0x1a'),_0x37e4c2['message'],_0x4b89fb);_0x3f99b0(_0x4e7ba5[_0xb211('0x15')](0x1f4,_0x37e4c2[_0xb211('0x17')]));});});}; \ No newline at end of file +var _0x1aba=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x1aba,0xb8));var _0xa1ab=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x1aba[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xa1ab('0x0'));var util=require(_0xa1ab('0x1'));var moment=require(_0xa1ab('0x2'));var BPromise=require(_0xa1ab('0x3'));var rs=require(_0xa1ab('0x4'));var fs=require('fs');var Redis=require(_0xa1ab('0x5'));var db=require(_0xa1ab('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1ab('0x7'))(_0xa1ab('0x8'));var config=require(_0xa1ab('0x9'));var jayson=require(_0xa1ab('0xa'));var client=jayson[_0xa1ab('0xb')]['http']({'port':0x232a});config[_0xa1ab('0xc')]=_[_0xa1ab('0xd')](config[_0xa1ab('0xc')],{'host':_0xa1ab('0xe'),'port':0x18eb});var socket=require(_0xa1ab('0xf'))(new Redis(config[_0xa1ab('0xc')]));require(_0xa1ab('0x10'))['register'](socket);function respondWithRpcPromise(_0x5477b2,_0x47223d,_0x3f9870){return new BPromise(function(_0x1779c5,_0x1c9bc5){return client[_0xa1ab('0x11')](_0x5477b2,_0x3f9870)['then'](function(_0x2cc4e0){logger['info'](_0xa1ab('0x12'),_0x47223d,_0xa1ab('0x13'));logger['debug'](_0xa1ab('0x14'),_0x47223d,'request\x20sent',JSON[_0xa1ab('0x15')](_0x2cc4e0));if(_0x2cc4e0[_0xa1ab('0x16')]){if(_0x2cc4e0[_0xa1ab('0x16')][_0xa1ab('0x17')]===0x1f4){logger['error'](_0xa1ab('0x12'),_0x47223d,_0x2cc4e0[_0xa1ab('0x16')][_0xa1ab('0x18')]);return _0x1c9bc5(_0x2cc4e0[_0xa1ab('0x16')][_0xa1ab('0x18')]);}logger[_0xa1ab('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x47223d,_0x2cc4e0[_0xa1ab('0x16')]['message']);return _0x1779c5(_0x2cc4e0[_0xa1ab('0x16')][_0xa1ab('0x18')]);}else{logger[_0xa1ab('0x19')](_0xa1ab('0x12'),_0x47223d,_0xa1ab('0x13'));_0x1779c5(_0x2cc4e0['result']['message']);}})[_0xa1ab('0x1a')](function(_0x5bcf3d){logger[_0xa1ab('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x47223d,_0x5bcf3d);_0x1c9bc5(_0x5bcf3d);});});}exports[_0xa1ab('0x1b')]=function(_0x3dbb7c){var _0x3a4fb5=this;return new Promise(function(_0x3884ac,_0x12b413){return db[_0xa1ab('0x1c')][_0xa1ab('0x1d')]({'raw':_0x3dbb7c['options']?_0x3dbb7c[_0xa1ab('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3dbb7c[_0xa1ab('0x1e')]?_0x3dbb7c[_0xa1ab('0x1e')][_0xa1ab('0x1f')]||null:null,'attributes':[[db[_0xa1ab('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa1ab('0x20')][_0xa1ab('0x21')](_0xa1ab('0x22')))),_0xa1ab('0x23')]]})['then'](function(_0x30f2d7){logger[_0xa1ab('0x19')](_0xa1ab('0x1b'),_0x3dbb7c);logger[_0xa1ab('0x24')]('GetVoiceQueueRtPauses',_0x3dbb7c,JSON['stringify'](_0x30f2d7));_0x3884ac(_0x30f2d7);})[_0xa1ab('0x1a')](function(_0x43143d){logger['error']('GetVoiceQueueRtPauses',_0x43143d[_0xa1ab('0x18')],_0x3dbb7c);_0x12b413(_0x3a4fb5[_0xa1ab('0x16')](0x1f4,_0x43143d[_0xa1ab('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index f4bec4f..164f3e0 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 _0x806b=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x4e1c2a,_0x264113){var _0x1a4670=function(_0x37828e){while(--_0x37828e){_0x4e1c2a['push'](_0x4e1c2a['shift']());}};_0x1a4670(++_0x264113);}(_0x806b,0x163));var _0xb806=function(_0x180c82,_0x54d770){_0x180c82=_0x180c82-0x0;var _0x125078=_0x806b[_0x180c82];return _0x125078;};'use strict';var UserVoiceQueueRtEvents=require(_0xb806('0x0'));var events=[_0xb806('0x1'),_0xb806('0x2'),_0xb806('0x3')];function createListener(_0x448368,_0x4648ea){return function(_0x307014){_0x4648ea[_0xb806('0x4')](_0x448368,_0x307014);};}function removeListener(_0x595117,_0x32c93c){return function(){UserVoiceQueueRtEvents[_0xb806('0x5')](_0x595117,_0x32c93c);};}exports[_0xb806('0x6')]=function(_0xc0353b){for(var _0x52107e=0x0,_0x9b2858=events[_0xb806('0x7')];_0x52107e<_0x9b2858;_0x52107e++){var _0x4fdc38=events[_0x52107e];var _0x3525e8=createListener(_0xb806('0x8')+_0x4fdc38,_0xc0353b);UserVoiceQueueRtEvents['on'](_0x4fdc38,_0x3525e8);}}; \ No newline at end of file +var _0xee3c=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','removeListener','register'];(function(_0x263021,_0x473221){var _0x5afa53=function(_0x3d96d9){while(--_0x3d96d9){_0x263021['push'](_0x263021['shift']());}};_0x5afa53(++_0x473221);}(_0xee3c,0x14a));var _0xcee3=function(_0x1a484d,_0x2837cc){_0x1a484d=_0x1a484d-0x0;var _0x1da4dd=_0xee3c[_0x1a484d];return _0x1da4dd;};'use strict';var UserVoiceQueueRtEvents=require(_0xcee3('0x0'));var events=[_0xcee3('0x1'),_0xcee3('0x2'),_0xcee3('0x3')];function createListener(_0x3077e7,_0x853001){return function(_0x4f216c){_0x853001['emit'](_0x3077e7,_0x4f216c);};}function removeListener(_0x435892,_0x4cd398){return function(){UserVoiceQueueRtEvents[_0xcee3('0x4')](_0x435892,_0x4cd398);};}exports[_0xcee3('0x5')]=function(_0x9350f3){for(var _0x44e46f=0x0,_0x3b8ffe=events[_0xcee3('0x6')];_0x44e46f<_0x3b8ffe;_0x44e46f++){var _0x22953c=events[_0x44e46f];var _0x364eb2=createListener(_0xcee3('0x7')+_0x22953c,_0x9350f3);UserVoiceQueueRtEvents['on'](_0x22953c,_0x364eb2);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index f70989f..13307ca 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3f7e37,_0x32f790){var _0x2a3ec7=function(_0x32922c){while(--_0x32922c){_0x3f7e37['push'](_0x3f7e37['shift']());}};_0x2a3ec7(++_0x32f790);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x25ce3a,_0x1a1550){var _0x3cf679=function(_0x296c7b){while(--_0x296c7b){_0x25ce3a['push'](_0x25ce3a['shift']());}};_0x3cf679(++_0x1a1550);}(_0x70e0,0x17b));var _0x070e=function(_0x8d75f2,_0x9afc9e){_0x8d75f2=_0x8d75f2-0x0;var _0x66d179=_0x70e0[_0x8d75f2];return _0x66d179;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index d4ab2e7..9be802f 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 _0xd734=['sequelize','exports','INTEGER'];(function(_0x2b576e,_0x308b41){var _0x426f17=function(_0x5af1a4){while(--_0x5af1a4){_0x2b576e['push'](_0x2b576e['shift']());}};_0x426f17(++_0x308b41);}(_0xd734,0x18c));var _0x4d73=function(_0x17b379,_0x216984){_0x17b379=_0x17b379-0x0;var _0x212e3d=_0xd734[_0x17b379];return _0x212e3d;};'use strict';var Sequelize=require(_0x4d73('0x0'));module[_0x4d73('0x1')]={'penalty':{'type':Sequelize[_0x4d73('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe0bf=['sequelize','exports','INTEGER'];(function(_0x1e7ba9,_0x20c316){var _0xcf1215=function(_0x53efa0){while(--_0x53efa0){_0x1e7ba9['push'](_0x1e7ba9['shift']());}};_0xcf1215(++_0x20c316);}(_0xe0bf,0x1e9));var _0xfe0b=function(_0x529ff1,_0x43dbd8){_0x529ff1=_0x529ff1-0x0;var _0x439242=_0xe0bf[_0x529ff1];return _0x439242;};'use strict';var Sequelize=require(_0xfe0b('0x0'));module[_0xfe0b('0x1')]={'penalty':{'type':Sequelize[_0xfe0b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 2463858..9a103ea 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 _0xf2bc=['rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xabd216,_0x4e55e2){var _0xff8366=function(_0x272bb5){while(--_0x272bb5){_0xabd216['push'](_0xabd216['shift']());}};_0xff8366(++_0x4e55e2);}(_0xf2bc,0x19c));var _0xcf2b=function(_0x54f925,_0x1daf38){_0x54f925=_0x54f925-0x0;var _0x3d7523=_0xf2bc[_0x54f925];return _0x3d7523;};'use strict';var _=require(_0xcf2b('0x0'));var util=require(_0xcf2b('0x1'));var logger=require(_0xcf2b('0x2'))(_0xcf2b('0x3'));var moment=require(_0xcf2b('0x4'));var BPromise=require(_0xcf2b('0x5'));var rp=require(_0xcf2b('0x6'));var fs=require('fs');var path=require(_0xcf2b('0x7'));var rimraf=require(_0xcf2b('0x8'));var config=require('../../config/environment');var attributes=require(_0xcf2b('0x9'));module[_0xcf2b('0xa')]=function(_0x423103,_0x2d3604){return _0x423103[_0xcf2b('0xb')](_0xcf2b('0xc'),attributes,{'tableName':_0xcf2b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd0e=['lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x26a956,_0x12145a){var _0x421f17=function(_0x39920f){while(--_0x39920f){_0x26a956['push'](_0x26a956['shift']());}};_0x421f17(++_0x12145a);}(_0xcd0e,0x84));var _0xecd0=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0xcd0e[_0x3f4891];return _0x54f2d8;};'use strict';var _=require(_0xecd0('0x0'));var util=require('util');var logger=require(_0xecd0('0x1'))(_0xecd0('0x2'));var moment=require(_0xecd0('0x3'));var BPromise=require(_0xecd0('0x4'));var rp=require(_0xecd0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xecd0('0x6'));var attributes=require(_0xecd0('0x7'));module['exports']=function(_0x1c75ff,_0x5d2779){return _0x1c75ff[_0xecd0('0x8')](_0xecd0('0x9'),attributes,{'tableName':_0xecd0('0xa'),'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 05924f2..3566885 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 _0x79f7=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','catch','lodash','util','moment'];(function(_0x2e6c19,_0x131233){var _0x52885d=function(_0x38f224){while(--_0x38f224){_0x2e6c19['push'](_0x2e6c19['shift']());}};_0x52885d(++_0x131233);}(_0x79f7,0x13d));var _0x779f=function(_0x1e647b,_0x359b5e){_0x1e647b=_0x1e647b-0x0;var _0x23b626=_0x79f7[_0x1e647b];return _0x23b626;};'use strict';var _=require(_0x779f('0x0'));var util=require(_0x779f('0x1'));var moment=require(_0x779f('0x2'));var BPromise=require('bluebird');var rs=require(_0x779f('0x3'));var fs=require('fs');var Redis=require(_0x779f('0x4'));var db=require(_0x779f('0x5'))['db'];var utils=require(_0x779f('0x6'));var logger=require(_0x779f('0x7'))('rpc');var config=require(_0x779f('0x8'));var jayson=require(_0x779f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a7dc0,_0x568276,_0xe50b9a){return new BPromise(function(_0xe6f688,_0x96b0f7){return client['request'](_0x2a7dc0,_0xe50b9a)[_0x779f('0xa')](function(_0x4fd4c4){logger['info'](_0x779f('0xb'),_0x568276,'request\x20sent');logger[_0x779f('0xc')](_0x779f('0xd'),_0x568276,'request\x20sent',JSON['stringify'](_0x4fd4c4));if(_0x4fd4c4[_0x779f('0xe')]){if(_0x4fd4c4[_0x779f('0xe')]['code']===0x1f4){logger[_0x779f('0xe')](_0x779f('0xb'),_0x568276,_0x4fd4c4[_0x779f('0xe')][_0x779f('0xf')]);return _0x96b0f7(_0x4fd4c4['error'][_0x779f('0xf')]);}logger[_0x779f('0xe')](_0x779f('0xb'),_0x568276,_0x4fd4c4[_0x779f('0xe')]['message']);return _0xe6f688(_0x4fd4c4['error']['message']);}else{logger[_0x779f('0x10')](_0x779f('0xb'),_0x568276,_0x779f('0x11'));_0xe6f688(_0x4fd4c4[_0x779f('0x12')]['message']);}})[_0x779f('0x13')](function(_0x2f29a4){logger['error'](_0x779f('0xb'),_0x568276,_0x2f29a4);_0x96b0f7(_0x2f29a4);});});} \ No newline at end of file +var _0x1d6b=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x5b6dfa,_0x474ef1){var _0x45fadc=function(_0x2aa077){while(--_0x2aa077){_0x5b6dfa['push'](_0x5b6dfa['shift']());}};_0x45fadc(++_0x474ef1);}(_0x1d6b,0x18f));var _0xb1d6=function(_0x1e235e,_0x994b77){_0x1e235e=_0x1e235e-0x0;var _0x1e8e94=_0x1d6b[_0x1e235e];return _0x1e8e94;};'use strict';var _=require('lodash');var util=require(_0xb1d6('0x0'));var moment=require(_0xb1d6('0x1'));var BPromise=require(_0xb1d6('0x2'));var rs=require(_0xb1d6('0x3'));var fs=require('fs');var Redis=require(_0xb1d6('0x4'));var db=require(_0xb1d6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb1d6('0x6'))('rpc');var config=require(_0xb1d6('0x7'));var jayson=require(_0xb1d6('0x8'));var client=jayson[_0xb1d6('0x9')][_0xb1d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x528fb3,_0x449c35,_0x136212){return new BPromise(function(_0x310aa7,_0x4468d6){return client[_0xb1d6('0xb')](_0x528fb3,_0x136212)[_0xb1d6('0xc')](function(_0x15ae2b){logger[_0xb1d6('0xd')](_0xb1d6('0xe'),_0x449c35,_0xb1d6('0xf'));logger[_0xb1d6('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x449c35,_0xb1d6('0xf'),JSON['stringify'](_0x15ae2b));if(_0x15ae2b['error']){if(_0x15ae2b[_0xb1d6('0x11')][_0xb1d6('0x12')]===0x1f4){logger[_0xb1d6('0x11')](_0xb1d6('0xe'),_0x449c35,_0x15ae2b[_0xb1d6('0x11')][_0xb1d6('0x13')]);return _0x4468d6(_0x15ae2b[_0xb1d6('0x11')][_0xb1d6('0x13')]);}logger[_0xb1d6('0x11')](_0xb1d6('0xe'),_0x449c35,_0x15ae2b['error'][_0xb1d6('0x13')]);return _0x310aa7(_0x15ae2b[_0xb1d6('0x11')][_0xb1d6('0x13')]);}else{logger[_0xb1d6('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x449c35,'request\x20sent');_0x310aa7(_0x15ae2b[_0xb1d6('0x14')]['message']);}})[_0xb1d6('0x15')](function(_0x7b3c06){logger[_0xb1d6('0x11')](_0xb1d6('0xe'),_0x449c35,_0x7b3c06);_0x4468d6(_0x7b3c06);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 4670ee7..80dfe2f 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 _0x871e=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','post','put','delete','destroy','exports'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x871e,0x1b0));var _0xe871=function(_0x284cae,_0x740c45){_0x284cae=_0x284cae-0x0;var _0x15c5b7=_0x871e[_0x284cae];return _0x15c5b7;};'use strict';var multer=require(_0xe871('0x0'));var util=require('util');var path=require(_0xe871('0x1'));var timeout=require(_0xe871('0x2'));var express=require(_0xe871('0x3'));var router=express[_0xe871('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe871('0x5'));var interaction=require(_0xe871('0x6'));var config=require(_0xe871('0x7'));var controller=require(_0xe871('0x8'));router[_0xe871('0x9')]('/',auth[_0xe871('0xa')](),controller[_0xe871('0xb')]);router[_0xe871('0x9')](_0xe871('0xc'),auth[_0xe871('0xa')](),controller['show']);router[_0xe871('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe871('0xe')](_0xe871('0xc'),auth[_0xe871('0xa')](),controller['update']);router[_0xe871('0xf')](_0xe871('0xc'),auth[_0xe871('0xa')](),controller[_0xe871('0x10')]);module[_0xe871('0x11')]=router; \ No newline at end of file +var _0xbf83=['connect-timeout','express','Router','fs-extra','../../config/environment','./variable.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0xd86450,_0xb31e79){var _0x3a416a=function(_0x4bc22d){while(--_0x4bc22d){_0xd86450['push'](_0xd86450['shift']());}};_0x3a416a(++_0xb31e79);}(_0xbf83,0x11e));var _0x3bf8=function(_0x5cd6a4,_0x446b45){_0x5cd6a4=_0x5cd6a4-0x0;var _0x3c59b8=_0xbf83[_0x5cd6a4];return _0x3c59b8;};'use strict';var multer=require(_0x3bf8('0x0'));var util=require('util');var path=require(_0x3bf8('0x1'));var timeout=require(_0x3bf8('0x2'));var express=require(_0x3bf8('0x3'));var router=express[_0x3bf8('0x4')]();var fs_extra=require(_0x3bf8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3bf8('0x6'));var controller=require(_0x3bf8('0x7'));router[_0x3bf8('0x8')]('/',auth[_0x3bf8('0x9')](),controller['index']);router['get'](_0x3bf8('0xa'),auth[_0x3bf8('0x9')](),controller['show']);router[_0x3bf8('0xb')]('/',auth['isAuthenticated'](),controller[_0x3bf8('0xc')]);router[_0x3bf8('0xd')](_0x3bf8('0xa'),auth[_0x3bf8('0x9')](),controller[_0x3bf8('0xe')]);router[_0x3bf8('0xf')](_0x3bf8('0xa'),auth['isAuthenticated'](),controller[_0x3bf8('0x10')]);module[_0x3bf8('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index cd2d205..9b91168 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 _0x4fe0=['STRING','sequelize','exports','name'];(function(_0x567bcb,_0x4978c1){var _0x4eebc2=function(_0x42a456){while(--_0x42a456){_0x567bcb['push'](_0x567bcb['shift']());}};_0x4eebc2(++_0x4978c1);}(_0x4fe0,0x1d9));var _0x04fe=function(_0x9749d,_0x208ec1){_0x9749d=_0x9749d-0x0;var _0x14edef=_0x4fe0[_0x9749d];return _0x14edef;};'use strict';var Sequelize=require(_0x04fe('0x0'));module[_0x04fe('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x04fe('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x04fe('0x3')]}}; \ No newline at end of file +var _0x4f05=['sequelize','exports','STRING','name'];(function(_0x5a401e,_0x2de782){var _0x2aa2cc=function(_0x1150e7){while(--_0x1150e7){_0x5a401e['push'](_0x5a401e['shift']());}};_0x2aa2cc(++_0x2de782);}(_0x4f05,0x138));var _0x54f0=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x4f05[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require(_0x54f0('0x0'));module[_0x54f0('0x1')]={'name':{'type':Sequelize[_0x54f0('0x2')],'unique':_0x54f0('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x54f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index fc8c7f3..9fc2035 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 _0x2ee5=['options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','Variables','UserProfileResource','sendStatus','stack','name','index','map','Variable','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter'];(function(_0x4245b7,_0x46a361){var _0x4379dc=function(_0x2cdec7){while(--_0x2cdec7){_0x4245b7['push'](_0x4245b7['shift']());}};_0x4379dc(++_0x46a361);}(_0x2ee5,0x1b1));var _0x52ee=function(_0x3d84d9,_0x51c46c){_0x3d84d9=_0x3d84d9-0x0;var _0x8285b2=_0x2ee5[_0x3d84d9];return _0x8285b2;};'use strict';var emlformat=require(_0x52ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x52ee('0x1'));var jsonpatch=require(_0x52ee('0x2'));var rp=require(_0x52ee('0x3'));var moment=require(_0x52ee('0x4'));var BPromise=require(_0x52ee('0x5'));var Mustache=require(_0x52ee('0x6'));var util=require(_0x52ee('0x7'));var path=require('path');var sox=require(_0x52ee('0x8'));var csv=require(_0x52ee('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x52ee('0xa'));var crypto=require('crypto');var jsforce=require(_0x52ee('0xb'));var deskjs=require(_0x52ee('0xc'));var toCsv=require(_0x52ee('0x9'));var querystring=require(_0x52ee('0xd'));var Papa=require(_0x52ee('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x52ee('0xf'));var as=require(_0x52ee('0x10'));var hardwareService=require(_0x52ee('0x11'));var logger=require(_0x52ee('0x12'))(_0x52ee('0x13'));var utils=require(_0x52ee('0x14'));var config=require(_0x52ee('0x15'));var licenseUtil=require(_0x52ee('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53871f,_0x3152f7){_0x3152f7=_0x3152f7||0xcc;return function(_0x302036){if(_0x302036){return _0x53871f['sendStatus'](_0x3152f7);}return _0x53871f['status'](_0x3152f7)[_0x52ee('0x17')]();};}function respondWithResult(_0xcf2239,_0x4a36b6){_0x4a36b6=_0x4a36b6||0xc8;return function(_0x1cb377){if(_0x1cb377){return _0xcf2239[_0x52ee('0x18')](_0x4a36b6)[_0x52ee('0x19')](_0x1cb377);}};}function respondWithFilteredResult(_0x163879,_0x29ee45){return function(_0x4f25ee){if(_0x4f25ee){var _0x59a1e8=typeof _0x29ee45[_0x52ee('0x1a')]==='undefined'&&typeof _0x29ee45[_0x52ee('0x1b')]===_0x52ee('0x1c');var _0x1f45b5=_0x4f25ee['count'];var _0x5ccb54=_0x59a1e8?0x0:_0x29ee45[_0x52ee('0x1a')];var _0x322663=_0x59a1e8?_0x4f25ee[_0x52ee('0x1d')]:_0x29ee45[_0x52ee('0x1a')]+_0x29ee45[_0x52ee('0x1b')];var _0x13de6b;if(_0x322663>=_0x1f45b5){_0x322663=_0x1f45b5;_0x13de6b=0xc8;}else{_0x13de6b=0xce;}_0x163879[_0x52ee('0x18')](_0x13de6b);return _0x163879[_0x52ee('0x1e')](_0x52ee('0x1f'),_0x5ccb54+'-'+_0x322663+'/'+_0x1f45b5)[_0x52ee('0x19')](_0x4f25ee);}return null;};}function patchUpdates(_0x5a5f54){return function(_0x5d4d64){try{jsonpatch[_0x52ee('0x20')](_0x5d4d64,_0x5a5f54,!![]);}catch(_0xf695aa){return BPromise[_0x52ee('0x21')](_0xf695aa);}return _0x5d4d64['save']();};}function saveUpdates(_0x2ceac9,_0x541534){return function(_0x26084b){if(_0x26084b){return _0x26084b[_0x52ee('0x22')](_0x2ceac9)[_0x52ee('0x23')](function(_0xf504a9){return _0xf504a9;});}return null;};}function removeEntity(_0x4ce2a8,_0x4ee6a7){return function(_0x395c4f){if(_0x395c4f){return _0x395c4f[_0x52ee('0x24')]()[_0x52ee('0x23')](function(){var _0x3a1e52=_0x395c4f[_0x52ee('0x25')]({'plain':!![]});var _0x3bc889=_0x52ee('0x26');return db[_0x52ee('0x27')][_0x52ee('0x24')]({'where':{'type':_0x3bc889,'resourceId':_0x3a1e52['id']}})[_0x52ee('0x23')](function(){return _0x395c4f;});})[_0x52ee('0x23')](function(){_0x4ce2a8['status'](0xcc)[_0x52ee('0x17')]();});}};}function handleEntityNotFound(_0x25fb7c,_0x1477b7){return function(_0x192434){if(!_0x192434){_0x25fb7c[_0x52ee('0x28')](0x194);}return _0x192434;};}function handleError(_0x5c7d62,_0x31d96b){_0x31d96b=_0x31d96b||0x1f4;return function(_0x2d1405){logger['error'](_0x2d1405[_0x52ee('0x29')]);if(_0x2d1405['name']){delete _0x2d1405[_0x52ee('0x2a')];}_0x5c7d62['status'](_0x31d96b)['send'](_0x2d1405);};}exports[_0x52ee('0x2b')]=function(_0x5d8cee,_0x4a9227){var _0x5f1599={},_0x5d25dd={},_0x301477={'count':0x0,'rows':[]};var _0x4550e7=_[_0x52ee('0x2c')](db[_0x52ee('0x2d')]['rawAttributes'],function(_0x2e374e){return{'name':_0x2e374e[_0x52ee('0x2e')],'type':_0x2e374e[_0x52ee('0x2f')]['key']};});_0x5d25dd[_0x52ee('0x30')]=_[_0x52ee('0x2c')](_0x4550e7,_0x52ee('0x2a'));_0x5d25dd['query']=_[_0x52ee('0x31')](_0x5d8cee[_0x52ee('0x32')]);_0x5d25dd[_0x52ee('0x33')]=_[_0x52ee('0x34')](_0x5d25dd[_0x52ee('0x30')],_0x5d25dd[_0x52ee('0x32')]);_0x5f1599[_0x52ee('0x35')]=_[_0x52ee('0x34')](_0x5d25dd[_0x52ee('0x30')],qs[_0x52ee('0x36')](_0x5d8cee[_0x52ee('0x32')][_0x52ee('0x36')]));_0x5f1599['attributes']=_0x5f1599[_0x52ee('0x35')][_0x52ee('0x37')]?_0x5f1599['attributes']:_0x5d25dd[_0x52ee('0x30')];if(!_0x5d8cee[_0x52ee('0x32')][_0x52ee('0x38')](_0x52ee('0x39'))){_0x5f1599[_0x52ee('0x1b')]=qs[_0x52ee('0x1b')](_0x5d8cee[_0x52ee('0x32')]['limit']);_0x5f1599[_0x52ee('0x1a')]=qs[_0x52ee('0x1a')](_0x5d8cee[_0x52ee('0x32')][_0x52ee('0x1a')]);}_0x5f1599[_0x52ee('0x3a')]=qs[_0x52ee('0x3b')](_0x5d8cee[_0x52ee('0x32')]['sort']);_0x5f1599['where']=qs[_0x52ee('0x33')](_[_0x52ee('0x3c')](_0x5d8cee[_0x52ee('0x32')],_0x5d25dd[_0x52ee('0x33')]),_0x4550e7);if(_0x5d8cee[_0x52ee('0x32')]['filter']){_0x5f1599[_0x52ee('0x3d')]=_[_0x52ee('0x3e')](_0x5f1599[_0x52ee('0x3d')],{'$or':_[_0x52ee('0x2c')](_0x4550e7,function(_0x2c33b7){if(_0x2c33b7['type']!==_0x52ee('0x3f')){var _0x2d05a1={};_0x2d05a1[_0x2c33b7['name']]={'$like':'%'+_0x5d8cee[_0x52ee('0x32')][_0x52ee('0x40')]+'%'};return _0x2d05a1;}})});}_0x5f1599=_[_0x52ee('0x3e')]({},_0x5f1599,_0x5d8cee[_0x52ee('0x41')]);var _0x5eeb11={'where':_0x5f1599['where']};return db[_0x52ee('0x2d')][_0x52ee('0x1d')](_0x5eeb11)['then'](function(_0x2d92d4){_0x301477[_0x52ee('0x1d')]=_0x2d92d4;if(_0x5d8cee[_0x52ee('0x32')][_0x52ee('0x42')]){_0x5f1599[_0x52ee('0x43')]=[{'all':!![]}];}return db[_0x52ee('0x2d')][_0x52ee('0x44')](_0x5f1599);})['then'](function(_0x5b4206){_0x301477[_0x52ee('0x45')]=_0x5b4206;return _0x301477;})[_0x52ee('0x23')](respondWithFilteredResult(_0x4a9227,_0x5f1599))[_0x52ee('0x46')](handleError(_0x4a9227,null));};exports[_0x52ee('0x47')]=function(_0x10d6b6,_0x51f3ef){var _0x302e25={'raw':!![],'where':{'id':_0x10d6b6[_0x52ee('0x48')]['id']}},_0x168eee={};_0x168eee[_0x52ee('0x30')]=_[_0x52ee('0x31')](db[_0x52ee('0x2d')][_0x52ee('0x49')]);_0x168eee['query']=_['keys'](_0x10d6b6[_0x52ee('0x32')]);_0x168eee[_0x52ee('0x33')]=_[_0x52ee('0x34')](_0x168eee[_0x52ee('0x30')],_0x168eee[_0x52ee('0x32')]);_0x302e25[_0x52ee('0x35')]=_[_0x52ee('0x34')](_0x168eee[_0x52ee('0x30')],qs[_0x52ee('0x36')](_0x10d6b6[_0x52ee('0x32')]['fields']));_0x302e25[_0x52ee('0x35')]=_0x302e25['attributes'][_0x52ee('0x37')]?_0x302e25[_0x52ee('0x35')]:_0x168eee[_0x52ee('0x30')];if(_0x10d6b6['query'][_0x52ee('0x42')]){_0x302e25['include']=[{'all':!![]}];}_0x302e25=_[_0x52ee('0x3e')]({},_0x302e25,_0x10d6b6[_0x52ee('0x41')]);return db[_0x52ee('0x2d')][_0x52ee('0x4a')](_0x302e25)['then'](handleEntityNotFound(_0x51f3ef,null))[_0x52ee('0x23')](respondWithResult(_0x51f3ef,null))[_0x52ee('0x46')](handleError(_0x51f3ef,null));};exports[_0x52ee('0x4b')]=function(_0x5e4841,_0x4ab94d){return db[_0x52ee('0x2d')][_0x52ee('0x4b')](_0x5e4841[_0x52ee('0x4c')],{})['then'](function(_0x1caaed){var _0x7b90f3=_0x5e4841['user'][_0x52ee('0x25')]({'plain':!![]});if(!_0x7b90f3)throw new Error(_0x52ee('0x4d'));if(_0x7b90f3[_0x52ee('0x4e')]===_0x52ee('0x4f')){var _0x316ebb=_0x1caaed[_0x52ee('0x25')]({'plain':!![]});var _0x4b508b=_0x52ee('0x26');return db[_0x52ee('0x50')][_0x52ee('0x4a')]({'where':{'name':_0x4b508b,'userProfileId':_0x7b90f3[_0x52ee('0x51')]},'raw':!![]})[_0x52ee('0x23')](function(_0x4d5826){if(_0x4d5826&&_0x4d5826['autoAssociation']===0x0){return db[_0x52ee('0x27')][_0x52ee('0x4b')]({'name':_0x316ebb[_0x52ee('0x2a')],'resourceId':_0x316ebb['id'],'type':_0x4d5826[_0x52ee('0x2a')],'sectionId':_0x4d5826['id']},{})[_0x52ee('0x23')](function(){return _0x1caaed;});}else{return _0x1caaed;}})[_0x52ee('0x46')](function(_0xe79c72){logger['error'](_0x52ee('0x52'),_0xe79c72);throw _0xe79c72;});}return _0x1caaed;})[_0x52ee('0x23')](respondWithResult(_0x4ab94d,0xc9))['catch'](handleError(_0x4ab94d,null));};exports[_0x52ee('0x22')]=function(_0x3d4940,_0xe27cb5){if(_0x3d4940[_0x52ee('0x4c')]['id']){delete _0x3d4940[_0x52ee('0x4c')]['id'];}return db[_0x52ee('0x2d')][_0x52ee('0x4a')]({'where':{'id':_0x3d4940[_0x52ee('0x48')]['id']}})[_0x52ee('0x23')](handleEntityNotFound(_0xe27cb5,null))[_0x52ee('0x23')](saveUpdates(_0x3d4940['body'],null))[_0x52ee('0x23')](respondWithResult(_0xe27cb5,null))[_0x52ee('0x46')](handleError(_0xe27cb5,null));};exports[_0x52ee('0x24')]=function(_0x357a25,_0x5acc83){return db[_0x52ee('0x2d')][_0x52ee('0x4a')]({'where':{'id':_0x357a25[_0x52ee('0x48')]['id']}})[_0x52ee('0x23')](handleEntityNotFound(_0x5acc83,null))[_0x52ee('0x23')](removeEntity(_0x5acc83,null))[_0x52ee('0x46')](handleError(_0x5acc83,null));}; \ No newline at end of file +var _0x8dbb=['autoAssociation','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','get','Variables','UserProfileResource','error','stack','name','index','map','Variable','rawAttributes','fieldName','type','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','params','intersection','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0x8dbb,0x142));var _0xb8db=function(_0x2fd674,_0x538865){_0x2fd674=_0x2fd674-0x0;var _0x47e641=_0x8dbb[_0x2fd674];return _0x47e641;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb8db('0x0'));var zipdir=require(_0xb8db('0x1'));var jsonpatch=require(_0xb8db('0x2'));var rp=require(_0xb8db('0x3'));var moment=require(_0xb8db('0x4'));var BPromise=require(_0xb8db('0x5'));var Mustache=require(_0xb8db('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb8db('0x7'));var ejs=require(_0xb8db('0x8'));var fs=require('fs');var fs_extra=require(_0xb8db('0x9'));var _=require('lodash');var squel=require(_0xb8db('0xa'));var crypto=require(_0xb8db('0xb'));var jsforce=require(_0xb8db('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb8db('0x7'));var querystring=require('querystring');var Papa=require(_0xb8db('0xd'));var Redis=require(_0xb8db('0xe'));var authService=require(_0xb8db('0xf'));var qs=require(_0xb8db('0x10'));var as=require(_0xb8db('0x11'));var hardwareService=require(_0xb8db('0x12'));var logger=require(_0xb8db('0x13'))('api');var utils=require(_0xb8db('0x14'));var config=require(_0xb8db('0x15'));var licenseUtil=require(_0xb8db('0x16'));var db=require(_0xb8db('0x17'))['db'];function respondWithStatusCode(_0x10766f,_0x10bb24){_0x10bb24=_0x10bb24||0xcc;return function(_0x1ace2b){if(_0x1ace2b){return _0x10766f[_0xb8db('0x18')](_0x10bb24);}return _0x10766f[_0xb8db('0x19')](_0x10bb24)[_0xb8db('0x1a')]();};}function respondWithResult(_0x1de7b3,_0x369f08){_0x369f08=_0x369f08||0xc8;return function(_0x41419d){if(_0x41419d){return _0x1de7b3['status'](_0x369f08)[_0xb8db('0x1b')](_0x41419d);}};}function respondWithFilteredResult(_0x31a00c,_0xb91aa5){return function(_0x550b74){if(_0x550b74){var _0x3d0ca9=typeof _0xb91aa5[_0xb8db('0x1c')]===_0xb8db('0x1d')&&typeof _0xb91aa5['limit']==='undefined';var _0x372ee2=_0x550b74[_0xb8db('0x1e')];var _0x57856b=_0x3d0ca9?0x0:_0xb91aa5['offset'];var _0x4ca27e=_0x3d0ca9?_0x550b74[_0xb8db('0x1e')]:_0xb91aa5['offset']+_0xb91aa5[_0xb8db('0x1f')];var _0x37fa46;if(_0x4ca27e>=_0x372ee2){_0x4ca27e=_0x372ee2;_0x37fa46=0xc8;}else{_0x37fa46=0xce;}_0x31a00c[_0xb8db('0x19')](_0x37fa46);return _0x31a00c['set'](_0xb8db('0x20'),_0x57856b+'-'+_0x4ca27e+'/'+_0x372ee2)[_0xb8db('0x1b')](_0x550b74);}return null;};}function patchUpdates(_0x444729){return function(_0x33772c){try{jsonpatch[_0xb8db('0x21')](_0x33772c,_0x444729,!![]);}catch(_0x2055cb){return BPromise[_0xb8db('0x22')](_0x2055cb);}return _0x33772c[_0xb8db('0x23')]();};}function saveUpdates(_0x495816,_0xe22329){return function(_0x3ced4a){if(_0x3ced4a){return _0x3ced4a['update'](_0x495816)[_0xb8db('0x24')](function(_0x45609c){return _0x45609c;});}return null;};}function removeEntity(_0x2623bb,_0x5035a2){return function(_0x1d2817){if(_0x1d2817){return _0x1d2817['destroy']()[_0xb8db('0x24')](function(){var _0x5af26e=_0x1d2817[_0xb8db('0x25')]({'plain':!![]});var _0x4265b1=_0xb8db('0x26');return db[_0xb8db('0x27')]['destroy']({'where':{'type':_0x4265b1,'resourceId':_0x5af26e['id']}})['then'](function(){return _0x1d2817;});})['then'](function(){_0x2623bb[_0xb8db('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216ef3,_0x1dd28b){return function(_0x48c584){if(!_0x48c584){_0x216ef3[_0xb8db('0x18')](0x194);}return _0x48c584;};}function handleError(_0x3d5e81,_0x2bfb03){_0x2bfb03=_0x2bfb03||0x1f4;return function(_0x34d167){logger[_0xb8db('0x28')](_0x34d167[_0xb8db('0x29')]);if(_0x34d167[_0xb8db('0x2a')]){delete _0x34d167[_0xb8db('0x2a')];}_0x3d5e81[_0xb8db('0x19')](_0x2bfb03)['send'](_0x34d167);};}exports[_0xb8db('0x2b')]=function(_0x93d008,_0x3e47ed){var _0x90a4e1={},_0x4befa0={},_0x35d1d0={'count':0x0,'rows':[]};var _0x37d1e6=_[_0xb8db('0x2c')](db[_0xb8db('0x2d')][_0xb8db('0x2e')],function(_0x471f73){return{'name':_0x471f73[_0xb8db('0x2f')],'type':_0x471f73[_0xb8db('0x30')]['key']};});_0x4befa0[_0xb8db('0x31')]=_[_0xb8db('0x2c')](_0x37d1e6,_0xb8db('0x2a'));_0x4befa0[_0xb8db('0x32')]=_[_0xb8db('0x33')](_0x93d008['query']);_0x4befa0['filters']=_['intersection'](_0x4befa0[_0xb8db('0x31')],_0x4befa0[_0xb8db('0x32')]);_0x90a4e1['attributes']=_['intersection'](_0x4befa0[_0xb8db('0x31')],qs[_0xb8db('0x34')](_0x93d008['query'][_0xb8db('0x34')]));_0x90a4e1[_0xb8db('0x35')]=_0x90a4e1[_0xb8db('0x35')][_0xb8db('0x36')]?_0x90a4e1[_0xb8db('0x35')]:_0x4befa0[_0xb8db('0x31')];if(!_0x93d008['query'][_0xb8db('0x37')](_0xb8db('0x38'))){_0x90a4e1[_0xb8db('0x1f')]=qs[_0xb8db('0x1f')](_0x93d008['query'][_0xb8db('0x1f')]);_0x90a4e1['offset']=qs[_0xb8db('0x1c')](_0x93d008[_0xb8db('0x32')][_0xb8db('0x1c')]);}_0x90a4e1['order']=qs[_0xb8db('0x39')](_0x93d008[_0xb8db('0x32')]['sort']);_0x90a4e1['where']=qs[_0xb8db('0x3a')](_[_0xb8db('0x3b')](_0x93d008[_0xb8db('0x32')],_0x4befa0[_0xb8db('0x3a')]),_0x37d1e6);if(_0x93d008[_0xb8db('0x32')][_0xb8db('0x3c')]){_0x90a4e1[_0xb8db('0x3d')]=_[_0xb8db('0x3e')](_0x90a4e1[_0xb8db('0x3d')],{'$or':_[_0xb8db('0x2c')](_0x37d1e6,function(_0x1bab0d){if(_0x1bab0d[_0xb8db('0x30')]!==_0xb8db('0x3f')){var _0x3ca6ac={};_0x3ca6ac[_0x1bab0d[_0xb8db('0x2a')]]={'$like':'%'+_0x93d008[_0xb8db('0x32')][_0xb8db('0x3c')]+'%'};return _0x3ca6ac;}})});}_0x90a4e1=_[_0xb8db('0x3e')]({},_0x90a4e1,_0x93d008[_0xb8db('0x40')]);var _0x1a5e74={'where':_0x90a4e1[_0xb8db('0x3d')]};return db[_0xb8db('0x2d')][_0xb8db('0x1e')](_0x1a5e74)[_0xb8db('0x24')](function(_0x5da02e){_0x35d1d0['count']=_0x5da02e;if(_0x93d008['query']['includeAll']){_0x90a4e1[_0xb8db('0x41')]=[{'all':!![]}];}return db[_0xb8db('0x2d')][_0xb8db('0x42')](_0x90a4e1);})[_0xb8db('0x24')](function(_0x48b3a4){_0x35d1d0[_0xb8db('0x43')]=_0x48b3a4;return _0x35d1d0;})[_0xb8db('0x24')](respondWithFilteredResult(_0x3e47ed,_0x90a4e1))['catch'](handleError(_0x3e47ed,null));};exports['show']=function(_0x2d732b,_0x4fb1e2){var _0x1afa2d={'raw':!![],'where':{'id':_0x2d732b[_0xb8db('0x44')]['id']}},_0x3c0db4={};_0x3c0db4[_0xb8db('0x31')]=_[_0xb8db('0x33')](db['Variable'][_0xb8db('0x2e')]);_0x3c0db4['query']=_['keys'](_0x2d732b[_0xb8db('0x32')]);_0x3c0db4[_0xb8db('0x3a')]=_['intersection'](_0x3c0db4[_0xb8db('0x31')],_0x3c0db4[_0xb8db('0x32')]);_0x1afa2d[_0xb8db('0x35')]=_[_0xb8db('0x45')](_0x3c0db4[_0xb8db('0x31')],qs[_0xb8db('0x34')](_0x2d732b[_0xb8db('0x32')]['fields']));_0x1afa2d['attributes']=_0x1afa2d[_0xb8db('0x35')][_0xb8db('0x36')]?_0x1afa2d['attributes']:_0x3c0db4[_0xb8db('0x31')];if(_0x2d732b['query'][_0xb8db('0x46')]){_0x1afa2d[_0xb8db('0x41')]=[{'all':!![]}];}_0x1afa2d=_[_0xb8db('0x3e')]({},_0x1afa2d,_0x2d732b[_0xb8db('0x40')]);return db[_0xb8db('0x2d')][_0xb8db('0x47')](_0x1afa2d)[_0xb8db('0x24')](handleEntityNotFound(_0x4fb1e2,null))[_0xb8db('0x24')](respondWithResult(_0x4fb1e2,null))[_0xb8db('0x48')](handleError(_0x4fb1e2,null));};exports['create']=function(_0xa2836f,_0x2a6676){return db['Variable'][_0xb8db('0x49')](_0xa2836f[_0xb8db('0x4a')],{})[_0xb8db('0x24')](function(_0x2f2939){var _0x1d9538=_0xa2836f[_0xb8db('0x4b')][_0xb8db('0x25')]({'plain':!![]});if(!_0x1d9538)throw new Error(_0xb8db('0x4c'));if(_0x1d9538[_0xb8db('0x4d')]==='user'){var _0x26ab5c=_0x2f2939[_0xb8db('0x25')]({'plain':!![]});var _0x49577c='Variables';return db['UserProfileSection'][_0xb8db('0x47')]({'where':{'name':_0x49577c,'userProfileId':_0x1d9538['userProfileId']},'raw':!![]})[_0xb8db('0x24')](function(_0x139153){if(_0x139153&&_0x139153[_0xb8db('0x4e')]===0x0){return db[_0xb8db('0x27')][_0xb8db('0x49')]({'name':_0x26ab5c[_0xb8db('0x2a')],'resourceId':_0x26ab5c['id'],'type':_0x139153[_0xb8db('0x2a')],'sectionId':_0x139153['id']},{})[_0xb8db('0x24')](function(){return _0x2f2939;});}else{return _0x2f2939;}})[_0xb8db('0x48')](function(_0x4066e5){logger[_0xb8db('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4066e5);throw _0x4066e5;});}return _0x2f2939;})['then'](respondWithResult(_0x2a6676,0xc9))[_0xb8db('0x48')](handleError(_0x2a6676,null));};exports[_0xb8db('0x4f')]=function(_0x2a9103,_0x1b122a){if(_0x2a9103[_0xb8db('0x4a')]['id']){delete _0x2a9103[_0xb8db('0x4a')]['id'];}return db[_0xb8db('0x2d')][_0xb8db('0x47')]({'where':{'id':_0x2a9103[_0xb8db('0x44')]['id']}})[_0xb8db('0x24')](handleEntityNotFound(_0x1b122a,null))[_0xb8db('0x24')](saveUpdates(_0x2a9103[_0xb8db('0x4a')],null))['then'](respondWithResult(_0x1b122a,null))['catch'](handleError(_0x1b122a,null));};exports['destroy']=function(_0x129ae0,_0xccdc49){return db[_0xb8db('0x2d')][_0xb8db('0x47')]({'where':{'id':_0x129ae0['params']['id']}})[_0xb8db('0x24')](handleEntityNotFound(_0xccdc49,null))[_0xb8db('0x24')](removeEntity(_0xccdc49,null))[_0xb8db('0x48')](handleError(_0xccdc49,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 8fee99d..0bbeccd 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 _0x4434=['path','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2be18d,_0x4c8b2e){var _0x35e50d=function(_0x4d10d6){while(--_0x4d10d6){_0x2be18d['push'](_0x2be18d['shift']());}};_0x35e50d(++_0x4c8b2e);}(_0x4434,0xc9));var _0x4443=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4434[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x4443('0x0'));var util=require(_0x4443('0x1'));var logger=require(_0x4443('0x2'))(_0x4443('0x3'));var moment=require(_0x4443('0x4'));var BPromise=require(_0x4443('0x5'));var rp=require(_0x4443('0x6'));var fs=require('fs');var path=require(_0x4443('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4443('0x8'));module[_0x4443('0x9')]=function(_0x47be43,_0x6e6313){return _0x47be43[_0x4443('0xa')](_0x4443('0xb'),attributes,{'tableName':_0x4443('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8183=['path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8183,0x12e));var _0x3818=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x8183[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x3818('0x0'));var util=require(_0x3818('0x1'));var logger=require(_0x3818('0x2'))(_0x3818('0x3'));var moment=require(_0x3818('0x4'));var BPromise=require('bluebird');var rp=require(_0x3818('0x5'));var fs=require('fs');var path=require(_0x3818('0x6'));var rimraf=require(_0x3818('0x7'));var config=require(_0x3818('0x8'));var attributes=require(_0x3818('0x9'));module[_0x3818('0xa')]=function(_0x299170,_0xde9c61){return _0x299170[_0x3818('0xb')](_0x3818('0xc'),attributes,{'tableName':_0x3818('0xd'),'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 99ae274..a3085f0 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 _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x839ecb,_0x1044d2){var _0x3d7e87=function(_0x28e00a){while(--_0x28e00a){_0x839ecb['push'](_0x839ecb['shift']());}};_0x3d7e87(++_0x1044d2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0x5fc3[_0x23a79e];return _0x3dab57;};'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')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\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']('Variable,\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);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xa41a,0x6b));var _0xaa41=function(_0x23895d,_0x44bc37){_0x23895d=_0x23895d-0x0;var _0x42cb14=_0xa41a[_0x23895d];return _0x42cb14;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 91a2b09..61b8ef6 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 _0xf069=['exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations'];(function(_0x455abf,_0x4ae86d){var _0x3ab136=function(_0x2f6199){while(--_0x2f6199){_0x455abf['push'](_0x455abf['shift']());}};_0x3ab136(++_0x4ae86d);}(_0xf069,0xb5));var _0x9f06=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf069[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x9f06('0x0'));var router=express[_0x9f06('0x1')]();var auth=require(_0x9f06('0x2'));var controller=require(_0x9f06('0x3'));router[_0x9f06('0x4')]('/',controller[_0x9f06('0x5')]);router[_0x9f06('0x4')](_0x9f06('0x6'),auth[_0x9f06('0x7')](),auth[_0x9f06('0x8')](),controller[_0x9f06('0x9')]);router[_0x9f06('0x4')](_0x9f06('0xa'),auth['isAuthenticated'](),auth[_0x9f06('0x8')](),controller[_0x9f06('0xb')]);router[_0x9f06('0x4')](_0x9f06('0xc'),auth[_0x9f06('0x7')](),auth[_0x9f06('0x8')](),controller[_0x9f06('0xd')]);router[_0x9f06('0x4')](_0x9f06('0xe'),auth[_0x9f06('0x7')](),controller[_0x9f06('0xf')]);router[_0x9f06('0x4')](_0x9f06('0x10'),controller['migrations']);module[_0x9f06('0x11')]=router; \ No newline at end of file +var _0x3d57=['index','fetch','reset','isAuthenticated','canUpdate','/restart','restart','/migrations','exports','express','Router','get'];(function(_0x25f6a7,_0x56af41){var _0x5870bb=function(_0xd44fba){while(--_0xd44fba){_0x25f6a7['push'](_0x25f6a7['shift']());}};_0x5870bb(++_0x56af41);}(_0x3d57,0xa5));var _0x73d5=function(_0x478c75,_0x4547a3){_0x478c75=_0x478c75-0x0;var _0x1250c1=_0x3d57[_0x478c75];return _0x1250c1;};'use strict';var express=require(_0x73d5('0x0'));var router=express[_0x73d5('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x73d5('0x2')]('/',controller[_0x73d5('0x3')]);router[_0x73d5('0x2')]('/fetch',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x73d5('0x4')]);router[_0x73d5('0x2')]('/reset',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x73d5('0x5')]);router[_0x73d5('0x2')]('/pull',auth[_0x73d5('0x6')](),auth[_0x73d5('0x7')](),controller['pull']);router[_0x73d5('0x2')](_0x73d5('0x8'),auth[_0x73d5('0x6')](),controller[_0x73d5('0x9')]);router['get'](_0x73d5('0xa'),controller['migrations']);module[_0x73d5('0xb')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 24a134b..2665a09 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 _0x84e8=['sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','index','exports','query','latest','fetch','tags','status','json','origin','master','error','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','join','root','server','migrations','length','replace','.js','push','sort'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0x84e8,0x1ba));var _0x884e=function(_0xd8fc44,_0xf97267){_0xd8fc44=_0xd8fc44-0x0;var _0x23994c=_0x84e8[_0xd8fc44];return _0x23994c;};'use strict';var Umzug=require(_0x884e('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x884e('0x1'));var pkginfo=require(_0x884e('0x2'))(module,_0x884e('0x3'));var compareVersions=require(_0x884e('0x4'));var exec=require(_0x884e('0x5'))[_0x884e('0x6')];var db=require(_0x884e('0x7'))['db'];var config=require(_0x884e('0x8'));var pm2=require('../../config/pm2');var logger=require(_0x884e('0x9'))(_0x884e('0xa'));var git=require(_0x884e('0xb'))(config['root']);exports[_0x884e('0xc')]=function(_0x19d4de,_0x119cef){var _0x2dc33e={'current':module[_0x884e('0xd')]['version'],'phonebar':0x2};if(_0x19d4de[_0x884e('0xe')]&&_0x19d4de['query'][_0x884e('0xf')]){return git[_0x884e('0x10')]()[_0x884e('0x11')](function(_0x5d80e7,_0x13bb64){_0x2dc33e[_0x884e('0xf')]=(_0x5d80e7?module[_0x884e('0xd')][_0x884e('0x3')]:_0x13bb64[_0x884e('0xf')])||'2.0.0';return _0x119cef[_0x884e('0x12')](0xc8)['json'](_0x2dc33e);});}else{return _0x119cef[_0x884e('0x12')](0xc8)[_0x884e('0x13')](_0x2dc33e);}};exports['fetch']=function(_0x14ece4,_0x4a43e1){return git[_0x884e('0x10')]([_0x884e('0x14'),_0x884e('0x15')],function(_0xbb5ec6){if(_0xbb5ec6){logger[_0x884e('0x16')](_0xbb5ec6);return _0x4a43e1['status'](0x1f4)[_0x884e('0x13')](_0xbb5ec6);}logger['info']('git\x20fetch');return _0x4a43e1[_0x884e('0x12')](0xc8)[_0x884e('0x13')]({'output':_0x884e('0x17')});});};exports[_0x884e('0x18')]=function(_0x5177a3,_0x44b15e){return git[_0x884e('0x18')]([_0x884e('0x19'),_0x884e('0x1a')],function(_0x1ac7c5){if(_0x1ac7c5){logger[_0x884e('0x16')](_0x1ac7c5);return _0x44b15e[_0x884e('0x12')](0x1f4)[_0x884e('0x13')](_0x1ac7c5);}logger[_0x884e('0x1b')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x44b15e[_0x884e('0x12')](0xc8)[_0x884e('0x13')]({'output':_0x884e('0x1c')});});};exports[_0x884e('0x1d')]=function(_0x26b05c,_0x273e52){exec(_0x884e('0x1e'),function(_0x3569b5,_0x2153bc,_0x1e4156){logger[_0x884e('0x1b')](_0x2153bc);logger[_0x884e('0x1b')](_0x1e4156);if(_0x3569b5){logger[_0x884e('0x16')](_0x3569b5);return _0x273e52[_0x884e('0x12')](0x1f4)['json'](_0x3569b5);}return _0x273e52[_0x884e('0x12')](0xc8)[_0x884e('0x13')]({'output':_0x2153bc});});};exports['restart']=function(_0x71be84,_0x32a384){return pm2[_0x884e('0x1f')]('motion2')['then'](function(_0x2af768){logger[_0x884e('0x1b')](_0x884e('0x20'),_0x2af768);return _0x32a384[_0x884e('0x12')](0xc8)[_0x884e('0x13')]({'output':_0x884e('0x21')});})[_0x884e('0x22')](function(_0x1a20f7){logger[_0x884e('0x16')](_0x1a20f7);return _0x32a384['status'](0x1f4)[_0x884e('0x13')](_0x1a20f7);});};exports['migrations']=function(_0xdd8d31,_0x24b800){var _0x1e325a=fs['readdirSync'](path[_0x884e('0x23')](config[_0x884e('0x24')],_0x884e('0x25'),_0x884e('0x26')));var _0x3144ed=[];for(var _0x164715=0x0;_0x164715<_0x1e325a[_0x884e('0x27')];_0x164715++){var _0x406e8a=_0x1e325a[_0x164715][_0x884e('0x28')](_0x884e('0x29'),'');if(compareVersions(module['exports'][_0x884e('0x3')],_0x406e8a)===-0x1){_0x3144ed[_0x884e('0x2a')](_0x406e8a);}}if(_0x3144ed['length']){var _0x3f9cb2=_0x3144ed[_0x884e('0x2b')](compareVersions);var _0x378480=new Umzug({'storage':_0x884e('0x2c'),'storageOptions':{'model':db[_0x884e('0x2d')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x884e('0x2c')]['getQueryInterface'](),db['sequelize'][_0x884e('0x2e')],function(){throw new Error(_0x884e('0x2f'));}],'path':path[_0x884e('0x23')](config[_0x884e('0x24')],_0x884e('0x25'),_0x884e('0x26')),'pattern':/\.js$/}});_0x378480['up']({'migrations':_[_0x884e('0x30')](_0x3f9cb2,function(_0x505bf2){return _0x505bf2+_0x884e('0x29');})})[_0x884e('0x31')](function(){return _0x24b800[_0x884e('0x12')](0xc8)[_0x884e('0x13')]({'output':_0x884e('0x32')+module[_0x884e('0xd')][_0x884e('0x3')]+'\x20to\x20'+_[_0x884e('0x33')](_0x3f9cb2),'migrations':_[_0x884e('0x23')](_0x3f9cb2)});})['catch'](function(_0x367d62){if(_0x367d62 instanceof db[_0x884e('0x2c')][_0x884e('0x34')]){return _0x24b800[_0x884e('0x12')](0xc8)[_0x884e('0x13')]({'output':_0x884e('0x35')});}else{return _0x24b800[_0x884e('0x12')](0x1f4)[_0x884e('0x13')](_0x367d62);}});}else{return _0x24b800[_0x884e('0x12')](0xc8)[_0x884e('0x13')]({'output':_0x884e('0x35')});}}; \ No newline at end of file +var _0x1dc5=['git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','join','server','replace','.js','length','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','index','exports','query','tags','latest','2.0.0','status','json','error','info'];(function(_0x3ccb80,_0xac04e1){var _0x11d47e=function(_0x212849){while(--_0x212849){_0x3ccb80['push'](_0x3ccb80['shift']());}};_0x11d47e(++_0xac04e1);}(_0x1dc5,0x80));var _0x51dc=function(_0xb22ef4,_0x518e17){_0xb22ef4=_0xb22ef4-0x0;var _0x3f7a11=_0x1dc5[_0xb22ef4];return _0x3f7a11;};'use strict';var Umzug=require('umzug');var path=require(_0x51dc('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x51dc('0x1'))(module,_0x51dc('0x2'));var compareVersions=require(_0x51dc('0x3'));var exec=require(_0x51dc('0x4'))[_0x51dc('0x5')];var db=require(_0x51dc('0x6'))['db'];var config=require(_0x51dc('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x51dc('0x8'))(_0x51dc('0x9'));var git=require(_0x51dc('0xa'))(config[_0x51dc('0xb')]);exports[_0x51dc('0xc')]=function(_0x4c7e3c,_0x429644){var _0x2a8945={'current':module[_0x51dc('0xd')][_0x51dc('0x2')],'phonebar':0x2};if(_0x4c7e3c[_0x51dc('0xe')]&&_0x4c7e3c[_0x51dc('0xe')]['latest']){return git['fetch']()[_0x51dc('0xf')](function(_0x4fc43b,_0x2a4ca4){_0x2a8945[_0x51dc('0x10')]=(_0x4fc43b?module['exports'][_0x51dc('0x2')]:_0x2a4ca4[_0x51dc('0x10')])||_0x51dc('0x11');return _0x429644[_0x51dc('0x12')](0xc8)[_0x51dc('0x13')](_0x2a8945);});}else{return _0x429644[_0x51dc('0x12')](0xc8)[_0x51dc('0x13')](_0x2a8945);}};exports['fetch']=function(_0x477c8d,_0x1d4d9e){return git['fetch'](['origin','master'],function(_0xb8c406){if(_0xb8c406){logger[_0x51dc('0x14')](_0xb8c406);return _0x1d4d9e[_0x51dc('0x12')](0x1f4)['json'](_0xb8c406);}logger[_0x51dc('0x15')](_0x51dc('0x16'));return _0x1d4d9e[_0x51dc('0x12')](0xc8)[_0x51dc('0x13')]({'output':_0x51dc('0x17')});});};exports[_0x51dc('0x18')]=function(_0x546eb2,_0x2efe94){return git['reset']([_0x51dc('0x19'),'FETCH_HEAD'],function(_0x5b85fa){if(_0x5b85fa){logger[_0x51dc('0x14')](_0x5b85fa);return _0x2efe94[_0x51dc('0x12')](0x1f4)[_0x51dc('0x13')](_0x5b85fa);}logger[_0x51dc('0x15')](_0x51dc('0x1a'));return _0x2efe94[_0x51dc('0x12')](0xc8)[_0x51dc('0x13')]({'output':_0x51dc('0x1b')});});};exports[_0x51dc('0x1c')]=function(_0x5d846c,_0x393658){exec(_0x51dc('0x1d'),function(_0x2a25dc,_0x8476f8,_0x46395b){logger['info'](_0x8476f8);logger[_0x51dc('0x15')](_0x46395b);if(_0x2a25dc){logger[_0x51dc('0x14')](_0x2a25dc);return _0x393658[_0x51dc('0x12')](0x1f4)[_0x51dc('0x13')](_0x2a25dc);}return _0x393658[_0x51dc('0x12')](0xc8)[_0x51dc('0x13')]({'output':_0x8476f8});});};exports[_0x51dc('0x1e')]=function(_0x51f50f,_0x56a054){return pm2['restart'](_0x51dc('0x1f'))[_0x51dc('0x20')](function(_0x3ebffc){logger[_0x51dc('0x15')](_0x51dc('0x21'),_0x3ebffc);return _0x56a054['status'](0xc8)[_0x51dc('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x51dc('0x22')](function(_0x356574){logger['error'](_0x356574);return _0x56a054['status'](0x1f4)['json'](_0x356574);});};exports[_0x51dc('0x23')]=function(_0x5d6fd9,_0x1c1786){var _0xd067df=fs['readdirSync'](path[_0x51dc('0x24')](config['root'],_0x51dc('0x25'),_0x51dc('0x23')));var _0xccaa83=[];for(var _0x266b78=0x0;_0x266b78<_0xd067df['length'];_0x266b78++){var _0x49c9fb=_0xd067df[_0x266b78][_0x51dc('0x26')](_0x51dc('0x27'),'');if(compareVersions(module['exports'][_0x51dc('0x2')],_0x49c9fb)===-0x1){_0xccaa83['push'](_0x49c9fb);}}if(_0xccaa83[_0x51dc('0x28')]){var _0x58c522=_0xccaa83['sort'](compareVersions);var _0x5ebd71=new Umzug({'storage':_0x51dc('0x29'),'storageOptions':{'model':db[_0x51dc('0x2a')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x51dc('0x29')][_0x51dc('0x2b')](),db[_0x51dc('0x29')]['constructor'],function(){throw new Error(_0x51dc('0x2c'));}],'path':path[_0x51dc('0x24')](config[_0x51dc('0xb')],'server',_0x51dc('0x23')),'pattern':/\.js$/}});_0x5ebd71['up']({'migrations':_[_0x51dc('0x2d')](_0x58c522,function(_0x232ed9){return _0x232ed9+_0x51dc('0x27');})})['then'](function(){return _0x1c1786[_0x51dc('0x12')](0xc8)[_0x51dc('0x13')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x51dc('0xd')]['version']+_0x51dc('0x2e')+_[_0x51dc('0x2f')](_0x58c522),'migrations':_[_0x51dc('0x24')](_0x58c522)});})[_0x51dc('0x22')](function(_0x10ffe5){if(_0x10ffe5 instanceof db[_0x51dc('0x29')][_0x51dc('0x30')]){return _0x1c1786[_0x51dc('0x12')](0xc8)[_0x51dc('0x13')]({'output':_0x51dc('0x31')});}else{return _0x1c1786[_0x51dc('0x12')](0x1f4)[_0x51dc('0x13')](_0x10ffe5);}});}else{return _0x1c1786[_0x51dc('0x12')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 21cc26c..c015f24 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 _0x5475=['../../config/environment','./voiceAgentReport.controller','get','index','/describe','describe','isAuthenticated','show','post','put','/:id','delete','destroy','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x270249,_0x3bb2d7){var _0x2297fa=function(_0x18d665){while(--_0x18d665){_0x270249['push'](_0x270249['shift']());}};_0x2297fa(++_0x3bb2d7);}(_0x5475,0xea));var _0x5547=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x5475[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5547('0x0'));var timeout=require('connect-timeout');var express=require(_0x5547('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5547('0x2'));var interaction=require(_0x5547('0x3'));var config=require(_0x5547('0x4'));var controller=require(_0x5547('0x5'));router[_0x5547('0x6')]('/',auth['isAuthenticated'](),controller[_0x5547('0x7')]);router['get'](_0x5547('0x8'),auth['isAuthenticated'](),controller[_0x5547('0x9')]);router['get']('/:id',auth[_0x5547('0xa')](),controller[_0x5547('0xb')]);router[_0x5547('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5547('0xd')](_0x5547('0xe'),auth[_0x5547('0xa')](),controller['update']);router[_0x5547('0xf')]('/:id',auth[_0x5547('0xa')](),controller[_0x5547('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1be0=['../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','post','put','/:id','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0xa47d22,_0x1a1705){var _0x4e03ba=function(_0x5cb9d1){while(--_0x5cb9d1){_0xa47d22['push'](_0xa47d22['shift']());}};_0x4e03ba(++_0x1a1705);}(_0x1be0,0x1d5));var _0x01be=function(_0x403d4e,_0x2293cd){_0x403d4e=_0x403d4e-0x0;var _0x393ada=_0x1be0[_0x403d4e];return _0x393ada;};'use strict';var multer=require(_0x01be('0x0'));var util=require(_0x01be('0x1'));var path=require('path');var timeout=require(_0x01be('0x2'));var express=require('express');var router=express[_0x01be('0x3')]();var fs_extra=require(_0x01be('0x4'));var auth=require(_0x01be('0x5'));var interaction=require(_0x01be('0x6'));var config=require('../../config/environment');var controller=require(_0x01be('0x7'));router[_0x01be('0x8')]('/',auth[_0x01be('0x9')](),controller[_0x01be('0xa')]);router[_0x01be('0x8')](_0x01be('0xb'),auth[_0x01be('0x9')](),controller[_0x01be('0xc')]);router[_0x01be('0x8')]('/:id',auth[_0x01be('0x9')](),controller['show']);router[_0x01be('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x01be('0xe')](_0x01be('0xf'),auth['isAuthenticated'](),controller[_0x01be('0x10')]);router[_0x01be('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x01be('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index c4f42f8..ddf8db3 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 _0xb91a=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x252b2d,_0x1af93){var _0x56c98b=function(_0x320923){while(--_0x320923){_0x252b2d['push'](_0x252b2d['shift']());}};_0x56c98b(++_0x1af93);}(_0xb91a,0xe5));var _0xab91=function(_0x1795cd,_0x560662){_0x1795cd=_0x1795cd-0x0;var _0x219ca0=_0xb91a[_0x1795cd];return _0x219ca0;};'use strict';var Sequelize=require('sequelize');module[_0xab91('0x0')]={'type':{'type':Sequelize[_0xab91('0x1')]},'uniqueid':{'type':Sequelize[_0xab91('0x1')]},'calleridnum':{'type':Sequelize[_0xab91('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xab91('0x1')]},'interface':{'type':Sequelize[_0xab91('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xab91('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xab91('0x2')]},'agentdumpAt':{'type':Sequelize[_0xab91('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xab91('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xab91('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xab91('0x4')]},'agentacw':{'type':Sequelize[_0xab91('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xab91('0x1')]},'channelstate':{'type':Sequelize[_0xab91('0x4')]},'channelstatedesc':{'type':Sequelize[_0xab91('0x1')]},'connectedlinenum':{'type':Sequelize[_0xab91('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xab91('0x1')]},'accountcode':{'type':Sequelize[_0xab91('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xab91('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xab91('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xab91('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xab91('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xab91('0x1')]},'destlanguage':{'type':Sequelize[_0xab91('0x1')]},'destaccountcode':{'type':Sequelize[_0xab91('0x1')]},'destcontext':{'type':Sequelize[_0xab91('0x1')]},'destexten':{'type':Sequelize[_0xab91('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xab91('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xab91('0x1')]},'transfer':{'type':Sequelize[_0xab91('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xab91('0x1')],'comment':_0xab91('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xab91('0x1')]},'agententerreason':{'type':Sequelize[_0xab91('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8227=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x8227,0x146));var _0x7822=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8227[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x7822('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7822('0x1')]},'calleridnum':{'type':Sequelize[_0x7822('0x1')]},'calleridname':{'type':Sequelize[_0x7822('0x1')]},'queue':{'type':Sequelize[_0x7822('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7822('0x1')]},'agentcalledAt':{'type':Sequelize[_0x7822('0x2')]},'agentconnectAt':{'type':Sequelize[_0x7822('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x7822('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x7822('0x2')]},'agentdumpAt':{'type':Sequelize[_0x7822('0x2')]},'holdtime':{'type':Sequelize[_0x7822('0x3')]},'agentcomplete':{'type':Sequelize[_0x7822('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7822('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x7822('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7822('0x3')]},'reason':{'type':Sequelize[_0x7822('0x1')]},'lastevent':{'type':Sequelize[_0x7822('0x1')]},'channel':{'type':Sequelize[_0x7822('0x1')]},'channelstate':{'type':Sequelize[_0x7822('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7822('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7822('0x1')]},'context':{'type':Sequelize[_0x7822('0x1')]},'exten':{'type':Sequelize[_0x7822('0x1')]},'priority':{'type':Sequelize[_0x7822('0x1')]},'destchannel':{'type':Sequelize[_0x7822('0x1')]},'destchannelstate':{'type':Sequelize[_0x7822('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7822('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7822('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x7822('0x1')]},'destaccountcode':{'type':Sequelize[_0x7822('0x1')]},'destcontext':{'type':Sequelize[_0x7822('0x1')]},'destexten':{'type':Sequelize[_0x7822('0x1')]},'destpriority':{'type':Sequelize[_0x7822('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x7822('0x1')]},'transfer':{'type':Sequelize[_0x7822('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7822('0x1')],'comment':_0x7822('0x5')},'transferexten':{'type':Sequelize[_0x7822('0x1')]},'transferuniqueid':{'type':Sequelize[_0x7822('0x1')]},'agententerreason':{'type':Sequelize[_0x7822('0x3')],'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 97945bc..7008c89 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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 bedf0a2..f6c3993 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 _0xf1e1=['exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x4b8d64,_0x5a1deb){var _0x30c61d=function(_0x95ee7f){while(--_0x95ee7f){_0x4b8d64['push'](_0x4b8d64['shift']());}};_0x30c61d(++_0x5a1deb);}(_0xf1e1,0x102));var _0x1f1e=function(_0x96b6a,_0x12471d){_0x96b6a=_0x96b6a-0x0;var _0x3e16f3=_0xf1e1[_0x96b6a];return _0x3e16f3;};'use strict';var _=require(_0x1f1e('0x0'));var util=require('util');var logger=require(_0x1f1e('0x1'))('api');var moment=require(_0x1f1e('0x2'));var BPromise=require('bluebird');var rp=require(_0x1f1e('0x3'));var fs=require('fs');var path=require(_0x1f1e('0x4'));var rimraf=require(_0x1f1e('0x5'));var config=require(_0x1f1e('0x6'));var attributes=require(_0x1f1e('0x7'));module[_0x1f1e('0x8')]=function(_0x1bdcee,_0x3242af){return _0x1bdcee[_0x1f1e('0x9')](_0x1f1e('0xa'),attributes,{'tableName':_0x1f1e('0xb'),'paranoid':![],'indexes':[{'fields':[_0x1f1e('0xc'),_0x1f1e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f0d=['uniqueid','destuniqueid','bluebird','request-promise','path','../../config/environment','define','VoiceAgentReport'];(function(_0x662ab6,_0x43f75b){var _0x14ade2=function(_0x1cafe6){while(--_0x1cafe6){_0x662ab6['push'](_0x662ab6['shift']());}};_0x14ade2(++_0x43f75b);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0xc80b2b,_0x5a12e9){_0xc80b2b=_0xc80b2b-0x0;var _0x22af6f=_0x4f0d[_0xc80b2b];return _0x22af6f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd4f0('0x0'));var rp=require(_0xd4f0('0x1'));var fs=require('fs');var path=require(_0xd4f0('0x2'));var rimraf=require('rimraf');var config=require(_0xd4f0('0x3'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x1809dd,_0x4da370){return _0x1809dd[_0xd4f0('0x4')](_0xd4f0('0x5'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xd4f0('0x6'),_0xd4f0('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index beafb90..4d02b4e 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 _0x3e10=['info','catch','UpdateVoiceAgentReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x3e10,0x106));var _0x03e1=function(_0x58ce68,_0x47bc99){_0x58ce68=_0x58ce68-0x0;var _0x1dd15f=_0x3e10[_0x58ce68];return _0x1dd15f;};'use strict';var _=require(_0x03e1('0x0'));var util=require(_0x03e1('0x1'));var moment=require(_0x03e1('0x2'));var BPromise=require(_0x03e1('0x3'));var rs=require(_0x03e1('0x4'));var fs=require('fs');var Redis=require(_0x03e1('0x5'));var db=require(_0x03e1('0x6'))['db'];var utils=require(_0x03e1('0x7'));var logger=require(_0x03e1('0x8'))(_0x03e1('0x9'));var config=require(_0x03e1('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x503ac6,_0x559637,_0x5aa56b){return new BPromise(function(_0x2d979e,_0x31136e){return client[_0x03e1('0xb')](_0x503ac6,_0x5aa56b)[_0x03e1('0xc')](function(_0x25f98a){logger['info'](_0x03e1('0xd'),_0x559637,'request\x20sent');logger[_0x03e1('0xe')](_0x03e1('0xf'),_0x559637,'request\x20sent',JSON[_0x03e1('0x10')](_0x25f98a));if(_0x25f98a[_0x03e1('0x11')]){if(_0x25f98a[_0x03e1('0x11')][_0x03e1('0x12')]===0x1f4){logger[_0x03e1('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x559637,_0x25f98a[_0x03e1('0x11')][_0x03e1('0x13')]);return _0x31136e(_0x25f98a[_0x03e1('0x11')]['message']);}logger['error'](_0x03e1('0xd'),_0x559637,_0x25f98a[_0x03e1('0x11')][_0x03e1('0x13')]);return _0x2d979e(_0x25f98a['error'][_0x03e1('0x13')]);}else{logger['info'](_0x03e1('0xd'),_0x559637,'request\x20sent');_0x2d979e(_0x25f98a[_0x03e1('0x14')]['message']);}})['catch'](function(_0x53c396){logger[_0x03e1('0x11')](_0x03e1('0xd'),_0x559637,_0x53c396);_0x31136e(_0x53c396);});});}exports[_0x03e1('0x15')]=function(_0x3f4dc7){var _0x5af394=this;return new Promise(function(_0x5db44b,_0x4a42e3){return db[_0x03e1('0x16')]['create'](_0x3f4dc7[_0x03e1('0x17')],{'raw':_0x3f4dc7['options']?_0x3f4dc7[_0x03e1('0x18')][_0x03e1('0x19')]===undefined?!![]:![]:!![]})[_0x03e1('0xc')](function(_0xca0434){logger[_0x03e1('0x1a')](_0x03e1('0x15'),_0x3f4dc7);logger[_0x03e1('0xe')](_0x03e1('0x15'),_0x3f4dc7,JSON[_0x03e1('0x10')](_0xca0434));_0x5db44b(_0xca0434);})[_0x03e1('0x1b')](function(_0x599bf3){logger['error'](_0x03e1('0x15'),_0x599bf3[_0x03e1('0x13')],_0x3f4dc7);_0x4a42e3(_0x5af394['error'](0x1f4,_0x599bf3[_0x03e1('0x13')]));});});};exports[_0x03e1('0x1c')]=function(_0x55c647){var _0x376f15=this;return new Promise(function(_0x85cd9,_0x5aa6de){return db[_0x03e1('0x16')]['update'](_0x55c647[_0x03e1('0x17')],{'raw':_0x55c647[_0x03e1('0x18')]?_0x55c647[_0x03e1('0x18')][_0x03e1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55c647['options']?_0x55c647[_0x03e1('0x18')][_0x03e1('0x1d')]||null:null,'attributes':_0x55c647[_0x03e1('0x18')]?_0x55c647[_0x03e1('0x18')][_0x03e1('0x1e')]||null:null,'limit':_0x55c647[_0x03e1('0x18')]?_0x55c647[_0x03e1('0x18')][_0x03e1('0x1f')]||null:null})[_0x03e1('0xc')](function(_0x2f53){logger[_0x03e1('0x1a')]('UpdateVoiceAgentReport',_0x55c647);logger[_0x03e1('0xe')](_0x03e1('0x1c'),_0x55c647,JSON[_0x03e1('0x10')](_0x2f53));_0x85cd9(_0x2f53);})[_0x03e1('0x1b')](function(_0x567213){logger['error'](_0x03e1('0x1c'),_0x567213['message'],_0x55c647);_0x5aa6de(_0x376f15[_0x03e1('0x11')](0x1f4,_0x567213[_0x03e1('0x13')]));});});}; \ No newline at end of file +var _0xc865=['then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','body','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x5e076c,_0x5af2a1){var _0x1984b6=function(_0x3cf1d6){while(--_0x3cf1d6){_0x5e076c['push'](_0x5e076c['shift']());}};_0x1984b6(++_0x5af2a1);}(_0xc865,0x74));var _0x5c86=function(_0x55f5f7,_0x4cf4d8){_0x55f5f7=_0x55f5f7-0x0;var _0x548e79=_0xc865[_0x55f5f7];return _0x548e79;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5c86('0x0'));var BPromise=require(_0x5c86('0x1'));var rs=require(_0x5c86('0x2'));var fs=require('fs');var Redis=require(_0x5c86('0x3'));var db=require(_0x5c86('0x4'))['db'];var utils=require(_0x5c86('0x5'));var logger=require(_0x5c86('0x6'))(_0x5c86('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c86('0x8'));var client=jayson[_0x5c86('0x9')][_0x5c86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe6a030,_0x5a9ed7,_0x437b0f){return new BPromise(function(_0x21994e,_0x237a94){return client[_0x5c86('0xb')](_0xe6a030,_0x437b0f)[_0x5c86('0xc')](function(_0x2d4d6f){logger[_0x5c86('0xd')](_0x5c86('0xe'),_0x5a9ed7,_0x5c86('0xf'));logger[_0x5c86('0x10')](_0x5c86('0x11'),_0x5a9ed7,_0x5c86('0xf'),JSON[_0x5c86('0x12')](_0x2d4d6f));if(_0x2d4d6f[_0x5c86('0x13')]){if(_0x2d4d6f[_0x5c86('0x13')][_0x5c86('0x14')]===0x1f4){logger['error'](_0x5c86('0xe'),_0x5a9ed7,_0x2d4d6f[_0x5c86('0x13')][_0x5c86('0x15')]);return _0x237a94(_0x2d4d6f[_0x5c86('0x13')][_0x5c86('0x15')]);}logger['error'](_0x5c86('0xe'),_0x5a9ed7,_0x2d4d6f[_0x5c86('0x13')][_0x5c86('0x15')]);return _0x21994e(_0x2d4d6f['error'][_0x5c86('0x15')]);}else{logger[_0x5c86('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x5a9ed7,_0x5c86('0xf'));_0x21994e(_0x2d4d6f['result'][_0x5c86('0x15')]);}})[_0x5c86('0x16')](function(_0x2b9a63){logger[_0x5c86('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x5a9ed7,_0x2b9a63);_0x237a94(_0x2b9a63);});});}exports[_0x5c86('0x17')]=function(_0x36a998){var _0x376391=this;return new Promise(function(_0xfe8c02,_0x4bc7d0){return db[_0x5c86('0x18')][_0x5c86('0x19')](_0x36a998['body'],{'raw':_0x36a998['options']?_0x36a998[_0x5c86('0x1a')][_0x5c86('0x1b')]===undefined?!![]:![]:!![]})[_0x5c86('0xc')](function(_0x326532){logger[_0x5c86('0xd')](_0x5c86('0x17'),_0x36a998);logger[_0x5c86('0x10')](_0x5c86('0x17'),_0x36a998,JSON['stringify'](_0x326532));_0xfe8c02(_0x326532);})['catch'](function(_0x30a677){logger['error'](_0x5c86('0x17'),_0x30a677['message'],_0x36a998);_0x4bc7d0(_0x376391[_0x5c86('0x13')](0x1f4,_0x30a677[_0x5c86('0x15')]));});});};exports[_0x5c86('0x1c')]=function(_0x3d6215){var _0x5856e1=this;return new Promise(function(_0x200827,_0x47b837){return db[_0x5c86('0x18')][_0x5c86('0x1d')](_0x3d6215[_0x5c86('0x1e')],{'raw':_0x3d6215[_0x5c86('0x1a')]?_0x3d6215['options'][_0x5c86('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d6215[_0x5c86('0x1a')]?_0x3d6215['options'][_0x5c86('0x1f')]||null:null,'attributes':_0x3d6215[_0x5c86('0x1a')]?_0x3d6215['options']['attributes']||null:null,'limit':_0x3d6215[_0x5c86('0x1a')]?_0x3d6215['options']['limit']||null:null})[_0x5c86('0xc')](function(_0x1b871b){logger[_0x5c86('0xd')](_0x5c86('0x1c'),_0x3d6215);logger[_0x5c86('0x10')](_0x5c86('0x1c'),_0x3d6215,JSON[_0x5c86('0x12')](_0x1b871b));_0x200827(_0x1b871b);})['catch'](function(_0x5a62a5){logger[_0x5c86('0x13')](_0x5c86('0x1c'),_0x5a62a5['message'],_0x3d6215);_0x47b837(_0x5856e1[_0x5c86('0x13')](0x1f4,_0x5a62a5[_0x5c86('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 3cb17f0..ce11fe8 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 _0x84ab=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','describe','isAuthenticated','post','create','update','delete','/:id','destroy','multer'];(function(_0x1cfda3,_0x32e81){var _0x45a82f=function(_0x19078e){while(--_0x19078e){_0x1cfda3['push'](_0x1cfda3['shift']());}};_0x45a82f(++_0x32e81);}(_0x84ab,0x12f));var _0xb84a=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0x84ab[_0x52085a];return _0x5afc1a;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router[_0xb84a('0x9')]('/:id',auth[_0xb84a('0xc')](),controller['show']);router[_0xb84a('0xd')]('/',auth[_0xb84a('0xc')](),controller[_0xb84a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb84a('0xf')]);router[_0xb84a('0x10')](_0xb84a('0x11'),auth[_0xb84a('0xc')](),controller[_0xb84a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8958=['index','get','/describe','/:id','show','post','create','put','delete','destroy','exports','util','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated'];(function(_0x253b20,_0x7efc92){var _0x144306=function(_0x2bb16e){while(--_0x2bb16e){_0x253b20['push'](_0x253b20['shift']());}};_0x144306(++_0x7efc92);}(_0x8958,0x93));var _0x8895=function(_0x97166b,_0x80708a){_0x97166b=_0x97166b-0x0;var _0x131e82=_0x8958[_0x97166b];return _0x131e82;};'use strict';var multer=require('multer');var util=require(_0x8895('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8895('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var controller=require(_0x8895('0x4'));router['get']('/',auth[_0x8895('0x5')](),controller[_0x8895('0x6')]);router[_0x8895('0x7')](_0x8895('0x8'),auth[_0x8895('0x5')](),controller['describe']);router[_0x8895('0x7')](_0x8895('0x9'),auth[_0x8895('0x5')](),controller[_0x8895('0xa')]);router[_0x8895('0xb')]('/',auth[_0x8895('0x5')](),controller[_0x8895('0xc')]);router[_0x8895('0xd')](_0x8895('0x9'),auth[_0x8895('0x5')](),controller['update']);router[_0x8895('0xe')](_0x8895('0x9'),auth[_0x8895('0x5')](),controller[_0x8895('0xf')]);module[_0x8895('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 804c27b..53ac0e6 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 _0x15bf=['STRING','DATE','INTEGER','sequelize','exports','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer'];(function(_0x566655,_0x1b38c1){var _0x4ee0f4=function(_0xfc4bab){while(--_0xfc4bab){_0x566655['push'](_0x566655['shift']());}};_0x4ee0f4(++_0x1b38c1);}(_0x15bf,0x7b));var _0xf15b=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x15bf[_0x1573ea];return _0x51c0e2;};'use strict';var Sequelize=require(_0xf15b('0x0'));module[_0xf15b('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf15b('0x2')](_0xf15b('0x3'),_0xf15b('0x4'),_0xf15b('0x5'),_0xf15b('0x6'),_0xf15b('0x7'),_0xf15b('0x8'))},'tag':{'type':Sequelize[_0xf15b('0x9')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xf15b('0x9')]},'destination':{'type':Sequelize[_0xf15b('0x9')]},'destinationcontext':{'type':Sequelize[_0xf15b('0x9')]},'callerid':{'type':Sequelize[_0xf15b('0x9')]},'channel':{'type':Sequelize[_0xf15b('0x9')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0xf15b('0x9')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xf15b('0xa')]},'systemanswertime':{'type':Sequelize[_0xf15b('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf15b('0xa')]},'duration':{'type':Sequelize[_0xf15b('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xf15b('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf15b('0x9')]},'amaflags':{'type':Sequelize[_0xf15b('0x9')]},'userfield':{'type':Sequelize[_0xf15b('0x9')]},'userDisposition':{'type':Sequelize[_0xf15b('0x9')]},'userSecondDisposition':{'type':Sequelize[_0xf15b('0x9')]},'userThirdDisposition':{'type':Sequelize[_0xf15b('0x9')]},'note':{'type':Sequelize[_0xf15b('0x9')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xf15b('0xb')]},'sipcallid':{'type':Sequelize[_0xf15b('0x9')]}}; \ No newline at end of file +var _0xf122=['exports','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','STRING','DATE','INTEGER','sequelize'];(function(_0x1620f3,_0x57527e){var _0x3925ca=function(_0x2ebf7a){while(--_0x2ebf7a){_0x1620f3['push'](_0x1620f3['shift']());}};_0x3925ca(++_0x57527e);}(_0xf122,0x17f));var _0x2f12=function(_0x49d6da,_0x46e58b){_0x49d6da=_0x49d6da-0x0;var _0x188c6a=_0xf122[_0x49d6da];return _0x188c6a;};'use strict';var Sequelize=require(_0x2f12('0x0'));module[_0x2f12('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2f12('0x2')](_0x2f12('0x3'),_0x2f12('0x4'),_0x2f12('0x5'),_0x2f12('0x6'),_0x2f12('0x7'),_0x2f12('0x8'))},'tag':{'type':Sequelize[_0x2f12('0x9')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x2f12('0x9')]},'destination':{'type':Sequelize[_0x2f12('0x9')]},'destinationcontext':{'type':Sequelize[_0x2f12('0x9')]},'callerid':{'type':Sequelize[_0x2f12('0x9')]},'channel':{'type':Sequelize[_0x2f12('0x9')]},'destinationchannel':{'type':Sequelize[_0x2f12('0x9')]},'lastapplication':{'type':Sequelize[_0x2f12('0x9')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x2f12('0xa')]},'systemanswertime':{'type':Sequelize[_0x2f12('0xa')]},'answertime':{'type':Sequelize[_0x2f12('0xa')]},'endtime':{'type':Sequelize[_0x2f12('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x2f12('0xb')]},'mohtime':{'type':Sequelize[_0x2f12('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2f12('0x9')]},'amaflags':{'type':Sequelize[_0x2f12('0x9')]},'userfield':{'type':Sequelize[_0x2f12('0x9')]},'userDisposition':{'type':Sequelize[_0x2f12('0x9')]},'userSecondDisposition':{'type':Sequelize[_0x2f12('0x9')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x2f12('0x9')]},'routeid':{'type':Sequelize[_0x2f12('0xb')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 6467b7a..6cca21d 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'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 _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','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','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0x2ef3,0xba));var _0x32ef=function(_0x52e594,_0x3464fd){_0x52e594=_0x52e594-0x0;var _0x59be7c=_0x2ef3[_0x52e594];return _0x59be7c;};'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['VoiceCallReport'][_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')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index f44edac..a8819d6 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 _0x472b=['VoiceCallReport','uniqueid','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x240b71,_0x444e97){var _0x14b3b1=function(_0x13ac4f){while(--_0x13ac4f){_0x240b71['push'](_0x240b71['shift']());}};_0x14b3b1(++_0x444e97);}(_0x472b,0xe8));var _0xb472=function(_0x4ecc53,_0x379b0b){_0x4ecc53=_0x4ecc53-0x0;var _0x28fa94=_0x472b[_0x4ecc53];return _0x28fa94;};'use strict';var _=require(_0xb472('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb472('0x1'));var BPromise=require(_0xb472('0x2'));var rp=require(_0xb472('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb472('0x4'));var config=require(_0xb472('0x5'));var attributes=require(_0xb472('0x6'));module[_0xb472('0x7')]=function(_0x1b3cc9,_0x11c7f4){return _0x1b3cc9['define'](_0xb472('0x8'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xb472('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe04d=['bluebird','request-promise','path','rimraf','exports','define','VoiceCallReport','report_call','util','../../config/logger','api','moment'];(function(_0xfca344,_0x5b08ef){var _0xd2ff91=function(_0x5c7082){while(--_0x5c7082){_0xfca344['push'](_0xfca344['shift']());}};_0xd2ff91(++_0x5b08ef);}(_0xe04d,0x110));var _0xde04=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xe04d[_0x2bc3f4];return _0x14ac53;};'use strict';var _=require('lodash');var util=require(_0xde04('0x0'));var logger=require(_0xde04('0x1'))(_0xde04('0x2'));var moment=require(_0xde04('0x3'));var BPromise=require(_0xde04('0x4'));var rp=require(_0xde04('0x5'));var fs=require('fs');var path=require(_0xde04('0x6'));var rimraf=require(_0xde04('0x7'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0xde04('0x8')]=function(_0x4162ff,_0x6d58b5){return _0x4162ff[_0xde04('0x9')](_0xde04('0xa'),attributes,{'tableName':_0xde04('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 4c7d92b..4d5ff33 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 _0x5d7c=['VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','info','result','GetVoiceCallReport','findAll','options','where','attributes','limit','map','include','model','CreateVoiceCallReport','VoiceCallReport','create','raw','catch','UpdateVoiceCallReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','request\x20sent','debug'];(function(_0x48b374,_0x2eb134){var _0xc3941e=function(_0x53b9b5){while(--_0x53b9b5){_0x48b374['push'](_0x48b374['shift']());}};_0xc3941e(++_0x2eb134);}(_0x5d7c,0x1c7));var _0xc5d7=function(_0x376e73,_0x1632b8){_0x376e73=_0x376e73-0x0;var _0x3a0e74=_0x5d7c[_0x376e73];return _0x3a0e74;};'use strict';var _=require(_0xc5d7('0x0'));var util=require(_0xc5d7('0x1'));var moment=require('moment');var BPromise=require(_0xc5d7('0x2'));var rs=require(_0xc5d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5d7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5d7('0x5'))(_0xc5d7('0x6'));var config=require(_0xc5d7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc5d7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25f640,_0x3f1475,_0x409087){return new BPromise(function(_0x36e750,_0x3e7ebd){return client[_0xc5d7('0x9')](_0x25f640,_0x409087)[_0xc5d7('0xa')](function(_0x49fc72){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x3f1475,_0xc5d7('0xb'));logger[_0xc5d7('0xc')](_0xc5d7('0xd'),_0x3f1475,_0xc5d7('0xb'),JSON[_0xc5d7('0xe')](_0x49fc72));if(_0x49fc72[_0xc5d7('0xf')]){if(_0x49fc72[_0xc5d7('0xf')][_0xc5d7('0x10')]===0x1f4){logger['error'](_0xc5d7('0x11'),_0x3f1475,_0x49fc72[_0xc5d7('0xf')][_0xc5d7('0x12')]);return _0x3e7ebd(_0x49fc72[_0xc5d7('0xf')][_0xc5d7('0x12')]);}logger[_0xc5d7('0xf')](_0xc5d7('0x11'),_0x3f1475,_0x49fc72[_0xc5d7('0xf')][_0xc5d7('0x12')]);return _0x36e750(_0x49fc72[_0xc5d7('0xf')][_0xc5d7('0x12')]);}else{logger[_0xc5d7('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x3f1475,_0xc5d7('0xb'));_0x36e750(_0x49fc72[_0xc5d7('0x14')]['message']);}})['catch'](function(_0x15f8ec){logger[_0xc5d7('0xf')](_0xc5d7('0x11'),_0x3f1475,_0x15f8ec);_0x3e7ebd(_0x15f8ec);});});}exports[_0xc5d7('0x15')]=function(_0x5331cd){var _0x212182=this;return new Promise(function(_0x5beb18,_0xd72928){return db['VoiceCallReport'][_0xc5d7('0x16')]({'raw':_0x5331cd['options']?_0x5331cd[_0xc5d7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5331cd[_0xc5d7('0x17')]?_0x5331cd[_0xc5d7('0x17')][_0xc5d7('0x18')]||null:null,'attributes':_0x5331cd['options']?_0x5331cd[_0xc5d7('0x17')][_0xc5d7('0x19')]||null:null,'limit':_0x5331cd[_0xc5d7('0x17')]?_0x5331cd[_0xc5d7('0x17')][_0xc5d7('0x1a')]||null:null,'include':_0x5331cd['options']?_0x5331cd[_0xc5d7('0x17')]['include']?_[_0xc5d7('0x1b')](_0x5331cd['options'][_0xc5d7('0x1c')],function(_0x46ffb9){return{'model':db[_0x46ffb9[_0xc5d7('0x1d')]],'as':_0x46ffb9['as'],'attributes':_0x46ffb9[_0xc5d7('0x19')],'include':_0x46ffb9[_0xc5d7('0x1c')]?_[_0xc5d7('0x1b')](_0x46ffb9[_0xc5d7('0x1c')],function(_0x1a1d69){return{'model':db[_0x1a1d69['model']],'as':_0x1a1d69['as'],'attributes':_0x1a1d69[_0xc5d7('0x19')],'include':_0x1a1d69[_0xc5d7('0x1c')]?_[_0xc5d7('0x1b')](_0x1a1d69[_0xc5d7('0x1c')],function(_0x2082fd){return{'model':db[_0x2082fd['model']],'as':_0x2082fd['as'],'attributes':_0x2082fd[_0xc5d7('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc5d7('0xa')](function(_0x1bdcb0){logger[_0xc5d7('0x13')](_0xc5d7('0x15'),_0x5331cd);logger[_0xc5d7('0xc')]('GetVoiceCallReport',_0x5331cd,JSON[_0xc5d7('0xe')](_0x1bdcb0));_0x5beb18(_0x1bdcb0);})['catch'](function(_0x187b8c){logger[_0xc5d7('0xf')]('GetVoiceCallReport',_0x187b8c[_0xc5d7('0x12')],_0x5331cd);_0xd72928(_0x212182['error'](0x1f4,_0x187b8c[_0xc5d7('0x12')]));});});};exports[_0xc5d7('0x1e')]=function(_0xda9ffa){var _0x2b5f73=this;return new Promise(function(_0x4d02c8,_0x5ed1a3){return db[_0xc5d7('0x1f')][_0xc5d7('0x20')](_0xda9ffa['body'],{'raw':_0xda9ffa[_0xc5d7('0x17')]?_0xda9ffa[_0xc5d7('0x17')][_0xc5d7('0x21')]===undefined?!![]:![]:!![]})[_0xc5d7('0xa')](function(_0x12a585){logger['info'](_0xc5d7('0x1e'),_0xda9ffa);logger['debug'](_0xc5d7('0x1e'),_0xda9ffa,JSON[_0xc5d7('0xe')](_0x12a585));_0x4d02c8(_0x12a585);})[_0xc5d7('0x22')](function(_0x5f104f){logger[_0xc5d7('0xf')](_0xc5d7('0x1e'),_0x5f104f[_0xc5d7('0x12')],_0xda9ffa);_0x5ed1a3(_0x2b5f73[_0xc5d7('0xf')](0x1f4,_0x5f104f[_0xc5d7('0x12')]));});});};exports[_0xc5d7('0x23')]=function(_0x50846b){var _0xc10d64=this;return new Promise(function(_0x125594,_0x3bfd61){return db['VoiceCallReport']['update'](_0x50846b['body'],{'raw':_0x50846b['options']?_0x50846b['options'][_0xc5d7('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50846b['options']?_0x50846b[_0xc5d7('0x17')][_0xc5d7('0x18')]||null:null,'attributes':_0x50846b[_0xc5d7('0x17')]?_0x50846b[_0xc5d7('0x17')][_0xc5d7('0x19')]||null:null,'limit':_0x50846b[_0xc5d7('0x17')]?_0x50846b[_0xc5d7('0x17')][_0xc5d7('0x1a')]||null:null})[_0xc5d7('0xa')](function(_0x38169b){logger[_0xc5d7('0x13')](_0xc5d7('0x23'),_0x50846b);logger[_0xc5d7('0xc')](_0xc5d7('0x23'),_0x50846b,JSON[_0xc5d7('0xe')](_0x38169b));_0x125594(_0x38169b);})[_0xc5d7('0x22')](function(_0xca5477){logger['error'](_0xc5d7('0x23'),_0xca5477[_0xc5d7('0x12')],_0x50846b);_0x3bfd61(_0xc10d64['error'](0x1f4,_0xca5477[_0xc5d7('0x12')]));});});}; \ No newline at end of file +var _0x1699=['CreateVoiceCallReport','create','body','UpdateVoiceCallReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceCallReport','options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport'];(function(_0x5ab653,_0x2b8dba){var _0x37b593=function(_0x5f4740){while(--_0x5f4740){_0x5ab653['push'](_0x5ab653['shift']());}};_0x37b593(++_0x2b8dba);}(_0x1699,0x1bc));var _0x9169=function(_0x13f9c3,_0x2036c0){_0x13f9c3=_0x13f9c3-0x0;var _0x22185a=_0x1699[_0x13f9c3];return _0x22185a;};'use strict';var _=require(_0x9169('0x0'));var util=require('util');var moment=require(_0x9169('0x1'));var BPromise=require(_0x9169('0x2'));var rs=require(_0x9169('0x3'));var fs=require('fs');var Redis=require(_0x9169('0x4'));var db=require(_0x9169('0x5'))['db'];var utils=require(_0x9169('0x6'));var logger=require(_0x9169('0x7'))(_0x9169('0x8'));var config=require(_0x9169('0x9'));var jayson=require(_0x9169('0xa'));var client=jayson[_0x9169('0xb')][_0x9169('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15ef86,_0x2d367d,_0x293738){return new BPromise(function(_0x5c8c05,_0xe3cf6a){return client[_0x9169('0xd')](_0x15ef86,_0x293738)[_0x9169('0xe')](function(_0x471380){logger[_0x9169('0xf')](_0x9169('0x10'),_0x2d367d,_0x9169('0x11'));logger[_0x9169('0x12')](_0x9169('0x13'),_0x2d367d,_0x9169('0x11'),JSON[_0x9169('0x14')](_0x471380));if(_0x471380[_0x9169('0x15')]){if(_0x471380[_0x9169('0x15')][_0x9169('0x16')]===0x1f4){logger[_0x9169('0x15')](_0x9169('0x10'),_0x2d367d,_0x471380['error'][_0x9169('0x17')]);return _0xe3cf6a(_0x471380[_0x9169('0x15')][_0x9169('0x17')]);}logger['error'](_0x9169('0x10'),_0x2d367d,_0x471380['error'][_0x9169('0x17')]);return _0x5c8c05(_0x471380['error'][_0x9169('0x17')]);}else{logger[_0x9169('0xf')](_0x9169('0x10'),_0x2d367d,_0x9169('0x11'));_0x5c8c05(_0x471380[_0x9169('0x18')][_0x9169('0x17')]);}})[_0x9169('0x19')](function(_0xa3e221){logger['error'](_0x9169('0x10'),_0x2d367d,_0xa3e221);_0xe3cf6a(_0xa3e221);});});}exports['GetVoiceCallReport']=function(_0x3c5531){var _0x3678cc=this;return new Promise(function(_0x4711c1,_0x4049a6){return db[_0x9169('0x1a')]['findAll']({'raw':_0x3c5531[_0x9169('0x1b')]?_0x3c5531[_0x9169('0x1b')][_0x9169('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c5531[_0x9169('0x1b')]?_0x3c5531[_0x9169('0x1b')][_0x9169('0x1d')]||null:null,'attributes':_0x3c5531[_0x9169('0x1b')]?_0x3c5531[_0x9169('0x1b')][_0x9169('0x1e')]||null:null,'limit':_0x3c5531[_0x9169('0x1b')]?_0x3c5531[_0x9169('0x1b')][_0x9169('0x1f')]||null:null,'include':_0x3c5531['options']?_0x3c5531[_0x9169('0x1b')][_0x9169('0x20')]?_[_0x9169('0x21')](_0x3c5531[_0x9169('0x1b')][_0x9169('0x20')],function(_0x5e9ef2){return{'model':db[_0x5e9ef2[_0x9169('0x22')]],'as':_0x5e9ef2['as'],'attributes':_0x5e9ef2['attributes'],'include':_0x5e9ef2[_0x9169('0x20')]?_[_0x9169('0x21')](_0x5e9ef2[_0x9169('0x20')],function(_0x31fe2e){return{'model':db[_0x31fe2e[_0x9169('0x22')]],'as':_0x31fe2e['as'],'attributes':_0x31fe2e['attributes'],'include':_0x31fe2e[_0x9169('0x20')]?_['map'](_0x31fe2e['include'],function(_0x1a3ff9){return{'model':db[_0x1a3ff9['model']],'as':_0x1a3ff9['as'],'attributes':_0x1a3ff9[_0x9169('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9169('0xe')](function(_0x2273d3){logger[_0x9169('0xf')]('GetVoiceCallReport',_0x3c5531);logger['debug'](_0x9169('0x23'),_0x3c5531,JSON['stringify'](_0x2273d3));_0x4711c1(_0x2273d3);})['catch'](function(_0x6cb6bb){logger[_0x9169('0x15')](_0x9169('0x23'),_0x6cb6bb[_0x9169('0x17')],_0x3c5531);_0x4049a6(_0x3678cc[_0x9169('0x15')](0x1f4,_0x6cb6bb[_0x9169('0x17')]));});});};exports[_0x9169('0x24')]=function(_0x32c00d){var _0x36257c=this;return new Promise(function(_0x2ae526,_0x659960){return db['VoiceCallReport'][_0x9169('0x25')](_0x32c00d[_0x9169('0x26')],{'raw':_0x32c00d[_0x9169('0x1b')]?_0x32c00d[_0x9169('0x1b')][_0x9169('0x1c')]===undefined?!![]:![]:!![]})[_0x9169('0xe')](function(_0x2797e6){logger[_0x9169('0xf')](_0x9169('0x24'),_0x32c00d);logger[_0x9169('0x12')]('CreateVoiceCallReport',_0x32c00d,JSON[_0x9169('0x14')](_0x2797e6));_0x2ae526(_0x2797e6);})[_0x9169('0x19')](function(_0x1f5131){logger['error'](_0x9169('0x24'),_0x1f5131['message'],_0x32c00d);_0x659960(_0x36257c[_0x9169('0x15')](0x1f4,_0x1f5131['message']));});});};exports[_0x9169('0x27')]=function(_0x125d01){var _0x1716c5=this;return new Promise(function(_0x27c998,_0x391d88){return db[_0x9169('0x1a')]['update'](_0x125d01[_0x9169('0x26')],{'raw':_0x125d01[_0x9169('0x1b')]?_0x125d01['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x125d01[_0x9169('0x1b')]?_0x125d01[_0x9169('0x1b')]['where']||null:null,'attributes':_0x125d01['options']?_0x125d01[_0x9169('0x1b')]['attributes']||null:null,'limit':_0x125d01['options']?_0x125d01[_0x9169('0x1b')][_0x9169('0x1f')]||null:null})['then'](function(_0x596649){logger[_0x9169('0xf')]('UpdateVoiceCallReport',_0x125d01);logger[_0x9169('0x12')](_0x9169('0x27'),_0x125d01,JSON[_0x9169('0x14')](_0x596649));_0x27c998(_0x596649);})[_0x9169('0x19')](function(_0x37feda){logger['error'](_0x9169('0x27'),_0x37feda[_0x9169('0x17')],_0x125d01);_0x391d88(_0x1716c5[_0x9169('0x15')](0x1f4,_0x37feda['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index c29db99..07fd71b 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 _0xc6d3=['post','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','/:id'];(function(_0xabde1e,_0x1b1871){var _0x1cddcc=function(_0x326c3d){while(--_0x326c3d){_0xabde1e['push'](_0xabde1e['shift']());}};_0x1cddcc(++_0x1b1871);}(_0xc6d3,0x1e4));var _0x3c6d=function(_0x3bfb4c,_0x24ea3e){_0x3bfb4c=_0x3bfb4c-0x0;var _0x191356=_0xc6d3[_0x3bfb4c];return _0x191356;};'use strict';var multer=require(_0x3c6d('0x0'));var util=require(_0x3c6d('0x1'));var path=require(_0x3c6d('0x2'));var timeout=require('connect-timeout');var express=require(_0x3c6d('0x3'));var router=express[_0x3c6d('0x4')]();var fs_extra=require(_0x3c6d('0x5'));var auth=require(_0x3c6d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3c6d('0x7'));var controller=require(_0x3c6d('0x8'));router['get']('/',auth[_0x3c6d('0x9')](),controller[_0x3c6d('0xa')]);router['get'](_0x3c6d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x3c6d('0xc')]('/',auth[_0x3c6d('0x9')](),controller['create']);router[_0x3c6d('0xd')](_0x3c6d('0xb'),auth['isAuthenticated'](),controller[_0x3c6d('0xe')]);router[_0x3c6d('0xf')](_0x3c6d('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcb85=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/:id','show','isAuthenticated','update','destroy','exports','util','path'];(function(_0xb7582e,_0x1ab61d){var _0x4a4fcd=function(_0x2bb67b){while(--_0x2bb67b){_0xb7582e['push'](_0xb7582e['shift']());}};_0x4a4fcd(++_0x1ab61d);}(_0xcb85,0x11b));var _0x5cb8=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0xcb85[_0x5a7e3c];return _0x59252b;};'use strict';var multer=require('multer');var util=require(_0x5cb8('0x0'));var path=require(_0x5cb8('0x1'));var timeout=require(_0x5cb8('0x2'));var express=require(_0x5cb8('0x3'));var router=express[_0x5cb8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5cb8('0x5'));var config=require(_0x5cb8('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x5cb8('0x7')]('/',auth['isAuthenticated'](),controller[_0x5cb8('0x8')]);router['get'](_0x5cb8('0x9'),auth['isAuthenticated'](),controller[_0x5cb8('0xa')]);router['post']('/',auth[_0x5cb8('0xb')](),controller['create']);router['put'](_0x5cb8('0x9'),auth[_0x5cb8('0xb')](),controller[_0x5cb8('0xc')]);router['delete'](_0x5cb8('0x9'),auth['isAuthenticated'](),controller[_0x5cb8('0xd')]);module[_0x5cb8('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 87773dd..2b3ffe7 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 _0x19db=['BOOLEAN','sequelize','exports','STRING','setDataValue','join','getDataValue'];(function(_0x25b4a4,_0x2e081b){var _0x707267=function(_0x440123){while(--_0x440123){_0x25b4a4['push'](_0x25b4a4['shift']());}};_0x707267(++_0x2e081b);}(_0x19db,0x14a));var _0xb19d=function(_0x18d8e9,_0x2d9568){_0x18d8e9=_0x18d8e9-0x0;var _0x1b9102=_0x19db[_0x18d8e9];return _0x1b9102;};'use strict';var Sequelize=require(_0xb19d('0x0'));module[_0xb19d('0x1')]={'name':{'type':Sequelize[_0xb19d('0x2')]},'prefix':{'type':Sequelize[_0xb19d('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xb19d('0x2')],'set':function(_0x4b6325){this[_0xb19d('0x3')]('options',_0x4b6325?_0x4b6325[_0xb19d('0x4')](''):[]);},'get':function(){return this[_0xb19d('0x5')]('options')?this['getDataValue']('options')['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xb19d('0x2')]},'record':{'type':Sequelize[_0xb19d('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb19d('0x2')]},'description':{'type':Sequelize[_0xb19d('0x2')]}}; \ No newline at end of file +var _0xa714=['options','BOOLEAN','sequelize','STRING','name','setDataValue','join','getDataValue'];(function(_0x1e1676,_0x40a6cf){var _0x14a078=function(_0x53ffaa){while(--_0x53ffaa){_0x1e1676['push'](_0x1e1676['shift']());}};_0x14a078(++_0x40a6cf);}(_0xa714,0x1ca));var _0x4a71=function(_0x4fe1ca,_0x3c3ef3){_0x4fe1ca=_0x4fe1ca-0x0;var _0x1dc065=_0xa714[_0x4fe1ca];return _0x1dc065;};'use strict';var Sequelize=require(_0x4a71('0x0'));module['exports']={'name':{'type':Sequelize[_0x4a71('0x1')]},'prefix':{'type':Sequelize[_0x4a71('0x1')],'unique':_0x4a71('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x4a71('0x1')],'set':function(_0x4a18bd){this[_0x4a71('0x3')]('options',_0x4a18bd?_0x4a18bd[_0x4a71('0x4')](''):[]);},'get':function(){return this[_0x4a71('0x5')](_0x4a71('0x6'))?this[_0x4a71('0x5')](_0x4a71('0x6'))['split'](''):[];}},'auth':{'type':Sequelize[_0x4a71('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x4a71('0x1')]},'record':{'type':Sequelize[_0x4a71('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4a71('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 4d862dd..45fbf38 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 _0x682e=['../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','apply','reject','save','update','then','get','ChanSpies','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','VoiceChanSpy','findAll','rows','catch','show','params','length','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x682e,0x1ce));var _0xe682=function(_0x41f8da,_0x12ec49){_0x41f8da=_0x41f8da-0x0;var _0x240e08=_0x682e[_0x41f8da];return _0x240e08;};'use strict';var emlformat=require(_0xe682('0x0'));var rimraf=require(_0xe682('0x1'));var zipdir=require(_0xe682('0x2'));var jsonpatch=require(_0xe682('0x3'));var rp=require(_0xe682('0x4'));var moment=require(_0xe682('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe682('0x6'));var util=require(_0xe682('0x7'));var path=require(_0xe682('0x8'));var sox=require(_0xe682('0x9'));var csv=require(_0xe682('0xa'));var ejs=require(_0xe682('0xb'));var fs=require('fs');var fs_extra=require(_0xe682('0xc'));var _=require(_0xe682('0xd'));var squel=require(_0xe682('0xe'));var crypto=require(_0xe682('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe682('0x10'));var toCsv=require(_0xe682('0xa'));var querystring=require(_0xe682('0x11'));var Papa=require(_0xe682('0x12'));var Redis=require(_0xe682('0x13'));var authService=require(_0xe682('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe682('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe682('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xe682('0x17'));var licenseUtil=require(_0xe682('0x18'));var db=require(_0xe682('0x19'))['db'];function respondWithStatusCode(_0x178861,_0x9d0c78){_0x9d0c78=_0x9d0c78||0xcc;return function(_0x27ead7){if(_0x27ead7){return _0x178861['sendStatus'](_0x9d0c78);}return _0x178861[_0xe682('0x1a')](_0x9d0c78)[_0xe682('0x1b')]();};}function respondWithResult(_0x1e4755,_0x32b45a){_0x32b45a=_0x32b45a||0xc8;return function(_0x29ec5a){if(_0x29ec5a){return _0x1e4755[_0xe682('0x1a')](_0x32b45a)[_0xe682('0x1c')](_0x29ec5a);}};}function respondWithFilteredResult(_0x30da5d,_0x5940b8){return function(_0x2de4e8){if(_0x2de4e8){var _0x5e29bd=typeof _0x5940b8['offset']==='undefined'&&typeof _0x5940b8[_0xe682('0x1d')]===_0xe682('0x1e');var _0xeae968=_0x2de4e8[_0xe682('0x1f')];var _0x51166c=_0x5e29bd?0x0:_0x5940b8[_0xe682('0x20')];var _0x596ca3=_0x5e29bd?_0x2de4e8[_0xe682('0x1f')]:_0x5940b8['offset']+_0x5940b8[_0xe682('0x1d')];var _0x5a2b51;if(_0x596ca3>=_0xeae968){_0x596ca3=_0xeae968;_0x5a2b51=0xc8;}else{_0x5a2b51=0xce;}_0x30da5d[_0xe682('0x1a')](_0x5a2b51);return _0x30da5d['set']('Content-Range',_0x51166c+'-'+_0x596ca3+'/'+_0xeae968)[_0xe682('0x1c')](_0x2de4e8);}return null;};}function patchUpdates(_0x5ebf37){return function(_0x36c7e0){try{jsonpatch[_0xe682('0x21')](_0x36c7e0,_0x5ebf37,!![]);}catch(_0x3c8f12){return BPromise[_0xe682('0x22')](_0x3c8f12);}return _0x36c7e0[_0xe682('0x23')]();};}function saveUpdates(_0x16fbfe,_0x227139){return function(_0x220eb3){if(_0x220eb3){return _0x220eb3[_0xe682('0x24')](_0x16fbfe)[_0xe682('0x25')](function(_0x1f8757){return _0x1f8757;});}return null;};}function removeEntity(_0x3e9018,_0x46402f){return function(_0x5bfb75){if(_0x5bfb75){return _0x5bfb75['destroy']()[_0xe682('0x25')](function(){var _0xb0bb2f=_0x5bfb75[_0xe682('0x26')]({'plain':!![]});var _0x4d1502=_0xe682('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x4d1502,'resourceId':_0xb0bb2f['id']}})[_0xe682('0x25')](function(){return _0x5bfb75;});})[_0xe682('0x25')](function(){_0x3e9018[_0xe682('0x1a')](0xcc)[_0xe682('0x1b')]();});}};}function handleEntityNotFound(_0x25a32f,_0x4aaaa0){return function(_0x4945f1){if(!_0x4945f1){_0x25a32f['sendStatus'](0x194);}return _0x4945f1;};}function handleError(_0x7af36b,_0x50fae3){_0x50fae3=_0x50fae3||0x1f4;return function(_0x57f872){logger[_0xe682('0x28')](_0x57f872['stack']);if(_0x57f872[_0xe682('0x29')]){delete _0x57f872['name'];}_0x7af36b['status'](_0x50fae3)[_0xe682('0x2a')](_0x57f872);};}exports[_0xe682('0x2b')]=function(_0xb6256a,_0x3d5b9b){var _0x49c0d6={},_0x41749f={},_0x161227={'count':0x0,'rows':[]};var _0x3a3b2f=_[_0xe682('0x2c')](db['VoiceChanSpy'][_0xe682('0x2d')],function(_0x573e23){return{'name':_0x573e23[_0xe682('0x2e')],'type':_0x573e23[_0xe682('0x2f')]['key']};});_0x41749f[_0xe682('0x30')]=_[_0xe682('0x2c')](_0x3a3b2f,'name');_0x41749f[_0xe682('0x31')]=_[_0xe682('0x32')](_0xb6256a[_0xe682('0x31')]);_0x41749f[_0xe682('0x33')]=_[_0xe682('0x34')](_0x41749f['model'],_0x41749f[_0xe682('0x31')]);_0x49c0d6[_0xe682('0x35')]=_[_0xe682('0x34')](_0x41749f['model'],qs[_0xe682('0x36')](_0xb6256a[_0xe682('0x31')]['fields']));_0x49c0d6[_0xe682('0x35')]=_0x49c0d6[_0xe682('0x35')]['length']?_0x49c0d6[_0xe682('0x35')]:_0x41749f[_0xe682('0x30')];if(!_0xb6256a[_0xe682('0x31')][_0xe682('0x37')]('nolimit')){_0x49c0d6[_0xe682('0x1d')]=qs[_0xe682('0x1d')](_0xb6256a[_0xe682('0x31')][_0xe682('0x1d')]);_0x49c0d6[_0xe682('0x20')]=qs[_0xe682('0x20')](_0xb6256a[_0xe682('0x31')][_0xe682('0x20')]);}_0x49c0d6[_0xe682('0x38')]=qs[_0xe682('0x39')](_0xb6256a[_0xe682('0x31')][_0xe682('0x39')]);_0x49c0d6[_0xe682('0x3a')]=qs[_0xe682('0x33')](_[_0xe682('0x3b')](_0xb6256a['query'],_0x41749f['filters']),_0x3a3b2f);if(_0xb6256a[_0xe682('0x31')][_0xe682('0x3c')]){_0x49c0d6[_0xe682('0x3a')]=_[_0xe682('0x3d')](_0x49c0d6[_0xe682('0x3a')],{'$or':_[_0xe682('0x2c')](_0x3a3b2f,function(_0x429862){if(_0x429862[_0xe682('0x2f')]!==_0xe682('0x3e')){var _0x373523={};_0x373523[_0x429862[_0xe682('0x29')]]={'$like':'%'+_0xb6256a[_0xe682('0x31')]['filter']+'%'};return _0x373523;}})});}_0x49c0d6=_['merge']({},_0x49c0d6,_0xb6256a[_0xe682('0x3f')]);var _0x208131={'where':_0x49c0d6[_0xe682('0x3a')]};return db['VoiceChanSpy']['count'](_0x208131)[_0xe682('0x25')](function(_0x5aaa0f){_0x161227['count']=_0x5aaa0f;if(_0xb6256a['query']['includeAll']){_0x49c0d6[_0xe682('0x40')]=[{'all':!![]}];}return db[_0xe682('0x41')][_0xe682('0x42')](_0x49c0d6);})[_0xe682('0x25')](function(_0xc220b4){_0x161227[_0xe682('0x43')]=_0xc220b4;return _0x161227;})[_0xe682('0x25')](respondWithFilteredResult(_0x3d5b9b,_0x49c0d6))[_0xe682('0x44')](handleError(_0x3d5b9b,null));};exports[_0xe682('0x45')]=function(_0x1e8a50,_0x4ba8d3){var _0x299250={'raw':![],'where':{'id':_0x1e8a50[_0xe682('0x46')]['id']}},_0x5efb2e={};_0x5efb2e[_0xe682('0x30')]=_[_0xe682('0x32')](db[_0xe682('0x41')][_0xe682('0x2d')]);_0x5efb2e[_0xe682('0x31')]=_[_0xe682('0x32')](_0x1e8a50['query']);_0x5efb2e['filters']=_[_0xe682('0x34')](_0x5efb2e[_0xe682('0x30')],_0x5efb2e[_0xe682('0x31')]);_0x299250['attributes']=_[_0xe682('0x34')](_0x5efb2e[_0xe682('0x30')],qs[_0xe682('0x36')](_0x1e8a50[_0xe682('0x31')][_0xe682('0x36')]));_0x299250[_0xe682('0x35')]=_0x299250[_0xe682('0x35')][_0xe682('0x47')]?_0x299250[_0xe682('0x35')]:_0x5efb2e[_0xe682('0x30')];if(_0x1e8a50[_0xe682('0x31')]['includeAll']){_0x299250[_0xe682('0x40')]=[{'all':!![]}];}_0x299250=_['merge']({},_0x299250,_0x1e8a50['options']);return db[_0xe682('0x41')][_0xe682('0x48')](_0x299250)[_0xe682('0x25')](handleEntityNotFound(_0x4ba8d3,null))[_0xe682('0x25')](respondWithResult(_0x4ba8d3,null))[_0xe682('0x44')](handleError(_0x4ba8d3,null));};exports['create']=function(_0x52faa4,_0x254b3d){return db[_0xe682('0x41')][_0xe682('0x49')](_0x52faa4[_0xe682('0x4a')],{})[_0xe682('0x25')](function(_0x1b74c0){var _0x3c71b2=_0x52faa4[_0xe682('0x4b')][_0xe682('0x26')]({'plain':!![]});if(!_0x3c71b2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c71b2['role']==='user'){var _0x50656d=_0x1b74c0[_0xe682('0x26')]({'plain':!![]});var _0x1d76a6=_0xe682('0x27');return db[_0xe682('0x4c')][_0xe682('0x48')]({'where':{'name':_0x1d76a6,'userProfileId':_0x3c71b2[_0xe682('0x4d')]},'raw':!![]})[_0xe682('0x25')](function(_0xd07768){if(_0xd07768&&_0xd07768[_0xe682('0x4e')]===0x0){return db[_0xe682('0x4f')][_0xe682('0x49')]({'name':_0x50656d[_0xe682('0x29')],'resourceId':_0x50656d['id'],'type':_0xd07768['name'],'sectionId':_0xd07768['id']},{})['then'](function(){return _0x1b74c0;});}else{return _0x1b74c0;}})['catch'](function(_0x87b156){logger[_0xe682('0x28')](_0xe682('0x50'),_0x87b156);throw _0x87b156;});}return _0x1b74c0;})[_0xe682('0x25')](respondWithResult(_0x254b3d,0xc9))['catch'](handleError(_0x254b3d,null));};exports[_0xe682('0x24')]=function(_0xa47f28,_0x3cf7ee){if(_0xa47f28['body']['id']){delete _0xa47f28[_0xe682('0x4a')]['id'];}return db['VoiceChanSpy'][_0xe682('0x48')]({'where':{'id':_0xa47f28[_0xe682('0x46')]['id']}})[_0xe682('0x25')](handleEntityNotFound(_0x3cf7ee,null))['then'](saveUpdates(_0xa47f28['body'],null))['then'](respondWithResult(_0x3cf7ee,null))[_0xe682('0x44')](handleError(_0x3cf7ee,null));};exports['destroy']=function(_0x202d74,_0x15f5fe){return db['VoiceChanSpy'][_0xe682('0x48')]({'where':{'id':_0x202d74[_0xe682('0x46')]['id']}})[_0xe682('0x25')](handleEntityNotFound(_0x15f5fe,null))['then'](removeEntity(_0x15f5fe,null))['catch'](handleError(_0x15f5fe,null));}; \ No newline at end of file +var _0x16d2=['error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','findAll','rows','show','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','userProfileId','UserProfileResource','catch','update','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','get'];(function(_0x43eb0c,_0x14d469){var _0x37aec6=function(_0xd0e0b2){while(--_0xd0e0b2){_0x43eb0c['push'](_0x43eb0c['shift']());}};_0x37aec6(++_0x14d469);}(_0x16d2,0x123));var _0x216d=function(_0x980a22,_0x30ecda){_0x980a22=_0x980a22-0x0;var _0x40d53f=_0x16d2[_0x980a22];return _0x40d53f;};'use strict';var emlformat=require(_0x216d('0x0'));var rimraf=require(_0x216d('0x1'));var zipdir=require(_0x216d('0x2'));var jsonpatch=require(_0x216d('0x3'));var rp=require(_0x216d('0x4'));var moment=require(_0x216d('0x5'));var BPromise=require(_0x216d('0x6'));var Mustache=require(_0x216d('0x7'));var util=require(_0x216d('0x8'));var path=require('path');var sox=require(_0x216d('0x9'));var csv=require(_0x216d('0xa'));var ejs=require(_0x216d('0xb'));var fs=require('fs');var fs_extra=require(_0x216d('0xc'));var _=require(_0x216d('0xd'));var squel=require(_0x216d('0xe'));var crypto=require(_0x216d('0xf'));var jsforce=require(_0x216d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x216d('0xa'));var querystring=require(_0x216d('0x11'));var Papa=require(_0x216d('0x12'));var Redis=require(_0x216d('0x13'));var authService=require(_0x216d('0x14'));var qs=require(_0x216d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x216d('0x16'));var logger=require('../../config/logger')(_0x216d('0x17'));var utils=require(_0x216d('0x18'));var config=require(_0x216d('0x19'));var licenseUtil=require(_0x216d('0x1a'));var db=require(_0x216d('0x1b'))['db'];function respondWithStatusCode(_0x23ecf9,_0x4c92d9){_0x4c92d9=_0x4c92d9||0xcc;return function(_0xb36a43){if(_0xb36a43){return _0x23ecf9['sendStatus'](_0x4c92d9);}return _0x23ecf9[_0x216d('0x1c')](_0x4c92d9)[_0x216d('0x1d')]();};}function respondWithResult(_0x4dc2a2,_0x165c19){_0x165c19=_0x165c19||0xc8;return function(_0x322e4b){if(_0x322e4b){return _0x4dc2a2['status'](_0x165c19)[_0x216d('0x1e')](_0x322e4b);}};}function respondWithFilteredResult(_0x494e92,_0x448c0d){return function(_0xf571a4){if(_0xf571a4){var _0x4631b0=typeof _0x448c0d[_0x216d('0x1f')]===_0x216d('0x20')&&typeof _0x448c0d[_0x216d('0x21')]===_0x216d('0x20');var _0x1496fe=_0xf571a4[_0x216d('0x22')];var _0x53d464=_0x4631b0?0x0:_0x448c0d[_0x216d('0x1f')];var _0x5124ab=_0x4631b0?_0xf571a4['count']:_0x448c0d[_0x216d('0x1f')]+_0x448c0d[_0x216d('0x21')];var _0x574758;if(_0x5124ab>=_0x1496fe){_0x5124ab=_0x1496fe;_0x574758=0xc8;}else{_0x574758=0xce;}_0x494e92[_0x216d('0x1c')](_0x574758);return _0x494e92[_0x216d('0x23')]('Content-Range',_0x53d464+'-'+_0x5124ab+'/'+_0x1496fe)[_0x216d('0x1e')](_0xf571a4);}return null;};}function patchUpdates(_0x13b8e0){return function(_0x430e81){try{jsonpatch[_0x216d('0x24')](_0x430e81,_0x13b8e0,!![]);}catch(_0x5c3e03){return BPromise[_0x216d('0x25')](_0x5c3e03);}return _0x430e81[_0x216d('0x26')]();};}function saveUpdates(_0x10f299,_0x438981){return function(_0x206782){if(_0x206782){return _0x206782['update'](_0x10f299)[_0x216d('0x27')](function(_0x1bd4db){return _0x1bd4db;});}return null;};}function removeEntity(_0x188494,_0x2880c6){return function(_0x6fa4b3){if(_0x6fa4b3){return _0x6fa4b3['destroy']()[_0x216d('0x27')](function(){var _0xab672=_0x6fa4b3[_0x216d('0x28')]({'plain':!![]});var _0x5998a1='ChanSpies';return db['UserProfileResource']['destroy']({'where':{'type':_0x5998a1,'resourceId':_0xab672['id']}})['then'](function(){return _0x6fa4b3;});})[_0x216d('0x27')](function(){_0x188494[_0x216d('0x1c')](0xcc)[_0x216d('0x1d')]();});}};}function handleEntityNotFound(_0x73b509,_0x46d0ef){return function(_0x47fa6d){if(!_0x47fa6d){_0x73b509['sendStatus'](0x194);}return _0x47fa6d;};}function handleError(_0xa7624a,_0x51b2bd){_0x51b2bd=_0x51b2bd||0x1f4;return function(_0x23d1c3){logger[_0x216d('0x29')](_0x23d1c3[_0x216d('0x2a')]);if(_0x23d1c3[_0x216d('0x2b')]){delete _0x23d1c3[_0x216d('0x2b')];}_0xa7624a[_0x216d('0x1c')](_0x51b2bd)[_0x216d('0x2c')](_0x23d1c3);};}exports[_0x216d('0x2d')]=function(_0x169cfa,_0x28f56a){var _0x11be90={},_0x260134={},_0x4537fd={'count':0x0,'rows':[]};var _0x483324=_[_0x216d('0x2e')](db[_0x216d('0x2f')][_0x216d('0x30')],function(_0x510ad9){return{'name':_0x510ad9[_0x216d('0x31')],'type':_0x510ad9[_0x216d('0x32')][_0x216d('0x33')]};});_0x260134[_0x216d('0x34')]=_['map'](_0x483324,_0x216d('0x2b'));_0x260134[_0x216d('0x35')]=_[_0x216d('0x36')](_0x169cfa[_0x216d('0x35')]);_0x260134[_0x216d('0x37')]=_[_0x216d('0x38')](_0x260134[_0x216d('0x34')],_0x260134[_0x216d('0x35')]);_0x11be90[_0x216d('0x39')]=_[_0x216d('0x38')](_0x260134[_0x216d('0x34')],qs['fields'](_0x169cfa[_0x216d('0x35')][_0x216d('0x3a')]));_0x11be90[_0x216d('0x39')]=_0x11be90['attributes'][_0x216d('0x3b')]?_0x11be90[_0x216d('0x39')]:_0x260134['model'];if(!_0x169cfa[_0x216d('0x35')]['hasOwnProperty']('nolimit')){_0x11be90[_0x216d('0x21')]=qs[_0x216d('0x21')](_0x169cfa[_0x216d('0x35')][_0x216d('0x21')]);_0x11be90['offset']=qs['offset'](_0x169cfa['query'][_0x216d('0x1f')]);}_0x11be90[_0x216d('0x3c')]=qs['sort'](_0x169cfa[_0x216d('0x35')][_0x216d('0x3d')]);_0x11be90['where']=qs[_0x216d('0x37')](_[_0x216d('0x3e')](_0x169cfa[_0x216d('0x35')],_0x260134[_0x216d('0x37')]),_0x483324);if(_0x169cfa[_0x216d('0x35')][_0x216d('0x3f')]){_0x11be90[_0x216d('0x40')]=_[_0x216d('0x41')](_0x11be90['where'],{'$or':_['map'](_0x483324,function(_0x281a88){if(_0x281a88[_0x216d('0x32')]!=='VIRTUAL'){var _0xf33f9c={};_0xf33f9c[_0x281a88[_0x216d('0x2b')]]={'$like':'%'+_0x169cfa[_0x216d('0x35')]['filter']+'%'};return _0xf33f9c;}})});}_0x11be90=_[_0x216d('0x41')]({},_0x11be90,_0x169cfa[_0x216d('0x42')]);var _0x13d787={'where':_0x11be90[_0x216d('0x40')]};return db['VoiceChanSpy'][_0x216d('0x22')](_0x13d787)[_0x216d('0x27')](function(_0x5665d7){_0x4537fd[_0x216d('0x22')]=_0x5665d7;if(_0x169cfa[_0x216d('0x35')]['includeAll']){_0x11be90['include']=[{'all':!![]}];}return db[_0x216d('0x2f')][_0x216d('0x43')](_0x11be90);})[_0x216d('0x27')](function(_0x498efe){_0x4537fd[_0x216d('0x44')]=_0x498efe;return _0x4537fd;})['then'](respondWithFilteredResult(_0x28f56a,_0x11be90))['catch'](handleError(_0x28f56a,null));};exports[_0x216d('0x45')]=function(_0x43336e,_0xac81f){var _0x5ddaeb={'raw':![],'where':{'id':_0x43336e['params']['id']}},_0xaccf45={};_0xaccf45[_0x216d('0x34')]=_[_0x216d('0x36')](db[_0x216d('0x2f')]['rawAttributes']);_0xaccf45[_0x216d('0x35')]=_[_0x216d('0x36')](_0x43336e[_0x216d('0x35')]);_0xaccf45[_0x216d('0x37')]=_['intersection'](_0xaccf45['model'],_0xaccf45['query']);_0x5ddaeb[_0x216d('0x39')]=_[_0x216d('0x38')](_0xaccf45[_0x216d('0x34')],qs[_0x216d('0x3a')](_0x43336e[_0x216d('0x35')][_0x216d('0x3a')]));_0x5ddaeb[_0x216d('0x39')]=_0x5ddaeb[_0x216d('0x39')]['length']?_0x5ddaeb[_0x216d('0x39')]:_0xaccf45[_0x216d('0x34')];if(_0x43336e[_0x216d('0x35')][_0x216d('0x46')]){_0x5ddaeb['include']=[{'all':!![]}];}_0x5ddaeb=_[_0x216d('0x41')]({},_0x5ddaeb,_0x43336e['options']);return db[_0x216d('0x2f')][_0x216d('0x47')](_0x5ddaeb)[_0x216d('0x27')](handleEntityNotFound(_0xac81f,null))['then'](respondWithResult(_0xac81f,null))['catch'](handleError(_0xac81f,null));};exports[_0x216d('0x48')]=function(_0x32d499,_0x3932a3){return db[_0x216d('0x2f')][_0x216d('0x48')](_0x32d499[_0x216d('0x49')],{})['then'](function(_0x4f9274){var _0x26209c=_0x32d499['user'][_0x216d('0x28')]({'plain':!![]});if(!_0x26209c)throw new Error(_0x216d('0x4a'));if(_0x26209c['role']==='user'){var _0x5f37e3=_0x4f9274['get']({'plain':!![]});var _0x1ae9b7=_0x216d('0x4b');return db[_0x216d('0x4c')][_0x216d('0x47')]({'where':{'name':_0x1ae9b7,'userProfileId':_0x26209c[_0x216d('0x4d')]},'raw':!![]})[_0x216d('0x27')](function(_0x29efa8){if(_0x29efa8&&_0x29efa8['autoAssociation']===0x0){return db[_0x216d('0x4e')][_0x216d('0x48')]({'name':_0x5f37e3[_0x216d('0x2b')],'resourceId':_0x5f37e3['id'],'type':_0x29efa8['name'],'sectionId':_0x29efa8['id']},{})[_0x216d('0x27')](function(){return _0x4f9274;});}else{return _0x4f9274;}})[_0x216d('0x4f')](function(_0x2c7c67){logger[_0x216d('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c7c67);throw _0x2c7c67;});}return _0x4f9274;})[_0x216d('0x27')](respondWithResult(_0x3932a3,0xc9))[_0x216d('0x4f')](handleError(_0x3932a3,null));};exports[_0x216d('0x50')]=function(_0x1a4761,_0x4d7705){if(_0x1a4761[_0x216d('0x49')]['id']){delete _0x1a4761[_0x216d('0x49')]['id'];}return db['VoiceChanSpy'][_0x216d('0x47')]({'where':{'id':_0x1a4761['params']['id']}})[_0x216d('0x27')](handleEntityNotFound(_0x4d7705,null))[_0x216d('0x27')](saveUpdates(_0x1a4761[_0x216d('0x49')],null))[_0x216d('0x27')](respondWithResult(_0x4d7705,null))[_0x216d('0x4f')](handleError(_0x4d7705,null));};exports[_0x216d('0x51')]=function(_0x24297f,_0x2c6cb6){return db[_0x216d('0x2f')]['find']({'where':{'id':_0x24297f[_0x216d('0x52')]['id']}})[_0x216d('0x27')](handleEntityNotFound(_0x2c6cb6,null))['then'](removeEntity(_0x2c6cb6,null))[_0x216d('0x4f')](handleError(_0x2c6cb6,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index edf0e77..deb9137 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 _0x6927=['record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','findAll','agent','then','exports','define','VoiceChanSpy','bulkCreate','catch','VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6927,0x64));var _0x7692=function(_0x1af4d7,_0x4cb6db){_0x1af4d7=_0x1af4d7-0x0;var _0xa1a660=_0x6927[_0x1af4d7];return _0xa1a660;};'use strict';var _=require(_0x7692('0x0'));var util=require(_0x7692('0x1'));var BPromise=require(_0x7692('0x2'));var attributes=require(_0x7692('0x3'));var getUserApplications=function(_0x44719b,_0x2dca65,_0x5e3816){var _0x1f8a0b=0x1;var _0x4ec388=[];var _0x3c579e={'context':_0x2dca65[_0x7692('0x4')]||_0x7692('0x5'),'exten':util[_0x7692('0x6')](_0x7692('0x7'),_0x44719b[_0x7692('0x8')],_0x5e3816),'type':_0x7692('0x9'),'isApp':![],'ChanSpyId':_0x44719b['id'],'UserId':_0x2dca65['id']};_0x4ec388[_0x7692('0xa')](_[_0x7692('0xb')]({'app':_0x7692('0xc'),'appdata':util['format'](_0x7692('0xd'),'chanspy'),'priority':_0x1f8a0b++},_0x3c579e));if(_0x44719b[_0x7692('0xe')]){_0x4ec388[_0x7692('0xa')](_[_0x7692('0xb')]({'app':_0x7692('0xf'),'appdata':util[_0x7692('0x6')](_0x7692('0x10'),_0x44719b[_0x7692('0x11')]),'priority':_0x1f8a0b++},_0x3c579e));}if(_0x44719b['auth']){_0x4ec388[_0x7692('0xa')](_[_0x7692('0xb')]({'app':_0x7692('0x12'),'appdata':_0x44719b['password'],'priority':_0x1f8a0b++},_0x3c579e));}_0x4ec388['push'](_[_0x7692('0xb')]({'app':_0x7692('0x13'),'appdata':util['format'](_0x7692('0x14'),_0x2dca65[_0x7692('0x15')],_0x44719b[_0x7692('0x16')]?_0x44719b[_0x7692('0x16')][_0x7692('0x17')](''):''),'priority':_0x1f8a0b++},_0x3c579e));if(_0x44719b[_0x7692('0xe')]){_0x4ec388[_0x7692('0xa')](_[_0x7692('0xb')]({'app':_0x7692('0x18'),'priority':_0x1f8a0b++},_0x3c579e));}return _0x4ec388;};var getChanSpyApplications=function(_0x3642b7,_0x52b8fd){var _0xc578a0=[];for(var _0x2f080e=0x0,_0x1c6c6d=0x1;_0x2f080e<_0x52b8fd[_0x7692('0x19')];_0x2f080e++,_0x1c6c6d=0x1){_0xc578a0=_0xc578a0['concat'](getUserApplications(_0x3642b7,_0x52b8fd[_0x2f080e],_0x52b8fd[_0x2f080e]['internal']));if(_0x52b8fd[_0x2f080e][_0x7692('0x1a')]!=_0x52b8fd[_0x2f080e][_0x7692('0x15')]){_0xc578a0=_0xc578a0[_0x7692('0x1b')](getUserApplications(_0x3642b7,_0x52b8fd[_0x2f080e],_0x52b8fd[_0x2f080e][_0x7692('0x15')]));}}return _0xc578a0;};var getChanSpyPromise=function(_0x5624c5,_0x1d77d8){return new BPromise(function(_0x32a3bb,_0x498b76){return _0x5624c5['User'][_0x7692('0x1c')]({'attributes':['id',_0x7692('0x15'),_0x7692('0x1a')],'where':{'role':_0x7692('0x1d'),'chanspy':!![]},'raw':!![]})[_0x7692('0x1e')](function(_0x1484b6){if(_0x1484b6){return _0x32a3bb(getChanSpyApplications(_0x1d77d8,_0x1484b6));}return _0x32a3bb([]);})['catch'](function(_0x5519d6){_0x498b76(_0x5519d6);});});};module[_0x7692('0x1f')]=function(_0x4e37a1,_0x413f6c){var _0xcffa66=_0x4e37a1['models'];return _0x4e37a1[_0x7692('0x20')](_0x7692('0x21'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4eb5d4,_0x1a5001,_0x1fe03c){return getChanSpyPromise(_0xcffa66,_0x4eb5d4)[_0x7692('0x1e')](function(_0x186251){if(_0x186251&&_0x186251[_0x7692('0x19')]){return _0xcffa66['VoiceExtension'][_0x7692('0x22')](_0x186251);}})[_0x7692('0x1e')](function(){_0x1fe03c();})[_0x7692('0x23')](function(_0x50c1b5){_0x1fe03c(_0x50c1b5);});},'afterUpdate':function(_0x286e4b,_0x2e3838,_0x382eba){return _0xcffa66[_0x7692('0x24')]['destroy']({'where':{'ChanSpyId':_0x286e4b['id']}})['then'](function(){return getChanSpyPromise(_0xcffa66,_0x286e4b);})[_0x7692('0x1e')](function(_0x4862f2){if(_0x4862f2&&_0x4862f2['length']){return _0xcffa66[_0x7692('0x24')]['bulkCreate'](_0x4862f2);}})[_0x7692('0x1e')](function(){_0x382eba();})[_0x7692('0x23')](function(_0x6a931c){_0x382eba(_0x6a931c);});},'afterDestroy':function(_0x301d0b,_0x490009,_0x5be004){return _0xcffa66[_0x7692('0x24')][_0x7692('0x25')]({'where':{'ChanSpyId':_0x301d0b['id']}})[_0x7692('0x1e')](function(){_0x5be004();})['catch'](function(_0x5036dd){_0x5be004(_0x5036dd);});}}});}; \ No newline at end of file +var _0x684d=['VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','system','push','merge','Set','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','format','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','findAll','agent','then','catch','models'];(function(_0x5eac06,_0x3670e5){var _0x4ab829=function(_0x358fef){while(--_0x358fef){_0x5eac06['push'](_0x5eac06['shift']());}};_0x4ab829(++_0x3670e5);}(_0x684d,0xc3));var _0xd684=function(_0x13bf2b,_0x1b7d9a){_0x13bf2b=_0x13bf2b-0x0;var _0x43bccf=_0x684d[_0x13bf2b];return _0x43bccf;};'use strict';var _=require('lodash');var util=require(_0xd684('0x0'));var BPromise=require(_0xd684('0x1'));var attributes=require(_0xd684('0x2'));var getUserApplications=function(_0x3aa900,_0x223fef,_0x1b7199){var _0xf1856b=0x1;var _0x5933b9=[];var _0x3d7c44={'context':_0x223fef[_0xd684('0x3')]||_0xd684('0x4'),'exten':util['format'](_0xd684('0x5'),_0x3aa900['prefix'],_0x1b7199),'type':_0xd684('0x6'),'isApp':![],'ChanSpyId':_0x3aa900['id'],'UserId':_0x223fef['id']};_0x5933b9[_0xd684('0x7')](_[_0xd684('0x8')]({'app':_0xd684('0x9'),'appdata':util['format']('CDR(type)=%s',_0xd684('0xa')),'priority':_0xf1856b++},_0x3d7c44));if(_0x3aa900[_0xd684('0xb')]){_0x5933b9[_0xd684('0x7')](_[_0xd684('0x8')]({'app':_0xd684('0xc'),'appdata':util['format'](_0xd684('0xd'),_0x3aa900[_0xd684('0xe')]),'priority':_0xf1856b++},_0x3d7c44));}if(_0x3aa900[_0xd684('0xf')]){_0x5933b9[_0xd684('0x7')](_['merge']({'app':_0xd684('0x10'),'appdata':_0x3aa900['password'],'priority':_0xf1856b++},_0x3d7c44));}_0x5933b9[_0xd684('0x7')](_['merge']({'app':_0xd684('0x11'),'appdata':util[_0xd684('0x12')](_0xd684('0x13'),_0x223fef[_0xd684('0x14')],_0x3aa900['options']?_0x3aa900[_0xd684('0x15')][_0xd684('0x16')](''):''),'priority':_0xf1856b++},_0x3d7c44));if(_0x3aa900[_0xd684('0xb')]){_0x5933b9[_0xd684('0x7')](_['merge']({'app':_0xd684('0x17'),'priority':_0xf1856b++},_0x3d7c44));}return _0x5933b9;};var getChanSpyApplications=function(_0x443a9b,_0x442685){var _0x12d953=[];for(var _0x2b3744=0x0,_0x3d8f68=0x1;_0x2b3744<_0x442685[_0xd684('0x18')];_0x2b3744++,_0x3d8f68=0x1){_0x12d953=_0x12d953['concat'](getUserApplications(_0x443a9b,_0x442685[_0x2b3744],_0x442685[_0x2b3744][_0xd684('0x19')]));if(_0x442685[_0x2b3744]['internal']!=_0x442685[_0x2b3744]['name']){_0x12d953=_0x12d953[_0xd684('0x1a')](getUserApplications(_0x443a9b,_0x442685[_0x2b3744],_0x442685[_0x2b3744][_0xd684('0x14')]));}}return _0x12d953;};var getChanSpyPromise=function(_0x47276f,_0x388df8){return new BPromise(function(_0x2773c1,_0x4a8f08){return _0x47276f[_0xd684('0x1b')][_0xd684('0x1c')]({'attributes':['id',_0xd684('0x14'),'internal'],'where':{'role':_0xd684('0x1d'),'chanspy':!![]},'raw':!![]})[_0xd684('0x1e')](function(_0x415055){if(_0x415055){return _0x2773c1(getChanSpyApplications(_0x388df8,_0x415055));}return _0x2773c1([]);})[_0xd684('0x1f')](function(_0x3a800f){_0x4a8f08(_0x3a800f);});});};module['exports']=function(_0x245e13,_0x1713d6){var _0x451af5=_0x245e13[_0xd684('0x20')];return _0x245e13['define'](_0xd684('0x21'),attributes,{'tableName':_0xd684('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x377cb6,_0x14b9de,_0x4fa9ab){return getChanSpyPromise(_0x451af5,_0x377cb6)['then'](function(_0x19e54e){if(_0x19e54e&&_0x19e54e[_0xd684('0x18')]){return _0x451af5[_0xd684('0x23')][_0xd684('0x24')](_0x19e54e);}})[_0xd684('0x1e')](function(){_0x4fa9ab();})[_0xd684('0x1f')](function(_0x34a887){_0x4fa9ab(_0x34a887);});},'afterUpdate':function(_0x5936b3,_0x412d96,_0x2d2b0c){return _0x451af5[_0xd684('0x23')][_0xd684('0x25')]({'where':{'ChanSpyId':_0x5936b3['id']}})[_0xd684('0x1e')](function(){return getChanSpyPromise(_0x451af5,_0x5936b3);})[_0xd684('0x1e')](function(_0x4921df){if(_0x4921df&&_0x4921df[_0xd684('0x18')]){return _0x451af5['VoiceExtension']['bulkCreate'](_0x4921df);}})[_0xd684('0x1e')](function(){_0x2d2b0c();})['catch'](function(_0x1ce894){_0x2d2b0c(_0x1ce894);});},'afterDestroy':function(_0x121748,_0x580c6e,_0x16259b){return _0x451af5[_0xd684('0x23')]['destroy']({'where':{'ChanSpyId':_0x121748['id']}})[_0xd684('0x1e')](function(){_0x16259b();})[_0xd684('0x1f')](function(_0x185acc){_0x16259b(_0x185acc);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 7f60c5b..3a63892 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 _0x5db8=['info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x5db8,0xbb));var _0x85db=function(_0x271537,_0x8b7b3b){_0x271537=_0x271537-0x0;var _0x19dc22=_0x5db8[_0x271537];return _0x19dc22;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var moment=require(_0x85db('0x2'));var BPromise=require('bluebird');var rs=require(_0x85db('0x3'));var fs=require('fs');var Redis=require(_0x85db('0x4'));var db=require(_0x85db('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x85db('0x6'));var config=require(_0x85db('0x7'));var jayson=require(_0x85db('0x8'));var client=jayson[_0x85db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x489b13,_0x2b9f25,_0x3a10dd){return new BPromise(function(_0xc6fd00,_0x308988){return client['request'](_0x489b13,_0x3a10dd)[_0x85db('0xa')](function(_0x54f0c1){logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));logger[_0x85db('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x2b9f25,'request\x20sent',JSON['stringify'](_0x54f0c1));if(_0x54f0c1[_0x85db('0xf')]){if(_0x54f0c1[_0x85db('0xf')]['code']===0x1f4){logger[_0x85db('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0x308988(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0xc6fd00(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}else{logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));_0xc6fd00(_0x54f0c1['result'][_0x85db('0x10')]);}})[_0x85db('0x11')](function(_0x11e7da){logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x11e7da);_0x308988(_0x11e7da);});});} \ No newline at end of file +var _0x3e5c=['info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x128ce5,_0x1311e3){var _0x3644e8=function(_0x5bfe48){while(--_0x5bfe48){_0x128ce5['push'](_0x128ce5['shift']());}};_0x3644e8(++_0x1311e3);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x576d57,_0x54b368){_0x576d57=_0x576d57-0x0;var _0x1752e9=_0x3e5c[_0x576d57];return _0x1752e9;};'use strict';var _=require(_0xc3e5('0x0'));var util=require(_0xc3e5('0x1'));var moment=require(_0xc3e5('0x2'));var BPromise=require(_0xc3e5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3e5('0x4'));var db=require(_0xc3e5('0x5'))['db'];var utils=require(_0xc3e5('0x6'));var logger=require(_0xc3e5('0x7'))(_0xc3e5('0x8'));var config=require(_0xc3e5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc3e5('0xa')][_0xc3e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d6089,_0xcbbec0,_0x2d580e){return new BPromise(function(_0x4864a2,_0x196f3a){return client[_0xc3e5('0xc')](_0x2d6089,_0x2d580e)[_0xc3e5('0xd')](function(_0x19813b){logger[_0xc3e5('0xe')](_0xc3e5('0xf'),_0xcbbec0,_0xc3e5('0x10'));logger['debug'](_0xc3e5('0x11'),_0xcbbec0,_0xc3e5('0x10'),JSON[_0xc3e5('0x12')](_0x19813b));if(_0x19813b[_0xc3e5('0x13')]){if(_0x19813b['error'][_0xc3e5('0x14')]===0x1f4){logger[_0xc3e5('0x13')](_0xc3e5('0xf'),_0xcbbec0,_0x19813b[_0xc3e5('0x13')][_0xc3e5('0x15')]);return _0x196f3a(_0x19813b[_0xc3e5('0x13')]['message']);}logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0xcbbec0,_0x19813b[_0xc3e5('0x13')]['message']);return _0x4864a2(_0x19813b[_0xc3e5('0x13')][_0xc3e5('0x15')]);}else{logger['info'](_0xc3e5('0xf'),_0xcbbec0,_0xc3e5('0x10'));_0x4864a2(_0x19813b[_0xc3e5('0x16')][_0xc3e5('0x15')]);}})[_0xc3e5('0x17')](function(_0x47cfd8){logger[_0xc3e5('0x13')](_0xc3e5('0xf'),_0xcbbec0,_0x47cfd8);_0x196f3a(_0x47cfd8);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 9899b4c..696b50c 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 _0xdc79=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id','post','create','update','delete','destroy','exports','multer'];(function(_0xa6afd2,_0x11e034){var _0x86b4d5=function(_0x37acae){while(--_0x37acae){_0xa6afd2['push'](_0xa6afd2['shift']());}};_0x86b4d5(++_0x11e034);}(_0xdc79,0xb3));var _0x9dc7=function(_0x227fef,_0x42c1a8){_0x227fef=_0x227fef-0x0;var _0x4fea88=_0xdc79[_0x227fef];return _0x4fea88;};'use strict';var multer=require(_0x9dc7('0x0'));var util=require(_0x9dc7('0x1'));var path=require(_0x9dc7('0x2'));var timeout=require(_0x9dc7('0x3'));var express=require(_0x9dc7('0x4'));var router=express[_0x9dc7('0x5')]();var fs_extra=require(_0x9dc7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9dc7('0x7'));var config=require(_0x9dc7('0x8'));var controller=require(_0x9dc7('0x9'));router['get']('/',auth[_0x9dc7('0xa')](),controller[_0x9dc7('0xb')]);router[_0x9dc7('0xc')](_0x9dc7('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x9dc7('0xe')]('/',auth[_0x9dc7('0xa')](),controller[_0x9dc7('0xf')]);router['put']('/:id',auth[_0x9dc7('0xa')](),controller[_0x9dc7('0x10')]);router[_0x9dc7('0x11')](_0x9dc7('0xd'),auth['isAuthenticated'](),controller[_0x9dc7('0x12')]);module[_0x9dc7('0x13')]=router; \ No newline at end of file +var _0x7d0e=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2568c9,_0x368e7a){var _0x3f32c7=function(_0xb5b01a){while(--_0xb5b01a){_0x2568c9['push'](_0x2568c9['shift']());}};_0x3f32c7(++_0x368e7a);}(_0x7d0e,0x16d));var _0xe7d0=function(_0x29ebb3,_0x52226e){_0x29ebb3=_0x29ebb3-0x0;var _0x13909d=_0x7d0e[_0x29ebb3];return _0x13909d;};'use strict';var multer=require(_0xe7d0('0x0'));var util=require(_0xe7d0('0x1'));var path=require(_0xe7d0('0x2'));var timeout=require(_0xe7d0('0x3'));var express=require(_0xe7d0('0x4'));var router=express[_0xe7d0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe7d0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe7d0('0x7'));var controller=require(_0xe7d0('0x8'));router[_0xe7d0('0x9')]('/',auth[_0xe7d0('0xa')](),controller[_0xe7d0('0xb')]);router[_0xe7d0('0x9')](_0xe7d0('0xc'),auth[_0xe7d0('0xa')](),controller[_0xe7d0('0xd')]);router[_0xe7d0('0xe')]('/',auth[_0xe7d0('0xa')](),controller['create']);router[_0xe7d0('0xf')](_0xe7d0('0xc'),auth['isAuthenticated'](),controller[_0xe7d0('0x10')]);router[_0xe7d0('0x11')](_0xe7d0('0xc'),auth[_0xe7d0('0xa')](),controller[_0xe7d0('0x12')]);module[_0xe7d0('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 19b0a83..7a81900 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 _0xe340=['STRING','name','sequelize','exports'];(function(_0x541dc6,_0x38f354){var _0x37d7cf=function(_0x5c4cc0){while(--_0x5c4cc0){_0x541dc6['push'](_0x541dc6['shift']());}};_0x37d7cf(++_0x38f354);}(_0xe340,0xd2));var _0x0e34=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xe340[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0x0e34('0x0'));module[_0x0e34('0x1')]={'name':{'type':Sequelize[_0x0e34('0x2')],'unique':_0x0e34('0x3')},'description':{'type':Sequelize[_0x0e34('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x175d=['exports','STRING','BOOLEAN'];(function(_0x2550ce,_0x45209b){var _0x25748d=function(_0x806ad5){while(--_0x806ad5){_0x2550ce['push'](_0x2550ce['shift']());}};_0x25748d(++_0x45209b);}(_0x175d,0x168));var _0xd175=function(_0x7798d2,_0x221d1d){_0x7798d2=_0x7798d2-0x0;var _0x164c99=_0x175d[_0x7798d2];return _0x164c99;};'use strict';var Sequelize=require('sequelize');module[_0xd175('0x0')]={'name':{'type':Sequelize[_0xd175('0x1')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xd175('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 75ffa7a..e36cd93 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 _0x66d8=['length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','show','params','find','body','findAll','readFileSync','root','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','render','chan_sip.so','join','utf8','writeFileSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','debug','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','request\x20sent','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','Contexts','UserProfileResource','end','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x207b87,_0x3266e5){var _0xbc46ff=function(_0x8a4c5f){while(--_0x8a4c5f){_0x207b87['push'](_0x207b87['shift']());}};_0xbc46ff(++_0x3266e5);}(_0x66d8,0x15c));var _0x866d=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x66d8[_0x519756];return _0x37047e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x866d('0x0'));var jsonpatch=require(_0x866d('0x1'));var rp=require(_0x866d('0x2'));var moment=require(_0x866d('0x3'));var BPromise=require(_0x866d('0x4'));var Mustache=require(_0x866d('0x5'));var util=require(_0x866d('0x6'));var path=require('path');var sox=require(_0x866d('0x7'));var csv=require(_0x866d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x866d('0x9'));var _=require(_0x866d('0xa'));var squel=require(_0x866d('0xb'));var crypto=require(_0x866d('0xc'));var jsforce=require(_0x866d('0xd'));var deskjs=require(_0x866d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x866d('0xf'));var Papa=require(_0x866d('0x10'));var Redis=require(_0x866d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x866d('0x12'));var as=require(_0x866d('0x13'));var hardwareService=require(_0x866d('0x14'));var logger=require(_0x866d('0x15'))('api');var utils=require(_0x866d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x866d('0x17'));var db=require(_0x866d('0x18'))['db'];var jayson=require(_0x866d('0x19'));var client=jayson[_0x866d('0x1a')][_0x866d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x432d14,_0x24b416,_0x25fc65,_0x105965){return new BPromise(function(_0x2ce3bf,_0x4dc7c3){var _0x2d111a=_0x105965||client;return _0x2d111a['request'](_0x432d14,_0x25fc65)['then'](function(_0x413605){logger[_0x866d('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x24b416,'request\x20sent');logger[_0x866d('0x1d')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x24b416,'request\x20sent',JSON[_0x866d('0x1e')](_0x413605));if(_0x413605['error']){if(_0x413605[_0x866d('0x1f')][_0x866d('0x20')]===0x1f4){logger[_0x866d('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x24b416,_0x413605['error']['message']);return _0x4dc7c3(_0x413605[_0x866d('0x1f')][_0x866d('0x21')]);}logger['error'](_0x866d('0x22'),_0x24b416,_0x413605[_0x866d('0x1f')][_0x866d('0x21')]);return _0x2ce3bf(_0x413605['error'][_0x866d('0x21')]);}else{logger[_0x866d('0x1c')](_0x866d('0x22'),_0x24b416,_0x866d('0x23'));_0x2ce3bf(_0x413605[_0x866d('0x24')][_0x866d('0x21')]);}})[_0x866d('0x25')](function(_0x443126){logger[_0x866d('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x24b416,_0x443126);_0x4dc7c3(_0x443126);});});}function respondWithStatusCode(_0x4bb462,_0x25b3c6){_0x25b3c6=_0x25b3c6||0xcc;return function(_0x277a02){if(_0x277a02){return _0x4bb462[_0x866d('0x26')](_0x25b3c6);}return _0x4bb462[_0x866d('0x27')](_0x25b3c6)['end']();};}function respondWithResult(_0x46e755,_0x31dab4){_0x31dab4=_0x31dab4||0xc8;return function(_0x4cb6b6){if(_0x4cb6b6){return _0x46e755[_0x866d('0x27')](_0x31dab4)['json'](_0x4cb6b6);}};}function respondWithFilteredResult(_0x506351,_0x26c2d5){return function(_0x37072f){if(_0x37072f){var _0x38fe2c=typeof _0x26c2d5[_0x866d('0x28')]===_0x866d('0x29')&&typeof _0x26c2d5[_0x866d('0x2a')]===_0x866d('0x29');var _0x492eb1=_0x37072f[_0x866d('0x2b')];var _0x1a8e5a=_0x38fe2c?0x0:_0x26c2d5[_0x866d('0x28')];var _0x3b3ce1=_0x38fe2c?_0x37072f['count']:_0x26c2d5[_0x866d('0x28')]+_0x26c2d5[_0x866d('0x2a')];var _0x12cd46;if(_0x3b3ce1>=_0x492eb1){_0x3b3ce1=_0x492eb1;_0x12cd46=0xc8;}else{_0x12cd46=0xce;}_0x506351[_0x866d('0x27')](_0x12cd46);return _0x506351[_0x866d('0x2c')](_0x866d('0x2d'),_0x1a8e5a+'-'+_0x3b3ce1+'/'+_0x492eb1)['json'](_0x37072f);}return null;};}function patchUpdates(_0x38340b){return function(_0x44f450){try{jsonpatch[_0x866d('0x2e')](_0x44f450,_0x38340b,!![]);}catch(_0x5e7656){return BPromise['reject'](_0x5e7656);}return _0x44f450[_0x866d('0x2f')]();};}function saveUpdates(_0x5f2d94,_0x579234){return function(_0x8d053e){if(_0x8d053e){return _0x8d053e[_0x866d('0x30')](_0x5f2d94)['then'](function(_0xfe2476){return _0xfe2476;});}return null;};}function removeEntity(_0x2f3473,_0x483f49){return function(_0x3ce4ea){if(_0x3ce4ea){return _0x3ce4ea[_0x866d('0x31')]()[_0x866d('0x32')](function(){var _0xc7a965=_0x3ce4ea[_0x866d('0x33')]({'plain':!![]});var _0x12f97d=_0x866d('0x34');return db[_0x866d('0x35')][_0x866d('0x31')]({'where':{'type':_0x12f97d,'resourceId':_0xc7a965['id']}})[_0x866d('0x32')](function(){return _0x3ce4ea;});})[_0x866d('0x32')](function(){_0x2f3473[_0x866d('0x27')](0xcc)[_0x866d('0x36')]();});}};}function handleEntityNotFound(_0x431c9b,_0x34a0f4){return function(_0x17c036){if(!_0x17c036){_0x431c9b['sendStatus'](0x194);}return _0x17c036;};}function handleError(_0x1c15a5,_0x67386c){_0x67386c=_0x67386c||0x1f4;return function(_0x474d7f){logger[_0x866d('0x1f')](_0x474d7f[_0x866d('0x37')]);if(_0x474d7f[_0x866d('0x38')]){delete _0x474d7f[_0x866d('0x38')];}_0x1c15a5[_0x866d('0x27')](_0x67386c)[_0x866d('0x39')](_0x474d7f);};}exports[_0x866d('0x3a')]=function(_0x4641dc,_0x27af47){var _0x458b03={},_0x5f110a={},_0x15c267={'count':0x0,'rows':[]};var _0x21f4d0=_[_0x866d('0x3b')](db[_0x866d('0x3c')][_0x866d('0x3d')],function(_0x5c2358){return{'name':_0x5c2358[_0x866d('0x3e')],'type':_0x5c2358[_0x866d('0x3f')][_0x866d('0x40')]};});_0x5f110a[_0x866d('0x41')]=_['map'](_0x21f4d0,_0x866d('0x38'));_0x5f110a[_0x866d('0x42')]=_[_0x866d('0x43')](_0x4641dc[_0x866d('0x42')]);_0x5f110a[_0x866d('0x44')]=_[_0x866d('0x45')](_0x5f110a[_0x866d('0x41')],_0x5f110a[_0x866d('0x42')]);_0x458b03['attributes']=_['intersection'](_0x5f110a[_0x866d('0x41')],qs['fields'](_0x4641dc['query'][_0x866d('0x46')]));_0x458b03[_0x866d('0x47')]=_0x458b03[_0x866d('0x47')][_0x866d('0x48')]?_0x458b03['attributes']:_0x5f110a[_0x866d('0x41')];if(!_0x4641dc[_0x866d('0x42')]['hasOwnProperty'](_0x866d('0x49'))){_0x458b03[_0x866d('0x2a')]=qs[_0x866d('0x2a')](_0x4641dc[_0x866d('0x42')][_0x866d('0x2a')]);_0x458b03['offset']=qs['offset'](_0x4641dc[_0x866d('0x42')][_0x866d('0x28')]);}_0x458b03[_0x866d('0x4a')]=qs['sort'](_0x4641dc[_0x866d('0x42')][_0x866d('0x4b')]);_0x458b03[_0x866d('0x4c')]=qs[_0x866d('0x44')](_[_0x866d('0x4d')](_0x4641dc[_0x866d('0x42')],_0x5f110a[_0x866d('0x44')]),_0x21f4d0);if(_0x4641dc['query']['filter']){_0x458b03['where']=_[_0x866d('0x4e')](_0x458b03[_0x866d('0x4c')],{'$or':_['map'](_0x21f4d0,function(_0x1b1758){if(_0x1b1758[_0x866d('0x3f')]!==_0x866d('0x4f')){var _0x58bc18={};_0x58bc18[_0x1b1758[_0x866d('0x38')]]={'$like':'%'+_0x4641dc['query'][_0x866d('0x50')]+'%'};return _0x58bc18;}})});}_0x458b03=_['merge']({},_0x458b03,_0x4641dc['options']);var _0x53db16={'where':_0x458b03[_0x866d('0x4c')]};return db[_0x866d('0x3c')][_0x866d('0x2b')](_0x53db16)[_0x866d('0x32')](function(_0x157bb8){_0x15c267[_0x866d('0x2b')]=_0x157bb8;if(_0x4641dc[_0x866d('0x42')][_0x866d('0x51')]){_0x458b03[_0x866d('0x52')]=[{'all':!![]}];}return db[_0x866d('0x3c')]['findAll'](_0x458b03);})['then'](function(_0x3426b6){_0x15c267[_0x866d('0x53')]=_0x3426b6;return _0x15c267;})[_0x866d('0x32')](respondWithFilteredResult(_0x27af47,_0x458b03))['catch'](handleError(_0x27af47,null));};exports[_0x866d('0x54')]=function(_0x26e1cb,_0x39a878){var _0x44a78a={'raw':![],'where':{'id':_0x26e1cb[_0x866d('0x55')]['id']}},_0x5d37f0={};_0x5d37f0[_0x866d('0x41')]=_[_0x866d('0x43')](db[_0x866d('0x3c')][_0x866d('0x3d')]);_0x5d37f0[_0x866d('0x42')]=_[_0x866d('0x43')](_0x26e1cb[_0x866d('0x42')]);_0x5d37f0[_0x866d('0x44')]=_[_0x866d('0x45')](_0x5d37f0[_0x866d('0x41')],_0x5d37f0[_0x866d('0x42')]);_0x44a78a[_0x866d('0x47')]=_[_0x866d('0x45')](_0x5d37f0[_0x866d('0x41')],qs['fields'](_0x26e1cb['query'][_0x866d('0x46')]));_0x44a78a['attributes']=_0x44a78a['attributes']['length']?_0x44a78a['attributes']:_0x5d37f0[_0x866d('0x41')];if(_0x26e1cb[_0x866d('0x42')][_0x866d('0x51')]){_0x44a78a['include']=[{'all':!![]}];}_0x44a78a=_[_0x866d('0x4e')]({},_0x44a78a,_0x26e1cb['options']);return db[_0x866d('0x3c')][_0x866d('0x56')](_0x44a78a)[_0x866d('0x32')](handleEntityNotFound(_0x39a878,null))[_0x866d('0x32')](respondWithResult(_0x39a878,null))[_0x866d('0x25')](handleError(_0x39a878,null));};exports['create']=function(_0x230059,_0x12312b,_0x25aa15){var _0x5b0aaf;return db[_0x866d('0x3c')]['create'](_0x230059[_0x866d('0x57')],{'raw':!![]})['then'](function(_0xfaafe7){_0x5b0aaf=_0xfaafe7;return db[_0x866d('0x3c')][_0x866d('0x58')]({'raw':!![]});})[_0x866d('0x32')](function(_0x3d1451){var _0x53119c=fs[_0x866d('0x59')](path['join'](config[_0x866d('0x5a')],_0x866d('0x5b')),'utf8');var _0x4692c8=ejs['render'](_0x53119c,{'contexts':_0x3d1451||[]});fs['writeFileSync'](_0x866d('0x5c'),_0x4692c8);})[_0x866d('0x32')](function(){return respondWithRpcPromise(_0x866d('0x5d'),_0x866d('0x5e'),{'module':'chan_sip.so'});})[_0x866d('0x32')](function(){var _0x39a87b=_0x230059['user']['get']({'plain':!![]});if(!_0x39a87b)throw new Error(_0x866d('0x5f'));if(_0x39a87b['role']===_0x866d('0x60')){var _0x578f2e=_0x5b0aaf['get']({'plain':!![]});return db[_0x866d('0x61')]['find']({'where':{'name':_0x866d('0x34'),'userProfileId':_0x39a87b[_0x866d('0x62')]},'raw':!![]})['then'](function(_0x5c3bf0){if(_0x5c3bf0&&_0x5c3bf0['autoAssociation']===0x0){return db['UserProfileResource'][_0x866d('0x5e')]({'name':_0x578f2e['name'],'resourceId':_0x578f2e['id'],'type':_0x5c3bf0['name'],'sectionId':_0x5c3bf0['id']},{})['then'](function(){return _0x5b0aaf;});}else{return _0x5b0aaf;}})[_0x866d('0x25')](function(_0x1d2d3a){logger['error'](_0x866d('0x63'),_0x1d2d3a);throw _0x1d2d3a;});}return _0x5b0aaf;})['then'](respondWithResult(_0x12312b,0xc9))[_0x866d('0x25')](handleError(_0x12312b,null));};exports[_0x866d('0x30')]=function(_0x4cdb0e,_0x2a069b,_0x32c2b5){var _0x29ad37;return db['VoiceContext'][_0x866d('0x56')]({'where':{'id':_0x4cdb0e['params']['id']}})[_0x866d('0x32')](handleEntityNotFound(_0x2a069b,null))['then'](saveUpdates(_0x4cdb0e[_0x866d('0x57')],null))['then'](function(_0x6197da){if(_0x6197da){_0x29ad37=_0x6197da;return db[_0x866d('0x3c')][_0x866d('0x58')]({'raw':!![]});}})['then'](function(_0x39ba66){var _0x3bc729=fs[_0x866d('0x59')](path['join'](config[_0x866d('0x5a')],_0x866d('0x5b')),'utf8');var _0x3d4c70=ejs[_0x866d('0x64')](_0x3bc729,{'contexts':_0x39ba66||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x3d4c70);})[_0x866d('0x32')](function(){return respondWithRpcPromise(_0x866d('0x5d'),_0x866d('0x30'),{'module':_0x866d('0x65')});})['then'](function(){return _0x29ad37;})[_0x866d('0x32')](respondWithResult(_0x2a069b,null))[_0x866d('0x25')](handleError(_0x2a069b,null));};exports['destroy']=function(_0x484852,_0xd0b465,_0x49be43){var _0x1a3ffe;return db[_0x866d('0x3c')][_0x866d('0x56')]({'where':{'id':_0x484852[_0x866d('0x55')]['id']}})[_0x866d('0x32')](handleEntityNotFound(_0xd0b465,null))[_0x866d('0x32')](removeEntity(_0xd0b465,null))['then'](function(){return db[_0x866d('0x3c')][_0x866d('0x58')]({'raw':!![]});})['then'](function(_0x55267c){var _0x1d802d=fs[_0x866d('0x59')](path[_0x866d('0x66')](config['root'],_0x866d('0x5b')),_0x866d('0x67'));var _0x52d0a2=ejs[_0x866d('0x64')](_0x1d802d,{'contexts':_0x55267c});fs[_0x866d('0x68')](_0x866d('0x5c'),_0x52d0a2);return respondWithRpcPromise(_0x866d('0x5d'),_0x866d('0x31'),{'module':_0x866d('0x65')});})[_0x866d('0x25')](handleError(_0xd0b465,null));}; \ No newline at end of file +var _0xc9f2=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','utf8','chan_sip.so','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','update','then','get','UserProfileResource','destroy','stack','send','index','VoiceContext','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','options','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','create','readFileSync','join','root','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user'];(function(_0x22fccd,_0x554a9a){var _0x10e3f7=function(_0x3cd399){while(--_0x3cd399){_0x22fccd['push'](_0x22fccd['shift']());}};_0x10e3f7(++_0x554a9a);}(_0xc9f2,0x13e));var _0x2c9f=function(_0x53745b,_0x173f17){_0x53745b=_0x53745b-0x0;var _0x5f05bd=_0xc9f2[_0x53745b];return _0x5f05bd;};'use strict';var emlformat=require(_0x2c9f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c9f('0x1'));var jsonpatch=require(_0x2c9f('0x2'));var rp=require(_0x2c9f('0x3'));var moment=require('moment');var BPromise=require(_0x2c9f('0x4'));var Mustache=require(_0x2c9f('0x5'));var util=require(_0x2c9f('0x6'));var path=require(_0x2c9f('0x7'));var sox=require(_0x2c9f('0x8'));var csv=require(_0x2c9f('0x9'));var ejs=require(_0x2c9f('0xa'));var fs=require('fs');var fs_extra=require(_0x2c9f('0xb'));var _=require(_0x2c9f('0xc'));var squel=require('squel');var crypto=require(_0x2c9f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2c9f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2c9f('0xf'));var Papa=require(_0x2c9f('0x10'));var Redis=require(_0x2c9f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2c9f('0x12'));var as=require(_0x2c9f('0x13'));var hardwareService=require(_0x2c9f('0x14'));var logger=require(_0x2c9f('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2c9f('0x16'));var db=require(_0x2c9f('0x17'))['db'];var jayson=require(_0x2c9f('0x18'));var client=jayson['client'][_0x2c9f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x425496,_0x3ddb56,_0x3d4487,_0x4da69a){return new BPromise(function(_0x326a69,_0x19cc2b){var _0x519f55=_0x4da69a||client;return _0x519f55[_0x2c9f('0x1a')](_0x425496,_0x3d4487)['then'](function(_0x5aab68){logger[_0x2c9f('0x1b')](_0x2c9f('0x1c'),_0x3ddb56,_0x2c9f('0x1d'));logger[_0x2c9f('0x1e')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3ddb56,_0x2c9f('0x1d'),JSON[_0x2c9f('0x1f')](_0x5aab68));if(_0x5aab68[_0x2c9f('0x20')]){if(_0x5aab68[_0x2c9f('0x20')][_0x2c9f('0x21')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x3ddb56,_0x5aab68[_0x2c9f('0x20')][_0x2c9f('0x22')]);return _0x19cc2b(_0x5aab68[_0x2c9f('0x20')][_0x2c9f('0x22')]);}logger['error'](_0x2c9f('0x1c'),_0x3ddb56,_0x5aab68[_0x2c9f('0x20')][_0x2c9f('0x22')]);return _0x326a69(_0x5aab68[_0x2c9f('0x20')]['message']);}else{logger[_0x2c9f('0x1b')](_0x2c9f('0x1c'),_0x3ddb56,'request\x20sent');_0x326a69(_0x5aab68[_0x2c9f('0x23')]['message']);}})[_0x2c9f('0x24')](function(_0x35a6c9){logger[_0x2c9f('0x20')]('VoiceContext,\x20%s,\x20%s',_0x3ddb56,_0x35a6c9);_0x19cc2b(_0x35a6c9);});});}function respondWithStatusCode(_0x27bae3,_0x3e08d2){_0x3e08d2=_0x3e08d2||0xcc;return function(_0x59fbab){if(_0x59fbab){return _0x27bae3[_0x2c9f('0x25')](_0x3e08d2);}return _0x27bae3['status'](_0x3e08d2)[_0x2c9f('0x26')]();};}function respondWithResult(_0x19b63d,_0x724994){_0x724994=_0x724994||0xc8;return function(_0x3ba7e7){if(_0x3ba7e7){return _0x19b63d['status'](_0x724994)[_0x2c9f('0x27')](_0x3ba7e7);}};}function respondWithFilteredResult(_0x3a95a0,_0x2714c5){return function(_0x1d3e73){if(_0x1d3e73){var _0x424be1=typeof _0x2714c5['offset']===_0x2c9f('0x28')&&typeof _0x2714c5[_0x2c9f('0x29')]===_0x2c9f('0x28');var _0x3b06c0=_0x1d3e73[_0x2c9f('0x2a')];var _0x652c81=_0x424be1?0x0:_0x2714c5['offset'];var _0x2c7ef2=_0x424be1?_0x1d3e73['count']:_0x2714c5[_0x2c9f('0x2b')]+_0x2714c5[_0x2c9f('0x29')];var _0x267aa2;if(_0x2c7ef2>=_0x3b06c0){_0x2c7ef2=_0x3b06c0;_0x267aa2=0xc8;}else{_0x267aa2=0xce;}_0x3a95a0[_0x2c9f('0x2c')](_0x267aa2);return _0x3a95a0[_0x2c9f('0x2d')](_0x2c9f('0x2e'),_0x652c81+'-'+_0x2c7ef2+'/'+_0x3b06c0)['json'](_0x1d3e73);}return null;};}function patchUpdates(_0x5e063c){return function(_0x125311){try{jsonpatch['apply'](_0x125311,_0x5e063c,!![]);}catch(_0x7b007f){return BPromise[_0x2c9f('0x2f')](_0x7b007f);}return _0x125311['save']();};}function saveUpdates(_0x2728f1,_0x29eaa5){return function(_0x2f7412){if(_0x2f7412){return _0x2f7412[_0x2c9f('0x30')](_0x2728f1)[_0x2c9f('0x31')](function(_0x3038bc){return _0x3038bc;});}return null;};}function removeEntity(_0x10fdfc,_0x1c0534){return function(_0x333aef){if(_0x333aef){return _0x333aef['destroy']()[_0x2c9f('0x31')](function(){var _0x3965d1=_0x333aef[_0x2c9f('0x32')]({'plain':!![]});var _0x37df09='Contexts';return db[_0x2c9f('0x33')][_0x2c9f('0x34')]({'where':{'type':_0x37df09,'resourceId':_0x3965d1['id']}})[_0x2c9f('0x31')](function(){return _0x333aef;});})[_0x2c9f('0x31')](function(){_0x10fdfc[_0x2c9f('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f6de4,_0x54b26c){return function(_0x1330d0){if(!_0x1330d0){_0x2f6de4['sendStatus'](0x194);}return _0x1330d0;};}function handleError(_0x563c43,_0x44eb9a){_0x44eb9a=_0x44eb9a||0x1f4;return function(_0x2c21d5){logger[_0x2c9f('0x20')](_0x2c21d5[_0x2c9f('0x35')]);if(_0x2c21d5['name']){delete _0x2c21d5['name'];}_0x563c43[_0x2c9f('0x2c')](_0x44eb9a)[_0x2c9f('0x36')](_0x2c21d5);};}exports[_0x2c9f('0x37')]=function(_0x5281f8,_0x3b835f){var _0x5976ec={},_0xd58edb={},_0x5bfd1d={'count':0x0,'rows':[]};var _0x52dc46=_['map'](db[_0x2c9f('0x38')]['rawAttributes'],function(_0x4ff080){return{'name':_0x4ff080[_0x2c9f('0x39')],'type':_0x4ff080[_0x2c9f('0x3a')][_0x2c9f('0x3b')]};});_0xd58edb[_0x2c9f('0x3c')]=_[_0x2c9f('0x3d')](_0x52dc46,_0x2c9f('0x3e'));_0xd58edb[_0x2c9f('0x3f')]=_[_0x2c9f('0x40')](_0x5281f8[_0x2c9f('0x3f')]);_0xd58edb[_0x2c9f('0x41')]=_['intersection'](_0xd58edb['model'],_0xd58edb[_0x2c9f('0x3f')]);_0x5976ec['attributes']=_[_0x2c9f('0x42')](_0xd58edb['model'],qs[_0x2c9f('0x43')](_0x5281f8['query'][_0x2c9f('0x43')]));_0x5976ec[_0x2c9f('0x44')]=_0x5976ec[_0x2c9f('0x44')][_0x2c9f('0x45')]?_0x5976ec[_0x2c9f('0x44')]:_0xd58edb['model'];if(!_0x5281f8[_0x2c9f('0x3f')][_0x2c9f('0x46')](_0x2c9f('0x47'))){_0x5976ec['limit']=qs[_0x2c9f('0x29')](_0x5281f8[_0x2c9f('0x3f')][_0x2c9f('0x29')]);_0x5976ec[_0x2c9f('0x2b')]=qs[_0x2c9f('0x2b')](_0x5281f8[_0x2c9f('0x3f')][_0x2c9f('0x2b')]);}_0x5976ec['order']=qs[_0x2c9f('0x48')](_0x5281f8[_0x2c9f('0x3f')][_0x2c9f('0x48')]);_0x5976ec['where']=qs['filters'](_['pick'](_0x5281f8[_0x2c9f('0x3f')],_0xd58edb[_0x2c9f('0x41')]),_0x52dc46);if(_0x5281f8['query'][_0x2c9f('0x49')]){_0x5976ec[_0x2c9f('0x4a')]=_['merge'](_0x5976ec[_0x2c9f('0x4a')],{'$or':_[_0x2c9f('0x3d')](_0x52dc46,function(_0x1ca4ac){if(_0x1ca4ac[_0x2c9f('0x3a')]!=='VIRTUAL'){var _0x4d3e33={};_0x4d3e33[_0x1ca4ac[_0x2c9f('0x3e')]]={'$like':'%'+_0x5281f8['query'][_0x2c9f('0x49')]+'%'};return _0x4d3e33;}})});}_0x5976ec=_['merge']({},_0x5976ec,_0x5281f8[_0x2c9f('0x4b')]);var _0x31c2cf={'where':_0x5976ec[_0x2c9f('0x4a')]};return db[_0x2c9f('0x38')][_0x2c9f('0x2a')](_0x31c2cf)[_0x2c9f('0x31')](function(_0x1be7f7){_0x5bfd1d['count']=_0x1be7f7;if(_0x5281f8[_0x2c9f('0x3f')][_0x2c9f('0x4c')]){_0x5976ec[_0x2c9f('0x4d')]=[{'all':!![]}];}return db[_0x2c9f('0x38')][_0x2c9f('0x4e')](_0x5976ec);})[_0x2c9f('0x31')](function(_0x150775){_0x5bfd1d[_0x2c9f('0x4f')]=_0x150775;return _0x5bfd1d;})[_0x2c9f('0x31')](respondWithFilteredResult(_0x3b835f,_0x5976ec))[_0x2c9f('0x24')](handleError(_0x3b835f,null));};exports[_0x2c9f('0x50')]=function(_0x1308c3,_0x579d6d){var _0x4a7365={'raw':![],'where':{'id':_0x1308c3[_0x2c9f('0x51')]['id']}},_0x57df4d={};_0x57df4d[_0x2c9f('0x3c')]=_[_0x2c9f('0x40')](db[_0x2c9f('0x38')][_0x2c9f('0x52')]);_0x57df4d[_0x2c9f('0x3f')]=_['keys'](_0x1308c3[_0x2c9f('0x3f')]);_0x57df4d['filters']=_[_0x2c9f('0x42')](_0x57df4d['model'],_0x57df4d[_0x2c9f('0x3f')]);_0x4a7365[_0x2c9f('0x44')]=_[_0x2c9f('0x42')](_0x57df4d[_0x2c9f('0x3c')],qs[_0x2c9f('0x43')](_0x1308c3[_0x2c9f('0x3f')][_0x2c9f('0x43')]));_0x4a7365[_0x2c9f('0x44')]=_0x4a7365[_0x2c9f('0x44')][_0x2c9f('0x45')]?_0x4a7365[_0x2c9f('0x44')]:_0x57df4d[_0x2c9f('0x3c')];if(_0x1308c3[_0x2c9f('0x3f')]['includeAll']){_0x4a7365[_0x2c9f('0x4d')]=[{'all':!![]}];}_0x4a7365=_[_0x2c9f('0x53')]({},_0x4a7365,_0x1308c3[_0x2c9f('0x4b')]);return db[_0x2c9f('0x38')][_0x2c9f('0x54')](_0x4a7365)[_0x2c9f('0x31')](handleEntityNotFound(_0x579d6d,null))[_0x2c9f('0x31')](respondWithResult(_0x579d6d,null))[_0x2c9f('0x24')](handleError(_0x579d6d,null));};exports[_0x2c9f('0x55')]=function(_0x284cce,_0x50cfce,_0x21e414){var _0x1e6b23;return db[_0x2c9f('0x38')][_0x2c9f('0x55')](_0x284cce['body'],{'raw':!![]})[_0x2c9f('0x31')](function(_0x4c9755){_0x1e6b23=_0x4c9755;return db['VoiceContext'][_0x2c9f('0x4e')]({'raw':!![]});})[_0x2c9f('0x31')](function(_0x554f16){var _0x291593=fs[_0x2c9f('0x56')](path[_0x2c9f('0x57')](config[_0x2c9f('0x58')],_0x2c9f('0x59')),'utf8');var _0x59f55b=ejs[_0x2c9f('0x5a')](_0x291593,{'contexts':_0x554f16||[]});fs['writeFileSync'](_0x2c9f('0x5b'),_0x59f55b);})[_0x2c9f('0x31')](function(){return respondWithRpcPromise(_0x2c9f('0x5c'),_0x2c9f('0x55'),{'module':'chan_sip.so'});})[_0x2c9f('0x31')](function(){var _0x463e5e=_0x284cce[_0x2c9f('0x5d')]['get']({'plain':!![]});if(!_0x463e5e)throw new Error(_0x2c9f('0x5e'));if(_0x463e5e[_0x2c9f('0x5f')]===_0x2c9f('0x5d')){var _0x142e7c=_0x1e6b23[_0x2c9f('0x32')]({'plain':!![]});return db[_0x2c9f('0x60')]['find']({'where':{'name':'Contexts','userProfileId':_0x463e5e[_0x2c9f('0x61')]},'raw':!![]})[_0x2c9f('0x31')](function(_0x13ad6f){if(_0x13ad6f&&_0x13ad6f[_0x2c9f('0x62')]===0x0){return db[_0x2c9f('0x33')][_0x2c9f('0x55')]({'name':_0x142e7c[_0x2c9f('0x3e')],'resourceId':_0x142e7c['id'],'type':_0x13ad6f[_0x2c9f('0x3e')],'sectionId':_0x13ad6f['id']},{})[_0x2c9f('0x31')](function(){return _0x1e6b23;});}else{return _0x1e6b23;}})[_0x2c9f('0x24')](function(_0x8f8c8e){logger[_0x2c9f('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8f8c8e);throw _0x8f8c8e;});}return _0x1e6b23;})[_0x2c9f('0x31')](respondWithResult(_0x50cfce,0xc9))[_0x2c9f('0x24')](handleError(_0x50cfce,null));};exports[_0x2c9f('0x30')]=function(_0x3bc0dc,_0x12b66d,_0x4aeb4d){var _0x12f476;return db[_0x2c9f('0x38')][_0x2c9f('0x54')]({'where':{'id':_0x3bc0dc[_0x2c9f('0x51')]['id']}})[_0x2c9f('0x31')](handleEntityNotFound(_0x12b66d,null))['then'](saveUpdates(_0x3bc0dc[_0x2c9f('0x63')],null))[_0x2c9f('0x31')](function(_0x433925){if(_0x433925){_0x12f476=_0x433925;return db['VoiceContext'][_0x2c9f('0x4e')]({'raw':!![]});}})[_0x2c9f('0x31')](function(_0x4dbe51){var _0x80894f=fs[_0x2c9f('0x56')](path[_0x2c9f('0x57')](config['root'],_0x2c9f('0x59')),_0x2c9f('0x64'));var _0x37a2d4=ejs['render'](_0x80894f,{'contexts':_0x4dbe51||[]});fs['writeFileSync'](_0x2c9f('0x5b'),_0x37a2d4);})['then'](function(){return respondWithRpcPromise(_0x2c9f('0x5c'),'update',{'module':_0x2c9f('0x65')});})['then'](function(){return _0x12f476;})[_0x2c9f('0x31')](respondWithResult(_0x12b66d,null))[_0x2c9f('0x24')](handleError(_0x12b66d,null));};exports[_0x2c9f('0x34')]=function(_0xfc97dc,_0x183387,_0x196253){var _0x34c7a8;return db['VoiceContext'][_0x2c9f('0x54')]({'where':{'id':_0xfc97dc['params']['id']}})[_0x2c9f('0x31')](handleEntityNotFound(_0x183387,null))[_0x2c9f('0x31')](removeEntity(_0x183387,null))[_0x2c9f('0x31')](function(){return db[_0x2c9f('0x38')][_0x2c9f('0x4e')]({'raw':!![]});})[_0x2c9f('0x31')](function(_0x1fb953){var _0x168208=fs[_0x2c9f('0x56')](path[_0x2c9f('0x57')](config[_0x2c9f('0x58')],_0x2c9f('0x59')),_0x2c9f('0x64'));var _0x213295=ejs[_0x2c9f('0x5a')](_0x168208,{'contexts':_0x1fb953});fs[_0x2c9f('0x66')](_0x2c9f('0x5b'),_0x213295);return respondWithRpcPromise('Reload',_0x2c9f('0x34'),{'module':_0x2c9f('0x65')});})[_0x2c9f('0x24')](handleError(_0x183387,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 8dc7d09..f2fc585 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 _0x7a03=['bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','exports','voice_contexts','lodash','util','../../config/logger','api','moment'];(function(_0x5ef25a,_0x5392c3){var _0x4dca64=function(_0x244a3e){while(--_0x244a3e){_0x5ef25a['push'](_0x5ef25a['shift']());}};_0x4dca64(++_0x5392c3);}(_0x7a03,0x1b7));var _0x37a0=function(_0x125deb,_0x3b464f){_0x125deb=_0x125deb-0x0;var _0x31c258=_0x7a03[_0x125deb];return _0x31c258;};'use strict';var _=require(_0x37a0('0x0'));var util=require(_0x37a0('0x1'));var logger=require(_0x37a0('0x2'))(_0x37a0('0x3'));var moment=require(_0x37a0('0x4'));var BPromise=require(_0x37a0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37a0('0x6'));var rimraf=require(_0x37a0('0x7'));var config=require(_0x37a0('0x8'));var attributes=require(_0x37a0('0x9'));module[_0x37a0('0xa')]=function(_0x495adc,_0x3cf2af){return _0x495adc['define']('VoiceContext',attributes,{'tableName':_0x37a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5943=['request-promise','path','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1eb069,_0x3c32d6){var _0x9395e2=function(_0x2eb951){while(--_0x2eb951){_0x1eb069['push'](_0x1eb069['shift']());}};_0x9395e2(++_0x3c32d6);}(_0x5943,0x1f2));var _0x3594=function(_0x3cfb9c,_0x336377){_0x3cfb9c=_0x3cfb9c-0x0;var _0x53d633=_0x5943[_0x3cfb9c];return _0x53d633;};'use strict';var _=require(_0x3594('0x0'));var util=require(_0x3594('0x1'));var logger=require(_0x3594('0x2'))(_0x3594('0x3'));var moment=require(_0x3594('0x4'));var BPromise=require(_0x3594('0x5'));var rp=require(_0x3594('0x6'));var fs=require('fs');var path=require(_0x3594('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3594('0x8'));module['exports']=function(_0x41b527,_0x168e14){return _0x41b527[_0x3594('0x9')](_0x3594('0xa'),attributes,{'tableName':_0x3594('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index af3d796..2feac6c 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 _0xf3e2=['rpc','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xf3e2,0x168));var _0x2f3e=function(_0x41a457,_0x4a8e30){_0x41a457=_0x41a457-0x0;var _0x84b15f=_0xf3e2[_0x41a457];return _0x84b15f;};'use strict';var _=require(_0x2f3e('0x0'));var util=require(_0x2f3e('0x1'));var moment=require(_0x2f3e('0x2'));var BPromise=require(_0x2f3e('0x3'));var rs=require(_0x2f3e('0x4'));var fs=require('fs');var Redis=require(_0x2f3e('0x5'));var db=require(_0x2f3e('0x6'))['db'];var utils=require(_0x2f3e('0x7'));var logger=require('../../config/logger')(_0x2f3e('0x8'));var config=require('../../config/environment');var jayson=require(_0x2f3e('0x9'));var client=jayson[_0x2f3e('0xa')][_0x2f3e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x392f91,_0x3b556b,_0x1ac142){return new BPromise(function(_0x30f939,_0x46ec1b){return client['request'](_0x392f91,_0x1ac142)[_0x2f3e('0xc')](function(_0x4d7f7d){logger[_0x2f3e('0xd')](_0x2f3e('0xe'),_0x3b556b,_0x2f3e('0xf'));logger[_0x2f3e('0x10')](_0x2f3e('0x11'),_0x3b556b,_0x2f3e('0xf'),JSON[_0x2f3e('0x12')](_0x4d7f7d));if(_0x4d7f7d[_0x2f3e('0x13')]){if(_0x4d7f7d[_0x2f3e('0x13')][_0x2f3e('0x14')]===0x1f4){logger[_0x2f3e('0x13')](_0x2f3e('0xe'),_0x3b556b,_0x4d7f7d['error'][_0x2f3e('0x15')]);return _0x46ec1b(_0x4d7f7d['error'][_0x2f3e('0x15')]);}logger[_0x2f3e('0x13')]('VoiceContext,\x20%s,\x20%s',_0x3b556b,_0x4d7f7d['error'][_0x2f3e('0x15')]);return _0x30f939(_0x4d7f7d[_0x2f3e('0x13')][_0x2f3e('0x15')]);}else{logger[_0x2f3e('0xd')](_0x2f3e('0xe'),_0x3b556b,_0x2f3e('0xf'));_0x30f939(_0x4d7f7d['result'][_0x2f3e('0x15')]);}})[_0x2f3e('0x16')](function(_0x15398d){logger[_0x2f3e('0x13')]('VoiceContext,\x20%s,\x20%s',_0x3b556b,_0x15398d);_0x46ec1b(_0x15398d);});});} \ No newline at end of file +var _0x4561=['jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x19aa84,_0x549537){var _0x536146=function(_0x5da480){while(--_0x5da480){_0x19aa84['push'](_0x19aa84['shift']());}};_0x536146(++_0x549537);}(_0x4561,0x1a3));var _0x1456=function(_0x3d4d33,_0x2313da){_0x3d4d33=_0x3d4d33-0x0;var _0x440d8e=_0x4561[_0x3d4d33];return _0x440d8e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1456('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1456('0x1'));var db=require(_0x1456('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1456('0x3'))(_0x1456('0x4'));var config=require(_0x1456('0x5'));var jayson=require(_0x1456('0x6'));var client=jayson[_0x1456('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x477688,_0x446bf9,_0xf359cd){return new BPromise(function(_0x42e9c6,_0x580f28){return client['request'](_0x477688,_0xf359cd)[_0x1456('0x8')](function(_0x4b5241){logger[_0x1456('0x9')](_0x1456('0xa'),_0x446bf9,_0x1456('0xb'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x446bf9,_0x1456('0xb'),JSON[_0x1456('0xc')](_0x4b5241));if(_0x4b5241[_0x1456('0xd')]){if(_0x4b5241[_0x1456('0xd')][_0x1456('0xe')]===0x1f4){logger['error'](_0x1456('0xa'),_0x446bf9,_0x4b5241[_0x1456('0xd')][_0x1456('0xf')]);return _0x580f28(_0x4b5241[_0x1456('0xd')][_0x1456('0xf')]);}logger['error'](_0x1456('0xa'),_0x446bf9,_0x4b5241['error'][_0x1456('0xf')]);return _0x42e9c6(_0x4b5241['error'][_0x1456('0xf')]);}else{logger[_0x1456('0x9')]('VoiceContext,\x20%s,\x20%s',_0x446bf9,_0x1456('0xb'));_0x42e9c6(_0x4b5241[_0x1456('0x10')][_0x1456('0xf')]);}})['catch'](function(_0x1a2c3c){logger[_0x1456('0xd')](_0x1456('0xa'),_0x446bf9,_0x1a2c3c);_0x580f28(_0x1a2c3c);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 969b56c..1bf2ca4 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 _0xbc50=['./voiceDialReport.controller','get','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x314d67,_0x594480){var _0x128c39=function(_0x2febdb){while(--_0x2febdb){_0x314d67['push'](_0x314d67['shift']());}};_0x128c39(++_0x594480);}(_0xbc50,0x7c));var _0x0bc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc50[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x0bc5('0x0'));var path=require(_0x0bc5('0x1'));var timeout=require(_0x0bc5('0x2'));var express=require(_0x0bc5('0x3'));var router=express[_0x0bc5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0bc5('0x5'));var interaction=require(_0x0bc5('0x6'));var config=require(_0x0bc5('0x7'));var controller=require(_0x0bc5('0x8'));router[_0x0bc5('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0bc5('0x9')](_0x0bc5('0xa'),auth['isAuthenticated'](),controller[_0x0bc5('0xb')]);router['get'](_0x0bc5('0xc'),auth[_0x0bc5('0xd')](),controller[_0x0bc5('0xe')]);router[_0x0bc5('0xf')]('/',auth['isAuthenticated'](),controller[_0x0bc5('0x10')]);router[_0x0bc5('0x11')](_0x0bc5('0xc'),auth[_0x0bc5('0xd')](),controller[_0x0bc5('0x12')]);router[_0x0bc5('0x13')]('/:id',auth[_0x0bc5('0xd')](),controller[_0x0bc5('0x14')]);module[_0x0bc5('0x15')]=router; \ No newline at end of file +var _0x8796=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x4ba8a4,_0x241bdf){var _0x28e9c7=function(_0x546193){while(--_0x546193){_0x4ba8a4['push'](_0x4ba8a4['shift']());}};_0x28e9c7(++_0x241bdf);}(_0x8796,0xcd));var _0x6879=function(_0x575446,_0x1a13fa){_0x575446=_0x575446-0x0;var _0x2fb644=_0x8796[_0x575446];return _0x2fb644;};'use strict';var multer=require(_0x6879('0x0'));var util=require(_0x6879('0x1'));var path=require(_0x6879('0x2'));var timeout=require(_0x6879('0x3'));var express=require('express');var router=express[_0x6879('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6879('0x5'));var config=require(_0x6879('0x6'));var controller=require(_0x6879('0x7'));router[_0x6879('0x8')]('/',auth['isAuthenticated'](),controller[_0x6879('0x9')]);router[_0x6879('0x8')](_0x6879('0xa'),auth[_0x6879('0xb')](),controller[_0x6879('0xc')]);router[_0x6879('0x8')](_0x6879('0xd'),auth[_0x6879('0xb')](),controller[_0x6879('0xe')]);router[_0x6879('0xf')]('/',auth[_0x6879('0xb')](),controller[_0x6879('0x10')]);router[_0x6879('0x11')]('/:id',auth[_0x6879('0xb')](),controller[_0x6879('0x12')]);router[_0x6879('0x13')](_0x6879('0xd'),auth['isAuthenticated'](),controller[_0x6879('0x14')]);module[_0x6879('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 7cfd5d1..f47b518 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 _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x3be063,_0x5402e9){var _0x19964e=function(_0x2d28d8){while(--_0x2d28d8){_0x3be063['push'](_0x3be063['shift']());}};_0x19964e(++_0x5402e9);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0x00bb=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x258f92,_0x2f34ee){var _0x3a4316=function(_0x52b2b0){while(--_0x52b2b0){_0x258f92['push'](_0x258f92['shift']());}};_0x3a4316(++_0x2f34ee);}(_0x00bb,0x1d8));var _0xb00b=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x00bb[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'privilege':{'type':Sequelize[_0xb00b('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb00b('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb00b('0x2')]},'calleridname':{'type':Sequelize[_0xb00b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'language':{'type':Sequelize[_0xb00b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb00b('0x3')]},'uniqueid':{'type':Sequelize[_0xb00b('0x2')]},'linkedid':{'type':Sequelize[_0xb00b('0x2')]},'destchannel':{'type':Sequelize[_0xb00b('0x2')]},'destchannelstate':{'type':Sequelize[_0xb00b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb00b('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb00b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'destlanguage':{'type':Sequelize[_0xb00b('0x2')]},'destaccountcode':{'type':Sequelize[_0xb00b('0x2')]},'destcontext':{'type':Sequelize[_0xb00b('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb00b('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xb00b('0x2')]},'starttime':{'type':Sequelize[_0xb00b('0x4')]},'answertime':{'type':Sequelize[_0xb00b('0x4')]},'endtime':{'type':Sequelize[_0xb00b('0x4')]},'lastevent':{'type':Sequelize[_0xb00b('0x2')],'comment':_0xb00b('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xb00b('0x3')]},'holdtime':{'type':Sequelize[_0xb00b('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 60850af..a778334 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 _0x1097=['find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','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','end','status','offset','undefined','limit','count','set','json','apply','save','update','then','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','options','VoiceDialReport','includeAll','include','findAll','catch','show','params'];(function(_0x437e41,_0x3a16d6){var _0x7b2e7f=function(_0x1cda3b){while(--_0x1cda3b){_0x437e41['push'](_0x437e41['shift']());}};_0x7b2e7f(++_0x3a16d6);}(_0x1097,0x125));var _0x7109=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x1097[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7109('0x0'));var jsonpatch=require(_0x7109('0x1'));var rp=require(_0x7109('0x2'));var moment=require(_0x7109('0x3'));var BPromise=require(_0x7109('0x4'));var Mustache=require(_0x7109('0x5'));var util=require(_0x7109('0x6'));var path=require(_0x7109('0x7'));var sox=require(_0x7109('0x8'));var csv=require('to-csv');var ejs=require(_0x7109('0x9'));var fs=require('fs');var fs_extra=require(_0x7109('0xa'));var _=require(_0x7109('0xb'));var squel=require(_0x7109('0xc'));var crypto=require(_0x7109('0xd'));var jsforce=require(_0x7109('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7109('0xf'));var authService=require(_0x7109('0x10'));var qs=require(_0x7109('0x11'));var as=require(_0x7109('0x12'));var hardwareService=require(_0x7109('0x13'));var logger=require('../../config/logger')(_0x7109('0x14'));var utils=require(_0x7109('0x15'));var config=require(_0x7109('0x16'));var licenseUtil=require(_0x7109('0x17'));var db=require(_0x7109('0x18'))['db'];function respondWithStatusCode(_0x59baff,_0x2bbadb){_0x2bbadb=_0x2bbadb||0xcc;return function(_0x1dd4cd){if(_0x1dd4cd){return _0x59baff[_0x7109('0x19')](_0x2bbadb);}return _0x59baff['status'](_0x2bbadb)[_0x7109('0x1a')]();};}function respondWithResult(_0x1bd94d,_0x88fc79){_0x88fc79=_0x88fc79||0xc8;return function(_0x260286){if(_0x260286){return _0x1bd94d[_0x7109('0x1b')](_0x88fc79)['json'](_0x260286);}};}function respondWithFilteredResult(_0x36c03f,_0xebc8ae){return function(_0xe2a777){if(_0xe2a777){var _0x41c3a7=typeof _0xebc8ae[_0x7109('0x1c')]===_0x7109('0x1d')&&typeof _0xebc8ae[_0x7109('0x1e')]===_0x7109('0x1d');var _0x4f602c=_0xe2a777[_0x7109('0x1f')];var _0x10bb87=_0x41c3a7?0x0:_0xebc8ae[_0x7109('0x1c')];var _0x3b399f=_0x41c3a7?_0xe2a777['count']:_0xebc8ae[_0x7109('0x1c')]+_0xebc8ae[_0x7109('0x1e')];var _0x5671e8;if(_0x3b399f>=_0x4f602c){_0x3b399f=_0x4f602c;_0x5671e8=0xc8;}else{_0x5671e8=0xce;}_0x36c03f['status'](_0x5671e8);return _0x36c03f[_0x7109('0x20')]('Content-Range',_0x10bb87+'-'+_0x3b399f+'/'+_0x4f602c)[_0x7109('0x21')](_0xe2a777);}return null;};}function patchUpdates(_0x13819d){return function(_0x236898){try{jsonpatch[_0x7109('0x22')](_0x236898,_0x13819d,!![]);}catch(_0x4a047d){return BPromise['reject'](_0x4a047d);}return _0x236898[_0x7109('0x23')]();};}function saveUpdates(_0xfe75e2,_0x4f1129){return function(_0x615cef){if(_0x615cef){return _0x615cef[_0x7109('0x24')](_0xfe75e2)[_0x7109('0x25')](function(_0x1ba314){return _0x1ba314;});}return null;};}function removeEntity(_0xfadec6,_0x1ae788){return function(_0x50746a){if(_0x50746a){return _0x50746a['destroy']()[_0x7109('0x25')](function(){_0xfadec6['status'](0xcc)[_0x7109('0x1a')]();});}};}function handleEntityNotFound(_0x548001,_0x226a38){return function(_0x972c35){if(!_0x972c35){_0x548001['sendStatus'](0x194);}return _0x972c35;};}function handleError(_0x2f8c1b,_0x5631a6){_0x5631a6=_0x5631a6||0x1f4;return function(_0x1737f0){logger['error'](_0x1737f0[_0x7109('0x26')]);if(_0x1737f0['name']){delete _0x1737f0[_0x7109('0x27')];}_0x2f8c1b[_0x7109('0x1b')](_0x5631a6)[_0x7109('0x28')](_0x1737f0);};}exports['index']=function(_0x51ca92,_0x505ecd){var _0x1b89f4={},_0x4e0a12={},_0x44b844={'count':0x0,'rows':[]};var _0x384e9d=_[_0x7109('0x29')](db['VoiceDialReport'][_0x7109('0x2a')],function(_0x5565bc){return{'name':_0x5565bc[_0x7109('0x2b')],'type':_0x5565bc[_0x7109('0x2c')]['key']};});_0x4e0a12[_0x7109('0x2d')]=_['map'](_0x384e9d,'name');_0x4e0a12[_0x7109('0x2e')]=_[_0x7109('0x2f')](_0x51ca92['query']);_0x4e0a12['filters']=_[_0x7109('0x30')](_0x4e0a12[_0x7109('0x2d')],_0x4e0a12[_0x7109('0x2e')]);_0x1b89f4[_0x7109('0x31')]=_['intersection'](_0x4e0a12[_0x7109('0x2d')],qs[_0x7109('0x32')](_0x51ca92['query'][_0x7109('0x32')]));_0x1b89f4[_0x7109('0x31')]=_0x1b89f4['attributes'][_0x7109('0x33')]?_0x1b89f4[_0x7109('0x31')]:_0x4e0a12['model'];if(!_0x51ca92[_0x7109('0x2e')]['hasOwnProperty']('nolimit')){_0x1b89f4[_0x7109('0x1e')]=qs['limit'](_0x51ca92[_0x7109('0x2e')][_0x7109('0x1e')]);_0x1b89f4[_0x7109('0x1c')]=qs[_0x7109('0x1c')](_0x51ca92[_0x7109('0x2e')][_0x7109('0x1c')]);}_0x1b89f4[_0x7109('0x34')]=qs['sort'](_0x51ca92['query'][_0x7109('0x35')]);_0x1b89f4[_0x7109('0x36')]=qs[_0x7109('0x37')](_[_0x7109('0x38')](_0x51ca92[_0x7109('0x2e')],_0x4e0a12['filters']),_0x384e9d);if(_0x51ca92[_0x7109('0x2e')]['filter']){_0x1b89f4[_0x7109('0x36')]=_[_0x7109('0x39')](_0x1b89f4['where'],{'$or':_[_0x7109('0x29')](_0x384e9d,function(_0x55ea86){if(_0x55ea86[_0x7109('0x2c')]!==_0x7109('0x3a')){var _0x17645e={};_0x17645e[_0x55ea86[_0x7109('0x27')]]={'$like':'%'+_0x51ca92[_0x7109('0x2e')]['filter']+'%'};return _0x17645e;}})});}_0x1b89f4=_[_0x7109('0x39')]({},_0x1b89f4,_0x51ca92[_0x7109('0x3b')]);var _0x1fef06={'where':_0x1b89f4[_0x7109('0x36')]};return db[_0x7109('0x3c')][_0x7109('0x1f')](_0x1fef06)[_0x7109('0x25')](function(_0x1542fc){_0x44b844['count']=_0x1542fc;if(_0x51ca92['query'][_0x7109('0x3d')]){_0x1b89f4[_0x7109('0x3e')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x7109('0x3f')](_0x1b89f4);})[_0x7109('0x25')](function(_0x486c1f){_0x44b844['rows']=_0x486c1f;return _0x44b844;})[_0x7109('0x25')](respondWithFilteredResult(_0x505ecd,_0x1b89f4))[_0x7109('0x40')](handleError(_0x505ecd,null));};exports[_0x7109('0x41')]=function(_0x4227db,_0x2f6862){var _0x10ba46={'raw':!![],'where':{'id':_0x4227db[_0x7109('0x42')]['id']}},_0x1b2c98={};_0x1b2c98[_0x7109('0x2d')]=_[_0x7109('0x2f')](db[_0x7109('0x3c')]['rawAttributes']);_0x1b2c98[_0x7109('0x2e')]=_['keys'](_0x4227db['query']);_0x1b2c98[_0x7109('0x37')]=_['intersection'](_0x1b2c98[_0x7109('0x2d')],_0x1b2c98['query']);_0x10ba46['attributes']=_[_0x7109('0x30')](_0x1b2c98[_0x7109('0x2d')],qs['fields'](_0x4227db['query'][_0x7109('0x32')]));_0x10ba46[_0x7109('0x31')]=_0x10ba46['attributes'][_0x7109('0x33')]?_0x10ba46[_0x7109('0x31')]:_0x1b2c98[_0x7109('0x2d')];if(_0x4227db['query'][_0x7109('0x3d')]){_0x10ba46['include']=[{'all':!![]}];}_0x10ba46=_[_0x7109('0x39')]({},_0x10ba46,_0x4227db[_0x7109('0x3b')]);return db[_0x7109('0x3c')][_0x7109('0x43')](_0x10ba46)['then'](handleEntityNotFound(_0x2f6862,null))['then'](respondWithResult(_0x2f6862,null))['catch'](handleError(_0x2f6862,null));};exports[_0x7109('0x44')]=function(_0xf86d9f,_0x51bf9b){return db[_0x7109('0x3c')][_0x7109('0x44')](_0xf86d9f[_0x7109('0x45')],{})['then'](respondWithResult(_0x51bf9b,0xc9))[_0x7109('0x40')](handleError(_0x51bf9b,null));};exports['update']=function(_0x4f33f3,_0x152670){if(_0x4f33f3['body']['id']){delete _0x4f33f3[_0x7109('0x45')]['id'];}return db[_0x7109('0x3c')][_0x7109('0x43')]({'where':{'id':_0x4f33f3[_0x7109('0x42')]['id']}})[_0x7109('0x25')](handleEntityNotFound(_0x152670,null))['then'](saveUpdates(_0x4f33f3[_0x7109('0x45')],null))[_0x7109('0x25')](respondWithResult(_0x152670,null))['catch'](handleError(_0x152670,null));};exports[_0x7109('0x46')]=function(_0x148e3a,_0x45f96b){return db[_0x7109('0x3c')][_0x7109('0x43')]({'where':{'id':_0x148e3a[_0x7109('0x42')]['id']}})[_0x7109('0x25')](handleEntityNotFound(_0x45f96b,null))[_0x7109('0x25')](removeEntity(_0x45f96b,null))[_0x7109('0x40')](handleError(_0x45f96b,null));};exports[_0x7109('0x47')]=function(_0x391125,_0x3a006c){return db[_0x7109('0x3c')][_0x7109('0x47')]()[_0x7109('0x25')](respondWithResult(_0x3a006c,null))[_0x7109('0x40')](handleError(_0x3a006c,null));}; \ No newline at end of file +var _0xc25d=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','save','update','then','destroy','end','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','keys','fields','length','include','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','fs-extra','lodash','squel','crypto','to-csv','querystring'];(function(_0x589cdf,_0x53f463){var _0x5f0774=function(_0x530589){while(--_0x530589){_0x589cdf['push'](_0x589cdf['shift']());}};_0x5f0774(++_0x53f463);}(_0xc25d,0x83));var _0xdc25=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0xc25d[_0x45346d];return _0x5ce7ca;};'use strict';var emlformat=require(_0xdc25('0x0'));var rimraf=require(_0xdc25('0x1'));var zipdir=require(_0xdc25('0x2'));var jsonpatch=require(_0xdc25('0x3'));var rp=require(_0xdc25('0x4'));var moment=require(_0xdc25('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc25('0x6'));var util=require('util');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(_0xdc25('0x7'));var _=require(_0xdc25('0x8'));var squel=require(_0xdc25('0x9'));var crypto=require(_0xdc25('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc25('0xb'));var querystring=require(_0xdc25('0xc'));var Papa=require(_0xdc25('0xd'));var Redis=require('ioredis');var authService=require(_0xdc25('0xe'));var qs=require(_0xdc25('0xf'));var as=require(_0xdc25('0x10'));var hardwareService=require(_0xdc25('0x11'));var logger=require(_0xdc25('0x12'))('api');var utils=require(_0xdc25('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xdc25('0x14'));var db=require(_0xdc25('0x15'))['db'];function respondWithStatusCode(_0x4fe3b6,_0x5b2741){_0x5b2741=_0x5b2741||0xcc;return function(_0x2eedca){if(_0x2eedca){return _0x4fe3b6[_0xdc25('0x16')](_0x5b2741);}return _0x4fe3b6[_0xdc25('0x17')](_0x5b2741)['end']();};}function respondWithResult(_0x11d4b0,_0x15b289){_0x15b289=_0x15b289||0xc8;return function(_0xe4918a){if(_0xe4918a){return _0x11d4b0['status'](_0x15b289)['json'](_0xe4918a);}};}function respondWithFilteredResult(_0x1b58fd,_0x7fc077){return function(_0x4d891d){if(_0x4d891d){var _0x57676e=typeof _0x7fc077['offset']===_0xdc25('0x18')&&typeof _0x7fc077[_0xdc25('0x19')]==='undefined';var _0x26160c=_0x4d891d[_0xdc25('0x1a')];var _0x267919=_0x57676e?0x0:_0x7fc077[_0xdc25('0x1b')];var _0x354b5e=_0x57676e?_0x4d891d[_0xdc25('0x1a')]:_0x7fc077[_0xdc25('0x1b')]+_0x7fc077[_0xdc25('0x19')];var _0x1e44f0;if(_0x354b5e>=_0x26160c){_0x354b5e=_0x26160c;_0x1e44f0=0xc8;}else{_0x1e44f0=0xce;}_0x1b58fd[_0xdc25('0x17')](_0x1e44f0);return _0x1b58fd['set'](_0xdc25('0x1c'),_0x267919+'-'+_0x354b5e+'/'+_0x26160c)[_0xdc25('0x1d')](_0x4d891d);}return null;};}function patchUpdates(_0x356901){return function(_0x1d1ba2){try{jsonpatch['apply'](_0x1d1ba2,_0x356901,!![]);}catch(_0x165135){return BPromise['reject'](_0x165135);}return _0x1d1ba2[_0xdc25('0x1e')]();};}function saveUpdates(_0x4b4028,_0x46e6d4){return function(_0x3d840b){if(_0x3d840b){return _0x3d840b[_0xdc25('0x1f')](_0x4b4028)[_0xdc25('0x20')](function(_0x38d475){return _0x38d475;});}return null;};}function removeEntity(_0x426ec5,_0x3d327d){return function(_0xf9756c){if(_0xf9756c){return _0xf9756c[_0xdc25('0x21')]()[_0xdc25('0x20')](function(){_0x426ec5[_0xdc25('0x17')](0xcc)[_0xdc25('0x22')]();});}};}function handleEntityNotFound(_0x23f486,_0x54e29b){return function(_0x4f79ee){if(!_0x4f79ee){_0x23f486[_0xdc25('0x16')](0x194);}return _0x4f79ee;};}function handleError(_0x23e4a1,_0x2165de){_0x2165de=_0x2165de||0x1f4;return function(_0x3a82c6){logger['error'](_0x3a82c6[_0xdc25('0x23')]);if(_0x3a82c6['name']){delete _0x3a82c6[_0xdc25('0x24')];}_0x23e4a1[_0xdc25('0x17')](_0x2165de)[_0xdc25('0x25')](_0x3a82c6);};}exports[_0xdc25('0x26')]=function(_0x5e7e4b,_0x140543){var _0x12e7cb={},_0x3ae238={},_0x5413ed={'count':0x0,'rows':[]};var _0x30388c=_['map'](db[_0xdc25('0x27')][_0xdc25('0x28')],function(_0x107427){return{'name':_0x107427[_0xdc25('0x29')],'type':_0x107427[_0xdc25('0x2a')][_0xdc25('0x2b')]};});_0x3ae238[_0xdc25('0x2c')]=_[_0xdc25('0x2d')](_0x30388c,_0xdc25('0x24'));_0x3ae238[_0xdc25('0x2e')]=_['keys'](_0x5e7e4b[_0xdc25('0x2e')]);_0x3ae238[_0xdc25('0x2f')]=_['intersection'](_0x3ae238['model'],_0x3ae238[_0xdc25('0x2e')]);_0x12e7cb[_0xdc25('0x30')]=_[_0xdc25('0x31')](_0x3ae238['model'],qs['fields'](_0x5e7e4b[_0xdc25('0x2e')]['fields']));_0x12e7cb['attributes']=_0x12e7cb[_0xdc25('0x30')]['length']?_0x12e7cb[_0xdc25('0x30')]:_0x3ae238[_0xdc25('0x2c')];if(!_0x5e7e4b[_0xdc25('0x2e')][_0xdc25('0x32')](_0xdc25('0x33'))){_0x12e7cb[_0xdc25('0x19')]=qs['limit'](_0x5e7e4b[_0xdc25('0x2e')][_0xdc25('0x19')]);_0x12e7cb[_0xdc25('0x1b')]=qs['offset'](_0x5e7e4b[_0xdc25('0x2e')]['offset']);}_0x12e7cb['order']=qs[_0xdc25('0x34')](_0x5e7e4b[_0xdc25('0x2e')]['sort']);_0x12e7cb['where']=qs[_0xdc25('0x2f')](_[_0xdc25('0x35')](_0x5e7e4b[_0xdc25('0x2e')],_0x3ae238['filters']),_0x30388c);if(_0x5e7e4b['query']['filter']){_0x12e7cb[_0xdc25('0x36')]=_[_0xdc25('0x37')](_0x12e7cb['where'],{'$or':_[_0xdc25('0x2d')](_0x30388c,function(_0x1ee2f2){if(_0x1ee2f2['type']!==_0xdc25('0x38')){var _0x199779={};_0x199779[_0x1ee2f2[_0xdc25('0x24')]]={'$like':'%'+_0x5e7e4b[_0xdc25('0x2e')]['filter']+'%'};return _0x199779;}})});}_0x12e7cb=_[_0xdc25('0x37')]({},_0x12e7cb,_0x5e7e4b[_0xdc25('0x39')]);var _0x5957d9={'where':_0x12e7cb[_0xdc25('0x36')]};return db[_0xdc25('0x27')][_0xdc25('0x1a')](_0x5957d9)['then'](function(_0x5ca960){_0x5413ed[_0xdc25('0x1a')]=_0x5ca960;if(_0x5e7e4b['query'][_0xdc25('0x3a')]){_0x12e7cb['include']=[{'all':!![]}];}return db[_0xdc25('0x27')][_0xdc25('0x3b')](_0x12e7cb);})[_0xdc25('0x20')](function(_0x8baa27){_0x5413ed[_0xdc25('0x3c')]=_0x8baa27;return _0x5413ed;})[_0xdc25('0x20')](respondWithFilteredResult(_0x140543,_0x12e7cb))['catch'](handleError(_0x140543,null));};exports[_0xdc25('0x3d')]=function(_0x3d8b98,_0x312a96){var _0x2ad48e={'raw':!![],'where':{'id':_0x3d8b98['params']['id']}},_0x4f88e4={};_0x4f88e4[_0xdc25('0x2c')]=_[_0xdc25('0x3e')](db[_0xdc25('0x27')][_0xdc25('0x28')]);_0x4f88e4[_0xdc25('0x2e')]=_[_0xdc25('0x3e')](_0x3d8b98['query']);_0x4f88e4[_0xdc25('0x2f')]=_[_0xdc25('0x31')](_0x4f88e4['model'],_0x4f88e4[_0xdc25('0x2e')]);_0x2ad48e[_0xdc25('0x30')]=_[_0xdc25('0x31')](_0x4f88e4[_0xdc25('0x2c')],qs['fields'](_0x3d8b98['query'][_0xdc25('0x3f')]));_0x2ad48e[_0xdc25('0x30')]=_0x2ad48e[_0xdc25('0x30')][_0xdc25('0x40')]?_0x2ad48e[_0xdc25('0x30')]:_0x4f88e4[_0xdc25('0x2c')];if(_0x3d8b98[_0xdc25('0x2e')]['includeAll']){_0x2ad48e[_0xdc25('0x41')]=[{'all':!![]}];}_0x2ad48e=_[_0xdc25('0x37')]({},_0x2ad48e,_0x3d8b98[_0xdc25('0x39')]);return db[_0xdc25('0x27')][_0xdc25('0x42')](_0x2ad48e)[_0xdc25('0x20')](handleEntityNotFound(_0x312a96,null))[_0xdc25('0x20')](respondWithResult(_0x312a96,null))[_0xdc25('0x43')](handleError(_0x312a96,null));};exports[_0xdc25('0x44')]=function(_0x35af87,_0x128456){return db[_0xdc25('0x27')][_0xdc25('0x44')](_0x35af87[_0xdc25('0x45')],{})['then'](respondWithResult(_0x128456,0xc9))[_0xdc25('0x43')](handleError(_0x128456,null));};exports['update']=function(_0x5ed9dc,_0xf7d664){if(_0x5ed9dc[_0xdc25('0x45')]['id']){delete _0x5ed9dc[_0xdc25('0x45')]['id'];}return db['VoiceDialReport'][_0xdc25('0x42')]({'where':{'id':_0x5ed9dc[_0xdc25('0x46')]['id']}})[_0xdc25('0x20')](handleEntityNotFound(_0xf7d664,null))[_0xdc25('0x20')](saveUpdates(_0x5ed9dc[_0xdc25('0x45')],null))[_0xdc25('0x20')](respondWithResult(_0xf7d664,null))['catch'](handleError(_0xf7d664,null));};exports[_0xdc25('0x21')]=function(_0x1cec17,_0x1ef0f7){return db[_0xdc25('0x27')][_0xdc25('0x42')]({'where':{'id':_0x1cec17[_0xdc25('0x46')]['id']}})[_0xdc25('0x20')](handleEntityNotFound(_0x1ef0f7,null))[_0xdc25('0x20')](removeEntity(_0x1ef0f7,null))[_0xdc25('0x43')](handleError(_0x1ef0f7,null));};exports[_0xdc25('0x47')]=function(_0x298f75,_0x1e1577){return db[_0xdc25('0x27')]['describe']()[_0xdc25('0x20')](respondWithResult(_0x1e1577,null))[_0xdc25('0x43')](handleError(_0x1e1577,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index b84bdd4..9619de6 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 _0x2777=['exports','define','VoiceDialReport','report_dial','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x31afea,_0x39d92b){var _0x621ddd=function(_0x75d2fe){while(--_0x75d2fe){_0x31afea['push'](_0x31afea['shift']());}};_0x621ddd(++_0x39d92b);}(_0x2777,0x130));var _0x7277=function(_0x2b8fee,_0x569bce){_0x2b8fee=_0x2b8fee-0x0;var _0x1a56e7=_0x2777[_0x2b8fee];return _0x1a56e7;};'use strict';var _=require(_0x7277('0x0'));var util=require('util');var logger=require(_0x7277('0x1'))(_0x7277('0x2'));var moment=require(_0x7277('0x3'));var BPromise=require(_0x7277('0x4'));var rp=require(_0x7277('0x5'));var fs=require('fs');var path=require(_0x7277('0x6'));var rimraf=require(_0x7277('0x7'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0x7277('0x8')]=function(_0x5c2294,_0x1c6397){return _0x5c2294[_0x7277('0x9')](_0x7277('0xa'),attributes,{'tableName':_0x7277('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xeef0=['report_dial','uniqueid','lodash','util','../../config/logger','api','request-promise','rimraf','exports','define'];(function(_0x3899a3,_0xcb527){var _0x13e1ce=function(_0x19cdb4){while(--_0x19cdb4){_0x3899a3['push'](_0x3899a3['shift']());}};_0x13e1ce(++_0xcb527);}(_0xeef0,0x1c4));var _0x0eef=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xeef0[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x0eef('0x0'));var util=require(_0x0eef('0x1'));var logger=require(_0x0eef('0x2'))(_0x0eef('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0eef('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0eef('0x5'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0x0eef('0x6')]=function(_0x671256,_0x1c86e1){return _0x671256[_0x0eef('0x7')]('VoiceDialReport',attributes,{'tableName':_0x0eef('0x8'),'paranoid':![],'indexes':[{'fields':[_0x0eef('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 297d6f8..7e41479 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 _0x772d=['result','CreateVoiceDialReport','VoiceDialReport','create','body','raw','stringify','UpdateVoiceDialReport','update','options','where','attributes','limit','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceDialReport,\x20%s,\x20%s','message'];(function(_0x1ee751,_0x5de873){var _0xd6085a=function(_0x3bcab2){while(--_0x3bcab2){_0x1ee751['push'](_0x1ee751['shift']());}};_0xd6085a(++_0x5de873);}(_0x772d,0x92));var _0xd772=function(_0x5c9745,_0x4954f2){_0x5c9745=_0x5c9745-0x0;var _0x2b8496=_0x772d[_0x5c9745];return _0x2b8496;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd772('0x0'));var BPromise=require(_0xd772('0x1'));var rs=require(_0xd772('0x2'));var fs=require('fs');var Redis=require(_0xd772('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd772('0x4'));var logger=require(_0xd772('0x5'))(_0xd772('0x6'));var config=require(_0xd772('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd772('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x225893,_0x2ad782,_0x27c56c){return new BPromise(function(_0x3e801c,_0x29224f){return client[_0xd772('0x9')](_0x225893,_0x27c56c)[_0xd772('0xa')](function(_0x2d6600){logger[_0xd772('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x2ad782,'request\x20sent');logger[_0xd772('0xc')](_0xd772('0xd'),_0x2ad782,_0xd772('0xe'),JSON['stringify'](_0x2d6600));if(_0x2d6600[_0xd772('0xf')]){if(_0x2d6600[_0xd772('0xf')][_0xd772('0x10')]===0x1f4){logger[_0xd772('0xf')](_0xd772('0x11'),_0x2ad782,_0x2d6600['error'][_0xd772('0x12')]);return _0x29224f(_0x2d6600[_0xd772('0xf')][_0xd772('0x12')]);}logger[_0xd772('0xf')](_0xd772('0x11'),_0x2ad782,_0x2d6600[_0xd772('0xf')]['message']);return _0x3e801c(_0x2d6600['error'][_0xd772('0x12')]);}else{logger[_0xd772('0xb')](_0xd772('0x11'),_0x2ad782,_0xd772('0xe'));_0x3e801c(_0x2d6600[_0xd772('0x13')][_0xd772('0x12')]);}})['catch'](function(_0x255662){logger['error'](_0xd772('0x11'),_0x2ad782,_0x255662);_0x29224f(_0x255662);});});}exports[_0xd772('0x14')]=function(_0x31cf7c){var _0x1da61c=this;return new Promise(function(_0x1d9a08,_0x328903){return db[_0xd772('0x15')][_0xd772('0x16')](_0x31cf7c[_0xd772('0x17')],{'raw':_0x31cf7c['options']?_0x31cf7c['options'][_0xd772('0x18')]===undefined?!![]:![]:!![]})[_0xd772('0xa')](function(_0x34795d){logger['info'](_0xd772('0x14'),_0x31cf7c);logger[_0xd772('0xc')](_0xd772('0x14'),_0x31cf7c,JSON[_0xd772('0x19')](_0x34795d));_0x1d9a08(_0x34795d);})['catch'](function(_0xf910e9){logger['error'](_0xd772('0x14'),_0xf910e9[_0xd772('0x12')],_0x31cf7c);_0x328903(_0x1da61c[_0xd772('0xf')](0x1f4,_0xf910e9[_0xd772('0x12')]));});});};exports[_0xd772('0x1a')]=function(_0x45bfe0){var _0x29a98a=this;return new Promise(function(_0x3dd930,_0x1102ea){return db[_0xd772('0x15')][_0xd772('0x1b')](_0x45bfe0[_0xd772('0x17')],{'raw':_0x45bfe0['options']?_0x45bfe0[_0xd772('0x1c')][_0xd772('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45bfe0[_0xd772('0x1c')]?_0x45bfe0['options'][_0xd772('0x1d')]||null:null,'attributes':_0x45bfe0[_0xd772('0x1c')]?_0x45bfe0[_0xd772('0x1c')][_0xd772('0x1e')]||null:null,'limit':_0x45bfe0[_0xd772('0x1c')]?_0x45bfe0[_0xd772('0x1c')][_0xd772('0x1f')]||null:null})[_0xd772('0xa')](function(_0xd2c906){logger[_0xd772('0xb')](_0xd772('0x1a'),_0x45bfe0);logger[_0xd772('0xc')](_0xd772('0x1a'),_0x45bfe0,JSON['stringify'](_0xd2c906));_0x3dd930(_0xd2c906);})[_0xd772('0x20')](function(_0x1bb9ae){logger[_0xd772('0xf')](_0xd772('0x1a'),_0x1bb9ae[_0xd772('0x12')],_0x45bfe0);_0x1102ea(_0x29a98a[_0xd772('0xf')](0x1f4,_0x1bb9ae[_0xd772('0x12')]));});});}; \ No newline at end of file +var _0x74b1=['info','debug','request\x20sent','stringify','error','message','VoiceDialReport,\x20%s,\x20%s','result','catch','VoiceDialReport','body','options','CreateVoiceDialReport','UpdateVoiceDialReport','update','where','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1a084a,_0x11c05a){var _0x5f5e06=function(_0x3344d7){while(--_0x3344d7){_0x1a084a['push'](_0x1a084a['shift']());}};_0x5f5e06(++_0x11c05a);}(_0x74b1,0xf0));var _0x174b=function(_0x3a99f4,_0x2a81c1){_0x3a99f4=_0x3a99f4-0x0;var _0xea0b42=_0x74b1[_0x3a99f4];return _0xea0b42;};'use strict';var _=require('lodash');var util=require(_0x174b('0x0'));var moment=require(_0x174b('0x1'));var BPromise=require(_0x174b('0x2'));var rs=require(_0x174b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x174b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x174b('0x5'))('rpc');var config=require(_0x174b('0x6'));var jayson=require(_0x174b('0x7'));var client=jayson[_0x174b('0x8')][_0x174b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x157f63,_0x11072a,_0x5b23eb){return new BPromise(function(_0x305ddf,_0x42ca2e){return client[_0x174b('0xa')](_0x157f63,_0x5b23eb)[_0x174b('0xb')](function(_0x38b179){logger[_0x174b('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x11072a,'request\x20sent');logger[_0x174b('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x11072a,_0x174b('0xe'),JSON[_0x174b('0xf')](_0x38b179));if(_0x38b179['error']){if(_0x38b179[_0x174b('0x10')]['code']===0x1f4){logger[_0x174b('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x11072a,_0x38b179['error'][_0x174b('0x11')]);return _0x42ca2e(_0x38b179[_0x174b('0x10')][_0x174b('0x11')]);}logger[_0x174b('0x10')](_0x174b('0x12'),_0x11072a,_0x38b179[_0x174b('0x10')]['message']);return _0x305ddf(_0x38b179[_0x174b('0x10')][_0x174b('0x11')]);}else{logger[_0x174b('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x11072a,'request\x20sent');_0x305ddf(_0x38b179[_0x174b('0x13')][_0x174b('0x11')]);}})[_0x174b('0x14')](function(_0x204aa6){logger[_0x174b('0x10')](_0x174b('0x12'),_0x11072a,_0x204aa6);_0x42ca2e(_0x204aa6);});});}exports['CreateVoiceDialReport']=function(_0x465db1){var _0x9f136f=this;return new Promise(function(_0x3dfb81,_0x2a0928){return db[_0x174b('0x15')]['create'](_0x465db1[_0x174b('0x16')],{'raw':_0x465db1['options']?_0x465db1[_0x174b('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x174b('0xb')](function(_0x57682d){logger[_0x174b('0xc')](_0x174b('0x18'),_0x465db1);logger[_0x174b('0xd')](_0x174b('0x18'),_0x465db1,JSON['stringify'](_0x57682d));_0x3dfb81(_0x57682d);})[_0x174b('0x14')](function(_0x35b76a){logger[_0x174b('0x10')](_0x174b('0x18'),_0x35b76a[_0x174b('0x11')],_0x465db1);_0x2a0928(_0x9f136f['error'](0x1f4,_0x35b76a[_0x174b('0x11')]));});});};exports[_0x174b('0x19')]=function(_0x16b0c8){var _0x3fe4e7=this;return new Promise(function(_0xbee671,_0x19ee1e){return db[_0x174b('0x15')][_0x174b('0x1a')](_0x16b0c8[_0x174b('0x16')],{'raw':_0x16b0c8[_0x174b('0x17')]?_0x16b0c8[_0x174b('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16b0c8['options']?_0x16b0c8[_0x174b('0x17')][_0x174b('0x1b')]||null:null,'attributes':_0x16b0c8['options']?_0x16b0c8[_0x174b('0x17')]['attributes']||null:null,'limit':_0x16b0c8[_0x174b('0x17')]?_0x16b0c8['options']['limit']||null:null})[_0x174b('0xb')](function(_0x56ed16){logger[_0x174b('0xc')](_0x174b('0x19'),_0x16b0c8);logger[_0x174b('0xd')](_0x174b('0x19'),_0x16b0c8,JSON['stringify'](_0x56ed16));_0xbee671(_0x56ed16);})[_0x174b('0x14')](function(_0x2d3d2b){logger[_0x174b('0x10')](_0x174b('0x19'),_0x2d3d2b[_0x174b('0x11')],_0x16b0c8);_0x19ee1e(_0x3fe4e7[_0x174b('0x10')](0x1f4,_0x2d3d2b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 8c1e05b..2b1ccc9 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 _0xd201=['/:id/applications','addApplications','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','./voiceExtension.controller','isAuthenticated','get','show','post'];(function(_0x196e33,_0x2548a4){var _0xa5f1ca=function(_0x426bda){while(--_0x426bda){_0x196e33['push'](_0x196e33['shift']());}};_0xa5f1ca(++_0x2548a4);}(_0xd201,0x104));var _0x1d20=function(_0x17141f,_0x4d7c4b){_0x17141f=_0x17141f-0x0;var _0x3ee900=_0xd201[_0x17141f];return _0x3ee900;};'use strict';var multer=require(_0x1d20('0x0'));var util=require(_0x1d20('0x1'));var path=require('path');var timeout=require(_0x1d20('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1d20('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1d20('0x4'));var config=require('../../config/environment');var controller=require(_0x1d20('0x5'));router['get']('/',auth[_0x1d20('0x6')](),controller['index']);router[_0x1d20('0x7')]('/:id',auth[_0x1d20('0x6')](),controller[_0x1d20('0x8')]);router[_0x1d20('0x9')]('/',auth[_0x1d20('0x6')](),controller['create']);router['post'](_0x1d20('0xa'),auth[_0x1d20('0x6')](),controller[_0x1d20('0xb')]);router[_0x1d20('0xc')](_0x1d20('0xd'),auth[_0x1d20('0x6')](),controller[_0x1d20('0xe')]);router[_0x1d20('0xf')](_0x1d20('0xd'),auth[_0x1d20('0x6')](),controller[_0x1d20('0x10')]);module[_0x1d20('0x11')]=router; \ No newline at end of file +var _0xea6a=['../../components/interaction/service','./voiceExtension.controller','isAuthenticated','index','get','/:id','show','post','/:id/applications','addApplications','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x50dd7e,_0x116a92){var _0x5d9ad4=function(_0x65b243){while(--_0x65b243){_0x50dd7e['push'](_0x50dd7e['shift']());}};_0x5d9ad4(++_0x116a92);}(_0xea6a,0xea));var _0xaea6=function(_0x5d29f2,_0x1eca36){_0x5d29f2=_0x5d29f2-0x0;var _0x191127=_0xea6a[_0x5d29f2];return _0x191127;};'use strict';var multer=require(_0xaea6('0x0'));var util=require(_0xaea6('0x1'));var path=require(_0xaea6('0x2'));var timeout=require(_0xaea6('0x3'));var express=require(_0xaea6('0x4'));var router=express[_0xaea6('0x5')]();var fs_extra=require(_0xaea6('0x6'));var auth=require(_0xaea6('0x7'));var interaction=require(_0xaea6('0x8'));var config=require('../../config/environment');var controller=require(_0xaea6('0x9'));router['get']('/',auth[_0xaea6('0xa')](),controller[_0xaea6('0xb')]);router[_0xaea6('0xc')](_0xaea6('0xd'),auth['isAuthenticated'](),controller[_0xaea6('0xe')]);router[_0xaea6('0xf')]('/',auth[_0xaea6('0xa')](),controller['create']);router[_0xaea6('0xf')](_0xaea6('0x10'),auth[_0xaea6('0xa')](),controller[_0xaea6('0x11')]);router[_0xaea6('0x12')](_0xaea6('0xd'),auth[_0xaea6('0xa')](),controller[_0xaea6('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xaea6('0x14')]);module[_0xaea6('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 032a795..735a988 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 _0xf901=['outbound-fax','system','any','*,*,*,*','INTEGER','wav','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal'];(function(_0x37cc52,_0x459a9b){var _0x2b4a90=function(_0xabcfc7){while(--_0xabcfc7){_0x37cc52['push'](_0x37cc52['shift']());}};_0x2b4a90(++_0x459a9b);}(_0xf901,0x1c2));var _0x1f90=function(_0x523909,_0x1e8767){_0x523909=_0x523909-0x0;var _0x202c66=_0xf901[_0x523909];return _0x202c66;};'use strict';var Sequelize=require(_0x1f90('0x0'));module[_0x1f90('0x1')]={'context':{'type':Sequelize[_0x1f90('0x2')],'allowNull':![],'unique':_0x1f90('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x1f90('0x2')],'allowNull':![],'unique':_0x1f90('0x3')},'priority':{'type':Sequelize[_0x1f90('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x1f90('0x3')},'tag':{'type':Sequelize[_0x1f90('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x1f90('0x2')],'allowNull':![],'defaultValue':_0x1f90('0x4')},'appdata':{'type':Sequelize[_0x1f90('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x1f90('0x5')](_0x1f90('0x6'),_0x1f90('0x7'),_0x1f90('0x8'),'inbound-fax',_0x1f90('0x9'),_0x1f90('0xa'),_0x1f90('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x1f90('0x2')]},'interval':{'type':Sequelize[_0x1f90('0x2')],'allowNull':![],'defaultValue':_0x1f90('0xc')},'IntervalId':{'type':Sequelize[_0x1f90('0xd')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x1f90('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x1f90('0xd')]},'recordingFormat':{'type':Sequelize[_0x1f90('0x2')],'defaultValue':_0x1f90('0xe')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x1f90('0xf')],'get':function(_0x15fa4b){return this[_0x1f90('0x10')]('exten');}},'alias':{'type':Sequelize[_0x1f90('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x0d06=['inbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound'];(function(_0xa62004,_0xd3afd9){var _0x3c39ff=function(_0x302529){while(--_0x302529){_0xa62004['push'](_0xa62004['shift']());}};_0x3c39ff(++_0xd3afd9);}(_0x0d06,0xe9));var _0x60d0=function(_0x2fd0f0,_0x4b634e){_0x2fd0f0=_0x2fd0f0-0x0;var _0x57f71a=_0x0d06[_0x2fd0f0];return _0x57f71a;};'use strict';var Sequelize=require(_0x60d0('0x0'));module[_0x60d0('0x1')]={'context':{'type':Sequelize[_0x60d0('0x2')],'allowNull':![],'unique':_0x60d0('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x60d0('0x2')],'allowNull':![],'unique':_0x60d0('0x3')},'priority':{'type':Sequelize[_0x60d0('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x60d0('0x3')},'tag':{'type':Sequelize[_0x60d0('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x60d0('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x60d0('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x60d0('0x4')](_0x60d0('0x5'),_0x60d0('0x6'),'internal',_0x60d0('0x7'),'outbound-fax',_0x60d0('0x8'),_0x60d0('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x60d0('0x2')],'allowNull':![],'defaultValue':_0x60d0('0xa')},'IntervalId':{'type':Sequelize[_0x60d0('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x60d0('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x60d0('0xb')]},'recordingFormat':{'type':Sequelize[_0x60d0('0x2')],'defaultValue':_0x60d0('0xd')},'answer':{'type':Sequelize[_0x60d0('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x60d0('0xe')],'get':function(_0x147756){return this['getDataValue'](_0x60d0('0xf'));}},'alias':{'type':Sequelize[_0x60d0('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 2e911b7..7984ebf 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 _0x8322=['recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','findOne','sequelize','transaction','VoiceExtensionId','createRouting','log','LOG\x20~\x20.then\x20~\x20routing','bulkCreate','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','destroy','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','then','index','VoiceExtension','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','findAll','rows','params','rawAttributes','include','catch','create','body','outbound','startsWith','exten','concat','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','update','context','description'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x8322,0x186));var _0x2832=function(_0x6287b6,_0x5682e7){_0x6287b6=_0x6287b6-0x0;var _0x5d6be4=_0x8322[_0x6287b6];return _0x5d6be4;};'use strict';var _=require(_0x2832('0x0'));var Redis=require(_0x2832('0x1'));var qs=require(_0x2832('0x2'));var logger=require(_0x2832('0x3'))(_0x2832('0x4'));var config=require(_0x2832('0x5'));var db=require(_0x2832('0x6'))['db'];config[_0x2832('0x7')]=_[_0x2832('0x8')](config[_0x2832('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2832('0x7')]));require(_0x2832('0x9'))[_0x2832('0xa')](socket);function respondWithStatusCode(_0x29a788,_0x1488df){_0x1488df=_0x1488df||0xcc;return function(_0x4b0ca8){if(_0x4b0ca8){return _0x29a788[_0x2832('0xb')](_0x1488df);}return _0x29a788[_0x2832('0xc')](_0x1488df)[_0x2832('0xd')]();};}function respondWithResult(_0xb1f005,_0x5e6ba7){_0x5e6ba7=_0x5e6ba7||0xc8;return function(_0x3b091c){if(_0x3b091c){return _0xb1f005[_0x2832('0xc')](_0x5e6ba7)['json'](_0x3b091c);}};}function respondWithFilteredResult(_0x4e9da7,_0x4366bf){return function(_0x4a3bbc){if(_0x4a3bbc){var _0x4b1aac=typeof _0x4366bf[_0x2832('0xe')]===_0x2832('0xf')&&typeof _0x4366bf[_0x2832('0x10')]===_0x2832('0xf');var _0x53f53c=_0x4a3bbc[_0x2832('0x11')];var _0x6eeba=_0x4b1aac?0x0:_0x4366bf['offset'];var _0x27cf0c=_0x4b1aac?_0x4a3bbc[_0x2832('0x11')]:_0x4366bf[_0x2832('0xe')]+_0x4366bf[_0x2832('0x10')];var _0xb74a53;if(_0x27cf0c>=_0x53f53c){_0x27cf0c=_0x53f53c;_0xb74a53=0xc8;}else{_0xb74a53=0xce;}_0x4e9da7[_0x2832('0xc')](_0xb74a53);return _0x4e9da7[_0x2832('0x12')]('Content-Range',_0x6eeba+'-'+_0x27cf0c+'/'+_0x53f53c)[_0x2832('0x13')](_0x4a3bbc);}return null;};}function removeEntity(_0x38f293){return function(_0x57091e){if(_0x57091e){return _0x57091e[_0x2832('0x14')]()['then'](function(){var _0x52cb7f=_0x57091e['get']({'plain':!![]});var _0x5337ba=[{'name':_0x2832('0x15'),'value':_0x2832('0x16'),'ignore':![]},{'name':_0x2832('0x17'),'value':'outbound','ignore':![]},{'name':_0x2832('0x18'),'value':_0x2832('0x19'),'ignore':![]}];var _0x52f067=_(_0x5337ba)[_0x2832('0x1a')](_0x2832('0x1b'))[_0x2832('0x1c')](_0x2832('0x1d'))['value']();if(_[_0x2832('0x1e')](_0x52f067,_0x52cb7f[_0x2832('0x1f')])){return;}var _0x3d57f9=_[_0x2832('0x20')](_0x5337ba,[_0x2832('0x1d'),_0x52cb7f[_0x2832('0x1f')]])[_0x2832('0x21')];return db[_0x2832('0x22')][_0x2832('0x14')]({'where':{'type':_0x3d57f9,'resourceId':_0x52cb7f['id']}})[_0x2832('0x23')](function(){return _0x57091e;});})[_0x2832('0x23')](function(){_0x38f293['status'](0xcc)[_0x2832('0xd')]();});}};}function handleEntityNotFound(_0x216357){return function(_0x3eaae0){if(!_0x3eaae0){_0x216357[_0x2832('0xb')](0x194);}return _0x3eaae0;};}function handleError(_0x24621a,_0x83416e){_0x83416e=_0x83416e||0x1f4;return function(_0x203cd0){logger['error'](_0x203cd0['stack']);if(_0x203cd0['name']){delete _0x203cd0[_0x2832('0x21')];}_0x24621a[_0x2832('0xc')](_0x83416e)['send'](_0x203cd0);};}exports[_0x2832('0x24')]=function(_0x6c1907,_0x4694ac){var _0x3703b1={},_0x178173={},_0x42b595={'count':0x0,'rows':[]};var _0x2469ab=_[_0x2832('0x1c')](db[_0x2832('0x25')]['rawAttributes'],function(_0xb79617){return{'name':_0xb79617['fieldName'],'type':_0xb79617[_0x2832('0x1f')][_0x2832('0x26')]};});_0x178173[_0x2832('0x27')]=_[_0x2832('0x1c')](_0x2469ab,_0x2832('0x21'));_0x178173[_0x2832('0x28')]=_[_0x2832('0x29')](_0x6c1907['query']);_0x178173[_0x2832('0x2a')]=_[_0x2832('0x2b')](_0x178173[_0x2832('0x27')],_0x178173[_0x2832('0x28')]);_0x3703b1['attributes']=_[_0x2832('0x2b')](_0x178173['model'],qs[_0x2832('0x2c')](_0x6c1907['query']['fields']));_0x3703b1[_0x2832('0x2d')]=_0x3703b1[_0x2832('0x2d')][_0x2832('0x2e')]?_0x3703b1[_0x2832('0x2d')]:_0x178173[_0x2832('0x27')];if(!_0x6c1907[_0x2832('0x28')][_0x2832('0x2f')](_0x2832('0x30'))){_0x3703b1['limit']=qs[_0x2832('0x10')](_0x6c1907[_0x2832('0x28')][_0x2832('0x10')]);_0x3703b1['offset']=qs[_0x2832('0xe')](_0x6c1907[_0x2832('0x28')][_0x2832('0xe')]);}_0x3703b1[_0x2832('0x31')]=qs[_0x2832('0x32')](_0x6c1907['query']['sort']);_0x3703b1[_0x2832('0x33')]=qs[_0x2832('0x2a')](_[_0x2832('0x34')](_0x6c1907['query'],_0x178173[_0x2832('0x2a')]),_0x2469ab);if(_0x6c1907[_0x2832('0x28')][_0x2832('0x1a')]){_0x3703b1['where']=_['merge'](_0x3703b1[_0x2832('0x33')],{'$or':_[_0x2832('0x1c')](_0x2469ab,function(_0x13ccba){if(_0x13ccba[_0x2832('0x1f')]!==_0x2832('0x35')){var _0x563543={};_0x563543[_0x13ccba['name']]={'$like':'%'+_0x6c1907[_0x2832('0x28')][_0x2832('0x1a')]+'%'};return _0x563543;}})});}_0x3703b1=_[_0x2832('0x36')]({},_0x3703b1,_0x6c1907[_0x2832('0x37')]);var _0x1fc691={'where':_0x3703b1['where']};return db[_0x2832('0x25')][_0x2832('0x11')](_0x1fc691)[_0x2832('0x23')](function(_0x834cae){_0x42b595[_0x2832('0x11')]=_0x834cae;if(_0x6c1907['query'][_0x2832('0x38')]){_0x3703b1['include']=[{'all':!![]}];}return db[_0x2832('0x25')][_0x2832('0x39')](_0x3703b1);})[_0x2832('0x23')](function(_0x50e92d){_0x42b595[_0x2832('0x3a')]=_0x50e92d;return _0x42b595;})[_0x2832('0x23')](respondWithFilteredResult(_0x4694ac,_0x3703b1))['catch'](handleError(_0x4694ac,null));};exports['show']=function(_0x716f66,_0x759be8){var _0x4e0564={'raw':![],'where':{'id':_0x716f66[_0x2832('0x3b')]['id']}},_0xce2866={};_0xce2866[_0x2832('0x27')]=_[_0x2832('0x29')](db[_0x2832('0x25')][_0x2832('0x3c')]);_0xce2866[_0x2832('0x28')]=_[_0x2832('0x29')](_0x716f66[_0x2832('0x28')]);_0xce2866[_0x2832('0x2a')]=_['intersection'](_0xce2866[_0x2832('0x27')],_0xce2866['query']);_0x4e0564[_0x2832('0x2d')]=_['intersection'](_0xce2866[_0x2832('0x27')],qs[_0x2832('0x2c')](_0x716f66['query'][_0x2832('0x2c')]));_0x4e0564[_0x2832('0x2d')]=_0x4e0564['attributes'][_0x2832('0x2e')]?_0x4e0564['attributes']:_0xce2866[_0x2832('0x27')];if(_0x716f66[_0x2832('0x28')][_0x2832('0x38')]){_0x4e0564[_0x2832('0x3d')]=[{'all':!![]}];}_0x4e0564=_[_0x2832('0x36')]({},_0x4e0564,_0x716f66[_0x2832('0x37')]);return db[_0x2832('0x25')][_0x2832('0x20')](_0x4e0564)['then'](handleEntityNotFound(_0x759be8,null))['then'](respondWithResult(_0x759be8,null))[_0x2832('0x3e')](handleError(_0x759be8,null));};exports[_0x2832('0x14')]=function(_0xa3ff85,_0x2f4ef0){return db[_0x2832('0x25')][_0x2832('0x20')]({'where':{'id':_0xa3ff85[_0x2832('0x3b')]['id']}})[_0x2832('0x23')](handleEntityNotFound(_0x2f4ef0,null))[_0x2832('0x23')](removeEntity(_0x2f4ef0,null))['catch'](handleError(_0x2f4ef0,null));};exports[_0x2832('0x3f')]=function(_0x5e77df,_0x4bc52d){if(_0x5e77df[_0x2832('0x40')][_0x2832('0x1f')]===_0x2832('0x41')&&!_[_0x2832('0x42')](_0x5e77df['body'][_0x2832('0x43')],'_')){_0x5e77df[_0x2832('0x40')][_0x2832('0x43')]='_'[_0x2832('0x44')](_0x5e77df[_0x2832('0x40')][_0x2832('0x43')]);}return db[_0x2832('0x25')]['create'](_0x5e77df['body'],{'raw':![]})['then'](function(_0x47c0f0){var _0x5a9fc7=_0x5e77df['user'][_0x2832('0x45')]({'plain':!![]});if(!_0x5a9fc7)throw new Error(_0x2832('0x46'));if(_0x5a9fc7[_0x2832('0x47')]===_0x2832('0x48')){var _0x2a997a=_0x47c0f0[_0x2832('0x45')]({'plain':!![]});var _0x2942a9=[{'name':_0x2832('0x15'),'value':'inbound'},{'name':_0x2832('0x17'),'value':_0x2832('0x41')},{'name':_0x2832('0x18'),'value':_0x2832('0x19')}];var _0xb6036d=_[_0x2832('0x20')](_0x2942a9,[_0x2832('0x1d'),_0x2a997a['type']])['name'];return db[_0x2832('0x49')][_0x2832('0x20')]({'where':{'name':_0xb6036d,'userProfileId':_0x5a9fc7[_0x2832('0x4a')]},'raw':!![]})[_0x2832('0x23')](function(_0x1b55ed){if(_0x1b55ed&&_0x1b55ed[_0x2832('0x4b')]===0x0){return db['UserProfileResource'][_0x2832('0x3f')]({'name':_0x2a997a[_0x2832('0x21')],'resourceId':_0x2a997a['id'],'type':_0x1b55ed[_0x2832('0x21')],'sectionId':_0x1b55ed['id']},{})['then'](function(){return _0x47c0f0;});}else{return _0x47c0f0;}})[_0x2832('0x3e')](function(_0x5e5c24){logger[_0x2832('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e5c24);throw _0x5e5c24;});}return _0x47c0f0;})[_0x2832('0x23')](respondWithResult(_0x4bc52d,0xc9))[_0x2832('0x3e')](handleError(_0x4bc52d,null));};exports['update']=function(_0x23997d,_0x4f779e){if(_0x23997d[_0x2832('0x40')]['id']){delete _0x23997d['body']['id'];}return db[_0x2832('0x25')]['find']({'where':{'id':_0x23997d['params']['id']}})[_0x2832('0x23')](handleEntityNotFound(_0x4f779e,null))['then'](function(_0x1298f7){if(_0x1298f7){return db['VoiceExtension'][_0x2832('0x4d')](_[_0x2832('0x34')](_0x23997d[_0x2832('0x40')],[_0x2832('0x43'),_0x2832('0x4e'),_0x2832('0x4f'),_0x2832('0x50'),_0x2832('0x51'),_0x2832('0x52'),_0x2832('0x53')]),{'where':{'context':_0x1298f7['context'],'exten':_0x1298f7[_0x2832('0x43')]},'individualHooks':!![]})[_0x2832('0x23')](function(_0x4635ae){return _0x4635ae;});}return null;})[_0x2832('0x23')](respondWithStatusCode(_0x4f779e,null))[_0x2832('0x3e')](handleError(_0x4f779e,null));};exports[_0x2832('0x54')]=function(_0x7c3bf,_0x3e9ed2){return db[_0x2832('0x25')][_0x2832('0x55')]({'where':{'id':_0x7c3bf[_0x2832('0x3b')]['id']}})[_0x2832('0x23')](function(_0x4c4a5e){if(_0x4c4a5e){return db[_0x2832('0x56')][_0x2832('0x57')](function(_0x4cd9c7){return db[_0x2832('0x25')]['destroy']({'where':{'VoiceExtensionId':_0x7c3bf[_0x2832('0x3b')]['id']},'transaction':_0x4cd9c7})[_0x2832('0x23')](function(){var _0x15f2d8=_[_0x2832('0x1c')](_0x7c3bf[_0x2832('0x40')],function(_0x6959c7){_0x6959c7[_0x2832('0x58')]=_0x7c3bf['params']['id'];_0x6959c7['isApp']=!![];return _0x6959c7;});return _0x4c4a5e[_0x2832('0x59')](_0x15f2d8);})['then'](function(_0x27014b){console[_0x2832('0x5a')](_0x2832('0x5b'),_0x27014b);return db[_0x2832('0x25')][_0x2832('0x5c')](_0x27014b,{'transaction':_0x4cd9c7});});})['then'](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x7c3bf[_0x2832('0x3b')]['id']},'order':_0x2832('0x5d')});});}})[_0x2832('0x23')](respondWithResult(_0x3e9ed2,null))['catch'](handleError(_0x3e9ed2,null));}; \ No newline at end of file +var _0x928c=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','internal','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','findOne','sequelize','transaction','VoiceExtensionId','isApp','createRouting','log','LOG\x20~\x20.then\x20~\x20routing','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','offset','limit','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','name','UserProfileResource','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','startsWith','exten','concat','user'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x928c,0x17f));var _0xc928=function(_0x3db361,_0x34e8b3){_0x3db361=_0x3db361-0x0;var _0x4d9d29=_0x928c[_0x3db361];return _0x4d9d29;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xc928('0x0'));var logger=require(_0xc928('0x1'))('api');var config=require(_0xc928('0x2'));var db=require(_0xc928('0x3'))['db'];config[_0xc928('0x4')]=_[_0xc928('0x5')](config[_0xc928('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0xc928('0x6'))(new Redis(config[_0xc928('0x4')]));require(_0xc928('0x7'))['register'](socket);function respondWithStatusCode(_0x4fd2a0,_0x5e433b){_0x5e433b=_0x5e433b||0xcc;return function(_0x445248){if(_0x445248){return _0x4fd2a0[_0xc928('0x8')](_0x5e433b);}return _0x4fd2a0[_0xc928('0x9')](_0x5e433b)[_0xc928('0xa')]();};}function respondWithResult(_0x421f1b,_0x628a51){_0x628a51=_0x628a51||0xc8;return function(_0x29b39a){if(_0x29b39a){return _0x421f1b[_0xc928('0x9')](_0x628a51)['json'](_0x29b39a);}};}function respondWithFilteredResult(_0xb8d4e8,_0x408632){return function(_0x550eba){if(_0x550eba){var _0x493fcc=typeof _0x408632[_0xc928('0xb')]==='undefined'&&typeof _0x408632[_0xc928('0xc')]==='undefined';var _0x425750=_0x550eba[_0xc928('0xd')];var _0x4f3b5a=_0x493fcc?0x0:_0x408632[_0xc928('0xb')];var _0x1428c2=_0x493fcc?_0x550eba['count']:_0x408632[_0xc928('0xb')]+_0x408632[_0xc928('0xc')];var _0x10f3cd;if(_0x1428c2>=_0x425750){_0x1428c2=_0x425750;_0x10f3cd=0xc8;}else{_0x10f3cd=0xce;}_0xb8d4e8[_0xc928('0x9')](_0x10f3cd);return _0xb8d4e8[_0xc928('0xe')](_0xc928('0xf'),_0x4f3b5a+'-'+_0x1428c2+'/'+_0x425750)['json'](_0x550eba);}return null;};}function removeEntity(_0x16dd14){return function(_0x331e02){if(_0x331e02){return _0x331e02[_0xc928('0x10')]()[_0xc928('0x11')](function(){var _0x12479f=_0x331e02[_0xc928('0x12')]({'plain':!![]});var _0x1b9097=[{'name':_0xc928('0x13'),'value':_0xc928('0x14'),'ignore':![]},{'name':_0xc928('0x15'),'value':_0xc928('0x16'),'ignore':![]},{'name':_0xc928('0x17'),'value':'internal','ignore':![]}];var _0xcf3bc7=_(_0x1b9097)[_0xc928('0x18')](_0xc928('0x19'))[_0xc928('0x1a')]('value')[_0xc928('0x1b')]();if(_[_0xc928('0x1c')](_0xcf3bc7,_0x12479f[_0xc928('0x1d')])){return;}var _0x51c5da=_['find'](_0x1b9097,[_0xc928('0x1b'),_0x12479f[_0xc928('0x1d')]])[_0xc928('0x1e')];return db[_0xc928('0x1f')]['destroy']({'where':{'type':_0x51c5da,'resourceId':_0x12479f['id']}})['then'](function(){return _0x331e02;});})[_0xc928('0x11')](function(){_0x16dd14[_0xc928('0x9')](0xcc)[_0xc928('0xa')]();});}};}function handleEntityNotFound(_0x1a5dc2){return function(_0x2090f8){if(!_0x2090f8){_0x1a5dc2['sendStatus'](0x194);}return _0x2090f8;};}function handleError(_0x3925d3,_0xdb3c4b){_0xdb3c4b=_0xdb3c4b||0x1f4;return function(_0x2ac3c7){logger['error'](_0x2ac3c7['stack']);if(_0x2ac3c7[_0xc928('0x1e')]){delete _0x2ac3c7[_0xc928('0x1e')];}_0x3925d3['status'](_0xdb3c4b)[_0xc928('0x20')](_0x2ac3c7);};}exports[_0xc928('0x21')]=function(_0xcb813,_0x3f3690){var _0x58b20b={},_0x207d06={},_0x1aa39c={'count':0x0,'rows':[]};var _0x38df7a=_[_0xc928('0x1a')](db[_0xc928('0x22')][_0xc928('0x23')],function(_0x9deef4){return{'name':_0x9deef4[_0xc928('0x24')],'type':_0x9deef4[_0xc928('0x1d')][_0xc928('0x25')]};});_0x207d06[_0xc928('0x26')]=_[_0xc928('0x1a')](_0x38df7a,_0xc928('0x1e'));_0x207d06[_0xc928('0x27')]=_[_0xc928('0x28')](_0xcb813[_0xc928('0x27')]);_0x207d06[_0xc928('0x29')]=_[_0xc928('0x2a')](_0x207d06['model'],_0x207d06[_0xc928('0x27')]);_0x58b20b[_0xc928('0x2b')]=_[_0xc928('0x2a')](_0x207d06['model'],qs['fields'](_0xcb813[_0xc928('0x27')][_0xc928('0x2c')]));_0x58b20b[_0xc928('0x2b')]=_0x58b20b[_0xc928('0x2b')][_0xc928('0x2d')]?_0x58b20b[_0xc928('0x2b')]:_0x207d06[_0xc928('0x26')];if(!_0xcb813[_0xc928('0x27')][_0xc928('0x2e')](_0xc928('0x2f'))){_0x58b20b[_0xc928('0xc')]=qs[_0xc928('0xc')](_0xcb813[_0xc928('0x27')]['limit']);_0x58b20b[_0xc928('0xb')]=qs[_0xc928('0xb')](_0xcb813['query'][_0xc928('0xb')]);}_0x58b20b[_0xc928('0x30')]=qs[_0xc928('0x31')](_0xcb813[_0xc928('0x27')][_0xc928('0x31')]);_0x58b20b[_0xc928('0x32')]=qs[_0xc928('0x29')](_[_0xc928('0x33')](_0xcb813['query'],_0x207d06['filters']),_0x38df7a);if(_0xcb813[_0xc928('0x27')]['filter']){_0x58b20b[_0xc928('0x32')]=_[_0xc928('0x34')](_0x58b20b[_0xc928('0x32')],{'$or':_[_0xc928('0x1a')](_0x38df7a,function(_0xf875fc){if(_0xf875fc[_0xc928('0x1d')]!=='VIRTUAL'){var _0x116286={};_0x116286[_0xf875fc[_0xc928('0x1e')]]={'$like':'%'+_0xcb813[_0xc928('0x27')]['filter']+'%'};return _0x116286;}})});}_0x58b20b=_[_0xc928('0x34')]({},_0x58b20b,_0xcb813[_0xc928('0x35')]);var _0x1925fe={'where':_0x58b20b[_0xc928('0x32')]};return db[_0xc928('0x22')][_0xc928('0xd')](_0x1925fe)['then'](function(_0x2f36c9){_0x1aa39c['count']=_0x2f36c9;if(_0xcb813[_0xc928('0x27')][_0xc928('0x36')]){_0x58b20b[_0xc928('0x37')]=[{'all':!![]}];}return db[_0xc928('0x22')][_0xc928('0x38')](_0x58b20b);})['then'](function(_0x134999){_0x1aa39c[_0xc928('0x39')]=_0x134999;return _0x1aa39c;})['then'](respondWithFilteredResult(_0x3f3690,_0x58b20b))['catch'](handleError(_0x3f3690,null));};exports['show']=function(_0x5bc131,_0x45f5ff){var _0x4bb65f={'raw':![],'where':{'id':_0x5bc131[_0xc928('0x3a')]['id']}},_0x432ab2={};_0x432ab2[_0xc928('0x26')]=_[_0xc928('0x28')](db[_0xc928('0x22')]['rawAttributes']);_0x432ab2[_0xc928('0x27')]=_[_0xc928('0x28')](_0x5bc131['query']);_0x432ab2['filters']=_[_0xc928('0x2a')](_0x432ab2[_0xc928('0x26')],_0x432ab2[_0xc928('0x27')]);_0x4bb65f[_0xc928('0x2b')]=_[_0xc928('0x2a')](_0x432ab2[_0xc928('0x26')],qs['fields'](_0x5bc131[_0xc928('0x27')]['fields']));_0x4bb65f[_0xc928('0x2b')]=_0x4bb65f[_0xc928('0x2b')][_0xc928('0x2d')]?_0x4bb65f[_0xc928('0x2b')]:_0x432ab2[_0xc928('0x26')];if(_0x5bc131['query']['includeAll']){_0x4bb65f[_0xc928('0x37')]=[{'all':!![]}];}_0x4bb65f=_[_0xc928('0x34')]({},_0x4bb65f,_0x5bc131['options']);return db[_0xc928('0x22')][_0xc928('0x3b')](_0x4bb65f)[_0xc928('0x11')](handleEntityNotFound(_0x45f5ff,null))['then'](respondWithResult(_0x45f5ff,null))[_0xc928('0x3c')](handleError(_0x45f5ff,null));};exports[_0xc928('0x10')]=function(_0xa1bdd,_0x214f85){return db['VoiceExtension'][_0xc928('0x3b')]({'where':{'id':_0xa1bdd[_0xc928('0x3a')]['id']}})['then'](handleEntityNotFound(_0x214f85,null))[_0xc928('0x11')](removeEntity(_0x214f85,null))[_0xc928('0x3c')](handleError(_0x214f85,null));};exports[_0xc928('0x3d')]=function(_0x198fcf,_0x1d8899){if(_0x198fcf[_0xc928('0x3e')]['type']===_0xc928('0x16')&&!_[_0xc928('0x3f')](_0x198fcf['body']['exten'],'_')){_0x198fcf[_0xc928('0x3e')][_0xc928('0x40')]='_'[_0xc928('0x41')](_0x198fcf[_0xc928('0x3e')][_0xc928('0x40')]);}return db[_0xc928('0x22')][_0xc928('0x3d')](_0x198fcf['body'],{'raw':![]})['then'](function(_0x398b42){var _0x2fdabf=_0x198fcf[_0xc928('0x42')]['get']({'plain':!![]});if(!_0x2fdabf)throw new Error(_0xc928('0x43'));if(_0x2fdabf[_0xc928('0x44')]==='user'){var _0x155e4e=_0x398b42[_0xc928('0x12')]({'plain':!![]});var _0xc44393=[{'name':_0xc928('0x13'),'value':_0xc928('0x14')},{'name':_0xc928('0x15'),'value':_0xc928('0x16')},{'name':_0xc928('0x17'),'value':_0xc928('0x45')}];var _0x396ecc=_[_0xc928('0x3b')](_0xc44393,[_0xc928('0x1b'),_0x155e4e[_0xc928('0x1d')]])[_0xc928('0x1e')];return db[_0xc928('0x46')][_0xc928('0x3b')]({'where':{'name':_0x396ecc,'userProfileId':_0x2fdabf[_0xc928('0x47')]},'raw':!![]})[_0xc928('0x11')](function(_0x37efe8){if(_0x37efe8&&_0x37efe8['autoAssociation']===0x0){return db[_0xc928('0x1f')][_0xc928('0x3d')]({'name':_0x155e4e[_0xc928('0x1e')],'resourceId':_0x155e4e['id'],'type':_0x37efe8[_0xc928('0x1e')],'sectionId':_0x37efe8['id']},{})[_0xc928('0x11')](function(){return _0x398b42;});}else{return _0x398b42;}})[_0xc928('0x3c')](function(_0x614f9e){logger[_0xc928('0x48')](_0xc928('0x49'),_0x614f9e);throw _0x614f9e;});}return _0x398b42;})[_0xc928('0x11')](respondWithResult(_0x1d8899,0xc9))[_0xc928('0x3c')](handleError(_0x1d8899,null));};exports[_0xc928('0x4a')]=function(_0x19758f,_0x349d67){if(_0x19758f[_0xc928('0x3e')]['id']){delete _0x19758f[_0xc928('0x3e')]['id'];}return db[_0xc928('0x22')][_0xc928('0x3b')]({'where':{'id':_0x19758f[_0xc928('0x3a')]['id']}})[_0xc928('0x11')](handleEntityNotFound(_0x349d67,null))[_0xc928('0x11')](function(_0x43ceee){if(_0x43ceee){return db[_0xc928('0x22')]['update'](_['pick'](_0x19758f[_0xc928('0x3e')],['exten',_0xc928('0x4b'),_0xc928('0x4c'),_0xc928('0x4d'),'cutdigits',_0xc928('0x4e'),'alias']),{'where':{'context':_0x43ceee['context'],'exten':_0x43ceee['exten']},'individualHooks':!![]})[_0xc928('0x11')](function(_0x568ff0){return _0x568ff0;});}return null;})['then'](respondWithStatusCode(_0x349d67,null))[_0xc928('0x3c')](handleError(_0x349d67,null));};exports['addApplications']=function(_0x3c9297,_0x1adeb4){return db[_0xc928('0x22')][_0xc928('0x4f')]({'where':{'id':_0x3c9297[_0xc928('0x3a')]['id']}})['then'](function(_0x5c1de1){if(_0x5c1de1){return db[_0xc928('0x50')][_0xc928('0x51')](function(_0x2285fc){return db[_0xc928('0x22')][_0xc928('0x10')]({'where':{'VoiceExtensionId':_0x3c9297[_0xc928('0x3a')]['id']},'transaction':_0x2285fc})['then'](function(){var _0x24fc97=_[_0xc928('0x1a')](_0x3c9297[_0xc928('0x3e')],function(_0x15735c){_0x15735c[_0xc928('0x52')]=_0x3c9297[_0xc928('0x3a')]['id'];_0x15735c[_0xc928('0x53')]=!![];return _0x15735c;});return _0x5c1de1[_0xc928('0x54')](_0x24fc97);})[_0xc928('0x11')](function(_0x2a2873){console[_0xc928('0x55')](_0xc928('0x56'),_0x2a2873);return db['VoiceExtension'][_0xc928('0x57')](_0x2a2873,{'transaction':_0x2285fc});});})[_0xc928('0x11')](function(){return db[_0xc928('0x22')][_0xc928('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3c9297[_0xc928('0x3a')]['id']},'order':_0xc928('0x59')});});}})[_0xc928('0x11')](respondWithResult(_0x1adeb4,null))[_0xc928('0x3c')](handleError(_0x1adeb4,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 6b1d77e..1bb509b 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 _0xe29b=['events','../../mysqldb','VoiceExtension','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x593286,_0x269d0c){var _0x14c673=function(_0xed2641){while(--_0xed2641){_0x593286['push'](_0x593286['shift']());}};_0x14c673(++_0x269d0c);}(_0xe29b,0x140));var _0xbe29=function(_0x2ee12e,_0x60d150){_0x2ee12e=_0x2ee12e-0x0;var _0x52415b=_0xe29b[_0x2ee12e];return _0x52415b;};'use strict';var EventEmitter=require(_0xbe29('0x0'));var VoiceExtension=require(_0xbe29('0x1'))['db'][_0xbe29('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xbe29('0x3')](0x0);var events={'afterCreate':_0xbe29('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5a173e){return function(_0x5b0429,_0xc51839,_0x54c778){VoiceExtensionEvents[_0xbe29('0x5')](_0x5a173e+':'+_0x5b0429['id'],_0x5b0429);VoiceExtensionEvents[_0xbe29('0x5')](_0x5a173e,_0x5b0429);_0x54c778(null);};}for(var e in events){if(events[_0xbe29('0x6')](e)){var event=events[e];VoiceExtension[_0xbe29('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x6a60=['VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x2bcd1f,_0x4f1972){var _0x2381ca=function(_0x51f935){while(--_0x51f935){_0x2bcd1f['push'](_0x2bcd1f['shift']());}};_0x2381ca(++_0x4f1972);}(_0x6a60,0xf2));var _0x06a6=function(_0x1c4e40,_0x3e0f04){_0x1c4e40=_0x1c4e40-0x0;var _0x101bde=_0x6a60[_0x1c4e40];return _0x101bde;};'use strict';var EventEmitter=require(_0x06a6('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x06a6('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x06a6('0x2')](0x0);var events={'afterCreate':_0x06a6('0x3'),'afterUpdate':_0x06a6('0x4'),'afterDestroy':_0x06a6('0x5')};function emitEvent(_0x4cb13d){return function(_0x320a96,_0x5bf3ad,_0x211cf7){VoiceExtensionEvents[_0x06a6('0x6')](_0x4cb13d+':'+_0x320a96['id'],_0x320a96);VoiceExtensionEvents[_0x06a6('0x6')](_0x4cb13d,_0x320a96);_0x211cf7(null);};}for(var e in events){if(events[_0x06a6('0x7')](e)){var event=events[e];VoiceExtension[_0x06a6('0x8')](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 dda5981..c542faf 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 _0x5d01=['outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','indexOf','replace','U(xcally-mixmonitor-context)','Interval','IntervalId','then','interval','*,*,*,*','map','filter','toLowerCase','tag','CDR(tag)=','intervals','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','exten','NoOp','CDR(routeAlias)=','alias','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0x5d01,0xe5));var _0x15d0=function(_0x42dc3e,_0x117cf1){_0x42dc3e=_0x42dc3e-0x0;var _0x17224d=_0x5d01[_0x42dc3e];return _0x17224d;};'use strict';var _=require(_0x15d0('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x15d0('0x1')]=function(_0x451b82){var _0x580bc6=_0x451b82[_0x15d0('0x2')];function _0x665632(_0x5e76ab){var _0x53abcf=0x2;var _0x1a067d=[{'type':_0x5e76ab[_0x15d0('0x3')],'app':_0x15d0('0x4'),'appdata':_0x15d0('0x5')+_0x5e76ab[_0x15d0('0x3')],'context':_0x5e76ab[_0x15d0('0x6')],'exten':_0x5e76ab[_0x15d0('0x7')],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']},{'type':_0x5e76ab[_0x15d0('0x3')],'app':_0x5e76ab['alias']?_0x15d0('0x4'):_0x15d0('0x8'),'appdata':_0x5e76ab['alias']?_0x15d0('0x9')+_0x5e76ab[_0x15d0('0xa')]:'No\x20alias\x20set','context':_0x5e76ab['context'],'exten':_0x5e76ab['exten'],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']}];if(_0x5e76ab[_0x15d0('0x3')]===_0x15d0('0xb')){_0x1a067d[_0x15d0('0xc')]({'type':_0x15d0('0xb'),'app':'Set','appdata':_0x15d0('0xd')+_0x5e76ab['id'],'context':_0x5e76ab[_0x15d0('0x6')],'exten':_0x5e76ab[_0x15d0('0x7')],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']});}_0x1a067d[_0x15d0('0xc')]({'type':_0x5e76ab[_0x15d0('0x3')],'app':_0x15d0('0x4'),'appdata':_0x15d0('0xe'),'context':_0x5e76ab[_0x15d0('0x6')],'exten':_0x5e76ab['exten'],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']},{'type':_0x5e76ab[_0x15d0('0x3')],'app':_0x15d0('0x4'),'appdata':_0x15d0('0xf'),'context':_0x5e76ab[_0x15d0('0x6')],'exten':_0x5e76ab[_0x15d0('0x7')],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']},{'type':_0x5e76ab[_0x15d0('0x3')],'app':_0x15d0('0x4'),'appdata':_0x15d0('0x10'),'context':_0x5e76ab[_0x15d0('0x6')],'exten':_0x5e76ab['exten'],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']});return _0x1a067d;}function _0x50ae3a(_0x536f28){var _0x6831b6=0x2;var _0x1abfa8=[{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x12'),'context':_0x536f28['context'],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x536f28[_0x15d0('0xa')]?_0x15d0('0x4'):'NoOp','appdata':_0x536f28[_0x15d0('0xa')]?'CDR(routeAlias)='+_0x536f28['alias']:_0x15d0('0x13'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':'Set','appdata':_0x15d0('0x14')+(_0x536f28[_0x15d0('0x15')]?_0x15d0('0x16')+_0x536f28[_0x15d0('0x15')]+'}':'${EXTEN}'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28['exten'],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':'CDR(routeid)='+_0x536f28['id'],'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x17'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x6831b6+0x2)+_0x15d0('0x18')+(_0x6831b6+0x1)+')','context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28['exten'],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':'Set','appdata':_0x536f28['cutdigits']?_0x15d0('0x19')+_0x536f28[_0x15d0('0x15')]+'}':'CDR(prefix)=noprefix','context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':'Set','appdata':_0x15d0('0xe'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':_0x15d0('0xf'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x10'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x1a')+_0x536f28['id'],'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']}];if(_0x536f28[_0x15d0('0x1b')](_0x15d0('0x1c'))&&_0x536f28[_0x15d0('0x1c')]!==_0x15d0('0x1d')){_0x1abfa8[_0x15d0('0xc')]({'type':'outbound','app':_0x15d0('0x4'),'appdata':_0x15d0('0x1e'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x536f28[_0x15d0('0x1c')]||'wav','context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']});}return _0x1abfa8;}function _0x496c80(_0x35e1dc,_0x8e02a0){var _0x495d2a=[{'name':_0x15d0('0x1f'),'param':0x0},{'name':_0x15d0('0x20'),'param':0x1},{'name':_0x15d0('0x21'),'param':0x2},{'name':_0x15d0('0x22'),'param':0x3}];var _0x4a7d94={};var _0x54601c=_0x8e02a0[_0x15d0('0x23')](',');var _0x3a9b23=[];for(var _0xdd62e5=0x0;_0xdd62e5<_0x495d2a[_0x15d0('0x24')];_0xdd62e5++){switch(_0x495d2a[_0xdd62e5][_0x15d0('0x25')]){case _0x15d0('0x1f'):_0x4a7d94['trunk']=_0x54601c[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]][_0x15d0('0x23')]('/')[0x1];_0x4a7d94[_0x15d0('0x27')]=_0x54601c[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]]['split']('/')[0x2];_0x4a7d94[_0x15d0('0x28')]=_0x4a7d94[_0x15d0('0x27')]?_0x4a7d94[_0x15d0('0x27')]['split']('$')[0x0]:undefined;_0x4a7d94['phone']=_0x35e1dc[_0x15d0('0x15')]?(_0x4a7d94[_0x15d0('0x28')]||'')+_0x15d0('0x16')+_0x35e1dc[_0x15d0('0x15')]+'}':(_0x4a7d94[_0x15d0('0x28')]||'')+'${EXTEN}';_0x3a9b23[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]]=[_0x15d0('0x29'),_0x4a7d94[_0x15d0('0x1f')],_0x4a7d94[_0x15d0('0x27')]][_0x15d0('0x2a')]('/');break;case _0x15d0('0x21'):_0x4a7d94[_0x15d0('0x21')]=_0x54601c[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]];if(_0x35e1dc[_0x15d0('0x1c')]!==_0x15d0('0x1d')){if(_0x4a7d94[_0x15d0('0x21')][_0x15d0('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x4a7d94[_0x15d0('0x21')]+='U(xcally-mixmonitor-context)';}}else{_0x4a7d94[_0x15d0('0x21')]=_0x4a7d94[_0x15d0('0x21')][_0x15d0('0x2c')](_0x15d0('0x2d'),'');}_0x3a9b23[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]]=_0x4a7d94[_0x15d0('0x21')];break;default:_0x3a9b23[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]]=_0x54601c[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]];}}return _0x3a9b23[_0x15d0('0x2a')](',');}function _0x622830(_0x5ba147,_0x2be6ca,_0x21c3bf){return new Promise(function(_0x230bb2,_0x1f1b3c){var _0x25eedb=[];if(_['isEmpty'](_0x2be6ca))return _0x230bb2(_0x25eedb);_0x580bc6[_0x15d0('0x2e')]['findAll']({'attributes':['id','interval',_0x15d0('0x2f')],'raw':!![]})[_0x15d0('0x30')](function(_0x367d58){for(var _0x11933f=0x0,_0x1c7c01=0x0;_0x11933f<_0x2be6ca['length'];_0x11933f++,_0x1c7c01=0x0){var _0xb4be9b=_0x2be6ca[_0x11933f];var _0x32de8d=[];var _0x1b38e7=[];delete _0xb4be9b['id'];if(_0xb4be9b[_0x15d0('0x31')]!==_0x15d0('0x32')){_0xb4be9b['intervals']=[_0xb4be9b[_0x15d0('0x31')]];}else{_0xb4be9b['intervals']=_0xb4be9b[_0x15d0('0x2f')]?_[_0x15d0('0x33')](_[_0x15d0('0x34')](_0x367d58,{'IntervalId':_0xb4be9b[_0x15d0('0x2f')]}),'interval'):[];}_0xb4be9b[_0x15d0('0x6')]=_0x5ba147[_0x15d0('0x6')];_0xb4be9b[_0x15d0('0x7')]=_0x5ba147[_0x15d0('0x7')];if(_0xb4be9b[_0x15d0('0x3')])_0xb4be9b[_0x15d0('0x3')]=_0xb4be9b['type'][_0x15d0('0x35')]();if(_0x5ba147[_0x15d0('0x3')]==='outbound'){if(_0xb4be9b[_0x15d0('0x1b')](_0x15d0('0x36'))&&_0xb4be9b[_0x15d0('0x36')]&&_0xb4be9b[_0x15d0('0x36')]!=='--'){_0x32de8d[_0x15d0('0xc')]({'type':_0xb4be9b[_0x15d0('0x3')]['toLowerCase'](),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x37')+_0xb4be9b[_0x15d0('0x36')],'context':_0x5ba147[_0x15d0('0x6')],'exten':_0x5ba147[_0x15d0('0x7')],'priority':_0xb4be9b[_0x15d0('0x38')][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});}_0x32de8d[_0x15d0('0xc')]({'type':_0xb4be9b[_0x15d0('0x3')][_0x15d0('0x35')](),'app':_0x15d0('0x17'),'appdata':_0x15d0('0x39')+(_0xb4be9b[_0x15d0('0x3a')]?_0x15d0('0x3b')+_0xb4be9b[_0x15d0('0x3a')]+')':_0x15d0('0x3c')),'context':_0x5ba147[_0x15d0('0x6')],'exten':_0x5ba147['exten'],'priority':_0xb4be9b[_0x15d0('0x38')][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});}else{if(_0xb4be9b[_0x15d0('0x1b')]('answer')){if([_0x15d0('0x3d'),_0x15d0('0x3e')][_0x15d0('0x3f')](_0xb4be9b[_0x15d0('0x40')][_0x15d0('0x35')]())&&_0xb4be9b['appType']!==_0x15d0('0x41')){if(_0xb4be9b['answer']){_0x32de8d['push']({'type':_0xb4be9b[_0x15d0('0x3')][_0x15d0('0x35')](),'app':_0x15d0('0x17'),'appdata':_0x15d0('0x42'),'context':_0x5ba147['context'],'exten':_0x5ba147['exten'],'priority':_0xb4be9b[_0x15d0('0x38')][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});_0x32de8d[_0x15d0('0xc')]({'type':_0xb4be9b[_0x15d0('0x3')][_0x15d0('0x35')](),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x43'),'context':_0x5ba147[_0x15d0('0x6')],'exten':_0x5ba147['exten'],'priority':_0xb4be9b['intervals'][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});}else{_0x32de8d['push']({'type':_0xb4be9b[_0x15d0('0x3')]['toLowerCase'](),'app':_0x15d0('0x17'),'appdata':_0x15d0('0x44'),'context':_0x5ba147[_0x15d0('0x6')],'exten':_0x5ba147[_0x15d0('0x7')],'priority':_0xb4be9b[_0x15d0('0x38')][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});_0x32de8d['push']({'type':_0xb4be9b[_0x15d0('0x3')]['toLowerCase'](),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x45'),'context':_0x5ba147[_0x15d0('0x6')],'exten':_0x5ba147[_0x15d0('0x7')],'priority':_0xb4be9b['intervals'][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});}}}}for(var _0x2eb7be=0x0;_0x2eb7be<_0xb4be9b['intervals'][_0x15d0('0x24')];_0x2eb7be++){var _0x507584=_0x21c3bf+_0xb4be9b[_0x15d0('0x38')][_0x15d0('0x24')];var _0x5868bf=_0x2eb7be===_0xb4be9b['intervals'][_0x15d0('0x24')]-0x1?_0x21c3bf+_0x32de8d[_0x15d0('0x24')]+_0x1b38e7[_0x15d0('0x24')]+0x2:_0x21c3bf+_0x2eb7be+0x1;_0x32de8d[_0x15d0('0x46')](_0x2eb7be,0x0,{'type':_0x5ba147[_0x15d0('0x3')],'app':_0x15d0('0x47'),'appdata':_0xb4be9b[_0x15d0('0x38')][_0x2eb7be]+'?'+_0x5ba147[_0x15d0('0x6')]+',${EXTEN},'+_0x507584+':'+_0x5ba147['context']+_0x15d0('0x48')+_0x5868bf,'exten':_0x5ba147[_0x15d0('0x7')],'context':_0x5ba147[_0x15d0('0x6')],'priority':_0x21c3bf+_0x2eb7be,'VoiceExtensionId':_0x5ba147['id']});}if(_0xb4be9b[_0x15d0('0x49')]===_0x15d0('0x4a'))_0xb4be9b['appdata']=_0x496c80(_0x5ba147,_0xb4be9b[_0x15d0('0x4b')]);_0xb4be9b[_0x15d0('0x4c')]=_0x32de8d[_0x15d0('0x24')]?_[_0x15d0('0x4d')](_0x32de8d)[_0x15d0('0x4c')]+0x1:_0x21c3bf;_0x25eedb=_[_0x15d0('0x4e')](_0x25eedb,_0x32de8d,[_0xb4be9b],_0x1b38e7);_0x21c3bf=_[_0x15d0('0x4d')](_0x25eedb)[_0x15d0('0x4c')]+0x1;}return _0x230bb2(_0x25eedb);})[_0x15d0('0x4f')](function(_0x5b6be7){_0x1f1b3c(_0x5b6be7);});});}return _0x451b82[_0x15d0('0x50')](_0x15d0('0x51'),attributes,{'tableName':_0x15d0('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1415d1){var _0x425511=this[_0x15d0('0x53')]({'plain':!![]});var _0x55f4b9=_0x425511[_0x15d0('0x3')]===_0x15d0('0x11')?_0x50ae3a(_0x425511):_0x665632(_0x425511);return _0x622830(_0x425511,_0x1415d1,_['last'](_0x55f4b9)['priority']+0x1)[_0x15d0('0x30')](function(_0x506701){var _0x23bb40=_['concat'](_0x55f4b9,_0x506701);_0x23bb40[_0x15d0('0xc')]({'type':_0x425511[_0x15d0('0x3')],'app':_0x15d0('0x54'),'exten':_0x425511['exten'],'context':_0x425511[_0x15d0('0x6')],'priority':_['last'](_0x23bb40)[_0x15d0('0x4c')]+0x1,'VoiceExtensionId':_0x425511['id']});return _0x23bb40;});}}});}; \ No newline at end of file +var _0x35f9=['splice',',${EXTEN},','outboundDial','appdata','priority','concat','last','catch','define','VoiceExtension','get','lodash','./voiceExtension.attributes','exports','models','CDR(type)=','type','context','exten','alias','Set','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','param','phone','prefix','SIP','U(xcally-mixmonitor-context)','replace','join','isEmpty','findAll','IntervalId','then','length','*,*,*,*','interval','intervals','map','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','includes','app','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress'];(function(_0x498545,_0x343c3d){var _0x3c6c59=function(_0x18c8d8){while(--_0x18c8d8){_0x498545['push'](_0x498545['shift']());}};_0x3c6c59(++_0x343c3d);}(_0x35f9,0x1df));var _0x935f=function(_0x1f75b6,_0x2f9b8c){_0x1f75b6=_0x1f75b6-0x0;var _0x20eeaf=_0x35f9[_0x1f75b6];return _0x20eeaf;};'use strict';var _=require(_0x935f('0x0'));var attributes=require(_0x935f('0x1'));module[_0x935f('0x2')]=function(_0x31a463){var _0x52e0b6=_0x31a463[_0x935f('0x3')];function _0x59b118(_0x53888b){var _0x3644e9=0x2;var _0x3f56c1=[{'type':_0x53888b['type'],'app':'Set','appdata':_0x935f('0x4')+_0x53888b[_0x935f('0x5')],'context':_0x53888b[_0x935f('0x6')],'exten':_0x53888b[_0x935f('0x7')],'priority':_0x3644e9++,'VoiceExtensionId':_0x53888b['id']},{'type':_0x53888b[_0x935f('0x5')],'app':_0x53888b[_0x935f('0x8')]?_0x935f('0x9'):'NoOp','appdata':_0x53888b[_0x935f('0x8')]?_0x935f('0xa')+_0x53888b[_0x935f('0x8')]:_0x935f('0xb'),'context':_0x53888b[_0x935f('0x6')],'exten':_0x53888b[_0x935f('0x7')],'priority':_0x3644e9++,'VoiceExtensionId':_0x53888b['id']}];if(_0x53888b[_0x935f('0x5')]===_0x935f('0xc')){_0x3f56c1[_0x935f('0xd')]({'type':'inbound','app':'Set','appdata':_0x935f('0xe')+_0x53888b['id'],'context':_0x53888b[_0x935f('0x6')],'exten':_0x53888b[_0x935f('0x7')],'priority':_0x3644e9++,'VoiceExtensionId':_0x53888b['id']});}_0x3f56c1['push']({'type':_0x53888b['type'],'app':_0x935f('0x9'),'appdata':_0x935f('0xf'),'context':_0x53888b['context'],'exten':_0x53888b['exten'],'priority':_0x3644e9++,'VoiceExtensionId':_0x53888b['id']},{'type':_0x53888b[_0x935f('0x5')],'app':'Set','appdata':_0x935f('0x10'),'context':_0x53888b[_0x935f('0x6')],'exten':_0x53888b[_0x935f('0x7')],'priority':_0x3644e9++,'VoiceExtensionId':_0x53888b['id']},{'type':_0x53888b[_0x935f('0x5')],'app':_0x935f('0x9'),'appdata':_0x935f('0x11'),'context':_0x53888b[_0x935f('0x6')],'exten':_0x53888b[_0x935f('0x7')],'priority':_0x3644e9++,'VoiceExtensionId':_0x53888b['id']});return _0x3f56c1;}function _0x5aa971(_0x1b24da){var _0x1fb8f6=0x2;var _0x57970e=[{'type':_0x935f('0x12'),'app':_0x935f('0x9'),'appdata':_0x935f('0x13'),'context':_0x1b24da['context'],'exten':_0x1b24da[_0x935f('0x7')],'priority':_0x1fb8f6++,'VoiceExtensionId':_0x1b24da['id']},{'type':_0x935f('0x12'),'app':_0x1b24da['alias']?_0x935f('0x9'):_0x935f('0x14'),'appdata':_0x1b24da[_0x935f('0x8')]?'CDR(routeAlias)='+_0x1b24da['alias']:'No\x20alias\x20set','context':_0x1b24da[_0x935f('0x6')],'exten':_0x1b24da['exten'],'priority':_0x1fb8f6++,'VoiceExtensionId':_0x1b24da['id']},{'type':_0x935f('0x12'),'app':_0x935f('0x9'),'appdata':_0x935f('0x15')+(_0x1b24da[_0x935f('0x16')]?_0x935f('0x17')+_0x1b24da[_0x935f('0x16')]+'}':_0x935f('0x18')),'context':_0x1b24da[_0x935f('0x6')],'exten':_0x1b24da[_0x935f('0x7')],'priority':_0x1fb8f6++,'VoiceExtensionId':_0x1b24da['id']},{'type':_0x935f('0x12'),'app':_0x935f('0x9'),'appdata':_0x935f('0xe')+_0x1b24da['id'],'context':_0x1b24da[_0x935f('0x6')],'exten':_0x1b24da[_0x935f('0x7')],'priority':_0x1fb8f6++,'VoiceExtensionId':_0x1b24da['id']},{'type':_0x935f('0x12'),'app':_0x935f('0x19'),'appdata':_0x935f('0x1a')+(_0x1fb8f6+0x2)+_0x935f('0x1b')+(_0x1fb8f6+0x1)+')','context':_0x1b24da['context'],'exten':_0x1b24da[_0x935f('0x7')],'priority':_0x1fb8f6++,'VoiceExtensionId':_0x1b24da['id']},{'type':_0x935f('0x12'),'app':_0x935f('0x9'),'appdata':_0x1b24da[_0x935f('0x16')]?_0x935f('0x1c')+_0x1b24da[_0x935f('0x16')]+'}':_0x935f('0x1d'),'context':_0x1b24da['context'],'exten':_0x1b24da[_0x935f('0x7')],'priority':_0x1fb8f6++,'VoiceExtensionId':_0x1b24da['id']},{'type':_0x935f('0x12'),'app':_0x935f('0x9'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1b24da[_0x935f('0x6')],'exten':_0x1b24da[_0x935f('0x7')],'priority':_0x1fb8f6++,'VoiceExtensionId':_0x1b24da['id']},{'type':_0x935f('0x12'),'app':_0x935f('0x9'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1b24da['context'],'exten':_0x1b24da['exten'],'priority':_0x1fb8f6++,'VoiceExtensionId':_0x1b24da['id']},{'type':_0x935f('0x12'),'app':_0x935f('0x9'),'appdata':_0x935f('0x11'),'context':_0x1b24da[_0x935f('0x6')],'exten':_0x1b24da['exten'],'priority':_0x1fb8f6++,'VoiceExtensionId':_0x1b24da['id']},{'type':_0x935f('0x12'),'app':_0x935f('0x9'),'appdata':'outboundrouteid='+_0x1b24da['id'],'context':_0x1b24da[_0x935f('0x6')],'exten':_0x1b24da[_0x935f('0x7')],'priority':_0x1fb8f6++,'VoiceExtensionId':_0x1b24da['id']}];if(_0x1b24da['hasOwnProperty'](_0x935f('0x1e'))&&_0x1b24da[_0x935f('0x1e')]!==_0x935f('0x1f')){_0x57970e['push']({'type':_0x935f('0x12'),'app':_0x935f('0x9'),'appdata':_0x935f('0x20'),'context':_0x1b24da[_0x935f('0x6')],'exten':_0x1b24da[_0x935f('0x7')],'priority':_0x1fb8f6++,'VoiceExtensionId':_0x1b24da['id']},{'type':'outbound','app':_0x935f('0x9'),'appdata':_0x935f('0x21')+_0x1b24da['recordingFormat']||'wav','context':_0x1b24da[_0x935f('0x6')],'exten':_0x1b24da[_0x935f('0x7')],'priority':_0x1fb8f6++,'VoiceExtensionId':_0x1b24da['id']});}return _0x57970e;}function _0x21cffd(_0x470796,_0x4e2ada){var _0x5366b9=[{'name':_0x935f('0x22'),'param':0x0},{'name':_0x935f('0x23'),'param':0x1},{'name':_0x935f('0x24'),'param':0x2},{'name':_0x935f('0x25'),'param':0x3}];var _0x3026b0={};var _0x1d798d=_0x4e2ada[_0x935f('0x26')](',');var _0x3f73a6=[];for(var _0x8ee2ef=0x0;_0x8ee2ef<_0x5366b9['length'];_0x8ee2ef++){switch(_0x5366b9[_0x8ee2ef]['name']){case _0x935f('0x22'):_0x3026b0[_0x935f('0x22')]=_0x1d798d[_0x5366b9[_0x8ee2ef][_0x935f('0x27')]][_0x935f('0x26')]('/')[0x1];_0x3026b0[_0x935f('0x28')]=_0x1d798d[_0x5366b9[_0x8ee2ef][_0x935f('0x27')]]['split']('/')[0x2];_0x3026b0[_0x935f('0x29')]=_0x3026b0['phone']?_0x3026b0[_0x935f('0x28')][_0x935f('0x26')]('$')[0x0]:undefined;_0x3026b0[_0x935f('0x28')]=_0x470796['cutdigits']?(_0x3026b0[_0x935f('0x29')]||'')+_0x935f('0x17')+_0x470796['cutdigits']+'}':(_0x3026b0['prefix']||'')+_0x935f('0x18');_0x3f73a6[_0x5366b9[_0x8ee2ef]['param']]=[_0x935f('0x2a'),_0x3026b0['trunk'],_0x3026b0[_0x935f('0x28')]]['join']('/');break;case _0x935f('0x24'):_0x3026b0[_0x935f('0x24')]=_0x1d798d[_0x5366b9[_0x8ee2ef][_0x935f('0x27')]];if(_0x470796['recordingFormat']!==_0x935f('0x1f')){if(_0x3026b0[_0x935f('0x24')]['indexOf'](_0x935f('0x2b'))<0x0){_0x3026b0[_0x935f('0x24')]+=_0x935f('0x2b');}}else{_0x3026b0['options']=_0x3026b0[_0x935f('0x24')][_0x935f('0x2c')]('U(xcally-mixmonitor-context)','');}_0x3f73a6[_0x5366b9[_0x8ee2ef][_0x935f('0x27')]]=_0x3026b0[_0x935f('0x24')];break;default:_0x3f73a6[_0x5366b9[_0x8ee2ef][_0x935f('0x27')]]=_0x1d798d[_0x5366b9[_0x8ee2ef][_0x935f('0x27')]];}}return _0x3f73a6[_0x935f('0x2d')](',');}function _0x80c62(_0x16fa0e,_0x6584d5,_0x5d2e05){return new Promise(function(_0x4b332f,_0x27fc1a){var _0x332d69=[];if(_[_0x935f('0x2e')](_0x6584d5))return _0x4b332f(_0x332d69);_0x52e0b6['Interval'][_0x935f('0x2f')]({'attributes':['id','interval',_0x935f('0x30')],'raw':!![]})[_0x935f('0x31')](function(_0xb753c2){for(var _0x22a9f=0x0,_0x2cd089=0x0;_0x22a9f<_0x6584d5[_0x935f('0x32')];_0x22a9f++,_0x2cd089=0x0){var _0x3bdafb=_0x6584d5[_0x22a9f];var _0x386948=[];var _0x496b56=[];delete _0x3bdafb['id'];if(_0x3bdafb['interval']!==_0x935f('0x33')){_0x3bdafb['intervals']=[_0x3bdafb[_0x935f('0x34')]];}else{_0x3bdafb[_0x935f('0x35')]=_0x3bdafb[_0x935f('0x30')]?_[_0x935f('0x36')](_['filter'](_0xb753c2,{'IntervalId':_0x3bdafb[_0x935f('0x30')]}),_0x935f('0x34')):[];}_0x3bdafb['context']=_0x16fa0e[_0x935f('0x6')];_0x3bdafb[_0x935f('0x7')]=_0x16fa0e[_0x935f('0x7')];if(_0x3bdafb['type'])_0x3bdafb[_0x935f('0x5')]=_0x3bdafb[_0x935f('0x5')]['toLowerCase']();if(_0x16fa0e[_0x935f('0x5')]===_0x935f('0x12')){if(_0x3bdafb['hasOwnProperty'](_0x935f('0x37'))&&_0x3bdafb[_0x935f('0x37')]&&_0x3bdafb[_0x935f('0x37')]!=='--'){_0x386948[_0x935f('0xd')]({'type':_0x3bdafb[_0x935f('0x5')][_0x935f('0x38')](),'app':_0x935f('0x9'),'appdata':_0x935f('0x39')+_0x3bdafb['tag'],'context':_0x16fa0e[_0x935f('0x6')],'exten':_0x16fa0e['exten'],'priority':_0x3bdafb[_0x935f('0x35')][_0x935f('0x32')]+_0x5d2e05+_0x2cd089++,'VoiceExtensionId':_0x16fa0e['id']});}_0x386948[_0x935f('0xd')]({'type':_0x3bdafb[_0x935f('0x5')]['toLowerCase'](),'app':_0x935f('0x19'),'appdata':_0x935f('0x3a')+(_0x3bdafb['callerID']?'Set(CALLERID(all)='+_0x3bdafb[_0x935f('0x3b')]+')':_0x935f('0x3c')),'context':_0x16fa0e[_0x935f('0x6')],'exten':_0x16fa0e[_0x935f('0x7')],'priority':_0x3bdafb[_0x935f('0x35')][_0x935f('0x32')]+_0x5d2e05+_0x2cd089++,'VoiceExtensionId':_0x16fa0e['id']});}else{if(_0x3bdafb['hasOwnProperty'](_0x935f('0x3d'))){if(['queue','playback'][_0x935f('0x3e')](_0x3bdafb[_0x935f('0x3f')][_0x935f('0x38')]())&&_0x3bdafb[_0x935f('0x40')]!=='custom'){if(_0x3bdafb[_0x935f('0x3d')]){_0x386948['push']({'type':_0x3bdafb[_0x935f('0x5')][_0x935f('0x38')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x16fa0e[_0x935f('0x6')],'exten':_0x16fa0e[_0x935f('0x7')],'priority':_0x3bdafb['intervals'][_0x935f('0x32')]+_0x5d2e05+_0x2cd089++,'VoiceExtensionId':_0x16fa0e['id']});_0x386948[_0x935f('0xd')]({'type':_0x3bdafb[_0x935f('0x5')]['toLowerCase'](),'app':_0x935f('0x9'),'appdata':_0x935f('0x41'),'context':_0x16fa0e['context'],'exten':_0x16fa0e[_0x935f('0x7')],'priority':_0x3bdafb[_0x935f('0x35')][_0x935f('0x32')]+_0x5d2e05+_0x2cd089++,'VoiceExtensionId':_0x16fa0e['id']});}else{_0x386948[_0x935f('0xd')]({'type':_0x3bdafb[_0x935f('0x5')][_0x935f('0x38')](),'app':_0x935f('0x19'),'appdata':_0x935f('0x42'),'context':_0x16fa0e['context'],'exten':_0x16fa0e['exten'],'priority':_0x3bdafb[_0x935f('0x35')][_0x935f('0x32')]+_0x5d2e05+_0x2cd089++,'VoiceExtensionId':_0x16fa0e['id']});_0x386948[_0x935f('0xd')]({'type':_0x3bdafb['type'][_0x935f('0x38')](),'app':_0x935f('0x9'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x16fa0e[_0x935f('0x6')],'exten':_0x16fa0e[_0x935f('0x7')],'priority':_0x3bdafb[_0x935f('0x35')][_0x935f('0x32')]+_0x5d2e05+_0x2cd089++,'VoiceExtensionId':_0x16fa0e['id']});}}}}for(var _0x38e9c1=0x0;_0x38e9c1<_0x3bdafb['intervals'][_0x935f('0x32')];_0x38e9c1++){var _0x5b294d=_0x5d2e05+_0x3bdafb[_0x935f('0x35')][_0x935f('0x32')];var _0x4aa0c2=_0x38e9c1===_0x3bdafb['intervals']['length']-0x1?_0x5d2e05+_0x386948[_0x935f('0x32')]+_0x496b56[_0x935f('0x32')]+0x2:_0x5d2e05+_0x38e9c1+0x1;_0x386948[_0x935f('0x43')](_0x38e9c1,0x0,{'type':_0x16fa0e[_0x935f('0x5')],'app':'GotoIfTime','appdata':_0x3bdafb[_0x935f('0x35')][_0x38e9c1]+'?'+_0x16fa0e[_0x935f('0x6')]+_0x935f('0x44')+_0x5b294d+':'+_0x16fa0e[_0x935f('0x6')]+_0x935f('0x44')+_0x4aa0c2,'exten':_0x16fa0e[_0x935f('0x7')],'context':_0x16fa0e[_0x935f('0x6')],'priority':_0x5d2e05+_0x38e9c1,'VoiceExtensionId':_0x16fa0e['id']});}if(_0x3bdafb[_0x935f('0x40')]===_0x935f('0x45'))_0x3bdafb[_0x935f('0x46')]=_0x21cffd(_0x16fa0e,_0x3bdafb[_0x935f('0x46')]);_0x3bdafb[_0x935f('0x47')]=_0x386948[_0x935f('0x32')]?_['last'](_0x386948)[_0x935f('0x47')]+0x1:_0x5d2e05;_0x332d69=_[_0x935f('0x48')](_0x332d69,_0x386948,[_0x3bdafb],_0x496b56);_0x5d2e05=_[_0x935f('0x49')](_0x332d69)[_0x935f('0x47')]+0x1;}return _0x4b332f(_0x332d69);})[_0x935f('0x4a')](function(_0x9fae2e){_0x27fc1a(_0x9fae2e);});});}return _0x31a463[_0x935f('0x4b')](_0x935f('0x4c'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x333e4f){var _0x66e83=this[_0x935f('0x4d')]({'plain':!![]});var _0x2ecde4=_0x66e83[_0x935f('0x5')]===_0x935f('0x12')?_0x5aa971(_0x66e83):_0x59b118(_0x66e83);return _0x80c62(_0x66e83,_0x333e4f,_['last'](_0x2ecde4)[_0x935f('0x47')]+0x1)['then'](function(_0x446fd1){var _0x315fa2=_['concat'](_0x2ecde4,_0x446fd1);_0x315fa2['push']({'type':_0x66e83[_0x935f('0x5')],'app':'Hangup','exten':_0x66e83['exten'],'context':_0x66e83['context'],'priority':_[_0x935f('0x49')](_0x315fa2)[_0x935f('0x47')]+0x1,'VoiceExtensionId':_0x66e83['id']});return _0x315fa2;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index f1af629..1ee99b9 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 _0x9829=['raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceExtension','VoiceExtension','findAll','options'];(function(_0x45f0a9,_0x31dfb3){var _0x148a1c=function(_0x42583b){while(--_0x42583b){_0x45f0a9['push'](_0x45f0a9['shift']());}};_0x148a1c(++_0x31dfb3);}(_0x9829,0xc4));var _0x9982=function(_0x53c256,_0x382a24){_0x53c256=_0x53c256-0x0;var _0x25feb6=_0x9829[_0x53c256];return _0x25feb6;};'use strict';var _=require(_0x9982('0x0'));var util=require(_0x9982('0x1'));var moment=require(_0x9982('0x2'));var BPromise=require(_0x9982('0x3'));var rs=require(_0x9982('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9982('0x5'))['db'];var utils=require(_0x9982('0x6'));var logger=require(_0x9982('0x7'))('rpc');var config=require(_0x9982('0x8'));var jayson=require(_0x9982('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x9982('0xa')]=_[_0x9982('0xb')](config['redis'],{'host':_0x9982('0xc'),'port':0x18eb});var socket=require(_0x9982('0xd'))(new Redis(config[_0x9982('0xa')]));require(_0x9982('0xe'))[_0x9982('0xf')](socket);function respondWithRpcPromise(_0x2bf685,_0x443b6a,_0x4047be){return new BPromise(function(_0x1e18e9,_0x88fce0){return client[_0x9982('0x10')](_0x2bf685,_0x4047be)[_0x9982('0x11')](function(_0x6eb13c){logger[_0x9982('0x12')](_0x9982('0x13'),_0x443b6a,_0x9982('0x14'));logger[_0x9982('0x15')](_0x9982('0x16'),_0x443b6a,'request\x20sent',JSON[_0x9982('0x17')](_0x6eb13c));if(_0x6eb13c[_0x9982('0x18')]){if(_0x6eb13c['error'][_0x9982('0x19')]===0x1f4){logger['error'](_0x9982('0x13'),_0x443b6a,_0x6eb13c[_0x9982('0x18')][_0x9982('0x1a')]);return _0x88fce0(_0x6eb13c[_0x9982('0x18')][_0x9982('0x1a')]);}logger[_0x9982('0x18')](_0x9982('0x13'),_0x443b6a,_0x6eb13c[_0x9982('0x18')][_0x9982('0x1a')]);return _0x1e18e9(_0x6eb13c['error'][_0x9982('0x1a')]);}else{logger['info'](_0x9982('0x13'),_0x443b6a,_0x9982('0x14'));_0x1e18e9(_0x6eb13c['result'][_0x9982('0x1a')]);}})[_0x9982('0x1b')](function(_0x2fb603){logger[_0x9982('0x18')](_0x9982('0x13'),_0x443b6a,_0x2fb603);_0x88fce0(_0x2fb603);});});}exports[_0x9982('0x1c')]=function(_0x4e1066){var _0x243bd8=this;return new Promise(function(_0x3802d4,_0x5ea55d){return db[_0x9982('0x1d')][_0x9982('0x1e')]({'raw':_0x4e1066[_0x9982('0x1f')]?_0x4e1066[_0x9982('0x1f')][_0x9982('0x20')]===undefined?!![]:![]:!![],'where':_0x4e1066[_0x9982('0x1f')]?_0x4e1066[_0x9982('0x1f')][_0x9982('0x21')]||null:null,'attributes':_0x4e1066[_0x9982('0x1f')]?_0x4e1066[_0x9982('0x1f')][_0x9982('0x22')]||null:null,'limit':_0x4e1066[_0x9982('0x1f')]?_0x4e1066[_0x9982('0x1f')]['limit']||null:null,'include':_0x4e1066[_0x9982('0x1f')]?_0x4e1066[_0x9982('0x1f')][_0x9982('0x23')]?_[_0x9982('0x24')](_0x4e1066[_0x9982('0x1f')][_0x9982('0x23')],function(_0x3c129a){return{'model':db[_0x3c129a[_0x9982('0x25')]],'as':_0x3c129a['as'],'attributes':_0x3c129a[_0x9982('0x22')],'include':_0x3c129a[_0x9982('0x23')]?_[_0x9982('0x24')](_0x3c129a[_0x9982('0x23')],function(_0x1eab54){return{'model':db[_0x1eab54[_0x9982('0x25')]],'as':_0x1eab54['as'],'attributes':_0x1eab54[_0x9982('0x22')],'include':_0x1eab54[_0x9982('0x23')]?_[_0x9982('0x24')](_0x1eab54[_0x9982('0x23')],function(_0x50d976){return{'model':db[_0x50d976['model']],'as':_0x50d976['as'],'attributes':_0x50d976[_0x9982('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9982('0x11')](function(_0x4544b5){logger[_0x9982('0x12')](_0x9982('0x1c'),_0x4e1066);logger[_0x9982('0x15')](_0x9982('0x1c'),_0x4e1066,JSON[_0x9982('0x17')](_0x4544b5));_0x3802d4(_0x4544b5);})[_0x9982('0x1b')](function(_0x26a999){logger[_0x9982('0x18')](_0x9982('0x1c'),_0x26a999['message'],_0x4e1066);_0x5ea55d(_0x243bd8[_0x9982('0x18')](0x1f4,_0x26a999[_0x9982('0x1a')]));});});}; \ No newline at end of file +var _0x4672=['catch','options','where','attributes','limit','map','model','include','GetVoiceExtension','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xcf581b,_0x4359dd){var _0x4f454d=function(_0x182d58){while(--_0x182d58){_0xcf581b['push'](_0xcf581b['shift']());}};_0x4f454d(++_0x4359dd);}(_0x4672,0x18a));var _0x2467=function(_0x42594f,_0x4612de){_0x42594f=_0x42594f-0x0;var _0x4ca5fa=_0x4672[_0x42594f];return _0x4ca5fa;};'use strict';var _=require(_0x2467('0x0'));var util=require('util');var moment=require(_0x2467('0x1'));var BPromise=require(_0x2467('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2467('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2467('0x4'));var logger=require(_0x2467('0x5'))(_0x2467('0x6'));var config=require(_0x2467('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2467('0x8')]['http']({'port':0x232a});config[_0x2467('0x9')]=_[_0x2467('0xa')](config[_0x2467('0x9')],{'host':_0x2467('0xb'),'port':0x18eb});var socket=require(_0x2467('0xc'))(new Redis(config[_0x2467('0x9')]));require(_0x2467('0xd'))[_0x2467('0xe')](socket);function respondWithRpcPromise(_0x1a5af4,_0x53b91d,_0x323203){return new BPromise(function(_0x1b1c63,_0xb5c09d){return client[_0x2467('0xf')](_0x1a5af4,_0x323203)['then'](function(_0x2cf4cb){logger[_0x2467('0x10')](_0x2467('0x11'),_0x53b91d,_0x2467('0x12'));logger[_0x2467('0x13')](_0x2467('0x14'),_0x53b91d,'request\x20sent',JSON[_0x2467('0x15')](_0x2cf4cb));if(_0x2cf4cb[_0x2467('0x16')]){if(_0x2cf4cb[_0x2467('0x16')][_0x2467('0x17')]===0x1f4){logger[_0x2467('0x16')](_0x2467('0x11'),_0x53b91d,_0x2cf4cb[_0x2467('0x16')]['message']);return _0xb5c09d(_0x2cf4cb['error']['message']);}logger[_0x2467('0x16')](_0x2467('0x11'),_0x53b91d,_0x2cf4cb[_0x2467('0x16')]['message']);return _0x1b1c63(_0x2cf4cb[_0x2467('0x16')][_0x2467('0x18')]);}else{logger['info'](_0x2467('0x11'),_0x53b91d,_0x2467('0x12'));_0x1b1c63(_0x2cf4cb[_0x2467('0x19')][_0x2467('0x18')]);}})[_0x2467('0x1a')](function(_0x1beb02){logger[_0x2467('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x53b91d,_0x1beb02);_0xb5c09d(_0x1beb02);});});}exports['GetVoiceExtension']=function(_0x3f32a8){var _0x4ba37e=this;return new Promise(function(_0x285423,_0xa16c1a){return db['VoiceExtension']['findAll']({'raw':_0x3f32a8[_0x2467('0x1b')]?_0x3f32a8[_0x2467('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3f32a8[_0x2467('0x1b')]?_0x3f32a8[_0x2467('0x1b')][_0x2467('0x1c')]||null:null,'attributes':_0x3f32a8[_0x2467('0x1b')]?_0x3f32a8['options'][_0x2467('0x1d')]||null:null,'limit':_0x3f32a8['options']?_0x3f32a8['options'][_0x2467('0x1e')]||null:null,'include':_0x3f32a8['options']?_0x3f32a8['options']['include']?_[_0x2467('0x1f')](_0x3f32a8[_0x2467('0x1b')]['include'],function(_0xb8f34f){return{'model':db[_0xb8f34f[_0x2467('0x20')]],'as':_0xb8f34f['as'],'attributes':_0xb8f34f[_0x2467('0x1d')],'include':_0xb8f34f[_0x2467('0x21')]?_[_0x2467('0x1f')](_0xb8f34f[_0x2467('0x21')],function(_0x4aeb8b){return{'model':db[_0x4aeb8b[_0x2467('0x20')]],'as':_0x4aeb8b['as'],'attributes':_0x4aeb8b[_0x2467('0x1d')],'include':_0x4aeb8b[_0x2467('0x21')]?_[_0x2467('0x1f')](_0x4aeb8b[_0x2467('0x21')],function(_0x327954){return{'model':db[_0x327954[_0x2467('0x20')]],'as':_0x327954['as'],'attributes':_0x327954[_0x2467('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa793b2){logger[_0x2467('0x10')](_0x2467('0x22'),_0x3f32a8);logger[_0x2467('0x13')](_0x2467('0x22'),_0x3f32a8,JSON[_0x2467('0x15')](_0xa793b2));_0x285423(_0xa793b2);})[_0x2467('0x1a')](function(_0x4d7632){logger[_0x2467('0x16')]('GetVoiceExtension',_0x4d7632['message'],_0x3f32a8);_0xa16c1a(_0x4ba37e[_0x2467('0x16')](0x1f4,_0x4d7632['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index d91e136..3f8d218 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 _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x5ebfb6,_0x3ffbc2){var _0x4a5198=function(_0x18d837){while(--_0x18d837){_0x5ebfb6['push'](_0x5ebfb6['shift']());}};_0x4a5198(++_0x3ffbc2);}(_0x1261,0x144));var _0x1126=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x1261[_0x2d486b];return _0x4291d1;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file +var _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x2862e3,_0x33d322){var _0x4cdcc2=function(_0xc5aec4){while(--_0xc5aec4){_0x2862e3['push'](_0x2862e3['shift']());}};_0x4cdcc2(++_0x33d322);}(_0x53ec,0x192));var _0xc53e=function(_0x2ecea0,_0x36a83d){_0x2ecea0=_0x2ecea0-0x0;var _0x17ab22=_0x53ec[_0x2ecea0];return _0x17ab22;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 2633182..a83fe47 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 _0x6a55=['isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy','exports','multer','express','../../components/auth/service','../../config/environment','get'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0x6a55,0xdb));var _0x56a5=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0x6a55[_0x3b6652];return _0x14d39f;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x56a5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x56a5('0x3'));var controller=require('./voiceMail.controller');router[_0x56a5('0x4')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x6')]);router[_0x56a5('0x4')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x4')]('/:id/messages',auth[_0x56a5('0x5')](),controller[_0x56a5('0x9')]);router[_0x56a5('0xa')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0xb')]);router[_0x56a5('0xc')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xd')]);router['delete']('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0xe')]);module[_0x56a5('0xf')]=router; \ No newline at end of file +var _0x323f=['show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id'];(function(_0x2c947c,_0x2c2e1e){var _0x139bfd=function(_0x228480){while(--_0x228480){_0x2c947c['push'](_0x2c947c['shift']());}};_0x139bfd(++_0x2c2e1e);}(_0x323f,0x1ee));var _0xf323=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x323f[_0x42245d];return _0x4b211a;};'use strict';var multer=require('multer');var util=require(_0xf323('0x0'));var path=require('path');var timeout=require(_0xf323('0x1'));var express=require(_0xf323('0x2'));var router=express[_0xf323('0x3')]();var fs_extra=require(_0xf323('0x4'));var auth=require(_0xf323('0x5'));var interaction=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var controller=require(_0xf323('0x8'));router[_0xf323('0x9')]('/',auth[_0xf323('0xa')](),controller['index']);router[_0xf323('0x9')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0xc')]);router[_0xf323('0x9')](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0xe')]);router[_0xf323('0xf')]('/',auth[_0xf323('0xa')](),controller[_0xf323('0x10')]);router[_0xf323('0x11')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0x12')]);router[_0xf323('0x13')](_0xf323('0xb'),auth['isAuthenticated'](),controller[_0xf323('0x14')]);module[_0xf323('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 831fdd5..d590b0b 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 _0x11d3=['getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','string','central','ENUM','yes','INTEGER','VIRTUAL'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x11d3,0x146));var _0x311d=function(_0x43cf8c,_0x28bf58){_0x43cf8c=_0x43cf8c-0x0;var _0x5482bf=_0x11d3[_0x43cf8c];return _0x5482bf;};'use strict';var Sequelize=require(_0x311d('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x311d('0x1')]},'context':{'type':Sequelize[_0x311d('0x1')],'defaultValue':_0x311d('0x2'),'unique':_0x311d('0x3')},'mailbox':{'type':Sequelize[_0x311d('0x1')],'defaultValue':'','allowNull':![],'unique':_0x311d('0x3')},'password':{'type':Sequelize[_0x311d('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x311d('0x1')],'validate':{'isEmail':!![]},'set':function(_0x870137){this['setDataValue']('email',typeof _0x870137===_0x311d('0x4')&&_0x870137['trim']()?_0x870137['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x311d('0x1')],'defaultValue':_0x311d('0x5')},'attach':{'type':Sequelize[_0x311d('0x6')]('yes','no'),'defaultValue':_0x311d('0x7'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x311d('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x311d('0x1')]},'callback':{'type':Sequelize[_0x311d('0x1')]},'review':{'type':Sequelize[_0x311d('0x6')](_0x311d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x311d('0x6')](_0x311d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x311d('0x6')](_0x311d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x311d('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x311d('0x6')](_0x311d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x311d('0x6')](_0x311d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x311d('0x6')](_0x311d('0x7'),'no'),'defaultValue':_0x311d('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x311d('0x6')](_0x311d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x311d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x311d('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x311d('0x1')]},'emailbody':{'type':Sequelize[_0x311d('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x311d('0x8')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x311d('0x9')],'get':function(){return this[_0x311d('0xa')](_0x311d('0xb'))+_0x311d('0xc')+this[_0x311d('0xa')](_0x311d('0xd'));}}}; \ No newline at end of file +var _0x3199=['contest_mailbox','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x3199,0x1d9));var _0x9319=function(_0x58fcb3,_0x58c2b6){_0x58fcb3=_0x58fcb3-0x0;var _0x20d1ae=_0x3199[_0x58fcb3];return _0x20d1ae;};'use strict';var Sequelize=require(_0x9319('0x0'));module[_0x9319('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x9319('0x2')],'defaultValue':'from-voicemail','unique':_0x9319('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x9319('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9319('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3fe8ef){this['setDataValue'](_0x9319('0x4'),typeof _0x3fe8ef==='string'&&_0x3fe8ef[_0x9319('0x5')]()?_0x3fe8ef[_0x9319('0x5')]():null);}},'pager':{'type':Sequelize[_0x9319('0x2')]},'tz':{'type':Sequelize[_0x9319('0x2')],'defaultValue':_0x9319('0x6')},'attach':{'type':Sequelize[_0x9319('0x7')](_0x9319('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x9319('0x7')](_0x9319('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x9319('0x2')]},'review':{'type':Sequelize[_0x9319('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x9319('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x9319('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x9319('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9319('0x7')](_0x9319('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x9319('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9319('0x7')]('yes','no'),'defaultValue':_0x9319('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x9319('0x7')](_0x9319('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9319('0x7')](_0x9319('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9319('0x7')](_0x9319('0x8'),'no'),'defaultValue':_0x9319('0x8'),'allowNull':![]},'stamp':{'type':_0x9319('0xa')},'emailsubject':{'type':Sequelize[_0x9319('0x2')]},'emailbody':{'type':Sequelize[_0x9319('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9319('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9319('0xc')],'get':function(){return this[_0x9319('0xd')](_0x9319('0xe'))+_0x9319('0xf')+this[_0x9319('0xd')](_0x9319('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index d4a359c..39eb40d 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 _0x13f6=['destroy','Voicemails','error','send','index','map','VoiceMail','rawAttributes','fieldName','type','model','name','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','get','UserProfileSection','userProfileId','UserProfileResource','getMessages','findOne','VoiceMailMessage','pick','findAndCountAll','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then'];(function(_0x540f60,_0x412f6f){var _0x1db0da=function(_0x5d3056){while(--_0x5d3056){_0x540f60['push'](_0x540f60['shift']());}};_0x1db0da(++_0x412f6f);}(_0x13f6,0x124));var _0x613f=function(_0x43be0c,_0x5219c2){_0x43be0c=_0x43be0c-0x0;var _0x559f3c=_0x13f6[_0x43be0c];return _0x559f3c;};'use strict';var emlformat=require(_0x613f('0x0'));var rimraf=require(_0x613f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x613f('0x2'));var moment=require(_0x613f('0x3'));var BPromise=require(_0x613f('0x4'));var Mustache=require('mustache');var util=require(_0x613f('0x5'));var path=require(_0x613f('0x6'));var sox=require(_0x613f('0x7'));var csv=require('to-csv');var ejs=require(_0x613f('0x8'));var fs=require('fs');var fs_extra=require(_0x613f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0xb'));var querystring=require(_0x613f('0xc'));var Papa=require(_0x613f('0xd'));var Redis=require('ioredis');var authService=require(_0x613f('0xe'));var qs=require(_0x613f('0xf'));var as=require(_0x613f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x11'))(_0x613f('0x12'));var utils=require(_0x613f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x14'));var db=require(_0x613f('0x15'))['db'];function respondWithStatusCode(_0x542230,_0x4c2a85){_0x4c2a85=_0x4c2a85||0xcc;return function(_0x517f57){if(_0x517f57){return _0x542230[_0x613f('0x16')](_0x4c2a85);}return _0x542230[_0x613f('0x17')](_0x4c2a85)[_0x613f('0x18')]();};}function respondWithResult(_0x375db1,_0x329fcf){_0x329fcf=_0x329fcf||0xc8;return function(_0x4a6fc){if(_0x4a6fc){return _0x375db1[_0x613f('0x17')](_0x329fcf)[_0x613f('0x19')](_0x4a6fc);}};}function respondWithFilteredResult(_0x2eee4d,_0x1d68fd){return function(_0x548218){if(_0x548218){var _0x3c9edf=typeof _0x1d68fd['offset']==='undefined'&&typeof _0x1d68fd[_0x613f('0x1a')]===_0x613f('0x1b');var _0x544eca=_0x548218[_0x613f('0x1c')];var _0x4f9dae=_0x3c9edf?0x0:_0x1d68fd[_0x613f('0x1d')];var _0x1e5a11=_0x3c9edf?_0x548218[_0x613f('0x1c')]:_0x1d68fd[_0x613f('0x1d')]+_0x1d68fd[_0x613f('0x1a')];var _0x1ba35f;if(_0x1e5a11>=_0x544eca){_0x1e5a11=_0x544eca;_0x1ba35f=0xc8;}else{_0x1ba35f=0xce;}_0x2eee4d['status'](_0x1ba35f);return _0x2eee4d['set'](_0x613f('0x1e'),_0x4f9dae+'-'+_0x1e5a11+'/'+_0x544eca)['json'](_0x548218);}return null;};}function patchUpdates(_0x48493c){return function(_0x3c9b58){try{jsonpatch[_0x613f('0x1f')](_0x3c9b58,_0x48493c,!![]);}catch(_0x4f5a5a){return BPromise[_0x613f('0x20')](_0x4f5a5a);}return _0x3c9b58[_0x613f('0x21')]();};}function saveUpdates(_0x2aa14b,_0x48b28a){return function(_0x5401c2){if(_0x5401c2){return _0x5401c2[_0x613f('0x22')](_0x2aa14b)[_0x613f('0x23')](function(_0x2acfcf){return _0x2acfcf;});}return null;};}function removeEntity(_0x51f376,_0x41104e){return function(_0x33e0c6){if(_0x33e0c6){return _0x33e0c6[_0x613f('0x24')]()[_0x613f('0x23')](function(){var _0x3013a1=_0x33e0c6['get']({'plain':!![]});var _0x30fb15=_0x613f('0x25');return db['UserProfileResource'][_0x613f('0x24')]({'where':{'type':_0x30fb15,'resourceId':_0x3013a1['id']}})[_0x613f('0x23')](function(){return _0x33e0c6;});})[_0x613f('0x23')](function(){_0x51f376['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4a8b,_0x379920){return function(_0x594c28){if(!_0x594c28){_0x5a4a8b[_0x613f('0x16')](0x194);}return _0x594c28;};}function handleError(_0x1767db,_0x4ca372){_0x4ca372=_0x4ca372||0x1f4;return function(_0x121241){logger[_0x613f('0x26')](_0x121241['stack']);if(_0x121241['name']){delete _0x121241['name'];}_0x1767db[_0x613f('0x17')](_0x4ca372)[_0x613f('0x27')](_0x121241);};}exports[_0x613f('0x28')]=function(_0x47f4af,_0x23eda8){var _0x439478={},_0xd335a6={},_0x19bb8f={'count':0x0,'rows':[]};var _0x4f8500=_[_0x613f('0x29')](db[_0x613f('0x2a')][_0x613f('0x2b')],function(_0x728f45){return{'name':_0x728f45[_0x613f('0x2c')],'type':_0x728f45[_0x613f('0x2d')]['key']};});_0xd335a6[_0x613f('0x2e')]=_[_0x613f('0x29')](_0x4f8500,_0x613f('0x2f'));_0xd335a6['query']=_[_0x613f('0x30')](_0x47f4af['query']);_0xd335a6[_0x613f('0x31')]=_[_0x613f('0x32')](_0xd335a6[_0x613f('0x2e')],_0xd335a6[_0x613f('0x33')]);_0x439478[_0x613f('0x34')]=_[_0x613f('0x32')](_0xd335a6['model'],qs[_0x613f('0x35')](_0x47f4af[_0x613f('0x33')][_0x613f('0x35')]));_0x439478[_0x613f('0x34')]=_0x439478[_0x613f('0x34')]['length']?_0x439478['attributes']:_0xd335a6['model'];if(!_0x47f4af[_0x613f('0x33')][_0x613f('0x36')](_0x613f('0x37'))){_0x439478[_0x613f('0x1a')]=qs['limit'](_0x47f4af[_0x613f('0x33')][_0x613f('0x1a')]);_0x439478['offset']=qs[_0x613f('0x1d')](_0x47f4af['query'][_0x613f('0x1d')]);}_0x439478['order']=qs[_0x613f('0x38')](_0x47f4af['query'][_0x613f('0x38')]);_0x439478[_0x613f('0x39')]=qs[_0x613f('0x31')](_['pick'](_0x47f4af[_0x613f('0x33')],_0xd335a6[_0x613f('0x31')]),_0x4f8500);if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]){_0x439478[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x439478[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x4f8500,function(_0x1f71f3){if(_0x1f71f3[_0x613f('0x2d')]!=='VIRTUAL'){var _0x28b1bc={};_0x28b1bc[_0x1f71f3[_0x613f('0x2f')]]={'$like':'%'+_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x28b1bc;}})});}_0x439478=_[_0x613f('0x3b')]({},_0x439478,_0x47f4af[_0x613f('0x3c')]);var _0xa76fff={'where':_0x439478['where']};return db[_0x613f('0x2a')][_0x613f('0x1c')](_0xa76fff)[_0x613f('0x23')](function(_0x3d2d7b){_0x19bb8f[_0x613f('0x1c')]=_0x3d2d7b;if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3d')]){_0x439478['include']=[{'all':!![]}];}return db[_0x613f('0x2a')][_0x613f('0x3e')](_0x439478);})[_0x613f('0x23')](function(_0x2f584e){_0x19bb8f[_0x613f('0x3f')]=_0x2f584e;return _0x19bb8f;})[_0x613f('0x23')](respondWithFilteredResult(_0x23eda8,_0x439478))[_0x613f('0x40')](handleError(_0x23eda8,null));};exports[_0x613f('0x41')]=function(_0x403feb,_0x2d2574){var _0x12647a={'raw':!![],'where':{'id':_0x403feb[_0x613f('0x42')]['id']}},_0x258a71={};_0x258a71['model']=_[_0x613f('0x30')](db[_0x613f('0x2a')][_0x613f('0x2b')]);_0x258a71[_0x613f('0x33')]=_['keys'](_0x403feb[_0x613f('0x33')]);_0x258a71[_0x613f('0x31')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],_0x258a71[_0x613f('0x33')]);_0x12647a[_0x613f('0x34')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],qs[_0x613f('0x35')](_0x403feb[_0x613f('0x33')]['fields']));_0x12647a['attributes']=_0x12647a[_0x613f('0x34')][_0x613f('0x43')]?_0x12647a['attributes']:_0x258a71[_0x613f('0x2e')];if(_0x403feb[_0x613f('0x33')][_0x613f('0x3d')]){_0x12647a[_0x613f('0x44')]=[{'all':!![]}];}_0x12647a=_[_0x613f('0x3b')]({},_0x12647a,_0x403feb[_0x613f('0x3c')]);return db[_0x613f('0x2a')][_0x613f('0x45')](_0x12647a)[_0x613f('0x23')](handleEntityNotFound(_0x2d2574,null))[_0x613f('0x23')](respondWithResult(_0x2d2574,null))[_0x613f('0x40')](handleError(_0x2d2574,null));};exports[_0x613f('0x46')]=function(_0x174e22,_0x17f8e5){return db[_0x613f('0x2a')][_0x613f('0x46')](_0x174e22[_0x613f('0x47')],{})[_0x613f('0x23')](function(_0x5a4079){var _0x47c84b=_0x174e22[_0x613f('0x48')][_0x613f('0x49')]({'plain':!![]});if(!_0x47c84b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47c84b['role']===_0x613f('0x48')){var _0x51729a=_0x5a4079['get']({'plain':!![]});var _0x6e006b=_0x613f('0x25');return db[_0x613f('0x4a')]['find']({'where':{'name':_0x6e006b,'userProfileId':_0x47c84b[_0x613f('0x4b')]},'raw':!![]})[_0x613f('0x23')](function(_0x4f59b6){if(_0x4f59b6&&_0x4f59b6['autoAssociation']===0x0){return db[_0x613f('0x4c')][_0x613f('0x46')]({'name':_0x51729a[_0x613f('0x2f')],'resourceId':_0x51729a['id'],'type':_0x4f59b6[_0x613f('0x2f')],'sectionId':_0x4f59b6['id']},{})[_0x613f('0x23')](function(){return _0x5a4079;});}else{return _0x5a4079;}})[_0x613f('0x40')](function(_0x24d162){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24d162);throw _0x24d162;});}return _0x5a4079;})[_0x613f('0x23')](respondWithResult(_0x17f8e5,0xc9))['catch'](handleError(_0x17f8e5,null));};exports['update']=function(_0x387913,_0x52c2a6){if(_0x387913[_0x613f('0x47')]['id']){delete _0x387913['body']['id'];}return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x387913[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x52c2a6,null))[_0x613f('0x23')](saveUpdates(_0x387913[_0x613f('0x47')],null))[_0x613f('0x23')](respondWithResult(_0x52c2a6,null))['catch'](handleError(_0x52c2a6,null));};exports[_0x613f('0x24')]=function(_0x4ff3ad,_0x3ce3dd){return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x4ff3ad[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x3ce3dd,null))[_0x613f('0x23')](removeEntity(_0x3ce3dd,null))[_0x613f('0x40')](handleError(_0x3ce3dd,null));};exports[_0x613f('0x4d')]=function(_0x214d01,_0x49637d,_0x2ebce1){return db[_0x613f('0x2a')][_0x613f('0x4e')]({'where':{'id':_0x214d01['params']['id']}})['then'](handleEntityNotFound(_0x49637d,null))[_0x613f('0x23')](function(_0x4b6eb3){var _0xcb1c9d;var _0x3c3cd7={},_0x42a72b={};_0x42a72b[_0x613f('0x2e')]=_[_0x613f('0x30')](db[_0x613f('0x4f')][_0x613f('0x2b')]);_0x42a72b[_0x613f('0x33')]=_[_0x613f('0x30')](_0x214d01[_0x613f('0x33')]);_0x42a72b[_0x613f('0x31')]=_['intersection'](_0x42a72b[_0x613f('0x2e')],_0x42a72b[_0x613f('0x33')]);_0x3c3cd7[_0x613f('0x34')]=_[_0x613f('0x32')](_0x42a72b['model'],qs[_0x613f('0x35')](_0x214d01[_0x613f('0x33')]['fields']));_0x3c3cd7['attributes']=_0x3c3cd7[_0x613f('0x34')]['length']?_0x3c3cd7['attributes']:_0x42a72b['model'];if(!_0x214d01[_0x613f('0x33')]['hasOwnProperty']('nolimit')){_0x3c3cd7['limit']=qs[_0x613f('0x1a')](_0x214d01[_0x613f('0x33')]['limit']);_0x3c3cd7[_0x613f('0x1d')]=qs[_0x613f('0x1d')](_0x214d01[_0x613f('0x33')][_0x613f('0x1d')]);}_0x3c3cd7['order']=qs[_0x613f('0x38')](_0x214d01[_0x613f('0x33')]['sort']);_0x3c3cd7[_0x613f('0x39')]=qs[_0x613f('0x31')](_[_0x613f('0x50')](_0x214d01[_0x613f('0x33')],_0x42a72b[_0x613f('0x31')]));if(_0x214d01[_0x613f('0x33')][_0x613f('0x3a')]){_0x3c3cd7[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x3c3cd7[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x3c3cd7[_0x613f('0x34')],function(_0x50d7ca){var _0x1c4e48={};_0x1c4e48[_0x50d7ca]={'$like':'%'+_0x214d01[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x1c4e48;})});}_0x3c3cd7[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x3c3cd7[_0x613f('0x39')],{'mailboxuser':_0x4b6eb3['mailbox']});_0x3c3cd7=_[_0x613f('0x3b')]({},_0x3c3cd7,_0x214d01[_0x613f('0x3c')]);return db[_0x613f('0x4f')][_0x613f('0x51')](_0x3c3cd7)[_0x613f('0x23')](respondWithFilteredResult(_0x49637d,_0x3c3cd7));})[_0x613f('0x40')](handleError(_0x49637d,null));}; \ No newline at end of file +var _0x6f7a=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','Voicemails','destroy','then','sendStatus','error','stack','name','send','index','VoiceMail','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll'];(function(_0x5d575,_0x39aee4){var _0x8069ec=function(_0x5e45e2){while(--_0x5e45e2){_0x5d575['push'](_0x5d575['shift']());}};_0x8069ec(++_0x39aee4);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x5ae0d4,_0x228e69){_0x5ae0d4=_0x5ae0d4-0x0;var _0x2ee8ab=_0x6f7a[_0x5ae0d4];return _0x2ee8ab;};'use strict';var emlformat=require(_0xa6f7('0x0'));var rimraf=require(_0xa6f7('0x1'));var zipdir=require(_0xa6f7('0x2'));var jsonpatch=require(_0xa6f7('0x3'));var rp=require('request-promise');var moment=require(_0xa6f7('0x4'));var BPromise=require(_0xa6f7('0x5'));var Mustache=require(_0xa6f7('0x6'));var util=require(_0xa6f7('0x7'));var path=require(_0xa6f7('0x8'));var sox=require(_0xa6f7('0x9'));var csv=require(_0xa6f7('0xa'));var ejs=require(_0xa6f7('0xb'));var fs=require('fs');var fs_extra=require(_0xa6f7('0xc'));var _=require(_0xa6f7('0xd'));var squel=require(_0xa6f7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6f7('0xf'));var toCsv=require(_0xa6f7('0xa'));var querystring=require(_0xa6f7('0x10'));var Papa=require(_0xa6f7('0x11'));var Redis=require(_0xa6f7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6f7('0x13'));var hardwareService=require(_0xa6f7('0x14'));var logger=require('../../config/logger')(_0xa6f7('0x15'));var utils=require('../../config/utils');var config=require(_0xa6f7('0x16'));var licenseUtil=require(_0xa6f7('0x17'));var db=require(_0xa6f7('0x18'))['db'];function respondWithStatusCode(_0xd5558b,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x3fc7f1){if(_0x3fc7f1){return _0xd5558b['sendStatus'](_0x5a3035);}return _0xd5558b[_0xa6f7('0x19')](_0x5a3035)[_0xa6f7('0x1a')]();};}function respondWithResult(_0x25c123,_0x4d3d59){_0x4d3d59=_0x4d3d59||0xc8;return function(_0x34c02d){if(_0x34c02d){return _0x25c123['status'](_0x4d3d59)[_0xa6f7('0x1b')](_0x34c02d);}};}function respondWithFilteredResult(_0x57308a,_0x17b814){return function(_0x17f9c5){if(_0x17f9c5){var _0x6efd38=typeof _0x17b814['offset']===_0xa6f7('0x1c')&&typeof _0x17b814[_0xa6f7('0x1d')]===_0xa6f7('0x1c');var _0x2401b9=_0x17f9c5['count'];var _0x4a8827=_0x6efd38?0x0:_0x17b814[_0xa6f7('0x1e')];var _0x5298ba=_0x6efd38?_0x17f9c5[_0xa6f7('0x1f')]:_0x17b814[_0xa6f7('0x1e')]+_0x17b814['limit'];var _0x18fc4a;if(_0x5298ba>=_0x2401b9){_0x5298ba=_0x2401b9;_0x18fc4a=0xc8;}else{_0x18fc4a=0xce;}_0x57308a[_0xa6f7('0x19')](_0x18fc4a);return _0x57308a[_0xa6f7('0x20')](_0xa6f7('0x21'),_0x4a8827+'-'+_0x5298ba+'/'+_0x2401b9)[_0xa6f7('0x1b')](_0x17f9c5);}return null;};}function patchUpdates(_0x1aa8dc){return function(_0x4887ad){try{jsonpatch[_0xa6f7('0x22')](_0x4887ad,_0x1aa8dc,!![]);}catch(_0x45d79e){return BPromise['reject'](_0x45d79e);}return _0x4887ad['save']();};}function saveUpdates(_0x5ddc8d,_0x1de6c9){return function(_0x119950){if(_0x119950){return _0x119950['update'](_0x5ddc8d)['then'](function(_0x50e2be){return _0x50e2be;});}return null;};}function removeEntity(_0x2b6a84,_0xc77e8e){return function(_0x28263e){if(_0x28263e){return _0x28263e['destroy']()['then'](function(){var _0x2f4907=_0x28263e['get']({'plain':!![]});var _0x47ef97=_0xa6f7('0x23');return db['UserProfileResource'][_0xa6f7('0x24')]({'where':{'type':_0x47ef97,'resourceId':_0x2f4907['id']}})[_0xa6f7('0x25')](function(){return _0x28263e;});})[_0xa6f7('0x25')](function(){_0x2b6a84[_0xa6f7('0x19')](0xcc)[_0xa6f7('0x1a')]();});}};}function handleEntityNotFound(_0x4b8d2b,_0x51db47){return function(_0x1c419b){if(!_0x1c419b){_0x4b8d2b[_0xa6f7('0x26')](0x194);}return _0x1c419b;};}function handleError(_0x55d45a,_0x267917){_0x267917=_0x267917||0x1f4;return function(_0x27babb){logger[_0xa6f7('0x27')](_0x27babb[_0xa6f7('0x28')]);if(_0x27babb[_0xa6f7('0x29')]){delete _0x27babb[_0xa6f7('0x29')];}_0x55d45a[_0xa6f7('0x19')](_0x267917)[_0xa6f7('0x2a')](_0x27babb);};}exports[_0xa6f7('0x2b')]=function(_0x3dee2e,_0x40b0f8){var _0x278bad={},_0x52f9c1={},_0x442ccf={'count':0x0,'rows':[]};var _0x42dc49=_['map'](db[_0xa6f7('0x2c')][_0xa6f7('0x2d')],function(_0x4d79d8){return{'name':_0x4d79d8['fieldName'],'type':_0x4d79d8[_0xa6f7('0x2e')][_0xa6f7('0x2f')]};});_0x52f9c1[_0xa6f7('0x30')]=_[_0xa6f7('0x31')](_0x42dc49,_0xa6f7('0x29'));_0x52f9c1['query']=_['keys'](_0x3dee2e[_0xa6f7('0x32')]);_0x52f9c1['filters']=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],_0x52f9c1[_0xa6f7('0x32')]);_0x278bad[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],qs['fields'](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x35')]));_0x278bad[_0xa6f7('0x34')]=_0x278bad['attributes'][_0xa6f7('0x36')]?_0x278bad['attributes']:_0x52f9c1[_0xa6f7('0x30')];if(!_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x37')]('nolimit')){_0x278bad[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x1d')]);_0x278bad[_0xa6f7('0x1e')]=qs[_0xa6f7('0x1e')](_0x3dee2e['query'][_0xa6f7('0x1e')]);}_0x278bad[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x278bad[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x3dee2e['query'],_0x52f9c1[_0xa6f7('0x3b')]),_0x42dc49);if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x278bad['where']=_[_0xa6f7('0x3e')](_0x278bad[_0xa6f7('0x3a')],{'$or':_['map'](_0x42dc49,function(_0x39349a){if(_0x39349a[_0xa6f7('0x2e')]!==_0xa6f7('0x3f')){var _0x14d532={};_0x14d532[_0x39349a[_0xa6f7('0x29')]]={'$like':'%'+_0x3dee2e['query'][_0xa6f7('0x3d')]+'%'};return _0x14d532;}})});}_0x278bad=_[_0xa6f7('0x3e')]({},_0x278bad,_0x3dee2e[_0xa6f7('0x40')]);var _0x1b8bf3={'where':_0x278bad[_0xa6f7('0x3a')]};return db[_0xa6f7('0x2c')][_0xa6f7('0x1f')](_0x1b8bf3)[_0xa6f7('0x25')](function(_0x5646b9){_0x442ccf['count']=_0x5646b9;if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x41')]){_0x278bad[_0xa6f7('0x42')]=[{'all':!![]}];}return db[_0xa6f7('0x2c')][_0xa6f7('0x43')](_0x278bad);})[_0xa6f7('0x25')](function(_0x21fdd7){_0x442ccf[_0xa6f7('0x44')]=_0x21fdd7;return _0x442ccf;})[_0xa6f7('0x25')](respondWithFilteredResult(_0x40b0f8,_0x278bad))[_0xa6f7('0x45')](handleError(_0x40b0f8,null));};exports['show']=function(_0x41917c,_0x30be3b){var _0x4d5846={'raw':!![],'where':{'id':_0x41917c[_0xa6f7('0x46')]['id']}},_0x22d500={};_0x22d500[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db['VoiceMail'][_0xa6f7('0x2d')]);_0x22d500['query']=_['keys'](_0x41917c[_0xa6f7('0x32')]);_0x22d500[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x22d500[_0xa6f7('0x30')],_0x22d500[_0xa6f7('0x32')]);_0x4d5846[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x22d500['model'],qs[_0xa6f7('0x35')](_0x41917c[_0xa6f7('0x32')]['fields']));_0x4d5846[_0xa6f7('0x34')]=_0x4d5846[_0xa6f7('0x34')][_0xa6f7('0x36')]?_0x4d5846['attributes']:_0x22d500[_0xa6f7('0x30')];if(_0x41917c['query'][_0xa6f7('0x41')]){_0x4d5846[_0xa6f7('0x42')]=[{'all':!![]}];}_0x4d5846=_[_0xa6f7('0x3e')]({},_0x4d5846,_0x41917c['options']);return db['VoiceMail'][_0xa6f7('0x48')](_0x4d5846)['then'](handleEntityNotFound(_0x30be3b,null))[_0xa6f7('0x25')](respondWithResult(_0x30be3b,null))['catch'](handleError(_0x30be3b,null));};exports['create']=function(_0x1e7089,_0x2e3a04){return db[_0xa6f7('0x2c')][_0xa6f7('0x49')](_0x1e7089[_0xa6f7('0x4a')],{})[_0xa6f7('0x25')](function(_0x5d9b6f){var _0x4032fc=_0x1e7089[_0xa6f7('0x4b')]['get']({'plain':!![]});if(!_0x4032fc)throw new Error(_0xa6f7('0x4c'));if(_0x4032fc['role']===_0xa6f7('0x4b')){var _0x59091a=_0x5d9b6f['get']({'plain':!![]});var _0x60eacc=_0xa6f7('0x23');return db[_0xa6f7('0x4d')][_0xa6f7('0x48')]({'where':{'name':_0x60eacc,'userProfileId':_0x4032fc[_0xa6f7('0x4e')]},'raw':!![]})['then'](function(_0x340d3f){if(_0x340d3f&&_0x340d3f[_0xa6f7('0x4f')]===0x0){return db['UserProfileResource'][_0xa6f7('0x49')]({'name':_0x59091a['name'],'resourceId':_0x59091a['id'],'type':_0x340d3f[_0xa6f7('0x29')],'sectionId':_0x340d3f['id']},{})[_0xa6f7('0x25')](function(){return _0x5d9b6f;});}else{return _0x5d9b6f;}})[_0xa6f7('0x45')](function(_0x55369a){logger[_0xa6f7('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55369a);throw _0x55369a;});}return _0x5d9b6f;})[_0xa6f7('0x25')](respondWithResult(_0x2e3a04,0xc9))[_0xa6f7('0x45')](handleError(_0x2e3a04,null));};exports[_0xa6f7('0x50')]=function(_0x1dcb45,_0xa6bff9){if(_0x1dcb45['body']['id']){delete _0x1dcb45['body']['id'];}return db[_0xa6f7('0x2c')][_0xa6f7('0x48')]({'where':{'id':_0x1dcb45[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0xa6bff9,null))['then'](saveUpdates(_0x1dcb45[_0xa6f7('0x4a')],null))[_0xa6f7('0x25')](respondWithResult(_0xa6bff9,null))[_0xa6f7('0x45')](handleError(_0xa6bff9,null));};exports[_0xa6f7('0x24')]=function(_0x1b33a5,_0x39538e){return db['VoiceMail'][_0xa6f7('0x48')]({'where':{'id':_0x1b33a5[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x39538e,null))['then'](removeEntity(_0x39538e,null))[_0xa6f7('0x45')](handleError(_0x39538e,null));};exports[_0xa6f7('0x51')]=function(_0x139192,_0x4496f1,_0x5908e3){return db['VoiceMail'][_0xa6f7('0x52')]({'where':{'id':_0x139192[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x4496f1,null))[_0xa6f7('0x25')](function(_0x301327){var _0x269249;var _0x1fcb72={},_0x5efd49={};_0x5efd49[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db[_0xa6f7('0x53')][_0xa6f7('0x2d')]);_0x5efd49[_0xa6f7('0x32')]=_[_0xa6f7('0x47')](_0x139192[_0xa6f7('0x32')]);_0x5efd49[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x5efd49[_0xa6f7('0x30')],_0x5efd49[_0xa6f7('0x32')]);_0x1fcb72['attributes']=_[_0xa6f7('0x33')](_0x5efd49['model'],qs[_0xa6f7('0x35')](_0x139192['query'][_0xa6f7('0x35')]));_0x1fcb72[_0xa6f7('0x34')]=_0x1fcb72['attributes'][_0xa6f7('0x36')]?_0x1fcb72[_0xa6f7('0x34')]:_0x5efd49[_0xa6f7('0x30')];if(!_0x139192['query'][_0xa6f7('0x37')]('nolimit')){_0x1fcb72[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x139192['query'][_0xa6f7('0x1d')]);_0x1fcb72['offset']=qs[_0xa6f7('0x1e')](_0x139192['query'][_0xa6f7('0x1e')]);}_0x1fcb72[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x139192[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x1fcb72[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x139192[_0xa6f7('0x32')],_0x5efd49[_0xa6f7('0x3b')]));if(_0x139192[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x1fcb72['where']=_[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')],{'$or':_[_0xa6f7('0x31')](_0x1fcb72[_0xa6f7('0x34')],function(_0x154c78){var _0x3a464e={};_0x3a464e[_0x154c78]={'$like':'%'+_0x139192[_0xa6f7('0x32')][_0xa6f7('0x3d')]+'%'};return _0x3a464e;})});}_0x1fcb72['where']=_[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')],{'mailboxuser':_0x301327[_0xa6f7('0x54')]});_0x1fcb72=_['merge']({},_0x1fcb72,_0x139192[_0xa6f7('0x40')]);return db[_0xa6f7('0x53')][_0xa6f7('0x55')](_0x1fcb72)[_0xa6f7('0x25')](respondWithFilteredResult(_0x4496f1,_0x1fcb72));})[_0xa6f7('0x45')](handleError(_0x4496f1,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 31780ca..ba9171c 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 _0x346a=['mailbox','context','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0x346a,0xa7));var _0xa346=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x346a[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xa346('0x0'));var logger=require(_0xa346('0x1'))('api');var moment=require(_0xa346('0x2'));var BPromise=require(_0xa346('0x3'));var rp=require(_0xa346('0x4'));var fs=require('fs');var path=require(_0xa346('0x5'));var rimraf=require(_0xa346('0x6'));var config=require('../../config/environment');var attributes=require(_0xa346('0x7'));module[_0xa346('0x8')]=function(_0x276e87,_0x468472){return _0x276e87[_0xa346('0x9')](_0xa346('0xa'),attributes,{'tableName':_0xa346('0xb'),'paranoid':![],'indexes':[{'name':_0xa346('0xc'),'fields':[_0xa346('0xd'),_0xa346('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xae9b=['VoiceMail','voice_voicemail','mailbox_context','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0x1ce957,_0x2088e5){var _0xa2c30c=function(_0x25a401){while(--_0x25a401){_0x1ce957['push'](_0x1ce957['shift']());}};_0xa2c30c(++_0x2088e5);}(_0xae9b,0x162));var _0xbae9=function(_0x59dcbc,_0x3655cf){_0x59dcbc=_0x59dcbc-0x0;var _0x224cd5=_0xae9b[_0x59dcbc];return _0x224cd5;};'use strict';var _=require(_0xbae9('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xbae9('0x1'));var BPromise=require(_0xbae9('0x2'));var rp=require(_0xbae9('0x3'));var fs=require('fs');var path=require(_0xbae9('0x4'));var rimraf=require(_0xbae9('0x5'));var config=require(_0xbae9('0x6'));var attributes=require(_0xbae9('0x7'));module[_0xbae9('0x8')]=function(_0x3a957f,_0x5820d5){return _0x3a957f[_0xbae9('0x9')](_0xbae9('0xa'),attributes,{'tableName':_0xbae9('0xb'),'paranoid':![],'indexes':[{'name':_0xbae9('0xc'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 03a531d..59fae10 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 _0x0f34=['VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','info','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0f34,0x126));var _0x40f3=function(_0x440fde,_0x445ce0){_0x440fde=_0x440fde-0x0;var _0x11052c=_0x0f34[_0x440fde];return _0x11052c;};'use strict';var _=require(_0x40f3('0x0'));var util=require(_0x40f3('0x1'));var moment=require(_0x40f3('0x2'));var BPromise=require(_0x40f3('0x3'));var rs=require(_0x40f3('0x4'));var fs=require('fs');var Redis=require(_0x40f3('0x5'));var db=require(_0x40f3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x40f3('0x7'))('rpc');var config=require(_0x40f3('0x8'));var jayson=require(_0x40f3('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x761e53,_0x5035e4,_0x3939b3){return new BPromise(function(_0x4ffaae,_0x5c0061){return client[_0x40f3('0xa')](_0x761e53,_0x3939b3)['then'](function(_0x12938d){logger[_0x40f3('0xb')]('VoiceMail,\x20%s,\x20%s',_0x5035e4,_0x40f3('0xc'));logger[_0x40f3('0xd')](_0x40f3('0xe'),_0x5035e4,'request\x20sent',JSON[_0x40f3('0xf')](_0x12938d));if(_0x12938d[_0x40f3('0x10')]){if(_0x12938d[_0x40f3('0x10')][_0x40f3('0x11')]===0x1f4){logger[_0x40f3('0x10')](_0x40f3('0x12'),_0x5035e4,_0x12938d['error'][_0x40f3('0x13')]);return _0x5c0061(_0x12938d[_0x40f3('0x10')][_0x40f3('0x13')]);}logger[_0x40f3('0x10')](_0x40f3('0x12'),_0x5035e4,_0x12938d[_0x40f3('0x10')][_0x40f3('0x13')]);return _0x4ffaae(_0x12938d[_0x40f3('0x10')]['message']);}else{logger['info'](_0x40f3('0x12'),_0x5035e4,_0x40f3('0xc'));_0x4ffaae(_0x12938d[_0x40f3('0x14')]['message']);}})[_0x40f3('0x15')](function(_0x5c6d8a){logger['error'](_0x40f3('0x12'),_0x5035e4,_0x5c6d8a);_0x5c0061(_0x5c6d8a);});});} \ No newline at end of file +var _0x0738=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x6bbbd6,_0x11a198){var _0x57417e=function(_0x15c1eb){while(--_0x15c1eb){_0x6bbbd6['push'](_0x6bbbd6['shift']());}};_0x57417e(++_0x11a198);}(_0x0738,0x1f4));var _0x8073=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0x0738[_0x1bd323];return _0x13097b;};'use strict';var _=require(_0x8073('0x0'));var util=require(_0x8073('0x1'));var moment=require(_0x8073('0x2'));var BPromise=require(_0x8073('0x3'));var rs=require(_0x8073('0x4'));var fs=require('fs');var Redis=require(_0x8073('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8073('0x6'));var logger=require(_0x8073('0x7'))(_0x8073('0x8'));var config=require('../../config/environment');var jayson=require(_0x8073('0x9'));var client=jayson[_0x8073('0xa')][_0x8073('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe857b9,_0x5f1cf3,_0x443c88){return new BPromise(function(_0x41c140,_0x6acc73){return client[_0x8073('0xc')](_0xe857b9,_0x443c88)[_0x8073('0xd')](function(_0x4c5604){logger['info'](_0x8073('0xe'),_0x5f1cf3,'request\x20sent');logger[_0x8073('0xf')](_0x8073('0x10'),_0x5f1cf3,_0x8073('0x11'),JSON[_0x8073('0x12')](_0x4c5604));if(_0x4c5604[_0x8073('0x13')]){if(_0x4c5604[_0x8073('0x13')]['code']===0x1f4){logger['error'](_0x8073('0xe'),_0x5f1cf3,_0x4c5604['error']['message']);return _0x6acc73(_0x4c5604[_0x8073('0x13')][_0x8073('0x14')]);}logger[_0x8073('0x13')](_0x8073('0xe'),_0x5f1cf3,_0x4c5604[_0x8073('0x13')][_0x8073('0x14')]);return _0x41c140(_0x4c5604[_0x8073('0x13')][_0x8073('0x14')]);}else{logger[_0x8073('0x15')](_0x8073('0xe'),_0x5f1cf3,_0x8073('0x11'));_0x41c140(_0x4c5604[_0x8073('0x16')][_0x8073('0x14')]);}})[_0x8073('0x17')](function(_0x42160d){logger[_0x8073('0x13')]('VoiceMail,\x20%s,\x20%s',_0x5f1cf3,_0x42160d);_0x6acc73(_0x42160d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index e3082ce..5a81c96 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 _0xb1d2=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x4bed2d,_0x4ebe20){var _0xe82d9f=function(_0x54d1af){while(--_0x54d1af){_0x4bed2d['push'](_0x4bed2d['shift']());}};_0xe82d9f(++_0x4ebe20);}(_0xb1d2,0x1e0));var _0x2b1d=function(_0x271aff,_0x6fcbab){_0x271aff=_0x271aff-0x0;var _0x3a25c5=_0xb1d2[_0x271aff];return _0x3a25c5;};'use strict';var multer=require(_0x2b1d('0x0'));var util=require(_0x2b1d('0x1'));var path=require(_0x2b1d('0x2'));var timeout=require(_0x2b1d('0x3'));var express=require(_0x2b1d('0x4'));var router=express['Router']();var fs_extra=require(_0x2b1d('0x5'));var auth=require(_0x2b1d('0x6'));var interaction=require(_0x2b1d('0x7'));var config=require(_0x2b1d('0x8'));var controller=require(_0x2b1d('0x9'));router[_0x2b1d('0xa')]('/',auth[_0x2b1d('0xb')](),controller[_0x2b1d('0xc')]);router[_0x2b1d('0xa')](_0x2b1d('0xd'),auth[_0x2b1d('0xb')](),controller[_0x2b1d('0xe')]);router[_0x2b1d('0xa')](_0x2b1d('0xf'),auth['isAuthenticated'](),controller[_0x2b1d('0x10')]);router[_0x2b1d('0x11')]('/',auth[_0x2b1d('0xb')](),controller[_0x2b1d('0x12')]);router['put']('/:id',auth[_0x2b1d('0xb')](),controller[_0x2b1d('0x13')]);router[_0x2b1d('0x14')]('/:id',auth[_0x2b1d('0xb')](),controller[_0x2b1d('0x15')]);module['exports']=router; \ No newline at end of file +var _0xf1dd=['delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','/:id/download','create','/:id','update'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf1dd,0x161));var _0xdf1d=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xf1dd[_0x1573ea];return _0x51c0e2;};'use strict';var multer=require(_0xdf1d('0x0'));var util=require('util');var path=require(_0xdf1d('0x1'));var timeout=require(_0xdf1d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdf1d('0x3'));var auth=require(_0xdf1d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xdf1d('0x5')]('/',auth[_0xdf1d('0x6')](),controller['index']);router[_0xdf1d('0x5')]('/:id',auth[_0xdf1d('0x6')](),controller['show']);router['get'](_0xdf1d('0x7'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xdf1d('0x8')]);router['put'](_0xdf1d('0x9'),auth[_0xdf1d('0x6')](),controller[_0xdf1d('0xa')]);router[_0xdf1d('0xb')](_0xdf1d('0x9'),auth['isAuthenticated'](),controller[_0xdf1d('0xc')]);module[_0xdf1d('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 39e1d4f..8860262 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 _0xff34=['TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','INTEGER','STRING','long'];(function(_0x359586,_0x3014bf){var _0x2cdbe3=function(_0x5afc37){while(--_0x5afc37){_0x359586['push'](_0x359586['shift']());}};_0x2cdbe3(++_0x3014bf);}(_0xff34,0x1bc));var _0x4ff3=function(_0xa1b74d,_0x614e6f){_0xa1b74d=_0xa1b74d-0x0;var _0x56bad4=_0xff34[_0xa1b74d];return _0x56bad4;};'use strict';var Sequelize=require(_0x4ff3('0x0'));module[_0x4ff3('0x1')]={'name':{'type':Sequelize[_0x4ff3('0x2')],'get':function(_0x19d880){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x4ff3('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x4ff3('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x4ff3('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x4ff3('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x4ff3('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x4ff3('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x4ff3('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x4ff3('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x4ff3('0x6'),'defaultValue':Sequelize[_0x4ff3('0x7')](_0x4ff3('0x8'))}}; \ No newline at end of file +var _0xa969=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal'];(function(_0x37f714,_0xcd9211){var _0x5b78fe=function(_0x21d3c8){while(--_0x21d3c8){_0x37f714['push'](_0x37f714['shift']());}};_0x5b78fe(++_0xcd9211);}(_0xa969,0x17d));var _0x9a96=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0xa969[_0x555b2f];return _0x81c0a6;};'use strict';var Sequelize=require(_0x9a96('0x0'));module[_0x9a96('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x14e3c4){return this[_0x9a96('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x9a96('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x9a96('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x9a96('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x9a96('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x9a96('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x9a96('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x9a96('0x5')](_0x9a96('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x9a96('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x9a96('0x4')],'defaultValue':''},'stamp':{'type':_0x9a96('0x7'),'defaultValue':Sequelize[_0x9a96('0x8')](_0x9a96('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 01a1eb5..a917550 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 _0xd974=['include','find','catch','create','body','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','index','rawAttributes','fieldName','key','model','differenceBy','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','filters','filter','where','merge','type','VIRTUAL','VoiceMailMessage','findAll','rows','show','params','includeAll'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xd974,0xb1));var _0x4d97=function(_0x534148,_0x13e370){_0x534148=_0x534148-0x0;var _0x5c3e0f=_0xd974[_0x534148];return _0x5c3e0f;};'use strict';var emlformat=require(_0x4d97('0x0'));var rimraf=require(_0x4d97('0x1'));var zipdir=require(_0x4d97('0x2'));var jsonpatch=require(_0x4d97('0x3'));var rp=require(_0x4d97('0x4'));var moment=require(_0x4d97('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4d97('0x6'));var path=require(_0x4d97('0x7'));var sox=require(_0x4d97('0x8'));var csv=require('to-csv');var ejs=require(_0x4d97('0x9'));var fs=require('fs');var fs_extra=require(_0x4d97('0xa'));var _=require(_0x4d97('0xb'));var squel=require(_0x4d97('0xc'));var crypto=require(_0x4d97('0xd'));var jsforce=require(_0x4d97('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4d97('0xf'));var querystring=require(_0x4d97('0x10'));var Papa=require(_0x4d97('0x11'));var Redis=require('ioredis');var authService=require(_0x4d97('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4d97('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d97('0x14'))(_0x4d97('0x15'));var utils=require(_0x4d97('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4d97('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b53fd,_0xf37f3a){_0xf37f3a=_0xf37f3a||0xcc;return function(_0x87b6fd){if(_0x87b6fd){return _0x4b53fd[_0x4d97('0x18')](_0xf37f3a);}return _0x4b53fd[_0x4d97('0x19')](_0xf37f3a)[_0x4d97('0x1a')]();};}function respondWithResult(_0x1edf80,_0x2e4bc9){_0x2e4bc9=_0x2e4bc9||0xc8;return function(_0x4cc9d6){if(_0x4cc9d6){return _0x1edf80[_0x4d97('0x19')](_0x2e4bc9)[_0x4d97('0x1b')](_0x4cc9d6);}};}function respondWithFilteredResult(_0x36b7af,_0x221936){return function(_0x44ed22){if(_0x44ed22){var _0x3d9c8e=typeof _0x221936[_0x4d97('0x1c')]===_0x4d97('0x1d')&&typeof _0x221936[_0x4d97('0x1e')]===_0x4d97('0x1d');var _0x11df5e=_0x44ed22[_0x4d97('0x1f')];var _0x392849=_0x3d9c8e?0x0:_0x221936[_0x4d97('0x1c')];var _0x3e8955=_0x3d9c8e?_0x44ed22[_0x4d97('0x1f')]:_0x221936['offset']+_0x221936['limit'];var _0x1971bd;if(_0x3e8955>=_0x11df5e){_0x3e8955=_0x11df5e;_0x1971bd=0xc8;}else{_0x1971bd=0xce;}_0x36b7af['status'](_0x1971bd);return _0x36b7af[_0x4d97('0x20')](_0x4d97('0x21'),_0x392849+'-'+_0x3e8955+'/'+_0x11df5e)[_0x4d97('0x1b')](_0x44ed22);}return null;};}function patchUpdates(_0x55531d){return function(_0x589f29){try{jsonpatch[_0x4d97('0x22')](_0x589f29,_0x55531d,!![]);}catch(_0x261d40){return BPromise['reject'](_0x261d40);}return _0x589f29[_0x4d97('0x23')]();};}function saveUpdates(_0x348e3a,_0x5b35ac){return function(_0x142c6e){if(_0x142c6e){return _0x142c6e[_0x4d97('0x24')](_0x348e3a)[_0x4d97('0x25')](function(_0x46e813){return _0x46e813;});}return null;};}function removeEntity(_0x4e1f4f,_0x50d088){return function(_0x1cd99a){if(_0x1cd99a){return _0x1cd99a[_0x4d97('0x26')]()[_0x4d97('0x25')](function(){_0x4e1f4f[_0x4d97('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1504fb,_0x55af9b){return function(_0x899bc8){if(!_0x899bc8){_0x1504fb[_0x4d97('0x18')](0x194);}return _0x899bc8;};}function handleError(_0x1f52b2,_0x311339){_0x311339=_0x311339||0x1f4;return function(_0x21ce23){logger[_0x4d97('0x27')](_0x21ce23['stack']);if(_0x21ce23[_0x4d97('0x28')]){delete _0x21ce23[_0x4d97('0x28')];}_0x1f52b2['status'](_0x311339)['send'](_0x21ce23);};}exports[_0x4d97('0x29')]=function(_0x39de82,_0x439c1b){var _0x314036={},_0x12edc0={},_0x1136ed={'count':0x0,'rows':[]};var _0x37cc6a=_['map'](db['VoiceMailMessage'][_0x4d97('0x2a')],function(_0x39233a){return{'name':_0x39233a[_0x4d97('0x2b')],'type':_0x39233a['type'][_0x4d97('0x2c')]};});_0x12edc0[_0x4d97('0x2d')]=_[_0x4d97('0x2e')](_[_0x4d97('0x2f')](_0x37cc6a,_0x4d97('0x28')),[_0x4d97('0x28')]);_0x12edc0[_0x4d97('0x30')]=_[_0x4d97('0x31')](_0x39de82[_0x4d97('0x30')]);_0x12edc0['filters']=_[_0x4d97('0x32')](_0x12edc0[_0x4d97('0x2d')],_0x12edc0[_0x4d97('0x30')]);_0x314036['attributes']=_[_0x4d97('0x32')](_0x12edc0[_0x4d97('0x2d')],qs['fields'](_0x39de82[_0x4d97('0x30')][_0x4d97('0x33')]));_0x314036[_0x4d97('0x34')]=_0x314036[_0x4d97('0x34')][_0x4d97('0x35')]?_0x314036[_0x4d97('0x34')]:_0x12edc0[_0x4d97('0x2d')];if(!_0x39de82[_0x4d97('0x30')][_0x4d97('0x36')](_0x4d97('0x37'))){_0x314036[_0x4d97('0x1e')]=qs[_0x4d97('0x1e')](_0x39de82[_0x4d97('0x30')][_0x4d97('0x1e')]);_0x314036['offset']=qs[_0x4d97('0x1c')](_0x39de82[_0x4d97('0x30')][_0x4d97('0x1c')]);}_0x314036[_0x4d97('0x38')]=qs['sort'](_0x39de82[_0x4d97('0x30')]['sort']);_0x314036['where']=qs[_0x4d97('0x39')](_['pick'](_0x39de82[_0x4d97('0x30')],_0x12edc0[_0x4d97('0x39')]),_0x37cc6a);if(_0x39de82[_0x4d97('0x30')][_0x4d97('0x3a')]){_0x314036[_0x4d97('0x3b')]=_[_0x4d97('0x3c')](_0x314036[_0x4d97('0x3b')],{'$or':_[_0x4d97('0x2f')](_0x37cc6a,function(_0x3c8931){if(_0x3c8931[_0x4d97('0x3d')]!==_0x4d97('0x3e')){var _0xab3369={};_0xab3369[_0x3c8931[_0x4d97('0x28')]]={'$like':'%'+_0x39de82[_0x4d97('0x30')][_0x4d97('0x3a')]+'%'};return _0xab3369;}})});}_0x314036=_[_0x4d97('0x3c')]({},_0x314036,_0x39de82['options']);var _0x38233c={'where':_0x314036['where']};return db[_0x4d97('0x3f')][_0x4d97('0x1f')](_0x38233c)[_0x4d97('0x25')](function(_0x2e6214){_0x1136ed[_0x4d97('0x1f')]=_0x2e6214;if(_0x39de82[_0x4d97('0x30')]['includeAll']){_0x314036['include']=[{'all':!![]}];}return db[_0x4d97('0x3f')][_0x4d97('0x40')](_0x314036);})['then'](function(_0x489a94){_0x1136ed[_0x4d97('0x41')]=_0x489a94;return _0x1136ed;})[_0x4d97('0x25')](respondWithFilteredResult(_0x439c1b,_0x314036))['catch'](handleError(_0x439c1b,null));};exports[_0x4d97('0x42')]=function(_0x3eba2d,_0x167e87){var _0x39141e={'raw':!![],'where':{'id':_0x3eba2d[_0x4d97('0x43')]['id']}},_0x44c88c={};_0x44c88c[_0x4d97('0x2d')]=_[_0x4d97('0x31')](db[_0x4d97('0x3f')][_0x4d97('0x2a')]);_0x44c88c['query']=_['keys'](_0x3eba2d[_0x4d97('0x30')]);_0x44c88c[_0x4d97('0x39')]=_[_0x4d97('0x32')](_0x44c88c[_0x4d97('0x2d')],_0x44c88c[_0x4d97('0x30')]);_0x39141e[_0x4d97('0x34')]=_[_0x4d97('0x32')](_0x44c88c['model'],qs[_0x4d97('0x33')](_0x3eba2d['query'][_0x4d97('0x33')]));_0x39141e[_0x4d97('0x34')]=_0x39141e[_0x4d97('0x34')][_0x4d97('0x35')]?_0x39141e['attributes']:_0x44c88c[_0x4d97('0x2d')];if(_0x3eba2d[_0x4d97('0x30')][_0x4d97('0x44')]){_0x39141e[_0x4d97('0x45')]=[{'all':!![]}];}_0x39141e=_[_0x4d97('0x3c')]({},_0x39141e,_0x3eba2d['options']);return db[_0x4d97('0x3f')][_0x4d97('0x46')](_0x39141e)['then'](handleEntityNotFound(_0x167e87,null))[_0x4d97('0x25')](respondWithResult(_0x167e87,null))[_0x4d97('0x47')](handleError(_0x167e87,null));};exports[_0x4d97('0x48')]=function(_0x4dd52f,_0x3056a0){return db[_0x4d97('0x3f')]['create'](_0x4dd52f[_0x4d97('0x49')],{})[_0x4d97('0x25')](respondWithResult(_0x3056a0,0xc9))[_0x4d97('0x47')](handleError(_0x3056a0,null));};exports[_0x4d97('0x24')]=function(_0x3ec7f9,_0x233ddd){if(_0x3ec7f9['body']['id']){delete _0x3ec7f9['body']['id'];}return db[_0x4d97('0x3f')][_0x4d97('0x46')]({'where':{'id':_0x3ec7f9[_0x4d97('0x43')]['id']}})[_0x4d97('0x25')](handleEntityNotFound(_0x233ddd,null))['then'](saveUpdates(_0x3ec7f9[_0x4d97('0x49')],null))['then'](respondWithResult(_0x233ddd,null))[_0x4d97('0x47')](handleError(_0x233ddd,null));};exports[_0x4d97('0x26')]=function(_0xea6780,_0x5ae85b){return db[_0x4d97('0x3f')][_0x4d97('0x46')]({'where':{'id':_0xea6780[_0x4d97('0x43')]['id']}})['then'](handleEntityNotFound(_0x5ae85b,null))[_0x4d97('0x25')](removeEntity(_0x5ae85b,null))['catch'](handleError(_0x5ae85b,null));};exports['download']=function(_0x546d82,_0x539028,_0x561cdc){return db[_0x4d97('0x3f')][_0x4d97('0x46')]({'where':{'id':_0x546d82[_0x4d97('0x43')]['id']},'attributes':['id',_0x4d97('0x4a'),_0x4d97('0x4b')]})[_0x4d97('0x25')](handleEntityNotFound(_0x539028,null))[_0x4d97('0x25')](function(_0x1a356e){if(_0x1a356e){if(!_0x1a356e['recording']){throw new db[(_0x4d97('0x4c'))][(_0x4d97('0x4d'))]('VoiceMailMessage\x20not\x20found');}var _0x147c7e={'Content-Type':_0x4d97('0x4e'),'Content-Disposition':'attachment'};if(_0x1a356e[_0x4d97('0x4b')]){_0x147c7e['Content-Disposition']=_0x4d97('0x4f')+_0x1a356e['msg_id']+_0x4d97('0x50');}_0x539028[_0x4d97('0x20')](_0x147c7e);return _0x539028[_0x4d97('0x51')](new Buffer(_0x1a356e['recording']));}})[_0x4d97('0x47')](handleError(_0x539028,null));}; \ No newline at end of file +var _0xe0ff=['path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','find','create','body','download','recording','msg_id','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','request-promise','moment','mustache','util'];(function(_0x4bf67a,_0x1136a9){var _0x3b369f=function(_0x2e7ca2){while(--_0x2e7ca2){_0x4bf67a['push'](_0x4bf67a['shift']());}};_0x3b369f(++_0x1136a9);}(_0xe0ff,0xa2));var _0xfe0f=function(_0x3f7ca2,_0x55ae3a){_0x3f7ca2=_0x3f7ca2-0x0;var _0x356d78=_0xe0ff[_0x3f7ca2];return _0x356d78;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe0f('0x0'));var zipdir=require(_0xfe0f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe0f('0x2'));var moment=require(_0xfe0f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfe0f('0x4'));var util=require(_0xfe0f('0x5'));var path=require(_0xfe0f('0x6'));var sox=require(_0xfe0f('0x7'));var csv=require(_0xfe0f('0x8'));var ejs=require(_0xfe0f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe0f('0xa'));var squel=require('squel');var crypto=require(_0xfe0f('0xb'));var jsforce=require(_0xfe0f('0xc'));var deskjs=require(_0xfe0f('0xd'));var toCsv=require(_0xfe0f('0x8'));var querystring=require('querystring');var Papa=require(_0xfe0f('0xe'));var Redis=require(_0xfe0f('0xf'));var authService=require(_0xfe0f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfe0f('0x11'));var hardwareService=require(_0xfe0f('0x12'));var logger=require('../../config/logger')(_0xfe0f('0x13'));var utils=require(_0xfe0f('0x14'));var config=require(_0xfe0f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe0f('0x16'))['db'];function respondWithStatusCode(_0x410f73,_0x2cec3f){_0x2cec3f=_0x2cec3f||0xcc;return function(_0x55468e){if(_0x55468e){return _0x410f73[_0xfe0f('0x17')](_0x2cec3f);}return _0x410f73[_0xfe0f('0x18')](_0x2cec3f)[_0xfe0f('0x19')]();};}function respondWithResult(_0x5b5ea9,_0x56efc6){_0x56efc6=_0x56efc6||0xc8;return function(_0xb63613){if(_0xb63613){return _0x5b5ea9[_0xfe0f('0x18')](_0x56efc6)[_0xfe0f('0x1a')](_0xb63613);}};}function respondWithFilteredResult(_0x31953d,_0x293a2d){return function(_0x26417){if(_0x26417){var _0x856679=typeof _0x293a2d[_0xfe0f('0x1b')]===_0xfe0f('0x1c')&&typeof _0x293a2d['limit']===_0xfe0f('0x1c');var _0x54491c=_0x26417[_0xfe0f('0x1d')];var _0x162f3a=_0x856679?0x0:_0x293a2d['offset'];var _0x1a9d77=_0x856679?_0x26417[_0xfe0f('0x1d')]:_0x293a2d[_0xfe0f('0x1b')]+_0x293a2d['limit'];var _0xe83354;if(_0x1a9d77>=_0x54491c){_0x1a9d77=_0x54491c;_0xe83354=0xc8;}else{_0xe83354=0xce;}_0x31953d[_0xfe0f('0x18')](_0xe83354);return _0x31953d[_0xfe0f('0x1e')](_0xfe0f('0x1f'),_0x162f3a+'-'+_0x1a9d77+'/'+_0x54491c)['json'](_0x26417);}return null;};}function patchUpdates(_0x2c48cd){return function(_0x1f9cfa){try{jsonpatch[_0xfe0f('0x20')](_0x1f9cfa,_0x2c48cd,!![]);}catch(_0x54fde4){return BPromise[_0xfe0f('0x21')](_0x54fde4);}return _0x1f9cfa[_0xfe0f('0x22')]();};}function saveUpdates(_0x569986,_0x3b621b){return function(_0x2c6067){if(_0x2c6067){return _0x2c6067[_0xfe0f('0x23')](_0x569986)[_0xfe0f('0x24')](function(_0x537f64){return _0x537f64;});}return null;};}function removeEntity(_0x2ec473,_0x2fb1fa){return function(_0x2cfdaa){if(_0x2cfdaa){return _0x2cfdaa[_0xfe0f('0x25')]()[_0xfe0f('0x24')](function(){_0x2ec473[_0xfe0f('0x18')](0xcc)[_0xfe0f('0x19')]();});}};}function handleEntityNotFound(_0x4c27f5,_0x4288a8){return function(_0x31387c){if(!_0x31387c){_0x4c27f5[_0xfe0f('0x17')](0x194);}return _0x31387c;};}function handleError(_0x5004cc,_0x506b34){_0x506b34=_0x506b34||0x1f4;return function(_0x262ec7){logger[_0xfe0f('0x26')](_0x262ec7[_0xfe0f('0x27')]);if(_0x262ec7['name']){delete _0x262ec7[_0xfe0f('0x28')];}_0x5004cc['status'](_0x506b34)[_0xfe0f('0x29')](_0x262ec7);};}exports[_0xfe0f('0x2a')]=function(_0x62752e,_0x51be48){var _0x47c6ee={},_0x2b73e0={},_0x59f3ae={'count':0x0,'rows':[]};var _0x2fb4e0=_[_0xfe0f('0x2b')](db[_0xfe0f('0x2c')][_0xfe0f('0x2d')],function(_0x39e5b7){return{'name':_0x39e5b7[_0xfe0f('0x2e')],'type':_0x39e5b7[_0xfe0f('0x2f')]['key']};});_0x2b73e0[_0xfe0f('0x30')]=_[_0xfe0f('0x31')](_[_0xfe0f('0x2b')](_0x2fb4e0,_0xfe0f('0x28')),[_0xfe0f('0x28')]);_0x2b73e0[_0xfe0f('0x32')]=_[_0xfe0f('0x33')](_0x62752e['query']);_0x2b73e0[_0xfe0f('0x34')]=_['intersection'](_0x2b73e0[_0xfe0f('0x30')],_0x2b73e0[_0xfe0f('0x32')]);_0x47c6ee[_0xfe0f('0x35')]=_[_0xfe0f('0x36')](_0x2b73e0[_0xfe0f('0x30')],qs['fields'](_0x62752e[_0xfe0f('0x32')][_0xfe0f('0x37')]));_0x47c6ee[_0xfe0f('0x35')]=_0x47c6ee[_0xfe0f('0x35')][_0xfe0f('0x38')]?_0x47c6ee[_0xfe0f('0x35')]:_0x2b73e0[_0xfe0f('0x30')];if(!_0x62752e[_0xfe0f('0x32')][_0xfe0f('0x39')](_0xfe0f('0x3a'))){_0x47c6ee['limit']=qs[_0xfe0f('0x3b')](_0x62752e[_0xfe0f('0x32')]['limit']);_0x47c6ee[_0xfe0f('0x1b')]=qs[_0xfe0f('0x1b')](_0x62752e['query']['offset']);}_0x47c6ee[_0xfe0f('0x3c')]=qs[_0xfe0f('0x3d')](_0x62752e[_0xfe0f('0x32')]['sort']);_0x47c6ee[_0xfe0f('0x3e')]=qs[_0xfe0f('0x34')](_[_0xfe0f('0x3f')](_0x62752e[_0xfe0f('0x32')],_0x2b73e0[_0xfe0f('0x34')]),_0x2fb4e0);if(_0x62752e[_0xfe0f('0x32')][_0xfe0f('0x40')]){_0x47c6ee[_0xfe0f('0x3e')]=_[_0xfe0f('0x41')](_0x47c6ee['where'],{'$or':_['map'](_0x2fb4e0,function(_0x19e07b){if(_0x19e07b[_0xfe0f('0x2f')]!=='VIRTUAL'){var _0x52742c={};_0x52742c[_0x19e07b[_0xfe0f('0x28')]]={'$like':'%'+_0x62752e[_0xfe0f('0x32')][_0xfe0f('0x40')]+'%'};return _0x52742c;}})});}_0x47c6ee=_[_0xfe0f('0x41')]({},_0x47c6ee,_0x62752e[_0xfe0f('0x42')]);var _0x51a081={'where':_0x47c6ee['where']};return db['VoiceMailMessage'][_0xfe0f('0x1d')](_0x51a081)[_0xfe0f('0x24')](function(_0x2914b8){_0x59f3ae[_0xfe0f('0x1d')]=_0x2914b8;if(_0x62752e[_0xfe0f('0x32')]['includeAll']){_0x47c6ee[_0xfe0f('0x43')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xfe0f('0x44')](_0x47c6ee);})[_0xfe0f('0x24')](function(_0x512bdd){_0x59f3ae[_0xfe0f('0x45')]=_0x512bdd;return _0x59f3ae;})[_0xfe0f('0x24')](respondWithFilteredResult(_0x51be48,_0x47c6ee))[_0xfe0f('0x46')](handleError(_0x51be48,null));};exports['show']=function(_0x2e9e31,_0x32a354){var _0x562f6d={'raw':!![],'where':{'id':_0x2e9e31[_0xfe0f('0x47')]['id']}},_0x4f1e8e={};_0x4f1e8e[_0xfe0f('0x30')]=_[_0xfe0f('0x33')](db[_0xfe0f('0x2c')][_0xfe0f('0x2d')]);_0x4f1e8e[_0xfe0f('0x32')]=_['keys'](_0x2e9e31[_0xfe0f('0x32')]);_0x4f1e8e[_0xfe0f('0x34')]=_[_0xfe0f('0x36')](_0x4f1e8e['model'],_0x4f1e8e[_0xfe0f('0x32')]);_0x562f6d['attributes']=_[_0xfe0f('0x36')](_0x4f1e8e['model'],qs[_0xfe0f('0x37')](_0x2e9e31[_0xfe0f('0x32')]['fields']));_0x562f6d[_0xfe0f('0x35')]=_0x562f6d['attributes'][_0xfe0f('0x38')]?_0x562f6d['attributes']:_0x4f1e8e[_0xfe0f('0x30')];if(_0x2e9e31['query']['includeAll']){_0x562f6d[_0xfe0f('0x43')]=[{'all':!![]}];}_0x562f6d=_[_0xfe0f('0x41')]({},_0x562f6d,_0x2e9e31['options']);return db[_0xfe0f('0x2c')][_0xfe0f('0x48')](_0x562f6d)[_0xfe0f('0x24')](handleEntityNotFound(_0x32a354,null))['then'](respondWithResult(_0x32a354,null))[_0xfe0f('0x46')](handleError(_0x32a354,null));};exports['create']=function(_0x4bf618,_0x55a012){return db[_0xfe0f('0x2c')][_0xfe0f('0x49')](_0x4bf618['body'],{})[_0xfe0f('0x24')](respondWithResult(_0x55a012,0xc9))[_0xfe0f('0x46')](handleError(_0x55a012,null));};exports[_0xfe0f('0x23')]=function(_0x38b798,_0x57a0c5){if(_0x38b798['body']['id']){delete _0x38b798[_0xfe0f('0x4a')]['id'];}return db[_0xfe0f('0x2c')][_0xfe0f('0x48')]({'where':{'id':_0x38b798[_0xfe0f('0x47')]['id']}})['then'](handleEntityNotFound(_0x57a0c5,null))[_0xfe0f('0x24')](saveUpdates(_0x38b798[_0xfe0f('0x4a')],null))[_0xfe0f('0x24')](respondWithResult(_0x57a0c5,null))['catch'](handleError(_0x57a0c5,null));};exports[_0xfe0f('0x25')]=function(_0x7fc46e,_0x237a7f){return db['VoiceMailMessage'][_0xfe0f('0x48')]({'where':{'id':_0x7fc46e[_0xfe0f('0x47')]['id']}})['then'](handleEntityNotFound(_0x237a7f,null))[_0xfe0f('0x24')](removeEntity(_0x237a7f,null))[_0xfe0f('0x46')](handleError(_0x237a7f,null));};exports[_0xfe0f('0x4b')]=function(_0x4c4b15,_0x5baffc,_0x3a6b19){return db[_0xfe0f('0x2c')][_0xfe0f('0x48')]({'where':{'id':_0x4c4b15[_0xfe0f('0x47')]['id']},'attributes':['id',_0xfe0f('0x4c'),_0xfe0f('0x4d')]})['then'](handleEntityNotFound(_0x5baffc,null))[_0xfe0f('0x24')](function(_0x53e2a8){if(_0x53e2a8){if(!_0x53e2a8[_0xfe0f('0x4c')]){throw new db['Sequelize']['ValidationError'](_0xfe0f('0x4e'));}var _0x47fd7d={'Content-Type':_0xfe0f('0x4f'),'Content-Disposition':_0xfe0f('0x50')};if(_0x53e2a8['msg_id']){_0x47fd7d[_0xfe0f('0x51')]=_0xfe0f('0x52')+_0x53e2a8[_0xfe0f('0x4d')]+_0xfe0f('0x53');}_0x5baffc[_0xfe0f('0x1e')](_0x47fd7d);return _0x5baffc['send'](new Buffer(_0x53e2a8[_0xfe0f('0x4c')]));}})[_0xfe0f('0x46')](handleError(_0x5baffc,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index b692eb1..c8afdbc 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 _0x7d35=['bluebird','path','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','dir','lodash','util','../../config/logger','api'];(function(_0xd2d54,_0x5329f7){var _0x78b113=function(_0x7d2b29){while(--_0x7d2b29){_0xd2d54['push'](_0xd2d54['shift']());}};_0x78b113(++_0x5329f7);}(_0x7d35,0x75));var _0x57d3=function(_0x1551ed,_0x5cc3ce){_0x1551ed=_0x1551ed-0x0;var _0x499928=_0x7d35[_0x1551ed];return _0x499928;};'use strict';var _=require(_0x57d3('0x0'));var util=require(_0x57d3('0x1'));var logger=require(_0x57d3('0x2'))(_0x57d3('0x3'));var moment=require('moment');var BPromise=require(_0x57d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x57d3('0x5'));var rimraf=require('rimraf');var config=require(_0x57d3('0x6'));var attributes=require(_0x57d3('0x7'));module['exports']=function(_0x25bbe1,_0x511cec){return _0x25bbe1[_0x57d3('0x8')](_0x57d3('0x9'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x57d3('0xa'),'fields':[_0x57d3('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x043a=['exports','voice_voicemail_messages','dir','util','../../config/logger','api','bluebird','rimraf','./voiceMailMessage.attributes'];(function(_0x1938f4,_0x5c0c98){var _0x37f4db=function(_0x5bec0c){while(--_0x5bec0c){_0x1938f4['push'](_0x1938f4['shift']());}};_0x37f4db(++_0x5c0c98);}(_0x043a,0x1d7));var _0xa043=function(_0x19ad69,_0x3b7de7){_0x19ad69=_0x19ad69-0x0;var _0x245552=_0x043a[_0x19ad69];return _0x245552;};'use strict';var _=require('lodash');var util=require(_0xa043('0x0'));var logger=require(_0xa043('0x1'))(_0xa043('0x2'));var moment=require('moment');var BPromise=require(_0xa043('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa043('0x4'));var config=require('../../config/environment');var attributes=require(_0xa043('0x5'));module[_0xa043('0x6')]=function(_0x2190fe,_0x5d5721){return _0x2190fe['define']('VoiceMailMessage',attributes,{'tableName':_0xa043('0x7'),'paranoid':![],'indexes':[{'name':_0xa043('0x8'),'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 e35f4c6..89d979c 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 _0xf841=['http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x55aa6e,_0x20407b){var _0x442f9d=function(_0x38e767){while(--_0x38e767){_0x55aa6e['push'](_0x55aa6e['shift']());}};_0x442f9d(++_0x20407b);}(_0xf841,0x9e));var _0x1f84=function(_0x585f40,_0x4a3091){_0x585f40=_0x585f40-0x0;var _0x44fc86=_0xf841[_0x585f40];return _0x44fc86;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1f84('0x0'));var BPromise=require(_0x1f84('0x1'));var rs=require(_0x1f84('0x2'));var fs=require('fs');var Redis=require(_0x1f84('0x3'));var db=require(_0x1f84('0x4'))['db'];var utils=require(_0x1f84('0x5'));var logger=require(_0x1f84('0x6'))(_0x1f84('0x7'));var config=require('../../config/environment');var jayson=require(_0x1f84('0x8'));var client=jayson[_0x1f84('0x9')][_0x1f84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3719de,_0x3256d2,_0x5c8bdd){return new BPromise(function(_0xafea08,_0x48de41){return client[_0x1f84('0xb')](_0x3719de,_0x5c8bdd)[_0x1f84('0xc')](function(_0x3fd077){logger[_0x1f84('0xd')](_0x1f84('0xe'),_0x3256d2,_0x1f84('0xf'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x3256d2,_0x1f84('0xf'),JSON['stringify'](_0x3fd077));if(_0x3fd077[_0x1f84('0x10')]){if(_0x3fd077[_0x1f84('0x10')][_0x1f84('0x11')]===0x1f4){logger['error'](_0x1f84('0xe'),_0x3256d2,_0x3fd077[_0x1f84('0x10')][_0x1f84('0x12')]);return _0x48de41(_0x3fd077[_0x1f84('0x10')][_0x1f84('0x12')]);}logger[_0x1f84('0x10')](_0x1f84('0xe'),_0x3256d2,_0x3fd077[_0x1f84('0x10')]['message']);return _0xafea08(_0x3fd077[_0x1f84('0x10')][_0x1f84('0x12')]);}else{logger[_0x1f84('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x3256d2,'request\x20sent');_0xafea08(_0x3fd077[_0x1f84('0x13')]['message']);}})[_0x1f84('0x14')](function(_0x5833b2){logger[_0x1f84('0x10')](_0x1f84('0xe'),_0x3256d2,_0x5833b2);_0x48de41(_0x5833b2);});});} \ No newline at end of file +var _0xc0f7=['rpc','../../config/environment','jayson/promise','http','request','info','VoiceMailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x59b31d,_0x22b410){var _0x5b0a77=function(_0x3d080d){while(--_0x3d080d){_0x59b31d['push'](_0x59b31d['shift']());}};_0x5b0a77(++_0x22b410);}(_0xc0f7,0x184));var _0x7c0f=function(_0x50d2d7,_0x40c61a){_0x50d2d7=_0x50d2d7-0x0;var _0x2e3e6b=_0xc0f7[_0x50d2d7];return _0x2e3e6b;};'use strict';var _=require(_0x7c0f('0x0'));var util=require(_0x7c0f('0x1'));var moment=require(_0x7c0f('0x2'));var BPromise=require(_0x7c0f('0x3'));var rs=require(_0x7c0f('0x4'));var fs=require('fs');var Redis=require(_0x7c0f('0x5'));var db=require(_0x7c0f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c0f('0x7'))(_0x7c0f('0x8'));var config=require(_0x7c0f('0x9'));var jayson=require(_0x7c0f('0xa'));var client=jayson['client'][_0x7c0f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bc6a9,_0x517db0,_0x4d01fb){return new BPromise(function(_0x23a491,_0x5ef22b){return client[_0x7c0f('0xc')](_0x2bc6a9,_0x4d01fb)['then'](function(_0x2c93c7){logger[_0x7c0f('0xd')](_0x7c0f('0xe'),_0x517db0,'request\x20sent');logger[_0x7c0f('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x517db0,_0x7c0f('0x10'),JSON[_0x7c0f('0x11')](_0x2c93c7));if(_0x2c93c7['error']){if(_0x2c93c7[_0x7c0f('0x12')]['code']===0x1f4){logger[_0x7c0f('0x12')](_0x7c0f('0xe'),_0x517db0,_0x2c93c7[_0x7c0f('0x12')][_0x7c0f('0x13')]);return _0x5ef22b(_0x2c93c7[_0x7c0f('0x12')]['message']);}logger[_0x7c0f('0x12')](_0x7c0f('0xe'),_0x517db0,_0x2c93c7[_0x7c0f('0x12')]['message']);return _0x23a491(_0x2c93c7[_0x7c0f('0x12')][_0x7c0f('0x13')]);}else{logger['info'](_0x7c0f('0xe'),_0x517db0,'request\x20sent');_0x23a491(_0x2c93c7[_0x7c0f('0x14')][_0x7c0f('0x13')]);}})[_0x7c0f('0x15')](function(_0x53efcf){logger[_0x7c0f('0x12')](_0x7c0f('0xe'),_0x517db0,_0x53efcf);_0x5ef22b(_0x53efcf);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 02ba4eb..071d25b 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 _0x1e26=['./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','show','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x432169,_0x7ffbe9){var _0x28e745=function(_0x810c68){while(--_0x810c68){_0x432169['push'](_0x432169['shift']());}};_0x28e745(++_0x7ffbe9);}(_0x1e26,0x93));var _0x61e2=function(_0x57ebdf,_0xee73b5){_0x57ebdf=_0x57ebdf-0x0;var _0x2956a3=_0x1e26[_0x57ebdf];return _0x2956a3;};'use strict';var multer=require(_0x61e2('0x0'));var util=require(_0x61e2('0x1'));var path=require(_0x61e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x61e2('0x3'));var router=express[_0x61e2('0x4')]();var fs_extra=require(_0x61e2('0x5'));var auth=require(_0x61e2('0x6'));var interaction=require(_0x61e2('0x7'));var config=require(_0x61e2('0x8'));var controller=require(_0x61e2('0x9'));router[_0x61e2('0xa')]('/',auth['isAuthenticated'](),controller[_0x61e2('0xb')]);router[_0x61e2('0xa')](_0x61e2('0xc'),auth[_0x61e2('0xd')](),controller[_0x61e2('0xe')]);router[_0x61e2('0xa')]('/:id/sounds',auth[_0x61e2('0xd')](),controller[_0x61e2('0xf')]);router[_0x61e2('0x10')]('/',auth[_0x61e2('0xd')](),controller[_0x61e2('0x11')]);router[_0x61e2('0x10')]('/:id/sounds',auth[_0x61e2('0xd')](),controller[_0x61e2('0x12')]);router[_0x61e2('0x13')](_0x61e2('0xc'),auth[_0x61e2('0xd')](),controller[_0x61e2('0x14')]);router[_0x61e2('0x15')](_0x61e2('0xc'),auth['isAuthenticated'](),controller[_0x61e2('0x16')]);router[_0x61e2('0x15')](_0x61e2('0x17'),auth[_0x61e2('0xd')](),controller[_0x61e2('0x18')]);module[_0x61e2('0x19')]=router; \ No newline at end of file +var _0x8d7d=['update','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','create','addSound','put','/:id'];(function(_0x1a732b,_0x4c52ce){var _0xcfdf0d=function(_0x42d329){while(--_0x42d329){_0x1a732b['push'](_0x1a732b['shift']());}};_0xcfdf0d(++_0x4c52ce);}(_0x8d7d,0x8e));var _0xd8d7=function(_0xed4d56,_0x3b749c){_0xed4d56=_0xed4d56-0x0;var _0x963cbd=_0x8d7d[_0xed4d56];return _0x963cbd;};'use strict';var multer=require(_0xd8d7('0x0'));var util=require(_0xd8d7('0x1'));var path=require(_0xd8d7('0x2'));var timeout=require(_0xd8d7('0x3'));var express=require(_0xd8d7('0x4'));var router=express['Router']();var fs_extra=require(_0xd8d7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd8d7('0x6'));var config=require(_0xd8d7('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0xd8d7('0x8')]('/',auth[_0xd8d7('0x9')](),controller[_0xd8d7('0xa')]);router['get']('/:id',auth[_0xd8d7('0x9')](),controller[_0xd8d7('0xb')]);router[_0xd8d7('0x8')](_0xd8d7('0xc'),auth[_0xd8d7('0x9')](),controller[_0xd8d7('0xd')]);router[_0xd8d7('0xe')]('/',auth['isAuthenticated'](),controller[_0xd8d7('0xf')]);router[_0xd8d7('0xe')](_0xd8d7('0xc'),auth[_0xd8d7('0x9')](),controller[_0xd8d7('0x10')]);router[_0xd8d7('0x11')](_0xd8d7('0x12'),auth['isAuthenticated'](),controller[_0xd8d7('0x13')]);router['delete']('/:id',auth[_0xd8d7('0x9')](),controller['destroy']);router['delete'](_0xd8d7('0x14'),auth['isAuthenticated'](),controller[_0xd8d7('0x15')]);module[_0xd8d7('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 98bcffc..37659e3 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 _0x780f=['TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM','files','mp3nb','quietmp3'];(function(_0x4651ae,_0x3d2bc0){var _0x29a97c=function(_0xf05c25){while(--_0xf05c25){_0x4651ae['push'](_0x4651ae['shift']());}};_0x29a97c(++_0x3d2bc0);}(_0x780f,0xad));var _0xf780=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x780f[_0x1b02bb];return _0x131245;};'use strict';var Sequelize=require(_0xf780('0x0'));module[_0xf780('0x1')]={'name':{'type':Sequelize[_0xf780('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xf780('0x3')]('custom',_0xf780('0x4'),_0xf780('0x5'),'quietmp3nb',_0xf780('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0xf780('0x4')},'directory':{'type':Sequelize[_0xf780('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xf780('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xf780('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xf780('0x7')},'defaultEntry':{'type':Sequelize[_0xf780('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdd28=['files','mp3nb','mp3','alpha','BOOLEAN','sequelize','STRING','name','custom'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xdd28,0x1b5));var _0x8dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd28[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8dd2('0x0'));module['exports']={'name':{'type':Sequelize[_0x8dd2('0x1')],'allowNull':![],'unique':_0x8dd2('0x2')},'mode':{'type':Sequelize['ENUM'](_0x8dd2('0x3'),_0x8dd2('0x4'),_0x8dd2('0x5'),'quietmp3nb','quietmp3',_0x8dd2('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x8dd2('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8dd2('0x7')},'format':{'type':Sequelize[_0x8dd2('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x8dd2('0x8')],'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 877dd0a..c444bd6 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 _0x243f=['rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters','filter','merge','VoiceMusicOnHold','includeAll','include','findAll','show','params','find','catch','body','create','sequelize','transaction','mode','files','join','server/files/moh','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','rmdirSync','ValidationError','message','Sound','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','basename','extname','symlinkSync','Sequelize','removeSound','findOne','id2','unlinkSync','getSounds','limit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','set','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','stack','name','send','map'];(function(_0x57b58b,_0x59b61e){var _0x453a3a=function(_0x7b6f5e){while(--_0x7b6f5e){_0x57b58b['push'](_0x57b58b['shift']());}};_0x453a3a(++_0x59b61e);}(_0x243f,0xb8));var _0xf243=function(_0x431ff8,_0x4085dd){_0x431ff8=_0x431ff8-0x0;var _0x84ccd4=_0x243f[_0x431ff8];return _0x84ccd4;};'use strict';var emlformat=require(_0xf243('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf243('0x1'));var jsonpatch=require(_0xf243('0x2'));var rp=require(_0xf243('0x3'));var moment=require(_0xf243('0x4'));var BPromise=require(_0xf243('0x5'));var Mustache=require(_0xf243('0x6'));var util=require(_0xf243('0x7'));var path=require(_0xf243('0x8'));var sox=require(_0xf243('0x9'));var csv=require('to-csv');var ejs=require(_0xf243('0xa'));var fs=require('fs');var fs_extra=require(_0xf243('0xb'));var _=require(_0xf243('0xc'));var squel=require('squel');var crypto=require(_0xf243('0xd'));var jsforce=require(_0xf243('0xe'));var deskjs=require(_0xf243('0xf'));var toCsv=require(_0xf243('0x10'));var querystring=require(_0xf243('0x11'));var Papa=require(_0xf243('0x12'));var Redis=require(_0xf243('0x13'));var authService=require(_0xf243('0x14'));var qs=require(_0xf243('0x15'));var as=require(_0xf243('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf243('0x17'))(_0xf243('0x18'));var utils=require(_0xf243('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf243('0x1a'))['db'];function respondWithStatusCode(_0x17b2cf,_0x475068){_0x475068=_0x475068||0xcc;return function(_0x54424a){if(_0x54424a){return _0x17b2cf[_0xf243('0x1b')](_0x475068);}return _0x17b2cf[_0xf243('0x1c')](_0x475068)[_0xf243('0x1d')]();};}function respondWithResult(_0x1dd680,_0x44d0d2){_0x44d0d2=_0x44d0d2||0xc8;return function(_0x3f800a){if(_0x3f800a){return _0x1dd680['status'](_0x44d0d2)[_0xf243('0x1e')](_0x3f800a);}};}function respondWithFilteredResult(_0x1e20cb,_0x41e485){return function(_0x2b21fc){if(_0x2b21fc){var _0x7aba92=typeof _0x41e485['offset']==='undefined'&&typeof _0x41e485['limit']===_0xf243('0x1f');var _0x353e00=_0x2b21fc[_0xf243('0x20')];var _0x8a3ee9=_0x7aba92?0x0:_0x41e485['offset'];var _0x4fd41e=_0x7aba92?_0x2b21fc[_0xf243('0x20')]:_0x41e485['offset']+_0x41e485['limit'];var _0x10b05e;if(_0x4fd41e>=_0x353e00){_0x4fd41e=_0x353e00;_0x10b05e=0xc8;}else{_0x10b05e=0xce;}_0x1e20cb[_0xf243('0x1c')](_0x10b05e);return _0x1e20cb[_0xf243('0x21')]('Content-Range',_0x8a3ee9+'-'+_0x4fd41e+'/'+_0x353e00)[_0xf243('0x1e')](_0x2b21fc);}return null;};}function patchUpdates(_0x30c2c7){return function(_0x4c10a9){try{jsonpatch[_0xf243('0x22')](_0x4c10a9,_0x30c2c7,!![]);}catch(_0x20b70f){return BPromise[_0xf243('0x23')](_0x20b70f);}return _0x4c10a9[_0xf243('0x24')]();};}function saveUpdates(_0x2bc0ed,_0x19cc09){return function(_0x38f7e0){if(_0x38f7e0){return _0x38f7e0[_0xf243('0x25')](_0x2bc0ed)[_0xf243('0x26')](function(_0x555b82){return _0x555b82;});}return null;};}function removeEntity(_0x1b80df,_0x284706){return function(_0x3a00c4){if(_0x3a00c4){return _0x3a00c4['destroy']()[_0xf243('0x26')](function(){var _0x5d5ab1=_0x3a00c4[_0xf243('0x27')]({'plain':!![]});var _0x47ad77=_0xf243('0x28');return db[_0xf243('0x29')][_0xf243('0x2a')]({'where':{'type':_0x47ad77,'resourceId':_0x5d5ab1['id']}})['then'](function(){return _0x3a00c4;});})[_0xf243('0x26')](function(){_0x1b80df[_0xf243('0x1c')](0xcc)[_0xf243('0x1d')]();});}};}function handleEntityNotFound(_0xfdcedb,_0x505eed){return function(_0x3020f5){if(!_0x3020f5){_0xfdcedb[_0xf243('0x1b')](0x194);}return _0x3020f5;};}function handleError(_0x1b2b2d,_0x49361a){_0x49361a=_0x49361a||0x1f4;return function(_0x316949){logger[_0xf243('0x2b')](_0x316949[_0xf243('0x2c')]);if(_0x316949[_0xf243('0x2d')]){delete _0x316949['name'];}_0x1b2b2d[_0xf243('0x1c')](_0x49361a)[_0xf243('0x2e')](_0x316949);};}exports['index']=function(_0x59c0ed,_0x285d72){var _0x48f4e0={},_0x2a905c={},_0x1542b5={'count':0x0,'rows':[]};var _0x1a9ce0=_[_0xf243('0x2f')](db['VoiceMusicOnHold'][_0xf243('0x30')],function(_0x44dcb0){return{'name':_0x44dcb0[_0xf243('0x31')],'type':_0x44dcb0[_0xf243('0x32')][_0xf243('0x33')]};});_0x2a905c[_0xf243('0x34')]=_[_0xf243('0x2f')](_0x1a9ce0,_0xf243('0x2d'));_0x2a905c['query']=_[_0xf243('0x35')](_0x59c0ed[_0xf243('0x36')]);_0x2a905c['filters']=_[_0xf243('0x37')](_0x2a905c['model'],_0x2a905c['query']);_0x48f4e0[_0xf243('0x38')]=_[_0xf243('0x37')](_0x2a905c[_0xf243('0x34')],qs[_0xf243('0x39')](_0x59c0ed[_0xf243('0x36')][_0xf243('0x39')]));_0x48f4e0[_0xf243('0x38')]=_0x48f4e0['attributes'][_0xf243('0x3a')]?_0x48f4e0['attributes']:_0x2a905c[_0xf243('0x34')];if(!_0x59c0ed[_0xf243('0x36')][_0xf243('0x3b')](_0xf243('0x3c'))){_0x48f4e0['limit']=qs['limit'](_0x59c0ed[_0xf243('0x36')]['limit']);_0x48f4e0[_0xf243('0x3d')]=qs[_0xf243('0x3d')](_0x59c0ed[_0xf243('0x36')][_0xf243('0x3d')]);}_0x48f4e0[_0xf243('0x3e')]=qs[_0xf243('0x3f')](_0x59c0ed['query']['sort']);delete _0x59c0ed['query'][_0xf243('0x3f')];_0x48f4e0[_0xf243('0x40')]=qs['filters'](_[_0xf243('0x41')](_0x59c0ed[_0xf243('0x36')],_0x2a905c[_0xf243('0x42')]),_0x1a9ce0);if(_0x59c0ed[_0xf243('0x36')][_0xf243('0x43')]){_0x48f4e0[_0xf243('0x40')]=_[_0xf243('0x44')](_0x48f4e0[_0xf243('0x40')],{'$or':_[_0xf243('0x2f')](_0x1a9ce0,function(_0x5760fa){if(_0x5760fa[_0xf243('0x32')]!=='VIRTUAL'){var _0x3d7c10={};_0x3d7c10[_0x5760fa[_0xf243('0x2d')]]={'$like':'%'+_0x59c0ed[_0xf243('0x36')][_0xf243('0x43')]+'%'};return _0x3d7c10;}})});}_0x48f4e0=_[_0xf243('0x44')]({},_0x48f4e0,_0x59c0ed['options']);var _0x5a413b={'where':_0x48f4e0['where']};return db[_0xf243('0x45')][_0xf243('0x20')](_0x5a413b)[_0xf243('0x26')](function(_0x3d21a8){_0x1542b5['count']=_0x3d21a8;if(_0x59c0ed[_0xf243('0x36')][_0xf243('0x46')]){_0x48f4e0[_0xf243('0x47')]=[{'all':!![]}];}return db[_0xf243('0x45')][_0xf243('0x48')](_0x48f4e0);})[_0xf243('0x26')](function(_0x571892){_0x1542b5['rows']=_0x571892;return _0x1542b5;})['then'](respondWithFilteredResult(_0x285d72,_0x48f4e0))['catch'](handleError(_0x285d72,null));};exports[_0xf243('0x49')]=function(_0x1d8cda,_0x5c4994){var _0x215ff2={'raw':![],'where':{'id':_0x1d8cda[_0xf243('0x4a')]['id']}},_0x25e3cb={};_0x25e3cb[_0xf243('0x34')]=_[_0xf243('0x35')](db[_0xf243('0x45')]['rawAttributes']);_0x25e3cb[_0xf243('0x36')]=_['keys'](_0x1d8cda['query']);_0x25e3cb['filters']=_[_0xf243('0x37')](_0x25e3cb[_0xf243('0x34')],_0x25e3cb[_0xf243('0x36')]);_0x215ff2['attributes']=_[_0xf243('0x37')](_0x25e3cb['model'],qs[_0xf243('0x39')](_0x1d8cda[_0xf243('0x36')][_0xf243('0x39')]));_0x215ff2[_0xf243('0x38')]=_0x215ff2['attributes']['length']?_0x215ff2['attributes']:_0x25e3cb[_0xf243('0x34')];if(_0x1d8cda[_0xf243('0x36')][_0xf243('0x46')]){_0x215ff2[_0xf243('0x47')]=[{'all':!![]}];}_0x215ff2=_['merge']({},_0x215ff2,_0x1d8cda['options']);return db[_0xf243('0x45')][_0xf243('0x4b')](_0x215ff2)[_0xf243('0x26')](handleEntityNotFound(_0x5c4994,null))[_0xf243('0x26')](respondWithResult(_0x5c4994,null))[_0xf243('0x4c')](handleError(_0x5c4994,null));};exports[_0xf243('0x25')]=function(_0x55a982,_0x423431){if(_0x55a982[_0xf243('0x4d')]['id']){delete _0x55a982[_0xf243('0x4d')]['id'];}return db[_0xf243('0x45')]['find']({'where':{'id':_0x55a982[_0xf243('0x4a')]['id']}})[_0xf243('0x26')](handleEntityNotFound(_0x423431,null))[_0xf243('0x26')](saveUpdates(_0x55a982[_0xf243('0x4d')],null))[_0xf243('0x26')](respondWithResult(_0x423431,null))[_0xf243('0x4c')](handleError(_0x423431,null));};exports[_0xf243('0x4e')]=function(_0x19569c,_0x305f29,_0x5912c0){return db[_0xf243('0x4f')][_0xf243('0x50')](function(_0x18f92a){if(_0x19569c[_0xf243('0x4d')][_0xf243('0x51')]===_0xf243('0x52')){_0x19569c[_0xf243('0x4d')]['directory']=path[_0xf243('0x53')](config['root'],_0xf243('0x54'),_0x19569c[_0xf243('0x4d')][_0xf243('0x2d')]);}return db[_0xf243('0x45')][_0xf243('0x4e')](_0x19569c['body'],{'transaction':_0x18f92a})[_0xf243('0x26')](function(_0x10773a){if(_0x19569c[_0xf243('0x4d')][_0xf243('0x51')]===_0xf243('0x52')){fs[_0xf243('0x55')](_0x10773a[_0xf243('0x56')],parseInt(_0xf243('0x57'),0x8));}var _0x3478d6=_0x19569c[_0xf243('0x58')][_0xf243('0x27')]({'plain':!![]});if(!_0x3478d6)throw new Error(_0xf243('0x59'));if(_0x3478d6[_0xf243('0x5a')]===_0xf243('0x58')){var _0xa864ab=_0x10773a[_0xf243('0x27')]({'plain':!![]});return db[_0xf243('0x5b')][_0xf243('0x4b')]({'where':{'name':_0xf243('0x28'),'userProfileId':_0x3478d6[_0xf243('0x5c')]},'raw':!![]})[_0xf243('0x26')](function(_0x2da952){if(_0x2da952&&_0x2da952[_0xf243('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0xa864ab[_0xf243('0x2d')],'resourceId':_0xa864ab['id'],'type':_0x2da952[_0xf243('0x2d')],'sectionId':_0x2da952['id']},{})[_0xf243('0x26')](function(){return _0x10773a;});}else{return _0x10773a;}})[_0xf243('0x4c')](function(_0x35af61){logger[_0xf243('0x2b')](_0xf243('0x5e'),_0x35af61);});}return _0x10773a;});})[_0xf243('0x26')](respondWithResult(_0x305f29,0xc9))[_0xf243('0x4c')](handleError(_0x305f29,null));};exports[_0xf243('0x2a')]=function(_0x200d99,_0x1604b5,_0x454d86){var _0x59e88e;return db['VoiceMusicOnHold'][_0xf243('0x4b')]({'where':{'id':_0x200d99[_0xf243('0x4a')]['id']}})['then'](function(_0x727fa2){if(_0x727fa2){return db[_0xf243('0x4f')]['transaction'](function(_0x3960cd){return _0x727fa2[_0xf243('0x2a')]({'transaction':_0x3960cd,'raw':!![]})[_0xf243('0x26')](function(_0x185a5b){if(_0x185a5b[_0xf243('0x56')]){fs[_0xf243('0x5f')](_0x185a5b['directory'])['forEach'](function(_0x508267){fs['unlinkSync'](path[_0xf243('0x53')](_0x185a5b[_0xf243('0x56')],_0x508267));});fs[_0xf243('0x60')](_0x185a5b['directory']);}return _0x185a5b;});})[_0xf243('0x4c')](function(_0x1d685b){throw new db['Sequelize'][(_0xf243('0x61'))](_0x1d685b[_0xf243('0x62')]);});}})['then'](handleEntityNotFound(_0x1604b5,null))['then'](removeEntity(_0x1604b5,null))['catch'](handleError(_0x1604b5,null));};exports['addSound']=function(_0x1f0390,_0x27f275,_0x448fac){return db[_0xf243('0x4f')][_0xf243('0x50')](function(_0x25b0c){var _0x23cc9c;return db['VoiceMusicOnHold'][_0xf243('0x4b')]({'where':{'id':_0x1f0390[_0xf243('0x4a')]['id']}})[_0xf243('0x26')](function(_0x3c44b2){if(_0x3c44b2){_0x23cc9c=_0x3c44b2;return _0x3c44b2['addSound'](_0x1f0390[_0xf243('0x4d')]['id'],{'transaction':_0x25b0c});}})['then'](function(_0x10021c){if(_0x10021c){return db[_0xf243('0x63')]['findOne']({'where':{'id':_0x1f0390[_0xf243('0x4d')]['id']},'attributes':['id',_0xf243('0x2d'),_0xf243('0x64'),_0xf243('0x65'),_0xf243('0x66')],'raw':!![]});}})[_0xf243('0x26')](function(_0x3dc43e){if(_0x3dc43e){var _0x42a1f1=path[_0xf243('0x53')](config[_0xf243('0x67')],_0xf243('0x68'),util[_0xf243('0x69')]('%s.%s',path[_0xf243('0x6a')](_0x3dc43e[_0xf243('0x64')],path[_0xf243('0x6b')](_0x3dc43e[_0xf243('0x64')])),_0x3dc43e[_0xf243('0x65')]));var _0x23e933=path['join'](config['root'],_0xf243('0x54'),_0x23cc9c[_0xf243('0x2d')],util[_0xf243('0x69')]('%s.%s',_0x3dc43e[_0xf243('0x2d')],_0x3dc43e[_0xf243('0x65')]));fs[_0xf243('0x6c')](_0x42a1f1,_0x23e933);return _0x3dc43e;}})[_0xf243('0x4c')](function(_0x3d21d3){throw new db[(_0xf243('0x6d'))]['ValidationError'](_0x3d21d3['message']);});})['then'](handleEntityNotFound(_0x27f275,null))[_0xf243('0x26')](respondWithResult(_0x27f275,0xc9))[_0xf243('0x4c')](handleError(_0x27f275,null));};exports[_0xf243('0x6e')]=function(_0x4c404d,_0x184f54,_0x580945){return db[_0xf243('0x4f')][_0xf243('0x50')](function(_0x5b873f){var _0x3ef6c0;return db[_0xf243('0x45')][_0xf243('0x6f')]({'where':{'id':_0x4c404d[_0xf243('0x4a')]['id']}})['then'](handleEntityNotFound(_0x184f54,null))['then'](function(_0xb980a1){if(_0xb980a1){_0x3ef6c0=_0xb980a1;return _0xb980a1[_0xf243('0x6e')](_0x4c404d[_0xf243('0x4a')][_0xf243('0x70')]);}})[_0xf243('0x26')](function(_0x5b665f){if(_0x5b665f){return db[_0xf243('0x63')]['findOne']({'where':{'id':_0x4c404d[_0xf243('0x4a')][_0xf243('0x70')]},'attributes':['id',_0xf243('0x2d'),_0xf243('0x64'),_0xf243('0x65'),_0xf243('0x66')],'raw':!![]});}})[_0xf243('0x26')](function(_0xd22997){if(_0xd22997){fs[_0xf243('0x71')](path[_0xf243('0x53')](_0x3ef6c0[_0xf243('0x56')],util[_0xf243('0x69')]('%s.%s',_0xd22997[_0xf243('0x2d')],_0xd22997[_0xf243('0x65')])));return _0xd22997;}})['catch'](function(_0x24f1a5){throw new db[(_0xf243('0x6d'))][(_0xf243('0x61'))](_0x24f1a5['message']);});})['then'](handleEntityNotFound(_0x184f54,null))[_0xf243('0x26')](respondWithStatusCode(_0x184f54,0xcc))[_0xf243('0x4c')](handleError(_0x184f54,null));};exports[_0xf243('0x72')]=function(_0xdee24a,_0xc3624a,_0x484093){var _0x19fd9c={};var _0x22f503={};var _0x570ac1;var _0x388fd4;return db[_0xf243('0x45')][_0xf243('0x6f')]({'where':{'id':_0xdee24a['params']['id']}})['then'](handleEntityNotFound(_0xc3624a,null))['then'](function(_0x168104){if(_0x168104){_0x570ac1=_0x168104;_0x22f503[_0xf243('0x34')]=_[_0xf243('0x35')](db['Sound']['rawAttributes']);_0x22f503['query']=_[_0xf243('0x35')](_0xdee24a['query']);_0x22f503[_0xf243('0x42')]=_[_0xf243('0x37')](_0x22f503[_0xf243('0x34')],_0x22f503[_0xf243('0x36')]);_0x19fd9c[_0xf243('0x38')]=_[_0xf243('0x37')](_0x22f503[_0xf243('0x34')],qs[_0xf243('0x39')](_0xdee24a['query'][_0xf243('0x39')]));_0x19fd9c['attributes']=_0x19fd9c[_0xf243('0x38')][_0xf243('0x3a')]?_0x19fd9c[_0xf243('0x38')]:_0x22f503['model'];_0x19fd9c[_0xf243('0x3e')]=qs[_0xf243('0x3f')](_0xdee24a['query']['sort']);_0x19fd9c[_0xf243('0x40')]=qs[_0xf243('0x42')](_[_0xf243('0x41')](_0xdee24a[_0xf243('0x36')],_0x22f503[_0xf243('0x42')]));if(_0xdee24a['query'][_0xf243('0x43')]){_0x19fd9c[_0xf243('0x40')]=_[_0xf243('0x44')](_0x19fd9c[_0xf243('0x40')],{'$or':_[_0xf243('0x2f')](_0x19fd9c[_0xf243('0x38')],function(_0x3cff57){var _0xf94da4={};_0xf94da4[_0x3cff57]={'$like':'%'+_0xdee24a['query']['filter']+'%'};return _0xf94da4;})});}_0x19fd9c=_['merge']({},_0x19fd9c,_0xdee24a['options']);return _0x570ac1[_0xf243('0x72')](_0x19fd9c);}})[_0xf243('0x26')](function(_0x59f716){if(_0x59f716){_0x388fd4=_0x59f716[_0xf243('0x3a')];if(!_0xdee24a['query'][_0xf243('0x3b')]('nolimit')){_0x19fd9c[_0xf243('0x73')]=qs[_0xf243('0x73')](_0xdee24a[_0xf243('0x36')][_0xf243('0x73')]);_0x19fd9c[_0xf243('0x3d')]=qs[_0xf243('0x3d')](_0xdee24a['query'][_0xf243('0x3d')]);}return _0x570ac1['getSounds'](_0x19fd9c);}})[_0xf243('0x26')](function(_0x5ca75b){if(_0x5ca75b){return _0x5ca75b?{'count':_0x388fd4,'rows':_0x5ca75b}:null;}})[_0xf243('0x26')](respondWithResult(_0xc3624a,null))[_0xf243('0x4c')](handleError(_0xc3624a,null));}; \ No newline at end of file +var _0x72d6=['merge','VIRTUAL','options','show','keys','includeAll','include','catch','body','params','create','transaction','mode','directory','root','server/files/moh','files','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','readdirSync','forEach','unlinkSync','join','rmdirSync','Sequelize','addSound','sequelize','Sound','findOne','converted_format','createdAt','format','%s.%s','save_name','extname','symlinkSync','message','removeSound','id2','ValidationError','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','MusicOnHolds','error','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x1d40d5,_0x1ee7a0){var _0x28bdcb=function(_0x355f48){while(--_0x355f48){_0x1d40d5['push'](_0x1d40d5['shift']());}};_0x28bdcb(++_0x1ee7a0);}(_0x72d6,0x17d));var _0x672d=function(_0x4a3a12,_0x1b6696){_0x4a3a12=_0x4a3a12-0x0;var _0x11b785=_0x72d6[_0x4a3a12];return _0x11b785;};'use strict';var emlformat=require(_0x672d('0x0'));var rimraf=require(_0x672d('0x1'));var zipdir=require(_0x672d('0x2'));var jsonpatch=require(_0x672d('0x3'));var rp=require(_0x672d('0x4'));var moment=require(_0x672d('0x5'));var BPromise=require(_0x672d('0x6'));var Mustache=require(_0x672d('0x7'));var util=require('util');var path=require('path');var sox=require(_0x672d('0x8'));var csv=require(_0x672d('0x9'));var ejs=require(_0x672d('0xa'));var fs=require('fs');var fs_extra=require(_0x672d('0xb'));var _=require(_0x672d('0xc'));var squel=require(_0x672d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x672d('0xe'));var toCsv=require(_0x672d('0x9'));var querystring=require('querystring');var Papa=require(_0x672d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x672d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x672d('0x11'));var logger=require(_0x672d('0x12'))(_0x672d('0x13'));var utils=require('../../config/utils');var config=require(_0x672d('0x14'));var licenseUtil=require(_0x672d('0x15'));var db=require(_0x672d('0x16'))['db'];function respondWithStatusCode(_0x2a9759,_0x4de838){_0x4de838=_0x4de838||0xcc;return function(_0x267099){if(_0x267099){return _0x2a9759['sendStatus'](_0x4de838);}return _0x2a9759[_0x672d('0x17')](_0x4de838)[_0x672d('0x18')]();};}function respondWithResult(_0x959a29,_0x1169ed){_0x1169ed=_0x1169ed||0xc8;return function(_0x3afebd){if(_0x3afebd){return _0x959a29[_0x672d('0x17')](_0x1169ed)[_0x672d('0x19')](_0x3afebd);}};}function respondWithFilteredResult(_0x10473f,_0x35c153){return function(_0x4d1519){if(_0x4d1519){var _0x4d0364=typeof _0x35c153[_0x672d('0x1a')]==='undefined'&&typeof _0x35c153[_0x672d('0x1b')]===_0x672d('0x1c');var _0x56460c=_0x4d1519[_0x672d('0x1d')];var _0x869074=_0x4d0364?0x0:_0x35c153[_0x672d('0x1a')];var _0x3cd0ac=_0x4d0364?_0x4d1519[_0x672d('0x1d')]:_0x35c153[_0x672d('0x1a')]+_0x35c153[_0x672d('0x1b')];var _0x4b8e17;if(_0x3cd0ac>=_0x56460c){_0x3cd0ac=_0x56460c;_0x4b8e17=0xc8;}else{_0x4b8e17=0xce;}_0x10473f[_0x672d('0x17')](_0x4b8e17);return _0x10473f[_0x672d('0x1e')](_0x672d('0x1f'),_0x869074+'-'+_0x3cd0ac+'/'+_0x56460c)[_0x672d('0x19')](_0x4d1519);}return null;};}function patchUpdates(_0x5dfc23){return function(_0x4c3941){try{jsonpatch[_0x672d('0x20')](_0x4c3941,_0x5dfc23,!![]);}catch(_0x2947c8){return BPromise[_0x672d('0x21')](_0x2947c8);}return _0x4c3941[_0x672d('0x22')]();};}function saveUpdates(_0x120a71,_0x3f0f2e){return function(_0x36ace2){if(_0x36ace2){return _0x36ace2[_0x672d('0x23')](_0x120a71)[_0x672d('0x24')](function(_0x646baf){return _0x646baf;});}return null;};}function removeEntity(_0x3dd878,_0x5f5a3b){return function(_0x23ceb1){if(_0x23ceb1){return _0x23ceb1[_0x672d('0x25')]()['then'](function(){var _0xd03350=_0x23ceb1['get']({'plain':!![]});var _0x4dbab2=_0x672d('0x26');return db['UserProfileResource'][_0x672d('0x25')]({'where':{'type':_0x4dbab2,'resourceId':_0xd03350['id']}})[_0x672d('0x24')](function(){return _0x23ceb1;});})[_0x672d('0x24')](function(){_0x3dd878['status'](0xcc)[_0x672d('0x18')]();});}};}function handleEntityNotFound(_0x55130e,_0x4b2fb3){return function(_0x5f5a02){if(!_0x5f5a02){_0x55130e['sendStatus'](0x194);}return _0x5f5a02;};}function handleError(_0x510d40,_0x1a4d3c){_0x1a4d3c=_0x1a4d3c||0x1f4;return function(_0xf60f45){logger[_0x672d('0x27')](_0xf60f45[_0x672d('0x28')]);if(_0xf60f45[_0x672d('0x29')]){delete _0xf60f45[_0x672d('0x29')];}_0x510d40[_0x672d('0x17')](_0x1a4d3c)[_0x672d('0x2a')](_0xf60f45);};}exports[_0x672d('0x2b')]=function(_0x40c953,_0x5b2afc){var _0x4ce190={},_0x3d1c08={},_0x517201={'count':0x0,'rows':[]};var _0x2a7f91=_[_0x672d('0x2c')](db[_0x672d('0x2d')]['rawAttributes'],function(_0x444b96){return{'name':_0x444b96[_0x672d('0x2e')],'type':_0x444b96[_0x672d('0x2f')][_0x672d('0x30')]};});_0x3d1c08['model']=_[_0x672d('0x2c')](_0x2a7f91,'name');_0x3d1c08['query']=_['keys'](_0x40c953[_0x672d('0x31')]);_0x3d1c08[_0x672d('0x32')]=_[_0x672d('0x33')](_0x3d1c08[_0x672d('0x34')],_0x3d1c08[_0x672d('0x31')]);_0x4ce190[_0x672d('0x35')]=_[_0x672d('0x33')](_0x3d1c08[_0x672d('0x34')],qs[_0x672d('0x36')](_0x40c953[_0x672d('0x31')][_0x672d('0x36')]));_0x4ce190['attributes']=_0x4ce190[_0x672d('0x35')][_0x672d('0x37')]?_0x4ce190[_0x672d('0x35')]:_0x3d1c08['model'];if(!_0x40c953['query'][_0x672d('0x38')](_0x672d('0x39'))){_0x4ce190[_0x672d('0x1b')]=qs[_0x672d('0x1b')](_0x40c953[_0x672d('0x31')][_0x672d('0x1b')]);_0x4ce190[_0x672d('0x1a')]=qs[_0x672d('0x1a')](_0x40c953[_0x672d('0x31')][_0x672d('0x1a')]);}_0x4ce190[_0x672d('0x3a')]=qs[_0x672d('0x3b')](_0x40c953['query']['sort']);delete _0x40c953[_0x672d('0x31')]['sort'];_0x4ce190[_0x672d('0x3c')]=qs[_0x672d('0x32')](_[_0x672d('0x3d')](_0x40c953[_0x672d('0x31')],_0x3d1c08[_0x672d('0x32')]),_0x2a7f91);if(_0x40c953[_0x672d('0x31')][_0x672d('0x3e')]){_0x4ce190[_0x672d('0x3c')]=_[_0x672d('0x3f')](_0x4ce190['where'],{'$or':_['map'](_0x2a7f91,function(_0x332a2d){if(_0x332a2d['type']!==_0x672d('0x40')){var _0x2550d4={};_0x2550d4[_0x332a2d[_0x672d('0x29')]]={'$like':'%'+_0x40c953['query'][_0x672d('0x3e')]+'%'};return _0x2550d4;}})});}_0x4ce190=_['merge']({},_0x4ce190,_0x40c953[_0x672d('0x41')]);var _0x625e04={'where':_0x4ce190[_0x672d('0x3c')]};return db[_0x672d('0x2d')]['count'](_0x625e04)['then'](function(_0x130fcf){_0x517201[_0x672d('0x1d')]=_0x130fcf;if(_0x40c953[_0x672d('0x31')]['includeAll']){_0x4ce190['include']=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x4ce190);})['then'](function(_0x9d7ea2){_0x517201['rows']=_0x9d7ea2;return _0x517201;})['then'](respondWithFilteredResult(_0x5b2afc,_0x4ce190))['catch'](handleError(_0x5b2afc,null));};exports[_0x672d('0x42')]=function(_0xcbdcac,_0x260281){var _0x8cc80d={'raw':![],'where':{'id':_0xcbdcac['params']['id']}},_0x5d028f={};_0x5d028f[_0x672d('0x34')]=_[_0x672d('0x43')](db[_0x672d('0x2d')]['rawAttributes']);_0x5d028f[_0x672d('0x31')]=_[_0x672d('0x43')](_0xcbdcac[_0x672d('0x31')]);_0x5d028f['filters']=_[_0x672d('0x33')](_0x5d028f[_0x672d('0x34')],_0x5d028f['query']);_0x8cc80d[_0x672d('0x35')]=_[_0x672d('0x33')](_0x5d028f[_0x672d('0x34')],qs[_0x672d('0x36')](_0xcbdcac[_0x672d('0x31')][_0x672d('0x36')]));_0x8cc80d['attributes']=_0x8cc80d[_0x672d('0x35')][_0x672d('0x37')]?_0x8cc80d[_0x672d('0x35')]:_0x5d028f['model'];if(_0xcbdcac[_0x672d('0x31')][_0x672d('0x44')]){_0x8cc80d[_0x672d('0x45')]=[{'all':!![]}];}_0x8cc80d=_['merge']({},_0x8cc80d,_0xcbdcac[_0x672d('0x41')]);return db[_0x672d('0x2d')]['find'](_0x8cc80d)['then'](handleEntityNotFound(_0x260281,null))['then'](respondWithResult(_0x260281,null))[_0x672d('0x46')](handleError(_0x260281,null));};exports['update']=function(_0x11e81b,_0x55fad7){if(_0x11e81b[_0x672d('0x47')]['id']){delete _0x11e81b[_0x672d('0x47')]['id'];}return db[_0x672d('0x2d')]['find']({'where':{'id':_0x11e81b[_0x672d('0x48')]['id']}})[_0x672d('0x24')](handleEntityNotFound(_0x55fad7,null))[_0x672d('0x24')](saveUpdates(_0x11e81b[_0x672d('0x47')],null))['then'](respondWithResult(_0x55fad7,null))[_0x672d('0x46')](handleError(_0x55fad7,null));};exports[_0x672d('0x49')]=function(_0x58215a,_0x55b2b1,_0x63862e){return db['sequelize'][_0x672d('0x4a')](function(_0x54db47){if(_0x58215a[_0x672d('0x47')][_0x672d('0x4b')]==='files'){_0x58215a[_0x672d('0x47')][_0x672d('0x4c')]=path['join'](config[_0x672d('0x4d')],_0x672d('0x4e'),_0x58215a[_0x672d('0x47')][_0x672d('0x29')]);}return db['VoiceMusicOnHold'][_0x672d('0x49')](_0x58215a[_0x672d('0x47')],{'transaction':_0x54db47})['then'](function(_0x1ca1a2){if(_0x58215a[_0x672d('0x47')][_0x672d('0x4b')]===_0x672d('0x4f')){fs[_0x672d('0x50')](_0x1ca1a2[_0x672d('0x4c')],parseInt(_0x672d('0x51'),0x8));}var _0x1c54c2=_0x58215a[_0x672d('0x52')][_0x672d('0x53')]({'plain':!![]});if(!_0x1c54c2)throw new Error(_0x672d('0x54'));if(_0x1c54c2[_0x672d('0x55')]===_0x672d('0x52')){var _0x594882=_0x1ca1a2[_0x672d('0x53')]({'plain':!![]});return db['UserProfileSection'][_0x672d('0x56')]({'where':{'name':'MusicOnHolds','userProfileId':_0x1c54c2[_0x672d('0x57')]},'raw':!![]})[_0x672d('0x24')](function(_0x3dac60){if(_0x3dac60&&_0x3dac60[_0x672d('0x58')]===0x0){return db['UserProfileResource'][_0x672d('0x49')]({'name':_0x594882[_0x672d('0x29')],'resourceId':_0x594882['id'],'type':_0x3dac60[_0x672d('0x29')],'sectionId':_0x3dac60['id']},{})[_0x672d('0x24')](function(){return _0x1ca1a2;});}else{return _0x1ca1a2;}})['catch'](function(_0x2128fc){logger[_0x672d('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2128fc);});}return _0x1ca1a2;});})[_0x672d('0x24')](respondWithResult(_0x55b2b1,0xc9))[_0x672d('0x46')](handleError(_0x55b2b1,null));};exports[_0x672d('0x25')]=function(_0x43c7da,_0x3f8be9,_0x351909){var _0x5e4669;return db[_0x672d('0x2d')][_0x672d('0x56')]({'where':{'id':_0x43c7da['params']['id']}})['then'](function(_0x1888c6){if(_0x1888c6){return db['sequelize'][_0x672d('0x4a')](function(_0x59e355){return _0x1888c6[_0x672d('0x25')]({'transaction':_0x59e355,'raw':!![]})[_0x672d('0x24')](function(_0x2f98d1){if(_0x2f98d1[_0x672d('0x4c')]){fs[_0x672d('0x59')](_0x2f98d1[_0x672d('0x4c')])[_0x672d('0x5a')](function(_0x22d94b){fs[_0x672d('0x5b')](path[_0x672d('0x5c')](_0x2f98d1['directory'],_0x22d94b));});fs[_0x672d('0x5d')](_0x2f98d1[_0x672d('0x4c')]);}return _0x2f98d1;});})[_0x672d('0x46')](function(_0x1571dd){throw new db[(_0x672d('0x5e'))]['ValidationError'](_0x1571dd['message']);});}})['then'](handleEntityNotFound(_0x3f8be9,null))['then'](removeEntity(_0x3f8be9,null))['catch'](handleError(_0x3f8be9,null));};exports[_0x672d('0x5f')]=function(_0x452b68,_0x2ce3b9,_0x244428){return db[_0x672d('0x60')][_0x672d('0x4a')](function(_0x11aab0){var _0x5cc6ce;return db[_0x672d('0x2d')][_0x672d('0x56')]({'where':{'id':_0x452b68[_0x672d('0x48')]['id']}})[_0x672d('0x24')](function(_0x2a8845){if(_0x2a8845){_0x5cc6ce=_0x2a8845;return _0x2a8845['addSound'](_0x452b68[_0x672d('0x47')]['id'],{'transaction':_0x11aab0});}})[_0x672d('0x24')](function(_0x210105){if(_0x210105){return db[_0x672d('0x61')][_0x672d('0x62')]({'where':{'id':_0x452b68[_0x672d('0x47')]['id']},'attributes':['id',_0x672d('0x29'),'save_name',_0x672d('0x63'),_0x672d('0x64')],'raw':!![]});}})[_0x672d('0x24')](function(_0x13693e){if(_0x13693e){var _0x1827f7=path[_0x672d('0x5c')](config['root'],'server/files/sounds/converted',util[_0x672d('0x65')](_0x672d('0x66'),path['basename'](_0x13693e[_0x672d('0x67')],path[_0x672d('0x68')](_0x13693e[_0x672d('0x67')])),_0x13693e[_0x672d('0x63')]));var _0x30771d=path[_0x672d('0x5c')](config[_0x672d('0x4d')],_0x672d('0x4e'),_0x5cc6ce[_0x672d('0x29')],util[_0x672d('0x65')](_0x672d('0x66'),_0x13693e[_0x672d('0x29')],_0x13693e[_0x672d('0x63')]));fs[_0x672d('0x69')](_0x1827f7,_0x30771d);return _0x13693e;}})[_0x672d('0x46')](function(_0x3e421f){throw new db[(_0x672d('0x5e'))]['ValidationError'](_0x3e421f[_0x672d('0x6a')]);});})[_0x672d('0x24')](handleEntityNotFound(_0x2ce3b9,null))[_0x672d('0x24')](respondWithResult(_0x2ce3b9,0xc9))[_0x672d('0x46')](handleError(_0x2ce3b9,null));};exports['removeSound']=function(_0x20cc7b,_0xbac658,_0x161330){return db[_0x672d('0x60')]['transaction'](function(_0x4ef97b){var _0x42c8fd;return db[_0x672d('0x2d')][_0x672d('0x62')]({'where':{'id':_0x20cc7b[_0x672d('0x48')]['id']}})[_0x672d('0x24')](handleEntityNotFound(_0xbac658,null))[_0x672d('0x24')](function(_0x3ea89f){if(_0x3ea89f){_0x42c8fd=_0x3ea89f;return _0x3ea89f[_0x672d('0x6b')](_0x20cc7b['params'][_0x672d('0x6c')]);}})[_0x672d('0x24')](function(_0x61c22d){if(_0x61c22d){return db[_0x672d('0x61')][_0x672d('0x62')]({'where':{'id':_0x20cc7b[_0x672d('0x48')][_0x672d('0x6c')]},'attributes':['id','name',_0x672d('0x67'),'converted_format',_0x672d('0x64')],'raw':!![]});}})['then'](function(_0xa15589){if(_0xa15589){fs['unlinkSync'](path['join'](_0x42c8fd[_0x672d('0x4c')],util[_0x672d('0x65')](_0x672d('0x66'),_0xa15589[_0x672d('0x29')],_0xa15589[_0x672d('0x63')])));return _0xa15589;}})[_0x672d('0x46')](function(_0x5bbd93){throw new db['Sequelize'][(_0x672d('0x6d'))](_0x5bbd93[_0x672d('0x6a')]);});})[_0x672d('0x24')](handleEntityNotFound(_0xbac658,null))['then'](respondWithStatusCode(_0xbac658,0xcc))[_0x672d('0x46')](handleError(_0xbac658,null));};exports[_0x672d('0x6e')]=function(_0x968eb2,_0x3aa62c,_0x4681f0){var _0x1f8f3d={};var _0x14a172={};var _0xbcccbd;var _0x5a21cc;return db[_0x672d('0x2d')][_0x672d('0x62')]({'where':{'id':_0x968eb2[_0x672d('0x48')]['id']}})[_0x672d('0x24')](handleEntityNotFound(_0x3aa62c,null))['then'](function(_0x551ed3){if(_0x551ed3){_0xbcccbd=_0x551ed3;_0x14a172[_0x672d('0x34')]=_['keys'](db[_0x672d('0x61')]['rawAttributes']);_0x14a172[_0x672d('0x31')]=_[_0x672d('0x43')](_0x968eb2['query']);_0x14a172[_0x672d('0x32')]=_['intersection'](_0x14a172[_0x672d('0x34')],_0x14a172['query']);_0x1f8f3d[_0x672d('0x35')]=_[_0x672d('0x33')](_0x14a172[_0x672d('0x34')],qs[_0x672d('0x36')](_0x968eb2[_0x672d('0x31')][_0x672d('0x36')]));_0x1f8f3d[_0x672d('0x35')]=_0x1f8f3d['attributes'][_0x672d('0x37')]?_0x1f8f3d[_0x672d('0x35')]:_0x14a172[_0x672d('0x34')];_0x1f8f3d[_0x672d('0x3a')]=qs['sort'](_0x968eb2[_0x672d('0x31')][_0x672d('0x3b')]);_0x1f8f3d[_0x672d('0x3c')]=qs[_0x672d('0x32')](_[_0x672d('0x3d')](_0x968eb2[_0x672d('0x31')],_0x14a172[_0x672d('0x32')]));if(_0x968eb2[_0x672d('0x31')][_0x672d('0x3e')]){_0x1f8f3d[_0x672d('0x3c')]=_[_0x672d('0x3f')](_0x1f8f3d['where'],{'$or':_[_0x672d('0x2c')](_0x1f8f3d[_0x672d('0x35')],function(_0x1fc783){var _0xb202c3={};_0xb202c3[_0x1fc783]={'$like':'%'+_0x968eb2[_0x672d('0x31')][_0x672d('0x3e')]+'%'};return _0xb202c3;})});}_0x1f8f3d=_[_0x672d('0x3f')]({},_0x1f8f3d,_0x968eb2[_0x672d('0x41')]);return _0xbcccbd[_0x672d('0x6e')](_0x1f8f3d);}})[_0x672d('0x24')](function(_0x4ca9d5){if(_0x4ca9d5){_0x5a21cc=_0x4ca9d5[_0x672d('0x37')];if(!_0x968eb2[_0x672d('0x31')][_0x672d('0x38')](_0x672d('0x39'))){_0x1f8f3d[_0x672d('0x1b')]=qs[_0x672d('0x1b')](_0x968eb2[_0x672d('0x31')]['limit']);_0x1f8f3d[_0x672d('0x1a')]=qs[_0x672d('0x1a')](_0x968eb2[_0x672d('0x31')][_0x672d('0x1a')]);}return _0xbcccbd[_0x672d('0x6e')](_0x1f8f3d);}})[_0x672d('0x24')](function(_0x99edd6){if(_0x99edd6){return _0x99edd6?{'count':_0x5a21cc,'rows':_0x99edd6}:null;}})['then'](respondWithResult(_0x3aa62c,null))[_0x672d('0x46')](handleError(_0x3aa62c,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 213f115..d4c1217 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 _0x05dd=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','moment'];(function(_0x32de09,_0x136403){var _0x39fa5c=function(_0x33653c){while(--_0x33653c){_0x32de09['push'](_0x32de09['shift']());}};_0x39fa5c(++_0x136403);}(_0x05dd,0x10e));var _0xd05d=function(_0xf68bfe,_0x2c2192){_0xf68bfe=_0xf68bfe-0x0;var _0x13671d=_0x05dd[_0xf68bfe];return _0x13671d;};'use strict';var _=require(_0xd05d('0x0'));var util=require('util');var logger=require(_0xd05d('0x1'))('api');var moment=require(_0xd05d('0x2'));var BPromise=require(_0xd05d('0x3'));var rp=require(_0xd05d('0x4'));var fs=require('fs');var path=require(_0xd05d('0x5'));var rimraf=require(_0xd05d('0x6'));var config=require(_0xd05d('0x7'));var attributes=require(_0xd05d('0x8'));module[_0xd05d('0x9')]=function(_0x5e993c,_0x677322){return _0x5e993c[_0xd05d('0xa')](_0xd05d('0xb'),attributes,{'tableName':_0xd05d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe889=['path','./voiceMusicOnHold.attributes','define','voice_musiconhold','lodash','util','api','moment','bluebird','request-promise'];(function(_0xe7acb9,_0x479726){var _0x364bb6=function(_0x235cda){while(--_0x235cda){_0xe7acb9['push'](_0xe7acb9['shift']());}};_0x364bb6(++_0x479726);}(_0xe889,0xd6));var _0x9e88=function(_0x100af6,_0x534964){_0x100af6=_0x100af6-0x0;var _0x4f4735=_0xe889[_0x100af6];return _0x4f4735;};'use strict';var _=require(_0x9e88('0x0'));var util=require(_0x9e88('0x1'));var logger=require('../../config/logger')(_0x9e88('0x2'));var moment=require(_0x9e88('0x3'));var BPromise=require(_0x9e88('0x4'));var rp=require(_0x9e88('0x5'));var fs=require('fs');var path=require(_0x9e88('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9e88('0x7'));module['exports']=function(_0x576de6,_0x2d3347){return _0x576de6[_0x9e88('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x9e88('0x9'),'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 8cea520..36816e9 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x25febe,_0x1d8dec){var _0x1cdffc=function(_0x40024d){while(--_0x40024d){_0x25febe['push'](_0x25febe['shift']());}};_0x1cdffc(++_0x1d8dec);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x5aa9ec,_0x59b358){var _0x37539b=function(_0x33fc2d){while(--_0x33fc2d){_0x5aa9ec['push'](_0x5aa9ec['shift']());}};_0x37539b(++_0x59b358);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 13e3fd3..a113dd9 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 _0x522b=['isAuthenticated','index','/describe','/:id','show','getAgents','getTeams','post','addAgents','/:id/teams','addTeams','put','update','delete','destroy','/:id/users','removeAgents','removeTeams','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get'];(function(_0xa33651,_0x383ca8){var _0x4d78e7=function(_0x50a909){while(--_0x50a909){_0xa33651['push'](_0xa33651['shift']());}};_0x4d78e7(++_0x383ca8);}(_0x522b,0x1c3));var _0xb522=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0x522b[_0xce93c];return _0x230720;};'use strict';var multer=require(_0xb522('0x0'));var util=require(_0xb522('0x1'));var path=require('path');var timeout=require(_0xb522('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb522('0x3'));var auth=require(_0xb522('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb522('0x5'));var controller=require(_0xb522('0x6'));router[_0xb522('0x7')]('/',auth[_0xb522('0x8')](),controller[_0xb522('0x9')]);router['get'](_0xb522('0xa'),auth[_0xb522('0x8')](),controller['describe']);router['get'](_0xb522('0xb'),auth['isAuthenticated'](),controller[_0xb522('0xc')]);router[_0xb522('0x7')]('/:id/users',auth[_0xb522('0x8')](),controller[_0xb522('0xd')]);router[_0xb522('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb522('0xe')]);router[_0xb522('0xf')]('/',auth[_0xb522('0x8')](),controller['create']);router[_0xb522('0xf')]('/:id/users',auth[_0xb522('0x8')](),controller[_0xb522('0x10')]);router['post'](_0xb522('0x11'),auth['isAuthenticated'](),controller[_0xb522('0x12')]);router[_0xb522('0x13')](_0xb522('0xb'),auth[_0xb522('0x8')](),controller[_0xb522('0x14')]);router[_0xb522('0x15')](_0xb522('0xb'),auth['isAuthenticated'](),controller[_0xb522('0x16')]);router['delete'](_0xb522('0x17'),auth[_0xb522('0x8')](),controller[_0xb522('0x18')]);router['delete'](_0xb522('0x11'),auth['isAuthenticated'](),controller[_0xb522('0x19')]);module[_0xb522('0x1a')]=router; \ No newline at end of file +var _0x4a06=['/:id','show','/:id/users','/:id/teams','getTeams','post','addTeams','put','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2edcd0,_0x378700){var _0x3d9a68=function(_0x323e65){while(--_0x323e65){_0x2edcd0['push'](_0x2edcd0['shift']());}};_0x3d9a68(++_0x378700);}(_0x4a06,0x1f2));var _0x64a0=function(_0x234f29,_0x23ec49){_0x234f29=_0x234f29-0x0;var _0x1d6d65=_0x4a06[_0x234f29];return _0x1d6d65;};'use strict';var multer=require(_0x64a0('0x0'));var util=require(_0x64a0('0x1'));var path=require(_0x64a0('0x2'));var timeout=require(_0x64a0('0x3'));var express=require(_0x64a0('0x4'));var router=express[_0x64a0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x64a0('0x6'));var interaction=require(_0x64a0('0x7'));var config=require(_0x64a0('0x8'));var controller=require(_0x64a0('0x9'));router[_0x64a0('0xa')]('/',auth[_0x64a0('0xb')](),controller[_0x64a0('0xc')]);router[_0x64a0('0xa')](_0x64a0('0xd'),auth[_0x64a0('0xb')](),controller[_0x64a0('0xe')]);router[_0x64a0('0xa')](_0x64a0('0xf'),auth[_0x64a0('0xb')](),controller[_0x64a0('0x10')]);router['get'](_0x64a0('0x11'),auth[_0x64a0('0xb')](),controller['getAgents']);router[_0x64a0('0xa')](_0x64a0('0x12'),auth[_0x64a0('0xb')](),controller[_0x64a0('0x13')]);router[_0x64a0('0x14')]('/',auth[_0x64a0('0xb')](),controller['create']);router[_0x64a0('0x14')](_0x64a0('0x11'),auth[_0x64a0('0xb')](),controller['addAgents']);router[_0x64a0('0x14')](_0x64a0('0x12'),auth['isAuthenticated'](),controller[_0x64a0('0x15')]);router[_0x64a0('0x16')](_0x64a0('0xf'),auth[_0x64a0('0xb')](),controller['update']);router[_0x64a0('0x17')](_0x64a0('0xf'),auth[_0x64a0('0xb')](),controller[_0x64a0('0x18')]);router[_0x64a0('0x17')](_0x64a0('0x11'),auth[_0x64a0('0xb')](),controller[_0x64a0('0x19')]);router[_0x64a0('0x17')](_0x64a0('0x12'),auth[_0x64a0('0xb')](),controller['removeTeams']);module[_0x64a0('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 17e812c..ffc6817 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 _0xd9cb=['name','INTEGER','sequelize','STRING'];(function(_0x4c00a3,_0x2d23e2){var _0x893854=function(_0x6f552c){while(--_0x6f552c){_0x4c00a3['push'](_0x4c00a3['shift']());}};_0x893854(++_0x2d23e2);}(_0xd9cb,0x1be));var _0xbd9c=function(_0x2e32f6,_0x5347a5){_0x2e32f6=_0x2e32f6-0x0;var _0x235a82=_0xd9cb[_0x2e32f6];return _0x235a82;};'use strict';var Sequelize=require(_0xbd9c('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd9c('0x1')],'allowNull':![],'unique':_0xbd9c('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x31cb6f){return'system-'+this['getDataValue'](_0xbd9c('0x2'))+'-';}},'description':{'type':Sequelize[_0xbd9c('0x1')]},'callerIdAll':{'type':Sequelize[_0xbd9c('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xbd9c('0x3')]}}; \ No newline at end of file +var _0xb8c3=['exports','STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize'];(function(_0xbcb6,_0x8e00a9){var _0x58899b=function(_0x35e0c4){while(--_0x35e0c4){_0xbcb6['push'](_0xbcb6['shift']());}};_0x58899b(++_0x8e00a9);}(_0xb8c3,0x127));var _0x3b8c=function(_0x562c83,_0x153164){_0x562c83=_0x562c83-0x0;var _0x2b91ae=_0xb8c3[_0x562c83];return _0x2b91ae;};'use strict';var Sequelize=require(_0x3b8c('0x0'));module[_0x3b8c('0x1')]={'name':{'type':Sequelize[_0x3b8c('0x2')],'allowNull':![],'unique':_0x3b8c('0x3')},'prefix':{'type':Sequelize[_0x3b8c('0x4')],'get':function(_0x41fd3b){return _0x3b8c('0x5')+this[_0x3b8c('0x6')](_0x3b8c('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x3b8c('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 4fb06d9..bc3a81d 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 _0x9f0e=['limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoicePrefix','rawAttributes','key','keys','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','filters','options','find','describe','create','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','order','pick','getAgents','getTeams','Team','User','Agents','flatMap','addTeams','each','TeamVoicePrefix','upsert','forEach','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','TeamId','all','union','value','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','status','end','json','undefined'];(function(_0xadd4bd,_0xe37e9c){var _0x18a7f3=function(_0x38cb3a){while(--_0x38cb3a){_0xadd4bd['push'](_0xadd4bd['shift']());}};_0x18a7f3(++_0xe37e9c);}(_0x9f0e,0x116));var _0xe9f0=function(_0xdc9c55,_0x576f0e){_0xdc9c55=_0xdc9c55-0x0;var _0x277236=_0x9f0e[_0xdc9c55];return _0x277236;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];config['redis']=_[_0xe9f0('0x19')](config[_0xe9f0('0x1a')],{'host':_0xe9f0('0x1b'),'port':0x18eb});var socket=require(_0xe9f0('0x1c'))(new Redis(config['redis']));require(_0xe9f0('0x1d'))['register'](socket);function respondWithStatusCode(_0x1e3ba8,_0x23914b){_0x23914b=_0x23914b||0xcc;return function(_0x3800e8){if(_0x3800e8){return _0x1e3ba8['sendStatus'](_0x23914b);}return _0x1e3ba8[_0xe9f0('0x1e')](_0x23914b)[_0xe9f0('0x1f')]();};}function respondWithResult(_0x2e68ef,_0x598eee){_0x598eee=_0x598eee||0xc8;return function(_0xaa7aa6){if(_0xaa7aa6){return _0x2e68ef[_0xe9f0('0x1e')](_0x598eee)[_0xe9f0('0x20')](_0xaa7aa6);}};}function respondWithFilteredResult(_0xd71ac8,_0x3ed69a){return function(_0x2ab12b){if(_0x2ab12b){var _0x3da237=typeof _0x3ed69a['offset']===_0xe9f0('0x21')&&typeof _0x3ed69a[_0xe9f0('0x22')]===_0xe9f0('0x21');var _0x5c4182=_0x2ab12b[_0xe9f0('0x23')];var _0x30b8c7=_0x3da237?0x0:_0x3ed69a[_0xe9f0('0x24')];var _0x43f399=_0x3da237?_0x2ab12b['count']:_0x3ed69a[_0xe9f0('0x24')]+_0x3ed69a[_0xe9f0('0x22')];var _0x583687;if(_0x43f399>=_0x5c4182){_0x43f399=_0x5c4182;_0x583687=0xc8;}else{_0x583687=0xce;}_0xd71ac8['status'](_0x583687);return _0xd71ac8['set'](_0xe9f0('0x25'),_0x30b8c7+'-'+_0x43f399+'/'+_0x5c4182)[_0xe9f0('0x20')](_0x2ab12b);}return null;};}function patchUpdates(_0x1211ae){return function(_0x316cdf){try{jsonpatch[_0xe9f0('0x26')](_0x316cdf,_0x1211ae,!![]);}catch(_0x4a5c27){return BPromise[_0xe9f0('0x27')](_0x4a5c27);}return _0x316cdf[_0xe9f0('0x28')]();};}function saveUpdates(_0x437d43,_0x10801b){return function(_0x3ca991){if(_0x3ca991){return _0x3ca991[_0xe9f0('0x29')](_0x437d43)[_0xe9f0('0x2a')](function(_0x1321bb){return _0x1321bb;});}return null;};}function removeEntity(_0x3c4ba9,_0x3fce54){return function(_0x48128a){if(_0x48128a){return _0x48128a[_0xe9f0('0x2b')]()[_0xe9f0('0x2a')](function(){var _0x2ddfba=_0x48128a[_0xe9f0('0x2c')]({'plain':!![]});var _0x4cf1b1=_0xe9f0('0x2d');return db[_0xe9f0('0x2e')][_0xe9f0('0x2b')]({'where':{'type':_0x4cf1b1,'resourceId':_0x2ddfba['id']}})[_0xe9f0('0x2a')](function(){return _0x48128a;});})[_0xe9f0('0x2a')](function(){_0x3c4ba9['status'](0xcc)[_0xe9f0('0x1f')]();});}};}function handleEntityNotFound(_0xdc16bc,_0x44fb5b){return function(_0xab3d81){if(!_0xab3d81){_0xdc16bc[_0xe9f0('0x2f')](0x194);}return _0xab3d81;};}function handleError(_0xd19788,_0x1d788a){_0x1d788a=_0x1d788a||0x1f4;return function(_0x2efd33){logger[_0xe9f0('0x30')](_0x2efd33[_0xe9f0('0x31')]);if(_0x2efd33[_0xe9f0('0x32')]){delete _0x2efd33[_0xe9f0('0x32')];}_0xd19788[_0xe9f0('0x1e')](_0x1d788a)[_0xe9f0('0x33')](_0x2efd33);};}exports[_0xe9f0('0x34')]=function(_0x2097c4,_0x80e3ac){var _0x3e1846={},_0x2e7535={},_0x19d799={'count':0x0,'rows':[]};var _0x4089cc=_[_0xe9f0('0x35')](db[_0xe9f0('0x36')][_0xe9f0('0x37')],function(_0x5480ce){return{'name':_0x5480ce['fieldName'],'type':_0x5480ce['type'][_0xe9f0('0x38')]};});_0x2e7535['model']=_[_0xe9f0('0x35')](_0x4089cc,_0xe9f0('0x32'));_0x2e7535['query']=_[_0xe9f0('0x39')](_0x2097c4['query']);_0x2e7535['filters']=_['intersection'](_0x2e7535[_0xe9f0('0x3a')],_0x2e7535[_0xe9f0('0x3b')]);_0x3e1846['attributes']=_[_0xe9f0('0x3c')](_0x2e7535[_0xe9f0('0x3a')],qs[_0xe9f0('0x3d')](_0x2097c4['query']['fields']));_0x3e1846[_0xe9f0('0x3e')]=_0x3e1846[_0xe9f0('0x3e')][_0xe9f0('0x3f')]?_0x3e1846['attributes']:_0x2e7535[_0xe9f0('0x3a')];if(!_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x40')](_0xe9f0('0x41'))){_0x3e1846[_0xe9f0('0x22')]=qs['limit'](_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x22')]);_0x3e1846[_0xe9f0('0x24')]=qs['offset'](_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x24')]);}_0x3e1846['order']=qs[_0xe9f0('0x42')](_0x2097c4['query'][_0xe9f0('0x42')]);_0x3e1846['where']=qs['filters'](_['pick'](_0x2097c4['query'],_0x2e7535['filters']),_0x4089cc);if(_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x43')]){_0x3e1846[_0xe9f0('0x44')]=_[_0xe9f0('0x45')](_0x3e1846[_0xe9f0('0x44')],{'$or':_[_0xe9f0('0x35')](_0x4089cc,function(_0x3d4eb7){if(_0x3d4eb7[_0xe9f0('0x46')]!==_0xe9f0('0x47')){var _0x4e1c68={};_0x4e1c68[_0x3d4eb7[_0xe9f0('0x32')]]={'$like':'%'+_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x43')]+'%'};return _0x4e1c68;}})});}_0x3e1846=_['merge']({},_0x3e1846,_0x2097c4['options']);var _0x3cbf49={'where':_0x3e1846['where']};return db[_0xe9f0('0x36')][_0xe9f0('0x23')](_0x3cbf49)[_0xe9f0('0x2a')](function(_0x42d9d2){_0x19d799['count']=_0x42d9d2;if(_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x48')]){_0x3e1846[_0xe9f0('0x49')]=[{'all':!![]}];}return db[_0xe9f0('0x36')][_0xe9f0('0x4a')](_0x3e1846);})['then'](function(_0x60a40d){_0x19d799[_0xe9f0('0x4b')]=_0x60a40d;return _0x19d799;})[_0xe9f0('0x2a')](respondWithFilteredResult(_0x80e3ac,_0x3e1846))[_0xe9f0('0x4c')](handleError(_0x80e3ac,null));};exports[_0xe9f0('0x4d')]=function(_0x4ffc17,_0x3a8d1d){var _0x54ab8f={'raw':![],'where':{'id':_0x4ffc17[_0xe9f0('0x4e')]['id']}},_0x54e432={};_0x54e432[_0xe9f0('0x3a')]=_['keys'](db[_0xe9f0('0x36')][_0xe9f0('0x37')]);_0x54e432[_0xe9f0('0x3b')]=_[_0xe9f0('0x39')](_0x4ffc17[_0xe9f0('0x3b')]);_0x54e432[_0xe9f0('0x4f')]=_[_0xe9f0('0x3c')](_0x54e432['model'],_0x54e432[_0xe9f0('0x3b')]);_0x54ab8f['attributes']=_[_0xe9f0('0x3c')](_0x54e432['model'],qs[_0xe9f0('0x3d')](_0x4ffc17['query'][_0xe9f0('0x3d')]));_0x54ab8f[_0xe9f0('0x3e')]=_0x54ab8f[_0xe9f0('0x3e')]['length']?_0x54ab8f[_0xe9f0('0x3e')]:_0x54e432[_0xe9f0('0x3a')];if(_0x4ffc17[_0xe9f0('0x3b')][_0xe9f0('0x48')]){_0x54ab8f[_0xe9f0('0x49')]=[{'all':!![]}];}_0x54ab8f=_[_0xe9f0('0x45')]({},_0x54ab8f,_0x4ffc17[_0xe9f0('0x50')]);return db[_0xe9f0('0x36')][_0xe9f0('0x51')](_0x54ab8f)[_0xe9f0('0x2a')](handleEntityNotFound(_0x3a8d1d,null))[_0xe9f0('0x2a')](respondWithResult(_0x3a8d1d,null))[_0xe9f0('0x4c')](handleError(_0x3a8d1d,null));};exports['destroy']=function(_0x55e898,_0x31aa19){return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x55e898['params']['id']}})[_0xe9f0('0x2a')](handleEntityNotFound(_0x31aa19,null))['then'](removeEntity(_0x31aa19,null))[_0xe9f0('0x4c')](handleError(_0x31aa19,null));};exports[_0xe9f0('0x52')]=function(_0x31770f,_0x4e8416){return db['VoicePrefix'][_0xe9f0('0x52')]()[_0xe9f0('0x2a')](respondWithResult(_0x4e8416,null))['catch'](handleError(_0x4e8416,null));};exports[_0xe9f0('0x53')]=function(_0xafb4d7,_0x33f26c){var _0xa26972;return db['sequelize'][_0xe9f0('0x54')](function(_0x3a5d19){return db[_0xe9f0('0x36')][_0xe9f0('0x53')](_0xafb4d7[_0xe9f0('0x55')],{'transaction':_0x3a5d19})[_0xe9f0('0x2a')](function(_0x1cba23){_0xa26972=_0x1cba23[_0xe9f0('0x2c')]({'plain':!![]});return db['VoiceExtension'][_0xe9f0('0x51')]({'where':{'id':_0xa26972[_0xe9f0('0x56')]},'raw':!![]})[_0xe9f0('0x2a')](function(_0x4728e7){return createVoicePrefixExtensions(_0xa26972,_0x4728e7,_0x3a5d19);});});})[_0xe9f0('0x2a')](function(){var _0xe67052=_0xafb4d7[_0xe9f0('0x57')][_0xe9f0('0x2c')]({'plain':!![]});if(!_0xe67052)throw new Error(_0xe9f0('0x58'));if(_0xe67052[_0xe9f0('0x59')]===_0xe9f0('0x57')){var _0x3c26ac=_0xa26972;return db[_0xe9f0('0x5a')][_0xe9f0('0x51')]({'where':{'name':'VoicePrefixes','userProfileId':_0xe67052[_0xe9f0('0x5b')]},'raw':!![]})[_0xe9f0('0x2a')](function(_0x52bcce){if(_0x52bcce&&_0x52bcce['autoAssociation']===0x0){return db['UserProfileResource'][_0xe9f0('0x53')]({'name':_0x3c26ac['name'],'resourceId':_0x3c26ac['id'],'type':_0x52bcce[_0xe9f0('0x32')],'sectionId':_0x52bcce['id']},{})[_0xe9f0('0x2a')](function(){return _0xa26972;});}else{return _0xa26972;}})[_0xe9f0('0x4c')](function(_0x4c983e){logger[_0xe9f0('0x30')](_0xe9f0('0x5c'),_0x4c983e);throw _0x4c983e;});}return _0xa26972;})[_0xe9f0('0x2a')](respondWithResult(_0x33f26c,null))[_0xe9f0('0x4c')](handleError(_0x33f26c,null));};function Extension(_0x4bb39d,_0x392eae,_0x3a05e7,_0x28a66e){this[_0xe9f0('0x5d')]='from-sip';this['exten']=_0x4bb39d;this[_0xe9f0('0x5e')]=_0x3a05e7;this[_0xe9f0('0x46')]=_0xe9f0('0x5f');this[_0xe9f0('0x60')]=_0xe9f0('0x61');this['priority']=_0x392eae;this[_0xe9f0('0x62')]=_0x28a66e;}function createVoicePrefixExtensions(_0x55ce2d,_0x16b3c0,_0x5858a9){return new BPromise(function(_0x7c05aa,_0x15ece3){var _0x8b26f2=new Extension(formatPrefixName(_0x55ce2d[_0xe9f0('0x63')]),0x1,_0xe9f0('0x64'),'Voice\x20Prefix');_0x8b26f2['VoicePrefixId']=_0x55ce2d['id'];return db['VoiceExtension'][_0xe9f0('0x53')](_0x8b26f2,{'transaction':_0x5858a9})[_0xe9f0('0x2a')](function(_0x4f6f7c){var _0x2fd3b2=_0x4f6f7c['get']({'plain':!![]});var _0x4f6a5b=_[_0xe9f0('0x35')](addVoicePrefixExtensions(_0x55ce2d,_0x16b3c0),function(_0x329e9e){_0x329e9e[_0xe9f0('0x56')]=_0x2fd3b2['id'];_0x329e9e[_0xe9f0('0x65')]=_0x55ce2d['id'];return _0x329e9e;});return db[_0xe9f0('0x66')][_0xe9f0('0x67')](_0x4f6a5b,{'transaction':_0x5858a9})['then'](function(_0x5e4ad4){if(!_0x5e4ad4){return _0x15ece3(_0xe9f0('0x68'));}else{return _0x7c05aa(_0x5e4ad4);}})[_0xe9f0('0x4c')](function(_0x12d40a){return _0x15ece3(_0x12d40a);});});;});};function addVoicePrefixExtensions(_0x1f57a1,_0x55dae1){var _0xb9b439=[];var _0x83dea9=formatPrefixName(_0x1f57a1[_0xe9f0('0x63')]);_0xb9b439[_0xe9f0('0x69')](new Extension(_0x83dea9,0x2,_0xe9f0('0x6a'),_0xe9f0('0x6b')+_0x1f57a1['name']));if(_0x1f57a1[_0xe9f0('0x6c')]){_0xb9b439[_0xe9f0('0x69')](new Extension(_0x83dea9,0x3,_0xe9f0('0x6a'),_0xe9f0('0x6d')+_0x1f57a1[_0xe9f0('0x6c')]));}else{_0xb9b439['push'](new Extension(_0x83dea9,0x3,_0xe9f0('0x64'),_0xe9f0('0x6e')));}_0xb9b439[_0xe9f0('0x69')](new Extension(_0x83dea9,0x4,_0xe9f0('0x6f'),_0x55dae1[_0xe9f0('0x5d')]+','+_0xe9f0('0x70')+(0x8+_0x1f57a1[_0xe9f0('0x32')][_0xe9f0('0x3f')])+'}'+','+0x1));return _0xb9b439;}function formatPrefixName(_0x2eaead){var _0x27e6bc='_';for(var _0xeaab41=0x0;_0xeaab41<_0x2eaead[_0xe9f0('0x3f')];_0xeaab41++){if(_0x2eaead['charAt'](_0xeaab41)=='-'){_0x27e6bc+=_0x2eaead[_0xe9f0('0x71')](_0xeaab41);}else{_0x27e6bc+='['+_0x2eaead[_0xe9f0('0x71')](_0xeaab41)+']';}}_0x27e6bc+='.';return _0x27e6bc;}exports[_0xe9f0('0x29')]=function(_0x116ec5,_0x3c700e,_0x2428aa){var _0x158e44=_0x116ec5['body'];_0x158e44[_0xe9f0('0x63')]=_0xe9f0('0x72')+_0x158e44['name']+'-';return db[_0xe9f0('0x73')][_0xe9f0('0x54')](function(_0x442b78){return db['VoicePrefix'][_0xe9f0('0x29')](_0x158e44,{'where':{'id':_0x158e44['id']},'transaction':_0x442b78})[_0xe9f0('0x2a')](function(){return db['VoiceExtension'][_0xe9f0('0x2b')]({'where':{'VoicePrefixId':_0x158e44['id']},'transaction':_0x442b78})[_0xe9f0('0x2a')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x158e44[_0xe9f0('0x56')]},'raw':!![]})['then'](function(_0x386d7b){return createVoicePrefixExtensions(_0x158e44,_0x386d7b,_0x442b78);});});});})[_0xe9f0('0x2a')](function(){return db['VoicePrefix'][_0xe9f0('0x74')](_0x158e44['id']);})[_0xe9f0('0x2a')](respondWithResult(_0x3c700e,null))[_0xe9f0('0x4c')](handleError(_0x3c700e,null));};exports[_0xe9f0('0x75')]=function(_0x161ee4,_0x8096c2,_0x42e4e9){return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x161ee4['params']['id']}})[_0xe9f0('0x2a')](handleEntityNotFound(_0x8096c2,null))[_0xe9f0('0x2a')](function(_0xe7fdb){if(_0xe7fdb){return _0xe7fdb[_0xe9f0('0x75')](_0x161ee4[_0xe9f0('0x55')][_0xe9f0('0x76')],_[_0xe9f0('0x77')](_0x161ee4[_0xe9f0('0x55')],['ids','id'])||{})[_0xe9f0('0x78')](function(_0x17c18c){for(var _0x2ce60c=0x0;_0x2ce60c<_0x161ee4[_0xe9f0('0x55')][_0xe9f0('0x76')][_0xe9f0('0x3f')];_0x2ce60c+=0x1){socket['emit'](_0xe9f0('0x79'),{'UserId':Number(_0x161ee4['body']['ids'][_0x2ce60c]),'VoicePrefixId':Number(_0x161ee4['params']['id'])});}return _0x17c18c;});}})[_0xe9f0('0x2a')](respondWithResult(_0x8096c2,null))[_0xe9f0('0x4c')](handleError(_0x8096c2,null));};exports[_0xe9f0('0x7a')]=function(_0x3b5b57,_0x2bf006,_0x8f8df5){return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x3b5b57[_0xe9f0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2bf006,null))[_0xe9f0('0x2a')](function(_0x29eee2){if(_0x29eee2){return _0x29eee2[_0xe9f0('0x7a')](_0x3b5b57[_0xe9f0('0x3b')][_0xe9f0('0x76')])[_0xe9f0('0x2a')](function(){if(_[_0xe9f0('0x7b')](_0x3b5b57[_0xe9f0('0x3b')][_0xe9f0('0x76')])){for(var _0x1a4217=0x0;_0x1a4217<_0x3b5b57['query']['ids'][_0xe9f0('0x3f')];_0x1a4217+=0x1){socket[_0xe9f0('0x7c')](_0xe9f0('0x7d'),{'UserId':Number(_0x3b5b57[_0xe9f0('0x3b')][_0xe9f0('0x76')][_0x1a4217]),'VoicePrefixId':Number(_0x3b5b57[_0xe9f0('0x4e')]['id'])});}}else{socket[_0xe9f0('0x7c')](_0xe9f0('0x7d'),{'UserId':Number(_0x3b5b57['query']['ids']),'VoicePrefixId':Number(_0x3b5b57[_0xe9f0('0x4e')]['id'])});}});}})[_0xe9f0('0x2a')](respondWithStatusCode(_0x2bf006,null))['catch'](handleError(_0x2bf006,null));};exports['getAgents']=function(_0x2c9d84,_0x145040,_0x3ed26a){var _0xab92b={};var _0x2f73cd={};var _0x5553df;var _0x20c026;return db[_0xe9f0('0x36')][_0xe9f0('0x7e')]({'where':{'id':_0x2c9d84[_0xe9f0('0x4e')]['id']}})[_0xe9f0('0x2a')](handleEntityNotFound(_0x145040,null))[_0xe9f0('0x2a')](function(_0x2aca09){if(_0x2aca09){_0x5553df=_0x2aca09;_0x2f73cd['model']=_['keys'](db['User'][_0xe9f0('0x37')]);_0x2f73cd[_0xe9f0('0x3b')]=_[_0xe9f0('0x39')](_0x2c9d84[_0xe9f0('0x3b')]);_0x2f73cd['filters']=_[_0xe9f0('0x3c')](_0x2f73cd['model'],_0x2f73cd[_0xe9f0('0x3b')]);_0xab92b['attributes']=_[_0xe9f0('0x3c')](_0x2f73cd[_0xe9f0('0x3a')],qs[_0xe9f0('0x3d')](_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x3d')]));_0xab92b[_0xe9f0('0x3e')]=_0xab92b['attributes'][_0xe9f0('0x3f')]?_0xab92b[_0xe9f0('0x3e')]:_0x2f73cd[_0xe9f0('0x3a')];_0xab92b[_0xe9f0('0x7f')]=qs[_0xe9f0('0x42')](_0x2c9d84['query'][_0xe9f0('0x42')]);_0xab92b[_0xe9f0('0x44')]=qs['filters'](_[_0xe9f0('0x80')](_0x2c9d84['query'],_0x2f73cd[_0xe9f0('0x4f')]));if(_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x43')]){_0xab92b['where']=_[_0xe9f0('0x45')](_0xab92b[_0xe9f0('0x44')],{'$or':_[_0xe9f0('0x35')](_0xab92b['attributes'],function(_0x2a5d79){var _0x473f78={};_0x473f78[_0x2a5d79]={'$like':'%'+_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x43')]+'%'};return _0x473f78;})});}_0xab92b=_[_0xe9f0('0x45')]({},_0xab92b,_0x2c9d84[_0xe9f0('0x50')]);return _0x5553df[_0xe9f0('0x81')](_0xab92b);}})['then'](function(_0x4a416c){if(_0x4a416c){_0x20c026=_0x4a416c[_0xe9f0('0x3f')];if(!_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x40')]('nolimit')){_0xab92b[_0xe9f0('0x22')]=qs[_0xe9f0('0x22')](_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x22')]);_0xab92b['offset']=qs['offset'](_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x24')]);}return _0x5553df['getAgents'](_0xab92b);}})[_0xe9f0('0x2a')](function(_0x5b26b1){if(_0x5b26b1){return _0x5b26b1?{'count':_0x20c026,'rows':_0x5b26b1}:null;}})['then'](respondWithResult(_0x145040,null))[_0xe9f0('0x4c')](handleError(_0x145040,null));};exports[_0xe9f0('0x82')]=function(_0x77b59d,_0x32ad0e,_0x10c4cf){var _0x563f55={};var _0x5761d3={};var _0x3e323e;var _0x41c1a9;return db[_0xe9f0('0x36')][_0xe9f0('0x7e')]({'where':{'id':_0x77b59d[_0xe9f0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x32ad0e,null))['then'](function(_0x5ae1ce){if(_0x5ae1ce){_0x3e323e=_0x5ae1ce;_0x5761d3[_0xe9f0('0x3a')]=_['keys'](db[_0xe9f0('0x83')][_0xe9f0('0x37')]);_0x5761d3[_0xe9f0('0x3b')]=_[_0xe9f0('0x39')](_0x77b59d[_0xe9f0('0x3b')]);_0x5761d3[_0xe9f0('0x4f')]=_['intersection'](_0x5761d3['model'],_0x5761d3[_0xe9f0('0x3b')]);_0x563f55[_0xe9f0('0x3e')]=_[_0xe9f0('0x3c')](_0x5761d3[_0xe9f0('0x3a')],qs[_0xe9f0('0x3d')](_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x3d')]));_0x563f55[_0xe9f0('0x3e')]=_0x563f55[_0xe9f0('0x3e')][_0xe9f0('0x3f')]?_0x563f55[_0xe9f0('0x3e')]:_0x5761d3[_0xe9f0('0x3a')];_0x563f55[_0xe9f0('0x7f')]=qs[_0xe9f0('0x42')](_0x77b59d['query'][_0xe9f0('0x42')]);_0x563f55[_0xe9f0('0x44')]=qs[_0xe9f0('0x4f')](_[_0xe9f0('0x80')](_0x77b59d[_0xe9f0('0x3b')],_0x5761d3[_0xe9f0('0x4f')]));if(_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x43')]){_0x563f55[_0xe9f0('0x44')]=_[_0xe9f0('0x45')](_0x563f55[_0xe9f0('0x44')],{'$or':_['map'](_0x563f55[_0xe9f0('0x3e')],function(_0x2b9c16){var _0x41ef5b={};_0x41ef5b[_0x2b9c16]={'$like':'%'+_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x43')]+'%'};return _0x41ef5b;})});}_0x563f55=_[_0xe9f0('0x45')]({},_0x563f55,_0x77b59d[_0xe9f0('0x50')]);return _0x3e323e[_0xe9f0('0x82')](_0x563f55);}})['then'](function(_0x5c5ac9){if(_0x5c5ac9){_0x41c1a9=_0x5c5ac9[_0xe9f0('0x3f')];if(!_0x77b59d[_0xe9f0('0x3b')]['hasOwnProperty']('nolimit')){_0x563f55[_0xe9f0('0x22')]=qs[_0xe9f0('0x22')](_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x22')]);_0x563f55[_0xe9f0('0x24')]=qs[_0xe9f0('0x24')](_0x77b59d['query'][_0xe9f0('0x24')]);}return _0x3e323e[_0xe9f0('0x82')](_0x563f55);}})['then'](function(_0x4d59c0){if(_0x4d59c0){return _0x4d59c0?{'count':_0x41c1a9,'rows':_0x4d59c0}:null;}})[_0xe9f0('0x2a')](respondWithResult(_0x32ad0e,null))[_0xe9f0('0x4c')](handleError(_0x32ad0e,null));};exports['addTeams']=function(_0x17013a,_0x63e374,_0x34eda8){var _0x5a38f4=_0x17013a[_0xe9f0('0x55')][_0xe9f0('0x76')];var _0x2a607b;return db[_0xe9f0('0x83')]['findAll']({'where':{'id':_0x5a38f4},'attributes':['id'],'include':[{'model':db[_0xe9f0('0x84')],'as':_0xe9f0('0x85'),'attributes':['id',_0xe9f0('0x32'),'online','voicePause','interface'],'raw':!![]}]})[_0xe9f0('0x2a')](function(_0x58db9d){if(_0x58db9d){_0x2a607b=_0x58db9d;var _0x4820a1=_[_0xe9f0('0x86')](_0x58db9d,function(_0x4cd8bc){var _0x1b2532=_0x4cd8bc[_0xe9f0('0x2c')]({'plain':!![]});return _0x1b2532[_0xe9f0('0x85')];});return db[_0xe9f0('0x36')]['find']({'where':{'id':_0x17013a[_0xe9f0('0x4e')]['id']}})[_0xe9f0('0x2a')](function(_0x231d94){return db[_0xe9f0('0x73')][_0xe9f0('0x54')](function(_0x25c2f6){return _0x231d94[_0xe9f0('0x87')](_0x5a38f4,{'transaction':_0x25c2f6})[_0xe9f0('0x2a')](function(){return BPromise[_0xe9f0('0x88')](_0x2a607b,function(_0x2cd0a5){return db[_0xe9f0('0x89')][_0xe9f0('0x8a')]({'TeamId':_0x2cd0a5['id'],'VoicePrefixId':_0x17013a[_0xe9f0('0x4e')]['id']},{'transaction':_0x25c2f6});});})['then'](function(){return BPromise[_0xe9f0('0x88')](_0x4820a1,function(_0x1d8fb5){return db['UserVoicePrefix']['findOrCreate']({'where':{'UserId':_0x1d8fb5['id'],'VoicePrefixId':_0x17013a[_0xe9f0('0x4e')]['id']},'transaction':_0x25c2f6});});})[_0xe9f0('0x2a')](function(){_0x4820a1[_0xe9f0('0x8b')](function(_0x1c0db4){socket['emit'](_0xe9f0('0x79'),{'UserId':_0x1c0db4['id'],'VoicePrefixId':_0x231d94['id']});});});});});}})[_0xe9f0('0x2a')](respondWithStatusCode(_0x63e374,null))[_0xe9f0('0x4c')](handleError(_0x63e374,null));};exports['removeTeams']=function(_0x448834,_0x116aec,_0x4398fd){return db[_0xe9f0('0x83')][_0xe9f0('0x4a')]({'where':{'id':_0x448834['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xe9f0('0x84')],'as':_0xe9f0('0x85'),'attributes':['id'],'raw':!![]}]})[_0xe9f0('0x2a')](handleEntityNotFound(_0x116aec,null))[_0xe9f0('0x2a')](function(_0x13ad0d){var _0x1b4977=_[_0xe9f0('0x35')](_0x13ad0d,'id');var _0x34f99d=[];var _0x5ae9f1=[];var _0x1aacfa=squel['select']();_0x1aacfa['field'](_0xe9f0('0x8c'))[_0xe9f0('0x8d')](_0xe9f0('0x8e'),'tq')['join'](_0xe9f0('0x8f'),'ut',_0xe9f0('0x90'))['where'](_0xe9f0('0x91'),_0x448834[_0xe9f0('0x4e')]['id']);for(var _0x14e369=0x0;_0x14e369<_0x13ad0d[_0xe9f0('0x3f')];_0x14e369+=0x1){let _0x56e09f=_0x13ad0d[_0x14e369];for(var _0x25750e=0x0;_0x25750e<_0x56e09f['Agents'][_0xe9f0('0x3f')];_0x25750e+=0x1){let _0x56e47c=_0x56e09f['Agents'][_0x25750e];var _0x58d863=_0x1aacfa[_0xe9f0('0x92')]();_0x58d863[_0xe9f0('0x44')]('ut.UserId\x20=\x20?',_0x56e47c['id']);_0x5ae9f1[_0xe9f0('0x69')](db[_0xe9f0('0x73')][_0xe9f0('0x3b')](_0x58d863[_0xe9f0('0x93')](),{'type':db[_0xe9f0('0x73')][_0xe9f0('0x94')][_0xe9f0('0x95')]})['then'](function(_0x5b10a5){if(_0x5b10a5[_0xe9f0('0x3f')]===0x1){return _0x56e47c['id'];}else{var _0x32eb6c=_['every'](_[_0xe9f0('0x35')](_0x5b10a5,_0xe9f0('0x96')),function(_0x96e959){return _['includes'](_0x1b4977,_0x96e959);});if(_0x32eb6c){return _0x56e47c['id'];}}}));}}return BPromise[_0xe9f0('0x97')](_0x5ae9f1)[_0xe9f0('0x2a')](function(_0x59fbca){_0x34f99d=_(_0x34f99d)[_0xe9f0('0x98')](_0x59fbca)['compact']()[_0xe9f0('0x99')]();return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x448834[_0xe9f0('0x4e')]['id']}})[_0xe9f0('0x2a')](function(_0x305d2f){return db['sequelize'][_0xe9f0('0x54')](function(_0x17f9bd){return _0x305d2f[_0xe9f0('0x9a')](_0x448834[_0xe9f0('0x3b')][_0xe9f0('0x76')],{'transaction':_0x17f9bd})[_0xe9f0('0x2a')](function(){if(!_[_0xe9f0('0x9b')](_0x34f99d)){return _0x305d2f['removeAgents'](_0x34f99d,{'transaction':_0x17f9bd});}})['then'](function(){_0x34f99d[_0xe9f0('0x8b')](function(_0x3e8745){socket['emit'](_0xe9f0('0x7d'),{'UserId':_0x3e8745,'VoicePrefixId':_0x305d2f['id']});});});});});});})['then'](respondWithStatusCode(_0x116aec,null))[_0xe9f0('0x4c')](handleError(_0x116aec,null));}; \ No newline at end of file +var _0x36ee=['show','params','find','describe','create','sequelize','transaction','get','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','charAt','body','findById','addAgents','spread','ids','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','getAgents','User','nolimit','getTeams','findOne','Team','findAll','Agents','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','includes','all','forEach','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','update','then','destroy','UserProfileResource','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch'];(function(_0xe103e2,_0x41f2f0){var _0xb0f713=function(_0x3a7b95){while(--_0x3a7b95){_0xe103e2['push'](_0xe103e2['shift']());}};_0xb0f713(++_0x41f2f0);}(_0x36ee,0xe8));var _0xe36e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x36ee[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];config['redis']=_[_0xe36e('0x19')](config[_0xe36e('0x1a')],{'host':_0xe36e('0x1b'),'port':0x18eb});var socket=require(_0xe36e('0x1c'))(new Redis(config['redis']));require(_0xe36e('0x1d'))['register'](socket);function respondWithStatusCode(_0x525155,_0x27ff47){_0x27ff47=_0x27ff47||0xcc;return function(_0x300f21){if(_0x300f21){return _0x525155[_0xe36e('0x1e')](_0x27ff47);}return _0x525155[_0xe36e('0x1f')](_0x27ff47)[_0xe36e('0x20')]();};}function respondWithResult(_0x924cd5,_0x2096f6){_0x2096f6=_0x2096f6||0xc8;return function(_0x39bae8){if(_0x39bae8){return _0x924cd5[_0xe36e('0x1f')](_0x2096f6)[_0xe36e('0x21')](_0x39bae8);}};}function respondWithFilteredResult(_0x5792e8,_0x333554){return function(_0x2184ae){if(_0x2184ae){var _0x56c019=typeof _0x333554[_0xe36e('0x22')]==='undefined'&&typeof _0x333554[_0xe36e('0x23')]===_0xe36e('0x24');var _0x5e15f5=_0x2184ae[_0xe36e('0x25')];var _0x6aa186=_0x56c019?0x0:_0x333554[_0xe36e('0x22')];var _0x597331=_0x56c019?_0x2184ae[_0xe36e('0x25')]:_0x333554[_0xe36e('0x22')]+_0x333554[_0xe36e('0x23')];var _0x3c4017;if(_0x597331>=_0x5e15f5){_0x597331=_0x5e15f5;_0x3c4017=0xc8;}else{_0x3c4017=0xce;}_0x5792e8[_0xe36e('0x1f')](_0x3c4017);return _0x5792e8[_0xe36e('0x26')]('Content-Range',_0x6aa186+'-'+_0x597331+'/'+_0x5e15f5)[_0xe36e('0x21')](_0x2184ae);}return null;};}function patchUpdates(_0x4f214a){return function(_0x23bcf3){try{jsonpatch[_0xe36e('0x27')](_0x23bcf3,_0x4f214a,!![]);}catch(_0x437f3f){return BPromise['reject'](_0x437f3f);}return _0x23bcf3['save']();};}function saveUpdates(_0x4749a8,_0x10818d){return function(_0xb0cd85){if(_0xb0cd85){return _0xb0cd85[_0xe36e('0x28')](_0x4749a8)[_0xe36e('0x29')](function(_0x1507f9){return _0x1507f9;});}return null;};}function removeEntity(_0x1a045c,_0x5ac484){return function(_0x3cafbf){if(_0x3cafbf){return _0x3cafbf[_0xe36e('0x2a')]()[_0xe36e('0x29')](function(){var _0x262caa=_0x3cafbf['get']({'plain':!![]});var _0x2d757c='VoicePrefixes';return db[_0xe36e('0x2b')]['destroy']({'where':{'type':_0x2d757c,'resourceId':_0x262caa['id']}})[_0xe36e('0x29')](function(){return _0x3cafbf;});})['then'](function(){_0x1a045c[_0xe36e('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b1045,_0x59548b){return function(_0x4bb75b){if(!_0x4bb75b){_0x3b1045['sendStatus'](0x194);}return _0x4bb75b;};}function handleError(_0x5b5d53,_0x203fa2){_0x203fa2=_0x203fa2||0x1f4;return function(_0x1fc639){logger['error'](_0x1fc639['stack']);if(_0x1fc639[_0xe36e('0x2c')]){delete _0x1fc639[_0xe36e('0x2c')];}_0x5b5d53[_0xe36e('0x1f')](_0x203fa2)[_0xe36e('0x2d')](_0x1fc639);};}exports[_0xe36e('0x2e')]=function(_0x4759b4,_0x57bb9b){var _0xb98e78={},_0x11c95d={},_0x57272f={'count':0x0,'rows':[]};var _0x87e595=_[_0xe36e('0x2f')](db[_0xe36e('0x30')][_0xe36e('0x31')],function(_0x21623e){return{'name':_0x21623e[_0xe36e('0x32')],'type':_0x21623e[_0xe36e('0x33')][_0xe36e('0x34')]};});_0x11c95d[_0xe36e('0x35')]=_[_0xe36e('0x2f')](_0x87e595,_0xe36e('0x2c'));_0x11c95d['query']=_[_0xe36e('0x36')](_0x4759b4['query']);_0x11c95d['filters']=_[_0xe36e('0x37')](_0x11c95d['model'],_0x11c95d[_0xe36e('0x38')]);_0xb98e78[_0xe36e('0x39')]=_[_0xe36e('0x37')](_0x11c95d[_0xe36e('0x35')],qs['fields'](_0x4759b4['query'][_0xe36e('0x3a')]));_0xb98e78[_0xe36e('0x39')]=_0xb98e78[_0xe36e('0x39')][_0xe36e('0x3b')]?_0xb98e78['attributes']:_0x11c95d[_0xe36e('0x35')];if(!_0x4759b4[_0xe36e('0x38')][_0xe36e('0x3c')]('nolimit')){_0xb98e78[_0xe36e('0x23')]=qs[_0xe36e('0x23')](_0x4759b4['query'][_0xe36e('0x23')]);_0xb98e78[_0xe36e('0x22')]=qs[_0xe36e('0x22')](_0x4759b4[_0xe36e('0x38')][_0xe36e('0x22')]);}_0xb98e78[_0xe36e('0x3d')]=qs[_0xe36e('0x3e')](_0x4759b4[_0xe36e('0x38')][_0xe36e('0x3e')]);_0xb98e78[_0xe36e('0x3f')]=qs[_0xe36e('0x40')](_[_0xe36e('0x41')](_0x4759b4[_0xe36e('0x38')],_0x11c95d['filters']),_0x87e595);if(_0x4759b4[_0xe36e('0x38')][_0xe36e('0x42')]){_0xb98e78[_0xe36e('0x3f')]=_[_0xe36e('0x43')](_0xb98e78[_0xe36e('0x3f')],{'$or':_['map'](_0x87e595,function(_0x591e33){if(_0x591e33[_0xe36e('0x33')]!==_0xe36e('0x44')){var _0x1acc12={};_0x1acc12[_0x591e33[_0xe36e('0x2c')]]={'$like':'%'+_0x4759b4[_0xe36e('0x38')][_0xe36e('0x42')]+'%'};return _0x1acc12;}})});}_0xb98e78=_[_0xe36e('0x43')]({},_0xb98e78,_0x4759b4[_0xe36e('0x45')]);var _0x48066c={'where':_0xb98e78[_0xe36e('0x3f')]};return db[_0xe36e('0x30')]['count'](_0x48066c)[_0xe36e('0x29')](function(_0x5ef3e4){_0x57272f[_0xe36e('0x25')]=_0x5ef3e4;if(_0x4759b4[_0xe36e('0x38')][_0xe36e('0x46')]){_0xb98e78[_0xe36e('0x47')]=[{'all':!![]}];}return db[_0xe36e('0x30')]['findAll'](_0xb98e78);})[_0xe36e('0x29')](function(_0x2961c9){_0x57272f[_0xe36e('0x48')]=_0x2961c9;return _0x57272f;})[_0xe36e('0x29')](respondWithFilteredResult(_0x57bb9b,_0xb98e78))[_0xe36e('0x49')](handleError(_0x57bb9b,null));};exports[_0xe36e('0x4a')]=function(_0x569809,_0x122704){var _0x134d71={'raw':![],'where':{'id':_0x569809[_0xe36e('0x4b')]['id']}},_0x2a6817={};_0x2a6817[_0xe36e('0x35')]=_['keys'](db[_0xe36e('0x30')][_0xe36e('0x31')]);_0x2a6817[_0xe36e('0x38')]=_[_0xe36e('0x36')](_0x569809[_0xe36e('0x38')]);_0x2a6817[_0xe36e('0x40')]=_[_0xe36e('0x37')](_0x2a6817[_0xe36e('0x35')],_0x2a6817[_0xe36e('0x38')]);_0x134d71['attributes']=_['intersection'](_0x2a6817[_0xe36e('0x35')],qs['fields'](_0x569809[_0xe36e('0x38')][_0xe36e('0x3a')]));_0x134d71[_0xe36e('0x39')]=_0x134d71[_0xe36e('0x39')]['length']?_0x134d71[_0xe36e('0x39')]:_0x2a6817[_0xe36e('0x35')];if(_0x569809['query'][_0xe36e('0x46')]){_0x134d71[_0xe36e('0x47')]=[{'all':!![]}];}_0x134d71=_[_0xe36e('0x43')]({},_0x134d71,_0x569809[_0xe36e('0x45')]);return db[_0xe36e('0x30')][_0xe36e('0x4c')](_0x134d71)[_0xe36e('0x29')](handleEntityNotFound(_0x122704,null))[_0xe36e('0x29')](respondWithResult(_0x122704,null))[_0xe36e('0x49')](handleError(_0x122704,null));};exports[_0xe36e('0x2a')]=function(_0x7307bc,_0x13ccc5){return db[_0xe36e('0x30')][_0xe36e('0x4c')]({'where':{'id':_0x7307bc[_0xe36e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x13ccc5,null))[_0xe36e('0x29')](removeEntity(_0x13ccc5,null))['catch'](handleError(_0x13ccc5,null));};exports['describe']=function(_0x10b8ff,_0x3e8ccb){return db['VoicePrefix'][_0xe36e('0x4d')]()[_0xe36e('0x29')](respondWithResult(_0x3e8ccb,null))[_0xe36e('0x49')](handleError(_0x3e8ccb,null));};exports[_0xe36e('0x4e')]=function(_0xa4be24,_0x22788b){var _0x935e84;return db[_0xe36e('0x4f')][_0xe36e('0x50')](function(_0x55d190){return db[_0xe36e('0x30')][_0xe36e('0x4e')](_0xa4be24['body'],{'transaction':_0x55d190})[_0xe36e('0x29')](function(_0x1da952){_0x935e84=_0x1da952[_0xe36e('0x51')]({'plain':!![]});return db[_0xe36e('0x52')][_0xe36e('0x4c')]({'where':{'id':_0x935e84['VoiceExtensionId']},'raw':!![]})['then'](function(_0x56f5b6){return createVoicePrefixExtensions(_0x935e84,_0x56f5b6,_0x55d190);});});})['then'](function(){var _0x47605d=_0xa4be24[_0xe36e('0x53')][_0xe36e('0x51')]({'plain':!![]});if(!_0x47605d)throw new Error(_0xe36e('0x54'));if(_0x47605d[_0xe36e('0x55')]===_0xe36e('0x53')){var _0x7c3766=_0x935e84;return db[_0xe36e('0x56')][_0xe36e('0x4c')]({'where':{'name':'VoicePrefixes','userProfileId':_0x47605d[_0xe36e('0x57')]},'raw':!![]})[_0xe36e('0x29')](function(_0x5a058b){if(_0x5a058b&&_0x5a058b[_0xe36e('0x58')]===0x0){return db[_0xe36e('0x2b')][_0xe36e('0x4e')]({'name':_0x7c3766[_0xe36e('0x2c')],'resourceId':_0x7c3766['id'],'type':_0x5a058b[_0xe36e('0x2c')],'sectionId':_0x5a058b['id']},{})[_0xe36e('0x29')](function(){return _0x935e84;});}else{return _0x935e84;}})[_0xe36e('0x49')](function(_0x1a70d1){logger[_0xe36e('0x59')](_0xe36e('0x5a'),_0x1a70d1);throw _0x1a70d1;});}return _0x935e84;})[_0xe36e('0x29')](respondWithResult(_0x22788b,null))[_0xe36e('0x49')](handleError(_0x22788b,null));};function Extension(_0x389e91,_0x6f979f,_0x3512ec,_0x3e4860){this[_0xe36e('0x5b')]=_0xe36e('0x5c');this[_0xe36e('0x5d')]=_0x389e91;this[_0xe36e('0x5e')]=_0x3512ec;this[_0xe36e('0x33')]=_0xe36e('0x5f');this[_0xe36e('0x60')]=_0xe36e('0x61');this[_0xe36e('0x62')]=_0x6f979f;this['appdata']=_0x3e4860;}function createVoicePrefixExtensions(_0x429a01,_0xedaa96,_0x49336b){return new BPromise(function(_0xce5583,_0x41bad0){var _0x180dc3=new Extension(formatPrefixName(_0x429a01[_0xe36e('0x63')]),0x1,_0xe36e('0x64'),_0xe36e('0x65'));_0x180dc3['VoicePrefixId']=_0x429a01['id'];return db[_0xe36e('0x52')]['create'](_0x180dc3,{'transaction':_0x49336b})[_0xe36e('0x29')](function(_0x1fc1e5){var _0x2b0059=_0x1fc1e5[_0xe36e('0x51')]({'plain':!![]});var _0x2a767d=_[_0xe36e('0x2f')](addVoicePrefixExtensions(_0x429a01,_0xedaa96),function(_0x2ab6aa){_0x2ab6aa[_0xe36e('0x66')]=_0x2b0059['id'];_0x2ab6aa['VoicePrefixId']=_0x429a01['id'];return _0x2ab6aa;});return db[_0xe36e('0x52')][_0xe36e('0x67')](_0x2a767d,{'transaction':_0x49336b})['then'](function(_0x3068e1){if(!_0x3068e1){return _0x41bad0(_0xe36e('0x68'));}else{return _0xce5583(_0x3068e1);}})[_0xe36e('0x49')](function(_0x1e8943){return _0x41bad0(_0x1e8943);});});;});};function addVoicePrefixExtensions(_0x30786a,_0x3565cb){var _0x3d4874=[];var _0x48ff05=formatPrefixName(_0x30786a[_0xe36e('0x63')]);_0x3d4874[_0xe36e('0x69')](new Extension(_0x48ff05,0x2,_0xe36e('0x6a'),_0xe36e('0x6b')+_0x30786a[_0xe36e('0x2c')]));if(_0x30786a[_0xe36e('0x6c')]){_0x3d4874[_0xe36e('0x69')](new Extension(_0x48ff05,0x3,_0xe36e('0x6a'),_0xe36e('0x6d')+_0x30786a[_0xe36e('0x6c')]));}else{_0x3d4874[_0xe36e('0x69')](new Extension(_0x48ff05,0x3,'NoOp',_0xe36e('0x6e')));}_0x3d4874[_0xe36e('0x69')](new Extension(_0x48ff05,0x4,_0xe36e('0x6f'),_0x3565cb[_0xe36e('0x5b')]+','+'${EXTEN:'+(0x8+_0x30786a['name'][_0xe36e('0x3b')])+'}'+','+0x1));return _0x3d4874;}function formatPrefixName(_0x55911b){var _0x585bd5='_';for(var _0x59c454=0x0;_0x59c454<_0x55911b[_0xe36e('0x3b')];_0x59c454++){if(_0x55911b['charAt'](_0x59c454)=='-'){_0x585bd5+=_0x55911b[_0xe36e('0x70')](_0x59c454);}else{_0x585bd5+='['+_0x55911b[_0xe36e('0x70')](_0x59c454)+']';}}_0x585bd5+='.';return _0x585bd5;}exports[_0xe36e('0x28')]=function(_0x221a90,_0x1bd60d,_0x46f789){var _0x11e610=_0x221a90[_0xe36e('0x71')];_0x11e610[_0xe36e('0x63')]='system-'+_0x11e610[_0xe36e('0x2c')]+'-';return db['sequelize'][_0xe36e('0x50')](function(_0x517c2a){return db[_0xe36e('0x30')][_0xe36e('0x28')](_0x11e610,{'where':{'id':_0x11e610['id']},'transaction':_0x517c2a})[_0xe36e('0x29')](function(){return db[_0xe36e('0x52')]['destroy']({'where':{'VoicePrefixId':_0x11e610['id']},'transaction':_0x517c2a})['then'](function(){return db[_0xe36e('0x52')][_0xe36e('0x4c')]({'where':{'id':_0x11e610[_0xe36e('0x66')]},'raw':!![]})[_0xe36e('0x29')](function(_0x3be728){return createVoicePrefixExtensions(_0x11e610,_0x3be728,_0x517c2a);});});});})[_0xe36e('0x29')](function(){return db['VoicePrefix'][_0xe36e('0x72')](_0x11e610['id']);})[_0xe36e('0x29')](respondWithResult(_0x1bd60d,null))['catch'](handleError(_0x1bd60d,null));};exports[_0xe36e('0x73')]=function(_0x5eea4f,_0x45ebca,_0x421c28){return db[_0xe36e('0x30')][_0xe36e('0x4c')]({'where':{'id':_0x5eea4f['params']['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x45ebca,null))['then'](function(_0x49a74b){if(_0x49a74b){return _0x49a74b[_0xe36e('0x73')](_0x5eea4f[_0xe36e('0x71')]['ids'],_['omit'](_0x5eea4f[_0xe36e('0x71')],['ids','id'])||{})[_0xe36e('0x74')](function(_0x36ddc0){for(var _0x2c0ed5=0x0;_0x2c0ed5<_0x5eea4f[_0xe36e('0x71')][_0xe36e('0x75')][_0xe36e('0x3b')];_0x2c0ed5+=0x1){socket['emit'](_0xe36e('0x76'),{'UserId':Number(_0x5eea4f[_0xe36e('0x71')][_0xe36e('0x75')][_0x2c0ed5]),'VoicePrefixId':Number(_0x5eea4f[_0xe36e('0x4b')]['id'])});}return _0x36ddc0;});}})['then'](respondWithResult(_0x45ebca,null))[_0xe36e('0x49')](handleError(_0x45ebca,null));};exports[_0xe36e('0x77')]=function(_0x2eef73,_0x39c9fe,_0x5ee201){return db[_0xe36e('0x30')]['find']({'where':{'id':_0x2eef73[_0xe36e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x39c9fe,null))[_0xe36e('0x29')](function(_0x522968){if(_0x522968){return _0x522968['removeAgents'](_0x2eef73[_0xe36e('0x38')][_0xe36e('0x75')])[_0xe36e('0x29')](function(){if(_['isArray'](_0x2eef73[_0xe36e('0x38')][_0xe36e('0x75')])){for(var _0x48e4f5=0x0;_0x48e4f5<_0x2eef73[_0xe36e('0x38')][_0xe36e('0x75')][_0xe36e('0x3b')];_0x48e4f5+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x2eef73[_0xe36e('0x38')][_0xe36e('0x75')][_0x48e4f5]),'VoicePrefixId':Number(_0x2eef73[_0xe36e('0x4b')]['id'])});}}else{socket[_0xe36e('0x78')](_0xe36e('0x79'),{'UserId':Number(_0x2eef73['query'][_0xe36e('0x75')]),'VoicePrefixId':Number(_0x2eef73[_0xe36e('0x4b')]['id'])});}});}})[_0xe36e('0x29')](respondWithStatusCode(_0x39c9fe,null))[_0xe36e('0x49')](handleError(_0x39c9fe,null));};exports[_0xe36e('0x7a')]=function(_0x5bdeea,_0x3712f6,_0x24fcf8){var _0x188dc9={};var _0x493d0f={};var _0x25e4eb;var _0x499f0a;return db[_0xe36e('0x30')]['findOne']({'where':{'id':_0x5bdeea[_0xe36e('0x4b')]['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x3712f6,null))['then'](function(_0x463355){if(_0x463355){_0x25e4eb=_0x463355;_0x493d0f['model']=_[_0xe36e('0x36')](db[_0xe36e('0x7b')][_0xe36e('0x31')]);_0x493d0f[_0xe36e('0x38')]=_[_0xe36e('0x36')](_0x5bdeea['query']);_0x493d0f[_0xe36e('0x40')]=_['intersection'](_0x493d0f[_0xe36e('0x35')],_0x493d0f[_0xe36e('0x38')]);_0x188dc9[_0xe36e('0x39')]=_[_0xe36e('0x37')](_0x493d0f[_0xe36e('0x35')],qs[_0xe36e('0x3a')](_0x5bdeea['query'][_0xe36e('0x3a')]));_0x188dc9[_0xe36e('0x39')]=_0x188dc9[_0xe36e('0x39')]['length']?_0x188dc9[_0xe36e('0x39')]:_0x493d0f[_0xe36e('0x35')];_0x188dc9[_0xe36e('0x3d')]=qs[_0xe36e('0x3e')](_0x5bdeea['query'][_0xe36e('0x3e')]);_0x188dc9['where']=qs[_0xe36e('0x40')](_['pick'](_0x5bdeea[_0xe36e('0x38')],_0x493d0f[_0xe36e('0x40')]));if(_0x5bdeea[_0xe36e('0x38')]['filter']){_0x188dc9[_0xe36e('0x3f')]=_[_0xe36e('0x43')](_0x188dc9['where'],{'$or':_[_0xe36e('0x2f')](_0x188dc9[_0xe36e('0x39')],function(_0x1f4dd2){var _0x531eac={};_0x531eac[_0x1f4dd2]={'$like':'%'+_0x5bdeea['query'][_0xe36e('0x42')]+'%'};return _0x531eac;})});}_0x188dc9=_[_0xe36e('0x43')]({},_0x188dc9,_0x5bdeea[_0xe36e('0x45')]);return _0x25e4eb[_0xe36e('0x7a')](_0x188dc9);}})[_0xe36e('0x29')](function(_0x5e62f1){if(_0x5e62f1){_0x499f0a=_0x5e62f1[_0xe36e('0x3b')];if(!_0x5bdeea[_0xe36e('0x38')][_0xe36e('0x3c')](_0xe36e('0x7c'))){_0x188dc9['limit']=qs[_0xe36e('0x23')](_0x5bdeea[_0xe36e('0x38')]['limit']);_0x188dc9['offset']=qs['offset'](_0x5bdeea[_0xe36e('0x38')]['offset']);}return _0x25e4eb['getAgents'](_0x188dc9);}})[_0xe36e('0x29')](function(_0x96f37a){if(_0x96f37a){return _0x96f37a?{'count':_0x499f0a,'rows':_0x96f37a}:null;}})[_0xe36e('0x29')](respondWithResult(_0x3712f6,null))[_0xe36e('0x49')](handleError(_0x3712f6,null));};exports[_0xe36e('0x7d')]=function(_0x378126,_0x48fbed,_0x2ebe8e){var _0x4f9354={};var _0x493692={};var _0x4451ec;var _0x21644d;return db[_0xe36e('0x30')][_0xe36e('0x7e')]({'where':{'id':_0x378126['params']['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x48fbed,null))[_0xe36e('0x29')](function(_0x23e62d){if(_0x23e62d){_0x4451ec=_0x23e62d;_0x493692[_0xe36e('0x35')]=_['keys'](db[_0xe36e('0x7f')]['rawAttributes']);_0x493692[_0xe36e('0x38')]=_[_0xe36e('0x36')](_0x378126[_0xe36e('0x38')]);_0x493692[_0xe36e('0x40')]=_[_0xe36e('0x37')](_0x493692['model'],_0x493692[_0xe36e('0x38')]);_0x4f9354[_0xe36e('0x39')]=_[_0xe36e('0x37')](_0x493692[_0xe36e('0x35')],qs[_0xe36e('0x3a')](_0x378126[_0xe36e('0x38')][_0xe36e('0x3a')]));_0x4f9354[_0xe36e('0x39')]=_0x4f9354[_0xe36e('0x39')][_0xe36e('0x3b')]?_0x4f9354[_0xe36e('0x39')]:_0x493692[_0xe36e('0x35')];_0x4f9354[_0xe36e('0x3d')]=qs['sort'](_0x378126['query']['sort']);_0x4f9354[_0xe36e('0x3f')]=qs[_0xe36e('0x40')](_[_0xe36e('0x41')](_0x378126[_0xe36e('0x38')],_0x493692['filters']));if(_0x378126[_0xe36e('0x38')][_0xe36e('0x42')]){_0x4f9354[_0xe36e('0x3f')]=_[_0xe36e('0x43')](_0x4f9354['where'],{'$or':_[_0xe36e('0x2f')](_0x4f9354[_0xe36e('0x39')],function(_0xdd1816){var _0x18dd36={};_0x18dd36[_0xdd1816]={'$like':'%'+_0x378126['query']['filter']+'%'};return _0x18dd36;})});}_0x4f9354=_[_0xe36e('0x43')]({},_0x4f9354,_0x378126[_0xe36e('0x45')]);return _0x4451ec['getTeams'](_0x4f9354);}})['then'](function(_0x59bf4d){if(_0x59bf4d){_0x21644d=_0x59bf4d[_0xe36e('0x3b')];if(!_0x378126[_0xe36e('0x38')][_0xe36e('0x3c')]('nolimit')){_0x4f9354[_0xe36e('0x23')]=qs[_0xe36e('0x23')](_0x378126[_0xe36e('0x38')][_0xe36e('0x23')]);_0x4f9354['offset']=qs[_0xe36e('0x22')](_0x378126[_0xe36e('0x38')][_0xe36e('0x22')]);}return _0x4451ec[_0xe36e('0x7d')](_0x4f9354);}})['then'](function(_0x3de53b){if(_0x3de53b){return _0x3de53b?{'count':_0x21644d,'rows':_0x3de53b}:null;}})['then'](respondWithResult(_0x48fbed,null))[_0xe36e('0x49')](handleError(_0x48fbed,null));};exports['addTeams']=function(_0x1c95cd,_0x2b3e81,_0x498822){var _0x2376b2=_0x1c95cd[_0xe36e('0x71')]['ids'];var _0x179b3f;return db[_0xe36e('0x7f')][_0xe36e('0x80')]({'where':{'id':_0x2376b2},'attributes':['id'],'include':[{'model':db[_0xe36e('0x7b')],'as':_0xe36e('0x81'),'attributes':['id',_0xe36e('0x2c'),'online',_0xe36e('0x82'),_0xe36e('0x83')],'raw':!![]}]})['then'](function(_0xda5f86){if(_0xda5f86){_0x179b3f=_0xda5f86;var _0x48e276=_[_0xe36e('0x84')](_0xda5f86,function(_0x7872d5){var _0x2aefd4=_0x7872d5[_0xe36e('0x51')]({'plain':!![]});return _0x2aefd4['Agents'];});return db[_0xe36e('0x30')][_0xe36e('0x4c')]({'where':{'id':_0x1c95cd[_0xe36e('0x4b')]['id']}})[_0xe36e('0x29')](function(_0x43f149){return db['sequelize'][_0xe36e('0x50')](function(_0x25abc5){return _0x43f149['addTeams'](_0x2376b2,{'transaction':_0x25abc5})['then'](function(){return BPromise[_0xe36e('0x85')](_0x179b3f,function(_0x51c98c){return db[_0xe36e('0x86')][_0xe36e('0x87')]({'TeamId':_0x51c98c['id'],'VoicePrefixId':_0x1c95cd[_0xe36e('0x4b')]['id']},{'transaction':_0x25abc5});});})[_0xe36e('0x29')](function(){return BPromise[_0xe36e('0x85')](_0x48e276,function(_0x3bd8e1){return db[_0xe36e('0x88')][_0xe36e('0x89')]({'where':{'UserId':_0x3bd8e1['id'],'VoicePrefixId':_0x1c95cd[_0xe36e('0x4b')]['id']},'transaction':_0x25abc5});});})[_0xe36e('0x29')](function(){_0x48e276['forEach'](function(_0xab0e50){socket['emit'](_0xe36e('0x76'),{'UserId':_0xab0e50['id'],'VoicePrefixId':_0x43f149['id']});});});});});}})[_0xe36e('0x29')](respondWithStatusCode(_0x2b3e81,null))[_0xe36e('0x49')](handleError(_0x2b3e81,null));};exports['removeTeams']=function(_0x3fc054,_0x947053,_0x51c758){return db[_0xe36e('0x7f')]['findAll']({'where':{'id':_0x3fc054[_0xe36e('0x38')][_0xe36e('0x75')]},'attributes':['id'],'include':[{'model':db[_0xe36e('0x7b')],'as':_0xe36e('0x81'),'attributes':['id'],'raw':!![]}]})[_0xe36e('0x29')](handleEntityNotFound(_0x947053,null))[_0xe36e('0x29')](function(_0x257b00){var _0x2056ed=_[_0xe36e('0x2f')](_0x257b00,'id');var _0x31ae71=[];var _0x166c22=[];var _0x47b082=squel['select']();_0x47b082[_0xe36e('0x8a')](_0xe36e('0x8b'))[_0xe36e('0x8c')](_0xe36e('0x8d'),'tq')['join'](_0xe36e('0x8e'),'ut',_0xe36e('0x8f'))['where'](_0xe36e('0x90'),_0x3fc054['params']['id']);for(var _0x260fff=0x0;_0x260fff<_0x257b00[_0xe36e('0x3b')];_0x260fff+=0x1){let _0x27d09b=_0x257b00[_0x260fff];for(var _0x5bc8b1=0x0;_0x5bc8b1<_0x27d09b[_0xe36e('0x81')][_0xe36e('0x3b')];_0x5bc8b1+=0x1){let _0x2e0e12=_0x27d09b[_0xe36e('0x81')][_0x5bc8b1];var _0x7a5d80=_0x47b082[_0xe36e('0x91')]();_0x7a5d80[_0xe36e('0x3f')]('ut.UserId\x20=\x20?',_0x2e0e12['id']);_0x166c22[_0xe36e('0x69')](db[_0xe36e('0x4f')][_0xe36e('0x38')](_0x7a5d80[_0xe36e('0x92')](),{'type':db[_0xe36e('0x4f')][_0xe36e('0x93')][_0xe36e('0x94')]})[_0xe36e('0x29')](function(_0xacc91e){if(_0xacc91e['length']===0x1){return _0x2e0e12['id'];}else{var _0x3e0dc9=_[_0xe36e('0x95')](_['map'](_0xacc91e,'TeamId'),function(_0x546461){return _[_0xe36e('0x96')](_0x2056ed,_0x546461);});if(_0x3e0dc9){return _0x2e0e12['id'];}}}));}}return BPromise[_0xe36e('0x97')](_0x166c22)['then'](function(_0x20208c){_0x31ae71=_(_0x31ae71)['union'](_0x20208c)['compact']()['value']();return db[_0xe36e('0x30')][_0xe36e('0x4c')]({'where':{'id':_0x3fc054['params']['id']}})[_0xe36e('0x29')](function(_0x2c9191){return db['sequelize'][_0xe36e('0x50')](function(_0x15b38e){return _0x2c9191['removeTeams'](_0x3fc054[_0xe36e('0x38')][_0xe36e('0x75')],{'transaction':_0x15b38e})['then'](function(){if(!_['isEmpty'](_0x31ae71)){return _0x2c9191[_0xe36e('0x77')](_0x31ae71,{'transaction':_0x15b38e});}})[_0xe36e('0x29')](function(){_0x31ae71[_0xe36e('0x98')](function(_0x3c7778){socket[_0xe36e('0x78')](_0xe36e('0x79'),{'UserId':_0x3c7778,'VoicePrefixId':_0x2c9191['id']});});});});});});})[_0xe36e('0x29')](respondWithStatusCode(_0x947053,null))[_0xe36e('0x49')](handleError(_0x947053,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 9ae6b82..768bda1 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 _0x2f9a=['exports','events','../../mysqldb','save','emit','hook'];(function(_0x572165,_0x6a45cc){var _0x8c8709=function(_0x43faab){while(--_0x43faab){_0x572165['push'](_0x572165['shift']());}};_0x8c8709(++_0x6a45cc);}(_0x2f9a,0xd9));var _0xa2f9=function(_0xe7908d,_0x38c980){_0xe7908d=_0xe7908d-0x0;var _0x58d6c7=_0x2f9a[_0xe7908d];return _0x58d6c7;};'use strict';var EventEmitter=require(_0xa2f9('0x0'));var VoicePrefix=require(_0xa2f9('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa2f9('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3425d6){return function(_0x575247,_0x56277b,_0x2659fc){VoicePrefixEvents[_0xa2f9('0x3')](_0x3425d6+':'+_0x575247['id'],_0x575247);VoicePrefixEvents[_0xa2f9('0x3')](_0x3425d6,_0x575247);_0x2659fc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xa2f9('0x4')](e,emitEvent(event));}}module[_0xa2f9('0x5')]=VoicePrefixEvents; \ No newline at end of file +var _0x18cf=['emit','exports','events','../../mysqldb','VoicePrefix','save','update','remove'];(function(_0x3b5e02,_0x535469){var _0x59464c=function(_0x2d11cb){while(--_0x2d11cb){_0x3b5e02['push'](_0x3b5e02['shift']());}};_0x59464c(++_0x535469);}(_0x18cf,0x122));var _0xf18c=function(_0x3a1c1b,_0x3bb5cd){_0x3a1c1b=_0x3a1c1b-0x0;var _0x2da3f2=_0x18cf[_0x3a1c1b];return _0x2da3f2;};'use strict';var EventEmitter=require(_0xf18c('0x0'));var VoicePrefix=require(_0xf18c('0x1'))['db'][_0xf18c('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf18c('0x3'),'afterUpdate':_0xf18c('0x4'),'afterDestroy':_0xf18c('0x5')};function emitEvent(_0x2907cb){return function(_0x3a3d97,_0x435879,_0x431c32){VoicePrefixEvents[_0xf18c('0x6')](_0x2907cb+':'+_0x3a3d97['id'],_0x3a3d97);VoicePrefixEvents[_0xf18c('0x6')](_0x2907cb,_0x3a3d97);_0x431c32(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xf18c('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 8035480..5601fe5 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 _0x406e=['voice_prefixes','lodash','api','moment','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define'];(function(_0x1caa71,_0x1c842d){var _0x4780b5=function(_0x5966c4){while(--_0x5966c4){_0x1caa71['push'](_0x1caa71['shift']());}};_0x4780b5(++_0x1c842d);}(_0x406e,0xf1));var _0xe406=function(_0x174396,_0x20189d){_0x174396=_0x174396-0x0;var _0x1aec8d=_0x406e[_0x174396];return _0x1aec8d;};'use strict';var _=require(_0xe406('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe406('0x1'));var moment=require(_0xe406('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe406('0x3'));var rimraf=require(_0xe406('0x4'));var config=require(_0xe406('0x5'));var attributes=require(_0xe406('0x6'));module[_0xe406('0x7')]=function(_0x4d3ece,_0x3b74c8){return _0x4d3ece[_0xe406('0x8')]('VoicePrefix',attributes,{'tableName':_0xe406('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd56=['exports','define','VoicePrefix','voice_prefixes','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x517182,_0x695b9){var _0x251dcc=function(_0x23f0cf){while(--_0x23f0cf){_0x517182['push'](_0x517182['shift']());}};_0x251dcc(++_0x695b9);}(_0xbd56,0x185));var _0x6bd5=function(_0x12c392,_0x3240e0){_0x12c392=_0x12c392-0x0;var _0x1cf3f0=_0xbd56[_0x12c392];return _0x1cf3f0;};'use strict';var _=require('lodash');var util=require(_0x6bd5('0x0'));var logger=require(_0x6bd5('0x1'))(_0x6bd5('0x2'));var moment=require(_0x6bd5('0x3'));var BPromise=require(_0x6bd5('0x4'));var rp=require(_0x6bd5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6bd5('0x6'));var attributes=require('./voicePrefix.attributes');module[_0x6bd5('0x7')]=function(_0x20724c,_0x23dbc0){return _0x20724c[_0x6bd5('0x8')](_0x6bd5('0x9'),attributes,{'tableName':_0x6bd5('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 243bfd6..5a35eec 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 _0x3e94=['error','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x418756,_0x9044bb){var _0x26ee7e=function(_0x4aea28){while(--_0x4aea28){_0x418756['push'](_0x418756['shift']());}};_0x26ee7e(++_0x9044bb);}(_0x3e94,0x67));var _0x43e9=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x3e94[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x43e9('0x0'));var util=require(_0x43e9('0x1'));var moment=require('moment');var BPromise=require(_0x43e9('0x2'));var rs=require(_0x43e9('0x3'));var fs=require('fs');var Redis=require(_0x43e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x43e9('0x5'));var logger=require(_0x43e9('0x6'))(_0x43e9('0x7'));var config=require('../../config/environment');var jayson=require(_0x43e9('0x8'));var client=jayson['client'][_0x43e9('0x9')]({'port':0x232a});config['redis']=_[_0x43e9('0xa')](config[_0x43e9('0xb')],{'host':_0x43e9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43e9('0xb')]));require(_0x43e9('0xd'))[_0x43e9('0xe')](socket);function respondWithRpcPromise(_0x208244,_0x3d2694,_0x169e98){return new BPromise(function(_0x437e1d,_0x3c3ee3){return client[_0x43e9('0xf')](_0x208244,_0x169e98)['then'](function(_0x367956){logger[_0x43e9('0x10')](_0x43e9('0x11'),_0x3d2694,'request\x20sent');logger[_0x43e9('0x12')](_0x43e9('0x13'),_0x3d2694,_0x43e9('0x14'),JSON[_0x43e9('0x15')](_0x367956));if(_0x367956[_0x43e9('0x16')]){if(_0x367956['error']['code']===0x1f4){logger[_0x43e9('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x3d2694,_0x367956[_0x43e9('0x16')][_0x43e9('0x17')]);return _0x3c3ee3(_0x367956[_0x43e9('0x16')][_0x43e9('0x17')]);}logger[_0x43e9('0x16')](_0x43e9('0x11'),_0x3d2694,_0x367956[_0x43e9('0x16')][_0x43e9('0x17')]);return _0x437e1d(_0x367956[_0x43e9('0x16')][_0x43e9('0x17')]);}else{logger[_0x43e9('0x10')](_0x43e9('0x11'),_0x3d2694,_0x43e9('0x14'));_0x437e1d(_0x367956[_0x43e9('0x18')]['message']);}})['catch'](function(_0x38b426){logger[_0x43e9('0x16')](_0x43e9('0x11'),_0x3d2694,_0x38b426);_0x3c3ee3(_0x38b426);});});} \ No newline at end of file +var _0xc051=['jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket','register','request','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x57ed8b,_0x2d83c3){var _0x38fd85=function(_0x4ecd0c){while(--_0x4ecd0c){_0x57ed8b['push'](_0x57ed8b['shift']());}};_0x38fd85(++_0x2d83c3);}(_0xc051,0xb5));var _0x1c05=function(_0x34ca62,_0x5c0ea9){_0x34ca62=_0x34ca62-0x0;var _0x2400ab=_0xc051[_0x34ca62];return _0x2400ab;};'use strict';var _=require(_0x1c05('0x0'));var util=require(_0x1c05('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1c05('0x2'));var fs=require('fs');var Redis=require(_0x1c05('0x3'));var db=require(_0x1c05('0x4'))['db'];var utils=require(_0x1c05('0x5'));var logger=require('../../config/logger')(_0x1c05('0x6'));var config=require(_0x1c05('0x7'));var jayson=require(_0x1c05('0x8'));var client=jayson[_0x1c05('0x9')][_0x1c05('0xa')]({'port':0x232a});config[_0x1c05('0xb')]=_[_0x1c05('0xc')](config[_0x1c05('0xb')],{'host':_0x1c05('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c05('0xb')]));require(_0x1c05('0xe'))[_0x1c05('0xf')](socket);function respondWithRpcPromise(_0x3cabf1,_0x501f08,_0x25afe5){return new BPromise(function(_0x198a9b,_0x4241a4){return client[_0x1c05('0x10')](_0x3cabf1,_0x25afe5)['then'](function(_0x3c7d13){logger['info'](_0x1c05('0x11'),_0x501f08,_0x1c05('0x12'));logger[_0x1c05('0x13')](_0x1c05('0x14'),_0x501f08,_0x1c05('0x12'),JSON[_0x1c05('0x15')](_0x3c7d13));if(_0x3c7d13[_0x1c05('0x16')]){if(_0x3c7d13[_0x1c05('0x16')][_0x1c05('0x17')]===0x1f4){logger[_0x1c05('0x16')](_0x1c05('0x11'),_0x501f08,_0x3c7d13[_0x1c05('0x16')]['message']);return _0x4241a4(_0x3c7d13[_0x1c05('0x16')][_0x1c05('0x18')]);}logger[_0x1c05('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x501f08,_0x3c7d13[_0x1c05('0x16')]['message']);return _0x198a9b(_0x3c7d13[_0x1c05('0x16')][_0x1c05('0x18')]);}else{logger[_0x1c05('0x19')](_0x1c05('0x11'),_0x501f08,_0x1c05('0x12'));_0x198a9b(_0x3c7d13['result'][_0x1c05('0x18')]);}})[_0x1c05('0x1a')](function(_0x3ad16c){logger['error'](_0x1c05('0x11'),_0x501f08,_0x3ad16c);_0x4241a4(_0x3ad16c);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 409eade..5a29768 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 _0x12c9=['emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','remove'];(function(_0x31093f,_0x1a13ec){var _0x35b054=function(_0x298b27){while(--_0x298b27){_0x31093f['push'](_0x31093f['shift']());}};_0x35b054(++_0x1a13ec);}(_0x12c9,0x9f));var _0x912c=function(_0x25517f,_0x496fa6){_0x25517f=_0x25517f-0x0;var _0xd1550c=_0x12c9[_0x25517f];return _0xd1550c;};'use strict';var VoicePrefixEvents=require(_0x912c('0x0'));var events=['save',_0x912c('0x1'),'update'];function createListener(_0x139c98,_0x522495){return function(_0x3364ce){_0x522495[_0x912c('0x2')](_0x139c98,_0x3364ce);};}function removeListener(_0x438fd6,_0x2a35f5){return function(){VoicePrefixEvents[_0x912c('0x3')](_0x438fd6,_0x2a35f5);};}exports[_0x912c('0x4')]=function(_0x572179){for(var _0x5daa7d=0x0,_0x31a317=events[_0x912c('0x5')];_0x5daa7d<_0x31a317;_0x5daa7d++){var _0x4745c5=events[_0x5daa7d];var _0x486e08=createListener(_0x912c('0x6')+_0x4745c5,_0x572179);VoicePrefixEvents['on'](_0x4745c5,_0x486e08);}}; \ No newline at end of file +var _0xde2c=['save','remove','update','emit','removeListener','register','length','./voicePrefix.events'];(function(_0x40dd8b,_0x76989c){var _0x591c6e=function(_0x53a364){while(--_0x53a364){_0x40dd8b['push'](_0x40dd8b['shift']());}};_0x591c6e(++_0x76989c);}(_0xde2c,0x7f));var _0xcde2=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0xde2c[_0x2c2980];return _0x2a20a9;};'use strict';var VoicePrefixEvents=require(_0xcde2('0x0'));var events=[_0xcde2('0x1'),_0xcde2('0x2'),_0xcde2('0x3')];function createListener(_0x7595ed,_0x40fa0a){return function(_0x33bb0c){_0x40fa0a[_0xcde2('0x4')](_0x7595ed,_0x33bb0c);};}function removeListener(_0x55c175,_0x4353c8){return function(){VoicePrefixEvents[_0xcde2('0x5')](_0x55c175,_0x4353c8);};}exports[_0xcde2('0x6')]=function(_0x1398de){for(var _0x401b16=0x0,_0x53c558=events[_0xcde2('0x7')];_0x401b16<_0x53c558;_0x401b16++){var _0x385e83=events[_0x401b16];var _0x9c7036=createListener('voicePrefix:'+_0x385e83,_0x1398de);VoicePrefixEvents['on'](_0x385e83,_0x9c7036);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a4264b6..1af551f 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 _0x0807=['/:id/users','getAgents','/:id/members','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','update','delete','/:id','removeAgents','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','/:id/teams','getTeams'];(function(_0x2a87d4,_0x1d3683){var _0x1a8e9d=function(_0x47f5ce){while(--_0x47f5ce){_0x2a87d4['push'](_0x2a87d4['shift']());}};_0x1a8e9d(++_0x1d3683);}(_0x0807,0x1b5));var _0x7080=function(_0x2f1606,_0xeb823e){_0x2f1606=_0x2f1606-0x0;var _0x47fe48=_0x0807[_0x2f1606];return _0x47fe48;};'use strict';var multer=require(_0x7080('0x0'));var util=require(_0x7080('0x1'));var path=require(_0x7080('0x2'));var timeout=require(_0x7080('0x3'));var express=require(_0x7080('0x4'));var router=express[_0x7080('0x5')]();var fs_extra=require(_0x7080('0x6'));var auth=require(_0x7080('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7080('0x8'));var controller=require('./voiceQueue.controller');router[_0x7080('0x9')]('/',auth[_0x7080('0xa')](),controller['index']);router[_0x7080('0x9')]('/:id',auth[_0x7080('0xa')](),controller['show']);router[_0x7080('0x9')](_0x7080('0xb'),auth[_0x7080('0xa')](),controller[_0x7080('0xc')]);router[_0x7080('0x9')](_0x7080('0xd'),auth[_0x7080('0xa')](),controller[_0x7080('0xe')]);router['get']('/:id/hopper_finals',auth[_0x7080('0xa')](),controller[_0x7080('0xf')]);router[_0x7080('0x9')](_0x7080('0x10'),auth[_0x7080('0xa')](),controller['getHopperBlacks']);router[_0x7080('0x9')](_0x7080('0x11'),auth['isAuthenticated'](),controller[_0x7080('0x12')]);router[_0x7080('0x9')](_0x7080('0x13'),auth[_0x7080('0xa')](),controller[_0x7080('0x14')]);router[_0x7080('0x9')](_0x7080('0x15'),auth[_0x7080('0xa')](),controller['getMembers']);router[_0x7080('0x9')](_0x7080('0x16'),auth[_0x7080('0xa')](),controller[_0x7080('0x17')]);router[_0x7080('0x9')](_0x7080('0x18'),auth[_0x7080('0xa')](),controller['getBlackLists']);router[_0x7080('0x19')]('/',auth[_0x7080('0xa')](),controller[_0x7080('0x1a')]);router[_0x7080('0x19')](_0x7080('0x1b'),auth[_0x7080('0xa')](),controller['clone']);router[_0x7080('0x19')](_0x7080('0x11'),auth[_0x7080('0xa')](),controller[_0x7080('0x1c')]);router[_0x7080('0x19')](_0x7080('0x13'),auth['isAuthenticated'](),controller[_0x7080('0x1d')]);router[_0x7080('0x19')](_0x7080('0x16'),auth[_0x7080('0xa')](),controller[_0x7080('0x1e')]);router['post'](_0x7080('0x18'),auth[_0x7080('0xa')](),controller[_0x7080('0x1f')]);router['put']('/:id',auth[_0x7080('0xa')](),controller[_0x7080('0x20')]);router[_0x7080('0x21')](_0x7080('0x22'),auth[_0x7080('0xa')](),controller['destroy']);router[_0x7080('0x21')](_0x7080('0x11'),auth[_0x7080('0xa')](),controller['removeTeams']);router[_0x7080('0x21')](_0x7080('0x13'),auth[_0x7080('0xa')](),controller[_0x7080('0x23')]);router[_0x7080('0x21')](_0x7080('0x16'),auth[_0x7080('0xa')](),controller['removeLists']);router[_0x7080('0x21')](_0x7080('0x18'),auth[_0x7080('0xa')](),controller[_0x7080('0x24')]);module[_0x7080('0x25')]=router; \ No newline at end of file +var _0x5183=['/:id/clone','clone','addTeams','addAgents','put','update','delete','destroy','removeTeams','/:id/users','removeLists','removeBlackLists','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','index','/:id','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create'];(function(_0x2ae5ce,_0x481760){var _0x3ccd3c=function(_0x3b870c){while(--_0x3b870c){_0x2ae5ce['push'](_0x2ae5ce['shift']());}};_0x3ccd3c(++_0x481760);}(_0x5183,0xe9));var _0x3518=function(_0x5c1945,_0x1b82c9){_0x5c1945=_0x5c1945-0x0;var _0x5eef2e=_0x5183[_0x5c1945];return _0x5eef2e;};'use strict';var multer=require('multer');var util=require(_0x3518('0x0'));var path=require(_0x3518('0x1'));var timeout=require('connect-timeout');var express=require(_0x3518('0x2'));var router=express[_0x3518('0x3')]();var fs_extra=require(_0x3518('0x4'));var auth=require(_0x3518('0x5'));var interaction=require(_0x3518('0x6'));var config=require('../../config/environment');var controller=require(_0x3518('0x7'));router[_0x3518('0x8')]('/',auth['isAuthenticated'](),controller[_0x3518('0x9')]);router[_0x3518('0x8')](_0x3518('0xa'),auth[_0x3518('0xb')](),controller['show']);router['get'](_0x3518('0xc'),auth[_0x3518('0xb')](),controller[_0x3518('0xd')]);router[_0x3518('0x8')](_0x3518('0xe'),auth['isAuthenticated'](),controller[_0x3518('0xf')]);router['get'](_0x3518('0x10'),auth[_0x3518('0xb')](),controller[_0x3518('0x11')]);router[_0x3518('0x8')](_0x3518('0x12'),auth[_0x3518('0xb')](),controller[_0x3518('0x13')]);router['get'](_0x3518('0x14'),auth[_0x3518('0xb')](),controller[_0x3518('0x15')]);router[_0x3518('0x8')]('/:id/users',auth[_0x3518('0xb')](),controller[_0x3518('0x16')]);router['get'](_0x3518('0x17'),auth['isAuthenticated'](),controller[_0x3518('0x18')]);router['get'](_0x3518('0x19'),auth[_0x3518('0xb')](),controller[_0x3518('0x1a')]);router[_0x3518('0x8')](_0x3518('0x1b'),auth[_0x3518('0xb')](),controller[_0x3518('0x1c')]);router[_0x3518('0x1d')]('/',auth[_0x3518('0xb')](),controller[_0x3518('0x1e')]);router[_0x3518('0x1d')](_0x3518('0x1f'),auth[_0x3518('0xb')](),controller[_0x3518('0x20')]);router[_0x3518('0x1d')](_0x3518('0x14'),auth[_0x3518('0xb')](),controller[_0x3518('0x21')]);router[_0x3518('0x1d')]('/:id/users',auth[_0x3518('0xb')](),controller[_0x3518('0x22')]);router[_0x3518('0x1d')]('/:id/lists',auth[_0x3518('0xb')](),controller['addLists']);router[_0x3518('0x1d')](_0x3518('0x1b'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0x3518('0x23')](_0x3518('0xa'),auth[_0x3518('0xb')](),controller[_0x3518('0x24')]);router[_0x3518('0x25')](_0x3518('0xa'),auth['isAuthenticated'](),controller[_0x3518('0x26')]);router[_0x3518('0x25')](_0x3518('0x14'),auth[_0x3518('0xb')](),controller[_0x3518('0x27')]);router[_0x3518('0x25')](_0x3518('0x28'),auth[_0x3518('0xb')](),controller['removeAgents']);router[_0x3518('0x25')]('/:id/lists',auth[_0x3518('0xb')](),controller[_0x3518('0x29')]);router[_0x3518('0x25')]('/:id/blacklists',auth[_0x3518('0xb')](),controller[_0x3518('0x2a')]);module[_0x3518('0x2b')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index d67abcc..e33c808 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 _0x79a8=['Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','#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)','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','STRING','name','ENUM','outbound','default','ringall','leastrecent','fewestcalls','random','linear','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','Dial\x20Method.','UNSIGNED','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate'];(function(_0x5b1698,_0x3e58e3){var _0x5d0f12=function(_0x26faed){while(--_0x26faed){_0x5b1698['push'](_0x5b1698['shift']());}};_0x5d0f12(++_0x3e58e3);}(_0x79a8,0x1d0));var _0x879a=function(_0x39bc80,_0x18f609){_0x39bc80=_0x39bc80-0x0;var _0x350050=_0x79a8[_0x39bc80];return _0x350050;};'use strict';var Sequelize=require(_0x879a('0x0'));module['exports']={'name':{'type':Sequelize[_0x879a('0x1')],'allowNull':![],'unique':_0x879a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x879a('0x3')]('inbound',_0x879a('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x879a('0x1')],'defaultValue':_0x879a('0x5')},'announce':{'type':Sequelize[_0x879a('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x879a('0x3')]('rr',_0x879a('0x6'),_0x879a('0x7'),_0x879a('0x8'),_0x879a('0x9'),'rrmemory',_0x879a('0xa'),'wrandom',_0x879a('0xb')),'allowNull':![],'defaultValue':_0x879a('0x6'),'set':function(_0x5eba04){this[_0x879a('0xc')](_0x879a('0xd'),_0x5eba04?_0x5eba04:_0x879a('0xe'));},'get':function(){var _0x5e792e=this[_0x879a('0xf')](_0x879a('0x10'));var _0x4ce306=this['getDataValue'](_0x879a('0x11'));var _0x1ccaf2=this[_0x879a('0xf')](_0x879a('0xd'));if(_0x5e792e==='inbound'){return _0x1ccaf2;}if(_0x4ce306===_0x879a('0x12')&&_0x1ccaf2===_0x879a('0xe')||_0x4ce306===_0x879a('0x12')&&_0x1ccaf2===_0x879a('0x13')){return _0x1ccaf2;}if(_0x4ce306===_0x879a('0x14')||_0x4ce306===_0x879a('0x15')||_0x4ce306===_0x879a('0x16')){return _0x1ccaf2;}return null;}},'servicelevel':{'type':Sequelize[_0x879a('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x879a('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x879a('0x17')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x879a('0x1')]},'weight':{'type':Sequelize[_0x879a('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x879a('0x3')](_0x879a('0x18'),'no'),'defaultValue':_0x879a('0x18')},'autopause':{'type':Sequelize[_0x879a('0x3')](_0x879a('0x18'),'no',_0x879a('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x879a('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0x879a('0x3')](_0x879a('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x879a('0x3')](_0x879a('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x879a('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x879a('0x3')](_0x879a('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x879a('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x879a('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x879a('0x3')](_0x879a('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x879a('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x879a('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x879a('0x3')](_0x879a('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x879a('0x18')},'announce_holdtime':{'type':Sequelize[_0x879a('0x3')](_0x879a('0x18'),'no',_0x879a('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x879a('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x879a('0x3')](_0x879a('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x879a('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x879a('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x879a('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x879a('0x1')]},'queue_youarenext':{'type':Sequelize[_0x879a('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x879a('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x879a('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x879a('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x879a('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x879a('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x879a('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x879a('0x1')]},'queue_quantity1':{'type':Sequelize[_0x879a('0x1')]},'queue_quantity2':{'type':Sequelize[_0x879a('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x879a('0x1')]},'queue_less_than':{'type':Sequelize[_0x879a('0x1')]},'periodic_announce':{'type':Sequelize[_0x879a('0x1b')],'set':function(_0x1c06f8){this[_0x879a('0xc')](_0x879a('0x1c'),_0x1c06f8?_0x1c06f8[_0x879a('0x1d')](','):[]);},'get':function(){return this[_0x879a('0xf')](_0x879a('0x1c'))?this[_0x879a('0xf')]('periodic_announce')[_0x879a('0x1e')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x879a('0x18'),'set':function(_0x314899){this[_0x879a('0xc')]('joinempty',_0x314899?_0x314899[_0x879a('0x1d')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this['getDataValue']('joinempty')[_0x879a('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x879a('0x1')],'defaultValue':'no','set':function(_0x4dcf18){this[_0x879a('0xc')](_0x879a('0x1f'),_0x4dcf18?_0x4dcf18[_0x879a('0x1d')](','):undefined);},'get':function(){return this['getDataValue'](_0x879a('0x1f'))?this[_0x879a('0xf')](_0x879a('0x1f'))[_0x879a('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x879a('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x879a('0x3')](_0x879a('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x879a('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x879a('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x879a('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x400bbb){this[_0x879a('0xc')]('acw',_0x400bbb);if(_0x400bbb){if(this[_0x879a('0xf')](_0x879a('0x20'))<0x2){this[_0x879a('0xc')](_0x879a('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x879a('0x21')],'defaultValue':0x0,'comment':_0x879a('0x22')},'dialMethod':{'type':Sequelize[_0x879a('0x3')]('preview','progressive','power','predictive','booked'),'defaultValue':_0x879a('0x14'),'comment':_0x879a('0x23')},'dialLimitChannel':{'type':Sequelize[_0x879a('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x879a('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x879a('0x25')](0x2)[_0x879a('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x879a('0x26')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x879a('0x27')),'defaultValue':'dropRate','comment':_0x879a('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x879a('0x25')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x879a('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x879a('0x17')](0x3)[_0x879a('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x879a('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x879a('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x879a('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x879a('0x2a')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x879a('0x2b'),'comment':_0x879a('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x879a('0x17')](0x3)[_0x879a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x879a('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x879a('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x879a('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x879a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x879a('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x879a('0x17')](0x3)[_0x879a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x879a('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0x879a('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x879a('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x879a('0x17')](0x3)[_0x879a('0x24')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x879a('0x17')](0x5)[_0x879a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x879a('0x31')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x879a('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x879a('0x32')},'dialTimezone':{'type':Sequelize[_0x879a('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x879a('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x879a('0x3')](_0x879a('0x33'),'never',_0x879a('0x34')),'defaultValue':_0x879a('0x33')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x879a('0x35')},'dialAMDInitialSilence':{'type':Sequelize[_0x879a('0x17')](0x9)[_0x879a('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x879a('0x36')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x879a('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x879a('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x879a('0x17')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x879a('0x17')](0x9)[_0x879a('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x879a('0x17')](0x9)[_0x879a('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x879a('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x879a('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x879a('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x879a('0x17')](0x9)[_0x879a('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x879a('0x17')](0x5)[_0x879a('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x879a('0x17')](0x9)[_0x879a('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x879a('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x879a('0x3a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x879a('0x3')]('DESC',_0x879a('0x3b')),'defaultValue':_0x879a('0x3c')},'dialQueueProject2':{'type':Sequelize[_0x879a('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x879a('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x879a('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x879a('0x17')](0x3)[_0x879a('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x879a('0x3d')},'dialCutDigit':{'type':Sequelize[_0x879a('0x17')](0x3)[_0x879a('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x879a('0x3e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x879a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x879a('0x3f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x879a('0x40')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x879a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x879a('0x41')},'dialDropRetryFrequency':{'type':Sequelize[_0x879a('0x17')](0x5)[_0x879a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x879a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x879a('0x42')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x879a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x879a('0x43')},'dialMachineMaxRetry':{'type':Sequelize[_0x879a('0x17')](0x3)[_0x879a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x879a('0x44')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x879a('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x879a('0x17')](0x5)[_0x879a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x879a('0x45')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x879a('0x17')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x879a('0x21')],'defaultValue':![],'comment':_0x879a('0x46'),'set':function(_0x4a482e){if(!_0x4a482e)this['setDataValue'](_0x879a('0x47'),null);this[_0x879a('0xc')]('mandatoryDisposition',_0x4a482e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x879a('0x17')](0x3)[_0x879a('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x879a('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x1e92=['DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','inbound','outbound','default','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','rrordered','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','setDataValue','joinempty','leavewhenempty','acw','wrapuptime','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','FLOAT','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','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)','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)','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue'];(function(_0x17d400,_0x440dff){var _0x1d0a39=function(_0x43ad32){while(--_0x43ad32){_0x17d400['push'](_0x17d400['shift']());}};_0x1d0a39(++_0x440dff);}(_0x1e92,0x1df));var _0x21e9=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x1e92[_0x2283dc];return _0x16db90;};'use strict';var Sequelize=require(_0x21e9('0x0'));module['exports']={'name':{'type':Sequelize[_0x21e9('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x21e9('0x2'),_0x21e9('0x3')),'allowNull':![],'defaultValue':_0x21e9('0x2')},'musiconhold':{'type':Sequelize[_0x21e9('0x1')],'defaultValue':_0x21e9('0x4')},'announce':{'type':Sequelize[_0x21e9('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x21e9('0x5')]('rr',_0x21e9('0x6'),_0x21e9('0x7'),_0x21e9('0x8'),_0x21e9('0x9'),_0x21e9('0xa'),'linear',_0x21e9('0xb'),_0x21e9('0xc')),'allowNull':![],'defaultValue':_0x21e9('0x6'),'set':function(_0x642c5c){this['setDataValue'](_0x21e9('0xd'),_0x642c5c?_0x642c5c:'rrmemory');},'get':function(){var _0x1d384d=this[_0x21e9('0xe')](_0x21e9('0xf'));var _0x2e7462=this[_0x21e9('0xe')](_0x21e9('0x10'));var _0x51b1d6=this[_0x21e9('0xe')]('strategy');if(_0x1d384d===_0x21e9('0x2')){return _0x51b1d6;}if(_0x2e7462===_0x21e9('0x11')&&_0x51b1d6===_0x21e9('0xa')||_0x2e7462===_0x21e9('0x11')&&_0x51b1d6===_0x21e9('0x12')){return _0x51b1d6;}if(_0x2e7462===_0x21e9('0x13')||_0x2e7462===_0x21e9('0x14')||_0x2e7462==='power'){return _0x51b1d6;}return null;}},'servicelevel':{'type':Sequelize[_0x21e9('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x21e9('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x21e9('0x15')](0xb)},'timeout':{'type':Sequelize[_0x21e9('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x21e9('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x21e9('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x21e9('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x21e9('0x5')](_0x21e9('0x16'),'no'),'defaultValue':_0x21e9('0x16')},'autopause':{'type':Sequelize['ENUM'](_0x21e9('0x16'),'no',_0x21e9('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x21e9('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x21e9('0x5')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x21e9('0x5')](_0x21e9('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x21e9('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x21e9('0x5')](_0x21e9('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x21e9('0x5')](_0x21e9('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x21e9('0x5')](_0x21e9('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x21e9('0x5')](_0x21e9('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x21e9('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x21e9('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x21e9('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x21e9('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x21e9('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x21e9('0x16')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0x21e9('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x21e9('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x21e9('0x5')](_0x21e9('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x21e9('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x21e9('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x21e9('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x21e9('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x21e9('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x21e9('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x21e9('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x21e9('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x21e9('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x21e9('0x1')]},'periodic_announce':{'type':Sequelize[_0x21e9('0x19')],'set':function(_0x2b897b){this['setDataValue'](_0x21e9('0x1a'),_0x2b897b?_0x2b897b[_0x21e9('0x1b')](','):[]);},'get':function(){return this[_0x21e9('0xe')](_0x21e9('0x1a'))?this['getDataValue'](_0x21e9('0x1a'))[_0x21e9('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x21e9('0x1')],'defaultValue':'yes','set':function(_0xe755c6){this[_0x21e9('0x1d')](_0x21e9('0x1e'),_0xe755c6?_0xe755c6['join'](','):undefined);},'get':function(){return this[_0x21e9('0xe')]('joinempty')?this['getDataValue'](_0x21e9('0x1e'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x206d48){this[_0x21e9('0x1d')](_0x21e9('0x1f'),_0x206d48?_0x206d48[_0x21e9('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0x21e9('0x1f'))?this[_0x21e9('0xe')](_0x21e9('0x1f'))[_0x21e9('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x21e9('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x21e9('0x5')](_0x21e9('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x21e9('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x21e9('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x372702){this['setDataValue'](_0x21e9('0x20'),_0x372702);if(_0x372702){if(this[_0x21e9('0xe')](_0x21e9('0x21'))<0x2){this[_0x21e9('0x1d')](_0x21e9('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x21e9('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0x21e9('0x22'),_0x21e9('0x13'),'power','predictive',_0x21e9('0x11')),'defaultValue':_0x21e9('0x13'),'comment':_0x21e9('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x21e9('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x21e9('0x25')},'dialLimitQueue':{'type':Sequelize[_0x21e9('0x15')](0x4)[_0x21e9('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x21e9('0x26')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x21e9('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x21e9('0x5')](_0x21e9('0x28'),'dropRate'),'defaultValue':_0x21e9('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x21e9('0x2a')](0x2)[_0x21e9('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x21e9('0x15')](0x3)[_0x21e9('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x21e9('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x21e9('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x21e9('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x21e9('0x15')](0x3)[_0x21e9('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21e9('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x21e9('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21e9('0x2e')},'dialQueueProject':{'type':Sequelize[_0x21e9('0x1')],'comment':_0x21e9('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x21e9('0x15')](0x3)[_0x21e9('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21e9('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x21e9('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21e9('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x21e9('0x15')](0x3)[_0x21e9('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21e9('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x21e9('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21e9('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x21e9('0x15')](0x3)[_0x21e9('0x24')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x21e9('0x15')](0x5)[_0x21e9('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21e9('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x21e9('0x35')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x21e9('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x21e9('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x21e9('0x5')](_0x21e9('0x36'),_0x21e9('0x37'),_0x21e9('0x38')),'defaultValue':_0x21e9('0x36')},'dialAMDActive':{'type':Sequelize[_0x21e9('0x39')],'defaultValue':0x0,'comment':_0x21e9('0x3a')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x21e9('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x21e9('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0x21e9('0x15')](0x9)[_0x21e9('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x21e9('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x21e9('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x21e9('0x15')](0x9)[_0x21e9('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x21e9('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x21e9('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x21e9('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x21e9('0x15')](0x9)[_0x21e9('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x21e9('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x21e9('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x21e9('0x15')](0x9)[_0x21e9('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x21e9('0x40')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x21e9('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x21e9('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x21e9('0x39')],'defaultValue':0x0,'comment':_0x21e9('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x21e9('0x5')](_0x21e9('0x43'),'ASC'),'defaultValue':_0x21e9('0x43')},'dialQueueProject2':{'type':Sequelize[_0x21e9('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x21e9('0x39')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x21e9('0x39')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x21e9('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x21e9('0x44')},'dialCutDigit':{'type':Sequelize[_0x21e9('0x15')](0x3)[_0x21e9('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x21e9('0x15')](0x3)[_0x21e9('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21e9('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x21e9('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x21e9('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21e9('0x46')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x21e9('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x21e9('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x21e9('0x15')](0x5)[_0x21e9('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21e9('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x21e9('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21e9('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0x21e9('0x15')](0x5)[_0x21e9('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x21e9('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21e9('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x21e9('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x21e9('0x15')],'allowNull':!![],'comment':_0x21e9('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x21e9('0x39')],'defaultValue':![],'comment':_0x21e9('0x4b'),'set':function(_0x3a6dbc){if(!_0x3a6dbc)this[_0x21e9('0x1d')](_0x21e9('0x4c'),null);this[_0x21e9('0x1d')](_0x21e9('0x4d'),_0x3a6dbc);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x21e9('0x15')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x21e9('0x15')](0x3)[_0x21e9('0x24')],'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 cf418fb..8d0d9e2 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 _0xb039=['../../mysqldb','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','undefined','limit','count','offset','set','reject','save','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','index','map','VoiceQueue','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','findAll','params','create','body','role','UserProfileSection','autoAssociation','catch','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','nolimit','order','VoiceQueueId','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','User','Agents','online','voicePause','interface','forEach','sequelize','transaction','addTeams','each','upsert','penalty','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','push','isArray','destroy','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','cm_hopper','phone','ContactId','NOW()','scheduledAt','CmListId','ListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','into','fromQuery','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x42a062,_0x2fc8be){var _0x33cbe6=function(_0x10faf4){while(--_0x10faf4){_0x42a062['push'](_0x42a062['shift']());}};_0x33cbe6(++_0x2fc8be);}(_0xb039,0x150));var _0x9b03=function(_0x205e5a,_0x5c19fb){_0x205e5a=_0x205e5a-0x0;var _0x10da58=_0xb039[_0x205e5a];return _0x10da58;};'use strict';var emlformat=require(_0x9b03('0x0'));var rimraf=require(_0x9b03('0x1'));var zipdir=require(_0x9b03('0x2'));var jsonpatch=require(_0x9b03('0x3'));var rp=require('request-promise');var moment=require(_0x9b03('0x4'));var BPromise=require(_0x9b03('0x5'));var Mustache=require(_0x9b03('0x6'));var util=require(_0x9b03('0x7'));var path=require('path');var sox=require(_0x9b03('0x8'));var csv=require(_0x9b03('0x9'));var ejs=require(_0x9b03('0xa'));var fs=require('fs');var fs_extra=require(_0x9b03('0xb'));var _=require(_0x9b03('0xc'));var squel=require(_0x9b03('0xd'));var crypto=require('crypto');var jsforce=require(_0x9b03('0xe'));var deskjs=require(_0x9b03('0xf'));var toCsv=require(_0x9b03('0x9'));var querystring=require(_0x9b03('0x10'));var Papa=require('papaparse');var Redis=require(_0x9b03('0x11'));var authService=require(_0x9b03('0x12'));var qs=require(_0x9b03('0x13'));var as=require(_0x9b03('0x14'));var hardwareService=require(_0x9b03('0x15'));var logger=require(_0x9b03('0x16'))(_0x9b03('0x17'));var utils=require('../../config/utils');var config=require(_0x9b03('0x18'));var licenseUtil=require(_0x9b03('0x19'));var db=require(_0x9b03('0x1a'))['db'];config[_0x9b03('0x1b')]=_['defaults'](config[_0x9b03('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x9b03('0x1c'))(new Redis(config[_0x9b03('0x1b')]));require(_0x9b03('0x1d'))['register'](socket);function respondWithStatusCode(_0x5c0bd8,_0x35f7be){_0x35f7be=_0x35f7be||0xcc;return function(_0x589b6a){if(_0x589b6a){return _0x5c0bd8[_0x9b03('0x1e')](_0x35f7be);}return _0x5c0bd8[_0x9b03('0x1f')](_0x35f7be)[_0x9b03('0x20')]();};}function respondWithResult(_0x4388fd,_0x496619){_0x496619=_0x496619||0xc8;return function(_0x1027ae){if(_0x1027ae){return _0x4388fd['status'](_0x496619)['json'](_0x1027ae);}};}function respondWithFilteredResult(_0x50c946,_0x449a18){return function(_0x5d55b7){if(_0x5d55b7){var _0x2b50d7=typeof _0x449a18['offset']===_0x9b03('0x21')&&typeof _0x449a18[_0x9b03('0x22')]==='undefined';var _0x1fc270=_0x5d55b7[_0x9b03('0x23')];var _0x48a4fb=_0x2b50d7?0x0:_0x449a18[_0x9b03('0x24')];var _0x49a898=_0x2b50d7?_0x5d55b7['count']:_0x449a18['offset']+_0x449a18[_0x9b03('0x22')];var _0x4b6441;if(_0x49a898>=_0x1fc270){_0x49a898=_0x1fc270;_0x4b6441=0xc8;}else{_0x4b6441=0xce;}_0x50c946['status'](_0x4b6441);return _0x50c946[_0x9b03('0x25')]('Content-Range',_0x48a4fb+'-'+_0x49a898+'/'+_0x1fc270)['json'](_0x5d55b7);}return null;};}function patchUpdates(_0x3245f0){return function(_0x29e5fa){try{jsonpatch['apply'](_0x29e5fa,_0x3245f0,!![]);}catch(_0x56f581){return BPromise[_0x9b03('0x26')](_0x56f581);}return _0x29e5fa[_0x9b03('0x27')]();};}function saveUpdates(_0x47c3b9,_0x11c416){return function(_0x20f9f8){if(_0x20f9f8){return _0x20f9f8[_0x9b03('0x28')](_0x47c3b9)[_0x9b03('0x29')](function(_0xeaa8e6){return _0xeaa8e6;});}return null;};}function removeEntity(_0x13f3b3,_0x30a76e){return function(_0x530b6c){if(_0x530b6c){return _0x530b6c['destroy']()['then'](function(){var _0x4d09b7=_0x530b6c[_0x9b03('0x2a')]({'plain':!![]});var _0x2aa388=[{'name':_0x9b03('0x2b'),'value':_0x9b03('0x2c'),'ignore':![]},{'name':_0x9b03('0x2d'),'value':_0x9b03('0x2e'),'ignore':![]}];var _0x4e0ed=_(_0x2aa388)[_0x9b03('0x2f')](_0x9b03('0x30'))['map'](_0x9b03('0x31'))[_0x9b03('0x31')]();if(_[_0x9b03('0x32')](_0x4e0ed,_0x4d09b7[_0x9b03('0x33')])){return;}var _0x5849e7=_[_0x9b03('0x34')](_0x2aa388,[_0x9b03('0x31'),_0x4d09b7[_0x9b03('0x33')]])[_0x9b03('0x35')];return db[_0x9b03('0x36')]['destroy']({'where':{'type':_0x5849e7,'resourceId':_0x4d09b7['id']}})[_0x9b03('0x29')](function(){return _0x530b6c;});})[_0x9b03('0x29')](function(){_0x13f3b3[_0x9b03('0x1f')](0xcc)[_0x9b03('0x20')]();});}};}function handleEntityNotFound(_0x3adb33,_0x1a0eac){return function(_0x843dd7){if(!_0x843dd7){_0x3adb33[_0x9b03('0x1e')](0x194);}return _0x843dd7;};}function handleError(_0x14de9d,_0x1c83bb){_0x1c83bb=_0x1c83bb||0x1f4;return function(_0x2ac78d){logger[_0x9b03('0x37')](_0x2ac78d[_0x9b03('0x38')]);if(_0x2ac78d[_0x9b03('0x35')]){delete _0x2ac78d[_0x9b03('0x35')];}_0x14de9d[_0x9b03('0x1f')](_0x1c83bb)['send'](_0x2ac78d);};}exports[_0x9b03('0x39')]=function(_0x345b55,_0x22bbec){var _0x1e3390={},_0x53b9a0={},_0x15692a={'count':0x0,'rows':[]};var _0x5a0005=_[_0x9b03('0x3a')](db[_0x9b03('0x3b')][_0x9b03('0x3c')],function(_0x494761){return{'name':_0x494761['fieldName'],'type':_0x494761[_0x9b03('0x33')]['key']};});_0x53b9a0[_0x9b03('0x3d')]=_[_0x9b03('0x3a')](_0x5a0005,_0x9b03('0x35'));_0x53b9a0[_0x9b03('0x3e')]=_[_0x9b03('0x3f')](_0x345b55[_0x9b03('0x3e')]);_0x53b9a0['filters']=_[_0x9b03('0x40')](_0x53b9a0[_0x9b03('0x3d')],_0x53b9a0[_0x9b03('0x3e')]);_0x1e3390[_0x9b03('0x41')]=_['intersection'](_0x53b9a0[_0x9b03('0x3d')],qs['fields'](_0x345b55[_0x9b03('0x3e')][_0x9b03('0x42')]));_0x1e3390[_0x9b03('0x41')]=_0x1e3390[_0x9b03('0x41')][_0x9b03('0x43')]?_0x1e3390[_0x9b03('0x41')]:_0x53b9a0[_0x9b03('0x3d')];if(!_0x345b55[_0x9b03('0x3e')][_0x9b03('0x44')]('nolimit')){_0x1e3390['limit']=qs['limit'](_0x345b55[_0x9b03('0x3e')][_0x9b03('0x22')]);_0x1e3390[_0x9b03('0x24')]=qs[_0x9b03('0x24')](_0x345b55[_0x9b03('0x3e')][_0x9b03('0x24')]);}_0x1e3390['order']=qs['sort'](_0x345b55[_0x9b03('0x3e')][_0x9b03('0x45')]);_0x1e3390[_0x9b03('0x46')]=qs[_0x9b03('0x47')](_[_0x9b03('0x48')](_0x345b55[_0x9b03('0x3e')],_0x53b9a0['filters']),_0x5a0005);if(_0x345b55['query'][_0x9b03('0x2f')]){_0x1e3390[_0x9b03('0x46')]=_['merge'](_0x1e3390[_0x9b03('0x46')],{'$or':_['map'](_0x5a0005,function(_0x50623d){if(_0x50623d[_0x9b03('0x33')]!==_0x9b03('0x49')){var _0x4b2986={};_0x4b2986[_0x50623d['name']]={'$like':'%'+_0x345b55['query']['filter']+'%'};return _0x4b2986;}})});}_0x1e3390=_[_0x9b03('0x4a')]({},_0x1e3390,_0x345b55[_0x9b03('0x4b')]);var _0x2d48ee={'where':_0x1e3390['where']};return db[_0x9b03('0x3b')][_0x9b03('0x23')](_0x2d48ee)[_0x9b03('0x29')](function(_0x5cf632){_0x15692a[_0x9b03('0x23')]=_0x5cf632;if(_0x345b55[_0x9b03('0x3e')][_0x9b03('0x4c')]){_0x1e3390[_0x9b03('0x4d')]=[{'all':!![]}];}return db[_0x9b03('0x3b')][_0x9b03('0x4e')](_0x1e3390);})[_0x9b03('0x29')](function(_0x96c75b){_0x15692a['rows']=_0x96c75b;return _0x15692a;})[_0x9b03('0x29')](respondWithFilteredResult(_0x22bbec,_0x1e3390))['catch'](handleError(_0x22bbec,null));};exports['show']=function(_0x3ab1f8,_0x58594b){var _0x4d6285={'raw':![],'where':{'id':_0x3ab1f8[_0x9b03('0x4f')]['id']}},_0x149bb7={};_0x149bb7[_0x9b03('0x3d')]=_[_0x9b03('0x3f')](db[_0x9b03('0x3b')][_0x9b03('0x3c')]);_0x149bb7[_0x9b03('0x3e')]=_[_0x9b03('0x3f')](_0x3ab1f8['query']);_0x149bb7[_0x9b03('0x47')]=_[_0x9b03('0x40')](_0x149bb7[_0x9b03('0x3d')],_0x149bb7[_0x9b03('0x3e')]);_0x4d6285[_0x9b03('0x41')]=_[_0x9b03('0x40')](_0x149bb7[_0x9b03('0x3d')],qs['fields'](_0x3ab1f8[_0x9b03('0x3e')][_0x9b03('0x42')]));_0x4d6285[_0x9b03('0x41')]=_0x4d6285[_0x9b03('0x41')][_0x9b03('0x43')]?_0x4d6285[_0x9b03('0x41')]:_0x149bb7[_0x9b03('0x3d')];if(_0x3ab1f8[_0x9b03('0x3e')][_0x9b03('0x4c')]){_0x4d6285[_0x9b03('0x4d')]=[{'all':!![]}];}_0x4d6285=_[_0x9b03('0x4a')]({},_0x4d6285,_0x3ab1f8[_0x9b03('0x4b')]);return db[_0x9b03('0x3b')]['find'](_0x4d6285)['then'](handleEntityNotFound(_0x58594b,null))['then'](respondWithResult(_0x58594b,null))['catch'](handleError(_0x58594b,null));};exports[_0x9b03('0x50')]=function(_0x441581,_0x4b9360){return db[_0x9b03('0x3b')][_0x9b03('0x50')](_0x441581[_0x9b03('0x51')],{})[_0x9b03('0x29')](function(_0x33d36a){var _0x418aa5=_0x441581['user'][_0x9b03('0x2a')]({'plain':!![]});if(!_0x418aa5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x418aa5[_0x9b03('0x52')]==='user'){var _0x4ad870=_0x33d36a[_0x9b03('0x2a')]({'plain':!![]});var _0x21bb94=[{'name':'VoiceQueues','value':_0x9b03('0x2c')},{'name':_0x9b03('0x2d'),'value':_0x9b03('0x2e')}];var _0x5e5a01=_[_0x9b03('0x34')](_0x21bb94,['value',_0x4ad870['type']])[_0x9b03('0x35')];return db[_0x9b03('0x53')][_0x9b03('0x34')]({'where':{'name':_0x5e5a01,'userProfileId':_0x418aa5['userProfileId']},'raw':!![]})['then'](function(_0x55dc51){if(_0x55dc51&&_0x55dc51[_0x9b03('0x54')]===0x0){return db[_0x9b03('0x36')][_0x9b03('0x50')]({'name':_0x4ad870[_0x9b03('0x35')],'resourceId':_0x4ad870['id'],'type':_0x55dc51['name'],'sectionId':_0x55dc51['id']},{})[_0x9b03('0x29')](function(){return _0x33d36a;});}else{return _0x33d36a;}})[_0x9b03('0x55')](function(_0x2fd87a){logger[_0x9b03('0x37')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fd87a);throw _0x2fd87a;});}return _0x33d36a;})[_0x9b03('0x29')](respondWithResult(_0x4b9360,0xc9))['catch'](handleError(_0x4b9360,null));};exports[_0x9b03('0x56')]=function(_0x4ad978,_0x49ebd2){var _0x3cf5b7={'where':{'id':_0x4ad978['params']['id']}},_0x494125={};_0x494125[_0x9b03('0x3d')]=_['keys'](db[_0x9b03('0x3b')][_0x9b03('0x3c')]);_0x3cf5b7[_0x9b03('0x41')]=_[_0x9b03('0x40')](_0x494125[_0x9b03('0x3d')],qs['fields'](_0x4ad978[_0x9b03('0x3e')][_0x9b03('0x42')]));_0x3cf5b7['attributes']=_0x3cf5b7[_0x9b03('0x41')][_0x9b03('0x43')]?_0x3cf5b7[_0x9b03('0x41')]:_0x494125[_0x9b03('0x3d')];if(_0x4ad978[_0x9b03('0x3e')][_0x9b03('0x4c')]){_0x3cf5b7[_0x9b03('0x4d')]=[{'all':!![]}];}_0x3cf5b7=_[_0x9b03('0x4a')]({},_0x3cf5b7,_0x4ad978[_0x9b03('0x4b')]);return db[_0x9b03('0x3b')]['find'](_0x3cf5b7)[_0x9b03('0x29')](handleEntityNotFound(_0x49ebd2,null))['then'](function(_0x98d07){if(_0x98d07){var _0x59567d=_0x98d07[_0x9b03('0x2a')]({'plain':!![]});_0x59567d=qs[_0x9b03('0x57')](_0x59567d,['id',_0x9b03('0x58'),_0x9b03('0x59')]);_0x4ad978[_0x9b03('0x51')]=_['omit'](_0x4ad978['body'],['id',_0x9b03('0x58'),_0x9b03('0x59')]);return db[_0x9b03('0x3b')][_0x9b03('0x50')](_['merge'](_0x59567d,_0x4ad978[_0x9b03('0x51')]),{'include':_0x4ad978['query'][_0x9b03('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x26e65a){var _0x3ae08d=_0x4ad978['user']['get']({'plain':!![]});if(!_0x3ae08d)throw new Error(_0x9b03('0x5a'));if(_0x3ae08d[_0x9b03('0x52')]===_0x9b03('0x5b')){var _0x42a4a6=_0x26e65a[_0x9b03('0x2a')]({'plain':!![]});var _0x4f1cd0=[{'name':'VoiceQueues','value':_0x9b03('0x2c')},{'name':'QueueCampaigns','value':_0x9b03('0x2e')}];var _0x59d46c=_['find'](_0x4f1cd0,[_0x9b03('0x31'),_0x42a4a6[_0x9b03('0x33')]])[_0x9b03('0x35')];return db['UserProfileSection'][_0x9b03('0x34')]({'where':{'name':_0x59d46c,'userProfileId':_0x3ae08d[_0x9b03('0x5c')]},'raw':!![]})[_0x9b03('0x29')](function(_0x44e2da){if(_0x44e2da&&_0x44e2da[_0x9b03('0x54')]===0x0){return db['UserProfileResource'][_0x9b03('0x50')]({'name':_0x42a4a6[_0x9b03('0x35')],'resourceId':_0x42a4a6['id'],'type':_0x44e2da[_0x9b03('0x35')],'sectionId':_0x44e2da['id']},{})['then'](function(){return _0x26e65a;});}else{return _0x26e65a;}})[_0x9b03('0x55')](function(_0x167fd7){logger[_0x9b03('0x37')](_0x9b03('0x5d'),_0x167fd7);throw _0x167fd7;});}return _0x26e65a;});}})[_0x9b03('0x29')](respondWithResult(_0x49ebd2,0xc9))[_0x9b03('0x55')](handleError(_0x49ebd2,null));};exports[_0x9b03('0x28')]=function(_0x45a939,_0x4ff8b9){if(_0x45a939[_0x9b03('0x51')]['id']){delete _0x45a939['body']['id'];}return db[_0x9b03('0x3b')][_0x9b03('0x34')]({'where':{'id':_0x45a939[_0x9b03('0x4f')]['id']}})[_0x9b03('0x29')](handleEntityNotFound(_0x4ff8b9,null))[_0x9b03('0x29')](saveUpdates(_0x45a939[_0x9b03('0x51')],null))['then'](respondWithResult(_0x4ff8b9,null))[_0x9b03('0x55')](handleError(_0x4ff8b9,null));};exports['destroy']=function(_0x58ca7f,_0x179827){return db[_0x9b03('0x3b')][_0x9b03('0x34')]({'where':{'id':_0x58ca7f[_0x9b03('0x4f')]['id']}})[_0x9b03('0x29')](handleEntityNotFound(_0x179827,null))[_0x9b03('0x29')](removeEntity(_0x179827,null))[_0x9b03('0x55')](handleError(_0x179827,null));};exports[_0x9b03('0x5e')]=function(_0xc81bf0,_0x1a1dcf,_0x3c587f){var _0x38bac1={'raw':![],'where':{}};var _0x5cea00={};var _0x304acb={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9b03('0x5f')]({'where':{'id':_0xc81bf0['params']['id']}})[_0x9b03('0x29')](handleEntityNotFound(_0x1a1dcf,null))[_0x9b03('0x29')](function(_0x55f8e1){if(_0x55f8e1){_0x5cea00[_0x9b03('0x3d')]=_[_0x9b03('0x3f')](db[_0x9b03('0x60')][_0x9b03('0x3c')]);_0x5cea00[_0x9b03('0x3e')]=_[_0x9b03('0x3f')](_0xc81bf0[_0x9b03('0x3e')]);_0x5cea00['filters']=_['intersection'](_0x5cea00[_0x9b03('0x3d')],_0x5cea00[_0x9b03('0x3e')]);_0x38bac1[_0x9b03('0x41')]=_[_0x9b03('0x40')](_0x5cea00['model'],qs[_0x9b03('0x42')](_0xc81bf0['query']['fields']));_0x38bac1[_0x9b03('0x41')]=_0x38bac1[_0x9b03('0x41')]['length']?_0x38bac1[_0x9b03('0x41')]:_0x5cea00[_0x9b03('0x3d')];if(!_0xc81bf0['query']['hasOwnProperty'](_0x9b03('0x61'))){_0x38bac1[_0x9b03('0x22')]=qs[_0x9b03('0x22')](_0xc81bf0['query']['limit']);_0x38bac1[_0x9b03('0x24')]=qs[_0x9b03('0x24')](_0xc81bf0[_0x9b03('0x3e')][_0x9b03('0x24')]);}_0x38bac1[_0x9b03('0x62')]=qs[_0x9b03('0x45')](_0xc81bf0['query'][_0x9b03('0x45')]);_0x38bac1[_0x9b03('0x46')]=qs['filters'](_[_0x9b03('0x48')](_0xc81bf0['query'],_0x5cea00['filters']));_0x38bac1[_0x9b03('0x46')][_0x9b03('0x63')]=_0x55f8e1['id'];if(_0xc81bf0[_0x9b03('0x3e')]['filter']){_0x38bac1[_0x9b03('0x46')]=_['merge'](_0x38bac1[_0x9b03('0x46')],{'$or':_[_0x9b03('0x3a')](_0x38bac1['attributes'],function(_0x54ccb8){var _0x59b46a={};_0x59b46a[_0x54ccb8]={'$like':'%'+_0xc81bf0['query']['filter']+'%'};return _0x59b46a;})});}_0x38bac1=_[_0x9b03('0x4a')]({},_0x38bac1,_0xc81bf0[_0x9b03('0x4b')]);return db[_0x9b03('0x60')]['count']({'where':_0x38bac1['where']})['then'](function(_0x5f4135){_0x304acb['count']=_0x5f4135;if(_0xc81bf0[_0x9b03('0x3e')][_0x9b03('0x4c')]){_0x38bac1[_0x9b03('0x4d')]=[{'all':!![]}];}return db[_0x9b03('0x60')][_0x9b03('0x4e')](_0x38bac1);})[_0x9b03('0x29')](function(_0x37234a){_0x304acb[_0x9b03('0x64')]=_0x37234a;return _0x304acb;});}})[_0x9b03('0x29')](respondWithFilteredResult(_0x1a1dcf,_0x38bac1))[_0x9b03('0x55')](handleError(_0x1a1dcf,null));};exports['getHopperHistories']=function(_0x258fcc,_0x161ee9,_0x1da0ca){var _0x24e433={'raw':!![],'where':{}};var _0x4cae53={};var _0x4541a0={'count':0x0,'rows':[]};return db[_0x9b03('0x3b')][_0x9b03('0x5f')]({'where':{'id':_0x258fcc[_0x9b03('0x4f')]['id']}})[_0x9b03('0x29')](handleEntityNotFound(_0x161ee9,null))[_0x9b03('0x29')](function(_0x46d788){if(_0x46d788){_0x4cae53[_0x9b03('0x3d')]=_[_0x9b03('0x3f')](db[_0x9b03('0x65')][_0x9b03('0x3c')]);_0x4cae53[_0x9b03('0x3e')]=_['keys'](_0x258fcc[_0x9b03('0x3e')]);_0x4cae53['filters']=_[_0x9b03('0x40')](_0x4cae53[_0x9b03('0x3d')],_0x4cae53[_0x9b03('0x3e')]);_0x24e433[_0x9b03('0x41')]=_['intersection'](_0x4cae53['model'],qs[_0x9b03('0x42')](_0x258fcc[_0x9b03('0x3e')][_0x9b03('0x42')]));_0x24e433['attributes']=_0x24e433[_0x9b03('0x41')]['length']?_0x24e433[_0x9b03('0x41')]:_0x4cae53[_0x9b03('0x3d')];if(!_0x258fcc[_0x9b03('0x3e')][_0x9b03('0x44')]('nolimit')){_0x24e433[_0x9b03('0x22')]=qs[_0x9b03('0x22')](_0x258fcc[_0x9b03('0x3e')][_0x9b03('0x22')]);_0x24e433[_0x9b03('0x24')]=qs[_0x9b03('0x24')](_0x258fcc[_0x9b03('0x3e')]['offset']);}_0x24e433[_0x9b03('0x62')]=qs[_0x9b03('0x45')](_0x258fcc[_0x9b03('0x3e')][_0x9b03('0x45')]);_0x24e433[_0x9b03('0x46')]=qs[_0x9b03('0x47')](_[_0x9b03('0x48')](_0x258fcc[_0x9b03('0x3e')],_0x4cae53['filters']));_0x24e433[_0x9b03('0x46')][_0x9b03('0x63')]=_0x46d788['id'];if(_0x258fcc['query'][_0x9b03('0x2f')]){_0x24e433[_0x9b03('0x46')]=_[_0x9b03('0x4a')](_0x24e433[_0x9b03('0x46')],{'$or':_[_0x9b03('0x3a')](_0x24e433[_0x9b03('0x41')],function(_0x570ecb){var _0x2d722d={};_0x2d722d[_0x570ecb]={'$like':'%'+_0x258fcc[_0x9b03('0x3e')][_0x9b03('0x2f')]+'%'};return _0x2d722d;})});}_0x24e433=_[_0x9b03('0x4a')]({},_0x24e433,_0x258fcc[_0x9b03('0x4b')]);return db['CmHopperHistory'][_0x9b03('0x23')]({'where':_0x24e433['where']})[_0x9b03('0x29')](function(_0x63a5d4){_0x4541a0[_0x9b03('0x23')]=_0x63a5d4;if(_0x258fcc['query']['includeAll']){_0x24e433[_0x9b03('0x4d')]=[{'all':!![]}];}return db[_0x9b03('0x65')]['findAll'](_0x24e433);})[_0x9b03('0x29')](function(_0x3162bf){_0x4541a0[_0x9b03('0x64')]=_0x3162bf;return _0x4541a0;});}})[_0x9b03('0x29')](respondWithFilteredResult(_0x161ee9,_0x24e433))['catch'](handleError(_0x161ee9,null));};exports[_0x9b03('0x66')]=function(_0x319723,_0x4d1944,_0x48b4a7){var _0x743795={'raw':!![],'where':{}};var _0xf88dcb={};var _0x2e9e88={'count':0x0,'rows':[]};return db[_0x9b03('0x3b')][_0x9b03('0x5f')]({'where':{'id':_0x319723[_0x9b03('0x4f')]['id']}})[_0x9b03('0x29')](handleEntityNotFound(_0x4d1944,null))[_0x9b03('0x29')](function(_0x209314){if(_0x209314){_0xf88dcb[_0x9b03('0x3d')]=_['keys'](db[_0x9b03('0x67')][_0x9b03('0x3c')]);_0xf88dcb[_0x9b03('0x3e')]=_[_0x9b03('0x3f')](_0x319723[_0x9b03('0x3e')]);_0xf88dcb[_0x9b03('0x47')]=_[_0x9b03('0x40')](_0xf88dcb[_0x9b03('0x3d')],_0xf88dcb[_0x9b03('0x3e')]);_0x743795[_0x9b03('0x41')]=_[_0x9b03('0x40')](_0xf88dcb[_0x9b03('0x3d')],qs[_0x9b03('0x42')](_0x319723['query'][_0x9b03('0x42')]));_0x743795[_0x9b03('0x41')]=_0x743795[_0x9b03('0x41')][_0x9b03('0x43')]?_0x743795[_0x9b03('0x41')]:_0xf88dcb[_0x9b03('0x3d')];if(!_0x319723['query'][_0x9b03('0x44')](_0x9b03('0x61'))){_0x743795[_0x9b03('0x22')]=qs[_0x9b03('0x22')](_0x319723['query'][_0x9b03('0x22')]);_0x743795['offset']=qs[_0x9b03('0x24')](_0x319723[_0x9b03('0x3e')][_0x9b03('0x24')]);}_0x743795[_0x9b03('0x62')]=qs[_0x9b03('0x45')](_0x319723['query']['sort']);_0x743795[_0x9b03('0x46')]=qs[_0x9b03('0x47')](_[_0x9b03('0x48')](_0x319723[_0x9b03('0x3e')],_0xf88dcb['filters']));_0x743795[_0x9b03('0x46')][_0x9b03('0x63')]=_0x209314['id'];if(_0x319723[_0x9b03('0x3e')][_0x9b03('0x2f')]){_0x743795[_0x9b03('0x46')]=_[_0x9b03('0x4a')](_0x743795[_0x9b03('0x46')],{'$or':_[_0x9b03('0x3a')](_0x743795['attributes'],function(_0x3cfad9){var _0x2b9924={};_0x2b9924[_0x3cfad9]={'$like':'%'+_0x319723['query']['filter']+'%'};return _0x2b9924;})});}_0x743795=_[_0x9b03('0x4a')]({},_0x743795,_0x319723['options']);return db[_0x9b03('0x67')][_0x9b03('0x23')]({'where':_0x743795[_0x9b03('0x46')]})[_0x9b03('0x29')](function(_0x1c833d){_0x2e9e88[_0x9b03('0x23')]=_0x1c833d;if(_0x319723[_0x9b03('0x3e')][_0x9b03('0x4c')]){_0x743795['include']=[{'all':!![]}];}return db[_0x9b03('0x67')][_0x9b03('0x4e')](_0x743795);})[_0x9b03('0x29')](function(_0x48a68d){_0x2e9e88[_0x9b03('0x64')]=_0x48a68d;return _0x2e9e88;});}})[_0x9b03('0x29')](respondWithFilteredResult(_0x4d1944,_0x743795))[_0x9b03('0x55')](handleError(_0x4d1944,null));};exports[_0x9b03('0x68')]=function(_0x37dbe6,_0x4bc822,_0x45b444){var _0x472257={'raw':!![],'where':{}};var _0x263037={};var _0x309f14={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9b03('0x5f')]({'where':{'id':_0x37dbe6['params']['id']}})['then'](handleEntityNotFound(_0x4bc822,null))[_0x9b03('0x29')](function(_0xa9dcfd){if(_0xa9dcfd){_0x263037[_0x9b03('0x3d')]=_[_0x9b03('0x3f')](db[_0x9b03('0x69')][_0x9b03('0x3c')]);_0x263037[_0x9b03('0x3e')]=_[_0x9b03('0x3f')](_0x37dbe6[_0x9b03('0x3e')]);_0x263037['filters']=_[_0x9b03('0x40')](_0x263037[_0x9b03('0x3d')],_0x263037[_0x9b03('0x3e')]);_0x472257[_0x9b03('0x41')]=_[_0x9b03('0x40')](_0x263037[_0x9b03('0x3d')],qs[_0x9b03('0x42')](_0x37dbe6[_0x9b03('0x3e')][_0x9b03('0x42')]));_0x472257[_0x9b03('0x41')]=_0x472257[_0x9b03('0x41')][_0x9b03('0x43')]?_0x472257[_0x9b03('0x41')]:_0x263037['model'];if(!_0x37dbe6['query']['hasOwnProperty']('nolimit')){_0x472257[_0x9b03('0x22')]=qs[_0x9b03('0x22')](_0x37dbe6[_0x9b03('0x3e')]['limit']);_0x472257[_0x9b03('0x24')]=qs[_0x9b03('0x24')](_0x37dbe6[_0x9b03('0x3e')]['offset']);}_0x472257[_0x9b03('0x62')]=qs['sort'](_0x37dbe6[_0x9b03('0x3e')]['sort']);_0x472257[_0x9b03('0x46')]=qs[_0x9b03('0x47')](_[_0x9b03('0x48')](_0x37dbe6[_0x9b03('0x3e')],_0x263037['filters']));_0x472257[_0x9b03('0x46')][_0x9b03('0x63')]=_0xa9dcfd['id'];if(_0x37dbe6['query'][_0x9b03('0x2f')]){_0x472257[_0x9b03('0x46')]=_[_0x9b03('0x4a')](_0x472257[_0x9b03('0x46')],{'$or':_['map'](_0x472257[_0x9b03('0x41')],function(_0x3b20e8){var _0x37ed16={};_0x37ed16[_0x3b20e8]={'$like':'%'+_0x37dbe6[_0x9b03('0x3e')]['filter']+'%'};return _0x37ed16;})});}_0x472257=_[_0x9b03('0x4a')]({},_0x472257,_0x37dbe6[_0x9b03('0x4b')]);return db[_0x9b03('0x69')][_0x9b03('0x23')]({'where':_0x472257[_0x9b03('0x46')]})['then'](function(_0x19cf03){_0x309f14[_0x9b03('0x23')]=_0x19cf03;if(_0x37dbe6[_0x9b03('0x3e')]['includeAll']){_0x472257[_0x9b03('0x4d')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x472257);})[_0x9b03('0x29')](function(_0x423a38){_0x309f14['rows']=_0x423a38;return _0x309f14;});}})[_0x9b03('0x29')](respondWithFilteredResult(_0x4bc822,_0x472257))['catch'](handleError(_0x4bc822,null));};exports[_0x9b03('0x6a')]=function(_0x2aa9bd,_0xe985c0,_0x3aed1e){var _0x1c6ba8={};var _0x1e84e2={};var _0x20a69d;var _0x46b0c4;return db[_0x9b03('0x3b')][_0x9b03('0x5f')]({'where':{'id':_0x2aa9bd['params']['id']}})['then'](handleEntityNotFound(_0xe985c0,null))[_0x9b03('0x29')](function(_0xe97c5e){if(_0xe97c5e){_0x20a69d=_0xe97c5e;_0x1e84e2[_0x9b03('0x3d')]=_[_0x9b03('0x3f')](db[_0x9b03('0x6b')][_0x9b03('0x3c')]);_0x1e84e2['query']=_['keys'](_0x2aa9bd[_0x9b03('0x3e')]);_0x1e84e2[_0x9b03('0x47')]=_[_0x9b03('0x40')](_0x1e84e2[_0x9b03('0x3d')],_0x1e84e2['query']);_0x1c6ba8[_0x9b03('0x41')]=_[_0x9b03('0x40')](_0x1e84e2[_0x9b03('0x3d')],qs['fields'](_0x2aa9bd[_0x9b03('0x3e')][_0x9b03('0x42')]));_0x1c6ba8['attributes']=_0x1c6ba8[_0x9b03('0x41')]['length']?_0x1c6ba8[_0x9b03('0x41')]:_0x1e84e2[_0x9b03('0x3d')];_0x1c6ba8[_0x9b03('0x62')]=qs[_0x9b03('0x45')](_0x2aa9bd['query']['sort']);_0x1c6ba8[_0x9b03('0x46')]=qs[_0x9b03('0x47')](_[_0x9b03('0x48')](_0x2aa9bd[_0x9b03('0x3e')],_0x1e84e2[_0x9b03('0x47')]));if(_0x2aa9bd[_0x9b03('0x3e')][_0x9b03('0x2f')]){_0x1c6ba8['where']=_[_0x9b03('0x4a')](_0x1c6ba8[_0x9b03('0x46')],{'$or':_['map'](_0x1c6ba8['attributes'],function(_0x53c580){var _0x1cca85={};_0x1cca85[_0x53c580]={'$like':'%'+_0x2aa9bd['query'][_0x9b03('0x2f')]+'%'};return _0x1cca85;})});}_0x1c6ba8=_['merge']({},_0x1c6ba8,_0x2aa9bd[_0x9b03('0x4b')]);return _0x20a69d[_0x9b03('0x6a')](_0x1c6ba8);}})[_0x9b03('0x29')](function(_0x29299d){if(_0x29299d){_0x46b0c4=_0x29299d[_0x9b03('0x43')];if(!_0x2aa9bd[_0x9b03('0x3e')][_0x9b03('0x44')]('nolimit')){_0x1c6ba8['limit']=qs[_0x9b03('0x22')](_0x2aa9bd[_0x9b03('0x3e')][_0x9b03('0x22')]);_0x1c6ba8['offset']=qs[_0x9b03('0x24')](_0x2aa9bd[_0x9b03('0x3e')]['offset']);}return _0x20a69d[_0x9b03('0x6a')](_0x1c6ba8);}})[_0x9b03('0x29')](function(_0x5e6619){if(_0x5e6619){return _0x5e6619?{'count':_0x46b0c4,'rows':_0x5e6619}:null;}})[_0x9b03('0x29')](respondWithResult(_0xe985c0,null))['catch'](handleError(_0xe985c0,null));};exports['addTeams']=function(_0x3e5c6a,_0x4d0545,_0x2f4691){var _0x160147=_0x3e5c6a[_0x9b03('0x51')][_0x9b03('0x6c')];var _0x4cf953=_[_0x9b03('0x3a')](_0x160147,'id');return db[_0x9b03('0x6b')][_0x9b03('0x4e')]({'where':{'id':_0x4cf953},'attributes':['id'],'include':[{'model':db[_0x9b03('0x6d')],'as':_0x9b03('0x6e'),'attributes':['id',_0x9b03('0x35'),_0x9b03('0x6f'),_0x9b03('0x70'),_0x9b03('0x71')],'raw':!![]}]})[_0x9b03('0x29')](function(_0x407509){if(_0x407509){var _0xddf11=_['flatMap'](_0x407509,function(_0x35ae1a){var _0x4131e3=_0x35ae1a[_0x9b03('0x2a')]({'plain':!![]});_0x4131e3['Agents'][_0x9b03('0x72')](function(_0x38d2cb){_0x38d2cb['penalty']=_[_0x9b03('0x34')](_0x160147,{'id':_0x4131e3['id']})['penalty'];});return _0x4131e3[_0x9b03('0x6e')];});return db[_0x9b03('0x3b')]['find']({'where':{'id':_0x3e5c6a[_0x9b03('0x4f')]['id']}})[_0x9b03('0x29')](function(_0xea3b8f){return db[_0x9b03('0x73')][_0x9b03('0x74')](function(_0xedfbbc){return _0xea3b8f[_0x9b03('0x75')](_0x4cf953,{'transaction':_0xedfbbc})[_0x9b03('0x29')](function(){return BPromise[_0x9b03('0x76')](_0x160147,function(_0x38db3f){return db['TeamVoiceQueue'][_0x9b03('0x77')]({'TeamId':_0x38db3f['id'],'VoiceQueueId':_0x3e5c6a[_0x9b03('0x4f')]['id'],'penalty':_0x38db3f[_0x9b03('0x78')]},{'transaction':_0xedfbbc});});})['then'](function(){return BPromise[_0x9b03('0x76')](_0xddf11,function(_0x470e08){return db['UserVoiceQueue'][_0x9b03('0x79')]({'where':{'UserId':_0x470e08['id'],'VoiceQueueId':_0x3e5c6a[_0x9b03('0x4f')]['id']},'defaults':{'penalty':_0x470e08['penalty']},'transaction':_0xedfbbc});});})[_0x9b03('0x29')](function(){return BPromise[_0x9b03('0x76')](_['filter'](_0xddf11,{'online':!![]}),function(_0x5bf2a5){return db[_0x9b03('0x7a')][_0x9b03('0x77')]({'membername':_0x5bf2a5['name'],'UserId':_0x5bf2a5['id'],'queue_name':_0xea3b8f[_0x9b03('0x35')],'VoiceQueueId':_0xea3b8f['id'],'interface':_[_0x9b03('0x7b')](_0x5bf2a5[_0x9b03('0x71')])?util[_0x9b03('0x7c')](_0x9b03('0x7d'),_0x5bf2a5[_0x9b03('0x35')]):_0x5bf2a5[_0x9b03('0x71')],'paused':_0x5bf2a5[_0x9b03('0x70')]||![],'penalty':_0x5bf2a5[_0x9b03('0x78')]},{'transaction':_0xedfbbc});});})['then'](function(){_0xddf11[_0x9b03('0x72')](function(_0x5f2790){socket[_0x9b03('0x7e')](_0x9b03('0x7f'),{'UserId':_0x5f2790['id'],'VoiceQueueId':_0xea3b8f['id']});});});});});}})[_0x9b03('0x29')](respondWithStatusCode(_0x4d0545,null))[_0x9b03('0x55')](handleError(_0x4d0545,null));};exports[_0x9b03('0x80')]=function(_0x9e6053,_0x59342f,_0x43d35d){return db['Team']['findAll']({'where':{'id':_0x9e6053[_0x9b03('0x3e')][_0x9b03('0x81')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9b03('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x59342f,null))[_0x9b03('0x29')](function(_0x46b9fd){var _0x46e7a0=_[_0x9b03('0x3a')](_0x46b9fd,'id');var _0x272768=[];var _0x4ced23=[];var _0x5ba304=squel[_0x9b03('0x82')]();_0x5ba304[_0x9b03('0x83')](_0x9b03('0x84'))[_0x9b03('0x85')](_0x9b03('0x86'),'tq')[_0x9b03('0x87')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9b03('0x46')]('VoiceQueueId\x20=\x20?',_0x9e6053[_0x9b03('0x4f')]['id']);for(var _0x12ba7f=0x0;_0x12ba7f<_0x46b9fd[_0x9b03('0x43')];_0x12ba7f+=0x1){let _0x5886c2=_0x46b9fd[_0x12ba7f];for(var _0x3350c7=0x0;_0x3350c7<_0x5886c2[_0x9b03('0x6e')]['length'];_0x3350c7+=0x1){let _0x4a253b=_0x5886c2['Agents'][_0x3350c7];var _0x120c1b=_0x5ba304[_0x9b03('0x56')]();_0x120c1b['where'](_0x9b03('0x88'),_0x4a253b['id']);_0x4ced23['push'](db[_0x9b03('0x73')][_0x9b03('0x3e')](_0x120c1b[_0x9b03('0x89')](),{'type':db['sequelize'][_0x9b03('0x8a')]['SELECT']})[_0x9b03('0x29')](function(_0x536ff8){if(_0x536ff8[_0x9b03('0x43')]===0x1){return _0x4a253b['id'];}else{var _0x542b7b=_[_0x9b03('0x8b')](_[_0x9b03('0x3a')](_0x536ff8,_0x9b03('0x8c')),function(_0x56e222){return _[_0x9b03('0x32')](_0x46e7a0,_0x56e222);});if(_0x542b7b){return _0x4a253b['id'];}}}));}}return BPromise[_0x9b03('0x8d')](_0x4ced23)['then'](function(_0x3572ef){_0x272768=_(_0x272768)['union'](_0x3572ef)['compact']()['value']();return db[_0x9b03('0x3b')][_0x9b03('0x34')]({'where':{'id':_0x9e6053[_0x9b03('0x4f')]['id']}})[_0x9b03('0x29')](function(_0x468307){return db['sequelize'][_0x9b03('0x74')](function(_0x8e8c6f){return _0x468307['removeTeams'](_0x9e6053[_0x9b03('0x3e')][_0x9b03('0x81')],{'transaction':_0x8e8c6f})[_0x9b03('0x29')](function(){if(!_[_0x9b03('0x8e')](_0x272768)){return _0x468307[_0x9b03('0x8f')](_0x272768,{'transaction':_0x8e8c6f})[_0x9b03('0x29')](function(){return db[_0x9b03('0x7a')]['destroy']({'where':{'VoiceQueueId':_0x9e6053[_0x9b03('0x4f')]['id'],'UserId':_0x272768},'transaction':_0x8e8c6f});});}})[_0x9b03('0x29')](function(){_0x272768['forEach'](function(_0x506eaf){socket[_0x9b03('0x7e')](_0x9b03('0x90'),{'UserId':_0x506eaf,'VoiceQueueId':_0x468307['id']});});});});});});})[_0x9b03('0x29')](respondWithStatusCode(_0x59342f,null))['catch'](handleError(_0x59342f,null));};exports[_0x9b03('0x91')]=function(_0x4ef23e,_0x1af8bc,_0xe57acf){var _0x3719ac,_0x5d83c7;return db[_0x9b03('0x3b')][_0x9b03('0x34')]({'where':{'id':_0x4ef23e[_0x9b03('0x4f')]['id']}})[_0x9b03('0x29')](handleEntityNotFound(_0x1af8bc,null))[_0x9b03('0x29')](function(_0x4e34da){if(_0x4e34da){_0x5d83c7=_0x4e34da;return _0x4e34da['addAgents'](_0x4ef23e['body'][_0x9b03('0x81')],_[_0x9b03('0x57')](_0x4ef23e[_0x9b03('0x51')],[_0x9b03('0x81'),'id'])||{})[_0x9b03('0x92')](function(_0xd75a55){for(var _0x591e09=0x0;_0x591e09<_0x4ef23e[_0x9b03('0x51')][_0x9b03('0x81')][_0x9b03('0x43')];_0x591e09+=0x1){socket['emit'](_0x9b03('0x7f'),{'UserId':Number(_0x4ef23e[_0x9b03('0x51')]['ids'][_0x591e09]),'VoiceQueueId':Number(_0x4ef23e[_0x9b03('0x4f')]['id'])});}return _0xd75a55;});}})[_0x9b03('0x29')](function(_0x34b0ee){_0x3719ac=_0x34b0ee||[];if(_0x5d83c7){return db[_0x9b03('0x6d')][_0x9b03('0x4e')]({'where':{'id':_0x4ef23e[_0x9b03('0x51')][_0x9b03('0x81')]},'attributes':['id','name',_0x9b03('0x6f'),_0x9b03('0x70'),'interface'],'raw':!![]});}})[_0x9b03('0x29')](function(_0x2208fb){if(!_[_0x9b03('0x8e')](_0x2208fb)){var _0x5a1bba=[];for(var _0x14dec4=0x0;_0x14dec4<_0x2208fb[_0x9b03('0x43')];_0x14dec4++){if(_0x2208fb[_0x14dec4][_0x9b03('0x6f')]){_0x5a1bba[_0x9b03('0x93')](db['UserVoiceQueueRt']['upsert']({'membername':_0x2208fb[_0x14dec4]['name'],'UserId':_0x2208fb[_0x14dec4]['id'],'queue_name':_0x5d83c7[_0x9b03('0x35')],'VoiceQueueId':_0x5d83c7['id'],'interface':_[_0x9b03('0x7b')](_0x2208fb[_0x14dec4][_0x9b03('0x71')])?util['format'](_0x9b03('0x7d'),_0x2208fb[_0x14dec4]['name']):_0x2208fb[_0x14dec4]['interface'],'paused':_0x2208fb[_0x14dec4][_0x9b03('0x70')]||![],'penalty':_0x4ef23e[_0x9b03('0x51')]['penalty']||0x0}));}}return BPromise[_0x9b03('0x8d')](_0x5a1bba);}})['then'](function(){return _0x3719ac;})['then'](respondWithResult(_0x1af8bc,null))[_0x9b03('0x55')](handleError(_0x1af8bc,null));};exports[_0x9b03('0x8f')]=function(_0x4f0881,_0x53eda8,_0x2f82af){return db[_0x9b03('0x3b')][_0x9b03('0x34')]({'where':{'id':_0x4f0881[_0x9b03('0x4f')]['id']}})[_0x9b03('0x29')](handleEntityNotFound(_0x53eda8,null))[_0x9b03('0x29')](function(_0xeef87b){if(_0xeef87b){return _0xeef87b[_0x9b03('0x8f')](_0x4f0881['query'][_0x9b03('0x81')])['then'](function(){if(_[_0x9b03('0x94')](_0x4f0881[_0x9b03('0x3e')][_0x9b03('0x81')])){for(var _0x179832=0x0;_0x179832<_0x4f0881[_0x9b03('0x3e')]['ids'][_0x9b03('0x43')];_0x179832+=0x1){socket[_0x9b03('0x7e')]('userVoiceQueue:remove',{'UserId':Number(_0x4f0881[_0x9b03('0x3e')][_0x9b03('0x81')][_0x179832]),'VoiceQueueId':Number(_0x4f0881['params']['id'])});}}else{socket[_0x9b03('0x7e')](_0x9b03('0x90'),{'UserId':Number(_0x4f0881['query'][_0x9b03('0x81')]),'VoiceQueueId':Number(_0x4f0881[_0x9b03('0x4f')]['id'])});}});}})[_0x9b03('0x29')](function(_0x3f98ea){return db['UserVoiceQueueRt'][_0x9b03('0x95')]({'where':{'VoiceQueueId':_0x4f0881[_0x9b03('0x4f')]['id'],'UserId':_0x4f0881[_0x9b03('0x3e')][_0x9b03('0x81')]}})[_0x9b03('0x29')](function(){return _0x3f98ea;});})['then'](respondWithStatusCode(_0x53eda8,null))[_0x9b03('0x55')](handleError(_0x53eda8,null));};exports['getAgents']=function(_0xfc120f,_0x2bcfdf,_0x3d1736){var _0x54f7da={};var _0x4d685f={};var _0x1fbc34;var _0x1279ee;return db[_0x9b03('0x3b')][_0x9b03('0x5f')]({'where':{'id':_0xfc120f[_0x9b03('0x4f')]['id']}})[_0x9b03('0x29')](handleEntityNotFound(_0x2bcfdf,null))[_0x9b03('0x29')](function(_0x4451b2){if(_0x4451b2){_0x1fbc34=_0x4451b2;_0x4d685f['model']=_['keys'](db[_0x9b03('0x6d')][_0x9b03('0x3c')]);_0x4d685f[_0x9b03('0x3e')]=_['keys'](_0xfc120f[_0x9b03('0x3e')]);_0x4d685f[_0x9b03('0x47')]=_[_0x9b03('0x40')](_0x4d685f[_0x9b03('0x3d')],_0x4d685f['query']);_0x54f7da[_0x9b03('0x41')]=_[_0x9b03('0x40')](_0x4d685f[_0x9b03('0x3d')],qs[_0x9b03('0x42')](_0xfc120f[_0x9b03('0x3e')]['fields']));_0x54f7da['attributes']=_0x54f7da[_0x9b03('0x41')]['length']?_0x54f7da['attributes']:_0x4d685f[_0x9b03('0x3d')];_0x54f7da[_0x9b03('0x62')]=qs['sort'](_0xfc120f[_0x9b03('0x3e')][_0x9b03('0x45')]);_0x54f7da['where']=qs[_0x9b03('0x47')](_[_0x9b03('0x48')](_0xfc120f[_0x9b03('0x3e')],_0x4d685f[_0x9b03('0x47')]));if(_0xfc120f[_0x9b03('0x3e')][_0x9b03('0x2f')]){_0x54f7da[_0x9b03('0x46')]=_['merge'](_0x54f7da[_0x9b03('0x46')],{'$or':_[_0x9b03('0x3a')](_0x54f7da['attributes'],function(_0x5b7471){var _0x334f31={};_0x334f31[_0x5b7471]={'$like':'%'+_0xfc120f[_0x9b03('0x3e')][_0x9b03('0x2f')]+'%'};return _0x334f31;})});}_0x54f7da=_['merge']({},_0x54f7da,_0xfc120f[_0x9b03('0x4b')]);return _0x1fbc34[_0x9b03('0x96')](_0x54f7da);}})[_0x9b03('0x29')](function(_0x3117e3){if(_0x3117e3){_0x1279ee=_0x3117e3[_0x9b03('0x43')];if(!_0xfc120f[_0x9b03('0x3e')][_0x9b03('0x44')](_0x9b03('0x61'))){_0x54f7da[_0x9b03('0x22')]=qs[_0x9b03('0x22')](_0xfc120f['query'][_0x9b03('0x22')]);_0x54f7da[_0x9b03('0x24')]=qs[_0x9b03('0x24')](_0xfc120f[_0x9b03('0x3e')]['offset']);}return _0x1fbc34['getAgents'](_0x54f7da);}})[_0x9b03('0x29')](function(_0x51c783){if(_0x51c783){return _0x51c783?{'count':_0x1279ee,'rows':_0x51c783}:null;}})['then'](respondWithResult(_0x2bcfdf,null))[_0x9b03('0x55')](handleError(_0x2bcfdf,null));};exports[_0x9b03('0x97')]=function(_0x183569,_0x2a739f,_0x67c9e3){var _0x3a8220={};var _0x4b20ec={};var _0x3068ce;var _0x83d3aa;return db[_0x9b03('0x3b')][_0x9b03('0x5f')]({'where':{'id':_0x183569[_0x9b03('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2a739f,null))['then'](function(_0xad2130){if(_0xad2130){_0x3068ce=_0xad2130;_0x4b20ec[_0x9b03('0x3d')]=_[_0x9b03('0x3f')](db[_0x9b03('0x7a')][_0x9b03('0x3c')]);_0x4b20ec['query']=_[_0x9b03('0x3f')](_0x183569['query']);_0x4b20ec[_0x9b03('0x47')]=_[_0x9b03('0x40')](_0x4b20ec[_0x9b03('0x3d')],_0x4b20ec['query']);_0x3a8220['attributes']=_[_0x9b03('0x40')](_0x4b20ec[_0x9b03('0x3d')],qs['fields'](_0x183569[_0x9b03('0x3e')][_0x9b03('0x42')]));_0x3a8220[_0x9b03('0x41')]=_0x3a8220[_0x9b03('0x41')]['length']?_0x3a8220[_0x9b03('0x41')]:_0x4b20ec[_0x9b03('0x3d')];_0x3a8220['order']=qs[_0x9b03('0x45')](_0x183569[_0x9b03('0x3e')]['sort']);_0x3a8220[_0x9b03('0x46')]=qs['filters'](_[_0x9b03('0x48')](_0x183569['query'],_0x4b20ec[_0x9b03('0x47')]));if(_0x183569['query'][_0x9b03('0x2f')]){_0x3a8220[_0x9b03('0x46')]=_[_0x9b03('0x4a')](_0x3a8220[_0x9b03('0x46')],{'$or':_[_0x9b03('0x3a')](_0x3a8220[_0x9b03('0x41')],function(_0x252681){var _0x20a4d7={};_0x20a4d7[_0x252681]={'$like':'%'+_0x183569[_0x9b03('0x3e')][_0x9b03('0x2f')]+'%'};return _0x20a4d7;})});}_0x3a8220=_[_0x9b03('0x4a')]({},_0x3a8220,_0x183569['options']);return _0x3068ce['getMembers'](_0x3a8220);}})[_0x9b03('0x29')](function(_0xf96e21){if(_0xf96e21){_0x83d3aa=_0xf96e21[_0x9b03('0x43')];if(!_0x183569[_0x9b03('0x3e')]['hasOwnProperty'](_0x9b03('0x61'))){_0x3a8220[_0x9b03('0x22')]=qs[_0x9b03('0x22')](_0x183569[_0x9b03('0x3e')][_0x9b03('0x22')]);_0x3a8220[_0x9b03('0x24')]=qs[_0x9b03('0x24')](_0x183569['query'][_0x9b03('0x24')]);}return _0x3068ce[_0x9b03('0x97')](_0x3a8220);}})['then'](function(_0x226c55){return _0x226c55?{'count':_0x83d3aa,'rows':_0x226c55}:null;})['then'](respondWithResult(_0x2a739f,null))[_0x9b03('0x55')](handleError(_0x2a739f,null));};exports[_0x9b03('0x98')]=function(_0x561f92,_0x23a369,_0x46960a){var _0x2f03cf={};var _0x1d44fd={};var _0x251c55;var _0x6626c3;return db[_0x9b03('0x3b')]['findOne']({'where':{'id':_0x561f92[_0x9b03('0x4f')]['id']}})['then'](handleEntityNotFound(_0x23a369,null))['then'](function(_0x5aa279){if(_0x5aa279){_0x251c55=_0x5aa279;_0x1d44fd[_0x9b03('0x3d')]=_['keys'](db[_0x9b03('0x99')][_0x9b03('0x3c')]);_0x1d44fd['query']=_[_0x9b03('0x3f')](_0x561f92[_0x9b03('0x3e')]);_0x1d44fd[_0x9b03('0x47')]=_[_0x9b03('0x40')](_0x1d44fd[_0x9b03('0x3d')],_0x1d44fd[_0x9b03('0x3e')]);_0x2f03cf[_0x9b03('0x41')]=_[_0x9b03('0x40')](_0x1d44fd[_0x9b03('0x3d')],qs['fields'](_0x561f92[_0x9b03('0x3e')]['fields']));_0x2f03cf[_0x9b03('0x41')]=_0x2f03cf[_0x9b03('0x41')][_0x9b03('0x43')]?_0x2f03cf[_0x9b03('0x41')]:_0x1d44fd[_0x9b03('0x3d')];_0x2f03cf['order']=qs[_0x9b03('0x45')](_0x561f92[_0x9b03('0x3e')]['sort']);_0x2f03cf[_0x9b03('0x46')]=qs[_0x9b03('0x47')](_[_0x9b03('0x48')](_0x561f92['query'],_0x1d44fd[_0x9b03('0x47')]));if(_0x561f92[_0x9b03('0x3e')][_0x9b03('0x2f')]){_0x2f03cf['where']=_[_0x9b03('0x4a')](_0x2f03cf[_0x9b03('0x46')],{'$or':_[_0x9b03('0x3a')](_0x2f03cf[_0x9b03('0x41')],function(_0x3af802){var _0x1f36aa={};_0x1f36aa[_0x3af802]={'$like':'%'+_0x561f92['query'][_0x9b03('0x2f')]+'%'};return _0x1f36aa;})});}_0x2f03cf=_[_0x9b03('0x4a')]({},_0x2f03cf,_0x561f92[_0x9b03('0x4b')]);return _0x251c55[_0x9b03('0x98')](_0x2f03cf);}})['then'](function(_0x3cd43a){if(_0x3cd43a){_0x6626c3=_0x3cd43a[_0x9b03('0x43')];if(!_0x561f92[_0x9b03('0x3e')][_0x9b03('0x44')]('nolimit')){_0x2f03cf[_0x9b03('0x22')]=qs[_0x9b03('0x22')](_0x561f92[_0x9b03('0x3e')][_0x9b03('0x22')]);_0x2f03cf[_0x9b03('0x24')]=qs[_0x9b03('0x24')](_0x561f92[_0x9b03('0x3e')][_0x9b03('0x24')]);}return _0x251c55['getLists'](_0x2f03cf);}})[_0x9b03('0x29')](function(_0x371601){if(_0x371601){return _0x371601?{'count':_0x6626c3,'rows':_0x371601}:null;}})[_0x9b03('0x29')](respondWithResult(_0x23a369,null))['catch'](handleError(_0x23a369,null));};exports[_0x9b03('0x9a')]=function(_0xfca3da,_0x45c0ad,_0x5344cd){var _0x234341,_0x552bf4;return db['VoiceQueue'][_0x9b03('0x34')]({'where':{'id':_0xfca3da['params']['id']}})[_0x9b03('0x29')](handleEntityNotFound(_0x45c0ad,null))['then'](function(_0xaff309){if(_0xaff309){_0x552bf4=_0xaff309;return _0xaff309[_0x9b03('0x9a')](_0xfca3da[_0x9b03('0x51')][_0x9b03('0x81')],_[_0x9b03('0x57')](_0xfca3da[_0x9b03('0x51')],[_0x9b03('0x81'),'id'])||{});}return null;})[_0x9b03('0x92')](function(_0x51eae1){var _0x11590a;_0x234341=_0x51eae1||[];var _0x32abcc=[];if(_0x51eae1){for(var _0x389a19=0x0;_0x389a19<_0x51eae1['length'];_0x389a19+=0x1){var _0x31be2c=_0x51eae1[_0x389a19][_0x9b03('0x2a')]({'plain':!![]});_0x552bf4['dialCheckDuplicateType']=_0xfca3da['body'][_0x9b03('0x9b')]?_0xfca3da[_0x9b03('0x51')][_0x9b03('0x9b')]:_0x552bf4[_0x9b03('0x9b')];switch(_0x552bf4['dialCheckDuplicateType']){case _0x9b03('0x9c'):_0x11590a=squel[_0x9b03('0x9d')]()['into'](_0x9b03('0x9e'))['fromQuery']([_0x9b03('0x9f'),'scheduledAt',_0x9b03('0xa0'),'ListId',_0x9b03('0x63'),_0x9b03('0x58'),'updatedAt'],squel[_0x9b03('0x82')]()[_0x9b03('0x83')](_0x9b03('0x9f'),'phone')[_0x9b03('0x83')](_0x9b03('0xa1'),_0x9b03('0xa2'))[_0x9b03('0x83')]('id',_0x9b03('0xa0'))[_0x9b03('0x83')](_0x31be2c[_0x9b03('0xa3')][_0x9b03('0x89')](),_0x9b03('0xa4'))[_0x9b03('0x83')](_0xfca3da[_0x9b03('0x4f')]['id'][_0x9b03('0x89')](),_0x9b03('0x63'))[_0x9b03('0x83')](_0x9b03('0xa1'),_0x9b03('0x58'))[_0x9b03('0x83')](_0x9b03('0xa1'),'updatedAt')[_0x9b03('0x85')](_0x9b03('0xa5'))[_0x9b03('0x46')]('deletedAt\x20IS\x20NULL')['where'](_0x9b03('0xa6'),_0x31be2c[_0x9b03('0xa3')][_0x9b03('0x89')]())[_0x9b03('0x46')](_0x9b03('0xa7'))[_0x9b03('0x46')](_0x9b03('0xa8'),squel['select']()[_0x9b03('0x83')](_0x9b03('0xa9'))[_0x9b03('0x85')](_0x9b03('0xaa'))[_0x9b03('0x46')](_0x9b03('0xab'),_0xfca3da['params']['id'][_0x9b03('0x89')]()))[_0x9b03('0x46')](_0x9b03('0xa8'),squel[_0x9b03('0x82')]()[_0x9b03('0x83')](_0x9b03('0xac'))[_0x9b03('0x85')](_0x9b03('0x9e'))[_0x9b03('0x46')](_0x9b03('0xab'),_0xfca3da['params']['id'][_0x9b03('0x89')]())))['toString']();break;case'onlyIfOpen':_0x11590a=squel[_0x9b03('0x9d')]()[_0x9b03('0xad')](_0x9b03('0x9e'))[_0x9b03('0xae')](['phone',_0x9b03('0xa2'),'ContactId',_0x9b03('0xa4'),_0x9b03('0x63'),_0x9b03('0x58'),'updatedAt'],squel[_0x9b03('0x82')]()['field'](_0x9b03('0x9f'),_0x9b03('0x9f'))[_0x9b03('0x83')](_0x9b03('0xa1'),_0x9b03('0xa2'))['field']('id',_0x9b03('0xa0'))[_0x9b03('0x83')](_0x31be2c[_0x9b03('0xa3')]['toString'](),_0x9b03('0xa4'))[_0x9b03('0x83')](_0xfca3da['params']['id'][_0x9b03('0x89')](),'VoiceQueueId')[_0x9b03('0x83')]('NOW()',_0x9b03('0x58'))[_0x9b03('0x83')]('NOW()',_0x9b03('0x59'))[_0x9b03('0x85')](_0x9b03('0xa5'))[_0x9b03('0x46')](_0x9b03('0xaf'))[_0x9b03('0x46')](_0x9b03('0xa6'),_0x31be2c['CmListId'][_0x9b03('0x89')]())[_0x9b03('0x46')](_0x9b03('0xa7'))[_0x9b03('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9b03('0x82')]()[_0x9b03('0x83')]('COALESCE(phone,\x27\x27)')[_0x9b03('0x85')](_0x9b03('0x9e'))[_0x9b03('0x46')](_0x9b03('0xab'),_0xfca3da['params']['id']['toString']())))[_0x9b03('0x89')]();break;default:_0x11590a=squel[_0x9b03('0x9d')]()[_0x9b03('0xad')](_0x9b03('0x9e'))[_0x9b03('0xae')]([_0x9b03('0x9f'),'scheduledAt',_0x9b03('0xa0'),_0x9b03('0xa4'),_0x9b03('0x63'),_0x9b03('0x58'),_0x9b03('0x59')],squel[_0x9b03('0x82')]()[_0x9b03('0x83')]('phone',_0x9b03('0x9f'))[_0x9b03('0x83')](_0x9b03('0xa1'),_0x9b03('0xa2'))[_0x9b03('0x83')]('id',_0x9b03('0xa0'))[_0x9b03('0x83')](_0x31be2c[_0x9b03('0xa3')][_0x9b03('0x89')](),'ListId')[_0x9b03('0x83')](_0xfca3da[_0x9b03('0x4f')]['id'][_0x9b03('0x89')](),_0x9b03('0x63'))[_0x9b03('0x83')](_0x9b03('0xa1'),'createdAt')[_0x9b03('0x83')](_0x9b03('0xa1'),_0x9b03('0x59'))['from'](_0x9b03('0xa5'))[_0x9b03('0x46')]('deletedAt\x20IS\x20NULL')[_0x9b03('0x46')](_0x9b03('0xa6'),_0x31be2c[_0x9b03('0xa3')]['toString']())[_0x9b03('0x46')](_0x9b03('0xa7')))[_0x9b03('0x89')]();}_0x32abcc[_0x9b03('0x93')](db[_0x9b03('0x73')][_0x9b03('0x3e')](_0x11590a));}return BPromise[_0x9b03('0x8d')](_0x32abcc);}})[_0x9b03('0x29')](function(){return _0x234341;})[_0x9b03('0x29')](respondWithResult(_0x45c0ad,null))[_0x9b03('0x55')](handleError(_0x45c0ad,null));};exports[_0x9b03('0xb0')]=function(_0x58e904,_0x2c4c0d,_0x180f12){return db[_0x9b03('0x3b')]['find']({'where':{'id':_0x58e904[_0x9b03('0x4f')]['id']}})[_0x9b03('0x29')](handleEntityNotFound(_0x2c4c0d,null))[_0x9b03('0x29')](function(_0x5d412b){if(_0x5d412b){return _0x5d412b[_0x9b03('0xb0')](_0x58e904['query'][_0x9b03('0x81')]);}})[_0x9b03('0x29')](function(_0x34227a){if(_0x34227a){return db[_0x9b03('0x60')][_0x9b03('0x95')]({'where':{'ListId':_0x58e904[_0x9b03('0x3e')][_0x9b03('0x81')],'VoiceQueueId':_0x58e904[_0x9b03('0x4f')]['id']}})[_0x9b03('0x29')](function(){return _0x34227a;});}})[_0x9b03('0x29')](respondWithStatusCode(_0x2c4c0d,null))['catch'](handleError(_0x2c4c0d,null));};exports[_0x9b03('0xb1')]=function(_0x5ecf34,_0x4402ef,_0x529301){var _0x27fc8f={};var _0x4fbcb2={};var _0x51ba88;var _0x37cb22;return db[_0x9b03('0x3b')][_0x9b03('0x5f')]({'where':{'id':_0x5ecf34[_0x9b03('0x4f')]['id']}})[_0x9b03('0x29')](handleEntityNotFound(_0x4402ef,null))[_0x9b03('0x29')](function(_0x4acfa5){if(_0x4acfa5){_0x51ba88=_0x4acfa5;_0x4fbcb2[_0x9b03('0x3d')]=_[_0x9b03('0x3f')](db[_0x9b03('0x99')][_0x9b03('0x3c')]);_0x4fbcb2['query']=_[_0x9b03('0x3f')](_0x5ecf34[_0x9b03('0x3e')]);_0x4fbcb2['filters']=_[_0x9b03('0x40')](_0x4fbcb2[_0x9b03('0x3d')],_0x4fbcb2[_0x9b03('0x3e')]);_0x27fc8f['attributes']=_[_0x9b03('0x40')](_0x4fbcb2['model'],qs['fields'](_0x5ecf34[_0x9b03('0x3e')]['fields']));_0x27fc8f[_0x9b03('0x41')]=_0x27fc8f[_0x9b03('0x41')][_0x9b03('0x43')]?_0x27fc8f['attributes']:_0x4fbcb2[_0x9b03('0x3d')];_0x27fc8f['order']=qs[_0x9b03('0x45')](_0x5ecf34[_0x9b03('0x3e')][_0x9b03('0x45')]);_0x27fc8f['where']=qs[_0x9b03('0x47')](_[_0x9b03('0x48')](_0x5ecf34['query'],_0x4fbcb2[_0x9b03('0x47')]));if(_0x5ecf34[_0x9b03('0x3e')]['filter']){_0x27fc8f[_0x9b03('0x46')]=_[_0x9b03('0x4a')](_0x27fc8f[_0x9b03('0x46')],{'$or':_[_0x9b03('0x3a')](_0x27fc8f[_0x9b03('0x41')],function(_0x378e22){var _0x59067e={};_0x59067e[_0x378e22]={'$like':'%'+_0x5ecf34[_0x9b03('0x3e')][_0x9b03('0x2f')]+'%'};return _0x59067e;})});}_0x27fc8f=_[_0x9b03('0x4a')]({},_0x27fc8f,_0x5ecf34[_0x9b03('0x4b')]);return _0x51ba88[_0x9b03('0xb1')](_0x27fc8f);}})[_0x9b03('0x29')](function(_0x40b3b7){if(_0x40b3b7){_0x37cb22=_0x40b3b7[_0x9b03('0x43')];if(!_0x5ecf34[_0x9b03('0x3e')][_0x9b03('0x44')]('nolimit')){_0x27fc8f[_0x9b03('0x22')]=qs['limit'](_0x5ecf34['query']['limit']);_0x27fc8f[_0x9b03('0x24')]=qs[_0x9b03('0x24')](_0x5ecf34[_0x9b03('0x3e')][_0x9b03('0x24')]);}return _0x51ba88[_0x9b03('0xb1')](_0x27fc8f);}})[_0x9b03('0x29')](function(_0x14fd60){if(_0x14fd60){return _0x14fd60?{'count':_0x37cb22,'rows':_0x14fd60}:null;}})[_0x9b03('0x29')](respondWithResult(_0x4402ef,null))['catch'](handleError(_0x4402ef,null));};exports[_0x9b03('0xb2')]=function(_0x4ee665,_0x1f30b4,_0x1f8735){var _0x19a00b,_0x591f66;return db[_0x9b03('0x3b')]['find']({'where':{'id':_0x4ee665[_0x9b03('0x4f')]['id']}})[_0x9b03('0x29')](handleEntityNotFound(_0x1f30b4,null))[_0x9b03('0x29')](function(_0x2cd383){if(_0x2cd383){_0x591f66=_0x2cd383;return _0x2cd383[_0x9b03('0xb2')](_0x4ee665['body'][_0x9b03('0x81')],_[_0x9b03('0x57')](_0x4ee665[_0x9b03('0x51')],[_0x9b03('0x81'),'id'])||{});}return null;})[_0x9b03('0x92')](function(_0x48745b){var _0x3620e9;_0x19a00b=_0x48745b||[];var _0x5d1dde=[];if(_0x48745b){for(var _0x22b31b=0x0;_0x22b31b<_0x48745b[_0x9b03('0x43')];_0x22b31b+=0x1){var _0x5c6417=_0x48745b[_0x22b31b]['get']({'plain':!![]});_0x3620e9=squel[_0x9b03('0x9d')]()['into'](_0x9b03('0xb3'))[_0x9b03('0xae')](['phone','ContactId',_0x9b03('0xa4'),'VoiceQueueId',_0x9b03('0x58'),_0x9b03('0x59')],squel[_0x9b03('0x82')]()[_0x9b03('0x83')](_0x9b03('0x9f'),_0x9b03('0x9f'))[_0x9b03('0x83')]('id',_0x9b03('0xa0'))[_0x9b03('0x83')](_0x5c6417['CmListId'][_0x9b03('0x89')](),_0x9b03('0xa4'))[_0x9b03('0x83')](_0x4ee665['params']['id'][_0x9b03('0x89')](),'VoiceQueueId')['field'](_0x9b03('0xa1'),_0x9b03('0x58'))[_0x9b03('0x83')](_0x9b03('0xa1'),'updatedAt')['from']('cm_contacts')[_0x9b03('0x46')](_0x9b03('0xaf'))[_0x9b03('0x46')](_0x9b03('0xa6'),_0x5c6417[_0x9b03('0xa3')][_0x9b03('0x89')]())['where'](_0x9b03('0xa7')))[_0x9b03('0x89')]();_0x5d1dde['push'](db[_0x9b03('0x73')]['query'](_0x3620e9));}return BPromise['all'](_0x5d1dde);}})[_0x9b03('0x29')](function(){return _0x19a00b;})[_0x9b03('0x29')](respondWithResult(_0x1f30b4,null))[_0x9b03('0x55')](handleError(_0x1f30b4,null));};exports[_0x9b03('0xb4')]=function(_0x381e92,_0x1ce09d,_0x2cd739){return db[_0x9b03('0x3b')][_0x9b03('0x34')]({'where':{'id':_0x381e92['params']['id']}})['then'](handleEntityNotFound(_0x1ce09d,null))[_0x9b03('0x29')](function(_0x271668){if(_0x271668){return _0x271668['removeBlackLists'](_0x381e92['query'][_0x9b03('0x81')]);}})[_0x9b03('0x29')](function(_0x4a2b0c){if(_0x4a2b0c){return db[_0x9b03('0x69')][_0x9b03('0x95')]({'where':{'ListId':_0x381e92[_0x9b03('0x3e')][_0x9b03('0x81')],'VoiceQueueId':_0x381e92[_0x9b03('0x4f')]['id']}})[_0x9b03('0x29')](function(){return _0x4a2b0c;});}})[_0x9b03('0x29')](respondWithStatusCode(_0x1ce09d,null))[_0x9b03('0x55')](handleError(_0x1ce09d,null));}; \ No newline at end of file +var _0x7a53=['reject','save','destroy','then','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','sendStatus','error','stack','VoiceQueue','rawAttributes','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','UserProfileSection','autoAssociation','update','nolimit','CmHopper','getHopperHistories','findOne','CmHopperHistory','order','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','voicePause','flatMap','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','interface','format','forEach','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','all','union','removeAgents','spread','online','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','NOW()','ContactId','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','into','cm_hopper_black','removeBlackLists','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','status','end','json','undefined','count','offset','limit','set','apply'];(function(_0x3a6f2a,_0x5d0da8){var _0x8c3ed8=function(_0x213cc2){while(--_0x213cc2){_0x3a6f2a['push'](_0x3a6f2a['shift']());}};_0x8c3ed8(++_0x5d0da8);}(_0x7a53,0x148));var _0x37a5=function(_0x43afde,_0x19d804){_0x43afde=_0x43afde-0x0;var _0x322089=_0x7a53[_0x43afde];return _0x322089;};'use strict';var emlformat=require(_0x37a5('0x0'));var rimraf=require(_0x37a5('0x1'));var zipdir=require(_0x37a5('0x2'));var jsonpatch=require(_0x37a5('0x3'));var rp=require(_0x37a5('0x4'));var moment=require(_0x37a5('0x5'));var BPromise=require(_0x37a5('0x6'));var Mustache=require(_0x37a5('0x7'));var util=require(_0x37a5('0x8'));var path=require(_0x37a5('0x9'));var sox=require(_0x37a5('0xa'));var csv=require(_0x37a5('0xb'));var ejs=require(_0x37a5('0xc'));var fs=require('fs');var fs_extra=require(_0x37a5('0xd'));var _=require(_0x37a5('0xe'));var squel=require(_0x37a5('0xf'));var crypto=require(_0x37a5('0x10'));var jsforce=require(_0x37a5('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x37a5('0xb'));var querystring=require('querystring');var Papa=require(_0x37a5('0x12'));var Redis=require(_0x37a5('0x13'));var authService=require(_0x37a5('0x14'));var qs=require(_0x37a5('0x15'));var as=require(_0x37a5('0x16'));var hardwareService=require(_0x37a5('0x17'));var logger=require(_0x37a5('0x18'))(_0x37a5('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x37a5('0x1a'))['db'];config[_0x37a5('0x1b')]=_[_0x37a5('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x37a5('0x1d'))(new Redis(config[_0x37a5('0x1b')]));require(_0x37a5('0x1e'))['register'](socket);function respondWithStatusCode(_0x4b34c8,_0x17d139){_0x17d139=_0x17d139||0xcc;return function(_0x15b9ac){if(_0x15b9ac){return _0x4b34c8['sendStatus'](_0x17d139);}return _0x4b34c8[_0x37a5('0x1f')](_0x17d139)[_0x37a5('0x20')]();};}function respondWithResult(_0xdeb0c1,_0x1460ba){_0x1460ba=_0x1460ba||0xc8;return function(_0x3c3c07){if(_0x3c3c07){return _0xdeb0c1[_0x37a5('0x1f')](_0x1460ba)[_0x37a5('0x21')](_0x3c3c07);}};}function respondWithFilteredResult(_0x5a5cc4,_0x286e92){return function(_0x4a5412){if(_0x4a5412){var _0x1069eb=typeof _0x286e92['offset']==='undefined'&&typeof _0x286e92['limit']===_0x37a5('0x22');var _0x2451b1=_0x4a5412[_0x37a5('0x23')];var _0x2929fd=_0x1069eb?0x0:_0x286e92['offset'];var _0x54d1ad=_0x1069eb?_0x4a5412[_0x37a5('0x23')]:_0x286e92[_0x37a5('0x24')]+_0x286e92[_0x37a5('0x25')];var _0x2193ef;if(_0x54d1ad>=_0x2451b1){_0x54d1ad=_0x2451b1;_0x2193ef=0xc8;}else{_0x2193ef=0xce;}_0x5a5cc4[_0x37a5('0x1f')](_0x2193ef);return _0x5a5cc4[_0x37a5('0x26')]('Content-Range',_0x2929fd+'-'+_0x54d1ad+'/'+_0x2451b1)[_0x37a5('0x21')](_0x4a5412);}return null;};}function patchUpdates(_0x5cb13d){return function(_0x164d66){try{jsonpatch[_0x37a5('0x27')](_0x164d66,_0x5cb13d,!![]);}catch(_0x55265e){return BPromise[_0x37a5('0x28')](_0x55265e);}return _0x164d66[_0x37a5('0x29')]();};}function saveUpdates(_0xddc06f,_0x336403){return function(_0x119db2){if(_0x119db2){return _0x119db2['update'](_0xddc06f)['then'](function(_0x36d748){return _0x36d748;});}return null;};}function removeEntity(_0x2d6069,_0x132e4d){return function(_0x26d310){if(_0x26d310){return _0x26d310[_0x37a5('0x2a')]()[_0x37a5('0x2b')](function(){var _0x99010b=_0x26d310[_0x37a5('0x2c')]({'plain':!![]});var _0x128a73=[{'name':'VoiceQueues','value':_0x37a5('0x2d'),'ignore':![]},{'name':_0x37a5('0x2e'),'value':_0x37a5('0x2f'),'ignore':![]}];var _0x53de13=_(_0x128a73)[_0x37a5('0x30')](_0x37a5('0x31'))[_0x37a5('0x32')](_0x37a5('0x33'))[_0x37a5('0x33')]();if(_[_0x37a5('0x34')](_0x53de13,_0x99010b[_0x37a5('0x35')])){return;}var _0x42868d=_['find'](_0x128a73,[_0x37a5('0x33'),_0x99010b[_0x37a5('0x35')]])[_0x37a5('0x36')];return db[_0x37a5('0x37')][_0x37a5('0x2a')]({'where':{'type':_0x42868d,'resourceId':_0x99010b['id']}})[_0x37a5('0x2b')](function(){return _0x26d310;});})[_0x37a5('0x2b')](function(){_0x2d6069[_0x37a5('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x246d40,_0x1c55f0){return function(_0x498a1a){if(!_0x498a1a){_0x246d40[_0x37a5('0x38')](0x194);}return _0x498a1a;};}function handleError(_0x46ee5f,_0x55099b){_0x55099b=_0x55099b||0x1f4;return function(_0x41ffb5){logger[_0x37a5('0x39')](_0x41ffb5[_0x37a5('0x3a')]);if(_0x41ffb5[_0x37a5('0x36')]){delete _0x41ffb5[_0x37a5('0x36')];}_0x46ee5f['status'](_0x55099b)['send'](_0x41ffb5);};}exports['index']=function(_0x4b9767,_0x16e5aa){var _0x56f226={},_0x2cd065={},_0x592fd1={'count':0x0,'rows':[]};var _0x1907b8=_[_0x37a5('0x32')](db[_0x37a5('0x3b')][_0x37a5('0x3c')],function(_0x52bae3){return{'name':_0x52bae3['fieldName'],'type':_0x52bae3['type']['key']};});_0x2cd065['model']=_[_0x37a5('0x32')](_0x1907b8,_0x37a5('0x36'));_0x2cd065[_0x37a5('0x3d')]=_[_0x37a5('0x3e')](_0x4b9767['query']);_0x2cd065[_0x37a5('0x3f')]=_[_0x37a5('0x40')](_0x2cd065['model'],_0x2cd065[_0x37a5('0x3d')]);_0x56f226[_0x37a5('0x41')]=_['intersection'](_0x2cd065[_0x37a5('0x42')],qs[_0x37a5('0x43')](_0x4b9767[_0x37a5('0x3d')][_0x37a5('0x43')]));_0x56f226[_0x37a5('0x41')]=_0x56f226[_0x37a5('0x41')][_0x37a5('0x44')]?_0x56f226['attributes']:_0x2cd065['model'];if(!_0x4b9767['query'][_0x37a5('0x45')]('nolimit')){_0x56f226[_0x37a5('0x25')]=qs['limit'](_0x4b9767[_0x37a5('0x3d')][_0x37a5('0x25')]);_0x56f226[_0x37a5('0x24')]=qs[_0x37a5('0x24')](_0x4b9767['query'][_0x37a5('0x24')]);}_0x56f226['order']=qs[_0x37a5('0x46')](_0x4b9767[_0x37a5('0x3d')][_0x37a5('0x46')]);_0x56f226['where']=qs[_0x37a5('0x3f')](_[_0x37a5('0x47')](_0x4b9767[_0x37a5('0x3d')],_0x2cd065['filters']),_0x1907b8);if(_0x4b9767['query'][_0x37a5('0x30')]){_0x56f226[_0x37a5('0x48')]=_[_0x37a5('0x49')](_0x56f226[_0x37a5('0x48')],{'$or':_[_0x37a5('0x32')](_0x1907b8,function(_0x43e985){if(_0x43e985[_0x37a5('0x35')]!==_0x37a5('0x4a')){var _0x18cdb7={};_0x18cdb7[_0x43e985['name']]={'$like':'%'+_0x4b9767['query']['filter']+'%'};return _0x18cdb7;}})});}_0x56f226=_[_0x37a5('0x49')]({},_0x56f226,_0x4b9767[_0x37a5('0x4b')]);var _0x2a055f={'where':_0x56f226['where']};return db['VoiceQueue'][_0x37a5('0x23')](_0x2a055f)['then'](function(_0x56fe31){_0x592fd1[_0x37a5('0x23')]=_0x56fe31;if(_0x4b9767[_0x37a5('0x3d')][_0x37a5('0x4c')]){_0x56f226[_0x37a5('0x4d')]=[{'all':!![]}];}return db['VoiceQueue'][_0x37a5('0x4e')](_0x56f226);})['then'](function(_0x1546fe){_0x592fd1[_0x37a5('0x4f')]=_0x1546fe;return _0x592fd1;})[_0x37a5('0x2b')](respondWithFilteredResult(_0x16e5aa,_0x56f226))['catch'](handleError(_0x16e5aa,null));};exports[_0x37a5('0x50')]=function(_0xe8328c,_0x2c0d8e){var _0x4c0904={'raw':![],'where':{'id':_0xe8328c[_0x37a5('0x51')]['id']}},_0x52f54c={};_0x52f54c[_0x37a5('0x42')]=_[_0x37a5('0x3e')](db[_0x37a5('0x3b')][_0x37a5('0x3c')]);_0x52f54c[_0x37a5('0x3d')]=_['keys'](_0xe8328c[_0x37a5('0x3d')]);_0x52f54c[_0x37a5('0x3f')]=_['intersection'](_0x52f54c[_0x37a5('0x42')],_0x52f54c[_0x37a5('0x3d')]);_0x4c0904[_0x37a5('0x41')]=_['intersection'](_0x52f54c[_0x37a5('0x42')],qs[_0x37a5('0x43')](_0xe8328c[_0x37a5('0x3d')]['fields']));_0x4c0904[_0x37a5('0x41')]=_0x4c0904[_0x37a5('0x41')][_0x37a5('0x44')]?_0x4c0904['attributes']:_0x52f54c[_0x37a5('0x42')];if(_0xe8328c[_0x37a5('0x3d')]['includeAll']){_0x4c0904[_0x37a5('0x4d')]=[{'all':!![]}];}_0x4c0904=_['merge']({},_0x4c0904,_0xe8328c[_0x37a5('0x4b')]);return db['VoiceQueue'][_0x37a5('0x52')](_0x4c0904)[_0x37a5('0x2b')](handleEntityNotFound(_0x2c0d8e,null))[_0x37a5('0x2b')](respondWithResult(_0x2c0d8e,null))[_0x37a5('0x53')](handleError(_0x2c0d8e,null));};exports['create']=function(_0x2a3691,_0x4e9e31){return db[_0x37a5('0x3b')][_0x37a5('0x54')](_0x2a3691['body'],{})[_0x37a5('0x2b')](function(_0x2e9887){var _0x18ac19=_0x2a3691[_0x37a5('0x55')][_0x37a5('0x2c')]({'plain':!![]});if(!_0x18ac19)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18ac19[_0x37a5('0x56')]===_0x37a5('0x55')){var _0x6633cf=_0x2e9887[_0x37a5('0x2c')]({'plain':!![]});var _0x3c2fd0=[{'name':'VoiceQueues','value':_0x37a5('0x2d')},{'name':_0x37a5('0x2e'),'value':'outbound'}];var _0x1b6ccd=_[_0x37a5('0x52')](_0x3c2fd0,[_0x37a5('0x33'),_0x6633cf[_0x37a5('0x35')]])[_0x37a5('0x36')];return db['UserProfileSection'][_0x37a5('0x52')]({'where':{'name':_0x1b6ccd,'userProfileId':_0x18ac19[_0x37a5('0x57')]},'raw':!![]})[_0x37a5('0x2b')](function(_0x3852da){if(_0x3852da&&_0x3852da['autoAssociation']===0x0){return db[_0x37a5('0x37')][_0x37a5('0x54')]({'name':_0x6633cf[_0x37a5('0x36')],'resourceId':_0x6633cf['id'],'type':_0x3852da['name'],'sectionId':_0x3852da['id']},{})['then'](function(){return _0x2e9887;});}else{return _0x2e9887;}})[_0x37a5('0x53')](function(_0x3a5160){logger['error'](_0x37a5('0x58'),_0x3a5160);throw _0x3a5160;});}return _0x2e9887;})[_0x37a5('0x2b')](respondWithResult(_0x4e9e31,0xc9))[_0x37a5('0x53')](handleError(_0x4e9e31,null));};exports['clone']=function(_0x500e9b,_0xe54fa1){var _0x1cd07c={'where':{'id':_0x500e9b[_0x37a5('0x51')]['id']}},_0x7d9052={};_0x7d9052['model']=_[_0x37a5('0x3e')](db[_0x37a5('0x3b')][_0x37a5('0x3c')]);_0x1cd07c[_0x37a5('0x41')]=_['intersection'](_0x7d9052[_0x37a5('0x42')],qs[_0x37a5('0x43')](_0x500e9b[_0x37a5('0x3d')][_0x37a5('0x43')]));_0x1cd07c[_0x37a5('0x41')]=_0x1cd07c[_0x37a5('0x41')][_0x37a5('0x44')]?_0x1cd07c[_0x37a5('0x41')]:_0x7d9052[_0x37a5('0x42')];if(_0x500e9b[_0x37a5('0x3d')][_0x37a5('0x4c')]){_0x1cd07c[_0x37a5('0x4d')]=[{'all':!![]}];}_0x1cd07c=_[_0x37a5('0x49')]({},_0x1cd07c,_0x500e9b[_0x37a5('0x4b')]);return db[_0x37a5('0x3b')]['find'](_0x1cd07c)[_0x37a5('0x2b')](handleEntityNotFound(_0xe54fa1,null))['then'](function(_0x34091f){if(_0x34091f){var _0x1d043d=_0x34091f[_0x37a5('0x2c')]({'plain':!![]});_0x1d043d=qs[_0x37a5('0x59')](_0x1d043d,['id',_0x37a5('0x5a'),_0x37a5('0x5b')]);_0x500e9b[_0x37a5('0x5c')]=_[_0x37a5('0x59')](_0x500e9b[_0x37a5('0x5c')],['id','createdAt','updatedAt']);return db[_0x37a5('0x3b')][_0x37a5('0x54')](_[_0x37a5('0x49')](_0x1d043d,_0x500e9b[_0x37a5('0x5c')]),{'include':_0x500e9b[_0x37a5('0x3d')][_0x37a5('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x4424a0){var _0x48792d=_0x500e9b[_0x37a5('0x55')][_0x37a5('0x2c')]({'plain':!![]});if(!_0x48792d)throw new Error(_0x37a5('0x5d'));if(_0x48792d['role']===_0x37a5('0x55')){var _0x13fc30=_0x4424a0[_0x37a5('0x2c')]({'plain':!![]});var _0x3698f6=[{'name':_0x37a5('0x5e'),'value':_0x37a5('0x2d')},{'name':_0x37a5('0x2e'),'value':_0x37a5('0x2f')}];var _0x59dffe=_[_0x37a5('0x52')](_0x3698f6,[_0x37a5('0x33'),_0x13fc30[_0x37a5('0x35')]])[_0x37a5('0x36')];return db[_0x37a5('0x5f')][_0x37a5('0x52')]({'where':{'name':_0x59dffe,'userProfileId':_0x48792d[_0x37a5('0x57')]},'raw':!![]})[_0x37a5('0x2b')](function(_0x1ff13f){if(_0x1ff13f&&_0x1ff13f[_0x37a5('0x60')]===0x0){return db[_0x37a5('0x37')][_0x37a5('0x54')]({'name':_0x13fc30[_0x37a5('0x36')],'resourceId':_0x13fc30['id'],'type':_0x1ff13f[_0x37a5('0x36')],'sectionId':_0x1ff13f['id']},{})[_0x37a5('0x2b')](function(){return _0x4424a0;});}else{return _0x4424a0;}})[_0x37a5('0x53')](function(_0x48c0c5){logger[_0x37a5('0x39')](_0x37a5('0x58'),_0x48c0c5);throw _0x48c0c5;});}return _0x4424a0;});}})['then'](respondWithResult(_0xe54fa1,0xc9))[_0x37a5('0x53')](handleError(_0xe54fa1,null));};exports[_0x37a5('0x61')]=function(_0x3de463,_0x595b38){if(_0x3de463[_0x37a5('0x5c')]['id']){delete _0x3de463[_0x37a5('0x5c')]['id'];}return db[_0x37a5('0x3b')][_0x37a5('0x52')]({'where':{'id':_0x3de463['params']['id']}})[_0x37a5('0x2b')](handleEntityNotFound(_0x595b38,null))[_0x37a5('0x2b')](saveUpdates(_0x3de463[_0x37a5('0x5c')],null))['then'](respondWithResult(_0x595b38,null))[_0x37a5('0x53')](handleError(_0x595b38,null));};exports[_0x37a5('0x2a')]=function(_0x5b8e2e,_0xe3313b){return db[_0x37a5('0x3b')]['find']({'where':{'id':_0x5b8e2e[_0x37a5('0x51')]['id']}})['then'](handleEntityNotFound(_0xe3313b,null))[_0x37a5('0x2b')](removeEntity(_0xe3313b,null))['catch'](handleError(_0xe3313b,null));};exports['getHoppers']=function(_0x193bf6,_0x2fae48,_0x132ed9){var _0x1de6ec={'raw':![],'where':{}};var _0xa96e82={};var _0x4ce819={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x193bf6[_0x37a5('0x51')]['id']}})[_0x37a5('0x2b')](handleEntityNotFound(_0x2fae48,null))['then'](function(_0x1355c9){if(_0x1355c9){_0xa96e82['model']=_[_0x37a5('0x3e')](db['CmHopper'][_0x37a5('0x3c')]);_0xa96e82[_0x37a5('0x3d')]=_['keys'](_0x193bf6[_0x37a5('0x3d')]);_0xa96e82[_0x37a5('0x3f')]=_[_0x37a5('0x40')](_0xa96e82['model'],_0xa96e82[_0x37a5('0x3d')]);_0x1de6ec[_0x37a5('0x41')]=_[_0x37a5('0x40')](_0xa96e82[_0x37a5('0x42')],qs[_0x37a5('0x43')](_0x193bf6['query'][_0x37a5('0x43')]));_0x1de6ec[_0x37a5('0x41')]=_0x1de6ec[_0x37a5('0x41')][_0x37a5('0x44')]?_0x1de6ec[_0x37a5('0x41')]:_0xa96e82[_0x37a5('0x42')];if(!_0x193bf6[_0x37a5('0x3d')][_0x37a5('0x45')](_0x37a5('0x62'))){_0x1de6ec['limit']=qs[_0x37a5('0x25')](_0x193bf6[_0x37a5('0x3d')]['limit']);_0x1de6ec['offset']=qs['offset'](_0x193bf6[_0x37a5('0x3d')][_0x37a5('0x24')]);}_0x1de6ec['order']=qs['sort'](_0x193bf6[_0x37a5('0x3d')][_0x37a5('0x46')]);_0x1de6ec[_0x37a5('0x48')]=qs[_0x37a5('0x3f')](_[_0x37a5('0x47')](_0x193bf6[_0x37a5('0x3d')],_0xa96e82['filters']));_0x1de6ec[_0x37a5('0x48')]['VoiceQueueId']=_0x1355c9['id'];if(_0x193bf6[_0x37a5('0x3d')]['filter']){_0x1de6ec[_0x37a5('0x48')]=_[_0x37a5('0x49')](_0x1de6ec['where'],{'$or':_['map'](_0x1de6ec['attributes'],function(_0xe093b){var _0x59e2a8={};_0x59e2a8[_0xe093b]={'$like':'%'+_0x193bf6[_0x37a5('0x3d')][_0x37a5('0x30')]+'%'};return _0x59e2a8;})});}_0x1de6ec=_['merge']({},_0x1de6ec,_0x193bf6['options']);return db[_0x37a5('0x63')][_0x37a5('0x23')]({'where':_0x1de6ec[_0x37a5('0x48')]})['then'](function(_0x1d94fa){_0x4ce819['count']=_0x1d94fa;if(_0x193bf6['query'][_0x37a5('0x4c')]){_0x1de6ec[_0x37a5('0x4d')]=[{'all':!![]}];}return db[_0x37a5('0x63')][_0x37a5('0x4e')](_0x1de6ec);})[_0x37a5('0x2b')](function(_0x445a0d){_0x4ce819[_0x37a5('0x4f')]=_0x445a0d;return _0x4ce819;});}})[_0x37a5('0x2b')](respondWithFilteredResult(_0x2fae48,_0x1de6ec))[_0x37a5('0x53')](handleError(_0x2fae48,null));};exports[_0x37a5('0x64')]=function(_0xd8d81,_0x25dc7b,_0x5b5c78){var _0x9f248d={'raw':!![],'where':{}};var _0x449a1a={};var _0x247139={'count':0x0,'rows':[]};return db[_0x37a5('0x3b')][_0x37a5('0x65')]({'where':{'id':_0xd8d81[_0x37a5('0x51')]['id']}})[_0x37a5('0x2b')](handleEntityNotFound(_0x25dc7b,null))[_0x37a5('0x2b')](function(_0x33e2c2){if(_0x33e2c2){_0x449a1a[_0x37a5('0x42')]=_[_0x37a5('0x3e')](db[_0x37a5('0x66')][_0x37a5('0x3c')]);_0x449a1a[_0x37a5('0x3d')]=_[_0x37a5('0x3e')](_0xd8d81['query']);_0x449a1a[_0x37a5('0x3f')]=_[_0x37a5('0x40')](_0x449a1a[_0x37a5('0x42')],_0x449a1a[_0x37a5('0x3d')]);_0x9f248d['attributes']=_[_0x37a5('0x40')](_0x449a1a[_0x37a5('0x42')],qs[_0x37a5('0x43')](_0xd8d81[_0x37a5('0x3d')][_0x37a5('0x43')]));_0x9f248d['attributes']=_0x9f248d['attributes'][_0x37a5('0x44')]?_0x9f248d[_0x37a5('0x41')]:_0x449a1a[_0x37a5('0x42')];if(!_0xd8d81['query'][_0x37a5('0x45')](_0x37a5('0x62'))){_0x9f248d[_0x37a5('0x25')]=qs[_0x37a5('0x25')](_0xd8d81[_0x37a5('0x3d')][_0x37a5('0x25')]);_0x9f248d[_0x37a5('0x24')]=qs[_0x37a5('0x24')](_0xd8d81['query']['offset']);}_0x9f248d[_0x37a5('0x67')]=qs[_0x37a5('0x46')](_0xd8d81[_0x37a5('0x3d')]['sort']);_0x9f248d['where']=qs[_0x37a5('0x3f')](_[_0x37a5('0x47')](_0xd8d81[_0x37a5('0x3d')],_0x449a1a['filters']));_0x9f248d[_0x37a5('0x48')][_0x37a5('0x68')]=_0x33e2c2['id'];if(_0xd8d81[_0x37a5('0x3d')]['filter']){_0x9f248d[_0x37a5('0x48')]=_[_0x37a5('0x49')](_0x9f248d[_0x37a5('0x48')],{'$or':_[_0x37a5('0x32')](_0x9f248d[_0x37a5('0x41')],function(_0xae55d3){var _0x2180b={};_0x2180b[_0xae55d3]={'$like':'%'+_0xd8d81[_0x37a5('0x3d')][_0x37a5('0x30')]+'%'};return _0x2180b;})});}_0x9f248d=_[_0x37a5('0x49')]({},_0x9f248d,_0xd8d81[_0x37a5('0x4b')]);return db[_0x37a5('0x66')][_0x37a5('0x23')]({'where':_0x9f248d['where']})[_0x37a5('0x2b')](function(_0xa39f5c){_0x247139['count']=_0xa39f5c;if(_0xd8d81[_0x37a5('0x3d')][_0x37a5('0x4c')]){_0x9f248d['include']=[{'all':!![]}];}return db[_0x37a5('0x66')][_0x37a5('0x4e')](_0x9f248d);})['then'](function(_0xe92744){_0x247139['rows']=_0xe92744;return _0x247139;});}})['then'](respondWithFilteredResult(_0x25dc7b,_0x9f248d))['catch'](handleError(_0x25dc7b,null));};exports[_0x37a5('0x69')]=function(_0x1f2605,_0x3b9891,_0x3d6a92){var _0x533bb1={'raw':!![],'where':{}};var _0x1a0d83={};var _0xf5acb6={'count':0x0,'rows':[]};return db[_0x37a5('0x3b')]['findOne']({'where':{'id':_0x1f2605['params']['id']}})[_0x37a5('0x2b')](handleEntityNotFound(_0x3b9891,null))[_0x37a5('0x2b')](function(_0x1e6d35){if(_0x1e6d35){_0x1a0d83[_0x37a5('0x42')]=_['keys'](db[_0x37a5('0x6a')]['rawAttributes']);_0x1a0d83[_0x37a5('0x3d')]=_[_0x37a5('0x3e')](_0x1f2605[_0x37a5('0x3d')]);_0x1a0d83[_0x37a5('0x3f')]=_[_0x37a5('0x40')](_0x1a0d83[_0x37a5('0x42')],_0x1a0d83['query']);_0x533bb1['attributes']=_[_0x37a5('0x40')](_0x1a0d83[_0x37a5('0x42')],qs[_0x37a5('0x43')](_0x1f2605[_0x37a5('0x3d')][_0x37a5('0x43')]));_0x533bb1[_0x37a5('0x41')]=_0x533bb1['attributes'][_0x37a5('0x44')]?_0x533bb1[_0x37a5('0x41')]:_0x1a0d83[_0x37a5('0x42')];if(!_0x1f2605['query'][_0x37a5('0x45')](_0x37a5('0x62'))){_0x533bb1[_0x37a5('0x25')]=qs[_0x37a5('0x25')](_0x1f2605[_0x37a5('0x3d')]['limit']);_0x533bb1[_0x37a5('0x24')]=qs[_0x37a5('0x24')](_0x1f2605[_0x37a5('0x3d')]['offset']);}_0x533bb1['order']=qs[_0x37a5('0x46')](_0x1f2605[_0x37a5('0x3d')]['sort']);_0x533bb1['where']=qs[_0x37a5('0x3f')](_[_0x37a5('0x47')](_0x1f2605[_0x37a5('0x3d')],_0x1a0d83[_0x37a5('0x3f')]));_0x533bb1[_0x37a5('0x48')][_0x37a5('0x68')]=_0x1e6d35['id'];if(_0x1f2605[_0x37a5('0x3d')][_0x37a5('0x30')]){_0x533bb1['where']=_[_0x37a5('0x49')](_0x533bb1['where'],{'$or':_['map'](_0x533bb1[_0x37a5('0x41')],function(_0x509551){var _0x38aa0d={};_0x38aa0d[_0x509551]={'$like':'%'+_0x1f2605[_0x37a5('0x3d')][_0x37a5('0x30')]+'%'};return _0x38aa0d;})});}_0x533bb1=_['merge']({},_0x533bb1,_0x1f2605['options']);return db[_0x37a5('0x6a')][_0x37a5('0x23')]({'where':_0x533bb1[_0x37a5('0x48')]})['then'](function(_0x5e4e24){_0xf5acb6[_0x37a5('0x23')]=_0x5e4e24;if(_0x1f2605[_0x37a5('0x3d')]['includeAll']){_0x533bb1[_0x37a5('0x4d')]=[{'all':!![]}];}return db[_0x37a5('0x6a')][_0x37a5('0x4e')](_0x533bb1);})[_0x37a5('0x2b')](function(_0x1876a7){_0xf5acb6[_0x37a5('0x4f')]=_0x1876a7;return _0xf5acb6;});}})[_0x37a5('0x2b')](respondWithFilteredResult(_0x3b9891,_0x533bb1))[_0x37a5('0x53')](handleError(_0x3b9891,null));};exports[_0x37a5('0x6b')]=function(_0x1ec46f,_0x1967e6,_0x262c2f){var _0x5902fe={'raw':!![],'where':{}};var _0x405234={};var _0x569723={'count':0x0,'rows':[]};return db[_0x37a5('0x3b')][_0x37a5('0x65')]({'where':{'id':_0x1ec46f['params']['id']}})[_0x37a5('0x2b')](handleEntityNotFound(_0x1967e6,null))['then'](function(_0x14321e){if(_0x14321e){_0x405234[_0x37a5('0x42')]=_[_0x37a5('0x3e')](db[_0x37a5('0x6c')][_0x37a5('0x3c')]);_0x405234[_0x37a5('0x3d')]=_[_0x37a5('0x3e')](_0x1ec46f[_0x37a5('0x3d')]);_0x405234[_0x37a5('0x3f')]=_[_0x37a5('0x40')](_0x405234[_0x37a5('0x42')],_0x405234[_0x37a5('0x3d')]);_0x5902fe[_0x37a5('0x41')]=_['intersection'](_0x405234[_0x37a5('0x42')],qs[_0x37a5('0x43')](_0x1ec46f[_0x37a5('0x3d')]['fields']));_0x5902fe['attributes']=_0x5902fe[_0x37a5('0x41')][_0x37a5('0x44')]?_0x5902fe['attributes']:_0x405234['model'];if(!_0x1ec46f[_0x37a5('0x3d')][_0x37a5('0x45')](_0x37a5('0x62'))){_0x5902fe[_0x37a5('0x25')]=qs[_0x37a5('0x25')](_0x1ec46f[_0x37a5('0x3d')][_0x37a5('0x25')]);_0x5902fe[_0x37a5('0x24')]=qs[_0x37a5('0x24')](_0x1ec46f['query'][_0x37a5('0x24')]);}_0x5902fe[_0x37a5('0x67')]=qs['sort'](_0x1ec46f['query']['sort']);_0x5902fe['where']=qs[_0x37a5('0x3f')](_[_0x37a5('0x47')](_0x1ec46f[_0x37a5('0x3d')],_0x405234['filters']));_0x5902fe['where'][_0x37a5('0x68')]=_0x14321e['id'];if(_0x1ec46f[_0x37a5('0x3d')][_0x37a5('0x30')]){_0x5902fe['where']=_['merge'](_0x5902fe['where'],{'$or':_[_0x37a5('0x32')](_0x5902fe[_0x37a5('0x41')],function(_0x5b3fa9){var _0xcbeaa9={};_0xcbeaa9[_0x5b3fa9]={'$like':'%'+_0x1ec46f[_0x37a5('0x3d')][_0x37a5('0x30')]+'%'};return _0xcbeaa9;})});}_0x5902fe=_[_0x37a5('0x49')]({},_0x5902fe,_0x1ec46f[_0x37a5('0x4b')]);return db['CmHopperBlack']['count']({'where':_0x5902fe['where']})[_0x37a5('0x2b')](function(_0x14a300){_0x569723[_0x37a5('0x23')]=_0x14a300;if(_0x1ec46f[_0x37a5('0x3d')]['includeAll']){_0x5902fe[_0x37a5('0x4d')]=[{'all':!![]}];}return db[_0x37a5('0x6c')][_0x37a5('0x4e')](_0x5902fe);})['then'](function(_0xc1eb47){_0x569723[_0x37a5('0x4f')]=_0xc1eb47;return _0x569723;});}})[_0x37a5('0x2b')](respondWithFilteredResult(_0x1967e6,_0x5902fe))[_0x37a5('0x53')](handleError(_0x1967e6,null));};exports[_0x37a5('0x6d')]=function(_0x4fbbb7,_0x59286e,_0x5cfbf3){var _0x457e1b={};var _0x4b63cd={};var _0x4654a4;var _0x2ee2e3;return db[_0x37a5('0x3b')][_0x37a5('0x65')]({'where':{'id':_0x4fbbb7[_0x37a5('0x51')]['id']}})['then'](handleEntityNotFound(_0x59286e,null))[_0x37a5('0x2b')](function(_0x3f275a){if(_0x3f275a){_0x4654a4=_0x3f275a;_0x4b63cd[_0x37a5('0x42')]=_[_0x37a5('0x3e')](db[_0x37a5('0x6e')]['rawAttributes']);_0x4b63cd['query']=_[_0x37a5('0x3e')](_0x4fbbb7['query']);_0x4b63cd[_0x37a5('0x3f')]=_['intersection'](_0x4b63cd[_0x37a5('0x42')],_0x4b63cd[_0x37a5('0x3d')]);_0x457e1b['attributes']=_['intersection'](_0x4b63cd[_0x37a5('0x42')],qs[_0x37a5('0x43')](_0x4fbbb7[_0x37a5('0x3d')][_0x37a5('0x43')]));_0x457e1b[_0x37a5('0x41')]=_0x457e1b[_0x37a5('0x41')][_0x37a5('0x44')]?_0x457e1b[_0x37a5('0x41')]:_0x4b63cd[_0x37a5('0x42')];_0x457e1b[_0x37a5('0x67')]=qs[_0x37a5('0x46')](_0x4fbbb7[_0x37a5('0x3d')][_0x37a5('0x46')]);_0x457e1b['where']=qs[_0x37a5('0x3f')](_[_0x37a5('0x47')](_0x4fbbb7['query'],_0x4b63cd[_0x37a5('0x3f')]));if(_0x4fbbb7[_0x37a5('0x3d')][_0x37a5('0x30')]){_0x457e1b['where']=_[_0x37a5('0x49')](_0x457e1b[_0x37a5('0x48')],{'$or':_['map'](_0x457e1b[_0x37a5('0x41')],function(_0x5acaaa){var _0x4ef5c6={};_0x4ef5c6[_0x5acaaa]={'$like':'%'+_0x4fbbb7[_0x37a5('0x3d')][_0x37a5('0x30')]+'%'};return _0x4ef5c6;})});}_0x457e1b=_[_0x37a5('0x49')]({},_0x457e1b,_0x4fbbb7['options']);return _0x4654a4[_0x37a5('0x6d')](_0x457e1b);}})[_0x37a5('0x2b')](function(_0x593dc9){if(_0x593dc9){_0x2ee2e3=_0x593dc9[_0x37a5('0x44')];if(!_0x4fbbb7[_0x37a5('0x3d')]['hasOwnProperty'](_0x37a5('0x62'))){_0x457e1b['limit']=qs[_0x37a5('0x25')](_0x4fbbb7[_0x37a5('0x3d')][_0x37a5('0x25')]);_0x457e1b[_0x37a5('0x24')]=qs[_0x37a5('0x24')](_0x4fbbb7[_0x37a5('0x3d')][_0x37a5('0x24')]);}return _0x4654a4[_0x37a5('0x6d')](_0x457e1b);}})[_0x37a5('0x2b')](function(_0x46fde7){if(_0x46fde7){return _0x46fde7?{'count':_0x2ee2e3,'rows':_0x46fde7}:null;}})[_0x37a5('0x2b')](respondWithResult(_0x59286e,null))[_0x37a5('0x53')](handleError(_0x59286e,null));};exports[_0x37a5('0x6f')]=function(_0x3b9fdb,_0x3efa5f,_0x58d092){var _0x3b9f18=_0x3b9fdb[_0x37a5('0x5c')][_0x37a5('0x70')];var _0x47ad16=_[_0x37a5('0x32')](_0x3b9f18,'id');return db[_0x37a5('0x6e')][_0x37a5('0x4e')]({'where':{'id':_0x47ad16},'attributes':['id'],'include':[{'model':db[_0x37a5('0x71')],'as':_0x37a5('0x72'),'attributes':['id',_0x37a5('0x36'),'online',_0x37a5('0x73'),'interface'],'raw':!![]}]})['then'](function(_0x46f8de){if(_0x46f8de){var _0x1e3d68=_[_0x37a5('0x74')](_0x46f8de,function(_0x59a407){var _0x5a6c80=_0x59a407[_0x37a5('0x2c')]({'plain':!![]});_0x5a6c80['Agents']['forEach'](function(_0x1f631b){_0x1f631b['penalty']=_['find'](_0x3b9f18,{'id':_0x5a6c80['id']})[_0x37a5('0x75')];});return _0x5a6c80[_0x37a5('0x72')];});return db['VoiceQueue']['find']({'where':{'id':_0x3b9fdb['params']['id']}})[_0x37a5('0x2b')](function(_0x3dd7e6){return db[_0x37a5('0x76')][_0x37a5('0x77')](function(_0x23f392){return _0x3dd7e6[_0x37a5('0x6f')](_0x47ad16,{'transaction':_0x23f392})[_0x37a5('0x2b')](function(){return BPromise['each'](_0x3b9f18,function(_0x4322aa){return db[_0x37a5('0x78')][_0x37a5('0x79')]({'TeamId':_0x4322aa['id'],'VoiceQueueId':_0x3b9fdb[_0x37a5('0x51')]['id'],'penalty':_0x4322aa['penalty']},{'transaction':_0x23f392});});})[_0x37a5('0x2b')](function(){return BPromise[_0x37a5('0x7a')](_0x1e3d68,function(_0x241c96){return db[_0x37a5('0x7b')][_0x37a5('0x7c')]({'where':{'UserId':_0x241c96['id'],'VoiceQueueId':_0x3b9fdb['params']['id']},'defaults':{'penalty':_0x241c96['penalty']},'transaction':_0x23f392});});})[_0x37a5('0x2b')](function(){return BPromise['each'](_['filter'](_0x1e3d68,{'online':!![]}),function(_0x5198a8){return db[_0x37a5('0x7d')][_0x37a5('0x79')]({'membername':_0x5198a8[_0x37a5('0x36')],'UserId':_0x5198a8['id'],'queue_name':_0x3dd7e6[_0x37a5('0x36')],'VoiceQueueId':_0x3dd7e6['id'],'interface':_['isNil'](_0x5198a8[_0x37a5('0x7e')])?util[_0x37a5('0x7f')]('SIP/%s',_0x5198a8[_0x37a5('0x36')]):_0x5198a8[_0x37a5('0x7e')],'paused':_0x5198a8[_0x37a5('0x73')]||![],'penalty':_0x5198a8[_0x37a5('0x75')]},{'transaction':_0x23f392});});})['then'](function(){_0x1e3d68[_0x37a5('0x80')](function(_0x2decbc){socket[_0x37a5('0x81')](_0x37a5('0x82'),{'UserId':_0x2decbc['id'],'VoiceQueueId':_0x3dd7e6['id']});});});});});}})['then'](respondWithStatusCode(_0x3efa5f,null))[_0x37a5('0x53')](handleError(_0x3efa5f,null));};exports[_0x37a5('0x83')]=function(_0x4af945,_0x3b39c3,_0x264f4b){return db[_0x37a5('0x6e')]['findAll']({'where':{'id':_0x4af945[_0x37a5('0x3d')][_0x37a5('0x84')]},'attributes':['id'],'include':[{'model':db[_0x37a5('0x71')],'as':_0x37a5('0x72'),'attributes':['id'],'raw':!![]}]})[_0x37a5('0x2b')](handleEntityNotFound(_0x3b39c3,null))[_0x37a5('0x2b')](function(_0x59749c){var _0x5867c6=_[_0x37a5('0x32')](_0x59749c,'id');var _0x7a6508=[];var _0x1e651e=[];var _0x5c5b78=squel['select']();_0x5c5b78[_0x37a5('0x85')](_0x37a5('0x86'))[_0x37a5('0x87')](_0x37a5('0x88'),'tq')[_0x37a5('0x89')](_0x37a5('0x8a'),'ut',_0x37a5('0x8b'))[_0x37a5('0x48')](_0x37a5('0x8c'),_0x4af945[_0x37a5('0x51')]['id']);for(var _0x14b94d=0x0;_0x14b94d<_0x59749c[_0x37a5('0x44')];_0x14b94d+=0x1){let _0x39d631=_0x59749c[_0x14b94d];for(var _0x51fa0e=0x0;_0x51fa0e<_0x39d631[_0x37a5('0x72')][_0x37a5('0x44')];_0x51fa0e+=0x1){let _0x33f37b=_0x39d631[_0x37a5('0x72')][_0x51fa0e];var _0x3b3529=_0x5c5b78['clone']();_0x3b3529[_0x37a5('0x48')](_0x37a5('0x8d'),_0x33f37b['id']);_0x1e651e[_0x37a5('0x8e')](db['sequelize'][_0x37a5('0x3d')](_0x3b3529[_0x37a5('0x8f')](),{'type':db[_0x37a5('0x76')]['QueryTypes'][_0x37a5('0x90')]})['then'](function(_0x504b42){if(_0x504b42[_0x37a5('0x44')]===0x1){return _0x33f37b['id'];}else{var _0x5aaccb=_['every'](_[_0x37a5('0x32')](_0x504b42,_0x37a5('0x91')),function(_0x355eeb){return _[_0x37a5('0x34')](_0x5867c6,_0x355eeb);});if(_0x5aaccb){return _0x33f37b['id'];}}}));}}return BPromise[_0x37a5('0x92')](_0x1e651e)[_0x37a5('0x2b')](function(_0x3c9499){_0x7a6508=_(_0x7a6508)[_0x37a5('0x93')](_0x3c9499)['compact']()[_0x37a5('0x33')]();return db['VoiceQueue'][_0x37a5('0x52')]({'where':{'id':_0x4af945[_0x37a5('0x51')]['id']}})[_0x37a5('0x2b')](function(_0x1c96db){return db[_0x37a5('0x76')][_0x37a5('0x77')](function(_0x38f40a){return _0x1c96db['removeTeams'](_0x4af945['query']['ids'],{'transaction':_0x38f40a})[_0x37a5('0x2b')](function(){if(!_['isEmpty'](_0x7a6508)){return _0x1c96db[_0x37a5('0x94')](_0x7a6508,{'transaction':_0x38f40a})[_0x37a5('0x2b')](function(){return db[_0x37a5('0x7d')][_0x37a5('0x2a')]({'where':{'VoiceQueueId':_0x4af945[_0x37a5('0x51')]['id'],'UserId':_0x7a6508},'transaction':_0x38f40a});});}})['then'](function(){_0x7a6508[_0x37a5('0x80')](function(_0x57a0b4){socket[_0x37a5('0x81')]('userVoiceQueue:remove',{'UserId':_0x57a0b4,'VoiceQueueId':_0x1c96db['id']});});});});});});})['then'](respondWithStatusCode(_0x3b39c3,null))['catch'](handleError(_0x3b39c3,null));};exports['addAgents']=function(_0x1a86c8,_0x4be4ba,_0x5c39f5){var _0x1931c0,_0x554b02;return db[_0x37a5('0x3b')][_0x37a5('0x52')]({'where':{'id':_0x1a86c8['params']['id']}})[_0x37a5('0x2b')](handleEntityNotFound(_0x4be4ba,null))[_0x37a5('0x2b')](function(_0x5acf4c){if(_0x5acf4c){_0x554b02=_0x5acf4c;return _0x5acf4c['addAgents'](_0x1a86c8[_0x37a5('0x5c')][_0x37a5('0x84')],_[_0x37a5('0x59')](_0x1a86c8['body'],['ids','id'])||{})[_0x37a5('0x95')](function(_0x3acbba){for(var _0x3ac830=0x0;_0x3ac830<_0x1a86c8[_0x37a5('0x5c')]['ids'][_0x37a5('0x44')];_0x3ac830+=0x1){socket[_0x37a5('0x81')](_0x37a5('0x82'),{'UserId':Number(_0x1a86c8[_0x37a5('0x5c')][_0x37a5('0x84')][_0x3ac830]),'VoiceQueueId':Number(_0x1a86c8['params']['id'])});}return _0x3acbba;});}})[_0x37a5('0x2b')](function(_0x446532){_0x1931c0=_0x446532||[];if(_0x554b02){return db[_0x37a5('0x71')][_0x37a5('0x4e')]({'where':{'id':_0x1a86c8[_0x37a5('0x5c')]['ids']},'attributes':['id',_0x37a5('0x36'),_0x37a5('0x96'),'voicePause',_0x37a5('0x7e')],'raw':!![]});}})[_0x37a5('0x2b')](function(_0x5f06ad){if(!_['isEmpty'](_0x5f06ad)){var _0xf61b91=[];for(var _0x667aca=0x0;_0x667aca<_0x5f06ad[_0x37a5('0x44')];_0x667aca++){if(_0x5f06ad[_0x667aca]['online']){_0xf61b91[_0x37a5('0x8e')](db[_0x37a5('0x7d')][_0x37a5('0x79')]({'membername':_0x5f06ad[_0x667aca]['name'],'UserId':_0x5f06ad[_0x667aca]['id'],'queue_name':_0x554b02['name'],'VoiceQueueId':_0x554b02['id'],'interface':_['isNil'](_0x5f06ad[_0x667aca]['interface'])?util[_0x37a5('0x7f')]('SIP/%s',_0x5f06ad[_0x667aca]['name']):_0x5f06ad[_0x667aca]['interface'],'paused':_0x5f06ad[_0x667aca][_0x37a5('0x73')]||![],'penalty':_0x1a86c8['body'][_0x37a5('0x75')]||0x0}));}}return BPromise[_0x37a5('0x92')](_0xf61b91);}})['then'](function(){return _0x1931c0;})[_0x37a5('0x2b')](respondWithResult(_0x4be4ba,null))['catch'](handleError(_0x4be4ba,null));};exports[_0x37a5('0x94')]=function(_0x591c82,_0x5ece33,_0x29a524){return db[_0x37a5('0x3b')][_0x37a5('0x52')]({'where':{'id':_0x591c82[_0x37a5('0x51')]['id']}})[_0x37a5('0x2b')](handleEntityNotFound(_0x5ece33,null))['then'](function(_0x9e75a){if(_0x9e75a){return _0x9e75a[_0x37a5('0x94')](_0x591c82['query'][_0x37a5('0x84')])[_0x37a5('0x2b')](function(){if(_[_0x37a5('0x97')](_0x591c82[_0x37a5('0x3d')][_0x37a5('0x84')])){for(var _0x570205=0x0;_0x570205<_0x591c82[_0x37a5('0x3d')][_0x37a5('0x84')][_0x37a5('0x44')];_0x570205+=0x1){socket['emit'](_0x37a5('0x98'),{'UserId':Number(_0x591c82[_0x37a5('0x3d')][_0x37a5('0x84')][_0x570205]),'VoiceQueueId':Number(_0x591c82[_0x37a5('0x51')]['id'])});}}else{socket[_0x37a5('0x81')](_0x37a5('0x98'),{'UserId':Number(_0x591c82[_0x37a5('0x3d')]['ids']),'VoiceQueueId':Number(_0x591c82[_0x37a5('0x51')]['id'])});}});}})[_0x37a5('0x2b')](function(_0x2c3ab3){return db[_0x37a5('0x7d')][_0x37a5('0x2a')]({'where':{'VoiceQueueId':_0x591c82[_0x37a5('0x51')]['id'],'UserId':_0x591c82[_0x37a5('0x3d')]['ids']}})[_0x37a5('0x2b')](function(){return _0x2c3ab3;});})[_0x37a5('0x2b')](respondWithStatusCode(_0x5ece33,null))[_0x37a5('0x53')](handleError(_0x5ece33,null));};exports[_0x37a5('0x99')]=function(_0x1b837c,_0x595c32,_0x2a02ef){var _0x37e33c={};var _0x61102c={};var _0x41735e;var _0x1d3792;return db['VoiceQueue'][_0x37a5('0x65')]({'where':{'id':_0x1b837c[_0x37a5('0x51')]['id']}})['then'](handleEntityNotFound(_0x595c32,null))[_0x37a5('0x2b')](function(_0x513786){if(_0x513786){_0x41735e=_0x513786;_0x61102c[_0x37a5('0x42')]=_['keys'](db[_0x37a5('0x71')][_0x37a5('0x3c')]);_0x61102c[_0x37a5('0x3d')]=_[_0x37a5('0x3e')](_0x1b837c[_0x37a5('0x3d')]);_0x61102c[_0x37a5('0x3f')]=_[_0x37a5('0x40')](_0x61102c[_0x37a5('0x42')],_0x61102c[_0x37a5('0x3d')]);_0x37e33c['attributes']=_['intersection'](_0x61102c[_0x37a5('0x42')],qs[_0x37a5('0x43')](_0x1b837c[_0x37a5('0x3d')][_0x37a5('0x43')]));_0x37e33c[_0x37a5('0x41')]=_0x37e33c['attributes'][_0x37a5('0x44')]?_0x37e33c[_0x37a5('0x41')]:_0x61102c[_0x37a5('0x42')];_0x37e33c[_0x37a5('0x67')]=qs['sort'](_0x1b837c['query']['sort']);_0x37e33c[_0x37a5('0x48')]=qs[_0x37a5('0x3f')](_[_0x37a5('0x47')](_0x1b837c['query'],_0x61102c[_0x37a5('0x3f')]));if(_0x1b837c['query']['filter']){_0x37e33c[_0x37a5('0x48')]=_[_0x37a5('0x49')](_0x37e33c[_0x37a5('0x48')],{'$or':_[_0x37a5('0x32')](_0x37e33c['attributes'],function(_0x387a96){var _0x35fa26={};_0x35fa26[_0x387a96]={'$like':'%'+_0x1b837c['query']['filter']+'%'};return _0x35fa26;})});}_0x37e33c=_[_0x37a5('0x49')]({},_0x37e33c,_0x1b837c[_0x37a5('0x4b')]);return _0x41735e[_0x37a5('0x99')](_0x37e33c);}})[_0x37a5('0x2b')](function(_0x1aeb0c){if(_0x1aeb0c){_0x1d3792=_0x1aeb0c[_0x37a5('0x44')];if(!_0x1b837c[_0x37a5('0x3d')][_0x37a5('0x45')](_0x37a5('0x62'))){_0x37e33c[_0x37a5('0x25')]=qs[_0x37a5('0x25')](_0x1b837c[_0x37a5('0x3d')][_0x37a5('0x25')]);_0x37e33c[_0x37a5('0x24')]=qs['offset'](_0x1b837c[_0x37a5('0x3d')]['offset']);}return _0x41735e[_0x37a5('0x99')](_0x37e33c);}})[_0x37a5('0x2b')](function(_0x328e52){if(_0x328e52){return _0x328e52?{'count':_0x1d3792,'rows':_0x328e52}:null;}})[_0x37a5('0x2b')](respondWithResult(_0x595c32,null))[_0x37a5('0x53')](handleError(_0x595c32,null));};exports[_0x37a5('0x9a')]=function(_0x4d52c2,_0x2b5835,_0x3ca771){var _0x55f82a={};var _0x397675={};var _0x1652e1;var _0x5903dd;return db[_0x37a5('0x3b')][_0x37a5('0x65')]({'where':{'id':_0x4d52c2[_0x37a5('0x51')]['id']}})['then'](handleEntityNotFound(_0x2b5835,null))[_0x37a5('0x2b')](function(_0x5f6111){if(_0x5f6111){_0x1652e1=_0x5f6111;_0x397675[_0x37a5('0x42')]=_['keys'](db[_0x37a5('0x7d')][_0x37a5('0x3c')]);_0x397675['query']=_[_0x37a5('0x3e')](_0x4d52c2['query']);_0x397675[_0x37a5('0x3f')]=_[_0x37a5('0x40')](_0x397675[_0x37a5('0x42')],_0x397675['query']);_0x55f82a['attributes']=_[_0x37a5('0x40')](_0x397675['model'],qs[_0x37a5('0x43')](_0x4d52c2['query'][_0x37a5('0x43')]));_0x55f82a[_0x37a5('0x41')]=_0x55f82a[_0x37a5('0x41')][_0x37a5('0x44')]?_0x55f82a[_0x37a5('0x41')]:_0x397675[_0x37a5('0x42')];_0x55f82a['order']=qs[_0x37a5('0x46')](_0x4d52c2['query'][_0x37a5('0x46')]);_0x55f82a[_0x37a5('0x48')]=qs[_0x37a5('0x3f')](_[_0x37a5('0x47')](_0x4d52c2[_0x37a5('0x3d')],_0x397675[_0x37a5('0x3f')]));if(_0x4d52c2[_0x37a5('0x3d')]['filter']){_0x55f82a[_0x37a5('0x48')]=_[_0x37a5('0x49')](_0x55f82a[_0x37a5('0x48')],{'$or':_[_0x37a5('0x32')](_0x55f82a[_0x37a5('0x41')],function(_0x1cf8c6){var _0x260cd5={};_0x260cd5[_0x1cf8c6]={'$like':'%'+_0x4d52c2['query'][_0x37a5('0x30')]+'%'};return _0x260cd5;})});}_0x55f82a=_[_0x37a5('0x49')]({},_0x55f82a,_0x4d52c2[_0x37a5('0x4b')]);return _0x1652e1[_0x37a5('0x9a')](_0x55f82a);}})['then'](function(_0x3ead50){if(_0x3ead50){_0x5903dd=_0x3ead50[_0x37a5('0x44')];if(!_0x4d52c2[_0x37a5('0x3d')][_0x37a5('0x45')](_0x37a5('0x62'))){_0x55f82a[_0x37a5('0x25')]=qs[_0x37a5('0x25')](_0x4d52c2[_0x37a5('0x3d')][_0x37a5('0x25')]);_0x55f82a['offset']=qs[_0x37a5('0x24')](_0x4d52c2[_0x37a5('0x3d')][_0x37a5('0x24')]);}return _0x1652e1[_0x37a5('0x9a')](_0x55f82a);}})[_0x37a5('0x2b')](function(_0x34a0e2){return _0x34a0e2?{'count':_0x5903dd,'rows':_0x34a0e2}:null;})[_0x37a5('0x2b')](respondWithResult(_0x2b5835,null))[_0x37a5('0x53')](handleError(_0x2b5835,null));};exports[_0x37a5('0x9b')]=function(_0xbf0065,_0x268531,_0x5c99ab){var _0x4fb473={};var _0x3f55c6={};var _0x55b590;var _0x2dfdef;return db[_0x37a5('0x3b')][_0x37a5('0x65')]({'where':{'id':_0xbf0065[_0x37a5('0x51')]['id']}})[_0x37a5('0x2b')](handleEntityNotFound(_0x268531,null))[_0x37a5('0x2b')](function(_0x253160){if(_0x253160){_0x55b590=_0x253160;_0x3f55c6['model']=_['keys'](db[_0x37a5('0x9c')]['rawAttributes']);_0x3f55c6[_0x37a5('0x3d')]=_[_0x37a5('0x3e')](_0xbf0065[_0x37a5('0x3d')]);_0x3f55c6['filters']=_[_0x37a5('0x40')](_0x3f55c6[_0x37a5('0x42')],_0x3f55c6['query']);_0x4fb473[_0x37a5('0x41')]=_[_0x37a5('0x40')](_0x3f55c6[_0x37a5('0x42')],qs[_0x37a5('0x43')](_0xbf0065['query'][_0x37a5('0x43')]));_0x4fb473[_0x37a5('0x41')]=_0x4fb473[_0x37a5('0x41')]['length']?_0x4fb473[_0x37a5('0x41')]:_0x3f55c6[_0x37a5('0x42')];_0x4fb473[_0x37a5('0x67')]=qs[_0x37a5('0x46')](_0xbf0065[_0x37a5('0x3d')]['sort']);_0x4fb473[_0x37a5('0x48')]=qs[_0x37a5('0x3f')](_['pick'](_0xbf0065[_0x37a5('0x3d')],_0x3f55c6['filters']));if(_0xbf0065[_0x37a5('0x3d')][_0x37a5('0x30')]){_0x4fb473[_0x37a5('0x48')]=_['merge'](_0x4fb473['where'],{'$or':_[_0x37a5('0x32')](_0x4fb473[_0x37a5('0x41')],function(_0x9e37cf){var _0x3f1a57={};_0x3f1a57[_0x9e37cf]={'$like':'%'+_0xbf0065[_0x37a5('0x3d')]['filter']+'%'};return _0x3f1a57;})});}_0x4fb473=_[_0x37a5('0x49')]({},_0x4fb473,_0xbf0065[_0x37a5('0x4b')]);return _0x55b590[_0x37a5('0x9b')](_0x4fb473);}})[_0x37a5('0x2b')](function(_0x3ca368){if(_0x3ca368){_0x2dfdef=_0x3ca368['length'];if(!_0xbf0065[_0x37a5('0x3d')][_0x37a5('0x45')](_0x37a5('0x62'))){_0x4fb473[_0x37a5('0x25')]=qs[_0x37a5('0x25')](_0xbf0065[_0x37a5('0x3d')][_0x37a5('0x25')]);_0x4fb473[_0x37a5('0x24')]=qs['offset'](_0xbf0065['query']['offset']);}return _0x55b590['getLists'](_0x4fb473);}})[_0x37a5('0x2b')](function(_0x1e4ea3){if(_0x1e4ea3){return _0x1e4ea3?{'count':_0x2dfdef,'rows':_0x1e4ea3}:null;}})['then'](respondWithResult(_0x268531,null))[_0x37a5('0x53')](handleError(_0x268531,null));};exports[_0x37a5('0x9d')]=function(_0x463346,_0x656902,_0x17acaa){var _0x3c004,_0x44c4a9;return db[_0x37a5('0x3b')][_0x37a5('0x52')]({'where':{'id':_0x463346[_0x37a5('0x51')]['id']}})[_0x37a5('0x2b')](handleEntityNotFound(_0x656902,null))[_0x37a5('0x2b')](function(_0x45656b){if(_0x45656b){_0x44c4a9=_0x45656b;return _0x45656b[_0x37a5('0x9d')](_0x463346['body'][_0x37a5('0x84')],_[_0x37a5('0x59')](_0x463346['body'],['ids','id'])||{});}return null;})[_0x37a5('0x95')](function(_0x521115){var _0x21607d;_0x3c004=_0x521115||[];var _0x13627f=[];if(_0x521115){for(var _0x3571f8=0x0;_0x3571f8<_0x521115[_0x37a5('0x44')];_0x3571f8+=0x1){var _0x5e9946=_0x521115[_0x3571f8][_0x37a5('0x2c')]({'plain':!![]});_0x44c4a9[_0x37a5('0x9e')]=_0x463346['body'][_0x37a5('0x9e')]?_0x463346[_0x37a5('0x5c')][_0x37a5('0x9e')]:_0x44c4a9[_0x37a5('0x9e')];switch(_0x44c4a9[_0x37a5('0x9e')]){case _0x37a5('0x9f'):_0x21607d=squel[_0x37a5('0xa0')]()['into'](_0x37a5('0xa1'))[_0x37a5('0xa2')]([_0x37a5('0xa3'),_0x37a5('0xa4'),'ContactId',_0x37a5('0xa5'),'VoiceQueueId',_0x37a5('0x5a'),_0x37a5('0x5b')],squel[_0x37a5('0xa6')]()[_0x37a5('0x85')](_0x37a5('0xa3'),_0x37a5('0xa3'))[_0x37a5('0x85')](_0x37a5('0xa7'),'scheduledAt')[_0x37a5('0x85')]('id',_0x37a5('0xa8'))[_0x37a5('0x85')](_0x5e9946[_0x37a5('0xa9')][_0x37a5('0x8f')](),_0x37a5('0xa5'))[_0x37a5('0x85')](_0x463346[_0x37a5('0x51')]['id']['toString'](),'VoiceQueueId')[_0x37a5('0x85')]('NOW()',_0x37a5('0x5a'))[_0x37a5('0x85')]('NOW()','updatedAt')[_0x37a5('0x87')](_0x37a5('0xaa'))[_0x37a5('0x48')](_0x37a5('0xab'))[_0x37a5('0x48')]('ListId\x20=\x20?',_0x5e9946[_0x37a5('0xa9')][_0x37a5('0x8f')]())['where'](_0x37a5('0xac'))[_0x37a5('0x48')](_0x37a5('0xad'),squel[_0x37a5('0xa6')]()[_0x37a5('0x85')]('COALESCE(calleridnum,\x27\x27)')[_0x37a5('0x87')](_0x37a5('0xae'))[_0x37a5('0x48')]('VoiceQueueId\x20=\x20?',_0x463346['params']['id'][_0x37a5('0x8f')]()))[_0x37a5('0x48')](_0x37a5('0xad'),squel[_0x37a5('0xa6')]()[_0x37a5('0x85')](_0x37a5('0xaf'))[_0x37a5('0x87')](_0x37a5('0xa1'))[_0x37a5('0x48')](_0x37a5('0x8c'),_0x463346[_0x37a5('0x51')]['id'][_0x37a5('0x8f')]())))['toString']();break;case _0x37a5('0xb0'):_0x21607d=squel[_0x37a5('0xa0')]()['into'](_0x37a5('0xa1'))[_0x37a5('0xa2')](['phone',_0x37a5('0xa4'),'ContactId',_0x37a5('0xa5'),_0x37a5('0x68'),_0x37a5('0x5a'),_0x37a5('0x5b')],squel[_0x37a5('0xa6')]()[_0x37a5('0x85')](_0x37a5('0xa3'),'phone')[_0x37a5('0x85')](_0x37a5('0xa7'),_0x37a5('0xa4'))['field']('id',_0x37a5('0xa8'))[_0x37a5('0x85')](_0x5e9946['CmListId']['toString'](),'ListId')['field'](_0x463346['params']['id'][_0x37a5('0x8f')](),'VoiceQueueId')[_0x37a5('0x85')](_0x37a5('0xa7'),_0x37a5('0x5a'))[_0x37a5('0x85')](_0x37a5('0xa7'),_0x37a5('0x5b'))[_0x37a5('0x87')](_0x37a5('0xaa'))[_0x37a5('0x48')]('deletedAt\x20IS\x20NULL')[_0x37a5('0x48')](_0x37a5('0xb1'),_0x5e9946[_0x37a5('0xa9')][_0x37a5('0x8f')]())[_0x37a5('0x48')]('phone\x20IS\x20NOT\x20NULL')[_0x37a5('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x37a5('0xa6')]()[_0x37a5('0x85')](_0x37a5('0xaf'))[_0x37a5('0x87')](_0x37a5('0xa1'))[_0x37a5('0x48')]('VoiceQueueId\x20=\x20?',_0x463346[_0x37a5('0x51')]['id'][_0x37a5('0x8f')]())))[_0x37a5('0x8f')]();break;default:_0x21607d=squel[_0x37a5('0xa0')]()['into'](_0x37a5('0xa1'))['fromQuery']([_0x37a5('0xa3'),'scheduledAt',_0x37a5('0xa8'),'ListId',_0x37a5('0x68'),_0x37a5('0x5a'),_0x37a5('0x5b')],squel[_0x37a5('0xa6')]()[_0x37a5('0x85')]('phone',_0x37a5('0xa3'))[_0x37a5('0x85')](_0x37a5('0xa7'),_0x37a5('0xa4'))['field']('id','ContactId')['field'](_0x5e9946[_0x37a5('0xa9')][_0x37a5('0x8f')](),'ListId')[_0x37a5('0x85')](_0x463346[_0x37a5('0x51')]['id'][_0x37a5('0x8f')](),_0x37a5('0x68'))['field'](_0x37a5('0xa7'),'createdAt')['field'](_0x37a5('0xa7'),_0x37a5('0x5b'))[_0x37a5('0x87')](_0x37a5('0xaa'))[_0x37a5('0x48')](_0x37a5('0xab'))[_0x37a5('0x48')](_0x37a5('0xb1'),_0x5e9946[_0x37a5('0xa9')][_0x37a5('0x8f')]())[_0x37a5('0x48')](_0x37a5('0xac')))[_0x37a5('0x8f')]();}_0x13627f['push'](db[_0x37a5('0x76')]['query'](_0x21607d));}return BPromise[_0x37a5('0x92')](_0x13627f);}})[_0x37a5('0x2b')](function(){return _0x3c004;})[_0x37a5('0x2b')](respondWithResult(_0x656902,null))[_0x37a5('0x53')](handleError(_0x656902,null));};exports[_0x37a5('0xb2')]=function(_0x3630dd,_0x2170ca,_0x42a8e2){return db[_0x37a5('0x3b')][_0x37a5('0x52')]({'where':{'id':_0x3630dd[_0x37a5('0x51')]['id']}})['then'](handleEntityNotFound(_0x2170ca,null))[_0x37a5('0x2b')](function(_0x360efb){if(_0x360efb){return _0x360efb[_0x37a5('0xb2')](_0x3630dd[_0x37a5('0x3d')]['ids']);}})['then'](function(_0x19abf1){if(_0x19abf1){return db['CmHopper'][_0x37a5('0x2a')]({'where':{'ListId':_0x3630dd[_0x37a5('0x3d')][_0x37a5('0x84')],'VoiceQueueId':_0x3630dd[_0x37a5('0x51')]['id']}})[_0x37a5('0x2b')](function(){return _0x19abf1;});}})[_0x37a5('0x2b')](respondWithStatusCode(_0x2170ca,null))['catch'](handleError(_0x2170ca,null));};exports['getBlackLists']=function(_0x3845af,_0x30cf0b,_0x326144){var _0x42246d={};var _0x17b459={};var _0x13cdcf;var _0x4ff493;return db[_0x37a5('0x3b')][_0x37a5('0x65')]({'where':{'id':_0x3845af[_0x37a5('0x51')]['id']}})[_0x37a5('0x2b')](handleEntityNotFound(_0x30cf0b,null))[_0x37a5('0x2b')](function(_0x19300d){if(_0x19300d){_0x13cdcf=_0x19300d;_0x17b459[_0x37a5('0x42')]=_[_0x37a5('0x3e')](db[_0x37a5('0x9c')][_0x37a5('0x3c')]);_0x17b459[_0x37a5('0x3d')]=_['keys'](_0x3845af[_0x37a5('0x3d')]);_0x17b459[_0x37a5('0x3f')]=_[_0x37a5('0x40')](_0x17b459[_0x37a5('0x42')],_0x17b459[_0x37a5('0x3d')]);_0x42246d[_0x37a5('0x41')]=_['intersection'](_0x17b459['model'],qs[_0x37a5('0x43')](_0x3845af[_0x37a5('0x3d')][_0x37a5('0x43')]));_0x42246d[_0x37a5('0x41')]=_0x42246d['attributes'][_0x37a5('0x44')]?_0x42246d[_0x37a5('0x41')]:_0x17b459[_0x37a5('0x42')];_0x42246d['order']=qs['sort'](_0x3845af[_0x37a5('0x3d')]['sort']);_0x42246d[_0x37a5('0x48')]=qs[_0x37a5('0x3f')](_[_0x37a5('0x47')](_0x3845af[_0x37a5('0x3d')],_0x17b459[_0x37a5('0x3f')]));if(_0x3845af[_0x37a5('0x3d')][_0x37a5('0x30')]){_0x42246d[_0x37a5('0x48')]=_[_0x37a5('0x49')](_0x42246d[_0x37a5('0x48')],{'$or':_['map'](_0x42246d['attributes'],function(_0x2886d5){var _0xc0d237={};_0xc0d237[_0x2886d5]={'$like':'%'+_0x3845af['query'][_0x37a5('0x30')]+'%'};return _0xc0d237;})});}_0x42246d=_[_0x37a5('0x49')]({},_0x42246d,_0x3845af[_0x37a5('0x4b')]);return _0x13cdcf[_0x37a5('0xb3')](_0x42246d);}})[_0x37a5('0x2b')](function(_0x36196f){if(_0x36196f){_0x4ff493=_0x36196f[_0x37a5('0x44')];if(!_0x3845af[_0x37a5('0x3d')][_0x37a5('0x45')](_0x37a5('0x62'))){_0x42246d[_0x37a5('0x25')]=qs[_0x37a5('0x25')](_0x3845af[_0x37a5('0x3d')][_0x37a5('0x25')]);_0x42246d['offset']=qs[_0x37a5('0x24')](_0x3845af[_0x37a5('0x3d')][_0x37a5('0x24')]);}return _0x13cdcf[_0x37a5('0xb3')](_0x42246d);}})[_0x37a5('0x2b')](function(_0x528c40){if(_0x528c40){return _0x528c40?{'count':_0x4ff493,'rows':_0x528c40}:null;}})[_0x37a5('0x2b')](respondWithResult(_0x30cf0b,null))[_0x37a5('0x53')](handleError(_0x30cf0b,null));};exports['addBlackLists']=function(_0x5c4d7b,_0x3624d9,_0x62c1d5){var _0xcd19bd,_0x585a6e;return db[_0x37a5('0x3b')][_0x37a5('0x52')]({'where':{'id':_0x5c4d7b[_0x37a5('0x51')]['id']}})[_0x37a5('0x2b')](handleEntityNotFound(_0x3624d9,null))['then'](function(_0x7455a6){if(_0x7455a6){_0x585a6e=_0x7455a6;return _0x7455a6[_0x37a5('0xb4')](_0x5c4d7b['body'][_0x37a5('0x84')],_[_0x37a5('0x59')](_0x5c4d7b['body'],[_0x37a5('0x84'),'id'])||{});}return null;})[_0x37a5('0x95')](function(_0x9d1241){var _0xd006e8;_0xcd19bd=_0x9d1241||[];var _0x15fcc7=[];if(_0x9d1241){for(var _0x31d136=0x0;_0x31d136<_0x9d1241['length'];_0x31d136+=0x1){var _0x45ba39=_0x9d1241[_0x31d136]['get']({'plain':!![]});_0xd006e8=squel['insert']()[_0x37a5('0xb5')](_0x37a5('0xb6'))[_0x37a5('0xa2')]([_0x37a5('0xa3'),'ContactId',_0x37a5('0xa5'),_0x37a5('0x68'),'createdAt',_0x37a5('0x5b')],squel['select']()['field'](_0x37a5('0xa3'),_0x37a5('0xa3'))[_0x37a5('0x85')]('id',_0x37a5('0xa8'))[_0x37a5('0x85')](_0x45ba39[_0x37a5('0xa9')]['toString'](),_0x37a5('0xa5'))['field'](_0x5c4d7b[_0x37a5('0x51')]['id'][_0x37a5('0x8f')](),_0x37a5('0x68'))[_0x37a5('0x85')](_0x37a5('0xa7'),'createdAt')[_0x37a5('0x85')](_0x37a5('0xa7'),_0x37a5('0x5b'))[_0x37a5('0x87')](_0x37a5('0xaa'))[_0x37a5('0x48')](_0x37a5('0xab'))[_0x37a5('0x48')](_0x37a5('0xb1'),_0x45ba39[_0x37a5('0xa9')]['toString']())[_0x37a5('0x48')](_0x37a5('0xac')))['toString']();_0x15fcc7[_0x37a5('0x8e')](db['sequelize'][_0x37a5('0x3d')](_0xd006e8));}return BPromise[_0x37a5('0x92')](_0x15fcc7);}})['then'](function(){return _0xcd19bd;})['then'](respondWithResult(_0x3624d9,null))[_0x37a5('0x53')](handleError(_0x3624d9,null));};exports[_0x37a5('0xb7')]=function(_0x514924,_0x22832d,_0x3e6b29){return db[_0x37a5('0x3b')][_0x37a5('0x52')]({'where':{'id':_0x514924[_0x37a5('0x51')]['id']}})[_0x37a5('0x2b')](handleEntityNotFound(_0x22832d,null))[_0x37a5('0x2b')](function(_0xe7fe63){if(_0xe7fe63){return _0xe7fe63[_0x37a5('0xb7')](_0x514924[_0x37a5('0x3d')][_0x37a5('0x84')]);}})[_0x37a5('0x2b')](function(_0x201295){if(_0x201295){return db[_0x37a5('0x6c')][_0x37a5('0x2a')]({'where':{'ListId':_0x514924[_0x37a5('0x3d')]['ids'],'VoiceQueueId':_0x514924[_0x37a5('0x51')]['id']}})[_0x37a5('0x2b')](function(){return _0x201295;});}})[_0x37a5('0x2b')](respondWithStatusCode(_0x22832d,null))[_0x37a5('0x53')](handleError(_0x22832d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 8041d31..180dc89 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 _0xf451=['hook','exports','events','VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x2671bc,_0x103d4b){var _0x1c5f76=function(_0x31f05f){while(--_0x31f05f){_0x2671bc['push'](_0x2671bc['shift']());}};_0x1c5f76(++_0x103d4b);}(_0xf451,0xf5));var _0x1f45=function(_0x2c2a6f,_0x25c37f){_0x2c2a6f=_0x2c2a6f-0x0;var _0x4cb127=_0xf451[_0x2c2a6f];return _0x4cb127;};'use strict';var EventEmitter=require(_0x1f45('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x1f45('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x1f45('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1f45('0x3'),'afterDestroy':_0x1f45('0x4')};function emitEvent(_0x31c6b8){return function(_0x4de5ef,_0x40b6d8,_0x24ce5a){VoiceQueueEvents[_0x1f45('0x5')](_0x31c6b8+':'+_0x4de5ef['id'],_0x4de5ef);VoiceQueueEvents['emit'](_0x31c6b8,_0x4de5ef);_0x24ce5a(null);};}for(var e in events){if(events[_0x1f45('0x6')](e)){var event=events[e];VoiceQueue[_0x1f45('0x7')](e,emitEvent(event));}}module[_0x1f45('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x293c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','VoiceQueue'];(function(_0x3684a1,_0xb154f8){var _0x53e818=function(_0x18eda0){while(--_0x18eda0){_0x3684a1['push'](_0x3684a1['shift']());}};_0x53e818(++_0xb154f8);}(_0x293c,0x11e));var _0xc293=function(_0x2204ef,_0x10b4eb){_0x2204ef=_0x2204ef-0x0;var _0x4ac9f2=_0x293c[_0x2204ef];return _0x4ac9f2;};'use strict';var EventEmitter=require(_0xc293('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xc293('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xc293('0x2')](0x0);var events={'afterCreate':_0xc293('0x3'),'afterUpdate':_0xc293('0x4'),'afterDestroy':_0xc293('0x5')};function emitEvent(_0x5bba20){return function(_0x1a198f,_0x8b238b,_0x800aa3){VoiceQueueEvents[_0xc293('0x6')](_0x5bba20+':'+_0x1a198f['id'],_0x1a198f);VoiceQueueEvents[_0xc293('0x6')](_0x5bba20,_0x1a198f);_0x800aa3(null);};}for(var e in events){if(events[_0xc293('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xc293('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 4de6af4..07a0ed4 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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x309000,_0x100543){var _0xb17fbb=function(_0x56649b){while(--_0x56649b){_0x309000['push'](_0x309000['shift']());}};_0xb17fbb(++_0x100543);}(_0x34e8,0x12c));var _0x834e=function(_0x118217,_0x5d2620){_0x118217=_0x118217-0x0;var _0x5ecd15=_0x34e8[_0x118217];return _0x5ecd15;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0xce06d0,_0xe944b9){var _0x360347=function(_0x565311){while(--_0x565311){_0xce06d0['push'](_0xce06d0['shift']());}};_0x360347(++_0xe944b9);}(_0x008c,0x188));var _0xc008=function(_0x5aaba8,_0x248b94){_0x5aaba8=_0x5aaba8-0x0;var _0x13f7e3=_0x008c[_0x5aaba8];return _0x13f7e3;};'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 diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index cd9d63d..7a28d84 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 _0x440b=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','find','info','ShowVoiceQueue'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0x440b,0x1a4));var _0xb440=function(_0x496997,_0x5a576c){_0x496997=_0x496997-0x0;var _0x3d16b2=_0x440b[_0x496997];return _0x3d16b2;};'use strict';var _=require(_0xb440('0x0'));var util=require(_0xb440('0x1'));var moment=require('moment');var BPromise=require(_0xb440('0x2'));var rs=require(_0xb440('0x3'));var fs=require('fs');var Redis=require(_0xb440('0x4'));var db=require(_0xb440('0x5'))['db'];var utils=require(_0xb440('0x6'));var logger=require(_0xb440('0x7'))(_0xb440('0x8'));var config=require('../../config/environment');var jayson=require(_0xb440('0x9'));var client=jayson[_0xb440('0xa')][_0xb440('0xb')]({'port':0x232a});config[_0xb440('0xc')]=_['defaults'](config[_0xb440('0xc')],{'host':_0xb440('0xd'),'port':0x18eb});var socket=require(_0xb440('0xe'))(new Redis(config[_0xb440('0xc')]));require(_0xb440('0xf'))[_0xb440('0x10')](socket);function respondWithRpcPromise(_0x29a16f,_0x307a10,_0x133716){return new BPromise(function(_0x1c559e,_0x2a6956){return client[_0xb440('0x11')](_0x29a16f,_0x133716)['then'](function(_0x5cd31f){logger['info'](_0xb440('0x12'),_0x307a10,_0xb440('0x13'));logger[_0xb440('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x307a10,_0xb440('0x13'),JSON[_0xb440('0x15')](_0x5cd31f));if(_0x5cd31f[_0xb440('0x16')]){if(_0x5cd31f['error'][_0xb440('0x17')]===0x1f4){logger[_0xb440('0x16')](_0xb440('0x12'),_0x307a10,_0x5cd31f[_0xb440('0x16')]['message']);return _0x2a6956(_0x5cd31f['error']['message']);}logger['error'](_0xb440('0x12'),_0x307a10,_0x5cd31f[_0xb440('0x16')][_0xb440('0x18')]);return _0x1c559e(_0x5cd31f[_0xb440('0x16')][_0xb440('0x18')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x307a10,_0xb440('0x13'));_0x1c559e(_0x5cd31f[_0xb440('0x19')]['message']);}})['catch'](function(_0xc4e8ae){logger[_0xb440('0x16')](_0xb440('0x12'),_0x307a10,_0xc4e8ae);_0x2a6956(_0xc4e8ae);});});}exports[_0xb440('0x1a')]=function(_0x1675fe){var _0x492314=this;return new Promise(function(_0x47a23f,_0x2a9f91){return db[_0xb440('0x1b')][_0xb440('0x1c')]({'raw':_0x1675fe[_0xb440('0x1d')]?_0x1675fe[_0xb440('0x1d')][_0xb440('0x1e')]===undefined?!![]:![]:!![],'where':_0x1675fe[_0xb440('0x1d')]?_0x1675fe['options'][_0xb440('0x1f')]||null:null,'attributes':_0x1675fe['options']?_0x1675fe['options'][_0xb440('0x20')]||null:null,'limit':_0x1675fe[_0xb440('0x1d')]?_0x1675fe['options'][_0xb440('0x21')]||null:null,'include':_0x1675fe['options']?_0x1675fe[_0xb440('0x1d')][_0xb440('0x22')]?_[_0xb440('0x23')](_0x1675fe['options']['include'],function(_0x51e9df){return{'model':db[_0x51e9df[_0xb440('0x24')]],'as':_0x51e9df['as'],'attributes':_0x51e9df[_0xb440('0x20')],'include':_0x51e9df['include']?_[_0xb440('0x23')](_0x51e9df[_0xb440('0x22')],function(_0x527c3d){return{'model':db[_0x527c3d[_0xb440('0x24')]],'as':_0x527c3d['as'],'attributes':_0x527c3d[_0xb440('0x20')],'include':_0x527c3d[_0xb440('0x22')]?_[_0xb440('0x23')](_0x527c3d[_0xb440('0x22')],function(_0x3ceba5){return{'model':db[_0x3ceba5[_0xb440('0x24')]],'as':_0x3ceba5['as'],'attributes':_0x3ceba5[_0xb440('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb440('0x25')](function(_0x21d77f){logger['info'](_0xb440('0x1a'),_0x1675fe);logger[_0xb440('0x14')](_0xb440('0x1a'),_0x1675fe,JSON['stringify'](_0x21d77f));_0x47a23f(_0x21d77f);})[_0xb440('0x26')](function(_0x2a5293){logger[_0xb440('0x16')](_0xb440('0x1a'),_0x2a5293[_0xb440('0x18')],_0x1675fe);_0x2a9f91(_0x492314[_0xb440('0x16')](0x1f4,_0x2a5293[_0xb440('0x18')]));});});};exports['ShowVoiceQueue']=function(_0x3bca24){var _0x1ce57c=this;return new Promise(function(_0x250d4d,_0x109752){return db[_0xb440('0x1b')][_0xb440('0x27')]({'raw':_0x3bca24[_0xb440('0x1d')]?_0x3bca24[_0xb440('0x1d')][_0xb440('0x1e')]===undefined?!![]:![]:!![],'where':_0x3bca24['options']?_0x3bca24[_0xb440('0x1d')][_0xb440('0x1f')]||null:null,'attributes':_0x3bca24[_0xb440('0x1d')]?_0x3bca24[_0xb440('0x1d')][_0xb440('0x20')]||null:null,'include':_0x3bca24['options']?_0x3bca24[_0xb440('0x1d')][_0xb440('0x22')]?_[_0xb440('0x23')](_0x3bca24[_0xb440('0x1d')][_0xb440('0x22')],function(_0x2f74b6){return{'model':db[_0x2f74b6[_0xb440('0x24')]],'as':_0x2f74b6['as'],'attributes':_0x2f74b6[_0xb440('0x20')],'include':_0x2f74b6['include']?_[_0xb440('0x23')](_0x2f74b6[_0xb440('0x22')],function(_0x121178){return{'model':db[_0x121178[_0xb440('0x24')]],'as':_0x121178['as'],'attributes':_0x121178[_0xb440('0x20')],'include':_0x121178['include']?_[_0xb440('0x23')](_0x121178['include'],function(_0x194bd1){return{'model':db[_0x194bd1[_0xb440('0x24')]],'as':_0x194bd1['as'],'attributes':_0x194bd1[_0xb440('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb440('0x25')](function(_0x5d3c02){logger[_0xb440('0x28')](_0xb440('0x29'),_0x3bca24);logger[_0xb440('0x14')](_0xb440('0x29'),_0x3bca24,JSON['stringify'](_0x5d3c02));_0x250d4d(_0x5d3c02);})[_0xb440('0x26')](function(_0x5e0592){logger[_0xb440('0x16')]('ShowVoiceQueue',_0x5e0592[_0xb440('0x18')],_0x3bca24);_0x109752(_0x1ce57c['error'](0x1f4,_0x5e0592[_0xb440('0x18')]));});});}; \ No newline at end of file +var _0x0b99=['include','model','GetVoiceQueue','debug','ShowVoiceQueue','find','util','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','VoiceQueue','findAll','options','raw','where','attributes','limit','map'];(function(_0x5678c1,_0x228fb4){var _0x5b6be2=function(_0x10691c){while(--_0x10691c){_0x5678c1['push'](_0x5678c1['shift']());}};_0x5b6be2(++_0x228fb4);}(_0x0b99,0xed));var _0x90b9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0b99[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x90b9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x90b9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90b9('0x2'));var logger=require(_0x90b9('0x3'))('rpc');var config=require(_0x90b9('0x4'));var jayson=require(_0x90b9('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x90b9('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x90b9('0x7'))(new Redis(config['redis']));require(_0x90b9('0x8'))[_0x90b9('0x9')](socket);function respondWithRpcPromise(_0x14b31d,_0x7bc4c1,_0x33b5d3){return new BPromise(function(_0xfbce99,_0x7a6ec2){return client[_0x90b9('0xa')](_0x14b31d,_0x33b5d3)[_0x90b9('0xb')](function(_0x51bd0a){logger[_0x90b9('0xc')](_0x90b9('0xd'),_0x7bc4c1,_0x90b9('0xe'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x7bc4c1,_0x90b9('0xe'),JSON[_0x90b9('0xf')](_0x51bd0a));if(_0x51bd0a['error']){if(_0x51bd0a[_0x90b9('0x10')]['code']===0x1f4){logger[_0x90b9('0x10')](_0x90b9('0xd'),_0x7bc4c1,_0x51bd0a[_0x90b9('0x10')]['message']);return _0x7a6ec2(_0x51bd0a[_0x90b9('0x10')][_0x90b9('0x11')]);}logger['error'](_0x90b9('0xd'),_0x7bc4c1,_0x51bd0a['error'][_0x90b9('0x11')]);return _0xfbce99(_0x51bd0a[_0x90b9('0x10')][_0x90b9('0x11')]);}else{logger['info'](_0x90b9('0xd'),_0x7bc4c1,'request\x20sent');_0xfbce99(_0x51bd0a['result'][_0x90b9('0x11')]);}})[_0x90b9('0x12')](function(_0x4f8ac8){logger[_0x90b9('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x7bc4c1,_0x4f8ac8);_0x7a6ec2(_0x4f8ac8);});});}exports['GetVoiceQueue']=function(_0x3f42f8){var _0x183b13=this;return new Promise(function(_0x2e978a,_0x23b48c){return db[_0x90b9('0x13')][_0x90b9('0x14')]({'raw':_0x3f42f8[_0x90b9('0x15')]?_0x3f42f8[_0x90b9('0x15')][_0x90b9('0x16')]===undefined?!![]:![]:!![],'where':_0x3f42f8[_0x90b9('0x15')]?_0x3f42f8[_0x90b9('0x15')][_0x90b9('0x17')]||null:null,'attributes':_0x3f42f8['options']?_0x3f42f8[_0x90b9('0x15')][_0x90b9('0x18')]||null:null,'limit':_0x3f42f8[_0x90b9('0x15')]?_0x3f42f8[_0x90b9('0x15')][_0x90b9('0x19')]||null:null,'include':_0x3f42f8[_0x90b9('0x15')]?_0x3f42f8[_0x90b9('0x15')]['include']?_[_0x90b9('0x1a')](_0x3f42f8[_0x90b9('0x15')][_0x90b9('0x1b')],function(_0x5cf03f){return{'model':db[_0x5cf03f[_0x90b9('0x1c')]],'as':_0x5cf03f['as'],'attributes':_0x5cf03f[_0x90b9('0x18')],'include':_0x5cf03f[_0x90b9('0x1b')]?_['map'](_0x5cf03f[_0x90b9('0x1b')],function(_0x3e1ca4){return{'model':db[_0x3e1ca4[_0x90b9('0x1c')]],'as':_0x3e1ca4['as'],'attributes':_0x3e1ca4[_0x90b9('0x18')],'include':_0x3e1ca4['include']?_[_0x90b9('0x1a')](_0x3e1ca4[_0x90b9('0x1b')],function(_0x1cb80e){return{'model':db[_0x1cb80e[_0x90b9('0x1c')]],'as':_0x1cb80e['as'],'attributes':_0x1cb80e[_0x90b9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x90b9('0xb')](function(_0x5ea22a){logger['info'](_0x90b9('0x1d'),_0x3f42f8);logger[_0x90b9('0x1e')](_0x90b9('0x1d'),_0x3f42f8,JSON[_0x90b9('0xf')](_0x5ea22a));_0x2e978a(_0x5ea22a);})['catch'](function(_0x30529d){logger[_0x90b9('0x10')](_0x90b9('0x1d'),_0x30529d['message'],_0x3f42f8);_0x23b48c(_0x183b13[_0x90b9('0x10')](0x1f4,_0x30529d[_0x90b9('0x11')]));});});};exports[_0x90b9('0x1f')]=function(_0x53ecaa){var _0x1e9c2c=this;return new Promise(function(_0x128076,_0x47f35e){return db['VoiceQueue'][_0x90b9('0x20')]({'raw':_0x53ecaa['options']?_0x53ecaa[_0x90b9('0x15')][_0x90b9('0x16')]===undefined?!![]:![]:!![],'where':_0x53ecaa[_0x90b9('0x15')]?_0x53ecaa['options'][_0x90b9('0x17')]||null:null,'attributes':_0x53ecaa[_0x90b9('0x15')]?_0x53ecaa['options'][_0x90b9('0x18')]||null:null,'include':_0x53ecaa[_0x90b9('0x15')]?_0x53ecaa[_0x90b9('0x15')]['include']?_['map'](_0x53ecaa[_0x90b9('0x15')][_0x90b9('0x1b')],function(_0x56eced){return{'model':db[_0x56eced['model']],'as':_0x56eced['as'],'attributes':_0x56eced[_0x90b9('0x18')],'include':_0x56eced[_0x90b9('0x1b')]?_['map'](_0x56eced[_0x90b9('0x1b')],function(_0x3c5074){return{'model':db[_0x3c5074[_0x90b9('0x1c')]],'as':_0x3c5074['as'],'attributes':_0x3c5074['attributes'],'include':_0x3c5074[_0x90b9('0x1b')]?_['map'](_0x3c5074[_0x90b9('0x1b')],function(_0x217b90){return{'model':db[_0x217b90[_0x90b9('0x1c')]],'as':_0x217b90['as'],'attributes':_0x217b90[_0x90b9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x90b9('0xb')](function(_0x380274){logger[_0x90b9('0xc')](_0x90b9('0x1f'),_0x53ecaa);logger['debug'](_0x90b9('0x1f'),_0x53ecaa,JSON[_0x90b9('0xf')](_0x380274));_0x128076(_0x380274);})[_0x90b9('0x12')](function(_0x382355){logger[_0x90b9('0x10')](_0x90b9('0x1f'),_0x382355[_0x90b9('0x11')],_0x53ecaa);_0x47f35e(_0x1e9c2c[_0x90b9('0x10')](0x1f4,_0x382355[_0x90b9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index f690cad..7528f55 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 _0xf088=['remove','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xf088,0x178));var _0x8f08=function(_0x2c6e10,_0x4470ca){_0x2c6e10=_0x2c6e10-0x0;var _0x5893a6=_0xf088[_0x2c6e10];return _0x5893a6;};'use strict';var VoiceQueueEvents=require(_0x8f08('0x0'));var events=[_0x8f08('0x1'),_0x8f08('0x2'),_0x8f08('0x3')];function createListener(_0x15fec9,_0x11b90b){return function(_0x38e7ad){_0x11b90b[_0x8f08('0x4')](_0x15fec9,_0x38e7ad);};}function removeListener(_0x3b8daa,_0x671b77){return function(){VoiceQueueEvents[_0x8f08('0x5')](_0x3b8daa,_0x671b77);};}exports[_0x8f08('0x6')]=function(_0x35baf2){for(var _0x27f19d=0x0,_0x3d6a2d=events[_0x8f08('0x7')];_0x27f19d<_0x3d6a2d;_0x27f19d++){var _0x39b711=events[_0x27f19d];var _0x1e556e=createListener(_0x8f08('0x8')+_0x39b711,_0x35baf2);VoiceQueueEvents['on'](_0x39b711,_0x1e556e);}}; \ No newline at end of file +var _0xcf52=['remove','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x4782eb,_0x1dafc9){var _0x9f1353=function(_0x1b74b4){while(--_0x1b74b4){_0x4782eb['push'](_0x4782eb['shift']());}};_0x9f1353(++_0x1dafc9);}(_0xcf52,0x1c7));var _0x2cf5=function(_0x51143a,_0x101e64){_0x51143a=_0x51143a-0x0;var _0x2d9dac=_0xcf52[_0x51143a];return _0x2d9dac;};'use strict';var VoiceQueueEvents=require(_0x2cf5('0x0'));var events=['save',_0x2cf5('0x1'),_0x2cf5('0x2')];function createListener(_0x3607a3,_0x4e463e){return function(_0x1032c8){_0x4e463e[_0x2cf5('0x3')](_0x3607a3,_0x1032c8);};}function removeListener(_0xcfbf88,_0x3b51b6){return function(){VoiceQueueEvents[_0x2cf5('0x4')](_0xcfbf88,_0x3b51b6);};}exports[_0x2cf5('0x5')]=function(_0xea446e){for(var _0x583e49=0x0,_0x112c29=events[_0x2cf5('0x6')];_0x583e49<_0x112c29;_0x583e49++){var _0x441bbc=events[_0x583e49];var _0x3b01b6=createListener(_0x2cf5('0x7')+_0x441bbc,_0xea446e);VoiceQueueEvents['on'](_0x441bbc,_0x3b01b6);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 7f5ca15..32de0c6 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 _0x9d98=['express','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','destroy','exports','multer','util','connect-timeout'];(function(_0x2541b0,_0x392c56){var _0x21375e=function(_0x49cb33){while(--_0x49cb33){_0x2541b0['push'](_0x2541b0['shift']());}};_0x21375e(++_0x392c56);}(_0x9d98,0x19f));var _0x89d9=function(_0x196cfb,_0x387cb3){_0x196cfb=_0x196cfb-0x0;var _0x3a14a8=_0x9d98[_0x196cfb];return _0x3a14a8;};'use strict';var multer=require(_0x89d9('0x0'));var util=require(_0x89d9('0x1'));var path=require('path');var timeout=require(_0x89d9('0x2'));var express=require(_0x89d9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x89d9('0x4'));var controller=require(_0x89d9('0x5'));router[_0x89d9('0x6')]('/',auth[_0x89d9('0x7')](),controller[_0x89d9('0x8')]);router[_0x89d9('0x6')](_0x89d9('0x9'),auth[_0x89d9('0x7')](),controller[_0x89d9('0xa')]);router[_0x89d9('0x6')](_0x89d9('0xb'),auth[_0x89d9('0x7')](),controller[_0x89d9('0xc')]);router['get'](_0x89d9('0xd'),auth[_0x89d9('0x7')](),controller[_0x89d9('0xe')]);router[_0x89d9('0xf')]('/',auth[_0x89d9('0x7')](),controller[_0x89d9('0x10')]);router['put']('/:id',auth[_0x89d9('0x7')](),controller['update']);router['delete'](_0x89d9('0xd'),auth[_0x89d9('0x7')](),controller[_0x89d9('0x11')]);module[_0x89d9('0x12')]=router; \ No newline at end of file +var _0x222c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','show','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2a1072,_0x4adcec){var _0x11c41a=function(_0x1e55c1){while(--_0x1e55c1){_0x2a1072['push'](_0x2a1072['shift']());}};_0x11c41a(++_0x4adcec);}(_0x222c,0xc2));var _0xc222=function(_0x4d7b8c,_0x5d3572){_0x4d7b8c=_0x4d7b8c-0x0;var _0x4a8e08=_0x222c[_0x4d7b8c];return _0x4a8e08;};'use strict';var multer=require(_0xc222('0x0'));var util=require(_0xc222('0x1'));var path=require(_0xc222('0x2'));var timeout=require(_0xc222('0x3'));var express=require(_0xc222('0x4'));var router=express[_0xc222('0x5')]();var fs_extra=require(_0xc222('0x6'));var auth=require(_0xc222('0x7'));var interaction=require(_0xc222('0x8'));var config=require(_0xc222('0x9'));var controller=require(_0xc222('0xa'));router[_0xc222('0xb')]('/',auth['isAuthenticated'](),controller[_0xc222('0xc')]);router['get'](_0xc222('0xd'),auth[_0xc222('0xe')](),controller[_0xc222('0xf')]);router[_0xc222('0xb')](_0xc222('0x10'),auth[_0xc222('0xe')](),controller[_0xc222('0x11')]);router[_0xc222('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xc222('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc222('0x13')]);router['put'](_0xc222('0x14'),auth[_0xc222('0xe')](),controller[_0xc222('0x15')]);router[_0xc222('0x16')](_0xc222('0x14'),auth['isAuthenticated'](),controller[_0xc222('0x17')]);module[_0xc222('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 089ead2..2ba6598 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 _0xc823=['sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x116240,_0x5949fc){var _0x1095a9=function(_0x3b4dc2){while(--_0x3b4dc2){_0x116240['push'](_0x116240['shift']());}};_0x1095a9(++_0x5949fc);}(_0xc823,0x96));var _0x3c82=function(_0x3dfc5d,_0x2beddf){_0x3dfc5d=_0x3dfc5d-0x0;var _0x309aa7=_0xc823[_0x3dfc5d];return _0x309aa7;};'use strict';var Sequelize=require(_0x3c82('0x0'));var moment=require('moment');module[_0x3c82('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3c82('0x2')]},'calleridnum':{'type':Sequelize[_0x3c82('0x2')]},'calleridname':{'type':Sequelize[_0x3c82('0x2')]},'queue':{'type':Sequelize[_0x3c82('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x3c82('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x3c82('0x3')],'set':function(_0x2fff32){var _0x2b5032=moment(_0x2fff32);var _0x11a403=moment(this[_0x3c82('0x4')](_0x3c82('0x5')))[_0x3c82('0x6')](_0x3c82('0x7'));var _0x37e310=_0x2b5032[_0x3c82('0x8')](_0x11a403,'seconds');this[_0x3c82('0x9')]('queuecallerleaveAt',_0x2fff32);this[_0x3c82('0x9')](_0x3c82('0xa'),_0x37e310||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x3c82('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3c82('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3c82('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x3c82('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3c82('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3c82('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x3c82('0x2')],'comment':_0x3c82('0xd')},'originalposition':{'type':Sequelize[_0x3c82('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x3c82('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3c82('0x2')]},'exten':{'type':Sequelize[_0x3c82('0x2')]},'priority':{'type':Sequelize[_0x3c82('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x3c82('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3c82('0x2')]},'transfer':{'type':Sequelize[_0x3c82('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3c82('0x2')],'comment':_0x3c82('0xe')},'transferexten':{'type':Sequelize[_0x3c82('0x2')]},'transferuniqueid':{'type':Sequelize[_0x3c82('0x2')]},'disposition':{'type':Sequelize[_0x3c82('0x2')]},'secondDisposition':{'type':Sequelize[_0x3c82('0x2')]},'thirdDisposition':{'type':Sequelize[_0x3c82('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x3c82('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb5ab=['sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x2fe74b,_0xded52){var _0x2c22c8=function(_0x2f1743){while(--_0x2f1743){_0x2fe74b['push'](_0x2fe74b['shift']());}};_0x2c22c8(++_0xded52);}(_0xb5ab,0x1c0));var _0xbb5a=function(_0x31d9b5,_0x3c6cde){_0x31d9b5=_0x31d9b5-0x0;var _0x334b1e=_0xb5ab[_0x31d9b5];return _0x334b1e;};'use strict';var Sequelize=require(_0xbb5a('0x0'));var moment=require(_0xbb5a('0x1'));module[_0xbb5a('0x2')]={'type':{'type':Sequelize[_0xbb5a('0x3')]},'uniqueid':{'type':Sequelize[_0xbb5a('0x3')]},'calleridnum':{'type':Sequelize[_0xbb5a('0x3')]},'calleridname':{'type':Sequelize[_0xbb5a('0x3')]},'queue':{'type':Sequelize[_0xbb5a('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xbb5a('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xbb5a('0x4')],'set':function(_0x5cdd81){var _0x108386=moment(_0x5cdd81);var _0x50c3f8=moment(this[_0xbb5a('0x5')](_0xbb5a('0x6')))[_0xbb5a('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2bcb4f=_0x108386[_0xbb5a('0x8')](_0x50c3f8,'seconds');this[_0xbb5a('0x9')](_0xbb5a('0xa'),_0x5cdd81);this[_0xbb5a('0x9')](_0xbb5a('0xb'),_0x2bcb4f||null);}},'position':{'type':Sequelize[_0xbb5a('0xc')]},'count':{'type':Sequelize[_0xbb5a('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xbb5a('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xbb5a('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xbb5a('0x4')]},'queuecallerexit':{'type':Sequelize[_0xbb5a('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xbb5a('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xbb5a('0xe')},'originalposition':{'type':Sequelize[_0xbb5a('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xbb5a('0x3')]},'connectedlinename':{'type':Sequelize[_0xbb5a('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xbb5a('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbb5a('0x3')]},'holdtime':{'type':Sequelize[_0xbb5a('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xbb5a('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xbb5a('0x3')]},'transfer':{'type':Sequelize[_0xbb5a('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbb5a('0x3')],'comment':_0xbb5a('0xf')},'transferexten':{'type':Sequelize[_0xbb5a('0x3')]},'transferuniqueid':{'type':Sequelize[_0xbb5a('0x3')]},'disposition':{'type':Sequelize[_0xbb5a('0x3')]},'secondDisposition':{'type':Sequelize[_0xbb5a('0x3')]},'thirdDisposition':{'type':Sequelize[_0xbb5a('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xbb5a('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 946e0ba..aa316ba 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 _0x5013=['../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','stack','name','send','index','VoiceQueueReport','rawAttributes','type','key','map','keys','filters','query','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','catch','create','body','find','describe','nolimit','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x41541b,_0x2d0afc){var _0x52adf3=function(_0x57ddcb){while(--_0x57ddcb){_0x41541b['push'](_0x41541b['shift']());}};_0x52adf3(++_0x2d0afc);}(_0x5013,0x187));var _0x3501=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x5013[_0x934425];return _0x31d596;};'use strict';var emlformat=require(_0x3501('0x0'));var rimraf=require(_0x3501('0x1'));var zipdir=require(_0x3501('0x2'));var jsonpatch=require(_0x3501('0x3'));var rp=require(_0x3501('0x4'));var moment=require(_0x3501('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3501('0x6'));var path=require('path');var sox=require(_0x3501('0x7'));var csv=require(_0x3501('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3501('0x9'));var _=require(_0x3501('0xa'));var squel=require(_0x3501('0xb'));var crypto=require(_0x3501('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3501('0xd'));var toCsv=require(_0x3501('0x8'));var querystring=require('querystring');var Papa=require(_0x3501('0xe'));var Redis=require(_0x3501('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3501('0x10'));var as=require(_0x3501('0x11'));var hardwareService=require(_0x3501('0x12'));var logger=require(_0x3501('0x13'))(_0x3501('0x14'));var utils=require(_0x3501('0x15'));var config=require(_0x3501('0x16'));var licenseUtil=require(_0x3501('0x17'));var db=require(_0x3501('0x18'))['db'];config['redis']=_[_0x3501('0x19')](config['redis'],{'host':_0x3501('0x1a'),'port':0x18eb});var socket=require(_0x3501('0x1b'))(new Redis(config[_0x3501('0x1c')]));require(_0x3501('0x1d'))[_0x3501('0x1e')](socket);function respondWithStatusCode(_0x2c6a6b,_0x4b9ce2){_0x4b9ce2=_0x4b9ce2||0xcc;return function(_0x3a9313){if(_0x3a9313){return _0x2c6a6b[_0x3501('0x1f')](_0x4b9ce2);}return _0x2c6a6b[_0x3501('0x20')](_0x4b9ce2)[_0x3501('0x21')]();};}function respondWithResult(_0x4c3499,_0x10dfc3){_0x10dfc3=_0x10dfc3||0xc8;return function(_0xc41c93){if(_0xc41c93){return _0x4c3499[_0x3501('0x20')](_0x10dfc3)[_0x3501('0x22')](_0xc41c93);}};}function respondWithFilteredResult(_0x2bfba3,_0x2413a2){return function(_0x2474f4){if(_0x2474f4){var _0xfcd837=typeof _0x2413a2[_0x3501('0x23')]===_0x3501('0x24')&&typeof _0x2413a2[_0x3501('0x25')]==='undefined';var _0x28a028=_0x2474f4[_0x3501('0x26')];var _0x3ade7b=_0xfcd837?0x0:_0x2413a2[_0x3501('0x23')];var _0x428a5c=_0xfcd837?_0x2474f4[_0x3501('0x26')]:_0x2413a2[_0x3501('0x23')]+_0x2413a2['limit'];var _0x52764e;if(_0x428a5c>=_0x28a028){_0x428a5c=_0x28a028;_0x52764e=0xc8;}else{_0x52764e=0xce;}_0x2bfba3[_0x3501('0x20')](_0x52764e);return _0x2bfba3['set']('Content-Range',_0x3ade7b+'-'+_0x428a5c+'/'+_0x28a028)['json'](_0x2474f4);}return null;};}function patchUpdates(_0x247abb){return function(_0x2a37d1){try{jsonpatch[_0x3501('0x27')](_0x2a37d1,_0x247abb,!![]);}catch(_0x598896){return BPromise[_0x3501('0x28')](_0x598896);}return _0x2a37d1['save']();};}function saveUpdates(_0x4169b4,_0x633d7){return function(_0x35ad60){if(_0x35ad60){return _0x35ad60[_0x3501('0x29')](_0x4169b4)[_0x3501('0x2a')](function(_0x496607){return _0x496607;});}return null;};}function removeEntity(_0x30fd1f,_0x32813f){return function(_0x36a59a){if(_0x36a59a){return _0x36a59a[_0x3501('0x2b')]()[_0x3501('0x2a')](function(){_0x30fd1f['status'](0xcc)[_0x3501('0x21')]();});}};}function handleEntityNotFound(_0x501299,_0x120672){return function(_0x54b61d){if(!_0x54b61d){_0x501299['sendStatus'](0x194);}return _0x54b61d;};}function handleError(_0x15d39d,_0x164f82){_0x164f82=_0x164f82||0x1f4;return function(_0x573a85){logger['error'](_0x573a85[_0x3501('0x2c')]);if(_0x573a85[_0x3501('0x2d')]){delete _0x573a85[_0x3501('0x2d')];}_0x15d39d[_0x3501('0x20')](_0x164f82)[_0x3501('0x2e')](_0x573a85);};}exports[_0x3501('0x2f')]=function(_0x44a34f,_0x26cc99){var _0x2928db={},_0x2d3922={},_0xf27e95={'count':0x0,'rows':[]};var _0x3b5e7f=_['map'](db[_0x3501('0x30')][_0x3501('0x31')],function(_0x3f655c){return{'name':_0x3f655c['fieldName'],'type':_0x3f655c[_0x3501('0x32')][_0x3501('0x33')]};});_0x2d3922['model']=_[_0x3501('0x34')](_0x3b5e7f,'name');_0x2d3922['query']=_[_0x3501('0x35')](_0x44a34f['query']);_0x2d3922[_0x3501('0x36')]=_['intersection'](_0x2d3922['model'],_0x2d3922[_0x3501('0x37')]);_0x2928db[_0x3501('0x38')]=_[_0x3501('0x39')](_0x2d3922[_0x3501('0x3a')],qs['fields'](_0x44a34f['query'][_0x3501('0x3b')]));_0x2928db[_0x3501('0x38')]=_0x2928db['attributes'][_0x3501('0x3c')]?_0x2928db[_0x3501('0x38')]:_0x2d3922[_0x3501('0x3a')];if(!_0x44a34f[_0x3501('0x37')][_0x3501('0x3d')]('nolimit')){_0x2928db['limit']=qs[_0x3501('0x25')](_0x44a34f[_0x3501('0x37')][_0x3501('0x25')]);_0x2928db[_0x3501('0x23')]=qs[_0x3501('0x23')](_0x44a34f['query'][_0x3501('0x23')]);}_0x2928db[_0x3501('0x3e')]=qs[_0x3501('0x3f')](_0x44a34f['query']['sort']);_0x2928db[_0x3501('0x40')]=qs[_0x3501('0x36')](_[_0x3501('0x41')](_0x44a34f[_0x3501('0x37')],_0x2d3922[_0x3501('0x36')]),_0x3b5e7f);if(_0x44a34f[_0x3501('0x37')][_0x3501('0x42')]){_0x2928db['where']=_[_0x3501('0x43')](_0x2928db[_0x3501('0x40')],{'$or':_['map'](_0x3b5e7f,function(_0x41a775){if(_0x41a775[_0x3501('0x32')]!==_0x3501('0x44')){var _0x3f7807={};_0x3f7807[_0x41a775['name']]={'$like':'%'+_0x44a34f['query'][_0x3501('0x42')]+'%'};return _0x3f7807;}})});}_0x2928db=_[_0x3501('0x43')]({},_0x2928db,_0x44a34f[_0x3501('0x45')]);var _0x3304b6={'where':_0x2928db[_0x3501('0x40')]};return db[_0x3501('0x30')][_0x3501('0x26')](_0x3304b6)[_0x3501('0x2a')](function(_0x3e3d7a){_0xf27e95['count']=_0x3e3d7a;if(_0x44a34f[_0x3501('0x37')]['includeAll']){_0x2928db[_0x3501('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x3501('0x47')](_0x2928db);})[_0x3501('0x2a')](function(_0x22ef88){_0xf27e95[_0x3501('0x48')]=_0x22ef88;return _0xf27e95;})['then'](respondWithFilteredResult(_0x26cc99,_0x2928db))['catch'](handleError(_0x26cc99,null));};exports[_0x3501('0x49')]=function(_0x5580f4,_0x1b3aaa){var _0x381abe={'raw':![],'where':{'id':_0x5580f4[_0x3501('0x4a')]['id']}},_0x27a158={};_0x27a158[_0x3501('0x3a')]=_[_0x3501('0x35')](db[_0x3501('0x30')][_0x3501('0x31')]);_0x27a158[_0x3501('0x37')]=_['keys'](_0x5580f4[_0x3501('0x37')]);_0x27a158['filters']=_[_0x3501('0x39')](_0x27a158[_0x3501('0x3a')],_0x27a158[_0x3501('0x37')]);_0x381abe[_0x3501('0x38')]=_[_0x3501('0x39')](_0x27a158[_0x3501('0x3a')],qs[_0x3501('0x3b')](_0x5580f4['query'][_0x3501('0x3b')]));_0x381abe[_0x3501('0x38')]=_0x381abe[_0x3501('0x38')][_0x3501('0x3c')]?_0x381abe['attributes']:_0x27a158[_0x3501('0x3a')];if(_0x5580f4[_0x3501('0x37')][_0x3501('0x4b')]){_0x381abe['include']=[{'all':!![]}];}_0x381abe=_[_0x3501('0x43')]({},_0x381abe,_0x5580f4[_0x3501('0x45')]);return db[_0x3501('0x30')]['find'](_0x381abe)[_0x3501('0x2a')](handleEntityNotFound(_0x1b3aaa,null))[_0x3501('0x2a')](respondWithResult(_0x1b3aaa,null))[_0x3501('0x4c')](handleError(_0x1b3aaa,null));};exports['create']=function(_0x424ce9,_0x26cda8){return db[_0x3501('0x30')][_0x3501('0x4d')](_0x424ce9['body'],{})[_0x3501('0x2a')](respondWithResult(_0x26cda8,0xc9))[_0x3501('0x4c')](handleError(_0x26cda8,null));};exports[_0x3501('0x29')]=function(_0x3b008a,_0x3d1ccd){if(_0x3b008a[_0x3501('0x4e')]['id']){delete _0x3b008a[_0x3501('0x4e')]['id'];}return db['VoiceQueueReport'][_0x3501('0x4f')]({'where':{'id':_0x3b008a[_0x3501('0x4a')]['id']}})[_0x3501('0x2a')](handleEntityNotFound(_0x3d1ccd,null))[_0x3501('0x2a')](saveUpdates(_0x3b008a[_0x3501('0x4e')],null))['then'](respondWithResult(_0x3d1ccd,null))[_0x3501('0x4c')](handleError(_0x3d1ccd,null));};exports[_0x3501('0x2b')]=function(_0x9f22a2,_0x392f2b){return db[_0x3501('0x30')]['find']({'where':{'id':_0x9f22a2['params']['id']}})[_0x3501('0x2a')](handleEntityNotFound(_0x392f2b,null))[_0x3501('0x2a')](removeEntity(_0x392f2b,null))[_0x3501('0x4c')](handleError(_0x392f2b,null));};exports[_0x3501('0x50')]=function(_0x4d9deb,_0x5cbdc3){return db[_0x3501('0x30')][_0x3501('0x50')]()['then'](respondWithResult(_0x5cbdc3,null))[_0x3501('0x4c')](handleError(_0x5cbdc3,null));};exports['getVoiceQueuesReport']=function(_0x2e91c3,_0x3ef6f6){var _0x56e8c1={},_0x3e1bd8={},_0x235f97={'count':0x0,'rows':[]};_0x3e1bd8[_0x3501('0x3a')]=_[_0x3501('0x35')](db['VoiceQueueReport'][_0x3501('0x31')]);_0x3e1bd8[_0x3501('0x37')]=_['keys'](_0x2e91c3[_0x3501('0x37')]);_0x3e1bd8[_0x3501('0x36')]=_[_0x3501('0x39')](_0x3e1bd8[_0x3501('0x3a')],_0x3e1bd8[_0x3501('0x37')]);_0x56e8c1[_0x3501('0x38')]=_['intersection'](_0x3e1bd8[_0x3501('0x3a')],qs['fields'](_0x2e91c3['query'][_0x3501('0x3b')]));_0x56e8c1['attributes']=_0x56e8c1[_0x3501('0x38')][_0x3501('0x3c')]?_0x56e8c1[_0x3501('0x38')]:_0x3e1bd8[_0x3501('0x3a')];if(!_0x2e91c3[_0x3501('0x37')]['hasOwnProperty'](_0x3501('0x51'))){_0x56e8c1['limit']=qs['limit'](_0x2e91c3[_0x3501('0x37')][_0x3501('0x25')]);_0x56e8c1[_0x3501('0x23')]=qs[_0x3501('0x23')](_0x2e91c3[_0x3501('0x37')][_0x3501('0x23')]);}_0x56e8c1[_0x3501('0x3e')]=qs[_0x3501('0x3f')](_0x2e91c3['query'][_0x3501('0x3f')]);_0x56e8c1[_0x3501('0x40')]=qs[_0x3501('0x36')](_[_0x3501('0x41')](_0x2e91c3[_0x3501('0x37')],_0x3e1bd8[_0x3501('0x36')]));if(_0x2e91c3[_0x3501('0x37')]['filter']){_0x56e8c1[_0x3501('0x40')]=_[_0x3501('0x43')](_0x56e8c1[_0x3501('0x40')],{'$or':_['map'](_0x56e8c1[_0x3501('0x38')],function(_0x22afc3){var _0x5af5e2={};_0x5af5e2[_0x22afc3]={'$like':'%'+_0x2e91c3[_0x3501('0x37')][_0x3501('0x42')]+'%'};return _0x5af5e2;})});}_0x56e8c1=_[_0x3501('0x43')]({},_0x56e8c1,_0x2e91c3[_0x3501('0x45')]);var _0x2b9e07={'where':_0x56e8c1[_0x3501('0x40')]};return db[_0x3501('0x30')][_0x3501('0x26')](_0x2b9e07)[_0x3501('0x2a')](function(_0x4921d3){_0x235f97[_0x3501('0x26')]=_0x4921d3;if(_0x2e91c3[_0x3501('0x37')][_0x3501('0x4b')]){_0x56e8c1[_0x3501('0x46')]=[{'all':!![]}];}return db[_0x3501('0x30')][_0x3501('0x47')](_0x56e8c1);})[_0x3501('0x2a')](function(_0x5e6854){_0x235f97[_0x3501('0x48')]=_0x5e6854;return _0x235f97;})[_0x3501('0x2a')](respondWithFilteredResult(_0x3ef6f6,_0x56e8c1,'getVoiceQueuesReport'))[_0x3501('0x4c')](handleError(_0x3ef6f6,null,_0x3501('0x52')));}; \ No newline at end of file +var _0xddfc=['name','send','index','map','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VoiceQueueReport','includeAll','findAll','rows','catch','show','rawAttributes','include','options','find','create','update','body','params','describe','getVoiceQueuesReport','hasOwnProperty','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','./voiceQueueReport.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','error','stack'];(function(_0x421a43,_0x94ea52){var _0x5d67a4=function(_0x5e47a7){while(--_0x5e47a7){_0x421a43['push'](_0x421a43['shift']());}};_0x5d67a4(++_0x94ea52);}(_0xddfc,0x120));var _0xcddf=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xddfc[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcddf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcddf('0x1'));var rp=require(_0xcddf('0x2'));var moment=require(_0xcddf('0x3'));var BPromise=require(_0xcddf('0x4'));var Mustache=require(_0xcddf('0x5'));var util=require(_0xcddf('0x6'));var path=require(_0xcddf('0x7'));var sox=require(_0xcddf('0x8'));var csv=require('to-csv');var ejs=require(_0xcddf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcddf('0xa'));var squel=require(_0xcddf('0xb'));var crypto=require(_0xcddf('0xc'));var jsforce=require(_0xcddf('0xd'));var deskjs=require(_0xcddf('0xe'));var toCsv=require(_0xcddf('0xf'));var querystring=require(_0xcddf('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcddf('0x11'));var qs=require(_0xcddf('0x12'));var as=require(_0xcddf('0x13'));var hardwareService=require(_0xcddf('0x14'));var logger=require(_0xcddf('0x15'))(_0xcddf('0x16'));var utils=require(_0xcddf('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcddf('0x18'));var db=require(_0xcddf('0x19'))['db'];config[_0xcddf('0x1a')]=_['defaults'](config[_0xcddf('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcddf('0x1a')]));require(_0xcddf('0x1b'))['register'](socket);function respondWithStatusCode(_0x2aeead,_0x13ec89){_0x13ec89=_0x13ec89||0xcc;return function(_0x58bede){if(_0x58bede){return _0x2aeead[_0xcddf('0x1c')](_0x13ec89);}return _0x2aeead[_0xcddf('0x1d')](_0x13ec89)[_0xcddf('0x1e')]();};}function respondWithResult(_0x1f6455,_0x1dfe11){_0x1dfe11=_0x1dfe11||0xc8;return function(_0x53a56f){if(_0x53a56f){return _0x1f6455[_0xcddf('0x1d')](_0x1dfe11)[_0xcddf('0x1f')](_0x53a56f);}};}function respondWithFilteredResult(_0x46dc0d,_0x31eab8){return function(_0x2da9f0){if(_0x2da9f0){var _0x405d54=typeof _0x31eab8['offset']===_0xcddf('0x20')&&typeof _0x31eab8[_0xcddf('0x21')]===_0xcddf('0x20');var _0x107a23=_0x2da9f0[_0xcddf('0x22')];var _0x2d6194=_0x405d54?0x0:_0x31eab8[_0xcddf('0x23')];var _0x3ad949=_0x405d54?_0x2da9f0['count']:_0x31eab8[_0xcddf('0x23')]+_0x31eab8[_0xcddf('0x21')];var _0x28d2ea;if(_0x3ad949>=_0x107a23){_0x3ad949=_0x107a23;_0x28d2ea=0xc8;}else{_0x28d2ea=0xce;}_0x46dc0d[_0xcddf('0x1d')](_0x28d2ea);return _0x46dc0d[_0xcddf('0x24')](_0xcddf('0x25'),_0x2d6194+'-'+_0x3ad949+'/'+_0x107a23)[_0xcddf('0x1f')](_0x2da9f0);}return null;};}function patchUpdates(_0x34b044){return function(_0x33ef20){try{jsonpatch[_0xcddf('0x26')](_0x33ef20,_0x34b044,!![]);}catch(_0x5e0164){return BPromise[_0xcddf('0x27')](_0x5e0164);}return _0x33ef20['save']();};}function saveUpdates(_0x5ef0f4,_0x11b8b3){return function(_0x52a9bc){if(_0x52a9bc){return _0x52a9bc['update'](_0x5ef0f4)[_0xcddf('0x28')](function(_0x12c72d){return _0x12c72d;});}return null;};}function removeEntity(_0x5465f6,_0x51f29a){return function(_0x20d57c){if(_0x20d57c){return _0x20d57c[_0xcddf('0x29')]()['then'](function(){_0x5465f6[_0xcddf('0x1d')](0xcc)[_0xcddf('0x1e')]();});}};}function handleEntityNotFound(_0x52b27e,_0x5db147){return function(_0x407e96){if(!_0x407e96){_0x52b27e[_0xcddf('0x1c')](0x194);}return _0x407e96;};}function handleError(_0x3e25f7,_0x56cb94){_0x56cb94=_0x56cb94||0x1f4;return function(_0x322d00){logger[_0xcddf('0x2a')](_0x322d00[_0xcddf('0x2b')]);if(_0x322d00[_0xcddf('0x2c')]){delete _0x322d00[_0xcddf('0x2c')];}_0x3e25f7[_0xcddf('0x1d')](_0x56cb94)[_0xcddf('0x2d')](_0x322d00);};}exports[_0xcddf('0x2e')]=function(_0x51ff96,_0x1b0097){var _0x5630db={},_0x3e94fa={},_0x36e745={'count':0x0,'rows':[]};var _0x590f1a=_[_0xcddf('0x2f')](db['VoiceQueueReport']['rawAttributes'],function(_0x86f6a6){return{'name':_0x86f6a6[_0xcddf('0x30')],'type':_0x86f6a6['type'][_0xcddf('0x31')]};});_0x3e94fa[_0xcddf('0x32')]=_[_0xcddf('0x2f')](_0x590f1a,'name');_0x3e94fa[_0xcddf('0x33')]=_[_0xcddf('0x34')](_0x51ff96[_0xcddf('0x33')]);_0x3e94fa['filters']=_['intersection'](_0x3e94fa[_0xcddf('0x32')],_0x3e94fa[_0xcddf('0x33')]);_0x5630db[_0xcddf('0x35')]=_[_0xcddf('0x36')](_0x3e94fa[_0xcddf('0x32')],qs[_0xcddf('0x37')](_0x51ff96[_0xcddf('0x33')][_0xcddf('0x37')]));_0x5630db[_0xcddf('0x35')]=_0x5630db[_0xcddf('0x35')][_0xcddf('0x38')]?_0x5630db[_0xcddf('0x35')]:_0x3e94fa[_0xcddf('0x32')];if(!_0x51ff96[_0xcddf('0x33')]['hasOwnProperty'](_0xcddf('0x39'))){_0x5630db[_0xcddf('0x21')]=qs['limit'](_0x51ff96['query']['limit']);_0x5630db[_0xcddf('0x23')]=qs[_0xcddf('0x23')](_0x51ff96[_0xcddf('0x33')][_0xcddf('0x23')]);}_0x5630db[_0xcddf('0x3a')]=qs[_0xcddf('0x3b')](_0x51ff96[_0xcddf('0x33')]['sort']);_0x5630db[_0xcddf('0x3c')]=qs[_0xcddf('0x3d')](_[_0xcddf('0x3e')](_0x51ff96[_0xcddf('0x33')],_0x3e94fa[_0xcddf('0x3d')]),_0x590f1a);if(_0x51ff96[_0xcddf('0x33')][_0xcddf('0x3f')]){_0x5630db[_0xcddf('0x3c')]=_[_0xcddf('0x40')](_0x5630db[_0xcddf('0x3c')],{'$or':_[_0xcddf('0x2f')](_0x590f1a,function(_0x2863cc){if(_0x2863cc[_0xcddf('0x41')]!=='VIRTUAL'){var _0x3e6c8c={};_0x3e6c8c[_0x2863cc[_0xcddf('0x2c')]]={'$like':'%'+_0x51ff96[_0xcddf('0x33')][_0xcddf('0x3f')]+'%'};return _0x3e6c8c;}})});}_0x5630db=_['merge']({},_0x5630db,_0x51ff96['options']);var _0x287594={'where':_0x5630db[_0xcddf('0x3c')]};return db[_0xcddf('0x42')][_0xcddf('0x22')](_0x287594)['then'](function(_0x25ad21){_0x36e745[_0xcddf('0x22')]=_0x25ad21;if(_0x51ff96[_0xcddf('0x33')][_0xcddf('0x43')]){_0x5630db['include']=[{'all':!![]}];}return db[_0xcddf('0x42')][_0xcddf('0x44')](_0x5630db);})['then'](function(_0xc6d13c){_0x36e745[_0xcddf('0x45')]=_0xc6d13c;return _0x36e745;})['then'](respondWithFilteredResult(_0x1b0097,_0x5630db))[_0xcddf('0x46')](handleError(_0x1b0097,null));};exports[_0xcddf('0x47')]=function(_0x50b402,_0x5cbdd2){var _0x28d4eb={'raw':![],'where':{'id':_0x50b402['params']['id']}},_0xa96f3c={};_0xa96f3c[_0xcddf('0x32')]=_[_0xcddf('0x34')](db['VoiceQueueReport'][_0xcddf('0x48')]);_0xa96f3c[_0xcddf('0x33')]=_[_0xcddf('0x34')](_0x50b402[_0xcddf('0x33')]);_0xa96f3c[_0xcddf('0x3d')]=_[_0xcddf('0x36')](_0xa96f3c['model'],_0xa96f3c[_0xcddf('0x33')]);_0x28d4eb[_0xcddf('0x35')]=_['intersection'](_0xa96f3c[_0xcddf('0x32')],qs['fields'](_0x50b402['query'][_0xcddf('0x37')]));_0x28d4eb[_0xcddf('0x35')]=_0x28d4eb[_0xcddf('0x35')][_0xcddf('0x38')]?_0x28d4eb[_0xcddf('0x35')]:_0xa96f3c['model'];if(_0x50b402[_0xcddf('0x33')]['includeAll']){_0x28d4eb[_0xcddf('0x49')]=[{'all':!![]}];}_0x28d4eb=_[_0xcddf('0x40')]({},_0x28d4eb,_0x50b402[_0xcddf('0x4a')]);return db[_0xcddf('0x42')][_0xcddf('0x4b')](_0x28d4eb)[_0xcddf('0x28')](handleEntityNotFound(_0x5cbdd2,null))[_0xcddf('0x28')](respondWithResult(_0x5cbdd2,null))[_0xcddf('0x46')](handleError(_0x5cbdd2,null));};exports[_0xcddf('0x4c')]=function(_0x5c8b34,_0x4ad97e){return db[_0xcddf('0x42')]['create'](_0x5c8b34['body'],{})[_0xcddf('0x28')](respondWithResult(_0x4ad97e,0xc9))[_0xcddf('0x46')](handleError(_0x4ad97e,null));};exports[_0xcddf('0x4d')]=function(_0x1965ae,_0xb7edc2){if(_0x1965ae[_0xcddf('0x4e')]['id']){delete _0x1965ae[_0xcddf('0x4e')]['id'];}return db[_0xcddf('0x42')]['find']({'where':{'id':_0x1965ae[_0xcddf('0x4f')]['id']}})[_0xcddf('0x28')](handleEntityNotFound(_0xb7edc2,null))[_0xcddf('0x28')](saveUpdates(_0x1965ae[_0xcddf('0x4e')],null))['then'](respondWithResult(_0xb7edc2,null))[_0xcddf('0x46')](handleError(_0xb7edc2,null));};exports[_0xcddf('0x29')]=function(_0x1c7d76,_0xddb83d){return db['VoiceQueueReport'][_0xcddf('0x4b')]({'where':{'id':_0x1c7d76['params']['id']}})[_0xcddf('0x28')](handleEntityNotFound(_0xddb83d,null))[_0xcddf('0x28')](removeEntity(_0xddb83d,null))[_0xcddf('0x46')](handleError(_0xddb83d,null));};exports['describe']=function(_0x24af13,_0x2eb0a7){return db[_0xcddf('0x42')][_0xcddf('0x50')]()[_0xcddf('0x28')](respondWithResult(_0x2eb0a7,null))[_0xcddf('0x46')](handleError(_0x2eb0a7,null));};exports[_0xcddf('0x51')]=function(_0x553d07,_0x2a28ee){var _0xe7ae41={},_0x30358b={},_0x1728bb={'count':0x0,'rows':[]};_0x30358b[_0xcddf('0x32')]=_[_0xcddf('0x34')](db[_0xcddf('0x42')][_0xcddf('0x48')]);_0x30358b['query']=_[_0xcddf('0x34')](_0x553d07[_0xcddf('0x33')]);_0x30358b['filters']=_[_0xcddf('0x36')](_0x30358b[_0xcddf('0x32')],_0x30358b[_0xcddf('0x33')]);_0xe7ae41[_0xcddf('0x35')]=_['intersection'](_0x30358b[_0xcddf('0x32')],qs[_0xcddf('0x37')](_0x553d07[_0xcddf('0x33')][_0xcddf('0x37')]));_0xe7ae41['attributes']=_0xe7ae41[_0xcddf('0x35')][_0xcddf('0x38')]?_0xe7ae41[_0xcddf('0x35')]:_0x30358b['model'];if(!_0x553d07[_0xcddf('0x33')][_0xcddf('0x52')](_0xcddf('0x39'))){_0xe7ae41[_0xcddf('0x21')]=qs['limit'](_0x553d07[_0xcddf('0x33')][_0xcddf('0x21')]);_0xe7ae41['offset']=qs['offset'](_0x553d07[_0xcddf('0x33')][_0xcddf('0x23')]);}_0xe7ae41[_0xcddf('0x3a')]=qs['sort'](_0x553d07[_0xcddf('0x33')][_0xcddf('0x3b')]);_0xe7ae41['where']=qs['filters'](_['pick'](_0x553d07[_0xcddf('0x33')],_0x30358b['filters']));if(_0x553d07[_0xcddf('0x33')]['filter']){_0xe7ae41[_0xcddf('0x3c')]=_[_0xcddf('0x40')](_0xe7ae41['where'],{'$or':_[_0xcddf('0x2f')](_0xe7ae41[_0xcddf('0x35')],function(_0x25e12d){var _0x342d98={};_0x342d98[_0x25e12d]={'$like':'%'+_0x553d07[_0xcddf('0x33')][_0xcddf('0x3f')]+'%'};return _0x342d98;})});}_0xe7ae41=_[_0xcddf('0x40')]({},_0xe7ae41,_0x553d07[_0xcddf('0x4a')]);var _0x29297b={'where':_0xe7ae41['where']};return db[_0xcddf('0x42')][_0xcddf('0x22')](_0x29297b)['then'](function(_0x474ba3){_0x1728bb[_0xcddf('0x22')]=_0x474ba3;if(_0x553d07[_0xcddf('0x33')][_0xcddf('0x43')]){_0xe7ae41['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xcddf('0x44')](_0xe7ae41);})[_0xcddf('0x28')](function(_0x23f7ee){_0x1728bb['rows']=_0x23f7ee;return _0x1728bb;})[_0xcddf('0x28')](respondWithFilteredResult(_0x2a28ee,_0xe7ae41,_0xcddf('0x51')))[_0xcddf('0x46')](handleError(_0x2a28ee,null,_0xcddf('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 67818f9..06aa99f 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 _0x641d=['emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','update'];(function(_0x4306f0,_0x557642){var _0x2b1ca5=function(_0x465d62){while(--_0x465d62){_0x4306f0['push'](_0x4306f0['shift']());}};_0x2b1ca5(++_0x557642);}(_0x641d,0x134));var _0xd641=function(_0x28c9f2,_0x19cab5){_0x28c9f2=_0x28c9f2-0x0;var _0x2333d1=_0x641d[_0x28c9f2];return _0x2333d1;};'use strict';var EventEmitter=require(_0xd641('0x0'));var VoiceQueueReport=require(_0xd641('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd641('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd641('0x3'),'afterDestroy':'remove'};function emitEvent(_0x515e7f){return function(_0x3b289a,_0x68058c,_0x4cac4a){VoiceQueueReportEvents['emit'](_0x515e7f+':'+_0x3b289a['id'],_0x3b289a);VoiceQueueReportEvents[_0xd641('0x4')](_0x515e7f,_0x3b289a);_0x4cac4a(null);};}for(var e in events){if(events[_0xd641('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x01a4=['emit','hasOwnProperty','hook','exports','events','VoiceQueueReport','save','update','remove'];(function(_0x16b334,_0x58bd7f){var _0x54aff2=function(_0x366b0e){while(--_0x366b0e){_0x16b334['push'](_0x16b334['shift']());}};_0x54aff2(++_0x58bd7f);}(_0x01a4,0x124));var _0x401a=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0x01a4[_0x52b7b9];return _0x5b5d30;};'use strict';var EventEmitter=require(_0x401a('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x401a('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x401a('0x2'),'afterUpdate':_0x401a('0x3'),'afterDestroy':_0x401a('0x4')};function emitEvent(_0xba6323){return function(_0x25df5c,_0x172eb0,_0x38abe1){VoiceQueueReportEvents['emit'](_0xba6323+':'+_0x25df5c['id'],_0x25df5c);VoiceQueueReportEvents[_0x401a('0x5')](_0xba6323,_0x25df5c);_0x38abe1(null);};}for(var e in events){if(events[_0x401a('0x6')](e)){var event=events[e];VoiceQueueReport[_0x401a('0x7')](e,emitEvent(event));}}module[_0x401a('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 10ebea4..e303be2 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 _0x276b=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x408c89,_0x1c953f){var _0x4de3a0=function(_0x51fd35){while(--_0x51fd35){_0x408c89['push'](_0x408c89['shift']());}};_0x4de3a0(++_0x1c953f);}(_0x276b,0x106));var _0xb276=function(_0x2a09f6,_0x2b6035){_0x2a09f6=_0x2a09f6-0x0;var _0x13b70d=_0x276b[_0x2a09f6];return _0x13b70d;};'use strict';var _=require(_0xb276('0x0'));var util=require(_0xb276('0x1'));var logger=require(_0xb276('0x2'))(_0xb276('0x3'));var moment=require(_0xb276('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb276('0x5'));var rimraf=require(_0xb276('0x6'));var config=require(_0xb276('0x7'));var attributes=require(_0xb276('0x8'));module[_0xb276('0x9')]=function(_0x338f11,_0x387b9b){return _0x338f11[_0xb276('0xa')](_0xb276('0xb'),attributes,{'tableName':_0xb276('0xc'),'paranoid':![],'indexes':[{'fields':[_0xb276('0xd')]},{'fields':[_0xb276('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x177a=['lodash','api','moment','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid'];(function(_0x447545,_0x4550aa){var _0x5d4e3b=function(_0x137878){while(--_0x137878){_0x447545['push'](_0x447545['shift']());}};_0x5d4e3b(++_0x4550aa);}(_0x177a,0xdd));var _0xa177=function(_0x221ad2,_0x1ef0fa){_0x221ad2=_0x221ad2-0x0;var _0x586399=_0x177a[_0x221ad2];return _0x586399;};'use strict';var _=require(_0xa177('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa177('0x1'));var moment=require(_0xa177('0x2'));var BPromise=require(_0xa177('0x3'));var rp=require(_0xa177('0x4'));var fs=require('fs');var path=require(_0xa177('0x5'));var rimraf=require(_0xa177('0x6'));var config=require('../../config/environment');var attributes=require(_0xa177('0x7'));module[_0xa177('0x8')]=function(_0x1f37b0,_0x455737){return _0x1f37b0[_0xa177('0x9')](_0xa177('0xa'),attributes,{'tableName':_0xa177('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa177('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index d7d7c70..4902e64 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 _0x5a52=['raw','then','UpdateVoiceQueueReport','update','where','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueueReport','findAll','options','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create','body'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x5a52,0x89));var _0x25a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a52[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x25a5('0x0'));var moment=require(_0x25a5('0x1'));var BPromise=require('bluebird');var rs=require(_0x25a5('0x2'));var fs=require('fs');var Redis=require(_0x25a5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x25a5('0x4'));var logger=require(_0x25a5('0x5'))('rpc');var config=require(_0x25a5('0x6'));var jayson=require(_0x25a5('0x7'));var client=jayson[_0x25a5('0x8')][_0x25a5('0x9')]({'port':0x232a});config[_0x25a5('0xa')]=_[_0x25a5('0xb')](config['redis'],{'host':_0x25a5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x25a5('0xa')]));require(_0x25a5('0xd'))[_0x25a5('0xe')](socket);function respondWithRpcPromise(_0x4222d0,_0x4b4c08,_0x462ef5){return new BPromise(function(_0x2eed84,_0x318039){return client[_0x25a5('0xf')](_0x4222d0,_0x462ef5)['then'](function(_0x525629){logger[_0x25a5('0x10')](_0x25a5('0x11'),_0x4b4c08,_0x25a5('0x12'));logger[_0x25a5('0x13')](_0x25a5('0x14'),_0x4b4c08,_0x25a5('0x12'),JSON[_0x25a5('0x15')](_0x525629));if(_0x525629[_0x25a5('0x16')]){if(_0x525629[_0x25a5('0x16')][_0x25a5('0x17')]===0x1f4){logger[_0x25a5('0x16')](_0x25a5('0x11'),_0x4b4c08,_0x525629['error']['message']);return _0x318039(_0x525629[_0x25a5('0x16')][_0x25a5('0x18')]);}logger[_0x25a5('0x16')](_0x25a5('0x11'),_0x4b4c08,_0x525629[_0x25a5('0x16')][_0x25a5('0x18')]);return _0x2eed84(_0x525629[_0x25a5('0x16')][_0x25a5('0x18')]);}else{logger[_0x25a5('0x10')](_0x25a5('0x11'),_0x4b4c08,_0x25a5('0x12'));_0x2eed84(_0x525629[_0x25a5('0x19')][_0x25a5('0x18')]);}})[_0x25a5('0x1a')](function(_0x19853a){logger['error'](_0x25a5('0x11'),_0x4b4c08,_0x19853a);_0x318039(_0x19853a);});});}exports['GetVoiceQueueReport']=function(_0x4ad3cc){var _0x34e033=this;return new Promise(function(_0x455115,_0x5385a2){return db[_0x25a5('0x1b')][_0x25a5('0x1c')]({'raw':_0x4ad3cc[_0x25a5('0x1d')]?_0x4ad3cc[_0x25a5('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4ad3cc['options']?_0x4ad3cc[_0x25a5('0x1d')]['where']||null:null,'attributes':_0x4ad3cc[_0x25a5('0x1d')]?_0x4ad3cc[_0x25a5('0x1d')][_0x25a5('0x1e')]||null:null,'limit':_0x4ad3cc['options']?_0x4ad3cc['options'][_0x25a5('0x1f')]||null:null,'include':_0x4ad3cc[_0x25a5('0x1d')]?_0x4ad3cc['options'][_0x25a5('0x20')]?_[_0x25a5('0x21')](_0x4ad3cc['options']['include'],function(_0x4ba489){return{'model':db[_0x4ba489['model']],'as':_0x4ba489['as'],'attributes':_0x4ba489[_0x25a5('0x1e')],'include':_0x4ba489['include']?_[_0x25a5('0x21')](_0x4ba489[_0x25a5('0x20')],function(_0xa283ac){return{'model':db[_0xa283ac['model']],'as':_0xa283ac['as'],'attributes':_0xa283ac['attributes'],'include':_0xa283ac[_0x25a5('0x20')]?_[_0x25a5('0x21')](_0xa283ac[_0x25a5('0x20')],function(_0x4fe245){return{'model':db[_0x4fe245[_0x25a5('0x22')]],'as':_0x4fe245['as'],'attributes':_0x4fe245[_0x25a5('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21c1a1){logger[_0x25a5('0x10')](_0x25a5('0x23'),_0x4ad3cc);logger[_0x25a5('0x13')](_0x25a5('0x23'),_0x4ad3cc,JSON[_0x25a5('0x15')](_0x21c1a1));_0x455115(_0x21c1a1);})[_0x25a5('0x1a')](function(_0x3d82e0){logger[_0x25a5('0x16')](_0x25a5('0x23'),_0x3d82e0[_0x25a5('0x18')],_0x4ad3cc);_0x5385a2(_0x34e033[_0x25a5('0x16')](0x1f4,_0x3d82e0[_0x25a5('0x18')]));});});};exports[_0x25a5('0x24')]=function(_0x2d6320){var _0x21408b=this;return new Promise(function(_0x534ec6,_0x5aeac5){return db['VoiceQueueReport'][_0x25a5('0x25')](_0x2d6320[_0x25a5('0x26')],{'raw':_0x2d6320[_0x25a5('0x1d')]?_0x2d6320['options'][_0x25a5('0x27')]===undefined?!![]:![]:!![]})[_0x25a5('0x28')](function(_0x7b359){logger[_0x25a5('0x10')](_0x25a5('0x24'),_0x2d6320);logger[_0x25a5('0x13')](_0x25a5('0x24'),_0x2d6320,JSON['stringify'](_0x7b359));_0x534ec6(_0x7b359);})['catch'](function(_0x12a978){logger[_0x25a5('0x16')]('CreateVoiceQueueReport',_0x12a978['message'],_0x2d6320);_0x5aeac5(_0x21408b[_0x25a5('0x16')](0x1f4,_0x12a978[_0x25a5('0x18')]));});});};exports[_0x25a5('0x29')]=function(_0xbdd800){var _0x436f2a=this;return new Promise(function(_0x3073af,_0x2cdb55){return db[_0x25a5('0x1b')][_0x25a5('0x2a')](_0xbdd800[_0x25a5('0x26')],{'raw':_0xbdd800[_0x25a5('0x1d')]?_0xbdd800['options'][_0x25a5('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbdd800[_0x25a5('0x1d')]?_0xbdd800['options'][_0x25a5('0x2b')]||null:null,'attributes':_0xbdd800[_0x25a5('0x1d')]?_0xbdd800[_0x25a5('0x1d')]['attributes']||null:null,'limit':_0xbdd800[_0x25a5('0x1d')]?_0xbdd800['options']['limit']||null:null})[_0x25a5('0x28')](function(_0x46c75e){logger[_0x25a5('0x10')](_0x25a5('0x29'),_0xbdd800);logger[_0x25a5('0x13')](_0x25a5('0x29'),_0xbdd800,JSON[_0x25a5('0x15')](_0x46c75e));_0x3073af(_0x46c75e);})[_0x25a5('0x1a')](function(_0x2b6f97){logger[_0x25a5('0x16')]('UpdateVoiceQueueReport',_0x2b6f97['message'],_0xbdd800);_0x2cdb55(_0x436f2a[_0x25a5('0x16')](0x1f4,_0x2b6f97[_0x25a5('0x18')]));});});}; \ No newline at end of file +var _0x58b1=['stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','attributes','limit','map','include','model','CreateVoiceQueueReport','create','body','raw','where','UpdateVoiceQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x9102f8,_0x578620){var _0x356161=function(_0x424b5f){while(--_0x424b5f){_0x9102f8['push'](_0x9102f8['shift']());}};_0x356161(++_0x578620);}(_0x58b1,0xc9));var _0x158b=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x58b1[_0x2f2360];return _0x1cc8d3;};'use strict';var _=require('lodash');var util=require(_0x158b('0x0'));var moment=require(_0x158b('0x1'));var BPromise=require(_0x158b('0x2'));var rs=require(_0x158b('0x3'));var fs=require('fs');var Redis=require(_0x158b('0x4'));var db=require(_0x158b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x158b('0x6'));var config=require(_0x158b('0x7'));var jayson=require(_0x158b('0x8'));var client=jayson[_0x158b('0x9')][_0x158b('0xa')]({'port':0x232a});config[_0x158b('0xb')]=_[_0x158b('0xc')](config[_0x158b('0xb')],{'host':_0x158b('0xd'),'port':0x18eb});var socket=require(_0x158b('0xe'))(new Redis(config[_0x158b('0xb')]));require(_0x158b('0xf'))[_0x158b('0x10')](socket);function respondWithRpcPromise(_0x4af6f6,_0x93db0c,_0x4e5735){return new BPromise(function(_0x38e634,_0x42e21b){return client[_0x158b('0x11')](_0x4af6f6,_0x4e5735)[_0x158b('0x12')](function(_0x2656a2){logger[_0x158b('0x13')](_0x158b('0x14'),_0x93db0c,'request\x20sent');logger[_0x158b('0x15')](_0x158b('0x16'),_0x93db0c,_0x158b('0x17'),JSON[_0x158b('0x18')](_0x2656a2));if(_0x2656a2[_0x158b('0x19')]){if(_0x2656a2[_0x158b('0x19')][_0x158b('0x1a')]===0x1f4){logger[_0x158b('0x19')](_0x158b('0x14'),_0x93db0c,_0x2656a2[_0x158b('0x19')]['message']);return _0x42e21b(_0x2656a2[_0x158b('0x19')][_0x158b('0x1b')]);}logger[_0x158b('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x93db0c,_0x2656a2['error'][_0x158b('0x1b')]);return _0x38e634(_0x2656a2['error'][_0x158b('0x1b')]);}else{logger[_0x158b('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x93db0c,_0x158b('0x17'));_0x38e634(_0x2656a2[_0x158b('0x1c')][_0x158b('0x1b')]);}})[_0x158b('0x1d')](function(_0x22765a){logger[_0x158b('0x19')](_0x158b('0x14'),_0x93db0c,_0x22765a);_0x42e21b(_0x22765a);});});}exports[_0x158b('0x1e')]=function(_0xb7e834){var _0x44e3c7=this;return new Promise(function(_0xdfbe32,_0x39c699){return db[_0x158b('0x1f')][_0x158b('0x20')]({'raw':_0xb7e834[_0x158b('0x21')]?_0xb7e834[_0x158b('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0xb7e834['options']?_0xb7e834[_0x158b('0x21')]['where']||null:null,'attributes':_0xb7e834[_0x158b('0x21')]?_0xb7e834[_0x158b('0x21')][_0x158b('0x22')]||null:null,'limit':_0xb7e834[_0x158b('0x21')]?_0xb7e834[_0x158b('0x21')][_0x158b('0x23')]||null:null,'include':_0xb7e834[_0x158b('0x21')]?_0xb7e834[_0x158b('0x21')]['include']?_[_0x158b('0x24')](_0xb7e834[_0x158b('0x21')][_0x158b('0x25')],function(_0x5eb587){return{'model':db[_0x5eb587['model']],'as':_0x5eb587['as'],'attributes':_0x5eb587[_0x158b('0x22')],'include':_0x5eb587[_0x158b('0x25')]?_[_0x158b('0x24')](_0x5eb587[_0x158b('0x25')],function(_0x20d611){return{'model':db[_0x20d611['model']],'as':_0x20d611['as'],'attributes':_0x20d611['attributes'],'include':_0x20d611[_0x158b('0x25')]?_[_0x158b('0x24')](_0x20d611[_0x158b('0x25')],function(_0x1df39d){return{'model':db[_0x1df39d[_0x158b('0x26')]],'as':_0x1df39d['as'],'attributes':_0x1df39d['attributes']};}):[]};}):[]};}):[]:[]})[_0x158b('0x12')](function(_0x3b2223){logger[_0x158b('0x13')]('GetVoiceQueueReport',_0xb7e834);logger['debug'](_0x158b('0x1e'),_0xb7e834,JSON[_0x158b('0x18')](_0x3b2223));_0xdfbe32(_0x3b2223);})['catch'](function(_0x2d3b21){logger[_0x158b('0x19')](_0x158b('0x1e'),_0x2d3b21[_0x158b('0x1b')],_0xb7e834);_0x39c699(_0x44e3c7[_0x158b('0x19')](0x1f4,_0x2d3b21[_0x158b('0x1b')]));});});};exports[_0x158b('0x27')]=function(_0x2792a7){var _0x156a2e=this;return new Promise(function(_0x589ca8,_0x4c1985){return db[_0x158b('0x1f')][_0x158b('0x28')](_0x2792a7[_0x158b('0x29')],{'raw':_0x2792a7[_0x158b('0x21')]?_0x2792a7[_0x158b('0x21')][_0x158b('0x2a')]===undefined?!![]:![]:!![]})[_0x158b('0x12')](function(_0x1330b5){logger[_0x158b('0x13')](_0x158b('0x27'),_0x2792a7);logger[_0x158b('0x15')](_0x158b('0x27'),_0x2792a7,JSON[_0x158b('0x18')](_0x1330b5));_0x589ca8(_0x1330b5);})[_0x158b('0x1d')](function(_0x11bb04){logger[_0x158b('0x19')](_0x158b('0x27'),_0x11bb04['message'],_0x2792a7);_0x4c1985(_0x156a2e['error'](0x1f4,_0x11bb04[_0x158b('0x1b')]));});});};exports['UpdateVoiceQueueReport']=function(_0x2266c3){var _0x504127=this;return new Promise(function(_0x305ffe,_0x2d05e7){return db[_0x158b('0x1f')]['update'](_0x2266c3[_0x158b('0x29')],{'raw':_0x2266c3[_0x158b('0x21')]?_0x2266c3[_0x158b('0x21')][_0x158b('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2266c3[_0x158b('0x21')]?_0x2266c3[_0x158b('0x21')][_0x158b('0x2b')]||null:null,'attributes':_0x2266c3[_0x158b('0x21')]?_0x2266c3[_0x158b('0x21')]['attributes']||null:null,'limit':_0x2266c3[_0x158b('0x21')]?_0x2266c3[_0x158b('0x21')][_0x158b('0x23')]||null:null})[_0x158b('0x12')](function(_0x3b3a52){logger['info'](_0x158b('0x2c'),_0x2266c3);logger[_0x158b('0x15')](_0x158b('0x2c'),_0x2266c3,JSON[_0x158b('0x18')](_0x3b3a52));_0x305ffe(_0x3b3a52);})[_0x158b('0x1d')](function(_0x9b1ca3){logger[_0x158b('0x19')](_0x158b('0x2c'),_0x9b1ca3[_0x158b('0x1b')],_0x2266c3);_0x2d05e7(_0x504127[_0x158b('0x19')](0x1f4,_0x9b1ca3['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 56e6069..a85571f 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 _0x594d=['removeListener','register','length','voiceQueueReport:','remove','update'];(function(_0x1fca66,_0x29e7b1){var _0x30e9c5=function(_0x12d508){while(--_0x12d508){_0x1fca66['push'](_0x1fca66['shift']());}};_0x30e9c5(++_0x29e7b1);}(_0x594d,0x172));var _0xd594=function(_0x43956c,_0x4324c5){_0x43956c=_0x43956c-0x0;var _0x317068=_0x594d[_0x43956c];return _0x317068;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0xd594('0x0'),_0xd594('0x1')];function createListener(_0x1354a1,_0x45b108){return function(_0x71782){_0x45b108['emit'](_0x1354a1,_0x71782);};}function removeListener(_0x2f523e,_0x43c803){return function(){VoiceQueueReportEvents[_0xd594('0x2')](_0x2f523e,_0x43c803);};}exports[_0xd594('0x3')]=function(_0x578735){for(var _0x5ac3b7=0x0,_0x52f59f=events[_0xd594('0x4')];_0x5ac3b7<_0x52f59f;_0x5ac3b7++){var _0x1defc6=events[_0x5ac3b7];var _0x1ed2a4=createListener(_0xd594('0x5')+_0x1defc6,_0x578735);VoiceQueueReportEvents['on'](_0x1defc6,_0x1ed2a4);}}; \ No newline at end of file +var _0x12f1=['update','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','remove'];(function(_0x2cf447,_0x5e64c6){var _0x42a10f=function(_0x4cbcce){while(--_0x4cbcce){_0x2cf447['push'](_0x2cf447['shift']());}};_0x42a10f(++_0x5e64c6);}(_0x12f1,0xf4));var _0x112f=function(_0x4817f9,_0x4070d1){_0x4817f9=_0x4817f9-0x0;var _0x2dcfa6=_0x12f1[_0x4817f9];return _0x2dcfa6;};'use strict';var VoiceQueueReportEvents=require(_0x112f('0x0'));var events=['save',_0x112f('0x1'),_0x112f('0x2')];function createListener(_0x1a428e,_0x10747c){return function(_0x1ba4ca){_0x10747c['emit'](_0x1a428e,_0x1ba4ca);};}function removeListener(_0x5dfc98,_0x554ca7){return function(){VoiceQueueReportEvents[_0x112f('0x3')](_0x5dfc98,_0x554ca7);};}exports['register']=function(_0x21cccd){for(var _0x2044f2=0x0,_0x39d5a6=events[_0x112f('0x4')];_0x2044f2<_0x39d5a6;_0x2044f2++){var _0x32612d=events[_0x2044f2];var _0x48ae1d=createListener(_0x112f('0x5')+_0x32612d,_0x21cccd);VoiceQueueReportEvents['on'](_0x32612d,_0x48ae1d);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 9068ec0..6ee0e99 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 _0xc47c=['delete','destroy','exports','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x5d03c5,_0x485a89){var _0x147cb0=function(_0x2969bd){while(--_0x2969bd){_0x5d03c5['push'](_0x5d03c5['shift']());}};_0x147cb0(++_0x485a89);}(_0xc47c,0xe0));var _0xcc47=function(_0x34365b,_0x418c5a){_0x34365b=_0x34365b-0x0;var _0x12d73a=_0xc47c[_0x34365b];return _0x12d73a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc47('0x0'));var router=express['Router']();var fs_extra=require(_0xcc47('0x1'));var auth=require(_0xcc47('0x2'));var interaction=require(_0xcc47('0x3'));var config=require(_0xcc47('0x4'));var controller=require(_0xcc47('0x5'));router[_0xcc47('0x6')]('/',auth[_0xcc47('0x7')](),controller['index']);router[_0xcc47('0x6')](_0xcc47('0x8'),auth['isAuthenticated'](),controller[_0xcc47('0x9')]);router[_0xcc47('0xa')]('/',auth[_0xcc47('0x7')](),controller[_0xcc47('0xb')]);router[_0xcc47('0xc')](_0xcc47('0x8'),auth['isAuthenticated'](),controller[_0xcc47('0xd')]);router[_0xcc47('0xe')](_0xcc47('0x8'),auth[_0xcc47('0x7')](),controller[_0xcc47('0xf')]);module[_0xcc47('0x10')]=router; \ No newline at end of file +var _0x9489=['path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x4a503b,_0x2b5c1b){var _0x1dab99=function(_0x35c3fc){while(--_0x35c3fc){_0x4a503b['push'](_0x4a503b['shift']());}};_0x1dab99(++_0x2b5c1b);}(_0x9489,0xb2));var _0x9948=function(_0x198746,_0x45bef4){_0x198746=_0x198746-0x0;var _0x1bf55f=_0x9489[_0x198746];return _0x1bf55f;};'use strict';var multer=require(_0x9948('0x0'));var util=require(_0x9948('0x1'));var path=require(_0x9948('0x2'));var timeout=require(_0x9948('0x3'));var express=require(_0x9948('0x4'));var router=express[_0x9948('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9948('0x6'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0x9948('0x7')]('/',auth[_0x9948('0x8')](),controller[_0x9948('0x9')]);router[_0x9948('0x7')](_0x9948('0xa'),auth[_0x9948('0x8')](),controller[_0x9948('0xb')]);router[_0x9948('0xc')]('/',auth[_0x9948('0x8')](),controller['create']);router[_0x9948('0xd')](_0x9948('0xa'),auth[_0x9948('0x8')](),controller[_0x9948('0xe')]);router[_0x9948('0xf')](_0x9948('0xa'),auth[_0x9948('0x8')](),controller[_0x9948('0x10')]);module[_0x9948('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 fb464ab..d104462 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 _0x613a=['moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3fc1b6,_0x1ea2df){var _0x24cce7=function(_0x21dfe6){while(--_0x21dfe6){_0x3fc1b6['push'](_0x3fc1b6['shift']());}};_0x24cce7(++_0x1ea2df);}(_0x613a,0xba));var _0xa613=function(_0x11bf2c,_0x16f5df){_0x11bf2c=_0x11bf2c-0x0;var _0x30ba9c=_0x613a[_0x11bf2c];return _0x30ba9c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa613('0x0'));module[_0xa613('0x1')]={'time':{'type':Sequelize[_0xa613('0x2')]},'callid':{'type':Sequelize[_0xa613('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa613('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa613('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa613('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa613('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa613('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa613('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa613('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa613('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa613('0x3')],'allowNull':![],'defaultValue':moment()[_0xa613('0x4')](_0xa613('0x5'))}}; \ No newline at end of file +var _0x0d74=['format','YYYY-MM-DD\x20HH:mm:ss','moment','STRING','DATE'];(function(_0x499dcf,_0x23bb8d){var _0x2d87f7=function(_0x887543){while(--_0x887543){_0x499dcf['push'](_0x499dcf['shift']());}};_0x2d87f7(++_0x23bb8d);}(_0x0d74,0x1c9));var _0x40d7=function(_0x3fef29,_0x565d00){_0x3fef29=_0x3fef29-0x0;var _0x250dc1=_0x0d74[_0x3fef29];return _0x250dc1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x40d7('0x0'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x40d7('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x40d7('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x40d7('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x40d7('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x40d7('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x40d7('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x40d7('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x40d7('0x2')],'allowNull':![],'defaultValue':moment()[_0x40d7('0x3')](_0x40d7('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 03aaae2..aa55063 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 _0x2991=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2991,0x130));var _0x1299=function(_0x2870ec,_0x3f2be6){_0x2870ec=_0x2870ec-0x0;var _0x3e2ae6=_0x2991[_0x2870ec];return _0x3e2ae6;};'use strict';var emlformat=require(_0x1299('0x0'));var rimraf=require(_0x1299('0x1'));var zipdir=require(_0x1299('0x2'));var jsonpatch=require(_0x1299('0x3'));var rp=require(_0x1299('0x4'));var moment=require(_0x1299('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1299('0x6'));var path=require(_0x1299('0x7'));var sox=require(_0x1299('0x8'));var csv=require(_0x1299('0x9'));var ejs=require(_0x1299('0xa'));var fs=require('fs');var fs_extra=require(_0x1299('0xb'));var _=require(_0x1299('0xc'));var squel=require(_0x1299('0xd'));var crypto=require('crypto');var jsforce=require(_0x1299('0xe'));var deskjs=require(_0x1299('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1299('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1299('0x11'));var qs=require(_0x1299('0x12'));var as=require(_0x1299('0x13'));var hardwareService=require(_0x1299('0x14'));var logger=require(_0x1299('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1299('0x16'));var licenseUtil=require(_0x1299('0x17'));var db=require(_0x1299('0x18'))['db'];function respondWithStatusCode(_0x5d4376,_0x5b53df){_0x5b53df=_0x5b53df||0xcc;return function(_0x1ab0ec){if(_0x1ab0ec){return _0x5d4376[_0x1299('0x19')](_0x5b53df);}return _0x5d4376[_0x1299('0x1a')](_0x5b53df)[_0x1299('0x1b')]();};}function respondWithResult(_0x5ae022,_0x34f9d0){_0x34f9d0=_0x34f9d0||0xc8;return function(_0x5c2a7c){if(_0x5c2a7c){return _0x5ae022[_0x1299('0x1a')](_0x34f9d0)[_0x1299('0x1c')](_0x5c2a7c);}};}function respondWithFilteredResult(_0x3a8578,_0x57deba){return function(_0x5e1f71){if(_0x5e1f71){var _0x3646fd=typeof _0x57deba[_0x1299('0x1d')]===_0x1299('0x1e')&&typeof _0x57deba['limit']===_0x1299('0x1e');var _0x37c53c=_0x5e1f71[_0x1299('0x1f')];var _0x42950c=_0x3646fd?0x0:_0x57deba[_0x1299('0x1d')];var _0x179919=_0x3646fd?_0x5e1f71[_0x1299('0x1f')]:_0x57deba[_0x1299('0x1d')]+_0x57deba[_0x1299('0x20')];var _0x2cfa83;if(_0x179919>=_0x37c53c){_0x179919=_0x37c53c;_0x2cfa83=0xc8;}else{_0x2cfa83=0xce;}_0x3a8578[_0x1299('0x1a')](_0x2cfa83);return _0x3a8578[_0x1299('0x21')](_0x1299('0x22'),_0x42950c+'-'+_0x179919+'/'+_0x37c53c)['json'](_0x5e1f71);}return null;};}function patchUpdates(_0x1c342d){return function(_0x2913e9){try{jsonpatch[_0x1299('0x23')](_0x2913e9,_0x1c342d,!![]);}catch(_0x36b189){return BPromise[_0x1299('0x24')](_0x36b189);}return _0x2913e9[_0x1299('0x25')]();};}function saveUpdates(_0x2a04e7,_0x38f6c2){return function(_0x54a5a9){if(_0x54a5a9){return _0x54a5a9[_0x1299('0x26')](_0x2a04e7)[_0x1299('0x27')](function(_0x54f94c){return _0x54f94c;});}return null;};}function removeEntity(_0x1de3e9,_0xb02924){return function(_0x5a34d4){if(_0x5a34d4){return _0x5a34d4[_0x1299('0x28')]()['then'](function(){_0x1de3e9[_0x1299('0x1a')](0xcc)[_0x1299('0x1b')]();});}};}function handleEntityNotFound(_0x4185f8,_0x26c20b){return function(_0x2f2074){if(!_0x2f2074){_0x4185f8[_0x1299('0x19')](0x194);}return _0x2f2074;};}function handleError(_0x39da61,_0x330ce4){_0x330ce4=_0x330ce4||0x1f4;return function(_0x40547e){logger[_0x1299('0x29')](_0x40547e[_0x1299('0x2a')]);if(_0x40547e[_0x1299('0x2b')]){delete _0x40547e[_0x1299('0x2b')];}_0x39da61[_0x1299('0x1a')](_0x330ce4)[_0x1299('0x2c')](_0x40547e);};}exports['index']=function(_0x136f7d,_0x56c77e){var _0x2c72c7={},_0x23c823={},_0x5e229d={'count':0x0,'rows':[]};var _0x4a9c8f=_[_0x1299('0x2d')](db[_0x1299('0x2e')][_0x1299('0x2f')],function(_0x10419c){return{'name':_0x10419c[_0x1299('0x30')],'type':_0x10419c[_0x1299('0x31')][_0x1299('0x32')]};});_0x23c823[_0x1299('0x33')]=_[_0x1299('0x2d')](_0x4a9c8f,_0x1299('0x2b'));_0x23c823[_0x1299('0x34')]=_[_0x1299('0x35')](_0x136f7d[_0x1299('0x34')]);_0x23c823[_0x1299('0x36')]=_[_0x1299('0x37')](_0x23c823[_0x1299('0x33')],_0x23c823[_0x1299('0x34')]);_0x2c72c7[_0x1299('0x38')]=_[_0x1299('0x37')](_0x23c823['model'],qs[_0x1299('0x39')](_0x136f7d['query']['fields']));_0x2c72c7[_0x1299('0x38')]=_0x2c72c7[_0x1299('0x38')][_0x1299('0x3a')]?_0x2c72c7[_0x1299('0x38')]:_0x23c823[_0x1299('0x33')];if(!_0x136f7d[_0x1299('0x34')][_0x1299('0x3b')]('nolimit')){_0x2c72c7[_0x1299('0x20')]=qs[_0x1299('0x20')](_0x136f7d[_0x1299('0x34')][_0x1299('0x20')]);_0x2c72c7['offset']=qs['offset'](_0x136f7d[_0x1299('0x34')][_0x1299('0x1d')]);}_0x2c72c7[_0x1299('0x3c')]=qs[_0x1299('0x3d')](_0x136f7d[_0x1299('0x34')][_0x1299('0x3d')]);_0x2c72c7[_0x1299('0x3e')]=qs['filters'](_['pick'](_0x136f7d['query'],_0x23c823[_0x1299('0x36')]),_0x4a9c8f);if(_0x136f7d['query'][_0x1299('0x3f')]){_0x2c72c7[_0x1299('0x3e')]=_[_0x1299('0x40')](_0x2c72c7[_0x1299('0x3e')],{'$or':_[_0x1299('0x2d')](_0x4a9c8f,function(_0xa8039a){if(_0xa8039a['type']!==_0x1299('0x41')){var _0x1ee820={};_0x1ee820[_0xa8039a['name']]={'$like':'%'+_0x136f7d[_0x1299('0x34')][_0x1299('0x3f')]+'%'};return _0x1ee820;}})});}_0x2c72c7=_['merge']({},_0x2c72c7,_0x136f7d[_0x1299('0x42')]);var _0x400d5e={'where':_0x2c72c7['where']};return db[_0x1299('0x2e')][_0x1299('0x1f')](_0x400d5e)[_0x1299('0x27')](function(_0x52d2f2){_0x5e229d[_0x1299('0x1f')]=_0x52d2f2;if(_0x136f7d['query'][_0x1299('0x43')]){_0x2c72c7[_0x1299('0x44')]=[{'all':!![]}];}return db[_0x1299('0x2e')][_0x1299('0x45')](_0x2c72c7);})[_0x1299('0x27')](function(_0x3854d8){_0x5e229d[_0x1299('0x46')]=_0x3854d8;return _0x5e229d;})[_0x1299('0x27')](respondWithFilteredResult(_0x56c77e,_0x2c72c7))[_0x1299('0x47')](handleError(_0x56c77e,null));};exports['show']=function(_0x20c428,_0x4e0ad2){var _0x1c574d={'raw':!![],'where':{'id':_0x20c428['params']['id']}},_0x2608f3={};_0x2608f3[_0x1299('0x33')]=_[_0x1299('0x35')](db[_0x1299('0x2e')][_0x1299('0x2f')]);_0x2608f3[_0x1299('0x34')]=_[_0x1299('0x35')](_0x20c428[_0x1299('0x34')]);_0x2608f3[_0x1299('0x36')]=_[_0x1299('0x37')](_0x2608f3['model'],_0x2608f3[_0x1299('0x34')]);_0x1c574d[_0x1299('0x38')]=_['intersection'](_0x2608f3[_0x1299('0x33')],qs['fields'](_0x20c428[_0x1299('0x34')][_0x1299('0x39')]));_0x1c574d['attributes']=_0x1c574d[_0x1299('0x38')][_0x1299('0x3a')]?_0x1c574d['attributes']:_0x2608f3[_0x1299('0x33')];if(_0x20c428[_0x1299('0x34')][_0x1299('0x43')]){_0x1c574d[_0x1299('0x44')]=[{'all':!![]}];}_0x1c574d=_[_0x1299('0x40')]({},_0x1c574d,_0x20c428[_0x1299('0x42')]);return db['VoiceQueuesLog'][_0x1299('0x48')](_0x1c574d)[_0x1299('0x27')](handleEntityNotFound(_0x4e0ad2,null))[_0x1299('0x27')](respondWithResult(_0x4e0ad2,null))['catch'](handleError(_0x4e0ad2,null));};exports[_0x1299('0x49')]=function(_0x3dbc3d,_0xbd401d){return db[_0x1299('0x2e')][_0x1299('0x49')](_0x3dbc3d[_0x1299('0x4a')],{})[_0x1299('0x27')](respondWithResult(_0xbd401d,0xc9))[_0x1299('0x47')](handleError(_0xbd401d,null));};exports[_0x1299('0x26')]=function(_0xe4c67b,_0x571017){if(_0xe4c67b[_0x1299('0x4a')]['id']){delete _0xe4c67b[_0x1299('0x4a')]['id'];}return db[_0x1299('0x2e')][_0x1299('0x48')]({'where':{'id':_0xe4c67b[_0x1299('0x4b')]['id']}})[_0x1299('0x27')](handleEntityNotFound(_0x571017,null))[_0x1299('0x27')](saveUpdates(_0xe4c67b[_0x1299('0x4a')],null))[_0x1299('0x27')](respondWithResult(_0x571017,null))[_0x1299('0x47')](handleError(_0x571017,null));};exports[_0x1299('0x28')]=function(_0x456a93,_0x1ab97b){return db[_0x1299('0x2e')][_0x1299('0x48')]({'where':{'id':_0x456a93['params']['id']}})[_0x1299('0x27')](handleEntityNotFound(_0x1ab97b,null))['then'](removeEntity(_0x1ab97b,null))['catch'](handleError(_0x1ab97b,null));}; \ No newline at end of file +var _0xbe39=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','create','update','find','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','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','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge'];(function(_0x1e08b8,_0xdfa22b){var _0x2eadd4=function(_0x19d3e6){while(--_0x19d3e6){_0x1e08b8['push'](_0x1e08b8['shift']());}};_0x2eadd4(++_0xdfa22b);}(_0xbe39,0x184));var _0x9be3=function(_0x5f19ef,_0x5603f7){_0x5f19ef=_0x5f19ef-0x0;var _0xd740b8=_0xbe39[_0x5f19ef];return _0xd740b8;};'use strict';var emlformat=require(_0x9be3('0x0'));var rimraf=require(_0x9be3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9be3('0x2'));var moment=require(_0x9be3('0x3'));var BPromise=require(_0x9be3('0x4'));var Mustache=require(_0x9be3('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9be3('0x6'));var csv=require(_0x9be3('0x7'));var ejs=require(_0x9be3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9be3('0x9'));var crypto=require('crypto');var jsforce=require(_0x9be3('0xa'));var deskjs=require(_0x9be3('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9be3('0xc'));var Papa=require(_0x9be3('0xd'));var Redis=require(_0x9be3('0xe'));var authService=require(_0x9be3('0xf'));var qs=require(_0x9be3('0x10'));var as=require(_0x9be3('0x11'));var hardwareService=require(_0x9be3('0x12'));var logger=require('../../config/logger')(_0x9be3('0x13'));var utils=require(_0x9be3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9be3('0x15'));var db=require(_0x9be3('0x16'))['db'];function respondWithStatusCode(_0x4b5d88,_0x1c37fa){_0x1c37fa=_0x1c37fa||0xcc;return function(_0x455f3a){if(_0x455f3a){return _0x4b5d88[_0x9be3('0x17')](_0x1c37fa);}return _0x4b5d88[_0x9be3('0x18')](_0x1c37fa)[_0x9be3('0x19')]();};}function respondWithResult(_0x15aea1,_0x56b4c0){_0x56b4c0=_0x56b4c0||0xc8;return function(_0x419364){if(_0x419364){return _0x15aea1[_0x9be3('0x18')](_0x56b4c0)['json'](_0x419364);}};}function respondWithFilteredResult(_0x5e55c3,_0x682fb9){return function(_0x668b0f){if(_0x668b0f){var _0x405a6d=typeof _0x682fb9[_0x9be3('0x1a')]===_0x9be3('0x1b')&&typeof _0x682fb9[_0x9be3('0x1c')]===_0x9be3('0x1b');var _0x4cf235=_0x668b0f['count'];var _0x156b01=_0x405a6d?0x0:_0x682fb9['offset'];var _0x5cea3e=_0x405a6d?_0x668b0f[_0x9be3('0x1d')]:_0x682fb9[_0x9be3('0x1a')]+_0x682fb9[_0x9be3('0x1c')];var _0x2e0955;if(_0x5cea3e>=_0x4cf235){_0x5cea3e=_0x4cf235;_0x2e0955=0xc8;}else{_0x2e0955=0xce;}_0x5e55c3[_0x9be3('0x18')](_0x2e0955);return _0x5e55c3[_0x9be3('0x1e')](_0x9be3('0x1f'),_0x156b01+'-'+_0x5cea3e+'/'+_0x4cf235)[_0x9be3('0x20')](_0x668b0f);}return null;};}function patchUpdates(_0xda40f5){return function(_0x48c6c4){try{jsonpatch[_0x9be3('0x21')](_0x48c6c4,_0xda40f5,!![]);}catch(_0x1226a3){return BPromise[_0x9be3('0x22')](_0x1226a3);}return _0x48c6c4[_0x9be3('0x23')]();};}function saveUpdates(_0x261bf4,_0x360406){return function(_0x189bcf){if(_0x189bcf){return _0x189bcf['update'](_0x261bf4)[_0x9be3('0x24')](function(_0x4f940a){return _0x4f940a;});}return null;};}function removeEntity(_0x5b59d9,_0x19648f){return function(_0x11b1b5){if(_0x11b1b5){return _0x11b1b5[_0x9be3('0x25')]()[_0x9be3('0x24')](function(){_0x5b59d9[_0x9be3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf290dd,_0x129471){return function(_0x38927f){if(!_0x38927f){_0xf290dd['sendStatus'](0x194);}return _0x38927f;};}function handleError(_0x17acd0,_0x25043c){_0x25043c=_0x25043c||0x1f4;return function(_0x102b92){logger[_0x9be3('0x26')](_0x102b92['stack']);if(_0x102b92[_0x9be3('0x27')]){delete _0x102b92[_0x9be3('0x27')];}_0x17acd0[_0x9be3('0x18')](_0x25043c)[_0x9be3('0x28')](_0x102b92);};}exports[_0x9be3('0x29')]=function(_0x5d9d7d,_0x116e8a){var _0x3a5688={},_0x405fc9={},_0x1083de={'count':0x0,'rows':[]};var _0xedf4eb=_[_0x9be3('0x2a')](db[_0x9be3('0x2b')][_0x9be3('0x2c')],function(_0x4a4214){return{'name':_0x4a4214[_0x9be3('0x2d')],'type':_0x4a4214[_0x9be3('0x2e')][_0x9be3('0x2f')]};});_0x405fc9[_0x9be3('0x30')]=_['map'](_0xedf4eb,_0x9be3('0x27'));_0x405fc9['query']=_[_0x9be3('0x31')](_0x5d9d7d[_0x9be3('0x32')]);_0x405fc9[_0x9be3('0x33')]=_[_0x9be3('0x34')](_0x405fc9['model'],_0x405fc9['query']);_0x3a5688[_0x9be3('0x35')]=_[_0x9be3('0x34')](_0x405fc9[_0x9be3('0x30')],qs[_0x9be3('0x36')](_0x5d9d7d[_0x9be3('0x32')][_0x9be3('0x36')]));_0x3a5688[_0x9be3('0x35')]=_0x3a5688[_0x9be3('0x35')][_0x9be3('0x37')]?_0x3a5688[_0x9be3('0x35')]:_0x405fc9['model'];if(!_0x5d9d7d[_0x9be3('0x32')][_0x9be3('0x38')](_0x9be3('0x39'))){_0x3a5688[_0x9be3('0x1c')]=qs[_0x9be3('0x1c')](_0x5d9d7d['query'][_0x9be3('0x1c')]);_0x3a5688[_0x9be3('0x1a')]=qs[_0x9be3('0x1a')](_0x5d9d7d[_0x9be3('0x32')][_0x9be3('0x1a')]);}_0x3a5688[_0x9be3('0x3a')]=qs[_0x9be3('0x3b')](_0x5d9d7d[_0x9be3('0x32')]['sort']);_0x3a5688['where']=qs[_0x9be3('0x33')](_['pick'](_0x5d9d7d[_0x9be3('0x32')],_0x405fc9['filters']),_0xedf4eb);if(_0x5d9d7d['query']['filter']){_0x3a5688[_0x9be3('0x3c')]=_[_0x9be3('0x3d')](_0x3a5688[_0x9be3('0x3c')],{'$or':_[_0x9be3('0x2a')](_0xedf4eb,function(_0x329ea7){if(_0x329ea7[_0x9be3('0x2e')]!==_0x9be3('0x3e')){var _0x2cab29={};_0x2cab29[_0x329ea7[_0x9be3('0x27')]]={'$like':'%'+_0x5d9d7d[_0x9be3('0x32')][_0x9be3('0x3f')]+'%'};return _0x2cab29;}})});}_0x3a5688=_[_0x9be3('0x3d')]({},_0x3a5688,_0x5d9d7d[_0x9be3('0x40')]);var _0x36a2a9={'where':_0x3a5688[_0x9be3('0x3c')]};return db[_0x9be3('0x2b')]['count'](_0x36a2a9)[_0x9be3('0x24')](function(_0x284ae6){_0x1083de[_0x9be3('0x1d')]=_0x284ae6;if(_0x5d9d7d[_0x9be3('0x32')][_0x9be3('0x41')]){_0x3a5688[_0x9be3('0x42')]=[{'all':!![]}];}return db[_0x9be3('0x2b')][_0x9be3('0x43')](_0x3a5688);})[_0x9be3('0x24')](function(_0x1f9fbc){_0x1083de[_0x9be3('0x44')]=_0x1f9fbc;return _0x1083de;})[_0x9be3('0x24')](respondWithFilteredResult(_0x116e8a,_0x3a5688))[_0x9be3('0x45')](handleError(_0x116e8a,null));};exports['show']=function(_0x5d822a,_0x7924ef){var _0x3e6dbe={'raw':!![],'where':{'id':_0x5d822a[_0x9be3('0x46')]['id']}},_0x403398={};_0x403398[_0x9be3('0x30')]=_[_0x9be3('0x31')](db[_0x9be3('0x2b')]['rawAttributes']);_0x403398['query']=_[_0x9be3('0x31')](_0x5d822a[_0x9be3('0x32')]);_0x403398[_0x9be3('0x33')]=_[_0x9be3('0x34')](_0x403398['model'],_0x403398['query']);_0x3e6dbe['attributes']=_[_0x9be3('0x34')](_0x403398[_0x9be3('0x30')],qs[_0x9be3('0x36')](_0x5d822a[_0x9be3('0x32')][_0x9be3('0x36')]));_0x3e6dbe[_0x9be3('0x35')]=_0x3e6dbe['attributes'][_0x9be3('0x37')]?_0x3e6dbe[_0x9be3('0x35')]:_0x403398[_0x9be3('0x30')];if(_0x5d822a[_0x9be3('0x32')][_0x9be3('0x41')]){_0x3e6dbe[_0x9be3('0x42')]=[{'all':!![]}];}_0x3e6dbe=_[_0x9be3('0x3d')]({},_0x3e6dbe,_0x5d822a[_0x9be3('0x40')]);return db['VoiceQueuesLog']['find'](_0x3e6dbe)[_0x9be3('0x24')](handleEntityNotFound(_0x7924ef,null))['then'](respondWithResult(_0x7924ef,null))[_0x9be3('0x45')](handleError(_0x7924ef,null));};exports[_0x9be3('0x47')]=function(_0x241414,_0x3a6d9c){return db[_0x9be3('0x2b')][_0x9be3('0x47')](_0x241414['body'],{})['then'](respondWithResult(_0x3a6d9c,0xc9))[_0x9be3('0x45')](handleError(_0x3a6d9c,null));};exports[_0x9be3('0x48')]=function(_0x4aaa6c,_0x37f1a8){if(_0x4aaa6c['body']['id']){delete _0x4aaa6c['body']['id'];}return db['VoiceQueuesLog'][_0x9be3('0x49')]({'where':{'id':_0x4aaa6c[_0x9be3('0x46')]['id']}})[_0x9be3('0x24')](handleEntityNotFound(_0x37f1a8,null))['then'](saveUpdates(_0x4aaa6c[_0x9be3('0x4a')],null))[_0x9be3('0x24')](respondWithResult(_0x37f1a8,null))[_0x9be3('0x45')](handleError(_0x37f1a8,null));};exports[_0x9be3('0x25')]=function(_0x1eb3af,_0x3487cc){return db[_0x9be3('0x2b')][_0x9be3('0x49')]({'where':{'id':_0x1eb3af[_0x9be3('0x46')]['id']}})[_0x9be3('0x24')](handleEntityNotFound(_0x3487cc,null))[_0x9be3('0x24')](removeEntity(_0x3487cc,null))[_0x9be3('0x45')](handleError(_0x3487cc,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c486fa1..eeffe37 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 _0xa47e=['lodash','util','moment','bluebird','rimraf','define','VoiceQueuesLog','event','dtm'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa47e,0x1a7));var _0xea47=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa47e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xea47('0x0'));var util=require(_0xea47('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xea47('0x2'));var BPromise=require(_0xea47('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xea47('0x4'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0xac2164,_0x58bb83){return _0xac2164[_0xea47('0x5')](_0xea47('0x6'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xea47('0x7'),_0xea47('0x8')]}],'timestamps':![]});}; \ No newline at end of file +var _0xa47e=['lodash','util','moment','bluebird','rimraf','define','VoiceQueuesLog','event','dtm'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xa47e,0x1a7));var _0xea47=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa47e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xea47('0x0'));var util=require(_0xea47('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xea47('0x2'));var BPromise=require(_0xea47('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xea47('0x4'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0xac2164,_0x58bb83){return _0xac2164[_0xea47('0x5')](_0xea47('0x6'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xea47('0x7'),_0xea47('0x8')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 99b06a4..d063979 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 _0x1bb2=['../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x9f02e9,_0x96bc30){var _0x44df6d=function(_0x16fc8e){while(--_0x16fc8e){_0x9f02e9['push'](_0x9f02e9['shift']());}};_0x44df6d(++_0x96bc30);}(_0x1bb2,0x152));var _0x21bb=function(_0x45ccf3,_0x459143){_0x45ccf3=_0x45ccf3-0x0;var _0x2cc830=_0x1bb2[_0x45ccf3];return _0x2cc830;};'use strict';var _=require('lodash');var util=require(_0x21bb('0x0'));var moment=require(_0x21bb('0x1'));var BPromise=require(_0x21bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21bb('0x3'))['db'];var utils=require(_0x21bb('0x4'));var logger=require(_0x21bb('0x5'))(_0x21bb('0x6'));var config=require(_0x21bb('0x7'));var jayson=require(_0x21bb('0x8'));var client=jayson[_0x21bb('0x9')][_0x21bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36217b,_0x330447,_0x642998){return new BPromise(function(_0x316b77,_0x5af85f){return client[_0x21bb('0xb')](_0x36217b,_0x642998)['then'](function(_0x300c15){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x330447,_0x21bb('0xc'));logger[_0x21bb('0xd')](_0x21bb('0xe'),_0x330447,_0x21bb('0xc'),JSON[_0x21bb('0xf')](_0x300c15));if(_0x300c15[_0x21bb('0x10')]){if(_0x300c15[_0x21bb('0x10')][_0x21bb('0x11')]===0x1f4){logger['error'](_0x21bb('0x12'),_0x330447,_0x300c15[_0x21bb('0x10')]['message']);return _0x5af85f(_0x300c15[_0x21bb('0x10')][_0x21bb('0x13')]);}logger['error'](_0x21bb('0x12'),_0x330447,_0x300c15[_0x21bb('0x10')][_0x21bb('0x13')]);return _0x316b77(_0x300c15[_0x21bb('0x10')]['message']);}else{logger[_0x21bb('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x330447,'request\x20sent');_0x316b77(_0x300c15[_0x21bb('0x15')][_0x21bb('0x13')]);}})[_0x21bb('0x16')](function(_0x465f5e){logger[_0x21bb('0x10')](_0x21bb('0x12'),_0x330447,_0x465f5e);_0x5af85f(_0x465f5e);});});} \ No newline at end of file +var _0x58ea=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','util'];(function(_0x36f649,_0x3331a4){var _0x3f9743=function(_0x27b990){while(--_0x27b990){_0x36f649['push'](_0x36f649['shift']());}};_0x3f9743(++_0x3331a4);}(_0x58ea,0xa7));var _0xa58e=function(_0x54be73,_0x387ba7){_0x54be73=_0x54be73-0x0;var _0x19773e=_0x58ea[_0x54be73];return _0x19773e;};'use strict';var _=require('lodash');var util=require(_0xa58e('0x0'));var moment=require(_0xa58e('0x1'));var BPromise=require(_0xa58e('0x2'));var rs=require(_0xa58e('0x3'));var fs=require('fs');var Redis=require(_0xa58e('0x4'));var db=require(_0xa58e('0x5'))['db'];var utils=require(_0xa58e('0x6'));var logger=require(_0xa58e('0x7'))(_0xa58e('0x8'));var config=require(_0xa58e('0x9'));var jayson=require(_0xa58e('0xa'));var client=jayson[_0xa58e('0xb')][_0xa58e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c1e42,_0x4b01e2,_0xf9c3e5){return new BPromise(function(_0x45426f,_0x59ab7){return client['request'](_0x2c1e42,_0xf9c3e5)[_0xa58e('0xd')](function(_0xf5561e){logger[_0xa58e('0xe')](_0xa58e('0xf'),_0x4b01e2,'request\x20sent');logger[_0xa58e('0x10')](_0xa58e('0x11'),_0x4b01e2,'request\x20sent',JSON['stringify'](_0xf5561e));if(_0xf5561e['error']){if(_0xf5561e[_0xa58e('0x12')][_0xa58e('0x13')]===0x1f4){logger[_0xa58e('0x12')](_0xa58e('0xf'),_0x4b01e2,_0xf5561e[_0xa58e('0x12')][_0xa58e('0x14')]);return _0x59ab7(_0xf5561e['error']['message']);}logger[_0xa58e('0x12')](_0xa58e('0xf'),_0x4b01e2,_0xf5561e['error'][_0xa58e('0x14')]);return _0x45426f(_0xf5561e[_0xa58e('0x12')][_0xa58e('0x14')]);}else{logger[_0xa58e('0xe')](_0xa58e('0xf'),_0x4b01e2,_0xa58e('0x15'));_0x45426f(_0xf5561e[_0xa58e('0x16')][_0xa58e('0x14')]);}})[_0xa58e('0x17')](function(_0x724b85){logger[_0xa58e('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4b01e2,_0x724b85);_0x59ab7(_0x724b85);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 6f5f3d2..5b4ee10 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 _0xb4c9=['./voiceRecording.controller','get','index','/describe','isAuthenticated','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','put','/:id','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x2873e6,_0x4d5b61){var _0x3a92eb=function(_0x5136e0){while(--_0x5136e0){_0x2873e6['push'](_0x2873e6['shift']());}};_0x3a92eb(++_0x4d5b61);}(_0xb4c9,0x1c2));var _0x9b4c=function(_0x6932d1,_0x3a210c){_0x6932d1=_0x6932d1-0x0;var _0x753c09=_0xb4c9[_0x6932d1];return _0x753c09;};'use strict';var multer=require(_0x9b4c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9b4c('0x1'));var express=require(_0x9b4c('0x2'));var router=express[_0x9b4c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9b4c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9b4c('0x5'));var controller=require(_0x9b4c('0x6'));router[_0x9b4c('0x7')]('/',auth['isAuthenticated'](),controller[_0x9b4c('0x8')]);router[_0x9b4c('0x7')](_0x9b4c('0x9'),auth[_0x9b4c('0xa')](),controller['describe']);router['get']('/:id',auth[_0x9b4c('0xa')](),controller[_0x9b4c('0xb')]);router[_0x9b4c('0x7')](_0x9b4c('0xc'),auth[_0x9b4c('0xa')](),controller['download']);router[_0x9b4c('0x7')](_0x9b4c('0xd'),controller[_0x9b4c('0xe')]);router[_0x9b4c('0x7')](_0x9b4c('0xf'),auth[_0x9b4c('0xa')](),controller[_0x9b4c('0x10')]);router[_0x9b4c('0x11')]('/',auth[_0x9b4c('0xa')](),controller[_0x9b4c('0x12')]);router[_0x9b4c('0x11')](_0x9b4c('0xf'),auth['isAuthenticated'](),controller['runTranscribe']);router[_0x9b4c('0x13')](_0x9b4c('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x9b4c('0x15')](_0x9b4c('0x14'),auth[_0x9b4c('0xa')](),controller[_0x9b4c('0x16')]);module[_0x9b4c('0x17')]=router; \ No newline at end of file +var _0xba54=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe','download','downloads','/:id/transcribe','post','create','put','/:id','update','exports','multer'];(function(_0x1430ce,_0x54d917){var _0x5ccc06=function(_0x4c3fbd){while(--_0x4c3fbd){_0x1430ce['push'](_0x1430ce['shift']());}};_0x5ccc06(++_0x54d917);}(_0xba54,0x149));var _0x4ba5=function(_0x495ad8,_0x5ab83c){_0x495ad8=_0x495ad8-0x0;var _0x227fad=_0xba54[_0x495ad8];return _0x227fad;};'use strict';var multer=require(_0x4ba5('0x0'));var util=require('util');var path=require(_0x4ba5('0x1'));var timeout=require(_0x4ba5('0x2'));var express=require(_0x4ba5('0x3'));var router=express[_0x4ba5('0x4')]();var fs_extra=require(_0x4ba5('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ba5('0x6'));var controller=require(_0x4ba5('0x7'));router['get']('/',auth[_0x4ba5('0x8')](),controller[_0x4ba5('0x9')]);router[_0x4ba5('0xa')](_0x4ba5('0xb'),auth[_0x4ba5('0x8')](),controller[_0x4ba5('0xc')]);router['get']('/:id',auth[_0x4ba5('0x8')](),controller['show']);router['get']('/:id/download',auth[_0x4ba5('0x8')](),controller[_0x4ba5('0xd')]);router[_0x4ba5('0xa')]('/:id/downloads',controller[_0x4ba5('0xe')]);router['get'](_0x4ba5('0xf'),auth[_0x4ba5('0x8')](),controller['downloadTranscribe']);router[_0x4ba5('0x10')]('/',auth['isAuthenticated'](),controller[_0x4ba5('0x11')]);router[_0x4ba5('0x10')]('/:id/transcribe',auth['isAuthenticated'](),controller['runTranscribe']);router[_0x4ba5('0x12')](_0x4ba5('0x13'),auth[_0x4ba5('0x8')](),controller[_0x4ba5('0x14')]);router['delete']('/:id',auth[_0x4ba5('0x8')](),controller['destroy']);module[_0x4ba5('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 94f6d9a..eca8c3e 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(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 7ca42ff..c42bf54 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 _0x57d4=['papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','download','message','sequelize','MD5','col','token','$and','push','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','upload','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','transcribe','transcribeAccountId','transcribeRegion','runSentiment','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','findOne','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','IN_PROGRESS','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1b564b,_0x3cad93){var _0xddceb8=function(_0x4ef160){while(--_0x4ef160){_0x1b564b['push'](_0x1b564b['shift']());}};_0xddceb8(++_0x3cad93);}(_0x57d4,0x1b9));var _0x457d=function(_0x4c3ae3,_0x460ac9){_0x4c3ae3=_0x4c3ae3-0x0;var _0x45e95a=_0x57d4[_0x4c3ae3];return _0x45e95a;};'use strict';var emlformat=require(_0x457d('0x0'));var rimraf=require(_0x457d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x457d('0x2'));var rp=require(_0x457d('0x3'));var moment=require(_0x457d('0x4'));var BPromise=require(_0x457d('0x5'));var Mustache=require(_0x457d('0x6'));var util=require(_0x457d('0x7'));var path=require(_0x457d('0x8'));var sox=require(_0x457d('0x9'));var csv=require(_0x457d('0xa'));var ejs=require(_0x457d('0xb'));var fs=require('fs');var fs_extra=require(_0x457d('0xc'));var _=require('lodash');var squel=require(_0x457d('0xd'));var crypto=require(_0x457d('0xe'));var jsforce=require(_0x457d('0xf'));var deskjs=require(_0x457d('0x10'));var toCsv=require(_0x457d('0xa'));var querystring=require(_0x457d('0x11'));var Papa=require(_0x457d('0x12'));var AWS=require(_0x457d('0x13'));var uuidv4=require(_0x457d('0x14'));var Redis=require(_0x457d('0x15'));var authService=require(_0x457d('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0x457d('0x17'));var hardwareService=require(_0x457d('0x18'));var logger=require(_0x457d('0x19'))('api');var utils=require(_0x457d('0x1a'));var config=require(_0x457d('0x1b'));var licenseUtil=require(_0x457d('0x1c'));var db=require(_0x457d('0x1d'))['db'];function respondWithStatusCode(_0x5cb21d,_0xced13b){_0xced13b=_0xced13b||0xcc;return function(_0x22fb8f){if(_0x22fb8f){return _0x5cb21d[_0x457d('0x1e')](_0xced13b);}return _0x5cb21d['status'](_0xced13b)[_0x457d('0x1f')]();};}function respondWithResult(_0x26e1f7,_0x421fce){_0x421fce=_0x421fce||0xc8;return function(_0x1840e9){if(_0x1840e9){return _0x26e1f7[_0x457d('0x20')](_0x421fce)[_0x457d('0x21')](_0x1840e9);}};}function respondWithFilteredResult(_0x4deba6,_0x58238f){return function(_0x548e53){if(_0x548e53){var _0x4e6ecf=typeof _0x58238f[_0x457d('0x22')]===_0x457d('0x23')&&typeof _0x58238f[_0x457d('0x24')]===_0x457d('0x23');var _0x2e50b7=_0x548e53[_0x457d('0x25')];var _0x52aabb=_0x4e6ecf?0x0:_0x58238f['offset'];var _0x11025c=_0x4e6ecf?_0x548e53[_0x457d('0x25')]:_0x58238f[_0x457d('0x22')]+_0x58238f['limit'];var _0xc24d13;if(_0x11025c>=_0x2e50b7){_0x11025c=_0x2e50b7;_0xc24d13=0xc8;}else{_0xc24d13=0xce;}_0x4deba6[_0x457d('0x20')](_0xc24d13);return _0x4deba6[_0x457d('0x26')](_0x457d('0x27'),_0x52aabb+'-'+_0x11025c+'/'+_0x2e50b7)['json'](_0x548e53);}return null;};}function patchUpdates(_0x3f4612){return function(_0x34c956){try{jsonpatch['apply'](_0x34c956,_0x3f4612,!![]);}catch(_0x39724b){return BPromise[_0x457d('0x28')](_0x39724b);}return _0x34c956[_0x457d('0x29')]();};}function saveUpdates(_0x517b69,_0x205f50){return function(_0x8c2a5){if(_0x8c2a5){return _0x8c2a5[_0x457d('0x2a')](_0x517b69)[_0x457d('0x2b')](function(_0x188ab0){return _0x188ab0;});}return null;};}function removeEntity(_0x59c577,_0x4df7d0){return function(_0x91fd5d){if(_0x91fd5d){return _0x91fd5d[_0x457d('0x2c')]()[_0x457d('0x2b')](function(){_0x59c577[_0x457d('0x20')](0xcc)[_0x457d('0x1f')]();});}};}function handleEntityNotFound(_0x9c582d,_0x362edb){return function(_0x11a92e){if(!_0x11a92e){_0x9c582d['sendStatus'](0x194);}return _0x11a92e;};}function handleError(_0x413daa,_0x15241f){_0x15241f=_0x15241f||0x1f4;return function(_0x368598){logger['error'](_0x368598[_0x457d('0x2d')]);if(_0x368598[_0x457d('0x2e')]){delete _0x368598['name'];}_0x413daa['status'](_0x15241f)[_0x457d('0x2f')](_0x368598);};}exports[_0x457d('0x30')]=function(_0x260187,_0x508684){var _0x1533d0={},_0x4c7547={},_0x4b04cc={'count':0x0,'rows':[]};var _0x50404d=_[_0x457d('0x31')](db[_0x457d('0x32')][_0x457d('0x33')],function(_0x426cb6){return{'name':_0x426cb6[_0x457d('0x34')],'type':_0x426cb6[_0x457d('0x35')]['key']};});_0x4c7547[_0x457d('0x36')]=_[_0x457d('0x37')](_[_0x457d('0x31')](_0x50404d,'name'),['format']);_0x4c7547[_0x457d('0x38')]=_[_0x457d('0x39')](_0x260187[_0x457d('0x38')]);_0x4c7547[_0x457d('0x3a')]=_[_0x457d('0x3b')](_0x4c7547['model'],_0x4c7547['query']);_0x1533d0[_0x457d('0x3c')]=_[_0x457d('0x3b')](_0x4c7547[_0x457d('0x36')],qs[_0x457d('0x3d')](_0x260187[_0x457d('0x38')][_0x457d('0x3d')]));_0x1533d0[_0x457d('0x3c')]=_0x1533d0[_0x457d('0x3c')][_0x457d('0x3e')]?_0x1533d0[_0x457d('0x3c')]:_0x4c7547[_0x457d('0x36')];if(!_0x260187[_0x457d('0x38')][_0x457d('0x3f')](_0x457d('0x40'))){_0x1533d0[_0x457d('0x24')]=qs['limit'](_0x260187['query'][_0x457d('0x24')]);_0x1533d0[_0x457d('0x22')]=qs[_0x457d('0x22')](_0x260187[_0x457d('0x38')][_0x457d('0x22')]);}_0x1533d0['order']=qs[_0x457d('0x41')](_0x260187[_0x457d('0x38')][_0x457d('0x41')]);_0x1533d0[_0x457d('0x42')]=qs[_0x457d('0x3a')](_[_0x457d('0x43')](_0x260187[_0x457d('0x38')],_0x4c7547[_0x457d('0x3a')]),_0x50404d);if(_0x260187[_0x457d('0x38')][_0x457d('0x44')]){_0x1533d0[_0x457d('0x42')]=_[_0x457d('0x45')](_0x1533d0[_0x457d('0x42')],{'$or':_['map'](_0x50404d,function(_0x527e55){if(_0x527e55[_0x457d('0x35')]!==_0x457d('0x46')){var _0x14bf06={};_0x14bf06[_0x527e55[_0x457d('0x2e')]]={'$like':'%'+_0x260187[_0x457d('0x38')]['filter']+'%'};return _0x14bf06;}})});}_0x1533d0=_[_0x457d('0x45')]({},_0x1533d0,_0x260187[_0x457d('0x47')]);var _0x295d33={'where':_0x1533d0['where']};return db[_0x457d('0x32')][_0x457d('0x25')](_0x295d33)[_0x457d('0x2b')](function(_0x447a14){_0x4b04cc[_0x457d('0x25')]=_0x447a14;if(_0x260187[_0x457d('0x38')][_0x457d('0x48')]){_0x1533d0[_0x457d('0x49')]=[{'all':!![]}];}return db[_0x457d('0x32')][_0x457d('0x4a')](_0x1533d0);})[_0x457d('0x2b')](function(_0x571bf3){_0x4b04cc['rows']=_0x571bf3;return _0x4b04cc;})[_0x457d('0x2b')](respondWithFilteredResult(_0x508684,_0x1533d0))[_0x457d('0x4b')](handleError(_0x508684,null));};exports[_0x457d('0x4c')]=function(_0x5c83df,_0x57b714){var _0x1a1b1b={'raw':![],'where':{'id':_0x5c83df[_0x457d('0x4d')]['id']}},_0x2d2983={};_0x2d2983['model']=_[_0x457d('0x39')](db[_0x457d('0x32')][_0x457d('0x33')]);_0x2d2983[_0x457d('0x38')]=_[_0x457d('0x39')](_0x5c83df[_0x457d('0x38')]);_0x2d2983[_0x457d('0x3a')]=_[_0x457d('0x3b')](_0x2d2983[_0x457d('0x36')],_0x2d2983[_0x457d('0x38')]);_0x1a1b1b['attributes']=_['intersection'](_0x2d2983[_0x457d('0x36')],qs[_0x457d('0x3d')](_0x5c83df[_0x457d('0x38')]['fields']));_0x1a1b1b[_0x457d('0x3c')]=_0x1a1b1b['attributes'][_0x457d('0x3e')]?_0x1a1b1b['attributes']:_0x2d2983[_0x457d('0x36')];if(_0x5c83df[_0x457d('0x38')][_0x457d('0x48')]){_0x1a1b1b[_0x457d('0x49')]=[{'all':!![]}];}_0x1a1b1b=_['merge']({},_0x1a1b1b,_0x5c83df[_0x457d('0x47')]);return db[_0x457d('0x32')][_0x457d('0x4e')](_0x1a1b1b)[_0x457d('0x2b')](handleEntityNotFound(_0x57b714,null))[_0x457d('0x2b')](respondWithResult(_0x57b714,null))[_0x457d('0x4b')](handleError(_0x57b714,null));};exports[_0x457d('0x4f')]=function(_0x422c8d,_0x297ed0){return db[_0x457d('0x32')][_0x457d('0x4f')](_0x422c8d['body'],{})[_0x457d('0x2b')](respondWithResult(_0x297ed0,0xc9))[_0x457d('0x4b')](handleError(_0x297ed0,null));};exports[_0x457d('0x2a')]=function(_0x273bd2,_0x319d2c){if(_0x273bd2[_0x457d('0x50')]['id']){delete _0x273bd2[_0x457d('0x50')]['id'];}return db[_0x457d('0x32')][_0x457d('0x4e')]({'where':{'id':_0x273bd2[_0x457d('0x4d')]['id']}})[_0x457d('0x2b')](handleEntityNotFound(_0x319d2c,null))[_0x457d('0x2b')](saveUpdates(_0x273bd2[_0x457d('0x50')],null))[_0x457d('0x2b')](respondWithResult(_0x319d2c,null))[_0x457d('0x4b')](handleError(_0x319d2c,null));};exports[_0x457d('0x51')]=function(_0x23dd9d,_0x39719d){return db[_0x457d('0x32')][_0x457d('0x51')]()[_0x457d('0x2b')](respondWithResult(_0x39719d,null))[_0x457d('0x4b')](handleError(_0x39719d,null));};exports['download']=function(_0x3aa243,_0x2b3951,_0x3f7ad3){var _0x201491=require(_0x457d('0x52'));var _0x20525b=![];var _0x149ac3={};if(_0x3aa243['query'][_0x457d('0x35')]&&_0x3aa243[_0x457d('0x38')][_0x457d('0x35')]===_0x457d('0x53')){_0x149ac3[_0x457d('0x53')]=_0x3aa243[_0x457d('0x4d')]['id'];}else{_0x149ac3['id']=_0x3aa243[_0x457d('0x4d')]['id'];}return db[_0x457d('0x32')][_0x457d('0x4e')]({'where':_0x149ac3,'attributes':['id',_0x457d('0x54')],'raw':!![]})[_0x457d('0x2b')](handleEntityNotFound(_0x2b3951,null))[_0x457d('0x2b')](function(_0x4a39ed){if(_0x4a39ed){var _0x45d1d4=_0x4a39ed[_0x457d('0x54')];var _0x46f76a=util[_0x457d('0x55')](_0x457d('0x56'),_0x45d1d4);if(fs[_0x457d('0x57')](_0x46f76a)){_0x20525b=!![];return _0x201491[_0x457d('0x58')](_0x46f76a,_0x45d1d4,config[_0x457d('0x59')][_0x457d('0x5a')])[_0x457d('0x2b')](function(){return _0x4a39ed;});}return _0x4a39ed;}})[_0x457d('0x2b')](function(_0xce977){if(_0xce977){var _0x35429d=_0xce977[_0x457d('0x54')];if(!fs[_0x457d('0x57')](_0x35429d)){throw new db[(_0x457d('0x5b'))][(_0x457d('0x5c'))](_0x457d('0x5d'));}if(_0xce977[_0x457d('0x5e')]){return _0x2b3951['download'](_0x35429d,_0xce977['filename']+path[_0x457d('0x5f')](_0x35429d),function(){if(_0x20525b){fs[_0x457d('0x60')](_0x35429d);}});}else{return _0x2b3951[_0x457d('0x61')](_0x35429d,function(_0x2ea9e5){if(_0x20525b){fs[_0x457d('0x60')](_0x35429d);}});}}})[_0x457d('0x4b')](function(_0x46db72){if(_0x46db72[_0x457d('0x62')]===_0x457d('0x5d')){_0x2b3951[_0x457d('0x20')](0x194)['send']('Not\x20found');}else{return handleError(_0x2b3951,null);}});};exports['downloads']=function(_0x138203,_0x4a5d8f,_0x49cc60){var _0x3cff43=require(_0x457d('0x52'));var _0x1a7f5=![];var _0x20428e={'$and':[db[_0x457d('0x63')]['where'](db[_0x457d('0x63')]['fn'](_0x457d('0x64'),db[_0x457d('0x63')][_0x457d('0x65')](_0x457d('0x53'))),_0x138203[_0x457d('0x38')][_0x457d('0x66')])]};if(_0x138203['query'][_0x457d('0x35')]&&_0x138203[_0x457d('0x38')][_0x457d('0x35')]===_0x457d('0x53')){_0x20428e[_0x457d('0x67')][_0x457d('0x68')]({'uniqueid':_0x138203[_0x457d('0x4d')]['id']});}else{_0x20428e[_0x457d('0x67')][_0x457d('0x68')]({'id':_0x138203['params']['id']});}return db[_0x457d('0x32')][_0x457d('0x4e')]({'where':_0x20428e,'attributes':['id',_0x457d('0x54')],'raw':!![]})[_0x457d('0x2b')](handleEntityNotFound(_0x4a5d8f,null))[_0x457d('0x2b')](function(_0x11a3fe){if(_0x11a3fe){var _0x59cb0a=util[_0x457d('0x55')]('%s.cypher',_0x11a3fe[_0x457d('0x54')]);if(fs[_0x457d('0x57')](_0x59cb0a)){_0x1a7f5=!![];return _0x3cff43[_0x457d('0x58')](_0x59cb0a,_0x11a3fe[_0x457d('0x54')],config[_0x457d('0x59')]['recording'])['then'](function(){return _0x11a3fe;});}return _0x11a3fe;}})['then'](function(_0x5707ae){if(_0x5707ae){if(!fs[_0x457d('0x57')](_0x5707ae['value'])){throw new db['Sequelize']['ValidationError'](_0x457d('0x5d'));}if(_0x5707ae[_0x457d('0x5e')]){return _0x4a5d8f[_0x457d('0x61')](_0x5707ae['value'],_0x5707ae[_0x457d('0x5e')]+path[_0x457d('0x5f')](_0x5707ae[_0x457d('0x54')]),function(){if(_0x1a7f5){fs['unlink'](_0x5707ae[_0x457d('0x54')]);}});}else{return _0x4a5d8f[_0x457d('0x61')](_0x5707ae[_0x457d('0x54')],function(_0x4e7a85){if(_0x1a7f5){fs[_0x457d('0x60')](_0x5707ae[_0x457d('0x54')]);}});}}})[_0x457d('0x4b')](handleError(_0x4a5d8f,null));};exports[_0x457d('0x2c')]=function(_0x55836f,_0x1f99ef){return db[_0x457d('0x32')][_0x457d('0x4e')]({'where':{'id':_0x55836f[_0x457d('0x4d')]['id']}})[_0x457d('0x2b')](function(_0x1b2c3d){if(_[_0x457d('0x69')](_0x1b2c3d)){throw new ReferenceError(_0x457d('0x6a'));}return _0x1b2c3d;})[_0x457d('0x2b')](function(_0x55b20b){var _0xf71e53=_0x55b20b[_0x457d('0x54')];logger[_0x457d('0x6b')]('cancellazione\x20fisica\x20documento\x20%s',_0xf71e53);if(!_[_0x457d('0x69')](_0x55b20b[_0x457d('0x54')])&&fs[_0x457d('0x57')](_0xf71e53)){logger[_0x457d('0x6b')](_0x457d('0x6c')+_0xf71e53+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x457d('0x6d')](_0xf71e53);}_0xf71e53=_0xf71e53+'.cypher';if(!_[_0x457d('0x69')](_0x55b20b[_0x457d('0x54')])&&fs['existsSync'](_0xf71e53)){logger[_0x457d('0x6b')](_0x457d('0x6c')+_0xf71e53+_0x457d('0x6e'));fs[_0x457d('0x6d')](_0xf71e53);}return _0x55b20b;})[_0x457d('0x2b')](function(_0x507492){if(!_0x507492)throw new InternalError();return _0x507492[_0x457d('0x2c')]();})[_0x457d('0x2b')](function(){_0x1f99ef['status'](0xcc)['end']();})[_0x457d('0x4b')](handleError(_0x1f99ef,null));};function getBucketslist(_0x102570,_0x326cb1,_0x5b2c8e){return new Promise(function(_0xedd34b,_0x486fa2){var _0x34b77a=new AWS['S3']({'accessKeyId':_0x326cb1,'secretAccessKey':_0x102570,'region':_0x5b2c8e});_0x34b77a[_0x457d('0x6f')]({},function(_0x41917c,_0x4ad19e){if(_0x41917c){return _0x486fa2(_0x41917c);}else{return _0xedd34b(_0x4ad19e);}});});}function createBucket(_0x4cddae,_0xf9ac1a,_0x24097a,_0x39f8a5){return new Promise(function(_0x54e034,_0xf4fc21){var _0x3c68eb=new AWS['S3']({'accessKeyId':_0xf9ac1a,'secretAccessKey':_0x4cddae,'region':_0x24097a});_0x3c68eb['createBucket']({'Bucket':_0x39f8a5},function(_0x3c801c,_0x5d05d6){if(_0x3c801c){return _0xf4fc21(_0x3c801c);}else{return _0x54e034(_0x5d05d6);}});});}function uploadFile(_0x49f324,_0x48fea2,_0x460213,_0x52df09,_0x19443b,_0xdac9d){return new Promise(function(_0x16c005,_0x52c90a){var _0x565499=new AWS['S3']({'accessKeyId':_0x48fea2,'secretAccessKey':_0x49f324,'region':_0x460213});_0x565499[_0x457d('0x70')]({'Bucket':_0x52df09,'Key':_0x19443b,'Body':_0xdac9d},function(_0x1b2d7e,_0x16ff21){if(_0x1b2d7e){return _0x52c90a(_0x1b2d7e);}else{return _0x16c005(_0x16ff21);}});});}function startTranscribe(_0x4bfa9e,_0x5dd832,_0x18deed,_0x5e7596,_0x27b605,_0x559f74){return new Promise(function(_0x534a2a,_0x3402cb){var _0x5ab300=new AWS['TranscribeService']({'accessKeyId':_0x5dd832,'secretAccessKey':_0x4bfa9e,'region':_0x18deed});_0x5ab300[_0x457d('0x71')]({'TranscriptionJobName':_0x5e7596,'LanguageCode':_0x27b605,'Media':{'MediaFileUri':_0x559f74}},function(_0x38d4c5,_0x32e9f1){if(_0x38d4c5){return _0x3402cb(_0x38d4c5);}else{return _0x534a2a(_0x32e9f1);}});});}function transcribe(_0x1b3b86,_0x73f385,_0xf68c15,_0x3fe0a6,_0x3ffb13,_0x4ccdd1,_0x5a4d4a){return new Promise(function(_0x2a6e5b,_0x3dda51){var _0x3956a3={};logger[_0x457d('0x6b')](util[_0x457d('0x55')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x1b3b86,_0x3ffb13));return uploadFile(_0x73f385,_0xf68c15,_0x3fe0a6,_0x3ffb13,path[_0x457d('0x72')](_0x4ccdd1),fs[_0x457d('0x73')](_0x4ccdd1))[_0x457d('0x2b')](function(_0x28abe2){logger[_0x457d('0x6b')](util['format'](_0x457d('0x74'),_0x1b3b86,_0x3ffb13,_0x28abe2[_0x457d('0x75')]));_0x3956a3[_0x457d('0x76')]=_0x28abe2[_0x457d('0x77')];_0x3956a3[_0x457d('0x78')]=_0x28abe2[_0x457d('0x75')];logger[_0x457d('0x6b')](util[_0x457d('0x55')](_0x457d('0x79'),_0x1b3b86));return startTranscribe(_0x73f385,_0xf68c15,_0x3fe0a6,uuidv4(),_0x5a4d4a,_0x28abe2['Location']);})['then'](function(_0x1505f8){logger['info'](util[_0x457d('0x55')](_0x457d('0x7a'),_0x1b3b86,_0x1505f8[_0x457d('0x7b')][_0x457d('0x7c')]));_0x3956a3[_0x457d('0x7d')]=_0x1505f8['TranscriptionJob'][_0x457d('0x7c')];_0x3956a3[_0x457d('0x7e')]=_0x1505f8[_0x457d('0x7b')][_0x457d('0x7f')];return _0x2a6e5b(_0x3956a3);})[_0x457d('0x4b')](function(_0x4c84b1){return _0x3dda51(_0x4c84b1);});});}exports[_0x457d('0x80')]=function(_0x866b7,_0x5b0adf,_0x15ff4d){var _0x192d7d;var _0x508c7d;var _0x8b857b;var _0x3c7f1b=require(_0x457d('0x52'));return db[_0x457d('0x32')]['findOne']({'where':{'id':_0x866b7[_0x457d('0x4d')]['id']}})[_0x457d('0x2b')](function(_0x547806){if(_0x547806){var _0x4eb8bd=util['format'](_0x457d('0x56'),_0x547806[_0x457d('0x54')]);if(fs[_0x457d('0x57')](_0x4eb8bd)){cypher=!![];return _0x3c7f1b[_0x457d('0x58')](_0x4eb8bd,_0x547806['value'],config[_0x457d('0x59')][_0x457d('0x5a')])[_0x457d('0x2b')](function(){return _0x547806;});}return _0x547806;}})['then'](function(_0x4d4d88){if(!_0x4d4d88){throw new db[(_0x457d('0x5b'))][(_0x457d('0x5c'))]('Voice\x20Recording\x20not\x20found');}_0x508c7d=_0x4d4d88;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x457d('0x2b')](handleEntityNotFound(_0x5b0adf,null))[_0x457d('0x2b')](function(_0x2e2ecb){if(_0x2e2ecb){_0x192d7d=_0x2e2ecb;if(!_0x192d7d[_0x457d('0x81')]||!_0x192d7d[_0x457d('0x82')]||!_0x192d7d[_0x457d('0x83')]||!_0x192d7d['language']||!_0x192d7d[_0x457d('0x76')]){throw new db[(_0x457d('0x5b'))][(_0x457d('0x5c'))]('Transcribe\x20not\x20configured');}if(_0x866b7[_0x457d('0x50')][_0x457d('0x84')]&&(!_0x192d7d[_0x457d('0x85')]||!_0x192d7d['sentimentAccountId']||!_0x192d7d[_0x457d('0x86')]||!_0x192d7d[_0x457d('0x87')]||!_0x192d7d[_0x457d('0x76')])){throw new db[(_0x457d('0x5b'))][(_0x457d('0x5c'))](_0x457d('0x88'));}return db['CloudProvider'][_0x457d('0x89')]({'where':{'id':_0x192d7d[_0x457d('0x82')]}});}})[_0x457d('0x2b')](function(_0x4e466f){if(!_0x4e466f){throw new db['Sequelize'][(_0x457d('0x5c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4e466f[_0x457d('0x8a')]||!_0x4e466f[_0x457d('0x8b')]){throw new db['Sequelize'][(_0x457d('0x5c'))](_0x457d('0x8c'));}_0x8b857b=_0x4e466f;return getBucketslist(_0x8b857b[_0x457d('0x8a')],_0x8b857b[_0x457d('0x8b')],_0x192d7d[_0x457d('0x83')]);})['then'](function(_0x11b3e6){if(_0x11b3e6&&_0x11b3e6[_0x457d('0x8d')]){var _0x2d0fd6=_[_0x457d('0x4e')](_0x11b3e6[_0x457d('0x8d')],function(_0xa15ef8){return _0xa15ef8[_0x457d('0x8e')]===_0x192d7d['bucket'];});if(!_0x2d0fd6){logger[_0x457d('0x6b')](util[_0x457d('0x55')](_0x457d('0x8f'),_0x866b7[_0x457d('0x4d')]['id'],_0x192d7d[_0x457d('0x76')]));return createBucket(_0x8b857b[_0x457d('0x8a')],_0x8b857b[_0x457d('0x8b')],_0x192d7d[_0x457d('0x83')],_0x192d7d[_0x457d('0x76')]);}logger[_0x457d('0x6b')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x866b7[_0x457d('0x4d')]['id'],_0x192d7d[_0x457d('0x76')]));return;}})[_0x457d('0x2b')](function(_0x5a3510){if(_0x508c7d[_0x457d('0x7e')]===_0x457d('0x90')){return transcribe(_0x866b7['params']['id'],_0x8b857b[_0x457d('0x8a')],_0x8b857b[_0x457d('0x8b')],_0x192d7d[_0x457d('0x83')],_0x192d7d[_0x457d('0x76')],_0x508c7d[_0x457d('0x54')],_0x192d7d[_0x457d('0x87')]);}else{logger['info'](util[_0x457d('0x55')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x866b7['params']['id']));return{'transcribeStatus':_0x457d('0x91')};}})[_0x457d('0x2b')](function(_0x574fce){if(_0x574fce){_0x574fce['tempSentiment']=_0x866b7[_0x457d('0x50')][_0x457d('0x84')];return _0x508c7d['updateAttributes'](_0x574fce);}})[_0x457d('0x2b')](respondWithResult(_0x5b0adf,null))[_0x457d('0x4b')](handleError(_0x5b0adf,null));};function writeFile(_0x50284e,_0x2bf694){return new Promise(function(_0x1c941a,_0xb63afa){fs[_0x457d('0x92')](_0x2bf694,_0x50284e,function(_0x32474c,_0x3fd775){if(_0x32474c){return _0xb63afa(_0x32474c);}else{return _0x1c941a(_0x3fd775);}});});}exports[_0x457d('0x93')]=function(_0x15ab98,_0x2cbfbf,_0x4ae6a9){return db['VoiceRecording'][_0x457d('0x89')]({'where':{'id':_0x15ab98['params']['id']}})[_0x457d('0x2b')](handleEntityNotFound(_0x2cbfbf))[_0x457d('0x2b')](function(_0xe6ac04){if(_0xe6ac04&&_0xe6ac04[_0x457d('0x94')]){var _0x582b7f=_0xe6ac04[_0x457d('0x94')];var _0x3032a1=config[_0x457d('0x95')]+_0x457d('0x96')+_0xe6ac04['id']+_0x457d('0x97');if(fs[_0x457d('0x57')](_0x3032a1)){return _0x3032a1;}return writeFile(_0x582b7f,_0x3032a1)[_0x457d('0x2b')](function(){return _0x3032a1;});}else{throw new db[(_0x457d('0x5b'))][(_0x457d('0x5c'))](_0x457d('0x98'));}})['then'](function(_0x3791f7){return _0x2cbfbf[_0x457d('0x61')](_0x3791f7);})[_0x457d('0x4b')](handleError(_0x2cbfbf));}; \ No newline at end of file +var _0x7a43=['../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','format','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','describe','download','../../components/encryptor','type','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch'];(function(_0x4aba0e,_0x3cca89){var _0x240301=function(_0x376410){while(--_0x376410){_0x4aba0e['push'](_0x4aba0e['shift']());}};_0x240301(++_0x3cca89);}(_0x7a43,0x85));var _0x37a4=function(_0x38435b,_0x3c6e54){_0x38435b=_0x38435b-0x0;var _0x4d45ec=_0x7a43[_0x38435b];return _0x4d45ec;};'use strict';var emlformat=require(_0x37a4('0x0'));var rimraf=require(_0x37a4('0x1'));var zipdir=require(_0x37a4('0x2'));var jsonpatch=require(_0x37a4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x37a4('0x4'));var Mustache=require(_0x37a4('0x5'));var util=require(_0x37a4('0x6'));var path=require(_0x37a4('0x7'));var sox=require(_0x37a4('0x8'));var csv=require(_0x37a4('0x9'));var ejs=require(_0x37a4('0xa'));var fs=require('fs');var fs_extra=require(_0x37a4('0xb'));var _=require(_0x37a4('0xc'));var squel=require('squel');var crypto=require(_0x37a4('0xd'));var jsforce=require(_0x37a4('0xe'));var deskjs=require(_0x37a4('0xf'));var toCsv=require(_0x37a4('0x9'));var querystring=require(_0x37a4('0x10'));var Papa=require(_0x37a4('0x11'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x37a4('0x12'));var hardwareService=require(_0x37a4('0x13'));var logger=require('../../config/logger')(_0x37a4('0x14'));var utils=require(_0x37a4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x37a4('0x16'));var db=require(_0x37a4('0x17'))['db'];function respondWithStatusCode(_0x5cdb7e,_0x511356){_0x511356=_0x511356||0xcc;return function(_0x237e30){if(_0x237e30){return _0x5cdb7e[_0x37a4('0x18')](_0x511356);}return _0x5cdb7e[_0x37a4('0x19')](_0x511356)[_0x37a4('0x1a')]();};}function respondWithResult(_0x2e7450,_0x4aff64){_0x4aff64=_0x4aff64||0xc8;return function(_0x372947){if(_0x372947){return _0x2e7450[_0x37a4('0x19')](_0x4aff64)['json'](_0x372947);}};}function respondWithFilteredResult(_0x2088b0,_0x4005f2){return function(_0x2bb0d7){if(_0x2bb0d7){var _0x5ac46a=typeof _0x4005f2[_0x37a4('0x1b')]==='undefined'&&typeof _0x4005f2[_0x37a4('0x1c')]===_0x37a4('0x1d');var _0x3aca85=_0x2bb0d7[_0x37a4('0x1e')];var _0x24be5b=_0x5ac46a?0x0:_0x4005f2[_0x37a4('0x1b')];var _0x47d2da=_0x5ac46a?_0x2bb0d7['count']:_0x4005f2[_0x37a4('0x1b')]+_0x4005f2[_0x37a4('0x1c')];var _0x573796;if(_0x47d2da>=_0x3aca85){_0x47d2da=_0x3aca85;_0x573796=0xc8;}else{_0x573796=0xce;}_0x2088b0[_0x37a4('0x19')](_0x573796);return _0x2088b0[_0x37a4('0x1f')](_0x37a4('0x20'),_0x24be5b+'-'+_0x47d2da+'/'+_0x3aca85)[_0x37a4('0x21')](_0x2bb0d7);}return null;};}function patchUpdates(_0x55b434){return function(_0x42ab5f){try{jsonpatch[_0x37a4('0x22')](_0x42ab5f,_0x55b434,!![]);}catch(_0x40db4f){return BPromise[_0x37a4('0x23')](_0x40db4f);}return _0x42ab5f[_0x37a4('0x24')]();};}function saveUpdates(_0xf71fab,_0x489429){return function(_0x2d4e71){if(_0x2d4e71){return _0x2d4e71[_0x37a4('0x25')](_0xf71fab)['then'](function(_0x48aa06){return _0x48aa06;});}return null;};}function removeEntity(_0x2cb239,_0x1933ec){return function(_0x50148d){if(_0x50148d){return _0x50148d['destroy']()[_0x37a4('0x26')](function(){_0x2cb239[_0x37a4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10dfb5,_0x3a6501){return function(_0x7afe63){if(!_0x7afe63){_0x10dfb5[_0x37a4('0x18')](0x194);}return _0x7afe63;};}function handleError(_0x1472dd,_0x364d82){_0x364d82=_0x364d82||0x1f4;return function(_0x53fbbe){logger[_0x37a4('0x27')](_0x53fbbe[_0x37a4('0x28')]);if(_0x53fbbe[_0x37a4('0x29')]){delete _0x53fbbe[_0x37a4('0x29')];}_0x1472dd[_0x37a4('0x19')](_0x364d82)[_0x37a4('0x2a')](_0x53fbbe);};}exports[_0x37a4('0x2b')]=function(_0x1008c2,_0x704233){var _0x372d89={},_0x5714cf={},_0x2b8fcb={'count':0x0,'rows':[]};var _0x383927=_[_0x37a4('0x2c')](db[_0x37a4('0x2d')][_0x37a4('0x2e')],function(_0x3e5f4f){return{'name':_0x3e5f4f[_0x37a4('0x2f')],'type':_0x3e5f4f['type']['key']};});_0x5714cf['model']=_['differenceBy'](_[_0x37a4('0x2c')](_0x383927,_0x37a4('0x29')),[_0x37a4('0x30')]);_0x5714cf[_0x37a4('0x31')]=_[_0x37a4('0x32')](_0x1008c2[_0x37a4('0x31')]);_0x5714cf[_0x37a4('0x33')]=_[_0x37a4('0x34')](_0x5714cf[_0x37a4('0x35')],_0x5714cf[_0x37a4('0x31')]);_0x372d89[_0x37a4('0x36')]=_[_0x37a4('0x34')](_0x5714cf[_0x37a4('0x35')],qs[_0x37a4('0x37')](_0x1008c2[_0x37a4('0x31')][_0x37a4('0x37')]));_0x372d89[_0x37a4('0x36')]=_0x372d89[_0x37a4('0x36')][_0x37a4('0x38')]?_0x372d89[_0x37a4('0x36')]:_0x5714cf['model'];if(!_0x1008c2[_0x37a4('0x31')]['hasOwnProperty'](_0x37a4('0x39'))){_0x372d89['limit']=qs['limit'](_0x1008c2[_0x37a4('0x31')][_0x37a4('0x1c')]);_0x372d89['offset']=qs[_0x37a4('0x1b')](_0x1008c2[_0x37a4('0x31')]['offset']);}_0x372d89['order']=qs[_0x37a4('0x3a')](_0x1008c2[_0x37a4('0x31')][_0x37a4('0x3a')]);_0x372d89[_0x37a4('0x3b')]=qs[_0x37a4('0x33')](_[_0x37a4('0x3c')](_0x1008c2[_0x37a4('0x31')],_0x5714cf[_0x37a4('0x33')]),_0x383927);if(_0x1008c2['query'][_0x37a4('0x3d')]){_0x372d89[_0x37a4('0x3b')]=_[_0x37a4('0x3e')](_0x372d89['where'],{'$or':_[_0x37a4('0x2c')](_0x383927,function(_0x2ac1ab){if(_0x2ac1ab['type']!==_0x37a4('0x3f')){var _0x319e87={};_0x319e87[_0x2ac1ab['name']]={'$like':'%'+_0x1008c2[_0x37a4('0x31')][_0x37a4('0x3d')]+'%'};return _0x319e87;}})});}_0x372d89=_[_0x37a4('0x3e')]({},_0x372d89,_0x1008c2[_0x37a4('0x40')]);var _0x391563={'where':_0x372d89[_0x37a4('0x3b')]};return db[_0x37a4('0x2d')][_0x37a4('0x1e')](_0x391563)[_0x37a4('0x26')](function(_0x3fe9a8){_0x2b8fcb['count']=_0x3fe9a8;if(_0x1008c2[_0x37a4('0x31')]['includeAll']){_0x372d89[_0x37a4('0x41')]=[{'all':!![]}];}return db[_0x37a4('0x2d')]['findAll'](_0x372d89);})[_0x37a4('0x26')](function(_0x5d60da){_0x2b8fcb['rows']=_0x5d60da;return _0x2b8fcb;})[_0x37a4('0x26')](respondWithFilteredResult(_0x704233,_0x372d89))[_0x37a4('0x42')](handleError(_0x704233,null));};exports[_0x37a4('0x43')]=function(_0x12a5fe,_0xb5ac03){var _0x3bb320={'raw':![],'where':{'id':_0x12a5fe[_0x37a4('0x44')]['id']}},_0x5e13fc={};_0x5e13fc[_0x37a4('0x35')]=_[_0x37a4('0x32')](db['VoiceRecording']['rawAttributes']);_0x5e13fc['query']=_[_0x37a4('0x32')](_0x12a5fe[_0x37a4('0x31')]);_0x5e13fc[_0x37a4('0x33')]=_['intersection'](_0x5e13fc[_0x37a4('0x35')],_0x5e13fc['query']);_0x3bb320[_0x37a4('0x36')]=_[_0x37a4('0x34')](_0x5e13fc[_0x37a4('0x35')],qs[_0x37a4('0x37')](_0x12a5fe[_0x37a4('0x31')][_0x37a4('0x37')]));_0x3bb320[_0x37a4('0x36')]=_0x3bb320['attributes'][_0x37a4('0x38')]?_0x3bb320[_0x37a4('0x36')]:_0x5e13fc[_0x37a4('0x35')];if(_0x12a5fe[_0x37a4('0x31')][_0x37a4('0x45')]){_0x3bb320['include']=[{'all':!![]}];}_0x3bb320=_['merge']({},_0x3bb320,_0x12a5fe[_0x37a4('0x40')]);return db['VoiceRecording'][_0x37a4('0x46')](_0x3bb320)[_0x37a4('0x26')](handleEntityNotFound(_0xb5ac03,null))[_0x37a4('0x26')](respondWithResult(_0xb5ac03,null))[_0x37a4('0x42')](handleError(_0xb5ac03,null));};exports[_0x37a4('0x47')]=function(_0x379032,_0xf0bb7c){return db[_0x37a4('0x2d')][_0x37a4('0x47')](_0x379032['body'],{})[_0x37a4('0x26')](respondWithResult(_0xf0bb7c,0xc9))[_0x37a4('0x42')](handleError(_0xf0bb7c,null));};exports['update']=function(_0x27adfa,_0x155f79){if(_0x27adfa['body']['id']){delete _0x27adfa[_0x37a4('0x48')]['id'];}return db[_0x37a4('0x2d')]['find']({'where':{'id':_0x27adfa[_0x37a4('0x44')]['id']}})['then'](handleEntityNotFound(_0x155f79,null))[_0x37a4('0x26')](saveUpdates(_0x27adfa[_0x37a4('0x48')],null))[_0x37a4('0x26')](respondWithResult(_0x155f79,null))['catch'](handleError(_0x155f79,null));};exports[_0x37a4('0x49')]=function(_0x10f874,_0x3f44dc){return db[_0x37a4('0x2d')][_0x37a4('0x49')]()['then'](respondWithResult(_0x3f44dc,null))[_0x37a4('0x42')](handleError(_0x3f44dc,null));};exports[_0x37a4('0x4a')]=function(_0x1876f8,_0x3d2887,_0x33b652){var _0x282d35=require(_0x37a4('0x4b'));var _0x2837f3=![];var _0x4daa13={};if(_0x1876f8[_0x37a4('0x31')][_0x37a4('0x4c')]&&_0x1876f8[_0x37a4('0x31')][_0x37a4('0x4c')]===_0x37a4('0x4d')){_0x4daa13[_0x37a4('0x4d')]=_0x1876f8[_0x37a4('0x44')]['id'];}else{_0x4daa13['id']=_0x1876f8['params']['id'];}return db[_0x37a4('0x2d')]['find']({'where':_0x4daa13,'attributes':['id',_0x37a4('0x4e')],'raw':!![]})[_0x37a4('0x26')](handleEntityNotFound(_0x3d2887,null))[_0x37a4('0x26')](function(_0x3f07ee){if(_0x3f07ee){var _0x5d8e3c=_0x3f07ee[_0x37a4('0x4e')];var _0x968a08=util[_0x37a4('0x30')](_0x37a4('0x4f'),_0x5d8e3c);if(fs[_0x37a4('0x50')](_0x968a08)){_0x2837f3=!![];return _0x282d35[_0x37a4('0x51')](_0x968a08,_0x5d8e3c,config[_0x37a4('0x52')][_0x37a4('0x53')])[_0x37a4('0x26')](function(){return _0x3f07ee;});}return _0x3f07ee;}})[_0x37a4('0x26')](function(_0x3ad57a){if(_0x3ad57a){var _0x494d8d=_0x3ad57a['value'];if(!fs['existsSync'](_0x494d8d)){throw new db[(_0x37a4('0x54'))][(_0x37a4('0x55'))](_0x37a4('0x56'));}if(_0x3ad57a[_0x37a4('0x57')]){return _0x3d2887['download'](_0x494d8d,_0x3ad57a[_0x37a4('0x57')]+path[_0x37a4('0x58')](_0x494d8d),function(){if(_0x2837f3){fs['unlink'](_0x494d8d);}});}else{return _0x3d2887[_0x37a4('0x4a')](_0x494d8d,function(_0x30612b){if(_0x2837f3){fs[_0x37a4('0x59')](_0x494d8d);}});}}})[_0x37a4('0x42')](function(_0x59bf3e){if(_0x59bf3e[_0x37a4('0x5a')]===_0x37a4('0x56')){_0x3d2887[_0x37a4('0x19')](0x194)[_0x37a4('0x2a')](_0x37a4('0x5b'));}else{return handleError(_0x3d2887,null);}});};exports['downloads']=function(_0x9c6c97,_0x59714e,_0x381190){var _0x30cde2=require('../../components/encryptor');var _0x4da1cb=![];var _0x2ef3ba={'$and':[db['sequelize'][_0x37a4('0x3b')](db[_0x37a4('0x5c')]['fn'](_0x37a4('0x5d'),db[_0x37a4('0x5c')][_0x37a4('0x5e')]('uniqueid')),_0x9c6c97['query'][_0x37a4('0x5f')])]};if(_0x9c6c97[_0x37a4('0x31')][_0x37a4('0x4c')]&&_0x9c6c97[_0x37a4('0x31')][_0x37a4('0x4c')]===_0x37a4('0x4d')){_0x2ef3ba[_0x37a4('0x60')][_0x37a4('0x61')]({'uniqueid':_0x9c6c97[_0x37a4('0x44')]['id']});}else{_0x2ef3ba['$and']['push']({'id':_0x9c6c97[_0x37a4('0x44')]['id']});}return db[_0x37a4('0x2d')][_0x37a4('0x46')]({'where':_0x2ef3ba,'attributes':['id',_0x37a4('0x4e')],'raw':!![]})[_0x37a4('0x26')](handleEntityNotFound(_0x59714e,null))[_0x37a4('0x26')](function(_0x2e31ba){if(_0x2e31ba){var _0x3148f3=util[_0x37a4('0x30')]('%s.cypher',_0x2e31ba[_0x37a4('0x4e')]);if(fs[_0x37a4('0x50')](_0x3148f3)){_0x4da1cb=!![];return _0x30cde2['decryptFile'](_0x3148f3,_0x2e31ba['value'],config[_0x37a4('0x52')]['recording'])[_0x37a4('0x26')](function(){return _0x2e31ba;});}return _0x2e31ba;}})[_0x37a4('0x26')](function(_0x2846d5){if(_0x2846d5){if(!fs[_0x37a4('0x50')](_0x2846d5[_0x37a4('0x4e')])){throw new db[(_0x37a4('0x54'))][(_0x37a4('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x2846d5[_0x37a4('0x57')]){return _0x59714e[_0x37a4('0x4a')](_0x2846d5[_0x37a4('0x4e')],_0x2846d5[_0x37a4('0x57')]+path['extname'](_0x2846d5['value']),function(){if(_0x4da1cb){fs[_0x37a4('0x59')](_0x2846d5[_0x37a4('0x4e')]);}});}else{return _0x59714e[_0x37a4('0x4a')](_0x2846d5[_0x37a4('0x4e')],function(_0x41dc62){if(_0x4da1cb){fs['unlink'](_0x2846d5[_0x37a4('0x4e')]);}});}}})[_0x37a4('0x42')](handleError(_0x59714e,null));};exports[_0x37a4('0x62')]=function(_0x17520f,_0x39cf99){return db[_0x37a4('0x2d')][_0x37a4('0x46')]({'where':{'id':_0x17520f[_0x37a4('0x44')]['id']}})['then'](function(_0x279ea5){if(_[_0x37a4('0x63')](_0x279ea5)){throw new ReferenceError(_0x37a4('0x64'));}return _0x279ea5;})[_0x37a4('0x26')](function(_0x442942){var _0x3f8302=_0x442942[_0x37a4('0x4e')];logger[_0x37a4('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x3f8302);if(!_[_0x37a4('0x63')](_0x442942['value'])&&fs[_0x37a4('0x50')](_0x3f8302)){logger[_0x37a4('0x65')](_0x37a4('0x66')+_0x3f8302+_0x37a4('0x67'));fs['unlinkSync'](_0x3f8302);}_0x3f8302=_0x3f8302+_0x37a4('0x68');if(!_[_0x37a4('0x63')](_0x442942[_0x37a4('0x4e')])&&fs[_0x37a4('0x50')](_0x3f8302)){logger[_0x37a4('0x65')](_0x37a4('0x66')+_0x3f8302+_0x37a4('0x67'));fs[_0x37a4('0x69')](_0x3f8302);}return _0x442942;})['then'](function(_0x20358e){if(!_0x20358e)throw new InternalError();return _0x20358e[_0x37a4('0x62')]();})[_0x37a4('0x26')](function(){_0x39cf99['status'](0xcc)[_0x37a4('0x1a')]();})[_0x37a4('0x42')](handleError(_0x39cf99,null));};function getBucketslist(_0x394c9e,_0xc0b4b3,_0x591533){return new Promise(function(_0xfae34f,_0x265c8c){var _0x494812=new AWS['S3']({'accessKeyId':_0xc0b4b3,'secretAccessKey':_0x394c9e,'region':_0x591533});_0x494812[_0x37a4('0x6a')]({},function(_0x7a1e70,_0x4370b3){if(_0x7a1e70){return _0x265c8c(_0x7a1e70);}else{return _0xfae34f(_0x4370b3);}});});}function createBucket(_0x2cafb1,_0x566e84,_0x281ba0,_0x3dc26e){return new Promise(function(_0xc87f84,_0x572a97){var _0x4c9aba=new AWS['S3']({'accessKeyId':_0x566e84,'secretAccessKey':_0x2cafb1,'region':_0x281ba0});_0x4c9aba[_0x37a4('0x6b')]({'Bucket':_0x3dc26e},function(_0x24ceda,_0xd6f5b5){if(_0x24ceda){return _0x572a97(_0x24ceda);}else{return _0xc87f84(_0xd6f5b5);}});});}function uploadFile(_0x36f297,_0x154479,_0x23de88,_0xd54e03,_0x4bba4,_0x4f80cb){return new Promise(function(_0x5b74aa,_0x59fe4c){var _0xe5e810=new AWS['S3']({'accessKeyId':_0x154479,'secretAccessKey':_0x36f297,'region':_0x23de88});_0xe5e810[_0x37a4('0x6c')]({'Bucket':_0xd54e03,'Key':_0x4bba4,'Body':_0x4f80cb},function(_0x3cd1bc,_0x292ccd){if(_0x3cd1bc){return _0x59fe4c(_0x3cd1bc);}else{return _0x5b74aa(_0x292ccd);}});});}function startTranscribe(_0x5d0eaf,_0x5700d0,_0x34bdfd,_0x30b221,_0x4dd142,_0x35fe3a){return new Promise(function(_0x380230,_0x3d1b4e){var _0xf7bd79=new AWS[(_0x37a4('0x6d'))]({'accessKeyId':_0x5700d0,'secretAccessKey':_0x5d0eaf,'region':_0x34bdfd});_0xf7bd79['startTranscriptionJob']({'TranscriptionJobName':_0x30b221,'LanguageCode':_0x4dd142,'Media':{'MediaFileUri':_0x35fe3a}},function(_0x43f4c1,_0x10c10c){if(_0x43f4c1){return _0x3d1b4e(_0x43f4c1);}else{return _0x380230(_0x10c10c);}});});}function transcribe(_0x31b6f5,_0x200d3d,_0x2ced05,_0x5c347d,_0x53fca5,_0x1ecf6f,_0x58ddba){return new Promise(function(_0x19739a,_0x18b576){var _0x555163={};logger[_0x37a4('0x65')](util[_0x37a4('0x30')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x31b6f5,_0x53fca5));return uploadFile(_0x200d3d,_0x2ced05,_0x5c347d,_0x53fca5,path[_0x37a4('0x6e')](_0x1ecf6f),fs[_0x37a4('0x6f')](_0x1ecf6f))[_0x37a4('0x26')](function(_0x2ea5da){logger[_0x37a4('0x65')](util[_0x37a4('0x30')](_0x37a4('0x70'),_0x31b6f5,_0x53fca5,_0x2ea5da[_0x37a4('0x71')]));_0x555163[_0x37a4('0x72')]=_0x2ea5da[_0x37a4('0x73')];_0x555163['location']=_0x2ea5da['Location'];logger[_0x37a4('0x65')](util[_0x37a4('0x30')](_0x37a4('0x74'),_0x31b6f5));return startTranscribe(_0x200d3d,_0x2ced05,_0x5c347d,uuidv4(),_0x58ddba,_0x2ea5da[_0x37a4('0x71')]);})[_0x37a4('0x26')](function(_0x6fd9d8){logger['info'](util[_0x37a4('0x30')](_0x37a4('0x75'),_0x31b6f5,_0x6fd9d8['TranscriptionJob'][_0x37a4('0x76')]));_0x555163[_0x37a4('0x77')]=_0x6fd9d8[_0x37a4('0x78')][_0x37a4('0x76')];_0x555163[_0x37a4('0x79')]=_0x6fd9d8[_0x37a4('0x78')]['TranscriptionJobStatus'];return _0x19739a(_0x555163);})['catch'](function(_0x5c9eb7){return _0x18b576(_0x5c9eb7);});});}exports['runTranscribe']=function(_0x25d555,_0x33ea9f,_0x551abe){var _0x3adf67;var _0x2d1c8b;var _0x18eb43;var _0xab8882=require('../../components/encryptor');return db[_0x37a4('0x2d')][_0x37a4('0x7a')]({'where':{'id':_0x25d555[_0x37a4('0x44')]['id']}})['then'](function(_0x3e2e26){if(_0x3e2e26){var _0x58f03d=util['format'](_0x37a4('0x4f'),_0x3e2e26[_0x37a4('0x4e')]);if(fs[_0x37a4('0x50')](_0x58f03d)){cypher=!![];return _0xab8882[_0x37a4('0x51')](_0x58f03d,_0x3e2e26['value'],config[_0x37a4('0x52')][_0x37a4('0x53')])[_0x37a4('0x26')](function(){return _0x3e2e26;});}return _0x3e2e26;}})[_0x37a4('0x26')](function(_0x1ddeb5){if(!_0x1ddeb5){throw new db[(_0x37a4('0x54'))][(_0x37a4('0x55'))](_0x37a4('0x7b'));}_0x2d1c8b=_0x1ddeb5;return db[_0x37a4('0x7c')][_0x37a4('0x7a')]({'where':{'id':0x1}});})[_0x37a4('0x26')](handleEntityNotFound(_0x33ea9f,null))[_0x37a4('0x26')](function(_0x3068de){if(_0x3068de){_0x3adf67=_0x3068de;if(!_0x3adf67[_0x37a4('0x7d')]||!_0x3adf67[_0x37a4('0x7e')]||!_0x3adf67['transcribeRegion']||!_0x3adf67[_0x37a4('0x7f')]||!_0x3adf67[_0x37a4('0x72')]){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}if(_0x25d555[_0x37a4('0x48')]['runSentiment']&&(!_0x3adf67[_0x37a4('0x80')]||!_0x3adf67[_0x37a4('0x81')]||!_0x3adf67[_0x37a4('0x82')]||!_0x3adf67['language']||!_0x3adf67[_0x37a4('0x72')])){throw new db['Sequelize'][(_0x37a4('0x55'))](_0x37a4('0x83'));}return db[_0x37a4('0x84')]['findOne']({'where':{'id':_0x3adf67[_0x37a4('0x7e')]}});}})[_0x37a4('0x26')](function(_0x3be884){if(!_0x3be884){throw new db['Sequelize'][(_0x37a4('0x55'))](_0x37a4('0x85'));}if(!_0x3be884[_0x37a4('0x86')]||!_0x3be884[_0x37a4('0x87')]){throw new db['Sequelize'][(_0x37a4('0x55'))](_0x37a4('0x88'));}_0x18eb43=_0x3be884;return getBucketslist(_0x18eb43[_0x37a4('0x86')],_0x18eb43['data2'],_0x3adf67[_0x37a4('0x89')]);})[_0x37a4('0x26')](function(_0x2f233c){if(_0x2f233c&&_0x2f233c[_0x37a4('0x8a')]){var _0x1eb7b1=_[_0x37a4('0x46')](_0x2f233c[_0x37a4('0x8a')],function(_0xf18437){return _0xf18437[_0x37a4('0x8b')]===_0x3adf67[_0x37a4('0x72')];});if(!_0x1eb7b1){logger[_0x37a4('0x65')](util['format'](_0x37a4('0x8c'),_0x25d555[_0x37a4('0x44')]['id'],_0x3adf67[_0x37a4('0x72')]));return createBucket(_0x18eb43['data1'],_0x18eb43['data2'],_0x3adf67[_0x37a4('0x89')],_0x3adf67['bucket']);}logger[_0x37a4('0x65')](util[_0x37a4('0x30')](_0x37a4('0x8d'),_0x25d555[_0x37a4('0x44')]['id'],_0x3adf67[_0x37a4('0x72')]));return;}})[_0x37a4('0x26')](function(_0x2f8a77){if(_0x2d1c8b['transcribeStatus']===_0x37a4('0x8e')){return transcribe(_0x25d555[_0x37a4('0x44')]['id'],_0x18eb43[_0x37a4('0x86')],_0x18eb43['data2'],_0x3adf67[_0x37a4('0x89')],_0x3adf67[_0x37a4('0x72')],_0x2d1c8b[_0x37a4('0x4e')],_0x3adf67['language']);}else{logger[_0x37a4('0x65')](util[_0x37a4('0x30')](_0x37a4('0x8f'),_0x25d555['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x37a4('0x26')](function(_0x26117e){if(_0x26117e){_0x26117e['tempSentiment']=_0x25d555['body'][_0x37a4('0x90')];return _0x2d1c8b[_0x37a4('0x91')](_0x26117e);}})[_0x37a4('0x26')](respondWithResult(_0x33ea9f,null))[_0x37a4('0x42')](handleError(_0x33ea9f,null));};function writeFile(_0x4d0255,_0x5e8273){return new Promise(function(_0x2554fe,_0x5c512b){fs[_0x37a4('0x92')](_0x5e8273,_0x4d0255,function(_0x55be8b,_0x40d42c){if(_0x55be8b){return _0x5c512b(_0x55be8b);}else{return _0x2554fe(_0x40d42c);}});});}exports[_0x37a4('0x93')]=function(_0x5063f2,_0x465594,_0x313505){return db[_0x37a4('0x2d')][_0x37a4('0x7a')]({'where':{'id':_0x5063f2[_0x37a4('0x44')]['id']}})[_0x37a4('0x26')](handleEntityNotFound(_0x465594))[_0x37a4('0x26')](function(_0x36eecf){if(_0x36eecf&&_0x36eecf['fileText']){var _0x229beb=_0x36eecf[_0x37a4('0x94')];var _0x4590ce=config[_0x37a4('0x95')]+'/server/files/transcribes/transcribe_'+_0x36eecf['id']+_0x37a4('0x96');if(fs[_0x37a4('0x50')](_0x4590ce)){return _0x4590ce;}return writeFile(_0x229beb,_0x4590ce)[_0x37a4('0x26')](function(){return _0x4590ce;});}else{throw new db[(_0x37a4('0x54'))][(_0x37a4('0x55'))](_0x37a4('0x97'));}})[_0x37a4('0x26')](function(_0x435d2d){return _0x465594[_0x37a4('0x4a')](_0x435d2d);})[_0x37a4('0x42')](handleError(_0x465594));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index b6197d5..7f1f139 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 _0x20f2=['../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x20f2,0x1e6));var _0x220f=function(_0xca1a99,_0x13aef5){_0xca1a99=_0xca1a99-0x0;var _0x1077a8=_0x20f2[_0xca1a99];return _0x1077a8;};'use strict';var _=require(_0x220f('0x0'));var util=require(_0x220f('0x1'));var logger=require(_0x220f('0x2'))(_0x220f('0x3'));var moment=require(_0x220f('0x4'));var BPromise=require(_0x220f('0x5'));var rp=require(_0x220f('0x6'));var fs=require('fs');var path=require(_0x220f('0x7'));var rimraf=require(_0x220f('0x8'));var config=require(_0x220f('0x9'));var attributes=require(_0x220f('0xa'));module[_0x220f('0xb')]=function(_0x46ad51,_0x464fa1){return _0x46ad51[_0x220f('0xc')](_0x220f('0xd'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x220f('0xe'),'fields':[_0x220f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa10=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid','lodash'];(function(_0xe5efcb,_0x473f01){var _0x782d72=function(_0x44bf97){while(--_0x44bf97){_0xe5efcb['push'](_0xe5efcb['shift']());}};_0x782d72(++_0x473f01);}(_0xaa10,0x1ac));var _0x0aa1=function(_0x397bb9,_0x43ea11){_0x397bb9=_0x397bb9-0x0;var _0x32b9b3=_0xaa10[_0x397bb9];return _0x32b9b3;};'use strict';var _=require(_0x0aa1('0x0'));var util=require(_0x0aa1('0x1'));var logger=require(_0x0aa1('0x2'))(_0x0aa1('0x3'));var moment=require(_0x0aa1('0x4'));var BPromise=require('bluebird');var rp=require(_0x0aa1('0x5'));var fs=require('fs');var path=require(_0x0aa1('0x6'));var rimraf=require('rimraf');var config=require(_0x0aa1('0x7'));var attributes=require(_0x0aa1('0x8'));module['exports']=function(_0x33c2c8,_0x73f4ec){return _0x33c2c8[_0x0aa1('0x9')](_0x0aa1('0xa'),attributes,{'tableName':_0x0aa1('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0aa1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index b0ead1f..8864633 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 _0x0adf=['attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','existsSync','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceRecording,\x20%s,\x20%s','message','result','catch','VoiceRecording','update','body','options','where'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x361abe,_0x57eadc){_0x361abe=_0x361abe-0x0;var _0x1224f0=_0x0adf[_0x361abe];return _0x1224f0;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var moment=require(_0xf0ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0ad('0x3'));var fs=require('fs');var Redis=require(_0xf0ad('0x4'));var db=require(_0xf0ad('0x5'))['db'];var utils=require(_0xf0ad('0x6'));var logger=require(_0xf0ad('0x7'))(_0xf0ad('0x8'));var config=require(_0xf0ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eca0e,_0x44cf37,_0x170574){return new BPromise(function(_0x41c99d,_0xa9a315){return client[_0xf0ad('0xb')](_0x2eca0e,_0x170574)[_0xf0ad('0xc')](function(_0x5bdf69){logger[_0xf0ad('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x44cf37,_0xf0ad('0xe'));logger[_0xf0ad('0xf')](_0xf0ad('0x10'),_0x44cf37,_0xf0ad('0xe'),JSON[_0xf0ad('0x11')](_0x5bdf69));if(_0x5bdf69['error']){if(_0x5bdf69['error'][_0xf0ad('0x12')]===0x1f4){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x5bdf69[_0xf0ad('0x13')]['message']);return _0xa9a315(_0x5bdf69[_0xf0ad('0x13')][_0xf0ad('0x15')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x44cf37,_0x5bdf69['error'][_0xf0ad('0x15')]);return _0x41c99d(_0x5bdf69['error'][_0xf0ad('0x15')]);}else{logger[_0xf0ad('0xd')](_0xf0ad('0x14'),_0x44cf37,_0xf0ad('0xe'));_0x41c99d(_0x5bdf69[_0xf0ad('0x16')]['message']);}})[_0xf0ad('0x17')](function(_0x285ab0){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x285ab0);_0xa9a315(_0x285ab0);});});}exports['UpdateVoiceRecording']=function(_0x4e9970){var _0x2466e8=this;return new Promise(function(_0x46fb20,_0x49f2ec){return db[_0xf0ad('0x18')][_0xf0ad('0x19')](_0x4e9970[_0xf0ad('0x1a')],{'raw':_0x4e9970[_0xf0ad('0x1b')]?_0x4e9970['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e9970[_0xf0ad('0x1b')]?_0x4e9970[_0xf0ad('0x1b')][_0xf0ad('0x1c')]||null:null,'attributes':_0x4e9970[_0xf0ad('0x1b')]?_0x4e9970[_0xf0ad('0x1b')][_0xf0ad('0x1d')]||null:null,'limit':_0x4e9970['options']?_0x4e9970[_0xf0ad('0x1b')][_0xf0ad('0x1e')]||null:null})[_0xf0ad('0xc')](function(_0x3ece1e){logger[_0xf0ad('0xd')](_0xf0ad('0x1f'),_0x4e9970);logger[_0xf0ad('0xf')](_0xf0ad('0x1f'),_0x4e9970,JSON[_0xf0ad('0x11')](_0x3ece1e));_0x46fb20(_0x3ece1e);})[_0xf0ad('0x17')](function(_0x39b3e8){logger[_0xf0ad('0x13')](_0xf0ad('0x1f'),_0x39b3e8[_0xf0ad('0x15')],_0x4e9970);_0x49f2ec(_0x2466e8[_0xf0ad('0x13')](0x1f4,_0x39b3e8['message']));});});};exports[_0xf0ad('0x20')]=function(_0x1507a3){var _0x248794=this;return new Promise(function(_0x7377d7,_0x28c280){var _0x30f8ee=require('../../components/encryptor');var _0x2cbe00;return db[_0xf0ad('0x21')][_0xf0ad('0x22')]({'attributes':['id',_0xf0ad('0x23')],'where':{'id':0x1},'raw':!![]})[_0xf0ad('0xc')](function(_0x1ac25c){_0x2cbe00=_0x1ac25c;return db[_0xf0ad('0x18')][_0xf0ad('0x24')](_0x1507a3[_0xf0ad('0x1a')]);})[_0xf0ad('0xc')](function(_0x2d1b2f){if(_0x2cbe00['callRecordingEncryption']&&fs[_0xf0ad('0x25')](_0x2d1b2f['value'])){var _0x83f211=util['format'](_0xf0ad('0x26'),_0x2d1b2f[_0xf0ad('0x27')]);return _0x30f8ee[_0xf0ad('0x28')](_0x2d1b2f[_0xf0ad('0x27')],_0x83f211,config[_0xf0ad('0x29')][_0xf0ad('0x2a')])[_0xf0ad('0xc')](function(){fs[_0xf0ad('0x2b')](_0x2d1b2f['value']);logger['info'](_0xf0ad('0x2c'));return _0x2d1b2f;});}return _0x2d1b2f;})[_0xf0ad('0xc')](function(_0xd608bf){logger[_0xf0ad('0xd')]('CreateVoiceRecording',_0x1507a3);logger[_0xf0ad('0xf')]('CreateVoiceRecording',_0x1507a3,JSON[_0xf0ad('0x11')](_0xd608bf));_0x7377d7(_0xd608bf);})['catch'](function(_0x4136b9){logger['error'](_0xf0ad('0x20'),_0x4136b9[_0xf0ad('0x15')],_0x1507a3);_0x28c280(_0x248794[_0xf0ad('0x13')](0x1f4,_0x4136b9[_0xf0ad('0x15')]));});});}; \ No newline at end of file +var _0x5430=['info','request\x20sent','debug','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','UpdateVoiceRecording','VoiceRecording','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','format','%s.cypher','value','encryptFile','secrets','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x46c2dd,_0xab8435){var _0x37225d=function(_0x1fbf28){while(--_0x1fbf28){_0x46c2dd['push'](_0x46c2dd['shift']());}};_0x37225d(++_0xab8435);}(_0x5430,0x10c));var _0x0543=function(_0xb0cfd2,_0x3dd841){_0xb0cfd2=_0xb0cfd2-0x0;var _0x22c1cd=_0x5430[_0xb0cfd2];return _0x22c1cd;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['update'](_0x20b396['body'],{'raw':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b396['options']?_0x20b396[_0x0543('0x17')]['where']||null:null,'attributes':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')]['attributes']||null:null,'limit':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x19')]||null:null})[_0x0543('0xb')](function(_0x37347e){logger[_0x0543('0xc')]('UpdateVoiceRecording',_0x20b396);logger['debug']('UpdateVoiceRecording',_0x20b396,JSON[_0x0543('0xf')](_0x37347e));_0x577cf0(_0x37347e);})[_0x0543('0x1a')](function(_0x15ebeb){logger[_0x0543('0x10')](_0x0543('0x15'),_0x15ebeb[_0x0543('0x13')],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x15ebeb[_0x0543('0x13')]));});});};exports[_0x0543('0x1b')]=function(_0xf1eccf){var _0x40a261=this;return new Promise(function(_0x21fc63,_0x547a88){var _0x25e6f1=require(_0x0543('0x1c'));var _0x30ad9e;return db['Setting'][_0x0543('0x1d')]({'attributes':['id',_0x0543('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0543('0xb')](function(_0x10b881){_0x30ad9e=_0x10b881;return db['VoiceRecording'][_0x0543('0x1f')](_0xf1eccf[_0x0543('0x20')]);})['then'](function(_0x576084){if(_0x30ad9e[_0x0543('0x1e')]&&fs[_0x0543('0x21')](_0x576084['value'])){var _0x3b879b=util[_0x0543('0x22')](_0x0543('0x23'),_0x576084[_0x0543('0x24')]);return _0x25e6f1[_0x0543('0x25')](_0x576084[_0x0543('0x24')],_0x3b879b,config[_0x0543('0x26')]['recording'])[_0x0543('0xb')](function(){fs['unlink'](_0x576084[_0x0543('0x24')]);logger[_0x0543('0xc')](_0x0543('0x27'));return _0x576084;});}return _0x576084;})[_0x0543('0xb')](function(_0x28307f){logger['info'](_0x0543('0x1b'),_0xf1eccf);logger['debug'](_0x0543('0x1b'),_0xf1eccf,JSON[_0x0543('0xf')](_0x28307f));_0x21fc63(_0x28307f);})[_0x0543('0x1a')](function(_0x327027){logger['error'](_0x0543('0x1b'),_0x327027['message'],_0xf1eccf);_0x547a88(_0x40a261[_0x0543('0x10')](0x1f4,_0x327027[_0x0543('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 5a36d67..018251a 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 _0x5575=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x3d73c6,_0x4cb220){var _0x3d06a4=function(_0x3361ee){while(--_0x3361ee){_0x3d73c6['push'](_0x3d73c6['shift']());}};_0x3d06a4(++_0x4cb220);}(_0x5575,0x19f));var _0x5557=function(_0x38c776,_0x18b659){_0x38c776=_0x38c776-0x0;var _0xef0815=_0x5575[_0x38c776];return _0xef0815;};'use strict';var multer=require(_0x5557('0x0'));var util=require(_0x5557('0x1'));var path=require(_0x5557('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5557('0x3')]();var fs_extra=require(_0x5557('0x4'));var auth=require(_0x5557('0x5'));var interaction=require(_0x5557('0x6'));var config=require(_0x5557('0x7'));var controller=require(_0x5557('0x8'));router[_0x5557('0x9')]('/',auth[_0x5557('0xa')](),controller[_0x5557('0xb')]);router[_0x5557('0x9')](_0x5557('0xc'),auth[_0x5557('0xa')](),controller[_0x5557('0xd')]);router['get'](_0x5557('0xe'),auth[_0x5557('0xa')](),controller[_0x5557('0xf')]);router[_0x5557('0x10')]('/',auth[_0x5557('0xa')](),controller[_0x5557('0x11')]);router['put'](_0x5557('0xe'),auth[_0x5557('0xa')](),controller['update']);router['delete'](_0x5557('0xe'),auth[_0x5557('0xa')](),controller[_0x5557('0x12')]);module[_0x5557('0x13')]=router; \ No newline at end of file +var _0xb27d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','destroy','exports','util','connect-timeout','express'];(function(_0x47c7a9,_0x3d08e5){var _0x560e6e=function(_0x299bef){while(--_0x299bef){_0x47c7a9['push'](_0x47c7a9['shift']());}};_0x560e6e(++_0x3d08e5);}(_0xb27d,0x12d));var _0xdb27=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xb27d[_0x4d8ed9];return _0x1e2140;};'use strict';var multer=require('multer');var util=require(_0xdb27('0x0'));var path=require('path');var timeout=require(_0xdb27('0x1'));var express=require(_0xdb27('0x2'));var router=express[_0xdb27('0x3')]();var fs_extra=require(_0xdb27('0x4'));var auth=require(_0xdb27('0x5'));var interaction=require(_0xdb27('0x6'));var config=require('../../config/environment');var controller=require(_0xdb27('0x7'));router[_0xdb27('0x8')]('/',auth['isAuthenticated'](),controller[_0xdb27('0x9')]);router[_0xdb27('0x8')](_0xdb27('0xa'),auth[_0xdb27('0xb')](),controller['describe']);router[_0xdb27('0x8')](_0xdb27('0xc'),auth['isAuthenticated'](),controller[_0xdb27('0xd')]);router[_0xdb27('0xe')]('/',auth[_0xdb27('0xb')](),controller[_0xdb27('0xf')]);router[_0xdb27('0x10')](_0xdb27('0xc'),auth[_0xdb27('0xb')](),controller['update']);router['delete'](_0xdb27('0xc'),auth[_0xdb27('0xb')](),controller[_0xdb27('0x11')]);module[_0xdb27('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 3714e67..be59cef 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 _0x98de=['Yes','exports','ENUM','blind','attended','STRING'];(function(_0x30c155,_0x20d0c9){var _0x76a87f=function(_0x20ac21){while(--_0x20ac21){_0x30c155['push'](_0x30c155['shift']());}};_0x76a87f(++_0x20d0c9);}(_0x98de,0x1c9));var _0xe98d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x98de[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xe98d('0x0')]={'type':{'type':Sequelize[_0xe98d('0x1')](_0xe98d('0x2'),_0xe98d('0x3'))},'result':{'type':Sequelize[_0xe98d('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xe98d('0x4')]},'transferercalleridname':{'type':Sequelize[_0xe98d('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe98d('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xe98d('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xe98d('0x4')]},'transfererexten':{'type':Sequelize[_0xe98d('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xe98d('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe98d('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xe98d('0x4')]},'transfereeexten':{'type':Sequelize[_0xe98d('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xe98d('0x4')]},'isexternal':{'type':Sequelize[_0xe98d('0x1')](_0xe98d('0x5'),'No')},'context':{'type':Sequelize[_0xe98d('0x4')]},'extension':{'type':Sequelize[_0xe98d('0x4')]}}; \ No newline at end of file +var _0x511b=['ENUM','sequelize','moment','exports','blind','attended','STRING'];(function(_0xed58fb,_0x3ad96e){var _0x34ff8a=function(_0x35cbfe){while(--_0x35cbfe){_0xed58fb['push'](_0xed58fb['shift']());}};_0x34ff8a(++_0x3ad96e);}(_0x511b,0x19e));var _0xb511=function(_0x3b671a,_0x39412f){_0x3b671a=_0x3b671a-0x0;var _0x20dfd5=_0x511b[_0x3b671a];return _0x20dfd5;};'use strict';var Sequelize=require(_0xb511('0x0'));var moment=require(_0xb511('0x1'));module[_0xb511('0x2')]={'type':{'type':Sequelize['ENUM'](_0xb511('0x3'),_0xb511('0x4'))},'result':{'type':Sequelize[_0xb511('0x5')]},'transfererchannel':{'type':Sequelize[_0xb511('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xb511('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb511('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xb511('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xb511('0x5')]},'transfererexten':{'type':Sequelize[_0xb511('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xb511('0x5')]},'transfereechannel':{'type':Sequelize[_0xb511('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xb511('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xb511('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb511('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xb511('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xb511('0x5')]},'transfereecontext':{'type':Sequelize[_0xb511('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xb511('0x5')]},'isexternal':{'type':Sequelize[_0xb511('0x6')]('Yes','No')},'context':{'type':Sequelize[_0xb511('0x5')]},'extension':{'type':Sequelize[_0xb511('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 1df5385..e862031 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 _0xd090=['intersection','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','rows','params','fields','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0xd090,0x188));var _0x0d09=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd090[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x0d09('0x0'));var rimraf=require(_0x0d09('0x1'));var zipdir=require(_0x0d09('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d09('0x3'));var moment=require(_0x0d09('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0d09('0x5'));var util=require(_0x0d09('0x6'));var path=require(_0x0d09('0x7'));var sox=require(_0x0d09('0x8'));var csv=require(_0x0d09('0x9'));var ejs=require(_0x0d09('0xa'));var fs=require('fs');var fs_extra=require(_0x0d09('0xb'));var _=require(_0x0d09('0xc'));var squel=require('squel');var crypto=require(_0x0d09('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0d09('0xe'));var toCsv=require(_0x0d09('0x9'));var querystring=require(_0x0d09('0xf'));var Papa=require(_0x0d09('0x10'));var Redis=require(_0x0d09('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0d09('0x12'));var hardwareService=require(_0x0d09('0x13'));var logger=require(_0x0d09('0x14'))(_0x0d09('0x15'));var utils=require(_0x0d09('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0d09('0x17'));var db=require(_0x0d09('0x18'))['db'];function respondWithStatusCode(_0xbc18f9,_0x1b928b){_0x1b928b=_0x1b928b||0xcc;return function(_0x358732){if(_0x358732){return _0xbc18f9['sendStatus'](_0x1b928b);}return _0xbc18f9[_0x0d09('0x19')](_0x1b928b)[_0x0d09('0x1a')]();};}function respondWithResult(_0x4282c3,_0x37af60){_0x37af60=_0x37af60||0xc8;return function(_0x23d789){if(_0x23d789){return _0x4282c3[_0x0d09('0x19')](_0x37af60)['json'](_0x23d789);}};}function respondWithFilteredResult(_0x127369,_0x1b4566){return function(_0x231f36){if(_0x231f36){var _0x475d06=typeof _0x1b4566[_0x0d09('0x1b')]===_0x0d09('0x1c')&&typeof _0x1b4566[_0x0d09('0x1d')]===_0x0d09('0x1c');var _0x51cc50=_0x231f36[_0x0d09('0x1e')];var _0x36a073=_0x475d06?0x0:_0x1b4566['offset'];var _0xa95ed8=_0x475d06?_0x231f36['count']:_0x1b4566[_0x0d09('0x1b')]+_0x1b4566[_0x0d09('0x1d')];var _0x547212;if(_0xa95ed8>=_0x51cc50){_0xa95ed8=_0x51cc50;_0x547212=0xc8;}else{_0x547212=0xce;}_0x127369['status'](_0x547212);return _0x127369[_0x0d09('0x1f')]('Content-Range',_0x36a073+'-'+_0xa95ed8+'/'+_0x51cc50)[_0x0d09('0x20')](_0x231f36);}return null;};}function patchUpdates(_0x10bbf1){return function(_0x22e861){try{jsonpatch['apply'](_0x22e861,_0x10bbf1,!![]);}catch(_0x2fc8db){return BPromise[_0x0d09('0x21')](_0x2fc8db);}return _0x22e861[_0x0d09('0x22')]();};}function saveUpdates(_0x16fa0f,_0x3c65a7){return function(_0x4bebed){if(_0x4bebed){return _0x4bebed[_0x0d09('0x23')](_0x16fa0f)[_0x0d09('0x24')](function(_0x5c31a9){return _0x5c31a9;});}return null;};}function removeEntity(_0x402513,_0x37e33a){return function(_0x3094bc){if(_0x3094bc){return _0x3094bc[_0x0d09('0x25')]()[_0x0d09('0x24')](function(){_0x402513[_0x0d09('0x19')](0xcc)[_0x0d09('0x1a')]();});}};}function handleEntityNotFound(_0x4bcab1,_0x226e44){return function(_0x18f3d1){if(!_0x18f3d1){_0x4bcab1[_0x0d09('0x26')](0x194);}return _0x18f3d1;};}function handleError(_0x49b7fe,_0x30db2f){_0x30db2f=_0x30db2f||0x1f4;return function(_0x1739ac){logger[_0x0d09('0x27')](_0x1739ac[_0x0d09('0x28')]);if(_0x1739ac[_0x0d09('0x29')]){delete _0x1739ac['name'];}_0x49b7fe[_0x0d09('0x19')](_0x30db2f)[_0x0d09('0x2a')](_0x1739ac);};}exports[_0x0d09('0x2b')]=function(_0x284bff,_0x268d03){var _0x124137={},_0x5e60cd={},_0x3c852a={'count':0x0,'rows':[]};var _0x390724=_[_0x0d09('0x2c')](db['VoiceTransferReport'][_0x0d09('0x2d')],function(_0x2b14c6){return{'name':_0x2b14c6[_0x0d09('0x2e')],'type':_0x2b14c6[_0x0d09('0x2f')]['key']};});_0x5e60cd[_0x0d09('0x30')]=_[_0x0d09('0x2c')](_0x390724,_0x0d09('0x29'));_0x5e60cd[_0x0d09('0x31')]=_[_0x0d09('0x32')](_0x284bff['query']);_0x5e60cd[_0x0d09('0x33')]=_[_0x0d09('0x34')](_0x5e60cd[_0x0d09('0x30')],_0x5e60cd[_0x0d09('0x31')]);_0x124137[_0x0d09('0x35')]=_['intersection'](_0x5e60cd['model'],qs['fields'](_0x284bff['query']['fields']));_0x124137[_0x0d09('0x35')]=_0x124137['attributes']['length']?_0x124137[_0x0d09('0x35')]:_0x5e60cd['model'];if(!_0x284bff[_0x0d09('0x31')][_0x0d09('0x36')]('nolimit')){_0x124137[_0x0d09('0x1d')]=qs[_0x0d09('0x1d')](_0x284bff['query'][_0x0d09('0x1d')]);_0x124137['offset']=qs[_0x0d09('0x1b')](_0x284bff[_0x0d09('0x31')]['offset']);}_0x124137['order']=qs[_0x0d09('0x37')](_0x284bff[_0x0d09('0x31')][_0x0d09('0x37')]);_0x124137[_0x0d09('0x38')]=qs['filters'](_[_0x0d09('0x39')](_0x284bff['query'],_0x5e60cd[_0x0d09('0x33')]),_0x390724);if(_0x284bff[_0x0d09('0x31')][_0x0d09('0x3a')]){_0x124137[_0x0d09('0x38')]=_[_0x0d09('0x3b')](_0x124137[_0x0d09('0x38')],{'$or':_['map'](_0x390724,function(_0x258b2e){if(_0x258b2e[_0x0d09('0x2f')]!==_0x0d09('0x3c')){var _0x2a5eef={};_0x2a5eef[_0x258b2e[_0x0d09('0x29')]]={'$like':'%'+_0x284bff[_0x0d09('0x31')][_0x0d09('0x3a')]+'%'};return _0x2a5eef;}})});}_0x124137=_[_0x0d09('0x3b')]({},_0x124137,_0x284bff[_0x0d09('0x3d')]);var _0x361b02={'where':_0x124137[_0x0d09('0x38')]};return db[_0x0d09('0x3e')][_0x0d09('0x1e')](_0x361b02)[_0x0d09('0x24')](function(_0x3a4164){_0x3c852a['count']=_0x3a4164;if(_0x284bff['query'][_0x0d09('0x3f')]){_0x124137[_0x0d09('0x40')]=[{'all':!![]}];}return db[_0x0d09('0x3e')]['findAll'](_0x124137);})[_0x0d09('0x24')](function(_0x4d47f9){_0x3c852a[_0x0d09('0x41')]=_0x4d47f9;return _0x3c852a;})[_0x0d09('0x24')](respondWithFilteredResult(_0x268d03,_0x124137))['catch'](handleError(_0x268d03,null));};exports['show']=function(_0x2bbbd6,_0x2dd27e){var _0x2ff333={'raw':!![],'where':{'id':_0x2bbbd6[_0x0d09('0x42')]['id']}},_0x1e521b={};_0x1e521b[_0x0d09('0x30')]=_[_0x0d09('0x32')](db[_0x0d09('0x3e')][_0x0d09('0x2d')]);_0x1e521b[_0x0d09('0x31')]=_[_0x0d09('0x32')](_0x2bbbd6[_0x0d09('0x31')]);_0x1e521b[_0x0d09('0x33')]=_['intersection'](_0x1e521b[_0x0d09('0x30')],_0x1e521b[_0x0d09('0x31')]);_0x2ff333[_0x0d09('0x35')]=_['intersection'](_0x1e521b[_0x0d09('0x30')],qs['fields'](_0x2bbbd6[_0x0d09('0x31')][_0x0d09('0x43')]));_0x2ff333[_0x0d09('0x35')]=_0x2ff333['attributes'][_0x0d09('0x44')]?_0x2ff333[_0x0d09('0x35')]:_0x1e521b[_0x0d09('0x30')];if(_0x2bbbd6[_0x0d09('0x31')][_0x0d09('0x3f')]){_0x2ff333[_0x0d09('0x40')]=[{'all':!![]}];}_0x2ff333=_['merge']({},_0x2ff333,_0x2bbbd6['options']);return db['VoiceTransferReport'][_0x0d09('0x45')](_0x2ff333)[_0x0d09('0x24')](handleEntityNotFound(_0x2dd27e,null))[_0x0d09('0x24')](respondWithResult(_0x2dd27e,null))[_0x0d09('0x46')](handleError(_0x2dd27e,null));};exports[_0x0d09('0x47')]=function(_0x19a654,_0x1c1d4c){return db[_0x0d09('0x3e')][_0x0d09('0x47')](_0x19a654[_0x0d09('0x48')],{})[_0x0d09('0x24')](respondWithResult(_0x1c1d4c,0xc9))['catch'](handleError(_0x1c1d4c,null));};exports[_0x0d09('0x23')]=function(_0x592c9e,_0x2a4fbc){if(_0x592c9e[_0x0d09('0x48')]['id']){delete _0x592c9e['body']['id'];}return db[_0x0d09('0x3e')][_0x0d09('0x45')]({'where':{'id':_0x592c9e[_0x0d09('0x42')]['id']}})[_0x0d09('0x24')](handleEntityNotFound(_0x2a4fbc,null))['then'](saveUpdates(_0x592c9e['body'],null))[_0x0d09('0x24')](respondWithResult(_0x2a4fbc,null))[_0x0d09('0x46')](handleError(_0x2a4fbc,null));};exports[_0x0d09('0x25')]=function(_0x511a0e,_0x217d14){return db['VoiceTransferReport'][_0x0d09('0x45')]({'where':{'id':_0x511a0e[_0x0d09('0x42')]['id']}})[_0x0d09('0x24')](handleEntityNotFound(_0x217d14,null))[_0x0d09('0x24')](removeEntity(_0x217d14,null))[_0x0d09('0x46')](handleError(_0x217d14,null));};exports[_0x0d09('0x49')]=function(_0x5b6e85,_0x185d6e){return db['VoiceTransferReport'][_0x0d09('0x49')]()['then'](respondWithResult(_0x185d6e,null))[_0x0d09('0x46')](handleError(_0x185d6e,null));}; \ No newline at end of file +var _0x1e2c=['includeAll','include','findAll','catch','show','params','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','save','then','destroy','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x3d1841,_0x598708){var _0x3c1f3f=function(_0x5c45b3){while(--_0x5c45b3){_0x3d1841['push'](_0x3d1841['shift']());}};_0x3c1f3f(++_0x598708);}(_0x1e2c,0x192));var _0xc1e2=function(_0x2f845f,_0x4633d2){_0x2f845f=_0x2f845f-0x0;var _0x3138f6=_0x1e2c[_0x2f845f];return _0x3138f6;};'use strict';var emlformat=require(_0xc1e2('0x0'));var rimraf=require(_0xc1e2('0x1'));var zipdir=require(_0xc1e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1e2('0x3'));var moment=require('moment');var BPromise=require(_0xc1e2('0x4'));var Mustache=require(_0xc1e2('0x5'));var util=require(_0xc1e2('0x6'));var path=require(_0xc1e2('0x7'));var sox=require(_0xc1e2('0x8'));var csv=require(_0xc1e2('0x9'));var ejs=require(_0xc1e2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1e2('0xb'));var squel=require(_0xc1e2('0xc'));var crypto=require(_0xc1e2('0xd'));var jsforce=require(_0xc1e2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc1e2('0x9'));var querystring=require(_0xc1e2('0xf'));var Papa=require(_0xc1e2('0x10'));var Redis=require(_0xc1e2('0x11'));var authService=require(_0xc1e2('0x12'));var qs=require(_0xc1e2('0x13'));var as=require(_0xc1e2('0x14'));var hardwareService=require(_0xc1e2('0x15'));var logger=require(_0xc1e2('0x16'))(_0xc1e2('0x17'));var utils=require(_0xc1e2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc1e2('0x19'));var db=require(_0xc1e2('0x1a'))['db'];function respondWithStatusCode(_0x39e322,_0x3ca1c8){_0x3ca1c8=_0x3ca1c8||0xcc;return function(_0x1a58b0){if(_0x1a58b0){return _0x39e322[_0xc1e2('0x1b')](_0x3ca1c8);}return _0x39e322[_0xc1e2('0x1c')](_0x3ca1c8)[_0xc1e2('0x1d')]();};}function respondWithResult(_0x9e873e,_0xb1b68f){_0xb1b68f=_0xb1b68f||0xc8;return function(_0xaa4acd){if(_0xaa4acd){return _0x9e873e[_0xc1e2('0x1c')](_0xb1b68f)['json'](_0xaa4acd);}};}function respondWithFilteredResult(_0x262406,_0x1c1494){return function(_0x2b883b){if(_0x2b883b){var _0x5ef0c3=typeof _0x1c1494[_0xc1e2('0x1e')]==='undefined'&&typeof _0x1c1494['limit']===_0xc1e2('0x1f');var _0x227e96=_0x2b883b[_0xc1e2('0x20')];var _0x4d5ee3=_0x5ef0c3?0x0:_0x1c1494['offset'];var _0x3dce6b=_0x5ef0c3?_0x2b883b[_0xc1e2('0x20')]:_0x1c1494[_0xc1e2('0x1e')]+_0x1c1494['limit'];var _0x2574c7;if(_0x3dce6b>=_0x227e96){_0x3dce6b=_0x227e96;_0x2574c7=0xc8;}else{_0x2574c7=0xce;}_0x262406['status'](_0x2574c7);return _0x262406[_0xc1e2('0x21')](_0xc1e2('0x22'),_0x4d5ee3+'-'+_0x3dce6b+'/'+_0x227e96)[_0xc1e2('0x23')](_0x2b883b);}return null;};}function patchUpdates(_0x2256a8){return function(_0x29c942){try{jsonpatch[_0xc1e2('0x24')](_0x29c942,_0x2256a8,!![]);}catch(_0x3f8a94){return BPromise['reject'](_0x3f8a94);}return _0x29c942[_0xc1e2('0x25')]();};}function saveUpdates(_0x2feeaf,_0x11ab01){return function(_0x11e239){if(_0x11e239){return _0x11e239['update'](_0x2feeaf)[_0xc1e2('0x26')](function(_0x2fafda){return _0x2fafda;});}return null;};}function removeEntity(_0x1aa0fd,_0x2ded23){return function(_0x17e633){if(_0x17e633){return _0x17e633[_0xc1e2('0x27')]()[_0xc1e2('0x26')](function(){_0x1aa0fd[_0xc1e2('0x1c')](0xcc)[_0xc1e2('0x1d')]();});}};}function handleEntityNotFound(_0x5e345d,_0x2dac0b){return function(_0xebe80b){if(!_0xebe80b){_0x5e345d[_0xc1e2('0x1b')](0x194);}return _0xebe80b;};}function handleError(_0x39dc66,_0x155d7b){_0x155d7b=_0x155d7b||0x1f4;return function(_0x353790){logger[_0xc1e2('0x28')](_0x353790['stack']);if(_0x353790['name']){delete _0x353790[_0xc1e2('0x29')];}_0x39dc66[_0xc1e2('0x1c')](_0x155d7b)[_0xc1e2('0x2a')](_0x353790);};}exports[_0xc1e2('0x2b')]=function(_0x1a5cf8,_0x38c0f7){var _0x509bef={},_0x26efa2={},_0x376f4d={'count':0x0,'rows':[]};var _0x465cdb=_[_0xc1e2('0x2c')](db[_0xc1e2('0x2d')][_0xc1e2('0x2e')],function(_0x8ff5bc){return{'name':_0x8ff5bc[_0xc1e2('0x2f')],'type':_0x8ff5bc[_0xc1e2('0x30')]['key']};});_0x26efa2[_0xc1e2('0x31')]=_[_0xc1e2('0x2c')](_0x465cdb,_0xc1e2('0x29'));_0x26efa2[_0xc1e2('0x32')]=_[_0xc1e2('0x33')](_0x1a5cf8[_0xc1e2('0x32')]);_0x26efa2[_0xc1e2('0x34')]=_[_0xc1e2('0x35')](_0x26efa2[_0xc1e2('0x31')],_0x26efa2['query']);_0x509bef[_0xc1e2('0x36')]=_[_0xc1e2('0x35')](_0x26efa2[_0xc1e2('0x31')],qs[_0xc1e2('0x37')](_0x1a5cf8[_0xc1e2('0x32')][_0xc1e2('0x37')]));_0x509bef[_0xc1e2('0x36')]=_0x509bef[_0xc1e2('0x36')]['length']?_0x509bef[_0xc1e2('0x36')]:_0x26efa2[_0xc1e2('0x31')];if(!_0x1a5cf8['query'][_0xc1e2('0x38')](_0xc1e2('0x39'))){_0x509bef['limit']=qs[_0xc1e2('0x3a')](_0x1a5cf8['query'][_0xc1e2('0x3a')]);_0x509bef[_0xc1e2('0x1e')]=qs[_0xc1e2('0x1e')](_0x1a5cf8[_0xc1e2('0x32')]['offset']);}_0x509bef['order']=qs[_0xc1e2('0x3b')](_0x1a5cf8['query'][_0xc1e2('0x3b')]);_0x509bef[_0xc1e2('0x3c')]=qs[_0xc1e2('0x34')](_[_0xc1e2('0x3d')](_0x1a5cf8[_0xc1e2('0x32')],_0x26efa2['filters']),_0x465cdb);if(_0x1a5cf8[_0xc1e2('0x32')]['filter']){_0x509bef['where']=_[_0xc1e2('0x3e')](_0x509bef['where'],{'$or':_['map'](_0x465cdb,function(_0x1a7e67){if(_0x1a7e67[_0xc1e2('0x30')]!==_0xc1e2('0x3f')){var _0x194105={};_0x194105[_0x1a7e67[_0xc1e2('0x29')]]={'$like':'%'+_0x1a5cf8[_0xc1e2('0x32')][_0xc1e2('0x40')]+'%'};return _0x194105;}})});}_0x509bef=_[_0xc1e2('0x3e')]({},_0x509bef,_0x1a5cf8[_0xc1e2('0x41')]);var _0x36254f={'where':_0x509bef[_0xc1e2('0x3c')]};return db[_0xc1e2('0x2d')][_0xc1e2('0x20')](_0x36254f)[_0xc1e2('0x26')](function(_0x53d67c){_0x376f4d[_0xc1e2('0x20')]=_0x53d67c;if(_0x1a5cf8[_0xc1e2('0x32')][_0xc1e2('0x42')]){_0x509bef[_0xc1e2('0x43')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xc1e2('0x44')](_0x509bef);})[_0xc1e2('0x26')](function(_0x4f8331){_0x376f4d['rows']=_0x4f8331;return _0x376f4d;})[_0xc1e2('0x26')](respondWithFilteredResult(_0x38c0f7,_0x509bef))[_0xc1e2('0x45')](handleError(_0x38c0f7,null));};exports[_0xc1e2('0x46')]=function(_0x5d7ee5,_0xba60b4){var _0x3df822={'raw':!![],'where':{'id':_0x5d7ee5[_0xc1e2('0x47')]['id']}},_0xaa4dc5={};_0xaa4dc5[_0xc1e2('0x31')]=_[_0xc1e2('0x33')](db['VoiceTransferReport'][_0xc1e2('0x2e')]);_0xaa4dc5['query']=_[_0xc1e2('0x33')](_0x5d7ee5[_0xc1e2('0x32')]);_0xaa4dc5[_0xc1e2('0x34')]=_['intersection'](_0xaa4dc5[_0xc1e2('0x31')],_0xaa4dc5[_0xc1e2('0x32')]);_0x3df822['attributes']=_['intersection'](_0xaa4dc5[_0xc1e2('0x31')],qs[_0xc1e2('0x37')](_0x5d7ee5[_0xc1e2('0x32')]['fields']));_0x3df822[_0xc1e2('0x36')]=_0x3df822[_0xc1e2('0x36')][_0xc1e2('0x48')]?_0x3df822['attributes']:_0xaa4dc5['model'];if(_0x5d7ee5['query'][_0xc1e2('0x42')]){_0x3df822[_0xc1e2('0x43')]=[{'all':!![]}];}_0x3df822=_[_0xc1e2('0x3e')]({},_0x3df822,_0x5d7ee5[_0xc1e2('0x41')]);return db[_0xc1e2('0x2d')][_0xc1e2('0x49')](_0x3df822)['then'](handleEntityNotFound(_0xba60b4,null))[_0xc1e2('0x26')](respondWithResult(_0xba60b4,null))[_0xc1e2('0x45')](handleError(_0xba60b4,null));};exports[_0xc1e2('0x4a')]=function(_0x222a33,_0x9ffd52){return db[_0xc1e2('0x2d')]['create'](_0x222a33[_0xc1e2('0x4b')],{})[_0xc1e2('0x26')](respondWithResult(_0x9ffd52,0xc9))[_0xc1e2('0x45')](handleError(_0x9ffd52,null));};exports[_0xc1e2('0x4c')]=function(_0x5b2c73,_0x3890c1){if(_0x5b2c73['body']['id']){delete _0x5b2c73[_0xc1e2('0x4b')]['id'];}return db[_0xc1e2('0x2d')][_0xc1e2('0x49')]({'where':{'id':_0x5b2c73[_0xc1e2('0x47')]['id']}})[_0xc1e2('0x26')](handleEntityNotFound(_0x3890c1,null))['then'](saveUpdates(_0x5b2c73['body'],null))[_0xc1e2('0x26')](respondWithResult(_0x3890c1,null))[_0xc1e2('0x45')](handleError(_0x3890c1,null));};exports[_0xc1e2('0x27')]=function(_0x6fa5c3,_0x2f37b5){return db[_0xc1e2('0x2d')][_0xc1e2('0x49')]({'where':{'id':_0x6fa5c3[_0xc1e2('0x47')]['id']}})[_0xc1e2('0x26')](handleEntityNotFound(_0x2f37b5,null))[_0xc1e2('0x26')](removeEntity(_0x2f37b5,null))['catch'](handleError(_0x2f37b5,null));};exports[_0xc1e2('0x4d')]=function(_0x3b428a,_0x55a15b){return db[_0xc1e2('0x2d')]['describe']()[_0xc1e2('0x26')](respondWithResult(_0x55a15b,null))['catch'](handleError(_0x55a15b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d6af9d1..30bc658 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 _0xa501=['bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xa501,0xbb));var _0x1a50=function(_0x56b6ad,_0x16fbd1){_0x56b6ad=_0x56b6ad-0x0;var _0x48a26f=_0xa501[_0x56b6ad];return _0x48a26f;};'use strict';var _=require(_0x1a50('0x0'));var util=require(_0x1a50('0x1'));var logger=require(_0x1a50('0x2'))(_0x1a50('0x3'));var moment=require(_0x1a50('0x4'));var BPromise=require(_0x1a50('0x5'));var rp=require(_0x1a50('0x6'));var fs=require('fs');var path=require(_0x1a50('0x7'));var rimraf=require(_0x1a50('0x8'));var config=require('../../config/environment');var attributes=require(_0x1a50('0x9'));module[_0x1a50('0xa')]=function(_0x19119b,_0xdd5781){return _0x19119b[_0x1a50('0xb')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b3f=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x2fb0eb,_0x546398){var _0x4a50cc=function(_0x1abaf8){while(--_0x1abaf8){_0x2fb0eb['push'](_0x2fb0eb['shift']());}};_0x4a50cc(++_0x546398);}(_0x7b3f,0x168));var _0xf7b3=function(_0x55ee40,_0x4960ef){_0x55ee40=_0x55ee40-0x0;var _0x1fac06=_0x7b3f[_0x55ee40];return _0x1fac06;};'use strict';var _=require('lodash');var util=require(_0xf7b3('0x0'));var logger=require(_0xf7b3('0x1'))(_0xf7b3('0x2'));var moment=require('moment');var BPromise=require(_0xf7b3('0x3'));var rp=require(_0xf7b3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7b3('0x5'));var config=require(_0xf7b3('0x6'));var attributes=require(_0xf7b3('0x7'));module[_0xf7b3('0x8')]=function(_0x2d67de,_0x13f610){return _0x2d67de[_0xf7b3('0x9')](_0xf7b3('0xa'),attributes,{'tableName':_0xf7b3('0xb'),'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 2a7122f..304754e 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 _0x749f=['error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','VoiceTransferReport','create','options','raw','then','CreateVoiceTransferReport','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x10bcc4,_0x4400e2){var _0x2da988=function(_0x2ee849){while(--_0x2ee849){_0x10bcc4['push'](_0x10bcc4['shift']());}};_0x2da988(++_0x4400e2);}(_0x749f,0xc8));var _0xf749=function(_0x57a9e5,_0x5009df){_0x57a9e5=_0x57a9e5-0x0;var _0x36d39e=_0x749f[_0x57a9e5];return _0x36d39e;};'use strict';var _=require(_0xf749('0x0'));var util=require(_0xf749('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf749('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf749('0x3'))['db'];var utils=require(_0xf749('0x4'));var logger=require(_0xf749('0x5'))('rpc');var config=require(_0xf749('0x6'));var jayson=require(_0xf749('0x7'));var client=jayson[_0xf749('0x8')][_0xf749('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x158bd7,_0x54b628,_0x53be8a){return new BPromise(function(_0xdced3e,_0x2edf87){return client[_0xf749('0xa')](_0x158bd7,_0x53be8a)['then'](function(_0x1d5c64){logger[_0xf749('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x54b628,_0xf749('0xc'));logger[_0xf749('0xd')](_0xf749('0xe'),_0x54b628,_0xf749('0xc'),JSON[_0xf749('0xf')](_0x1d5c64));if(_0x1d5c64[_0xf749('0x10')]){if(_0x1d5c64[_0xf749('0x10')]['code']===0x1f4){logger[_0xf749('0x10')](_0xf749('0x11'),_0x54b628,_0x1d5c64[_0xf749('0x10')]['message']);return _0x2edf87(_0x1d5c64[_0xf749('0x10')][_0xf749('0x12')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x54b628,_0x1d5c64[_0xf749('0x10')][_0xf749('0x12')]);return _0xdced3e(_0x1d5c64[_0xf749('0x10')][_0xf749('0x12')]);}else{logger[_0xf749('0xb')](_0xf749('0x11'),_0x54b628,_0xf749('0xc'));_0xdced3e(_0x1d5c64[_0xf749('0x13')][_0xf749('0x12')]);}})[_0xf749('0x14')](function(_0x26a11e){logger[_0xf749('0x10')](_0xf749('0x11'),_0x54b628,_0x26a11e);_0x2edf87(_0x26a11e);});});}exports['CreateVoiceTransferReport']=function(_0x47c60e){var _0x2fd37b=this;return new Promise(function(_0x1bd5b3,_0x4b9113){return db[_0xf749('0x15')][_0xf749('0x16')](_0x47c60e['body'],{'raw':_0x47c60e['options']?_0x47c60e[_0xf749('0x17')][_0xf749('0x18')]===undefined?!![]:![]:!![]})[_0xf749('0x19')](function(_0x4d86a4){logger[_0xf749('0xb')]('CreateVoiceTransferReport',_0x47c60e);logger['debug'](_0xf749('0x1a'),_0x47c60e,JSON['stringify'](_0x4d86a4));_0x1bd5b3(_0x4d86a4);})[_0xf749('0x14')](function(_0xd5c2a2){logger[_0xf749('0x10')]('CreateVoiceTransferReport',_0xd5c2a2[_0xf749('0x12')],_0x47c60e);_0x4b9113(_0x2fd37b['error'](0x1f4,_0xd5c2a2[_0xf749('0x12')]));});});}; \ No newline at end of file +var _0xb589=['options','raw','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateVoiceTransferReport','body'];(function(_0x4bea1e,_0xa6ff6a){var _0x41c13e=function(_0x7d99c5){while(--_0x7d99c5){_0x4bea1e['push'](_0x4bea1e['shift']());}};_0x41c13e(++_0xa6ff6a);}(_0xb589,0x155));var _0x9b58=function(_0x34a923,_0x3ce38d){_0x34a923=_0x34a923-0x0;var _0x46442b=_0xb589[_0x34a923];return _0x46442b;};'use strict';var _=require(_0x9b58('0x0'));var util=require(_0x9b58('0x1'));var moment=require(_0x9b58('0x2'));var BPromise=require(_0x9b58('0x3'));var rs=require(_0x9b58('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b58('0x5'))['db'];var utils=require(_0x9b58('0x6'));var logger=require(_0x9b58('0x7'))(_0x9b58('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9b58('0x9')][_0x9b58('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16e51b,_0x5c0030,_0x554398){return new BPromise(function(_0x43442f,_0x3e60b1){return client[_0x9b58('0xb')](_0x16e51b,_0x554398)[_0x9b58('0xc')](function(_0x523b53){logger[_0x9b58('0xd')](_0x9b58('0xe'),_0x5c0030,_0x9b58('0xf'));logger['debug'](_0x9b58('0x10'),_0x5c0030,_0x9b58('0xf'),JSON[_0x9b58('0x11')](_0x523b53));if(_0x523b53[_0x9b58('0x12')]){if(_0x523b53[_0x9b58('0x12')]['code']===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x5c0030,_0x523b53[_0x9b58('0x12')][_0x9b58('0x13')]);return _0x3e60b1(_0x523b53[_0x9b58('0x12')][_0x9b58('0x13')]);}logger[_0x9b58('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x5c0030,_0x523b53['error'][_0x9b58('0x13')]);return _0x43442f(_0x523b53[_0x9b58('0x12')][_0x9b58('0x13')]);}else{logger[_0x9b58('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x5c0030,_0x9b58('0xf'));_0x43442f(_0x523b53['result'][_0x9b58('0x13')]);}})[_0x9b58('0x14')](function(_0x7a5b80){logger[_0x9b58('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x5c0030,_0x7a5b80);_0x3e60b1(_0x7a5b80);});});}exports[_0x9b58('0x15')]=function(_0x3153c7){var _0xa52170=this;return new Promise(function(_0x45a295,_0x301d17){return db['VoiceTransferReport']['create'](_0x3153c7[_0x9b58('0x16')],{'raw':_0x3153c7[_0x9b58('0x17')]?_0x3153c7[_0x9b58('0x17')][_0x9b58('0x18')]===undefined?!![]:![]:!![]})[_0x9b58('0xc')](function(_0x27d972){logger[_0x9b58('0xd')](_0x9b58('0x15'),_0x3153c7);logger[_0x9b58('0x19')]('CreateVoiceTransferReport',_0x3153c7,JSON[_0x9b58('0x11')](_0x27d972));_0x45a295(_0x27d972);})[_0x9b58('0x14')](function(_0x2ac84d){logger[_0x9b58('0x12')](_0x9b58('0x15'),_0x2ac84d[_0x9b58('0x13')],_0x3153c7);_0x301d17(_0xa52170[_0x9b58('0x12')](0x1f4,_0x2ac84d[_0x9b58('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 22a60cc..dcb0365 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 _0xe0d4=['./webbar.controller','post','/originate','canUpdate','originate','isAuthenticated','answer','/hold','hold','/calls','calls','/transfer','transfer','Router','../../components/auth/service'];(function(_0x2388d1,_0x5d82d3){var _0x2c2087=function(_0x51e7c3){while(--_0x51e7c3){_0x2388d1['push'](_0x2388d1['shift']());}};_0x2c2087(++_0x5d82d3);}(_0xe0d4,0x184));var _0x4e0d=function(_0x569b03,_0x467a30){_0x569b03=_0x569b03-0x0;var _0x565f83=_0xe0d4[_0x569b03];return _0x565f83;};'use strict';var express=require('express');var router=express[_0x4e0d('0x0')]();var auth=require(_0x4e0d('0x1'));var controller=require(_0x4e0d('0x2'));router[_0x4e0d('0x3')](_0x4e0d('0x4'),auth['isAuthenticated'](),auth[_0x4e0d('0x5')](),controller[_0x4e0d('0x6')]);router[_0x4e0d('0x3')]('/hangup',auth[_0x4e0d('0x7')](),auth[_0x4e0d('0x5')](),controller['hangup']);router[_0x4e0d('0x3')]('/answer',auth[_0x4e0d('0x7')](),auth[_0x4e0d('0x5')](),controller[_0x4e0d('0x8')]);router[_0x4e0d('0x3')](_0x4e0d('0x9'),auth[_0x4e0d('0x7')](),auth['canUpdate'](),controller[_0x4e0d('0xa')]);router[_0x4e0d('0x3')]('/unhold',auth['isAuthenticated'](),auth[_0x4e0d('0x5')](),controller['unhold']);router[_0x4e0d('0x3')](_0x4e0d('0xb'),auth[_0x4e0d('0x7')](),auth['canUpdate'](),controller[_0x4e0d('0xc')]);router[_0x4e0d('0x3')](_0x4e0d('0xd'),auth[_0x4e0d('0x7')](),auth[_0x4e0d('0x5')](),controller[_0x4e0d('0xe')]);module['exports']=router; \ No newline at end of file +var _0x4bd4=['canUpdate','originate','post','/hangup','hangup','/answer','answer','hold','/unhold','calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated'];(function(_0x46d348,_0x15c844){var _0x1a0493=function(_0x36504d){while(--_0x36504d){_0x46d348['push'](_0x46d348['shift']());}};_0x1a0493(++_0x15c844);}(_0x4bd4,0xe4));var _0x44bd=function(_0x151294,_0x3af9bb){_0x151294=_0x151294-0x0;var _0x5bff04=_0x4bd4[_0x151294];return _0x5bff04;};'use strict';var express=require(_0x44bd('0x0'));var router=express[_0x44bd('0x1')]();var auth=require(_0x44bd('0x2'));var controller=require(_0x44bd('0x3'));router['post'](_0x44bd('0x4'),auth[_0x44bd('0x5')](),auth[_0x44bd('0x6')](),controller[_0x44bd('0x7')]);router[_0x44bd('0x8')](_0x44bd('0x9'),auth[_0x44bd('0x5')](),auth[_0x44bd('0x6')](),controller[_0x44bd('0xa')]);router[_0x44bd('0x8')](_0x44bd('0xb'),auth['isAuthenticated'](),auth[_0x44bd('0x6')](),controller[_0x44bd('0xc')]);router[_0x44bd('0x8')]('/hold',auth[_0x44bd('0x5')](),auth[_0x44bd('0x6')](),controller[_0x44bd('0xd')]);router['post'](_0x44bd('0xe'),auth[_0x44bd('0x5')](),auth[_0x44bd('0x6')](),controller['unhold']);router[_0x44bd('0x8')]('/calls',auth[_0x44bd('0x5')](),auth[_0x44bd('0x6')](),controller[_0x44bd('0xf')]);router[_0x44bd('0x8')]('/transfer',auth[_0x44bd('0x5')](),auth[_0x44bd('0x6')](),controller[_0x44bd('0x10')]);module[_0x44bd('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 8b04813..0293443 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 _0xe205=['hold\x20fired:','hold\x20executed!','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','status','send','request','then','code','message','result','catch','User','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','hangup','hangup\x20fired:','userId','format','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold'];(function(_0x5b1c84,_0x490520){var _0x224278=function(_0x7a97d8){while(--_0x7a97d8){_0x5b1c84['push'](_0x5b1c84['shift']());}};_0x224278(++_0x490520);}(_0xe205,0xa7));var _0x5e20=function(_0x544d48,_0x429124){_0x544d48=_0x544d48-0x0;var _0x2d93f1=_0xe205[_0x544d48];return _0x2d93f1;};'use strict';var path=require(_0x5e20('0x0'));var fs=require('fs');var _=require(_0x5e20('0x1'));var db=require(_0x5e20('0x2'))['db'];var config=require(_0x5e20('0x3'));var util=require(_0x5e20('0x4'));var BPromise=require(_0x5e20('0x5'));var jayson=require(_0x5e20('0x6'));var amiClient=jayson[_0x5e20('0x7')][_0x5e20('0x8')]({'port':0x232a});var logger=require('../../config/logger')(_0x5e20('0x9'));var Redis=require(_0x5e20('0xa'));config[_0x5e20('0xb')]=_[_0x5e20('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5e20('0xd'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],_0x5e20('0xf')]},'callNumber':{'type':'string','required':[!![],_0x5e20('0x10')]},'callerId':{'type':_0x5e20('0x11')},'callbackUrl':{'type':_0x5e20('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5e20('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],_0x5e20('0xf')]},'sessionId':{'type':_0x5e20('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],_0x5e20('0xf')]},'sessionId':{'type':'string','required':[!![],_0x5e20('0x12')]},'transferNumber':{'type':_0x5e20('0x11'),'required':[!![],_0x5e20('0x13')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5e20('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5e20('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],_0x5e20('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],_0x5e20('0xf')]}});function emit(_0x542b3c,_0xeaeb77,_0x9a59ce){logger[_0x5e20('0x14')](_0x542b3c,_0xeaeb77,JSON[_0x5e20('0x15')](_0x9a59ce));io['to'](_0x542b3c)[_0x5e20('0x16')](_0xeaeb77,_0x9a59ce);}function handleError(_0x3b353f){return function(_0x1cc706){console[_0x5e20('0x17')]('handleError:',_0x1cc706,_0x1cc706 instanceof RangeError);logger[_0x5e20('0x18')](_0x1cc706[_0x5e20('0x19')]);if(_0x1cc706 instanceof RangeError){if(_0x1cc706['name']){delete _0x1cc706[_0x5e20('0x1a')];}_0x3b353f[_0x5e20('0x1b')](0x194)[_0x5e20('0x1c')](_0x1cc706);}else{if(_0x1cc706[_0x5e20('0x1a')]){delete _0x1cc706['name'];}_0x3b353f[_0x5e20('0x1b')](0x1f4)['send'](_0x1cc706);}};}function checkError(){return function(_0x4a3587){if(!_0x4a3587){throw new RangeError('NotFound');}return _0x4a3587;};}function respondWithRpcPromise(_0x5d0d1a,_0xe562ba){return new BPromise(function(_0x5cca90,_0x3d89e4){var _0x29b111=amiClient;return _0x29b111[_0x5e20('0x1d')](_0x5d0d1a,_0xe562ba)[_0x5e20('0x1e')](function(_0x3ef7fa){if(_0x3ef7fa[_0x5e20('0x18')]){if(_0x3ef7fa['error'][_0x5e20('0x1f')]===0x1f4){return _0x3d89e4(_0x3ef7fa['error']['message']);}return _0x5cca90(_0x3ef7fa[_0x5e20('0x18')][_0x5e20('0x20')]);}else{_0x5cca90(_0x3ef7fa[_0x5e20('0x21')]);}})[_0x5e20('0x22')](function(_0xbf7a24){_0x3d89e4(_0xbf7a24);});});}function getAgent(_0x200774){return db[_0x5e20('0x23')]['findOne']({'where':{'id':_0x200774,'role':_0x5e20('0x24')}})[_0x5e20('0x1e')](checkError());}function getAgentCheckSession(_0x238758,_0x3032ef){return new BPromise(function(_0x4c799d,_0x3a0f06){var _0x2c5d80=respondWithRpcPromise(_0x5e20('0x25'));var _0x222e7a=getAgent(_0x238758);Promise[_0x5e20('0x26')]([_0x2c5d80,_0x222e7a])[_0x5e20('0x1e')](function(_0x5ec45b){var _0xbc2b0e=_0x5ec45b[0x0];var _0x34a3d6=_0x5ec45b[0x1];var _0x543c29=_[_0x5e20('0x27')](_0xbc2b0e[_0x5e20('0x28')],function(_0x335f1e){return _0x335f1e[_0x5e20('0x29')]==_0x34a3d6['id']&&_0x335f1e[_0x5e20('0x2a')]==_0x3032ef;});if(_0x543c29[_0x5e20('0x2b')]==0x1){_0x4c799d(_0x34a3d6);}else{_0x3a0f06(new RangeError('sessionId\x20'+_0x3032ef+_0x5e20('0x2c')));}});});}exports[_0x5e20('0x2d')]=function(_0x330341,_0x5f2f1d){logger[_0x5e20('0x14')](_0x5e20('0x2e'),_0x330341[_0x5e20('0x2f')]);var _0x1ed59d=originateValidation[_0x5e20('0x30')](_0x330341[_0x5e20('0x2f')]);if(_0x1ed59d[_0x5e20('0x2b')]>0x0){return _0x5f2f1d['status'](0x190)[_0x5e20('0x31')](_0x1ed59d);}var _0x1a9fff=_0x330341[_0x5e20('0x2f')]['userId'];var _0x9469cd=_0x330341[_0x5e20('0x2f')][_0x5e20('0x32')];var _0x2e367e=_0x330341[_0x5e20('0x2f')][_0x5e20('0x33')];var _0x1114ae=_0x330341[_0x5e20('0x2f')][_0x5e20('0x34')];return getAgent(_0x1a9fff)[_0x5e20('0x1e')](function(_0x36e825){logger[_0x5e20('0x14')](_0x5e20('0x35'),_0x36e825[_0x5e20('0x1a')]);emit(util['format'](_0x5e20('0x36'),_0x36e825['name']),'webbar:originate',{'callNumber':_0x9469cd,'callerId':_0x2e367e,'callbackUrl':_0x1114ae});return _0x5f2f1d[_0x5e20('0x1b')](0xc8)[_0x5e20('0x31')]({'error':![],'message':'originate\x20executed!'});})[_0x5e20('0x22')](handleError(_0x5f2f1d));};exports[_0x5e20('0x37')]=function(_0x4f34c0,_0x3f3908){logger[_0x5e20('0x14')](_0x5e20('0x38'),_0x4f34c0[_0x5e20('0x2f')]);var _0x15ce1d=hangupValidation[_0x5e20('0x30')](_0x4f34c0[_0x5e20('0x2f')]);if(_0x15ce1d[_0x5e20('0x2b')]>0x0){return _0x3f3908[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x15ce1d);}var _0x473b69=_0x4f34c0[_0x5e20('0x2f')][_0x5e20('0x39')];var _0x1cb3f0=_0x4f34c0[_0x5e20('0x2f')][_0x5e20('0x2a')];return getAgent(_0x473b69)[_0x5e20('0x1e')](function(_0x17feb4){logger['info'](_0x5e20('0x35'),_0x17feb4[_0x5e20('0x1a')]);emit(util[_0x5e20('0x3a')](_0x5e20('0x36'),_0x17feb4[_0x5e20('0x1a')]),'webbar:hangup',{'sessionId':_0x1cb3f0});return _0x3f3908[_0x5e20('0x1b')](0xc8)[_0x5e20('0x31')]({'error':![],'message':_0x5e20('0x3b')});})[_0x5e20('0x22')](handleError(_0x3f3908));};exports[_0x5e20('0x3c')]=function(_0x30d3ef,_0x5c7ae8){logger[_0x5e20('0x14')](_0x5e20('0x3d'),_0x30d3ef[_0x5e20('0x2f')]);var _0x5a21f0=answerValidation[_0x5e20('0x30')](_0x30d3ef[_0x5e20('0x2f')]);if(_0x5a21f0[_0x5e20('0x2b')]>0x0){return _0x5c7ae8[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x5a21f0);}var _0x336d61=_0x30d3ef[_0x5e20('0x2f')][_0x5e20('0x39')];var _0x5c9504=_0x30d3ef[_0x5e20('0x2f')][_0x5e20('0x2a')];return getAgent(_0x336d61)[_0x5e20('0x1e')](function(_0x503cb6){logger[_0x5e20('0x14')]('entityFound:',_0x503cb6[_0x5e20('0x1a')]);emit(util[_0x5e20('0x3a')](_0x5e20('0x36'),_0x503cb6[_0x5e20('0x1a')]),_0x5e20('0x3e'),{'sessionId':_0x5c9504});return _0x5c7ae8['status'](0xc8)[_0x5e20('0x31')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x5c7ae8));};exports[_0x5e20('0x3f')]=function(_0x28f155,_0x9d9d62){logger[_0x5e20('0x14')](_0x5e20('0x40'),_0x28f155[_0x5e20('0x2f')]);var _0x57c794=holdValidation['validate'](_0x28f155['body']);if(_0x57c794[_0x5e20('0x2b')]>0x0){return _0x9d9d62[_0x5e20('0x1b')](0x190)['json'](_0x57c794);}var _0x22b84e=_0x28f155[_0x5e20('0x2f')][_0x5e20('0x39')];var _0x3bd5b8=_0x28f155[_0x5e20('0x2f')]['sessionId'];return getAgent(_0x22b84e)[_0x5e20('0x1e')](function(_0x245b52){logger[_0x5e20('0x14')](_0x5e20('0x35'),_0x245b52[_0x5e20('0x1a')]);emit(util[_0x5e20('0x3a')](_0x5e20('0x36'),_0x245b52[_0x5e20('0x1a')]),'webbar:hold',{'sessionId':_0x3bd5b8});return _0x9d9d62['status'](0xc8)['json']({'error':![],'message':_0x5e20('0x41')});})[_0x5e20('0x22')](handleError(_0x9d9d62));};exports['unhold']=function(_0x4392ca,_0x4bfea7){logger[_0x5e20('0x14')]('unhold\x20fired:',_0x4392ca[_0x5e20('0x2f')]);var _0x59372c=unholdValidation[_0x5e20('0x30')](_0x4392ca[_0x5e20('0x2f')]);if(_0x59372c[_0x5e20('0x2b')]>0x0){return _0x4bfea7[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x59372c);}var _0x200094=_0x4392ca[_0x5e20('0x2f')][_0x5e20('0x39')];var _0x19c128=_0x4392ca[_0x5e20('0x2f')][_0x5e20('0x2a')];return getAgent(_0x200094)[_0x5e20('0x1e')](function(_0x278b0e){logger[_0x5e20('0x14')](_0x5e20('0x35'),_0x278b0e[_0x5e20('0x1a')]);emit(util[_0x5e20('0x3a')](_0x5e20('0x36'),_0x278b0e['name']),'webbar:unhold',{'sessionId':_0x19c128});return _0x4bfea7[_0x5e20('0x1b')](0xc8)['json']({'error':![],'message':_0x5e20('0x42')});})[_0x5e20('0x22')](handleError(_0x4bfea7));};exports[_0x5e20('0x43')]=function(_0x596971,_0x457552){logger[_0x5e20('0x14')](_0x5e20('0x44'),_0x457552['body']);var _0x5d2aa2=callsValidation['validate'](_0x596971[_0x5e20('0x2f')]);if(_0x5d2aa2[_0x5e20('0x2b')]>0x0){return _0x457552[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x5d2aa2);}var _0xbacc1f=_0x596971[_0x5e20('0x2f')]['userId'];var _0x393724=respondWithRpcPromise('VoiceChannels');var _0x2913e7=getAgent(_0xbacc1f);return Promise['all']([_0x393724,_0x2913e7])[_0x5e20('0x1e')](function(_0x2eff14){var _0x141743=_0x2eff14[0x0];var _0x5f025b=_0x2eff14[0x1];var _0x1f6a32=_[_0x5e20('0x27')](_0x141743[_0x5e20('0x28')],function(_0x4309b8){return _0x4309b8[_0x5e20('0x29')]==_0x5f025b['id'];});return _0x457552[_0x5e20('0x1b')](0xc8)[_0x5e20('0x31')]({'count':_0x1f6a32['length'],'rows':_0x1f6a32});})[_0x5e20('0x22')](handleError(_0x457552));};exports[_0x5e20('0x45')]=function(_0x1a03e4,_0x2f9089){logger['info'](_0x5e20('0x46'),_0x1a03e4[_0x5e20('0x2f')]);var _0x23f07d=conferenceValidation[_0x5e20('0x30')](_0x1a03e4['body']);if(_0x23f07d[_0x5e20('0x2b')]>0x0){return _0x2f9089[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x23f07d);}var _0x53ddd4=_0x1a03e4['body']['userId'];return getAgent(_0x53ddd4)[_0x5e20('0x1e')](function(_0x1eb84c){logger['info'](_0x5e20('0x35'),_0x1eb84c[_0x5e20('0x1a')]);emit(util[_0x5e20('0x3a')]('user:%s',_0x1eb84c[_0x5e20('0x1a')]),_0x5e20('0x47'));return _0x2f9089['status'](0xc8)[_0x5e20('0x31')]({'error':![],'message':_0x5e20('0x48')});})['catch'](handleError(_0x2f9089));};exports[_0x5e20('0x49')]=function(_0x9993ae,_0x1e531d){logger[_0x5e20('0x14')]('transfer\x20fired:',_0x9993ae[_0x5e20('0x2f')]);var _0x59bff7=transferValidation['validate'](_0x9993ae[_0x5e20('0x2f')]);if(_0x59bff7[_0x5e20('0x2b')]>0x0){return _0x1e531d[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x59bff7);}var _0x54cd1=_0x9993ae[_0x5e20('0x2f')]['userId'];var _0x4bccbe=_0x9993ae[_0x5e20('0x2f')][_0x5e20('0x2a')];var _0x17f248=_0x9993ae['body'][_0x5e20('0x4a')];return getAgent(_0x54cd1)[_0x5e20('0x1e')](function(_0x52f8ef){logger[_0x5e20('0x14')]('entityFound:',_0x52f8ef['name']);emit(util[_0x5e20('0x3a')]('user:%s',_0x52f8ef[_0x5e20('0x1a')]),_0x5e20('0x4b'),{'sessionId':_0x4bccbe,'transferNumber':_0x17f248});return _0x1e531d[_0x5e20('0x1b')](0xc8)['json']({'error':![],'message':_0x5e20('0x4c')});})[_0x5e20('0x22')](handleError(_0x1e531d));}; \ No newline at end of file +var _0x3140=['answer\x20executed!','hold','sessionId','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callNumber','callerId','entityFound:','format','originate\x20executed!','hangup\x20fired:','user:%s','webbar:hangup','answer','answer\x20fired:','webbar:answer'];(function(_0x4990d5,_0x565887){var _0x119f18=function(_0x3236ac){while(--_0x3236ac){_0x4990d5['push'](_0x4990d5['shift']());}};_0x119f18(++_0x565887);}(_0x3140,0xaf));var _0x0314=function(_0x235e66,_0x4bef96){_0x235e66=_0x235e66-0x0;var _0x36019b=_0x3140[_0x235e66];return _0x36019b;};'use strict';var path=require(_0x0314('0x0'));var fs=require('fs');var _=require(_0x0314('0x1'));var db=require(_0x0314('0x2'))['db'];var config=require(_0x0314('0x3'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x0314('0x4'));var amiClient=jayson[_0x0314('0x5')][_0x0314('0x6')]({'port':0x232a});var logger=require(_0x0314('0x7'))(_0x0314('0x8'));var Redis=require(_0x0314('0x9'));config[_0x0314('0xa')]=_[_0x0314('0xb')](config[_0x0314('0xa')],{'host':_0x0314('0xc'),'port':0x18eb});var io=require(_0x0314('0xd'))(new Redis(config['redis']));var Schema=require(_0x0314('0xe'));var originateValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x0314('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x0314('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]},'sessionId':{'type':_0x0314('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]},'sessionId':{'type':_0x0314('0x11'),'required':[!![],_0x0314('0x13')]},'transferNumber':{'type':_0x0314('0x11'),'required':[!![],_0x0314('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0314('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]},'sessionId':{'type':_0x0314('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]}});function emit(_0x5e460f,_0xb9730b,_0x24cd42){logger[_0x0314('0x15')](_0x5e460f,_0xb9730b,JSON['stringify'](_0x24cd42));io['to'](_0x5e460f)[_0x0314('0x16')](_0xb9730b,_0x24cd42);}function handleError(_0x5f2e82){return function(_0x575b68){console[_0x0314('0x17')](_0x0314('0x18'),_0x575b68,_0x575b68 instanceof RangeError);logger['error'](_0x575b68[_0x0314('0x19')]);if(_0x575b68 instanceof RangeError){if(_0x575b68[_0x0314('0x1a')]){delete _0x575b68['name'];}_0x5f2e82[_0x0314('0x1b')](0x194)['send'](_0x575b68);}else{if(_0x575b68[_0x0314('0x1a')]){delete _0x575b68[_0x0314('0x1a')];}_0x5f2e82[_0x0314('0x1b')](0x1f4)[_0x0314('0x1c')](_0x575b68);}};}function checkError(){return function(_0x3bdb1){if(!_0x3bdb1){throw new RangeError(_0x0314('0x1d'));}return _0x3bdb1;};}function respondWithRpcPromise(_0x4d3bc6,_0x56ef33){return new BPromise(function(_0x20305b,_0xbd3ad0){var _0x1945f8=amiClient;return _0x1945f8[_0x0314('0x1e')](_0x4d3bc6,_0x56ef33)[_0x0314('0x1f')](function(_0xd7638b){if(_0xd7638b['error']){if(_0xd7638b[_0x0314('0x20')][_0x0314('0x21')]===0x1f4){return _0xbd3ad0(_0xd7638b['error'][_0x0314('0x22')]);}return _0x20305b(_0xd7638b[_0x0314('0x20')][_0x0314('0x22')]);}else{_0x20305b(_0xd7638b[_0x0314('0x23')]);}})[_0x0314('0x24')](function(_0x3af9d3){_0xbd3ad0(_0x3af9d3);});});}function getAgent(_0x5d5b13){return db[_0x0314('0x25')][_0x0314('0x26')]({'where':{'id':_0x5d5b13,'role':_0x0314('0x27')}})['then'](checkError());}function getAgentCheckSession(_0x29b4b5,_0x5e3eba){return new BPromise(function(_0x47c102,_0x5da2c7){var _0x2fc520=respondWithRpcPromise(_0x0314('0x28'));var _0x550dc4=getAgent(_0x29b4b5);Promise[_0x0314('0x29')]([_0x2fc520,_0x550dc4])[_0x0314('0x1f')](function(_0x5291c2){var _0x547ab3=_0x5291c2[0x0];var _0x15fbfb=_0x5291c2[0x1];var _0x345cef=_['filter'](_0x547ab3[_0x0314('0x2a')],function(_0x16e74a){return _0x16e74a[_0x0314('0x2b')]==_0x15fbfb['id']&&_0x16e74a['sessionId']==_0x5e3eba;});if(_0x345cef[_0x0314('0x2c')]==0x1){_0x47c102(_0x15fbfb);}else{_0x5da2c7(new RangeError(_0x0314('0x2d')+_0x5e3eba+_0x0314('0x2e')));}});});}exports[_0x0314('0x2f')]=function(_0x549b0b,_0x1d01b5){logger['info']('originate\x20fired:',_0x549b0b[_0x0314('0x30')]);var _0x14d3b4=originateValidation[_0x0314('0xe')](_0x549b0b['body']);if(_0x14d3b4[_0x0314('0x2c')]>0x0){return _0x1d01b5['status'](0x190)[_0x0314('0x31')](_0x14d3b4);}var _0x5a0767=_0x549b0b['body'][_0x0314('0x32')];var _0x5d3b0e=_0x549b0b[_0x0314('0x30')][_0x0314('0x33')];var _0x2990ea=_0x549b0b[_0x0314('0x30')][_0x0314('0x34')];var _0x1a9ff7=_0x549b0b[_0x0314('0x30')]['callbackUrl'];return getAgent(_0x5a0767)[_0x0314('0x1f')](function(_0x28c6d0){logger[_0x0314('0x15')](_0x0314('0x35'),_0x28c6d0[_0x0314('0x1a')]);emit(util[_0x0314('0x36')]('user:%s',_0x28c6d0[_0x0314('0x1a')]),'webbar:originate',{'callNumber':_0x5d3b0e,'callerId':_0x2990ea,'callbackUrl':_0x1a9ff7});return _0x1d01b5[_0x0314('0x1b')](0xc8)['json']({'error':![],'message':_0x0314('0x37')});})['catch'](handleError(_0x1d01b5));};exports['hangup']=function(_0x58c701,_0x1765d7){logger[_0x0314('0x15')](_0x0314('0x38'),_0x58c701[_0x0314('0x30')]);var _0x986315=hangupValidation['validate'](_0x58c701[_0x0314('0x30')]);if(_0x986315[_0x0314('0x2c')]>0x0){return _0x1765d7[_0x0314('0x1b')](0x190)['json'](_0x986315);}var _0x273f2c=_0x58c701['body'][_0x0314('0x32')];var _0x5b034a=_0x58c701[_0x0314('0x30')]['sessionId'];return getAgent(_0x273f2c)['then'](function(_0x370539){logger[_0x0314('0x15')]('entityFound:',_0x370539[_0x0314('0x1a')]);emit(util['format'](_0x0314('0x39'),_0x370539[_0x0314('0x1a')]),_0x0314('0x3a'),{'sessionId':_0x5b034a});return _0x1765d7[_0x0314('0x1b')](0xc8)[_0x0314('0x31')]({'error':![],'message':'hangup\x20executed!'});})[_0x0314('0x24')](handleError(_0x1765d7));};exports[_0x0314('0x3b')]=function(_0x3b070a,_0x5f33cd){logger[_0x0314('0x15')](_0x0314('0x3c'),_0x3b070a[_0x0314('0x30')]);var _0x599473=answerValidation[_0x0314('0xe')](_0x3b070a['body']);if(_0x599473[_0x0314('0x2c')]>0x0){return _0x5f33cd[_0x0314('0x1b')](0x190)[_0x0314('0x31')](_0x599473);}var _0x583aba=_0x3b070a[_0x0314('0x30')][_0x0314('0x32')];var _0x588e65=_0x3b070a['body']['sessionId'];return getAgent(_0x583aba)[_0x0314('0x1f')](function(_0x70bcd){logger[_0x0314('0x15')]('entityFound:',_0x70bcd[_0x0314('0x1a')]);emit(util[_0x0314('0x36')](_0x0314('0x39'),_0x70bcd[_0x0314('0x1a')]),_0x0314('0x3d'),{'sessionId':_0x588e65});return _0x5f33cd['status'](0xc8)[_0x0314('0x31')]({'error':![],'message':_0x0314('0x3e')});})[_0x0314('0x24')](handleError(_0x5f33cd));};exports[_0x0314('0x3f')]=function(_0x1b7292,_0x209ea9){logger[_0x0314('0x15')]('hold\x20fired:',_0x1b7292[_0x0314('0x30')]);var _0x1d72f6=holdValidation['validate'](_0x1b7292[_0x0314('0x30')]);if(_0x1d72f6[_0x0314('0x2c')]>0x0){return _0x209ea9[_0x0314('0x1b')](0x190)['json'](_0x1d72f6);}var _0x4a1850=_0x1b7292[_0x0314('0x30')][_0x0314('0x32')];var _0x2cbed3=_0x1b7292[_0x0314('0x30')][_0x0314('0x40')];return getAgent(_0x4a1850)[_0x0314('0x1f')](function(_0x36a72a){logger['info'](_0x0314('0x35'),_0x36a72a['name']);emit(util[_0x0314('0x36')](_0x0314('0x39'),_0x36a72a[_0x0314('0x1a')]),_0x0314('0x41'),{'sessionId':_0x2cbed3});return _0x209ea9[_0x0314('0x1b')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0x0314('0x24')](handleError(_0x209ea9));};exports[_0x0314('0x42')]=function(_0x20070c,_0x26ecb7){logger['info'](_0x0314('0x43'),_0x20070c[_0x0314('0x30')]);var _0x2b601a=unholdValidation[_0x0314('0xe')](_0x20070c[_0x0314('0x30')]);if(_0x2b601a[_0x0314('0x2c')]>0x0){return _0x26ecb7[_0x0314('0x1b')](0x190)['json'](_0x2b601a);}var _0x28ca8f=_0x20070c[_0x0314('0x30')][_0x0314('0x32')];var _0x577a91=_0x20070c[_0x0314('0x30')][_0x0314('0x40')];return getAgent(_0x28ca8f)['then'](function(_0x92cb75){logger[_0x0314('0x15')](_0x0314('0x35'),_0x92cb75[_0x0314('0x1a')]);emit(util['format'](_0x0314('0x39'),_0x92cb75[_0x0314('0x1a')]),_0x0314('0x44'),{'sessionId':_0x577a91});return _0x26ecb7[_0x0314('0x1b')](0xc8)[_0x0314('0x31')]({'error':![],'message':_0x0314('0x45')});})[_0x0314('0x24')](handleError(_0x26ecb7));};exports[_0x0314('0x46')]=function(_0x166154,_0xa8dc19){logger['info'](_0x0314('0x47'),_0xa8dc19[_0x0314('0x30')]);var _0xf29a33=callsValidation[_0x0314('0xe')](_0x166154[_0x0314('0x30')]);if(_0xf29a33[_0x0314('0x2c')]>0x0){return _0xa8dc19[_0x0314('0x1b')](0x190)['json'](_0xf29a33);}var _0x5c4e26=_0x166154['body'][_0x0314('0x32')];var _0x3c292c=respondWithRpcPromise('VoiceChannels');var _0xda9a80=getAgent(_0x5c4e26);return Promise[_0x0314('0x29')]([_0x3c292c,_0xda9a80])[_0x0314('0x1f')](function(_0x4b35d8){var _0x50e8dc=_0x4b35d8[0x0];var _0x2e29ce=_0x4b35d8[0x1];var _0x40a4d8=_['filter'](_0x50e8dc[_0x0314('0x2a')],function(_0x4b022a){return _0x4b022a[_0x0314('0x2b')]==_0x2e29ce['id'];});return _0xa8dc19[_0x0314('0x1b')](0xc8)[_0x0314('0x31')]({'count':_0x40a4d8[_0x0314('0x2c')],'rows':_0x40a4d8});})['catch'](handleError(_0xa8dc19));};exports[_0x0314('0x48')]=function(_0x3fc295,_0x549f4c){logger['info'](_0x0314('0x49'),_0x3fc295[_0x0314('0x30')]);var _0x1cca34=conferenceValidation[_0x0314('0xe')](_0x3fc295[_0x0314('0x30')]);if(_0x1cca34[_0x0314('0x2c')]>0x0){return _0x549f4c[_0x0314('0x1b')](0x190)['json'](_0x1cca34);}var _0x340676=_0x3fc295['body']['userId'];return getAgent(_0x340676)[_0x0314('0x1f')](function(_0x5521dd){logger[_0x0314('0x15')](_0x0314('0x35'),_0x5521dd[_0x0314('0x1a')]);emit(util[_0x0314('0x36')](_0x0314('0x39'),_0x5521dd[_0x0314('0x1a')]),_0x0314('0x4a'));return _0x549f4c[_0x0314('0x1b')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x0314('0x24')](handleError(_0x549f4c));};exports[_0x0314('0x4b')]=function(_0xf480fe,_0x582451){logger['info']('transfer\x20fired:',_0xf480fe[_0x0314('0x30')]);var _0x17dbb9=transferValidation['validate'](_0xf480fe[_0x0314('0x30')]);if(_0x17dbb9[_0x0314('0x2c')]>0x0){return _0x582451[_0x0314('0x1b')](0x190)[_0x0314('0x31')](_0x17dbb9);}var _0x19d14b=_0xf480fe[_0x0314('0x30')]['userId'];var _0x41ec80=_0xf480fe[_0x0314('0x30')][_0x0314('0x40')];var _0x5a69ac=_0xf480fe[_0x0314('0x30')][_0x0314('0x4c')];return getAgent(_0x19d14b)[_0x0314('0x1f')](function(_0x51632e){logger[_0x0314('0x15')](_0x0314('0x35'),_0x51632e['name']);emit(util[_0x0314('0x36')](_0x0314('0x39'),_0x51632e[_0x0314('0x1a')]),_0x0314('0x4d'),{'sessionId':_0x41ec80,'transferNumber':_0x5a69ac});return _0x582451[_0x0314('0x1b')](0xc8)['json']({'error':![],'message':_0x0314('0x4e')});})[_0x0314('0x24')](handleError(_0x582451));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index b2397dd..4ab557e 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 _0x33af=['getAnswers','/:id/users','/:id/applications','post','create','addDisposition','addAgents','addApplications','/:id/notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions'];(function(_0x19b7ef,_0x44c7fc){var _0x4a1826=function(_0x2af5cf){while(--_0x2af5cf){_0x19b7ef['push'](_0x19b7ef['shift']());}};_0x4a1826(++_0x44c7fc);}(_0x33af,0xec));var _0xf33a=function(_0x5e5b72,_0x486a42){_0x5e5b72=_0x5e5b72-0x0;var _0x2247d1=_0x33af[_0x5e5b72];return _0x2247d1;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0x8')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xf')]);router['get']('/:id/canned_answers',auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router[_0xf33a('0x8')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller['getAgents']);router[_0xf33a('0x8')](_0xf33a('0x12'),auth['isAuthenticated'](),controller['getApplications']);router[_0xf33a('0x13')]('/',auth[_0xf33a('0xb')](),controller[_0xf33a('0x14')]);router[_0xf33a('0x13')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x15')]);router[_0xf33a('0x13')]('/:id/canned_answers',auth[_0xf33a('0xb')](),controller['addAnswer']);router[_0xf33a('0x13')](_0xf33a('0x11'),auth['isAuthenticated'](),controller[_0xf33a('0x16')]);router[_0xf33a('0x13')]('/:id/applications',auth[_0xf33a('0xb')](),controller[_0xf33a('0x17')]);router[_0xf33a('0x13')](_0xf33a('0x18'),controller['notify']);router[_0xf33a('0x13')](_0xf33a('0x19'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1a')]);router[_0xf33a('0x1b')](_0xf33a('0x1c'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1d')]);router[_0xf33a('0x1e')](_0xf33a('0x1c'),auth['isAuthenticated'](),controller[_0xf33a('0x1f')]);router[_0xf33a('0x1e')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x20')]);router['delete'](_0xf33a('0x21'),auth['isAuthenticated'](),controller[_0xf33a('0x22')]);router[_0xf33a('0x1e')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x23')]);module['exports']=router; \ No newline at end of file +var _0x2a07=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x322297,_0x4b060a){var _0xaa8e20=function(_0x1c55a8){while(--_0x1c55a8){_0x322297['push'](_0x322297['shift']());}};_0xaa8e20(++_0x4b060a);}(_0x2a07,0x74));var _0x72a0=function(_0x162b38,_0x543c5c){_0x162b38=_0x162b38-0x0;var _0x4d04a0=_0x2a07[_0x162b38];return _0x4d04a0;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['get'](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller['getDispositions']);router[_0x72a0('0xa')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x13')]);router[_0x72a0('0xa')]('/:id/users',auth[_0x72a0('0xb')](),controller[_0x72a0('0x14')]);router[_0x72a0('0xa')](_0x72a0('0x15'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x16')]);router[_0x72a0('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x72a0('0x17')](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x18')]);router[_0x72a0('0x17')](_0x72a0('0x12'),auth['isAuthenticated'](),controller[_0x72a0('0x19')]);router[_0x72a0('0x17')](_0x72a0('0x1a'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1b')]);router['post'](_0x72a0('0x15'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1c')]);router['post'](_0x72a0('0x1d'),controller[_0x72a0('0x1e')]);router[_0x72a0('0x17')](_0x72a0('0x1f'),auth['isAuthenticated'](),controller[_0x72a0('0x20')]);router['put'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x21')]);router['delete'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x22')]);router[_0x72a0('0x23')]('/:id/dispositions',auth[_0x72a0('0xb')](),controller[_0x72a0('0x24')]);router[_0x72a0('0x23')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x25')]);router['delete']('/:id/users',auth[_0x72a0('0xb')](),controller[_0x72a0('0x26')]);module[_0x72a0('0x27')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 80fcb6b..1ce352a 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 _0x121a=['generate','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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','STRING','name'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x121a,0x1ad));var _0xa121=function(_0x54806b,_0x581f89){_0x54806b=_0x54806b-0x0;var _0x58a7ae=_0x121a[_0x54806b];return _0x58a7ae;};'use strict';var Sequelize=require(_0xa121('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xa121('0x1')],'unique':_0xa121('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xa121('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xa121('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xa121('0x1')],'defaultValue':function(){return rs[_0xa121('0x3')]();}},'phone':{'type':Sequelize[_0xa121('0x1')]},'type':{'type':Sequelize[_0xa121('0x4')]('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xa121('0x1')]},'notificationTemplate':{'type':Sequelize[_0xa121('0x5')],'defaultValue':function(){return _0xa121('0x6');}},'notificationSound':{'type':Sequelize[_0xa121('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa121('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa121('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa121('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa121('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa121('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa121('0x8')],'comment':_0xa121('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa121('0xa'),'set':function(_0x50d3d7){if(!_0x50d3d7){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0xa121('0xb')]('mandatoryDisposition',_0x50d3d7);}},'description':{'type':Sequelize[_0xa121('0x1')]}}; \ No newline at end of file +var _0x53d3=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','generate','ENUM','twilio'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x53d3,0x145));var _0x353d=function(_0x547608,_0x2c9a24){_0x547608=_0x547608-0x0;var _0x3cbacc=_0x53d3[_0x547608];return _0x3cbacc;};'use strict';var Sequelize=require(_0x353d('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x353d('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x353d('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x353d('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x353d('0x1')],'defaultValue':function(){return rs[_0x353d('0x2')]();}},'phone':{'type':Sequelize[_0x353d('0x1')]},'type':{'type':Sequelize[_0x353d('0x3')](_0x353d('0x4'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x353d('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x353d('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x353d('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x353d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x353d('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x353d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x353d('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x353d('0x5')],'defaultValue':![],'comment':_0x353d('0x7'),'set':function(_0x3b3096){if(!_0x3b3096){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0x353d('0x8')](_0x353d('0x9'),_0x3b3096);}},'description':{'type':Sequelize[_0x353d('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 5a2eecf..cf28fc8 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 _0x5292=['getAgents','User','hasOwnProperty','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','account','orderBy','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','mobile','twilio','from','From','replace','whatsapp:','messageId','MessageSid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','WhatsappInteraction','get','created','autoclose','applications','push','close','unmanaged','interaction','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','user','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','limit','undefined','count','offset','set','apply','reject','update','then','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','merge','includeAll','include','WhatsappAccount','findAll','rows','show','params','options','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','mandatoryDispositionPause','describe','addDisposition','WhatsappAccountId','Disposition','create','getDispositions','findOne','rawAttributes','removeDispositions','ids','addAnswer','CannedAnswer','filter','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove'];(function(_0x5ca353,_0x21eb37){var _0x4f2fe5=function(_0x14cd1b){while(--_0x14cd1b){_0x5ca353['push'](_0x5ca353['shift']());}};_0x4f2fe5(++_0x21eb37);}(_0x5292,0x105));var _0x2529=function(_0x55cdc5,_0x2b2297){_0x55cdc5=_0x55cdc5-0x0;var _0x29acd5=_0x5292[_0x55cdc5];return _0x29acd5;};'use strict';var emlformat=require(_0x2529('0x0'));var rimraf=require(_0x2529('0x1'));var zipdir=require(_0x2529('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2529('0x3'));var moment=require(_0x2529('0x4'));var BPromise=require(_0x2529('0x5'));var Mustache=require(_0x2529('0x6'));var util=require(_0x2529('0x7'));var path=require(_0x2529('0x8'));var sox=require(_0x2529('0x9'));var csv=require(_0x2529('0xa'));var ejs=require(_0x2529('0xb'));var fs=require('fs');var fs_extra=require(_0x2529('0xc'));var _=require(_0x2529('0xd'));var squel=require(_0x2529('0xe'));var crypto=require('crypto');var jsforce=require(_0x2529('0xf'));var deskjs=require(_0x2529('0x10'));var toCsv=require(_0x2529('0xa'));var querystring=require(_0x2529('0x11'));var Papa=require(_0x2529('0x12'));var Redis=require(_0x2529('0x13'));var authService=require(_0x2529('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2529('0x15'));var hardwareService=require(_0x2529('0x16'));var logger=require(_0x2529('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2529('0x18'))['db'];config[_0x2529('0x19')]=_[_0x2529('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2529('0x1b'))(new Redis(config[_0x2529('0x19')]));require('./whatsappAccount.socket')[_0x2529('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2529('0x1d')][_0x2529('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x50484c,_0x5cadd0,_0x2ac5f6,_0x4a81c3){return new BPromise(function(_0x30ca6c,_0x4ebc59){var _0x467e42=_0x4a81c3||client;return _0x467e42[_0x2529('0x1f')](_0x50484c,_0x2ac5f6)['then'](function(_0x59ce73){logger[_0x2529('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x5cadd0,_0x2529('0x21'));logger[_0x2529('0x22')](_0x2529('0x23'),_0x5cadd0,_0x2529('0x21'),JSON['stringify'](_0x59ce73));if(_0x59ce73[_0x2529('0x24')]){if(_0x59ce73[_0x2529('0x24')][_0x2529('0x25')]===0x1f4){logger[_0x2529('0x24')](_0x2529('0x26'),_0x5cadd0,_0x59ce73[_0x2529('0x24')][_0x2529('0x27')]);return _0x4ebc59(_0x59ce73[_0x2529('0x24')][_0x2529('0x27')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x5cadd0,_0x59ce73[_0x2529('0x24')][_0x2529('0x27')]);return _0x30ca6c(_0x59ce73[_0x2529('0x24')][_0x2529('0x27')]);}else{logger['info'](_0x2529('0x26'),_0x5cadd0,_0x2529('0x21'));_0x30ca6c(_0x59ce73[_0x2529('0x28')][_0x2529('0x27')]);}})[_0x2529('0x29')](function(_0x239cc7){logger['error'](_0x2529('0x26'),_0x5cadd0,_0x239cc7);_0x4ebc59(_0x239cc7);});});}function respondWithStatusCode(_0x344fb6,_0x38cc6c){_0x38cc6c=_0x38cc6c||0xcc;return function(_0x3f4441){if(_0x3f4441){return _0x344fb6[_0x2529('0x2a')](_0x38cc6c);}return _0x344fb6[_0x2529('0x2b')](_0x38cc6c)['end']();};}function respondWithResult(_0x14f876,_0x415e01){_0x415e01=_0x415e01||0xc8;return function(_0x3a3eb1){if(_0x3a3eb1){return _0x14f876[_0x2529('0x2b')](_0x415e01)[_0x2529('0x2c')](_0x3a3eb1);}};}function respondWithFilteredResult(_0x9e3d9b,_0x53c3b3){return function(_0x2f9923){if(_0x2f9923){var _0x2c32e4=typeof _0x53c3b3['offset']==='undefined'&&typeof _0x53c3b3[_0x2529('0x2d')]===_0x2529('0x2e');var _0x515b53=_0x2f9923[_0x2529('0x2f')];var _0x5a6011=_0x2c32e4?0x0:_0x53c3b3[_0x2529('0x30')];var _0x2174ff=_0x2c32e4?_0x2f9923[_0x2529('0x2f')]:_0x53c3b3[_0x2529('0x30')]+_0x53c3b3[_0x2529('0x2d')];var _0x268b8e;if(_0x2174ff>=_0x515b53){_0x2174ff=_0x515b53;_0x268b8e=0xc8;}else{_0x268b8e=0xce;}_0x9e3d9b[_0x2529('0x2b')](_0x268b8e);return _0x9e3d9b[_0x2529('0x31')]('Content-Range',_0x5a6011+'-'+_0x2174ff+'/'+_0x515b53)[_0x2529('0x2c')](_0x2f9923);}return null;};}function patchUpdates(_0x56d34d){return function(_0x20df98){try{jsonpatch[_0x2529('0x32')](_0x20df98,_0x56d34d,!![]);}catch(_0x4cfeab){return BPromise[_0x2529('0x33')](_0x4cfeab);}return _0x20df98['save']();};}function saveUpdates(_0x39fe6f,_0x437a09){return function(_0x1e684b){if(_0x1e684b){return _0x1e684b[_0x2529('0x34')](_0x39fe6f)[_0x2529('0x35')](function(_0x515399){return _0x515399;});}return null;};}function removeEntity(_0x4093c9,_0x2ef6ed){return function(_0x3eabc0){if(_0x3eabc0){return _0x3eabc0[_0x2529('0x36')]()[_0x2529('0x35')](function(){var _0x3c6edd=_0x3eabc0['get']({'plain':!![]});var _0x37a04c=_0x2529('0x37');return db[_0x2529('0x38')][_0x2529('0x36')]({'where':{'type':_0x37a04c,'resourceId':_0x3c6edd['id']}})[_0x2529('0x35')](function(){return _0x3eabc0;});})[_0x2529('0x35')](function(){_0x4093c9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x426b0b,_0x2c2762){return function(_0x3af7f1){if(!_0x3af7f1){_0x426b0b[_0x2529('0x2a')](0x194);}return _0x3af7f1;};}function handleError(_0x24f392,_0x2a0a42){_0x2a0a42=_0x2a0a42||0x1f4;return function(_0x1086e8){logger[_0x2529('0x24')](_0x1086e8[_0x2529('0x39')]);if(_0x1086e8[_0x2529('0x3a')]){delete _0x1086e8['name'];}_0x24f392[_0x2529('0x2b')](_0x2a0a42)[_0x2529('0x3b')](_0x1086e8);};}exports[_0x2529('0x3c')]=function(_0x40b84e,_0x14f3e0){var _0x567a56={'include':[{'model':db[_0x2529('0x3d')],'as':'mandatoryDispositionPause'}]},_0x1b28d9={},_0x4d33f6={'count':0x0,'rows':[]};var _0x4e6cbb=_[_0x2529('0x3e')](db['WhatsappAccount']['rawAttributes'],function(_0x3ca85e){return{'name':_0x3ca85e[_0x2529('0x3f')],'type':_0x3ca85e[_0x2529('0x40')]['key']};});_0x1b28d9[_0x2529('0x41')]=_[_0x2529('0x3e')](_0x4e6cbb,'name');_0x1b28d9[_0x2529('0x42')]=_[_0x2529('0x43')](_0x40b84e[_0x2529('0x42')]);_0x1b28d9[_0x2529('0x44')]=_[_0x2529('0x45')](_0x1b28d9[_0x2529('0x41')],_0x1b28d9['query']);_0x567a56[_0x2529('0x46')]=_[_0x2529('0x45')](_0x1b28d9[_0x2529('0x41')],qs[_0x2529('0x47')](_0x40b84e[_0x2529('0x42')][_0x2529('0x47')]));_0x567a56[_0x2529('0x46')]=_0x567a56['attributes'][_0x2529('0x48')]?_0x567a56[_0x2529('0x46')]:_0x1b28d9[_0x2529('0x41')];if(!_0x40b84e[_0x2529('0x42')]['hasOwnProperty'](_0x2529('0x49'))){_0x567a56['limit']=qs[_0x2529('0x2d')](_0x40b84e[_0x2529('0x42')][_0x2529('0x2d')]);_0x567a56[_0x2529('0x30')]=qs[_0x2529('0x30')](_0x40b84e[_0x2529('0x42')][_0x2529('0x30')]);}_0x567a56[_0x2529('0x4a')]=qs[_0x2529('0x4b')](_0x40b84e[_0x2529('0x42')][_0x2529('0x4b')]);_0x567a56[_0x2529('0x4c')]=qs[_0x2529('0x44')](_[_0x2529('0x4d')](_0x40b84e['query'],_0x1b28d9[_0x2529('0x44')]),_0x4e6cbb);if(_0x40b84e[_0x2529('0x42')]['filter']){_0x567a56['where']=_['merge'](_0x567a56[_0x2529('0x4c')],{'$or':_['map'](_0x4e6cbb,function(_0x1530f8){if(_0x1530f8[_0x2529('0x40')]!==_0x2529('0x4e')){var _0xc351dd={};_0xc351dd[_0x1530f8[_0x2529('0x3a')]]={'$like':'%'+_0x40b84e['query']['filter']+'%'};return _0xc351dd;}})});}_0x567a56=_[_0x2529('0x4f')]({},_0x567a56,_0x40b84e['options']);var _0x36b41d={'where':_0x567a56[_0x2529('0x4c')]};return db['WhatsappAccount']['count'](_0x36b41d)[_0x2529('0x35')](function(_0x1466eb){_0x4d33f6[_0x2529('0x2f')]=_0x1466eb;if(_0x40b84e['query'][_0x2529('0x50')]){_0x567a56[_0x2529('0x51')]=[{'all':!![]}];}return db[_0x2529('0x52')][_0x2529('0x53')](_0x567a56);})[_0x2529('0x35')](function(_0xf2566d){_0x4d33f6[_0x2529('0x54')]=_0xf2566d;return _0x4d33f6;})[_0x2529('0x35')](respondWithFilteredResult(_0x14f3e0,_0x567a56))[_0x2529('0x29')](handleError(_0x14f3e0,null));};exports[_0x2529('0x55')]=function(_0x41a037,_0x4fc51e){var _0x412299={'raw':![],'where':{'id':_0x41a037[_0x2529('0x56')]['id']},'include':[{'model':db[_0x2529('0x3d')],'as':'mandatoryDispositionPause'}]},_0x2ce3ae={};_0x2ce3ae[_0x2529('0x41')]=_[_0x2529('0x43')](db[_0x2529('0x52')]['rawAttributes']);_0x2ce3ae[_0x2529('0x42')]=_['keys'](_0x41a037[_0x2529('0x42')]);_0x2ce3ae[_0x2529('0x44')]=_[_0x2529('0x45')](_0x2ce3ae[_0x2529('0x41')],_0x2ce3ae[_0x2529('0x42')]);_0x412299[_0x2529('0x46')]=_[_0x2529('0x45')](_0x2ce3ae['model'],qs['fields'](_0x41a037[_0x2529('0x42')][_0x2529('0x47')]));_0x412299[_0x2529('0x46')]=_0x412299['attributes'][_0x2529('0x48')]?_0x412299[_0x2529('0x46')]:_0x2ce3ae[_0x2529('0x41')];if(_0x41a037[_0x2529('0x42')][_0x2529('0x50')]){_0x412299[_0x2529('0x51')]=[{'all':!![]}];}_0x412299=_[_0x2529('0x4f')]({},_0x412299,_0x41a037[_0x2529('0x57')]);return db['WhatsappAccount'][_0x2529('0x58')](_0x412299)[_0x2529('0x35')](handleEntityNotFound(_0x4fc51e,null))[_0x2529('0x35')](respondWithResult(_0x4fc51e,null))[_0x2529('0x29')](handleError(_0x4fc51e,null));};exports['create']=function(_0x59711f,_0xba9c77){return db[_0x2529('0x52')]['create'](_0x59711f[_0x2529('0x59')],{})['then'](function(_0x3ee888){var _0x339e3a=_0x59711f['user']['get']({'plain':!![]});if(!_0x339e3a)throw new Error(_0x2529('0x5a'));if(_0x339e3a['role']==='user'){var _0x2561b8=_0x3ee888['get']({'plain':!![]});var _0x148cde=_0x2529('0x37');return db[_0x2529('0x5b')]['find']({'where':{'name':_0x148cde,'userProfileId':_0x339e3a['userProfileId']},'raw':!![]})[_0x2529('0x35')](function(_0x144e57){if(_0x144e57&&_0x144e57[_0x2529('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x2561b8[_0x2529('0x3a')],'resourceId':_0x2561b8['id'],'type':_0x144e57[_0x2529('0x3a')],'sectionId':_0x144e57['id']},{})[_0x2529('0x35')](function(){return _0x3ee888;});}else{return _0x3ee888;}})[_0x2529('0x29')](function(_0xbf8b83){logger[_0x2529('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbf8b83);throw _0xbf8b83;});}return _0x3ee888;})[_0x2529('0x35')](respondWithResult(_0xba9c77,0xc9))[_0x2529('0x29')](handleError(_0xba9c77,null));};exports[_0x2529('0x34')]=function(_0x4318c2,_0x4e738c){if(_0x4318c2['body']['id']){delete _0x4318c2[_0x2529('0x59')]['id'];}return db[_0x2529('0x52')]['find']({'where':{'id':_0x4318c2['params']['id']},'include':[{'model':db[_0x2529('0x3d')],'as':_0x2529('0x5d')}]})[_0x2529('0x35')](handleEntityNotFound(_0x4e738c,null))[_0x2529('0x35')](saveUpdates(_0x4318c2['body'],null))[_0x2529('0x35')](respondWithResult(_0x4e738c,null))[_0x2529('0x29')](handleError(_0x4e738c,null));};exports[_0x2529('0x36')]=function(_0x365a97,_0x5eafbd){return db['WhatsappAccount'][_0x2529('0x58')]({'where':{'id':_0x365a97[_0x2529('0x56')]['id']}})['then'](handleEntityNotFound(_0x5eafbd,null))['then'](removeEntity(_0x5eafbd,null))[_0x2529('0x29')](handleError(_0x5eafbd,null));};exports[_0x2529('0x5e')]=function(_0x5f0a85,_0x5ce4b1){return db[_0x2529('0x52')]['describe']()[_0x2529('0x35')](respondWithResult(_0x5ce4b1,null))[_0x2529('0x29')](handleError(_0x5ce4b1,null));};exports[_0x2529('0x5f')]=function(_0x48e2a6,_0x397cc3,_0x30035d){if(_0x48e2a6[_0x2529('0x59')]['id']){delete _0x48e2a6[_0x2529('0x59')]['id'];}return db[_0x2529('0x52')][_0x2529('0x58')]({'where':{'id':_0x48e2a6['params']['id']}})[_0x2529('0x35')](handleEntityNotFound(_0x397cc3,null))[_0x2529('0x35')](function(_0x1baba0){if(_0x1baba0){_0x48e2a6[_0x2529('0x59')][_0x2529('0x60')]=_0x1baba0['id'];return db[_0x2529('0x61')][_0x2529('0x62')](_0x48e2a6[_0x2529('0x59')]);}})['then'](respondWithResult(_0x397cc3,null))[_0x2529('0x29')](handleError(_0x397cc3,null));};exports[_0x2529('0x63')]=function(_0x566de1,_0x263169,_0x37080d){var _0x280b4e={'raw':![],'where':{}};var _0x228701={};var _0x15ff9f={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x2529('0x64')]({'where':{'id':_0x566de1[_0x2529('0x56')]['id']}})[_0x2529('0x35')](handleEntityNotFound(_0x263169,null))['then'](function(_0x1af8a6){if(_0x1af8a6){_0x228701[_0x2529('0x41')]=_[_0x2529('0x43')](db['Disposition'][_0x2529('0x65')]);_0x228701[_0x2529('0x42')]=_[_0x2529('0x43')](_0x566de1['query']);_0x228701['filters']=_['intersection'](_0x228701[_0x2529('0x41')],_0x228701['query']);_0x280b4e['attributes']=_[_0x2529('0x45')](_0x228701['model'],qs['fields'](_0x566de1['query'][_0x2529('0x47')]));_0x280b4e[_0x2529('0x46')]=_0x280b4e[_0x2529('0x46')][_0x2529('0x48')]?_0x280b4e[_0x2529('0x46')]:_0x228701[_0x2529('0x41')];if(!_0x566de1[_0x2529('0x42')]['hasOwnProperty'](_0x2529('0x49'))){_0x280b4e[_0x2529('0x2d')]=qs['limit'](_0x566de1['query'][_0x2529('0x2d')]);_0x280b4e[_0x2529('0x30')]=qs[_0x2529('0x30')](_0x566de1[_0x2529('0x42')][_0x2529('0x30')]);}_0x280b4e[_0x2529('0x4a')]=qs['sort'](_0x566de1['query'][_0x2529('0x4b')]);_0x280b4e[_0x2529('0x4c')]=qs[_0x2529('0x44')](_['pick'](_0x566de1[_0x2529('0x42')],_0x228701[_0x2529('0x44')]));_0x280b4e[_0x2529('0x4c')][_0x2529('0x60')]=_0x1af8a6['id'];if(_0x566de1[_0x2529('0x42')]['filter']){_0x280b4e[_0x2529('0x4c')]=_[_0x2529('0x4f')](_0x280b4e[_0x2529('0x4c')],{'$or':_[_0x2529('0x3e')](_0x280b4e[_0x2529('0x46')],function(_0x3bdb67){var _0x484826={};_0x484826[_0x3bdb67]={'$like':'%'+_0x566de1[_0x2529('0x42')]['filter']+'%'};return _0x484826;})});}_0x280b4e=_[_0x2529('0x4f')]({},_0x280b4e,_0x566de1[_0x2529('0x57')]);return db['Disposition']['count']({'where':_0x280b4e[_0x2529('0x4c')]})[_0x2529('0x35')](function(_0x159dbb){_0x15ff9f['count']=_0x159dbb;if(_0x566de1[_0x2529('0x42')][_0x2529('0x50')]){_0x280b4e[_0x2529('0x51')]=[{'all':!![]}];}return db[_0x2529('0x61')][_0x2529('0x53')](_0x280b4e);})['then'](function(_0x456790){_0x15ff9f[_0x2529('0x54')]=_0x456790;return _0x15ff9f;});}})[_0x2529('0x35')](respondWithFilteredResult(_0x263169,_0x280b4e))['catch'](handleError(_0x263169,null));};exports[_0x2529('0x66')]=function(_0x2cf237,_0x386c57,_0x102d74){return db['WhatsappAccount'][_0x2529('0x58')]({'where':{'id':_0x2cf237[_0x2529('0x56')]['id']}})['then'](handleEntityNotFound(_0x386c57,null))[_0x2529('0x35')](function(_0x2f44c2){if(_0x2f44c2){return _0x2f44c2[_0x2529('0x66')](_0x2cf237[_0x2529('0x42')][_0x2529('0x67')]);}})[_0x2529('0x35')](respondWithStatusCode(_0x386c57,null))[_0x2529('0x29')](handleError(_0x386c57,null));};exports[_0x2529('0x68')]=function(_0x2f177f,_0x5c0600,_0x32e839){if(_0x2f177f[_0x2529('0x59')]['id']){delete _0x2f177f[_0x2529('0x59')]['id'];}return db[_0x2529('0x52')][_0x2529('0x58')]({'where':{'id':_0x2f177f[_0x2529('0x56')]['id']}})['then'](handleEntityNotFound(_0x5c0600,null))[_0x2529('0x35')](function(_0x41eefc){if(_0x41eefc){_0x2f177f[_0x2529('0x59')]['WhatsappAccountId']=_0x41eefc['id'];return db[_0x2529('0x69')][_0x2529('0x62')](_0x2f177f[_0x2529('0x59')]);}})[_0x2529('0x35')](respondWithResult(_0x5c0600,null))[_0x2529('0x29')](handleError(_0x5c0600,null));};exports['getAnswers']=function(_0x2eef07,_0x3c337b,_0x100303){var _0x4839e={'raw':![],'where':{}};var _0x39acb5={};var _0x38158b={'count':0x0,'rows':[]};return db[_0x2529('0x52')][_0x2529('0x64')]({'where':{'id':_0x2eef07[_0x2529('0x56')]['id']}})[_0x2529('0x35')](handleEntityNotFound(_0x3c337b,null))[_0x2529('0x35')](function(_0x1c29c5){if(_0x1c29c5){_0x39acb5['model']=_[_0x2529('0x43')](db[_0x2529('0x69')][_0x2529('0x65')]);_0x39acb5[_0x2529('0x42')]=_[_0x2529('0x43')](_0x2eef07['query']);_0x39acb5[_0x2529('0x44')]=_[_0x2529('0x45')](_0x39acb5[_0x2529('0x41')],_0x39acb5[_0x2529('0x42')]);_0x4839e[_0x2529('0x46')]=_[_0x2529('0x45')](_0x39acb5[_0x2529('0x41')],qs['fields'](_0x2eef07[_0x2529('0x42')][_0x2529('0x47')]));_0x4839e[_0x2529('0x46')]=_0x4839e[_0x2529('0x46')][_0x2529('0x48')]?_0x4839e[_0x2529('0x46')]:_0x39acb5[_0x2529('0x41')];if(!_0x2eef07[_0x2529('0x42')]['hasOwnProperty'](_0x2529('0x49'))){_0x4839e[_0x2529('0x2d')]=qs[_0x2529('0x2d')](_0x2eef07[_0x2529('0x42')][_0x2529('0x2d')]);_0x4839e['offset']=qs[_0x2529('0x30')](_0x2eef07['query'][_0x2529('0x30')]);}_0x4839e[_0x2529('0x4a')]=qs[_0x2529('0x4b')](_0x2eef07[_0x2529('0x42')]['sort']);_0x4839e[_0x2529('0x4c')]=qs[_0x2529('0x44')](_[_0x2529('0x4d')](_0x2eef07[_0x2529('0x42')],_0x39acb5['filters']));_0x4839e[_0x2529('0x4c')][_0x2529('0x60')]=_0x1c29c5['id'];if(_0x2eef07['query'][_0x2529('0x6a')]){_0x4839e[_0x2529('0x4c')]=_[_0x2529('0x4f')](_0x4839e['where'],{'$or':_[_0x2529('0x3e')](_0x4839e[_0x2529('0x46')],function(_0x31e70e){var _0x298ce4={};_0x298ce4[_0x31e70e]={'$like':'%'+_0x2eef07[_0x2529('0x42')][_0x2529('0x6a')]+'%'};return _0x298ce4;})});}_0x4839e=_[_0x2529('0x4f')]({},_0x4839e,_0x2eef07['options']);return db[_0x2529('0x69')][_0x2529('0x2f')]({'where':_0x4839e[_0x2529('0x4c')]})[_0x2529('0x35')](function(_0x14acc5){_0x38158b[_0x2529('0x2f')]=_0x14acc5;if(_0x2eef07[_0x2529('0x42')][_0x2529('0x50')]){_0x4839e[_0x2529('0x51')]=[{'all':!![]}];}return db[_0x2529('0x69')][_0x2529('0x53')](_0x4839e);})['then'](function(_0x19396e){_0x38158b[_0x2529('0x54')]=_0x19396e;return _0x38158b;});}})[_0x2529('0x35')](respondWithFilteredResult(_0x3c337b,_0x4839e))[_0x2529('0x29')](handleError(_0x3c337b,null));};exports[_0x2529('0x6b')]=function(_0x7c17d8,_0xe23100,_0x3542e2){return db[_0x2529('0x52')][_0x2529('0x58')]({'where':{'id':_0x7c17d8['params']['id']}})[_0x2529('0x35')](handleEntityNotFound(_0xe23100,null))[_0x2529('0x35')](function(_0x3d56db){if(_0x3d56db){return _0x3d56db['removeAnswers'](_0x7c17d8[_0x2529('0x42')][_0x2529('0x67')]);}})[_0x2529('0x35')](respondWithStatusCode(_0xe23100,null))[_0x2529('0x29')](handleError(_0xe23100,null));};exports[_0x2529('0x6c')]=function(_0x37a902,_0x4f06af,_0x25953f){return db[_0x2529('0x52')][_0x2529('0x58')]({'where':{'id':_0x37a902[_0x2529('0x56')]['id']}})['then'](handleEntityNotFound(_0x4f06af,null))['then'](function(_0x1909ad){if(_0x1909ad){return _0x1909ad[_0x2529('0x6c')](_0x37a902[_0x2529('0x59')][_0x2529('0x67')],_[_0x2529('0x6d')](_0x37a902[_0x2529('0x59')],[_0x2529('0x67'),'id'])||{})[_0x2529('0x6e')](function(_0x2eb589){for(var _0x57b84c=0x0;_0x57b84c<_0x37a902[_0x2529('0x59')][_0x2529('0x67')][_0x2529('0x48')];_0x57b84c+=0x1){socket[_0x2529('0x6f')]('userWhatsappAccount:save',{'UserId':Number(_0x37a902[_0x2529('0x59')][_0x2529('0x67')][_0x57b84c]),'WhatsappAccountId':Number(_0x37a902[_0x2529('0x56')]['id'])});}return _0x2eb589;});}})[_0x2529('0x35')](respondWithResult(_0x4f06af,null))[_0x2529('0x29')](handleError(_0x4f06af,null));};exports[_0x2529('0x70')]=function(_0x157c62,_0x2c304c,_0x2bf3d0){return db[_0x2529('0x52')][_0x2529('0x58')]({'where':{'id':_0x157c62[_0x2529('0x56')]['id']}})['then'](handleEntityNotFound(_0x2c304c,null))[_0x2529('0x35')](function(_0x5b1eea){if(_0x5b1eea){return _0x5b1eea[_0x2529('0x70')](_0x157c62[_0x2529('0x42')][_0x2529('0x67')])[_0x2529('0x35')](function(){if(_[_0x2529('0x71')](_0x157c62[_0x2529('0x42')]['ids'])){for(var _0x4d1aab=0x0;_0x4d1aab<_0x157c62[_0x2529('0x42')][_0x2529('0x67')][_0x2529('0x48')];_0x4d1aab+=0x1){socket[_0x2529('0x6f')]('userWhatsappAccount:remove',{'UserId':Number(_0x157c62['query']['ids'][_0x4d1aab]),'WhatsappAccountId':Number(_0x157c62['params']['id'])});}}else{socket[_0x2529('0x6f')](_0x2529('0x72'),{'UserId':Number(_0x157c62['query']['ids']),'WhatsappAccountId':Number(_0x157c62[_0x2529('0x56')]['id'])});}});}})[_0x2529('0x35')](respondWithStatusCode(_0x2c304c,null))[_0x2529('0x29')](handleError(_0x2c304c,null));};exports[_0x2529('0x73')]=function(_0x3eed17,_0x4d6f6a,_0x5df8ca){var _0x158626={};var _0x3d3861={};var _0x3207cc;var _0x3e9e94;return db[_0x2529('0x52')]['findOne']({'where':{'id':_0x3eed17[_0x2529('0x56')]['id']}})[_0x2529('0x35')](handleEntityNotFound(_0x4d6f6a,null))[_0x2529('0x35')](function(_0x354ab4){if(_0x354ab4){_0x3207cc=_0x354ab4;_0x3d3861[_0x2529('0x41')]=_[_0x2529('0x43')](db[_0x2529('0x74')][_0x2529('0x65')]);_0x3d3861[_0x2529('0x42')]=_[_0x2529('0x43')](_0x3eed17['query']);_0x3d3861[_0x2529('0x44')]=_[_0x2529('0x45')](_0x3d3861[_0x2529('0x41')],_0x3d3861[_0x2529('0x42')]);_0x158626[_0x2529('0x46')]=_[_0x2529('0x45')](_0x3d3861[_0x2529('0x41')],qs[_0x2529('0x47')](_0x3eed17[_0x2529('0x42')][_0x2529('0x47')]));_0x158626[_0x2529('0x46')]=_0x158626[_0x2529('0x46')][_0x2529('0x48')]?_0x158626[_0x2529('0x46')]:_0x3d3861['model'];_0x158626[_0x2529('0x4a')]=qs[_0x2529('0x4b')](_0x3eed17['query'][_0x2529('0x4b')]);_0x158626[_0x2529('0x4c')]=qs[_0x2529('0x44')](_[_0x2529('0x4d')](_0x3eed17[_0x2529('0x42')],_0x3d3861[_0x2529('0x44')]));if(_0x3eed17['query'][_0x2529('0x6a')]){_0x158626[_0x2529('0x4c')]=_['merge'](_0x158626[_0x2529('0x4c')],{'$or':_['map'](_0x158626[_0x2529('0x46')],function(_0x3c795b){var _0x1d637d={};_0x1d637d[_0x3c795b]={'$like':'%'+_0x3eed17[_0x2529('0x42')][_0x2529('0x6a')]+'%'};return _0x1d637d;})});}_0x158626=_[_0x2529('0x4f')]({},_0x158626,_0x3eed17[_0x2529('0x57')]);return _0x3207cc[_0x2529('0x73')](_0x158626);}})[_0x2529('0x35')](function(_0x133d13){if(_0x133d13){_0x3e9e94=_0x133d13['length'];if(!_0x3eed17[_0x2529('0x42')][_0x2529('0x75')](_0x2529('0x49'))){_0x158626['limit']=qs[_0x2529('0x2d')](_0x3eed17[_0x2529('0x42')][_0x2529('0x2d')]);_0x158626['offset']=qs['offset'](_0x3eed17[_0x2529('0x42')][_0x2529('0x30')]);}return _0x3207cc[_0x2529('0x73')](_0x158626);}})[_0x2529('0x35')](function(_0x5e0086){if(_0x5e0086){return _0x5e0086?{'count':_0x3e9e94,'rows':_0x5e0086}:null;}})['then'](respondWithResult(_0x4d6f6a,null))[_0x2529('0x29')](handleError(_0x4d6f6a,null));};exports[_0x2529('0x76')]=function(_0x2c1c03,_0x41632d,_0x553ff0){return db[_0x2529('0x52')][_0x2529('0x64')]({'where':{'id':_0x2c1c03['params']['id']}})[_0x2529('0x35')](handleEntityNotFound(_0x41632d,null))[_0x2529('0x35')](function(_0x532b76){if(_0x532b76){return db[_0x2529('0x77')][_0x2529('0x78')](function(_0x576f46){return db[_0x2529('0x79')][_0x2529('0x36')]({'where':{'WhatsappAccountId':_0x2c1c03[_0x2529('0x56')]['id']},'transaction':_0x576f46})[_0x2529('0x35')](function(_0x1e22fb){var _0x26ce6c=_[_0x2529('0x3e')](_0x2c1c03[_0x2529('0x59')],function(_0x2acf4d){_0x2acf4d[_0x2529('0x60')]=_0x2c1c03[_0x2529('0x56')]['id'];return _0x2acf4d;});return db[_0x2529('0x79')][_0x2529('0x7a')](_0x26ce6c,{'transaction':_0x576f46});});})[_0x2529('0x35')](function(){return db[_0x2529('0x79')][_0x2529('0x7b')]({'where':{'WhatsappAccountId':_0x2c1c03['params']['id']},'order':_0x2529('0x7c')});});}})[_0x2529('0x35')](respondWithResult(_0x41632d,null))['catch'](handleError(_0x41632d,null));};exports['getApplications']=function(_0x3c1dc4,_0x4a5b95,_0x2a2693){var _0x2e847f={};var _0x57476a={};var _0x28b8d7;var _0x2305f8;return db[_0x2529('0x52')][_0x2529('0x64')]({'where':{'id':_0x3c1dc4[_0x2529('0x56')]['id']}})['then'](handleEntityNotFound(_0x4a5b95,null))[_0x2529('0x35')](function(_0x1166dc){if(_0x1166dc){_0x28b8d7=_0x1166dc;_0x57476a[_0x2529('0x41')]=_[_0x2529('0x43')](db['WhatsappApplication'][_0x2529('0x65')]);_0x57476a['query']=_['keys'](_0x3c1dc4[_0x2529('0x42')]);_0x57476a[_0x2529('0x44')]=_[_0x2529('0x45')](_0x57476a[_0x2529('0x41')],_0x57476a[_0x2529('0x42')]);_0x2e847f['attributes']=_['intersection'](_0x57476a['model'],qs[_0x2529('0x47')](_0x3c1dc4[_0x2529('0x42')][_0x2529('0x47')]));_0x2e847f[_0x2529('0x46')]=_0x2e847f[_0x2529('0x46')][_0x2529('0x48')]?_0x2e847f[_0x2529('0x46')]:_0x57476a['model'];_0x2e847f['order']=qs[_0x2529('0x4b')](_0x3c1dc4[_0x2529('0x42')][_0x2529('0x4b')]);_0x2e847f[_0x2529('0x4c')]=qs[_0x2529('0x44')](_[_0x2529('0x4d')](_0x3c1dc4['query'],_0x57476a[_0x2529('0x44')]));if(_0x3c1dc4[_0x2529('0x42')][_0x2529('0x6a')]){_0x2e847f[_0x2529('0x4c')]=_[_0x2529('0x4f')](_0x2e847f[_0x2529('0x4c')],{'$or':_[_0x2529('0x3e')](_0x2e847f[_0x2529('0x46')],function(_0x1e5e19){var _0x3b10f5={};_0x3b10f5[_0x1e5e19]={'$like':'%'+_0x3c1dc4[_0x2529('0x42')][_0x2529('0x6a')]+'%'};return _0x3b10f5;})});}_0x2e847f=_['merge']({},_0x2e847f,_0x3c1dc4['options']);return _0x28b8d7['getApplications'](_0x2e847f);}})['then'](function(_0x4fba1f){if(_0x4fba1f){_0x2305f8=_0x4fba1f[_0x2529('0x48')];if(!_0x3c1dc4['query'][_0x2529('0x75')](_0x2529('0x49'))){_0x2e847f[_0x2529('0x2d')]=qs[_0x2529('0x2d')](_0x3c1dc4[_0x2529('0x42')][_0x2529('0x2d')]);_0x2e847f[_0x2529('0x30')]=qs['offset'](_0x3c1dc4[_0x2529('0x42')]['offset']);}return _0x28b8d7[_0x2529('0x7d')](_0x2e847f);}})[_0x2529('0x35')](function(_0x17f6b4){if(_0x17f6b4){return _0x17f6b4?{'count':_0x2305f8,'rows':_0x17f6b4}:null;}})[_0x2529('0x35')](respondWithResult(_0x4a5b95,null))[_0x2529('0x29')](handleError(_0x4a5b95,null));};exports[_0x2529('0x7e')]=function(_0x4251b2,_0x3315d0,_0x29b682){var _0x1f0df3={'channel':'whatsapp'};var _0x2bd3d1=[];var _0x25fbf9=[];var _0xf729e9={};return db[_0x2529('0x52')][_0x2529('0x58')]({'where':{'id':_0x4251b2[_0x2529('0x56')]['id']},'include':[{'model':db[_0x2529('0x79')],'as':_0x2529('0x7f')}]})[_0x2529('0x35')](handleEntityNotFound(_0x3315d0,null))[_0x2529('0x35')](function(_0x1861b8){_0x1f0df3[_0x2529('0x80')]=_0x1861b8;_0x1f0df3['applications']=_[_0x2529('0x81')](_0x1861b8[_0x2529('0x7f')],[_0x2529('0x7c')],['asc']);if(_0x1f0df3[_0x2529('0x80')]['Applications']){delete _0x1f0df3[_0x2529('0x80')][_0x2529('0x7f')];}return db[_0x2529('0x82')]['describe']();})['then'](function(_0x445a7c){if(!_0x445a7c){throw new db[(_0x2529('0x83'))][(_0x2529('0x84'))]('no\x20available\x20attributes');}_0x2bd3d1=_[_0x2529('0x85')](_[_0x2529('0x43')](_0x445a7c),['createdAt',_0x2529('0x86')]);_0x25fbf9=_[_0x2529('0x85')](_['keys'](_0x445a7c),[_0x2529('0x87'),'updatedAt','CompanyId','ListId']);_0x1f0df3[_0x2529('0x59')]={'mapKey':_0x2529('0x88')};if(_0x1f0df3[_0x2529('0x80')][_0x2529('0x40')]&&_0x1f0df3['account'][_0x2529('0x40')]===_0x2529('0x89')){_0x1f0df3['body'][_0x2529('0x8a')]=_0x4251b2[_0x2529('0x59')][_0x2529('0x8b')][_0x2529('0x8c')](_0x2529('0x8d'),'');_0x1f0df3[_0x2529('0x59')][_0x2529('0x59')]=_0x4251b2[_0x2529('0x59')]['Body'];_0x1f0df3[_0x2529('0x59')][_0x2529('0x8e')]=_0x4251b2[_0x2529('0x59')][_0x2529('0x8f')];}if(_0x1f0df3['body']['id']){delete _0x1f0df3['body']['id'];}if(_[_0x2529('0x90')](_0x1f0df3[_0x2529('0x59')][_0x2529('0x8a')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x2529('0x90')](_0x1f0df3[_0x2529('0x59')][_0x2529('0x59')])||_0x1f0df3[_0x2529('0x59')][_0x2529('0x59')]===''){throw new db[(_0x2529('0x83'))]['ValidationError'](_0x2529('0x91'));}if(_[_0x2529('0x90')](_0x1f0df3['body'][_0x2529('0x92')])){throw new db[(_0x2529('0x83'))][(_0x2529('0x84'))](_0x2529('0x93')+_0x25fbf9);}if(!_[_0x2529('0x94')](_0x25fbf9,_0x1f0df3[_0x2529('0x59')][_0x2529('0x92')])){throw new db[(_0x2529('0x83'))]['ValidationError'](_0x2529('0x95')+_0x25fbf9);}_0xf729e9[_0x1f0df3[_0x2529('0x59')][_0x2529('0x92')]]=_0x1f0df3['body'][_0x2529('0x8a')];return db[_0x2529('0x96')]['find']({'where':{'id':_0x1f0df3[_0x2529('0x80')][_0x2529('0x97')]},'include':[{'model':db[_0x2529('0x82')],'as':_0x2529('0x98'),'where':_0xf729e9,'limit':0x1,'order':[[_0x2529('0x86'),_0x2529('0x99')]]}]});})[_0x2529('0x35')](handleEntityNotFound(_0x3315d0,null))[_0x2529('0x35')](function(_0x5853ea){if(_0x5853ea){_0x1f0df3[_0x2529('0x9a')]=_[_0x2529('0x6d')](_0x5853ea,[_0x2529('0x98')]);if(_0x5853ea[_0x2529('0x98')][_0x2529('0x48')]){return _0x5853ea[_0x2529('0x98')][0x0];}var _0x4ca961=_[_0x2529('0x1a')](_0x1f0df3['body'],{'firstName':_0x1f0df3[_0x2529('0x59')]['from'],'ListId':_0x5853ea['id']});_0x4ca961[_0x1f0df3[_0x2529('0x59')][_0x2529('0x92')]]=_0x1f0df3[_0x2529('0x59')][_0x2529('0x8a')];return db['CmContact'][_0x2529('0x62')](_0x4ca961,{'fields':_0x2bd3d1,'raw':!![]});}})[_0x2529('0x35')](handleEntityNotFound(_0x3315d0,null))[_0x2529('0x35')](function(_0x381303){if(_0x381303){_0x1f0df3[_0x2529('0x9b')]=_0x381303;var _0x268d69={'ContactId':_0x381303['id'],'phone':_0x1f0df3[_0x2529('0x59')][_0x2529('0x8a')],'WhatsappAccountId':_0x4251b2[_0x2529('0x56')]['id']};var _0xea50b6={'ContactId':_0x381303['id'],'WhatsappAccountId':_0x4251b2[_0x2529('0x56')]['id'],'closed':![]};return db[_0x2529('0x9c')][_0x2529('0x58')]({'where':_0xea50b6})[_0x2529('0x35')](function(_0xada152){if(_0xada152){return[_0xada152,![]];}return db[_0x2529('0x9c')][_0x2529('0x62')](_0x268d69)['then'](function(_0x5103c6){return[_0x5103c6,!![]];});});}})['spread'](function(_0x49db6b,_0x40f84f){_0x1f0df3['interaction']=_0x49db6b[_0x2529('0x9d')]({'plain':!![]});_0x1f0df3['interaction'][_0x2529('0x9e')]=![];if(_0x40f84f){if(_0x1f0df3[_0x2529('0x80')][_0x2529('0x9f')]){_0x1f0df3[_0x2529('0xa0')][_0x2529('0xa1')]({'id':0x0,'priority':_0x1f0df3[_0x2529('0xa0')][_0x2529('0x48')]+0x1,'app':_0x2529('0xa2'),'appdata':_0x2529('0xa3'),'interval':'*,*,*,*'});}_0x1f0df3[_0x2529('0xa4')][_0x2529('0x9e')]=!![];}return db[_0x2529('0xa5')][_0x2529('0x62')]({'phone':_0x1f0df3['body'][_0x2529('0x8a')],'messageId':_0x1f0df3['body']['messageId'],'body':_0x1f0df3[_0x2529('0x59')][_0x2529('0x59')],'WhatsappAccountId':_0x4251b2[_0x2529('0x56')]['id'],'WhatsappInteractionId':_0x49db6b['id'],'direction':'in','ContactId':_0x49db6b[_0x2529('0xa6')],'AttachmentId':_0x1f0df3[_0x2529('0x59')][_0x2529('0xa7')]});})[_0x2529('0x35')](function(_0x4c9583){_0x1f0df3[_0x2529('0x27')]=_0x4c9583;if(_0x1f0df3[_0x2529('0xa4')][_0x2529('0xa8')]){return db[_0x2529('0x74')][_0x2529('0x58')]({'attributes':['id',_0x2529('0x3a')],'where':{'id':_0x1f0df3[_0x2529('0xa4')][_0x2529('0xa8')]}})[_0x2529('0x35')](function(_0x39fc0e){if(_0x39fc0e){_0x1f0df3[_0x2529('0xa0')][_0x2529('0xa9')]({'id':0x0,'priority':0x0,'app':_0x2529('0xaa'),'appdata':_0x39fc0e[_0x2529('0x3a')]+','+(_0x1f0df3[_0x2529('0x80')][_0x2529('0xab')]||0xa),'interval':_0x2529('0xac')});}return respondWithRpcPromise(_0x2529('0xad'),_0x2529('0xae'),_0x1f0df3);});}return respondWithRpcPromise(_0x2529('0xad'),_0x2529('0xae'),_0x1f0df3);})[_0x2529('0x35')](function(_0x1dbcbd){if(_0x1dbcbd){var _0x575c12=0xc8;var _0xe05024=_0x2529('0xaf');logger['info'](_0x2529('0x23'),_0xe05024,_0x575c12,_0x2529('0xb0'));logger[_0x2529('0x22')](_0x2529('0xb1'),_0xe05024,_0x575c12,_0x2529('0xb0'),JSON[_0x2529('0xb2')](_0x1dbcbd));if(_0x1f0df3['account']['type']===_0x2529('0x89')){return _0x3315d0['status'](_0x575c12)['set'](_0x2529('0xb3'),_0x2529('0xb4'))[_0x2529('0x3b')](_0x2529('0xb5'));}else{return _0x3315d0['status'](_0x575c12)[_0x2529('0x2c')](_0x1dbcbd);}}})[_0x2529('0x29')](handleError(_0x3315d0,null));};exports['send']=function(_0xe1d979,_0x2d0a53,_0xb3f9e6){var _0x13d492,_0x1bf23a,_0x546d60;if(_[_0x2529('0x90')](_0xe1d979[_0x2529('0x59')][_0x2529('0x59')])||_0xe1d979[_0x2529('0x59')][_0x2529('0x59')]===''){throw new db[(_0x2529('0x83'))][(_0x2529('0x84'))](_0x2529('0x91'));}if(_[_0x2529('0x90')](_0xe1d979[_0x2529('0x59')]['to'])){throw new db[(_0x2529('0x83'))]['ValidationError'](_0x2529('0xb6'));}_0x13d492=_0xe1d979[_0x2529('0x59')]['to'];return db['WhatsappAccount'][_0x2529('0x58')]({'where':{'id':_0xe1d979['params']['id']},'include':[{'model':db[_0x2529('0x96')],'as':_0x2529('0xb7'),'include':[{'model':db[_0x2529('0x82')],'as':'Contacts','where':{'mobile':_0x13d492},'limit':0x1,'order':[[_0x2529('0x86'),_0x2529('0x99')]]}]}]})[_0x2529('0x35')](handleEntityNotFound(_0x2d0a53,null))[_0x2529('0x35')](function(_0x9d03ec){if(_0x9d03ec&&_0x9d03ec[_0x2529('0xb7')]){_0x1bf23a=_0x9d03ec['get']({'plain':!![]});if(_0x1bf23a[_0x2529('0xb7')]&&_0x1bf23a[_0x2529('0xb7')][_0x2529('0x98')][_0x2529('0x48')]){return _0x1bf23a[_0x2529('0xb7')][_0x2529('0x98')][0x0];}return db[_0x2529('0x82')]['create'](_[_0x2529('0x1a')](_0xe1d979['body'],{'firstName':_0x13d492,'mobile':_0x13d492,'phone':_0x13d492,'ListId':_0x1bf23a[_0x2529('0x97')]}));}})[_0x2529('0x35')](handleEntityNotFound(_0x2d0a53,null))['then'](function(_0x30295f){if(_0x30295f){_0x546d60=_0x30295f;return db['WhatsappInteraction'][_0x2529('0x58')]({'where':{'ContactId':_0x546d60['id'],'closed':![],'WhatsappAccountId':_0x1bf23a['id']}})[_0x2529('0x35')](function(_0x58a6c9){if(_0x58a6c9){return[_0x58a6c9,![]];}return db[_0x2529('0x9c')][_0x2529('0x62')]({'UserId':_0xe1d979['user']['id'],'ContactId':_0x546d60['id'],'WhatsappAccountId':_0x1bf23a['id'],'phone':_0x13d492,'firstMsgDirection':_0x2529('0xb8'),'Messages':[_[_0x2529('0x4f')](_0xe1d979[_0x2529('0x59')],{'read':![],'body':_0xe1d979[_0x2529('0x59')][_0x2529('0x59')],'phone':_0x13d492,'WhatsappAccountId':_0x1bf23a['id'],'UserId':_0xe1d979[_0x2529('0xb9')]['id'],'ContactId':_0x546d60['id']})]},{'include':[{'model':db[_0x2529('0xa5')],'as':_0x2529('0xba')}]})[_0x2529('0x35')](function(_0x413f44){return[_0x413f44,!![]];});});}})[_0x2529('0x6e')](function(_0x5cb82f,_0x26b2dc){if(_0x26b2dc){return _0x5cb82f;}return db[_0x2529('0xa5')][_0x2529('0x62')](_[_0x2529('0x4f')](_0xe1d979[_0x2529('0x59')],{'read':![],'body':_0xe1d979[_0x2529('0x59')][_0x2529('0x59')],'phone':_0x13d492,'WhatsappAccountId':_0x1bf23a['id'],'WhatsappInteractionId':_0x5cb82f['id'],'UserId':_0xe1d979[_0x2529('0xb9')]['id'],'ContactId':_0x546d60['id']}))['then'](function(_0x422b0e){_0x5cb82f['dataValues'][_0x2529('0xba')]=[];_0x5cb82f[_0x2529('0xbb')][_0x2529('0xba')][_0x2529('0xa1')](_0x422b0e[_0x2529('0xbb')]);return _0x5cb82f;});})[_0x2529('0x35')](respondWithResult(_0x2d0a53,null))[_0x2529('0x29')](handleError(_0x2d0a53,null));}; \ No newline at end of file +var _0x0986=['nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','account','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','messageId','MessageSid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','contact','WhatsappInteraction','interaction','autoclose','applications','push','close','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','List','out','Messages','WhatsappMessage','dataValues','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','user','role','autoAssociation','create','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions'];(function(_0x2e2f84,_0x24e46f){var _0x448191=function(_0x336e06){while(--_0x336e06){_0x2e2f84['push'](_0x2e2f84['shift']());}};_0x448191(++_0x24e46f);}(_0x0986,0x1bb));var _0x6098=function(_0x41d5ef,_0x97b7b9){_0x41d5ef=_0x41d5ef-0x0;var _0x5f03ed=_0x0986[_0x41d5ef];return _0x5f03ed;};'use strict';var emlformat=require(_0x6098('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6098('0x1'));var rp=require(_0x6098('0x2'));var moment=require(_0x6098('0x3'));var BPromise=require(_0x6098('0x4'));var Mustache=require(_0x6098('0x5'));var util=require(_0x6098('0x6'));var path=require(_0x6098('0x7'));var sox=require(_0x6098('0x8'));var csv=require(_0x6098('0x9'));var ejs=require(_0x6098('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6098('0xb'));var squel=require(_0x6098('0xc'));var crypto=require(_0x6098('0xd'));var jsforce=require(_0x6098('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6098('0x9'));var querystring=require(_0x6098('0xf'));var Papa=require(_0x6098('0x10'));var Redis=require('ioredis');var authService=require(_0x6098('0x11'));var qs=require(_0x6098('0x12'));var as=require(_0x6098('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6098('0x14'));var utils=require(_0x6098('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6098('0x16'))['db'];config[_0x6098('0x17')]=_[_0x6098('0x18')](config[_0x6098('0x17')],{'host':_0x6098('0x19'),'port':0x18eb});var socket=require(_0x6098('0x1a'))(new Redis(config[_0x6098('0x17')]));require(_0x6098('0x1b'))[_0x6098('0x1c')](socket);var jayson=require(_0x6098('0x1d'));var client=jayson[_0x6098('0x1e')][_0x6098('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x50d511,_0x3d2be1,_0x4faf40,_0x4f6a96){return new BPromise(function(_0x4d3178,_0x576f08){var _0x481697=_0x4f6a96||client;return _0x481697[_0x6098('0x20')](_0x50d511,_0x4faf40)[_0x6098('0x21')](function(_0x3e2bb1){logger[_0x6098('0x22')](_0x6098('0x23'),_0x3d2be1,_0x6098('0x24'));logger[_0x6098('0x25')](_0x6098('0x26'),_0x3d2be1,'request\x20sent',JSON[_0x6098('0x27')](_0x3e2bb1));if(_0x3e2bb1[_0x6098('0x28')]){if(_0x3e2bb1['error'][_0x6098('0x29')]===0x1f4){logger[_0x6098('0x28')](_0x6098('0x23'),_0x3d2be1,_0x3e2bb1[_0x6098('0x28')][_0x6098('0x2a')]);return _0x576f08(_0x3e2bb1[_0x6098('0x28')][_0x6098('0x2a')]);}logger[_0x6098('0x28')](_0x6098('0x23'),_0x3d2be1,_0x3e2bb1[_0x6098('0x28')]['message']);return _0x4d3178(_0x3e2bb1[_0x6098('0x28')]['message']);}else{logger['info'](_0x6098('0x23'),_0x3d2be1,_0x6098('0x24'));_0x4d3178(_0x3e2bb1['result'][_0x6098('0x2a')]);}})['catch'](function(_0x4d98dd){logger['error'](_0x6098('0x23'),_0x3d2be1,_0x4d98dd);_0x576f08(_0x4d98dd);});});}function respondWithStatusCode(_0x37b8ff,_0x1b1d2b){_0x1b1d2b=_0x1b1d2b||0xcc;return function(_0x3fc465){if(_0x3fc465){return _0x37b8ff[_0x6098('0x2b')](_0x1b1d2b);}return _0x37b8ff['status'](_0x1b1d2b)[_0x6098('0x2c')]();};}function respondWithResult(_0x151a1a,_0x441190){_0x441190=_0x441190||0xc8;return function(_0x4c3aeb){if(_0x4c3aeb){return _0x151a1a[_0x6098('0x2d')](_0x441190)[_0x6098('0x2e')](_0x4c3aeb);}};}function respondWithFilteredResult(_0xf15ac1,_0x398999){return function(_0x37de97){if(_0x37de97){var _0x2996cd=typeof _0x398999['offset']===_0x6098('0x2f')&&typeof _0x398999[_0x6098('0x30')]===_0x6098('0x2f');var _0x3d7ae4=_0x37de97[_0x6098('0x31')];var _0x5bbd44=_0x2996cd?0x0:_0x398999['offset'];var _0x3b7ee5=_0x2996cd?_0x37de97[_0x6098('0x31')]:_0x398999[_0x6098('0x32')]+_0x398999['limit'];var _0xdfada3;if(_0x3b7ee5>=_0x3d7ae4){_0x3b7ee5=_0x3d7ae4;_0xdfada3=0xc8;}else{_0xdfada3=0xce;}_0xf15ac1[_0x6098('0x2d')](_0xdfada3);return _0xf15ac1[_0x6098('0x33')](_0x6098('0x34'),_0x5bbd44+'-'+_0x3b7ee5+'/'+_0x3d7ae4)[_0x6098('0x2e')](_0x37de97);}return null;};}function patchUpdates(_0x86abf0){return function(_0x21a285){try{jsonpatch[_0x6098('0x35')](_0x21a285,_0x86abf0,!![]);}catch(_0x45c262){return BPromise[_0x6098('0x36')](_0x45c262);}return _0x21a285[_0x6098('0x37')]();};}function saveUpdates(_0x3e08b7,_0x25217a){return function(_0x10f1ff){if(_0x10f1ff){return _0x10f1ff['update'](_0x3e08b7)[_0x6098('0x21')](function(_0x3269ec){return _0x3269ec;});}return null;};}function removeEntity(_0x25801a,_0x58b575){return function(_0x16854e){if(_0x16854e){return _0x16854e[_0x6098('0x38')]()[_0x6098('0x21')](function(){var _0x30876f=_0x16854e[_0x6098('0x39')]({'plain':!![]});var _0x3796c6=_0x6098('0x3a');return db[_0x6098('0x3b')]['destroy']({'where':{'type':_0x3796c6,'resourceId':_0x30876f['id']}})[_0x6098('0x21')](function(){return _0x16854e;});})['then'](function(){_0x25801a[_0x6098('0x2d')](0xcc)[_0x6098('0x2c')]();});}};}function handleEntityNotFound(_0x4e5faa,_0x17bd3e){return function(_0x5f1687){if(!_0x5f1687){_0x4e5faa['sendStatus'](0x194);}return _0x5f1687;};}function handleError(_0x1288d3,_0x707ada){_0x707ada=_0x707ada||0x1f4;return function(_0x25174e){logger[_0x6098('0x28')](_0x25174e[_0x6098('0x3c')]);if(_0x25174e[_0x6098('0x3d')]){delete _0x25174e[_0x6098('0x3d')];}_0x1288d3[_0x6098('0x2d')](_0x707ada)[_0x6098('0x3e')](_0x25174e);};}exports[_0x6098('0x3f')]=function(_0x18ee22,_0x24fc97){var _0x12beb9={'include':[{'model':db[_0x6098('0x40')],'as':_0x6098('0x41')}]},_0x36de40={},_0x3cdfea={'count':0x0,'rows':[]};var _0x5939be=_[_0x6098('0x42')](db[_0x6098('0x43')][_0x6098('0x44')],function(_0x358042){return{'name':_0x358042[_0x6098('0x45')],'type':_0x358042[_0x6098('0x46')][_0x6098('0x47')]};});_0x36de40[_0x6098('0x48')]=_[_0x6098('0x42')](_0x5939be,_0x6098('0x3d'));_0x36de40['query']=_[_0x6098('0x49')](_0x18ee22[_0x6098('0x4a')]);_0x36de40[_0x6098('0x4b')]=_[_0x6098('0x4c')](_0x36de40[_0x6098('0x48')],_0x36de40[_0x6098('0x4a')]);_0x12beb9['attributes']=_['intersection'](_0x36de40[_0x6098('0x48')],qs[_0x6098('0x4d')](_0x18ee22[_0x6098('0x4a')][_0x6098('0x4d')]));_0x12beb9[_0x6098('0x4e')]=_0x12beb9['attributes'][_0x6098('0x4f')]?_0x12beb9[_0x6098('0x4e')]:_0x36de40[_0x6098('0x48')];if(!_0x18ee22[_0x6098('0x4a')][_0x6098('0x50')]('nolimit')){_0x12beb9[_0x6098('0x30')]=qs['limit'](_0x18ee22[_0x6098('0x4a')][_0x6098('0x30')]);_0x12beb9[_0x6098('0x32')]=qs[_0x6098('0x32')](_0x18ee22['query']['offset']);}_0x12beb9[_0x6098('0x51')]=qs[_0x6098('0x52')](_0x18ee22['query'][_0x6098('0x52')]);_0x12beb9[_0x6098('0x53')]=qs[_0x6098('0x4b')](_[_0x6098('0x54')](_0x18ee22[_0x6098('0x4a')],_0x36de40['filters']),_0x5939be);if(_0x18ee22[_0x6098('0x4a')][_0x6098('0x55')]){_0x12beb9[_0x6098('0x53')]=_[_0x6098('0x56')](_0x12beb9[_0x6098('0x53')],{'$or':_['map'](_0x5939be,function(_0x2916e2){if(_0x2916e2[_0x6098('0x46')]!=='VIRTUAL'){var _0x53ad00={};_0x53ad00[_0x2916e2[_0x6098('0x3d')]]={'$like':'%'+_0x18ee22[_0x6098('0x4a')][_0x6098('0x55')]+'%'};return _0x53ad00;}})});}_0x12beb9=_[_0x6098('0x56')]({},_0x12beb9,_0x18ee22[_0x6098('0x57')]);var _0x2a678f={'where':_0x12beb9[_0x6098('0x53')]};return db['WhatsappAccount'][_0x6098('0x31')](_0x2a678f)[_0x6098('0x21')](function(_0xda0b49){_0x3cdfea['count']=_0xda0b49;if(_0x18ee22[_0x6098('0x4a')][_0x6098('0x58')]){_0x12beb9[_0x6098('0x59')]=[{'all':!![]}];}return db[_0x6098('0x43')][_0x6098('0x5a')](_0x12beb9);})['then'](function(_0x2ec65d){_0x3cdfea[_0x6098('0x5b')]=_0x2ec65d;return _0x3cdfea;})[_0x6098('0x21')](respondWithFilteredResult(_0x24fc97,_0x12beb9))[_0x6098('0x5c')](handleError(_0x24fc97,null));};exports[_0x6098('0x5d')]=function(_0x58df1a,_0x2c730d){var _0x30ed7b={'raw':![],'where':{'id':_0x58df1a[_0x6098('0x5e')]['id']},'include':[{'model':db[_0x6098('0x40')],'as':_0x6098('0x41')}]},_0x5e9097={};_0x5e9097['model']=_[_0x6098('0x49')](db[_0x6098('0x43')][_0x6098('0x44')]);_0x5e9097[_0x6098('0x4a')]=_['keys'](_0x58df1a[_0x6098('0x4a')]);_0x5e9097[_0x6098('0x4b')]=_[_0x6098('0x4c')](_0x5e9097[_0x6098('0x48')],_0x5e9097[_0x6098('0x4a')]);_0x30ed7b[_0x6098('0x4e')]=_[_0x6098('0x4c')](_0x5e9097['model'],qs[_0x6098('0x4d')](_0x58df1a['query'][_0x6098('0x4d')]));_0x30ed7b[_0x6098('0x4e')]=_0x30ed7b[_0x6098('0x4e')][_0x6098('0x4f')]?_0x30ed7b[_0x6098('0x4e')]:_0x5e9097[_0x6098('0x48')];if(_0x58df1a[_0x6098('0x4a')]['includeAll']){_0x30ed7b['include']=[{'all':!![]}];}_0x30ed7b=_['merge']({},_0x30ed7b,_0x58df1a['options']);return db['WhatsappAccount'][_0x6098('0x5f')](_0x30ed7b)[_0x6098('0x21')](handleEntityNotFound(_0x2c730d,null))[_0x6098('0x21')](respondWithResult(_0x2c730d,null))[_0x6098('0x5c')](handleError(_0x2c730d,null));};exports['create']=function(_0x46a606,_0x5ee773){return db[_0x6098('0x43')]['create'](_0x46a606['body'],{})[_0x6098('0x21')](function(_0x238032){var _0x39d85c=_0x46a606[_0x6098('0x60')][_0x6098('0x39')]({'plain':!![]});if(!_0x39d85c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39d85c[_0x6098('0x61')]==='user'){var _0x174fe1=_0x238032[_0x6098('0x39')]({'plain':!![]});var _0x423a00=_0x6098('0x3a');return db['UserProfileSection'][_0x6098('0x5f')]({'where':{'name':_0x423a00,'userProfileId':_0x39d85c['userProfileId']},'raw':!![]})[_0x6098('0x21')](function(_0xf15403){if(_0xf15403&&_0xf15403[_0x6098('0x62')]===0x0){return db[_0x6098('0x3b')][_0x6098('0x63')]({'name':_0x174fe1[_0x6098('0x3d')],'resourceId':_0x174fe1['id'],'type':_0xf15403[_0x6098('0x3d')],'sectionId':_0xf15403['id']},{})['then'](function(){return _0x238032;});}else{return _0x238032;}})['catch'](function(_0x36d588){logger[_0x6098('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36d588);throw _0x36d588;});}return _0x238032;})['then'](respondWithResult(_0x5ee773,0xc9))['catch'](handleError(_0x5ee773,null));};exports['update']=function(_0x32b877,_0x3912c6){if(_0x32b877[_0x6098('0x64')]['id']){delete _0x32b877[_0x6098('0x64')]['id'];}return db[_0x6098('0x43')][_0x6098('0x5f')]({'where':{'id':_0x32b877[_0x6098('0x5e')]['id']},'include':[{'model':db[_0x6098('0x40')],'as':_0x6098('0x41')}]})[_0x6098('0x21')](handleEntityNotFound(_0x3912c6,null))[_0x6098('0x21')](saveUpdates(_0x32b877[_0x6098('0x64')],null))[_0x6098('0x21')](respondWithResult(_0x3912c6,null))[_0x6098('0x5c')](handleError(_0x3912c6,null));};exports[_0x6098('0x38')]=function(_0x42c385,_0x112cb9){return db[_0x6098('0x43')][_0x6098('0x5f')]({'where':{'id':_0x42c385[_0x6098('0x5e')]['id']}})[_0x6098('0x21')](handleEntityNotFound(_0x112cb9,null))[_0x6098('0x21')](removeEntity(_0x112cb9,null))[_0x6098('0x5c')](handleError(_0x112cb9,null));};exports[_0x6098('0x65')]=function(_0x34439b,_0x5cb08d){return db[_0x6098('0x43')]['describe']()[_0x6098('0x21')](respondWithResult(_0x5cb08d,null))[_0x6098('0x5c')](handleError(_0x5cb08d,null));};exports[_0x6098('0x66')]=function(_0x253de6,_0x203e07,_0x180df8){if(_0x253de6[_0x6098('0x64')]['id']){delete _0x253de6[_0x6098('0x64')]['id'];}return db['WhatsappAccount'][_0x6098('0x5f')]({'where':{'id':_0x253de6[_0x6098('0x5e')]['id']}})[_0x6098('0x21')](handleEntityNotFound(_0x203e07,null))['then'](function(_0x210354){if(_0x210354){_0x253de6[_0x6098('0x64')][_0x6098('0x67')]=_0x210354['id'];return db[_0x6098('0x68')][_0x6098('0x63')](_0x253de6[_0x6098('0x64')]);}})['then'](respondWithResult(_0x203e07,null))['catch'](handleError(_0x203e07,null));};exports[_0x6098('0x69')]=function(_0x4e44bf,_0x4e08f7,_0x125ba6){var _0x35b7a1={'raw':![],'where':{}};var _0xc07bab={};var _0x2f7d14={'count':0x0,'rows':[]};return db[_0x6098('0x43')]['findOne']({'where':{'id':_0x4e44bf['params']['id']}})[_0x6098('0x21')](handleEntityNotFound(_0x4e08f7,null))[_0x6098('0x21')](function(_0x30be0b){if(_0x30be0b){_0xc07bab[_0x6098('0x48')]=_[_0x6098('0x49')](db[_0x6098('0x68')][_0x6098('0x44')]);_0xc07bab[_0x6098('0x4a')]=_[_0x6098('0x49')](_0x4e44bf[_0x6098('0x4a')]);_0xc07bab['filters']=_['intersection'](_0xc07bab[_0x6098('0x48')],_0xc07bab[_0x6098('0x4a')]);_0x35b7a1[_0x6098('0x4e')]=_[_0x6098('0x4c')](_0xc07bab[_0x6098('0x48')],qs[_0x6098('0x4d')](_0x4e44bf[_0x6098('0x4a')][_0x6098('0x4d')]));_0x35b7a1['attributes']=_0x35b7a1[_0x6098('0x4e')][_0x6098('0x4f')]?_0x35b7a1[_0x6098('0x4e')]:_0xc07bab[_0x6098('0x48')];if(!_0x4e44bf[_0x6098('0x4a')][_0x6098('0x50')](_0x6098('0x6a'))){_0x35b7a1[_0x6098('0x30')]=qs['limit'](_0x4e44bf[_0x6098('0x4a')][_0x6098('0x30')]);_0x35b7a1[_0x6098('0x32')]=qs[_0x6098('0x32')](_0x4e44bf[_0x6098('0x4a')][_0x6098('0x32')]);}_0x35b7a1['order']=qs['sort'](_0x4e44bf[_0x6098('0x4a')][_0x6098('0x52')]);_0x35b7a1[_0x6098('0x53')]=qs['filters'](_[_0x6098('0x54')](_0x4e44bf[_0x6098('0x4a')],_0xc07bab[_0x6098('0x4b')]));_0x35b7a1[_0x6098('0x53')]['WhatsappAccountId']=_0x30be0b['id'];if(_0x4e44bf[_0x6098('0x4a')][_0x6098('0x55')]){_0x35b7a1['where']=_[_0x6098('0x56')](_0x35b7a1[_0x6098('0x53')],{'$or':_['map'](_0x35b7a1[_0x6098('0x4e')],function(_0x25fdd9){var _0x2a675c={};_0x2a675c[_0x25fdd9]={'$like':'%'+_0x4e44bf[_0x6098('0x4a')][_0x6098('0x55')]+'%'};return _0x2a675c;})});}_0x35b7a1=_[_0x6098('0x56')]({},_0x35b7a1,_0x4e44bf[_0x6098('0x57')]);return db['Disposition']['count']({'where':_0x35b7a1['where']})[_0x6098('0x21')](function(_0x4e7783){_0x2f7d14[_0x6098('0x31')]=_0x4e7783;if(_0x4e44bf[_0x6098('0x4a')][_0x6098('0x58')]){_0x35b7a1['include']=[{'all':!![]}];}return db[_0x6098('0x68')][_0x6098('0x5a')](_0x35b7a1);})[_0x6098('0x21')](function(_0x14d3fd){_0x2f7d14[_0x6098('0x5b')]=_0x14d3fd;return _0x2f7d14;});}})[_0x6098('0x21')](respondWithFilteredResult(_0x4e08f7,_0x35b7a1))['catch'](handleError(_0x4e08f7,null));};exports['removeDispositions']=function(_0x50b5dd,_0x2b7d3f,_0x46e2f1){return db[_0x6098('0x43')]['find']({'where':{'id':_0x50b5dd[_0x6098('0x5e')]['id']}})[_0x6098('0x21')](handleEntityNotFound(_0x2b7d3f,null))['then'](function(_0xdc10ba){if(_0xdc10ba){return _0xdc10ba[_0x6098('0x6b')](_0x50b5dd[_0x6098('0x4a')][_0x6098('0x6c')]);}})[_0x6098('0x21')](respondWithStatusCode(_0x2b7d3f,null))[_0x6098('0x5c')](handleError(_0x2b7d3f,null));};exports[_0x6098('0x6d')]=function(_0x1a9b2e,_0x236494,_0x43ffcc){if(_0x1a9b2e[_0x6098('0x64')]['id']){delete _0x1a9b2e['body']['id'];}return db['WhatsappAccount'][_0x6098('0x5f')]({'where':{'id':_0x1a9b2e[_0x6098('0x5e')]['id']}})[_0x6098('0x21')](handleEntityNotFound(_0x236494,null))[_0x6098('0x21')](function(_0x2f6e6f){if(_0x2f6e6f){_0x1a9b2e[_0x6098('0x64')][_0x6098('0x67')]=_0x2f6e6f['id'];return db[_0x6098('0x6e')][_0x6098('0x63')](_0x1a9b2e[_0x6098('0x64')]);}})[_0x6098('0x21')](respondWithResult(_0x236494,null))[_0x6098('0x5c')](handleError(_0x236494,null));};exports[_0x6098('0x6f')]=function(_0x3f3919,_0x4b8e66,_0x531a4f){var _0x3cdee6={'raw':![],'where':{}};var _0x5e9b2f={};var _0x41ff9c={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x6098('0x70')]({'where':{'id':_0x3f3919[_0x6098('0x5e')]['id']}})[_0x6098('0x21')](handleEntityNotFound(_0x4b8e66,null))[_0x6098('0x21')](function(_0x56d8ce){if(_0x56d8ce){_0x5e9b2f[_0x6098('0x48')]=_[_0x6098('0x49')](db[_0x6098('0x6e')][_0x6098('0x44')]);_0x5e9b2f[_0x6098('0x4a')]=_[_0x6098('0x49')](_0x3f3919[_0x6098('0x4a')]);_0x5e9b2f[_0x6098('0x4b')]=_[_0x6098('0x4c')](_0x5e9b2f[_0x6098('0x48')],_0x5e9b2f[_0x6098('0x4a')]);_0x3cdee6[_0x6098('0x4e')]=_[_0x6098('0x4c')](_0x5e9b2f[_0x6098('0x48')],qs['fields'](_0x3f3919[_0x6098('0x4a')][_0x6098('0x4d')]));_0x3cdee6[_0x6098('0x4e')]=_0x3cdee6[_0x6098('0x4e')][_0x6098('0x4f')]?_0x3cdee6[_0x6098('0x4e')]:_0x5e9b2f['model'];if(!_0x3f3919[_0x6098('0x4a')][_0x6098('0x50')]('nolimit')){_0x3cdee6[_0x6098('0x30')]=qs[_0x6098('0x30')](_0x3f3919[_0x6098('0x4a')][_0x6098('0x30')]);_0x3cdee6[_0x6098('0x32')]=qs[_0x6098('0x32')](_0x3f3919[_0x6098('0x4a')]['offset']);}_0x3cdee6['order']=qs['sort'](_0x3f3919[_0x6098('0x4a')][_0x6098('0x52')]);_0x3cdee6['where']=qs[_0x6098('0x4b')](_[_0x6098('0x54')](_0x3f3919[_0x6098('0x4a')],_0x5e9b2f[_0x6098('0x4b')]));_0x3cdee6[_0x6098('0x53')][_0x6098('0x67')]=_0x56d8ce['id'];if(_0x3f3919[_0x6098('0x4a')][_0x6098('0x55')]){_0x3cdee6['where']=_['merge'](_0x3cdee6[_0x6098('0x53')],{'$or':_['map'](_0x3cdee6[_0x6098('0x4e')],function(_0x5bbcaa){var _0x4340ff={};_0x4340ff[_0x5bbcaa]={'$like':'%'+_0x3f3919[_0x6098('0x4a')]['filter']+'%'};return _0x4340ff;})});}_0x3cdee6=_[_0x6098('0x56')]({},_0x3cdee6,_0x3f3919[_0x6098('0x57')]);return db[_0x6098('0x6e')][_0x6098('0x31')]({'where':_0x3cdee6[_0x6098('0x53')]})['then'](function(_0x3da855){_0x41ff9c[_0x6098('0x31')]=_0x3da855;if(_0x3f3919[_0x6098('0x4a')]['includeAll']){_0x3cdee6['include']=[{'all':!![]}];}return db[_0x6098('0x6e')][_0x6098('0x5a')](_0x3cdee6);})[_0x6098('0x21')](function(_0x57fff7){_0x41ff9c[_0x6098('0x5b')]=_0x57fff7;return _0x41ff9c;});}})['then'](respondWithFilteredResult(_0x4b8e66,_0x3cdee6))['catch'](handleError(_0x4b8e66,null));};exports[_0x6098('0x71')]=function(_0x49d182,_0x4ed2fe,_0x2fc8bd){return db[_0x6098('0x43')][_0x6098('0x5f')]({'where':{'id':_0x49d182[_0x6098('0x5e')]['id']}})[_0x6098('0x21')](handleEntityNotFound(_0x4ed2fe,null))[_0x6098('0x21')](function(_0x4f8e9e){if(_0x4f8e9e){return _0x4f8e9e[_0x6098('0x71')](_0x49d182[_0x6098('0x4a')][_0x6098('0x6c')]);}})['then'](respondWithStatusCode(_0x4ed2fe,null))[_0x6098('0x5c')](handleError(_0x4ed2fe,null));};exports[_0x6098('0x72')]=function(_0x2c3480,_0x3b498c,_0x36c24a){return db[_0x6098('0x43')]['find']({'where':{'id':_0x2c3480['params']['id']}})[_0x6098('0x21')](handleEntityNotFound(_0x3b498c,null))[_0x6098('0x21')](function(_0xf6b0d3){if(_0xf6b0d3){return _0xf6b0d3[_0x6098('0x72')](_0x2c3480[_0x6098('0x64')]['ids'],_[_0x6098('0x73')](_0x2c3480[_0x6098('0x64')],[_0x6098('0x6c'),'id'])||{})[_0x6098('0x74')](function(_0x1c408f){for(var _0x28c579=0x0;_0x28c579<_0x2c3480[_0x6098('0x64')][_0x6098('0x6c')][_0x6098('0x4f')];_0x28c579+=0x1){socket[_0x6098('0x75')](_0x6098('0x76'),{'UserId':Number(_0x2c3480[_0x6098('0x64')][_0x6098('0x6c')][_0x28c579]),'WhatsappAccountId':Number(_0x2c3480[_0x6098('0x5e')]['id'])});}return _0x1c408f;});}})[_0x6098('0x21')](respondWithResult(_0x3b498c,null))[_0x6098('0x5c')](handleError(_0x3b498c,null));};exports[_0x6098('0x77')]=function(_0x2a014a,_0x174294,_0x2a4737){return db[_0x6098('0x43')][_0x6098('0x5f')]({'where':{'id':_0x2a014a[_0x6098('0x5e')]['id']}})[_0x6098('0x21')](handleEntityNotFound(_0x174294,null))[_0x6098('0x21')](function(_0x3c5828){if(_0x3c5828){return _0x3c5828[_0x6098('0x77')](_0x2a014a['query'][_0x6098('0x6c')])[_0x6098('0x21')](function(){if(_[_0x6098('0x78')](_0x2a014a['query'][_0x6098('0x6c')])){for(var _0x45ef7f=0x0;_0x45ef7f<_0x2a014a[_0x6098('0x4a')][_0x6098('0x6c')][_0x6098('0x4f')];_0x45ef7f+=0x1){socket[_0x6098('0x75')](_0x6098('0x79'),{'UserId':Number(_0x2a014a[_0x6098('0x4a')][_0x6098('0x6c')][_0x45ef7f]),'WhatsappAccountId':Number(_0x2a014a[_0x6098('0x5e')]['id'])});}}else{socket[_0x6098('0x75')](_0x6098('0x79'),{'UserId':Number(_0x2a014a[_0x6098('0x4a')][_0x6098('0x6c')]),'WhatsappAccountId':Number(_0x2a014a[_0x6098('0x5e')]['id'])});}});}})[_0x6098('0x21')](respondWithStatusCode(_0x174294,null))['catch'](handleError(_0x174294,null));};exports['getAgents']=function(_0x1f4f90,_0xe88413,_0x90b038){var _0x55b1bf={};var _0x41ee54={};var _0xce7403;var _0x885588;return db[_0x6098('0x43')][_0x6098('0x70')]({'where':{'id':_0x1f4f90['params']['id']}})[_0x6098('0x21')](handleEntityNotFound(_0xe88413,null))[_0x6098('0x21')](function(_0x37ab86){if(_0x37ab86){_0xce7403=_0x37ab86;_0x41ee54['model']=_[_0x6098('0x49')](db['User'][_0x6098('0x44')]);_0x41ee54[_0x6098('0x4a')]=_[_0x6098('0x49')](_0x1f4f90[_0x6098('0x4a')]);_0x41ee54[_0x6098('0x4b')]=_[_0x6098('0x4c')](_0x41ee54[_0x6098('0x48')],_0x41ee54[_0x6098('0x4a')]);_0x55b1bf['attributes']=_[_0x6098('0x4c')](_0x41ee54['model'],qs[_0x6098('0x4d')](_0x1f4f90[_0x6098('0x4a')][_0x6098('0x4d')]));_0x55b1bf[_0x6098('0x4e')]=_0x55b1bf['attributes'][_0x6098('0x4f')]?_0x55b1bf[_0x6098('0x4e')]:_0x41ee54['model'];_0x55b1bf['order']=qs[_0x6098('0x52')](_0x1f4f90['query'][_0x6098('0x52')]);_0x55b1bf['where']=qs['filters'](_[_0x6098('0x54')](_0x1f4f90[_0x6098('0x4a')],_0x41ee54[_0x6098('0x4b')]));if(_0x1f4f90[_0x6098('0x4a')][_0x6098('0x55')]){_0x55b1bf['where']=_[_0x6098('0x56')](_0x55b1bf[_0x6098('0x53')],{'$or':_[_0x6098('0x42')](_0x55b1bf[_0x6098('0x4e')],function(_0x59195e){var _0x465f5f={};_0x465f5f[_0x59195e]={'$like':'%'+_0x1f4f90[_0x6098('0x4a')][_0x6098('0x55')]+'%'};return _0x465f5f;})});}_0x55b1bf=_[_0x6098('0x56')]({},_0x55b1bf,_0x1f4f90[_0x6098('0x57')]);return _0xce7403[_0x6098('0x7a')](_0x55b1bf);}})[_0x6098('0x21')](function(_0x1a9c0f){if(_0x1a9c0f){_0x885588=_0x1a9c0f[_0x6098('0x4f')];if(!_0x1f4f90[_0x6098('0x4a')][_0x6098('0x50')](_0x6098('0x6a'))){_0x55b1bf[_0x6098('0x30')]=qs['limit'](_0x1f4f90[_0x6098('0x4a')]['limit']);_0x55b1bf[_0x6098('0x32')]=qs[_0x6098('0x32')](_0x1f4f90[_0x6098('0x4a')][_0x6098('0x32')]);}return _0xce7403['getAgents'](_0x55b1bf);}})['then'](function(_0x264f37){if(_0x264f37){return _0x264f37?{'count':_0x885588,'rows':_0x264f37}:null;}})[_0x6098('0x21')](respondWithResult(_0xe88413,null))['catch'](handleError(_0xe88413,null));};exports[_0x6098('0x7b')]=function(_0xcc19d3,_0x4f6eab,_0x44fd14){return db[_0x6098('0x43')][_0x6098('0x70')]({'where':{'id':_0xcc19d3[_0x6098('0x5e')]['id']}})[_0x6098('0x21')](handleEntityNotFound(_0x4f6eab,null))[_0x6098('0x21')](function(_0x24b3ba){if(_0x24b3ba){return db['sequelize']['transaction'](function(_0x545dd0){return db[_0x6098('0x7c')][_0x6098('0x38')]({'where':{'WhatsappAccountId':_0xcc19d3[_0x6098('0x5e')]['id']},'transaction':_0x545dd0})['then'](function(_0x5f293d){var _0x18ffe8=_[_0x6098('0x42')](_0xcc19d3['body'],function(_0x52da9a){_0x52da9a['WhatsappAccountId']=_0xcc19d3[_0x6098('0x5e')]['id'];return _0x52da9a;});return db[_0x6098('0x7c')][_0x6098('0x7d')](_0x18ffe8,{'transaction':_0x545dd0});});})[_0x6098('0x21')](function(){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0xcc19d3[_0x6098('0x5e')]['id']},'order':_0x6098('0x7e')});});}})[_0x6098('0x21')](respondWithResult(_0x4f6eab,null))[_0x6098('0x5c')](handleError(_0x4f6eab,null));};exports[_0x6098('0x7f')]=function(_0x479e32,_0x5d2417,_0x875940){var _0xd26689={};var _0x484c2d={};var _0x2f71a9;var _0x3f2b5f;return db['WhatsappAccount'][_0x6098('0x70')]({'where':{'id':_0x479e32['params']['id']}})['then'](handleEntityNotFound(_0x5d2417,null))[_0x6098('0x21')](function(_0x180187){if(_0x180187){_0x2f71a9=_0x180187;_0x484c2d[_0x6098('0x48')]=_[_0x6098('0x49')](db[_0x6098('0x7c')][_0x6098('0x44')]);_0x484c2d[_0x6098('0x4a')]=_[_0x6098('0x49')](_0x479e32['query']);_0x484c2d[_0x6098('0x4b')]=_[_0x6098('0x4c')](_0x484c2d[_0x6098('0x48')],_0x484c2d[_0x6098('0x4a')]);_0xd26689['attributes']=_[_0x6098('0x4c')](_0x484c2d[_0x6098('0x48')],qs[_0x6098('0x4d')](_0x479e32['query'][_0x6098('0x4d')]));_0xd26689[_0x6098('0x4e')]=_0xd26689[_0x6098('0x4e')][_0x6098('0x4f')]?_0xd26689[_0x6098('0x4e')]:_0x484c2d[_0x6098('0x48')];_0xd26689[_0x6098('0x51')]=qs['sort'](_0x479e32[_0x6098('0x4a')]['sort']);_0xd26689[_0x6098('0x53')]=qs[_0x6098('0x4b')](_[_0x6098('0x54')](_0x479e32[_0x6098('0x4a')],_0x484c2d['filters']));if(_0x479e32[_0x6098('0x4a')][_0x6098('0x55')]){_0xd26689[_0x6098('0x53')]=_[_0x6098('0x56')](_0xd26689[_0x6098('0x53')],{'$or':_[_0x6098('0x42')](_0xd26689[_0x6098('0x4e')],function(_0x215199){var _0x2f5acd={};_0x2f5acd[_0x215199]={'$like':'%'+_0x479e32[_0x6098('0x4a')]['filter']+'%'};return _0x2f5acd;})});}_0xd26689=_['merge']({},_0xd26689,_0x479e32['options']);return _0x2f71a9[_0x6098('0x7f')](_0xd26689);}})[_0x6098('0x21')](function(_0x4ad558){if(_0x4ad558){_0x3f2b5f=_0x4ad558['length'];if(!_0x479e32[_0x6098('0x4a')]['hasOwnProperty'](_0x6098('0x6a'))){_0xd26689[_0x6098('0x30')]=qs['limit'](_0x479e32[_0x6098('0x4a')][_0x6098('0x30')]);_0xd26689[_0x6098('0x32')]=qs['offset'](_0x479e32['query'][_0x6098('0x32')]);}return _0x2f71a9['getApplications'](_0xd26689);}})[_0x6098('0x21')](function(_0x3c852e){if(_0x3c852e){return _0x3c852e?{'count':_0x3f2b5f,'rows':_0x3c852e}:null;}})['then'](respondWithResult(_0x5d2417,null))[_0x6098('0x5c')](handleError(_0x5d2417,null));};exports[_0x6098('0x80')]=function(_0x482779,_0x4cf8e0,_0x463d19){var _0x1b0488={'channel':_0x6098('0x81')};var _0x33066d=[];var _0x2ae0d4=[];var _0x283a78={};return db[_0x6098('0x43')]['find']({'where':{'id':_0x482779[_0x6098('0x5e')]['id']},'include':[{'model':db[_0x6098('0x7c')],'as':_0x6098('0x82')}]})[_0x6098('0x21')](handleEntityNotFound(_0x4cf8e0,null))['then'](function(_0x19dc0d){_0x1b0488[_0x6098('0x83')]=_0x19dc0d;_0x1b0488['applications']=_['orderBy'](_0x19dc0d[_0x6098('0x82')],[_0x6098('0x7e')],[_0x6098('0x84')]);if(_0x1b0488[_0x6098('0x83')][_0x6098('0x82')]){delete _0x1b0488[_0x6098('0x83')][_0x6098('0x82')];}return db[_0x6098('0x85')][_0x6098('0x65')]();})[_0x6098('0x21')](function(_0x15ded3){if(!_0x15ded3){throw new db[(_0x6098('0x86'))][(_0x6098('0x87'))]('no\x20available\x20attributes');}_0x33066d=_[_0x6098('0x88')](_[_0x6098('0x49')](_0x15ded3),[_0x6098('0x89'),_0x6098('0x8a')]);_0x2ae0d4=_[_0x6098('0x88')](_['keys'](_0x15ded3),[_0x6098('0x89'),_0x6098('0x8a'),_0x6098('0x8b'),_0x6098('0x8c')]);_0x1b0488[_0x6098('0x64')]={'mapKey':_0x6098('0x8d')};if(_0x1b0488['account'][_0x6098('0x46')]&&_0x1b0488['account'][_0x6098('0x46')]===_0x6098('0x8e')){_0x1b0488['body'][_0x6098('0x8f')]=_0x482779[_0x6098('0x64')][_0x6098('0x90')]['replace'](_0x6098('0x91'),'');_0x1b0488[_0x6098('0x64')]['body']=_0x482779[_0x6098('0x64')]['Body'];_0x1b0488[_0x6098('0x64')][_0x6098('0x92')]=_0x482779['body'][_0x6098('0x93')];}if(_0x1b0488[_0x6098('0x64')]['id']){delete _0x1b0488[_0x6098('0x64')]['id'];}if(_[_0x6098('0x94')](_0x1b0488[_0x6098('0x64')][_0x6098('0x8f')])){throw new db['Sequelize'][(_0x6098('0x87'))]('from\x20is\x20mandatory');}if(_[_0x6098('0x94')](_0x1b0488[_0x6098('0x64')]['body'])||_0x1b0488[_0x6098('0x64')]['body']===''){throw new db[(_0x6098('0x86'))]['ValidationError'](_0x6098('0x95'));}if(_[_0x6098('0x94')](_0x1b0488[_0x6098('0x64')][_0x6098('0x96')])){throw new db[(_0x6098('0x86'))][(_0x6098('0x87'))](_0x6098('0x97')+_0x2ae0d4);}if(!_[_0x6098('0x98')](_0x2ae0d4,_0x1b0488[_0x6098('0x64')][_0x6098('0x96')])){throw new db[(_0x6098('0x86'))][(_0x6098('0x87'))](_0x6098('0x99')+_0x2ae0d4);}_0x283a78[_0x1b0488[_0x6098('0x64')][_0x6098('0x96')]]=_0x1b0488[_0x6098('0x64')][_0x6098('0x8f')];return db[_0x6098('0x9a')]['find']({'where':{'id':_0x1b0488['account'][_0x6098('0x8c')]},'include':[{'model':db[_0x6098('0x85')],'as':_0x6098('0x9b'),'where':_0x283a78,'limit':0x1,'order':[['updatedAt',_0x6098('0x9c')]]}]});})['then'](handleEntityNotFound(_0x4cf8e0,null))[_0x6098('0x21')](function(_0x34e9e4){if(_0x34e9e4){_0x1b0488['list']=_[_0x6098('0x73')](_0x34e9e4,[_0x6098('0x9b')]);if(_0x34e9e4[_0x6098('0x9b')][_0x6098('0x4f')]){return _0x34e9e4[_0x6098('0x9b')][0x0];}var _0x422a1c=_[_0x6098('0x18')](_0x1b0488[_0x6098('0x64')],{'firstName':_0x1b0488[_0x6098('0x64')][_0x6098('0x8f')],'ListId':_0x34e9e4['id']});_0x422a1c[_0x1b0488[_0x6098('0x64')][_0x6098('0x96')]]=_0x1b0488[_0x6098('0x64')][_0x6098('0x8f')];return db['CmContact'][_0x6098('0x63')](_0x422a1c,{'fields':_0x33066d,'raw':!![]});}})[_0x6098('0x21')](handleEntityNotFound(_0x4cf8e0,null))[_0x6098('0x21')](function(_0x4575e1){if(_0x4575e1){_0x1b0488[_0x6098('0x9d')]=_0x4575e1;var _0x208635={'ContactId':_0x4575e1['id'],'phone':_0x1b0488[_0x6098('0x64')][_0x6098('0x8f')],'WhatsappAccountId':_0x482779[_0x6098('0x5e')]['id']};var _0x5c0a81={'ContactId':_0x4575e1['id'],'WhatsappAccountId':_0x482779[_0x6098('0x5e')]['id'],'closed':![]};return db[_0x6098('0x9e')][_0x6098('0x5f')]({'where':_0x5c0a81})[_0x6098('0x21')](function(_0x1f70c9){if(_0x1f70c9){return[_0x1f70c9,![]];}return db[_0x6098('0x9e')][_0x6098('0x63')](_0x208635)[_0x6098('0x21')](function(_0xe341e6){return[_0xe341e6,!![]];});});}})['spread'](function(_0x4b2f25,_0x20d1a0){_0x1b0488[_0x6098('0x9f')]=_0x4b2f25[_0x6098('0x39')]({'plain':!![]});_0x1b0488['interaction']['created']=![];if(_0x20d1a0){if(_0x1b0488[_0x6098('0x83')][_0x6098('0xa0')]){_0x1b0488[_0x6098('0xa1')][_0x6098('0xa2')]({'id':0x0,'priority':_0x1b0488[_0x6098('0xa1')][_0x6098('0x4f')]+0x1,'app':_0x6098('0xa3'),'appdata':_0x6098('0xa4'),'interval':_0x6098('0xa5')});}_0x1b0488[_0x6098('0x9f')][_0x6098('0xa6')]=!![];}return db['WhatsappMessage']['create']({'phone':_0x1b0488[_0x6098('0x64')][_0x6098('0x8f')],'messageId':_0x1b0488['body'][_0x6098('0x92')],'body':_0x1b0488[_0x6098('0x64')][_0x6098('0x64')],'WhatsappAccountId':_0x482779[_0x6098('0x5e')]['id'],'WhatsappInteractionId':_0x4b2f25['id'],'direction':'in','ContactId':_0x4b2f25[_0x6098('0xa7')],'AttachmentId':_0x1b0488[_0x6098('0x64')][_0x6098('0xa8')]});})[_0x6098('0x21')](function(_0x84d077){_0x1b0488[_0x6098('0x2a')]=_0x84d077;if(_0x1b0488[_0x6098('0x9f')][_0x6098('0xa9')]){return db[_0x6098('0xaa')][_0x6098('0x5f')]({'attributes':['id',_0x6098('0x3d')],'where':{'id':_0x1b0488[_0x6098('0x9f')][_0x6098('0xa9')]}})[_0x6098('0x21')](function(_0x4e0730){if(_0x4e0730){_0x1b0488[_0x6098('0xa1')][_0x6098('0xab')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4e0730[_0x6098('0x3d')]+','+(_0x1b0488[_0x6098('0x83')][_0x6098('0xac')]||0xa),'interval':_0x6098('0xa5')});}return respondWithRpcPromise(_0x6098('0xad'),_0x6098('0xae'),_0x1b0488);});}return respondWithRpcPromise(_0x6098('0xad'),_0x6098('0xae'),_0x1b0488);})[_0x6098('0x21')](function(_0x428f0a){if(_0x428f0a){var _0x3e1bba=0xc8;var _0xdd849f=_0x6098('0xaf');logger[_0x6098('0x22')](_0x6098('0x26'),_0xdd849f,_0x3e1bba,_0x6098('0xb0'));logger[_0x6098('0x25')](_0x6098('0xb1'),_0xdd849f,_0x3e1bba,'entity\x20found',JSON[_0x6098('0x27')](_0x428f0a));if(_0x1b0488['account']['type']===_0x6098('0x8e')){return _0x4cf8e0['status'](_0x3e1bba)['set']('Content-Type','text/xml')[_0x6098('0x3e')]('\x0a');}else{return _0x4cf8e0['status'](_0x3e1bba)[_0x6098('0x2e')](_0x428f0a);}}})[_0x6098('0x5c')](handleError(_0x4cf8e0,null));};exports[_0x6098('0x3e')]=function(_0x1b09d3,_0x291cc6,_0x3c80d5){var _0x244651,_0x3c9076,_0x106f52;if(_['isNil'](_0x1b09d3[_0x6098('0x64')][_0x6098('0x64')])||_0x1b09d3['body'][_0x6098('0x64')]===''){throw new db[(_0x6098('0x86'))]['ValidationError'](_0x6098('0x95'));}if(_['isNil'](_0x1b09d3['body']['to'])){throw new db[(_0x6098('0x86'))][(_0x6098('0x87'))]('to\x20is\x20mandatory');}_0x244651=_0x1b09d3['body']['to'];return db['WhatsappAccount'][_0x6098('0x5f')]({'where':{'id':_0x1b09d3[_0x6098('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0x6098('0xb2'),'include':[{'model':db[_0x6098('0x85')],'as':_0x6098('0x9b'),'where':{'mobile':_0x244651},'limit':0x1,'order':[[_0x6098('0x8a'),_0x6098('0x9c')]]}]}]})[_0x6098('0x21')](handleEntityNotFound(_0x291cc6,null))[_0x6098('0x21')](function(_0x1eda76){if(_0x1eda76&&_0x1eda76['List']){_0x3c9076=_0x1eda76[_0x6098('0x39')]({'plain':!![]});if(_0x3c9076[_0x6098('0xb2')]&&_0x3c9076['List'][_0x6098('0x9b')][_0x6098('0x4f')]){return _0x3c9076[_0x6098('0xb2')][_0x6098('0x9b')][0x0];}return db[_0x6098('0x85')]['create'](_[_0x6098('0x18')](_0x1b09d3[_0x6098('0x64')],{'firstName':_0x244651,'mobile':_0x244651,'phone':_0x244651,'ListId':_0x3c9076[_0x6098('0x8c')]}));}})['then'](handleEntityNotFound(_0x291cc6,null))[_0x6098('0x21')](function(_0x35887f){if(_0x35887f){_0x106f52=_0x35887f;return db[_0x6098('0x9e')][_0x6098('0x5f')]({'where':{'ContactId':_0x106f52['id'],'closed':![],'WhatsappAccountId':_0x3c9076['id']}})['then'](function(_0x999e2c){if(_0x999e2c){return[_0x999e2c,![]];}return db[_0x6098('0x9e')][_0x6098('0x63')]({'UserId':_0x1b09d3['user']['id'],'ContactId':_0x106f52['id'],'WhatsappAccountId':_0x3c9076['id'],'phone':_0x244651,'firstMsgDirection':_0x6098('0xb3'),'Messages':[_[_0x6098('0x56')](_0x1b09d3['body'],{'read':![],'body':_0x1b09d3['body']['body'],'phone':_0x244651,'WhatsappAccountId':_0x3c9076['id'],'UserId':_0x1b09d3[_0x6098('0x60')]['id'],'ContactId':_0x106f52['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x6098('0xb4')}]})[_0x6098('0x21')](function(_0x538fc8){return[_0x538fc8,!![]];});});}})['spread'](function(_0x565b1f,_0x9191c8){if(_0x9191c8){return _0x565b1f;}return db[_0x6098('0xb5')][_0x6098('0x63')](_[_0x6098('0x56')](_0x1b09d3[_0x6098('0x64')],{'read':![],'body':_0x1b09d3[_0x6098('0x64')][_0x6098('0x64')],'phone':_0x244651,'WhatsappAccountId':_0x3c9076['id'],'WhatsappInteractionId':_0x565b1f['id'],'UserId':_0x1b09d3[_0x6098('0x60')]['id'],'ContactId':_0x106f52['id']}))[_0x6098('0x21')](function(_0x500f16){_0x565b1f[_0x6098('0xb6')]['Messages']=[];_0x565b1f[_0x6098('0xb6')]['Messages'][_0x6098('0xa2')](_0x500f16['dataValues']);return _0x565b1f;});})[_0x6098('0x21')](respondWithResult(_0x291cc6,null))['catch'](handleError(_0x291cc6,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 5c99761..a244677 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 _0x71c0=['save','update','emit','exports','setMaxListeners'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x71c0,0x1a3));var _0x071c=function(_0x20ee5a,_0x409903){_0x20ee5a=_0x20ee5a-0x0;var _0x4573bf=_0x71c0[_0x20ee5a];return _0x4573bf;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x071c('0x0')](0x0);var events={'afterCreate':_0x071c('0x1'),'afterUpdate':_0x071c('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3bd656){return function(_0x338a95,_0x56773c,_0x4bc8b4){WhatsappAccountEvents[_0x071c('0x3')](_0x3bd656+':'+_0x338a95['id'],_0x338a95);WhatsappAccountEvents[_0x071c('0x3')](_0x3bd656,_0x338a95);_0x4bc8b4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x071c('0x4')]=WhatsappAccountEvents; \ No newline at end of file +var _0xb190=['../../mysqldb','WhatsappAccount','emit','hasOwnProperty','exports','events'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb190,0x13d));var _0x0b19=function(_0x257384,_0x31aad3){_0x257384=_0x257384-0x0;var _0x30ce92=_0xb190[_0x257384];return _0x30ce92;};'use strict';var EventEmitter=require(_0x0b19('0x0'));var WhatsappAccount=require(_0x0b19('0x1'))['db'][_0x0b19('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4550e1){return function(_0x322081,_0x392938,_0x2c5e8d){WhatsappAccountEvents[_0x0b19('0x3')](_0x4550e1+':'+_0x322081['id'],_0x322081);WhatsappAccountEvents[_0x0b19('0x3')](_0x4550e1,_0x322081);_0x2c5e8d(null);};}for(var e in events){if(events[_0x0b19('0x4')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x0b19('0x5')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index f4dd4f6..9dbe7c1 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 _0x2205=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','lodash'];(function(_0x142cd4,_0x5f040d){var _0x4ce088=function(_0x4cacd2){while(--_0x4cacd2){_0x142cd4['push'](_0x142cd4['shift']());}};_0x4ce088(++_0x5f040d);}(_0x2205,0x1e0));var _0x5220=function(_0x4242f1,_0xe2fcd2){_0x4242f1=_0x4242f1-0x0;var _0x1b333a=_0x2205[_0x4242f1];return _0x1b333a;};'use strict';var _=require(_0x5220('0x0'));var util=require(_0x5220('0x1'));var logger=require(_0x5220('0x2'))(_0x5220('0x3'));var moment=require(_0x5220('0x4'));var BPromise=require(_0x5220('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5220('0x6'));var rimraf=require(_0x5220('0x7'));var config=require(_0x5220('0x8'));var attributes=require(_0x5220('0x9'));module[_0x5220('0xa')]=function(_0x50859d,_0x57fb80){return _0x50859d[_0x5220('0xb')](_0x5220('0xc'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6ea=['whatsapp_accounts','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappAccount'];(function(_0x3d4c1f,_0x3295e3){var _0x981b89=function(_0x2d0dce){while(--_0x2d0dce){_0x3d4c1f['push'](_0x3d4c1f['shift']());}};_0x981b89(++_0x3295e3);}(_0xe6ea,0x1c3));var _0xae6e=function(_0x5d784d,_0x43a0c2){_0x5d784d=_0x5d784d-0x0;var _0x4bd08c=_0xe6ea[_0x5d784d];return _0x4bd08c;};'use strict';var _=require(_0xae6e('0x0'));var util=require('util');var logger=require(_0xae6e('0x1'))('api');var moment=require('moment');var BPromise=require(_0xae6e('0x2'));var rp=require(_0xae6e('0x3'));var fs=require('fs');var path=require(_0xae6e('0x4'));var rimraf=require(_0xae6e('0x5'));var config=require(_0xae6e('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0xae6e('0x7')]=function(_0x28a2e9,_0x3d9019){return _0x28a2e9['define'](_0xae6e('0x8'),attributes,{'tableName':_0xae6e('0x9'),'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 e09a77d..4f0ead6 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 _0xa8ea=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','map','attributes','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34f1c2,_0x238534){var _0x3c7a1e=function(_0xfa41ea){while(--_0xfa41ea){_0x34f1c2['push'](_0x34f1c2['shift']());}};_0x3c7a1e(++_0x238534);}(_0xa8ea,0xfb));var _0xaa8e=function(_0x217ce3,_0x519d82){_0x217ce3=_0x217ce3-0x0;var _0x2c5bae=_0xa8ea[_0x217ce3];return _0x2c5bae;};'use strict';var _=require(_0xaa8e('0x0'));var util=require(_0xaa8e('0x1'));var moment=require(_0xaa8e('0x2'));var BPromise=require(_0xaa8e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa8e('0x4'));var db=require(_0xaa8e('0x5'))['db'];var utils=require(_0xaa8e('0x6'));var logger=require(_0xaa8e('0x7'))(_0xaa8e('0x8'));var config=require(_0xaa8e('0x9'));var jayson=require(_0xaa8e('0xa'));var client=jayson[_0xaa8e('0xb')][_0xaa8e('0xc')]({'port':0x232a});config[_0xaa8e('0xd')]=_['defaults'](config[_0xaa8e('0xd')],{'host':_0xaa8e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x1c953b,_0x57f7e6,_0x3a3511){return new BPromise(function(_0x933d9f,_0x4e5d4e){return client['request'](_0x1c953b,_0x3a3511)[_0xaa8e('0xf')](function(_0x1c4b0c){logger['info'](_0xaa8e('0x10'),_0x57f7e6,_0xaa8e('0x11'));logger[_0xaa8e('0x12')](_0xaa8e('0x13'),_0x57f7e6,_0xaa8e('0x11'),JSON[_0xaa8e('0x14')](_0x1c4b0c));if(_0x1c4b0c['error']){if(_0x1c4b0c['error'][_0xaa8e('0x15')]===0x1f4){logger[_0xaa8e('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x57f7e6,_0x1c4b0c[_0xaa8e('0x16')][_0xaa8e('0x17')]);return _0x4e5d4e(_0x1c4b0c['error']['message']);}logger[_0xaa8e('0x16')](_0xaa8e('0x10'),_0x57f7e6,_0x1c4b0c[_0xaa8e('0x16')][_0xaa8e('0x17')]);return _0x933d9f(_0x1c4b0c[_0xaa8e('0x16')]['message']);}else{logger[_0xaa8e('0x18')](_0xaa8e('0x10'),_0x57f7e6,_0xaa8e('0x11'));_0x933d9f(_0x1c4b0c[_0xaa8e('0x19')]['message']);}})[_0xaa8e('0x1a')](function(_0x43bcc2){logger[_0xaa8e('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x57f7e6,_0x43bcc2);_0x4e5d4e(_0x43bcc2);});});}exports[_0xaa8e('0x1b')]=function(_0x44659e){var _0x2a6dd7=this;return new Promise(function(_0x438efc,_0x47b0cb){return db[_0xaa8e('0x1c')][_0xaa8e('0x1d')]({'raw':_0x44659e[_0xaa8e('0x1e')]?_0x44659e[_0xaa8e('0x1e')][_0xaa8e('0x1f')]===undefined?!![]:![]:!![],'where':_0x44659e[_0xaa8e('0x1e')]?_0x44659e['options'][_0xaa8e('0x20')]||null:null,'attributes':_0x44659e[_0xaa8e('0x1e')]?_0x44659e[_0xaa8e('0x1e')]['attributes']||null:null,'include':_0x44659e[_0xaa8e('0x1e')]?_0x44659e['options'][_0xaa8e('0x21')]?_[_0xaa8e('0x22')](_0x44659e[_0xaa8e('0x1e')]['include'],function(_0x4dfce7){return{'model':db[_0x4dfce7['model']],'as':_0x4dfce7['as'],'attributes':_0x4dfce7[_0xaa8e('0x23')],'include':_0x4dfce7['include']?_[_0xaa8e('0x22')](_0x4dfce7['include'],function(_0x29b6c5){return{'model':db[_0x29b6c5[_0xaa8e('0x24')]],'as':_0x29b6c5['as'],'attributes':_0x29b6c5['attributes'],'include':_0x29b6c5[_0xaa8e('0x21')]?_[_0xaa8e('0x22')](_0x29b6c5['include'],function(_0x3b3b90){return{'model':db[_0x3b3b90[_0xaa8e('0x24')]],'as':_0x3b3b90['as'],'attributes':_0x3b3b90[_0xaa8e('0x23')]};}):[]};}):[]};}):[]:[]})[_0xaa8e('0xf')](function(_0x5ad46c){logger[_0xaa8e('0x18')]('ShowWhatsappAccount',_0x44659e);logger[_0xaa8e('0x12')](_0xaa8e('0x1b'),_0x44659e,JSON[_0xaa8e('0x14')](_0x5ad46c));_0x438efc(_0x5ad46c);})['catch'](function(_0x405d44){logger[_0xaa8e('0x16')](_0xaa8e('0x1b'),_0x405d44[_0xaa8e('0x17')],_0x44659e);_0x47b0cb(_0x2a6dd7[_0xaa8e('0x16')](0x1f4,_0x405d44[_0xaa8e('0x17')]));});});}; \ No newline at end of file +var _0xb08f=['./whatsappAccount.socket','register','then','info','request\x20sent','debug','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','catch','find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost'];(function(_0x5aa73b,_0x51691d){var _0x4557e2=function(_0x3276af){while(--_0x3276af){_0x5aa73b['push'](_0x5aa73b['shift']());}};_0x4557e2(++_0x51691d);}(_0xb08f,0x125));var _0xfb08=function(_0x3d07f5,_0x2beeb5){_0x3d07f5=_0x3d07f5-0x0;var _0x289960=_0xb08f[_0x3d07f5];return _0x289960;};'use strict';var _=require('lodash');var util=require(_0xfb08('0x0'));var moment=require(_0xfb08('0x1'));var BPromise=require(_0xfb08('0x2'));var rs=require(_0xfb08('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb08('0x4'))['db'];var utils=require(_0xfb08('0x5'));var logger=require(_0xfb08('0x6'))(_0xfb08('0x7'));var config=require(_0xfb08('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfb08('0x9')]({'port':0x232a});config[_0xfb08('0xa')]=_[_0xfb08('0xb')](config[_0xfb08('0xa')],{'host':_0xfb08('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb08('0xa')]));require(_0xfb08('0xd'))[_0xfb08('0xe')](socket);function respondWithRpcPromise(_0x1edb02,_0x320e24,_0x46d6d8){return new BPromise(function(_0x39683b,_0x47a7c0){return client['request'](_0x1edb02,_0x46d6d8)[_0xfb08('0xf')](function(_0x4b2f26){logger[_0xfb08('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x320e24,_0xfb08('0x11'));logger[_0xfb08('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x320e24,_0xfb08('0x11'),JSON[_0xfb08('0x13')](_0x4b2f26));if(_0x4b2f26[_0xfb08('0x14')]){if(_0x4b2f26[_0xfb08('0x14')][_0xfb08('0x15')]===0x1f4){logger[_0xfb08('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x320e24,_0x4b2f26[_0xfb08('0x14')][_0xfb08('0x16')]);return _0x47a7c0(_0x4b2f26[_0xfb08('0x14')][_0xfb08('0x16')]);}logger[_0xfb08('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x320e24,_0x4b2f26['error'][_0xfb08('0x16')]);return _0x39683b(_0x4b2f26[_0xfb08('0x14')][_0xfb08('0x16')]);}else{logger['info'](_0xfb08('0x17'),_0x320e24,_0xfb08('0x11'));_0x39683b(_0x4b2f26['result'][_0xfb08('0x16')]);}})[_0xfb08('0x18')](function(_0x2ad482){logger['error'](_0xfb08('0x17'),_0x320e24,_0x2ad482);_0x47a7c0(_0x2ad482);});});}exports['ShowWhatsappAccount']=function(_0x1eaa04){var _0x393085=this;return new Promise(function(_0x20ba20,_0x1eeb29){return db['WhatsappAccount'][_0xfb08('0x19')]({'raw':_0x1eaa04[_0xfb08('0x1a')]?_0x1eaa04[_0xfb08('0x1a')][_0xfb08('0x1b')]===undefined?!![]:![]:!![],'where':_0x1eaa04[_0xfb08('0x1a')]?_0x1eaa04[_0xfb08('0x1a')][_0xfb08('0x1c')]||null:null,'attributes':_0x1eaa04[_0xfb08('0x1a')]?_0x1eaa04[_0xfb08('0x1a')][_0xfb08('0x1d')]||null:null,'include':_0x1eaa04[_0xfb08('0x1a')]?_0x1eaa04[_0xfb08('0x1a')][_0xfb08('0x1e')]?_[_0xfb08('0x1f')](_0x1eaa04[_0xfb08('0x1a')]['include'],function(_0x30f1ab){return{'model':db[_0x30f1ab[_0xfb08('0x20')]],'as':_0x30f1ab['as'],'attributes':_0x30f1ab[_0xfb08('0x1d')],'include':_0x30f1ab[_0xfb08('0x1e')]?_[_0xfb08('0x1f')](_0x30f1ab[_0xfb08('0x1e')],function(_0x3de4f4){return{'model':db[_0x3de4f4[_0xfb08('0x20')]],'as':_0x3de4f4['as'],'attributes':_0x3de4f4['attributes'],'include':_0x3de4f4[_0xfb08('0x1e')]?_['map'](_0x3de4f4[_0xfb08('0x1e')],function(_0x3517a5){return{'model':db[_0x3517a5[_0xfb08('0x20')]],'as':_0x3517a5['as'],'attributes':_0x3517a5[_0xfb08('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4aa26f){logger[_0xfb08('0x10')](_0xfb08('0x21'),_0x1eaa04);logger[_0xfb08('0x12')](_0xfb08('0x21'),_0x1eaa04,JSON['stringify'](_0x4aa26f));_0x20ba20(_0x4aa26f);})[_0xfb08('0x18')](function(_0x443fd2){logger['error'](_0xfb08('0x21'),_0x443fd2[_0xfb08('0x16')],_0x1eaa04);_0x1eeb29(_0x393085[_0xfb08('0x14')](0x1f4,_0x443fd2[_0xfb08('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 58ef6a2..9a27a02 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 _0x067d=['register','save','remove'];(function(_0x24431a,_0x52459a){var _0x454ec7=function(_0x34cd60){while(--_0x34cd60){_0x24431a['push'](_0x24431a['shift']());}};_0x454ec7(++_0x52459a);}(_0x067d,0xa0));var _0xd067=function(_0x7148b6,_0xa61534){_0x7148b6=_0x7148b6-0x0;var _0x111019=_0x067d[_0x7148b6];return _0x111019;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xd067('0x0'),_0xd067('0x1'),'update'];function createListener(_0x4fc5a8,_0x291558){return function(_0x35c798){_0x291558['emit'](_0x4fc5a8,_0x35c798);};}function removeListener(_0x31bae8,_0x54248b){return function(){WhatsappAccountEvents['removeListener'](_0x31bae8,_0x54248b);};}exports[_0xd067('0x2')]=function(_0x37c7f3){for(var _0x3dcdd4=0x0,_0x504650=events['length'];_0x3dcdd4<_0x504650;_0x3dcdd4++){var _0x13fa76=events[_0x3dcdd4];var _0x43b6eb=createListener('whatsappAccount:'+_0x13fa76,_0x37c7f3);WhatsappAccountEvents['on'](_0x13fa76,_0x43b6eb);}}; \ No newline at end of file +var _0xb2f3=['removeListener','register','length','whatsappAccount:','remove','emit'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0xb2f3,0x172));var _0x3b2f=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xb2f3[_0x346737];return _0x1ade2e;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0x3b2f('0x0'),'update'];function createListener(_0x130ab9,_0x47a937){return function(_0x162581){_0x47a937[_0x3b2f('0x1')](_0x130ab9,_0x162581);};}function removeListener(_0x500dbd,_0x538c1a){return function(){WhatsappAccountEvents[_0x3b2f('0x2')](_0x500dbd,_0x538c1a);};}exports[_0x3b2f('0x3')]=function(_0x2cdd76){for(var _0x21a057=0x0,_0x2859a7=events[_0x3b2f('0x4')];_0x21a057<_0x2859a7;_0x21a057++){var _0xef134e=events[_0x21a057];var _0x5a13f2=createListener(_0x3b2f('0x5')+_0xef134e,_0x2cdd76);WhatsappAccountEvents['on'](_0xef134e,_0x5a13f2);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index f2e763e..88f9ed0 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 _0x70fe=['isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','./whatsappApplication.controller','get'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0x70fe,0xc9));var _0xe70f=function(_0x31b963,_0x167b0a){_0x31b963=_0x31b963-0x0;var _0xf3efae=_0x70fe[_0x31b963];return _0xf3efae;};'use strict';var multer=require('multer');var util=require(_0xe70f('0x0'));var path=require(_0xe70f('0x1'));var timeout=require(_0xe70f('0x2'));var express=require('express');var router=express[_0xe70f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe70f('0x4'));var config=require('../../config/environment');var controller=require(_0xe70f('0x5'));router[_0xe70f('0x6')]('/',auth[_0xe70f('0x7')](),controller[_0xe70f('0x8')]);router[_0xe70f('0x6')](_0xe70f('0x9'),auth[_0xe70f('0x7')](),controller[_0xe70f('0xa')]);router['post']('/',auth[_0xe70f('0x7')](),controller['create']);router[_0xe70f('0xb')](_0xe70f('0x9'),auth['isAuthenticated'](),controller[_0xe70f('0xc')]);router[_0xe70f('0xd')](_0xe70f('0x9'),auth[_0xe70f('0x7')](),controller[_0xe70f('0xe')]);module[_0xe70f('0xf')]=router; \ No newline at end of file +var _0xc53b=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x4e9693,_0x588b62){var _0x583a6c=function(_0x4183b8){while(--_0x4183b8){_0x4e9693['push'](_0x4e9693['shift']());}};_0x583a6c(++_0x588b62);}(_0xc53b,0x198));var _0xbc53=function(_0x27c57a,_0x32259a){_0x27c57a=_0x27c57a-0x0;var _0x4aebf2=_0xc53b[_0x27c57a];return _0x4aebf2;};'use strict';var multer=require(_0xbc53('0x0'));var util=require(_0xbc53('0x1'));var path=require(_0xbc53('0x2'));var timeout=require(_0xbc53('0x3'));var express=require(_0xbc53('0x4'));var router=express[_0xbc53('0x5')]();var fs_extra=require(_0xbc53('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbc53('0x7'));var config=require(_0xbc53('0x8'));var controller=require(_0xbc53('0x9'));router[_0xbc53('0xa')]('/',auth[_0xbc53('0xb')](),controller[_0xbc53('0xc')]);router[_0xbc53('0xa')](_0xbc53('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xbc53('0xe')]('/',auth[_0xbc53('0xb')](),controller[_0xbc53('0xf')]);router['put'](_0xbc53('0xd'),auth[_0xbc53('0xb')](),controller[_0xbc53('0x10')]);router[_0xbc53('0x11')](_0xbc53('0xd'),auth[_0xbc53('0xb')](),controller[_0xbc53('0x12')]);module[_0xbc53('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 53a476c..a11e758 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 _0xfbab=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x543c2a,_0x11fd4c){var _0x26936c=function(_0x3b5a5c){while(--_0x3b5a5c){_0x543c2a['push'](_0x543c2a['shift']());}};_0x26936c(++_0x11fd4c);}(_0xfbab,0x150));var _0xbfba=function(_0x2d435a,_0x1dadf3){_0x2d435a=_0x2d435a-0x0;var _0x41d43a=_0xfbab[_0x2d435a];return _0x41d43a;};'use strict';var Sequelize=require(_0xbfba('0x0'));module[_0xbfba('0x1')]={'priority':{'type':Sequelize[_0xbfba('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbfba('0x3')],'allowNull':![],'defaultValue':_0xbfba('0x4')},'appdata':{'type':Sequelize[_0xbfba('0x5')]()},'description':{'type':Sequelize[_0xbfba('0x3')]},'interval':{'type':Sequelize[_0xbfba('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0cd1=['exports','STRING','*,*,*,*','sequelize'];(function(_0x2f504c,_0x554cb4){var _0x4c1702=function(_0xe0220a){while(--_0xe0220a){_0x2f504c['push'](_0x2f504c['shift']());}};_0x4c1702(++_0x554cb4);}(_0x0cd1,0x15b));var _0x10cd=function(_0x5ce075,_0x20b649){_0x5ce075=_0x5ce075-0x0;var _0x595e7d=_0x0cd1[_0x5ce075];return _0x595e7d;};'use strict';var Sequelize=require(_0x10cd('0x0'));module[_0x10cd('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x10cd('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x10cd('0x2')]},'interval':{'type':Sequelize[_0x10cd('0x2')],'defaultValue':_0x10cd('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 28ed1bc..39569f6 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 _0xf643=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappApplication','count','includeAll','include','findAll','rows','catch','params','intersection','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x3402c7,_0x3f7438){var _0x91ed90=function(_0x3783e6){while(--_0x3783e6){_0x3402c7['push'](_0x3402c7['shift']());}};_0x91ed90(++_0x3f7438);}(_0xf643,0x122));var _0x3f64=function(_0x44ae0b,_0x3e9865){_0x44ae0b=_0x44ae0b-0x0;var _0x69232a=_0xf643[_0x44ae0b];return _0x69232a;};'use strict';var emlformat=require(_0x3f64('0x0'));var rimraf=require(_0x3f64('0x1'));var zipdir=require(_0x3f64('0x2'));var jsonpatch=require(_0x3f64('0x3'));var rp=require('request-promise');var moment=require(_0x3f64('0x4'));var BPromise=require(_0x3f64('0x5'));var Mustache=require('mustache');var util=require(_0x3f64('0x6'));var path=require(_0x3f64('0x7'));var sox=require(_0x3f64('0x8'));var csv=require(_0x3f64('0x9'));var ejs=require(_0x3f64('0xa'));var fs=require('fs');var fs_extra=require(_0x3f64('0xb'));var _=require(_0x3f64('0xc'));var squel=require(_0x3f64('0xd'));var crypto=require(_0x3f64('0xe'));var jsforce=require(_0x3f64('0xf'));var deskjs=require(_0x3f64('0x10'));var toCsv=require(_0x3f64('0x9'));var querystring=require(_0x3f64('0x11'));var Papa=require(_0x3f64('0x12'));var Redis=require(_0x3f64('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3f64('0x14'));var as=require(_0x3f64('0x15'));var hardwareService=require(_0x3f64('0x16'));var logger=require('../../config/logger')(_0x3f64('0x17'));var utils=require(_0x3f64('0x18'));var config=require(_0x3f64('0x19'));var licenseUtil=require(_0x3f64('0x1a'));var db=require(_0x3f64('0x1b'))['db'];function respondWithStatusCode(_0x2d1039,_0x1eadf3){_0x1eadf3=_0x1eadf3||0xcc;return function(_0x55dd00){if(_0x55dd00){return _0x2d1039[_0x3f64('0x1c')](_0x1eadf3);}return _0x2d1039[_0x3f64('0x1d')](_0x1eadf3)[_0x3f64('0x1e')]();};}function respondWithResult(_0x3165b6,_0x505e9f){_0x505e9f=_0x505e9f||0xc8;return function(_0x84d3a9){if(_0x84d3a9){return _0x3165b6[_0x3f64('0x1d')](_0x505e9f)[_0x3f64('0x1f')](_0x84d3a9);}};}function respondWithFilteredResult(_0x1f215d,_0x52acab){return function(_0x1c4059){if(_0x1c4059){var _0x1c17bb=typeof _0x52acab[_0x3f64('0x20')]===_0x3f64('0x21')&&typeof _0x52acab[_0x3f64('0x22')]===_0x3f64('0x21');var _0x3d5196=_0x1c4059['count'];var _0xbcf1aa=_0x1c17bb?0x0:_0x52acab[_0x3f64('0x20')];var _0x2cdac6=_0x1c17bb?_0x1c4059['count']:_0x52acab[_0x3f64('0x20')]+_0x52acab['limit'];var _0x5177e2;if(_0x2cdac6>=_0x3d5196){_0x2cdac6=_0x3d5196;_0x5177e2=0xc8;}else{_0x5177e2=0xce;}_0x1f215d[_0x3f64('0x1d')](_0x5177e2);return _0x1f215d[_0x3f64('0x23')](_0x3f64('0x24'),_0xbcf1aa+'-'+_0x2cdac6+'/'+_0x3d5196)['json'](_0x1c4059);}return null;};}function patchUpdates(_0x40e9e8){return function(_0x301d72){try{jsonpatch[_0x3f64('0x25')](_0x301d72,_0x40e9e8,!![]);}catch(_0x5f5507){return BPromise[_0x3f64('0x26')](_0x5f5507);}return _0x301d72[_0x3f64('0x27')]();};}function saveUpdates(_0x4c725c,_0xc72655){return function(_0x3faf46){if(_0x3faf46){return _0x3faf46['update'](_0x4c725c)['then'](function(_0x5b1628){return _0x5b1628;});}return null;};}function removeEntity(_0x3f1bb2,_0x794db2){return function(_0x336b98){if(_0x336b98){return _0x336b98[_0x3f64('0x28')]()[_0x3f64('0x29')](function(){_0x3f1bb2['status'](0xcc)[_0x3f64('0x1e')]();});}};}function handleEntityNotFound(_0x4702a3,_0x151f1e){return function(_0x142fe5){if(!_0x142fe5){_0x4702a3[_0x3f64('0x1c')](0x194);}return _0x142fe5;};}function handleError(_0x26e152,_0x1f0f91){_0x1f0f91=_0x1f0f91||0x1f4;return function(_0x3499ff){logger['error'](_0x3499ff[_0x3f64('0x2a')]);if(_0x3499ff['name']){delete _0x3499ff[_0x3f64('0x2b')];}_0x26e152[_0x3f64('0x1d')](_0x1f0f91)[_0x3f64('0x2c')](_0x3499ff);};}exports[_0x3f64('0x2d')]=function(_0x191a2d,_0x307efc){var _0x286b2a={},_0x1bcefe={},_0x36b338={'count':0x0,'rows':[]};var _0x3c5bb2=_['map'](db['WhatsappApplication'][_0x3f64('0x2e')],function(_0x5a03a8){return{'name':_0x5a03a8[_0x3f64('0x2f')],'type':_0x5a03a8[_0x3f64('0x30')][_0x3f64('0x31')]};});_0x1bcefe[_0x3f64('0x32')]=_['map'](_0x3c5bb2,'name');_0x1bcefe[_0x3f64('0x33')]=_[_0x3f64('0x34')](_0x191a2d[_0x3f64('0x33')]);_0x1bcefe[_0x3f64('0x35')]=_['intersection'](_0x1bcefe[_0x3f64('0x32')],_0x1bcefe['query']);_0x286b2a['attributes']=_['intersection'](_0x1bcefe[_0x3f64('0x32')],qs['fields'](_0x191a2d[_0x3f64('0x33')]['fields']));_0x286b2a[_0x3f64('0x36')]=_0x286b2a[_0x3f64('0x36')][_0x3f64('0x37')]?_0x286b2a[_0x3f64('0x36')]:_0x1bcefe['model'];if(!_0x191a2d[_0x3f64('0x33')][_0x3f64('0x38')](_0x3f64('0x39'))){_0x286b2a['limit']=qs['limit'](_0x191a2d[_0x3f64('0x33')]['limit']);_0x286b2a[_0x3f64('0x20')]=qs[_0x3f64('0x20')](_0x191a2d[_0x3f64('0x33')]['offset']);}_0x286b2a[_0x3f64('0x3a')]=qs[_0x3f64('0x3b')](_0x191a2d[_0x3f64('0x33')][_0x3f64('0x3b')]);_0x286b2a[_0x3f64('0x3c')]=qs[_0x3f64('0x35')](_[_0x3f64('0x3d')](_0x191a2d[_0x3f64('0x33')],_0x1bcefe[_0x3f64('0x35')]),_0x3c5bb2);if(_0x191a2d[_0x3f64('0x33')][_0x3f64('0x3e')]){_0x286b2a[_0x3f64('0x3c')]=_[_0x3f64('0x3f')](_0x286b2a[_0x3f64('0x3c')],{'$or':_['map'](_0x3c5bb2,function(_0x195f0c){if(_0x195f0c[_0x3f64('0x30')]!==_0x3f64('0x40')){var _0x566e49={};_0x566e49[_0x195f0c[_0x3f64('0x2b')]]={'$like':'%'+_0x191a2d[_0x3f64('0x33')][_0x3f64('0x3e')]+'%'};return _0x566e49;}})});}_0x286b2a=_[_0x3f64('0x3f')]({},_0x286b2a,_0x191a2d[_0x3f64('0x41')]);var _0x16e3f8={'where':_0x286b2a['where']};return db[_0x3f64('0x42')]['count'](_0x16e3f8)[_0x3f64('0x29')](function(_0x2be6c1){_0x36b338[_0x3f64('0x43')]=_0x2be6c1;if(_0x191a2d['query'][_0x3f64('0x44')]){_0x286b2a[_0x3f64('0x45')]=[{'all':!![]}];}return db[_0x3f64('0x42')][_0x3f64('0x46')](_0x286b2a);})['then'](function(_0x70ba90){_0x36b338[_0x3f64('0x47')]=_0x70ba90;return _0x36b338;})[_0x3f64('0x29')](respondWithFilteredResult(_0x307efc,_0x286b2a))[_0x3f64('0x48')](handleError(_0x307efc,null));};exports['show']=function(_0x5c6a22,_0x38b32c){var _0x291f70={'raw':!![],'where':{'id':_0x5c6a22[_0x3f64('0x49')]['id']}},_0x4f3ddd={};_0x4f3ddd[_0x3f64('0x32')]=_[_0x3f64('0x34')](db['WhatsappApplication'][_0x3f64('0x2e')]);_0x4f3ddd[_0x3f64('0x33')]=_['keys'](_0x5c6a22[_0x3f64('0x33')]);_0x4f3ddd[_0x3f64('0x35')]=_[_0x3f64('0x4a')](_0x4f3ddd[_0x3f64('0x32')],_0x4f3ddd[_0x3f64('0x33')]);_0x291f70[_0x3f64('0x36')]=_[_0x3f64('0x4a')](_0x4f3ddd[_0x3f64('0x32')],qs[_0x3f64('0x4b')](_0x5c6a22[_0x3f64('0x33')][_0x3f64('0x4b')]));_0x291f70[_0x3f64('0x36')]=_0x291f70[_0x3f64('0x36')]['length']?_0x291f70['attributes']:_0x4f3ddd[_0x3f64('0x32')];if(_0x5c6a22[_0x3f64('0x33')][_0x3f64('0x44')]){_0x291f70[_0x3f64('0x45')]=[{'all':!![]}];}_0x291f70=_['merge']({},_0x291f70,_0x5c6a22[_0x3f64('0x41')]);return db[_0x3f64('0x42')][_0x3f64('0x4c')](_0x291f70)[_0x3f64('0x29')](handleEntityNotFound(_0x38b32c,null))[_0x3f64('0x29')](respondWithResult(_0x38b32c,null))[_0x3f64('0x48')](handleError(_0x38b32c,null));};exports[_0x3f64('0x4d')]=function(_0xf0878a,_0x137f48){return db['WhatsappApplication'][_0x3f64('0x4d')](_0xf0878a[_0x3f64('0x4e')],{})[_0x3f64('0x29')](respondWithResult(_0x137f48,0xc9))[_0x3f64('0x48')](handleError(_0x137f48,null));};exports['update']=function(_0x397256,_0x15c946){if(_0x397256['body']['id']){delete _0x397256[_0x3f64('0x4e')]['id'];}return db[_0x3f64('0x42')][_0x3f64('0x4c')]({'where':{'id':_0x397256[_0x3f64('0x49')]['id']}})[_0x3f64('0x29')](handleEntityNotFound(_0x15c946,null))['then'](saveUpdates(_0x397256['body'],null))[_0x3f64('0x29')](respondWithResult(_0x15c946,null))['catch'](handleError(_0x15c946,null));};exports[_0x3f64('0x28')]=function(_0x2aa325,_0x1aa2fd){return db['WhatsappApplication'][_0x3f64('0x4c')]({'where':{'id':_0x2aa325[_0x3f64('0x49')]['id']}})[_0x3f64('0x29')](handleEntityNotFound(_0x1aa2fd,null))[_0x3f64('0x29')](removeEntity(_0x1aa2fd,null))['catch'](handleError(_0x1aa2fd,null));}; \ No newline at end of file +var _0xc14a=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','WhatsappApplication','findAll','rows','show','params','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','then','destroy','error','stack','name','rawAttributes','fieldName','type','key','map','query','keys','filters','model'];(function(_0x4f12d3,_0x3d458f){var _0x4ab505=function(_0x3033da){while(--_0x3033da){_0x4f12d3['push'](_0x4f12d3['shift']());}};_0x4ab505(++_0x3d458f);}(_0xc14a,0xa9));var _0xac14=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xc14a[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xac14('0x0'));var rimraf=require(_0xac14('0x1'));var zipdir=require(_0xac14('0x2'));var jsonpatch=require(_0xac14('0x3'));var rp=require(_0xac14('0x4'));var moment=require('moment');var BPromise=require(_0xac14('0x5'));var Mustache=require(_0xac14('0x6'));var util=require('util');var path=require(_0xac14('0x7'));var sox=require('sox');var csv=require(_0xac14('0x8'));var ejs=require(_0xac14('0x9'));var fs=require('fs');var fs_extra=require(_0xac14('0xa'));var _=require('lodash');var squel=require(_0xac14('0xb'));var crypto=require(_0xac14('0xc'));var jsforce=require(_0xac14('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xac14('0x8'));var querystring=require(_0xac14('0xe'));var Papa=require(_0xac14('0xf'));var Redis=require(_0xac14('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xac14('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac14('0x12'));var logger=require(_0xac14('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xac14('0x14'));var licenseUtil=require(_0xac14('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11d522,_0x394952){_0x394952=_0x394952||0xcc;return function(_0x5920f7){if(_0x5920f7){return _0x11d522[_0xac14('0x16')](_0x394952);}return _0x11d522['status'](_0x394952)[_0xac14('0x17')]();};}function respondWithResult(_0x3a171d,_0x44e80d){_0x44e80d=_0x44e80d||0xc8;return function(_0x5a80ed){if(_0x5a80ed){return _0x3a171d['status'](_0x44e80d)[_0xac14('0x18')](_0x5a80ed);}};}function respondWithFilteredResult(_0x5c00df,_0xe50537){return function(_0x497be2){if(_0x497be2){var _0x270284=typeof _0xe50537[_0xac14('0x19')]===_0xac14('0x1a')&&typeof _0xe50537[_0xac14('0x1b')]===_0xac14('0x1a');var _0x4d7f22=_0x497be2[_0xac14('0x1c')];var _0x219ee6=_0x270284?0x0:_0xe50537[_0xac14('0x19')];var _0x1682b1=_0x270284?_0x497be2[_0xac14('0x1c')]:_0xe50537[_0xac14('0x19')]+_0xe50537[_0xac14('0x1b')];var _0x572d08;if(_0x1682b1>=_0x4d7f22){_0x1682b1=_0x4d7f22;_0x572d08=0xc8;}else{_0x572d08=0xce;}_0x5c00df[_0xac14('0x1d')](_0x572d08);return _0x5c00df[_0xac14('0x1e')](_0xac14('0x1f'),_0x219ee6+'-'+_0x1682b1+'/'+_0x4d7f22)[_0xac14('0x18')](_0x497be2);}return null;};}function patchUpdates(_0x14b2a0){return function(_0x52d9d2){try{jsonpatch['apply'](_0x52d9d2,_0x14b2a0,!![]);}catch(_0x1cbb67){return BPromise[_0xac14('0x20')](_0x1cbb67);}return _0x52d9d2['save']();};}function saveUpdates(_0x44a533,_0x492f37){return function(_0x528406){if(_0x528406){return _0x528406['update'](_0x44a533)[_0xac14('0x21')](function(_0x4c6580){return _0x4c6580;});}return null;};}function removeEntity(_0x1b863e,_0x8e5979){return function(_0x272b46){if(_0x272b46){return _0x272b46[_0xac14('0x22')]()['then'](function(){_0x1b863e[_0xac14('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x186a10,_0xa2c069){return function(_0x536eb3){if(!_0x536eb3){_0x186a10[_0xac14('0x16')](0x194);}return _0x536eb3;};}function handleError(_0x34f641,_0x3d2eeb){_0x3d2eeb=_0x3d2eeb||0x1f4;return function(_0x1c581b){logger[_0xac14('0x23')](_0x1c581b[_0xac14('0x24')]);if(_0x1c581b['name']){delete _0x1c581b[_0xac14('0x25')];}_0x34f641['status'](_0x3d2eeb)['send'](_0x1c581b);};}exports['index']=function(_0x23a5b3,_0x25b07e){var _0x2f6914={},_0x53584e={},_0x4b72e0={'count':0x0,'rows':[]};var _0x506837=_['map'](db['WhatsappApplication'][_0xac14('0x26')],function(_0x568024){return{'name':_0x568024[_0xac14('0x27')],'type':_0x568024[_0xac14('0x28')][_0xac14('0x29')]};});_0x53584e['model']=_[_0xac14('0x2a')](_0x506837,'name');_0x53584e[_0xac14('0x2b')]=_[_0xac14('0x2c')](_0x23a5b3[_0xac14('0x2b')]);_0x53584e[_0xac14('0x2d')]=_['intersection'](_0x53584e[_0xac14('0x2e')],_0x53584e[_0xac14('0x2b')]);_0x2f6914[_0xac14('0x2f')]=_[_0xac14('0x30')](_0x53584e[_0xac14('0x2e')],qs[_0xac14('0x31')](_0x23a5b3['query']['fields']));_0x2f6914['attributes']=_0x2f6914[_0xac14('0x2f')][_0xac14('0x32')]?_0x2f6914[_0xac14('0x2f')]:_0x53584e[_0xac14('0x2e')];if(!_0x23a5b3['query'][_0xac14('0x33')](_0xac14('0x34'))){_0x2f6914[_0xac14('0x1b')]=qs['limit'](_0x23a5b3[_0xac14('0x2b')][_0xac14('0x1b')]);_0x2f6914['offset']=qs['offset'](_0x23a5b3['query'][_0xac14('0x19')]);}_0x2f6914[_0xac14('0x35')]=qs[_0xac14('0x36')](_0x23a5b3[_0xac14('0x2b')][_0xac14('0x36')]);_0x2f6914[_0xac14('0x37')]=qs[_0xac14('0x2d')](_[_0xac14('0x38')](_0x23a5b3['query'],_0x53584e[_0xac14('0x2d')]),_0x506837);if(_0x23a5b3[_0xac14('0x2b')]['filter']){_0x2f6914[_0xac14('0x37')]=_[_0xac14('0x39')](_0x2f6914[_0xac14('0x37')],{'$or':_[_0xac14('0x2a')](_0x506837,function(_0x561a70){if(_0x561a70[_0xac14('0x28')]!==_0xac14('0x3a')){var _0x296644={};_0x296644[_0x561a70[_0xac14('0x25')]]={'$like':'%'+_0x23a5b3[_0xac14('0x2b')]['filter']+'%'};return _0x296644;}})});}_0x2f6914=_[_0xac14('0x39')]({},_0x2f6914,_0x23a5b3[_0xac14('0x3b')]);var _0x116a5a={'where':_0x2f6914[_0xac14('0x37')]};return db['WhatsappApplication'][_0xac14('0x1c')](_0x116a5a)['then'](function(_0x35f359){_0x4b72e0[_0xac14('0x1c')]=_0x35f359;if(_0x23a5b3[_0xac14('0x2b')][_0xac14('0x3c')]){_0x2f6914[_0xac14('0x3d')]=[{'all':!![]}];}return db[_0xac14('0x3e')][_0xac14('0x3f')](_0x2f6914);})['then'](function(_0x375712){_0x4b72e0[_0xac14('0x40')]=_0x375712;return _0x4b72e0;})[_0xac14('0x21')](respondWithFilteredResult(_0x25b07e,_0x2f6914))['catch'](handleError(_0x25b07e,null));};exports[_0xac14('0x41')]=function(_0x46b7ea,_0x515b58){var _0x160621={'raw':!![],'where':{'id':_0x46b7ea[_0xac14('0x42')]['id']}},_0x34932e={};_0x34932e[_0xac14('0x2e')]=_['keys'](db[_0xac14('0x3e')][_0xac14('0x26')]);_0x34932e[_0xac14('0x2b')]=_[_0xac14('0x2c')](_0x46b7ea['query']);_0x34932e['filters']=_[_0xac14('0x30')](_0x34932e[_0xac14('0x2e')],_0x34932e[_0xac14('0x2b')]);_0x160621[_0xac14('0x2f')]=_[_0xac14('0x30')](_0x34932e['model'],qs[_0xac14('0x31')](_0x46b7ea[_0xac14('0x2b')]['fields']));_0x160621[_0xac14('0x2f')]=_0x160621[_0xac14('0x2f')]['length']?_0x160621[_0xac14('0x2f')]:_0x34932e['model'];if(_0x46b7ea[_0xac14('0x2b')][_0xac14('0x3c')]){_0x160621[_0xac14('0x3d')]=[{'all':!![]}];}_0x160621=_[_0xac14('0x39')]({},_0x160621,_0x46b7ea[_0xac14('0x3b')]);return db[_0xac14('0x3e')][_0xac14('0x43')](_0x160621)[_0xac14('0x21')](handleEntityNotFound(_0x515b58,null))[_0xac14('0x21')](respondWithResult(_0x515b58,null))[_0xac14('0x44')](handleError(_0x515b58,null));};exports[_0xac14('0x45')]=function(_0x43d34e,_0x1ba97c){return db['WhatsappApplication'][_0xac14('0x45')](_0x43d34e[_0xac14('0x46')],{})[_0xac14('0x21')](respondWithResult(_0x1ba97c,0xc9))[_0xac14('0x44')](handleError(_0x1ba97c,null));};exports[_0xac14('0x47')]=function(_0x19b9a2,_0x24764b){if(_0x19b9a2[_0xac14('0x46')]['id']){delete _0x19b9a2[_0xac14('0x46')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x19b9a2[_0xac14('0x42')]['id']}})[_0xac14('0x21')](handleEntityNotFound(_0x24764b,null))[_0xac14('0x21')](saveUpdates(_0x19b9a2['body'],null))[_0xac14('0x21')](respondWithResult(_0x24764b,null))[_0xac14('0x44')](handleError(_0x24764b,null));};exports[_0xac14('0x22')]=function(_0x5d817a,_0x33b158){return db[_0xac14('0x3e')]['find']({'where':{'id':_0x5d817a[_0xac14('0x42')]['id']}})[_0xac14('0x21')](handleEntityNotFound(_0x33b158,null))[_0xac14('0x21')](removeEntity(_0x33b158,null))['catch'](handleError(_0x33b158,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index e06252d..a7aa328 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 _0x9224=['api','moment','bluebird','request-promise','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','util','../../config/logger'];(function(_0x5bccbf,_0x547e42){var _0x2158c6=function(_0x40f28a){while(--_0x40f28a){_0x5bccbf['push'](_0x5bccbf['shift']());}};_0x2158c6(++_0x547e42);}(_0x9224,0xa3));var _0x4922=function(_0x3fbd0e,_0x16e99d){_0x3fbd0e=_0x3fbd0e-0x0;var _0x2d2197=_0x9224[_0x3fbd0e];return _0x2d2197;};'use strict';var _=require('lodash');var util=require(_0x4922('0x0'));var logger=require(_0x4922('0x1'))(_0x4922('0x2'));var moment=require(_0x4922('0x3'));var BPromise=require(_0x4922('0x4'));var rp=require(_0x4922('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4922('0x6'));module['exports']=function(_0x12601a,_0x1b7fc7){return _0x12601a[_0x4922('0x7')](_0x4922('0x8'),attributes,{'tableName':_0x4922('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4922('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x294b=['exports','define','whatsapp_applications','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappApplication.attributes'];(function(_0x6cd39e,_0x4c4df1){var _0x60b43d=function(_0x2fb782){while(--_0x2fb782){_0x6cd39e['push'](_0x6cd39e['shift']());}};_0x60b43d(++_0x4c4df1);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb294('0x0'));var util=require('util');var logger=require(_0xb294('0x1'))(_0xb294('0x2'));var moment=require(_0xb294('0x3'));var BPromise=require(_0xb294('0x4'));var rp=require(_0xb294('0x5'));var fs=require('fs');var path=require(_0xb294('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb294('0x7'));module[_0xb294('0x8')]=function(_0xaa6a67,_0x181f5e){return _0xaa6a67[_0xb294('0x9')]('WhatsappApplication',attributes,{'tableName':_0xb294('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 1b6cb0e..17b8d63 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 _0x4bc3=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x12110a,_0xad3487){var _0x5c11d5=function(_0x534b09){while(--_0x534b09){_0x12110a['push'](_0x12110a['shift']());}};_0x5c11d5(++_0xad3487);}(_0x4bc3,0x16e));var _0x34bc=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x4bc3[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21451b,_0x50320d,_0x502087){return new BPromise(function(_0x18a01c,_0x474108){return client[_0x34bc('0xb')](_0x21451b,_0x502087)[_0x34bc('0xc')](function(_0x409105){logger[_0x34bc('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x50320d,'request\x20sent');logger[_0x34bc('0xe')](_0x34bc('0xf'),_0x50320d,_0x34bc('0x10'),JSON['stringify'](_0x409105));if(_0x409105[_0x34bc('0x11')]){if(_0x409105['error'][_0x34bc('0x12')]===0x1f4){logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error'][_0x34bc('0x14')]);return _0x474108(_0x409105['error'][_0x34bc('0x14')]);}logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error']['message']);return _0x18a01c(_0x409105[_0x34bc('0x11')]['message']);}else{logger[_0x34bc('0xd')](_0x34bc('0x13'),_0x50320d,_0x34bc('0x10'));_0x18a01c(_0x409105[_0x34bc('0x15')][_0x34bc('0x14')]);}})[_0x34bc('0x16')](function(_0x5e132d){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x50320d,_0x5e132d);_0x474108(_0x5e132d);});});} \ No newline at end of file +var _0x7bae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x7bae[_0x5416db];return _0x243e35;};'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});function respondWithRpcPromise(_0x3c5e59,_0x10b307,_0x34fb18){return new BPromise(function(_0x160565,_0x27b1d5){return client[_0xe7ba('0xa')](_0x3c5e59,_0x34fb18)[_0xe7ba('0xb')](function(_0x588f08){logger[_0xe7ba('0xc')](_0xe7ba('0xd'),_0x10b307,_0xe7ba('0xe'));logger[_0xe7ba('0xf')](_0xe7ba('0x10'),_0x10b307,_0xe7ba('0xe'),JSON[_0xe7ba('0x11')](_0x588f08));if(_0x588f08[_0xe7ba('0x12')]){if(_0x588f08[_0xe7ba('0x12')]['code']===0x1f4){logger[_0xe7ba('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);return _0x27b1d5(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}logger[_0xe7ba('0x12')](_0xe7ba('0xd'),_0x10b307,_0x588f08['error']['message']);return _0x160565(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}else{logger[_0xe7ba('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0xe7ba('0xe'));_0x160565(_0x588f08['result']['message']);}})['catch'](function(_0x393f75){logger['error'](_0xe7ba('0xd'),_0x10b307,_0x393f75);_0x27b1d5(_0x393f75);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 47a46fc..0582694 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 _0x7217=['/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','whatsappinteraction:addtags','addTags','whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5ca32e,_0x465e85){var _0x3dc5c8=function(_0x3296de){while(--_0x3296de){_0x5ca32e['push'](_0x5ca32e['shift']());}};_0x3dc5c8(++_0x465e85);}(_0x7217,0x19e));var _0x7721=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x7217[_0x220dbb];return _0x2b77de;};'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('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x13')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0x14')]);router['post'](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addMessage']);router[_0x7721('0x13')](_0x7721('0x15'),auth[_0x7721('0x9')](),interaction[_0x7721('0x16')]('whatsapp',_0x7721('0x17')),controller[_0x7721('0x18')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x7721('0x16')](_0x7721('0x19'),_0x7721('0x1a')),controller[_0x7721('0x1b')]);router['delete'](_0x7721('0xd'),auth['isAuthenticated'](),interaction[_0x7721('0x16')]('whatsapp',_0x7721('0x1c')),controller[_0x7721('0x1d')]);router[_0x7721('0x1e')](_0x7721('0x15'),auth[_0x7721('0x9')](),controller[_0x7721('0x1f')]);module[_0x7721('0x20')]=router; \ No newline at end of file +var _0x723e=['../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2976cc,_0x1c47bc){var _0x4f3635=function(_0x36e656){while(--_0x36e656){_0x2976cc['push'](_0x2976cc['shift']());}};_0x4f3635(++_0x1c47bc);}(_0x723e,0x179));var _0xe723=function(_0x3c8084,_0x34ca9d){_0x3c8084=_0x3c8084-0x0;var _0x1778b0=_0x723e[_0x3c8084];return _0x1778b0;};'use strict';var multer=require('multer');var util=require(_0xe723('0x0'));var path=require(_0xe723('0x1'));var timeout=require(_0xe723('0x2'));var express=require(_0xe723('0x3'));var router=express[_0xe723('0x4')]();var fs_extra=require(_0xe723('0x5'));var auth=require(_0xe723('0x6'));var interaction=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var controller=require(_0xe723('0x9'));router['get']('/',auth[_0xe723('0xa')](),controller[_0xe723('0xb')]);router[_0xe723('0xc')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller[_0xe723('0xe')]);router[_0xe723('0xc')](_0xe723('0xf'),auth['isAuthenticated'](),controller[_0xe723('0x10')]);router[_0xe723('0xc')](_0xe723('0x11'),auth['isAuthenticated'](),controller[_0xe723('0x12')]);router[_0xe723('0xc')](_0xe723('0x13'),auth['isAuthenticated'](),controller[_0xe723('0x14')]);router[_0xe723('0x15')]('/',auth[_0xe723('0xa')](),controller[_0xe723('0x16')]);router[_0xe723('0x15')]('/:id/messages',auth[_0xe723('0xa')](),controller['addMessage']);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0xe723('0x17')](_0xe723('0x18'),_0xe723('0x19')),controller[_0xe723('0x1a')]);router[_0xe723('0x1b')]('/:id',auth[_0xe723('0xa')](),interaction[_0xe723('0x17')](_0xe723('0x18'),_0xe723('0x1c')),controller[_0xe723('0x1d')]);router[_0xe723('0x1e')](_0xe723('0xf'),auth[_0xe723('0xa')](),interaction[_0xe723('0x17')](_0xe723('0x18'),_0xe723('0x1f')),controller[_0xe723('0x20')]);router[_0xe723('0x1e')](_0xe723('0x21'),auth['isAuthenticated'](),controller['removeTags']);module[_0xe723('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 3f0ae43..86e4526 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 _0xb182=['ENUM','out','moment','exports','BOOLEAN','STRING','DATE'];(function(_0x25334b,_0x229b30){var _0x41a749=function(_0x5529ee){while(--_0x5529ee){_0x25334b['push'](_0x25334b['shift']());}};_0x41a749(++_0x229b30);}(_0xb182,0x121));var _0x2b18=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0xb182[_0x2ef8f1];return _0x17498d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2b18('0x0'));module[_0x2b18('0x1')]={'closed':{'type':Sequelize[_0x2b18('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2b18('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2b18('0x3')]},'note':{'type':Sequelize[_0x2b18('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2b18('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2b18('0x5')]('in',_0x2b18('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2b18('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x2b18('0x5')]('in',_0x2b18('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2b18('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x5075=['DATE','STRING','ENUM','sequelize','moment','exports','BOOLEAN'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5075,0x73));var _0x5507=function(_0x2bfe52,_0x43946e){_0x2bfe52=_0x2bfe52-0x0;var _0x1cf649=_0x5075[_0x2bfe52];return _0x1cf649;};'use strict';var Sequelize=require(_0x5507('0x0'));var moment=require(_0x5507('0x1'));module[_0x5507('0x2')]={'closed':{'type':Sequelize[_0x5507('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5507('0x4')]},'disposition':{'type':Sequelize[_0x5507('0x5')]},'secondDisposition':{'type':Sequelize[_0x5507('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5507('0x5')]},'phone':{'type':Sequelize[_0x5507('0x5')]},'read1stAt':{'type':Sequelize[_0x5507('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5507('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x5507('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5507('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 265e02c..19dbdc2 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 _0xdb4b=['../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','Tags','TagIds','split','forEach','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','select','color','tools_tags','u.id','field','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','contactName','DESC','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','user','getWhatsappAccounts','agent','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','include','options','create','addMessage','WhatsappMessage','ids','getMessages','findOne','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','setTags','omit','spread','Tag','whatsappInteractionTags:save','removeTags','download','root','server','files','attachments','join','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','format','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x26166b,_0x1d2fb6){_0x26166b=_0x26166b-0x0;var _0x470ac3=_0xdb4b[_0x26166b];return _0x470ac3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbdb4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbdb4('0x1'));var rp=require(_0xbdb4('0x2'));var moment=require(_0xbdb4('0x3'));var BPromise=require(_0xbdb4('0x4'));var Mustache=require('mustache');var util=require(_0xbdb4('0x5'));var path=require(_0xbdb4('0x6'));var sox=require(_0xbdb4('0x7'));var csv=require(_0xbdb4('0x8'));var ejs=require(_0xbdb4('0x9'));var fs=require('fs');var fs_extra=require(_0xbdb4('0xa'));var _=require(_0xbdb4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbdb4('0xc'));var deskjs=require(_0xbdb4('0xd'));var toCsv=require(_0xbdb4('0x8'));var querystring=require(_0xbdb4('0xe'));var Papa=require('papaparse');var Redis=require(_0xbdb4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbdb4('0x10'));var as=require(_0xbdb4('0x11'));var pdf=require(_0xbdb4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbdb4('0x13'));var utils=require(_0xbdb4('0x14'));var config=require(_0xbdb4('0x15'));var licenseUtil=require(_0xbdb4('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xbdb4('0x17')](config[_0xbdb4('0x18')],{'host':_0xbdb4('0x19'),'port':0x18eb});var socket=require(_0xbdb4('0x1a'))(new Redis(config[_0xbdb4('0x18')]));require(_0xbdb4('0x1b'))['register'](socket);function respondWithStatusCode(_0x4a49ad,_0x2e953a){_0x2e953a=_0x2e953a||0xcc;return function(_0x4386e1){if(_0x4386e1){return _0x4a49ad['sendStatus'](_0x2e953a);}return _0x4a49ad[_0xbdb4('0x1c')](_0x2e953a)[_0xbdb4('0x1d')]();};}function respondWithResult(_0x554c91,_0x5984a9){_0x5984a9=_0x5984a9||0xc8;return function(_0x3b7c35){if(_0x3b7c35){return _0x554c91[_0xbdb4('0x1c')](_0x5984a9)['json'](_0x3b7c35);}};}function respondWithFilteredResult(_0x4538cc,_0x113471){return function(_0x4a180b){if(_0x4a180b){var _0x2ca1d5=typeof _0x113471[_0xbdb4('0x1e')]===_0xbdb4('0x1f')&&typeof _0x113471['limit']==='undefined';var _0x995070=_0x4a180b[_0xbdb4('0x20')];var _0x484d03=_0x2ca1d5?0x0:_0x113471[_0xbdb4('0x1e')];var _0x2d72d9=_0x2ca1d5?_0x4a180b[_0xbdb4('0x20')]:_0x113471['offset']+_0x113471[_0xbdb4('0x21')];var _0x57e33b;if(_0x2d72d9>=_0x995070){_0x2d72d9=_0x995070;_0x57e33b=0xc8;}else{_0x57e33b=0xce;}_0x4538cc[_0xbdb4('0x1c')](_0x57e33b);return _0x4538cc[_0xbdb4('0x22')](_0xbdb4('0x23'),_0x484d03+'-'+_0x2d72d9+'/'+_0x995070)[_0xbdb4('0x24')](_0x4a180b);}return null;};}function patchUpdates(_0x2eab45){return function(_0x250ade){try{jsonpatch['apply'](_0x250ade,_0x2eab45,!![]);}catch(_0x3db8aa){return BPromise[_0xbdb4('0x25')](_0x3db8aa);}return _0x250ade[_0xbdb4('0x26')]();};}function saveUpdates(_0x18bec7,_0x6ac75a){return function(_0x5efe9d){if(_0x5efe9d){return _0x5efe9d[_0xbdb4('0x27')](_0x18bec7)[_0xbdb4('0x28')](function(_0x3d440a){return _0x3d440a;});}return null;};}function removeEntity(_0x5b46a1,_0x59b289){return function(_0x1ab9b1){if(_0x1ab9b1){return _0x1ab9b1[_0xbdb4('0x29')]()[_0xbdb4('0x28')](function(){_0x5b46a1[_0xbdb4('0x1c')](0xcc)[_0xbdb4('0x1d')]();});}};}function handleEntityNotFound(_0x325f6a,_0x401be4){return function(_0x414f4f){if(!_0x414f4f){_0x325f6a[_0xbdb4('0x2a')](0x194);}return _0x414f4f;};}function handleError(_0x2be4ee,_0x52ebf5){_0x52ebf5=_0x52ebf5||0x1f4;return function(_0x81ec7d){logger[_0xbdb4('0x2b')](_0x81ec7d[_0xbdb4('0x2c')]);if(_0x81ec7d[_0xbdb4('0x2d')]){delete _0x81ec7d[_0xbdb4('0x2d')];}_0x2be4ee['status'](_0x52ebf5)[_0xbdb4('0x2e')](_0x81ec7d);};}function getInteractionUsers(_0x3898d6,_0x1b938c){return new BPromise(function(_0x464fe2,_0x1ca755){try{if(_0x1b938c[_0x3898d6['id']]){_0x3898d6[_0xbdb4('0x2f')]=_[_0xbdb4('0x30')](_0x1b938c[_0x3898d6['id']],function(_0x3548d1){return{'id':_0x3548d1['id'],'fullname':_0x3548d1['fullname']};});}}catch(_0x12075e){_0x1ca755(_0x12075e);}_0x464fe2(_0x3898d6);});}function getInteractionTags(_0x475cd9,_0x47d37d){return new BPromise(function(_0x4fc3f0,_0x2e0b6f){try{if(_0x475cd9['TagIds']){_0x475cd9[_0xbdb4('0x31')]=[];_0x475cd9[_0xbdb4('0x32')][_0xbdb4('0x33')](',')[_0xbdb4('0x34')](function(_0x543923){_0x475cd9[_0xbdb4('0x31')][_0xbdb4('0x35')](_0x47d37d[_0x543923]);});}delete _0x475cd9[_0xbdb4('0x32')];}catch(_0x164bc9){_0x2e0b6f(_0x164bc9);}_0x4fc3f0(_0x475cd9);});}function updateWhatsappInteraction(_0x1cbd44,_0x23e1df,_0x445376){return new BPromise(function(_0x439935,_0x17a9e7){return getInteractionUsers(_0x1cbd44,_0x445376)[_0xbdb4('0x28')](function(_0x38a1d2){return getInteractionTags(_0x38a1d2,_0x23e1df);})[_0xbdb4('0x28')](function(_0x4e15e1){_0x439935(_0x4e15e1);})[_0xbdb4('0x36')](function(_0x2331fc){_0x17a9e7(_0x2331fc);});});}exports[_0xbdb4('0x37')]=function(_0x38a77d,_0x48e3ea){var _0x35ca64={},_0xe25e14={},_0x410f96={'count':0x0,'rows':[]};var _0x2056a5=_[_0xbdb4('0x30')](db[_0xbdb4('0x38')][_0xbdb4('0x39')],function(_0x277f7d){return{'name':_0x277f7d[_0xbdb4('0x3a')],'type':_0x277f7d[_0xbdb4('0x3b')]['key']};});_0xe25e14[_0xbdb4('0x3c')]=_[_0xbdb4('0x30')](_0x2056a5,_0xbdb4('0x2d'));_0xe25e14['query']=_[_0xbdb4('0x3d')](_0x38a77d[_0xbdb4('0x3e')]);_0xe25e14[_0xbdb4('0x3f')]=_[_0xbdb4('0x40')](_0xe25e14['model'],_0xe25e14[_0xbdb4('0x3e')]);_0x35ca64['attributes']=_['intersection'](_0xe25e14[_0xbdb4('0x3c')],qs[_0xbdb4('0x41')](_0x38a77d['query'][_0xbdb4('0x41')]));_0x35ca64[_0xbdb4('0x42')]=_0x35ca64[_0xbdb4('0x42')][_0xbdb4('0x43')]?_0x35ca64[_0xbdb4('0x42')]:_0xe25e14[_0xbdb4('0x3c')];if(!_0x38a77d['query'][_0xbdb4('0x44')]('nolimit')){_0x35ca64['limit']=qs[_0xbdb4('0x21')](_0x38a77d[_0xbdb4('0x3e')][_0xbdb4('0x21')]);_0x35ca64[_0xbdb4('0x1e')]=qs[_0xbdb4('0x1e')](_0x38a77d[_0xbdb4('0x3e')][_0xbdb4('0x1e')]);}_0x35ca64[_0xbdb4('0x45')]=qs[_0xbdb4('0x46')](_0x38a77d[_0xbdb4('0x3e')][_0xbdb4('0x46')]);_0x35ca64[_0xbdb4('0x47')]=qs[_0xbdb4('0x3f')](_[_0xbdb4('0x48')](_0x38a77d[_0xbdb4('0x3e')],_0xe25e14['filters']),_0x2056a5);var _0x39b934=[];var _0x5ef6b3=squel[_0xbdb4('0x49')]()['field']('id')['field']('name')['field'](_0xbdb4('0x4a'))['from'](_0xbdb4('0x4b'));var _0xf0ead8=squel[_0xbdb4('0x49')]()['field'](_0xbdb4('0x4c'))[_0xbdb4('0x4d')](_0xbdb4('0x4e'))[_0xbdb4('0x4d')](_0xbdb4('0x4f'))[_0xbdb4('0x50')](_0xbdb4('0x51'),'ui')[_0xbdb4('0x52')]('users','u',_0xbdb4('0x53'));var _0x2f074e=squel[_0xbdb4('0x49')]()[_0xbdb4('0x50')]('whatsapp_interactions','i')[_0xbdb4('0x52')](_0xbdb4('0x54'),'c',_0xbdb4('0x55'))[_0xbdb4('0x52')](_0xbdb4('0x56'),'o','o.id\x20=\x20i.UserId')[_0xbdb4('0x52')](_0xbdb4('0x57'),'a','a.id\x20=\x20i.WhatsappAccountId')['left_join'](_0xbdb4('0x58'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0xbdb4('0x59'),'it',_0xbdb4('0x5a'))[_0xbdb4('0x52')](_0xbdb4('0x4b'),'t',_0xbdb4('0x5b'));var _0x448e09=squel[_0xbdb4('0x5c')]();var _0x436233=[];var _0x2eb86d=squel[_0xbdb4('0x5c')]();var _0xa1b553;if(_0x38a77d[_0xbdb4('0x3e')][_0xbdb4('0x5d')]){_0xa1b553=as['parseSearch'](_0x38a77d[_0xbdb4('0x3e')]['search']);var _0xce917e=_0xa1b553[_0xbdb4('0x5e')];for(var _0x165e82=0x0;_0x165e82<_0xa1b553[_0xbdb4('0x5f')][_0xbdb4('0x43')];_0x165e82++){var _0x267b8b=_0xa1b553['conditions'][_0x165e82];var _0x4e85bd='i';var _0x26d079=_[_0xbdb4('0x60')](_0x2056a5,[_0xbdb4('0x2d'),_0x267b8b[_0xbdb4('0x4d')]]);if(!_0x26d079){switch(_0x267b8b[_0xbdb4('0x4d')]){case _0xbdb4('0x61'):if(_0x267b8b[_0xbdb4('0x62')]==0x1){_0x2f074e[_0xbdb4('0x63')]('`'+_0x267b8b[_0xbdb4('0x4d')]+_0xbdb4('0x64'));}else{_0x2f074e[_0xbdb4('0x63')]('`'+_0x267b8b[_0xbdb4('0x4d')]+'`\x20>\x200');}break;case _0xbdb4('0x65'):if(_0x267b8b[_0xbdb4('0x66')]===_0xbdb4('0x67')){if(_0x267b8b['value']['split']('\x20')[_0xbdb4('0x43')]>0x1){_0x448e09[_0xce917e](_0xbdb4('0x68'),qs['getFullTextValue'](_0x267b8b['value']),null);}else{var _0x361236='%'+_0x267b8b[_0xbdb4('0x62')]+'%';_0x448e09[_0xce917e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x361236,_0x361236,_0x361236);}}else{_0x26d079=_[_0xbdb4('0x60')](_0x2056a5,[_0xbdb4('0x2d'),_0xbdb4('0x69')]);_0x267b8b['field']='ContactId';_0x4251fd=as[_0xbdb4('0x6a')](_0x4e85bd,_0x26d079[_0xbdb4('0x3b')],_0x267b8b);_0x448e09[_0xce917e](_0x4251fd[_0xbdb4('0x6b')],_0x4251fd[_0xbdb4('0x62')][_0xbdb4('0x6c')],_0x4251fd[_0xbdb4('0x62')][_0xbdb4('0x1d')]);}break;case'Tag':var _0x5820cf=_0x267b8b[_0xbdb4('0x62')]['split'](',')[_0xbdb4('0x30')](function(_0x531c07){return Number(_0x531c07);});_0x5820cf['forEach'](function(_0x5dda2b){_0x2eb86d['or'](_0xbdb4('0x6d'),'%,'+_0x5dda2b+',%');});_0x436233=_[_0xbdb4('0x6e')](_0x436233,_0x5820cf);break;case _0xbdb4('0x6f'):if(_0x267b8b[_0xbdb4('0x66')]===_0xbdb4('0x67')){_0x448e09[_0xce917e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x267b8b[_0xbdb4('0x62')]+'%',null);}else{_0x26d079=_['find'](_0x2056a5,[_0xbdb4('0x2d'),_0xbdb4('0x70')]);_0x267b8b[_0xbdb4('0x4d')]=_0xbdb4('0x70');_0x4251fd=as[_0xbdb4('0x6a')](_0x4e85bd,_0x26d079[_0xbdb4('0x3b')],_0x267b8b);_0x448e09[_0xce917e](_0x4251fd['text'],_0x4251fd[_0xbdb4('0x62')][_0xbdb4('0x6c')],_0x4251fd['value'][_0xbdb4('0x1d')]);}break;case _0xbdb4('0x71'):_0x4251fd=as[_0xbdb4('0x6a')]('me',null,_0x267b8b);_0x448e09[_0xce917e](_0x4251fd['text'],_0x4251fd[_0xbdb4('0x62')]['start'],_0x4251fd[_0xbdb4('0x62')][_0xbdb4('0x1d')]);break;}}else{var _0x4251fd=as[_0xbdb4('0x6a')](_0x4e85bd,_0x26d079['type'],_0x267b8b);_0x448e09[_0xce917e](_0x4251fd[_0xbdb4('0x6b')],_0x4251fd['value']['start'],_0x4251fd[_0xbdb4('0x62')][_0xbdb4('0x1d')]);}}}else{var _0x5d8898=_(_0x38a77d[_0xbdb4('0x3e')])[_0xbdb4('0x3d')]()['map'](function(_0x58768f){return _[_0xbdb4('0x72')](_0x2056a5,[_0xbdb4('0x2d'),_0x58768f])?_0x58768f:undefined;})[_0xbdb4('0x73')]()['value']();if(!_[_0xbdb4('0x74')](_0x5d8898)){_0x5d8898[_0xbdb4('0x34')](function(_0x593fae){if(_0x593fae===_0xbdb4('0x75')){_0x2f074e[_0xbdb4('0x47')](_0xbdb4('0x76'),[][_0xbdb4('0x77')](_0x38a77d[_0xbdb4('0x3e')][_0x593fae]));}else if(_0x593fae===_0xbdb4('0x78')){var _0x324716=JSON['parse'](_0x38a77d['query'][_0x593fae])['$gte'];var _0x3bf6d9=JSON[_0xbdb4('0x79')](_0x38a77d[_0xbdb4('0x3e')][_0x593fae])[_0xbdb4('0x7a')];_0x2f074e['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x324716,_0x3bf6d9);}else{if(_0x38a77d[_0xbdb4('0x3e')][_0x593fae]===_0xbdb4('0x7b')){_0x2f074e[_0xbdb4('0x47')]('i.'+_0x593fae+_0xbdb4('0x7c'));}else{_0x2f074e[_0xbdb4('0x47')]('i.'+_0x593fae+_0xbdb4('0x7d'),_0x38a77d['query'][_0x593fae]);}}});}if(_0x38a77d['query'][_0xbdb4('0x7e')]){if(_0x38a77d[_0xbdb4('0x3e')][_0xbdb4('0x7e')]==0x1){_0x2f074e['having'](_0xbdb4('0x7f'));}else{_0x2f074e[_0xbdb4('0x63')](_0xbdb4('0x80'));}}if(_0x38a77d[_0xbdb4('0x3e')][_0xbdb4('0x81')]){_0x436233=_[_0xbdb4('0x82')](_0x38a77d[_0xbdb4('0x3e')][_0xbdb4('0x81')])?_0x38a77d[_0xbdb4('0x3e')][_0xbdb4('0x81')]:new Array(_0x38a77d[_0xbdb4('0x3e')][_0xbdb4('0x81')]);_0x436233[_0xbdb4('0x34')](function(_0xecf8e4){_0x2eb86d['or'](_0xbdb4('0x6d'),'%,'+_0xecf8e4+',%');});}if(_0x38a77d[_0xbdb4('0x3e')][_0xbdb4('0x83')]){var _0x4e5665=_0x38a77d['query']['filter'][_0xbdb4('0x84')]('\x5c','\x5c\x5c')[_0xbdb4('0x84')](/'/g,'\x27\x27');if(qs[_0xbdb4('0x85')](_0x4e5665)){_0x448e09['or'](_0xbdb4('0x86'),_0x4e5665+'%')['or'](_0xbdb4('0x87'),_0x4e5665+'%');}else{_0x448e09['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4e5665))['or'](_0xbdb4('0x88'),_0x4e5665+'%');}}}_0x2f074e[_0xbdb4('0x47')](_0x448e09);_0x2f074e[_0xbdb4('0x89')](_0xbdb4('0x8a'));var _0x17514f={'type':db[_0xbdb4('0x8b')]['QueryTypes']['SELECT'],'raw':!![]};var _0x3bacd1=_0x2f074e[_0xbdb4('0x8c')]();_0x3bacd1[_0xbdb4('0x4d')](_0xbdb4('0x8a'));_0x3bacd1['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbdb4('0x61'));if(_0x35ca64[_0xbdb4('0x45')]){_0x35ca64[_0xbdb4('0x45')][_0xbdb4('0x34')](function(_0x10e186){var _0x17c4cf=_0x10e186[0x0]===_0xbdb4('0x8d')?_0x10e186[0x0]:'i.'+_0x10e186[0x0];_0x2f074e[_0xbdb4('0x45')](_0x17c4cf,_0x10e186[0x1]===_0xbdb4('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x436233)){_0x2f074e[_0xbdb4('0x63')](_0x2eb86d);_0x3bacd1['where']('t.id\x20IN\x20?',_0x436233);}BPromise['resolve']()[_0xbdb4('0x28')](function(){if(!_0xa1b553){if(_0x38a77d[_0xbdb4('0x3e')]['WhatsappAccountId'])return;_0x3bacd1['where'](_0xbdb4('0x8f'));_0x2f074e[_0xbdb4('0x47')](_0xbdb4('0x8f'));return;}if(_0x38a77d['user'][_0xbdb4('0x90')]!=='agent')return;return _0x38a77d[_0xbdb4('0x91')][_0xbdb4('0x92')]({'attributes':['id'],'raw':!![]})[_0xbdb4('0x28')](function(_0x11b7b3){if(_[_0xbdb4('0x74')](_0x11b7b3)){_0x3bacd1[_0xbdb4('0x47')]('i.WhatsappAccountId\x20IS\x20NULL');_0x2f074e[_0xbdb4('0x47')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x3bacd1[_0xbdb4('0x47')](_0xbdb4('0x76'),_[_0xbdb4('0x30')](_0x11b7b3,'id'));_0x2f074e[_0xbdb4('0x47')]('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x11b7b3,'id'));}});})['then'](function(){if(_0x38a77d[_0xbdb4('0x91')][_0xbdb4('0x90')]===_0xbdb4('0x93')&&!_0xa1b553&&!_0x38a77d[_0xbdb4('0x3e')][_0xbdb4('0x75')])return[];return db[_0xbdb4('0x94')][_0xbdb4('0x3e')](_0x3bacd1[_0xbdb4('0x95')](),_0x17514f);})[_0xbdb4('0x28')](function(_0x37dc6f){_0x410f96['count']=_0x37dc6f[_0xbdb4('0x43')];if(_0x410f96[_0xbdb4('0x20')]===0x0)return[];return db['sequelize'][_0xbdb4('0x3e')](_0x5ef6b3[_0xbdb4('0x95')](),_0x17514f)[_0xbdb4('0x28')](function(_0x1adf27){_0x39b934=_[_0xbdb4('0x96')](_0x1adf27,'id');_0x17514f=_[_0xbdb4('0x97')](_0x17514f,{'model':db[_0xbdb4('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x38a77d['query'][_0xbdb4('0x41')]){_0x35ca64[_0xbdb4('0x42')][_0xbdb4('0x34')](function(_0x4451af){_0x2f074e[_0xbdb4('0x4d')]('i.'+_0x4451af);});}else{_0x2f074e['field'](_0xbdb4('0x98'),_0xbdb4('0x61'));_0x2f074e['field'](_0xbdb4('0x99'),_0xbdb4('0x9a'));_0x2f074e[_0xbdb4('0x4d')]('a.mandatoryDisposition',_0xbdb4('0x9b'));_0x2f074e['field'](_0xbdb4('0x9c'),'contactName');_0x2f074e['field'](_0xbdb4('0x9d'));_0x2f074e[_0xbdb4('0x4d')]('c.firstName',_0xbdb4('0x9e'));_0x2f074e['field'](_0xbdb4('0x9f'),_0xbdb4('0xa0'));_0x2f074e[_0xbdb4('0x4d')](_0xbdb4('0xa1'),_0xbdb4('0xa2'));_0x2f074e[_0xbdb4('0x4d')](_0xbdb4('0xa3'),_0xbdb4('0xa4'));_0x2f074e['field']('c.mobile',_0xbdb4('0xa5'));_0x2f074e[_0xbdb4('0x4d')](_0xbdb4('0xa6'),'Contact.fax');_0x2f074e[_0xbdb4('0x4d')]('o.fullname','Owner.fullname');_0x2f074e[_0xbdb4('0x4d')]('o.internal',_0xbdb4('0xa7'));_0x2f074e[_0xbdb4('0x4d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbdb4('0x32'));}if(_0x35ca64[_0xbdb4('0x21')])_0x2f074e[_0xbdb4('0x21')](_0x35ca64['limit']);if(_0x35ca64[_0xbdb4('0x1e')])_0x2f074e[_0xbdb4('0x1e')](_0x35ca64[_0xbdb4('0x1e')]);return db[_0xbdb4('0x94')][_0xbdb4('0x3e')](_0x2f074e['toString'](),_0x17514f);})[_0xbdb4('0x28')](function(_0x408940){if(_0x408940[_0xbdb4('0x43')]>0x0)_0xf0ead8[_0xbdb4('0x47')](_0xbdb4('0xa8'),_[_0xbdb4('0x30')](_0x408940,'id'));return db[_0xbdb4('0x94')][_0xbdb4('0x3e')](_0xf0ead8[_0xbdb4('0x95')](),_0x17514f)[_0xbdb4('0x28')](function(_0x256091){var _0x14c5c6=_[_0xbdb4('0xa9')](_0x256091,_0xbdb4('0xaa'));var _0x902772=[];_0x408940[_0xbdb4('0x34')](function(_0x59ad12){_0x902772[_0xbdb4('0x35')](updateWhatsappInteraction(_0x59ad12,_0x39b934,_0x14c5c6));});return BPromise[_0xbdb4('0xab')](_0x902772);});});})['then'](function(_0x157750){_0x410f96[_0xbdb4('0xac')]=_0x157750;return _0x410f96;})[_0xbdb4('0x28')](respondWithFilteredResult(_0x48e3ea,_0x35ca64))['catch'](handleError(_0x48e3ea,null));};exports[_0xbdb4('0xad')]=function(_0x1373a6,_0x28e342){var _0x1e0579={'raw':![],'where':{'id':_0x1373a6[_0xbdb4('0xae')]['id']}},_0x3bb340={};_0x3bb340['model']=_[_0xbdb4('0x3d')](db['WhatsappInteraction'][_0xbdb4('0x39')]);_0x3bb340['query']=_[_0xbdb4('0x3d')](_0x1373a6[_0xbdb4('0x3e')]);_0x3bb340[_0xbdb4('0x3f')]=_[_0xbdb4('0x40')](_0x3bb340[_0xbdb4('0x3c')],_0x3bb340[_0xbdb4('0x3e')]);_0x1e0579[_0xbdb4('0x42')]=_[_0xbdb4('0x40')](_0x3bb340[_0xbdb4('0x3c')],qs['fields'](_0x1373a6[_0xbdb4('0x3e')][_0xbdb4('0x41')]));_0x1e0579[_0xbdb4('0x42')]=_0x1e0579[_0xbdb4('0x42')][_0xbdb4('0x43')]?_0x1e0579['attributes']:_0x3bb340[_0xbdb4('0x3c')];if(_0x1373a6['query'][_0xbdb4('0xaf')]){_0x1e0579[_0xbdb4('0xb0')]=[{'all':!![]}];}_0x1e0579=_[_0xbdb4('0x97')]({},_0x1e0579,_0x1373a6[_0xbdb4('0xb1')]);return db[_0xbdb4('0x38')][_0xbdb4('0x60')](_0x1e0579)[_0xbdb4('0x28')](handleEntityNotFound(_0x28e342,null))[_0xbdb4('0x28')](respondWithResult(_0x28e342,null))[_0xbdb4('0x36')](handleError(_0x28e342,null));};exports[_0xbdb4('0xb2')]=function(_0x2e19b3,_0xef3d42){return db[_0xbdb4('0x38')]['create'](_0x2e19b3[_0xbdb4('0x71')],{})[_0xbdb4('0x28')](respondWithResult(_0xef3d42,0xc9))[_0xbdb4('0x36')](handleError(_0xef3d42,null));};exports[_0xbdb4('0x27')]=function(_0x22953a,_0xf06fd8){if(_0x22953a[_0xbdb4('0x71')]['id']){delete _0x22953a[_0xbdb4('0x71')]['id'];}return db[_0xbdb4('0x38')][_0xbdb4('0x60')]({'where':{'id':_0x22953a['params']['id']}})['then'](handleEntityNotFound(_0xf06fd8,null))[_0xbdb4('0x28')](saveUpdates(_0x22953a['body'],null))[_0xbdb4('0x28')](respondWithResult(_0xf06fd8,null))[_0xbdb4('0x36')](handleError(_0xf06fd8,null));};exports['destroy']=function(_0x1e81d5,_0x1901f9){return db[_0xbdb4('0x38')][_0xbdb4('0x60')]({'where':{'id':_0x1e81d5[_0xbdb4('0xae')]['id']}})[_0xbdb4('0x28')](handleEntityNotFound(_0x1901f9,null))[_0xbdb4('0x28')](removeEntity(_0x1901f9,null))[_0xbdb4('0x36')](handleError(_0x1901f9,null));};exports['describe']=function(_0x8b8b1e,_0x368636){return db[_0xbdb4('0x38')]['describe']()[_0xbdb4('0x28')](respondWithResult(_0x368636,null))[_0xbdb4('0x36')](handleError(_0x368636,null));};exports[_0xbdb4('0xb3')]=function(_0x4f2aef,_0x1171d1,_0x1eeaf1){return db[_0xbdb4('0xb4')][_0xbdb4('0x60')]({'where':{'id':_0x4f2aef[_0xbdb4('0xae')]['id']}})[_0xbdb4('0x28')](handleEntityNotFound(_0x1171d1,null))[_0xbdb4('0x28')](function(_0x2f4691){if(_0x2f4691){return _0x2f4691['addMessage'](_0x4f2aef[_0xbdb4('0x71')][_0xbdb4('0xb5')],_['omit'](_0x4f2aef[_0xbdb4('0x71')],[_0xbdb4('0xb5'),'id'])||{});}})[_0xbdb4('0x28')](respondWithResult(_0x1171d1,null))[_0xbdb4('0x36')](handleError(_0x1171d1,null));};exports[_0xbdb4('0xb6')]=function(_0x159376,_0x38005b,_0x4b9af9){var _0x4d8e72={'raw':![],'where':{}};var _0x1a9fa9={};var _0x968893={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xbdb4('0xb7')]({'where':{'id':_0x159376['params']['id']}})['then'](handleEntityNotFound(_0x38005b,null))[_0xbdb4('0x28')](function(_0x524f56){if(_0x524f56){_0x1a9fa9[_0xbdb4('0x3c')]=_[_0xbdb4('0x3d')](db[_0xbdb4('0xb4')][_0xbdb4('0x39')]);_0x1a9fa9['query']=_['keys'](_0x159376['query']);_0x1a9fa9[_0xbdb4('0x3f')]=_[_0xbdb4('0x40')](_0x1a9fa9['model'],_0x1a9fa9[_0xbdb4('0x3e')]);_0x4d8e72[_0xbdb4('0x42')]=_[_0xbdb4('0x40')](_0x1a9fa9[_0xbdb4('0x3c')],qs[_0xbdb4('0x41')](_0x159376[_0xbdb4('0x3e')][_0xbdb4('0x41')]));_0x4d8e72['attributes']=_0x4d8e72['attributes'][_0xbdb4('0x43')]?_0x4d8e72['attributes']:_0x1a9fa9[_0xbdb4('0x3c')];if(!_0x159376[_0xbdb4('0x3e')][_0xbdb4('0x44')](_0xbdb4('0xb8'))){_0x4d8e72[_0xbdb4('0x21')]=qs['limit'](_0x159376[_0xbdb4('0x3e')]['limit']);_0x4d8e72[_0xbdb4('0x1e')]=qs[_0xbdb4('0x1e')](_0x159376[_0xbdb4('0x3e')][_0xbdb4('0x1e')]);}_0x4d8e72[_0xbdb4('0x45')]=qs[_0xbdb4('0x46')](_0x159376[_0xbdb4('0x3e')]['sort']);_0x4d8e72[_0xbdb4('0x47')]=qs[_0xbdb4('0x3f')](_[_0xbdb4('0x48')](_0x159376[_0xbdb4('0x3e')],_0x1a9fa9[_0xbdb4('0x3f')]));_0x4d8e72['where'][_0xbdb4('0xaa')]=_0x524f56['id'];if(_0x159376[_0xbdb4('0x3e')][_0xbdb4('0x83')]){_0x4d8e72[_0xbdb4('0x47')]=_['merge'](_0x4d8e72[_0xbdb4('0x47')],{'$or':_[_0xbdb4('0x30')](_0x4d8e72[_0xbdb4('0x42')],function(_0x21059b){var _0x8be74e={};_0x8be74e[_0x21059b]={'$like':'%'+_0x159376['query'][_0xbdb4('0x83')]+'%'};return _0x8be74e;})});}if(_0x159376[_0xbdb4('0x3e')][_0xbdb4('0xb9')]){var _0xa405d0=_0x159376[_0xbdb4('0x3e')][_0xbdb4('0xb9')][_0xbdb4('0x33')](',');var _0x459fb8={};_0x459fb8[_0xa405d0[0x0]]={'$gte':moment(_0xa405d0[0x1])['format'](_0xbdb4('0xba'))};_0x4d8e72[_0xbdb4('0x47')]=_['merge'](_0x4d8e72['where'],_0x459fb8);}_0x4d8e72=_[_0xbdb4('0x97')]({},_0x4d8e72,_0x159376[_0xbdb4('0xb1')]);return db['WhatsappMessage'][_0xbdb4('0x20')]({'where':_0x4d8e72[_0xbdb4('0x47')]})[_0xbdb4('0x28')](function(_0x4d749b){_0x968893['count']=_0x4d749b;if(_0x159376[_0xbdb4('0x3e')][_0xbdb4('0xaf')]){_0x4d8e72[_0xbdb4('0xb0')]=[{'all':!![]}];}return db[_0xbdb4('0xb4')]['findAll'](_0x4d8e72);})[_0xbdb4('0x28')](function(_0x2bbe80){_0x968893[_0xbdb4('0xac')]=_0x2bbe80;return _0x968893;});}})[_0xbdb4('0x28')](respondWithFilteredResult(_0x38005b,_0x4d8e72))[_0xbdb4('0x36')](handleError(_0x38005b,null));};exports['addTags']=function(_0x5930a5,_0x2fe1b4,_0x59d179){return db[_0xbdb4('0x38')][_0xbdb4('0x60')]({'where':{'id':_0x5930a5[_0xbdb4('0xae')]['id']}})[_0xbdb4('0x28')](handleEntityNotFound(_0x2fe1b4,null))['then'](function(_0x1abb33){if(_0x1abb33){return _0x1abb33[_0xbdb4('0xbb')](_0x5930a5['body'][_0xbdb4('0xb5')],_[_0xbdb4('0xbc')](_0x5930a5[_0xbdb4('0x71')],[_0xbdb4('0xb5'),'id'])||{})[_0xbdb4('0xbd')](function(){return db[_0xbdb4('0xbe')]['findAll']({'attributes':['id','name',_0xbdb4('0x4a')],'where':{'id':_0x5930a5[_0xbdb4('0x71')][_0xbdb4('0xb5')]}});})[_0xbdb4('0x28')](function(_0x51fbb1){socket['emit'](_0xbdb4('0xbf'),{'id':Number(_0x5930a5['params']['id']),'tags':_0x51fbb1||[]});return{'id':Number(_0x5930a5[_0xbdb4('0xae')]['id']),'tags':_0x51fbb1||[]};});}})['then'](respondWithResult(_0x2fe1b4,null))['catch'](handleError(_0x2fe1b4,null));};exports[_0xbdb4('0xc0')]=function(_0x410178,_0xaa171,_0x5e31da){return db['WhatsappInteraction'][_0xbdb4('0x60')]({'where':{'id':_0x410178[_0xbdb4('0xae')]['id']}})[_0xbdb4('0x28')](handleEntityNotFound(_0xaa171,null))['then'](function(_0x1d6b0a){if(_0x1d6b0a){return _0x1d6b0a[_0xbdb4('0xc0')](_0x410178[_0xbdb4('0x3e')]['ids']);}})[_0xbdb4('0x28')](respondWithStatusCode(_0xaa171,null))[_0xbdb4('0x36')](handleError(_0xaa171,null));};exports[_0xbdb4('0xc1')]=function(_0x5737c2,_0x416bce){var _0x5ad045=moment()['unix']()['toString']();var _0xf39640=path['join'](config[_0xbdb4('0xc2')],_0xbdb4('0xc3'),_0xbdb4('0xc4'),'tmp');var _0x330d19=path['join'](config[_0xbdb4('0xc2')],'server',_0xbdb4('0xc4'),_0xbdb4('0xc5'));var _0x2035cb=path[_0xbdb4('0xc6')](_0xf39640,_0x5ad045);var _0x41d462=util['format'](_0xbdb4('0xc7'),_0x5737c2[_0xbdb4('0xae')]['id'],_0x5ad045);var _0xcb89dc=path[_0xbdb4('0xc6')](_0xf39640,_0x41d462);var _0x3c5d55=[];_0x3c5d55[_0xbdb4('0x35')]({'model':db[_0xbdb4('0x6f')],'as':_0xbdb4('0x6f'),'attributes':['id',_0xbdb4('0xc8')],'raw':!![]});_0x3c5d55[_0xbdb4('0x35')]({'model':db[_0xbdb4('0xc9')],'as':_0xbdb4('0x65'),'attributes':['id',_0xbdb4('0xca'),_0xbdb4('0xcb')],'raw':!![]});if(_0x5737c2[_0xbdb4('0x3e')]['attachments']){_0x3c5d55[_0xbdb4('0x35')]({'model':db[_0xbdb4('0xcc')],'as':_0xbdb4('0xcc'),'raw':!![]});}var _0x389f18=[{'model':db['WhatsappMessage'],'as':_0xbdb4('0xcd'),'attributes':['id','body','createdAt',_0xbdb4('0xce'),_0xbdb4('0xcf'),_0xbdb4('0x7e')],'include':_0x3c5d55}];_0x389f18[_0xbdb4('0x35')]({'model':db[_0xbdb4('0xd0')],'as':_0xbdb4('0xd1'),'attributes':['id','name']});_0x389f18['push']({'model':db[_0xbdb4('0x6f')],'as':_0xbdb4('0xd2'),'attributes':['id',_0xbdb4('0xc8')]});return db[_0xbdb4('0x38')]['find']({'where':{'id':_0x5737c2[_0xbdb4('0xae')]['id']},'include':_0x389f18})[_0xbdb4('0x28')](handleEntityNotFound(_0x416bce,null))[_0xbdb4('0x28')](function(_0x5955b2){if(_0x5955b2){var _0x403e89=_0x5955b2[_0xbdb4('0xd3')]({'plain':!![]});fs[_0xbdb4('0xd4')](_0x2035cb);var _0x425cdf={'channel':_0xbdb4('0xd5'),'account':_0x403e89[_0xbdb4('0xd1')][_0xbdb4('0x2d')],'agent':_0x403e89[_0xbdb4('0xd2')]?_0x403e89[_0xbdb4('0xd2')]['fullname']:_0xbdb4('0xd6'),'createdAt':moment(_0x403e89[_0xbdb4('0x78')])[_0xbdb4('0xd7')](_0xbdb4('0xba'))[_0xbdb4('0x95')](),'closedAt':_0x403e89[_0xbdb4('0xd8')]?moment(_0x403e89[_0xbdb4('0xd9')])['format'](_0xbdb4('0xba'))[_0xbdb4('0x95')]():'','disposition':_0x403e89[_0xbdb4('0xda')],'messages':_(_0x403e89['Messages'])[_0xbdb4('0x83')]({'secret':![]})[_0xbdb4('0x30')](function(_0x495b72){if(_0x495b72[_0xbdb4('0xcc')]){var _0x240419=path[_0xbdb4('0xc6')](_0x330d19,_0x495b72[_0xbdb4('0xcc')][_0xbdb4('0xdb')]);if(fs[_0xbdb4('0xdc')](_0x240419)){fs[_0xbdb4('0xdd')](_0x240419)[_0xbdb4('0xde')](fs[_0xbdb4('0xdf')](path[_0xbdb4('0xc6')](_0x2035cb,_0x495b72[_0xbdb4('0xcc')][_0xbdb4('0xdb')])));}}return{'date':moment(_0x495b72[_0xbdb4('0x78')])[_0xbdb4('0xd7')](_0xbdb4('0xba'))[_0xbdb4('0x95')](),'sender':_0x495b72[_0xbdb4('0xce')]===_0xbdb4('0xe0')?_0x495b72[_0xbdb4('0x6f')]?_0x495b72[_0xbdb4('0x6f')]['fullname']:_0xbdb4('0xe1'):_0x495b72[_0xbdb4('0x65')][_0xbdb4('0xca')]+(_0x495b72[_0xbdb4('0x65')][_0xbdb4('0xcb')]?'\x20'+_0x495b72[_0xbdb4('0x65')][_0xbdb4('0xcb')]:''),'body':_0x495b72[_0xbdb4('0xcc')]?_0x495b72['Attachment']['basename']:_0x495b72[_0xbdb4('0x71')],'direction':_0x495b72[_0xbdb4('0xce')]===_0xbdb4('0xe0')?'A':'C','secret':_0x495b72['secret'],'read':_0x495b72[_0xbdb4('0x7e')],'attachment':_0x495b72['Attachment']};})[_0xbdb4('0x62')]()};return ejs[_0xbdb4('0xe2')](path[_0xbdb4('0xc6')](config[_0xbdb4('0xc2')],'server',_0xbdb4('0xe3'),_0xbdb4('0xe4')),{'interaction':_0x425cdf})[_0xbdb4('0x28')](function(_0x2c4a56){var _0x430c1e=path[_0xbdb4('0xc6')](_0x2035cb,_0xbdb4('0xe5')+_0x403e89['id']+'-'+_0x5ad045+'.pdf');var _0x3e0f6e={'path':_0x430c1e,'channel':_0xbdb4('0xd5'),'interactionId':_0x403e89['id']};return pdf[_0xbdb4('0xe6')](_0x2c4a56,_0x3e0f6e);})[_0xbdb4('0x28')](function(){return new BPromise(function(_0x4379b2,_0x1f8ec6){zipdir(_0x2035cb,{'saveTo':_0xcb89dc},function(_0x1ae170,_0x48fbb3){if(_0x1ae170)return _0x1f8ec6(_0x1ae170);return _0x4379b2(_0x48fbb3);});})[_0xbdb4('0x28')](function(){return new BPromise(function(_0x520155,_0x4fc73e){rimraf(_0x2035cb,function(_0x350520){if(_0x350520)_0x4fc73e(_0x350520);return _0x520155();});});})['then'](function(){return _0x416bce[_0xbdb4('0xc1')](_0xcb89dc,_0x41d462,function(_0x342e3b){if(_0x342e3b){console[_0xbdb4('0xe7')]('err',_0x342e3b);}else{fs['unlinkSync'](_0xcb89dc);}});});});}else{return _0x416bce[_0xbdb4('0x2a')](0xc8);}})[_0xbdb4('0x36')](handleError(_0x416bce,null));}; \ No newline at end of file +var _0x7333=['pipe','createWriteStream','basename','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','log','err','unlinkSync','sendStatus','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./whatsappInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','index','WhatsappInteraction','rawAttributes','type','model','query','keys','intersection','attributes','length','nolimit','sort','filters','field','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','u.id\x20=\x20ui.UserId','select','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','left_join','whatsapp_messages','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','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','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','UserId','body','some','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','$gte','parse','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','user','sequelize','toString','keyBy','merge','fields','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','include','options','create','destroy','describe','WhatsappMessage','ids','omit','getMessages','hasOwnProperty','pick','findAll','addTags','setTags','spread','Tag','color','whatsappInteractionTags:save','removeTags','download','unix','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','Attachment','createdAt','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Messages','existsSync','createReadStream'];(function(_0x1b72d5,_0x25ab5d){var _0x453d20=function(_0x4b4cdc){while(--_0x4b4cdc){_0x1b72d5['push'](_0x1b72d5['shift']());}};_0x453d20(++_0x25ab5d);}(_0x7333,0xfc));var _0x3733=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7333[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x3733('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3733('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3733('0x2'));var moment=require(_0x3733('0x3'));var BPromise=require(_0x3733('0x4'));var Mustache=require('mustache');var util=require(_0x3733('0x5'));var path=require(_0x3733('0x6'));var sox=require(_0x3733('0x7'));var csv=require('to-csv');var ejs=require(_0x3733('0x8'));var fs=require('fs');var fs_extra=require(_0x3733('0x9'));var _=require(_0x3733('0xa'));var squel=require(_0x3733('0xb'));var crypto=require('crypto');var jsforce=require(_0x3733('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3733('0xd'));var querystring=require(_0x3733('0xe'));var Papa=require(_0x3733('0xf'));var Redis=require(_0x3733('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3733('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x3733('0x12'));var hardwareService=require(_0x3733('0x13'));var logger=require(_0x3733('0x14'))(_0x3733('0x15'));var utils=require(_0x3733('0x16'));var config=require(_0x3733('0x17'));var licenseUtil=require(_0x3733('0x18'));var db=require(_0x3733('0x19'))['db'];config[_0x3733('0x1a')]=_[_0x3733('0x1b')](config[_0x3733('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3733('0x1a')]));require(_0x3733('0x1c'))[_0x3733('0x1d')](socket);function respondWithStatusCode(_0x375298,_0x46a3cb){_0x46a3cb=_0x46a3cb||0xcc;return function(_0x46a03e){if(_0x46a03e){return _0x375298['sendStatus'](_0x46a3cb);}return _0x375298[_0x3733('0x1e')](_0x46a3cb)[_0x3733('0x1f')]();};}function respondWithResult(_0x42e87f,_0xcf12d3){_0xcf12d3=_0xcf12d3||0xc8;return function(_0x56c17a){if(_0x56c17a){return _0x42e87f[_0x3733('0x1e')](_0xcf12d3)[_0x3733('0x20')](_0x56c17a);}};}function respondWithFilteredResult(_0x274d49,_0xd0f743){return function(_0x497600){if(_0x497600){var _0x24a91e=typeof _0xd0f743[_0x3733('0x21')]===_0x3733('0x22')&&typeof _0xd0f743[_0x3733('0x23')]===_0x3733('0x22');var _0x1a4e56=_0x497600[_0x3733('0x24')];var _0x1ff6aa=_0x24a91e?0x0:_0xd0f743[_0x3733('0x21')];var _0x48e182=_0x24a91e?_0x497600[_0x3733('0x24')]:_0xd0f743[_0x3733('0x21')]+_0xd0f743[_0x3733('0x23')];var _0x5525f4;if(_0x48e182>=_0x1a4e56){_0x48e182=_0x1a4e56;_0x5525f4=0xc8;}else{_0x5525f4=0xce;}_0x274d49[_0x3733('0x1e')](_0x5525f4);return _0x274d49[_0x3733('0x25')](_0x3733('0x26'),_0x1ff6aa+'-'+_0x48e182+'/'+_0x1a4e56)[_0x3733('0x20')](_0x497600);}return null;};}function patchUpdates(_0xe8c8ff){return function(_0x17e23b){try{jsonpatch[_0x3733('0x27')](_0x17e23b,_0xe8c8ff,!![]);}catch(_0x48826c){return BPromise[_0x3733('0x28')](_0x48826c);}return _0x17e23b['save']();};}function saveUpdates(_0x2d5e10,_0x2c70e7){return function(_0x24512a){if(_0x24512a){return _0x24512a[_0x3733('0x29')](_0x2d5e10)[_0x3733('0x2a')](function(_0xf21aa9){return _0xf21aa9;});}return null;};}function removeEntity(_0x34a572,_0x42cdc6){return function(_0x1a408a){if(_0x1a408a){return _0x1a408a['destroy']()[_0x3733('0x2a')](function(){_0x34a572['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46ee12,_0x12169e){return function(_0x466ef9){if(!_0x466ef9){_0x46ee12['sendStatus'](0x194);}return _0x466ef9;};}function handleError(_0xe68681,_0x375dc2){_0x375dc2=_0x375dc2||0x1f4;return function(_0x1a8a88){logger[_0x3733('0x2b')](_0x1a8a88[_0x3733('0x2c')]);if(_0x1a8a88[_0x3733('0x2d')]){delete _0x1a8a88[_0x3733('0x2d')];}_0xe68681['status'](_0x375dc2)[_0x3733('0x2e')](_0x1a8a88);};}function getInteractionUsers(_0x15cf54,_0x414f69){return new BPromise(function(_0x934ddc,_0x4794fd){try{if(_0x414f69[_0x15cf54['id']]){_0x15cf54['Users']=_[_0x3733('0x2f')](_0x414f69[_0x15cf54['id']],function(_0x51c662){return{'id':_0x51c662['id'],'fullname':_0x51c662[_0x3733('0x30')]};});}}catch(_0x4b0fe8){_0x4794fd(_0x4b0fe8);}_0x934ddc(_0x15cf54);});}function getInteractionTags(_0x10ac22,_0x2675fc){return new BPromise(function(_0x32333e,_0x24ce22){try{if(_0x10ac22[_0x3733('0x31')]){_0x10ac22[_0x3733('0x32')]=[];_0x10ac22[_0x3733('0x31')][_0x3733('0x33')](',')['forEach'](function(_0x159753){_0x10ac22[_0x3733('0x32')][_0x3733('0x34')](_0x2675fc[_0x159753]);});}delete _0x10ac22[_0x3733('0x31')];}catch(_0x5cd9ee){_0x24ce22(_0x5cd9ee);}_0x32333e(_0x10ac22);});}function updateWhatsappInteraction(_0x11a6c2,_0x46e440,_0x10d226){return new BPromise(function(_0xc6cca,_0x2ca276){return getInteractionUsers(_0x11a6c2,_0x10d226)[_0x3733('0x2a')](function(_0x4337c5){return getInteractionTags(_0x4337c5,_0x46e440);})[_0x3733('0x2a')](function(_0x29a87a){_0xc6cca(_0x29a87a);})[_0x3733('0x35')](function(_0x5ac7dc){_0x2ca276(_0x5ac7dc);});});}exports[_0x3733('0x36')]=function(_0x3032f6,_0x2f12a3){var _0x19b394={},_0x240990={},_0x4cfd54={'count':0x0,'rows':[]};var _0x2e1dcb=_['map'](db[_0x3733('0x37')][_0x3733('0x38')],function(_0x46f0d9){return{'name':_0x46f0d9['fieldName'],'type':_0x46f0d9[_0x3733('0x39')]['key']};});_0x240990[_0x3733('0x3a')]=_[_0x3733('0x2f')](_0x2e1dcb,'name');_0x240990[_0x3733('0x3b')]=_[_0x3733('0x3c')](_0x3032f6[_0x3733('0x3b')]);_0x240990['filters']=_[_0x3733('0x3d')](_0x240990[_0x3733('0x3a')],_0x240990[_0x3733('0x3b')]);_0x19b394[_0x3733('0x3e')]=_[_0x3733('0x3d')](_0x240990[_0x3733('0x3a')],qs['fields'](_0x3032f6[_0x3733('0x3b')]['fields']));_0x19b394['attributes']=_0x19b394[_0x3733('0x3e')][_0x3733('0x3f')]?_0x19b394[_0x3733('0x3e')]:_0x240990[_0x3733('0x3a')];if(!_0x3032f6[_0x3733('0x3b')]['hasOwnProperty'](_0x3733('0x40'))){_0x19b394['limit']=qs['limit'](_0x3032f6[_0x3733('0x3b')][_0x3733('0x23')]);_0x19b394[_0x3733('0x21')]=qs[_0x3733('0x21')](_0x3032f6[_0x3733('0x3b')]['offset']);}_0x19b394['order']=qs[_0x3733('0x41')](_0x3032f6[_0x3733('0x3b')]['sort']);_0x19b394['where']=qs['filters'](_['pick'](_0x3032f6['query'],_0x240990[_0x3733('0x42')]),_0x2e1dcb);var _0x5c6846=[];var _0x5032ae=squel['select']()['field']('id')[_0x3733('0x43')](_0x3733('0x2d'))[_0x3733('0x43')]('color')[_0x3733('0x44')](_0x3733('0x45'));var _0x3a9329=squel['select']()[_0x3733('0x43')](_0x3733('0x46'))[_0x3733('0x43')](_0x3733('0x47'))['field'](_0x3733('0x48'))[_0x3733('0x44')]('user_has_whatsapp_interactions','ui')['left_join']('users','u',_0x3733('0x49'));var _0xf3dd18=squel[_0x3733('0x4a')]()[_0x3733('0x44')](_0x3733('0x4b'),'i')['left_join'](_0x3733('0x4c'),'c',_0x3733('0x4d'))['left_join']('users','o',_0x3733('0x4e'))['left_join'](_0x3733('0x4f'),'a',_0x3733('0x50'))[_0x3733('0x51')](_0x3733('0x52'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x3733('0x53'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x3733('0x51')]('tools_tags','t',_0x3733('0x54'));var _0x5c4fb7=squel[_0x3733('0x55')]();var _0x4bbc9e=[];var _0x3609d6=squel['expr']();var _0x25c042;if(_0x3032f6['query'][_0x3733('0x56')]){_0x25c042=as[_0x3733('0x57')](_0x3032f6[_0x3733('0x3b')][_0x3733('0x56')]);var _0x32698a=_0x25c042[_0x3733('0x58')];for(var _0x5babbc=0x0;_0x5babbc<_0x25c042[_0x3733('0x59')][_0x3733('0x3f')];_0x5babbc++){var _0x30ec23=_0x25c042[_0x3733('0x59')][_0x5babbc];var _0xb0f280='i';var _0x22cc8b=_[_0x3733('0x5a')](_0x2e1dcb,['name',_0x30ec23['field']]);if(!_0x22cc8b){switch(_0x30ec23[_0x3733('0x43')]){case'unreadMessages':if(_0x30ec23[_0x3733('0x5b')]==0x1){_0xf3dd18[_0x3733('0x5c')]('`'+_0x30ec23[_0x3733('0x43')]+_0x3733('0x5d'));}else{_0xf3dd18['having']('`'+_0x30ec23[_0x3733('0x43')]+_0x3733('0x5e'));}break;case _0x3733('0x5f'):if(_0x30ec23[_0x3733('0x60')]==='$substring'){if(_0x30ec23[_0x3733('0x5b')][_0x3733('0x33')]('\x20')[_0x3733('0x3f')]>0x1){_0x5c4fb7[_0x32698a](_0x3733('0x61'),qs[_0x3733('0x62')](_0x30ec23[_0x3733('0x5b')]),null);}else{var _0x15fc52='%'+_0x30ec23[_0x3733('0x5b')]+'%';_0x5c4fb7[_0x32698a](_0x3733('0x63'),_0x15fc52,_0x15fc52,_0x15fc52);}}else{_0x22cc8b=_[_0x3733('0x5a')](_0x2e1dcb,[_0x3733('0x2d'),'ContactId']);_0x30ec23[_0x3733('0x43')]=_0x3733('0x64');_0x174627=as[_0x3733('0x65')](_0xb0f280,_0x22cc8b[_0x3733('0x39')],_0x30ec23);_0x5c4fb7[_0x32698a](_0x174627[_0x3733('0x66')],_0x174627['value'][_0x3733('0x67')],_0x174627['value'][_0x3733('0x1f')]);}break;case'Tag':var _0x1a4b2b=_0x30ec23[_0x3733('0x5b')][_0x3733('0x33')](',')[_0x3733('0x2f')](function(_0x164869){return Number(_0x164869);});_0x1a4b2b[_0x3733('0x68')](function(_0x1d415a){_0x3609d6['or'](_0x3733('0x69'),'%,'+_0x1d415a+',%');});_0x4bbc9e=_['union'](_0x4bbc9e,_0x1a4b2b);break;case _0x3733('0x6a'):if(_0x30ec23['operator']===_0x3733('0x6b')){_0x5c4fb7[_0x32698a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x30ec23['value']+'%',null);}else{_0x22cc8b=_['find'](_0x2e1dcb,['name','UserId']);_0x30ec23[_0x3733('0x43')]=_0x3733('0x6c');_0x174627=as[_0x3733('0x65')](_0xb0f280,_0x22cc8b[_0x3733('0x39')],_0x30ec23);_0x5c4fb7[_0x32698a](_0x174627[_0x3733('0x66')],_0x174627['value'][_0x3733('0x67')],_0x174627[_0x3733('0x5b')][_0x3733('0x1f')]);}break;case _0x3733('0x6d'):_0x174627=as[_0x3733('0x65')]('me',null,_0x30ec23);_0x5c4fb7[_0x32698a](_0x174627[_0x3733('0x66')],_0x174627[_0x3733('0x5b')]['start'],_0x174627[_0x3733('0x5b')][_0x3733('0x1f')]);break;}}else{var _0x174627=as[_0x3733('0x65')](_0xb0f280,_0x22cc8b[_0x3733('0x39')],_0x30ec23);_0x5c4fb7[_0x32698a](_0x174627['text'],_0x174627[_0x3733('0x5b')][_0x3733('0x67')],_0x174627[_0x3733('0x5b')][_0x3733('0x1f')]);}}}else{var _0xdec51c=_(_0x3032f6[_0x3733('0x3b')])[_0x3733('0x3c')]()[_0x3733('0x2f')](function(_0x50cfa1){return _[_0x3733('0x6e')](_0x2e1dcb,[_0x3733('0x2d'),_0x50cfa1])?_0x50cfa1:undefined;})['compact']()[_0x3733('0x5b')]();if(!_['isEmpty'](_0xdec51c)){_0xdec51c[_0x3733('0x68')](function(_0xeedf9a){if(_0xeedf9a===_0x3733('0x6f')){_0xf3dd18[_0x3733('0x70')](_0x3733('0x71'),[][_0x3733('0x72')](_0x3032f6[_0x3733('0x3b')][_0xeedf9a]));}else if(_0xeedf9a==='createdAt'){var _0x16ba44=JSON['parse'](_0x3032f6[_0x3733('0x3b')][_0xeedf9a])[_0x3733('0x73')];var _0x5a9016=JSON[_0x3733('0x74')](_0x3032f6[_0x3733('0x3b')][_0xeedf9a])[_0x3733('0x75')];_0xf3dd18[_0x3733('0x70')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16ba44,_0x5a9016);}else{if(_0x3032f6[_0x3733('0x3b')][_0xeedf9a]===_0x3733('0x76')){_0xf3dd18[_0x3733('0x70')]('i.'+_0xeedf9a+_0x3733('0x77'));}else{_0xf3dd18['where']('i.'+_0xeedf9a+'\x20=\x20?',_0x3032f6[_0x3733('0x3b')][_0xeedf9a]);}}});}if(_0x3032f6['query']['read']){if(_0x3032f6['query'][_0x3733('0x78')]==0x1){_0xf3dd18[_0x3733('0x5c')]('`unreadMessages`\x20=\x200');}else{_0xf3dd18[_0x3733('0x5c')](_0x3733('0x79'));}}if(_0x3032f6[_0x3733('0x3b')][_0x3733('0x7a')]){_0x4bbc9e=_[_0x3733('0x7b')](_0x3032f6[_0x3733('0x3b')][_0x3733('0x7a')])?_0x3032f6['query'][_0x3733('0x7a')]:new Array(_0x3032f6[_0x3733('0x3b')][_0x3733('0x7a')]);_0x4bbc9e['forEach'](function(_0x4be6ad){_0x3609d6['or'](_0x3733('0x69'),'%,'+_0x4be6ad+',%');});}if(_0x3032f6[_0x3733('0x3b')][_0x3733('0x7c')]){var _0x137bdc=_0x3032f6['query']['filter']['replace']('\x5c','\x5c\x5c')[_0x3733('0x7d')](/'/g,'\x27\x27');if(qs[_0x3733('0x7e')](_0x137bdc)){_0x5c4fb7['or'](_0x3733('0x7f'),_0x137bdc+'%')['or'](_0x3733('0x80'),_0x137bdc+'%');}else{_0x5c4fb7['or'](_0x3733('0x81'),qs[_0x3733('0x62')](_0x137bdc))['or'](_0x3733('0x82'),_0x137bdc+'%');}}}_0xf3dd18[_0x3733('0x70')](_0x5c4fb7);_0xf3dd18[_0x3733('0x83')](_0x3733('0x84'));var _0x1b0f6d={'type':db['Sequelize'][_0x3733('0x85')][_0x3733('0x86')],'raw':!![]};var _0x1d510a=_0xf3dd18['clone']();_0x1d510a[_0x3733('0x43')](_0x3733('0x84'));_0x1d510a['field'](_0x3733('0x87'),_0x3733('0x88'));if(_0x19b394[_0x3733('0x89')]){_0x19b394[_0x3733('0x89')][_0x3733('0x68')](function(_0x2d37ca){var _0x4966cb=_0x2d37ca[0x0]===_0x3733('0x8a')?_0x2d37ca[0x0]:'i.'+_0x2d37ca[0x0];_0xf3dd18[_0x3733('0x89')](_0x4966cb,_0x2d37ca[0x1]===_0x3733('0x8b')?![]:!![]);});}if(!_[_0x3733('0x8c')](_0x4bbc9e)){_0xf3dd18[_0x3733('0x5c')](_0x3609d6);_0x1d510a[_0x3733('0x70')](_0x3733('0x8d'),_0x4bbc9e);}BPromise[_0x3733('0x8e')]()['then'](function(){if(!_0x25c042){if(_0x3032f6[_0x3733('0x3b')]['WhatsappAccountId'])return;_0x1d510a[_0x3733('0x70')](_0x3733('0x8f'));_0xf3dd18[_0x3733('0x70')](_0x3733('0x8f'));return;}if(_0x3032f6['user'][_0x3733('0x90')]!==_0x3733('0x91'))return;return _0x3032f6['user'][_0x3733('0x92')]({'attributes':['id'],'raw':!![]})[_0x3733('0x2a')](function(_0x3542a6){if(_[_0x3733('0x8c')](_0x3542a6)){_0x1d510a[_0x3733('0x70')](_0x3733('0x93'));_0xf3dd18[_0x3733('0x70')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x1d510a[_0x3733('0x70')](_0x3733('0x71'),_[_0x3733('0x2f')](_0x3542a6,'id'));_0xf3dd18[_0x3733('0x70')](_0x3733('0x71'),_[_0x3733('0x2f')](_0x3542a6,'id'));}});})[_0x3733('0x2a')](function(){if(_0x3032f6[_0x3733('0x94')][_0x3733('0x90')]==='agent'&&!_0x25c042&&!_0x3032f6['query'][_0x3733('0x6f')])return[];return db[_0x3733('0x95')]['query'](_0x1d510a['toString'](),_0x1b0f6d);})[_0x3733('0x2a')](function(_0x5d9f09){_0x4cfd54[_0x3733('0x24')]=_0x5d9f09[_0x3733('0x3f')];if(_0x4cfd54[_0x3733('0x24')]===0x0)return[];return db[_0x3733('0x95')][_0x3733('0x3b')](_0x5032ae[_0x3733('0x96')](),_0x1b0f6d)['then'](function(_0x2da428){_0x5c6846=_[_0x3733('0x97')](_0x2da428,'id');_0x1b0f6d=_[_0x3733('0x98')](_0x1b0f6d,{'model':db[_0x3733('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3032f6['query'][_0x3733('0x99')]){_0x19b394[_0x3733('0x3e')]['forEach'](function(_0x57d208){_0xf3dd18[_0x3733('0x43')]('i.'+_0x57d208);});}else{_0xf3dd18['field'](_0x3733('0x87'),_0x3733('0x88'));_0xf3dd18['field'](_0x3733('0x9a'),_0x3733('0x9b'));_0xf3dd18[_0x3733('0x43')](_0x3733('0x9c'),_0x3733('0x9d'));_0xf3dd18[_0x3733('0x43')]('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',_0x3733('0x8a'));_0xf3dd18[_0x3733('0x43')](_0x3733('0x9e'));_0xf3dd18['field']('c.firstName',_0x3733('0x9f'));_0xf3dd18['field'](_0x3733('0xa0'),_0x3733('0xa1'));_0xf3dd18[_0x3733('0x43')](_0x3733('0xa2'),_0x3733('0xa3'));_0xf3dd18[_0x3733('0x43')](_0x3733('0xa4'),'Contact.phone');_0xf3dd18[_0x3733('0x43')](_0x3733('0xa5'),_0x3733('0xa6'));_0xf3dd18[_0x3733('0x43')](_0x3733('0xa7'),_0x3733('0xa8'));_0xf3dd18[_0x3733('0x43')]('o.fullname',_0x3733('0xa9'));_0xf3dd18[_0x3733('0x43')](_0x3733('0xaa'),_0x3733('0xab'));_0xf3dd18[_0x3733('0x43')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3733('0x31'));}if(_0x19b394[_0x3733('0x23')])_0xf3dd18[_0x3733('0x23')](_0x19b394['limit']);if(_0x19b394[_0x3733('0x21')])_0xf3dd18[_0x3733('0x21')](_0x19b394['offset']);return db[_0x3733('0x95')][_0x3733('0x3b')](_0xf3dd18['toString'](),_0x1b0f6d);})[_0x3733('0x2a')](function(_0x14d31c){if(_0x14d31c[_0x3733('0x3f')]>0x0)_0x3a9329[_0x3733('0x70')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0x3733('0x2f')](_0x14d31c,'id'));return db[_0x3733('0x95')][_0x3733('0x3b')](_0x3a9329[_0x3733('0x96')](),_0x1b0f6d)[_0x3733('0x2a')](function(_0x4ee4af){var _0x1227ec=_[_0x3733('0xac')](_0x4ee4af,_0x3733('0xad'));var _0x1f0085=[];_0x14d31c[_0x3733('0x68')](function(_0x49e3eb){_0x1f0085[_0x3733('0x34')](updateWhatsappInteraction(_0x49e3eb,_0x5c6846,_0x1227ec));});return BPromise[_0x3733('0xae')](_0x1f0085);});});})[_0x3733('0x2a')](function(_0x4f59aa){_0x4cfd54[_0x3733('0xaf')]=_0x4f59aa;return _0x4cfd54;})[_0x3733('0x2a')](respondWithFilteredResult(_0x2f12a3,_0x19b394))[_0x3733('0x35')](handleError(_0x2f12a3,null));};exports[_0x3733('0xb0')]=function(_0x7a6bf1,_0x5e1123){var _0x5b96b1={'raw':![],'where':{'id':_0x7a6bf1[_0x3733('0xb1')]['id']}},_0x1b3089={};_0x1b3089['model']=_[_0x3733('0x3c')](db[_0x3733('0x37')][_0x3733('0x38')]);_0x1b3089[_0x3733('0x3b')]=_[_0x3733('0x3c')](_0x7a6bf1['query']);_0x1b3089[_0x3733('0x42')]=_['intersection'](_0x1b3089['model'],_0x1b3089[_0x3733('0x3b')]);_0x5b96b1[_0x3733('0x3e')]=_[_0x3733('0x3d')](_0x1b3089[_0x3733('0x3a')],qs[_0x3733('0x99')](_0x7a6bf1['query'][_0x3733('0x99')]));_0x5b96b1[_0x3733('0x3e')]=_0x5b96b1['attributes'][_0x3733('0x3f')]?_0x5b96b1[_0x3733('0x3e')]:_0x1b3089['model'];if(_0x7a6bf1[_0x3733('0x3b')][_0x3733('0xb2')]){_0x5b96b1[_0x3733('0xb3')]=[{'all':!![]}];}_0x5b96b1=_['merge']({},_0x5b96b1,_0x7a6bf1[_0x3733('0xb4')]);return db[_0x3733('0x37')][_0x3733('0x5a')](_0x5b96b1)['then'](handleEntityNotFound(_0x5e1123,null))[_0x3733('0x2a')](respondWithResult(_0x5e1123,null))['catch'](handleError(_0x5e1123,null));};exports[_0x3733('0xb5')]=function(_0x44168c,_0x51d401){return db[_0x3733('0x37')][_0x3733('0xb5')](_0x44168c[_0x3733('0x6d')],{})[_0x3733('0x2a')](respondWithResult(_0x51d401,0xc9))[_0x3733('0x35')](handleError(_0x51d401,null));};exports['update']=function(_0x2b7952,_0x3c3772){if(_0x2b7952[_0x3733('0x6d')]['id']){delete _0x2b7952[_0x3733('0x6d')]['id'];}return db['WhatsappInteraction'][_0x3733('0x5a')]({'where':{'id':_0x2b7952[_0x3733('0xb1')]['id']}})[_0x3733('0x2a')](handleEntityNotFound(_0x3c3772,null))[_0x3733('0x2a')](saveUpdates(_0x2b7952[_0x3733('0x6d')],null))[_0x3733('0x2a')](respondWithResult(_0x3c3772,null))['catch'](handleError(_0x3c3772,null));};exports[_0x3733('0xb6')]=function(_0x4e5fe5,_0x5e5f26){return db[_0x3733('0x37')][_0x3733('0x5a')]({'where':{'id':_0x4e5fe5['params']['id']}})[_0x3733('0x2a')](handleEntityNotFound(_0x5e5f26,null))['then'](removeEntity(_0x5e5f26,null))[_0x3733('0x35')](handleError(_0x5e5f26,null));};exports[_0x3733('0xb7')]=function(_0x3a5af1,_0x17c037){return db['WhatsappInteraction'][_0x3733('0xb7')]()[_0x3733('0x2a')](respondWithResult(_0x17c037,null))[_0x3733('0x35')](handleError(_0x17c037,null));};exports['addMessage']=function(_0x10269d,_0x46c526,_0x11a96a){return db[_0x3733('0xb8')][_0x3733('0x5a')]({'where':{'id':_0x10269d[_0x3733('0xb1')]['id']}})[_0x3733('0x2a')](handleEntityNotFound(_0x46c526,null))[_0x3733('0x2a')](function(_0x297710){if(_0x297710){return _0x297710['addMessage'](_0x10269d[_0x3733('0x6d')][_0x3733('0xb9')],_[_0x3733('0xba')](_0x10269d['body'],['ids','id'])||{});}})[_0x3733('0x2a')](respondWithResult(_0x46c526,null))[_0x3733('0x35')](handleError(_0x46c526,null));};exports[_0x3733('0xbb')]=function(_0x58de39,_0x439b4b,_0x445aa9){var _0x30dcf3={'raw':![],'where':{}};var _0x4e60ef={};var _0x4d4a1f={'count':0x0,'rows':[]};return db[_0x3733('0x37')]['findOne']({'where':{'id':_0x58de39[_0x3733('0xb1')]['id']}})[_0x3733('0x2a')](handleEntityNotFound(_0x439b4b,null))['then'](function(_0x175dd6){if(_0x175dd6){_0x4e60ef[_0x3733('0x3a')]=_[_0x3733('0x3c')](db[_0x3733('0xb8')][_0x3733('0x38')]);_0x4e60ef[_0x3733('0x3b')]=_[_0x3733('0x3c')](_0x58de39[_0x3733('0x3b')]);_0x4e60ef[_0x3733('0x42')]=_[_0x3733('0x3d')](_0x4e60ef[_0x3733('0x3a')],_0x4e60ef['query']);_0x30dcf3['attributes']=_[_0x3733('0x3d')](_0x4e60ef['model'],qs[_0x3733('0x99')](_0x58de39['query'][_0x3733('0x99')]));_0x30dcf3[_0x3733('0x3e')]=_0x30dcf3[_0x3733('0x3e')]['length']?_0x30dcf3[_0x3733('0x3e')]:_0x4e60ef['model'];if(!_0x58de39[_0x3733('0x3b')][_0x3733('0xbc')](_0x3733('0x40'))){_0x30dcf3[_0x3733('0x23')]=qs[_0x3733('0x23')](_0x58de39[_0x3733('0x3b')][_0x3733('0x23')]);_0x30dcf3['offset']=qs[_0x3733('0x21')](_0x58de39[_0x3733('0x3b')][_0x3733('0x21')]);}_0x30dcf3['order']=qs[_0x3733('0x41')](_0x58de39['query'][_0x3733('0x41')]);_0x30dcf3[_0x3733('0x70')]=qs['filters'](_[_0x3733('0xbd')](_0x58de39[_0x3733('0x3b')],_0x4e60ef[_0x3733('0x42')]));_0x30dcf3[_0x3733('0x70')][_0x3733('0xad')]=_0x175dd6['id'];if(_0x58de39[_0x3733('0x3b')][_0x3733('0x7c')]){_0x30dcf3['where']=_[_0x3733('0x98')](_0x30dcf3[_0x3733('0x70')],{'$or':_[_0x3733('0x2f')](_0x30dcf3[_0x3733('0x3e')],function(_0x3f49a9){var _0xc9c322={};_0xc9c322[_0x3f49a9]={'$like':'%'+_0x58de39[_0x3733('0x3b')][_0x3733('0x7c')]+'%'};return _0xc9c322;})});}if(_0x58de39[_0x3733('0x3b')][_0x3733('0x73')]){var _0x7bc711=_0x58de39['query'][_0x3733('0x73')][_0x3733('0x33')](',');var _0x1882ab={};_0x1882ab[_0x7bc711[0x0]]={'$gte':moment(_0x7bc711[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x30dcf3[_0x3733('0x70')]=_[_0x3733('0x98')](_0x30dcf3[_0x3733('0x70')],_0x1882ab);}_0x30dcf3=_[_0x3733('0x98')]({},_0x30dcf3,_0x58de39['options']);return db[_0x3733('0xb8')][_0x3733('0x24')]({'where':_0x30dcf3[_0x3733('0x70')]})[_0x3733('0x2a')](function(_0x368984){_0x4d4a1f[_0x3733('0x24')]=_0x368984;if(_0x58de39[_0x3733('0x3b')][_0x3733('0xb2')]){_0x30dcf3[_0x3733('0xb3')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x3733('0xbe')](_0x30dcf3);})[_0x3733('0x2a')](function(_0xd7f58a){_0x4d4a1f['rows']=_0xd7f58a;return _0x4d4a1f;});}})[_0x3733('0x2a')](respondWithFilteredResult(_0x439b4b,_0x30dcf3))[_0x3733('0x35')](handleError(_0x439b4b,null));};exports[_0x3733('0xbf')]=function(_0x502fa7,_0x5786d0,_0x1bf9fe){return db[_0x3733('0x37')][_0x3733('0x5a')]({'where':{'id':_0x502fa7[_0x3733('0xb1')]['id']}})[_0x3733('0x2a')](handleEntityNotFound(_0x5786d0,null))[_0x3733('0x2a')](function(_0x1395ef){if(_0x1395ef){return _0x1395ef[_0x3733('0xc0')](_0x502fa7[_0x3733('0x6d')]['ids'],_[_0x3733('0xba')](_0x502fa7['body'],[_0x3733('0xb9'),'id'])||{})[_0x3733('0xc1')](function(){return db[_0x3733('0xc2')]['findAll']({'attributes':['id',_0x3733('0x2d'),_0x3733('0xc3')],'where':{'id':_0x502fa7[_0x3733('0x6d')][_0x3733('0xb9')]}});})[_0x3733('0x2a')](function(_0x2186b0){socket['emit'](_0x3733('0xc4'),{'id':Number(_0x502fa7[_0x3733('0xb1')]['id']),'tags':_0x2186b0||[]});return{'id':Number(_0x502fa7[_0x3733('0xb1')]['id']),'tags':_0x2186b0||[]};});}})[_0x3733('0x2a')](respondWithResult(_0x5786d0,null))[_0x3733('0x35')](handleError(_0x5786d0,null));};exports[_0x3733('0xc5')]=function(_0x44133e,_0x29df25,_0x1a281b){return db[_0x3733('0x37')][_0x3733('0x5a')]({'where':{'id':_0x44133e[_0x3733('0xb1')]['id']}})[_0x3733('0x2a')](handleEntityNotFound(_0x29df25,null))[_0x3733('0x2a')](function(_0x1b67d3){if(_0x1b67d3){return _0x1b67d3[_0x3733('0xc5')](_0x44133e[_0x3733('0x3b')][_0x3733('0xb9')]);}})[_0x3733('0x2a')](respondWithStatusCode(_0x29df25,null))[_0x3733('0x35')](handleError(_0x29df25,null));};exports[_0x3733('0xc6')]=function(_0x56eed9,_0x16881b){var _0x64ab85=moment()[_0x3733('0xc7')]()[_0x3733('0x96')]();var _0x5b0f4d=path['join'](config[_0x3733('0xc8')],_0x3733('0xc9'),'files',_0x3733('0xca'));var _0x21c8e5=path[_0x3733('0xcb')](config['root'],'server',_0x3733('0xcc'),_0x3733('0xcd'));var _0x42c28c=path[_0x3733('0xcb')](_0x5b0f4d,_0x64ab85);var _0x5abaaf=util['format'](_0x3733('0xce'),_0x56eed9['params']['id'],_0x64ab85);var _0x883120=path[_0x3733('0xcb')](_0x5b0f4d,_0x5abaaf);var _0x4f79f9=[];_0x4f79f9[_0x3733('0x34')]({'model':db[_0x3733('0x6a')],'as':'User','attributes':['id',_0x3733('0x30')],'raw':!![]});_0x4f79f9[_0x3733('0x34')]({'model':db['CmContact'],'as':_0x3733('0x5f'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x56eed9['query'][_0x3733('0xcd')]){_0x4f79f9[_0x3733('0x34')]({'model':db[_0x3733('0xcf')],'as':_0x3733('0xcf'),'raw':!![]});}var _0x5e99e3=[{'model':db[_0x3733('0xb8')],'as':'Messages','attributes':['id','body',_0x3733('0xd0'),_0x3733('0xd1'),_0x3733('0xd2'),'read'],'include':_0x4f79f9}];_0x5e99e3[_0x3733('0x34')]({'model':db[_0x3733('0xd3')],'as':_0x3733('0xd4'),'attributes':['id',_0x3733('0x2d')]});_0x5e99e3[_0x3733('0x34')]({'model':db[_0x3733('0x6a')],'as':_0x3733('0xd5'),'attributes':['id','fullname']});return db['WhatsappInteraction'][_0x3733('0x5a')]({'where':{'id':_0x56eed9[_0x3733('0xb1')]['id']},'include':_0x5e99e3})[_0x3733('0x2a')](handleEntityNotFound(_0x16881b,null))[_0x3733('0x2a')](function(_0x3a2b7c){if(_0x3a2b7c){var _0x440110=_0x3a2b7c[_0x3733('0xd6')]({'plain':!![]});fs[_0x3733('0xd7')](_0x42c28c);var _0x49dd76={'channel':_0x3733('0xd8'),'account':_0x440110[_0x3733('0xd4')][_0x3733('0x2d')],'agent':_0x440110[_0x3733('0xd5')]?_0x440110['Owner'][_0x3733('0x30')]:_0x3733('0xd9'),'createdAt':moment(_0x440110[_0x3733('0xd0')])[_0x3733('0xda')](_0x3733('0xdb'))[_0x3733('0x96')](),'closedAt':_0x440110[_0x3733('0xdc')]?moment(_0x440110[_0x3733('0xdd')])[_0x3733('0xda')](_0x3733('0xdb'))[_0x3733('0x96')]():'','disposition':_0x440110[_0x3733('0xde')],'messages':_(_0x440110[_0x3733('0xdf')])[_0x3733('0x7c')]({'secret':![]})[_0x3733('0x2f')](function(_0x165a15){if(_0x165a15[_0x3733('0xcf')]){var _0x292d5d=path[_0x3733('0xcb')](_0x21c8e5,_0x165a15[_0x3733('0xcf')]['basename']);if(fs[_0x3733('0xe0')](_0x292d5d)){fs[_0x3733('0xe1')](_0x292d5d)[_0x3733('0xe2')](fs[_0x3733('0xe3')](path['join'](_0x42c28c,_0x165a15[_0x3733('0xcf')][_0x3733('0xe4')])));}}return{'date':moment(_0x165a15['createdAt'])[_0x3733('0xda')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x165a15[_0x3733('0xd1')]==='out'?_0x165a15[_0x3733('0x6a')]?_0x165a15[_0x3733('0x6a')][_0x3733('0x30')]:_0x3733('0xe5'):_0x165a15['Contact']['firstName']+(_0x165a15[_0x3733('0x5f')]['lastName']?'\x20'+_0x165a15['Contact'][_0x3733('0xe6')]:''),'body':_0x165a15[_0x3733('0xcf')]?_0x165a15[_0x3733('0xcf')][_0x3733('0xe4')]:_0x165a15[_0x3733('0x6d')],'direction':_0x165a15['direction']==='out'?'A':'C','secret':_0x165a15[_0x3733('0xd2')],'read':_0x165a15[_0x3733('0x78')],'attachment':_0x165a15['Attachment']};})[_0x3733('0x5b')]()};return ejs[_0x3733('0xe7')](path[_0x3733('0xcb')](config[_0x3733('0xc8')],_0x3733('0xc9'),_0x3733('0xe8'),_0x3733('0xe9')),{'interaction':_0x49dd76})[_0x3733('0x2a')](function(_0x11a51e){var _0x10c2c5=path[_0x3733('0xcb')](_0x42c28c,_0x3733('0xea')+_0x440110['id']+'-'+_0x64ab85+'.pdf');var _0x366644={'path':_0x10c2c5,'channel':_0x3733('0xd8'),'interactionId':_0x440110['id']};return pdf['createPdfFromHTML'](_0x11a51e,_0x366644);})[_0x3733('0x2a')](function(){return new BPromise(function(_0x3b41ef,_0x9d8b21){zipdir(_0x42c28c,{'saveTo':_0x883120},function(_0x3c6e8d,_0x3d3db7){if(_0x3c6e8d)return _0x9d8b21(_0x3c6e8d);return _0x3b41ef(_0x3d3db7);});})[_0x3733('0x2a')](function(){return new BPromise(function(_0x5eda9b,_0x5b396d){rimraf(_0x42c28c,function(_0x1acceb){if(_0x1acceb)_0x5b396d(_0x1acceb);return _0x5eda9b();});});})[_0x3733('0x2a')](function(){return _0x16881b[_0x3733('0xc6')](_0x883120,_0x5abaaf,function(_0xfe80bb){if(_0xfe80bb){console[_0x3733('0xeb')](_0x3733('0xec'),_0xfe80bb);}else{fs[_0x3733('0xed')](_0x883120);}});});});}else{return _0x16881b[_0x3733('0xee')](0xc8);}})[_0x3733('0x35')](handleError(_0x16881b,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 225feed..c014c3a 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 _0x49ac=['update','remove','then','setDataValue','Users','unreadMessages','length','emit','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save'];(function(_0x54e37e,_0x24e11e){var _0x245492=function(_0x27d142){while(--_0x27d142){_0x54e37e['push'](_0x54e37e['shift']());}};_0x245492(++_0x24e11e);}(_0x49ac,0x19e));var _0xc49a=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0x49ac[_0xf26c2e];return _0x46ecb4;};'use strict';var EventEmitter=require(_0xc49a('0x0'));var WhatsappInteraction=require(_0xc49a('0x1'))['db'][_0xc49a('0x2')];var WhatsappMessage=require(_0xc49a('0x1'))['db'][_0xc49a('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc49a('0x4')](0x0);var events={'afterCreate':_0xc49a('0x5'),'afterUpdate':_0xc49a('0x6'),'afterDestroy':_0xc49a('0x7')};function emitEvent(_0x28a560){return function(_0x43bc9c,_0x4dcf88,_0x40017e){_0x43bc9c['getUsers']({'attributes':['id'],'raw':!![]})[_0xc49a('0x8')](function(_0x1cbdda){_0x43bc9c[_0xc49a('0x9')](_0xc49a('0xa'),_0x1cbdda['map'](function(_0x35f07d){return{'id':_0x35f07d['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x43bc9c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc49a('0x8')](function(_0x5d5828){_0x43bc9c[_0xc49a('0x9')](_0xc49a('0xb'),_0x5d5828[_0xc49a('0xc')]);WhatsappInteractionEvents[_0xc49a('0xd')](_0x28a560+':'+_0x43bc9c['id'],_0x43bc9c);WhatsappInteractionEvents[_0xc49a('0xd')](_0x28a560,_0x43bc9c);_0x40017e(null);})['catch'](_0x40017e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xc49a('0xe')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x6c4b=['catch','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','then','Users','map','findAll','setDataValue','length','emit'];(function(_0x553305,_0x516b34){var _0x3329c6=function(_0x4d42db){while(--_0x4d42db){_0x553305['push'](_0x553305['shift']());}};_0x3329c6(++_0x516b34);}(_0x6c4b,0x93));var _0xb6c4=function(_0x5e5dbf,_0x1e8c22){_0x5e5dbf=_0x5e5dbf-0x0;var _0xfd8d51=_0x6c4b[_0x5e5dbf];return _0xfd8d51;};'use strict';var EventEmitter=require(_0xb6c4('0x0'));var WhatsappInteraction=require(_0xb6c4('0x1'))['db'][_0xb6c4('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0xb6c4('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb6c4('0x4')](0x0);var events={'afterCreate':_0xb6c4('0x5'),'afterUpdate':_0xb6c4('0x6'),'afterDestroy':_0xb6c4('0x7')};function emitEvent(_0x27f46b){return function(_0x4b1799,_0x52a9b1,_0x1f7abc){_0x4b1799['getUsers']({'attributes':['id'],'raw':!![]})[_0xb6c4('0x8')](function(_0x38b222){_0x4b1799['setDataValue'](_0xb6c4('0x9'),_0x38b222[_0xb6c4('0xa')](function(_0xd54ca8){return{'id':_0xd54ca8['id']};}));return WhatsappMessage[_0xb6c4('0xb')]({'where':{'WhatsappInteractionId':_0x4b1799['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb6c4('0x8')](function(_0x46b134){_0x4b1799[_0xb6c4('0xc')]('unreadMessages',_0x46b134[_0xb6c4('0xd')]);WhatsappInteractionEvents[_0xb6c4('0xe')](_0x27f46b+':'+_0x4b1799['id'],_0x4b1799);WhatsappInteractionEvents[_0xb6c4('0xe')](_0x27f46b,_0x4b1799);_0x1f7abc(null);})[_0xb6c4('0xf')](_0x1f7abc(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xb6c4('0x10')](e,emitEvent(event));}}module[_0xb6c4('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 60685ad..f72ffeb 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 _0x7c22=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x7c22,0x1bf));var _0x27c2=function(_0x53cc47,_0x2a4c6b){_0x53cc47=_0x53cc47-0x0;var _0x9c1682=_0x7c22[_0x53cc47];return _0x9c1682;};'use strict';var _=require('lodash');var util=require(_0x27c2('0x0'));var logger=require(_0x27c2('0x1'))(_0x27c2('0x2'));var moment=require(_0x27c2('0x3'));var BPromise=require(_0x27c2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27c2('0x5'));var rimraf=require(_0x27c2('0x6'));var config=require(_0x27c2('0x7'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x138b4a,_0x19e473){return _0x138b4a['define']('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x81f5e1,_0x160310,_0x64ee3f){if(_0x81f5e1[_0x27c2('0x8')](_0x27c2('0x9'))){_0x81f5e1[_0x27c2('0xa')]=moment()[_0x27c2('0xb')](_0x27c2('0xc'));}_0x64ee3f(null,_0x81f5e1);}}});}; \ No newline at end of file +var _0x12d3=['WhatsappInteraction','closed','closedAt','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports'];(function(_0x5e06e2,_0x1ae423){var _0x443048=function(_0x326daa){while(--_0x326daa){_0x5e06e2['push'](_0x5e06e2['shift']());}};_0x443048(++_0x1ae423);}(_0x12d3,0xab));var _0x312d=function(_0x2cdd9a,_0x248a39){_0x2cdd9a=_0x2cdd9a-0x0;var _0x4b3e4e=_0x12d3[_0x2cdd9a];return _0x4b3e4e;};'use strict';var _=require(_0x312d('0x0'));var util=require(_0x312d('0x1'));var logger=require(_0x312d('0x2'))(_0x312d('0x3'));var moment=require(_0x312d('0x4'));var BPromise=require('bluebird');var rp=require(_0x312d('0x5'));var fs=require('fs');var path=require(_0x312d('0x6'));var rimraf=require(_0x312d('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x312d('0x8')]=function(_0x484ab0,_0x264811){return _0x484ab0['define'](_0x312d('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe7ecd5,_0x15bc71,_0x460b6f){if(_0xe7ecd5['changed'](_0x312d('0xa'))){_0xe7ecd5[_0x312d('0xb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x460b6f(null,_0xe7ecd5);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index f0b380d..90f776c 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 _0xdb71=['register','request','then','debug','request\x20sent','error','code','WhatsappInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','attributes','limit','stringify','AddTagsToWhatsappInteraction','find','where','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket'];(function(_0x371559,_0x3c1849){var _0x3950f7=function(_0x1b8dba){while(--_0x1b8dba){_0x371559['push'](_0x371559['shift']());}};_0x3950f7(++_0x3c1849);}(_0xdb71,0xf8));var _0x1db7=function(_0x7615b4,_0x25cf30){_0x7615b4=_0x7615b4-0x0;var _0x12648d=_0xdb71[_0x7615b4];return _0x12648d;};'use strict';var _=require(_0x1db7('0x0'));var util=require('util');var moment=require(_0x1db7('0x1'));var BPromise=require(_0x1db7('0x2'));var rs=require(_0x1db7('0x3'));var fs=require('fs');var Redis=require(_0x1db7('0x4'));var db=require(_0x1db7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1db7('0x6'))('rpc');var config=require(_0x1db7('0x7'));var jayson=require(_0x1db7('0x8'));var client=jayson[_0x1db7('0x9')][_0x1db7('0xa')]({'port':0x232a});config[_0x1db7('0xb')]=_[_0x1db7('0xc')](config[_0x1db7('0xb')],{'host':_0x1db7('0xd'),'port':0x18eb});var socket=require(_0x1db7('0xe'))(new Redis(config['redis']));require(_0x1db7('0xf'))[_0x1db7('0x10')](socket);function respondWithRpcPromise(_0x47b663,_0x4eeb2a,_0x2fc380){return new BPromise(function(_0x5b3818,_0x2c5c9e){return client[_0x1db7('0x11')](_0x47b663,_0x2fc380)[_0x1db7('0x12')](function(_0x204511){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x4eeb2a,'request\x20sent');logger[_0x1db7('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4eeb2a,_0x1db7('0x14'),JSON['stringify'](_0x204511));if(_0x204511[_0x1db7('0x15')]){if(_0x204511['error'][_0x1db7('0x16')]===0x1f4){logger[_0x1db7('0x15')](_0x1db7('0x17'),_0x4eeb2a,_0x204511[_0x1db7('0x15')]['message']);return _0x2c5c9e(_0x204511[_0x1db7('0x15')][_0x1db7('0x18')]);}logger['error'](_0x1db7('0x17'),_0x4eeb2a,_0x204511[_0x1db7('0x15')][_0x1db7('0x18')]);return _0x5b3818(_0x204511[_0x1db7('0x15')][_0x1db7('0x18')]);}else{logger[_0x1db7('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x4eeb2a,_0x1db7('0x14'));_0x5b3818(_0x204511[_0x1db7('0x1a')][_0x1db7('0x18')]);}})[_0x1db7('0x1b')](function(_0x56a53b){logger[_0x1db7('0x15')](_0x1db7('0x17'),_0x4eeb2a,_0x56a53b);_0x2c5c9e(_0x56a53b);});});}exports[_0x1db7('0x1c')]=function(_0x46324b){var _0x30ad53=this;return new Promise(function(_0x298309,_0x4afb18){return db[_0x1db7('0x1d')][_0x1db7('0x1e')](_0x46324b[_0x1db7('0x1f')],{'raw':_0x46324b[_0x1db7('0x20')]?_0x46324b[_0x1db7('0x20')][_0x1db7('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46324b[_0x1db7('0x20')]?_0x46324b[_0x1db7('0x20')]['where']||null:null,'attributes':_0x46324b['options']?_0x46324b['options'][_0x1db7('0x22')]||null:null,'limit':_0x46324b['options']?_0x46324b[_0x1db7('0x20')][_0x1db7('0x23')]||null:null})['then'](function(_0xc0afbb){logger['info'](_0x1db7('0x1c'),_0x46324b);logger[_0x1db7('0x13')](_0x1db7('0x1c'),_0x46324b,JSON[_0x1db7('0x24')](_0xc0afbb));_0x298309(_0xc0afbb);})[_0x1db7('0x1b')](function(_0x2c6542){logger[_0x1db7('0x15')](_0x1db7('0x1c'),_0x2c6542[_0x1db7('0x18')],_0x46324b);_0x4afb18(_0x30ad53[_0x1db7('0x15')](0x1f4,_0x2c6542[_0x1db7('0x18')]));});});};exports[_0x1db7('0x25')]=function(_0x434301){return new Promise(function(_0x1cfc7f,_0x35aac6){return db['WhatsappInteraction'][_0x1db7('0x26')]({'where':_0x434301[_0x1db7('0x20')]?_0x434301[_0x1db7('0x20')][_0x1db7('0x27')]||null:null})[_0x1db7('0x12')](function(_0x5ac269){if(_0x5ac269){return _0x5ac269[_0x1db7('0x28')](_0x434301['body'][_0x1db7('0x29')],_['omit'](_0x434301[_0x1db7('0x1f')],[_0x1db7('0x29'),'id'])||{});}})[_0x1db7('0x2a')](function(_0x48885b){logger[_0x1db7('0x19')](_0x1db7('0x2b'),_0x434301);logger['debug'](_0x1db7('0x2b'),_0x434301,JSON['stringify'](_0x48885b));_0x1cfc7f(_0x48885b);})[_0x1db7('0x1b')](function(_0x3a30cb){logger['error']('AddTags',_0x3a30cb['message'],_0x434301);_0x35aac6(_this[_0x1db7('0x15')](0x1f4,_0x3a30cb[_0x1db7('0x18')]));});});}; \ No newline at end of file +var _0x67ed=['AddTags','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','info','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','limit','find','addTags','ids'];(function(_0x3a723e,_0x59d99a){var _0x3e9c03=function(_0x4a6947){while(--_0x4a6947){_0x3a723e['push'](_0x3a723e['shift']());}};_0x3e9c03(++_0x59d99a);}(_0x67ed,0xfd));var _0xd67e=function(_0x33faa9,_0x2fca33){_0x33faa9=_0x33faa9-0x0;var _0x1b2b41=_0x67ed[_0x33faa9];return _0x1b2b41;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd67e('0x0'));var BPromise=require(_0xd67e('0x1'));var rs=require(_0xd67e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd67e('0x3'))(_0xd67e('0x4'));var config=require(_0xd67e('0x5'));var jayson=require(_0xd67e('0x6'));var client=jayson[_0xd67e('0x7')][_0xd67e('0x8')]({'port':0x232a});config[_0xd67e('0x9')]=_[_0xd67e('0xa')](config['redis'],{'host':_0xd67e('0xb'),'port':0x18eb});var socket=require(_0xd67e('0xc'))(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1d4039,_0x53774a,_0x1997d0){return new BPromise(function(_0x5ce4d6,_0x399c43){return client['request'](_0x1d4039,_0x1997d0)[_0xd67e('0xd')](function(_0x433896){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x53774a,_0xd67e('0xe'));logger[_0xd67e('0xf')](_0xd67e('0x10'),_0x53774a,'request\x20sent',JSON[_0xd67e('0x11')](_0x433896));if(_0x433896[_0xd67e('0x12')]){if(_0x433896['error'][_0xd67e('0x13')]===0x1f4){logger[_0xd67e('0x12')](_0xd67e('0x14'),_0x53774a,_0x433896[_0xd67e('0x12')][_0xd67e('0x15')]);return _0x399c43(_0x433896[_0xd67e('0x12')][_0xd67e('0x15')]);}logger['error'](_0xd67e('0x14'),_0x53774a,_0x433896[_0xd67e('0x12')][_0xd67e('0x15')]);return _0x5ce4d6(_0x433896['error']['message']);}else{logger[_0xd67e('0x16')](_0xd67e('0x14'),_0x53774a,_0xd67e('0xe'));_0x5ce4d6(_0x433896['result'][_0xd67e('0x15')]);}})[_0xd67e('0x17')](function(_0x169b8f){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x53774a,_0x169b8f);_0x399c43(_0x169b8f);});});}exports[_0xd67e('0x18')]=function(_0x1f7f39){var _0x8d06f=this;return new Promise(function(_0xc82c9e,_0x2c357c){return db[_0xd67e('0x19')][_0xd67e('0x1a')](_0x1f7f39[_0xd67e('0x1b')],{'raw':_0x1f7f39['options']?_0x1f7f39[_0xd67e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f7f39[_0xd67e('0x1c')]?_0x1f7f39[_0xd67e('0x1c')][_0xd67e('0x1d')]||null:null,'attributes':_0x1f7f39[_0xd67e('0x1c')]?_0x1f7f39[_0xd67e('0x1c')][_0xd67e('0x1e')]||null:null,'limit':_0x1f7f39[_0xd67e('0x1c')]?_0x1f7f39[_0xd67e('0x1c')][_0xd67e('0x1f')]||null:null})[_0xd67e('0xd')](function(_0x375a38){logger[_0xd67e('0x16')](_0xd67e('0x18'),_0x1f7f39);logger[_0xd67e('0xf')](_0xd67e('0x18'),_0x1f7f39,JSON[_0xd67e('0x11')](_0x375a38));_0xc82c9e(_0x375a38);})[_0xd67e('0x17')](function(_0x1b860d){logger[_0xd67e('0x12')](_0xd67e('0x18'),_0x1b860d['message'],_0x1f7f39);_0x2c357c(_0x8d06f[_0xd67e('0x12')](0x1f4,_0x1b860d[_0xd67e('0x15')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x5e8299){return new Promise(function(_0x2880dc,_0xc16d0a){return db[_0xd67e('0x19')][_0xd67e('0x20')]({'where':_0x5e8299[_0xd67e('0x1c')]?_0x5e8299[_0xd67e('0x1c')][_0xd67e('0x1d')]||null:null})[_0xd67e('0xd')](function(_0x1b48e8){if(_0x1b48e8){return _0x1b48e8[_0xd67e('0x21')](_0x5e8299[_0xd67e('0x1b')][_0xd67e('0x22')],_['omit'](_0x5e8299[_0xd67e('0x1b')],[_0xd67e('0x22'),'id'])||{});}})['spread'](function(_0xae37c3){logger[_0xd67e('0x16')](_0xd67e('0x23'),_0x5e8299);logger[_0xd67e('0xf')](_0xd67e('0x23'),_0x5e8299,JSON[_0xd67e('0x11')](_0xae37c3));_0x2880dc(_0xae37c3);})[_0xd67e('0x17')](function(_0x25341c){logger[_0xd67e('0x12')](_0xd67e('0x23'),_0x25341c[_0xd67e('0x15')],_0x5e8299);_0xc16d0a(_this['error'](0x1f4,_0x25341c['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index eee7812..d0e196f 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 _0xe55f=['remove','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe55f,0x6e));var _0xfe55=function(_0x419aa4,_0x5926a7){_0x419aa4=_0x419aa4-0x0;var _0x557d9b=_0xe55f[_0x419aa4];return _0x557d9b;};'use strict';var WhatsappInteractionEvents=require(_0xfe55('0x0'));var events=[_0xfe55('0x1'),_0xfe55('0x2'),'update'];function createListener(_0x4f6509,_0x157ecf){return function(_0x2c75e0){_0x157ecf[_0xfe55('0x3')](_0x4f6509,_0x2c75e0);};}function removeListener(_0x121179,_0x46dd67){return function(){WhatsappInteractionEvents[_0xfe55('0x4')](_0x121179,_0x46dd67);};}exports[_0xfe55('0x5')]=function(_0x11d9b2){for(var _0x187b34=0x0,_0x48aca5=events[_0xfe55('0x6')];_0x187b34<_0x48aca5;_0x187b34++){var _0x14b3b3=events[_0x187b34];var _0x243f92=createListener(_0xfe55('0x7')+_0x14b3b3,_0x11d9b2);WhatsappInteractionEvents['on'](_0x14b3b3,_0x243f92);}}; \ No newline at end of file +var _0xcbc5=['update','emit','removeListener','length','whatsappInteraction:','remove'];(function(_0x311015,_0x455f8a){var _0x325549=function(_0x2f5ca5){while(--_0x2f5ca5){_0x311015['push'](_0x311015['shift']());}};_0x325549(++_0x455f8a);}(_0xcbc5,0x1d9));var _0x5cbc=function(_0x5ef8ab,_0x235fad){_0x5ef8ab=_0x5ef8ab-0x0;var _0x4839c0=_0xcbc5[_0x5ef8ab];return _0x4839c0;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x5cbc('0x0'),_0x5cbc('0x1')];function createListener(_0x373ad6,_0x136826){return function(_0x254e31){_0x136826[_0x5cbc('0x2')](_0x373ad6,_0x254e31);};}function removeListener(_0x3f5e58,_0x55c4ac){return function(){WhatsappInteractionEvents[_0x5cbc('0x3')](_0x3f5e58,_0x55c4ac);};}exports['register']=function(_0x4b8963){for(var _0x5103cc=0x0,_0x34a610=events[_0x5cbc('0x4')];_0x5103cc<_0x34a610;_0x5103cc++){var _0x5dc6e9=events[_0x5103cc];var _0x59a7f8=createListener(_0x5cbc('0x5')+_0x5dc6e9,_0x4b8963);WhatsappInteractionEvents['on'](_0x5dc6e9,_0x59a7f8);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 3025b10..07174a6 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 _0xd08e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x243c52,_0x496529){var _0x492280=function(_0x3e4467){while(--_0x3e4467){_0x243c52['push'](_0x243c52['shift']());}};_0x492280(++_0x496529);}(_0xd08e,0x109));var _0xed08=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xd08e[_0x23e7c1];return _0x1add43;};'use strict';var multer=require(_0xed08('0x0'));var util=require(_0xed08('0x1'));var path=require(_0xed08('0x2'));var timeout=require(_0xed08('0x3'));var express=require(_0xed08('0x4'));var router=express[_0xed08('0x5')]();var fs_extra=require(_0xed08('0x6'));var auth=require(_0xed08('0x7'));var interaction=require(_0xed08('0x8'));var config=require(_0xed08('0x9'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0xed08('0xa')](),controller['index']);router[_0xed08('0xb')](_0xed08('0xc'),auth[_0xed08('0xa')](),controller[_0xed08('0xd')]);router[_0xed08('0xb')](_0xed08('0xe'),auth[_0xed08('0xa')](),controller[_0xed08('0xf')]);router[_0xed08('0x10')]('/',auth['isAuthenticated'](),interaction[_0xed08('0x11')](_0xed08('0x12'),_0xed08('0x13')),controller[_0xed08('0x14')]);router['post'](_0xed08('0x15'),controller['status']);router[_0xed08('0x16')]('/:id',auth[_0xed08('0xa')](),controller[_0xed08('0x17')]);router[_0xed08('0x16')](_0xed08('0x18'),auth['isAuthenticated'](),controller[_0xed08('0x19')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xed08('0x1a')]);router[_0xed08('0x1b')](_0xed08('0xe'),auth[_0xed08('0xa')](),controller[_0xed08('0x1c')]);module[_0xed08('0x1d')]=router; \ No newline at end of file +var _0xd760=['whatsappmessage:create','create','status','put','update','accept','/:id/reject','delete','destroy','exports','multer','util','express','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','describe','/:id','show','post','tracked'];(function(_0x411a6e,_0x38978e){var _0xfbb021=function(_0x518fc3){while(--_0x518fc3){_0x411a6e['push'](_0x411a6e['shift']());}};_0xfbb021(++_0x38978e);}(_0xd760,0x17a));var _0x0d76=function(_0x36f794,_0x13ad32){_0x36f794=_0x36f794-0x0;var _0x51f23b=_0xd760[_0x36f794];return _0x51f23b;};'use strict';var multer=require(_0x0d76('0x0'));var util=require(_0x0d76('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0d76('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0d76('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0d76('0x4'));var controller=require(_0x0d76('0x5'));router[_0x0d76('0x6')]('/',auth[_0x0d76('0x7')](),controller['index']);router[_0x0d76('0x6')]('/describe',auth[_0x0d76('0x7')](),controller[_0x0d76('0x8')]);router[_0x0d76('0x6')](_0x0d76('0x9'),auth[_0x0d76('0x7')](),controller[_0x0d76('0xa')]);router[_0x0d76('0xb')]('/',auth[_0x0d76('0x7')](),interaction[_0x0d76('0xc')]('whatsapp',_0x0d76('0xd')),controller[_0x0d76('0xe')]);router[_0x0d76('0xb')]('/:id/status',controller[_0x0d76('0xf')]);router[_0x0d76('0x10')](_0x0d76('0x9'),auth[_0x0d76('0x7')](),controller[_0x0d76('0x11')]);router[_0x0d76('0x10')]('/:id/accept',auth[_0x0d76('0x7')](),controller[_0x0d76('0x12')]);router[_0x0d76('0x10')](_0x0d76('0x13'),auth[_0x0d76('0x7')](),controller['reject']);router[_0x0d76('0x14')](_0x0d76('0x9'),auth['isAuthenticated'](),controller[_0x0d76('0x15')]);module[_0x0d76('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 4f49301..07d5180 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 _0xd34e=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x374d83,_0x5f200d){var _0x539c7f=function(_0x2acbf8){while(--_0x2acbf8){_0x374d83['push'](_0x374d83['shift']());}};_0x539c7f(++_0x5f200d);}(_0xd34e,0x1d6));var _0xed34=function(_0x42b804,_0x523ade){_0x42b804=_0x42b804-0x0;var _0x1777fe=_0xd34e[_0x42b804];return _0x1777fe;};'use strict';var Sequelize=require(_0xed34('0x0'));module[_0xed34('0x1')]={'body':{'type':Sequelize[_0xed34('0x2')](_0xed34('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xed34('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xed34('0x5')]('in','out'),'defaultValue':_0xed34('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xed34('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xed34('0x8')]},'secret':{'type':Sequelize[_0xed34('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xed34('0x7')]},'providerResponse':{'type':Sequelize[_0xed34('0x2')]}}; \ No newline at end of file +var _0xc1bf=['DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x4e53f3,_0x46a9e3){var _0x4273d4=function(_0xbeb00f){while(--_0xbeb00f){_0x4e53f3['push'](_0x4e53f3['shift']());}};_0x4273d4(++_0x46a9e3);}(_0xc1bf,0x79));var _0xfc1b=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0xc1bf[_0x53abe5];return _0xc1c37e;};'use strict';var Sequelize=require(_0xfc1b('0x0'));module[_0xfc1b('0x1')]={'body':{'type':Sequelize[_0xfc1b('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xfc1b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfc1b('0x4')]('in',_0xfc1b('0x5')),'defaultValue':_0xfc1b('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xfc1b('0x6')](0xbe)},'phone':{'type':Sequelize[_0xfc1b('0x6')]},'readAt':{'type':Sequelize[_0xfc1b('0x7')]},'secret':{'type':Sequelize[_0xfc1b('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xfc1b('0x6')]},'providerResponse':{'type':Sequelize[_0xfc1b('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 9f4d548..e6cc3a1 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 _0x0472=['received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp','WhatsappInteraction','get','RejectMessage','rejectMessage','sequelize','User','fullname','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s'];(function(_0x5a8cc0,_0x2bf6ed){var _0xbf6bb5=function(_0x2fb560){while(--_0x2fb560){_0x5a8cc0['push'](_0x5a8cc0['shift']());}};_0xbf6bb5(++_0x2bf6ed);}(_0x0472,0x1ad));var _0x2047=function(_0x1ebc88,_0x638cd6){_0x1ebc88=_0x1ebc88-0x0;var _0xcef294=_0x0472[_0x1ebc88];return _0xcef294;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2047('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2047('0x1'));var moment=require(_0x2047('0x2'));var BPromise=require(_0x2047('0x3'));var Mustache=require(_0x2047('0x4'));var util=require(_0x2047('0x5'));var path=require(_0x2047('0x6'));var sox=require('sox');var csv=require(_0x2047('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2047('0x8'));var _=require(_0x2047('0x9'));var squel=require(_0x2047('0xa'));var crypto=require(_0x2047('0xb'));var jsforce=require(_0x2047('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2047('0x7'));var querystring=require(_0x2047('0xd'));var Papa=require(_0x2047('0xe'));var Redis=require(_0x2047('0xf'));var authService=require(_0x2047('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2047('0x11'));var hardwareService=require(_0x2047('0x12'));var logger=require(_0x2047('0x13'))(_0x2047('0x14'));var utils=require(_0x2047('0x15'));var config=require(_0x2047('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2047('0x17'))['db'];config[_0x2047('0x18')]=_['defaults'](config['redis'],{'host':_0x2047('0x19'),'port':0x18eb});var socket=require(_0x2047('0x1a'))(new Redis(config[_0x2047('0x18')]));require(_0x2047('0x1b'))[_0x2047('0x1c')](socket);var jayson=require(_0x2047('0x1d'));var client=jayson[_0x2047('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x2047('0x1e')][_0x2047('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x12f937,_0x4b24c8,_0x628513,_0xd6d71d){return new BPromise(function(_0x59ac39,_0x5f0fec){var _0x5f3d0b=_0xd6d71d||client;return _0x5f3d0b[_0x2047('0x20')](_0x12f937,_0x628513)['then'](function(_0x474744){logger[_0x2047('0x21')](_0x2047('0x22'),_0x4b24c8,_0x2047('0x23'));logger[_0x2047('0x24')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4b24c8,'request\x20sent',JSON[_0x2047('0x25')](_0x474744));if(_0x474744[_0x2047('0x26')]){if(_0x474744[_0x2047('0x26')]['code']===0x1f4){logger[_0x2047('0x26')](_0x2047('0x22'),_0x4b24c8,_0x474744[_0x2047('0x26')]['message']);return _0x5f0fec(_0x474744[_0x2047('0x26')][_0x2047('0x27')]);}logger[_0x2047('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x4b24c8,_0x474744['error'][_0x2047('0x27')]);return _0x59ac39(_0x474744['error'][_0x2047('0x27')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4b24c8,'request\x20sent');_0x59ac39(_0x474744['result'][_0x2047('0x27')]);}})['catch'](function(_0x2b5810){logger[_0x2047('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x4b24c8,_0x2b5810);_0x5f0fec(_0x2b5810);});});}function respondWithStatusCode(_0x45eb96,_0x49fe01){_0x49fe01=_0x49fe01||0xcc;return function(_0x25bebf){if(_0x25bebf){return _0x45eb96['sendStatus'](_0x49fe01);}return _0x45eb96['status'](_0x49fe01)['end']();};}function respondWithResult(_0x42e447,_0x21e7ac){_0x21e7ac=_0x21e7ac||0xc8;return function(_0x54d5b3){if(_0x54d5b3){return _0x42e447['status'](_0x21e7ac)[_0x2047('0x28')](_0x54d5b3);}};}function respondWithFilteredResult(_0x12e538,_0x25a398){return function(_0x4163ca){if(_0x4163ca){var _0x2851b4=typeof _0x25a398[_0x2047('0x29')]===_0x2047('0x2a')&&typeof _0x25a398[_0x2047('0x2b')]==='undefined';var _0x4311be=_0x4163ca[_0x2047('0x2c')];var _0x4a6231=_0x2851b4?0x0:_0x25a398['offset'];var _0x71217d=_0x2851b4?_0x4163ca[_0x2047('0x2c')]:_0x25a398[_0x2047('0x29')]+_0x25a398[_0x2047('0x2b')];var _0x22b457;if(_0x71217d>=_0x4311be){_0x71217d=_0x4311be;_0x22b457=0xc8;}else{_0x22b457=0xce;}_0x12e538[_0x2047('0x2d')](_0x22b457);return _0x12e538[_0x2047('0x2e')]('Content-Range',_0x4a6231+'-'+_0x71217d+'/'+_0x4311be)['json'](_0x4163ca);}return null;};}function patchUpdates(_0x378790){return function(_0x3a7f63){try{jsonpatch[_0x2047('0x2f')](_0x3a7f63,_0x378790,!![]);}catch(_0x57b97f){return BPromise[_0x2047('0x30')](_0x57b97f);}return _0x3a7f63[_0x2047('0x31')]();};}function saveUpdates(_0x595419,_0x39b2da){return function(_0x42a647){if(_0x42a647){return _0x42a647[_0x2047('0x32')](_0x595419)[_0x2047('0x33')](function(_0x32e098){return _0x32e098;});}return null;};}function removeEntity(_0x1c5244,_0x2594c8){return function(_0x8e990d){if(_0x8e990d){return _0x8e990d[_0x2047('0x34')]()[_0x2047('0x33')](function(){_0x1c5244[_0x2047('0x2d')](0xcc)[_0x2047('0x35')]();});}};}function handleEntityNotFound(_0x349b33,_0x3ce6a0){return function(_0x198bba){if(!_0x198bba){_0x349b33[_0x2047('0x36')](0x194);}return _0x198bba;};}function handleError(_0x47c194,_0x345937){_0x345937=_0x345937||0x1f4;return function(_0x1e8313){logger['error'](_0x1e8313[_0x2047('0x37')]);if(_0x1e8313[_0x2047('0x38')]){delete _0x1e8313[_0x2047('0x38')];}_0x47c194[_0x2047('0x2d')](_0x345937)[_0x2047('0x39')](_0x1e8313);};}exports[_0x2047('0x3a')]=function(_0x1936a2,_0x788dc1){var _0x2f2c04={},_0x381b7d={},_0x3fc78e={'count':0x0,'rows':[]};var _0x5cad9d=_[_0x2047('0x3b')](db[_0x2047('0x3c')]['rawAttributes'],function(_0x7d6679){return{'name':_0x7d6679[_0x2047('0x3d')],'type':_0x7d6679[_0x2047('0x3e')][_0x2047('0x3f')]};});_0x381b7d[_0x2047('0x40')]=_[_0x2047('0x3b')](_0x5cad9d,_0x2047('0x38'));_0x381b7d[_0x2047('0x41')]=_[_0x2047('0x42')](_0x1936a2[_0x2047('0x41')]);_0x381b7d['filters']=_['intersection'](_0x381b7d['model'],_0x381b7d['query']);_0x2f2c04[_0x2047('0x43')]=_[_0x2047('0x44')](_0x381b7d[_0x2047('0x40')],qs[_0x2047('0x45')](_0x1936a2['query'][_0x2047('0x45')]));_0x2f2c04[_0x2047('0x43')]=_0x2f2c04['attributes'][_0x2047('0x46')]?_0x2f2c04[_0x2047('0x43')]:_0x381b7d[_0x2047('0x40')];if(!_0x1936a2[_0x2047('0x41')][_0x2047('0x47')](_0x2047('0x48'))){_0x2f2c04['limit']=qs['limit'](_0x1936a2['query'][_0x2047('0x2b')]);_0x2f2c04['offset']=qs[_0x2047('0x29')](_0x1936a2[_0x2047('0x41')]['offset']);}_0x2f2c04[_0x2047('0x49')]=qs[_0x2047('0x4a')](_0x1936a2[_0x2047('0x41')]['sort']);_0x2f2c04[_0x2047('0x4b')]=qs[_0x2047('0x4c')](_['pick'](_0x1936a2[_0x2047('0x41')],_0x381b7d['filters']),_0x5cad9d);if(_0x1936a2['query'][_0x2047('0x4d')]){_0x2f2c04['where']=_[_0x2047('0x4e')](_0x2f2c04[_0x2047('0x4b')],{'$or':_[_0x2047('0x3b')](_0x5cad9d,function(_0x48ebd2){if(_0x48ebd2[_0x2047('0x3e')]!==_0x2047('0x4f')){var _0x30ea7e={};_0x30ea7e[_0x48ebd2[_0x2047('0x38')]]={'$like':'%'+_0x1936a2[_0x2047('0x41')][_0x2047('0x4d')]+'%'};return _0x30ea7e;}})});}_0x2f2c04=_[_0x2047('0x4e')]({},_0x2f2c04,_0x1936a2[_0x2047('0x50')]);var _0x352edd={'where':_0x2f2c04[_0x2047('0x4b')]};return db[_0x2047('0x3c')]['count'](_0x352edd)[_0x2047('0x33')](function(_0xa92a9b){_0x3fc78e[_0x2047('0x2c')]=_0xa92a9b;if(_0x1936a2['query'][_0x2047('0x51')]){_0x2f2c04['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x2047('0x52')](_0x2f2c04);})['then'](function(_0x14edba){_0x3fc78e['rows']=_0x14edba;return _0x3fc78e;})['then'](respondWithFilteredResult(_0x788dc1,_0x2f2c04))[_0x2047('0x53')](handleError(_0x788dc1,null));};exports[_0x2047('0x54')]=function(_0x4162d0,_0x4c1407){var _0xe0fc37={'raw':!![],'where':{'id':_0x4162d0[_0x2047('0x55')]['id']}},_0x35fa7b={};_0x35fa7b[_0x2047('0x40')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x35fa7b['query']=_[_0x2047('0x42')](_0x4162d0[_0x2047('0x41')]);_0x35fa7b[_0x2047('0x4c')]=_[_0x2047('0x44')](_0x35fa7b[_0x2047('0x40')],_0x35fa7b[_0x2047('0x41')]);_0xe0fc37[_0x2047('0x43')]=_[_0x2047('0x44')](_0x35fa7b[_0x2047('0x40')],qs[_0x2047('0x45')](_0x4162d0[_0x2047('0x41')][_0x2047('0x45')]));_0xe0fc37[_0x2047('0x43')]=_0xe0fc37['attributes'][_0x2047('0x46')]?_0xe0fc37[_0x2047('0x43')]:_0x35fa7b[_0x2047('0x40')];if(_0x4162d0['query'][_0x2047('0x51')]){_0xe0fc37[_0x2047('0x56')]=[{'all':!![]}];}_0xe0fc37=_[_0x2047('0x4e')]({},_0xe0fc37,_0x4162d0[_0x2047('0x50')]);return db[_0x2047('0x3c')][_0x2047('0x57')](_0xe0fc37)[_0x2047('0x33')](handleEntityNotFound(_0x4c1407,null))[_0x2047('0x33')](respondWithResult(_0x4c1407,null))[_0x2047('0x53')](handleError(_0x4c1407,null));};exports['create']=function(_0x3a6a70,_0x2a66d9){return db[_0x2047('0x3c')][_0x2047('0x58')](_0x3a6a70['body'],{})[_0x2047('0x33')](respondWithResult(_0x2a66d9,0xc9))[_0x2047('0x53')](handleError(_0x2a66d9,null));};exports[_0x2047('0x32')]=function(_0xad124b,_0x3cf3a7){if(_0xad124b[_0x2047('0x59')]['id']){delete _0xad124b['body']['id'];}return db['WhatsappMessage'][_0x2047('0x57')]({'where':{'id':_0xad124b[_0x2047('0x55')]['id']}})[_0x2047('0x33')](handleEntityNotFound(_0x3cf3a7,null))[_0x2047('0x33')](saveUpdates(_0xad124b['body'],null))[_0x2047('0x33')](respondWithResult(_0x3cf3a7,null))[_0x2047('0x53')](handleError(_0x3cf3a7,null));};exports['destroy']=function(_0x5511ab,_0x9dc063){return db[_0x2047('0x3c')][_0x2047('0x57')]({'where':{'id':_0x5511ab[_0x2047('0x55')]['id']}})[_0x2047('0x33')](handleEntityNotFound(_0x9dc063,null))['then'](removeEntity(_0x9dc063,null))[_0x2047('0x53')](handleError(_0x9dc063,null));};exports[_0x2047('0x5a')]=function(_0x3c391b,_0x8b5f02){return db[_0x2047('0x3c')]['describe']()[_0x2047('0x33')](respondWithResult(_0x8b5f02,null))[_0x2047('0x53')](handleError(_0x8b5f02,null));};var interaction_log=require(_0x2047('0x13'))(_0x2047('0x5b'));exports[_0x2047('0x5c')]=function(_0x24b63f,_0x1190e7,_0x3594d3){var _0x337727={'agent':{},'channel':'whatsapp'};if(_0x24b63f['body']['id']){delete _0x24b63f[_0x2047('0x59')]['id'];}_0x24b63f[_0x2047('0x59')][_0x2047('0x5d')]=!![];_0x24b63f['body'][_0x2047('0x5e')]=moment()[_0x2047('0x5f')](_0x2047('0x60'));_0x24b63f[_0x2047('0x59')]['UserId']=_0x24b63f[_0x2047('0x59')][_0x2047('0x61')]||_0x24b63f['user']['id'];_0x337727[_0x2047('0x62')]['id']=_0x24b63f[_0x2047('0x59')][_0x2047('0x61')];return db[_0x2047('0x3c')][_0x2047('0x57')]({'where':{'id':_0x24b63f[_0x2047('0x55')]['id'],'UserId':null}})[_0x2047('0x33')](handleEntityNotFound(_0x1190e7,null))['then'](saveUpdates(_0x24b63f['body'],null))['then'](function(_0x4c2f81){if(_0x4c2f81){_0x337727[_0x2047('0x27')]=_0x4c2f81['get']({'plain':!![]});return db['WhatsappInteraction'][_0x2047('0x57')]({'where':{'id':_0x4c2f81[_0x2047('0x63')]}});}return null;})[_0x2047('0x33')](handleEntityNotFound(_0x1190e7,null))['then'](function(_0x50cc7f){if(_0x50cc7f){return _0x50cc7f[_0x2047('0x32')]({'UserId':_0x24b63f[_0x2047('0x59')][_0x2047('0x61')],'read1stAt':_['isNil'](_0x50cc7f[_0x2047('0x64')])?moment()[_0x2047('0x5f')](_0x2047('0x60')):undefined});}return null;})[_0x2047('0x33')](function(_0x4e40ef){if(_0x4e40ef){_0x337727[_0x2047('0x65')]=_0x4e40ef['get']({'plain':!![]});interaction_log['info'](_0x2047('0x66'),_0x24b63f[_0x2047('0x67')]['id'],_0x24b63f[_0x2047('0x67')][_0x2047('0x38')],_0x24b63f[_0x2047('0x67')][_0x2047('0x68')],_0x337727['interaction']['id'],_0x24b63f[_0x2047('0x59')]?JSON[_0x2047('0x25')](_0x24b63f[_0x2047('0x59')]):_0x2047('0x69'));return respondWithRpcPromise(_0x2047('0x6a'),_0x2047('0x6b'),_0x337727);}return null;})[_0x2047('0x33')](function(_0x53b072){var _0x34fd44=_0x2047('0x6c')+_0x53b072[_0x2047('0x27')][_0x2047('0x6d')];return db['sequelize']['query'](_0x34fd44,{'type':db[_0x2047('0x6e')]['QueryTypes'][_0x2047('0x6f')],'raw':!![]})[_0x2047('0x33')](function(_0x444047){return _0x444047;});})[_0x2047('0x33')](function(_0x2880a2){if(_0x2880a2){_0x337727[_0x2047('0x27')][_0x2047('0x70')]=_0x2880a2[0x0];if(!_0x24b63f[_0x2047('0x59')][_0x2047('0x61')])return;return db['User'][_0x2047('0x57')]({'where':{'id':_0x24b63f[_0x2047('0x59')][_0x2047('0x61')],'role':_0x2047('0x62')},'attributes':['id',_0x2047('0x38'),'fullname',_0x2047('0x71'),_0x2047('0x72')],'raw':!![]});}return null;})[_0x2047('0x33')](function(_0x4369d1){if(!_0x4369d1)return null;_0x337727[_0x2047('0x27')]['agent']=_0x4369d1;return _0x337727;})['then'](function(_0x33eb67){if(_0x33eb67){if(_0x24b63f['body'][_0x2047('0x73')]){_0x337727[_0x2047('0x27')][_0x2047('0x74')]=util[_0x2047('0x5f')](_0x2047('0x75'),_0x24b63f['user'][_0x2047('0x38')]);_0x337727['message'][_0x2047('0x76')]=_0x337727['channel'];_0x337727['message'][_0x2047('0x77')]=_0x337727[_0x2047('0x76')];_0x337727[_0x2047('0x27')][_0x2047('0x78')]='accept';return respondWithRpcPromise(_0x2047('0x79'),_0x2047('0x79'),{'event':_0x2047('0x7a'),'message':_0x337727[_0x2047('0x27')]},client9002)[_0x2047('0x33')](function(){return _0x337727;});}return _0x337727;}return null;})[_0x2047('0x33')](respondWithResult(_0x1190e7,null))[_0x2047('0x53')](handleError(_0x1190e7,null));};var interaction_log=require(_0x2047('0x13'))(_0x2047('0x5b'));exports[_0x2047('0x30')]=function(_0x4a25f3,_0xcb6d26,_0x3fbaff){var _0x4c63c9={'agent':{},'channel':_0x2047('0x7b')};if(_0x4a25f3[_0x2047('0x59')]['id']){delete _0x4a25f3['body']['id'];}_0x4a25f3[_0x2047('0x59')]['UserId']=_0x4a25f3[_0x2047('0x59')][_0x2047('0x61')]||_0x4a25f3[_0x2047('0x67')]['id'];_0x4c63c9['agent']['id']=_0x4a25f3['body'][_0x2047('0x61')];return db[_0x2047('0x3c')]['find']({'where':{'id':_0x4a25f3[_0x2047('0x55')]['id'],'UserId':null}})[_0x2047('0x33')](handleEntityNotFound(_0xcb6d26,null))[_0x2047('0x33')](function(_0x53f5fd){if(_0x53f5fd){_0x4c63c9[_0x2047('0x27')]=_0x53f5fd['get']({'plain':!![]});return db[_0x2047('0x7c')][_0x2047('0x57')]({'where':{'id':_0x53f5fd[_0x2047('0x63')]}});}return null;})['then'](handleEntityNotFound(_0xcb6d26,null))['then'](function(_0x4ad9e8){if(_0x4ad9e8){_0x4c63c9[_0x2047('0x65')]=_0x4ad9e8[_0x2047('0x7d')]({'plain':!![]});interaction_log[_0x2047('0x21')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a25f3[_0x2047('0x67')]['id'],_0x4a25f3[_0x2047('0x67')][_0x2047('0x38')],_0x4a25f3[_0x2047('0x67')][_0x2047('0x68')],_0x4c63c9['interaction']['id'],_0x4a25f3[_0x2047('0x59')]?JSON[_0x2047('0x25')](_0x4a25f3['body']):_0x2047('0x69'));return respondWithRpcPromise(_0x2047('0x7e'),_0x2047('0x7f'),_0x4c63c9);}return null;})[_0x2047('0x33')](function(_0x2f308a){var _0x370497=_0x2047('0x6c')+_0x2f308a['message'][_0x2047('0x6d')];return db[_0x2047('0x80')][_0x2047('0x41')](_0x370497,{'type':db[_0x2047('0x6e')]['QueryTypes'][_0x2047('0x6f')],'raw':!![]})[_0x2047('0x33')](function(_0x5e0c89){return _0x5e0c89;});})['then'](function(_0x34db48){if(_0x34db48){_0x4c63c9[_0x2047('0x27')][_0x2047('0x70')]=_0x34db48[0x0];if(!_0x4a25f3[_0x2047('0x59')]['UserId'])return;return db[_0x2047('0x81')]['find']({'where':{'id':_0x4a25f3[_0x2047('0x59')]['UserId'],'role':'agent'},'attributes':['id',_0x2047('0x38'),_0x2047('0x82'),_0x2047('0x71'),_0x2047('0x72')],'raw':!![]});}return null;})[_0x2047('0x33')](function(_0x450f34){if(!_0x450f34)return null;_0x4c63c9[_0x2047('0x27')][_0x2047('0x62')]=_0x450f34;return _0x4c63c9;})[_0x2047('0x33')](function(_0x33e313){if(_0x33e313){_0x33e313['message'][_0x2047('0x74')]=util[_0x2047('0x5f')](_0x2047('0x75'),_0x4a25f3['user'][_0x2047('0x38')]);_0x33e313['message'][_0x2047('0x76')]=_0x4c63c9[_0x2047('0x76')];_0x33e313[_0x2047('0x27')][_0x2047('0x77')]=_0x4c63c9['channel'];_0x33e313['message']['event']=_0x2047('0x30');respondWithRpcPromise(_0x2047('0x79'),_0x2047('0x79'),{'event':_0x2047('0x83'),'message':_0x33e313[_0x2047('0x27')]},client9002);return _0x4c63c9;}return null;})[_0x2047('0x33')](respondWithResult(_0xcb6d26,null))[_0x2047('0x53')](handleError(_0xcb6d26,null));};exports['status']=function(_0x57cfa5,_0x89a0ce,_0x5254e5){if(_0x57cfa5[_0x2047('0x59')]['id']){delete _0x57cfa5['body']['id'];}var _0x4733f4;return db[_0x2047('0x3c')][_0x2047('0x57')]({'where':{'id':_0x57cfa5[_0x2047('0x55')]['id']}})[_0x2047('0x33')](handleEntityNotFound(_0x89a0ce,null))['then'](function(_0x2fc8e3){if(_0x2fc8e3){_0x4733f4=_0x2fc8e3;return db[_0x2047('0x84')][_0x2047('0x57')]({'where':{'id':_0x2fc8e3[_0x2047('0x85')]}});}})[_0x2047('0x33')](handleEntityNotFound(_0x89a0ce,null))[_0x2047('0x33')](function(_0x2a64bb){if(_0x2a64bb){logger[_0x2047('0x24')](_0x2047('0x86'),_0x2047('0x2d'),_0x2047('0x87'),_0x2a64bb['type'],util[_0x2047('0x88')](_0x57cfa5[_0x2047('0x59')],{'showHidden':![],'depth':null}));switch(_0x2a64bb['type']){case _0x2047('0x89'):if(_0x57cfa5[_0x2047('0x59')][_0x2047('0x8a')]&&_0x57cfa5[_0x2047('0x59')][_0x2047('0x8a')]===_0x4733f4[_0x2047('0x8b')]&&_0x57cfa5[_0x2047('0x59')]['MessageStatus']&&_0x57cfa5[_0x2047('0x59')]['MessageStatus']===_0x2047('0x5d')){return _0x4733f4[_0x2047('0x32')]({'read':!![]});}else{logger['error'](_0x2047('0x8c'),_0x2047('0x2d'),_0x2047('0x89'),util[_0x2047('0x88')](_0x57cfa5[_0x2047('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x4733f4;}})[_0x2047('0x33')](respondWithResult(_0x89a0ce,null))[_0x2047('0x53')](handleError(_0x89a0ce,null));}; \ No newline at end of file +var _0xfd3a=['null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','Sequelize','QueryTypes','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','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','./whatsappMessage.socket','client','http','request','then','info','debug','request\x20sent','stringify','code','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','map','WhatsappMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','length','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','agent','get','WhatsappInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfd3a,0xb1));var _0xafd3=function(_0x24aa5c,_0x4ee4d3){_0x24aa5c=_0x24aa5c-0x0;var _0x19eb18=_0xfd3a[_0x24aa5c];return _0x19eb18;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xafd3('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xafd3('0x1'));var BPromise=require(_0xafd3('0x2'));var Mustache=require('mustache');var util=require(_0xafd3('0x3'));var path=require(_0xafd3('0x4'));var sox=require(_0xafd3('0x5'));var csv=require('to-csv');var ejs=require(_0xafd3('0x6'));var fs=require('fs');var fs_extra=require(_0xafd3('0x7'));var _=require(_0xafd3('0x8'));var squel=require(_0xafd3('0x9'));var crypto=require('crypto');var jsforce=require(_0xafd3('0xa'));var deskjs=require(_0xafd3('0xb'));var toCsv=require(_0xafd3('0xc'));var querystring=require('querystring');var Papa=require(_0xafd3('0xd'));var Redis=require(_0xafd3('0xe'));var authService=require(_0xafd3('0xf'));var qs=require(_0xafd3('0x10'));var as=require(_0xafd3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xafd3('0x12'))(_0xafd3('0x13'));var utils=require(_0xafd3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xafd3('0x15'));var db=require('../../mysqldb')['db'];config[_0xafd3('0x16')]=_[_0xafd3('0x17')](config[_0xafd3('0x16')],{'host':_0xafd3('0x18'),'port':0x18eb});var socket=require(_0xafd3('0x19'))(new Redis(config['redis']));require(_0xafd3('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xafd3('0x1b')][_0xafd3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x38d2ca,_0x30b33c,_0x32a27b,_0x4ecee8){return new BPromise(function(_0x18f033,_0xff3ad9){var _0x1d1c33=_0x4ecee8||client;return _0x1d1c33[_0xafd3('0x1d')](_0x38d2ca,_0x32a27b)[_0xafd3('0x1e')](function(_0x5195c9){logger[_0xafd3('0x1f')]('WhatsappMessage,\x20%s,\x20%s',_0x30b33c,'request\x20sent');logger[_0xafd3('0x20')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x30b33c,_0xafd3('0x21'),JSON[_0xafd3('0x22')](_0x5195c9));if(_0x5195c9['error']){if(_0x5195c9['error'][_0xafd3('0x23')]===0x1f4){logger[_0xafd3('0x24')](_0xafd3('0x25'),_0x30b33c,_0x5195c9[_0xafd3('0x24')]['message']);return _0xff3ad9(_0x5195c9['error']['message']);}logger[_0xafd3('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x30b33c,_0x5195c9[_0xafd3('0x24')][_0xafd3('0x26')]);return _0x18f033(_0x5195c9[_0xafd3('0x24')][_0xafd3('0x26')]);}else{logger['info'](_0xafd3('0x25'),_0x30b33c,'request\x20sent');_0x18f033(_0x5195c9[_0xafd3('0x27')]['message']);}})[_0xafd3('0x28')](function(_0x18d0e0){logger[_0xafd3('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x30b33c,_0x18d0e0);_0xff3ad9(_0x18d0e0);});});}function respondWithStatusCode(_0x313c11,_0x1a701f){_0x1a701f=_0x1a701f||0xcc;return function(_0x2f990c){if(_0x2f990c){return _0x313c11[_0xafd3('0x29')](_0x1a701f);}return _0x313c11[_0xafd3('0x2a')](_0x1a701f)[_0xafd3('0x2b')]();};}function respondWithResult(_0x32c701,_0x27cd75){_0x27cd75=_0x27cd75||0xc8;return function(_0x19b6ac){if(_0x19b6ac){return _0x32c701[_0xafd3('0x2a')](_0x27cd75)['json'](_0x19b6ac);}};}function respondWithFilteredResult(_0x33f582,_0x50f73d){return function(_0x44313f){if(_0x44313f){var _0xf49f58=typeof _0x50f73d[_0xafd3('0x2c')]===_0xafd3('0x2d')&&typeof _0x50f73d[_0xafd3('0x2e')]==='undefined';var _0x2a5757=_0x44313f[_0xafd3('0x2f')];var _0x102b29=_0xf49f58?0x0:_0x50f73d['offset'];var _0x687cf0=_0xf49f58?_0x44313f[_0xafd3('0x2f')]:_0x50f73d[_0xafd3('0x2c')]+_0x50f73d[_0xafd3('0x2e')];var _0x271115;if(_0x687cf0>=_0x2a5757){_0x687cf0=_0x2a5757;_0x271115=0xc8;}else{_0x271115=0xce;}_0x33f582['status'](_0x271115);return _0x33f582[_0xafd3('0x30')](_0xafd3('0x31'),_0x102b29+'-'+_0x687cf0+'/'+_0x2a5757)['json'](_0x44313f);}return null;};}function patchUpdates(_0xe096d8){return function(_0xbcc866){try{jsonpatch[_0xafd3('0x32')](_0xbcc866,_0xe096d8,!![]);}catch(_0x17cfcb){return BPromise[_0xafd3('0x33')](_0x17cfcb);}return _0xbcc866[_0xafd3('0x34')]();};}function saveUpdates(_0x236706,_0x5557a3){return function(_0x5a3f17){if(_0x5a3f17){return _0x5a3f17[_0xafd3('0x35')](_0x236706)[_0xafd3('0x1e')](function(_0x3d8c9c){return _0x3d8c9c;});}return null;};}function removeEntity(_0x22583b,_0x345bb4){return function(_0x4b5f27){if(_0x4b5f27){return _0x4b5f27[_0xafd3('0x36')]()['then'](function(){_0x22583b[_0xafd3('0x2a')](0xcc)[_0xafd3('0x2b')]();});}};}function handleEntityNotFound(_0x5bbdde,_0x2e2e65){return function(_0x598863){if(!_0x598863){_0x5bbdde[_0xafd3('0x29')](0x194);}return _0x598863;};}function handleError(_0x4dbb3d,_0x74f86f){_0x74f86f=_0x74f86f||0x1f4;return function(_0x1ac5f0){logger[_0xafd3('0x24')](_0x1ac5f0[_0xafd3('0x37')]);if(_0x1ac5f0['name']){delete _0x1ac5f0[_0xafd3('0x38')];}_0x4dbb3d[_0xafd3('0x2a')](_0x74f86f)['send'](_0x1ac5f0);};}exports['index']=function(_0x1bf14d,_0x494a15){var _0xf8c937={},_0x3fb278={},_0x397fa4={'count':0x0,'rows':[]};var _0x24b3de=_[_0xafd3('0x39')](db[_0xafd3('0x3a')][_0xafd3('0x3b')],function(_0x382f8b){return{'name':_0x382f8b['fieldName'],'type':_0x382f8b[_0xafd3('0x3c')][_0xafd3('0x3d')]};});_0x3fb278[_0xafd3('0x3e')]=_['map'](_0x24b3de,'name');_0x3fb278[_0xafd3('0x3f')]=_[_0xafd3('0x40')](_0x1bf14d[_0xafd3('0x3f')]);_0x3fb278[_0xafd3('0x41')]=_[_0xafd3('0x42')](_0x3fb278[_0xafd3('0x3e')],_0x3fb278[_0xafd3('0x3f')]);_0xf8c937[_0xafd3('0x43')]=_[_0xafd3('0x42')](_0x3fb278[_0xafd3('0x3e')],qs[_0xafd3('0x44')](_0x1bf14d[_0xafd3('0x3f')][_0xafd3('0x44')]));_0xf8c937['attributes']=_0xf8c937[_0xafd3('0x43')]['length']?_0xf8c937[_0xafd3('0x43')]:_0x3fb278['model'];if(!_0x1bf14d['query'][_0xafd3('0x45')]('nolimit')){_0xf8c937['limit']=qs[_0xafd3('0x2e')](_0x1bf14d[_0xafd3('0x3f')][_0xafd3('0x2e')]);_0xf8c937[_0xafd3('0x2c')]=qs[_0xafd3('0x2c')](_0x1bf14d[_0xafd3('0x3f')]['offset']);}_0xf8c937[_0xafd3('0x46')]=qs[_0xafd3('0x47')](_0x1bf14d['query']['sort']);_0xf8c937[_0xafd3('0x48')]=qs[_0xafd3('0x41')](_[_0xafd3('0x49')](_0x1bf14d[_0xafd3('0x3f')],_0x3fb278[_0xafd3('0x41')]),_0x24b3de);if(_0x1bf14d['query'][_0xafd3('0x4a')]){_0xf8c937[_0xafd3('0x48')]=_[_0xafd3('0x4b')](_0xf8c937[_0xafd3('0x48')],{'$or':_['map'](_0x24b3de,function(_0x1539eb){if(_0x1539eb[_0xafd3('0x3c')]!=='VIRTUAL'){var _0x54b3b3={};_0x54b3b3[_0x1539eb[_0xafd3('0x38')]]={'$like':'%'+_0x1bf14d['query'][_0xafd3('0x4a')]+'%'};return _0x54b3b3;}})});}_0xf8c937=_['merge']({},_0xf8c937,_0x1bf14d['options']);var _0x3da062={'where':_0xf8c937[_0xafd3('0x48')]};return db[_0xafd3('0x3a')][_0xafd3('0x2f')](_0x3da062)[_0xafd3('0x1e')](function(_0x3eabd3){_0x397fa4['count']=_0x3eabd3;if(_0x1bf14d[_0xafd3('0x3f')][_0xafd3('0x4c')]){_0xf8c937[_0xafd3('0x4d')]=[{'all':!![]}];}return db[_0xafd3('0x3a')][_0xafd3('0x4e')](_0xf8c937);})['then'](function(_0x4f5a47){_0x397fa4[_0xafd3('0x4f')]=_0x4f5a47;return _0x397fa4;})[_0xafd3('0x1e')](respondWithFilteredResult(_0x494a15,_0xf8c937))[_0xafd3('0x28')](handleError(_0x494a15,null));};exports[_0xafd3('0x50')]=function(_0x460dfe,_0x268023){var _0x32a7aa={'raw':!![],'where':{'id':_0x460dfe[_0xafd3('0x51')]['id']}},_0x3a5341={};_0x3a5341[_0xafd3('0x3e')]=_[_0xafd3('0x40')](db['WhatsappMessage'][_0xafd3('0x3b')]);_0x3a5341[_0xafd3('0x3f')]=_[_0xafd3('0x40')](_0x460dfe[_0xafd3('0x3f')]);_0x3a5341[_0xafd3('0x41')]=_[_0xafd3('0x42')](_0x3a5341[_0xafd3('0x3e')],_0x3a5341[_0xafd3('0x3f')]);_0x32a7aa[_0xafd3('0x43')]=_['intersection'](_0x3a5341[_0xafd3('0x3e')],qs[_0xafd3('0x44')](_0x460dfe[_0xafd3('0x3f')][_0xafd3('0x44')]));_0x32a7aa[_0xafd3('0x43')]=_0x32a7aa['attributes'][_0xafd3('0x52')]?_0x32a7aa[_0xafd3('0x43')]:_0x3a5341[_0xafd3('0x3e')];if(_0x460dfe[_0xafd3('0x3f')][_0xafd3('0x4c')]){_0x32a7aa[_0xafd3('0x4d')]=[{'all':!![]}];}_0x32a7aa=_[_0xafd3('0x4b')]({},_0x32a7aa,_0x460dfe['options']);return db[_0xafd3('0x3a')]['find'](_0x32a7aa)[_0xafd3('0x1e')](handleEntityNotFound(_0x268023,null))[_0xafd3('0x1e')](respondWithResult(_0x268023,null))['catch'](handleError(_0x268023,null));};exports[_0xafd3('0x53')]=function(_0x565bf8,_0x3ba71){return db[_0xafd3('0x3a')][_0xafd3('0x53')](_0x565bf8[_0xafd3('0x54')],{})[_0xafd3('0x1e')](respondWithResult(_0x3ba71,0xc9))[_0xafd3('0x28')](handleError(_0x3ba71,null));};exports[_0xafd3('0x35')]=function(_0x27dba5,_0x397702){if(_0x27dba5[_0xafd3('0x54')]['id']){delete _0x27dba5['body']['id'];}return db[_0xafd3('0x3a')][_0xafd3('0x55')]({'where':{'id':_0x27dba5[_0xafd3('0x51')]['id']}})[_0xafd3('0x1e')](handleEntityNotFound(_0x397702,null))[_0xafd3('0x1e')](saveUpdates(_0x27dba5[_0xafd3('0x54')],null))['then'](respondWithResult(_0x397702,null))[_0xafd3('0x28')](handleError(_0x397702,null));};exports['destroy']=function(_0x1ed837,_0x5b86e5){return db[_0xafd3('0x3a')][_0xafd3('0x55')]({'where':{'id':_0x1ed837[_0xafd3('0x51')]['id']}})[_0xafd3('0x1e')](handleEntityNotFound(_0x5b86e5,null))[_0xafd3('0x1e')](removeEntity(_0x5b86e5,null))[_0xafd3('0x28')](handleError(_0x5b86e5,null));};exports['describe']=function(_0x4c3c3b,_0x5a28ef){return db[_0xafd3('0x3a')][_0xafd3('0x56')]()[_0xafd3('0x1e')](respondWithResult(_0x5a28ef,null))[_0xafd3('0x28')](handleError(_0x5a28ef,null));};var interaction_log=require(_0xafd3('0x12'))(_0xafd3('0x57'));exports[_0xafd3('0x58')]=function(_0x57f38e,_0x1d09cc,_0x5bb5f9){var _0x94205e={'agent':{},'channel':_0xafd3('0x59')};if(_0x57f38e[_0xafd3('0x54')]['id']){delete _0x57f38e[_0xafd3('0x54')]['id'];}_0x57f38e['body'][_0xafd3('0x5a')]=!![];_0x57f38e[_0xafd3('0x54')][_0xafd3('0x5b')]=moment()[_0xafd3('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x57f38e[_0xafd3('0x54')][_0xafd3('0x5d')]=_0x57f38e[_0xafd3('0x54')][_0xafd3('0x5d')]||_0x57f38e['user']['id'];_0x94205e[_0xafd3('0x5e')]['id']=_0x57f38e[_0xafd3('0x54')]['UserId'];return db[_0xafd3('0x3a')][_0xafd3('0x55')]({'where':{'id':_0x57f38e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1d09cc,null))[_0xafd3('0x1e')](saveUpdates(_0x57f38e[_0xafd3('0x54')],null))[_0xafd3('0x1e')](function(_0x2483f0){if(_0x2483f0){_0x94205e['message']=_0x2483f0[_0xafd3('0x5f')]({'plain':!![]});return db['WhatsappInteraction'][_0xafd3('0x55')]({'where':{'id':_0x2483f0[_0xafd3('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x1d09cc,null))[_0xafd3('0x1e')](function(_0x4f6ee1){if(_0x4f6ee1){return _0x4f6ee1[_0xafd3('0x35')]({'UserId':_0x57f38e[_0xafd3('0x54')][_0xafd3('0x5d')],'read1stAt':_['isNil'](_0x4f6ee1[_0xafd3('0x61')])?moment()['format'](_0xafd3('0x62')):undefined});}return null;})[_0xafd3('0x1e')](function(_0x3cf0d7){if(_0x3cf0d7){_0x94205e[_0xafd3('0x63')]=_0x3cf0d7[_0xafd3('0x5f')]({'plain':!![]});interaction_log[_0xafd3('0x1f')](_0xafd3('0x64'),_0x57f38e[_0xafd3('0x65')]['id'],_0x57f38e[_0xafd3('0x65')][_0xafd3('0x38')],_0x57f38e[_0xafd3('0x65')][_0xafd3('0x66')],_0x94205e['interaction']['id'],_0x57f38e[_0xafd3('0x54')]?JSON[_0xafd3('0x22')](_0x57f38e[_0xafd3('0x54')]):_0xafd3('0x67'));return respondWithRpcPromise(_0xafd3('0x68'),_0xafd3('0x69'),_0x94205e);}return null;})[_0xafd3('0x1e')](function(_0x314e41){var _0x31a58a=_0xafd3('0x6a')+_0x314e41['message'][_0xafd3('0x6b')];return db['sequelize']['query'](_0x31a58a,{'type':db['Sequelize']['QueryTypes'][_0xafd3('0x6c')],'raw':!![]})[_0xafd3('0x1e')](function(_0x3fbcdc){return _0x3fbcdc;});})[_0xafd3('0x1e')](function(_0x1a9eb){if(_0x1a9eb){_0x94205e[_0xafd3('0x26')][_0xafd3('0x6d')]=_0x1a9eb[0x0];if(!_0x57f38e[_0xafd3('0x54')][_0xafd3('0x5d')])return;return db[_0xafd3('0x6e')][_0xafd3('0x55')]({'where':{'id':_0x57f38e[_0xafd3('0x54')][_0xafd3('0x5d')],'role':_0xafd3('0x5e')},'attributes':['id','name',_0xafd3('0x6f'),_0xafd3('0x70'),_0xafd3('0x71')],'raw':!![]});}return null;})[_0xafd3('0x1e')](function(_0x4ead0b){if(!_0x4ead0b)return null;_0x94205e[_0xafd3('0x26')]['agent']=_0x4ead0b;return _0x94205e;})[_0xafd3('0x1e')](function(_0x1007a1){if(_0x1007a1){if(_0x57f38e[_0xafd3('0x54')][_0xafd3('0x72')]){_0x94205e[_0xafd3('0x26')][_0xafd3('0x73')]=util[_0xafd3('0x5c')](_0xafd3('0x74'),_0x57f38e[_0xafd3('0x65')][_0xafd3('0x38')]);_0x94205e['message']['channel']=_0x94205e[_0xafd3('0x75')];_0x94205e[_0xafd3('0x26')][_0xafd3('0x76')]=_0x94205e[_0xafd3('0x75')];_0x94205e['message']['event']=_0xafd3('0x58');return respondWithRpcPromise(_0xafd3('0x77'),_0xafd3('0x77'),{'event':_0xafd3('0x78'),'message':_0x94205e['message']},client9002)[_0xafd3('0x1e')](function(){return _0x94205e;});}return _0x94205e;}return null;})['then'](respondWithResult(_0x1d09cc,null))['catch'](handleError(_0x1d09cc,null));};var interaction_log=require(_0xafd3('0x12'))(_0xafd3('0x57'));exports[_0xafd3('0x33')]=function(_0xac3874,_0x334575,_0x19fbaa){var _0x39c9cd={'agent':{},'channel':_0xafd3('0x59')};if(_0xac3874['body']['id']){delete _0xac3874[_0xafd3('0x54')]['id'];}_0xac3874[_0xafd3('0x54')][_0xafd3('0x5d')]=_0xac3874[_0xafd3('0x54')]['UserId']||_0xac3874[_0xafd3('0x65')]['id'];_0x39c9cd[_0xafd3('0x5e')]['id']=_0xac3874[_0xafd3('0x54')][_0xafd3('0x5d')];return db[_0xafd3('0x3a')][_0xafd3('0x55')]({'where':{'id':_0xac3874[_0xafd3('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x334575,null))[_0xafd3('0x1e')](function(_0x468579){if(_0x468579){_0x39c9cd[_0xafd3('0x26')]=_0x468579[_0xafd3('0x5f')]({'plain':!![]});return db[_0xafd3('0x79')][_0xafd3('0x55')]({'where':{'id':_0x468579['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x334575,null))[_0xafd3('0x1e')](function(_0x5e7351){if(_0x5e7351){_0x39c9cd['interaction']=_0x5e7351[_0xafd3('0x5f')]({'plain':!![]});interaction_log[_0xafd3('0x1f')](_0xafd3('0x7a'),_0xac3874[_0xafd3('0x65')]['id'],_0xac3874[_0xafd3('0x65')][_0xafd3('0x38')],_0xac3874[_0xafd3('0x65')][_0xafd3('0x66')],_0x39c9cd[_0xafd3('0x63')]['id'],_0xac3874['body']?JSON[_0xafd3('0x22')](_0xac3874[_0xafd3('0x54')]):'null');return respondWithRpcPromise(_0xafd3('0x7b'),_0xafd3('0x7c'),_0x39c9cd);}return null;})[_0xafd3('0x1e')](function(_0x48c33e){var _0x2ea29e=_0xafd3('0x6a')+_0x48c33e[_0xafd3('0x26')][_0xafd3('0x6b')];return db[_0xafd3('0x7d')][_0xafd3('0x3f')](_0x2ea29e,{'type':db[_0xafd3('0x7e')][_0xafd3('0x7f')][_0xafd3('0x6c')],'raw':!![]})[_0xafd3('0x1e')](function(_0x573ed6){return _0x573ed6;});})[_0xafd3('0x1e')](function(_0x4416fa){if(_0x4416fa){_0x39c9cd[_0xafd3('0x26')][_0xafd3('0x6d')]=_0x4416fa[0x0];if(!_0xac3874[_0xafd3('0x54')][_0xafd3('0x5d')])return;return db['User']['find']({'where':{'id':_0xac3874[_0xafd3('0x54')][_0xafd3('0x5d')],'role':'agent'},'attributes':['id',_0xafd3('0x38'),_0xafd3('0x6f'),_0xafd3('0x70'),'internal'],'raw':!![]});}return null;})[_0xafd3('0x1e')](function(_0x57c84a){if(!_0x57c84a)return null;_0x39c9cd['message']['agent']=_0x57c84a;return _0x39c9cd;})[_0xafd3('0x1e')](function(_0x58c3d5){if(_0x58c3d5){_0x58c3d5['message'][_0xafd3('0x73')]=util[_0xafd3('0x5c')](_0xafd3('0x74'),_0xac3874['user']['name']);_0x58c3d5[_0xafd3('0x26')][_0xafd3('0x75')]=_0x39c9cd[_0xafd3('0x75')];_0x58c3d5['message'][_0xafd3('0x76')]=_0x39c9cd[_0xafd3('0x75')];_0x58c3d5['message'][_0xafd3('0x80')]=_0xafd3('0x33');respondWithRpcPromise(_0xafd3('0x77'),_0xafd3('0x77'),{'event':_0xafd3('0x81'),'message':_0x58c3d5[_0xafd3('0x26')]},client9002);return _0x39c9cd;}return null;})[_0xafd3('0x1e')](respondWithResult(_0x334575,null))[_0xafd3('0x28')](handleError(_0x334575,null));};exports[_0xafd3('0x2a')]=function(_0x287ecb,_0x34f0df,_0x3dfb43){if(_0x287ecb[_0xafd3('0x54')]['id']){delete _0x287ecb[_0xafd3('0x54')]['id'];}var _0x267ff2;return db[_0xafd3('0x3a')]['find']({'where':{'id':_0x287ecb[_0xafd3('0x51')]['id']}})[_0xafd3('0x1e')](handleEntityNotFound(_0x34f0df,null))[_0xafd3('0x1e')](function(_0x4eaaf3){if(_0x4eaaf3){_0x267ff2=_0x4eaaf3;return db[_0xafd3('0x82')][_0xafd3('0x55')]({'where':{'id':_0x4eaaf3[_0xafd3('0x83')]}});}})['then'](handleEntityNotFound(_0x34f0df,null))[_0xafd3('0x1e')](function(_0x4aa055){if(_0x4aa055){logger[_0xafd3('0x20')](_0xafd3('0x84'),_0xafd3('0x2a'),_0xafd3('0x85'),_0x4aa055[_0xafd3('0x3c')],util[_0xafd3('0x86')](_0x287ecb[_0xafd3('0x54')],{'showHidden':![],'depth':null}));switch(_0x4aa055['type']){case _0xafd3('0x87'):if(_0x287ecb[_0xafd3('0x54')][_0xafd3('0x88')]&&_0x287ecb[_0xafd3('0x54')]['MessageSid']===_0x267ff2[_0xafd3('0x89')]&&_0x287ecb[_0xafd3('0x54')][_0xafd3('0x8a')]&&_0x287ecb[_0xafd3('0x54')][_0xafd3('0x8a')]==='read'){return _0x267ff2[_0xafd3('0x35')]({'read':!![]});}else{logger[_0xafd3('0x24')](_0xafd3('0x8b'),_0xafd3('0x2a'),_0xafd3('0x87'),util[_0xafd3('0x86')](_0x287ecb['body'],{'showHidden':![],'depth':null}));}break;}return _0x267ff2;}})['then'](respondWithResult(_0x34f0df,null))[_0xafd3('0x28')](handleError(_0x34f0df,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 5968dd2..fdb7e56 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 _0xefda=['save','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x39be5c,_0x47de2f){var _0x57a9a5=function(_0x42517e){while(--_0x42517e){_0x39be5c['push'](_0x39be5c['shift']());}};_0x57a9a5(++_0x47de2f);}(_0xefda,0x96));var _0xaefd=function(_0x4780d5,_0x2e9f87){_0x4780d5=_0x4780d5-0x0;var _0x2dc425=_0xefda[_0x4780d5];return _0x2dc425;};'use strict';var EventEmitter=require(_0xaefd('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xaefd('0x1')](0x0);var events={'afterCreate':_0xaefd('0x2'),'afterUpdate':'update','afterDestroy':_0xaefd('0x3')};function emitEvent(_0x1c65db){return function(_0x2ade44,_0x22df24,_0x1ef6b4){WhatsappMessageEvents[_0xaefd('0x4')](_0x1c65db+':'+_0x2ade44['id'],_0x2ade44);WhatsappMessageEvents['emit'](_0x1c65db,_0x2ade44);_0x1ef6b4(null);};}for(var e in events){if(events[_0xaefd('0x5')](e)){var event=events[e];WhatsappMessage[_0xaefd('0x6')](e,emitEvent(event));}}module[_0xaefd('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x6b24=['../../mysqldb','WhatsappMessage','setMaxListeners','save','emit','exports'];(function(_0x2d5805,_0x21954e){var _0x1cae4f=function(_0x53ff24){while(--_0x53ff24){_0x2d5805['push'](_0x2d5805['shift']());}};_0x1cae4f(++_0x21954e);}(_0x6b24,0x1ce));var _0x46b2=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x6b24[_0x33032e];return _0x13316b;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x46b2('0x0'))['db'][_0x46b2('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x46b2('0x2')](0x0);var events={'afterCreate':_0x46b2('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4cfef4){return function(_0x304ab5,_0x53ee5c,_0x186cda){WhatsappMessageEvents['emit'](_0x4cfef4+':'+_0x304ab5['id'],_0x304ab5);WhatsappMessageEvents[_0x46b2('0x4')](_0x4cfef4,_0x304ab5);_0x186cda(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x46b2('0x5')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 7afc787..94ccb40 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 _0x0e6b=['messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','secret','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','catch','error','out','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','whatsapp_messages'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0e6b,0x17d));var _0xb0e6=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x0e6b[_0x75f869];return _0x10af8b;};'use strict';var _=require(_0xb0e6('0x0'));var util=require('util');var logger=require(_0xb0e6('0x1'))('api');var moment=require(_0xb0e6('0x2'));var BPromise=require(_0xb0e6('0x3'));var rp=require(_0xb0e6('0x4'));var fs=require('fs');var path=require(_0xb0e6('0x5'));var rimraf=require(_0xb0e6('0x6'));var config=require(_0xb0e6('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0xb0e6('0x8')]=function(_0x190ab0,_0x2eb5dc){return _0x190ab0[_0xb0e6('0x9')]('WhatsappMessage',attributes,{'tableName':_0xb0e6('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xb0e6('0xb')]},{'name':_0xb0e6('0xc'),'fields':[_0xb0e6('0xd')],'type':_0xb0e6('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x394ae2,_0x2eebba,_0x4a1ca1){var _0x457081=_0x190ab0['models'];var _0x3a647f=_0x394ae2[_0xb0e6('0xf')]({'plain':!![]});if(_0x3a647f[_0xb0e6('0x10')][_0xb0e6('0x11')]()==='in'||_0x3a647f[_0xb0e6('0x10')][_0xb0e6('0x11')]()==='out'&&!_0x3a647f[_0xb0e6('0x12')]&&!_['isNil'](_0x3a647f[_0xb0e6('0x13')])){_0x457081[_0xb0e6('0x14')]['findOne']({'where':{'id':_0x3a647f[_0xb0e6('0x15')]}})[_0xb0e6('0x16')](function(_0xceaaf7){if(_0xceaaf7){_0xceaaf7[_0xb0e6('0x17')]({'lastMsgAt':_0x3a647f[_0xb0e6('0x18')],'lastMsgDirection':_0x3a647f[_0xb0e6('0x10')][_0xb0e6('0x11')]()});}})[_0xb0e6('0x19')](function(_0x5b0d68){console[_0xb0e6('0x1a')](_0x5b0d68);});}if(_0x3a647f[_0xb0e6('0x10')]===_0xb0e6('0x1b')&&!_0x3a647f[_0xb0e6('0x12')]){var _0x150f74;_0x457081[_0xb0e6('0x1c')]['find']({'where':{'id':_0x3a647f[_0xb0e6('0x1d')]},'raw':!![]})[_0xb0e6('0x16')](function(_0x179c92){_0x150f74=_0x179c92;if(_0x150f74&&_0x150f74['type']){switch(_0x150f74[_0xb0e6('0x1e')]){case _0xb0e6('0x1f'):var _0x1f03e1=require(_0xb0e6('0x1f'));if(_0x150f74[_0xb0e6('0x20')]&&_0x150f74[_0xb0e6('0x21')]&&_0x150f74[_0xb0e6('0x22')]){var _0xa4b6d9=new _0x1f03e1(_0x150f74[_0xb0e6('0x20')],_0x150f74['authToken']);_0xa4b6d9[_0xb0e6('0x23')][_0xb0e6('0x24')]({'body':_0x3a647f[_0xb0e6('0xd')],'to':_0xb0e6('0x25')+_0x3a647f['phone'],'from':_0xb0e6('0x25')+_0x150f74[_0xb0e6('0x22')],'statusCallback':_0x150f74[_0xb0e6('0x26')]+_0xb0e6('0x27')+_0x3a647f['id']+_0xb0e6('0x28')+_0x150f74[_0xb0e6('0x29')]})[_0xb0e6('0x16')](function(_0x2e358c){if(_0x2e358c['sid']){return _0x394ae2[_0xb0e6('0x17')]({'messageId':_0x2e358c[_0xb0e6('0x2a')]});}})[_0xb0e6('0x19')](function(_0x5e7119){logger[_0xb0e6('0x1a')](_0xb0e6('0x2b'),'afterCreate',_0xb0e6('0x1f'),util['inspect'](_0x5e7119,{'showHidden':![],'depth':null}));});}else{logger[_0xb0e6('0x1a')](_0xb0e6('0x2b'),_0xb0e6('0x2c'),_0xb0e6('0x1f'),_0xb0e6('0x2d'));}break;}}})[_0xb0e6('0x2e')](function(){_0x4a1ca1();});}else{_0x4a1ca1();}}},'charset':_0xb0e6('0x2f'),'collate':_0xb0e6('0x30')});}; \ No newline at end of file +var _0x281e=['WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','update'];(function(_0x5d24df,_0x44b3db){var _0x386f69=function(_0x2803bb){while(--_0x2803bb){_0x5d24df['push'](_0x5d24df['shift']());}};_0x386f69(++_0x44b3db);}(_0x281e,0x68));var _0xe281=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x281e[_0x26462c];return _0x509a42;};'use strict';var _=require(_0xe281('0x0'));var util=require(_0xe281('0x1'));var logger=require(_0xe281('0x2'))(_0xe281('0x3'));var moment=require(_0xe281('0x4'));var BPromise=require(_0xe281('0x5'));var rp=require(_0xe281('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe281('0x7'));var config=require(_0xe281('0x8'));var attributes=require(_0xe281('0x9'));module[_0xe281('0xa')]=function(_0x2ae20d,_0x3319bb){return _0x2ae20d[_0xe281('0xb')](_0xe281('0xc'),attributes,{'tableName':_0xe281('0xd'),'paranoid':![],'indexes':[{'name':_0xe281('0xe'),'fields':[_0xe281('0xe')]},{'name':'fti_whatsapp_messages','fields':[_0xe281('0xf')],'type':_0xe281('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x390f22,_0x5d2ec1,_0x36ede9){var _0x4d0814=_0x2ae20d[_0xe281('0x11')];var _0x7bc7b9=_0x390f22[_0xe281('0x12')]({'plain':!![]});if(_0x7bc7b9[_0xe281('0x13')][_0xe281('0x14')]()==='in'||_0x7bc7b9[_0xe281('0x13')]['toLowerCase']()===_0xe281('0x15')&&!_0x7bc7b9[_0xe281('0x16')]&&!_[_0xe281('0x17')](_0x7bc7b9[_0xe281('0x18')])){_0x4d0814[_0xe281('0x19')][_0xe281('0x1a')]({'where':{'id':_0x7bc7b9[_0xe281('0x1b')]}})[_0xe281('0x1c')](function(_0x1f0fa3){if(_0x1f0fa3){_0x1f0fa3['update']({'lastMsgAt':_0x7bc7b9['createdAt'],'lastMsgDirection':_0x7bc7b9[_0xe281('0x13')][_0xe281('0x14')]()});}})[_0xe281('0x1d')](function(_0x362543){console[_0xe281('0x1e')](_0x362543);});}if(_0x7bc7b9[_0xe281('0x13')]==='out'&&!_0x7bc7b9[_0xe281('0x16')]){var _0x5401da;_0x4d0814[_0xe281('0x1f')]['find']({'where':{'id':_0x7bc7b9[_0xe281('0x20')]},'raw':!![]})[_0xe281('0x1c')](function(_0x39d3e9){_0x5401da=_0x39d3e9;if(_0x5401da&&_0x5401da[_0xe281('0x21')]){switch(_0x5401da['type']){case _0xe281('0x22'):var _0xc8ac56=require(_0xe281('0x22'));if(_0x5401da[_0xe281('0x23')]&&_0x5401da['authToken']&&_0x5401da['phone']){var _0x208977=new _0xc8ac56(_0x5401da[_0xe281('0x23')],_0x5401da[_0xe281('0x24')]);_0x208977['messages'][_0xe281('0x25')]({'body':_0x7bc7b9['body'],'to':_0xe281('0x26')+_0x7bc7b9[_0xe281('0x27')],'from':'whatsapp:'+_0x5401da['phone'],'statusCallback':_0x5401da[_0xe281('0x28')]+_0xe281('0x29')+_0x7bc7b9['id']+_0xe281('0x2a')+_0x5401da[_0xe281('0x2b')]})['then'](function(_0x42484d){if(_0x42484d[_0xe281('0x2c')]){return _0x390f22[_0xe281('0x2d')]({'messageId':_0x42484d[_0xe281('0x2c')]});}})[_0xe281('0x1d')](function(_0x15f59d){logger[_0xe281('0x1e')](_0xe281('0x2e'),_0xe281('0x2f'),_0xe281('0x22'),util[_0xe281('0x30')](_0x15f59d,{'showHidden':![],'depth':null}));});}else{logger[_0xe281('0x1e')](_0xe281('0x2e'),_0xe281('0x2f'),_0xe281('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0x36ede9();});}else{_0x36ede9();}}},'charset':_0xe281('0x31'),'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 94f249a..6c31935 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 _0x486a=['./whatsappMessage.socket','register','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults'];(function(_0x54ef4e,_0xa18f9c){var _0x44c037=function(_0x1ea1cb){while(--_0x1ea1cb){_0x54ef4e['push'](_0x54ef4e['shift']());}};_0x44c037(++_0xa18f9c);}(_0x486a,0x121));var _0xa486=function(_0x447ef1,_0x374cd2){_0x447ef1=_0x447ef1-0x0;var _0x3d72ec=_0x486a[_0x447ef1];return _0x3d72ec;};'use strict';var _=require('lodash');var util=require(_0xa486('0x0'));var moment=require(_0xa486('0x1'));var BPromise=require('bluebird');var rs=require(_0xa486('0x2'));var fs=require('fs');var Redis=require(_0xa486('0x3'));var db=require(_0xa486('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa486('0x5'))(_0xa486('0x6'));var config=require('../../config/environment');var jayson=require(_0xa486('0x7'));var client=jayson['client'][_0xa486('0x8')]({'port':0x232a});config[_0xa486('0x9')]=_[_0xa486('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa486('0x9')]));require(_0xa486('0xb'))[_0xa486('0xc')](socket);function respondWithRpcPromise(_0x1256f1,_0x27767f,_0x547ad4){return new BPromise(function(_0xf65e3a,_0x402ae2){return client['request'](_0x1256f1,_0x547ad4)['then'](function(_0x122281){logger[_0xa486('0xd')]('WhatsappMessage,\x20%s,\x20%s',_0x27767f,'request\x20sent');logger[_0xa486('0xe')](_0xa486('0xf'),_0x27767f,_0xa486('0x10'),JSON[_0xa486('0x11')](_0x122281));if(_0x122281['error']){if(_0x122281[_0xa486('0x12')][_0xa486('0x13')]===0x1f4){logger[_0xa486('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x27767f,_0x122281['error']['message']);return _0x402ae2(_0x122281[_0xa486('0x12')]['message']);}logger[_0xa486('0x12')](_0xa486('0x14'),_0x27767f,_0x122281['error'][_0xa486('0x15')]);return _0xf65e3a(_0x122281[_0xa486('0x12')][_0xa486('0x15')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x27767f,_0xa486('0x10'));_0xf65e3a(_0x122281[_0xa486('0x16')]['message']);}})[_0xa486('0x17')](function(_0x2ce83d){logger[_0xa486('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x27767f,_0x2ce83d);_0x402ae2(_0x2ce83d);});});}exports[_0xa486('0x18')]=function(_0x46aa64){var _0x4cbf8d=this;return new Promise(function(_0x4ee837,_0x57f625){return db[_0xa486('0x19')][_0xa486('0x1a')](_0x46aa64[_0xa486('0x1b')],{'raw':_0x46aa64[_0xa486('0x1c')]?_0x46aa64[_0xa486('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xa486('0x1d')](function(_0x48f394){logger[_0xa486('0xd')](_0xa486('0x18'),_0x46aa64);logger[_0xa486('0xe')](_0xa486('0x18'),_0x46aa64,JSON['stringify'](_0x48f394));_0x4ee837(_0x48f394);})[_0xa486('0x17')](function(_0x27a239){logger[_0xa486('0x12')]('CreateWhatsappMessage',_0x27a239[_0xa486('0x15')],_0x46aa64);_0x57f625(_0x4cbf8d[_0xa486('0x12')](0x1f4,_0x27a239[_0xa486('0x15')]));});});}; \ No newline at end of file +var _0xd2e1=['CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x569d81,_0x47adab){var _0x5095a1=function(_0x22e048){while(--_0x22e048){_0x569d81['push'](_0x569d81['shift']());}};_0x5095a1(++_0x47adab);}(_0xd2e1,0x96));var _0x1d2e=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xd2e1[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x1d2e('0x0'));var util=require(_0x1d2e('0x1'));var moment=require(_0x1d2e('0x2'));var BPromise=require(_0x1d2e('0x3'));var rs=require(_0x1d2e('0x4'));var fs=require('fs');var Redis=require(_0x1d2e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1d2e('0x6'));var config=require(_0x1d2e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1d2e('0x8')]['http']({'port':0x232a});config['redis']=_[_0x1d2e('0x9')](config[_0x1d2e('0xa')],{'host':_0x1d2e('0xb'),'port':0x18eb});var socket=require(_0x1d2e('0xc'))(new Redis(config[_0x1d2e('0xa')]));require(_0x1d2e('0xd'))['register'](socket);function respondWithRpcPromise(_0x4a06fb,_0x15a8f7,_0x2a7583){return new BPromise(function(_0x4afa3f,_0x3faf50){return client['request'](_0x4a06fb,_0x2a7583)['then'](function(_0x364c79){logger[_0x1d2e('0xe')](_0x1d2e('0xf'),_0x15a8f7,_0x1d2e('0x10'));logger[_0x1d2e('0x11')](_0x1d2e('0x12'),_0x15a8f7,'request\x20sent',JSON[_0x1d2e('0x13')](_0x364c79));if(_0x364c79['error']){if(_0x364c79[_0x1d2e('0x14')][_0x1d2e('0x15')]===0x1f4){logger['error'](_0x1d2e('0xf'),_0x15a8f7,_0x364c79['error'][_0x1d2e('0x16')]);return _0x3faf50(_0x364c79[_0x1d2e('0x14')][_0x1d2e('0x16')]);}logger[_0x1d2e('0x14')](_0x1d2e('0xf'),_0x15a8f7,_0x364c79[_0x1d2e('0x14')][_0x1d2e('0x16')]);return _0x4afa3f(_0x364c79['error'][_0x1d2e('0x16')]);}else{logger[_0x1d2e('0xe')](_0x1d2e('0xf'),_0x15a8f7,_0x1d2e('0x10'));_0x4afa3f(_0x364c79['result']['message']);}})[_0x1d2e('0x17')](function(_0x377614){logger[_0x1d2e('0x14')](_0x1d2e('0xf'),_0x15a8f7,_0x377614);_0x3faf50(_0x377614);});});}exports[_0x1d2e('0x18')]=function(_0x29cffb){var _0x1cfa24=this;return new Promise(function(_0x48d3fe,_0x1475a0){return db[_0x1d2e('0x19')]['create'](_0x29cffb[_0x1d2e('0x1a')],{'raw':_0x29cffb[_0x1d2e('0x1b')]?_0x29cffb[_0x1d2e('0x1b')][_0x1d2e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x50a36b){logger[_0x1d2e('0xe')]('CreateWhatsappMessage',_0x29cffb);logger['debug']('CreateWhatsappMessage',_0x29cffb,JSON['stringify'](_0x50a36b));_0x48d3fe(_0x50a36b);})[_0x1d2e('0x17')](function(_0x2a451e){logger[_0x1d2e('0x14')](_0x1d2e('0x18'),_0x2a451e[_0x1d2e('0x16')],_0x29cffb);_0x1475a0(_0x1cfa24[_0x1d2e('0x14')](0x1f4,_0x2a451e['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 9473cd4..b62f826 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 _0x9907=['./whatsappMessage.events','save','emit','removeListener','register','length','whatsappMessage:'];(function(_0x2258a6,_0x3e1e9c){var _0x31c75f=function(_0x1d8608){while(--_0x1d8608){_0x2258a6['push'](_0x2258a6['shift']());}};_0x31c75f(++_0x3e1e9c);}(_0x9907,0x1c0));var _0x7990=function(_0x2bc1fe,_0x45da98){_0x2bc1fe=_0x2bc1fe-0x0;var _0x1a47a5=_0x9907[_0x2bc1fe];return _0x1a47a5;};'use strict';var WhatsappMessageEvents=require(_0x7990('0x0'));var events=[_0x7990('0x1'),'remove','update'];function createListener(_0x11cd2e,_0x3ad4cb){return function(_0x3a16e4){_0x3ad4cb[_0x7990('0x2')](_0x11cd2e,_0x3a16e4);};}function removeListener(_0x40f695,_0x180f01){return function(){WhatsappMessageEvents[_0x7990('0x3')](_0x40f695,_0x180f01);};}exports[_0x7990('0x4')]=function(_0x4ff16e){for(var _0xf1e34c=0x0,_0x5e398d=events[_0x7990('0x5')];_0xf1e34c<_0x5e398d;_0xf1e34c++){var _0x317741=events[_0xf1e34c];var _0x889c1a=createListener(_0x7990('0x6')+_0x317741,_0x4ff16e);WhatsappMessageEvents['on'](_0x317741,_0x889c1a);}}; \ No newline at end of file +var _0xfb76=['update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events'];(function(_0x407217,_0x36d62a){var _0x2dc211=function(_0x3cbe9a){while(--_0x3cbe9a){_0x407217['push'](_0x407217['shift']());}};_0x2dc211(++_0x36d62a);}(_0xfb76,0xae));var _0x6fb7=function(_0x3f176a,_0x57ab66){_0x3f176a=_0x3f176a-0x0;var _0x168314=_0xfb76[_0x3f176a];return _0x168314;};'use strict';var WhatsappMessageEvents=require(_0x6fb7('0x0'));var events=['save','remove',_0x6fb7('0x1')];function createListener(_0x236ffe,_0x1500f3){return function(_0x47338a){_0x1500f3[_0x6fb7('0x2')](_0x236ffe,_0x47338a);};}function removeListener(_0x3b2329,_0x11a75d){return function(){WhatsappMessageEvents[_0x6fb7('0x3')](_0x3b2329,_0x11a75d);};}exports[_0x6fb7('0x4')]=function(_0x1b84ce){for(var _0x29266c=0x0,_0x38e63e=events[_0x6fb7('0x5')];_0x29266c<_0x38e63e;_0x29266c++){var _0x313f19=events[_0x29266c];var _0x42d828=createListener(_0x6fb7('0x6')+_0x313f19,_0x1b84ce);WhatsappMessageEvents['on'](_0x313f19,_0x42d828);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 763973d..bec3e59 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 _0xbabd=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','addTeams','post','addAgents','put','update','destroy','removeAgents','exports'];(function(_0x6c05d2,_0x5c0e9f){var _0x1aefee=function(_0x938d85){while(--_0x938d85){_0x6c05d2['push'](_0x6c05d2['shift']());}};_0x1aefee(++_0x5c0e9f);}(_0xbabd,0x118));var _0xdbab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbabd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdbab('0x0'));var timeout=require(_0xdbab('0x1'));var express=require(_0xdbab('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdbab('0x3'));var interaction=require(_0xdbab('0x4'));var config=require(_0xdbab('0x5'));var controller=require(_0xdbab('0x6'));router[_0xdbab('0x7')]('/',auth['isAuthenticated'](),controller[_0xdbab('0x8')]);router[_0xdbab('0x7')](_0xdbab('0x9'),auth[_0xdbab('0xa')](),controller[_0xdbab('0xb')]);router[_0xdbab('0x7')](_0xdbab('0xc'),auth[_0xdbab('0xa')](),controller[_0xdbab('0xd')]);router[_0xdbab('0x7')](_0xdbab('0xe'),auth['isAuthenticated'](),controller[_0xdbab('0xf')]);router[_0xdbab('0x7')](_0xdbab('0x10'),auth[_0xdbab('0xa')](),controller[_0xdbab('0x11')]);router[_0xdbab('0x7')](_0xdbab('0x12'),auth[_0xdbab('0xa')](),controller[_0xdbab('0x13')]);router['post']('/',auth[_0xdbab('0xa')](),controller['create']);router['post']('/:id/teams',auth[_0xdbab('0xa')](),controller[_0xdbab('0x14')]);router[_0xdbab('0x15')]('/:id/users',auth[_0xdbab('0xa')](),controller[_0xdbab('0x16')]);router[_0xdbab('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xdbab('0x18')]);router['delete'](_0xdbab('0xc'),auth['isAuthenticated'](),controller[_0xdbab('0x19')]);router['delete'](_0xdbab('0x10'),auth[_0xdbab('0xa')](),controller['removeTeams']);router['delete'](_0xdbab('0x12'),auth[_0xdbab('0xa')](),controller[_0xdbab('0x1a')]);module[_0xdbab('0x1b')]=router; \ No newline at end of file +var _0x20c1=['/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/:id','show'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x20c1,0x1a4));var _0x120c=function(_0x407398,_0x254d6c){_0x407398=_0x407398-0x0;var _0x4024f9=_0x20c1[_0x407398];return _0x4024f9;};'use strict';var multer=require('multer');var util=require(_0x120c('0x0'));var path=require(_0x120c('0x1'));var timeout=require(_0x120c('0x2'));var express=require(_0x120c('0x3'));var router=express['Router']();var fs_extra=require(_0x120c('0x4'));var auth=require(_0x120c('0x5'));var interaction=require(_0x120c('0x6'));var config=require(_0x120c('0x7'));var controller=require(_0x120c('0x8'));router['get']('/',auth[_0x120c('0x9')](),controller[_0x120c('0xa')]);router['get']('/describe',auth[_0x120c('0x9')](),controller['describe']);router[_0x120c('0xb')](_0x120c('0xc'),auth[_0x120c('0x9')](),controller[_0x120c('0xd')]);router[_0x120c('0xb')](_0x120c('0xe'),auth['isAuthenticated'](),controller[_0x120c('0xf')]);router[_0x120c('0xb')]('/:id/teams',auth[_0x120c('0x9')](),controller[_0x120c('0x10')]);router['get'](_0x120c('0x11'),auth['isAuthenticated'](),controller[_0x120c('0x12')]);router[_0x120c('0x13')]('/',auth[_0x120c('0x9')](),controller[_0x120c('0x14')]);router[_0x120c('0x13')](_0x120c('0x15'),auth['isAuthenticated'](),controller[_0x120c('0x16')]);router[_0x120c('0x13')](_0x120c('0x11'),auth['isAuthenticated'](),controller[_0x120c('0x17')]);router[_0x120c('0x18')](_0x120c('0xc'),auth['isAuthenticated'](),controller[_0x120c('0x19')]);router[_0x120c('0x1a')](_0x120c('0xc'),auth[_0x120c('0x9')](),controller[_0x120c('0x1b')]);router[_0x120c('0x1a')](_0x120c('0x15'),auth[_0x120c('0x9')](),controller[_0x120c('0x1c')]);router['delete']('/:id/users',auth[_0x120c('0x9')](),controller[_0x120c('0x1d')]);module[_0x120c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 707d64a..f4edb01 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 _0x0a34=['roundrobin','STRING','sequelize','exports','name','INTEGER','ENUM','beepall'];(function(_0x6f775e,_0x293e77){var _0x517fe5=function(_0x69f1a2){while(--_0x69f1a2){_0x6f775e['push'](_0x6f775e['shift']());}};_0x517fe5(++_0x293e77);}(_0x0a34,0x12a));var _0x40a3=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x0a34[_0x119d5a];return _0x15bff4;};'use strict';var Sequelize=require(_0x40a3('0x0'));module[_0x40a3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x40a3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x40a3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x40a3('0x4')]('rrmemory',_0x40a3('0x5'),_0x40a3('0x6'))},'description':{'type':Sequelize[_0x40a3('0x7')]}}; \ No newline at end of file +var _0x79d8=['STRING','name','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x50fcf9,_0x5cc11d){var _0x59fe13=function(_0x1d8a2f){while(--_0x1d8a2f){_0x50fcf9['push'](_0x50fcf9['shift']());}};_0x59fe13(++_0x5cc11d);}(_0x79d8,0x67));var _0x879d=function(_0x2467a8,_0x6a5bcf){_0x2467a8=_0x2467a8-0x0;var _0x38a462=_0x79d8[_0x2467a8];return _0x38a462;};'use strict';var Sequelize=require(_0x879d('0x0'));module[_0x879d('0x1')]={'name':{'type':Sequelize[_0x879d('0x2')],'unique':_0x879d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x879d('0x4')](_0x879d('0x5'),'beepall',_0x879d('0x6'))},'description':{'type':Sequelize[_0x879d('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index ab1925d..cdbf5e8 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 _0x70e3=['WhatsappQueues','UserProfileResource','destroy','end','stack','name','send','index','WhatsappQueue','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','merge','VIRTUAL','filter','options','where','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','ids','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','userWhatsappQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get'];(function(_0x5ee1ef,_0x8d83d5){var _0x601cdc=function(_0xf3f658){while(--_0xf3f658){_0x5ee1ef['push'](_0x5ee1ef['shift']());}};_0x601cdc(++_0x8d83d5);}(_0x70e3,0xef));var _0x370e=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x70e3[_0x1f9f37];return _0x21c080;};'use strict';var emlformat=require(_0x370e('0x0'));var rimraf=require(_0x370e('0x1'));var zipdir=require(_0x370e('0x2'));var jsonpatch=require(_0x370e('0x3'));var rp=require(_0x370e('0x4'));var moment=require(_0x370e('0x5'));var BPromise=require(_0x370e('0x6'));var Mustache=require(_0x370e('0x7'));var util=require(_0x370e('0x8'));var path=require(_0x370e('0x9'));var sox=require('sox');var csv=require(_0x370e('0xa'));var ejs=require(_0x370e('0xb'));var fs=require('fs');var fs_extra=require(_0x370e('0xc'));var _=require(_0x370e('0xd'));var squel=require('squel');var crypto=require(_0x370e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x370e('0xf'));var toCsv=require(_0x370e('0xa'));var querystring=require(_0x370e('0x10'));var Papa=require('papaparse');var Redis=require(_0x370e('0x11'));var authService=require(_0x370e('0x12'));var qs=require(_0x370e('0x13'));var as=require(_0x370e('0x14'));var hardwareService=require(_0x370e('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x370e('0x16'));var config=require(_0x370e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x370e('0x18'))['db'];config[_0x370e('0x19')]=_[_0x370e('0x1a')](config[_0x370e('0x19')],{'host':_0x370e('0x1b'),'port':0x18eb});var socket=require(_0x370e('0x1c'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x370e('0x1d')](socket);function respondWithStatusCode(_0x2b116e,_0x34a84b){_0x34a84b=_0x34a84b||0xcc;return function(_0x6f1f84){if(_0x6f1f84){return _0x2b116e[_0x370e('0x1e')](_0x34a84b);}return _0x2b116e['status'](_0x34a84b)['end']();};}function respondWithResult(_0x1750dd,_0x519acb){_0x519acb=_0x519acb||0xc8;return function(_0x3ae940){if(_0x3ae940){return _0x1750dd[_0x370e('0x1f')](_0x519acb)[_0x370e('0x20')](_0x3ae940);}};}function respondWithFilteredResult(_0x448ff7,_0x47af19){return function(_0x277668){if(_0x277668){var _0x4c6321=typeof _0x47af19[_0x370e('0x21')]===_0x370e('0x22')&&typeof _0x47af19[_0x370e('0x23')]===_0x370e('0x22');var _0x58ca49=_0x277668['count'];var _0x10910b=_0x4c6321?0x0:_0x47af19['offset'];var _0x381625=_0x4c6321?_0x277668[_0x370e('0x24')]:_0x47af19[_0x370e('0x21')]+_0x47af19[_0x370e('0x23')];var _0x22ccb2;if(_0x381625>=_0x58ca49){_0x381625=_0x58ca49;_0x22ccb2=0xc8;}else{_0x22ccb2=0xce;}_0x448ff7['status'](_0x22ccb2);return _0x448ff7[_0x370e('0x25')](_0x370e('0x26'),_0x10910b+'-'+_0x381625+'/'+_0x58ca49)['json'](_0x277668);}return null;};}function patchUpdates(_0x3cb9ed){return function(_0x3a8780){try{jsonpatch[_0x370e('0x27')](_0x3a8780,_0x3cb9ed,!![]);}catch(_0x308cda){return BPromise[_0x370e('0x28')](_0x308cda);}return _0x3a8780[_0x370e('0x29')]();};}function saveUpdates(_0x10079b,_0x3d78ea){return function(_0x4b6c4c){if(_0x4b6c4c){return _0x4b6c4c[_0x370e('0x2a')](_0x10079b)[_0x370e('0x2b')](function(_0x4da178){return _0x4da178;});}return null;};}function removeEntity(_0x49ac33,_0x3692aa){return function(_0x1d8b44){if(_0x1d8b44){return _0x1d8b44['destroy']()[_0x370e('0x2b')](function(){var _0x299702=_0x1d8b44[_0x370e('0x2c')]({'plain':!![]});var _0x58266a=_0x370e('0x2d');return db[_0x370e('0x2e')][_0x370e('0x2f')]({'where':{'type':_0x58266a,'resourceId':_0x299702['id']}})[_0x370e('0x2b')](function(){return _0x1d8b44;});})[_0x370e('0x2b')](function(){_0x49ac33[_0x370e('0x1f')](0xcc)[_0x370e('0x30')]();});}};}function handleEntityNotFound(_0x5e9e45,_0x3be40d){return function(_0x2f78c1){if(!_0x2f78c1){_0x5e9e45[_0x370e('0x1e')](0x194);}return _0x2f78c1;};}function handleError(_0x47e164,_0x295d64){_0x295d64=_0x295d64||0x1f4;return function(_0x5323b4){logger['error'](_0x5323b4[_0x370e('0x31')]);if(_0x5323b4[_0x370e('0x32')]){delete _0x5323b4[_0x370e('0x32')];}_0x47e164[_0x370e('0x1f')](_0x295d64)[_0x370e('0x33')](_0x5323b4);};}exports[_0x370e('0x34')]=function(_0x7736a3,_0x136285){var _0x1ece3a={},_0x320e9d={},_0x216dcf={'count':0x0,'rows':[]};var _0x45faa0=_['map'](db[_0x370e('0x35')][_0x370e('0x36')],function(_0x37d3e4){return{'name':_0x37d3e4[_0x370e('0x37')],'type':_0x37d3e4['type'][_0x370e('0x38')]};});_0x320e9d[_0x370e('0x39')]=_[_0x370e('0x3a')](_0x45faa0,_0x370e('0x32'));_0x320e9d[_0x370e('0x3b')]=_[_0x370e('0x3c')](_0x7736a3[_0x370e('0x3b')]);_0x320e9d[_0x370e('0x3d')]=_['intersection'](_0x320e9d[_0x370e('0x39')],_0x320e9d['query']);_0x1ece3a[_0x370e('0x3e')]=_[_0x370e('0x3f')](_0x320e9d['model'],qs['fields'](_0x7736a3[_0x370e('0x3b')][_0x370e('0x40')]));_0x1ece3a[_0x370e('0x3e')]=_0x1ece3a[_0x370e('0x3e')][_0x370e('0x41')]?_0x1ece3a[_0x370e('0x3e')]:_0x320e9d[_0x370e('0x39')];if(!_0x7736a3[_0x370e('0x3b')]['hasOwnProperty'](_0x370e('0x42'))){_0x1ece3a[_0x370e('0x23')]=qs[_0x370e('0x23')](_0x7736a3[_0x370e('0x3b')]['limit']);_0x1ece3a['offset']=qs[_0x370e('0x21')](_0x7736a3[_0x370e('0x3b')][_0x370e('0x21')]);}_0x1ece3a[_0x370e('0x43')]=qs[_0x370e('0x44')](_0x7736a3['query'][_0x370e('0x44')]);_0x1ece3a['where']=qs[_0x370e('0x3d')](_[_0x370e('0x45')](_0x7736a3['query'],_0x320e9d[_0x370e('0x3d')]),_0x45faa0);if(_0x7736a3[_0x370e('0x3b')]['filter']){_0x1ece3a['where']=_[_0x370e('0x46')](_0x1ece3a['where'],{'$or':_[_0x370e('0x3a')](_0x45faa0,function(_0x21c350){if(_0x21c350['type']!==_0x370e('0x47')){var _0x9a7452={};_0x9a7452[_0x21c350[_0x370e('0x32')]]={'$like':'%'+_0x7736a3[_0x370e('0x3b')][_0x370e('0x48')]+'%'};return _0x9a7452;}})});}_0x1ece3a=_['merge']({},_0x1ece3a,_0x7736a3[_0x370e('0x49')]);var _0x7e9b49={'where':_0x1ece3a[_0x370e('0x4a')]};return db[_0x370e('0x35')]['count'](_0x7e9b49)[_0x370e('0x2b')](function(_0x3fd70c){_0x216dcf[_0x370e('0x24')]=_0x3fd70c;if(_0x7736a3[_0x370e('0x3b')]['includeAll']){_0x1ece3a[_0x370e('0x4b')]=[{'all':!![]}];}return db[_0x370e('0x35')][_0x370e('0x4c')](_0x1ece3a);})[_0x370e('0x2b')](function(_0x7abb25){_0x216dcf[_0x370e('0x4d')]=_0x7abb25;return _0x216dcf;})[_0x370e('0x2b')](respondWithFilteredResult(_0x136285,_0x1ece3a))[_0x370e('0x4e')](handleError(_0x136285,null));};exports[_0x370e('0x4f')]=function(_0x37edcc,_0x48d429){var _0x236b54={'raw':!![],'where':{'id':_0x37edcc[_0x370e('0x50')]['id']}},_0x1c131c={};_0x1c131c[_0x370e('0x39')]=_['keys'](db[_0x370e('0x35')][_0x370e('0x36')]);_0x1c131c['query']=_[_0x370e('0x3c')](_0x37edcc[_0x370e('0x3b')]);_0x1c131c[_0x370e('0x3d')]=_[_0x370e('0x3f')](_0x1c131c[_0x370e('0x39')],_0x1c131c[_0x370e('0x3b')]);_0x236b54[_0x370e('0x3e')]=_[_0x370e('0x3f')](_0x1c131c[_0x370e('0x39')],qs['fields'](_0x37edcc['query'][_0x370e('0x40')]));_0x236b54[_0x370e('0x3e')]=_0x236b54['attributes']['length']?_0x236b54[_0x370e('0x3e')]:_0x1c131c['model'];if(_0x37edcc[_0x370e('0x3b')]['includeAll']){_0x236b54[_0x370e('0x4b')]=[{'all':!![]}];}_0x236b54=_['merge']({},_0x236b54,_0x37edcc['options']);return db[_0x370e('0x35')][_0x370e('0x51')](_0x236b54)[_0x370e('0x2b')](handleEntityNotFound(_0x48d429,null))[_0x370e('0x2b')](respondWithResult(_0x48d429,null))[_0x370e('0x4e')](handleError(_0x48d429,null));};exports[_0x370e('0x52')]=function(_0x2cb48f,_0x3b721f){return db[_0x370e('0x35')][_0x370e('0x52')](_0x2cb48f[_0x370e('0x53')],{})[_0x370e('0x2b')](function(_0x359c10){var _0x3c648c=_0x2cb48f[_0x370e('0x54')]['get']({'plain':!![]});if(!_0x3c648c)throw new Error(_0x370e('0x55'));if(_0x3c648c['role']==='user'){var _0x3740a2=_0x359c10[_0x370e('0x2c')]({'plain':!![]});var _0x1a7c20=_0x370e('0x2d');return db[_0x370e('0x56')][_0x370e('0x51')]({'where':{'name':_0x1a7c20,'userProfileId':_0x3c648c['userProfileId']},'raw':!![]})[_0x370e('0x2b')](function(_0x449ba2){if(_0x449ba2&&_0x449ba2[_0x370e('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x3740a2[_0x370e('0x32')],'resourceId':_0x3740a2['id'],'type':_0x449ba2[_0x370e('0x32')],'sectionId':_0x449ba2['id']},{})[_0x370e('0x2b')](function(){return _0x359c10;});}else{return _0x359c10;}})['catch'](function(_0x3924c0){logger[_0x370e('0x58')](_0x370e('0x59'),_0x3924c0);throw _0x3924c0;});}return _0x359c10;})[_0x370e('0x2b')](respondWithResult(_0x3b721f,0xc9))[_0x370e('0x4e')](handleError(_0x3b721f,null));};exports['update']=function(_0x117290,_0x18b3f6){if(_0x117290[_0x370e('0x53')]['id']){delete _0x117290[_0x370e('0x53')]['id'];}return db[_0x370e('0x35')][_0x370e('0x51')]({'where':{'id':_0x117290['params']['id']}})[_0x370e('0x2b')](handleEntityNotFound(_0x18b3f6,null))[_0x370e('0x2b')](saveUpdates(_0x117290['body'],null))[_0x370e('0x2b')](respondWithResult(_0x18b3f6,null))['catch'](handleError(_0x18b3f6,null));};exports['destroy']=function(_0x210755,_0x1aaae2){return db[_0x370e('0x35')][_0x370e('0x51')]({'where':{'id':_0x210755[_0x370e('0x50')]['id']}})[_0x370e('0x2b')](handleEntityNotFound(_0x1aaae2,null))[_0x370e('0x2b')](removeEntity(_0x1aaae2,null))[_0x370e('0x4e')](handleError(_0x1aaae2,null));};exports[_0x370e('0x5a')]=function(_0x4fef67,_0x4a7c79){return db[_0x370e('0x35')][_0x370e('0x5a')]()[_0x370e('0x2b')](respondWithResult(_0x4a7c79,null))[_0x370e('0x4e')](handleError(_0x4a7c79,null));};exports[_0x370e('0x5b')]=function(_0x209ad9,_0x2e3461,_0x2cf2ef){var _0x395e60={'raw':!![],'where':{}},_0x2371a3={},_0x3095fd;return db[_0x370e('0x35')][_0x370e('0x5c')]({'where':{'id':_0x209ad9[_0x370e('0x50')]['id']}})[_0x370e('0x2b')](handleEntityNotFound(_0x2e3461,null))['then'](function(_0x4b981b){if(_0x4b981b){_0x3095fd=_0x4b981b['get']({'plain':!![]});_0x2371a3[_0x370e('0x39')]=_[_0x370e('0x3c')](db[_0x370e('0x5d')][_0x370e('0x36')]);_0x2371a3[_0x370e('0x3b')]=_['keys'](_0x209ad9[_0x370e('0x3b')]);_0x2371a3['filters']=_[_0x370e('0x3f')](_0x2371a3[_0x370e('0x39')],_0x2371a3[_0x370e('0x3b')]);_0x395e60[_0x370e('0x3e')]=_[_0x370e('0x3f')](_0x2371a3[_0x370e('0x39')],qs['fields'](_0x209ad9[_0x370e('0x3b')][_0x370e('0x40')]));_0x395e60[_0x370e('0x3e')]=_0x395e60[_0x370e('0x3e')][_0x370e('0x41')]?_0x395e60[_0x370e('0x3e')]:_0x2371a3[_0x370e('0x39')];if(!_0x209ad9[_0x370e('0x3b')][_0x370e('0x5e')](_0x370e('0x42'))){_0x395e60[_0x370e('0x23')]=qs[_0x370e('0x23')](_0x209ad9[_0x370e('0x3b')][_0x370e('0x23')]);_0x395e60[_0x370e('0x21')]=qs[_0x370e('0x21')](_0x209ad9[_0x370e('0x3b')][_0x370e('0x21')]);}_0x395e60[_0x370e('0x43')]=qs[_0x370e('0x44')](_0x209ad9['query'][_0x370e('0x44')]);_0x395e60[_0x370e('0x4a')]=qs[_0x370e('0x3d')](_[_0x370e('0x45')](_0x209ad9[_0x370e('0x3b')],_0x2371a3[_0x370e('0x3d')]));_0x395e60[_0x370e('0x4a')][_0x370e('0x5f')]=_0x4b981b['id'];if(_0x209ad9[_0x370e('0x3b')][_0x370e('0x48')]){_0x395e60[_0x370e('0x4a')]=_[_0x370e('0x46')](_0x395e60[_0x370e('0x4a')],{'$or':_['map'](_0x395e60[_0x370e('0x3e')],function(_0x4db06b){var _0xe56574={};_0xe56574[_0x4db06b]={'$like':'%'+_0x209ad9[_0x370e('0x3b')][_0x370e('0x48')]+'%'};return _0xe56574;})});}_0x395e60=_[_0x370e('0x46')]({},_0x395e60,_0x209ad9[_0x370e('0x49')]);return db[_0x370e('0x5d')][_0x370e('0x4c')](_0x395e60);}})[_0x370e('0x2b')](function(_0x24353f){if(_0x24353f){return db[_0x370e('0x60')][_0x370e('0x61')]({'where':{'id':_[_0x370e('0x3a')](_0x24353f,'UserId'),'role':_0x370e('0x62')},'attributes':['id','name',_0x370e('0x63'),_0x370e('0x64'),_0x370e('0x65')]});}})[_0x370e('0x2b')](function(_0x2b95d5){if(_0x2b95d5){return{'count':_0x2b95d5[_0x370e('0x24')],'rows':_[_0x370e('0x3a')](_0x2b95d5[_0x370e('0x4d')],function(_0xdd2d7b){return{'membername':_0xdd2d7b[_0x370e('0x32')],'UserId':_0xdd2d7b['id'],'queue_name':_0x3095fd[_0x370e('0x32')],'WhatsappQueueId':_0x3095fd['id'],'interface':util[_0x370e('0x66')](_0x370e('0x67'),_0x370e('0x68'),_0xdd2d7b[_0x370e('0x32')]),'penalty':0x0,'paused':_0xdd2d7b[_0x370e('0x63')],'createdAt':_0xdd2d7b[_0x370e('0x65')],'updatedAt':_0xdd2d7b[_0x370e('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x370e('0x2b')](respondWithFilteredResult(_0x2e3461,_0x395e60))['catch'](handleError(_0x2e3461,null));};exports['getTeams']=function(_0x59bcff,_0x1b1879,_0x1860f8){var _0x202a84={};var _0x156826={};var _0x12ab0d;var _0x3486aa;return db['WhatsappQueue'][_0x370e('0x5c')]({'where':{'id':_0x59bcff[_0x370e('0x50')]['id']}})[_0x370e('0x2b')](handleEntityNotFound(_0x1b1879,null))[_0x370e('0x2b')](function(_0x476da9){if(_0x476da9){_0x12ab0d=_0x476da9;_0x156826[_0x370e('0x39')]=_[_0x370e('0x3c')](db['Team'][_0x370e('0x36')]);_0x156826[_0x370e('0x3b')]=_[_0x370e('0x3c')](_0x59bcff[_0x370e('0x3b')]);_0x156826[_0x370e('0x3d')]=_[_0x370e('0x3f')](_0x156826[_0x370e('0x39')],_0x156826[_0x370e('0x3b')]);_0x202a84[_0x370e('0x3e')]=_[_0x370e('0x3f')](_0x156826[_0x370e('0x39')],qs[_0x370e('0x40')](_0x59bcff[_0x370e('0x3b')][_0x370e('0x40')]));_0x202a84[_0x370e('0x3e')]=_0x202a84['attributes'][_0x370e('0x41')]?_0x202a84[_0x370e('0x3e')]:_0x156826[_0x370e('0x39')];_0x202a84[_0x370e('0x43')]=qs['sort'](_0x59bcff['query'][_0x370e('0x44')]);_0x202a84['where']=qs[_0x370e('0x3d')](_[_0x370e('0x45')](_0x59bcff[_0x370e('0x3b')],_0x156826['filters']));if(_0x59bcff[_0x370e('0x3b')]['filter']){_0x202a84['where']=_[_0x370e('0x46')](_0x202a84[_0x370e('0x4a')],{'$or':_[_0x370e('0x3a')](_0x202a84['attributes'],function(_0x1a7085){var _0x135b8d={};_0x135b8d[_0x1a7085]={'$like':'%'+_0x59bcff[_0x370e('0x3b')][_0x370e('0x48')]+'%'};return _0x135b8d;})});}_0x202a84=_[_0x370e('0x46')]({},_0x202a84,_0x59bcff[_0x370e('0x49')]);return _0x12ab0d[_0x370e('0x69')](_0x202a84);}})[_0x370e('0x2b')](function(_0xe7a804){if(_0xe7a804){_0x3486aa=_0xe7a804[_0x370e('0x41')];if(!_0x59bcff[_0x370e('0x3b')]['hasOwnProperty'](_0x370e('0x42'))){_0x202a84[_0x370e('0x23')]=qs[_0x370e('0x23')](_0x59bcff[_0x370e('0x3b')]['limit']);_0x202a84['offset']=qs['offset'](_0x59bcff[_0x370e('0x3b')][_0x370e('0x21')]);}return _0x12ab0d['getTeams'](_0x202a84);}})[_0x370e('0x2b')](function(_0x601f86){if(_0x601f86){return _0x601f86?{'count':_0x3486aa,'rows':_0x601f86}:null;}})[_0x370e('0x2b')](respondWithResult(_0x1b1879,null))['catch'](handleError(_0x1b1879,null));};exports[_0x370e('0x6a')]=function(_0x4f464d,_0x936754,_0x44b756){var _0x516f0a=_0x4f464d[_0x370e('0x53')]['ids'];return db[_0x370e('0x6b')]['findAll']({'where':{'id':_0x516f0a},'attributes':['id'],'include':[{'model':db[_0x370e('0x60')],'as':_0x370e('0x6c'),'attributes':['id',_0x370e('0x32'),_0x370e('0x6d'),_0x370e('0x6e'),'interface'],'raw':!![]}]})[_0x370e('0x2b')](function(_0x20cb8e){if(_0x20cb8e){var _0xa96384=_[_0x370e('0x6f')](_0x20cb8e,function(_0x57b756){var _0x524c19=_0x57b756[_0x370e('0x2c')]({'plain':!![]});return _0x524c19['Agents'];});return db[_0x370e('0x35')][_0x370e('0x51')]({'where':{'id':_0x4f464d[_0x370e('0x50')]['id']}})[_0x370e('0x2b')](function(_0xf7ef04){return db[_0x370e('0x70')][_0x370e('0x71')](function(_0x24e251){return _0xf7ef04[_0x370e('0x6a')](_0x516f0a,{'transaction':_0x24e251})['then'](function(){return BPromise['each'](_0xa96384,function(_0x11bdae){return db[_0x370e('0x5d')][_0x370e('0x72')]({'where':{'UserId':_0x11bdae['id'],'WhatsappQueueId':_0x4f464d[_0x370e('0x50')]['id']},'transaction':_0x24e251});});})[_0x370e('0x2b')](function(){_0xa96384[_0x370e('0x73')](function(_0x178897){socket['emit']('userWhatsappQueue:save',{'UserId':_0x178897['id'],'WhatsappQueueId':_0xf7ef04['id']});});});});});}})['then'](respondWithStatusCode(_0x936754,null))['catch'](handleError(_0x936754,null));};exports[_0x370e('0x74')]=function(_0x15673b,_0x23a83c,_0x7074ea){return db['Team'][_0x370e('0x4c')]({'where':{'id':_0x15673b['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x370e('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x370e('0x2b')](handleEntityNotFound(_0x23a83c,null))['then'](function(_0x430928){var _0x187722=_[_0x370e('0x3a')](_0x430928,'id');var _0x6b5f17=[];var _0x518c25=[];var _0x3217b3=squel[_0x370e('0x75')]();_0x3217b3[_0x370e('0x76')]('tq.TeamId')[_0x370e('0x77')]('team_has_whatsapp_queues','tq')[_0x370e('0x78')](_0x370e('0x79'),'ut',_0x370e('0x7a'))['where'](_0x370e('0x7b'),_0x15673b[_0x370e('0x50')]['id']);for(var _0x982cf4=0x0;_0x982cf4<_0x430928['length'];_0x982cf4+=0x1){let _0x4bef7b=_0x430928[_0x982cf4];for(var _0x1eac51=0x0;_0x1eac51<_0x4bef7b['Agents'][_0x370e('0x41')];_0x1eac51+=0x1){let _0xc20c70=_0x4bef7b['Agents'][_0x1eac51];var _0x26c945=_0x3217b3['clone']();_0x26c945[_0x370e('0x4a')]('ut.UserId\x20=\x20?',_0xc20c70['id']);_0x518c25[_0x370e('0x7c')](db[_0x370e('0x70')]['query'](_0x26c945[_0x370e('0x7d')](),{'type':db['sequelize'][_0x370e('0x7e')][_0x370e('0x7f')]})['then'](function(_0x3ed4f9){if(_0x3ed4f9[_0x370e('0x41')]===0x1){return _0xc20c70['id'];}else{var _0x474f67=_[_0x370e('0x80')](_['map'](_0x3ed4f9,'TeamId'),function(_0x3bb212){return _[_0x370e('0x81')](_0x187722,_0x3bb212);});if(_0x474f67){return _0xc20c70['id'];}}}));}}return BPromise[_0x370e('0x82')](_0x518c25)['then'](function(_0x287845){_0x6b5f17=_(_0x6b5f17)[_0x370e('0x83')](_0x287845)[_0x370e('0x84')]()['value']();return db[_0x370e('0x35')][_0x370e('0x51')]({'where':{'id':_0x15673b[_0x370e('0x50')]['id']}})[_0x370e('0x2b')](function(_0x1138b9){return db[_0x370e('0x70')][_0x370e('0x71')](function(_0x3a791f){return _0x1138b9[_0x370e('0x74')](_0x15673b[_0x370e('0x3b')][_0x370e('0x85')],{'transaction':_0x3a791f})[_0x370e('0x2b')](function(){if(!_[_0x370e('0x86')](_0x6b5f17)){return _0x1138b9[_0x370e('0x87')](_0x6b5f17,{'transaction':_0x3a791f});}})[_0x370e('0x2b')](function(){_0x6b5f17['forEach'](function(_0x21ca2e){socket[_0x370e('0x88')](_0x370e('0x89'),{'UserId':_0x21ca2e,'WhatsappQueueId':_0x1138b9['id']});});});});});});})['then'](respondWithStatusCode(_0x23a83c,null))[_0x370e('0x4e')](handleError(_0x23a83c,null));};exports[_0x370e('0x8a')]=function(_0x5ee260,_0x210918,_0x4f2048){return db[_0x370e('0x35')]['find']({'where':{'id':_0x5ee260[_0x370e('0x50')]['id']}})[_0x370e('0x2b')](handleEntityNotFound(_0x210918,null))[_0x370e('0x2b')](function(_0x3a5197){if(_0x3a5197){return _0x3a5197[_0x370e('0x8a')](_0x5ee260['body']['ids'],_[_0x370e('0x8b')](_0x5ee260['body'],[_0x370e('0x85'),'id'])||{})['spread'](function(_0x5273ae){for(var _0x45757c=0x0;_0x45757c<_0x5ee260[_0x370e('0x53')]['ids'][_0x370e('0x41')];_0x45757c+=0x1){socket[_0x370e('0x88')](_0x370e('0x8c'),{'UserId':Number(_0x5ee260[_0x370e('0x53')]['ids'][_0x45757c]),'WhatsappQueueId':Number(_0x5ee260['params']['id'])});}return _0x5273ae;});}})[_0x370e('0x2b')](respondWithResult(_0x210918,null))['catch'](handleError(_0x210918,null));};exports[_0x370e('0x87')]=function(_0x57118b,_0x16715d,_0x328dd2){return db['WhatsappQueue']['find']({'where':{'id':_0x57118b[_0x370e('0x50')]['id']}})['then'](handleEntityNotFound(_0x16715d,null))[_0x370e('0x2b')](function(_0x9b11d6){if(_0x9b11d6){return _0x9b11d6['removeAgents'](_0x57118b[_0x370e('0x3b')][_0x370e('0x85')])['then'](function(){if(_['isArray'](_0x57118b['query']['ids'])){for(var _0x1aaecc=0x0;_0x1aaecc<_0x57118b[_0x370e('0x3b')]['ids'][_0x370e('0x41')];_0x1aaecc+=0x1){socket[_0x370e('0x88')](_0x370e('0x89'),{'UserId':Number(_0x57118b[_0x370e('0x3b')][_0x370e('0x85')][_0x1aaecc]),'WhatsappQueueId':Number(_0x57118b[_0x370e('0x50')]['id'])});}}else{socket[_0x370e('0x88')](_0x370e('0x89'),{'UserId':Number(_0x57118b[_0x370e('0x3b')][_0x370e('0x85')]),'WhatsappQueueId':Number(_0x57118b['params']['id'])});}});}})[_0x370e('0x2b')](respondWithStatusCode(_0x16715d,null))[_0x370e('0x4e')](handleError(_0x16715d,null));};exports['getAgents']=function(_0x121f57,_0x3080ca,_0x4c51e1){var _0x442ace={};var _0x14b6d3={};var _0x30fe95;var _0x4a2def;return db['WhatsappQueue']['findOne']({'where':{'id':_0x121f57[_0x370e('0x50')]['id']}})[_0x370e('0x2b')](handleEntityNotFound(_0x3080ca,null))[_0x370e('0x2b')](function(_0x51bb1d){if(_0x51bb1d){_0x30fe95=_0x51bb1d;_0x14b6d3[_0x370e('0x39')]=_[_0x370e('0x3c')](db[_0x370e('0x60')][_0x370e('0x36')]);_0x14b6d3[_0x370e('0x3b')]=_['keys'](_0x121f57[_0x370e('0x3b')]);_0x14b6d3[_0x370e('0x3d')]=_['intersection'](_0x14b6d3['model'],_0x14b6d3['query']);_0x442ace[_0x370e('0x3e')]=_[_0x370e('0x3f')](_0x14b6d3[_0x370e('0x39')],qs[_0x370e('0x40')](_0x121f57[_0x370e('0x3b')][_0x370e('0x40')]));_0x442ace[_0x370e('0x3e')]=_0x442ace[_0x370e('0x3e')][_0x370e('0x41')]?_0x442ace['attributes']:_0x14b6d3[_0x370e('0x39')];_0x442ace[_0x370e('0x43')]=qs['sort'](_0x121f57['query'][_0x370e('0x44')]);_0x442ace[_0x370e('0x4a')]=qs[_0x370e('0x3d')](_[_0x370e('0x45')](_0x121f57['query'],_0x14b6d3[_0x370e('0x3d')]));if(_0x121f57[_0x370e('0x3b')][_0x370e('0x48')]){_0x442ace[_0x370e('0x4a')]=_[_0x370e('0x46')](_0x442ace[_0x370e('0x4a')],{'$or':_[_0x370e('0x3a')](_0x442ace[_0x370e('0x3e')],function(_0x3a5b11){var _0x9bd80d={};_0x9bd80d[_0x3a5b11]={'$like':'%'+_0x121f57[_0x370e('0x3b')][_0x370e('0x48')]+'%'};return _0x9bd80d;})});}_0x442ace=_[_0x370e('0x46')]({},_0x442ace,_0x121f57['options']);return _0x30fe95['getAgents'](_0x442ace);}})[_0x370e('0x2b')](function(_0x41c3b6){if(_0x41c3b6){_0x4a2def=_0x41c3b6['length'];if(!_0x121f57[_0x370e('0x3b')][_0x370e('0x5e')](_0x370e('0x42'))){_0x442ace[_0x370e('0x23')]=qs[_0x370e('0x23')](_0x121f57[_0x370e('0x3b')][_0x370e('0x23')]);_0x442ace[_0x370e('0x21')]=qs['offset'](_0x121f57[_0x370e('0x3b')][_0x370e('0x21')]);}return _0x30fe95[_0x370e('0x8d')](_0x442ace);}})[_0x370e('0x2b')](function(_0x49121b){if(_0x49121b){return _0x49121b?{'count':_0x4a2def,'rows':_0x49121b}:null;}})[_0x370e('0x2b')](respondWithResult(_0x3080ca,null))[_0x370e('0x4e')](handleError(_0x3080ca,null));}; \ No newline at end of file +var _0x30ad=['undefined','count','set','Content-Range','apply','then','destroy','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','WhatsappQueue','includeAll','include','findAll','rows','catch','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','order','getTeams','Team','Agents','voicePause','interface','sequelize','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','transaction','ids','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','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','register','status','end','json','offset','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30ad,0x18a));var _0xd30a=function(_0x2f34bc,_0x3e2489){_0x2f34bc=_0x2f34bc-0x0;var _0x666a44=_0x30ad[_0x2f34bc];return _0x666a44;};'use strict';var emlformat=require(_0xd30a('0x0'));var rimraf=require(_0xd30a('0x1'));var zipdir=require(_0xd30a('0x2'));var jsonpatch=require(_0xd30a('0x3'));var rp=require(_0xd30a('0x4'));var moment=require('moment');var BPromise=require(_0xd30a('0x5'));var Mustache=require('mustache');var util=require(_0xd30a('0x6'));var path=require(_0xd30a('0x7'));var sox=require('sox');var csv=require(_0xd30a('0x8'));var ejs=require(_0xd30a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd30a('0xa'));var crypto=require(_0xd30a('0xb'));var jsforce=require(_0xd30a('0xc'));var deskjs=require(_0xd30a('0xd'));var toCsv=require(_0xd30a('0x8'));var querystring=require(_0xd30a('0xe'));var Papa=require(_0xd30a('0xf'));var Redis=require(_0xd30a('0x10'));var authService=require(_0xd30a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd30a('0x12'));var hardwareService=require(_0xd30a('0x13'));var logger=require(_0xd30a('0x14'))(_0xd30a('0x15'));var utils=require(_0xd30a('0x16'));var config=require(_0xd30a('0x17'));var licenseUtil=require(_0xd30a('0x18'));var db=require(_0xd30a('0x19'))['db'];config[_0xd30a('0x1a')]=_[_0xd30a('0x1b')](config[_0xd30a('0x1a')],{'host':_0xd30a('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd30a('0x1a')]));require('./whatsappQueue.socket')[_0xd30a('0x1d')](socket);function respondWithStatusCode(_0x2fe919,_0x377224){_0x377224=_0x377224||0xcc;return function(_0x199a97){if(_0x199a97){return _0x2fe919['sendStatus'](_0x377224);}return _0x2fe919[_0xd30a('0x1e')](_0x377224)[_0xd30a('0x1f')]();};}function respondWithResult(_0x53555b,_0xc24a4b){_0xc24a4b=_0xc24a4b||0xc8;return function(_0x362efc){if(_0x362efc){return _0x53555b['status'](_0xc24a4b)[_0xd30a('0x20')](_0x362efc);}};}function respondWithFilteredResult(_0x1065d5,_0x55072f){return function(_0x9305aa){if(_0x9305aa){var _0x140dff=typeof _0x55072f[_0xd30a('0x21')]==='undefined'&&typeof _0x55072f[_0xd30a('0x22')]===_0xd30a('0x23');var _0x352541=_0x9305aa['count'];var _0x3057b0=_0x140dff?0x0:_0x55072f[_0xd30a('0x21')];var _0x5a099c=_0x140dff?_0x9305aa[_0xd30a('0x24')]:_0x55072f[_0xd30a('0x21')]+_0x55072f[_0xd30a('0x22')];var _0x4ddf69;if(_0x5a099c>=_0x352541){_0x5a099c=_0x352541;_0x4ddf69=0xc8;}else{_0x4ddf69=0xce;}_0x1065d5[_0xd30a('0x1e')](_0x4ddf69);return _0x1065d5[_0xd30a('0x25')](_0xd30a('0x26'),_0x3057b0+'-'+_0x5a099c+'/'+_0x352541)['json'](_0x9305aa);}return null;};}function patchUpdates(_0x4284af){return function(_0x493e73){try{jsonpatch[_0xd30a('0x27')](_0x493e73,_0x4284af,!![]);}catch(_0x139f4e){return BPromise['reject'](_0x139f4e);}return _0x493e73['save']();};}function saveUpdates(_0x1b06c7,_0x4f3f20){return function(_0x5f5693){if(_0x5f5693){return _0x5f5693['update'](_0x1b06c7)[_0xd30a('0x28')](function(_0x36cf4a){return _0x36cf4a;});}return null;};}function removeEntity(_0x57a5f3,_0x35515f){return function(_0x2cbcb0){if(_0x2cbcb0){return _0x2cbcb0[_0xd30a('0x29')]()[_0xd30a('0x28')](function(){var _0x5bbf86=_0x2cbcb0[_0xd30a('0x2a')]({'plain':!![]});var _0x4e55a4=_0xd30a('0x2b');return db[_0xd30a('0x2c')][_0xd30a('0x29')]({'where':{'type':_0x4e55a4,'resourceId':_0x5bbf86['id']}})[_0xd30a('0x28')](function(){return _0x2cbcb0;});})[_0xd30a('0x28')](function(){_0x57a5f3[_0xd30a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x499c13,_0x4ce9cf){return function(_0x5cd8a1){if(!_0x5cd8a1){_0x499c13[_0xd30a('0x2d')](0x194);}return _0x5cd8a1;};}function handleError(_0x336436,_0x35753e){_0x35753e=_0x35753e||0x1f4;return function(_0xd43936){logger[_0xd30a('0x2e')](_0xd43936[_0xd30a('0x2f')]);if(_0xd43936[_0xd30a('0x30')]){delete _0xd43936[_0xd30a('0x30')];}_0x336436[_0xd30a('0x1e')](_0x35753e)[_0xd30a('0x31')](_0xd43936);};}exports[_0xd30a('0x32')]=function(_0x5460a2,_0x45a143){var _0x781bc={},_0x577143={},_0x39fd5b={'count':0x0,'rows':[]};var _0x51b129=_[_0xd30a('0x33')](db['WhatsappQueue'][_0xd30a('0x34')],function(_0x5b194a){return{'name':_0x5b194a[_0xd30a('0x35')],'type':_0x5b194a[_0xd30a('0x36')][_0xd30a('0x37')]};});_0x577143[_0xd30a('0x38')]=_['map'](_0x51b129,_0xd30a('0x30'));_0x577143[_0xd30a('0x39')]=_[_0xd30a('0x3a')](_0x5460a2[_0xd30a('0x39')]);_0x577143[_0xd30a('0x3b')]=_[_0xd30a('0x3c')](_0x577143[_0xd30a('0x38')],_0x577143[_0xd30a('0x39')]);_0x781bc['attributes']=_[_0xd30a('0x3c')](_0x577143['model'],qs['fields'](_0x5460a2[_0xd30a('0x39')][_0xd30a('0x3d')]));_0x781bc[_0xd30a('0x3e')]=_0x781bc[_0xd30a('0x3e')][_0xd30a('0x3f')]?_0x781bc[_0xd30a('0x3e')]:_0x577143[_0xd30a('0x38')];if(!_0x5460a2[_0xd30a('0x39')][_0xd30a('0x40')](_0xd30a('0x41'))){_0x781bc[_0xd30a('0x22')]=qs[_0xd30a('0x22')](_0x5460a2[_0xd30a('0x39')][_0xd30a('0x22')]);_0x781bc[_0xd30a('0x21')]=qs[_0xd30a('0x21')](_0x5460a2[_0xd30a('0x39')]['offset']);}_0x781bc['order']=qs[_0xd30a('0x42')](_0x5460a2[_0xd30a('0x39')][_0xd30a('0x42')]);_0x781bc['where']=qs['filters'](_[_0xd30a('0x43')](_0x5460a2[_0xd30a('0x39')],_0x577143[_0xd30a('0x3b')]),_0x51b129);if(_0x5460a2['query']['filter']){_0x781bc[_0xd30a('0x44')]=_['merge'](_0x781bc[_0xd30a('0x44')],{'$or':_[_0xd30a('0x33')](_0x51b129,function(_0x530255){if(_0x530255[_0xd30a('0x36')]!==_0xd30a('0x45')){var _0x40f680={};_0x40f680[_0x530255[_0xd30a('0x30')]]={'$like':'%'+_0x5460a2[_0xd30a('0x39')][_0xd30a('0x46')]+'%'};return _0x40f680;}})});}_0x781bc=_[_0xd30a('0x47')]({},_0x781bc,_0x5460a2[_0xd30a('0x48')]);var _0x45fa46={'where':_0x781bc[_0xd30a('0x44')]};return db[_0xd30a('0x49')][_0xd30a('0x24')](_0x45fa46)[_0xd30a('0x28')](function(_0x396d40){_0x39fd5b[_0xd30a('0x24')]=_0x396d40;if(_0x5460a2['query'][_0xd30a('0x4a')]){_0x781bc[_0xd30a('0x4b')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xd30a('0x4c')](_0x781bc);})[_0xd30a('0x28')](function(_0x5da0d2){_0x39fd5b[_0xd30a('0x4d')]=_0x5da0d2;return _0x39fd5b;})['then'](respondWithFilteredResult(_0x45a143,_0x781bc))[_0xd30a('0x4e')](handleError(_0x45a143,null));};exports['show']=function(_0x1aaaa5,_0x5d2a99){var _0x5ef733={'raw':!![],'where':{'id':_0x1aaaa5[_0xd30a('0x4f')]['id']}},_0x24ed31={};_0x24ed31[_0xd30a('0x38')]=_['keys'](db['WhatsappQueue'][_0xd30a('0x34')]);_0x24ed31[_0xd30a('0x39')]=_[_0xd30a('0x3a')](_0x1aaaa5[_0xd30a('0x39')]);_0x24ed31[_0xd30a('0x3b')]=_[_0xd30a('0x3c')](_0x24ed31[_0xd30a('0x38')],_0x24ed31[_0xd30a('0x39')]);_0x5ef733[_0xd30a('0x3e')]=_[_0xd30a('0x3c')](_0x24ed31[_0xd30a('0x38')],qs[_0xd30a('0x3d')](_0x1aaaa5['query'][_0xd30a('0x3d')]));_0x5ef733[_0xd30a('0x3e')]=_0x5ef733[_0xd30a('0x3e')][_0xd30a('0x3f')]?_0x5ef733[_0xd30a('0x3e')]:_0x24ed31[_0xd30a('0x38')];if(_0x1aaaa5[_0xd30a('0x39')][_0xd30a('0x4a')]){_0x5ef733['include']=[{'all':!![]}];}_0x5ef733=_[_0xd30a('0x47')]({},_0x5ef733,_0x1aaaa5[_0xd30a('0x48')]);return db[_0xd30a('0x49')]['find'](_0x5ef733)['then'](handleEntityNotFound(_0x5d2a99,null))[_0xd30a('0x28')](respondWithResult(_0x5d2a99,null))[_0xd30a('0x4e')](handleError(_0x5d2a99,null));};exports[_0xd30a('0x50')]=function(_0x4c4429,_0xf8bb45){return db[_0xd30a('0x49')][_0xd30a('0x50')](_0x4c4429[_0xd30a('0x51')],{})['then'](function(_0x14c14b){var _0x51422a=_0x4c4429['user'][_0xd30a('0x2a')]({'plain':!![]});if(!_0x51422a)throw new Error(_0xd30a('0x52'));if(_0x51422a['role']==='user'){var _0x4ca2ba=_0x14c14b[_0xd30a('0x2a')]({'plain':!![]});var _0xe6515=_0xd30a('0x2b');return db[_0xd30a('0x53')][_0xd30a('0x54')]({'where':{'name':_0xe6515,'userProfileId':_0x51422a[_0xd30a('0x55')]},'raw':!![]})['then'](function(_0x1d5a59){if(_0x1d5a59&&_0x1d5a59[_0xd30a('0x56')]===0x0){return db[_0xd30a('0x2c')][_0xd30a('0x50')]({'name':_0x4ca2ba[_0xd30a('0x30')],'resourceId':_0x4ca2ba['id'],'type':_0x1d5a59[_0xd30a('0x30')],'sectionId':_0x1d5a59['id']},{})[_0xd30a('0x28')](function(){return _0x14c14b;});}else{return _0x14c14b;}})['catch'](function(_0x555fc5){logger[_0xd30a('0x2e')](_0xd30a('0x57'),_0x555fc5);throw _0x555fc5;});}return _0x14c14b;})[_0xd30a('0x28')](respondWithResult(_0xf8bb45,0xc9))[_0xd30a('0x4e')](handleError(_0xf8bb45,null));};exports[_0xd30a('0x58')]=function(_0x7cc44c,_0x2f6e92){if(_0x7cc44c[_0xd30a('0x51')]['id']){delete _0x7cc44c[_0xd30a('0x51')]['id'];}return db[_0xd30a('0x49')][_0xd30a('0x54')]({'where':{'id':_0x7cc44c['params']['id']}})['then'](handleEntityNotFound(_0x2f6e92,null))[_0xd30a('0x28')](saveUpdates(_0x7cc44c['body'],null))[_0xd30a('0x28')](respondWithResult(_0x2f6e92,null))['catch'](handleError(_0x2f6e92,null));};exports[_0xd30a('0x29')]=function(_0x403f5b,_0x27b963){return db[_0xd30a('0x49')][_0xd30a('0x54')]({'where':{'id':_0x403f5b[_0xd30a('0x4f')]['id']}})[_0xd30a('0x28')](handleEntityNotFound(_0x27b963,null))[_0xd30a('0x28')](removeEntity(_0x27b963,null))[_0xd30a('0x4e')](handleError(_0x27b963,null));};exports['describe']=function(_0x819b79,_0xf42483){return db[_0xd30a('0x49')][_0xd30a('0x59')]()[_0xd30a('0x28')](respondWithResult(_0xf42483,null))[_0xd30a('0x4e')](handleError(_0xf42483,null));};exports[_0xd30a('0x5a')]=function(_0xbf470c,_0x41d46a,_0x4898af){var _0x35beb2={'raw':!![],'where':{}},_0x668870={},_0x30efa1;return db['WhatsappQueue'][_0xd30a('0x5b')]({'where':{'id':_0xbf470c[_0xd30a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x41d46a,null))[_0xd30a('0x28')](function(_0x4d64de){if(_0x4d64de){_0x30efa1=_0x4d64de[_0xd30a('0x2a')]({'plain':!![]});_0x668870['model']=_[_0xd30a('0x3a')](db[_0xd30a('0x5c')][_0xd30a('0x34')]);_0x668870['query']=_[_0xd30a('0x3a')](_0xbf470c['query']);_0x668870[_0xd30a('0x3b')]=_[_0xd30a('0x3c')](_0x668870[_0xd30a('0x38')],_0x668870['query']);_0x35beb2[_0xd30a('0x3e')]=_[_0xd30a('0x3c')](_0x668870[_0xd30a('0x38')],qs[_0xd30a('0x3d')](_0xbf470c[_0xd30a('0x39')][_0xd30a('0x3d')]));_0x35beb2[_0xd30a('0x3e')]=_0x35beb2[_0xd30a('0x3e')][_0xd30a('0x3f')]?_0x35beb2[_0xd30a('0x3e')]:_0x668870[_0xd30a('0x38')];if(!_0xbf470c['query']['hasOwnProperty'](_0xd30a('0x41'))){_0x35beb2[_0xd30a('0x22')]=qs['limit'](_0xbf470c[_0xd30a('0x39')]['limit']);_0x35beb2[_0xd30a('0x21')]=qs['offset'](_0xbf470c[_0xd30a('0x39')][_0xd30a('0x21')]);}_0x35beb2['order']=qs['sort'](_0xbf470c[_0xd30a('0x39')][_0xd30a('0x42')]);_0x35beb2[_0xd30a('0x44')]=qs[_0xd30a('0x3b')](_[_0xd30a('0x43')](_0xbf470c[_0xd30a('0x39')],_0x668870[_0xd30a('0x3b')]));_0x35beb2[_0xd30a('0x44')][_0xd30a('0x5d')]=_0x4d64de['id'];if(_0xbf470c[_0xd30a('0x39')][_0xd30a('0x46')]){_0x35beb2['where']=_[_0xd30a('0x47')](_0x35beb2[_0xd30a('0x44')],{'$or':_[_0xd30a('0x33')](_0x35beb2[_0xd30a('0x3e')],function(_0x463368){var _0x534ac6={};_0x534ac6[_0x463368]={'$like':'%'+_0xbf470c[_0xd30a('0x39')][_0xd30a('0x46')]+'%'};return _0x534ac6;})});}_0x35beb2=_[_0xd30a('0x47')]({},_0x35beb2,_0xbf470c['options']);return db[_0xd30a('0x5c')][_0xd30a('0x4c')](_0x35beb2);}})['then'](function(_0x24bde0){if(_0x24bde0){return db[_0xd30a('0x5e')][_0xd30a('0x5f')]({'where':{'id':_[_0xd30a('0x33')](_0x24bde0,_0xd30a('0x60')),'role':_0xd30a('0x61')},'attributes':['id',_0xd30a('0x30'),'whatsappPause',_0xd30a('0x62'),_0xd30a('0x63')]});}})[_0xd30a('0x28')](function(_0x4ec388){if(_0x4ec388){return{'count':_0x4ec388['count'],'rows':_[_0xd30a('0x33')](_0x4ec388[_0xd30a('0x4d')],function(_0xe96715){return{'membername':_0xe96715[_0xd30a('0x30')],'UserId':_0xe96715['id'],'queue_name':_0x30efa1['name'],'WhatsappQueueId':_0x30efa1['id'],'interface':util[_0xd30a('0x64')](_0xd30a('0x65'),_0xd30a('0x66'),_0xe96715['name']),'penalty':0x0,'paused':_0xe96715[_0xd30a('0x67')],'createdAt':_0xe96715['createdAt'],'updatedAt':_0xe96715[_0xd30a('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd30a('0x28')](respondWithFilteredResult(_0x41d46a,_0x35beb2))[_0xd30a('0x4e')](handleError(_0x41d46a,null));};exports['getTeams']=function(_0x2b8dbb,_0x19cd4b,_0x1e83a3){var _0x565aa1={};var _0x4baa34={};var _0x206fec;var _0x426245;return db['WhatsappQueue'][_0xd30a('0x5b')]({'where':{'id':_0x2b8dbb['params']['id']}})[_0xd30a('0x28')](handleEntityNotFound(_0x19cd4b,null))[_0xd30a('0x28')](function(_0x5c4b30){if(_0x5c4b30){_0x206fec=_0x5c4b30;_0x4baa34[_0xd30a('0x38')]=_[_0xd30a('0x3a')](db['Team'][_0xd30a('0x34')]);_0x4baa34[_0xd30a('0x39')]=_['keys'](_0x2b8dbb['query']);_0x4baa34[_0xd30a('0x3b')]=_[_0xd30a('0x3c')](_0x4baa34['model'],_0x4baa34[_0xd30a('0x39')]);_0x565aa1[_0xd30a('0x3e')]=_[_0xd30a('0x3c')](_0x4baa34[_0xd30a('0x38')],qs[_0xd30a('0x3d')](_0x2b8dbb['query'][_0xd30a('0x3d')]));_0x565aa1[_0xd30a('0x3e')]=_0x565aa1['attributes'][_0xd30a('0x3f')]?_0x565aa1[_0xd30a('0x3e')]:_0x4baa34[_0xd30a('0x38')];_0x565aa1[_0xd30a('0x68')]=qs['sort'](_0x2b8dbb[_0xd30a('0x39')][_0xd30a('0x42')]);_0x565aa1[_0xd30a('0x44')]=qs[_0xd30a('0x3b')](_[_0xd30a('0x43')](_0x2b8dbb[_0xd30a('0x39')],_0x4baa34[_0xd30a('0x3b')]));if(_0x2b8dbb[_0xd30a('0x39')][_0xd30a('0x46')]){_0x565aa1[_0xd30a('0x44')]=_[_0xd30a('0x47')](_0x565aa1[_0xd30a('0x44')],{'$or':_[_0xd30a('0x33')](_0x565aa1['attributes'],function(_0x26d46b){var _0x5918c5={};_0x5918c5[_0x26d46b]={'$like':'%'+_0x2b8dbb[_0xd30a('0x39')]['filter']+'%'};return _0x5918c5;})});}_0x565aa1=_[_0xd30a('0x47')]({},_0x565aa1,_0x2b8dbb[_0xd30a('0x48')]);return _0x206fec[_0xd30a('0x69')](_0x565aa1);}})[_0xd30a('0x28')](function(_0x4ee9af){if(_0x4ee9af){_0x426245=_0x4ee9af['length'];if(!_0x2b8dbb[_0xd30a('0x39')][_0xd30a('0x40')](_0xd30a('0x41'))){_0x565aa1['limit']=qs[_0xd30a('0x22')](_0x2b8dbb[_0xd30a('0x39')][_0xd30a('0x22')]);_0x565aa1[_0xd30a('0x21')]=qs['offset'](_0x2b8dbb['query']['offset']);}return _0x206fec['getTeams'](_0x565aa1);}})[_0xd30a('0x28')](function(_0x393227){if(_0x393227){return _0x393227?{'count':_0x426245,'rows':_0x393227}:null;}})['then'](respondWithResult(_0x19cd4b,null))[_0xd30a('0x4e')](handleError(_0x19cd4b,null));};exports['addTeams']=function(_0x3def29,_0x3f03c6,_0x442975){var _0x23624b=_0x3def29[_0xd30a('0x51')]['ids'];return db[_0xd30a('0x6a')][_0xd30a('0x4c')]({'where':{'id':_0x23624b},'attributes':['id'],'include':[{'model':db[_0xd30a('0x5e')],'as':_0xd30a('0x6b'),'attributes':['id','name','online',_0xd30a('0x6c'),_0xd30a('0x6d')],'raw':!![]}]})['then'](function(_0x59f949){if(_0x59f949){var _0xb2f832=_['flatMap'](_0x59f949,function(_0x376f0b){var _0x591ea8=_0x376f0b[_0xd30a('0x2a')]({'plain':!![]});return _0x591ea8['Agents'];});return db[_0xd30a('0x49')][_0xd30a('0x54')]({'where':{'id':_0x3def29['params']['id']}})['then'](function(_0x4fb9f4){return db[_0xd30a('0x6e')]['transaction'](function(_0x58cba2){return _0x4fb9f4['addTeams'](_0x23624b,{'transaction':_0x58cba2})[_0xd30a('0x28')](function(){return BPromise[_0xd30a('0x6f')](_0xb2f832,function(_0x5e9802){return db[_0xd30a('0x5c')][_0xd30a('0x70')]({'where':{'UserId':_0x5e9802['id'],'WhatsappQueueId':_0x3def29['params']['id']},'transaction':_0x58cba2});});})[_0xd30a('0x28')](function(){_0xb2f832['forEach'](function(_0xf46c6f){socket[_0xd30a('0x71')](_0xd30a('0x72'),{'UserId':_0xf46c6f['id'],'WhatsappQueueId':_0x4fb9f4['id']});});});});});}})['then'](respondWithStatusCode(_0x3f03c6,null))[_0xd30a('0x4e')](handleError(_0x3f03c6,null));};exports[_0xd30a('0x73')]=function(_0x1f75d6,_0x1b3cf9,_0x464433){return db['Team'][_0xd30a('0x4c')]({'where':{'id':_0x1f75d6[_0xd30a('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd30a('0x5e')],'as':_0xd30a('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xd30a('0x28')](handleEntityNotFound(_0x1b3cf9,null))[_0xd30a('0x28')](function(_0x18b4e5){var _0xd688ac=_[_0xd30a('0x33')](_0x18b4e5,'id');var _0x1f3c18=[];var _0x2850ec=[];var _0x2a9c7b=squel[_0xd30a('0x74')]();_0x2a9c7b['field'](_0xd30a('0x75'))['from'](_0xd30a('0x76'),'tq')[_0xd30a('0x77')]('user_has_teams','ut',_0xd30a('0x78'))[_0xd30a('0x44')](_0xd30a('0x79'),_0x1f75d6[_0xd30a('0x4f')]['id']);for(var _0x301f7f=0x0;_0x301f7f<_0x18b4e5[_0xd30a('0x3f')];_0x301f7f+=0x1){let _0x256bfd=_0x18b4e5[_0x301f7f];for(var _0x185b8c=0x0;_0x185b8c<_0x256bfd[_0xd30a('0x6b')][_0xd30a('0x3f')];_0x185b8c+=0x1){let _0xc6331f=_0x256bfd[_0xd30a('0x6b')][_0x185b8c];var _0x46f7cb=_0x2a9c7b[_0xd30a('0x7a')]();_0x46f7cb['where'](_0xd30a('0x7b'),_0xc6331f['id']);_0x2850ec[_0xd30a('0x7c')](db[_0xd30a('0x6e')][_0xd30a('0x39')](_0x46f7cb[_0xd30a('0x7d')](),{'type':db['sequelize'][_0xd30a('0x7e')][_0xd30a('0x7f')]})[_0xd30a('0x28')](function(_0x4ef36c){if(_0x4ef36c[_0xd30a('0x3f')]===0x1){return _0xc6331f['id'];}else{var _0xf2c4b2=_['every'](_[_0xd30a('0x33')](_0x4ef36c,_0xd30a('0x80')),function(_0x123612){return _['includes'](_0xd688ac,_0x123612);});if(_0xf2c4b2){return _0xc6331f['id'];}}}));}}return BPromise[_0xd30a('0x81')](_0x2850ec)[_0xd30a('0x28')](function(_0x110ba8){_0x1f3c18=_(_0x1f3c18)[_0xd30a('0x82')](_0x110ba8)[_0xd30a('0x83')]()[_0xd30a('0x84')]();return db['WhatsappQueue'][_0xd30a('0x54')]({'where':{'id':_0x1f75d6[_0xd30a('0x4f')]['id']}})[_0xd30a('0x28')](function(_0x3223ff){return db[_0xd30a('0x6e')][_0xd30a('0x85')](function(_0xdea2ea){return _0x3223ff[_0xd30a('0x73')](_0x1f75d6[_0xd30a('0x39')][_0xd30a('0x86')],{'transaction':_0xdea2ea})['then'](function(){if(!_[_0xd30a('0x87')](_0x1f3c18)){return _0x3223ff[_0xd30a('0x88')](_0x1f3c18,{'transaction':_0xdea2ea});}})[_0xd30a('0x28')](function(){_0x1f3c18[_0xd30a('0x89')](function(_0x4f46c4){socket[_0xd30a('0x71')](_0xd30a('0x8a'),{'UserId':_0x4f46c4,'WhatsappQueueId':_0x3223ff['id']});});});});});});})[_0xd30a('0x28')](respondWithStatusCode(_0x1b3cf9,null))[_0xd30a('0x4e')](handleError(_0x1b3cf9,null));};exports[_0xd30a('0x8b')]=function(_0x12004e,_0x2d41ef,_0x4b3f58){return db[_0xd30a('0x49')]['find']({'where':{'id':_0x12004e[_0xd30a('0x4f')]['id']}})[_0xd30a('0x28')](handleEntityNotFound(_0x2d41ef,null))[_0xd30a('0x28')](function(_0x38e137){if(_0x38e137){return _0x38e137[_0xd30a('0x8b')](_0x12004e[_0xd30a('0x51')][_0xd30a('0x86')],_[_0xd30a('0x8c')](_0x12004e['body'],[_0xd30a('0x86'),'id'])||{})['spread'](function(_0x176dd3){for(var _0x51e3b5=0x0;_0x51e3b5<_0x12004e[_0xd30a('0x51')][_0xd30a('0x86')]['length'];_0x51e3b5+=0x1){socket['emit'](_0xd30a('0x72'),{'UserId':Number(_0x12004e[_0xd30a('0x51')]['ids'][_0x51e3b5]),'WhatsappQueueId':Number(_0x12004e[_0xd30a('0x4f')]['id'])});}return _0x176dd3;});}})['then'](respondWithResult(_0x2d41ef,null))['catch'](handleError(_0x2d41ef,null));};exports[_0xd30a('0x88')]=function(_0x722549,_0xc892ae,_0x3c196c){return db[_0xd30a('0x49')][_0xd30a('0x54')]({'where':{'id':_0x722549[_0xd30a('0x4f')]['id']}})[_0xd30a('0x28')](handleEntityNotFound(_0xc892ae,null))[_0xd30a('0x28')](function(_0x39ae17){if(_0x39ae17){return _0x39ae17['removeAgents'](_0x722549[_0xd30a('0x39')][_0xd30a('0x86')])[_0xd30a('0x28')](function(){if(_[_0xd30a('0x8d')](_0x722549[_0xd30a('0x39')]['ids'])){for(var _0x2149ee=0x0;_0x2149ee<_0x722549['query']['ids']['length'];_0x2149ee+=0x1){socket[_0xd30a('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x722549[_0xd30a('0x39')][_0xd30a('0x86')][_0x2149ee]),'WhatsappQueueId':Number(_0x722549[_0xd30a('0x4f')]['id'])});}}else{socket[_0xd30a('0x71')](_0xd30a('0x8a'),{'UserId':Number(_0x722549['query'][_0xd30a('0x86')]),'WhatsappQueueId':Number(_0x722549[_0xd30a('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0xc892ae,null))['catch'](handleError(_0xc892ae,null));};exports[_0xd30a('0x8e')]=function(_0x24579b,_0x27772e,_0x5d6dce){var _0x48edb1={};var _0x2f47d1={};var _0x279d39;var _0x12dbe7;return db[_0xd30a('0x49')]['findOne']({'where':{'id':_0x24579b[_0xd30a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x27772e,null))[_0xd30a('0x28')](function(_0x26c6bd){if(_0x26c6bd){_0x279d39=_0x26c6bd;_0x2f47d1[_0xd30a('0x38')]=_['keys'](db['User'][_0xd30a('0x34')]);_0x2f47d1[_0xd30a('0x39')]=_['keys'](_0x24579b[_0xd30a('0x39')]);_0x2f47d1[_0xd30a('0x3b')]=_[_0xd30a('0x3c')](_0x2f47d1[_0xd30a('0x38')],_0x2f47d1[_0xd30a('0x39')]);_0x48edb1[_0xd30a('0x3e')]=_['intersection'](_0x2f47d1[_0xd30a('0x38')],qs[_0xd30a('0x3d')](_0x24579b[_0xd30a('0x39')][_0xd30a('0x3d')]));_0x48edb1['attributes']=_0x48edb1[_0xd30a('0x3e')][_0xd30a('0x3f')]?_0x48edb1[_0xd30a('0x3e')]:_0x2f47d1[_0xd30a('0x38')];_0x48edb1['order']=qs[_0xd30a('0x42')](_0x24579b[_0xd30a('0x39')][_0xd30a('0x42')]);_0x48edb1[_0xd30a('0x44')]=qs[_0xd30a('0x3b')](_[_0xd30a('0x43')](_0x24579b[_0xd30a('0x39')],_0x2f47d1['filters']));if(_0x24579b[_0xd30a('0x39')][_0xd30a('0x46')]){_0x48edb1[_0xd30a('0x44')]=_['merge'](_0x48edb1[_0xd30a('0x44')],{'$or':_[_0xd30a('0x33')](_0x48edb1[_0xd30a('0x3e')],function(_0x18a0b1){var _0x4a7244={};_0x4a7244[_0x18a0b1]={'$like':'%'+_0x24579b[_0xd30a('0x39')][_0xd30a('0x46')]+'%'};return _0x4a7244;})});}_0x48edb1=_[_0xd30a('0x47')]({},_0x48edb1,_0x24579b[_0xd30a('0x48')]);return _0x279d39[_0xd30a('0x8e')](_0x48edb1);}})[_0xd30a('0x28')](function(_0x595b2a){if(_0x595b2a){_0x12dbe7=_0x595b2a[_0xd30a('0x3f')];if(!_0x24579b['query'][_0xd30a('0x40')](_0xd30a('0x41'))){_0x48edb1[_0xd30a('0x22')]=qs[_0xd30a('0x22')](_0x24579b[_0xd30a('0x39')][_0xd30a('0x22')]);_0x48edb1[_0xd30a('0x21')]=qs[_0xd30a('0x21')](_0x24579b['query'][_0xd30a('0x21')]);}return _0x279d39[_0xd30a('0x8e')](_0x48edb1);}})[_0xd30a('0x28')](function(_0x27b00c){if(_0x27b00c){return _0x27b00c?{'count':_0x12dbe7,'rows':_0x27b00c}:null;}})[_0xd30a('0x28')](respondWithResult(_0x27772e,null))['catch'](handleError(_0x27772e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 850c927..1591119 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 _0x4111=['update','remove','emit','hasOwnProperty','exports','events','WhatsappQueue','save'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x4111,0x10d));var _0x1411=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4111[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x1411('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x1411('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1411('0x2'),'afterUpdate':_0x1411('0x3'),'afterDestroy':_0x1411('0x4')};function emitEvent(_0xc1523c){return function(_0x7093c2,_0x2f5f1d,_0x9699d9){WhatsappQueueEvents[_0x1411('0x5')](_0xc1523c+':'+_0x7093c2['id'],_0x7093c2);WhatsappQueueEvents['emit'](_0xc1523c,_0x7093c2);_0x9699d9(null);};}for(var e in events){if(events[_0x1411('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x1411('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xf7f8=['remove','emit','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf7f8,0xc0));var _0x8f7f=function(_0x571bd1,_0x1ed51c){_0x571bd1=_0x571bd1-0x0;var _0x4832d4=_0xf7f8[_0x571bd1];return _0x4832d4;};'use strict';var EventEmitter=require(_0x8f7f('0x0'));var WhatsappQueue=require(_0x8f7f('0x1'))['db'][_0x8f7f('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8f7f('0x3')](0x0);var events={'afterCreate':_0x8f7f('0x4'),'afterUpdate':_0x8f7f('0x5'),'afterDestroy':_0x8f7f('0x6')};function emitEvent(_0x3381a7){return function(_0x34b366,_0x2656fc,_0x14165f){WhatsappQueueEvents[_0x8f7f('0x7')](_0x3381a7+':'+_0x34b366['id'],_0x34b366);WhatsappQueueEvents[_0x8f7f('0x7')](_0x3381a7,_0x34b366);_0x14165f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x8f7f('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 21ded86..cf393eb 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 _0xac6f=['api','bluebird','path','rimraf','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','util','../../config/logger'];(function(_0x5356e1,_0x315f03){var _0x4a648b=function(_0xd2c8d7){while(--_0xd2c8d7){_0x5356e1['push'](_0x5356e1['shift']());}};_0x4a648b(++_0x315f03);}(_0xac6f,0x1ca));var _0xfac6=function(_0x35d59c,_0x341ef9){_0x35d59c=_0x35d59c-0x0;var _0x18cd27=_0xac6f[_0x35d59c];return _0x18cd27;};'use strict';var _=require('lodash');var util=require(_0xfac6('0x0'));var logger=require(_0xfac6('0x1'))(_0xfac6('0x2'));var moment=require('moment');var BPromise=require(_0xfac6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfac6('0x4'));var rimraf=require(_0xfac6('0x5'));var config=require('../../config/environment');var attributes=require(_0xfac6('0x6'));module[_0xfac6('0x7')]=function(_0x3f2b09,_0x1a793c){return _0x3f2b09['define'](_0xfac6('0x8'),attributes,{'tableName':_0xfac6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf21=['path','rimraf','../../config/environment','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2e93fc,_0x104452){var _0x1151fc=function(_0x431d0f){while(--_0x431d0f){_0x2e93fc['push'](_0x2e93fc['shift']());}};_0x1151fc(++_0x104452);}(_0xaf21,0xde));var _0x1af2=function(_0x9f98df,_0x20497b){_0x9f98df=_0x9f98df-0x0;var _0x4fc6b6=_0xaf21[_0x9f98df];return _0x4fc6b6;};'use strict';var _=require('lodash');var util=require(_0x1af2('0x0'));var logger=require(_0x1af2('0x1'))(_0x1af2('0x2'));var moment=require(_0x1af2('0x3'));var BPromise=require(_0x1af2('0x4'));var rp=require(_0x1af2('0x5'));var fs=require('fs');var path=require(_0x1af2('0x6'));var rimraf=require(_0x1af2('0x7'));var config=require(_0x1af2('0x8'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x55f21b,_0x5b11f1){return _0x55f21b[_0x1af2('0x9')](_0x1af2('0xa'),attributes,{'tableName':_0x1af2('0xb'),'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 d863bf5..60967d7 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 _0x35e6=['WhatsappQueue','find','lodash','util','moment','bluebird','../../mysqldb','rpc','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','GetWhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','stringify','catch','ShowWhatsappQueue'];(function(_0x5987d2,_0xccfa59){var _0x3f1acf=function(_0x44cba2){while(--_0x44cba2){_0x5987d2['push'](_0x5987d2['shift']());}};_0x3f1acf(++_0xccfa59);}(_0x35e6,0x113));var _0x635e=function(_0x22c00f,_0x33f101){_0x22c00f=_0x22c00f-0x0;var _0x34a543=_0x35e6[_0x22c00f];return _0x34a543;};'use strict';var _=require(_0x635e('0x0'));var util=require(_0x635e('0x1'));var moment=require(_0x635e('0x2'));var BPromise=require(_0x635e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x635e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x635e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x635e('0x6')]({'port':0x232a});config[_0x635e('0x7')]=_[_0x635e('0x8')](config[_0x635e('0x7')],{'host':_0x635e('0x9'),'port':0x18eb});var socket=require(_0x635e('0xa'))(new Redis(config[_0x635e('0x7')]));require(_0x635e('0xb'))[_0x635e('0xc')](socket);function respondWithRpcPromise(_0x52fed6,_0x40e6da,_0x4b4c99){return new BPromise(function(_0x306eef,_0x40920a){return client[_0x635e('0xd')](_0x52fed6,_0x4b4c99)[_0x635e('0xe')](function(_0x458560){logger[_0x635e('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x40e6da,_0x635e('0x10'));logger[_0x635e('0x11')](_0x635e('0x12'),_0x40e6da,_0x635e('0x10'),JSON['stringify'](_0x458560));if(_0x458560[_0x635e('0x13')]){if(_0x458560[_0x635e('0x13')][_0x635e('0x14')]===0x1f4){logger['error'](_0x635e('0x15'),_0x40e6da,_0x458560['error']['message']);return _0x40920a(_0x458560[_0x635e('0x13')][_0x635e('0x16')]);}logger[_0x635e('0x13')](_0x635e('0x15'),_0x40e6da,_0x458560[_0x635e('0x13')][_0x635e('0x16')]);return _0x306eef(_0x458560[_0x635e('0x13')][_0x635e('0x16')]);}else{logger[_0x635e('0xf')](_0x635e('0x15'),_0x40e6da,'request\x20sent');_0x306eef(_0x458560[_0x635e('0x17')][_0x635e('0x16')]);}})['catch'](function(_0x457c25){logger[_0x635e('0x13')](_0x635e('0x15'),_0x40e6da,_0x457c25);_0x40920a(_0x457c25);});});}exports[_0x635e('0x18')]=function(_0x5c2e99){var _0x2fb306=this;return new Promise(function(_0x951b4,_0x1f897b){return db['WhatsappQueue'][_0x635e('0x19')]({'raw':_0x5c2e99[_0x635e('0x1a')]?_0x5c2e99[_0x635e('0x1a')][_0x635e('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c2e99[_0x635e('0x1a')]?_0x5c2e99[_0x635e('0x1a')][_0x635e('0x1c')]||null:null,'attributes':_0x5c2e99[_0x635e('0x1a')]?_0x5c2e99[_0x635e('0x1a')]['attributes']||null:null,'limit':_0x5c2e99['options']?_0x5c2e99[_0x635e('0x1a')][_0x635e('0x1d')]||null:null,'include':_0x5c2e99[_0x635e('0x1a')]?_0x5c2e99[_0x635e('0x1a')][_0x635e('0x1e')]?_[_0x635e('0x1f')](_0x5c2e99[_0x635e('0x1a')][_0x635e('0x1e')],function(_0x66e7f){return{'model':db[_0x66e7f[_0x635e('0x20')]],'as':_0x66e7f['as'],'attributes':_0x66e7f[_0x635e('0x21')],'include':_0x66e7f[_0x635e('0x1e')]?_[_0x635e('0x1f')](_0x66e7f[_0x635e('0x1e')],function(_0x1cd891){return{'model':db[_0x1cd891[_0x635e('0x20')]],'as':_0x1cd891['as'],'attributes':_0x1cd891[_0x635e('0x21')],'include':_0x1cd891[_0x635e('0x1e')]?_['map'](_0x1cd891['include'],function(_0x8c2dbb){return{'model':db[_0x8c2dbb[_0x635e('0x20')]],'as':_0x8c2dbb['as'],'attributes':_0x8c2dbb[_0x635e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x635e('0xe')](function(_0xf2e552){logger[_0x635e('0xf')](_0x635e('0x18'),_0x5c2e99);logger[_0x635e('0x11')]('GetWhatsappQueue',_0x5c2e99,JSON[_0x635e('0x22')](_0xf2e552));_0x951b4(_0xf2e552);})[_0x635e('0x23')](function(_0x270257){logger[_0x635e('0x13')](_0x635e('0x18'),_0x270257[_0x635e('0x16')],_0x5c2e99);_0x1f897b(_0x2fb306['error'](0x1f4,_0x270257[_0x635e('0x16')]));});});};exports[_0x635e('0x24')]=function(_0x1433ab){var _0x5979c8=this;return new Promise(function(_0x5e94df,_0x202aa3){return db[_0x635e('0x25')][_0x635e('0x26')]({'raw':_0x1433ab[_0x635e('0x1a')]?_0x1433ab[_0x635e('0x1a')][_0x635e('0x1b')]===undefined?!![]:![]:!![],'where':_0x1433ab[_0x635e('0x1a')]?_0x1433ab[_0x635e('0x1a')][_0x635e('0x1c')]||null:null,'attributes':_0x1433ab['options']?_0x1433ab[_0x635e('0x1a')][_0x635e('0x21')]||null:null,'include':_0x1433ab['options']?_0x1433ab[_0x635e('0x1a')][_0x635e('0x1e')]?_[_0x635e('0x1f')](_0x1433ab[_0x635e('0x1a')]['include'],function(_0x20d81d){return{'model':db[_0x20d81d[_0x635e('0x20')]],'as':_0x20d81d['as'],'attributes':_0x20d81d[_0x635e('0x21')],'include':_0x20d81d[_0x635e('0x1e')]?_[_0x635e('0x1f')](_0x20d81d[_0x635e('0x1e')],function(_0x38f785){return{'model':db[_0x38f785['model']],'as':_0x38f785['as'],'attributes':_0x38f785[_0x635e('0x21')],'include':_0x38f785['include']?_[_0x635e('0x1f')](_0x38f785['include'],function(_0x5552a5){return{'model':db[_0x5552a5[_0x635e('0x20')]],'as':_0x5552a5['as'],'attributes':_0x5552a5[_0x635e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x635e('0xe')](function(_0x53a238){logger['info'](_0x635e('0x24'),_0x1433ab);logger[_0x635e('0x11')]('ShowWhatsappQueue',_0x1433ab,JSON['stringify'](_0x53a238));_0x5e94df(_0x53a238);})[_0x635e('0x23')](function(_0x519bb2){logger['error']('ShowWhatsappQueue',_0x519bb2[_0x635e('0x16')],_0x1433ab);_0x202aa3(_0x5979c8[_0x635e('0x13')](0x1f4,_0x519bb2[_0x635e('0x16')]));});});}; \ No newline at end of file +var _0xb3b9=['attributes','ShowWhatsappQueue','WhatsappQueue','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueue,\x20%s,\x20%s','result','catch','GetWhatsappQueue','options','where','limit','include','map','model'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xb3b9,0xa0));var _0x9b3b=function(_0x185618,_0xb45934){_0x185618=_0x185618-0x0;var _0x5a4041=_0xb3b9[_0x185618];return _0x5a4041;};'use strict';var _=require(_0x9b3b('0x0'));var util=require(_0x9b3b('0x1'));var moment=require('moment');var BPromise=require(_0x9b3b('0x2'));var rs=require(_0x9b3b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b3b('0x4'))['db'];var utils=require(_0x9b3b('0x5'));var logger=require('../../config/logger')(_0x9b3b('0x6'));var config=require(_0x9b3b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9b3b('0x8')][_0x9b3b('0x9')]({'port':0x232a});config['redis']=_[_0x9b3b('0xa')](config[_0x9b3b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9b3b('0xc'))(new Redis(config['redis']));require(_0x9b3b('0xd'))[_0x9b3b('0xe')](socket);function respondWithRpcPromise(_0xd7874c,_0x32ca56,_0x4133c0){return new BPromise(function(_0xe5737f,_0x3e8d97){return client[_0x9b3b('0xf')](_0xd7874c,_0x4133c0)[_0x9b3b('0x10')](function(_0x4c9e5c){logger[_0x9b3b('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x32ca56,_0x9b3b('0x12'));logger[_0x9b3b('0x13')](_0x9b3b('0x14'),_0x32ca56,_0x9b3b('0x12'),JSON[_0x9b3b('0x15')](_0x4c9e5c));if(_0x4c9e5c[_0x9b3b('0x16')]){if(_0x4c9e5c['error'][_0x9b3b('0x17')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x32ca56,_0x4c9e5c['error']['message']);return _0x3e8d97(_0x4c9e5c['error'][_0x9b3b('0x18')]);}logger[_0x9b3b('0x16')](_0x9b3b('0x19'),_0x32ca56,_0x4c9e5c[_0x9b3b('0x16')][_0x9b3b('0x18')]);return _0xe5737f(_0x4c9e5c[_0x9b3b('0x16')][_0x9b3b('0x18')]);}else{logger['info'](_0x9b3b('0x19'),_0x32ca56,_0x9b3b('0x12'));_0xe5737f(_0x4c9e5c[_0x9b3b('0x1a')][_0x9b3b('0x18')]);}})[_0x9b3b('0x1b')](function(_0x4249da){logger[_0x9b3b('0x16')](_0x9b3b('0x19'),_0x32ca56,_0x4249da);_0x3e8d97(_0x4249da);});});}exports[_0x9b3b('0x1c')]=function(_0x5815f0){var _0x4d9dbf=this;return new Promise(function(_0xc86408,_0x321755){return db['WhatsappQueue']['findAll']({'raw':_0x5815f0[_0x9b3b('0x1d')]?_0x5815f0[_0x9b3b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5815f0[_0x9b3b('0x1d')]?_0x5815f0[_0x9b3b('0x1d')][_0x9b3b('0x1e')]||null:null,'attributes':_0x5815f0[_0x9b3b('0x1d')]?_0x5815f0[_0x9b3b('0x1d')]['attributes']||null:null,'limit':_0x5815f0['options']?_0x5815f0[_0x9b3b('0x1d')][_0x9b3b('0x1f')]||null:null,'include':_0x5815f0['options']?_0x5815f0[_0x9b3b('0x1d')][_0x9b3b('0x20')]?_[_0x9b3b('0x21')](_0x5815f0[_0x9b3b('0x1d')]['include'],function(_0x5b972c){return{'model':db[_0x5b972c[_0x9b3b('0x22')]],'as':_0x5b972c['as'],'attributes':_0x5b972c[_0x9b3b('0x23')],'include':_0x5b972c[_0x9b3b('0x20')]?_['map'](_0x5b972c[_0x9b3b('0x20')],function(_0x375234){return{'model':db[_0x375234[_0x9b3b('0x22')]],'as':_0x375234['as'],'attributes':_0x375234[_0x9b3b('0x23')],'include':_0x375234['include']?_['map'](_0x375234['include'],function(_0x2a7284){return{'model':db[_0x2a7284[_0x9b3b('0x22')]],'as':_0x2a7284['as'],'attributes':_0x2a7284[_0x9b3b('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9b3b('0x10')](function(_0xa2076c){logger[_0x9b3b('0x11')](_0x9b3b('0x1c'),_0x5815f0);logger['debug'](_0x9b3b('0x1c'),_0x5815f0,JSON['stringify'](_0xa2076c));_0xc86408(_0xa2076c);})[_0x9b3b('0x1b')](function(_0x5f300c){logger[_0x9b3b('0x16')]('GetWhatsappQueue',_0x5f300c[_0x9b3b('0x18')],_0x5815f0);_0x321755(_0x4d9dbf[_0x9b3b('0x16')](0x1f4,_0x5f300c[_0x9b3b('0x18')]));});});};exports[_0x9b3b('0x24')]=function(_0x1d948a){var _0x38d9cd=this;return new Promise(function(_0x2a384c,_0x3cdd12){return db[_0x9b3b('0x25')]['find']({'raw':_0x1d948a[_0x9b3b('0x1d')]?_0x1d948a[_0x9b3b('0x1d')][_0x9b3b('0x26')]===undefined?!![]:![]:!![],'where':_0x1d948a[_0x9b3b('0x1d')]?_0x1d948a[_0x9b3b('0x1d')][_0x9b3b('0x1e')]||null:null,'attributes':_0x1d948a[_0x9b3b('0x1d')]?_0x1d948a[_0x9b3b('0x1d')][_0x9b3b('0x23')]||null:null,'include':_0x1d948a[_0x9b3b('0x1d')]?_0x1d948a[_0x9b3b('0x1d')][_0x9b3b('0x20')]?_['map'](_0x1d948a[_0x9b3b('0x1d')][_0x9b3b('0x20')],function(_0x35fa28){return{'model':db[_0x35fa28[_0x9b3b('0x22')]],'as':_0x35fa28['as'],'attributes':_0x35fa28[_0x9b3b('0x23')],'include':_0x35fa28[_0x9b3b('0x20')]?_[_0x9b3b('0x21')](_0x35fa28[_0x9b3b('0x20')],function(_0x11f322){return{'model':db[_0x11f322[_0x9b3b('0x22')]],'as':_0x11f322['as'],'attributes':_0x11f322[_0x9b3b('0x23')],'include':_0x11f322[_0x9b3b('0x20')]?_[_0x9b3b('0x21')](_0x11f322['include'],function(_0x20515c){return{'model':db[_0x20515c['model']],'as':_0x20515c['as'],'attributes':_0x20515c[_0x9b3b('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9b3b('0x10')](function(_0x435d62){logger['info'](_0x9b3b('0x24'),_0x1d948a);logger[_0x9b3b('0x13')](_0x9b3b('0x24'),_0x1d948a,JSON[_0x9b3b('0x15')](_0x435d62));_0x2a384c(_0x435d62);})['catch'](function(_0x5b2403){logger[_0x9b3b('0x16')](_0x9b3b('0x24'),_0x5b2403[_0x9b3b('0x18')],_0x1d948a);_0x3cdd12(_0x38d9cd[_0x9b3b('0x16')](0x1f4,_0x5b2403[_0x9b3b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 2ea9fdf..d1b4f2e 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 _0x2beb=['save','remove','update','emit','removeListener','register','whatsappQueue:','./whatsappQueue.events'];(function(_0x28685e,_0x863378){var _0x3256c9=function(_0x1632b9){while(--_0x1632b9){_0x28685e['push'](_0x28685e['shift']());}};_0x3256c9(++_0x863378);}(_0x2beb,0x97));var _0xb2be=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2beb[_0x20a584];return _0x4b41a8;};'use strict';var WhatsappQueueEvents=require(_0xb2be('0x0'));var events=[_0xb2be('0x1'),_0xb2be('0x2'),_0xb2be('0x3')];function createListener(_0x468efb,_0xb22f72){return function(_0x4535b5){_0xb22f72[_0xb2be('0x4')](_0x468efb,_0x4535b5);};}function removeListener(_0x280d54,_0xb56dec){return function(){WhatsappQueueEvents[_0xb2be('0x5')](_0x280d54,_0xb56dec);};}exports[_0xb2be('0x6')]=function(_0x861739){for(var _0x17b392=0x0,_0x5eaaa9=events['length'];_0x17b392<_0x5eaaa9;_0x17b392++){var _0x1fbdea=events[_0x17b392];var _0x2315cf=createListener(_0xb2be('0x7')+_0x1fbdea,_0x861739);WhatsappQueueEvents['on'](_0x1fbdea,_0x2315cf);}}; \ No newline at end of file +var _0x7157=['./whatsappQueue.events','remove','update','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7157,0x17c));var _0x7715=function(_0x3ad6cf,_0x3fe524){_0x3ad6cf=_0x3ad6cf-0x0;var _0x190bbb=_0x7157[_0x3ad6cf];return _0x190bbb;};'use strict';var WhatsappQueueEvents=require(_0x7715('0x0'));var events=['save',_0x7715('0x1'),_0x7715('0x2')];function createListener(_0x1a4395,_0x36a9c6){return function(_0x4a8d53){_0x36a9c6['emit'](_0x1a4395,_0x4a8d53);};}function removeListener(_0x3b1689,_0x3b8ab4){return function(){WhatsappQueueEvents[_0x7715('0x3')](_0x3b1689,_0x3b8ab4);};}exports[_0x7715('0x4')]=function(_0x280855){for(var _0x205709=0x0,_0x443186=events['length'];_0x205709<_0x443186;_0x205709++){var _0x21cb1e=events[_0x205709];var _0x4aa7cd=createListener('whatsappQueue:'+_0x21cb1e,_0x280855);WhatsappQueueEvents['on'](_0x21cb1e,_0x4aa7cd);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 818e9f3..ff787fe 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 _0x6bce=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','/:id','show','post','put','update','delete'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x6bce,0xd4));var _0xe6bc=function(_0x2375e1,_0x3d125a){_0x2375e1=_0x2375e1-0x0;var _0x2ccc7d=_0x6bce[_0x2375e1];return _0x2ccc7d;};'use strict';var multer=require(_0xe6bc('0x0'));var util=require(_0xe6bc('0x1'));var path=require(_0xe6bc('0x2'));var timeout=require(_0xe6bc('0x3'));var express=require(_0xe6bc('0x4'));var router=express[_0xe6bc('0x5')]();var fs_extra=require(_0xe6bc('0x6'));var auth=require(_0xe6bc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe6bc('0x8'));var controller=require(_0xe6bc('0x9'));router[_0xe6bc('0xa')]('/',auth[_0xe6bc('0xb')](),controller['index']);router[_0xe6bc('0xa')](_0xe6bc('0xc'),auth[_0xe6bc('0xb')](),controller['describe']);router[_0xe6bc('0xa')](_0xe6bc('0xd'),auth[_0xe6bc('0xb')](),controller[_0xe6bc('0xe')]);router[_0xe6bc('0xf')]('/',auth[_0xe6bc('0xb')](),controller['create']);router[_0xe6bc('0x10')](_0xe6bc('0xd'),auth['isAuthenticated'](),controller[_0xe6bc('0x11')]);router[_0xe6bc('0x12')](_0xe6bc('0xd'),auth[_0xe6bc('0xb')](),controller[_0xe6bc('0x13')]);module[_0xe6bc('0x14')]=router; \ No newline at end of file +var _0x475c=['util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','show','post','create','put','/:id','delete','exports','multer'];(function(_0x2096b2,_0x53c8bd){var _0x540b16=function(_0x4f7d38){while(--_0x4f7d38){_0x2096b2['push'](_0x2096b2['shift']());}};_0x540b16(++_0x53c8bd);}(_0x475c,0xb3));var _0xc475=function(_0x1655dd,_0x18c9f9){_0x1655dd=_0x1655dd-0x0;var _0x138b30=_0x475c[_0x1655dd];return _0x138b30;};'use strict';var multer=require(_0xc475('0x0'));var util=require(_0xc475('0x1'));var path=require('path');var timeout=require(_0xc475('0x2'));var express=require('express');var router=express[_0xc475('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc475('0x4'));var config=require(_0xc475('0x5'));var controller=require(_0xc475('0x6'));router[_0xc475('0x7')]('/',auth['isAuthenticated'](),controller[_0xc475('0x8')]);router[_0xc475('0x7')](_0xc475('0x9'),auth[_0xc475('0xa')](),controller['describe']);router[_0xc475('0x7')]('/:id',auth[_0xc475('0xa')](),controller[_0xc475('0xb')]);router[_0xc475('0xc')]('/',auth[_0xc475('0xa')](),controller[_0xc475('0xd')]);router[_0xc475('0xe')](_0xc475('0xf'),auth[_0xc475('0xa')](),controller['update']);router[_0xc475('0x10')](_0xc475('0xf'),auth[_0xc475('0xa')](),controller['destroy']);module[_0xc475('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 43b0f7d..0fa9ba3 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(_0x13ba0a,_0x46e0c3){var _0x22b93d=function(_0x1d8f41){while(--_0x1d8f41){_0x13ba0a['push'](_0x13ba0a['shift']());}};_0x22b93d(++_0x46e0c3);}(_0x7a54,0x106));var _0x47a5=function(_0x165e23,_0x1d8dc5){_0x165e23=_0x165e23-0x0;var _0x22ba75=_0x7a54[_0x165e23];return _0x22ba75;};'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 _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x1af7cc,_0x35fa74){var _0xb0fdb6=function(_0x21f942){while(--_0x21f942){_0x1af7cc['push'](_0x1af7cc['shift']());}};_0xb0fdb6(++_0x35fa74);}(_0x7a54,0x106));var _0x47a5=function(_0x5b8ac0,_0x7d3386){_0x5b8ac0=_0x5b8ac0-0x0;var _0x4829f4=_0x7a54[_0x5b8ac0];return _0x4829f4;};'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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 208d624..cf4e17c 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 _0x4483=['reject','update','destroy','then','stack','name','send','index','WhatsappQueueReport','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','findAll','catch','show','params','filters','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply'];(function(_0x2bbd1c,_0x3fa41f){var _0x163252=function(_0x151b96){while(--_0x151b96){_0x2bbd1c['push'](_0x2bbd1c['shift']());}};_0x163252(++_0x3fa41f);}(_0x4483,0x1a3));var _0x3448=function(_0xd15cac,_0x18338c){_0xd15cac=_0xd15cac-0x0;var _0x193670=_0x4483[_0xd15cac];return _0x193670;};'use strict';var emlformat=require(_0x3448('0x0'));var rimraf=require(_0x3448('0x1'));var zipdir=require(_0x3448('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3448('0x3'));var moment=require(_0x3448('0x4'));var BPromise=require(_0x3448('0x5'));var Mustache=require(_0x3448('0x6'));var util=require(_0x3448('0x7'));var path=require('path');var sox=require(_0x3448('0x8'));var csv=require(_0x3448('0x9'));var ejs=require(_0x3448('0xa'));var fs=require('fs');var fs_extra=require(_0x3448('0xb'));var _=require(_0x3448('0xc'));var squel=require(_0x3448('0xd'));var crypto=require(_0x3448('0xe'));var jsforce=require(_0x3448('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3448('0x10'));var Papa=require(_0x3448('0x11'));var Redis=require(_0x3448('0x12'));var authService=require(_0x3448('0x13'));var qs=require(_0x3448('0x14'));var as=require(_0x3448('0x15'));var hardwareService=require(_0x3448('0x16'));var logger=require(_0x3448('0x17'))(_0x3448('0x18'));var utils=require(_0x3448('0x19'));var config=require(_0x3448('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x298ae6,_0x38fbb1){_0x38fbb1=_0x38fbb1||0xcc;return function(_0x5f52bd){if(_0x5f52bd){return _0x298ae6[_0x3448('0x1b')](_0x38fbb1);}return _0x298ae6[_0x3448('0x1c')](_0x38fbb1)[_0x3448('0x1d')]();};}function respondWithResult(_0x549306,_0x14104c){_0x14104c=_0x14104c||0xc8;return function(_0x2952a6){if(_0x2952a6){return _0x549306['status'](_0x14104c)[_0x3448('0x1e')](_0x2952a6);}};}function respondWithFilteredResult(_0x2c2da6,_0x46784f){return function(_0x4fc70f){if(_0x4fc70f){var _0x472518=typeof _0x46784f[_0x3448('0x1f')]===_0x3448('0x20')&&typeof _0x46784f[_0x3448('0x21')]===_0x3448('0x20');var _0x1b2081=_0x4fc70f[_0x3448('0x22')];var _0x425514=_0x472518?0x0:_0x46784f['offset'];var _0x1658cd=_0x472518?_0x4fc70f['count']:_0x46784f['offset']+_0x46784f['limit'];var _0x1e9774;if(_0x1658cd>=_0x1b2081){_0x1658cd=_0x1b2081;_0x1e9774=0xc8;}else{_0x1e9774=0xce;}_0x2c2da6[_0x3448('0x1c')](_0x1e9774);return _0x2c2da6[_0x3448('0x23')]('Content-Range',_0x425514+'-'+_0x1658cd+'/'+_0x1b2081)[_0x3448('0x1e')](_0x4fc70f);}return null;};}function patchUpdates(_0x392c8d){return function(_0x317de6){try{jsonpatch[_0x3448('0x24')](_0x317de6,_0x392c8d,!![]);}catch(_0x29a15a){return BPromise[_0x3448('0x25')](_0x29a15a);}return _0x317de6['save']();};}function saveUpdates(_0x54c7ee,_0x4e6716){return function(_0x1b3d5a){if(_0x1b3d5a){return _0x1b3d5a[_0x3448('0x26')](_0x54c7ee)['then'](function(_0x5b1f7c){return _0x5b1f7c;});}return null;};}function removeEntity(_0x2dcd40,_0x4371d6){return function(_0x22ad5c){if(_0x22ad5c){return _0x22ad5c[_0x3448('0x27')]()[_0x3448('0x28')](function(){_0x2dcd40['status'](0xcc)[_0x3448('0x1d')]();});}};}function handleEntityNotFound(_0x1b5c49,_0x114244){return function(_0x2088de){if(!_0x2088de){_0x1b5c49[_0x3448('0x1b')](0x194);}return _0x2088de;};}function handleError(_0x56b3ff,_0x329947){_0x329947=_0x329947||0x1f4;return function(_0x393081){logger['error'](_0x393081[_0x3448('0x29')]);if(_0x393081[_0x3448('0x2a')]){delete _0x393081[_0x3448('0x2a')];}_0x56b3ff[_0x3448('0x1c')](_0x329947)[_0x3448('0x2b')](_0x393081);};}exports[_0x3448('0x2c')]=function(_0x31be64,_0x95714e){var _0x5911b8={},_0x3307dc={},_0x450704={'count':0x0,'rows':[]};var _0xcfdc5=_['map'](db[_0x3448('0x2d')]['rawAttributes'],function(_0x486f2c){return{'name':_0x486f2c['fieldName'],'type':_0x486f2c[_0x3448('0x2e')][_0x3448('0x2f')]};});_0x3307dc['model']=_['map'](_0xcfdc5,_0x3448('0x2a'));_0x3307dc[_0x3448('0x30')]=_[_0x3448('0x31')](_0x31be64[_0x3448('0x30')]);_0x3307dc['filters']=_[_0x3448('0x32')](_0x3307dc[_0x3448('0x33')],_0x3307dc[_0x3448('0x30')]);_0x5911b8['attributes']=_[_0x3448('0x32')](_0x3307dc[_0x3448('0x33')],qs['fields'](_0x31be64['query'][_0x3448('0x34')]));_0x5911b8[_0x3448('0x35')]=_0x5911b8[_0x3448('0x35')][_0x3448('0x36')]?_0x5911b8['attributes']:_0x3307dc[_0x3448('0x33')];if(!_0x31be64[_0x3448('0x30')][_0x3448('0x37')](_0x3448('0x38'))){_0x5911b8['limit']=qs[_0x3448('0x21')](_0x31be64[_0x3448('0x30')]['limit']);_0x5911b8[_0x3448('0x1f')]=qs[_0x3448('0x1f')](_0x31be64[_0x3448('0x30')][_0x3448('0x1f')]);}_0x5911b8[_0x3448('0x39')]=qs[_0x3448('0x3a')](_0x31be64[_0x3448('0x30')][_0x3448('0x3a')]);_0x5911b8[_0x3448('0x3b')]=qs['filters'](_['pick'](_0x31be64[_0x3448('0x30')],_0x3307dc['filters']),_0xcfdc5);if(_0x31be64[_0x3448('0x30')][_0x3448('0x3c')]){_0x5911b8[_0x3448('0x3b')]=_[_0x3448('0x3d')](_0x5911b8['where'],{'$or':_[_0x3448('0x3e')](_0xcfdc5,function(_0x18fc16){if(_0x18fc16[_0x3448('0x2e')]!==_0x3448('0x3f')){var _0x2e83c6={};_0x2e83c6[_0x18fc16[_0x3448('0x2a')]]={'$like':'%'+_0x31be64[_0x3448('0x30')][_0x3448('0x3c')]+'%'};return _0x2e83c6;}})});}_0x5911b8=_[_0x3448('0x3d')]({},_0x5911b8,_0x31be64['options']);var _0x39b22e={'where':_0x5911b8[_0x3448('0x3b')]};return db[_0x3448('0x2d')][_0x3448('0x22')](_0x39b22e)[_0x3448('0x28')](function(_0x58963d){_0x450704[_0x3448('0x22')]=_0x58963d;if(_0x31be64[_0x3448('0x30')][_0x3448('0x40')]){_0x5911b8[_0x3448('0x41')]=[{'all':!![]}];}return db[_0x3448('0x2d')][_0x3448('0x42')](_0x5911b8);})[_0x3448('0x28')](function(_0x3db5f1){_0x450704['rows']=_0x3db5f1;return _0x450704;})[_0x3448('0x28')](respondWithFilteredResult(_0x95714e,_0x5911b8))[_0x3448('0x43')](handleError(_0x95714e,null));};exports[_0x3448('0x44')]=function(_0x4a04d0,_0x2465ff){var _0x1d2a7c={'raw':!![],'where':{'id':_0x4a04d0[_0x3448('0x45')]['id']}},_0x21f989={};_0x21f989[_0x3448('0x33')]=_[_0x3448('0x31')](db[_0x3448('0x2d')]['rawAttributes']);_0x21f989[_0x3448('0x30')]=_[_0x3448('0x31')](_0x4a04d0[_0x3448('0x30')]);_0x21f989[_0x3448('0x46')]=_[_0x3448('0x32')](_0x21f989[_0x3448('0x33')],_0x21f989['query']);_0x1d2a7c[_0x3448('0x35')]=_['intersection'](_0x21f989['model'],qs[_0x3448('0x34')](_0x4a04d0[_0x3448('0x30')]['fields']));_0x1d2a7c[_0x3448('0x35')]=_0x1d2a7c[_0x3448('0x35')]['length']?_0x1d2a7c[_0x3448('0x35')]:_0x21f989[_0x3448('0x33')];if(_0x4a04d0['query'][_0x3448('0x40')]){_0x1d2a7c[_0x3448('0x41')]=[{'all':!![]}];}_0x1d2a7c=_[_0x3448('0x3d')]({},_0x1d2a7c,_0x4a04d0[_0x3448('0x47')]);return db[_0x3448('0x2d')][_0x3448('0x48')](_0x1d2a7c)[_0x3448('0x28')](handleEntityNotFound(_0x2465ff,null))['then'](respondWithResult(_0x2465ff,null))['catch'](handleError(_0x2465ff,null));};exports[_0x3448('0x49')]=function(_0x3c9b82,_0x1b82e7){return db[_0x3448('0x2d')]['create'](_0x3c9b82[_0x3448('0x4a')],{})[_0x3448('0x28')](respondWithResult(_0x1b82e7,0xc9))[_0x3448('0x43')](handleError(_0x1b82e7,null));};exports[_0x3448('0x26')]=function(_0x363374,_0x5d942b){if(_0x363374[_0x3448('0x4a')]['id']){delete _0x363374['body']['id'];}return db[_0x3448('0x2d')][_0x3448('0x48')]({'where':{'id':_0x363374['params']['id']}})[_0x3448('0x28')](handleEntityNotFound(_0x5d942b,null))[_0x3448('0x28')](saveUpdates(_0x363374[_0x3448('0x4a')],null))[_0x3448('0x28')](respondWithResult(_0x5d942b,null))[_0x3448('0x43')](handleError(_0x5d942b,null));};exports[_0x3448('0x27')]=function(_0xc769e1,_0x53236c){return db[_0x3448('0x2d')][_0x3448('0x48')]({'where':{'id':_0xc769e1['params']['id']}})['then'](handleEntityNotFound(_0x53236c,null))[_0x3448('0x28')](removeEntity(_0x53236c,null))[_0x3448('0x43')](handleError(_0x53236c,null));};exports['describe']=function(_0x4db823,_0x371e8a){return db[_0x3448('0x2d')][_0x3448('0x4b')]()[_0x3448('0x28')](respondWithResult(_0x371e8a,null))[_0x3448('0x43')](handleError(_0x371e8a,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','WhatsappQueueReport','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(_0x5663ea,_0x4e4468){var _0x32cbc4=function(_0x26758d){while(--_0x26758d){_0x5663ea['push'](_0x5663ea['shift']());}};_0x32cbc4(++_0x4e4468);}(_0xf45e,0x115));var _0xef45=function(_0x48ada8,_0x578d35){_0x48ada8=_0x48ada8-0x0;var _0x178ad1=_0xf45e[_0x48ada8];return _0x178ad1;};'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['WhatsappQueueReport'][_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['WhatsappQueueReport'][_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));};exports['describe']=function(_0x22b75e,_0x24aceb){return db[_0xef45('0x3f')]['describe']()[_0xef45('0x29')](respondWithResult(_0x24aceb,null))[_0xef45('0x4d')](handleError(_0x24aceb,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 661630f..7d39cac 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 _0xcac4=['report_whatsapp_queue','uniqueid','moment','request-promise','path','../../config/environment','define','WhatsappQueueReport'];(function(_0x24028c,_0x5ea5de){var _0x14569c=function(_0xfaf931){while(--_0xfaf931){_0x24028c['push'](_0x24028c['shift']());}};_0x14569c(++_0x5ea5de);}(_0xcac4,0x1aa));var _0x4cac=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0xcac4[_0x5d8018];return _0x151ac4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4cac('0x0'));var BPromise=require('bluebird');var rp=require(_0x4cac('0x1'));var fs=require('fs');var path=require(_0x4cac('0x2'));var rimraf=require('rimraf');var config=require(_0x4cac('0x3'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x4f233a,_0x573908){return _0x4f233a[_0x4cac('0x4')](_0x4cac('0x5'),attributes,{'tableName':_0x4cac('0x6'),'paranoid':![],'indexes':[{'name':_0x4cac('0x7'),'fields':[_0x4cac('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x48d4=['path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x48d4,0xd7));var _0x448d=function(_0x2421e1,_0x46b342){_0x2421e1=_0x2421e1-0x0;var _0x240a0b=_0x48d4[_0x2421e1];return _0x240a0b;};'use strict';var _=require(_0x448d('0x0'));var util=require(_0x448d('0x1'));var logger=require('../../config/logger')(_0x448d('0x2'));var moment=require(_0x448d('0x3'));var BPromise=require(_0x448d('0x4'));var rp=require(_0x448d('0x5'));var fs=require('fs');var path=require(_0x448d('0x6'));var rimraf=require('rimraf');var config=require(_0x448d('0x7'));var attributes=require(_0x448d('0x8'));module[_0x448d('0x9')]=function(_0x2e8f88,_0x490090){return _0x2e8f88[_0x448d('0xa')](_0x448d('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x448d('0xc'),'fields':[_0x448d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 9c2ad00..c5826d2 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 _0xebd3=['rpc','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','update','where','limit','UpdateWhatsappQueueReport','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5c5904,_0xa16eeb){var _0x1eb4b8=function(_0x103d25){while(--_0x103d25){_0x5c5904['push'](_0x5c5904['shift']());}};_0x1eb4b8(++_0xa16eeb);}(_0xebd3,0x19f));var _0x3ebd=function(_0x25cd2c,_0x57498e){_0x25cd2c=_0x25cd2c-0x0;var _0x1e364c=_0xebd3[_0x25cd2c];return _0x1e364c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ebd('0x0'));var BPromise=require(_0x3ebd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ebd('0x2'))['db'];var utils=require(_0x3ebd('0x3'));var logger=require(_0x3ebd('0x4'))(_0x3ebd('0x5'));var config=require('../../config/environment');var jayson=require(_0x3ebd('0x6'));var client=jayson['client'][_0x3ebd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x348667,_0x438a98,_0x248abb){return new BPromise(function(_0x20e05b,_0x58623d){return client[_0x3ebd('0x8')](_0x348667,_0x248abb)[_0x3ebd('0x9')](function(_0x3f6dee){logger[_0x3ebd('0xa')](_0x3ebd('0xb'),_0x438a98,_0x3ebd('0xc'));logger[_0x3ebd('0xd')](_0x3ebd('0xe'),_0x438a98,_0x3ebd('0xc'),JSON['stringify'](_0x3f6dee));if(_0x3f6dee[_0x3ebd('0xf')]){if(_0x3f6dee[_0x3ebd('0xf')][_0x3ebd('0x10')]===0x1f4){logger[_0x3ebd('0xf')](_0x3ebd('0xb'),_0x438a98,_0x3f6dee[_0x3ebd('0xf')]['message']);return _0x58623d(_0x3f6dee[_0x3ebd('0xf')][_0x3ebd('0x11')]);}logger[_0x3ebd('0xf')](_0x3ebd('0xb'),_0x438a98,_0x3f6dee[_0x3ebd('0xf')][_0x3ebd('0x11')]);return _0x20e05b(_0x3f6dee['error'][_0x3ebd('0x11')]);}else{logger[_0x3ebd('0xa')](_0x3ebd('0xb'),_0x438a98,_0x3ebd('0xc'));_0x20e05b(_0x3f6dee[_0x3ebd('0x12')]['message']);}})['catch'](function(_0x46ee5b){logger[_0x3ebd('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x438a98,_0x46ee5b);_0x58623d(_0x46ee5b);});});}exports['CreateWhatsappQueueReport']=function(_0x529da8){var _0x1d51b8=this;return new Promise(function(_0x167256,_0x4c680c){return db[_0x3ebd('0x13')][_0x3ebd('0x14')](_0x529da8[_0x3ebd('0x15')],{'raw':_0x529da8['options']?_0x529da8[_0x3ebd('0x16')][_0x3ebd('0x17')]===undefined?!![]:![]:!![]})[_0x3ebd('0x9')](function(_0x24ffb2){logger[_0x3ebd('0xa')](_0x3ebd('0x18'),_0x529da8);logger['debug'](_0x3ebd('0x18'),_0x529da8,JSON['stringify'](_0x24ffb2));_0x167256(_0x24ffb2);})['catch'](function(_0x14c210){logger['error'](_0x3ebd('0x18'),_0x14c210[_0x3ebd('0x11')],_0x529da8);_0x4c680c(_0x1d51b8[_0x3ebd('0xf')](0x1f4,_0x14c210[_0x3ebd('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x8d4a9c){var _0x4c810a=this;return new Promise(function(_0x2568c5,_0x4ea64d){return db[_0x3ebd('0x13')][_0x3ebd('0x19')](_0x8d4a9c[_0x3ebd('0x15')],{'raw':_0x8d4a9c[_0x3ebd('0x16')]?_0x8d4a9c[_0x3ebd('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8d4a9c['options']?_0x8d4a9c[_0x3ebd('0x16')][_0x3ebd('0x1a')]||null:null,'attributes':_0x8d4a9c[_0x3ebd('0x16')]?_0x8d4a9c['options']['attributes']||null:null,'limit':_0x8d4a9c['options']?_0x8d4a9c[_0x3ebd('0x16')][_0x3ebd('0x1b')]||null:null})[_0x3ebd('0x9')](function(_0x17551a){logger[_0x3ebd('0xa')]('UpdateWhatsappQueueReport',_0x8d4a9c);logger[_0x3ebd('0xd')](_0x3ebd('0x1c'),_0x8d4a9c,JSON['stringify'](_0x17551a));_0x2568c5(_0x17551a);})[_0x3ebd('0x1d')](function(_0x2d2027){logger['error'](_0x3ebd('0x1c'),_0x2d2027[_0x3ebd('0x11')],_0x8d4a9c);_0x4ea64d(_0x4c810a[_0x3ebd('0xf')](0x1f4,_0x2d2027[_0x3ebd('0x11')]));});});}; \ No newline at end of file +var _0x701b=['attributes','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappQueueReport','create','body','options','info','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','raw','where'];(function(_0x2fc4e2,_0x3c51eb){var _0x532a40=function(_0xbd02a2){while(--_0xbd02a2){_0x2fc4e2['push'](_0x2fc4e2['shift']());}};_0x532a40(++_0x3c51eb);}(_0x701b,0x122));var _0xb701=function(_0x25135e,_0x533704){_0x25135e=_0x25135e-0x0;var _0x455646=_0x701b[_0x25135e];return _0x455646;};'use strict';var _=require(_0xb701('0x0'));var util=require(_0xb701('0x1'));var moment=require('moment');var BPromise=require(_0xb701('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb701('0x3'));var db=require(_0xb701('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb701('0x5'))(_0xb701('0x6'));var config=require(_0xb701('0x7'));var jayson=require(_0xb701('0x8'));var client=jayson['client'][_0xb701('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ee22f,_0x3039dc,_0x47b14c){return new BPromise(function(_0x2735ee,_0x205bc7){return client[_0xb701('0xa')](_0x1ee22f,_0x47b14c)[_0xb701('0xb')](function(_0x57a9cf){logger['info'](_0xb701('0xc'),_0x3039dc,_0xb701('0xd'));logger[_0xb701('0xe')](_0xb701('0xf'),_0x3039dc,'request\x20sent',JSON['stringify'](_0x57a9cf));if(_0x57a9cf[_0xb701('0x10')]){if(_0x57a9cf['error'][_0xb701('0x11')]===0x1f4){logger[_0xb701('0x10')](_0xb701('0xc'),_0x3039dc,_0x57a9cf[_0xb701('0x10')]['message']);return _0x205bc7(_0x57a9cf['error'][_0xb701('0x12')]);}logger[_0xb701('0x10')](_0xb701('0xc'),_0x3039dc,_0x57a9cf[_0xb701('0x10')][_0xb701('0x12')]);return _0x2735ee(_0x57a9cf[_0xb701('0x10')]['message']);}else{logger['info'](_0xb701('0xc'),_0x3039dc,_0xb701('0xd'));_0x2735ee(_0x57a9cf[_0xb701('0x13')][_0xb701('0x12')]);}})[_0xb701('0x14')](function(_0x417996){logger[_0xb701('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3039dc,_0x417996);_0x205bc7(_0x417996);});});}exports['CreateWhatsappQueueReport']=function(_0x556aaa){var _0x55e83c=this;return new Promise(function(_0x279099,_0x5041e6){return db[_0xb701('0x15')][_0xb701('0x16')](_0x556aaa[_0xb701('0x17')],{'raw':_0x556aaa[_0xb701('0x18')]?_0x556aaa['options']['raw']===undefined?!![]:![]:!![]})[_0xb701('0xb')](function(_0x5df020){logger[_0xb701('0x19')]('CreateWhatsappQueueReport',_0x556aaa);logger[_0xb701('0xe')](_0xb701('0x1a'),_0x556aaa,JSON['stringify'](_0x5df020));_0x279099(_0x5df020);})['catch'](function(_0x17c765){logger['error'](_0xb701('0x1a'),_0x17c765[_0xb701('0x12')],_0x556aaa);_0x5041e6(_0x55e83c['error'](0x1f4,_0x17c765[_0xb701('0x12')]));});});};exports[_0xb701('0x1b')]=function(_0x376a52){var _0x1a9477=this;return new Promise(function(_0x25db4d,_0x5d93f3){return db['WhatsappQueueReport']['update'](_0x376a52[_0xb701('0x17')],{'raw':_0x376a52[_0xb701('0x18')]?_0x376a52[_0xb701('0x18')][_0xb701('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x376a52[_0xb701('0x18')]?_0x376a52['options'][_0xb701('0x1d')]||null:null,'attributes':_0x376a52[_0xb701('0x18')]?_0x376a52[_0xb701('0x18')][_0xb701('0x1e')]||null:null,'limit':_0x376a52['options']?_0x376a52[_0xb701('0x18')]['limit']||null:null})[_0xb701('0xb')](function(_0x3335df){logger[_0xb701('0x19')](_0xb701('0x1b'),_0x376a52);logger[_0xb701('0xe')](_0xb701('0x1b'),_0x376a52,JSON[_0xb701('0x1f')](_0x3335df));_0x25db4d(_0x3335df);})['catch'](function(_0x264611){logger[_0xb701('0x10')](_0xb701('0x1b'),_0x264611[_0xb701('0x12')],_0x376a52);_0x5d93f3(_0x1a9477[_0xb701('0x10')](0x1f4,_0x264611[_0xb701('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 5d3f173..12875b8 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 _0x287e=['exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','describe','/:id','show','put','update','delete','destroy'];(function(_0x30bc95,_0x25a1fe){var _0x4166a8=function(_0x415e3d){while(--_0x415e3d){_0x30bc95['push'](_0x30bc95['shift']());}};_0x4166a8(++_0x25a1fe);}(_0x287e,0x89));var _0xe287=function(_0x31f8e4,_0x1d6f5b){_0x31f8e4=_0x31f8e4-0x0;var _0xdff639=_0x287e[_0x31f8e4];return _0xdff639;};'use strict';var multer=require(_0xe287('0x0'));var util=require('util');var path=require(_0xe287('0x1'));var timeout=require(_0xe287('0x2'));var express=require('express');var router=express[_0xe287('0x3')]();var fs_extra=require(_0xe287('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe287('0x5'));var controller=require(_0xe287('0x6'));router[_0xe287('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe287('0x7')]('/describe',auth[_0xe287('0x8')](),controller[_0xe287('0x9')]);router[_0xe287('0x7')](_0xe287('0xa'),auth[_0xe287('0x8')](),controller[_0xe287('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe287('0xc')](_0xe287('0xa'),auth['isAuthenticated'](),controller[_0xe287('0xd')]);router[_0xe287('0xe')]('/:id',auth[_0xe287('0x8')](),controller[_0xe287('0xf')]);module[_0xe287('0x10')]=router; \ No newline at end of file +var _0x8b1d=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','describe','/:id','post','create'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x8b1d,0xa3));var _0xd8b1=function(_0x36d114,_0x2e05b3){_0x36d114=_0x36d114-0x0;var _0x3d767b=_0x8b1d[_0x36d114];return _0x3d767b;};'use strict';var multer=require('multer');var util=require(_0xd8b1('0x0'));var path=require(_0xd8b1('0x1'));var timeout=require(_0xd8b1('0x2'));var express=require(_0xd8b1('0x3'));var router=express[_0xd8b1('0x4')]();var fs_extra=require(_0xd8b1('0x5'));var auth=require(_0xd8b1('0x6'));var interaction=require(_0xd8b1('0x7'));var config=require(_0xd8b1('0x8'));var controller=require(_0xd8b1('0x9'));router['get']('/',auth[_0xd8b1('0xa')](),controller[_0xd8b1('0xb')]);router[_0xd8b1('0xc')]('/describe',auth[_0xd8b1('0xa')](),controller[_0xd8b1('0xd')]);router['get'](_0xd8b1('0xe'),auth[_0xd8b1('0xa')](),controller['show']);router[_0xd8b1('0xf')]('/',auth[_0xd8b1('0xa')](),controller[_0xd8b1('0x10')]);router['put'](_0xd8b1('0xe'),auth[_0xd8b1('0xa')](),controller['update']);router[_0xd8b1('0x11')](_0xd8b1('0xe'),auth[_0xd8b1('0xa')](),controller[_0xd8b1('0x12')]);module[_0xd8b1('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 1e5b8f7..c5abe44 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 _0xdca3=['queue','DATE','sequelize','STRING','ENUM','account','agent'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xdca3,0x64));var _0x3dca=function(_0x4e14bd,_0x1ac1d7){_0x4e14bd=_0x4e14bd-0x0;var _0x11d943=_0xdca3[_0x4e14bd];return _0x11d943;};'use strict';var Sequelize=require(_0x3dca('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x3dca('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3dca('0x2')](_0x3dca('0x3'),_0x3dca('0x4'),_0x3dca('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x3dca('0x6')]}}; \ No newline at end of file +var _0x7497=['STRING','queue','DATE','sequelize','exports'];(function(_0x510ee9,_0x10f7c8){var _0x462806=function(_0x17ca3c){while(--_0x17ca3c){_0x510ee9['push'](_0x510ee9['shift']());}};_0x462806(++_0x10f7c8);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7749('0x0'));module[_0x7749('0x1')]={'uniqueid':{'type':Sequelize[_0x7749('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0x7749('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7749('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 1a316da..0e4d1ec 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 _0x5942=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','destroy','then','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x1b7a42,_0x3a91ae){var _0x13ad96=function(_0x1b9e39){while(--_0x1b9e39){_0x1b7a42['push'](_0x1b7a42['shift']());}};_0x13ad96(++_0x3a91ae);}(_0x5942,0x16a));var _0x2594=function(_0x31c9dc,_0x24c945){_0x31c9dc=_0x31c9dc-0x0;var _0x326c0f=_0x5942[_0x31c9dc];return _0x326c0f;};'use strict';var emlformat=require(_0x2594('0x0'));var rimraf=require(_0x2594('0x1'));var zipdir=require(_0x2594('0x2'));var jsonpatch=require(_0x2594('0x3'));var rp=require(_0x2594('0x4'));var moment=require(_0x2594('0x5'));var BPromise=require(_0x2594('0x6'));var Mustache=require(_0x2594('0x7'));var util=require(_0x2594('0x8'));var path=require(_0x2594('0x9'));var sox=require(_0x2594('0xa'));var csv=require(_0x2594('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2594('0xc'));var squel=require(_0x2594('0xd'));var crypto=require(_0x2594('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2594('0xf'));var toCsv=require(_0x2594('0xb'));var querystring=require('querystring');var Papa=require(_0x2594('0x10'));var Redis=require('ioredis');var authService=require(_0x2594('0x11'));var qs=require(_0x2594('0x12'));var as=require(_0x2594('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2594('0x14'))(_0x2594('0x15'));var utils=require(_0x2594('0x16'));var config=require(_0x2594('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2594('0x18'))['db'];function respondWithStatusCode(_0x1ba533,_0x371ff3){_0x371ff3=_0x371ff3||0xcc;return function(_0x3aa70e){if(_0x3aa70e){return _0x1ba533[_0x2594('0x19')](_0x371ff3);}return _0x1ba533[_0x2594('0x1a')](_0x371ff3)[_0x2594('0x1b')]();};}function respondWithResult(_0xa26e3a,_0x271894){_0x271894=_0x271894||0xc8;return function(_0x5da604){if(_0x5da604){return _0xa26e3a[_0x2594('0x1a')](_0x271894)[_0x2594('0x1c')](_0x5da604);}};}function respondWithFilteredResult(_0x587bad,_0x1cbb20){return function(_0x4cc124){if(_0x4cc124){var _0x192f3d=typeof _0x1cbb20[_0x2594('0x1d')]===_0x2594('0x1e')&&typeof _0x1cbb20[_0x2594('0x1f')]===_0x2594('0x1e');var _0x59a199=_0x4cc124[_0x2594('0x20')];var _0x457beb=_0x192f3d?0x0:_0x1cbb20[_0x2594('0x1d')];var _0x31f24a=_0x192f3d?_0x4cc124[_0x2594('0x20')]:_0x1cbb20[_0x2594('0x1d')]+_0x1cbb20[_0x2594('0x1f')];var _0x3f022d;if(_0x31f24a>=_0x59a199){_0x31f24a=_0x59a199;_0x3f022d=0xc8;}else{_0x3f022d=0xce;}_0x587bad[_0x2594('0x1a')](_0x3f022d);return _0x587bad['set']('Content-Range',_0x457beb+'-'+_0x31f24a+'/'+_0x59a199)[_0x2594('0x1c')](_0x4cc124);}return null;};}function patchUpdates(_0x40a1f2){return function(_0x266cb9){try{jsonpatch[_0x2594('0x21')](_0x266cb9,_0x40a1f2,!![]);}catch(_0x3b68eb){return BPromise[_0x2594('0x22')](_0x3b68eb);}return _0x266cb9['save']();};}function saveUpdates(_0x44766c,_0x3bbebd){return function(_0x121a8e){if(_0x121a8e){return _0x121a8e[_0x2594('0x23')](_0x44766c)['then'](function(_0x39fb25){return _0x39fb25;});}return null;};}function removeEntity(_0x5685fd,_0x281987){return function(_0x5eed6f){if(_0x5eed6f){return _0x5eed6f[_0x2594('0x24')]()[_0x2594('0x25')](function(){_0x5685fd['status'](0xcc)[_0x2594('0x1b')]();});}};}function handleEntityNotFound(_0x48a306,_0x2a01a9){return function(_0x12258e){if(!_0x12258e){_0x48a306[_0x2594('0x19')](0x194);}return _0x12258e;};}function handleError(_0x38feeb,_0x1b2820){_0x1b2820=_0x1b2820||0x1f4;return function(_0xf60655){logger[_0x2594('0x26')](_0xf60655[_0x2594('0x27')]);if(_0xf60655['name']){delete _0xf60655[_0x2594('0x28')];}_0x38feeb['status'](_0x1b2820)['send'](_0xf60655);};}exports[_0x2594('0x29')]=function(_0x21339d,_0x4dc1a5){var _0x36fdf4={},_0xa8ee54={},_0x590123={'count':0x0,'rows':[]};var _0x273e04=_[_0x2594('0x2a')](db[_0x2594('0x2b')][_0x2594('0x2c')],function(_0x587af2){return{'name':_0x587af2[_0x2594('0x2d')],'type':_0x587af2[_0x2594('0x2e')][_0x2594('0x2f')]};});_0xa8ee54[_0x2594('0x30')]=_[_0x2594('0x2a')](_0x273e04,'name');_0xa8ee54[_0x2594('0x31')]=_[_0x2594('0x32')](_0x21339d['query']);_0xa8ee54['filters']=_[_0x2594('0x33')](_0xa8ee54[_0x2594('0x30')],_0xa8ee54[_0x2594('0x31')]);_0x36fdf4[_0x2594('0x34')]=_['intersection'](_0xa8ee54[_0x2594('0x30')],qs[_0x2594('0x35')](_0x21339d['query']['fields']));_0x36fdf4['attributes']=_0x36fdf4['attributes']['length']?_0x36fdf4[_0x2594('0x34')]:_0xa8ee54[_0x2594('0x30')];if(!_0x21339d[_0x2594('0x31')][_0x2594('0x36')](_0x2594('0x37'))){_0x36fdf4[_0x2594('0x1f')]=qs[_0x2594('0x1f')](_0x21339d[_0x2594('0x31')][_0x2594('0x1f')]);_0x36fdf4[_0x2594('0x1d')]=qs[_0x2594('0x1d')](_0x21339d[_0x2594('0x31')][_0x2594('0x1d')]);}_0x36fdf4[_0x2594('0x38')]=qs[_0x2594('0x39')](_0x21339d['query']['sort']);_0x36fdf4[_0x2594('0x3a')]=qs[_0x2594('0x3b')](_[_0x2594('0x3c')](_0x21339d[_0x2594('0x31')],_0xa8ee54[_0x2594('0x3b')]),_0x273e04);if(_0x21339d[_0x2594('0x31')][_0x2594('0x3d')]){_0x36fdf4[_0x2594('0x3a')]=_[_0x2594('0x3e')](_0x36fdf4['where'],{'$or':_['map'](_0x273e04,function(_0x1754f5){if(_0x1754f5['type']!==_0x2594('0x3f')){var _0x2b3887={};_0x2b3887[_0x1754f5[_0x2594('0x28')]]={'$like':'%'+_0x21339d[_0x2594('0x31')]['filter']+'%'};return _0x2b3887;}})});}_0x36fdf4=_['merge']({},_0x36fdf4,_0x21339d['options']);var _0x6df7f1={'where':_0x36fdf4[_0x2594('0x3a')]};return db[_0x2594('0x2b')][_0x2594('0x20')](_0x6df7f1)[_0x2594('0x25')](function(_0xc866c2){_0x590123['count']=_0xc866c2;if(_0x21339d[_0x2594('0x31')][_0x2594('0x40')]){_0x36fdf4[_0x2594('0x41')]=[{'all':!![]}];}return db[_0x2594('0x2b')][_0x2594('0x42')](_0x36fdf4);})['then'](function(_0x5d9268){_0x590123[_0x2594('0x43')]=_0x5d9268;return _0x590123;})[_0x2594('0x25')](respondWithFilteredResult(_0x4dc1a5,_0x36fdf4))[_0x2594('0x44')](handleError(_0x4dc1a5,null));};exports[_0x2594('0x45')]=function(_0x5e6bad,_0x582e5f){var _0x5b2aa9={'raw':!![],'where':{'id':_0x5e6bad[_0x2594('0x46')]['id']}},_0x4906f8={};_0x4906f8[_0x2594('0x30')]=_['keys'](db[_0x2594('0x2b')][_0x2594('0x2c')]);_0x4906f8['query']=_[_0x2594('0x32')](_0x5e6bad['query']);_0x4906f8[_0x2594('0x3b')]=_[_0x2594('0x33')](_0x4906f8[_0x2594('0x30')],_0x4906f8[_0x2594('0x31')]);_0x5b2aa9[_0x2594('0x34')]=_[_0x2594('0x33')](_0x4906f8['model'],qs[_0x2594('0x35')](_0x5e6bad['query']['fields']));_0x5b2aa9[_0x2594('0x34')]=_0x5b2aa9['attributes'][_0x2594('0x47')]?_0x5b2aa9[_0x2594('0x34')]:_0x4906f8[_0x2594('0x30')];if(_0x5e6bad[_0x2594('0x31')][_0x2594('0x40')]){_0x5b2aa9[_0x2594('0x41')]=[{'all':!![]}];}_0x5b2aa9=_[_0x2594('0x3e')]({},_0x5b2aa9,_0x5e6bad[_0x2594('0x48')]);return db[_0x2594('0x2b')][_0x2594('0x49')](_0x5b2aa9)[_0x2594('0x25')](handleEntityNotFound(_0x582e5f,null))[_0x2594('0x25')](respondWithResult(_0x582e5f,null))['catch'](handleError(_0x582e5f,null));};exports[_0x2594('0x4a')]=function(_0x4b0ce5,_0x1a49b7){return db[_0x2594('0x2b')][_0x2594('0x4a')](_0x4b0ce5[_0x2594('0x4b')],{})['then'](respondWithResult(_0x1a49b7,0xc9))[_0x2594('0x44')](handleError(_0x1a49b7,null));};exports[_0x2594('0x23')]=function(_0x2de34e,_0x5dcbe1){if(_0x2de34e[_0x2594('0x4b')]['id']){delete _0x2de34e[_0x2594('0x4b')]['id'];}return db[_0x2594('0x2b')][_0x2594('0x49')]({'where':{'id':_0x2de34e[_0x2594('0x46')]['id']}})[_0x2594('0x25')](handleEntityNotFound(_0x5dcbe1,null))[_0x2594('0x25')](saveUpdates(_0x2de34e[_0x2594('0x4b')],null))['then'](respondWithResult(_0x5dcbe1,null))[_0x2594('0x44')](handleError(_0x5dcbe1,null));};exports[_0x2594('0x24')]=function(_0x45e1eb,_0x8719e0){return db[_0x2594('0x2b')]['find']({'where':{'id':_0x45e1eb[_0x2594('0x46')]['id']}})[_0x2594('0x25')](handleEntityNotFound(_0x8719e0,null))['then'](removeEntity(_0x8719e0,null))['catch'](handleError(_0x8719e0,null));};exports[_0x2594('0x4c')]=function(_0xb3d959,_0xa83fac){return db[_0x2594('0x2b')][_0x2594('0x4c')]()[_0x2594('0x25')](respondWithResult(_0xa83fac,null))[_0x2594('0x44')](handleError(_0xa83fac,null));}; \ No newline at end of file +var _0x36ca=['map','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','squel','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','name'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0x36ca,0x137));var _0xa36c=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x36ca[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa36c('0x0'));var zipdir=require(_0xa36c('0x1'));var jsonpatch=require(_0xa36c('0x2'));var rp=require(_0xa36c('0x3'));var moment=require(_0xa36c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa36c('0x5'));var path=require('path');var sox=require(_0xa36c('0x6'));var csv=require(_0xa36c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa36c('0x8'));var squel=require(_0xa36c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa36c('0xa'));var toCsv=require(_0xa36c('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa36c('0xb'));var qs=require(_0xa36c('0xc'));var as=require(_0xa36c('0xd'));var hardwareService=require(_0xa36c('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0xa36c('0xf'));var config=require(_0xa36c('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xa36c('0x11'))['db'];function respondWithStatusCode(_0x2b9500,_0x7c666e){_0x7c666e=_0x7c666e||0xcc;return function(_0x269a00){if(_0x269a00){return _0x2b9500[_0xa36c('0x12')](_0x7c666e);}return _0x2b9500['status'](_0x7c666e)[_0xa36c('0x13')]();};}function respondWithResult(_0x18e674,_0x4a37ee){_0x4a37ee=_0x4a37ee||0xc8;return function(_0xabfc65){if(_0xabfc65){return _0x18e674[_0xa36c('0x14')](_0x4a37ee)[_0xa36c('0x15')](_0xabfc65);}};}function respondWithFilteredResult(_0x1bef29,_0x4b214e){return function(_0x29625c){if(_0x29625c){var _0x12d790=typeof _0x4b214e[_0xa36c('0x16')]===_0xa36c('0x17')&&typeof _0x4b214e[_0xa36c('0x18')]==='undefined';var _0x3ed459=_0x29625c[_0xa36c('0x19')];var _0x4b408d=_0x12d790?0x0:_0x4b214e[_0xa36c('0x16')];var _0x56113f=_0x12d790?_0x29625c[_0xa36c('0x19')]:_0x4b214e['offset']+_0x4b214e['limit'];var _0x2b0e11;if(_0x56113f>=_0x3ed459){_0x56113f=_0x3ed459;_0x2b0e11=0xc8;}else{_0x2b0e11=0xce;}_0x1bef29[_0xa36c('0x14')](_0x2b0e11);return _0x1bef29[_0xa36c('0x1a')]('Content-Range',_0x4b408d+'-'+_0x56113f+'/'+_0x3ed459)[_0xa36c('0x15')](_0x29625c);}return null;};}function patchUpdates(_0xc3561f){return function(_0x569681){try{jsonpatch[_0xa36c('0x1b')](_0x569681,_0xc3561f,!![]);}catch(_0x381b3e){return BPromise[_0xa36c('0x1c')](_0x381b3e);}return _0x569681[_0xa36c('0x1d')]();};}function saveUpdates(_0x281b95,_0x2308f8){return function(_0x154a1a){if(_0x154a1a){return _0x154a1a[_0xa36c('0x1e')](_0x281b95)[_0xa36c('0x1f')](function(_0x437712){return _0x437712;});}return null;};}function removeEntity(_0x39d049,_0x457479){return function(_0x4e513b){if(_0x4e513b){return _0x4e513b['destroy']()[_0xa36c('0x1f')](function(){_0x39d049[_0xa36c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b1d3c,_0x12f263){return function(_0xdfdf5a){if(!_0xdfdf5a){_0x4b1d3c[_0xa36c('0x12')](0x194);}return _0xdfdf5a;};}function handleError(_0x554708,_0x469746){_0x469746=_0x469746||0x1f4;return function(_0x8cb97f){logger[_0xa36c('0x20')](_0x8cb97f['stack']);if(_0x8cb97f[_0xa36c('0x21')]){delete _0x8cb97f['name'];}_0x554708[_0xa36c('0x14')](_0x469746)['send'](_0x8cb97f);};}exports['index']=function(_0x31e7bd,_0x44f555){var _0x19fcea={},_0x2e085a={},_0x41e9f9={'count':0x0,'rows':[]};var _0x20aef9=_[_0xa36c('0x22')](db[_0xa36c('0x23')]['rawAttributes'],function(_0x184f53){return{'name':_0x184f53[_0xa36c('0x24')],'type':_0x184f53[_0xa36c('0x25')][_0xa36c('0x26')]};});_0x2e085a[_0xa36c('0x27')]=_['map'](_0x20aef9,_0xa36c('0x21'));_0x2e085a[_0xa36c('0x28')]=_[_0xa36c('0x29')](_0x31e7bd['query']);_0x2e085a[_0xa36c('0x2a')]=_[_0xa36c('0x2b')](_0x2e085a[_0xa36c('0x27')],_0x2e085a['query']);_0x19fcea['attributes']=_[_0xa36c('0x2b')](_0x2e085a['model'],qs[_0xa36c('0x2c')](_0x31e7bd[_0xa36c('0x28')][_0xa36c('0x2c')]));_0x19fcea[_0xa36c('0x2d')]=_0x19fcea['attributes'][_0xa36c('0x2e')]?_0x19fcea['attributes']:_0x2e085a[_0xa36c('0x27')];if(!_0x31e7bd[_0xa36c('0x28')][_0xa36c('0x2f')](_0xa36c('0x30'))){_0x19fcea[_0xa36c('0x18')]=qs['limit'](_0x31e7bd[_0xa36c('0x28')][_0xa36c('0x18')]);_0x19fcea[_0xa36c('0x16')]=qs[_0xa36c('0x16')](_0x31e7bd[_0xa36c('0x28')][_0xa36c('0x16')]);}_0x19fcea[_0xa36c('0x31')]=qs['sort'](_0x31e7bd[_0xa36c('0x28')][_0xa36c('0x32')]);_0x19fcea['where']=qs[_0xa36c('0x2a')](_[_0xa36c('0x33')](_0x31e7bd[_0xa36c('0x28')],_0x2e085a[_0xa36c('0x2a')]),_0x20aef9);if(_0x31e7bd[_0xa36c('0x28')][_0xa36c('0x34')]){_0x19fcea[_0xa36c('0x35')]=_[_0xa36c('0x36')](_0x19fcea[_0xa36c('0x35')],{'$or':_['map'](_0x20aef9,function(_0xdf149b){if(_0xdf149b[_0xa36c('0x25')]!==_0xa36c('0x37')){var _0x3a7bbd={};_0x3a7bbd[_0xdf149b['name']]={'$like':'%'+_0x31e7bd[_0xa36c('0x28')]['filter']+'%'};return _0x3a7bbd;}})});}_0x19fcea=_[_0xa36c('0x36')]({},_0x19fcea,_0x31e7bd['options']);var _0x3db3eb={'where':_0x19fcea['where']};return db['WhatsappTransferReport'][_0xa36c('0x19')](_0x3db3eb)[_0xa36c('0x1f')](function(_0x51f4bb){_0x41e9f9[_0xa36c('0x19')]=_0x51f4bb;if(_0x31e7bd[_0xa36c('0x28')][_0xa36c('0x38')]){_0x19fcea[_0xa36c('0x39')]=[{'all':!![]}];}return db[_0xa36c('0x23')][_0xa36c('0x3a')](_0x19fcea);})[_0xa36c('0x1f')](function(_0x501950){_0x41e9f9[_0xa36c('0x3b')]=_0x501950;return _0x41e9f9;})[_0xa36c('0x1f')](respondWithFilteredResult(_0x44f555,_0x19fcea))['catch'](handleError(_0x44f555,null));};exports[_0xa36c('0x3c')]=function(_0x22618c,_0xdbce1a){var _0x34384f={'raw':!![],'where':{'id':_0x22618c[_0xa36c('0x3d')]['id']}},_0x2ae461={};_0x2ae461[_0xa36c('0x27')]=_[_0xa36c('0x29')](db[_0xa36c('0x23')][_0xa36c('0x3e')]);_0x2ae461[_0xa36c('0x28')]=_[_0xa36c('0x29')](_0x22618c[_0xa36c('0x28')]);_0x2ae461['filters']=_[_0xa36c('0x2b')](_0x2ae461[_0xa36c('0x27')],_0x2ae461[_0xa36c('0x28')]);_0x34384f[_0xa36c('0x2d')]=_[_0xa36c('0x2b')](_0x2ae461[_0xa36c('0x27')],qs[_0xa36c('0x2c')](_0x22618c[_0xa36c('0x28')][_0xa36c('0x2c')]));_0x34384f[_0xa36c('0x2d')]=_0x34384f[_0xa36c('0x2d')]['length']?_0x34384f[_0xa36c('0x2d')]:_0x2ae461['model'];if(_0x22618c[_0xa36c('0x28')][_0xa36c('0x38')]){_0x34384f[_0xa36c('0x39')]=[{'all':!![]}];}_0x34384f=_[_0xa36c('0x36')]({},_0x34384f,_0x22618c[_0xa36c('0x3f')]);return db[_0xa36c('0x23')][_0xa36c('0x40')](_0x34384f)['then'](handleEntityNotFound(_0xdbce1a,null))['then'](respondWithResult(_0xdbce1a,null))[_0xa36c('0x41')](handleError(_0xdbce1a,null));};exports[_0xa36c('0x42')]=function(_0x40f4ac,_0x407dc3){return db[_0xa36c('0x23')][_0xa36c('0x42')](_0x40f4ac[_0xa36c('0x43')],{})['then'](respondWithResult(_0x407dc3,0xc9))[_0xa36c('0x41')](handleError(_0x407dc3,null));};exports[_0xa36c('0x1e')]=function(_0x98da12,_0x41d111){if(_0x98da12[_0xa36c('0x43')]['id']){delete _0x98da12[_0xa36c('0x43')]['id'];}return db[_0xa36c('0x23')][_0xa36c('0x40')]({'where':{'id':_0x98da12[_0xa36c('0x3d')]['id']}})[_0xa36c('0x1f')](handleEntityNotFound(_0x41d111,null))['then'](saveUpdates(_0x98da12[_0xa36c('0x43')],null))['then'](respondWithResult(_0x41d111,null))[_0xa36c('0x41')](handleError(_0x41d111,null));};exports['destroy']=function(_0x5391bf,_0x404dcf){return db[_0xa36c('0x23')][_0xa36c('0x40')]({'where':{'id':_0x5391bf[_0xa36c('0x3d')]['id']}})[_0xa36c('0x1f')](handleEntityNotFound(_0x404dcf,null))[_0xa36c('0x1f')](removeEntity(_0x404dcf,null))[_0xa36c('0x41')](handleError(_0x404dcf,null));};exports[_0xa36c('0x44')]=function(_0x2e66bb,_0x1cd8dd){return db[_0xa36c('0x23')][_0xa36c('0x44')]()[_0xa36c('0x1f')](respondWithResult(_0x1cd8dd,null))[_0xa36c('0x41')](handleError(_0x1cd8dd,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 7426125..d7cd11f 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 _0x8a8d=['bluebird','path','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x250cac,_0x5c17c8){var _0x1deeb7=function(_0x407a9d){while(--_0x407a9d){_0x250cac['push'](_0x250cac['shift']());}};_0x1deeb7(++_0x5c17c8);}(_0x8a8d,0x19b));var _0xd8a8=function(_0x697205,_0x5cd9a5){_0x697205=_0x697205-0x0;var _0x473c2c=_0x8a8d[_0x697205];return _0x473c2c;};'use strict';var _=require(_0xd8a8('0x0'));var util=require(_0xd8a8('0x1'));var logger=require(_0xd8a8('0x2'))(_0xd8a8('0x3'));var moment=require(_0xd8a8('0x4'));var BPromise=require(_0xd8a8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8a8('0x6'));var rimraf=require('rimraf');var config=require(_0xd8a8('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0xd8a8('0x8')]=function(_0x1de5ce,_0x5b7572){return _0x1de5ce[_0xd8a8('0x9')](_0xd8a8('0xa'),attributes,{'tableName':_0xd8a8('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd8a8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe22=['util','api','moment','bluebird','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfe22,0xe3));var _0x2fe2=function(_0x3387ea,_0x597531){_0x3387ea=_0x3387ea-0x0;var _0x362884=_0xfe22[_0x3387ea];return _0x362884;};'use strict';var _=require(_0x2fe2('0x0'));var util=require(_0x2fe2('0x1'));var logger=require('../../config/logger')(_0x2fe2('0x2'));var moment=require(_0x2fe2('0x3'));var BPromise=require(_0x2fe2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2fe2('0x5'));var config=require(_0x2fe2('0x6'));var attributes=require(_0x2fe2('0x7'));module[_0x2fe2('0x8')]=function(_0x383af4,_0x34330a){return _0x383af4[_0x2fe2('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x2fe2('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2fe2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 0678698..8f5c80f 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 _0x745b=['code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5760c9,_0x3ad606){var _0x6da60c=function(_0x3f8d5a){while(--_0x3f8d5a){_0x5760c9['push'](_0x5760c9['shift']());}};_0x6da60c(++_0x3ad606);}(_0x745b,0x125));var _0xb745=function(_0x35e75a,_0x4dba87){_0x35e75a=_0x35e75a-0x0;var _0x171371=_0x745b[_0x35e75a];return _0x171371;};'use strict';var _=require(_0xb745('0x0'));var util=require(_0xb745('0x1'));var moment=require(_0xb745('0x2'));var BPromise=require(_0xb745('0x3'));var rs=require(_0xb745('0x4'));var fs=require('fs');var Redis=require(_0xb745('0x5'));var db=require(_0xb745('0x6'))['db'];var utils=require(_0xb745('0x7'));var logger=require('../../config/logger')(_0xb745('0x8'));var config=require(_0xb745('0x9'));var jayson=require(_0xb745('0xa'));var client=jayson['client'][_0xb745('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20d052,_0x15c9d9,_0x59d807){return new BPromise(function(_0x540fb0,_0x3c9f1e){return client[_0xb745('0xc')](_0x20d052,_0x59d807)[_0xb745('0xd')](function(_0x26b2b7){logger[_0xb745('0xe')](_0xb745('0xf'),_0x15c9d9,_0xb745('0x10'));logger[_0xb745('0x11')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x15c9d9,_0xb745('0x10'),JSON[_0xb745('0x12')](_0x26b2b7));if(_0x26b2b7['error']){if(_0x26b2b7['error'][_0xb745('0x13')]===0x1f4){logger[_0xb745('0x14')](_0xb745('0xf'),_0x15c9d9,_0x26b2b7[_0xb745('0x14')][_0xb745('0x15')]);return _0x3c9f1e(_0x26b2b7[_0xb745('0x14')][_0xb745('0x15')]);}logger['error'](_0xb745('0xf'),_0x15c9d9,_0x26b2b7['error']['message']);return _0x540fb0(_0x26b2b7['error']['message']);}else{logger[_0xb745('0xe')](_0xb745('0xf'),_0x15c9d9,'request\x20sent');_0x540fb0(_0x26b2b7[_0xb745('0x16')][_0xb745('0x15')]);}})[_0xb745('0x17')](function(_0x117861){logger[_0xb745('0x14')](_0xb745('0xf'),_0x15c9d9,_0x117861);_0x3c9f1e(_0x117861);});});} \ No newline at end of file +var _0x6dff=['debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x56ea6f,_0x15535a){var _0x43ac31=function(_0x1b6d99){while(--_0x1b6d99){_0x56ea6f['push'](_0x56ea6f['shift']());}};_0x43ac31(++_0x15535a);}(_0x6dff,0x147));var _0xf6df=function(_0x23a70e,_0x3884cc){_0x23a70e=_0x23a70e-0x0;var _0x5845fd=_0x6dff[_0x23a70e];return _0x5845fd;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf6df('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6df('0x1'));var db=require(_0xf6df('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6df('0x3'))(_0xf6df('0x4'));var config=require(_0xf6df('0x5'));var jayson=require(_0xf6df('0x6'));var client=jayson[_0xf6df('0x7')][_0xf6df('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a89fc,_0x4d97a4,_0x132873){return new BPromise(function(_0x3ca241,_0x4a4eb7){return client[_0xf6df('0x9')](_0x3a89fc,_0x132873)['then'](function(_0x137922){logger[_0xf6df('0xa')](_0xf6df('0xb'),_0x4d97a4,_0xf6df('0xc'));logger[_0xf6df('0xd')](_0xf6df('0xe'),_0x4d97a4,_0xf6df('0xc'),JSON['stringify'](_0x137922));if(_0x137922['error']){if(_0x137922[_0xf6df('0xf')][_0xf6df('0x10')]===0x1f4){logger['error'](_0xf6df('0xb'),_0x4d97a4,_0x137922[_0xf6df('0xf')]['message']);return _0x4a4eb7(_0x137922['error'][_0xf6df('0x11')]);}logger[_0xf6df('0xf')](_0xf6df('0xb'),_0x4d97a4,_0x137922[_0xf6df('0xf')]['message']);return _0x3ca241(_0x137922[_0xf6df('0xf')][_0xf6df('0x11')]);}else{logger[_0xf6df('0xa')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4d97a4,'request\x20sent');_0x3ca241(_0x137922[_0xf6df('0x12')][_0xf6df('0x11')]);}})[_0xf6df('0x13')](function(_0x2d5770){logger[_0xf6df('0xf')](_0xf6df('0xb'),_0x4d97a4,_0x2d5770);_0x4a4eb7(_0x2d5770);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index f504a21..8e05b6e 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ed7=['./config/license','default','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','listen','info','then','start','Online\x20apps:','filter','Offline\x20apps:','status','online','name','join','None','seedDB','./config/seedDB'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x7ed7,0x18d));var _0x77ed=function(_0x40bbce,_0x1541b9){_0x40bbce=_0x40bbce-0x0;var _0xb24be4=_0x7ed7[_0x40bbce];return _0xb24be4;};'use strict';var _=require(_0x77ed('0x0'));var mysqldb=require(_0x77ed('0x1'));var rpc=require(_0x77ed('0x2'));var config=require('./config/environment');var logger=require('./config/logger')(_0x77ed('0x3'));var pm2=require(_0x77ed('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x77ed('0x5'));var chat=require(_0x77ed('0x6'));var whatsapp=require(_0x77ed('0x7'));var transcribe=require(_0x77ed('0x8'));function main(){return mysqldb['db']['sequelize']['sync']()['then'](function(){return rpc[_0x77ed('0x9')]();})['then'](function(_0x165c80){logger[_0x77ed('0xa')](_0x165c80);return chat['start']();})[_0x77ed('0xb')](function(){return whatsapp[_0x77ed('0xc')]();})[_0x77ed('0xb')](function(){return schedule[_0x77ed('0xc')]();})[_0x77ed('0xb')](function(){return transcribe['start']();})[_0x77ed('0xb')](function(_0x3102b0){logger[_0x77ed('0xa')](_0x3102b0);return pm2[_0x77ed('0xc')](pm2Config);})[_0x77ed('0xb')](function(_0x476f22){logger['info'](_0x77ed('0xd'),_['map'](_[_0x77ed('0xe')](_0x476f22,{'status':'online'}),'name')['join']());logger[_0x77ed('0xa')](_0x77ed('0xf'),_['map'](_[_0x77ed('0xe')](_0x476f22,function(_0x1efe64){return _0x1efe64[_0x77ed('0x10')]!==_0x77ed('0x11');}),_0x77ed('0x12'))[_0x77ed('0x13')]()||_0x77ed('0x14'));config[_0x77ed('0x15')]&&require(_0x77ed('0x16'))['default']();require(_0x77ed('0x17'))[_0x77ed('0x18')]();})[_0x77ed('0x19')](function(_0x3b2ad1){logger['error'](_0x77ed('0x1a'),_0x3b2ad1);process[_0x77ed('0x1b')](0x1);});}main(); \ No newline at end of file +var _0xf926=['name','join','status','None','seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen','start','info','Online\x20apps:','filter','online'];(function(_0x53b8e0,_0x55d46e){var _0x10630c=function(_0x3189aa){while(--_0x3189aa){_0x53b8e0['push'](_0x53b8e0['shift']());}};_0x10630c(++_0x55d46e);}(_0xf926,0x96));var _0x6f92=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xf926[_0x422905];return _0x33dc6c;};'use strict';var _=require('lodash');var mysqldb=require(_0x6f92('0x0'));var rpc=require(_0x6f92('0x1'));var config=require('./config/environment');var logger=require(_0x6f92('0x2'))('app');var pm2=require(_0x6f92('0x3'));var pm2Config=require(_0x6f92('0x4'));var schedule=require(_0x6f92('0x5'));var chat=require(_0x6f92('0x6'));var whatsapp=require(_0x6f92('0x7'));var transcribe=require(_0x6f92('0x8'));function main(){return mysqldb['db'][_0x6f92('0x9')][_0x6f92('0xa')]()[_0x6f92('0xb')](function(){return rpc[_0x6f92('0xc')]();})['then'](function(_0x4444a0){logger['info'](_0x4444a0);return chat[_0x6f92('0xd')]();})['then'](function(){return whatsapp['start']();})[_0x6f92('0xb')](function(){return schedule[_0x6f92('0xd')]();})[_0x6f92('0xb')](function(){return transcribe[_0x6f92('0xd')]();})[_0x6f92('0xb')](function(_0x12c504){logger[_0x6f92('0xe')](_0x12c504);return pm2[_0x6f92('0xd')](pm2Config);})[_0x6f92('0xb')](function(_0x551faa){logger[_0x6f92('0xe')](_0x6f92('0xf'),_['map'](_[_0x6f92('0x10')](_0x551faa,{'status':_0x6f92('0x11')}),_0x6f92('0x12'))[_0x6f92('0x13')]());logger[_0x6f92('0xe')]('Offline\x20apps:',_['map'](_['filter'](_0x551faa,function(_0x1c5b08){return _0x1c5b08[_0x6f92('0x14')]!=='online';}),_0x6f92('0x12'))[_0x6f92('0x13')]()||_0x6f92('0x15'));config[_0x6f92('0x16')]&&require('./config/seedDB')[_0x6f92('0x17')]();require(_0x6f92('0x18'))['default']();})[_0x6f92('0x19')](function(_0x1d09ed){logger['error'](_0x6f92('0x1a'),_0x1d09ed);process[_0x6f92('0x1b')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 5b9e79b..5518dd3 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 _0xec52=['faxPause','smsPause','openchannelPause','pauseType','showWebBar','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','then','json','Unmanaged.','catch','headers','authorization','startsWith','Basic','authenticate','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','getUuid','apikey','find','Setting','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User','User\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','setTokenCookie','role','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','promisify','sign','secret','secrets','session','payload','options','verify','randomBytes','toString','hex','now','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','crypto','bluebird','util','name','internal','userpic','permissions','md5secret','voicePause','chatPause','mailPause'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xec52,0x165));var _0x2ec5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xec52[_0x14add3];return _0x4a174f;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x2ec5('0x0'));var hardwareConf=require(_0x2ec5('0x1'));var licenseUtil=require(_0x2ec5('0x2'));var encryptor=require(_0x2ec5('0x3'));var _=require(_0x2ec5('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x2ec5('0x5'));var compose=require(_0x2ec5('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x2ec5('0x7'));var BPromise=require(_0x2ec5('0x8'));var util=require(_0x2ec5('0x9'));var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id','role','fullname',_0x2ec5('0xa'),_0x2ec5('0xb'),'email',_0x2ec5('0xc'),_0x2ec5('0xd'),_0x2ec5('0xe'),_0x2ec5('0xf'),_0x2ec5('0x10'),_0x2ec5('0x11'),_0x2ec5('0x12'),_0x2ec5('0x13'),_0x2ec5('0x14'),_0x2ec5('0x15'),_0x2ec5('0x16'),'lastLoginAt','lastPauseAt',_0x2ec5('0x17'),_0x2ec5('0x18'),_0x2ec5('0x19'),_0x2ec5('0x1a'),'phoneBarAutoAnswer',_0x2ec5('0x1b'),_0x2ec5('0x1c'),_0x2ec5('0x1d'),_0x2ec5('0x1e'),_0x2ec5('0x1f'),_0x2ec5('0x20'),_0x2ec5('0x21'),_0x2ec5('0x22'),_0x2ec5('0x23'),_0x2ec5('0x24'),_0x2ec5('0x25'),_0x2ec5('0x26'),'privacyEnabled',_0x2ec5('0x27'),_0x2ec5('0x28'),_0x2ec5('0x29'),_0x2ec5('0x2a'),_0x2ec5('0x2b')];exports[_0x2ec5('0x2c')]=function(){return this[_0x2ec5('0x2d')](!![])[_0x2ec5('0x2e')](function(_0x402573,_0x458271,_0x5cd4c6){if(_0x402573[_0x2ec5('0x2f')]){_0x5cd4c6();}else{return db[_0x2ec5('0x30')]['findOne']({'where':{'id':_0x402573[_0x2ec5('0x31')]['id']},'attributes':['id',_0x2ec5('0x32'),_0x2ec5('0x33')],'raw':!![]})[_0x2ec5('0x34')](function(_0x2c4d09){if(_0x2c4d09&&_0x2c4d09[_0x2ec5('0x32')]){return _0x458271['status'](_0x2c4d09[_0x2ec5('0x33')]==='unmanaged'?0x195:0x193)[_0x2ec5('0x35')]({'message':_0x2c4d09['disposition']==='unmanaged'?_0x2ec5('0x36'):'Forbidden.'});}else{_0x5cd4c6();}})[_0x2ec5('0x37')](function(_0x3a67a2){_0x5cd4c6(_0x3a67a2);});}});};exports[_0x2ec5('0x2d')]=function isAuthenticated(_0x5b65b3){return compose()[_0x2ec5('0x2e')](function(_0x2bc3c1,_0x5487f0,_0x1d1d85){var _0x1d70cc;if(_0x2bc3c1[_0x2ec5('0x38')][_0x2ec5('0x39')]){if(_[_0x2ec5('0x3a')](_0x2bc3c1['headers']['authorization'],_0x2ec5('0x3b'))){var _0x147c4e=basicAuth(_0x2bc3c1);db['User']['find']({'where':{'name':_0x147c4e['name']}})[_0x2ec5('0x34')](function(_0xd42617){if(!_0xd42617||!_0xd42617[_0x2ec5('0x3c')](_0x147c4e[_0x2ec5('0x3d')])){return _0x5487f0[_0x2ec5('0x3e')](0x191)[_0x2ec5('0x35')]({'message':_0x2ec5('0x3f')});}_0x2bc3c1['user']={'id':_0xd42617['id']};_0x1d1d85();})['catch'](function(_0xfc0d45){_0x1d1d85(_0xfc0d45);});}else if(_[_0x2ec5('0x3a')](_0x2bc3c1['headers'][_0x2ec5('0x39')],_0x2ec5('0x40'))){validateJwt(_0x2bc3c1,_0x5487f0,_0x1d1d85);}else{if(_0x5b65b3){_0x1d1d85();}else{return _0x5487f0[_0x2ec5('0x3e')](0x193)[_0x2ec5('0x35')]({'message':_0x2ec5('0x41')});}}}else if(_0x2bc3c1[_0x2ec5('0x42')]['apikey']){try{var _0x4380bd={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x2ec5('0x43')]()};verifyJwt(_0x2bc3c1['query'][_0x2ec5('0x44')],_0x4380bd)[_0x2ec5('0x34')](function(_0x498636){return db['User'][_0x2ec5('0x45')]({'where':{'id':_0x498636['sub']}})[_0x2ec5('0x34')](function(_0x5660e0){_0x1d70cc=_0x5660e0;return db[_0x2ec5('0x46')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x2ec5('0x47')],'raw':!![]});})[_0x2ec5('0x34')](function(_0x262fb8){if(!_0x1d70cc||!_[_0x2ec5('0x48')](_0x1d70cc[_0x2ec5('0x49')],_0x498636[_0x2ec5('0x4a')])){return _0x5487f0[_0x2ec5('0x3e')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x1d70cc[_0x2ec5('0x4b')]){return _0x5487f0['status'](0x191)[_0x2ec5('0x35')]({'message':_0x2ec5('0x4c')});}if(_0x1d70cc[_0x2ec5('0x4d')]){if(_0x262fb8[_0x2ec5('0x47')]>0x0){if(moment(_0x1d70cc[_0x2ec5('0x4e')])[_0x2ec5('0x4f')](_0x262fb8['blockDuration'],_0x2ec5('0x50'))>moment()){return _0x5487f0[_0x2ec5('0x3e')](0x191)[_0x2ec5('0x35')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x5487f0[_0x2ec5('0x3e')](0x191)[_0x2ec5('0x35')]({'message':_0x2ec5('0x4c')});}}_0x2bc3c1[_0x2ec5('0x2f')]={'id':_0x1d70cc['id']};_0x1d1d85();});})['catch'](function(){return _0x5487f0['status'](0x191)[_0x2ec5('0x35')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x544a32){_0x1d1d85(_0x544a32);}}else if(_0x5b65b3){_0x1d1d85();}else{return _0x5487f0[_0x2ec5('0x3e')](0x193)['json']({'message':_0x2ec5('0x41')});}})[_0x2ec5('0x2e')](function(_0x2077a5,_0x75a5c5,_0x1cbcaa){if(_0x2077a5[_0x2ec5('0x2f')]){db[_0x2ec5('0x51')][_0x2ec5('0x45')]({'where':{'id':_0x2077a5['user']['id']},'attributes':userAttributes})[_0x2ec5('0x34')](function(_0x21c8d9){if(!_0x21c8d9){return _0x75a5c5[_0x2ec5('0x3e')](0x194)[_0x2ec5('0x35')]({'message':_0x2ec5('0x52')});}_0x2077a5[_0x2ec5('0x2f')]=_0x21c8d9;_0x1cbcaa();})[_0x2ec5('0x37')](function(_0x5b098e){_0x1cbcaa(_0x5b098e);});}else if(_0x5b65b3){_0x1cbcaa();}else{return _0x75a5c5[_0x2ec5('0x3e')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x2ec5('0x53')]=function canUpdate(){return compose()['use'](function(_0x1a0e96,_0x1fe3c8,_0x40d076){return licenseUtil[_0x2ec5('0x54')]()['then'](function(_0xa159e8){if(_0xa159e8['update']){_0x40d076();}else{return _0x1fe3c8[_0x2ec5('0x3e')](0x193)[_0x2ec5('0x35')]({'message':_0x2ec5('0x55')});}})['catch'](function(_0x3633a6){_0x40d076(_0x3633a6);});});};exports['isMiddleware']=function(_0x451bdf,_0x111161,_0x45b801){_0x451bdf[_0x2ec5('0x56')]=!![];return _0x45b801();};exports['signToken']=function signToken(_0xe1aa8d){return signJwt(_0xe1aa8d);};exports[_0x2ec5('0x57')]=function(_0x45a0a2,_0x26244f){if(!_0x45a0a2[_0x2ec5('0x2f')]){return _0x26244f[_0x2ec5('0x3e')](0x194)[_0x2ec5('0x35')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x42a2ed={'payload':{'id':_0x45a0a2[_0x2ec5('0x2f')]['id'],'role':_0x45a0a2[_0x2ec5('0x2f')][_0x2ec5('0x58')]},'options':{'expiresIn':0x15180}};return signJwt(_0x42a2ed)['then'](function(_0xc067f2){_0x26244f['cookie']('motion.token',_0xc067f2);_0x26244f[_0x2ec5('0x59')](_0x2ec5('0x5a'));})['catch'](function(_0x26e7dd){return _0x26244f[_0x2ec5('0x3e')](0x1f4)[_0x2ec5('0x5b')](_0x26e7dd);});};exports[_0x2ec5('0x5c')]=function(_0x509589){if(_[_0x2ec5('0x5d')](_0x509589['apiKeyNonce'])||_[_0x2ec5('0x5d')](_0x509589[_0x2ec5('0x5e')])){return null;}else{return createJwt(_0x509589);}};exports[_0x2ec5('0x5f')]=function(_0x3d09f3){_0x3d09f3[_0x2ec5('0x49')]=generateNonce();_0x3d09f3[_0x2ec5('0x5e')]=generateIssuedAt();return createJwt(_0x3d09f3);};exports[_0x2ec5('0x60')]=function(_0x37b653,_0x119882){var _0x590395=_0x37b653[_0x2ec5('0x42')][_0x2ec5('0x44')];if(_0x590395){var _0x1643e0={'nonce':_0x119882[_0x2ec5('0x49')],'iat':_0x119882['apiKeyIat'],'audience':hardwareConf[_0x2ec5('0x43')](),'issuer':hardwareConf[_0x2ec5('0x43')]()};return verifyJwt(_0x590395,_0x1643e0)[_0x2ec5('0x34')](function(){return generateApiKey(_0x119882);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x283ffe){var _0x22c163=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x22c163[_0x2ec5('0x61')](_0x283ffe))throw new db[(_0x2ec5('0x62'))][(_0x2ec5('0x63'))](_0x2ec5('0x64'));return;};exports[_0x2ec5('0x65')]=function(_0x34b95c,_0x5d76f5,_0x91a423){var _0x2ab555=encryptor[_0x2ec5('0x66')](_0x5d76f5)[_0x2ec5('0x67')](',');for(var _0x2bef4f=0x0;_0x2bef4f<_0x91a423;_0x2bef4f++){if(!_0x2ab555[_0x2bef4f])break;if(_0x34b95c[_0x2ec5('0x68')]()===_0x2ab555[_0x2bef4f]['toLowerCase']()){var _0xe037e5=util['format'](_0x2ec5('0x69'),_0x91a423);if(_0x91a423===0x1){_0xe037e5=_0x2ec5('0x6a');}throw new db['Sequelize']['ValidationError'](_0xe037e5);}}return;};exports[_0x2ec5('0x6b')]=function(_0x2e6983,_0x2f08af){var _0x99e59a=_0x2f08af?encryptor[_0x2ec5('0x66')](_0x2f08af)[_0x2ec5('0x67')](','):[];if(_0x99e59a[_0x2ec5('0x6c')]===0x5){_0x99e59a[_0x2ec5('0x6d')](-0x1,0x1);}_0x99e59a[_0x2ec5('0x6e')](_0x2e6983);return encryptor[_0x2ec5('0x6f')](_0x99e59a['join'](','));};function signJwt(_0x3fa43a){var _0x31b6e4=BPromise[_0x2ec5('0x70')](jwt[_0x2ec5('0x71')],{'context':jwt});var _0x5b9cf5=_0x3fa43a[_0x2ec5('0x72')]||config[_0x2ec5('0x73')][_0x2ec5('0x74')];return new BPromise(function(_0x4727a2,_0x42dc68){_0x31b6e4(_0x3fa43a[_0x2ec5('0x75')],_0x5b9cf5,_0x3fa43a[_0x2ec5('0x76')])[_0x2ec5('0x34')](function(_0x374e6c){_0x4727a2(_0x374e6c);})['catch'](function(_0x1aaa60){_0x42dc68(_0x1aaa60);});});}function verifyJwt(_0x3e35e4,_0x552e0e,_0x39cdb9){var _0x2403fe=BPromise[_0x2ec5('0x70')](jwt[_0x2ec5('0x77')],{'context':jwt});var _0x3c3f7e=_0x39cdb9||config['secrets'][_0x2ec5('0x74')];return new BPromise(function(_0x101dab,_0x22cbd5){_0x2403fe(_0x3e35e4,_0x3c3f7e,_0x552e0e)[_0x2ec5('0x34')](function(_0x54f95f){_0x101dab(_0x54f95f);})[_0x2ec5('0x37')](function(_0x2c9d70){_0x22cbd5(_0x2c9d70);});});}function generateNonce(){return crypto[_0x2ec5('0x78')](0x10)[_0x2ec5('0x79')](_0x2ec5('0x7a'));}function generateIssuedAt(){return Math['floor'](Date[_0x2ec5('0x7b')]()/0x3e8)[_0x2ec5('0x79')]();}function createJwt(_0x128eb7){var _0x11cc69={'payload':{'iat':_0x128eb7[_0x2ec5('0x5e')],'nonce':_0x128eb7['apiKeyNonce']},'options':{'algorithm':_0x2ec5('0x7c'),'subject':_0x128eb7['id'][_0x2ec5('0x79')](),'issuer':hardwareConf[_0x2ec5('0x43')](),'audience':hardwareConf[_0x2ec5('0x43')]()}};return signJwt(_0x11cc69)[_0x2ec5('0x34')](function(_0x33bdff){return{'iat':_0x128eb7[_0x2ec5('0x5e')],'nonce':_0x128eb7[_0x2ec5('0x49')],'token':_0x33bdff};});} \ No newline at end of file +var _0x9255=['sign','secret','session','payload','randomBytes','toString','hex','floor','now','apiKeyIat','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','name','internal','email','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','use','headers','authorization','startsWith','find','authenticate','pass','Wrong\x20credentials.','catch','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','blockDuration','minutes','User','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','signToken','cookie','motion.token','redirect','send','retrieveApiKey','isNil','generateApiKey','regenerateApiKey','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~!@#$%^&-_=+[{]}.','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','splice','unshift','join','promisify'];(function(_0x4b2df3,_0x50a168){var _0x4daa61=function(_0x2e1a79){while(--_0x2e1a79){_0x4b2df3['push'](_0x4b2df3['shift']());}};_0x4daa61(++_0x50a168);}(_0x9255,0x109));var _0x5925=function(_0x30f6b0,_0x1a2d08){_0x30f6b0=_0x30f6b0-0x0;var _0x2b4fba=_0x9255[_0x30f6b0];return _0x2b4fba;};'use strict';var db=require(_0x5925('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x5925('0x1'));var licenseUtil=require(_0x5925('0x2'));var encryptor=require(_0x5925('0x3'));var _=require(_0x5925('0x4'));var jwt=require(_0x5925('0x5'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0x5925('0x6'));var crypto=require(_0x5925('0x7'));var BPromise=require(_0x5925('0x8'));var util=require(_0x5925('0x9'));var moment=require(_0x5925('0xa'));var validateJwt=expressJwt({'secret':config[_0x5925('0xb')]['session']});var userAttributes=['id',_0x5925('0xc'),_0x5925('0xd'),_0x5925('0xe'),_0x5925('0xf'),_0x5925('0x10'),'userpic',_0x5925('0x11'),'md5secret',_0x5925('0x12'),_0x5925('0x13'),_0x5925('0x14'),_0x5925('0x15'),_0x5925('0x16'),_0x5925('0x17'),_0x5925('0x18'),'showWebBar',_0x5925('0x19'),_0x5925('0x1a'),_0x5925('0x1b'),_0x5925('0x1c'),_0x5925('0x1d'),_0x5925('0x1e'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x5925('0x1f'),'phoneBarEnableRecording',_0x5925('0x20'),'phoneBarEnableSettings',_0x5925('0x21'),_0x5925('0x22'),_0x5925('0x23'),_0x5925('0x24'),_0x5925('0x25'),_0x5925('0x26'),_0x5925('0x27'),_0x5925('0x28'),_0x5925('0x29'),_0x5925('0x2a'),_0x5925('0x2b'),_0x5925('0x2c'),_0x5925('0x2d')];exports['isChatInteractionAuthorized']=function(){return this[_0x5925('0x2e')](!![])['use'](function(_0x3007a9,_0x51ed82,_0x4c5151){if(_0x3007a9[_0x5925('0x2f')]){_0x4c5151();}else{return db[_0x5925('0x30')][_0x5925('0x31')]({'where':{'id':_0x3007a9[_0x5925('0x32')]['id']},'attributes':['id',_0x5925('0x33'),_0x5925('0x34')],'raw':!![]})[_0x5925('0x35')](function(_0x14ab95){if(_0x14ab95&&_0x14ab95['closed']){return _0x51ed82[_0x5925('0x36')](_0x14ab95[_0x5925('0x34')]===_0x5925('0x37')?0x195:0x193)[_0x5925('0x38')]({'message':_0x14ab95[_0x5925('0x34')]===_0x5925('0x37')?_0x5925('0x39'):_0x5925('0x3a')});}else{_0x4c5151();}})['catch'](function(_0x3fb8c9){_0x4c5151(_0x3fb8c9);});}});};exports['isAuthenticated']=function isAuthenticated(_0x331951){return compose()[_0x5925('0x3b')](function(_0x539895,_0x1eb1c2,_0x3a3b24){var _0x310e3e;if(_0x539895[_0x5925('0x3c')][_0x5925('0x3d')]){if(_[_0x5925('0x3e')](_0x539895[_0x5925('0x3c')]['authorization'],'Basic')){var _0x3e9309=basicAuth(_0x539895);db['User'][_0x5925('0x3f')]({'where':{'name':_0x3e9309[_0x5925('0xe')]}})['then'](function(_0x4a9b01){if(!_0x4a9b01||!_0x4a9b01[_0x5925('0x40')](_0x3e9309[_0x5925('0x41')])){return _0x1eb1c2[_0x5925('0x36')](0x191)[_0x5925('0x38')]({'message':_0x5925('0x42')});}_0x539895[_0x5925('0x2f')]={'id':_0x4a9b01['id']};_0x3a3b24();})[_0x5925('0x43')](function(_0x28be64){_0x3a3b24(_0x28be64);});}else if(_[_0x5925('0x3e')](_0x539895[_0x5925('0x3c')][_0x5925('0x3d')],'Bearer')){validateJwt(_0x539895,_0x1eb1c2,_0x3a3b24);}else{if(_0x331951){_0x3a3b24();}else{return _0x1eb1c2[_0x5925('0x36')](0x193)['json']({'message':_0x5925('0x44')});}}}else if(_0x539895[_0x5925('0x45')][_0x5925('0x46')]){try{var _0x20d1ac={'audience':hardwareConf[_0x5925('0x47')](),'issuer':hardwareConf[_0x5925('0x47')]()};verifyJwt(_0x539895['query'][_0x5925('0x46')],_0x20d1ac)['then'](function(_0x2064d8){return db['User'][_0x5925('0x3f')]({'where':{'id':_0x2064d8[_0x5925('0x48')]}})[_0x5925('0x35')](function(_0x359383){_0x310e3e=_0x359383;return db[_0x5925('0x49')][_0x5925('0x31')]({'where':{'id':0x1},'attributes':[_0x5925('0x4a'),'blockDuration'],'raw':!![]});})[_0x5925('0x35')](function(_0x32cda5){if(!_0x310e3e||!_[_0x5925('0x4b')](_0x310e3e[_0x5925('0x4c')],_0x2064d8[_0x5925('0x4d')])){return _0x1eb1c2[_0x5925('0x36')](0x191)[_0x5925('0x38')]({'message':_0x5925('0x4e')});}if(_0x310e3e[_0x5925('0x4f')]){return _0x1eb1c2[_0x5925('0x36')](0x191)['json']({'message':_0x5925('0x50')});}if(_0x310e3e[_0x5925('0x51')]){if(_0x32cda5['blockDuration']>0x0){if(moment(_0x310e3e['blockedAt'])[_0x5925('0x52')](_0x32cda5[_0x5925('0x53')],_0x5925('0x54'))>moment()){return _0x1eb1c2[_0x5925('0x36')](0x191)[_0x5925('0x38')]({'message':_0x5925('0x50')});}}else{return _0x1eb1c2[_0x5925('0x36')](0x191)['json']({'message':_0x5925('0x50')});}}_0x539895[_0x5925('0x2f')]={'id':_0x310e3e['id']};_0x3a3b24();});})['catch'](function(){return _0x1eb1c2[_0x5925('0x36')](0x191)['json']({'message':_0x5925('0x50')});});}catch(_0x49ba41){_0x3a3b24(_0x49ba41);}}else if(_0x331951){_0x3a3b24();}else{return _0x1eb1c2['status'](0x193)[_0x5925('0x38')]({'message':_0x5925('0x44')});}})[_0x5925('0x3b')](function(_0x3c3db3,_0x1ffcde,_0x5c8ece){if(_0x3c3db3[_0x5925('0x2f')]){db[_0x5925('0x55')][_0x5925('0x3f')]({'where':{'id':_0x3c3db3['user']['id']},'attributes':userAttributes})['then'](function(_0x5dcd02){if(!_0x5dcd02){return _0x1ffcde[_0x5925('0x36')](0x194)[_0x5925('0x38')]({'message':_0x5925('0x56')});}_0x3c3db3[_0x5925('0x2f')]=_0x5dcd02;_0x5c8ece();})[_0x5925('0x43')](function(_0x4996e3){_0x5c8ece(_0x4996e3);});}else if(_0x331951){_0x5c8ece();}else{return _0x1ffcde[_0x5925('0x36')](0x194)[_0x5925('0x38')]({'message':_0x5925('0x57')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x5925('0x3b')](function(_0x203846,_0x1a53e2,_0x33685c){return licenseUtil[_0x5925('0x58')]()[_0x5925('0x35')](function(_0x3a0be8){if(_0x3a0be8[_0x5925('0x59')]){_0x33685c();}else{return _0x1a53e2[_0x5925('0x36')](0x193)['json']({'message':_0x5925('0x5a')});}})[_0x5925('0x43')](function(_0x6cc44){_0x33685c(_0x6cc44);});});};exports['isMiddleware']=function(_0x291da4,_0x1c9f2d,_0x34dccb){_0x291da4['isMiddleware']=!![];return _0x34dccb();};exports[_0x5925('0x5b')]=function signToken(_0x218a08){return signJwt(_0x218a08);};exports['setTokenCookie']=function(_0x1ff126,_0x61e92a){if(!_0x1ff126[_0x5925('0x2f')]){return _0x61e92a['status'](0x194)[_0x5925('0x38')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0xa69900={'payload':{'id':_0x1ff126['user']['id'],'role':_0x1ff126['user'][_0x5925('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0xa69900)['then'](function(_0x2bf587){_0x61e92a[_0x5925('0x5c')](_0x5925('0x5d'),_0x2bf587);_0x61e92a[_0x5925('0x5e')]('/dashboards/general');})[_0x5925('0x43')](function(_0x4bb968){return _0x61e92a[_0x5925('0x36')](0x1f4)[_0x5925('0x5f')](_0x4bb968);});};exports[_0x5925('0x60')]=function(_0x4a3f37){if(_[_0x5925('0x61')](_0x4a3f37[_0x5925('0x4c')])||_[_0x5925('0x61')](_0x4a3f37['apiKeyIat'])){return null;}else{return createJwt(_0x4a3f37);}};exports[_0x5925('0x62')]=function(_0x396590){_0x396590[_0x5925('0x4c')]=generateNonce();_0x396590['apiKeyIat']=generateIssuedAt();return createJwt(_0x396590);};exports[_0x5925('0x63')]=function(_0x8e42ed,_0x5ccd68){var _0xac56df=_0x8e42ed['query']['apikey'];if(_0xac56df){var _0x4207d3={'nonce':_0x5ccd68[_0x5925('0x4c')],'iat':_0x5ccd68['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x5925('0x47')]()};return verifyJwt(_0xac56df,_0x4207d3)[_0x5925('0x35')](function(){return generateApiKey(_0x5ccd68);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x5925('0x64')]=function(_0x1ee0ea){var _0x7b84db=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x7b84db[_0x5925('0x65')](_0x1ee0ea))throw new db[(_0x5925('0x66'))][(_0x5925('0x67'))](_0x5925('0x68'));return;};exports['validatePasswordHistory']=function(_0x220e5c,_0x4e47c4,_0x2992dd){var _0x270346=encryptor['decryptString'](_0x4e47c4)[_0x5925('0x69')](',');for(var _0x42537d=0x0;_0x42537d<_0x2992dd;_0x42537d++){if(!_0x270346[_0x42537d])break;if(_0x220e5c['toLowerCase']()===_0x270346[_0x42537d][_0x5925('0x6a')]()){var _0x292807=util['format'](_0x5925('0x6b'),_0x2992dd);if(_0x2992dd===0x1){_0x292807=_0x5925('0x6c');}throw new db[(_0x5925('0x66'))][(_0x5925('0x67'))](_0x292807);}}return;};exports[_0x5925('0x6d')]=function(_0xdb881c,_0x322423){var _0x21d9f1=_0x322423?encryptor[_0x5925('0x6e')](_0x322423)[_0x5925('0x69')](','):[];if(_0x21d9f1[_0x5925('0x6f')]===0x5){_0x21d9f1[_0x5925('0x70')](-0x1,0x1);}_0x21d9f1[_0x5925('0x71')](_0xdb881c);return encryptor['encryptString'](_0x21d9f1[_0x5925('0x72')](','));};function signJwt(_0x2ecaa9){var _0xe3d75c=BPromise[_0x5925('0x73')](jwt[_0x5925('0x74')],{'context':jwt});var _0x3f957e=_0x2ecaa9[_0x5925('0x75')]||config[_0x5925('0xb')][_0x5925('0x76')];return new BPromise(function(_0x82503,_0x4a54df){_0xe3d75c(_0x2ecaa9[_0x5925('0x77')],_0x3f957e,_0x2ecaa9['options'])[_0x5925('0x35')](function(_0x420c1e){_0x82503(_0x420c1e);})[_0x5925('0x43')](function(_0x17500c){_0x4a54df(_0x17500c);});});}function verifyJwt(_0x2ef627,_0x47edd0,_0x3003b3){var _0x3044ef=BPromise[_0x5925('0x73')](jwt['verify'],{'context':jwt});var _0xd6b645=_0x3003b3||config[_0x5925('0xb')][_0x5925('0x76')];return new BPromise(function(_0x35f96f,_0xb1ac8a){_0x3044ef(_0x2ef627,_0xd6b645,_0x47edd0)['then'](function(_0x5f500c){_0x35f96f(_0x5f500c);})[_0x5925('0x43')](function(_0x3e91e6){_0xb1ac8a(_0x3e91e6);});});}function generateNonce(){return crypto[_0x5925('0x78')](0x10)[_0x5925('0x79')](_0x5925('0x7a'));}function generateIssuedAt(){return Math[_0x5925('0x7b')](Date[_0x5925('0x7c')]()/0x3e8)[_0x5925('0x79')]();}function createJwt(_0x5b6711){var _0x3705fe={'payload':{'iat':_0x5b6711[_0x5925('0x7d')],'nonce':_0x5b6711[_0x5925('0x4c')]},'options':{'algorithm':_0x5925('0x7e'),'subject':_0x5b6711['id']['toString'](),'issuer':hardwareConf[_0x5925('0x47')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x3705fe)['then'](function(_0x40e892){return{'iat':_0x5b6711[_0x5925('0x7d')],'nonce':_0x5b6711['apiKeyNonce'],'token':_0x40e892};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e1e29fd..1aaf13e 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 _0x8960=['aes-256-ctr','aes192','encrypt','algorithm','join','test','getCiphers','filter','indexOf','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','unlink','createDecipher','close','encryptString','secret','utf8','base64','final','decryptString','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session'];(function(_0x66a21e,_0x102645){var _0x4fa0a4=function(_0x35ced4){while(--_0x35ced4){_0x66a21e['push'](_0x66a21e['shift']());}};_0x4fa0a4(++_0x102645);}(_0x8960,0x14d));var _0x0896=function(_0x12c5cf,_0x5765c4){_0x12c5cf=_0x12c5cf-0x0;var _0xd64153=_0x8960[_0x12c5cf];return _0xd64153;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x0896('0x0'));var _=require(_0x0896('0x1'));var config=require(_0x0896('0x2'));var logger=require(_0x0896('0x3'))(_0x0896('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0896('0x5')][_0x0896('0x6')],'algorithm':_0x0896('0x7')};const fileOptions={'algorithm':_0x0896('0x8')};if(config[_0x0896('0x9')]&&config[_0x0896('0x9')][_0x0896('0xa')]){var isSupported=isAlgorithmSupported(config[_0x0896('0x9')][_0x0896('0xa')]);if(isSupported){fileOptions['algorithm']=config[_0x0896('0x9')][_0x0896('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0896('0xb')](',\x20');logger['error'](config['encrypt'][_0x0896('0xa')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x1bdba6){return AES_SUPPORTED_RX[_0x0896('0xc')](_0x1bdba6);}function getSupportedCiphers(){return crypto[_0x0896('0xd')]()[_0x0896('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x3ae30b){return getSupportedCiphers()[_0x0896('0xf')](_0x3ae30b)>-0x1;}function combineOptions(_0x34a8be){var _0x4e4301={};for(var _0x4d43d9 in fileOptions){if(fileOptions['hasOwnProperty'](_0x4d43d9)){_0x4e4301[_0x4d43d9]=fileOptions[_0x4d43d9];}}if(_0x34a8be){for(var _0x49de8d in _0x34a8be){if(_0x34a8be['hasOwnProperty'](_0x49de8d)){_0x4e4301[_0x49de8d]=_0x34a8be[_0x49de8d];}}}return _0x4e4301;}exports[_0x0896('0x10')]=function(_0x43469a,_0x5e9690,_0x356211,_0x1e6849){return new BPromise(function(_0x45d3d2,_0x325c2a){_0x1e6849=combineOptions(_0x1e6849);var _0x31662b=new Buffer(_0x356211);var _0x3c738a=fs[_0x0896('0x11')](_0x43469a);var _0x9d4eb4=fs[_0x0896('0x12')](_0x5e9690);var _0x15e668=crypto[_0x0896('0x13')](_0x1e6849[_0x0896('0xa')],_0x31662b);_0x3c738a['on'](_0x0896('0x14'),function(_0x35a446){var _0x28261d=new Buffer(_0x15e668[_0x0896('0x15')](_0x35a446),_0x0896('0x16'));_0x9d4eb4[_0x0896('0x17')](_0x28261d);});_0x3c738a['on'](_0x0896('0x18'),function(){try{var _0x52fb51=new Buffer(_0x15e668['final']('binary'),_0x0896('0x16'));_0x9d4eb4[_0x0896('0x17')](_0x52fb51);_0x9d4eb4['end']();_0x9d4eb4['on']('close',function(){return _0x45d3d2(_0x5e9690);});}catch(_0x129947){fs[_0x0896('0x19')](_0x5e9690);return _0x325c2a(_0x129947);}});});};exports['decryptFile']=function(_0x5c1503,_0xff891d,_0x52d0a0,_0x5c7ce0){return new BPromise(function(_0x46f84c,_0x2e8d76){_0x5c7ce0=combineOptions(_0x5c7ce0);var _0x5e5a1e=new Buffer(_0x52d0a0);var _0x1e04d7=fs[_0x0896('0x11')](_0x5c1503);var _0x163e3a=fs[_0x0896('0x12')](_0xff891d);var _0x515583=crypto[_0x0896('0x1a')](_0x5c7ce0[_0x0896('0xa')],_0x5e5a1e);_0x1e04d7['on']('data',function(_0x3a2809){var _0x3267bd=new Buffer(_0x515583[_0x0896('0x15')](_0x3a2809),'binary');_0x163e3a[_0x0896('0x17')](_0x3267bd);});_0x1e04d7['on'](_0x0896('0x18'),function(){try{var _0x4271e6=new Buffer(_0x515583['final'](_0x0896('0x16')),'binary');_0x163e3a[_0x0896('0x17')](_0x4271e6);_0x163e3a[_0x0896('0x18')]();_0x163e3a['on'](_0x0896('0x1b'),function(){return _0x46f84c(_0xff891d);});}catch(_0x1c5054){fs[_0x0896('0x19')](_0xff891d);return _0x2e8d76(_0x1c5054);}});});};exports[_0x0896('0x1c')]=function(_0x18bc67,_0x3b47f7,_0x41186e){var _0x4c8beb=_0x41186e||stringOptions['algorithm'];var _0xddd00f=_0x3b47f7||stringOptions[_0x0896('0x1d')];var _0x4317c1=crypto[_0x0896('0x13')](_0x4c8beb,_0xddd00f);var _0x3a5d52=_0x4317c1[_0x0896('0x15')](_0x18bc67,_0x0896('0x1e'),_0x0896('0x1f'));_0x3a5d52+=_0x4317c1[_0x0896('0x20')]('base64');return _0x3a5d52;};exports[_0x0896('0x21')]=function(_0x2c06d0,_0x3494de,_0x510c00){var _0x5ab81f=_0x510c00||stringOptions[_0x0896('0xa')];var _0x40c05b=_0x3494de||stringOptions[_0x0896('0x1d')];var _0x3bbde5=crypto[_0x0896('0x1a')](_0x5ab81f,_0x40c05b);var _0x4f9e29=_0x3bbde5[_0x0896('0x15')](_0x2c06d0,'base64','utf8');_0x4f9e29+=_0x3bbde5[_0x0896('0x20')](_0x0896('0x1e'));return _0x4f9e29;}; \ No newline at end of file +var _0x6637=['createWriteStream','createDecipher','data','update','end','encryptString','secret','createCipher','utf8','base64','crypto','lodash','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','write','final','binary','close','unlink','decryptFile'];(function(_0x2163b8,_0x480ac2){var _0x3a9e24=function(_0xb259d2){while(--_0xb259d2){_0x2163b8['push'](_0x2163b8['shift']());}};_0x3a9e24(++_0x480ac2);}(_0x6637,0x175));var _0x7663=function(_0x2564ad,_0x156b79){_0x2564ad=_0x2564ad-0x0;var _0x1368fd=_0x6637[_0x2564ad];return _0x1368fd;};'use strict';var crypto=require(_0x7663('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x7663('0x1'));var config=require(_0x7663('0x2'));var logger=require(_0x7663('0x3'))(_0x7663('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x7663('0x5')]['session'],'algorithm':_0x7663('0x6')};const fileOptions={'algorithm':_0x7663('0x7')};if(config[_0x7663('0x8')]&&config[_0x7663('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x7663('0x8')]['algorithm']);if(isSupported){fileOptions[_0x7663('0x9')]=config[_0x7663('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x7663('0x8')][_0x7663('0x9')],_0x7663('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x2b05c0){return AES_SUPPORTED_RX[_0x7663('0xb')](_0x2b05c0);}function getSupportedCiphers(){return crypto[_0x7663('0xc')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x33ca7f){return getSupportedCiphers()[_0x7663('0xd')](_0x33ca7f)>-0x1;}function combineOptions(_0x193972){var _0xb3398c={};for(var _0x3f3159 in fileOptions){if(fileOptions['hasOwnProperty'](_0x3f3159)){_0xb3398c[_0x3f3159]=fileOptions[_0x3f3159];}}if(_0x193972){for(var _0x5ad6a6 in _0x193972){if(_0x193972[_0x7663('0xe')](_0x5ad6a6)){_0xb3398c[_0x5ad6a6]=_0x193972[_0x5ad6a6];}}}return _0xb3398c;}exports[_0x7663('0xf')]=function(_0xe95b45,_0x57cfd4,_0x5c2fe9,_0x276434){return new BPromise(function(_0x341aa0,_0x2b7061){_0x276434=combineOptions(_0x276434);var _0x36aa74=new Buffer(_0x5c2fe9);var _0x27e60b=fs[_0x7663('0x10')](_0xe95b45);var _0x193fb7=fs['createWriteStream'](_0x57cfd4);var _0x141135=crypto['createCipher'](_0x276434['algorithm'],_0x36aa74);_0x27e60b['on']('data',function(_0x37b956){var _0x46bdaf=new Buffer(_0x141135['update'](_0x37b956),'binary');_0x193fb7[_0x7663('0x11')](_0x46bdaf);});_0x27e60b['on']('end',function(){try{var _0x1f353b=new Buffer(_0x141135[_0x7663('0x12')]('binary'),_0x7663('0x13'));_0x193fb7[_0x7663('0x11')](_0x1f353b);_0x193fb7['end']();_0x193fb7['on'](_0x7663('0x14'),function(){return _0x341aa0(_0x57cfd4);});}catch(_0x9a8127){fs[_0x7663('0x15')](_0x57cfd4);return _0x2b7061(_0x9a8127);}});});};exports[_0x7663('0x16')]=function(_0x326f9a,_0x53da48,_0x155743,_0x339e88){return new BPromise(function(_0x58cc65,_0x370a04){_0x339e88=combineOptions(_0x339e88);var _0x2153f3=new Buffer(_0x155743);var _0x224a69=fs[_0x7663('0x10')](_0x326f9a);var _0x25a432=fs[_0x7663('0x17')](_0x53da48);var _0x30a645=crypto[_0x7663('0x18')](_0x339e88[_0x7663('0x9')],_0x2153f3);_0x224a69['on'](_0x7663('0x19'),function(_0x209168){var _0x39b021=new Buffer(_0x30a645[_0x7663('0x1a')](_0x209168),_0x7663('0x13'));_0x25a432['write'](_0x39b021);});_0x224a69['on'](_0x7663('0x1b'),function(){try{var _0x357b2d=new Buffer(_0x30a645['final']('binary'),_0x7663('0x13'));_0x25a432[_0x7663('0x11')](_0x357b2d);_0x25a432[_0x7663('0x1b')]();_0x25a432['on']('close',function(){return _0x58cc65(_0x53da48);});}catch(_0x421103){fs[_0x7663('0x15')](_0x53da48);return _0x370a04(_0x421103);}});});};exports[_0x7663('0x1c')]=function(_0x4649db,_0x39812e,_0x6064e9){var _0x1e109d=_0x6064e9||stringOptions[_0x7663('0x9')];var _0x497560=_0x39812e||stringOptions[_0x7663('0x1d')];var _0x2b1b80=crypto[_0x7663('0x1e')](_0x1e109d,_0x497560);var _0x1a5ab5=_0x2b1b80['update'](_0x4649db,_0x7663('0x1f'),'base64');_0x1a5ab5+=_0x2b1b80[_0x7663('0x12')](_0x7663('0x20'));return _0x1a5ab5;};exports['decryptString']=function(_0x41d5bd,_0x2eb9fc,_0x326cf3){var _0x82d80e=_0x326cf3||stringOptions[_0x7663('0x9')];var _0x4f58cd=_0x2eb9fc||stringOptions[_0x7663('0x1d')];var _0x154406=crypto[_0x7663('0x18')](_0x82d80e,_0x4f58cd);var _0x145402=_0x154406[_0x7663('0x1a')](_0x41d5bd,_0x7663('0x20'),_0x7663('0x1f'));_0x145402+=_0x154406[_0x7663('0x12')](_0x7663('0x1f'));return _0x145402;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 4b28360..91cafc5 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 _0xb62b=['update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','isInteger','forEach','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','.csv','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb62b,0x85));var _0xbb62=function(_0x5d4fa5,_0x326baa){_0x5d4fa5=_0x5d4fa5-0x0;var _0x54bd21=_0xb62b[_0x5d4fa5];return _0x54bd21;};'use strict';var util=require('util');var path=require('path');var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xbb62('0x0'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0xbb62('0x1'))['db'];var dbH=require('../../mysqldb')[_0xbb62('0x2')];var logger=require(_0xbb62('0x3'))(_0xbb62('0x4'));var EXTRACTED_REPORT_ID=Number(process[_0xbb62('0x5')][0x2]);var QUERY=process[_0xbb62('0x5')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x23b871,_0x4ee4cd){var _0x3ecc07={'status':_0x23b871};var _0x2e7ede={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4ee4cd){_0x3ecc07[_0xbb62('0x6')]=_0x4ee4cd;}return db[_0xbb62('0x7')][_0xbb62('0x8')](_0x3ecc07,_0x2e7ede);}function main(){var _0x5da523=0x1388;var _0x578a09;logger[_0xbb62('0x9')](util['format'](_0xbb62('0xa'),EXTRACTED_REPORT_ID,_0xbb62('0xb')));return db[_0xbb62('0xc')][_0xbb62('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb62('0xe'),'splitSizeCsv']})[_0xbb62('0xf')](function(_0x1b4a2d){if(_0x1b4a2d){_0x578a09=_0x1b4a2d;_0x5da523=_0x578a09[_0xbb62('0x10')]||0x1388;}})[_0xbb62('0xf')](function(){return dbH['sequelize']['query'](util[_0xbb62('0x11')](_0xbb62('0x12'),QUERY),{'type':dbH['sequelize'][_0xbb62('0x13')][_0xbb62('0x14')]});})[_0xbb62('0xf')](function(_0x4f659d){if(!_0x4f659d[0x0][_0xbb62('0x15')]){return analyticExtractedReport(_0xbb62('0x16'));}var _0xd9dd74=[];var _0x5160e6=0x0;if(_0x578a09[_0xbb62('0xe')]){if(_0x4f659d&&_0x4f659d[_0xbb62('0x17')]){var _0x5868fc=_['range'](_0x4f659d[0x0]['num']/_0x5da523);var _0x3316ae=Number[_0xbb62('0x18')](_0x4f659d[0x0][_0xbb62('0x15')]/_0x5da523)?_0x4f659d[0x0][_0xbb62('0x15')]%_0x5da523:0x0;_0x5868fc[_0xbb62('0x19')](function(_0x849174){if(_0x849174>0x0){_0x5160e6+=_0x5da523;}_0xd9dd74[_0xbb62('0x1a')](dbH[_0xbb62('0x1b')]['query'](util[_0xbb62('0x11')](_0xbb62('0x1c'),QUERY,_0x5da523,_0x5160e6),{'type':dbH[_0xbb62('0x1b')][_0xbb62('0x13')][_0xbb62('0x14')]}));});if(_0x3316ae>0x0){_0x5160e6+=_0x5da523;_0xd9dd74[_0xbb62('0x1a')](dbH['sequelize'][_0xbb62('0x1d')](util[_0xbb62('0x11')](_0xbb62('0x1c'),QUERY,_0x3316ae,_0x5160e6),{'type':dbH[_0xbb62('0x1b')][_0xbb62('0x13')][_0xbb62('0x14')]}));}}}else{_0xd9dd74[_0xbb62('0x1a')](dbH[_0xbb62('0x1b')]['query'](QUERY,{'type':dbH[_0xbb62('0x1b')][_0xbb62('0x13')]['SELECT']}));}var _0x70fed9=path[_0xbb62('0x1e')](PATH);var _0x5f4cb8=path['basename'](PATH,_0xbb62('0x1f'));var _0x56e62b=_0x578a09[_0xbb62('0xe')]&&_0xd9dd74[_0xbb62('0x17')]>0x1;var _0x4b0dd8=[];if(!fs['existsSync'](path[_0xbb62('0x20')](_0x70fed9,_0x5f4cb8))&&_0x56e62b){fs[_0xbb62('0x21')](path[_0xbb62('0x20')](_0x70fed9,_0x5f4cb8));}return BPromise[_0xbb62('0x22')](_0xd9dd74,function(_0x2410e5){_0x4b0dd8['push'](_0x2410e5);})['then'](function(){for(var _0x5bdbc1=0x0;_0x5bdbc1<_0x4b0dd8[_0xbb62('0x17')];_0x5bdbc1+=0x1){var _0x4d7499;var _0x3bc50f=_0x4b0dd8[_0x5bdbc1];if(_0x56e62b){_0x4d7499=path[_0xbb62('0x20')](_0x70fed9,_0x5f4cb8,util[_0xbb62('0x11')](_0xbb62('0x23'),_0x5f4cb8,_0x5bdbc1,_0xbb62('0x24')));}else{_0x4d7499=path[_0xbb62('0x20')](_0x70fed9,util[_0xbb62('0x11')](_0xbb62('0x25'),_0x5f4cb8,_0xbb62('0x24')));}fs[_0xbb62('0x26')](_0x4d7499,csv(_0x3bc50f));}})[_0xbb62('0xf')](function(){if(_0x56e62b){return new Promise(function(_0x109fa6){zipdir(path[_0xbb62('0x20')](_0x70fed9,_0x5f4cb8),{'saveTo':path['join'](_0x70fed9,util[_0xbb62('0x11')](_0xbb62('0x25'),_0x5f4cb8,_0xbb62('0x27')))},function(_0x37d748,_0x4d75f0){rimraf(path[_0xbb62('0x20')](_0x70fed9,_0x5f4cb8),function(){});_0x109fa6(_0xbb62('0x28'));});});}})['then'](function(){logger[_0xbb62('0x9')](util[_0xbb62('0x11')](_0xbb62('0x29'),EXTRACTED_REPORT_ID,_0xbb62('0xb')));return analyticExtractedReport('Completed',_0x56e62b?util['format'](_0xbb62('0x25'),_0x5f4cb8,_0x56e62b?_0xbb62('0x27'):'csv'):null);});})[_0xbb62('0x2a')](function(_0x2b539e){logger[_0xbb62('0x9')](util['format'](_0xbb62('0x2b'),EXTRACTED_REPORT_ID,_0xbb62('0xb')),util[_0xbb62('0x2c')](_0x2b539e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbb62('0x2d'));})[_0xbb62('0x2e')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0a9f=['path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','isInteger','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.csv','length','existsSync','mkdirSync','each','join','csv','%s.%s','writeFileSync','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','util'];(function(_0x6c3c1c,_0xa37255){var _0xd73cb6=function(_0x3f6e8b){while(--_0x3f6e8b){_0x6c3c1c['push'](_0x6c3c1c['shift']());}};_0xd73cb6(++_0xa37255);}(_0x0a9f,0x16f));var _0xf0a9=function(_0x5773e7,_0x435e69){_0x5773e7=_0x5773e7-0x0;var _0x5e6621=_0x0a9f[_0x5773e7];return _0x5e6621;};'use strict';var util=require(_0xf0a9('0x0'));var path=require(_0xf0a9('0x1'));var _=require(_0xf0a9('0x2'));var csv=require(_0xf0a9('0x3'));var fs=require('fs');var BPromise=require(_0xf0a9('0x4'));var zipdir=require(_0xf0a9('0x5'));var rimraf=require(_0xf0a9('0x6'));var db=require(_0xf0a9('0x7'))['db'];var dbH=require(_0xf0a9('0x7'))['dbH'];var logger=require(_0xf0a9('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xf0a9('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2f5140,_0x1d4163){var _0x40410e={'status':_0x2f5140};var _0x2c8342={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1d4163){_0x40410e['savename']=_0x1d4163;}return db[_0xf0a9('0xa')][_0xf0a9('0xb')](_0x40410e,_0x2c8342);}function main(){var _0x23e2e4=0x1388;var _0x151e91;logger[_0xf0a9('0xc')](util[_0xf0a9('0xd')](_0xf0a9('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xf0a9('0xf')][_0xf0a9('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf0a9('0x11'),_0xf0a9('0x12')]})[_0xf0a9('0x13')](function(_0x7d3cb5){if(_0x7d3cb5){_0x151e91=_0x7d3cb5;_0x23e2e4=_0x151e91[_0xf0a9('0x12')]||0x1388;}})[_0xf0a9('0x13')](function(){return dbH[_0xf0a9('0x14')]['query'](util['format'](_0xf0a9('0x15'),QUERY),{'type':dbH['sequelize'][_0xf0a9('0x16')]['SELECT']});})[_0xf0a9('0x13')](function(_0x3d97f0){if(!_0x3d97f0[0x0]['num']){return analyticExtractedReport(_0xf0a9('0x17'));}var _0x214a31=[];var _0x7adc52=0x0;if(_0x151e91[_0xf0a9('0x11')]){if(_0x3d97f0&&_0x3d97f0['length']){var _0x3c1cf9=_['range'](_0x3d97f0[0x0]['num']/_0x23e2e4);var _0xb1c4cd=Number[_0xf0a9('0x18')](_0x3d97f0[0x0]['num']/_0x23e2e4)?_0x3d97f0[0x0][_0xf0a9('0x19')]%_0x23e2e4:0x0;_0x3c1cf9['forEach'](function(_0x27d478){if(_0x27d478>0x0){_0x7adc52+=_0x23e2e4;}_0x214a31[_0xf0a9('0x1a')](dbH[_0xf0a9('0x14')]['query'](util[_0xf0a9('0xd')](_0xf0a9('0x1b'),QUERY,_0x23e2e4,_0x7adc52),{'type':dbH[_0xf0a9('0x14')][_0xf0a9('0x16')][_0xf0a9('0x1c')]}));});if(_0xb1c4cd>0x0){_0x7adc52+=_0x23e2e4;_0x214a31[_0xf0a9('0x1a')](dbH[_0xf0a9('0x14')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xb1c4cd,_0x7adc52),{'type':dbH[_0xf0a9('0x14')][_0xf0a9('0x16')][_0xf0a9('0x1c')]}));}}}else{_0x214a31[_0xf0a9('0x1a')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xf0a9('0x14')][_0xf0a9('0x16')]['SELECT']}));}var _0x2b9f86=path['dirname'](PATH);var _0x5ad0ae=path[_0xf0a9('0x1d')](PATH,_0xf0a9('0x1e'));var _0x2ea904=_0x151e91[_0xf0a9('0x11')]&&_0x214a31[_0xf0a9('0x1f')]>0x1;var _0x44aa97=[];if(!fs[_0xf0a9('0x20')](path['join'](_0x2b9f86,_0x5ad0ae))&&_0x2ea904){fs[_0xf0a9('0x21')](path['join'](_0x2b9f86,_0x5ad0ae));}return BPromise[_0xf0a9('0x22')](_0x214a31,function(_0x4e167a){_0x44aa97[_0xf0a9('0x1a')](_0x4e167a);})[_0xf0a9('0x13')](function(){for(var _0x263e2a=0x0;_0x263e2a<_0x44aa97[_0xf0a9('0x1f')];_0x263e2a+=0x1){var _0x3526c7;var _0x4d2650=_0x44aa97[_0x263e2a];if(_0x2ea904){_0x3526c7=path[_0xf0a9('0x23')](_0x2b9f86,_0x5ad0ae,util['format']('%s%d.%s',_0x5ad0ae,_0x263e2a,_0xf0a9('0x24')));}else{_0x3526c7=path[_0xf0a9('0x23')](_0x2b9f86,util[_0xf0a9('0xd')](_0xf0a9('0x25'),_0x5ad0ae,_0xf0a9('0x24')));}fs[_0xf0a9('0x26')](_0x3526c7,csv(_0x4d2650));}})[_0xf0a9('0x13')](function(){if(_0x2ea904){return new Promise(function(_0x51a19f){zipdir(path[_0xf0a9('0x23')](_0x2b9f86,_0x5ad0ae),{'saveTo':path[_0xf0a9('0x23')](_0x2b9f86,util[_0xf0a9('0xd')](_0xf0a9('0x25'),_0x5ad0ae,_0xf0a9('0x27')))},function(_0x28a624,_0xa66b2e){rimraf(path['join'](_0x2b9f86,_0x5ad0ae),function(){});_0x51a19f(_0xf0a9('0x28'));});});}})[_0xf0a9('0x13')](function(){logger['info'](util[_0xf0a9('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xf0a9('0x29'),_0x2ea904?util[_0xf0a9('0xd')]('%s.%s',_0x5ad0ae,_0x2ea904?_0xf0a9('0x27'):_0xf0a9('0x24')):null);});})[_0xf0a9('0x2a')](function(_0x438300){logger[_0xf0a9('0xc')](util['format'](_0xf0a9('0x2b'),EXTRACTED_REPORT_ID,'CSV'),util[_0xf0a9('0x2c')](_0x438300,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xf0a9('0x2d')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 5becd41..2b7cfcb 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 _0xfc19=['%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','error','createPdfFromHTML','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','toString','value','fill','length','body','concat','keys','forEach','push','format','name','startDate','endDate','header','pageBreak','before','margin','\x20/\x20','footer','Arial','right','num','Empty','Setting','find','splitSizePdf','then','split','range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','SELECT','query','QueryTypes','.pdf','existsSync','join','each','flatten','pdf'];(function(_0x1940b6,_0x473d6f){var _0x7cdb91=function(_0x152a99){while(--_0x152a99){_0x1940b6['push'](_0x1940b6['shift']());}};_0x7cdb91(++_0x473d6f);}(_0xfc19,0x1d3));var _0x9fc1=function(_0x46b968,_0xc65e97){_0x46b968=_0x46b968-0x0;var _0x3044d0=_0xfc19[_0x46b968];return _0x3044d0;};'use strict';var _=require(_0x9fc1('0x0'));var fs=require('fs');var util=require(_0x9fc1('0x1'));var path=require(_0x9fc1('0x2'));var moment=require(_0x9fc1('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x9fc1('0x4'));var zipdir=require(_0x9fc1('0x5'));var rimraf=require(_0x9fc1('0x6'));var JSDOM=require(_0x9fc1('0x7'))[_0x9fc1('0x8')];var window=new JSDOM('')[_0x9fc1('0x9')];var BPromise=require(_0x9fc1('0xa'));var db=require(_0x9fc1('0xb'))['db'];var dbH=require('../../mysqldb')[_0x9fc1('0xc')];var logger=require(_0x9fc1('0xd'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x9fc1('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x9fc1('0xe')][0x4];var NAME=process[_0x9fc1('0xe')][0x5];var FORMAT=_0x9fc1('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x172cb3,_0xca0b4e){var _0x11fe44={'status':_0x172cb3};var _0x4fdce4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xca0b4e){_0x11fe44[_0x9fc1('0x10')]=_0xca0b4e;}return db[_0x9fc1('0x11')][_0x9fc1('0x12')](_0x11fe44,_0x4fdce4);}function getHeaders(_0x161384){return _[_0x9fc1('0x13')](_0x161384,function(_0x4c528a){return{'text':_0x4c528a,'style':'tableHeader'};});}function getRows(_0x327878,_0x3cb4dc){return _[_0x9fc1('0x13')](_0x3cb4dc,function(_0x118fc5){return _(_0x118fc5)['pick'](_0x327878)[_0x9fc1('0x13')](function(_0x397a92){return _0x397a92?_[_0x9fc1('0x14')](_0x397a92):'';})[_0x9fc1('0x15')]();});}function createTable(_0x40a149,_0x298cac){var _0x36a98c={'widths':_[_0x9fc1('0x16')](Array(_0x40a149[_0x9fc1('0x17')]),0x91),'heights':function(_0x11eda7){return _0x11eda7===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x39ff0f=getHeaders(_0x40a149);_0x36a98c[_0x9fc1('0x18')]['push'](_0x39ff0f);var _0x4ac996=getRows(_0x40a149,_0x298cac);_0x36a98c['body']=_0x36a98c[_0x9fc1('0x18')][_0x9fc1('0x19')](_0x4ac996);return _0x36a98c;}function createTables(_0x3df938){var _0x141651=[];var _0x5d924b=_['chunk'](Object[_0x9fc1('0x1a')](_0x3df938[0x0]),0x5);_0x5d924b[_0x9fc1('0x1b')](function(_0x24e299){_0x141651[_0x9fc1('0x1c')](createTable(_0x24e299,_0x3df938));});return _0x141651;}function getPDFDocDefinition(_0x58e786){var _0x2cb90c=util[_0x9fc1('0x1d')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x9fc1('0x1e')],moment(EXTRACTED_REPORT[_0x9fc1('0x1f')])[_0x9fc1('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x9fc1('0x20')])[_0x9fc1('0x1d')](FORMAT));var _0x43b372=[];for(var _0x42187f=0x0;_0x42187f<_0x58e786[_0x9fc1('0x17')];_0x42187f++){var _0x41e85f=[];if(_0x42187f===0x0){_0x41e85f['push']({'text':_0x2cb90c,'style':_0x9fc1('0x21')});}var _0x33d09d={'table':_0x58e786[_0x42187f]};if(_0x42187f>0x0){_0x33d09d[_0x9fc1('0x22')]=_0x9fc1('0x23');_0x33d09d[_0x9fc1('0x24')]=[0x0,0x46,0x0,0x0];}_0x41e85f[_0x9fc1('0x1c')](_0x33d09d);_0x43b372[_0x9fc1('0x1c')](_0x41e85f);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x43b372,'footer':function(_0x42ac5a,_0x301970){return{'text':_0x42ac5a[_0x9fc1('0x14')]()+_0x9fc1('0x25')+_0x301970,'style':_0x9fc1('0x26')};},'defaultStyle':{'font':_0x9fc1('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x9fc1('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1c6507){var _0x249411=0x1388;var _0xe157b2;if(!_0x1c6507[0x0][_0x9fc1('0x29')]){return analyticExtractedReport(_0x9fc1('0x2a'));}return db[_0x9fc1('0x2b')][_0x9fc1('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x9fc1('0x2d')]})[_0x9fc1('0x2e')](function(_0x5437b2){if(_0x5437b2){_0xe157b2=_0x5437b2;_0x249411=_0xe157b2[_0x9fc1('0x2d')]||0x3e8;}})[_0x9fc1('0x2e')](function(){var _0x359e75=[];var _0x201245=0x0;if(_0xe157b2[_0x9fc1('0x2f')]){if(_0x1c6507&&_0x1c6507[_0x9fc1('0x17')]){var _0x3ff315=_[_0x9fc1('0x30')](_0x1c6507[0x0][_0x9fc1('0x29')]/_0x249411);var _0x3eaced=Number[_0x9fc1('0x31')](_0x1c6507[0x0][_0x9fc1('0x29')]/_0x249411)?_0x1c6507[0x0][_0x9fc1('0x29')]%_0x249411:0x0;_0x3ff315[_0x9fc1('0x1b')](function(_0x15cb88){if(_0x15cb88>0x0){_0x201245+=_0x249411;}_0x359e75['push'](dbH['sequelize']['query'](util['format'](_0x9fc1('0x32'),QUERY,_0x249411,_0x201245),{'type':dbH[_0x9fc1('0x33')]['QueryTypes'][_0x9fc1('0x34')]}));});if(_0x3eaced>0x0){_0x201245+=_0x249411;_0x359e75[_0x9fc1('0x1c')](dbH[_0x9fc1('0x33')][_0x9fc1('0x35')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3eaced,_0x201245),{'type':dbH['sequelize']['QueryTypes'][_0x9fc1('0x34')]}));}}}else{_0x359e75[_0x9fc1('0x1c')](dbH[_0x9fc1('0x33')]['query'](QUERY,{'type':dbH[_0x9fc1('0x33')][_0x9fc1('0x36')][_0x9fc1('0x34')]}));}var _0x236a59=path['dirname'](PATH);var _0x1e3269=path['basename'](PATH,_0x9fc1('0x37'));var _0x434a93=_0xe157b2[_0x9fc1('0x2f')]&&_0x359e75['length']>0x1;var _0xb9dbef=[];if(!fs[_0x9fc1('0x38')](path[_0x9fc1('0x39')](_0x236a59,_0x1e3269))&&_0x434a93){fs['mkdirSync'](path['join'](_0x236a59,_0x1e3269));}return BPromise[_0x9fc1('0x3a')](_0x359e75,function(_0x35737e){_0xb9dbef[_0x9fc1('0x1c')](_0x35737e);})['then'](function(){var _0x3ae226=[];for(var _0x7f85c4=0x0;_0x7f85c4<_0xb9dbef['length'];_0x7f85c4+=0x1){var _0x1719bc=_0xb9dbef[_0x7f85c4];var _0x2c7abb=createTables(_[_0x9fc1('0x3b')](_0x1719bc));var _0x21c117;var _0x5102e8=getPDFDocDefinition(_0x2c7abb);var _0x18c219=getPDFPrinter();var _0x378a0c=_0x18c219['createPdfKitDocument'](_0x5102e8);if(_0x434a93){_0x21c117=path['join'](_0x236a59,_0x1e3269,util['format']('%s%d.%s',_0x1e3269,_0x7f85c4,_0x9fc1('0x3c')));}else{_0x21c117=path[_0x9fc1('0x39')](_0x236a59,util['format'](_0x9fc1('0x3d'),_0x1e3269,'pdf'));}_0x3ae226[_0x9fc1('0x1c')](writePDFDocument(_0x378a0c,_0x21c117));}return Promise['all'](_0x3ae226);})[_0x9fc1('0x2e')](function(){if(_0x434a93){return new Promise(function(_0x1a9034){zipdir(path[_0x9fc1('0x39')](_0x236a59,_0x1e3269),{'saveTo':path['join'](_0x236a59,util[_0x9fc1('0x1d')]('%s.%s',_0x1e3269,_0x9fc1('0x3e')))},function(){rimraf(path[_0x9fc1('0x39')](_0x236a59,_0x1e3269),function(){});_0x1a9034('zip\x20finished');});});}})[_0x9fc1('0x2e')](function(){if(!_0x434a93)return;rimraf(path['join'](_0x236a59,_0x1e3269),function(){});})[_0x9fc1('0x2e')](function(){logger[_0x9fc1('0x3f')](util[_0x9fc1('0x1d')](_0x9fc1('0x40'),EXTRACTED_REPORT_ID,_0x9fc1('0x41')));return analyticExtractedReport(_0x9fc1('0x42'),_0x434a93?util[_0x9fc1('0x1d')](_0x9fc1('0x3d'),_0x1e3269,_0x434a93?'zip':_0x9fc1('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x9fc1('0x1d')](_0x9fc1('0x43'),EXTRACTED_REPORT_ID,_0x9fc1('0x41')));return db[_0x9fc1('0x11')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x9fc1('0x2e')](function(_0x5ae0d1){EXTRACTED_REPORT=_0x5ae0d1;return dbH['sequelize'][_0x9fc1('0x35')](util[_0x9fc1('0x1d')](_0x9fc1('0x44'),QUERY),{'type':dbH['sequelize'][_0x9fc1('0x36')][_0x9fc1('0x34')]});})['then'](extractReport)[_0x9fc1('0x45')](function(_0x54a755){logger['info'](util[_0x9fc1('0x1d')](_0x9fc1('0x46'),EXTRACTED_REPORT_ID,_0x9fc1('0x41')),util[_0x9fc1('0x47')](_0x54a755,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9fc1('0x48'));})[_0x9fc1('0x49')](function(){process[_0x9fc1('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x69e6f0=new PdfPrinter({'Arial':{'normal':__dirname+_0x9fc1('0x4b'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x9fc1('0x4c'),'bolditalics':__dirname+_0x9fc1('0x4d')}});return _0x69e6f0;}function getPDFDocDefinitionFromHTML(_0x1e9c5e,_0x35aaf1){var _0x1e13fb=util[_0x9fc1('0x1d')](_0x9fc1('0x4e'),_0x35aaf1[_0x9fc1('0x4f')],_0x35aaf1[_0x9fc1('0x50')]);var _0xe89fee=moment()[_0x9fc1('0x1d')](_0x9fc1('0x51'))[_0x9fc1('0x14')]();var _0x80085=htmlToPdfmake(_0x1e9c5e,{'window':window,'tableAutoSize':!![]});return{'content':[_0x80085],'defaultStyle':{'font':_0x9fc1('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x9fc1('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x9fc1('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x9fc1('0x52')}},'header':function(){return[{'text':_0x9fc1('0x53'),'style':_0x9fc1('0x21')}];},'footer':function(_0x35e8ea,_0x293a71){return[{'text':util[_0x9fc1('0x1d')](_0x9fc1('0x54'),_0x1e13fb,_0x35e8ea,_0x293a71,_0xe89fee),'style':'footer'}];}};}function writePDFDocument(_0x507336,_0x5ec0be){return new Promise(function(_0x4500ea,_0x2063ee){var _0x2fec78=_0x507336['pipe'](fs['createWriteStream'](_0x5ec0be));_0x2fec78['on']('finish',function(){_0x4500ea(_0x9fc1('0x55'));});_0x2fec78['on'](_0x9fc1('0x56'),function(_0x365ec2){_0x2063ee(_0x365ec2);});_0x507336['end']();});}exports[_0x9fc1('0x57')]=function(_0x4d5259,_0x790b9b){var _0x1759ff=getPDFPrinter();var _0x4a1024=getPDFDocDefinitionFromHTML(_0x4d5259,_0x790b9b);var _0x2c60c2=_0x1759ff['createPdfKitDocument'](_0x4a1024);return writePDFDocument(_0x2c60c2,_0x790b9b[_0x9fc1('0x2')])[_0x9fc1('0x45')](function(_0x343d24){throw _0x343d24;});}; \ No newline at end of file +var _0x8162=['createPdfKitDocument','%s%d.%s','pdf','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-bold.ttf','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','lodash','util','path','moment','html-to-pdfmake','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','value','fill','auto','body','concat','chunk','keys','forEach','push','format','startDate','endDate','length','header','pageBreak','before','margin','landscape','\x20/\x20','black','right','Setting','split','then','splitSizePdf','range','isInteger','num','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','existsSync','mkdirSync','join','each','flatten'];(function(_0x1943ac,_0x34a4f7){var _0x1da2fa=function(_0x4dbfff){while(--_0x4dbfff){_0x1943ac['push'](_0x1943ac['shift']());}};_0x1da2fa(++_0x34a4f7);}(_0x8162,0xcd));var _0x2816=function(_0x1f79c9,_0x21021b){_0x1f79c9=_0x1f79c9-0x0;var _0x1cfcf9=_0x8162[_0x1f79c9];return _0x1cfcf9;};'use strict';var _=require(_0x2816('0x0'));var fs=require('fs');var util=require(_0x2816('0x1'));var path=require(_0x2816('0x2'));var moment=require(_0x2816('0x3'));var htmlToPdfmake=require(_0x2816('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x2816('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x2816('0x6'))[_0x2816('0x7')];var window=new JSDOM('')[_0x2816('0x8')];var BPromise=require(_0x2816('0x9'));var db=require(_0x2816('0xa'))['db'];var dbH=require(_0x2816('0xa'))[_0x2816('0xb')];var logger=require('../../config/logger')(_0x2816('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x2816('0xd')][0x2]);var QUERY=process[_0x2816('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x2816('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x374f4d,_0x5cbed0){var _0x4890a1={'status':_0x374f4d};var _0xac699c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5cbed0){_0x4890a1[_0x2816('0xf')]=_0x5cbed0;}return db[_0x2816('0x10')][_0x2816('0x11')](_0x4890a1,_0xac699c);}function getHeaders(_0x4bb8ca){return _[_0x2816('0x12')](_0x4bb8ca,function(_0x1871c4){return{'text':_0x1871c4,'style':_0x2816('0x13')};});}function getRows(_0x5a7d1f,_0x203af6){return _[_0x2816('0x12')](_0x203af6,function(_0x5defba){return _(_0x5defba)['pick'](_0x5a7d1f)['map'](function(_0x1505aa){return _0x1505aa?_['toString'](_0x1505aa):'';})[_0x2816('0x14')]();});}function createTable(_0x41d31a,_0x463f0f){var _0x8cecdf={'widths':_[_0x2816('0x15')](Array(_0x41d31a['length']),0x91),'heights':function(_0x3f60e9){return _0x3f60e9===0x0?_0x2816('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1d5c81=getHeaders(_0x41d31a);_0x8cecdf[_0x2816('0x17')]['push'](_0x1d5c81);var _0x58f5fa=getRows(_0x41d31a,_0x463f0f);_0x8cecdf[_0x2816('0x17')]=_0x8cecdf[_0x2816('0x17')][_0x2816('0x18')](_0x58f5fa);return _0x8cecdf;}function createTables(_0x2633f4){var _0x5c8cc5=[];var _0x219bda=_[_0x2816('0x19')](Object[_0x2816('0x1a')](_0x2633f4[0x0]),0x5);_0x219bda[_0x2816('0x1b')](function(_0x521356){_0x5c8cc5[_0x2816('0x1c')](createTable(_0x521356,_0x2633f4));});return _0x5c8cc5;}function getPDFDocDefinition(_0x6fb369){var _0x3f65ab=util[_0x2816('0x1d')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x2816('0x1e')])[_0x2816('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x2816('0x1f')])[_0x2816('0x1d')](FORMAT));var _0x4b2ee2=[];for(var _0x383925=0x0;_0x383925<_0x6fb369[_0x2816('0x20')];_0x383925++){var _0x58d154=[];if(_0x383925===0x0){_0x58d154[_0x2816('0x1c')]({'text':_0x3f65ab,'style':_0x2816('0x21')});}var _0x31ca94={'table':_0x6fb369[_0x383925]};if(_0x383925>0x0){_0x31ca94[_0x2816('0x22')]=_0x2816('0x23');_0x31ca94[_0x2816('0x24')]=[0x0,0x46,0x0,0x0];}_0x58d154['push'](_0x31ca94);_0x4b2ee2['push'](_0x58d154);}return{'pageSize':'A4','pageOrientation':_0x2816('0x25'),'content':_0x4b2ee2,'footer':function(_0xb012e6,_0x4b8329){return{'text':_0xb012e6['toString']()+_0x2816('0x26')+_0x4b8329,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x2816('0x27')},'footer':{'alignment':_0x2816('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x10602c){var _0xa5f230=0x1388;var _0x32f657;if(!_0x10602c[0x0]['num']){return analyticExtractedReport('Empty');}return db[_0x2816('0x29')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2816('0x2a'),'splitSizePdf']})[_0x2816('0x2b')](function(_0x14a54b){if(_0x14a54b){_0x32f657=_0x14a54b;_0xa5f230=_0x32f657[_0x2816('0x2c')]||0x3e8;}})['then'](function(){var _0x197f30=[];var _0x16484f=0x0;if(_0x32f657[_0x2816('0x2a')]){if(_0x10602c&&_0x10602c[_0x2816('0x20')]){var _0x44be2e=_[_0x2816('0x2d')](_0x10602c[0x0]['num']/_0xa5f230);var _0x2c7a1d=Number[_0x2816('0x2e')](_0x10602c[0x0]['num']/_0xa5f230)?_0x10602c[0x0][_0x2816('0x2f')]%_0xa5f230:0x0;_0x44be2e[_0x2816('0x1b')](function(_0x2eb0ac){if(_0x2eb0ac>0x0){_0x16484f+=_0xa5f230;}_0x197f30['push'](dbH[_0x2816('0x30')][_0x2816('0x31')](util[_0x2816('0x1d')](_0x2816('0x32'),QUERY,_0xa5f230,_0x16484f),{'type':dbH[_0x2816('0x30')][_0x2816('0x33')][_0x2816('0x34')]}));});if(_0x2c7a1d>0x0){_0x16484f+=_0xa5f230;_0x197f30[_0x2816('0x1c')](dbH['sequelize'][_0x2816('0x31')](util[_0x2816('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2c7a1d,_0x16484f),{'type':dbH[_0x2816('0x30')][_0x2816('0x33')][_0x2816('0x34')]}));}}}else{_0x197f30['push'](dbH[_0x2816('0x30')][_0x2816('0x31')](QUERY,{'type':dbH['sequelize'][_0x2816('0x33')][_0x2816('0x34')]}));}var _0x1d118a=path['dirname'](PATH);var _0x1e918f=path[_0x2816('0x35')](PATH,'.pdf');var _0x1dc520=_0x32f657[_0x2816('0x2a')]&&_0x197f30[_0x2816('0x20')]>0x1;var _0x2a742d=[];if(!fs[_0x2816('0x36')](path['join'](_0x1d118a,_0x1e918f))&&_0x1dc520){fs[_0x2816('0x37')](path[_0x2816('0x38')](_0x1d118a,_0x1e918f));}return BPromise[_0x2816('0x39')](_0x197f30,function(_0x120483){_0x2a742d[_0x2816('0x1c')](_0x120483);})[_0x2816('0x2b')](function(){var _0x3b9bdd=[];for(var _0x50d099=0x0;_0x50d099<_0x2a742d[_0x2816('0x20')];_0x50d099+=0x1){var _0x113f75=_0x2a742d[_0x50d099];var _0x4e884d=createTables(_[_0x2816('0x3a')](_0x113f75));var _0x10faac;var _0x4e7894=getPDFDocDefinition(_0x4e884d);var _0x394dec=getPDFPrinter();var _0x5d9e4a=_0x394dec[_0x2816('0x3b')](_0x4e7894);if(_0x1dc520){_0x10faac=path[_0x2816('0x38')](_0x1d118a,_0x1e918f,util[_0x2816('0x1d')](_0x2816('0x3c'),_0x1e918f,_0x50d099,_0x2816('0x3d')));}else{_0x10faac=path[_0x2816('0x38')](_0x1d118a,util[_0x2816('0x1d')]('%s.%s',_0x1e918f,_0x2816('0x3d')));}_0x3b9bdd[_0x2816('0x1c')](writePDFDocument(_0x5d9e4a,_0x10faac));}return Promise['all'](_0x3b9bdd);})['then'](function(){if(_0x1dc520){return new Promise(function(_0x5b4b11){zipdir(path[_0x2816('0x38')](_0x1d118a,_0x1e918f),{'saveTo':path[_0x2816('0x38')](_0x1d118a,util[_0x2816('0x1d')]('%s.%s',_0x1e918f,_0x2816('0x3e')))},function(){rimraf(path[_0x2816('0x38')](_0x1d118a,_0x1e918f),function(){});_0x5b4b11('zip\x20finished');});});}})[_0x2816('0x2b')](function(){if(!_0x1dc520)return;rimraf(path[_0x2816('0x38')](_0x1d118a,_0x1e918f),function(){});})['then'](function(){logger[_0x2816('0x3f')](util[_0x2816('0x1d')](_0x2816('0x40'),EXTRACTED_REPORT_ID,_0x2816('0x41')));return analyticExtractedReport(_0x2816('0x42'),_0x1dc520?util['format']('%s.%s',_0x1e918f,_0x1dc520?_0x2816('0x3e'):_0x2816('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x2816('0x3f')](util[_0x2816('0x1d')](_0x2816('0x43'),EXTRACTED_REPORT_ID,_0x2816('0x41')));return db[_0x2816('0x10')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x2816('0x2b')](function(_0x34898a){EXTRACTED_REPORT=_0x34898a;return dbH['sequelize'][_0x2816('0x31')](util[_0x2816('0x1d')](_0x2816('0x44'),QUERY),{'type':dbH[_0x2816('0x30')]['QueryTypes'][_0x2816('0x34')]});})[_0x2816('0x2b')](extractReport)[_0x2816('0x45')](function(_0x42319e){logger['info'](util[_0x2816('0x1d')](_0x2816('0x46'),EXTRACTED_REPORT_ID,'PDF'),util[_0x2816('0x47')](_0x42319e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2816('0x48'));})[_0x2816('0x49')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x127b86=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x2816('0x4a'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x127b86;}function getPDFDocDefinitionFromHTML(_0x5e4e13,_0x2d1267){var _0x770a5f=util['format']('%s\x20#%d',_0x2d1267[_0x2816('0x4b')],_0x2d1267[_0x2816('0x4c')]);var _0x29e08d=moment()[_0x2816('0x1d')](_0x2816('0x4d'))['toString']();var _0x4af67f=htmlToPdfmake(_0x5e4e13,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4af67f],'defaultStyle':{'font':_0x2816('0x4e')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x2816('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x2816('0x4f')}},'header':function(){return[{'text':_0x2816('0x50'),'style':_0x2816('0x21')}];},'footer':function(_0x298ca3,_0x42b99d){return[{'text':util[_0x2816('0x1d')](_0x2816('0x51'),_0x770a5f,_0x298ca3,_0x42b99d,_0x29e08d),'style':_0x2816('0x52')}];}};}function writePDFDocument(_0x552651,_0x590bf5){return new Promise(function(_0xd2bc00,_0x28887c){var _0x31b95e=_0x552651[_0x2816('0x53')](fs[_0x2816('0x54')](_0x590bf5));_0x31b95e['on'](_0x2816('0x55'),function(){_0xd2bc00(_0x2816('0x55'));});_0x31b95e['on'](_0x2816('0x56'),function(_0x23495a){_0x28887c(_0x23495a);});_0x552651[_0x2816('0x57')]();});}exports['createPdfFromHTML']=function(_0xcf248c,_0x3d9c60){var _0x457ebc=getPDFPrinter();var _0x3c9d1c=getPDFDocDefinitionFromHTML(_0xcf248c,_0x3d9c60);var _0xfc7857=_0x457ebc['createPdfKitDocument'](_0x3c9d1c);return writePDFDocument(_0xfc7857,_0x3d9c60[_0x2816('0x2')])['catch'](function(_0x2955c9){throw _0x2955c9;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index c773777..1b96264 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 _0xd408=['finally','util','path','lodash','json2xls','bluebird','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','splitSizeXlsx','then','sequelize','query','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xd408,0x1e7));var _0x8d40=function(_0x263778,_0x57197c){_0x263778=_0x263778-0x0;var _0x3dd6d9=_0xd408[_0x263778];return _0x3dd6d9;};'use strict';var util=require(_0x8d40('0x0'));var path=require(_0x8d40('0x1'));var _=require(_0x8d40('0x2'));var fs=require('fs');var json2xls=require(_0x8d40('0x3'));var BPromise=require(_0x8d40('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x8d40('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x8d40('0x6'))[_0x8d40('0x7')];var logger=require(_0x8d40('0x8'))(_0x8d40('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x8d40('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5842c7,_0x483d83){var _0xc25d12={'status':_0x5842c7};var _0x36225b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x483d83){_0xc25d12[_0x8d40('0xb')]=_0x483d83;}return db[_0x8d40('0xc')][_0x8d40('0xd')](_0xc25d12,_0x36225b);}function main(){var _0x442d0c=0x1388;var _0x5a6f5e;logger[_0x8d40('0xe')](util[_0x8d40('0xf')](_0x8d40('0x10'),EXTRACTED_REPORT_ID,_0x8d40('0x11')));return db[_0x8d40('0x12')][_0x8d40('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8d40('0x14')]})['then'](function(_0x29d010){if(_0x29d010){_0x5a6f5e=_0x29d010;_0x442d0c=_0x5a6f5e['splitSizeXlsx']||0x1388;}})[_0x8d40('0x15')](function(){return dbH[_0x8d40('0x16')][_0x8d40('0x17')](util[_0x8d40('0xf')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x8d40('0x15')](function(_0x1e9cd9){if(!_0x1e9cd9[0x0][_0x8d40('0x18')]){return analyticExtractedReport(_0x8d40('0x19'));}var _0x3473c0=[];var _0x4ab79d=0x0;if(_0x5a6f5e[_0x8d40('0x1a')]){if(_0x1e9cd9&&_0x1e9cd9[_0x8d40('0x1b')]){var _0x498a88=_[_0x8d40('0x1c')](_0x1e9cd9[0x0]['num']/_0x442d0c);var _0x4157bc=Number[_0x8d40('0x1d')](_0x1e9cd9[0x0][_0x8d40('0x18')]/_0x442d0c)?_0x1e9cd9[0x0][_0x8d40('0x18')]%_0x442d0c:0x0;_0x498a88[_0x8d40('0x1e')](function(_0x486eb1){if(_0x486eb1>0x0){_0x4ab79d+=_0x442d0c;}_0x3473c0[_0x8d40('0x1f')](dbH[_0x8d40('0x16')]['query'](util[_0x8d40('0xf')](_0x8d40('0x20'),QUERY,_0x442d0c,_0x4ab79d),{'type':dbH[_0x8d40('0x16')][_0x8d40('0x21')][_0x8d40('0x22')]}));});if(_0x4157bc>0x0){_0x4ab79d+=_0x442d0c;_0x3473c0[_0x8d40('0x1f')](dbH[_0x8d40('0x16')][_0x8d40('0x17')](util[_0x8d40('0xf')](_0x8d40('0x20'),QUERY,_0x4157bc,_0x4ab79d),{'type':dbH[_0x8d40('0x16')]['QueryTypes'][_0x8d40('0x22')]}));}}}else{_0x3473c0[_0x8d40('0x1f')](dbH['sequelize'][_0x8d40('0x17')](QUERY,{'type':dbH['sequelize'][_0x8d40('0x21')][_0x8d40('0x22')]}));}var _0x59fd87=path[_0x8d40('0x23')](PATH);var _0x14a797=path[_0x8d40('0x24')](PATH,_0x8d40('0x25'));var _0x2931b7=_0x5a6f5e[_0x8d40('0x1a')]&&_0x3473c0[_0x8d40('0x1b')]>0x1;var _0x14c39f=[];if(!fs[_0x8d40('0x26')](path['join'](_0x59fd87,_0x14a797))&&_0x2931b7){fs[_0x8d40('0x27')](path[_0x8d40('0x28')](_0x59fd87,_0x14a797));}return BPromise[_0x8d40('0x29')](_0x3473c0,function(_0x42bfcb){_0x14c39f[_0x8d40('0x1f')](_0x42bfcb);})[_0x8d40('0x15')](function(){for(var _0x295623=0x0;_0x295623<_0x14c39f['length'];_0x295623+=0x1){var _0x1fb657;var _0x28a086=_0x14c39f[_0x295623];if(_0x2931b7){_0x1fb657=path[_0x8d40('0x28')](_0x59fd87,_0x14a797,util[_0x8d40('0xf')](_0x8d40('0x2a'),_0x14a797,_0x295623,_0x8d40('0x2b')));}else{_0x1fb657=path[_0x8d40('0x28')](_0x59fd87,util[_0x8d40('0xf')](_0x8d40('0x2c'),_0x14a797,_0x8d40('0x2b')));}fs[_0x8d40('0x2d')](_0x1fb657,json2xls(_0x28a086),_0x8d40('0x2e'));}})['then'](function(){if(_0x2931b7){return new Promise(function(_0x441d37){zipdir(path[_0x8d40('0x28')](_0x59fd87,_0x14a797),{'saveTo':path[_0x8d40('0x28')](_0x59fd87,util[_0x8d40('0xf')]('%s.%s',_0x14a797,_0x8d40('0x2f')))},function(_0x476021,_0x4ee2b0){rimraf(path[_0x8d40('0x28')](_0x59fd87,_0x14a797),function(){});_0x441d37(_0x8d40('0x30'));});});}})[_0x8d40('0x15')](function(){logger[_0x8d40('0xe')](util['format'](_0x8d40('0x31'),EXTRACTED_REPORT_ID,_0x8d40('0x11')));return analyticExtractedReport(_0x8d40('0x32'),_0x2931b7?util[_0x8d40('0xf')](_0x8d40('0x2c'),_0x14a797,_0x2931b7?_0x8d40('0x2f'):_0x8d40('0x2b')):null);});})[_0x8d40('0x33')](function(_0x1b0558){logger[_0x8d40('0xe')](util[_0x8d40('0xf')](_0x8d40('0x34'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x1b0558,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x8d40('0x35')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xbc5e=['split','length','range','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','.xlsx','existsSync','mkdirSync','each','join','%s%d.%s','xlsx','binary','%s.%s','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','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty'];(function(_0x32bb6b,_0x1a5fbe){var _0x58dcb4=function(_0x402ee2){while(--_0x402ee2){_0x32bb6b['push'](_0x32bb6b['shift']());}};_0x58dcb4(++_0x1a5fbe);}(_0xbc5e,0x7d));var _0xebc5=function(_0x4a61eb,_0x4d801a){_0x4a61eb=_0x4a61eb-0x0;var _0x3e5a88=_0xbc5e[_0x4a61eb];return _0x3e5a88;};'use strict';var util=require(_0xebc5('0x0'));var path=require(_0xebc5('0x1'));var _=require(_0xebc5('0x2'));var fs=require('fs');var json2xls=require(_0xebc5('0x3'));var BPromise=require(_0xebc5('0x4'));var zipdir=require(_0xebc5('0x5'));var rimraf=require(_0xebc5('0x6'));var db=require(_0xebc5('0x7'))['db'];var dbH=require(_0xebc5('0x7'))['dbH'];var logger=require(_0xebc5('0x8'))(_0xebc5('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xebc5('0xa')][0x2]);var QUERY=process[_0xebc5('0xa')][0x3];var PATH=process[_0xebc5('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5927ab,_0x5c3136){var _0x197a10={'status':_0x5927ab};var _0x469973={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c3136){_0x197a10[_0xebc5('0xb')]=_0x5c3136;}return db[_0xebc5('0xc')]['update'](_0x197a10,_0x469973);}function main(){var _0x3e4657=0x1388;var _0x580c81;logger[_0xebc5('0xd')](util[_0xebc5('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xebc5('0xf')));return db[_0xebc5('0x10')][_0xebc5('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})['then'](function(_0x564553){if(_0x564553){_0x580c81=_0x564553;_0x3e4657=_0x580c81[_0xebc5('0x12')]||0x1388;}})[_0xebc5('0x13')](function(){return dbH[_0xebc5('0x14')][_0xebc5('0x15')](util[_0xebc5('0xe')](_0xebc5('0x16'),QUERY),{'type':dbH['sequelize'][_0xebc5('0x17')]['SELECT']});})[_0xebc5('0x13')](function(_0x5eff85){if(!_0x5eff85[0x0]['num']){return analyticExtractedReport(_0xebc5('0x18'));}var _0x5489e9=[];var _0x53ead7=0x0;if(_0x580c81[_0xebc5('0x19')]){if(_0x5eff85&&_0x5eff85[_0xebc5('0x1a')]){var _0x111275=_[_0xebc5('0x1b')](_0x5eff85[0x0][_0xebc5('0x1c')]/_0x3e4657);var _0x38d629=Number['isInteger'](_0x5eff85[0x0][_0xebc5('0x1c')]/_0x3e4657)?_0x5eff85[0x0][_0xebc5('0x1c')]%_0x3e4657:0x0;_0x111275['forEach'](function(_0xfaff49){if(_0xfaff49>0x0){_0x53ead7+=_0x3e4657;}_0x5489e9[_0xebc5('0x1d')](dbH['sequelize'][_0xebc5('0x15')](util[_0xebc5('0xe')](_0xebc5('0x1e'),QUERY,_0x3e4657,_0x53ead7),{'type':dbH[_0xebc5('0x14')][_0xebc5('0x17')]['SELECT']}));});if(_0x38d629>0x0){_0x53ead7+=_0x3e4657;_0x5489e9['push'](dbH['sequelize'][_0xebc5('0x15')](util['format'](_0xebc5('0x1e'),QUERY,_0x38d629,_0x53ead7),{'type':dbH[_0xebc5('0x14')]['QueryTypes'][_0xebc5('0x1f')]}));}}}else{_0x5489e9[_0xebc5('0x1d')](dbH['sequelize'][_0xebc5('0x15')](QUERY,{'type':dbH[_0xebc5('0x14')][_0xebc5('0x17')][_0xebc5('0x1f')]}));}var _0x46394c=path[_0xebc5('0x20')](PATH);var _0x33bf29=path['basename'](PATH,_0xebc5('0x21'));var _0x4feb68=_0x580c81[_0xebc5('0x19')]&&_0x5489e9[_0xebc5('0x1a')]>0x1;var _0x2f227d=[];if(!fs[_0xebc5('0x22')](path['join'](_0x46394c,_0x33bf29))&&_0x4feb68){fs[_0xebc5('0x23')](path['join'](_0x46394c,_0x33bf29));}return BPromise[_0xebc5('0x24')](_0x5489e9,function(_0x255b72){_0x2f227d[_0xebc5('0x1d')](_0x255b72);})[_0xebc5('0x13')](function(){for(var _0x242793=0x0;_0x242793<_0x2f227d[_0xebc5('0x1a')];_0x242793+=0x1){var _0x386465;var _0x2ab9b8=_0x2f227d[_0x242793];if(_0x4feb68){_0x386465=path[_0xebc5('0x25')](_0x46394c,_0x33bf29,util[_0xebc5('0xe')](_0xebc5('0x26'),_0x33bf29,_0x242793,_0xebc5('0x27')));}else{_0x386465=path[_0xebc5('0x25')](_0x46394c,util[_0xebc5('0xe')]('%s.%s',_0x33bf29,_0xebc5('0x27')));}fs['writeFileSync'](_0x386465,json2xls(_0x2ab9b8),_0xebc5('0x28'));}})[_0xebc5('0x13')](function(){if(_0x4feb68){return new Promise(function(_0xad0686){zipdir(path[_0xebc5('0x25')](_0x46394c,_0x33bf29),{'saveTo':path[_0xebc5('0x25')](_0x46394c,util[_0xebc5('0xe')](_0xebc5('0x29'),_0x33bf29,_0xebc5('0x2a')))},function(_0x337070,_0x50356b){rimraf(path['join'](_0x46394c,_0x33bf29),function(){});_0xad0686('zip\x20finished');});});}})[_0xebc5('0x13')](function(){logger['info'](util[_0xebc5('0xe')](_0xebc5('0x2b'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x4feb68?util['format'](_0xebc5('0x29'),_0x33bf29,_0x4feb68?_0xebc5('0x2a'):_0xebc5('0x27')):null);});})[_0xebc5('0x2c')](function(_0x53d69a){logger[_0xebc5('0xd')](util['format'](_0xebc5('0x2d'),EXTRACTED_REPORT_ID,_0xebc5('0xf')),util[_0xebc5('0x2e')](_0x53d69a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xebc5('0x2f'));})[_0xebc5('0x30')](function(){process[_0xebc5('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 8cb3046..2407b58 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 _0xedce=['custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','destroy','then','sortBy','catch','error','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','hasOwnProperty','priority','extensions','extension','find','push','type','format','CDR(type)=%s','context','VoiceExtensionId','inbound','Set','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','length','toLowerCase','createdAt','updatedAt','interval','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app'];(function(_0x21bfb0,_0x20eae7){var _0x21b621=function(_0x19c22a){while(--_0x19c22a){_0x21bfb0['push'](_0x21bfb0['shift']());}};_0x21b621(++_0x20eae7);}(_0xedce,0x14d));var _0xeedc=function(_0x35ab92,_0x471470){_0x35ab92=_0x35ab92-0x0;var _0x320ec8=_0xedce[_0x35ab92];return _0x320ec8;};'use strict';var _=require(_0xeedc('0x0'));var util=require(_0xeedc('0x1'));function rewrite(_0x18cbc0,_0x102fa0){var _0x4b1c0b=this;return _0x18cbc0[_0xeedc('0x2')]['Interval'][_0xeedc('0x3')]({'raw':!![]})['then'](function(_0x443728){_0x4b1c0b[_0xeedc('0x4')]=_0x443728;return _0x18cbc0['models'][_0xeedc('0x5')][_0xeedc('0x3')]({'where':{'IntervalId':_0x102fa0['IntervalId']},'raw':!![]});})['then'](function(_0x3c59c1){return _0x18cbc0[_0xeedc('0x2')]['VoiceExtension'][_0xeedc('0x3')]({'where':{'exten':{'$in':_[_0xeedc('0x6')](_[_0xeedc('0x7')](_0x3c59c1,_0xeedc('0x8')))}},'order':[{'raw':_0xeedc('0x9')}],'raw':!![]});})['then'](function(_0x2bc1a0){var _0x3d0e19=_[_0xeedc('0xa')](_0x2bc1a0,{'priority':'1'});var _0x36ee9e=_['filter'](_0x2bc1a0,{'isApp':0x1});var _0x4bb360=_['groupBy'](_0x36ee9e,_0xeedc('0x8'));var _0x20ac67=[_0xeedc('0xb'),'playback'];var _0x16a2cc=[];var _0x6b3fb6=[];for(var _0x58a34f in _0x4bb360){if(_0x4bb360[_0xeedc('0xc')](_0x58a34f)){_0x4b1c0b[_0xeedc('0xd')]=0x2;_0x4b1c0b[_0xeedc('0xe')]=[];_0x4b1c0b[_0xeedc('0xf')]=_[_0xeedc('0x10')](_0x3d0e19,{'exten':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x8')]});_0x4b1c0b[_0xeedc('0xe')][_0xeedc('0x11')]({'type':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x12')],'app':'Set','appdata':util[_0xeedc('0x13')](_0xeedc('0x14'),_0x4bb360[_0x58a34f][0x0][_0xeedc('0x12')]),'context':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x15')],'exten':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x8')],'priority':_0x4b1c0b[_0xeedc('0xd')]++,'VoiceExtensionId':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x16')]});if(_0x4bb360[_0x58a34f][0x0][_0xeedc('0x12')]===_0xeedc('0x17')){_0x4b1c0b[_0xeedc('0xe')][_0xeedc('0x11')]({'type':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x12')],'app':_0xeedc('0x18'),'appdata':_0xeedc('0x19')+_0x4bb360[_0x58a34f][0x0]['VoiceExtensionId'],'context':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x15')],'exten':_0x4bb360[_0x58a34f][0x0]['exten'],'priority':_0x4b1c0b[_0xeedc('0xd')]++,'VoiceExtensionId':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x16')]});}else if(_0x4bb360[_0x58a34f][0x0][_0xeedc('0x12')]===_0xeedc('0x1a')){if(_0x4b1c0b[_0xeedc('0xf')]){_0x4b1c0b[_0xeedc('0xe')][_0xeedc('0x11')]({'type':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x12')],'app':'Set','appdata':_0xeedc('0x1b')+(_0x4b1c0b['extension'][_0xeedc('0x1c')]?'${EXTEN:'+_0x4b1c0b[_0xeedc('0xf')]['cutdigits']+'}':'${EXTEN}'),'context':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x15')],'exten':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x8')],'priority':_0x4b1c0b['priority']++,'VoiceExtensionId':_0x4bb360[_0x58a34f][0x0]['VoiceExtensionId']});}_0x4b1c0b[_0xeedc('0xe')][_0xeedc('0x11')]({'type':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x12')],'app':'Set','appdata':_0xeedc('0x19')+_0x4bb360[_0x58a34f][0x0][_0xeedc('0x16')],'context':_0x4bb360[_0x58a34f][0x0]['context'],'exten':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x8')],'priority':_0x4b1c0b['priority']++,'VoiceExtensionId':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x16')]});var _0x4836dd=_0x4b1c0b[_0xeedc('0xd')]++;_0x4b1c0b['extensions'][_0xeedc('0x11')]({'type':_0x4bb360[_0x58a34f][0x0]['type'],'app':_0xeedc('0x1d'),'appdata':_0xeedc('0x1e')+(_0x4836dd+0x2)+'):Goto('+(_0x4836dd+0x1)+')','context':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x15')],'exten':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x8')],'priority':_0x4836dd,'VoiceExtensionId':_0x4bb360[_0x58a34f][0x0]['VoiceExtensionId']});if(_0x4b1c0b[_0xeedc('0xf')]){_0x4b1c0b['extensions'][_0xeedc('0x11')]({'type':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x12')],'app':_0xeedc('0x18'),'appdata':_0x4b1c0b[_0xeedc('0xf')][_0xeedc('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x4b1c0b[_0xeedc('0xf')]['cutdigits']+'}':_0xeedc('0x1f'),'context':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x15')],'exten':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x8')],'priority':_0x4b1c0b[_0xeedc('0xd')]++,'VoiceExtensionId':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x16')]});}_0x4b1c0b[_0xeedc('0xe')]['push']({'type':_0x4bb360[_0x58a34f][0x0]['type'],'app':_0xeedc('0x18'),'appdata':_0xeedc('0x20')+_0x4bb360[_0x58a34f][0x0][_0xeedc('0x16')],'context':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x15')],'exten':_0x4bb360[_0x58a34f][0x0]['exten'],'priority':_0x4b1c0b[_0xeedc('0xd')]++,'VoiceExtensionId':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x16')]});if(_0x4b1c0b[_0xeedc('0xf')]&&_0x4b1c0b[_0xeedc('0xf')][_0xeedc('0xc')](_0xeedc('0x21'))&&_0x4b1c0b[_0xeedc('0xf')][_0xeedc('0x21')]!==_0xeedc('0x22')){_0x4b1c0b[_0xeedc('0xe')][_0xeedc('0x11')]({'type':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x12')],'app':_0xeedc('0x18'),'appdata':_0xeedc('0x23'),'context':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x15')],'exten':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x8')],'priority':_0x4b1c0b[_0xeedc('0xd')]++,'VoiceExtensionId':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x16')]});_0x4b1c0b[_0xeedc('0xe')][_0xeedc('0x11')]({'type':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x12')],'app':_0xeedc('0x18'),'appdata':_0xeedc('0x24')+_0x4b1c0b[_0xeedc('0xf')][_0xeedc('0x21')]||_0xeedc('0x25'),'context':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x15')],'exten':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x8')],'priority':_0x4b1c0b['priority']++,'VoiceExtensionId':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x16')]});}}_0x4b1c0b['extensions'][_0xeedc('0x11')]({'type':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x12')],'app':_0xeedc('0x18'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x15')],'exten':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x8')],'priority':_0x4b1c0b['priority']++,'VoiceExtensionId':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x16')]});_0x4b1c0b[_0xeedc('0xe')][_0xeedc('0x11')]({'type':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x12')],'app':_0xeedc('0x18'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x15')],'exten':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x8')],'priority':_0x4b1c0b[_0xeedc('0xd')]++,'VoiceExtensionId':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x16')]});_0x4b1c0b[_0xeedc('0xe')][_0xeedc('0x11')]({'type':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x12')],'app':_0xeedc('0x18'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x15')],'exten':_0x4bb360[_0x58a34f][0x0]['exten'],'priority':_0x4b1c0b['priority']++,'VoiceExtensionId':_0x4bb360[_0x58a34f][0x0]['VoiceExtensionId']});for(var _0x58acdd=0x0,_0x585e27=0x0;_0x58acdd<_0x4bb360[_0x58a34f][_0xeedc('0x26')];_0x58acdd+=0x1,_0x585e27=0x0){var _0x2a1e1b=_0x4bb360[_0x58a34f][_0x58acdd];if(_0x2a1e1b[_0xeedc('0x12')]){_0x2a1e1b[_0xeedc('0x12')]=_0x2a1e1b[_0xeedc('0x12')][_0xeedc('0x27')]();}var _0x26f13f=[];var _0x1a140c=[];delete _0x2a1e1b['id'];delete _0x2a1e1b[_0xeedc('0x28')];delete _0x2a1e1b[_0xeedc('0x29')];var _0x34dfe6=_0x2a1e1b['interval']!=='*,*,*,*'?[_0x2a1e1b[_0xeedc('0x2a')]]:_0x2a1e1b[_0xeedc('0x2b')]?_[_0xeedc('0x7')](_[_0xeedc('0xa')](_0x4b1c0b['intervals'],{'IntervalId':_0x2a1e1b[_0xeedc('0x2b')]}),'interval'):[];if(_0x2a1e1b[_0xeedc('0xc')](_0xeedc('0x2c'))){if(_0x2a1e1b[_0xeedc('0x2c')]&&_0x2a1e1b[_0xeedc('0x2c')]!=='--'){_0x26f13f['push']({'type':_0x2a1e1b[_0xeedc('0x12')],'app':_0xeedc('0x18'),'appdata':_0xeedc('0x2d')+_0x2a1e1b[_0xeedc('0x2c')],'context':_0x2a1e1b[_0xeedc('0x15')],'exten':_0x2a1e1b['exten'],'priority':_0x34dfe6[_0xeedc('0x26')]+_0x4b1c0b[_0xeedc('0xd')]+_0x585e27++,'VoiceExtensionId':_0x2a1e1b['VoiceExtensionId']});}}if(_0x2a1e1b[_0xeedc('0x12')]==='outbound'&&_0x2a1e1b[_0xeedc('0xc')]('callerID')){if(_0x2a1e1b[_0xeedc('0x2e')]){_0x26f13f[_0xeedc('0x11')]({'type':_0x2a1e1b[_0xeedc('0x12')],'app':_0xeedc('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x2a1e1b['callerID']+')','context':_0x2a1e1b[_0xeedc('0x15')],'exten':_0x2a1e1b[_0xeedc('0x8')],'priority':_0x34dfe6['length']+_0x4b1c0b[_0xeedc('0xd')]+_0x585e27++,'VoiceExtensionId':_0x2a1e1b['VoiceExtensionId']});}else{_0x26f13f[_0xeedc('0x11')]({'type':_0x2a1e1b['type'],'app':'ExecIf','appdata':_0xeedc('0x2f'),'context':_0x2a1e1b[_0xeedc('0x15')],'exten':_0x2a1e1b[_0xeedc('0x8')],'priority':_0x34dfe6[_0xeedc('0x26')]+_0x4b1c0b['priority']+_0x585e27++,'VoiceExtensionId':_0x2a1e1b[_0xeedc('0x16')]});}}if(_0x2a1e1b[_0xeedc('0xc')](_0xeedc('0x30'))){if(_0x20ac67[_0xeedc('0x31')](_0x2a1e1b[_0xeedc('0x32')][_0xeedc('0x27')]())>=0x0&&_0x2a1e1b['appType']!==_0xeedc('0x33')){if(_0x2a1e1b[_0xeedc('0x30')]){_0x26f13f[_0xeedc('0x11')]({'type':_0x2a1e1b[_0xeedc('0x12')],'app':_0xeedc('0x1d'),'appdata':_0xeedc('0x34'),'context':_0x2a1e1b['context'],'exten':_0x2a1e1b[_0xeedc('0x8')],'priority':_0x34dfe6['length']+_0x4b1c0b[_0xeedc('0xd')]+_0x585e27++,'VoiceExtensionId':_0x2a1e1b[_0xeedc('0x16')]});_0x26f13f['push']({'type':_0x2a1e1b[_0xeedc('0x12')],'app':_0xeedc('0x18'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2a1e1b[_0xeedc('0x15')],'exten':_0x2a1e1b[_0xeedc('0x8')],'priority':_0x34dfe6[_0xeedc('0x26')]+_0x4b1c0b[_0xeedc('0xd')]+_0x585e27++,'VoiceExtensionId':_0x2a1e1b[_0xeedc('0x16')]});}else{_0x26f13f['push']({'type':_0x2a1e1b[_0xeedc('0x12')],'app':_0xeedc('0x1d'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2a1e1b[_0xeedc('0x15')],'exten':_0x2a1e1b[_0xeedc('0x8')],'priority':_0x34dfe6[_0xeedc('0x26')]+_0x4b1c0b[_0xeedc('0xd')]+_0x585e27++,'VoiceExtensionId':_0x2a1e1b[_0xeedc('0x16')]});_0x26f13f['push']({'type':_0x2a1e1b[_0xeedc('0x12')],'app':_0xeedc('0x18'),'appdata':_0xeedc('0x35'),'context':_0x2a1e1b[_0xeedc('0x15')],'exten':_0x2a1e1b[_0xeedc('0x8')],'priority':_0x34dfe6[_0xeedc('0x26')]+_0x4b1c0b[_0xeedc('0xd')]+_0x585e27++,'VoiceExtensionId':_0x2a1e1b['VoiceExtensionId']});}}}for(var _0x1f5e22=0x0;_0x1f5e22<_0x34dfe6[_0xeedc('0x26')];_0x1f5e22+=0x1){var _0x4070c7=_0x4b1c0b[_0xeedc('0xd')]+_0x34dfe6[_0xeedc('0x26')];var _0xa7283=_0x1f5e22===_0x34dfe6[_0xeedc('0x26')]-0x1?_0x4b1c0b['priority']+_0x26f13f[_0xeedc('0x26')]+_0x1a140c[_0xeedc('0x26')]+0x2:_0x4b1c0b['priority']+_0x1f5e22+0x1;_0x26f13f['splice'](_0x1f5e22,0x0,{'type':_0x2a1e1b[_0xeedc('0x12')],'app':_0xeedc('0x36'),'appdata':_0x34dfe6[_0x1f5e22]+'?'+_0x2a1e1b['context']+_0xeedc('0x37')+_0x4070c7+':'+_0x2a1e1b[_0xeedc('0x15')]+',${EXTEN},'+_0xa7283,'exten':_0x2a1e1b['exten'],'context':_0x2a1e1b[_0xeedc('0x15')],'priority':_0x4b1c0b[_0xeedc('0xd')]+_0x1f5e22,'VoiceExtensionId':_0x4bb360[_0x58a34f][0x0]['VoiceExtensionId']});}_0x2a1e1b[_0xeedc('0xd')]=_0x26f13f[_0xeedc('0x26')]?_[_0xeedc('0x38')](_0x26f13f)[_0xeedc('0xd')]+0x1:_0x4b1c0b['priority'];_0x4b1c0b[_0xeedc('0xd')]=(_0x1a140c['length']?_[_0xeedc('0x38')](_0x1a140c)[_0xeedc('0xd')]:_0x2a1e1b['priority'])+0x1;_0x4b1c0b[_0xeedc('0xe')]=_[_0xeedc('0x39')](_0x4b1c0b[_0xeedc('0xe')],_0x26f13f,[_0x2a1e1b],_0x1a140c);}_0x4b1c0b[_0xeedc('0xe')][_0xeedc('0x11')]({'type':_0x4bb360[_0x58a34f][0x0][_0xeedc('0x12')],'app':'Hangup','exten':_0x4bb360[_0x58a34f][0x0]['exten'],'context':_0x4bb360[_0x58a34f][0x0]['context'],'priority':_0x4b1c0b['priority'],'VoiceExtensionId':_0x4bb360[_0x58a34f][0x0]['VoiceExtensionId']});_0x16a2cc[_0xeedc('0x11')](_0x4bb360[_0x58a34f][0x0][_0xeedc('0x16')]);_0x6b3fb6=_['concat'](_0x6b3fb6,_0x4b1c0b['extensions']);}}return _0x18cbc0['transaction'](function(_0x5b461e){return _0x18cbc0['models'][_0xeedc('0x5')][_0xeedc('0x3a')]({'where':{'VoiceExtensionId':{'$in':_0x16a2cc}},'transaction':_0x5b461e})[_0xeedc('0x3b')](function(_0xe9f5a1){return _0x18cbc0[_0xeedc('0x2')][_0xeedc('0x5')]['bulkCreate'](_[_0xeedc('0x3c')](_0x6b3fb6,'priority'),{'transaction':_0x5b461e});});});})[_0xeedc('0x3d')](function(_0x270dc5){console[_0xeedc('0x3e')](_0x270dc5);});}exports[_0xeedc('0x3f')]=rewrite; \ No newline at end of file +var _0xda83=['findAll','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','type','Set','format','CDR(type)=%s','VoiceExtensionId','inbound','context','outbound','push','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','IntervalId','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','error','rewrite','util','models','Interval','then','intervals','VoiceExtension'];(function(_0x44caf4,_0x238750){var _0x117cad=function(_0x3e64c8){while(--_0x3e64c8){_0x44caf4['push'](_0x44caf4['shift']());}};_0x117cad(++_0x238750);}(_0xda83,0xd8));var _0x3da8=function(_0x5e2cbc,_0x2c42e3){_0x5e2cbc=_0x5e2cbc-0x0;var _0x4f9fcc=_0xda83[_0x5e2cbc];return _0x4f9fcc;};'use strict';var _=require('lodash');var util=require(_0x3da8('0x0'));function rewrite(_0x3c3346,_0x2b2694){var _0x313349=this;return _0x3c3346[_0x3da8('0x1')][_0x3da8('0x2')]['findAll']({'raw':!![]})[_0x3da8('0x3')](function(_0x1eac3b){_0x313349[_0x3da8('0x4')]=_0x1eac3b;return _0x3c3346[_0x3da8('0x1')][_0x3da8('0x5')][_0x3da8('0x6')]({'where':{'IntervalId':_0x2b2694['IntervalId']},'raw':!![]});})[_0x3da8('0x3')](function(_0x28286d){return _0x3c3346[_0x3da8('0x1')][_0x3da8('0x5')][_0x3da8('0x6')]({'where':{'exten':{'$in':_[_0x3da8('0x7')](_['map'](_0x28286d,_0x3da8('0x8')))}},'order':[{'raw':_0x3da8('0x9')}],'raw':!![]});})['then'](function(_0x40ee58){var _0x1a6935=_[_0x3da8('0xa')](_0x40ee58,{'priority':'1'});var _0x2db1af=_[_0x3da8('0xa')](_0x40ee58,{'isApp':0x1});var _0x2b59c3=_[_0x3da8('0xb')](_0x2db1af,_0x3da8('0x8'));var _0x702243=[_0x3da8('0xc'),_0x3da8('0xd')];var _0x549bc1=[];var _0x2d0a9e=[];for(var _0x2ff604 in _0x2b59c3){if(_0x2b59c3[_0x3da8('0xe')](_0x2ff604)){_0x313349[_0x3da8('0xf')]=0x2;_0x313349[_0x3da8('0x10')]=[];_0x313349[_0x3da8('0x11')]=_[_0x3da8('0x12')](_0x1a6935,{'exten':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x8')]});_0x313349['extensions']['push']({'type':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x13')],'app':_0x3da8('0x14'),'appdata':util[_0x3da8('0x15')](_0x3da8('0x16'),_0x2b59c3[_0x2ff604][0x0]['type']),'context':_0x2b59c3[_0x2ff604][0x0]['context'],'exten':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x8')],'priority':_0x313349[_0x3da8('0xf')]++,'VoiceExtensionId':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x17')]});if(_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x13')]===_0x3da8('0x18')){_0x313349[_0x3da8('0x10')]['push']({'type':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x13')],'app':_0x3da8('0x14'),'appdata':'CDR(routeid)='+_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x17')],'context':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x19')],'exten':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x8')],'priority':_0x313349[_0x3da8('0xf')]++,'VoiceExtensionId':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x17')]});}else if(_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x13')]===_0x3da8('0x1a')){if(_0x313349[_0x3da8('0x11')]){_0x313349[_0x3da8('0x10')][_0x3da8('0x1b')]({'type':_0x2b59c3[_0x2ff604][0x0]['type'],'app':'Set','appdata':_0x3da8('0x1c')+(_0x313349['extension'][_0x3da8('0x1d')]?_0x3da8('0x1e')+_0x313349[_0x3da8('0x11')][_0x3da8('0x1d')]+'}':_0x3da8('0x1f')),'context':_0x2b59c3[_0x2ff604][0x0]['context'],'exten':_0x2b59c3[_0x2ff604][0x0]['exten'],'priority':_0x313349[_0x3da8('0xf')]++,'VoiceExtensionId':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x17')]});}_0x313349[_0x3da8('0x10')][_0x3da8('0x1b')]({'type':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x13')],'app':'Set','appdata':_0x3da8('0x20')+_0x2b59c3[_0x2ff604][0x0]['VoiceExtensionId'],'context':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x19')],'exten':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x8')],'priority':_0x313349[_0x3da8('0xf')]++,'VoiceExtensionId':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x17')]});var _0x4bc3f0=_0x313349[_0x3da8('0xf')]++;_0x313349[_0x3da8('0x10')][_0x3da8('0x1b')]({'type':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x13')],'app':_0x3da8('0x21'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4bc3f0+0x2)+_0x3da8('0x22')+(_0x4bc3f0+0x1)+')','context':_0x2b59c3[_0x2ff604][0x0]['context'],'exten':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x8')],'priority':_0x4bc3f0,'VoiceExtensionId':_0x2b59c3[_0x2ff604][0x0]['VoiceExtensionId']});if(_0x313349[_0x3da8('0x11')]){_0x313349['extensions'][_0x3da8('0x1b')]({'type':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x13')],'app':_0x3da8('0x14'),'appdata':_0x313349[_0x3da8('0x11')][_0x3da8('0x1d')]?_0x3da8('0x23')+_0x313349[_0x3da8('0x11')][_0x3da8('0x1d')]+'}':_0x3da8('0x24'),'context':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x19')],'exten':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x8')],'priority':_0x313349[_0x3da8('0xf')]++,'VoiceExtensionId':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x17')]});}_0x313349[_0x3da8('0x10')][_0x3da8('0x1b')]({'type':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x13')],'app':_0x3da8('0x14'),'appdata':'outboundrouteid='+_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x17')],'context':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x19')],'exten':_0x2b59c3[_0x2ff604][0x0]['exten'],'priority':_0x313349[_0x3da8('0xf')]++,'VoiceExtensionId':_0x2b59c3[_0x2ff604][0x0]['VoiceExtensionId']});if(_0x313349['extension']&&_0x313349['extension'][_0x3da8('0xe')](_0x3da8('0x25'))&&_0x313349[_0x3da8('0x11')][_0x3da8('0x25')]!=='none'){_0x313349['extensions'][_0x3da8('0x1b')]({'type':_0x2b59c3[_0x2ff604][0x0]['type'],'app':_0x3da8('0x14'),'appdata':_0x3da8('0x26'),'context':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x19')],'exten':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x8')],'priority':_0x313349[_0x3da8('0xf')]++,'VoiceExtensionId':_0x2b59c3[_0x2ff604][0x0]['VoiceExtensionId']});_0x313349[_0x3da8('0x10')][_0x3da8('0x1b')]({'type':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x13')],'app':_0x3da8('0x14'),'appdata':_0x3da8('0x27')+_0x313349[_0x3da8('0x11')][_0x3da8('0x25')]||_0x3da8('0x28'),'context':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x19')],'exten':_0x2b59c3[_0x2ff604][0x0]['exten'],'priority':_0x313349[_0x3da8('0xf')]++,'VoiceExtensionId':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x17')]});}}_0x313349[_0x3da8('0x10')]['push']({'type':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x13')],'app':_0x3da8('0x14'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x19')],'exten':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x8')],'priority':_0x313349['priority']++,'VoiceExtensionId':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x17')]});_0x313349[_0x3da8('0x10')][_0x3da8('0x1b')]({'type':_0x2b59c3[_0x2ff604][0x0]['type'],'app':_0x3da8('0x14'),'appdata':_0x3da8('0x29'),'context':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x19')],'exten':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x8')],'priority':_0x313349['priority']++,'VoiceExtensionId':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x17')]});_0x313349[_0x3da8('0x10')]['push']({'type':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x13')],'app':_0x3da8('0x14'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x19')],'exten':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x8')],'priority':_0x313349[_0x3da8('0xf')]++,'VoiceExtensionId':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x17')]});for(var _0x4528de=0x0,_0x7c3773=0x0;_0x4528de<_0x2b59c3[_0x2ff604]['length'];_0x4528de+=0x1,_0x7c3773=0x0){var _0x256519=_0x2b59c3[_0x2ff604][_0x4528de];if(_0x256519[_0x3da8('0x13')]){_0x256519['type']=_0x256519[_0x3da8('0x13')][_0x3da8('0x2a')]();}var _0x126f16=[];var _0xcac5d=[];delete _0x256519['id'];delete _0x256519[_0x3da8('0x2b')];delete _0x256519[_0x3da8('0x2c')];var _0x1a1d86=_0x256519[_0x3da8('0x2d')]!==_0x3da8('0x2e')?[_0x256519['interval']]:_0x256519['IntervalId']?_[_0x3da8('0x2f')](_[_0x3da8('0xa')](_0x313349[_0x3da8('0x4')],{'IntervalId':_0x256519[_0x3da8('0x30')]}),_0x3da8('0x2d')):[];if(_0x256519[_0x3da8('0xe')](_0x3da8('0x31'))){if(_0x256519[_0x3da8('0x31')]&&_0x256519[_0x3da8('0x31')]!=='--'){_0x126f16[_0x3da8('0x1b')]({'type':_0x256519['type'],'app':'Set','appdata':_0x3da8('0x32')+_0x256519[_0x3da8('0x31')],'context':_0x256519[_0x3da8('0x19')],'exten':_0x256519[_0x3da8('0x8')],'priority':_0x1a1d86[_0x3da8('0x33')]+_0x313349['priority']+_0x7c3773++,'VoiceExtensionId':_0x256519[_0x3da8('0x17')]});}}if(_0x256519[_0x3da8('0x13')]===_0x3da8('0x1a')&&_0x256519[_0x3da8('0xe')](_0x3da8('0x34'))){if(_0x256519[_0x3da8('0x34')]){_0x126f16[_0x3da8('0x1b')]({'type':_0x256519[_0x3da8('0x13')],'app':_0x3da8('0x21'),'appdata':_0x3da8('0x35')+_0x256519['callerID']+')','context':_0x256519[_0x3da8('0x19')],'exten':_0x256519['exten'],'priority':_0x1a1d86[_0x3da8('0x33')]+_0x313349[_0x3da8('0xf')]+_0x7c3773++,'VoiceExtensionId':_0x256519[_0x3da8('0x17')]});}else{_0x126f16[_0x3da8('0x1b')]({'type':_0x256519[_0x3da8('0x13')],'app':_0x3da8('0x21'),'appdata':_0x3da8('0x36'),'context':_0x256519[_0x3da8('0x19')],'exten':_0x256519[_0x3da8('0x8')],'priority':_0x1a1d86[_0x3da8('0x33')]+_0x313349[_0x3da8('0xf')]+_0x7c3773++,'VoiceExtensionId':_0x256519[_0x3da8('0x17')]});}}if(_0x256519[_0x3da8('0xe')]('answer')){if(_0x702243[_0x3da8('0x37')](_0x256519[_0x3da8('0x38')]['toLowerCase']())>=0x0&&_0x256519[_0x3da8('0x39')]!=='custom'){if(_0x256519[_0x3da8('0x3a')]){_0x126f16[_0x3da8('0x1b')]({'type':_0x256519[_0x3da8('0x13')],'app':_0x3da8('0x21'),'appdata':_0x3da8('0x3b'),'context':_0x256519[_0x3da8('0x19')],'exten':_0x256519[_0x3da8('0x8')],'priority':_0x1a1d86[_0x3da8('0x33')]+_0x313349[_0x3da8('0xf')]+_0x7c3773++,'VoiceExtensionId':_0x256519['VoiceExtensionId']});_0x126f16[_0x3da8('0x1b')]({'type':_0x256519[_0x3da8('0x13')],'app':_0x3da8('0x14'),'appdata':_0x3da8('0x3c'),'context':_0x256519['context'],'exten':_0x256519['exten'],'priority':_0x1a1d86['length']+_0x313349[_0x3da8('0xf')]+_0x7c3773++,'VoiceExtensionId':_0x256519[_0x3da8('0x17')]});}else{_0x126f16[_0x3da8('0x1b')]({'type':_0x256519[_0x3da8('0x13')],'app':'ExecIf','appdata':_0x3da8('0x3d'),'context':_0x256519[_0x3da8('0x19')],'exten':_0x256519['exten'],'priority':_0x1a1d86['length']+_0x313349['priority']+_0x7c3773++,'VoiceExtensionId':_0x256519[_0x3da8('0x17')]});_0x126f16['push']({'type':_0x256519['type'],'app':_0x3da8('0x14'),'appdata':_0x3da8('0x3e'),'context':_0x256519['context'],'exten':_0x256519[_0x3da8('0x8')],'priority':_0x1a1d86[_0x3da8('0x33')]+_0x313349[_0x3da8('0xf')]+_0x7c3773++,'VoiceExtensionId':_0x256519[_0x3da8('0x17')]});}}}for(var _0x2dd40=0x0;_0x2dd40<_0x1a1d86[_0x3da8('0x33')];_0x2dd40+=0x1){var _0x16a9e0=_0x313349[_0x3da8('0xf')]+_0x1a1d86['length'];var _0x5e3229=_0x2dd40===_0x1a1d86[_0x3da8('0x33')]-0x1?_0x313349[_0x3da8('0xf')]+_0x126f16[_0x3da8('0x33')]+_0xcac5d[_0x3da8('0x33')]+0x2:_0x313349[_0x3da8('0xf')]+_0x2dd40+0x1;_0x126f16[_0x3da8('0x3f')](_0x2dd40,0x0,{'type':_0x256519[_0x3da8('0x13')],'app':_0x3da8('0x40'),'appdata':_0x1a1d86[_0x2dd40]+'?'+_0x256519[_0x3da8('0x19')]+_0x3da8('0x41')+_0x16a9e0+':'+_0x256519[_0x3da8('0x19')]+_0x3da8('0x41')+_0x5e3229,'exten':_0x256519[_0x3da8('0x8')],'context':_0x256519['context'],'priority':_0x313349[_0x3da8('0xf')]+_0x2dd40,'VoiceExtensionId':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x17')]});}_0x256519['priority']=_0x126f16[_0x3da8('0x33')]?_[_0x3da8('0x42')](_0x126f16)[_0x3da8('0xf')]+0x1:_0x313349[_0x3da8('0xf')];_0x313349[_0x3da8('0xf')]=(_0xcac5d['length']?_['last'](_0xcac5d)[_0x3da8('0xf')]:_0x256519[_0x3da8('0xf')])+0x1;_0x313349['extensions']=_[_0x3da8('0x43')](_0x313349[_0x3da8('0x10')],_0x126f16,[_0x256519],_0xcac5d);}_0x313349['extensions'][_0x3da8('0x1b')]({'type':_0x2b59c3[_0x2ff604][0x0]['type'],'app':_0x3da8('0x44'),'exten':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x8')],'context':_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x19')],'priority':_0x313349[_0x3da8('0xf')],'VoiceExtensionId':_0x2b59c3[_0x2ff604][0x0]['VoiceExtensionId']});_0x549bc1[_0x3da8('0x1b')](_0x2b59c3[_0x2ff604][0x0][_0x3da8('0x17')]);_0x2d0a9e=_[_0x3da8('0x43')](_0x2d0a9e,_0x313349['extensions']);}}return _0x3c3346['transaction'](function(_0x18a1d4){return _0x3c3346['models'][_0x3da8('0x5')][_0x3da8('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x549bc1}},'transaction':_0x18a1d4})['then'](function(_0x2ad4b6){return _0x3c3346[_0x3da8('0x1')][_0x3da8('0x5')][_0x3da8('0x46')](_[_0x3da8('0x47')](_0x2d0a9e,'priority'),{'transaction':_0x18a1d4});});});})['catch'](function(_0x520bda){console[_0x3da8('0x48')](_0x520bda);});}exports[_0x3da8('0x49')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 820b744..083a865 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 _0x21c1=['createReadStream','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','errors','join','hasOwnProperty','data','firstName','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','duplicate','Duplicate\x20Contact','CmContact','create','keys','pick','catch','message','stringify','into','cm_hopper','createdAt','updatedAt','select','field','NOW()','scheduledAt','ContactId','cm_contacts','where','deletedAt\x20IS\x20NULL','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','insert','fromQuery','id\x20IN\x20?','str','cm_hopper_final','cm_hopper_black','ListId\x20=\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','BlackLists','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CSV\x20import\x20process\x20stopped!'];(function(_0x5a4400,_0xfae3b6){var _0xf9b532=function(_0x39804e){while(--_0x39804e){_0x5a4400['push'](_0x5a4400['shift']());}};_0xf9b532(++_0xfae3b6);}(_0x21c1,0xd2));var _0x121c=function(_0xa4944a,_0x227799){_0xa4944a=_0xa4944a-0x0;var _0x27a103=_0x21c1[_0xa4944a];return _0x27a103;};'use strict';var BPromise=require(_0x121c('0x0'));var util=require(_0x121c('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x121c('0x2'));var Redis=require(_0x121c('0x3'));var db=require(_0x121c('0x4'))['db'];var config=require(_0x121c('0x5'));var logger=require(_0x121c('0x6'))('api');config['redis']=_['defaults'](config[_0x121c('0x7')],{'host':_0x121c('0x8'),'port':0x18eb});var socket=require(_0x121c('0x9'))(new Redis(config['redis']));require(_0x121c('0xa'))['register'](socket);try{if(!process[_0x121c('0xb')][0x2]||process[_0x121c('0xb')][0x2]===_0x121c('0xc')||process['argv'][0x2]==='null'){throw new Error(_0x121c('0xd'));}var FILEPATH=process[_0x121c('0xb')][0x2];if(!process[_0x121c('0xb')][0x3]||process['argv'][0x3]===_0x121c('0xc')||process['argv'][0x3]===_0x121c('0xe')||!process['argv'][0x4]||process[_0x121c('0xb')][0x4]==='undefined'||process[_0x121c('0xb')][0x4]===_0x121c('0xe')){throw new Error(_0x121c('0xf'));}var FIELDS=_['zipObject'](process['argv'][0x3][_0x121c('0x10')](','),process[_0x121c('0xb')][0x4][_0x121c('0x10')](','));if(!process[_0x121c('0xb')][0x5]||process[_0x121c('0xb')][0x5]===_0x121c('0xc')||process[_0x121c('0xb')][0x5]==='null'){throw new Error(_0x121c('0x11'));}var LISTID=process[_0x121c('0xb')][0x5];var COMPANYID=process[_0x121c('0xb')][0x6]&&process[_0x121c('0xb')][0x6]!==_0x121c('0xc')&&process[_0x121c('0xb')][0x6]!==_0x121c('0xe')?process['argv'][0x6]:null;var DUPLICATES=process[_0x121c('0xb')][0x7]&&process['argv'][0x7]!==_0x121c('0xc')&&process[_0x121c('0xb')][0x7]!==_0x121c('0xe')?process[_0x121c('0xb')][0x7]:null;if(!process[_0x121c('0xb')][0x8]||process[_0x121c('0xb')][0x8]==='undefined'||process['argv'][0x8]===_0x121c('0xe')){throw new Error(_0x121c('0x12'));}var SOCKET_TIMESTAMP=process[_0x121c('0xb')][0x8];}catch(_0x22c799){logger[_0x121c('0x13')](_0x22c799);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(_0x2dba92,_0x169101,_0x54d6b4,_0x41ea8d){var _0x17a5da={'message':_0x169101};_0x17a5da[_0x2dba92]=!![];if(_0x54d6b4){_0x17a5da[_0x121c('0x14')]=_0x54d6b4;}if(_0x41ea8d){_0x17a5da[_0x121c('0x15')]=_0x41ea8d;}return _0x17a5da;}function isEmail(_0x376a1c){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))*$/[_0x121c('0x16')](_0x376a1c);}function checkRow(_0xc500c3,_0x386c53,_0x45a772){return new BPromise(function(_0x102a8f,_0x5e5866){if(_['isNil'](_0xc500c3)){return _0x5e5866(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x45a772));}if(_0xc500c3[_0x121c('0x17')]&&_0xc500c3[_0x121c('0x17')]['length']){var _0x463a48=_['map'](_0xc500c3[_0x121c('0x17')],'message')[_0x121c('0x18')](';');return _0x5e5866(handleCheckRowError(_0x121c('0x13'),_0x463a48,null,_0x45a772));}var _0x2ca336={};for(var _0x3a9d2e in FIELDS){if(FIELDS[_0x121c('0x19')](_0x3a9d2e)&&FIELDS[_0x3a9d2e]){_0x2ca336[_0x3a9d2e]=_0xc500c3[_0x121c('0x1a')][0x0][FIELDS[_0x3a9d2e]]||_0xc500c3[_0x121c('0x1a')][0x0]['\ufeff'+FIELDS[_0x3a9d2e]];}}if(!_0x2ca336[_0x121c('0x1b')]){return _0x5e5866(handleCheckRowError(_0x121c('0x13'),'firstName\x20not\x20specified!',null,_0x45a772));}if(!_0x2ca336[_0x121c('0x1c')]){return _0x5e5866(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x45a772));}if(_0x2ca336[_0x121c('0x1d')]){var _0x339e62=moment(_0x2ca336[_0x121c('0x1d')],_0x121c('0x1e'));if(!_0x339e62[_0x121c('0x1f')]()){return _0x5e5866(handleCheckRowError(_0x121c('0x13'),_0x121c('0x20'),null,_0x45a772));}}if(_0x2ca336[_0x121c('0x21')]){if(!isEmail(_0x2ca336[_0x121c('0x21')])){return _0x5e5866(handleCheckRowError(_0x121c('0x13'),_0x121c('0x22'),null,_0x45a772));}}_0x2ca336[_0x121c('0x23')]=LISTID;_0x2ca336[_0x121c('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x121c('0x25')]&&_0x386c53){var _0x1f2ec9={};for(var _0x138eff=0x0,_0x35bfe6=DUPLICATES[_0x121c('0x25')];_0x138eff<_0x35bfe6;_0x138eff+=0x1){_0x1f2ec9[DUPLICATES[_0x138eff]]=_0x2ca336[DUPLICATES[_0x138eff]];}var _0x129003=_['find'](_0x386c53,_0x1f2ec9);if(_0x129003){return _0x5e5866(handleCheckRowError(_0x121c('0x26'),_0x121c('0x27'),_0x129003,_0x45a772));}}return db[_0x121c('0x28')][_0x121c('0x29')](_0x2ca336,{'raw':!![],'hooks':![],'fields':_[_0x121c('0x2a')](_0x2ca336)})['then'](function(_0x4d5e47){if(DUPLICATES&&DUPLICATES[_0x121c('0x25')]&&_0x386c53){_0x386c53['push'](_[_0x121c('0x2b')](_0x2ca336,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4d5e47['id'];return _0x102a8f();})[_0x121c('0x2c')](function(_0x58a846){return _0x5e5866(handleCheckRowError(_0x121c('0x13'),'Error\x20while\x20creating\x20contact:\x20'+(_0x58a846[_0x121c('0x2d')]||JSON[_0x121c('0x2e')](_0x58a846)),null,_0x45a772));});});}function checkHopper(){function _0x197f29(){return function(_0x39ebb5){logger[_0x121c('0x13')]('cmContact','checkHopper',util['inspect'](_0x39ebb5,{'showHidden':![],'depth':null}));};}var _0x40bc82=function(_0xcdf36d,_0x7544){var _0x41802c=squel['insert']()[_0x121c('0x2f')](_0x121c('0x30'))['fromQuery'](['phone','scheduledAt','ContactId',_0x121c('0x23'),_0x7544,_0x121c('0x31'),_0x121c('0x32')],squel[_0x121c('0x33')]()[_0x121c('0x34')]('phone',_0x121c('0x1c'))[_0x121c('0x34')](_0x121c('0x35'),_0x121c('0x36'))[_0x121c('0x34')]('id',_0x121c('0x37'))[_0x121c('0x34')](LISTID['toString'](),'ListId')[_0x121c('0x34')](_0xcdf36d['id']['toString'](),_0x7544)['field'](_0x121c('0x35'),_0x121c('0x31'))[_0x121c('0x34')](_0x121c('0x35'),_0x121c('0x32'))['from'](_0x121c('0x38'))[_0x121c('0x39')](_0x121c('0x3a'))[_0x121c('0x39')]('ListId\x20=\x20?',LISTID[_0x121c('0x3b')]())[_0x121c('0x39')](_0x121c('0x3c'))[_0x121c('0x39')](_0x121c('0x3d'),squel['select']()['field'](_0x121c('0x1c'))[_0x121c('0x3e')](_0x121c('0x30'))[_0x121c('0x39')](_0x7544+_0x121c('0x3f'),_0xcdf36d['id'][_0x121c('0x3b')]())))[_0x121c('0x3b')]();return _0x41802c;};var _0x3d29b6=function(_0x462f12,_0xe5f8a4){var _0x2bace8=squel[_0x121c('0x40')]()['into'](_0x121c('0x30'))[_0x121c('0x41')](['phone',_0x121c('0x36'),_0x121c('0x37'),_0x121c('0x23'),_0xe5f8a4,'createdAt',_0x121c('0x32')],squel[_0x121c('0x33')]()[_0x121c('0x34')]('phone',_0x121c('0x1c'))[_0x121c('0x34')]('NOW()',_0x121c('0x36'))[_0x121c('0x34')]('id','ContactId')['field'](LISTID[_0x121c('0x3b')](),'ListId')['field'](_0x462f12['id'][_0x121c('0x3b')](),_0xe5f8a4)[_0x121c('0x34')]('NOW()',_0x121c('0x31'))[_0x121c('0x34')](_0x121c('0x35'),_0x121c('0x32'))[_0x121c('0x3e')](_0x121c('0x38'))['where']('deletedAt\x20IS\x20NULL')[_0x121c('0x39')]('ListId\x20=\x20?',LISTID[_0x121c('0x3b')]())[_0x121c('0x39')](_0x121c('0x42'),squel[_0x121c('0x43')](hopperContacts))[_0x121c('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0x121c('0x39')](_0x121c('0x3d'),squel[_0x121c('0x33')]()[_0x121c('0x34')]('calleridnum')['from'](_0x121c('0x44'))[_0x121c('0x39')](_0xe5f8a4+_0x121c('0x3f'),_0x462f12['id'][_0x121c('0x3b')]()))[_0x121c('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0x121c('0x33')]()['field'](_0x121c('0x1c'))[_0x121c('0x3e')](_0x121c('0x30'))[_0x121c('0x39')](_0xe5f8a4+_0x121c('0x3f'),_0x462f12['id'][_0x121c('0x3b')]())))[_0x121c('0x3b')]();return _0x2bace8;};function _0x2a93e1(_0x30348f,_0x5075b8){var _0x1f1759=squel['insert']()[_0x121c('0x2f')](_0x121c('0x30'))[_0x121c('0x41')]([_0x121c('0x1c'),_0x121c('0x36'),_0x121c('0x37'),_0x121c('0x23'),_0x5075b8,'createdAt','updatedAt'],squel[_0x121c('0x33')]()[_0x121c('0x34')]('phone',_0x121c('0x1c'))['field'](_0x121c('0x35'),_0x121c('0x36'))[_0x121c('0x34')]('id',_0x121c('0x37'))[_0x121c('0x34')](LISTID[_0x121c('0x3b')](),_0x121c('0x23'))[_0x121c('0x34')](_0x30348f['id'][_0x121c('0x3b')](),_0x5075b8)[_0x121c('0x34')](_0x121c('0x35'),'createdAt')[_0x121c('0x34')](_0x121c('0x35'),_0x121c('0x32'))[_0x121c('0x3e')](_0x121c('0x38'))[_0x121c('0x39')]('deletedAt\x20IS\x20NULL')[_0x121c('0x39')]('ListId\x20=\x20?',LISTID[_0x121c('0x3b')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))['where'](_0x121c('0x3c')))['toString']();return _0x1f1759;}function _0xc5e0d0(_0x2b39dc,_0x1c2f66){var _0x3ad7ec=squel[_0x121c('0x40')]()['into'](_0x121c('0x45'))[_0x121c('0x41')]([_0x121c('0x1c'),_0x121c('0x37'),_0x121c('0x23'),_0x1c2f66,_0x121c('0x31'),_0x121c('0x32')],squel[_0x121c('0x33')]()[_0x121c('0x34')](_0x121c('0x1c'),_0x121c('0x1c'))[_0x121c('0x34')]('id',_0x121c('0x37'))['field'](LISTID['toString'](),'ListId')['field'](_0x2b39dc['id']['toString'](),_0x1c2f66)[_0x121c('0x34')](_0x121c('0x35'),_0x121c('0x31'))[_0x121c('0x34')](_0x121c('0x35'),_0x121c('0x32'))[_0x121c('0x3e')]('cm_contacts')[_0x121c('0x39')](_0x121c('0x3a'))['where'](_0x121c('0x46'),LISTID['toString']())['where'](_0x121c('0x42'),squel[_0x121c('0x43')](hopperContacts))[_0x121c('0x39')](_0x121c('0x3c')))[_0x121c('0x3b')]();return _0x3ad7ec;}return db[_0x121c('0x47')][_0x121c('0x48')]({'where':{'type':_0x121c('0x49')},'attributes':['id',_0x121c('0x4a')],'include':[{'model':db[_0x121c('0x4b')],'as':_0x121c('0x4c'),'where':{'id':LISTID}}]})[_0x121c('0x4d')](function(_0x5d0fcc){var _0x422f93=[];if(_0x5d0fcc){var _0xea20bc;for(var _0x50838b=0x0,_0x209048;_0x50838b<_0x5d0fcc[_0x121c('0x25')];_0x50838b+=0x1){_0x209048=_0x5d0fcc[_0x50838b][_0x121c('0x4e')]({'plain':!![]});switch(_0x209048[_0x121c('0x4a')]){case _0x121c('0x4f'):_0x422f93['push'](db[_0x121c('0x50')][_0x121c('0x51')](_0x3d29b6(_0x209048,_0x121c('0x52')))[_0x121c('0x4d')](function(){})['catch'](_0x197f29()));break;case _0x121c('0x53'):_0x422f93['push'](db[_0x121c('0x50')][_0x121c('0x51')](_0x40bc82(_0x209048,_0x121c('0x52')))[_0x121c('0x4d')](function(){})[_0x121c('0x2c')](_0x197f29()));break;default:_0x422f93[_0x121c('0x54')](db[_0x121c('0x50')][_0x121c('0x51')](_0x2a93e1(_0x209048,_0x121c('0x52')))[_0x121c('0x4d')](function(){})[_0x121c('0x2c')](_0x197f29()));}}}return _0x422f93;})[_0x121c('0x55')]()['then'](function(){return db['VoiceQueue'][_0x121c('0x48')]({'where':{'type':_0x121c('0x49')},'attributes':['id'],'include':[{'model':db[_0x121c('0x4b')],'as':_0x121c('0x56'),'where':{'id':LISTID}}]})[_0x121c('0x4d')](function(_0xcd605d){var _0x210ad3=[];if(_0xcd605d){var _0x35a2fb;for(var _0x16d900=0x0,_0x2c099;_0x16d900<_0xcd605d[_0x121c('0x25')];_0x16d900+=0x1){_0x2c099=_0xcd605d[_0x16d900][_0x121c('0x4e')]({'plain':!![]});_0x210ad3[_0x121c('0x54')](db[_0x121c('0x50')][_0x121c('0x51')](_0xc5e0d0(_0x2c099,_0x121c('0x52')))[_0x121c('0x4d')](function(){})[_0x121c('0x2c')](_0x197f29()));}}return _0x210ad3;})[_0x121c('0x55')]();})[_0x121c('0x4d')](function(){return db['Campaign']['findAll']({'attributes':['id',_0x121c('0x4a')],'include':[{'model':db[_0x121c('0x4b')],'as':_0x121c('0x4c'),'where':{'id':LISTID}}]})['then'](function(_0x11c055){var _0x490112=[];if(_0x11c055){for(var _0x39eda7=0x0,_0x43846a;_0x39eda7<_0x11c055['length'];_0x39eda7+=0x1){_0x43846a=_0x11c055[_0x39eda7]['get']({'plain':!![]});switch(_0x43846a[_0x121c('0x4a')]){case _0x121c('0x4f'):_0x490112['push'](db[_0x121c('0x50')][_0x121c('0x51')](_0x3d29b6(_0x43846a,_0x121c('0x57')))[_0x121c('0x4d')](function(){})[_0x121c('0x2c')](_0x197f29()));break;case _0x121c('0x53'):_0x490112[_0x121c('0x54')](db[_0x121c('0x50')][_0x121c('0x51')](_0x40bc82(_0x43846a,_0x121c('0x57')))['then'](function(){})[_0x121c('0x2c')](_0x197f29()));break;default:_0x490112['push'](db[_0x121c('0x50')]['query'](_0x2a93e1(_0x43846a,_0x121c('0x57')))[_0x121c('0x4d')](function(){})['catch'](_0x197f29()));}}}return _0x490112;})[_0x121c('0x55')]();})[_0x121c('0x4d')](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x121c('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x5b0d74){var _0x74b811=[];if(_0x5b0d74){for(var _0x586169=0x0,_0x3c5cc7;_0x586169<_0x5b0d74[_0x121c('0x25')];_0x586169+=0x1){_0x3c5cc7=_0x5b0d74[_0x586169][_0x121c('0x4e')]({'plain':!![]});_0x74b811[_0x121c('0x54')](db[_0x121c('0x50')][_0x121c('0x51')](_0xc5e0d0(_0x3c5cc7,'CampaignId'))[_0x121c('0x4d')](function(){})[_0x121c('0x2c')](_0x197f29()));}}return _0x74b811;})['all']();})[_0x121c('0x2c')](function(_0xeb7d97){logger[_0x121c('0x13')](_0x121c('0x58'),_0x121c('0x59'),_0xeb7d97[_0x121c('0x2d')]);});}var processPromises=function(_0xa77a30){return BPromise[_0x121c('0x55')](promises)[_0x121c('0x4d')](function(_0x5e3249){})[_0x121c('0x2c')](function(_0xc46a63){logger[_0x121c('0x13')](_0x121c('0x5a'),JSON['stringify'](_0xc46a63));})[_0x121c('0x5b')](function(){socket['emit'](_0x121c('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xa77a30){return _0xa77a30[_0x121c('0x5d')]();}});};var endCsv=function(){return BPromise[_0x121c('0x5e')]()[_0x121c('0x4d')](function(){if(hopperContacts){return checkHopper();}})[_0x121c('0x4d')](function(){socket['emit'](_0x121c('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x121c('0x5f')](FILEPATH);}catch(_0x16f3a2){logger['error'](_0x121c('0x60'),JSON[_0x121c('0x2e')](_0x16f3a2));}finally{process['exit'](0x0);}});};process['on'](_0x121c('0x61'),function(){logger['info'](_0x121c('0x62'));endCsv();});function main(){return BPromise[_0x121c('0x5e')]()[_0x121c('0x4d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x121c('0x10')](',');return db[_0x121c('0x28')][_0x121c('0x48')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x121c('0x4d')](function(_0x59c29f){var _0x5ecc97=fs[_0x121c('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x5ecc97,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1799c0,_0x477677){total+=0x1;var _0x5ca3dd=total;promises[_0x121c('0x54')](checkRow(_0x1799c0,_0x59c29f,_0x5ca3dd)[_0x121c('0x4d')](function(){success+=0x1;})[_0x121c('0x2c')](function(_0x1e8202){if(_0x1e8202[_0x121c('0x13')]){errors+=0x1;delete _0x1e8202[_0x121c('0x13')];}else if(_0x1e8202[_0x121c('0x26')]){duplicates+=0x1;delete _0x1e8202[_0x121c('0x26')];}rows[_0x121c('0x54')](_0x1e8202);}));if(total%0xc8===0x0){_0x477677['pause']();return processPromises(_0x477677);}},'complete':function(){return processPromises()[_0x121c('0x4d')](function(){logger[_0x121c('0x64')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x533e05,_0x4996cc){logger[_0x121c('0x64')](_0x121c('0x65'),JSON[_0x121c('0x2e')](_0x533e05));endCsv();}});})['catch'](function(_0x37c5ee){logger[_0x121c('0x13')](_0x121c('0x66'),JSON['stringify'](_0x37c5ee));});}main(); \ No newline at end of file +var _0x97db=['localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','into','cm_hopper','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','toString','NOW()','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','from','\x20=\x20?','insert','fromQuery','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueue','findAll','outbound','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','CmList','get','all','Campaign','Lists','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','split','createReadStream','duplicate','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults'];(function(_0x313bae,_0x1a9e80){var _0x45363f=function(_0x3d6903){while(--_0x3d6903){_0x313bae['push'](_0x313bae['shift']());}};_0x45363f(++_0x1a9e80);}(_0x97db,0x1b4));var _0xb97d=function(_0x2f08bd,_0xa805da){_0x2f08bd=_0x2f08bd-0x0;var _0x56a741=_0x97db[_0x2f08bd];return _0x56a741;};'use strict';var BPromise=require(_0xb97d('0x0'));var util=require(_0xb97d('0x1'));var _=require(_0xb97d('0x2'));var fs=require('fs');var squel=require(_0xb97d('0x3'));var Papa=require(_0xb97d('0x4'));var Redis=require(_0xb97d('0x5'));var db=require(_0xb97d('0x6'))['db'];var config=require(_0xb97d('0x7'));var logger=require(_0xb97d('0x8'))(_0xb97d('0x9'));config[_0xb97d('0xa')]=_[_0xb97d('0xb')](config[_0xb97d('0xa')],{'host':_0xb97d('0xc'),'port':0x18eb});var socket=require(_0xb97d('0xd'))(new Redis(config[_0xb97d('0xa')]));require(_0xb97d('0xe'))[_0xb97d('0xf')](socket);try{if(!process['argv'][0x2]||process[_0xb97d('0x10')][0x2]===_0xb97d('0x11')||process[_0xb97d('0x10')][0x2]===_0xb97d('0x12')){throw new Error(_0xb97d('0x13'));}var FILEPATH=process[_0xb97d('0x10')][0x2];if(!process[_0xb97d('0x10')][0x3]||process['argv'][0x3]==='undefined'||process[_0xb97d('0x10')][0x3]===_0xb97d('0x12')||!process['argv'][0x4]||process[_0xb97d('0x10')][0x4]===_0xb97d('0x11')||process[_0xb97d('0x10')][0x4]===_0xb97d('0x12')){throw new Error(_0xb97d('0x14'));}var FIELDS=_[_0xb97d('0x15')](process['argv'][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0xb97d('0x11')||process[_0xb97d('0x10')][0x5]===_0xb97d('0x12')){throw new Error(_0xb97d('0x16'));}var LISTID=process[_0xb97d('0x10')][0x5];var COMPANYID=process[_0xb97d('0x10')][0x6]&&process[_0xb97d('0x10')][0x6]!==_0xb97d('0x11')&&process[_0xb97d('0x10')][0x6]!=='null'?process[_0xb97d('0x10')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0xb97d('0x11')&&process[_0xb97d('0x10')][0x7]!=='null'?process[_0xb97d('0x10')][0x7]:null;if(!process[_0xb97d('0x10')][0x8]||process[_0xb97d('0x10')][0x8]===_0xb97d('0x11')||process['argv'][0x8]==='null'){throw new Error(_0xb97d('0x17'));}var SOCKET_TIMESTAMP=process[_0xb97d('0x10')][0x8];}catch(_0x44ccac){logger[_0xb97d('0x18')](_0x44ccac);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(_0x293836,_0x4b2e7f,_0x2404e3,_0x48eec3){var _0x29a7b6={'message':_0x4b2e7f};_0x29a7b6[_0x293836]=!![];if(_0x2404e3){_0x29a7b6[_0xb97d('0x19')]=_0x2404e3;}if(_0x48eec3){_0x29a7b6[_0xb97d('0x1a')]=_0x48eec3;}return _0x29a7b6;}function isEmail(_0x592281){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))*$/[_0xb97d('0x1b')](_0x592281);}function checkRow(_0x3ba37f,_0xba9efc,_0x3c7cfe){return new BPromise(function(_0x1b169f,_0xc49830){if(_[_0xb97d('0x1c')](_0x3ba37f)){return _0xc49830(handleCheckRowError(_0xb97d('0x18'),_0xb97d('0x1d'),null,_0x3c7cfe));}if(_0x3ba37f[_0xb97d('0x1e')]&&_0x3ba37f[_0xb97d('0x1e')][_0xb97d('0x1f')]){var _0x56c144=_[_0xb97d('0x20')](_0x3ba37f[_0xb97d('0x1e')],_0xb97d('0x21'))[_0xb97d('0x22')](';');return _0xc49830(handleCheckRowError(_0xb97d('0x18'),_0x56c144,null,_0x3c7cfe));}var _0x58bc66={};for(var _0xfad02b in FIELDS){if(FIELDS[_0xb97d('0x23')](_0xfad02b)&&FIELDS[_0xfad02b]){_0x58bc66[_0xfad02b]=_0x3ba37f[_0xb97d('0x24')][0x0][FIELDS[_0xfad02b]]||_0x3ba37f[_0xb97d('0x24')][0x0]['\ufeff'+FIELDS[_0xfad02b]];}}if(!_0x58bc66[_0xb97d('0x25')]){return _0xc49830(handleCheckRowError(_0xb97d('0x18'),_0xb97d('0x26'),null,_0x3c7cfe));}if(!_0x58bc66[_0xb97d('0x27')]){return _0xc49830(handleCheckRowError(_0xb97d('0x18'),_0xb97d('0x28'),null,_0x3c7cfe));}if(_0x58bc66[_0xb97d('0x29')]){var _0x4359ec=moment(_0x58bc66[_0xb97d('0x29')],_0xb97d('0x2a'));if(!_0x4359ec[_0xb97d('0x2b')]()){return _0xc49830(handleCheckRowError(_0xb97d('0x18'),_0xb97d('0x2c'),null,_0x3c7cfe));}}if(_0x58bc66[_0xb97d('0x2d')]){if(!isEmail(_0x58bc66[_0xb97d('0x2d')])){return _0xc49830(handleCheckRowError(_0xb97d('0x18'),_0xb97d('0x2e'),null,_0x3c7cfe));}}_0x58bc66['ListId']=LISTID;_0x58bc66[_0xb97d('0x2f')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xb97d('0x1f')]&&_0xba9efc){var _0x120d46={};for(var _0x43f140=0x0,_0x599131=DUPLICATES[_0xb97d('0x1f')];_0x43f140<_0x599131;_0x43f140+=0x1){_0x120d46[DUPLICATES[_0x43f140]]=_0x58bc66[DUPLICATES[_0x43f140]];}var _0x173b2e=_[_0xb97d('0x30')](_0xba9efc,_0x120d46);if(_0x173b2e){return _0xc49830(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x173b2e,_0x3c7cfe));}}return db['CmContact']['create'](_0x58bc66,{'raw':!![],'hooks':![],'fields':_[_0xb97d('0x31')](_0x58bc66)})[_0xb97d('0x32')](function(_0x33277e){if(DUPLICATES&&DUPLICATES[_0xb97d('0x1f')]&&_0xba9efc){_0xba9efc[_0xb97d('0x33')](_[_0xb97d('0x34')](_0x58bc66,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x33277e['id'];return _0x1b169f();})[_0xb97d('0x35')](function(_0x55b7b0){return _0xc49830(handleCheckRowError(_0xb97d('0x18'),_0xb97d('0x36')+(_0x55b7b0[_0xb97d('0x21')]||JSON[_0xb97d('0x37')](_0x55b7b0)),null,_0x3c7cfe));});});}function checkHopper(){function _0xbb4fc8(){return function(_0x75372e){logger[_0xb97d('0x18')](_0xb97d('0x38'),_0xb97d('0x39'),util[_0xb97d('0x3a')](_0x75372e,{'showHidden':![],'depth':null}));};}var _0x5d5fce=function(_0x4a095e,_0x58abdd){var _0x22e722=squel['insert']()[_0xb97d('0x3b')](_0xb97d('0x3c'))['fromQuery']([_0xb97d('0x27'),_0xb97d('0x3d'),_0xb97d('0x3e'),_0xb97d('0x3f'),_0x58abdd,_0xb97d('0x40'),_0xb97d('0x41')],squel[_0xb97d('0x42')]()[_0xb97d('0x43')](_0xb97d('0x27'),'phone')[_0xb97d('0x43')]('NOW()',_0xb97d('0x3d'))[_0xb97d('0x43')]('id',_0xb97d('0x3e'))[_0xb97d('0x43')](LISTID[_0xb97d('0x44')](),_0xb97d('0x3f'))[_0xb97d('0x43')](_0x4a095e['id'][_0xb97d('0x44')](),_0x58abdd)[_0xb97d('0x43')](_0xb97d('0x45'),_0xb97d('0x40'))['field'](_0xb97d('0x45'),_0xb97d('0x41'))['from'](_0xb97d('0x46'))[_0xb97d('0x47')](_0xb97d('0x48'))[_0xb97d('0x47')](_0xb97d('0x49'),LISTID[_0xb97d('0x44')]())['where'](_0xb97d('0x4a'))[_0xb97d('0x47')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xb97d('0x43')](_0xb97d('0x27'))[_0xb97d('0x4b')](_0xb97d('0x3c'))[_0xb97d('0x47')](_0x58abdd+_0xb97d('0x4c'),_0x4a095e['id'][_0xb97d('0x44')]())))['toString']();return _0x22e722;};var _0x156f70=function(_0x32a0e0,_0x5c0ca5){var _0x24c998=squel[_0xb97d('0x4d')]()['into'](_0xb97d('0x3c'))[_0xb97d('0x4e')](['phone','scheduledAt','ContactId',_0xb97d('0x3f'),_0x5c0ca5,'createdAt',_0xb97d('0x41')],squel[_0xb97d('0x42')]()[_0xb97d('0x43')](_0xb97d('0x27'),_0xb97d('0x27'))[_0xb97d('0x43')](_0xb97d('0x45'),_0xb97d('0x3d'))[_0xb97d('0x43')]('id',_0xb97d('0x3e'))[_0xb97d('0x43')](LISTID[_0xb97d('0x44')](),_0xb97d('0x3f'))[_0xb97d('0x43')](_0x32a0e0['id']['toString'](),_0x5c0ca5)[_0xb97d('0x43')](_0xb97d('0x45'),_0xb97d('0x40'))[_0xb97d('0x43')](_0xb97d('0x45'),_0xb97d('0x41'))[_0xb97d('0x4b')]('cm_contacts')[_0xb97d('0x47')]('deletedAt\x20IS\x20NULL')['where'](_0xb97d('0x49'),LISTID['toString']())['where'](_0xb97d('0x4f'),squel[_0xb97d('0x50')](hopperContacts))[_0xb97d('0x47')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xb97d('0x51'),squel['select']()['field']('calleridnum')[_0xb97d('0x4b')](_0xb97d('0x52'))[_0xb97d('0x47')](_0x5c0ca5+_0xb97d('0x4c'),_0x32a0e0['id'][_0xb97d('0x44')]()))['where'](_0xb97d('0x51'),squel[_0xb97d('0x42')]()[_0xb97d('0x43')](_0xb97d('0x27'))[_0xb97d('0x4b')](_0xb97d('0x3c'))[_0xb97d('0x47')](_0x5c0ca5+_0xb97d('0x4c'),_0x32a0e0['id'][_0xb97d('0x44')]())))['toString']();return _0x24c998;};function _0x55e079(_0xdd1a2,_0x2a055e){var _0x4234d8=squel['insert']()[_0xb97d('0x3b')](_0xb97d('0x3c'))['fromQuery']([_0xb97d('0x27'),'scheduledAt',_0xb97d('0x3e'),'ListId',_0x2a055e,'createdAt','updatedAt'],squel[_0xb97d('0x42')]()[_0xb97d('0x43')](_0xb97d('0x27'),_0xb97d('0x27'))[_0xb97d('0x43')](_0xb97d('0x45'),'scheduledAt')[_0xb97d('0x43')]('id','ContactId')[_0xb97d('0x43')](LISTID[_0xb97d('0x44')](),'ListId')[_0xb97d('0x43')](_0xdd1a2['id'][_0xb97d('0x44')](),_0x2a055e)[_0xb97d('0x43')](_0xb97d('0x45'),_0xb97d('0x40'))[_0xb97d('0x43')](_0xb97d('0x45'),_0xb97d('0x41'))[_0xb97d('0x4b')]('cm_contacts')['where'](_0xb97d('0x48'))[_0xb97d('0x47')](_0xb97d('0x49'),LISTID[_0xb97d('0x44')]())[_0xb97d('0x47')]('id\x20IN\x20?',squel[_0xb97d('0x50')](hopperContacts))[_0xb97d('0x47')](_0xb97d('0x4a')))[_0xb97d('0x44')]();return _0x4234d8;}function _0x15ca02(_0x1157bb,_0x196fb6){var _0x596ed3=squel[_0xb97d('0x4d')]()[_0xb97d('0x3b')]('cm_hopper_black')[_0xb97d('0x4e')]([_0xb97d('0x27'),_0xb97d('0x3e'),_0xb97d('0x3f'),_0x196fb6,_0xb97d('0x40'),'updatedAt'],squel[_0xb97d('0x42')]()[_0xb97d('0x43')](_0xb97d('0x27'),_0xb97d('0x27'))[_0xb97d('0x43')]('id',_0xb97d('0x3e'))[_0xb97d('0x43')](LISTID['toString'](),_0xb97d('0x3f'))[_0xb97d('0x43')](_0x1157bb['id'][_0xb97d('0x44')](),_0x196fb6)[_0xb97d('0x43')]('NOW()',_0xb97d('0x40'))[_0xb97d('0x43')](_0xb97d('0x45'),'updatedAt')[_0xb97d('0x4b')](_0xb97d('0x46'))[_0xb97d('0x47')](_0xb97d('0x48'))[_0xb97d('0x47')](_0xb97d('0x49'),LISTID[_0xb97d('0x44')]())[_0xb97d('0x47')](_0xb97d('0x4f'),squel[_0xb97d('0x50')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xb97d('0x44')]();return _0x596ed3;}return db[_0xb97d('0x53')][_0xb97d('0x54')]({'where':{'type':_0xb97d('0x55')},'attributes':['id',_0xb97d('0x56')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xb97d('0x32')](function(_0x281d1f){var _0x262947=[];if(_0x281d1f){var _0x188fbe;for(var _0x332d1e=0x0,_0x4355f9;_0x332d1e<_0x281d1f[_0xb97d('0x1f')];_0x332d1e+=0x1){_0x4355f9=_0x281d1f[_0x332d1e]['get']({'plain':!![]});switch(_0x4355f9[_0xb97d('0x56')]){case _0xb97d('0x57'):_0x262947[_0xb97d('0x33')](db[_0xb97d('0x58')]['query'](_0x156f70(_0x4355f9,_0xb97d('0x59')))[_0xb97d('0x32')](function(){})[_0xb97d('0x35')](_0xbb4fc8()));break;case _0xb97d('0x5a'):_0x262947[_0xb97d('0x33')](db['sequelize'][_0xb97d('0x5b')](_0x5d5fce(_0x4355f9,_0xb97d('0x59')))['then'](function(){})['catch'](_0xbb4fc8()));break;default:_0x262947[_0xb97d('0x33')](db['sequelize'][_0xb97d('0x5b')](_0x55e079(_0x4355f9,_0xb97d('0x59')))[_0xb97d('0x32')](function(){})[_0xb97d('0x35')](_0xbb4fc8()));}}}return _0x262947;})['all']()[_0xb97d('0x32')](function(){return db[_0xb97d('0x53')][_0xb97d('0x54')]({'where':{'type':_0xb97d('0x55')},'attributes':['id'],'include':[{'model':db[_0xb97d('0x5c')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x2ecc12){var _0x369710=[];if(_0x2ecc12){var _0x3fe3cd;for(var _0x17308f=0x0,_0x1fb659;_0x17308f<_0x2ecc12[_0xb97d('0x1f')];_0x17308f+=0x1){_0x1fb659=_0x2ecc12[_0x17308f][_0xb97d('0x5d')]({'plain':!![]});_0x369710['push'](db[_0xb97d('0x58')][_0xb97d('0x5b')](_0x15ca02(_0x1fb659,_0xb97d('0x59')))[_0xb97d('0x32')](function(){})['catch'](_0xbb4fc8()));}}return _0x369710;})[_0xb97d('0x5e')]();})['then'](function(){return db[_0xb97d('0x5f')]['findAll']({'attributes':['id',_0xb97d('0x56')],'include':[{'model':db['CmList'],'as':_0xb97d('0x60'),'where':{'id':LISTID}}]})['then'](function(_0x479d74){var _0x5a0fab=[];if(_0x479d74){for(var _0x42adcf=0x0,_0x51ff08;_0x42adcf<_0x479d74[_0xb97d('0x1f')];_0x42adcf+=0x1){_0x51ff08=_0x479d74[_0x42adcf][_0xb97d('0x5d')]({'plain':!![]});switch(_0x51ff08[_0xb97d('0x56')]){case _0xb97d('0x57'):_0x5a0fab[_0xb97d('0x33')](db[_0xb97d('0x58')][_0xb97d('0x5b')](_0x156f70(_0x51ff08,'CampaignId'))[_0xb97d('0x32')](function(){})[_0xb97d('0x35')](_0xbb4fc8()));break;case _0xb97d('0x5a'):_0x5a0fab[_0xb97d('0x33')](db[_0xb97d('0x58')]['query'](_0x5d5fce(_0x51ff08,'CampaignId'))[_0xb97d('0x32')](function(){})[_0xb97d('0x35')](_0xbb4fc8()));break;default:_0x5a0fab[_0xb97d('0x33')](db[_0xb97d('0x58')][_0xb97d('0x5b')](_0x55e079(_0x51ff08,'CampaignId'))[_0xb97d('0x32')](function(){})['catch'](_0xbb4fc8()));}}}return _0x5a0fab;})[_0xb97d('0x5e')]();})['then'](function(){return db[_0xb97d('0x5f')][_0xb97d('0x54')]({'attributes':['id'],'include':[{'model':db[_0xb97d('0x5c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xb97d('0x32')](function(_0xc1a34c){var _0x59e0a1=[];if(_0xc1a34c){for(var _0x4f594c=0x0,_0x24df26;_0x4f594c<_0xc1a34c['length'];_0x4f594c+=0x1){_0x24df26=_0xc1a34c[_0x4f594c][_0xb97d('0x5d')]({'plain':!![]});_0x59e0a1[_0xb97d('0x33')](db[_0xb97d('0x58')][_0xb97d('0x5b')](_0x15ca02(_0x24df26,'CampaignId'))[_0xb97d('0x32')](function(){})[_0xb97d('0x35')](_0xbb4fc8()));}}return _0x59e0a1;})['all']();})[_0xb97d('0x35')](function(_0x496d1c){logger[_0xb97d('0x18')]('cmContact,\x20%s,\x20%s',_0xb97d('0x61'),_0x496d1c[_0xb97d('0x21')]);});}var processPromises=function(_0x4b2b0c){return BPromise[_0xb97d('0x5e')](promises)[_0xb97d('0x32')](function(_0x198983){})[_0xb97d('0x35')](function(_0x4837d9){logger[_0xb97d('0x18')](_0xb97d('0x62'),JSON['stringify'](_0x4837d9));})[_0xb97d('0x63')](function(){socket['emit'](_0xb97d('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4b2b0c){return _0x4b2b0c['resume']();}});};var endCsv=function(){return BPromise[_0xb97d('0x65')]()[_0xb97d('0x32')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0xb97d('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xb97d('0x66')](FILEPATH);}catch(_0x4391b2){logger[_0xb97d('0x18')](_0xb97d('0x67'),JSON['stringify'](_0x4391b2));}finally{process['exit'](0x0);}});};process['on'](_0xb97d('0x68'),function(){logger[_0xb97d('0x69')](_0xb97d('0x6a'));endCsv();});function main(){return BPromise['resolve']()[_0xb97d('0x32')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xb97d('0x6b')](',');return db['CmContact'][_0xb97d('0x54')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xb97d('0x32')](function(_0x25bd43){var _0x425d38=fs[_0xb97d('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x425d38,{'header':!![],'skipEmptyLines':!![],'step':function(_0x42a99e,_0x5ea246){total+=0x1;var _0x4c6631=total;promises[_0xb97d('0x33')](checkRow(_0x42a99e,_0x25bd43,_0x4c6631)[_0xb97d('0x32')](function(){success+=0x1;})[_0xb97d('0x35')](function(_0x34c8a0){if(_0x34c8a0[_0xb97d('0x18')]){errors+=0x1;delete _0x34c8a0['error'];}else if(_0x34c8a0[_0xb97d('0x6d')]){duplicates+=0x1;delete _0x34c8a0[_0xb97d('0x6d')];}rows['push'](_0x34c8a0);}));if(total%0xc8===0x0){_0x5ea246['pause']();return processPromises(_0x5ea246);}},'complete':function(){return processPromises()['then'](function(){logger[_0xb97d('0x69')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x274a24,_0x505a7c){logger[_0xb97d('0x69')](_0xb97d('0x6e'),JSON[_0xb97d('0x37')](_0x274a24));endCsv();}});})[_0xb97d('0x35')](function(_0x2fb0db){logger[_0xb97d('0x18')](_0xb97d('0x6f'),JSON[_0xb97d('0x37')](_0x2fb0db));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 74a39d7..485a155 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 _0x8633=['.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isNil','firstName','\x20not\x20specified','SystemRow','emit','contact:import:','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','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','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','from','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','cm_hopper','fromQuery','phone','scheduledat','ListId','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.id','cm_contacts.updatedAt','into','ContactId','updatedAt','field','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','createdAt','keys','CompanyId','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','error','exit','errors','push','code','message','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','socket_timestamp','root','server/files/tmp'];(function(_0x150469,_0x5ec8a2){var _0x110773=function(_0x3c8448){while(--_0x3c8448){_0x150469['push'](_0x150469['shift']());}};_0x110773(++_0x5ec8a2);}(_0x8633,0xe4));var _0x3863=function(_0x325812,_0x1cbbc6){_0x325812=_0x325812-0x0;var _0x41dd55=_0x8633[_0x325812];return _0x41dd55;};'use strict';var fs=require('fs');var path=require(_0x3863('0x0'));var _=require(_0x3863('0x1'));var Papa=require(_0x3863('0x2'));var util=require(_0x3863('0x3'));var BPromise=require(_0x3863('0x4'));var moment=require(_0x3863('0x5'));var squel=require(_0x3863('0x6'));var Redis=require(_0x3863('0x7'));var db=require(_0x3863('0x8'))['db'];var config=require(_0x3863('0x9'));var shared=require(_0x3863('0xa'));var logger=require(_0x3863('0xb'))('import');config['redis']=_[_0x3863('0xc')](config[_0x3863('0xd')],{'host':_0x3863('0xe'),'port':0x18eb});var socket=require(_0x3863('0xf'))(new Redis(config[_0x3863('0xd')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x3863('0x10')](_0x3863('0x11'));function isEmail(_0xa045f1){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))*$/[_0x3863('0x12')](_0xa045f1);}function selectNotIn(_0x28dce7,_0x45f386,_0x43287d,_0x5f2fe1,_0x32c4b5){return squel[_0x3863('0x13')]()['field']('phone')[_0x3863('0x14')](_0x5f2fe1)['join'](_0x45f386,null,_0x45f386+'.id\x20=\x20'+_0x5f2fe1+'.'+_0x43287d)[_0x3863('0x15')](_0x5f2fe1+'.'+_0x43287d+_0x3863('0x16')+_0x28dce7+'.'+_0x43287d)['where'](_0x45f386+_0x3863('0x17')+_0x32c4b5[_0x3863('0x18')]()+')');}function insertCmHopper(_0x5e1408,_0x3fb1d0,_0x1bb498,_0x3789e7,_0x49f4c7){var _0xdd7fbe=['cm_contacts.phone',_0x3863('0x19'),'cm_contacts.id',_0x3863('0x1a'),_0x3fb1d0+'.'+_0x3789e7,_0x3863('0x1b'),'cm_contacts.updatedAt',_0x3863('0x1c'),'cm_contacts.UserId','\x22'+_0x49f4c7+'\x22'];return squel[_0x3863('0x1d')]()['into'](_0x3863('0x1e'))[_0x3863('0x1f')]([_0x3863('0x20'),_0x3863('0x21'),'ContactId',_0x3863('0x22'),_0x3789e7,'createdAt','updatedAt',_0x3863('0x23'),_0x3863('0x24'),_0x3863('0x25')],squel[_0x3863('0x13')]()[_0x3863('0x26')](_0xdd7fbe)['from'](_0x3fb1d0)[_0x3863('0x18')](_0x3863('0x27'),null,_0x3863('0x28')+_0x3fb1d0+_0x3863('0x29'))['join'](_0x1bb498,null,_0x1bb498+_0x3863('0x2a')+_0x3fb1d0+'.'+_0x3789e7)['where'](_0x3fb1d0+_0x3863('0x2b'),_0x5e1408)['where'](_0x3863('0x2c'),NOW)[_0x3863('0x15')](_0x3863('0x2d'),selectNotIn(_0x3fb1d0,_0x1bb498,_0x3789e7,_0x3863('0x1e'),[_0x3863('0x2e'),_0x3863('0x2f')]))[_0x3863('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3fb1d0,_0x1bb498,_0x3789e7,_0x3863('0x1e'),[_0x3863('0x2e')])))[_0x3863('0x30')]();}function insertCmHopperBlack(_0x492a80,_0x44d914,_0x4ac7c7,_0x1f4175){var _0x99c0fc=[_0x3863('0x31'),_0x3863('0x32'),_0x3863('0x1a'),_0x44d914+'.'+_0x1f4175,_0x3863('0x1b'),_0x3863('0x33')];return squel['insert']()[_0x3863('0x34')]('cm_hopper_black')['fromQuery']([_0x3863('0x20'),_0x3863('0x35'),_0x3863('0x22'),_0x1f4175,'createdAt',_0x3863('0x36')],squel[_0x3863('0x13')]()[_0x3863('0x26')](_0x99c0fc)['from'](_0x44d914)[_0x3863('0x18')](_0x3863('0x27'),null,_0x3863('0x28')+_0x44d914+'.CmListId')[_0x3863('0x18')](_0x4ac7c7,null,_0x4ac7c7+_0x3863('0x2a')+_0x44d914+'.'+_0x1f4175)[_0x3863('0x15')](_0x44d914+'.CmListId\x20=\x20?',_0x492a80)[_0x3863('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x3863('0x2d'),squel['select']()[_0x3863('0x37')](_0x3863('0x20'))[_0x3863('0x14')](_0x3863('0x38'))[_0x3863('0x15')](_0x3863('0x39'),_0x492a80)[_0x3863('0x15')](_0x1f4175+_0x3863('0x3a'),_0x44d914+'.'+_0x1f4175)))[_0x3863('0x30')]();}function insertTzCmHopper(_0x1e1bd3,_0x3a4416,_0x1394d0,_0xca8254,_0x30b642,_0x3316e4){var _0x297017=[_0x3863('0x31'),_0x3863('0x3b')+_0x3316e4+_0x3863('0x3c'),_0x3863('0x32'),_0x3863('0x1a'),_0x3a4416+'.'+_0xca8254,'cm_contacts.createdAt',_0x3863('0x33'),'cm_contacts.priority',_0x3863('0x3d'),'\x22'+_0x30b642+'\x22'];var _0x37a048=squel[_0x3863('0x1d')]()[_0x3863('0x34')]('cm_hopper')['fromQuery']([_0x3863('0x20'),'scheduledat',_0x3863('0x35'),_0x3863('0x22'),_0xca8254,_0x3863('0x3e'),_0x3863('0x36'),_0x3863('0x23'),'UserId',_0x3863('0x25')],squel[_0x3863('0x13')]()[_0x3863('0x26')](_0x297017)['from'](_0x3a4416)[_0x3863('0x18')](_0x3863('0x27'),null,_0x3863('0x28')+_0x3a4416+_0x3863('0x29'))['join'](_0x1394d0,null,_0x1394d0+_0x3863('0x2a')+_0x3a4416+'.'+_0xca8254)[_0x3863('0x18')](_0x3316e4,null,_0x3316e4+_0x3863('0x2a')+_0x3a4416+'.'+_0xca8254)[_0x3863('0x15')](_0x3a4416+'.CmListId\x20=\x20?',_0x1e1bd3)['where'](_0x3863('0x2c'),NOW)[_0x3863('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3a4416,_0x1394d0,_0xca8254,_0x3863('0x1e'),['\x22always\x22',_0x3863('0x2f')]))[_0x3863('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3a4416,_0x1394d0,_0xca8254,_0x3863('0x1e'),[_0x3863('0x2e')])))[_0x3863('0x30')]();return _0x37a048;}function insertTzCmHopperBlack(_0x1ea29e,_0x2e8a17,_0x531e8a,_0x2a667f){var _0x5b2186=[_0x3863('0x31'),_0x3863('0x32'),_0x3863('0x1a'),_0x2e8a17+'.'+_0x2a667f,_0x3863('0x1b'),_0x3863('0x33')];return squel[_0x3863('0x1d')]()[_0x3863('0x34')](_0x3863('0x38'))[_0x3863('0x1f')](['phone',_0x3863('0x35'),_0x3863('0x22'),_0x2a667f,_0x3863('0x3e'),'updatedAt'],squel[_0x3863('0x13')]()[_0x3863('0x26')](_0x5b2186)['from'](_0x2e8a17)[_0x3863('0x18')](_0x3863('0x27'),null,_0x3863('0x28')+_0x2e8a17+_0x3863('0x29'))['join'](_0x531e8a,null,_0x531e8a+_0x3863('0x2a')+_0x2e8a17+'.'+_0x2a667f)[_0x3863('0x15')](_0x2e8a17+'.CmListId\x20=\x20?',_0x1ea29e)['where'](_0x3863('0x2c'),NOW)['where'](_0x3863('0x2d'),squel[_0x3863('0x13')]()[_0x3863('0x37')]('phone')[_0x3863('0x14')](_0x3863('0x38'))[_0x3863('0x15')](_0x3863('0x39'),_0x1ea29e)['where'](_0x2a667f+_0x3863('0x3a'),_0x2e8a17+'.'+_0x2a667f)))[_0x3863('0x30')]();}function insertCmContact(_0x177b7f,_0x5ef305,_0x3f5d52,_0xd1bce1){var _0x546981=_['concat'](_[_0x3863('0x3f')](_0xd1bce1),[_0x3863('0x22'),_0x3863('0x40'),_0x3863('0x3e'),'updatedAt']);return squel[_0x3863('0x1d')]()[_0x3863('0x34')](_0x3863('0x27'))[_0x3863('0x1f')](_0x546981,squel['select']()[_0x3863('0x26')](_0x546981)[_0x3863('0x14')](_0x5ef305)[_0x3863('0x15')]('('+_0x3f5d52[_0x3863('0x18')](',')+')\x20NOT\x20IN\x20?',squel[_0x3863('0x13')]()[_0x3863('0x26')](_0x3f5d52)[_0x3863('0x14')]('cm_contacts')[_0x3863('0x15')](_0x3863('0x39'),_0x177b7f)['where']('deletedAt\x20IS\x20NULL'))[_0x3863('0x15')](_0x3863('0x41'),squel[_0x3863('0x13')]()[_0x3863('0x37')](_0x3863('0x42'),_0x3863('0x43'))[_0x3863('0x14')](_0x5ef305)['group'](_0x3f5d52[_0x3863('0x18')](','))))['toString']();}function handleStop(){logger[_0x3863('0x44')](_0x3863('0x45'));stopped=!![];}function handleUncaughtException(_0x89b212){logger[_0x3863('0x46')](_0x89b212['message']);process[_0x3863('0x47')](0x1);}function handleError(_0x17d5da,_0x36a14f){stats[_0x3863('0x48')][_0x3863('0x49')]({'name':_0x36a14f[_0x3863('0x4a')],'message':_0x36a14f[_0x3863('0x4b')],'row':_0x17d5da});}function handleQuery(_0x52125c){logger[_0x3863('0x44')](_0x52125c);return db[_0x3863('0x4c')][_0x3863('0x4d')](_0x52125c)[_0x3863('0x4e')](function(_0x16a0e2){results[_0x3863('0x49')](_0x16a0e2);})[_0x3863('0x4f')](function(_0x57ceb7){logger['error'](_0x57ceb7[_0x3863('0x4b')]);});}function updateTzCampaigns(_0x28e99a){return new Promise(function(_0x3154f4,_0xccc4ba){var _0x5df108=squel[_0x3863('0x13')]()[_0x3863('0x26')]([_0x3863('0x50'),_0x3863('0x51')])['from']('campaigns')[_0x3863('0x18')](_0x3863('0x52'),null,_0x3863('0x53'))[_0x3863('0x15')](_0x3863('0x54')+_0x28e99a);db[_0x3863('0x4c')][_0x3863('0x4d')](_0x5df108['toString']())['spread'](function(_0x326883){var _0x405e58=[];for(var _0x17cb58=0x0;_0x17cb58<_0x326883[_0x3863('0x55')];_0x17cb58++){_0x405e58[_0x3863('0x49')](getTimezoneData(_0x326883[_0x17cb58],tmp_campaigns));}BPromise[_0x3863('0x56')](_0x405e58)[_0x3863('0x57')](function(){_0x3154f4({'val':0x1});});})[_0x3863('0x4f')](function(_0x8c680e){logger[_0x3863('0x46')](_0x8c680e[_0x3863('0x4b')]);_0x3154f4({'val':0x0});});});}function updateTzVoiceQueues(_0x5e0e24){return new Promise(function(_0x4acc12,_0x400eab){var _0x90db75=squel['select']()[_0x3863('0x26')](['voice_queues.id',_0x3863('0x58')])[_0x3863('0x14')]('voice_queues')[_0x3863('0x18')]('voice_queues_has_cm_lists',null,_0x3863('0x59'))[_0x3863('0x15')](_0x3863('0x5a')+_0x5e0e24);db['sequelize'][_0x3863('0x4d')](_0x90db75[_0x3863('0x30')]())[_0x3863('0x4e')](function(_0x59432f){var _0x341f67=[];for(var _0x4de1b7=0x0;_0x4de1b7<_0x59432f[_0x3863('0x55')];_0x4de1b7++){_0x341f67['push'](getTimezoneData(_0x59432f[_0x4de1b7],tmp_voice_queues));}BPromise[_0x3863('0x56')](_0x341f67)[_0x3863('0x57')](function(){_0x4acc12({'val':0x1});});})['catch'](function(_0x48e218){logger[_0x3863('0x46')](_0x48e218[_0x3863('0x4b')]);_0x4acc12({'val':0x0});});});}function getTimezoneData(_0x523da4,_0x2183c3){return new Promise(function(_0x40ebe7,_0x3348a6){var _0x23ba31=shared[_0x3863('0x5b')];var _0x20f08c=_0x23ba31[_0x523da4[_0x3863('0x5c')]];if(_['isNil'](_0x20f08c)){_0x40ebe7({'ret':0x1});}else{var _0x249344=_0x20f08c[_0x3863('0x5d')];var _0x3deba2=squel[_0x3863('0x1d')]()[_0x3863('0x34')](_0x2183c3)[_0x3863('0x5e')]('id',_0x523da4['id'])[_0x3863('0x5e')](_0x3863('0x5f'),_0x249344)['set'](_0x3863('0x5c'),_0x523da4[_0x3863('0x5c')])['toString']();return db[_0x3863('0x4c')][_0x3863('0x4d')](_0x3deba2)[_0x3863('0x4e')](function(_0x25a801){_0x40ebe7({'ret':0x1});})[_0x3863('0x4f')](function(_0x3fdccd){logger['error'](_0x3fdccd[_0x3863('0x4b')]);_0x3348a6({'ret':0x1});});}});}function handleTZQuery(_0x2eab96){logger[_0x3863('0x44')](_0x2eab96);return db[_0x3863('0x4c')][_0x3863('0x4d')](_0x2eab96)[_0x3863('0x4e')](function(_0x386f11){})['catch'](function(_0x2f5078){logger[_0x3863('0x46')](_0x2f5078[_0x3863('0x4b')]);});}function main(_0x34295f,_0x1e3ade,_0x566753,_0x1f43a2){logger[_0x3863('0x44')](_0x3863('0x60'),_0x34295f,JSON[_0x3863('0x61')](_0x1e3ade));process[_0x3863('0x62')]('start');var _0x5600dc=_0x1e3ade['binding'];var _0x400899=_0x1e3ade[_0x3863('0x63')];var _0x4c8985=path['join'](config[_0x3863('0x64')],_0x3863('0x65'),_0x400899+_0x3863('0x66'));hasTZ=_[_0x3863('0x3f')](_0x5600dc)[_0x3863('0x67')](_0x3863('0x5c'));var _0x4e1eb2=_[_0x3863('0x3f')](_0x5600dc)[_0x3863('0x18')]();logger[_0x3863('0x44')](_0x3863('0x68'),_0x4e1eb2);if(hasTZ)_0x4e1eb2+=_0x3863('0x69');fs[_0x3863('0x6a')](_0x4c8985,_0x4e1eb2+'\x0a');Papa[_0x3863('0x6b')](fs[_0x3863('0x6c')](_0x34295f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2d7287,_0x26bc39){try{for(var _0x86440f=0x0,_0x518187=[];_0x86440f<_0x2d7287[_0x3863('0x6d')][_0x3863('0x55')];_0x86440f++){stats[_0x3863('0x6e')]+=0x1;if(_0x2d7287[_0x3863('0x48')][_0x86440f]){handleError(_0x2d7287[_0x3863('0x6d')][_0x86440f],_0x2d7287[_0x3863('0x48')][_0x86440f]);}else{var _0x2d8c18=[];for(var _0x3400e5 in _0x5600dc){if(_0x5600dc[_0x3863('0x6f')](_0x3400e5)){if(_0x2d7287[_0x3863('0x6d')][_0x86440f][_0x5600dc[_0x3400e5]]){var _0x8d45ff=_[_0x3863('0x70')](_0x2d7287['data'][_0x86440f][_0x5600dc[_0x3400e5]][_0x3863('0x71')](/"/g,'\x27'));switch(_0x3400e5){case _0x3863('0x21'):var _0x548f5f=moment(_0x8d45ff,_0x3863('0x11'),!![]);if(_0x548f5f[_0x3863('0x72')]()){_0x518187[_0x3863('0x49')]('\x22'+_0x8d45ff+'\x22');}else{_0x2d8c18[_0x3863('0x49')](_0x3863('0x73'));}break;case'priority':var _0x40faeb=parseInt(_0x8d45ff);_0x8d45ff=_[_0x3863('0x74')](_0x40faeb)||_0x40faeb<0x0||_0x40faeb>0x4?_0x1f43a2?0x3:0x2:_0x40faeb;_0x518187[_0x3863('0x49')]('\x22'+_0x8d45ff+'\x22');break;case _0x3863('0x24'):var _0x4559e6=parseInt(_0x8d45ff);if(_[_0x3863('0x75')](_0x4559e6)&&_[_0x3863('0x67')](_0x566753,_0x4559e6)){_0x518187['push']('\x22'+_0x4559e6+'\x22');}else{_0x2d8c18[_0x3863('0x49')](_0x3863('0x76'));}break;case _0x3863('0x77'):if(isEmail(_0x8d45ff)){_0x518187['push']('\x22'+_0x8d45ff+'\x22');}else{_0x2d8c18[_0x3863('0x49')](_0x3863('0x78'));}break;case _0x3863('0x79'):var _0x194f44=moment(_0x8d45ff,_0x3863('0x7a'),!![]);if(_0x194f44[_0x3863('0x72')]()){_0x518187[_0x3863('0x49')]('\x22'+_0x8d45ff+'\x22');}else{_0x2d8c18[_0x3863('0x49')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case'dialTimezone':var _0x3857ef=shared[_0x3863('0x5b')];var _0x4ebd62=_0x3857ef[_0x8d45ff];if(!_[_0x3863('0x7b')](_0x4ebd62)){var _0x2f50f8=_0x4ebd62[_0x3863('0x5d')];_0x518187[_0x3863('0x49')]('\x22'+_0x8d45ff+'\x22');_0x518187[_0x3863('0x49')]('\x22'+_0x2f50f8+'\x22');}break;default:_0x518187[_0x3863('0x49')]('\x22'+_0x8d45ff+'\x22');}}else{switch(_0x3400e5){case _0x3863('0x7c'):case _0x3863('0x20'):_0x2d8c18[_0x3863('0x49')](_0x3400e5+_0x3863('0x7d'));break;default:_0x518187[_0x3863('0x49')]('\x22\x22');}}}}if(_0x2d8c18[_0x3863('0x55')]){handleError(_0x2d7287['data'][_0x86440f],{'code':_0x3863('0x7e'),'message':_0x2d8c18['join']()});}else{fs['appendFileSync'](_0x4c8985,_0x518187[_0x3863('0x18')]()+'\x0a');}_0x518187=[];}if(!(stats[_0x3863('0x6e')]%0xc8)){socket[_0x3863('0x7f')](_0x3863('0x80')+_0x400899,stats);stats[_0x3863('0x48')]=[];}}if(stopped){logger[_0x3863('0x44')]('Abort\x20parser');_0x26bc39['abort']();}}catch(_0x3c4813){handleError(_0x2d7287['data'][_0x86440f],{'code':_0x3863('0x81'),'message':_0x3c4813[_0x3863('0x4b')]});logger[_0x3863('0x46')](_0x3863('0x82'),_0x3c4813[_0x3863('0x4b')]);}},'complete':function(){try{var _0x2415c2=[];var _0x4731f0=[];var _0x467559=_0x3863('0x27');if(_0x1e3ade[_0x3863('0x83')]&&_0x1e3ade['duplicates'][_0x3863('0x55')]){_0x467559=_0x3863('0x84')+_0x400899;_0x2415c2['push'](_0x3863('0x85')+_0x467559+_0x3863('0x86'));}tmp_campaigns='campaigns_'+_0x400899;tmp_voice_queues=_0x3863('0x87')+_0x400899;_0x4731f0[_0x3863('0x49')](_0x3863('0x85')+tmp_campaigns+_0x3863('0x88'));_0x4731f0[_0x3863('0x49')](_0x3863('0x85')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x3863('0x89')](_0x4731f0,handleTZQuery)[_0x3863('0x57')](function(_0x4b4b89){updateTzCampaigns(_0x1e3ade['ListId'])[_0x3863('0x57')](function(_0xd7e54){updateTzVoiceQueues(_0x1e3ade[_0x3863('0x22')])['then'](function(_0x2d70d5){var _0x2a35b0=util[_0x3863('0x10')](_0x3863('0x8a'),_0x4c8985,_0x467559,_0x4e1eb2,_0x1e3ade[_0x3863('0x22')],_0x1e3ade[_0x3863('0x40')]||null,NOW,NOW);if(_['isNil'](_0x5600dc['scheduledat'])){_0x2a35b0+=_0x3863('0x8b');}_0x2415c2[_0x3863('0x49')](_0x2a35b0);if(_0x1e3ade[_0x3863('0x83')]&&_0x1e3ade[_0x3863('0x83')][_0x3863('0x55')]){_0x2415c2[_0x3863('0x49')](insertCmContact(_0x1e3ade['ListId'],_0x467559,_0x1e3ade[_0x3863('0x83')],_0x5600dc));_0x2415c2[_0x3863('0x49')](_0x3863('0x8c')+_0x467559+';');}if(hasTZ){_0x2415c2[_0x3863('0x49')](insertTzCmHopper(_0x1e3ade[_0x3863('0x22')],_0x3863('0x8d'),_0x3863('0x8e'),'VoiceQueueId',_0x1f43a2,tmp_voice_queues));_0x2415c2[_0x3863('0x49')](insertTzCmHopperBlack(_0x1e3ade['ListId'],_0x3863('0x8f'),_0x3863('0x8e'),_0x3863('0x90')));_0x2415c2[_0x3863('0x49')](insertTzCmHopper(_0x1e3ade['ListId'],_0x3863('0x52'),_0x3863('0x91'),_0x3863('0x92'),_0x1f43a2,tmp_campaigns));_0x2415c2[_0x3863('0x49')](insertTzCmHopperBlack(_0x1e3ade[_0x3863('0x22')],'campaigns_has_cm_blacklists',_0x3863('0x91'),_0x3863('0x92')));}else{_0x2415c2[_0x3863('0x49')](insertCmHopper(_0x1e3ade[_0x3863('0x22')],'voice_queues_has_cm_lists',_0x3863('0x8e'),_0x3863('0x90'),_0x1f43a2));_0x2415c2[_0x3863('0x49')](insertCmHopperBlack(_0x1e3ade[_0x3863('0x22')],_0x3863('0x8f'),_0x3863('0x8e'),_0x3863('0x90')));_0x2415c2[_0x3863('0x49')](insertCmHopper(_0x1e3ade[_0x3863('0x22')],_0x3863('0x52'),_0x3863('0x91'),_0x3863('0x92'),_0x1f43a2));_0x2415c2[_0x3863('0x49')](insertCmHopperBlack(_0x1e3ade['ListId'],_0x3863('0x93'),_0x3863('0x91'),'CampaignId'));}_0x2415c2[_0x3863('0x49')](_0x3863('0x8c')+tmp_campaigns+';');_0x2415c2[_0x3863('0x49')](_0x3863('0x8c')+tmp_voice_queues+';');BPromise[_0x3863('0x89')](_0x2415c2,handleQuery)['then'](function(_0x5c2bc7){stats[_0x3863('0x94')]=!![];stats['affectedRows']=_0x1e3ade[_0x3863('0x83')]&&_0x1e3ade[_0x3863('0x83')][_0x3863('0x55')]?results[0x2][_0x3863('0x95')]:results[0x0][_0x3863('0x95')];socket['emit']('contact:import:'+_0x400899,stats);fs['unlink'](_0x34295f);fs[_0x3863('0x96')](_0x4c8985);process[_0x3863('0x47')](0x0);})['catch'](function(_0x5a6e7b){logger[_0x3863('0x46')](_0x5a6e7b['message']);process[_0x3863('0x47')](0x1);});});});});}catch(_0x4fe489){logger[_0x3863('0x46')]('complete',_0x4fe489[_0x3863('0x4b')]);process[_0x3863('0x47')](0x1);}},'error':function(_0x2bb677,_0x139e7f,_0x575d4d,_0x330d19){throw new Error(_0x330d19);}});}function validate(){if(process[_0x3863('0x97')]&&process[_0x3863('0x97')][_0x3863('0x55')]<0x4){throw new Error(_0x3863('0x98'));}var _0x371636=path[_0x3863('0x18')](config[_0x3863('0x64')],_0x3863('0x65'),process[_0x3863('0x97')][0x2]);if(!fs[_0x3863('0x99')](_0x371636)){throw new Error(_0x3863('0x9a'));}var _0x27dc91={};try{_0x27dc91=JSON[_0x3863('0x6b')](process['argv'][0x3]);if(!_0x27dc91['binding']){throw new Error(_0x3863('0x9b'));}if(!_0x27dc91[_0x3863('0x9c')][_0x3863('0x20')]){throw new Error(_0x3863('0x9d'));}if(!_0x27dc91[_0x3863('0x9c')][_0x3863('0x7c')]){throw new Error(_0x3863('0x9e'));}var _0x61e0df=0x0;if(_0x27dc91[_0x3863('0x9c')]['UserId']){_0x61e0df=0x1;}if(!_0x27dc91['ListId']){throw new Error(_0x3863('0x9f'));}}catch(_0xf4d601){throw new Error(_0x3863('0xa0'));}var _0x5cdb77=[];try{_0x5cdb77=_[_0x3863('0xa1')](JSON[_0x3863('0x6b')](process[_0x3863('0x97')][0x4]),'id');}catch(_0x4d734c){logger[_0x3863('0x44')](_0x3863('0xa2'));}main(_0x371636,_0x27dc91,_0x5cdb77,_0x61e0df);}validate();process['on'](_0x3863('0xa3'),handleStop);process['on'](_0x3863('0xa4'),handleUncaughtException); \ No newline at end of file +var _0x2779=['CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','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','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','insert','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone','cm_contacts.updatedAt','cm_hopper_black','phone','ListId','ListId\x20=\x20?','toString','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','scheduledat','recallme','.CmListId','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','errors','push','sequelize','query','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','length','all','then','voice_queues.id','voice_queues.dialTimezone','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','catch','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','start','binding','root','server/files/tmp','includes','header','writeFileSync','createReadStream','data','hasOwnProperty','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','email\x20wrong\x20format','dateOfBirth','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','isNil','firstName','\x20not\x20specified','SystemRow','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates'];(function(_0x32905d,_0x2ed18c){var _0x2c3f12=function(_0x2a478b){while(--_0x2a478b){_0x32905d['push'](_0x32905d['shift']());}};_0x2c3f12(++_0x2ed18c);}(_0x2779,0x146));var _0x9277=function(_0x20128d,_0x36e7cf){_0x20128d=_0x20128d-0x0;var _0x23d142=_0x2779[_0x20128d];return _0x23d142;};'use strict';var fs=require('fs');var path=require(_0x9277('0x0'));var _=require(_0x9277('0x1'));var Papa=require(_0x9277('0x2'));var util=require(_0x9277('0x3'));var BPromise=require('bluebird');var moment=require(_0x9277('0x4'));var squel=require(_0x9277('0x5'));var Redis=require('ioredis');var db=require(_0x9277('0x6'))['db'];var config=require(_0x9277('0x7'));var shared=require(_0x9277('0x8'));var logger=require('../../../config/logger')('import');config[_0x9277('0x9')]=_['defaults'](config[_0x9277('0x9')],{'host':_0x9277('0xa'),'port':0x18eb});var socket=require(_0x9277('0xb'))(new Redis(config[_0x9277('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x9277('0xc')](_0x9277('0xd'));function isEmail(_0x4635c6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x4635c6);}function selectNotIn(_0x48991b,_0x2387ac,_0x15359d,_0x38435b,_0x381b21){return squel[_0x9277('0xe')]()[_0x9277('0xf')]('phone')[_0x9277('0x10')](_0x38435b)[_0x9277('0x11')](_0x2387ac,null,_0x2387ac+_0x9277('0x12')+_0x38435b+'.'+_0x15359d)[_0x9277('0x13')](_0x38435b+'.'+_0x15359d+_0x9277('0x14')+_0x48991b+'.'+_0x15359d)['where'](_0x2387ac+_0x9277('0x15')+_0x381b21['join']()+')');}function insertCmHopper(_0x41b697,_0x1239c1,_0x1ae942,_0x35067e,_0x3e67ad){var _0x16e2b4=['cm_contacts.phone',_0x9277('0x16'),_0x9277('0x17'),_0x9277('0x18'),_0x1239c1+'.'+_0x35067e,_0x9277('0x19'),'cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x3e67ad+'\x22'];return squel[_0x9277('0x1a')]()[_0x9277('0x1b')](_0x9277('0x1c'))[_0x9277('0x1d')](['phone','scheduledat',_0x9277('0x1e'),'ListId',_0x35067e,_0x9277('0x1f'),_0x9277('0x20'),_0x9277('0x21'),_0x9277('0x22'),'recallme'],squel['select']()[_0x9277('0x23')](_0x16e2b4)['from'](_0x1239c1)[_0x9277('0x11')](_0x9277('0x24'),null,_0x9277('0x25')+_0x1239c1+'.CmListId')['join'](_0x1ae942,null,_0x1ae942+_0x9277('0x12')+_0x1239c1+'.'+_0x35067e)[_0x9277('0x13')](_0x1239c1+_0x9277('0x26'),_0x41b697)[_0x9277('0x13')](_0x9277('0x27'),NOW)[_0x9277('0x13')](_0x9277('0x28'),selectNotIn(_0x1239c1,_0x1ae942,_0x35067e,_0x9277('0x1c'),[_0x9277('0x29'),_0x9277('0x2a')]))[_0x9277('0x13')](_0x9277('0x28'),selectNotIn(_0x1239c1,_0x1ae942,_0x35067e,_0x9277('0x1c'),[_0x9277('0x29')])))['toString']();}function insertCmHopperBlack(_0x36a707,_0x3dd96c,_0x1c7227,_0x1b5fd6){var _0xdc86d0=[_0x9277('0x2b'),_0x9277('0x17'),_0x9277('0x18'),_0x3dd96c+'.'+_0x1b5fd6,_0x9277('0x19'),_0x9277('0x2c')];return squel[_0x9277('0x1a')]()[_0x9277('0x1b')](_0x9277('0x2d'))[_0x9277('0x1d')]([_0x9277('0x2e'),'ContactId',_0x9277('0x2f'),_0x1b5fd6,_0x9277('0x1f'),'updatedAt'],squel[_0x9277('0xe')]()['fields'](_0xdc86d0)[_0x9277('0x10')](_0x3dd96c)['join'](_0x9277('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x3dd96c+'.CmListId')['join'](_0x1c7227,null,_0x1c7227+_0x9277('0x12')+_0x3dd96c+'.'+_0x1b5fd6)[_0x9277('0x13')](_0x3dd96c+'.CmListId\x20=\x20?',_0x36a707)[_0x9277('0x13')](_0x9277('0x27'),NOW)[_0x9277('0x13')](_0x9277('0x28'),squel['select']()[_0x9277('0xf')](_0x9277('0x2e'))[_0x9277('0x10')]('cm_hopper_black')['where'](_0x9277('0x30'),_0x36a707)['where'](_0x1b5fd6+'\x20=\x20?',_0x3dd96c+'.'+_0x1b5fd6)))[_0x9277('0x31')]();}function insertTzCmHopper(_0x2125b1,_0x1c2820,_0x4c336a,_0x4e5392,_0x336b63,_0x3845d5){var _0x333242=[_0x9277('0x2b'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x3845d5+_0x9277('0x32'),_0x9277('0x17'),_0x9277('0x18'),_0x1c2820+'.'+_0x4e5392,_0x9277('0x19'),_0x9277('0x2c'),_0x9277('0x33'),'cm_contacts.UserId','\x22'+_0x336b63+'\x22'];var _0x93193c=squel[_0x9277('0x1a')]()[_0x9277('0x1b')]('cm_hopper')[_0x9277('0x1d')]([_0x9277('0x2e'),_0x9277('0x34'),'ContactId','ListId',_0x4e5392,'createdAt',_0x9277('0x20'),_0x9277('0x21'),'UserId',_0x9277('0x35')],squel[_0x9277('0xe')]()[_0x9277('0x23')](_0x333242)[_0x9277('0x10')](_0x1c2820)[_0x9277('0x11')]('cm_contacts',null,_0x9277('0x25')+_0x1c2820+'.CmListId')[_0x9277('0x11')](_0x4c336a,null,_0x4c336a+'.id\x20=\x20'+_0x1c2820+'.'+_0x4e5392)[_0x9277('0x11')](_0x3845d5,null,_0x3845d5+'.id\x20=\x20'+_0x1c2820+'.'+_0x4e5392)[_0x9277('0x13')](_0x1c2820+'.CmListId\x20=\x20?',_0x2125b1)[_0x9277('0x13')](_0x9277('0x27'),NOW)[_0x9277('0x13')](_0x9277('0x28'),selectNotIn(_0x1c2820,_0x4c336a,_0x4e5392,_0x9277('0x1c'),[_0x9277('0x29'),_0x9277('0x2a')]))[_0x9277('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1c2820,_0x4c336a,_0x4e5392,_0x9277('0x1c'),[_0x9277('0x29')])))[_0x9277('0x31')]();return _0x93193c;}function insertTzCmHopperBlack(_0x15914e,_0x44137e,_0x290ae5,_0x17e770){var _0x533702=[_0x9277('0x2b'),_0x9277('0x17'),'cm_contacts.ListId',_0x44137e+'.'+_0x17e770,_0x9277('0x19'),'cm_contacts.updatedAt'];return squel[_0x9277('0x1a')]()['into'](_0x9277('0x2d'))['fromQuery']([_0x9277('0x2e'),'ContactId','ListId',_0x17e770,'createdAt',_0x9277('0x20')],squel[_0x9277('0xe')]()[_0x9277('0x23')](_0x533702)[_0x9277('0x10')](_0x44137e)[_0x9277('0x11')]('cm_contacts',null,_0x9277('0x25')+_0x44137e+_0x9277('0x36'))[_0x9277('0x11')](_0x290ae5,null,_0x290ae5+'.id\x20=\x20'+_0x44137e+'.'+_0x17e770)[_0x9277('0x13')](_0x44137e+'.CmListId\x20=\x20?',_0x15914e)[_0x9277('0x13')](_0x9277('0x27'),NOW)[_0x9277('0x13')](_0x9277('0x28'),squel[_0x9277('0xe')]()[_0x9277('0xf')](_0x9277('0x2e'))[_0x9277('0x10')](_0x9277('0x2d'))[_0x9277('0x13')](_0x9277('0x30'),_0x15914e)['where'](_0x17e770+'\x20=\x20?',_0x44137e+'.'+_0x17e770)))[_0x9277('0x31')]();}function insertCmContact(_0x2a8481,_0x262436,_0xa6e6ad,_0xec61b0){var _0x2fa06f=_['concat'](_[_0x9277('0x37')](_0xec61b0),[_0x9277('0x2f'),_0x9277('0x38'),_0x9277('0x1f'),_0x9277('0x20')]);return squel['insert']()['into']('cm_contacts')[_0x9277('0x1d')](_0x2fa06f,squel[_0x9277('0xe')]()[_0x9277('0x23')](_0x2fa06f)[_0x9277('0x10')](_0x262436)[_0x9277('0x13')]('('+_0xa6e6ad[_0x9277('0x11')](',')+_0x9277('0x39'),squel['select']()[_0x9277('0x23')](_0xa6e6ad)[_0x9277('0x10')]('cm_contacts')[_0x9277('0x13')](_0x9277('0x30'),_0x2a8481)[_0x9277('0x13')](_0x9277('0x3a')))[_0x9277('0x13')](_0x9277('0x3b'),squel[_0x9277('0xe')]()[_0x9277('0xf')](_0x9277('0x3c'),_0x9277('0x3d'))['from'](_0x262436)[_0x9277('0x3e')](_0xa6e6ad['join'](','))))['toString']();}function handleStop(){logger[_0x9277('0x3f')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4e004e){logger[_0x9277('0x40')](_0x4e004e[_0x9277('0x41')]);process[_0x9277('0x42')](0x1);}function handleError(_0x4cc145,_0x474a18){stats[_0x9277('0x43')][_0x9277('0x44')]({'name':_0x474a18['code'],'message':_0x474a18[_0x9277('0x41')],'row':_0x4cc145});}function handleQuery(_0x3572d0){logger[_0x9277('0x3f')](_0x3572d0);return db[_0x9277('0x45')][_0x9277('0x46')](_0x3572d0)['spread'](function(_0x4f6c2b){results[_0x9277('0x44')](_0x4f6c2b);})['catch'](function(_0x1e2ea5){logger[_0x9277('0x40')](_0x1e2ea5[_0x9277('0x41')]);});}function updateTzCampaigns(_0x22f9c3){return new Promise(function(_0x21db42,_0x1f2231){var _0x587eac=squel['select']()[_0x9277('0x23')]([_0x9277('0x47'),_0x9277('0x48')])[_0x9277('0x10')](_0x9277('0x49'))[_0x9277('0x11')]('campaigns_has_cm_lists',null,_0x9277('0x4a'))[_0x9277('0x13')](_0x9277('0x4b')+_0x22f9c3);db[_0x9277('0x45')][_0x9277('0x46')](_0x587eac[_0x9277('0x31')]())[_0x9277('0x4c')](function(_0x5c2862){var _0x47ada3=[];for(var _0x59fa71=0x0;_0x59fa71<_0x5c2862[_0x9277('0x4d')];_0x59fa71++){_0x47ada3['push'](getTimezoneData(_0x5c2862[_0x59fa71],tmp_campaigns));}BPromise[_0x9277('0x4e')](_0x47ada3)[_0x9277('0x4f')](function(){_0x21db42({'val':0x1});});})['catch'](function(_0x288751){logger[_0x9277('0x40')](_0x288751[_0x9277('0x41')]);_0x21db42({'val':0x0});});});}function updateTzVoiceQueues(_0x16d578){return new Promise(function(_0x27f518,_0x537498){var _0x3294ed=squel['select']()[_0x9277('0x23')]([_0x9277('0x50'),_0x9277('0x51')])['from']('voice_queues')[_0x9277('0x11')]('voice_queues_has_cm_lists',null,_0x9277('0x52'))[_0x9277('0x13')](_0x9277('0x53')+_0x16d578);db['sequelize'][_0x9277('0x46')](_0x3294ed['toString']())[_0x9277('0x4c')](function(_0x510147){var _0x3d4094=[];for(var _0x6a7e74=0x0;_0x6a7e74<_0x510147[_0x9277('0x4d')];_0x6a7e74++){_0x3d4094[_0x9277('0x44')](getTimezoneData(_0x510147[_0x6a7e74],tmp_voice_queues));}BPromise[_0x9277('0x4e')](_0x3d4094)['then'](function(){_0x27f518({'val':0x1});});})[_0x9277('0x54')](function(_0x1749e8){logger[_0x9277('0x40')](_0x1749e8['message']);_0x27f518({'val':0x0});});});}function getTimezoneData(_0x36511e,_0x3d4d5d){return new Promise(function(_0x850af8,_0x28e586){var _0xef5590=shared[_0x9277('0x55')];var _0x3610ee=_0xef5590[_0x36511e[_0x9277('0x56')]];if(_['isNil'](_0x3610ee)){_0x850af8({'ret':0x1});}else{var _0x471528=_0x3610ee[_0x9277('0x57')];var _0x356846=squel[_0x9277('0x1a')]()['into'](_0x3d4d5d)[_0x9277('0x58')]('id',_0x36511e['id'])[_0x9277('0x58')](_0x9277('0x59'),_0x471528)[_0x9277('0x58')](_0x9277('0x56'),_0x36511e[_0x9277('0x56')])[_0x9277('0x31')]();return db[_0x9277('0x45')][_0x9277('0x46')](_0x356846)[_0x9277('0x4c')](function(_0x5b73b2){_0x850af8({'ret':0x1});})[_0x9277('0x54')](function(_0x56bf21){logger[_0x9277('0x40')](_0x56bf21['message']);_0x28e586({'ret':0x1});});}});}function handleTZQuery(_0x5ad141){logger['info'](_0x5ad141);return db[_0x9277('0x45')][_0x9277('0x46')](_0x5ad141)[_0x9277('0x4c')](function(_0x537eb2){})['catch'](function(_0x22573f){logger[_0x9277('0x40')](_0x22573f['message']);});}function main(_0x37cda2,_0x1fc9e7,_0x1ed044,_0x3abc03){logger[_0x9277('0x3f')](_0x9277('0x5a'),_0x37cda2,JSON[_0x9277('0x5b')](_0x1fc9e7));process[_0x9277('0x5c')](_0x9277('0x5d'));var _0x454247=_0x1fc9e7[_0x9277('0x5e')];var _0x370bd2=_0x1fc9e7['socket_timestamp'];var _0x410776=path[_0x9277('0x11')](config[_0x9277('0x5f')],_0x9277('0x60'),_0x370bd2+'.csv');hasTZ=_[_0x9277('0x37')](_0x454247)[_0x9277('0x61')]('dialTimezone');var _0x392cc8=_[_0x9277('0x37')](_0x454247)[_0x9277('0x11')]();logger['info'](_0x9277('0x62'),_0x392cc8);if(hasTZ)_0x392cc8+=',utcOffset';fs[_0x9277('0x63')](_0x410776,_0x392cc8+'\x0a');Papa['parse'](fs[_0x9277('0x64')](_0x37cda2),{'header':!![],'skipEmptyLines':!![],'step':function(_0xd46fff,_0xe4f3f6){try{for(var _0x20a2c4=0x0,_0xb3074d=[];_0x20a2c4<_0xd46fff[_0x9277('0x65')][_0x9277('0x4d')];_0x20a2c4++){stats['rows']+=0x1;if(_0xd46fff['errors'][_0x20a2c4]){handleError(_0xd46fff['data'][_0x20a2c4],_0xd46fff[_0x9277('0x43')][_0x20a2c4]);}else{var _0x17db44=[];for(var _0x22e15c in _0x454247){if(_0x454247[_0x9277('0x66')](_0x22e15c)){if(_0xd46fff['data'][_0x20a2c4][_0x454247[_0x22e15c]]){var _0x2e1da0=_['trim'](_0xd46fff[_0x9277('0x65')][_0x20a2c4][_0x454247[_0x22e15c]]['replace'](/"/g,'\x27'));switch(_0x22e15c){case'scheduledat':var _0x3fd868=moment(_0x2e1da0,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3fd868['isValid']()){_0xb3074d[_0x9277('0x44')]('\x22'+_0x2e1da0+'\x22');}else{_0x17db44['push'](_0x9277('0x67'));}break;case _0x9277('0x21'):var _0xd7bba9=parseInt(_0x2e1da0);_0x2e1da0=_[_0x9277('0x68')](_0xd7bba9)||_0xd7bba9<0x0||_0xd7bba9>0x4?_0x3abc03?0x3:0x2:_0xd7bba9;_0xb3074d[_0x9277('0x44')]('\x22'+_0x2e1da0+'\x22');break;case _0x9277('0x22'):var _0xa78153=parseInt(_0x2e1da0);if(_['isNumber'](_0xa78153)&&_['includes'](_0x1ed044,_0xa78153)){_0xb3074d[_0x9277('0x44')]('\x22'+_0xa78153+'\x22');}else{_0x17db44[_0x9277('0x44')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x2e1da0)){_0xb3074d['push']('\x22'+_0x2e1da0+'\x22');}else{_0x17db44['push'](_0x9277('0x69'));}break;case _0x9277('0x6a'):var _0x221bf9=moment(_0x2e1da0,'YYYY-MM-DD',!![]);if(_0x221bf9[_0x9277('0x6b')]()){_0xb3074d['push']('\x22'+_0x2e1da0+'\x22');}else{_0x17db44[_0x9277('0x44')](_0x9277('0x6c'));}break;case _0x9277('0x56'):var _0x52f9de=shared[_0x9277('0x55')];var _0x308bab=_0x52f9de[_0x2e1da0];if(!_[_0x9277('0x6d')](_0x308bab)){var _0x117ffc=_0x308bab[_0x9277('0x57')];_0xb3074d[_0x9277('0x44')]('\x22'+_0x2e1da0+'\x22');_0xb3074d[_0x9277('0x44')]('\x22'+_0x117ffc+'\x22');}break;default:_0xb3074d[_0x9277('0x44')]('\x22'+_0x2e1da0+'\x22');}}else{switch(_0x22e15c){case _0x9277('0x6e'):case _0x9277('0x2e'):_0x17db44[_0x9277('0x44')](_0x22e15c+_0x9277('0x6f'));break;default:_0xb3074d[_0x9277('0x44')]('\x22\x22');}}}}if(_0x17db44[_0x9277('0x4d')]){handleError(_0xd46fff[_0x9277('0x65')][_0x20a2c4],{'code':_0x9277('0x70'),'message':_0x17db44[_0x9277('0x11')]()});}else{fs['appendFileSync'](_0x410776,_0xb3074d[_0x9277('0x11')]()+'\x0a');}_0xb3074d=[];}if(!(stats[_0x9277('0x71')]%0xc8)){socket[_0x9277('0x72')](_0x9277('0x73')+_0x370bd2,stats);stats[_0x9277('0x43')]=[];}}if(stopped){logger[_0x9277('0x3f')](_0x9277('0x74'));_0xe4f3f6[_0x9277('0x75')]();}}catch(_0x42fc5f){handleError(_0xd46fff[_0x9277('0x65')][_0x20a2c4],{'code':_0x9277('0x76'),'message':_0x42fc5f[_0x9277('0x41')]});logger[_0x9277('0x40')](_0x9277('0x77'),_0x42fc5f[_0x9277('0x41')]);}},'complete':function(){try{var _0x2b911e=[];var _0x396c05=[];var _0x1b38b8=_0x9277('0x24');if(_0x1fc9e7[_0x9277('0x78')]&&_0x1fc9e7['duplicates'][_0x9277('0x4d')]){_0x1b38b8='cm_contacts_'+_0x370bd2;_0x2b911e[_0x9277('0x44')]('CREATE\x20TABLE\x20'+_0x1b38b8+'\x20LIKE\x20cm_contacts;');}tmp_campaigns='campaigns_'+_0x370bd2;tmp_voice_queues='voice_queues_'+_0x370bd2;_0x396c05['push'](_0x9277('0x79')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x396c05[_0x9277('0x44')](_0x9277('0x79')+tmp_voice_queues+_0x9277('0x7a'));BPromise[_0x9277('0x7b')](_0x396c05,handleTZQuery)[_0x9277('0x4f')](function(_0x3ae524){updateTzCampaigns(_0x1fc9e7[_0x9277('0x2f')])[_0x9277('0x4f')](function(_0x109e3e){updateTzVoiceQueues(_0x1fc9e7[_0x9277('0x2f')])['then'](function(_0x103874){var _0x362656=util[_0x9277('0xc')](_0x9277('0x7c'),_0x410776,_0x1b38b8,_0x392cc8,_0x1fc9e7[_0x9277('0x2f')],_0x1fc9e7[_0x9277('0x38')]||null,NOW,NOW);if(_[_0x9277('0x6d')](_0x454247[_0x9277('0x34')])){_0x362656+=',\x20scheduledAt\x20=\x20NOW()';}_0x2b911e[_0x9277('0x44')](_0x362656);if(_0x1fc9e7[_0x9277('0x78')]&&_0x1fc9e7[_0x9277('0x78')][_0x9277('0x4d')]){_0x2b911e[_0x9277('0x44')](insertCmContact(_0x1fc9e7[_0x9277('0x2f')],_0x1b38b8,_0x1fc9e7[_0x9277('0x78')],_0x454247));_0x2b911e['push'](_0x9277('0x7d')+_0x1b38b8+';');}if(hasTZ){_0x2b911e['push'](insertTzCmHopper(_0x1fc9e7['ListId'],_0x9277('0x7e'),_0x9277('0x7f'),_0x9277('0x80'),_0x3abc03,tmp_voice_queues));_0x2b911e[_0x9277('0x44')](insertTzCmHopperBlack(_0x1fc9e7['ListId'],'voice_queues_has_cm_blacklists',_0x9277('0x7f'),_0x9277('0x80')));_0x2b911e[_0x9277('0x44')](insertTzCmHopper(_0x1fc9e7[_0x9277('0x2f')],'campaigns_has_cm_lists',_0x9277('0x49'),_0x9277('0x81'),_0x3abc03,tmp_campaigns));_0x2b911e[_0x9277('0x44')](insertTzCmHopperBlack(_0x1fc9e7[_0x9277('0x2f')],_0x9277('0x82'),_0x9277('0x49'),_0x9277('0x81')));}else{_0x2b911e['push'](insertCmHopper(_0x1fc9e7[_0x9277('0x2f')],_0x9277('0x7e'),'voice_queues',_0x9277('0x80'),_0x3abc03));_0x2b911e[_0x9277('0x44')](insertCmHopperBlack(_0x1fc9e7[_0x9277('0x2f')],_0x9277('0x83'),_0x9277('0x7f'),'VoiceQueueId'));_0x2b911e[_0x9277('0x44')](insertCmHopper(_0x1fc9e7[_0x9277('0x2f')],_0x9277('0x84'),'campaigns',_0x9277('0x81'),_0x3abc03));_0x2b911e['push'](insertCmHopperBlack(_0x1fc9e7[_0x9277('0x2f')],_0x9277('0x82'),_0x9277('0x49'),'CampaignId'));}_0x2b911e[_0x9277('0x44')](_0x9277('0x7d')+tmp_campaigns+';');_0x2b911e[_0x9277('0x44')](_0x9277('0x7d')+tmp_voice_queues+';');BPromise[_0x9277('0x7b')](_0x2b911e,handleQuery)[_0x9277('0x4f')](function(_0xc8c1ec){stats[_0x9277('0x85')]=!![];stats[_0x9277('0x86')]=_0x1fc9e7['duplicates']&&_0x1fc9e7[_0x9277('0x78')][_0x9277('0x4d')]?results[0x2]['affectedRows']:results[0x0][_0x9277('0x86')];socket[_0x9277('0x72')]('contact:import:'+_0x370bd2,stats);fs[_0x9277('0x87')](_0x37cda2);fs[_0x9277('0x87')](_0x410776);process[_0x9277('0x42')](0x0);})['catch'](function(_0x36ec6a){logger['error'](_0x36ec6a[_0x9277('0x41')]);process[_0x9277('0x42')](0x1);});});});});}catch(_0xf7db7e){logger['error'](_0x9277('0x88'),_0xf7db7e[_0x9277('0x41')]);process[_0x9277('0x42')](0x1);}},'error':function(_0x168841,_0x345428,_0x4666db,_0x358c6b){throw new Error(_0x358c6b);}});}function validate(){if(process[_0x9277('0x89')]&&process[_0x9277('0x89')][_0x9277('0x4d')]<0x4){throw new Error(_0x9277('0x8a'));}var _0x5c9afb=path[_0x9277('0x11')](config[_0x9277('0x5f')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x9277('0x8b')](_0x5c9afb)){throw new Error(_0x9277('0x8c'));}var _0x555e85={};try{_0x555e85=JSON[_0x9277('0x8d')](process[_0x9277('0x89')][0x3]);if(!_0x555e85[_0x9277('0x5e')]){throw new Error(_0x9277('0x8e'));}if(!_0x555e85[_0x9277('0x5e')][_0x9277('0x2e')]){throw new Error(_0x9277('0x8f'));}if(!_0x555e85['binding'][_0x9277('0x6e')]){throw new Error('firstName\x20is\x20mandatory');}var _0x2af379=0x0;if(_0x555e85[_0x9277('0x5e')]['UserId']){_0x2af379=0x1;}if(!_0x555e85[_0x9277('0x2f')]){throw new Error(_0x9277('0x90'));}}catch(_0x2bee09){throw new Error(_0x9277('0x91'));}var _0x2c12df=[];try{_0x2c12df=_[_0x9277('0x92')](JSON[_0x9277('0x8d')](process['argv'][0x4]),'id');}catch(_0x312ae5){logger[_0x9277('0x3f')](_0x9277('0x93'));}main(_0x5c9afb,_0x555e85,_0x2c12df,_0x2af379);}validate();process['on'](_0x9277('0x94'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 930f108..3e86f4a 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 _0x6dcb=['Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Complete','agentcompleteAt','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridname','destexten','Queue','UniqueId','uniqueid'];(function(_0x12a291,_0x114413){var _0x23c9c3=function(_0x3b8c1c){while(--_0x3b8c1c){_0x12a291['push'](_0x12a291['shift']());}};_0x23c9c3(++_0x114413);}(_0x6dcb,0x165));var _0xb6dc=function(_0x214373,_0xf3716f){_0x214373=_0x214373-0x0;var _0x3505d4=_0x6dcb[_0x214373];return _0x3505d4;};'use strict';exports[_0xb6dc('0x0')]=function(_0x244da7,_0x2f2e90){var _0x3f7b19=[{'type':_0xb6dc('0x1'),'content':_0xb6dc('0x2'),'variableName':null}];switch(_0x244da7[_0xb6dc('0x3')]()){case _0xb6dc('0x4'):switch(_0x2f2e90[_0xb6dc('0x3')]()){case _0xb6dc('0x5'):_0x3f7b19[_0xb6dc('0x6')]({'type':_0xb6dc('0x7'),'content':'','variableName':_0xb6dc('0x8')});_0x3f7b19[_0xb6dc('0x6')]({'type':_0xb6dc('0x7'),'content':'','variableName':_0xb6dc('0x9')});break;case _0xb6dc('0xa'):_0x3f7b19['push']({'type':_0xb6dc('0x1'),'content':'Outbound\x20Call','variableName':null});_0x3f7b19['push']({'type':'variable','content':'','variableName':_0xb6dc('0xb')});break;}}return _0x3f7b19;};exports[_0xb6dc('0xc')]=function(_0x25c27d,_0x8487a9){var _0x23dd25=[];switch(_0x25c27d[_0xb6dc('0x3')]()){case _0xb6dc('0x4'):switch(_0x8487a9[_0xb6dc('0x3')]()){case _0xb6dc('0x5'):_0x23dd25=[{'type':_0xb6dc('0x1'),'content':_0xb6dc('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xb6dc('0xe'),'content':'','key':_0xb6dc('0xf'),'keyType':_0xb6dc('0x7'),'variableName':'calleridnum'},{'type':_0xb6dc('0xe'),'content':'','key':'Caller\x20Name','keyType':_0xb6dc('0x7'),'variableName':_0xb6dc('0x10')},{'type':_0xb6dc('0xe'),'content':'','key':'Call\x20To','keyType':_0xb6dc('0x7'),'variableName':_0xb6dc('0x11')},{'type':'keyValue','content':'','key':_0xb6dc('0x12'),'keyType':_0xb6dc('0x7'),'variableName':_0xb6dc('0x8')},{'type':'keyValue','content':'','key':_0xb6dc('0x13'),'keyType':_0xb6dc('0x7'),'variableName':_0xb6dc('0x14')},{'type':'keyValue','content':'','key':_0xb6dc('0x15'),'keyType':_0xb6dc('0x7'),'variableName':'agentcalledAt'},{'type':_0xb6dc('0x1'),'content':_0xb6dc('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0xb6dc('0xe'),'content':'','key':_0xb6dc('0x17'),'keyType':_0xb6dc('0x7'),'variableName':_0xb6dc('0x18')},{'type':_0xb6dc('0xe'),'content':'','key':_0xb6dc('0x19'),'keyType':_0xb6dc('0x7'),'variableName':'destcalleridnum'},{'type':_0xb6dc('0x1'),'content':_0xb6dc('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0xb6dc('0xe'),'content':'','key':_0xb6dc('0x1b'),'keyType':_0xb6dc('0x7'),'variableName':_0xb6dc('0x1c')},{'type':_0xb6dc('0xe'),'content':'','key':'Agent\x20Connect','keyType':_0xb6dc('0x7'),'variableName':'agentconnectAt'},{'type':_0xb6dc('0xe'),'content':'','key':_0xb6dc('0x1d'),'keyType':_0xb6dc('0x7'),'variableName':_0xb6dc('0x1e')},{'type':'keyValue','content':'','key':'Hold\x20Time','keyType':_0xb6dc('0x7'),'variableName':_0xb6dc('0x1f')},{'type':_0xb6dc('0xe'),'content':'','key':_0xb6dc('0x20'),'keyType':'variable','variableName':_0xb6dc('0x21')}];break;case _0xb6dc('0xa'):_0x23dd25=[{'type':'string','content':_0xb6dc('0xd'),'variableName':null},{'type':_0xb6dc('0xe'),'content':'','key':_0xb6dc('0x22'),'keyType':_0xb6dc('0x7'),'keyContent':'','variableName':_0xb6dc('0xb')},{'type':_0xb6dc('0xe'),'content':'','key':_0xb6dc('0x23'),'keyType':_0xb6dc('0x7'),'keyContent':'','variableName':_0xb6dc('0x24')},{'type':_0xb6dc('0xe'),'content':'','key':_0xb6dc('0x13'),'keyType':'variable','keyContent':'','variableName':_0xb6dc('0x14')},{'type':_0xb6dc('0xe'),'content':'','key':_0xb6dc('0x15'),'keyType':_0xb6dc('0x7'),'keyContent':'','variableName':'starttime'},{'type':_0xb6dc('0x1'),'content':_0xb6dc('0x1a')},{'type':_0xb6dc('0xe'),'content':'','key':_0xb6dc('0x25'),'keyType':_0xb6dc('0x7'),'keyContent':'','variableName':'answertime'},{'type':_0xb6dc('0xe'),'content':'','key':_0xb6dc('0x26'),'keyType':'variable','keyContent':'','variableName':_0xb6dc('0x27')},{'type':_0xb6dc('0xe'),'content':'','key':_0xb6dc('0x28'),'keyType':_0xb6dc('0x7'),'keyContent':'','variableName':_0xb6dc('0x29')},{'type':_0xb6dc('0xe'),'content':'','key':'Billable\x20Time','keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x23dd25;}; \ No newline at end of file +var _0x5125=['toLowerCase','push','queue','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','inbound','Caller\x20Number','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','membername','starttime','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]'];(function(_0x50c50b,_0x3a6fb3){var _0x423c29=function(_0x223cf6){while(--_0x223cf6){_0x50c50b['push'](_0x50c50b['shift']());}};_0x423c29(++_0x3a6fb3);}(_0x5125,0x1cc));var _0x5512=function(_0x29be28,_0x41c66c){_0x29be28=_0x29be28-0x0;var _0x39cab0=_0x5125[_0x29be28];return _0x39cab0;};'use strict';exports['getSubjects']=function(_0x4d365a,_0x9ebbb4){var _0x288d51=[{'type':_0x5512('0x0'),'content':_0x5512('0x1'),'variableName':null}];switch(_0x4d365a[_0x5512('0x2')]()){case'voice':switch(_0x9ebbb4['toLowerCase']()){case'inbound':_0x288d51[_0x5512('0x3')]({'type':'variable','content':'','variableName':_0x5512('0x4')});_0x288d51[_0x5512('0x3')]({'type':_0x5512('0x5'),'content':'','variableName':_0x5512('0x6')});break;case _0x5512('0x7'):_0x288d51[_0x5512('0x3')]({'type':'string','content':_0x5512('0x8'),'variableName':null});_0x288d51[_0x5512('0x3')]({'type':'variable','content':'','variableName':_0x5512('0x9')});break;}}return _0x288d51;};exports['getDescriptions']=function(_0x2fc1d2,_0x553cdf){var _0x5f0c83=[];switch(_0x2fc1d2['toLowerCase']()){case'voice':switch(_0x553cdf['toLowerCase']()){case _0x5512('0xa'):_0x5f0c83=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x5512('0xb'),'keyType':'variable','variableName':_0x5512('0x6')},{'type':_0x5512('0xc'),'content':'','key':_0x5512('0xd'),'keyType':_0x5512('0x5'),'variableName':_0x5512('0xe')},{'type':_0x5512('0xc'),'content':'','key':_0x5512('0xf'),'keyType':_0x5512('0x5'),'variableName':_0x5512('0x10')},{'type':_0x5512('0xc'),'content':'','key':_0x5512('0x11'),'keyType':_0x5512('0x5'),'variableName':_0x5512('0x4')},{'type':_0x5512('0xc'),'content':'','key':_0x5512('0x12'),'keyType':_0x5512('0x5'),'variableName':_0x5512('0x13')},{'type':'keyValue','content':'','key':_0x5512('0x14'),'keyType':_0x5512('0x5'),'variableName':_0x5512('0x15')},{'type':_0x5512('0x0'),'content':_0x5512('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x5512('0xc'),'content':'','key':'Agent\x20Name','keyType':_0x5512('0x5'),'variableName':_0x5512('0x17')},{'type':_0x5512('0xc'),'content':'','key':_0x5512('0x18'),'keyType':_0x5512('0x5'),'variableName':_0x5512('0x9')},{'type':_0x5512('0x0'),'content':_0x5512('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x5512('0xc'),'content':'','key':_0x5512('0x1a'),'keyType':_0x5512('0x5'),'variableName':_0x5512('0x15')},{'type':_0x5512('0xc'),'content':'','key':_0x5512('0x1b'),'keyType':_0x5512('0x5'),'variableName':_0x5512('0x1c')},{'type':_0x5512('0xc'),'content':'','key':_0x5512('0x1d'),'keyType':_0x5512('0x5'),'variableName':_0x5512('0x1e')},{'type':_0x5512('0xc'),'content':'','key':_0x5512('0x1f'),'keyType':_0x5512('0x5'),'variableName':_0x5512('0x20')},{'type':_0x5512('0xc'),'content':'','key':'Talk\x20Time','keyType':_0x5512('0x5'),'variableName':'talktime'}];break;case _0x5512('0x7'):_0x5f0c83=[{'type':_0x5512('0x0'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x5512('0xc'),'content':'','key':'Called\x20Number','keyType':_0x5512('0x5'),'keyContent':'','variableName':_0x5512('0x9')},{'type':_0x5512('0xc'),'content':'','key':'Member\x20Name','keyType':_0x5512('0x5'),'keyContent':'','variableName':_0x5512('0x21')},{'type':_0x5512('0xc'),'content':'','key':_0x5512('0x12'),'keyType':_0x5512('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0x5512('0xc'),'content':'','key':_0x5512('0x14'),'keyType':_0x5512('0x5'),'keyContent':'','variableName':_0x5512('0x22')},{'type':'string','content':_0x5512('0x19')},{'type':_0x5512('0xc'),'content':'','key':'Answer\x20Time','keyType':_0x5512('0x5'),'keyContent':'','variableName':_0x5512('0x23')},{'type':'keyValue','content':'','key':_0x5512('0x24'),'keyType':_0x5512('0x5'),'keyContent':'','variableName':_0x5512('0x25')},{'type':_0x5512('0xc'),'content':'','key':_0x5512('0x26'),'keyType':_0x5512('0x5'),'keyContent':'','variableName':_0x5512('0x27')},{'type':_0x5512('0xc'),'content':'','key':_0x5512('0x28'),'keyType':_0x5512('0x5'),'keyContent':'','variableName':_0x5512('0x29')}];break;}}return _0x5f0c83;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 15b39f0..ab202a8 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 _0x11f1=['../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','update','then','info','catch','error','tracked','user','query','clone','omit','body','html','phone','fax','mobile','lodash','../../mysqldb','mail-interactions'];(function(_0x5a99c0,_0x5abf32){var _0x11e1df=function(_0xaed64e){while(--_0xaed64e){_0x5a99c0['push'](_0x5a99c0['shift']());}};_0x11e1df(++_0x5abf32);}(_0x11f1,0x169));var _0x111f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x11f1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x111f('0x0'));var db=require(_0x111f('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require('../../config/logger')(_0x111f('0x2')),'fax':require(_0x111f('0x3'))(_0x111f('0x4')),'sms':require(_0x111f('0x3'))(_0x111f('0x5')),'chat':require(_0x111f('0x3'))(_0x111f('0x6')),'whatsapp':require(_0x111f('0x3'))(_0x111f('0x7'))};function getInteractionId(_0x312de4,_0x1afcfa,_0x50e9b9){if(_0x312de4&&_0x312de4[_[_0x111f('0x8')](_0x50e9b9)+_0x111f('0x9')]){return _0x312de4[_['upperFirst'](_0x50e9b9)+_0x111f('0x9')];}else if(_0x312de4&&_0x312de4['id']){return _0x312de4['id'];}else if(_0x1afcfa&&_0x1afcfa['id']){return _0x1afcfa['id'];}else{return'unknown';}}function log(_0xa6726c,_0x1c9c26,_0x3a2e4c,_0xeb3c4a,_0xa2ad66,_0x1ad9f1){loggers[_0xa2ad66[_0x111f('0xa')]()][_0xa6726c](_0x111f('0xb'),_0x1ad9f1['toUpperCase'](),_0x1c9c26?_0x1c9c26['id']:null,_0x1c9c26?_0x1c9c26['name']:null,_0x1c9c26?_0x1c9c26[_0x111f('0xc')]:null,getInteractionId(_0x3a2e4c,_0xeb3c4a,_0xa2ad66),_0x3a2e4c?JSON['stringify'](_0x3a2e4c):'null');}function updateUser(_0x2ed216,_0x40c9a6,_0x42ceaf,_0x261bf7,_0x49f710){db[_[_0x111f('0x8')](_0x261bf7)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x40c9a6,_0x42ceaf,_0x261bf7)}})['then'](function(_0xd98d5f){if(_0xd98d5f){return _0xd98d5f[_0x111f('0xd')]({'UserId':_0x2ed216?_0x2ed216['id']:null});}})[_0x111f('0xe')](function(_0x2fb9b4){if(_0x2fb9b4){log(_0x111f('0xf'),_0x2ed216,_0x40c9a6,_0x42ceaf,_0x261bf7,_0x49f710);}})[_0x111f('0x10')](function(){log(_0x111f('0x11'),_0x2ed216,_0x40c9a6,_0x42ceaf,_0x261bf7,_0x49f710);});}exports[_0x111f('0x12')]=function(_0x1eb1fe,_0x70c549){return function(_0x19dda6,_0xabb20a,_0x5b7d25){var _0x5e9794=_0x19dda6[_0x111f('0x13')];var _0xa85783={};var _0x247574=_0x19dda6[_0x111f('0x14')];if(_0xa85783){_0xa85783=_[_0x111f('0x15')](_0x19dda6['body']);_0xa85783=_[_0x111f('0x16')](_0xa85783,[_0x111f('0x17'),_0x111f('0x18'),_0x111f('0x19'),_0x111f('0x1a'),_0x111f('0x1b')]);}updateUser(_0x5e9794,_0xa85783,_0x247574,_0x1eb1fe,_0x70c549);_0x5b7d25(null);};}; \ No newline at end of file +var _0x044d=['update','catch','error','tracked','query','clone','body','omit','phone','fax','mobile','../../mysqldb','../../config/logger','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','findOne','then'];(function(_0x1b52c6,_0x18b627){var _0x4ef750=function(_0x4a106e){while(--_0x4a106e){_0x1b52c6['push'](_0x1b52c6['shift']());}};_0x4ef750(++_0x18b627);}(_0x044d,0x18b));var _0xd044=function(_0x8b33f3,_0xd07b70){_0x8b33f3=_0x8b33f3-0x0;var _0xb78ec=_0x044d[_0x8b33f3];return _0xb78ec;};'use strict';var _=require('lodash');var db=require(_0xd044('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0xd044('0x1'))('mail-interactions'),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0xd044('0x1'))(_0xd044('0x2')),'chat':require(_0xd044('0x1'))(_0xd044('0x3')),'whatsapp':require(_0xd044('0x1'))(_0xd044('0x4'))};function getInteractionId(_0x38f70f,_0x51e09d,_0x536461){if(_0x38f70f&&_0x38f70f[_[_0xd044('0x5')](_0x536461)+'InteractionId']){return _0x38f70f[_[_0xd044('0x5')](_0x536461)+'InteractionId'];}else if(_0x38f70f&&_0x38f70f['id']){return _0x38f70f['id'];}else if(_0x51e09d&&_0x51e09d['id']){return _0x51e09d['id'];}else{return'unknown';}}function log(_0x39c59e,_0x2d59ae,_0x4b7ddd,_0x3c9521,_0x4be351,_0x2eab9a){loggers[_0x4be351['toLowerCase']()][_0x39c59e](_0xd044('0x6'),_0x2eab9a[_0xd044('0x7')](),_0x2d59ae?_0x2d59ae['id']:null,_0x2d59ae?_0x2d59ae[_0xd044('0x8')]:null,_0x2d59ae?_0x2d59ae[_0xd044('0x9')]:null,getInteractionId(_0x4b7ddd,_0x3c9521,_0x4be351),_0x4b7ddd?JSON[_0xd044('0xa')](_0x4b7ddd):'null');}function updateUser(_0x38c20f,_0x3790dc,_0x1bbe34,_0x4d4aba,_0x340018){db[_['upperFirst'](_0x4d4aba)+'Interaction'][_0xd044('0xb')]({'where':{'id':getInteractionId(_0x3790dc,_0x1bbe34,_0x4d4aba)}})[_0xd044('0xc')](function(_0x305e81){if(_0x305e81){return _0x305e81[_0xd044('0xd')]({'UserId':_0x38c20f?_0x38c20f['id']:null});}})['then'](function(_0x5af615){if(_0x5af615){log('info',_0x38c20f,_0x3790dc,_0x1bbe34,_0x4d4aba,_0x340018);}})[_0xd044('0xe')](function(){log(_0xd044('0xf'),_0x38c20f,_0x3790dc,_0x1bbe34,_0x4d4aba,_0x340018);});}exports[_0xd044('0x10')]=function(_0x48a251,_0x1f8174){return function(_0x470e75,_0x4a36b8,_0x5011ac){var _0x3e9d0c=_0x470e75['user'];var _0x454535={};var _0x4bb8a7=_0x470e75[_0xd044('0x11')];if(_0x454535){_0x454535=_[_0xd044('0x12')](_0x470e75[_0xd044('0x13')]);_0x454535=_[_0xd044('0x14')](_0x454535,['body','html',_0xd044('0x15'),_0xd044('0x16'),_0xd044('0x17')]);}updateUser(_0x3e9d0c,_0x454535,_0x4bb8a7,_0x48a251,_0x1f8174);_0x5011ac(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 80471e9..d361328 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 _0xb7eb=['parse','hasOwnProperty','use','License','findOne','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','base64','utf8','final'];(function(_0x5b05f8,_0xc7af0f){var _0x56d258=function(_0x13fe70){while(--_0x13fe70){_0x5b05f8['push'](_0x5b05f8['shift']());}};_0x56d258(++_0xc7af0f);}(_0xb7eb,0x17a));var _0xbb7e=function(_0x5f246f,_0x5b45d9){_0x5f246f=_0x5f246f-0x0;var _0x1bbbf9=_0xb7eb[_0x5f246f];return _0x1bbbf9;};'use strict';var crypto=require(_0xbb7e('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0xbb7e('0x1'))['db'];var config=require(_0xbb7e('0x2'));function getValueFromLicense(_0x196e81,_0x180d61){if(_0x196e81&&_0x180d61){if(_0x180d61[_0xbb7e('0x3')]&&_0x180d61[_0xbb7e('0x4')]){var _0x467d41=_0x180d61[_0xbb7e('0x3')];var _0x166ee1=_0x180d61[_0xbb7e('0x4')];var _0x421a81=_0x467d41[_0xbb7e('0x5')]('-')[0x4];var _0x50e5da=_0x467d41[_0xbb7e('0x5')]('-')[0x0];var _0x2188f4=crypto[_0xbb7e('0x6')](_0xbb7e('0x7'),util[_0xbb7e('0x8')]('%s:%s:%s',_0x421a81,_0x467d41,_0x50e5da));var _0x5d2661=_0x2188f4['update'](_0x166ee1,_0xbb7e('0x9'),_0xbb7e('0xa'));_0x5d2661+=_0x2188f4[_0xbb7e('0xb')](_0xbb7e('0xa'));var _0x2efb2a=JSON[_0xbb7e('0xc')](_0x5d2661);return _0x2efb2a[_0xbb7e('0xd')](_0x196e81)?_0x2efb2a[_0x196e81]:null;}}return null;}function isLimit(_0x532468,_0x5428e9,_0x27ea2a,_0x109745){var _0x1a0026=_0x5428e9;return compose()[_0xbb7e('0xe')](function(_0x45db3f,_0x106a2a,_0x5a6354){return db[_0xbb7e('0xf')][_0xbb7e('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x14e964){var _0x56eaaa=getValueFromLicense(_0x532468,_0x14e964);return _0x56eaaa?_0x56eaaa:_0x1a0026;})[_0xbb7e('0x11')](function(_0x4ff906){_0x1a0026=_0x4ff906;return _0x27ea2a[_0xbb7e('0x12')](_0x109745);})[_0xbb7e('0x11')](function(_0x348911){if(_0x348911>=_0x1a0026){return _0x106a2a['status'](0x193)['json']({'message':util['format'](_0xbb7e('0x13'),_0x532468)});}_0x5a6354();})[_0xbb7e('0x14')](function(_0x2738fb){_0x5a6354(_0x2738fb);});});}function isUserLimit(){return isLimit(_0xbb7e('0x15'),0x1,db[_0xbb7e('0x16')],{'where':{'$or':[{'role':_0xbb7e('0x17')},{'role':_0xbb7e('0x18')}]}});}exports[_0xbb7e('0x19')]=isUserLimit; \ No newline at end of file +var _0x5363=['license','split','createDecipher','aes-256-ctr','format','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5363,0x191));var _0x3536=function(_0x2d7683,_0x40a984){_0x2d7683=_0x2d7683-0x0;var _0x297dfe=_0x5363[_0x2d7683];return _0x297dfe;};'use strict';var crypto=require(_0x3536('0x0'));var util=require(_0x3536('0x1'));var compose=require(_0x3536('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x3536('0x3'));function getValueFromLicense(_0x17c86c,_0x33f908){if(_0x17c86c&&_0x33f908){if(_0x33f908[_0x3536('0x4')]&&_0x33f908['license']){var _0x5c2325=_0x33f908['data1'];var _0x23fd93=_0x33f908[_0x3536('0x5')];var _0x1e16b1=_0x5c2325[_0x3536('0x6')]('-')[0x4];var _0x4a493a=_0x5c2325['split']('-')[0x0];var _0x4a2fea=crypto[_0x3536('0x7')](_0x3536('0x8'),util[_0x3536('0x9')]('%s:%s:%s',_0x1e16b1,_0x5c2325,_0x4a493a));var _0x4e4766=_0x4a2fea[_0x3536('0xa')](_0x23fd93,_0x3536('0xb'),_0x3536('0xc'));_0x4e4766+=_0x4a2fea[_0x3536('0xd')]('utf8');var _0x56e61b=JSON[_0x3536('0xe')](_0x4e4766);return _0x56e61b[_0x3536('0xf')](_0x17c86c)?_0x56e61b[_0x17c86c]:null;}}return null;}function isLimit(_0x59bfa5,_0x21202a,_0x4b1891,_0x5c6aeb){var _0x165839=_0x21202a;return compose()[_0x3536('0x10')](function(_0x916af8,_0x49f252,_0x3b8293){return db[_0x3536('0x11')][_0x3536('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x3536('0x13')](function(_0x2dd150){var _0x44cfcf=getValueFromLicense(_0x59bfa5,_0x2dd150);return _0x44cfcf?_0x44cfcf:_0x165839;})[_0x3536('0x13')](function(_0x793249){_0x165839=_0x793249;return _0x4b1891[_0x3536('0x14')](_0x5c6aeb);})[_0x3536('0x13')](function(_0x2cc2bd){if(_0x2cc2bd>=_0x165839){return _0x49f252[_0x3536('0x15')](0x193)[_0x3536('0x16')]({'message':util[_0x3536('0x9')](_0x3536('0x17'),_0x59bfa5)});}_0x3b8293();})['catch'](function(_0x3e2931){_0x3b8293(_0x3e2931);});});}function isUserLimit(){return isLimit(_0x3536('0x18'),0x1,db[_0x3536('0x19')],{'where':{'$or':[{'role':_0x3536('0x1a')},{'role':_0x3536('0x1b')}]}});}exports[_0x3536('0x1c')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 26ed020..d44f469 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 _0x99b4=['$lt','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$endsWith','start','pop','utcOffset','add','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','split','slice','forEach','shift','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','format','YYYY-MM-DD','CAST(','field','\x20AS\x20','castTo','text','$ne','\x20OR\x20','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','LIKE\x20?'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0x99b4,0x15d));var _0x499b=function(_0x5ebc07,_0x7f5dfe){_0x5ebc07=_0x5ebc07-0x0;var _0x49d229=_0x99b4[_0x5ebc07];return _0x49d229;};'use strict';var _=require(_0x499b('0x0'));var moment=require(_0x499b('0x1'));exports['parseSearch']=function(_0x38b7a6){var _0x2c884d={'conditions':[]};_0x2c884d[_0x499b('0x2')]=_[_0x499b('0x3')](_0x38b7a6,_0x499b('0x4'))?'or':_0x499b('0x5');var _0x4f55d8=_0x38b7a6[_0x499b('0x6')]('[$and]','')[_0x499b('0x6')](_0x499b('0x4'),'')['split']('||');for(var _0x4e9491=0x0;_0x4e9491<_0x4f55d8['length'];_0x4e9491++){var _0xeb452e=_0x4f55d8[_0x4e9491][_0x499b('0x7')](':=');var _0xd9100c=_0xeb452e[0x0];var _0x31671d=_0xeb452e[_0x499b('0x8')](0x1);_0x31671d[_0x499b('0x9')](function(_0x240c6f){var _0x208f06=_0x240c6f[_0x499b('0x7')]('[')[_0x499b('0xa')]();var _0x18eb1e=_0x240c6f[_0x499b('0xb')](/\[(.*?)\]/g);_0x18eb1e['forEach'](function(_0x9033bb){var _0x47d9af=_0x9033bb[_0x499b('0x7')]('[')[_0x499b('0xc')](function(_0x2b4150){return _0x2b4150[_0x499b('0xd')](']')>-0x1;})['map'](function(_0x185d09){return _0x185d09[_0x499b('0x7')](']')[0x0];})[0x0];_0x2c884d[_0x499b('0xe')][_0x499b('0xf')]({'field':_0xd9100c,'operator':_0x208f06,'value':_0x47d9af});});});}return _0x2c884d;};exports[_0x499b('0x10')]=function(_0x2c2cae,_0x1afd78,_0x10a4dc){var _0x57f3ce={};if(_0x1afd78===_0x499b('0x11')){if(_0x10a4dc[_0x499b('0x12')]===_0x499b('0x13')){_0x10a4dc[_0x499b('0x12')]=_0x499b('0x14');_0x10a4dc[_0x499b('0x15')]+=','+_0x10a4dc['value'];}else if(_[_0x499b('0x16')]([_0x499b('0x17'),_0x499b('0x18')],_0x10a4dc['operator'])){_0x10a4dc[_0x499b('0x15')]=moment(_0x10a4dc[_0x499b('0x15')])['add'](0x1,_0x499b('0x19'))[_0x499b('0x1a')](_0x499b('0x1b'));}}if(_0x10a4dc['castTo']){_0x1afd78=_0x10a4dc['castTo'];_0x57f3ce['text']=_0x499b('0x1c')+_0x2c2cae+'.'+_0x10a4dc[_0x499b('0x1d')]+_0x499b('0x1e')+_0x10a4dc[_0x499b('0x1f')]+')\x20'+parseOperator(_0x10a4dc[_0x499b('0x12')]);}else{_0x57f3ce[_0x499b('0x20')]=_0x2c2cae+'.'+_0x10a4dc['field']+'\x20'+parseOperator(_0x10a4dc[_0x499b('0x12')]);}if(_['includes']([_0x499b('0x21'),'$notIn'],_0x10a4dc[_0x499b('0x12')]))_0x57f3ce[_0x499b('0x20')]='('+_0x57f3ce[_0x499b('0x20')]+_0x499b('0x22')+_0x2c2cae+'.'+_0x10a4dc['field']+'\x20IS\x20NULL)';_0x57f3ce['value']=parseValue(_0x1afd78,_0x10a4dc[_0x499b('0x12')],_0x10a4dc[_0x499b('0x15')]);return _0x57f3ce;};function parseOperator(_0x5091d8){var _0x1a7fd4;switch(_0x5091d8){case _0x499b('0x23'):_0x1a7fd4=_0x499b('0x24');break;case _0x499b('0x25'):_0x1a7fd4=_0x499b('0x26');break;case _0x499b('0x13'):_0x1a7fd4=_0x499b('0x27');break;case'$ne':_0x1a7fd4='<>\x20?';break;case _0x499b('0x28'):case _0x499b('0x29'):case'$endsWith':_0x1a7fd4=_0x499b('0x2a');break;case _0x499b('0x2b'):_0x1a7fd4=_0x499b('0x2c');break;case'$gt':_0x1a7fd4='>\x20?';break;case'$lte':_0x1a7fd4=_0x499b('0x2d');break;case _0x499b('0x2e'):_0x1a7fd4=_0x499b('0x2f');break;case _0x499b('0x14'):_0x1a7fd4=_0x499b('0x30');break;}return _0x1a7fd4;}function parseValue(_0x14096c,_0x306bb8,_0x1c9add){var _0x138edb={'start':undefined,'end':undefined};switch(_0x306bb8){case _0x499b('0x23'):case'$notIn':_0x138edb['start']=_0x1c9add[_0x499b('0x7')](',');break;case _0x499b('0x28'):_0x138edb['start']='%'+_0x1c9add+'%';break;case _0x499b('0x29'):_0x138edb['start']=_0x1c9add+'%';break;case _0x499b('0x31'):_0x138edb[_0x499b('0x32')]='%'+_0x1c9add;break;case _0x499b('0x14'):var _0x57d510=_0x1c9add[_0x499b('0x7')](',');var _0x1c9add=_0x57d510[_0x499b('0xa')]();var _0x2147b8=_0x57d510[_0x499b('0x33')]();if(_0x14096c==='DATE'){_0x1c9add=moment(_0x1c9add)[_0x499b('0x34')](0x0,!![])[_0x499b('0x1a')]();_0x2147b8=moment(_0x2147b8)[_0x499b('0x34')](0x0,!![])[_0x499b('0x35')](0x17,'hours')[_0x499b('0x35')](0x3b,_0x499b('0x36'))['add'](0x3b,_0x499b('0x37'))[_0x499b('0x1a')]();}_0x138edb={'start':_0x1c9add,'end':_0x2147b8};break;default:_0x138edb[_0x499b('0x32')]=_0x1c9add;break;}return _0x138edb;} \ No newline at end of file +var _0xd0a0=['<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','start','$endsWith','shift','pop','DATE','utcOffset','hours','minutes','seconds','lodash','parseSearch','and','replace','[$and]','split','length','slice','forEach','filter','indexOf','map','conditions','push','buildExpression','operator','$eq','$between','$gt','$lte','value','add','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','includes','$ne','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?'];(function(_0x417df7,_0x51921a){var _0x1a9ea5=function(_0x16f491){while(--_0x16f491){_0x417df7['push'](_0x417df7['shift']());}};_0x1a9ea5(++_0x51921a);}(_0xd0a0,0xed));var _0x0d0a=function(_0x58a517,_0xac13ca){_0x58a517=_0x58a517-0x0;var _0x237373=_0xd0a0[_0x58a517];return _0x237373;};'use strict';var _=require(_0x0d0a('0x0'));var moment=require('moment');exports[_0x0d0a('0x1')]=function(_0x5553d6){var _0x1f212c={'conditions':[]};_0x1f212c['sqlOperator']=_['startsWith'](_0x5553d6,'[$or]')?'or':_0x0d0a('0x2');var _0x43c65b=_0x5553d6[_0x0d0a('0x3')](_0x0d0a('0x4'),'')['replace']('[$or]','')[_0x0d0a('0x5')]('||');for(var _0x596b12=0x0;_0x596b12<_0x43c65b[_0x0d0a('0x6')];_0x596b12++){var _0x3652e5=_0x43c65b[_0x596b12]['split'](':=');var _0x57a7bb=_0x3652e5[0x0];var _0x381a88=_0x3652e5[_0x0d0a('0x7')](0x1);_0x381a88[_0x0d0a('0x8')](function(_0x456336){var _0x3826d9=_0x456336[_0x0d0a('0x5')]('[')['shift']();var _0x37761b=_0x456336['match'](/\[(.*?)\]/g);_0x37761b['forEach'](function(_0xec784){var _0x596c7b=_0xec784[_0x0d0a('0x5')]('[')[_0x0d0a('0x9')](function(_0x145c8e){return _0x145c8e[_0x0d0a('0xa')](']')>-0x1;})[_0x0d0a('0xb')](function(_0xa0b939){return _0xa0b939[_0x0d0a('0x5')](']')[0x0];})[0x0];_0x1f212c[_0x0d0a('0xc')][_0x0d0a('0xd')]({'field':_0x57a7bb,'operator':_0x3826d9,'value':_0x596c7b});});});}return _0x1f212c;};exports[_0x0d0a('0xe')]=function(_0x437f30,_0x486e61,_0x39a5f1){var _0x51a40d={};if(_0x486e61==='DATE'){if(_0x39a5f1[_0x0d0a('0xf')]===_0x0d0a('0x10')){_0x39a5f1['operator']=_0x0d0a('0x11');_0x39a5f1['value']+=','+_0x39a5f1['value'];}else if(_['includes']([_0x0d0a('0x12'),_0x0d0a('0x13')],_0x39a5f1['operator'])){_0x39a5f1[_0x0d0a('0x14')]=moment(_0x39a5f1['value'])[_0x0d0a('0x15')](0x1,'days')[_0x0d0a('0x16')](_0x0d0a('0x17'));}}if(_0x39a5f1[_0x0d0a('0x18')]){_0x486e61=_0x39a5f1['castTo'];_0x51a40d['text']=_0x0d0a('0x19')+_0x437f30+'.'+_0x39a5f1[_0x0d0a('0x1a')]+_0x0d0a('0x1b')+_0x39a5f1[_0x0d0a('0x18')]+')\x20'+parseOperator(_0x39a5f1[_0x0d0a('0xf')]);}else{_0x51a40d['text']=_0x437f30+'.'+_0x39a5f1[_0x0d0a('0x1a')]+'\x20'+parseOperator(_0x39a5f1['operator']);}if(_[_0x0d0a('0x1c')]([_0x0d0a('0x1d'),'$notIn'],_0x39a5f1['operator']))_0x51a40d[_0x0d0a('0x1e')]='('+_0x51a40d[_0x0d0a('0x1e')]+_0x0d0a('0x1f')+_0x437f30+'.'+_0x39a5f1[_0x0d0a('0x1a')]+_0x0d0a('0x20');_0x51a40d[_0x0d0a('0x14')]=parseValue(_0x486e61,_0x39a5f1[_0x0d0a('0xf')],_0x39a5f1['value']);return _0x51a40d;};function parseOperator(_0x2ba4d1){var _0x2d0928;switch(_0x2ba4d1){case _0x0d0a('0x21'):_0x2d0928=_0x0d0a('0x22');break;case _0x0d0a('0x23'):_0x2d0928=_0x0d0a('0x24');break;case _0x0d0a('0x10'):_0x2d0928=_0x0d0a('0x25');break;case'$ne':_0x2d0928=_0x0d0a('0x26');break;case _0x0d0a('0x27'):case _0x0d0a('0x28'):case'$endsWith':_0x2d0928=_0x0d0a('0x29');break;case _0x0d0a('0x2a'):_0x2d0928='<\x20?';break;case _0x0d0a('0x12'):_0x2d0928=_0x0d0a('0x2b');break;case _0x0d0a('0x13'):_0x2d0928=_0x0d0a('0x2c');break;case _0x0d0a('0x2d'):_0x2d0928='>=\x20?';break;case'$between':_0x2d0928='BETWEEN\x20?\x20AND\x20?';break;}return _0x2d0928;}function parseValue(_0x4ac1f8,_0x1bf2f4,_0x272210){var _0x54f4bd={'start':undefined,'end':undefined};switch(_0x1bf2f4){case'$in':case _0x0d0a('0x23'):_0x54f4bd[_0x0d0a('0x2e')]=_0x272210['split'](',');break;case _0x0d0a('0x27'):_0x54f4bd[_0x0d0a('0x2e')]='%'+_0x272210+'%';break;case _0x0d0a('0x28'):_0x54f4bd[_0x0d0a('0x2e')]=_0x272210+'%';break;case _0x0d0a('0x2f'):_0x54f4bd['start']='%'+_0x272210;break;case'$between':var _0x1f5567=_0x272210[_0x0d0a('0x5')](',');var _0x272210=_0x1f5567[_0x0d0a('0x30')]();var _0x593d63=_0x1f5567[_0x0d0a('0x31')]();if(_0x4ac1f8===_0x0d0a('0x32')){_0x272210=moment(_0x272210)['utcOffset'](0x0,!![])[_0x0d0a('0x16')]();_0x593d63=moment(_0x593d63)[_0x0d0a('0x33')](0x0,!![])['add'](0x17,_0x0d0a('0x34'))['add'](0x3b,_0x0d0a('0x35'))[_0x0d0a('0x15')](0x3b,_0x0d0a('0x36'))[_0x0d0a('0x16')]();}_0x54f4bd={'start':_0x272210,'end':_0x593d63};break;default:_0x54f4bd['start']=_0x272210;break;}return _0x54f4bd;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index ba51260..b554c2f 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 _0x4b00=['priority','cast','col','unsigned','substr','ASC','omit','length','isObject','isString','unset','^[+]?[0-9]*$','match','replace','push','join','getOptions','query','$id','model','map','attributes','intersection','hasOwnProperty','nolimit','limit','offset','order','pick','filters','filter','merge','where','lower','lodash','sequelize','moment','parse','keys','includes','fields','split','isEmpty','forOwn','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','sort','indexOf'];(function(_0x2c521a,_0x1fa05b){var _0x467b7b=function(_0x5a8e7b){while(--_0x5a8e7b){_0x2c521a['push'](_0x2c521a['shift']());}};_0x467b7b(++_0x1fa05b);}(_0x4b00,0x96));var _0x04b0=function(_0x40cfa0,_0x589481){_0x40cfa0=_0x40cfa0-0x0;var _0xc1f981=_0x4b00[_0x40cfa0];return _0xc1f981;};'use strict';var _=require(_0x04b0('0x0'));var sequelize=require(_0x04b0('0x1'));var moment=require(_0x04b0('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x582817){var _0x37cbe2=['ne'];try{var _0x40fe03=JSON[_0x04b0('0x3')](_0x582817);var _0x2dd7bc=Object[_0x04b0('0x4')](_0x40fe03)[0x0];return _0x37cbe2[_0x04b0('0x5')](_0x2dd7bc);}catch(_0x2b2852){return![];}}function getOperatorValue(_0x378cf6){var _0x40f176=JSON[_0x04b0('0x3')](_0x378cf6);var _0x4d825e=Object[_0x04b0('0x4')](_0x40f176)[0x0];var _0x3a7916=_0x40f176[_0x4d825e];return{['$'+_0x4d825e]:_0x3a7916};}exports[_0x04b0('0x6')]=function(_0x56f1ce){var _0x59f93b=null;if(_0x56f1ce){_0x59f93b=_0x56f1ce[_0x04b0('0x7')](',');}return _0x59f93b;};exports['filters']=function(_0x51c97d,_0x3c9e81){var _0x2944af={};if(!_[_0x04b0('0x8')](_0x51c97d)){_[_0x04b0('0x9')](_0x51c97d,function(_0xabca84,_0x39402d){try{if(_0x3c9e81){var _0x19d314=_[_0x04b0('0xa')](_0x3c9e81,{'name':_0x39402d})||{};if(hasSequelizeOperator(_0xabca84)){_0x2944af[_0x39402d]=getOperatorValue(_0xabca84);}else if(_0x19d314['type']===_0x04b0('0xb')&&_[_0x04b0('0xc')](_0xabca84)){var _0x35f48b=JSON[_0x04b0('0x3')](_0xabca84);var _0x465d96={'$gte':moment(moment(_0x35f48b[_0x04b0('0xd')])[_0x04b0('0xe')](_0x04b0('0xf')))[_0x04b0('0x10')]()['format'](),'$lte':moment(moment(_0x35f48b[_0x04b0('0x11')])['format']('YYYY-MM-DD'))[_0x04b0('0x10')]()[_0x04b0('0x12')](0x1,'s')[_0x04b0('0xe')]()};_0x2944af[_0x39402d]=_0x465d96;}else if(_0x19d314[_0x04b0('0x13')]===_0x04b0('0x14')){_0x2944af[_0x39402d]=_0xabca84;}else{_0x2944af[_0x39402d]=_['isArray'](_0xabca84)?_0xabca84:JSON['parse'](_0xabca84);}}else{_0x2944af[_0x39402d]=_[_0x04b0('0x15')](_0xabca84)?_0xabca84:JSON[_0x04b0('0x3')](_0xabca84);}}catch(_0x209d89){_0x2944af[_0x39402d]=_0xabca84[_0x04b0('0x7')](',');}});}return _0x2944af;};exports['limit']=function(_0x5770c5){_0x5770c5=parseInt(_0x5770c5,0xa);if(!_0x5770c5||_0x5770c5<0x0){_0x5770c5=LIMIT_VALUE;}return _0x5770c5;};exports['offset']=function(_0x370876){_0x370876=parseInt(_0x370876,0xa);if(!_0x370876||_0x370876<0x0){_0x370876=0x0;}return _0x370876;};exports[_0x04b0('0x16')]=function(_0x56f707){var _0x3c242e,_0x253bf5=null;if(_0x56f707){_0x3c242e=_0x56f707[_0x04b0('0x7')](',');_0x253bf5=_['map'](_0x3c242e,function(_0x38751e){if(_0x38751e[_0x04b0('0x17')]('-')===0x0){return[_0x38751e===_0x04b0('0x18')?sequelize[_0x04b0('0x19')](sequelize[_0x04b0('0x1a')]('priority'),_0x04b0('0x1b')):_0x38751e[_0x04b0('0x1c')](0x1),'DESC'];}else{return[_0x38751e==='priority'?sequelize[_0x04b0('0x19')](sequelize[_0x04b0('0x1a')](_0x04b0('0x18')),'unsigned'):_0x38751e,_0x04b0('0x1d')];}});}return _0x253bf5;};exports[_0x04b0('0x1e')]=function(_0x271991,_0x36648e){if(_['isEmpty'](_0x271991)){return _0x271991;}if(_[_0x04b0('0x15')](_0x271991)){for(var _0x1f0ee0=0x0;_0x1f0ee0<_0x271991[_0x04b0('0x1f')];_0x1f0ee0+=0x1){_0x271991[_0x1f0ee0]=this[_0x04b0('0x1e')](_0x271991[_0x1f0ee0],_0x36648e);}return _0x271991;}if(!_[_0x04b0('0x20')](_0x271991)){return _0x271991;}if(_[_0x04b0('0x21')](_0x36648e)){_0x36648e=[_0x36648e];}if(!_['isArray'](_0x36648e)){return _0x271991;}for(var _0x899932=0x0;_0x899932<_0x36648e['length'];_0x899932+=0x1){_[_0x04b0('0x22')](_0x271991,_0x36648e[_0x899932]);}for(var _0x3b14f4 in _0x271991){if(_0x271991['hasOwnProperty'](_0x3b14f4)){_0x271991[_0x3b14f4]=this[_0x04b0('0x1e')](_0x271991[_0x3b14f4],_0x36648e);}}return _0x271991;};exports['isNumeric']=function(_0x45117d){return _0x45117d['match'](RegExp(_0x04b0('0x23')))?!![]:![];};exports['isEmail']=function(_0x691ba4){return _0x691ba4[_0x04b0('0x24')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x4965a5){var _0x34745e=[];_0x4965a5[_0x04b0('0x7')](/[ ,]+/)['forEach'](function(_0x477b2f){_0x477b2f=_0x477b2f[_0x04b0('0x25')](/([^:]")"+/g,'$1');_0x477b2f='+'+_0x477b2f+'*';if(_0x477b2f[_0x04b0('0x5')]('@'))_0x477b2f='\x22'+_0x477b2f+'\x22';_0x34745e[_0x04b0('0x26')](_0x477b2f);});return _0x34745e[_0x04b0('0x27')]('\x20');};exports[_0x04b0('0x28')]=function(_0x35f93a,_0x3472c4,_0x11fb86){var _0x3093ad={},_0x5f4e6d={};if(_0x3472c4[_0x04b0('0x29')]['$id']){_0x3472c4['query']['id']=_0x3472c4[_0x04b0('0x29')][_0x04b0('0x2a')];delete _0x3472c4[_0x04b0('0x29')][_0x04b0('0x2a')];}_0x3093ad[_0x04b0('0x2b')]=_[_0x04b0('0x2c')](_0x35f93a,_0x04b0('0x13'));_0x3093ad[_0x04b0('0x29')]=_[_0x04b0('0x4')](_0x3472c4[_0x04b0('0x29')]);_0x3093ad['filters']=_['intersection'](_0x3093ad[_0x04b0('0x2b')],_0x3093ad[_0x04b0('0x29')]);_0x5f4e6d[_0x04b0('0x2d')]=_[_0x04b0('0x2e')](_0x3093ad[_0x04b0('0x2b')],this[_0x04b0('0x6')](_0x3472c4['query'][_0x04b0('0x6')]));_0x5f4e6d[_0x04b0('0x2d')]=_0x5f4e6d[_0x04b0('0x2d')][_0x04b0('0x1f')]?_0x5f4e6d['attributes']:_0x3093ad['model'];if(!_0x3472c4[_0x04b0('0x29')][_0x04b0('0x2f')](_0x04b0('0x30'))){_0x5f4e6d[_0x04b0('0x31')]=this[_0x04b0('0x31')](_0x3472c4['query']['limit']);_0x5f4e6d[_0x04b0('0x32')]=this['offset'](_0x3472c4[_0x04b0('0x29')][_0x04b0('0x32')]);}_0x5f4e6d[_0x04b0('0x33')]=this['sort'](_0x3472c4[_0x04b0('0x29')][_0x04b0('0x16')]);_0x5f4e6d['where']=this['filters'](_[_0x04b0('0x34')](_0x3472c4[_0x04b0('0x29')],_0x3093ad[_0x04b0('0x35')]),_0x35f93a);if(_0x3472c4[_0x04b0('0x29')][_0x04b0('0x36')]){_0x5f4e6d['where']=_[_0x04b0('0x37')](_0x5f4e6d['where'],{'$or':_[_0x04b0('0x2c')](_0x35f93a,function(_0x55500){if(_0x55500['type']!=='VIRTUAL'){if(_0x11fb86){return sequelize[_0x04b0('0x38')](sequelize['fn'](_0x04b0('0x39'),sequelize[_0x04b0('0x1a')](_0x55500[_0x04b0('0x13')])),{'$like':sequelize['fn'](_0x04b0('0x39'),'%'+_0x3472c4[_0x04b0('0x29')][_0x04b0('0x36')]+'%')});}else{var _0x1a485d={};_0x1a485d[_0x55500[_0x04b0('0x13')]]={'$like':'%'+_0x3472c4[_0x04b0('0x29')]['filter']+'%'};return _0x1a485d;}}})});}_0x5f4e6d=_['merge']({},_0x5f4e6d,_0x3472c4['options']);return _0x5f4e6d;}; \ No newline at end of file +var _0x903e=['replace','includes','join','getOptions','query','$id','model','intersection','attributes','nolimit','order','where','pick','filter','merge','VIRTUAL','lower','options','lodash','sequelize','moment','keys','fields','split','filters','isEmpty','find','type','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','isArray','parse','limit','offset','sort','map','indexOf','priority','cast','col','substr','DESC','unsigned','ASC','length','omit','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','forEach'];(function(_0x70b84e,_0x4ab046){var _0x5c3d04=function(_0x1a2066){while(--_0x1a2066){_0x70b84e['push'](_0x70b84e['shift']());}};_0x5c3d04(++_0x4ab046);}(_0x903e,0x8e));var _0xe903=function(_0x3048ea,_0x3838c2){_0x3048ea=_0x3048ea-0x0;var _0x1a13c4=_0x903e[_0x3048ea];return _0x1a13c4;};'use strict';var _=require(_0xe903('0x0'));var sequelize=require(_0xe903('0x1'));var moment=require(_0xe903('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x51666d){var _0x212284=['ne'];try{var _0x5ab4b9=JSON['parse'](_0x51666d);var _0xf0b54c=Object[_0xe903('0x3')](_0x5ab4b9)[0x0];return _0x212284['includes'](_0xf0b54c);}catch(_0x49b527){return![];}}function getOperatorValue(_0x5bb2e6){var _0x3256c8=JSON['parse'](_0x5bb2e6);var _0x1377ca=Object[_0xe903('0x3')](_0x3256c8)[0x0];var _0x518f7a=_0x3256c8[_0x1377ca];return{['$'+_0x1377ca]:_0x518f7a};}exports[_0xe903('0x4')]=function(_0x5540e2){var _0x45bca1=null;if(_0x5540e2){_0x45bca1=_0x5540e2[_0xe903('0x5')](',');}return _0x45bca1;};exports[_0xe903('0x6')]=function(_0xd5821d,_0x5cf389){var _0x21fc86={};if(!_[_0xe903('0x7')](_0xd5821d)){_['forOwn'](_0xd5821d,function(_0x12c31d,_0x121824){try{if(_0x5cf389){var _0x3c3177=_[_0xe903('0x8')](_0x5cf389,{'name':_0x121824})||{};if(hasSequelizeOperator(_0x12c31d)){_0x21fc86[_0x121824]=getOperatorValue(_0x12c31d);}else if(_0x3c3177[_0xe903('0x9')]==='DATE'&&_[_0xe903('0xa')](_0x12c31d)){var _0x3d763b=JSON['parse'](_0x12c31d);var _0x1a0f55={'$gte':moment(moment(_0x3d763b[_0xe903('0xb')])['format'](_0xe903('0xc')))[_0xe903('0xd')]()[_0xe903('0xe')](),'$lte':moment(moment(_0x3d763b[_0xe903('0xf')])[_0xe903('0xe')](_0xe903('0xc')))[_0xe903('0xd')]()[_0xe903('0x10')](0x1,'s')[_0xe903('0xe')]()};_0x21fc86[_0x121824]=_0x1a0f55;}else if(_0x3c3177[_0xe903('0x11')]===_0xe903('0x12')){_0x21fc86[_0x121824]=_0x12c31d;}else{_0x21fc86[_0x121824]=_[_0xe903('0x13')](_0x12c31d)?_0x12c31d:JSON['parse'](_0x12c31d);}}else{_0x21fc86[_0x121824]=_[_0xe903('0x13')](_0x12c31d)?_0x12c31d:JSON[_0xe903('0x14')](_0x12c31d);}}catch(_0x28610c){_0x21fc86[_0x121824]=_0x12c31d[_0xe903('0x5')](',');}});}return _0x21fc86;};exports[_0xe903('0x15')]=function(_0x11de7b){_0x11de7b=parseInt(_0x11de7b,0xa);if(!_0x11de7b||_0x11de7b<0x0){_0x11de7b=LIMIT_VALUE;}return _0x11de7b;};exports[_0xe903('0x16')]=function(_0x204fb5){_0x204fb5=parseInt(_0x204fb5,0xa);if(!_0x204fb5||_0x204fb5<0x0){_0x204fb5=0x0;}return _0x204fb5;};exports[_0xe903('0x17')]=function(_0x60f14){var _0x48aaa3,_0x4c7f02=null;if(_0x60f14){_0x48aaa3=_0x60f14[_0xe903('0x5')](',');_0x4c7f02=_[_0xe903('0x18')](_0x48aaa3,function(_0x152110){if(_0x152110[_0xe903('0x19')]('-')===0x0){return[_0x152110===_0xe903('0x1a')?sequelize[_0xe903('0x1b')](sequelize[_0xe903('0x1c')](_0xe903('0x1a')),'unsigned'):_0x152110[_0xe903('0x1d')](0x1),_0xe903('0x1e')];}else{return[_0x152110===_0xe903('0x1a')?sequelize[_0xe903('0x1b')](sequelize[_0xe903('0x1c')](_0xe903('0x1a')),_0xe903('0x1f')):_0x152110,_0xe903('0x20')];}});}return _0x4c7f02;};exports['omit']=function(_0x3fc370,_0x185388){if(_['isEmpty'](_0x3fc370)){return _0x3fc370;}if(_[_0xe903('0x13')](_0x3fc370)){for(var _0x3c06af=0x0;_0x3c06af<_0x3fc370[_0xe903('0x21')];_0x3c06af+=0x1){_0x3fc370[_0x3c06af]=this[_0xe903('0x22')](_0x3fc370[_0x3c06af],_0x185388);}return _0x3fc370;}if(!_[_0xe903('0x23')](_0x3fc370)){return _0x3fc370;}if(_[_0xe903('0x24')](_0x185388)){_0x185388=[_0x185388];}if(!_[_0xe903('0x13')](_0x185388)){return _0x3fc370;}for(var _0x1a363c=0x0;_0x1a363c<_0x185388[_0xe903('0x21')];_0x1a363c+=0x1){_[_0xe903('0x25')](_0x3fc370,_0x185388[_0x1a363c]);}for(var _0x36aea2 in _0x3fc370){if(_0x3fc370[_0xe903('0x26')](_0x36aea2)){_0x3fc370[_0x36aea2]=this[_0xe903('0x22')](_0x3fc370[_0x36aea2],_0x185388);}}return _0x3fc370;};exports[_0xe903('0x27')]=function(_0x432a96){return _0x432a96[_0xe903('0x28')](RegExp(_0xe903('0x29')))?!![]:![];};exports[_0xe903('0x2a')]=function(_0x399ea6){return _0x399ea6[_0xe903('0x28')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x546283){var _0x16ca5a=[];_0x546283[_0xe903('0x5')](/[ ,]+/)[_0xe903('0x2b')](function(_0x3a4844){_0x3a4844=_0x3a4844[_0xe903('0x2c')](/([^:]")"+/g,'$1');_0x3a4844='+'+_0x3a4844+'*';if(_0x3a4844[_0xe903('0x2d')]('@'))_0x3a4844='\x22'+_0x3a4844+'\x22';_0x16ca5a['push'](_0x3a4844);});return _0x16ca5a[_0xe903('0x2e')]('\x20');};exports[_0xe903('0x2f')]=function(_0x1b166e,_0x41d4fb,_0x58027a){var _0x1b876b={},_0x209d2d={};if(_0x41d4fb[_0xe903('0x30')][_0xe903('0x31')]){_0x41d4fb[_0xe903('0x30')]['id']=_0x41d4fb[_0xe903('0x30')]['$id'];delete _0x41d4fb[_0xe903('0x30')][_0xe903('0x31')];}_0x1b876b[_0xe903('0x32')]=_[_0xe903('0x18')](_0x1b166e,_0xe903('0x11'));_0x1b876b[_0xe903('0x30')]=_[_0xe903('0x3')](_0x41d4fb[_0xe903('0x30')]);_0x1b876b[_0xe903('0x6')]=_[_0xe903('0x33')](_0x1b876b[_0xe903('0x32')],_0x1b876b[_0xe903('0x30')]);_0x209d2d[_0xe903('0x34')]=_[_0xe903('0x33')](_0x1b876b[_0xe903('0x32')],this['fields'](_0x41d4fb['query'][_0xe903('0x4')]));_0x209d2d[_0xe903('0x34')]=_0x209d2d[_0xe903('0x34')]['length']?_0x209d2d[_0xe903('0x34')]:_0x1b876b[_0xe903('0x32')];if(!_0x41d4fb[_0xe903('0x30')]['hasOwnProperty'](_0xe903('0x35'))){_0x209d2d[_0xe903('0x15')]=this[_0xe903('0x15')](_0x41d4fb['query'][_0xe903('0x15')]);_0x209d2d[_0xe903('0x16')]=this[_0xe903('0x16')](_0x41d4fb[_0xe903('0x30')][_0xe903('0x16')]);}_0x209d2d[_0xe903('0x36')]=this[_0xe903('0x17')](_0x41d4fb[_0xe903('0x30')][_0xe903('0x17')]);_0x209d2d[_0xe903('0x37')]=this[_0xe903('0x6')](_[_0xe903('0x38')](_0x41d4fb[_0xe903('0x30')],_0x1b876b[_0xe903('0x6')]),_0x1b166e);if(_0x41d4fb[_0xe903('0x30')][_0xe903('0x39')]){_0x209d2d[_0xe903('0x37')]=_[_0xe903('0x3a')](_0x209d2d[_0xe903('0x37')],{'$or':_['map'](_0x1b166e,function(_0x4cde48){if(_0x4cde48[_0xe903('0x9')]!==_0xe903('0x3b')){if(_0x58027a){return sequelize['where'](sequelize['fn']('lower',sequelize['col'](_0x4cde48['name'])),{'$like':sequelize['fn'](_0xe903('0x3c'),'%'+_0x41d4fb[_0xe903('0x30')][_0xe903('0x39')]+'%')});}else{var _0x442b38={};_0x442b38[_0x4cde48[_0xe903('0x11')]]={'$like':'%'+_0x41d4fb['query']['filter']+'%'};return _0x442b38;}}})});}_0x209d2d=_[_0xe903('0x3a')]({},_0x209d2d,_0x41d4fb[_0xe903('0x3d')]);return _0x209d2d;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index b3622d5..b56c90d 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2f0=['html','ejs','renderFile','view\x20engine','urlencoded','50mb','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','cors','moment','./environment','../mysqldb','default','production','set','appPath','join','root','public','development','use','json\x20replacer','toISOString','split','get','views','/server/views','engine'];(function(_0x596fbf,_0x45a5b7){var _0x5e4595=function(_0x1a1b58){while(--_0x1a1b58){_0x596fbf['push'](_0x596fbf['shift']());}};_0x5e4595(++_0x45a5b7);}(_0xf2f0,0xa6));var _0x0f2f=function(_0x5d8fa1,_0x48f172){_0x5d8fa1=_0x5d8fa1-0x0;var _0x53a280=_0xf2f0[_0x5d8fa1];return _0x53a280;};'use strict';var express=require(_0x0f2f('0x0'));var favicon=require(_0x0f2f('0x1'));var bodyParser=require(_0x0f2f('0x2'));var methodOverride=require(_0x0f2f('0x3'));var cookieParser=require(_0x0f2f('0x4'));var errorHandler=require(_0x0f2f('0x5'));var path=require('path');var passport=require('passport');var cors=require(_0x0f2f('0x6'));var moment=require(_0x0f2f('0x7'));var config=require(_0x0f2f('0x8'));var db=require(_0x0f2f('0x9'))['db'];exports[_0x0f2f('0xa')]=function(_0x562ed1){var _0x500217=_0x562ed1['get']('env');if(_0x500217===_0x0f2f('0xb')){_0x562ed1[_0x0f2f('0xc')](_0x0f2f('0xd'),path[_0x0f2f('0xe')](config[_0x0f2f('0xf')],_0x0f2f('0x10')));}if(_0x500217===_0x0f2f('0x11')||_0x500217==='test'){_0x562ed1[_0x0f2f('0xc')](_0x0f2f('0xd'),path[_0x0f2f('0xe')](config[_0x0f2f('0xf')],'client'));_0x562ed1[_0x0f2f('0x12')](errorHandler());}_0x562ed1['set'](_0x0f2f('0x13'),function(_0x269199,_0x21f0b0){if(this[_0x269199]instanceof Date){_0x21f0b0=this[_0x269199][_0x0f2f('0x14')]()[_0x0f2f('0x15')]('.')[0x0]+'Z';}return _0x21f0b0;});_0x562ed1['use'](express['static'](_0x562ed1[_0x0f2f('0x16')](_0x0f2f('0xd'))));_0x562ed1[_0x0f2f('0xc')](_0x0f2f('0x17'),config[_0x0f2f('0xf')]+_0x0f2f('0x18'));_0x562ed1[_0x0f2f('0x19')](_0x0f2f('0x1a'),require(_0x0f2f('0x1b'))[_0x0f2f('0x1c')]);_0x562ed1[_0x0f2f('0xc')](_0x0f2f('0x1d'),_0x0f2f('0x1a'));_0x562ed1[_0x0f2f('0x12')](bodyParser[_0x0f2f('0x1e')]({'limit':_0x0f2f('0x1f'),'extended':!![]}));_0x562ed1['use'](bodyParser['json']({'limit':_0x0f2f('0x1f')}));_0x562ed1[_0x0f2f('0x12')](cors());_0x562ed1[_0x0f2f('0x12')](methodOverride());_0x562ed1['use'](cookieParser());_0x562ed1[_0x0f2f('0x12')](passport['initialize']());}; \ No newline at end of file +var _0x6de7=['join','root','public','development','test','use','json\x20replacer','toISOString','split','static','/server/views','engine','renderFile','view\x20engine','html','50mb','json','initialize','express','body-parser','method-override','errorhandler','path','passport','cors','./environment','../mysqldb','default','get','env','production','set','appPath'];(function(_0x1c18d6,_0x1b593d){var _0x2695ed=function(_0x1468c4){while(--_0x1468c4){_0x1c18d6['push'](_0x1c18d6['shift']());}};_0x2695ed(++_0x1b593d);}(_0x6de7,0x11a));var _0x76de=function(_0x2fe5a8,_0x36dfc3){_0x2fe5a8=_0x2fe5a8-0x0;var _0x5cf27c=_0x6de7[_0x2fe5a8];return _0x5cf27c;};'use strict';var express=require(_0x76de('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x76de('0x1'));var methodOverride=require(_0x76de('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x76de('0x3'));var path=require(_0x76de('0x4'));var passport=require(_0x76de('0x5'));var cors=require(_0x76de('0x6'));var moment=require('moment');var config=require(_0x76de('0x7'));var db=require(_0x76de('0x8'))['db'];exports[_0x76de('0x9')]=function(_0x9f2592){var _0x3f713d=_0x9f2592[_0x76de('0xa')](_0x76de('0xb'));if(_0x3f713d===_0x76de('0xc')){_0x9f2592[_0x76de('0xd')](_0x76de('0xe'),path[_0x76de('0xf')](config[_0x76de('0x10')],_0x76de('0x11')));}if(_0x3f713d===_0x76de('0x12')||_0x3f713d===_0x76de('0x13')){_0x9f2592[_0x76de('0xd')](_0x76de('0xe'),path[_0x76de('0xf')](config[_0x76de('0x10')],'client'));_0x9f2592[_0x76de('0x14')](errorHandler());}_0x9f2592[_0x76de('0xd')](_0x76de('0x15'),function(_0x506b7d,_0x55c0e5){if(this[_0x506b7d]instanceof Date){_0x55c0e5=this[_0x506b7d][_0x76de('0x16')]()[_0x76de('0x17')]('.')[0x0]+'Z';}return _0x55c0e5;});_0x9f2592['use'](express[_0x76de('0x18')](_0x9f2592[_0x76de('0xa')](_0x76de('0xe'))));_0x9f2592[_0x76de('0xd')]('views',config['root']+_0x76de('0x19'));_0x9f2592[_0x76de('0x1a')]('html',require('ejs')[_0x76de('0x1b')]);_0x9f2592[_0x76de('0xd')](_0x76de('0x1c'),_0x76de('0x1d'));_0x9f2592['use'](bodyParser['urlencoded']({'limit':_0x76de('0x1e'),'extended':!![]}));_0x9f2592[_0x76de('0x14')](bodyParser[_0x76de('0x1f')]({'limit':'50mb'}));_0x9f2592['use'](cors());_0x9f2592[_0x76de('0x14')](methodOverride());_0x9f2592['use'](cookieParser());_0x9f2592['use'](passport[_0x76de('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index cf79ffe..7517816 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 _0x190c=['test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','update','hex','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','internal','concat','mac','00:00:00:00:00:00','127.0.0.1','getFirstInterface','map','model','join','createHash','md5','digest','getUuid','licenseToken'];(function(_0xec73e1,_0xb23870){var _0x527efd=function(_0x22c19c){while(--_0x22c19c){_0xec73e1['push'](_0xec73e1['shift']());}};_0x527efd(++_0xb23870);}(_0x190c,0x153));var _0xc190=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0x190c[_0x549278];return _0x1ea9a1;};'use strict';var _=require(_0xc190('0x0'));var os=require('os');var crypto=require(_0xc190('0x1'));var machine=require(_0xc190('0x2'));var exec=require('child_process')[_0xc190('0x3')];var config=require(_0xc190('0x4'));function getInterfaces(){var _0x1cc19b=[];var _0x3b290c=os[_0xc190('0x5')]();var _0x4a4ca9=_[_0xc190('0x6')](_[_0xc190('0x7')](_0x3b290c));for(var _0x23463d=0x0;_0x23463d<_0x4a4ca9[_0xc190('0x8')];_0x23463d++){var _0x81db51=_0x3b290c[_0x4a4ca9[_0x23463d]][_0xc190('0x9')](function(_0x5b4ec2){return _0x5b4ec2['family']==='IPv4'&&_0x5b4ec2[_0xc190('0xa')]===![];});_0x1cc19b=_0x1cc19b[_0xc190('0xb')](_0x81db51);}return _0x1cc19b;}function getFirstInterface(){var _0x650a22=_['head'](getInterfaces());return{'macAddress':_0x650a22&&_0x650a22[_0xc190('0xc')]?_0x650a22[_0xc190('0xc')]:_0xc190('0xd'),'ipAddress':_0x650a22&&_0x650a22['address']?_0x650a22['address']:_0xc190('0xe')};}exports[_0xc190('0xf')]=getFirstInterface;function getCPUhash(){var _0x264448=_[_0xc190('0x6')](os['cpus']()[_0xc190('0x10')](function(_0x11a151){return _0x11a151[_0xc190('0x11')];}))[_0xc190('0x12')](':');return crypto[_0xc190('0x13')](_0xc190('0x14'))['update'](_0x264448)[_0xc190('0x15')]('hex');}exports[_0xc190('0x16')]=function(){var _0x3d6089=os['platform']();var _0x514fa4=/[0-9a-f-]{36}/;if(config[_0xc190('0x17')]&&_0x514fa4[_0xc190('0x18')](config[_0xc190('0x17')])){return config[_0xc190('0x17')];}else if(_0x3d6089===_0xc190('0x19')){return exec(_0xc190('0x1a'),{'encoding':'utf8'})[_0xc190('0x1b')]('\x0d\x0a','');}else{var _0x338800=getFirstInterface();var _0x5cf803=getCPUhash();var _0x7d192c=_0x5cf803+'|'+os[_0xc190('0x1c')]()+'|'+_0x338800[_0xc190('0x1d')]+'|'+_0x338800['ipAddress'];var _0x5cfca9=crypto[_0xc190('0x13')](_0xc190('0x14'))[_0xc190('0x1e')](_0x7d192c)[_0xc190('0x15')](_0xc190('0x1f'));return _0x5cfca9['substring'](0x0,0x8)+'-'+_0x5cfca9[_0xc190('0x20')](0x8,0xc)+'-'+_0x5cfca9[_0xc190('0x20')](0xc,0x10)+'-'+_0x5cfca9['substring'](0x10,0x14)+'-'+_0x5cfca9[_0xc190('0x20')](0x14);}}; \ No newline at end of file +var _0xf4a4=['execSync','networkInterfaces','orderBy','keys','length','filter','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join','md5','digest','hex','getUuid','licenseToken','test','utf8','replace','hostname','macAddress','ipAddress','createHash','update','substring','lodash','crypto','bimedia-machine-uuid','child_process'];(function(_0x444991,_0x3e6606){var _0x4ef665=function(_0x6748a1){while(--_0x6748a1){_0x444991['push'](_0x444991['shift']());}};_0x4ef665(++_0x3e6606);}(_0xf4a4,0x188));var _0x4f4a=function(_0x4372a7,_0x5a466f){_0x4372a7=_0x4372a7-0x0;var _0x47fb13=_0xf4a4[_0x4372a7];return _0x47fb13;};'use strict';var _=require(_0x4f4a('0x0'));var os=require('os');var crypto=require(_0x4f4a('0x1'));var machine=require(_0x4f4a('0x2'));var exec=require(_0x4f4a('0x3'))[_0x4f4a('0x4')];var config=require('../environment');function getInterfaces(){var _0x4cb280=[];var _0x4dbcd3=os[_0x4f4a('0x5')]();var _0x3c901c=_[_0x4f4a('0x6')](_[_0x4f4a('0x7')](_0x4dbcd3));for(var _0x4306ba=0x0;_0x4306ba<_0x3c901c[_0x4f4a('0x8')];_0x4306ba++){var _0x14ddff=_0x4dbcd3[_0x3c901c[_0x4306ba]][_0x4f4a('0x9')](function(_0x1c5ac4){return _0x1c5ac4['family']==='IPv4'&&_0x1c5ac4['internal']===![];});_0x4cb280=_0x4cb280['concat'](_0x14ddff);}return _0x4cb280;}function getFirstInterface(){var _0x385469=_[_0x4f4a('0xa')](getInterfaces());return{'macAddress':_0x385469&&_0x385469[_0x4f4a('0xb')]?_0x385469[_0x4f4a('0xb')]:_0x4f4a('0xc'),'ipAddress':_0x385469&&_0x385469[_0x4f4a('0xd')]?_0x385469[_0x4f4a('0xd')]:_0x4f4a('0xe')};}exports[_0x4f4a('0xf')]=getFirstInterface;function getCPUhash(){var _0x4cc15c=_[_0x4f4a('0x6')](os[_0x4f4a('0x10')]()[_0x4f4a('0x11')](function(_0x185e7f){return _0x185e7f['model'];}))[_0x4f4a('0x12')](':');return crypto['createHash'](_0x4f4a('0x13'))['update'](_0x4cc15c)[_0x4f4a('0x14')](_0x4f4a('0x15'));}exports[_0x4f4a('0x16')]=function(){var _0x7fc101=os['platform']();var _0x62d972=/[0-9a-f-]{36}/;if(config[_0x4f4a('0x17')]&&_0x62d972[_0x4f4a('0x18')](config[_0x4f4a('0x17')])){return config['licenseToken'];}else if(_0x7fc101==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x4f4a('0x19')})[_0x4f4a('0x1a')]('\x0d\x0a','');}else{var _0x28dba5=getFirstInterface();var _0x35b91f=getCPUhash();var _0x36e98c=_0x35b91f+'|'+os[_0x4f4a('0x1b')]()+'|'+_0x28dba5[_0x4f4a('0x1c')]+'|'+_0x28dba5[_0x4f4a('0x1d')];var _0x2e4d0b=crypto[_0x4f4a('0x1e')](_0x4f4a('0x13'))[_0x4f4a('0x1f')](_0x36e98c)['digest'](_0x4f4a('0x15'));return _0x2e4d0b[_0x4f4a('0x20')](0x0,0x8)+'-'+_0x2e4d0b['substring'](0x8,0xc)+'-'+_0x2e4d0b[_0x4f4a('0x20')](0xc,0x10)+'-'+_0x2e4d0b[_0x4f4a('0x20')](0x10,0x14)+'-'+_0x2e4d0b['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index a95916f..250eca8 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 _0x2fd8=['get','data2','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','update','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','pkginfo','version','../../mysqldb','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch'];(function(_0x4ac07d,_0x2935e8){var _0x1f9e1f=function(_0x19edae){while(--_0x19edae){_0x4ac07d['push'](_0x4ac07d['shift']());}};_0x1f9e1f(++_0x2935e8);}(_0x2fd8,0xdb));var _0x82fd=function(_0x59845f,_0x2e3ccc){_0x59845f=_0x59845f-0x0;var _0x460f6d=_0x2fd8[_0x59845f];return _0x460f6d;};'use strict';var util=require(_0x82fd('0x0'));var moment=require(_0x82fd('0x1'));var rp=require(_0x82fd('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x82fd('0x3'))(module,_0x82fd('0x4'));var db=require(_0x82fd('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x82fd('0x6'));var logger=require(_0x82fd('0x7'))(_0x82fd('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3ee01f){return new BPromise(function(_0x381ffb,_0x3ffb46){var _0x24ebfb=util[_0x82fd('0x9')](_0x82fd('0xa'),HOST,_0x3ee01f,module['exports'][_0x82fd('0x4')]);if(oldToken){_0x24ebfb=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x3ee01f,module[_0x82fd('0xb')][_0x82fd('0x4')],oldToken);}var _0x3f4c4c={'uri':_0x24ebfb,'method':_0x82fd('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x3f4c4c)[_0x82fd('0xd')](function(_0x2c0cd7){_0x381ffb(_0x2c0cd7);})[_0x82fd('0xe')](function(_0x24e92b){_0x3ffb46(_0x24e92b);});});}function manageLicense(_0x38651f,_0x5cc08b){var _0x2452dd=_0x5cc08b[_0x82fd('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x2452dd['data1']!==_0x38651f&&!_0x2452dd[_0x82fd('0x10')]){oldToken=_0x2452dd[_0x82fd('0x11')];}httpRequest(_0x38651f)[_0x82fd('0xd')](function(_0x387b13){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x387b13[_0x82fd('0x12')]){isOldTokenSent=![];if(!_0x2452dd[_0x82fd('0x8')]&&_0x2452dd[_0x82fd('0x8')]!=_0x387b13[_0x82fd('0x8')]||_0x2452dd[_0x82fd('0x8')]&&_0x2452dd[_0x82fd('0x10')]){logger[_0x82fd('0x13')](_0x82fd('0x14'));}if(_0x2452dd[_0x82fd('0x8')]&&!_0x2452dd[_0x82fd('0x10')]&&_0x2452dd[_0x82fd('0x8')]!=_0x387b13['license']){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x2452dd[_0x82fd('0x8')]&&!_0x2452dd[_0x82fd('0x10')]&&_0x2452dd[_0x82fd('0x8')]==_0x387b13['license']){return _0x5cc08b;}return _0x5cc08b['update']({'data1':_0x38651f,'data2':null,'license':_0x387b13[_0x82fd('0x8')]});}else{if(_0x387b13[_0x82fd('0x8')]||_0x2452dd[_0x82fd('0x8')]){if(!_0x2452dd[_0x82fd('0x10')]){if(_0x2452dd['data1']==_0x38651f){GRAY_PERIOD_REASON=_0x82fd('0x15');logger[_0x82fd('0x13')](_0x82fd('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x82fd('0x13')](_0x82fd('0x17'),_0x2452dd[_0x82fd('0x11')],_0x38651f);}logger[_0x82fd('0x13')](_0x82fd('0x18'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x82fd('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x5cc08b[_0x82fd('0x19')]({'data2':encryptor[_0x82fd('0x1a')](moment()[_0x82fd('0x9')](_0x82fd('0x1b')))});}else{if(moment()[_0x82fd('0x1c')](encryptor[_0x82fd('0x1d')](_0x2452dd[_0x82fd('0x10')]),_0x82fd('0x1e'))>DAYS){logger[_0x82fd('0x13')](_0x82fd('0x1f'),moment()['format'](_0x82fd('0x1b')));isOldTokenSent=![];return _0x5cc08b[_0x82fd('0x19')]({'data1':_0x38651f,'data2':null,'license':null});}}}else{if(_0x2452dd[_0x82fd('0x11')]!=_0x38651f){logger[_0x82fd('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2452dd[_0x82fd('0x11')],_0x38651f);return _0x5cc08b['update']({'data1':_0x38651f,'data2':null,'license':null});}}}return _0x5cc08b;})['then'](function(_0x415d15){_0x5cc08b=_0x415d15;})[_0x82fd('0xe')](function(_0x2185c8){logger[_0x82fd('0x20')](_0x2185c8[_0x82fd('0x21')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x82fd('0x22')](),_0x5cc08b);},TIME);});}function defaultLicense(){var _0x37783b=hardware['getUuid']();if(_0x37783b){return db[_0x82fd('0x23')][_0x82fd('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x37783b}})[_0x82fd('0x25')](function(_0x841e41,_0x1051a6){logger[_0x82fd('0x13')](_0x82fd('0x26'),_0x37783b);manageLicense(_0x37783b,_0x841e41);})[_0x82fd('0xe')](function(_0x34bd12){logger[_0x82fd('0x20')](_0x34bd12[_0x82fd('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x11a7=['active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','update','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','catch','message','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','moment','request-promise','bluebird','pkginfo','version','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','data1','data2'];(function(_0x114b7f,_0x4e7790){var _0x3e0774=function(_0x3429e1){while(--_0x3429e1){_0x114b7f['push'](_0x114b7f['shift']());}};_0x3e0774(++_0x4e7790);}(_0x11a7,0xf3));var _0x711a=function(_0x8e1e89,_0x396be9){_0x8e1e89=_0x8e1e89-0x0;var _0x411cbd=_0x11a7[_0x8e1e89];return _0x411cbd;};'use strict';var util=require('util');var moment=require(_0x711a('0x0'));var rp=require(_0x711a('0x1'));var BPromise=require(_0x711a('0x2'));var pkginfo=require(_0x711a('0x3'))(module,_0x711a('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x711a('0x5'));var logger=require('../logger')(_0x711a('0x6'));var HOST=_0x711a('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1054cd){return new BPromise(function(_0x35df4c,_0xaa974a){var _0x5b6a78=util[_0x711a('0x8')](_0x711a('0x9'),HOST,_0x1054cd,module[_0x711a('0xa')][_0x711a('0x4')]);if(oldToken){_0x5b6a78=util[_0x711a('0x8')](_0x711a('0xb'),HOST,_0x1054cd,module[_0x711a('0xa')][_0x711a('0x4')],oldToken);}var _0x19b433={'uri':_0x5b6a78,'method':_0x711a('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x19b433)[_0x711a('0xd')](function(_0x310eb6){_0x35df4c(_0x310eb6);})['catch'](function(_0x318ad4){_0xaa974a(_0x318ad4);});});}function manageLicense(_0x3fcfd1,_0x3b7df5){var _0x279596=_0x3b7df5['get']({'plain':!![]});if(!isOldTokenSent&&_0x279596[_0x711a('0xe')]!==_0x3fcfd1&&!_0x279596[_0x711a('0xf')]){oldToken=_0x279596[_0x711a('0xe')];}httpRequest(_0x3fcfd1)['then'](function(_0x2e5275){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2e5275[_0x711a('0x10')]){isOldTokenSent=![];if(!_0x279596['license']&&_0x279596['license']!=_0x2e5275[_0x711a('0x6')]||_0x279596[_0x711a('0x6')]&&_0x279596[_0x711a('0xf')]){logger['info'](_0x711a('0x11'));}if(_0x279596[_0x711a('0x6')]&&!_0x279596[_0x711a('0xf')]&&_0x279596[_0x711a('0x6')]!=_0x2e5275[_0x711a('0x6')]){logger[_0x711a('0x12')](_0x711a('0x13'));}if(_0x279596[_0x711a('0x6')]&&!_0x279596[_0x711a('0xf')]&&_0x279596[_0x711a('0x6')]==_0x2e5275[_0x711a('0x6')]){return _0x3b7df5;}return _0x3b7df5['update']({'data1':_0x3fcfd1,'data2':null,'license':_0x2e5275[_0x711a('0x6')]});}else{if(_0x2e5275[_0x711a('0x6')]||_0x279596[_0x711a('0x6')]){if(!_0x279596[_0x711a('0xf')]){if(_0x279596[_0x711a('0xe')]==_0x3fcfd1){GRAY_PERIOD_REASON='Disabled';logger[_0x711a('0x12')](_0x711a('0x14'));}else{GRAY_PERIOD_REASON=_0x711a('0x15');logger[_0x711a('0x12')](_0x711a('0x16'),_0x279596[_0x711a('0xe')],_0x3fcfd1);}logger['info'](_0x711a('0x17'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x711a('0x8')]('YYYY-MM-DD\x20HH:mm'));return _0x3b7df5[_0x711a('0x18')]({'data2':encryptor[_0x711a('0x19')](moment()[_0x711a('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0x711a('0x1a')](_0x279596[_0x711a('0xf')]),_0x711a('0x1b'))>DAYS){logger[_0x711a('0x12')](_0x711a('0x1c'),moment()['format'](_0x711a('0x1d')));isOldTokenSent=![];return _0x3b7df5[_0x711a('0x18')]({'data1':_0x3fcfd1,'data2':null,'license':null});}}}else{if(_0x279596[_0x711a('0xe')]!=_0x3fcfd1){logger[_0x711a('0x12')](_0x711a('0x16'),_0x279596[_0x711a('0xe')],_0x3fcfd1);return _0x3b7df5['update']({'data1':_0x3fcfd1,'data2':null,'license':null});}}}return _0x3b7df5;})['then'](function(_0x54b81d){_0x3b7df5=_0x54b81d;})[_0x711a('0x1e')](function(_0x266244){logger['error'](_0x266244[_0x711a('0x1f')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x711a('0x20')](),_0x3b7df5);},TIME);});}function defaultLicense(){var _0xb99ba4=hardware['getUuid']();if(_0xb99ba4){return db['License'][_0x711a('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0xb99ba4}})[_0x711a('0x22')](function(_0x79116c,_0x100fb5){logger[_0x711a('0x12')](_0x711a('0x23'),_0xb99ba4);manageLicense(_0xb99ba4,_0x79116c);})[_0x711a('0x1e')](function(_0x12c1e2){logger[_0x711a('0x24')](_0x12c1e2['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 644691d..b491aca 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 _0xa6fb=['lodash','moment','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','License','find','defaults','then','catch','uuid','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','%s:%s:%s','demo','machineUuid','gray','add','format','grayReason','message','role','sequelize','COUNT','col','count','admin','user','telephone','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','util'];(function(_0x37d7b1,_0x10b2a2){var _0x26dfa1=function(_0x32fc42){while(--_0x32fc42){_0x37d7b1['push'](_0x37d7b1['shift']());}};_0x26dfa1(++_0x10b2a2);}(_0xa6fb,0x101));var _0xba6f=function(_0x426f1e,_0x5f38bf){_0x426f1e=_0x426f1e-0x0;var _0x4c487e=_0xa6fb[_0x426f1e];return _0x4c487e;};'use strict';var util=require(_0xba6f('0x0'));var _=require(_0xba6f('0x1'));var moment=require(_0xba6f('0x2'));var BPromise=require('bluebird');var hardware=require(_0xba6f('0x3'));var encryptor=require(_0xba6f('0x4'));var db=require(_0xba6f('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xba6f('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xba6f('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xba6f('0x8'),'machineUuid':hardware[_0xba6f('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1658af){return new BPromise(function(_0x3cb3d0,_0x20b710){return db[_0xba6f('0xa')][_0xba6f('0xb')](_[_0xba6f('0xc')](_0x1658af,{'raw':!![],'where':{'id':0x1}}))[_0xba6f('0xd')](function(_0x560b2c){return checkLicense(_0x560b2c,null);})[_0xba6f('0xd')](function(_0x401222){_0x3cb3d0(_0x401222);return;})[_0xba6f('0xe')](function(_0x34fb69){_0x20b710(_0x34fb69);});});}function checkLicense(_0x5e9b16,_0x2bd307){if(!_0x5e9b16){demoLicense[_0xba6f('0xf')]=_0x5e9b16['data1'];return demoLicense;}try{var _0x3d0d0b=_0x2bd307||_0x5e9b16['license'];if(_[_0xba6f('0x10')](_0x3d0d0b)){throw new Error(_0xba6f('0x11'));}var _0x274865=_0x5e9b16[_0xba6f('0x12')];var _0x4a0589=_0x5e9b16[_0xba6f('0x13')];var _0x16126f=_0x274865[_0xba6f('0x14')]('-')[0x4];var _0x3a5f94=_0x274865[_0xba6f('0x14')]('-')[0x0];var _0x5722a1=encryptor[_0xba6f('0x15')](_0x3d0d0b,util['format'](_0xba6f('0x16'),_0x16126f,_0x274865,_0x3a5f94));var _0x326e95=JSON['parse'](_0x5722a1);_0x326e95[_0xba6f('0x17')]=![];_0x326e95[_0xba6f('0xf')]=_0x274865;_0x326e95[_0xba6f('0x18')]=hardware[_0xba6f('0x9')]();if(_0x4a0589){var _0x1ec644=encryptor[_0xba6f('0x15')](_0x4a0589);_0x326e95[_0xba6f('0x19')]=_0x1ec644;_0x326e95['deadline']=moment(_0x1ec644)[_0xba6f('0x1a')](0x7,'days')[_0xba6f('0x1b')]();_0x326e95[_0xba6f('0x1c')]=_0x326e95[_0xba6f('0xf')]!=_0x326e95[_0xba6f('0x18')]?'changed':'disabled';}return _0x326e95;}catch(_0xc4d20d){breakingLicense[_0xba6f('0xf')]=_0x5e9b16[_0xba6f('0x12')];breakingLicense[_0xba6f('0x1d')]=_0xc4d20d['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x564b93,_0x1d50d4){getLicense()[_0xba6f('0xd')](function(_0x5b0a58){return db['User']['findAll']({'attributes':[_0xba6f('0x1e'),[db[_0xba6f('0x1f')]['fn'](_0xba6f('0x20'),db['sequelize'][_0xba6f('0x21')](_0xba6f('0x1e'))),_0xba6f('0x22')]],'group':_0xba6f('0x1e'),'where':{'role':{'$or':[_0xba6f('0x23'),_0xba6f('0x24'),_0xba6f('0x25')]}},'raw':!![]})[_0xba6f('0xd')](function(_0x1c6a5d){var _0xbd5c82={'user':_0x5b0a58['users']||0x0,'telephone':_0x5b0a58[_0xba6f('0x26')]||0x0};_0x1c6a5d[_0xba6f('0x27')](function(_0x350c06){var _0x285878=_0x350c06[_0xba6f('0x1e')]===_0xba6f('0x23')?'user':_0x350c06['role'];_0xbd5c82[_0x285878]-=_0x350c06[_0xba6f('0x22')];if(_0xbd5c82[_0x285878]<0x0)_0xbd5c82[_0x285878]=0x0;});_0x564b93(_0xbd5c82);return;});})[_0xba6f('0xe')](function(_0x28b1c5){_0x1d50d4(_0x28b1c5);});});}function checkUserLimits(_0x4a0aa6){return new BPromise(function(_0x352bd3,_0x5e39bb){getLimits()[_0xba6f('0xd')](function(_0xe1ae62){var _0x147369=_[_0xba6f('0x28')](_[_0xba6f('0x29')](_0x4a0aa6,_0xba6f('0x1e')),['admin',_0xba6f('0x24'),_0xba6f('0x25')]);var _0x47491a=(_0x147369[_0xba6f('0x23')]||0x0)+(_0x147369['user']||0x0);var _0x8fa9cb=_0x147369['telephone']||0x0;if(_0x47491a>_0xe1ae62[_0xba6f('0x24')])return _0x5e39bb('License\x20limit\x20reached\x20for\x20users');if(_0x8fa9cb>_0xe1ae62['telephone'])return _0x5e39bb(_0xba6f('0x2a'));return _0x352bd3();})[_0xba6f('0xe')](function(_0x2f88bf){_0x5e39bb(_0x2f88bf);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x7640=['data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','decryptString','%s:%s:%s','parse','machineUuid','gray','deadline','add','days','format','changed','disabled','message','findAll','role','sequelize','col','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../mysqldb','Demo\x20license','2027-01-01T00:00:00.000Z','getUuid','License','find','then','catch','uuid'];(function(_0xb549f1,_0x186170){var _0x1efbee=function(_0x5daad4){while(--_0x5daad4){_0xb549f1['push'](_0xb549f1['shift']());}};_0x1efbee(++_0x186170);}(_0x7640,0xab));var _0x0764=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x7640[_0x36884e];return _0x1cc367;};'use strict';var util=require(_0x0764('0x0'));var _=require(_0x0764('0x1'));var moment=require(_0x0764('0x2'));var BPromise=require(_0x0764('0x3'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0x0764('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0764('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0764('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x0764('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x587bd2){return new BPromise(function(_0x49d83e,_0x80888d){return db[_0x0764('0x8')][_0x0764('0x9')](_['defaults'](_0x587bd2,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x152239){return checkLicense(_0x152239,null);})[_0x0764('0xa')](function(_0x45296f){_0x49d83e(_0x45296f);return;})[_0x0764('0xb')](function(_0x1c30f5){_0x80888d(_0x1c30f5);});});}function checkLicense(_0x4d8518,_0xe166f0){if(!_0x4d8518){demoLicense[_0x0764('0xc')]=_0x4d8518[_0x0764('0xd')];return demoLicense;}try{var _0x5717f6=_0xe166f0||_0x4d8518[_0x0764('0xe')];if(_[_0x0764('0xf')](_0x5717f6)){throw new Error(_0x0764('0x10'));}var _0x1fbad8=_0x4d8518['data1'];var _0x3ea0b0=_0x4d8518[_0x0764('0x11')];var _0x116055=_0x1fbad8['split']('-')[0x4];var _0x2d21e9=_0x1fbad8['split']('-')[0x0];var _0x4e8a6a=encryptor[_0x0764('0x12')](_0x5717f6,util['format'](_0x0764('0x13'),_0x116055,_0x1fbad8,_0x2d21e9));var _0x72fd1e=JSON[_0x0764('0x14')](_0x4e8a6a);_0x72fd1e['demo']=![];_0x72fd1e[_0x0764('0xc')]=_0x1fbad8;_0x72fd1e[_0x0764('0x15')]=hardware[_0x0764('0x7')]();if(_0x3ea0b0){var _0x48f685=encryptor[_0x0764('0x12')](_0x3ea0b0);_0x72fd1e[_0x0764('0x16')]=_0x48f685;_0x72fd1e[_0x0764('0x17')]=moment(_0x48f685)[_0x0764('0x18')](0x7,_0x0764('0x19'))[_0x0764('0x1a')]();_0x72fd1e['grayReason']=_0x72fd1e[_0x0764('0xc')]!=_0x72fd1e['machineUuid']?_0x0764('0x1b'):_0x0764('0x1c');}return _0x72fd1e;}catch(_0x4393fa){breakingLicense[_0x0764('0xc')]=_0x4d8518[_0x0764('0xd')];breakingLicense[_0x0764('0x1d')]=_0x4393fa[_0x0764('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x26a5de,_0x367937){getLicense()[_0x0764('0xa')](function(_0x4973d1){return db['User'][_0x0764('0x1e')]({'attributes':[_0x0764('0x1f'),[db[_0x0764('0x20')]['fn']('COUNT',db[_0x0764('0x20')][_0x0764('0x21')]('role')),_0x0764('0x22')]],'group':_0x0764('0x1f'),'where':{'role':{'$or':[_0x0764('0x23'),_0x0764('0x24'),_0x0764('0x25')]}},'raw':!![]})[_0x0764('0xa')](function(_0x13aac0){var _0x19a167={'user':_0x4973d1[_0x0764('0x26')]||0x0,'telephone':_0x4973d1[_0x0764('0x27')]||0x0};_0x13aac0[_0x0764('0x28')](function(_0x3a4220){var _0x5189e7=_0x3a4220['role']===_0x0764('0x23')?_0x0764('0x24'):_0x3a4220[_0x0764('0x1f')];_0x19a167[_0x5189e7]-=_0x3a4220[_0x0764('0x22')];if(_0x19a167[_0x5189e7]<0x0)_0x19a167[_0x5189e7]=0x0;});_0x26a5de(_0x19a167);return;});})[_0x0764('0xb')](function(_0xa9adee){_0x367937(_0xa9adee);});});}function checkUserLimits(_0x95c8c6){return new BPromise(function(_0x32a755,_0xd9c553){getLimits()['then'](function(_0x5cc27c){var _0x291597=_[_0x0764('0x29')](_[_0x0764('0x2a')](_0x95c8c6,'role'),[_0x0764('0x23'),_0x0764('0x24'),_0x0764('0x25')]);var _0xfacc8=(_0x291597[_0x0764('0x23')]||0x0)+(_0x291597[_0x0764('0x24')]||0x0);var _0x269878=_0x291597[_0x0764('0x25')]||0x0;if(_0xfacc8>_0x5cc27c[_0x0764('0x24')])return _0xd9c553(_0x0764('0x2b'));if(_0x269878>_0x5cc27c[_0x0764('0x25')])return _0xd9c553(_0x0764('0x2c'));return _0x32a755();})[_0x0764('0xb')](function(_0x59d3c3){_0xd9c553(_0x59d3c3);});});}module[_0x0764('0x2d')]={'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 35cefce..a0af974 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 _0xb78e=['secret','exports','http://localhost:9000','app-id'];(function(_0x2fa9ef,_0x11eb49){var _0x40a7db=function(_0x387c7c){while(--_0x387c7c){_0x2fa9ef['push'](_0x2fa9ef['shift']());}};_0x40a7db(++_0x11eb49);}(_0xb78e,0x1c9));var _0xeb78=function(_0x53fdb9,_0xd21ce1){_0x53fdb9=_0x53fdb9-0x0;var _0xe8029=_0xb78e[_0x53fdb9];return _0xe8029;};'use strict';module[_0xeb78('0x0')]={'DOMAIN':_0xeb78('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xeb78('0x2'),'GOOGLE_SECRET':_0xeb78('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x25e7=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0x25e7,0x1d6));var _0x725e=function(_0x4c6eaa,_0x391f8b){_0x4c6eaa=_0x4c6eaa-0x0;var _0x403439=_0x25e7[_0x4c6eaa];return _0x403439;};'use strict';module[_0x725e('0x0')]={'DOMAIN':_0x725e('0x1'),'SESSION_SECRET':_0x725e('0x2'),'GOOGLE_ID':_0x725e('0x3'),'GOOGLE_SECRET':_0x725e('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 131bce8..b54dee7 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe8e=['}}}','YYYY-MM-DD\x20HH:mm:ss','level','exports','Logger','transports','File','error','%s-%s','info','Console','env','debugLevel','moment','winston','util','path','INFO','join','/var','format','%s-%s.log','message','replace','{{{'];(function(_0xb5fc3e,_0x234703){var _0x2efc3c=function(_0x4e4e44){while(--_0x4e4e44){_0xb5fc3e['push'](_0xb5fc3e['shift']());}};_0x2efc3c(++_0x234703);}(_0xbe8e,0xd5));var _0xebe8=function(_0x457cee,_0x353347){_0x457cee=_0x457cee-0x0;var _0x55de4e=_0xbe8e[_0x457cee];return _0x55de4e;};'use strict';var moment=require(_0xebe8('0x0'));var winston=require(_0xebe8('0x1'));var util=require(_0xebe8('0x2'));var path=require(_0xebe8('0x3'));var debugLevel=_0xebe8('0x4');function filename(_0x4c13eb,_0x1ffa12){return path[_0xebe8('0x5')](_0xebe8('0x6'),'log','xcally',util[_0xebe8('0x7')](_0xebe8('0x8'),_0x4c13eb,_0x1ffa12));}function formatter(_0x5e4c27,_0x30f51d){_0x30f51d[_0xebe8('0x9')]=_0x30f51d[_0xebe8('0x9')][_0xebe8('0xa')](/@@{/g,_0xebe8('0xb'))['replace'](/}@@/g,_0xebe8('0xc'))['replace'](/@{/g,'{{')[_0xebe8('0xa')](/}@/g,'}}');return util[_0xebe8('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xebe8('0x7')](_0xebe8('0xd')),_0x30f51d[_0xebe8('0xe')]['toUpperCase'](),_0x5e4c27,_0x30f51d['message']);}module[_0xebe8('0xf')]=function(_0x11d811){return new winston[(_0xebe8('0x10'))]({'transports':[new winston[(_0xebe8('0x11'))][(_0xebe8('0x12'))]({'name':util[_0xebe8('0x7')]('%s-%s',_0x11d811,_0xebe8('0x13')),'filename':filename(_0x11d811,'error'),'level':_0xebe8('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x14bf39){return formatter(_0x11d811,_0x14bf39);}}),new winston['transports']['File']({'name':util[_0xebe8('0x7')](_0xebe8('0x14'),_0x11d811,_0xebe8('0x15')),'filename':filename(_0x11d811,_0xebe8('0x15')),'level':_0xebe8('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x263354){return formatter(_0x11d811,_0x263354);}}),new winston[(_0xebe8('0x11'))][(_0xebe8('0x16'))]({'level':process[_0xebe8('0x17')][_0xebe8('0x18')]||debugLevel,'json':![],'formatter':function(_0x1e0a64){return formatter(_0x11d811,_0x1e0a64);}})]});}; \ No newline at end of file +var _0xb552=['log','xcally','%s-%s.log','message','{{{','}}}','replace','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','env','debugLevel','moment','winston','path','INFO','join','/var'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xb552,0x108));var _0x2b55=function(_0x56c266,_0x2fcf00){_0x56c266=_0x56c266-0x0;var _0x4a9dd0=_0xb552[_0x56c266];return _0x4a9dd0;};'use strict';var moment=require(_0x2b55('0x0'));var winston=require(_0x2b55('0x1'));var util=require('util');var path=require(_0x2b55('0x2'));var debugLevel=_0x2b55('0x3');function filename(_0xb531da,_0x53d7ba){return path[_0x2b55('0x4')](_0x2b55('0x5'),_0x2b55('0x6'),_0x2b55('0x7'),util['format'](_0x2b55('0x8'),_0xb531da,_0x53d7ba));}function formatter(_0x3f950b,_0x4482c1){_0x4482c1[_0x2b55('0x9')]=_0x4482c1[_0x2b55('0x9')]['replace'](/@@{/g,_0x2b55('0xa'))['replace'](/}@@/g,_0x2b55('0xb'))[_0x2b55('0xc')](/@{/g,'{{')[_0x2b55('0xc')](/}@/g,'}}');return util[_0x2b55('0xd')](_0x2b55('0xe'),moment()[_0x2b55('0xd')](_0x2b55('0xf')),_0x4482c1[_0x2b55('0x10')][_0x2b55('0x11')](),_0x3f950b,_0x4482c1[_0x2b55('0x9')]);}module[_0x2b55('0x12')]=function(_0x30252c){return new winston[(_0x2b55('0x13'))]({'transports':[new winston[(_0x2b55('0x14'))][(_0x2b55('0x15'))]({'name':util[_0x2b55('0xd')](_0x2b55('0x16'),_0x30252c,_0x2b55('0x17')),'filename':filename(_0x30252c,_0x2b55('0x17')),'level':_0x2b55('0x17'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4fd215){return formatter(_0x30252c,_0x4fd215);}}),new winston['transports'][(_0x2b55('0x15'))]({'name':util[_0x2b55('0xd')](_0x2b55('0x16'),_0x30252c,_0x2b55('0x18')),'filename':filename(_0x30252c,_0x2b55('0x18')),'level':_0x2b55('0x18'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4aa9ab){return formatter(_0x30252c,_0x4aa9ab);}}),new winston[(_0x2b55('0x14'))]['Console']({'level':process[_0x2b55('0x19')][_0x2b55('0x1a')]||debugLevel,'json':![],'formatter':function(_0x4b483b){return formatter(_0x30252c,_0x4b483b);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f022c65..3e8b59a 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 _0xd757=['routing','../../services/xdr/index.js','exports','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email'];(function(_0xa1e7d7,_0x5714bb){var _0x287bee=function(_0x5605b2){while(--_0x5605b2){_0xa1e7d7['push'](_0xa1e7d7['shift']());}};_0x287bee(++_0x5714bb);}(_0xd757,0x18f));var _0x7d75=function(_0x1450ef,_0x113b59){_0x1450ef=_0x1450ef-0x0;var _0x390d4a=_0xd757[_0x1450ef];return _0x390d4a;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x7d75('0x0'),'script':path[_0x7d75('0x1')](__dirname,_0x7d75('0x2'))},{'name':_0x7d75('0x3'),'script':path['join'](__dirname,_0x7d75('0x4'))},{'name':_0x7d75('0x5'),'script':path[_0x7d75('0x1')](__dirname,_0x7d75('0x6'))},{'name':_0x7d75('0x7'),'script':path[_0x7d75('0x1')](__dirname,'../../services/email/index.js')},{'name':_0x7d75('0x8'),'script':path['join'](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0x7d75('0x1')](__dirname,_0x7d75('0x9'))}]};module[_0x7d75('0xa')]=config; \ No newline at end of file +var _0x9035=['express','../../services/express/index.js','ami','join','agi','../../services/agi/index.js','email','../../services/email/index.js','xdr','../../services/xdr/index.js','path'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9035,0x1c2));var _0x5903=function(_0x5709c9,_0x957760){_0x5709c9=_0x5709c9-0x0;var _0x195b03=_0x9035[_0x5709c9];return _0x195b03;};'use strict';var path=require(_0x5903('0x0'));var os=require('os');var config={'apps':[{'name':_0x5903('0x1'),'script':path['join'](__dirname,_0x5903('0x2'))},{'name':_0x5903('0x3'),'script':path[_0x5903('0x4')](__dirname,'../../services/ami/index.js')},{'name':_0x5903('0x5'),'script':path[_0x5903('0x4')](__dirname,_0x5903('0x6'))},{'name':_0x5903('0x7'),'script':path[_0x5903('0x4')](__dirname,_0x5903('0x8'))},{'name':'routing','script':path['join'](__dirname,'../../services/routing/index.js')},{'name':_0x5903('0x9'),'script':path[_0x5903('0x4')](__dirname,_0x5903('0xa'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 6091927..ac09f60 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 _0xe7de=['delete','dump','saved','bluebird','connect','start','then','disconnect','stop','restart','list','describe'];(function(_0x22d667,_0x4ab6f6){var _0xc8eba0=function(_0x217df2){while(--_0x217df2){_0x22d667['push'](_0x22d667['shift']());}};_0xc8eba0(++_0x4ab6f6);}(_0xe7de,0x1b3));var _0xee7d=function(_0x5dabd0,_0xde1664){_0x5dabd0=_0x5dabd0-0x0;var _0x55ab5c=_0xe7de[_0x5dabd0];return _0x55ab5c;};'use strict';var pm2=require('pm2');var BPromise=require(_0xee7d('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x3c99d1,_0x48b5c0){return pm2[_0xee7d('0x1')](function(_0x401014){if(_0x401014){return _0x48b5c0(_0x401014);}return _0x3c99d1('connected');});});};exports[_0xee7d('0x2')]=function(_0x31c3ee){return connect()[_0xee7d('0x3')](function(){return new BPromise(function(_0x210557,_0x238c39){return pm2[_0xee7d('0x2')](_0x31c3ee,function(_0x235eb8,_0x4e0858){if(_0x235eb8){return _0x238c39(_0x235eb8);}pm2[_0xee7d('0x4')]();return _0x210557(_0x4e0858);});});});};exports[_0xee7d('0x5')]=function(_0x853357){return connect()[_0xee7d('0x3')](function(){return new BPromise(function(_0x426825,_0x2f27d8){return pm2[_0xee7d('0x5')](_0x853357,function(_0x127783,_0x3cfaf9){if(_0x127783){return _0x2f27d8(_0x127783);}pm2[_0xee7d('0x4')]();return _0x426825(_0x3cfaf9);});});});};exports[_0xee7d('0x6')]=function(_0x2fe501){return connect()['then'](function(){return new BPromise(function(_0x5a3456,_0x16e44b){return pm2[_0xee7d('0x6')](_0x2fe501,function(_0x5986ee,_0x4ef8e0){if(_0x5986ee){return _0x16e44b(_0x5986ee);}pm2[_0xee7d('0x4')]();return _0x5a3456(_0x4ef8e0);});});});};exports[_0xee7d('0x7')]=function(){return connect()[_0xee7d('0x3')](function(){return new BPromise(function(_0x148a58,_0x190339){return pm2[_0xee7d('0x7')](function(_0x350f6b,_0x1c3ddc){if(_0x350f6b){return _0x190339(_0x350f6b);}pm2[_0xee7d('0x4')]();return _0x148a58(_0x1c3ddc);});});});};exports[_0xee7d('0x8')]=function(_0x463872){return connect()[_0xee7d('0x3')](function(){return new BPromise(function(_0x353133,_0x2eb742){return pm2['describe'](_0x463872,function(_0x16f92d,_0x1b0232){if(_0x16f92d){return _0x2eb742(_0x16f92d);}pm2[_0xee7d('0x4')]();return _0x353133(_0x1b0232);});});});};exports['delete']=function(_0x5670f8){return connect()[_0xee7d('0x3')](function(){return new BPromise(function(_0x3a5d75,_0x448f5e){return pm2[_0xee7d('0x9')](_0x5670f8,function(_0x1ed489,_0x359da7){if(_0x1ed489){return _0x448f5e(_0x1ed489);}pm2[_0xee7d('0x4')]();return _0x3a5d75(_0x359da7);});});});};exports[_0xee7d('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x34ce13,_0x13bd3e){return pm2[_0xee7d('0xa')](function(_0x2da583){if(_0x2da583){return _0x13bd3e(_0x2da583);}return _0x34ce13(_0xee7d('0xb'));});});});}; \ No newline at end of file +var _0x1a98=['start','then','stop','restart','list','describe','disconnect','delete','dump','saved','pm2','bluebird','./config','connect','connected'];(function(_0x49a71f,_0x284ebd){var _0x44ab70=function(_0x39fda8){while(--_0x39fda8){_0x49a71f['push'](_0x49a71f['shift']());}};_0x44ab70(++_0x284ebd);}(_0x1a98,0x1db));var _0x81a9=function(_0x322241,_0x239bb4){_0x322241=_0x322241-0x0;var _0x2972ae=_0x1a98[_0x322241];return _0x2972ae;};'use strict';var pm2=require(_0x81a9('0x0'));var BPromise=require(_0x81a9('0x1'));var config=require(_0x81a9('0x2'));function connect(){return new BPromise(function(_0x5e0da2,_0x469a7d){return pm2[_0x81a9('0x3')](function(_0x40a0c3){if(_0x40a0c3){return _0x469a7d(_0x40a0c3);}return _0x5e0da2(_0x81a9('0x4'));});});};exports[_0x81a9('0x5')]=function(_0x51eb73){return connect()['then'](function(){return new BPromise(function(_0x5c90a0,_0x204697){return pm2['start'](_0x51eb73,function(_0x59a9ec,_0x4eaf0b){if(_0x59a9ec){return _0x204697(_0x59a9ec);}pm2['disconnect']();return _0x5c90a0(_0x4eaf0b);});});});};exports['stop']=function(_0x5a54a7){return connect()[_0x81a9('0x6')](function(){return new BPromise(function(_0x2d2588,_0x1925a0){return pm2[_0x81a9('0x7')](_0x5a54a7,function(_0x2a96d2,_0x5bd139){if(_0x2a96d2){return _0x1925a0(_0x2a96d2);}pm2['disconnect']();return _0x2d2588(_0x5bd139);});});});};exports[_0x81a9('0x8')]=function(_0xf4e166){return connect()['then'](function(){return new BPromise(function(_0x2cc405,_0x31d6ef){return pm2[_0x81a9('0x8')](_0xf4e166,function(_0x35fc5e,_0x5687a0){if(_0x35fc5e){return _0x31d6ef(_0x35fc5e);}pm2['disconnect']();return _0x2cc405(_0x5687a0);});});});};exports[_0x81a9('0x9')]=function(){return connect()[_0x81a9('0x6')](function(){return new BPromise(function(_0x4885b8,_0x577eda){return pm2[_0x81a9('0x9')](function(_0x34b0fc,_0x131f73){if(_0x34b0fc){return _0x577eda(_0x34b0fc);}pm2['disconnect']();return _0x4885b8(_0x131f73);});});});};exports[_0x81a9('0xa')]=function(_0x36eaaf){return connect()[_0x81a9('0x6')](function(){return new BPromise(function(_0x234da2,_0x187057){return pm2[_0x81a9('0xa')](_0x36eaaf,function(_0x321b6d,_0x21531a){if(_0x321b6d){return _0x187057(_0x321b6d);}pm2[_0x81a9('0xb')]();return _0x234da2(_0x21531a);});});});};exports[_0x81a9('0xc')]=function(_0x38b62b){return connect()[_0x81a9('0x6')](function(){return new BPromise(function(_0x45486f,_0x1d4a03){return pm2[_0x81a9('0xc')](_0x38b62b,function(_0x443e17,_0x143002){if(_0x443e17){return _0x1d4a03(_0x443e17);}pm2['disconnect']();return _0x45486f(_0x143002);});});});};exports[_0x81a9('0xd')]=function(){return connect()[_0x81a9('0x6')](function(){return new BPromise(function(_0x26cf41,_0x3ff830){return pm2[_0x81a9('0xd')](function(_0x332671){if(_0x332671){return _0x3ff830(_0x332671);}return _0x26cf41(_0x81a9('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 9fd6b64..fb113c1 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 _0x8fd5=['../../config/environment','../../mysqldb','schedule','redis','Setting','find','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','emit','chatInteraction:update','catch','error','start','ioredis','util'];(function(_0x5e18a8,_0x542820){var _0x6af40d=function(_0x2f2e89){while(--_0x2f2e89){_0x5e18a8['push'](_0x5e18a8['shift']());}};_0x6af40d(++_0x542820);}(_0x8fd5,0x14e));var _0x58fd=function(_0x20e555,_0x40aea6){_0x20e555=_0x20e555-0x0;var _0x182077=_0x8fd5[_0x20e555];return _0x182077;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x58fd('0x0'));var util=require(_0x58fd('0x1'));var config=require(_0x58fd('0x2'));var db=require(_0x58fd('0x3'))['db'];var logger=require('../logger')(_0x58fd('0x4'));config[_0x58fd('0x5')]=_['defaults'](config[_0x58fd('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x58fd('0x5')]));function closeInteractions(){var _0xe6ad40=0x0;var _0x41de92=[];return db[_0x58fd('0x6')][_0x58fd('0x7')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x6b6a1f){_0xe6ad40=_0x6b6a1f[_0x58fd('0x8')];if(_0xe6ad40){return db[_0x58fd('0x9')]['findAll']({'raw':!![],'attributes':['id',_0x58fd('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x58fd('0xb')](_0x6b6a1f['chatTimeout'],_0x58fd('0xc'))}}});}else{return[];}})[_0x58fd('0xd')](function(_0x306bc5){if(_0x306bc5&&_0x306bc5[_0x58fd('0xe')]){_0x41de92=_[_0x58fd('0xf')](_0x306bc5||[],'id');logger[_0x58fd('0x10')](_0x58fd('0x11'),_0x41de92[_0x58fd('0x12')]());return db[_0x58fd('0x9')][_0x58fd('0x13')]({'closeReason':_0x58fd('0x14'),'disposition':_0x58fd('0x15'),'closed':!![],'closedAt':moment()[_0x58fd('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x41de92}});}})['then'](function(){if(_0x41de92&&_0x41de92[_0x58fd('0xe')]){logger[_0x58fd('0x10')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x41de92[_0x58fd('0x12')]());for(var _0x2b32df=0x0;_0x2b32df<_0x41de92[_0x58fd('0xe')];_0x2b32df++){io[_0x58fd('0x17')](_0x58fd('0x18'),{'id':_0x41de92[_0x2b32df],'closed':!![]});}}})[_0x58fd('0x19')](function(_0x297bfe){logger[_0x58fd('0x1a')]('[CHAT]\x20Error\x20closing\x20interactions',_0x297bfe?util['inspect'](_0x297bfe,{'showHidden':![],'depth':null}):'');});}exports[_0x58fd('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xca7a=['lodash','moment','ioredis','../../config/environment','../../mysqldb','defaults','redis','localhost','Setting','chatTimeout','then','ChatInteraction','lastMsgAt','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','info','emit','chatInteraction:update','catch','error','start'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca7a,0xd8));var _0xaca7=function(_0x36d2e4,_0x49819a){_0x36d2e4=_0x36d2e4-0x0;var _0x3c32ae=_0xca7a[_0x36d2e4];return _0x3c32ae;};'use strict';var _=require(_0xaca7('0x0'));var moment=require(_0xaca7('0x1'));var Redis=require(_0xaca7('0x2'));var util=require('util');var config=require(_0xaca7('0x3'));var db=require(_0xaca7('0x4'))['db'];var logger=require('../logger')('schedule');config['redis']=_[_0xaca7('0x5')](config[_0xaca7('0x6')],{'host':_0xaca7('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaca7('0x6')]));function closeInteractions(){var _0x19d48a=0x0;var _0x3c2601=[];return db[_0xaca7('0x8')]['find']({'raw':!![],'attributes':['id',_0xaca7('0x9')],'where':{'id':0x1}})[_0xaca7('0xa')](function(_0x14b7ab){_0x19d48a=_0x14b7ab[_0xaca7('0x9')];if(_0x19d48a){return db[_0xaca7('0xb')]['findAll']({'raw':!![],'attributes':['id',_0xaca7('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x14b7ab[_0xaca7('0x9')],_0xaca7('0xd'))}}});}else{return[];}})[_0xaca7('0xa')](function(_0x34d6d8){if(_0x34d6d8&&_0x34d6d8[_0xaca7('0xe')]){_0x3c2601=_[_0xaca7('0xf')](_0x34d6d8||[],'id');logger['info'](_0xaca7('0x10'),_0x3c2601[_0xaca7('0x11')]());return db[_0xaca7('0xb')][_0xaca7('0x12')]({'closeReason':_0xaca7('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xaca7('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3c2601}});}})[_0xaca7('0xa')](function(){if(_0x3c2601&&_0x3c2601[_0xaca7('0xe')]){logger[_0xaca7('0x15')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x3c2601[_0xaca7('0x11')]());for(var _0x3dea20=0x0;_0x3dea20<_0x3c2601['length'];_0x3dea20++){io[_0xaca7('0x16')](_0xaca7('0x17'),{'id':_0x3c2601[_0x3dea20],'closed':!![]});}}})[_0xaca7('0x18')](function(_0x5d0eb6){logger[_0xaca7('0x19')]('[CHAT]\x20Error\x20closing\x20interactions',_0x5d0eb6?util['inspect'](_0x5d0eb6,{'showHidden':![],'depth':null}):'');});}exports[_0xaca7('0x1a')]=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 059031e..32a8f03 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 _0x6904=['then','error','error\x20mail','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','update','stop\x20cron','run','util','lodash','moment','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','email','MailAccount','service','Smtp','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','savename','zip','join','existsSync','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail'];(function(_0x1b6563,_0x3bf0f1){var _0xdea7b8=function(_0x49e6c6){while(--_0x49e6c6){_0x1b6563['push'](_0x1b6563['shift']());}};_0xdea7b8(++_0x3bf0f1);}(_0x6904,0xe8));var _0x4690=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0x6904[_0x1cd674];return _0x27928f;};'use strict';var fs=require('fs');var util=require(_0x4690('0x0'));var path=require('path');var _=require(_0x4690('0x1'));var moment=require(_0x4690('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x4690('0x3'))(_0x4690('0x4'));var db=require(_0x4690('0x5'))['db'];var analyticCustomReportController=require(_0x4690('0x6'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x4690('0x7')][_0x4690('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x394739,_0x57cf63){return function(){logger[_0x4690('0x9')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x394739[_0x4690('0xa')]);var _0x51539f=!![];var _0x3e1eff={'tls':{'rejectUnauthorized':![]}};if(_0x394739[_0x4690('0xb')]['Smtp']['service']){_0x3e1eff[_0x4690('0xc')]=_0x394739[_0x4690('0xb')][_0x4690('0xd')][_0x4690('0xc')];}else{_0x3e1eff[_0x4690('0xe')]=_0x394739[_0x4690('0xb')][_0x4690('0xd')][_0x4690('0xe')];_0x3e1eff[_0x4690('0xf')]=_0x394739[_0x4690('0xb')][_0x4690('0xd')][_0x4690('0xf')];_0x3e1eff[_0x4690('0x10')]=_0x394739[_0x4690('0xb')]['Smtp'][_0x4690('0x10')];}if(_0x394739[_0x4690('0xb')]['Smtp'][_0x4690('0x11')]){_0x3e1eff[_0x4690('0x12')]={'user':_0x394739[_0x4690('0xb')][_0x4690('0xd')][_0x4690('0x13')],'pass':_0x394739['MailAccount']['Smtp'][_0x4690('0x14')]};}var _0x170254={'account':_0x3e1eff,'message':{'from':util[_0x4690('0x15')](_0x4690('0x16'),_0x394739[_0x4690('0xb')][_0x4690('0x17')],_0x394739['MailAccount']['email']||_0x394739[_0x4690('0xb')][_0x4690('0xd')][_0x4690('0x13')]),'to':_0x394739['email'],'cc':_0x394739['cc'],'bcc':_0x394739[_0x4690('0x18')],'subject':util[_0x4690('0x15')](_0x4690('0x19'),_0x57cf63['name'],_0x394739['subtractNumber'],_0x394739['subtractUnit'])}};var _0x27e842=path['join'](__dirname,'../../files/reports');var _0xd9421d=_0x57cf63[_0x4690('0x1a')];var _0x264ff4=util[_0x4690('0x15')]('%s.%s',path['basename'](_0x57cf63['savename'],path['extname'](_0x57cf63[_0x4690('0x1a')])),_0x4690('0x1b'));var _0x43b24d=path[_0x4690('0x1c')](_0x27e842,_0xd9421d);var _0x3a2990=path[_0x4690('0x1c')](_0x27e842,_0x264ff4);if(fs[_0x4690('0x1d')](_0x43b24d)){_0x57cf63['status']='Sent';_0x170254[_0x4690('0x1e')][_0x4690('0x1f')]=[{'filename':_0xd9421d,'path':_0x43b24d}];_0x170254[_0x4690('0x1e')]['text']=util['format'](_0x4690('0x20'),JSON[_0x4690('0x21')](_0x57cf63,null,0x2));}else if(fs[_0x4690('0x1d')](_0x3a2990)){_0x57cf63[_0x4690('0x22')]='Sent';_0x170254[_0x4690('0x1e')]['attachments']=[{'filename':_0x264ff4,'path':_0x3a2990}];}else{_0x170254[_0x4690('0x1e')][_0x4690('0x23')]=_0x4690('0x24');if(!_0x394739[_0x4690('0x25')]){_0x51539f=![];logger['info'](_0x4690('0x26'));}}if(_0x51539f){return client[_0x4690('0x27')](_0x4690('0x28'),_0x170254)[_0x4690('0x29')](function(_0x263430){if(_0x263430[_0x4690('0x2a')]){return logger[_0x4690('0x2a')](_0x4690('0x2b'),JSON[_0x4690('0x21')](_0x263430));}return logger[_0x4690('0x9')]('email\x20sent');})[_0x4690('0x2c')](function(_0x3d9d72){return logger[_0x4690('0x2a')](_0x4690('0x2b'),JSON[_0x4690('0x21')](_0x3d9d72));});}};}function handleError(){return function(_0x101b78){return logger[_0x4690('0x2a')](JSON['stringify'](_0x101b78));};}function handleResult(_0x1987c6){return function(_0x3b090a){logger['info'](_0x4690('0x2d'),JSON[_0x4690('0x21')](_0x3b090a));if(_0x1987c6[_0x4690('0xb')]&&_0x1987c6[_0x4690('0xb')]['Smtp']&&!_[_0x4690('0x2e')](_0x1987c6[_0x4690('0xa')])){setTimeout(handleSendEmail(_0x1987c6,_0x3b090a),0x3c*0x3e8);}};}function handleJob(_0x1a08ca){return function(){try{if(_[_0x4690('0x2e')](_0x1a08ca[_0x4690('0x2f')])){return logger[_0x4690('0x9')](_0x4690('0x30'));}if(_['isNil'](_0x1a08ca[_0x4690('0x31')])){return logger[_0x4690('0x9')](_0x4690('0x32'));}var _0x343cb0={'startDate':moment()[_0x4690('0x33')](_0x1a08ca[_0x4690('0x2f')],_0x1a08ca['subtractUnit'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x4690('0x15')](_0x4690('0x34')),'type':_0x4690('0x35'),'output':_0x1a08ca[_0x4690('0x36')],'name':_0x1a08ca['name']};if(!_['isNil'](_0x1a08ca[_0x4690('0x37')])){logger[_0x4690('0x9')](_0x4690('0x38'),_0x1a08ca['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x1a08ca[_0x4690('0x37')]},_0x343cb0)[_0x4690('0x29')](handleResult(_0x1a08ca))[_0x4690('0x2c')](handleError());}if(!_[_0x4690('0x2e')](_0x1a08ca[_0x4690('0x39')])){logger[_0x4690('0x9')](_0x4690('0x3a'),_0x1a08ca[_0x4690('0x39')]);return analyticCustomReportController[_0x4690('0x3b')]({'id':_0x1a08ca[_0x4690('0x39')]},_0x343cb0)[_0x4690('0x29')](handleResult(_0x1a08ca))[_0x4690('0x2c')](handleError());}}catch(_0x576548){logger['error'](JSON[_0x4690('0x21')](_0x576548));}return logger[_0x4690('0x9')](_0x4690('0x3c'));};}function getJobs(_0x11fb9c){var _0x5e2445={};if(_0x11fb9c){_0x5e2445['id']=_0x11fb9c;}return db[_0x4690('0x3d')][_0x4690('0x3e')]({'where':_0x5e2445,'include':[{'model':db[_0x4690('0xb')],'attributes':['id',_0x4690('0x17'),_0x4690('0xa')],'include':[{'model':db[_0x4690('0x3f')],'as':'Smtp'}]}]})[_0x4690('0x29')](function(_0x272526){var _0x3df734=_[_0x4690('0x40')](manager[_0x4690('0x41')]);var _0x4b6cc6=_['map'](_0x272526,function(_0xd732fb){return _0xd732fb['id'][_0x4690('0x42')]();});var _0x323ca2=_[_0x4690('0x43')](_0x272526,function(_0x182078){return _0x182078['id'][_0x4690('0x42')]();});var _0x2c2b56=_0x11fb9c?_0x4b6cc6:_[_0x4690('0x44')](_0x4b6cc6,_0x3df734);var _0x3e1e22=_[_0x4690('0x45')](_0x4b6cc6,_0x3df734);var _0x477395=_[_0x4690('0x44')](_0x3df734,_0x4b6cc6);var _0x368bb;var _0x4ce2fb;for(_0x368bb=0x0;_0x368bb<_0x477395[_0x4690('0x46')]&&!_0x11fb9c;_0x368bb+=0x1){_0x4ce2fb=_0x477395[_0x368bb][_0x4690('0x42')]();if(manager[_0x4690('0x47')](_0x4ce2fb)){manager[_0x4690('0x48')](_0x4ce2fb);manager[_0x4690('0x49')](_0x4ce2fb);logger[_0x4690('0x9')](_0x4690('0x4a'),_0x4ce2fb);}}logger[_0x4690('0x9')](_0x4690('0x4b'),JSON[_0x4690('0x21')](_0x2c2b56));for(_0x368bb=0x0;_0x368bb<_0x2c2b56[_0x4690('0x46')];_0x368bb+=0x1){_0x4ce2fb=_0x2c2b56[_0x368bb]['toString']();logger[_0x4690('0x9')](_0x4690('0x4c'),_0x4ce2fb);if(_0x11fb9c){logger[_0x4690('0x9')](_0x4690('0x4d'),_0x11fb9c);logger[_0x4690('0x9')](JSON[_0x4690('0x21')](_0x323ca2[_0x4ce2fb]));BPromise[_0x4690('0x4e')]()[_0x4690('0x29')](handleJob(_0x323ca2[_0x4ce2fb]));logger[_0x4690('0x9')](_0x4690('0x4f'),_0x323ca2[_0x4ce2fb]['name'],_0x323ca2[_0x4ce2fb]['cron']);}else if(_0x323ca2[_0x4ce2fb][_0x4690('0x50')]&&_0x323ca2[_0x4ce2fb][_0x4690('0x51')]&&moment()[_0x4690('0x52')](_0x323ca2[_0x4ce2fb][_0x4690('0x53')],_0x323ca2[_0x4ce2fb][_0x4690('0x54')])){manager[_0x4690('0x55')](_0x4ce2fb,_0x323ca2[_0x4ce2fb]['cron'],handleJob(_0x323ca2[_0x4ce2fb]));manager[_0x4690('0x56')](_0x4ce2fb);logger[_0x4690('0x9')](_0x4690('0x57'),_0x323ca2[_0x4ce2fb][_0x4690('0x17')],_0x323ca2[_0x4ce2fb][_0x4690('0x50')]);}else if(manager['exists'](_0x4ce2fb)){manager[_0x4690('0x48')](_0x4ce2fb);manager['deleteJob'](_0x4ce2fb);logger['info']('stop\x20cron',_0x323ca2[_0x4ce2fb][_0x4690('0x17')],_0x323ca2[_0x4ce2fb]['cron']);}}for(_0x368bb=0x0,_0x4ce2fb;_0x368bb<_0x3e1e22[_0x4690('0x46')]&&!_0x11fb9c;_0x368bb+=0x1){_0x4ce2fb=_0x3e1e22[_0x368bb][_0x4690('0x42')]();if(manager[_0x4690('0x47')](_0x4ce2fb)){if(_0x323ca2[_0x4ce2fb]['cron']&&_0x323ca2[_0x4ce2fb]['active']&&moment()[_0x4690('0x52')](_0x323ca2[_0x4ce2fb]['startAt'],_0x323ca2[_0x4ce2fb][_0x4690('0x54')])){manager[_0x4690('0x58')](_0x4ce2fb,_0x323ca2[_0x4ce2fb]['cron'],handleJob(_0x323ca2[_0x4ce2fb]));logger[_0x4690('0x9')]('update\x20cron',_0x323ca2[_0x4ce2fb][_0x4690('0x17')],_0x323ca2[_0x4ce2fb][_0x4690('0x50')]);}else{manager['stop'](_0x4ce2fb);manager[_0x4690('0x49')](_0x4ce2fb);logger[_0x4690('0x9')](_0x4690('0x59'),_0x323ca2[_0x4ce2fb][_0x4690('0x17')],_0x323ca2[_0x4ce2fb][_0x4690('0x50')]);}}}})[_0x4690('0x2c')](function(_0x3aeecd){logger['error'](JSON[_0x4690('0x21')](_0x3aeecd));});}exports[_0x4690('0x5a')]=function(_0x281077){return getJobs(_0x281077);};exports[_0x4690('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x7ac3=['savename','%s.%s','zip','join','existsSync','status','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','Sent','message','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','request','SendMail','then','error','catch','error\x20mail','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','findAll','MailServerOut','keys','jobs','toString','difference','intersection','stop','toRun','length','index','resolve','run\x20job','cron','active','isBetween','startAt','add','add\x20cron','exists','deleteJob','stop\x20cron','endAt','update','run','start','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','MailAccount','Smtp','service','host','port','secure','auth','format','\x22%s\x22\x20<%s>','name','email','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports'];(function(_0x18b20e,_0x46903c){var _0xadd3a9=function(_0x477ece){while(--_0x477ece){_0x18b20e['push'](_0x18b20e['shift']());}};_0xadd3a9(++_0x46903c);}(_0x7ac3,0xe8));var _0x37ac=function(_0x1ff5bd,_0x59b7be){_0x1ff5bd=_0x1ff5bd-0x0;var _0x5267ef=_0x7ac3[_0x1ff5bd];return _0x5267ef;};'use strict';var fs=require('fs');var util=require(_0x37ac('0x0'));var path=require(_0x37ac('0x1'));var _=require(_0x37ac('0x2'));var moment=require(_0x37ac('0x3'));var CronJobManager=require(_0x37ac('0x4'));var jayson=require(_0x37ac('0x5'));var BPromise=require('bluebird');var logger=require(_0x37ac('0x6'))(_0x37ac('0x7'));var db=require(_0x37ac('0x8'))['db'];var analyticCustomReportController=require(_0x37ac('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x37ac('0xa')][_0x37ac('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4eb3d4,_0x12efab){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x4eb3d4['email']);var _0x2e8a4e=!![];var _0x5eba65={'tls':{'rejectUnauthorized':![]}};if(_0x4eb3d4[_0x37ac('0xc')][_0x37ac('0xd')]['service']){_0x5eba65['service']=_0x4eb3d4['MailAccount'][_0x37ac('0xd')][_0x37ac('0xe')];}else{_0x5eba65[_0x37ac('0xf')]=_0x4eb3d4[_0x37ac('0xc')][_0x37ac('0xd')][_0x37ac('0xf')];_0x5eba65[_0x37ac('0x10')]=_0x4eb3d4[_0x37ac('0xc')][_0x37ac('0xd')][_0x37ac('0x10')];_0x5eba65['secure']=_0x4eb3d4['MailAccount'][_0x37ac('0xd')][_0x37ac('0x11')];}if(_0x4eb3d4['MailAccount']['Smtp']['authentication']){_0x5eba65[_0x37ac('0x12')]={'user':_0x4eb3d4[_0x37ac('0xc')][_0x37ac('0xd')]['user'],'pass':_0x4eb3d4[_0x37ac('0xc')][_0x37ac('0xd')]['pass']};}var _0x4ebf5a={'account':_0x5eba65,'message':{'from':util[_0x37ac('0x13')](_0x37ac('0x14'),_0x4eb3d4[_0x37ac('0xc')][_0x37ac('0x15')],_0x4eb3d4[_0x37ac('0xc')][_0x37ac('0x16')]||_0x4eb3d4[_0x37ac('0xc')][_0x37ac('0xd')][_0x37ac('0x17')]),'to':_0x4eb3d4[_0x37ac('0x16')],'cc':_0x4eb3d4['cc'],'bcc':_0x4eb3d4[_0x37ac('0x18')],'subject':util[_0x37ac('0x13')](_0x37ac('0x19'),_0x12efab[_0x37ac('0x15')],_0x4eb3d4[_0x37ac('0x1a')],_0x4eb3d4[_0x37ac('0x1b')])}};var _0x53f792=path['join'](__dirname,_0x37ac('0x1c'));var _0x5bab6e=_0x12efab[_0x37ac('0x1d')];var _0x18e7cf=util['format'](_0x37ac('0x1e'),path['basename'](_0x12efab[_0x37ac('0x1d')],path['extname'](_0x12efab['savename'])),_0x37ac('0x1f'));var _0x545be1=path[_0x37ac('0x20')](_0x53f792,_0x5bab6e);var _0x10e632=path[_0x37ac('0x20')](_0x53f792,_0x18e7cf);if(fs[_0x37ac('0x21')](_0x545be1)){_0x12efab[_0x37ac('0x22')]='Sent';_0x4ebf5a['message'][_0x37ac('0x23')]=[{'filename':_0x5bab6e,'path':_0x545be1}];_0x4ebf5a['message'][_0x37ac('0x24')]=util['format'](_0x37ac('0x25'),JSON[_0x37ac('0x26')](_0x12efab,null,0x2));}else if(fs[_0x37ac('0x21')](_0x10e632)){_0x12efab[_0x37ac('0x22')]=_0x37ac('0x27');_0x4ebf5a[_0x37ac('0x28')][_0x37ac('0x23')]=[{'filename':_0x18e7cf,'path':_0x10e632}];}else{_0x4ebf5a['message'][_0x37ac('0x24')]=_0x37ac('0x29');if(!_0x4eb3d4[_0x37ac('0x2a')]){_0x2e8a4e=![];logger[_0x37ac('0x2b')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x2e8a4e){return client[_0x37ac('0x2c')](_0x37ac('0x2d'),_0x4ebf5a)[_0x37ac('0x2e')](function(_0x2dee63){if(_0x2dee63[_0x37ac('0x2f')]){return logger['error']('error\x20mail',JSON[_0x37ac('0x26')](_0x2dee63));}return logger[_0x37ac('0x2b')]('email\x20sent');})[_0x37ac('0x30')](function(_0x256860){return logger[_0x37ac('0x2f')](_0x37ac('0x31'),JSON[_0x37ac('0x26')](_0x256860));});}};}function handleError(){return function(_0x4081f3){return logger[_0x37ac('0x2f')](JSON[_0x37ac('0x26')](_0x4081f3));};}function handleResult(_0x36e720){return function(_0x40eb1c){logger[_0x37ac('0x2b')](_0x37ac('0x32'),JSON[_0x37ac('0x26')](_0x40eb1c));if(_0x36e720[_0x37ac('0xc')]&&_0x36e720[_0x37ac('0xc')][_0x37ac('0xd')]&&!_[_0x37ac('0x33')](_0x36e720[_0x37ac('0x16')])){setTimeout(handleSendEmail(_0x36e720,_0x40eb1c),0x3c*0x3e8);}};}function handleJob(_0xe1218d){return function(){try{if(_[_0x37ac('0x33')](_0xe1218d[_0x37ac('0x1a')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x37ac('0x33')](_0xe1218d[_0x37ac('0x1b')])){return logger[_0x37ac('0x2b')](_0x37ac('0x34'));}var _0xee7e4a={'startDate':moment()[_0x37ac('0x35')](_0xe1218d[_0x37ac('0x1a')],_0xe1218d[_0x37ac('0x1b')])[_0x37ac('0x13')](_0x37ac('0x36')),'endDate':moment()['format'](_0x37ac('0x36')),'type':'scheduled','output':_0xe1218d[_0x37ac('0x37')],'name':_0xe1218d[_0x37ac('0x15')]};if(!_['isNil'](_0xe1218d[_0x37ac('0x38')])){logger[_0x37ac('0x2b')](_0x37ac('0x39'),_0xe1218d[_0x37ac('0x38')]);return analyticDefaultReportController[_0x37ac('0x3a')]({'id':_0xe1218d[_0x37ac('0x38')]},_0xee7e4a)[_0x37ac('0x2e')](handleResult(_0xe1218d))[_0x37ac('0x30')](handleError());}if(!_[_0x37ac('0x33')](_0xe1218d[_0x37ac('0x3b')])){logger[_0x37ac('0x2b')](_0x37ac('0x3c'),_0xe1218d[_0x37ac('0x3b')]);return analyticCustomReportController[_0x37ac('0x3a')]({'id':_0xe1218d[_0x37ac('0x3b')]},_0xee7e4a)[_0x37ac('0x2e')](handleResult(_0xe1218d))['catch'](handleError());}}catch(_0x2ab6a1){logger[_0x37ac('0x2f')](JSON[_0x37ac('0x26')](_0x2ab6a1));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x40688){var _0x2faa2e={};if(_0x40688){_0x2faa2e['id']=_0x40688;}return db['Schedule'][_0x37ac('0x3d')]({'where':_0x2faa2e,'include':[{'model':db[_0x37ac('0xc')],'attributes':['id',_0x37ac('0x15'),_0x37ac('0x16')],'include':[{'model':db[_0x37ac('0x3e')],'as':_0x37ac('0xd')}]}]})[_0x37ac('0x2e')](function(_0xa0cb45){var _0x3572a1=_[_0x37ac('0x3f')](manager[_0x37ac('0x40')]);var _0x219bbf=_['map'](_0xa0cb45,function(_0x59fec2){return _0x59fec2['id'][_0x37ac('0x41')]();});var _0x52bda2=_['keyBy'](_0xa0cb45,function(_0x1cc558){return _0x1cc558['id'][_0x37ac('0x41')]();});var _0x40fa55=_0x40688?_0x219bbf:_[_0x37ac('0x42')](_0x219bbf,_0x3572a1);var _0x464032=_[_0x37ac('0x43')](_0x219bbf,_0x3572a1);var _0x53c41b=_[_0x37ac('0x42')](_0x3572a1,_0x219bbf);var _0x377c40;var _0x405dfc;for(_0x377c40=0x0;_0x377c40<_0x53c41b['length']&&!_0x40688;_0x377c40+=0x1){_0x405dfc=_0x53c41b[_0x377c40][_0x37ac('0x41')]();if(manager['exists'](_0x405dfc)){manager[_0x37ac('0x44')](_0x405dfc);manager['deleteJob'](_0x405dfc);logger[_0x37ac('0x2b')]('delete\x20cron',_0x405dfc);}}logger[_0x37ac('0x2b')](_0x37ac('0x45'),JSON[_0x37ac('0x26')](_0x40fa55));for(_0x377c40=0x0;_0x377c40<_0x40fa55[_0x37ac('0x46')];_0x377c40+=0x1){_0x405dfc=_0x40fa55[_0x377c40]['toString']();logger['info'](_0x37ac('0x47'),_0x405dfc);if(_0x40688){logger[_0x37ac('0x2b')]('my\x20id',_0x40688);logger[_0x37ac('0x2b')](JSON['stringify'](_0x52bda2[_0x405dfc]));BPromise[_0x37ac('0x48')]()[_0x37ac('0x2e')](handleJob(_0x52bda2[_0x405dfc]));logger[_0x37ac('0x2b')](_0x37ac('0x49'),_0x52bda2[_0x405dfc][_0x37ac('0x15')],_0x52bda2[_0x405dfc][_0x37ac('0x4a')]);}else if(_0x52bda2[_0x405dfc]['cron']&&_0x52bda2[_0x405dfc][_0x37ac('0x4b')]&&moment()[_0x37ac('0x4c')](_0x52bda2[_0x405dfc][_0x37ac('0x4d')],_0x52bda2[_0x405dfc]['endAt'])){manager[_0x37ac('0x4e')](_0x405dfc,_0x52bda2[_0x405dfc]['cron'],handleJob(_0x52bda2[_0x405dfc]));manager['start'](_0x405dfc);logger[_0x37ac('0x2b')](_0x37ac('0x4f'),_0x52bda2[_0x405dfc][_0x37ac('0x15')],_0x52bda2[_0x405dfc][_0x37ac('0x4a')]);}else if(manager[_0x37ac('0x50')](_0x405dfc)){manager['stop'](_0x405dfc);manager[_0x37ac('0x51')](_0x405dfc);logger[_0x37ac('0x2b')](_0x37ac('0x52'),_0x52bda2[_0x405dfc][_0x37ac('0x15')],_0x52bda2[_0x405dfc][_0x37ac('0x4a')]);}}for(_0x377c40=0x0,_0x405dfc;_0x377c40<_0x464032[_0x37ac('0x46')]&&!_0x40688;_0x377c40+=0x1){_0x405dfc=_0x464032[_0x377c40]['toString']();if(manager[_0x37ac('0x50')](_0x405dfc)){if(_0x52bda2[_0x405dfc]['cron']&&_0x52bda2[_0x405dfc][_0x37ac('0x4b')]&&moment()['isBetween'](_0x52bda2[_0x405dfc][_0x37ac('0x4d')],_0x52bda2[_0x405dfc][_0x37ac('0x53')])){manager[_0x37ac('0x54')](_0x405dfc,_0x52bda2[_0x405dfc][_0x37ac('0x4a')],handleJob(_0x52bda2[_0x405dfc]));logger[_0x37ac('0x2b')]('update\x20cron',_0x52bda2[_0x405dfc]['name'],_0x52bda2[_0x405dfc]['cron']);}else{manager[_0x37ac('0x44')](_0x405dfc);manager['deleteJob'](_0x405dfc);logger['info'](_0x37ac('0x52'),_0x52bda2[_0x405dfc][_0x37ac('0x15')],_0x52bda2[_0x405dfc][_0x37ac('0x4a')]);}}}})[_0x37ac('0x30')](function(_0x6675fc){logger['error'](JSON[_0x37ac('0x26')](_0x6675fc));});}exports[_0x37ac('0x55')]=function(_0xf074fa){return getJobs(_0xf074fa);};exports[_0x37ac('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 389cf64..7d54f12 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 _0x153c=['substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','transcripts','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Positive','catch','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20configured','forEach','push','all','name','SequelizeValidationError','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment'];(function(_0x20812c,_0x9b17b4){var _0x2ba52a=function(_0xcceb8e){while(--_0xcceb8e){_0x20812c['push'](_0x20812c['shift']());}};_0x2ba52a(++_0x9b17b4);}(_0x153c,0x8c));var _0xc153=function(_0x30357f,_0x338d5b){_0x30357f=_0x30357f-0x0;var _0x4f7100=_0x153c[_0x30357f];return _0x4f7100;};var _=require(_0xc153('0x0'));var AWS=require(_0xc153('0x1'));var rp=require(_0xc153('0x2'));var util=require(_0xc153('0x3'));var BPromise=require('bluebird');var db=require(_0xc153('0x4'))['db'];var logger=require(_0xc153('0x5'))(_0xc153('0x6'));function getTranscriptionJob(_0x22c05b,_0x2e075e,_0x24fa12,_0x34e4b2){return new Promise(function(_0x58f5c5,_0x267a79){var _0x46a8b7=new AWS[(_0xc153('0x7'))]({'accessKeyId':_0x2e075e,'secretAccessKey':_0x22c05b,'region':_0x24fa12});_0x46a8b7[_0xc153('0x8')]({'TranscriptionJobName':_0x34e4b2},function(_0x374a0c,_0x5a844b){if(_0x374a0c){return _0x267a79(_0x374a0c);}else{return _0x58f5c5(_0x5a844b);}});});}function sentiment(_0x584a57,_0x5838f2,_0x3843d3,_0x3566e3,_0x12ecca){return new Promise(function(_0x4040b3,_0x1d706e){var _0x5367d7=new AWS['Comprehend']({'accessKeyId':_0x5838f2,'secretAccessKey':_0x584a57,'region':_0x3843d3});_0x5367d7[_0xc153('0x9')]({'Text':_0x3566e3,'LanguageCode':_0x12ecca[_0xc153('0xa')](0x0,0x2)},function(_0x49b44c,_0x138fae){if(_0x49b44c){return _0x1d706e(_0x49b44c);}else{return _0x4040b3(_0x138fae);}});});}function checkTranscribeJob(_0x361e7f,_0x4f48f5,_0x49286f){var _0x1c9d09;return new BPromise(function(_0x1f7c65,_0x2e92f5){logger['info'](util[_0xc153('0xb')](_0xc153('0xc'),_0x361e7f['id'],_0x361e7f[_0xc153('0xd')]));return getTranscriptionJob(_0x49286f['data1'],_0x49286f[_0xc153('0xe')],_0x4f48f5[_0xc153('0xf')],_0x361e7f['transcribeName'])['then'](function(_0x41c1a3){logger[_0xc153('0x10')](util[_0xc153('0xb')](_0xc153('0x11'),_0x361e7f['id'],_0x361e7f[_0xc153('0xd')],_0x41c1a3[_0xc153('0x12')][_0xc153('0x13')]));if(!_0x361e7f[_0xc153('0x14')]){switch(_0x41c1a3['TranscriptionJob'][_0xc153('0x13')]){case _0xc153('0x15'):var _0x19fc4e={'transcribeStatus':_0x41c1a3['TranscriptionJob'][_0xc153('0x13')],'fileUri':_0x41c1a3['TranscriptionJob']['Transcript'][_0xc153('0x16')]};logger[_0xc153('0x10')](util[_0xc153('0xb')](_0xc153('0x17'),_0x361e7f['id']));return rp({'uri':_0x41c1a3[_0xc153('0x12')][_0xc153('0x18')]['TranscriptFileUri'],'json':!![]})[_0xc153('0x19')](function(_0x4b7a9d){logger[_0xc153('0x10')](util[_0xc153('0xb')](_0xc153('0x1a'),_0x361e7f['id']));if(_0x4b7a9d&&_0x4b7a9d[_0xc153('0x1b')]&&_0x4b7a9d['results']['transcripts']&&_0x4b7a9d[_0xc153('0x1b')]['transcripts'][_0xc153('0x1c')]){_0x19fc4e[_0xc153('0x14')]='';for(var _0x2a1ea6=0x0;_0x2a1ea6<_0x4b7a9d[_0xc153('0x1b')]['transcripts'][_0xc153('0x1c')];_0x2a1ea6++){_0x19fc4e[_0xc153('0x14')]+=_0x4b7a9d[_0xc153('0x1b')][_0xc153('0x1d')][_0x2a1ea6][_0xc153('0x1e')]+'';}}return _0x361e7f[_0xc153('0x1f')](_0x19fc4e);})['then'](function(){logger[_0xc153('0x10')](util['format'](_0xc153('0x20'),_0x361e7f['id']));if(!_0x361e7f[_0xc153('0x21')]){throw new db['Sequelize'][(_0xc153('0x22'))](_0xc153('0x23'));}if(!_0x4f48f5['sentiment']||!_0x4f48f5[_0xc153('0x24')]||!_0x4f48f5[_0xc153('0x25')]||!_0x4f48f5[_0xc153('0x26')]||!_0x4f48f5['bucket']){throw new db[(_0xc153('0x27'))][(_0xc153('0x22'))](_0xc153('0x28'));}if(!_0x19fc4e['fileText']){throw new Error(_0xc153('0x29'));}if(_0x4f48f5[_0xc153('0x24')]===_0x49286f['id']){return _0x49286f;}else{return db[_0xc153('0x2a')][_0xc153('0x2b')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xc153('0x19')](function(_0x56afaa){if(!_0x56afaa){throw new db[(_0xc153('0x27'))]['ValidationError'](_0xc153('0x2c'));}if(!_0x56afaa[_0xc153('0x2d')]||!_0x56afaa['data2']){throw new db[(_0xc153('0x27'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x1c9d09=_0x56afaa;logger[_0xc153('0x10')](util[_0xc153('0xb')](_0xc153('0x2e'),_0x361e7f['id']));return sentiment(_0x1c9d09[_0xc153('0x2d')],_0x1c9d09[_0xc153('0xe')],_0x4f48f5['sentimentRegion'],_0x19fc4e[_0xc153('0x14')],_0x4f48f5[_0xc153('0x26')]);})[_0xc153('0x19')](function(_0x2c1f35){logger[_0xc153('0x10')](util[_0xc153('0xb')](_0xc153('0x2f'),_0x361e7f['id']));return _0x361e7f[_0xc153('0x1f')]({'sentiment':_0x2c1f35[_0xc153('0x30')],'sPositive':_0x2c1f35[_0xc153('0x31')]['Positive'],'sNegative':_0x2c1f35['SentimentScore'][_0xc153('0x32')],'sMixed':_0x2c1f35['SentimentScore'][_0xc153('0x33')],'sNeutral':_0x2c1f35[_0xc153('0x31')][_0xc153('0x34')]});})['then'](function(){logger[_0xc153('0x10')](util[_0xc153('0xb')](_0xc153('0x20'),_0x361e7f['id']));_0x1f7c65();});case _0xc153('0x35'):return _0x361e7f[_0xc153('0x1f')]({'transcribeStatus':_0xc153('0x35'),'failureReason':_0x41c1a3[_0xc153('0x12')][_0xc153('0x36')]})['then'](function(){logger['info'](util[_0xc153('0xb')](_0xc153('0x20'),_0x361e7f['id']));_0x1f7c65();});default:logger[_0xc153('0x10')](util[_0xc153('0xb')](_0xc153('0x37'),_0x361e7f['id']));break;}}else{return BPromise[_0xc153('0x38')]()['then'](function(){if(!_0x361e7f[_0xc153('0x21')]){throw new db[(_0xc153('0x27'))][(_0xc153('0x22'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4f48f5[_0xc153('0x39')]||!_0x4f48f5[_0xc153('0x24')]||!_0x4f48f5[_0xc153('0x25')]||!_0x4f48f5['language']||!_0x4f48f5['bucket']){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x361e7f[_0xc153('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0x4f48f5[_0xc153('0x24')]===_0x49286f['id']){return _0x49286f;}else{return db[_0xc153('0x2a')][_0xc153('0x2b')]({'where':{'id':_settings[_0xc153('0x24')]}});}})[_0xc153('0x19')](function(_0x3d09d5){if(!_0x3d09d5){throw new db[(_0xc153('0x27'))][(_0xc153('0x22'))](_0xc153('0x2c'));}if(!_0x3d09d5[_0xc153('0x2d')]||!_0x3d09d5[_0xc153('0xe')]){throw new db[(_0xc153('0x27'))][(_0xc153('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x1c9d09=_0x3d09d5;logger[_0xc153('0x10')](util[_0xc153('0xb')](_0xc153('0x2e'),_0x361e7f['id']));return sentiment(_0x1c9d09[_0xc153('0x2d')],_0x1c9d09[_0xc153('0xe')],_0x4f48f5['sentimentRegion'],_0x361e7f[_0xc153('0x14')],_0x4f48f5[_0xc153('0x26')]);})['then'](function(_0x5c3c37){logger[_0xc153('0x10')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x361e7f['id']));return _0x361e7f['update']({'sentiment':_0x5c3c37[_0xc153('0x30')],'sPositive':_0x5c3c37['SentimentScore'][_0xc153('0x3a')],'sNegative':_0x5c3c37[_0xc153('0x31')][_0xc153('0x32')],'sMixed':_0x5c3c37['SentimentScore']['Mixed'],'sNeutral':_0x5c3c37[_0xc153('0x31')][_0xc153('0x34')],'transcribeStatus':_0xc153('0x15')});})[_0xc153('0x19')](function(){logger[_0xc153('0x10')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x361e7f['id']));_0x1f7c65();});}})[_0xc153('0x3b')](function(_0x5a38ed){if(_0x5a38ed){if(!_0x5a38ed['name']||_0x5a38ed['name']!=='SequelizeValidationError'){logger[_0xc153('0x3c')](util['format'](_0xc153('0x3d'),_0x361e7f['id']),util[_0xc153('0x3e')](_0x5a38ed,{'showHidden':![],'depth':null}));}}_0x1f7c65();});});}function checkTranscribe(){var _0x31c2f7;var _0x20be09;var _0x41eed2;return db['VoiceRecording'][_0xc153('0x3f')]({'where':{'transcribeStatus':_0xc153('0x40')}})[_0xc153('0x19')](function(_0x109814){if(!_0x109814||!_0x109814[_0xc153('0x1c')]){throw new db['Sequelize']['ValidationError'](_0xc153('0x41'));}_0x31c2f7=_0x109814;return db['Setting'][_0xc153('0x2b')]({'where':{'id':0x1}});})[_0xc153('0x19')](function(_0x108c00){if(!_0x108c00){throw new db[(_0xc153('0x27'))][(_0xc153('0x22'))](_0xc153('0x42'));}_0x20be09=_0x108c00;if(!_0x20be09[_0xc153('0x6')]||!_0x20be09['transcribeAccountId']||!_0x20be09[_0xc153('0xf')]||!_0x20be09['language']||!_0x20be09['bucket']){throw new db[(_0xc153('0x27'))][(_0xc153('0x22'))](_0xc153('0x43'));}return db[_0xc153('0x2a')][_0xc153('0x2b')]({'where':{'id':_0x20be09[_0xc153('0x44')]}});})[_0xc153('0x19')](function(_0x39e810){if(!_0x39e810){throw new db[(_0xc153('0x27'))][(_0xc153('0x22'))](_0xc153('0x2c'));}if(!_0x39e810[_0xc153('0x2d')]||!_0x39e810[_0xc153('0xe')]){throw new db[(_0xc153('0x27'))][(_0xc153('0x22'))](_0xc153('0x45'));}_0x41eed2=_0x39e810;var _0x5e1f68=[];_0x31c2f7[_0xc153('0x46')](function(_0x366d94){_0x5e1f68[_0xc153('0x47')](checkTranscribeJob(_0x366d94,_0x20be09,_0x41eed2));});return BPromise[_0xc153('0x48')](_0x5e1f68);})[_0xc153('0x3b')](function(_0x3c2fb2){if(_0x3c2fb2){if(!_0x3c2fb2[_0xc153('0x49')]||_0x3c2fb2[_0xc153('0x49')]!==_0xc153('0x4a')){logger[_0xc153('0x3c')](util['inspect'](_0x3c2fb2,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x7e22=['results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','bucket','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Sentiment','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','start','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','substring','info','format','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','COMPLETED','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded'];(function(_0xe8fabd,_0x2201dc){var _0x17c2c3=function(_0x3ec3dd){while(--_0x3ec3dd){_0xe8fabd['push'](_0xe8fabd['shift']());}};_0x17c2c3(++_0x2201dc);}(_0x7e22,0x1d8));var _0x27e2=function(_0x2fa8b1,_0x766b87){_0x2fa8b1=_0x2fa8b1-0x0;var _0x26ca4d=_0x7e22[_0x2fa8b1];return _0x26ca4d;};var _=require(_0x27e2('0x0'));var AWS=require('aws-sdk');var rp=require(_0x27e2('0x1'));var util=require(_0x27e2('0x2'));var BPromise=require(_0x27e2('0x3'));var db=require(_0x27e2('0x4'))['db'];var logger=require(_0x27e2('0x5'))(_0x27e2('0x6'));function getTranscriptionJob(_0x5e5b08,_0x43868c,_0x4b2588,_0x3b7d1e){return new Promise(function(_0x350996,_0x3eb3cd){var _0x8ec259=new AWS['TranscribeService']({'accessKeyId':_0x43868c,'secretAccessKey':_0x5e5b08,'region':_0x4b2588});_0x8ec259[_0x27e2('0x7')]({'TranscriptionJobName':_0x3b7d1e},function(_0x419985,_0x44cf2e){if(_0x419985){return _0x3eb3cd(_0x419985);}else{return _0x350996(_0x44cf2e);}});});}function sentiment(_0x49591c,_0x29d007,_0xadcc3e,_0x1892a9,_0x256eac){return new Promise(function(_0x49d150,_0x3303bb){var _0x1ada35=new AWS['Comprehend']({'accessKeyId':_0x29d007,'secretAccessKey':_0x49591c,'region':_0xadcc3e});_0x1ada35[_0x27e2('0x8')]({'Text':_0x1892a9,'LanguageCode':_0x256eac[_0x27e2('0x9')](0x0,0x2)},function(_0x298536,_0x1d6bc6){if(_0x298536){return _0x3303bb(_0x298536);}else{return _0x49d150(_0x1d6bc6);}});});}function checkTranscribeJob(_0x5f5603,_0x1d57b7,_0x5a4e20){var _0x39d327;return new BPromise(function(_0x396d33,_0x41809c){logger[_0x27e2('0xa')](util[_0x27e2('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5f5603['id'],_0x5f5603[_0x27e2('0xc')]));return getTranscriptionJob(_0x5a4e20['data1'],_0x5a4e20[_0x27e2('0xd')],_0x1d57b7[_0x27e2('0xe')],_0x5f5603[_0x27e2('0xc')])[_0x27e2('0xf')](function(_0x3499e2){logger[_0x27e2('0xa')](util[_0x27e2('0xb')](_0x27e2('0x10'),_0x5f5603['id'],_0x5f5603['transcribeName'],_0x3499e2['TranscriptionJob'][_0x27e2('0x11')]));if(!_0x5f5603[_0x27e2('0x12')]){switch(_0x3499e2['TranscriptionJob'][_0x27e2('0x11')]){case _0x27e2('0x13'):var _0x20518f={'transcribeStatus':_0x3499e2[_0x27e2('0x14')][_0x27e2('0x11')],'fileUri':_0x3499e2['TranscriptionJob'][_0x27e2('0x15')][_0x27e2('0x16')]};logger[_0x27e2('0xa')](util['format'](_0x27e2('0x17'),_0x5f5603['id']));return rp({'uri':_0x3499e2[_0x27e2('0x14')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0x27e2('0xf')](function(_0x43cc48){logger[_0x27e2('0xa')](util[_0x27e2('0xb')](_0x27e2('0x18'),_0x5f5603['id']));if(_0x43cc48&&_0x43cc48[_0x27e2('0x19')]&&_0x43cc48[_0x27e2('0x19')]['transcripts']&&_0x43cc48['results'][_0x27e2('0x1a')][_0x27e2('0x1b')]){_0x20518f[_0x27e2('0x12')]='';for(var _0x270cf3=0x0;_0x270cf3<_0x43cc48[_0x27e2('0x19')][_0x27e2('0x1a')]['length'];_0x270cf3++){_0x20518f[_0x27e2('0x12')]+=_0x43cc48[_0x27e2('0x19')]['transcripts'][_0x270cf3][_0x27e2('0x1c')]+'';}}return _0x5f5603[_0x27e2('0x1d')](_0x20518f);})['then'](function(){logger['info'](util[_0x27e2('0xb')](_0x27e2('0x1e'),_0x5f5603['id']));if(!_0x5f5603[_0x27e2('0x1f')]){throw new db[(_0x27e2('0x20'))][(_0x27e2('0x21'))](_0x27e2('0x22'));}if(!_0x1d57b7[_0x27e2('0x23')]||!_0x1d57b7[_0x27e2('0x24')]||!_0x1d57b7['sentimentRegion']||!_0x1d57b7['language']||!_0x1d57b7[_0x27e2('0x25')]){throw new db['Sequelize'][(_0x27e2('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x20518f[_0x27e2('0x12')]){throw new Error(_0x27e2('0x26'));}if(_0x1d57b7[_0x27e2('0x24')]===_0x5a4e20['id']){return _0x5a4e20;}else{return db[_0x27e2('0x27')][_0x27e2('0x28')]({'where':{'id':_settings[_0x27e2('0x24')]}});}})['then'](function(_0x1eb259){if(!_0x1eb259){throw new db['Sequelize']['ValidationError'](_0x27e2('0x29'));}if(!_0x1eb259[_0x27e2('0x2a')]||!_0x1eb259[_0x27e2('0xd')]){throw new db[(_0x27e2('0x20'))][(_0x27e2('0x21'))](_0x27e2('0x2b'));}_0x39d327=_0x1eb259;logger[_0x27e2('0xa')](util[_0x27e2('0xb')](_0x27e2('0x2c'),_0x5f5603['id']));return sentiment(_0x39d327[_0x27e2('0x2a')],_0x39d327[_0x27e2('0xd')],_0x1d57b7['sentimentRegion'],_0x20518f['fileText'],_0x1d57b7[_0x27e2('0x2d')]);})['then'](function(_0x22cda0){logger['info'](util[_0x27e2('0xb')](_0x27e2('0x2e'),_0x5f5603['id']));return _0x5f5603['update']({'sentiment':_0x22cda0['Sentiment'],'sPositive':_0x22cda0[_0x27e2('0x2f')][_0x27e2('0x30')],'sNegative':_0x22cda0[_0x27e2('0x2f')][_0x27e2('0x31')],'sMixed':_0x22cda0[_0x27e2('0x2f')][_0x27e2('0x32')],'sNeutral':_0x22cda0['SentimentScore'][_0x27e2('0x33')]});})['then'](function(){logger['info'](util[_0x27e2('0xb')](_0x27e2('0x1e'),_0x5f5603['id']));_0x396d33();});case _0x27e2('0x34'):return _0x5f5603[_0x27e2('0x1d')]({'transcribeStatus':_0x27e2('0x34'),'failureReason':_0x3499e2[_0x27e2('0x14')][_0x27e2('0x35')]})[_0x27e2('0xf')](function(){logger['info'](util[_0x27e2('0xb')](_0x27e2('0x1e'),_0x5f5603['id']));_0x396d33();});default:logger[_0x27e2('0xa')](util['format'](_0x27e2('0x36'),_0x5f5603['id']));break;}}else{return BPromise['resolve']()[_0x27e2('0xf')](function(){if(!_0x5f5603['tempSentiment']){throw new db[(_0x27e2('0x20'))][(_0x27e2('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1d57b7[_0x27e2('0x23')]||!_0x1d57b7[_0x27e2('0x24')]||!_0x1d57b7[_0x27e2('0x37')]||!_0x1d57b7[_0x27e2('0x2d')]||!_0x1d57b7[_0x27e2('0x25')]){throw new db[(_0x27e2('0x20'))]['ValidationError'](_0x27e2('0x38'));}if(!_0x5f5603[_0x27e2('0x12')]){throw new Error(_0x27e2('0x26'));}if(_0x1d57b7['sentimentAccountId']===_0x5a4e20['id']){return _0x5a4e20;}else{return db[_0x27e2('0x27')][_0x27e2('0x28')]({'where':{'id':_settings[_0x27e2('0x24')]}});}})[_0x27e2('0xf')](function(_0x401215){if(!_0x401215){throw new db['Sequelize'][(_0x27e2('0x21'))](_0x27e2('0x29'));}if(!_0x401215[_0x27e2('0x2a')]||!_0x401215[_0x27e2('0xd')]){throw new db[(_0x27e2('0x20'))][(_0x27e2('0x21'))](_0x27e2('0x2b'));}_0x39d327=_0x401215;logger[_0x27e2('0xa')](util[_0x27e2('0xb')](_0x27e2('0x2c'),_0x5f5603['id']));return sentiment(_0x39d327[_0x27e2('0x2a')],_0x39d327[_0x27e2('0xd')],_0x1d57b7[_0x27e2('0x37')],_0x5f5603[_0x27e2('0x12')],_0x1d57b7[_0x27e2('0x2d')]);})['then'](function(_0x287544){logger['info'](util['format'](_0x27e2('0x2e'),_0x5f5603['id']));return _0x5f5603[_0x27e2('0x1d')]({'sentiment':_0x287544[_0x27e2('0x39')],'sPositive':_0x287544[_0x27e2('0x2f')][_0x27e2('0x30')],'sNegative':_0x287544['SentimentScore']['Negative'],'sMixed':_0x287544['SentimentScore'][_0x27e2('0x32')],'sNeutral':_0x287544[_0x27e2('0x2f')][_0x27e2('0x33')],'transcribeStatus':_0x27e2('0x13')});})[_0x27e2('0xf')](function(){logger[_0x27e2('0xa')](util[_0x27e2('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5f5603['id']));_0x396d33();});}})[_0x27e2('0x3a')](function(_0x32b999){if(_0x32b999){if(!_0x32b999['name']||_0x32b999[_0x27e2('0x3b')]!==_0x27e2('0x3c')){logger[_0x27e2('0x3d')](util[_0x27e2('0xb')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x5f5603['id']),util[_0x27e2('0x3e')](_0x32b999,{'showHidden':![],'depth':null}));}}_0x396d33();});});}function checkTranscribe(){var _0xa9f4ab;var _0x305cfd;var _0x64d913;return db[_0x27e2('0x3f')]['findAll']({'where':{'transcribeStatus':_0x27e2('0x40')}})[_0x27e2('0xf')](function(_0x1cff7d){if(!_0x1cff7d||!_0x1cff7d['length']){throw new db[(_0x27e2('0x20'))][(_0x27e2('0x21'))]('No\x20transcribe\x20job\x20to\x20check');}_0xa9f4ab=_0x1cff7d;return db[_0x27e2('0x41')][_0x27e2('0x28')]({'where':{'id':0x1}});})[_0x27e2('0xf')](function(_0x1bd8a7){if(!_0x1bd8a7){throw new db[(_0x27e2('0x20'))][(_0x27e2('0x21'))](_0x27e2('0x42'));}_0x305cfd=_0x1bd8a7;if(!_0x305cfd[_0x27e2('0x6')]||!_0x305cfd[_0x27e2('0x43')]||!_0x305cfd[_0x27e2('0xe')]||!_0x305cfd[_0x27e2('0x2d')]||!_0x305cfd[_0x27e2('0x25')]){throw new db['Sequelize'][(_0x27e2('0x21'))]('Transcribe\x20not\x20configured');}return db[_0x27e2('0x27')][_0x27e2('0x28')]({'where':{'id':_0x305cfd[_0x27e2('0x43')]}});})[_0x27e2('0xf')](function(_0xc171bc){if(!_0xc171bc){throw new db[(_0x27e2('0x20'))][(_0x27e2('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xc171bc[_0x27e2('0x2a')]||!_0xc171bc[_0x27e2('0xd')]){throw new db['Sequelize'][(_0x27e2('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x64d913=_0xc171bc;var _0x5d0f48=[];_0xa9f4ab[_0x27e2('0x44')](function(_0x172891){_0x5d0f48[_0x27e2('0x45')](checkTranscribeJob(_0x172891,_0x305cfd,_0x64d913));});return BPromise['all'](_0x5d0f48);})['catch'](function(_0x48d772){if(_0x48d772){if(!_0x48d772[_0x27e2('0x3b')]||_0x48d772[_0x27e2('0x3b')]!=='SequelizeValidationError'){logger[_0x27e2('0x3d')](util[_0x27e2('0x3e')](_0x48d772,{'showHidden':![],'depth':null}));}}});}exports[_0x27e2('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index d821f7b..db63bfb 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 _0x4d1f=['system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','redis','socket.io-emitter','WhatsappInteraction','findAll','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join'];(function(_0x148d10,_0xc5fe5a){var _0x36f207=function(_0x2fdad2){while(--_0x2fdad2){_0x148d10['push'](_0x148d10['shift']());}};_0x36f207(++_0xc5fe5a);}(_0x4d1f,0x141));var _0xf4d1=function(_0x5c25fb,_0x117fb3){_0x5c25fb=_0x5c25fb-0x0;var _0x4c3313=_0x4d1f[_0x5c25fb];return _0x4c3313;};'use strict';var _=require(_0xf4d1('0x0'));var moment=require(_0xf4d1('0x1'));var Redis=require(_0xf4d1('0x2'));var util=require(_0xf4d1('0x3'));var config=require(_0xf4d1('0x4'));var db=require(_0xf4d1('0x5'))['db'];var logger=require('../logger')('schedule');config[_0xf4d1('0x6')]=_['defaults'](config[_0xf4d1('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xf4d1('0x7'))(new Redis(config[_0xf4d1('0x6')]));function closeInteractions(){var _0xa14873=[];return db[_0xf4d1('0x8')][_0xf4d1('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})['then'](function(_0x2a6fb0){if(_0x2a6fb0&&_0x2a6fb0[_0xf4d1('0xa')]){_0xa14873=_[_0xf4d1('0xb')](_0x2a6fb0||[],'id');logger[_0xf4d1('0xc')](_0xf4d1('0xd'),_0xa14873[_0xf4d1('0xe')]());return db[_0xf4d1('0x8')]['update']({'closeReason':_0xf4d1('0xf'),'disposition':_0xf4d1('0x10'),'closed':!![],'closedAt':moment()[_0xf4d1('0x11')](_0xf4d1('0x12'))},{'where':{'id':_0xa14873}});}})['then'](function(){if(_0xa14873&&_0xa14873[_0xf4d1('0xa')]){logger['info'](_0xf4d1('0x13'),_0xa14873[_0xf4d1('0xe')]());for(var _0x3872bb=0x0;_0x3872bb<_0xa14873[_0xf4d1('0xa')];_0x3872bb++){io['emit']('whatsappInteraction:update',{'id':_0xa14873[_0x3872bb],'closed':!![]});}}})[_0xf4d1('0x14')](function(_0x34a4e4){logger[_0xf4d1('0x15')](_0xf4d1('0x16'),_0x34a4e4?util[_0xf4d1('0x17')](_0x34a4e4,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x35a6=['lastMsgAt','subtract','hours','then','length','map','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','socket.io-emitter','redis','WhatsappInteraction','findAll'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x35a6,0x122));var _0x635a=function(_0x241e99,_0x561cf1){_0x241e99=_0x241e99-0x0;var _0x2c30be=_0x35a6[_0x241e99];return _0x2c30be;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x635a('0x0'));var util=require(_0x635a('0x1'));var config=require(_0x635a('0x2'));var db=require(_0x635a('0x3'))['db'];var logger=require(_0x635a('0x4'))(_0x635a('0x5'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x635a('0x6'))(new Redis(config[_0x635a('0x7')]));function closeInteractions(){var _0x383937=[];return db[_0x635a('0x8')][_0x635a('0x9')]({'raw':!![],'attributes':['id',_0x635a('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x635a('0xb')](0x18,_0x635a('0xc'))}}})[_0x635a('0xd')](function(_0x351bbc){if(_0x351bbc&&_0x351bbc[_0x635a('0xe')]){_0x383937=_[_0x635a('0xf')](_0x351bbc||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x383937[_0x635a('0x10')]());return db[_0x635a('0x8')][_0x635a('0x11')]({'closeReason':'system','disposition':_0x635a('0x12'),'closed':!![],'closedAt':moment()[_0x635a('0x13')](_0x635a('0x14'))},{'where':{'id':_0x383937}});}})['then'](function(){if(_0x383937&&_0x383937['length']){logger[_0x635a('0x15')](_0x635a('0x16'),_0x383937[_0x635a('0x10')]());for(var _0x3193f7=0x0;_0x3193f7<_0x383937['length'];_0x3193f7++){io[_0x635a('0x17')](_0x635a('0x18'),{'id':_0x383937[_0x3193f7],'closed':!![]});}}})[_0x635a('0x19')](function(_0x528620){logger[_0x635a('0x1a')](_0x635a('0x1b'),_0x528620?util[_0x635a('0x1c')](_0x528620,{'showHidden':![],'depth':null}):'');});}exports[_0x635a('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index a3ef48a..7fb8afc 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x697b=['Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','log','finished\x20populating','contacts1','CmHopper','then','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo'];(function(_0x3c2a37,_0xfa1c9d){var _0x3a9511=function(_0x3c58ff){while(--_0x3c58ff){_0x3c2a37['push'](_0x3c2a37['shift']());}};_0x3a9511(++_0xfa1c9d);}(_0x697b,0x6e));var _0xb697=function(_0x1b91bd,_0x56ab90){_0x1b91bd=_0x1b91bd-0x0;var _0x2872f2=_0x697b[_0x1b91bd];return _0x2872f2;};'use strict';var util=require(_0xb697('0x0'));var db=require(_0xb697('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xb697('0x2')]({'id':i,'firstName':_0xb697('0x3')+i,'lastName':_0xb697('0x4')+i,'phone':0xf879fb460+i,'email':_0xb697('0x5')+i+_0xb697('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb697('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xb697('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb697('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xb697('0x2')]({'id':i,'firstName':_0xb697('0x3')+i,'lastName':_0xb697('0x4')+i,'phone':0xf879fb460+i,'email':_0xb697('0x5')+i+_0xb697('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xb697('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xb697('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb697('0x7')](),'updatedAt':Date[_0xb697('0x7')]()});}db[_0xb697('0x8')][_0xb697('0x9')]({'where':{}})['then'](function(){return db[_0xb697('0x8')][_0xb697('0xa')](contacts);})['then'](function(){console[_0xb697('0xb')](_0xb697('0xc'),_0xb697('0xd'));return db[_0xb697('0xe')]['destroy']({'where':{}});})[_0xb697('0xf')](function(){return db[_0xb697('0xe')][_0xb697('0xa')](hopper);})[_0xb697('0xf')](function(){console[_0xb697('0xb')](_0xb697('0xc'),'hopper1');return db[_0xb697('0x8')]['bulkCreate'](contacts2);})[_0xb697('0xf')](function(){console[_0xb697('0xb')]('finished\x20populating',_0xb697('0x10'));return db[_0xb697('0xe')][_0xb697('0xa')](hopper2);})[_0xb697('0xf')](function(){console[_0xb697('0xb')]('finished\x20populating',_0xb697('0x11'));})[_0xb697('0x12')](function(_0x25ef78){console[_0xb697('0xb')](_0x25ef78);}); \ No newline at end of file +var _0x0f48=['finished\x20populating','contacts1','CmHopper','destroy','log','hopper2','catch','../mysqldb','Innocenzo','innocenzo.biondo','@xcally.com','push','now','Biondo','CmContact','then','bulkCreate'];(function(_0x42c118,_0x111737){var _0x1cffa8=function(_0x27338f){while(--_0x27338f){_0x42c118['push'](_0x42c118['shift']());}};_0x1cffa8(++_0x111737);}(_0x0f48,0x1c1));var _0x80f4=function(_0x4ea327,_0x596b31){_0x4ea327=_0x4ea327-0x0;var _0x6c4253=_0x0f48[_0x4ea327];return _0x6c4253;};'use strict';var util=require('util');var db=require(_0x80f4('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x80f4('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x80f4('0x2')+i+_0x80f4('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x80f4('0x4')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x80f4('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x80f4('0x1')+i,'lastName':_0x80f4('0x6')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x80f4('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x80f4('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x80f4('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x80f4('0x5')]()});}db[_0x80f4('0x7')]['destroy']({'where':{}})[_0x80f4('0x8')](function(){return db[_0x80f4('0x7')][_0x80f4('0x9')](contacts);})[_0x80f4('0x8')](function(){console['log'](_0x80f4('0xa'),_0x80f4('0xb'));return db[_0x80f4('0xc')][_0x80f4('0xd')]({'where':{}});})[_0x80f4('0x8')](function(){return db[_0x80f4('0xc')]['bulkCreate'](hopper);})['then'](function(){console[_0x80f4('0xe')](_0x80f4('0xa'),'hopper1');return db['CmContact']['bulkCreate'](contacts2);})[_0x80f4('0x8')](function(){console[_0x80f4('0xe')](_0x80f4('0xa'),'contacts2');return db[_0x80f4('0xc')]['bulkCreate'](hopper2);})[_0x80f4('0x8')](function(){console['log'](_0x80f4('0xa'),_0x80f4('0xf'));})[_0x80f4('0x10')](function(_0x2bb985){console['log'](_0x2bb985);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index edb1485..b60a658 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d81=['log','add\x20user','catch','util','push','format','%s%s','agent','password','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','then'];(function(_0x373d35,_0x131198){var _0x144781=function(_0x51925a){while(--_0x51925a){_0x373d35['push'](_0x373d35['shift']());}};_0x144781(++_0x131198);}(_0x9d81,0x18a));var _0x19d8=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9d81[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x19d8('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x19d8('0x1')]({'name':util[_0x19d8('0x2')](_0x19d8('0x3'),'agent',i),'fullname':util[_0x19d8('0x2')]('%s%s','agent',i),'email':util['format']('%s%s@xcally.com',_0x19d8('0x4'),i),'role':_0x19d8('0x4'),'password':_0x19d8('0x5'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x19d8('0x6')],'disallow':['all'],'allow':[_0x19d8('0x7')],'defaultuser':util[_0x19d8('0x2')](_0x19d8('0x3'),_0x19d8('0x4'),i),'encryption':_0x19d8('0x8'),'avpf':_0x19d8('0x8'),'force_avp':_0x19d8('0x8'),'icesupport':_0x19d8('0x8'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x19d8('0x9'),'dtlsprivatekey':_0x19d8('0xa'),'dtlssetup':_0x19d8('0xb'),'callerid':util[_0x19d8('0x2')](_0x19d8('0xc'),util['format'](_0x19d8('0x3'),_0x19d8('0x4'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0x19d8('0xd')](function(){console[_0x19d8('0xe')](_0x19d8('0xf'));})[_0x19d8('0x10')](function(_0x180cd6){console[_0x19d8('0xe')](_0x180cd6);}); \ No newline at end of file +var _0x3ad2=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','add\x20user','log','util','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','wss','all'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3ad2,0x12f));var _0x23ad=function(_0x12fb36,_0x2285e9){_0x12fb36=_0x12fb36-0x0;var _0x37952d=_0x3ad2[_0x12fb36];return _0x37952d;};'use strict';var util=require(_0x23ad('0x0'));var db=require(_0x23ad('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x23ad('0x2')]({'name':util['format'](_0x23ad('0x3'),_0x23ad('0x4'),i),'fullname':util[_0x23ad('0x5')]('%s%s',_0x23ad('0x4'),i),'email':util[_0x23ad('0x5')](_0x23ad('0x6'),'agent',i),'role':_0x23ad('0x4'),'password':_0x23ad('0x7'),'internal':0xfa0+i,'type':_0x23ad('0x8'),'transport':[_0x23ad('0x9'),'ws',_0x23ad('0xa')],'disallow':[_0x23ad('0xb')],'allow':['ulaw'],'defaultuser':util[_0x23ad('0x5')]('%s%s','agent',i),'encryption':'yes','avpf':_0x23ad('0xc'),'force_avp':_0x23ad('0xc'),'icesupport':_0x23ad('0xc'),'dtlsenable':_0x23ad('0xc'),'dtlsverify':'no','dtlscertfile':_0x23ad('0xd'),'dtlsprivatekey':_0x23ad('0xe'),'dtlssetup':_0x23ad('0xf'),'callerid':util[_0x23ad('0x5')](_0x23ad('0x10'),util[_0x23ad('0x5')](_0x23ad('0x3'),_0x23ad('0x4'),i),0xfa0+i)});}db[_0x23ad('0x11')][_0x23ad('0x12')](users)['then'](function(){console['log'](_0x23ad('0x13'));})['catch'](function(_0x408188){console[_0x23ad('0x14')](_0x408188);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 58ec452..360b332 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x046b=['user_has_chat_interactions:remove','leave','removeMailInteractions','emit','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','User','where','Campaign','%s:queue:%s','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','format','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','voice:outbound','SmsQueues','MailQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','map','removeChatInteractions'];(function(_0x58c099,_0x5c8584){var _0x4b2be0=function(_0x5b244c){while(--_0x5b244c){_0x58c099['push'](_0x58c099['shift']());}};_0x4b2be0(++_0x5c8584);}(_0x046b,0x1ba));var _0xb046=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0x046b[_0x1f5a63];return _0x30bb7a;};'use strict';var _=require(_0xb046('0x0'));var util=require(_0xb046('0x1'));var BPromise=require(_0xb046('0x2'));var db=require(_0xb046('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xb046('0x4')],'include':[{'as':_0xb046('0x5'),'model':db['User'],'attributes':['id',_0xb046('0x4'),_0xb046('0x6')],'raw':!![],'where':{'role':_0xb046('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb046('0x4')],'where':{'role':_0xb046('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb046('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xb046('0x4')],'where':{'role':_0xb046('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb046('0x4'),_0xb046('0x9')],'where':{'type':_0xb046('0xa')}};function getAssociatedResources(_0x48f38d,_0x37eef0,_0x53c263){return db[_0xb046('0xb')][_0xb046('0xc')]({'where':{'name':_0x48f38d,'userProfileId':_0x37eef0},'raw':!![]})[_0xb046('0xd')](function(_0x322324){if(_0x322324){if(_0x322324[_0xb046('0xe')]){switch(_0x48f38d){case'VoiceQueues':case _0xb046('0xf'):case _0xb046('0x10'):case'SmsQueues':case'MailQueues':case _0xb046('0x11'):case _0xb046('0x12'):return db[_0x53c263][_0xb046('0x13')](queryQueues);case _0xb046('0x14'):return db[_0x53c263][_0xb046('0x13')](queryTelephones);case _0xb046('0x15'):return db[_0x53c263][_0xb046('0x13')](queryTrunks);case _0xb046('0x16'):return db[_0x53c263][_0xb046('0x13')](queryCampaigns);}}else{return db[_0xb046('0x17')]['findAll']({'attributes':[_0xb046('0x18')],'where':{'sectionId':_0x322324['id']},'raw':!![]})[_0xb046('0xd')](function(_0x4fd90c){if(_0x4fd90c){var _0x2b0d1e={'where':{'id':_['map'](_0x4fd90c,_0xb046('0x18'))},'raw':!![]};switch(_0x53c263){case _0xb046('0x19'):_0x2b0d1e[_0xb046('0x1a')][_0xb046('0x6')]=_0xb046('0x8');break;case _0xb046('0x1b'):_0x2b0d1e['where']['type']=_0xb046('0xa');break;}return db[_0x53c263][_0xb046('0x13')](_0x2b0d1e);}else{return[];}});}}else{return[];}})[_0xb046('0xd')](function(_0x4cd3c1){return _0x4cd3c1;});}function joinOrLeaveQueues(_0x541283,_0x1d617c,_0x5e5594,_0x144022){_0x541283[_0x1d617c](util['format'](_0xb046('0x1c'),_0x5e5594,_0x144022[_0xb046('0x4')]));if(_0x144022[_0xb046('0x5')]){for(var _0x324dba=0x0;_0x324dba<_0x144022['Agents']['length'];_0x324dba+=0x1){_0x541283[_0x1d617c](util['format'](_0xb046('0x1d'),_0x144022[_0xb046('0x5')][_0x324dba][_0xb046('0x4')]));}}}function joinOrLeave(_0x471c65,_0xc3c99a,_0x433526){var _0x51c65d;if(_0x471c65[_0xb046('0x1e')]['query']['id']){db['User'][_0xb046('0x1f')]({'attributes':['id',_0xb046('0x4'),_0xb046('0x6'),_0xb046('0x20')],'where':{'id':_0x471c65[_0xb046('0x1e')][_0xb046('0x21')]['id']},'include':[{'model':db[_0xb046('0x22')],'as':_0xb046('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb046('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb046('0x25')],'as':_0xb046('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xb046('0x27')],'as':_0xb046('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xb046('0x29')],'as':_0xb046('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xb046('0xd')](function(_0x333dbe){if(_0x333dbe){_0x51c65d=_0x333dbe;_0x471c65[_0xc3c99a](util[_0xb046('0x2b')](_0xb046('0x1d'),_0x333dbe[_0xb046('0x4')]));var _0x4706ab=[];switch(_0x333dbe[_0xb046('0x6')]){case'admin':_0x471c65[_0xc3c99a](_0xb046('0x2c'));_0x471c65[_0xc3c99a]('voice:outbound');if(queryQueues[_0xb046('0x2d')](_0xb046('0x2e'))){delete queryQueues[_0xb046('0x2e')];}_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x30')]['findAll'](queryQueues));_0x4706ab['push'](db[_0xb046('0x31')][_0xb046('0x13')](queryQueues));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x32')]['findAll'](queryQueues));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x33')][_0xb046('0x13')](queryQueues));_0x4706ab['push'](db[_0xb046('0x34')][_0xb046('0x13')](queryQueues));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x35')][_0xb046('0x13')](queryQueues));_0x4706ab[_0xb046('0x2f')](db['WhatsappQueue']['findAll'](queryQueues));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x19')][_0xb046('0x13')](queryTelephones));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x36')]['findAll'](queryTrunks));_0x4706ab[_0xb046('0x2f')](db['Campaign'][_0xb046('0x13')](queryCampaigns));_0x4706ab[_0xb046('0x2f')](db[_0xb046('0x19')][_0xb046('0x13')](queryAgents));break;case _0xb046('0x37'):_0x471c65[_0xc3c99a](_0xb046('0x2c'));_0x471c65[_0xc3c99a](_0xb046('0x38'));_0x4706ab[_0xb046('0x2f')](getAssociatedResources('VoiceQueues',_0x333dbe[_0xb046('0x20')],_0xb046('0x30')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources('ChatQueues',_0x333dbe['userProfileId'],'ChatQueue'));_0x4706ab['push'](getAssociatedResources(_0xb046('0x10'),_0x333dbe[_0xb046('0x20')],'FaxQueue'));_0x4706ab[_0xb046('0x2f')](getAssociatedResources(_0xb046('0x39'),_0x333dbe[_0xb046('0x20')],_0xb046('0x33')));_0x4706ab['push'](getAssociatedResources(_0xb046('0x3a'),_0x333dbe['userProfileId'],_0xb046('0x34')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources(_0xb046('0x11'),_0x333dbe[_0xb046('0x20')],_0xb046('0x35')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources(_0xb046('0x12'),_0x333dbe[_0xb046('0x20')],_0xb046('0x3b')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources(_0xb046('0x14'),_0x333dbe[_0xb046('0x20')],_0xb046('0x19')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources('Trunks',_0x333dbe[_0xb046('0x20')],_0xb046('0x36')));_0x4706ab[_0xb046('0x2f')](getAssociatedResources(_0xb046('0x16'),_0x333dbe[_0xb046('0x20')],_0xb046('0x1b')));_0x4706ab['push'](db['User'][_0xb046('0x13')](queryAgents));break;case _0xb046('0x7'):_0x471c65[_0xc3c99a](_0xb046('0x2c'));_0x471c65[_0xc3c99a](_0xb046('0x38'));_0x4706ab[_0xb046('0x2f')](_0x333dbe[_0xb046('0x3c')]({'attributes':['id',_0xb046('0x4')]}));_0x4706ab['push'](_0x333dbe[_0xb046('0x3d')]({'attributes':['id',_0xb046('0x4')]}));_0x4706ab['push'](_0x333dbe[_0xb046('0x3e')]({'attributes':['id',_0xb046('0x4')]}));_0x4706ab['push'](_0x333dbe[_0xb046('0x3f')]({'attributes':['id','name']}));_0x4706ab[_0xb046('0x2f')](_0x333dbe[_0xb046('0x40')]({'attributes':['id',_0xb046('0x4')]}));_0x4706ab['push'](_0x333dbe[_0xb046('0x41')]({'attributes':['id',_0xb046('0x4')]}));_0x4706ab[_0xb046('0x2f')](_0x333dbe[_0xb046('0x42')]({'attributes':['id',_0xb046('0x4')]}));break;}return BPromise['all'](_0x4706ab);}})['then'](function(_0x5b81f1){if(_0x5b81f1&&_0x5b81f1[_0xb046('0x43')]){for(var _0x7004b4=0x0;_0x7004b4<_0x5b81f1[_0xb046('0x43')];_0x7004b4+=0x1){for(var _0x33a6fd=0x0;_0x33a6fd<_0x5b81f1[_0x7004b4][_0xb046('0x43')];_0x33a6fd+=0x1){switch(_0x7004b4){case 0x0:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x44'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x1:joinOrLeaveQueues(_0x471c65,_0xc3c99a,'chat',_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x2:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x45'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x3:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x46'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x4:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x47'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x5:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x48'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x6:joinOrLeaveQueues(_0x471c65,_0xc3c99a,_0xb046('0x49'),_0x5b81f1[_0x7004b4][_0x33a6fd]);break;case 0x7:if(_0x51c65d[_0xb046('0x6')]!==_0xb046('0x7'))_0x471c65[_0xc3c99a](util[_0xb046('0x2b')]('telephone:%s',_0x5b81f1[_0x7004b4][_0x33a6fd][_0xb046('0x4')]));break;case 0x8:if(_0x51c65d[_0xb046('0x6')]!==_0xb046('0x7'))_0x471c65[_0xc3c99a](util[_0xb046('0x2b')](_0xb046('0x4a'),_0x5b81f1[_0x7004b4][_0x33a6fd]['name']));break;case 0x9:if(_0x51c65d[_0xb046('0x6')]!=='agent')_0x471c65[_0xc3c99a](util[_0xb046('0x2b')](_0xb046('0x4b'),_0x5b81f1[_0x7004b4][_0x33a6fd][_0xb046('0x9')],_0x5b81f1[_0x7004b4][_0x33a6fd][_0xb046('0x4')]));break;case 0xa:_0x471c65[_0xc3c99a](util['format'](_0xb046('0x1d'),_0x5b81f1[_0x7004b4][_0x33a6fd][_0xb046('0x4')]));break;}}}}})[_0xb046('0xd')](function(){if(_0xc3c99a==='leave'){var _0x474b65=_[_0xb046('0x4c')](_0x51c65d[_0xb046('0x23')],'id');return _0x51c65d[_0xb046('0x4d')](_0x474b65)[_0xb046('0xd')](function(){for(var _0x248097=0x0;_0x248097<_0x474b65[_0xb046('0x43')];_0x248097+=0x1){_0x433526['emit'](_0xb046('0x4e'),{'ChatInteractionId':Number(_0x474b65[_0x248097]),'UserId':Number(_0x51c65d['id'])});}});}})['then'](function(){if(_0xc3c99a===_0xb046('0x4f')){var _0x41e3a8=_['map'](_0x51c65d['MailInteractions'],'id');return _0x51c65d[_0xb046('0x50')](_0x41e3a8)[_0xb046('0xd')](function(){for(var _0x27692a=0x0;_0x27692a<_0x41e3a8['length'];_0x27692a+=0x1){_0x433526[_0xb046('0x51')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x41e3a8[_0x27692a]),'UserId':Number(_0x51c65d['id'])});}});}})[_0xb046('0xd')](function(){if(_0xc3c99a===_0xb046('0x4f')){var _0x4dd0f7=_[_0xb046('0x4c')](_0x51c65d[_0xb046('0x52')],'id');return _0x51c65d[_0xb046('0x53')](_0x4dd0f7)['then'](function(){for(var _0x10ed02=0x0;_0x10ed02<_0x4dd0f7[_0xb046('0x43')];_0x10ed02+=0x1){_0x433526['emit'](_0xb046('0x54'),{'FaxInteractionId':Number(_0x4dd0f7[_0x10ed02]),'UserId':Number(_0x51c65d['id'])});}});}})[_0xb046('0xd')](function(){if(_0xc3c99a===_0xb046('0x4f')){var _0x22adbf=_['map'](_0x51c65d['SmsInteractions'],'id');return _0x51c65d[_0xb046('0x55')](_0x22adbf)[_0xb046('0xd')](function(){for(var _0x5d3fbb=0x0;_0x5d3fbb<_0x22adbf[_0xb046('0x43')];_0x5d3fbb+=0x1){_0x433526[_0xb046('0x51')](_0xb046('0x56'),{'SmsInteractionId':Number(_0x22adbf[_0x5d3fbb]),'UserId':Number(_0x51c65d['id'])});}});}})['then'](function(){if(_0xc3c99a==='leave'){var _0x262cde=_[_0xb046('0x4c')](_0x51c65d[_0xb046('0x28')],'id');return _0x51c65d[_0xb046('0x57')](_0x262cde)[_0xb046('0xd')](function(){for(var _0x3aff1a=0x0;_0x3aff1a<_0x262cde[_0xb046('0x43')];_0x3aff1a+=0x1){_0x433526[_0xb046('0x51')](_0xb046('0x58'),{'OpenchannelInteractionId':Number(_0x262cde[_0x3aff1a]),'UserId':Number(_0x51c65d['id'])});}});}})[_0xb046('0xd')](function(){if(_0xc3c99a===_0xb046('0x4f')){var _0x28cce4=_[_0xb046('0x4c')](_0x51c65d[_0xb046('0x2a')],'id');return _0x51c65d[_0xb046('0x59')](_0x28cce4)['then'](function(){for(var _0x519d2d=0x0;_0x519d2d<_0x28cce4[_0xb046('0x43')];_0x519d2d+=0x1){_0x433526['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x28cce4[_0x519d2d]),'UserId':Number(_0x51c65d['id'])});}});}})[_0xb046('0x5a')](function(_0x2c6782){_0x471c65[_0xb046('0x5b')](_0x2c6782);});}}function onDisconnect(_0x237cbe,_0x2fe60b){joinOrLeave(_0x237cbe,_0xb046('0x4f'),_0x2fe60b);}function onConnect(_0x21735d){joinOrLeave(_0x21735d,_0xb046('0x5c'));}exports[_0xb046('0x5d')]=function(_0x119754){_0x119754['on'](_0xb046('0x5e'),function(_0x4caa5a){_0x4caa5a[_0xb046('0x5f')](0x0);_0x4caa5a[_0xb046('0x60')]=_0x4caa5a[_0xb046('0x61')][_0xb046('0x5e')][_0xb046('0x62')]+':'+_0x4caa5a[_0xb046('0x61')][_0xb046('0x5e')]['remotePort'];_0x4caa5a['connectedAt']=new Date();_0x4caa5a['log']=function(_0x555b8a){console[_0xb046('0x5b')](_0xb046('0x63')+_0x4caa5a[_0xb046('0x64')][_0xb046('0x4')]+'['+_0x4caa5a['address']+']',_0x555b8a);};_0x4caa5a['on'](_0xb046('0x65'),function(){onDisconnect(_0x4caa5a,_0x119754);_0x4caa5a[_0xb046('0x5b')](_0xb046('0x66'));});onConnect(_0x4caa5a);_0x4caa5a[_0xb046('0x5b')](_0xb046('0x67'));});}; \ No newline at end of file +var _0xce62=['sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','removeChatInteractions','emit','leave','MailInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','then','VoiceQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','resourceId','map','where','role','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','SmsQueues','WhatsappQueue','IvrCampaigns','getVoiceQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xce62,0x83));var _0x2ce6=function(_0x19cc54,_0x24d120){_0x19cc54=_0x19cc54-0x0;var _0x4105ce=_0xce62[_0x19cc54];return _0x4105ce;};'use strict';var _=require(_0x2ce6('0x0'));var util=require(_0x2ce6('0x1'));var BPromise=require('bluebird');var db=require(_0x2ce6('0x2'))['db'];var config=require(_0x2ce6('0x3'));var queryQueues={'attributes':['id',_0x2ce6('0x4')],'include':[{'as':_0x2ce6('0x5'),'model':db[_0x2ce6('0x6')],'attributes':['id',_0x2ce6('0x4'),'role'],'raw':!![],'where':{'role':_0x2ce6('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x2ce6('0x4')],'where':{'role':_0x2ce6('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x2ce6('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x2ce6('0x4')],'where':{'role':_0x2ce6('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x2ce6('0x9')],'where':{'type':_0x2ce6('0xa')}};function getAssociatedResources(_0x47f788,_0x4dc8d5,_0x2e6eae){return db[_0x2ce6('0xb')]['findOne']({'where':{'name':_0x47f788,'userProfileId':_0x4dc8d5},'raw':!![]})[_0x2ce6('0xc')](function(_0x5693d4){if(_0x5693d4){if(_0x5693d4['autoAssociation']){switch(_0x47f788){case _0x2ce6('0xd'):case'ChatQueues':case _0x2ce6('0xe'):case'SmsQueues':case _0x2ce6('0xf'):case _0x2ce6('0x10'):case _0x2ce6('0x11'):return db[_0x2e6eae][_0x2ce6('0x12')](queryQueues);case _0x2ce6('0x13'):return db[_0x2e6eae][_0x2ce6('0x12')](queryTelephones);case _0x2ce6('0x14'):return db[_0x2e6eae][_0x2ce6('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x2e6eae][_0x2ce6('0x12')](queryCampaigns);}}else{return db['UserProfileResource'][_0x2ce6('0x12')]({'attributes':[_0x2ce6('0x15')],'where':{'sectionId':_0x5693d4['id']},'raw':!![]})[_0x2ce6('0xc')](function(_0x5dec62){if(_0x5dec62){var _0x312a6e={'where':{'id':_[_0x2ce6('0x16')](_0x5dec62,_0x2ce6('0x15'))},'raw':!![]};switch(_0x2e6eae){case _0x2ce6('0x6'):_0x312a6e[_0x2ce6('0x17')][_0x2ce6('0x18')]=_0x2ce6('0x8');break;case _0x2ce6('0x19'):_0x312a6e[_0x2ce6('0x17')][_0x2ce6('0x9')]='ivr';break;}return db[_0x2e6eae][_0x2ce6('0x12')](_0x312a6e);}else{return[];}});}}else{return[];}})[_0x2ce6('0xc')](function(_0x5ed660){return _0x5ed660;});}function joinOrLeaveQueues(_0x54e172,_0x411004,_0x2b5bf0,_0xa551b9){_0x54e172[_0x411004](util[_0x2ce6('0x1a')](_0x2ce6('0x1b'),_0x2b5bf0,_0xa551b9['name']));if(_0xa551b9[_0x2ce6('0x5')]){for(var _0x4947d7=0x0;_0x4947d7<_0xa551b9['Agents'][_0x2ce6('0x1c')];_0x4947d7+=0x1){_0x54e172[_0x411004](util[_0x2ce6('0x1a')](_0x2ce6('0x1d'),_0xa551b9['Agents'][_0x4947d7][_0x2ce6('0x4')]));}}}function joinOrLeave(_0x425461,_0x1e11b1,_0x437864){var _0x5a4656;if(_0x425461[_0x2ce6('0x1e')][_0x2ce6('0x1f')]['id']){db[_0x2ce6('0x6')][_0x2ce6('0x20')]({'attributes':['id',_0x2ce6('0x4'),_0x2ce6('0x18'),_0x2ce6('0x21')],'where':{'id':_0x425461['handshake']['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0x2ce6('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x2ce6('0x23')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x2ce6('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x2ce6('0x25')],'as':_0x2ce6('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x2ce6('0x27')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x2ce6('0x28'),'attributes':['id'],'raw':!![]}]})[_0x2ce6('0xc')](function(_0x2fd596){if(_0x2fd596){_0x5a4656=_0x2fd596;_0x425461[_0x1e11b1](util['format']('user:%s',_0x2fd596['name']));var _0x3dff5c=[];switch(_0x2fd596['role']){case _0x2ce6('0x29'):_0x425461[_0x1e11b1](_0x2ce6('0x2a'));_0x425461[_0x1e11b1](_0x2ce6('0x2b'));if(queryQueues[_0x2ce6('0x2c')](_0x2ce6('0x2d'))){delete queryQueues['include'];}_0x3dff5c[_0x2ce6('0x2e')](db[_0x2ce6('0x2f')][_0x2ce6('0x12')](queryQueues));_0x3dff5c[_0x2ce6('0x2e')](db['ChatQueue'][_0x2ce6('0x12')](queryQueues));_0x3dff5c[_0x2ce6('0x2e')](db[_0x2ce6('0x30')]['findAll'](queryQueues));_0x3dff5c[_0x2ce6('0x2e')](db[_0x2ce6('0x31')][_0x2ce6('0x12')](queryQueues));_0x3dff5c[_0x2ce6('0x2e')](db[_0x2ce6('0x32')][_0x2ce6('0x12')](queryQueues));_0x3dff5c['push'](db[_0x2ce6('0x33')]['findAll'](queryQueues));_0x3dff5c['push'](db['WhatsappQueue'][_0x2ce6('0x12')](queryQueues));_0x3dff5c[_0x2ce6('0x2e')](db[_0x2ce6('0x6')][_0x2ce6('0x12')](queryTelephones));_0x3dff5c[_0x2ce6('0x2e')](db[_0x2ce6('0x34')][_0x2ce6('0x12')](queryTrunks));_0x3dff5c[_0x2ce6('0x2e')](db[_0x2ce6('0x19')][_0x2ce6('0x12')](queryCampaigns));_0x3dff5c[_0x2ce6('0x2e')](db[_0x2ce6('0x6')][_0x2ce6('0x12')](queryAgents));break;case _0x2ce6('0x35'):_0x425461[_0x1e11b1](_0x2ce6('0x2a'));_0x425461[_0x1e11b1](_0x2ce6('0x2b'));_0x3dff5c['push'](getAssociatedResources(_0x2ce6('0xd'),_0x2fd596[_0x2ce6('0x21')],_0x2ce6('0x2f')));_0x3dff5c[_0x2ce6('0x2e')](getAssociatedResources('ChatQueues',_0x2fd596[_0x2ce6('0x21')],'ChatQueue'));_0x3dff5c[_0x2ce6('0x2e')](getAssociatedResources(_0x2ce6('0xe'),_0x2fd596[_0x2ce6('0x21')],_0x2ce6('0x30')));_0x3dff5c[_0x2ce6('0x2e')](getAssociatedResources(_0x2ce6('0x36'),_0x2fd596[_0x2ce6('0x21')],'SmsQueue'));_0x3dff5c['push'](getAssociatedResources(_0x2ce6('0xf'),_0x2fd596[_0x2ce6('0x21')],'MailQueue'));_0x3dff5c['push'](getAssociatedResources(_0x2ce6('0x10'),_0x2fd596[_0x2ce6('0x21')],_0x2ce6('0x33')));_0x3dff5c[_0x2ce6('0x2e')](getAssociatedResources('WhatsappQueues',_0x2fd596[_0x2ce6('0x21')],_0x2ce6('0x37')));_0x3dff5c[_0x2ce6('0x2e')](getAssociatedResources(_0x2ce6('0x13'),_0x2fd596[_0x2ce6('0x21')],_0x2ce6('0x6')));_0x3dff5c[_0x2ce6('0x2e')](getAssociatedResources(_0x2ce6('0x14'),_0x2fd596[_0x2ce6('0x21')],'Trunk'));_0x3dff5c['push'](getAssociatedResources(_0x2ce6('0x38'),_0x2fd596[_0x2ce6('0x21')],_0x2ce6('0x19')));_0x3dff5c['push'](db[_0x2ce6('0x6')]['findAll'](queryAgents));break;case _0x2ce6('0x7'):_0x425461[_0x1e11b1]('voice:inbound');_0x425461[_0x1e11b1](_0x2ce6('0x2b'));_0x3dff5c[_0x2ce6('0x2e')](_0x2fd596[_0x2ce6('0x39')]({'attributes':['id',_0x2ce6('0x4')]}));_0x3dff5c[_0x2ce6('0x2e')](_0x2fd596['getChatQueues']({'attributes':['id','name']}));_0x3dff5c[_0x2ce6('0x2e')](_0x2fd596[_0x2ce6('0x3a')]({'attributes':['id',_0x2ce6('0x4')]}));_0x3dff5c[_0x2ce6('0x2e')](_0x2fd596[_0x2ce6('0x3b')]({'attributes':['id',_0x2ce6('0x4')]}));_0x3dff5c[_0x2ce6('0x2e')](_0x2fd596['getMailQueues']({'attributes':['id',_0x2ce6('0x4')]}));_0x3dff5c[_0x2ce6('0x2e')](_0x2fd596[_0x2ce6('0x3c')]({'attributes':['id',_0x2ce6('0x4')]}));_0x3dff5c['push'](_0x2fd596[_0x2ce6('0x3d')]({'attributes':['id',_0x2ce6('0x4')]}));break;}return BPromise[_0x2ce6('0x3e')](_0x3dff5c);}})[_0x2ce6('0xc')](function(_0x39bcab){if(_0x39bcab&&_0x39bcab[_0x2ce6('0x1c')]){for(var _0x47606d=0x0;_0x47606d<_0x39bcab['length'];_0x47606d+=0x1){for(var _0x3d5250=0x0;_0x3d5250<_0x39bcab[_0x47606d][_0x2ce6('0x1c')];_0x3d5250+=0x1){switch(_0x47606d){case 0x0:joinOrLeaveQueues(_0x425461,_0x1e11b1,'voice',_0x39bcab[_0x47606d][_0x3d5250]);break;case 0x1:joinOrLeaveQueues(_0x425461,_0x1e11b1,_0x2ce6('0x3f'),_0x39bcab[_0x47606d][_0x3d5250]);break;case 0x2:joinOrLeaveQueues(_0x425461,_0x1e11b1,_0x2ce6('0x40'),_0x39bcab[_0x47606d][_0x3d5250]);break;case 0x3:joinOrLeaveQueues(_0x425461,_0x1e11b1,_0x2ce6('0x41'),_0x39bcab[_0x47606d][_0x3d5250]);break;case 0x4:joinOrLeaveQueues(_0x425461,_0x1e11b1,_0x2ce6('0x42'),_0x39bcab[_0x47606d][_0x3d5250]);break;case 0x5:joinOrLeaveQueues(_0x425461,_0x1e11b1,_0x2ce6('0x43'),_0x39bcab[_0x47606d][_0x3d5250]);break;case 0x6:joinOrLeaveQueues(_0x425461,_0x1e11b1,_0x2ce6('0x44'),_0x39bcab[_0x47606d][_0x3d5250]);break;case 0x7:if(_0x5a4656[_0x2ce6('0x18')]!==_0x2ce6('0x7'))_0x425461[_0x1e11b1](util['format'](_0x2ce6('0x45'),_0x39bcab[_0x47606d][_0x3d5250][_0x2ce6('0x4')]));break;case 0x8:if(_0x5a4656[_0x2ce6('0x18')]!=='agent')_0x425461[_0x1e11b1](util[_0x2ce6('0x1a')](_0x2ce6('0x46'),_0x39bcab[_0x47606d][_0x3d5250][_0x2ce6('0x4')]));break;case 0x9:if(_0x5a4656[_0x2ce6('0x18')]!==_0x2ce6('0x7'))_0x425461[_0x1e11b1](util['format']('campaign:%s:%s',_0x39bcab[_0x47606d][_0x3d5250][_0x2ce6('0x9')],_0x39bcab[_0x47606d][_0x3d5250][_0x2ce6('0x4')]));break;case 0xa:_0x425461[_0x1e11b1](util[_0x2ce6('0x1a')](_0x2ce6('0x1d'),_0x39bcab[_0x47606d][_0x3d5250][_0x2ce6('0x4')]));break;}}}}})[_0x2ce6('0xc')](function(){if(_0x1e11b1==='leave'){var _0x4367f8=_[_0x2ce6('0x16')](_0x5a4656['ChatInteractions'],'id');return _0x5a4656[_0x2ce6('0x47')](_0x4367f8)[_0x2ce6('0xc')](function(){for(var _0xfca81=0x0;_0xfca81<_0x4367f8[_0x2ce6('0x1c')];_0xfca81+=0x1){_0x437864[_0x2ce6('0x48')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x4367f8[_0xfca81]),'UserId':Number(_0x5a4656['id'])});}});}})[_0x2ce6('0xc')](function(){if(_0x1e11b1===_0x2ce6('0x49')){var _0x189bb6=_[_0x2ce6('0x16')](_0x5a4656[_0x2ce6('0x4a')],'id');return _0x5a4656['removeMailInteractions'](_0x189bb6)[_0x2ce6('0xc')](function(){for(var _0x1caf6c=0x0;_0x1caf6c<_0x189bb6['length'];_0x1caf6c+=0x1){_0x437864[_0x2ce6('0x48')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x189bb6[_0x1caf6c]),'UserId':Number(_0x5a4656['id'])});}});}})[_0x2ce6('0xc')](function(){if(_0x1e11b1===_0x2ce6('0x49')){var _0x4c99df=_[_0x2ce6('0x16')](_0x5a4656[_0x2ce6('0x24')],'id');return _0x5a4656['removeFaxInteractions'](_0x4c99df)[_0x2ce6('0xc')](function(){for(var _0x1c2ee3=0x0;_0x1c2ee3<_0x4c99df['length'];_0x1c2ee3+=0x1){_0x437864[_0x2ce6('0x48')](_0x2ce6('0x4b'),{'FaxInteractionId':Number(_0x4c99df[_0x1c2ee3]),'UserId':Number(_0x5a4656['id'])});}});}})[_0x2ce6('0xc')](function(){if(_0x1e11b1==='leave'){var _0x5d0f79=_[_0x2ce6('0x16')](_0x5a4656['SmsInteractions'],'id');return _0x5a4656['removeSmsInteractions'](_0x5d0f79)[_0x2ce6('0xc')](function(){for(var _0x586fe1=0x0;_0x586fe1<_0x5d0f79[_0x2ce6('0x1c')];_0x586fe1+=0x1){_0x437864[_0x2ce6('0x48')](_0x2ce6('0x4c'),{'SmsInteractionId':Number(_0x5d0f79[_0x586fe1]),'UserId':Number(_0x5a4656['id'])});}});}})[_0x2ce6('0xc')](function(){if(_0x1e11b1===_0x2ce6('0x49')){var _0x1e855d=_[_0x2ce6('0x16')](_0x5a4656[_0x2ce6('0x4d')],'id');return _0x5a4656[_0x2ce6('0x4e')](_0x1e855d)[_0x2ce6('0xc')](function(){for(var _0xe2e793=0x0;_0xe2e793<_0x1e855d[_0x2ce6('0x1c')];_0xe2e793+=0x1){_0x437864[_0x2ce6('0x48')](_0x2ce6('0x4f'),{'OpenchannelInteractionId':Number(_0x1e855d[_0xe2e793]),'UserId':Number(_0x5a4656['id'])});}});}})['then'](function(){if(_0x1e11b1===_0x2ce6('0x49')){var _0x12aa55=_[_0x2ce6('0x16')](_0x5a4656[_0x2ce6('0x28')],'id');return _0x5a4656[_0x2ce6('0x50')](_0x12aa55)['then'](function(){for(var _0x3286c0=0x0;_0x3286c0<_0x12aa55['length'];_0x3286c0+=0x1){_0x437864['emit'](_0x2ce6('0x51'),{'WhatsappInteractionId':Number(_0x12aa55[_0x3286c0]),'UserId':Number(_0x5a4656['id'])});}});}})[_0x2ce6('0x52')](function(_0x5a056e){_0x425461[_0x2ce6('0x53')](_0x5a056e);});}}function onDisconnect(_0x1f2482,_0x4b2295){joinOrLeave(_0x1f2482,'leave',_0x4b2295);}function onConnect(_0x642f2){joinOrLeave(_0x642f2,_0x2ce6('0x54'));}exports[_0x2ce6('0x55')]=function(_0x1b0393){_0x1b0393['on'](_0x2ce6('0x56'),function(_0x28a2ed){_0x28a2ed[_0x2ce6('0x57')](0x0);_0x28a2ed['address']=_0x28a2ed[_0x2ce6('0x58')]['connection'][_0x2ce6('0x59')]+':'+_0x28a2ed[_0x2ce6('0x58')][_0x2ce6('0x56')][_0x2ce6('0x5a')];_0x28a2ed[_0x2ce6('0x5b')]=new Date();_0x28a2ed[_0x2ce6('0x53')]=function(_0x1c636a){console[_0x2ce6('0x53')](_0x2ce6('0x5c')+_0x28a2ed[_0x2ce6('0x5d')][_0x2ce6('0x4')]+'['+_0x28a2ed[_0x2ce6('0x5e')]+']',_0x1c636a);};_0x28a2ed['on'](_0x2ce6('0x5f'),function(){onDisconnect(_0x28a2ed,_0x1b0393);_0x28a2ed[_0x2ce6('0x53')](_0x2ce6('0x60'));});onConnect(_0x28a2ed);_0x28a2ed[_0x2ce6('0x53')](_0x2ce6('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index ebf1137..a9024ce 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 _0x4a38=['fullname','email','internal','interface','format','SIP/%s','name','agent','incomingmessage','catch','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','closed','changed','substatus','event','User','default','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','lodash','client','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','Sms','SmsInteraction','SmsMessage','newmessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','Openchannel','OpenchannelInteraction','EventManager','then','error','code','Trigger,\x20%s','get','channel','motionChannel','direction','ContactId','query','QueryTypes','SELECT','contact','UserId','find'];(function(_0x4374d7,_0x54c394){var _0xe51cf=function(_0xf7302b){while(--_0xf7302b){_0x4374d7['push'](_0x4374d7['shift']());}};_0xe51cf(++_0x54c394);}(_0x4a38,0x12a));var _0x84a3=function(_0x20be85,_0x4076f3){_0x20be85=_0x20be85-0x0;var _0x53d13a=_0x4a38[_0x20be85];return _0x53d13a;};'use strict';var util=require(_0x84a3('0x0'));var db=require(_0x84a3('0x1'))['db'];var jayson=require(_0x84a3('0x2'));var logger=require(_0x84a3('0x3'))(_0x84a3('0x4'));var _=require(_0x84a3('0x5'));var client=jayson[_0x84a3('0x6')]['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x84a3('0x7'),'event':_0x84a3('0x8'),'condition':_0x84a3('0x9'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':_0x84a3('0xa'),'condition':_0x84a3('0xb'),'callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':_0x84a3('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x84a3('0xc'),'model':_0x84a3('0xd'),'event':_0x84a3('0x8'),'condition':_0x84a3('0x9'),'callback':afterCreate},{'channel':_0x84a3('0xc'),'model':_0x84a3('0xd'),'event':_0x84a3('0xa'),'condition':_0x84a3('0xb'),'callback':afterUpdate},{'channel':'Sms','model':_0x84a3('0xe'),'event':'afterCreate','condition':_0x84a3('0xf'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x84a3('0x10'),'event':_0x84a3('0x8'),'condition':_0x84a3('0x9'),'callback':afterCreate},{'channel':_0x84a3('0x11'),'model':_0x84a3('0x10'),'event':_0x84a3('0xa'),'condition':_0x84a3('0xb'),'callback':afterUpdate},{'channel':_0x84a3('0x11'),'model':_0x84a3('0x12'),'event':_0x84a3('0x8'),'condition':_0x84a3('0xf'),'callback':afterCreateMessage},{'channel':'Fax','model':'FaxInteraction','event':_0x84a3('0x8'),'condition':_0x84a3('0x9'),'callback':afterCreate},{'channel':_0x84a3('0x13'),'model':_0x84a3('0x14'),'event':_0x84a3('0xa'),'condition':_0x84a3('0xb'),'callback':afterUpdate},{'channel':_0x84a3('0x13'),'model':_0x84a3('0x15'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':_0x84a3('0x16'),'event':_0x84a3('0x8'),'condition':_0x84a3('0x9'),'callback':afterCreate},{'channel':'Mail','model':_0x84a3('0x16'),'event':_0x84a3('0xa'),'condition':_0x84a3('0xb'),'callback':afterUpdate},{'channel':_0x84a3('0x17'),'model':'MailMessage','event':'afterCreate','condition':_0x84a3('0xf'),'callback':afterCreateMessage},{'channel':_0x84a3('0x18'),'model':_0x84a3('0x19'),'event':_0x84a3('0x8'),'condition':_0x84a3('0x9'),'callback':afterCreate},{'channel':_0x84a3('0x18'),'model':'OpenchannelInteraction','event':'afterUpdate','condition':_0x84a3('0xb'),'callback':afterUpdate},{'channel':'Openchannel','model':'OpenchannelMessage','event':_0x84a3('0x8'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x5f343a){return client['request'](_0x84a3('0x1a'),_0x5f343a)[_0x84a3('0x1b')](function(_0xa31d11){logger['info']('Trigger,\x20%s',_0x84a3('0x1a'),_0xa31d11);if(_0xa31d11[_0x84a3('0x1c')]){if(_0xa31d11[_0x84a3('0x1c')][_0x84a3('0x1d')]===0x1f4){logger[_0x84a3('0x1c')](_0x84a3('0x1e'),'EventManager',_0xa31d11['error']);}}})['catch'](function(_0x199eb6){logger[_0x84a3('0x1c')](_0x84a3('0x1e'),'EventManager',_0x199eb6);});}function afterCreateMessage(_0x3e139a,_0x2ba14d){return function(_0x28a27a,_0x46bce0){_0x28a27a=_0x28a27a[_0x84a3('0x1f')]({'plain':!![]});_0x28a27a[_0x84a3('0x20')]=_0x3e139a;_0x28a27a[_0x84a3('0x21')]=_0x3e139a;_0x28a27a['event']=_0x28a27a[_0x84a3('0x22')];var _0x54bbaa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x28a27a[_0x84a3('0x23')];return db['sequelize'][_0x84a3('0x24')](_0x54bbaa,{'type':db['Sequelize'][_0x84a3('0x25')][_0x84a3('0x26')],'raw':!![]})[_0x84a3('0x1b')](function(_0x275040){return _0x275040;})[_0x84a3('0x1b')](function(_0x5ce152){if(_0x5ce152){_0x28a27a[_0x84a3('0x27')]=_0x5ce152[0x0];}if(_0x28a27a[_0x84a3('0x28')]){return db['User'][_0x84a3('0x29')]({'where':{'id':_0x28a27a['UserId']},'attributes':['id','name',_0x84a3('0x2a'),_0x84a3('0x2b'),_0x84a3('0x2c')],'raw':!![]})['then'](function(_0x440243){_0x28a27a[_0x84a3('0x2d')]=util[_0x84a3('0x2e')](_0x84a3('0x2f'),_0x440243[_0x84a3('0x30')]);_0x28a27a[_0x84a3('0x20')]=_0x3e139a;_0x28a27a[_0x84a3('0x31')]=_0x440243;return request({'event':_0x84a3('0x32'),'message':_0x28a27a});})[_0x84a3('0x33')](function(_0x41cce8){console[_0x84a3('0x1c')](_0x41cce8);});}else{return request({'event':'outgoingmessage','message':_0x28a27a});}});};}function afterCreate(_0x380ff4,_0x678397){return function(_0x465d30,_0x2cb198){_0x465d30=_0x465d30[_0x84a3('0x1f')]({'plain':!![]});_0x465d30[_0x84a3('0x20')]=_0x380ff4;_0x465d30[_0x84a3('0x21')]=_0x380ff4;_0x465d30['event']=_0x84a3('0x34');var _0x3ab1a2=_0x84a3('0x35')+_0x465d30['ContactId'];return db[_0x84a3('0x36')][_0x84a3('0x24')](_0x3ab1a2,{'type':db[_0x84a3('0x37')][_0x84a3('0x25')][_0x84a3('0x26')],'raw':!![]})[_0x84a3('0x1b')](function(_0x39ee00){return _0x39ee00;})[_0x84a3('0x1b')](function(_0xb2a775){if(_0xb2a775){_0x465d30[_0x84a3('0x27')]=_0xb2a775[0x0];}return request({'event':_0x678397,'message':_0x465d30});});};}function afterUpdate(_0x293c43){return function(_0x13b8d8){var _0x1732e6=_0x13b8d8['changed'](_0x84a3('0x38'))&&_0x13b8d8[_0x84a3('0x38')];var _0x350649=_0x13b8d8[_0x84a3('0x39')](_0x84a3('0x3a'));if(_0x1732e6||_0x350649){var _0x1306a3=_0x1732e6?_0x84a3('0xb'):_0x84a3('0x3a');var _0x200b39=_0x13b8d8[_0x84a3('0x1f')]({'plain':!![]});_0x200b39['channel']=_0x293c43;_0x200b39[_0x84a3('0x21')]=_0x293c43;_0x200b39[_0x84a3('0x3b')]=_0x1732e6?'closed':_0x84a3('0x3a');var _0x24676f=_0x84a3('0x35')+_0x200b39[_0x84a3('0x23')];return db[_0x84a3('0x36')]['query'](_0x24676f,{'type':db[_0x84a3('0x37')]['QueryTypes']['SELECT'],'raw':!![]})[_0x84a3('0x1b')](function(_0x3d4d43){if(_0x3d4d43){_0x200b39[_0x84a3('0x27')]=_0x3d4d43[0x0];}if(_0x200b39[_0x84a3('0x28')]){return db[_0x84a3('0x3c')]['find']({'where':{'id':_0x200b39[_0x84a3('0x28')]},'attributes':['id',_0x84a3('0x30'),_0x84a3('0x2a'),'email','internal'],'raw':!![]})[_0x84a3('0x1b')](function(_0x17b9a9){_0x200b39[_0x84a3('0x2d')]=util[_0x84a3('0x2e')](_0x84a3('0x2f'),_0x17b9a9[_0x84a3('0x30')]);_0x200b39[_0x84a3('0x31')]=_0x17b9a9;return request({'event':_0x1306a3,'message':_0x200b39});})[_0x84a3('0x33')](function(_0x167e87){console['error'](_0x167e87);});}else{return request({'event':_0x1306a3,'message':_0x200b39});}});}};}exports[_0x84a3('0x3d')]=function(){for(var _0x357030=0x0;_0x357030=_0x172580[_0xe57f('0x15')]){throw Error(_0xe57f('0x16'));}_0x340e30(_0x5c7c04);})[_0xe57f('0x17')](function(_0x22b104){_0x4f1022(_0x22b104);});});}; \ No newline at end of file +var _0x2af1=['catch','lodash','bluebird','../mysqldb','./license/util','voice','chat','fax','whatsapp','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x23dc18,_0x1e729a){var _0x248c55=function(_0x380498){while(--_0x380498){_0x23dc18['push'](_0x23dc18['shift']());}};_0x248c55(++_0x1e729a);}(_0x2af1,0xb1));var _0x12af=function(_0x280523,_0x3be909){_0x280523=_0x280523-0x0;var _0x5d6770=_0x2af1[_0x280523];return _0x5d6770;};'use strict';var _=require(_0x12af('0x0'));var BPromise=require(_0x12af('0x1'));var db=require(_0x12af('0x2'))['db'];var util=require(_0x12af('0x3'));var channels=[_0x12af('0x4'),'mail',_0x12af('0x5'),_0x12af('0x6'),'sms',_0x12af('0x7'),'openchannel'];exports['getChannels']=function(){return channels;};exports[_0x12af('0x8')]=function(_0x29afe3){_0x29afe3=_0x29afe3[_0x12af('0x9')]();return _[_0x12af('0xa')](channels,_0x29afe3);};exports[_0x12af('0xb')]=function(_0x16d28f,_0x4d0e7c,_0x3ba498,_0x12e3b9){var _0x1278f1={'loginAttempts':_0x4d0e7c,'blocked':_0x3ba498};if(!_[_0x12af('0xc')](_0x12e3b9)){_0x1278f1[_0x12af('0xd')]=_0x12e3b9;}return _0x16d28f[_0x12af('0xe')](_0x1278f1);};exports[_0x12af('0xf')]=function(_0xf3851d){return new BPromise(function(_0x5a1a05,_0x67116e){var _0x59b4fb=0x0;if(_0xf3851d['role']!==_0x12af('0x10')){_0x5a1a05(_0xf3851d);}db['User'][_0x12af('0x11')]({'where':{'role':_0x12af('0x10'),'online':!![],'id':{'$ne':_0xf3851d['id']}}})['then'](function(_0xf4c383){_0x59b4fb=_0xf4c383;return util[_0x12af('0xf')]();})[_0x12af('0x12')](function(_0x308087){if(_0x308087&&_0x308087[_0x12af('0x13')]&&_0x59b4fb>=_0x308087[_0x12af('0x13')]){throw Error(_0x12af('0x14'));}_0x5a1a05(_0xf3851d);})[_0x12af('0x15')](function(_0x2611c8){_0x67116e(_0x2611c8);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index b3edc17..a1d6555 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc627=['404','status','render','json','exports'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0xc627,0x90));var _0x7c62=function(_0x2cf240,_0x1a5db6){_0x2cf240=_0x2cf240-0x0;var _0x490ab7=_0xc627[_0x2cf240];return _0x490ab7;};'use strict';module[_0x7c62('0x0')][0x194]=function pageNotFound(_0x3b7800,_0x27f20b){var _0x2fbcd1=_0x7c62('0x1');var _0x1bfc4b=0x194;var _0x28e081={'status':_0x1bfc4b};_0x27f20b[_0x7c62('0x2')](_0x28e081[_0x7c62('0x2')]);_0x27f20b[_0x7c62('0x3')](_0x2fbcd1,{},function(_0x20e737,_0xd2520d){if(_0x20e737){return _0x27f20b[_0x7c62('0x2')](_0x28e081[_0x7c62('0x2')])[_0x7c62('0x4')](_0x28e081);}_0x27f20b['send'](_0xd2520d);});}; \ No newline at end of file +var _0xd7d0=['exports','status','render','send'];(function(_0x5a2836,_0x2b200c){var _0x238e0a=function(_0x46ccc0){while(--_0x46ccc0){_0x5a2836['push'](_0x5a2836['shift']());}};_0x238e0a(++_0x2b200c);}(_0xd7d0,0x1a0));var _0x0d7d=function(_0x39d024,_0x5c5797){_0x39d024=_0x39d024-0x0;var _0x311bdd=_0xd7d0[_0x39d024];return _0x311bdd;};'use strict';module[_0x0d7d('0x0')][0x194]=function pageNotFound(_0x29e175,_0x49dfd5){var _0x1778eb='404';var _0x1edcca=0x194;var _0x3f68d0={'status':_0x1edcca};_0x49dfd5[_0x0d7d('0x1')](_0x3f68d0[_0x0d7d('0x1')]);_0x49dfd5[_0x0d7d('0x2')](_0x1778eb,{},function(_0x4fea70,_0x3ddccc){if(_0x4fea70){return _0x49dfd5[_0x0d7d('0x1')](_0x3f68d0[_0x0d7d('0x1')])['json'](_0x3f68d0);}_0x49dfd5[_0x0d7d('0x3')](_0x3ddccc);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 6b2dc64..961eb19 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','../api/integration/integration.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','User','hasOne','cascade','UserId','VoiceRecording','Recordings','hasMany','VoiceExtension','Extensions','CmHopperFinal','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueues','UserMailQueue','ChatQueue','ChatQueues','UserChatQueue','FaxQueues','UserFaxQueue','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Team','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailServerOut','MailAccountId','Imap','Smtp','Answers','Interactions','List','TemplateId','team_has_mail_queues','MailMessage','MailInteractionId','mail_interaction_has_tags','Tags','Users','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','restrict','TagId','MailQueueReport','ListId','Items','FaxAccountId','Exntensions','Pause','mandatoryDispositionPause','FaxInteractionId','fax_interaction_has_tags','ThroughTags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','Owner','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','Dispositions','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ChatApplication','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','ChatGroupId','JscriptySessionReport','Company','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Automation','Any','AutomationAnyId','Action','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','Schedule','AnalyticDefaultReport','DefaultReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Description','Variable','SugarcrmField','Subject','VariableId','Configurations','int_desk_configuration_has_tags','Field','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowConfiguration','FromId','SessionId','JscriptyAnswerReport','JscriptyProject','ProjectId','team_has_whatsapp_queues','WhatsappQueues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToChatWebsiteId','ToAccount','FromFaxAccountId','FromAgent','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappTransferReport','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','defaultsDeep','motion2','xC@LL1234','mysql','utf8_general_ci','sequelizeHistory','xcall','utf8mb4','name','utf8','database','username','password','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueue/userVoiceQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperHistory','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model'];(function(_0xd8030d,_0x1685d1){var _0x24caa7=function(_0x1e4479){while(--_0x1e4479){_0xd8030d['push'](_0xd8030d['shift']());}};_0x24caa7(++_0x1685d1);}(_0x70e0,0x17b));var _0x070e=function(_0x3b7184,_0x5ca8e0){_0x3b7184=_0x3b7184-0x0;var _0x464ab3=_0x70e0[_0x3b7184];return _0x464ab3;};'use strict';var config=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));var _=require(_0x070e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x070e('0x1')]=_[_0x070e('0x3')](config[_0x070e('0x1')],{'database':_0x070e('0x4'),'username':'xcall','password':_0x070e('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x070e('0x6'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x070e('0x7')}}});config[_0x070e('0x8')]=_[_0x070e('0x3')](config[_0x070e('0x8')],{'database':_0x070e('0x4'),'username':_0x070e('0x9'),'password':_0x070e('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x070e('0xa')},'logging':![],'timezone':timezone[_0x070e('0xb')](),'define':{'charset':_0x070e('0xc'),'collate':_0x070e('0x7')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x070e('0x1')][_0x070e('0xd')],config[_0x070e('0x1')][_0x070e('0xe')],config[_0x070e('0x1')][_0x070e('0xf')],config[_0x070e('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x070e('0xd')],config['sequelizeHistory']['username'],config['sequelizeHistory'][_0x070e('0xf')],config[_0x070e('0x8')]['options'])};db['User']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x11'));db[_0x070e('0x12')]=db['sequelize']['import'](_0x070e('0x13'));db[_0x070e('0x14')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x15'));db['VoiceExtension']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x16'));db[_0x070e('0x17')]=db[_0x070e('0x1')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x18'));db['VoiceRecording']=db[_0x070e('0x1')]['import'](_0x070e('0x19'));db[_0x070e('0x1a')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x1b'));db[_0x070e('0x1c')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/voiceMail/voiceMail.model');db[_0x070e('0x1d')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x070e('0x1e')]=db['sequelize']['import'](_0x070e('0x1f'));db[_0x070e('0x20')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x21'));db['VoiceAgentReport']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x22'));db[_0x070e('0x23')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x24'));db[_0x070e('0x25')]=db['sequelize'][_0x070e('0x10')](_0x070e('0x26'));db[_0x070e('0x27')]=db['sequelize']['import'](_0x070e('0x28'));db[_0x070e('0x29')]=db[_0x070e('0x1')]['import'](_0x070e('0x2a'));db[_0x070e('0x2b')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db['sequelize']['import'](_0x070e('0x2c'));db['UserChatQueue']=db[_0x070e('0x1')][_0x070e('0x10')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0x070e('0x1')][_0x070e('0x10')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x2d'));db[_0x070e('0x2e')]=db[_0x070e('0x1')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x070e('0x2f')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x30'));db[_0x070e('0x31')]=db['sequelize'][_0x070e('0x10')](_0x070e('0x32'));db['MailServerIn']=db[_0x070e('0x1')][_0x070e('0x10')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db['sequelize'][_0x070e('0x10')](_0x070e('0x33'));db[_0x070e('0x34')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/mailAccount/mailAccount.model');db[_0x070e('0x35')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/mailQueue/mailQueue.model');db[_0x070e('0x36')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/mailSubstatus/mailSubstatus.model');db[_0x070e('0x37')]=db[_0x070e('0x1')]['import'](_0x070e('0x38'));db['MailMessage']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x39'));db[_0x070e('0x3a')]=db[_0x070e('0x1')]['import'](_0x070e('0x3b'));db['MailQueueReport']=db['sequelize'][_0x070e('0x10')](_0x070e('0x3c'));db[_0x070e('0x3d')]=db['sequelize'][_0x070e('0x10')](_0x070e('0x3e'));db[_0x070e('0x3f')]=db[_0x070e('0x1')]['import'](_0x070e('0x40'));db['FaxAccount']=db['sequelize']['import'](_0x070e('0x41'));db[_0x070e('0x42')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x43'));db['FaxInteraction']=db[_0x070e('0x1')]['import'](_0x070e('0x44'));db[_0x070e('0x45')]=db[_0x070e('0x1')]['import']('../api/faxMessage/faxMessage.model');db[_0x070e('0x46')]=db['sequelize'][_0x070e('0x10')](_0x070e('0x47'));db[_0x070e('0x48')]=db['sequelize'][_0x070e('0x10')](_0x070e('0x49'));db['SmsAccount']=db['sequelize'][_0x070e('0x10')](_0x070e('0x4a'));db[_0x070e('0x4b')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/smsApplication/smsApplication.model');db[_0x070e('0x4c')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x4d'));db[_0x070e('0x4e')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x4f'));db[_0x070e('0x50')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x51'));db[_0x070e('0x52')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/openchannelAccount/openchannelAccount.model');db[_0x070e('0x53')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x54'));db[_0x070e('0x55')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x56'));db[_0x070e('0x57')]=db['sequelize'][_0x070e('0x10')]('../api/openchannelMessage/openchannelMessage.model');db[_0x070e('0x58')]=db[_0x070e('0x1')]['import'](_0x070e('0x59'));db[_0x070e('0x5a')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x5b'));db[_0x070e('0x5c')]=db[_0x070e('0x1')]['import'](_0x070e('0x5d'));db['ChatApplication']=db['sequelize'][_0x070e('0x10')](_0x070e('0x5e'));db[_0x070e('0x5f')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x60'));db[_0x070e('0x61')]=db[_0x070e('0x1')]['import'](_0x070e('0x62'));db['ChatOfflineMessage']=db['sequelize'][_0x070e('0x10')](_0x070e('0x63'));db['ChatQueue']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x64'));db[_0x070e('0x65')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x66'));db['ChatProactiveAction']=db['sequelize']['import'](_0x070e('0x67'));db[_0x070e('0x68')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/cmCompany/cmCompany.model');db[_0x070e('0x69')]=db['sequelize'][_0x070e('0x10')](_0x070e('0x6a'));db[_0x070e('0x6b')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x6c'));db['CmHopperBlack']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x6d'));db['CmHopperFinal']=db[_0x070e('0x1')][_0x070e('0x10')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x070e('0x6e')]=db['sequelize'][_0x070e('0x10')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db['sequelize'][_0x070e('0x10')](_0x070e('0x6f'));db[_0x070e('0x70')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x71'));db['Action']=db[_0x070e('0x1')]['import'](_0x070e('0x72'));db['Automation']=db[_0x070e('0x1')][_0x070e('0x10')]('../api/automation/automation.model');db[_0x070e('0x73')]=db['sequelize'][_0x070e('0x10')](_0x070e('0x74'));db[_0x070e('0x75')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x76'));db[_0x070e('0x77')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x78'));db[_0x070e('0x79')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x7a'));db['Pause']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x7b'));db[_0x070e('0x7c')]=db['sequelize'][_0x070e('0x10')](_0x070e('0x7d'));db[_0x070e('0x7e')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x7f'));db['Schedule']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x80'));db[_0x070e('0x81')]=db['sequelize'][_0x070e('0x10')]('../api/sound/sound.model');db[_0x070e('0x82')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x83'));db[_0x070e('0x84')]=db['sequelize'][_0x070e('0x10')](_0x070e('0x85'));db[_0x070e('0x86')]=db[_0x070e('0x1')]['import'](_0x070e('0x87'));db['Variable']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x88'));db['Integration']=db[_0x070e('0x1')]['import'](_0x070e('0x89'));db['IntegrationReport']=db[_0x070e('0x1')][_0x070e('0x10')]('../api/integrationReport/integrationReport.model');db[_0x070e('0x8a')]=db['sequelize'][_0x070e('0x10')](_0x070e('0x8b'));db['AnalyticDefaultReport']=db['sequelize'][_0x070e('0x10')](_0x070e('0x8c'));db[_0x070e('0x8d')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x8e'));db[_0x070e('0x8f')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x90'));db[_0x070e('0x91')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x070e('0x92')]=db[_0x070e('0x1')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x070e('0x93')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x94'));db[_0x070e('0x95')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x96'));db[_0x070e('0x97')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x98'));db[_0x070e('0x99')]=db['sequelize']['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x070e('0x9a')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x9b'));db['SugarcrmField']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x9c'));db[_0x070e('0x9d')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/intDeskAccount/intDeskAccount.model');db[_0x070e('0x9e')]=db['sequelize'][_0x070e('0x10')](_0x070e('0x9f'));db[_0x070e('0xa0')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/intDeskField/intDeskField.model');db[_0x070e('0xa1')]=db[_0x070e('0x1')]['import'](_0x070e('0xa2'));db[_0x070e('0xa3')]=db['sequelize'][_0x070e('0x10')](_0x070e('0xa4'));db[_0x070e('0xa5')]=db['sequelize'][_0x070e('0x10')](_0x070e('0xa6'));db[_0x070e('0xa7')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xa8'));db[_0x070e('0xa9')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xaa'));db[_0x070e('0xab')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/intZendeskField/intZendeskField.model');db[_0x070e('0xac')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xad'));db[_0x070e('0xae')]=db[_0x070e('0x1')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xaf'));db[_0x070e('0xb0')]=db['sequelize'][_0x070e('0x10')](_0x070e('0xb1'));db[_0x070e('0xb2')]=db['sequelize'][_0x070e('0x10')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x070e('0xb3')]=db[_0x070e('0x1')]['import']('../api/intVtigerField/intVtigerField.model');db[_0x070e('0xb4')]=db[_0x070e('0x1')]['import'](_0x070e('0xb5'));db['ServicenowConfiguration']=db['sequelize']['import'](_0x070e('0xb6'));db[_0x070e('0xb7')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xb8'));db[_0x070e('0xb9')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xba'));db[_0x070e('0xbb')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xbc'));db[_0x070e('0xbd')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xbe'));db[_0x070e('0xbf')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xc0'));db[_0x070e('0xc1')]=db['sequelize'][_0x070e('0x10')](_0x070e('0xc2'));db[_0x070e('0xc3')]=db[_0x070e('0x1')]['import'](_0x070e('0xc4'));db[_0x070e('0xc5')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x89'));db[_0x070e('0xc6')]=db['sequelize']['import']('../api/network/network.model');db[_0x070e('0xc7')]=db['sequelize'][_0x070e('0x10')](_0x070e('0xc8'));db['ChatInternalMessage']=db[_0x070e('0x1')][_0x070e('0x10')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xc9'));db[_0x070e('0xca')]=db[_0x070e('0x1')]['import'](_0x070e('0xcb'));db['JscriptySessionReport']=db[_0x070e('0x1')][_0x070e('0x10')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x070e('0xcc')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xcd'));db[_0x070e('0xce')]=db[_0x070e('0x1')]['import'](_0x070e('0xcf'));db[_0x070e('0xd0')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xd1'));db['JscriptyProject']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xd2'));db[_0x070e('0xd3')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xd4'));db[_0x070e('0xd5')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xd6'));db[_0x070e('0xd7')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xd8'));db[_0x070e('0xd9')]=db['sequelize']['import'](_0x070e('0xda'));db[_0x070e('0xdb')]=db['sequelize']['import']('../api/squareMessage/squareMessage.model');db['Team']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xdc'));db[_0x070e('0xdd')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xde'));db[_0x070e('0xdf')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/campaign/campaign.model');db[_0x070e('0xe0')]=db[_0x070e('0x1')]['import'](_0x070e('0xe1'));db[_0x070e('0xe2')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/attachment/attachment.model');db[_0x070e('0xe3')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xe4'));db['MailTransferReport']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xe5'));db[_0x070e('0xe6')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xe7'));db[_0x070e('0xe8')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xe9'));db['OpenchannelTransferReport']=db[_0x070e('0x1')][_0x070e('0x10')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0x070e('0x1')]['import'](_0x070e('0xea'));db[_0x070e('0xeb')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xec'));db[_0x070e('0xed')]=db[_0x070e('0x1')]['import'](_0x070e('0xee'));db[_0x070e('0xef')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xf0'));db['UserProfileResource']=db[_0x070e('0x1')][_0x070e('0x10')]('../api/userProfileResource/userProfileResource.model');db[_0x070e('0xf1')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xf2'));db[_0x070e('0xf3')]=db[_0x070e('0x1')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x070e('0xf4')]=db['sequelize'][_0x070e('0x10')](_0x070e('0xf5'));db['WhatsappInteraction']=db[_0x070e('0x1')]['import'](_0x070e('0xf6'));db[_0x070e('0xf7')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xf8'));db[_0x070e('0xf9')]=db['sequelize'][_0x070e('0x10')](_0x070e('0xfa'));db['WhatsappTransferReport']=db['sequelize'][_0x070e('0x10')](_0x070e('0xfb'));db[_0x070e('0xfc')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0xfd'));db[_0x070e('0xfe')]=db[_0x070e('0x1')]['import'](_0x070e('0xff'));db[_0x070e('0x100')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x101'));db[_0x070e('0x102')]=db[_0x070e('0x1')][_0x070e('0x10')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x070e('0x103')]=db[_0x070e('0x1')][_0x070e('0x10')](_0x070e('0x104'));db[_0x070e('0x105')][_0x070e('0x106')](db[_0x070e('0x1c')],{'as':_0x070e('0x1c'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x108')});db['User']['hasMany'](db[_0x070e('0x109')],{'as':_0x070e('0x10a'),'foreignKey':_0x070e('0x108')});db['User'][_0x070e('0x10b')](db[_0x070e('0x2b')],{'as':'VoiceQueuesRt','foreignKey':_0x070e('0x108')});db[_0x070e('0x105')][_0x070e('0x10b')](db[_0x070e('0x10c')],{'as':_0x070e('0x10d'),'onDelete':_0x070e('0x107'),'hooks':!![]});db['User']['hasMany'](db[_0x070e('0x10e')],{'as':_0x070e('0x10f'),'foreignKey':'UserId'});db[_0x070e('0x105')][_0x070e('0x10b')](db[_0x070e('0x6e')],{'as':_0x070e('0x110'),'foreignKey':_0x070e('0x108')});db[_0x070e('0x105')]['hasMany'](db[_0x070e('0x111')],{'as':_0x070e('0x111'),'foreignKey':'UserId'});db[_0x070e('0x105')][_0x070e('0x10b')](db[_0x070e('0x55')],{'as':_0x070e('0x112'),'foreignKey':'UserId'});db['User'][_0x070e('0x10b')](db[_0x070e('0x5f')],{'as':_0x070e('0x113'),'foreignKey':_0x070e('0x108')});db[_0x070e('0x105')][_0x070e('0x10b')](db[_0x070e('0x4c')],{'as':_0x070e('0x114'),'foreignKey':_0x070e('0x108')});db[_0x070e('0x105')]['hasMany'](db[_0x070e('0x115')],{'as':_0x070e('0x116'),'foreignKey':_0x070e('0x108')});db[_0x070e('0x105')]['hasMany'](db[_0x070e('0x37')],{'as':_0x070e('0x117'),'foreignKey':'UserId'});db['User'][_0x070e('0x10b')](db[_0x070e('0x118')],{'as':_0x070e('0x119'),'foreignKey':'UserId'});db[_0x070e('0x105')][_0x070e('0x10b')](db[_0x070e('0xf1')],{'as':_0x070e('0x11a'),'foreignKey':_0x070e('0x11b')});db['User'][_0x070e('0x11c')](db[_0x070e('0xef')],{'as':'UserProfile','foreignKey':_0x070e('0x11d')});db['User']['belongsToMany'](db['ChatGroup'],{'as':_0x070e('0x11e'),'through':_0x070e('0x11f')});db[_0x070e('0x105')][_0x070e('0x120')](db['CmContact'],{'as':_0x070e('0x121'),'through':_0x070e('0x122')});db['User'][_0x070e('0x120')](db[_0x070e('0xeb')],{'as':_0x070e('0x123'),'through':_0x070e('0x124')});db[_0x070e('0x105')][_0x070e('0x120')](db['Team'],{'through':_0x070e('0x125')});db['User'][_0x070e('0x120')](db[_0x070e('0x37')],{'as':_0x070e('0x117'),'through':'user_has_mail_interactions'});db[_0x070e('0x105')][_0x070e('0x120')](db[_0x070e('0x5f')],{'as':'ChatInteractions','through':_0x070e('0x126')});db[_0x070e('0x105')]['belongsToMany'](db[_0x070e('0x115')],{'as':_0x070e('0x116'),'through':'user_has_fax_interactions'});db['User']['belongsToMany'](db['SmsInteraction'],{'as':_0x070e('0x114'),'through':_0x070e('0x127')});db[_0x070e('0x105')][_0x070e('0x120')](db[_0x070e('0x55')],{'as':_0x070e('0x112'),'through':_0x070e('0x128')});db[_0x070e('0x105')]['belongsToMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x070e('0x105')][_0x070e('0x120')](db[_0x070e('0x129')],{'as':_0x070e('0x12a'),'through':_0x070e('0x12b'),'required':![]});db['User']['belongsToMany'](db[_0x070e('0xed')],{'as':_0x070e('0x12c'),'through':'UserVoicePrefix','required':![]});db[_0x070e('0x105')][_0x070e('0x120')](db[_0x070e('0x35')],{'as':_0x070e('0x12d'),'through':_0x070e('0x12e'),'required':![]});db[_0x070e('0x105')]['belongsToMany'](db[_0x070e('0x12f')],{'as':_0x070e('0x130'),'through':_0x070e('0x131'),'required':![],'hooks':!![]});db['User'][_0x070e('0x120')](db[_0x070e('0x46')],{'as':_0x070e('0x132'),'through':_0x070e('0x133'),'required':![]});db['User'][_0x070e('0x120')](db[_0x070e('0x50')],{'as':'SmsQueues','through':_0x070e('0x2e'),'required':![]});db[_0x070e('0x105')]['belongsToMany'](db[_0x070e('0x58')],{'as':'OpenchannelQueues','through':_0x070e('0x2f'),'required':![]});db['User'][_0x070e('0x120')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0x070e('0x31'),'required':![]});db['User']['belongsToMany'](db[_0x070e('0xeb')],{'through':_0x070e('0x124')});db[_0x070e('0x105')][_0x070e('0x120')](db[_0x070e('0x5a')],{'as':'ChatWebsites','through':_0x070e('0x134')});db[_0x070e('0x105')][_0x070e('0x120')](db[_0x070e('0x135')],{'as':_0x070e('0x136'),'through':_0x070e('0x137')});db['User'][_0x070e('0x120')](db[_0x070e('0x34')],{'as':_0x070e('0x138'),'through':_0x070e('0x139')});db['User']['belongsToMany'](db[_0x070e('0x52')],{'as':_0x070e('0x13a'),'through':_0x070e('0x13b')});db[_0x070e('0x105')][_0x070e('0x120')](db[_0x070e('0x13c')],{'as':'SmsAccounts','through':_0x070e('0x13d')});db[_0x070e('0x105')][_0x070e('0x120')](db[_0x070e('0xf3')],{'as':_0x070e('0x13e'),'through':_0x070e('0x13f')});db['User']['belongsToMany'](db[_0x070e('0xd7')],{'as':_0x070e('0x140'),'through':_0x070e('0x141')});db[_0x070e('0x12')][_0x070e('0x10b')](db[_0x070e('0x10c')],{'as':_0x070e('0x142'),'onDelete':'cascade','foreignKey':_0x070e('0x143')});db['VoiceContext'][_0x070e('0x10b')](db['VoiceExtension'],{'onDelete':'cascade'});db['VoiceExtension'][_0x070e('0x10b')](db[_0x070e('0x10c')],{'as':_0x070e('0x144'),'onDelete':_0x070e('0x107')});db[_0x070e('0x17')][_0x070e('0x120')](db[_0x070e('0x81')],{'as':_0x070e('0x145'),'through':_0x070e('0x146')});db['VoiceQueue'][_0x070e('0x10b')](db[_0x070e('0x2b')],{'as':_0x070e('0x147'),'foreignKey':_0x070e('0x148')});db[_0x070e('0x129')][_0x070e('0x10b')](db[_0x070e('0x6b')],{'as':_0x070e('0x149'),'foreignKey':_0x070e('0x148')});db['VoiceQueue']['hasMany'](db[_0x070e('0x10e')],{'as':_0x070e('0x10f'),'foreignKey':'VoiceQueueId'});db[_0x070e('0x129')]['hasMany'](db['CmHopperHistory'],{'as':_0x070e('0x14a'),'foreignKey':_0x070e('0x148')});db['VoiceQueue'][_0x070e('0x10b')](db[_0x070e('0x111')],{'as':_0x070e('0x111'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x070e('0x10b')](db[_0x070e('0x14b')],{'as':_0x070e('0x14c'),'foreignKey':'VoiceQueueId'});db[_0x070e('0x129')][_0x070e('0x10b')](db['JscriptySessionReport'],{'as':_0x070e('0x14d'),'foreignKey':_0x070e('0x148')});db[_0x070e('0x129')][_0x070e('0x11c')](db[_0x070e('0x27')],{'as':_0x070e('0x27'),'foreignKey':_0x070e('0x14e')});db[_0x070e('0x129')][_0x070e('0x11c')](db[_0x070e('0x27')],{'as':_0x070e('0x14f'),'foreignKey':_0x070e('0x150')});db[_0x070e('0x129')][_0x070e('0x11c')](db[_0x070e('0x79')],{'as':_0x070e('0x79'),'foreignKey':_0x070e('0x151')});db['VoiceQueue']['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x070e('0x152')});db[_0x070e('0x129')][_0x070e('0x120')](db['CmList'],{'as':_0x070e('0x123'),'through':_0x070e('0x153')});db[_0x070e('0x129')]['belongsToMany'](db[_0x070e('0x105')],{'as':_0x070e('0x154'),'through':_0x070e('0x12b')});db[_0x070e('0x129')]['belongsToMany'](db[_0x070e('0x155')],{'as':_0x070e('0x156'),'through':_0x070e('0x100')});db['VoiceQueue'][_0x070e('0x120')](db[_0x070e('0xeb')],{'as':_0x070e('0x157'),'through':_0x070e('0x158')});db[_0x070e('0x109')][_0x070e('0x11c')](db[_0x070e('0x105')],{'as':_0x070e('0x105'),'foreignKey':_0x070e('0x108')});db['ScreenRecording']['belongsTo'](db[_0x070e('0x105')],{'as':'User','foreignKey':'UserId'});db[_0x070e('0x1c')][_0x070e('0x10b')](db[_0x070e('0x1d')],{'as':_0x070e('0x159'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x15a'),'sourceKey':'mailbox'});db[_0x070e('0x1d')][_0x070e('0x11c')](db[_0x070e('0x1c')],{'foreignKey':_0x070e('0x15a'),'targetKey':'mailbox'});db[_0x070e('0x1e')]['hasMany'](db[_0x070e('0x23')],{'as':_0x070e('0x15b'),'foreignKey':_0x070e('0x15c'),'constraints':![]});db[_0x070e('0x1e')][_0x070e('0x10b')](db[_0x070e('0x15d')],{'as':_0x070e('0x15e'),'foreignKey':_0x070e('0x15c'),'constraints':![]});db[_0x070e('0x1e')]['belongsTo'](db[_0x070e('0x105')],{'as':_0x070e('0x105'),'foreignKey':_0x070e('0x108')});db[_0x070e('0x1e')][_0x070e('0x11c')](db[_0x070e('0x69')],{'as':_0x070e('0x15f'),'foreignKey':_0x070e('0x160')});db['MailServerIn'][_0x070e('0x11c')](db[_0x070e('0x34')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x070e('0x161')][_0x070e('0x11c')](db[_0x070e('0x34')],{'as':_0x070e('0x34'),'foreignKey':_0x070e('0x162')});db[_0x070e('0x34')]['hasOne'](db['MailServerIn'],{'as':_0x070e('0x163'),'onDelete':_0x070e('0x107')});db['MailAccount'][_0x070e('0x106')](db['MailServerOut'],{'as':_0x070e('0x164'),'onDelete':_0x070e('0x107')});db['MailAccount'][_0x070e('0x10b')](db[_0x070e('0x75')],{'as':'Dispositions','foreignKey':'MailAccountId','onDelete':_0x070e('0x107')});db['MailAccount'][_0x070e('0x10b')](db[_0x070e('0x73')],{'as':_0x070e('0x165'),'foreignKey':'MailAccountId'});db[_0x070e('0x34')][_0x070e('0x10b')](db['MailMessage'],{'as':_0x070e('0x159'),'foreignKey':_0x070e('0x162')});db[_0x070e('0x34')][_0x070e('0x10b')](db[_0x070e('0x37')],{'as':_0x070e('0x166')});db[_0x070e('0x34')][_0x070e('0x10b')](db[_0x070e('0x3a')],{'as':_0x070e('0x144')});db['MailAccount'][_0x070e('0x11c')](db[_0x070e('0xeb')],{'as':_0x070e('0x167'),'foreignKey':'ListId'});db['MailAccount'][_0x070e('0x11c')](db[_0x070e('0x84')],{'as':_0x070e('0x84'),'foreignKey':_0x070e('0x168')});db['MailAccount'][_0x070e('0x11c')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x070e('0x152')});db['MailAccount'][_0x070e('0x120')](db[_0x070e('0x105')],{'as':_0x070e('0x154'),'through':_0x070e('0x139')});db['MailQueue'][_0x070e('0x120')](db['User'],{'as':_0x070e('0x154'),'through':_0x070e('0x12e')});db[_0x070e('0x35')][_0x070e('0x120')](db[_0x070e('0x155')],{'through':_0x070e('0x169'),'as':_0x070e('0x156')});db[_0x070e('0x37')][_0x070e('0x10b')](db[_0x070e('0x16a')],{'as':_0x070e('0x159'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x16b')});db[_0x070e('0x37')][_0x070e('0x11c')](db[_0x070e('0x34')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x070e('0x37')][_0x070e('0x11c')](db['CmContact'],{'as':_0x070e('0x15f'),'foreignKey':_0x070e('0x160')});db['MailInteraction'][_0x070e('0x11c')](db[_0x070e('0x105')],{'as':'Owner','foreignKey':_0x070e('0x108')});db[_0x070e('0x37')][_0x070e('0x120')](db[_0x070e('0x82')],{'through':_0x070e('0x16c'),'as':_0x070e('0x16d')});db['MailInteraction'][_0x070e('0x120')](db[_0x070e('0x82')],{'through':_0x070e('0x16c'),'as':'ThroughTags'});db[_0x070e('0x37')][_0x070e('0x120')](db[_0x070e('0x105')],{'as':_0x070e('0x16e'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x070e('0x16a')][_0x070e('0x10b')](db[_0x070e('0xe2')],{'as':_0x070e('0x16f'),'onDelete':_0x070e('0x107')});db[_0x070e('0x16a')][_0x070e('0x11c')](db['User'],{'as':_0x070e('0x105')});db[_0x070e('0x16a')][_0x070e('0x11c')](db[_0x070e('0x69')],{'onDelete':_0x070e('0x107'),'as':_0x070e('0x15f')});db[_0x070e('0x16a')][_0x070e('0x11c')](db[_0x070e('0x37')],{'as':_0x070e('0x170'),'foreignKey':_0x070e('0x16b')});db[_0x070e('0x16a')][_0x070e('0x11c')](db[_0x070e('0x34')],{'as':_0x070e('0x171'),'foreignKey':'MailAccountId'});db[_0x070e('0x16a')][_0x070e('0x11c')](db[_0x070e('0x5a')],{'as':_0x070e('0x5a'),'foreignKey':_0x070e('0x172')});db[_0x070e('0x16a')][_0x070e('0x11c')](db['ChatOfflineMessage'],{'as':_0x070e('0x173'),'foreignKey':_0x070e('0x174')});db[_0x070e('0x3a')][_0x070e('0x11c')](db[_0x070e('0x105')],{'onDelete':_0x070e('0x175')});db[_0x070e('0x3a')][_0x070e('0x11c')](db[_0x070e('0x35')],{'onDelete':'restrict'});db[_0x070e('0x3a')][_0x070e('0x11c')](db[_0x070e('0x34')],{'onDelete':_0x070e('0x175')});db[_0x070e('0x3a')][_0x070e('0x11c')](db[_0x070e('0x79')],{'onDelete':_0x070e('0x175'),'foreignKey':_0x070e('0x151')});db[_0x070e('0x3a')][_0x070e('0x11c')](db[_0x070e('0x82')],{'onDelete':_0x070e('0x175'),'foreignKey':_0x070e('0x176')});db[_0x070e('0x177')][_0x070e('0x11c')](db[_0x070e('0x34')],{});db[_0x070e('0x177')][_0x070e('0x11c')](db[_0x070e('0xeb')],{'as':_0x070e('0x167'),'foreignKey':_0x070e('0x178')});db['MailQueueReport'][_0x070e('0x11c')](db[_0x070e('0x69')],{'as':_0x070e('0x15f'),'foreignKey':_0x070e('0x160')});db['MailQueueReport'][_0x070e('0x11c')](db['MailInteraction'],{});db[_0x070e('0x177')]['belongsTo'](db['MailMessage'],{});db[_0x070e('0x177')][_0x070e('0x11c')](db[_0x070e('0x105')],{});db['MailQueueReport'][_0x070e('0x11c')](db['MailQueue'],{});db[_0x070e('0x3d')][_0x070e('0x10b')](db['DashboardItem'],{'as':_0x070e('0x179'),'onDelete':'cascade'});db[_0x070e('0x135')][_0x070e('0x10b')](db[_0x070e('0x75')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0x070e('0x107')});db['FaxAccount'][_0x070e('0x10b')](db[_0x070e('0x73')],{'as':_0x070e('0x165'),'foreignKey':_0x070e('0x17a')});db[_0x070e('0x135')][_0x070e('0x10b')](db['FaxInteraction'],{'as':'Interactions'});db[_0x070e('0x135')]['hasMany'](db['FaxApplication'],{'as':_0x070e('0x144')});db[_0x070e('0x135')][_0x070e('0x10b')](db['VoiceExtension'],{'as':_0x070e('0x17b'),'onDelete':_0x070e('0x107')});db[_0x070e('0x135')]['hasMany'](db['FaxMessage'],{'as':_0x070e('0x159')});db[_0x070e('0x135')][_0x070e('0x11c')](db['Trunk'],{'as':_0x070e('0x27')});db['FaxAccount'][_0x070e('0x11c')](db['CmList'],{'as':_0x070e('0x167'),'foreignKey':_0x070e('0x178')});db['FaxAccount'][_0x070e('0x11c')](db[_0x070e('0x17c')],{'as':_0x070e('0x17d'),'foreignKey':_0x070e('0x152')});db[_0x070e('0x135')][_0x070e('0x120')](db[_0x070e('0x105')],{'as':_0x070e('0x154'),'through':_0x070e('0x137')});db[_0x070e('0x42')][_0x070e('0x11c')](db[_0x070e('0x105')],{'onDelete':_0x070e('0x175')});db['FaxApplication'][_0x070e('0x11c')](db[_0x070e('0x46')],{'onDelete':_0x070e('0x175')});db['FaxApplication']['belongsTo'](db[_0x070e('0x135')],{'onDelete':_0x070e('0x175')});db['FaxApplication'][_0x070e('0x11c')](db[_0x070e('0x82')],{'onDelete':_0x070e('0x175'),'foreignKey':'TagId'});db[_0x070e('0x115')]['hasMany'](db[_0x070e('0x45')],{'as':_0x070e('0x159'),'onDelete':'cascade','foreignKey':_0x070e('0x17e')});db[_0x070e('0x115')][_0x070e('0x11c')](db[_0x070e('0x135')],{'as':_0x070e('0x171'),'foreignKey':_0x070e('0x17a')});db[_0x070e('0x115')][_0x070e('0x11c')](db[_0x070e('0x69')],{'as':'Contact','foreignKey':_0x070e('0x160')});db[_0x070e('0x115')][_0x070e('0x11c')](db[_0x070e('0x105')],{'as':'Owner','foreignKey':'UserId'});db['FaxInteraction'][_0x070e('0x120')](db['Tag'],{'through':_0x070e('0x17f'),'as':_0x070e('0x16d')});db['FaxInteraction'][_0x070e('0x120')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x070e('0x180')});db[_0x070e('0x115')][_0x070e('0x120')](db[_0x070e('0x105')],{'as':_0x070e('0x16e'),'through':_0x070e('0x181'),'foreignKey':_0x070e('0x17e')});db[_0x070e('0x45')][_0x070e('0x11c')](db[_0x070e('0x105')],{'onDelete':_0x070e('0x107'),'as':_0x070e('0x105')});db['FaxMessage'][_0x070e('0x11c')](db[_0x070e('0x115')],{'as':_0x070e('0x170'),'foreignKey':_0x070e('0x17e')});db[_0x070e('0x45')][_0x070e('0x11c')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0x070e('0x45')][_0x070e('0x11c')](db[_0x070e('0xe2')],{'as':'Attachment','foreignKey':_0x070e('0x182')});db[_0x070e('0x45')]['belongsTo'](db['FaxAccount'],{'as':_0x070e('0x171'),'foreignKey':'FaxAccountId'});db[_0x070e('0x46')][_0x070e('0x120')](db[_0x070e('0x105')],{'as':_0x070e('0x154'),'through':_0x070e('0x133')});db[_0x070e('0x46')]['belongsToMany'](db[_0x070e('0x155')],{'through':_0x070e('0x183'),'as':_0x070e('0x156')});db['FaxQueueReport'][_0x070e('0x11c')](db['FaxAccount'],{});db['FaxQueueReport'][_0x070e('0x11c')](db['CmList'],{'as':_0x070e('0x167'),'foreignKey':'ListId'});db[_0x070e('0x48')][_0x070e('0x11c')](db['CmContact'],{'as':_0x070e('0x15f'),'foreignKey':_0x070e('0x160')});db[_0x070e('0x48')][_0x070e('0x11c')](db[_0x070e('0x115')],{});db[_0x070e('0x48')][_0x070e('0x11c')](db[_0x070e('0x45')],{});db[_0x070e('0x48')][_0x070e('0x11c')](db['User'],{});db[_0x070e('0x48')]['belongsTo'](db[_0x070e('0x46')],{});db[_0x070e('0x13c')]['hasMany'](db[_0x070e('0x75')],{'as':'Dispositions','foreignKey':_0x070e('0x184'),'onDelete':'cascade'});db[_0x070e('0x13c')][_0x070e('0x10b')](db['CannedAnswer'],{'as':_0x070e('0x165'),'foreignKey':_0x070e('0x184')});db[_0x070e('0x13c')][_0x070e('0x10b')](db[_0x070e('0x4e')],{'as':'Messages','foreignKey':_0x070e('0x184')});db['SmsAccount']['hasMany'](db[_0x070e('0x4c')],{'as':'Interactions'});db['SmsAccount'][_0x070e('0x10b')](db['SmsApplication'],{'as':_0x070e('0x144')});db[_0x070e('0x13c')][_0x070e('0x11c')](db['CmList'],{'as':_0x070e('0x167'),'foreignKey':_0x070e('0x178')});db[_0x070e('0x13c')][_0x070e('0x11c')](db[_0x070e('0x17c')],{'as':'mandatoryDispositionPause','foreignKey':_0x070e('0x152')});db[_0x070e('0x13c')][_0x070e('0x120')](db[_0x070e('0x105')],{'as':_0x070e('0x154'),'through':_0x070e('0x13d')});db[_0x070e('0x4b')]['belongsTo'](db[_0x070e('0x105')],{'onDelete':_0x070e('0x175')});db[_0x070e('0x4b')][_0x070e('0x11c')](db['SmsQueue'],{'onDelete':_0x070e('0x175')});db[_0x070e('0x4b')][_0x070e('0x11c')](db['SmsAccount'],{'onDelete':_0x070e('0x175')});db[_0x070e('0x4b')][_0x070e('0x11c')](db['Interval'],{'onDelete':_0x070e('0x175'),'foreignKey':_0x070e('0x151')});db[_0x070e('0x4b')][_0x070e('0x11c')](db[_0x070e('0x82')],{'onDelete':_0x070e('0x175'),'foreignKey':'TagId'});db[_0x070e('0x4c')][_0x070e('0x10b')](db['SmsMessage'],{'as':'Messages','onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x185')});db[_0x070e('0x4c')][_0x070e('0x11c')](db['SmsAccount'],{'as':_0x070e('0x171'),'foreignKey':_0x070e('0x184')});db[_0x070e('0x4c')]['belongsTo'](db[_0x070e('0x69')],{'as':_0x070e('0x15f'),'foreignKey':_0x070e('0x160')});db[_0x070e('0x4c')]['belongsTo'](db['User'],{'as':_0x070e('0x186'),'foreignKey':_0x070e('0x108')});db['SmsInteraction'][_0x070e('0x120')](db[_0x070e('0x82')],{'through':'sms_interaction_has_tags','as':'Tags'});db[_0x070e('0x4c')][_0x070e('0x120')](db[_0x070e('0x82')],{'through':_0x070e('0x187'),'as':'ThroughTags'});db['SmsInteraction'][_0x070e('0x120')](db[_0x070e('0x105')],{'as':'Users','through':_0x070e('0x127'),'foreignKey':'SmsInteractionId'});db[_0x070e('0x4e')][_0x070e('0x11c')](db[_0x070e('0x105')],{'as':'User'});db[_0x070e('0x4e')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x070e('0x15f')});db[_0x070e('0x4e')][_0x070e('0x11c')](db[_0x070e('0x4c')],{'onDelete':_0x070e('0x107'),'as':_0x070e('0x170'),'foreignKey':_0x070e('0x185')});db[_0x070e('0x4e')][_0x070e('0x11c')](db[_0x070e('0x13c')],{'as':_0x070e('0x171'),'foreignKey':'SmsAccountId'});db[_0x070e('0x50')][_0x070e('0x120')](db['User'],{'as':'Agents','through':_0x070e('0x2e'),'foreignKey':_0x070e('0x188')});db[_0x070e('0x50')][_0x070e('0x120')](db['Team'],{'through':_0x070e('0x189'),'as':_0x070e('0x156')});db[_0x070e('0x52')][_0x070e('0x10b')](db[_0x070e('0x75')],{'as':_0x070e('0x18a'),'foreignKey':'OpenchannelAccountId','onDelete':_0x070e('0x107')});db['OpenchannelAccount'][_0x070e('0x10b')](db[_0x070e('0x73')],{'as':_0x070e('0x165'),'foreignKey':_0x070e('0x18b')});db[_0x070e('0x52')][_0x070e('0x10b')](db[_0x070e('0x55')],{'as':'Interactions','foreignKey':_0x070e('0x18b')});db[_0x070e('0x52')][_0x070e('0x10b')](db[_0x070e('0x57')],{'as':_0x070e('0x159'),'foreignKey':_0x070e('0x18b')});db[_0x070e('0x52')][_0x070e('0x10b')](db[_0x070e('0x53')],{'as':_0x070e('0x144'),'foreignKey':_0x070e('0x18b')});db[_0x070e('0x52')][_0x070e('0x11c')](db[_0x070e('0xeb')],{'as':'List','foreignKey':_0x070e('0x178')});db[_0x070e('0x52')]['belongsTo'](db[_0x070e('0x17c')],{'as':_0x070e('0x17d'),'foreignKey':_0x070e('0x152')});db[_0x070e('0x52')]['belongsToMany'](db[_0x070e('0x105')],{'as':_0x070e('0x154'),'through':'user_has_openchannel_accounts'});db[_0x070e('0x53')][_0x070e('0x11c')](db[_0x070e('0x105')],{'onDelete':_0x070e('0x175')});db[_0x070e('0x53')]['belongsTo'](db[_0x070e('0x58')],{'onDelete':_0x070e('0x175'),'foreignKey':_0x070e('0x18c')});db[_0x070e('0x53')]['belongsTo'](db[_0x070e('0x52')],{'onDelete':_0x070e('0x175'),'foreignKey':_0x070e('0x18b')});db['OpenchannelApplication'][_0x070e('0x11c')](db[_0x070e('0x79')],{'onDelete':'restrict','foreignKey':_0x070e('0x151')});db[_0x070e('0x53')][_0x070e('0x11c')](db[_0x070e('0x82')],{'onDelete':'restrict','foreignKey':_0x070e('0x176')});db['OpenchannelInteraction'][_0x070e('0x10b')](db[_0x070e('0x57')],{'as':_0x070e('0x159'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction'][_0x070e('0x11c')](db[_0x070e('0x52')],{'as':'Account','foreignKey':_0x070e('0x18b')});db[_0x070e('0x55')][_0x070e('0x11c')](db[_0x070e('0x69')],{'as':_0x070e('0x15f'),'foreignKey':_0x070e('0x160')});db[_0x070e('0x55')]['belongsTo'](db[_0x070e('0x105')],{'as':'Owner','foreignKey':_0x070e('0x108')});db[_0x070e('0x55')][_0x070e('0x120')](db[_0x070e('0x82')],{'through':'openchannel_interaction_has_tags','as':_0x070e('0x16d')});db[_0x070e('0x55')][_0x070e('0x120')](db['Tag'],{'through':_0x070e('0x18d'),'as':'ThroughTags'});db[_0x070e('0x55')][_0x070e('0x120')](db[_0x070e('0x105')],{'as':'Users','through':_0x070e('0x128'),'foreignKey':_0x070e('0x18e')});db[_0x070e('0x57')][_0x070e('0x11c')](db[_0x070e('0x105')],{'onDelete':_0x070e('0x107'),'as':_0x070e('0x105')});db[_0x070e('0x57')][_0x070e('0x11c')](db[_0x070e('0x69')],{'onDelete':_0x070e('0x107'),'as':'Contact'});db[_0x070e('0x57')][_0x070e('0x11c')](db['OpenchannelInteraction'],{'onDelete':_0x070e('0x107'),'as':_0x070e('0x170'),'foreignKey':_0x070e('0x18e')});db[_0x070e('0x57')][_0x070e('0x11c')](db[_0x070e('0xe2')],{'as':_0x070e('0xe2'),'foreignKey':_0x070e('0x182')});db[_0x070e('0x57')]['belongsTo'](db[_0x070e('0x52')],{'as':_0x070e('0x171'),'foreignKey':_0x070e('0x18b')});db['OpenchannelQueue'][_0x070e('0x120')](db[_0x070e('0x105')],{'as':_0x070e('0x154'),'through':_0x070e('0x2f'),'foreignKey':_0x070e('0x18c')});db[_0x070e('0x58')][_0x070e('0x120')](db['Team'],{'through':_0x070e('0x18f'),'as':_0x070e('0x156')});db[_0x070e('0x5a')][_0x070e('0x10b')](db[_0x070e('0x75')],{'as':'Dispositions','foreignKey':_0x070e('0x172'),'onDelete':_0x070e('0x107')});db['ChatWebsite']['hasMany'](db['CannedAnswer'],{'as':_0x070e('0x165'),'foreignKey':_0x070e('0x172')});db['ChatWebsite']['hasMany'](db[_0x070e('0x190')],{'as':'ProactiveActions'});db[_0x070e('0x5a')][_0x070e('0x10b')](db[_0x070e('0x5f')],{'as':_0x070e('0x166')});db[_0x070e('0x5a')][_0x070e('0x10b')](db[_0x070e('0x191')],{'as':'Applications'});db[_0x070e('0x5a')][_0x070e('0x10b')](db[_0x070e('0x61')],{'as':_0x070e('0x159')});db['ChatWebsite']['belongsTo'](db[_0x070e('0xeb')],{'as':_0x070e('0x167'),'foreignKey':_0x070e('0x178')});db['ChatWebsite'][_0x070e('0x11c')](db[_0x070e('0x79')],{'as':_0x070e('0x79'),'foreignKey':_0x070e('0x151')});db['ChatWebsite']['belongsTo'](db[_0x070e('0x34')],{'as':_0x070e('0x34'),'foreignKey':_0x070e('0x162')});db[_0x070e('0x5a')][_0x070e('0x11c')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x070e('0x5a')][_0x070e('0x120')](db[_0x070e('0x105')],{'as':_0x070e('0x154'),'through':'user_has_chat_websites'});db[_0x070e('0x5c')]['belongsTo'](db['OpenchannelAccount'],{});db[_0x070e('0x5c')][_0x070e('0x11c')](db['CmList'],{'as':_0x070e('0x167'),'foreignKey':_0x070e('0x178')});db[_0x070e('0x5c')][_0x070e('0x11c')](db[_0x070e('0x69')],{'as':_0x070e('0x15f'),'foreignKey':'ContactId'});db[_0x070e('0x5c')][_0x070e('0x11c')](db[_0x070e('0x55')],{});db['OpenchannelQueueReport'][_0x070e('0x11c')](db[_0x070e('0x57')],{});db[_0x070e('0x5c')]['belongsTo'](db[_0x070e('0x105')],{});db[_0x070e('0x5c')][_0x070e('0x11c')](db[_0x070e('0x58')],{});db[_0x070e('0x191')][_0x070e('0x11c')](db[_0x070e('0x105')],{'as':_0x070e('0x192'),'foreignKey':_0x070e('0x108'),'onDelete':_0x070e('0x175')});db[_0x070e('0x191')]['belongsTo'](db[_0x070e('0x12f')],{'as':_0x070e('0x193'),'foreignKey':_0x070e('0x194'),'onDelete':_0x070e('0x175')});db['ChatApplication'][_0x070e('0x11c')](db[_0x070e('0x5a')],{'as':'Website','foreignKey':_0x070e('0x172'),'onDelete':_0x070e('0x175')});db['ChatApplication'][_0x070e('0x11c')](db['Tag'],{'onDelete':_0x070e('0x175'),'foreignKey':'TagId'});db['ChatInteraction'][_0x070e('0x10b')](db['ChatMessage'],{'as':_0x070e('0x159'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x195')});db[_0x070e('0x5f')][_0x070e('0x11c')](db[_0x070e('0x5a')],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatInteraction']['belongsTo'](db[_0x070e('0x69')],{'as':'Contact','foreignKey':_0x070e('0x160')});db[_0x070e('0x5f')][_0x070e('0x11c')](db[_0x070e('0x105')],{'as':_0x070e('0x186'),'foreignKey':_0x070e('0x108')});db['ChatInteraction'][_0x070e('0x120')](db[_0x070e('0x82')],{'through':_0x070e('0x196'),'as':_0x070e('0x16d')});db[_0x070e('0x5f')][_0x070e('0x120')](db['Tag'],{'through':_0x070e('0x196'),'as':_0x070e('0x180')});db[_0x070e('0x5f')]['belongsToMany'](db[_0x070e('0x105')],{'as':_0x070e('0x16e'),'through':_0x070e('0x126'),'foreignKey':_0x070e('0x195')});db[_0x070e('0x61')][_0x070e('0x11c')](db[_0x070e('0x105')],{'onDelete':_0x070e('0x107'),'as':_0x070e('0x105')});db[_0x070e('0x61')][_0x070e('0x11c')](db[_0x070e('0x69')],{'onDelete':_0x070e('0x107'),'as':_0x070e('0x15f'),'foreignKey':_0x070e('0x160')});db[_0x070e('0x61')][_0x070e('0x11c')](db[_0x070e('0x5f')],{'onDelete':_0x070e('0x107'),'as':_0x070e('0x170'),'foreignKey':'ChatInteractionId'});db[_0x070e('0x61')]['belongsTo'](db['Attachment'],{'as':_0x070e('0xe2'),'foreignKey':'AttachmentId'});db[_0x070e('0x61')][_0x070e('0x11c')](db[_0x070e('0x5a')],{'as':_0x070e('0x171'),'foreignKey':_0x070e('0x172')});db[_0x070e('0x173')][_0x070e('0x10b')](db[_0x070e('0xe2')],{'as':_0x070e('0x16f'),'foreignKey':_0x070e('0x174'),'onDelete':'cascade','hooks':!![]});db[_0x070e('0x173')][_0x070e('0x11c')](db[_0x070e('0x69')],{'onDelete':_0x070e('0x107'),'as':_0x070e('0x15f'),'foreignKey':'ContactId'});db[_0x070e('0x173')][_0x070e('0x11c')](db[_0x070e('0x5a')],{'as':_0x070e('0x171'),'foreignKey':'ChatWebsiteId'});db[_0x070e('0x12f')][_0x070e('0x120')](db['User'],{'as':_0x070e('0x154'),'through':_0x070e('0x131'),'hooks':!![]});db[_0x070e('0x12f')][_0x070e('0x120')](db['Team'],{'through':_0x070e('0x197'),'as':_0x070e('0x156')});db[_0x070e('0x65')]['hasMany'](db[_0x070e('0x198')],{'as':'Messages','foreignKey':_0x070e('0x199'),'onDelete':_0x070e('0x107')});db['ChatGroup'][_0x070e('0x120')](db[_0x070e('0x105')],{'as':_0x070e('0x147'),'through':_0x070e('0x11f')});db[_0x070e('0x190')][_0x070e('0x11c')](db[_0x070e('0x5a')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x070e('0x68')][_0x070e('0x10b')](db[_0x070e('0x69')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x070e('0x69')]['hasMany'](db['CmHopper'],{'as':_0x070e('0x149'),'foreignKey':_0x070e('0x160')});db[_0x070e('0x69')][_0x070e('0x10b')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x070e('0x160')});db[_0x070e('0x69')][_0x070e('0x10b')](db[_0x070e('0x6e')],{'as':_0x070e('0x14a'),'foreignKey':'ContactId'});db[_0x070e('0x69')][_0x070e('0x10b')](db[_0x070e('0x111')],{'as':'ReportAgentPreview','foreignKey':_0x070e('0x160')});db['CmContact'][_0x070e('0x10b')](db[_0x070e('0x19a')],{'as':_0x070e('0x14d'),'foreignKey':_0x070e('0x160')});db[_0x070e('0x69')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x070e('0x112'),'foreignKey':_0x070e('0x160'),'onDelete':_0x070e('0x175')});db['CmContact']['hasMany'](db[_0x070e('0x5f')],{'as':_0x070e('0x113'),'foreignKey':_0x070e('0x160'),'onDelete':_0x070e('0x175')});db[_0x070e('0x69')][_0x070e('0x10b')](db[_0x070e('0x4c')],{'as':_0x070e('0x114'),'foreignKey':_0x070e('0x160'),'onDelete':_0x070e('0x175')});db[_0x070e('0x69')][_0x070e('0x10b')](db[_0x070e('0x115')],{'as':_0x070e('0x116'),'foreignKey':_0x070e('0x160'),'onDelete':'restrict'});db[_0x070e('0x69')][_0x070e('0x10b')](db[_0x070e('0x37')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x070e('0x11c')](db[_0x070e('0x68')],{'as':_0x070e('0x19b'),'foreignKey':_0x070e('0x19c')});db[_0x070e('0x69')][_0x070e('0x11c')](db[_0x070e('0xeb')],{'as':_0x070e('0x167'),'foreignKey':_0x070e('0x178'),'onDelete':'cascade'});db['CmContact']['belongsToMany'](db['User'],{'as':_0x070e('0x16e'),'through':'cm_user_has_contacts'});db[_0x070e('0x69')][_0x070e('0x120')](db[_0x070e('0x82')],{'as':_0x070e('0x16d'),'through':_0x070e('0x19d')});db[_0x070e('0x69')][_0x070e('0x120')](db[_0x070e('0x82')],{'through':'cm_contact_has_tags','as':_0x070e('0x180')});db[_0x070e('0x6b')][_0x070e('0x11c')](db[_0x070e('0x69')],{'as':_0x070e('0x15f'),'foreignKey':_0x070e('0x160'),'onDelete':_0x070e('0x107')});db[_0x070e('0x6b')][_0x070e('0x11c')](db[_0x070e('0xeb')],{'as':_0x070e('0x167'),'foreignKey':'ListId','onDelete':_0x070e('0x107')});db[_0x070e('0x6b')]['belongsTo'](db[_0x070e('0x105')],{'as':'Agent','foreignKey':'UserId'});db[_0x070e('0x6b')]['belongsTo'](db[_0x070e('0x129')],{'as':_0x070e('0x193'),'foreignKey':_0x070e('0x148'),'onDelete':'cascade'});db[_0x070e('0x6b')]['belongsTo'](db[_0x070e('0xdf')],{'as':'Campaign','foreignKey':_0x070e('0x19e'),'onDelete':_0x070e('0x107')});db[_0x070e('0x6b')]['belongsTo'](db['User'],{'as':_0x070e('0x186'),'foreignKey':_0x070e('0x19f')});db[_0x070e('0x14b')][_0x070e('0x11c')](db['CmContact'],{'as':_0x070e('0x15f'),'foreignKey':_0x070e('0x160'),'onDelete':_0x070e('0x107')});db[_0x070e('0x14b')][_0x070e('0x11c')](db[_0x070e('0xeb')],{'as':'List','foreignKey':_0x070e('0x178'),'onDelete':_0x070e('0x107')});db['CmHopperBlack'][_0x070e('0x11c')](db[_0x070e('0x129')],{'as':_0x070e('0x193'),'foreignKey':_0x070e('0x148'),'onDelete':'cascade'});db['CmHopperBlack'][_0x070e('0x11c')](db[_0x070e('0xdf')],{'as':_0x070e('0xdf'),'foreignKey':_0x070e('0x19e'),'onDelete':_0x070e('0x107')});db['Automation'][_0x070e('0x10b')](db[_0x070e('0x77')],{'as':{'plural':_0x070e('0x1a0'),'singular':_0x070e('0x1a1')},'foreignKey':_0x070e('0x1a2'),'onDelete':'cascade','hooks':!![]});db[_0x070e('0x1a3')][_0x070e('0x10b')](db[_0x070e('0x77')],{'as':{'plural':_0x070e('0x1a4'),'singular':'OneAny'},'foreignKey':_0x070e('0x1a5'),'onDelete':_0x070e('0x107'),'hooks':!![]});db['Automation'][_0x070e('0x10b')](db[_0x070e('0x1a6')],{'as':_0x070e('0x1a7'),'foreignKey':_0x070e('0x1a8'),'onDelete':_0x070e('0x107'),'hooks':!![]});db[_0x070e('0x75')][_0x070e('0x10b')](db[_0x070e('0x75')],{'as':_0x070e('0x18a'),'foreignKey':'ParentId','onDelete':_0x070e('0x107')});db[_0x070e('0x79')][_0x070e('0x10b')](db[_0x070e('0x79')],{'as':_0x070e('0x1a9'),'foreignKey':_0x070e('0x151'),'onDelete':_0x070e('0x107'),'hooks':!![],'required':![]});db['Interval'][_0x070e('0x10b')](db[_0x070e('0x10c')],{'as':_0x070e('0x10d'),'foreignKey':'IntervalId','onDelete':_0x070e('0x175')});db[_0x070e('0x79')][_0x070e('0x10b')](db[_0x070e('0x3a')],{'as':_0x070e('0x1aa'),'foreignKey':_0x070e('0x151')});db[_0x070e('0x79')][_0x070e('0x10b')](db[_0x070e('0x191')],{'as':_0x070e('0x1ab'),'foreignKey':'IntervalId'});db['Interval'][_0x070e('0x10b')](db[_0x070e('0x42')],{'as':_0x070e('0x1ac'),'foreignKey':'IntervalId'});db[_0x070e('0x79')][_0x070e('0x10b')](db[_0x070e('0x4b')],{'as':'SmsApplications','foreignKey':_0x070e('0x151')});db[_0x070e('0x1ad')][_0x070e('0x11c')](db[_0x070e('0x34')],{});db['Schedule'][_0x070e('0x11c')](db[_0x070e('0x1ae')],{'foreignKey':_0x070e('0x1af')});db[_0x070e('0x1ad')][_0x070e('0x11c')](db[_0x070e('0x8a')],{'foreignKey':'CustomReportId'});db['Sound'][_0x070e('0x120')](db['VoiceMusicOnHold'],{'as':_0x070e('0x1b0'),'through':_0x070e('0x146'),'onDelete':'restrict'});db[_0x070e('0x82')][_0x070e('0x120')](db[_0x070e('0x69')],{'through':'cm_contact_has_tags'});db[_0x070e('0x82')]['belongsToMany'](db['ChatInteraction'],{'through':_0x070e('0x196')});db[_0x070e('0x82')]['belongsToMany'](db[_0x070e('0x37')],{'through':_0x070e('0x16c')});db['Tag'][_0x070e('0x120')](db[_0x070e('0x4c')],{'through':'sms_interaction_has_tags'});db[_0x070e('0x82')][_0x070e('0x120')](db[_0x070e('0x115')],{'through':'fax_interaction_has_tags'});db['Tag'][_0x070e('0x120')](db[_0x070e('0x55')],{'through':_0x070e('0x18d')});db[_0x070e('0x82')][_0x070e('0x120')](db[_0x070e('0x118')],{'through':_0x070e('0x1b1')});db[_0x070e('0x86')][_0x070e('0x10b')](db['Condition'],{'as':{'plural':_0x070e('0x1b2'),'singular':'AllCondition'},'foreignKey':_0x070e('0x1b3'),'onDelete':_0x070e('0x107'),'hooks':!![]});db[_0x070e('0x86')][_0x070e('0x10b')](db[_0x070e('0x77')],{'as':{'plural':_0x070e('0x1b4'),'singular':_0x070e('0x1b5')},'foreignKey':'TriggerAnyId','onDelete':_0x070e('0x107'),'hooks':!![]});db[_0x070e('0x86')]['hasMany'](db[_0x070e('0x1a6')],{'as':_0x070e('0x1a7'),'foreignKey':_0x070e('0x1b6'),'onDelete':_0x070e('0x107'),'hooks':!![]});db[_0x070e('0x8a')][_0x070e('0x10b')](db[_0x070e('0x91')],{'as':_0x070e('0x1b7'),'onDelete':_0x070e('0x107'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x070e('0x10b')](db[_0x070e('0x91')],{'as':_0x070e('0x1b7'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1af')});db[_0x070e('0x8f')][_0x070e('0x10b')](db[_0x070e('0x91')],{'as':_0x070e('0x1b7'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1b8')});db[_0x070e('0x91')][_0x070e('0x11c')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x070e('0x93')][_0x070e('0x10b')](db[_0x070e('0x95')],{'as':'Configurations','onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1b9')});db[_0x070e('0x95')][_0x070e('0x10b')](db['SalesforceField'],{'as':_0x070e('0x1ba'),'onDelete':'cascade','foreignKey':_0x070e('0x1bb')});db[_0x070e('0x95')][_0x070e('0x10b')](db['SalesforceField'],{'as':_0x070e('0x1bc'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1bd')});db[_0x070e('0x95')]['hasMany'](db['SalesforceField'],{'as':_0x070e('0x1b7'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1be')});db[_0x070e('0x95')]['belongsTo'](db[_0x070e('0x93')],{'as':_0x070e('0x171'),'foreignKey':_0x070e('0x1b9')});db[_0x070e('0x97')][_0x070e('0x10b')](db['SalesforceField'],{'as':'Subject','foreignKey':_0x070e('0x1bb')});db[_0x070e('0x97')][_0x070e('0x10b')](db[_0x070e('0x97')],{'as':_0x070e('0x1bf'),'foreignKey':_0x070e('0x1bd')});db[_0x070e('0x97')][_0x070e('0x10b')](db[_0x070e('0x97')],{'as':'Field','foreignKey':_0x070e('0x1be')});db['SalesforceField'][_0x070e('0x11c')](db[_0x070e('0x1c0')],{'as':_0x070e('0x1c0'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x070e('0x10b')](db[_0x070e('0x9a')],{'as':'Configurations','onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1b9')});db[_0x070e('0x9a')][_0x070e('0x10b')](db[_0x070e('0x1c1')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x070e('0x9a')][_0x070e('0x10b')](db['SugarcrmField'],{'as':_0x070e('0x1bc'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1bd')});db[_0x070e('0x9a')][_0x070e('0x10b')](db['SugarcrmField'],{'as':_0x070e('0x1b7'),'onDelete':'cascade','foreignKey':_0x070e('0x1be')});db['SugarcrmConfiguration'][_0x070e('0x11c')](db[_0x070e('0x99')],{'as':'Account','foreignKey':'AccountId'});db[_0x070e('0x1c1')]['hasMany'](db['SugarcrmField'],{'as':_0x070e('0x1c2'),'foreignKey':_0x070e('0x1bb')});db[_0x070e('0x1c1')][_0x070e('0x10b')](db[_0x070e('0x1c1')],{'as':_0x070e('0x1bf'),'foreignKey':_0x070e('0x1bd')});db[_0x070e('0x1c1')][_0x070e('0x10b')](db['SugarcrmField'],{'as':'Field','foreignKey':_0x070e('0x1be')});db[_0x070e('0x1c1')][_0x070e('0x11c')](db[_0x070e('0x1c0')],{'as':_0x070e('0x1c0'),'foreignKey':_0x070e('0x1c3')});db[_0x070e('0x9d')][_0x070e('0x10b')](db[_0x070e('0x9e')],{'as':_0x070e('0x1c4'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1b9')});db['DeskConfiguration'][_0x070e('0x10b')](db[_0x070e('0xa0')],{'as':'Subjects','onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1bb')});db[_0x070e('0x9e')][_0x070e('0x10b')](db[_0x070e('0xa0')],{'as':_0x070e('0x1bc'),'onDelete':'cascade','foreignKey':_0x070e('0x1bd')});db[_0x070e('0x9e')][_0x070e('0x10b')](db[_0x070e('0xa0')],{'as':'Fields','onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1be')});db[_0x070e('0x9e')][_0x070e('0x11c')](db[_0x070e('0x9d')],{'as':_0x070e('0x171'),'foreignKey':_0x070e('0x1b9')});db[_0x070e('0x9e')][_0x070e('0x120')](db[_0x070e('0x82')],{'through':_0x070e('0x1c5')});db[_0x070e('0xa0')][_0x070e('0x10b')](db[_0x070e('0xa0')],{'as':_0x070e('0x1c2'),'foreignKey':_0x070e('0x1bb')});db[_0x070e('0xa0')][_0x070e('0x10b')](db[_0x070e('0xa0')],{'as':_0x070e('0x1bf'),'foreignKey':_0x070e('0x1bd')});db[_0x070e('0xa0')][_0x070e('0x10b')](db[_0x070e('0xa0')],{'as':_0x070e('0x1c6'),'foreignKey':_0x070e('0x1be')});db[_0x070e('0xa0')][_0x070e('0x11c')](db[_0x070e('0x1c0')],{'as':_0x070e('0x1c0'),'foreignKey':_0x070e('0x1c3')});db['ZohoAccount']['hasMany'](db['ZohoConfiguration'],{'as':_0x070e('0x1c4'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1b9')});db[_0x070e('0xa3')][_0x070e('0x10b')](db['ZohoField'],{'as':_0x070e('0x1ba'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x070e('0xa3')][_0x070e('0x10b')](db[_0x070e('0xa5')],{'as':_0x070e('0x1bc'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1bd')});db[_0x070e('0xa3')]['hasMany'](db[_0x070e('0xa5')],{'as':_0x070e('0x1b7'),'onDelete':'cascade','foreignKey':_0x070e('0x1be')});db[_0x070e('0xa3')][_0x070e('0x11c')](db[_0x070e('0xa1')],{'as':_0x070e('0x171'),'foreignKey':_0x070e('0x1b9')});db[_0x070e('0xa5')][_0x070e('0x10b')](db['ZohoField'],{'as':_0x070e('0x1c2'),'foreignKey':_0x070e('0x1bb')});db[_0x070e('0xa5')][_0x070e('0x10b')](db[_0x070e('0xa5')],{'as':_0x070e('0x1bf'),'foreignKey':_0x070e('0x1bd')});db[_0x070e('0xa5')][_0x070e('0x10b')](db[_0x070e('0xa5')],{'as':_0x070e('0x1c6'),'foreignKey':_0x070e('0x1be')});db['ZohoField'][_0x070e('0x11c')](db['Variable'],{'as':_0x070e('0x1c0'),'foreignKey':_0x070e('0x1c3')});db[_0x070e('0xa7')][_0x070e('0x10b')](db[_0x070e('0xa9')],{'as':_0x070e('0x1c4'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1b9')});db[_0x070e('0xa9')][_0x070e('0x10b')](db[_0x070e('0xab')],{'as':_0x070e('0x1ba'),'foreignKey':_0x070e('0x1bb')});db['ZendeskConfiguration'][_0x070e('0x10b')](db['ZendeskField'],{'as':_0x070e('0x1bc'),'foreignKey':_0x070e('0x1bd')});db[_0x070e('0xa9')]['hasMany'](db[_0x070e('0xab')],{'as':_0x070e('0x1b7'),'foreignKey':_0x070e('0x1be')});db[_0x070e('0xa9')][_0x070e('0x11c')](db[_0x070e('0xa7')],{'as':'Account','foreignKey':_0x070e('0x1b9')});db[_0x070e('0xa9')][_0x070e('0x120')](db[_0x070e('0x82')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x070e('0x10b')](db[_0x070e('0xab')],{'as':_0x070e('0x1c2'),'foreignKey':_0x070e('0x1bb')});db[_0x070e('0xab')][_0x070e('0x10b')](db[_0x070e('0xab')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x070e('0xab')][_0x070e('0x10b')](db[_0x070e('0xab')],{'as':'Field','foreignKey':_0x070e('0x1be')});db[_0x070e('0xab')][_0x070e('0x11c')](db[_0x070e('0x1c0')],{'as':_0x070e('0x1c0'),'foreignKey':_0x070e('0x1c3')});db[_0x070e('0xac')]['hasMany'](db[_0x070e('0xae')],{'as':'Configurations','onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1b9')});db[_0x070e('0xae')][_0x070e('0x10b')](db['FreshdeskField'],{'as':_0x070e('0x1ba'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1bb')});db['FreshdeskConfiguration'][_0x070e('0x10b')](db[_0x070e('0x1c7')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x070e('0xae')][_0x070e('0x10b')](db[_0x070e('0x1c7')],{'as':'Fields','onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1be')});db[_0x070e('0xae')][_0x070e('0x11c')](db[_0x070e('0xac')],{'as':_0x070e('0x171'),'foreignKey':_0x070e('0x1b9')});db[_0x070e('0xae')]['belongsToMany'](db[_0x070e('0x82')],{'through':_0x070e('0x1c8')});db[_0x070e('0x1c7')][_0x070e('0x10b')](db[_0x070e('0x1c7')],{'as':_0x070e('0x1c2'),'foreignKey':_0x070e('0x1bb')});db['FreshdeskField'][_0x070e('0x10b')](db[_0x070e('0x1c7')],{'as':_0x070e('0x1bf'),'foreignKey':_0x070e('0x1bd')});db[_0x070e('0x1c7')]['hasMany'](db[_0x070e('0x1c7')],{'as':'Field','foreignKey':_0x070e('0x1be')});db['FreshdeskField'][_0x070e('0x11c')](db[_0x070e('0x1c0')],{'as':_0x070e('0x1c0'),'foreignKey':_0x070e('0x1c3')});db[_0x070e('0xb0')]['hasMany'](db['VtigerConfiguration'],{'as':_0x070e('0x1c4'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1b9')});db[_0x070e('0xb2')][_0x070e('0x10b')](db[_0x070e('0xb3')],{'as':'Subjects','foreignKey':_0x070e('0x1bb')});db[_0x070e('0xb2')][_0x070e('0x10b')](db[_0x070e('0xb3')],{'as':'Descriptions','foreignKey':_0x070e('0x1bd')});db[_0x070e('0xb2')]['hasMany'](db['VtigerField'],{'as':_0x070e('0x1b7'),'foreignKey':'FieldId'});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':_0x070e('0x171'),'foreignKey':_0x070e('0x1b9')});db[_0x070e('0xb3')][_0x070e('0x10b')](db[_0x070e('0xb3')],{'as':_0x070e('0x1c2'),'foreignKey':_0x070e('0x1bb')});db[_0x070e('0xb3')][_0x070e('0x10b')](db[_0x070e('0xb3')],{'as':_0x070e('0x1bf'),'foreignKey':_0x070e('0x1bd')});db[_0x070e('0xb3')][_0x070e('0x10b')](db[_0x070e('0xb3')],{'as':_0x070e('0x1c6'),'foreignKey':_0x070e('0x1be')});db[_0x070e('0xb3')][_0x070e('0x11c')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['ServicenowAccount'][_0x070e('0x10b')](db[_0x070e('0x1c9')],{'as':_0x070e('0x1c4'),'onDelete':_0x070e('0x107'),'foreignKey':'AccountId'});db['ServicenowConfiguration'][_0x070e('0x10b')](db[_0x070e('0xb7')],{'as':_0x070e('0x1ba'),'foreignKey':_0x070e('0x1bb')});db[_0x070e('0x1c9')]['hasMany'](db['ServicenowField'],{'as':_0x070e('0x1bc'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration']['hasMany'](db[_0x070e('0xb7')],{'as':'Fields','foreignKey':_0x070e('0x1be')});db[_0x070e('0x1c9')][_0x070e('0x11c')](db[_0x070e('0xb4')],{'as':_0x070e('0x171'),'foreignKey':_0x070e('0x1b9')});db[_0x070e('0xb7')]['hasMany'](db[_0x070e('0xb7')],{'as':_0x070e('0x1c2'),'foreignKey':_0x070e('0x1bb')});db[_0x070e('0xb7')][_0x070e('0x10b')](db['ServicenowField'],{'as':_0x070e('0x1bf'),'foreignKey':_0x070e('0x1bd')});db[_0x070e('0xb7')][_0x070e('0x10b')](db[_0x070e('0xb7')],{'as':_0x070e('0x1c6'),'foreignKey':'FieldId'});db[_0x070e('0xb7')]['belongsTo'](db[_0x070e('0x1c0')],{'as':'Variable','foreignKey':_0x070e('0x1c3')});db[_0x070e('0xb9')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x070e('0x1c4'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1b9')});db[_0x070e('0xbb')][_0x070e('0x10b')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1bb')});db[_0x070e('0xbb')]['hasMany'](db[_0x070e('0xbd')],{'as':_0x070e('0x1bc'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1bd')});db[_0x070e('0xbb')][_0x070e('0x10b')](db[_0x070e('0xbd')],{'as':_0x070e('0x1b7'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1be')});db[_0x070e('0xbb')][_0x070e('0x11c')](db['Dynamics365Account'],{'as':_0x070e('0x171'),'foreignKey':_0x070e('0x1b9')});db['Dynamics365Field']['hasMany'](db[_0x070e('0xbd')],{'as':'Subject','foreignKey':_0x070e('0x1bb')});db['Dynamics365Field'][_0x070e('0x10b')](db['Dynamics365Field'],{'as':_0x070e('0x1bf'),'foreignKey':_0x070e('0x1bd')});db[_0x070e('0xbd')][_0x070e('0x10b')](db['Dynamics365Field'],{'as':_0x070e('0x1c6'),'foreignKey':_0x070e('0x1be')});db['Dynamics365Field'][_0x070e('0x11c')](db['Variable'],{'as':_0x070e('0x1c0'),'foreignKey':_0x070e('0x1c3')});db[_0x070e('0xbf')]['hasMany'](db[_0x070e('0xc1')],{'as':_0x070e('0x1c4'),'onDelete':'cascade','foreignKey':_0x070e('0x1b9')});db[_0x070e('0xc1')][_0x070e('0x10b')](db[_0x070e('0xc3')],{'as':_0x070e('0x1ba'),'foreignKey':_0x070e('0x1bb')});db[_0x070e('0xc1')]['hasMany'](db[_0x070e('0xc3')],{'as':_0x070e('0x1bc'),'foreignKey':'DescriptionId'});db[_0x070e('0xc1')][_0x070e('0x10b')](db[_0x070e('0xc3')],{'as':_0x070e('0x1b7'),'foreignKey':_0x070e('0x1be')});db[_0x070e('0xc1')][_0x070e('0x11c')](db[_0x070e('0xbf')],{'as':_0x070e('0x171'),'foreignKey':_0x070e('0x1b9')});db['FreshsalesField'][_0x070e('0x10b')](db[_0x070e('0xc3')],{'as':_0x070e('0x1c2'),'foreignKey':'SubjectId'});db[_0x070e('0xc3')][_0x070e('0x10b')](db[_0x070e('0xc3')],{'as':_0x070e('0x1bf'),'foreignKey':_0x070e('0x1bd')});db['FreshsalesField']['hasMany'](db[_0x070e('0xc3')],{'as':'Field','foreignKey':_0x070e('0x1be')});db['FreshsalesField']['belongsTo'](db[_0x070e('0x1c0')],{'as':'Variable','foreignKey':_0x070e('0x1c3')});db[_0x070e('0xc7')][_0x070e('0x11c')](db[_0x070e('0x5a')],{});db[_0x070e('0xc7')][_0x070e('0x11c')](db[_0x070e('0xeb')],{'as':_0x070e('0x167'),'foreignKey':_0x070e('0x178')});db[_0x070e('0xc7')][_0x070e('0x11c')](db[_0x070e('0x69')],{'as':_0x070e('0x15f'),'foreignKey':'ContactId'});db['ChatQueueReport']['belongsTo'](db[_0x070e('0x5f')],{});db[_0x070e('0xc7')][_0x070e('0x11c')](db[_0x070e('0x61')],{});db['ChatQueueReport'][_0x070e('0x11c')](db[_0x070e('0x105')],{});db[_0x070e('0xc7')][_0x070e('0x11c')](db[_0x070e('0x12f')],{});db['ChatInternalMessage'][_0x070e('0x11c')](db[_0x070e('0x105')],{'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x1ca')});db['ChatInternalMessage'][_0x070e('0x11c')](db[_0x070e('0x105')],{'onDelete':_0x070e('0x107'),'foreignKey':'ToId'});db[_0x070e('0x19a')][_0x070e('0x10b')](db[_0x070e('0xca')],{'foreignKey':_0x070e('0x1cb'),'onDelete':_0x070e('0x107')});db[_0x070e('0x19a')][_0x070e('0x10b')](db[_0x070e('0x1cc')],{'foreignKey':_0x070e('0x1cb'),'onDelete':_0x070e('0x107')});db[_0x070e('0xcc')]['belongsTo'](db[_0x070e('0x13c')],{});db[_0x070e('0xcc')][_0x070e('0x11c')](db['CmList'],{'as':_0x070e('0x167'),'foreignKey':'ListId'});db[_0x070e('0xcc')][_0x070e('0x11c')](db['CmContact'],{'as':_0x070e('0x15f'),'foreignKey':_0x070e('0x160')});db[_0x070e('0xcc')][_0x070e('0x11c')](db['SmsInteraction'],{});db['SmsQueueReport'][_0x070e('0x11c')](db[_0x070e('0x4e')],{});db[_0x070e('0xcc')][_0x070e('0x11c')](db[_0x070e('0x105')],{});db[_0x070e('0xcc')][_0x070e('0x11c')](db[_0x070e('0x50')],{});db[_0x070e('0x1cd')]['hasMany'](db[_0x070e('0x19a')],{'foreignKey':_0x070e('0x1ce')});db[_0x070e('0x1cd')][_0x070e('0x10b')](db['JscriptyQuestionReport'],{'foreignKey':_0x070e('0x1ce')});db[_0x070e('0x1cd')][_0x070e('0x10b')](db[_0x070e('0x1cc')],{'foreignKey':_0x070e('0x1ce')});db[_0x070e('0xd7')][_0x070e('0x120')](db[_0x070e('0x105')],{'as':_0x070e('0x16e'),'through':_0x070e('0x141')});db[_0x070e('0x155')]['belongsToMany'](db[_0x070e('0x105')],{'as':'Agents','through':'user_has_teams'});db['Team']['belongsToMany'](db[_0x070e('0x129')],{'through':_0x070e('0x100'),'as':_0x070e('0x12a')});db[_0x070e('0x155')]['belongsToMany'](db[_0x070e('0x35')],{'through':_0x070e('0x169'),'as':_0x070e('0x12d')});db['Team'][_0x070e('0x120')](db['ChatQueue'],{'through':_0x070e('0x197'),'as':_0x070e('0x130')});db[_0x070e('0x155')]['belongsToMany'](db[_0x070e('0x46')],{'through':'team_has_fax_queues','as':_0x070e('0x132')});db[_0x070e('0x155')][_0x070e('0x120')](db['SmsQueue'],{'through':_0x070e('0x189'),'as':'SmsQueues'});db[_0x070e('0x155')][_0x070e('0x120')](db['OpenchannelQueue'],{'through':_0x070e('0x18f'),'as':'OpenchannelQueues'});db[_0x070e('0x155')][_0x070e('0x120')](db[_0x070e('0xfc')],{'through':_0x070e('0x1cf'),'as':_0x070e('0x1d0')});db['Team'][_0x070e('0x120')](db[_0x070e('0xed')],{'through':_0x070e('0x102'),'as':_0x070e('0x12c')});db[_0x070e('0xdf')][_0x070e('0x10b')](db[_0x070e('0x6b')],{'as':_0x070e('0x149'),'foreignKey':_0x070e('0x19e')});db['Campaign']['hasMany'](db[_0x070e('0x10e')],{'as':_0x070e('0x10f'),'foreignKey':_0x070e('0x19e')});db['Campaign'][_0x070e('0x10b')](db[_0x070e('0x6e')],{'as':'HopperHistories','foreignKey':_0x070e('0x19e')});db[_0x070e('0xdf')][_0x070e('0x10b')](db[_0x070e('0x14b')],{'as':'HopperBlacks','foreignKey':_0x070e('0x19e')});db[_0x070e('0xdf')][_0x070e('0x11c')](db['Trunk'],{'as':_0x070e('0x27'),'foreignKey':'TrunkId'});db[_0x070e('0xdf')]['belongsTo'](db[_0x070e('0x27')],{'as':_0x070e('0x14f'),'foreignKey':_0x070e('0x150')});db[_0x070e('0xdf')][_0x070e('0x11c')](db[_0x070e('0x79')],{'as':_0x070e('0x79'),'foreignKey':_0x070e('0x151')});db[_0x070e('0xdf')]['belongsTo'](db['SquareProject'],{'as':_0x070e('0xd7'),'foreignKey':_0x070e('0x1d1')});db[_0x070e('0xdf')][_0x070e('0x120')](db[_0x070e('0xeb')],{'as':_0x070e('0x123'),'through':_0x070e('0x1d2')});db['Campaign'][_0x070e('0x120')](db['CmList'],{'as':_0x070e('0x157'),'through':_0x070e('0x1d3')});db['Attachment'][_0x070e('0x11c')](db[_0x070e('0x173')],{'as':_0x070e('0x173'),'foreignKey':_0x070e('0x174')});db[_0x070e('0x1d4')][_0x070e('0x11c')](db[_0x070e('0x16a')],{});db[_0x070e('0x1d4')]['belongsTo'](db[_0x070e('0x37')],{});db[_0x070e('0x1d4')][_0x070e('0x11c')](db[_0x070e('0x34')],{'foreignKey':_0x070e('0x1d5'),'as':_0x070e('0x1d6')});db['MailTransferReport'][_0x070e('0x11c')](db['User'],{'foreignKey':_0x070e('0x1d7'),'as':'FromAgent'});db[_0x070e('0x1d4')][_0x070e('0x11c')](db[_0x070e('0x105')],{'foreignKey':_0x070e('0x1d8'),'as':_0x070e('0x1d9')});db['MailTransferReport'][_0x070e('0x11c')](db[_0x070e('0x35')],{'foreignKey':_0x070e('0x1da'),'as':_0x070e('0x1db')});db[_0x070e('0x1d4')]['belongsTo'](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0x070e('0xe6')][_0x070e('0x11c')](db[_0x070e('0x61')],{});db[_0x070e('0xe6')][_0x070e('0x11c')](db[_0x070e('0x5f')],{});db[_0x070e('0xe6')][_0x070e('0x11c')](db[_0x070e('0x5a')],{'foreignKey':'FromChatWebsiteId','as':_0x070e('0x1d6')});db[_0x070e('0xe6')]['belongsTo'](db['User'],{'foreignKey':_0x070e('0x1d7'),'as':'FromAgent'});db[_0x070e('0xe6')][_0x070e('0x11c')](db[_0x070e('0x105')],{'foreignKey':_0x070e('0x1d8'),'as':'ToAgent'});db['ChatTransferReport'][_0x070e('0x11c')](db[_0x070e('0x12f')],{'foreignKey':'ToChatQueueId','as':_0x070e('0x1db')});db[_0x070e('0xe6')][_0x070e('0x11c')](db[_0x070e('0x5a')],{'foreignKey':_0x070e('0x1dc'),'as':_0x070e('0x1dd')});db['FaxTransferReport'][_0x070e('0x11c')](db['FaxMessage'],{});db[_0x070e('0xe8')][_0x070e('0x11c')](db[_0x070e('0x115')],{});db[_0x070e('0xe8')][_0x070e('0x11c')](db[_0x070e('0x135')],{'foreignKey':_0x070e('0x1de'),'as':'FromAccount'});db[_0x070e('0xe8')][_0x070e('0x11c')](db[_0x070e('0x105')],{'foreignKey':'FromUserId','as':_0x070e('0x1df')});db[_0x070e('0xe8')][_0x070e('0x11c')](db[_0x070e('0x105')],{'foreignKey':_0x070e('0x1d8'),'as':_0x070e('0x1d9')});db[_0x070e('0xe8')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x070e('0x1e0'),'as':_0x070e('0x1db')});db[_0x070e('0xe8')][_0x070e('0x11c')](db[_0x070e('0x135')],{'foreignKey':_0x070e('0x1e1'),'as':_0x070e('0x1dd')});db[_0x070e('0x1e2')]['belongsTo'](db[_0x070e('0x57')],{});db[_0x070e('0x1e2')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x070e('0x1e2')]['belongsTo'](db[_0x070e('0x52')],{'foreignKey':'FromOpenchannelAccountId','as':_0x070e('0x1d6')});db[_0x070e('0x1e2')][_0x070e('0x11c')](db[_0x070e('0x105')],{'foreignKey':'FromUserId','as':_0x070e('0x1df')});db[_0x070e('0x1e2')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0x070e('0x1d9')});db['OpenchannelTransferReport'][_0x070e('0x11c')](db[_0x070e('0x58')],{'foreignKey':_0x070e('0x1e3'),'as':_0x070e('0x1db')});db[_0x070e('0x1e2')]['belongsTo'](db[_0x070e('0x52')],{'foreignKey':_0x070e('0x1e4'),'as':_0x070e('0x1dd')});db[_0x070e('0x1e5')][_0x070e('0x11c')](db[_0x070e('0x4e')],{});db[_0x070e('0x1e5')]['belongsTo'](db[_0x070e('0x4c')],{});db[_0x070e('0x1e5')][_0x070e('0x11c')](db[_0x070e('0x13c')],{'foreignKey':_0x070e('0x1e6'),'as':_0x070e('0x1d6')});db[_0x070e('0x1e5')][_0x070e('0x11c')](db[_0x070e('0x105')],{'foreignKey':_0x070e('0x1d7'),'as':_0x070e('0x1df')});db[_0x070e('0x1e5')][_0x070e('0x11c')](db[_0x070e('0x105')],{'foreignKey':_0x070e('0x1d8'),'as':_0x070e('0x1d9')});db['SmsTransferReport'][_0x070e('0x11c')](db['SmsQueue'],{'foreignKey':_0x070e('0x1e7'),'as':'ToQueue'});db[_0x070e('0x1e5')][_0x070e('0x11c')](db['SmsAccount'],{'foreignKey':_0x070e('0x1e8'),'as':'ToAccount'});db[_0x070e('0xeb')][_0x070e('0x10b')](db[_0x070e('0x75')],{'as':_0x070e('0x18a'),'foreignKey':'ListId','onDelete':_0x070e('0x107')});db['CmList'][_0x070e('0x10b')](db[_0x070e('0x70')],{'as':_0x070e('0x1e9'),'foreignKey':_0x070e('0x178')});db[_0x070e('0xeb')][_0x070e('0x10b')](db[_0x070e('0x69')],{'as':_0x070e('0x121'),'onDelete':_0x070e('0x107'),'foreignKey':_0x070e('0x178')});db[_0x070e('0xeb')]['hasMany'](db['CmHopperFinal'],{'as':_0x070e('0x10f'),'foreignKey':_0x070e('0x178')});db[_0x070e('0xeb')][_0x070e('0x10b')](db[_0x070e('0x6e')],{'as':'HopperHistory','foreignKey':_0x070e('0x178')});db[_0x070e('0xeb')][_0x070e('0x10b')](db[_0x070e('0x111')],{'as':'ReportAgentPreview','foreignKey':_0x070e('0x178')});db[_0x070e('0xeb')][_0x070e('0x120')](db[_0x070e('0x129')],{'as':_0x070e('0x1ea'),'through':_0x070e('0x153')});db['CmList']['belongsToMany'](db[_0x070e('0x105')],{'as':'Agents','through':_0x070e('0x124')});db[_0x070e('0xed')][_0x070e('0x10b')](db[_0x070e('0x10c')],{'as':_0x070e('0x10d'),'onDelete':'cascade'});db[_0x070e('0xed')][_0x070e('0x120')](db[_0x070e('0x105')],{'as':_0x070e('0x154'),'through':_0x070e('0x103')});db[_0x070e('0xed')][_0x070e('0x120')](db[_0x070e('0x155')],{'through':_0x070e('0x102'),'as':_0x070e('0x156')});db[_0x070e('0xef')][_0x070e('0x10b')](db[_0x070e('0x105')],{'as':'Users','foreignKey':_0x070e('0x11d')});db['UserProfile'][_0x070e('0x10b')](db[_0x070e('0x1eb')],{'as':_0x070e('0x1ec'),'foreignKey':_0x070e('0x11d'),'onDelete':_0x070e('0x107')});db['UserProfileSection'][_0x070e('0x10b')](db['UserProfileResource'],{'as':_0x070e('0x1ed'),'foreignKey':_0x070e('0x1ee'),'onDelete':_0x070e('0x107')});db[_0x070e('0xf3')]['hasMany'](db[_0x070e('0x75')],{'as':_0x070e('0x18a'),'foreignKey':_0x070e('0x1ef'),'onDelete':'cascade'});db['WhatsappAccount'][_0x070e('0x10b')](db[_0x070e('0x73')],{'as':'Answers','foreignKey':_0x070e('0x1ef')});db[_0x070e('0xf3')]['hasMany'](db[_0x070e('0xf7')],{'as':_0x070e('0x159'),'foreignKey':_0x070e('0x1ef')});db['WhatsappAccount'][_0x070e('0x10b')](db[_0x070e('0x118')],{'as':_0x070e('0x166')});db['WhatsappAccount'][_0x070e('0x10b')](db[_0x070e('0xf4')],{'as':_0x070e('0x144')});db[_0x070e('0xf3')][_0x070e('0x11c')](db['CmList'],{'as':_0x070e('0x167'),'foreignKey':_0x070e('0x178')});db[_0x070e('0xf3')][_0x070e('0x11c')](db[_0x070e('0x17c')],{'as':_0x070e('0x17d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x070e('0xf3')]['belongsToMany'](db[_0x070e('0x105')],{'as':_0x070e('0x154'),'through':_0x070e('0x13f')});db['WhatsappApplication'][_0x070e('0x11c')](db['User'],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db[_0x070e('0xfc')],{'onDelete':'restrict'});db[_0x070e('0xf4')][_0x070e('0x11c')](db[_0x070e('0xf3')],{'onDelete':_0x070e('0x175')});db[_0x070e('0xf4')][_0x070e('0x11c')](db['Interval'],{'onDelete':_0x070e('0x175'),'foreignKey':_0x070e('0x151')});db['WhatsappApplication'][_0x070e('0x11c')](db['Tag'],{'onDelete':_0x070e('0x175'),'foreignKey':_0x070e('0x176')});db[_0x070e('0x118')][_0x070e('0x10b')](db['WhatsappMessage'],{'as':_0x070e('0x159'),'onDelete':'cascade','foreignKey':_0x070e('0x1f0')});db[_0x070e('0x118')][_0x070e('0x11c')](db[_0x070e('0xf3')],{'as':_0x070e('0x171'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction']['belongsTo'](db[_0x070e('0x69')],{'as':'Contact','foreignKey':_0x070e('0x160')});db[_0x070e('0x118')][_0x070e('0x11c')](db[_0x070e('0x105')],{'as':'Owner','foreignKey':'UserId'});db['WhatsappInteraction']['belongsToMany'](db[_0x070e('0x82')],{'through':_0x070e('0x1b1'),'as':_0x070e('0x16d')});db[_0x070e('0x118')][_0x070e('0x120')](db[_0x070e('0x82')],{'through':_0x070e('0x1b1'),'as':'ThroughTags'});db[_0x070e('0x118')][_0x070e('0x120')](db[_0x070e('0x105')],{'as':_0x070e('0x16e'),'through':_0x070e('0x1f1'),'foreignKey':_0x070e('0x1f0')});db[_0x070e('0xf7')][_0x070e('0x11c')](db[_0x070e('0x105')],{'as':_0x070e('0x105')});db['WhatsappMessage']['belongsTo'](db[_0x070e('0x69')],{'onDelete':_0x070e('0x107'),'as':_0x070e('0x15f')});db[_0x070e('0xf7')][_0x070e('0x11c')](db[_0x070e('0x118')],{'onDelete':_0x070e('0x107'),'as':'Interaction','foreignKey':'WhatsappInteractionId'});db[_0x070e('0xf7')][_0x070e('0x11c')](db[_0x070e('0xf3')],{'as':_0x070e('0x171'),'foreignKey':'WhatsappAccountId'});db[_0x070e('0xf9')][_0x070e('0x11c')](db['WhatsappAccount'],{});db[_0x070e('0xf9')][_0x070e('0x11c')](db[_0x070e('0xeb')],{'as':_0x070e('0x167'),'foreignKey':_0x070e('0x178')});db['WhatsappQueueReport'][_0x070e('0x11c')](db[_0x070e('0x69')],{'as':'Contact','foreignKey':_0x070e('0x160')});db[_0x070e('0xf9')][_0x070e('0x11c')](db[_0x070e('0x118')],{});db['WhatsappQueueReport'][_0x070e('0x11c')](db['WhatsappQueue'],{});db[_0x070e('0xf9')][_0x070e('0x11c')](db[_0x070e('0xf7')],{});db[_0x070e('0xf9')][_0x070e('0x11c')](db['User'],{});db['WhatsappTransferReport'][_0x070e('0x11c')](db[_0x070e('0xf7')],{});db[_0x070e('0x1f2')][_0x070e('0x11c')](db[_0x070e('0x118')],{});db['WhatsappTransferReport'][_0x070e('0x11c')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x070e('0x1f2')]['belongsTo'](db[_0x070e('0xf3')],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db[_0x070e('0x1f2')]['belongsTo'](db[_0x070e('0xfc')],{'foreignKey':_0x070e('0x1f3'),'as':_0x070e('0x1db')});db[_0x070e('0x1f2')][_0x070e('0x11c')](db[_0x070e('0x105')],{'foreignKey':_0x070e('0x1d7'),'as':_0x070e('0x1df')});db['WhatsappTransferReport'][_0x070e('0x11c')](db[_0x070e('0x105')],{'foreignKey':_0x070e('0x1d8'),'as':_0x070e('0x1d9')});db[_0x070e('0xfc')]['belongsToMany'](db[_0x070e('0x105')],{'as':'Agents','through':_0x070e('0x31'),'foreignKey':_0x070e('0x1f4')});db[_0x070e('0xfc')][_0x070e('0x120')](db[_0x070e('0x155')],{'through':_0x070e('0x1cf'),'as':_0x070e('0x156')});module[_0x070e('0x1f5')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa75b=['../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskField','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../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','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','UserNotifications','SenderId','UserProfile','belongsToMany','Groups','Contacts','Lists','user_has_teams','MailInteraction','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','UserVoicePrefix','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','VoiceAgentReport','AgentReports','uniqueid','Contact','ContactId','MailAccount','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','MailApplication','List','mandatoryDispositionPauseId','Teams','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','ListId','Items','FaxAccountId','Exntensions','Agents','user_has_fax_accounts','FaxQueue','FaxInteractionId','fax_interaction_has_tags','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','AttachmentId','OpenchannelQueueId','team_has_openchannel_queues','ChatProactiveAction','OpenchannelQueueReport','Agent','Queue','ChatQueueId','ChatMessage','ChatInteractionId','ChatGroupId','chat_group_has_users','CompanyId','JscriptySessionReport','Company','cm_user_has_contacts','cm_contact_has_tags','Condition','All','OneAll','AutomationAllId','Any','OneAny','Action','Actions','AutomationId','MailApplications','ChatApplications','FaxApplications','AnalyticDefaultReport','Mohs','chat_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','CustomReportId','Fields','DefaultReportId','AnalyticMetric','MetricId','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','Field','SugarcrmAccount','Configurations','DescriptionId','VariableId','DeskAccount','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZendeskConfiguration','int_zendesk_configuration_has_tags','VtigerAccount','VtigerField','ServicenowConfiguration','FreshsalesField','FromId','ToId','SessionId','ProjectId','JscriptyQuestionReport','SquareProject','team_has_mail_queues','team_has_sms_queues','team_has_whatsapp_queues','CampaignId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToAccount','FromChatWebsiteId','ToChatWebsiteId','FromFaxAccountId','FromAccount','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','cm_user_has_lists','userProfileId','UserProfileSections','UserProfileResource','Resources','WhatsappAccountId','WhatsappInteractionId','ToWhatsappAccountId','exports','../config/environment','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','database','username','password','sequelizeHistory','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0xa75b,0x170));var _0xba75=function(_0x4a6669,_0x1c8646){_0x4a6669=_0x4a6669-0x0;var _0x529ba3=_0xa75b[_0x4a6669];return _0x529ba3;};'use strict';var config=require(_0xba75('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0xba75('0x1'));var timezone=jstz[_0xba75('0x2')]();config[_0xba75('0x3')]=_[_0xba75('0x4')](config[_0xba75('0x3')],{'database':_0xba75('0x5'),'username':_0xba75('0x6'),'password':_0xba75('0x7'),'options':{'host':_0xba75('0x8'),'port':0xcea,'dialect':_0xba75('0x9'),'dialectOptions':{'charset':_0xba75('0xa')},'logging':![],'timezone':timezone[_0xba75('0xb')](),'define':{'charset':_0xba75('0xc'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0xba75('0x4')](config['sequelizeHistory'],{'database':'motion2','username':_0xba75('0x6'),'password':'xC@LL1234','options':{'host':_0xba75('0x8'),'port':0xcea,'dialect':_0xba75('0x9'),'dialectOptions':{'charset':_0xba75('0xa')},'logging':![],'timezone':timezone[_0xba75('0xb')](),'define':{'charset':_0xba75('0xc'),'collate':_0xba75('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xba75('0x3')][_0xba75('0xe')],config[_0xba75('0x3')][_0xba75('0xf')],config[_0xba75('0x3')][_0xba75('0x10')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xba75('0x11')]['database'],config[_0xba75('0x11')][_0xba75('0xf')],config[_0xba75('0x11')][_0xba75('0x10')],config['sequelizeHistory'][_0xba75('0x12')])};db[_0xba75('0x13')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x15'));db['VoiceChanSpy']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x16'));db['VoiceContext']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x17'));db[_0xba75('0x18')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0xba75('0x19')]=db[_0xba75('0x3')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xba75('0x1a')]=db[_0xba75('0x3')]['import']('../api/voiceQueue/voiceQueue.model');db[_0xba75('0x1b')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x1c'));db[_0xba75('0x1d')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x1e'));db[_0xba75('0x1f')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x20'));db['VoiceMailMessage']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x21'));db[_0xba75('0x22')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x23'));db[_0xba75('0x24')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db['sequelize'][_0xba75('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xba75('0x25')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x26'));db[_0xba75('0x27')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x28'));db[_0xba75('0x29')]=db[_0xba75('0x3')]['import']('../api/trunk/trunk.model');db[_0xba75('0x2a')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x2b'));db[_0xba75('0x2c')]=db[_0xba75('0x3')]['import'](_0xba75('0x2d'));db[_0xba75('0x2e')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x2f'));db[_0xba75('0x30')]=db[_0xba75('0x3')]['import'](_0xba75('0x31'));db[_0xba75('0x32')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x33'));db[_0xba75('0x34')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x35'));db[_0xba75('0x36')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x37'));db[_0xba75('0x38')]=db['sequelize']['import'](_0xba75('0x39'));db[_0xba75('0x3a')]=db[_0xba75('0x3')]['import'](_0xba75('0x3b'));db[_0xba75('0x3c')]=db['sequelize']['import'](_0xba75('0x3d'));db[_0xba75('0x3e')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x3f'));db['MailAccount']=db['sequelize'][_0xba75('0x14')](_0xba75('0x40'));db[_0xba75('0x41')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x42'));db[_0xba75('0x43')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x44'));db['MailInteraction']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x45'));db[_0xba75('0x46')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x47'));db['MailApplication']=db[_0xba75('0x3')]['import'](_0xba75('0x48'));db['MailQueueReport']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x49'));db[_0xba75('0x4a')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x4b'));db[_0xba75('0x4c')]=db[_0xba75('0x3')]['import'](_0xba75('0x4d'));db[_0xba75('0x4e')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x4f'));db[_0xba75('0x50')]=db['sequelize']['import']('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0xba75('0x3')]['import'](_0xba75('0x51'));db[_0xba75('0x52')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x53'));db['FaxQueue']=db['sequelize'][_0xba75('0x14')]('../api/faxQueue/faxQueue.model');db[_0xba75('0x54')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x55'));db[_0xba75('0x56')]=db[_0xba75('0x3')]['import'](_0xba75('0x57'));db[_0xba75('0x58')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x59'));db[_0xba75('0x5a')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/smsInteraction/smsInteraction.model');db[_0xba75('0x5b')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x5c'));db[_0xba75('0x5d')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x5e'));db[_0xba75('0x5f')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x60'));db[_0xba75('0x61')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x62'));db[_0xba75('0x63')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x64'));db['OpenchannelMessage']=db['sequelize'][_0xba75('0x14')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0xba75('0x3')]['import'](_0xba75('0x65'));db[_0xba75('0x66')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x67'));db['OpenchannelQueueReport']=db[_0xba75('0x3')][_0xba75('0x14')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xba75('0x68')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x69'));db[_0xba75('0x6a')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x6b'));db['ChatMessage']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x6c'));db[_0xba75('0x6d')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xba75('0x6e')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x6f'));db[_0xba75('0x70')]=db[_0xba75('0x3')]['import']('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db['sequelize'][_0xba75('0x14')](_0xba75('0x71'));db[_0xba75('0x72')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x73'));db[_0xba75('0x74')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x75'));db[_0xba75('0x76')]=db[_0xba75('0x3')]['import'](_0xba75('0x77'));db[_0xba75('0x78')]=db['sequelize'][_0xba75('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xba75('0x79')]=db[_0xba75('0x3')]['import'](_0xba75('0x7a'));db[_0xba75('0x7b')]=db['sequelize']['import'](_0xba75('0x7c'));db['ReportAgentPreview']=db[_0xba75('0x3')]['import'](_0xba75('0x7d'));db[_0xba75('0x7e')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x7f'));db['Action']=db[_0xba75('0x3')][_0xba75('0x14')]('../api/action/action.model');db[_0xba75('0x80')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x81'));db[_0xba75('0x82')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x83'));db[_0xba75('0x84')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x85'));db['Condition']=db['sequelize'][_0xba75('0x14')](_0xba75('0x86'));db[_0xba75('0x87')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x88'));db[_0xba75('0x89')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x8a'));db[_0xba75('0x8b')]=db['sequelize'][_0xba75('0x14')]('../api/cdr/cdr.model');db[_0xba75('0x8c')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x8d'));db[_0xba75('0x8e')]=db[_0xba75('0x3')]['import'](_0xba75('0x8f'));db['Sound']=db[_0xba75('0x3')][_0xba75('0x14')]('../api/sound/sound.model');db['Tag']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x90'));db[_0xba75('0x91')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/template/template.model');db[_0xba75('0x92')]=db[_0xba75('0x3')]['import'](_0xba75('0x93'));db[_0xba75('0x94')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x95'));db['Integration']=db[_0xba75('0x3')]['import'](_0xba75('0x96'));db[_0xba75('0x97')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x98'));db[_0xba75('0x99')]=db['sequelize']['import'](_0xba75('0x9a'));db['AnalyticDefaultReport']=db[_0xba75('0x3')][_0xba75('0x14')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xba75('0x9b')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db['sequelize']['import']('../api/analyticMetric/analyticMetric.model');db[_0xba75('0x9c')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x9d'));db[_0xba75('0x9e')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x9f'));db[_0xba75('0xa0')]=db['sequelize']['import'](_0xba75('0xa1'));db[_0xba75('0xa2')]=db['sequelize'][_0xba75('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xba75('0xa3')]=db[_0xba75('0x3')]['import'](_0xba75('0xa4'));db['SugarcrmAccount']=db[_0xba75('0x3')][_0xba75('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xba75('0xa5')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xa6'));db[_0xba75('0xa7')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xa8'));db['DeskAccount']=db[_0xba75('0x3')][_0xba75('0x14')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db['sequelize'][_0xba75('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xba75('0xa9')]=db['sequelize'][_0xba75('0x14')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0xba75('0x3')]['import'](_0xba75('0xaa'));db['ZohoConfiguration']=db['sequelize'][_0xba75('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xba75('0xab')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xac'));db[_0xba75('0xad')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xae'));db['ZendeskConfiguration']=db[_0xba75('0x3')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xba75('0xaf')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xb0'));db[_0xba75('0xb1')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xb2'));db[_0xba75('0xb3')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xb4'));db[_0xba75('0xb5')]=db['sequelize']['import'](_0xba75('0xb6'));db['VtigerAccount']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xb7'));db[_0xba75('0xb8')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0xba75('0x3')]['import'](_0xba75('0xb9'));db[_0xba75('0xba')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xbb'));db['ServicenowConfiguration']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xbc'));db[_0xba75('0xbd')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xbe'));db[_0xba75('0xbf')]=db[_0xba75('0x3')]['import'](_0xba75('0xc0'));db[_0xba75('0xc1')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xc2'));db[_0xba75('0xc3')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xba75('0xc4')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xc5'));db[_0xba75('0xc6')]=db[_0xba75('0x3')]['import'](_0xba75('0xc7'));db['FreshsalesField']=db[_0xba75('0x3')]['import'](_0xba75('0xc8'));db[_0xba75('0xc9')]=db[_0xba75('0x3')]['import']('../api/integration/integration.model');db['Network']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xca'));db[_0xba75('0xcb')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xcc'));db[_0xba75('0xcd')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xce'));db[_0xba75('0xcf')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xd0'));db['JscriptyQuestionReport']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xd1'));db['JscriptySessionReport']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xd2'));db[_0xba75('0xd3')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xd4'));db['SquareReport']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xd5'));db[_0xba75('0xd6')]=db[_0xba75('0x3')]['import']('../api/squareReportDetail/squareReportDetail.model');db[_0xba75('0xd7')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xd8'));db[_0xba75('0xd9')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xda'));db[_0xba75('0xdb')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db['sequelize'][_0xba75('0x14')]('../api/squareProject/squareProject.model');db[_0xba75('0xdc')]=db['sequelize'][_0xba75('0x14')]('../api/squareRecording/squareRecording.model');db[_0xba75('0xdd')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xde'));db[_0xba75('0xdf')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xe0'));db['License']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xe1'));db[_0xba75('0xe2')]=db[_0xba75('0x3')]['import'](_0xba75('0xe3'));db[_0xba75('0xe4')]=db[_0xba75('0x3')]['import'](_0xba75('0xe5'));db['Attachment']=db['sequelize'][_0xba75('0x14')](_0xba75('0xe6'));db[_0xba75('0xe7')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xe8'));db[_0xba75('0xe9')]=db['sequelize'][_0xba75('0x14')]('../api/mailTransferReport/mailTransferReport.model');db[_0xba75('0xea')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xeb'));db[_0xba75('0xec')]=db[_0xba75('0x3')]['import'](_0xba75('0xed'));db[_0xba75('0xee')]=db[_0xba75('0x3')]['import'](_0xba75('0xef'));db[_0xba75('0xf0')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xf1'));db[_0xba75('0xf2')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xf3'));db[_0xba75('0xf4')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xf5'));db['UserProfile']=db[_0xba75('0x3')][_0xba75('0x14')]('../api/userProfile/userProfile.model');db[_0xba75('0xf6')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xf7'));db['UserProfileResource']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xf8'));db[_0xba75('0xf9')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xfa'));db['WhatsappAccount']=db['sequelize']['import'](_0xba75('0xfb'));db[_0xba75('0xfc')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xfd'));db[_0xba75('0xfe')]=db[_0xba75('0x3')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0xba75('0xff')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x100'));db[_0xba75('0x101')]=db['sequelize'][_0xba75('0x14')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xba75('0x102')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x103'));db[_0xba75('0x104')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x105'));db[_0xba75('0x106')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x107'));db[_0xba75('0x108')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x109'));db[_0xba75('0x10a')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x10b'));db['UserVoicePrefix']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x10c'));db[_0xba75('0x13')][_0xba75('0x10d')](db[_0xba75('0x1f')],{'as':'VoiceMail','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x13')][_0xba75('0x110')](db[_0xba75('0x1b')],{'as':'Recordings','foreignKey':'UserId'});db[_0xba75('0x13')][_0xba75('0x110')](db[_0xba75('0x2c')],{'as':_0xba75('0x111'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x13')][_0xba75('0x110')](db[_0xba75('0x18')],{'as':_0xba75('0x112'),'onDelete':_0xba75('0x10e'),'hooks':!![]});db[_0xba75('0x13')][_0xba75('0x110')](db['CmHopperFinal'],{'as':_0xba75('0x113'),'foreignKey':_0xba75('0x10f')});db['User'][_0xba75('0x110')](db['CmHopperHistory'],{'as':_0xba75('0x114'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x13')][_0xba75('0x110')](db['ReportAgentPreview'],{'as':_0xba75('0x115'),'foreignKey':'UserId'});db[_0xba75('0x13')][_0xba75('0x110')](db['OpenchannelInteraction'],{'as':_0xba75('0x116'),'foreignKey':'UserId'});db[_0xba75('0x13')][_0xba75('0x110')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xba75('0x10f')});db[_0xba75('0x13')][_0xba75('0x110')](db[_0xba75('0x5a')],{'as':_0xba75('0x117'),'foreignKey':'UserId'});db[_0xba75('0x13')][_0xba75('0x110')](db[_0xba75('0x118')],{'as':_0xba75('0x119'),'foreignKey':_0xba75('0x10f')});db['User'][_0xba75('0x110')](db['MailInteraction'],{'as':_0xba75('0x11a'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x13')][_0xba75('0x110')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0xba75('0x13')]['hasMany'](db[_0xba75('0xf9')],{'as':_0xba75('0x11b'),'foreignKey':_0xba75('0x11c')});db[_0xba75('0x13')]['belongsTo'](db[_0xba75('0x11d')],{'as':_0xba75('0x11d'),'foreignKey':'userProfileId'});db[_0xba75('0x13')][_0xba75('0x11e')](db[_0xba75('0x70')],{'as':_0xba75('0x11f'),'through':'chat_group_has_users'});db[_0xba75('0x13')]['belongsToMany'](db[_0xba75('0x74')],{'as':_0xba75('0x120'),'through':'cm_user_has_contacts'});db['User']['belongsToMany'](db['CmList'],{'as':_0xba75('0x121'),'through':'cm_user_has_lists'});db[_0xba75('0x13')][_0xba75('0x11e')](db[_0xba75('0xdf')],{'through':_0xba75('0x122')});db['User']['belongsToMany'](db[_0xba75('0x123')],{'as':'MailInteractions','through':_0xba75('0x124')});db['User'][_0xba75('0x11e')](db[_0xba75('0x6a')],{'as':_0xba75('0x125'),'through':_0xba75('0x126')});db[_0xba75('0x13')][_0xba75('0x11e')](db[_0xba75('0x118')],{'as':_0xba75('0x119'),'through':_0xba75('0x127')});db['User'][_0xba75('0x11e')](db[_0xba75('0x5a')],{'as':_0xba75('0x117'),'through':_0xba75('0x128')});db['User'][_0xba75('0x11e')](db[_0xba75('0x63')],{'as':_0xba75('0x116'),'through':'user_has_openchannel_interactions'});db[_0xba75('0x13')][_0xba75('0x11e')](db['WhatsappInteraction'],{'as':_0xba75('0x129'),'through':_0xba75('0x12a')});db['User']['belongsToMany'](db[_0xba75('0x1a')],{'as':_0xba75('0x12b'),'through':'UserVoiceQueue','required':![]});db[_0xba75('0x13')][_0xba75('0x11e')](db['VoicePrefix'],{'as':_0xba75('0x12c'),'through':_0xba75('0x12d'),'required':![]});db[_0xba75('0x13')][_0xba75('0x11e')](db[_0xba75('0x41')],{'as':_0xba75('0x12e'),'through':_0xba75('0x32'),'required':![]});db[_0xba75('0x13')]['belongsToMany'](db[_0xba75('0x6e')],{'as':_0xba75('0x12f'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0xba75('0x11e')](db['FaxQueue'],{'as':_0xba75('0x130'),'through':'UserFaxQueue','required':![]});db[_0xba75('0x13')][_0xba75('0x11e')](db[_0xba75('0x5d')],{'as':_0xba75('0x131'),'through':_0xba75('0x36'),'required':![]});db['User'][_0xba75('0x11e')](db[_0xba75('0x132')],{'as':_0xba75('0x133'),'through':_0xba75('0x38'),'required':![]});db[_0xba75('0x13')]['belongsToMany'](db[_0xba75('0x104')],{'as':_0xba75('0x134'),'through':_0xba75('0x3a'),'required':![]});db[_0xba75('0x13')]['belongsToMany'](db[_0xba75('0xf2')],{'through':'cm_user_has_lists'});db['User'][_0xba75('0x11e')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0xba75('0x135')});db[_0xba75('0x13')][_0xba75('0x11e')](db['FaxAccount'],{'as':_0xba75('0x136'),'through':'user_has_fax_accounts'});db[_0xba75('0x13')][_0xba75('0x11e')](db['MailAccount'],{'as':'MailAccounts','through':_0xba75('0x137')});db['User'][_0xba75('0x11e')](db[_0xba75('0x5f')],{'as':_0xba75('0x138'),'through':'user_has_openchannel_accounts'});db[_0xba75('0x13')]['belongsToMany'](db[_0xba75('0x56')],{'as':'SmsAccounts','through':_0xba75('0x139')});db['User'][_0xba75('0x11e')](db[_0xba75('0x13a')],{'as':_0xba75('0x13b'),'through':_0xba75('0x13c')});db[_0xba75('0x13')][_0xba75('0x11e')](db['SquareProject'],{'as':'SquareProjects','through':_0xba75('0x13d')});db[_0xba75('0x13e')][_0xba75('0x110')](db[_0xba75('0x18')],{'as':_0xba75('0x13f'),'onDelete':'cascade','foreignKey':_0xba75('0x140')});db[_0xba75('0x141')][_0xba75('0x110')](db[_0xba75('0x18')],{'onDelete':'cascade'});db['VoiceExtension'][_0xba75('0x110')](db[_0xba75('0x18')],{'as':_0xba75('0x142'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x19')][_0xba75('0x11e')](db[_0xba75('0x143')],{'as':_0xba75('0x144'),'through':_0xba75('0x145')});db['VoiceQueue'][_0xba75('0x110')](db['UserVoiceQueueRt'],{'as':_0xba75('0x146'),'foreignKey':_0xba75('0x147')});db[_0xba75('0x1a')][_0xba75('0x110')](db['CmHopper'],{'as':_0xba75('0x148'),'foreignKey':_0xba75('0x147')});db[_0xba75('0x1a')]['hasMany'](db[_0xba75('0x79')],{'as':_0xba75('0x113'),'foreignKey':_0xba75('0x147')});db[_0xba75('0x1a')][_0xba75('0x110')](db[_0xba75('0x7b')],{'as':_0xba75('0x149'),'foreignKey':_0xba75('0x147')});db[_0xba75('0x1a')][_0xba75('0x110')](db['ReportAgentPreview'],{'as':_0xba75('0x115'),'foreignKey':_0xba75('0x147')});db[_0xba75('0x1a')][_0xba75('0x110')](db[_0xba75('0x78')],{'as':'HopperBlacks','foreignKey':_0xba75('0x147')});db['VoiceQueue'][_0xba75('0x110')](db['JscriptySessionReport'],{'as':_0xba75('0x14a'),'foreignKey':_0xba75('0x147')});db[_0xba75('0x1a')][_0xba75('0x14b')](db[_0xba75('0x29')],{'as':'Trunk','foreignKey':_0xba75('0x14c')});db[_0xba75('0x1a')][_0xba75('0x14b')](db['Trunk'],{'as':_0xba75('0x14d'),'foreignKey':_0xba75('0x14e')});db[_0xba75('0x1a')][_0xba75('0x14b')](db['Interval'],{'as':_0xba75('0x87'),'foreignKey':_0xba75('0x14f')});db['VoiceQueue'][_0xba75('0x14b')](db['Pause'],{'as':_0xba75('0x150'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xba75('0x1a')]['belongsToMany'](db[_0xba75('0xf2')],{'as':'Lists','through':_0xba75('0x151')});db[_0xba75('0x1a')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':'Agents','through':'UserVoiceQueue'});db[_0xba75('0x1a')][_0xba75('0x11e')](db[_0xba75('0xdf')],{'as':'Teams','through':_0xba75('0x108')});db[_0xba75('0x1a')]['belongsToMany'](db[_0xba75('0xf2')],{'as':'BlackLists','through':_0xba75('0x152')});db['VoiceRecording'][_0xba75('0x14b')](db[_0xba75('0x13')],{'as':_0xba75('0x13'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x1d')][_0xba75('0x14b')](db['User'],{'as':_0xba75('0x13'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x1f')]['hasMany'](db[_0xba75('0x153')],{'as':_0xba75('0x154'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x155'),'sourceKey':_0xba75('0x156')});db['VoiceMailMessage'][_0xba75('0x14b')](db[_0xba75('0x1f')],{'foreignKey':_0xba75('0x155'),'targetKey':_0xba75('0x156')});db[_0xba75('0x22')]['hasMany'](db['VoiceQueueReport'],{'as':_0xba75('0x157'),'foreignKey':'uniqueid','constraints':![]});db[_0xba75('0x22')][_0xba75('0x110')](db[_0xba75('0x158')],{'as':_0xba75('0x159'),'foreignKey':_0xba75('0x15a'),'constraints':![]});db[_0xba75('0x22')]['belongsTo'](db[_0xba75('0x13')],{'as':_0xba75('0x13'),'foreignKey':'UserId'});db[_0xba75('0x22')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x3c')][_0xba75('0x14b')](db[_0xba75('0x15d')],{'as':_0xba75('0x15d'),'foreignKey':_0xba75('0x15e')});db[_0xba75('0x3e')]['belongsTo'](db[_0xba75('0x15d')],{'as':'MailAccount','foreignKey':_0xba75('0x15e')});db[_0xba75('0x15d')]['hasOne'](db[_0xba75('0x3c')],{'as':_0xba75('0x15f'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x15d')][_0xba75('0x10d')](db['MailServerOut'],{'as':_0xba75('0x160'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x15d')][_0xba75('0x110')](db[_0xba75('0x84')],{'as':_0xba75('0x161'),'foreignKey':_0xba75('0x15e'),'onDelete':_0xba75('0x10e')});db['MailAccount'][_0xba75('0x110')](db[_0xba75('0x82')],{'as':_0xba75('0x162'),'foreignKey':_0xba75('0x15e')});db[_0xba75('0x15d')]['hasMany'](db[_0xba75('0x46')],{'as':_0xba75('0x154'),'foreignKey':'MailAccountId'});db[_0xba75('0x15d')][_0xba75('0x110')](db['MailInteraction'],{'as':_0xba75('0x163')});db[_0xba75('0x15d')]['hasMany'](db[_0xba75('0x164')],{'as':'Applications'});db[_0xba75('0x15d')][_0xba75('0x14b')](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':'ListId'});db['MailAccount'][_0xba75('0x14b')](db[_0xba75('0x91')],{'as':_0xba75('0x91'),'foreignKey':'TemplateId'});db[_0xba75('0x15d')][_0xba75('0x14b')](db[_0xba75('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0xba75('0x166')});db[_0xba75('0x15d')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':'Agents','through':_0xba75('0x137')});db['MailQueue']['belongsToMany'](db[_0xba75('0x13')],{'as':'Agents','through':_0xba75('0x32')});db[_0xba75('0x41')][_0xba75('0x11e')](db[_0xba75('0xdf')],{'through':'team_has_mail_queues','as':_0xba75('0x167')});db[_0xba75('0x123')]['hasMany'](db[_0xba75('0x46')],{'as':_0xba75('0x154'),'onDelete':'cascade','foreignKey':_0xba75('0x168')});db[_0xba75('0x123')][_0xba75('0x14b')](db[_0xba75('0x15d')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x15e')});db[_0xba75('0x123')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x123')][_0xba75('0x14b')](db[_0xba75('0x13')],{'as':_0xba75('0x16a'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x123')]['belongsToMany'](db[_0xba75('0x16b')],{'through':_0xba75('0x16c'),'as':_0xba75('0x16d')});db['MailInteraction'][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x16c'),'as':_0xba75('0x16e')});db[_0xba75('0x123')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x16f'),'through':'user_has_mail_interactions','foreignKey':_0xba75('0x168')});db[_0xba75('0x46')][_0xba75('0x110')](db[_0xba75('0x170')],{'as':_0xba75('0x171'),'onDelete':'cascade'});db[_0xba75('0x46')][_0xba75('0x14b')](db[_0xba75('0x13')],{'as':_0xba75('0x13')});db[_0xba75('0x46')]['belongsTo'](db[_0xba75('0x74')],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x15b')});db[_0xba75('0x46')]['belongsTo'](db['MailInteraction'],{'as':_0xba75('0x172'),'foreignKey':_0xba75('0x168')});db[_0xba75('0x46')][_0xba75('0x14b')](db[_0xba75('0x15d')],{'as':'Account','foreignKey':'MailAccountId'});db[_0xba75('0x46')][_0xba75('0x14b')](db[_0xba75('0x66')],{'as':'ChatWebsite','foreignKey':_0xba75('0x173')});db[_0xba75('0x46')][_0xba75('0x14b')](db[_0xba75('0x6d')],{'as':_0xba75('0x6d'),'foreignKey':_0xba75('0x174')});db['MailApplication'][_0xba75('0x14b')](db[_0xba75('0x13')],{'onDelete':_0xba75('0x175')});db[_0xba75('0x164')][_0xba75('0x14b')](db['MailQueue'],{'onDelete':_0xba75('0x175')});db['MailApplication']['belongsTo'](db[_0xba75('0x15d')],{'onDelete':_0xba75('0x175')});db[_0xba75('0x164')]['belongsTo'](db['Interval'],{'onDelete':_0xba75('0x175'),'foreignKey':_0xba75('0x14f')});db[_0xba75('0x164')][_0xba75('0x14b')](db[_0xba75('0x16b')],{'onDelete':_0xba75('0x175'),'foreignKey':_0xba75('0x176')});db[_0xba75('0x177')][_0xba75('0x14b')](db[_0xba75('0x15d')],{});db[_0xba75('0x177')][_0xba75('0x14b')](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db['MailQueueReport'][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x177')][_0xba75('0x14b')](db[_0xba75('0x123')],{});db[_0xba75('0x177')][_0xba75('0x14b')](db[_0xba75('0x46')],{});db['MailQueueReport']['belongsTo'](db[_0xba75('0x13')],{});db[_0xba75('0x177')][_0xba75('0x14b')](db[_0xba75('0x41')],{});db[_0xba75('0x4a')][_0xba75('0x110')](db[_0xba75('0x4c')],{'as':_0xba75('0x179'),'onDelete':'cascade'});db[_0xba75('0x4e')][_0xba75('0x110')](db[_0xba75('0x84')],{'as':_0xba75('0x161'),'foreignKey':'FaxAccountId','onDelete':_0xba75('0x10e')});db['FaxAccount'][_0xba75('0x110')](db[_0xba75('0x82')],{'as':_0xba75('0x162'),'foreignKey':_0xba75('0x17a')});db[_0xba75('0x4e')][_0xba75('0x110')](db[_0xba75('0x118')],{'as':_0xba75('0x163')});db[_0xba75('0x4e')][_0xba75('0x110')](db[_0xba75('0x50')],{'as':_0xba75('0x142')});db[_0xba75('0x4e')][_0xba75('0x110')](db[_0xba75('0x18')],{'as':_0xba75('0x17b'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x4e')][_0xba75('0x110')](db[_0xba75('0x52')],{'as':_0xba75('0x154')});db[_0xba75('0x4e')][_0xba75('0x14b')](db['Trunk'],{'as':_0xba75('0x29')});db[_0xba75('0x4e')][_0xba75('0x14b')](db['CmList'],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x4e')][_0xba75('0x14b')](db[_0xba75('0x89')],{'as':_0xba75('0x150'),'foreignKey':_0xba75('0x166')});db[_0xba75('0x4e')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x17d')});db[_0xba75('0x50')][_0xba75('0x14b')](db['User'],{'onDelete':'restrict'});db[_0xba75('0x50')][_0xba75('0x14b')](db[_0xba75('0x17e')],{'onDelete':_0xba75('0x175')});db['FaxApplication'][_0xba75('0x14b')](db[_0xba75('0x4e')],{'onDelete':_0xba75('0x175')});db[_0xba75('0x50')][_0xba75('0x14b')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xba75('0x176')});db['FaxInteraction']['hasMany'](db['FaxMessage'],{'as':_0xba75('0x154'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x17f')});db[_0xba75('0x118')][_0xba75('0x14b')](db[_0xba75('0x4e')],{'as':_0xba75('0x169'),'foreignKey':'FaxAccountId'});db[_0xba75('0x118')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x118')]['belongsTo'](db[_0xba75('0x13')],{'as':_0xba75('0x16a'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x118')][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x180'),'as':_0xba75('0x16d')});db['FaxInteraction'][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x180'),'as':_0xba75('0x16e')});db[_0xba75('0x118')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':'Users','through':_0xba75('0x127'),'foreignKey':_0xba75('0x17f')});db[_0xba75('0x52')][_0xba75('0x14b')](db[_0xba75('0x13')],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x13')});db[_0xba75('0x52')][_0xba75('0x14b')](db['FaxInteraction'],{'as':_0xba75('0x172'),'foreignKey':_0xba75('0x17f')});db['FaxMessage'][_0xba75('0x14b')](db[_0xba75('0x74')],{'onDelete':'cascade','as':'Contact'});db['FaxMessage']['belongsTo'](db[_0xba75('0x170')],{'as':_0xba75('0x170'),'foreignKey':'AttachmentId'});db[_0xba75('0x52')][_0xba75('0x14b')](db[_0xba75('0x4e')],{'as':'Account','foreignKey':_0xba75('0x17a')});db['FaxQueue']['belongsToMany'](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x34')});db['FaxQueue'][_0xba75('0x11e')](db[_0xba75('0xdf')],{'through':'team_has_fax_queues','as':'Teams'});db[_0xba75('0x54')][_0xba75('0x14b')](db['FaxAccount'],{});db[_0xba75('0x54')]['belongsTo'](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x54')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x54')][_0xba75('0x14b')](db[_0xba75('0x118')],{});db[_0xba75('0x54')]['belongsTo'](db[_0xba75('0x52')],{});db['FaxQueueReport'][_0xba75('0x14b')](db['User'],{});db[_0xba75('0x54')][_0xba75('0x14b')](db['FaxQueue'],{});db[_0xba75('0x56')][_0xba75('0x110')](db[_0xba75('0x84')],{'as':_0xba75('0x161'),'foreignKey':_0xba75('0x181'),'onDelete':'cascade'});db['SmsAccount']['hasMany'](db[_0xba75('0x82')],{'as':_0xba75('0x162'),'foreignKey':_0xba75('0x181')});db[_0xba75('0x56')][_0xba75('0x110')](db[_0xba75('0x5b')],{'as':_0xba75('0x154'),'foreignKey':_0xba75('0x181')});db[_0xba75('0x56')]['hasMany'](db['SmsInteraction'],{'as':_0xba75('0x163')});db[_0xba75('0x56')]['hasMany'](db[_0xba75('0x58')],{'as':_0xba75('0x142')});db['SmsAccount'][_0xba75('0x14b')](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x56')][_0xba75('0x14b')](db[_0xba75('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0xba75('0x166')});db['SmsAccount']['belongsToMany'](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x139')});db[_0xba75('0x58')]['belongsTo'](db[_0xba75('0x13')],{'onDelete':_0xba75('0x175')});db[_0xba75('0x58')][_0xba75('0x14b')](db[_0xba75('0x5d')],{'onDelete':_0xba75('0x175')});db[_0xba75('0x58')][_0xba75('0x14b')](db[_0xba75('0x56')],{'onDelete':_0xba75('0x175')});db[_0xba75('0x58')]['belongsTo'](db[_0xba75('0x87')],{'onDelete':_0xba75('0x175'),'foreignKey':'IntervalId'});db[_0xba75('0x58')][_0xba75('0x14b')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xba75('0x176')});db[_0xba75('0x5a')][_0xba75('0x110')](db[_0xba75('0x5b')],{'as':_0xba75('0x154'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x182')});db[_0xba75('0x5a')][_0xba75('0x14b')](db['SmsAccount'],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x181')});db[_0xba75('0x5a')]['belongsTo'](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':'ContactId'});db['SmsInteraction']['belongsTo'](db['User'],{'as':_0xba75('0x16a'),'foreignKey':_0xba75('0x10f')});db['SmsInteraction'][_0xba75('0x11e')](db['Tag'],{'through':'sms_interaction_has_tags','as':'Tags'});db['SmsInteraction']['belongsToMany'](db[_0xba75('0x16b')],{'through':_0xba75('0x183'),'as':'ThroughTags'});db[_0xba75('0x5a')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x16f'),'through':_0xba75('0x128'),'foreignKey':_0xba75('0x182')});db[_0xba75('0x5b')][_0xba75('0x14b')](db[_0xba75('0x13')],{'as':'User'});db['SmsMessage'][_0xba75('0x14b')](db[_0xba75('0x74')],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x15b')});db[_0xba75('0x5b')][_0xba75('0x14b')](db[_0xba75('0x5a')],{'onDelete':'cascade','as':_0xba75('0x172'),'foreignKey':'SmsInteractionId'});db[_0xba75('0x5b')][_0xba75('0x14b')](db[_0xba75('0x56')],{'as':_0xba75('0x169'),'foreignKey':'SmsAccountId'});db[_0xba75('0x5d')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':'Agents','through':_0xba75('0x36'),'foreignKey':_0xba75('0x184')});db['SmsQueue'][_0xba75('0x11e')](db[_0xba75('0xdf')],{'through':'team_has_sms_queues','as':'Teams'});db[_0xba75('0x5f')][_0xba75('0x110')](db[_0xba75('0x84')],{'as':_0xba75('0x161'),'foreignKey':'OpenchannelAccountId','onDelete':_0xba75('0x10e')});db[_0xba75('0x5f')][_0xba75('0x110')](db[_0xba75('0x82')],{'as':_0xba75('0x162'),'foreignKey':_0xba75('0x185')});db['OpenchannelAccount'][_0xba75('0x110')](db[_0xba75('0x63')],{'as':_0xba75('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0xba75('0x5f')][_0xba75('0x110')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0xba75('0x185')});db[_0xba75('0x5f')][_0xba75('0x110')](db[_0xba75('0x61')],{'as':_0xba75('0x142'),'foreignKey':_0xba75('0x185')});db[_0xba75('0x5f')][_0xba75('0x14b')](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x5f')]['belongsTo'](db[_0xba75('0x89')],{'as':_0xba75('0x150'),'foreignKey':_0xba75('0x166')});db[_0xba75('0x5f')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':'user_has_openchannel_accounts'});db[_0xba75('0x61')]['belongsTo'](db[_0xba75('0x13')],{'onDelete':_0xba75('0x175')});db[_0xba75('0x61')][_0xba75('0x14b')](db['OpenchannelQueue'],{'onDelete':_0xba75('0x175'),'foreignKey':'OpenchannelQueueId'});db[_0xba75('0x61')][_0xba75('0x14b')](db[_0xba75('0x5f')],{'onDelete':'restrict','foreignKey':_0xba75('0x185')});db['OpenchannelApplication'][_0xba75('0x14b')](db[_0xba75('0x87')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xba75('0x61')][_0xba75('0x14b')](db[_0xba75('0x16b')],{'onDelete':_0xba75('0x175'),'foreignKey':_0xba75('0x176')});db[_0xba75('0x63')][_0xba75('0x110')](db[_0xba75('0x186')],{'as':_0xba75('0x154'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x187')});db['OpenchannelInteraction'][_0xba75('0x14b')](db[_0xba75('0x5f')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x185')});db[_0xba75('0x63')][_0xba75('0x14b')](db['CmContact'],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db['OpenchannelInteraction'][_0xba75('0x14b')](db[_0xba75('0x13')],{'as':_0xba75('0x16a'),'foreignKey':_0xba75('0x10f')});db['OpenchannelInteraction'][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x188'),'as':'Tags'});db['OpenchannelInteraction'][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x188'),'as':_0xba75('0x16e')});db[_0xba75('0x63')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x16f'),'through':_0xba75('0x189'),'foreignKey':_0xba75('0x187')});db[_0xba75('0x186')][_0xba75('0x14b')](db[_0xba75('0x13')],{'onDelete':'cascade','as':'User'});db[_0xba75('0x186')]['belongsTo'](db['CmContact'],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x15b')});db['OpenchannelMessage'][_0xba75('0x14b')](db[_0xba75('0x63')],{'onDelete':_0xba75('0x10e'),'as':'Interaction','foreignKey':_0xba75('0x187')});db[_0xba75('0x186')][_0xba75('0x14b')](db['Attachment'],{'as':_0xba75('0x170'),'foreignKey':_0xba75('0x18a')});db['OpenchannelMessage'][_0xba75('0x14b')](db[_0xba75('0x5f')],{'as':'Account','foreignKey':_0xba75('0x185')});db['OpenchannelQueue'][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x38'),'foreignKey':_0xba75('0x18b')});db['OpenchannelQueue'][_0xba75('0x11e')](db[_0xba75('0xdf')],{'through':_0xba75('0x18c'),'as':_0xba75('0x167')});db['ChatWebsite'][_0xba75('0x110')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xba75('0x173'),'onDelete':'cascade'});db['ChatWebsite'][_0xba75('0x110')](db['CannedAnswer'],{'as':_0xba75('0x162'),'foreignKey':_0xba75('0x173')});db[_0xba75('0x66')][_0xba75('0x110')](db[_0xba75('0x18d')],{'as':'ProactiveActions'});db[_0xba75('0x66')][_0xba75('0x110')](db['ChatInteraction'],{'as':_0xba75('0x163')});db[_0xba75('0x66')][_0xba75('0x110')](db[_0xba75('0x68')],{'as':_0xba75('0x142')});db[_0xba75('0x66')]['hasMany'](db['ChatMessage'],{'as':_0xba75('0x154')});db[_0xba75('0x66')][_0xba75('0x14b')](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x66')][_0xba75('0x14b')](db[_0xba75('0x87')],{'as':'Interval','foreignKey':_0xba75('0x14f')});db['ChatWebsite'][_0xba75('0x14b')](db[_0xba75('0x15d')],{'as':'MailAccount','foreignKey':_0xba75('0x15e')});db['ChatWebsite'][_0xba75('0x14b')](db[_0xba75('0x89')],{'as':_0xba75('0x150'),'foreignKey':_0xba75('0x166')});db[_0xba75('0x66')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x135')});db[_0xba75('0x18e')][_0xba75('0x14b')](db[_0xba75('0x5f')],{});db[_0xba75('0x18e')][_0xba75('0x14b')](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x18e')][_0xba75('0x14b')](db['CmContact'],{'as':'Contact','foreignKey':_0xba75('0x15c')});db[_0xba75('0x18e')]['belongsTo'](db[_0xba75('0x63')],{});db[_0xba75('0x18e')]['belongsTo'](db[_0xba75('0x186')],{});db[_0xba75('0x18e')][_0xba75('0x14b')](db[_0xba75('0x13')],{});db[_0xba75('0x18e')][_0xba75('0x14b')](db[_0xba75('0x132')],{});db[_0xba75('0x68')][_0xba75('0x14b')](db['User'],{'as':_0xba75('0x18f'),'foreignKey':_0xba75('0x10f'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0xba75('0x6e')],{'as':_0xba75('0x190'),'foreignKey':_0xba75('0x191'),'onDelete':'restrict'});db['ChatApplication'][_0xba75('0x14b')](db[_0xba75('0x66')],{'as':'Website','foreignKey':_0xba75('0x173'),'onDelete':'restrict'});db[_0xba75('0x68')]['belongsTo'](db[_0xba75('0x16b')],{'onDelete':_0xba75('0x175'),'foreignKey':_0xba75('0x176')});db['ChatInteraction'][_0xba75('0x110')](db[_0xba75('0x192')],{'as':_0xba75('0x154'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x193')});db[_0xba75('0x6a')][_0xba75('0x14b')](db[_0xba75('0x66')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x173')});db[_0xba75('0x6a')][_0xba75('0x14b')](db['CmContact'],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x6a')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xba75('0x10f')});db['ChatInteraction'][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0xba75('0x6a')][_0xba75('0x11e')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0xba75('0x16e')});db[_0xba75('0x6a')]['belongsToMany'](db[_0xba75('0x13')],{'as':'Users','through':_0xba75('0x126'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xba75('0x14b')](db[_0xba75('0x13')],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x13')});db[_0xba75('0x192')][_0xba75('0x14b')](db['CmContact'],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x15b'),'foreignKey':'ContactId'});db[_0xba75('0x192')]['belongsTo'](db['ChatInteraction'],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x172'),'foreignKey':_0xba75('0x193')});db['ChatMessage'][_0xba75('0x14b')](db[_0xba75('0x170')],{'as':_0xba75('0x170'),'foreignKey':_0xba75('0x18a')});db[_0xba75('0x192')][_0xba75('0x14b')](db[_0xba75('0x66')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x173')});db[_0xba75('0x6d')][_0xba75('0x110')](db[_0xba75('0x170')],{'as':'Attachments','foreignKey':_0xba75('0x174'),'onDelete':_0xba75('0x10e'),'hooks':!![]});db[_0xba75('0x6d')][_0xba75('0x14b')](db[_0xba75('0x74')],{'onDelete':'cascade','as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x6d')][_0xba75('0x14b')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xba75('0x173')});db[_0xba75('0x6e')]['belongsToMany'](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x30'),'hooks':!![]});db['ChatQueue'][_0xba75('0x11e')](db[_0xba75('0xdf')],{'through':'team_has_chat_queues','as':'Teams'});db[_0xba75('0x70')][_0xba75('0x110')](db[_0xba75('0xcd')],{'as':'Messages','foreignKey':_0xba75('0x194'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x70')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x146'),'through':_0xba75('0x195')});db[_0xba75('0x18d')]['belongsTo'](db[_0xba75('0x66')],{'as':'Website','foreignKey':_0xba75('0x173')});db['CmCompany'][_0xba75('0x110')](db[_0xba75('0x74')],{'as':_0xba75('0x120'),'foreignKey':_0xba75('0x196')});db[_0xba75('0x74')]['hasMany'](db[_0xba75('0x76')],{'as':_0xba75('0x148'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x74')][_0xba75('0x110')](db[_0xba75('0x79')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0xba75('0x74')][_0xba75('0x110')](db['CmHopperHistory'],{'as':_0xba75('0x149'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x74')]['hasMany'](db[_0xba75('0x115')],{'as':_0xba75('0x115'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x74')]['hasMany'](db[_0xba75('0x197')],{'as':_0xba75('0x14a'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x74')][_0xba75('0x110')](db[_0xba75('0x63')],{'as':'OpenchannelInteractions','foreignKey':_0xba75('0x15c'),'onDelete':_0xba75('0x175')});db[_0xba75('0x74')]['hasMany'](db[_0xba75('0x6a')],{'as':_0xba75('0x125'),'foreignKey':_0xba75('0x15c'),'onDelete':_0xba75('0x175')});db[_0xba75('0x74')]['hasMany'](db[_0xba75('0x5a')],{'as':_0xba75('0x117'),'foreignKey':'ContactId','onDelete':_0xba75('0x175')});db[_0xba75('0x74')][_0xba75('0x110')](db[_0xba75('0x118')],{'as':'FaxInteractions','foreignKey':_0xba75('0x15c'),'onDelete':_0xba75('0x175')});db['CmContact'][_0xba75('0x110')](db['MailInteraction'],{'as':_0xba75('0x11a'),'foreignKey':_0xba75('0x15c'),'onDelete':_0xba75('0x175')});db[_0xba75('0x74')][_0xba75('0x14b')](db[_0xba75('0x72')],{'as':_0xba75('0x198'),'foreignKey':_0xba75('0x196')});db[_0xba75('0x74')]['belongsTo'](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':'ListId','onDelete':_0xba75('0x10e')});db[_0xba75('0x74')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x16f'),'through':_0xba75('0x199')});db[_0xba75('0x74')][_0xba75('0x11e')](db[_0xba75('0x16b')],{'as':'Tags','through':_0xba75('0x19a')});db[_0xba75('0x74')][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x19a'),'as':_0xba75('0x16e')});db[_0xba75('0x76')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':'Contact','foreignKey':_0xba75('0x15c'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x76')]['belongsTo'](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x76')]['belongsTo'](db['User'],{'as':'Agent','foreignKey':_0xba75('0x10f')});db['CmHopper'][_0xba75('0x14b')](db[_0xba75('0x1a')],{'as':_0xba75('0x190'),'foreignKey':'VoiceQueueId','onDelete':_0xba75('0x10e')});db['CmHopper'][_0xba75('0x14b')](db[_0xba75('0xe2')],{'as':_0xba75('0xe2'),'foreignKey':'CampaignId','onDelete':_0xba75('0x10e')});db[_0xba75('0x76')][_0xba75('0x14b')](db[_0xba75('0x13')],{'as':_0xba75('0x16a'),'foreignKey':'OwnerId'});db[_0xba75('0x78')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c'),'onDelete':_0xba75('0x10e')});db['CmHopperBlack'][_0xba75('0x14b')](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178'),'onDelete':'cascade'});db[_0xba75('0x78')][_0xba75('0x14b')](db[_0xba75('0x1a')],{'as':_0xba75('0x190'),'foreignKey':'VoiceQueueId','onDelete':_0xba75('0x10e')});db[_0xba75('0x78')]['belongsTo'](db['Campaign'],{'as':_0xba75('0xe2'),'foreignKey':'CampaignId','onDelete':_0xba75('0x10e')});db['Automation'][_0xba75('0x110')](db[_0xba75('0x19b')],{'as':{'plural':_0xba75('0x19c'),'singular':_0xba75('0x19d')},'foreignKey':_0xba75('0x19e'),'onDelete':_0xba75('0x10e'),'hooks':!![]});db[_0xba75('0x80')]['hasMany'](db[_0xba75('0x19b')],{'as':{'plural':_0xba75('0x19f'),'singular':_0xba75('0x1a0')},'foreignKey':'AutomationAnyId','onDelete':_0xba75('0x10e'),'hooks':!![]});db[_0xba75('0x80')]['hasMany'](db[_0xba75('0x1a1')],{'as':_0xba75('0x1a2'),'foreignKey':_0xba75('0x1a3'),'onDelete':_0xba75('0x10e'),'hooks':!![]});db[_0xba75('0x84')][_0xba75('0x110')](db[_0xba75('0x84')],{'as':_0xba75('0x161'),'foreignKey':'ParentId','onDelete':'cascade'});db['Interval'][_0xba75('0x110')](db[_0xba75('0x87')],{'as':'Intervals','foreignKey':_0xba75('0x14f'),'onDelete':_0xba75('0x10e'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0xba75('0x18')],{'as':'Extensions','foreignKey':_0xba75('0x14f'),'onDelete':_0xba75('0x175')});db[_0xba75('0x87')][_0xba75('0x110')](db[_0xba75('0x164')],{'as':_0xba75('0x1a4'),'foreignKey':_0xba75('0x14f')});db[_0xba75('0x87')][_0xba75('0x110')](db[_0xba75('0x68')],{'as':_0xba75('0x1a5'),'foreignKey':_0xba75('0x14f')});db[_0xba75('0x87')][_0xba75('0x110')](db['FaxApplication'],{'as':_0xba75('0x1a6'),'foreignKey':_0xba75('0x14f')});db[_0xba75('0x87')][_0xba75('0x110')](db[_0xba75('0x58')],{'as':'SmsApplications','foreignKey':_0xba75('0x14f')});db[_0xba75('0x8e')][_0xba75('0x14b')](db[_0xba75('0x15d')],{});db[_0xba75('0x8e')][_0xba75('0x14b')](db[_0xba75('0x1a7')],{'foreignKey':'DefaultReportId'});db[_0xba75('0x8e')]['belongsTo'](db[_0xba75('0x99')],{'foreignKey':'CustomReportId'});db[_0xba75('0x143')]['belongsToMany'](db[_0xba75('0x19')],{'as':_0xba75('0x1a8'),'through':_0xba75('0x145'),'onDelete':_0xba75('0x175')});db[_0xba75('0x16b')][_0xba75('0x11e')](db[_0xba75('0x74')],{'through':_0xba75('0x19a')});db[_0xba75('0x16b')]['belongsToMany'](db['ChatInteraction'],{'through':_0xba75('0x1a9')});db[_0xba75('0x16b')][_0xba75('0x11e')](db[_0xba75('0x123')],{'through':_0xba75('0x16c')});db['Tag'][_0xba75('0x11e')](db[_0xba75('0x5a')],{'through':_0xba75('0x183')});db['Tag']['belongsToMany'](db[_0xba75('0x118')],{'through':_0xba75('0x180')});db[_0xba75('0x16b')][_0xba75('0x11e')](db[_0xba75('0x63')],{'through':'openchannel_interaction_has_tags'});db[_0xba75('0x16b')][_0xba75('0x11e')](db[_0xba75('0xfe')],{'through':_0xba75('0x1aa')});db['Trigger']['hasMany'](db[_0xba75('0x19b')],{'as':{'plural':_0xba75('0x1ab'),'singular':_0xba75('0x1ac')},'foreignKey':_0xba75('0x1ad'),'onDelete':_0xba75('0x10e'),'hooks':!![]});db[_0xba75('0x92')][_0xba75('0x110')](db[_0xba75('0x19b')],{'as':{'plural':_0xba75('0x1ae'),'singular':'AnyCondition'},'foreignKey':_0xba75('0x1af'),'onDelete':_0xba75('0x10e'),'hooks':!![]});db['Trigger']['hasMany'](db['Action'],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0xba75('0x10e'),'hooks':!![]});db[_0xba75('0x99')][_0xba75('0x110')](db[_0xba75('0x9c')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xba75('0x1b0'),'hooks':!![]});db[_0xba75('0x1a7')][_0xba75('0x110')](db[_0xba75('0x9c')],{'as':_0xba75('0x1b1'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b2')});db[_0xba75('0x1b3')][_0xba75('0x110')](db['AnalyticFieldReport'],{'as':_0xba75('0x1b1'),'onDelete':'cascade','foreignKey':_0xba75('0x1b4')});db[_0xba75('0x9c')]['belongsTo'](db[_0xba75('0x1b3')],{'foreignKey':_0xba75('0x1b4')});db[_0xba75('0xa0')][_0xba75('0x110')](db[_0xba75('0xa2')],{'as':'Configurations','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b5')});db[_0xba75('0xa2')][_0xba75('0x110')](db[_0xba75('0xa3')],{'as':_0xba75('0x1b6'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b7')});db['SalesforceConfiguration']['hasMany'](db[_0xba75('0xa3')],{'as':_0xba75('0x1b8'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0xba75('0x110')](db[_0xba75('0xa3')],{'as':_0xba75('0x1b1'),'onDelete':'cascade','foreignKey':_0xba75('0x1b9')});db[_0xba75('0xa2')]['belongsTo'](db[_0xba75('0xa0')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x1b5')});db['SalesforceField'][_0xba75('0x110')](db[_0xba75('0xa3')],{'as':_0xba75('0x1ba'),'foreignKey':_0xba75('0x1b7')});db[_0xba75('0xa3')][_0xba75('0x110')](db['SalesforceField'],{'as':_0xba75('0x1bb'),'foreignKey':'DescriptionId'});db[_0xba75('0xa3')][_0xba75('0x110')](db[_0xba75('0xa3')],{'as':_0xba75('0x1bc'),'foreignKey':_0xba75('0x1b9')});db[_0xba75('0xa3')][_0xba75('0x14b')](db[_0xba75('0x94')],{'as':_0xba75('0x94'),'foreignKey':'VariableId'});db[_0xba75('0x1bd')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0xba75('0x1be'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b5')});db[_0xba75('0xa5')]['hasMany'](db[_0xba75('0xa7')],{'as':_0xba75('0x1b6'),'onDelete':'cascade','foreignKey':_0xba75('0x1b7')});db[_0xba75('0xa5')][_0xba75('0x110')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0xa5')][_0xba75('0x110')](db[_0xba75('0xa7')],{'as':'Fields','onDelete':_0xba75('0x10e'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0xba75('0x14b')](db[_0xba75('0x1bd')],{'as':'Account','foreignKey':_0xba75('0x1b5')});db[_0xba75('0xa7')]['hasMany'](db['SugarcrmField'],{'as':_0xba75('0x1ba'),'foreignKey':_0xba75('0x1b7')});db['SugarcrmField'][_0xba75('0x110')](db[_0xba75('0xa7')],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0xa7')][_0xba75('0x110')](db[_0xba75('0xa7')],{'as':_0xba75('0x1bc'),'foreignKey':_0xba75('0x1b9')});db[_0xba75('0xa7')][_0xba75('0x14b')](db['Variable'],{'as':'Variable','foreignKey':_0xba75('0x1c0')});db[_0xba75('0x1c1')]['hasMany'](db[_0xba75('0x1c2')],{'as':_0xba75('0x1be'),'onDelete':_0xba75('0x10e'),'foreignKey':'AccountId'});db[_0xba75('0x1c2')]['hasMany'](db[_0xba75('0xa9')],{'as':_0xba75('0x1b6'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b7')});db[_0xba75('0x1c2')][_0xba75('0x110')](db[_0xba75('0xa9')],{'as':_0xba75('0x1b8'),'onDelete':'cascade','foreignKey':_0xba75('0x1bf')});db[_0xba75('0x1c2')]['hasMany'](db[_0xba75('0xa9')],{'as':'Fields','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b9')});db['DeskConfiguration'][_0xba75('0x14b')](db['DeskAccount'],{'as':_0xba75('0x169'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x1c3')});db[_0xba75('0xa9')][_0xba75('0x110')](db[_0xba75('0xa9')],{'as':_0xba75('0x1ba'),'foreignKey':_0xba75('0x1b7')});db[_0xba75('0xa9')][_0xba75('0x110')](db[_0xba75('0xa9')],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0xa9')][_0xba75('0x110')](db[_0xba75('0xa9')],{'as':_0xba75('0x1bc'),'foreignKey':_0xba75('0x1b9')});db[_0xba75('0xa9')][_0xba75('0x14b')](db[_0xba75('0x94')],{'as':'Variable','foreignKey':'VariableId'});db[_0xba75('0x1c4')]['hasMany'](db[_0xba75('0x1c5')],{'as':_0xba75('0x1be'),'onDelete':'cascade','foreignKey':_0xba75('0x1b5')});db[_0xba75('0x1c5')][_0xba75('0x110')](db[_0xba75('0xab')],{'as':_0xba75('0x1b6'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b7')});db['ZohoConfiguration']['hasMany'](db[_0xba75('0xab')],{'as':_0xba75('0x1b8'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1bf')});db['ZohoConfiguration'][_0xba75('0x110')](db[_0xba75('0xab')],{'as':_0xba75('0x1b1'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b9')});db[_0xba75('0x1c5')]['belongsTo'](db[_0xba75('0x1c4')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x1b5')});db[_0xba75('0xab')]['hasMany'](db[_0xba75('0xab')],{'as':_0xba75('0x1ba'),'foreignKey':_0xba75('0x1b7')});db[_0xba75('0xab')][_0xba75('0x110')](db[_0xba75('0xab')],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0xab')][_0xba75('0x110')](db[_0xba75('0xab')],{'as':_0xba75('0x1bc'),'foreignKey':'FieldId'});db['ZohoField'][_0xba75('0x14b')](db[_0xba75('0x94')],{'as':_0xba75('0x94'),'foreignKey':_0xba75('0x1c0')});db[_0xba75('0xad')][_0xba75('0x110')](db[_0xba75('0x1c6')],{'as':_0xba75('0x1be'),'onDelete':_0xba75('0x10e'),'foreignKey':'AccountId'});db[_0xba75('0x1c6')][_0xba75('0x110')](db[_0xba75('0xaf')],{'as':_0xba75('0x1b6'),'foreignKey':'SubjectId'});db[_0xba75('0x1c6')][_0xba75('0x110')](db['ZendeskField'],{'as':_0xba75('0x1b8'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0x1c6')][_0xba75('0x110')](db['ZendeskField'],{'as':_0xba75('0x1b1'),'foreignKey':_0xba75('0x1b9')});db[_0xba75('0x1c6')][_0xba75('0x14b')](db[_0xba75('0xad')],{'as':'Account','foreignKey':_0xba75('0x1b5')});db[_0xba75('0x1c6')][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x1c7')});db[_0xba75('0xaf')][_0xba75('0x110')](db[_0xba75('0xaf')],{'as':_0xba75('0x1ba'),'foreignKey':_0xba75('0x1b7')});db['ZendeskField'][_0xba75('0x110')](db[_0xba75('0xaf')],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0xaf')]['hasMany'](db[_0xba75('0xaf')],{'as':_0xba75('0x1bc'),'foreignKey':'FieldId'});db['ZendeskField'][_0xba75('0x14b')](db[_0xba75('0x94')],{'as':'Variable','foreignKey':_0xba75('0x1c0')});db[_0xba75('0xb1')]['hasMany'](db['FreshdeskConfiguration'],{'as':_0xba75('0x1be'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b5')});db[_0xba75('0xb3')]['hasMany'](db[_0xba75('0xb5')],{'as':_0xba75('0x1b6'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b7')});db[_0xba75('0xb3')][_0xba75('0x110')](db['FreshdeskField'],{'as':_0xba75('0x1b8'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0xb3')][_0xba75('0x110')](db[_0xba75('0xb5')],{'as':_0xba75('0x1b1'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xba75('0xb3')][_0xba75('0x14b')](db['FreshdeskAccount'],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x1b5')});db[_0xba75('0xb3')][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xba75('0xb5')]['hasMany'](db[_0xba75('0xb5')],{'as':'Subject','foreignKey':'SubjectId'});db['FreshdeskField'][_0xba75('0x110')](db[_0xba75('0xb5')],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0xb5')][_0xba75('0x110')](db[_0xba75('0xb5')],{'as':_0xba75('0x1bc'),'foreignKey':'FieldId'});db[_0xba75('0xb5')]['belongsTo'](db['Variable'],{'as':_0xba75('0x94'),'foreignKey':_0xba75('0x1c0')});db[_0xba75('0x1c8')][_0xba75('0x110')](db[_0xba75('0xb8')],{'as':_0xba75('0x1be'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b5')});db[_0xba75('0xb8')][_0xba75('0x110')](db[_0xba75('0x1c9')],{'as':'Subjects','foreignKey':_0xba75('0x1b7')});db[_0xba75('0xb8')]['hasMany'](db[_0xba75('0x1c9')],{'as':_0xba75('0x1b8'),'foreignKey':_0xba75('0x1bf')});db['VtigerConfiguration']['hasMany'](db[_0xba75('0x1c9')],{'as':_0xba75('0x1b1'),'foreignKey':_0xba75('0x1b9')});db['VtigerConfiguration'][_0xba75('0x14b')](db['VtigerAccount'],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x1b5')});db['VtigerField']['hasMany'](db[_0xba75('0x1c9')],{'as':_0xba75('0x1ba'),'foreignKey':'SubjectId'});db['VtigerField']['hasMany'](db['VtigerField'],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db['VtigerField'][_0xba75('0x110')](db[_0xba75('0x1c9')],{'as':_0xba75('0x1bc'),'foreignKey':'FieldId'});db[_0xba75('0x1c9')][_0xba75('0x14b')](db[_0xba75('0x94')],{'as':_0xba75('0x94'),'foreignKey':_0xba75('0x1c0')});db['ServicenowAccount'][_0xba75('0x110')](db[_0xba75('0x1ca')],{'as':'Configurations','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b5')});db['ServicenowConfiguration']['hasMany'](db[_0xba75('0xbd')],{'as':_0xba75('0x1b6'),'foreignKey':_0xba75('0x1b7')});db[_0xba75('0x1ca')][_0xba75('0x110')](db[_0xba75('0xbd')],{'as':_0xba75('0x1b8'),'foreignKey':_0xba75('0x1bf')});db['ServicenowConfiguration']['hasMany'](db[_0xba75('0xbd')],{'as':'Fields','foreignKey':_0xba75('0x1b9')});db[_0xba75('0x1ca')][_0xba75('0x14b')](db[_0xba75('0xba')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x1b5')});db[_0xba75('0xbd')][_0xba75('0x110')](db[_0xba75('0xbd')],{'as':_0xba75('0x1ba'),'foreignKey':_0xba75('0x1b7')});db[_0xba75('0xbd')][_0xba75('0x110')](db['ServicenowField'],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db['ServicenowField'][_0xba75('0x110')](db[_0xba75('0xbd')],{'as':_0xba75('0x1bc'),'foreignKey':_0xba75('0x1b9')});db[_0xba75('0xbd')]['belongsTo'](db[_0xba75('0x94')],{'as':'Variable','foreignKey':_0xba75('0x1c0')});db['Dynamics365Account'][_0xba75('0x110')](db[_0xba75('0xc1')],{'as':_0xba75('0x1be'),'onDelete':_0xba75('0x10e'),'foreignKey':'AccountId'});db[_0xba75('0xc1')][_0xba75('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b7')});db['Dynamics365Configuration'][_0xba75('0x110')](db[_0xba75('0xc3')],{'as':_0xba75('0x1b8'),'onDelete':'cascade','foreignKey':_0xba75('0x1bf')});db[_0xba75('0xc1')][_0xba75('0x110')](db[_0xba75('0xc3')],{'as':'Fields','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b9')});db['Dynamics365Configuration'][_0xba75('0x14b')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0xba75('0x1b5')});db['Dynamics365Field'][_0xba75('0x110')](db[_0xba75('0xc3')],{'as':_0xba75('0x1ba'),'foreignKey':'SubjectId'});db[_0xba75('0xc3')]['hasMany'](db['Dynamics365Field'],{'as':_0xba75('0x1bb'),'foreignKey':'DescriptionId'});db[_0xba75('0xc3')][_0xba75('0x110')](db[_0xba75('0xc3')],{'as':_0xba75('0x1bc'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0xba75('0x14b')](db[_0xba75('0x94')],{'as':_0xba75('0x94'),'foreignKey':_0xba75('0x1c0')});db[_0xba75('0xc4')][_0xba75('0x110')](db[_0xba75('0xc6')],{'as':_0xba75('0x1be'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b5')});db['FreshsalesConfiguration'][_0xba75('0x110')](db[_0xba75('0x1cb')],{'as':'Subjects','foreignKey':_0xba75('0x1b7')});db[_0xba75('0xc6')][_0xba75('0x110')](db[_0xba75('0x1cb')],{'as':'Descriptions','foreignKey':_0xba75('0x1bf')});db[_0xba75('0xc6')][_0xba75('0x110')](db[_0xba75('0x1cb')],{'as':'Fields','foreignKey':_0xba75('0x1b9')});db[_0xba75('0xc6')][_0xba75('0x14b')](db[_0xba75('0xc4')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x1b5')});db['FreshsalesField'][_0xba75('0x110')](db[_0xba75('0x1cb')],{'as':'Subject','foreignKey':_0xba75('0x1b7')});db['FreshsalesField'][_0xba75('0x110')](db[_0xba75('0x1cb')],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0x1cb')][_0xba75('0x110')](db['FreshsalesField'],{'as':_0xba75('0x1bc'),'foreignKey':_0xba75('0x1b9')});db[_0xba75('0x1cb')][_0xba75('0x14b')](db[_0xba75('0x94')],{'as':_0xba75('0x94'),'foreignKey':_0xba75('0x1c0')});db['ChatQueueReport'][_0xba75('0x14b')](db[_0xba75('0x66')],{});db[_0xba75('0xcb')]['belongsTo'](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0xcb')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':'Contact','foreignKey':_0xba75('0x15c')});db[_0xba75('0xcb')]['belongsTo'](db[_0xba75('0x6a')],{});db[_0xba75('0xcb')][_0xba75('0x14b')](db[_0xba75('0x192')],{});db[_0xba75('0xcb')]['belongsTo'](db['User'],{});db[_0xba75('0xcb')][_0xba75('0x14b')](db[_0xba75('0x6e')],{});db['ChatInternalMessage'][_0xba75('0x14b')](db[_0xba75('0x13')],{'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1cc')});db[_0xba75('0xcd')][_0xba75('0x14b')](db[_0xba75('0x13')],{'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1cd')});db[_0xba75('0x197')][_0xba75('0x110')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xba75('0x197')][_0xba75('0x110')](db[_0xba75('0xcf')],{'foreignKey':_0xba75('0x1ce'),'onDelete':'cascade'});db[_0xba75('0xd3')]['belongsTo'](db[_0xba75('0x56')],{});db[_0xba75('0xd3')][_0xba75('0x14b')](db['CmList'],{'as':_0xba75('0x165'),'foreignKey':'ListId'});db[_0xba75('0xd3')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0xd3')][_0xba75('0x14b')](db[_0xba75('0x5a')],{});db[_0xba75('0xd3')][_0xba75('0x14b')](db['SmsMessage'],{});db[_0xba75('0xd3')][_0xba75('0x14b')](db[_0xba75('0x13')],{});db['SmsQueueReport']['belongsTo'](db[_0xba75('0x5d')],{});db[_0xba75('0xd7')][_0xba75('0x110')](db['JscriptySessionReport'],{'foreignKey':_0xba75('0x1cf')});db[_0xba75('0xd7')][_0xba75('0x110')](db[_0xba75('0x1d0')],{'foreignKey':_0xba75('0x1cf')});db[_0xba75('0xd7')][_0xba75('0x110')](db['JscriptyAnswerReport'],{'foreignKey':_0xba75('0x1cf')});db[_0xba75('0x1d1')]['belongsToMany'](db[_0xba75('0x13')],{'as':_0xba75('0x16f'),'through':_0xba75('0x13d')});db['Team'][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':'Agents','through':_0xba75('0x122')});db[_0xba75('0xdf')]['belongsToMany'](db['VoiceQueue'],{'through':_0xba75('0x108'),'as':_0xba75('0x12b')});db[_0xba75('0xdf')][_0xba75('0x11e')](db[_0xba75('0x41')],{'through':_0xba75('0x1d2'),'as':'MailQueues'});db[_0xba75('0xdf')][_0xba75('0x11e')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0xba75('0x12f')});db[_0xba75('0xdf')][_0xba75('0x11e')](db[_0xba75('0x17e')],{'through':'team_has_fax_queues','as':_0xba75('0x130')});db[_0xba75('0xdf')][_0xba75('0x11e')](db[_0xba75('0x5d')],{'through':_0xba75('0x1d3'),'as':_0xba75('0x131')});db[_0xba75('0xdf')][_0xba75('0x11e')](db[_0xba75('0x132')],{'through':_0xba75('0x18c'),'as':_0xba75('0x133')});db[_0xba75('0xdf')][_0xba75('0x11e')](db[_0xba75('0x104')],{'through':_0xba75('0x1d4'),'as':_0xba75('0x134')});db['Team']['belongsToMany'](db[_0xba75('0xf4')],{'through':_0xba75('0x10a'),'as':_0xba75('0x12c')});db[_0xba75('0xe2')][_0xba75('0x110')](db[_0xba75('0x76')],{'as':_0xba75('0x148'),'foreignKey':_0xba75('0x1d5')});db[_0xba75('0xe2')][_0xba75('0x110')](db[_0xba75('0x79')],{'as':'HopperFinals','foreignKey':_0xba75('0x1d5')});db[_0xba75('0xe2')][_0xba75('0x110')](db[_0xba75('0x7b')],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0xba75('0xe2')]['hasMany'](db[_0xba75('0x78')],{'as':'HopperBlacks','foreignKey':_0xba75('0x1d5')});db['Campaign']['belongsTo'](db[_0xba75('0x29')],{'as':_0xba75('0x29'),'foreignKey':_0xba75('0x14c')});db[_0xba75('0xe2')]['belongsTo'](db[_0xba75('0x29')],{'as':_0xba75('0x14d'),'foreignKey':'TrunkBackupId'});db[_0xba75('0xe2')][_0xba75('0x14b')](db[_0xba75('0x87')],{'as':_0xba75('0x87'),'foreignKey':_0xba75('0x14f')});db[_0xba75('0xe2')][_0xba75('0x14b')](db[_0xba75('0x1d1')],{'as':_0xba75('0x1d1'),'foreignKey':_0xba75('0x1d6')});db[_0xba75('0xe2')]['belongsToMany'](db[_0xba75('0xf2')],{'as':_0xba75('0x121'),'through':_0xba75('0x1d7')});db[_0xba75('0xe2')][_0xba75('0x11e')](db[_0xba75('0xf2')],{'as':'BlackLists','through':_0xba75('0x1d8')});db[_0xba75('0x170')]['belongsTo'](db[_0xba75('0x6d')],{'as':_0xba75('0x6d'),'foreignKey':_0xba75('0x174')});db[_0xba75('0xe9')][_0xba75('0x14b')](db[_0xba75('0x46')],{});db[_0xba75('0xe9')][_0xba75('0x14b')](db[_0xba75('0x123')],{});db['MailTransferReport'][_0xba75('0x14b')](db[_0xba75('0x15d')],{'foreignKey':_0xba75('0x1d9'),'as':'FromAccount'});db[_0xba75('0xe9')][_0xba75('0x14b')](db['User'],{'foreignKey':_0xba75('0x1da'),'as':_0xba75('0x1db')});db[_0xba75('0xe9')][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':_0xba75('0x1dc'),'as':_0xba75('0x1dd')});db[_0xba75('0xe9')][_0xba75('0x14b')](db[_0xba75('0x41')],{'foreignKey':'ToMailQueueId','as':_0xba75('0x1de')});db[_0xba75('0xe9')][_0xba75('0x14b')](db[_0xba75('0x15d')],{'foreignKey':'ToMailAccountId','as':_0xba75('0x1df')});db[_0xba75('0xea')][_0xba75('0x14b')](db[_0xba75('0x192')],{});db[_0xba75('0xea')]['belongsTo'](db[_0xba75('0x6a')],{});db['ChatTransferReport'][_0xba75('0x14b')](db[_0xba75('0x66')],{'foreignKey':_0xba75('0x1e0'),'as':'FromAccount'});db[_0xba75('0xea')][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':_0xba75('0x1da'),'as':'FromAgent'});db['ChatTransferReport'][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':_0xba75('0x1dc'),'as':_0xba75('0x1dd')});db[_0xba75('0xea')][_0xba75('0x14b')](db[_0xba75('0x6e')],{'foreignKey':'ToChatQueueId','as':_0xba75('0x1de')});db[_0xba75('0xea')][_0xba75('0x14b')](db[_0xba75('0x66')],{'foreignKey':_0xba75('0x1e1'),'as':'ToAccount'});db['FaxTransferReport'][_0xba75('0x14b')](db[_0xba75('0x52')],{});db[_0xba75('0xec')][_0xba75('0x14b')](db[_0xba75('0x118')],{});db[_0xba75('0xec')][_0xba75('0x14b')](db[_0xba75('0x4e')],{'foreignKey':_0xba75('0x1e2'),'as':_0xba75('0x1e3')});db[_0xba75('0xec')][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':'FromUserId','as':_0xba75('0x1db')});db[_0xba75('0xec')][_0xba75('0x14b')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db['FaxTransferReport'][_0xba75('0x14b')](db[_0xba75('0x17e')],{'foreignKey':_0xba75('0x1e4'),'as':_0xba75('0x1de')});db[_0xba75('0xec')][_0xba75('0x14b')](db['FaxAccount'],{'foreignKey':_0xba75('0x1e5'),'as':'ToAccount'});db[_0xba75('0xee')][_0xba75('0x14b')](db['OpenchannelMessage'],{});db[_0xba75('0xee')][_0xba75('0x14b')](db['OpenchannelInteraction'],{});db[_0xba75('0xee')]['belongsTo'](db[_0xba75('0x5f')],{'foreignKey':_0xba75('0x1e6'),'as':_0xba75('0x1e3')});db['OpenchannelTransferReport'][_0xba75('0x14b')](db['User'],{'foreignKey':_0xba75('0x1da'),'as':_0xba75('0x1db')});db[_0xba75('0xee')][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':_0xba75('0x1dc'),'as':_0xba75('0x1dd')});db['OpenchannelTransferReport'][_0xba75('0x14b')](db[_0xba75('0x132')],{'foreignKey':_0xba75('0x1e7'),'as':_0xba75('0x1de')});db[_0xba75('0xee')][_0xba75('0x14b')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport'][_0xba75('0x14b')](db['SmsMessage'],{});db[_0xba75('0xf0')][_0xba75('0x14b')](db[_0xba75('0x5a')],{});db['SmsTransferReport'][_0xba75('0x14b')](db[_0xba75('0x56')],{'foreignKey':_0xba75('0x1e8'),'as':_0xba75('0x1e3')});db[_0xba75('0xf0')][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':_0xba75('0x1da'),'as':_0xba75('0x1db')});db[_0xba75('0xf0')][_0xba75('0x14b')](db['User'],{'foreignKey':_0xba75('0x1dc'),'as':_0xba75('0x1dd')});db[_0xba75('0xf0')][_0xba75('0x14b')](db['SmsQueue'],{'foreignKey':_0xba75('0x1e9'),'as':_0xba75('0x1de')});db[_0xba75('0xf0')][_0xba75('0x14b')](db[_0xba75('0x56')],{'foreignKey':'ToSmsAccountId','as':_0xba75('0x1df')});db[_0xba75('0xf2')][_0xba75('0x110')](db[_0xba75('0x84')],{'as':_0xba75('0x161'),'foreignKey':'ListId','onDelete':_0xba75('0x10e')});db[_0xba75('0xf2')][_0xba75('0x110')](db['CmCustomField'],{'as':_0xba75('0x1ea'),'foreignKey':'ListId'});db['CmList'][_0xba75('0x110')](db[_0xba75('0x74')],{'as':'Contacts','onDelete':_0xba75('0x10e'),'foreignKey':'ListId'});db[_0xba75('0xf2')][_0xba75('0x110')](db[_0xba75('0x79')],{'as':_0xba75('0x113'),'foreignKey':'ListId'});db['CmList'][_0xba75('0x110')](db[_0xba75('0x7b')],{'as':'HopperHistory','foreignKey':_0xba75('0x178')});db[_0xba75('0xf2')][_0xba75('0x110')](db[_0xba75('0x115')],{'as':_0xba75('0x115'),'foreignKey':'ListId'});db[_0xba75('0xf2')]['belongsToMany'](db[_0xba75('0x1a')],{'as':_0xba75('0x1eb'),'through':_0xba75('0x151')});db[_0xba75('0xf2')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x1ec')});db[_0xba75('0xf4')][_0xba75('0x110')](db[_0xba75('0x18')],{'as':'Extensions','onDelete':_0xba75('0x10e')});db[_0xba75('0xf4')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':'Agents','through':'UserVoicePrefix'});db[_0xba75('0xf4')][_0xba75('0x11e')](db[_0xba75('0xdf')],{'through':_0xba75('0x10a'),'as':'Teams'});db[_0xba75('0x11d')]['hasMany'](db['User'],{'as':_0xba75('0x16f'),'foreignKey':_0xba75('0x1ed')});db[_0xba75('0x11d')][_0xba75('0x110')](db[_0xba75('0xf6')],{'as':_0xba75('0x1ee'),'foreignKey':_0xba75('0x1ed'),'onDelete':_0xba75('0x10e')});db[_0xba75('0xf6')][_0xba75('0x110')](db[_0xba75('0x1ef')],{'as':_0xba75('0x1f0'),'foreignKey':'sectionId','onDelete':_0xba75('0x10e')});db[_0xba75('0x13a')][_0xba75('0x110')](db[_0xba75('0x84')],{'as':'Dispositions','foreignKey':_0xba75('0x1f1'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x13a')]['hasMany'](db[_0xba75('0x82')],{'as':'Answers','foreignKey':_0xba75('0x1f1')});db['WhatsappAccount'][_0xba75('0x110')](db[_0xba75('0xff')],{'as':_0xba75('0x154'),'foreignKey':_0xba75('0x1f1')});db[_0xba75('0x13a')][_0xba75('0x110')](db['WhatsappInteraction'],{'as':_0xba75('0x163')});db[_0xba75('0x13a')][_0xba75('0x110')](db['WhatsappApplication'],{'as':'Applications'});db[_0xba75('0x13a')]['belongsTo'](db['CmList'],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x13a')][_0xba75('0x14b')](db[_0xba75('0x89')],{'as':_0xba75('0x150'),'foreignKey':_0xba75('0x166')});db[_0xba75('0x13a')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x13c')});db[_0xba75('0xfc')][_0xba75('0x14b')](db[_0xba75('0x13')],{'onDelete':_0xba75('0x175')});db[_0xba75('0xfc')][_0xba75('0x14b')](db['WhatsappQueue'],{'onDelete':_0xba75('0x175')});db['WhatsappApplication'][_0xba75('0x14b')](db[_0xba75('0x13a')],{'onDelete':_0xba75('0x175')});db[_0xba75('0xfc')][_0xba75('0x14b')](db['Interval'],{'onDelete':_0xba75('0x175'),'foreignKey':'IntervalId'});db[_0xba75('0xfc')][_0xba75('0x14b')](db[_0xba75('0x16b')],{'onDelete':_0xba75('0x175'),'foreignKey':_0xba75('0x176')});db['WhatsappInteraction'][_0xba75('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1f2')});db[_0xba75('0xfe')][_0xba75('0x14b')](db[_0xba75('0x13a')],{'as':'Account','foreignKey':_0xba75('0x1f1')});db['WhatsappInteraction'][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0xba75('0x14b')](db['User'],{'as':'Owner','foreignKey':_0xba75('0x10f')});db[_0xba75('0xfe')][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':'whatsapp_interaction_has_tags','as':_0xba75('0x16d')});db[_0xba75('0xfe')][_0xba75('0x11e')](db['Tag'],{'through':_0xba75('0x1aa'),'as':_0xba75('0x16e')});db[_0xba75('0xfe')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':'Users','through':_0xba75('0x12a'),'foreignKey':_0xba75('0x1f2')});db[_0xba75('0xff')][_0xba75('0x14b')](db[_0xba75('0x13')],{'as':_0xba75('0x13')});db['WhatsappMessage']['belongsTo'](db[_0xba75('0x74')],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x15b')});db[_0xba75('0xff')][_0xba75('0x14b')](db[_0xba75('0xfe')],{'onDelete':'cascade','as':_0xba75('0x172'),'foreignKey':_0xba75('0x1f2')});db[_0xba75('0xff')][_0xba75('0x14b')](db[_0xba75('0x13a')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x1f1')});db[_0xba75('0x101')][_0xba75('0x14b')](db[_0xba75('0x13a')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x101')][_0xba75('0x14b')](db['CmContact'],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db['WhatsappQueueReport'][_0xba75('0x14b')](db[_0xba75('0xfe')],{});db[_0xba75('0x101')][_0xba75('0x14b')](db[_0xba75('0x104')],{});db[_0xba75('0x101')]['belongsTo'](db[_0xba75('0xff')],{});db['WhatsappQueueReport'][_0xba75('0x14b')](db[_0xba75('0x13')],{});db[_0xba75('0x102')][_0xba75('0x14b')](db[_0xba75('0xff')],{});db[_0xba75('0x102')]['belongsTo'](db[_0xba75('0xfe')],{});db[_0xba75('0x102')][_0xba75('0x14b')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db['WhatsappTransferReport'][_0xba75('0x14b')](db['WhatsappAccount'],{'foreignKey':_0xba75('0x1f3'),'as':_0xba75('0x1df')});db[_0xba75('0x102')][_0xba75('0x14b')](db[_0xba75('0x104')],{'foreignKey':'ToQueueId','as':_0xba75('0x1de')});db['WhatsappTransferReport'][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xba75('0x102')][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':_0xba75('0x1dc'),'as':_0xba75('0x1dd')});db['WhatsappQueue']['belongsToMany'](db[_0xba75('0x13')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0xba75('0x104')][_0xba75('0x11e')](db['Team'],{'through':_0xba75('0x1d4'),'as':_0xba75('0x167')});module[_0xba75('0x1f4')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 0819396..faf7afc 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd04=['./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./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/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/system','./api/system','/api/pm2','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','resolve','appPath','/index.html','username','newPassword','apiKey','lastName','phone','mobile','email','clientId','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerSecret','membername','calleridname','calleridnum','clientEmail','accesskeyid','secretaccesskey','key','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','includes','path','express','util','./errors','./config/environment','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','device','%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','test','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions'];(function(_0x2c3dfd,_0xf5f93d){var _0x10ec9f=function(_0x1e4e78){while(--_0x1e4e78){_0x2c3dfd['push'](_0x2c3dfd['shift']());}};_0x10ec9f(++_0xf5f93d);}(_0xbd04,0x102));var _0x4bd0=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xbd04[_0x2fc012];return _0x2891f9;};'use strict';var _=require('lodash');var path=require(_0x4bd0('0x0'));var express=require(_0x4bd0('0x1'));var ewinston=require('express-winston');var util=require(_0x4bd0('0x2'));var errors=require(_0x4bd0('0x3'));var config=require(_0x4bd0('0x4'));var logger=require(_0x4bd0('0x5'))(_0x4bd0('0x6'));var authLogger=require(_0x4bd0('0x5'))(_0x4bd0('0x7'));exports[_0x4bd0('0x8')]=function(_0x1c16da){_0x1c16da[_0x4bd0('0x9')](ewinston[_0x4bd0('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2ba13d,_0x44cc58){var _0x4fe1b5=_0x4bd0('0xb');if(!_['isEmpty'](_0x2ba13d[_0x4bd0('0xc')])){_0x4fe1b5+=_0x4bd0('0xd');var _0x1e9182=_0x2ba13d[_0x4bd0('0xc')];maskSensitiveData(_0x1e9182);}return util[_0x4bd0('0xe')](_0x4fe1b5,_0x2ba13d[_0x4bd0('0xf')],_0x2ba13d[_0x4bd0('0x10')][_0x4bd0('0x11')]?_0x2ba13d[_0x4bd0('0x10')][_0x4bd0('0x11')]:_0x2ba13d[_0x4bd0('0x12')][_0x4bd0('0x13')]||_0x2ba13d['ip'],_0x2ba13d[_0x4bd0('0x14')],_0x44cc58[_0x4bd0('0x15')],_0x44cc58[_0x4bd0('0x16')],_0x2ba13d['user']?_0x2ba13d[_0x4bd0('0x17')]['id']:null,_0x2ba13d[_0x4bd0('0x17')]?_0x2ba13d[_0x4bd0('0x17')][_0x4bd0('0x18')]:null,_0x2ba13d[_0x4bd0('0x17')]?_0x2ba13d['user'][_0x4bd0('0x19')]:null,_0x1e9182?util[_0x4bd0('0x1a')](_0x1e9182,![],null):'');}}));_0x1c16da[_0x4bd0('0x9')](ewinston[_0x4bd0('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5ec3ba,_0x152bbf){var _0x3d3367='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x5ec3ba['body']&&_0x5ec3ba[_0x4bd0('0xc')][_0x4bd0('0x1b')]&&_0x5ec3ba[_0x4bd0('0xc')]['agent_id']){_0x3d3367=_0x4bd0('0x1c');}return util[_0x4bd0('0xe')](_0x3d3367,_0x5ec3ba[_0x4bd0('0xf')],_0x5ec3ba['headers'][_0x4bd0('0x11')]?_0x5ec3ba[_0x4bd0('0x10')][_0x4bd0('0x11')]:_0x5ec3ba[_0x4bd0('0x12')][_0x4bd0('0x13')]||_0x5ec3ba['ip'],_0x5ec3ba[_0x4bd0('0x14')],_0x152bbf[_0x4bd0('0x15')],_0x152bbf['responseTime'],_0x5ec3ba[_0x4bd0('0x17')]?_0x5ec3ba[_0x4bd0('0x17')]['id']:null,_0x5ec3ba['user']?_0x5ec3ba[_0x4bd0('0x17')]['name']:null,_0x5ec3ba[_0x4bd0('0x17')]?_0x5ec3ba[_0x4bd0('0x17')][_0x4bd0('0x19')]:null,_0x5ec3ba['body']&&_0x5ec3ba[_0x4bd0('0xc')][_0x4bd0('0x1b')]?_0x5ec3ba[_0x4bd0('0xc')][_0x4bd0('0x1b')]:_0x4bd0('0x1d'),_0x5ec3ba['body']&&_0x5ec3ba[_0x4bd0('0xc')][_0x4bd0('0x1e')]?_0x5ec3ba[_0x4bd0('0xc')][_0x4bd0('0x1e')]:'',_0x5ec3ba[_0x4bd0('0xc')]&&_0x5ec3ba['body']['agent_name']?_0x5ec3ba[_0x4bd0('0xc')]['agent_name']:'');},'ignoreRoute':function(_0x266f2a){var _0x194dfa=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x194dfa[_0x4bd0('0x1f')](_0x266f2a['url']);}}));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x20'),require('./api/user'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x21'),require(_0x4bd0('0x22')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x23'),require('./api/voiceContext'));_0x1c16da[_0x4bd0('0x9')]('/api/voice/extensions',require(_0x4bd0('0x24')));_0x1c16da[_0x4bd0('0x9')]('/api/voice/mohs',require(_0x4bd0('0x25')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x26'),require(_0x4bd0('0x27')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x28'),require(_0x4bd0('0x29')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x2a'),require(_0x4bd0('0x2b')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x2c'),require(_0x4bd0('0x2d')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x2e'),require(_0x4bd0('0x2f')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x30'),require(_0x4bd0('0x31')));_0x1c16da['use'](_0x4bd0('0x32'),require(_0x4bd0('0x33')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x34'),require('./api/voiceAgentReport'));_0x1c16da['use'](_0x4bd0('0x35'),require('./api/voiceQueueReport'));_0x1c16da['use'](_0x4bd0('0x36'),require('./api/memberReport'));_0x1c16da['use'](_0x4bd0('0x37'),require(_0x4bd0('0x38')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x39'),require(_0x4bd0('0x3a')));_0x1c16da['use'](_0x4bd0('0x3b'),require(_0x4bd0('0x3c')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x3d'),require(_0x4bd0('0x3e')));_0x1c16da['use'](_0x4bd0('0x3f'),require(_0x4bd0('0x40')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x41'),require('./api/mailSubstatus'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x42'),require(_0x4bd0('0x43')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x44'),require(_0x4bd0('0x45')));_0x1c16da['use'](_0x4bd0('0x46'),require(_0x4bd0('0x47')));_0x1c16da['use'](_0x4bd0('0x48'),require(_0x4bd0('0x49')));_0x1c16da['use'](_0x4bd0('0x4a'),require(_0x4bd0('0x4b')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x4c'),require(_0x4bd0('0x4d')));_0x1c16da['use'](_0x4bd0('0x4e'),require(_0x4bd0('0x4f')));_0x1c16da[_0x4bd0('0x9')]('/api/fax/applications',require('./api/faxApplication'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x50'),require(_0x4bd0('0x51')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x52'),require(_0x4bd0('0x53')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x54'),require(_0x4bd0('0x55')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x56'),require(_0x4bd0('0x57')));_0x1c16da['use'](_0x4bd0('0x58'),require(_0x4bd0('0x59')));_0x1c16da[_0x4bd0('0x9')]('/api/sms/applications',require(_0x4bd0('0x5a')));_0x1c16da['use'](_0x4bd0('0x5b'),require(_0x4bd0('0x5c')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x5d'),require(_0x4bd0('0x5e')));_0x1c16da['use']('/api/sms/queues',require(_0x4bd0('0x5f')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x60'),require(_0x4bd0('0x61')));_0x1c16da[_0x4bd0('0x9')]('/api/openchannel/applications',require(_0x4bd0('0x62')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x63'),require(_0x4bd0('0x64')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x65'),require(_0x4bd0('0x66')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x67'),require('./api/openchannelQueue'));_0x1c16da[_0x4bd0('0x9')]('/api/chat/websites',require('./api/chatWebsite'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x68'),require('./api/openchannelQueueReport'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x69'),require(_0x4bd0('0x6a')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x6b'),require(_0x4bd0('0x6c')));_0x1c16da[_0x4bd0('0x9')]('/api/chat/messages',require('./api/chatMessage'));_0x1c16da[_0x4bd0('0x9')]('/api/chat/offline_messages',require(_0x4bd0('0x6d')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x6e'),require(_0x4bd0('0x6f')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x70'),require(_0x4bd0('0x71')));_0x1c16da[_0x4bd0('0x9')]('/api/chat/proactive_actions',require(_0x4bd0('0x72')));_0x1c16da['use'](_0x4bd0('0x73'),require(_0x4bd0('0x74')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x75'),require(_0x4bd0('0x76')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x77'),require('./api/cmHopper'));_0x1c16da[_0x4bd0('0x9')]('/api/cm/hopper_black',require(_0x4bd0('0x78')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x79'),require(_0x4bd0('0x7a')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x7b'),require('./api/cmHopperHistory'));_0x1c16da[_0x4bd0('0x9')]('/api/cm/custom_fields',require(_0x4bd0('0x7c')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x7d'),require('./api/action'));_0x1c16da['use']('/api/automations',require(_0x4bd0('0x7e')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x7f'),require('./api/cannedAnswer'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x80'),require(_0x4bd0('0x81')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x82'),require('./api/condition'));_0x1c16da['use'](_0x4bd0('0x83'),require(_0x4bd0('0x84')));_0x1c16da[_0x4bd0('0x9')]('/api/pauses',require(_0x4bd0('0x85')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x86'),require(_0x4bd0('0x87')));_0x1c16da['use'](_0x4bd0('0x88'),require('./api/voiceQueuesLog'));_0x1c16da['use'](_0x4bd0('0x89'),require(_0x4bd0('0x8a')));_0x1c16da['use']('/api/sounds',require(_0x4bd0('0x8b')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x8c'),require(_0x4bd0('0x8d')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x8e'),require(_0x4bd0('0x8f')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x90'),require('./api/trigger'));_0x1c16da['use'](_0x4bd0('0x91'),require(_0x4bd0('0x92')));_0x1c16da[_0x4bd0('0x9')]('/api/integrations',require('./api/integration'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x93'),require(_0x4bd0('0x94')));_0x1c16da[_0x4bd0('0x9')]('/api/analytics/custom_reports',require(_0x4bd0('0x95')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x96'),require(_0x4bd0('0x97')));_0x1c16da['use'](_0x4bd0('0x98'),require(_0x4bd0('0x99')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x9a'),require(_0x4bd0('0x9b')));_0x1c16da[_0x4bd0('0x9')]('/api/analytics/field_reports',require(_0x4bd0('0x9c')));_0x1c16da['use']('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x9d'),require(_0x4bd0('0x9e')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x9f'),require(_0x4bd0('0xa0')));_0x1c16da['use']('/api/integrations/salesforce/fields',require(_0x4bd0('0xa1')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xa2'),require(_0x4bd0('0xa3')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xa4'),require(_0x4bd0('0xa5')));_0x1c16da['use'](_0x4bd0('0xa6'),require('./api/intSugarcrmField'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xa7'),require(_0x4bd0('0xa8')));_0x1c16da['use'](_0x4bd0('0xa9'),require(_0x4bd0('0xaa')));_0x1c16da[_0x4bd0('0x9')]('/api/integrations/desk/fields',require(_0x4bd0('0xab')));_0x1c16da['use'](_0x4bd0('0xac'),require(_0x4bd0('0xad')));_0x1c16da[_0x4bd0('0x9')]('/api/integrations/zoho/configurations',require(_0x4bd0('0xae')));_0x1c16da['use'](_0x4bd0('0xaf'),require('./api/intZohoField'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xb0'),require(_0x4bd0('0xb1')));_0x1c16da['use']('/api/integrations/zendesk/configurations',require(_0x4bd0('0xb2')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xb3'),require('./api/intZendeskField'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xb4'),require(_0x4bd0('0xb5')));_0x1c16da['use'](_0x4bd0('0xb6'),require(_0x4bd0('0xb7')));_0x1c16da['use']('/api/integrations/freshdesk/fields',require(_0x4bd0('0xb8')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xb9'),require(_0x4bd0('0xba')));_0x1c16da[_0x4bd0('0x9')]('/api/integrations/vtiger/configurations',require(_0x4bd0('0xbb')));_0x1c16da['use']('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xbc'),require('./api/intServicenowAccount'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xbd'),require('./api/intServicenowConfiguration'));_0x1c16da[_0x4bd0('0x9')]('/api/integrations/servicenow/fields',require(_0x4bd0('0xbe')));_0x1c16da['use']('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xbf'),require(_0x4bd0('0xc0')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xc1'),require(_0x4bd0('0xc2')));_0x1c16da[_0x4bd0('0x9')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x1c16da['use'](_0x4bd0('0xc3'),require(_0x4bd0('0xc4')));_0x1c16da['use'](_0x4bd0('0xc5'),require(_0x4bd0('0xc6')));_0x1c16da['use'](_0x4bd0('0xc7'),require(_0x4bd0('0xc8')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xc9'),require('./api/chatQueueReport'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xca'),require('./api/chatInternalMessage'));_0x1c16da['use'](_0x4bd0('0xcb'),require(_0x4bd0('0xcc')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xcd'),require(_0x4bd0('0xce')));_0x1c16da['use']('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xcf'),require(_0x4bd0('0xd0')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xd1'),require(_0x4bd0('0xd2')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xd3'),require(_0x4bd0('0xd4')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xd5'),require(_0x4bd0('0xd6')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xd7'),require(_0x4bd0('0xd8')));_0x1c16da[_0x4bd0('0x9')]('/api/square/odbc',require(_0x4bd0('0xd9')));_0x1c16da['use']('/api/square/projects',require(_0x4bd0('0xda')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xdb'),require(_0x4bd0('0xdc')));_0x1c16da['use'](_0x4bd0('0xdd'),require(_0x4bd0('0xde')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xdf'),require(_0x4bd0('0xe0')));_0x1c16da['use']('/api/license',require(_0x4bd0('0xe1')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xe2'),require(_0x4bd0('0xe3')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xe4'),require(_0x4bd0('0xe5')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xe6'),require('./api/attachment'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xe7'),require(_0x4bd0('0xe8')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xe9'),require(_0x4bd0('0xea')));_0x1c16da[_0x4bd0('0x9')]('/api/chat/reports/transfer',require(_0x4bd0('0xeb')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xec'),require(_0x4bd0('0xed')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xee'),require('./api/openchannelTransferReport'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xef'),require(_0x4bd0('0xf0')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xf1'),require(_0x4bd0('0xf2')));_0x1c16da[_0x4bd0('0x9')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xf3'),require('./api/userProfile'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xf4'),require(_0x4bd0('0xf5')));_0x1c16da['use']('/api/userProfile/resources',require(_0x4bd0('0xf6')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xf7'),require(_0x4bd0('0xf8')));_0x1c16da['use'](_0x4bd0('0xf9'),require(_0x4bd0('0xfa')));_0x1c16da[_0x4bd0('0x9')]('/api/whatsapp/applications',require(_0x4bd0('0xfb')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xfc'),require(_0x4bd0('0xfd')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0xfe'),require(_0x4bd0('0xff')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x100'),require(_0x4bd0('0x101')));_0x1c16da['use'](_0x4bd0('0x102'),require(_0x4bd0('0x103')));_0x1c16da['use'](_0x4bd0('0x104'),require(_0x4bd0('0x105')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x106'),require(_0x4bd0('0x107')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x108'),require(_0x4bd0('0x109')));_0x1c16da[_0x4bd0('0x9')]('/api/auth/local',require(_0x4bd0('0x10a')));_0x1c16da[_0x4bd0('0x9')]('/api/auth/google',require(_0x4bd0('0x10b')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x10c'),require(_0x4bd0('0x10d')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x10e'),require(_0x4bd0('0x10f')));_0x1c16da[_0x4bd0('0x9')]('/api/version',require('./api/version'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x110'),require(_0x4bd0('0x111')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x112'),require('./api/pm2'));_0x1c16da[_0x4bd0('0x9')]('/api/webbar',require('./api/webbar'));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x113'),express[_0x4bd0('0x114')](path[_0x4bd0('0x115')](config[_0x4bd0('0x116')],_0x4bd0('0x113'))));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x117'),express[_0x4bd0('0x114')](path[_0x4bd0('0x115')](config['root'],_0x4bd0('0x117'))));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x118'),express['static'](path['join'](config[_0x4bd0('0x116')],_0x4bd0('0x118'))));_0x1c16da['use'](_0x4bd0('0x119'),express[_0x4bd0('0x114')](path[_0x4bd0('0x115')](config[_0x4bd0('0x116')],_0x4bd0('0x11a'),'3.0.0')));_0x1c16da[_0x4bd0('0x9')](_0x4bd0('0x11b'),express[_0x4bd0('0x114')](path[_0x4bd0('0x115')](config[_0x4bd0('0x116')],_0x4bd0('0x11c'))));_0x1c16da['route']('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x1c16da[_0x4bd0('0x11d')]('/*')[_0x4bd0('0x11e')](function(_0x327317,_0x5ba8b2){_0x5ba8b2['sendFile'](path[_0x4bd0('0x11f')](_0x1c16da[_0x4bd0('0x11e')](_0x4bd0('0x120'))+_0x4bd0('0x121')));});};var sensitiveFields=[_0x4bd0('0x122'),'password',_0x4bd0('0x123'),_0x4bd0('0x124'),'firstName',_0x4bd0('0x125'),'street',_0x4bd0('0x126'),_0x4bd0('0x127'),'fax',_0x4bd0('0x128'),_0x4bd0('0x129'),'clientSecret',_0x4bd0('0x12a'),_0x4bd0('0x12b'),_0x4bd0('0x12c'),_0x4bd0('0x12d'),_0x4bd0('0x12e'),_0x4bd0('0x12f'),_0x4bd0('0x130'),_0x4bd0('0x131'),'authToken','consumerKey',_0x4bd0('0x132'),_0x4bd0('0x133'),_0x4bd0('0x134'),_0x4bd0('0x135'),'exten','vidaooApiKey',_0x4bd0('0x136'),'privateKey',_0x4bd0('0x137'),_0x4bd0('0x138'),_0x4bd0('0x139'),'user','pass','accountSid',_0x4bd0('0x13a'),_0x4bd0('0x13b'),_0x4bd0('0x13c'),_0x4bd0('0x13d'),_0x4bd0('0x13e')];function maskSensitiveData(_0xa50ac6){var _0x59653c=/(?!^)[\s\S](?!$)/g;if(!_[_0x4bd0('0x13f')](_0xa50ac6))return;for(var _0x3c85b8 in _0xa50ac6){if(_[_0x4bd0('0x140')](_0xa50ac6[_0x3c85b8])){for(var _0x5d632c=0x0;_0x5d632c<_0xa50ac6[_0x3c85b8][_0x4bd0('0x141')];_0x5d632c++){maskSensitiveData(_0xa50ac6[_0x3c85b8][_0x5d632c]);}}else if(_[_0x4bd0('0x13f')](_0xa50ac6[_0x3c85b8])){maskSensitiveData(_0xa50ac6[_0x3c85b8]);}else if(_[_0x4bd0('0x142')](_0xa50ac6[_0x3c85b8])){_0xa50ac6[_0x3c85b8]=_0xa50ac6[_0x3c85b8]['replace'](/{{{/g,'@@{')[_0x4bd0('0x143')](/}}}/g,'}@@')['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x4bd0('0x144')](sensitiveFields,_0x3c85b8)){_0xa50ac6[_0x3c85b8]=_0xa50ac6[_0x3c85b8][_0x4bd0('0x143')](_0x59653c,'*');}}}} \ No newline at end of file +var _0x3ca6=['/api/sms/applications','./api/smsApplication','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/openchannel/reports/queue','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/automations','./api/automation','./api/cannedAnswer','./api/disposition','/api/intervals','./api/interval','/api/pauses','./api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/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/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowField','./api/intDynamics365Account','/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/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','./api/pm2','./api/webbar','/apidoc','join','root','/www','static','/demo','/snippet','snippet','3.0.0','/server/files/plugins','get','route','sendFile','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientSecret','securityToken','code','accessKey','tenantId','token','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','key','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString','@@{','replace','lodash','path','express','util','./errors','./config/environment','./config/logger','auth','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','x-forwarded-for','headers','remoteAddress','url','statusCode','responseTime','user','name','role','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','connection','other','agent_name','test','/api/users','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','/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/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts'];(function(_0x245b66,_0x474c4f){var _0x3240c9=function(_0x54c1fa){while(--_0x54c1fa){_0x245b66['push'](_0x245b66['shift']());}};_0x3240c9(++_0x474c4f);}(_0x3ca6,0xf6));var _0x63ca=function(_0x4a77c3,_0x132416){_0x4a77c3=_0x4a77c3-0x0;var _0x2f5796=_0x3ca6[_0x4a77c3];return _0x2f5796;};'use strict';var _=require(_0x63ca('0x0'));var path=require(_0x63ca('0x1'));var express=require(_0x63ca('0x2'));var ewinston=require('express-winston');var util=require(_0x63ca('0x3'));var errors=require(_0x63ca('0x4'));var config=require(_0x63ca('0x5'));var logger=require(_0x63ca('0x6'))('api');var authLogger=require(_0x63ca('0x6'))(_0x63ca('0x7'));exports['default']=function(_0x31f5e8){_0x31f5e8[_0x63ca('0x8')](ewinston[_0x63ca('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x18c185,_0x18dd1f){var _0x21b669=_0x63ca('0xa');if(!_['isEmpty'](_0x18c185[_0x63ca('0xb')])){_0x21b669+=_0x63ca('0xc');var _0x279329=_0x18c185[_0x63ca('0xb')];maskSensitiveData(_0x279329);}return util[_0x63ca('0xd')](_0x21b669,_0x18c185['method'],_0x18c185['headers'][_0x63ca('0xe')]?_0x18c185[_0x63ca('0xf')][_0x63ca('0xe')]:_0x18c185['connection'][_0x63ca('0x10')]||_0x18c185['ip'],_0x18c185[_0x63ca('0x11')],_0x18dd1f[_0x63ca('0x12')],_0x18dd1f[_0x63ca('0x13')],_0x18c185[_0x63ca('0x14')]?_0x18c185[_0x63ca('0x14')]['id']:null,_0x18c185[_0x63ca('0x14')]?_0x18c185[_0x63ca('0x14')][_0x63ca('0x15')]:null,_0x18c185['user']?_0x18c185[_0x63ca('0x14')][_0x63ca('0x16')]:null,_0x279329?util['inspect'](_0x279329,![],null):'');}}));_0x31f5e8[_0x63ca('0x8')](ewinston[_0x63ca('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xf1ede3,_0x49fd79){var _0x2103ab='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0xf1ede3[_0x63ca('0xb')]&&_0xf1ede3[_0x63ca('0xb')][_0x63ca('0x17')]&&_0xf1ede3[_0x63ca('0xb')][_0x63ca('0x18')]){_0x2103ab=_0x63ca('0x19');}return util[_0x63ca('0xd')](_0x2103ab,_0xf1ede3[_0x63ca('0x1a')],_0xf1ede3['headers']['x-forwarded-for']?_0xf1ede3[_0x63ca('0xf')][_0x63ca('0xe')]:_0xf1ede3[_0x63ca('0x1b')][_0x63ca('0x10')]||_0xf1ede3['ip'],_0xf1ede3[_0x63ca('0x11')],_0x49fd79[_0x63ca('0x12')],_0x49fd79['responseTime'],_0xf1ede3[_0x63ca('0x14')]?_0xf1ede3[_0x63ca('0x14')]['id']:null,_0xf1ede3[_0x63ca('0x14')]?_0xf1ede3[_0x63ca('0x14')]['name']:null,_0xf1ede3['user']?_0xf1ede3[_0x63ca('0x14')][_0x63ca('0x16')]:null,_0xf1ede3['body']&&_0xf1ede3[_0x63ca('0xb')]['device']?_0xf1ede3[_0x63ca('0xb')][_0x63ca('0x17')]:_0x63ca('0x1c'),_0xf1ede3[_0x63ca('0xb')]&&_0xf1ede3[_0x63ca('0xb')][_0x63ca('0x18')]?_0xf1ede3['body']['agent_id']:'',_0xf1ede3[_0x63ca('0xb')]&&_0xf1ede3[_0x63ca('0xb')][_0x63ca('0x1d')]?_0xf1ede3[_0x63ca('0xb')][_0x63ca('0x1d')]:'');},'ignoreRoute':function(_0x2aa01c){var _0x5a0992=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5a0992[_0x63ca('0x1e')](_0x2aa01c[_0x63ca('0x11')]);}}));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x1f'),require('./api/user'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x20'),require(_0x63ca('0x21')));_0x31f5e8[_0x63ca('0x8')]('/api/voice/contexts',require(_0x63ca('0x22')));_0x31f5e8['use'](_0x63ca('0x23'),require(_0x63ca('0x24')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x25'),require(_0x63ca('0x26')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x27'),require(_0x63ca('0x28')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x29'),require('./api/voiceRecording'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x2a'),require(_0x63ca('0x2b')));_0x31f5e8[_0x63ca('0x8')]('/api/voice/mails',require(_0x63ca('0x2c')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x2d'),require('./api/voiceMailMessage'));_0x31f5e8[_0x63ca('0x8')]('/api/voice/calls/reports',require(_0x63ca('0x2e')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x2f'),require(_0x63ca('0x30')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x31'),require(_0x63ca('0x32')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x33'),require(_0x63ca('0x34')));_0x31f5e8['use'](_0x63ca('0x35'),require(_0x63ca('0x36')));_0x31f5e8['use'](_0x63ca('0x37'),require('./api/trunk'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x38'),require(_0x63ca('0x39')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x3a'),require(_0x63ca('0x3b')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x3c'),require(_0x63ca('0x3d')));_0x31f5e8[_0x63ca('0x8')]('/api/mail/queues',require('./api/mailQueue'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x3e'),require(_0x63ca('0x3f')));_0x31f5e8['use'](_0x63ca('0x40'),require(_0x63ca('0x41')));_0x31f5e8['use'](_0x63ca('0x42'),require(_0x63ca('0x43')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x44'),require(_0x63ca('0x45')));_0x31f5e8['use'](_0x63ca('0x46'),require(_0x63ca('0x47')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x48'),require(_0x63ca('0x49')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x4a'),require('./api/dashboardItem'));_0x31f5e8['use'](_0x63ca('0x4b'),require(_0x63ca('0x4c')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x4d'),require(_0x63ca('0x4e')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x4f'),require(_0x63ca('0x50')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x51'),require(_0x63ca('0x52')));_0x31f5e8[_0x63ca('0x8')]('/api/fax/queues',require('./api/faxQueue'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x53'),require(_0x63ca('0x54')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x55'),require('./api/smsAccount'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x56'),require(_0x63ca('0x57')));_0x31f5e8['use']('/api/sms/interactions',require('./api/smsInteraction'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x58'),require(_0x63ca('0x59')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x5a'),require('./api/smsQueue'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x5b'),require(_0x63ca('0x5c')));_0x31f5e8['use'](_0x63ca('0x5d'),require(_0x63ca('0x5e')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x5f'),require(_0x63ca('0x60')));_0x31f5e8['use'](_0x63ca('0x61'),require(_0x63ca('0x62')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x63'),require(_0x63ca('0x64')));_0x31f5e8['use']('/api/chat/websites',require('./api/chatWebsite'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x65'),require('./api/openchannelQueueReport'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x66'),require('./api/chatApplication'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x67'),require(_0x63ca('0x68')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x69'),require(_0x63ca('0x6a')));_0x31f5e8['use'](_0x63ca('0x6b'),require(_0x63ca('0x6c')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x6d'),require(_0x63ca('0x6e')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x6f'),require(_0x63ca('0x70')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x71'),require(_0x63ca('0x72')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x73'),require(_0x63ca('0x74')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x75'),require(_0x63ca('0x76')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x77'),require(_0x63ca('0x78')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x79'),require(_0x63ca('0x7a')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x7b'),require('./api/cmHopperFinal'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x7c'),require(_0x63ca('0x7d')));_0x31f5e8[_0x63ca('0x8')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x31f5e8[_0x63ca('0x8')]('/api/actions',require('./api/action'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x7e'),require(_0x63ca('0x7f')));_0x31f5e8['use']('/api/canned_answers',require(_0x63ca('0x80')));_0x31f5e8['use']('/api/dispositions',require(_0x63ca('0x81')));_0x31f5e8[_0x63ca('0x8')]('/api/conditions',require('./api/condition'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x82'),require(_0x63ca('0x83')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x84'),require('./api/pause'));_0x31f5e8[_0x63ca('0x8')]('/api/cdr',require(_0x63ca('0x85')));_0x31f5e8['use']('/api/voiceQueuesLog',require(_0x63ca('0x86')));_0x31f5e8[_0x63ca('0x8')]('/api/schedules',require(_0x63ca('0x87')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x88'),require('./api/sound'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x89'),require(_0x63ca('0x8a')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x8b'),require(_0x63ca('0x8c')));_0x31f5e8[_0x63ca('0x8')]('/api/triggers',require(_0x63ca('0x8d')));_0x31f5e8[_0x63ca('0x8')]('/api/variables',require(_0x63ca('0x8e')));_0x31f5e8['use'](_0x63ca('0x8f'),require('./api/integration'));_0x31f5e8[_0x63ca('0x8')]('/api/integrations/reports',require('./api/integrationReport'));_0x31f5e8['use'](_0x63ca('0x90'),require(_0x63ca('0x91')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x92'),require(_0x63ca('0x93')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x94'),require(_0x63ca('0x95')));_0x31f5e8['use'](_0x63ca('0x96'),require(_0x63ca('0x97')));_0x31f5e8[_0x63ca('0x8')]('/api/analytics/field_reports',require(_0x63ca('0x98')));_0x31f5e8['use'](_0x63ca('0x99'),require('./api/analyticTreeReport'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x9a'),require(_0x63ca('0x9b')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x9c'),require(_0x63ca('0x9d')));_0x31f5e8[_0x63ca('0x8')]('/api/integrations/salesforce/fields',require(_0x63ca('0x9e')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x9f'),require('./api/intSugarcrmAccount'));_0x31f5e8['use'](_0x63ca('0xa0'),require(_0x63ca('0xa1')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xa2'),require('./api/intSugarcrmField'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xa3'),require(_0x63ca('0xa4')));_0x31f5e8[_0x63ca('0x8')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x31f5e8[_0x63ca('0x8')]('/api/integrations/desk/fields',require(_0x63ca('0xa5')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xa6'),require(_0x63ca('0xa7')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xa8'),require(_0x63ca('0xa9')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xaa'),require('./api/intZohoField'));_0x31f5e8[_0x63ca('0x8')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xab'),require(_0x63ca('0xac')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xad'),require(_0x63ca('0xae')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xaf'),require(_0x63ca('0xb0')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xb1'),require('./api/intFreshdeskConfiguration'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xb2'),require(_0x63ca('0xb3')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xb4'),require('./api/intVtigerAccount'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xb5'),require(_0x63ca('0xb6')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xb7'),require(_0x63ca('0xb8')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xb9'),require(_0x63ca('0xba')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xbb'),require('./api/intServicenowConfiguration'));_0x31f5e8[_0x63ca('0x8')]('/api/integrations/servicenow/fields',require(_0x63ca('0xbc')));_0x31f5e8[_0x63ca('0x8')]('/api/integrations/dynamics365/accounts',require(_0x63ca('0xbd')));_0x31f5e8['use'](_0x63ca('0xbe'),require(_0x63ca('0xbf')));_0x31f5e8[_0x63ca('0x8')]('/api/integrations/dynamics365/fields',require(_0x63ca('0xc0')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xc1'),require(_0x63ca('0xc2')));_0x31f5e8['use'](_0x63ca('0xc3'),require(_0x63ca('0xc4')));_0x31f5e8['use'](_0x63ca('0xc5'),require(_0x63ca('0xc6')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xc7'),require(_0x63ca('0xc8')));_0x31f5e8[_0x63ca('0x8')]('/api/chat/reports/queue',require(_0x63ca('0xc9')));_0x31f5e8[_0x63ca('0x8')]('/api/chat/internal/messages',require(_0x63ca('0xca')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xcb'),require('./api/jscriptyAnswerReport'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xcc'),require(_0x63ca('0xcd')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xce'),require(_0x63ca('0xcf')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xd0'),require(_0x63ca('0xd1')));_0x31f5e8[_0x63ca('0x8')]('/api/square/reports',require(_0x63ca('0xd2')));_0x31f5e8['use'](_0x63ca('0xd3'),require(_0x63ca('0xd4')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xd5'),require(_0x63ca('0xd6')));_0x31f5e8['use']('/api/settings',require('./api/setting'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xd7'),require('./api/squareOdbc'));_0x31f5e8['use'](_0x63ca('0xd8'),require(_0x63ca('0xd9')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xda'),require(_0x63ca('0xdb')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xdc'),require(_0x63ca('0xdd')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xde'),require(_0x63ca('0xdf')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xe0'),require(_0x63ca('0xe1')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xe2'),require(_0x63ca('0xe3')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xe4'),require(_0x63ca('0xe5')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xe6'),require(_0x63ca('0xe7')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xe8'),require(_0x63ca('0xe9')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xea'),require(_0x63ca('0xeb')));_0x31f5e8['use'](_0x63ca('0xec'),require(_0x63ca('0xed')));_0x31f5e8[_0x63ca('0x8')]('/api/fax/reports/transfer',require(_0x63ca('0xee')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xef'),require(_0x63ca('0xf0')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xf1'),require(_0x63ca('0xf2')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xf3'),require(_0x63ca('0xf4')));_0x31f5e8['use']('/api/voice/prefixes',require('./api/voicePrefix'));_0x31f5e8[_0x63ca('0x8')]('/api/userProfiles',require(_0x63ca('0xf5')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xf6'),require(_0x63ca('0xf7')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xf8'),require('./api/userProfileResource'));_0x31f5e8['use'](_0x63ca('0xf9'),require(_0x63ca('0xfa')));_0x31f5e8['use'](_0x63ca('0xfb'),require(_0x63ca('0xfc')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xfd'),require(_0x63ca('0xfe')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0xff'),require(_0x63ca('0x100')));_0x31f5e8['use'](_0x63ca('0x101'),require(_0x63ca('0x102')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x103'),require(_0x63ca('0x104')));_0x31f5e8[_0x63ca('0x8')]('/api/whatsapp/reports/transfer',require(_0x63ca('0x105')));_0x31f5e8[_0x63ca('0x8')]('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x106'),require(_0x63ca('0x107')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x108'),require('./api/realtime'));_0x31f5e8[_0x63ca('0x8')]('/api/auth/local',require(_0x63ca('0x109')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x10a'),require(_0x63ca('0x10b')));_0x31f5e8['use'](_0x63ca('0x10c'),require(_0x63ca('0x10d')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x10e'),require(_0x63ca('0x10f')));_0x31f5e8[_0x63ca('0x8')]('/api/version',require(_0x63ca('0x110')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x111'),require(_0x63ca('0x112')));_0x31f5e8[_0x63ca('0x8')]('/api/pm2',require(_0x63ca('0x113')));_0x31f5e8[_0x63ca('0x8')]('/api/webbar',require(_0x63ca('0x114')));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x115'),express['static'](path[_0x63ca('0x116')](config[_0x63ca('0x117')],_0x63ca('0x115'))));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x118'),express[_0x63ca('0x119')](path['join'](config['root'],_0x63ca('0x118'))));_0x31f5e8[_0x63ca('0x8')]('/demo',express[_0x63ca('0x119')](path[_0x63ca('0x116')](config['root'],_0x63ca('0x11a'))));_0x31f5e8[_0x63ca('0x8')](_0x63ca('0x11b'),express['static'](path[_0x63ca('0x116')](config['root'],_0x63ca('0x11c'),_0x63ca('0x11d'))));_0x31f5e8['use']('/plugins',express[_0x63ca('0x119')](path[_0x63ca('0x116')](config[_0x63ca('0x117')],_0x63ca('0x11e'))));_0x31f5e8['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x63ca('0x11f')](errors[0x194]);_0x31f5e8[_0x63ca('0x120')]('/*')['get'](function(_0x1a2866,_0x45cc40){_0x45cc40[_0x63ca('0x121')](path['resolve'](_0x31f5e8['get'](_0x63ca('0x122'))+_0x63ca('0x123')));});};var sensitiveFields=[_0x63ca('0x124'),_0x63ca('0x125'),_0x63ca('0x126'),_0x63ca('0x127'),_0x63ca('0x128'),_0x63ca('0x129'),_0x63ca('0x12a'),_0x63ca('0x12b'),_0x63ca('0x12c'),_0x63ca('0x12d'),_0x63ca('0x12e'),'clientId',_0x63ca('0x12f'),_0x63ca('0x130'),_0x63ca('0x131'),_0x63ca('0x132'),_0x63ca('0x133'),_0x63ca('0x134'),'channelSecret','accessToken','accessTokenSecret','authToken',_0x63ca('0x135'),_0x63ca('0x136'),_0x63ca('0x137'),_0x63ca('0x138'),_0x63ca('0x139'),_0x63ca('0x13a'),_0x63ca('0x13b'),_0x63ca('0x13c'),_0x63ca('0x13d'),_0x63ca('0x13e'),'secretaccesskey',_0x63ca('0x13f'),_0x63ca('0x14'),_0x63ca('0x140'),_0x63ca('0x141'),_0x63ca('0x142'),_0x63ca('0x143'),_0x63ca('0x144'),_0x63ca('0x145'),'oldPassword'];function maskSensitiveData(_0xdcc2bb){var _0x1e94eb=/(?!^)[\s\S](?!$)/g;if(!_[_0x63ca('0x146')](_0xdcc2bb))return;for(var _0x208ddc in _0xdcc2bb){if(_[_0x63ca('0x147')](_0xdcc2bb[_0x208ddc])){for(var _0x3c498e=0x0;_0x3c498e<_0xdcc2bb[_0x208ddc][_0x63ca('0x148')];_0x3c498e++){maskSensitiveData(_0xdcc2bb[_0x208ddc][_0x3c498e]);}}else if(_[_0x63ca('0x146')](_0xdcc2bb[_0x208ddc])){maskSensitiveData(_0xdcc2bb[_0x208ddc]);}else if(_[_0x63ca('0x149')](_0xdcc2bb[_0x208ddc])){_0xdcc2bb[_0x208ddc]=_0xdcc2bb[_0x208ddc]['replace'](/{{{/g,_0x63ca('0x14a'))[_0x63ca('0x14b')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0x63ca('0x14b')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x208ddc)){_0xdcc2bb[_0x208ddc]=_0xdcc2bb[_0x208ddc][_0x63ca('0x14b')](_0x1e94eb,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index a1c3ad4..61a4b0c 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x600c=['../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','bluebird','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc'];(function(_0x599d25,_0x591813){var _0x4d9c68=function(_0xf7348){while(--_0xf7348){_0x599d25['push'](_0x599d25['shift']());}};_0x4d9c68(++_0x591813);}(_0x600c,0x6b));var _0xc600=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x600c[_0x29d94e];return _0x106237;};'use strict';var jayson=require(_0xc600('0x0'));var BPromise=require(_0xc600('0x1'));var _=require(_0xc600('0x2'));var config=require(_0xc600('0x3'));exports[_0xc600('0x4')]=function(){return new BPromise(function(_0x6c09c0,_0xefbea6){var _0x16f539={};_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x5')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x7')));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x8')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x9')));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0xa')));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0xb')));_0x16f539=_['merge'](_0x16f539,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0xc')));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0xd')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0xe')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0xf')));_0x16f539=_['merge'](_0x16f539,require('../api/mailServerIn/mailServerIn.rpc'));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x10')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x11')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require('../api/mailInteraction/mailInteraction.rpc'));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x12')));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x13')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x14')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x15')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x16')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x17')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x18')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require('../api/faxQueue/faxQueue.rpc'));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x19')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x1a')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require('../api/smsInteraction/smsInteraction.rpc'));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x1b')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require('../api/smsQueue/smsQueue.rpc'));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x1c')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x1d')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x1e')));_0x16f539=_['merge'](_0x16f539,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x1f')));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x20')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x21')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x22')));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x23')));_0x16f539=_['merge'](_0x16f539,require('../api/cmHopper/cmHopper.rpc'));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x24')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x25')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x26')));_0x16f539=_['merge'](_0x16f539,require('../api/pause/pause.rpc'));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x27')));_0x16f539=_['merge'](_0x16f539,require('../api/template/template.rpc'));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x28')));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x29')));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x2a')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x2b')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x2c')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x2d')));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x2e')));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x2f')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x16f539=_[_0xc600('0x6')](_0x16f539,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x30')));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x31')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x32')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x33')));_0x16f539=_['merge'](_0x16f539,require('../api/setting/setting.rpc'));_0x16f539=_['merge'](_0x16f539,require('../api/squareOdbc/squareOdbc.rpc'));_0x16f539=_['merge'](_0x16f539,require('../api/squareProject/squareProject.rpc'));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x34')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require('../api/squareMessage/squareMessage.rpc'));_0x16f539=_[_0xc600('0x6')](_0x16f539,require('../api/campaign/campaign.rpc'));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x35')));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x36')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x16f539=_['merge'](_0x16f539,require(_0xc600('0x37')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x38')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x39')));_0x16f539=_[_0xc600('0x6')](_0x16f539,require(_0xc600('0x3a')));var _0x286bb2=jayson[_0xc600('0x3b')](_0x16f539)['http']();var _0x5957e7=config[_0xc600('0x3c')][_0xc600('0x3d')]||config[_0xc600('0x3d')]+0x1;var _0x2a0edd=config[_0xc600('0x3c')]['ip']||_0xc600('0x3e');_0x286bb2['on']('error',function(_0x516e1e){return _0xefbea6(_0x516e1e);});_0x286bb2[_0xc600('0x4')](_0x5957e7,_0x2a0edd,function(){console['log'](_0xc600('0x3f'),_0x2a0edd,_0x5957e7);require(_0xc600('0x40'))[_0xc600('0x41')]();return _0x6c09c0('RPC\x20listening\x20on\x20'+_0x2a0edd+':'+_0x5957e7);});});}; \ No newline at end of file +var _0xe6cb=['../api/trunk/trunk.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/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/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','http','rpc','port','localhost','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc'];(function(_0x344191,_0x3059d3){var _0x2e5e90=function(_0x53d6b8){while(--_0x53d6b8){_0x344191['push'](_0x344191['shift']());}};_0x2e5e90(++_0x3059d3);}(_0xe6cb,0x1f2));var _0xbe6c=function(_0x2edde1,_0x1e1d7f){_0x2edde1=_0x2edde1-0x0;var _0x37e050=_0xe6cb[_0x2edde1];return _0x37e050;};'use strict';var jayson=require(_0xbe6c('0x0'));var BPromise=require(_0xbe6c('0x1'));var _=require(_0xbe6c('0x2'));var config=require(_0xbe6c('0x3'));exports['listen']=function(){return new BPromise(function(_0x36cabb,_0x57137a){var _0x590abf={};_0x590abf=_['merge'](_0x590abf,require(_0xbe6c('0x4')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x6')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x7')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x8')));_0x590abf=_['merge'](_0x590abf,require(_0xbe6c('0x9')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0xa')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0xb')));_0x590abf=_['merge'](_0x590abf,require(_0xbe6c('0xc')));_0x590abf=_['merge'](_0x590abf,require(_0xbe6c('0xd')));_0x590abf=_['merge'](_0x590abf,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/mailServerIn/mailServerIn.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/mailAccount/mailAccount.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0xe')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/mailInteraction/mailInteraction.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0xf')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x10')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x11')));_0x590abf=_['merge'](_0x590abf,require(_0xbe6c('0x12')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x13')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/faxInteraction/faxInteraction.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x14')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x15')));_0x590abf=_['merge'](_0x590abf,require(_0xbe6c('0x16')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x17')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/smsInteraction/smsInteraction.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x18')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x19')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x1a')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x1b')));_0x590abf=_['merge'](_0x590abf,require(_0xbe6c('0x1c')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x1d')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x1e')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x1f')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x20')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x21')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/cmContact/cmContact.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x22')));_0x590abf=_['merge'](_0x590abf,require(_0xbe6c('0x23')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x24')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x25')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x26')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x27')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x28')));_0x590abf=_['merge'](_0x590abf,require(_0xbe6c('0x29')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x2a')));_0x590abf=_['merge'](_0x590abf,require(_0xbe6c('0x2b')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x2c')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x2d')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x2e')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x2f')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x30')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x590abf=_['merge'](_0x590abf,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x31')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x32')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x33')));_0x590abf=_['merge'](_0x590abf,require(_0xbe6c('0x34')));_0x590abf=_['merge'](_0x590abf,require(_0xbe6c('0x35')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/setting/setting.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/squareOdbc/squareOdbc.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/squareProject/squareProject.rpc'));_0x590abf=_['merge'](_0x590abf,require(_0xbe6c('0x36')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x37')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x38')));_0x590abf=_['merge'](_0x590abf,require(_0xbe6c('0x39')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x3a')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x3b')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x3c')));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require(_0xbe6c('0x3d')));_0x590abf=_['merge'](_0x590abf,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x590abf=_[_0xbe6c('0x5')](_0x590abf,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x506570=jayson[_0xbe6c('0x3e')](_0x590abf)[_0xbe6c('0x3f')]();var _0x2e55f1=config[_0xbe6c('0x40')]['port']||config[_0xbe6c('0x41')]+0x1;var _0x260453=config['rpc']['ip']||_0xbe6c('0x42');_0x506570['on']('error',function(_0x7fb664){return _0x57137a(_0x7fb664);});_0x506570[_0xbe6c('0x43')](_0x2e55f1,_0x260453,function(){console[_0xbe6c('0x44')](_0xbe6c('0x45'),_0x260453,_0x2e55f1);require(_0xbe6c('0x46'))[_0xbe6c('0x47')]();return _0x36cabb(_0xbe6c('0x48')+_0x260453+':'+_0x2e55f1);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 1e65a7b..6a15f09 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 _0x5419=['setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','hangup','substring','search','no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits','prototype','sendRequest','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','format','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','extension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call'];(function(_0x35245d,_0x193583){var _0x184a83=function(_0x2d46bd){while(--_0x2d46bd){_0x35245d['push'](_0x35245d['shift']());}};_0x184a83(++_0x193583);}(_0x5419,0x175));var _0x9541=function(_0x4b6813,_0x369619){_0x4b6813=_0x4b6813-0x0;var _0x1119c2=_0x5419[_0x4b6813];return _0x1119c2;};'use strict';var util=require(_0x9541('0x0'));var _=require(_0x9541('0x1'));var EventEmitter=require(_0x9541('0x2'))[_0x9541('0x3')];var AGIReply=require(_0x9541('0x4'));var AGIError=require(_0x9541('0x5'));function AGIChannel(_0x15418a){var _0x317e1e=this,_0x307a35=new AGIReply(),_0xacdcfa=![],_0x4d8224={};EventEmitter[_0x9541('0x6')](_0x317e1e);_0x15418a[_0x9541('0x7')](_0x9541('0x8'));_0x15418a[_0x9541('0x9')](0x8*0x3c*0x3c*0x3e8);_0x307a35[_0x9541('0x7')](_0x9541('0x8'));_0x307a35['on'](_0x9541('0xa'),function(_0x1140ef){for(var _0x5b1893 in _0x1140ef){_0x317e1e[_0x5b1893]=_0x1140ef[_0x5b1893];}_0x317e1e[_0x9541('0xb')]('ready');});_0x307a35['on'](_0x9541('0xc'),function(_0x3dec9b){if(_0x3dec9b[_0x9541('0xd')]()==_0x9541('0xe')){_0x317e1e[_0x9541('0xb')](_0x9541('0xe'));return;}if(_0x3dec9b[_0x9541('0xf')](0x0,0xb)=='520-Invalid'){_0xacdcfa=!![];}if(_0xacdcfa){_0x4d8224['rx']+=_0x3dec9b+'\x0a';if(_0x3dec9b[_0x9541('0x10')]('520\x20End\x20of\x20proper')!=-0x1){_0xacdcfa=![];}}else{_0x4d8224['rx']=_0x3dec9b;}if(_0xacdcfa){return;}if(typeof _0x4d8224['cb']=='function'){var _0x75669e=_0x4d8224['rx']['substring'](0x0,0x3),_0x4f97a9=null,_0x40cc60=null;_0x75669e=parseInt(_0x75669e);if(isNaN(_0x75669e)){_0x4d8224['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9541('0x11')});return;}if(_0x75669e!=0xc8){_0x4d8224['cb'](null,{'code':_0x75669e,'result':-0x1,'extra':'KO'});return;}_0x4f97a9=_0x4d8224['rx'][_0x9541('0xf')](0x4)[_0x9541('0x12')](_0x9541('0x13'),'');if(_0x4f97a9[_0x9541('0x14')]('\x20')!=-0x1){_0x4f97a9=_0x4f97a9[_0x9541('0x15')](0x0,_0x4f97a9['indexOf']('\x20'));}if(_[_0x9541('0x16')](_0x4f97a9,'-1')){_0x4f97a9=parseInt(_0x4f97a9);}_0x40cc60=_0x4d8224['rx']['split']('\x20');if(_0x40cc60[_0x9541('0x17')]==0x3){_0x40cc60=_0x40cc60[0x2]['substring'](0x1,_0x40cc60[0x2][_0x9541('0x17')]-0x1);}else if(_0x40cc60['length']>0x3){var _0x92ca2f=/\((.+)\)/;var _0x4468e4=_0x4d8224['rx'][_0x9541('0x18')](_0x92ca2f);if(_0x4468e4){_0x40cc60=_0x4468e4[0x1];}else{_0x40cc60=null;}}else{_0x40cc60=null;}_0x4d8224['cb'](null,{'code':_0x75669e,'result':_0x4f97a9,'extra':_0x40cc60});}});_0x15418a['on'](_0x9541('0x19'),function(_0xf5a87e){_0x317e1e[_0x9541('0xb')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0xf5a87e[_0x9541('0x1a')]));});_0x15418a['on'](_0x9541('0x1b'),function(){_0x317e1e['emit']('close',new AGIError(_0x9541('0x1c')));});_0x15418a['on'](_0x9541('0x1d'),function(){_0x317e1e[_0x9541('0xb')](_0x9541('0x1d'),new AGIError(_0x9541('0x1e')));_0x15418a[_0x9541('0x1f')]();});_0x15418a[_0x9541('0x20')](_0x307a35);this[_0x9541('0x21')]=function(_0x30f965,_0x1f2d91){var _0x30f965=_0x30f965||'',_0x1f2d91=typeof _0x1f2d91==_0x9541('0x22')?_0x1f2d91:new Function();_0x4d8224={'tx':_0x30f965,'rx':'','cb':_0x1f2d91};_0x15418a[_0x9541('0x23')](_0x30f965+'\x0a');},this[_0x9541('0x1b')]=function(){_0x15418a[_0x9541('0x1f')]();};}util[_0x9541('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x9541('0x25')][_0x9541('0x26')]=function(_0x451013){return this[_0x9541('0x21')]['sync'](this,_0x451013);};AGIChannel[_0x9541('0x25')]['answer']=function(){return this[_0x9541('0x26')](_0x9541('0x27'));};AGIChannel[_0x9541('0x25')][_0x9541('0x28')]=function(_0x4b6faf,_0x2e36c8,_0x46ea7e){_0x4b6faf=_0x4b6faf===undefined?_0x9541('0x29'):_0x4b6faf;_0x2e36c8=_0x2e36c8===undefined?'5':_0x2e36c8;_0x46ea7e=_0x46ea7e===undefined?'1':_0x46ea7e;return this[_0x9541('0x26')](util['format'](_0x9541('0x2a'),_0x4b6faf,_0x2e36c8*0x3e8,_0x46ea7e));};AGIChannel['prototype'][_0x9541('0x2b')]=function(_0x19c710){_0x19c710=_0x19c710||'NO\x20MESSAGE';return this[_0x9541('0x26')](util[_0x9541('0x2c')]('VERBOSE\x20\x22%s\x22',_0x19c710));};AGIChannel[_0x9541('0x25')][_0x9541('0x2d')]=function(_0x4d83ba,_0x259243){if(_['isArray'](_0x259243)){return this[_0x9541('0x26')](util[_0x9541('0x2c')](_0x9541('0x2e'),_0x4d83ba,_0x259243[_0x9541('0x2f')](',')));}return this[_0x9541('0x26')](util[_0x9541('0x2c')](_0x9541('0x2e'),_0x4d83ba,_0x259243));};AGIChannel['prototype'][_0x9541('0x30')]=function(_0x451816){return this[_0x9541('0x26')](util[_0x9541('0x2c')](_0x9541('0x31'),_0x451816));};AGIChannel[_0x9541('0x25')][_0x9541('0x32')]=function(_0x2f5033){return this[_0x9541('0x26')](util[_0x9541('0x2c')](_0x9541('0x33'),_0x2f5033));};AGIChannel[_0x9541('0x25')][_0x9541('0x34')]=function(_0x1275da){return this[_0x9541('0x26')](util[_0x9541('0x2c')](_0x9541('0x35'),_0x1275da));};AGIChannel[_0x9541('0x25')][_0x9541('0xe')]=function(){return this[_0x9541('0x26')]('HANGUP');};AGIChannel[_0x9541('0x25')]['setVariable']=function(_0x5afdff,_0x4d4268){var _0x5f59d8=_[_0x9541('0x36')](_0x4d4268)||_[_0x9541('0x37')](_0x4d4268)?_0x4d4268[_0x9541('0x38')]():_0x4d4268;return this['sendRequest'](util[_0x9541('0x2c')](_0x9541('0x39'),_0x5afdff,_0x5f59d8?_0x5f59d8['toString']()[_0x9541('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9541('0x25')][_0x9541('0x3a')]=function(_0x28a77b,_0x12b6ff){return this[_0x9541('0x26')](util[_0x9541('0x2c')](_0x9541('0x3b'),_0x28a77b,_0x12b6ff));};AGIChannel[_0x9541('0x25')][_0x9541('0x3c')]=function(_0x4799a4,_0x4d48c0){return this[_0x9541('0x26')](util[_0x9541('0x2c')](_0x9541('0x3d'),_0x4799a4,_0x4d48c0));};AGIChannel[_0x9541('0x25')][_0x9541('0x3e')]=function(_0x42f654,_0x1ce444){return this[_0x9541('0x26')](util[_0x9541('0x2c')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x42f654,_0x1ce444));};AGIChannel[_0x9541('0x25')]['continueAt']=function(_0x9af222,_0x250c10,_0x6a0ce3){_0x250c10=_0x250c10||this[_0x9541('0x3f')];_0x6a0ce3=_0x6a0ce3||0x1;this['setContext'](_0x9af222);this[_0x9541('0x32')](_0x250c10);this[_0x9541('0x34')](_0x6a0ce3);return this[_0x9541('0x2b')](util[_0x9541('0x2c')](_0x9541('0x40'),_0x9af222,_0x250c10,_0x6a0ce3));};AGIChannel[_0x9541('0x25')][_0x9541('0x41')]=function(_0x410a11){return this[_0x9541('0x26')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x410a11));};AGIChannel[_0x9541('0x25')][_0x9541('0x42')]=function(_0x8614ce,_0x5e9c1a,_0x183388,_0x4e835e,_0x1aef0a,_0x4f7768){_0x5e9c1a=_0x5e9c1a||_0x9541('0x43');_0x183388=_0x183388||'';_0x4e835e=_0x4e835e===undefined?-0x1:_0x4e835e==='-1'?-0x1:_0x4e835e*0x3e8;_0x1aef0a=_0x1aef0a===undefined?'':'s='+_0x1aef0a;_0x4f7768=_0x4f7768?_0x9541('0x44'):'';return this[_0x9541('0x26')](util[_0x9541('0x2c')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x8614ce,_0x5e9c1a,_0x183388,_0x4e835e,_0x4f7768,_0x1aef0a));};AGIChannel[_0x9541('0x25')][_0x9541('0x45')]=function(_0x4308ca,_0x5786a6){_0x5786a6=_0x5786a6||'';return this[_0x9541('0x26')](util[_0x9541('0x2c')](_0x9541('0x46'),_0x4308ca,_0x5786a6));};AGIChannel[_0x9541('0x25')]['agi']=function(_0x531890){return this['exec']('AGI',_0x531890);};AGIChannel[_0x9541('0x25')][_0x9541('0x47')]=function(_0x3681b9){return this[_0x9541('0x2d')](_0x9541('0x48'),_0x3681b9);};AGIChannel['prototype'][_0x9541('0x19')]=function(_0x1f3064,_0x458b3c){this['noop'](util['format'](_0x9541('0x49'),_0x1f3064['id'],_0x1f3064[_0x9541('0x4a')],_0x458b3c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9541('0x4b')]=AGIChannel; \ No newline at end of file +var _0xff36=['BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','call','setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','function','no\x20code','replace','result=','substr','indexOf','startsWith','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','inherits','prototype','sync','answer','sendRequest','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xff36,0x1de));var _0x6ff3=function(_0x1d4174,_0x5827b3){_0x1d4174=_0x1d4174-0x0;var _0x472d5e=_0xff36[_0x1d4174];return _0x472d5e;};'use strict';var util=require(_0x6ff3('0x0'));var _=require(_0x6ff3('0x1'));var EventEmitter=require(_0x6ff3('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x44b7a6){var _0x3845cb=this,_0x462896=new AGIReply(),_0x597443=![],_0x43a95b={};EventEmitter[_0x6ff3('0x3')](_0x3845cb);_0x44b7a6[_0x6ff3('0x4')](_0x6ff3('0x5'));_0x44b7a6[_0x6ff3('0x6')](0x8*0x3c*0x3c*0x3e8);_0x462896[_0x6ff3('0x4')](_0x6ff3('0x5'));_0x462896['on'](_0x6ff3('0x7'),function(_0x2142f2){for(var _0x1428f6 in _0x2142f2){_0x3845cb[_0x1428f6]=_0x2142f2[_0x1428f6];}_0x3845cb[_0x6ff3('0x8')]('ready');});_0x462896['on'](_0x6ff3('0x9'),function(_0x415ab7){if(_0x415ab7[_0x6ff3('0xa')]()==_0x6ff3('0xb')){_0x3845cb[_0x6ff3('0x8')]('hangup');return;}if(_0x415ab7[_0x6ff3('0xc')](0x0,0xb)==_0x6ff3('0xd')){_0x597443=!![];}if(_0x597443){_0x43a95b['rx']+=_0x415ab7+'\x0a';if(_0x415ab7[_0x6ff3('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x597443=![];}}else{_0x43a95b['rx']=_0x415ab7;}if(_0x597443){return;}if(typeof _0x43a95b['cb']==_0x6ff3('0xf')){var _0x21d07f=_0x43a95b['rx'][_0x6ff3('0xc')](0x0,0x3),_0x5a0f77=null,_0x382e31=null;_0x21d07f=parseInt(_0x21d07f);if(isNaN(_0x21d07f)){_0x43a95b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6ff3('0x10')});return;}if(_0x21d07f!=0xc8){_0x43a95b['cb'](null,{'code':_0x21d07f,'result':-0x1,'extra':'KO'});return;}_0x5a0f77=_0x43a95b['rx'][_0x6ff3('0xc')](0x4)[_0x6ff3('0x11')](_0x6ff3('0x12'),'');if(_0x5a0f77['indexOf']('\x20')!=-0x1){_0x5a0f77=_0x5a0f77[_0x6ff3('0x13')](0x0,_0x5a0f77[_0x6ff3('0x14')]('\x20'));}if(_[_0x6ff3('0x15')](_0x5a0f77,'-1')){_0x5a0f77=parseInt(_0x5a0f77);}_0x382e31=_0x43a95b['rx']['split']('\x20');if(_0x382e31[_0x6ff3('0x16')]==0x3){_0x382e31=_0x382e31[0x2][_0x6ff3('0xc')](0x1,_0x382e31[0x2]['length']-0x1);}else if(_0x382e31[_0x6ff3('0x16')]>0x3){var _0xe89b85=/\((.+)\)/;var _0x176b8d=_0x43a95b['rx']['match'](_0xe89b85);if(_0x176b8d){_0x382e31=_0x176b8d[0x1];}else{_0x382e31=null;}}else{_0x382e31=null;}_0x43a95b['cb'](null,{'code':_0x21d07f,'result':_0x5a0f77,'extra':_0x382e31});}});_0x44b7a6['on'](_0x6ff3('0x17'),function(_0x411e15){_0x3845cb[_0x6ff3('0x8')]('error',new AGIError(_0x6ff3('0x18'),_0x411e15[_0x6ff3('0x19')]));});_0x44b7a6['on']('close',function(){_0x3845cb[_0x6ff3('0x8')](_0x6ff3('0x1a'),new AGIError(_0x6ff3('0x1b')));});_0x44b7a6['on'](_0x6ff3('0x1c'),function(){_0x3845cb['emit'](_0x6ff3('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x44b7a6[_0x6ff3('0x1d')]();});_0x44b7a6[_0x6ff3('0x1e')](_0x462896);this[_0x6ff3('0x1f')]=function(_0x573f3c,_0x14cd05){var _0x573f3c=_0x573f3c||'',_0x14cd05=typeof _0x14cd05=='function'?_0x14cd05:new Function();_0x43a95b={'tx':_0x573f3c,'rx':'','cb':_0x14cd05};_0x44b7a6[_0x6ff3('0x20')](_0x573f3c+'\x0a');},this[_0x6ff3('0x1a')]=function(){_0x44b7a6[_0x6ff3('0x1d')]();};}util[_0x6ff3('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x6ff3('0x22')]['sendRequest']=function(_0x22f68c){return this['command'][_0x6ff3('0x23')](this,_0x22f68c);};AGIChannel[_0x6ff3('0x22')][_0x6ff3('0x24')]=function(){return this[_0x6ff3('0x25')](_0x6ff3('0x26'));};AGIChannel[_0x6ff3('0x22')][_0x6ff3('0x27')]=function(_0x502daf,_0x5d4a13,_0x5c2681){_0x502daf=_0x502daf===undefined?_0x6ff3('0x28'):_0x502daf;_0x5d4a13=_0x5d4a13===undefined?'5':_0x5d4a13;_0x5c2681=_0x5c2681===undefined?'1':_0x5c2681;return this['sendRequest'](util[_0x6ff3('0x29')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x502daf,_0x5d4a13*0x3e8,_0x5c2681));};AGIChannel[_0x6ff3('0x22')][_0x6ff3('0x2a')]=function(_0x1d0552){_0x1d0552=_0x1d0552||_0x6ff3('0x2b');return this['sendRequest'](util[_0x6ff3('0x29')](_0x6ff3('0x2c'),_0x1d0552));};AGIChannel[_0x6ff3('0x22')][_0x6ff3('0x2d')]=function(_0x15c96d,_0x1b684c){if(_[_0x6ff3('0x2e')](_0x1b684c)){return this[_0x6ff3('0x25')](util[_0x6ff3('0x29')](_0x6ff3('0x2f'),_0x15c96d,_0x1b684c['join'](',')));}return this[_0x6ff3('0x25')](util['format']('EXEC\x20%s\x20%s',_0x15c96d,_0x1b684c));};AGIChannel[_0x6ff3('0x22')][_0x6ff3('0x30')]=function(_0x1cbdbd){return this['sendRequest'](util[_0x6ff3('0x29')]('SET\x20CONTEXT\x20%s',_0x1cbdbd));};AGIChannel[_0x6ff3('0x22')][_0x6ff3('0x31')]=function(_0x5d0e0c){return this[_0x6ff3('0x25')](util['format'](_0x6ff3('0x32'),_0x5d0e0c));};AGIChannel['prototype']['setPriority']=function(_0x53dc6d){return this[_0x6ff3('0x25')](util[_0x6ff3('0x29')](_0x6ff3('0x33'),_0x53dc6d));};AGIChannel[_0x6ff3('0x22')]['hangup']=function(){return this[_0x6ff3('0x25')]('HANGUP');};AGIChannel[_0x6ff3('0x22')]['setVariable']=function(_0x500c7e,_0x2eb744){var _0x1dd461=_[_0x6ff3('0x34')](_0x2eb744)||_[_0x6ff3('0x35')](_0x2eb744)?_0x2eb744['toString']():_0x2eb744;return this[_0x6ff3('0x25')](util[_0x6ff3('0x29')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x500c7e,_0x1dd461?_0x1dd461[_0x6ff3('0x36')]()[_0x6ff3('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x6ff3('0x37')]=function(_0x422425,_0xe36445){return this[_0x6ff3('0x25')](util[_0x6ff3('0x29')](_0x6ff3('0x38'),_0x422425,_0xe36445));};AGIChannel['prototype'][_0x6ff3('0x39')]=function(_0x40b99b,_0x492dba){return this[_0x6ff3('0x25')](util[_0x6ff3('0x29')](_0x6ff3('0x3a'),_0x40b99b,_0x492dba));};AGIChannel[_0x6ff3('0x22')][_0x6ff3('0x3b')]=function(_0x59e4c7,_0xe9759c){return this[_0x6ff3('0x25')](util[_0x6ff3('0x29')](_0x6ff3('0x3c'),_0x59e4c7,_0xe9759c));};AGIChannel[_0x6ff3('0x22')][_0x6ff3('0x3d')]=function(_0x50cd17,_0xe8dbbf,_0x42e8eb){_0xe8dbbf=_0xe8dbbf||this[_0x6ff3('0x3e')];_0x42e8eb=_0x42e8eb||0x1;this[_0x6ff3('0x30')](_0x50cd17);this[_0x6ff3('0x31')](_0xe8dbbf);this[_0x6ff3('0x3f')](_0x42e8eb);return this['noop'](util[_0x6ff3('0x29')](_0x6ff3('0x40'),_0x50cd17,_0xe8dbbf,_0x42e8eb));};AGIChannel[_0x6ff3('0x22')]['getVariable']=function(_0x30ed9f){return this[_0x6ff3('0x25')](util[_0x6ff3('0x29')](_0x6ff3('0x41'),_0x30ed9f));};AGIChannel[_0x6ff3('0x22')][_0x6ff3('0x42')]=function(_0x5b324e,_0x350141,_0x38223a,_0x984623,_0x231219,_0xe3618e){_0x350141=_0x350141||_0x6ff3('0x43');_0x38223a=_0x38223a||'';_0x984623=_0x984623===undefined?-0x1:_0x984623==='-1'?-0x1:_0x984623*0x3e8;_0x231219=_0x231219===undefined?'':'s='+_0x231219;_0xe3618e=_0xe3618e?_0x6ff3('0x44'):'';return this[_0x6ff3('0x25')](util['format'](_0x6ff3('0x45'),_0x5b324e,_0x350141,_0x38223a,_0x984623,_0xe3618e,_0x231219));};AGIChannel[_0x6ff3('0x22')][_0x6ff3('0x46')]=function(_0x450ddc,_0x5eef0f){_0x5eef0f=_0x5eef0f||'';return this[_0x6ff3('0x25')](util[_0x6ff3('0x29')](_0x6ff3('0x47'),_0x450ddc,_0x5eef0f));};AGIChannel[_0x6ff3('0x22')][_0x6ff3('0x48')]=function(_0x3590f2){return this[_0x6ff3('0x2d')](_0x6ff3('0x49'),_0x3590f2);};AGIChannel[_0x6ff3('0x22')][_0x6ff3('0x4a')]=function(_0x6b2a5f){return this['exec']('WAIT',_0x6b2a5f);};AGIChannel[_0x6ff3('0x22')][_0x6ff3('0x17')]=function(_0x503d52,_0x2f0906){this[_0x6ff3('0x2a')](util[_0x6ff3('0x29')](_0x6ff3('0x4b'),_0x503d52['id'],_0x503d52[_0x6ff3('0x4c')],_0x2f0906));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6ff3('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 30b39c0..18e37c1 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 _0x0d4f=['apply','message','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x1f1e30,_0x459b26){var _0x4f1d95=function(_0x12fbdc){while(--_0x12fbdc){_0x1f1e30['push'](_0x1f1e30['shift']());}};_0x4f1d95(++_0x459b26);}(_0x0d4f,0x6f));var _0xf0d4=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x0d4f[_0xf71120];return _0xbe2fd3;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xf0d4('0x0'),'E_AGI_ARGUMENT_PORT':_0xf0d4('0x1'),'E_AGI_SERVER_ERROR':_0xf0d4('0x2'),'E_AGI_SERVER_CLOSE':_0xf0d4('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xf0d4('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xf0d4('0x5'),'E_AGI_SOCKET_ERROR':_0xf0d4('0x6'),'E_AGI_SOCKET_CLOSE':_0xf0d4('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xf0d4('0x8'),'E_AGI_COMMAND_EMPTY':_0xf0d4('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xf0d4('0xa'),'E_AGI_IVR_ENTRY':_0xf0d4('0xb')};function AGIError(_0x35e231){var _0x35e231=_0x35e231||null,_0x32a738=_0x32a738||[],_0x362f37=0x1,_0xaa498='';if(!error[_0x35e231]){_0x35e231=_0xf0d4('0xc');}_0x32a738[_0xf0d4('0xd')](error[_0x35e231]);while(arguments[_0x362f37]){_0x32a738[_0xf0d4('0xd')](arguments[_0x362f37]);_0x362f37++;}_0xaa498=util[_0xf0d4('0xe')][_0xf0d4('0xf')](util,_0x32a738);this[_0xf0d4('0x10')]=_0xaa498;this['name']=_0x35e231;}module[_0xf0d4('0x11')]=AGIError; \ No newline at end of file +var _0xae4a=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.'];(function(_0x9da917,_0x1631c0){var _0x59beed=function(_0x2b5346){while(--_0x2b5346){_0x9da917['push'](_0x9da917['shift']());}};_0x59beed(++_0x1631c0);}(_0xae4a,0x1d2));var _0xaae4=function(_0x519bf5,_0x477e8f){_0x519bf5=_0x519bf5-0x0;var _0x3c4f4f=_0xae4a[_0x519bf5];return _0x3c4f4f;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xaae4('0x0'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xaae4('0x1'),'E_AGI_SERVER_MAXCONNECTION':_0xaae4('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0xaae4('0x3'),'E_AGI_SOCKET_ERROR':_0xaae4('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xaae4('0x5'),'E_AGI_COMMAND_EMPTY':_0xaae4('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xaae4('0x7')};function AGIError(_0x4b700a){var _0x4b700a=_0x4b700a||null,_0x30aff2=_0x30aff2||[],_0x54a8f4=0x1,_0x5104e1='';if(!error[_0x4b700a]){_0x4b700a=_0xaae4('0x8');}_0x30aff2[_0xaae4('0x9')](error[_0x4b700a]);while(arguments[_0x54a8f4]){_0x30aff2[_0xaae4('0x9')](arguments[_0x54a8f4]);_0x54a8f4++;}_0x5104e1=util[_0xaae4('0xa')]['apply'](util,_0x30aff2);this['message']=_0x5104e1;this[_0xaae4('0xb')]=_0x4b700a;}module[_0xaae4('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 96f2b3c..61eefc0 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 _0x271f=['max\x20retry\x20reach','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','addEdge','push','size','getVertex','traverseBFS','no\x20vertex\x20found','info','length','condition','split','agicommand','vswitch','target','default','default\x20on\x20switch\x20not\x20found'];(function(_0x4cb819,_0x382986){var _0x33fb18=function(_0x211d5e){while(--_0x211d5e){_0x4cb819['push'](_0x4cb819['shift']());}};_0x33fb18(++_0x382986);}(_0x271f,0xaa));var _0xf271=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x271f[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xf271('0x0'));var logger=require(_0xf271('0x1'))(_0xf271('0x2'));var verticesWithRetry=[_0xf271('0x3'),_0xf271('0x4'),_0xf271('0x5')];var Graph=function(){this[_0xf271('0x6')]={};this['edges']={};this[_0xf271('0x7')]=0x0;};Graph[_0xf271('0x8')][_0xf271('0x9')]=function(_0x18f7da){this['vertices'][_0x18f7da['id']]=_0x18f7da;this[_0xf271('0xa')][_0x18f7da['id']]=[];};Graph[_0xf271('0x8')][_0xf271('0xb')]=function(_0x51bf6e,_0xfbc2aa,_0x233b71){this[_0xf271('0xa')][_0x51bf6e][_0xf271('0xc')]({'target':_0xfbc2aa,'condition':_0x233b71});this[_0xf271('0x7')]+=0x1;};Graph[_0xf271('0x8')][_0xf271('0xd')]=function(){return _['size'](this[_0xf271('0x6')]);};Graph[_0xf271('0x8')]['relations']=function(){return this['numberOfEdges'];};Graph[_0xf271('0x8')][_0xf271('0xe')]=function(_0x56ee56){return this[_0xf271('0x6')][_0x56ee56];};Graph[_0xf271('0x8')][_0xf271('0xf')]=function(_0x168eb4,_0x17317e){if(!this['vertices'][_0x168eb4]){return logger['info'](_0xf271('0x10'));}var _0x5099c6=_0x17317e(this[_0xf271('0x6')][_0x168eb4]);if(!_0x5099c6){return logger[_0xf271('0x11')]('stop\x20traverse');}if(this[_0xf271('0xa')][_0x168eb4][_0xf271('0x12')]===0x0){return logger[_0xf271('0x11')]('no\x20edge/s\x20available');}for(var _0x5c5841=0x0,_0x258162=[],_0x2b13d7=![];_0x5c5841\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','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','getSquareProject','then','catch','createSquareReport','indexOf','substring','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','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','isUndefined','toString','agicommand\x20not\x20found','finally','clear','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','port'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0x6edf,0xb5));var _0xf6ed=function(_0x2f321d,_0x43307a){_0x2f321d=_0x2f321d-0x0;var _0x3cadd8=_0x6edf[_0x2f321d];return _0x3cadd8;};'use strict';var parser=require(_0xf6ed('0x0'));var _=require(_0xf6ed('0x1'));var syncho=require(_0xf6ed('0x2'));var util=require('util');var moment=require(_0xf6ed('0x3'));var config=require(_0xf6ed('0x4'));var logger=require(_0xf6ed('0x5'))('agi');var utilLicense=require(_0xf6ed('0x6'));var rpc=require('./rpc');var mailRpc=require(_0xf6ed('0x7'));var Graph=require(_0xf6ed('0x8'));var Vertices=require(_0xf6ed('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xf6ed('0xa')]=_[_0xf6ed('0xb')](config[_0xf6ed('0xa')],{'ip':_0xf6ed('0xc'),'port':0x11dd});function connectionHandler(_0x5f205f){process[_0xf6ed('0xd')](function(){syncho(function(){try{setChannelVariables(_0x5f205f);agiHandler(_0x5f205f);}catch(_0x53d0ca){logger['error'](_0x53d0ca[_0xf6ed('0xe')]);}});});}function listeningHandler(){console[_0xf6ed('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi']['port']);logger[_0xf6ed('0x10')](util[_0xf6ed('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xf6ed('0xa')]['ip'],config[_0xf6ed('0xa')]['port']));}function errorHandler(_0x3f469c){if(_0x3f469c&&_0x3f469c['name']&&_0x3f469c[_0xf6ed('0x12')]){logger[_0xf6ed('0x13')](util[_0xf6ed('0x11')](_0xf6ed('0x14'),_0x3f469c[_0xf6ed('0x15')],_0x3f469c[_0xf6ed('0x12')]));}else{logger[_0xf6ed('0x13')](util['format'](_0xf6ed('0x16'),_0x3f469c[_0xf6ed('0xe')]));}}function closeHandler(){logger[_0xf6ed('0x10')](util['format'](_0xf6ed('0x17'),this[_0xf6ed('0x18')],this[_0xf6ed('0x19')],this[_0xf6ed('0x1a')],this[_0xf6ed('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x1d43de){logger[_0xf6ed('0x13')](_0x1d43de[_0xf6ed('0xe')]);}}function timeoutHandler(){logger[_0xf6ed('0x10')](util[_0xf6ed('0x11')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xf6ed('0x19')],this['callerid'],this[_0xf6ed('0x1b')],this[_0xf6ed('0x1c')]));}function hangupHandler(){logger[_0xf6ed('0x10')](util[_0xf6ed('0x11')](_0xf6ed('0x1d'),this[_0xf6ed('0x18')],this[_0xf6ed('0x19')],this[_0xf6ed('0x1a')],this[_0xf6ed('0x1b')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x1a6391){return parser[_0xf6ed('0x1e')](_0x1a6391,{'object':!![]})[_0xf6ed('0x1f')][_0xf6ed('0x20')];}function addVertex(_0x53ae15,_0x3a7973,_0x5bcde4){_0x3a7973[_0xf6ed('0x21')]=_0x5bcde4;if(_0x3a7973[_0xf6ed('0x22')](_0xf6ed('0x23'))){_0x3a7973[_0xf6ed('0x24')]=parseInt(_0x3a7973['retry'],0xa);}_0x53ae15[_0xf6ed('0x25')](_[_0xf6ed('0x26')](_0x3a7973,'mxCell'));}function initGraph(_0x485afb,_0x5e18d1){var _0x9afb59=new Graph();for(var _0x4b8358 in _0x485afb){if(_0x485afb[_0xf6ed('0x22')](_0x4b8358)){if(_[_0xf6ed('0x27')](_0x485afb[_0x4b8358])){for(var _0x1a61f3=0x0;_0x1a61f3<_0x485afb[_0x4b8358][_0xf6ed('0x28')];_0x1a61f3+=0x1){addVertex(_0x9afb59,_0x485afb[_0x4b8358][_0x1a61f3],_0x4b8358);}}else{addVertex(_0x9afb59,_0x485afb[_0x4b8358],_0x4b8358);}}}for(var _0xfb64ca=0x0;_0xfb64ca<_0x5e18d1['length'];_0xfb64ca+=0x1){if(_0x5e18d1[_0xfb64ca][_0xf6ed('0x29')]&&_0x5e18d1[_0xfb64ca][_0xf6ed('0x2a')]){_0x9afb59['addEdge'](_0x5e18d1[_0xfb64ca]['source'],_0x5e18d1[_0xfb64ca][_0xf6ed('0x2a')],_0x5e18d1[_0xfb64ca]['value']);}}return _0x9afb59;}function getSquareProject(_0x26e1ad,_0x22bfb2){rpc[_0xf6ed('0x2b')](_0x26e1ad)[_0xf6ed('0x2c')](function(_0x277a1a){_0x22bfb2(null,_0x277a1a);})[_0xf6ed('0x2d')](function(_0x4831e4){_0x22bfb2(null,_0x4831e4);});}function createSquareReport(_0x47a984,_0x58a6d9){rpc[_0xf6ed('0x2e')](_0x47a984)[_0xf6ed('0x2c')](function(_0x1ceea0){if(_0x58a6d9){_0x58a6d9(null,_0x1ceea0);}})[_0xf6ed('0x2d')](function(_0x20045b){if(_0x58a6d9){_0x58a6d9(null,_0x20045b);}});}function setChannelVariables(_0x473d1f){for(var _0x3e3f08 in _0x473d1f){if(_0x473d1f[_0xf6ed('0x22')](_0x3e3f08)){if(_0x3e3f08[_0xf6ed('0x2f')]('agi_')===0x0){_0x473d1f[_0x3e3f08[_0xf6ed('0x30')](0x4)]=_0x473d1f[_0x3e3f08];delete _0x473d1f[_0x3e3f08];}}}}function getLogFromObject(_0x4b2d9a){return util['inspect'](_0x4b2d9a,{'showHidden':![],'depth':null});}function agiHandler(_0x383b5e){var _0x401f3f,_0x3faac5,_0x4eb73e,_0x1cd90b,_0x3aef0f;logger[_0xf6ed('0x31')](_0xf6ed('0x32'),JSON[_0xf6ed('0x33')](_0x383b5e,null,0x2));logger[_0xf6ed('0x10')](util[_0xf6ed('0x11')](_0xf6ed('0x34'),_0x383b5e[_0xf6ed('0x18')],_0x383b5e[_0xf6ed('0x19')],_0x383b5e['callerid'],_0x383b5e['dnid'],_0x383b5e[_0xf6ed('0x1c')]));_0x383b5e['on'](_0xf6ed('0x13'),errorHandler);_0x383b5e['on'](_0xf6ed('0x35'),closeHandler);_0x383b5e['on'](_0xf6ed('0x36'),timeoutHandler);_0x383b5e[_0xf6ed('0x37')]=![];_0x383b5e['on'](_0xf6ed('0x38'),hangupHandler);var _0x342902=getSquareProject[_0xf6ed('0x39')](null,_0x383b5e[_0xf6ed('0x18')]);if(_0x342902){if(_0x342902[_0xf6ed('0x3a')]){_0x401f3f=getRoot(_0x342902['production']);if(_0x401f3f&&_0x401f3f['start']){logger[_0xf6ed('0x31')](_0xf6ed('0x20'),JSON[_0xf6ed('0x33')](_0x401f3f,null,0x2));_0x383b5e['joinAt']=moment()[_0xf6ed('0x11')](_0xf6ed('0x3b'));_0x3faac5=initGraph(_[_0xf6ed('0x26')](_0x401f3f,_0xf6ed('0x3c')),_0x401f3f[_0xf6ed('0x3c')]);_0x4eb73e=new Vertices(_0x383b5e,rpc,mailRpc);logger[_0xf6ed('0x10')](util[_0xf6ed('0x11')](_0xf6ed('0x3d'),_0x383b5e[_0xf6ed('0x18')],_0x383b5e[_0xf6ed('0x19')],_0x383b5e['callerid'],_0x383b5e[_0xf6ed('0x1b')],_0x383b5e[_0xf6ed('0x1c')]));_0x3faac5[_0xf6ed('0x3e')](_0x401f3f[_0xf6ed('0x3f')]['id'],function(_0x2506b5){try{_0x2506b5=_0x4eb73e['clear'](_0x2506b5);logger[_0xf6ed('0x31')](_0xf6ed('0x40'),JSON[_0xf6ed('0x33')](_0x2506b5,null,0x2));if(_0x2506b5[_0xf6ed('0x21')]===_0xf6ed('0x41')){logger[_0xf6ed('0x10')](_0xf6ed('0x42'));_0x383b5e[_0xf6ed('0x43')]=_0x2506b5[_0xf6ed('0x43')]||_0x383b5e[_0xf6ed('0x43')];_0x383b5e[_0xf6ed('0x44')]=_0x2506b5[_0xf6ed('0x44')];_0x383b5e[_0xf6ed('0x45')]=_0x2506b5[_0xf6ed('0x45')]?_0x2506b5[_0xf6ed('0x45')]-0x1:0x1;return null;}else if(_0x2506b5&&_0x4eb73e[_0x2506b5['agicommand']]){_0x3aef0f=_0x4eb73e[_0x2506b5[_0xf6ed('0x21')]](_0x2506b5);logger[_0xf6ed('0x10')]('response',JSON[_0xf6ed('0x33')](_0x3aef0f,null,0x2));if(_0x3aef0f&&_0x3aef0f[_0xf6ed('0x46')]===AGI_CODE_SUCCESS&&_0x3aef0f[_0xf6ed('0x47')]!==AGI_RESULT_ERROR&&!_0x383b5e['evtHangup']){logger[_0xf6ed('0x31')](_0xf6ed('0x48'),getLogFromObject(_0x3aef0f));return _[_0xf6ed('0x49')](_0x3aef0f[_0xf6ed('0x47')])?null:_0x3aef0f[_0xf6ed('0x47')][_0xf6ed('0x4a')]();}else{logger[_0xf6ed('0x13')](_0xf6ed('0x48'),getLogFromObject(_0x3aef0f));return null;}}else{logger[_0xf6ed('0x13')](_0xf6ed('0x4b'));return null;}}catch(_0x4dd624){logger[_0xf6ed('0x13')](_0x4dd624[_0xf6ed('0xe')]);return null;}});if(_0x401f3f[_0xf6ed('0x4c')]){logger[_0xf6ed('0x10')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x383b5e[_0xf6ed('0x18')],_0x383b5e['calleridname'],_0x383b5e[_0xf6ed('0x1a')],_0x383b5e[_0xf6ed('0x1b')],_0x383b5e[_0xf6ed('0x1c')]));_0x3faac5[_0xf6ed('0x3e')](_0x401f3f[_0xf6ed('0x4c')]['id'],function(_0x41ee05){try{_0x41ee05=_0x4eb73e[_0xf6ed('0x4d')](_0x41ee05);logger['debug'](_0xf6ed('0x40'),JSON['stringify'](_0x41ee05,null,0x2));if(_0x41ee05&&_0x4eb73e[_0x41ee05[_0xf6ed('0x21')]]){_0x3aef0f=_0x4eb73e[_0x41ee05[_0xf6ed('0x21')]](_0x41ee05);if(_0x3aef0f){logger[_0xf6ed('0x31')](_0xf6ed('0x48'),getLogFromObject(_0x3aef0f));return _[_0xf6ed('0x49')](_0x3aef0f[_0xf6ed('0x47')])?null:_0x3aef0f[_0xf6ed('0x47')][_0xf6ed('0x4a')]();}else{logger[_0xf6ed('0x13')](_0xf6ed('0x48'),getLogFromObject(_0x3aef0f));return null;}}else{logger[_0xf6ed('0x13')](_0xf6ed('0x4b'));return null;}}catch(_0x11d898){logger[_0xf6ed('0x13')](_0x11d898[_0xf6ed('0xe')]);return null;}});}logger[_0xf6ed('0x10')](util[_0xf6ed('0x11')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x383b5e[_0xf6ed('0x18')],_0x383b5e[_0xf6ed('0x19')],_0x383b5e[_0xf6ed('0x1a')],_0x383b5e[_0xf6ed('0x1b')],_0x383b5e[_0xf6ed('0x1c')]));logger[_0xf6ed('0x10')](util[_0xf6ed('0x11')](_0xf6ed('0x4e'),_0x383b5e['context'],_0x383b5e[_0xf6ed('0x44')],parseInt(_0x383b5e[_0xf6ed('0x45')],0xa)+0x1));_0x383b5e[_0xf6ed('0x4f')](_0x383b5e[_0xf6ed('0x43')],_0x383b5e[_0xf6ed('0x44')],parseInt(_0x383b5e[_0xf6ed('0x45')],0xa)+0x1);_0x383b5e[_0xf6ed('0x35')]();}}else{logger[_0xf6ed('0x13')](util[_0xf6ed('0x11')](_0xf6ed('0x50'),_0x383b5e[_0xf6ed('0x18')]));_0x383b5e[_0xf6ed('0x4f')](_0x383b5e['context'],_0x383b5e[_0xf6ed('0x44')],parseInt(_0x383b5e[_0xf6ed('0x45')],0xa)+0x1);_0x383b5e['close']();}}else{logger['error'](util[_0xf6ed('0x11')]('Project\x20%s\x20not\x20found',_0x383b5e[_0xf6ed('0x18')]));_0x383b5e[_0xf6ed('0x4f')](_0x383b5e[_0xf6ed('0x43')],_0x383b5e[_0xf6ed('0x44')],parseInt(_0x383b5e[_0xf6ed('0x45')],0xa)+0x1);_0x383b5e[_0xf6ed('0x35')]();}}function main(){var _0x59db93;return utilLicense[_0xf6ed('0x51')]()['then'](function(_0x2237b9){if(_0x2237b9){if(_0x2237b9[_0xf6ed('0x52')]){if(_0x2237b9[_0xf6ed('0x53')]&&_0x2237b9[_0xf6ed('0x53')]>0x0){logger[_0xf6ed('0x10')](util[_0xf6ed('0x11')](_0xf6ed('0x54'),_0x2237b9[_0xf6ed('0x53')]));_0x59db93=_0x2237b9['callysquare'];}else{logger[_0xf6ed('0x10')](_0xf6ed('0x55'));}}else{logger[_0xf6ed('0x10')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x59db93=-0x1;}}})['catch'](function(_0x5f0d04){logger[_0xf6ed('0x13')](_0xf6ed('0x56'),_0x5f0d04[_0xf6ed('0xe')]);})[_0xf6ed('0x4c')](function(){var _0x5b6a07=require(_0xf6ed('0x57'))(config['agi'][_0xf6ed('0x58')],config[_0xf6ed('0xa')]['ip'],_0x59db93);_0x5b6a07['on'](_0xf6ed('0x13'),errorHandler);_0x5b6a07['on']('listening',listeningHandler);_0x5b6a07['on'](_0xf6ed('0x59'),connectionHandler);_0x5b6a07['on'](_0xf6ed('0x35'),closeHandler);});}main(); \ No newline at end of file +var _0xc9c5=['[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','target','source','value','catch','then','indexOf','agi_','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','production','start','joinAt','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','isUndefined','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','xml2json','moment','../../config/environment','agi','../../config/license/util','./rpc','./mailRpc','defaults','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name'];(function(_0x43145c,_0x4ea1b4){var _0x2cee86=function(_0x5141d3){while(--_0x5141d3){_0x43145c['push'](_0x43145c['shift']());}};_0x2cee86(++_0x4ea1b4);}(_0xc9c5,0x193));var _0x5c9c=function(_0x2384bb,_0x12f81b){_0x2384bb=_0x2384bb-0x0;var _0x3f2bac=_0xc9c5[_0x2384bb];return _0x3f2bac;};'use strict';var parser=require(_0x5c9c('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require('util');var moment=require(_0x5c9c('0x1'));var config=require(_0x5c9c('0x2'));var logger=require('../../config/logger')(_0x5c9c('0x3'));var utilLicense=require(_0x5c9c('0x4'));var rpc=require(_0x5c9c('0x5'));var mailRpc=require(_0x5c9c('0x6'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x5c9c('0x3')]=_[_0x5c9c('0x7')](config['agi'],{'ip':_0x5c9c('0x8'),'port':0x11dd});function connectionHandler(_0x1762af){process[_0x5c9c('0x9')](function(){syncho(function(){try{setChannelVariables(_0x1762af);agiHandler(_0x1762af);}catch(_0x1d0b48){logger[_0x5c9c('0xa')](_0x1d0b48[_0x5c9c('0xb')]);}});});}function listeningHandler(){console['log'](_0x5c9c('0xc'),config[_0x5c9c('0x3')][_0x5c9c('0xd')]);logger['info'](util[_0x5c9c('0xe')](_0x5c9c('0xf'),config[_0x5c9c('0x3')]['ip'],config[_0x5c9c('0x3')][_0x5c9c('0xd')]));}function errorHandler(_0x243f04){if(_0x243f04&&_0x243f04[_0x5c9c('0x10')]&&_0x243f04['message']){logger[_0x5c9c('0xa')](util[_0x5c9c('0xe')](_0x5c9c('0x11'),_0x243f04[_0x5c9c('0x10')],_0x243f04['message']));}else{logger['error'](util[_0x5c9c('0xe')](_0x5c9c('0x12'),_0x243f04[_0x5c9c('0xb')]));}}function closeHandler(){logger['info'](util[_0x5c9c('0xe')](_0x5c9c('0x13'),this[_0x5c9c('0x14')],this[_0x5c9c('0x15')],this['callerid'],this[_0x5c9c('0x16')],this[_0x5c9c('0x17')]));try{createSquareReport(this);}catch(_0x3bec85){logger['error'](_0x3bec85[_0x5c9c('0xb')]);}}function timeoutHandler(){logger[_0x5c9c('0x18')](util[_0x5c9c('0xe')](_0x5c9c('0x19'),this[_0x5c9c('0x14')],this['calleridname'],this[_0x5c9c('0x1a')],this['dnid'],this[_0x5c9c('0x17')]));}function hangupHandler(){logger[_0x5c9c('0x18')](util[_0x5c9c('0xe')](_0x5c9c('0x1b'),this[_0x5c9c('0x14')],this[_0x5c9c('0x15')],this['callerid'],this['dnid'],this['uniqueid']));this[_0x5c9c('0x1c')]=!![];}function getRoot(_0x62c22f){return parser['toJson'](_0x62c22f,{'object':!![]})[_0x5c9c('0x1d')][_0x5c9c('0x1e')];}function addVertex(_0x3d0ed7,_0x1c113a,_0x21441f){_0x1c113a[_0x5c9c('0x1f')]=_0x21441f;if(_0x1c113a[_0x5c9c('0x20')](_0x5c9c('0x21'))){_0x1c113a[_0x5c9c('0x22')]=parseInt(_0x1c113a['retry'],0xa);}_0x3d0ed7[_0x5c9c('0x23')](_[_0x5c9c('0x24')](_0x1c113a,'mxCell'));}function initGraph(_0x5100c2,_0x3da09a){var _0x4493df=new Graph();for(var _0xcd277 in _0x5100c2){if(_0x5100c2[_0x5c9c('0x20')](_0xcd277)){if(_[_0x5c9c('0x25')](_0x5100c2[_0xcd277])){for(var _0x1b36cf=0x0;_0x1b36cf<_0x5100c2[_0xcd277][_0x5c9c('0x26')];_0x1b36cf+=0x1){addVertex(_0x4493df,_0x5100c2[_0xcd277][_0x1b36cf],_0xcd277);}}else{addVertex(_0x4493df,_0x5100c2[_0xcd277],_0xcd277);}}}for(var _0x4b13c6=0x0;_0x4b13c6<_0x3da09a['length'];_0x4b13c6+=0x1){if(_0x3da09a[_0x4b13c6]['source']&&_0x3da09a[_0x4b13c6][_0x5c9c('0x27')]){_0x4493df['addEdge'](_0x3da09a[_0x4b13c6][_0x5c9c('0x28')],_0x3da09a[_0x4b13c6][_0x5c9c('0x27')],_0x3da09a[_0x4b13c6][_0x5c9c('0x29')]);}}return _0x4493df;}function getSquareProject(_0xfc37eb,_0x57d649){rpc['getSquareProject'](_0xfc37eb)['then'](function(_0x25c210){_0x57d649(null,_0x25c210);})[_0x5c9c('0x2a')](function(_0x3d7289){_0x57d649(null,_0x3d7289);});}function createSquareReport(_0xf8470e,_0x1e0013){rpc['createSquareReport'](_0xf8470e)[_0x5c9c('0x2b')](function(_0x26acdd){if(_0x1e0013){_0x1e0013(null,_0x26acdd);}})['catch'](function(_0xb4e045){if(_0x1e0013){_0x1e0013(null,_0xb4e045);}});}function setChannelVariables(_0x32cd04){for(var _0x50b31d in _0x32cd04){if(_0x32cd04[_0x5c9c('0x20')](_0x50b31d)){if(_0x50b31d[_0x5c9c('0x2c')](_0x5c9c('0x2d'))===0x0){_0x32cd04[_0x50b31d[_0x5c9c('0x2e')](0x4)]=_0x32cd04[_0x50b31d];delete _0x32cd04[_0x50b31d];}}}}function getLogFromObject(_0x3819eb){return util['inspect'](_0x3819eb,{'showHidden':![],'depth':null});}function agiHandler(_0x45f1c3){var _0xb82e18,_0x4dd4e5,_0x44d3a6,_0x3ad942,_0x539692;logger[_0x5c9c('0x2f')](_0x5c9c('0x30'),JSON['stringify'](_0x45f1c3,null,0x2));logger[_0x5c9c('0x18')](util[_0x5c9c('0xe')](_0x5c9c('0x31'),_0x45f1c3['arg_1'],_0x45f1c3['calleridname'],_0x45f1c3['callerid'],_0x45f1c3[_0x5c9c('0x16')],_0x45f1c3[_0x5c9c('0x17')]));_0x45f1c3['on'](_0x5c9c('0xa'),errorHandler);_0x45f1c3['on'](_0x5c9c('0x32'),closeHandler);_0x45f1c3['on'](_0x5c9c('0x33'),timeoutHandler);_0x45f1c3[_0x5c9c('0x1c')]=![];_0x45f1c3['on']('hangup',hangupHandler);var _0x418d84=getSquareProject['sync'](null,_0x45f1c3[_0x5c9c('0x14')]);if(_0x418d84){if(_0x418d84[_0x5c9c('0x34')]){_0xb82e18=getRoot(_0x418d84[_0x5c9c('0x34')]);if(_0xb82e18&&_0xb82e18[_0x5c9c('0x35')]){logger['debug']('root',JSON['stringify'](_0xb82e18,null,0x2));_0x45f1c3[_0x5c9c('0x36')]=moment()[_0x5c9c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x4dd4e5=initGraph(_[_0x5c9c('0x24')](_0xb82e18,_0x5c9c('0x37')),_0xb82e18[_0x5c9c('0x37')]);_0x44d3a6=new Vertices(_0x45f1c3,rpc,mailRpc);logger[_0x5c9c('0x18')](util[_0x5c9c('0xe')](_0x5c9c('0x38'),_0x45f1c3[_0x5c9c('0x14')],_0x45f1c3[_0x5c9c('0x15')],_0x45f1c3[_0x5c9c('0x1a')],_0x45f1c3['dnid'],_0x45f1c3[_0x5c9c('0x17')]));_0x4dd4e5[_0x5c9c('0x39')](_0xb82e18['start']['id'],function(_0x3138b7){try{_0x3138b7=_0x44d3a6[_0x5c9c('0x3a')](_0x3138b7);logger[_0x5c9c('0x2f')]('vertex',JSON[_0x5c9c('0x3b')](_0x3138b7,null,0x2));if(_0x3138b7['agicommand']===_0x5c9c('0x3c')){logger[_0x5c9c('0x18')](_0x5c9c('0x3d'));_0x45f1c3['context']=_0x3138b7[_0x5c9c('0x3e')]||_0x45f1c3['context'];_0x45f1c3[_0x5c9c('0x3f')]=_0x3138b7['extension'];_0x45f1c3['priority']=_0x3138b7[_0x5c9c('0x40')]?_0x3138b7[_0x5c9c('0x40')]-0x1:0x1;return null;}else if(_0x3138b7&&_0x44d3a6[_0x3138b7[_0x5c9c('0x1f')]]){_0x539692=_0x44d3a6[_0x3138b7[_0x5c9c('0x1f')]](_0x3138b7);logger[_0x5c9c('0x18')]('response',JSON[_0x5c9c('0x3b')](_0x539692,null,0x2));if(_0x539692&&_0x539692[_0x5c9c('0x41')]===AGI_CODE_SUCCESS&&_0x539692[_0x5c9c('0x42')]!==AGI_RESULT_ERROR&&!_0x45f1c3[_0x5c9c('0x1c')]){logger[_0x5c9c('0x2f')](_0x5c9c('0x43'),getLogFromObject(_0x539692));return _[_0x5c9c('0x44')](_0x539692[_0x5c9c('0x42')])?null:_0x539692[_0x5c9c('0x42')]['toString']();}else{logger[_0x5c9c('0xa')]('response',getLogFromObject(_0x539692));return null;}}else{logger[_0x5c9c('0xa')](_0x5c9c('0x45'));return null;}}catch(_0x3c9500){logger['error'](_0x3c9500[_0x5c9c('0xb')]);return null;}});if(_0xb82e18[_0x5c9c('0x46')]){logger[_0x5c9c('0x18')](util['format'](_0x5c9c('0x47'),_0x45f1c3[_0x5c9c('0x14')],_0x45f1c3['calleridname'],_0x45f1c3[_0x5c9c('0x1a')],_0x45f1c3[_0x5c9c('0x16')],_0x45f1c3[_0x5c9c('0x17')]));_0x4dd4e5[_0x5c9c('0x39')](_0xb82e18[_0x5c9c('0x46')]['id'],function(_0x471179){try{_0x471179=_0x44d3a6[_0x5c9c('0x3a')](_0x471179);logger[_0x5c9c('0x2f')]('vertex',JSON[_0x5c9c('0x3b')](_0x471179,null,0x2));if(_0x471179&&_0x44d3a6[_0x471179[_0x5c9c('0x1f')]]){_0x539692=_0x44d3a6[_0x471179[_0x5c9c('0x1f')]](_0x471179);if(_0x539692){logger['debug']('response',getLogFromObject(_0x539692));return _['isUndefined'](_0x539692[_0x5c9c('0x42')])?null:_0x539692[_0x5c9c('0x42')]['toString']();}else{logger[_0x5c9c('0xa')](_0x5c9c('0x43'),getLogFromObject(_0x539692));return null;}}else{logger[_0x5c9c('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x39efb0){logger['error'](_0x39efb0[_0x5c9c('0xb')]);return null;}});}logger[_0x5c9c('0x18')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x45f1c3[_0x5c9c('0x14')],_0x45f1c3[_0x5c9c('0x15')],_0x45f1c3[_0x5c9c('0x1a')],_0x45f1c3[_0x5c9c('0x16')],_0x45f1c3[_0x5c9c('0x17')]));logger['info'](util[_0x5c9c('0xe')](_0x5c9c('0x48'),_0x45f1c3['context'],_0x45f1c3[_0x5c9c('0x3f')],parseInt(_0x45f1c3[_0x5c9c('0x40')],0xa)+0x1));_0x45f1c3[_0x5c9c('0x49')](_0x45f1c3[_0x5c9c('0x3e')],_0x45f1c3[_0x5c9c('0x3f')],parseInt(_0x45f1c3[_0x5c9c('0x40')],0xa)+0x1);_0x45f1c3[_0x5c9c('0x32')]();}}else{logger[_0x5c9c('0xa')](util['format'](_0x5c9c('0x4a'),_0x45f1c3[_0x5c9c('0x14')]));_0x45f1c3[_0x5c9c('0x49')](_0x45f1c3['context'],_0x45f1c3[_0x5c9c('0x3f')],parseInt(_0x45f1c3[_0x5c9c('0x40')],0xa)+0x1);_0x45f1c3['close']();}}else{logger[_0x5c9c('0xa')](util[_0x5c9c('0xe')](_0x5c9c('0x4b'),_0x45f1c3[_0x5c9c('0x14')]));_0x45f1c3[_0x5c9c('0x49')](_0x45f1c3['context'],_0x45f1c3[_0x5c9c('0x3f')],parseInt(_0x45f1c3[_0x5c9c('0x40')],0xa)+0x1);_0x45f1c3[_0x5c9c('0x32')]();}}function main(){var _0xb597c7;return utilLicense['getLicense']()['then'](function(_0xcc16ef){if(_0xcc16ef){if(_0xcc16ef[_0x5c9c('0x4c')]){if(_0xcc16ef[_0x5c9c('0x4d')]&&_0xcc16ef[_0x5c9c('0x4d')]>0x0){logger['info'](util[_0x5c9c('0xe')](_0x5c9c('0x4e'),_0xcc16ef['callysquare']));_0xb597c7=_0xcc16ef[_0x5c9c('0x4d')];}else{logger['info'](_0x5c9c('0x4f'));}}else{logger[_0x5c9c('0x18')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0xb597c7=-0x1;}}})[_0x5c9c('0x2a')](function(_0x3c0a05){logger['error'](_0x5c9c('0x50'),_0x3c0a05[_0x5c9c('0xb')]);})[_0x5c9c('0x46')](function(){var _0x31f449=require(_0x5c9c('0x51'))(config['agi']['port'],config[_0x5c9c('0x3')]['ip'],_0xb597c7);_0x31f449['on'](_0x5c9c('0xa'),errorHandler);_0x31f449['on'](_0x5c9c('0x52'),listeningHandler);_0x31f449['on'](_0x5c9c('0x53'),connectionHandler);_0x31f449['on'](_0x5c9c('0x32'),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 8733e8b..69ec03c 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 _0x03b0=['SendMail','jayson/promise','http','request','then','error','message','result','sendMailMessage'];(function(_0x594ced,_0xa8963d){var _0x3e733c=function(_0x31bd22){while(--_0x31bd22){_0x594ced['push'](_0x594ced['shift']());}};_0x3e733c(++_0xa8963d);}(_0x03b0,0xbe));var _0x003b=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x03b0[_0x486f4a];return _0x135d99;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x003b('0x0'));var client=jayson['client'][_0x003b('0x1')]({'port':0x232b});function request(_0x36ee33,_0x1c4790){return new BPromise(function(_0x32104c,_0x12a1e4){return client[_0x003b('0x2')](_0x36ee33,_0x1c4790)[_0x003b('0x3')](function(_0x270e5e){if(_0x270e5e[_0x003b('0x4')]){return _0x12a1e4(_0x270e5e[_0x003b('0x4')][_0x003b('0x5')]);}else{return _0x32104c(_0x270e5e[_0x003b('0x6')]);}})['catch'](function(_0x702cbc){return _0x12a1e4(_0x702cbc);});});}exports[_0x003b('0x7')]=function(_0x16417b,_0x5f191a){return request(_0x003b('0x8'),{'account':_0x16417b,'message':_0x5f191a});}; \ No newline at end of file +var _0xaa4e=['message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xaa4e,0x1bc));var _0xeaa4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xaa4e[_0x3ab51d];return _0x29a04e;};'use strict';var BPromise=require(_0xeaa4('0x0'));var jayson=require(_0xeaa4('0x1'));var client=jayson[_0xeaa4('0x2')][_0xeaa4('0x3')]({'port':0x232b});function request(_0x5ec6ba,_0x3ef09a){return new BPromise(function(_0x3ac1c8,_0x42d437){return client[_0xeaa4('0x4')](_0x5ec6ba,_0x3ef09a)[_0xeaa4('0x5')](function(_0x5ccbac){if(_0x5ccbac[_0xeaa4('0x6')]){return _0x42d437(_0x5ccbac['error'][_0xeaa4('0x7')]);}else{return _0x3ac1c8(_0x5ccbac['result']);}})[_0xeaa4('0x8')](function(_0xa3bb7a){return _0x42d437(_0xa3bb7a);});});}exports[_0xeaa4('0x9')]=function(_0x41deb0,_0xd06a75){return request(_0xeaa4('0xa'),{'account':_0x41deb0,'message':_0xd06a75});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 601ad19..e92ead3 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 _0x502a=['Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','length','split','indexOf','slice','trim','emit','headers','line','exports','stream'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x502a,0x1df));var _0xa502=function(_0x22dc10,_0x234058){_0x22dc10=_0x22dc10-0x0;var _0x43064c=_0x502a[_0x22dc10];return _0x43064c;};'use strict';var util=require('util');var Transform=require(_0xa502('0x0'))[_0xa502('0x1')];function AGIReply(_0x2760b1){Transform[_0xa502('0x2')](this,_0x2760b1);this[_0xa502('0x3')]='';this[_0xa502('0x4')]=![];}util[_0xa502('0x5')](AGIReply,Transform);AGIReply[_0xa502('0x6')][_0xa502('0x7')]=function(_0x131634,_0x51e52a,_0x3f6081){var _0x2c4a08='\x0a',_0x39df41=['\x0a\x0a',_0xa502('0x8')],_0x1e5600=-0x1,_0x2e102b=-0x1,_0x5f463a='',_0x2a70f3=0x0,_0x4f50dd='',_0x4248f1='';this['_localBuffer']+=_0x131634[_0xa502('0x9')]();_0x4f50dd=this[_0xa502('0x3')];if(!this[_0xa502('0x4')]){_0x2a70f3=0x0;while(_0x39df41[_0x2a70f3]){while((_0x2e102b=_0x4f50dd['indexOf'](_0x39df41[_0x2a70f3]))!=-0x1){_0x5f463a=_0x39df41[_0x2a70f3];_0x4248f1=_0x4f50dd['substring'](0x0,_0x2e102b);_0x4f50dd=_0x4f50dd[_0xa502('0xa')](_0x2e102b+_0x5f463a[_0xa502('0xb')]);var _0x314d64=_0x4248f1[_0xa502('0xc')](_0x2c4a08),_0x56940f=0x0,_0x47d967={},_0x54c783='',_0x58b068='',_0x108e6b=-0x1;while(_0x314d64[_0x56940f]){_0x108e6b=_0x314d64[_0x56940f][_0xa502('0xd')](':');if(_0x108e6b!=-0x1){_0x54c783=_0x314d64[_0x56940f][_0xa502('0xe')](0x0,_0x108e6b)[_0xa502('0xf')]();_0x58b068=_0x314d64[_0x56940f][_0xa502('0xe')](_0x108e6b+0x1)['trim']();if(_0x54c783['length']>0x0){_0x47d967[_0x54c783]=_0x58b068;}}else{}_0x56940f++;}this[_0xa502('0x10')](_0xa502('0x11'),_0x47d967);this['_inBody']=!![];}_0x2a70f3++;}this[_0xa502('0x3')]=_0x4f50dd;}else{while((_0x1e5600=_0x4f50dd['indexOf'](_0x2c4a08))!=-0x1){_0x4248f1=_0x4f50dd[_0xa502('0xa')](0x0,_0x1e5600);this[_0xa502('0x10')](_0xa502('0x12'),_0x4248f1);_0x4f50dd=_0x4f50dd[_0xa502('0xa')](_0x1e5600+_0x2c4a08[_0xa502('0xb')]);}this[_0xa502('0x3')]=_0x4f50dd;}_0x3f6081();};module[_0xa502('0x13')]=AGIReply; \ No newline at end of file +var _0xf098=['indexOf','substring','length','split','slice','trim','emit','headers','line','util','stream','Transform','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0xf098,0x139));var _0x8f09=function(_0x5828c5,_0x459b42){_0x5828c5=_0x5828c5-0x0;var _0x733e0=_0xf098[_0x5828c5];return _0x733e0;};'use strict';var util=require(_0x8f09('0x0'));var Transform=require(_0x8f09('0x1'))[_0x8f09('0x2')];function AGIReply(_0x4826a3){Transform['call'](this,_0x4826a3);this['_localBuffer']='';this[_0x8f09('0x3')]=![];}util[_0x8f09('0x4')](AGIReply,Transform);AGIReply[_0x8f09('0x5')][_0x8f09('0x6')]=function(_0x47d2bb,_0x73b504,_0x2fe60b){var _0x23afa5='\x0a',_0x4f8124=['\x0a\x0a',_0x8f09('0x7')],_0x516497=-0x1,_0x447d71=-0x1,_0x56cc73='',_0x1d627c=0x0,_0x4849ba='',_0xe22fc3='';this[_0x8f09('0x8')]+=_0x47d2bb[_0x8f09('0x9')]();_0x4849ba=this[_0x8f09('0x8')];if(!this[_0x8f09('0x3')]){_0x1d627c=0x0;while(_0x4f8124[_0x1d627c]){while((_0x447d71=_0x4849ba[_0x8f09('0xa')](_0x4f8124[_0x1d627c]))!=-0x1){_0x56cc73=_0x4f8124[_0x1d627c];_0xe22fc3=_0x4849ba[_0x8f09('0xb')](0x0,_0x447d71);_0x4849ba=_0x4849ba[_0x8f09('0xb')](_0x447d71+_0x56cc73[_0x8f09('0xc')]);var _0x1ef318=_0xe22fc3[_0x8f09('0xd')](_0x23afa5),_0x59f69e=0x0,_0x11e550={},_0x1a2330='',_0x3e2149='',_0x16d121=-0x1;while(_0x1ef318[_0x59f69e]){_0x16d121=_0x1ef318[_0x59f69e][_0x8f09('0xa')](':');if(_0x16d121!=-0x1){_0x1a2330=_0x1ef318[_0x59f69e][_0x8f09('0xe')](0x0,_0x16d121)['trim']();_0x3e2149=_0x1ef318[_0x59f69e][_0x8f09('0xe')](_0x16d121+0x1)[_0x8f09('0xf')]();if(_0x1a2330[_0x8f09('0xc')]>0x0){_0x11e550[_0x1a2330]=_0x3e2149;}}else{}_0x59f69e++;}this[_0x8f09('0x10')](_0x8f09('0x11'),_0x11e550);this[_0x8f09('0x3')]=!![];}_0x1d627c++;}this['_localBuffer']=_0x4849ba;}else{while((_0x516497=_0x4849ba[_0x8f09('0xa')](_0x23afa5))!=-0x1){_0xe22fc3=_0x4849ba[_0x8f09('0xb')](0x0,_0x516497);this[_0x8f09('0x10')](_0x8f09('0x12'),_0xe22fc3);_0x4849ba=_0x4849ba[_0x8f09('0xb')](_0x516497+_0x23afa5[_0x8f09('0xc')]);}this[_0x8f09('0x8')]=_0x4849ba;}_0x2fe60b();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 493f08a..b91fcfe 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 _0xafa5=['jayson/promise','client','http','request','error','message','result','catch','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xafa5,0x1af));var _0x5afa=function(_0x997de4,_0x21dd6a){_0x997de4=_0x997de4-0x0;var _0x3818cb=_0xafa5[_0x997de4];return _0x3818cb;};'use strict';var BPromise=require('bluebird');var moment=require(_0x5afa('0x0'));var _=require(_0x5afa('0x1'));var util=require(_0x5afa('0x2'));var jayson=require(_0x5afa('0x3'));var client=jayson[_0x5afa('0x4')][_0x5afa('0x5')]({'port':0x2329});function request(_0x14535b,_0x21b649){return new BPromise(function(_0xac7ca5,_0x1509e4){return client[_0x5afa('0x6')](_0x14535b,_0x21b649)['then'](function(_0x166388){if(_0x166388[_0x5afa('0x7')]){return _0x1509e4(_0x166388[_0x5afa('0x7')][_0x5afa('0x8')]);}else{return _0xac7ca5(_0x166388[_0x5afa('0x9')]);}})[_0x5afa('0xa')](function(_0x4251b7){return _0x1509e4(_0x4251b7);});});}exports[_0x5afa('0xb')]=function(_0x2bfaff){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x2bfaff},'attributes':['production']}});};exports[_0x5afa('0xc')]=function(_0x34bd90){return request(_0x5afa('0xd'),{'options':{'raw':![],'where':{'id':_0x34bd90},'include':[{'model':_0x5afa('0xe'),'as':_0x5afa('0xf')}],'attributes':['id',_0x5afa('0x10'),_0x5afa('0x11')]}});};exports[_0x5afa('0x12')]=function(_0x57fd0f){return request(_0x5afa('0x13'),{'options':{'where':{'id':_0x57fd0f},'attributes':[_0x5afa('0x10')]}});};exports[_0x5afa('0x14')]=function(_0xc85509){return request(_0x5afa('0x15'),{'options':{'where':{'id':_0xc85509},'attributes':[_0x5afa('0x10')]}});};exports['getVariableById']=function(_0x1674eb){return request(_0x5afa('0x16'),{'options':{'where':{'id':_0x1674eb},'attributes':[_0x5afa('0x10')]}});};exports[_0x5afa('0x17')]=function(_0xfcb0a2){return request(_0x5afa('0x18'),{'options':{'where':{'id':_0xfcb0a2},'attributes':[_0x5afa('0x19')]}});};exports['getUserById']=function(_0x31aa81){return request(_0x5afa('0x1a'),{'options':{'where':{'id':_0x31aa81},'attributes':['name']}});};exports[_0x5afa('0x1b')]=function(_0x6ebf03){return request(_0x5afa('0x1c'),{'options':{'where':{'phone':_0x6ebf03[_0x5afa('0x1d')]},'attributes':['id']}});};exports[_0x5afa('0x1e')]=function(_0xaef03b){return request(_0x5afa('0x1f'),{'options':{'where':{'id':_0xaef03b},'attributes':['name']}});};exports[_0x5afa('0x20')]=function(_0x31316e){return request(_0x5afa('0x21'),{'options':{'where':{'id':_0x31316e},'attributes':[_0x5afa('0x22')]}});};exports[_0x5afa('0x23')]=function(_0xff5b77){return request(_0x5afa('0x24'),{'options':{'raw':![],'where':{'id':_0xff5b77},'include':[{'model':_0x5afa('0x25'),'as':_0x5afa('0x26')}]}});};exports[_0x5afa('0x27')]=function(_0x4e4470){return request(_0x5afa('0x28'),{'options':{'where':{'id':_0x4e4470},'attributes':['id',_0x5afa('0x10')]}});};exports[_0x5afa('0x29')]=function(_0x5e4a7d){return request(_0x5afa('0x2a'),{'body':_0x5e4a7d});};exports[_0x5afa('0x2b')]=function(_0x462505){return request('CreateSquareDetailsReport',{'body':_0x462505});};exports['createSquareReport']=function(_0x48269c){return request('CreateSquareReport',{'body':_['merge'](_0x48269c,{'project_name':_0x48269c[_0x5afa('0x2c')],'prev_project_name':_0x48269c[_0x5afa('0x2d')]||'','is_subproject':_0x48269c[_0x5afa('0x2d')]?!![]:![],'leaveAt':moment()[_0x5afa('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x5afa('0x2f')]=function(_0x37d118){return request(_0x5afa('0x30'),{'body':_0x37d118});};exports[_0x5afa('0x31')]=function(_0x16461f){return request('CreateSquareMessage',{'body':_0x16461f});};exports[_0x5afa('0x32')]=function(_0x18147d){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x18147d[_0x5afa('0x1d')],'ListId':_0x18147d[_0x5afa('0x33')]}}})[_0x5afa('0x34')](function(_0x9a6b5a){if(_0x9a6b5a){return _0x9a6b5a;}return request(_0x5afa('0x35'),{'body':_0x18147d});});};exports[_0x5afa('0x36')]=function(_0x37e91d){return request(_0x5afa('0x37'),{'options':{'where':{'id':_0x37e91d},'attributes':[_0x5afa('0x10')]}});};exports[_0x5afa('0x38')]=function(_0x51cc27,_0x14565f){return request('LoginUser',{'body':{'interface':_0x14565f},'options':{'where':_0x51cc27}});};exports[_0x5afa('0x39')]=function(_0x552ab2,_0x35f5b3,_0x4f4778){return request(_0x5afa('0x3a'),{'body':{'type':_0x35f5b3,'uniqueid':_0x4f4778},'options':{'where':_0x552ab2}});};exports['agentUnpause']=function(_0x57a561){return request(_0x5afa('0x3b'),{'body':{},'options':{'where':_0x57a561}});};exports[_0x5afa('0x3c')]=function(_0xabd1cb){return request(_0x5afa('0x3d'),{'body':{},'options':{'where':_0xabd1cb}});}; \ No newline at end of file +var _0x4986=['result','catch','getSquareProject','production','getMailAccountById','Smtp','email','getSquareProjectById','ShowSquareProject','name','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','LoginUser','agentPause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','client','http','request','then','error'];(function(_0x196220,_0x2c2f77){var _0x4640c4=function(_0x3d42d5){while(--_0x3d42d5){_0x196220['push'](_0x196220['shift']());}};_0x4640c4(++_0x2c2f77);}(_0x4986,0x6e));var _0x6498=function(_0x19b6cd,_0x558f2a){_0x19b6cd=_0x19b6cd-0x0;var _0x1b5169=_0x4986[_0x19b6cd];return _0x1b5169;};'use strict';var BPromise=require(_0x6498('0x0'));var moment=require(_0x6498('0x1'));var _=require(_0x6498('0x2'));var util=require('util');var jayson=require('jayson/promise');var client=jayson[_0x6498('0x3')][_0x6498('0x4')]({'port':0x2329});function request(_0x5d24c6,_0x15e8d3){return new BPromise(function(_0x12a6fb,_0x2c54ee){return client[_0x6498('0x5')](_0x5d24c6,_0x15e8d3)[_0x6498('0x6')](function(_0x8d1853){if(_0x8d1853[_0x6498('0x7')]){return _0x2c54ee(_0x8d1853['error']['message']);}else{return _0x12a6fb(_0x8d1853[_0x6498('0x8')]);}})[_0x6498('0x9')](function(_0x16c587){return _0x2c54ee(_0x16c587);});});}exports[_0x6498('0xa')]=function(_0x1c590e){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x1c590e},'attributes':[_0x6498('0xb')]}});};exports[_0x6498('0xc')]=function(_0x3fe456){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3fe456},'include':[{'model':'MailServerOut','as':_0x6498('0xd')}],'attributes':['id','name',_0x6498('0xe')]}});};exports[_0x6498('0xf')]=function(_0x429fcb){return request(_0x6498('0x10'),{'options':{'where':{'id':_0x429fcb},'attributes':[_0x6498('0x11')]}});};exports[_0x6498('0x12')]=function(_0x45b86e){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x45b86e},'attributes':['name']}});};exports[_0x6498('0x13')]=function(_0xfde02b){return request(_0x6498('0x14'),{'options':{'where':{'id':_0xfde02b},'attributes':[_0x6498('0x11')]}});};exports[_0x6498('0x15')]=function(_0x59833d){return request(_0x6498('0x16'),{'options':{'where':{'id':_0x59833d},'attributes':[_0x6498('0x17')]}});};exports[_0x6498('0x18')]=function(_0x4420ee){return request(_0x6498('0x19'),{'options':{'where':{'id':_0x4420ee},'attributes':[_0x6498('0x11')]}});};exports[_0x6498('0x1a')]=function(_0x500d3f){return request(_0x6498('0x1b'),{'options':{'where':{'phone':_0x500d3f[_0x6498('0x1c')]},'attributes':['id']}});};exports[_0x6498('0x1d')]=function(_0x2f8fdb){return request(_0x6498('0x1e'),{'options':{'where':{'id':_0x2f8fdb},'attributes':['name']}});};exports['getSoundById']=function(_0x334ee9){return request(_0x6498('0x1f'),{'options':{'where':{'id':_0x334ee9},'attributes':[_0x6498('0x20')]}});};exports[_0x6498('0x21')]=function(_0xde1ea0){return request(_0x6498('0x22'),{'options':{'raw':![],'where':{'id':_0xde1ea0},'include':[{'model':_0x6498('0x23'),'as':_0x6498('0x24')}]}});};exports[_0x6498('0x25')]=function(_0x372181){return request(_0x6498('0x26'),{'options':{'where':{'id':_0x372181},'attributes':['id',_0x6498('0x11')]}});};exports[_0x6498('0x27')]=function(_0x87685c){return request('CreateSmsMessage',{'body':_0x87685c});};exports['createSquareDetailsReport']=function(_0x2a34d0){return request('CreateSquareDetailsReport',{'body':_0x2a34d0});};exports[_0x6498('0x28')]=function(_0x30d261){return request(_0x6498('0x29'),{'body':_[_0x6498('0x2a')](_0x30d261,{'project_name':_0x30d261['arg_1'],'prev_project_name':_0x30d261['arg_2']||'','is_subproject':_0x30d261[_0x6498('0x2b')]?!![]:![],'leaveAt':moment()['format'](_0x6498('0x2c'))})});};exports[_0x6498('0x2d')]=function(_0x41d43f){return request(_0x6498('0x2e'),{'body':_0x41d43f});};exports[_0x6498('0x2f')]=function(_0x3a976e){return request(_0x6498('0x30'),{'body':_0x3a976e});};exports[_0x6498('0x31')]=function(_0x119790){return request(_0x6498('0x32'),{'options':{'raw':![],'where':{'phone':_0x119790[_0x6498('0x1c')],'ListId':_0x119790[_0x6498('0x33')]}}})[_0x6498('0x6')](function(_0x4be06f){if(_0x4be06f){return _0x4be06f;}return request(_0x6498('0x34'),{'body':_0x119790});});};exports[_0x6498('0x35')]=function(_0x5eda63){return request('ShowPause',{'options':{'where':{'id':_0x5eda63},'attributes':['name']}});};exports['agentLogin']=function(_0x61b762,_0x20e342){return request(_0x6498('0x36'),{'body':{'interface':_0x20e342},'options':{'where':_0x61b762}});};exports[_0x6498('0x37')]=function(_0x576ab2,_0x46b361,_0x49a065){return request('PauseUser',{'body':{'type':_0x46b361,'uniqueid':_0x49a065},'options':{'where':_0x576ab2}});};exports['agentUnpause']=function(_0x565975){return request(_0x6498('0x38'),{'body':{},'options':{'where':_0x565975}});};exports[_0x6498('0x39')]=function(_0x4df85d){return request(_0x6498('0x3a'),{'body':{},'options':{'where':_0x4df85d}});}; \ 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 28a44fb..daf7496 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 _0xed08=['exports','./lex'];(function(_0x2d62ba,_0x59a9e6){var _0x5e6930=function(_0x1bcf65){while(--_0x1bcf65){_0x2d62ba['push'](_0x2d62ba['shift']());}};_0x5e6930(++_0x59a9e6);}(_0xed08,0x67));var _0x8ed0=function(_0x480ec4,_0x30bf3b){_0x480ec4=_0x480ec4-0x0;var _0x13bb65=_0xed08[_0x480ec4];return _0x13bb65;};var polly=require('./polly');var lex=require(_0x8ed0('0x0'));module[_0x8ed0('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xbcc7=['./polly','./lex'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xbcc7,0x19a));var _0x7bcc=function(_0x28e307,_0x34c207){_0x28e307=_0x28e307-0x0;var _0x5cb53f=_0xbcc7[_0x28e307];return _0x5cb53f;};var polly=require(_0x7bcc('0x0'));var lex=require(_0x7bcc('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 7fb9aa4..22515b4 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 _0xe706=['exports','./lib/api'];(function(_0x582711,_0x30db0a){var _0xb6621b=function(_0x532ca4){while(--_0x532ca4){_0x582711['push'](_0x582711['shift']());}};_0xb6621b(++_0x30db0a);}(_0xe706,0xa3));var _0x6e70=function(_0x5a18c3,_0x5c6928){_0x5a18c3=_0x5a18c3-0x0;var _0x3e22e7=_0xe706[_0x5a18c3];return _0x3e22e7;};'use strict';var lex=require(_0x6e70('0x0'));module[_0x6e70('0x1')]=function(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3){return lex(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x2936e7,_0x2afa91,_0x27405a,_0x305d85,_0x864539,_0x52b5fb){return lex(_0x2936e7,_0x2afa91,_0x27405a,_0x305d85,_0x864539,_0x52b5fb);}; \ 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 e28a654..d283e7c 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(_0x3dadef,_0x2ac9f5){var _0x42b867=function(_0x973c82){while(--_0x973c82){_0x3dadef['push'](_0x3dadef['shift']());}};_0x42b867(++_0x2ac9f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x5424de,_0x5b43a3){var _0xf3216a=function(_0x14cba3){while(--_0x14cba3){_0x5424de['push'](_0x5424de['shift']());}};_0xf3216a(++_0x5b43a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 711622f..96a45d1 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 _0x1be2=['./lib/api','exports'];(function(_0x2c8702,_0x2cf285){var _0x329973=function(_0x4b77be){while(--_0x4b77be){_0x2c8702['push'](_0x2c8702['shift']());}};_0x329973(++_0x2cf285);}(_0x1be2,0xb6));var _0x21be=function(_0x3037ba,_0x186eb9){_0x3037ba=_0x3037ba-0x0;var _0x33a63b=_0x1be2[_0x3037ba];return _0x33a63b;};'use strict';var polly=require(_0x21be('0x0'));module[_0x21be('0x1')]=function(_0x37173a,_0x180f8f,_0x22bf39,_0x551d7d,_0x5a935d,_0x2f394c,_0xcad759){return polly(_0x37173a,_0x180f8f,_0x22bf39,_0x551d7d,_0x5a935d,_0x2f394c,_0xcad759);}; \ No newline at end of file +var _0x596d=['exports'];(function(_0x241dbf,_0x2fffa5){var _0x34b554=function(_0x14a779){while(--_0x14a779){_0x241dbf['push'](_0x241dbf['shift']());}};_0x34b554(++_0x2fffa5);}(_0x596d,0xbe));var _0xd596=function(_0x3f3d02,_0x10addb){_0x3f3d02=_0x3f3d02-0x0;var _0x45e57c=_0x596d[_0x3f3d02];return _0x45e57c;};'use strict';var polly=require('./lib/api');module[_0xd596('0x0')]=function(_0x3c684b,_0x57c3b1,_0x3724d9,_0x3eca27,_0x1ec4d1,_0x2906a9,_0x352cc3){return polly(_0x3c684b,_0x57c3b1,_0x3724d9,_0x3eca27,_0x1ec4d1,_0x2906a9,_0x352cc3);}; \ 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 94d9c8a..1c9b038 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 _0x6f42=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','bluebird','randomstring'];(function(_0x5722b5,_0x14b788){var _0x5570de=function(_0x520f6e){while(--_0x520f6e){_0x5722b5['push'](_0x5722b5['shift']());}};_0x5570de(++_0x14b788);}(_0x6f42,0x154));var _0x26f4=function(_0x2a3c0a,_0x163f5c){_0x2a3c0a=_0x2a3c0a-0x0;var _0x1703a2=_0x6f42[_0x2a3c0a];return _0x1703a2;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x26f4('0x0'));var rs=require(_0x26f4('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x54957a,_0x5e84f6,_0x3f394e){return new BPromise(function(_0x191489,_0x3b1e29){_0x54957a[_0x26f4('0x2')](_0x5e84f6,function(_0x3fc029,_0x32678){if(_0x3fc029){_0x3b1e29(_0x3fc029);}else if(_0x32678){if(_0x32678[_0x26f4('0x3')]instanceof Buffer){fs[_0x26f4('0x4')](_0x3f394e,_0x32678[_0x26f4('0x3')],function(_0x50044e){if(_0x50044e){_0x3b1e29(_0x50044e);}else{_0x191489();}});}else{_0x3b1e29(new Error(_0x26f4('0x5')));}}else{_0x3b1e29(new Error(_0x26f4('0x6')));}});});}module['exports']=function(_0x2017e1,_0x27e482,_0x418783,_0x306ddc,_0x5a8c42,_0x4c9772,_0xd84051){var _0x3c58b4=new AWS[(_0x26f4('0x7'))]({'accessKeyId':_0x2017e1,'secretAccessKey':_0x27e482,'region':_0x418783});var _0x12f398={'Text':_0x5a8c42,'TextType':_0x4c9772||_0x26f4('0x8'),'OutputFormat':'mp3','VoiceId':_0x306ddc};return pollyResult(_0x3c58b4,_0x12f398,_0xd84051);}; \ No newline at end of file +var _0xb42a=['mp3','path','bluebird','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x3e5e03,_0x2fac27){var _0x45279e=function(_0xb0f1c8){while(--_0xb0f1c8){_0x3e5e03['push'](_0x3e5e03['shift']());}};_0x45279e(++_0x2fac27);}(_0xb42a,0xe7));var _0xab42=function(_0x37eabb,_0x22cd8b){_0x37eabb=_0x37eabb-0x0;var _0x4fee8a=_0xb42a[_0x37eabb];return _0x4fee8a;};'use strict';var fs=require('fs');var path=require(_0xab42('0x0'));var BPromise=require(_0xab42('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x2d1c0d,_0x11781f,_0x50cd6b){return new BPromise(function(_0x4ce638,_0x364367){_0x2d1c0d['synthesizeSpeech'](_0x11781f,function(_0x395ea6,_0x2542c1){if(_0x395ea6){_0x364367(_0x395ea6);}else if(_0x2542c1){if(_0x2542c1[_0xab42('0x2')]instanceof Buffer){fs[_0xab42('0x3')](_0x50cd6b,_0x2542c1[_0xab42('0x2')],function(_0x579bdc){if(_0x579bdc){_0x364367(_0x579bdc);}else{_0x4ce638();}});}else{_0x364367(new Error(_0xab42('0x4')));}}else{_0x364367(new Error(_0xab42('0x5')));}});});}module[_0xab42('0x6')]=function(_0x3409a3,_0xf048ca,_0x558dac,_0xf7ed0d,_0x445ed2,_0x320fc4,_0x5f48bb){var _0x1142fb=new AWS[(_0xab42('0x7'))]({'accessKeyId':_0x3409a3,'secretAccessKey':_0xf048ca,'region':_0x558dac});var _0x336362={'Text':_0x445ed2,'TextType':_0x320fc4||_0xab42('0x8'),'OutputFormat':_0xab42('0x9'),'VoiceId':_0xf7ed0d};return pollyResult(_0x1142fb,_0x336362,_0x5f48bb);}; \ 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 19f95cc..8500b41 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf126=['./lib/api','exports'];(function(_0x1ebd10,_0x4914b4){var _0x1004d3=function(_0x59e3ba){while(--_0x59e3ba){_0x1ebd10['push'](_0x1ebd10['shift']());}};_0x1004d3(++_0x4914b4);}(_0xf126,0x78));var _0x6f12=function(_0x3ba2a3,_0x34d0ba){_0x3ba2a3=_0x3ba2a3-0x0;var _0x2d0e38=_0xf126[_0x3ba2a3];return _0x2d0e38;};'use strict';var asr=require(_0x6f12('0x0'));module[_0x6f12('0x1')]=function(_0x1bba9c,_0xbbd3a5,_0x3f482e,_0x2557b9){return asr(_0x1bba9c,_0xbbd3a5,_0x3f482e);}; \ No newline at end of file +var _0x4eec=['exports','./lib/api'];(function(_0x1c20bb,_0x470f93){var _0xad34cb=function(_0x3fb904){while(--_0x3fb904){_0x1c20bb['push'](_0x1c20bb['shift']());}};_0xad34cb(++_0x470f93);}(_0x4eec,0x175));var _0xc4ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4eec[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require(_0xc4ee('0x0'));module[_0xc4ee('0x1')]=function(_0x422df7,_0x50ef88,_0x560c63,_0x189222){return asr(_0x422df7,_0x50ef88,_0x560c63);}; \ 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 bdbad94..e6f2705 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 _0xfc4c=['undefined','length','base64','/v1/speech:recognize?key=','url','bluebird','https://speech.googleapis.com','string','key\x20should\x20be\x20a\x20string'];(function(_0x4ef395,_0x45faed){var _0x155d7d=function(_0x562ca0){while(--_0x562ca0){_0x4ef395['push'](_0x4ef395['shift']());}};_0x155d7d(++_0x45faed);}(_0xfc4c,0xca));var _0xcfc4=function(_0x29523b,_0x1629f2){_0x29523b=_0x29523b-0x0;var _0x4b5cb4=_0xfc4c[_0x29523b];return _0x4b5cb4;};'use strict';var url=require(_0xcfc4('0x0'));var BPromise=require(_0xcfc4('0x1'));var fs=require('fs');var host=_0xcfc4('0x2');module['exports']=function(_0x29323d,_0xb8f67b,_0x3a0bd9){return new BPromise(function(_0x54bee8,_0x57bf8a){var _0x436d9b;if(typeof _0x29323d!==_0xcfc4('0x3')||_0x29323d['length']===0x0){return _0x57bf8a('filepath\x20should\x20be\x20a\x20string');}if(typeof _0xb8f67b!==_0xcfc4('0x3')||_0xb8f67b['length']===0x0){return _0x57bf8a(_0xcfc4('0x4'));}if(typeof _0x3a0bd9!==_0xcfc4('0x5')&&(typeof _0x3a0bd9!=='string'||_0x3a0bd9[_0xcfc4('0x6')]===0x0)){return _0x57bf8a('lang\x20should\x20be\x20a\x20string');}try{_0x436d9b=fs['readFileSync'](_0x29323d)['toString'](_0xcfc4('0x7'));}catch(_0x2d8256){return _0x57bf8a(_0x2d8256);}return _0x54bee8({'method':'POST','uri':host+_0xcfc4('0x8')+_0xb8f67b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x3a0bd9},'audio':{'content':_0x436d9b}},'json':!![]});});}; \ No newline at end of file +var _0x3036=['length','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string'];(function(_0x457fcf,_0x459fa1){var _0xb49ba5=function(_0x590fe3){while(--_0x590fe3){_0x457fcf['push'](_0x457fcf['shift']());}};_0xb49ba5(++_0x459fa1);}(_0x3036,0x1a9));var _0x6303=function(_0x410d73,_0xcfb9){_0x410d73=_0x410d73-0x0;var _0x256ae5=_0x3036[_0x410d73];return _0x256ae5;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x6303('0x0');module[_0x6303('0x1')]=function(_0x304285,_0x586c8f,_0x130341){return new BPromise(function(_0x4b6d75,_0x48aa0c){var _0x4d040b;if(typeof _0x304285!==_0x6303('0x2')||_0x304285['length']===0x0){return _0x48aa0c(_0x6303('0x3'));}if(typeof _0x586c8f!==_0x6303('0x2')||_0x586c8f[_0x6303('0x4')]===0x0){return _0x48aa0c('key\x20should\x20be\x20a\x20string');}if(typeof _0x130341!==_0x6303('0x5')&&(typeof _0x130341!==_0x6303('0x2')||_0x130341[_0x6303('0x4')]===0x0)){return _0x48aa0c(_0x6303('0x6'));}try{_0x4d040b=fs[_0x6303('0x7')](_0x304285)[_0x6303('0x8')](_0x6303('0x9'));}catch(_0x179151){return _0x48aa0c(_0x179151);}return _0x4b6d75({'method':_0x6303('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x586c8f,'body':{'config':{'encoding':_0x6303('0xb'),'sampleRateHertz':_0x6303('0xc'),'languageCode':_0x130341},'audio':{'content':_0x4d040b}},'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 34f2fd1..3f02405 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 _0xc6b7=['exports','./asr'];(function(_0x27098a,_0x55fe31){var _0x2c73e3=function(_0x208297){while(--_0x208297){_0x27098a['push'](_0x27098a['shift']());}};_0x2c73e3(++_0x55fe31);}(_0xc6b7,0xdf));var _0x7c6b=function(_0x1f891e,_0x597801){_0x1f891e=_0x1f891e-0x0;var _0x349c8f=_0xc6b7[_0x1f891e];return _0x349c8f;};var asr=require(_0x7c6b('0x0'));module[_0x7c6b('0x1')]={'asr':asr}; \ No newline at end of file +var _0x8017=['exports','./asr'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x8017,0xeb));var _0x7801=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0x8017[_0x4aa4e6];return _0x322588;};var asr=require(_0x7801('0x0'));module[_0x7801('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 f37b4a6..a2ed457 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 _0x879a=['Data','audiofile','apiai-promise','bluebird','dialogflow','http','md5','querystring','request-promise','sox','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','path','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','host','WHAT_EVER','data','end','error\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','POST','generate','.mp3','from','audioContent','writeFile','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','results','map','alternatives','transcript','join','confidence','[%s]\x20%s:%s','googleDialogflow','textRequest','result','action','actionIncomplete','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts'];(function(_0x326791,_0x46d555){var _0x3ab112=function(_0x3fc979){while(--_0x3fc979){_0x326791['push'](_0x326791['shift']());}};_0x3ab112(++_0x46d555);}(_0x879a,0x85));var _0xa879=function(_0x3bb5ef,_0x182d0b){_0x3bb5ef=_0x3bb5ef-0x0;var _0x22fa25=_0x879a[_0x3bb5ef];return _0x22fa25;};'use strict';var apiai=require(_0xa879('0x0'));var BPromise=require(_0xa879('0x1'));var dialogflow=require(_0xa879('0x2'));var fs=require('fs');var http=require(_0xa879('0x3'));var https=require('https');var md5=require(_0xa879('0x4'));var path=require('path');var querystring=require(_0xa879('0x5'));var rp=require(_0xa879('0x6'));var rs=require('randomstring');var sox=require(_0xa879('0x7'));var tts=require('google-tts-api');var urlParse=require(_0xa879('0x8'))[_0xa879('0x9')];var util=require(_0xa879('0xa'));var aws=require(_0xa879('0xb'));var google=require(_0xa879('0xc'));var sestek=require(_0xa879('0xd'));var tilde=require(_0xa879('0xe'));var logger=require(_0xa879('0xf'))(_0xa879('0x10'));var ISPEECH_API=_0xa879('0x11');function downloadFile(_0x5d9569,_0x53a7cd){return new BPromise(function(_0x29958d,_0x27eece){var _0x4ff38f=urlParse(_0x5d9569);var _0x427a20=_0x4ff38f[_0xa879('0x12')]==='https:'?https:http;var _0x3ffa33={'host':_0x4ff38f['host'],'path':_0x4ff38f[_0xa879('0x13')],'headers':{'user-agent':'WHAT_EVER'}};_0x427a20[_0xa879('0x14')](_0x3ffa33,function(_0x16c57a){if(_0x16c57a[_0xa879('0x15')]!==0xc8){logger[_0xa879('0x16')](_0xa879('0x17')+_0x5d9569+_0xa879('0x18')+_0x16c57a[_0xa879('0x15')]+'\x20('+_0x16c57a['statusMessage']+')');_0x27eece(new Error(_0xa879('0x17')+_0x5d9569+_0xa879('0x18')+_0x16c57a['statusCode']+'\x20('+_0x16c57a[_0xa879('0x19')]+')'));return;}var _0x43fb8a=fs[_0xa879('0x1a')](_0x53a7cd);_0x43fb8a['on'](_0xa879('0x1b'),function(){logger[_0xa879('0x1c')](_0xa879('0x1d'));_0x43fb8a[_0xa879('0x1e')](_0x29958d);});_0x43fb8a['on']('error',function(_0xc14028){fs[_0xa879('0x1f')](_0x53a7cd);logger[_0xa879('0x16')](_0xa879('0x20'),_0xc14028);_0x27eece(_0xc14028);});_0x16c57a[_0xa879('0x21')](_0x43fb8a);})['on']('error',function(_0x138ec4){logger[_0xa879('0x16')](_0x138ec4);_0x27eece(_0x138ec4);})['end']();});}function uploadFile(_0x3299b1){return new BPromise(function(_0x5bfce8,_0xfa68a5){var _0x17d057=urlParse(_0x3299b1);var _0x4a976c=_0x17d057[_0xa879('0x12')]==='https:'?https:http;var _0x2349fe={'host':_0x17d057[_0xa879('0x22')],'path':_0x17d057[_0xa879('0x13')],'headers':{'user-agent':_0xa879('0x23')}};_0x4a976c[_0xa879('0x14')](_0x2349fe,function(_0x3715ff){if(_0x3715ff['statusCode']!==0xc8){_0xfa68a5(new Error(_0xa879('0x17')+_0x3299b1+_0xa879('0x18')+_0x3715ff['statusCode']+'\x20('+_0x3715ff[_0xa879('0x19')]+')'));return;}var _0x42c80e='';_0x3715ff['on'](_0xa879('0x24'),function(_0xdd4251){_0x42c80e+=_0xdd4251;});_0x3715ff['on']('end',function(){_0x5bfce8(_0x42c80e);});})['on'](_0xa879('0x16'),function(_0x1b62fd){_0xfa68a5(_0x1b62fd);})[_0xa879('0x25')]();});}function convertFile(_0x546683,_0xafb1f4){return new BPromise(function(_0x26d1ed,_0x3f0464){var _0x5a0ee9=sox['transcode'](_0x546683,_0xafb1f4,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5a0ee9['on'](_0xa879('0x16'),function(_0x1e509c){logger['error'](_0xa879('0x26'),_0x1e509c);_0x3f0464(_0x1e509c);});_0x5a0ee9['on'](_0xa879('0x25'),function(){logger[_0xa879('0x1c')]('finish\x20to\x20convert');_0x26d1ed();});_0x5a0ee9[_0xa879('0x27')]();});}function base64Decode(_0x498f28,_0x349650){var _0x4e94b0=path[_0xa879('0x28')](__dirname,_0xa879('0x29'),rs['generate'](0x4)+_0xa879('0x2a'));fs[_0xa879('0x2b')](_0x4e94b0,_0x498f28,_0xa879('0x2c'));return convertFile(_0x4e94b0,_0x349650)[_0xa879('0x2d')](function(){try{fs[_0xa879('0x1f')](_0x4e94b0);fs[_0xa879('0x2e')](_0x349650,_0xa879('0x2f'));}catch(_0x22f079){logger[_0xa879('0x16')](_0x22f079);}return _0x349650['split']('.')[0x0];});}function base64Encode(_0x4c47af){var _0x5af9c5=fs['readFileSync'](_0x4c47af);return new Buffer(_0x5af9c5)[_0xa879('0x30')]('base64');}exports[_0xa879('0x31')]=function(_0x32bc80,_0x10dc54,_0x26c38e,_0x1ef392,_0x41aa17,_0x2642c5){var _0x5ba842,_0x375496;var _0x9c870a=_0xa879('0x32');var _0x3669ca='?key='+_0x32bc80;var _0x8632b5={};if(_0x10dc54===_0xa879('0x33')){_0x8632b5[_0xa879('0x34')]={'ssml':_0x26c38e};}else{_0x8632b5['input']={'text':_0x26c38e};};_0x8632b5[_0xa879('0x35')]={'languageCode':_0x1ef392,'ssmlGender':_0x41aa17};_0x8632b5[_0xa879('0x36')]={'audioEncoding':_0xa879('0x37'),'sampleRateHertz':0x1f40};var _0x187432={'url':_0x9c870a+'text:synthesize'+_0x3669ca,'method':_0xa879('0x38'),'json':!![],'body':_0x8632b5};return rp(_0x187432)[_0xa879('0x2d')](function(_0x3bb235){return new BPromise(function(_0x2810ea,_0x357c41){_0x5ba842=path[_0xa879('0x28')](__dirname,_0xa879('0x29'),rs[_0xa879('0x39')](0x4)+_0xa879('0x3a'));var _0x2f6f8f=Buffer[_0xa879('0x3b')](_0x3bb235[_0xa879('0x3c')],_0xa879('0x2c'));return fs[_0xa879('0x3d')](_0x5ba842,_0x2f6f8f,function(_0x317362){_0x357c41(_0x317362);},function(_0x1113ac){fs['chmodSync'](_0x5ba842,_0xa879('0x2f'));_0x2810ea(_0x1113ac);});});})[_0xa879('0x2d')](function(_0x23ee9b){_0x375496=path['resolve'](__dirname,_0xa879('0x29'),rs[_0xa879('0x39')](0x4)+_0xa879('0x2a'));return convertFile(_0x5ba842,_0x375496);})[_0xa879('0x2d')](function(){try{fs[_0xa879('0x1f')](_0x5ba842);fs[_0xa879('0x2e')](_0x375496,'777');}catch(_0x52ee5c){logger['error'](_0x52ee5c);}logger[_0xa879('0x1c')]('googleCloudTTS\x20path',_0x375496['split']('.')[0x0]);return _0x375496[_0xa879('0x3e')]('.')[0x0];});};exports[_0xa879('0x3f')]=function(_0x3cf411,_0x55163a){var _0x506975=_0xa879('0x40');var _0x112bba,_0x34ac3e;var _0x56106e;var _0x4797a5={'encoding':_0xa879('0x41'),'method':_0xa879('0x38'),'timeout':0x2710,'url':_0x506975,'headers':{'Content-Type':_0xa879('0x42')},'body':'f.req='+encodeURIComponent(JSON[_0xa879('0x43')]([[[_0xa879('0x44'),JSON[_0xa879('0x43')]([_0x3cf411,_0x55163a||'en',![],_0xa879('0x45')]),null,'generic']]]))};return rp(_0x4797a5)[_0xa879('0x2d')](function(_0x16df1b){try{_0x56106e=eval(_0x16df1b[_0xa879('0x46')](0x5))[0x0][0x2];}catch(_0x5bc139){throw new Error(_0xa879('0x47')+_0x16df1b['data']);}if(!_0x56106e){if(_0x3cf411[_0xa879('0x48')]>0xc8){throw new Error(_0xa879('0x49'));}else{throw new Error(_0xa879('0x4a')+_0x55163a+_0xa879('0x4b'));}}try{_0x56106e=eval(_0x56106e)[0x0];}catch(_0x94549b){throw new Error(_0xa879('0x47')+res[_0xa879('0x24')]);}const _0xd299ef=_0x56106e;_0x112bba=path[_0xa879('0x28')](__dirname,'tmp',rs[_0xa879('0x39')](0x4)+_0xa879('0x3a'));fs[_0xa879('0x2b')](_0x112bba,_0x56106e,{'encoding':_0xa879('0x2c')});_0x34ac3e=path[_0xa879('0x28')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x112bba,_0x34ac3e);})['then'](function(){try{fs[_0xa879('0x1f')](_0x112bba);fs[_0xa879('0x2e')](_0x34ac3e,'777');}catch(_0x4c06a6){logger['error'](_0x4c06a6);}logger[_0xa879('0x1c')]('goggleTTS\x20path',_0x34ac3e[_0xa879('0x3e')]('.')[0x0]);return _0x34ac3e[_0xa879('0x3e')]('.')[0x0];});};exports[_0xa879('0x4c')]=function(_0x414061,_0xf7da82,_0x3493e3){return google[_0xa879('0x4d')](_0x414061,_0xf7da82,_0x3493e3)['then'](function(_0x5d951c){logger[_0xa879('0x1c')](_0x5d951c['uri']);return rp(_0x5d951c);})[_0xa879('0x2d')](function(_0x55a596){var _0x49815f='';var _0x1d3f7e=0x0;try{fs['unlink'](_0x414061);}catch(_0x32cbbb){logger[_0xa879('0x16')](_0x32cbbb);}if(_0x55a596&&_0x55a596[_0xa879('0x4e')]){_0x49815f=_0x55a596['results'][_0xa879('0x4f')](function(_0x4705ae){return _0x4705ae&&_0x4705ae[_0xa879('0x50')][0x0]&&_0x4705ae[_0xa879('0x50')][0x0][_0xa879('0x51')]?_0x4705ae[_0xa879('0x50')][0x0][_0xa879('0x51')]:'';})[_0xa879('0x52')]('\x0a');_0x1d3f7e=_0x55a596[_0xa879('0x4e')]['map'](function(_0x189dbf){return _0x189dbf&&_0x189dbf[_0xa879('0x50')][0x0]&&_0x189dbf['alternatives'][0x0][_0xa879('0x53')]?_0x189dbf[_0xa879('0x50')][0x0][_0xa879('0x53')]:0x0;})['join']('\x0a');}logger[_0xa879('0x1c')]('googleASR\x20transcription',_0x49815f);logger[_0xa879('0x1c')]('googleASR\x20confidence',_0x1d3f7e);return{'transcript':_0x49815f,'confidence':_0x1d3f7e};})['catch'](function(_0xde9f35){logger[_0xa879('0x16')](_0xa879('0x54'),_0xde9f35[_0xa879('0x15')],_0xde9f35['name'],_0xde9f35['message']);});};exports[_0xa879('0x55')]=function(_0x21d016,_0x1f2952,_0x19af7b,_0x399dc0){var _0x1db4e5=apiai(_0x1f2952,{'language':_0x399dc0||'en'});return _0x1db4e5[_0xa879('0x56')](_0x19af7b,{'sessionId':md5(_0x21d016)})['then'](function(_0x418a01){logger[_0xa879('0x1c')](JSON['stringify'](_0x418a01));return{'source':_0x418a01[_0xa879('0x57')]['source'],'resolvedQuery':_0x418a01[_0xa879('0x57')]['resolvedQuery'],'action':_0x418a01[_0xa879('0x57')][_0xa879('0x58')],'actionIncomplete':_0x418a01['result'][_0xa879('0x59')],'speech':_0x418a01[_0xa879('0x57')]['fulfillment'][_0xa879('0x5a')],'score':_0x418a01[_0xa879('0x57')][_0xa879('0x5b')],'statusCode':_0x418a01[_0xa879('0x5c')][_0xa879('0x5d')],'endConversation':_0x418a01[_0xa879('0x57')][_0xa879('0x5e')][_0xa879('0x5f')]||![],'isFallbackIntent':_0x418a01['result'][_0xa879('0x5e')][_0xa879('0x60')]};});};exports[_0xa879('0x61')]=function(_0x13de4f,_0xac990a,_0x585899,_0x520d31,_0x215e8e,_0x47f7ab){var _0x58ecc3=_0x520d31['replace'](/\\n/g,'\x0a');var _0x4ac9f4={'credentials':{'private_key':_0x58ecc3,'client_email':_0x585899}};var _0x1b58fc=new dialogflow[(_0xa879('0x62'))](_0x4ac9f4);var _0x58b2e5=_0x1b58fc[_0xa879('0x63')](_0xac990a,md5(_0x13de4f));var _0x5ab673={'session':_0x58b2e5,'queryInput':{'text':{'text':_0x215e8e,'languageCode':_0x47f7ab}}};return _0x1b58fc[_0xa879('0x64')](_0x5ab673)[_0xa879('0x2d')](function(_0x642de0){if(_0x642de0&&_0x642de0[_0xa879('0x48')]){logger[_0xa879('0x1c')](_0xa879('0x65'),JSON[_0xa879('0x43')](_0x642de0));var _0x340eaf=_0x642de0[0x0];if(_0x340eaf){var _0x36db19={'action':_0x340eaf[_0xa879('0x66')][_0xa879('0x58')],'allRequiredParamsPresent':_0x340eaf[_0xa879('0x66')]['allRequiredParamsPresent'],'endConversation':_0x340eaf[_0xa879('0x66')]['diagnosticInfo']&&_0x340eaf['queryResult'][_0xa879('0x67')][_0xa879('0x68')]?_0x340eaf['queryResult']['diagnosticInfo']['fields'][_0xa879('0x69')]['boolValue']:![],'fulfillmentText':_0x340eaf['queryResult'][_0xa879('0x6a')],'intentName':_0x340eaf[_0xa879('0x66')]['intent']['name'],'intentDisplayName':_0x340eaf[_0xa879('0x66')][_0xa879('0x6b')][_0xa879('0x6c')],'isFallbackIntent':_0x340eaf[_0xa879('0x66')]['intent']['isFallback'],'languageCode':_0x340eaf[_0xa879('0x66')]['languageCode'],'queryText':_0x340eaf['queryResult']['queryText'],'responseId':_0x340eaf[_0xa879('0x6d')],'score':_0x340eaf['queryResult'][_0xa879('0x6e')],'speech':_0x340eaf['queryResult'][_0xa879('0x6a')],'providerResponse':JSON[_0xa879('0x43')](_0x642de0)};return _0x36db19;}}});};exports['tildeASR']=function(_0x2aa219,_0x11234b,_0x3cb5ab,_0x18bcd4){return tilde[_0xa879('0x4d')](_0x2aa219,_0x11234b,_0x3cb5ab,_0x18bcd4)['then'](function(_0x1df49b){try{fs['unlink'](_0x2aa219);}catch(_0x1eb7f8){logger[_0xa879('0x16')](_0x1eb7f8);}logger[_0xa879('0x1c')](_0xa879('0x6f'),_0x1df49b[_0xa879('0x51')]);logger[_0xa879('0x1c')](_0xa879('0x70'),_0x1df49b[_0xa879('0x53')]);return _0x1df49b;});};exports[_0xa879('0x71')]=function(_0x2ad8cf,_0x1a679a,_0x393d8a,_0x1d85aa,_0x149924,_0x1b27ca){var _0x4f3741=path[_0xa879('0x28')](__dirname,'tmp',rs[_0xa879('0x39')](0x4)+_0xa879('0x3a'));var _0x17f72a;return aws[_0xa879('0x72')](_0x2ad8cf,_0x1a679a,_0x393d8a,_0x1d85aa,_0x149924,_0x1b27ca,_0x4f3741)[_0xa879('0x2d')](function(){_0x17f72a=path['resolve'](__dirname,_0xa879('0x29'),rs[_0xa879('0x39')](0x4)+_0xa879('0x2a'));return convertFile(_0x4f3741,_0x17f72a);})[_0xa879('0x2d')](function(){try{fs[_0xa879('0x1f')](_0x4f3741);fs['chmodSync'](_0x17f72a,_0xa879('0x2f'));}catch(_0x17e0d0){logger['error'](_0x17e0d0);}return _0x17f72a['split']('.')[0x0];});};exports[_0xa879('0x73')]=function(_0x4dd099,_0x1b22e4,_0x4dcfaa,_0x5cac93,_0x5f3175,_0x5e029a){return aws[_0xa879('0x74')](_0x4dd099,_0x1b22e4,_0x4dcfaa,_0x5cac93,_0x5f3175,_0x5e029a)[_0xa879('0x2d')](function(_0xd51bf1){logger[_0xa879('0x1c')](JSON[_0xa879('0x43')](_0xd51bf1));return _0xd51bf1;});};exports[_0xa879('0x75')]=function(_0x41ea03,_0x3e448d,_0x226835,_0x1a6dc6){var _0x2048ca=util[_0xa879('0x76')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x41ea03,encodeURIComponent(_0x3e448d),_0x226835,_0x1a6dc6);var _0x2e686a=path[_0xa879('0x28')](__dirname,_0xa879('0x29'),rs['generate'](0x4)+_0xa879('0x3a'));var _0x1e1979;return downloadFile(_0x2048ca,_0x2e686a)['then'](function(){_0x1e1979=path['resolve'](__dirname,_0xa879('0x29'),rs[_0xa879('0x39')](0x4)+_0xa879('0x2a'));return convertFile(_0x2e686a,_0x1e1979);})[_0xa879('0x2d')](function(){try{fs[_0xa879('0x1f')](_0x2e686a);fs[_0xa879('0x2e')](_0x1e1979,'777');}catch(_0x4c97ec){logger[_0xa879('0x16')](_0x4c97ec);}return _0x1e1979[_0xa879('0x3e')]('.')[0x0];});};exports[_0xa879('0x77')]=function(_0x35d045,_0x1d7cc6,_0x5b835e,_0x1089bc){var _0x83776d=util[_0xa879('0x76')](_0xa879('0x78'),ISPEECH_API,_0x1d7cc6,_0x5b835e,base64Encode(_0x35d045),_0x1089bc?util[_0xa879('0x76')](_0xa879('0x79'),encodeURIComponent(_0x1089bc)):'freeform=3');return uploadFile(_0x83776d)['then'](function(_0x33b592){return querystring['parse'](_0x33b592);});};exports[_0xa879('0x7a')]=function(_0x104e29,_0x28c729){return sestek[_0xa879('0x7b')](_0x104e29,_0x28c729)[_0xa879('0x2d')](function(_0x56b245){logger['info'](JSON[_0xa879('0x43')](_0x56b245));var _0x17baa1={'speech':_0x56b245[_0xa879('0x7c')],'action':_0x56b245[_0xa879('0x7d')]?_0x56b245[_0xa879('0x7d')][_0xa879('0x7e')]:undefined,'actiondata':_0x56b245['channelData']?_0x56b245[_0xa879('0x7d')][_0xa879('0x7f')]:undefined};if(_0x56b245[_0xa879('0x7d')]&&_0x56b245[_0xa879('0x7d')][_0xa879('0x80')]){return base64Decode(_0x56b245[_0xa879('0x7d')][_0xa879('0x80')][_0xa879('0x81')],path[_0xa879('0x28')](__dirname,_0xa879('0x29'),rs[_0xa879('0x39')](0x4)+'.wav'))[_0xa879('0x2d')](function(_0x524fc4){_0x17baa1[_0xa879('0x82')]=_0x524fc4;return _0x17baa1;});}return _0x17baa1;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x9aeb=['ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','parse','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','sox','url','util','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','finish','info','finish\x20download\x20file','close','unlink','download\x20error','end','https:','request\x20to\x20','data','transcode','wav','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','chmodSync','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','asr','map','alternatives','transcript','results','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','boolValue','fulfillmentText','name','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3'];(function(_0x2afcb5,_0x29a0c5){var _0x37608f=function(_0x2c9728){while(--_0x2c9728){_0x2afcb5['push'](_0x2afcb5['shift']());}};_0x37608f(++_0x29a0c5);}(_0x9aeb,0x128));var _0xb9ae=function(_0x1c34b0,_0x1c23bf){_0x1c34b0=_0x1c34b0-0x0;var _0x103554=_0x9aeb[_0x1c34b0];return _0x103554;};'use strict';var apiai=require(_0xb9ae('0x0'));var BPromise=require(_0xb9ae('0x1'));var dialogflow=require(_0xb9ae('0x2'));var fs=require('fs');var http=require(_0xb9ae('0x3'));var https=require(_0xb9ae('0x4'));var md5=require(_0xb9ae('0x5'));var path=require(_0xb9ae('0x6'));var querystring=require(_0xb9ae('0x7'));var rp=require(_0xb9ae('0x8'));var rs=require('randomstring');var sox=require(_0xb9ae('0x9'));var tts=require('google-tts-api');var urlParse=require(_0xb9ae('0xa'))['parse'];var util=require(_0xb9ae('0xb'));var aws=require(_0xb9ae('0xc'));var google=require(_0xb9ae('0xd'));var sestek=require(_0xb9ae('0xe'));var tilde=require(_0xb9ae('0xf'));var logger=require(_0xb9ae('0x10'))('agi');var ISPEECH_API=_0xb9ae('0x11');function downloadFile(_0x277185,_0x42bc17){return new BPromise(function(_0x276a5a,_0x6bbf75){var _0x2b3b55=urlParse(_0x277185);var _0x10663f=_0x2b3b55[_0xb9ae('0x12')]==='https:'?https:http;var _0x3fca7d={'host':_0x2b3b55[_0xb9ae('0x13')],'path':_0x2b3b55[_0xb9ae('0x6')],'headers':{'user-agent':_0xb9ae('0x14')}};_0x10663f[_0xb9ae('0x15')](_0x3fca7d,function(_0x536a84){if(_0x536a84['statusCode']!==0xc8){logger[_0xb9ae('0x16')]('request\x20to\x20'+_0x277185+_0xb9ae('0x17')+_0x536a84[_0xb9ae('0x18')]+'\x20('+_0x536a84[_0xb9ae('0x19')]+')');_0x6bbf75(new Error('request\x20to\x20'+_0x277185+_0xb9ae('0x17')+_0x536a84[_0xb9ae('0x18')]+'\x20('+_0x536a84[_0xb9ae('0x19')]+')'));return;}var _0x28e71a=fs['createWriteStream'](_0x42bc17);_0x28e71a['on'](_0xb9ae('0x1a'),function(){logger[_0xb9ae('0x1b')](_0xb9ae('0x1c'));_0x28e71a[_0xb9ae('0x1d')](_0x276a5a);});_0x28e71a['on'](_0xb9ae('0x16'),function(_0x203eeb){fs[_0xb9ae('0x1e')](_0x42bc17);logger[_0xb9ae('0x16')](_0xb9ae('0x1f'),_0x203eeb);_0x6bbf75(_0x203eeb);});_0x536a84['pipe'](_0x28e71a);})['on'](_0xb9ae('0x16'),function(_0x4620bb){logger[_0xb9ae('0x16')](_0x4620bb);_0x6bbf75(_0x4620bb);})[_0xb9ae('0x20')]();});}function uploadFile(_0x2e1595){return new BPromise(function(_0x10fbd4,_0x2106bd){var _0xdb5dcc=urlParse(_0x2e1595);var _0xac06c5=_0xdb5dcc[_0xb9ae('0x12')]===_0xb9ae('0x21')?https:http;var _0x30dcb5={'host':_0xdb5dcc[_0xb9ae('0x13')],'path':_0xdb5dcc[_0xb9ae('0x6')],'headers':{'user-agent':_0xb9ae('0x14')}};_0xac06c5[_0xb9ae('0x15')](_0x30dcb5,function(_0x580b57){if(_0x580b57[_0xb9ae('0x18')]!==0xc8){_0x2106bd(new Error(_0xb9ae('0x22')+_0x2e1595+_0xb9ae('0x17')+_0x580b57[_0xb9ae('0x18')]+'\x20('+_0x580b57[_0xb9ae('0x19')]+')'));return;}var _0x1f0115='';_0x580b57['on'](_0xb9ae('0x23'),function(_0x29a3cf){_0x1f0115+=_0x29a3cf;});_0x580b57['on'](_0xb9ae('0x20'),function(){_0x10fbd4(_0x1f0115);});})['on']('error',function(_0x27a513){_0x2106bd(_0x27a513);})['end']();});}function convertFile(_0x309e20,_0x13058b){return new BPromise(function(_0x79f8da,_0x36e24f){var _0x1931f4=sox[_0xb9ae('0x24')](_0x309e20,_0x13058b,{'sampleRate':0x1f40,'format':_0xb9ae('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1931f4['on'](_0xb9ae('0x16'),function(_0x1a47cf){logger[_0xb9ae('0x16')]('error\x20convert',_0x1a47cf);_0x36e24f(_0x1a47cf);});_0x1931f4['on']('end',function(){logger[_0xb9ae('0x1b')](_0xb9ae('0x26'));_0x79f8da();});_0x1931f4[_0xb9ae('0x27')]();});}function base64Decode(_0x2b7bd3,_0x4f1273){var _0x507697=path[_0xb9ae('0x28')](__dirname,_0xb9ae('0x29'),rs[_0xb9ae('0x2a')](0x4)+_0xb9ae('0x2b'));fs[_0xb9ae('0x2c')](_0x507697,_0x2b7bd3,_0xb9ae('0x2d'));return convertFile(_0x507697,_0x4f1273)[_0xb9ae('0x2e')](function(){try{fs['unlink'](_0x507697);fs['chmodSync'](_0x4f1273,_0xb9ae('0x2f'));}catch(_0x1680dd){logger[_0xb9ae('0x16')](_0x1680dd);}return _0x4f1273[_0xb9ae('0x30')]('.')[0x0];});}function base64Encode(_0x497466){var _0xdba88b=fs['readFileSync'](_0x497466);return new Buffer(_0xdba88b)[_0xb9ae('0x31')](_0xb9ae('0x2d'));}exports[_0xb9ae('0x32')]=function(_0x1210e8,_0x3459e6,_0x3c7f9c,_0x320e80,_0x2b6400,_0x4544c9){var _0x31330e,_0x147e75;var _0xdf6a45=_0xb9ae('0x33');var _0x49831a=_0xb9ae('0x34')+_0x1210e8;var _0x1f4358={};if(_0x3459e6===_0xb9ae('0x35')){_0x1f4358[_0xb9ae('0x36')]={'ssml':_0x3c7f9c};}else{_0x1f4358[_0xb9ae('0x36')]={'text':_0x3c7f9c};};_0x1f4358[_0xb9ae('0x37')]={'languageCode':_0x320e80,'ssmlGender':_0x2b6400};_0x1f4358[_0xb9ae('0x38')]={'audioEncoding':_0xb9ae('0x39'),'sampleRateHertz':0x1f40};var _0x23c411={'url':_0xdf6a45+_0xb9ae('0x3a')+_0x49831a,'method':_0xb9ae('0x3b'),'json':!![],'body':_0x1f4358};return rp(_0x23c411)[_0xb9ae('0x2e')](function(_0x50ddc8){return new BPromise(function(_0x4fe2ec,_0x559459){_0x31330e=path[_0xb9ae('0x28')](__dirname,_0xb9ae('0x29'),rs[_0xb9ae('0x2a')](0x4)+_0xb9ae('0x3c'));var _0x597a98=Buffer[_0xb9ae('0x3d')](_0x50ddc8[_0xb9ae('0x3e')],_0xb9ae('0x2d'));return fs['writeFile'](_0x31330e,_0x597a98,function(_0x14790d){_0x559459(_0x14790d);},function(_0x5d160f){fs[_0xb9ae('0x3f')](_0x31330e,_0xb9ae('0x2f'));_0x4fe2ec(_0x5d160f);});});})[_0xb9ae('0x2e')](function(_0xa96474){_0x147e75=path[_0xb9ae('0x28')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x31330e,_0x147e75);})[_0xb9ae('0x2e')](function(){try{fs['unlink'](_0x31330e);fs[_0xb9ae('0x3f')](_0x147e75,_0xb9ae('0x2f'));}catch(_0x54e055){logger[_0xb9ae('0x16')](_0x54e055);}logger[_0xb9ae('0x1b')](_0xb9ae('0x40'),_0x147e75[_0xb9ae('0x30')]('.')[0x0]);return _0x147e75[_0xb9ae('0x30')]('.')[0x0];});};exports[_0xb9ae('0x41')]=function(_0xbcb009,_0x5c32c7){var _0x153820='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x99e312,_0xb52322;var _0xa959c2;var _0x1fd2ab={'encoding':_0xb9ae('0x42'),'method':_0xb9ae('0x3b'),'timeout':0x2710,'url':_0x153820,'headers':{'Content-Type':_0xb9ae('0x43')},'body':_0xb9ae('0x44')+encodeURIComponent(JSON[_0xb9ae('0x45')]([[[_0xb9ae('0x46'),JSON['stringify']([_0xbcb009,_0x5c32c7||'en',![],_0xb9ae('0x47')]),null,_0xb9ae('0x48')]]]))};return rp(_0x1fd2ab)['then'](function(_0x4c8fad){try{_0xa959c2=eval(_0x4c8fad[_0xb9ae('0x49')](0x5))[0x0][0x2];}catch(_0xbed259){throw new Error(_0xb9ae('0x4a')+_0x4c8fad['data']);}if(!_0xa959c2){if(_0xbcb009[_0xb9ae('0x4b')]>0xc8){throw new Error(_0xb9ae('0x4c'));}else{throw new Error(_0xb9ae('0x4d')+_0x5c32c7+'\x22\x20might\x20not\x20exist');}}try{_0xa959c2=eval(_0xa959c2)[0x0];}catch(_0x500ff2){throw new Error(_0xb9ae('0x4a')+res['data']);}const _0x13ccb4=_0xa959c2;_0x99e312=path[_0xb9ae('0x28')](__dirname,'tmp',rs[_0xb9ae('0x2a')](0x4)+'.mp3');fs[_0xb9ae('0x2c')](_0x99e312,_0xa959c2,{'encoding':_0xb9ae('0x2d')});_0xb52322=path[_0xb9ae('0x28')](__dirname,_0xb9ae('0x29'),rs[_0xb9ae('0x2a')](0x4)+_0xb9ae('0x2b'));return convertFile(_0x99e312,_0xb52322);})['then'](function(){try{fs['unlink'](_0x99e312);fs[_0xb9ae('0x3f')](_0xb52322,'777');}catch(_0x360beb){logger['error'](_0x360beb);}logger[_0xb9ae('0x1b')](_0xb9ae('0x4e'),_0xb52322[_0xb9ae('0x30')]('.')[0x0]);return _0xb52322[_0xb9ae('0x30')]('.')[0x0];});};exports[_0xb9ae('0x4f')]=function(_0x4459d0,_0x5744d3,_0x98358d){return google[_0xb9ae('0x50')](_0x4459d0,_0x5744d3,_0x98358d)[_0xb9ae('0x2e')](function(_0x8bb720){logger['info'](_0x8bb720['uri']);return rp(_0x8bb720);})['then'](function(_0x4974b5){var _0x234550='';var _0x5cbcc4=0x0;try{fs[_0xb9ae('0x1e')](_0x4459d0);}catch(_0x4ab03f){logger[_0xb9ae('0x16')](_0x4ab03f);}if(_0x4974b5&&_0x4974b5['results']){_0x234550=_0x4974b5['results'][_0xb9ae('0x51')](function(_0x20176a){return _0x20176a&&_0x20176a[_0xb9ae('0x52')][0x0]&&_0x20176a[_0xb9ae('0x52')][0x0][_0xb9ae('0x53')]?_0x20176a['alternatives'][0x0][_0xb9ae('0x53')]:'';})['join']('\x0a');_0x5cbcc4=_0x4974b5[_0xb9ae('0x54')][_0xb9ae('0x51')](function(_0x461b9c){return _0x461b9c&&_0x461b9c[_0xb9ae('0x52')][0x0]&&_0x461b9c[_0xb9ae('0x52')][0x0][_0xb9ae('0x55')]?_0x461b9c[_0xb9ae('0x52')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0xb9ae('0x1b')](_0xb9ae('0x56'),_0x234550);logger['info'](_0xb9ae('0x57'),_0x5cbcc4);return{'transcript':_0x234550,'confidence':_0x5cbcc4};})[_0xb9ae('0x58')](function(_0xf7b3ac){logger['error'](_0xb9ae('0x59'),_0xf7b3ac[_0xb9ae('0x18')],_0xf7b3ac['name'],_0xf7b3ac[_0xb9ae('0x5a')]);});};exports[_0xb9ae('0x5b')]=function(_0x36f8fe,_0x299217,_0x10f328,_0x59e680){var _0x4cec6f=apiai(_0x299217,{'language':_0x59e680||'en'});return _0x4cec6f[_0xb9ae('0x5c')](_0x10f328,{'sessionId':md5(_0x36f8fe)})['then'](function(_0x15fc32){logger['info'](JSON[_0xb9ae('0x45')](_0x15fc32));return{'source':_0x15fc32[_0xb9ae('0x5d')][_0xb9ae('0x5e')],'resolvedQuery':_0x15fc32[_0xb9ae('0x5d')]['resolvedQuery'],'action':_0x15fc32['result'][_0xb9ae('0x5f')],'actionIncomplete':_0x15fc32[_0xb9ae('0x5d')][_0xb9ae('0x60')],'speech':_0x15fc32[_0xb9ae('0x5d')][_0xb9ae('0x61')]['speech'],'score':_0x15fc32['result'][_0xb9ae('0x62')],'statusCode':_0x15fc32[_0xb9ae('0x63')][_0xb9ae('0x64')],'endConversation':_0x15fc32['result'][_0xb9ae('0x65')]['endConversation']||![],'isFallbackIntent':_0x15fc32[_0xb9ae('0x5d')][_0xb9ae('0x65')][_0xb9ae('0x66')]};});};exports[_0xb9ae('0x67')]=function(_0x39a3ed,_0x205938,_0x34f9f1,_0x547e8d,_0x54acf0,_0x172827){var _0x40d9a6=_0x547e8d[_0xb9ae('0x68')](/\\n/g,'\x0a');var _0x1daaad={'credentials':{'private_key':_0x40d9a6,'client_email':_0x34f9f1}};var _0xf93e4c=new dialogflow[(_0xb9ae('0x69'))](_0x1daaad);var _0x5f4d9d=_0xf93e4c[_0xb9ae('0x6a')](_0x205938,md5(_0x39a3ed));var _0x6915d={'session':_0x5f4d9d,'queryInput':{'text':{'text':_0x54acf0,'languageCode':_0x172827}}};return _0xf93e4c[_0xb9ae('0x6b')](_0x6915d)[_0xb9ae('0x2e')](function(_0x55ac2e){if(_0x55ac2e&&_0x55ac2e[_0xb9ae('0x4b')]){logger[_0xb9ae('0x1b')](_0xb9ae('0x6c'),JSON[_0xb9ae('0x45')](_0x55ac2e));var _0x4a1a64=_0x55ac2e[0x0];if(_0x4a1a64){var _0x58de3d={'action':_0x4a1a64[_0xb9ae('0x6d')][_0xb9ae('0x5f')],'allRequiredParamsPresent':_0x4a1a64['queryResult']['allRequiredParamsPresent'],'endConversation':_0x4a1a64[_0xb9ae('0x6d')][_0xb9ae('0x6e')]&&_0x4a1a64[_0xb9ae('0x6d')][_0xb9ae('0x6e')]['fields']?_0x4a1a64[_0xb9ae('0x6d')][_0xb9ae('0x6e')][_0xb9ae('0x6f')]['end_conversation'][_0xb9ae('0x70')]:![],'fulfillmentText':_0x4a1a64['queryResult'][_0xb9ae('0x71')],'intentName':_0x4a1a64[_0xb9ae('0x6d')]['intent'][_0xb9ae('0x72')],'intentDisplayName':_0x4a1a64[_0xb9ae('0x6d')][_0xb9ae('0x73')][_0xb9ae('0x74')],'isFallbackIntent':_0x4a1a64[_0xb9ae('0x6d')][_0xb9ae('0x73')][_0xb9ae('0x75')],'languageCode':_0x4a1a64['queryResult'][_0xb9ae('0x76')],'queryText':_0x4a1a64['queryResult'][_0xb9ae('0x77')],'responseId':_0x4a1a64['responseId'],'score':_0x4a1a64[_0xb9ae('0x6d')][_0xb9ae('0x78')],'speech':_0x4a1a64[_0xb9ae('0x6d')][_0xb9ae('0x71')],'providerResponse':JSON[_0xb9ae('0x45')](_0x55ac2e)};return _0x58de3d;}}});};exports[_0xb9ae('0x79')]=function(_0x4ed39c,_0x130dcc,_0x1a7b18,_0x50cf47){return tilde[_0xb9ae('0x50')](_0x4ed39c,_0x130dcc,_0x1a7b18,_0x50cf47)[_0xb9ae('0x2e')](function(_0x375cce){try{fs['unlink'](_0x4ed39c);}catch(_0x282b8d){logger[_0xb9ae('0x16')](_0x282b8d);}logger[_0xb9ae('0x1b')](_0xb9ae('0x7a'),_0x375cce[_0xb9ae('0x53')]);logger[_0xb9ae('0x1b')](_0xb9ae('0x7b'),_0x375cce[_0xb9ae('0x55')]);return _0x375cce;});};exports['awsPolly']=function(_0x2a63d5,_0x224a2a,_0x17a680,_0x26d736,_0x25efa6,_0xd1d28){var _0x5a2a8f=path[_0xb9ae('0x28')](__dirname,_0xb9ae('0x29'),rs[_0xb9ae('0x2a')](0x4)+_0xb9ae('0x3c'));var _0x31633b;return aws[_0xb9ae('0x7c')](_0x2a63d5,_0x224a2a,_0x17a680,_0x26d736,_0x25efa6,_0xd1d28,_0x5a2a8f)[_0xb9ae('0x2e')](function(){_0x31633b=path[_0xb9ae('0x28')](__dirname,_0xb9ae('0x29'),rs[_0xb9ae('0x2a')](0x4)+'.wav');return convertFile(_0x5a2a8f,_0x31633b);})[_0xb9ae('0x2e')](function(){try{fs['unlink'](_0x5a2a8f);fs[_0xb9ae('0x3f')](_0x31633b,_0xb9ae('0x2f'));}catch(_0x434620){logger[_0xb9ae('0x16')](_0x434620);}return _0x31633b[_0xb9ae('0x30')]('.')[0x0];});};exports[_0xb9ae('0x7d')]=function(_0x38c9bc,_0x9a8540,_0x559d27,_0x9247fa,_0x4e80c3,_0x1a49bb){return aws[_0xb9ae('0x7e')](_0x38c9bc,_0x9a8540,_0x559d27,_0x9247fa,_0x4e80c3,_0x1a49bb)[_0xb9ae('0x2e')](function(_0x5f2062){logger['info'](JSON[_0xb9ae('0x45')](_0x5f2062));return _0x5f2062;});};exports[_0xb9ae('0x7f')]=function(_0x1dff9c,_0x470330,_0x7cb2d4,_0x215f1c){var _0x28f127=util[_0xb9ae('0x80')](_0xb9ae('0x81'),ISPEECH_API,_0x1dff9c,encodeURIComponent(_0x470330),_0x7cb2d4,_0x215f1c);var _0x1e7f36=path[_0xb9ae('0x28')](__dirname,'tmp',rs[_0xb9ae('0x2a')](0x4)+_0xb9ae('0x3c'));var _0x45a53b;return downloadFile(_0x28f127,_0x1e7f36)['then'](function(){_0x45a53b=path[_0xb9ae('0x28')](__dirname,_0xb9ae('0x29'),rs[_0xb9ae('0x2a')](0x4)+_0xb9ae('0x2b'));return convertFile(_0x1e7f36,_0x45a53b);})[_0xb9ae('0x2e')](function(){try{fs[_0xb9ae('0x1e')](_0x1e7f36);fs['chmodSync'](_0x45a53b,_0xb9ae('0x2f'));}catch(_0x462aa9){logger['error'](_0x462aa9);}return _0x45a53b[_0xb9ae('0x30')]('.')[0x0];});};exports[_0xb9ae('0x82')]=function(_0x5b07f4,_0x234be2,_0x3b27ca,_0x5347f9){var _0x196880=util['format'](_0xb9ae('0x83'),ISPEECH_API,_0x234be2,_0x3b27ca,base64Encode(_0x5b07f4),_0x5347f9?util[_0xb9ae('0x80')]('model=%s',encodeURIComponent(_0x5347f9)):_0xb9ae('0x84'));return uploadFile(_0x196880)[_0xb9ae('0x2e')](function(_0x5b2b6b){return querystring[_0xb9ae('0x85')](_0x5b2b6b);});};exports[_0xb9ae('0x86')]=function(_0x406558,_0x19664d){return sestek[_0xb9ae('0x87')](_0x406558,_0x19664d)[_0xb9ae('0x2e')](function(_0x4de17b){logger[_0xb9ae('0x1b')](JSON[_0xb9ae('0x45')](_0x4de17b));var _0x38f108={'speech':_0x4de17b['text'],'action':_0x4de17b[_0xb9ae('0x88')]?_0x4de17b[_0xb9ae('0x88')][_0xb9ae('0x89')]:undefined,'actiondata':_0x4de17b[_0xb9ae('0x88')]?_0x4de17b[_0xb9ae('0x88')][_0xb9ae('0x8a')]:undefined};if(_0x4de17b[_0xb9ae('0x88')]&&_0x4de17b[_0xb9ae('0x88')][_0xb9ae('0x8b')]){return base64Decode(_0x4de17b[_0xb9ae('0x88')]['AudioFromTts']['Data'],path[_0xb9ae('0x28')](__dirname,_0xb9ae('0x29'),rs[_0xb9ae('0x2a')](0x4)+'.wav'))[_0xb9ae('0x2e')](function(_0x2467b5){_0x38f108[_0xb9ae('0x8c')]=_0x2467b5;return _0x38f108;});}return _0x38f108;});};exports[_0xb9ae('0x8d')]=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 a639f5f..cee378d 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 _0xd0ca=['./nda','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xd0ca,0x1dc));var _0xad0c=function(_0x5a3759,_0x359292){_0x5a3759=_0x5a3759-0x0;var _0x207c47=_0xd0ca[_0x5a3759];return _0x207c47;};var nda=require(_0xad0c('0x0'));module[_0xad0c('0x1')]={'nda':nda}; \ No newline at end of file +var _0x350c=['./nda','exports'];(function(_0x47adba,_0x223bdb){var _0xbeff41=function(_0x562d03){while(--_0x562d03){_0x47adba['push'](_0x47adba['shift']());}};_0xbeff41(++_0x223bdb);}(_0x350c,0x17e));var _0xc350=function(_0x2bbdc3,_0x770578){_0x2bbdc3=_0x2bbdc3-0x0;var _0x5ee1da=_0x350c[_0x2bbdc3];return _0x5ee1da;};var nda=require(_0xc350('0x0'));module[_0xc350('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index b22fb72..f52c785 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 _0x2bdb=['CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','AudioOutputSettings','audio/wav','custom_action'];(function(_0x23b809,_0x4f7718){var _0xc781a8=function(_0x1528e8){while(--_0x1528e8){_0x23b809['push'](_0x23b809['shift']());}};_0xc781a8(++_0x4f7718);}(_0x2bdb,0x105));var _0xb2bd=function(_0x160a03,_0x3769f2){_0x160a03=_0x160a03-0x0;var _0x899179=_0x2bdb[_0x160a03];return _0x899179;};'use strict';var rp=require(_0xb2bd('0x0'));var url=require('url');var logger=require(_0xb2bd('0x1'))('agi');module[_0xb2bd('0x2')]=function(_0x1d3ddb,_0xab9a35){var _0x552d38={'method':_0xb2bd('0x3'),'uri':url[_0xb2bd('0x4')](_0xab9a35[_0xb2bd('0x5')],_0xb2bd('0x6')),'form':{'grant_type':_0xb2bd('0x7'),'username':_0xab9a35[_0xb2bd('0x8')],'password':_0xab9a35[_0xb2bd('0x7')]},'json':!![]};return rp(_0x552d38)['then'](function(_0x21462b){var _0x4d9d3f={'method':_0xb2bd('0x3'),'uri':url[_0xb2bd('0x4')](_0xab9a35[_0xb2bd('0x9')],_0xb2bd('0xa')),'body':{'type':_0xab9a35[_0xb2bd('0xb')]||_0xb2bd('0xc'),'channelId':_0xb2bd('0xd'),'conversation':{'id':_0x1d3ddb[_0xb2bd('0xe')]},'from':{'id':_0x1d3ddb[_0xb2bd('0xf')],'name':_0x1d3ddb['calleridname']},'recipient':{'id':_0x1d3ddb[_0xb2bd('0x10')],'name':_0x1d3ddb[_0xb2bd('0x11')]},'text':_0xab9a35[_0xb2bd('0x12')],'channelData':{}},'headers':{'Authorization':_0xb2bd('0x13')+_0x21462b[_0xb2bd('0x14')]},'json':!![]};if(_0xab9a35[_0xb2bd('0x15')]){_0x4d9d3f[_0xb2bd('0x16')][_0xb2bd('0x17')]['ProjectName']=_0xab9a35[_0xb2bd('0x15')];}if(_0xab9a35['ndagenerate_audio']=='1'){_0x4d9d3f[_0xb2bd('0x16')][_0xb2bd('0x17')][_0xb2bd('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb2bd('0x19')};}if(_0xab9a35[_0xb2bd('0x1a')]){_0x4d9d3f['body'][_0xb2bd('0x17')][_0xb2bd('0x1b')]=_0xab9a35[_0xb2bd('0x1a')];if(_0xab9a35[_0xb2bd('0x1c')]){_0x4d9d3f['body'][_0xb2bd('0x17')][_0xb2bd('0x1d')]=_0xab9a35['custom_action_data'];}}logger[_0xb2bd('0x1e')](JSON[_0xb2bd('0x1f')](_0x4d9d3f));return rp(_0x4d9d3f);});}; \ No newline at end of file +var _0x9d9b=['CustomAction','custom_action','custom_action_data','CustomActionData','stringify','url','../../../../../config/logger','exports','POST','ndauth_url','password','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','callerid','calleridname','dnid','text','Bearer\x20','project','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings','audio/wav'];(function(_0x469118,_0x57e49f){var _0x130029=function(_0x3f6193){while(--_0x3f6193){_0x469118['push'](_0x469118['shift']());}};_0x130029(++_0x57e49f);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x555109,_0x1d7ebb){_0x555109=_0x555109-0x0;var _0x2d499d=_0x9d9b[_0x555109];return _0x2d499d;};'use strict';var rp=require('request-promise');var url=require(_0xb9d9('0x0'));var logger=require(_0xb9d9('0x1'))('agi');module[_0xb9d9('0x2')]=function(_0x5924bd,_0x29ac5b){var _0x19d86d={'method':_0xb9d9('0x3'),'uri':url['resolve'](_0x29ac5b[_0xb9d9('0x4')],'/token'),'form':{'grant_type':_0xb9d9('0x5'),'username':_0x29ac5b[_0xb9d9('0x6')],'password':_0x29ac5b['password']},'json':!![]};return rp(_0x19d86d)[_0xb9d9('0x7')](function(_0x20e0e5){var _0x184896={'method':_0xb9d9('0x3'),'uri':url[_0xb9d9('0x8')](_0x29ac5b[_0xb9d9('0x9')],_0xb9d9('0xa')),'body':{'type':_0x29ac5b['ndaactivity_type']||'message','channelId':'Nda','conversation':{'id':_0x5924bd['uniqueid']},'from':{'id':_0x5924bd[_0xb9d9('0xb')],'name':_0x5924bd[_0xb9d9('0xc')]},'recipient':{'id':_0x5924bd[_0xb9d9('0xd')],'name':_0x5924bd['extension']},'text':_0x29ac5b[_0xb9d9('0xe')],'channelData':{}},'headers':{'Authorization':_0xb9d9('0xf')+_0x20e0e5['access_token']},'json':!![]};if(_0x29ac5b[_0xb9d9('0x10')]){_0x184896['body'][_0xb9d9('0x11')][_0xb9d9('0x12')]=_0x29ac5b[_0xb9d9('0x10')];}if(_0x29ac5b[_0xb9d9('0x13')]=='1'){_0x184896[_0xb9d9('0x14')][_0xb9d9('0x11')][_0xb9d9('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb9d9('0x16')};}if(_0x29ac5b['custom_action']){_0x184896['body'][_0xb9d9('0x11')][_0xb9d9('0x17')]=_0x29ac5b[_0xb9d9('0x18')];if(_0x29ac5b[_0xb9d9('0x19')]){_0x184896['body']['channelData'][_0xb9d9('0x1a')]=_0x29ac5b['custom_action_data'];}}logger['info'](JSON[_0xb9d9('0x1b')](_0x184896));return rp(_0x184896);});}; \ 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 3ee242d..503c0a2 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 _0x263e=['./lib/api','exports'];(function(_0x5680df,_0x3c9987){var _0x20ba55=function(_0x2e5d77){while(--_0x2e5d77){_0x5680df['push'](_0x5680df['shift']());}};_0x20ba55(++_0x3c9987);}(_0x263e,0xb0));var _0xe263=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x263e[_0x261522];return _0x98a25a;};'use strict';var asr=require(_0xe263('0x0'));module[_0xe263('0x1')]=function(_0x4ba571,_0x4d6a13,_0x5b2a3a,_0x5722f5){return asr(_0x4ba571,_0x4d6a13,_0x5b2a3a,_0x5722f5);}; \ No newline at end of file +var _0x0837=['exports'];(function(_0x45cd35,_0x41147c){var _0x16db84=function(_0x1ce5e9){while(--_0x1ce5e9){_0x45cd35['push'](_0x45cd35['shift']());}};_0x16db84(++_0x41147c);}(_0x0837,0x151));var _0x7083=function(_0x49ba17,_0x31874c){_0x49ba17=_0x49ba17-0x0;var _0x104a3f=_0x0837[_0x49ba17];return _0x104a3f;};'use strict';var asr=require('./lib/api');module[_0x7083('0x0')]=function(_0x443c21,_0x3f3214,_0xaf330a,_0x2aa28f){return asr(_0x443c21,_0x3f3214,_0xaf330a,_0x2aa28f);}; \ 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 73732e5..48c83fe 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 _0xfdb4=['open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','digest','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject'];(function(_0x4746fb,_0x49b351){var _0x2c8722=function(_0xaddcf4){while(--_0xaddcf4){_0x4746fb['push'](_0x4746fb['shift']());}};_0x2c8722(++_0x49b351);}(_0xfdb4,0x13a));var _0x4fdb=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xfdb4[_0x3ff085];return _0x2b68c3;};'use strict';var BPromise=require(_0x4fdb('0x0'));var _=require(_0x4fdb('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x4fdb('0x2'));var crypto=require(_0x4fdb('0x3'));var logger=require(_0x4fdb('0x4'))(_0x4fdb('0x5'));module[_0x4fdb('0x6')]=function(_0x524c8b,_0x201757,_0x35bf8b,_0x57f519){return new BPromise(function(_0x31ccfe,_0x33d568){logger[_0x4fdb('0x7')]('Tilde\x20URI',_0x57f519||_0x4fdb('0x8'));var _0x5c9a1b=new WebSocket(_0x57f519||_0x4fdb('0x8'),{'perMessageDeflate':![]});var _0x38eb11='';var _0x1d35b7='0';var _0x2ae621='1';var _0x3b3ea8='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x129056(_0x2892fc){var _0x249198=crypto[_0x4fdb('0x9')](_0x4fdb('0xa'));_0x249198['update'](_0x2892fc);return _0x249198[_0x4fdb('0xb')]('hex');}function _0x2cdf7d(){try{logger[_0x4fdb('0x7')](_0x4fdb('0xc'));var _0x111966=moment()['unix']();var _0x57c5e6=_0x129056(_0x111966+_0x201757+_0x35bf8b);_0x5c9a1b[_0x4fdb('0xd')](JSON[_0x4fdb('0xe')]({'appID':_0x201757,'timestamp':_0x111966,'appKey':_0x57c5e6}));var _0x1f7730=fs[_0x4fdb('0xf')](_0x524c8b);_0x1f7730['on'](_0x4fdb('0x10'),function(_0x53aad6){_0x5c9a1b[_0x4fdb('0xd')](_0x53aad6);});_0x1f7730['on'](_0x4fdb('0x11'),function(){_0x5c9a1b[_0x4fdb('0xd')](_0x4fdb('0x12'));});}catch(_0x3ea6d5){logger[_0x4fdb('0x13')](_0x4fdb('0x14'),JSON['stringify'](_0x3ea6d5));_0x5c9a1b[_0x4fdb('0x15')]();}}function _0x3f6b12(_0x134621){try{if(_0x134621){var _0x159e28=JSON['parse'](_0x134621);switch(_0x159e28['status']){case 0x0:if(_0x159e28[_0x4fdb('0x16')]){if(_0x159e28[_0x4fdb('0x16')][_0x4fdb('0x17')]){logger['info'](_0x4fdb('0x18'),JSON[_0x4fdb('0xe')](_0x159e28[_0x4fdb('0x16')][_0x4fdb('0x19')]));_0x38eb11=_0x159e28['result'][_0x4fdb('0x19')][0x0][_0x4fdb('0x1a')];_0x1d35b7=_0x159e28[_0x4fdb('0x16')]['hypotheses'][0x0][_0x4fdb('0x1b')];_0x2ae621='0';_0x3b3ea8=_0x4fdb('0x1c');_0x5c9a1b['terminate']();}}break;case 0x1:logger[_0x4fdb('0x7')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2ae621='1';_0x3b3ea8=_0x4fdb('0x1d');break;case 0x2:logger[_0x4fdb('0x7')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2ae621='2';_0x3b3ea8='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x4fdb('0x7')](_0x4fdb('0x1e'));_0x2ae621='9';_0x3b3ea8=_0x4fdb('0x1e');break;case 0xa:logger[_0x4fdb('0x7')](_0x4fdb('0x1f'));_0x2ae621='10';_0x3b3ea8=_0x4fdb('0x1f');break;case 0xb:logger[_0x4fdb('0x7')](_0x4fdb('0x20'));_0x2ae621='11';_0x3b3ea8='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x17d051){logger[_0x4fdb('0x13')](_0x4fdb('0x21'),JSON[_0x4fdb('0xe')](_0x17d051));_0x5c9a1b['terminate']();}}function _0x3c0395(){logger[_0x4fdb('0x7')](_0x4fdb('0x22'));_0x31ccfe({'transcript':_0x38eb11,'confidence':_0x1d35b7,'status':_0x2ae621,'status_message':_0x3b3ea8});}function _0x230bc0(_0x26e6b9){logger[_0x4fdb('0x13')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x4fdb('0x23')](_0x26e6b9)){logger['error'](_[_0x4fdb('0x24')](_0x26e6b9)?JSON[_0x4fdb('0xe')](_0x26e6b9):_0x26e6b9);}}_0x5c9a1b['on'](_0x4fdb('0x25'),_0x2cdf7d);_0x5c9a1b['on'](_0x4fdb('0x26'),_0x3f6b12);_0x5c9a1b['on'](_0x4fdb('0x11'),_0x3c0395);_0x5c9a1b['on'](_0x4fdb('0x13'),_0x230bc0);});}; \ No newline at end of file +var _0x8b1a=['isObject','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','send','stringify','createReadStream','data','close','EOS','error','terminate','status','result','final','info','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0x8b1a,0x9d));var _0xa8b1=function(_0x2ee94d,_0x3e3f41){_0x2ee94d=_0x2ee94d-0x0;var _0xc2431=_0x8b1a[_0x2ee94d];return _0xc2431;};'use strict';var BPromise=require(_0xa8b1('0x0'));var _=require(_0xa8b1('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xa8b1('0x2'));var crypto=require(_0xa8b1('0x3'));var logger=require(_0xa8b1('0x4'))(_0xa8b1('0x5'));module[_0xa8b1('0x6')]=function(_0x2956db,_0x47e8b5,_0x5877cc,_0x588118){return new BPromise(function(_0x556ad5,_0x243a48){logger['info'](_0xa8b1('0x7'),_0x588118||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x4f5916=new WebSocket(_0x588118||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x5a6db2='';var _0x17dad4='0';var _0x366055='1';var _0x46ec2a=_0xa8b1('0x8');function _0x2df156(_0x373e72){var _0xa5fab3=crypto[_0xa8b1('0x9')](_0xa8b1('0xa'));_0xa5fab3[_0xa8b1('0xb')](_0x373e72);return _0xa5fab3[_0xa8b1('0xc')](_0xa8b1('0xd'));}function _0x43dae0(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x40dd73=moment()[_0xa8b1('0xe')]();var _0x123e9a=_0x2df156(_0x40dd73+_0x47e8b5+_0x5877cc);_0x4f5916[_0xa8b1('0xf')](JSON[_0xa8b1('0x10')]({'appID':_0x47e8b5,'timestamp':_0x40dd73,'appKey':_0x123e9a}));var _0x57236d=fs[_0xa8b1('0x11')](_0x2956db);_0x57236d['on'](_0xa8b1('0x12'),function(_0x7eb7b){_0x4f5916[_0xa8b1('0xf')](_0x7eb7b);});_0x57236d['on'](_0xa8b1('0x13'),function(){_0x4f5916[_0xa8b1('0xf')](_0xa8b1('0x14'));});}catch(_0x1db13a){logger[_0xa8b1('0x15')]('Tilde\x20ASR\x20send\x20error',JSON[_0xa8b1('0x10')](_0x1db13a));_0x4f5916[_0xa8b1('0x16')]();}}function _0x4d71c2(_0x392220){try{if(_0x392220){var _0x1343fe=JSON['parse'](_0x392220);switch(_0x1343fe[_0xa8b1('0x17')]){case 0x0:if(_0x1343fe[_0xa8b1('0x18')]){if(_0x1343fe[_0xa8b1('0x18')][_0xa8b1('0x19')]){logger[_0xa8b1('0x1a')](_0xa8b1('0x1b'),JSON[_0xa8b1('0x10')](_0x1343fe['result'][_0xa8b1('0x1c')]));_0x5a6db2=_0x1343fe['result'][_0xa8b1('0x1c')][0x0][_0xa8b1('0x1d')];_0x17dad4=_0x1343fe[_0xa8b1('0x18')][_0xa8b1('0x1c')][0x0][_0xa8b1('0x1e')];_0x366055='0';_0x46ec2a=_0xa8b1('0x1f');_0x4f5916['terminate']();}}break;case 0x1:logger[_0xa8b1('0x1a')](_0xa8b1('0x8'));_0x366055='1';_0x46ec2a=_0xa8b1('0x8');break;case 0x2:logger['info'](_0xa8b1('0x20'));_0x366055='2';_0x46ec2a=_0xa8b1('0x20');break;case 0x9:logger[_0xa8b1('0x1a')](_0xa8b1('0x21'));_0x366055='9';_0x46ec2a=_0xa8b1('0x21');break;case 0xa:logger[_0xa8b1('0x1a')](_0xa8b1('0x22'));_0x366055='10';_0x46ec2a=_0xa8b1('0x22');break;case 0xb:logger[_0xa8b1('0x1a')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x366055='11';_0x46ec2a='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x282efa){logger[_0xa8b1('0x15')](_0xa8b1('0x23'),JSON[_0xa8b1('0x10')](_0x282efa));_0x4f5916['terminate']();}}function _0xf805d5(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x556ad5({'transcript':_0x5a6db2,'confidence':_0x17dad4,'status':_0x366055,'status_message':_0x46ec2a});}function _0x1039ca(_0x6a343e){logger['error'](_0xa8b1('0x24'));if(!_[_0xa8b1('0x25')](_0x6a343e)){logger[_0xa8b1('0x15')](_[_0xa8b1('0x26')](_0x6a343e)?JSON[_0xa8b1('0x10')](_0x6a343e):_0x6a343e);}}_0x4f5916['on']('open',_0x43dae0);_0x4f5916['on']('message',_0x4d71c2);_0x4f5916['on']('close',_0xf805d5);_0x4f5916['on'](_0xa8b1('0x15'),_0x1039ca);});}; \ 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 3f3100d..e3c8dd0 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 _0xd919=['./asr','exports'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xd919,0x1ca));var _0x9d91=function(_0x1d1152,_0x5afd9c){_0x1d1152=_0x1d1152-0x0;var _0x59d599=_0xd919[_0x1d1152];return _0x59d599;};var asr=require(_0x9d91('0x0'));module[_0x9d91('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7cba=['exports','./asr'];(function(_0x5c56ed,_0x44db68){var _0x1b2ce0=function(_0x2da01b){while(--_0x2da01b){_0x5c56ed['push'](_0x5c56ed['shift']());}};_0x1b2ce0(++_0x44db68);}(_0x7cba,0x6f));var _0xa7cb=function(_0x222aec,_0x1819a4){_0x222aec=_0x222aec-0x0;var _0x37d172=_0x7cba[_0x222aec];return _0x37d172;};var asr=require(_0xa7cb('0x0'));module[_0xa7cb('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 90c3930..6de6400 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 _0xf0c6=['E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','error','code','close','nextTick','inherits','exports','util','net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','createServer','listening','connection','getConnections'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf0c6,0x9b));var _0x6f0c=function(_0x4e0253,_0x2ec67f){_0x4e0253=_0x4e0253-0x0;var _0x4e6bc9=_0xf0c6[_0x4e0253];return _0x4e6bc9;};'use strict';var util=require(_0x6f0c('0x0'));var net=require(_0x6f0c('0x1'));var EventEmitter=require(_0x6f0c('0x2'))[_0x6f0c('0x3')];var AGIError=require(_0x6f0c('0x4'));var AGIChannel=require(_0x6f0c('0x5'));var AGIServer=function(_0x4cdf18,_0x232c66,_0x52734f){var _0x45cf0b=this,_0x4cdf18=_0x4cdf18||0x11dd,_0x232c66=_0x232c66||_0x6f0c('0x6'),_0x444de3=null,_0x1a0cac=0x0;EventEmitter[_0x6f0c('0x7')](_0x45cf0b);function _0x9e40df(){if(!_0x4cdf18){_0x45cf0b[_0x6f0c('0x8')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x444de3=net[_0x6f0c('0x9')]();_0x444de3['listen'](_0x4cdf18,_0x232c66);_0x444de3['on'](_0x6f0c('0xa'),function(){_0x45cf0b[_0x6f0c('0x8')](_0x6f0c('0xa'));});_0x444de3['on'](_0x6f0c('0xb'),function(_0x5525d1){_0x444de3[_0x6f0c('0xc')](function(_0x346af4,_0xb17f4e){if(_0x346af4){_0x45cf0b[_0x6f0c('0x8')]('error',new AGIError(_0x6f0c('0xd'),_0x346af4));}else if(_0x52734f&&_0x52734f<0x0){_0x45cf0b[_0x6f0c('0x8')]('error',new AGIError(_0x6f0c('0xe')));_0x5525d1[_0x6f0c('0xf')]();}else if(_0x52734f&&_0x52734f>0x0&&_0x52734f<_0xb17f4e){_0x1a0cac+=0x1;_0x45cf0b['emit']('error',new AGIError(_0x6f0c('0x10'),_0x1a0cac));_0x5525d1[_0x6f0c('0xf')]();}else{var _0x4ff2d0=new AGIChannel(_0x5525d1);_0x4ff2d0['on'](_0x6f0c('0x11'),function(){_0x45cf0b[_0x6f0c('0x8')](_0x6f0c('0xb'),_0x4ff2d0);});}});});_0x444de3['on'](_0x6f0c('0x12'),function(_0x5756f4){_0x45cf0b[_0x6f0c('0x8')](_0x6f0c('0x12'),new AGIError(_0x6f0c('0xd'),_0x5756f4[_0x6f0c('0x13')]));});_0x444de3['on'](_0x6f0c('0x14'),function(){_0x45cf0b[_0x6f0c('0x8')](_0x6f0c('0x14'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6f0c('0x15')](function(){_0x9e40df();});};util[_0x6f0c('0x16')](AGIServer,EventEmitter);module[_0x6f0c('0x17')]=function(_0x2c31bf,_0x5982cf,_0x268626){return new AGIServer(_0x2c31bf,_0x5982cf,_0x268626);}; \ No newline at end of file +var _0x98cd=['net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening','getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0x98cd,0x68));var _0xd98c=function(_0x2c5883,_0x23a2b6){_0x2c5883=_0x2c5883-0x0;var _0x249af2=_0x98cd[_0x2c5883];return _0x249af2;};'use strict';var util=require('util');var net=require(_0xd98c('0x0'));var EventEmitter=require(_0xd98c('0x1'))[_0xd98c('0x2')];var AGIError=require(_0xd98c('0x3'));var AGIChannel=require(_0xd98c('0x4'));var AGIServer=function(_0x291214,_0x220788,_0x52f2dd){var _0x1ab5dc=this,_0x291214=_0x291214||0x11dd,_0x220788=_0x220788||_0xd98c('0x5'),_0x461b98=null,_0xed5f17=0x0;EventEmitter[_0xd98c('0x6')](_0x1ab5dc);function _0x4dbb94(){if(!_0x291214){_0x1ab5dc[_0xd98c('0x7')]('error',new AGIError(_0xd98c('0x8')));return![];}_0x461b98=net[_0xd98c('0x9')]();_0x461b98[_0xd98c('0xa')](_0x291214,_0x220788);_0x461b98['on'](_0xd98c('0xb'),function(){_0x1ab5dc['emit'](_0xd98c('0xb'));});_0x461b98['on']('connection',function(_0x1eb61e){_0x461b98[_0xd98c('0xc')](function(_0x4b144c,_0x42144f){if(_0x4b144c){_0x1ab5dc[_0xd98c('0x7')](_0xd98c('0xd'),new AGIError(_0xd98c('0xe'),_0x4b144c));}else if(_0x52f2dd&&_0x52f2dd<0x0){_0x1ab5dc[_0xd98c('0x7')](_0xd98c('0xd'),new AGIError(_0xd98c('0xf')));_0x1eb61e[_0xd98c('0x10')]();}else if(_0x52f2dd&&_0x52f2dd>0x0&&_0x52f2dd<_0x42144f){_0xed5f17+=0x1;_0x1ab5dc[_0xd98c('0x7')](_0xd98c('0xd'),new AGIError(_0xd98c('0x11'),_0xed5f17));_0x1eb61e[_0xd98c('0x10')]();}else{var _0x5a3f7c=new AGIChannel(_0x1eb61e);_0x5a3f7c['on'](_0xd98c('0x12'),function(){_0x1ab5dc[_0xd98c('0x7')](_0xd98c('0x13'),_0x5a3f7c);});}});});_0x461b98['on'](_0xd98c('0xd'),function(_0x564e01){_0x1ab5dc[_0xd98c('0x7')](_0xd98c('0xd'),new AGIError('E_AGI_SERVER_ERROR',_0x564e01[_0xd98c('0x14')]));});_0x461b98['on']('close',function(){_0x1ab5dc[_0xd98c('0x7')](_0xd98c('0x15'),new AGIError(_0xd98c('0x16')));});}process[_0xd98c('0x17')](function(){_0x4dbb94();});};util[_0xd98c('0x18')](AGIServer,EventEmitter);module[_0xd98c('0x19')]=function(_0x4180ee,_0x575323,_0x3b1b87){return new AGIServer(_0x4180ee,_0x575323,_0x3b1b87);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 554433a..2f8c8c1 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 _0xa630=['trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','toUpperCase','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','IFTIME\x20%s\x20%s','hangup','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','variable_id','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','secure','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','success','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','odbc','moment','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueueById','getSquareProjectById','getSquareOdbc','dsn','getUserById','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','%s/sounds/converted/%s','open','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','callback','Callback\x20scheduled\x20at\x20','scheduledAt','dialTimezone','getContactByPhone','timezones','utcOffset','add','minutes','insertContact','scheduledat','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','format','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','text','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','isConfigured','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','isString','saveRestApiResult','length','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','wait','list_id','no\x20list\x20selected','delay','callback_priority','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','keys','forEach','%s[%s][%s]','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block'];(function(_0x4a26d9,_0x30d9e0){var _0x32db4b=function(_0x157e5d){while(--_0x157e5d){_0x4a26d9['push'](_0x4a26d9['shift']());}};_0x32db4b(++_0x30d9e0);}(_0xa630,0xbe));var _0x0a63=function(_0x133288,_0xa08048){_0x133288=_0x133288-0x0;var _0x249def=_0xa630[_0x133288];return _0x249def;};'use strict';var fs=require('fs');var path=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var _=require('lodash');var sh=require('shelljs');var odbc=require(_0x0a63('0x2'))();var rs=require('randomstring');var moment=require(_0x0a63('0x3'));var Mustache=require('mustache');var rp=require(_0x0a63('0x4'));var logger=require(_0x0a63('0x5'))(_0x0a63('0x6'));var config=require(_0x0a63('0x7'));var shared=require(_0x0a63('0x8'));var scripts=require('./scripts');var FILES_PATH=_0x0a63('0x9');var recursiveMapAttributes=[_0x0a63('0xa'),_0x0a63('0xb')];var verticesWithRetry=[_0x0a63('0xc'),_0x0a63('0xd'),_0x0a63('0xe')];var AGIVertices=function(_0x501a82,_0x688acd,_0xb714c7){this[_0x0a63('0xf')]=_0x501a82;this[_0x0a63('0x10')]=_0x688acd;this[_0x0a63('0x11')]=_0xb714c7;};AGIVertices[_0x0a63('0x12')][_0x0a63('0x13')]=function(_0x22f340,_0x258511){this[_0x0a63('0x10')]['getVariableById'](_0x22f340)[_0x0a63('0x14')](function(_0x420043){_0x258511(null,_0x420043?_0x420043[_0x0a63('0x15')]:![]);})[_0x0a63('0x16')](function(_0x55cb2f){_0x258511(_0x55cb2f);});};AGIVertices[_0x0a63('0x12')]['getVoiceQueue']=function(_0x331e99,_0x19e922){this[_0x0a63('0x10')][_0x0a63('0x17')](_0x331e99)[_0x0a63('0x14')](function(_0x23b49d){_0x19e922(null,_0x23b49d?_0x23b49d[_0x0a63('0x15')]:![]);})[_0x0a63('0x16')](function(_0x524a98){_0x19e922(_0x524a98);});};AGIVertices[_0x0a63('0x12')]['getSquareProject']=function(_0x282856,_0x292170){this[_0x0a63('0x10')][_0x0a63('0x18')](_0x282856)[_0x0a63('0x14')](function(_0x181507){_0x292170(null,_0x181507?_0x181507[_0x0a63('0x15')]:![]);})[_0x0a63('0x16')](function(_0x2fd06c){_0x292170(_0x2fd06c);});};AGIVertices[_0x0a63('0x12')][_0x0a63('0x19')]=function(_0x4ea56f,_0x550568){this[_0x0a63('0x10')]['getSquareOdbcById'](_0x4ea56f)[_0x0a63('0x14')](function(_0x5937df){_0x550568(null,_0x5937df?_0x5937df[_0x0a63('0x1a')]:![]);})[_0x0a63('0x16')](function(_0x145625){_0x550568(_0x145625);});};AGIVertices[_0x0a63('0x12')]['getUser']=function(_0x398a16,_0x4c225a){this[_0x0a63('0x10')][_0x0a63('0x1b')](_0x398a16)[_0x0a63('0x14')](function(_0x20c114){_0x4c225a(null,_0x20c114?_0x20c114[_0x0a63('0x15')]:![]);})[_0x0a63('0x16')](function(_0x263236){_0x4c225a(_0x263236);});};AGIVertices[_0x0a63('0x12')]['getTrunk']=function(_0x5e5987,_0x55fb70){this['rpc'][_0x0a63('0x1c')](_0x5e5987)['then'](function(_0x496c93){_0x55fb70(null,_0x496c93?_0x496c93[_0x0a63('0x15')]:![]);})[_0x0a63('0x16')](function(_0x362d6a){_0x55fb70(_0x362d6a);});};AGIVertices[_0x0a63('0x12')]['getSound']=function(_0x402692,_0x498371){var _0x25ab82=this;this['rpc'][_0x0a63('0x1d')](_0x402692)[_0x0a63('0x14')](function(_0x1b7bdb){_0x498371(null,_0x1b7bdb?_0x25ab82[_0x0a63('0x1e')](_0x1b7bdb[_0x0a63('0x1f')]):![]);})[_0x0a63('0x16')](function(_0x23fcf3){_0x498371(_0x23fcf3);});};AGIVertices[_0x0a63('0x12')]['getMailAccount']=function(_0x58cc71,_0x574c06){this[_0x0a63('0x10')][_0x0a63('0x20')](_0x58cc71)[_0x0a63('0x14')](function(_0x26de7a){_0x574c06(null,_0x26de7a?_0x26de7a:![]);})[_0x0a63('0x16')](function(_0x53a46b){_0x574c06(_0x53a46b);});};AGIVertices[_0x0a63('0x12')][_0x0a63('0x21')]=function(_0x33a717,_0x46fb40,_0x59d06c){this[_0x0a63('0x11')][_0x0a63('0x21')](_0x33a717,_0x46fb40)['then'](function(){_0x59d06c(null);})['catch'](function(_0x34a170){_0x59d06c(_0x34a170);});};AGIVertices['prototype']['getIntervals']=function(_0x3bd154,_0x3fd128){this['rpc'][_0x0a63('0x22')](_0x3bd154)[_0x0a63('0x14')](function(_0x46f98d){if(_0x46f98d){if(_0x46f98d[_0x0a63('0x23')]){_0x3fd128(null,[_0x46f98d[_0x0a63('0x24')]]);}else{_0x3fd128(null,_['map'](_0x46f98d['Intervals'],_0x0a63('0x24')));}}else{_0x3fd128(null,![]);}})[_0x0a63('0x16')](function(_0x14ab42){_0x3fd128(_0x14ab42);});};AGIVertices[_0x0a63('0x12')][_0x0a63('0x1e')]=function(_0x273bcf){return util['format'](_0x0a63('0x25'),FILES_PATH,_0x273bcf);};AGIVertices[_0x0a63('0x12')]['getQueryOdbc']=function(_0xf9c6ea,_0x5b62b7,_0x4ed1e1){odbc[_0x0a63('0x26')](_0xf9c6ea,function(_0x232388){if(_0x232388){logger[_0x0a63('0x27')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x232388);_0x4ed1e1(_0x232388);}else{logger[_0x0a63('0x28')](_0x0a63('0x29'));odbc[_0x0a63('0x2a')](_0x5b62b7,function(_0x369e68,_0x3f88a1){if(_0x369e68){logger[_0x0a63('0x28')](_0x0a63('0x2b'),_0x5b62b7);_0x4ed1e1(_0x369e68);}else{logger['info'](_0x0a63('0x2c'),_0x5b62b7);odbc[_0x0a63('0x2d')](function(_0x3d5c33){if(_0x3d5c33){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x3d5c33);}_0x4ed1e1(null,_0x3f88a1);});}});}});};AGIVertices[_0x0a63('0x12')]['getSmsAccount']=function(_0x1a01f4,_0x1e1aec){this[_0x0a63('0x10')]['getSmsAccountById'](_0x1a01f4)[_0x0a63('0x14')](function(_0x14c737){_0x1e1aec(null,_0x14c737?_0x14c737:![]);})[_0x0a63('0x16')](function(_0x108202){_0x1e1aec(_0x108202);});};AGIVertices['prototype'][_0x0a63('0x2e')]=function(_0x236617,_0x4234cd){this[_0x0a63('0x10')][_0x0a63('0x2e')](_0x236617)[_0x0a63('0x14')](function(_0x5d22b5){_0x4234cd(null,_0x5d22b5);})[_0x0a63('0x16')](function(_0x218729){_0x4234cd(_0x218729);});};AGIVertices[_0x0a63('0x12')][_0x0a63('0x2f')]=function(_0x20fa0d,_0x2482ca,_0x24da6a){this[_0x0a63('0x10')][_0x0a63('0x2f')]({'uniqueid':this[_0x0a63('0xf')][_0x0a63('0x30')],'node':_0x20fa0d[_0x0a63('0x31')],'application':_0x20fa0d[_0x0a63('0x32')],'data':_0x2482ca||null,'project_name':this[_0x0a63('0xf')][_0x0a63('0x33')],'callerid':this[_0x0a63('0xf')][_0x0a63('0x34')]})[_0x0a63('0x14')](function(_0x4847ae){if(_0x24da6a){_0x24da6a(null,_0x4847ae);}})[_0x0a63('0x16')](function(_0x5ef4e9){if(_0x24da6a){_0x24da6a(_0x5ef4e9);}});};AGIVertices['prototype'][_0x0a63('0x35')]=function(_0x223ecf,_0x2b3439,_0x45ec47,_0xd9149d){this[_0x0a63('0x10')][_0x0a63('0x35')]({'uniqueid':this[_0x0a63('0xf')][_0x0a63('0x30')],'callerid':this[_0x0a63('0xf')][_0x0a63('0x34')],'calleridname':this[_0x0a63('0xf')][_0x0a63('0x36')],'context':this[_0x0a63('0xf')][_0x0a63('0x37')],'extension':this[_0x0a63('0xf')][_0x0a63('0x38')],'priority':this[_0x0a63('0xf')][_0x0a63('0x39')],'accountcode':this[_0x0a63('0xf')]['accountcode'],'dnid':this[_0x0a63('0xf')][_0x0a63('0x3a')],'projectName':this['channel']['arg_1'],'saveName':_0x2b3439,'filename':_0x223ecf['file']||_0x2b3439,'savePath':_0x45ec47})['then'](function(_0x36d066){_0xd9149d(null,_0x36d066);})[_0x0a63('0x16')](function(_0x5d9ffc){_0xd9149d(_0x5d9ffc);});};AGIVertices[_0x0a63('0x12')]['createSquareMessage']=function(_0x3e3680,_0x30f354,_0x4c6440,_0x4a937b,_0x4b16ea){this[_0x0a63('0x10')][_0x0a63('0x3b')]({'uniqueid':this[_0x0a63('0xf')][_0x0a63('0x30')],'body':_0x3e3680,'direction':_0x30f354,'providerName':_0x4c6440,'providerResponse':_0x4a937b})[_0x0a63('0x14')](function(_0x4be904){if(_0x4b16ea){_0x4b16ea(null,_0x4be904);}})[_0x0a63('0x16')](function(_0x38327a){if(_0x4b16ea){_0x4b16ea(_0x38327a);}});};AGIVertices[_0x0a63('0x12')][_0x0a63('0x3c')]=function(_0x3575ae,_0x4a5b6e){var _0x2f7208=this;var _0x3379b5=0x0;var _0x393996={'firstName':_[_0x0a63('0x3d')](_0x3575ae['name'])||_[_0x0a63('0x3e')](_0x3575ae[_0x0a63('0x15')])?_0x0a63('0x3f')+Math[_0x0a63('0x40')]():_0x3575ae[_0x0a63('0x15')],'lastName':_[_0x0a63('0x3d')](_0x3575ae['lastName'])||_[_0x0a63('0x3e')](_0x3575ae[_0x0a63('0x41')])?null:_0x3575ae[_0x0a63('0x41')],'phone':_0x3575ae[_0x0a63('0x42')],'ListId':_0x3575ae['list_id'],'scheduledat':_0x3575ae['scheduledAt'],'callbackUniqueid':this[_0x0a63('0xf')][_0x0a63('0x30')],'tags':_0x0a63('0x43'),'description':_0x0a63('0x44')+_0x3575ae[_0x0a63('0x45')]['toString'](),'priority':_0x3575ae['callback_priority']};if(_['has'](_0x3575ae,_0x0a63('0x46'))){if(!_['isNil'](_0x3575ae[_0x0a63('0x46')])){var _0x6975b7=_0x3575ae[_0x0a63('0x46')];if(_0x3575ae['dialTimezone']=='CALLERID(dialTimezone)'){this[_0x0a63('0x10')][_0x0a63('0x47')]({'phone':_0x3575ae[_0x0a63('0x42')]})[_0x0a63('0x14')](function(_0x2d39d7){if(!_[_0x0a63('0x3e')](_0x2d39d7)){var _0x21502e=_0x2d39d7[_0x0a63('0x46')];if(!_[_0x0a63('0x3e')](_0x21502e)){var _0xb3a507=shared[_0x0a63('0x48')][_0x21502e];if(!_[_0x0a63('0x3e')](_0xb3a507)){var _0x5779c3=-0x1*_0xb3a507[_0x0a63('0x49')];_0x393996['scheduledat']=moment(_0x3575ae['scheduledat'])[_0x0a63('0x4a')](_0x5779c3,_0x0a63('0x4b'));_0x2f7208['insertContact'](_0x393996,_0x3575ae,_0x4a5b6e);}else{_0x2f7208[_0x0a63('0x4c')](_0x393996,_0x3575ae,_0x4a5b6e);}}else{_0x2f7208[_0x0a63('0x4c')](_0x393996,_0x3575ae,_0x4a5b6e);}}else{_0x2f7208['insertContact'](_0x393996,_0x3575ae,_0x4a5b6e);}});}else{var _0x3379b5=shared[_0x0a63('0x48')][_0x6975b7];if(!_['isNil'](_0x3379b5)){var _0x4d86ed=-0x1*_0x3379b5[_0x0a63('0x49')];_0x393996[_0x0a63('0x4d')]=moment(_0x3575ae[_0x0a63('0x4d')])['add'](_0x4d86ed,_0x0a63('0x4b'));_0x2f7208[_0x0a63('0x4c')](_0x393996,_0x3575ae,_0x4a5b6e);}else{_0x2f7208[_0x0a63('0x4c')](_0x393996,_0x3575ae,_0x4a5b6e);}}}else{_0x2f7208[_0x0a63('0x4c')](_0x393996,_0x3575ae,_0x4a5b6e);}}else{_0x2f7208[_0x0a63('0x4c')](_0x393996,_0x3575ae,_0x4a5b6e);}};AGIVertices['prototype'][_0x0a63('0x4e')]=function(_0x28becf,_0x51d720){this[_0x0a63('0x10')][_0x0a63('0x4f')](_0x28becf)[_0x0a63('0x14')](function(_0x1db0b6){_0x51d720(null,_0x1db0b6?_0x1db0b6['name']:![]);})[_0x0a63('0x16')](function(_0x1e25cd){_0x51d720(_0x1e25cd);});};AGIVertices[_0x0a63('0x12')][_0x0a63('0x50')]=function(_0xd52d09,_0xf814c7,_0x4c4f98){var _0xcb4029={'role':'agent'};_0xcb4029[_0xd52d09]=this['channel'][_0x0a63('0x34')];this[_0x0a63('0x10')][_0x0a63('0x50')](_0xcb4029,_0xf814c7,this[_0x0a63('0xf')][_0x0a63('0x30')])['then'](function(_0x3b24e9){_0x4c4f98(null,_[_0x0a63('0x3e')](_0x3b24e9)?![]:!![]);})[_0x0a63('0x16')](function(_0x2a2f1b){logger[_0x0a63('0x27')](_0x2a2f1b);_0x4c4f98(null,![]);});};AGIVertices[_0x0a63('0x12')][_0x0a63('0x51')]=function(_0xe52dfd,_0x3d9dce){var _0x35083d={'role':_0x0a63('0x52')};_0x35083d[_0xe52dfd]=this['channel'][_0x0a63('0x34')];this['rpc'][_0x0a63('0x51')](_0x35083d)[_0x0a63('0x14')](function(_0x5a1622){_0x3d9dce(null,_['isNil'](_0x5a1622)?![]:!![]);})['catch'](function(_0x31481f){logger[_0x0a63('0x27')](_0x31481f);_0x3d9dce(null,![]);});};AGIVertices[_0x0a63('0x12')][_0x0a63('0x53')]=function(_0xa87bbd,_0x4254c7){var _0x47eb39={'role':'agent'};_0x47eb39[_0xa87bbd]=this['channel'][_0x0a63('0x34')];this[_0x0a63('0x10')][_0x0a63('0x53')](_0x47eb39)[_0x0a63('0x14')](function(_0x522387){_0x4254c7(null,_[_0x0a63('0x3e')](_0x522387)?![]:!![]);})['catch'](function(_0x5de3de){logger[_0x0a63('0x27')](_0x5de3de);_0x4254c7(null,![]);});};AGIVertices['prototype'][_0x0a63('0x54')]=function(_0x3ae1bd,_0x49ab73){var _0x267583={'role':'agent'};_0x267583[_0x3ae1bd]=this[_0x0a63('0xf')]['callerid'];var _0x463687=_0x3ae1bd!=_0x0a63('0x55')?util[_0x0a63('0x56')]('%s/%s@from-sip/n',_0x0a63('0x57'),this[_0x0a63('0xf')][_0x0a63('0x34')]):undefined;this[_0x0a63('0x10')][_0x0a63('0x54')](_0x267583,_0x463687)['then'](function(_0x55174c){_0x49ab73(null,_['isNil'](_0x55174c)?![]:!![]);})[_0x0a63('0x16')](function(_0x5ea8b7){logger[_0x0a63('0x27')](_0x5ea8b7);_0x49ab73(null,![]);});};AGIVertices[_0x0a63('0x12')][_0x0a63('0x58')]=function(_0x253fb1,_0x5540c6){sh[_0x0a63('0x59')](_[_0x0a63('0x5a')](_0x253fb1),function(_0x5612ce,_0x711025){var _0x409d2b=_0x711025[_0x0a63('0x5b')](/(\r\n|\n|\r)/gm,'');_0x5540c6(null,_0x409d2b);});};AGIVertices[_0x0a63('0x12')][_0x0a63('0x5c')]=function(_0x4ca0e4,_0x206221){scripts[_0x0a63('0x5c')](_0x4ca0e4[_0x0a63('0x5d')],_0x4ca0e4['google_cloud_tts_text_type']||'text',_0x4ca0e4['text'],_0x4ca0e4[_0x0a63('0x5e')]||_0x0a63('0x5f'),_0x4ca0e4[_0x0a63('0x60')]||_0x0a63('0x61'),_0x4ca0e4[_0x0a63('0x62')]||_0x0a63('0x63'))[_0x0a63('0x14')](function(_0x37255d){_0x206221(null,_0x37255d);})[_0x0a63('0x16')](function(_0x2505e7){_0x206221(_0x2505e7);});};AGIVertices['prototype'][_0x0a63('0x64')]=function(_0x10cf0d,_0xdfacb3){scripts[_0x0a63('0x64')](_0x10cf0d[_0x0a63('0x65')],_0x10cf0d[_0x0a63('0x66')]||'en',0x1)['then'](function(_0x5afa9e){_0xdfacb3(null,_0x5afa9e);})[_0x0a63('0x16')](function(_0x160596){_0xdfacb3(_0x160596);});};AGIVertices[_0x0a63('0x12')][_0x0a63('0x67')]=function(_0x50f07e,_0x3c3366){var _0x5e4293={'uri':_0x50f07e[_0x0a63('0x68')],'method':_0x50f07e[_0x0a63('0x69')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x50f07e[_0x0a63('0x6a')])===_0x0a63('0x6b')&&parseInt(_0x50f07e['timeout'])>=0x1?parseInt(_0x50f07e[_0x0a63('0x6a')])*0x3e8:0x5*0x3e8};if(_[_0x0a63('0x6c')]([_0x0a63('0x6d'),_0x0a63('0x6e')],_0x5e4293['method']['toUpperCase']())){try{_0x5e4293[_0x0a63('0x6f')]=_0x50f07e['rawBody']?JSON[_0x0a63('0x70')](_0x50f07e[_0x0a63('0xb')]):{};}catch(_0x326872){logger[_0x0a63('0x27')](_0x0a63('0x71'),_0x326872);}}try{_0x5e4293['headers']=_0x50f07e[_0x0a63('0xa')]?JSON[_0x0a63('0x70')](_0x50f07e[_0x0a63('0xa')]):{};}catch(_0x1638ab){logger[_0x0a63('0x27')](_0x0a63('0x72'),_0x1638ab);}if(_0x50f07e[_0x0a63('0x73')]){try{var _0x54b8a6=require(_0x50f07e[_0x0a63('0x73')])[_0x0a63('0x74')](this,_0x5e4293);_0x5e4293[_0x0a63('0x75')]=Mustache[_0x0a63('0x76')](_0x50f07e['url'],_0x54b8a6,{},['$$','$$']);if(_0x5e4293[_0x0a63('0x77')]){_0x5e4293[_0x0a63('0x77')]=JSON[_0x0a63('0x70')](Mustache['render'](JSON[_0x0a63('0x78')](_0x5e4293[_0x0a63('0x77')]),_0x54b8a6,{},['$$','$$']));}if(_0x5e4293[_0x0a63('0x6f')]){_0x5e4293['body']=JSON[_0x0a63('0x70')](Mustache[_0x0a63('0x76')](JSON[_0x0a63('0x78')](_0x5e4293[_0x0a63('0x6f')]),_0x54b8a6,{},['$$','$$']));}}catch(_0x316cdd){logger[_0x0a63('0x27')](_0x0a63('0x79'),_0x316cdd);}}rp(_0x5e4293)[_0x0a63('0x14')](function(_0xb39ec2){var _0x2b6971={'statusCode':_0xb39ec2[_0x0a63('0x7a')]||0xc8,'statusMessage':_0xb39ec2[_0x0a63('0x7b')]||'OK','headers':_0xb39ec2[_0x0a63('0x77')]||{},'body':_0xb39ec2[_0x0a63('0x6f')]||{}};_0x3c3366(null,_0x2b6971);})[_0x0a63('0x16')](function(_0xeb7019){var _0x53e40e={'statusCode':_0xeb7019[_0x0a63('0x7a')]||0x1f4,'statusMessage':_0xeb7019['message']||_0x0a63('0x7c'),'headers':_0xeb7019[_0x0a63('0x7d')]['headers']||{},'body':_0xeb7019[_0x0a63('0x7d')][_0x0a63('0x6f')]||{}};_0x3c3366(null,_0x53e40e);});};AGIVertices[_0x0a63('0x12')][_0x0a63('0x7e')]=function(_0x281489,_0xd9a258){scripts[_0x0a63('0x7e')](this[_0x0a63('0xf')][_0x0a63('0x30')],_0x281489['key'],_0x281489[_0x0a63('0x65')],_0x281489['dialogflow_language']||'en')['then'](function(_0x1d35b2){_0xd9a258(null,_0x1d35b2);})[_0x0a63('0x16')](function(_0x37747e){_0xd9a258(_0x37747e);});};AGIVertices[_0x0a63('0x12')]['googleDialogflowV2']=function(_0x1473bf,_0x489eff){scripts['googleDialogflowV2'](this[_0x0a63('0xf')]['uniqueid'],_0x1473bf['dialogflowV2_project_id'],_0x1473bf[_0x0a63('0x7f')],_0x1473bf[_0x0a63('0x80')],_0x1473bf[_0x0a63('0x65')],_0x1473bf[_0x0a63('0x81')]||'en')['then'](function(_0x1f2ecc){_0x489eff(null,_0x1f2ecc);})['catch'](function(_0x413dd6){_0x489eff(_0x413dd6);});};AGIVertices['prototype'][_0x0a63('0x82')]=function(_0x4f1697,_0x2cd3fe){scripts[_0x0a63('0x82')](this[_0x0a63('0xf')],_0x4f1697)[_0x0a63('0x14')](function(_0x363874){_0x2cd3fe(null,_0x363874);})[_0x0a63('0x16')](function(_0x3acdb8){_0x2cd3fe(_0x3acdb8);});};AGIVertices[_0x0a63('0x12')][_0x0a63('0x83')]=function(_0x49f349,_0x30e9ec){scripts['ispeechTTS'](_0x49f349[_0x0a63('0x84')],_0x49f349[_0x0a63('0x65')],_0x49f349[_0x0a63('0x85')]||_0x0a63('0x5f'),_0x49f349[_0x0a63('0x86')])['then'](function(_0x1d0fb4){_0x30e9ec(null,_0x1d0fb4);})[_0x0a63('0x16')](function(_0xfe3690){_0x30e9ec(_0xfe3690);});};AGIVertices[_0x0a63('0x12')]['ispeechASR']=function(_0x2e397b,_0x1f403c,_0x58dcce){scripts[_0x0a63('0x87')](_0x1f403c,_0x2e397b[_0x0a63('0x84')],_0x2e397b['ispeech_asr_language']||_0x0a63('0x5f'),this[_0x0a63('0x88')](_0x2e397b['model'])?_0x2e397b['model']:undefined)[_0x0a63('0x14')](function(_0x329680){_0x58dcce(null,_0x329680);})[_0x0a63('0x16')](function(_0x1ebaca){_0x58dcce(_0x1ebaca);});};AGIVertices[_0x0a63('0x12')][_0x0a63('0x89')]=function(_0x2a1717,_0x4998e0){scripts[_0x0a63('0x89')](_0x2a1717[_0x0a63('0x8a')],_0x2a1717['aws_secret_access_key'],_0x2a1717[_0x0a63('0x8b')],_0x2a1717[_0x0a63('0x8c')]||_0x0a63('0x8d'),_0x2a1717[_0x0a63('0x65')],_0x2a1717[_0x0a63('0x8e')]||'text')['then'](function(_0x28f29f){_0x4998e0(null,_0x28f29f);})[_0x0a63('0x16')](function(_0x40f6e0){_0x4998e0(_0x40f6e0);});};AGIVertices['prototype']['awsLex']=function(_0x22caf2,_0x4d6cd9){scripts['awsLex'](this[_0x0a63('0xf')][_0x0a63('0x30')],_0x22caf2[_0x0a63('0x8a')],_0x22caf2[_0x0a63('0x8f')],_0x22caf2['aws_lex_region'],_0x22caf2['text'],_0x22caf2[_0x0a63('0x90')])[_0x0a63('0x14')](function(_0x5006b1){_0x4d6cd9(null,_0x5006b1);})[_0x0a63('0x16')](function(_0x46382a){_0x4d6cd9(_0x46382a);});};AGIVertices[_0x0a63('0x12')]['googleASR']=function(_0x2d5db3,_0x4616d6,_0x5ef908){scripts[_0x0a63('0x91')](_0x4616d6,_0x2d5db3[_0x0a63('0x84')],_0x2d5db3[_0x0a63('0x92')]||_0x0a63('0x5f'))[_0x0a63('0x14')](function(_0x31648e){_0x5ef908(null,_0x31648e);})[_0x0a63('0x16')](function(_0x33d6fd){_0x5ef908(_0x33d6fd);});};AGIVertices[_0x0a63('0x12')][_0x0a63('0x93')]=function(_0x1cdc75,_0x1a0683,_0x262508){scripts['tildeASR'](_0x1a0683,_0x1cdc75[_0x0a63('0x94')],_0x1cdc75[_0x0a63('0x95')],_0x1cdc75[_0x0a63('0x75')])[_0x0a63('0x14')](function(_0xe51241){_0x262508(null,_0xe51241);})['catch'](function(_0x1de68b){_0x262508(_0x1de68b);});};AGIVertices['prototype'][_0x0a63('0x96')]=function(_0x488b92){var _0x50cc9a=_['includes'](verticesWithRetry,_0x488b92[_0x0a63('0x32')])?_0x488b92:_[_0x0a63('0x97')](_0x488b92);for(var _0x486e15 in _0x50cc9a){if(_0x50cc9a[_0x0a63('0x98')](_0x486e15)){if(_0x50cc9a[_0x486e15]&&_['isString'](_0x50cc9a[_0x486e15])){if(_[_0x0a63('0x6c')](recursiveMapAttributes,_0x486e15)){_0x50cc9a[_0x486e15]=this['replaceObjectAllVariables'](_0x50cc9a[_0x486e15]);}else{_0x50cc9a[_0x486e15]=this[_0x0a63('0x99')](_0x50cc9a[_0x486e15]);}}}}return _0x50cc9a;};AGIVertices['prototype'][_0x0a63('0x9a')]=function(_0x438b06){for(var _0x252fc6 in _0x438b06){if(_0x438b06[_0x0a63('0x98')](_0x252fc6)){if(_[_0x0a63('0x9b')](_0x438b06[_0x252fc6])){this[_0x0a63('0x9a')](_0x438b06[_0x252fc6]);}else if(_[_0x0a63('0x9c')](_0x438b06[_0x252fc6])){for(var _0x48018f=0x0;_0x48018f<_0x438b06[_0x252fc6]['length'];_0x48018f++){this[_0x0a63('0x9a')](_0x438b06[_0x252fc6][_0x48018f]);}}else if(_[_0x0a63('0x9d')](_0x438b06[_0x252fc6])){_0x438b06[_0x252fc6]=this[_0x0a63('0x99')](_0x438b06[_0x252fc6]);}}}};AGIVertices[_0x0a63('0x12')][_0x0a63('0x9e')]=function(_0x5a0a76,_0x212e66){for(var _0x55916f in _0x5a0a76){if(_0x5a0a76[_0x0a63('0x98')](_0x55916f)){if(_[_0x0a63('0x9b')](_0x5a0a76[_0x55916f])){if(!_[_0x0a63('0x3d')](_0x5a0a76[_0x55916f])){this['saveRestApiResult'](_0x5a0a76[_0x55916f],util[_0x0a63('0x56')]('%s.%s',_0x212e66,_0x55916f));}}else if(_[_0x0a63('0x9c')](_0x5a0a76[_0x55916f])){for(var _0x427188=0x0;_0x427188<_0x5a0a76[_0x55916f][_0x0a63('0x9f')];_0x427188++){this['saveRestApiResult'](_0x5a0a76[_0x55916f][_0x427188],util[_0x0a63('0x56')](_0x0a63('0xa0'),_0x212e66,_0x55916f+'['+_0x427188+']'));}}else{if(!_[_0x0a63('0x3e')](_0x5a0a76[_0x55916f])){this[_0x0a63('0xf')][_0x0a63('0xa1')](util[_0x0a63('0x56')]('%s.%s',_0x212e66,_0x55916f),_0x5a0a76[_0x55916f]);}}}}};AGIVertices[_0x0a63('0x12')][_0x0a63('0xa2')]=function(_0x407b39){try{var _0x4ef750=JSON[_0x0a63('0x70')](_0x407b39);this[_0x0a63('0x9a')](_0x4ef750);return JSON['stringify'](_0x4ef750);}catch(_0xd0923c){return this[_0x0a63('0x99')](_0x407b39);}};AGIVertices[_0x0a63('0x12')][_0x0a63('0x99')]=function(_0x2e21df){var _0x231246=_0x2e21df[_0x0a63('0xa3')]('{');for(var _0x2fb691=0x1;_0x2fb691<_0x231246['length'];_0x2fb691+=0x1){var _0x362de9=_0x231246[_0x2fb691][_0x0a63('0xa3')]('}');if(_0x362de9[_0x0a63('0x9f')]>0x1){_0x2e21df=_0x2e21df[_0x0a63('0xa4')]('{'+_0x362de9[0x0]+'}',this[_0x0a63('0xf')]['getVariable'](_0x362de9[0x0])[_0x0a63('0xa5')]||_0x362de9[0x0]);}}if(_0x231246[_0x0a63('0x9f')]===0x1){return _0x2e21df[_0x0a63('0xa6')]();}return this[_0x0a63('0x99')](_0x2e21df);};AGIVertices[_0x0a63('0x12')][_0x0a63('0xa7')]=function(_0x5d9075,_0x4f1eea){var _0x34b70b=this['channel']['getVariable'](_0x5d9075);if(_0x34b70b[_0x0a63('0xa8')]===-0x1){return _0x34b70b;}logger[_0x0a63('0x28')](util['format'](_0x0a63('0xa9'),_0x4f1eea,_0x34b70b[_0x0a63('0xa5')]));return this[_0x0a63('0xf')][_0x0a63('0xa1')](_0x4f1eea,_0x34b70b[_0x0a63('0xa5')]);};AGIVertices[_0x0a63('0x12')][_0x0a63('0x88')]=function(_0x2a84be){return _0x2a84be&&_0x2a84be!=='0'&&_0x2a84be!=='-1'&&_0x2a84be!=='';};AGIVertices[_0x0a63('0x12')][_0x0a63('0xaa')]=function(_0x529e25){this[_0x0a63('0x2f')][_0x0a63('0x74')](this,_0x529e25,'-');_0x529e25[_0x0a63('0xab')]=_0x529e25[_0x0a63('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x0a63('0xac')]=function(_0x35becd){logger['info'](util[_0x0a63('0x56')](_0x0a63('0xad'),_0x35becd[_0x0a63('0x31')]));if(!this['isConfigured'](_0x35becd[_0x0a63('0x65')])){return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0xaf'));}var _0x18b690='\x22'+_0x35becd[_0x0a63('0x65')]+'\x22';if(this['isConfigured'](_0x35becd[_0x0a63('0x7d')])){_0x18b690+=','+_0x35becd[_0x0a63('0x7d')];}var _0x13a3cd=this[_0x0a63('0xf')][_0x0a63('0x59')](_0x0a63('0xb0'),_0x18b690);if(_0x13a3cd['result']===-0x1){return _0x13a3cd;}return this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')]('Executed\x20command\x20MRCPSynth\x20%s',_0x18b690));};AGIVertices[_0x0a63('0x12')][_0x0a63('0xb1')]=function(_0xb4afe1){logger[_0x0a63('0x28')](util['format'](_0x0a63('0xb2'),_0xb4afe1[_0x0a63('0x31')]));if(!this['isConfigured'](_0xb4afe1[_0x0a63('0xb3')])){return this[_0x0a63('0xf')][_0x0a63('0xae')]('no\x20grammar\x20configured');}var _0x87f56=_0xb4afe1[_0x0a63('0xb3')];if(this[_0x0a63('0x88')](_0xb4afe1[_0x0a63('0x7d')])){_0x87f56+=','+_0xb4afe1['options'];}var _0x37ffc3=this['channel'][_0x0a63('0x59')](_0x0a63('0xb4'),_0x87f56);if(_0x37ffc3[_0x0a63('0xa8')]===-0x1){return _0x37ffc3;}var _0x4f5e4a=this[_0x0a63('0xa7')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x4f5e4a[_0x0a63('0xa8')]===-0x1){return _0x4f5e4a;}var _0x5cf250=this[_0x0a63('0xa7')](_0x0a63('0xb5'),_0x0a63('0xb6'));if(_0x5cf250[_0x0a63('0xa8')]===-0x1){return _0x5cf250;}var _0x1683fe=this[_0x0a63('0xa7')]('RECOG_INSTANCE()',_0x0a63('0xb7'));if(_0x1683fe[_0x0a63('0xa8')]===-0x1){return _0x1683fe;}return this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0xb8'),_0x87f56));};AGIVertices[_0x0a63('0x12')][_0x0a63('0x6')]=function(_0x1a7d5b){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0xb9'),_0x1a7d5b[_0x0a63('0x31')]));return this[_0x0a63('0xf')][_0x0a63('0x6')]([_0x1a7d5b[_0x0a63('0xba')],_0x1a7d5b[_0x0a63('0xbb')]]);};AGIVertices[_0x0a63('0x12')][_0x0a63('0xbc')]=function(_0x137423){logger['info'](util[_0x0a63('0x56')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x137423[_0x0a63('0x31')]));if(this['isConfigured'](_0x137423[_0x0a63('0x6a')])){logger[_0x0a63('0x28')](util[_0x0a63('0x56')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x137423['timeout']));var _0x38c4f9=this['channel'][_0x0a63('0xbd')](_0x137423[_0x0a63('0x6a')]);if(_0x38c4f9[_0x0a63('0xa8')]===-0x1){return _0x38c4f9;}}return this['channel'][_0x0a63('0xbc')]();};AGIVertices['prototype'][_0x0a63('0x43')]=function(_0x27619f){logger[_0x0a63('0x28')](util[_0x0a63('0x56')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x27619f[_0x0a63('0x31')]));if(!this['isConfigured'](_0x27619f[_0x0a63('0xbe')])){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x27619f,_0x0a63('0xbf'));}_0x27619f[_0x0a63('0x45')]=moment();if(this[_0x0a63('0x88')](_0x27619f[_0x0a63('0xc0')])){_0x27619f[_0x0a63('0x45')]=moment()[_0x0a63('0x4a')](_0x27619f[_0x0a63('0xc0')],'minutes');}if(!this[_0x0a63('0x88')](_0x27619f[_0x0a63('0xc1')])){_0x27619f['callback_priority']=0x2;}this[_0x0a63('0x3c')]['sync'](this,_0x27619f);return this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x27619f[_0x0a63('0x42')],_0x27619f[_0x0a63('0xbe')],_0x27619f[_0x0a63('0x45')]));};AGIVertices[_0x0a63('0x12')][_0x0a63('0xc2')]=function(_0x5e2926){logger['info'](util[_0x0a63('0x56')](_0x0a63('0xc3'),_0x5e2926[_0x0a63('0x31')]));var _0x4eb619=this[_0x0a63('0xf')][_0x0a63('0x59')](_0x5e2926[_0x0a63('0xc4')],_0x5e2926[_0x0a63('0x7d')]);if(_0x4eb619[_0x0a63('0xa8')]===-0x1){return _0x4eb619;}return this[_0x0a63('0xf')][_0x0a63('0xae')](util['format'](_0x0a63('0xc5'),_0x5e2926[_0x0a63('0xc4')],_0x5e2926['options']));};AGIVertices['prototype'][_0x0a63('0xc6')]=function(_0x20860c){logger[_0x0a63('0x28')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x20860c[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x20860c[_0x0a63('0x65')])){return this['channel']['noop'](_0x0a63('0xaf'));}var _0x4b3f63='\x22'+_0x20860c[_0x0a63('0x65')]+'\x22';if(this['isConfigured'](_0x20860c[_0x0a63('0x7d')])){_0x4b3f63+=','+_0x20860c['options'];}var _0xf9bf87=this[_0x0a63('0xf')]['exec'](_0x0a63('0xb0'),_0x4b3f63);if(_0xf9bf87[_0x0a63('0xa8')]===-0x1){return _0xf9bf87;}return this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4b3f63));};AGIVertices[_0x0a63('0x12')]['sestektts']=function(_0x2e7690){logger['info'](util[_0x0a63('0x56')](_0x0a63('0xc7'),_0x2e7690[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x2e7690[_0x0a63('0x65')])){return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0xaf'));}var _0x2c540f='\x22'+_0x2e7690['text']+'\x22';if(this[_0x0a63('0x88')](_0x2e7690[_0x0a63('0x7d')])){_0x2c540f+=','+_0x2e7690['options'];}var _0x276050=this[_0x0a63('0xf')][_0x0a63('0x59')](_0x0a63('0xb0'),_0x2c540f);if(_0x276050['result']===-0x1){return _0x276050;}return this[_0x0a63('0xf')]['noop'](util['format'](_0x0a63('0xc8'),_0x2c540f));};AGIVertices[_0x0a63('0x12')][_0x0a63('0xc9')]=function(_0x340281){logger[_0x0a63('0x28')](util[_0x0a63('0x56')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x340281[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x340281[_0x0a63('0xb3')])){return this[_0x0a63('0xf')][_0x0a63('0xae')]('no\x20grammar\x20configured');}var _0x100340=_0x340281[_0x0a63('0xb3')];if(this[_0x0a63('0x88')](_0x340281[_0x0a63('0x7d')])){_0x100340+=','+_0x340281['options'];}var _0x11309c=this['channel'][_0x0a63('0x59')]('MRCPRecog',_0x100340);if(_0x11309c[_0x0a63('0xa8')]===-0x1){return _0x11309c;}var _0x3f08d6=this[_0x0a63('0xa7')]('RECOG_CONFIDENCE()',_0x0a63('0xca'));if(_0x3f08d6[_0x0a63('0xa8')]===-0x1){return _0x3f08d6;}var _0x36a64b=this['getAndSetVariable'](_0x0a63('0xb5'),_0x0a63('0xcb'));if(_0x36a64b[_0x0a63('0xa8')]===-0x1){return _0x36a64b;}var _0x1da6c0=this[_0x0a63('0xa7')](_0x0a63('0xcc'),_0x0a63('0xcd'));if(_0x1da6c0[_0x0a63('0xa8')]===-0x1){return _0x1da6c0;}return this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')]('Executed\x20command\x20MRCPRecog\x20%s',_0x100340));};AGIVertices[_0x0a63('0x12')][_0x0a63('0xce')]=function(_0x5cb343){logger[_0x0a63('0x28')](util['format'](_0x0a63('0xcf'),_0x5cb343[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x5cb343[_0x0a63('0xb3')])){return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0xd0'));}var _0x20cc0f=_0x5cb343[_0x0a63('0xb3')];if(this['isConfigured'](_0x5cb343[_0x0a63('0x7d')])){_0x20cc0f+=','+_0x5cb343[_0x0a63('0x7d')];}var _0x107f3f=this[_0x0a63('0xf')][_0x0a63('0x59')](_0x0a63('0xb4'),_0x20cc0f);if(_0x107f3f[_0x0a63('0xa8')]===-0x1){return _0x107f3f;}var _0x17f6b7=this['getAndSetVariable'](_0x0a63('0xd1'),_0x0a63('0xd2'));if(_0x17f6b7['result']===-0x1){return _0x17f6b7;}var _0x3c2e47=this[_0x0a63('0xa7')]('RECOG_INPUT()',_0x0a63('0xd3'));if(_0x3c2e47['result']===-0x1){return _0x3c2e47;}var _0x595798=this['getAndSetVariable'](_0x0a63('0xcc'),_0x0a63('0xd4'));if(_0x595798[_0x0a63('0xa8')]===-0x1){return _0x595798;}return this['channel']['noop'](util[_0x0a63('0x56')](_0x0a63('0xb8'),_0x20cc0f));};AGIVertices[_0x0a63('0x12')][_0x0a63('0xd5')]=function(_0x52403d){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0xd6'),_0x52403d['label']));if(!this[_0x0a63('0x88')](_0x52403d['odbc_id'])){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x52403d,'no\x20database\x20selected');}var _0x558d35=this[_0x0a63('0x19')][_0x0a63('0x74')](this,_0x52403d['odbc_id']);if(!_0x558d35){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x52403d,_0x0a63('0xd7'));}if(!this[_0x0a63('0x88')](_0x52403d[_0x0a63('0x2a')])){return this[_0x0a63('0xf')]['error'](_0x52403d,_0x0a63('0xd8'));}var _0x4577c1=_0x52403d[_0x0a63('0x2a')][_0x0a63('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0xd9'),_0x4577c1));var _0x1506fa=this['getQueryOdbc'][_0x0a63('0x74')](this,_0x558d35,_0x4577c1);this['createSquareDetailsReport'][_0x0a63('0x74')](this,_0x52403d,_0x4577c1);if(!this[_0x0a63('0x88')](_0x52403d['variable_id'])){return this[_0x0a63('0xf')]['noop'](_0x0a63('0xda'));}var _0x5c9b1d=this[_0x0a63('0x13')][_0x0a63('0x74')](this,_0x52403d['variable_id']);if(!_0x5c9b1d){return this['channel'][_0x0a63('0x27')](_0x52403d,'no\x20variable\x20found');}var _0x46de13=this;_0x1506fa['forEach'](function(_0x162feb,_0xcd57d1){Object[_0x0a63('0xdb')](_0x162feb)[_0x0a63('0xdc')](function(_0x3641f2){_0x46de13['channel']['setVariable'](util[_0x0a63('0x56')](_0x0a63('0xdd'),_0x5c9b1d,_0xcd57d1,_0x3641f2),_0x162feb[_0x3641f2]);});});this['channel'][_0x0a63('0xa1')](util['format']('%s_ROWS_COUNT',_0x5c9b1d),_0x1506fa[_0x0a63('0x9f')]);return this[_0x0a63('0xf')]['noop'](util[_0x0a63('0x56')]('variable\x20%s\x20set',_0x5c9b1d));};AGIVertices[_0x0a63('0x12')][_0x0a63('0xde')]=function(_0x1e3069){logger['debug'](util[_0x0a63('0x56')](_0x0a63('0xdf'),_0x1e3069['label']));if(!this[_0x0a63('0x88')](_0x1e3069[_0x0a63('0xe0')])){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x1e3069,_0x0a63('0xe1'));}var _0x34b1cb=this[_0x0a63('0xe2')][_0x0a63('0x74')](this,_0x1e3069[_0x0a63('0xe0')]);if(!_0x34b1cb){return this['channel'][_0x0a63('0x27')](_0x1e3069,_0x0a63('0xe3'));}var _0x580a13=this[_0x0a63('0xf')][_0x0a63('0x59')](_0x0a63('0xe4'),[util[_0x0a63('0x56')]('SIP/%s',_0x34b1cb),_0x1e3069['timeout'],_0x1e3069[_0x0a63('0xe5')],_0x1e3069['url']]);if(_0x580a13[_0x0a63('0xa8')]===-0x1){return _0x580a13;}return this[_0x0a63('0xf')]['noop'](util[_0x0a63('0x56')](_0x0a63('0xe6'),'DIAL'));};AGIVertices[_0x0a63('0x12')][_0x0a63('0xe7')]=function(_0x59884a){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0xe8'),_0x59884a[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x59884a[_0x0a63('0x84')])){return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0xe9'));}if(!this[_0x0a63('0x88')](_0x59884a[_0x0a63('0x65')])){return this[_0x0a63('0xf')][_0x0a63('0xae')]('no\x20text\x20configured');}this[_0x0a63('0xf')][_0x0a63('0xea')]=!![];this[_0x0a63('0x2f')](_0x59884a);this[_0x0a63('0x3b')](_0x59884a[_0x0a63('0x65')],'in','','');this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0xeb'),_0x59884a['text']));var _0x348363=this[_0x0a63('0x7e')][_0x0a63('0x74')](this,_0x59884a);if(_0x348363){for(var _0x269e84 in _0x348363){if(_0x348363['hasOwnProperty'](_0x269e84)){this[_0x0a63('0xf')][_0x0a63('0xa1')](util['format']('DIALOGFLOW_%s',_0x269e84['toUpperCase']()),_0x348363[_0x269e84]);}}this[_0x0a63('0x3b')](_0x348363[_0x0a63('0xec')],_0x0a63('0xed'),_0x0a63('0xe7'),'');return this[_0x0a63('0xf')]['noop'](util[_0x0a63('0x56')](_0x0a63('0xee'),_0x348363[_0x0a63('0xec')]));}return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x59884a,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x0a63('0x12')][_0x0a63('0xef')]=function(_0x33400c){logger['info'](util['format'](_0x0a63('0xf0'),_0x33400c[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x33400c[_0x0a63('0xf1')])){return this[_0x0a63('0xf')]['noop'](_0x0a63('0xf2'));}if(!this[_0x0a63('0x88')](_0x33400c[_0x0a63('0x7f')])){return this[_0x0a63('0xf')][_0x0a63('0xae')]('no\x20client_email\x20configured');}if(!this[_0x0a63('0x88')](_0x33400c[_0x0a63('0x80')])){return this[_0x0a63('0xf')]['noop']('no\x20private_key\x20configured');}if(!this[_0x0a63('0x88')](_0x33400c[_0x0a63('0x81')])){return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0xf3'));}if(!this['isConfigured'](_0x33400c['text'])){return this['channel'][_0x0a63('0xae')]('no\x20text\x20configured');}this[_0x0a63('0xf')][_0x0a63('0xea')]=!![];this['createSquareDetailsReport'](_0x33400c);this['createSquareMessage'](_0x33400c[_0x0a63('0x65')],'in','','');this[_0x0a63('0xf')]['noop'](util[_0x0a63('0x56')](_0x0a63('0xf4'),_0x33400c[_0x0a63('0x65')]));var _0x4ed872=this['googleDialogflowV2']['sync'](this,_0x33400c);if(_0x4ed872){for(var _0x5a6b4e in _0x4ed872){if(_0x4ed872[_0x0a63('0x98')](_0x5a6b4e)){if(_0x5a6b4e!==_0x0a63('0xf5')){this[_0x0a63('0xf')][_0x0a63('0xa1')](util[_0x0a63('0x56')](_0x0a63('0xf6'),_0x5a6b4e['toUpperCase']()),_0x4ed872[_0x5a6b4e]);}}}this[_0x0a63('0x3b')](_0x4ed872[_0x0a63('0xec')],_0x0a63('0xed'),_0x0a63('0xef'),_0x4ed872[_0x0a63('0xf5')]);return this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0xf7'),_0x4ed872['speech']));}return this[_0x0a63('0xf')]['error'](_0x33400c,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x0a63('0x12')]['sesteknda']=function(_0x2f0d72){logger['info'](util['format'](_0x0a63('0xf8'),_0x2f0d72[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x2f0d72[_0x0a63('0xf9')])){return this[_0x0a63('0xf')][_0x0a63('0xae')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x0a63('0x88')](_0x2f0d72[_0x0a63('0xfa')])){return this[_0x0a63('0xf')]['noop']('no\x20username\x20configured');}if(!this[_0x0a63('0x88')](_0x2f0d72[_0x0a63('0xfb')])){return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0xfc'));}if(!this['isConfigured'](_0x2f0d72['ndassistant_url'])){return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0xaf'));}this[_0x0a63('0xf')][_0x0a63('0xea')]=!![];this[_0x0a63('0x2f')](_0x2f0d72);this['createSquareMessage'](_0x2f0d72[_0x0a63('0x65')],'in','','');this[_0x0a63('0xf')]['noop'](util[_0x0a63('0x56')](_0x0a63('0xfd'),_0x2f0d72['text']));var _0x141a34=this[_0x0a63('0x82')][_0x0a63('0x74')](this,_0x2f0d72);if(_0x141a34){for(var _0x37797f in _0x141a34){if(_0x141a34[_0x0a63('0x98')](_0x37797f)){this[_0x0a63('0xf')][_0x0a63('0xa1')](util['format'](_0x0a63('0xfe'),_0x37797f['toUpperCase']()),_0x141a34[_0x37797f]);}}this[_0x0a63('0x3b')](_0x141a34[_0x0a63('0xec')],'out',_0x0a63('0xff'),'');if(_0x141a34[_0x0a63('0x100')]){this[_0x0a63('0xf')][_0x0a63('0xae')](util['format'](_0x0a63('0x101'),_0x141a34[_0x0a63('0x100')]));var _0x4b150d=this['channel'][_0x0a63('0x102')](_0x141a34[_0x0a63('0x100')]);try{fs[_0x0a63('0x103')](_0x141a34[_0x0a63('0x100')]+_0x0a63('0x104'));}catch(_0x5252ad){logger[_0x0a63('0x27')](_0x5252ad);}return _0x4b150d;}else{return this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x105'),_0x141a34['speech']));}}return this['channel'][_0x0a63('0x27')](_0x2f0d72,_0x0a63('0x106'));};AGIVertices['prototype'][_0x0a63('0x107')]=function(_0x4bd1d7){logger[_0x0a63('0x28')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x4bd1d7[_0x0a63('0x31')]));return this[_0x0a63('0xf')]['noop'](_0x0a63('0x107'));};AGIVertices[_0x0a63('0x12')][_0x0a63('0x108')]=function(_0x106953){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x109'),_0x106953['label']));var _0x38e66d='';if(_0x106953[_0x0a63('0x10a')]){if(!this['isConfigured'](_0x106953[_0x0a63('0x10a')])){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x106953,'no\x20trunk\x20selected');}else{var _0x4cb6e1=parseInt(_0x106953[_0x0a63('0x10a')],0xa);if(isNaN(_0x4cb6e1)){_0x38e66d=_0x106953[_0x0a63('0x10a')];}else{_0x38e66d=this[_0x0a63('0x10b')][_0x0a63('0x74')](this,_0x106953[_0x0a63('0x10a')]);if(!_0x38e66d){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x106953,_0x0a63('0x10c'));}}}}else if(_0x106953[_0x0a63('0x10d')]){_0x38e66d=_0x106953[_0x0a63('0x10d')];}else{return this['channel']['error'](_0x106953,_0x0a63('0x10e'));}var _0xcb69ba=this['channel'][_0x0a63('0x59')](_0x0a63('0xe4'),[util['format'](_0x0a63('0x10f'),_0x38e66d,_0x106953[_0x0a63('0x42')]),_0x106953['timeout'],_0x106953[_0x0a63('0xe5')],_0x106953[_0x0a63('0x68')]]);if(_0xcb69ba['result']===-0x1){return _0xcb69ba;}return this[_0x0a63('0xf')]['noop'](util[_0x0a63('0x56')](_0x0a63('0xe6'),_0x0a63('0xe4')));};AGIVertices[_0x0a63('0x12')][_0x0a63('0x110')]=function(_0x3d9031){logger['info'](util[_0x0a63('0x56')](_0x0a63('0x111'),_0x3d9031['label']));return this[_0x0a63('0xf')][_0x0a63('0xae')]('finally');};AGIVertices[_0x0a63('0x12')][_0x0a63('0xd')]=function(_0x532196){logger['info'](util[_0x0a63('0x56')](_0x0a63('0x112'),_0x532196[_0x0a63('0x31')]));if(_0x532196[_0x0a63('0xab')]===0x0){return this[_0x0a63('0xaa')](_0x532196);}_0x532196[_0x0a63('0xab')]-=0x1;if(!this[_0x0a63('0x88')](_0x532196[_0x0a63('0x113')])){return this['channel'][_0x0a63('0x27')](_0x532196,_0x0a63('0x114'));}var _0x494bc3=this[_0x0a63('0x115')][_0x0a63('0x74')](this,_0x532196[_0x0a63('0x113')]);if(!_0x494bc3){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x532196,_0x0a63('0x116'));}if(!this[_0x0a63('0x88')](_0x532196['variable_id'])){return this[_0x0a63('0xf')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4e0f61=this['channel']['getData'](_0x494bc3,_0x532196[_0x0a63('0x117')],_0x532196[_0x0a63('0x118')]);var _0x482cd9=_0x4e0f61[_0x0a63('0xa8')]?_0x4e0f61['result'][_0x0a63('0xa6')]():'';logger[_0x0a63('0x28')](_0x0a63('0x119'),JSON[_0x0a63('0x78')](_0x4e0f61));if(_0x4e0f61[_0x0a63('0xa8')]===-0x1){this[_0x0a63('0x2f')]['sync'](this,_0x532196,_0x482cd9);return _0x4e0f61;}else if(_0x4e0f61['extra']===_0x0a63('0x6a')){_0x4e0f61['result']=_0x482cd9[_0x0a63('0x9f')]>=parseInt(_0x532196[_0x0a63('0x11a')])?'x':'i';}else{_0x4e0f61['result']=_0x482cd9[_0x0a63('0x9f')]>=parseInt(_0x532196[_0x0a63('0x11a')])&&_0x482cd9[_0x0a63('0x9f')]<=parseInt(_0x532196[_0x0a63('0x118')])?'x':'i';}var _0x717d20=this[_0x0a63('0x13')]['sync'](this,_0x532196['variable_id']);if(!_0x717d20){return this['channel'][_0x0a63('0x27')](_0x532196,_0x0a63('0x11b'));}this[_0x0a63('0xf')][_0x0a63('0xa1')](_0x717d20,_0x482cd9);if(this['isConfigured'](_0x532196['hiddendigitsnum'])){var _0x5b19eb=parseInt(_0x532196[_0x0a63('0x11c')],0xa);var _0x3b5e90=rs[_0x0a63('0x11d')]({'charset':'*','length':_0x5b19eb});var _0x2d185b=_0x482cd9['length'];if(_0x2d185b>0x0){if(_0x2d185b>_0x5b19eb){this[_0x0a63('0x2f')]['sync'](this,_0x532196,_0x532196['hiddendigitspos']==='first'?_0x3b5e90+_0x482cd9[_0x0a63('0x11e')](_0x5b19eb):_0x482cd9[_0x0a63('0x11e')](0x0,_0x2d185b-_0x5b19eb)+_0x3b5e90);}else{this['createSquareDetailsReport'][_0x0a63('0x74')](this,_0x532196,rs[_0x0a63('0x11d')]({'charset':'*','length':_0x2d185b}));}}else{this[_0x0a63('0x2f')][_0x0a63('0x74')](this,_0x532196,'');}}else{this[_0x0a63('0x2f')]['sync'](this,_0x532196,_0x482cd9);}return _0x4e0f61;};AGIVertices['prototype'][_0x0a63('0xe')]=function(_0x196ebb){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x11f'),_0x196ebb[_0x0a63('0x31')]));return this[_0x0a63('0xd')](_0x196ebb);};AGIVertices[_0x0a63('0x12')][_0x0a63('0x120')]=function(_0x995a){logger['info'](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x995a[_0x0a63('0x31')]));this['createSquareDetailsReport'][_0x0a63('0x74')](this,_0x995a,_0x995a[_0x0a63('0x121')]);return this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x122'),_0x995a[_0x0a63('0x121')]));};AGIVertices['prototype']['awspolly']=function(_0x5b8ede){logger[_0x0a63('0x28')](util['format'](_0x0a63('0x123'),_0x5b8ede[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x5b8ede['aws_access_key_id'])||!this[_0x0a63('0x88')](_0x5b8ede[_0x0a63('0x8f')])){return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0x124'));}if(!this[_0x0a63('0x88')](_0x5b8ede[_0x0a63('0x65')])){return this[_0x0a63('0xf')]['noop'](_0x0a63('0xaf'));}this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x125'),_0x5b8ede[_0x0a63('0x65')]));var _0x3a9ec9=this[_0x0a63('0x89')]['sync'](this,_0x5b8ede);if(_0x3a9ec9){this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x126'),_0x3a9ec9));var _0x2bdfc5=this[_0x0a63('0xf')][_0x0a63('0x102')](_0x3a9ec9);try{fs[_0x0a63('0x103')](_0x3a9ec9+_0x0a63('0x104'));}catch(_0x2df06f){logger[_0x0a63('0x27')](_0x2df06f);}return _0x2bdfc5;}return this[_0x0a63('0xf')]['error'](_0x5b8ede,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x0a63('0x12')][_0x0a63('0x127')]=function(_0x2ebd41){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x128'),_0x2ebd41[_0x0a63('0x31')]));if(!this['isConfigured'](_0x2ebd41[_0x0a63('0x8a')])||!this[_0x0a63('0x88')](_0x2ebd41['aws_secret_access_key'])){return this['channel']['noop'](_0x0a63('0x124'));}if(!this[_0x0a63('0x88')](_0x2ebd41[_0x0a63('0x90')])){return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0x129'));}if(!this[_0x0a63('0x88')](_0x2ebd41[_0x0a63('0x65')])){return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0xaf'));}this[_0x0a63('0xf')][_0x0a63('0xea')]=!![];this[_0x0a63('0x2f')](_0x2ebd41);this[_0x0a63('0x3b')](_0x2ebd41['text'],'in','','');this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x12a'),_0x2ebd41[_0x0a63('0x65')]));var _0x4e8c24=this[_0x0a63('0x12b')][_0x0a63('0x74')](this,_0x2ebd41);if(_0x4e8c24){for(var _0x3401e7 in _0x4e8c24){if(_0x4e8c24[_0x0a63('0x98')](_0x3401e7)&&_[_0x0a63('0x9d')](_0x4e8c24[_0x3401e7])){this[_0x0a63('0xf')]['setVariable'](util[_0x0a63('0x56')](_0x0a63('0x12c'),_0x3401e7[_0x0a63('0x12d')]()),_0x4e8c24[_0x3401e7]);}}if(_['isNil'](_0x4e8c24[_0x0a63('0x12e')])){return this['channel'][_0x0a63('0xae')](_0x0a63('0x12f'));}else{this[_0x0a63('0x3b')](_0x4e8c24['message'],'out','amazonlex','');return this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x130'),_0x4e8c24['message']));}}return this[_0x0a63('0xf')]['error'](_0x2ebd41,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype'][_0x0a63('0x131')]=function(_0x55c12a){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x132'),_0x55c12a['label'],_0x55c12a[_0x0a63('0x6a')]));if(!this[_0x0a63('0x88')](_0x55c12a[_0x0a63('0x84')])){return this[_0x0a63('0xf')][_0x0a63('0xae')]('no\x20key\x20configured');}var _0x303190=_0x0a63('0x133');var _0x46e575=util[_0x0a63('0x56')](_0x0a63('0x134'),FILES_PATH,rs['generate'](0x4));var _0x3bb365=util['format'](_0x0a63('0xa0'),_0x46e575,_0x303190);var _0x379985=!![];if(_0x55c12a[_0x0a63('0x135')]==='NOBEEP'){_0x379985=![];}var _0x481558=this[_0x0a63('0xf')][_0x0a63('0x136')](_0x46e575,_0x303190,_0x55c12a[_0x0a63('0x137')],_0x55c12a[_0x0a63('0x6a')],undefined,_0x379985);if(_0x481558[_0x0a63('0xa8')]!==-0x1){this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x138'),_0x3bb365));var _0x66a455=this[_0x0a63('0x91')]['sync'](this,_0x55c12a,_0x3bb365);if(_0x66a455){for(var _0xf0aadc in _0x66a455){if(_0x66a455[_0x0a63('0x98')](_0xf0aadc)){this['channel'][_0x0a63('0xa1')](util['format'](_0x0a63('0x139'),_0xf0aadc[_0x0a63('0x12d')]()),_0x66a455[_0xf0aadc]);}}return this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x13a'),JSON['stringify'](_0x66a455)));}}return _0x481558;};AGIVertices[_0x0a63('0x12')]['tildeasr']=function(_0x1164f5){logger[_0x0a63('0x28')](util[_0x0a63('0x56')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x1164f5[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x1164f5[_0x0a63('0x94')])){return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0x13b'));}if(!this['isConfigured'](_0x1164f5[_0x0a63('0x95')])){return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0x13c'));}var _0x5bf793='wav';var _0x5d71c3=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x0a63('0x11d')](0x4));var _0x54effc=util['format'](_0x0a63('0xa0'),_0x5d71c3,_0x5bf793);var _0x1c4309=!![];if(_0x1164f5['beep']===_0x0a63('0x13d')){_0x1c4309=![];}var _0x3992f6=this[_0x0a63('0xf')][_0x0a63('0x136')](_0x5d71c3,_0x5bf793,_0x1164f5['intKey'],_0x1164f5[_0x0a63('0x6a')],undefined,_0x1c4309);if(_0x3992f6[_0x0a63('0xa8')]!==-0x1){this[_0x0a63('0xf')]['noop'](util[_0x0a63('0x56')]('tilde\x20%s\x20file\x20created',_0x54effc));var _0x43dfe6=this[_0x0a63('0x93')][_0x0a63('0x74')](this,_0x1164f5,_0x54effc);if(_0x43dfe6){for(var _0x5a23ea in _0x43dfe6){if(_0x43dfe6['hasOwnProperty'](_0x5a23ea)){this[_0x0a63('0xf')][_0x0a63('0xa1')](util[_0x0a63('0x56')](_0x0a63('0x13e'),_0x5a23ea['toUpperCase']()),_0x43dfe6[_0x5a23ea]);}}return this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')]('TildeASR\x20Result\x20%s',JSON[_0x0a63('0x78')](_0x43dfe6)));}}return _0x3992f6;};AGIVertices[_0x0a63('0x12')]['gotoc']=function(_0xc758bc){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x13f'),_0xc758bc[_0x0a63('0x31')]));return this[_0x0a63('0xf')]['continueAt'](_0xc758bc[_0x0a63('0x37')],_0xc758bc[_0x0a63('0x38')],_0xc758bc[_0x0a63('0x39')]);};AGIVertices['prototype'][_0x0a63('0x140')]=function(_0x5c8d22){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x141'),_0x5c8d22[_0x0a63('0x31')]));if(!this['isConfigured'](_0x5c8d22['condition'])){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x5c8d22,_0x0a63('0x142'));}try{var _0x153503=eval(_0x5c8d22[_0x0a63('0x143')])?_0x0a63('0x144'):_0x0a63('0x145');this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x146'),_0x5c8d22['condition'],_0x153503));return{'code':0xc8,'result':_0x153503};}catch(_0x278f06){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x0a63('0x12')][_0x0a63('0x147')]=function(_0x52c1ca){logger['info'](util['format'](_0x0a63('0x148'),_0x52c1ca[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x52c1ca[_0x0a63('0x149')])){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x52c1ca,_0x0a63('0x14a'));}var _0x1a43f7=this[_0x0a63('0x14b')][_0x0a63('0x74')](this,_0x52c1ca[_0x0a63('0x149')]);if(!_0x1a43f7){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x52c1ca,'no\x20intervals\x20found');}for(var _0x298906=0x0;_0x298906<_0x1a43f7['length'];_0x298906+=0x1){var _0x3056dd=this['channel'][_0x0a63('0x13')](util['format']('IFTIME(%s?true:false)',_0x1a43f7[_0x298906]));if(_0x3056dd[_0x0a63('0xa8')]===-0x1){return _0x3056dd;}logger[_0x0a63('0x28')](util[_0x0a63('0x56')]('IFTIME\x20%s\x20%s',_0x1a43f7[_0x298906],_0x3056dd[_0x0a63('0xa5')]));if(_0x3056dd[_0x0a63('0xa5')]===_0x0a63('0x144')){logger['info'](util[_0x0a63('0x56')]('IFTIME\x20%s\x20%s',_0x1a43f7[_0x298906],'true'));this[_0x0a63('0xf')][_0x0a63('0xae')](util['format'](_0x0a63('0x14c'),_0x1a43f7[_0x298906],'true'));return{'code':0xc8,'result':_0x0a63('0x144')};}else{logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x14c'),_0x1a43f7[_0x298906],_0x0a63('0x145')));this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x14c'),_0x1a43f7[_0x298906],_0x0a63('0x145')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x0a63('0x14d')]=function(_0x5c57f4){logger[_0x0a63('0x28')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x5c57f4[_0x0a63('0x31')]));return this[_0x0a63('0xf')]['hangup']();};AGIVertices[_0x0a63('0x12')]['ispeechasr']=function(_0x904e51){logger['info'](util[_0x0a63('0x56')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x904e51[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x904e51[_0x0a63('0x84')])){return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0xe9'));}var _0x27411e='wav';var _0x2fc1d5=util[_0x0a63('0x56')](_0x0a63('0x134'),FILES_PATH,rs[_0x0a63('0x11d')](0x4));var _0x2c6463=util[_0x0a63('0x56')](_0x0a63('0xa0'),_0x2fc1d5,_0x27411e);var _0xa87b4c=!![];if(_0x904e51[_0x0a63('0x135')]===_0x0a63('0x13d')){_0xa87b4c=![];}var _0x3452a6=this['channel'][_0x0a63('0x136')](_0x2fc1d5,_0x27411e,_0x904e51[_0x0a63('0x137')],_0x904e51[_0x0a63('0x6a')],undefined,_0xa87b4c);if(_0x3452a6[_0x0a63('0xa8')]!==-0x1){this[_0x0a63('0xf')]['noop'](util['format'](_0x0a63('0x14e'),_0x2c6463));var _0x39dce8=this[_0x0a63('0x87')][_0x0a63('0x74')](this,_0x904e51,_0x2c6463);if(_0x39dce8){for(var _0x5dbb0d in _0x39dce8){if(_0x39dce8['hasOwnProperty'](_0x5dbb0d)){this['channel'][_0x0a63('0xa1')](util[_0x0a63('0x56')](_0x0a63('0x14f'),_0x5dbb0d[_0x0a63('0x12d')]()),_0x39dce8[_0x5dbb0d]);}}return this[_0x0a63('0xf')]['noop'](util[_0x0a63('0x56')](_0x0a63('0x150'),JSON[_0x0a63('0x78')](_0x39dce8)));}}return _0x3452a6;};AGIVertices[_0x0a63('0x12')][_0x0a63('0x151')]=function(_0x17d92c){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x152'),_0x17d92c[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x17d92c[_0x0a63('0x84')])){return this['channel'][_0x0a63('0xae')](_0x0a63('0xe9'));}if(!this[_0x0a63('0x88')](_0x17d92c[_0x0a63('0x65')])){return this[_0x0a63('0xf')]['noop'](_0x0a63('0xaf'));}this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x153'),_0x17d92c[_0x0a63('0x65')]));var _0x215642=this[_0x0a63('0x83')]['sync'](this,_0x17d92c);if(_0x215642){this['channel'][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x14e'),_0x215642));var _0x17c612=this[_0x0a63('0xf')][_0x0a63('0x102')](_0x215642,_0x17d92c[_0x0a63('0x137')]);try{fs[_0x0a63('0x103')](_0x215642+_0x0a63('0x104'));}catch(_0x2499d8){logger[_0x0a63('0x27')](_0x2499d8);}return _0x17c612;}return this['channel'][_0x0a63('0x27')](_0x17d92c,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x0a63('0x154')]=function(_0x7137a4){logger[_0x0a63('0x28')](util[_0x0a63('0x56')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x7137a4[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x7137a4[_0x0a63('0x155')])){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x7137a4,_0x0a63('0x156'));}logger[_0x0a63('0x28')](util['format'](_0x0a63('0x157'),this[_0x0a63('0xf')]['callerid'],_0x7137a4[_0x0a63('0x155')]));var _0x1ffac5=this[_0x0a63('0x54')][_0x0a63('0x74')](this,_0x7137a4[_0x0a63('0x155')]);if(_0x1ffac5){logger[_0x0a63('0x28')](util['format'](_0x0a63('0x158'),this[_0x0a63('0xf')]['callerid'],_0x7137a4[_0x0a63('0x155')]));this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x158'),this[_0x0a63('0xf')][_0x0a63('0x34')],_0x7137a4[_0x0a63('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x0a63('0x28')](util[_0x0a63('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0a63('0xf')][_0x0a63('0x34')],_0x7137a4[_0x0a63('0x155')]));this['channel'][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x159'),this[_0x0a63('0xf')][_0x0a63('0x34')],_0x7137a4[_0x0a63('0x155')]));return{'code':0xc8,'result':_0x0a63('0x15a')};}};AGIVertices['prototype'][_0x0a63('0x15b')]=function(_0x1ec505){logger[_0x0a63('0x28')](util['format'](_0x0a63('0x15c'),_0x1ec505[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x1ec505[_0x0a63('0x155')])){return this[_0x0a63('0xf')]['error'](_0x1ec505,_0x0a63('0x156'));}logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x157'),this[_0x0a63('0xf')][_0x0a63('0x34')],_0x1ec505['findBy']));var _0x24e234=this[_0x0a63('0x53')][_0x0a63('0x74')](this,_0x1ec505[_0x0a63('0x155')]);if(_0x24e234){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x158'),this[_0x0a63('0xf')][_0x0a63('0x34')],_0x1ec505[_0x0a63('0x155')]));this[_0x0a63('0xf')]['noop'](util[_0x0a63('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0a63('0xf')][_0x0a63('0x34')],_0x1ec505[_0x0a63('0x155')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x0a63('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0a63('0xf')][_0x0a63('0x34')],_0x1ec505[_0x0a63('0x155')]));this[_0x0a63('0xf')]['noop'](util[_0x0a63('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0a63('0xf')][_0x0a63('0x34')],_0x1ec505['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0a63('0x12')]['math']=function(_0x40e878){logger[_0x0a63('0x28')](util['format'](_0x0a63('0x15d'),_0x40e878['label']));if(!this['isConfigured'](_0x40e878['operation'])){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x40e878,_0x0a63('0x15e'));}this[_0x0a63('0xf')]['noop'](util[_0x0a63('0x56')]('math\x20%s',_0x40e878['operation']));var _0xd69a2e=eval(_0x40e878[_0x0a63('0x15f')]);if(!this[_0x0a63('0x88')](_0x40e878[_0x0a63('0x160')])){return this[_0x0a63('0xf')]['noop'](_0x0a63('0xda'));}var _0x2e54ab=this[_0x0a63('0x13')][_0x0a63('0x74')](this,_0x40e878[_0x0a63('0x160')]);if(!_0x2e54ab){return this['channel'][_0x0a63('0x27')](_0x40e878,_0x0a63('0x11b'));}if(_[_0x0a63('0x9c')](_0xd69a2e)){var _0x1a7fea=this;_0xd69a2e[_0x0a63('0xdc')](function(_0x2815b2,_0x2f9550){_0x1a7fea[_0x0a63('0xf')][_0x0a63('0xa1')](util['format']('%s[%s]',_0x2e54ab,_0x2f9550),_0x2815b2);});return this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x161'),_0x2e54ab));}else{return this[_0x0a63('0xf')]['setVariable'](_0x2e54ab,_0xd69a2e);}};AGIVertices['prototype'][_0x0a63('0xc')]=function(_0x2925c8){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x162'),_0x2925c8[_0x0a63('0x31')]));if(_0x2925c8[_0x0a63('0xab')]===0x0){return this['maxRetry'](_0x2925c8);}_0x2925c8[_0x0a63('0xab')]-=0x1;if(!this[_0x0a63('0x88')](_0x2925c8[_0x0a63('0x113')])){return this[_0x0a63('0xf')]['error'](_0x2925c8,_0x0a63('0x114'));}var _0x439ab9=this['getSound'][_0x0a63('0x74')](this,_0x2925c8[_0x0a63('0x113')]);if(!_0x439ab9){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x2925c8,_0x0a63('0x116'));}var _0x491bb4=this[_0x0a63('0xf')][_0x0a63('0x163')](_0x439ab9,_0x2925c8['response'],_0x2925c8[_0x0a63('0x164')]);var _0x12ecfd=_0x491bb4['result'];if(_0x491bb4[_0x0a63('0xa8')]===-0x1){this[_0x0a63('0x2f')]['sync'](this,_0x2925c8,'-1');return _0x491bb4;}else if(_0x491bb4[_0x0a63('0xa5')]===_0x0a63('0x6a')){_0x491bb4[_0x0a63('0xa8')]=_0x491bb4[_0x0a63('0xa8')][_0x0a63('0x9f')]>0x0?_0x491bb4[_0x0a63('0xa8')]:'t';}else if(_['isEmpty'](_0x491bb4[_0x0a63('0xa8')])){_0x491bb4['result']='#';_0x12ecfd='#';}if(!this[_0x0a63('0x88')](_0x2925c8['variable_id'])){this['channel'][_0x0a63('0xae')](_0x0a63('0xda'));}else{var _0xd7617f=this[_0x0a63('0x13')][_0x0a63('0x74')](this,_0x2925c8[_0x0a63('0x160')]);if(!_0xd7617f){return this[_0x0a63('0xf')]['error'](_0x2925c8,_0x0a63('0x11b'));}this['channel']['setVariable'](_0xd7617f,_0x12ecfd);}this[_0x0a63('0x2f')][_0x0a63('0x74')](this,_0x2925c8,_0x12ecfd);return _0x491bb4;};AGIVertices[_0x0a63('0x12')][_0x0a63('0xae')]=function(_0x2c4c91){logger[_0x0a63('0x28')](util['format'](_0x0a63('0x165'),_0x2c4c91['label']));return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x2c4c91['output']||_0x2c4c91[_0x0a63('0x31')]);};AGIVertices[_0x0a63('0x12')][_0x0a63('0x166')]=function(_0x1e2c14){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x167'),_0x1e2c14[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x1e2c14[_0x0a63('0x155')])){return this['channel'][_0x0a63('0x27')](_0x1e2c14,_0x0a63('0x156'));}logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x157'),this[_0x0a63('0xf')][_0x0a63('0x34')],_0x1e2c14['findBy']));var _0x3ef5b1=this[_0x0a63('0x4e')]['sync'](this,_0x1e2c14[_0x0a63('0x168')]);var _0x38c225=this['agentPause'][_0x0a63('0x74')](this,_0x1e2c14[_0x0a63('0x155')],_0x3ef5b1);if(_0x38c225){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x158'),this[_0x0a63('0xf')][_0x0a63('0x34')],_0x1e2c14[_0x0a63('0x155')]));this['channel']['noop'](util['format'](_0x0a63('0x158'),this[_0x0a63('0xf')][_0x0a63('0x34')],_0x1e2c14[_0x0a63('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x159'),this[_0x0a63('0xf')]['callerid'],_0x1e2c14[_0x0a63('0x155')]));this['channel'][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x158'),this[_0x0a63('0xf')][_0x0a63('0x34')],_0x1e2c14['findBy']));return{'code':0xc8,'result':_0x0a63('0x15a')};}};AGIVertices[_0x0a63('0x12')][_0x0a63('0x169')]=function(_0x3f1702){logger['info'](util['format'](_0x0a63('0x16a'),_0x3f1702[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x3f1702[_0x0a63('0x113')])){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x3f1702,_0x0a63('0x114'));}var _0x654712=this[_0x0a63('0x115')][_0x0a63('0x74')](this,_0x3f1702[_0x0a63('0x113')]);if(!_0x654712){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x3f1702,_0x0a63('0x116'));}var _0x2c8bce=this['channel'][_0x0a63('0x59')](_0x0a63('0x16b'),[_0x654712,_0x3f1702[_0x0a63('0xe5')]]);if(_0x2c8bce[_0x0a63('0xa8')]===-0x1){return _0x2c8bce;}return this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0xc5'),'PLAYBACK',_0x654712));};AGIVertices[_0x0a63('0x12')][_0x0a63('0x16c')]=function(_0x4802af){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x16d'),_0x4802af['label']));if(!this['isConfigured'](_0x4802af[_0x0a63('0x16e')])){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x4802af,_0x0a63('0x16f'));}var _0x4c4e8c='';var _0x412938=parseInt(_0x4802af[_0x0a63('0x16e')],0xa);if(isNaN(_0x412938)){_0x4c4e8c=_0x4802af[_0x0a63('0x16e')];}else{_0x4c4e8c=this['getVoiceQueue'][_0x0a63('0x74')](this,_0x4802af[_0x0a63('0x16e')]);if(!_0x4c4e8c){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x4802af,_0x0a63('0x170'));}}var _0x2e1b03='';if(this[_0x0a63('0x88')](_0x4802af[_0x0a63('0x113')])){var _0x5a4b2b=this['getSound']['sync'](this,_0x4802af[_0x0a63('0x113')]);if(_0x5a4b2b){_0x2e1b03=_0x5a4b2b;}}this[_0x0a63('0x2f')]['sync'](this,_0x4802af,_0x4c4e8c);if(_0x4802af[_0x0a63('0xe5')]['indexOf']('x')<0x0){_0x4802af[_0x0a63('0xe5')]+='x';}if(_0x4802af['opts']['indexOf']('X')<0x0){_0x4802af['opts']+='X';}this[_0x0a63('0xf')][_0x0a63('0xa1')]('XMCS-QUEUE',_0x4c4e8c?_0x4c4e8c[_0x0a63('0x171')]():'');var _0x116408=this[_0x0a63('0xf')]['exec'](_0x0a63('0x172'),[_0x4c4e8c,_0x4802af[_0x0a63('0xe5')],_0x4802af[_0x0a63('0x68')],_0x2e1b03,_0x4802af['timeout'],_0x4802af[_0x0a63('0x6')],_0x4802af[_0x0a63('0x173')],_0x4802af[_0x0a63('0x174')],'',_0x4802af[_0x0a63('0x175')]]);if(_0x116408[_0x0a63('0xa8')]===-0x1){return _0x116408;}return this[_0x0a63('0xf')][_0x0a63('0xae')](util['format'](_0x0a63('0xc5'),'QUEUE',_0x4c4e8c));};AGIVertices[_0x0a63('0x12')]['record']=function(_0x628400){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x176'),_0x628400[_0x0a63('0x31')]));var _0x467064=_0x628400[_0x0a63('0x177')]||_0x0a63('0x133');var _0x5a0990=util[_0x0a63('0x56')]('%s_%s',this[_0x0a63('0xf')][_0x0a63('0x30')],rs[_0x0a63('0x11d')](0x5));var _0x2c9ed5=util[_0x0a63('0x56')](_0x0a63('0x178'),FILES_PATH,_0x5a0990,_0x467064);var _0x502698=util[_0x0a63('0x56')](_0x0a63('0x134'),FILES_PATH,_0x5a0990);this[_0x0a63('0x35')][_0x0a63('0x74')](this,_0x628400,_0x5a0990,_0x2c9ed5);this[_0x0a63('0xf')]['setVariable']('RECORDING_SAVENAME',_0x5a0990);logger[_0x0a63('0x28')](_0x0a63('0x179'),_0x502698,_0x467064,_0x628400['escape_digits'],_0x628400[_0x0a63('0x6a')]);return this['channel'][_0x0a63('0x136')](_0x502698,_0x467064,_0x628400[_0x0a63('0x17a')],_0x628400[_0x0a63('0x6a')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x41e886){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x17b'),_0x41e886[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x41e886[_0x0a63('0x68')])){return this[_0x0a63('0xf')][_0x0a63('0xae')]('no\x20url\x20configured');}var _0x41e01a=this[_0x0a63('0x67')][_0x0a63('0x74')](this,_0x41e886);logger[_0x0a63('0x28')](util['format'](_0x0a63('0x17c'),util[_0x0a63('0x17d')](_0x41e01a,{'showHidden':![],'depth':null})));if(!this[_0x0a63('0x88')](_0x41e886[_0x0a63('0x160')])){return this['channel']['noop'](_0x0a63('0x17e'));}var _0x1c2aaf=this[_0x0a63('0x13')][_0x0a63('0x74')](this,_0x41e886[_0x0a63('0x160')]);if(!_0x1c2aaf){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x41e886,_0x0a63('0x11b'));}this['channel']['setVariable'](util[_0x0a63('0x56')](_0x0a63('0x17f'),_0x1c2aaf),_0x41e01a['statusCode']?_0x41e01a['statusCode']:_0x0a63('0x180'));this[_0x0a63('0xf')][_0x0a63('0xa1')](util[_0x0a63('0x56')](_0x0a63('0x181'),_0x1c2aaf),_0x41e01a[_0x0a63('0x7b')]?_0x41e01a[_0x0a63('0x7b')]:'OK');if(_0x41e01a['body']){try{this[_0x0a63('0x9e')](_0x41e01a[_0x0a63('0x6f')],_0x1c2aaf);}catch(_0xedf8d8){logger[_0x0a63('0x27')](util[_0x0a63('0x56')](_0x0a63('0x182'),_0x1c2aaf));}}return this[_0x0a63('0xf')]['noop'](util['format'](_0x0a63('0x183'),_0x1c2aaf));};AGIVertices[_0x0a63('0x12')]['saydigits']=function(_0xd6f445){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x184'),_0xd6f445[_0x0a63('0x31')]));return this[_0x0a63('0xf')][_0x0a63('0x185')](_0xd6f445['digits'][_0x0a63('0x5b')](/\s+/g,''),_0xd6f445[_0x0a63('0x17a')]);};AGIVertices[_0x0a63('0x12')][_0x0a63('0x186')]=function(_0x332634){logger[_0x0a63('0x28')](util['format'](_0x0a63('0x187'),_0x332634[_0x0a63('0x31')]));return this[_0x0a63('0xf')]['sayNumber'](_0x332634[_0x0a63('0x6b')][_0x0a63('0x5b')](/\s+/g,''),_0x332634[_0x0a63('0x17a')]);};AGIVertices['prototype']['sayphonetic']=function(_0x56a313){logger[_0x0a63('0x28')](util[_0x0a63('0x56')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x56a313[_0x0a63('0x31')]));return this[_0x0a63('0xf')][_0x0a63('0x188')](_0x56a313[_0x0a63('0x65')],_0x56a313['escape_digits']);};AGIVertices['prototype'][_0x0a63('0x189')]=function(_0x77ba4e){logger[_0x0a63('0x28')](util['format'](_0x0a63('0x18a'),_0x77ba4e[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x77ba4e[_0x0a63('0x18b')])){return this[_0x0a63('0xf')]['noop'](_0x0a63('0x18c'));}var _0x2f30e0=this[_0x0a63('0x18d')][_0x0a63('0x74')](this,_0x77ba4e['account_id']);if(!_0x2f30e0||!_0x2f30e0[_0x0a63('0x18e')]){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x77ba4e,_0x0a63('0x18f'));}var _0x345449={'from':util[_0x0a63('0x56')](_0x0a63('0x190'),_0x2f30e0['name'],_0x2f30e0[_0x0a63('0x191')]||_0x2f30e0['Smtp'][_0x0a63('0x192')]),'to':_0x77ba4e['to']||'','cc':_0x77ba4e['cc']||'','bcc':_0x77ba4e[_0x0a63('0x193')]||'','subject':_0x77ba4e[_0x0a63('0x194')],'html':_0x77ba4e['text'],'text':_0x77ba4e[_0x0a63('0x65')]};var _0x3048a8={'tls':{'rejectUnauthorized':![]}};if(_0x2f30e0['Smtp'][_0x0a63('0x195')]){_0x3048a8[_0x0a63('0x195')]=_0x2f30e0[_0x0a63('0x18e')][_0x0a63('0x195')];}else{_0x3048a8[_0x0a63('0x196')]=_0x2f30e0['Smtp'][_0x0a63('0x196')];_0x3048a8['port']=_0x2f30e0[_0x0a63('0x18e')]['port'];_0x3048a8[_0x0a63('0x197')]=_0x2f30e0['Smtp'][_0x0a63('0x197')];}if(_0x2f30e0[_0x0a63('0x18e')]['authentication']){_0x3048a8['auth']={'user':_0x2f30e0['Smtp'][_0x0a63('0x192')],'pass':_0x2f30e0[_0x0a63('0x18e')]['pass']};}if(this[_0x0a63('0x88')](_0x77ba4e[_0x0a63('0x198')])){}logger[_0x0a63('0x199')](_0x0a63('0x19a'),JSON[_0x0a63('0x78')](_0x345449));this[_0x0a63('0x2f')][_0x0a63('0x74')](this,_0x77ba4e,_0x77ba4e[_0x0a63('0x18b')]);this[_0x0a63('0xf')][_0x0a63('0xae')](util['format'](_0x0a63('0x19b'),_0x2f30e0['name']));this[_0x0a63('0x21')][_0x0a63('0x74')](this,_0x3048a8,_0x345449);return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0x19c'));};AGIVertices[_0x0a63('0x12')][_0x0a63('0x19d')]=function(_0x50bc61){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x19e'),_0x50bc61[_0x0a63('0x31')]));return this[_0x0a63('0xf')][_0x0a63('0xae')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x0a63('0x12')]['sendSMS']=function(_0x29d943){logger[_0x0a63('0x28')](util[_0x0a63('0x56')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x29d943[_0x0a63('0x31')]));if(!this['isConfigured'](_0x29d943['sms_account_id'])){return this[_0x0a63('0xf')]['noop']('no\x20sms\x20account\x20configured');}var _0x42f4bb=this['getSmsAccount']['sync'](this,_0x29d943[_0x0a63('0x19f')]);if(!_0x42f4bb){return this[_0x0a63('0xf')]['error'](_0x29d943,_0x0a63('0x1a0'));}var _0x159a67={'body':_0x29d943['sms_text'],'phone':_0x29d943['to']||'','SmsAccountId':_0x42f4bb['id']};logger[_0x0a63('0x199')](_0x0a63('0x1a1'),JSON[_0x0a63('0x78')](_0x159a67));this[_0x0a63('0x2f')]['sync'](this,_0x29d943,_0x29d943[_0x0a63('0x19f')]);this[_0x0a63('0xf')][_0x0a63('0xae')](util['format'](_0x0a63('0x1a2'),_0x42f4bb[_0x0a63('0x15')]));this['createSmsMessage'][_0x0a63('0x74')](this,_0x159a67);return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0x1a3'));};AGIVertices[_0x0a63('0x12')][_0x0a63('0x1a4')]=function(_0xff9e27){logger[_0x0a63('0x28')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0xff9e27[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0xff9e27[_0x0a63('0x160')])){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0xff9e27,_0x0a63('0x1a5'));}var _0xab5c59=this[_0x0a63('0x13')][_0x0a63('0x74')](this,_0xff9e27[_0x0a63('0x160')]);if(!_0xab5c59){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0xff9e27,_0x0a63('0x11b'));}return this['channel'][_0x0a63('0xa1')](_0xab5c59,_0xff9e27[_0x0a63('0x1a6')]);};AGIVertices[_0x0a63('0x12')][_0x0a63('0x1a7')]=function(_0x32238a){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x1a8'),_0x32238a['label']));this[_0x0a63('0xf')][_0x0a63('0xae')]('START\x20CALLY\x20SQUARE');if(_0x32238a[_0x0a63('0xbc')]===_0x0a63('0x1a9')){this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0x1aa'));return this[_0x0a63('0xf')][_0x0a63('0xbc')]();}return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0x1ab'));};AGIVertices['prototype'][_0x0a63('0x1ac')]=function(_0x194283){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x1ad'),_0x194283[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x194283[_0x0a63('0x1ae')])){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x194283,_0x0a63('0x1af'));}var _0x271675=this['getSquareProject'][_0x0a63('0x74')](this,_0x194283[_0x0a63('0x1ae')]);if(!this['isConfigured'](_0x271675)){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x194283,util[_0x0a63('0x56')](_0x0a63('0x1b0'),_0x194283['project_id']));}if(_0x271675===this['channel'][_0x0a63('0x33')]){return this['channel']['error'](_0x194283,_0x0a63('0x1b1'));}this[_0x0a63('0x2f')][_0x0a63('0x74')](this,_0x194283,_0x271675);var _0x55af91=this[_0x0a63('0xf')][_0x0a63('0x59')](_0x0a63('0x1b2'),util[_0x0a63('0x56')](_0x0a63('0x1b3'),config[_0x0a63('0x6')][_0x0a63('0x196')]||_0x0a63('0x1b4'),_0x271675,this[_0x0a63('0xf')][_0x0a63('0x33')]));if(_0x55af91[_0x0a63('0xa8')]===-0x1){return _0x55af91;}return this[_0x0a63('0xf')]['noop'](util[_0x0a63('0x56')](_0x0a63('0xc5'),_0x0a63('0x1b2'),_0x271675));};AGIVertices['prototype'][_0x0a63('0x1b5')]=function(_0x252d47){logger[_0x0a63('0x28')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x252d47[_0x0a63('0x31')]));var _0xfb5d7c=this[_0x0a63('0x58')]['sync'](this,_0x252d47[_0x0a63('0xba')]);this[_0x0a63('0x2f')][_0x0a63('0x74')](this,_0x252d47,_0x252d47[_0x0a63('0xba')]);if(this[_0x0a63('0x88')](_0x252d47[_0x0a63('0x160')])){var _0x2018e9=this[_0x0a63('0x13')][_0x0a63('0x74')](this,_0x252d47[_0x0a63('0x160')]);if(_0x2018e9){this[_0x0a63('0xf')][_0x0a63('0xa1')](_0x2018e9,_0xfb5d7c);return this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x1b6'),_0x252d47[_0x0a63('0xba')],_0x2018e9));}}return this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x1b7'),_0x252d47['command']));};AGIVertices[_0x0a63('0x12')][_0x0a63('0x1b8')]=function(_0x5837fa){logger['info'](util['format'](_0x0a63('0x1b9'),_0x5837fa['label']));_0x5837fa[_0x0a63('0x65')]=_0x5837fa[_0x0a63('0x65')][_0x0a63('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0a63('0x88')](_0x5837fa['apiKey'])){return this[_0x0a63('0xf')][_0x0a63('0xae')](_0x0a63('0x1ba'));}if(!this[_0x0a63('0x88')](_0x5837fa['text'])){return this[_0x0a63('0xf')][_0x0a63('0xae')]('no\x20text\x20configured');}this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x1bb'),_0x5837fa[_0x0a63('0x65')]));var _0x1d1e90=this[_0x0a63('0x5c')][_0x0a63('0x74')](this,_0x5837fa);if(_0x1d1e90){this['channel'][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x1bc'),_0x1d1e90));var _0x42b4e3=this['channel']['streamFile'](_0x1d1e90);try{fs[_0x0a63('0x103')](_0x1d1e90+_0x0a63('0x104'));}catch(_0x271bcc){logger['error'](_0x271bcc);}return _0x42b4e3;}return this[_0x0a63('0xf')]['error'](_0x5837fa,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x0a63('0x12')][_0x0a63('0x1bd')]=function(_0x3d3804){logger[_0x0a63('0x28')](util[_0x0a63('0x56')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x3d3804['label']));_0x3d3804[_0x0a63('0x65')]=_0x3d3804[_0x0a63('0x65')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0a63('0x88')](_0x3d3804[_0x0a63('0x65')])){return this[_0x0a63('0xf')]['noop'](_0x0a63('0xaf'));}this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x1be'),_0x3d3804[_0x0a63('0x65')]));var _0x377cfd=this[_0x0a63('0x64')][_0x0a63('0x74')](this,_0x3d3804);if(_0x377cfd){this[_0x0a63('0xf')][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x1bf'),_0x377cfd));var _0x3d90f4=this[_0x0a63('0xf')][_0x0a63('0x102')](_0x377cfd);try{fs[_0x0a63('0x103')](_0x377cfd+'.wav');}catch(_0x35d892){logger[_0x0a63('0x27')](_0x35d892);}return _0x3d90f4;}return this['channel']['error'](_0x3d3804,_0x0a63('0x1c0'));};AGIVertices[_0x0a63('0x12')]['unpause']=function(_0x19ea41){logger[_0x0a63('0x28')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x19ea41[_0x0a63('0x31')]));if(!this[_0x0a63('0x88')](_0x19ea41[_0x0a63('0x155')])){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x19ea41,'no\x20find\x20by\x20configured');}logger['info'](util[_0x0a63('0x56')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x0a63('0xf')][_0x0a63('0x34')],_0x19ea41['findBy']));var _0x3a7cf2=this[_0x0a63('0x51')]['sync'](this,_0x19ea41[_0x0a63('0x155')]);if(_0x3a7cf2){logger[_0x0a63('0x28')](util[_0x0a63('0x56')](_0x0a63('0x158'),this[_0x0a63('0xf')][_0x0a63('0x34')],_0x19ea41['findBy']));this['channel']['noop'](util[_0x0a63('0x56')](_0x0a63('0x158'),this[_0x0a63('0xf')]['callerid'],_0x19ea41[_0x0a63('0x155')]));return{'code':0xc8,'result':_0x0a63('0x1c1')};}else{logger[_0x0a63('0x28')](util['format'](_0x0a63('0x159'),this[_0x0a63('0xf')][_0x0a63('0x34')],_0x19ea41['findBy']));this['channel'][_0x0a63('0xae')](util[_0x0a63('0x56')](_0x0a63('0x159'),this[_0x0a63('0xf')][_0x0a63('0x34')],_0x19ea41[_0x0a63('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['voicemail']=function(_0x3e4734){logger[_0x0a63('0x28')](util[_0x0a63('0x56')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x3e4734[_0x0a63('0x31')]));var _0xf71d86=this[_0x0a63('0xf')][_0x0a63('0x59')](_0x0a63('0x1c2'),[_0x3e4734['mailbox'],_0x3e4734[_0x0a63('0x7d')]]);if(_0xf71d86['result']===-0x1){return _0xf71d86;}return this[_0x0a63('0xf')]['noop'](util[_0x0a63('0x56')](_0x0a63('0xc5'),_0x0a63('0x1c2'),_0x3e4734[_0x0a63('0x1c3')]));};AGIVertices[_0x0a63('0x12')][_0x0a63('0x1c4')]=function(_0x1b0bac){logger['info'](util[_0x0a63('0x56')](_0x0a63('0x1c5'),_0x1b0bac['label']));if(!this[_0x0a63('0x88')](_0x1b0bac[_0x0a63('0x160')])){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x1b0bac,'no\x20variable\x20selected');}var _0x5a2209=this[_0x0a63('0x13')][_0x0a63('0x74')](this,_0x1b0bac[_0x0a63('0x160')]);if(!_0x5a2209){return this[_0x0a63('0xf')][_0x0a63('0x27')](_0x1b0bac,_0x0a63('0x11b'));}var _0x201f28=this[_0x0a63('0xf')][_0x0a63('0x13')](_0x5a2209);return{'code':0xc8,'result':_0x201f28[_0x0a63('0xa5')]?_0x201f28[_0x0a63('0xa5')]:'-'};};String[_0x0a63('0x12')][_0x0a63('0xa4')]=function(_0x2c7969,_0x5168d0){return this[_0x0a63('0xa3')](_0x2c7969)[_0x0a63('0x1c6')](_0x5168d0);};module[_0x0a63('0x1c7')]=AGIVertices; \ No newline at end of file +var _0x3561=['no\x20appid\x20configured','appsecret','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','saveRestApiResult','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','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','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','exports','path','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','rpc','prototype','getVariable','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createCmContact','isNil','callback_','random','isEmpty','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','has','dialTimezone','CALLERID(dialTimezone)','phone','timezones','scheduledat','add','insertContact','utcOffset','minutes','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','method','timeout','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','computedVariables','sync','uri','url','headers','stringify','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','%s.%s','setVariable','split','replaceAll','toString','result','info','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','RECOG_CONFIDENCE()','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','SIP/%s','opts','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','createSquareMessage','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','unlink','.wav','aws\x20Polly\x20is\x20unreachable','awslex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid'];(function(_0x1c129a,_0x4824ed){var _0xad881f=function(_0x3607f2){while(--_0x3607f2){_0x1c129a['push'](_0x1c129a['shift']());}};_0xad881f(++_0x4824ed);}(_0x3561,0x94));var _0x1356=function(_0x3f7ce8,_0x2cd0b0){_0x3f7ce8=_0x3f7ce8-0x0;var _0x1bc03d=_0x3561[_0x3f7ce8];return _0x1bc03d;};'use strict';var fs=require('fs');var path=require(_0x1356('0x0'));var util=require('util');var _=require(_0x1356('0x1'));var sh=require(_0x1356('0x2'));var odbc=require(_0x1356('0x3'))();var rs=require(_0x1356('0x4'));var moment=require(_0x1356('0x5'));var Mustache=require(_0x1356('0x6'));var rp=require(_0x1356('0x7'));var logger=require(_0x1356('0x8'))(_0x1356('0x9'));var config=require(_0x1356('0xa'));var shared=require(_0x1356('0xb'));var scripts=require(_0x1356('0xc'));var FILES_PATH=_0x1356('0xd');var recursiveMapAttributes=['rawHeaders',_0x1356('0xe')];var verticesWithRetry=[_0x1356('0xf'),_0x1356('0x10'),'getsecretdigits'];var AGIVertices=function(_0x5e8516,_0x4e1adb,_0x101c23){this['channel']=_0x5e8516;this[_0x1356('0x11')]=_0x4e1adb;this['mailRpc']=_0x101c23;};AGIVertices[_0x1356('0x12')][_0x1356('0x13')]=function(_0x4d3b39,_0x3bbd0c){this[_0x1356('0x11')]['getVariableById'](_0x4d3b39)[_0x1356('0x14')](function(_0x457d18){_0x3bbd0c(null,_0x457d18?_0x457d18[_0x1356('0x15')]:![]);})[_0x1356('0x16')](function(_0x319af1){_0x3bbd0c(_0x319af1);});};AGIVertices[_0x1356('0x12')][_0x1356('0x17')]=function(_0x3c8b32,_0x365fb0){this[_0x1356('0x11')][_0x1356('0x18')](_0x3c8b32)[_0x1356('0x14')](function(_0x58975b){_0x365fb0(null,_0x58975b?_0x58975b['name']:![]);})['catch'](function(_0x61991a){_0x365fb0(_0x61991a);});};AGIVertices[_0x1356('0x12')][_0x1356('0x19')]=function(_0x5cecb2,_0x23a1ef){this[_0x1356('0x11')][_0x1356('0x1a')](_0x5cecb2)[_0x1356('0x14')](function(_0xa115de){_0x23a1ef(null,_0xa115de?_0xa115de[_0x1356('0x15')]:![]);})[_0x1356('0x16')](function(_0x210b85){_0x23a1ef(_0x210b85);});};AGIVertices[_0x1356('0x12')][_0x1356('0x1b')]=function(_0x8ff03f,_0x1cb49e){this[_0x1356('0x11')]['getSquareOdbcById'](_0x8ff03f)[_0x1356('0x14')](function(_0x5b958c){_0x1cb49e(null,_0x5b958c?_0x5b958c[_0x1356('0x1c')]:![]);})['catch'](function(_0x420dd6){_0x1cb49e(_0x420dd6);});};AGIVertices[_0x1356('0x12')][_0x1356('0x1d')]=function(_0x377fe7,_0x10d756){this[_0x1356('0x11')]['getUserById'](_0x377fe7)[_0x1356('0x14')](function(_0x2c26be){_0x10d756(null,_0x2c26be?_0x2c26be['name']:![]);})[_0x1356('0x16')](function(_0x13d30b){_0x10d756(_0x13d30b);});};AGIVertices[_0x1356('0x12')]['getTrunk']=function(_0xc153ed,_0x2a6170){this[_0x1356('0x11')][_0x1356('0x1e')](_0xc153ed)['then'](function(_0x4ce322){_0x2a6170(null,_0x4ce322?_0x4ce322[_0x1356('0x15')]:![]);})['catch'](function(_0x9961c3){_0x2a6170(_0x9961c3);});};AGIVertices[_0x1356('0x12')][_0x1356('0x1f')]=function(_0x3035eb,_0x39796b){var _0x5867d8=this;this[_0x1356('0x11')][_0x1356('0x20')](_0x3035eb)[_0x1356('0x14')](function(_0x261710){_0x39796b(null,_0x261710?_0x5867d8[_0x1356('0x21')](_0x261710[_0x1356('0x22')]):![]);})['catch'](function(_0x3716cf){_0x39796b(_0x3716cf);});};AGIVertices['prototype'][_0x1356('0x23')]=function(_0x5d3980,_0x5d3a34){this[_0x1356('0x11')][_0x1356('0x24')](_0x5d3980)['then'](function(_0x38dac3){_0x5d3a34(null,_0x38dac3?_0x38dac3:![]);})[_0x1356('0x16')](function(_0x307c88){_0x5d3a34(_0x307c88);});};AGIVertices[_0x1356('0x12')][_0x1356('0x25')]=function(_0x183bfd,_0x12128f,_0x5150a0){this[_0x1356('0x26')][_0x1356('0x25')](_0x183bfd,_0x12128f)[_0x1356('0x14')](function(){_0x5150a0(null);})[_0x1356('0x16')](function(_0x4f1c53){_0x5150a0(_0x4f1c53);});};AGIVertices[_0x1356('0x12')][_0x1356('0x27')]=function(_0x21036e,_0x270515){this[_0x1356('0x11')]['getIntervalById'](_0x21036e)[_0x1356('0x14')](function(_0x52053d){if(_0x52053d){if(_0x52053d[_0x1356('0x28')]){_0x270515(null,[_0x52053d[_0x1356('0x29')]]);}else{_0x270515(null,_[_0x1356('0x2a')](_0x52053d[_0x1356('0x2b')],_0x1356('0x29')));}}else{_0x270515(null,![]);}})[_0x1356('0x16')](function(_0xf2f808){_0x270515(_0xf2f808);});};AGIVertices['prototype'][_0x1356('0x21')]=function(_0x1d206d){return util[_0x1356('0x2c')](_0x1356('0x2d'),FILES_PATH,_0x1d206d);};AGIVertices['prototype'][_0x1356('0x2e')]=function(_0x523990,_0x464c66,_0x5c1eac){odbc[_0x1356('0x2f')](_0x523990,function(_0x37925c){if(_0x37925c){logger['error'](_0x1356('0x30'),_0x37925c);_0x5c1eac(_0x37925c);}else{logger['info'](_0x1356('0x31'));odbc[_0x1356('0x32')](_0x464c66,function(_0x28919e,_0x433e70){if(_0x28919e){logger['info'](_0x1356('0x33'),_0x464c66);_0x5c1eac(_0x28919e);}else{logger['info'](_0x1356('0x34'),_0x464c66);odbc[_0x1356('0x35')](function(_0x1668d2){if(_0x1668d2){logger[_0x1356('0x36')](_0x1356('0x37'),_0x1668d2);}_0x5c1eac(null,_0x433e70);});}});}});};AGIVertices[_0x1356('0x12')][_0x1356('0x38')]=function(_0x18b741,_0x13d04f){this[_0x1356('0x11')][_0x1356('0x39')](_0x18b741)[_0x1356('0x14')](function(_0x467c11){_0x13d04f(null,_0x467c11?_0x467c11:![]);})[_0x1356('0x16')](function(_0x50fa0a){_0x13d04f(_0x50fa0a);});};AGIVertices[_0x1356('0x12')][_0x1356('0x3a')]=function(_0xa65ce2,_0x36ee6a){this[_0x1356('0x11')][_0x1356('0x3a')](_0xa65ce2)[_0x1356('0x14')](function(_0x12ffe9){_0x36ee6a(null,_0x12ffe9);})['catch'](function(_0x594dbd){_0x36ee6a(_0x594dbd);});};AGIVertices[_0x1356('0x12')][_0x1356('0x3b')]=function(_0x55b399,_0x278d7f,_0x3615b9){this[_0x1356('0x11')][_0x1356('0x3b')]({'uniqueid':this[_0x1356('0x3c')][_0x1356('0x3d')],'node':_0x55b399[_0x1356('0x3e')],'application':_0x55b399[_0x1356('0x3f')],'data':_0x278d7f||null,'project_name':this['channel'][_0x1356('0x40')],'callerid':this['channel'][_0x1356('0x41')]})[_0x1356('0x14')](function(_0x43def4){if(_0x3615b9){_0x3615b9(null,_0x43def4);}})[_0x1356('0x16')](function(_0x443d49){if(_0x3615b9){_0x3615b9(_0x443d49);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x3338f1,_0x186908,_0x416708,_0x28fbcf){this[_0x1356('0x11')][_0x1356('0x42')]({'uniqueid':this['channel'][_0x1356('0x3d')],'callerid':this['channel']['callerid'],'calleridname':this[_0x1356('0x3c')][_0x1356('0x43')],'context':this[_0x1356('0x3c')][_0x1356('0x44')],'extension':this['channel'][_0x1356('0x45')],'priority':this[_0x1356('0x3c')][_0x1356('0x46')],'accountcode':this[_0x1356('0x3c')]['accountcode'],'dnid':this['channel'][_0x1356('0x47')],'projectName':this[_0x1356('0x3c')][_0x1356('0x40')],'saveName':_0x186908,'filename':_0x3338f1[_0x1356('0x48')]||_0x186908,'savePath':_0x416708})[_0x1356('0x14')](function(_0x97ebd9){_0x28fbcf(null,_0x97ebd9);})['catch'](function(_0x3ad474){_0x28fbcf(_0x3ad474);});};AGIVertices[_0x1356('0x12')]['createSquareMessage']=function(_0xbe30af,_0xcf7e3a,_0x234bba,_0x2d3641,_0x578dbf){this['rpc']['createSquareMessage']({'uniqueid':this[_0x1356('0x3c')]['uniqueid'],'body':_0xbe30af,'direction':_0xcf7e3a,'providerName':_0x234bba,'providerResponse':_0x2d3641})[_0x1356('0x14')](function(_0x21ce0e){if(_0x578dbf){_0x578dbf(null,_0x21ce0e);}})[_0x1356('0x16')](function(_0x479756){if(_0x578dbf){_0x578dbf(_0x479756);}});};AGIVertices[_0x1356('0x12')][_0x1356('0x49')]=function(_0x1cf6d5,_0x16fe6c){var _0x3198d5=this;var _0x5e2af3=0x0;var _0x570f7b={'firstName':_['isEmpty'](_0x1cf6d5[_0x1356('0x15')])||_[_0x1356('0x4a')](_0x1cf6d5[_0x1356('0x15')])?_0x1356('0x4b')+Math[_0x1356('0x4c')]():_0x1cf6d5[_0x1356('0x15')],'lastName':_[_0x1356('0x4d')](_0x1cf6d5['lastName'])||_[_0x1356('0x4a')](_0x1cf6d5[_0x1356('0x4e')])?null:_0x1cf6d5['lastName'],'phone':_0x1cf6d5['phone'],'ListId':_0x1cf6d5[_0x1356('0x4f')],'scheduledat':_0x1cf6d5[_0x1356('0x50')],'callbackUniqueid':this[_0x1356('0x3c')][_0x1356('0x3d')],'tags':_0x1356('0x51'),'description':_0x1356('0x52')+_0x1cf6d5[_0x1356('0x50')]['toString'](),'priority':_0x1cf6d5['callback_priority']};if(_[_0x1356('0x53')](_0x1cf6d5,_0x1356('0x54'))){if(!_[_0x1356('0x4a')](_0x1cf6d5[_0x1356('0x54')])){var _0x4e26a1=_0x1cf6d5[_0x1356('0x54')];if(_0x1cf6d5[_0x1356('0x54')]==_0x1356('0x55')){this[_0x1356('0x11')]['getContactByPhone']({'phone':_0x1cf6d5[_0x1356('0x56')]})['then'](function(_0x79bd86){if(!_[_0x1356('0x4a')](_0x79bd86)){var _0x2da393=_0x79bd86[_0x1356('0x54')];if(!_[_0x1356('0x4a')](_0x2da393)){var _0x33dc4f=shared[_0x1356('0x57')][_0x2da393];if(!_[_0x1356('0x4a')](_0x33dc4f)){var _0x280124=-0x1*_0x33dc4f['utcOffset'];_0x570f7b[_0x1356('0x58')]=moment(_0x1cf6d5[_0x1356('0x58')])[_0x1356('0x59')](_0x280124,'minutes');_0x3198d5[_0x1356('0x5a')](_0x570f7b,_0x1cf6d5,_0x16fe6c);}else{_0x3198d5[_0x1356('0x5a')](_0x570f7b,_0x1cf6d5,_0x16fe6c);}}else{_0x3198d5[_0x1356('0x5a')](_0x570f7b,_0x1cf6d5,_0x16fe6c);}}else{_0x3198d5[_0x1356('0x5a')](_0x570f7b,_0x1cf6d5,_0x16fe6c);}});}else{var _0x5e2af3=shared[_0x1356('0x57')][_0x4e26a1];if(!_[_0x1356('0x4a')](_0x5e2af3)){var _0x2c52aa=-0x1*_0x5e2af3[_0x1356('0x5b')];_0x570f7b[_0x1356('0x58')]=moment(_0x1cf6d5[_0x1356('0x58')])[_0x1356('0x59')](_0x2c52aa,_0x1356('0x5c'));_0x3198d5['insertContact'](_0x570f7b,_0x1cf6d5,_0x16fe6c);}else{_0x3198d5['insertContact'](_0x570f7b,_0x1cf6d5,_0x16fe6c);}}}else{_0x3198d5[_0x1356('0x5a')](_0x570f7b,_0x1cf6d5,_0x16fe6c);}}else{_0x3198d5['insertContact'](_0x570f7b,_0x1cf6d5,_0x16fe6c);}};AGIVertices[_0x1356('0x12')]['getPause']=function(_0x27cf2e,_0x568c45){this['rpc'][_0x1356('0x5d')](_0x27cf2e)[_0x1356('0x14')](function(_0x1d7392){_0x568c45(null,_0x1d7392?_0x1d7392[_0x1356('0x15')]:![]);})[_0x1356('0x16')](function(_0xe13b17){_0x568c45(_0xe13b17);});};AGIVertices[_0x1356('0x12')][_0x1356('0x5e')]=function(_0x594792,_0x2f365e,_0x1b9468){var _0x292a02={'role':_0x1356('0x5f')};_0x292a02[_0x594792]=this[_0x1356('0x3c')][_0x1356('0x41')];this['rpc'][_0x1356('0x5e')](_0x292a02,_0x2f365e,this[_0x1356('0x3c')]['uniqueid'])[_0x1356('0x14')](function(_0x19548a){_0x1b9468(null,_['isNil'](_0x19548a)?![]:!![]);})[_0x1356('0x16')](function(_0x5b8464){logger[_0x1356('0x36')](_0x5b8464);_0x1b9468(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x2e6c61,_0x57554b){var _0x12306b={'role':'agent'};_0x12306b[_0x2e6c61]=this['channel'][_0x1356('0x41')];this[_0x1356('0x11')][_0x1356('0x60')](_0x12306b)[_0x1356('0x14')](function(_0x127ea1){_0x57554b(null,_[_0x1356('0x4a')](_0x127ea1)?![]:!![]);})[_0x1356('0x16')](function(_0x4e4271){logger[_0x1356('0x36')](_0x4e4271);_0x57554b(null,![]);});};AGIVertices[_0x1356('0x12')][_0x1356('0x61')]=function(_0x219695,_0x2071fa){var _0x1ef6e9={'role':_0x1356('0x5f')};_0x1ef6e9[_0x219695]=this['channel'][_0x1356('0x41')];this[_0x1356('0x11')][_0x1356('0x61')](_0x1ef6e9)[_0x1356('0x14')](function(_0x667135){_0x2071fa(null,_[_0x1356('0x4a')](_0x667135)?![]:!![]);})['catch'](function(_0x570652){logger[_0x1356('0x36')](_0x570652);_0x2071fa(null,![]);});};AGIVertices[_0x1356('0x12')][_0x1356('0x62')]=function(_0x2e8c5a,_0x1f8aab){var _0x4b4601={'role':_0x1356('0x5f')};_0x4b4601[_0x2e8c5a]=this[_0x1356('0x3c')][_0x1356('0x41')];var _0x4f7b0f=_0x2e8c5a!='internal'?util[_0x1356('0x2c')](_0x1356('0x63'),_0x1356('0x64'),this['channel'][_0x1356('0x41')]):undefined;this[_0x1356('0x11')]['agentLogin'](_0x4b4601,_0x4f7b0f)[_0x1356('0x14')](function(_0x18f7dc){_0x1f8aab(null,_['isNil'](_0x18f7dc)?![]:!![]);})['catch'](function(_0x2215b9){logger[_0x1356('0x36')](_0x2215b9);_0x1f8aab(null,![]);});};AGIVertices[_0x1356('0x12')]['shellCommand']=function(_0x5bf6e6,_0x45ed2b){sh['exec'](_['trim'](_0x5bf6e6),function(_0x5efafe,_0x20583c){var _0x3cbb5c=_0x20583c[_0x1356('0x65')](/(\r\n|\n|\r)/gm,'');_0x45ed2b(null,_0x3cbb5c);});};AGIVertices['prototype'][_0x1356('0x66')]=function(_0x5df947,_0x4585d8){scripts['googleCloudTTS'](_0x5df947[_0x1356('0x67')],_0x5df947[_0x1356('0x68')]||_0x1356('0x69'),_0x5df947[_0x1356('0x69')],_0x5df947[_0x1356('0x6a')]||'en-US',_0x5df947[_0x1356('0x6b')]||_0x1356('0x6c'),_0x5df947['audioEncoding']||_0x1356('0x6d'))[_0x1356('0x14')](function(_0x17b673){_0x4585d8(null,_0x17b673);})[_0x1356('0x16')](function(_0x2ed128){_0x4585d8(_0x2ed128);});};AGIVertices[_0x1356('0x12')][_0x1356('0x6e')]=function(_0x82c37f,_0x29ba81){scripts[_0x1356('0x6e')](_0x82c37f[_0x1356('0x69')],_0x82c37f[_0x1356('0x6f')]||'en',0x1)[_0x1356('0x14')](function(_0x59736b){_0x29ba81(null,_0x59736b);})[_0x1356('0x16')](function(_0xad7d26){_0x29ba81(_0xad7d26);});};AGIVertices[_0x1356('0x12')][_0x1356('0x70')]=function(_0x3fad09,_0x38b4df){var _0xad1bf5={'uri':_0x3fad09['url'],'method':_0x3fad09[_0x1356('0x71')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3fad09[_0x1356('0x72')])==='number'&&parseInt(_0x3fad09[_0x1356('0x72')])>=0x1?parseInt(_0x3fad09[_0x1356('0x72')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0x1356('0x73')],_0xad1bf5[_0x1356('0x71')]['toUpperCase']())){try{_0xad1bf5[_0x1356('0x74')]=_0x3fad09['rawBody']?JSON[_0x1356('0x75')](_0x3fad09['rawBody']):{};}catch(_0x14a682){logger[_0x1356('0x36')](_0x1356('0x76'),_0x14a682);}}try{_0xad1bf5['headers']=_0x3fad09[_0x1356('0x77')]?JSON[_0x1356('0x75')](_0x3fad09['rawHeaders']):{};}catch(_0x3922fc){logger[_0x1356('0x36')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3922fc);}if(_0x3fad09[_0x1356('0x78')]){try{var _0x262823=require(_0x3fad09[_0x1356('0x78')])[_0x1356('0x79')](this,_0xad1bf5);_0xad1bf5[_0x1356('0x7a')]=Mustache['render'](_0x3fad09[_0x1356('0x7b')],_0x262823,{},['$$','$$']);if(_0xad1bf5[_0x1356('0x7c')]){_0xad1bf5['headers']=JSON['parse'](Mustache['render'](JSON[_0x1356('0x7d')](_0xad1bf5[_0x1356('0x7c')]),_0x262823,{},['$$','$$']));}if(_0xad1bf5[_0x1356('0x74')]){_0xad1bf5[_0x1356('0x74')]=JSON[_0x1356('0x75')](Mustache[_0x1356('0x7e')](JSON[_0x1356('0x7d')](_0xad1bf5[_0x1356('0x74')]),_0x262823,{},['$$','$$']));}}catch(_0x535b87){logger[_0x1356('0x36')](_0x1356('0x7f'),_0x535b87);}}rp(_0xad1bf5)[_0x1356('0x14')](function(_0x3acf45){var _0x159882={'statusCode':_0x3acf45[_0x1356('0x80')]||0xc8,'statusMessage':_0x3acf45[_0x1356('0x81')]||'OK','headers':_0x3acf45['headers']||{},'body':_0x3acf45[_0x1356('0x74')]||{}};_0x38b4df(null,_0x159882);})[_0x1356('0x16')](function(_0x141d5b){var _0x22ee07={'statusCode':_0x141d5b[_0x1356('0x80')]||0x1f4,'statusMessage':_0x141d5b['message']||_0x1356('0x82'),'headers':_0x141d5b[_0x1356('0x83')]['headers']||{},'body':_0x141d5b[_0x1356('0x83')][_0x1356('0x74')]||{}};_0x38b4df(null,_0x22ee07);});};AGIVertices[_0x1356('0x12')][_0x1356('0x84')]=function(_0x5b35d4,_0x3b38fc){scripts['googleDialogflow'](this[_0x1356('0x3c')]['uniqueid'],_0x5b35d4[_0x1356('0x85')],_0x5b35d4[_0x1356('0x69')],_0x5b35d4['dialogflow_language']||'en')['then'](function(_0x4cea28){_0x3b38fc(null,_0x4cea28);})['catch'](function(_0x5603a9){_0x3b38fc(_0x5603a9);});};AGIVertices[_0x1356('0x12')][_0x1356('0x86')]=function(_0x213178,_0x4cd9a4){scripts['googleDialogflowV2'](this[_0x1356('0x3c')][_0x1356('0x3d')],_0x213178['dialogflowV2_project_id'],_0x213178[_0x1356('0x87')],_0x213178[_0x1356('0x88')],_0x213178[_0x1356('0x69')],_0x213178[_0x1356('0x89')]||'en')[_0x1356('0x14')](function(_0x2e19fb){_0x4cd9a4(null,_0x2e19fb);})[_0x1356('0x16')](function(_0x5d60f6){_0x4cd9a4(_0x5d60f6);});};AGIVertices[_0x1356('0x12')][_0x1356('0x8a')]=function(_0x3d8b85,_0x2fba99){scripts[_0x1356('0x8a')](this[_0x1356('0x3c')],_0x3d8b85)['then'](function(_0x36e4a1){_0x2fba99(null,_0x36e4a1);})['catch'](function(_0x1b266c){_0x2fba99(_0x1b266c);});};AGIVertices[_0x1356('0x12')][_0x1356('0x8b')]=function(_0x417b31,_0x362f10){scripts[_0x1356('0x8b')](_0x417b31[_0x1356('0x85')],_0x417b31[_0x1356('0x69')],_0x417b31[_0x1356('0x8c')]||_0x1356('0x8d'),_0x417b31[_0x1356('0x8e')])[_0x1356('0x14')](function(_0x3854af){_0x362f10(null,_0x3854af);})['catch'](function(_0x497e3a){_0x362f10(_0x497e3a);});};AGIVertices[_0x1356('0x12')][_0x1356('0x8f')]=function(_0x404ee9,_0x1b72f6,_0xbb82bd){scripts['ispeechASR'](_0x1b72f6,_0x404ee9[_0x1356('0x85')],_0x404ee9[_0x1356('0x90')]||_0x1356('0x8d'),this['isConfigured'](_0x404ee9[_0x1356('0x91')])?_0x404ee9[_0x1356('0x91')]:undefined)[_0x1356('0x14')](function(_0x275a25){_0xbb82bd(null,_0x275a25);})[_0x1356('0x16')](function(_0x89bf5){_0xbb82bd(_0x89bf5);});};AGIVertices[_0x1356('0x12')][_0x1356('0x92')]=function(_0x3f1af2,_0x32f681){scripts[_0x1356('0x92')](_0x3f1af2[_0x1356('0x93')],_0x3f1af2[_0x1356('0x94')],_0x3f1af2[_0x1356('0x95')],_0x3f1af2[_0x1356('0x96')]||'Amy',_0x3f1af2[_0x1356('0x69')],_0x3f1af2['aws_text_type']||_0x1356('0x69'))['then'](function(_0x17454d){_0x32f681(null,_0x17454d);})[_0x1356('0x16')](function(_0x431386){_0x32f681(_0x431386);});};AGIVertices[_0x1356('0x12')][_0x1356('0x97')]=function(_0xcd1348,_0x596b79){scripts[_0x1356('0x97')](this[_0x1356('0x3c')][_0x1356('0x3d')],_0xcd1348[_0x1356('0x93')],_0xcd1348['aws_secret_access_key'],_0xcd1348[_0x1356('0x98')],_0xcd1348[_0x1356('0x69')],_0xcd1348[_0x1356('0x99')])['then'](function(_0x6ad53b){_0x596b79(null,_0x6ad53b);})[_0x1356('0x16')](function(_0x3a2f6a){_0x596b79(_0x3a2f6a);});};AGIVertices[_0x1356('0x12')][_0x1356('0x9a')]=function(_0x3c6236,_0x4ca2c2,_0x122202){scripts[_0x1356('0x9a')](_0x4ca2c2,_0x3c6236['key'],_0x3c6236[_0x1356('0x9b')]||_0x1356('0x8d'))['then'](function(_0x2a99fd){_0x122202(null,_0x2a99fd);})[_0x1356('0x16')](function(_0x39c30c){_0x122202(_0x39c30c);});};AGIVertices[_0x1356('0x12')][_0x1356('0x9c')]=function(_0x5b4ed4,_0x32c745,_0x485a91){scripts[_0x1356('0x9c')](_0x32c745,_0x5b4ed4['appid'],_0x5b4ed4['appsecret'],_0x5b4ed4['uri'])[_0x1356('0x14')](function(_0x5a9848){_0x485a91(null,_0x5a9848);})[_0x1356('0x16')](function(_0xfc50c3){_0x485a91(_0xfc50c3);});};AGIVertices[_0x1356('0x12')][_0x1356('0x9d')]=function(_0x4cce92){var _0x457d12=_[_0x1356('0x9e')](verticesWithRetry,_0x4cce92[_0x1356('0x3f')])?_0x4cce92:_[_0x1356('0x9f')](_0x4cce92);for(var _0x4c459e in _0x457d12){if(_0x457d12[_0x1356('0xa0')](_0x4c459e)){if(_0x457d12[_0x4c459e]&&_[_0x1356('0xa1')](_0x457d12[_0x4c459e])){if(_[_0x1356('0x9e')](recursiveMapAttributes,_0x4c459e)){_0x457d12[_0x4c459e]=this[_0x1356('0xa2')](_0x457d12[_0x4c459e]);}else{_0x457d12[_0x4c459e]=this[_0x1356('0xa3')](_0x457d12[_0x4c459e]);}}}}return _0x457d12;};AGIVertices[_0x1356('0x12')]['recursiveNodeIndex']=function(_0x1dea63){for(var _0x42cb3f in _0x1dea63){if(_0x1dea63[_0x1356('0xa0')](_0x42cb3f)){if(_[_0x1356('0xa4')](_0x1dea63[_0x42cb3f])){this[_0x1356('0xa5')](_0x1dea63[_0x42cb3f]);}else if(_[_0x1356('0xa6')](_0x1dea63[_0x42cb3f])){for(var _0x7ff21e=0x0;_0x7ff21e<_0x1dea63[_0x42cb3f][_0x1356('0xa7')];_0x7ff21e++){this['recursiveNodeIndex'](_0x1dea63[_0x42cb3f][_0x7ff21e]);}}else if(_[_0x1356('0xa1')](_0x1dea63[_0x42cb3f])){_0x1dea63[_0x42cb3f]=this[_0x1356('0xa3')](_0x1dea63[_0x42cb3f]);}}}};AGIVertices[_0x1356('0x12')]['saveRestApiResult']=function(_0x5a505d,_0x263672){for(var _0x25ef3f in _0x5a505d){if(_0x5a505d[_0x1356('0xa0')](_0x25ef3f)){if(_['isPlainObject'](_0x5a505d[_0x25ef3f])){if(!_[_0x1356('0x4d')](_0x5a505d[_0x25ef3f])){this['saveRestApiResult'](_0x5a505d[_0x25ef3f],util[_0x1356('0x2c')](_0x1356('0xa8'),_0x263672,_0x25ef3f));}}else if(_[_0x1356('0xa6')](_0x5a505d[_0x25ef3f])){for(var _0x2e14e9=0x0;_0x2e14e9<_0x5a505d[_0x25ef3f][_0x1356('0xa7')];_0x2e14e9++){this['saveRestApiResult'](_0x5a505d[_0x25ef3f][_0x2e14e9],util[_0x1356('0x2c')]('%s.%s',_0x263672,_0x25ef3f+'['+_0x2e14e9+']'));}}else{if(!_[_0x1356('0x4a')](_0x5a505d[_0x25ef3f])){this[_0x1356('0x3c')][_0x1356('0xa9')](util[_0x1356('0x2c')]('%s.%s',_0x263672,_0x25ef3f),_0x5a505d[_0x25ef3f]);}}}}};AGIVertices[_0x1356('0x12')][_0x1356('0xa2')]=function(_0x395e6f){try{var _0x4c6405=JSON[_0x1356('0x75')](_0x395e6f);this[_0x1356('0xa5')](_0x4c6405);return JSON[_0x1356('0x7d')](_0x4c6405);}catch(_0x5c2d9e){return this[_0x1356('0xa3')](_0x395e6f);}};AGIVertices['prototype'][_0x1356('0xa3')]=function(_0x462465){var _0x2f958c=_0x462465[_0x1356('0xaa')]('{');for(var _0x51d234=0x1;_0x51d234<_0x2f958c[_0x1356('0xa7')];_0x51d234+=0x1){var _0x4daee7=_0x2f958c[_0x51d234]['split']('}');if(_0x4daee7['length']>0x1){_0x462465=_0x462465[_0x1356('0xab')]('{'+_0x4daee7[0x0]+'}',this[_0x1356('0x3c')]['getVariable'](_0x4daee7[0x0])['extra']||_0x4daee7[0x0]);}}if(_0x2f958c[_0x1356('0xa7')]===0x1){return _0x462465[_0x1356('0xac')]();}return this[_0x1356('0xa3')](_0x462465);};AGIVertices[_0x1356('0x12')]['getAndSetVariable']=function(_0x458271,_0x12cb88){var _0x47e21a=this[_0x1356('0x3c')][_0x1356('0x13')](_0x458271);if(_0x47e21a[_0x1356('0xad')]===-0x1){return _0x47e21a;}logger[_0x1356('0xae')](util['format'](_0x1356('0xaf'),_0x12cb88,_0x47e21a[_0x1356('0xb0')]));return this[_0x1356('0x3c')][_0x1356('0xa9')](_0x12cb88,_0x47e21a[_0x1356('0xb0')]);};AGIVertices[_0x1356('0x12')]['isConfigured']=function(_0x34da61){return _0x34da61&&_0x34da61!=='0'&&_0x34da61!=='-1'&&_0x34da61!=='';};AGIVertices[_0x1356('0x12')][_0x1356('0xb1')]=function(_0x39a332){this[_0x1356('0x3b')]['sync'](this,_0x39a332,'-');_0x39a332[_0x1356('0xb2')]=_0x39a332['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x1356('0xb3')]=function(_0x5e4d30){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0xb4'),_0x5e4d30[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x5e4d30['text'])){return this[_0x1356('0x3c')][_0x1356('0xb6')](_0x1356('0xb7'));}var _0x14d9ba='\x22'+_0x5e4d30[_0x1356('0x69')]+'\x22';if(this[_0x1356('0xb5')](_0x5e4d30[_0x1356('0x83')])){_0x14d9ba+=','+_0x5e4d30[_0x1356('0x83')];}var _0x46d509=this['channel'][_0x1356('0xb8')](_0x1356('0xb9'),_0x14d9ba);if(_0x46d509[_0x1356('0xad')]===-0x1){return _0x46d509;}return this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0xba'),_0x14d9ba));};AGIVertices[_0x1356('0x12')][_0x1356('0xbb')]=function(_0x444322){logger[_0x1356('0xae')](util['format'](_0x1356('0xbc'),_0x444322[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x444322['grammar'])){return this['channel'][_0x1356('0xb6')](_0x1356('0xbd'));}var _0x5beefd=_0x444322[_0x1356('0xbe')];if(this[_0x1356('0xb5')](_0x444322[_0x1356('0x83')])){_0x5beefd+=','+_0x444322[_0x1356('0x83')];}var _0x5408c1=this[_0x1356('0x3c')][_0x1356('0xb8')]('MRCPRecog',_0x5beefd);if(_0x5408c1[_0x1356('0xad')]===-0x1){return _0x5408c1;}var _0x1329d5=this['getAndSetVariable'](_0x1356('0xbf'),'MRCP_RECOG_CONFIDENCE');if(_0x1329d5[_0x1356('0xad')]===-0x1){return _0x1329d5;}var _0x3e1e93=this[_0x1356('0xc0')](_0x1356('0xc1'),_0x1356('0xc2'));if(_0x3e1e93[_0x1356('0xad')]===-0x1){return _0x3e1e93;}var _0xb4ae0b=this[_0x1356('0xc0')]('RECOG_INSTANCE()',_0x1356('0xc3'));if(_0xb4ae0b[_0x1356('0xad')]===-0x1){return _0xb4ae0b;}return this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5beefd));};AGIVertices['prototype'][_0x1356('0x9')]=function(_0x2eb5d2){logger[_0x1356('0xae')](util[_0x1356('0x2c')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x2eb5d2[_0x1356('0x3e')]));return this[_0x1356('0x3c')][_0x1356('0x9')]([_0x2eb5d2['command'],_0x2eb5d2[_0x1356('0xc4')]]);};AGIVertices[_0x1356('0x12')][_0x1356('0xc5')]=function(_0xa4fbc){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0xc6'),_0xa4fbc[_0x1356('0x3e')]));if(this[_0x1356('0xb5')](_0xa4fbc['timeout'])){logger[_0x1356('0xae')](util['format'](_0x1356('0xc7'),_0xa4fbc[_0x1356('0x72')]));var _0x4deb18=this[_0x1356('0x3c')]['wait'](_0xa4fbc[_0x1356('0x72')]);if(_0x4deb18[_0x1356('0xad')]===-0x1){return _0x4deb18;}}return this[_0x1356('0x3c')][_0x1356('0xc5')]();};AGIVertices[_0x1356('0x12')]['callback']=function(_0x34a668){logger[_0x1356('0xae')](util['format'](_0x1356('0xc8'),_0x34a668[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x34a668['list_id'])){return this[_0x1356('0x3c')]['error'](_0x34a668,_0x1356('0xc9'));}_0x34a668[_0x1356('0x50')]=moment();if(this[_0x1356('0xb5')](_0x34a668[_0x1356('0xca')])){_0x34a668['scheduledAt']=moment()[_0x1356('0x59')](_0x34a668['delay'],_0x1356('0x5c'));}if(!this['isConfigured'](_0x34a668[_0x1356('0xcb')])){_0x34a668['callback_priority']=0x2;}this[_0x1356('0x49')][_0x1356('0x79')](this,_0x34a668);return this['channel']['noop'](util[_0x1356('0x2c')](_0x1356('0xcc'),_0x34a668['phone'],_0x34a668[_0x1356('0x4f')],_0x34a668['scheduledAt']));};AGIVertices[_0x1356('0x12')][_0x1356('0xcd')]=function(_0xf5ca66){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0xce'),_0xf5ca66['label']));var _0x45df74=this[_0x1356('0x3c')][_0x1356('0xb8')](_0xf5ca66[_0x1356('0xcf')],_0xf5ca66[_0x1356('0x83')]);if(_0x45df74[_0x1356('0xad')]===-0x1){return _0x45df74;}return this['channel']['noop'](util[_0x1356('0x2c')]('Executed\x20command\x20%s\x20%s',_0xf5ca66[_0x1356('0xcf')],_0xf5ca66[_0x1356('0x83')]));};AGIVertices[_0x1356('0x12')][_0x1356('0xd0')]=function(_0x561528){logger[_0x1356('0xae')](util['format'](_0x1356('0xd1'),_0x561528['label']));if(!this[_0x1356('0xb5')](_0x561528[_0x1356('0x69')])){return this['channel'][_0x1356('0xb6')]('no\x20text\x20configured');}var _0x173201='\x22'+_0x561528[_0x1356('0x69')]+'\x22';if(this[_0x1356('0xb5')](_0x561528[_0x1356('0x83')])){_0x173201+=','+_0x561528['options'];}var _0x2d215c=this[_0x1356('0x3c')][_0x1356('0xb8')](_0x1356('0xb9'),_0x173201);if(_0x2d215c[_0x1356('0xad')]===-0x1){return _0x2d215c;}return this['channel'][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0xba'),_0x173201));};AGIVertices[_0x1356('0x12')][_0x1356('0xd2')]=function(_0x52b165){logger[_0x1356('0xae')](util[_0x1356('0x2c')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x52b165['label']));if(!this[_0x1356('0xb5')](_0x52b165[_0x1356('0x69')])){return this[_0x1356('0x3c')]['noop'](_0x1356('0xb7'));}var _0x4a66dd='\x22'+_0x52b165[_0x1356('0x69')]+'\x22';if(this['isConfigured'](_0x52b165['options'])){_0x4a66dd+=','+_0x52b165[_0x1356('0x83')];}var _0x3210a9=this[_0x1356('0x3c')][_0x1356('0xb8')](_0x1356('0xb9'),_0x4a66dd);if(_0x3210a9[_0x1356('0xad')]===-0x1){return _0x3210a9;}return this['channel'][_0x1356('0xb6')](util['format'](_0x1356('0xba'),_0x4a66dd));};AGIVertices['prototype'][_0x1356('0xd3')]=function(_0x195026){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0xd4'),_0x195026[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x195026[_0x1356('0xbe')])){return this[_0x1356('0x3c')][_0x1356('0xb6')](_0x1356('0xbd'));}var _0x3051ce=_0x195026[_0x1356('0xbe')];if(this[_0x1356('0xb5')](_0x195026[_0x1356('0x83')])){_0x3051ce+=','+_0x195026['options'];}var _0x43de60=this[_0x1356('0x3c')][_0x1356('0xb8')](_0x1356('0xd5'),_0x3051ce);if(_0x43de60[_0x1356('0xad')]===-0x1){return _0x43de60;}var _0x3e53d9=this[_0x1356('0xc0')](_0x1356('0xbf'),_0x1356('0xd6'));if(_0x3e53d9['result']===-0x1){return _0x3e53d9;}var _0x56f89f=this[_0x1356('0xc0')](_0x1356('0xc1'),_0x1356('0xd7'));if(_0x56f89f[_0x1356('0xad')]===-0x1){return _0x56f89f;}var _0x5978e8=this[_0x1356('0xc0')](_0x1356('0xd8'),_0x1356('0xd9'));if(_0x5978e8['result']===-0x1){return _0x5978e8;}return this[_0x1356('0x3c')][_0x1356('0xb6')](util['format'](_0x1356('0xda'),_0x3051ce));};AGIVertices[_0x1356('0x12')][_0x1356('0xdb')]=function(_0x55c856){logger[_0x1356('0xae')](util[_0x1356('0x2c')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x55c856[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x55c856[_0x1356('0xbe')])){return this[_0x1356('0x3c')]['noop'](_0x1356('0xbd'));}var _0x35fb28=_0x55c856['grammar'];if(this[_0x1356('0xb5')](_0x55c856['options'])){_0x35fb28+=','+_0x55c856[_0x1356('0x83')];}var _0x5887df=this[_0x1356('0x3c')]['exec'](_0x1356('0xd5'),_0x35fb28);if(_0x5887df[_0x1356('0xad')]===-0x1){return _0x5887df;}var _0x494502=this['getAndSetVariable'](_0x1356('0xbf'),_0x1356('0xdc'));if(_0x494502[_0x1356('0xad')]===-0x1){return _0x494502;}var _0x4dd2d6=this[_0x1356('0xc0')](_0x1356('0xc1'),'SESTEK_ASR_TRANSCRIPT');if(_0x4dd2d6[_0x1356('0xad')]===-0x1){return _0x4dd2d6;}var _0x556792=this[_0x1356('0xc0')](_0x1356('0xd8'),'SESTEK_ASR_INSTANCE');if(_0x556792['result']===-0x1){return _0x556792;}return this['channel'][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0xda'),_0x35fb28));};AGIVertices[_0x1356('0x12')][_0x1356('0xdd')]=function(_0x12fb7d){logger[_0x1356('0xae')](util['format'](_0x1356('0xde'),_0x12fb7d[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x12fb7d[_0x1356('0xdf')])){return this['channel'][_0x1356('0x36')](_0x12fb7d,_0x1356('0xe0'));}var _0x3a2532=this[_0x1356('0x1b')]['sync'](this,_0x12fb7d[_0x1356('0xdf')]);if(!_0x3a2532){return this[_0x1356('0x3c')][_0x1356('0x36')](_0x12fb7d,_0x1356('0xe1'));}if(!this[_0x1356('0xb5')](_0x12fb7d['query'])){return this[_0x1356('0x3c')][_0x1356('0x36')](_0x12fb7d,_0x1356('0xe2'));}var _0x229e5b=_0x12fb7d[_0x1356('0x32')][_0x1356('0x65')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x1356('0xb6')](util['format'](_0x1356('0xe3'),_0x229e5b));var _0x49c8ef=this[_0x1356('0x2e')][_0x1356('0x79')](this,_0x3a2532,_0x229e5b);this[_0x1356('0x3b')][_0x1356('0x79')](this,_0x12fb7d,_0x229e5b);if(!this['isConfigured'](_0x12fb7d[_0x1356('0xe4')])){return this[_0x1356('0x3c')]['noop'](_0x1356('0xe5'));}var _0x5748b3=this[_0x1356('0x13')][_0x1356('0x79')](this,_0x12fb7d['variable_id']);if(!_0x5748b3){return this[_0x1356('0x3c')]['error'](_0x12fb7d,_0x1356('0xe6'));}var _0x5035be=this;_0x49c8ef[_0x1356('0xe7')](function(_0x546304,_0xea8631){Object[_0x1356('0xe8')](_0x546304)[_0x1356('0xe7')](function(_0xef6c5c){_0x5035be[_0x1356('0x3c')][_0x1356('0xa9')](util[_0x1356('0x2c')]('%s[%s][%s]',_0x5748b3,_0xea8631,_0xef6c5c),_0x546304[_0xef6c5c]);});});this['channel']['setVariable'](util[_0x1356('0x2c')]('%s_ROWS_COUNT',_0x5748b3),_0x49c8ef[_0x1356('0xa7')]);return this['channel']['noop'](util[_0x1356('0x2c')](_0x1356('0xe9'),_0x5748b3));};AGIVertices[_0x1356('0x12')][_0x1356('0xea')]=function(_0x1c53c6){logger[_0x1356('0xeb')](util[_0x1356('0x2c')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x1c53c6['label']));if(!this['isConfigured'](_0x1c53c6[_0x1356('0xec')])){return this[_0x1356('0x3c')][_0x1356('0x36')](_0x1c53c6,_0x1356('0xed'));}var _0x218999=this[_0x1356('0x1d')][_0x1356('0x79')](this,_0x1c53c6[_0x1356('0xec')]);if(!_0x218999){return this[_0x1356('0x3c')][_0x1356('0x36')](_0x1c53c6,'no\x20user\x20found');}var _0x582463=this['channel'][_0x1356('0xb8')]('DIAL',[util[_0x1356('0x2c')](_0x1356('0xee'),_0x218999),_0x1c53c6['timeout'],_0x1c53c6[_0x1356('0xef')],_0x1c53c6[_0x1356('0x7b')]]);if(_0x582463[_0x1356('0xad')]===-0x1){return _0x582463;}return this['channel'][_0x1356('0xb6')](util['format']('Executed\x20command\x20%s',_0x1356('0xf0')));};AGIVertices[_0x1356('0x12')][_0x1356('0xf1')]=function(_0x7e207e){logger[_0x1356('0xae')](util['format'](_0x1356('0xf2'),_0x7e207e[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x7e207e['key'])){return this[_0x1356('0x3c')][_0x1356('0xb6')](_0x1356('0xf3'));}if(!this[_0x1356('0xb5')](_0x7e207e['text'])){return this[_0x1356('0x3c')][_0x1356('0xb6')](_0x1356('0xb7'));}this[_0x1356('0x3c')][_0x1356('0xf4')]=!![];this['createSquareDetailsReport'](_0x7e207e);this[_0x1356('0xf5')](_0x7e207e['text'],'in','','');this[_0x1356('0x3c')]['noop'](util[_0x1356('0x2c')](_0x1356('0xf6'),_0x7e207e['text']));var _0x34a414=this[_0x1356('0x84')][_0x1356('0x79')](this,_0x7e207e);if(_0x34a414){for(var _0x5017b1 in _0x34a414){if(_0x34a414[_0x1356('0xa0')](_0x5017b1)){this[_0x1356('0x3c')]['setVariable'](util[_0x1356('0x2c')](_0x1356('0xf7'),_0x5017b1[_0x1356('0xf8')]()),_0x34a414[_0x5017b1]);}}this[_0x1356('0xf5')](_0x34a414[_0x1356('0xf9')],_0x1356('0xfa'),'dialogflow','');return this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0xfb'),_0x34a414[_0x1356('0xf9')]));}return this['channel']['error'](_0x7e207e,_0x1356('0xfc'));};AGIVertices[_0x1356('0x12')][_0x1356('0xfd')]=function(_0x2bbc3c){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0xfe'),_0x2bbc3c['label']));if(!this['isConfigured'](_0x2bbc3c['dialogflowV2_project_id'])){return this[_0x1356('0x3c')][_0x1356('0xb6')](_0x1356('0xff'));}if(!this['isConfigured'](_0x2bbc3c['client_email'])){return this['channel'][_0x1356('0xb6')](_0x1356('0x100'));}if(!this[_0x1356('0xb5')](_0x2bbc3c[_0x1356('0x88')])){return this['channel']['noop']('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x2bbc3c[_0x1356('0x89')])){return this[_0x1356('0x3c')][_0x1356('0xb6')]('no\x20anguage\x20configured');}if(!this[_0x1356('0xb5')](_0x2bbc3c['text'])){return this['channel'][_0x1356('0xb6')](_0x1356('0xb7'));}this[_0x1356('0x3c')][_0x1356('0xf4')]=!![];this[_0x1356('0x3b')](_0x2bbc3c);this[_0x1356('0xf5')](_0x2bbc3c[_0x1356('0x69')],'in','','');this['channel']['noop'](util[_0x1356('0x2c')](_0x1356('0x101'),_0x2bbc3c[_0x1356('0x69')]));var _0x7ec742=this[_0x1356('0x86')][_0x1356('0x79')](this,_0x2bbc3c);if(_0x7ec742){for(var _0x54bd35 in _0x7ec742){if(_0x7ec742[_0x1356('0xa0')](_0x54bd35)){if(_0x54bd35!==_0x1356('0x102')){this[_0x1356('0x3c')]['setVariable'](util[_0x1356('0x2c')](_0x1356('0xf7'),_0x54bd35['toUpperCase']()),_0x7ec742[_0x54bd35]);}}}this['createSquareMessage'](_0x7ec742['speech'],_0x1356('0xfa'),_0x1356('0xfd'),_0x7ec742[_0x1356('0x102')]);return this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0x103'),_0x7ec742[_0x1356('0xf9')]));}return this[_0x1356('0x3c')][_0x1356('0x36')](_0x2bbc3c,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x1356('0x12')][_0x1356('0x104')]=function(_0x3b7802){logger[_0x1356('0xae')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x3b7802['label']));if(!this[_0x1356('0xb5')](_0x3b7802[_0x1356('0x105')])){return this[_0x1356('0x3c')][_0x1356('0xb6')](_0x1356('0x106'));}if(!this[_0x1356('0xb5')](_0x3b7802[_0x1356('0x107')])){return this[_0x1356('0x3c')][_0x1356('0xb6')](_0x1356('0x108'));}if(!this[_0x1356('0xb5')](_0x3b7802[_0x1356('0x109')])){return this[_0x1356('0x3c')]['noop']('no\x20password\x20configured');}if(!this[_0x1356('0xb5')](_0x3b7802['ndassistant_url'])){return this[_0x1356('0x3c')][_0x1356('0xb6')]('no\x20text\x20configured');}this[_0x1356('0x3c')][_0x1356('0xf4')]=!![];this[_0x1356('0x3b')](_0x3b7802);this[_0x1356('0xf5')](_0x3b7802[_0x1356('0x69')],'in','','');this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0x10a'),_0x3b7802[_0x1356('0x69')]));var _0x5cb8fd=this[_0x1356('0x8a')]['sync'](this,_0x3b7802);if(_0x5cb8fd){for(var _0x39a4a3 in _0x5cb8fd){if(_0x5cb8fd[_0x1356('0xa0')](_0x39a4a3)){this[_0x1356('0x3c')]['setVariable'](util[_0x1356('0x2c')](_0x1356('0x10b'),_0x39a4a3[_0x1356('0xf8')]()),_0x5cb8fd[_0x39a4a3]);}}this['createSquareMessage'](_0x5cb8fd[_0x1356('0xf9')],_0x1356('0xfa'),_0x1356('0x104'),'');if(_0x5cb8fd[_0x1356('0x10c')]){this[_0x1356('0x3c')]['noop'](util[_0x1356('0x2c')](_0x1356('0x10d'),_0x5cb8fd[_0x1356('0x10c')]));var _0x5325e5=this['channel'][_0x1356('0x10e')](_0x5cb8fd[_0x1356('0x10c')]);try{fs['unlink'](_0x5cb8fd[_0x1356('0x10c')]+'.wav');}catch(_0x560f9e){logger[_0x1356('0x36')](_0x560f9e);}return _0x5325e5;}else{return this[_0x1356('0x3c')]['noop'](util[_0x1356('0x2c')](_0x1356('0x10f'),_0x5cb8fd[_0x1356('0xf9')]));}}return this['channel'][_0x1356('0x36')](_0x3b7802,_0x1356('0x110'));};AGIVertices['prototype'][_0x1356('0x111')]=function(_0x248e72){logger[_0x1356('0xae')](util[_0x1356('0x2c')]('Enter\x20in\x20END\x20(%s)\x20block',_0x248e72['label']));return this['channel']['noop'](_0x1356('0x111'));};AGIVertices[_0x1356('0x12')]['ext_dial']=function(_0x24f742){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x112'),_0x24f742[_0x1356('0x3e')]));var _0x2e141c='';if(_0x24f742[_0x1356('0x113')]){if(!this[_0x1356('0xb5')](_0x24f742['trunk_id'])){return this['channel'][_0x1356('0x36')](_0x24f742,'no\x20trunk\x20selected');}else{var _0x379b3b=parseInt(_0x24f742[_0x1356('0x113')],0xa);if(isNaN(_0x379b3b)){_0x2e141c=_0x24f742[_0x1356('0x113')];}else{_0x2e141c=this[_0x1356('0x114')][_0x1356('0x79')](this,_0x24f742['trunk_id']);if(!_0x2e141c){return this[_0x1356('0x3c')][_0x1356('0x36')](_0x24f742,_0x1356('0x115'));}}}}else if(_0x24f742[_0x1356('0x116')]){_0x2e141c=_0x24f742[_0x1356('0x116')];}else{return this[_0x1356('0x3c')][_0x1356('0x36')](_0x24f742,_0x1356('0x117'));}var _0x8bd775=this[_0x1356('0x3c')][_0x1356('0xb8')](_0x1356('0xf0'),[util[_0x1356('0x2c')](_0x1356('0x118'),_0x2e141c,_0x24f742[_0x1356('0x56')]),_0x24f742['timeout'],_0x24f742[_0x1356('0xef')],_0x24f742[_0x1356('0x7b')]]);if(_0x8bd775['result']===-0x1){return _0x8bd775;}return this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0x119'),_0x1356('0xf0')));};AGIVertices[_0x1356('0x12')][_0x1356('0x11a')]=function(_0x494b64){logger['info'](util['format'](_0x1356('0x11b'),_0x494b64['label']));return this[_0x1356('0x3c')][_0x1356('0xb6')](_0x1356('0x11a'));};AGIVertices['prototype'][_0x1356('0x10')]=function(_0x11819){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x11c'),_0x11819[_0x1356('0x3e')]));if(_0x11819[_0x1356('0xb2')]===0x0){return this[_0x1356('0xb1')](_0x11819);}_0x11819[_0x1356('0xb2')]-=0x1;if(!this['isConfigured'](_0x11819[_0x1356('0x11d')])){return this['channel'][_0x1356('0x36')](_0x11819,_0x1356('0x11e'));}var _0x2a9645=this[_0x1356('0x1f')][_0x1356('0x79')](this,_0x11819[_0x1356('0x11d')]);if(!_0x2a9645){return this[_0x1356('0x3c')][_0x1356('0x36')](_0x11819,_0x1356('0x11f'));}if(!this[_0x1356('0xb5')](_0x11819[_0x1356('0xe4')])){return this[_0x1356('0x3c')]['error'](_0x1356('0xe5'));}var _0x17e837=this[_0x1356('0x3c')][_0x1356('0x120')](_0x2a9645,_0x11819['response'],_0x11819[_0x1356('0x121')]);var _0x77a698=_0x17e837['result']?_0x17e837[_0x1356('0xad')][_0x1356('0xac')]():'';logger[_0x1356('0xae')]('test',JSON[_0x1356('0x7d')](_0x17e837));if(_0x17e837['result']===-0x1){this[_0x1356('0x3b')][_0x1356('0x79')](this,_0x11819,_0x77a698);return _0x17e837;}else if(_0x17e837[_0x1356('0xb0')]===_0x1356('0x72')){_0x17e837[_0x1356('0xad')]=_0x77a698[_0x1356('0xa7')]>=parseInt(_0x11819[_0x1356('0x122')])?'x':'i';}else{_0x17e837[_0x1356('0xad')]=_0x77a698[_0x1356('0xa7')]>=parseInt(_0x11819[_0x1356('0x122')])&&_0x77a698[_0x1356('0xa7')]<=parseInt(_0x11819['maxdigit'])?'x':'i';}var _0x130e5d=this['getVariable']['sync'](this,_0x11819[_0x1356('0xe4')]);if(!_0x130e5d){return this[_0x1356('0x3c')][_0x1356('0x36')](_0x11819,_0x1356('0xe6'));}this['channel'][_0x1356('0xa9')](_0x130e5d,_0x77a698);if(this[_0x1356('0xb5')](_0x11819[_0x1356('0x123')])){var _0x12588c=parseInt(_0x11819[_0x1356('0x123')],0xa);var _0x509709=rs[_0x1356('0x124')]({'charset':'*','length':_0x12588c});var _0x1d2ac4=_0x77a698[_0x1356('0xa7')];if(_0x1d2ac4>0x0){if(_0x1d2ac4>_0x12588c){this[_0x1356('0x3b')][_0x1356('0x79')](this,_0x11819,_0x11819[_0x1356('0x125')]===_0x1356('0x126')?_0x509709+_0x77a698['substr'](_0x12588c):_0x77a698[_0x1356('0x127')](0x0,_0x1d2ac4-_0x12588c)+_0x509709);}else{this[_0x1356('0x3b')][_0x1356('0x79')](this,_0x11819,rs[_0x1356('0x124')]({'charset':'*','length':_0x1d2ac4}));}}else{this[_0x1356('0x3b')][_0x1356('0x79')](this,_0x11819,'');}}else{this[_0x1356('0x3b')][_0x1356('0x79')](this,_0x11819,_0x77a698);}return _0x17e837;};AGIVertices[_0x1356('0x12')][_0x1356('0x128')]=function(_0x16b5fc){logger['info'](util[_0x1356('0x2c')](_0x1356('0x129'),_0x16b5fc[_0x1356('0x3e')]));return this[_0x1356('0x10')](_0x16b5fc);};AGIVertices[_0x1356('0x12')][_0x1356('0x12a')]=function(_0x5275e7){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x12b'),_0x5275e7[_0x1356('0x3e')]));this[_0x1356('0x3b')][_0x1356('0x79')](this,_0x5275e7,_0x5275e7[_0x1356('0x12c')]);return this[_0x1356('0x3c')]['noop'](util['format'](_0x1356('0x12d'),_0x5275e7[_0x1356('0x12c')]));};AGIVertices[_0x1356('0x12')]['awspolly']=function(_0x3f1ccf){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x12e'),_0x3f1ccf['label']));if(!this[_0x1356('0xb5')](_0x3f1ccf[_0x1356('0x93')])||!this['isConfigured'](_0x3f1ccf[_0x1356('0x94')])){return this['channel'][_0x1356('0xb6')](_0x1356('0x12f'));}if(!this[_0x1356('0xb5')](_0x3f1ccf['text'])){return this['channel']['noop'](_0x1356('0xb7'));}this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')]('Trying\x20aws\x20Polly\x20%s',_0x3f1ccf['text']));var _0x2fd116=this['awsPolly']['sync'](this,_0x3f1ccf);if(_0x2fd116){this['channel'][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0x130'),_0x2fd116));var _0x5849b5=this[_0x1356('0x3c')]['streamFile'](_0x2fd116);try{fs[_0x1356('0x131')](_0x2fd116+_0x1356('0x132'));}catch(_0x552dec){logger[_0x1356('0x36')](_0x552dec);}return _0x5849b5;}return this[_0x1356('0x3c')][_0x1356('0x36')](_0x3f1ccf,_0x1356('0x133'));};AGIVertices[_0x1356('0x12')][_0x1356('0x134')]=function(_0x3dfebc){logger[_0x1356('0xae')](util[_0x1356('0x2c')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x3dfebc['label']));if(!this[_0x1356('0xb5')](_0x3dfebc[_0x1356('0x93')])||!this[_0x1356('0xb5')](_0x3dfebc[_0x1356('0x94')])){return this[_0x1356('0x3c')][_0x1356('0xb6')](_0x1356('0x12f'));}if(!this[_0x1356('0xb5')](_0x3dfebc[_0x1356('0x99')])){return this[_0x1356('0x3c')][_0x1356('0xb6')]('no\x20bot\x20name\x20configured');}if(!this[_0x1356('0xb5')](_0x3dfebc[_0x1356('0x69')])){return this[_0x1356('0x3c')]['noop'](_0x1356('0xb7'));}this[_0x1356('0x3c')][_0x1356('0xf4')]=!![];this['createSquareDetailsReport'](_0x3dfebc);this[_0x1356('0xf5')](_0x3dfebc['text'],'in','','');this['channel'][_0x1356('0xb6')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x3dfebc[_0x1356('0x69')]));var _0x43f93b=this['awsLex'][_0x1356('0x79')](this,_0x3dfebc);if(_0x43f93b){for(var _0xba1bcf in _0x43f93b){if(_0x43f93b[_0x1356('0xa0')](_0xba1bcf)&&_[_0x1356('0xa1')](_0x43f93b[_0xba1bcf])){this[_0x1356('0x3c')]['setVariable'](util[_0x1356('0x2c')](_0x1356('0x135'),_0xba1bcf[_0x1356('0xf8')]()),_0x43f93b[_0xba1bcf]);}}if(_[_0x1356('0x4a')](_0x43f93b['message'])){return this[_0x1356('0x3c')][_0x1356('0xb6')](_0x1356('0x136'));}else{this[_0x1356('0xf5')](_0x43f93b[_0x1356('0x137')],_0x1356('0xfa'),_0x1356('0x138'),'');return this[_0x1356('0x3c')][_0x1356('0xb6')](util['format'](_0x1356('0x139'),_0x43f93b['message']));}}return this[_0x1356('0x3c')][_0x1356('0x36')](_0x3dfebc,_0x1356('0x13a'));};AGIVertices[_0x1356('0x12')]['googleasr']=function(_0x4d38ad){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x13b'),_0x4d38ad[_0x1356('0x3e')],_0x4d38ad[_0x1356('0x72')]));if(!this[_0x1356('0xb5')](_0x4d38ad['key'])){return this['channel'][_0x1356('0xb6')]('no\x20key\x20configured');}var _0x2f6f45=_0x1356('0x13c');var _0x4f9ab5=util[_0x1356('0x2c')](_0x1356('0x13d'),FILES_PATH,rs[_0x1356('0x124')](0x4));var _0x1d206b=util[_0x1356('0x2c')]('%s.%s',_0x4f9ab5,_0x2f6f45);var _0xa8b8c=!![];if(_0x4d38ad[_0x1356('0x13e')]===_0x1356('0x13f')){_0xa8b8c=![];}var _0x4792c6=this[_0x1356('0x3c')][_0x1356('0x140')](_0x4f9ab5,_0x2f6f45,_0x4d38ad[_0x1356('0x141')],_0x4d38ad[_0x1356('0x72')],undefined,_0xa8b8c);if(_0x4792c6[_0x1356('0xad')]!==-0x1){this[_0x1356('0x3c')][_0x1356('0xb6')](util['format'](_0x1356('0x142'),_0x1d206b));var _0x44be86=this[_0x1356('0x9a')][_0x1356('0x79')](this,_0x4d38ad,_0x1d206b);if(_0x44be86){for(var _0x1aa66b in _0x44be86){if(_0x44be86[_0x1356('0xa0')](_0x1aa66b)){this['channel']['setVariable'](util['format'](_0x1356('0x143'),_0x1aa66b[_0x1356('0xf8')]()),_0x44be86[_0x1aa66b]);}}return this[_0x1356('0x3c')]['noop'](util[_0x1356('0x2c')]('GoogleASR\x20Result\x20%s',JSON[_0x1356('0x7d')](_0x44be86)));}}return _0x4792c6;};AGIVertices[_0x1356('0x12')][_0x1356('0x144')]=function(_0x260d04){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x145'),_0x260d04[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x260d04[_0x1356('0x146')])){return this[_0x1356('0x3c')]['noop'](_0x1356('0x147'));}if(!this[_0x1356('0xb5')](_0x260d04[_0x1356('0x148')])){return this['channel'][_0x1356('0xb6')]('no\x20appsecret\x20configured');}var _0xb6ff96='wav';var _0x293c21=util[_0x1356('0x2c')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x57a12c=util[_0x1356('0x2c')](_0x1356('0xa8'),_0x293c21,_0xb6ff96);var _0x4b0bee=!![];if(_0x260d04[_0x1356('0x13e')]===_0x1356('0x13f')){_0x4b0bee=![];}var _0x7ff74f=this['channel'][_0x1356('0x140')](_0x293c21,_0xb6ff96,_0x260d04[_0x1356('0x141')],_0x260d04[_0x1356('0x72')],undefined,_0x4b0bee);if(_0x7ff74f['result']!==-0x1){this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0x149'),_0x57a12c));var _0x182981=this[_0x1356('0x9c')][_0x1356('0x79')](this,_0x260d04,_0x57a12c);if(_0x182981){for(var _0x3f5235 in _0x182981){if(_0x182981['hasOwnProperty'](_0x3f5235)){this[_0x1356('0x3c')][_0x1356('0xa9')](util[_0x1356('0x2c')]('TILDE_ASR_%s',_0x3f5235[_0x1356('0xf8')]()),_0x182981[_0x3f5235]);}}return this['channel'][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0x14a'),JSON[_0x1356('0x7d')](_0x182981)));}}return _0x7ff74f;};AGIVertices[_0x1356('0x12')][_0x1356('0x14b')]=function(_0x54ed9d){logger[_0x1356('0xae')](util['format'](_0x1356('0x14c'),_0x54ed9d['label']));return this['channel'][_0x1356('0x14d')](_0x54ed9d[_0x1356('0x44')],_0x54ed9d['extension'],_0x54ed9d[_0x1356('0x46')]);};AGIVertices[_0x1356('0x12')][_0x1356('0x14e')]=function(_0x1a6c20){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x14f'),_0x1a6c20[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x1a6c20[_0x1356('0x150')])){return this[_0x1356('0x3c')][_0x1356('0x36')](_0x1a6c20,_0x1356('0x151'));}try{var _0x5d67c6=eval(_0x1a6c20[_0x1356('0x150')])?_0x1356('0x152'):_0x1356('0x153');this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0x154'),_0x1a6c20[_0x1356('0x150')],_0x5d67c6));return{'code':0xc8,'result':_0x5d67c6};}catch(_0x402fa5){return{'code':0xc8,'result':_0x1356('0x153')};}};AGIVertices['prototype']['gotoiftime']=function(_0x39f5a4){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x155'),_0x39f5a4[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x39f5a4['interval_id'])){return this[_0x1356('0x3c')][_0x1356('0x36')](_0x39f5a4,_0x1356('0x156'));}var _0x313a2d=this[_0x1356('0x27')][_0x1356('0x79')](this,_0x39f5a4['interval_id']);if(!_0x313a2d){return this[_0x1356('0x3c')]['error'](_0x39f5a4,'no\x20intervals\x20found');}for(var _0x2810f7=0x0;_0x2810f7<_0x313a2d[_0x1356('0xa7')];_0x2810f7+=0x1){var _0x1e2938=this['channel'][_0x1356('0x13')](util[_0x1356('0x2c')](_0x1356('0x157'),_0x313a2d[_0x2810f7]));if(_0x1e2938['result']===-0x1){return _0x1e2938;}logger['info'](util[_0x1356('0x2c')](_0x1356('0x158'),_0x313a2d[_0x2810f7],_0x1e2938['extra']));if(_0x1e2938[_0x1356('0xb0')]==='true'){logger[_0x1356('0xae')](util['format']('IFTIME\x20%s\x20%s',_0x313a2d[_0x2810f7],_0x1356('0x152')));this[_0x1356('0x3c')]['noop'](util[_0x1356('0x2c')](_0x1356('0x158'),_0x313a2d[_0x2810f7],_0x1356('0x152')));return{'code':0xc8,'result':_0x1356('0x152')};}else{logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x158'),_0x313a2d[_0x2810f7],_0x1356('0x153')));this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')]('IFTIME\x20%s\x20%s',_0x313a2d[_0x2810f7],'false'));}}return{'code':0xc8,'result':_0x1356('0x153')};};AGIVertices[_0x1356('0x12')][_0x1356('0x159')]=function(_0xefd5f8){logger[_0x1356('0xae')](util[_0x1356('0x2c')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0xefd5f8[_0x1356('0x3e')]));return this[_0x1356('0x3c')]['hangup']();};AGIVertices[_0x1356('0x12')][_0x1356('0x15a')]=function(_0xfc72bb){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x15b'),_0xfc72bb[_0x1356('0x3e')]));if(!this['isConfigured'](_0xfc72bb[_0x1356('0x85')])){return this['channel'][_0x1356('0xb6')]('no\x20key\x20configured');}var _0x3ae9b4=_0x1356('0x13c');var _0x2dbcd4=util[_0x1356('0x2c')](_0x1356('0x13d'),FILES_PATH,rs['generate'](0x4));var _0x59b8a0=util[_0x1356('0x2c')](_0x1356('0xa8'),_0x2dbcd4,_0x3ae9b4);var _0x5826e2=!![];if(_0xfc72bb[_0x1356('0x13e')]==='NOBEEP'){_0x5826e2=![];}var _0x3974c9=this['channel'][_0x1356('0x140')](_0x2dbcd4,_0x3ae9b4,_0xfc72bb[_0x1356('0x141')],_0xfc72bb[_0x1356('0x72')],undefined,_0x5826e2);if(_0x3974c9['result']!==-0x1){this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0x15c'),_0x59b8a0));var _0x2b2463=this[_0x1356('0x8f')][_0x1356('0x79')](this,_0xfc72bb,_0x59b8a0);if(_0x2b2463){for(var _0x3c51ca in _0x2b2463){if(_0x2b2463['hasOwnProperty'](_0x3c51ca)){this[_0x1356('0x3c')]['setVariable'](util[_0x1356('0x2c')](_0x1356('0x15d'),_0x3c51ca['toUpperCase']()),_0x2b2463[_0x3c51ca]);}}return this[_0x1356('0x3c')][_0x1356('0xb6')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x1356('0x7d')](_0x2b2463)));}}return _0x3974c9;};AGIVertices[_0x1356('0x12')][_0x1356('0x15e')]=function(_0x25fb30){logger[_0x1356('0xae')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x25fb30[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x25fb30['key'])){return this[_0x1356('0x3c')][_0x1356('0xb6')](_0x1356('0xf3'));}if(!this[_0x1356('0xb5')](_0x25fb30[_0x1356('0x69')])){return this['channel'][_0x1356('0xb6')]('no\x20text\x20configured');}this['channel'][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0x15f'),_0x25fb30[_0x1356('0x69')]));var _0xd11e22=this[_0x1356('0x8b')][_0x1356('0x79')](this,_0x25fb30);if(_0xd11e22){this[_0x1356('0x3c')]['noop'](util['format'](_0x1356('0x15c'),_0xd11e22));var _0x25980a=this['channel'][_0x1356('0x10e')](_0xd11e22,_0x25fb30[_0x1356('0x141')]);try{fs['unlink'](_0xd11e22+_0x1356('0x132'));}catch(_0x9b9a76){logger['error'](_0x9b9a76);}return _0x25980a;}return this[_0x1356('0x3c')][_0x1356('0x36')](_0x25fb30,_0x1356('0x160'));};AGIVertices[_0x1356('0x12')][_0x1356('0x161')]=function(_0x10214f){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x162'),_0x10214f[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x10214f['findBy'])){return this[_0x1356('0x3c')]['error'](_0x10214f,'no\x20find\x20by\x20configured');}logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x163'),this['channel']['callerid'],_0x10214f['findBy']));var _0x2499fc=this[_0x1356('0x62')][_0x1356('0x79')](this,_0x10214f[_0x1356('0x164')]);if(_0x2499fc){logger[_0x1356('0xae')](util[_0x1356('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1356('0x3c')]['callerid'],_0x10214f[_0x1356('0x164')]));this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0x165'),this[_0x1356('0x3c')][_0x1356('0x41')],_0x10214f['findBy']));return{'code':0xc8,'result':_0x1356('0x166')};}else{logger[_0x1356('0xae')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1356('0x3c')]['callerid'],_0x10214f[_0x1356('0x164')]));this[_0x1356('0x3c')]['noop'](util[_0x1356('0x2c')](_0x1356('0x167'),this[_0x1356('0x3c')]['callerid'],_0x10214f[_0x1356('0x164')]));return{'code':0xc8,'result':_0x1356('0x168')};}};AGIVertices[_0x1356('0x12')][_0x1356('0x169')]=function(_0x40fc19){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x16a'),_0x40fc19[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x40fc19[_0x1356('0x164')])){return this[_0x1356('0x3c')][_0x1356('0x36')](_0x40fc19,_0x1356('0x16b'));}logger[_0x1356('0xae')](util['format'](_0x1356('0x163'),this['channel']['callerid'],_0x40fc19[_0x1356('0x164')]));var _0x3e8733=this[_0x1356('0x61')][_0x1356('0x79')](this,_0x40fc19[_0x1356('0x164')]);if(_0x3e8733){logger['info'](util[_0x1356('0x2c')](_0x1356('0x165'),this[_0x1356('0x3c')]['callerid'],_0x40fc19[_0x1356('0x164')]));this[_0x1356('0x3c')]['noop'](util[_0x1356('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1356('0x3c')][_0x1356('0x41')],_0x40fc19[_0x1356('0x164')]));return{'code':0xc8,'result':_0x1356('0x166')};}else{logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x167'),this[_0x1356('0x3c')][_0x1356('0x41')],_0x40fc19['findBy']));this['channel'][_0x1356('0xb6')](util[_0x1356('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1356('0x3c')][_0x1356('0x41')],_0x40fc19[_0x1356('0x164')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x1356('0x12')][_0x1356('0x16c')]=function(_0x42a4db){logger[_0x1356('0xae')](util[_0x1356('0x2c')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x42a4db['label']));if(!this[_0x1356('0xb5')](_0x42a4db[_0x1356('0x16d')])){return this[_0x1356('0x3c')]['error'](_0x42a4db,'no\x20operation\x20configured');}this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0x16e'),_0x42a4db['operation']));var _0x1f865d=eval(_0x42a4db[_0x1356('0x16d')]);if(!this[_0x1356('0xb5')](_0x42a4db[_0x1356('0xe4')])){return this[_0x1356('0x3c')][_0x1356('0xb6')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4aa636=this[_0x1356('0x13')][_0x1356('0x79')](this,_0x42a4db[_0x1356('0xe4')]);if(!_0x4aa636){return this['channel'][_0x1356('0x36')](_0x42a4db,_0x1356('0xe6'));}if(_[_0x1356('0xa6')](_0x1f865d)){var _0x441efc=this;_0x1f865d['forEach'](function(_0x11b077,_0x50be47){_0x441efc[_0x1356('0x3c')]['setVariable'](util[_0x1356('0x2c')](_0x1356('0x16f'),_0x4aa636,_0x50be47),_0x11b077);});return this[_0x1356('0x3c')][_0x1356('0xb6')](util['format'](_0x1356('0x170'),_0x4aa636));}else{return this[_0x1356('0x3c')]['setVariable'](_0x4aa636,_0x1f865d);}};AGIVertices[_0x1356('0x12')][_0x1356('0xf')]=function(_0x395a8e){logger['info'](util[_0x1356('0x2c')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x395a8e[_0x1356('0x3e')]));if(_0x395a8e['retry']===0x0){return this[_0x1356('0xb1')](_0x395a8e);}_0x395a8e[_0x1356('0xb2')]-=0x1;if(!this[_0x1356('0xb5')](_0x395a8e['file_id'])){return this[_0x1356('0x3c')][_0x1356('0x36')](_0x395a8e,'no\x20file\x20audio\x20selected');}var _0xae441b=this[_0x1356('0x1f')][_0x1356('0x79')](this,_0x395a8e[_0x1356('0x11d')]);if(!_0xae441b){return this['channel']['error'](_0x395a8e,'no\x20file\x20audio\x20found');}var _0x5cb4d8=this[_0x1356('0x3c')][_0x1356('0x120')](_0xae441b,_0x395a8e['response'],_0x395a8e['digit']);var _0x35ddf3=_0x5cb4d8[_0x1356('0xad')];if(_0x5cb4d8[_0x1356('0xad')]===-0x1){this[_0x1356('0x3b')][_0x1356('0x79')](this,_0x395a8e,'-1');return _0x5cb4d8;}else if(_0x5cb4d8[_0x1356('0xb0')]===_0x1356('0x72')){_0x5cb4d8['result']=_0x5cb4d8[_0x1356('0xad')][_0x1356('0xa7')]>0x0?_0x5cb4d8[_0x1356('0xad')]:'t';}else if(_[_0x1356('0x4d')](_0x5cb4d8['result'])){_0x5cb4d8['result']='#';_0x35ddf3='#';}if(!this[_0x1356('0xb5')](_0x395a8e[_0x1356('0xe4')])){this[_0x1356('0x3c')]['noop'](_0x1356('0xe5'));}else{var _0x42f0c6=this[_0x1356('0x13')][_0x1356('0x79')](this,_0x395a8e['variable_id']);if(!_0x42f0c6){return this[_0x1356('0x3c')][_0x1356('0x36')](_0x395a8e,_0x1356('0xe6'));}this[_0x1356('0x3c')][_0x1356('0xa9')](_0x42f0c6,_0x35ddf3);}this[_0x1356('0x3b')][_0x1356('0x79')](this,_0x395a8e,_0x35ddf3);return _0x5cb4d8;};AGIVertices['prototype'][_0x1356('0xb6')]=function(_0xf4ba92){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x171'),_0xf4ba92[_0x1356('0x3e')]));return this[_0x1356('0x3c')][_0x1356('0xb6')](_0xf4ba92['output']||_0xf4ba92['label']);};AGIVertices[_0x1356('0x12')][_0x1356('0x172')]=function(_0x2833fd){logger[_0x1356('0xae')](util[_0x1356('0x2c')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x2833fd['label']));if(!this[_0x1356('0xb5')](_0x2833fd[_0x1356('0x164')])){return this['channel'][_0x1356('0x36')](_0x2833fd,_0x1356('0x16b'));}logger['info'](util[_0x1356('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1356('0x3c')][_0x1356('0x41')],_0x2833fd[_0x1356('0x164')]));var _0x2d07eb=this[_0x1356('0x173')]['sync'](this,_0x2833fd[_0x1356('0x174')]);var _0x3a308e=this[_0x1356('0x5e')][_0x1356('0x79')](this,_0x2833fd['findBy'],_0x2d07eb);if(_0x3a308e){logger[_0x1356('0xae')](util[_0x1356('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1356('0x3c')][_0x1356('0x41')],_0x2833fd[_0x1356('0x164')]));this['channel']['noop'](util[_0x1356('0x2c')](_0x1356('0x165'),this[_0x1356('0x3c')][_0x1356('0x41')],_0x2833fd[_0x1356('0x164')]));return{'code':0xc8,'result':_0x1356('0x166')};}else{logger[_0x1356('0xae')](util['format'](_0x1356('0x167'),this[_0x1356('0x3c')][_0x1356('0x41')],_0x2833fd['findBy']));this[_0x1356('0x3c')]['noop'](util[_0x1356('0x2c')](_0x1356('0x165'),this[_0x1356('0x3c')][_0x1356('0x41')],_0x2833fd[_0x1356('0x164')]));return{'code':0xc8,'result':_0x1356('0x168')};}};AGIVertices[_0x1356('0x12')][_0x1356('0x175')]=function(_0x1cdebd){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x176'),_0x1cdebd[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x1cdebd[_0x1356('0x11d')])){return this[_0x1356('0x3c')]['error'](_0x1cdebd,_0x1356('0x11e'));}var _0x2d947b=this[_0x1356('0x1f')]['sync'](this,_0x1cdebd['file_id']);if(!_0x2d947b){return this['channel'][_0x1356('0x36')](_0x1cdebd,_0x1356('0x11f'));}var _0x393ab0=this[_0x1356('0x3c')][_0x1356('0xb8')](_0x1356('0x177'),[_0x2d947b,_0x1cdebd['opts']]);if(_0x393ab0[_0x1356('0xad')]===-0x1){return _0x393ab0;}return this['channel']['noop'](util[_0x1356('0x2c')](_0x1356('0x178'),_0x1356('0x177'),_0x2d947b));};AGIVertices[_0x1356('0x12')]['queue']=function(_0xb3f83d){logger[_0x1356('0xae')](util[_0x1356('0x2c')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0xb3f83d[_0x1356('0x3e')]));if(!this['isConfigured'](_0xb3f83d[_0x1356('0x179')])){return this[_0x1356('0x3c')]['error'](_0xb3f83d,_0x1356('0x17a'));}var _0x2f5dda='';var _0x5a100f=parseInt(_0xb3f83d['queue_id'],0xa);if(isNaN(_0x5a100f)){_0x2f5dda=_0xb3f83d[_0x1356('0x179')];}else{_0x2f5dda=this[_0x1356('0x17')][_0x1356('0x79')](this,_0xb3f83d[_0x1356('0x179')]);if(!_0x2f5dda){return this[_0x1356('0x3c')][_0x1356('0x36')](_0xb3f83d,'no\x20queue\x20found');}}var _0x3110a9='';if(this['isConfigured'](_0xb3f83d[_0x1356('0x11d')])){var _0x103049=this[_0x1356('0x1f')]['sync'](this,_0xb3f83d['file_id']);if(_0x103049){_0x3110a9=_0x103049;}}this[_0x1356('0x3b')][_0x1356('0x79')](this,_0xb3f83d,_0x2f5dda);if(_0xb3f83d[_0x1356('0xef')][_0x1356('0x17b')]('x')<0x0){_0xb3f83d[_0x1356('0xef')]+='x';}if(_0xb3f83d[_0x1356('0xef')]['indexOf']('X')<0x0){_0xb3f83d[_0x1356('0xef')]+='X';}this['channel'][_0x1356('0xa9')](_0x1356('0x17c'),_0x2f5dda?_0x2f5dda['toLowerCase']():'');var _0x2d2703=this[_0x1356('0x3c')][_0x1356('0xb8')](_0x1356('0x17d'),[_0x2f5dda,_0xb3f83d['opts'],_0xb3f83d[_0x1356('0x7b')],_0x3110a9,_0xb3f83d[_0x1356('0x72')],_0xb3f83d[_0x1356('0x9')],_0xb3f83d[_0x1356('0x17e')],_0xb3f83d[_0x1356('0x17f')],'',_0xb3f83d[_0x1356('0x180')]]);if(_0x2d2703[_0x1356('0xad')]===-0x1){return _0x2d2703;}return this['channel'][_0x1356('0xb6')](util[_0x1356('0x2c')]('Executed\x20command\x20%s\x20%s',_0x1356('0x17d'),_0x2f5dda));};AGIVertices[_0x1356('0x12')][_0x1356('0x181')]=function(_0x1f6b9a){logger[_0x1356('0xae')](util['format'](_0x1356('0x182'),_0x1f6b9a['label']));var _0x125222=_0x1f6b9a[_0x1356('0x183')]||'wav';var _0x28ea66=util[_0x1356('0x2c')](_0x1356('0x184'),this[_0x1356('0x3c')][_0x1356('0x3d')],rs['generate'](0x5));var _0x503420=util[_0x1356('0x2c')](_0x1356('0x185'),FILES_PATH,_0x28ea66,_0x125222);var _0x206ebd=util[_0x1356('0x2c')](_0x1356('0x13d'),FILES_PATH,_0x28ea66);this['createSquareRecording']['sync'](this,_0x1f6b9a,_0x28ea66,_0x503420);this[_0x1356('0x3c')][_0x1356('0xa9')](_0x1356('0x186'),_0x28ea66);logger[_0x1356('0xae')](_0x1356('0x187'),_0x206ebd,_0x125222,_0x1f6b9a[_0x1356('0x188')],_0x1f6b9a['timeout']);return this[_0x1356('0x3c')][_0x1356('0x140')](_0x206ebd,_0x125222,_0x1f6b9a[_0x1356('0x188')],_0x1f6b9a['timeout'],undefined,!![]);};AGIVertices[_0x1356('0x12')]['restapi']=function(_0x3909d5){logger[_0x1356('0xae')](util['format'](_0x1356('0x189'),_0x3909d5[_0x1356('0x3e')]));if(!this['isConfigured'](_0x3909d5[_0x1356('0x7b')])){return this['channel'][_0x1356('0xb6')]('no\x20url\x20configured');}var _0x41f983=this[_0x1356('0x70')][_0x1356('0x79')](this,_0x3909d5);logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x18a'),util[_0x1356('0x18b')](_0x41f983,{'showHidden':![],'depth':null})));if(!this[_0x1356('0xb5')](_0x3909d5['variable_id'])){return this['channel'][_0x1356('0xb6')](_0x1356('0x18c'));}var _0x1ef63f=this['getVariable']['sync'](this,_0x3909d5[_0x1356('0xe4')]);if(!_0x1ef63f){return this[_0x1356('0x3c')][_0x1356('0x36')](_0x3909d5,'no\x20variable\x20found');}this['channel'][_0x1356('0xa9')](util[_0x1356('0x2c')]('%s_STATUS_CODE',_0x1ef63f),_0x41f983[_0x1356('0x80')]?_0x41f983['statusCode']:_0x1356('0x18d'));this[_0x1356('0x3c')][_0x1356('0xa9')](util[_0x1356('0x2c')]('%s_STATUS_MESSAGE',_0x1ef63f),_0x41f983[_0x1356('0x81')]?_0x41f983['statusMessage']:'OK');if(_0x41f983['body']){try{this[_0x1356('0x18e')](_0x41f983[_0x1356('0x74')],_0x1ef63f);}catch(_0x2c1e82){logger[_0x1356('0x36')](util[_0x1356('0x2c')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x1ef63f));}}return this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0xe9'),_0x1ef63f));};AGIVertices[_0x1356('0x12')][_0x1356('0x18f')]=function(_0xaf0893){logger[_0x1356('0xae')](util['format'](_0x1356('0x190'),_0xaf0893[_0x1356('0x3e')]));return this['channel'][_0x1356('0x191')](_0xaf0893['digits']['replace'](/\s+/g,''),_0xaf0893[_0x1356('0x188')]);};AGIVertices['prototype']['saynumber']=function(_0x5951e1){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x192'),_0x5951e1['label']));return this[_0x1356('0x3c')][_0x1356('0x193')](_0x5951e1[_0x1356('0x194')][_0x1356('0x65')](/\s+/g,''),_0x5951e1[_0x1356('0x188')]);};AGIVertices['prototype'][_0x1356('0x195')]=function(_0x346cb2){logger[_0x1356('0xae')](util['format'](_0x1356('0x196'),_0x346cb2[_0x1356('0x3e')]));return this[_0x1356('0x3c')][_0x1356('0x197')](_0x346cb2['text'],_0x346cb2[_0x1356('0x188')]);};AGIVertices[_0x1356('0x12')][_0x1356('0x198')]=function(_0x52f0e0){logger[_0x1356('0xae')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x52f0e0[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x52f0e0[_0x1356('0x199')])){return this['channel'][_0x1356('0xb6')]('no\x20mail\x20account\x20configured');}var _0x12ad2f=this[_0x1356('0x23')][_0x1356('0x79')](this,_0x52f0e0['account_id']);if(!_0x12ad2f||!_0x12ad2f[_0x1356('0x19a')]){return this[_0x1356('0x3c')][_0x1356('0x36')](_0x52f0e0,'no\x20mail\x20account\x20found');}var _0x301810={'from':util[_0x1356('0x2c')](_0x1356('0x19b'),_0x12ad2f[_0x1356('0x15')],_0x12ad2f[_0x1356('0x19c')]||_0x12ad2f[_0x1356('0x19a')][_0x1356('0x19d')]),'to':_0x52f0e0['to']||'','cc':_0x52f0e0['cc']||'','bcc':_0x52f0e0[_0x1356('0x19e')]||'','subject':_0x52f0e0[_0x1356('0x19f')],'html':_0x52f0e0[_0x1356('0x69')],'text':_0x52f0e0['text']};var _0x5cc8da={'tls':{'rejectUnauthorized':![]}};if(_0x12ad2f[_0x1356('0x19a')][_0x1356('0x1a0')]){_0x5cc8da[_0x1356('0x1a0')]=_0x12ad2f[_0x1356('0x19a')][_0x1356('0x1a0')];}else{_0x5cc8da[_0x1356('0x1a1')]=_0x12ad2f[_0x1356('0x19a')][_0x1356('0x1a1')];_0x5cc8da[_0x1356('0x1a2')]=_0x12ad2f[_0x1356('0x19a')]['port'];_0x5cc8da[_0x1356('0x1a3')]=_0x12ad2f['Smtp']['secure'];}if(_0x12ad2f[_0x1356('0x19a')][_0x1356('0x1a4')]){_0x5cc8da['auth']={'user':_0x12ad2f['Smtp'][_0x1356('0x19d')],'pass':_0x12ad2f['Smtp'][_0x1356('0x1a5')]};}if(this[_0x1356('0xb5')](_0x52f0e0[_0x1356('0x1a6')])){}logger['debug'](_0x1356('0x1a7'),JSON[_0x1356('0x7d')](_0x301810));this[_0x1356('0x3b')][_0x1356('0x79')](this,_0x52f0e0,_0x52f0e0[_0x1356('0x199')]);this['channel'][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0x1a8'),_0x12ad2f['name']));this[_0x1356('0x25')][_0x1356('0x79')](this,_0x5cc8da,_0x301810);return this[_0x1356('0x3c')]['noop'](_0x1356('0x1a9'));};AGIVertices[_0x1356('0x12')][_0x1356('0x1aa')]=function(_0x22d2d7){logger[_0x1356('0xae')](util['format'](_0x1356('0x1ab'),_0x22d2d7[_0x1356('0x3e')]));return this['channel']['noop'](_0x1356('0x1ac'));};AGIVertices[_0x1356('0x12')]['sendSMS']=function(_0x4f91b1){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x1ad'),_0x4f91b1[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x4f91b1[_0x1356('0x1ae')])){return this['channel']['noop'](_0x1356('0x1af'));}var _0x343632=this[_0x1356('0x38')][_0x1356('0x79')](this,_0x4f91b1[_0x1356('0x1ae')]);if(!_0x343632){return this[_0x1356('0x3c')]['error'](_0x4f91b1,'no\x20sms\x20account\x20found');}var _0x45554c={'body':_0x4f91b1[_0x1356('0x1b0')],'phone':_0x4f91b1['to']||'','SmsAccountId':_0x343632['id']};logger[_0x1356('0xeb')](_0x1356('0x1b1'),JSON[_0x1356('0x7d')](_0x45554c));this[_0x1356('0x3b')][_0x1356('0x79')](this,_0x4f91b1,_0x4f91b1[_0x1356('0x1ae')]);this[_0x1356('0x3c')][_0x1356('0xb6')](util['format'](_0x1356('0x1b2'),_0x343632[_0x1356('0x15')]));this[_0x1356('0x3a')][_0x1356('0x79')](this,_0x45554c);return this[_0x1356('0x3c')][_0x1356('0xb6')](_0x1356('0x1b3'));};AGIVertices[_0x1356('0x12')][_0x1356('0x1b4')]=function(_0xac5e07){logger['info'](util[_0x1356('0x2c')](_0x1356('0x1b5'),_0xac5e07[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0xac5e07['variable_id'])){return this['channel']['error'](_0xac5e07,_0x1356('0x1b6'));}var _0x2356ba=this['getVariable'][_0x1356('0x79')](this,_0xac5e07[_0x1356('0xe4')]);if(!_0x2356ba){return this[_0x1356('0x3c')][_0x1356('0x36')](_0xac5e07,_0x1356('0xe6'));}return this[_0x1356('0x3c')][_0x1356('0xa9')](_0x2356ba,_0xac5e07[_0x1356('0x1b7')]);};AGIVertices[_0x1356('0x12')]['start']=function(_0x479c70){logger[_0x1356('0xae')](util['format'](_0x1356('0x1b8'),_0x479c70[_0x1356('0x3e')]));this[_0x1356('0x3c')][_0x1356('0xb6')]('START\x20CALLY\x20SQUARE');if(_0x479c70['answer']===_0x1356('0x1b9')){this[_0x1356('0x3c')][_0x1356('0xb6')](_0x1356('0x1ba'));return this[_0x1356('0x3c')][_0x1356('0xc5')]();}return this[_0x1356('0x3c')][_0x1356('0xb6')](_0x1356('0x1bb'));};AGIVertices['prototype'][_0x1356('0x1bc')]=function(_0xac9ed2){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x1bd'),_0xac9ed2[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0xac9ed2[_0x1356('0x1be')])){return this[_0x1356('0x3c')]['error'](_0xac9ed2,'no\x20subproject\x20selected');}var _0x15e8ee=this[_0x1356('0x19')][_0x1356('0x79')](this,_0xac9ed2[_0x1356('0x1be')]);if(!this[_0x1356('0xb5')](_0x15e8ee)){return this['channel'][_0x1356('0x36')](_0xac9ed2,util['format'](_0x1356('0x1bf'),_0xac9ed2['project_id']));}if(_0x15e8ee===this[_0x1356('0x3c')][_0x1356('0x40')]){return this[_0x1356('0x3c')]['error'](_0xac9ed2,_0x1356('0x1c0'));}this[_0x1356('0x3b')][_0x1356('0x79')](this,_0xac9ed2,_0x15e8ee);var _0x3c1856=this[_0x1356('0x3c')]['exec']('AGI',util['format'](_0x1356('0x1c1'),config[_0x1356('0x9')][_0x1356('0x1a1')]||_0x1356('0x1c2'),_0x15e8ee,this['channel'][_0x1356('0x40')]));if(_0x3c1856['result']===-0x1){return _0x3c1856;}return this[_0x1356('0x3c')][_0x1356('0xb6')](util['format'](_0x1356('0x178'),_0x1356('0x1c3'),_0x15e8ee));};AGIVertices[_0x1356('0x12')][_0x1356('0x1c4')]=function(_0x3c7270){logger['info'](util[_0x1356('0x2c')](_0x1356('0x1c5'),_0x3c7270['label']));var _0x315c60=this[_0x1356('0x1c6')][_0x1356('0x79')](this,_0x3c7270[_0x1356('0x1c7')]);this[_0x1356('0x3b')][_0x1356('0x79')](this,_0x3c7270,_0x3c7270[_0x1356('0x1c7')]);if(this['isConfigured'](_0x3c7270[_0x1356('0xe4')])){var _0x2c6199=this['getVariable'][_0x1356('0x79')](this,_0x3c7270['variable_id']);if(_0x2c6199){this[_0x1356('0x3c')][_0x1356('0xa9')](_0x2c6199,_0x315c60);return this['channel'][_0x1356('0xb6')](util[_0x1356('0x2c')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x3c7270[_0x1356('0x1c7')],_0x2c6199));}}return this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0x1c8'),_0x3c7270[_0x1356('0x1c7')]));};AGIVertices['prototype'][_0x1356('0x1c9')]=function(_0x443ff0){logger[_0x1356('0xae')](util['format'](_0x1356('0x1ca'),_0x443ff0[_0x1356('0x3e')]));_0x443ff0['text']=_0x443ff0[_0x1356('0x69')][_0x1356('0x65')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1356('0xb5')](_0x443ff0[_0x1356('0x67')])){return this['channel'][_0x1356('0xb6')](_0x1356('0x1cb'));}if(!this[_0x1356('0xb5')](_0x443ff0[_0x1356('0x69')])){return this[_0x1356('0x3c')][_0x1356('0xb6')](_0x1356('0xb7'));}this[_0x1356('0x3c')][_0x1356('0xb6')](util['format'](_0x1356('0x1cc'),_0x443ff0['text']));var _0x32e84a=this[_0x1356('0x66')]['sync'](this,_0x443ff0);if(_0x32e84a){this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0x1cd'),_0x32e84a));var _0x5911bf=this['channel']['streamFile'](_0x32e84a);try{fs[_0x1356('0x131')](_0x32e84a+_0x1356('0x132'));}catch(_0x44746a){logger[_0x1356('0x36')](_0x44746a);}return _0x5911bf;}return this[_0x1356('0x3c')][_0x1356('0x36')](_0x443ff0,_0x1356('0x1ce'));};AGIVertices[_0x1356('0x12')][_0x1356('0x1cf')]=function(_0x4d0c8d){logger[_0x1356('0xae')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x4d0c8d[_0x1356('0x3e')]));_0x4d0c8d[_0x1356('0x69')]=_0x4d0c8d[_0x1356('0x69')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4d0c8d[_0x1356('0x69')])){return this[_0x1356('0x3c')][_0x1356('0xb6')]('no\x20text\x20configured');}this[_0x1356('0x3c')][_0x1356('0xb6')](util['format'](_0x1356('0x1d0'),_0x4d0c8d['text']));var _0x195315=this[_0x1356('0x6e')]['sync'](this,_0x4d0c8d);if(_0x195315){this['channel']['noop'](util['format'](_0x1356('0x1d1'),_0x195315));var _0xe782d0=this[_0x1356('0x3c')][_0x1356('0x10e')](_0x195315);try{fs['unlink'](_0x195315+'.wav');}catch(_0x434151){logger[_0x1356('0x36')](_0x434151);}return _0xe782d0;}return this[_0x1356('0x3c')][_0x1356('0x36')](_0x4d0c8d,_0x1356('0x1d2'));};AGIVertices['prototype']['unpause']=function(_0x14a469){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x1d3'),_0x14a469[_0x1356('0x3e')]));if(!this[_0x1356('0xb5')](_0x14a469['findBy'])){return this[_0x1356('0x3c')]['error'](_0x14a469,_0x1356('0x16b'));}logger['info'](util[_0x1356('0x2c')](_0x1356('0x163'),this[_0x1356('0x3c')][_0x1356('0x41')],_0x14a469[_0x1356('0x164')]));var _0x1bdfd9=this[_0x1356('0x60')][_0x1356('0x79')](this,_0x14a469[_0x1356('0x164')]);if(_0x1bdfd9){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x165'),this[_0x1356('0x3c')][_0x1356('0x41')],_0x14a469[_0x1356('0x164')]));this[_0x1356('0x3c')][_0x1356('0xb6')](util[_0x1356('0x2c')](_0x1356('0x165'),this[_0x1356('0x3c')][_0x1356('0x41')],_0x14a469['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x167'),this[_0x1356('0x3c')][_0x1356('0x41')],_0x14a469[_0x1356('0x164')]));this[_0x1356('0x3c')]['noop'](util[_0x1356('0x2c')](_0x1356('0x167'),this[_0x1356('0x3c')]['callerid'],_0x14a469[_0x1356('0x164')]));return{'code':0xc8,'result':_0x1356('0x168')};}};AGIVertices[_0x1356('0x12')][_0x1356('0x1d4')]=function(_0x1407a5){logger[_0x1356('0xae')](util[_0x1356('0x2c')](_0x1356('0x1d5'),_0x1407a5[_0x1356('0x3e')]));var _0x4b188c=this[_0x1356('0x3c')][_0x1356('0xb8')](_0x1356('0x1d6'),[_0x1407a5[_0x1356('0x1d7')],_0x1407a5[_0x1356('0x83')]]);if(_0x4b188c[_0x1356('0xad')]===-0x1){return _0x4b188c;}return this['channel'][_0x1356('0xb6')](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x1407a5['mailbox']));};AGIVertices[_0x1356('0x12')][_0x1356('0x1d8')]=function(_0x2d45b5){logger[_0x1356('0xae')](util[_0x1356('0x2c')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x2d45b5[_0x1356('0x3e')]));if(!this['isConfigured'](_0x2d45b5[_0x1356('0xe4')])){return this[_0x1356('0x3c')]['error'](_0x2d45b5,_0x1356('0x1b6'));}var _0x9b4e79=this[_0x1356('0x13')][_0x1356('0x79')](this,_0x2d45b5['variable_id']);if(!_0x9b4e79){return this['channel']['error'](_0x2d45b5,_0x1356('0xe6'));}var _0x3ec247=this[_0x1356('0x3c')][_0x1356('0x13')](_0x9b4e79);return{'code':0xc8,'result':_0x3ec247[_0x1356('0xb0')]?_0x3ec247['extra']:'-'};};String[_0x1356('0x12')]['replaceAll']=function(_0x8f8fb0,_0x2c219c){return this[_0x1356('0xaa')](_0x8f8fb0)[_0x1356('0x1d9')](_0x2c219c);};module[_0x1356('0x1da')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index dcee895..1976b23 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 _0x6770=['hanguprequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','savePause','info','acwTimeout','stopAcw','lastPauseAt','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:LINKEDID]','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind'];(function(_0x3da06f,_0x1da546){var _0x37cc85=function(_0x31a162){while(--_0x31a162){_0x3da06f['push'](_0x3da06f['shift']());}};_0x37cc85(++_0x1da546);}(_0x6770,0x1d0));var _0x0677=function(_0x431a53,_0x5269ea){_0x431a53=_0x431a53-0x0;var _0x3fd95e=_0x6770[_0x431a53];return _0x3fd95e;};'use strict';var util=require(_0x0677('0x0'));var _=require(_0x0677('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x0677('0x2'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x0677('0x3'));function Acw(_0x3626d9){this[_0x0677('0x4')]=_0x3626d9[_0x0677('0x4')];this[_0x0677('0x5')]=_0x3626d9[_0x0677('0x5')];this[_0x0677('0x6')]=_0x3626d9[_0x0677('0x6')];this[_0x0677('0x7')]={};ami['on']('agentconnect',this[_0x0677('0x8')][_0x0677('0x9')](this));ami['on'](_0x0677('0xa'),this['syncHangupRequest'][_0x0677('0x9')](this));ami['on'](_0x0677('0xb'),this[_0x0677('0xc')][_0x0677('0x9')](this));ami['on']('agentringnoanswer',this[_0x0677('0xd')][_0x0677('0x9')](this));ami['on'](_0x0677('0xe'),this[_0x0677('0xf')][_0x0677('0x9')](this));ami['on'](_0x0677('0x10'),this['syncBlindTransfer'][_0x0677('0x9')](this));ami['on'](_0x0677('0x11'),this[_0x0677('0x12')]['bind'](this));}function getDiff(_0x167450){var _0x2b0083=moment()[_0x0677('0x13')](0x0);var _0x30bd92=moment(_0x167450)[_0x0677('0x13')](0x0);return _0x2b0083[_0x0677('0x14')](_0x30bd92,_0x0677('0x15'));}Acw[_0x0677('0x16')][_0x0677('0x17')]=function(_0x5e49c9){try{var _0x35405a=this;var _0x3b9726=this[_0x0677('0x7')][_0x5e49c9][_0x0677('0x18')];var _0xf84a51=this[_0x0677('0x7')][_0x5e49c9][_0x0677('0x19')];var _0x57fcad=this[_0x0677('0x4')][_0xf84a51];var _0x5880e1=![];var _0x105b0e=_0x0677('0x1a');if(_0x57fcad['mandatoryDisposition']){if(_0x57fcad[_0x0677('0x1b')][_0x0677('0x1c')]){_0x5880e1=!![];_0x105b0e=_0x57fcad[_0x0677('0x1b')][_0x0677('0x1c')];}}ami['Action']({'action':_0x0677('0x1d'),'interface':_0x3b9726,'paused':!![],'reason':_0x105b0e})[_0x0677('0x1e')](function(_0x4784e2){if(_0x35405a[_0x0677('0x5')][_0x3b9726]){return RpcUser[_0x0677('0x1f')](_0x35405a[_0x0677('0x5')][_0x3b9726]['id'])[_0x0677('0x1e')](function(_0x1c9b53){if(_0x1c9b53&&!_0x1c9b53[_0x0677('0x20')]){logger['info'](_0x0677('0x21'),_0x5e49c9,_0x3b9726,_0xf84a51);var _0x4431ba=_0x35405a[_0x0677('0x7')][_0x5e49c9][_0x0677('0x22')]&&_0x35405a['channels'][_0x5e49c9]['destlinkedid']?_0x35405a['channels'][_0x5e49c9]['destlinkedid']:_0x5e49c9;return RpcUser[_0x0677('0x23')](_0x35405a[_0x0677('0x5')][_0x3b9726],_0x105b0e,_0x4431ba)[_0x0677('0x1e')](function(_0x3bad83){if(!_0x5880e1){_0x35405a[_0x0677('0x6')][_0x3b9726]={};logger[_0x0677('0x24')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5e49c9,_0x35405a['voiceQueues'][_0xf84a51][_0x0677('0x25')],_0x3b9726,_0xf84a51);_0x35405a[_0x0677('0x6')][_0x3b9726]['timer']=setTimeout(_0x35405a[_0x0677('0x26')][_0x0677('0x9')](_0x35405a,_0x3b9726),_0x35405a[_0x0677('0x4')][_0xf84a51][_0x0677('0x25')]*0x3e8);_0x35405a[_0x0677('0x6')][_0x3b9726][_0x0677('0x27')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x35405a['timers'][_0x3b9726][_0x0677('0x28')]=_0x5e49c9;_0x35405a[_0x0677('0x6')][_0x3b9726][_0x0677('0x19')]=_0xf84a51;_0x35405a[_0x0677('0x6')][_0x3b9726][_0x0677('0x29')]=function(){var _0x1137fb=getDiff(_0x35405a[_0x0677('0x6')][_0x3b9726]['lastPauseAt']);clearTimeout(_0x35405a[_0x0677('0x6')][_0x3b9726][_0x0677('0x2a')]);_0x35405a['timers'][_0x3b9726][_0x0677('0x2a')]=![];RpcVoiceAgentReport[_0x0677('0x2b')]({'acwtime':_0x1137fb},_0x35405a['timers'][_0x3b9726][_0x0677('0x28')],_0x3b9726)[_0x0677('0x1e')](function(_0x5e4a60){logger[_0x0677('0x24')](_0x0677('0x2c'),_0x5e49c9,_0x1137fb,_0x5e4a60);})['catch'](function(_0x26ed15){logger[_0x0677('0x2d')](_0x0677('0x2e'),_0x5e49c9,_0x26ed15);});delete _0x35405a[_0x0677('0x6')][_0x3b9726];};}});}else{logger[_0x0677('0x24')](_0x0677('0x2f'),_0x5e49c9,_0x3b9726,_0xf84a51);}});}})[_0x0677('0x30')](function(_0x4be337){logger[_0x0677('0x2d')](_0x0677('0x31'),_0x5e49c9,_0x35405a[_0x0677('0x4')][_0xf84a51][_0x0677('0x25')],_0x3b9726,_0xf84a51);})['finally'](function(){delete _0x35405a[_0x0677('0x7')][_0x5e49c9];});}catch(_0xa79ab1){logger[_0x0677('0x2d')](_0x0677('0x32'),_0xa79ab1[_0x0677('0x33')]);}};Acw[_0x0677('0x16')]['stopAcw']=function(_0x53554f){try{var _0x1600b6=this;if(_0x1600b6['timers'][_0x53554f]){_0x1600b6[_0x0677('0x6')][_0x53554f]['timer']=![];var _0x66f641=_0x1600b6[_0x0677('0x6')][_0x53554f][_0x0677('0x28')];var _0x46b44a=_0x1600b6['timers'][_0x53554f][_0x0677('0x19')];var _0x1cbe38=_0x1600b6[_0x0677('0x4')][_0x46b44a][_0x0677('0x25')];logger[_0x0677('0x24')](_0x0677('0x34'),_0x66f641,_0x53554f);RpcUser['saveUnpause'](this[_0x0677('0x5')][_0x53554f]);RpcVoiceAgentReport[_0x0677('0x2b')]({'acwtime':_0x1cbe38,'agentacw':!![]},_0x66f641,_0x53554f)[_0x0677('0x1e')](function(_0x1ab7b8){logger[_0x0677('0x24')]('[%s][UPDATE][ACWTIME:%s]',_0x66f641,_0x1cbe38,_0x1ab7b8);})[_0x0677('0x30')](function(_0x3b719d){logger[_0x0677('0x2d')](_0x0677('0x2e'),_0x66f641,_0x3b719d);});}else{logger[_0x0677('0x2d')](_0x0677('0x35'),_0x53554f);if(_0x1600b6[_0x0677('0x6')]){logger[_0x0677('0x24')](_0x0677('0x36'),JSON[_0x0677('0x37')](_0x1600b6[_0x0677('0x6')]));}}}catch(_0x3e30cd){logger[_0x0677('0x2d')](_0x0677('0x38'),_0x3e30cd[_0x0677('0x33')]);}};Acw['prototype'][_0x0677('0x8')]=function(_0x3dd26b){try{if(this[_0x0677('0x4')][_0x3dd26b[_0x0677('0x19')]]&&(this[_0x0677('0x4')][_0x3dd26b[_0x0677('0x19')]][_0x0677('0x39')]||this[_0x0677('0x4')][_0x3dd26b[_0x0677('0x19')]][_0x0677('0x3a')])){if(this[_0x0677('0x5')][_0x3dd26b[_0x0677('0x18')]]){this[_0x0677('0x7')][_0x3dd26b['uniqueid']]={'queue':_0x3dd26b[_0x0677('0x19')],'interface':_0x3dd26b[_0x0677('0x18')],'destlinkedid':_0x3dd26b['destlinkedid']};}}}catch(_0x19385f){logger[_0x0677('0x2d')](_0x0677('0x3b'),_0x19385f[_0x0677('0x33')]);}};Acw[_0x0677('0x16')][_0x0677('0x12')]=function(_0x580d4e){try{if(this['voiceQueues'][_0x580d4e[_0x0677('0x19')]]&&(this[_0x0677('0x4')][_0x580d4e[_0x0677('0x19')]][_0x0677('0x39')]||this['voiceQueues'][_0x580d4e[_0x0677('0x19')]][_0x0677('0x3a')])){if(this[_0x0677('0x5')][_0x580d4e[_0x0677('0x18')]]){this[_0x0677('0x7')][_0x580d4e[_0x0677('0x28')]]={'queue':_0x580d4e[_0x0677('0x19')],'interface':_0x580d4e[_0x0677('0x18')]};}}}catch(_0x4c9eec){logger[_0x0677('0x2d')](_0x0677('0x3c'),_0x4c9eec[_0x0677('0x33')]);}};Acw[_0x0677('0x16')][_0x0677('0x3d')]=function(_0x3b50a8){try{if(this[_0x0677('0x7')][_0x3b50a8[_0x0677('0x28')]]&&_[_0x0677('0x3e')](this['channels'][_0x3b50a8['uniqueid']][_0x0677('0x22')])){logger[_0x0677('0x24')]('[%s][HANGUP:UNIQUEID]',_0x3b50a8[_0x0677('0x28')]);this[_0x0677('0x17')](_0x3b50a8['uniqueid']);}else if(this[_0x0677('0x7')][_0x3b50a8['linkedid']]&&_[_0x0677('0x3e')](this[_0x0677('0x7')][_0x3b50a8['linkedid']][_0x0677('0x22')])){logger[_0x0677('0x24')](_0x0677('0x3f'),_0x3b50a8[_0x0677('0x40')]);this[_0x0677('0x17')](_0x3b50a8[_0x0677('0x40')]);}}catch(_0x85a147){logger[_0x0677('0x2d')]('[ACW][syncHangupRequest]\x20%s',_0x85a147[_0x0677('0x33')]);}};Acw[_0x0677('0x16')][_0x0677('0xc')]=function(_0x1afd5b){try{if(this['channels'][_0x1afd5b[_0x0677('0x28')]]&&this[_0x0677('0x7')][_0x1afd5b['uniqueid']][_0x0677('0x22')]){logger[_0x0677('0x24')](_0x0677('0x41'),_0x1afd5b[_0x0677('0x28')]);this[_0x0677('0x17')](_0x1afd5b['uniqueid']);}else if(this['channels'][_0x1afd5b['linkedid']]&&this[_0x0677('0x7')][_0x1afd5b[_0x0677('0x40')]][_0x0677('0x22')]){logger[_0x0677('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x1afd5b['linkedid']);this[_0x0677('0x17')](_0x1afd5b['linkedid']);}}catch(_0x186a3b){logger['error']('[ACW][syncHangup]\x20%s',_0x186a3b[_0x0677('0x33')]);}};Acw['prototype'][_0x0677('0xf')]=function(_0x46b44d){try{if(!_['isNil'](this[_0x0677('0x7')][_0x46b44d['transfereeuniqueid']])){this[_0x0677('0x17')](_0x46b44d[_0x0677('0x42')]);if(this[_0x0677('0x7')][_0x46b44d[_0x0677('0x43')]]){this['channels'][_0x46b44d[_0x0677('0x43')]][_0x0677('0x22')]=!![];this[_0x0677('0x7')][_0x46b44d[_0x0677('0x44')]]=this['channels'][_0x46b44d[_0x0677('0x43')]];delete this['channels'][_0x46b44d[_0x0677('0x43')]];}}else if(!_['isNil'](this[_0x0677('0x7')][_0x46b44d[_0x0677('0x44')]])){this[_0x0677('0x17')](_0x46b44d[_0x0677('0x44')]);if(this[_0x0677('0x7')][_0x46b44d[_0x0677('0x45')]]){this[_0x0677('0x7')][_0x46b44d[_0x0677('0x45')]][_0x0677('0x22')]=!![];this['channels'][_0x46b44d[_0x0677('0x42')]]=this[_0x0677('0x7')][_0x46b44d[_0x0677('0x45')]];delete this[_0x0677('0x7')][_0x46b44d[_0x0677('0x45')]];}}}catch(_0x4749c7){logger[_0x0677('0x2d')]('[ACW][syncAttendedTransfer]\x20%s',_0x4749c7[_0x0677('0x33')]);}};Acw[_0x0677('0x16')][_0x0677('0x46')]=function(_0x73804f){try{if(this[_0x0677('0x7')][_0x73804f[_0x0677('0x47')]]){logger['info'](_0x0677('0x48'),JSON[_0x0677('0x37')](_0x73804f['transfereruniqueid']));this[_0x0677('0x17')](_0x73804f['transfereruniqueid']);}else if(this[_0x0677('0x7')][_0x73804f[_0x0677('0x49')]]){logger[_0x0677('0x24')](_0x0677('0x4a'),JSON[_0x0677('0x37')](_0x73804f[_0x0677('0x49')]));this[_0x0677('0x17')](_0x73804f[_0x0677('0x49')]);}}catch(_0x1049ee){logger[_0x0677('0x2d')](_0x0677('0x4b'),_0x1049ee[_0x0677('0x33')]);}};Acw[_0x0677('0x16')][_0x0677('0xd')]=function(_0x287290){try{if(this[_0x0677('0x4')][_0x287290['queue']]&&this['voiceQueues'][_0x287290[_0x0677('0x19')]]['autopause']==='all'){if(this[_0x0677('0x5')][_0x287290[_0x0677('0x18')]]){logger[_0x0677('0x24')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x287290[_0x0677('0x28')],_0x287290[_0x0677('0x18')],_0x287290[_0x0677('0x19')]);return RpcUser[_0x0677('0x23')](this['agents'][_0x287290['interface']],_0x0677('0x4c'),_0x287290['uniqueid']);}}}catch(_0x339073){logger[_0x0677('0x2d')](_0x0677('0x4d'),_0x339073[_0x0677('0x33')]);}};module[_0x0677('0x4e')]=Acw; \ No newline at end of file +var _0xa288=['format','updateAcw','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt'];(function(_0x20a96b,_0x2c130c){var _0x496800=function(_0x3ac00d){while(--_0x3ac00d){_0x20a96b['push'](_0x20a96b['shift']());}};_0x496800(++_0x2c130c);}(_0xa288,0x1ed));var _0x8a28=function(_0x1a1fa5,_0x568604){_0x1a1fa5=_0x1a1fa5-0x0;var _0x2d7171=_0xa288[_0x1a1fa5];return _0x2d7171;};'use strict';var util=require(_0x8a28('0x0'));var _=require('lodash');var moment=require(_0x8a28('0x1'));var ami=require(_0x8a28('0x2'));var logger=require(_0x8a28('0x3'))(_0x8a28('0x4'));var RpcUser=require(_0x8a28('0x5'));var RpcVoiceAgentReport=require(_0x8a28('0x6'));function Acw(_0x243c0d){this[_0x8a28('0x7')]=_0x243c0d[_0x8a28('0x7')];this[_0x8a28('0x8')]=_0x243c0d[_0x8a28('0x8')];this[_0x8a28('0x9')]=_0x243c0d[_0x8a28('0x9')];this[_0x8a28('0xa')]={};ami['on'](_0x8a28('0xb'),this[_0x8a28('0xc')][_0x8a28('0xd')](this));ami['on'](_0x8a28('0xe'),this[_0x8a28('0xf')][_0x8a28('0xd')](this));ami['on']('hangup',this[_0x8a28('0x10')][_0x8a28('0xd')](this));ami['on'](_0x8a28('0x11'),this[_0x8a28('0x12')][_0x8a28('0xd')](this));ami['on'](_0x8a28('0x13'),this[_0x8a28('0x14')][_0x8a28('0xd')](this));ami['on'](_0x8a28('0x15'),this[_0x8a28('0x16')][_0x8a28('0xd')](this));ami['on'](_0x8a28('0x17'),this[_0x8a28('0x18')]['bind'](this));}function getDiff(_0x1cd0d7){var _0x54952b=moment()[_0x8a28('0x19')](0x0);var _0x48043b=moment(_0x1cd0d7)['milliseconds'](0x0);return _0x54952b['diff'](_0x48043b,_0x8a28('0x1a'));}Acw[_0x8a28('0x1b')][_0x8a28('0x1c')]=function(_0x26392d){try{var _0x4a7155=this;var _0x481d9a=this[_0x8a28('0xa')][_0x26392d][_0x8a28('0x1d')];var _0x383353=this['channels'][_0x26392d][_0x8a28('0x1e')];var _0x3de308=this['voiceQueues'][_0x383353];var _0x32a8f8=![];var _0x376bbc=_0x8a28('0x1f');if(_0x3de308[_0x8a28('0x20')]){if(_0x3de308[_0x8a28('0x21')][_0x8a28('0x22')]){_0x32a8f8=!![];_0x376bbc=_0x3de308[_0x8a28('0x21')][_0x8a28('0x22')];}}ami['Action']({'action':_0x8a28('0x23'),'interface':_0x481d9a,'paused':!![],'reason':_0x376bbc})[_0x8a28('0x24')](function(_0x384448){if(_0x4a7155[_0x8a28('0x8')][_0x481d9a]){return RpcUser[_0x8a28('0x25')](_0x4a7155[_0x8a28('0x8')][_0x481d9a]['id'])[_0x8a28('0x24')](function(_0x35a5ed){if(_0x35a5ed&&!_0x35a5ed[_0x8a28('0x26')]){logger[_0x8a28('0x27')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x26392d,_0x481d9a,_0x383353);var _0x5c04e1=_0x4a7155[_0x8a28('0xa')][_0x26392d][_0x8a28('0x28')]&&_0x4a7155[_0x8a28('0xa')][_0x26392d][_0x8a28('0x29')]?_0x4a7155[_0x8a28('0xa')][_0x26392d]['destlinkedid']:_0x26392d;return RpcUser[_0x8a28('0x2a')](_0x4a7155[_0x8a28('0x8')][_0x481d9a],_0x376bbc,_0x5c04e1)[_0x8a28('0x24')](function(_0x26a189){if(!_0x32a8f8){_0x4a7155[_0x8a28('0x9')][_0x481d9a]={};logger[_0x8a28('0x27')](_0x8a28('0x2b'),_0x26392d,_0x4a7155[_0x8a28('0x7')][_0x383353][_0x8a28('0x2c')],_0x481d9a,_0x383353);_0x4a7155[_0x8a28('0x9')][_0x481d9a]['timer']=setTimeout(_0x4a7155[_0x8a28('0x2d')][_0x8a28('0xd')](_0x4a7155,_0x481d9a),_0x4a7155[_0x8a28('0x7')][_0x383353][_0x8a28('0x2c')]*0x3e8);_0x4a7155['timers'][_0x481d9a][_0x8a28('0x2e')]=moment()[_0x8a28('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a7155[_0x8a28('0x9')][_0x481d9a]['uniqueid']=_0x26392d;_0x4a7155['timers'][_0x481d9a]['queue']=_0x383353;_0x4a7155[_0x8a28('0x9')][_0x481d9a][_0x8a28('0x30')]=function(){var _0x42358e=getDiff(_0x4a7155[_0x8a28('0x9')][_0x481d9a][_0x8a28('0x2e')]);clearTimeout(_0x4a7155['timers'][_0x481d9a][_0x8a28('0x31')]);_0x4a7155[_0x8a28('0x9')][_0x481d9a][_0x8a28('0x31')]=![];RpcVoiceAgentReport[_0x8a28('0x32')]({'acwtime':_0x42358e},_0x4a7155['timers'][_0x481d9a][_0x8a28('0x33')],_0x481d9a)[_0x8a28('0x24')](function(_0x1254f7){logger[_0x8a28('0x27')](_0x8a28('0x34'),_0x26392d,_0x42358e,_0x1254f7);})[_0x8a28('0x35')](function(_0x2d1404){logger[_0x8a28('0x36')]('[%s][UPDATE][ERRORS:%s]',_0x26392d,_0x2d1404);});delete _0x4a7155['timers'][_0x481d9a];};}});}else{logger[_0x8a28('0x27')](_0x8a28('0x37'),_0x26392d,_0x481d9a,_0x383353);}});}})[_0x8a28('0x35')](function(_0x368efd){logger[_0x8a28('0x36')](_0x8a28('0x2b'),_0x26392d,_0x4a7155[_0x8a28('0x7')][_0x383353][_0x8a28('0x2c')],_0x481d9a,_0x383353);})[_0x8a28('0x38')](function(){delete _0x4a7155[_0x8a28('0xa')][_0x26392d];});}catch(_0x54ee1e){logger['error'](_0x8a28('0x39'),_0x54ee1e['message']);}};Acw['prototype']['stopAcw']=function(_0x3fd03c){try{var _0x4f0173=this;if(_0x4f0173[_0x8a28('0x9')][_0x3fd03c]){_0x4f0173[_0x8a28('0x9')][_0x3fd03c][_0x8a28('0x31')]=![];var _0x4fb63b=_0x4f0173[_0x8a28('0x9')][_0x3fd03c][_0x8a28('0x33')];var _0x40e3ff=_0x4f0173[_0x8a28('0x9')][_0x3fd03c][_0x8a28('0x1e')];var _0x2e09a9=_0x4f0173['voiceQueues'][_0x40e3ff][_0x8a28('0x2c')];logger['info'](_0x8a28('0x3a'),_0x4fb63b,_0x3fd03c);RpcUser[_0x8a28('0x3b')](this['agents'][_0x3fd03c]);RpcVoiceAgentReport[_0x8a28('0x32')]({'acwtime':_0x2e09a9,'agentacw':!![]},_0x4fb63b,_0x3fd03c)[_0x8a28('0x24')](function(_0x37e16d){logger[_0x8a28('0x27')](_0x8a28('0x34'),_0x4fb63b,_0x2e09a9,_0x37e16d);})[_0x8a28('0x35')](function(_0x1186df){logger['error'](_0x8a28('0x3c'),_0x4fb63b,_0x1186df);});}else{logger[_0x8a28('0x36')](_0x8a28('0x3d'),_0x3fd03c);if(_0x4f0173[_0x8a28('0x9')]){logger['info'](_0x8a28('0x3e'),JSON[_0x8a28('0x3f')](_0x4f0173[_0x8a28('0x9')]));}}}catch(_0x46bc7f){logger['error'](_0x8a28('0x40'),_0x46bc7f[_0x8a28('0x41')]);}};Acw[_0x8a28('0x1b')][_0x8a28('0xc')]=function(_0x3f1a79){try{if(this[_0x8a28('0x7')][_0x3f1a79['queue']]&&(this[_0x8a28('0x7')][_0x3f1a79[_0x8a28('0x1e')]][_0x8a28('0x4')]||this[_0x8a28('0x7')][_0x3f1a79['queue']]['mandatoryDisposition'])){if(this['agents'][_0x3f1a79['interface']]){this[_0x8a28('0xa')][_0x3f1a79[_0x8a28('0x33')]]={'queue':_0x3f1a79[_0x8a28('0x1e')],'interface':_0x3f1a79[_0x8a28('0x1d')],'destlinkedid':_0x3f1a79[_0x8a28('0x29')]};}}}catch(_0x25851f){logger[_0x8a28('0x36')](_0x8a28('0x42'),_0x25851f[_0x8a28('0x41')]);}};Acw[_0x8a28('0x1b')][_0x8a28('0x18')]=function(_0xf4de94){try{if(this[_0x8a28('0x7')][_0xf4de94[_0x8a28('0x1e')]]&&(this['voiceQueues'][_0xf4de94[_0x8a28('0x1e')]][_0x8a28('0x4')]||this['voiceQueues'][_0xf4de94[_0x8a28('0x1e')]][_0x8a28('0x20')])){if(this[_0x8a28('0x8')][_0xf4de94[_0x8a28('0x1d')]]){this[_0x8a28('0xa')][_0xf4de94[_0x8a28('0x33')]]={'queue':_0xf4de94[_0x8a28('0x1e')],'interface':_0xf4de94['interface']};}}}catch(_0x192b6a){logger[_0x8a28('0x36')]('[ACW][syncAgentConnectPreview]\x20%s',_0x192b6a[_0x8a28('0x41')]);}};Acw[_0x8a28('0x1b')][_0x8a28('0xf')]=function(_0x13e676){try{if(this[_0x8a28('0xa')][_0x13e676[_0x8a28('0x33')]]&&_[_0x8a28('0x43')](this['channels'][_0x13e676[_0x8a28('0x33')]]['attended'])){logger[_0x8a28('0x27')](_0x8a28('0x44'),_0x13e676[_0x8a28('0x33')]);this[_0x8a28('0x1c')](_0x13e676[_0x8a28('0x33')]);}else if(this[_0x8a28('0xa')][_0x13e676[_0x8a28('0x45')]]&&_[_0x8a28('0x43')](this[_0x8a28('0xa')][_0x13e676['linkedid']][_0x8a28('0x28')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x13e676['linkedid']);this[_0x8a28('0x1c')](_0x13e676[_0x8a28('0x45')]);}}catch(_0x20141b){logger[_0x8a28('0x36')](_0x8a28('0x46'),_0x20141b[_0x8a28('0x41')]);}};Acw[_0x8a28('0x1b')]['syncHangup']=function(_0xd3f0a3){try{if(this['channels'][_0xd3f0a3['uniqueid']]&&this[_0x8a28('0xa')][_0xd3f0a3[_0x8a28('0x33')]][_0x8a28('0x28')]){logger['info'](_0x8a28('0x47'),_0xd3f0a3[_0x8a28('0x33')]);this[_0x8a28('0x1c')](_0xd3f0a3['uniqueid']);}else if(this['channels'][_0xd3f0a3[_0x8a28('0x45')]]&&this[_0x8a28('0xa')][_0xd3f0a3[_0x8a28('0x45')]][_0x8a28('0x28')]){logger[_0x8a28('0x27')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0xd3f0a3['linkedid']);this[_0x8a28('0x1c')](_0xd3f0a3['linkedid']);}}catch(_0x10abae){logger[_0x8a28('0x36')](_0x8a28('0x48'),_0x10abae[_0x8a28('0x41')]);}};Acw[_0x8a28('0x1b')]['syncAttendedTransfer']=function(_0x57f330){try{if(!_[_0x8a28('0x49')](this[_0x8a28('0xa')][_0x57f330['transfereeuniqueid']])){this['startAcw'](_0x57f330[_0x8a28('0x4a')]);if(this[_0x8a28('0xa')][_0x57f330[_0x8a28('0x4b')]]){this[_0x8a28('0xa')][_0x57f330[_0x8a28('0x4b')]][_0x8a28('0x28')]=!![];this['channels'][_0x57f330['transfertargetuniqueid']]=this[_0x8a28('0xa')][_0x57f330[_0x8a28('0x4b')]];delete this[_0x8a28('0xa')][_0x57f330['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x8a28('0xa')][_0x57f330[_0x8a28('0x4c')]])){this[_0x8a28('0x1c')](_0x57f330[_0x8a28('0x4c')]);if(this[_0x8a28('0xa')][_0x57f330[_0x8a28('0x4d')]]){this[_0x8a28('0xa')][_0x57f330[_0x8a28('0x4d')]][_0x8a28('0x28')]=!![];this[_0x8a28('0xa')][_0x57f330[_0x8a28('0x4a')]]=this[_0x8a28('0xa')][_0x57f330[_0x8a28('0x4d')]];delete this[_0x8a28('0xa')][_0x57f330['origtransfereruniqueid']];}}}catch(_0x5035f5){logger['error'](_0x8a28('0x4e'),_0x5035f5[_0x8a28('0x41')]);}};Acw[_0x8a28('0x1b')]['syncBlindTransfer']=function(_0x3030c5){try{if(this[_0x8a28('0xa')][_0x3030c5[_0x8a28('0x4f')]]){logger['info'](_0x8a28('0x50'),JSON[_0x8a28('0x3f')](_0x3030c5['transfereruniqueid']));this[_0x8a28('0x1c')](_0x3030c5['transfereruniqueid']);}else if(this['channels'][_0x3030c5[_0x8a28('0x51')]]){logger[_0x8a28('0x27')](_0x8a28('0x52'),JSON[_0x8a28('0x3f')](_0x3030c5[_0x8a28('0x51')]));this[_0x8a28('0x1c')](_0x3030c5[_0x8a28('0x51')]);}}catch(_0x1fc1e2){logger[_0x8a28('0x36')](_0x8a28('0x53'),_0x1fc1e2[_0x8a28('0x41')]);}};Acw[_0x8a28('0x1b')][_0x8a28('0x12')]=function(_0x22cac5){try{if(this[_0x8a28('0x7')][_0x22cac5[_0x8a28('0x1e')]]&&this[_0x8a28('0x7')][_0x22cac5['queue']][_0x8a28('0x54')]===_0x8a28('0x55')){if(this['agents'][_0x22cac5[_0x8a28('0x1d')]]){logger[_0x8a28('0x27')](_0x8a28('0x56'),_0x22cac5[_0x8a28('0x33')],_0x22cac5[_0x8a28('0x1d')],_0x22cac5[_0x8a28('0x1e')]);return RpcUser[_0x8a28('0x2a')](this[_0x8a28('0x8')][_0x22cac5['interface']],_0x8a28('0x57'),_0x22cac5['uniqueid']);}}}catch(_0x62f98f){logger[_0x8a28('0x36')](_0x8a28('0x58'),_0x62f98f[_0x8a28('0x41')]);}};module[_0x8a28('0x59')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 8a33484..71aa125 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 _0x562c=['connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionSipShowRegistry','actionSipPeerStatus','catch','bluebird','util','lodash','ami','asterisk','username','password','keepConnected','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','Action','sipshowregistry','actionDeviceStateList','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close'];(function(_0x39b4b8,_0xc2ae72){var _0x4aa082=function(_0x447f37){while(--_0x447f37){_0x39b4b8['push'](_0x39b4b8['shift']());}};_0x4aa082(++_0xc2ae72);}(_0x562c,0xb4));var _0xc562=function(_0x4434dd,_0x52bfbf){_0x4434dd=_0x4434dd-0x0;var _0x1f1ff0=_0x562c[_0x4434dd];return _0x1f1ff0;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xc562('0x0'));var moment=require('moment');var util=require(_0xc562('0x1'));var _=require(_0xc562('0x2'));var logger=require('../../config/logger')(_0xc562('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0xc562('0x4')]['port'],config[_0xc562('0x4')]['ip'],config[_0xc562('0x4')][_0xc562('0x5')],config['asterisk'][_0xc562('0x6')],!![]);ami[_0xc562('0x7')]();ami['Action']=BPromise['promisify'](ami[_0xc562('0x8')]);function error(_0x4bdd5d){logger[_0xc562('0x9')](util[_0xc562('0xa')](_0xc562('0xb'),config[_0xc562('0x4')]['username'],config[_0xc562('0x4')]['ip'],config[_0xc562('0x4')][_0xc562('0xc')],util['inspect'](_0x4bdd5d,![],null)));}function close(){logger[_0xc562('0x9')](util[_0xc562('0xa')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xc562('0x4')][_0xc562('0x5')],config[_0xc562('0x4')]['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xc562('0xd')]({'action':_0xc562('0xe')});};};ami[_0xc562('0xf')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xc562('0xd')]({'action':'sippeerstatus'});};};ami[_0xc562('0x10')]=function(){return function(){return ami[_0xc562('0xd')]({'action':_0xc562('0x11')});};};ami[_0xc562('0x12')]=function(){return function(){return ami[_0xc562('0xd')]({'action':_0xc562('0x13')});};};function connect(_0x3eeb00){logger[_0xc562('0x14')](util[_0xc562('0xa')](_0xc562('0x15'),config[_0xc562('0x4')][_0xc562('0x5')],config['asterisk']['ip'],config[_0xc562('0x4')][_0xc562('0xc')]));ami[_0xc562('0x16')](_0xc562('0x9'),error);ami[_0xc562('0x16')](_0xc562('0x17'),close);}ami['on'](_0xc562('0x18'),connect);ami['on'](_0xc562('0x19'),function(_0x550100){logger['info'](util[_0xc562('0xa')](_0xc562('0x1a'),config[_0xc562('0x4')]['username'],config[_0xc562('0x4')]['ip'],config['asterisk'][_0xc562('0xc')],util[_0xc562('0x1b')](_0x550100,![],null)));});ami['on'](_0xc562('0x1c'),function(_0x82f275){logger[_0xc562('0x14')](util[_0xc562('0xa')](_0xc562('0x1d'),config[_0xc562('0x4')][_0xc562('0x5')],config['asterisk']['ip'],config['asterisk'][_0xc562('0xc')]));return BPromise['resolve']()[_0xc562('0x1e')](ami[_0xc562('0x1f')]())['then'](ami[_0xc562('0xf')]())[_0xc562('0x1e')](ami[_0xc562('0x20')]())[_0xc562('0x1e')](ami[_0xc562('0x10')]())[_0xc562('0x1e')](ami[_0xc562('0x12')]())[_0xc562('0x21')](function(_0x46d883){console['log'](_0x46d883);});});ami['once'](_0xc562('0x9'),error);ami[_0xc562('0x16')](_0xc562('0x17'),close);module['exports']=ami; \ No newline at end of file +var _0x3fa8=['moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','actionSipShowRegistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','catch','exports','asterisk-manager','bluebird'];(function(_0x2af29a,_0x4f44bc){var _0x5ef02f=function(_0x4349ef){while(--_0x4349ef){_0x2af29a['push'](_0x2af29a['shift']());}};_0x5ef02f(++_0x4f44bc);}(_0x3fa8,0x13e));var _0x83fa=function(_0x568bba,_0x2cabca){_0x568bba=_0x568bba-0x0;var _0x3b49e0=_0x3fa8[_0x568bba];return _0x3b49e0;};'use strict';var Manager=require(_0x83fa('0x0'));var BPromise=require(_0x83fa('0x1'));var moment=require(_0x83fa('0x2'));var util=require(_0x83fa('0x3'));var _=require(_0x83fa('0x4'));var logger=require(_0x83fa('0x5'))(_0x83fa('0x6'));var config=require(_0x83fa('0x7'));var ami=new Manager(config['asterisk']['port'],config[_0x83fa('0x8')]['ip'],config[_0x83fa('0x8')][_0x83fa('0x9')],config[_0x83fa('0x8')][_0x83fa('0xa')],!![]);ami[_0x83fa('0xb')]();ami[_0x83fa('0xc')]=BPromise[_0x83fa('0xd')](ami[_0x83fa('0xe')]);function error(_0x2b6360){logger[_0x83fa('0xf')](util[_0x83fa('0x10')](_0x83fa('0x11'),config['asterisk'][_0x83fa('0x9')],config[_0x83fa('0x8')]['ip'],config[_0x83fa('0x8')][_0x83fa('0x12')],util['inspect'](_0x2b6360,![],null)));}function close(){logger[_0x83fa('0xf')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x83fa('0x8')][_0x83fa('0x9')],config['asterisk']['ip'],config[_0x83fa('0x8')]['port']));}ami[_0x83fa('0x13')]=function(){return function(){return ami[_0x83fa('0xc')]({'action':'sipshowregistry'});};};ami[_0x83fa('0x14')]=function(){return function(){return ami[_0x83fa('0xc')]({'action':_0x83fa('0x15')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x83fa('0xc')]({'action':_0x83fa('0x16')});};};ami[_0x83fa('0x17')]=function(){return function(){return ami[_0x83fa('0xc')]({'action':_0x83fa('0x18')});};};ami[_0x83fa('0x19')]=function(){return function(){return ami[_0x83fa('0xc')]({'action':_0x83fa('0x1a')});};};function connect(_0x41b14b){logger[_0x83fa('0x1b')](util[_0x83fa('0x10')](_0x83fa('0x1c'),config['asterisk'][_0x83fa('0x9')],config[_0x83fa('0x8')]['ip'],config[_0x83fa('0x8')][_0x83fa('0x12')]));ami[_0x83fa('0x1d')](_0x83fa('0xf'),error);ami[_0x83fa('0x1d')](_0x83fa('0x1e'),close);}ami['on'](_0x83fa('0x1f'),connect);ami['on']('shutdown',function(_0x286696){logger[_0x83fa('0x1b')](util[_0x83fa('0x10')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x83fa('0x8')]['username'],config[_0x83fa('0x8')]['ip'],config[_0x83fa('0x8')][_0x83fa('0x12')],util[_0x83fa('0x20')](_0x286696,![],null)));});ami['on'](_0x83fa('0x21'),function(_0x21ee89){logger[_0x83fa('0x1b')](util[_0x83fa('0x10')](_0x83fa('0x22'),config['asterisk']['username'],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x83fa('0x23')]()[_0x83fa('0x24')](ami[_0x83fa('0x13')]())['then'](ami[_0x83fa('0x14')]())[_0x83fa('0x24')](ami[_0x83fa('0x25')]())[_0x83fa('0x24')](ami[_0x83fa('0x17')]())[_0x83fa('0x24')](ami[_0x83fa('0x19')]())[_0x83fa('0x26')](function(_0x235165){console['log'](_0x235165);});});ami[_0x83fa('0x1d')](_0x83fa('0xf'),error);ami[_0x83fa('0x1d')](_0x83fa('0x1e'),close);module[_0x83fa('0x27')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 567bec5..dd12ca3 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 _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x574b08,_0x327679){var _0x4a555b=function(_0x221ce6){while(--_0x221ce6){_0x574b08['push'](_0x574b08['shift']());}};_0x4a555b(++_0x327679);}(_0xaa88,0x137));var _0x8aa8=function(_0x1a8ff0,_0x20788d){_0x1a8ff0=_0x1a8ff0-0x0;var _0x3588bf=_0xaa88[_0x1a8ff0];return _0x3588bf;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file +var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x16e5b3,_0x30d91d){var _0x4d6874=function(_0x2fffbe){while(--_0x2fffbe){_0x16e5b3['push'](_0x16e5b3['shift']());}};_0x4d6874(++_0x30d91d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 16c67ab..46819fe 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 _0x09bd=['originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','prototype','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme'];(function(_0x225197,_0x4e19d7){var _0x2d2ccc=function(_0x59dc1a){while(--_0x59dc1a){_0x225197['push'](_0x225197['shift']());}};_0x2d2ccc(++_0x4e19d7);}(_0x09bd,0x118));var _0xd09b=function(_0x509da2,_0xd2f81a){_0x509da2=_0x509da2-0x0;var _0x277535=_0x09bd[_0x509da2];return _0x277535;};'use strict';var util=require(_0xd09b('0x0'));var _=require('lodash');var moment=require(_0xd09b('0x1'));function checkNameSurname(_0x52669c,_0x50051f,_0x68d2c7){var _0x3b24be='';if(!_[_0xd09b('0x2')](_0x50051f)&&_0xd09b('0x3')===typeof _0x50051f){_0x3b24be+=_0x50051f;}if(!_[_0xd09b('0x2')](_0x68d2c7)&&_0xd09b('0x3')===typeof _0x68d2c7){_0x3b24be+='\x20'+_0x68d2c7;}if(_0x3b24be!==''){return _0x3b24be;}return _0x52669c;}function Action(_0x14b9e9,_0x394109,_0x2b7603){this[_0xd09b('0x4')]=_0x14b9e9;this[_0xd09b('0x5')]=_0x2b7603||undefined;this[_0xd09b('0x6')]=checkNameSurname(_0x394109[_0xd09b('0x7')][_0xd09b('0x8')],_0x394109[_0xd09b('0x7')][_0xd09b('0x9')],_0x394109[_0xd09b('0x7')][_0xd09b('0xa')]);this['number']=_0x394109['Contact'][_0xd09b('0x8')];this['queue']=_0x14b9e9['name'];this[_0xd09b('0xb')]=_0x394109[_0xd09b('0xb')]||![];this[_0xd09b('0xc')]=_0x14b9e9['type'];this[_0xd09b('0xd')]=_0x14b9e9[_0xd09b('0xd')]||0x3;this[_0xd09b('0xe')]=_0x394109[_0xd09b('0xe')];this['countbusyretry']=_0x394109[_0xd09b('0xf')];this[_0xd09b('0x10')]=_0x394109[_0xd09b('0x10')];this['countnoanswerretry']=_0x394109[_0xd09b('0x11')];this['countnosuchnumberretry']=_0x394109[_0xd09b('0x12')];this[_0xd09b('0x13')]=_0x394109[_0xd09b('0x13')];this[_0xd09b('0x14')]=_0x394109[_0xd09b('0x14')];this[_0xd09b('0x15')]=_0x394109[_0xd09b('0x15')];this['countagentrejectretry']=_0x394109['countagentrejectretry'];this[_0xd09b('0x16')]=_0x394109['ContactId'];this[_0xd09b('0x17')]=_0x394109['ListId'];this[_0xd09b('0x18')]=_0x394109[_0xd09b('0x18')];this[_0xd09b('0x19')]=_0x394109['VoiceQueueId'];this[_0xd09b('0x1a')]=_0x394109[_0xd09b('0x1a')];this[_0xd09b('0x1b')]=_0x394109['id'];this[_0xd09b('0x1c')]=_0x394109[_0xd09b('0x7')][_0xd09b('0x9')]||'';this[_0xd09b('0x1d')]=moment()['format'](_0xd09b('0x1e'));this[_0xd09b('0x1f')]=_0x394109['callback'];this[_0xd09b('0x20')]=_0x394109[_0xd09b('0x20')];this['callbackat']=_0x394109[_0xd09b('0x21')];this['recallme']=_0x394109[_0xd09b('0x22')];this[_0xd09b('0x23')]='';this[_0xd09b('0x24')]='';}Action['prototype'][_0xd09b('0x25')]=function(){return util[_0xd09b('0x26')](_0xd09b('0x27'),this[_0xd09b('0x6')],this['voiceQueue'][_0xd09b('0x28')]>0x0?this[_0xd09b('0x29')][_0xd09b('0x2a')](this[_0xd09b('0x4')][_0xd09b('0x28')]):this['number']);};Action[_0xd09b('0x2b')]['getQueue']=function(){return this['queue'];};module[_0xd09b('0x2c')]=Action; \ No newline at end of file +var _0xe39c=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','number','getQueue','exports','util','moment','isNil','string','voiceQueue','name','Contact','phone','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry'];(function(_0x250610,_0x40bfe8){var _0x2aaece=function(_0x83328){while(--_0x83328){_0x250610['push'](_0x250610['shift']());}};_0x2aaece(++_0x40bfe8);}(_0xe39c,0x1a8));var _0xce39=function(_0x17b9e2,_0x3921fa){_0x17b9e2=_0x17b9e2-0x0;var _0x4335d2=_0xe39c[_0x17b9e2];return _0x4335d2;};'use strict';var util=require(_0xce39('0x0'));var _=require('lodash');var moment=require(_0xce39('0x1'));function checkNameSurname(_0x1b6695,_0x4a2e07,_0x3a5ff4){var _0x1410ae='';if(!_[_0xce39('0x2')](_0x4a2e07)&&_0xce39('0x3')===typeof _0x4a2e07){_0x1410ae+=_0x4a2e07;}if(!_['isNil'](_0x3a5ff4)&&_0xce39('0x3')===typeof _0x3a5ff4){_0x1410ae+='\x20'+_0x3a5ff4;}if(_0x1410ae!==''){return _0x1410ae;}return _0x1b6695;}function Action(_0x505af8,_0xdecabe,_0x2130e7){this[_0xce39('0x4')]=_0x505af8;this['uniqueid']=_0x2130e7||undefined;this[_0xce39('0x5')]=checkNameSurname(_0xdecabe[_0xce39('0x6')][_0xce39('0x7')],_0xdecabe[_0xce39('0x6')]['firstName'],_0xdecabe[_0xce39('0x6')][_0xce39('0x8')]);this['number']=_0xdecabe[_0xce39('0x6')][_0xce39('0x7')];this[_0xce39('0x9')]=_0x505af8[_0xce39('0x5')];this[_0xce39('0xa')]=_0xdecabe[_0xce39('0xa')]||![];this['type']=_0x505af8[_0xce39('0xb')];this[_0xce39('0xc')]=_0x505af8['dialQueueTimeout']||0x3;this['scheduledat']=_0xdecabe[_0xce39('0xd')];this[_0xce39('0xe')]=_0xdecabe[_0xce39('0xe')];this['countcongestionretry']=_0xdecabe['countcongestionretry'];this[_0xce39('0xf')]=_0xdecabe[_0xce39('0xf')];this[_0xce39('0x10')]=_0xdecabe[_0xce39('0x10')];this[_0xce39('0x11')]=_0xdecabe[_0xce39('0x11')];this[_0xce39('0x12')]=_0xdecabe['countabandonedretry'];this[_0xce39('0x13')]=_0xdecabe[_0xce39('0x13')];this[_0xce39('0x14')]=_0xdecabe[_0xce39('0x14')];this[_0xce39('0x15')]=_0xdecabe[_0xce39('0x15')];this[_0xce39('0x16')]=_0xdecabe[_0xce39('0x16')];this[_0xce39('0x17')]=_0xdecabe[_0xce39('0x17')];this[_0xce39('0x18')]=_0xdecabe[_0xce39('0x18')];this[_0xce39('0x19')]=_0xdecabe[_0xce39('0x19')];this[_0xce39('0x1a')]=_0xdecabe['id'];this['ContactFirstName']=_0xdecabe[_0xce39('0x6')][_0xce39('0x1b')]||'';this[_0xce39('0x1c')]=moment()[_0xce39('0x1d')](_0xce39('0x1e'));this['callback']=_0xdecabe[_0xce39('0x1f')];this[_0xce39('0x20')]=_0xdecabe[_0xce39('0x20')];this['callbackat']=_0xdecabe[_0xce39('0x21')];this['recallme']=_0xdecabe[_0xce39('0x22')];this[_0xce39('0x23')]='';this[_0xce39('0x24')]='';}Action[_0xce39('0x25')]['getCaller']=function(){return util[_0xce39('0x1d')](_0xce39('0x26'),this[_0xce39('0x5')],this[_0xce39('0x4')][_0xce39('0x27')]>0x0?this['number'][_0xce39('0x28')](this[_0xce39('0x4')][_0xce39('0x27')]):this[_0xce39('0x29')]);};Action['prototype'][_0xce39('0x2a')]=function(){return this[_0xce39('0x9')];};module[_0xce39('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index d3074a7..384d723 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 _0x4785=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','reason','callback'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4785,0x1ef));var _0x5478=function(_0x19416d,_0x54c85e){_0x19416d=_0x19416d-0x0;var _0x17528f=_0x4785[_0x19416d];return _0x17528f;};'use strict';var util=require(_0x5478('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x5aff1b,_0x1fe758){var _0x15f875=moment(_0x5aff1b)[_0x5478('0x1')](0x0);var _0xee4bf2=moment(_0x1fe758)['milliseconds'](0x0);return _0x15f875[_0x5478('0x2')](_0xee4bf2,_0x5478('0x3'));}function AgentComplete(_0x43ab25,_0x4c29c0){this['state']=0x4;this[_0x5478('0x4')]=_0x5478('0x5');this[_0x5478('0x6')]=_0x43ab25[_0x5478('0x6')];this['type']=_0x43ab25[_0x5478('0x7')];this['campaigntype']=_0x43ab25[_0x5478('0x7')]===_0x5478('0x8')?_0x5478('0x9'):_0x43ab25[_0x5478('0x7')];this[_0x5478('0xa')]=_0x43ab25[_0x5478('0xa')];this[_0x5478('0xb')]=_0x43ab25[_0x5478('0xb')];this[_0x5478('0xc')]=_0x43ab25['countnoanswerretry'];this[_0x5478('0xd')]=_0x43ab25['countbusyretry']+_0x43ab25[_0x5478('0xb')]+_0x43ab25['countnoanswerretry']+_0x43ab25[_0x5478('0xe')]+_0x43ab25[_0x5478('0xf')]+_0x43ab25[_0x5478('0x10')]+_0x43ab25['countmachineretry']+_0x43ab25['countagentrejectretry'];this['countnosuchnumberretry']=_0x43ab25['countnosuchnumberretry'];this[_0x5478('0xf')]=_0x43ab25[_0x5478('0xf')];this[_0x5478('0x10')]=_0x43ab25['countabandonedretry'];this['countmachineretry']=_0x43ab25['countmachineretry'];this[_0x5478('0x11')]=_0x43ab25[_0x5478('0x11')];this[_0x5478('0x12')]=_0x4c29c0[_0x5478('0x12')];this[_0x5478('0x13')]=_0x43ab25[_0x5478('0x14')];this[_0x5478('0x15')]=_0x43ab25[_0x5478('0x16')];this[_0x5478('0x17')]=_0x43ab25[_0x5478('0x17')];this[_0x5478('0x18')]=_0x43ab25[_0x5478('0x18')];this[_0x5478('0x19')]=_0x43ab25['answertime'];this[_0x5478('0x1a')]=moment()['format'](_0x5478('0x1b'));this[_0x5478('0x1c')]=getSeconds(_0x43ab25[_0x5478('0x18')],_0x43ab25['starttime']);this[_0x5478('0x1d')]=getSeconds(_0x43ab25['answertime'],_0x43ab25['responsetime']);this[_0x5478('0x1e')]=getSeconds(this[_0x5478('0x1a')],_0x43ab25[_0x5478('0x19')]);this[_0x5478('0x9')]=_0x4c29c0[_0x5478('0x9')];this['membername']=_0x4c29c0['membername'];this[_0x5478('0x1f')]=_0x4c29c0[_0x5478('0x1f')];this[_0x5478('0x20')]=_0x43ab25[_0x5478('0x20')];this[_0x5478('0x21')]=_0x43ab25[_0x5478('0x21')];this[_0x5478('0x22')]=_0x43ab25['callbackat'];this['recallme']=_0x43ab25[_0x5478('0x23')];this[_0x5478('0x24')]=_0x43ab25[_0x5478('0x24')];this['ListId']=_0x43ab25[_0x5478('0x25')];this[_0x5478('0x26')]=_0x43ab25[_0x5478('0x26')];this[_0x5478('0x27')]=_0x43ab25[_0x5478('0x27')];this[_0x5478('0x28')]=_0x43ab25['CampaignId'];this[_0x5478('0x29')]=_0x43ab25[_0x5478('0x29')]||'';this[_0x5478('0x2a')]=_0x43ab25['originatecalleridname']||'';}module[_0x5478('0x2b')]=AgentComplete; \ No newline at end of file +var _0xc6c9=['calleridnum','number','answertime','format','YYYY-MM-DD\x20HH:mm:ss','responsetime','starttime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','lodash','moment','milliseconds','diff','seconds','state','statedesc','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname'];(function(_0x46c923,_0x539ee6){var _0x25c4d5=function(_0xc8b881){while(--_0xc8b881){_0x46c923['push'](_0x46c923['shift']());}};_0x25c4d5(++_0x539ee6);}(_0xc6c9,0x18f));var _0x9c6c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc6c9[_0x397e5f];return _0x5302b8;};'use strict';var util=require('util');var _=require(_0x9c6c('0x0'));var moment=require(_0x9c6c('0x1'));function getSeconds(_0xa71f9e,_0x281582){var _0x1ca134=moment(_0xa71f9e)[_0x9c6c('0x2')](0x0);var _0x3b1ed9=moment(_0x281582)[_0x9c6c('0x2')](0x0);return _0x1ca134[_0x9c6c('0x3')](_0x3b1ed9,_0x9c6c('0x4'));}function AgentComplete(_0x5503be,_0x324576){this[_0x9c6c('0x5')]=0x4;this[_0x9c6c('0x6')]='Answer';this['scheduledat']=_0x5503be['scheduledat'];this[_0x9c6c('0x7')]=_0x5503be[_0x9c6c('0x7')];this[_0x9c6c('0x8')]=_0x5503be['type']==='outbound'?_0x9c6c('0x9'):_0x5503be[_0x9c6c('0x7')];this[_0x9c6c('0xa')]=_0x5503be[_0x9c6c('0xa')];this[_0x9c6c('0xb')]=_0x5503be[_0x9c6c('0xb')];this[_0x9c6c('0xc')]=_0x5503be[_0x9c6c('0xc')];this[_0x9c6c('0xd')]=_0x5503be[_0x9c6c('0xa')]+_0x5503be[_0x9c6c('0xb')]+_0x5503be[_0x9c6c('0xc')]+_0x5503be[_0x9c6c('0xe')]+_0x5503be[_0x9c6c('0xf')]+_0x5503be[_0x9c6c('0x10')]+_0x5503be[_0x9c6c('0x11')]+_0x5503be[_0x9c6c('0x12')];this['countnosuchnumberretry']=_0x5503be[_0x9c6c('0xe')];this[_0x9c6c('0xf')]=_0x5503be['countdropretry'];this[_0x9c6c('0x10')]=_0x5503be[_0x9c6c('0x10')];this['countmachineretry']=_0x5503be[_0x9c6c('0x11')];this['countagentrejectretry']=_0x5503be[_0x9c6c('0x12')];this[_0x9c6c('0x13')]=_0x324576['uniqueid'];this[_0x9c6c('0x14')]=_0x5503be['name'];this[_0x9c6c('0x15')]=_0x5503be[_0x9c6c('0x16')];this['starttime']=_0x5503be['starttime'];this['responsetime']=_0x5503be['responsetime'];this[_0x9c6c('0x17')]=_0x5503be[_0x9c6c('0x17')];this['endtime']=moment()[_0x9c6c('0x18')](_0x9c6c('0x19'));this['ringtime']=getSeconds(_0x5503be[_0x9c6c('0x1a')],_0x5503be[_0x9c6c('0x1b')]);this['holdtime']=getSeconds(_0x5503be[_0x9c6c('0x17')],_0x5503be['responsetime']);this[_0x9c6c('0x1c')]=getSeconds(this[_0x9c6c('0x1d')],_0x5503be[_0x9c6c('0x17')]);this[_0x9c6c('0x9')]=_0x324576[_0x9c6c('0x9')];this[_0x9c6c('0x1e')]=_0x324576['membername'];this[_0x9c6c('0x1f')]=_0x324576[_0x9c6c('0x1f')];this['callback']=_0x5503be[_0x9c6c('0x20')];this[_0x9c6c('0x21')]=_0x5503be['callbackuniqueid'];this[_0x9c6c('0x22')]=_0x5503be[_0x9c6c('0x22')];this[_0x9c6c('0x23')]=_0x5503be['recallme'];this[_0x9c6c('0x24')]=_0x5503be['ContactId'];this['ListId']=_0x5503be['ListId'];this['UserId']=_0x5503be[_0x9c6c('0x25')];this[_0x9c6c('0x26')]=_0x5503be[_0x9c6c('0x26')];this[_0x9c6c('0x27')]=_0x5503be[_0x9c6c('0x27')];this[_0x9c6c('0x28')]=_0x5503be[_0x9c6c('0x28')]||'';this['originatecalleridname']=_0x5503be['originatecalleridname']||'';}module[_0x9c6c('0x29')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 9f727c9..a012f34 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 _0x61a5=['scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','moment','milliseconds','diff','uniqueid'];(function(_0x3a4fbe,_0x6a4b91){var _0x5eabd6=function(_0x512b54){while(--_0x512b54){_0x3a4fbe['push'](_0x3a4fbe['shift']());}};_0x5eabd6(++_0x6a4b91);}(_0x61a5,0xf0));var _0x561a=function(_0x5b697a,_0x280202){_0x5b697a=_0x5b697a-0x0;var _0x5de43b=_0x61a5[_0x5b697a];return _0x5de43b;};'use strict';var util=require(_0x561a('0x0'));var _=require('lodash');var moment=require(_0x561a('0x1'));function getSeconds(_0x28892d,_0xc164c0){var _0x862a0e=moment(_0x28892d)[_0x561a('0x2')](0x0);var _0x58f636=moment(_0xc164c0)[_0x561a('0x2')](0x0);return _0x862a0e[_0x561a('0x3')](_0x58f636,'seconds');}function Final(_0x18902a){this[_0x561a('0x4')]=_0x18902a[_0x561a('0x4')];this[_0x561a('0x5')]=_0x18902a[_0x561a('0x5')];this[_0x561a('0x6')]=_0x18902a[_0x561a('0x6')];this['campaigntype']=_0x18902a[_0x561a('0x6')]==='outbound'?_0x561a('0x7'):_0x18902a[_0x561a('0x6')];this['countbusyretry']=_0x18902a[_0x561a('0x8')];this[_0x561a('0x9')]=_0x18902a['countcongestionretry'];this[_0x561a('0xa')]=_0x18902a['countnoanswerretry'];this[_0x561a('0xb')]=_0x18902a[_0x561a('0x8')]+_0x18902a[_0x561a('0x9')]+_0x18902a[_0x561a('0xa')]+_0x18902a[_0x561a('0xc')]+_0x18902a[_0x561a('0xd')]+_0x18902a[_0x561a('0xe')]+_0x18902a[_0x561a('0xf')]+_0x18902a[_0x561a('0x10')];this[_0x561a('0xc')]=_0x18902a[_0x561a('0xc')];this[_0x561a('0xd')]=_0x18902a['countdropretry'];this[_0x561a('0xe')]=_0x18902a[_0x561a('0xe')];this[_0x561a('0xf')]=_0x18902a[_0x561a('0xf')];this[_0x561a('0x10')]=_0x18902a[_0x561a('0x10')];this[_0x561a('0x7')]=_0x18902a[_0x561a('0x7')];this[_0x561a('0x11')]=_0x18902a[_0x561a('0x11')];this[_0x561a('0x12')]=_0x18902a['calleridnum'];this[_0x561a('0x13')]=_0x18902a[_0x561a('0x13')];this['responsetime']=_0x18902a[_0x561a('0x14')];this[_0x561a('0x15')]=_0x18902a['responsetime'];this[_0x561a('0x16')]=_0x18902a['ringtime']||0x0;this['holdtime']=_0x18902a[_0x561a('0x17')]||0x0;this[_0x561a('0x18')]=_0x18902a['talktime']||0x0;this[_0x561a('0x19')]=_0x18902a[_0x561a('0x19')];this[_0x561a('0x1a')]=_0x18902a[_0x561a('0x1a')];this[_0x561a('0x1b')]=_0x18902a[_0x561a('0x1b')];this['recallme']=_0x18902a[_0x561a('0x1c')];this[_0x561a('0x1d')]=_0x18902a[_0x561a('0x1d')];this['ListId']=_0x18902a['ListId'];this[_0x561a('0x1e')]=_0x18902a[_0x561a('0x1e')];this[_0x561a('0x1f')]=_0x18902a[_0x561a('0x1f')];this[_0x561a('0x20')]=_0x18902a[_0x561a('0x20')];this[_0x561a('0x21')]=_0x18902a[_0x561a('0x21')]||'';this['originatecalleridname']=_0x18902a['originatecalleridname']||'';}module[_0x561a('0x22')]=Final; \ No newline at end of file +var _0x8ece=['UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8ece,0x195));var _0xe8ec=function(_0x50ea5e,_0x3640ce){_0x50ea5e=_0x50ea5e-0x0;var _0x5eb4d9=_0x8ece[_0x50ea5e];return _0x5eb4d9;};'use strict';var util=require(_0xe8ec('0x0'));var _=require(_0xe8ec('0x1'));var moment=require(_0xe8ec('0x2'));function getSeconds(_0x309040,_0x4dd5dd){var _0x47b1c1=moment(_0x309040)[_0xe8ec('0x3')](0x0);var _0x30c05a=moment(_0x4dd5dd)[_0xe8ec('0x3')](0x0);return _0x47b1c1[_0xe8ec('0x4')](_0x30c05a,_0xe8ec('0x5'));}function Final(_0x4f2e7f){this[_0xe8ec('0x6')]=_0x4f2e7f[_0xe8ec('0x6')];this[_0xe8ec('0x7')]=_0x4f2e7f[_0xe8ec('0x7')];this[_0xe8ec('0x8')]=_0x4f2e7f[_0xe8ec('0x8')];this[_0xe8ec('0x9')]=_0x4f2e7f['type']===_0xe8ec('0xa')?'queue':_0x4f2e7f[_0xe8ec('0x8')];this['countbusyretry']=_0x4f2e7f[_0xe8ec('0xb')];this[_0xe8ec('0xc')]=_0x4f2e7f[_0xe8ec('0xc')];this[_0xe8ec('0xd')]=_0x4f2e7f[_0xe8ec('0xd')];this[_0xe8ec('0xe')]=_0x4f2e7f[_0xe8ec('0xb')]+_0x4f2e7f[_0xe8ec('0xc')]+_0x4f2e7f[_0xe8ec('0xd')]+_0x4f2e7f[_0xe8ec('0xf')]+_0x4f2e7f[_0xe8ec('0x10')]+_0x4f2e7f[_0xe8ec('0x11')]+_0x4f2e7f[_0xe8ec('0x12')]+_0x4f2e7f['countagentrejectretry'];this[_0xe8ec('0xf')]=_0x4f2e7f[_0xe8ec('0xf')];this[_0xe8ec('0x10')]=_0x4f2e7f[_0xe8ec('0x10')];this[_0xe8ec('0x11')]=_0x4f2e7f[_0xe8ec('0x11')];this[_0xe8ec('0x12')]=_0x4f2e7f[_0xe8ec('0x12')];this['countagentrejectretry']=_0x4f2e7f[_0xe8ec('0x13')];this[_0xe8ec('0x14')]=_0x4f2e7f[_0xe8ec('0x14')];this['calleridname']=_0x4f2e7f[_0xe8ec('0x15')];this[_0xe8ec('0x16')]=_0x4f2e7f[_0xe8ec('0x16')];this[_0xe8ec('0x17')]=_0x4f2e7f[_0xe8ec('0x17')];this[_0xe8ec('0x18')]=_0x4f2e7f[_0xe8ec('0x18')];this[_0xe8ec('0x19')]=_0x4f2e7f['responsetime'];this[_0xe8ec('0x1a')]=_0x4f2e7f[_0xe8ec('0x1a')]||0x0;this[_0xe8ec('0x1b')]=_0x4f2e7f[_0xe8ec('0x1b')]||0x0;this[_0xe8ec('0x1c')]=_0x4f2e7f[_0xe8ec('0x1c')]||0x0;this[_0xe8ec('0x1d')]=_0x4f2e7f[_0xe8ec('0x1d')];this[_0xe8ec('0x1e')]=_0x4f2e7f['callbackuniqueid'];this[_0xe8ec('0x1f')]=_0x4f2e7f[_0xe8ec('0x1f')];this[_0xe8ec('0x20')]=_0x4f2e7f[_0xe8ec('0x20')];this[_0xe8ec('0x21')]=_0x4f2e7f['ContactId'];this[_0xe8ec('0x22')]=_0x4f2e7f[_0xe8ec('0x22')];this[_0xe8ec('0x23')]=_0x4f2e7f[_0xe8ec('0x23')];this[_0xe8ec('0x24')]=_0x4f2e7f[_0xe8ec('0x24')];this['CampaignId']=_0x4f2e7f['CampaignId'];this[_0xe8ec('0x25')]=_0x4f2e7f[_0xe8ec('0x25')]||'';this[_0xe8ec('0x26')]=_0x4f2e7f[_0xe8ec('0x26')]||'';}module[_0xe8ec('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 12c93e2..0f55ef1 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 _0x8d75=['number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','util','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum'];(function(_0x1001b7,_0x5910da){var _0x439d3e=function(_0x19643e){while(--_0x19643e){_0x1001b7['push'](_0x1001b7['shift']());}};_0x439d3e(++_0x5910da);}(_0x8d75,0x116));var _0x58d7=function(_0x53b9f0,_0x3190be){_0x53b9f0=_0x53b9f0-0x0;var _0x3e207a=_0x8d75[_0x53b9f0];return _0x3e207a;};'use strict';var util=require(_0x58d7('0x0'));var _=require('lodash');var moment=require(_0x58d7('0x1'));function getSeconds(_0x1f2da1,_0x394ec5){var _0x3e53bb=moment(_0x1f2da1)[_0x58d7('0x2')](0x0);var _0x224362=moment(_0x394ec5)[_0x58d7('0x2')](0x0);return _0x3e53bb[_0x58d7('0x3')](_0x224362,_0x58d7('0x4'));}function Hangup(_0x3c314c,_0x19a048){this['state']=0x4;this[_0x58d7('0x5')]=_0x58d7('0x6');this[_0x58d7('0x7')]=_0x3c314c[_0x58d7('0x7')];this['type']=_0x3c314c['type'];this[_0x58d7('0x8')]=_0x3c314c['type']===_0x58d7('0x9')?_0x58d7('0xa'):_0x3c314c['type'];this[_0x58d7('0xb')]=_0x3c314c[_0x58d7('0xb')];this['countcongestionretry']=_0x3c314c[_0x58d7('0xc')];this['countnoanswerretry']=_0x3c314c[_0x58d7('0xd')];this['countglobal']=_0x3c314c[_0x58d7('0xb')]+_0x3c314c[_0x58d7('0xc')]+_0x3c314c[_0x58d7('0xd')]+_0x3c314c[_0x58d7('0xe')]+_0x3c314c[_0x58d7('0xf')]+_0x3c314c[_0x58d7('0x10')]+_0x3c314c[_0x58d7('0x11')]+_0x3c314c[_0x58d7('0x12')];this[_0x58d7('0xe')]=_0x3c314c[_0x58d7('0xe')];this[_0x58d7('0xf')]=_0x3c314c[_0x58d7('0xf')];this['countabandonedretry']=_0x3c314c['countabandonedretry'];this[_0x58d7('0x11')]=_0x3c314c[_0x58d7('0x11')];this[_0x58d7('0x12')]=_0x3c314c[_0x58d7('0x12')];this[_0x58d7('0x13')]=_0x19a048[_0x58d7('0x13')];this[_0x58d7('0x14')]=_0x3c314c[_0x58d7('0x15')];this[_0x58d7('0x16')]=_0x3c314c[_0x58d7('0x17')];this[_0x58d7('0x18')]=_0x3c314c[_0x58d7('0x18')];this[_0x58d7('0x19')]=_0x3c314c[_0x58d7('0x19')];this[_0x58d7('0x1a')]=moment()['format'](_0x58d7('0x1b'));this[_0x58d7('0x1c')]=getSeconds(_0x3c314c[_0x58d7('0x19')],_0x3c314c[_0x58d7('0x18')]);this[_0x58d7('0x1d')]=0x0;this[_0x58d7('0x1e')]=getSeconds(this['endtime'],_0x3c314c['responsetime']);this[_0x58d7('0xa')]=_0x3c314c[_0x58d7('0xa')];this[_0x58d7('0x1f')]=_0x58d7('0x20');this[_0x58d7('0x21')]=_0x19a048[_0x58d7('0x22')];this[_0x58d7('0x23')]=_0x3c314c[_0x58d7('0x23')];this[_0x58d7('0x24')]=_0x3c314c[_0x58d7('0x24')];this['callbackat']=_0x3c314c[_0x58d7('0x25')];this[_0x58d7('0x26')]=_0x3c314c[_0x58d7('0x26')];this[_0x58d7('0x27')]=_0x3c314c[_0x58d7('0x27')];this['ListId']=_0x3c314c['ListId'];this[_0x58d7('0x28')]=_0x3c314c[_0x58d7('0x28')];this[_0x58d7('0x29')]=_0x3c314c['VoiceQueueId'];this['CampaignId']=_0x3c314c[_0x58d7('0x2a')];}module['exports']=Hangup; \ No newline at end of file +var _0x9d09=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','diff','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid'];(function(_0x45319d,_0x5a0653){var _0x20f076=function(_0x3da82c){while(--_0x3da82c){_0x45319d['push'](_0x45319d['shift']());}};_0x20f076(++_0x5a0653);}(_0x9d09,0x10a));var _0x99d0=function(_0x14b035,_0x107f28){_0x14b035=_0x14b035-0x0;var _0x13b57b=_0x9d09[_0x14b035];return _0x13b57b;};'use strict';var util=require(_0x99d0('0x0'));var _=require(_0x99d0('0x1'));var moment=require('moment');function getSeconds(_0x241d06,_0x5f2cf8){var _0x5c5f64=moment(_0x241d06)['milliseconds'](0x0);var _0x165a86=moment(_0x5f2cf8)['milliseconds'](0x0);return _0x5c5f64[_0x99d0('0x2')](_0x165a86,'seconds');}function Hangup(_0x177d65,_0x358e48){this[_0x99d0('0x3')]=0x4;this[_0x99d0('0x4')]=_0x99d0('0x5');this[_0x99d0('0x6')]=_0x177d65['scheduledat'];this[_0x99d0('0x7')]=_0x177d65['type'];this[_0x99d0('0x8')]=_0x177d65[_0x99d0('0x7')]==='outbound'?_0x99d0('0x9'):_0x177d65[_0x99d0('0x7')];this[_0x99d0('0xa')]=_0x177d65[_0x99d0('0xa')];this[_0x99d0('0xb')]=_0x177d65['countcongestionretry'];this[_0x99d0('0xc')]=_0x177d65[_0x99d0('0xc')];this['countglobal']=_0x177d65[_0x99d0('0xa')]+_0x177d65['countcongestionretry']+_0x177d65[_0x99d0('0xc')]+_0x177d65[_0x99d0('0xd')]+_0x177d65[_0x99d0('0xe')]+_0x177d65[_0x99d0('0xf')]+_0x177d65[_0x99d0('0x10')]+_0x177d65['countagentrejectretry'];this['countnosuchnumberretry']=_0x177d65[_0x99d0('0xd')];this[_0x99d0('0xe')]=_0x177d65['countdropretry'];this['countabandonedretry']=_0x177d65[_0x99d0('0xf')];this['countmachineretry']=_0x177d65[_0x99d0('0x10')];this[_0x99d0('0x11')]=_0x177d65['countagentrejectretry'];this[_0x99d0('0x12')]=_0x358e48['uniqueid'];this[_0x99d0('0x13')]=_0x177d65['name'];this[_0x99d0('0x14')]=_0x177d65[_0x99d0('0x15')];this[_0x99d0('0x16')]=_0x177d65[_0x99d0('0x16')];this['responsetime']=_0x177d65[_0x99d0('0x17')];this[_0x99d0('0x18')]=moment()[_0x99d0('0x19')](_0x99d0('0x1a'));this[_0x99d0('0x1b')]=getSeconds(_0x177d65['responsetime'],_0x177d65['starttime']);this['holdtime']=0x0;this[_0x99d0('0x1c')]=getSeconds(this[_0x99d0('0x18')],_0x177d65['responsetime']);this['queue']=_0x177d65[_0x99d0('0x9')];this[_0x99d0('0x1d')]=_0x99d0('0x1e');this[_0x99d0('0x1f')]=_0x358e48[_0x99d0('0x20')];this['callback']=_0x177d65[_0x99d0('0x21')];this[_0x99d0('0x22')]=_0x177d65[_0x99d0('0x22')];this[_0x99d0('0x23')]=_0x177d65['callbackat'];this[_0x99d0('0x24')]=_0x177d65['recallme'];this[_0x99d0('0x25')]=_0x177d65[_0x99d0('0x25')];this['ListId']=_0x177d65[_0x99d0('0x26')];this[_0x99d0('0x27')]=_0x177d65[_0x99d0('0x27')];this[_0x99d0('0x28')]=_0x177d65['VoiceQueueId'];this['CampaignId']=_0x177d65[_0x99d0('0x29')];}module[_0x99d0('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index d77bd4c..86a3e87 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 _0x85e4=['seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x85e4,0x1ea));var _0x485e=function(_0x5c29ec,_0x3fa8df){_0x5c29ec=_0x5c29ec-0x0;var _0x2347ee=_0x85e4[_0x5c29ec];return _0x2347ee;};'use strict';var util=require('util');var _=require(_0x485e('0x0'));var moment=require(_0x485e('0x1'));function getSeconds(_0x24bea2,_0x54d22f){var _0x4f39cf=moment(_0x24bea2)[_0x485e('0x2')](0x0);var _0x1ce79e=moment(_0x54d22f)['milliseconds'](0x0);return _0x4f39cf[_0x485e('0x3')](_0x1ce79e,_0x485e('0x4'));}function History(_0x2c0c02){this[_0x485e('0x5')]=_0x2c0c02['uniqueid'];this[_0x485e('0x6')]=_0x2c0c02[_0x485e('0x6')]||undefined;this['type']=_0x2c0c02[_0x485e('0x7')];this[_0x485e('0x8')]=_0x2c0c02[_0x485e('0x7')]===_0x485e('0x9')?_0x485e('0xa'):_0x2c0c02['type'];this[_0x485e('0xb')]=_0x2c0c02['countbusyretry'];this[_0x485e('0xc')]=_0x2c0c02[_0x485e('0xc')];this[_0x485e('0xd')]=_0x2c0c02[_0x485e('0xd')];this[_0x485e('0xe')]=_0x2c0c02['countbusyretry']+_0x2c0c02['countcongestionretry']+_0x2c0c02[_0x485e('0xd')]+_0x2c0c02['countnosuchnumberretry']+_0x2c0c02['countdropretry']+_0x2c0c02[_0x485e('0xf')]+_0x2c0c02[_0x485e('0x10')]+_0x2c0c02[_0x485e('0x11')];this['countnosuchnumberretry']=_0x2c0c02['countnosuchnumberretry'];this[_0x485e('0x12')]=_0x2c0c02[_0x485e('0x12')];this[_0x485e('0xf')]=_0x2c0c02[_0x485e('0xf')];this['countmachineretry']=_0x2c0c02[_0x485e('0x10')];this[_0x485e('0x11')]=_0x2c0c02[_0x485e('0x11')];this[_0x485e('0xa')]=_0x2c0c02['queue'];this['calleridname']=_0x2c0c02[_0x485e('0x13')];this[_0x485e('0x14')]=_0x2c0c02[_0x485e('0x15')];this[_0x485e('0x16')]=_0x2c0c02['starttime'];this[_0x485e('0x17')]=_0x2c0c02[_0x485e('0x17')];this[_0x485e('0x18')]=_0x2c0c02[_0x485e('0x17')];this['ringtime']=getSeconds(_0x2c0c02[_0x485e('0x17')],_0x2c0c02[_0x485e('0x16')]);this[_0x485e('0x19')]=0x0;this[_0x485e('0x1a')]=0x0;this[_0x485e('0x1b')]=_0x2c0c02['callback'];this['callbackuniqueid']=_0x2c0c02[_0x485e('0x1c')];this[_0x485e('0x1d')]=_0x2c0c02[_0x485e('0x1d')];this[_0x485e('0x1e')]=_0x2c0c02[_0x485e('0x1e')];this[_0x485e('0x1f')]=_0x2c0c02[_0x485e('0x1f')];this['ListId']=_0x2c0c02['ListId'];this[_0x485e('0x20')]=_0x2c0c02[_0x485e('0x20')];this['VoiceQueueId']=_0x2c0c02[_0x485e('0x21')];this[_0x485e('0x22')]=_0x2c0c02[_0x485e('0x22')];this['originatecalleridnum']=_0x2c0c02[_0x485e('0x23')]||'';this['originatecalleridname']=_0x2c0c02[_0x485e('0x24')]||'';}module[_0x485e('0x25')]=History; \ No newline at end of file +var _0x3049=['uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countnosuchnumberretry','countdropretry','countagentrejectretry','calleridname','name','calleridnum','number','responsetime','endtime','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','moment','milliseconds','diff','seconds'];(function(_0x22b2be,_0x4b164c){var _0x213c31=function(_0x475528){while(--_0x475528){_0x22b2be['push'](_0x22b2be['shift']());}};_0x213c31(++_0x4b164c);}(_0x3049,0x1e9));var _0x9304=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x3049[_0x47a7d0];return _0xb9bd08;};'use strict';var util=require(_0x9304('0x0'));var _=require('lodash');var moment=require(_0x9304('0x1'));function getSeconds(_0x4cbf80,_0x39b3a3){var _0x41be2d=moment(_0x4cbf80)[_0x9304('0x2')](0x0);var _0x5aa4d8=moment(_0x39b3a3)[_0x9304('0x2')](0x0);return _0x41be2d[_0x9304('0x3')](_0x5aa4d8,_0x9304('0x4'));}function History(_0x348557){this[_0x9304('0x5')]=_0x348557['uniqueid'];this[_0x9304('0x6')]=_0x348557[_0x9304('0x6')]||undefined;this[_0x9304('0x7')]=_0x348557[_0x9304('0x7')];this[_0x9304('0x8')]=_0x348557[_0x9304('0x7')]===_0x9304('0x9')?_0x9304('0xa'):_0x348557[_0x9304('0x7')];this[_0x9304('0xb')]=_0x348557[_0x9304('0xb')];this['countcongestionretry']=_0x348557[_0x9304('0xc')];this[_0x9304('0xd')]=_0x348557[_0x9304('0xd')];this[_0x9304('0xe')]=_0x348557[_0x9304('0xb')]+_0x348557['countcongestionretry']+_0x348557[_0x9304('0xd')]+_0x348557['countnosuchnumberretry']+_0x348557['countdropretry']+_0x348557[_0x9304('0xf')]+_0x348557['countmachineretry']+_0x348557['countagentrejectretry'];this[_0x9304('0x10')]=_0x348557[_0x9304('0x10')];this[_0x9304('0x11')]=_0x348557['countdropretry'];this[_0x9304('0xf')]=_0x348557['countabandonedretry'];this['countmachineretry']=_0x348557['countmachineretry'];this[_0x9304('0x12')]=_0x348557[_0x9304('0x12')];this[_0x9304('0xa')]=_0x348557[_0x9304('0xa')];this[_0x9304('0x13')]=_0x348557[_0x9304('0x14')];this[_0x9304('0x15')]=_0x348557[_0x9304('0x16')];this['starttime']=_0x348557['starttime'];this['responsetime']=_0x348557[_0x9304('0x17')];this[_0x9304('0x18')]=_0x348557['responsetime'];this['ringtime']=getSeconds(_0x348557[_0x9304('0x17')],_0x348557[_0x9304('0x19')]);this[_0x9304('0x1a')]=0x0;this[_0x9304('0x1b')]=0x0;this['callback']=_0x348557[_0x9304('0x1c')];this['callbackuniqueid']=_0x348557[_0x9304('0x1d')];this[_0x9304('0x1e')]=_0x348557['callbackat'];this[_0x9304('0x1f')]=_0x348557[_0x9304('0x1f')];this[_0x9304('0x20')]=_0x348557[_0x9304('0x20')];this['ListId']=_0x348557['ListId'];this[_0x9304('0x21')]=_0x348557[_0x9304('0x21')];this[_0x9304('0x22')]=_0x348557['VoiceQueueId'];this[_0x9304('0x23')]=_0x348557[_0x9304('0x23')];this['originatecalleridnum']=_0x348557['originatecalleridnum']||'';this['originatecalleridname']=_0x348557[_0x9304('0x24')]||'';}module[_0x9304('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 22347a8..7e9f2cc 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 _0x4dd3=['[rescheduleContact][Abandoned]','channel','syncQueueMember','actionid','locked','paused','stateinterface','rrmemory','push','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','isTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','length','command','iftime\x20%s,%s','interval','timezones','indexOf','true','Action','content','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','progressive','handlePower','Queue','launchHandleIvr','checkIsTrunkReachable','checkIfTime','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','trim','dialCutDigit','SIP/%s/%s%s','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','outboundBusyCallsDay','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Max\x20Drop\x20','dialPredictiveInterval','averageHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','busyFactor','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','agentBusyFactor','[CatchErlangB]','check\x20failure','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[actionOriginate]\x20','checkIsBlackList','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\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','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','md5','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','syncHangup','newexten','syncNewExten','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','[ifTime][Action]','stringify','milliseconds','seconds','emit','type','outbound','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','campaign:ivr:%s','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\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','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22\x22\x20<>','error','inspect','stack','originated','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','waiting','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','prototype','loopClearZombieChannels','clearZombieChannels','[uniqueid]','actions','[actions]','isNil','status','No\x20such\x20channel','ivr','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','then','[checkIsBlackList]\x20','checkIsBlackListIvr','catch','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','state','membername','AMD','custom:amd','[syncHangupInAMD][createHistory]','value','Machine','countmachineretry','amd','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','dialGlobalMaxRetry','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','countglobal','dialDropMaxRetry','dialDropRetryFrequency','minutes','[rescheduleContact][Drop]','calleridname','calleridnum','dropreason','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x158769,_0x3e7a0a){var _0x58e9a4=function(_0x5545cd){while(--_0x5545cd){_0x158769['push'](_0x158769['shift']());}};_0x58e9a4(++_0x3e7a0a);}(_0x4dd3,0xf5));var _0x34dd=function(_0x2de020,_0x252df0){_0x2de020=_0x2de020-0x0;var _0x182b7c=_0x4dd3[_0x2de020];return _0x182b7c;};'use strict';var util=require(_0x34dd('0x0'));var _=require(_0x34dd('0x1'));var BPromise=require(_0x34dd('0x2'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0x34dd('0x3'));var Redis=require('ioredis');var ut=require(_0x34dd('0x4'));var config=require(_0x34dd('0x5'));var logger=require(_0x34dd('0x6'))('dialer');var loggerBooked=require(_0x34dd('0x6'))(_0x34dd('0x7'));var loggerPredictive=require(_0x34dd('0x6'))(_0x34dd('0x8'));var loggerPredictiveCalls=require(_0x34dd('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x34dd('0x9'));var ami=require(_0x34dd('0xa'));config[_0x34dd('0xb')]=_['defaults'](config[_0x34dd('0xb')],{'host':_0x34dd('0xc'),'port':0x18eb});var io=require(_0x34dd('0xd'))(new Redis(config[_0x34dd('0xb')]));var cmHopper=require(_0x34dd('0xe'));var cmHopperHistory=require(_0x34dd('0xf'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x34dd('0x10'));var Action=require(_0x34dd('0x11'));var History=require(_0x34dd('0x12'));var Final=require(_0x34dd('0x13'));var AgentComplete=require(_0x34dd('0x14'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process[_0x34dd('0x15')][_0x34dd('0x16')]||_0x34dd('0x17');var strategy={'rrmemory':'rrmemory','roundrobin':_0x34dd('0x18')};var Sequence=function(){};Sequence['prototype'][_0x34dd('0x19')]=function(_0x30537f){this[_0x34dd('0x1a')]=this[_0x34dd('0x1a')]?this[_0x34dd('0x1a')][_0x34dd('0x1b')](_0x30537f):_0x30537f();};function Dialer(_0x4f7be5,_0x351c8a){this[_0x34dd('0x1c')]=new Sequence();this[_0x34dd('0x1d')]=_0x351c8a;this[_0x34dd('0x1e')]=_0x4f7be5[_0x34dd('0x1e')];this[_0x34dd('0x1f')]=_0x4f7be5[_0x34dd('0x1f')];this[_0x34dd('0x20')]=_0x4f7be5[_0x34dd('0x20')];this[_0x34dd('0x21')]=_0x4f7be5[_0x34dd('0x21')];this[_0x34dd('0x22')]=config[_0x34dd('0x22')]||0x2;this[_0x34dd('0x23')]={};this['actions']={};this['contactsId']={};this[_0x34dd('0x24')]={};this[_0x34dd('0x25')]={};this[_0x34dd('0x26')]={};this[_0x34dd('0x27')]={};this[_0x34dd('0x28')]={};this[_0x34dd('0x29')]={};this['queueBookedRR']={};ami['on'](_0x34dd('0x2a'),this[_0x34dd('0x2b')]['bind'](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x34dd('0x2c')](this));ami['on']('originateresponse',this[_0x34dd('0x2d')][_0x34dd('0x2c')](this));ami['on'](_0x34dd('0x2e'),this[_0x34dd('0x2f')][_0x34dd('0x2c')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x34dd('0x2c')](this));ami['on']('hangup',this[_0x34dd('0x30')][_0x34dd('0x2c')](this));ami['on'](_0x34dd('0x31'),this[_0x34dd('0x32')][_0x34dd('0x2c')](this));ami['on'](_0x34dd('0x33'),this['syncVarSet'][_0x34dd('0x2c')](this));ami['on'](_0x34dd('0x34'),this['syncQueueMember'][_0x34dd('0x2c')](this));ami['on'](_0x34dd('0x35'),this[_0x34dd('0x36')][_0x34dd('0x2c')](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x991b71){return _0x991b71!==null&&!_[_0x34dd('0x37')](_0x991b71);}function checkIsLoggedIn(_0x74a33c,_0x3820ea){return function(){if(_0x3820ea<=0x0){_0x74a33c[_0x34dd('0x38')]=_0x34dd('0x39');throw _0x74a33c[_0x34dd('0x3a')]+_0x34dd('0x3b');}};}function isActive(_0x511497){return _0x511497;}function checkIsActive(_0x5b389b,_0x1a1df1){return function(){if(!isActive(_0x1a1df1)){_0x5b389b[_0x34dd('0x38')]=_0x34dd('0x3c');throw _0x5b389b[_0x34dd('0x3a')]+_0x34dd('0x3d');}};}function checkInterval(_0x1abd7c){return function(){if(!isNotNull(_0x1abd7c['Interval'])){_0x1abd7c['message']=_0x34dd('0x3e');throw _0x1abd7c[_0x34dd('0x3a')]+_0x34dd('0x3f');}if(!isNotNull(_0x1abd7c[_0x34dd('0x40')][_0x34dd('0x41')])){_0x1abd7c[_0x34dd('0x38')]='INTERVAL_IS_NULL';throw _0x1abd7c[_0x34dd('0x3a')]+_0x34dd('0x3f');}if(!isNotNull(_['isEmpty'](_0x1abd7c['Interval'][_0x34dd('0x41')]))){_0x1abd7c[_0x34dd('0x38')]=_0x34dd('0x3e');throw _0x1abd7c[_0x34dd('0x3a')]+_0x34dd('0x3f');}};}function msgResponse(_0x3afadc,_0x3c567e,_0x2704fe){return{'action':_0x3afadc,'response':_0x3c567e,'message':_0x2704fe,'stack':_0x2704fe};}function myreject(_0x501683){return function(_0x2eada0){return _0x501683(msgResponse(_0x34dd('0x42'),'Error',JSON[_0x34dd('0x43')](_0x2eada0)));};}function getSeconds(_0x1df9e4,_0x6c3eba){var _0x32a7fb=moment(_0x1df9e4)['milliseconds'](0x0);var _0x4362a7=moment(_0x6c3eba)[_0x34dd('0x44')](0x0);return _0x32a7fb['diff'](_0x4362a7,_0x34dd('0x45'));}function emit(_0x5db0d9,_0x49626b,_0x47021b){io['to'](_0x5db0d9)[_0x34dd('0x46')](_0x49626b,_0x47021b);}function emitVoiceQueueSummary(_0x3e3439){if(_0x3e3439[_0x34dd('0x47')]===_0x34dd('0x48')){var _0x12ed9c={'id':_0x3e3439['id'],'name':_0x3e3439[_0x34dd('0x3a')],'strategy':_0x3e3439[_0x34dd('0x49')],'answered':_0x3e3439[_0x34dd('0x4a')],'available':_0x3e3439['available'],'loggedIn':_0x3e3439[_0x34dd('0x4b')],'pTalking':_0x3e3439[_0x34dd('0x4c')],'sumBillable':_0x3e3439[_0x34dd('0x4d')],'sumDuration':_0x3e3439[_0x34dd('0x4e')],'sumHoldTime':_0x3e3439[_0x34dd('0x4f')]||0x0,'talking':_0x3e3439[_0x34dd('0x50')],'total':_0x3e3439[_0x34dd('0x51')],'type':_0x3e3439[_0x34dd('0x47')],'unmanaged':_0x3e3439[_0x34dd('0x52')],'abandoned':_0x3e3439['abandoned'],'waiting':_0x3e3439['waiting'],'loggedInDb':_0x3e3439[_0x34dd('0x53')],'dialActive':_0x3e3439[_0x34dd('0x54')],'dialMethod':_0x3e3439[_0x34dd('0x55')],'dialOriginateCallerIdName':_0x3e3439['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3e3439[_0x34dd('0x56')],'dialOriginateTimeout':_0x3e3439['dialOriginateTimeout'],'dialPrefix':_0x3e3439[_0x34dd('0x57')],'outboundAnswerAgiCallsDay':_0x3e3439[_0x34dd('0x58')],'outboundAnswerCallsDay':_0x3e3439[_0x34dd('0x59')],'outboundBlacklistCallsDay':_0x3e3439[_0x34dd('0x5a')],'outboundBusyCallsDay':_0x3e3439['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3e3439[_0x34dd('0x5b')],'outboundDropCallsDayACS':_0x3e3439[_0x34dd('0x5c')],'outboundDropCallsDayCallersExit':_0x3e3439[_0x34dd('0x5d')],'outboundDropCallsDayTimeout':_0x3e3439[_0x34dd('0x5e')],'outboundNoAnswerCallsDay':_0x3e3439[_0x34dd('0x5f')],'outboundNoSuchCallsDay':_0x3e3439[_0x34dd('0x60')],'outboundOriginateFailureCallsDay':_0x3e3439[_0x34dd('0x61')],'outboundReCallsDay':_0x3e3439[_0x34dd('0x62')],'outboundRejectCallsDay':_0x3e3439[_0x34dd('0x63')],'outboundUnknownCallsDay':_0x3e3439['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x3e3439[_0x34dd('0x64')],'predictiveIntervalAvgHoldtime':_0x3e3439[_0x34dd('0x65')],'predictiveIntervalAvgTalktime':_0x3e3439[_0x34dd('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x3e3439[_0x34dd('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x3e3439['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x3e3439[_0x34dd('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x3e3439[_0x34dd('0x69')],'predictiveIntervalHitRate':_0x3e3439[_0x34dd('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x3e3439[_0x34dd('0x6b')],'predictiveIntervalPauses':_0x3e3439[_0x34dd('0x6c')],'predictiveIntervalAvailable':_0x3e3439[_0x34dd('0x6d')],'predictiveIntervalTotalCalls':_0x3e3439[_0x34dd('0x6e')],'message':_0x3e3439[_0x34dd('0x38')],'originated':_0x3e3439['originated'],'erlangCalls':_0x3e3439[_0x34dd('0x6f')],'erlangCallToSecond':_0x3e3439[_0x34dd('0x70')],'erlangAbandonmentRate':_0x3e3439['erlangAbandonmentRate'],'erlangBusyFactor':_0x3e3439[_0x34dd('0x71')],'startPredictive':_0x3e3439[_0x34dd('0x26')],'startProgressive':_0x3e3439[_0x34dd('0x27')]};if(_0x3e3439[_0x34dd('0x72')]){_0x12ed9c[_0x34dd('0x72')]={'id':_0x3e3439[_0x34dd('0x72')]['id'],'name':_0x3e3439['Trunk'][_0x34dd('0x3a')],'active':_0x3e3439[_0x34dd('0x72')][_0x34dd('0x73')],'callerid':_0x3e3439[_0x34dd('0x72')][_0x34dd('0x74')]};}if(_0x3e3439['Interval']){_0x12ed9c[_0x34dd('0x40')]={'id':_0x3e3439[_0x34dd('0x40')]['id'],'name':_0x3e3439['Interval']['name']};}var _0x3a0fef=md5(JSON[_0x34dd('0x43')](_0x12ed9c));if(_0x3e3439[_0x34dd('0x3')]!==_0x3a0fef){_0x3e3439[_0x34dd('0x3')]=_0x3a0fef;emit(util[_0x34dd('0x75')](_0x34dd('0x76'),_0x12ed9c['name']),'voice_queue:save',_0x12ed9c);}}}function emitCampaignSummary(_0xe6448d){if(_0xe6448d[_0x34dd('0x47')]==='ivr'){emit(util[_0x34dd('0x75')](_0x34dd('0x77'),_0xe6448d[_0x34dd('0x3a')]),_0x34dd('0x78'),_0xe6448d);}}function checkGetDataPredictive(_0x5b3224){if(isNotNull(_0x5b3224)&&!_[_0x34dd('0x79')](_0x5b3224)){loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x7b'));loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x7c'),_0x5b3224['predictiveIntervalTotalCalls']);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b3224['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x34dd('0x7d'),_0x5b3224[_0x34dd('0x7e')]);loggerPredictive[_0x34dd('0x7a')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b3224[_0x34dd('0x67')]);loggerPredictive[_0x34dd('0x7a')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b3224[_0x34dd('0x65')]);loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x7f'),_0x5b3224[_0x34dd('0x66')]);loggerPredictive['info'](_0x34dd('0x80'));if(_0x5b3224[_0x34dd('0x6e')]>0x0){if(!_[_0x34dd('0x37')](_0x5b3224['predictiveIntervalAvgTalktime'])&&_0x5b3224[_0x34dd('0x66')]>0x0){return!![];}loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x81'));if(!_[_0x34dd('0x37')](_0x5b3224[_0x34dd('0x65')])&&_0x5b3224[_0x34dd('0x65')]>0x0){return!![];}loggerPredictive['info'](_0x34dd('0x82'));}else{loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x83'));}}else{loggerPredictive[_0x34dd('0x7a')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x33640c){return function(_0x1be109){loggerPredictive['info'](_0x34dd('0x84'));loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x85'),_0x1be109[_0x34dd('0x6f')]);loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x86'),_0x1be109['erlangCallToSecond']);loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x87'),_0x1be109[_0x34dd('0x88')]);loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x89'),_0x1be109[_0x34dd('0x71')]);loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x87'),_0x1be109['erlangAbandonmentRate']);loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x80'));_[_0x34dd('0x8a')](_0x33640c,_0x1be109);};}function getDiff(_0x4746dc){var _0x269e1f=moment()[_0x34dd('0x44')](0x0);var _0x176acb=moment(_0x4746dc)[_0x34dd('0x44')](0x0);return _0x269e1f[_0x34dd('0x8b')](_0x176acb,'seconds');}function ifInterval(_0xcf7235,_0x1da537){if(_[_0x34dd('0x37')](_0x1da537)){return![];}return getDiff(_0x1da537)<_0xcf7235*0x3c;}function freeVariablesPredictive(_0x2d020b){if(isNotNull(_0x2d020b)){if(!_[_0x34dd('0x37')](_0x2d020b[_0x34dd('0x27')])){_0x2d020b['startProgressive']=undefined;loggerPredictive[_0x34dd('0x7a')](_0x2d020b[_0x34dd('0x3a')],_0x34dd('0x8c'));}if(!_[_0x34dd('0x37')](_0x2d020b[_0x34dd('0x26')])){_0x2d020b[_0x34dd('0x26')]=undefined;loggerPredictive['info'](_0x2d020b[_0x34dd('0x3a')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x34dd('0x37')](_0x2d020b['handlePredictive'])){clearInterval(_0x2d020b[_0x34dd('0x8d')]);_0x2d020b['handlePredictive']=undefined;loggerPredictive['info'](_0x2d020b[_0x34dd('0x3a')],_0x34dd('0x8e'));}}}function erlangb(_0x16fa39,_0x5b34c3){if(_0x5b34c3===0x0){return 0x0;}var _0x3eee01=0x1;for(var _0x2330b1=0x1;_0x2330b1<=_0x5b34c3;_0x2330b1+=0x1){_0x3eee01=0x1+_0x3eee01*_0x2330b1/_0x16fa39;}return 0x1/_0x3eee01;}function isVoiceQueueOutbound(_0x158bdd){return _0x158bdd===_0x34dd('0x48');}function isNotPreview(_0x1391f4){return _0x1391f4!==_0x34dd('0x1d');}function isCampaignIvr(_0x3b7ad4){return _0x3b7ad4==='ivr';}function getCallerId(_0x289de1,_0x1650d2,_0x293ca9){if(!_['isUndefined'](_0x293ca9)&&typeof _0x293ca9===_0x34dd('0x8f')&&!_[_0x34dd('0x79')](_0x293ca9)){if(!_[_0x34dd('0x37')](_0x1650d2)&&typeof _0x1650d2===_0x34dd('0x8f')&&!_[_0x34dd('0x79')](_0x1650d2)){return util[_0x34dd('0x75')]('\x22%s\x22\x20<%s>',_0x1650d2,_0x293ca9);}return util[_0x34dd('0x75')]('\x22%s\x22\x20<%s>',_0x293ca9,_0x293ca9);}if(!_[_0x34dd('0x37')](_0x289de1)&&typeof _0x289de1===_0x34dd('0x8f')&&!_[_0x34dd('0x79')](_0x289de1)){return _0x289de1;}return _0x34dd('0x90');}function loggerCatchQueueSummary(_0x88f669,_0x46f7b3){return function(_0x2b7d81){freeVariablesPredictive(_0x46f7b3);emitVoiceQueueSummary(_0x46f7b3);emitCampaignSummary(_0x46f7b3);loggerSyncQueueSummary[_0x34dd('0x91')](_0x88f669,util[_0x34dd('0x92')](_0x2b7d81,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3cd434,_0x3e4c33){return function(_0x313858){loggerPredictive[_0x34dd('0x91')](_0x3e4c33[_0x34dd('0x3a')],_0x3cd434);loggerPredictive[_0x34dd('0x91')](_0x313858[_0x34dd('0x93')]);freeVariablesPredictive(_0x3e4c33);};}function loggerCatch(_0x4d1635){return function(_0x268539){logger[_0x34dd('0x91')](_0x4d1635,util[_0x34dd('0x92')](_0x268539,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x221755){return _0x221755&&!_['isUndefined'](_0x221755)&&_0x221755['length']>0x0;}function decremetOriginate(_0x743c2c){if(!_[_0x34dd('0x37')](_0x743c2c)&&_0x743c2c!==null){if(typeof _0x743c2c[_0x34dd('0x94')]!==_0x34dd('0x95')){if(_0x743c2c[_0x34dd('0x94')]>0x0){_0x743c2c[_0x34dd('0x94')]-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x34dd('0x91')](_0x34dd('0x96'));}}function checkContactLowerLimitOriginate(_0x417569,_0x11c73c,_0x5913d7){if(_0x11c73c>_0x5913d7){for(var _0xc664a5=0x0;_0xc664a5<_0x11c73c-_0x5913d7;_0xc664a5+=0x1){decremetOriginate(_0x417569);}}}function loggerGetContactDialer(_0x53788d,_0x360e03,_0x3f3ad){return function(_0x1003aa){checkContactLowerLimitOriginate(_0x360e03,_0x3f3ad,0x0);logger[_0x34dd('0x91')](_0x53788d,util[_0x34dd('0x92')](_0x1003aa,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2ec54e){return function(_0x3d889e){if(isNotNull(_0x3d889e)&&isNotNull(_0x3d889e[0x0])){if(_0x3d889e[0x0]['contactsRescheduled']>0x0){_0x2ec54e[_0x34dd('0x38')]=_0x34dd('0x97');logger[_0x34dd('0x7a')]('[getContactDialer2][ReScheduled]'+_0x2ec54e[_0x34dd('0x3a')],_0x3d889e[0x0]['contactsRescheduled'],_0x34dd('0x98'));}else{_0x2ec54e['message']=_0x34dd('0x99');logger[_0x34dd('0x7a')]('[getContactDialer2][Empty]'+_0x2ec54e['name']);}}};}function notSendMessagesQueue(_0x5c6361){if(_0x5c6361['sendMessageOneNotActive']){freeVariablesPredictive(_0x5c6361);if(_0x5c6361[_0x34dd('0x94')]===0x0&&_0x5c6361[_0x34dd('0x50')]===0x0&&_0x5c6361[_0x34dd('0x9a')]===0x0&&(_0x5c6361[_0x34dd('0x4c')]||0x0)===0x0){_0x5c6361['sendMessageOneNotActive']=![];_0x5c6361[_0x34dd('0x9b')]=0x0;_0x5c6361[_0x34dd('0x38')]=_0x34dd('0x3c');loggerSyncQueueSummary[_0x34dd('0x91')](_0x34dd('0x9c'),_0x5c6361['name'],_0x34dd('0x9d'));}else{_0x5c6361[_0x34dd('0x38')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x34dd('0x91')](_0x34dd('0x9c'),_0x5c6361['name'],_0x34dd('0x9e'));}emitVoiceQueueSummary(_0x5c6361);}}function notSendMessagesCampaign(_0x4fd317){if(_0x4fd317[_0x34dd('0x9f')]){if(_0x4fd317[_0x34dd('0x94')]===0x0){_0x4fd317[_0x34dd('0x9f')]=![];_0x4fd317[_0x34dd('0x38')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0x34dd('0xa0'),_0x4fd317[_0x34dd('0x3a')],_0x34dd('0x9d'));}else{_0x4fd317[_0x34dd('0x38')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x34dd('0x91')](_0x34dd('0xa0'),_0x4fd317[_0x34dd('0x3a')],_0x34dd('0x9e'));}emitCampaignSummary(_0x4fd317);}}function createObjHistory(_0x1f12b3,_0x472821,_0x331219,_0x2302c9,_0x3dcbef){_0x1f12b3['message']=_0x331219;var _0xf01988=new Action(_0x1f12b3,_0x472821);var _0x3602c5=new History(_0xf01988);_0x3602c5['state']=_0x2302c9;_0x3602c5[_0x34dd('0xa1')]=_0x3dcbef;_0x3602c5[_0x34dd('0xa2')]=_0xf01988[_0x34dd('0xa3')];return _0x3602c5;}Dialer[_0x34dd('0xa4')][_0x34dd('0xa5')]=function(){var _0x198bfb=this;setInterval(function(){_0x198bfb[_0x34dd('0xa6')](_0x198bfb[_0x34dd('0x24')],_0x34dd('0xa7'));_0x198bfb['clearZombieChannels'](_0x198bfb[_0x34dd('0xa8')],_0x34dd('0xa9'));},0x32c8);};Dialer['prototype'][_0x34dd('0xa6')]=function(_0x537115,_0x3e1753){var _0x81d202=this;for(var _0x1acefe in _0x537115){if(typeof _0x537115[_0x1acefe]!==_0x34dd('0x95')){this[_0x34dd('0x1c')][_0x34dd('0x19')](function(){if(!_[_0x34dd('0xaa')](_0x537115[_0x1acefe])){return ami['Action']({'action':_0x34dd('0xab'),'channel':_0x537115[_0x1acefe]['channel']})['catch'](function(_0x2d7284){if(_0x2d7284['message']===_0x34dd('0xac')){setTimeout(function(){if(_0x537115[_0x1acefe]&&_0x537115[_0x1acefe]['type']!==_0x34dd('0xad')){_0x81d202[_0x34dd('0xae')](_0x81d202['voiceQueues'][_0x537115[_0x1acefe][_0x34dd('0xaf')]]);logger['error'](_0x34dd('0xb0'),_0x3e1753,_0x1acefe,_0x537115[_0x1acefe]['queue']);delete _0x537115[_0x1acefe];}if(_0x537115[_0x1acefe]&&_0x537115[_0x1acefe]['type']==='ivr'){_0x81d202['updateOriginated'](_0x81d202['campaigns'][_0x537115[_0x1acefe][_0x34dd('0xaf')]]);logger[_0x34dd('0x91')](_0x34dd('0xb1'),_0x3e1753,_0x1acefe,_0x537115[_0x1acefe][_0x34dd('0xaf')]);delete _0x537115[_0x1acefe];}},0x2328);}});}});}}};Dialer[_0x34dd('0xa4')][_0x34dd('0xb2')]=function(_0xb98ad5){return BPromise[_0x34dd('0xb3')]()['then'](cmHopper['countReScheduled'](_0xb98ad5))['catch'](loggerCatch(_0x34dd('0xb4')));};Dialer[_0x34dd('0xa4')]['checkIsBlackList']=function(_0x5f1f22){return BPromise['resolve']()[_0x34dd('0xb5')](cmHopperBlack['checkIsBlackList'](_0x5f1f22))['catch'](loggerCatch(_0x34dd('0xb6')));};Dialer[_0x34dd('0xa4')]['checkIsBlackListIvr']=function(_0x44acb1){return BPromise[_0x34dd('0xb3')]()[_0x34dd('0xb5')](cmHopperBlack[_0x34dd('0xb7')](_0x44acb1))[_0x34dd('0xb8')](loggerCatch(_0x34dd('0xb9')));};Dialer[_0x34dd('0xa4')]['averageHandleTime']=function(_0x54a88b){return BPromise[_0x34dd('0xb3')]()['then'](cmHopperHistory[_0x34dd('0xba')](_0x54a88b))['catch'](loggerCatch(_0x34dd('0xbb')));};Dialer[_0x34dd('0xa4')][_0x34dd('0xbc')]=function(_0x9d09a8){return BPromise[_0x34dd('0xb3')]()[_0x34dd('0xb5')](cmHopper[_0x34dd('0xbc')](_0x9d09a8))[_0x34dd('0xb8')](loggerCatch(_0x34dd('0xbd')));};Dialer[_0x34dd('0xa4')][_0x34dd('0xbe')]=function(_0x1b2885,_0x9089a4,_0x1186a4){return BPromise[_0x34dd('0xb3')]()[_0x34dd('0xb5')](cmHopper[_0x34dd('0xbe')](_0x1b2885,_0x9089a4,_0x1186a4))[_0x34dd('0xb8')](loggerCatch(_0x34dd('0xbf')));};Dialer['prototype'][_0x34dd('0xc0')]=function(_0x38d8b5,_0x2b8771,_0x53f0ca,_0x541ea2,_0x30daf6){return BPromise['resolve']()['then'](cmHopper[_0x34dd('0xc0')](_0x38d8b5,_0x2b8771,_0x53f0ca,_0x541ea2))[_0x34dd('0xb8')](function(_0x6bbd66){_0x30daf6['temp']-=_0x53f0ca;_0x30daf6['temp']=_0x30daf6[_0x34dd('0xc1')]>0x0?_0x30daf6[_0x34dd('0xc1')]:0x0;loggerCatch(_0x34dd('0xc2'))(_0x6bbd66);});};Dialer[_0x34dd('0xa4')][_0x34dd('0xc3')]=function(_0x2e269e,_0x1c353c,_0x58219b,_0x337f57){return BPromise[_0x34dd('0xb3')]()[_0x34dd('0xb5')](cmHopper[_0x34dd('0xc3')](_0x2e269e,_0x1c353c,_0x58219b))[_0x34dd('0xb8')](function(_0x4bdf7f){_0x337f57[_0x34dd('0xc1')]-=_0x1c353c;_0x337f57[_0x34dd('0xc1')]=_0x337f57[_0x34dd('0xc1')]>0x0?_0x337f57[_0x34dd('0xc1')]:0x0;loggerCatch(_0x34dd('0xc4'))(_0x4bdf7f);});};Dialer['prototype'][_0x34dd('0xc5')]=function(_0xe7bc15){return BPromise['resolve']()[_0x34dd('0xb5')](voiceQueueRt[_0x34dd('0xc5')](_0xe7bc15))['catch'](loggerCatch(_0x34dd('0xc6')));};Dialer['prototype'][_0x34dd('0xc7')]=function(_0x337ed1){return BPromise['resolve']()['then'](cmHopper[_0x34dd('0xc7')](_0x337ed1))[_0x34dd('0xb8')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x34dd('0xa4')]['createHistory']=function(_0x290e85){return BPromise[_0x34dd('0xb3')]()[_0x34dd('0xb5')](cmHopperHistory[_0x34dd('0xc8')](_0x290e85))[_0x34dd('0xb8')](loggerCatch('[createHistory]\x20'));};Dialer[_0x34dd('0xa4')]['updateOriginated']=function(_0x24eec5){if(!_['isUndefined'](_0x24eec5)&&_0x24eec5!==null){if(typeof _0x24eec5[_0x34dd('0x94')]!==_0x34dd('0x95')){if(_0x24eec5[_0x34dd('0x94')]>0x0){_0x24eec5[_0x34dd('0x94')]-=0x1;}else{logger['error'](_0x34dd('0xc9'));}}}else{logger['error'](_0x34dd('0xca'));}};Dialer[_0x34dd('0xa4')][_0x34dd('0xcb')]=function(_0x142593,_0x38feaf){var _0x493448=this;return function(_0x41adb2){_0x493448[_0x34dd('0xae')](_0x38feaf);logger['error'](_0x142593,util['inspect'](_0x41adb2,{'showHidden':![],'depth':null}));};};Dialer[_0x34dd('0xa4')][_0x34dd('0xcc')]=function(_0x236e97,_0x565281,_0x2d869a){var _0x1c3acc={'state':0x19,'statedesc':_0x34dd('0xcd')};this[_0x34dd('0xae')](_0x565281);this[_0x34dd('0xce')](_[_0x34dd('0x8a')](_0x1c3acc,_[_0x34dd('0xcf')](_0x2d869a,[_0x34dd('0xd0'),_0x34dd('0xd1'),_0x34dd('0xd2'),_0x34dd('0xd3'),_0x34dd('0xd4')])),_0x34dd('0xd5'),_0x34dd('0xd6'));logger[_0x34dd('0x91')](_0x236e97);};Dialer[_0x34dd('0xa4')][_0x34dd('0xd7')]=function(_0x25ac41){return _0x25ac41===_0x34dd('0xd8');};Dialer[_0x34dd('0xa4')]['isTrunkReachable']=function(_0x20fed7){return!_[_0x34dd('0x37')](_0x20fed7)&&_0x20fed7&&!_['isUndefined'](_0x20fed7['name'])&&!_[_0x34dd('0x37')](_0x20fed7[_0x34dd('0x73')])&&_0x20fed7[_0x34dd('0x73')]&&(this[_0x34dd('0x21')][util[_0x34dd('0x75')](_0x34dd('0xd9'),_0x20fed7[_0x34dd('0x3a')])]['status']===_0x34dd('0xda')||this[_0x34dd('0x21')][util[_0x34dd('0x75')](_0x34dd('0xd9'),_0x20fed7[_0x34dd('0x3a')])][_0x34dd('0xab')]===_0x34dd('0xdb'));};Dialer[_0x34dd('0xa4')][_0x34dd('0xce')]=function(_0x267ed2,_0x28fde9,_0x1d740f){this[_0x34dd('0xc8')](_0x267ed2)['catch'](loggerCatch(_0x28fde9));this[_0x34dd('0xc7')](_0x267ed2)[_0x34dd('0xb8')](loggerCatch(_0x1d740f));};Dialer[_0x34dd('0xa4')]['syncVarSet']=function(_0x56207b){var _0x280d3=this[_0x34dd('0x24')][_0x56207b[_0x34dd('0xdc')]];var _0x1ceaf1;if(!_['isNil'](_0x56207b)&&!_[_0x34dd('0xaa')](_0x56207b[_0x34dd('0xdd')])&&!_[_0x34dd('0xaa')](_0x56207b['variable'][_0x34dd('0xde')])&&_0x56207b[_0x34dd('0xdf')]===_0x34dd('0xe0')&&_0x280d3){if(_0x280d3[_0x34dd('0x47')]!==_0x34dd('0xad')&&this[_0x34dd('0x1e')][_0x280d3['queue']][_0x34dd('0xe1')]&&_0x56207b['value']===_0x34dd('0xe2')){delete this['uniqueId'][_0x56207b['uniqueid']];this['updateOriginated'](this[_0x34dd('0x1e')][_0x280d3[_0x34dd('0xaf')]]);this[_0x34dd('0x1e')][_0x280d3['queue']][_0x34dd('0x59')]+=0x1;this['voiceQueues'][_0x280d3[_0x34dd('0xaf')]][_0x34dd('0x58')]+=0x1;_0x1ceaf1=new Hangup(_0x280d3,_0x56207b);_0x1ceaf1[_0x34dd('0xe3')]=0x12;_0x1ceaf1['statedesc']='HangupInAMD';_0x1ceaf1[_0x34dd('0xe4')]=_0x34dd('0xe5');ami['emit'](_0x34dd('0xe6'),ut['buildObj'](_0x1ceaf1,'amd'));this[_0x34dd('0xce')](_0x1ceaf1,_0x34dd('0xe7'),'[syncHangupInAMD]');}if(_0x280d3[_0x34dd('0x47')]!==_0x34dd('0xad')&&this[_0x34dd('0x1e')][_0x280d3['queue']][_0x34dd('0xe1')]&&_0x56207b[_0x34dd('0xe8')]==='MACHINE'){var _0x2fd02a=this;return new BPromise(function(_0x33e481,_0x22aa6e){delete _0x2fd02a[_0x34dd('0x24')][_0x56207b[_0x34dd('0xdc')]];_0x2fd02a['updateOriginated'](_0x2fd02a[_0x34dd('0x1e')][_0x280d3[_0x34dd('0xaf')]]);_0x2fd02a[_0x34dd('0x1e')][_0x280d3['queue']]['outboundAnswerCallsDay']+=0x1;_0x2fd02a[_0x34dd('0x1e')][_0x280d3[_0x34dd('0xaf')]][_0x34dd('0x58')]+=0x1;var _0x19b1af=_0x2fd02a[_0x34dd('0x1e')][_0x280d3[_0x34dd('0xaf')]];var _0x2d7ccb=new Hangup(_0x280d3,_0x56207b);_0x2d7ccb['state']=0x13;_0x2d7ccb[_0x34dd('0xa1')]=_0x34dd('0xe9');_0x2d7ccb[_0x34dd('0xe4')]=_0x34dd('0xe5');_0x2d7ccb[_0x34dd('0xea')]+=0x1;_0x2d7ccb['countglobal']+=0x1;_0x2d7ccb[_0x34dd('0xeb')]=!![];ami[_0x34dd('0x46')](_0x34dd('0xe6'),ut[_0x34dd('0xec')](_0x2d7ccb,'amd'));_0x2fd02a[_0x34dd('0xc8')](_0x2d7ccb)[_0x34dd('0xb8')](loggerCatch(_0x34dd('0xed')));if(_0x2d7ccb[_0x34dd('0xee')]+_0x2d7ccb[_0x34dd('0xef')]+_0x2d7ccb[_0x34dd('0xf0')]+_0x2d7ccb[_0x34dd('0xf1')]+_0x2d7ccb[_0x34dd('0xf2')]+_0x2d7ccb[_0x34dd('0xf3')]+_0x2d7ccb['countmachineretry']+_0x2d7ccb[_0x34dd('0xf4')]>=_0x19b1af['dialGlobalMaxRetry']){_0x2fd02a[_0x34dd('0xf5')](_0x2d7ccb,_0x33e481,_0x22aa6e,'reason19\x20machine....');}else{if(_0x2d7ccb[_0x34dd('0xea')]>=_0x19b1af[_0x34dd('0xf6')]){_0x2fd02a[_0x34dd('0xf7')](_0x2d7ccb,_0x33e481,_0x22aa6e,_0x34dd('0xf8'));}else{_0x2fd02a[_0x34dd('0xbc')]({'active':![],'countmachineretry':_0x2d7ccb[_0x34dd('0xea')],'scheduledat':moment()[_0x34dd('0xf9')](_0x19b1af['dialMachineRetryFrequency'],'minutes')[_0x34dd('0x75')](_0x34dd('0xfa')),'ContactId':_0x2d7ccb[_0x34dd('0xd0')],'ListId':_0x2d7ccb[_0x34dd('0xd1')],'VoiceQueueId':_0x2d7ccb[_0x34dd('0xd3')]||undefined,'CampaignId':_0x2d7ccb[_0x34dd('0xd4')]||undefined})[_0x34dd('0xb8')](loggerCatch(_0x34dd('0xfb')));_0x33e481({'reschedule':0x1});}}});}if(_0x280d3[_0x34dd('0x47')]===_0x34dd('0xad')&&this[_0x34dd('0x1f')][_0x280d3[_0x34dd('0xaf')]]['dialAMDActive']&&_0x56207b['value']===_0x34dd('0xe2')){delete this[_0x34dd('0x24')][_0x56207b[_0x34dd('0xdc')]];this[_0x34dd('0xae')](this[_0x34dd('0x1f')][_0x280d3['queue']]);_0x1ceaf1=new Hangup(_0x280d3,_0x56207b);_0x1ceaf1[_0x34dd('0xe3')]=0x12;_0x1ceaf1[_0x34dd('0xa1')]=_0x34dd('0xfc');_0x1ceaf1[_0x34dd('0xe4')]=_0x34dd('0xe5');ami[_0x34dd('0x46')]('custom:amd',ut[_0x34dd('0xec')](_0x1ceaf1,_0x34dd('0xeb')));this[_0x34dd('0xce')](_0x1ceaf1,_0x34dd('0xfd'),_0x34dd('0xfe'));}if(_0x280d3[_0x34dd('0x47')]==='ivr'&&this[_0x34dd('0x1f')][_0x280d3[_0x34dd('0xaf')]][_0x34dd('0xe1')]&&_0x56207b['value']===_0x34dd('0xff')){var _0x2fd02a=this;return new BPromise(function(_0x834d99,_0x1dea61){delete _0x2fd02a['uniqueId'][_0x56207b[_0x34dd('0xdc')]];_0x2fd02a[_0x34dd('0xae')](_0x2fd02a['campaigns'][_0x280d3[_0x34dd('0xaf')]]);_0x2fd02a[_0x34dd('0x1f')][_0x280d3[_0x34dd('0xaf')]][_0x34dd('0x59')]+=0x1;_0x2fd02a[_0x34dd('0x1f')][_0x280d3[_0x34dd('0xaf')]][_0x34dd('0x58')]+=0x1;var _0x5c3cce=_0x2fd02a[_0x34dd('0x1f')][_0x280d3['queue']];var _0x2cb2ee=new Hangup(_0x280d3,_0x56207b);_0x2cb2ee[_0x34dd('0xe3')]=0x13;_0x2cb2ee[_0x34dd('0xa1')]=_0x34dd('0xe9');_0x2cb2ee[_0x34dd('0xe4')]=_0x34dd('0xe5');_0x2cb2ee[_0x34dd('0xea')]+=0x1;_0x2cb2ee['countglobal']+=0x1;_0x2cb2ee[_0x34dd('0xeb')]=!![];ami[_0x34dd('0x46')](_0x34dd('0xe6'),ut[_0x34dd('0xec')](_0x2cb2ee,_0x34dd('0xeb')));_0x2fd02a['createHistory'](_0x2cb2ee)[_0x34dd('0xb8')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2cb2ee[_0x34dd('0xee')]+_0x2cb2ee[_0x34dd('0xef')]+_0x2cb2ee[_0x34dd('0xf0')]+_0x2cb2ee['countnosuchnumberretry']+_0x2cb2ee[_0x34dd('0xf2')]+_0x2cb2ee[_0x34dd('0xf3')]+_0x2cb2ee[_0x34dd('0xea')]+_0x2cb2ee['countagentrejectretry']>=_0x5c3cce[_0x34dd('0x100')]){_0x2fd02a['stateGlobal'](_0x2cb2ee,_0x834d99,_0x1dea61,'reason19\x20machine....');}else{if(_0x2cb2ee[_0x34dd('0xea')]>=_0x5c3cce[_0x34dd('0xf6')]){_0x2fd02a[_0x34dd('0xf7')](_0x2cb2ee,_0x834d99,_0x1dea61,_0x34dd('0xf8'));}else{_0x2fd02a['rescheduleContact']({'active':![],'countmachineretry':_0x2cb2ee[_0x34dd('0xea')],'scheduledat':moment()[_0x34dd('0xf9')](_0x5c3cce[_0x34dd('0x101')],'minutes')[_0x34dd('0x75')](_0x34dd('0xfa')),'ContactId':_0x2cb2ee[_0x34dd('0xd0')],'ListId':_0x2cb2ee[_0x34dd('0xd1')],'VoiceQueueId':_0x2cb2ee[_0x34dd('0xd3')]||undefined,'CampaignId':_0x2cb2ee['CampaignId']||undefined})['catch'](loggerCatch(_0x34dd('0xfb')));_0x834d99({'reschedule':0x1});}}});}}};Dialer[_0x34dd('0xa4')]['syncHangup']=function(_0x127480){var _0x17f35e=this[_0x34dd('0x24')][_0x127480['uniqueid']];var _0x148293=this;var _0x589b84;if(_0x17f35e&&_0x17f35e[_0x34dd('0x47')]==='ivr'){delete this['uniqueId'][_0x127480[_0x34dd('0xdc')]];this[_0x34dd('0xae')](this[_0x34dd('0x1f')][_0x17f35e['queue']]);this[_0x34dd('0x1f')][_0x17f35e[_0x34dd('0xaf')]][_0x34dd('0x102')]+=0x1;_0x589b84=new Hangup(_0x17f35e,_0x127480);this[_0x34dd('0xc8')](_0x589b84)[_0x34dd('0xb8')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x589b84)[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x103')));}if(_0x17f35e&&_0x17f35e[_0x34dd('0x47')]!==_0x34dd('0xad')&&isNotNull(this['voiceQueues'][_0x17f35e[_0x34dd('0xaf')]][_0x34dd('0x104')])){delete this[_0x34dd('0x24')][_0x127480[_0x34dd('0xdc')]];this['updateOriginated'](this['voiceQueues'][_0x17f35e['queue']]);this[_0x34dd('0x1e')][_0x17f35e['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x34dd('0x1e')][_0x17f35e['queue']][_0x34dd('0x58')]+=0x1;_0x589b84=new Hangup(_0x17f35e,_0x127480);_0x589b84['state']=0x10;_0x589b84[_0x34dd('0xa1')]=_0x34dd('0x105');_0x589b84[_0x34dd('0xe4')]=_0x34dd('0x106');this[_0x34dd('0xc8')](_0x589b84)['catch'](loggerCatch(_0x34dd('0x107')));this['moveContactManagedDialer'](_0x589b84)[_0x34dd('0xb8')](loggerCatch('[syncHangupIvr]'));}if(_0x17f35e&&_0x17f35e['type']!==_0x34dd('0xad')&&!isNotNull(this['voiceQueues'][_0x17f35e[_0x34dd('0xaf')]][_0x34dd('0x104')])){delete this[_0x34dd('0x24')][_0x127480[_0x34dd('0xdc')]];this[_0x34dd('0xae')](this[_0x34dd('0x1e')][_0x17f35e[_0x34dd('0xaf')]]);this[_0x34dd('0x1e')][_0x17f35e['queue']]['outboundUnknownCallsDay']+=0x1;_0x589b84=new Hangup(_0x17f35e,_0x127480);_0x589b84[_0x34dd('0xe3')]=0xc;_0x589b84[_0x34dd('0xa1')]=_0x127480['cause-txt'];_0x589b84[_0x34dd('0xe4')]=_0x34dd('0x108');this[_0x34dd('0xc8')](_0x589b84)[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x107')));this[_0x34dd('0xc7')](_0x589b84)[_0x34dd('0xb8')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype']['syncAgentComplete']=function(_0x106d60){var _0x4c0912=this[_0x34dd('0x24')][_0x106d60[_0x34dd('0xdc')]];var _0x23192d=this;if(this['voiceQueues'][_0x106d60[_0x34dd('0xaf')]]){if(_0x4c0912&&_0x4c0912[_0x34dd('0x47')]!==_0x34dd('0xad')){delete this[_0x34dd('0x24')][_0x106d60[_0x34dd('0xdc')]];this[_0x34dd('0x1e')][_0x106d60[_0x34dd('0xaf')]]['outboundAnswerCallsDay']+=0x1;var _0x5b4ad0=new AgentComplete(_0x4c0912,_0x106d60);if(_0x106d60[_0x34dd('0x109')]==='agent'){_0x5b4ad0[_0x34dd('0x10a')]=this[_0x34dd('0x1e')][_0x106d60[_0x34dd('0xaf')]][_0x34dd('0x10b')]&&this[_0x34dd('0x1e')][_0x106d60['queue']][_0x34dd('0x10c')]?moment()[_0x34dd('0x75')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x5b4ad0)[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x10d')));this['moveContactManagedDialer'](_0x5b4ad0)['catch'](loggerCatch(_0x34dd('0x10e')));}}};Dialer[_0x34dd('0xa4')][_0x34dd('0x2b')]=function(_0x57f3db){if(this[_0x34dd('0x1e')][_0x57f3db[_0x34dd('0xaf')]]){if(this[_0x34dd('0x24')][_0x57f3db['uniqueid']]&&this[_0x34dd('0x24')][_0x57f3db[_0x34dd('0xdc')]]['type']!==_0x34dd('0xad')){this['updateOriginated'](this['voiceQueues'][_0x57f3db[_0x34dd('0xaf')]]);this[_0x34dd('0x24')][_0x57f3db[_0x34dd('0xdc')]][_0x34dd('0x10f')]=moment()[_0x34dd('0x75')](_0x34dd('0xfa'));}}};Dialer['prototype'][_0x34dd('0x110')]=function(_0x5ace3d){this[_0x34dd('0xc8')](_0x5ace3d)[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x10d')));this['moveContactManagedDialer'](_0x5ace3d)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x34dd('0xa4')][_0x34dd('0x111')]=function(_0x270958){var _0x5ddfc5=this[_0x34dd('0x24')][_0x270958[_0x34dd('0xdc')]];var _0x6839fc=this;if(this[_0x34dd('0x1e')][_0x270958[_0x34dd('0xaf')]]){if(_0x5ddfc5&&_0x5ddfc5[_0x34dd('0x47')]!==_0x34dd('0xad')){delete this['uniqueId'][_0x270958[_0x34dd('0xdc')]];this[_0x34dd('0xae')](this[_0x34dd('0x1e')][_0x270958[_0x34dd('0xaf')]]);_0x5ddfc5[_0x34dd('0x112')]=moment()[_0x34dd('0x75')](_0x34dd('0xfa'));var _0xd9976d=new QueueCallerAbandon(_0x5ddfc5,_0x270958);if(getSeconds(_0x5ddfc5[_0x34dd('0x112')],_0x5ddfc5[_0x34dd('0x113')])>=_0x5ddfc5[_0x34dd('0x114')]){this['voiceQueues'][_0x270958[_0x34dd('0xaf')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x34dd('0x1e')][_0x270958[_0x34dd('0xaf')]][_0x34dd('0x5e')]+=0x1;this[_0x34dd('0x1e')][_0x270958['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0xd9976d[_0x34dd('0xe3')]=0xa;_0xd9976d[_0x34dd('0xa1')]=_0x34dd('0x115');_0xd9976d['dropreason']=_0x34dd('0x116');_0xd9976d[_0x34dd('0x10a')]=this['voiceQueues'][_0x270958[_0x34dd('0xaf')]][_0x34dd('0x10b')]?moment()[_0x34dd('0x75')](_0x34dd('0xfa')):undefined;_0xd9976d['countdropretry']+=0x1;_0xd9976d[_0x34dd('0x117')]+=0x1;if(_0xd9976d[_0x34dd('0xf2')]>=this[_0x34dd('0x1e')][_0x270958[_0x34dd('0xaf')]][_0x34dd('0x118')]){this[_0x34dd('0x110')](_0xd9976d);}else{this[_0x34dd('0xbc')]({'active':![],'countdropretry':_0xd9976d[_0x34dd('0xf2')],'scheduledat':moment()[_0x34dd('0xf9')](this[_0x34dd('0x1e')][_0x270958['queue']][_0x34dd('0x119')],_0x34dd('0x11a'))[_0x34dd('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5ddfc5[_0x34dd('0xd0')],'ListId':_0x5ddfc5[_0x34dd('0xd1')],'VoiceQueueId':_0x5ddfc5['VoiceQueueId']||undefined,'CampaignId':_0x5ddfc5[_0x34dd('0xd4')]||undefined})[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x11b')));var _0x306038=new History(_0xd9976d);_0x306038['state']=0xa;_0x306038[_0x34dd('0xa1')]=_0x34dd('0x115');_0x306038['starttime']=moment()[_0x34dd('0x75')](_0x34dd('0xfa'));_0x306038[_0x34dd('0xa2')]=_0x306038[_0x34dd('0xa3')];_0x306038[_0x34dd('0x11c')]=_0xd9976d[_0x34dd('0x11c')];_0x306038[_0x34dd('0x11d')]=_0xd9976d[_0x34dd('0x11d')];this['createHistory'](_0x306038)[_0x34dd('0xb8')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x34dd('0x1e')][_0x270958['queue']][_0x34dd('0x67')]+=0x1;this[_0x34dd('0x1e')][_0x270958[_0x34dd('0xaf')]]['outboundDropCallsDayCallersExit']+=0x1;_0xd9976d[_0x34dd('0xe3')]=0xb;_0xd9976d[_0x34dd('0xa1')]='Abandoned';_0xd9976d[_0x34dd('0x11e')]=_0x34dd('0x11f');_0xd9976d['countabandonedretry']+=0x1;_0xd9976d[_0x34dd('0x117')]+=0x1;if(_0xd9976d['countabandonedretry']>=this['voiceQueues'][_0x270958[_0x34dd('0xaf')]][_0x34dd('0x120')]){this['queueCallerAbandonCreateState'](_0xd9976d);}else{this[_0x34dd('0xbc')]({'active':![],'countabandonedretry':_0xd9976d[_0x34dd('0xf3')],'scheduledat':moment()[_0x34dd('0xf9')](this['voiceQueues'][_0x270958['queue']][_0x34dd('0x121')],'minutes')[_0x34dd('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5ddfc5[_0x34dd('0xd0')],'ListId':_0x5ddfc5['ListId'],'VoiceQueueId':_0x5ddfc5['VoiceQueueId']||undefined,'CampaignId':_0x5ddfc5[_0x34dd('0xd4')]||undefined})['catch'](loggerCatch(_0x34dd('0x122')));var _0x306038=new History(_0xd9976d);_0x306038[_0x34dd('0xe3')]=0xb;_0x306038['statedesc']='Abandoned';_0x306038[_0x34dd('0xa3')]=moment()[_0x34dd('0x75')](_0x34dd('0xfa'));_0x306038[_0x34dd('0xa2')]=_0x306038['starttime'];_0x306038['calleridname']=_0xd9976d[_0x34dd('0x11c')];_0x306038[_0x34dd('0x11d')]=_0xd9976d['calleridnum'];this['createHistory'](_0x306038)[_0x34dd('0xb8')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x34dd('0xa4')]['syncNewExten']=function(_0x4fa47d){if(this[_0x34dd('0xa8')][_0x4fa47d[_0x34dd('0xdc')]]){this[_0x34dd('0xa8')][_0x4fa47d[_0x34dd('0xdc')]][_0x34dd('0x123')]=_0x4fa47d[_0x34dd('0x123')];}if(this[_0x34dd('0x24')][_0x4fa47d[_0x34dd('0xdc')]]){this[_0x34dd('0x24')][_0x4fa47d[_0x34dd('0xdc')]]['channel']=_0x4fa47d[_0x34dd('0x123')];}};Dialer[_0x34dd('0xa4')][_0x34dd('0x124')]=function(_0x48d182){if(strategy[this['voiceQueues'][this[_0x34dd('0xa8')][_0x48d182[_0x34dd('0x125')]]['queue']][_0x34dd('0x49')]]===_0x34dd('0x18')){if(this['actions'][_0x48d182[_0x34dd('0x125')]]&&_[_0x34dd('0xaa')](this[_0x34dd('0xa8')][_0x48d182[_0x34dd('0x125')]][_0x34dd('0x126')])&&_0x48d182[_0x34dd('0xab')]==='1'&&_0x48d182[_0x34dd('0x127')]==='0'){if(this[_0x34dd('0x20')][_0x48d182[_0x34dd('0x128')]]){if(!this[_0x34dd('0x20')][_0x48d182[_0x34dd('0x128')]]['locked']){this[_0x34dd('0x20')][_0x48d182['stateinterface']]['locked']=!![];this[_0x34dd('0xa8')][_0x48d182[_0x34dd('0x125')]][_0x34dd('0x126')]=!![];this[_0x34dd('0xa8')][_0x48d182['actionid']][_0x34dd('0x128')]=_0x48d182[_0x34dd('0x128')];}}}}else if((strategy[this[_0x34dd('0x1e')][this[_0x34dd('0xa8')][_0x48d182['actionid']]['queue']][_0x34dd('0x49')]]||_0x34dd('0x129'))==='rrmemory'){if(this[_0x34dd('0xa8')][_0x48d182[_0x34dd('0x125')]]){if(this[_0x34dd('0x20')][_0x48d182['stateinterface']]){this['actions'][_0x48d182[_0x34dd('0x125')]][_0x34dd('0x128')]=_0x48d182['stateinterface'];if(_[_0x34dd('0xaa')](this[_0x34dd('0x29')][this[_0x34dd('0xa8')][_0x48d182[_0x34dd('0x125')]][_0x34dd('0xaf')]])){this[_0x34dd('0x29')][this[_0x34dd('0xa8')][_0x48d182[_0x34dd('0x125')]]['queue']]=[];}this[_0x34dd('0x29')][this[_0x34dd('0xa8')][_0x48d182[_0x34dd('0x125')]]['queue']][_0x34dd('0x12a')](_['merge'](_[_0x34dd('0xcf')](this[_0x34dd('0xa8')][_0x48d182[_0x34dd('0x125')]],['idHopper',_0x34dd('0x128')]),{'status':_0x48d182['status'],'paused':_0x48d182[_0x34dd('0x127')]}));}}}};function unlockQueueStatus(_0x138eeb,_0x31beae){setTimeout(function(){if(_[_0x34dd('0x37')](_0x138eeb[_0x34dd('0x12b')])){loggerBooked[_0x34dd('0x91')](_0x34dd('0x12c'),_0x31beae);}_0x138eeb[_0x34dd('0x12b')]=!![];loggerBooked[_0x34dd('0x7a')](_0x34dd('0x12d'),_0x31beae,JSON[_0x34dd('0x43')](_[_0x34dd('0xcf')](_0x138eeb,[_0x34dd('0x3a'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x34dd('0xa4')][_0x34dd('0x36')]=function(_0x39efcd){var _0x18d314=this;var _0x3e99fd=_0x18d314[_0x34dd('0x1e')][_0x18d314['actions'][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0xaf')]];if(strategy[this['voiceQueues'][this['actions'][_0x39efcd[_0x34dd('0x125')]]['queue']][_0x34dd('0x49')]]===_0x34dd('0x18')){if(this['actions'][_0x39efcd['actionid']]&&this[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0x128')]){this[_0x34dd('0x1d')][_0x34dd('0x12e')](this[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0x12f')],this['actions'][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0x128')])[_0x34dd('0xb8')](function(_0x209fad){logger[_0x34dd('0x91')](_0x34dd('0x130'),util[_0x34dd('0x92')](_0x209fad,{'showHidden':![],'depth':null}));})[_0x34dd('0x1b')](function(){_0x18d314[_0x34dd('0xae')](_0x18d314[_0x34dd('0x1e')][_0x18d314['actions'][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0xaf')]]);_0x18d314[_0x34dd('0x20')][_0x18d314[_0x34dd('0xa8')][_0x39efcd['actionid']]['stateinterface']][_0x34dd('0x126')]=![];delete _0x18d314[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]];unlockQueueStatus(_0x3e99fd);});}else{this[_0x34dd('0xae')](this[_0x34dd('0x1e')][this[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0xaf')]]);this[_0x34dd('0xbc')]({'active':![],'ContactId':this[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0xd0')],'ListId':this[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0xd1')],'VoiceQueueId':this['actions'][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0xd3')]||undefined,'CampaignId':this[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]]['CampaignId']||undefined})[_0x34dd('0xb8')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]];unlockQueueStatus(_0x3e99fd);}}else if((strategy[this['voiceQueues'][this[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0xaf')]]['strategy']]||_0x34dd('0x129'))==='rrmemory'){var _0x300df9;if(this['actions'][_0x39efcd[_0x34dd('0x125')]]&&!_[_0x34dd('0x79')](this['queueBooked'][this[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0xaf')]])){if(this[_0x34dd('0x131')][_0x18d314[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0xaf')]]){this[_0x34dd('0x131')][_0x18d314[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0xaf')]]=this['queueBookedRR'][this[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0xaf')]]?this['queueBookedRR'][this[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0xaf')]]:this[_0x34dd('0x29')][this['actions'][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0xaf')]]?this[_0x34dd('0x29')][this[_0x34dd('0xa8')][_0x39efcd['actionid']][_0x34dd('0xaf')]]['_rr']||0x0:0x0;}this[_0x34dd('0x29')][this[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]]['queue']]['_rr']=this[_0x34dd('0x131')][this[_0x34dd('0xa8')][_0x39efcd[_0x34dd('0x125')]][_0x34dd('0xaf')]];for(var _0x4fce88=0x0;_0x4fce88=0x0;})[_0x34dd('0xb8')](myreject(_0x1b96f4)));}}else{_0x156ab4[_0x34dd('0x12a')](ami[_0x34dd('0x14f')]({'action':_0x34dd('0x149'),'command':util[_0x34dd('0x75')](_0x34dd('0x14a'),_0x2da7e6,!_[_0x34dd('0x37')](config[_0x34dd('0x14c')][_0x2dc278])?_0x2dc278:'')})[_0x34dd('0xb5')](function(_0x1763dd){return _0x1763dd[_0x34dd('0x150')]['indexOf'](_0x34dd('0x14e'))>=0x0;})[_0x34dd('0xb8')](myreject(_0x1b96f4)));}BPromise[_0x34dd('0x151')](_0x156ab4)[_0x34dd('0xb5')](function(_0x3df497){var _0x40548e=_[_0x34dd('0x152')](_0x3df497);if(_0x40548e){return _0x5d8199(_0x40548e);}else{_0x40cd42[_0x34dd('0x38')]=_0x6a4045?'GLOBAL_INTERVAL_IS_OVERTIME':_0x34dd('0x153');return _0x1b96f4(msgResponse(_0x34dd('0x154'),'Failure','Global:\x20'+_0x6a4045+'\x20'+_0x30bfd0+'\x20Interval\x20is\x20overtime:\x20'+util[_0x34dd('0x92')](_0x2da7e6,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x2dc278));}})[_0x34dd('0xb8')](function(_0x1c959d){return _0x1b96f4(msgResponse('ifTime',_0x34dd('0x143'),JSON[_0x34dd('0x43')](_0x1c959d)));});});};Dialer[_0x34dd('0xa4')]['checkDialMethod']=function(_0x3bb0d8){var _0x2f7e30=this;return function(){switch(_0x3bb0d8['dialMethod']){case _0x34dd('0x155'):freeVariablesPredictive(_0x3bb0d8);_0x2f7e30['handlePower'](_0x3bb0d8,0x1);break;case'power':freeVariablesPredictive(_0x3bb0d8);_0x2f7e30[_0x34dd('0x156')](_0x3bb0d8,_0x3bb0d8['dialPowerLevel']);break;case'predictive':_0x2f7e30[_0x34dd('0x8')](_0x3bb0d8);break;case _0x34dd('0x7'):freeVariablesPredictive(_0x3bb0d8);_0x2f7e30[_0x34dd('0x156')](_0x3bb0d8,0x1);break;default:freeVariablesPredictive(_0x3bb0d8);logger['error'](_0x34dd('0x157'),_0x3bb0d8[_0x34dd('0x3a')],'method\x20not\x20recognized');}};};Dialer[_0x34dd('0xa4')][_0x34dd('0x158')]=function(_0x21324a){var _0x3e3fd8=this;return function(){_0x3e3fd8['handleIvr'](_0x21324a);};};Dialer[_0x34dd('0xa4')]['syncQueueSummary']=function(_0x2a2e17){var _0x27c0ac=this;if(isNotPreview(_0x2a2e17[_0x34dd('0x55')])){if(isVoiceQueueOutbound(_0x2a2e17[_0x34dd('0x47')])&&isActive(_0x2a2e17[_0x34dd('0x54')])){_0x2a2e17[_0x34dd('0x9f')]=!![];BPromise[_0x34dd('0xb3')]()[_0x34dd('0xb5')](checkIsLoggedIn(_0x2a2e17,_0x2a2e17[_0x34dd('0x4b')]))[_0x34dd('0xb5')](checkIsActive(_0x2a2e17,_0x2a2e17[_0x34dd('0x54')]))[_0x34dd('0xb5')](checkInterval(_0x2a2e17))[_0x34dd('0xb5')](_0x27c0ac[_0x34dd('0x159')](_0x2a2e17))[_0x34dd('0xb5')](_0x27c0ac[_0x34dd('0x15a')](_0x2a2e17['dialGlobalInterval'],_0x2a2e17[_0x34dd('0x15b')],_0x2a2e17[_0x34dd('0x3a')],_0x2a2e17))[_0x34dd('0xb5')](_0x27c0ac['checkIfTimeIntervals'](_0x2a2e17[_0x34dd('0x40')],_0x2a2e17[_0x34dd('0x15b')],_0x2a2e17[_0x34dd('0x3a')],_0x2a2e17))['then'](_0x27c0ac['checkDialMethod'](_0x2a2e17))[_0x34dd('0xb8')](loggerCatchQueueSummary(_0x34dd('0x15c'),_0x2a2e17));}else{notSendMessagesQueue(_0x2a2e17);}}else{freeVariablesPredictive(_0x2a2e17);}};Dialer[_0x34dd('0xa4')]['syncCampaigns']=function(){var _0x9b6ce=this;var _0x1e98a6;for(var _0x3cceaa in this[_0x34dd('0x1f')]){if(typeof this['campaigns'][_0x3cceaa]!=='undefined'){_0x1e98a6=this[_0x34dd('0x1f')][_0x3cceaa];if(isCampaignIvr(_0x1e98a6[_0x34dd('0x47')])&&isActive(_0x1e98a6['active'])){_0x1e98a6[_0x34dd('0x9f')]=!![];BPromise[_0x34dd('0xb3')]()[_0x34dd('0xb5')](checkIsActive(_0x1e98a6,_0x1e98a6[_0x34dd('0x73')]))[_0x34dd('0xb5')](checkInterval(_0x1e98a6))[_0x34dd('0xb5')](_0x9b6ce[_0x34dd('0x159')](_0x1e98a6))[_0x34dd('0xb5')](_0x9b6ce[_0x34dd('0x15a')](_0x1e98a6['dialGlobalInterval'],_0x1e98a6[_0x34dd('0x15b')],_0x1e98a6[_0x34dd('0x3a')],_0x1e98a6))[_0x34dd('0xb5')](_0x9b6ce['checkIfTimeIntervals'](_0x1e98a6[_0x34dd('0x40')],_0x1e98a6[_0x34dd('0x15b')],_0x1e98a6[_0x34dd('0x3a')],_0x1e98a6))[_0x34dd('0xb5')](_0x9b6ce[_0x34dd('0x158')](_0x1e98a6))[_0x34dd('0xb8')](loggerCatchQueueSummary(_0x34dd('0x15d'),_0x1e98a6));}else{notSendMessagesCampaign(_0x1e98a6);}}}};function getCallerIdRandom(_0x154798,_0x37ac85){var _0xc39d6f;var _0x176c29;var _0x1d377c;if(_0x37ac85<=0x0){_0x37ac85=0x1;}_0xc39d6f=new RegExp(_0x34dd('0x15e')+_0x37ac85+'}$');_0x176c29=Math['pow'](0xa,_0x37ac85-0x1);_0x1d377c=Math[_0x34dd('0x15f')](0xa,_0x37ac85)-0x1;return util[_0x34dd('0x75')]('%s',_[_0x34dd('0x160')](_0x154798,_0xc39d6f,_[_0x34dd('0x161')](_0x176c29,_0x1d377c)));}function extractCalleridName(_0x1961f5){var _0x843256=_0x1961f5[_0x34dd('0x162')](/"(.*?)"/);return _0x843256?_0x843256[0x1]:_0x1961f5;}function extractCalleridNumber(_0x3812d8){var _0x483b6e=_0x3812d8[_0x34dd('0x162')](/<(.*?)>/);return _0x483b6e?_0x483b6e[0x1]:_0x3812d8;}Dialer['prototype'][_0x34dd('0x163')]=function(_0x34f95e,_0x3aa0bb){var _0x405a8e=this;var _0x14fb72=uuid['v4']();this[_0x34dd('0xa8')][_0x14fb72]=new Action(_0x34f95e,_0x3aa0bb,_0x14fb72);return new BPromise(function(_0x102306,_0x1ed2a8){if(_[_0x34dd('0x37')](_0x34f95e)&&typeof _0x34f95e!==_0x34dd('0x164')){return _0x1ed2a8(msgResponse(_0x34dd('0x165'),_0x34dd('0x143'),_0x34dd('0x166')));}if(_[_0x34dd('0x37')](_0x3aa0bb[_0x34dd('0x167')][_0x34dd('0x168')])||_0x3aa0bb[_0x34dd('0x167')][_0x34dd('0x168')]===null){return _0x1ed2a8(msgResponse('originate',_0x34dd('0x143'),_0x34dd('0x169')));}var _0x563763={'XMD-CALLERID':_0x405a8e[_0x34dd('0xa8')][_0x14fb72][_0x34dd('0x16a')](),'XMD-AGI':_0x34f95e[_0x34dd('0x104')]?util[_0x34dd('0x75')](_0x34dd('0x16b'),ipAgi,_0x34f95e[_0x34dd('0x104')]):_0x34dd('0x16c'),'XMD-AGIAFTER':_0x34f95e['dialQueueProject2']?util[_0x34dd('0x75')](_0x34dd('0x16b'),ipAgi,_0x34f95e[_0x34dd('0x10b')]):_0x34dd('0x16c'),'XMD-QUEUE':_0x34f95e[_0x34dd('0x47')]===_0x34dd('0x48')?util[_0x34dd('0x75')](_0x34dd('0x16d'),_0x34f95e[_0x34dd('0x3a')],_0x34f95e[_0x34dd('0x16e')]||'',_0x34f95e[_0x34dd('0x10c')]?'c':'',_0x34f95e['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x3aa0bb[_0x34dd('0xd0')],'XMD-CDRTYPE':_0x34dd('0x16f'),'CALLERID(all)':_0x405a8e[_0x34dd('0xa8')][_0x14fb72][_0x34dd('0x16a')](),'XMD-AMD':_0x34f95e[_0x34dd('0xe1')]?_0x34dd('0x170'):_0x34dd('0x16c'),'XMD-DESTINATION':_0x34dd('0xe0')};if(_0x34f95e['dialAMDActive']){_0x563763[_0x34dd('0x171')]=_0x34f95e[_0x34dd('0x172')]||0x9c4;_0x563763[_0x34dd('0x173')]=_0x34f95e[_0x34dd('0x174')]||0x5dc;_0x563763[_0x34dd('0x175')]=_0x34f95e[_0x34dd('0x176')]||0x320;_0x563763[_0x34dd('0x177')]=_0x34f95e[_0x34dd('0x178')]||0x1388;_0x563763[_0x34dd('0x179')]=_0x34f95e[_0x34dd('0x17a')]||0x64;_0x563763[_0x34dd('0x17b')]=_0x34f95e[_0x34dd('0x17c')]||0x32;_0x563763['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x34f95e[_0x34dd('0x17d')]||0x3;_0x563763[_0x34dd('0x17e')]=_0x34f95e[_0x34dd('0x17f')]||0x100;_0x563763[_0x34dd('0x180')]=_0x34f95e['dialAMDMaximumWordLength']||0x1388;}if(_0x34f95e[_0x34dd('0x47')]===_0x34dd('0x48')){_0x563763[_0x34dd('0x181')]=_0x3aa0bb['VoiceQueueId'];}else{_0x563763[_0x34dd('0x182')]=_0x3aa0bb[_0x34dd('0xd4')];}for(var _0x16ffc5 in _0x3aa0bb[_0x34dd('0x167')]){if(typeof _0x3aa0bb[_0x34dd('0x167')][_0x16ffc5]!==_0x34dd('0x95')){if(isNotNull(_0x3aa0bb['Contact'][_0x16ffc5])&&_0x16ffc5!=='id'&&_0x16ffc5!==_0x34dd('0x183')&&_0x16ffc5!=='createdAt'&&_0x16ffc5!==_0x34dd('0x184')){_0x563763[util[_0x34dd('0x75')](_0x34dd('0x185'),_0x34dd('0x186'),_[_0x34dd('0x187')](_0x16ffc5))]=_0x3aa0bb[_0x34dd('0x167')][_0x16ffc5];}}}var _0x5130d4=_0x405a8e[_0x34dd('0x13e')](_0x34f95e[_0x34dd('0x72')])?getCallerId(_0x34f95e['Trunk']['callerid'],_0x34f95e[_0x34dd('0x188')],_0x34f95e[_0x34dd('0x189')]>0x0?getCallerIdRandom(_0x34f95e[_0x34dd('0x56')],_0x34f95e['dialRandomLastDigitCallerIdNumber']):_0x34f95e[_0x34dd('0x56')]):getCallerId(_['isNil'](_0x34f95e['TrunkBackup'])?_0x34f95e[_0x34dd('0x72')][_0x34dd('0x74')]:_0x34f95e[_0x34dd('0x13f')][_0x34dd('0x74')],_0x34f95e[_0x34dd('0x188')],_0x34f95e[_0x34dd('0x189')]>0x0?getCallerIdRandom(_0x34f95e[_0x34dd('0x56')],_0x34f95e[_0x34dd('0x189')]):_0x34f95e[_0x34dd('0x56')]);if(_0x5130d4){_0x563763['XMD-ORIGINATECALLERIDNAME']=_0x405a8e['actions'][_0x14fb72][_0x34dd('0x18a')]=extractCalleridName(_0x5130d4);_0x563763[_0x34dd('0x18b')]=_0x405a8e[_0x34dd('0xa8')][_0x14fb72]['originatecalleridnum']=extractCalleridNumber(_0x5130d4);}return ami['Action']({'actionid':_0x14fb72,'action':_0x34dd('0x165'),'channel':_0x405a8e[_0x34dd('0x13e')](_0x34f95e[_0x34dd('0x72')])?util[_0x34dd('0x75')]('SIP/%s/%s%s',_0x34f95e[_0x34dd('0x72')][_0x34dd('0x3a')],isNotNull(_0x34f95e[_0x34dd('0x57')])?_0x34f95e[_0x34dd('0x57')][_0x34dd('0x18c')]()||'':'',_0x34f95e[_0x34dd('0x18d')]>0x0?_0x3aa0bb[_0x34dd('0x167')][_0x34dd('0x168')]['substring'](_0x34f95e[_0x34dd('0x18d')]):_0x3aa0bb[_0x34dd('0x167')][_0x34dd('0x168')]):util[_0x34dd('0x75')](_0x34dd('0x18e'),_[_0x34dd('0xaa')](_0x34f95e[_0x34dd('0x13f')])?_0x34f95e[_0x34dd('0x72')][_0x34dd('0x3a')]:_0x34f95e[_0x34dd('0x13f')][_0x34dd('0x3a')],isNotNull(_0x34f95e[_0x34dd('0x57')])?_0x34f95e[_0x34dd('0x57')][_0x34dd('0x18c')]()||'':'',_0x34f95e[_0x34dd('0x18d')]>0x0?_0x3aa0bb[_0x34dd('0x167')][_0x34dd('0x168')]['substring'](_0x34f95e[_0x34dd('0x18d')]):_0x3aa0bb[_0x34dd('0x167')][_0x34dd('0x168')]),'callerid':_0x5130d4,'Exten':_0x34dd('0xe0'),'Context':'from-sip','Priority':'1','variable':_0x563763,'timeout':(_0x34f95e['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x14fb72})[_0x34dd('0xb5')](function(_0x30b8e0){return _0x102306(_0x30b8e0);})['catch'](function(_0x512c9c){_0x34f95e['outboundOriginateFailureCallsDay']+=0x1;var _0x2e977e=new History(_0x405a8e[_0x34dd('0xa8')][_0x14fb72]);logger['error'](util['format']('[originateError]:\x20%s',JSON[_0x34dd('0x43')](_0x512c9c)));_0x2e977e[_0x34dd('0xe3')]=0xe;_0x2e977e[_0x34dd('0xa1')]='OriginateError';_0x2e977e['starttime']=moment()[_0x34dd('0x75')](_0x34dd('0xfa'));_0x2e977e[_0x34dd('0xa2')]=_0x2e977e[_0x34dd('0xa3')];_0x405a8e[_0x34dd('0xc8')](_0x2e977e)['catch'](loggerCatch(_0x34dd('0x18f')));_0x405a8e[_0x34dd('0xc7')](_0x2e977e)[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x18f')))[_0x34dd('0x1b')](function(){delete _0x405a8e['actions'][_0x14fb72];return _0x1ed2a8(msgResponse(_0x34dd('0x165'),_0x34dd('0x190'),_0x34dd('0x191')));});});});};Dialer['prototype'][_0x34dd('0x2d')]=function(_0x291d72){var _0x174c81=this['actions'][_0x291d72['actionid']];if(_0x174c81){delete this[_0x34dd('0xa8')][_0x291d72[_0x34dd('0x125')]];_0x174c81[_0x34dd('0x113')]=moment()[_0x34dd('0x75')](_0x34dd('0xfa'));var _0x2427bb=_0x174c81[_0x34dd('0x47')]===_0x34dd('0xad')?this[_0x34dd('0x1f')][_0x174c81[_0x34dd('0xaf')]]:this['voiceQueues'][_0x174c81[_0x34dd('0x192')]()];if(!this[_0x34dd('0xd7')](_0x291d72[_0x34dd('0x193')])){this['updateOriginated'](_0x2427bb);return this['callProgressDetecting'](_0x174c81,_0x2427bb,_0x291d72)[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x194')));}this['uniqueId'][_0x291d72['uniqueid']]=_0x174c81;}};Dialer[_0x34dd('0xa4')][_0x34dd('0x195')]=function(_0x5539c,_0x29c8a2,_0x393d73){var _0x35bd8a=new History(_0x29c8a2);if(_0x35bd8a[_0x34dd('0xee')]+_0x35bd8a[_0x34dd('0xef')]+_0x35bd8a[_0x34dd('0xf0')]+_0x35bd8a[_0x34dd('0xf1')]+_0x35bd8a[_0x34dd('0xf2')]+_0x35bd8a[_0x34dd('0xf3')]+_0x35bd8a[_0x34dd('0xea')]+_0x35bd8a['countagentrejectretry']>=_0x393d73[_0x34dd('0x100')]-0x1){return!![];}switch(_0x5539c){case 0x3:if(_0x35bd8a[_0x34dd('0xf0')]>=_0x393d73[_0x34dd('0x196')]-0x1){return!![];}this[_0x34dd('0xbc')]({'active':![],'countnoanswerretry':_0x35bd8a[_0x34dd('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x393d73[_0x34dd('0x197')],_0x34dd('0x11a'))['format'](_0x34dd('0xfa')),'ContactId':_0x35bd8a['ContactId'],'ListId':_0x35bd8a[_0x34dd('0xd1')],'VoiceQueueId':_0x35bd8a['VoiceQueueId']||undefined,'CampaignId':_0x35bd8a[_0x34dd('0xd4')]||undefined})['catch'](loggerCatch(_0x34dd('0x198')));break;case 0x5:if(_0x35bd8a['countbusyretry']>=_0x393d73[_0x34dd('0x199')]-0x1){return!![];}this[_0x34dd('0xbc')]({'active':![],'countbusyretry':_0x35bd8a[_0x34dd('0xee')]+=0x1,'scheduledat':moment()[_0x34dd('0xf9')](_0x393d73[_0x34dd('0x19a')],'minutes')[_0x34dd('0x75')](_0x34dd('0xfa')),'ContactId':_0x35bd8a[_0x34dd('0xd0')],'ListId':_0x35bd8a[_0x34dd('0xd1')],'VoiceQueueId':_0x35bd8a[_0x34dd('0xd3')]||undefined,'CampaignId':_0x35bd8a[_0x34dd('0xd4')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x35bd8a[_0x34dd('0xef')]>=_0x393d73['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x35bd8a[_0x34dd('0xef')]+=0x1,'scheduledat':moment()['add'](_0x393d73[_0x34dd('0x19b')],_0x34dd('0x11a'))[_0x34dd('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x35bd8a['ContactId'],'ListId':_0x35bd8a['ListId'],'VoiceQueueId':_0x35bd8a['VoiceQueueId']||undefined,'CampaignId':_0x35bd8a[_0x34dd('0xd4')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x35bd8a[_0x34dd('0xf1')]>=_0x393d73[_0x34dd('0x19c')]-0x1){return!![];}else{this[_0x34dd('0xbc')]({'active':![],'countnosuchnumberretry':_0x35bd8a[_0x34dd('0xf1')]+=0x1,'scheduledat':moment()[_0x34dd('0xf9')](_0x393d73[_0x34dd('0x19d')],'minutes')[_0x34dd('0x75')](_0x34dd('0xfa')),'ContactId':_0x35bd8a['ContactId'],'ListId':_0x35bd8a[_0x34dd('0xd1')],'VoiceQueueId':_0x35bd8a['VoiceQueueId']||undefined,'CampaignId':_0x35bd8a[_0x34dd('0xd4')]||undefined})[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x19e')));}break;case 0xa:if(_0x35bd8a[_0x34dd('0xf2')]>=_0x393d73[_0x34dd('0x118')]-0x1){return!![];}this[_0x34dd('0xbc')]({'active':![],'countdropretry':_0x35bd8a[_0x34dd('0xf2')]+=0x1,'scheduledat':moment()[_0x34dd('0xf9')](_0x393d73[_0x34dd('0x119')],_0x34dd('0x11a'))['format'](_0x34dd('0xfa')),'ContactId':_0x35bd8a[_0x34dd('0xd0')],'ListId':_0x35bd8a['ListId'],'VoiceQueueId':_0x35bd8a['VoiceQueueId']||undefined,'CampaignId':_0x35bd8a[_0x34dd('0xd4')]||undefined})['catch'](loggerCatch(_0x34dd('0x11b')));break;case 0xb:if(_0x35bd8a[_0x34dd('0xf3')]>=_0x393d73['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x34dd('0xbc')]({'active':![],'countabandonedretry':_0x35bd8a[_0x34dd('0xf3')]+=0x1,'scheduledat':moment()[_0x34dd('0xf9')](_0x393d73[_0x34dd('0x121')],_0x34dd('0x11a'))[_0x34dd('0x75')](_0x34dd('0xfa')),'ContactId':_0x35bd8a[_0x34dd('0xd0')],'ListId':_0x35bd8a[_0x34dd('0xd1')],'VoiceQueueId':_0x35bd8a[_0x34dd('0xd3')]||undefined,'CampaignId':_0x35bd8a[_0x34dd('0xd4')]||undefined})[_0x34dd('0xb8')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x35bd8a[_0x34dd('0xea')]>=_0x393d73[_0x34dd('0xf6')]-0x1){return!![];}this[_0x34dd('0xbc')]({'active':![],'countmachineretry':_0x35bd8a[_0x34dd('0xea')]+=0x1,'scheduledat':moment()[_0x34dd('0xf9')](_0x393d73[_0x34dd('0x101')],'minutes')['format'](_0x34dd('0xfa')),'ContactId':_0x35bd8a[_0x34dd('0xd0')],'ListId':_0x35bd8a[_0x34dd('0xd1')],'VoiceQueueId':_0x35bd8a[_0x34dd('0xd3')]||undefined,'CampaignId':_0x35bd8a[_0x34dd('0xd4')]||undefined})[_0x34dd('0xb8')](loggerCatch(_0x34dd('0xfb')));break;case 0x14:if(_0x35bd8a[_0x34dd('0xf4')]>=_0x393d73[_0x34dd('0x19f')]-0x1){return!![];}this[_0x34dd('0xbc')]({'active':![],'countagentrejectretry':_0x35bd8a[_0x34dd('0xf4')]+=0x1,'scheduledat':moment()[_0x34dd('0xf9')](_0x393d73[_0x34dd('0x1a0')],_0x34dd('0x11a'))[_0x34dd('0x75')](_0x34dd('0xfa')),'ContactId':_0x35bd8a[_0x34dd('0xd0')],'ListId':_0x35bd8a[_0x34dd('0xd1')],'VoiceQueueId':_0x35bd8a[_0x34dd('0xd3')]||undefined,'CampaignId':_0x35bd8a[_0x34dd('0xd4')]||undefined})[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x1a1')));break;default:return!![];}};Dialer[_0x34dd('0xa4')]['callProgressDetecting']=function(_0x34f192,_0x5381e6,_0x3691d5){var _0xd003b8=this;var _0x5d3218=new History(_0x34f192);return new BPromise(function(_0x403fd1,_0x469d57){if(_[_0x34dd('0x37')](_0x5381e6)&&typeof _0x5381e6!==_0x34dd('0x164')){return _0x469d57(msgResponse(_0x34dd('0x1a2'),_0x34dd('0x143'),_0x34dd('0x1a3')));}if(_[_0x34dd('0x37')](_0x3691d5)&&typeof _0x3691d5!=='object'){return _0x469d57(msgResponse('[callProgressDetecting]',_0x34dd('0x143'),'evt\x20is\x20undefine'));}switch(_0x3691d5['reason']){case'0':_0x5381e6['outboundNoSuchCallsDay']+=0x1;_0x5d3218['state']=0x0;_0x5d3218['statedesc']=_0x34dd('0x1a4');_0x5d3218[_0x34dd('0xf1')]+=0x1;_0x5d3218[_0x34dd('0x117')]+=0x1;ami[_0x34dd('0x46')](_0x34dd('0x1a5'),ut[_0x34dd('0xec')](_0x34f192,'nosuchnumber'));_0xd003b8[_0x34dd('0xc8')](_0x5d3218)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xd003b8['checkRetriveMax'](0x0,_0x34f192,_0x5381e6)){if(_0x5d3218[_0x34dd('0xf1')]>=_0x5381e6[_0x34dd('0x19c')]){_0xd003b8[_0x34dd('0xf7')](_0x5d3218,_0x403fd1,_0x469d57,_0x34dd('0x1a6'));}else{_0xd003b8[_0x34dd('0xf5')](_0x5d3218,_0x403fd1,_0x469d57,_0x34dd('0x1a6'));}}break;case'3':_0x5381e6[_0x34dd('0x5f')]+=0x1;_0x5d3218[_0x34dd('0xe3')]=0x3;_0x5d3218['statedesc']=_0x34dd('0x1a7');_0x5d3218[_0x34dd('0xf0')]+=0x1;_0x5d3218[_0x34dd('0x117')]+=0x1;ami[_0x34dd('0x46')](_0x34dd('0x1a8'),ut[_0x34dd('0xec')](_0x34f192,_0x34dd('0x1a9')));_0xd003b8[_0x34dd('0xc8')](_0x5d3218)[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x1aa')));if(_0xd003b8[_0x34dd('0x195')](0x3,_0x34f192,_0x5381e6)){if(_0x5d3218[_0x34dd('0xf0')]>=_0x5381e6['dialNoAnswerMaxRetry']){_0xd003b8[_0x34dd('0xf7')](_0x5d3218,_0x403fd1,_0x469d57,'reason\x203\x20ringing\x20no\x20answer');}else{_0xd003b8[_0x34dd('0xf5')](_0x5d3218,_0x403fd1,_0x469d57,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x5381e6[_0x34dd('0x1ab')]+=0x1;_0x5d3218[_0x34dd('0xe3')]=0x5;_0x5d3218[_0x34dd('0xa1')]=_0x34dd('0x1ac');_0x5d3218[_0x34dd('0xee')]+=0x1;_0x5d3218[_0x34dd('0x117')]+=0x1;ami[_0x34dd('0x46')]('custom:agentbusy',ut[_0x34dd('0xec')](_0x34f192,_0x34dd('0x1ad')));_0xd003b8[_0x34dd('0xc8')](_0x5d3218)[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x1ae')));if(_0xd003b8[_0x34dd('0x195')](0x5,_0x34f192,_0x5381e6)){if(_0x5d3218[_0x34dd('0xee')]>=_0x5381e6['dialBusyMaxRetry']){_0xd003b8[_0x34dd('0xf7')](_0x5d3218,_0x403fd1,_0x469d57,'reason\x205\x20busy');}else{_0xd003b8['stateGlobal'](_0x5d3218,_0x403fd1,_0x469d57,_0x34dd('0x1af'));}}break;case'8':_0x5381e6[_0x34dd('0x5b')]+=0x1;_0x5d3218['state']=0x8;_0x5d3218['statedesc']=_0x34dd('0x1b0');_0x5d3218[_0x34dd('0xef')]+=0x1;_0x5d3218['countglobal']+=0x1;ami['emit'](_0x34dd('0x1b1'),ut['buildObj'](_0x34f192,'congestion'));_0xd003b8[_0x34dd('0xc8')](_0x5d3218)[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x1b2')));if(_0xd003b8['checkRetriveMax'](0x8,_0x34f192,_0x5381e6)){if(_0x5d3218['countcongestionretry']>=_0x5381e6[_0x34dd('0x1b3')]){_0xd003b8[_0x34dd('0xf7')](_0x5d3218,_0x403fd1,_0x469d57,_0x34dd('0x1b4'));}else{_0xd003b8[_0x34dd('0xf5')](_0x5d3218,_0x403fd1,_0x469d57,_0x34dd('0x1b4'));}}break;case'11':_0x5381e6[_0x34dd('0x1b5')]+=0x1;_0x5d3218[_0x34dd('0xe3')]=0xb;_0x5d3218[_0x34dd('0xa1')]=_0x34dd('0x1b6');_0x5d3218[_0x34dd('0xf3')]+=0x1;_0x5d3218[_0x34dd('0x117')]+=0x1;_0xd003b8['createHistory'](_0x5d3218)[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x1b7')));if(_0xd003b8[_0x34dd('0x195')](0xb,_0x34f192,_0x5381e6)){if(_0x5d3218[_0x34dd('0xf3')]>=_0x5381e6[_0x34dd('0x120')]){_0xd003b8[_0x34dd('0xf7')](_0x5d3218,_0x403fd1,_0x469d57,_0x34dd('0x1b8'));}else{_0xd003b8['stateGlobal'](_0x5d3218,_0x403fd1,_0x469d57,_0x34dd('0x1b8'));}}break;case'20':_0x5381e6[_0x34dd('0x63')]+=0x1;_0x5d3218[_0x34dd('0xe3')]=0x14;_0x5d3218['statedesc']='AgentReject';_0x5d3218['countagentrejectretry']+=0x1;_0x5d3218['countglobal']+=0x1;ami[_0x34dd('0x46')](_0x34dd('0x1b9'),ut[_0x34dd('0xec')](_0x34f192,_0x34dd('0x1ba')));_0xd003b8[_0x34dd('0xc8')](_0x5d3218)[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x1bb')));if(_0xd003b8[_0x34dd('0x195')](0x14,_0x34f192,_0x5381e6)){if(_0x5d3218[_0x34dd('0xf4')]>=_0x5381e6[_0x34dd('0x19f')]){_0xd003b8['createStateFinal'](_0x5d3218,_0x403fd1,_0x469d57,_0x34dd('0x1bc'));}else{_0xd003b8[_0x34dd('0xf5')](_0x5d3218,_0x403fd1,_0x469d57,_0x34dd('0x1bc'));}}break;default:_0x5381e6[_0x34dd('0x1bd')]+=0x1;_0x5d3218['state']=0xc;_0x5d3218['statedesc']=_0x3691d5['reason'];_0xd003b8[_0x34dd('0xc8')](_0x5d3218)[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x1be')));if(_0xd003b8[_0x34dd('0x195')](_0x3691d5[_0x34dd('0x109')],_0x34f192,_0x5381e6)){if(_0x5d3218['countbusyretry']+_0x5d3218[_0x34dd('0xef')]+_0x5d3218[_0x34dd('0xf0')]+_0x5d3218[_0x34dd('0xf1')]+_0x5d3218[_0x34dd('0xf2')]+_0x5d3218[_0x34dd('0xf3')]+_0x5d3218['countmachineretry']+_0x5d3218['countagentrejectretry']>=_0x5381e6['dialGlobalMaxRetry']){_0xd003b8[_0x34dd('0xf5')](_0x5d3218,_0x403fd1,_0x469d57,_0x3691d5[_0x34dd('0x109')]);}else{_0xd003b8['createStateFinal'](_0x5d3218,_0x403fd1,_0x469d57,_0x3691d5[_0x34dd('0x109')]);}}}});};Dialer[_0x34dd('0xa4')][_0x34dd('0xf5')]=function(_0x53f0d6,_0x4172,_0x391a05,_0x3bb466){var _0x312d1f=new Final(_0x53f0d6);_0x312d1f['state']=0xf;_0x312d1f[_0x34dd('0xa1')]=_0x34dd('0x1bf');this[_0x34dd('0xf7')](_0x312d1f,_0x4172,_0x391a05,_0x3bb466);};Dialer[_0x34dd('0xa4')][_0x34dd('0xf7')]=function(_0xae7ea5,_0x111fda,_0xa8d8f6,_0x5c2a16){this['moveContactManagedDialer'](_0xae7ea5)[_0x34dd('0xb5')](function(){return _0x111fda(msgResponse('[callProgressDetecting]','Success',_0x5c2a16));})[_0x34dd('0xb8')](function(){return _0xa8d8f6(msgResponse(_0x34dd('0x1c0'),_0x34dd('0x143'),_0x34dd('0x1c1')));});};Dialer[_0x34dd('0xa4')][_0x34dd('0x8')]=function(_0x11c30c){var _0x198d11=_0x11c30c[_0x34dd('0x1c2')]/0x64;var _0x5824bb=_0x11c30c['outboundDropCallsDayTimeout']/(_0x11c30c[_0x34dd('0x5e')]+_0x11c30c[_0x34dd('0x59')]);var _0x365cc8=Math[_0x34dd('0x1c3')](_0x11c30c[_0x34dd('0x6d')]*(_0x11c30c[_0x34dd('0x1c4')]/0x64));var _0x4c7da9=Math[_0x34dd('0x1c3')](_0x11c30c[_0x34dd('0x6d')]*(_0x11c30c[_0x34dd('0x1c5')]/0x64));var _0x3806d4=_0x11c30c[_0x34dd('0x9b')]+_0x11c30c[_0x34dd('0x50')];var _0x27b058=Math['floor'](_0x11c30c['erlangCalls']*_0x11c30c[_0x34dd('0x88')]*_0x11c30c[_0x34dd('0x6a')]*_0x11c30c['predictiveIntervalMultiplicativeFactor']);if(_[_0x34dd('0x37')](_0x11c30c[_0x34dd('0x27')])){if(!_[_0x34dd('0x37')](_0x11c30c['startPredictive'])){_0x11c30c[_0x34dd('0x26')]=undefined;loggerPredictive[_0x34dd('0x91')](_0x34dd('0x1c6'),_0x34dd('0x1c7'));}if(!_['isUndefined'](_0x11c30c[_0x34dd('0x8d')])){loggerPredictive['error'](_0x34dd('0x1c6'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x11c30c['handlePredictive']);_0x11c30c[_0x34dd('0x8d')]=undefined;}_0x11c30c[_0x34dd('0x27')]=moment()[_0x34dd('0x75')](_0x34dd('0xfa'));loggerPredictive['info'](_0x11c30c[_0x34dd('0x3a')],_0x34dd('0x1c8'),_0x11c30c[_0x34dd('0x27')]);this['handlePower'](_0x11c30c,0x1);}else if(ifInterval(_0x11c30c['dialPredictiveInterval'],_0x11c30c[_0x34dd('0x27')])){this[_0x34dd('0x156')](_0x11c30c,0x1);loggerPredictiveCalls[_0x34dd('0x7a')](_0x34dd('0x1c9'),_0x11c30c[_0x34dd('0x27')],_0x11c30c[_0x34dd('0x3a')]);_0x11c30c['erlangCalls']=0x0;_0x11c30c['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x198d11<_0x5824bb&&_0x11c30c[_0x34dd('0x1ca')]===_0x34dd('0x1cb')){freeVariablesPredictive(_0x11c30c);loggerPredictive['info'](_0x34dd('0x1cc'),'Dropped\x20calls\x20day',_0x5824bb,'startProgressive',_0x11c30c[_0x34dd('0x3a')]);}else if(_0x27b058<_0x11c30c[_0x34dd('0x69')]&&_0x11c30c[_0x34dd('0x1ca')]===_0x34dd('0x1cb')){freeVariablesPredictive(_0x11c30c);loggerPredictive[_0x34dd('0x7a')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x34dd('0x1cd'),_0x27b058,'Drop\x20in\x20this\x20interval',_0x11c30c[_0x34dd('0x69')],_0x34dd('0x27'),_0x11c30c[_0x34dd('0x3a')]);}else if(!ifInterval(_0x11c30c[_0x34dd('0x1ce')],_0x11c30c[_0x34dd('0x27')])&&_[_0x34dd('0x37')](_0x11c30c[_0x34dd('0x26')])&&!_[_0x34dd('0x37')](_0x11c30c['startProgressive'])){_0x11c30c[_0x34dd('0x26')]=moment()[_0x34dd('0x75')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x34dd('0x7a')](_0x11c30c[_0x34dd('0x3a')],'started\x20in\x20predictive\x20at',_0x11c30c[_0x34dd('0x26')]);this[_0x34dd('0x1cf')](_0x11c30c['dialPredictiveInterval'])[_0x34dd('0xb5')](this['getDataPredictive'](_0x11c30c))[_0x34dd('0xb5')](mergeDataErlangB(_0x11c30c))['then'](this[_0x34dd('0x1d0')](_0x11c30c))[_0x34dd('0xb8')](loggerCatchPredictive(_0x34dd('0x1d1'),_0x11c30c));}else if(!ifInterval(_0x11c30c[_0x34dd('0x1ce')],_0x11c30c['startPredictive'])){_0x11c30c['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x11c30c[_0x34dd('0x26')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x34dd('0x7a')](_0x11c30c['name'],_0x34dd('0x1d2'),_0x11c30c[_0x34dd('0x26')]);clearInterval(_0x11c30c[_0x34dd('0x8d')]);_0x11c30c['handlePredictive']=undefined;this[_0x34dd('0x1cf')](_0x11c30c[_0x34dd('0x1ce')])[_0x34dd('0xb5')](this['getDataPredictive'](_0x11c30c))[_0x34dd('0xb5')](mergeDataErlangB(_0x11c30c))[_0x34dd('0xb5')](this[_0x34dd('0x1d0')](_0x11c30c))[_0x34dd('0xb8')](loggerCatchPredictive(_0x34dd('0x1d3'),_0x11c30c));}else if(_0x11c30c['predictiveIntervalAvailable']&&_0x3806d4<_0x11c30c['predictiveIntervalAvailable']-_0x4c7da9){freeVariablesPredictive(_0x11c30c);loggerPredictive[_0x34dd('0x7a')](_0x11c30c[_0x34dd('0x3a')],_0x34dd('0x1d4'),_0x3806d4,')\x20are\x20less\x20than\x20threshold\x20(',_0x11c30c[_0x34dd('0x6d')],'-',_0x4c7da9,'=',_0x11c30c[_0x34dd('0x6d')]-_0x4c7da9,')');}else if(_0x11c30c[_0x34dd('0x6d')]&&_0x3806d4>_0x11c30c['predictiveIntervalAvailable']+_0x365cc8){freeVariablesPredictive(_0x11c30c);loggerPredictive['info'](_0x11c30c[_0x34dd('0x3a')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3806d4,_0x34dd('0x1d5'),_0x11c30c[_0x34dd('0x6d')],'+',_0x365cc8,'=',_0x11c30c[_0x34dd('0x6d')]+_0x365cc8,')');}};Dialer['prototype'][_0x34dd('0x1d6')]=function(_0x4154bf){var _0x43ca31=this;return function(_0x2f459c){return new BPromise(function(_0x5d95b7,_0x2ae491){_[_0x34dd('0x8a')](_0x4154bf,_0x2f459c[0x0]);if(checkGetDataPredictive(_0x2f459c[0x0])){var _0x5680dd=_0x4154bf['predictiveIntervalAvailable']=_0x4154bf[_0x34dd('0x50')]+_0x4154bf[_0x34dd('0x9b')];var _0x1cfdcc=_0x4154bf[_0x34dd('0x1ce')]*0x3c;var _0x3783bf=_0x2f459c[0x0][_0x34dd('0x66')]+_0x2f459c[0x0]['predictiveIntervalAvgHoldtime'];var _0x303c58=(_0x2f459c[0x0]['predictiveIntervalAnsweredCalls']+_0x2f459c[0x0][_0x34dd('0x7e')]+_0x2f459c[0x0][_0x34dd('0x67')])/_0x2f459c[0x0][_0x34dd('0x6e')];_0x4154bf[_0x34dd('0x6a')]=_0x303c58>0x0?_0x303c58:0x1;switch(_0x4154bf[_0x34dd('0x1ca')]){case'dropRate':var _0x25d11b=_0x4154bf[_0x34dd('0x1c2')]/0x64;return _0x43ca31['abandonmentRate'](_0x5680dd,_0x1cfdcc,_0x3783bf,_0x303c58,_0x25d11b)['then'](function(_0x263173){return _0x5d95b7(_0x263173);});case'agentBusyFactor':var _0x29f5ca=_0x4154bf[_0x34dd('0x1c2')]/0x64;return _0x43ca31[_0x34dd('0x1d7')](_0x5680dd,_0x1cfdcc,_0x3783bf,_0x303c58,_0x29f5ca)['then'](function(_0x1cba0e){return _0x5d95b7(_0x1cba0e);});default:return _0x2ae491(msgResponse('[getDataPredictive]','Failure',_0x34dd('0x1d8')));}}else{return _0x2ae491(msgResponse('[getDataPredictive]',_0x34dd('0x143'),'check\x20failure'));}});};};Dialer[_0x34dd('0xa4')][_0x34dd('0x1d9')]=function(_0x2ee37f){var _0x304e7c=this;return function(_0x382d1e){return new BPromise(function(_0x54a805,_0xed766e){_[_0x34dd('0x8a')](_0x2ee37f,_0x382d1e[0x0]);if(checkGetDataPredictive(_0x382d1e[0x0])){loggerPredictive[_0x34dd('0x7a')](JSON[_0x34dd('0x43')](_0x382d1e[0x0]));if(_0x2ee37f[_0x34dd('0x1ca')]==='dropRate'){return _0x304e7c[_0x34dd('0xc5')](_0x2ee37f['id'])[_0x34dd('0xb5')](function(_0x4b5b11){var _0x412721=_0x2ee37f[_0x34dd('0x4b')]-_0x4b5b11[0x0][_0x34dd('0x1da')];var _0x711e89=_0x2ee37f['dialPredictiveInterval']*0x3c;var _0x283656=_0x382d1e[0x0][_0x34dd('0x66')]+_0x382d1e[0x0][_0x34dd('0x65')];var _0x3b32bf=(_0x382d1e[0x0][_0x34dd('0x64')]+_0x382d1e[0x0][_0x34dd('0x7e')]+_0x382d1e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x382d1e[0x0]['predictiveIntervalTotalCalls'];var _0x1fb15c=_0x2ee37f[_0x34dd('0x1c2')]/0x64;_0x2ee37f[_0x34dd('0x6c')]=_0x4b5b11[0x0][_0x34dd('0x1da')]||0x0;_0x2ee37f[_0x34dd('0x6a')]=_0x3b32bf>0x0?_0x3b32bf:0x1;return _0x304e7c[_0x34dd('0x1db')](_0x412721,_0x711e89,_0x283656,_0x3b32bf,_0x1fb15c);})[_0x34dd('0xb5')](function(_0x615b54){return _0x54a805(_0x615b54);})['catch'](function(_0x2949cb){return _0xed766e(msgResponse('[CatchErlangB]',_0x34dd('0x143'),JSON['stringify'](_0x2949cb)));});}if(_0x2ee37f[_0x34dd('0x1ca')]===_0x34dd('0x1dc')){return _0x304e7c[_0x34dd('0xc5')](_0x2ee37f['id'])['then'](function(_0x4cb45a){var _0x89ad68=_0x2ee37f[_0x34dd('0x4b')]-_0x4cb45a[0x0][_0x34dd('0x1da')];var _0x3ece6b=_0x2ee37f[_0x34dd('0x1ce')]*0x3c;var _0x51c89f=_0x382d1e[0x0][_0x34dd('0x66')]+_0x382d1e[0x0][_0x34dd('0x65')];var _0x56e354=(_0x382d1e[0x0][_0x34dd('0x64')]+_0x382d1e[0x0][_0x34dd('0x7e')]+_0x382d1e[0x0][_0x34dd('0x67')])/_0x382d1e[0x0][_0x34dd('0x6e')];var _0x2f2f9f=_0x2ee37f[_0x34dd('0x1c2')]/0x64;_0x2ee37f[_0x34dd('0x6c')]=_0x4cb45a[0x0][_0x34dd('0x1da')]||0x0;_0x2ee37f[_0x34dd('0x6a')]=_0x56e354>0x0?_0x56e354:0x1;return _0x304e7c[_0x34dd('0x1d7')](_0x89ad68,_0x3ece6b,_0x51c89f,_0x56e354,_0x2f2f9f);})[_0x34dd('0xb5')](function(_0x29c8e6){return _0x54a805(_0x29c8e6);})[_0x34dd('0xb8')](function(_0x482e19){return _0xed766e(msgResponse(_0x34dd('0x1dd'),_0x34dd('0x143'),JSON['stringify'](_0x482e19)));});}}else{return _0xed766e(msgResponse('[getDataPredictive]',_0x34dd('0x143'),_0x34dd('0x1de')));}});};};Dialer[_0x34dd('0xa4')][_0x34dd('0x1d0')]=function(_0x484752){var _0x3d9c1c=this;return function(){var _0xe4b743=0x0;var _0x12bac0=Math[_0x34dd('0x1df')](_0x484752['erlangCallToSecond']*0x3e8);if(_0x12bac0>0x0){_0x12bac0=_0x12bac0<0x64?0x64:_0x12bac0;loggerPredictive[_0x34dd('0x7a')](_0x484752[_0x34dd('0x3a')],_0x34dd('0x1e0'),_0x12bac0,_0x34dd('0x44'));_0x484752[_0x34dd('0x8d')]=setInterval(function(){_0x3d9c1c[_0x34dd('0x8d')](_0x484752);loggerPredictiveCalls[_0x34dd('0x7a')](_0x34dd('0x1e1'),_0xe4b743+=0x1);},_0x12bac0);}else{loggerPredictive[_0x34dd('0x7a')](_0x484752[_0x34dd('0x3a')],_0x34dd('0x1e2'));}};};Dialer[_0x34dd('0xa4')][_0x34dd('0x1e3')]=function(_0x45f367,_0x4bdb7d){var _0x491ced=this;return function(_0x54ebb2){if(_[_0x34dd('0x79')](_0x54ebb2)){if(_['isNil'](_0x4bdb7d['UserId'])||!_0x4bdb7d[_0x34dd('0x1e4')]){if(_0x45f367[_0x34dd('0x55')]===_0x34dd('0x7')){_0x45f367[_0x34dd('0x12b')]=_[_0x34dd('0x37')](_0x45f367[_0x34dd('0x12b')])?!![]:_0x45f367[_0x34dd('0x12b')];var _0xabf8d=uuid['v4']();_0x491ced[_0x34dd('0xa8')][_0xabf8d]=new Action(_0x45f367,_0x4bdb7d,_0xabf8d);loggerBooked[_0x34dd('0x7a')]('[booked][checkContactBlack]',_0xabf8d,_0x34dd('0x1e5'),JSON['stringify'](_0x45f367[_0x34dd('0x12b')]),_0x34dd('0x1e6'),_0x45f367['name']);if(_0x45f367[_0x34dd('0x12b')]){_0x45f367[_0x34dd('0x12b')]=![];_0x491ced['queueBooked'][_0x491ced[_0x34dd('0xa8')][_0xabf8d][_0x34dd('0xaf')]]=[];ami[_0x34dd('0x14f')]({'actionid':_0xabf8d,'action':'queuestatus','queue':_0x45f367[_0x34dd('0x3a')]})[_0x34dd('0xb8')](function(){_0x491ced[_0x34dd('0xae')](_0x45f367);_0x491ced[_0x34dd('0xbc')]({'active':![],'ContactId':_0x491ced[_0x34dd('0xa8')][_0xabf8d][_0x34dd('0xd0')],'ListId':_0x491ced[_0x34dd('0xa8')][_0xabf8d]['ListId'],'VoiceQueueId':_0x491ced[_0x34dd('0xa8')][_0xabf8d][_0x34dd('0xd3')]||undefined,'CampaignId':_0x491ced[_0x34dd('0xa8')][_0xabf8d][_0x34dd('0xd4')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x491ced[_0x34dd('0xa8')][_0xabf8d];});}else{loggerBooked['info'](_0x34dd('0x1e7'),JSON[_0x34dd('0x43')](_0x45f367[_0x34dd('0x12b')]),_0x34dd('0x1e6'),_0x45f367['name']);_0x491ced[_0x34dd('0xae')](_0x45f367);_0x491ced[_0x34dd('0xbc')]({'active':![],'ContactId':_0x491ced[_0x34dd('0xa8')][_0xabf8d][_0x34dd('0xd0')],'ListId':_0x491ced[_0x34dd('0xa8')][_0xabf8d]['ListId'],'VoiceQueueId':_0x491ced[_0x34dd('0xa8')][_0xabf8d]['VoiceQueueId']||undefined,'CampaignId':_0x491ced[_0x34dd('0xa8')][_0xabf8d]['CampaignId']||undefined})[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x1e8')));delete _0x491ced[_0x34dd('0xa8')][_0xabf8d];}}else{return _0x491ced[_0x34dd('0x163')](_0x45f367,_0x4bdb7d);}}else{if(getDiff(_0x4bdb7d[_0x34dd('0x1e9')])<_0x45f367[_0x34dd('0x1ea')]*0x3c){if(_0x4bdb7d['Agent']&&!_0x4bdb7d[_0x34dd('0x1eb')][_0x34dd('0x1ec')]){_0x491ced['preview'][_0x34dd('0x12e')](_0x4bdb7d['id'])[_0x34dd('0x1b')](function(){_0x491ced['updateOriginated'](_0x45f367);});}else{_0x491ced[_0x34dd('0xbe')]({'active':![]},_0x4bdb7d['id'],0x1)[_0x34dd('0x1b')](function(){_0x491ced['updateOriginated'](_0x45f367);});}}else{_0x45f367[_0x34dd('0x62')]+=0x1;_0x491ced[_0x34dd('0xae')](_0x45f367);if(_0x45f367['dialRecallInQueue']){_0x491ced[_0x34dd('0xbc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4bdb7d[_0x34dd('0xd0')],'ListId':_0x4bdb7d[_0x34dd('0xd1')],'VoiceQueueId':_0x4bdb7d['VoiceQueueId']||undefined,'CampaignId':_0x4bdb7d[_0x34dd('0xd4')]||undefined})[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x1ed')));_0x491ced['createHistory'](createObjHistory(_0x45f367,_0x4bdb7d,'RECALLINQUEUE',0x17,_0x34dd('0x1ee')))[_0x34dd('0xb8')](loggerCatch(_0x34dd('0x1ef')));}else{_0x491ced[_0x34dd('0xce')](createObjHistory(_0x45f367,_0x4bdb7d,_0x34dd('0x1f0'),0x16,_0x34dd('0x1f1')),_0x34dd('0x1f2'),_0x34dd('0x1f3'));}}}}else{_0x45f367['outboundBlacklistCallsDay']+=0x1;_0x491ced[_0x34dd('0xce')](createObjHistory(_0x45f367,_0x4bdb7d,_0x34dd('0x1f4'),0xd,_0x34dd('0x1f5')),_0x34dd('0x1f6'),_0x34dd('0x1f7'));throw _0x34dd('0x1f8');}};};Dialer[_0x34dd('0xa4')][_0x34dd('0x1f9')]=function(_0x5bdb44){var _0x226c57=this;var _0xc288d9=_0x5bdb44['limitCalls']-_0x5bdb44[_0x34dd('0x94')]-_0x5bdb44['temp'];emitCampaignSummary(_0x5bdb44);if(_0xc288d9>0x0){if(_0xc288d9>this[_0x34dd('0x22')]){_0xc288d9=this[_0x34dd('0x22')];}_0x5bdb44['temp']+=_0xc288d9;this[_0x34dd('0xc3')](_0x5bdb44['id'],_0xc288d9,_0x5bdb44[_0x34dd('0x1fa')],_0x5bdb44)[_0x34dd('0xb5')](function(_0x4141b4){_0x5bdb44['temp']-=_0xc288d9;_0x5bdb44[_0x34dd('0xc1')]=_0x5bdb44[_0x34dd('0xc1')]>0x0?_0x5bdb44['temp']:0x0;if(!checkContactEmpty(_0x4141b4)){_0x5bdb44[_0x34dd('0x38')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x34dd('0x7a')]('[getContactCampaign2][Empty]'+_0x5bdb44[_0x34dd('0x3a')]);}else{_0x5bdb44[_0x34dd('0x94')]+=_0x4141b4[_0x34dd('0x148')];_0x5bdb44['message']=_0x34dd('0x1fb');for(var _0x41ee27=0x0;_0x41ee27<_0x4141b4[_0x34dd('0x148')];_0x41ee27+=0x1){_0x5bdb44[_0x34dd('0x1fc')]+=0x1;if(_[_0x34dd('0xaa')](_0x4141b4[_0x41ee27])||_[_0x34dd('0xaa')](_0x4141b4[_0x41ee27]['Contact'])||_[_0x34dd('0xaa')](_0x4141b4[_0x41ee27][_0x34dd('0x167')][_0x34dd('0x168')])){_0x226c57['emptyContact']('[actionOriginate]\x20',_0x5bdb44,_0x4141b4[_0x41ee27]);}else{_0x226c57[_0x34dd('0xb7')](_[_0x34dd('0xcf')](_0x4141b4[_0x41ee27],[_0x34dd('0xd4'),'Contact.phone']))[_0x34dd('0xb5')](_0x226c57['checkContactBlack'](_0x5bdb44,_0x4141b4[_0x41ee27]))[_0x34dd('0xb8')](_0x226c57['loggerHandler'](_0x34dd('0x1fd'),_0x5bdb44));}}}})[_0x34dd('0xb8')](loggerGetContactDialer(_0x34dd('0x1fe'),_0x5bdb44,_0xc288d9));}};Dialer[_0x34dd('0xa4')]['handlePower']=function(_0x4b34bf,_0xf4653d){var _0x3e7cee=this;var _0x3961e0=[];var _0x42f592=_0xf4653d>=0x1?_0xf4653d:0x1;if(_0x4b34bf[_0x34dd('0x55')]===_0x34dd('0x7')){_0x42f592=0x1;}var _0x2094e4=Math[_0x34dd('0x1df')](_0x4b34bf['available']*_0x42f592)-_0x4b34bf['originated']-_0x4b34bf[_0x34dd('0xc1')];emitVoiceQueueSummary(_0x4b34bf);if(_0x4b34bf['dialLimitQueue']>0x0){var _0x403923=_0x4b34bf[_0x34dd('0x1ff')]-_0x4b34bf['originated']-_0x4b34bf[_0x34dd('0x50')]-_0x4b34bf[_0x34dd('0xc1')]-_0x4b34bf[_0x34dd('0x4c')];if(_0x2094e4>_0x403923){_0x2094e4=_0x403923;}}if(_0x2094e4>0x0){if(_0x4b34bf[_0x34dd('0x55')]==='booked'){_0x2094e4=0x1;}if(_0x2094e4>this[_0x34dd('0x22')]){_0x2094e4=this[_0x34dd('0x22')];}_0x4b34bf[_0x34dd('0xc1')]+=_0x2094e4;for(var _0x174997 in this['agents']){if(typeof this[_0x34dd('0x20')][_0x174997]!==_0x34dd('0x95')){if(this['agents'][_0x174997][_0x34dd('0xe3')]===_0x34dd('0x200')&&this[_0x34dd('0x20')][_0x174997][_0x34dd('0xab')]==='reachable'){_0x3961e0['push'](this['agents'][_0x174997]['id']);}}}this[_0x34dd('0xc0')](_0x4b34bf['id'],_0x3961e0,_0x2094e4,_0x4b34bf[_0x34dd('0x1fa')],_0x4b34bf)['then'](function(_0x526e63){_0x4b34bf[_0x34dd('0xc1')]-=_0x2094e4;_0x4b34bf[_0x34dd('0xc1')]=_0x4b34bf[_0x34dd('0xc1')]>0x0?_0x4b34bf[_0x34dd('0xc1')]:0x0;if(!checkContactEmpty(_0x526e63)){_0x3e7cee[_0x34dd('0xb2')](_0x4b34bf)['then'](sendMessageReschedule(_0x4b34bf))[_0x34dd('0xb8')](loggerCatch(_0x34dd('0xb4')));}else{_0x4b34bf[_0x34dd('0x94')]+=_0x526e63[_0x34dd('0x148')];_0x4b34bf[_0x34dd('0x38')]=_0x4b34bf[_0x34dd('0x55')]==='booked'?_0x34dd('0x170'):_0x34dd('0x1fb');for(var _0x520c0b=0x0;_0x520c0b<_0x526e63[_0x34dd('0x148')];_0x520c0b+=0x1){if(_[_0x34dd('0xaa')](_0x526e63[_0x520c0b])||_['isNil'](_0x526e63[_0x520c0b][_0x34dd('0x167')])||_[_0x34dd('0xaa')](_0x526e63[_0x520c0b]['Contact']['phone'])){_0x3e7cee[_0x34dd('0xcc')](_0x34dd('0x201'),_0x4b34bf,_0x526e63[_0x520c0b]);}else{_0x3e7cee[_0x34dd('0x202')](_[_0x34dd('0xcf')](_0x526e63[_0x520c0b],[_0x34dd('0xd3'),_0x34dd('0x203')]))[_0x34dd('0xb5')](_0x3e7cee['checkContactBlack'](_0x4b34bf,_0x526e63[_0x520c0b]))[_0x34dd('0xb8')](_0x3e7cee[_0x34dd('0xcb')](_0x34dd('0x201'),_0x4b34bf));}}}})[_0x34dd('0xb8')](loggerGetContactDialer(_0x34dd('0x204'),_0x4b34bf,_0x2094e4));}};Dialer[_0x34dd('0xa4')][_0x34dd('0x8d')]=function(_0x154545){if(_0x154545['dialLimitQueue']>0x0){var _0x3f4fe1=_0x154545[_0x34dd('0x1ff')]-_0x154545[_0x34dd('0x94')]-_0x154545['talking'];if(_0x3f4fe1>0x0){this[_0x34dd('0x205')](_0x154545);}else{loggerPredictiveCalls['info'](_0x34dd('0x206'));}}else{this[_0x34dd('0x205')](_0x154545);}};Dialer[_0x34dd('0xa4')]['tryOriginatePredictive']=function(_0x214049){var _0x1abb2c=this;var _0xd2e230=[];_0x214049[_0x34dd('0x94')]+=0x1;for(var _0x22bb38 in this[_0x34dd('0x20')]){if(typeof this['agents'][_0x22bb38]!=='undefined'){if(this[_0x34dd('0x20')][_0x22bb38][_0x34dd('0xe3')]===_0x34dd('0x200')&&this[_0x34dd('0x20')][_0x22bb38]['status']==='reachable'){_0xd2e230[_0x34dd('0x12a')](this['agents'][_0x22bb38]['id']);}}}this[_0x34dd('0xc0')](_0x214049['id'],_0xd2e230,0x1,_0x214049[_0x34dd('0x1fa')],_0x214049)[_0x34dd('0xb5')](function(_0x24b659){if(!checkContactEmpty(_0x24b659)){checkContactLowerLimitOriginate(_0x214049,0x1,0x0);_0x1abb2c[_0x34dd('0xb2')](_0x214049)[_0x34dd('0xb5')](sendMessageReschedule(_0x214049))[_0x34dd('0xb8')](loggerCatch(_0x34dd('0xb4')));}else{_0x214049[_0x34dd('0x38')]=_0x34dd('0x1fb');if(_[_0x34dd('0xaa')](_0x24b659[0x0])||_[_0x34dd('0xaa')](_0x24b659[0x0]['Contact'])||_['isNil'](_0x24b659[0x0]['Contact'][_0x34dd('0x168')])){_0x1abb2c[_0x34dd('0xcc')](_0x34dd('0x201'),_0x214049,_0x24b659[0x0]);}else{_0x1abb2c['checkIsBlackList'](_[_0x34dd('0xcf')](_0x24b659[0x0],[_0x34dd('0xd3'),_0x34dd('0x203')]))['then'](_0x1abb2c[_0x34dd('0x1e3')](_0x214049,_0x24b659[0x0]))[_0x34dd('0xb8')](_0x1abb2c[_0x34dd('0xcb')](_0x34dd('0x207'),_0x214049));}}})[_0x34dd('0xb8')](loggerGetContactDialer('[getContactDialerPredictive]',_0x214049,0x1));emitVoiceQueueSummary(_0x214049);};Dialer['prototype'][_0x34dd('0x1db')]=function(_0x5dae27,_0x1754fa,_0x285538,_0xd13837,_0x36f76f,_0x553d83){loggerPredictive['info'](_0x34dd('0x208'));loggerPredictive[_0x34dd('0x7a')]('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',_0x5dae27);loggerPredictive[_0x34dd('0x7a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1754fa);loggerPredictive[_0x34dd('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',_0x285538);loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x209'),_0xd13837);loggerPredictive['info'](_0x34dd('0x20a'),_0x36f76f);loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x80'));return new BPromise(function(_0x55d3e7,_0x734044){if(_0x5dae27<=0x0||isNaN(_0x5dae27)){return _0x734044(msgResponse(_0x34dd('0x20b'),_0x34dd('0x190'),'m\x20=\x20'+_0x5dae27));}if(_0x285538<=0x0||isNaN(_0x285538)){return _0x734044(msgResponse(_0x34dd('0x20b'),'Error',_0x34dd('0x20c')+_0x285538));}if(_0xd13837<=0x0||isNaN(_0xd13837)){return _0x734044(msgResponse(_0x34dd('0x20b'),_0x34dd('0x190'),_0x34dd('0x20d')+_0xd13837));}if(_0x1754fa<=0x0||isNaN(_0x1754fa)){return _0x734044(msgResponse(_0x34dd('0x20b'),_0x34dd('0x190'),_0x34dd('0x20e')+_0x1754fa));}if(_0x36f76f<=0x0||isNaN(_0x36f76f)){return _0x734044(msgResponse(_0x34dd('0x20b'),'Error','Amax\x20=\x20'+_0x36f76f));}_0x553d83=_0x553d83||0x0;var _0x2c2bd6=0x1/_0x285538;var _0x2a57a0=0x0;var _0x3fa32a=0x0;var _0x358dfe=0x0;var _0x5efd66=0x0;for(var _0x8d3818=0x0;_0x358dfe<_0x36f76f;_0x8d3818+=0x1){_0x3fa32a=_0x8d3818/_0x1754fa;_0x2a57a0=(_0xd13837*_0x3fa32a+_0x553d83)/_0x2c2bd6;_0x358dfe=erlangb(_0x2a57a0,_0x5dae27);_0x5efd66=_0x2a57a0/_0x5dae27*(0x1-erlangb(_0x2a57a0,_0x5dae27));}return _0x55d3e7({'erlangCalls':_0x8d3818,'erlangCallToSecond':_0x1754fa/_0x8d3818,'erlangAbandonmentRate':_0x358dfe,'erlangBusyFactor':_0x5efd66});});};Dialer['prototype']['busyFactor']=function(_0x4378d3,_0x3aab13,_0x181266,_0x45fc15,_0x46fb7e,_0x14a610){loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x20f'));loggerPredictive['info'](_0x34dd('0x210'),_0x4378d3);loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x211'),_0x3aab13);loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x212'),_0x181266);loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x209'),_0x45fc15);loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x213'),_0x46fb7e);loggerPredictive[_0x34dd('0x7a')](_0x34dd('0x80'));return new BPromise(function(_0x57d5b9,_0x5dbc51){if(_0x4378d3<=0x0||isNaN(_0x4378d3)){return _0x5dbc51(msgResponse(_0x34dd('0x214'),_0x34dd('0x190'),'m\x20=\x20'+_0x4378d3));}if(_0x181266<=0x0||isNaN(_0x181266)){return _0x5dbc51(msgResponse(_0x34dd('0x214'),_0x34dd('0x190'),_0x34dd('0x20c')+_0x181266));}if(_0x45fc15<=0x0||isNaN(_0x45fc15)){return _0x5dbc51(msgResponse(_0x34dd('0x214'),_0x34dd('0x190'),_0x34dd('0x20d')+_0x45fc15));}if(_0x3aab13<=0x0||isNaN(_0x3aab13)){return _0x5dbc51(msgResponse(_0x34dd('0x214'),_0x34dd('0x190'),'interval\x20=\x20'+_0x3aab13));}if(_0x46fb7e<=0x0||isNaN(_0x46fb7e)){return _0x5dbc51(msgResponse('[busyFactor]',_0x34dd('0x190'),_0x34dd('0x215')+_0x46fb7e));}_0x14a610=_0x14a610||0x0;var _0x463547=0x1/_0x181266;var _0x2a83fd=0x0;var _0x311433=0x0;var _0x620300=0x0;var _0x2661db=0x0;for(var _0x5b9ccd=0x0;_0x2661db<_0x46fb7e;_0x5b9ccd+=0x1){_0x311433=_0x5b9ccd/_0x3aab13;_0x2a83fd=(_0x45fc15*_0x311433+_0x14a610)/_0x463547;_0x620300=erlangb(_0x2a83fd,_0x4378d3);_0x2661db=_0x2a83fd/_0x4378d3*(0x1-erlangb(_0x2a83fd,_0x4378d3));}return _0x57d5b9({'erlangCalls':_0x5b9ccd,'erlangCallToSecond':_0x3aab13/_0x5b9ccd,'erlangAbandonmentRate':_0x620300,'erlangBusyFactor':_0x2661db});});};module[_0x34dd('0x216')]=Dialer; \ No newline at end of file +var _0x37dc=['syncAgentComplete','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','Interval','Intervals','\x20INTERVAL_IS_NULL','isEmpty','stringify','milliseconds','diff','seconds','type','outbound','strategy','loggedIn','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\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','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','waiting','pTalking','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','clearZombieChannels','uniqueId','[actions]','sequence','isNil','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','checkIsBlackList','then','checkIsBlackListIvr','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','saveInDb','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','voiceQueues','value','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','state','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','amd','[syncHangupInAMD]','dialAMDActive','MACHINE','countglobal','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countbusyretry','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','outboundUnknownCallsDay','Unknow','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','syncQueueMember','actionid','locked','stateinterface','queueBooked','push','pick','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','iftime\x20%s,%s','content','indexOf','true','Action','command','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','launchHandleIvr','handleIvr','dialGlobalInterval','checkIfTimeIntervals','[syncQueueSummary]','dialTimezone','[syncCampaigns]','pow','replace','random','match','object','originate','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','dialPredictiveInterval','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(','dialPredictiveOptimizationPercentage','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','maxNumberOriginate','[getContactCampaign2][Empty]','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','ACTIVE','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','--------\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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','md5','../preview/util/util','booked','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','preview','campaigns','agents','trunks','channels','actions','contactsId','optionPredictive','startPredictive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete'];(function(_0x1689de,_0x470299){var _0x448495=function(_0x221159){while(--_0x221159){_0x1689de['push'](_0x1689de['shift']());}};_0x448495(++_0x470299);}(_0x37dc,0x1e9));var _0xc37d=function(_0x16bc4f,_0x29b4ce){_0x16bc4f=_0x16bc4f-0x0;var _0x3edf8a=_0x37dc[_0x16bc4f];return _0x3edf8a;};'use strict';var util=require(_0xc37d('0x0'));var _=require(_0xc37d('0x1'));var BPromise=require(_0xc37d('0x2'));var uuid=require(_0xc37d('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0xc37d('0x4'));var Redis=require('ioredis');var ut=require(_0xc37d('0x5'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')('dialer');var loggerBooked=require('../../../config/logger')(_0xc37d('0x6'));var loggerPredictive=require(_0xc37d('0x7'))(_0xc37d('0x8'));var loggerPredictiveCalls=require(_0xc37d('0x7'))(_0xc37d('0x9'));var loggerSyncQueueSummary=require(_0xc37d('0x7'))(_0xc37d('0xa'));var ami=require(_0xc37d('0xb'));config[_0xc37d('0xc')]=_['defaults'](config[_0xc37d('0xc')],{'host':_0xc37d('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc37d('0xc')]));var cmHopper=require(_0xc37d('0xe'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xc37d('0xf'));var voiceQueueRt=require(_0xc37d('0x10'));var Action=require('./action');var History=require(_0xc37d('0x11'));var Final=require(_0xc37d('0x12'));var AgentComplete=require(_0xc37d('0x13'));var QueueCallerAbandon=require(_0xc37d('0x14'));var Hangup=require(_0xc37d('0x15'));var ipAgi=process[_0xc37d('0x16')][_0xc37d('0x17')]||_0xc37d('0x18');var strategy={'rrmemory':_0xc37d('0x19'),'roundrobin':_0xc37d('0x1a')};var Sequence=function(){};Sequence[_0xc37d('0x1b')][_0xc37d('0x1c')]=function(_0x5371d1){this['tail']=this[_0xc37d('0x1d')]?this['tail']['finally'](_0x5371d1):_0x5371d1();};function Dialer(_0xce39b1,_0x11615a){this['sequence']=new Sequence();this[_0xc37d('0x1e')]=_0x11615a;this['voiceQueues']=_0xce39b1['voiceQueues'];this[_0xc37d('0x1f')]=_0xce39b1[_0xc37d('0x1f')];this[_0xc37d('0x20')]=_0xce39b1[_0xc37d('0x20')];this[_0xc37d('0x21')]=_0xce39b1[_0xc37d('0x21')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0xc37d('0x22')]={};this[_0xc37d('0x23')]={};this[_0xc37d('0x24')]={};this['uniqueId']={};this[_0xc37d('0x25')]={};this[_0xc37d('0x26')]={};this['startProgressive']={};this[_0xc37d('0x27')]={};this['queueBooked']={};this[_0xc37d('0x28')]={};ami['on'](_0xc37d('0x29'),this[_0xc37d('0x2a')][_0xc37d('0x2b')](this));ami['on'](_0xc37d('0x2c'),this[_0xc37d('0x2d')][_0xc37d('0x2b')](this));ami['on'](_0xc37d('0x2e'),this[_0xc37d('0x2f')]['bind'](this));ami['on'](_0xc37d('0x30'),this[_0xc37d('0x31')][_0xc37d('0x2b')](this));ami['on']('custom:queuesummary',this[_0xc37d('0xa')]['bind'](this));ami['on']('hangup',this[_0xc37d('0x32')][_0xc37d('0x2b')](this));ami['on'](_0xc37d('0x33'),this[_0xc37d('0x34')][_0xc37d('0x2b')](this));ami['on']('varset',this[_0xc37d('0x35')]['bind'](this));ami['on'](_0xc37d('0x36'),this['syncQueueMember'][_0xc37d('0x2b')](this));ami['on'](_0xc37d('0x37'),this[_0xc37d('0x38')][_0xc37d('0x2b')](this));this[_0xc37d('0x39')]();this[_0xc37d('0x3a')]();}function isNotNull(_0x429b4f){return _0x429b4f!==null&&!_[_0xc37d('0x3b')](_0x429b4f);}function checkIsLoggedIn(_0x5281cd,_0x146831){return function(){if(_0x146831<=0x0){_0x5281cd['message']='AGENTS_NOT_LOGGED';throw _0x5281cd[_0xc37d('0x3c')]+_0xc37d('0x3d');}};}function isActive(_0x404049){return _0x404049;}function checkIsActive(_0x1d3865,_0x9a754f){return function(){if(!isActive(_0x9a754f)){_0x1d3865[_0xc37d('0x3e')]=_0xc37d('0x3f');throw _0x1d3865[_0xc37d('0x3c')]+_0xc37d('0x40');}};}function checkInterval(_0x4b5b6b){return function(){if(!isNotNull(_0x4b5b6b['Interval'])){_0x4b5b6b[_0xc37d('0x3e')]=_0xc37d('0x41');throw _0x4b5b6b[_0xc37d('0x3c')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x4b5b6b[_0xc37d('0x42')][_0xc37d('0x43')])){_0x4b5b6b[_0xc37d('0x3e')]='INTERVAL_IS_NULL';throw _0x4b5b6b[_0xc37d('0x3c')]+_0xc37d('0x44');}if(!isNotNull(_[_0xc37d('0x45')](_0x4b5b6b[_0xc37d('0x42')][_0xc37d('0x43')]))){_0x4b5b6b['message']='INTERVAL_IS_NULL';throw _0x4b5b6b[_0xc37d('0x3c')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x473ffa,_0x13f8f4,_0x2022d7){return{'action':_0x473ffa,'response':_0x13f8f4,'message':_0x2022d7,'stack':_0x2022d7};}function myreject(_0x9febe3){return function(_0x1e1c2a){return _0x9febe3(msgResponse('[ifTime][Action]','Error',JSON[_0xc37d('0x46')](_0x1e1c2a)));};}function getSeconds(_0x261df9,_0x20014b){var _0x52fac5=moment(_0x261df9)[_0xc37d('0x47')](0x0);var _0x43f427=moment(_0x20014b)[_0xc37d('0x47')](0x0);return _0x52fac5[_0xc37d('0x48')](_0x43f427,_0xc37d('0x49'));}function emit(_0x288731,_0xce60d3,_0x4fe880){io['to'](_0x288731)['emit'](_0xce60d3,_0x4fe880);}function emitVoiceQueueSummary(_0x318020){if(_0x318020[_0xc37d('0x4a')]===_0xc37d('0x4b')){var _0x503b7e={'id':_0x318020['id'],'name':_0x318020['name'],'strategy':_0x318020[_0xc37d('0x4c')],'answered':_0x318020['answered'],'available':_0x318020['available'],'loggedIn':_0x318020[_0xc37d('0x4d')],'pTalking':_0x318020['pTalking'],'sumBillable':_0x318020[_0xc37d('0x4e')],'sumDuration':_0x318020['sumDuration'],'sumHoldTime':_0x318020[_0xc37d('0x4f')]||0x0,'talking':_0x318020[_0xc37d('0x50')],'total':_0x318020[_0xc37d('0x51')],'type':_0x318020[_0xc37d('0x4a')],'unmanaged':_0x318020[_0xc37d('0x52')],'abandoned':_0x318020[_0xc37d('0x53')],'waiting':_0x318020['waiting'],'loggedInDb':_0x318020[_0xc37d('0x54')],'dialActive':_0x318020[_0xc37d('0x55')],'dialMethod':_0x318020[_0xc37d('0x56')],'dialOriginateCallerIdName':_0x318020['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x318020[_0xc37d('0x57')],'dialOriginateTimeout':_0x318020[_0xc37d('0x58')],'dialPrefix':_0x318020[_0xc37d('0x59')],'outboundAnswerAgiCallsDay':_0x318020['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x318020['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x318020[_0xc37d('0x5a')],'outboundBusyCallsDay':_0x318020[_0xc37d('0x5b')],'outboundCongestionCallsDay':_0x318020['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x318020[_0xc37d('0x5c')],'outboundDropCallsDayCallersExit':_0x318020[_0xc37d('0x5d')],'outboundDropCallsDayTimeout':_0x318020['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x318020['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x318020[_0xc37d('0x5e')],'outboundOriginateFailureCallsDay':_0x318020['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x318020[_0xc37d('0x5f')],'outboundRejectCallsDay':_0x318020[_0xc37d('0x60')],'outboundUnknownCallsDay':_0x318020['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x318020[_0xc37d('0x61')],'predictiveIntervalAvgHoldtime':_0x318020[_0xc37d('0x62')],'predictiveIntervalAvgTalktime':_0x318020['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x318020['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x318020[_0xc37d('0x63')],'predictiveIntervalErlangCalls':_0x318020[_0xc37d('0x64')],'predictiveIntervalErlangCallsDroppedCalls':_0x318020[_0xc37d('0x65')],'predictiveIntervalHitRate':_0x318020[_0xc37d('0x66')],'predictiveIntervalMultiplicativeFactor':_0x318020[_0xc37d('0x67')],'predictiveIntervalPauses':_0x318020[_0xc37d('0x68')],'predictiveIntervalAvailable':_0x318020[_0xc37d('0x69')],'predictiveIntervalTotalCalls':_0x318020[_0xc37d('0x6a')],'message':_0x318020[_0xc37d('0x3e')],'originated':_0x318020[_0xc37d('0x6b')],'erlangCalls':_0x318020[_0xc37d('0x6c')],'erlangCallToSecond':_0x318020[_0xc37d('0x6d')],'erlangAbandonmentRate':_0x318020[_0xc37d('0x6e')],'erlangBusyFactor':_0x318020[_0xc37d('0x6f')],'startPredictive':_0x318020[_0xc37d('0x26')],'startProgressive':_0x318020[_0xc37d('0x70')]};if(_0x318020[_0xc37d('0x71')]){_0x503b7e[_0xc37d('0x71')]={'id':_0x318020['Trunk']['id'],'name':_0x318020[_0xc37d('0x71')][_0xc37d('0x3c')],'active':_0x318020[_0xc37d('0x71')][_0xc37d('0x72')],'callerid':_0x318020[_0xc37d('0x71')][_0xc37d('0x73')]};}if(_0x318020['Interval']){_0x503b7e[_0xc37d('0x42')]={'id':_0x318020[_0xc37d('0x42')]['id'],'name':_0x318020['Interval']['name']};}var _0x840116=md5(JSON['stringify'](_0x503b7e));if(_0x318020[_0xc37d('0x4')]!==_0x840116){_0x318020[_0xc37d('0x4')]=_0x840116;emit(util['format'](_0xc37d('0x74'),_0x503b7e[_0xc37d('0x3c')]),_0xc37d('0x75'),_0x503b7e);}}}function emitCampaignSummary(_0x5dfa57){if(_0x5dfa57[_0xc37d('0x4a')]===_0xc37d('0x76')){emit(util['format'](_0xc37d('0x77'),_0x5dfa57[_0xc37d('0x3c')]),_0xc37d('0x78'),_0x5dfa57);}}function checkGetDataPredictive(_0x2c8ae8){if(isNotNull(_0x2c8ae8)&&!_[_0xc37d('0x45')](_0x2c8ae8)){loggerPredictive[_0xc37d('0x79')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xc37d('0x79')](_0xc37d('0x7a'),_0x2c8ae8['predictiveIntervalTotalCalls']);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x7b'),_0x2c8ae8[_0xc37d('0x61')]);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x7c'),_0x2c8ae8['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x7d'),_0x2c8ae8[_0xc37d('0x7e')]);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x7f'),_0x2c8ae8['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x80'),_0x2c8ae8[_0xc37d('0x81')]);loggerPredictive['info'](_0xc37d('0x82'));if(_0x2c8ae8['predictiveIntervalTotalCalls']>0x0){if(!_[_0xc37d('0x3b')](_0x2c8ae8['predictiveIntervalAvgTalktime'])&&_0x2c8ae8['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xc37d('0x79')](_0xc37d('0x83'));if(!_['isUndefined'](_0x2c8ae8[_0xc37d('0x62')])&&_0x2c8ae8['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xc37d('0x79')](_0xc37d('0x84'));}else{loggerPredictive[_0xc37d('0x79')](_0xc37d('0x85'));}}else{loggerPredictive[_0xc37d('0x79')](_0xc37d('0x86'));}return![];}function mergeDataErlangB(_0x591f44){return function(_0x5363d7){loggerPredictive['info'](_0xc37d('0x87'));loggerPredictive[_0xc37d('0x79')](_0xc37d('0x88'),_0x5363d7['erlangCalls']);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x89'),_0x5363d7[_0xc37d('0x6d')]);loggerPredictive[_0xc37d('0x79')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5363d7[_0xc37d('0x6e')]);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x8a'),_0x5363d7[_0xc37d('0x6f')]);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x8b'),_0x5363d7[_0xc37d('0x6e')]);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x82'));_[_0xc37d('0x8c')](_0x591f44,_0x5363d7);};}function getDiff(_0x54ebd3){var _0x3cc00a=moment()[_0xc37d('0x47')](0x0);var _0x597eb4=moment(_0x54ebd3)[_0xc37d('0x47')](0x0);return _0x3cc00a['diff'](_0x597eb4,_0xc37d('0x49'));}function ifInterval(_0x4302a6,_0x59465){if(_[_0xc37d('0x3b')](_0x59465)){return![];}return getDiff(_0x59465)<_0x4302a6*0x3c;}function freeVariablesPredictive(_0xc378c){if(isNotNull(_0xc378c)){if(!_['isUndefined'](_0xc378c[_0xc37d('0x70')])){_0xc378c[_0xc37d('0x70')]=undefined;loggerPredictive[_0xc37d('0x79')](_0xc378c['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xc37d('0x3b')](_0xc378c[_0xc37d('0x26')])){_0xc378c[_0xc37d('0x26')]=undefined;loggerPredictive['info'](_0xc378c[_0xc37d('0x3c')],_0xc37d('0x8d'));}if(!_[_0xc37d('0x3b')](_0xc378c['handlePredictive'])){clearInterval(_0xc378c[_0xc37d('0x8e')]);_0xc378c['handlePredictive']=undefined;loggerPredictive[_0xc37d('0x79')](_0xc378c[_0xc37d('0x3c')],_0xc37d('0x8f'));}}}function erlangb(_0x4c890a,_0x2b6728){if(_0x2b6728===0x0){return 0x0;}var _0x325936=0x1;for(var _0x5f59f5=0x1;_0x5f59f5<=_0x2b6728;_0x5f59f5+=0x1){_0x325936=0x1+_0x325936*_0x5f59f5/_0x4c890a;}return 0x1/_0x325936;}function isVoiceQueueOutbound(_0x300cdf){return _0x300cdf===_0xc37d('0x4b');}function isNotPreview(_0x48003){return _0x48003!=='preview';}function isCampaignIvr(_0x30f07e){return _0x30f07e===_0xc37d('0x76');}function getCallerId(_0x5be2ca,_0x1dc352,_0x5515a0){if(!_[_0xc37d('0x3b')](_0x5515a0)&&typeof _0x5515a0===_0xc37d('0x90')&&!_[_0xc37d('0x45')](_0x5515a0)){if(!_[_0xc37d('0x3b')](_0x1dc352)&&typeof _0x1dc352===_0xc37d('0x90')&&!_['isEmpty'](_0x1dc352)){return util[_0xc37d('0x91')](_0xc37d('0x92'),_0x1dc352,_0x5515a0);}return util[_0xc37d('0x91')]('\x22%s\x22\x20<%s>',_0x5515a0,_0x5515a0);}if(!_['isUndefined'](_0x5be2ca)&&typeof _0x5be2ca===_0xc37d('0x90')&&!_['isEmpty'](_0x5be2ca)){return _0x5be2ca;}return _0xc37d('0x93');}function loggerCatchQueueSummary(_0x270ecc,_0x343f70){return function(_0xdc961a){freeVariablesPredictive(_0x343f70);emitVoiceQueueSummary(_0x343f70);emitCampaignSummary(_0x343f70);loggerSyncQueueSummary[_0xc37d('0x94')](_0x270ecc,util[_0xc37d('0x95')](_0xdc961a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x28cce0,_0x531f19){return function(_0x4dee19){loggerPredictive[_0xc37d('0x94')](_0x531f19[_0xc37d('0x3c')],_0x28cce0);loggerPredictive[_0xc37d('0x94')](_0x4dee19[_0xc37d('0x96')]);freeVariablesPredictive(_0x531f19);};}function loggerCatch(_0x467bff){return function(_0x10ebb9){logger[_0xc37d('0x94')](_0x467bff,util[_0xc37d('0x95')](_0x10ebb9,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x454f1d){return _0x454f1d&&!_['isUndefined'](_0x454f1d)&&_0x454f1d[_0xc37d('0x97')]>0x0;}function decremetOriginate(_0x13ee91){if(!_[_0xc37d('0x3b')](_0x13ee91)&&_0x13ee91!==null){if(typeof _0x13ee91['originated']!==_0xc37d('0x98')){if(_0x13ee91[_0xc37d('0x6b')]>0x0){_0x13ee91['originated']-=0x1;}else{logger[_0xc37d('0x94')](_0xc37d('0x99'));}}}else{logger[_0xc37d('0x94')](_0xc37d('0x9a'));}}function checkContactLowerLimitOriginate(_0x5adca4,_0x339af,_0x155825){if(_0x339af>_0x155825){for(var _0x5ed4ee=0x0;_0x5ed4ee<_0x339af-_0x155825;_0x5ed4ee+=0x1){decremetOriginate(_0x5adca4);}}}function loggerGetContactDialer(_0x4b73c5,_0x4b7b96,_0x5c4c9b){return function(_0x4f108e){checkContactLowerLimitOriginate(_0x4b7b96,_0x5c4c9b,0x0);logger['error'](_0x4b73c5,util[_0xc37d('0x95')](_0x4f108e,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xe87399){return function(_0x25b31a){if(isNotNull(_0x25b31a)&&isNotNull(_0x25b31a[0x0])){if(_0x25b31a[0x0][_0xc37d('0x9b')]>0x0){_0xe87399[_0xc37d('0x3e')]='RESCHEDULED_CONTACTS';logger[_0xc37d('0x79')](_0xc37d('0x9c')+_0xe87399[_0xc37d('0x3c')],_0x25b31a[0x0][_0xc37d('0x9b')],_0xc37d('0x9d'));}else{_0xe87399[_0xc37d('0x3e')]=_0xc37d('0x9e');logger[_0xc37d('0x79')]('[getContactDialer2][Empty]'+_0xe87399[_0xc37d('0x3c')]);}}};}function notSendMessagesQueue(_0x3a7a40){if(_0x3a7a40['sendMessageOneNotActive']){freeVariablesPredictive(_0x3a7a40);if(_0x3a7a40['originated']===0x0&&_0x3a7a40[_0xc37d('0x50')]===0x0&&_0x3a7a40[_0xc37d('0x9f')]===0x0&&(_0x3a7a40[_0xc37d('0xa0')]||0x0)===0x0){_0x3a7a40[_0xc37d('0xa1')]=![];_0x3a7a40[_0xc37d('0xa2')]=0x0;_0x3a7a40[_0xc37d('0x3e')]=_0xc37d('0x3f');loggerSyncQueueSummary[_0xc37d('0x94')](_0xc37d('0xa3'),_0x3a7a40[_0xc37d('0x3c')],_0xc37d('0xa4'));}else{_0x3a7a40['message']=_0xc37d('0xa5');loggerSyncQueueSummary[_0xc37d('0x94')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x3a7a40[_0xc37d('0x3c')],_0xc37d('0xa6'));}emitVoiceQueueSummary(_0x3a7a40);}}function notSendMessagesCampaign(_0x474294){if(_0x474294[_0xc37d('0xa1')]){if(_0x474294[_0xc37d('0x6b')]===0x0){_0x474294[_0xc37d('0xa1')]=![];_0x474294['message']=_0xc37d('0x3f');loggerSyncQueueSummary['error'](_0xc37d('0xa7'),_0x474294[_0xc37d('0x3c')],_0xc37d('0xa4'));}else{_0x474294[_0xc37d('0x3e')]=_0xc37d('0xa5');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x474294[_0xc37d('0x3c')],_0xc37d('0xa6'));}emitCampaignSummary(_0x474294);}}function createObjHistory(_0x5ced8b,_0x1a6c68,_0x2317d5,_0x16ced6,_0x2ba439){_0x5ced8b[_0xc37d('0x3e')]=_0x2317d5;var _0x12423c=new Action(_0x5ced8b,_0x1a6c68);var _0x28c1ef=new History(_0x12423c);_0x28c1ef['state']=_0x16ced6;_0x28c1ef[_0xc37d('0xa8')]=_0x2ba439;_0x28c1ef[_0xc37d('0xa9')]=_0x12423c[_0xc37d('0xaa')];return _0x28c1ef;}Dialer[_0xc37d('0x1b')][_0xc37d('0x3a')]=function(){var _0x4094e5=this;setInterval(function(){_0x4094e5[_0xc37d('0xab')](_0x4094e5[_0xc37d('0xac')],'[uniqueid]');_0x4094e5['clearZombieChannels'](_0x4094e5[_0xc37d('0x23')],_0xc37d('0xad'));},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x3ce313,_0x41e64a){var _0x5b844c=this;for(var _0x3da9e8 in _0x3ce313){if(typeof _0x3ce313[_0x3da9e8]!==_0xc37d('0x98')){this[_0xc37d('0xae')][_0xc37d('0x1c')](function(){if(!_[_0xc37d('0xaf')](_0x3ce313[_0x3da9e8])){return ami['Action']({'action':_0xc37d('0xb0'),'channel':_0x3ce313[_0x3da9e8][_0xc37d('0xb1')]})[_0xc37d('0xb2')](function(_0x13cc65){if(_0x13cc65[_0xc37d('0x3e')]===_0xc37d('0xb3')){setTimeout(function(){if(_0x3ce313[_0x3da9e8]&&_0x3ce313[_0x3da9e8][_0xc37d('0x4a')]!==_0xc37d('0x76')){_0x5b844c[_0xc37d('0xb4')](_0x5b844c['voiceQueues'][_0x3ce313[_0x3da9e8][_0xc37d('0xb5')]]);logger[_0xc37d('0x94')](_0xc37d('0xb6'),_0x41e64a,_0x3da9e8,_0x3ce313[_0x3da9e8][_0xc37d('0xb5')]);delete _0x3ce313[_0x3da9e8];}if(_0x3ce313[_0x3da9e8]&&_0x3ce313[_0x3da9e8][_0xc37d('0x4a')]==='ivr'){_0x5b844c[_0xc37d('0xb4')](_0x5b844c[_0xc37d('0x1f')][_0x3ce313[_0x3da9e8][_0xc37d('0xb5')]]);logger[_0xc37d('0x94')](_0xc37d('0xb7'),_0x41e64a,_0x3da9e8,_0x3ce313[_0x3da9e8]['queue']);delete _0x3ce313[_0x3da9e8];}},0x2328);}});}});}}};Dialer[_0xc37d('0x1b')][_0xc37d('0xb8')]=function(_0xa3c673){return BPromise[_0xc37d('0xb9')]()['then'](cmHopper[_0xc37d('0xb8')](_0xa3c673))[_0xc37d('0xb2')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xc37d('0x1b')][_0xc37d('0xba')]=function(_0x57cac1){return BPromise[_0xc37d('0xb9')]()[_0xc37d('0xbb')](cmHopperBlack['checkIsBlackList'](_0x57cac1))[_0xc37d('0xb2')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0xc37d('0x1b')][_0xc37d('0xbc')]=function(_0x23dca3){return BPromise[_0xc37d('0xb9')]()[_0xc37d('0xbb')](cmHopperBlack[_0xc37d('0xbc')](_0x23dca3))[_0xc37d('0xb2')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xc37d('0x1b')][_0xc37d('0xbd')]=function(_0x4c56ea){return BPromise[_0xc37d('0xb9')]()[_0xc37d('0xbb')](cmHopperHistory['avgHandleTime'](_0x4c56ea))[_0xc37d('0xb2')](loggerCatch(_0xc37d('0xbe')));};Dialer[_0xc37d('0x1b')][_0xc37d('0xbf')]=function(_0x16caf7){return BPromise[_0xc37d('0xb9')]()[_0xc37d('0xbb')](cmHopper[_0xc37d('0xbf')](_0x16caf7))[_0xc37d('0xb2')](loggerCatch(_0xc37d('0xc0')));};Dialer[_0xc37d('0x1b')]['unlockContact']=function(_0x4cbbe9,_0x206bae,_0x3418f6){return BPromise[_0xc37d('0xb9')]()[_0xc37d('0xbb')](cmHopper[_0xc37d('0xc1')](_0x4cbbe9,_0x206bae,_0x3418f6))[_0xc37d('0xb2')](loggerCatch(_0xc37d('0xc2')));};Dialer[_0xc37d('0x1b')][_0xc37d('0xc3')]=function(_0x10c09f,_0x42eaff,_0x6208,_0x4326b9,_0x18aa6b){return BPromise['resolve']()['then'](cmHopper['getContactDialer'](_0x10c09f,_0x42eaff,_0x6208,_0x4326b9))[_0xc37d('0xb2')](function(_0x964ef3){_0x18aa6b[_0xc37d('0xc4')]-=_0x6208;_0x18aa6b['temp']=_0x18aa6b[_0xc37d('0xc4')]>0x0?_0x18aa6b['temp']:0x0;loggerCatch(_0xc37d('0xc5'))(_0x964ef3);});};Dialer[_0xc37d('0x1b')][_0xc37d('0xc6')]=function(_0x482e20,_0x4837e1,_0x56a7c6,_0x166070){return BPromise[_0xc37d('0xb9')]()['then'](cmHopper[_0xc37d('0xc6')](_0x482e20,_0x4837e1,_0x56a7c6))[_0xc37d('0xb2')](function(_0x56f9c4){_0x166070[_0xc37d('0xc4')]-=_0x4837e1;_0x166070[_0xc37d('0xc4')]=_0x166070['temp']>0x0?_0x166070['temp']:0x0;loggerCatch(_0xc37d('0xc7'))(_0x56f9c4);});};Dialer[_0xc37d('0x1b')][_0xc37d('0xc8')]=function(_0x391e0f){return BPromise[_0xc37d('0xb9')]()[_0xc37d('0xbb')](voiceQueueRt[_0xc37d('0xc8')](_0x391e0f))[_0xc37d('0xb2')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xc37d('0x1b')][_0xc37d('0xc9')]=function(_0x5f24c8){return BPromise['resolve']()[_0xc37d('0xbb')](cmHopper[_0xc37d('0xc9')](_0x5f24c8))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xc37d('0x1b')][_0xc37d('0xca')]=function(_0x5bf1a5){return BPromise['resolve']()[_0xc37d('0xbb')](cmHopperHistory['createHistory'](_0x5bf1a5))['catch'](loggerCatch(_0xc37d('0xcb')));};Dialer[_0xc37d('0x1b')][_0xc37d('0xb4')]=function(_0x1a90ee){if(!_[_0xc37d('0x3b')](_0x1a90ee)&&_0x1a90ee!==null){if(typeof _0x1a90ee[_0xc37d('0x6b')]!==_0xc37d('0x98')){if(_0x1a90ee[_0xc37d('0x6b')]>0x0){_0x1a90ee[_0xc37d('0x6b')]-=0x1;}else{logger[_0xc37d('0x94')](_0xc37d('0xcc'));}}}else{logger[_0xc37d('0x94')](_0xc37d('0xcd'));}};Dialer['prototype'][_0xc37d('0xce')]=function(_0x62492b,_0x2e25c5){var _0x4368a2=this;return function(_0x1899af){_0x4368a2[_0xc37d('0xb4')](_0x2e25c5);logger['error'](_0x62492b,util[_0xc37d('0x95')](_0x1899af,{'showHidden':![],'depth':null}));};};Dialer[_0xc37d('0x1b')]['emptyContact']=function(_0x1ca437,_0x55009f,_0x24d8c5){var _0x383a68={'state':0x19,'statedesc':_0xc37d('0xcf')};this[_0xc37d('0xb4')](_0x55009f);this['saveInDb'](_[_0xc37d('0x8c')](_0x383a68,_['pick'](_0x24d8c5,[_0xc37d('0xd0'),_0xc37d('0xd1'),_0xc37d('0xd2'),_0xc37d('0xd3'),_0xc37d('0xd4')])),'[emptyContact][createHistory]',_0xc37d('0xd5'));logger[_0xc37d('0x94')](_0x1ca437);};Dialer[_0xc37d('0x1b')][_0xc37d('0xd6')]=function(_0x41e3e2){return _0x41e3e2===_0xc37d('0xd7');};Dialer['prototype'][_0xc37d('0xd8')]=function(_0x2f38ca){return!_[_0xc37d('0x3b')](_0x2f38ca)&&_0x2f38ca&&!_[_0xc37d('0x3b')](_0x2f38ca[_0xc37d('0x3c')])&&!_['isUndefined'](_0x2f38ca[_0xc37d('0x72')])&&_0x2f38ca['active']&&(this[_0xc37d('0x21')][util['format'](_0xc37d('0xd9'),_0x2f38ca[_0xc37d('0x3c')])]['status']===_0xc37d('0xda')||this[_0xc37d('0x21')][util[_0xc37d('0x91')](_0xc37d('0xd9'),_0x2f38ca[_0xc37d('0x3c')])][_0xc37d('0xb0')]===_0xc37d('0xdb'));};Dialer['prototype'][_0xc37d('0xdc')]=function(_0x49fc88,_0xdac7d8,_0x11286b){this['createHistory'](_0x49fc88)[_0xc37d('0xb2')](loggerCatch(_0xdac7d8));this[_0xc37d('0xc9')](_0x49fc88)[_0xc37d('0xb2')](loggerCatch(_0x11286b));};Dialer[_0xc37d('0x1b')][_0xc37d('0x35')]=function(_0x2cc20c){var _0x2eac6a=this[_0xc37d('0xac')][_0x2cc20c[_0xc37d('0xdd')]];var _0x3b2680;if(!_['isNil'](_0x2cc20c)&&!_[_0xc37d('0xaf')](_0x2cc20c[_0xc37d('0xde')])&&!_[_0xc37d('0xaf')](_0x2cc20c['variable'][_0xc37d('0xdf')])&&_0x2cc20c[_0xc37d('0xe0')]===_0xc37d('0xe1')&&_0x2eac6a){if(_0x2eac6a['type']!==_0xc37d('0x76')&&this[_0xc37d('0xe2')][_0x2eac6a['queue']]['dialAMDActive']&&_0x2cc20c[_0xc37d('0xe3')]==='HANGUP'){delete this[_0xc37d('0xac')][_0x2cc20c['uniqueid']];this[_0xc37d('0xb4')](this[_0xc37d('0xe2')][_0x2eac6a['queue']]);this[_0xc37d('0xe2')][_0x2eac6a['queue']][_0xc37d('0xe4')]+=0x1;this[_0xc37d('0xe2')][_0x2eac6a[_0xc37d('0xb5')]][_0xc37d('0xe5')]+=0x1;_0x3b2680=new Hangup(_0x2eac6a,_0x2cc20c);_0x3b2680[_0xc37d('0xe6')]=0x12;_0x3b2680[_0xc37d('0xa8')]=_0xc37d('0xe7');_0x3b2680[_0xc37d('0xe8')]=_0xc37d('0xe9');ami[_0xc37d('0xea')](_0xc37d('0xeb'),ut[_0xc37d('0xec')](_0x3b2680,_0xc37d('0xed')));this[_0xc37d('0xdc')](_0x3b2680,'[syncHangupInAMD][createHistory]',_0xc37d('0xee'));}if(_0x2eac6a[_0xc37d('0x4a')]!==_0xc37d('0x76')&&this[_0xc37d('0xe2')][_0x2eac6a['queue']][_0xc37d('0xef')]&&_0x2cc20c[_0xc37d('0xe3')]===_0xc37d('0xf0')){var _0x3f82b4=this;return new BPromise(function(_0x4400d8,_0x3f1b8f){delete _0x3f82b4[_0xc37d('0xac')][_0x2cc20c[_0xc37d('0xdd')]];_0x3f82b4[_0xc37d('0xb4')](_0x3f82b4[_0xc37d('0xe2')][_0x2eac6a[_0xc37d('0xb5')]]);_0x3f82b4['voiceQueues'][_0x2eac6a[_0xc37d('0xb5')]]['outboundAnswerCallsDay']+=0x1;_0x3f82b4[_0xc37d('0xe2')][_0x2eac6a[_0xc37d('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x250f7b=_0x3f82b4[_0xc37d('0xe2')][_0x2eac6a[_0xc37d('0xb5')]];var _0x416991=new Hangup(_0x2eac6a,_0x2cc20c);_0x416991[_0xc37d('0xe6')]=0x13;_0x416991['statedesc']='Machine';_0x416991[_0xc37d('0xe8')]=_0xc37d('0xe9');_0x416991['countmachineretry']+=0x1;_0x416991[_0xc37d('0xf1')]+=0x1;_0x416991[_0xc37d('0xed')]=!![];ami[_0xc37d('0xea')](_0xc37d('0xeb'),ut[_0xc37d('0xec')](_0x416991,_0xc37d('0xed')));_0x3f82b4['createHistory'](_0x416991)[_0xc37d('0xb2')](loggerCatch(_0xc37d('0xf2')));if(_0x416991['countbusyretry']+_0x416991[_0xc37d('0xf3')]+_0x416991[_0xc37d('0xf4')]+_0x416991[_0xc37d('0xf5')]+_0x416991[_0xc37d('0xf6')]+_0x416991[_0xc37d('0xf7')]+_0x416991[_0xc37d('0xf8')]+_0x416991[_0xc37d('0xf9')]>=_0x250f7b[_0xc37d('0xfa')]){_0x3f82b4[_0xc37d('0xfb')](_0x416991,_0x4400d8,_0x3f1b8f,'reason19\x20machine....');}else{if(_0x416991[_0xc37d('0xf8')]>=_0x250f7b[_0xc37d('0xfc')]){_0x3f82b4[_0xc37d('0xfd')](_0x416991,_0x4400d8,_0x3f1b8f,_0xc37d('0xfe'));}else{_0x3f82b4[_0xc37d('0xbf')]({'active':![],'countmachineretry':_0x416991[_0xc37d('0xf8')],'scheduledat':moment()[_0xc37d('0xff')](_0x250f7b['dialMachineRetryFrequency'],_0xc37d('0x100'))[_0xc37d('0x91')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x416991[_0xc37d('0xd0')],'ListId':_0x416991[_0xc37d('0xd1')],'VoiceQueueId':_0x416991[_0xc37d('0xd3')]||undefined,'CampaignId':_0x416991[_0xc37d('0xd4')]||undefined})[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x101')));_0x4400d8({'reschedule':0x1});}}});}if(_0x2eac6a[_0xc37d('0x4a')]===_0xc37d('0x76')&&this[_0xc37d('0x1f')][_0x2eac6a[_0xc37d('0xb5')]][_0xc37d('0xef')]&&_0x2cc20c[_0xc37d('0xe3')]==='HANGUP'){delete this['uniqueId'][_0x2cc20c[_0xc37d('0xdd')]];this[_0xc37d('0xb4')](this[_0xc37d('0x1f')][_0x2eac6a[_0xc37d('0xb5')]]);_0x3b2680=new Hangup(_0x2eac6a,_0x2cc20c);_0x3b2680[_0xc37d('0xe6')]=0x12;_0x3b2680['statedesc']=_0xc37d('0xe7');_0x3b2680[_0xc37d('0xe8')]='AMD';ami[_0xc37d('0xea')](_0xc37d('0xeb'),ut['buildObj'](_0x3b2680,_0xc37d('0xed')));this['saveInDb'](_0x3b2680,_0xc37d('0x102'),_0xc37d('0x103'));}if(_0x2eac6a['type']===_0xc37d('0x76')&&this[_0xc37d('0x1f')][_0x2eac6a['queue']]['dialAMDActive']&&_0x2cc20c['value']===_0xc37d('0xf0')){var _0x3f82b4=this;return new BPromise(function(_0x147502,_0x51328b){delete _0x3f82b4[_0xc37d('0xac')][_0x2cc20c[_0xc37d('0xdd')]];_0x3f82b4['updateOriginated'](_0x3f82b4[_0xc37d('0x1f')][_0x2eac6a[_0xc37d('0xb5')]]);_0x3f82b4[_0xc37d('0x1f')][_0x2eac6a['queue']][_0xc37d('0xe4')]+=0x1;_0x3f82b4[_0xc37d('0x1f')][_0x2eac6a[_0xc37d('0xb5')]][_0xc37d('0xe5')]+=0x1;var _0x4a7783=_0x3f82b4[_0xc37d('0x1f')][_0x2eac6a[_0xc37d('0xb5')]];var _0x1c54b9=new Hangup(_0x2eac6a,_0x2cc20c);_0x1c54b9[_0xc37d('0xe6')]=0x13;_0x1c54b9['statedesc']=_0xc37d('0x104');_0x1c54b9[_0xc37d('0xe8')]=_0xc37d('0xe9');_0x1c54b9[_0xc37d('0xf8')]+=0x1;_0x1c54b9['countglobal']+=0x1;_0x1c54b9['amd']=!![];ami[_0xc37d('0xea')](_0xc37d('0xeb'),ut[_0xc37d('0xec')](_0x1c54b9,_0xc37d('0xed')));_0x3f82b4['createHistory'](_0x1c54b9)[_0xc37d('0xb2')](loggerCatch(_0xc37d('0xf2')));if(_0x1c54b9[_0xc37d('0x105')]+_0x1c54b9[_0xc37d('0xf3')]+_0x1c54b9['countnoanswerretry']+_0x1c54b9[_0xc37d('0xf5')]+_0x1c54b9[_0xc37d('0xf6')]+_0x1c54b9[_0xc37d('0xf7')]+_0x1c54b9[_0xc37d('0xf8')]+_0x1c54b9['countagentrejectretry']>=_0x4a7783['dialGlobalMaxRetry']){_0x3f82b4[_0xc37d('0xfb')](_0x1c54b9,_0x147502,_0x51328b,'reason19\x20machine....');}else{if(_0x1c54b9[_0xc37d('0xf8')]>=_0x4a7783[_0xc37d('0xfc')]){_0x3f82b4[_0xc37d('0xfd')](_0x1c54b9,_0x147502,_0x51328b,_0xc37d('0xfe'));}else{_0x3f82b4[_0xc37d('0xbf')]({'active':![],'countmachineretry':_0x1c54b9[_0xc37d('0xf8')],'scheduledat':moment()[_0xc37d('0xff')](_0x4a7783['dialMachineRetryFrequency'],_0xc37d('0x100'))[_0xc37d('0x91')](_0xc37d('0x106')),'ContactId':_0x1c54b9['ContactId'],'ListId':_0x1c54b9['ListId'],'VoiceQueueId':_0x1c54b9[_0xc37d('0xd3')]||undefined,'CampaignId':_0x1c54b9[_0xc37d('0xd4')]||undefined})[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x101')));_0x147502({'reschedule':0x1});}}});}}};Dialer[_0xc37d('0x1b')][_0xc37d('0x32')]=function(_0x479de7){var _0x29c4af=this[_0xc37d('0xac')][_0x479de7[_0xc37d('0xdd')]];var _0x187d8c=this;var _0x1ef09e;if(_0x29c4af&&_0x29c4af[_0xc37d('0x4a')]===_0xc37d('0x76')){delete this['uniqueId'][_0x479de7[_0xc37d('0xdd')]];this[_0xc37d('0xb4')](this[_0xc37d('0x1f')][_0x29c4af[_0xc37d('0xb5')]]);this[_0xc37d('0x1f')][_0x29c4af[_0xc37d('0xb5')]][_0xc37d('0x107')]+=0x1;_0x1ef09e=new Hangup(_0x29c4af,_0x479de7);this['createHistory'](_0x1ef09e)[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x108')));this[_0xc37d('0xc9')](_0x1ef09e)[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x109')));}if(_0x29c4af&&_0x29c4af[_0xc37d('0x4a')]!==_0xc37d('0x76')&&isNotNull(this['voiceQueues'][_0x29c4af[_0xc37d('0xb5')]]['dialQueueProject'])){delete this[_0xc37d('0xac')][_0x479de7['uniqueid']];this[_0xc37d('0xb4')](this[_0xc37d('0xe2')][_0x29c4af['queue']]);this[_0xc37d('0xe2')][_0x29c4af['queue']][_0xc37d('0xe4')]+=0x1;this[_0xc37d('0xe2')][_0x29c4af[_0xc37d('0xb5')]][_0xc37d('0xe5')]+=0x1;_0x1ef09e=new Hangup(_0x29c4af,_0x479de7);_0x1ef09e[_0xc37d('0xe6')]=0x10;_0x1ef09e[_0xc37d('0xa8')]=_0xc37d('0x10a');_0x1ef09e[_0xc37d('0xe8')]=_0xc37d('0x10b');this[_0xc37d('0xca')](_0x1ef09e)[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x108')));this['moveContactManagedDialer'](_0x1ef09e)[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x109')));}if(_0x29c4af&&_0x29c4af[_0xc37d('0x4a')]!==_0xc37d('0x76')&&!isNotNull(this[_0xc37d('0xe2')][_0x29c4af[_0xc37d('0xb5')]][_0xc37d('0x10c')])){delete this[_0xc37d('0xac')][_0x479de7[_0xc37d('0xdd')]];this['updateOriginated'](this[_0xc37d('0xe2')][_0x29c4af[_0xc37d('0xb5')]]);this[_0xc37d('0xe2')][_0x29c4af[_0xc37d('0xb5')]][_0xc37d('0x10d')]+=0x1;_0x1ef09e=new Hangup(_0x29c4af,_0x479de7);_0x1ef09e['state']=0xc;_0x1ef09e['statedesc']=_0x479de7['cause-txt'];_0x1ef09e[_0xc37d('0xe8')]=_0xc37d('0x10e');this[_0xc37d('0xca')](_0x1ef09e)[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x108')));this[_0xc37d('0xc9')](_0x1ef09e)[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x109')));}};Dialer[_0xc37d('0x1b')][_0xc37d('0x31')]=function(_0x3ab043){var _0x57af1f=this[_0xc37d('0xac')][_0x3ab043[_0xc37d('0xdd')]];var _0x31585d=this;if(this[_0xc37d('0xe2')][_0x3ab043[_0xc37d('0xb5')]]){if(_0x57af1f&&_0x57af1f['type']!==_0xc37d('0x76')){delete this['uniqueId'][_0x3ab043[_0xc37d('0xdd')]];this['voiceQueues'][_0x3ab043[_0xc37d('0xb5')]]['outboundAnswerCallsDay']+=0x1;var _0x46906e=new AgentComplete(_0x57af1f,_0x3ab043);if(_0x3ab043['reason']==='agent'){_0x46906e[_0xc37d('0x10f')]=this[_0xc37d('0xe2')][_0x3ab043[_0xc37d('0xb5')]][_0xc37d('0x110')]&&this[_0xc37d('0xe2')][_0x3ab043[_0xc37d('0xb5')]][_0xc37d('0x111')]?moment()[_0xc37d('0x91')](_0xc37d('0x106')):undefined;}this[_0xc37d('0xca')](_0x46906e)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xc37d('0xc9')](_0x46906e)[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x112')));}}};Dialer[_0xc37d('0x1b')][_0xc37d('0x2a')]=function(_0x1ee19d){if(this[_0xc37d('0xe2')][_0x1ee19d[_0xc37d('0xb5')]]){if(this[_0xc37d('0xac')][_0x1ee19d[_0xc37d('0xdd')]]&&this[_0xc37d('0xac')][_0x1ee19d['uniqueid']][_0xc37d('0x4a')]!==_0xc37d('0x76')){this[_0xc37d('0xb4')](this[_0xc37d('0xe2')][_0x1ee19d['queue']]);this[_0xc37d('0xac')][_0x1ee19d[_0xc37d('0xdd')]]['answertime']=moment()[_0xc37d('0x91')](_0xc37d('0x106'));}}};Dialer['prototype'][_0xc37d('0x113')]=function(_0x1b5995){this[_0xc37d('0xca')](_0x1b5995)[_0xc37d('0xb2')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xc37d('0xc9')](_0x1b5995)[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x114')));};Dialer[_0xc37d('0x1b')][_0xc37d('0x2d')]=function(_0x41a14d){var _0x57e37d=this['uniqueId'][_0x41a14d[_0xc37d('0xdd')]];var _0x1dda70=this;if(this[_0xc37d('0xe2')][_0x41a14d[_0xc37d('0xb5')]]){if(_0x57e37d&&_0x57e37d['type']!==_0xc37d('0x76')){delete this['uniqueId'][_0x41a14d['uniqueid']];this[_0xc37d('0xb4')](this[_0xc37d('0xe2')][_0x41a14d['queue']]);_0x57e37d[_0xc37d('0x115')]=moment()[_0xc37d('0x91')]('YYYY-MM-DD\x20HH:mm:ss');var _0x58d1d5=new QueueCallerAbandon(_0x57e37d,_0x41a14d);if(getSeconds(_0x57e37d[_0xc37d('0x115')],_0x57e37d[_0xc37d('0x116')])>=_0x57e37d[_0xc37d('0x117')]){this[_0xc37d('0xe2')][_0x41a14d[_0xc37d('0xb5')]][_0xc37d('0x63')]+=0x1;this[_0xc37d('0xe2')][_0x41a14d['queue']][_0xc37d('0x118')]+=0x1;this['voiceQueues'][_0x41a14d['queue']][_0xc37d('0x65')]+=0x1;_0x58d1d5[_0xc37d('0xe6')]=0xa;_0x58d1d5['statedesc']='Drop';_0x58d1d5[_0xc37d('0x119')]=_0xc37d('0x11a');_0x58d1d5[_0xc37d('0x10f')]=this[_0xc37d('0xe2')][_0x41a14d[_0xc37d('0xb5')]][_0xc37d('0x110')]?moment()[_0xc37d('0x91')](_0xc37d('0x106')):undefined;_0x58d1d5[_0xc37d('0xf6')]+=0x1;_0x58d1d5[_0xc37d('0xf1')]+=0x1;if(_0x58d1d5['countdropretry']>=this['voiceQueues'][_0x41a14d[_0xc37d('0xb5')]][_0xc37d('0x11b')]){this[_0xc37d('0x113')](_0x58d1d5);}else{this[_0xc37d('0xbf')]({'active':![],'countdropretry':_0x58d1d5['countdropretry'],'scheduledat':moment()[_0xc37d('0xff')](this['voiceQueues'][_0x41a14d[_0xc37d('0xb5')]][_0xc37d('0x11c')],_0xc37d('0x100'))[_0xc37d('0x91')](_0xc37d('0x106')),'ContactId':_0x57e37d[_0xc37d('0xd0')],'ListId':_0x57e37d[_0xc37d('0xd1')],'VoiceQueueId':_0x57e37d[_0xc37d('0xd3')]||undefined,'CampaignId':_0x57e37d['CampaignId']||undefined})[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x11d')));var _0x1e515b=new History(_0x58d1d5);_0x1e515b['state']=0xa;_0x1e515b[_0xc37d('0xa8')]=_0xc37d('0x11e');_0x1e515b[_0xc37d('0xaa')]=moment()['format'](_0xc37d('0x106'));_0x1e515b['endtime']=_0x1e515b[_0xc37d('0xaa')];_0x1e515b[_0xc37d('0x11f')]=_0x58d1d5[_0xc37d('0x11f')];_0x1e515b['calleridnum']=_0x58d1d5[_0xc37d('0x120')];this['createHistory'](_0x1e515b)[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x121')));}}else{this['voiceQueues'][_0x41a14d[_0xc37d('0xb5')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xc37d('0xe2')][_0x41a14d[_0xc37d('0xb5')]]['outboundDropCallsDayCallersExit']+=0x1;_0x58d1d5[_0xc37d('0xe6')]=0xb;_0x58d1d5[_0xc37d('0xa8')]=_0xc37d('0x122');_0x58d1d5[_0xc37d('0x119')]=_0xc37d('0x123');_0x58d1d5[_0xc37d('0xf7')]+=0x1;_0x58d1d5['countglobal']+=0x1;if(_0x58d1d5['countabandonedretry']>=this[_0xc37d('0xe2')][_0x41a14d[_0xc37d('0xb5')]][_0xc37d('0x124')]){this[_0xc37d('0x113')](_0x58d1d5);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x58d1d5[_0xc37d('0xf7')],'scheduledat':moment()['add'](this['voiceQueues'][_0x41a14d[_0xc37d('0xb5')]][_0xc37d('0x125')],_0xc37d('0x100'))[_0xc37d('0x91')](_0xc37d('0x106')),'ContactId':_0x57e37d[_0xc37d('0xd0')],'ListId':_0x57e37d[_0xc37d('0xd1')],'VoiceQueueId':_0x57e37d[_0xc37d('0xd3')]||undefined,'CampaignId':_0x57e37d[_0xc37d('0xd4')]||undefined})[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x126')));var _0x1e515b=new History(_0x58d1d5);_0x1e515b[_0xc37d('0xe6')]=0xb;_0x1e515b['statedesc']='Abandoned';_0x1e515b[_0xc37d('0xaa')]=moment()[_0xc37d('0x91')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e515b[_0xc37d('0xa9')]=_0x1e515b[_0xc37d('0xaa')];_0x1e515b['calleridname']=_0x58d1d5[_0xc37d('0x11f')];_0x1e515b[_0xc37d('0x120')]=_0x58d1d5[_0xc37d('0x120')];this[_0xc37d('0xca')](_0x1e515b)[_0xc37d('0xb2')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype'][_0xc37d('0x34')]=function(_0x23dedd){if(this[_0xc37d('0x23')][_0x23dedd['uniqueid']]){this[_0xc37d('0x23')][_0x23dedd[_0xc37d('0xdd')]][_0xc37d('0xb1')]=_0x23dedd[_0xc37d('0xb1')];}if(this['uniqueId'][_0x23dedd[_0xc37d('0xdd')]]){this[_0xc37d('0xac')][_0x23dedd['uniqueid']]['channel']=_0x23dedd[_0xc37d('0xb1')];}};Dialer[_0xc37d('0x1b')][_0xc37d('0x127')]=function(_0x3d1609){if(strategy[this[_0xc37d('0xe2')][this[_0xc37d('0x23')][_0x3d1609[_0xc37d('0x128')]][_0xc37d('0xb5')]]['strategy']]===_0xc37d('0x1a')){if(this[_0xc37d('0x23')][_0x3d1609[_0xc37d('0x128')]]&&_[_0xc37d('0xaf')](this[_0xc37d('0x23')][_0x3d1609[_0xc37d('0x128')]][_0xc37d('0x129')])&&_0x3d1609['status']==='1'&&_0x3d1609['paused']==='0'){if(this[_0xc37d('0x20')][_0x3d1609['stateinterface']]){if(!this[_0xc37d('0x20')][_0x3d1609[_0xc37d('0x12a')]][_0xc37d('0x129')]){this['agents'][_0x3d1609[_0xc37d('0x12a')]][_0xc37d('0x129')]=!![];this[_0xc37d('0x23')][_0x3d1609[_0xc37d('0x128')]][_0xc37d('0x129')]=!![];this[_0xc37d('0x23')][_0x3d1609[_0xc37d('0x128')]][_0xc37d('0x12a')]=_0x3d1609[_0xc37d('0x12a')];}}}}else if((strategy[this[_0xc37d('0xe2')][this['actions'][_0x3d1609['actionid']][_0xc37d('0xb5')]]['strategy']]||'rrmemory')===_0xc37d('0x19')){if(this[_0xc37d('0x23')][_0x3d1609[_0xc37d('0x128')]]){if(this[_0xc37d('0x20')][_0x3d1609[_0xc37d('0x12a')]]){this[_0xc37d('0x23')][_0x3d1609[_0xc37d('0x128')]]['stateinterface']=_0x3d1609['stateinterface'];if(_[_0xc37d('0xaf')](this[_0xc37d('0x12b')][this[_0xc37d('0x23')][_0x3d1609['actionid']]['queue']])){this[_0xc37d('0x12b')][this[_0xc37d('0x23')][_0x3d1609[_0xc37d('0x128')]][_0xc37d('0xb5')]]=[];}this[_0xc37d('0x12b')][this[_0xc37d('0x23')][_0x3d1609[_0xc37d('0x128')]]['queue']][_0xc37d('0x12c')](_[_0xc37d('0x8c')](_[_0xc37d('0x12d')](this[_0xc37d('0x23')][_0x3d1609['actionid']],['idHopper','stateinterface']),{'status':_0x3d1609[_0xc37d('0xb0')],'paused':_0x3d1609[_0xc37d('0x12e')]}));}}}};function unlockQueueStatus(_0x261850,_0x19a076){setTimeout(function(){if(_['isUndefined'](_0x261850[_0xc37d('0x12f')])){loggerBooked[_0xc37d('0x94')](_0xc37d('0x130'),_0x19a076);}_0x261850[_0xc37d('0x12f')]=!![];loggerBooked[_0xc37d('0x79')](_0xc37d('0x131'),_0x19a076,JSON['stringify'](_[_0xc37d('0x12d')](_0x261850,['name',_0xc37d('0x12f')])));},0x1f3);}Dialer[_0xc37d('0x1b')][_0xc37d('0x38')]=function(_0xcab6c1){var _0x124541=this;var _0x207f1c=_0x124541['voiceQueues'][_0x124541[_0xc37d('0x23')][_0xcab6c1['actionid']][_0xc37d('0xb5')]];if(strategy[this[_0xc37d('0xe2')][this[_0xc37d('0x23')][_0xcab6c1['actionid']][_0xc37d('0xb5')]][_0xc37d('0x4c')]]===_0xc37d('0x1a')){if(this[_0xc37d('0x23')][_0xcab6c1['actionid']]&&this[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]][_0xc37d('0x12a')]){this[_0xc37d('0x1e')][_0xc37d('0x132')](this['actions'][_0xcab6c1[_0xc37d('0x128')]][_0xc37d('0x133')],this['actions'][_0xcab6c1['actionid']][_0xc37d('0x12a')])['catch'](function(_0x9299ec){logger[_0xc37d('0x94')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x9299ec,{'showHidden':![],'depth':null}));})[_0xc37d('0x134')](function(){_0x124541['updateOriginated'](_0x124541[_0xc37d('0xe2')][_0x124541[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]][_0xc37d('0xb5')]]);_0x124541[_0xc37d('0x20')][_0x124541[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]][_0xc37d('0x12a')]][_0xc37d('0x129')]=![];delete _0x124541[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]];unlockQueueStatus(_0x207f1c);});}else{this[_0xc37d('0xb4')](this[_0xc37d('0xe2')][this[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]][_0xc37d('0xb5')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0xcab6c1[_0xc37d('0x128')]][_0xc37d('0xd0')],'ListId':this[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]][_0xc37d('0xd1')],'VoiceQueueId':this[_0xc37d('0x23')][_0xcab6c1['actionid']][_0xc37d('0xd3')]||undefined,'CampaignId':this[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]][_0xc37d('0xd4')]||undefined})[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x135')));delete this[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]];unlockQueueStatus(_0x207f1c);}}else if((strategy[this['voiceQueues'][this[_0xc37d('0x23')][_0xcab6c1['actionid']]['queue']]['strategy']]||_0xc37d('0x19'))===_0xc37d('0x19')){var _0x3e2e7d;if(this[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]]&&!_[_0xc37d('0x45')](this[_0xc37d('0x12b')][this[_0xc37d('0x23')][_0xcab6c1['actionid']][_0xc37d('0xb5')]])){if(this[_0xc37d('0x28')][_0x124541[_0xc37d('0x23')][_0xcab6c1['actionid']][_0xc37d('0xb5')]]){this[_0xc37d('0x28')][_0x124541[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]]['queue']]=this['queueBookedRR'][this[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]]['queue']]?this['queueBookedRR'][this[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]][_0xc37d('0xb5')]]:this[_0xc37d('0x12b')][this[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]][_0xc37d('0xb5')]]?this['queueBooked'][this[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]][_0xc37d('0xb5')]]['_rr']||0x0:0x0;}this['queueBooked'][this[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]][_0xc37d('0xb5')]][_0xc37d('0x136')]=this[_0xc37d('0x28')][this[_0xc37d('0x23')][_0xcab6c1[_0xc37d('0x128')]]['queue']];for(var _0x174c67=0x0;_0x174c67=0x0;})[_0xc37d('0xb2')](myreject(_0x4932c4)));}}else{_0x29d362[_0xc37d('0x12c')](ami[_0xc37d('0x151')]({'action':_0xc37d('0x152'),'command':util[_0xc37d('0x91')]('iftime\x20%s,%s',_0x2e3fa8,!_[_0xc37d('0x3b')](config['timezones'][_0x530c10])?_0x530c10:'')})[_0xc37d('0xbb')](function(_0x5cb720){return _0x5cb720[_0xc37d('0x14e')][_0xc37d('0x14f')](_0xc37d('0x150'))>=0x0;})[_0xc37d('0xb2')](myreject(_0x4932c4)));}BPromise[_0xc37d('0x153')](_0x29d362)[_0xc37d('0xbb')](function(_0x471a45){var _0x436988=_['some'](_0x471a45);if(_0x436988){return _0x24a4a1(_0x436988);}else{_0x48b8ea[_0xc37d('0x3e')]=_0x2bdfd3?_0xc37d('0x154'):_0xc37d('0x155');return _0x4932c4(msgResponse(_0xc37d('0x156'),_0xc37d('0x146'),_0xc37d('0x157')+_0x2bdfd3+'\x20'+_0x5f39a3+'\x20Interval\x20is\x20overtime:\x20'+util[_0xc37d('0x95')](_0x2e3fa8,{'showHidden':![],'depth':null})+_0xc37d('0x158')+_0x530c10));}})[_0xc37d('0xb2')](function(_0x3aabf3){return _0x4932c4(msgResponse(_0xc37d('0x145'),_0xc37d('0x146'),JSON[_0xc37d('0x46')](_0x3aabf3)));});});};Dialer[_0xc37d('0x1b')][_0xc37d('0x159')]=function(_0x3681a4){var _0x45edcf=this;return function(){switch(_0x3681a4[_0xc37d('0x56')]){case _0xc37d('0x15a'):freeVariablesPredictive(_0x3681a4);_0x45edcf[_0xc37d('0x15b')](_0x3681a4,0x1);break;case _0xc37d('0x15c'):freeVariablesPredictive(_0x3681a4);_0x45edcf[_0xc37d('0x15b')](_0x3681a4,_0x3681a4[_0xc37d('0x15d')]);break;case _0xc37d('0x8'):_0x45edcf[_0xc37d('0x8')](_0x3681a4);break;case _0xc37d('0x6'):freeVariablesPredictive(_0x3681a4);_0x45edcf['handlePower'](_0x3681a4,0x1);break;default:freeVariablesPredictive(_0x3681a4);logger['error']('Queue',_0x3681a4['name'],'method\x20not\x20recognized');}};};Dialer[_0xc37d('0x1b')][_0xc37d('0x15e')]=function(_0x38a71a){var _0x198fa1=this;return function(){_0x198fa1[_0xc37d('0x15f')](_0x38a71a);};};Dialer[_0xc37d('0x1b')][_0xc37d('0xa')]=function(_0x315f0c){var _0x1a1206=this;if(isNotPreview(_0x315f0c[_0xc37d('0x56')])){if(isVoiceQueueOutbound(_0x315f0c['type'])&&isActive(_0x315f0c[_0xc37d('0x55')])){_0x315f0c[_0xc37d('0xa1')]=!![];BPromise[_0xc37d('0xb9')]()['then'](checkIsLoggedIn(_0x315f0c,_0x315f0c[_0xc37d('0x4d')]))['then'](checkIsActive(_0x315f0c,_0x315f0c[_0xc37d('0x55')]))[_0xc37d('0xbb')](checkInterval(_0x315f0c))[_0xc37d('0xbb')](_0x1a1206[_0xc37d('0x140')](_0x315f0c))[_0xc37d('0xbb')](_0x1a1206['checkIfTime'](_0x315f0c[_0xc37d('0x160')],_0x315f0c['dialTimezone'],_0x315f0c[_0xc37d('0x3c')],_0x315f0c))[_0xc37d('0xbb')](_0x1a1206[_0xc37d('0x161')](_0x315f0c[_0xc37d('0x42')],_0x315f0c['dialTimezone'],_0x315f0c['name'],_0x315f0c))[_0xc37d('0xbb')](_0x1a1206[_0xc37d('0x159')](_0x315f0c))['catch'](loggerCatchQueueSummary(_0xc37d('0x162'),_0x315f0c));}else{notSendMessagesQueue(_0x315f0c);}}else{freeVariablesPredictive(_0x315f0c);}};Dialer[_0xc37d('0x1b')]['syncCampaigns']=function(){var _0x3c4530=this;var _0x28d471;for(var _0x55dbf9 in this[_0xc37d('0x1f')]){if(typeof this['campaigns'][_0x55dbf9]!==_0xc37d('0x98')){_0x28d471=this['campaigns'][_0x55dbf9];if(isCampaignIvr(_0x28d471[_0xc37d('0x4a')])&&isActive(_0x28d471[_0xc37d('0x72')])){_0x28d471[_0xc37d('0xa1')]=!![];BPromise[_0xc37d('0xb9')]()['then'](checkIsActive(_0x28d471,_0x28d471[_0xc37d('0x72')]))[_0xc37d('0xbb')](checkInterval(_0x28d471))[_0xc37d('0xbb')](_0x3c4530['checkIsTrunkReachable'](_0x28d471))['then'](_0x3c4530['checkIfTime'](_0x28d471[_0xc37d('0x160')],_0x28d471[_0xc37d('0x163')],_0x28d471[_0xc37d('0x3c')],_0x28d471))[_0xc37d('0xbb')](_0x3c4530[_0xc37d('0x161')](_0x28d471[_0xc37d('0x42')],_0x28d471['dialTimezone'],_0x28d471[_0xc37d('0x3c')],_0x28d471))[_0xc37d('0xbb')](_0x3c4530[_0xc37d('0x15e')](_0x28d471))['catch'](loggerCatchQueueSummary(_0xc37d('0x164'),_0x28d471));}else{notSendMessagesCampaign(_0x28d471);}}}};function getCallerIdRandom(_0x31a637,_0x566fba){var _0x244228;var _0x2584b9;var _0x40767e;if(_0x566fba<=0x0){_0x566fba=0x1;}_0x244228=new RegExp('\x5cw{0,'+_0x566fba+'}$');_0x2584b9=Math[_0xc37d('0x165')](0xa,_0x566fba-0x1);_0x40767e=Math[_0xc37d('0x165')](0xa,_0x566fba)-0x1;return util['format']('%s',_[_0xc37d('0x166')](_0x31a637,_0x244228,_[_0xc37d('0x167')](_0x2584b9,_0x40767e)));}function extractCalleridName(_0x3f8ee1){var _0x57a255=_0x3f8ee1[_0xc37d('0x168')](/"(.*?)"/);return _0x57a255?_0x57a255[0x1]:_0x3f8ee1;}function extractCalleridNumber(_0x558edb){var _0x220415=_0x558edb['match'](/<(.*?)>/);return _0x220415?_0x220415[0x1]:_0x558edb;}Dialer[_0xc37d('0x1b')]['actionOriginate']=function(_0x5dace3,_0x50d187){var _0x6ba9bc=this;var _0x41044a=uuid['v4']();this[_0xc37d('0x23')][_0x41044a]=new Action(_0x5dace3,_0x50d187,_0x41044a);return new BPromise(function(_0x4273d8,_0x5af30f){if(_['isUndefined'](_0x5dace3)&&typeof _0x5dace3!==_0xc37d('0x169')){return _0x5af30f(msgResponse(_0xc37d('0x16a'),_0xc37d('0x146'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x50d187[_0xc37d('0x16b')][_0xc37d('0x16c')])||_0x50d187[_0xc37d('0x16b')]['phone']===null){return _0x5af30f(msgResponse(_0xc37d('0x16a'),_0xc37d('0x146'),_0xc37d('0x16d')));}var _0x4e484b={'XMD-CALLERID':_0x6ba9bc[_0xc37d('0x23')][_0x41044a][_0xc37d('0x16e')](),'XMD-AGI':_0x5dace3[_0xc37d('0x10c')]?util[_0xc37d('0x91')](_0xc37d('0x16f'),ipAgi,_0x5dace3[_0xc37d('0x10c')]):_0xc37d('0x170'),'XMD-AGIAFTER':_0x5dace3[_0xc37d('0x110')]?util[_0xc37d('0x91')](_0xc37d('0x16f'),ipAgi,_0x5dace3[_0xc37d('0x110')]):_0xc37d('0x170'),'XMD-QUEUE':_0x5dace3[_0xc37d('0x4a')]===_0xc37d('0x4b')?util[_0xc37d('0x91')](_0xc37d('0x171'),_0x5dace3[_0xc37d('0x3c')],_0x5dace3['dialQueueOptions']||'',_0x5dace3['dialAgiAfterHangupAgent']?'c':'',_0x5dace3['dialQueueTimeout']||0x3):_0xc37d('0x170'),'XMD-CONTACTID':_0x50d187[_0xc37d('0xd0')],'XMD-CDRTYPE':_0xc37d('0x172'),'CALLERID(all)':_0x6ba9bc[_0xc37d('0x23')][_0x41044a][_0xc37d('0x16e')](),'XMD-AMD':_0x5dace3[_0xc37d('0xef')]?'ACTIVE':_0xc37d('0x170'),'XMD-DESTINATION':_0xc37d('0xe1')};if(_0x5dace3[_0xc37d('0xef')]){_0x4e484b[_0xc37d('0x173')]=_0x5dace3[_0xc37d('0x174')]||0x9c4;_0x4e484b[_0xc37d('0x175')]=_0x5dace3['dialAMDGreeting']||0x5dc;_0x4e484b[_0xc37d('0x176')]=_0x5dace3['dialAMDAfterGreetingSilence']||0x320;_0x4e484b[_0xc37d('0x177')]=_0x5dace3[_0xc37d('0x178')]||0x1388;_0x4e484b[_0xc37d('0x179')]=_0x5dace3[_0xc37d('0x17a')]||0x64;_0x4e484b[_0xc37d('0x17b')]=_0x5dace3[_0xc37d('0x17c')]||0x32;_0x4e484b['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x5dace3[_0xc37d('0x17d')]||0x3;_0x4e484b[_0xc37d('0x17e')]=_0x5dace3[_0xc37d('0x17f')]||0x100;_0x4e484b[_0xc37d('0x180')]=_0x5dace3[_0xc37d('0x181')]||0x1388;}if(_0x5dace3[_0xc37d('0x4a')]==='outbound'){_0x4e484b['XMD-VOICEQUEUEID']=_0x50d187['VoiceQueueId'];}else{_0x4e484b['XMD-CAMPAIGNID']=_0x50d187[_0xc37d('0xd4')];}for(var _0x2514d9 in _0x50d187[_0xc37d('0x16b')]){if(typeof _0x50d187[_0xc37d('0x16b')][_0x2514d9]!==_0xc37d('0x98')){if(isNotNull(_0x50d187[_0xc37d('0x16b')][_0x2514d9])&&_0x2514d9!=='id'&&_0x2514d9!=='tags'&&_0x2514d9!=='createdAt'&&_0x2514d9!=='updatedAt'){_0x4e484b[util[_0xc37d('0x91')]('%s%s',_0xc37d('0x182'),_[_0xc37d('0x183')](_0x2514d9))]=_0x50d187[_0xc37d('0x16b')][_0x2514d9];}}}var _0x5f7223=_0x6ba9bc['isTrunkReachable'](_0x5dace3['Trunk'])?getCallerId(_0x5dace3['Trunk'][_0xc37d('0x73')],_0x5dace3[_0xc37d('0x184')],_0x5dace3[_0xc37d('0x185')]>0x0?getCallerIdRandom(_0x5dace3[_0xc37d('0x57')],_0x5dace3[_0xc37d('0x185')]):_0x5dace3[_0xc37d('0x57')]):getCallerId(_[_0xc37d('0xaf')](_0x5dace3[_0xc37d('0x141')])?_0x5dace3['Trunk'][_0xc37d('0x73')]:_0x5dace3[_0xc37d('0x141')][_0xc37d('0x73')],_0x5dace3['dialOriginateCallerIdName'],_0x5dace3['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5dace3[_0xc37d('0x57')],_0x5dace3[_0xc37d('0x185')]):_0x5dace3[_0xc37d('0x57')]);if(_0x5f7223){_0x4e484b[_0xc37d('0x186')]=_0x6ba9bc[_0xc37d('0x23')][_0x41044a]['originatecalleridname']=extractCalleridName(_0x5f7223);_0x4e484b[_0xc37d('0x187')]=_0x6ba9bc[_0xc37d('0x23')][_0x41044a][_0xc37d('0x188')]=extractCalleridNumber(_0x5f7223);}return ami[_0xc37d('0x151')]({'actionid':_0x41044a,'action':_0xc37d('0x16a'),'channel':_0x6ba9bc[_0xc37d('0xd8')](_0x5dace3['Trunk'])?util['format'](_0xc37d('0x189'),_0x5dace3['Trunk'][_0xc37d('0x3c')],isNotNull(_0x5dace3[_0xc37d('0x59')])?_0x5dace3[_0xc37d('0x59')][_0xc37d('0x18a')]()||'':'',_0x5dace3[_0xc37d('0x18b')]>0x0?_0x50d187[_0xc37d('0x16b')][_0xc37d('0x16c')][_0xc37d('0x18c')](_0x5dace3[_0xc37d('0x18b')]):_0x50d187[_0xc37d('0x16b')][_0xc37d('0x16c')]):util['format']('SIP/%s/%s%s',_[_0xc37d('0xaf')](_0x5dace3['TrunkBackup'])?_0x5dace3[_0xc37d('0x71')][_0xc37d('0x3c')]:_0x5dace3[_0xc37d('0x141')]['name'],isNotNull(_0x5dace3[_0xc37d('0x59')])?_0x5dace3[_0xc37d('0x59')]['trim']()||'':'',_0x5dace3[_0xc37d('0x18b')]>0x0?_0x50d187['Contact']['phone'][_0xc37d('0x18c')](_0x5dace3[_0xc37d('0x18b')]):_0x50d187['Contact'][_0xc37d('0x16c')]),'callerid':_0x5f7223,'Exten':_0xc37d('0xe1'),'Context':'from-sip','Priority':'1','variable':_0x4e484b,'timeout':(_0x5dace3[_0xc37d('0x58')]||0x1e)*0x3e8,'async':!![],'channelid':_0x41044a})[_0xc37d('0xbb')](function(_0x2934a3){return _0x4273d8(_0x2934a3);})['catch'](function(_0x4b01a0){_0x5dace3[_0xc37d('0x18d')]+=0x1;var _0x11aeb7=new History(_0x6ba9bc[_0xc37d('0x23')][_0x41044a]);logger[_0xc37d('0x94')](util[_0xc37d('0x91')](_0xc37d('0x18e'),JSON[_0xc37d('0x46')](_0x4b01a0)));_0x11aeb7[_0xc37d('0xe6')]=0xe;_0x11aeb7[_0xc37d('0xa8')]='OriginateError';_0x11aeb7[_0xc37d('0xaa')]=moment()[_0xc37d('0x91')](_0xc37d('0x106'));_0x11aeb7[_0xc37d('0xa9')]=_0x11aeb7[_0xc37d('0xaa')];_0x6ba9bc[_0xc37d('0xca')](_0x11aeb7)['catch'](loggerCatch('[originate][error]'));_0x6ba9bc['moveContactManagedDialer'](_0x11aeb7)['catch'](loggerCatch(_0xc37d('0x18f')))[_0xc37d('0x134')](function(){delete _0x6ba9bc['actions'][_0x41044a];return _0x5af30f(msgResponse(_0xc37d('0x16a'),_0xc37d('0x190'),_0xc37d('0x191')));});});});};Dialer[_0xc37d('0x1b')][_0xc37d('0x2f')]=function(_0x43e8af){var _0x1e64f1=this[_0xc37d('0x23')][_0x43e8af[_0xc37d('0x128')]];if(_0x1e64f1){delete this['actions'][_0x43e8af['actionid']];_0x1e64f1[_0xc37d('0x116')]=moment()[_0xc37d('0x91')](_0xc37d('0x106'));var _0x3e2a38=_0x1e64f1[_0xc37d('0x4a')]===_0xc37d('0x76')?this[_0xc37d('0x1f')][_0x1e64f1[_0xc37d('0xb5')]]:this['voiceQueues'][_0x1e64f1[_0xc37d('0x192')]()];if(!this[_0xc37d('0xd6')](_0x43e8af[_0xc37d('0x193')])){this[_0xc37d('0xb4')](_0x3e2a38);return this['callProgressDetecting'](_0x1e64f1,_0x3e2a38,_0x43e8af)[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x194')));}this[_0xc37d('0xac')][_0x43e8af[_0xc37d('0xdd')]]=_0x1e64f1;}};Dialer[_0xc37d('0x1b')][_0xc37d('0x195')]=function(_0x75e466,_0xca426b,_0x14219b){var _0x1c17e6=new History(_0xca426b);if(_0x1c17e6[_0xc37d('0x105')]+_0x1c17e6['countcongestionretry']+_0x1c17e6[_0xc37d('0xf4')]+_0x1c17e6[_0xc37d('0xf5')]+_0x1c17e6[_0xc37d('0xf6')]+_0x1c17e6[_0xc37d('0xf7')]+_0x1c17e6[_0xc37d('0xf8')]+_0x1c17e6['countagentrejectretry']>=_0x14219b[_0xc37d('0xfa')]-0x1){return!![];}switch(_0x75e466){case 0x3:if(_0x1c17e6[_0xc37d('0xf4')]>=_0x14219b[_0xc37d('0x196')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x1c17e6['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xc37d('0xff')](_0x14219b['dialNoAnswerRetryFrequency'],_0xc37d('0x100'))['format'](_0xc37d('0x106')),'ContactId':_0x1c17e6[_0xc37d('0xd0')],'ListId':_0x1c17e6[_0xc37d('0xd1')],'VoiceQueueId':_0x1c17e6[_0xc37d('0xd3')]||undefined,'CampaignId':_0x1c17e6[_0xc37d('0xd4')]||undefined})[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x197')));break;case 0x5:if(_0x1c17e6[_0xc37d('0x105')]>=_0x14219b['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x1c17e6[_0xc37d('0x105')]+=0x1,'scheduledat':moment()['add'](_0x14219b[_0xc37d('0x198')],'minutes')[_0xc37d('0x91')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c17e6['ContactId'],'ListId':_0x1c17e6[_0xc37d('0xd1')],'VoiceQueueId':_0x1c17e6[_0xc37d('0xd3')]||undefined,'CampaignId':_0x1c17e6['CampaignId']||undefined})[_0xc37d('0xb2')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x1c17e6[_0xc37d('0xf3')]>=_0x14219b[_0xc37d('0x199')]-0x1){return!![];}this[_0xc37d('0xbf')]({'active':![],'countcongestionretry':_0x1c17e6['countcongestionretry']+=0x1,'scheduledat':moment()[_0xc37d('0xff')](_0x14219b[_0xc37d('0x19a')],_0xc37d('0x100'))[_0xc37d('0x91')](_0xc37d('0x106')),'ContactId':_0x1c17e6['ContactId'],'ListId':_0x1c17e6['ListId'],'VoiceQueueId':_0x1c17e6[_0xc37d('0xd3')]||undefined,'CampaignId':_0x1c17e6[_0xc37d('0xd4')]||undefined})[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x19b')));break;case 0x0:if(_0x1c17e6[_0xc37d('0xf5')]>=_0x14219b[_0xc37d('0x19c')]-0x1){return!![];}else{this[_0xc37d('0xbf')]({'active':![],'countnosuchnumberretry':_0x1c17e6['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xc37d('0xff')](_0x14219b[_0xc37d('0x19d')],_0xc37d('0x100'))[_0xc37d('0x91')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c17e6['ContactId'],'ListId':_0x1c17e6['ListId'],'VoiceQueueId':_0x1c17e6[_0xc37d('0xd3')]||undefined,'CampaignId':_0x1c17e6[_0xc37d('0xd4')]||undefined})[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x19e')));}break;case 0xa:if(_0x1c17e6['countdropretry']>=_0x14219b[_0xc37d('0x11b')]-0x1){return!![];}this[_0xc37d('0xbf')]({'active':![],'countdropretry':_0x1c17e6[_0xc37d('0xf6')]+=0x1,'scheduledat':moment()['add'](_0x14219b['dialDropRetryFrequency'],_0xc37d('0x100'))[_0xc37d('0x91')](_0xc37d('0x106')),'ContactId':_0x1c17e6[_0xc37d('0xd0')],'ListId':_0x1c17e6[_0xc37d('0xd1')],'VoiceQueueId':_0x1c17e6[_0xc37d('0xd3')]||undefined,'CampaignId':_0x1c17e6[_0xc37d('0xd4')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x1c17e6['countabandonedretry']>=_0x14219b[_0xc37d('0x124')]-0x1){return!![];}this[_0xc37d('0xbf')]({'active':![],'countabandonedretry':_0x1c17e6['countabandonedretry']+=0x1,'scheduledat':moment()[_0xc37d('0xff')](_0x14219b[_0xc37d('0x125')],_0xc37d('0x100'))[_0xc37d('0x91')](_0xc37d('0x106')),'ContactId':_0x1c17e6[_0xc37d('0xd0')],'ListId':_0x1c17e6[_0xc37d('0xd1')],'VoiceQueueId':_0x1c17e6[_0xc37d('0xd3')]||undefined,'CampaignId':_0x1c17e6['CampaignId']||undefined})[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x126')));break;case 0x13:if(_0x1c17e6[_0xc37d('0xf8')]>=_0x14219b[_0xc37d('0xfc')]-0x1){return!![];}this[_0xc37d('0xbf')]({'active':![],'countmachineretry':_0x1c17e6[_0xc37d('0xf8')]+=0x1,'scheduledat':moment()[_0xc37d('0xff')](_0x14219b[_0xc37d('0x19f')],_0xc37d('0x100'))['format'](_0xc37d('0x106')),'ContactId':_0x1c17e6['ContactId'],'ListId':_0x1c17e6[_0xc37d('0xd1')],'VoiceQueueId':_0x1c17e6[_0xc37d('0xd3')]||undefined,'CampaignId':_0x1c17e6['CampaignId']||undefined})['catch'](loggerCatch(_0xc37d('0x101')));break;case 0x14:if(_0x1c17e6[_0xc37d('0xf9')]>=_0x14219b['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0xc37d('0xbf')]({'active':![],'countagentrejectretry':_0x1c17e6['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xc37d('0xff')](_0x14219b[_0xc37d('0x1a0')],_0xc37d('0x100'))[_0xc37d('0x91')](_0xc37d('0x106')),'ContactId':_0x1c17e6[_0xc37d('0xd0')],'ListId':_0x1c17e6[_0xc37d('0xd1')],'VoiceQueueId':_0x1c17e6[_0xc37d('0xd3')]||undefined,'CampaignId':_0x1c17e6[_0xc37d('0xd4')]||undefined})['catch'](loggerCatch(_0xc37d('0x1a1')));break;default:return!![];}};Dialer[_0xc37d('0x1b')]['callProgressDetecting']=function(_0x43c5e6,_0x15cf0f,_0xccc11c){var _0x3ed309=this;var _0xd89eea=new History(_0x43c5e6);return new BPromise(function(_0x3511a4,_0x283566){if(_[_0xc37d('0x3b')](_0x15cf0f)&&typeof _0x15cf0f!=='object'){return _0x283566(msgResponse(_0xc37d('0x1a2'),_0xc37d('0x146'),_0xc37d('0x1a3')));}if(_[_0xc37d('0x3b')](_0xccc11c)&&typeof _0xccc11c!==_0xc37d('0x169')){return _0x283566(msgResponse('[callProgressDetecting]','Failure',_0xc37d('0x1a4')));}switch(_0xccc11c[_0xc37d('0x1a5')]){case'0':_0x15cf0f['outboundNoSuchCallsDay']+=0x1;_0xd89eea['state']=0x0;_0xd89eea['statedesc']='NoSuchNumber';_0xd89eea[_0xc37d('0xf5')]+=0x1;_0xd89eea['countglobal']+=0x1;ami['emit'](_0xc37d('0x1a6'),ut['buildObj'](_0x43c5e6,_0xc37d('0x1a7')));_0x3ed309[_0xc37d('0xca')](_0xd89eea)[_0xc37d('0xb2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3ed309[_0xc37d('0x195')](0x0,_0x43c5e6,_0x15cf0f)){if(_0xd89eea['countnosuchnumberretry']>=_0x15cf0f['dialNoSuchNumberMaxRetry']){_0x3ed309[_0xc37d('0xfd')](_0xd89eea,_0x3511a4,_0x283566,_0xc37d('0x1a8'));}else{_0x3ed309[_0xc37d('0xfb')](_0xd89eea,_0x3511a4,_0x283566,_0xc37d('0x1a8'));}}break;case'3':_0x15cf0f[_0xc37d('0x1a9')]+=0x1;_0xd89eea[_0xc37d('0xe6')]=0x3;_0xd89eea['statedesc']=_0xc37d('0x1aa');_0xd89eea[_0xc37d('0xf4')]+=0x1;_0xd89eea['countglobal']+=0x1;ami[_0xc37d('0xea')](_0xc37d('0x1ab'),ut[_0xc37d('0xec')](_0x43c5e6,_0xc37d('0x1ac')));_0x3ed309[_0xc37d('0xca')](_0xd89eea)[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x1ad')));if(_0x3ed309[_0xc37d('0x195')](0x3,_0x43c5e6,_0x15cf0f)){if(_0xd89eea[_0xc37d('0xf4')]>=_0x15cf0f['dialNoAnswerMaxRetry']){_0x3ed309[_0xc37d('0xfd')](_0xd89eea,_0x3511a4,_0x283566,_0xc37d('0x1ae'));}else{_0x3ed309['stateGlobal'](_0xd89eea,_0x3511a4,_0x283566,_0xc37d('0x1ae'));}}break;case'5':_0x15cf0f['outboundBusyCallsDay']+=0x1;_0xd89eea['state']=0x5;_0xd89eea[_0xc37d('0xa8')]='Busy';_0xd89eea['countbusyretry']+=0x1;_0xd89eea['countglobal']+=0x1;ami[_0xc37d('0xea')](_0xc37d('0x1af'),ut['buildObj'](_0x43c5e6,_0xc37d('0x1b0')));_0x3ed309[_0xc37d('0xca')](_0xd89eea)[_0xc37d('0xb2')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x3ed309[_0xc37d('0x195')](0x5,_0x43c5e6,_0x15cf0f)){if(_0xd89eea['countbusyretry']>=_0x15cf0f[_0xc37d('0x1b1')]){_0x3ed309['createStateFinal'](_0xd89eea,_0x3511a4,_0x283566,'reason\x205\x20busy');}else{_0x3ed309[_0xc37d('0xfb')](_0xd89eea,_0x3511a4,_0x283566,_0xc37d('0x1b2'));}}break;case'8':_0x15cf0f[_0xc37d('0x1b3')]+=0x1;_0xd89eea['state']=0x8;_0xd89eea[_0xc37d('0xa8')]=_0xc37d('0x1b4');_0xd89eea[_0xc37d('0xf3')]+=0x1;_0xd89eea['countglobal']+=0x1;ami[_0xc37d('0xea')]('custom:agentcongestion',ut['buildObj'](_0x43c5e6,_0xc37d('0x1b5')));_0x3ed309[_0xc37d('0xca')](_0xd89eea)[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x1b6')));if(_0x3ed309[_0xc37d('0x195')](0x8,_0x43c5e6,_0x15cf0f)){if(_0xd89eea[_0xc37d('0xf3')]>=_0x15cf0f[_0xc37d('0x199')]){_0x3ed309[_0xc37d('0xfd')](_0xd89eea,_0x3511a4,_0x283566,'reason\x208\x20congestion');}else{_0x3ed309[_0xc37d('0xfb')](_0xd89eea,_0x3511a4,_0x283566,'reason\x208\x20congestion');}}break;case'11':_0x15cf0f[_0xc37d('0x1b7')]+=0x1;_0xd89eea[_0xc37d('0xe6')]=0xb;_0xd89eea['statedesc']='Abandoned';_0xd89eea[_0xc37d('0xf7')]+=0x1;_0xd89eea['countglobal']+=0x1;_0x3ed309[_0xc37d('0xca')](_0xd89eea)[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x1b8')));if(_0x3ed309[_0xc37d('0x195')](0xb,_0x43c5e6,_0x15cf0f)){if(_0xd89eea['countabandonedretry']>=_0x15cf0f[_0xc37d('0x124')]){_0x3ed309['createStateFinal'](_0xd89eea,_0x3511a4,_0x283566,_0xc37d('0x1b9'));}else{_0x3ed309[_0xc37d('0xfb')](_0xd89eea,_0x3511a4,_0x283566,_0xc37d('0x1b9'));}}break;case'20':_0x15cf0f[_0xc37d('0x60')]+=0x1;_0xd89eea['state']=0x14;_0xd89eea[_0xc37d('0xa8')]=_0xc37d('0x1ba');_0xd89eea[_0xc37d('0xf9')]+=0x1;_0xd89eea[_0xc37d('0xf1')]+=0x1;ami['emit'](_0xc37d('0x1bb'),ut['buildObj'](_0x43c5e6,_0xc37d('0x1bc')));_0x3ed309[_0xc37d('0xca')](_0xd89eea)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x3ed309[_0xc37d('0x195')](0x14,_0x43c5e6,_0x15cf0f)){if(_0xd89eea[_0xc37d('0xf9')]>=_0x15cf0f[_0xc37d('0x1bd')]){_0x3ed309['createStateFinal'](_0xd89eea,_0x3511a4,_0x283566,'reason\x2020\x20agentreject');}else{_0x3ed309[_0xc37d('0xfb')](_0xd89eea,_0x3511a4,_0x283566,_0xc37d('0x1be'));}}break;default:_0x15cf0f[_0xc37d('0x10d')]+=0x1;_0xd89eea[_0xc37d('0xe6')]=0xc;_0xd89eea['statedesc']=_0xccc11c[_0xc37d('0x1a5')];_0x3ed309[_0xc37d('0xca')](_0xd89eea)[_0xc37d('0xb2')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x3ed309[_0xc37d('0x195')](_0xccc11c[_0xc37d('0x1a5')],_0x43c5e6,_0x15cf0f)){if(_0xd89eea['countbusyretry']+_0xd89eea[_0xc37d('0xf3')]+_0xd89eea['countnoanswerretry']+_0xd89eea['countnosuchnumberretry']+_0xd89eea[_0xc37d('0xf6')]+_0xd89eea[_0xc37d('0xf7')]+_0xd89eea['countmachineretry']+_0xd89eea[_0xc37d('0xf9')]>=_0x15cf0f['dialGlobalMaxRetry']){_0x3ed309['stateGlobal'](_0xd89eea,_0x3511a4,_0x283566,_0xccc11c[_0xc37d('0x1a5')]);}else{_0x3ed309[_0xc37d('0xfd')](_0xd89eea,_0x3511a4,_0x283566,_0xccc11c['reason']);}}}});};Dialer[_0xc37d('0x1b')][_0xc37d('0xfb')]=function(_0x5e846e,_0x32971c,_0x1f0bda,_0x3ae340){var _0x1c5fb5=new Final(_0x5e846e);_0x1c5fb5['state']=0xf;_0x1c5fb5[_0xc37d('0xa8')]='Global';this[_0xc37d('0xfd')](_0x1c5fb5,_0x32971c,_0x1f0bda,_0x3ae340);};Dialer[_0xc37d('0x1b')]['createStateFinal']=function(_0x42913f,_0x190360,_0x1afa38,_0x4c6bc7){this[_0xc37d('0xc9')](_0x42913f)[_0xc37d('0xbb')](function(){return _0x190360(msgResponse(_0xc37d('0x1a2'),_0xc37d('0xd7'),_0x4c6bc7));})[_0xc37d('0xb2')](function(){return _0x1afa38(msgResponse('[moveContactManagedDialer][0]',_0xc37d('0x146'),_0xc37d('0x1bf')));});};Dialer[_0xc37d('0x1b')]['predictive']=function(_0x107aaa){var _0x158f7b=_0x107aaa['dialPredictiveOptimizationPercentage']/0x64;var _0x42f446=_0x107aaa['outboundDropCallsDayTimeout']/(_0x107aaa[_0xc37d('0x118')]+_0x107aaa[_0xc37d('0xe4')]);var _0x337bc6=Math[_0xc37d('0x1c0')](_0x107aaa[_0xc37d('0x69')]*(_0x107aaa[_0xc37d('0x1c1')]/0x64));var _0x5a37bf=Math[_0xc37d('0x1c0')](_0x107aaa[_0xc37d('0x69')]*(_0x107aaa['predictiveIntervalMinThreshold']/0x64));var _0x2c587e=_0x107aaa['available']+_0x107aaa[_0xc37d('0x50')];var _0x508c68=Math[_0xc37d('0x1c2')](_0x107aaa[_0xc37d('0x6c')]*_0x107aaa[_0xc37d('0x6e')]*_0x107aaa['predictiveIntervalHitRate']*_0x107aaa['predictiveIntervalMultiplicativeFactor']);if(_[_0xc37d('0x3b')](_0x107aaa[_0xc37d('0x70')])){if(!_[_0xc37d('0x3b')](_0x107aaa[_0xc37d('0x26')])){_0x107aaa[_0xc37d('0x26')]=undefined;loggerPredictive[_0xc37d('0x94')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xc37d('0x3b')](_0x107aaa[_0xc37d('0x8e')])){loggerPredictive[_0xc37d('0x94')](_0xc37d('0x1c3'),_0xc37d('0x1c4'));clearInterval(_0x107aaa[_0xc37d('0x8e')]);_0x107aaa[_0xc37d('0x8e')]=undefined;}_0x107aaa[_0xc37d('0x70')]=moment()[_0xc37d('0x91')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x107aaa[_0xc37d('0x3c')],_0xc37d('0x1c5'),_0x107aaa[_0xc37d('0x70')]);this[_0xc37d('0x15b')](_0x107aaa,0x1);}else if(ifInterval(_0x107aaa['dialPredictiveInterval'],_0x107aaa[_0xc37d('0x70')])){this[_0xc37d('0x15b')](_0x107aaa,0x1);loggerPredictiveCalls[_0xc37d('0x79')](_0xc37d('0x1c6'),_0x107aaa[_0xc37d('0x70')],_0x107aaa[_0xc37d('0x3c')]);_0x107aaa[_0xc37d('0x6c')]=0x0;_0x107aaa[_0xc37d('0x65')]=0x0;}else if(_0x158f7b<_0x42f446&&_0x107aaa['dialPredictiveOptimization']===_0xc37d('0x1c7')){freeVariablesPredictive(_0x107aaa);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x1c8'),_0xc37d('0x1c9'),_0x42f446,_0xc37d('0x70'),_0x107aaa['name']);}else if(_0x508c68<_0x107aaa[_0xc37d('0x65')]&&_0x107aaa[_0xc37d('0x1ca')]===_0xc37d('0x1c7')){freeVariablesPredictive(_0x107aaa);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x1cb'),_0xc37d('0x1cc'),_0x508c68,_0xc37d('0x1cd'),_0x107aaa[_0xc37d('0x65')],'startProgressive',_0x107aaa[_0xc37d('0x3c')]);}else if(!ifInterval(_0x107aaa['dialPredictiveInterval'],_0x107aaa['startProgressive'])&&_[_0xc37d('0x3b')](_0x107aaa['startPredictive'])&&!_[_0xc37d('0x3b')](_0x107aaa[_0xc37d('0x70')])){_0x107aaa[_0xc37d('0x26')]=moment()[_0xc37d('0x91')](_0xc37d('0x106'));loggerPredictive['info'](_0x107aaa['name'],_0xc37d('0x1ce'),_0x107aaa[_0xc37d('0x26')]);this[_0xc37d('0xbd')](_0x107aaa[_0xc37d('0x1cf')])[_0xc37d('0xbb')](this[_0xc37d('0x1d0')](_0x107aaa))[_0xc37d('0xbb')](mergeDataErlangB(_0x107aaa))[_0xc37d('0xbb')](this[_0xc37d('0x1d1')](_0x107aaa))[_0xc37d('0xb2')](loggerCatchPredictive(_0xc37d('0x1d2'),_0x107aaa));}else if(!ifInterval(_0x107aaa[_0xc37d('0x1cf')],_0x107aaa[_0xc37d('0x26')])){_0x107aaa['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x107aaa['startPredictive']=moment()[_0xc37d('0x91')](_0xc37d('0x106'));loggerPredictive[_0xc37d('0x79')](_0x107aaa['name'],_0xc37d('0x1d3'),_0x107aaa['startPredictive']);clearInterval(_0x107aaa[_0xc37d('0x8e')]);_0x107aaa[_0xc37d('0x8e')]=undefined;this[_0xc37d('0xbd')](_0x107aaa[_0xc37d('0x1cf')])[_0xc37d('0xbb')](this['getDataPredictive'](_0x107aaa))[_0xc37d('0xbb')](mergeDataErlangB(_0x107aaa))[_0xc37d('0xbb')](this['startMethodPredictive'](_0x107aaa))[_0xc37d('0xb2')](loggerCatchPredictive(_0xc37d('0x1d4'),_0x107aaa));}else if(_0x107aaa[_0xc37d('0x69')]&&_0x2c587e<_0x107aaa[_0xc37d('0x69')]-_0x5a37bf){freeVariablesPredictive(_0x107aaa);loggerPredictive[_0xc37d('0x79')](_0x107aaa[_0xc37d('0x3c')],_0xc37d('0x1d5'),_0x2c587e,_0xc37d('0x1d6'),_0x107aaa[_0xc37d('0x69')],'-',_0x5a37bf,'=',_0x107aaa['predictiveIntervalAvailable']-_0x5a37bf,')');}else if(_0x107aaa[_0xc37d('0x69')]&&_0x2c587e>_0x107aaa[_0xc37d('0x69')]+_0x337bc6){freeVariablesPredictive(_0x107aaa);loggerPredictive['info'](_0x107aaa[_0xc37d('0x3c')],_0xc37d('0x1d5'),_0x2c587e,_0xc37d('0x1d7'),_0x107aaa[_0xc37d('0x69')],'+',_0x337bc6,'=',_0x107aaa[_0xc37d('0x69')]+_0x337bc6,')');}};Dialer['prototype']['getDataPredictive']=function(_0x18f4ad){var _0x131b5d=this;return function(_0x340639){return new BPromise(function(_0x5ca4a7,_0x496d81){_['merge'](_0x18f4ad,_0x340639[0x0]);if(checkGetDataPredictive(_0x340639[0x0])){var _0x1d8ee3=_0x18f4ad[_0xc37d('0x69')]=_0x18f4ad[_0xc37d('0x50')]+_0x18f4ad[_0xc37d('0xa2')];var _0x38dbe1=_0x18f4ad['dialPredictiveInterval']*0x3c;var _0x283273=_0x340639[0x0][_0xc37d('0x81')]+_0x340639[0x0][_0xc37d('0x62')];var _0x351331=(_0x340639[0x0]['predictiveIntervalAnsweredCalls']+_0x340639[0x0][_0xc37d('0x63')]+_0x340639[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x340639[0x0][_0xc37d('0x6a')];_0x18f4ad[_0xc37d('0x66')]=_0x351331>0x0?_0x351331:0x1;switch(_0x18f4ad['dialPredictiveOptimization']){case _0xc37d('0x1c7'):var _0x52e75a=_0x18f4ad[_0xc37d('0x1d8')]/0x64;return _0x131b5d['abandonmentRate'](_0x1d8ee3,_0x38dbe1,_0x283273,_0x351331,_0x52e75a)['then'](function(_0x11daa9){return _0x5ca4a7(_0x11daa9);});case _0xc37d('0x1d9'):var _0x29645c=_0x18f4ad[_0xc37d('0x1d8')]/0x64;return _0x131b5d[_0xc37d('0x1da')](_0x1d8ee3,_0x38dbe1,_0x283273,_0x351331,_0x29645c)[_0xc37d('0xbb')](function(_0x5e2288){return _0x5ca4a7(_0x5e2288);});default:return _0x496d81(msgResponse(_0xc37d('0x1db'),_0xc37d('0x146'),_0xc37d('0x1dc')));}}else{return _0x496d81(msgResponse(_0xc37d('0x1db'),_0xc37d('0x146'),'check\x20failure'));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x90f8a7){var _0x1bd037=this;return function(_0x36b20c){return new BPromise(function(_0x4230df,_0x52a88c){_[_0xc37d('0x8c')](_0x90f8a7,_0x36b20c[0x0]);if(checkGetDataPredictive(_0x36b20c[0x0])){loggerPredictive[_0xc37d('0x79')](JSON['stringify'](_0x36b20c[0x0]));if(_0x90f8a7[_0xc37d('0x1ca')]===_0xc37d('0x1c7')){return _0x1bd037['getVoiceQueueRtPauses'](_0x90f8a7['id'])[_0xc37d('0xbb')](function(_0x3ea882){var _0x39252f=_0x90f8a7[_0xc37d('0x4d')]-_0x3ea882[0x0][_0xc37d('0x1dd')];var _0x1d44b0=_0x90f8a7[_0xc37d('0x1cf')]*0x3c;var _0x502849=_0x36b20c[0x0][_0xc37d('0x81')]+_0x36b20c[0x0][_0xc37d('0x62')];var _0x2ea12f=(_0x36b20c[0x0]['predictiveIntervalAnsweredCalls']+_0x36b20c[0x0][_0xc37d('0x63')]+_0x36b20c[0x0][_0xc37d('0x7e')])/_0x36b20c[0x0][_0xc37d('0x6a')];var _0x24a4ba=_0x90f8a7['dialPredictiveOptimizationPercentage']/0x64;_0x90f8a7[_0xc37d('0x68')]=_0x3ea882[0x0][_0xc37d('0x1dd')]||0x0;_0x90f8a7['predictiveIntervalHitRate']=_0x2ea12f>0x0?_0x2ea12f:0x1;return _0x1bd037[_0xc37d('0x1de')](_0x39252f,_0x1d44b0,_0x502849,_0x2ea12f,_0x24a4ba);})[_0xc37d('0xbb')](function(_0x9e4bf2){return _0x4230df(_0x9e4bf2);})[_0xc37d('0xb2')](function(_0x4297e3){return _0x52a88c(msgResponse(_0xc37d('0x1df'),_0xc37d('0x146'),JSON[_0xc37d('0x46')](_0x4297e3)));});}if(_0x90f8a7[_0xc37d('0x1ca')]===_0xc37d('0x1d9')){return _0x1bd037[_0xc37d('0xc8')](_0x90f8a7['id'])[_0xc37d('0xbb')](function(_0x288d57){var _0x181a9e=_0x90f8a7[_0xc37d('0x4d')]-_0x288d57[0x0][_0xc37d('0x1dd')];var _0x5d49dd=_0x90f8a7[_0xc37d('0x1cf')]*0x3c;var _0xe563d6=_0x36b20c[0x0]['predictiveIntervalAvgTalktime']+_0x36b20c[0x0]['predictiveIntervalAvgHoldtime'];var _0x37ac60=(_0x36b20c[0x0]['predictiveIntervalAnsweredCalls']+_0x36b20c[0x0][_0xc37d('0x63')]+_0x36b20c[0x0][_0xc37d('0x7e')])/_0x36b20c[0x0][_0xc37d('0x6a')];var _0x3840a9=_0x90f8a7[_0xc37d('0x1d8')]/0x64;_0x90f8a7[_0xc37d('0x68')]=_0x288d57[0x0][_0xc37d('0x1dd')]||0x0;_0x90f8a7[_0xc37d('0x66')]=_0x37ac60>0x0?_0x37ac60:0x1;return _0x1bd037[_0xc37d('0x1da')](_0x181a9e,_0x5d49dd,_0xe563d6,_0x37ac60,_0x3840a9);})[_0xc37d('0xbb')](function(_0xcabf54){return _0x4230df(_0xcabf54);})[_0xc37d('0xb2')](function(_0x5e4df2){return _0x52a88c(msgResponse(_0xc37d('0x1df'),_0xc37d('0x146'),JSON[_0xc37d('0x46')](_0x5e4df2)));});}}else{return _0x52a88c(msgResponse(_0xc37d('0x1db'),'Failure','check\x20failure'));}});};};Dialer['prototype'][_0xc37d('0x1d1')]=function(_0xae940d){var _0x1e1bb2=this;return function(){var _0x5b3fe3=0x0;var _0x7b5ddb=Math[_0xc37d('0x1c2')](_0xae940d['erlangCallToSecond']*0x3e8);if(_0x7b5ddb>0x0){_0x7b5ddb=_0x7b5ddb<0x64?0x64:_0x7b5ddb;loggerPredictive['info'](_0xae940d[_0xc37d('0x3c')],_0xc37d('0x1e0'),_0x7b5ddb,'milliseconds');_0xae940d[_0xc37d('0x8e')]=setInterval(function(){_0x1e1bb2[_0xc37d('0x8e')](_0xae940d);loggerPredictiveCalls[_0xc37d('0x79')](_0xc37d('0x1e1'),_0x5b3fe3+=0x1);},_0x7b5ddb);}else{loggerPredictive[_0xc37d('0x79')](_0xae940d[_0xc37d('0x3c')],_0xc37d('0x1e2'));}};};Dialer[_0xc37d('0x1b')][_0xc37d('0x1e3')]=function(_0x2034e7,_0x4a4ca6){var _0x56e0ba=this;return function(_0x13724d){if(_[_0xc37d('0x45')](_0x13724d)){if(_[_0xc37d('0xaf')](_0x4a4ca6['UserId'])||!_0x4a4ca6['recallme']){if(_0x2034e7[_0xc37d('0x56')]==='booked'){_0x2034e7[_0xc37d('0x12f')]=_[_0xc37d('0x3b')](_0x2034e7[_0xc37d('0x12f')])?!![]:_0x2034e7[_0xc37d('0x12f')];var _0x313744=uuid['v4']();_0x56e0ba[_0xc37d('0x23')][_0x313744]=new Action(_0x2034e7,_0x4a4ca6,_0x313744);loggerBooked[_0xc37d('0x79')](_0xc37d('0x1e4'),_0x313744,_0xc37d('0x1e5'),JSON['stringify'](_0x2034e7[_0xc37d('0x12f')]),_0xc37d('0x1e6'),_0x2034e7[_0xc37d('0x3c')]);if(_0x2034e7[_0xc37d('0x12f')]){_0x2034e7['queueStatusComplete']=![];_0x56e0ba[_0xc37d('0x12b')][_0x56e0ba[_0xc37d('0x23')][_0x313744][_0xc37d('0xb5')]]=[];ami[_0xc37d('0x151')]({'actionid':_0x313744,'action':_0xc37d('0x1e7'),'queue':_0x2034e7['name']})['catch'](function(){_0x56e0ba[_0xc37d('0xb4')](_0x2034e7);_0x56e0ba[_0xc37d('0xbf')]({'active':![],'ContactId':_0x56e0ba[_0xc37d('0x23')][_0x313744][_0xc37d('0xd0')],'ListId':_0x56e0ba['actions'][_0x313744][_0xc37d('0xd1')],'VoiceQueueId':_0x56e0ba['actions'][_0x313744][_0xc37d('0xd3')]||undefined,'CampaignId':_0x56e0ba['actions'][_0x313744]['CampaignId']||undefined})[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x1e8')));delete _0x56e0ba[_0xc37d('0x23')][_0x313744];});}else{loggerBooked[_0xc37d('0x79')](_0xc37d('0x1e9'),JSON[_0xc37d('0x46')](_0x2034e7[_0xc37d('0x12f')]),_0xc37d('0x1e6'),_0x2034e7['name']);_0x56e0ba[_0xc37d('0xb4')](_0x2034e7);_0x56e0ba['rescheduleContact']({'active':![],'ContactId':_0x56e0ba[_0xc37d('0x23')][_0x313744][_0xc37d('0xd0')],'ListId':_0x56e0ba['actions'][_0x313744][_0xc37d('0xd1')],'VoiceQueueId':_0x56e0ba['actions'][_0x313744]['VoiceQueueId']||undefined,'CampaignId':_0x56e0ba['actions'][_0x313744][_0xc37d('0xd4')]||undefined})[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x1e8')));delete _0x56e0ba[_0xc37d('0x23')][_0x313744];}}else{return _0x56e0ba[_0xc37d('0x1ea')](_0x2034e7,_0x4a4ca6);}}else{if(getDiff(_0x4a4ca6[_0xc37d('0x1eb')])<_0x2034e7[_0xc37d('0x1ec')]*0x3c){if(_0x4a4ca6[_0xc37d('0x1ed')]&&!_0x4a4ca6[_0xc37d('0x1ed')]['voicePause']){_0x56e0ba[_0xc37d('0x1e')]['run'](_0x4a4ca6['id'])[_0xc37d('0x134')](function(){_0x56e0ba[_0xc37d('0xb4')](_0x2034e7);});}else{_0x56e0ba[_0xc37d('0xc1')]({'active':![]},_0x4a4ca6['id'],0x1)[_0xc37d('0x134')](function(){_0x56e0ba[_0xc37d('0xb4')](_0x2034e7);});}}else{_0x2034e7[_0xc37d('0x5f')]+=0x1;_0x56e0ba[_0xc37d('0xb4')](_0x2034e7);if(_0x2034e7[_0xc37d('0x1ee')]){_0x56e0ba[_0xc37d('0xbf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4a4ca6[_0xc37d('0xd0')],'ListId':_0x4a4ca6[_0xc37d('0xd1')],'VoiceQueueId':_0x4a4ca6[_0xc37d('0xd3')]||undefined,'CampaignId':_0x4a4ca6[_0xc37d('0xd4')]||undefined})[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x1ef')));_0x56e0ba['createHistory'](createObjHistory(_0x2034e7,_0x4a4ca6,'RECALLINQUEUE',0x17,_0xc37d('0x1f0')))['catch'](loggerCatch(_0xc37d('0x1f1')));}else{_0x56e0ba[_0xc37d('0xdc')](createObjHistory(_0x2034e7,_0x4a4ca6,_0xc37d('0x1f2'),0x16,_0xc37d('0x1f3')),_0xc37d('0x1f4'),_0xc37d('0x1f5'));}}}}else{_0x2034e7[_0xc37d('0x5a')]+=0x1;_0x56e0ba[_0xc37d('0xdc')](createObjHistory(_0x2034e7,_0x4a4ca6,'BLACKLIST',0xd,_0xc37d('0x1f6')),_0xc37d('0x1f7'),_0xc37d('0x1f8'));throw _0xc37d('0x1f9');}};};Dialer['prototype'][_0xc37d('0x15f')]=function(_0x15f9ca){var _0x1dd8b5=this;var _0x3c7392=_0x15f9ca[_0xc37d('0x1fa')]-_0x15f9ca[_0xc37d('0x6b')]-_0x15f9ca['temp'];emitCampaignSummary(_0x15f9ca);if(_0x3c7392>0x0){if(_0x3c7392>this['maxNumberOriginate']){_0x3c7392=this[_0xc37d('0x1fb')];}_0x15f9ca[_0xc37d('0xc4')]+=_0x3c7392;this[_0xc37d('0xc6')](_0x15f9ca['id'],_0x3c7392,_0x15f9ca['dialOrderByScheduledAt'],_0x15f9ca)['then'](function(_0xe884c7){_0x15f9ca[_0xc37d('0xc4')]-=_0x3c7392;_0x15f9ca['temp']=_0x15f9ca[_0xc37d('0xc4')]>0x0?_0x15f9ca[_0xc37d('0xc4')]:0x0;if(!checkContactEmpty(_0xe884c7)){_0x15f9ca[_0xc37d('0x3e')]=_0xc37d('0x9e');logger[_0xc37d('0x79')](_0xc37d('0x1fc')+_0x15f9ca[_0xc37d('0x3c')]);}else{_0x15f9ca[_0xc37d('0x6b')]+=_0xe884c7[_0xc37d('0x97')];_0x15f9ca['message']='RUNNING';for(var _0x24e1b5=0x0;_0x24e1b5<_0xe884c7['length'];_0x24e1b5+=0x1){_0x15f9ca[_0xc37d('0x1fd')]+=0x1;if(_[_0xc37d('0xaf')](_0xe884c7[_0x24e1b5])||_[_0xc37d('0xaf')](_0xe884c7[_0x24e1b5][_0xc37d('0x16b')])||_['isNil'](_0xe884c7[_0x24e1b5][_0xc37d('0x16b')][_0xc37d('0x16c')])){_0x1dd8b5[_0xc37d('0x1fe')](_0xc37d('0x1ff'),_0x15f9ca,_0xe884c7[_0x24e1b5]);}else{_0x1dd8b5[_0xc37d('0xbc')](_['pick'](_0xe884c7[_0x24e1b5],[_0xc37d('0xd4'),'Contact.phone']))['then'](_0x1dd8b5[_0xc37d('0x1e3')](_0x15f9ca,_0xe884c7[_0x24e1b5]))[_0xc37d('0xb2')](_0x1dd8b5[_0xc37d('0xce')](_0xc37d('0x200'),_0x15f9ca));}}}})['catch'](loggerGetContactDialer(_0xc37d('0x201'),_0x15f9ca,_0x3c7392));}};Dialer[_0xc37d('0x1b')][_0xc37d('0x15b')]=function(_0x1bfd8b,_0x18784d){var _0x107e55=this;var _0x9200fa=[];var _0x4da5e6=_0x18784d>=0x1?_0x18784d:0x1;if(_0x1bfd8b['dialMethod']===_0xc37d('0x6')){_0x4da5e6=0x1;}var _0x573999=Math['floor'](_0x1bfd8b['available']*_0x4da5e6)-_0x1bfd8b[_0xc37d('0x6b')]-_0x1bfd8b[_0xc37d('0xc4')];emitVoiceQueueSummary(_0x1bfd8b);if(_0x1bfd8b[_0xc37d('0x202')]>0x0){var _0xfae462=_0x1bfd8b[_0xc37d('0x202')]-_0x1bfd8b[_0xc37d('0x6b')]-_0x1bfd8b[_0xc37d('0x50')]-_0x1bfd8b[_0xc37d('0xc4')]-_0x1bfd8b[_0xc37d('0xa0')];if(_0x573999>_0xfae462){_0x573999=_0xfae462;}}if(_0x573999>0x0){if(_0x1bfd8b[_0xc37d('0x56')]==='booked'){_0x573999=0x1;}if(_0x573999>this['maxNumberOriginate']){_0x573999=this[_0xc37d('0x1fb')];}_0x1bfd8b[_0xc37d('0xc4')]+=_0x573999;for(var _0xb815e2 in this[_0xc37d('0x20')]){if(typeof this[_0xc37d('0x20')][_0xb815e2]!==_0xc37d('0x98')){if(this['agents'][_0xb815e2][_0xc37d('0xe6')]===_0xc37d('0x203')&&this[_0xc37d('0x20')][_0xb815e2][_0xc37d('0xb0')]===_0xc37d('0xda')){_0x9200fa[_0xc37d('0x12c')](this[_0xc37d('0x20')][_0xb815e2]['id']);}}}this['getContactDialer'](_0x1bfd8b['id'],_0x9200fa,_0x573999,_0x1bfd8b['dialOrderByScheduledAt'],_0x1bfd8b)[_0xc37d('0xbb')](function(_0x418d51){_0x1bfd8b[_0xc37d('0xc4')]-=_0x573999;_0x1bfd8b[_0xc37d('0xc4')]=_0x1bfd8b['temp']>0x0?_0x1bfd8b[_0xc37d('0xc4')]:0x0;if(!checkContactEmpty(_0x418d51)){_0x107e55['countReScheduled'](_0x1bfd8b)[_0xc37d('0xbb')](sendMessageReschedule(_0x1bfd8b))[_0xc37d('0xb2')](loggerCatch(_0xc37d('0x204')));}else{_0x1bfd8b['originated']+=_0x418d51[_0xc37d('0x97')];_0x1bfd8b[_0xc37d('0x3e')]=_0x1bfd8b['dialMethod']===_0xc37d('0x6')?_0xc37d('0x205'):'RUNNING';for(var _0x3baeba=0x0;_0x3baeba<_0x418d51[_0xc37d('0x97')];_0x3baeba+=0x1){if(_[_0xc37d('0xaf')](_0x418d51[_0x3baeba])||_[_0xc37d('0xaf')](_0x418d51[_0x3baeba][_0xc37d('0x16b')])||_['isNil'](_0x418d51[_0x3baeba][_0xc37d('0x16b')][_0xc37d('0x16c')])){_0x107e55['emptyContact'](_0xc37d('0x1ff'),_0x1bfd8b,_0x418d51[_0x3baeba]);}else{_0x107e55[_0xc37d('0xba')](_[_0xc37d('0x12d')](_0x418d51[_0x3baeba],[_0xc37d('0xd3'),_0xc37d('0x206')]))[_0xc37d('0xbb')](_0x107e55[_0xc37d('0x1e3')](_0x1bfd8b,_0x418d51[_0x3baeba]))[_0xc37d('0xb2')](_0x107e55[_0xc37d('0xce')](_0xc37d('0x1ff'),_0x1bfd8b));}}}})[_0xc37d('0xb2')](loggerGetContactDialer(_0xc37d('0x207'),_0x1bfd8b,_0x573999));}};Dialer['prototype']['handlePredictive']=function(_0x12ab2f){if(_0x12ab2f[_0xc37d('0x202')]>0x0){var _0x478aa0=_0x12ab2f['dialLimitQueue']-_0x12ab2f[_0xc37d('0x6b')]-_0x12ab2f['talking'];if(_0x478aa0>0x0){this[_0xc37d('0x208')](_0x12ab2f);}else{loggerPredictiveCalls['info'](_0xc37d('0x209'));}}else{this[_0xc37d('0x208')](_0x12ab2f);}};Dialer[_0xc37d('0x1b')][_0xc37d('0x208')]=function(_0x34c575){var _0x3f3a9a=this;var _0x5a5fd4=[];_0x34c575[_0xc37d('0x6b')]+=0x1;for(var _0x460c2c in this[_0xc37d('0x20')]){if(typeof this[_0xc37d('0x20')][_0x460c2c]!==_0xc37d('0x98')){if(this[_0xc37d('0x20')][_0x460c2c]['state']===_0xc37d('0x203')&&this['agents'][_0x460c2c]['status']===_0xc37d('0xda')){_0x5a5fd4[_0xc37d('0x12c')](this['agents'][_0x460c2c]['id']);}}}this[_0xc37d('0xc3')](_0x34c575['id'],_0x5a5fd4,0x1,_0x34c575[_0xc37d('0x20a')],_0x34c575)[_0xc37d('0xbb')](function(_0x2f54ee){if(!checkContactEmpty(_0x2f54ee)){checkContactLowerLimitOriginate(_0x34c575,0x1,0x0);_0x3f3a9a[_0xc37d('0xb8')](_0x34c575)[_0xc37d('0xbb')](sendMessageReschedule(_0x34c575))[_0xc37d('0xb2')](loggerCatch('[countReScheduled]\x20'));}else{_0x34c575[_0xc37d('0x3e')]='RUNNING';if(_['isNil'](_0x2f54ee[0x0])||_['isNil'](_0x2f54ee[0x0][_0xc37d('0x16b')])||_[_0xc37d('0xaf')](_0x2f54ee[0x0][_0xc37d('0x16b')][_0xc37d('0x16c')])){_0x3f3a9a['emptyContact']('[actionOriginate]\x20',_0x34c575,_0x2f54ee[0x0]);}else{_0x3f3a9a[_0xc37d('0xba')](_[_0xc37d('0x12d')](_0x2f54ee[0x0],[_0xc37d('0xd3'),_0xc37d('0x206')]))['then'](_0x3f3a9a['checkContactBlack'](_0x34c575,_0x2f54ee[0x0]))[_0xc37d('0xb2')](_0x3f3a9a[_0xc37d('0xce')]('[actionOriginatePredictive]\x20',_0x34c575));}}})[_0xc37d('0xb2')](loggerGetContactDialer('[getContactDialerPredictive]',_0x34c575,0x1));emitVoiceQueueSummary(_0x34c575);};Dialer[_0xc37d('0x1b')][_0xc37d('0x1de')]=function(_0x3fe12c,_0x1e3148,_0x529a02,_0x34ebac,_0x23372b,_0x24113f){loggerPredictive[_0xc37d('0x79')](_0xc37d('0x20b'));loggerPredictive[_0xc37d('0x79')](_0xc37d('0x20c'),_0x3fe12c);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x20d'),_0x1e3148);loggerPredictive[_0xc37d('0x79')]('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',_0x529a02);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x20e'),_0x34ebac);loggerPredictive['info'](_0xc37d('0x20f'),_0x23372b);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x82'));return new BPromise(function(_0x501869,_0x441a08){if(_0x3fe12c<=0x0||isNaN(_0x3fe12c)){return _0x441a08(msgResponse(_0xc37d('0x210'),_0xc37d('0x190'),_0xc37d('0x211')+_0x3fe12c));}if(_0x529a02<=0x0||isNaN(_0x529a02)){return _0x441a08(msgResponse(_0xc37d('0x210'),_0xc37d('0x190'),_0xc37d('0x212')+_0x529a02));}if(_0x34ebac<=0x0||isNaN(_0x34ebac)){return _0x441a08(msgResponse('[abandonmentRate]',_0xc37d('0x190'),'p\x20=\x20'+_0x34ebac));}if(_0x1e3148<=0x0||isNaN(_0x1e3148)){return _0x441a08(msgResponse('[abandonmentRate]',_0xc37d('0x190'),_0xc37d('0x213')+_0x1e3148));}if(_0x23372b<=0x0||isNaN(_0x23372b)){return _0x441a08(msgResponse('[abandonmentRate]',_0xc37d('0x190'),_0xc37d('0x214')+_0x23372b));}_0x24113f=_0x24113f||0x0;var _0x255160=0x1/_0x529a02;var _0x22c7e3=0x0;var _0x345c88=0x0;var _0x2156e3=0x0;var _0x56e7ca=0x0;for(var _0x1466ce=0x0;_0x2156e3<_0x23372b;_0x1466ce+=0x1){_0x345c88=_0x1466ce/_0x1e3148;_0x22c7e3=(_0x34ebac*_0x345c88+_0x24113f)/_0x255160;_0x2156e3=erlangb(_0x22c7e3,_0x3fe12c);_0x56e7ca=_0x22c7e3/_0x3fe12c*(0x1-erlangb(_0x22c7e3,_0x3fe12c));}return _0x501869({'erlangCalls':_0x1466ce,'erlangCallToSecond':_0x1e3148/_0x1466ce,'erlangAbandonmentRate':_0x2156e3,'erlangBusyFactor':_0x56e7ca});});};Dialer[_0xc37d('0x1b')][_0xc37d('0x1da')]=function(_0x229ff,_0x221e04,_0x2c05cd,_0xf1c9cb,_0x36f365,_0x2b9662){loggerPredictive[_0xc37d('0x79')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xc37d('0x79')](_0xc37d('0x20c'),_0x229ff);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x20d'),_0x221e04);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x215'),_0x2c05cd);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x20e'),_0xf1c9cb);loggerPredictive['info'](_0xc37d('0x216'),_0x36f365);loggerPredictive[_0xc37d('0x79')](_0xc37d('0x82'));return new BPromise(function(_0x41fc55,_0xec4d10){if(_0x229ff<=0x0||isNaN(_0x229ff)){return _0xec4d10(msgResponse(_0xc37d('0x217'),'Error',_0xc37d('0x211')+_0x229ff));}if(_0x2c05cd<=0x0||isNaN(_0x2c05cd)){return _0xec4d10(msgResponse(_0xc37d('0x217'),_0xc37d('0x190'),_0xc37d('0x212')+_0x2c05cd));}if(_0xf1c9cb<=0x0||isNaN(_0xf1c9cb)){return _0xec4d10(msgResponse(_0xc37d('0x217'),_0xc37d('0x190'),'p\x20=\x20'+_0xf1c9cb));}if(_0x221e04<=0x0||isNaN(_0x221e04)){return _0xec4d10(msgResponse('[busyFactor]',_0xc37d('0x190'),_0xc37d('0x213')+_0x221e04));}if(_0x36f365<=0x0||isNaN(_0x36f365)){return _0xec4d10(msgResponse(_0xc37d('0x217'),'Error',_0xc37d('0x218')+_0x36f365));}_0x2b9662=_0x2b9662||0x0;var _0x1bbb28=0x1/_0x2c05cd;var _0x44b40e=0x0;var _0x4ec9c6=0x0;var _0x5cf3da=0x0;var _0x1a3205=0x0;for(var _0x5d7e16=0x0;_0x1a3205<_0x36f365;_0x5d7e16+=0x1){_0x4ec9c6=_0x5d7e16/_0x221e04;_0x44b40e=(_0xf1c9cb*_0x4ec9c6+_0x2b9662)/_0x1bbb28;_0x5cf3da=erlangb(_0x44b40e,_0x229ff);_0x1a3205=_0x44b40e/_0x229ff*(0x1-erlangb(_0x44b40e,_0x229ff));}return _0x41fc55({'erlangCalls':_0x5d7e16,'erlangCallToSecond':_0x221e04/_0x5d7e16,'erlangAbandonmentRate':_0x5cf3da,'erlangBusyFactor':_0x1a3205});});};module[_0xc37d('0x219')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 30cc11d..15a416a 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 _0x4974=['calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x4974,0x114));var _0x4497=function(_0x8739f5,_0x55a924){_0x8739f5=_0x8739f5-0x0;var _0x403a42=_0x4974[_0x8739f5];return _0x403a42;};'use strict';var util=require(_0x4497('0x0'));var _=require(_0x4497('0x1'));var moment=require('moment');function getSeconds(_0x503c4b,_0x69ce10){var _0x175e52=moment(_0x503c4b)[_0x4497('0x2')](0x0);var _0x3c80b3=moment(_0x69ce10)[_0x4497('0x2')](0x0);return _0x175e52[_0x4497('0x3')](_0x3c80b3,'seconds');}function QueueCallerAbandon(_0x437bed,_0x64e9fa){this[_0x4497('0x4')]=_0x437bed[_0x4497('0x4')];this[_0x4497('0x5')]=_0x437bed[_0x4497('0x5')];this[_0x4497('0x6')]=_0x437bed[_0x4497('0x5')]===_0x4497('0x7')?_0x4497('0x8'):_0x437bed[_0x4497('0x5')];this['countbusyretry']=_0x437bed['countbusyretry'];this['countcongestionretry']=_0x437bed[_0x4497('0x9')];this[_0x4497('0xa')]=_0x437bed[_0x4497('0xa')];this[_0x4497('0xb')]=_0x437bed[_0x4497('0xc')]+_0x437bed[_0x4497('0x9')]+_0x437bed['countnoanswerretry']+_0x437bed['countnosuchnumberretry']+_0x437bed[_0x4497('0xd')]+_0x437bed['countabandonedretry']+_0x437bed[_0x4497('0xe')]+_0x437bed[_0x4497('0xf')];this['countnosuchnumberretry']=_0x437bed['countnosuchnumberretry'];this['countdropretry']=_0x437bed[_0x4497('0xd')];this[_0x4497('0x10')]=_0x437bed['countabandonedretry'];this['countmachineretry']=_0x437bed['countmachineretry'];this[_0x4497('0xf')]=_0x437bed[_0x4497('0xf')];this[_0x4497('0x11')]=_0x64e9fa[_0x4497('0x11')];this[_0x4497('0x12')]=_0x437bed[_0x4497('0x13')];this[_0x4497('0x14')]=_0x437bed[_0x4497('0x15')];this[_0x4497('0x16')]=_0x437bed[_0x4497('0x16')];this['responsetime']=_0x437bed[_0x4497('0x17')];this['droptime']=_0x437bed[_0x4497('0x18')];this[_0x4497('0x19')]=this[_0x4497('0x18')];this[_0x4497('0x1a')]=getSeconds(_0x437bed[_0x4497('0x17')],_0x437bed[_0x4497('0x16')]);this[_0x4497('0x1b')]=getSeconds(this[_0x4497('0x18')],_0x437bed[_0x4497('0x17')]);this[_0x4497('0x1c')]=0x0;this[_0x4497('0x8')]=_0x64e9fa[_0x4497('0x8')];this['membername']=_0x64e9fa[_0x4497('0x1d')];this[_0x4497('0x1e')]=_0x64e9fa[_0x4497('0x1e')];this[_0x4497('0x1f')]=_0x437bed[_0x4497('0x1f')];this[_0x4497('0x20')]=_0x437bed[_0x4497('0x20')];this[_0x4497('0x21')]=_0x437bed[_0x4497('0x21')];this[_0x4497('0x22')]=_0x437bed[_0x4497('0x22')];this['ContactId']=_0x437bed['ContactId'];this[_0x4497('0x23')]=_0x437bed[_0x4497('0x23')];this[_0x4497('0x24')]=_0x437bed[_0x4497('0x24')];this[_0x4497('0x25')]=_0x437bed[_0x4497('0x25')];this[_0x4497('0x26')]=_0x437bed[_0x4497('0x26')];this[_0x4497('0x27')]=_0x437bed[_0x4497('0x27')]||'';this[_0x4497('0x28')]=_0x437bed[_0x4497('0x28')]||'';}module[_0x4497('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x8daf=['diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8daf,0xf9));var _0xf8da=function(_0x3e2040,_0x660381){_0x3e2040=_0x3e2040-0x0;var _0x38e3ec=_0x8daf[_0x3e2040];return _0x38e3ec;};'use strict';var util=require(_0xf8da('0x0'));var _=require(_0xf8da('0x1'));var moment=require('moment');function getSeconds(_0x3d300b,_0x177e35){var _0x522cd6=moment(_0x3d300b)[_0xf8da('0x2')](0x0);var _0x2ea645=moment(_0x177e35)[_0xf8da('0x2')](0x0);return _0x522cd6[_0xf8da('0x3')](_0x2ea645,_0xf8da('0x4'));}function QueueCallerAbandon(_0x4f5165,_0x1800b8){this[_0xf8da('0x5')]=_0x4f5165['scheduledat'];this['type']=_0x4f5165[_0xf8da('0x6')];this[_0xf8da('0x7')]=_0x4f5165[_0xf8da('0x6')]==='outbound'?_0xf8da('0x8'):_0x4f5165['type'];this[_0xf8da('0x9')]=_0x4f5165[_0xf8da('0x9')];this[_0xf8da('0xa')]=_0x4f5165[_0xf8da('0xa')];this['countnoanswerretry']=_0x4f5165[_0xf8da('0xb')];this[_0xf8da('0xc')]=_0x4f5165[_0xf8da('0x9')]+_0x4f5165[_0xf8da('0xa')]+_0x4f5165['countnoanswerretry']+_0x4f5165[_0xf8da('0xd')]+_0x4f5165[_0xf8da('0xe')]+_0x4f5165['countabandonedretry']+_0x4f5165['countmachineretry']+_0x4f5165[_0xf8da('0xf')];this[_0xf8da('0xd')]=_0x4f5165[_0xf8da('0xd')];this['countdropretry']=_0x4f5165['countdropretry'];this[_0xf8da('0x10')]=_0x4f5165[_0xf8da('0x10')];this['countmachineretry']=_0x4f5165[_0xf8da('0x11')];this['countagentrejectretry']=_0x4f5165[_0xf8da('0xf')];this[_0xf8da('0x12')]=_0x1800b8[_0xf8da('0x12')];this[_0xf8da('0x13')]=_0x4f5165['name'];this[_0xf8da('0x14')]=_0x4f5165[_0xf8da('0x15')];this[_0xf8da('0x16')]=_0x4f5165[_0xf8da('0x16')];this[_0xf8da('0x17')]=_0x4f5165[_0xf8da('0x17')];this['droptime']=_0x4f5165[_0xf8da('0x18')];this[_0xf8da('0x19')]=this[_0xf8da('0x18')];this['ringtime']=getSeconds(_0x4f5165[_0xf8da('0x17')],_0x4f5165['starttime']);this[_0xf8da('0x1a')]=getSeconds(this[_0xf8da('0x18')],_0x4f5165[_0xf8da('0x17')]);this['talktime']=0x0;this['queue']=_0x1800b8[_0xf8da('0x8')];this[_0xf8da('0x1b')]=_0x1800b8[_0xf8da('0x1c')];this[_0xf8da('0x1d')]=_0x1800b8[_0xf8da('0x1d')];this['callback']=_0x4f5165[_0xf8da('0x1e')];this[_0xf8da('0x1f')]=_0x4f5165[_0xf8da('0x1f')];this[_0xf8da('0x20')]=_0x4f5165[_0xf8da('0x20')];this[_0xf8da('0x21')]=_0x4f5165[_0xf8da('0x21')];this[_0xf8da('0x22')]=_0x4f5165[_0xf8da('0x22')];this[_0xf8da('0x23')]=_0x4f5165[_0xf8da('0x23')];this[_0xf8da('0x24')]=_0x4f5165[_0xf8da('0x24')];this['VoiceQueueId']=_0x4f5165[_0xf8da('0x25')];this[_0xf8da('0x26')]=_0x4f5165[_0xf8da('0x26')];this['originatecalleridnum']=_0x4f5165[_0xf8da('0x27')]||'';this[_0xf8da('0x28')]=_0x4f5165[_0xf8da('0x28')]||'';}module[_0xf8da('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 45c60b3..1529042 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(_0x54ef43,_0x308497){var _0x4e3816=function(_0x5147c6){while(--_0x5147c6){_0x54ef43['push'](_0x54ef43['shift']());}};_0x4e3816(++_0x308497);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x74e3e6,_0x51de4f){var _0xa34a1f=function(_0x3dfe18){while(--_0x3dfe18){_0x74e3e6['push'](_0x74e3e6['shift']());}};_0xa34a1f(++_0x51de4f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 4c63009..e81a77a 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 _0xac95=['moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','then','notify','.pdf','error','stringify','\x20receiveFax\x20','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','catch','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','FaxAccountId','Trunk','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','bluebird','uuid'];(function(_0x3afded,_0x10a4fc){var _0x1a0d58=function(_0x5add06){while(--_0x5add06){_0x3afded['push'](_0x3afded['shift']());}};_0x1a0d58(++_0x10a4fc);}(_0xac95,0x71));var _0x5ac9=function(_0x110f03,_0x2ebf2a){_0x110f03=_0x110f03-0x0;var _0x5cbd15=_0xac95[_0x110f03];return _0x5cbd15;};'use strict';var util=require(_0x5ac9('0x0'));var _=require('lodash');var BPromise=require(_0x5ac9('0x1'));var uuid=require(_0x5ac9('0x2'));var moment=require(_0x5ac9('0x3'));var path=require(_0x5ac9('0x4'));var tiff2pdf=require(_0x5ac9('0x5'));var gs=require(_0x5ac9('0x6'));var logger=require('../../../config/logger')(_0x5ac9('0x7'));var ami=require(_0x5ac9('0x8'));var rpcDb=require(_0x5ac9('0x9'));var Channel=require(_0x5ac9('0xa'));var ut=require(_0x5ac9('0xb'));var Action=require(_0x5ac9('0xc'));var faxAccount=require(_0x5ac9('0xd'));var attachment=require(_0x5ac9('0xe'));var faxMessage=require(_0x5ac9('0xf'));function Fax(_0x7317e6){this['channels']={};this[_0x5ac9('0x10')]=_0x7317e6[_0x5ac9('0x10')];this[_0x5ac9('0x11')]=_0x7317e6[_0x5ac9('0x11')];this[_0x5ac9('0x12')]={};ami['on'](_0x5ac9('0x13'),this[_0x5ac9('0x14')][_0x5ac9('0x15')](this));ami['on'](_0x5ac9('0x16'),this[_0x5ac9('0x17')]['bind'](this));ami['on'](_0x5ac9('0x18'),this[_0x5ac9('0x19')][_0x5ac9('0x15')](this));ami['on'](_0x5ac9('0x1a'),this['syncNewExten']['bind'](this));ami['on'](_0x5ac9('0x1b'),this[_0x5ac9('0x1c')]['bind'](this));ami['on'](_0x5ac9('0x1d'),this[_0x5ac9('0x1e')][_0x5ac9('0x15')](this));ami['on'](_0x5ac9('0x1f'),this[_0x5ac9('0x20')][_0x5ac9('0x15')](this));ami['on'](_0x5ac9('0x21'),this[_0x5ac9('0x22')][_0x5ac9('0x15')](this));}Fax[_0x5ac9('0x23')][_0x5ac9('0x14')]=function(_0x35cd19){if(_0x35cd19[_0x5ac9('0x24')]===_0x5ac9('0x25')){for(var _0x1efe54 in this['faxAccounts']){if(this[_0x5ac9('0x10')][_0x5ac9('0x26')](_0x1efe54)){if(_0x35cd19[_0x5ac9('0x27')]===this[_0x5ac9('0x10')][_0x1efe54][_0x5ac9('0x28')]){this[_0x5ac9('0x29')][_0x35cd19[_0x5ac9('0x2a')]]={};this['channels'][_0x35cd19[_0x5ac9('0x2a')]]['channel']=_0x35cd19[_0x5ac9('0x2b')];this[_0x5ac9('0x29')][_0x35cd19[_0x5ac9('0x2a')]]['id']=this[_0x5ac9('0x10')][_0x1efe54]['id'];this[_0x5ac9('0x29')][_0x35cd19[_0x5ac9('0x2a')]][_0x5ac9('0x2c')]=this[_0x5ac9('0x10')][_0x1efe54][_0x5ac9('0x2c')];logger[_0x5ac9('0x2d')](_0x35cd19['uniqueid'],_0x5ac9('0x2e'));}}}}if(this['actions'][_0x35cd19[_0x5ac9('0x2a')]]){this[_0x5ac9('0x29')][_0x35cd19[_0x5ac9('0x2a')]]={};this['channels'][_0x35cd19['uniqueid']][_0x5ac9('0x2b')]=_0x35cd19[_0x5ac9('0x2b')];logger[_0x5ac9('0x2d')](_0x35cd19[_0x5ac9('0x2a')],_0x5ac9('0x2e'));}};Fax[_0x5ac9('0x23')][_0x5ac9('0x17')]=function(_0x368f06){if(this[_0x5ac9('0x29')][_0x368f06[_0x5ac9('0x2a')]]){for(var _0x356a2a in _0x368f06['variable']){if(_0x368f06[_0x5ac9('0x2f')]['hasOwnProperty'](_0x356a2a)){this[_0x5ac9('0x29')][_0x368f06[_0x5ac9('0x2a')]][_0x356a2a]=_0x368f06[_0x5ac9('0x30')];}}}};Fax['prototype'][_0x5ac9('0x19')]=function(_0xf3328c){if(this['channels'][_0xf3328c[_0x5ac9('0x2a')]]){this[_0x5ac9('0x29')][_0xf3328c[_0x5ac9('0x2a')]]['channelstate']=_0xf3328c[_0x5ac9('0x31')];this[_0x5ac9('0x29')][_0xf3328c[_0x5ac9('0x2a')]][_0x5ac9('0x32')]=_0xf3328c[_0x5ac9('0x32')];}};Fax[_0x5ac9('0x23')][_0x5ac9('0x33')]=function(_0x14562e){if(this['channels'][_0x14562e['uniqueid']]){for(var _0xc18dbe in _0x14562e['variable']){if(_0x14562e[_0x5ac9('0x2f')][_0x5ac9('0x26')](_0xc18dbe)){this[_0x5ac9('0x29')][_0x14562e[_0x5ac9('0x2a')]][_0xc18dbe]=_0x14562e[_0x5ac9('0x30')];}}}};Fax[_0x5ac9('0x23')][_0x5ac9('0x1c')]=function(_0x571fd4){if(this[_0x5ac9('0x29')][_0x571fd4[_0x5ac9('0x2a')]]){this[_0x5ac9('0x29')][_0x571fd4['uniqueid']][_0x5ac9('0x34')]=_0x571fd4[_0x5ac9('0x34')];this[_0x5ac9('0x29')][_0x571fd4['uniqueid']][_0x5ac9('0x35')]=_0x571fd4[_0x5ac9('0x35')];this[_0x5ac9('0x29')][_0x571fd4[_0x5ac9('0x2a')]][_0x5ac9('0x28')]=_0x571fd4['localstationid'];this[_0x5ac9('0x29')][_0x571fd4['uniqueid']][_0x5ac9('0x36')]=_0x571fd4[_0x5ac9('0x36')];logger[_0x5ac9('0x2d')](_0x571fd4[_0x5ac9('0x2a')],_0x5ac9('0x37'));}};Fax[_0x5ac9('0x23')]['syncReceiveFax']=function(_0x38c4f6){var _0x3a4ee8=this;if(this['channels'][_0x38c4f6[_0x5ac9('0x2a')]]){var _0x7fe1b8=this[_0x5ac9('0x29')][_0x38c4f6[_0x5ac9('0x2a')]]['id'];this['channels'][_0x38c4f6[_0x5ac9('0x2a')]]['remotestationid']=_0x38c4f6[_0x5ac9('0x38')];this[_0x5ac9('0x29')][_0x38c4f6[_0x5ac9('0x2a')]]['pagestransferred']=_0x38c4f6['pagestransferred'];this['channels'][_0x38c4f6[_0x5ac9('0x2a')]][_0x5ac9('0x28')]=_0x38c4f6[_0x5ac9('0x28')];this[_0x5ac9('0x29')][_0x38c4f6[_0x5ac9('0x2a')]][_0x5ac9('0x39')]=_0x38c4f6['resolution'];this[_0x5ac9('0x29')][_0x38c4f6['uniqueid']][_0x5ac9('0x3a')]=_0x38c4f6[_0x5ac9('0x3a')];this[_0x5ac9('0x29')][_0x38c4f6[_0x5ac9('0x2a')]][_0x5ac9('0x36')]=_0x38c4f6['filename'];this[_0x5ac9('0x29')][_0x38c4f6[_0x5ac9('0x2a')]][_0x5ac9('0x3b')]=_0x38c4f6[_0x5ac9('0x3b')];if(this[_0x5ac9('0x29')][_0x38c4f6['uniqueid']][_0x5ac9('0x3c')]>0x0){tiff2pdf(_0x38c4f6['filename'],_0x5ac9('0x3d'),function(_0x1c239c){logger[_0x5ac9('0x2d')](_0x38c4f6[_0x5ac9('0x2a')],_0x5ac9('0x3e'),_0x1c239c[_0x5ac9('0x3f')]);attachment[_0x5ac9('0x40')]({'name':path['parse'](_0x38c4f6[_0x5ac9('0x36')])[_0x5ac9('0x2c')],'basename':path[_0x5ac9('0x41')](_0x38c4f6['filename'])[_0x5ac9('0x2c')]+'.pdf','type':'application/pdf'})[_0x5ac9('0x42')](function(_0x5bb94e){faxAccount[_0x5ac9('0x43')](_0x7fe1b8,{'from':_0x38c4f6[_0x5ac9('0x3b')],'mapKey':'fax','body':path[_0x5ac9('0x41')](_0x38c4f6['filename'])['name']+_0x5ac9('0x44'),'AttachmentId':_0x5bb94e['id']})['catch'](function(_0x1038bb){logger[_0x5ac9('0x45')](_0x38c4f6['uniqueid'],'\x20notify\x20',JSON[_0x5ac9('0x46')](_0x1038bb));});})['catch'](function(_0x25421d){logger[_0x5ac9('0x45')](_0x38c4f6[_0x5ac9('0x2a')],_0x5ac9('0x47'),JSON['stringify'](_0x25421d));});});}logger[_0x5ac9('0x2d')](_0x38c4f6[_0x5ac9('0x2a')],'\x20receiveFax\x20');}};Fax[_0x5ac9('0x23')][_0x5ac9('0x22')]=function(_0x2b4a29){if(this['actions'][_0x2b4a29['uniqueid']]){_['merge'](this['channels'][_0x2b4a29[_0x5ac9('0x2a')]],_['pick'](_0x2b4a29,[_0x5ac9('0x48'),_0x5ac9('0x49')]));}};function updateStatus(_0x50119a){if(_0x50119a[_0x5ac9('0x4a')]){faxMessage[_0x5ac9('0x4b')](_0x50119a[_0x5ac9('0x4a')],{'failMessage':_0x5ac9('0x4c')})[_0x5ac9('0x42')](function(_0x420ff1){ut['logger'](_0x5ac9('0x4d'),_0x420ff1);})['catch'](function(_0x1035bf){ut[_0x5ac9('0x4e')](_0x5ac9('0x4f'),_0x1035bf);});}else{ut['logger'](_0x5ac9('0x50'));}}Fax['prototype'][_0x5ac9('0x51')]=function(_0x513074,_0x513e73,_0x46e285){var _0x5d23ad=this;var _0x40dd77={};if(_0x513e73){_0x40dd77={'read':_0x513e73};}else{_0x40dd77={'failMessage':_0x46e285};}if(this[_0x5ac9('0x12')][_0x513074][_0x5ac9('0x4a')]){faxMessage[_0x5ac9('0x4b')](this[_0x5ac9('0x12')][_0x513074][_0x5ac9('0x4a')],_0x40dd77)[_0x5ac9('0x42')](function(_0x58e903){ut[_0x5ac9('0x4e')]('[Fax][Message][Updated]',_0x58e903);})[_0x5ac9('0x52')](function(_0x4b1d34){ut['logger'](_0x5ac9('0x53'),_0x4b1d34);})[_0x5ac9('0x54')](function(){delete _0x5d23ad[_0x5ac9('0x29')][_0x513074];delete _0x5d23ad[_0x5ac9('0x12')][_0x513074];});}else{ut[_0x5ac9('0x4e')](_0x5ac9('0x55'));delete this[_0x5ac9('0x29')][_0x513074];delete this[_0x5ac9('0x12')][_0x513074];}};Fax['prototype']['syncHangup']=function(_0x7f518d){var _0x46ab88=this;if(this['channels'][_0x7f518d['uniqueid']]){if(this['actions'][_0x7f518d[_0x5ac9('0x2a')]]){this['channels'][_0x7f518d[_0x5ac9('0x2a')]]['id']=this[_0x5ac9('0x12')][_0x7f518d[_0x5ac9('0x2a')]]['id'];this['channels'][_0x7f518d[_0x5ac9('0x2a')]][_0x5ac9('0x2c')]=this[_0x5ac9('0x12')][_0x7f518d['uniqueid']][_0x5ac9('0x2c')];}logger[_0x5ac9('0x2d')](_0x7f518d[_0x5ac9('0x2a')],this['actions'][_0x7f518d[_0x5ac9('0x2a')]]?'\x20hangup\x20sendFile\x20':_0x5ac9('0x56'),JSON[_0x5ac9('0x46')](this[_0x5ac9('0x29')][_0x7f518d['uniqueid']]));if(this[_0x5ac9('0x12')][_0x7f518d['uniqueid']]){if(this['channels'][_0x7f518d[_0x5ac9('0x2a')]]['faxpages']>0x0&&this[_0x5ac9('0x29')][_0x7f518d[_0x5ac9('0x2a')]][_0x5ac9('0x1b')]===_0x5ac9('0x57')){this['updateStatus'](_0x7f518d[_0x5ac9('0x2a')],!![]);}else{this[_0x5ac9('0x51')](_0x7f518d['uniqueid'],![],this['channels'][_0x7f518d[_0x5ac9('0x2a')]][_0x5ac9('0x58')]?_0x5ac9('0x59')+this[_0x5ac9('0x29')][_0x7f518d['uniqueid']][_0x5ac9('0x58')]:'SENDING\x20FAILED');}}}};Fax['prototype']['send']=function(_0x1cc857){var _0xb05f=this;return new BPromise(function(_0xb84bcc,_0x283a4a){_0xb05f[_0x5ac9('0x5a')](_0x1cc857,_0xb05f[_0x5ac9('0x10')][_0x1cc857['FaxAccountId']])[_0x5ac9('0x42')](function(_0x2b5395){ut['logger'](_0x5ac9('0x5b'),_0x2b5395);_0xb84bcc(ut[_0x5ac9('0x3f')](_0x5ac9('0x5c')));})[_0x5ac9('0x52')](function(_0x714026){ut[_0x5ac9('0x4e')](_0x5ac9('0x5d'),_0x714026);updateStatus(_0x1cc857);_0x283a4a(ut[_0x5ac9('0x3f')]('Fax\x20failed'));});});};Fax['prototype'][_0x5ac9('0x5e')]=function(_0x6e0617){var _0x44e6b5=this;return new BPromise(function(_0x160581,_0x446fa9){var _0xf47d0f=_0x44e6b5['checkTrunk'](_0x44e6b5[_0x5ac9('0x10')][_0x6e0617[_0x5ac9('0x5f')]][_0x5ac9('0x60')],_0x6e0617);if(_0xf47d0f['isValid']){_0x160581(ut[_0x5ac9('0x3f')](_0x5ac9('0x61')));}else{_0x446fa9(ut[_0x5ac9('0x3f')](_0xf47d0f[_0x5ac9('0x3f')]));}});};function originate(_0x4e94ce,_0x24a5d6,_0x443f4e){return new BPromise(function(_0xf99c58,_0x45582c){if(_0x443f4e){var _0x1aff13=util[_0x5ac9('0x62')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x5ac9('0x41')](_0x4e94ce[_0x5ac9('0x4')])[_0x5ac9('0x2c')],_0x4e94ce['path']);gs[_0x5ac9('0x63')](_0x1aff13)['then'](function(){_0x4e94ce['path']=util[_0x5ac9('0x62')](_0x5ac9('0x64'),path[_0x5ac9('0x41')](_0x4e94ce[_0x5ac9('0x4')])[_0x5ac9('0x65')],path['parse'](_0x4e94ce[_0x5ac9('0x4')])[_0x5ac9('0x2c')]);_0x24a5d6['XMF-PATH']=_0x4e94ce[_0x5ac9('0x4')];ut[_0x5ac9('0x4e')]('Convert\x20pdf\x20to\x20tif','');ami[_0x5ac9('0x66')](ut['variablesAction'](_0x4e94ce,_0x24a5d6))[_0x5ac9('0x42')](function(_0x3e603f){_0xf99c58(_0x3e603f);})['catch'](function(_0x4a5b75){_0x45582c(_0x4a5b75);});})[_0x5ac9('0x52')](function(_0x2fb8cb){_0x45582c(_0x2fb8cb);});}else{ami[_0x5ac9('0x66')](ut['variablesAction'](_0x4e94ce,_0x24a5d6))[_0x5ac9('0x42')](function(_0x36218a){_0xf99c58(_0x36218a);})[_0x5ac9('0x52')](function(_0x8b92f7){_0x45582c(_0x8b92f7);});}});}Fax[_0x5ac9('0x23')][_0x5ac9('0x5a')]=function(_0x34ee2b,_0x10a034){var _0x5ce82f=this;return new BPromise(function(_0x1fdbe4,_0x1bccd5){var _0x819f12=uuid['v4']();var _0x38d1af=ut[_0x5ac9('0x67')](_0x34ee2b,_0x10a034);_0x5ce82f[_0x5ac9('0x12')][_0x819f12]=new Action(_0x819f12,_0x10a034,_0x34ee2b);var _0x558130=_0x5ce82f[_0x5ac9('0x12')][_0x819f12];if(path[_0x5ac9('0x41')](_0x34ee2b[_0x5ac9('0x4')])[_0x5ac9('0x68')]===_0x5ac9('0x44')){originate(_0x558130,_0x38d1af,!![])[_0x5ac9('0x42')](function(_0x5e8dae){_0x1fdbe4(_0x5e8dae);})['catch'](function(_0x2b13ea){_0x1bccd5(_0x2b13ea);});}else{originate(_0x558130,_0x38d1af,![])[_0x5ac9('0x42')](function(_0x1d6249){_0x1fdbe4(_0x1d6249);})[_0x5ac9('0x52')](function(_0x32890b){_0x1bccd5(_0x32890b);});}});};Fax[_0x5ac9('0x23')][_0x5ac9('0x69')]=function(_0x16fc60){return!_[_0x5ac9('0x6a')](_0x16fc60)&&!_[_0x5ac9('0x6a')](_0x16fc60[_0x5ac9('0x2c')])&&!_[_0x5ac9('0x6a')](_0x16fc60[_0x5ac9('0x6b')])&&_0x16fc60[_0x5ac9('0x6b')]&&!_[_0x5ac9('0x6a')](this[_0x5ac9('0x11')][util[_0x5ac9('0x62')](_0x5ac9('0x6c'),_0x16fc60['name'])])&&!_['isNil'](this[_0x5ac9('0x11')][util[_0x5ac9('0x62')]('SIP/%s',_0x16fc60['name'])]['status'])&&(this[_0x5ac9('0x11')][util[_0x5ac9('0x62')](_0x5ac9('0x6c'),_0x16fc60[_0x5ac9('0x2c')])][_0x5ac9('0x35')]===_0x5ac9('0x6d')||this[_0x5ac9('0x11')][util['format'](_0x5ac9('0x6c'),_0x16fc60['name'])][_0x5ac9('0x35')]===_0x5ac9('0x6e'));};Fax[_0x5ac9('0x23')]['checkTrunk']=function(_0x4bbced,_0x5ba504){if(!this['isTrunkReachable'](_0x4bbced)){ut[_0x5ac9('0x4e')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x4bbced)?'':_0x4bbced['name']+_0x5ac9('0x6f'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x5ac9('0x6a')](_0x5ba504[_0x5ac9('0x7')])){ut[_0x5ac9('0x4e')](_0x5ac9('0x70'),JSON[_0x5ac9('0x46')](_0x5ba504));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x5ac9('0x6a')](_0x5ba504[_0x5ac9('0x4')])){ut[_0x5ac9('0x4e')](_0x5ac9('0x71'),JSON[_0x5ac9('0x46')](_0x5ba504));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x5ac9('0x72')};};module[_0x5ac9('0x73')]=Fax; \ No newline at end of file +var _0x4353=['/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','update','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','Trunk','isValid','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','path','execute','format','%s/%s.tif','XMF-PATH','addVariables','.pdf','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','moment','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum'];(function(_0x5b9df5,_0x5866b3){var _0x5e6fa9=function(_0x23d51b){while(--_0x23d51b){_0x5b9df5['push'](_0x5b9df5['shift']());}};_0x5e6fa9(++_0x5866b3);}(_0x4353,0x122));var _0x3435=function(_0xc068a4,_0x1b63f4){_0xc068a4=_0xc068a4-0x0;var _0x317dfd=_0x4353[_0xc068a4];return _0x317dfd;};'use strict';var util=require(_0x3435('0x0'));var _=require('lodash');var BPromise=require(_0x3435('0x1'));var uuid=require('uuid');var moment=require(_0x3435('0x2'));var path=require('path');var tiff2pdf=require(_0x3435('0x3'));var gs=require(_0x3435('0x4'));var logger=require(_0x3435('0x5'))('fax');var ami=require(_0x3435('0x6'));var rpcDb=require(_0x3435('0x7'));var Channel=require(_0x3435('0x8'));var ut=require(_0x3435('0x9'));var Action=require(_0x3435('0xa'));var faxAccount=require(_0x3435('0xb'));var attachment=require(_0x3435('0xc'));var faxMessage=require(_0x3435('0xd'));function Fax(_0x4fa64a){this[_0x3435('0xe')]={};this[_0x3435('0xf')]=_0x4fa64a[_0x3435('0xf')];this[_0x3435('0x10')]=_0x4fa64a[_0x3435('0x10')];this[_0x3435('0x11')]={};ami['on'](_0x3435('0x12'),this['syncNewchannel'][_0x3435('0x13')](this));ami['on'](_0x3435('0x14'),this[_0x3435('0x15')][_0x3435('0x13')](this));ami['on'](_0x3435('0x16'),this[_0x3435('0x17')]['bind'](this));ami['on']('newexten',this[_0x3435('0x18')]['bind'](this));ami['on'](_0x3435('0x19'),this[_0x3435('0x1a')]['bind'](this));ami['on'](_0x3435('0x1b'),this[_0x3435('0x1c')]['bind'](this));ami['on'](_0x3435('0x1d'),this[_0x3435('0x1e')][_0x3435('0x13')](this));ami['on'](_0x3435('0x1f'),this[_0x3435('0x20')][_0x3435('0x13')](this));}Fax[_0x3435('0x21')][_0x3435('0x22')]=function(_0x1b628d){if(_0x1b628d['context']===_0x3435('0x23')){for(var _0x8c7211 in this[_0x3435('0xf')]){if(this[_0x3435('0xf')][_0x3435('0x24')](_0x8c7211)){if(_0x1b628d['exten']===this[_0x3435('0xf')][_0x8c7211][_0x3435('0x25')]){this[_0x3435('0xe')][_0x1b628d[_0x3435('0x26')]]={};this['channels'][_0x1b628d[_0x3435('0x26')]]['channel']=_0x1b628d[_0x3435('0x27')];this[_0x3435('0xe')][_0x1b628d[_0x3435('0x26')]]['id']=this[_0x3435('0xf')][_0x8c7211]['id'];this[_0x3435('0xe')][_0x1b628d[_0x3435('0x26')]][_0x3435('0x28')]=this[_0x3435('0xf')][_0x8c7211][_0x3435('0x28')];logger[_0x3435('0x29')](_0x1b628d[_0x3435('0x26')],_0x3435('0x2a'));}}}}if(this[_0x3435('0x11')][_0x1b628d[_0x3435('0x26')]]){this[_0x3435('0xe')][_0x1b628d[_0x3435('0x26')]]={};this[_0x3435('0xe')][_0x1b628d[_0x3435('0x26')]][_0x3435('0x27')]=_0x1b628d[_0x3435('0x27')];logger['info'](_0x1b628d['uniqueid'],_0x3435('0x2a'));}};Fax[_0x3435('0x21')][_0x3435('0x15')]=function(_0x975c1){if(this['channels'][_0x975c1[_0x3435('0x26')]]){for(var _0x233562 in _0x975c1[_0x3435('0x2b')]){if(_0x975c1['variable'][_0x3435('0x24')](_0x233562)){this[_0x3435('0xe')][_0x975c1['uniqueid']][_0x233562]=_0x975c1['value'];}}}};Fax[_0x3435('0x21')][_0x3435('0x17')]=function(_0x5e677c){if(this['channels'][_0x5e677c[_0x3435('0x26')]]){this['channels'][_0x5e677c['uniqueid']][_0x3435('0x2c')]=_0x5e677c['channelstate'];this[_0x3435('0xe')][_0x5e677c[_0x3435('0x26')]][_0x3435('0x2d')]=_0x5e677c['channelstatedesc'];}};Fax['prototype']['syncNewExten']=function(_0x145726){if(this[_0x3435('0xe')][_0x145726['uniqueid']]){for(var _0x5ce41f in _0x145726['variable']){if(_0x145726[_0x3435('0x2b')][_0x3435('0x24')](_0x5ce41f)){this[_0x3435('0xe')][_0x145726[_0x3435('0x26')]][_0x5ce41f]=_0x145726['value'];}}}};Fax[_0x3435('0x21')][_0x3435('0x1a')]=function(_0x391b68){if(this[_0x3435('0xe')][_0x391b68['uniqueid']]){this[_0x3435('0xe')][_0x391b68[_0x3435('0x26')]][_0x3435('0x2e')]=_0x391b68[_0x3435('0x2e')];this[_0x3435('0xe')][_0x391b68['uniqueid']][_0x3435('0x2f')]=_0x391b68['status'];this[_0x3435('0xe')][_0x391b68[_0x3435('0x26')]][_0x3435('0x25')]=_0x391b68[_0x3435('0x25')];this[_0x3435('0xe')][_0x391b68['uniqueid']][_0x3435('0x30')]=_0x391b68['filename'];logger[_0x3435('0x29')](_0x391b68[_0x3435('0x26')],_0x3435('0x31'));}};Fax['prototype'][_0x3435('0x1c')]=function(_0xc277db){var _0x589fc3=this;if(this[_0x3435('0xe')][_0xc277db[_0x3435('0x26')]]){var _0x47bf0e=this['channels'][_0xc277db[_0x3435('0x26')]]['id'];this['channels'][_0xc277db[_0x3435('0x26')]][_0x3435('0x32')]=_0xc277db['remotestationid'];this['channels'][_0xc277db['uniqueid']]['pagestransferred']=_0xc277db[_0x3435('0x33')];this['channels'][_0xc277db[_0x3435('0x26')]]['localstationid']=_0xc277db[_0x3435('0x25')];this[_0x3435('0xe')][_0xc277db[_0x3435('0x26')]][_0x3435('0x34')]=_0xc277db['resolution'];this['channels'][_0xc277db[_0x3435('0x26')]]['transferrate']=_0xc277db[_0x3435('0x35')];this[_0x3435('0xe')][_0xc277db[_0x3435('0x26')]][_0x3435('0x30')]=_0xc277db['filename'];this[_0x3435('0xe')][_0xc277db[_0x3435('0x26')]]['calleridnum']=_0xc277db[_0x3435('0x36')];if(this[_0x3435('0xe')][_0xc277db['uniqueid']][_0x3435('0x33')]>0x0){tiff2pdf(_0xc277db[_0x3435('0x30')],_0x3435('0x37'),function(_0x2ec6d3){logger['info'](_0xc277db[_0x3435('0x26')],_0x3435('0x38'),_0x2ec6d3[_0x3435('0x39')]);attachment[_0x3435('0x3a')]({'name':path[_0x3435('0x3b')](_0xc277db[_0x3435('0x30')])[_0x3435('0x28')],'basename':path[_0x3435('0x3b')](_0xc277db[_0x3435('0x30')])[_0x3435('0x28')]+'.pdf','type':_0x3435('0x3c')})[_0x3435('0x3d')](function(_0x4360b9){faxAccount[_0x3435('0x3e')](_0x47bf0e,{'from':_0xc277db[_0x3435('0x36')],'mapKey':_0x3435('0x3f'),'body':path[_0x3435('0x3b')](_0xc277db['filename'])['name']+'.pdf','AttachmentId':_0x4360b9['id']})[_0x3435('0x40')](function(_0x1674d0){logger[_0x3435('0x41')](_0xc277db[_0x3435('0x26')],_0x3435('0x42'),JSON[_0x3435('0x43')](_0x1674d0));});})[_0x3435('0x40')](function(_0x3749ce){logger[_0x3435('0x41')](_0xc277db[_0x3435('0x26')],'\x20receiveFax\x20',JSON['stringify'](_0x3749ce));});});}logger[_0x3435('0x29')](_0xc277db['uniqueid'],_0x3435('0x44'));}};Fax[_0x3435('0x21')]['syncOriginateResponse']=function(_0x3a34b3){if(this[_0x3435('0x11')][_0x3a34b3[_0x3435('0x26')]]){_[_0x3435('0x45')](this[_0x3435('0xe')][_0x3a34b3[_0x3435('0x26')]],_[_0x3435('0x46')](_0x3a34b3,['response',_0x3435('0x47')]));}};function updateStatus(_0x45cd96){if(_0x45cd96[_0x3435('0x48')]){faxMessage['update'](_0x45cd96[_0x3435('0x48')],{'failMessage':_0x3435('0x49')})['then'](function(_0x5bf5f2){ut['logger']('[Fax][Message][Error][Updated]',_0x5bf5f2);})['catch'](function(_0x133c78){ut[_0x3435('0x4a')](_0x3435('0x4b'),_0x133c78);});}else{ut['logger'](_0x3435('0x4c'));}}Fax[_0x3435('0x21')]['updateStatus']=function(_0x111567,_0x2c57e4,_0x18db62){var _0x2638df=this;var _0x4bcb84={};if(_0x2c57e4){_0x4bcb84={'read':_0x2c57e4};}else{_0x4bcb84={'failMessage':_0x18db62};}if(this['actions'][_0x111567][_0x3435('0x48')]){faxMessage[_0x3435('0x4d')](this['actions'][_0x111567][_0x3435('0x48')],_0x4bcb84)[_0x3435('0x3d')](function(_0x1494db){ut['logger']('[Fax][Message][Updated]',_0x1494db);})[_0x3435('0x40')](function(_0x1e41d8){ut[_0x3435('0x4a')](_0x3435('0x4e'),_0x1e41d8);})['finally'](function(){delete _0x2638df[_0x3435('0xe')][_0x111567];delete _0x2638df['actions'][_0x111567];});}else{ut['logger'](_0x3435('0x4f'));delete this[_0x3435('0xe')][_0x111567];delete this['actions'][_0x111567];}};Fax[_0x3435('0x21')]['syncHangup']=function(_0x34f69f){var _0x4f598b=this;if(this[_0x3435('0xe')][_0x34f69f[_0x3435('0x26')]]){if(this[_0x3435('0x11')][_0x34f69f[_0x3435('0x26')]]){this[_0x3435('0xe')][_0x34f69f['uniqueid']]['id']=this[_0x3435('0x11')][_0x34f69f[_0x3435('0x26')]]['id'];this['channels'][_0x34f69f['uniqueid']]['name']=this[_0x3435('0x11')][_0x34f69f[_0x3435('0x26')]][_0x3435('0x28')];}logger[_0x3435('0x29')](_0x34f69f[_0x3435('0x26')],this[_0x3435('0x11')][_0x34f69f[_0x3435('0x26')]]?_0x3435('0x50'):_0x3435('0x51'),JSON[_0x3435('0x43')](this[_0x3435('0xe')][_0x34f69f[_0x3435('0x26')]]));if(this['actions'][_0x34f69f[_0x3435('0x26')]]){if(this['channels'][_0x34f69f[_0x3435('0x26')]]['faxpages']>0x0&&this['channels'][_0x34f69f['uniqueid']]['faxstatus']===_0x3435('0x52')){this['updateStatus'](_0x34f69f['uniqueid'],!![]);}else{this[_0x3435('0x53')](_0x34f69f[_0x3435('0x26')],![],this[_0x3435('0xe')][_0x34f69f[_0x3435('0x26')]][_0x3435('0x54')]?_0x3435('0x55')+this[_0x3435('0xe')][_0x34f69f[_0x3435('0x26')]][_0x3435('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0x3435('0x21')][_0x3435('0x56')]=function(_0x3125f4){var _0x49b9ef=this;return new BPromise(function(_0x15666e,_0x5d2022){_0x49b9ef['execOriginate'](_0x3125f4,_0x49b9ef['faxAccounts'][_0x3125f4[_0x3435('0x57')]])[_0x3435('0x3d')](function(_0x284f8d){ut['logger'](_0x3435('0x58'),_0x284f8d);_0x15666e(ut[_0x3435('0x39')](_0x3435('0x59')));})[_0x3435('0x40')](function(_0x541218){ut[_0x3435('0x4a')]('[Fax][execOriginate][failure]',_0x541218);updateStatus(_0x3125f4);_0x5d2022(ut[_0x3435('0x39')](_0x3435('0x5a')));});});};Fax[_0x3435('0x21')]['checkAfterSend']=function(_0x22f685){var _0x52607c=this;return new BPromise(function(_0x40f70e,_0x209cb5){var _0x391da7=_0x52607c['checkTrunk'](_0x52607c[_0x3435('0xf')][_0x22f685[_0x3435('0x57')]][_0x3435('0x5b')],_0x22f685);if(_0x391da7[_0x3435('0x5c')]){_0x40f70e(ut['message'](_0x3435('0x5d')));}else{_0x209cb5(ut[_0x3435('0x39')](_0x391da7[_0x3435('0x39')]));}});};function originate(_0x47da40,_0x124172,_0x3f5296){return new BPromise(function(_0x5e8f6d,_0x22891c){if(_0x3f5296){var _0x71628=util['format'](_0x3435('0x5e'),path[_0x3435('0x3b')](_0x47da40['path'])[_0x3435('0x28')],_0x47da40[_0x3435('0x5f')]);gs[_0x3435('0x60')](_0x71628)[_0x3435('0x3d')](function(){_0x47da40[_0x3435('0x5f')]=util[_0x3435('0x61')](_0x3435('0x62'),path[_0x3435('0x3b')](_0x47da40[_0x3435('0x5f')])['dir'],path[_0x3435('0x3b')](_0x47da40[_0x3435('0x5f')])['name']);_0x124172[_0x3435('0x63')]=_0x47da40[_0x3435('0x5f')];ut[_0x3435('0x4a')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut['variablesAction'](_0x47da40,_0x124172))[_0x3435('0x3d')](function(_0x352ea1){_0x5e8f6d(_0x352ea1);})['catch'](function(_0x1b6f82){_0x22891c(_0x1b6f82);});})[_0x3435('0x40')](function(_0x3267f4){_0x22891c(_0x3267f4);});}else{ami['Action'](ut['variablesAction'](_0x47da40,_0x124172))[_0x3435('0x3d')](function(_0xfff95){_0x5e8f6d(_0xfff95);})[_0x3435('0x40')](function(_0x2e6afa){_0x22891c(_0x2e6afa);});}});}Fax['prototype']['execOriginate']=function(_0x47b456,_0xc2e733){var _0xb85bab=this;return new BPromise(function(_0x2d3478,_0x35489c){var _0x46ced0=uuid['v4']();var _0x17ce9e=ut[_0x3435('0x64')](_0x47b456,_0xc2e733);_0xb85bab[_0x3435('0x11')][_0x46ced0]=new Action(_0x46ced0,_0xc2e733,_0x47b456);var _0x3f917d=_0xb85bab[_0x3435('0x11')][_0x46ced0];if(path[_0x3435('0x3b')](_0x47b456[_0x3435('0x5f')])['ext']===_0x3435('0x65')){originate(_0x3f917d,_0x17ce9e,!![])['then'](function(_0x2204d7){_0x2d3478(_0x2204d7);})[_0x3435('0x40')](function(_0x1e1b7a){_0x35489c(_0x1e1b7a);});}else{originate(_0x3f917d,_0x17ce9e,![])[_0x3435('0x3d')](function(_0x3da4dc){_0x2d3478(_0x3da4dc);})[_0x3435('0x40')](function(_0x156a89){_0x35489c(_0x156a89);});}});};Fax[_0x3435('0x21')][_0x3435('0x66')]=function(_0x4d4263){return!_[_0x3435('0x67')](_0x4d4263)&&!_[_0x3435('0x67')](_0x4d4263[_0x3435('0x28')])&&!_[_0x3435('0x67')](_0x4d4263[_0x3435('0x68')])&&_0x4d4263['active']&&!_[_0x3435('0x67')](this[_0x3435('0x10')][util['format'](_0x3435('0x69'),_0x4d4263[_0x3435('0x28')])])&&!_['isNil'](this[_0x3435('0x10')][util[_0x3435('0x61')]('SIP/%s',_0x4d4263[_0x3435('0x28')])][_0x3435('0x2f')])&&(this['trunks'][util[_0x3435('0x61')](_0x3435('0x69'),_0x4d4263[_0x3435('0x28')])][_0x3435('0x2f')]===_0x3435('0x6a')||this['trunks'][util[_0x3435('0x61')](_0x3435('0x69'),_0x4d4263[_0x3435('0x28')])][_0x3435('0x2f')]===_0x3435('0x6b'));};Fax[_0x3435('0x21')][_0x3435('0x6c')]=function(_0x221460,_0x45f534){if(!this[_0x3435('0x66')](_0x221460)){ut[_0x3435('0x4a')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x3435('0x67')](_0x221460)?'':_0x221460['name']+_0x3435('0x6d'));return{'isValid':![],'message':_0x3435('0x6e')};}if(_[_0x3435('0x67')](_0x45f534[_0x3435('0x3f')])){ut[_0x3435('0x4a')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x3435('0x43')](_0x45f534));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x3435('0x67')](_0x45f534[_0x3435('0x5f')])){ut[_0x3435('0x4a')](_0x3435('0x6f'),JSON[_0x3435('0x43')](_0x45f534));return{'isValid':![],'message':_0x3435('0x70')};}return{'isValid':!![],'message':_0x3435('0x71')};};module[_0x3435('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 3c75dce..2e125ca 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 _0x2fcd=['resolve','then','catch','util','preview','lodash','../rpc/faxAccount','inspect','notify'];(function(_0xccf869,_0x2556a5){var _0x21a9db=function(_0xcc4835){while(--_0xcc4835){_0xccf869['push'](_0xccf869['shift']());}};_0x21a9db(++_0x2556a5);}(_0x2fcd,0xf6));var _0xd2fc=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2fcd[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0xd2fc('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0xd2fc('0x1'));var _=require(_0xd2fc('0x2'));var faxAccount=require(_0xd2fc('0x3'));function loggerCatch(_0x201368){return function(_0x2edda5){logger['error'](_0x201368,util[_0xd2fc('0x4')](_0x2edda5,{'showHidden':![],'depth':null}));};}exports[_0xd2fc('0x5')]=function(_0x2debf,_0x5bcb92){return BPromise[_0xd2fc('0x6')]()[_0xd2fc('0x7')](faxAccount[_0xd2fc('0x5')](_0x2debf,_0x5bcb92))[_0xd2fc('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x3b0d=['lodash','../rpc/faxAccount','error','inspect','notify','resolve','[Notify]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x3b0d,0x104));var _0xd3b0=function(_0x2e19ac,_0x5ee48a){_0x2e19ac=_0x2e19ac-0x0;var _0x29d578=_0x3b0d[_0x2e19ac];return _0x29d578;};'use strict';var util=require(_0xd3b0('0x0'));var BPromise=require(_0xd3b0('0x1'));var logger=require(_0xd3b0('0x2'))(_0xd3b0('0x3'));var _=require(_0xd3b0('0x4'));var faxAccount=require(_0xd3b0('0x5'));function loggerCatch(_0x48eb02){return function(_0xe9035){logger[_0xd3b0('0x6')](_0x48eb02,util[_0xd3b0('0x7')](_0xe9035,{'showHidden':![],'depth':null}));};}exports[_0xd3b0('0x8')]=function(_0x1b1e2b,_0x2b50a0){return BPromise[_0xd3b0('0x9')]()['then'](faxAccount['notify'](_0x1b1e2b,_0x2b50a0))['catch'](loggerCatch(_0xd3b0('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index db4a110..6b2278a 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 _0x8ba1=['info','Exec\x20gs','util','bluebird','exec'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8ba1,0x1ce));var _0x18ba=function(_0x431ea1,_0x230c17){_0x431ea1=_0x431ea1-0x0;var _0x4b79c9=_0x8ba1[_0x431ea1];return _0x4b79c9;};'use strict';var util=require(_0x18ba('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x18ba('0x1'));var exec=require('child_process')[_0x18ba('0x2')];exports['execute']=function(_0x51e08f){return new BPromise(function(_0x1f4735,_0x4c3763){exec(_0x51e08f,function(_0xa7549e,_0x46ecbf,_0x41d40d){logger[_0x18ba('0x3')](_0x18ba('0x4'),_0x46ecbf);if(_0xa7549e){logger[_0x18ba('0x3')](_0x18ba('0x4'),'\x20Error\x20:',util['inspect'](_0xa7549e,{'showHidden':![],'depth':null}),_0x46ecbf,_0x41d40d);_0x4c3763(_0xa7549e);}_0x1f4735(_0x46ecbf);});});}; \ No newline at end of file +var _0x7f13=['child_process','exec','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','bluebird'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0x7f13,0x1eb));var _0x37f1=function(_0x45682b,_0x22ef44){_0x45682b=_0x45682b-0x0;var _0x28c3cd=_0x7f13[_0x45682b];return _0x28c3cd;};'use strict';var util=require(_0x37f1('0x0'));var logger=require(_0x37f1('0x1'))(_0x37f1('0x2'));var BPromise=require(_0x37f1('0x3'));var exec=require(_0x37f1('0x4'))[_0x37f1('0x5')];exports['execute']=function(_0x4a36ac){return new BPromise(function(_0x5d514a,_0x2532cf){exec(_0x4a36ac,function(_0x2212a2,_0x14c680,_0x3f27a5){logger[_0x37f1('0x6')](_0x37f1('0x7'),_0x14c680);if(_0x2212a2){logger[_0x37f1('0x6')](_0x37f1('0x7'),_0x37f1('0x8'),util['inspect'](_0x2212a2,{'showHidden':![],'depth':null}),_0x14c680,_0x3f27a5);_0x2532cf(_0x2212a2);}_0x5d514a(_0x14c680);});});}; \ 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 4971477..4318ba1 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 _0x0d80=['ecm','headerinfo','minrate','format','\x22%s\x22','gateway','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','fax','inspect','addVariables'];(function(_0x2072f7,_0xa8b6b4){var _0xd687a0=function(_0x17bad2){while(--_0x17bad2){_0x2072f7['push'](_0x2072f7['shift']());}};_0xd687a0(++_0xa8b6b4);}(_0x0d80,0x68));var _0x00d8=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0x0d80[_0x584291];return _0x4e7d08;};'use strict';var util=require(_0x00d8('0x0'));var _=require(_0x00d8('0x1'));var moment=require(_0x00d8('0x2'));var logger=require('../../../../config/logger')(_0x00d8('0x3'));exports['message']=function(_0x4fcaa8){return{'message':_0x4fcaa8};};exports['logger']=function(_0x18be2f,_0x496b70){logger['info'](_0x18be2f,util[_0x00d8('0x4')](_0x496b70,{'showHidden':![],'depth':null}));};exports[_0x00d8('0x5')]=function(_0x478a10,_0x200801){var _0x48dc82={'XMF-ECM':_0x200801[_0x00d8('0x6')],'XMF-HEADERINFO':_0x200801[_0x00d8('0x7')],'XMF-MINRATE':_0x200801[_0x00d8('0x8')],'XMF-MAXRATE':_0x200801['maxrate'],'XMF-MODEM':util[_0x00d8('0x9')](_0x00d8('0xa'),_0x200801['modem']),'XMF-GATEWAY':_0x200801[_0x00d8('0xb')],'XMF-FAXDETECT':_0x200801['faxdetect'],'XMF-T38TIMEOUT':_0x200801[_0x00d8('0xc')],'XMF-LOCALSTATIONID':_0x200801[_0x00d8('0xd')],'XMF-PATH':_0x478a10[_0x00d8('0xe')]};return _0x48dc82;};exports[_0x00d8('0xf')]=function(_0x34f03b,_0x2ceb52){return{'actionid':_0x34f03b[_0x00d8('0x10')],'action':_0x00d8('0x11'),'channel':_0x34f03b[_0x00d8('0x12')],'Exten':_0x00d8('0x13'),'Context':_0x00d8('0x14'),'Priority':'1','callerid':util[_0x00d8('0x9')](_0x00d8('0x15'),_0x34f03b[_0x00d8('0x7')]?_0x34f03b[_0x00d8('0x7')]:'',_0x34f03b[_0x00d8('0xd')]),'variable':_0x2ceb52,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x34f03b[_0x00d8('0x10')]};}; \ No newline at end of file +var _0x797a=['inspect','addVariables','ecm','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','headerinfo','../../../../config/logger','fax','message','logger','info'];(function(_0x1fdf81,_0x110fab){var _0x6d7002=function(_0x8de332){while(--_0x8de332){_0x1fdf81['push'](_0x1fdf81['shift']());}};_0x6d7002(++_0x110fab);}(_0x797a,0xab));var _0xa797=function(_0x28a7ab,_0x6e0632){_0x28a7ab=_0x28a7ab-0x0;var _0x11e955=_0x797a[_0x28a7ab];return _0x11e955;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var logger=require(_0xa797('0x0'))(_0xa797('0x1'));exports[_0xa797('0x2')]=function(_0x5e16e9){return{'message':_0x5e16e9};};exports[_0xa797('0x3')]=function(_0x4782c3,_0x27356d){logger[_0xa797('0x4')](_0x4782c3,util[_0xa797('0x5')](_0x27356d,{'showHidden':![],'depth':null}));};exports[_0xa797('0x6')]=function(_0x34d5ff,_0x1a2a31){var _0x204386={'XMF-ECM':_0x1a2a31[_0xa797('0x7')],'XMF-HEADERINFO':_0x1a2a31['headerinfo'],'XMF-MINRATE':_0x1a2a31[_0xa797('0x8')],'XMF-MAXRATE':_0x1a2a31[_0xa797('0x9')],'XMF-MODEM':util['format'](_0xa797('0xa'),_0x1a2a31[_0xa797('0xb')]),'XMF-GATEWAY':_0x1a2a31[_0xa797('0xc')],'XMF-FAXDETECT':_0x1a2a31[_0xa797('0xd')],'XMF-T38TIMEOUT':_0x1a2a31[_0xa797('0xe')],'XMF-LOCALSTATIONID':_0x1a2a31[_0xa797('0xf')],'XMF-PATH':_0x34d5ff['path']};return _0x204386;};exports['variablesAction']=function(_0xeede2d,_0x1af161){return{'actionid':_0xeede2d[_0xa797('0x10')],'action':_0xa797('0x11'),'channel':_0xeede2d[_0xa797('0x12')],'Exten':'xcally-motion-fax','Context':_0xa797('0x13'),'Priority':'1','callerid':util['format'](_0xa797('0x14'),_0xeede2d[_0xa797('0x15')]?_0xeede2d['headerinfo']:'',_0xeede2d[_0xa797('0xf')]),'variable':_0x1af161,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xeede2d['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index d60e193..19c4109 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 _0x1b2e=['getVoiceCallReports','initVoiceCallReports','catch','log','sync','bluebird','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','resolve','getAgents','then','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory'];(function(_0x18b422,_0x4aa468){var _0x109786=function(_0x26b308){while(--_0x26b308){_0x18b422['push'](_0x18b422['shift']());}};_0x109786(++_0x4aa468);}(_0x1b2e,0x1c5));var _0xe1b2=function(_0x47123b,_0x3d97f5){_0x47123b=_0x47123b-0x0;var _0x5fbaae=_0x1b2e[_0x47123b];return _0x5fbaae;};'use strict';var BPromise=require(_0xe1b2('0x0'));var util=require('util');var moment=require('moment');var server=require('./server');var Realtime=require(_0xe1b2('0x1'));var Report=require(_0xe1b2('0x2'));var Acw=require('./acw');var Trigger=require(_0xe1b2('0x3'));var Dialer=require(_0xe1b2('0x4'));var Preview=require(_0xe1b2('0x5'));var Fax=require(_0xe1b2('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0xe1b2('0x7'));var voiceQueueReport=require(_0xe1b2('0x8'));var voiceCallReport=require(_0xe1b2('0x9'));var trunk=require(_0xe1b2('0xa'));var trigger=require(_0xe1b2('0xb'));var template=require(_0xe1b2('0xc'));var cmHopperHistory=require(_0xe1b2('0xd'));var campaign=require(_0xe1b2('0xe'));var voiceExtension=require(_0xe1b2('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xe1b2('0x10'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xe1b2('0x11'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xe1b2('0x12'));var zoho=require(_0xe1b2('0x13'));var vtiger=require(_0xe1b2('0x14'));var freshsales=require(_0xe1b2('0x15'));var servicenow=require(_0xe1b2('0x16'));var dynamics365=require(_0xe1b2('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()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe1b2('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xe1b2('0x19')]()['then'](user[_0xe1b2('0x1a')]())[_0xe1b2('0x1b')](realtime[_0xe1b2('0x1c')]())[_0xe1b2('0x1b')](user['getTelephones']())[_0xe1b2('0x1b')](realtime[_0xe1b2('0x1d')]())[_0xe1b2('0x1b')](trunk[_0xe1b2('0x1e')]())['then'](realtime[_0xe1b2('0x1f')]())['then'](voiceQueue[_0xe1b2('0x20')]())['then'](realtime[_0xe1b2('0x21')]())[_0xe1b2('0x1b')](trigger['getTriggers']())[_0xe1b2('0x1b')](realtime[_0xe1b2('0x22')]())[_0xe1b2('0x1b')](template['getTemplates']())[_0xe1b2('0x1b')](realtime['initTemplates']())[_0xe1b2('0x1b')](zendesk[_0xe1b2('0x23')]())['then'](realtime['initZendeskAccounts']())['then'](salesforce[_0xe1b2('0x24')]())[_0xe1b2('0x1b')](realtime[_0xe1b2('0x25')]())['then'](sugarcrm[_0xe1b2('0x26')]())[_0xe1b2('0x1b')](realtime[_0xe1b2('0x27')]())[_0xe1b2('0x1b')](freshdesk['getFreshdeskAccounts']())[_0xe1b2('0x1b')](realtime['initFreshdeskAccounts']())[_0xe1b2('0x1b')](desk['getDeskAccounts']())['then'](realtime['initDeskAccounts']())['then'](zoho[_0xe1b2('0x28')]())[_0xe1b2('0x1b')](realtime['initZohoAccounts']())['then'](vtiger[_0xe1b2('0x29')]())['then'](realtime[_0xe1b2('0x2a')]())[_0xe1b2('0x1b')](freshsales[_0xe1b2('0x2b')]())['then'](realtime[_0xe1b2('0x2c')]())[_0xe1b2('0x1b')](servicenow[_0xe1b2('0x2d')]())['then'](realtime[_0xe1b2('0x2e')]())['then'](dynamics365[_0xe1b2('0x2f')]())['then'](realtime[_0xe1b2('0x30')]())[_0xe1b2('0x1b')](campaign[_0xe1b2('0x31')]())[_0xe1b2('0x1b')](realtime[_0xe1b2('0x32')]())[_0xe1b2('0x1b')](voiceExtension['getVoiceExtensions']())[_0xe1b2('0x1b')](realtime[_0xe1b2('0x33')]())[_0xe1b2('0x1b')](faxAccount['getFaxAccounts']())[_0xe1b2('0x1b')](realtime[_0xe1b2('0x34')]())[_0xe1b2('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0xe1b2('0x19')]()[_0xe1b2('0x1b')](voiceQueueReport[_0xe1b2('0x35')]())['then'](realtime[_0xe1b2('0x36')]())[_0xe1b2('0x1b')](cmHopperHistory[_0xe1b2('0x37')]())[_0xe1b2('0x1b')](realtime[_0xe1b2('0x38')]())[_0xe1b2('0x1b')](cmHopperHistory[_0xe1b2('0x39')]())['then'](realtime[_0xe1b2('0x3a')]())[_0xe1b2('0x1b')](voiceCallReport[_0xe1b2('0x3b')]())['then'](realtime[_0xe1b2('0x3c')]())['then'](function(_0x53cdeb){})[_0xe1b2('0x3d')](function(_0x5dc68b){console[_0xe1b2('0x3e')](_0x5dc68b);});}function main(){return server['listen'](realtime,preview,fax)[_0xe1b2('0x1b')](function(_0x46c113){return initRealtime();})[_0xe1b2('0x1b')](function(){return initParams();})[_0xe1b2('0x1b')](function(){report[_0xe1b2('0x3f')]();setInterval(initRealtime,0x1388);})[_0xe1b2('0x3d')](function(_0x494e6b){console[_0xe1b2('0x3e')](_0x494e6b);});}main(); \ No newline at end of file +var _0x43dc=['catch','log','listen','sync','bluebird','util','moment','./realtime','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','getAgents','then','initAgents','initTelephones','getTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','initVoiceCallReports'];(function(_0x210b9c,_0x1aee89){var _0x590419=function(_0x5cfa2b){while(--_0x5cfa2b){_0x210b9c['push'](_0x210b9c['shift']());}};_0x590419(++_0x1aee89);}(_0x43dc,0xf0));var _0xc43d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x43dc[_0x27af45];return _0x18df21;};'use strict';var BPromise=require(_0xc43d('0x0'));var util=require(_0xc43d('0x1'));var moment=require(_0xc43d('0x2'));var server=require('./server');var Realtime=require(_0xc43d('0x3'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0xc43d('0x4'));var Dialer=require(_0xc43d('0x5'));var Preview=require(_0xc43d('0x6'));var Fax=require(_0xc43d('0x7'));var user=require(_0xc43d('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xc43d('0x9'));var voiceCallReport=require(_0xc43d('0xa'));var trunk=require(_0xc43d('0xb'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0xc43d('0xc'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xc43d('0xd'));var faxAccount=require(_0xc43d('0xe'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xc43d('0xf'));var sugarcrm=require(_0xc43d('0x10'));var freshdesk=require(_0xc43d('0x11'));var desk=require(_0xc43d('0x12'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xc43d('0x13'));var dynamics365=require(_0xc43d('0x14'));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()[_0xc43d('0x15')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xc43d('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc43d('0x17')]()['then'](user[_0xc43d('0x18')]())[_0xc43d('0x19')](realtime[_0xc43d('0x1a')]())['then'](user['getTelephones']())[_0xc43d('0x19')](realtime[_0xc43d('0x1b')]())[_0xc43d('0x19')](trunk[_0xc43d('0x1c')]())[_0xc43d('0x19')](realtime['initTrunks']())[_0xc43d('0x19')](voiceQueue['getVoiceQueues']())[_0xc43d('0x19')](realtime[_0xc43d('0x1d')]())[_0xc43d('0x19')](trigger[_0xc43d('0x1e')]())[_0xc43d('0x19')](realtime[_0xc43d('0x1f')]())[_0xc43d('0x19')](template[_0xc43d('0x20')]())[_0xc43d('0x19')](realtime['initTemplates']())[_0xc43d('0x19')](zendesk['getZendeskAccounts']())['then'](realtime[_0xc43d('0x21')]())[_0xc43d('0x19')](salesforce[_0xc43d('0x22')]())[_0xc43d('0x19')](realtime[_0xc43d('0x23')]())[_0xc43d('0x19')](sugarcrm[_0xc43d('0x24')]())[_0xc43d('0x19')](realtime[_0xc43d('0x25')]())['then'](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0xc43d('0x26')]())[_0xc43d('0x19')](desk['getDeskAccounts']())[_0xc43d('0x19')](realtime['initDeskAccounts']())['then'](zoho['getZohoAccounts']())['then'](realtime['initZohoAccounts']())[_0xc43d('0x19')](vtiger[_0xc43d('0x27')]())['then'](realtime[_0xc43d('0x28')]())[_0xc43d('0x19')](freshsales[_0xc43d('0x29')]())[_0xc43d('0x19')](realtime[_0xc43d('0x2a')]())[_0xc43d('0x19')](servicenow[_0xc43d('0x2b')]())[_0xc43d('0x19')](realtime['initServicenowAccounts']())[_0xc43d('0x19')](dynamics365[_0xc43d('0x2c')]())[_0xc43d('0x19')](realtime['initDynamics365Accounts']())['then'](campaign['getCampaigns']())[_0xc43d('0x19')](realtime[_0xc43d('0x2d')]())[_0xc43d('0x19')](voiceExtension[_0xc43d('0x2e')]())[_0xc43d('0x19')](realtime[_0xc43d('0x2f')]())[_0xc43d('0x19')](faxAccount[_0xc43d('0x30')]())[_0xc43d('0x19')](realtime[_0xc43d('0x31')]())[_0xc43d('0x19')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xc43d('0x19')](voiceQueueReport['getVoiceQueueReports']())[_0xc43d('0x19')](realtime[_0xc43d('0x32')]())[_0xc43d('0x19')](cmHopperHistory[_0xc43d('0x33')]())[_0xc43d('0x19')](realtime[_0xc43d('0x34')]())[_0xc43d('0x19')](cmHopperHistory['getCampaignHopperHistory']())[_0xc43d('0x19')](realtime[_0xc43d('0x35')]())[_0xc43d('0x19')](voiceCallReport['getVoiceCallReports']())[_0xc43d('0x19')](realtime[_0xc43d('0x36')]())[_0xc43d('0x19')](function(_0x42c51a){})[_0xc43d('0x37')](function(_0x154beb){console[_0xc43d('0x38')](_0x154beb);});}function main(){return server[_0xc43d('0x39')](realtime,preview,fax)[_0xc43d('0x19')](function(_0x244c7d){return initRealtime();})[_0xc43d('0x19')](function(){return initParams();})[_0xc43d('0x19')](function(){report[_0xc43d('0x3a')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x5f26e3){console[_0xc43d('0x38')](_0x5f26e3);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 01c576f..ca7ff7d 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x5e7634,_0x5356a1){var _0x563eb3=function(_0x1f73f7){while(--_0x1f73f7){_0x5e7634['push'](_0x5e7634['shift']());}};_0x563eb3(++_0x5356a1);}(_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 md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file +var _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x4db341,_0xb12794){var _0x193cb0=function(_0x27666e){while(--_0x27666e){_0x4db341['push'](_0x4db341['shift']());}};_0x193cb0(++_0xb12794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 6ad60d8..4706ded 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 _0x134e=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','campaign','temp','ivrTotalCallsDays','message','active','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x2de500,_0x7175a0){var _0xa6dfa8=function(_0x315ecc){while(--_0x315ecc){_0x2de500['push'](_0x2de500['shift']());}};_0xa6dfa8(++_0x7175a0);}(_0x134e,0xc6));var _0xe134=function(_0xd35e7d,_0x3edeaa){_0xd35e7d=_0xd35e7d-0x0;var _0x3548da=_0x134e[_0xd35e7d];return _0x3548da;};'use strict';function Campaign(_0x5d691e){this['id']=_0x5d691e['id']||0x0;this[_0xe134('0x0')]=_0x5d691e[_0xe134('0x0')]||'';this['type']=_0x5d691e['type']||_0xe134('0x1');this['originated']=0x0;this[_0xe134('0x2')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xe134('0x3')]=0x0;this[_0xe134('0x4')]='';this['sendMessageOneNotActive']=!![];this[_0xe134('0x5')]=_0x5d691e['active'];this['limitCalls']=_0x5d691e['limitCalls'];this['dialTimezone']=_0x5d691e['dialTimezone']||null;this[_0xe134('0x6')]=_0x5d691e['dialGlobalInterval']?_0x5d691e['dialGlobalInterval']:null;this[_0xe134('0x7')]=_0x5d691e[_0xe134('0x7')];this[_0xe134('0x8')]=_0x5d691e[_0xe134('0x8')];this[_0xe134('0x9')]=_0x5d691e[_0xe134('0x9')]||0x1e;this[_0xe134('0xa')]=_0x5d691e[_0xe134('0xa')];this['dialCongestionRetryFrequency']=_0x5d691e[_0xe134('0xb')];this[_0xe134('0xc')]=_0x5d691e[_0xe134('0xc')];this[_0xe134('0xd')]=_0x5d691e[_0xe134('0xd')];this[_0xe134('0xe')]=_0x5d691e['dialNoAnswerMaxRetry'];this[_0xe134('0xf')]=_0x5d691e['dialNoAnswerRetryFrequency'];this[_0xe134('0x10')]=_0x5d691e['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x5d691e[_0xe134('0x11')]||0x3;this[_0xe134('0x12')]=_0x5d691e[_0xe134('0x12')]||0x96;this[_0xe134('0x13')]=_0x5d691e[_0xe134('0x13')]||0x3;this[_0xe134('0x14')]=_0x5d691e[_0xe134('0x14')]||0x96;this[_0xe134('0x15')]=_0x5d691e[_0xe134('0x15')]||0x3;this['dialAbandonedRetryFrequency']=_0x5d691e['dialAbandonedRetryFrequency']||0x96;this[_0xe134('0x16')]=_0x5d691e[_0xe134('0x16')]||0x3;this[_0xe134('0x17')]=_0x5d691e[_0xe134('0x17')]||0x96;this[_0xe134('0x18')]=_0x5d691e[_0xe134('0x18')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5d691e[_0xe134('0x19')]||0x96;this['dialOrderByScheduledAt']=_0x5d691e['dialOrderByScheduledAt']||_0xe134('0x1a');this['dialPrefix']=_0x5d691e['dialPrefix']||undefined;this[_0xe134('0x1b')]=_0x5d691e[_0xe134('0x1b')]||undefined;this[_0xe134('0x1c')]=_0x5d691e['dialCutDigit']||undefined;this[_0xe134('0x1d')]=_0x5d691e[_0xe134('0x1d')]?_0x5d691e[_0xe134('0x1d')]:undefined;this['Trunk']=_0x5d691e['Trunk']?_0x5d691e[_0xe134('0x1e')]:undefined;this[_0xe134('0x1f')]=_0x5d691e[_0xe134('0x1f')]?_0x5d691e[_0xe134('0x1f')]:undefined;this[_0xe134('0x20')]=_0x5d691e[_0xe134('0x20')]?_0x5d691e['SquareProject']:undefined;this['dialQueueProject']=_0x5d691e['SquareProject']?_0x5d691e[_0xe134('0x20')][_0xe134('0x0')]:undefined;this['dialAMDActive']=_0x5d691e[_0xe134('0x21')]||![];this[_0xe134('0x22')]=_0x5d691e['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x5d691e[_0xe134('0x23')];this[_0xe134('0x24')]=_0x5d691e[_0xe134('0x24')];this[_0xe134('0x25')]=_0x5d691e[_0xe134('0x25')];this[_0xe134('0x26')]=_0x5d691e[_0xe134('0x26')];this[_0xe134('0x27')]=_0x5d691e['dialAMDBetweenWordsSilence'];this[_0xe134('0x28')]=_0x5d691e[_0xe134('0x28')];this['dialAMDSilenceThreshold']=_0x5d691e[_0xe134('0x29')];this['dialAMDMaximumWordLength']=_0x5d691e[_0xe134('0x2a')];}module['exports']=Campaign; \ No newline at end of file +var _0x7777=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x18cd5f,_0x3928ae){var _0x5517dd=function(_0x186c58){while(--_0x186c58){_0x18cd5f['push'](_0x18cd5f['shift']());}};_0x5517dd(++_0x3928ae);}(_0x7777,0x106));var _0x7777=function(_0x54ba5b,_0x5b7508){_0x54ba5b=_0x54ba5b-0x0;var _0x5e16ac=_0x7777[_0x54ba5b];return _0x5e16ac;};'use strict';function Campaign(_0x1b46cb){this['id']=_0x1b46cb['id']||0x0;this[_0x7777('0x0')]=_0x1b46cb['name']||'';this['type']=_0x1b46cb[_0x7777('0x1')]||_0x7777('0x2');this[_0x7777('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x7777('0x4')]=0x0;this[_0x7777('0x5')]='';this[_0x7777('0x6')]=!![];this[_0x7777('0x7')]=_0x1b46cb[_0x7777('0x7')];this[_0x7777('0x8')]=_0x1b46cb['limitCalls'];this[_0x7777('0x9')]=_0x1b46cb[_0x7777('0x9')]||null;this[_0x7777('0xa')]=_0x1b46cb[_0x7777('0xa')]?_0x1b46cb[_0x7777('0xa')]:null;this['dialOriginateCallerIdName']=_0x1b46cb[_0x7777('0xb')];this['dialOriginateCallerIdNumber']=_0x1b46cb[_0x7777('0xc')];this['dialOriginateTimeout']=_0x1b46cb[_0x7777('0xd')]||0x1e;this[_0x7777('0xe')]=_0x1b46cb[_0x7777('0xe')];this['dialCongestionRetryFrequency']=_0x1b46cb[_0x7777('0xf')];this[_0x7777('0x10')]=_0x1b46cb[_0x7777('0x10')];this['dialBusyRetryFrequency']=_0x1b46cb['dialBusyRetryFrequency'];this[_0x7777('0x11')]=_0x1b46cb['dialNoAnswerMaxRetry'];this[_0x7777('0x12')]=_0x1b46cb[_0x7777('0x12')];this[_0x7777('0x13')]=_0x1b46cb[_0x7777('0x13')];this[_0x7777('0x14')]=_0x1b46cb[_0x7777('0x14')]||0x3;this[_0x7777('0x15')]=_0x1b46cb[_0x7777('0x15')]||0x96;this['dialDropMaxRetry']=_0x1b46cb['dialDropMaxRetry']||0x3;this[_0x7777('0x16')]=_0x1b46cb['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x1b46cb['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x1b46cb[_0x7777('0x17')]||0x96;this['dialMachineMaxRetry']=_0x1b46cb[_0x7777('0x18')]||0x3;this[_0x7777('0x19')]=_0x1b46cb[_0x7777('0x19')]||0x96;this[_0x7777('0x1a')]=_0x1b46cb[_0x7777('0x1a')]||0x3;this[_0x7777('0x1b')]=_0x1b46cb['dialAgentRejectRetryFrequency']||0x96;this[_0x7777('0x1c')]=_0x1b46cb[_0x7777('0x1c')]||_0x7777('0x1d');this[_0x7777('0x1e')]=_0x1b46cb[_0x7777('0x1e')]||undefined;this[_0x7777('0x1f')]=_0x1b46cb[_0x7777('0x1f')]||undefined;this[_0x7777('0x20')]=_0x1b46cb[_0x7777('0x20')]||undefined;this[_0x7777('0x21')]=_0x1b46cb['TrunkBackup']?_0x1b46cb[_0x7777('0x21')]:undefined;this['Trunk']=_0x1b46cb[_0x7777('0x22')]?_0x1b46cb['Trunk']:undefined;this[_0x7777('0x23')]=_0x1b46cb[_0x7777('0x23')]?_0x1b46cb[_0x7777('0x23')]:undefined;this[_0x7777('0x24')]=_0x1b46cb[_0x7777('0x24')]?_0x1b46cb['SquareProject']:undefined;this[_0x7777('0x25')]=_0x1b46cb['SquareProject']?_0x1b46cb[_0x7777('0x24')]['name']:undefined;this[_0x7777('0x26')]=_0x1b46cb[_0x7777('0x26')]||![];this[_0x7777('0x27')]=_0x1b46cb['dialAMDInitialSilence'];this[_0x7777('0x28')]=_0x1b46cb[_0x7777('0x28')];this[_0x7777('0x29')]=_0x1b46cb[_0x7777('0x29')];this[_0x7777('0x2a')]=_0x1b46cb['dialAMDTotalAnalysisTime'];this[_0x7777('0x2b')]=_0x1b46cb[_0x7777('0x2b')];this[_0x7777('0x2c')]=_0x1b46cb[_0x7777('0x2c')];this['dialAMDMaximumNumberOfWords']=_0x1b46cb[_0x7777('0x2d')];this[_0x7777('0x2e')]=_0x1b46cb[_0x7777('0x2e')];this[_0x7777('0x2f')]=_0x1b46cb['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 21c794d..3d2d4c1 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 _0xf954=['connectedlinenum','connectedlinename','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastapplication','billableseconds','holdtime','type','monitorFilename','queue','monitors','transfercalleridnum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xf954,0x10e));var _0x4f95=function(_0x245a45,_0x587c6d){_0x245a45=_0x245a45-0x0;var _0x327b26=_0xf954[_0x245a45];return _0x327b26;};'use strict';function Channel(){this[_0x4f95('0x0')]=null;this[_0x4f95('0x1')]='';this[_0x4f95('0x2')]='';this[_0x4f95('0x3')]=0x0;this[_0x4f95('0x4')]='';this[_0x4f95('0x5')]=undefined;this[_0x4f95('0x6')]=undefined;this['accountcode']=0x0;this['context']='';this[_0x4f95('0x7')]=0x0;this[_0x4f95('0x8')]=0x0;this[_0x4f95('0x9')]=0x0;this[_0x4f95('0xa')]=![];this['answertime']=null;this[_0x4f95('0xb')]=null;this[_0x4f95('0xc')]=![];this[_0x4f95('0xd')]=![];this[_0x4f95('0xe')]='';this['lastdata']='';this['duration']=0x0;this[_0x4f95('0xf')]=0x0;this[_0x4f95('0x10')]=0x0;this[_0x4f95('0x11')]=null;this['tag']=null;this['disposition']=null;this['monitor']=![];this[_0x4f95('0x12')]=null;this[_0x4f95('0x13')]=null;this[_0x4f95('0x14')]=[];this[_0x4f95('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x4f95('0x16')]=undefined;this[_0x4f95('0x17')]=0x0;}module[_0x4f95('0x18')]=Channel; \ No newline at end of file +var _0x7d33=['transfercalleridnum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','linkedid','exten','unmanaged','abandoned','lastdata','billableseconds','type','tag','monitor','monitorFilename','queue','monitors'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x7d33,0x1cc));var _0x37d3=function(_0x22fe5c,_0x28645c){_0x22fe5c=_0x22fe5c-0x0;var _0x17a217=_0x7d33[_0x22fe5c];return _0x17a217;};'use strict';function Channel(){this[_0x37d3('0x0')]=null;this[_0x37d3('0x1')]='';this[_0x37d3('0x2')]='';this[_0x37d3('0x3')]=0x0;this[_0x37d3('0x4')]='';this[_0x37d3('0x5')]=undefined;this[_0x37d3('0x6')]=undefined;this['accountcode']=0x0;this[_0x37d3('0x7')]='';this['uniqueid']=0x0;this[_0x37d3('0x8')]=0x0;this[_0x37d3('0x9')]=0x0;this['answered']=![];this['answertime']=null;this['endtime']=null;this[_0x37d3('0xa')]=![];this[_0x37d3('0xb')]=![];this['lastapplication']='';this[_0x37d3('0xc')]='';this['duration']=0x0;this[_0x37d3('0xd')]=0x0;this['holdtime']=0x0;this[_0x37d3('0xe')]=null;this[_0x37d3('0xf')]=null;this['disposition']=null;this[_0x37d3('0x10')]=![];this[_0x37d3('0x11')]=null;this[_0x37d3('0x12')]=null;this[_0x37d3('0x13')]=[];this[_0x37d3('0x14')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x37d3('0x15')]=undefined;this[_0x37d3('0x16')]=0x0;}module[_0x37d3('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index cf1e763..f0b6a6c 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 _0x2f84=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x5d184b,_0x3fffc9){var _0x2a941e=function(_0x224a26){while(--_0x224a26){_0x5d184b['push'](_0x5d184b['shift']());}};_0x2a941e(++_0x3fffc9);}(_0x2f84,0x1ba));var _0x42f8=function(_0x595e2a,_0x10b153){_0x595e2a=_0x595e2a-0x0;var _0x3936c8=_0x2f84[_0x595e2a];return _0x3936c8;};'use strict';function DeskAccount(_0x4a54e0){this['id']=_0x4a54e0['id']||0x0;this[_0x42f8('0x0')]=_0x4a54e0[_0x42f8('0x0')]||'';this[_0x42f8('0x1')]=_0x4a54e0[_0x42f8('0x1')]||'';this['remoteUri']=_0x4a54e0[_0x42f8('0x2')]||'';this[_0x42f8('0x3')]=_0x4a54e0[_0x42f8('0x3')]||'';this['password']=_0x4a54e0[_0x42f8('0x4')]||'';this[_0x42f8('0x5')]=_0x4a54e0[_0x42f8('0x5')]||'';this[_0x42f8('0x6')]=_0x4a54e0['consumerSecret']||'';this[_0x42f8('0x7')]=_0x4a54e0['token']||'';this[_0x42f8('0x8')]=_0x4a54e0['tokenSecret']||'';this[_0x42f8('0x9')]=_0x4a54e0['type']||'';this[_0x42f8('0xa')]=_0x4a54e0[_0x42f8('0xa')]||'';this[_0x42f8('0xb')]=_0x4a54e0['Configurations']||{};}module[_0x42f8('0xc')]=DeskAccount; \ No newline at end of file +var _0xf202=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name'];(function(_0x112d78,_0x12563a){var _0xf7c8c2=function(_0x21f879){while(--_0x21f879){_0x112d78['push'](_0x112d78['shift']());}};_0xf7c8c2(++_0x12563a);}(_0xf202,0x15b));var _0x2f20=function(_0x3e2247,_0x4cccde){_0x3e2247=_0x3e2247-0x0;var _0x5a3e5a=_0xf202[_0x3e2247];return _0x5a3e5a;};'use strict';function DeskAccount(_0x111e5e){this['id']=_0x111e5e['id']||0x0;this[_0x2f20('0x0')]=_0x111e5e['name']||'';this[_0x2f20('0x1')]=_0x111e5e['username']||'';this[_0x2f20('0x2')]=_0x111e5e[_0x2f20('0x2')]||'';this[_0x2f20('0x3')]=_0x111e5e[_0x2f20('0x3')]||'';this[_0x2f20('0x4')]=_0x111e5e[_0x2f20('0x4')]||'';this[_0x2f20('0x5')]=_0x111e5e[_0x2f20('0x5')]||'';this[_0x2f20('0x6')]=_0x111e5e[_0x2f20('0x6')]||'';this[_0x2f20('0x7')]=_0x111e5e[_0x2f20('0x7')]||'';this[_0x2f20('0x8')]=_0x111e5e[_0x2f20('0x8')]||'';this[_0x2f20('0x9')]=_0x111e5e['type']||'';this[_0x2f20('0xa')]=_0x111e5e['serverUrl']||'';this[_0x2f20('0xb')]=_0x111e5e[_0x2f20('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index b3e812b..cdf63f5 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 _0xaa88=['username','password','remoteUri','tenantId','clientSecret','serverUrl','Configurations','name'];(function(_0xa261f5,_0x37ed4e){var _0x4a889b=function(_0x2e1c9f){while(--_0x2e1c9f){_0xa261f5['push'](_0xa261f5['shift']());}};_0x4a889b(++_0x37ed4e);}(_0xaa88,0x137));var _0x8aa8=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0xaa88[_0x3e32a8];return _0x2997b0;};'use strict';function Dynamics365Account(_0x2d8583){this['id']=_0x2d8583['id']||0x0;this[_0x8aa8('0x0')]=_0x2d8583[_0x8aa8('0x0')]||'';this[_0x8aa8('0x1')]=_0x2d8583['username']||'';this[_0x8aa8('0x2')]=_0x2d8583[_0x8aa8('0x2')]||'';this[_0x8aa8('0x3')]=_0x2d8583[_0x8aa8('0x3')]||'';this[_0x8aa8('0x4')]=_0x2d8583[_0x8aa8('0x4')]||'';this['clientId']=_0x2d8583['clientId']||'';this[_0x8aa8('0x5')]=_0x2d8583['clientSecret']||{};this[_0x8aa8('0x6')]=_0x2d8583[_0x8aa8('0x6')]||'';this[_0x8aa8('0x7')]=_0x2d8583[_0x8aa8('0x7')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xaa88=['username','password','remoteUri','tenantId','clientSecret','serverUrl','Configurations','name'];(function(_0x50c2c8,_0x17421e){var _0x55f8a3=function(_0x1fb37e){while(--_0x1fb37e){_0x50c2c8['push'](_0x50c2c8['shift']());}};_0x55f8a3(++_0x17421e);}(_0xaa88,0x137));var _0x8aa8=function(_0x28fbe3,_0x4ac6f8){_0x28fbe3=_0x28fbe3-0x0;var _0x45db6a=_0xaa88[_0x28fbe3];return _0x45db6a;};'use strict';function Dynamics365Account(_0x2d8583){this['id']=_0x2d8583['id']||0x0;this[_0x8aa8('0x0')]=_0x2d8583[_0x8aa8('0x0')]||'';this[_0x8aa8('0x1')]=_0x2d8583['username']||'';this[_0x8aa8('0x2')]=_0x2d8583[_0x8aa8('0x2')]||'';this[_0x8aa8('0x3')]=_0x2d8583[_0x8aa8('0x3')]||'';this[_0x8aa8('0x4')]=_0x2d8583[_0x8aa8('0x4')]||'';this['clientId']=_0x2d8583['clientId']||'';this[_0x8aa8('0x5')]=_0x2d8583['clientSecret']||{};this[_0x8aa8('0x6')]=_0x2d8583[_0x8aa8('0x6')]||'';this[_0x8aa8('0x7')]=_0x2d8583[_0x8aa8('0x7')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 4b9ea9b..5abf965 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 _0x4ddb=['faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x4ddb,0xa0));var _0xb4dd=function(_0x419715,_0x221336){_0x419715=_0x419715-0x0;var _0x274fbd=_0x4ddb[_0x419715];return _0x274fbd;};'use strict';function FaxAccount(_0x2fb8d5){this['id']=_0x2fb8d5['id']||0x0;this[_0xb4dd('0x0')]=_0x2fb8d5[_0xb4dd('0x0')]||'';this[_0xb4dd('0x1')]=_0x2fb8d5[_0xb4dd('0x1')];this['ecm']=_0x2fb8d5[_0xb4dd('0x2')];this[_0xb4dd('0x3')]=_0x2fb8d5[_0xb4dd('0x3')];this['localstationid']=_0x2fb8d5[_0xb4dd('0x4')];this[_0xb4dd('0x5')]=_0x2fb8d5['minrate']||0x960;this[_0xb4dd('0x6')]=_0x2fb8d5[_0xb4dd('0x6')]||0x3840;this[_0xb4dd('0x7')]=_0x2fb8d5['modem']||_0xb4dd('0x8');this[_0xb4dd('0x9')]=_0x2fb8d5[_0xb4dd('0x9')]||'no';this[_0xb4dd('0xa')]=_0x2fb8d5[_0xb4dd('0xa')]||'no';this[_0xb4dd('0xb')]=_0x2fb8d5['t38timeout']||0x1388;this['tech']=_0x2fb8d5[_0xb4dd('0xc')]||'SIP';this[_0xb4dd('0xd')]=_0x2fb8d5[_0xb4dd('0xd')]?_0x2fb8d5[_0xb4dd('0xd')]:undefined;this[_0xb4dd('0xe')]=_0x2fb8d5[_0xb4dd('0xe')];this[_0xb4dd('0xf')]=_0x2fb8d5[_0xb4dd('0xf')];}module[_0xb4dd('0x10')]=FaxAccount; \ No newline at end of file +var _0x9314=['key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','tech','SIP','Trunk','ListId'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x9314,0x178));var _0x4931=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9314[_0x4f9b18];return _0x29f20c;};'use strict';function FaxAccount(_0xdec108){this['id']=_0xdec108['id']||0x0;this['name']=_0xdec108[_0x4931('0x0')]||'';this[_0x4931('0x1')]=_0xdec108[_0x4931('0x1')];this[_0x4931('0x2')]=_0xdec108['ecm'];this[_0x4931('0x3')]=_0xdec108[_0x4931('0x3')];this[_0x4931('0x4')]=_0xdec108[_0x4931('0x4')];this[_0x4931('0x5')]=_0xdec108[_0x4931('0x5')]||0x960;this[_0x4931('0x6')]=_0xdec108[_0x4931('0x6')]||0x3840;this[_0x4931('0x7')]=_0xdec108[_0x4931('0x7')]||_0x4931('0x8');this[_0x4931('0x9')]=_0xdec108[_0x4931('0x9')]||'no';this[_0x4931('0xa')]=_0xdec108[_0x4931('0xa')]||'no';this['t38timeout']=_0xdec108['t38timeout']||0x1388;this[_0x4931('0xb')]=_0xdec108[_0x4931('0xb')]||_0x4931('0xc');this[_0x4931('0xd')]=_0xdec108[_0x4931('0xd')]?_0xdec108[_0x4931('0xd')]:undefined;this['ListId']=_0xdec108[_0x4931('0xe')];this[_0x4931('0xf')]=_0xdec108['key'];}module[_0x4931('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 70a84d3..80da208 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 _0x700c=['exports','name','username','apiKey','token','remoteUri','Configurations'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0x700c,0x127));var _0xc700=function(_0x306ee6,_0x16febb){_0x306ee6=_0x306ee6-0x0;var _0x47ab12=_0x700c[_0x306ee6];return _0x47ab12;};'use strict';function FreshdeskAccount(_0x176535){this['id']=_0x176535['id']||0x0;this[_0xc700('0x0')]=_0x176535[_0xc700('0x0')]||'';this[_0xc700('0x1')]=_0x176535[_0xc700('0x1')]||'';this[_0xc700('0x2')]=_0x176535[_0xc700('0x3')]||'';this[_0xc700('0x4')]=_0x176535[_0xc700('0x4')]||'';this['serverUrl']=_0x176535['serverUrl']||'';this[_0xc700('0x5')]=_0x176535['Configurations']||{};}module[_0xc700('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xc9f8=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x542b1b,_0x3b3727){var _0x40f1d5=function(_0x2fd70e){while(--_0x2fd70e){_0x542b1b['push'](_0x542b1b['shift']());}};_0x40f1d5(++_0x3b3727);}(_0xc9f8,0xf8));var _0x8c9f=function(_0x33f160,_0x2d3884){_0x33f160=_0x33f160-0x0;var _0x3241a9=_0xc9f8[_0x33f160];return _0x3241a9;};'use strict';function FreshdeskAccount(_0x13865d){this['id']=_0x13865d['id']||0x0;this[_0x8c9f('0x0')]=_0x13865d[_0x8c9f('0x0')]||'';this[_0x8c9f('0x1')]=_0x13865d['username']||'';this[_0x8c9f('0x2')]=_0x13865d['token']||'';this[_0x8c9f('0x3')]=_0x13865d[_0x8c9f('0x3')]||'';this[_0x8c9f('0x4')]=_0x13865d[_0x8c9f('0x4')]||'';this[_0x8c9f('0x5')]=_0x13865d[_0x8c9f('0x5')]||{};}module[_0x8c9f('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 13ec3ac..c03be9e 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 _0x6d19=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x6d19,0x160));var _0x96d1=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0x6d19[_0x5d860f];return _0x236490;};'use strict';function FreshsalesAccount(_0x92d742){this['id']=_0x92d742['id']||0x0;this[_0x96d1('0x0')]=_0x92d742[_0x96d1('0x0')]||'';this[_0x96d1('0x1')]=_0x92d742[_0x96d1('0x1')]||'';this[_0x96d1('0x2')]=_0x92d742[_0x96d1('0x3')]||'';this['remoteUri']=_0x92d742[_0x96d1('0x4')]||'';this[_0x96d1('0x5')]=_0x92d742[_0x96d1('0x5')]||'';this[_0x96d1('0x6')]=_0x92d742['Configurations']||{};}module[_0x96d1('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x27c9=['token','remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x59609a,_0xbd79db){var _0x5328bb=function(_0x502109){while(--_0x502109){_0x59609a['push'](_0x59609a['shift']());}};_0x5328bb(++_0xbd79db);}(_0x27c9,0x1af));var _0x927c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x27c9[_0x126558];return _0x1f6d14;};'use strict';function FreshsalesAccount(_0xef3ee0){this['id']=_0xef3ee0['id']||0x0;this[_0x927c('0x0')]=_0xef3ee0[_0x927c('0x0')]||'';this[_0x927c('0x1')]=_0xef3ee0['username']||'';this[_0x927c('0x2')]=_0xef3ee0[_0x927c('0x3')]||'';this['remoteUri']=_0xef3ee0[_0x927c('0x4')]||'';this[_0x927c('0x5')]=_0xef3ee0[_0x927c('0x5')]||'';this[_0x927c('0x6')]=_0xef3ee0[_0x927c('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 6f4d5cc..ccafe16 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 _0xea49=['calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinename','accountcode','context','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','variables','exports','type','inbound','uniqueid'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xea49,0x1a6));var _0x9ea4=function(_0x2f0244,_0x5c752b){_0x2f0244=_0x2f0244-0x0;var _0x1699a1=_0xea49[_0x2f0244];return _0x1699a1;};'use strict';function QueueReport(){this[_0x9ea4('0x0')]=_0x9ea4('0x1');this[_0x9ea4('0x2')]='';this['calleridnum']='';this[_0x9ea4('0x3')]='';this[_0x9ea4('0x4')]='';this[_0x9ea4('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x9ea4('0x6')]=0x1;this[_0x9ea4('0x7')]=0x1;this[_0x9ea4('0x8')]=![];this[_0x9ea4('0x9')]=null;this['queuecallercomplete']=![];this[_0x9ea4('0xa')]=null;this[_0x9ea4('0xb')]=![];this[_0x9ea4('0xc')]=null;this['originalposition']=0x1;this[_0x9ea4('0xd')]='';this['connectedlinenum']='';this[_0x9ea4('0xe')]='';this[_0x9ea4('0xf')]='';this[_0x9ea4('0x10')]='';this['exten']='';this[_0x9ea4('0x11')]='';this[_0x9ea4('0x12')]=0x0;this[_0x9ea4('0x13')]=![];this[_0x9ea4('0x14')]='';this[_0x9ea4('0x15')]=_0x9ea4('0x16');this['mohtime']=0x0;this[_0x9ea4('0x17')]={};}module[_0x9ea4('0x18')]=QueueReport; \ No newline at end of file +var _0x8432=['exports','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','voice','mohtime','variables'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0x8432,0x1a5));var _0x2843=function(_0x1fec1e,_0xce18d2){_0x1fec1e=_0x1fec1e-0x0;var _0x31f9ec=_0x8432[_0x1fec1e];return _0x31f9ec;};'use strict';function QueueReport(){this['type']=_0x2843('0x0');this[_0x2843('0x1')]='';this['calleridnum']='';this[_0x2843('0x2')]='';this[_0x2843('0x3')]='';this[_0x2843('0x4')]=null;this[_0x2843('0x5')]=null;this[_0x2843('0x6')]=0x1;this[_0x2843('0x7')]=0x1;this[_0x2843('0x8')]=![];this[_0x2843('0x9')]=null;this[_0x2843('0xa')]=![];this[_0x2843('0xb')]=null;this[_0x2843('0xc')]=![];this[_0x2843('0xd')]=null;this['originalposition']=0x1;this[_0x2843('0xe')]='';this[_0x2843('0xf')]='';this[_0x2843('0x10')]='';this[_0x2843('0x11')]='';this[_0x2843('0x12')]='';this[_0x2843('0x13')]='';this[_0x2843('0x14')]='';this[_0x2843('0x15')]=0x0;this[_0x2843('0x16')]=![];this[_0x2843('0x17')]='';this['motionChannel']=_0x2843('0x18');this[_0x2843('0x19')]=0x0;this[_0x2843('0x1a')]={};}module[_0x2843('0x1b')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 9bcf59b..861b593 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 _0xe66c=['clientId','clientSecret','securityToken','integrationTab','serverUrl','username','remoteUri','password'];(function(_0x573337,_0x1671e5){var _0x37390d=function(_0x611dcc){while(--_0x611dcc){_0x573337['push'](_0x573337['shift']());}};_0x37390d(++_0x1671e5);}(_0xe66c,0x105));var _0xce66=function(_0x3f43c5,_0xc8562d){_0x3f43c5=_0x3f43c5-0x0;var _0xfe9ec=_0xe66c[_0x3f43c5];return _0xfe9ec;};'use strict';function SalesforceAccount(_0x54e052){this['id']=_0x54e052['id']||0x0;this['name']=_0x54e052['name']||'';this[_0xce66('0x0')]=_0x54e052[_0xce66('0x0')]||'';this[_0xce66('0x1')]=_0x54e052[_0xce66('0x1')]||'';this[_0xce66('0x2')]=_0x54e052[_0xce66('0x2')]||'';this[_0xce66('0x3')]=_0x54e052[_0xce66('0x3')]||'';this['clientSecret']=_0x54e052[_0xce66('0x4')]||'';this[_0xce66('0x5')]=_0x54e052['securityToken']||'';this['type']=_0x54e052['type']||_0xce66('0x6');this[_0xce66('0x7')]=_0x54e052[_0xce66('0x7')]||'';this['Configurations']=_0x54e052['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x9527=['username','remoteUri','password','clientId','clientSecret','type','integrationTab','serverUrl','Configurations','name'];(function(_0x1ffeb8,_0x1d9e0b){var _0x4a6ce7=function(_0x3372f9){while(--_0x3372f9){_0x1ffeb8['push'](_0x1ffeb8['shift']());}};_0x4a6ce7(++_0x1d9e0b);}(_0x9527,0x135));var _0x7952=function(_0x1631a6,_0x1a4161){_0x1631a6=_0x1631a6-0x0;var _0xd9bda1=_0x9527[_0x1631a6];return _0xd9bda1;};'use strict';function SalesforceAccount(_0xd1912){this['id']=_0xd1912['id']||0x0;this[_0x7952('0x0')]=_0xd1912[_0x7952('0x0')]||'';this[_0x7952('0x1')]=_0xd1912['username']||'';this[_0x7952('0x2')]=_0xd1912[_0x7952('0x2')]||'';this[_0x7952('0x3')]=_0xd1912[_0x7952('0x3')]||'';this[_0x7952('0x4')]=_0xd1912['clientId']||'';this[_0x7952('0x5')]=_0xd1912[_0x7952('0x5')]||'';this['securityToken']=_0xd1912['securityToken']||'';this['type']=_0xd1912[_0x7952('0x6')]||_0x7952('0x7');this[_0x7952('0x8')]=_0xd1912[_0x7952('0x8')]||'';this[_0x7952('0x9')]=_0xd1912[_0x7952('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 5b5933c..b8aeceb 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 _0x91cd=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x5a40d7,_0x4c343f){var _0x29982f=function(_0x4a8aaf){while(--_0x4a8aaf){_0x5a40d7['push'](_0x5a40d7['shift']());}};_0x29982f(++_0x4c343f);}(_0x91cd,0xeb));var _0xd91c=function(_0x3cd91d,_0x163516){_0x3cd91d=_0x3cd91d-0x0;var _0x3b4fab=_0x91cd[_0x3cd91d];return _0x3b4fab;};'use strict';function ServicenowAccount(_0x5987a0){this['id']=_0x5987a0['id']||0x0;this['name']=_0x5987a0[_0xd91c('0x0')]||'';this['username']=_0x5987a0[_0xd91c('0x1')]||'';this[_0xd91c('0x2')]=_0x5987a0[_0xd91c('0x2')]||'';this[_0xd91c('0x3')]=_0x5987a0[_0xd91c('0x3')]||'';this[_0xd91c('0x4')]=_0x5987a0['serverUrl']||'';this[_0xd91c('0x5')]=_0x5987a0[_0xd91c('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xa66a=['username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x22a89b,_0x3e370d){var _0x2597a8=function(_0x19f421){while(--_0x19f421){_0x22a89b['push'](_0x22a89b['shift']());}};_0x2597a8(++_0x3e370d);}(_0xa66a,0x1d4));var _0xaa66=function(_0x4291a1,_0x5179a9){_0x4291a1=_0x4291a1-0x0;var _0x1fc720=_0xa66a[_0x4291a1];return _0x1fc720;};'use strict';function ServicenowAccount(_0x5a2562){this['id']=_0x5a2562['id']||0x0;this['name']=_0x5a2562['name']||'';this['username']=_0x5a2562[_0xaa66('0x0')]||'';this[_0xaa66('0x1')]=_0x5a2562[_0xaa66('0x1')]||'';this['remoteUri']=_0x5a2562[_0xaa66('0x2')]||'';this[_0xaa66('0x3')]=_0x5a2562[_0xaa66('0x3')]||'';this[_0xaa66('0x4')]=_0x5a2562[_0xaa66('0x4')]||{};}module[_0xaa66('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index a916323..b87c3a2 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 _0xd9f2=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd9f2,0x111));var _0x2d9f=function(_0x4a6400,_0x5bf830){_0x4a6400=_0x4a6400-0x0;var _0x4b30bc=_0xd9f2[_0x4a6400];return _0x4b30bc;};'use strict';function SugarcrmAccount(_0x342d27){this['id']=_0x342d27['id']||0x0;this['name']=_0x342d27[_0x2d9f('0x0')]||'';this[_0x2d9f('0x1')]=_0x342d27[_0x2d9f('0x1')]||'';this[_0x2d9f('0x2')]=_0x342d27[_0x2d9f('0x2')]||'';this[_0x2d9f('0x3')]=_0x342d27[_0x2d9f('0x3')]||'';this[_0x2d9f('0x4')]=_0x342d27[_0x2d9f('0x4')]||'';this[_0x2d9f('0x5')]=_0x342d27[_0x2d9f('0x5')]||{};}module[_0x2d9f('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x3e8a=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0xd839e7,_0x4209e9){var _0xc3cf23=function(_0x16ace2){while(--_0x16ace2){_0xd839e7['push'](_0xd839e7['shift']());}};_0xc3cf23(++_0x4209e9);}(_0x3e8a,0x9e));var _0xa3e8=function(_0x5cf209,_0x274212){_0x5cf209=_0x5cf209-0x0;var _0x2ac22d=_0x3e8a[_0x5cf209];return _0x2ac22d;};'use strict';function SugarcrmAccount(_0x4f33fa){this['id']=_0x4f33fa['id']||0x0;this[_0xa3e8('0x0')]=_0x4f33fa[_0xa3e8('0x0')]||'';this[_0xa3e8('0x1')]=_0x4f33fa[_0xa3e8('0x1')]||'';this['password']=_0x4f33fa[_0xa3e8('0x2')]||'';this['remoteUri']=_0x4f33fa[_0xa3e8('0x3')]||'';this[_0xa3e8('0x4')]=_0x4f33fa[_0xa3e8('0x4')]||'';this[_0xa3e8('0x5')]=_0x4f33fa[_0xa3e8('0x5')]||{};}module[_0xa3e8('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 f7f0ad4..09d2958 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 _0x51b1=['state','unknown','stateTime','exports','name','accountcode'];(function(_0x2f04a4,_0x1be47e){var _0x5dde34=function(_0x2aac62){while(--_0x2aac62){_0x2f04a4['push'](_0x2f04a4['shift']());}};_0x5dde34(++_0x1be47e);}(_0x51b1,0xf4));var _0x151b=function(_0x136a23,_0x507cda){_0x136a23=_0x136a23-0x0;var _0x48e69b=_0x51b1[_0x136a23];return _0x48e69b;};'use strict';function Telephone(_0x150751){this['id']=_0x150751['id']||0x0;this[_0x151b('0x0')]=_0x150751[_0x151b('0x0')]||'';this[_0x151b('0x1')]=_0x150751['accountcode']||'';this[_0x151b('0x2')]=_0x151b('0x3');this[_0x151b('0x4')]=0x0;this['status']=_0x151b('0x3');this['address']='';}module[_0x151b('0x5')]=Telephone; \ No newline at end of file +var _0x5393=['stateTime','status','address','exports','name','accountcode','unknown'];(function(_0xc05d8d,_0x2d8668){var _0x58d54=function(_0x76a70c){while(--_0x76a70c){_0xc05d8d['push'](_0xc05d8d['shift']());}};_0x58d54(++_0x2d8668);}(_0x5393,0x1b6));var _0x3539=function(_0x1756bc,_0x20be9b){_0x1756bc=_0x1756bc-0x0;var _0x41564a=_0x5393[_0x1756bc];return _0x41564a;};'use strict';function Telephone(_0x4269e1){this['id']=_0x4269e1['id']||0x0;this[_0x3539('0x0')]=_0x4269e1['name']||'';this['accountcode']=_0x4269e1[_0x3539('0x1')]||'';this['state']=_0x3539('0x2');this[_0x3539('0x3')]=0x0;this[_0x3539('0x4')]=_0x3539('0x2');this[_0x3539('0x5')]='';}module[_0x3539('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 21499a4..342b64c 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 _0xb10b=['name','html'];(function(_0x3adecb,_0x6262a5){var _0xce5ec5=function(_0x39d648){while(--_0x39d648){_0x3adecb['push'](_0x3adecb['shift']());}};_0xce5ec5(++_0x6262a5);}(_0xb10b,0x12a));var _0xbb10=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xb10b[_0x2fc012];return _0x2891f9;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0xdc3083,_0x9fa8c3){var _0x298fb3=function(_0x2b4623){while(--_0x2b4623){_0xdc3083['push'](_0xdc3083['shift']());}};_0x298fb3(++_0x9fa8c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 3944bdf..565d97f 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 _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x1db481,_0x1627b2){var _0x3db95b=function(_0x2d54e4){while(--_0x2d54e4){_0x1db481['push'](_0x1db481['shift']());}};_0x3db95b(++_0x1627b2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x1d1f04,_0x9d3533){var _0x448de6=function(_0x5d6300){while(--_0x5d6300){_0x1d1f04['push'](_0x1d1f04['shift']());}};_0x448de6(++_0x9d3533);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xb7e7[_0x3ab9ee];return _0x82ee88;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index dd3665f..8d918a3 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 _0x773d=['host','domainport','refresh','stateRegistry','defaultuser','exports','active','name','state','unknown','stateTime','registry','indexOf'];(function(_0x1098ee,_0x44e329){var _0x27798f=function(_0x28f275){while(--_0x28f275){_0x1098ee['push'](_0x1098ee['shift']());}};_0x27798f(++_0x44e329);}(_0x773d,0x172));var _0xd773=function(_0x48bdc9,_0x5531e6){_0x48bdc9=_0x48bdc9-0x0;var _0x4b9f62=_0x773d[_0x48bdc9];return _0x4b9f62;};'use strict';function Trunk(_0x1bd148){this['id']=_0x1bd148['id']||0x0;this['active']=_0x1bd148[_0xd773('0x0')]||![];this[_0xd773('0x1')]=_0x1bd148[_0xd773('0x1')]||'';this[_0xd773('0x2')]=_0xd773('0x3');this[_0xd773('0x4')]=0x0;this['status']='unknown';this[_0xd773('0x5')]=_0x1bd148[_0xd773('0x5')]&&_0x1bd148[_0xd773('0x5')][_0xd773('0x6')](':')?_0x1bd148['registry']['split'](':')[0x0]:'';this[_0xd773('0x7')]='';this['port']='';this['domain']='';this[_0xd773('0x8')]='';this[_0xd773('0x9')]='';this[_0xd773('0xa')]='unknown';this['registrationtime']='';this['address']='';this[_0xd773('0xb')]=_0x1bd148[_0xd773('0xb')]||'';}module[_0xd773('0xc')]=Trunk; \ No newline at end of file +var _0xe4b2=['registry','indexOf','port','domain','domainport','stateRegistry','registrationtime','address','defaultuser','active','name','state','unknown','stateTime','status'];(function(_0x5cde12,_0x46e9c0){var _0x47b9d1=function(_0x10c2d1){while(--_0x10c2d1){_0x5cde12['push'](_0x5cde12['shift']());}};_0x47b9d1(++_0x46e9c0);}(_0xe4b2,0x81));var _0x2e4b=function(_0x4fa1ff,_0xb6f371){_0x4fa1ff=_0x4fa1ff-0x0;var _0x2d8704=_0xe4b2[_0x4fa1ff];return _0x2d8704;};'use strict';function Trunk(_0x1bb24d){this['id']=_0x1bb24d['id']||0x0;this[_0x2e4b('0x0')]=_0x1bb24d[_0x2e4b('0x0')]||![];this[_0x2e4b('0x1')]=_0x1bb24d[_0x2e4b('0x1')]||'';this[_0x2e4b('0x2')]=_0x2e4b('0x3');this[_0x2e4b('0x4')]=0x0;this[_0x2e4b('0x5')]='unknown';this['registry']=_0x1bb24d[_0x2e4b('0x6')]&&_0x1bb24d[_0x2e4b('0x6')][_0x2e4b('0x7')](':')?_0x1bb24d[_0x2e4b('0x6')]['split'](':')[0x0]:'';this['host']='';this[_0x2e4b('0x8')]='';this[_0x2e4b('0x9')]='';this[_0x2e4b('0xa')]='';this['refresh']='';this[_0x2e4b('0xb')]=_0x2e4b('0x3');this[_0x2e4b('0xc')]='';this[_0x2e4b('0xd')]='';this[_0x2e4b('0xe')]=_0x1bb24d[_0x2e4b('0xe')]||'';}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 6b83787..767d5e2 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 _0x87f6=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x3cd09,_0x73265e){var _0xcc3a04=function(_0x4f19cd){while(--_0x4f19cd){_0x3cd09['push'](_0x3cd09['shift']());}};_0xcc3a04(++_0x73265e);}(_0x87f6,0x125));var _0x687f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x87f6[_0x3b380d];return _0x54502b;};'use strict';function voiceExtension(_0x4d8b57){this['id']=_0x4d8b57['id']||0x0;this[_0x687f('0x0')]=_0x4d8b57['exten']||'';this[_0x687f('0x1')]=_0x4d8b57[_0x687f('0x1')]||_0x687f('0x2');this[_0x687f('0x3')]=_0x4d8b57['mandatoryDisposition']||![];}module[_0x687f('0x4')]=voiceExtension; \ No newline at end of file +var _0x047e=['mandatoryDisposition','exten','recordingFormat'];(function(_0x198f6f,_0x941a94){var _0x2f38f7=function(_0x8eead0){while(--_0x8eead0){_0x198f6f['push'](_0x198f6f['shift']());}};_0x2f38f7(++_0x941a94);}(_0x047e,0x13f));var _0xe047=function(_0x2af981,_0x59d094){_0x2af981=_0x2af981-0x0;var _0x5d30b9=_0x047e[_0x2af981];return _0x5d30b9;};'use strict';function voiceExtension(_0x442008){this['id']=_0x442008['id']||0x0;this[_0xe047('0x0')]=_0x442008[_0xe047('0x0')]||'';this['recordingFormat']=_0x442008[_0xe047('0x1')]||'none';this[_0xe047('0x2')]=_0x442008['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 8934375..cbc9370 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 _0x3e9c=['rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','total','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm'];(function(_0x575057,_0x14baf3){var _0x49dbc8=function(_0x23599a){while(--_0x23599a){_0x575057['push'](_0x575057['shift']());}};_0x49dbc8(++_0x14baf3);}(_0x3e9c,0x6f));var _0xc3e9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3e9c[_0x4565bf];return _0x5610ba;};'use strict';var statusDesc=[_0xc3e9('0x0'),_0xc3e9('0x1'),_0xc3e9('0x2'),_0xc3e9('0x3'),_0xc3e9('0x4'),_0xc3e9('0x5'),_0xc3e9('0x6'),_0xc3e9('0x7'),_0xc3e9('0x8')];var monitorFormat={'wav':_0xc3e9('0x9'),'wav49':_0xc3e9('0xa'),'gsm':_0xc3e9('0xb')};var strategy={'rrmemory':_0xc3e9('0xc'),'roundrobin':_0xc3e9('0xd')};function VoiceQueue(_0x41b9cc){this['id']=_0x41b9cc['id']||0x0;this[_0xc3e9('0xe')]=_0x41b9cc[_0xc3e9('0xe')]||'';this[_0xc3e9('0xf')]=_0x41b9cc['monitor_format']||'';this[_0xc3e9('0x10')]=_0x41b9cc[_0xc3e9('0x10')]||_0xc3e9('0x11');this[_0xc3e9('0x12')]=0x0;this['talking']=0x0;this[_0xc3e9('0x13')]=0x0;this['answered']=0x0;this[_0xc3e9('0x14')]=0x0;this[_0xc3e9('0x15')]=0x0;this[_0xc3e9('0x16')]=0x0;this[_0xc3e9('0x17')]=0x0;this[_0xc3e9('0x18')]=0x0;this[_0xc3e9('0x19')]=0x0;this[_0xc3e9('0x1a')]=0x0;this[_0xc3e9('0x1b')]=_0x41b9cc['acw']||![];this[_0xc3e9('0x1c')]=_0x41b9cc['acwTimeout']||0xa;this[_0xc3e9('0x1d')]=_0x41b9cc['autopause']||'no';this[_0xc3e9('0x1e')]=!![];this[_0xc3e9('0x1f')]='';this['originated']=0x0;this[_0xc3e9('0x20')]=0x0;this[_0xc3e9('0x21')]=_0x41b9cc[_0xc3e9('0x21')]||null;this[_0xc3e9('0x22')]=_0x41b9cc['dialGlobalInterval']?_0x41b9cc[_0xc3e9('0x22')]:null;this['dialActive']=_0x41b9cc[_0xc3e9('0x23')];this['dialMethod']=_0x41b9cc[_0xc3e9('0x24')]||_0xc3e9('0x25');this[_0xc3e9('0x26')]=_0x41b9cc[_0xc3e9('0x26')]||0x0;this[_0xc3e9('0x27')]=_0x41b9cc[_0xc3e9('0x27')]||0x0;this[_0xc3e9('0x28')]=_0x41b9cc[_0xc3e9('0x28')]||0x1;this[_0xc3e9('0x29')]=_0x41b9cc[_0xc3e9('0x29')]||_0xc3e9('0x2a');this[_0xc3e9('0x2b')]=_0x41b9cc[_0xc3e9('0x2b')]||0.03;this[_0xc3e9('0x2c')]=_0x41b9cc['dialPredictiveInterval']||0x258;this[_0xc3e9('0x2d')]=_0x41b9cc[_0xc3e9('0x2d')]||'anonymous';this[_0xc3e9('0x2e')]=_0x41b9cc[_0xc3e9('0x2e')]||_0xc3e9('0x2f');this[_0xc3e9('0x30')]=_0x41b9cc[_0xc3e9('0x30')]||0x1e;this[_0xc3e9('0x31')]=_0x41b9cc[_0xc3e9('0x31')]||_0xc3e9('0x32');this[_0xc3e9('0x33')]=_0x41b9cc['dialQueueTimeout']||0x3;this[_0xc3e9('0x34')]=_0x41b9cc[_0xc3e9('0x34')]||undefined;this['dialCongestionMaxRetry']=_0x41b9cc['dialCongestionMaxRetry']||0x3;this[_0xc3e9('0x35')]=_0x41b9cc['dialCongestionRetryFrequency']||0x96;this[_0xc3e9('0x36')]=_0x41b9cc[_0xc3e9('0x36')]||0x3;this[_0xc3e9('0x37')]=_0x41b9cc[_0xc3e9('0x37')]||0x96;this[_0xc3e9('0x38')]=_0x41b9cc[_0xc3e9('0x38')]||0x3;this['dialNoAnswerRetryFrequency']=_0x41b9cc['dialNoAnswerRetryFrequency']||0x96;this[_0xc3e9('0x39')]=_0x41b9cc[_0xc3e9('0x39')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x41b9cc[_0xc3e9('0x3a')]||0x96;this[_0xc3e9('0x3b')]=_0x41b9cc[_0xc3e9('0x3b')]||0x3;this[_0xc3e9('0x3c')]=_0x41b9cc[_0xc3e9('0x3c')]||0x96;this[_0xc3e9('0x3d')]=_0x41b9cc['dialAbandonedMaxRetry']||0x3;this[_0xc3e9('0x3e')]=_0x41b9cc[_0xc3e9('0x3e')]||0x96;this['dialMachineMaxRetry']=_0x41b9cc[_0xc3e9('0x3f')]||0x3;this[_0xc3e9('0x40')]=_0x41b9cc[_0xc3e9('0x40')]||0x96;this[_0xc3e9('0x41')]=_0x41b9cc['dialAgentRejectMaxRetry']||0x3;this[_0xc3e9('0x42')]=_0x41b9cc[_0xc3e9('0x42')]||0x96;this[_0xc3e9('0x43')]=_0x41b9cc[_0xc3e9('0x43')]||0x4;this[_0xc3e9('0x44')]=_0x41b9cc[_0xc3e9('0x44')]?_0x41b9cc[_0xc3e9('0x44')]:undefined;this[_0xc3e9('0x45')]=_0x41b9cc[_0xc3e9('0x45')]?_0x41b9cc[_0xc3e9('0x45')]:undefined;this[_0xc3e9('0x46')]=_0x41b9cc[_0xc3e9('0x46')]||undefined;this[_0xc3e9('0x47')]=_0x41b9cc[_0xc3e9('0x47')]?_0x41b9cc[_0xc3e9('0x47')]:undefined;this[_0xc3e9('0x48')]=_0x41b9cc[_0xc3e9('0x48')]||_0xc3e9('0x49');this[_0xc3e9('0x4a')]=_0x41b9cc['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x41b9cc['dialCutDigit']||undefined;this['strategy']=strategy[_0x41b9cc[_0xc3e9('0x4b')]]||_0xc3e9('0xc');this[_0xc3e9('0x4c')]=!![];this[_0xc3e9('0x4d')]=_0x41b9cc[_0xc3e9('0x4d')]||![];this[_0xc3e9('0x4e')]=_0x41b9cc[_0xc3e9('0x4e')];this['dialAMDGreeting']=_0x41b9cc[_0xc3e9('0x4f')];this[_0xc3e9('0x50')]=_0x41b9cc['dialAMDAfterGreetingSilence'];this[_0xc3e9('0x51')]=_0x41b9cc[_0xc3e9('0x51')];this['dialAMDMinWordLength']=_0x41b9cc[_0xc3e9('0x52')];this[_0xc3e9('0x53')]=_0x41b9cc[_0xc3e9('0x53')];this[_0xc3e9('0x54')]=_0x41b9cc[_0xc3e9('0x54')];this[_0xc3e9('0x55')]=_0x41b9cc[_0xc3e9('0x55')];this[_0xc3e9('0x56')]=_0x41b9cc[_0xc3e9('0x56')];this[_0xc3e9('0x57')]=0x0;this['pTalking']=0x0;this[_0xc3e9('0x58')]=_0x41b9cc[_0xc3e9('0x58')];this[_0xc3e9('0x59')]=0x0;this[_0xc3e9('0x5a')]=0x0;this[_0xc3e9('0x5b')]=0x0;this[_0xc3e9('0x5c')]=0x0;this[_0xc3e9('0x5d')]=0x0;this[_0xc3e9('0x5e')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xc3e9('0x5f')]=0x0;this[_0xc3e9('0x60')]=0x0;this[_0xc3e9('0x61')]=0x0;this[_0xc3e9('0x62')]=0x0;this[_0xc3e9('0x63')]=0x0;this[_0xc3e9('0x64')]=0x0;this['startProgressive']=undefined;this[_0xc3e9('0x65')]=undefined;this[_0xc3e9('0x66')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xc3e9('0x67')]=0x0;this[_0xc3e9('0x68')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xc3e9('0x69')]=0x0;this[_0xc3e9('0x6a')]=0x0;this[_0xc3e9('0x6b')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x41b9cc[_0xc3e9('0x6c')]||0x14;this[_0xc3e9('0x6d')]=_0x41b9cc[_0xc3e9('0x6c')]||0xa;this[_0xc3e9('0x6e')]=0x0;this[_0xc3e9('0x6f')]=0x0;this[_0xc3e9('0x70')]=0x1;this['erlangCalls']=0x0;this[_0xc3e9('0x71')]=0x0;this[_0xc3e9('0x72')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x41b9cc[_0xc3e9('0x73')]||0x1e;this[_0xc3e9('0x74')]=_0x41b9cc['dialRecallInQueue']||![];this[_0xc3e9('0x75')]=_0x41b9cc[_0xc3e9('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x41b9cc[_0xc3e9('0x76')]||![];this[_0xc3e9('0x77')]=_0x41b9cc[_0xc3e9('0x77')]||![];this[_0xc3e9('0xf')]=monitorFormat[_0x41b9cc[_0xc3e9('0xf')]]?monitorFormat[_0x41b9cc[_0xc3e9('0xf')]]:undefined;this[_0xc3e9('0x78')]=_0x41b9cc[_0xc3e9('0x78')]||![];this[_0xc3e9('0x79')]=_0x41b9cc[_0xc3e9('0x79')]?_0x41b9cc['mandatoryDispositionPause']:undefined;}module[_0xc3e9('0x7a')]=VoiceQueue; \ No newline at end of file +var _0xdea1=['predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','roundrobin','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','message','temp','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','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','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor'];(function(_0x3d4147,_0x253d46){var _0x3fe857=function(_0x285599){while(--_0x285599){_0x3d4147['push'](_0x3d4147['shift']());}};_0x3fe857(++_0x253d46);}(_0xdea1,0x82));var _0x1dea=function(_0x420479,_0x5a3ace){_0x420479=_0x420479-0x0;var _0x42c763=_0xdea1[_0x420479];return _0x42c763;};'use strict';var statusDesc=[_0x1dea('0x0'),_0x1dea('0x1'),_0x1dea('0x2'),'busy','invalid',_0x1dea('0x3'),_0x1dea('0x4'),_0x1dea('0x5'),_0x1dea('0x6')];var monitorFormat={'wav':_0x1dea('0x7'),'wav49':_0x1dea('0x8'),'gsm':'gsm'};var strategy={'rrmemory':_0x1dea('0x9'),'roundrobin':_0x1dea('0xa')};function VoiceQueue(_0x1f26c5){this['id']=_0x1f26c5['id']||0x0;this['name']=_0x1f26c5['name']||'';this[_0x1dea('0xb')]=_0x1f26c5[_0x1dea('0xb')]||'';this[_0x1dea('0xc')]=_0x1f26c5['type']||_0x1dea('0xd');this[_0x1dea('0xe')]=0x0;this[_0x1dea('0xf')]=0x0;this[_0x1dea('0x10')]=0x0;this[_0x1dea('0x11')]=0x0;this[_0x1dea('0x12')]=0x0;this[_0x1dea('0x13')]=0x0;this[_0x1dea('0x14')]=0x0;this['unmanaged']=0x0;this[_0x1dea('0x15')]=0x0;this[_0x1dea('0x16')]=0x0;this[_0x1dea('0x17')]=0x0;this[_0x1dea('0x18')]=_0x1f26c5[_0x1dea('0x18')]||![];this[_0x1dea('0x19')]=_0x1f26c5[_0x1dea('0x19')]||0xa;this['autopause']=_0x1f26c5['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x1dea('0x1a')]='';this['originated']=0x0;this[_0x1dea('0x1b')]=0x0;this['dialTimezone']=_0x1f26c5['dialTimezone']||null;this['dialGlobalInterval']=_0x1f26c5['dialGlobalInterval']?_0x1f26c5['dialGlobalInterval']:null;this[_0x1dea('0x1c')]=_0x1f26c5[_0x1dea('0x1c')];this[_0x1dea('0x1d')]=_0x1f26c5[_0x1dea('0x1d')]||'progressive';this[_0x1dea('0x1e')]=_0x1f26c5[_0x1dea('0x1e')]||0x0;this[_0x1dea('0x1f')]=_0x1f26c5['dialLimitQueue']||0x0;this[_0x1dea('0x20')]=_0x1f26c5[_0x1dea('0x20')]||0x1;this[_0x1dea('0x21')]=_0x1f26c5['dialPredictiveOptimization']||_0x1dea('0x22');this[_0x1dea('0x23')]=_0x1f26c5[_0x1dea('0x23')]||0.03;this[_0x1dea('0x24')]=_0x1f26c5[_0x1dea('0x24')]||0x258;this[_0x1dea('0x25')]=_0x1f26c5[_0x1dea('0x25')]||_0x1dea('0x26');this[_0x1dea('0x27')]=_0x1f26c5[_0x1dea('0x27')]||_0x1dea('0x26');this['dialOriginateTimeout']=_0x1f26c5['dialOriginateTimeout']||0x1e;this[_0x1dea('0x28')]=_0x1f26c5[_0x1dea('0x28')]||'tTxX';this[_0x1dea('0x29')]=_0x1f26c5[_0x1dea('0x29')]||0x3;this[_0x1dea('0x2a')]=_0x1f26c5[_0x1dea('0x2a')]||undefined;this[_0x1dea('0x2b')]=_0x1f26c5['dialCongestionMaxRetry']||0x3;this[_0x1dea('0x2c')]=_0x1f26c5[_0x1dea('0x2c')]||0x96;this[_0x1dea('0x2d')]=_0x1f26c5[_0x1dea('0x2d')]||0x3;this[_0x1dea('0x2e')]=_0x1f26c5[_0x1dea('0x2e')]||0x96;this[_0x1dea('0x2f')]=_0x1f26c5[_0x1dea('0x2f')]||0x3;this[_0x1dea('0x30')]=_0x1f26c5[_0x1dea('0x30')]||0x96;this[_0x1dea('0x31')]=_0x1f26c5[_0x1dea('0x31')]||0x3;this[_0x1dea('0x32')]=_0x1f26c5[_0x1dea('0x32')]||0x96;this[_0x1dea('0x33')]=_0x1f26c5[_0x1dea('0x33')]||0x3;this[_0x1dea('0x34')]=_0x1f26c5[_0x1dea('0x34')]||0x96;this[_0x1dea('0x35')]=_0x1f26c5['dialAbandonedMaxRetry']||0x3;this[_0x1dea('0x36')]=_0x1f26c5[_0x1dea('0x36')]||0x96;this[_0x1dea('0x37')]=_0x1f26c5[_0x1dea('0x37')]||0x3;this[_0x1dea('0x38')]=_0x1f26c5[_0x1dea('0x38')]||0x96;this[_0x1dea('0x39')]=_0x1f26c5['dialAgentRejectMaxRetry']||0x3;this[_0x1dea('0x3a')]=_0x1f26c5[_0x1dea('0x3a')]||0x96;this[_0x1dea('0x3b')]=_0x1f26c5[_0x1dea('0x3b')]||0x4;this['Trunk']=_0x1f26c5[_0x1dea('0x3c')]?_0x1f26c5['Trunk']:undefined;this['TrunkBackup']=_0x1f26c5[_0x1dea('0x3d')]?_0x1f26c5[_0x1dea('0x3d')]:undefined;this[_0x1dea('0x3e')]=_0x1f26c5['dialPrefix']||undefined;this[_0x1dea('0x3f')]=_0x1f26c5[_0x1dea('0x3f')]?_0x1f26c5[_0x1dea('0x3f')]:undefined;this[_0x1dea('0x40')]=_0x1f26c5['dialOrderByScheduledAt']||_0x1dea('0x41');this[_0x1dea('0x42')]=_0x1f26c5[_0x1dea('0x42')]||undefined;this[_0x1dea('0x43')]=_0x1f26c5[_0x1dea('0x43')]||undefined;this['strategy']=strategy[_0x1f26c5[_0x1dea('0x44')]]||'rrmemory';this[_0x1dea('0x45')]=!![];this[_0x1dea('0x46')]=_0x1f26c5[_0x1dea('0x46')]||![];this[_0x1dea('0x47')]=_0x1f26c5[_0x1dea('0x47')];this['dialAMDGreeting']=_0x1f26c5[_0x1dea('0x48')];this[_0x1dea('0x49')]=_0x1f26c5[_0x1dea('0x49')];this[_0x1dea('0x4a')]=_0x1f26c5[_0x1dea('0x4a')];this['dialAMDMinWordLength']=_0x1f26c5[_0x1dea('0x4b')];this[_0x1dea('0x4c')]=_0x1f26c5[_0x1dea('0x4c')];this[_0x1dea('0x4d')]=_0x1f26c5[_0x1dea('0x4d')];this[_0x1dea('0x4e')]=_0x1f26c5['dialAMDSilenceThreshold'];this[_0x1dea('0x4f')]=_0x1f26c5[_0x1dea('0x4f')];this['outboundRejectCallsDay']=0x0;this[_0x1dea('0x50')]=0x0;this['timeout']=_0x1f26c5[_0x1dea('0x51')];this[_0x1dea('0x52')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x1dea('0x53')]=0x0;this[_0x1dea('0x54')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x1dea('0x55')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x1dea('0x56')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x1dea('0x57')]=0x0;this[_0x1dea('0x58')]=0x0;this[_0x1dea('0x59')]=0x0;this[_0x1dea('0x5a')]=0x0;this['startProgressive']=undefined;this[_0x1dea('0x5b')]=undefined;this[_0x1dea('0x5c')]=undefined;this[_0x1dea('0x5d')]=1.05;this[_0x1dea('0x5e')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x1dea('0x5f')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x1dea('0x60')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x1dea('0x61')]=0x0;this[_0x1dea('0x62')]=0x0;this[_0x1dea('0x63')]=_0x1f26c5[_0x1dea('0x64')]||0x14;this['predictiveIntervalMinThreshold']=_0x1f26c5[_0x1dea('0x64')]||0xa;this[_0x1dea('0x65')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x1dea('0x66')]=0x1;this['erlangCalls']=0x0;this[_0x1dea('0x67')]=0x0;this[_0x1dea('0x68')]=0x0;this['erlangBusyFactor']=0x0;this[_0x1dea('0x69')]=_0x1f26c5['dialRecallMeTimeout']||0x1e;this[_0x1dea('0x6a')]=_0x1f26c5[_0x1dea('0x6a')]||![];this['dialQueueProject2']=_0x1f26c5[_0x1dea('0x6b')]||undefined;this[_0x1dea('0x6c')]=_0x1f26c5[_0x1dea('0x6c')]||![];this[_0x1dea('0x6d')]=_0x1f26c5[_0x1dea('0x6d')]||![];this[_0x1dea('0xb')]=monitorFormat[_0x1f26c5['monitor_format']]?monitorFormat[_0x1f26c5[_0x1dea('0xb')]]:undefined;this['mandatoryDisposition']=_0x1f26c5[_0x1dea('0x6e')]||![];this['mandatoryDispositionPause']=_0x1f26c5[_0x1dea('0x6f')]?_0x1f26c5[_0x1dea('0x6f')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index d206610..74f6950 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 _0xf3d8=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xf3d8,0xdd));var _0x8f3d=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0xf3d8[_0x5466ab];return _0x40751a;};'use strict';function VtigerAccount(_0x44850c){this['id']=_0x44850c['id']||0x0;this[_0x8f3d('0x0')]=_0x44850c[_0x8f3d('0x0')]||'';this[_0x8f3d('0x1')]=_0x44850c[_0x8f3d('0x1')]||'';this[_0x8f3d('0x2')]=_0x44850c[_0x8f3d('0x2')]||'';this[_0x8f3d('0x3')]=_0x44850c[_0x8f3d('0x3')]||'';this['serverUrl']=_0x44850c[_0x8f3d('0x4')]||'';this[_0x8f3d('0x5')]=_0x44850c['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xcbe7=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x3b0912,_0x39d739){var _0xa8f339=function(_0x6a31ab){while(--_0x6a31ab){_0x3b0912['push'](_0x3b0912['shift']());}};_0xa8f339(++_0x39d739);}(_0xcbe7,0xd5));var _0x7cbe=function(_0x3160cf,_0x41a8b2){_0x3160cf=_0x3160cf-0x0;var _0x1e39c4=_0xcbe7[_0x3160cf];return _0x1e39c4;};'use strict';function VtigerAccount(_0xb25add){this['id']=_0xb25add['id']||0x0;this[_0x7cbe('0x0')]=_0xb25add[_0x7cbe('0x0')]||'';this[_0x7cbe('0x1')]=_0xb25add['username']||'';this['accessKey']=_0xb25add[_0x7cbe('0x2')]||'';this['remoteUri']=_0xb25add[_0x7cbe('0x3')]||'';this[_0x7cbe('0x4')]=_0xb25add['serverUrl']||'';this['Configurations']=_0xb25add[_0x7cbe('0x5')]||{};}module[_0x7cbe('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 429ab4b..4669f76 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 _0x42d4=['username','password','token','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x5266e7,_0x97b16b){var _0x5470f1=function(_0x10258e){while(--_0x10258e){_0x5266e7['push'](_0x5266e7['shift']());}};_0x5470f1(++_0x97b16b);}(_0x42d4,0x170));var _0x442d=function(_0x5d708c,_0x513fda){_0x5d708c=_0x5d708c-0x0;var _0x16d4a4=_0x42d4[_0x5d708c];return _0x16d4a4;};'use strict';function ZendeskAccount(_0x4449fd){this['id']=_0x4449fd['id']||0x0;this['name']=_0x4449fd['name']||'';this[_0x442d('0x0')]=_0x4449fd[_0x442d('0x0')]||'';this[_0x442d('0x1')]=_0x4449fd[_0x442d('0x1')]||'';this[_0x442d('0x2')]=_0x4449fd[_0x442d('0x2')]||'';this['remoteUri']=_0x4449fd['remoteUri']||'';this[_0x442d('0x3')]=_0x4449fd[_0x442d('0x3')]||'';this['type']=_0x4449fd[_0x442d('0x4')]||_0x442d('0x5');this[_0x442d('0x6')]=_0x4449fd[_0x442d('0x6')]||'';this[_0x442d('0x7')]=_0x4449fd[_0x442d('0x7')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x85f8=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x246a4f,_0x1a74c9){var _0x3bebe2=function(_0x1f1215){while(--_0x1f1215){_0x246a4f['push'](_0x246a4f['shift']());}};_0x3bebe2(++_0x1a74c9);}(_0x85f8,0x11d));var _0x885f=function(_0x12389b,_0x3c4f6e){_0x12389b=_0x12389b-0x0;var _0xe985a2=_0x85f8[_0x12389b];return _0xe985a2;};'use strict';function ZendeskAccount(_0x37a071){this['id']=_0x37a071['id']||0x0;this['name']=_0x37a071[_0x885f('0x0')]||'';this[_0x885f('0x1')]=_0x37a071['username']||'';this[_0x885f('0x2')]=_0x37a071['password']||'';this['token']=_0x37a071[_0x885f('0x3')]||'';this[_0x885f('0x4')]=_0x37a071[_0x885f('0x4')]||'';this[_0x885f('0x5')]=_0x37a071['authType']||'';this[_0x885f('0x6')]=_0x37a071[_0x885f('0x6')]||_0x885f('0x7');this[_0x885f('0x8')]=_0x37a071['serverUrl']||'';this[_0x885f('0x9')]=_0x37a071[_0x885f('0x9')]||{};}module[_0x885f('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 6f34406..76ab3de 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 _0x7d00=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7d00,0x104));var _0x07d0=function(_0x35ed07,_0x29880c){_0x35ed07=_0x35ed07-0x0;var _0x4631e9=_0x7d00[_0x35ed07];return _0x4631e9;};'use strict';function ZohoAccount(_0x19279c){this['id']=_0x19279c['id']||0x0;this['name']=_0x19279c[_0x07d0('0x0')]||'';this[_0x07d0('0x1')]=_0x19279c['description']||'';this[_0x07d0('0x2')]=_0x19279c['host']||'';this[_0x07d0('0x3')]=_0x19279c['zone']||'';this['clientId']=_0x19279c[_0x07d0('0x4')]||'';this['clientSecret']=_0x19279c[_0x07d0('0x5')]||'';this[_0x07d0('0x6')]=_0x19279c['serverUrl']||'';this[_0x07d0('0x7')]=_0x19279c[_0x07d0('0x7')]||'';this[_0x07d0('0x8')]=_0x19279c['refreshToken']||'';this[_0x07d0('0x9')]=_0x19279c[_0x07d0('0x9')]||{};}module[_0x07d0('0xa')]=ZohoAccount; \ No newline at end of file +var _0xffe2=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x434d68,_0xcbdfed){var _0x56f3ce=function(_0x3553ab){while(--_0x3553ab){_0x434d68['push'](_0x434d68['shift']());}};_0x56f3ce(++_0xcbdfed);}(_0xffe2,0x160));var _0x2ffe=function(_0x32e2eb,_0x3347b7){_0x32e2eb=_0x32e2eb-0x0;var _0x2418ce=_0xffe2[_0x32e2eb];return _0x2418ce;};'use strict';function ZohoAccount(_0x408fe6){this['id']=_0x408fe6['id']||0x0;this[_0x2ffe('0x0')]=_0x408fe6[_0x2ffe('0x0')]||'';this[_0x2ffe('0x1')]=_0x408fe6[_0x2ffe('0x1')]||'';this[_0x2ffe('0x2')]=_0x408fe6[_0x2ffe('0x2')]||'';this[_0x2ffe('0x3')]=_0x408fe6['zone']||'';this[_0x2ffe('0x4')]=_0x408fe6[_0x2ffe('0x4')]||'';this['clientSecret']=_0x408fe6[_0x2ffe('0x5')]||'';this[_0x2ffe('0x6')]=_0x408fe6[_0x2ffe('0x6')]||'';this[_0x2ffe('0x7')]=_0x408fe6['code']||'';this[_0x2ffe('0x8')]=_0x408fe6[_0x2ffe('0x8')]||'';this[_0x2ffe('0x9')]=_0x408fe6[_0x2ffe('0x9')]||{};}module[_0x2ffe('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 d188fa4..f50367e 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 _0x6cef=['callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','name','type','membername','Agent','format','calleridname','Contact','phone','firstName','lastName','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid'];(function(_0x3d2ab4,_0x3c7886){var _0x12de08=function(_0x33abeb){while(--_0x33abeb){_0x3d2ab4['push'](_0x3d2ab4['shift']());}};_0x12de08(++_0x3c7886);}(_0x6cef,0xfa));var _0xf6ce=function(_0x4711ee,_0x1e22f9){_0x4711ee=_0x4711ee-0x0;var _0x1d4992=_0x6cef[_0x4711ee];return _0x1d4992;};'use strict';var util=require(_0xf6ce('0x0'));var _=require(_0xf6ce('0x1'));var moment=require(_0xf6ce('0x2'));function checkNameSurname(_0x379032,_0x54ea8c,_0x7c8670){var _0x264e80='';if(!_[_0xf6ce('0x3')](_0x54ea8c)&&_0xf6ce('0x4')===typeof _0x54ea8c){_0x264e80+=_0x54ea8c;}if(!_['isNil'](_0x7c8670)&&_0xf6ce('0x4')===typeof _0x7c8670){_0x264e80+='\x20'+_0x7c8670;}if(_0x264e80!==''){return _0x264e80;}return _0x379032;}function Action(_0x1e1775,_0x5f0085,_0x2208b3,_0x107a7e,_0xa14ff1){this[_0xf6ce('0x5')]=_0x2208b3||undefined;this[_0xf6ce('0x6')]=_0x1e1775['id'];this['queue']=_0x5f0085[_0xf6ce('0x7')];this[_0xf6ce('0x8')]=_0x5f0085['type'];this['campaigntype']='queue';this['dialAnswer']=![];this[_0xf6ce('0x9')]=_[_0xf6ce('0x3')](_0x1e1775[_0xf6ce('0xa')])?undefined:_0x1e1775[_0xf6ce('0xa')][_0xf6ce('0x7')];this['channelAgent']=this[_0xf6ce('0x9')]?util[_0xf6ce('0xb')]('SIP/%s',this[_0xf6ce('0x9')]):_0x107a7e||undefined;this[_0xf6ce('0xc')]=checkNameSurname(_0x1e1775[_0xf6ce('0xd')][_0xf6ce('0xe')],_0x1e1775['Contact'][_0xf6ce('0xf')],_0x1e1775[_0xf6ce('0xd')][_0xf6ce('0x10')]);this['active']=_0x1e1775['active']||![];this[_0xf6ce('0x11')]=_0x1e1775[_0xf6ce('0xd')]['phone'];this[_0xf6ce('0x12')]=_0x1e1775[_0xf6ce('0x12')];this[_0xf6ce('0x13')]=_0x1e1775[_0xf6ce('0x13')]||0x0;this['countcongestionretry']=_0x1e1775[_0xf6ce('0x14')]||0x0;this['countnoanswerretry']=_0x1e1775[_0xf6ce('0x15')]||0x0;this[_0xf6ce('0x16')]=(_0x1e1775[_0xf6ce('0x13')]||0x0)+(_0x1e1775['countcongestionretry']||0x0)+(_0x1e1775['countnoanswerretry']||0x0)+(_0x1e1775[_0xf6ce('0x17')]||0x0)+(_0x1e1775['countdropretry']||0x0)+(_0x1e1775[_0xf6ce('0x18')]||0x0)+(_0x1e1775[_0xf6ce('0x19')]||0x0)+(_0x1e1775[_0xf6ce('0x1a')]||0x0);this[_0xf6ce('0x17')]=_0x1e1775[_0xf6ce('0x17')]||0x0;this['countdropretry']=_0x1e1775[_0xf6ce('0x1b')]||0x0;this[_0xf6ce('0x18')]=_0x1e1775[_0xf6ce('0x18')]||0x0;this[_0xf6ce('0x19')]=_0x1e1775[_0xf6ce('0x19')]||0x0;this[_0xf6ce('0x1a')]=_0x1e1775[_0xf6ce('0x1a')]||0x0;this['callback']=_0x1e1775[_0xf6ce('0x1c')];this[_0xf6ce('0x1d')]=_0x1e1775['callbackuniqueid'];this[_0xf6ce('0x1e')]=_0x1e1775[_0xf6ce('0x1e')];this[_0xf6ce('0x1f')]=_0x1e1775[_0xf6ce('0x1f')];this['ContactId']=_0x1e1775[_0xf6ce('0x20')];this['ListId']=_0x1e1775['ListId'];this[_0xf6ce('0x21')]=_[_0xf6ce('0x3')](_0x1e1775[_0xf6ce('0xa')])?_0x1e1775['UserId']:_0x1e1775['Agent']['id'];this[_0xf6ce('0x22')]=_0x1e1775[_0xf6ce('0x22')];this[_0xf6ce('0x23')]='';this['originatecalleridname']='';}Action['prototype'][_0xf6ce('0x24')]=function(){return util[_0xf6ce('0xb')](_0xf6ce('0x25'),this[_0xf6ce('0xc')],this[_0xf6ce('0x26')]);};module[_0xf6ce('0x27')]=Action; \ No newline at end of file +var _0x11be=['countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','prototype','\x22%s\x22\x20<%s>','calleridname','number','exports','lodash','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','Contact','phone','lastName','active','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x11be,0x146));var _0xe11b=function(_0x4c630b,_0x25f8ef){_0x4c630b=_0x4c630b-0x0;var _0x181259=_0x11be[_0x4c630b];return _0x181259;};'use strict';var util=require('util');var _=require(_0xe11b('0x0'));var moment=require('moment');function checkNameSurname(_0x5e68c6,_0x441490,_0x121b5e){var _0x599fea='';if(!_[_0xe11b('0x1')](_0x441490)&&_0xe11b('0x2')===typeof _0x441490){_0x599fea+=_0x441490;}if(!_[_0xe11b('0x1')](_0x121b5e)&&_0xe11b('0x2')===typeof _0x121b5e){_0x599fea+='\x20'+_0x121b5e;}if(_0x599fea!==''){return _0x599fea;}return _0x5e68c6;}function Action(_0x50249f,_0x92f062,_0x79943a,_0x1bd093,_0x1ce090){this[_0xe11b('0x3')]=_0x79943a||undefined;this[_0xe11b('0x4')]=_0x50249f['id'];this[_0xe11b('0x5')]=_0x92f062[_0xe11b('0x6')];this[_0xe11b('0x7')]=_0x92f062[_0xe11b('0x7')];this[_0xe11b('0x8')]=_0xe11b('0x5');this[_0xe11b('0x9')]=![];this[_0xe11b('0xa')]=_[_0xe11b('0x1')](_0x50249f[_0xe11b('0xb')])?undefined:_0x50249f[_0xe11b('0xb')]['name'];this['channelAgent']=this['membername']?util[_0xe11b('0xc')](_0xe11b('0xd'),this[_0xe11b('0xa')]):_0x1bd093||undefined;this['calleridname']=checkNameSurname(_0x50249f[_0xe11b('0xe')][_0xe11b('0xf')],_0x50249f[_0xe11b('0xe')]['firstName'],_0x50249f[_0xe11b('0xe')][_0xe11b('0x10')]);this[_0xe11b('0x11')]=_0x50249f[_0xe11b('0x11')]||![];this['calleridnum']=_0x50249f[_0xe11b('0xe')][_0xe11b('0xf')];this['scheduledat']=_0x50249f['scheduledat'];this['countbusyretry']=_0x50249f[_0xe11b('0x12')]||0x0;this[_0xe11b('0x13')]=_0x50249f[_0xe11b('0x13')]||0x0;this[_0xe11b('0x14')]=_0x50249f[_0xe11b('0x14')]||0x0;this[_0xe11b('0x15')]=(_0x50249f[_0xe11b('0x12')]||0x0)+(_0x50249f[_0xe11b('0x13')]||0x0)+(_0x50249f['countnoanswerretry']||0x0)+(_0x50249f[_0xe11b('0x16')]||0x0)+(_0x50249f['countdropretry']||0x0)+(_0x50249f[_0xe11b('0x17')]||0x0)+(_0x50249f[_0xe11b('0x18')]||0x0)+(_0x50249f[_0xe11b('0x19')]||0x0);this[_0xe11b('0x16')]=_0x50249f['countnosuchnumberretry']||0x0;this[_0xe11b('0x1a')]=_0x50249f['countdropretry']||0x0;this[_0xe11b('0x17')]=_0x50249f[_0xe11b('0x17')]||0x0;this[_0xe11b('0x18')]=_0x50249f[_0xe11b('0x18')]||0x0;this[_0xe11b('0x19')]=_0x50249f[_0xe11b('0x19')]||0x0;this[_0xe11b('0x1b')]=_0x50249f[_0xe11b('0x1b')];this[_0xe11b('0x1c')]=_0x50249f[_0xe11b('0x1c')];this['callbackat']=_0x50249f[_0xe11b('0x1d')];this['recallme']=_0x50249f[_0xe11b('0x1e')];this[_0xe11b('0x1f')]=_0x50249f[_0xe11b('0x1f')];this[_0xe11b('0x20')]=_0x50249f[_0xe11b('0x20')];this['UserId']=_[_0xe11b('0x1')](_0x50249f[_0xe11b('0xb')])?_0x50249f[_0xe11b('0x21')]:_0x50249f[_0xe11b('0xb')]['id'];this['VoiceQueueId']=_0x50249f['VoiceQueueId'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xe11b('0x22')]['getCaller']=function(){return util[_0xe11b('0xc')](_0xe11b('0x23'),this[_0xe11b('0x24')],this[_0xe11b('0x25')]);};module[_0xe11b('0x26')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 1537746..78720d6 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 _0x2a62=['Queue:\x20','idContact','called','Calling','logBlacklist','[Blacklist][error]','SIP/%s','reachable','unmonitored','execRun','unlock','recallme','isValid','checkIsBlackList','Contact.phone','checkInBlack','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','trim','getCallerId','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','calleridnum','user:%s','[originated][increment]','OriginateError','channel','syncOriginateResponse','logLookAgent','clone','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','addVariable','variables','filterKey','variable','keys','value','error','[syncVarSet][Preview]','inspect','transfererlinkedid','exports','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','./action','redis','defaults','localhost','enqueue','tail','sequence','trunks','actions','agents','clockClearZombieChannels','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','answered','pTalking','sumBillable','sumDuration','sumHoldTime','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','info','voice_queue_channel:remove','emit','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','\x20is\x20disactive','prototype','syncCampaigns','campaignsPreview','preview','hasOwnProperty','setMessage','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','status','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','catch','disableContact','starttime','outboundReCallsDay','logCustomer','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','[16]','totalGlobal','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','rescheduleContact','dialBusyRetryFrequency','activeContact','NOANSWER','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','countagentrejectretry','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','AnswerAGI','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0x2a62,0x192));var _0x22a6=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x2a62[_0x5f1391];return _0x50ebe3;};'use strict';var util=require('util');var _=require(_0x22a6('0x0'));var BPromise=require('bluebird');var uuid=require(_0x22a6('0x1'));var moment=require(_0x22a6('0x2'));var md5=require('md5');var Redis=require(_0x22a6('0x3'));var config=require(_0x22a6('0x4'));var logger=require(_0x22a6('0x5'))('preview');var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x22a6('0x6'));var rpcDb=require(_0x22a6('0x7'));var Action=require(_0x22a6('0x8'));var ut=require('./util/util');config[_0x22a6('0x9')]=_[_0x22a6('0xa')](config['redis'],{'host':_0x22a6('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x22a6('0x9')]));var Sequence=function(){};Sequence['prototype'][_0x22a6('0xc')]=function(_0x5079f5){this[_0x22a6('0xd')]=this[_0x22a6('0xd')]?this[_0x22a6('0xd')]['finally'](_0x5079f5):_0x5079f5();};function Preview(_0x7b9b35){this[_0x22a6('0xe')]=new Sequence();this['campaignsPreview']=_0x7b9b35['voiceQueues'];this[_0x22a6('0xf')]=_0x7b9b35[_0x22a6('0xf')];this[_0x22a6('0x10')]={};this[_0x22a6('0x11')]=_0x7b9b35[_0x22a6('0x11')];this[_0x22a6('0x12')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x22a6('0x13')](this));ami['on'](_0x22a6('0x14'),this['syncHangup'][_0x22a6('0x13')](this));ami['on'](_0x22a6('0x15'),this[_0x22a6('0x16')][_0x22a6('0x13')](this));ami['on'](_0x22a6('0x17'),this[_0x22a6('0x18')][_0x22a6('0x13')](this));ami['on'](_0x22a6('0x19'),this[_0x22a6('0x1a')][_0x22a6('0x13')](this));ami['on'](_0x22a6('0x1b'),this[_0x22a6('0x1c')][_0x22a6('0x13')](this));ami['on']('attendedtransfer',this[_0x22a6('0x1d')][_0x22a6('0x13')](this));ami['on'](_0x22a6('0x1e'),this[_0x22a6('0x1f')][_0x22a6('0x13')](this));this[_0x22a6('0x20')](this['campaignsPreview']);}function emit(_0x4922b6,_0x490259,_0x175643){io['to'](_0x4922b6)['emit'](_0x490259,_0x175643);}function emitCampaignPreview(_0x118d7f){if(_0x118d7f[_0x22a6('0x21')]===_0x22a6('0x22')){var _0x3a2042={'id':_0x118d7f['id'],'name':_0x118d7f[_0x22a6('0x23')],'strategy':_0x118d7f['strategy'],'answered':_0x118d7f[_0x22a6('0x24')],'available':_0x118d7f['available'],'loggedIn':_0x118d7f['loggedIn'],'pTalking':_0x118d7f[_0x22a6('0x25')],'sumBillable':_0x118d7f[_0x22a6('0x26')],'sumDuration':_0x118d7f[_0x22a6('0x27')],'sumHoldTime':_0x118d7f[_0x22a6('0x28')]||0x0,'talking':_0x118d7f['talking'],'total':_0x118d7f['total'],'type':_0x118d7f[_0x22a6('0x21')],'unmanaged':_0x118d7f['unmanaged'],'abandoned':_0x118d7f[_0x22a6('0x29')],'waiting':_0x118d7f[_0x22a6('0x2a')],'loggedInDb':_0x118d7f[_0x22a6('0x2b')],'dialActive':_0x118d7f[_0x22a6('0x2c')],'dialMethod':_0x118d7f[_0x22a6('0x2d')],'dialOriginateCallerIdName':_0x118d7f[_0x22a6('0x2e')],'dialOriginateCallerIdNumber':_0x118d7f['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x118d7f[_0x22a6('0x2f')],'dialPrefix':_0x118d7f[_0x22a6('0x30')],'outboundAnswerAgiCallsDay':_0x118d7f[_0x22a6('0x31')],'outboundAnswerCallsDay':_0x118d7f[_0x22a6('0x32')],'outboundBlacklistCallsDay':_0x118d7f[_0x22a6('0x33')],'outboundBusyCallsDay':_0x118d7f[_0x22a6('0x34')],'outboundCongestionCallsDay':_0x118d7f[_0x22a6('0x35')],'outboundDropCallsDayACS':_0x118d7f[_0x22a6('0x36')],'outboundDropCallsDayCallersExit':_0x118d7f[_0x22a6('0x37')],'outboundDropCallsDayTimeout':_0x118d7f['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x118d7f[_0x22a6('0x38')],'outboundNoSuchCallsDay':_0x118d7f[_0x22a6('0x39')],'outboundOriginateFailureCallsDay':_0x118d7f[_0x22a6('0x3a')],'outboundReCallsDay':_0x118d7f['outboundReCallsDay'],'outboundRejectCallsDay':_0x118d7f['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x118d7f[_0x22a6('0x3b')],'outboundAbandonedCallsDay':_0x118d7f[_0x22a6('0x3c')],'predictiveIntervalAnsweredCalls':_0x118d7f[_0x22a6('0x3d')],'predictiveIntervalAvgHoldtime':_0x118d7f['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x118d7f['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x118d7f['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x118d7f['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x118d7f[_0x22a6('0x3e')],'predictiveIntervalErlangCallsDroppedCalls':_0x118d7f[_0x22a6('0x3f')],'predictiveIntervalHitRate':_0x118d7f[_0x22a6('0x40')],'predictiveIntervalMultiplicativeFactor':_0x118d7f['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x118d7f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x118d7f[_0x22a6('0x41')],'predictiveIntervalTotalCalls':_0x118d7f[_0x22a6('0x42')],'message':_0x118d7f[_0x22a6('0x43')],'originated':_0x118d7f['originated'],'erlangCalls':_0x118d7f[_0x22a6('0x44')],'erlangCallToSecond':_0x118d7f[_0x22a6('0x45')],'erlangAbandonmentRate':_0x118d7f[_0x22a6('0x46')],'erlangBusyFactor':_0x118d7f[_0x22a6('0x47')],'startPredictive':_0x118d7f[_0x22a6('0x48')],'startProgressive':_0x118d7f[_0x22a6('0x49')]};if(_0x118d7f[_0x22a6('0x4a')]){_0x3a2042[_0x22a6('0x4a')]={'id':_0x118d7f[_0x22a6('0x4a')]['id'],'name':_0x118d7f[_0x22a6('0x4a')]['name'],'active':_0x118d7f['Trunk'][_0x22a6('0x4b')],'callerid':_0x118d7f[_0x22a6('0x4a')][_0x22a6('0x4c')]};}if(_0x118d7f[_0x22a6('0x4d')]){_0x3a2042[_0x22a6('0x4d')]={'id':_0x118d7f[_0x22a6('0x4d')]['id'],'name':_0x118d7f[_0x22a6('0x4d')][_0x22a6('0x23')]};}var _0x230b84=md5(JSON[_0x22a6('0x4e')](_0x3a2042));if(_0x118d7f[_0x22a6('0x4f')]!==_0x230b84){_0x118d7f[_0x22a6('0x4f')]=_0x230b84;emit(util[_0x22a6('0x50')](_0x22a6('0x51'),_0x3a2042[_0x22a6('0x23')]),_0x22a6('0x52'),_0x3a2042);}}}function emitVoiceQueueChannelRemove(_0xbac52){logger[_0x22a6('0x53')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x22a6('0x4e')](_0xbac52));emit(util[_0x22a6('0x50')](_0x22a6('0x51'),_0xbac52[_0x22a6('0x23')]),_0x22a6('0x54'),_0xbac52);io[_0x22a6('0x55')]('voice_queue_presence:remove',_0xbac52);}function notSendMessagesQueue(_0x419576){if(_0x419576[_0x22a6('0x56')]){if(_0x419576[_0x22a6('0x57')]===0x0&&_0x419576[_0x22a6('0x25')]===0x0){_0x419576[_0x22a6('0x56')]=![];_0x419576['available']=0x0;_0x419576[_0x22a6('0x58')]=0x0;_0x419576[_0x22a6('0x43')]=_0x22a6('0x59');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x419576[_0x22a6('0x23')]+'\x20is\x20not\x20active');}else{_0x419576[_0x22a6('0x43')]='IS_DISACTIVED';ut[_0x22a6('0x5a')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x419576['name']+_0x22a6('0x5b'));}emitCampaignPreview(_0x419576);}}Preview[_0x22a6('0x5c')][_0x22a6('0x20')]=function(){var _0x3e93fb=this;setInterval(function(){_0x3e93fb[_0x22a6('0x5d')]();},0x7cf);};Preview['prototype'][_0x22a6('0x5d')]=function(){var _0x51483c=this[_0x22a6('0x5e')];this[_0x22a6('0x12')]+=0x1;for(var _0x3bb962 in _0x51483c){if(_0x51483c['hasOwnProperty'](_0x3bb962)&&(_0x51483c[_0x3bb962]['dialMethod']===_0x22a6('0x5f')||_0x51483c[_0x3bb962][_0x22a6('0x2d')]==='booked')&&_0x51483c[_0x3bb962][_0x22a6('0x21')]==='outbound'){if(this[_0x22a6('0x12')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x51483c[_0x22a6('0x60')](_0x3bb962)&&_0x51483c[_0x3bb962][_0x22a6('0x2d')]===_0x22a6('0x5f')&&_0x51483c[_0x3bb962][_0x22a6('0x21')]==='outbound'){if(_0x51483c[_0x3bb962][_0x22a6('0x2c')]){this[_0x22a6('0x61')](_0x51483c[_0x3bb962]);this[_0x22a6('0x62')](_0x51483c[_0x3bb962]);}else{notSendMessagesQueue(_0x51483c[_0x3bb962]);}}}};Preview['prototype'][_0x22a6('0x63')]=function(_0x501ce8){var _0x3bb9d2=this;this[_0x22a6('0xe')][_0x22a6('0xc')](function(){if(!_['isNil'](_0x3bb9d2['actions'][_0x501ce8])){loggerAction[_0x22a6('0x53')](_0x22a6('0x64'),_0x501ce8,_0x22a6('0x65'),_0x3bb9d2[_0x22a6('0x10')][_0x501ce8][_0x22a6('0x66')],'originated:\x20',JSON[_0x22a6('0x4e')](_0x3bb9d2['campaignsPreview'][_0x3bb9d2['actions'][_0x501ce8][_0x22a6('0x66')]][_0x22a6('0x57')]),_0x22a6('0x67'),JSON['stringify'](_0x3bb9d2[_0x22a6('0x5e')][_0x3bb9d2['actions'][_0x501ce8][_0x22a6('0x66')]]['pTalking']),JSON[_0x22a6('0x4e')](_0x3bb9d2[_0x22a6('0x10')][_0x501ce8][_0x22a6('0x68')]),JSON[_0x22a6('0x4e')](_[_0x22a6('0x69')](_0x3bb9d2['actions'][_0x501ce8],[_0x22a6('0x6a'),_0x22a6('0x6b'),_0x22a6('0x6c'),'ListId'])));return ami[_0x22a6('0x6d')]({'action':_0x22a6('0x6e'),'channel':_0x3bb9d2[_0x22a6('0x10')][_0x501ce8]['channel']})['catch'](function(_0x4d9ae4){if(_0x4d9ae4[_0x22a6('0x43')]===_0x22a6('0x6f')){setTimeout(function(){if(_0x3bb9d2[_0x22a6('0x10')][_0x501ce8]){ut[_0x22a6('0x70')](_0x3bb9d2[_0x22a6('0x5e')][_0x3bb9d2['actions'][_0x501ce8][_0x22a6('0x66')]],'[clearZombieChannel]');if(_0x3bb9d2['actions'][_0x501ce8]['dialAnswer']===!![]){ut[_0x22a6('0x71')](_0x3bb9d2[_0x22a6('0x5e')][_0x3bb9d2['actions'][_0x501ce8]['queue']],_0x22a6('0x72'));ut[_0x22a6('0x73')]('[Dialer][checkChannel][pTalking][Preview]'+_0x501ce8,_0x3bb9d2[_0x22a6('0x10')][_0x501ce8][_0x22a6('0x66')]);}ut[_0x22a6('0x73')](_0x22a6('0x74')+_0x501ce8,_0x3bb9d2[_0x22a6('0x10')][_0x501ce8][_0x22a6('0x66')]);delete _0x3bb9d2['actions'][_0x501ce8];}},0x2328);}});}});};Preview[_0x22a6('0x5c')][_0x22a6('0x75')]=function(){var _0xd3a453=this;loggerAction[_0x22a6('0x53')](_0x22a6('0x76'),_[_0x22a6('0x77')](this[_0x22a6('0x10')]));for(var _0xeaf296 in this['actions']){if(_0xd3a453[_0x22a6('0x10')][_0x22a6('0x60')](_0xeaf296)){_0xd3a453['clearZombieChannel'](_0xeaf296);}}};Preview[_0x22a6('0x5c')][_0x22a6('0x62')]=function(_0x515daf){var _0x4b148b=this;rpcDb[_0x22a6('0x78')](_0x515daf['id'],ut[_0x22a6('0x79')](this[_0x22a6('0x11')]))[_0x22a6('0x7a')](function(_0x440614){if(!_[_0x22a6('0x7b')](_0x440614)){for(var _0x2e3b8c=0x0;_0x2e3b8c<_0x440614[_0x22a6('0x7c')];_0x2e3b8c+=0x1){if(ut[_0x22a6('0x7d')](_0x440614[_0x2e3b8c][_0x22a6('0x7e')])<_0x515daf[_0x22a6('0x7f')]*0x3c){if(_0x440614[_0x2e3b8c]['Agent']&&!_0x440614[_0x2e3b8c][_0x22a6('0x80')][_0x22a6('0x81')]){_0x4b148b[_0x22a6('0x82')](_0x440614[_0x2e3b8c]['id'])[_0x22a6('0x7a')](ut[_0x22a6('0x83')](_0x22a6('0x84')))[_0x22a6('0x85')](ut[_0x22a6('0x83')](_0x22a6('0x84')));}else{rpcDb[_0x22a6('0x86')](_0x440614[_0x2e3b8c]['id']);}}else{var _0x3a6ebe=new Action(_0x440614[_0x2e3b8c],_0x515daf);_0x3a6ebe[_0x22a6('0x87')]=moment()[_0x22a6('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x515daf[_0x22a6('0x88')]+=0x1;ut[_0x22a6('0x89')](_0x3a6ebe,0x17,'RecallInQueue');if(_0x515daf['dialRecallInQueue']){rpcDb[_0x22a6('0x8a')](ut[_0x22a6('0x8b')](_0x440614[_0x2e3b8c]));rpcDb[_0x22a6('0x8c')](_0x3a6ebe,_0x22a6('0x8d'));}else{ut[_0x22a6('0x89')](_0x3a6ebe,0x16,_0x22a6('0x8e'));rpcDb[_0x22a6('0x8c')](_0x3a6ebe,_0x22a6('0x8f'));rpcDb[_0x22a6('0x90')](_0x3a6ebe,_0x22a6('0x8f'));}}}}})[_0x22a6('0x85')](ut['logger2'](_0x22a6('0x91')));};Preview['prototype'][_0x22a6('0x61')]=function(_0x3e6bcd){_0x3e6bcd[_0x22a6('0x56')]=!![];if(ut[_0x22a6('0x92')](_0x3e6bcd[_0x22a6('0x93')])){_0x3e6bcd[_0x22a6('0x43')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x3e6bcd['dialActive'])){_0x3e6bcd[_0x22a6('0x43')]=_0x22a6('0x59');}else if(!this[_0x22a6('0x94')](_0x3e6bcd[_0x22a6('0x4a')])){if(!this[_0x22a6('0x94')](_0x3e6bcd[_0x22a6('0x95')])){_0x3e6bcd[_0x22a6('0x43')]='TRUNK_IS_NOT_REACHABLE';}else{_0x3e6bcd[_0x22a6('0x43')]=_0x22a6('0x96');}}else{_0x3e6bcd[_0x22a6('0x43')]='ACTIVE';}emitCampaignPreview(_0x3e6bcd);};Preview[_0x22a6('0x5c')][_0x22a6('0x97')]=function(_0x5cdd95,_0x103ff3,_0x91393a){var _0x5c249f=this;var _0x480fac=this[_0x22a6('0x10')][_0x103ff3];var _0x1ebbe2=this[_0x22a6('0x5e')][_0x480fac['queue']];var _0x2d0a8d;if(_0x1ebbe2){switch(_0x91393a){case'1':_0x1ebbe2[_0x22a6('0x39')]+=0x1;_0x480fac[_0x22a6('0x98')]+=0x1;_0x480fac[_0x22a6('0x99')]=ut['totalGlobal'](_0x480fac);ut['logCustomer'](_0x480fac,0x0,_0x22a6('0x9a'));ami[_0x22a6('0x55')](_0x22a6('0x9b'),ut[_0x22a6('0x9c')](_0x480fac,_0x22a6('0x9d')));rpcDb[_0x22a6('0x8c')](_0x480fac,_0x22a6('0x9e'));if(ut['totalGlobal'](_0x480fac)>=_0x1ebbe2[_0x22a6('0x9f')]){_0x2d0a8d=ut[_0x22a6('0xa0')](_0x480fac,0xf,_0x22a6('0xa1'));rpcDb['createCustomerFinal'](_0x2d0a8d,_0x22a6('0xa2'));}else{if(_0x480fac[_0x22a6('0x98')]>=_0x1ebbe2[_0x22a6('0xa3')]){rpcDb[_0x22a6('0x90')](_0x480fac,_0x22a6('0xa2'));}else{rpcDb['rescheduleContact'](ut[_0x22a6('0xa4')](_0x480fac,_0x22a6('0x98'),_0x1ebbe2[_0x22a6('0xa5')]),_0x480fac[_0x22a6('0xa6')],_0x480fac['activeContact']);}}delete this['actions'][_0x5cdd95[_0x22a6('0xa7')]];break;case _0x22a6('0xa8'):var _0xa688b6=moment()[_0x22a6('0x50')](_0x22a6('0xa9'));_0x480fac[_0x22a6('0xaa')]=_0xa688b6;_0x480fac[_0x22a6('0xab')]=_0xa688b6;_0x480fac[_0x22a6('0x68')]=!![];_0x1ebbe2[_0x22a6('0x25')]+=0x1;logger[_0x22a6('0x53')](_0x22a6('0xac'),_0x480fac[_0x22a6('0xad')],_0x22a6('0xae'),_0x1ebbe2[_0x22a6('0x23')],_0x22a6('0x67'),_0x1ebbe2[_0x22a6('0x25')]);ami['emit'](_0x22a6('0xaf'),ut[_0x22a6('0x9c')](_0x480fac,_0x22a6('0xb0'),this['campaignsPreview'][_0x480fac['queue']]));if(_0x1ebbe2['acw']){ami[_0x22a6('0x55')](_0x22a6('0xb1'),ut[_0x22a6('0xb2')](_0x480fac));}break;case'16':ami[_0x22a6('0x55')](_0x22a6('0xb3'),ut['buildObj'](_0x480fac,_0x22a6('0xb4'),this[_0x22a6('0x5e')][_0x480fac['queue']]));emitVoiceQueueChannelRemove(ut[_0x22a6('0x9c')](_0x480fac,_0x22a6('0xb4')));_0x1ebbe2[_0x22a6('0x32')]+=0x1;_0x1ebbe2[_0x22a6('0xb5')]+=0x1;_0x1ebbe2[_0x22a6('0x24')]+=0x1;ut[_0x22a6('0x71')](_0x1ebbe2,_0x22a6('0xb6'));_0x480fac[_0x22a6('0x99')]=ut[_0x22a6('0xb7')](_0x480fac);ut[_0x22a6('0x89')](_0x480fac,0x4,'Answer');rpcDb[_0x22a6('0x8c')](_0x480fac,_0x22a6('0xb8'));rpcDb[_0x22a6('0x90')](_0x480fac,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x22a6('0xb9')](_0x480fac);_0x1ebbe2['sumDuration']+=_0x480fac[_0x22a6('0xba')];_0x1ebbe2[_0x22a6('0x26')]+=_0x480fac[_0x22a6('0xba')];logger[_0x22a6('0x53')](_0x22a6('0xbb'),_0x480fac['uniqueid'],'\x20Queue',_0x1ebbe2[_0x22a6('0x23')],_0x22a6('0x67'),_0x1ebbe2[_0x22a6('0x25')]);delete this[_0x22a6('0x10')][_0x5cdd95[_0x22a6('0xa7')]];break;case'BUSY':_0x1ebbe2[_0x22a6('0x34')]+=0x1;_0x480fac[_0x22a6('0xbc')]+=0x1;_0x480fac[_0x22a6('0x99')]=ut[_0x22a6('0xb7')](_0x480fac);ut[_0x22a6('0x89')](_0x480fac,0x5,_0x22a6('0xbd'));ami[_0x22a6('0x55')]('custom:agentbusy',ut[_0x22a6('0x9c')](_0x480fac,_0x22a6('0xbe')));rpcDb[_0x22a6('0x8c')](_0x480fac,_0x22a6('0xbf'));if(ut[_0x22a6('0xb7')](_0x480fac)>=_0x1ebbe2[_0x22a6('0x9f')]){_0x2d0a8d=ut[_0x22a6('0xa0')](_0x480fac,0xf,_0x22a6('0xa1'));rpcDb[_0x22a6('0x90')](_0x2d0a8d,_0x22a6('0xc0'));}else{if(_0x480fac[_0x22a6('0xbc')]>=_0x1ebbe2['dialBusyMaxRetry']){rpcDb[_0x22a6('0x90')](_0x480fac,_0x22a6('0xbf'));}else{rpcDb[_0x22a6('0xc1')](ut[_0x22a6('0xa4')](_0x480fac,_0x22a6('0xbc'),_0x1ebbe2[_0x22a6('0xc2')]),_0x480fac[_0x22a6('0xa6')],_0x480fac[_0x22a6('0xc3')]);}}break;case _0x22a6('0xc4'):_0x1ebbe2[_0x22a6('0x38')]+=0x1;_0x480fac['countnoanswerretry']+=0x1;_0x480fac[_0x22a6('0x99')]=ut[_0x22a6('0xb7')](_0x480fac);ut['logCustomer'](_0x480fac,0x3,_0x22a6('0xc5'));ami[_0x22a6('0x55')]('custom:agentnoanswer',ut[_0x22a6('0x9c')](_0x480fac,_0x22a6('0xc6')));rpcDb[_0x22a6('0x8c')](_0x480fac,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x22a6('0xb7')](_0x480fac)>=_0x1ebbe2[_0x22a6('0x9f')]){_0x2d0a8d=ut[_0x22a6('0xa0')](_0x480fac,0xf,_0x22a6('0xa1'));rpcDb[_0x22a6('0x90')](_0x2d0a8d,_0x22a6('0xc7'));}else{if(_0x480fac[_0x22a6('0xc8')]>=_0x1ebbe2[_0x22a6('0xc9')]){rpcDb[_0x22a6('0x90')](_0x480fac,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0x22a6('0xa4')](_0x480fac,'countnoanswerretry',_0x1ebbe2['dialNoAnswerRetryFrequency']),_0x480fac[_0x22a6('0xa6')],_0x480fac[_0x22a6('0xc3')]);}}break;case _0x22a6('0xca'):_0x1ebbe2['outboundCongestionCallsDay']+=0x1;_0x480fac[_0x22a6('0xcb')]+=0x1;_0x480fac[_0x22a6('0x99')]=ut[_0x22a6('0xb7')](_0x480fac);ut[_0x22a6('0x89')](_0x480fac,0x8,_0x22a6('0xcc'));ami[_0x22a6('0x55')]('custom:agentcongestion',ut[_0x22a6('0x9c')](_0x480fac,'congestion'));rpcDb[_0x22a6('0x8c')](_0x480fac,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x22a6('0xb7')](_0x480fac)>=_0x1ebbe2[_0x22a6('0x9f')]){_0x2d0a8d=ut[_0x22a6('0xa0')](_0x480fac,0xf,_0x22a6('0xa1'));rpcDb[_0x22a6('0x90')](_0x2d0a8d,_0x22a6('0xcd'));}else{if(_0x480fac[_0x22a6('0xcb')]>=_0x1ebbe2['dialCongestionMaxRetry']){rpcDb[_0x22a6('0x90')](_0x480fac,_0x22a6('0xce'));}else{rpcDb[_0x22a6('0xc1')](ut[_0x22a6('0xa4')](_0x480fac,_0x22a6('0xcb'),_0x1ebbe2[_0x22a6('0xc2')]),_0x480fac[_0x22a6('0xa6')],_0x480fac[_0x22a6('0xc3')]);}}break;case _0x22a6('0xcf'):_0x1ebbe2[_0x22a6('0xd0')]+=0x1;_0x480fac[_0x22a6('0xd1')]+=0x1;_0x480fac[_0x22a6('0x99')]=ut[_0x22a6('0xb7')](_0x480fac);ut[_0x22a6('0x89')](_0x480fac,0x14,'AgentReject');ami[_0x22a6('0x55')]('custom:agentreject',ut['buildObj'](_0x480fac,_0x22a6('0xd2')));rpcDb[_0x22a6('0x8c')](_0x480fac,_0x22a6('0xd3'));if(ut[_0x22a6('0xb7')](_0x480fac)>=_0x1ebbe2[_0x22a6('0x9f')]){_0x2d0a8d=ut[_0x22a6('0xa0')](_0x480fac,0x14,_0x22a6('0xd4'));rpcDb[_0x22a6('0x90')](_0x2d0a8d,_0x22a6('0xd5'));}else{if(_0x480fac[_0x22a6('0xd1')]>=_0x1ebbe2['dialAgentRejectMaxRetry']){rpcDb[_0x22a6('0x90')](_0x480fac,_0x22a6('0xd5'));}else{rpcDb[_0x22a6('0xc1')](ut[_0x22a6('0xa4')](_0x480fac,_0x22a6('0xd1'),_0x1ebbe2[_0x22a6('0xd6')]),_0x480fac['unlockAgent'],_0x480fac[_0x22a6('0xc3')]);}}break;case'ABANDONED':_0x1ebbe2[_0x22a6('0x3c')]+=0x1;_0x480fac[_0x22a6('0xd7')]+=0x1;_0x480fac[_0x22a6('0x99')]=ut['totalGlobal'](_0x480fac);ut[_0x22a6('0x89')](_0x480fac,0xb,'Abandoned');rpcDb[_0x22a6('0x8c')](_0x480fac,_0x22a6('0xd8'));if(ut['totalGlobal'](_0x480fac)>=_0x1ebbe2[_0x22a6('0x9f')]){_0x2d0a8d=ut[_0x22a6('0xa0')](_0x480fac,0xf,_0x22a6('0xa1'));rpcDb[_0x22a6('0x90')](_0x2d0a8d,_0x22a6('0xd8'));}else{if(_0x480fac[_0x22a6('0xd9')]>=_0x1ebbe2['dialAbandonedMaxRety']){rpcDb[_0x22a6('0x90')](_0x480fac,_0x22a6('0xd8'));}else{rpcDb[_0x22a6('0xc1')](ut[_0x22a6('0xa4')](_0x480fac,_0x22a6('0xd7'),_0x1ebbe2[_0x22a6('0xda')]),_0x480fac[_0x22a6('0xa6')],_0x480fac[_0x22a6('0xc3')]);}}break;case'18':_0x1ebbe2[_0x22a6('0x3b')]+=0x1;_0x480fac[_0x22a6('0xdb')]+=0x1;_0x480fac['countglobal']=ut[_0x22a6('0xb7')](_0x480fac);ut[_0x22a6('0x89')](_0x480fac,0x12,_0x5cdd95[_0x22a6('0xdc')]||_0x5cdd95[_0x22a6('0xdd')]);ami[_0x22a6('0x55')](_0x22a6('0xde'),ut[_0x22a6('0x9c')](_0x480fac,'amd'));rpcDb['createCustomerHistory'](_0x480fac,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0x22a6('0xb7')](_0x480fac)>=_0x1ebbe2['dialGlobalMaxRetry']){_0x2d0a8d=ut[_0x22a6('0xa0')](_0x480fac,0xf,_0x22a6('0xa1'));rpcDb[_0x22a6('0x90')](_0x2d0a8d,_0x22a6('0xdf'));}else{rpcDb['createCustomerFinal'](_0x480fac,_0x22a6('0xdf'));}delete this['actions'][_0x5cdd95[_0x22a6('0xa7')]];break;case'19':_0x1ebbe2['outboundUnknownCallsDay']+=0x1;_0x480fac[_0x22a6('0x99')]=ut[_0x22a6('0xb7')](_0x480fac);ut[_0x22a6('0x89')](_0x480fac,0x13,_0x5cdd95[_0x22a6('0xdc')]||_0x5cdd95[_0x22a6('0xdd')]);ami[_0x22a6('0x55')](_0x22a6('0xde'),ut[_0x22a6('0x9c')](_0x480fac,_0x22a6('0xe0')));rpcDb[_0x22a6('0x8c')](_0x480fac,'[callProgressDetectingCustomer][machine]');if(ut[_0x22a6('0xb7')](_0x480fac)>=_0x1ebbe2[_0x22a6('0x9f')]){_0x2d0a8d=ut['cloneAction'](_0x480fac,0xf,_0x22a6('0xa1'));rpcDb[_0x22a6('0x90')](_0x2d0a8d,_0x22a6('0xe1'));}else{rpcDb['createCustomerFinal'](_0x480fac,'[callProgressDetectingCustomer][machine]');}delete this[_0x22a6('0x10')][_0x5cdd95[_0x22a6('0xa7')]];break;default:if(_0x480fac['dialAnswer']){ut[_0x22a6('0x71')](_0x1ebbe2,_0x22a6('0xe2'));ut[_0x22a6('0x73')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x1ebbe2[_0x22a6('0x23')],_0x5cdd95);}_0x1ebbe2['outboundUnknownCallsDay']+=0x1;_0x480fac['countglobal']=ut[_0x22a6('0xb7')](_0x480fac);ut['logCustomer'](_0x480fac,0xc,_0x5cdd95[_0x22a6('0xdc')]||_0x5cdd95[_0x22a6('0xdd')]);rpcDb[_0x22a6('0x8c')](_0x480fac,_0x22a6('0xe3'));if(ut[_0x22a6('0xb7')](_0x480fac)>=_0x1ebbe2[_0x22a6('0x9f')]){_0x2d0a8d=ut[_0x22a6('0xa0')](_0x480fac,0xf,_0x22a6('0xa1'));rpcDb[_0x22a6('0x90')](_0x2d0a8d,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x480fac,_0x22a6('0xe4'));}delete this[_0x22a6('0x10')][_0x5cdd95[_0x22a6('0xa7')]];}if(!(_0x480fac['dialAnswer']&&_0x91393a==='16')){ut['updateOriginated'](_0x1ebbe2,'[callProgressDetectingCustomer]');logger[_0x22a6('0x53')](_0x22a6('0xe5'),_0x480fac[_0x22a6('0xad')],_0x22a6('0xae'),_0x1ebbe2['name'],_0x22a6('0xe6'),_0x1ebbe2[_0x22a6('0x57')]);}if(_0x91393a!==_0x22a6('0xa8')){delete this[_0x22a6('0x10')][_0x5cdd95[_0x22a6('0xa7')]];delete this[_0x22a6('0x10')][_0x5cdd95[_0x22a6('0xe7')]];}}};Preview['prototype'][_0x22a6('0xe8')]=function(_0x3a870d,_0x191d34,_0x5815d8){if(_[_0x22a6('0xe9')](_0x191d34)&&'object'!==typeof _0x191d34){return;}if(_['isUndefined'](_0x5815d8)&&_0x22a6('0xea')!==typeof _0x5815d8){return;}switch(_0x5815d8['reason']){case'0':ut['logAgent'](_0x3a870d,0x0,_0x22a6('0x9a'));rpcDb[_0x22a6('0xeb')](_0x3a870d,_0x22a6('0xec'));break;case'3':ut[_0x22a6('0xed')](_0x3a870d,0x3,_0x22a6('0xc5'));rpcDb[_0x22a6('0xeb')](_0x3a870d,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x22a6('0xed')](_0x3a870d,0x5,_0x22a6('0xbd'));rpcDb['createAgentHistory'](_0x3a870d,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x22a6('0xed')](_0x3a870d,0x8,'Congestion');rpcDb[_0x22a6('0xeb')](_0x3a870d,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x22a6('0xed')](_0x3a870d,0x16,_0x22a6('0xee'));rpcDb[_0x22a6('0xeb')](_0x3a870d,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x3a870d,0xc,_0x5815d8[_0x22a6('0xef')]);rpcDb['createAgentHistory'](_0x3a870d,_0x22a6('0xf0'));}ut[_0x22a6('0x70')](_0x191d34,_0x22a6('0xf1'));logger[_0x22a6('0x53')](_0x22a6('0xf2'),_0x3a870d[_0x22a6('0xad')],_0x22a6('0xae'),_0x191d34['name'],'originated:\x20',_0x191d34[_0x22a6('0x57')]);delete this[_0x22a6('0x10')][_0x3a870d['uniqueid']];};Preview[_0x22a6('0x5c')]['checkInBlack']=function(_0x2fd6b1,_0x219425,_0x228c10,_0x10bf29,_0x22877c){var _0x3b1cf4=this;return new BPromise(function(_0x2c3a40,_0x27b952){if(_[_0x22a6('0x7b')](_0x219425)||_[_0x22a6('0x7b')](_0x219425[_0x22a6('0xf3')])||_[_0x22a6('0x7b')](_0x219425[_0x22a6('0xf3')][_0x22a6('0xf4')])||_[_0x22a6('0x7b')](_0x219425[_0x22a6('0x6c')])){_0x27b952(ut['message'](_0x22a6('0xf5'),_0x10bf29,_0x22877c));return;}var _0x32816e=uuid['v4']();var _0x165d68=_0x3b1cf4[_0x22a6('0x5e')][_0x219425['Queue'][_0x22a6('0x23')]];var _0x1c6983=_0x228c10?_0x3b1cf4['agents'][_0x228c10]['id']:undefined;_0x3b1cf4[_0x22a6('0x10')][_0x32816e]=new Action(_0x219425,_0x165d68,_0x32816e,_0x228c10,_0x1c6983);var _0x1257e6=_0x3b1cf4[_0x22a6('0x10')][_0x32816e];_0x1257e6['unlockAgent']=_0x10bf29;_0x1257e6['activeContact']=_0x22877c;_0x1257e6[_0x22a6('0xf6')]=_0x228c10;if(_[_0x22a6('0xf7')](_0x2fd6b1)){_0x3b1cf4['execCall'](_0x1257e6,_0x165d68,_0x219425,_0x228c10)['then'](function(_0x99dfdb){logger['info']('[Preview][execCall][success]',_0x22a6('0xf8')+_0x1257e6[_0x22a6('0x66')]+'\x20IdHopper:\x20'+_0x1257e6[_0x22a6('0xf9')],JSON[_0x22a6('0x4e')](_0x99dfdb));ami[_0x22a6('0x55')]('custom:agentcalled',ut['buildObj'](_0x1257e6,_0x22a6('0xfa'),_0x3b1cf4[_0x22a6('0x5e')][_0x1257e6[_0x22a6('0x66')]]));_0x2c3a40(ut['message'](_0x22a6('0xfb')));})[_0x22a6('0x85')](function(_0x1f6974){ut[_0x22a6('0x5a')]('[Preview][execCall][failure]',_0x1f6974);_0x27b952(ut[_0x22a6('0x43')]('Call\x20failed',_0x10bf29,_0x22877c));});}else{_0x165d68[_0x22a6('0x33')]+=0x1;ut[_0x22a6('0xfc')](_0x1257e6);rpcDb['createHistory'](_0x1257e6,_0x22a6('0xfd'));delete _0x3b1cf4[_0x22a6('0x10')][_0x32816e];_0x27b952(ut['message']('Contact\x20in\x20black\x20List',_0x10bf29,_0x22877c));}});};Preview[_0x22a6('0x5c')]['isTrunkReachable']=function(_0x51f124){return!_[_0x22a6('0x7b')](_0x51f124)&&!_['isNil'](_0x51f124['name'])&&!_[_0x22a6('0x7b')](_0x51f124['active'])&&_0x51f124[_0x22a6('0x4b')]&&!_[_0x22a6('0x7b')](this['trunks'][util['format'](_0x22a6('0xfe'),_0x51f124[_0x22a6('0x23')])])&&!_['isNil'](this[_0x22a6('0xf')][util[_0x22a6('0x50')](_0x22a6('0xfe'),_0x51f124[_0x22a6('0x23')])]['status'])&&(this[_0x22a6('0xf')][util[_0x22a6('0x50')](_0x22a6('0xfe'),_0x51f124[_0x22a6('0x23')])]['status']===_0x22a6('0xff')||this[_0x22a6('0xf')][util['format']('SIP/%s',_0x51f124[_0x22a6('0x23')])][_0x22a6('0x6e')]===_0x22a6('0x100'));};Preview[_0x22a6('0x5c')][_0x22a6('0x82')]=function(_0xe29190,_0x387264){var _0xb4b27=this;return new BPromise(function(_0x4c4db9,_0x3dff16){_0xb4b27[_0x22a6('0x101')](_0xe29190,_0x387264)[_0x22a6('0x7a')](function(_0x42cb7a){_0x4c4db9(_[_0x22a6('0x69')](_0x42cb7a,[_0x22a6('0x43')]));})[_0x22a6('0x85')](function(_0x510868){if(_0x510868[_0x22a6('0x102')]){rpcDb['unlockContact'](_0xe29190);}if(_0x510868[_0x22a6('0x4b')]){rpcDb['disableContact'](_0xe29190);}_0x3dff16(_['pick'](_0x510868,[_0x22a6('0x43')]));});});};Preview['prototype'][_0x22a6('0x101')]=function(_0x499fac,_0xcc80b0){var _0xd0fdd=this;return new BPromise(function(_0x108231,_0x262286){var _0x15760f,_0x5da1b2;rpcDb['getContactPreview'](_0x499fac)[_0x22a6('0x7a')](function(_0x202ece){if(!_[_0x22a6('0x7b')](_0x202ece[0x0])){_0x5da1b2=_0x202ece[0x0][_0x22a6('0x103')]?![]:!![];_0x15760f=_0x202ece[0x0]['recallme']?!![]:![];_0x15760f=_0xcc80b0?!![]:_0x15760f;}var _0x497b0f=_0xd0fdd['validateContact'](_0x202ece);if(_0x497b0f[_0x22a6('0x104')]){rpcDb[_0x22a6('0x105')](_[_0x22a6('0x69')](_0x202ece[0x0],['VoiceQueueId',_0x22a6('0x106')]))[_0x22a6('0x7a')](function(_0x591412){_0xd0fdd[_0x22a6('0x107')](_0x591412,_0x202ece[0x0],_0xcc80b0,_0x5da1b2,_0x15760f)['then'](function(_0x1564e7){_0x108231(_0x1564e7);})[_0x22a6('0x85')](function(_0xe24f3f){_0x262286(_0xe24f3f);});})[_0x22a6('0x85')](function(_0xf49b0f){ut[_0x22a6('0x5a')]('[Preview][checkIsBlackList]',_0xf49b0f);_0x262286(ut[_0x22a6('0x43')](_0x22a6('0x108'),_0x5da1b2,_0x15760f));});}else{_0x262286(ut['message'](_0x497b0f[_0x22a6('0x43')],_0x5da1b2,_0x15760f));}})[_0x22a6('0x85')](function(_0x5293da){ut[_0x22a6('0x5a')](_0x22a6('0x109'),_0x5293da);_0x262286(ut['message'](_0x22a6('0x108'),![],!![]));});});};Preview[_0x22a6('0x5c')]['validateContact']=function(_0x2bdc24){if(_[_0x22a6('0x7b')](_0x2bdc24)||_['isEmpty'](_0x2bdc24)||!_['isNil'](_0x2bdc24[0x0][_0x22a6('0x80')])&&_['isNil'](_0x2bdc24[0x0]['Agent']['name'])){ut[_0x22a6('0x5a')](_0x22a6('0x10a'),_0x2bdc24);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x4fdf72=this[_0x22a6('0x5e')][_0x2bdc24[0x0][_0x22a6('0x65')][_0x22a6('0x23')]];_0x4fdf72[_0x22a6('0x43')]='ACTIVE';if(_[_0x22a6('0x7b')](_0x4fdf72)){ut[_0x22a6('0x5a')](_0x22a6('0x10b'),_0x4fdf72);return{'isValid':![],'message':_0x22a6('0x10c')};}if(!this['isTrunkReachable'](_0x4fdf72['Trunk'])){ut[_0x22a6('0x5a')](_0x22a6('0x10d'),_0x22a6('0x10e')+_0x4fdf72[_0x22a6('0x23')]+_0x22a6('0x10f'));if(!this[_0x22a6('0x94')](_0x4fdf72['TrunkBackup'])){ut[_0x22a6('0x5a')](_0x22a6('0x10d'),_0x4fdf72[_0x22a6('0x23')]+_0x22a6('0x110'));return{'isValid':![],'message':_0x22a6('0x111')};}}if(!ut[_0x22a6('0x112')](_0x4fdf72[_0x22a6('0x2c')])){ut[_0x22a6('0x5a')](_0x22a6('0x113'),_0x4fdf72[_0x22a6('0x23')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4fdf72[_0x22a6('0x23')]+_0x22a6('0x114')};}return{'isValid':!![],'message':_0x22a6('0x115')};};Preview['prototype']['execCall']=function(_0x32bc31,_0x5db9c2,_0x152882,_0x17fd65){var _0x108cdb=this;return new BPromise(function(_0x43d9e0,_0x4597b2){var _0x13fadf=_0x32bc31[_0x22a6('0xad')];var _0x115da7=_0x108cdb[_0x22a6('0x94')](_0x5db9c2[_0x22a6('0x4a')])?util['format'](_0x22a6('0x116'),_0x5db9c2[_0x22a6('0x4a')][_0x22a6('0x23')],_['isNil'](_0x5db9c2[_0x22a6('0x30')])?'':_0x5db9c2[_0x22a6('0x30')]['trim']()||'',_0x5db9c2[_0x22a6('0x117')]>0x0?_0x152882[_0x22a6('0xf3')][_0x22a6('0xf4')][_0x22a6('0x118')](_0x5db9c2['dialCutDigit']):_0x152882[_0x22a6('0xf3')][_0x22a6('0xf4')]):util[_0x22a6('0x50')](_0x22a6('0x116'),_['isNil'](_0x5db9c2[_0x22a6('0x95')])?_0x5db9c2[_0x22a6('0x4a')][_0x22a6('0x23')]:_0x5db9c2[_0x22a6('0x95')][_0x22a6('0x23')],_[_0x22a6('0x7b')](_0x5db9c2[_0x22a6('0x30')])?'':_0x5db9c2[_0x22a6('0x30')][_0x22a6('0x119')]()||'',_0x5db9c2['dialCutDigit']>0x0?_0x152882[_0x22a6('0xf3')][_0x22a6('0xf4')]['substring'](_0x5db9c2['dialCutDigit']):_0x152882[_0x22a6('0xf3')][_0x22a6('0xf4')]);var _0x4cff6b=_0x108cdb['isTrunkReachable'](_0x5db9c2['Trunk'])?ut[_0x22a6('0x11a')](_0x5db9c2[_0x22a6('0x4a')][_0x22a6('0x4c')],_0x5db9c2[_0x22a6('0x2e')],_0x5db9c2['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x22a6('0x11b')](_0x5db9c2[_0x22a6('0x11c')],_0x5db9c2[_0x22a6('0x11d')]):_0x5db9c2[_0x22a6('0x11c')]):ut[_0x22a6('0x11a')](_['isNil'](_0x5db9c2[_0x22a6('0x95')])?_0x5db9c2[_0x22a6('0x4a')][_0x22a6('0x4c')]:_0x5db9c2[_0x22a6('0x95')][_0x22a6('0x4c')],_0x5db9c2['dialOriginateCallerIdName'],_0x5db9c2[_0x22a6('0x11d')]>0x0?ut[_0x22a6('0x11b')](_0x5db9c2[_0x22a6('0x11c')],_0x5db9c2[_0x22a6('0x11d')]):_0x5db9c2['dialOriginateCallerIdNumber']);if(_0x4cff6b){_0x32bc31[_0x22a6('0x11e')]=ut[_0x22a6('0x11f')](_0x4cff6b);_0x32bc31['originatecalleridnum']=ut[_0x22a6('0x120')](_0x4cff6b);}var _0x57f285=ut[_0x22a6('0x121')](_0x5db9c2,_0x152882,_0x115da7,_0x4cff6b,_0x13fadf,_0x32bc31);_[_0x22a6('0x122')](_0x32bc31,ut['toLowerVariables'](_0x57f285));_0x32bc31[_0x22a6('0x87')]=moment()[_0x22a6('0x50')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x22a6('0x6d')](ut['variablesAction'](_0x32bc31,_0x5db9c2,_0x57f285,_0x32bc31[_0x22a6('0xc3')],_0x17fd65))[_0x22a6('0x7a')](function(_0xc543e2){var _0x258fce=_0x32bc31['channelAgent'];if(!_[_0x22a6('0x7b')](_0x258fce)){if(!_[_0x22a6('0x7b')](_0x108cdb[_0x22a6('0x11')][_0x258fce])){_0x108cdb['agents'][_0x258fce]['destconnectedlinenum']=_0x32bc31[_0x22a6('0x123')];emit(util['format'](_0x22a6('0x124'),_0x108cdb[_0x22a6('0x11')][_0x258fce][_0x22a6('0x23')]),'user:agentconnect',{'destaccountcode':_0x108cdb[_0x22a6('0x11')][_0x258fce]['accountcode'],'destconnectedlinenum':_0x32bc31[_0x22a6('0x123')]});}}_0x5db9c2[_0x22a6('0x57')]+=0x1;logger[_0x22a6('0x53')](_0x22a6('0x125'),_0x13fadf,_0x22a6('0xae'),_0x5db9c2[_0x22a6('0x23')],_0x22a6('0xe6'),_0x5db9c2[_0x22a6('0x57')]);_0x43d9e0(_0xc543e2);})['catch'](function(_0xf06870){ut['logAgent'](_0x32bc31,0xe,_0x22a6('0x126'));rpcDb[_0x22a6('0xeb')](_0x32bc31,'[originateFailure][logOriginateFailure]');_0x4597b2(_0xf06870);});});};Preview[_0x22a6('0x5c')][_0x22a6('0x1a')]=function(_0x61723){if(this[_0x22a6('0x10')][_0x61723['linkedid']]){this[_0x22a6('0x10')][_0x61723[_0x22a6('0xa7')]][_0x22a6('0x127')]=_0x61723['channel'];}};Preview[_0x22a6('0x5c')][_0x22a6('0x128')]=function(_0x13b112){var _0xd223c4=this;var _0x3da03a=this[_0x22a6('0x10')][_0x13b112['actionid']];if(_0x3da03a){if(_0x3da03a['lookAgent']&&this[_0x22a6('0x11')][_0x3da03a[_0x22a6('0xf6')]]){ut[_0x22a6('0x129')](_0x3da03a,this[_0x22a6('0x11')][_0x3da03a[_0x22a6('0xf6')]]['name'],this[_0x22a6('0x11')][_0x3da03a[_0x22a6('0xf6')]]['id']);}var _0x1d4a16=_[_0x22a6('0x12a')](_0x3da03a);_0x1d4a16[_0x22a6('0xaa')]=moment()[_0x22a6('0x50')](_0x22a6('0xa9'));var _0x1a018b=_0xd223c4[_0x22a6('0x5e')][_0x3da03a[_0x22a6('0x66')]];if(ut[_0x22a6('0x12b')](_0x13b112[_0x22a6('0x12c')])){if(_0x3da03a[_0x22a6('0xa6')]){rpcDb[_0x22a6('0x12d')](_0x3da03a['idContact']);}if(_0x3da03a[_0x22a6('0xc3')]){rpcDb[_0x22a6('0x86')](_0x3da03a[_0x22a6('0xf9')]);}ami['emit'](_0x22a6('0x12e'),ut[_0x22a6('0x9c')](_0x3da03a,_0x22a6('0x12f'),this['campaignsPreview'][_0x3da03a[_0x22a6('0x66')]]));this[_0x22a6('0xe8')](_0x1d4a16,_0x1a018b,_0x13b112);}else{_0x3da03a[_0x22a6('0x87')]=moment()[_0x22a6('0x50')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x22a6('0xed')](_0x1d4a16,0x4,_0x22a6('0x130'));rpcDb[_0x22a6('0xeb')](_0x1d4a16,_0x22a6('0x131'));}}};Preview[_0x22a6('0x5c')]['syncHangup']=function(_0x27ac03){var _0x549e78=this;var _0x1ad1bc=this['actions'][_0x27ac03[_0x22a6('0xa7')]];var _0x28af27;if(_0x1ad1bc){_0x28af27=this[_0x22a6('0x5e')][_0x1ad1bc['queue']];logger[_0x22a6('0x53')](_0x22a6('0x132'),_0x27ac03[_0x22a6('0xa7')],_0x22a6('0xae'),_0x28af27['name'],_0x22a6('0x67'),_0x28af27[_0x22a6('0x25')]);}if(this[_0x22a6('0x10')][_0x27ac03[_0x22a6('0xa7')]]&&_0x27ac03[_0x22a6('0xa7')]!==_0x27ac03[_0x22a6('0xad')]){if(_0x27ac03[_0x22a6('0x133')]==='16'&&this[_0x22a6('0x10')][_0x27ac03['linkedid']][_0x22a6('0x68')]){this[_0x22a6('0x97')](_0x27ac03,_0x27ac03[_0x22a6('0xa7')],_0x27ac03['cause']);}else if(this['actions'][_0x27ac03[_0x22a6('0xa7')]][_0x22a6('0x68')]){logger[_0x22a6('0x53')](_0x22a6('0x134'),_0x27ac03[_0x22a6('0xa7')],_0x27ac03[_0x22a6('0x133')],_0x22a6('0xae'),_0x28af27[_0x22a6('0x23')],_0x22a6('0x67'),_0x28af27[_0x22a6('0x25')]);this[_0x22a6('0x97')](_0x27ac03,_0x27ac03[_0x22a6('0xa7')],_0x27ac03[_0x22a6('0x133')]);}}else if(_0x1ad1bc&&_['isNil'](_0x1ad1bc[_0x22a6('0x135')])&&_0x28af27[_0x22a6('0x136')]&&_0x27ac03[_0x22a6('0xa7')]===_0x27ac03[_0x22a6('0xad')]&&_[_0x22a6('0x7b')](_0x27ac03[_0x22a6('0xef')])&&_0x27ac03[_0x22a6('0x133')]==='16'&&_0x27ac03[_0x22a6('0x137')]==='6'&&_['isUndefined'](_0x1ad1bc[_0x22a6('0x138')])){if(_0x1ad1bc[_0x22a6('0xa6')]){rpcDb[_0x22a6('0x12d')](_0x1ad1bc[_0x22a6('0xf9')]);}if(_0x1ad1bc[_0x22a6('0xc3')]){rpcDb[_0x22a6('0x86')](_0x1ad1bc['idContact']);}_0x27ac03[_0x22a6('0xef')]='22';this['callProgressDetectingAgent'](_0x1ad1bc,_0x28af27,_0x27ac03);}else if(_0x1ad1bc&&_0x1ad1bc[_0x22a6('0x138')]){if(_0x27ac03[_0x22a6('0x133')]==='16'&&this['actions'][_0x27ac03[_0x22a6('0xa7')]][_0x22a6('0x68')]){logger[_0x22a6('0x53')]('[syncHangup][talking][transfer]',_0x27ac03[_0x22a6('0xa7')],_0x27ac03[_0x22a6('0x133')],_0x22a6('0xae'),_0x28af27[_0x22a6('0x23')],_0x22a6('0x67'),_0x28af27['pTalking']);this[_0x22a6('0x97')](_0x27ac03,_0x27ac03[_0x22a6('0xa7')],_0x27ac03[_0x22a6('0x133')]);}else if(this[_0x22a6('0x10')][_0x27ac03[_0x22a6('0xa7')]][_0x22a6('0x68')]){logger[_0x22a6('0x53')](_0x22a6('0x134'),_0x27ac03[_0x22a6('0xa7')],_0x27ac03['cause'],'\x20Queue',_0x28af27[_0x22a6('0x23')],'pTalking:\x20',_0x28af27[_0x22a6('0x25')]);this[_0x22a6('0x97')](_0x27ac03,_0x27ac03[_0x22a6('0xa7')],_0x27ac03[_0x22a6('0x133')]);}}};Preview[_0x22a6('0x5c')][_0x22a6('0x18')]=function(_0x1e904e){if(this[_0x22a6('0x10')][_0x1e904e[_0x22a6('0xe7')]]&&_0x1e904e[_0x22a6('0xe7')]!==_0x1e904e[_0x22a6('0x139')]){this[_0x22a6('0x97')](_0x1e904e,_0x1e904e[_0x22a6('0xe7')],_0x1e904e['dialstatus']);}};Preview[_0x22a6('0x5c')][_0x22a6('0x16')]=function(_0x194d38){if(this[_0x22a6('0x10')][_0x194d38[_0x22a6('0xa7')]]&&_0x194d38[_0x22a6('0xa7')]!==_0x194d38[_0x22a6('0xad')]&&!this[_0x22a6('0x10')][_0x194d38[_0x22a6('0xa7')]][_0x22a6('0x68')]){if(_0x194d38['cause']==='1'){this['callProgressDetectingCustomer'](_0x194d38,_0x194d38[_0x22a6('0xa7')],_0x194d38[_0x22a6('0x133')]);}}};Preview[_0x22a6('0x5c')][_0x22a6('0x13a')]=function(_0x5a0cab,_0x163956,_0x5e4a07){if(this[_0x22a6('0x10')][_0x5a0cab]){if(_[_0x22a6('0x7b')](this['actions'][_0x5a0cab][_0x22a6('0x13b')])){this['actions'][_0x5a0cab][_0x22a6('0x13b')]={};}this[_0x22a6('0x10')][_0x5a0cab][_0x22a6('0x13b')][_0x163956]=_0x5e4a07;}};Preview[_0x22a6('0x5c')][_0x22a6('0x1c')]=function(_0x21422c){try{if(!_[_0x22a6('0x7b')](_0x21422c)){if(ut[_0x22a6('0x13c')](_['keys'](_0x21422c[_0x22a6('0x13d')])[0x0])){this[_0x22a6('0x13a')](_0x21422c[_0x22a6('0xad')],_[_0x22a6('0x13e')](_0x21422c['variable'])[0x0],_0x21422c[_0x22a6('0x13f')]);}}}catch(_0x20e452){logger[_0x22a6('0x140')](_0x22a6('0x141'),util[_0x22a6('0x142')](_0x20e452,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x18436d){if(_0x18436d){if(this['actions'][_0x18436d['transfertargetlinkedid']]){this[_0x22a6('0x10')][_0x18436d['transfertargetlinkedid']][_0x22a6('0x138')]=!![];}}};Preview[_0x22a6('0x5c')][_0x22a6('0x1f')]=function(_0x22b8d2){if(_0x22b8d2){if(this[_0x22a6('0x10')][_0x22b8d2[_0x22a6('0x143')]]){this[_0x22a6('0x10')][_0x22b8d2[_0x22a6('0x143')]]['transfer']=!![];}}};module[_0x22a6('0x144')]=Preview; \ No newline at end of file +var _0xcea4=['newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialActive','setMessage','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','[RecallMe]','catch','logger2','disableContact','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','ACTIVE','totalGlobal','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','countnosuchnumberretry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','uniqueid','linkedid','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','activeContact','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','run','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','trim','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','starttime','variablesAction','channelAgent','destconnectedlinenum','user:%s','accountcode','\x20Queue','lookAgent','logLookAgent','clone','isFailure','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','preview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','dialend'];(function(_0x5e6f69,_0xe2b769){var _0x55061c=function(_0x55ae49){while(--_0x55ae49){_0x5e6f69['push'](_0x5e6f69['shift']());}};_0x55061c(++_0xe2b769);}(_0xcea4,0x13e));var _0x4cea=function(_0x24487f,_0x9b3ea0){_0x24487f=_0x24487f-0x0;var _0x456456=_0xcea4[_0x24487f];return _0x456456;};'use strict';var util=require('util');var _=require(_0x4cea('0x0'));var BPromise=require(_0x4cea('0x1'));var uuid=require(_0x4cea('0x2'));var moment=require(_0x4cea('0x3'));var md5=require(_0x4cea('0x4'));var Redis=require(_0x4cea('0x5'));var config=require('../../../config/environment');var logger=require(_0x4cea('0x6'))(_0x4cea('0x7'));var loggerAction=require(_0x4cea('0x6'))('actionPreview');var ami=require(_0x4cea('0x8'));var rpcDb=require(_0x4cea('0x9'));var Action=require(_0x4cea('0xa'));var ut=require(_0x4cea('0xb'));config[_0x4cea('0xc')]=_[_0x4cea('0xd')](config[_0x4cea('0xc')],{'host':_0x4cea('0xe'),'port':0x18eb});var io=require(_0x4cea('0xf'))(new Redis(config[_0x4cea('0xc')]));var Sequence=function(){};Sequence[_0x4cea('0x10')][_0x4cea('0x11')]=function(_0x5e4e1a){this[_0x4cea('0x12')]=this['tail']?this[_0x4cea('0x12')][_0x4cea('0x13')](_0x5e4e1a):_0x5e4e1a();};function Preview(_0x2bb846){this[_0x4cea('0x14')]=new Sequence();this[_0x4cea('0x15')]=_0x2bb846[_0x4cea('0x16')];this[_0x4cea('0x17')]=_0x2bb846[_0x4cea('0x17')];this['actions']={};this[_0x4cea('0x18')]=_0x2bb846['agents'];this[_0x4cea('0x19')]=0x0;ami['on'](_0x4cea('0x1a'),this[_0x4cea('0x1b')][_0x4cea('0x1c')](this));ami['on'](_0x4cea('0x1d'),this['syncHangup'][_0x4cea('0x1c')](this));ami['on'](_0x4cea('0x1e'),this['syncHangupRequest'][_0x4cea('0x1c')](this));ami['on'](_0x4cea('0x1f'),this['syncDialEnd'][_0x4cea('0x1c')](this));ami['on'](_0x4cea('0x20'),this[_0x4cea('0x21')][_0x4cea('0x1c')](this));ami['on'](_0x4cea('0x22'),this[_0x4cea('0x23')][_0x4cea('0x1c')](this));ami['on'](_0x4cea('0x24'),this[_0x4cea('0x25')][_0x4cea('0x1c')](this));ami['on'](_0x4cea('0x26'),this[_0x4cea('0x27')][_0x4cea('0x1c')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x35f5ce,_0x358943,_0x2df340){io['to'](_0x35f5ce)[_0x4cea('0x28')](_0x358943,_0x2df340);}function emitCampaignPreview(_0x1ee06e){if(_0x1ee06e[_0x4cea('0x29')]===_0x4cea('0x2a')){var _0x3d9709={'id':_0x1ee06e['id'],'name':_0x1ee06e[_0x4cea('0x2b')],'strategy':_0x1ee06e[_0x4cea('0x2c')],'answered':_0x1ee06e[_0x4cea('0x2d')],'available':_0x1ee06e[_0x4cea('0x2e')],'loggedIn':_0x1ee06e[_0x4cea('0x2f')],'pTalking':_0x1ee06e[_0x4cea('0x30')],'sumBillable':_0x1ee06e[_0x4cea('0x31')],'sumDuration':_0x1ee06e['sumDuration'],'sumHoldTime':_0x1ee06e[_0x4cea('0x32')]||0x0,'talking':_0x1ee06e[_0x4cea('0x33')],'total':_0x1ee06e[_0x4cea('0x34')],'type':_0x1ee06e[_0x4cea('0x29')],'unmanaged':_0x1ee06e[_0x4cea('0x35')],'abandoned':_0x1ee06e['abandoned'],'waiting':_0x1ee06e[_0x4cea('0x36')],'loggedInDb':_0x1ee06e[_0x4cea('0x37')],'dialActive':_0x1ee06e['dialActive'],'dialMethod':_0x1ee06e[_0x4cea('0x38')],'dialOriginateCallerIdName':_0x1ee06e[_0x4cea('0x39')],'dialOriginateCallerIdNumber':_0x1ee06e[_0x4cea('0x3a')],'dialOriginateTimeout':_0x1ee06e[_0x4cea('0x3b')],'dialPrefix':_0x1ee06e[_0x4cea('0x3c')],'outboundAnswerAgiCallsDay':_0x1ee06e[_0x4cea('0x3d')],'outboundAnswerCallsDay':_0x1ee06e['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x1ee06e[_0x4cea('0x3e')],'outboundBusyCallsDay':_0x1ee06e['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1ee06e['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1ee06e[_0x4cea('0x3f')],'outboundDropCallsDayCallersExit':_0x1ee06e[_0x4cea('0x40')],'outboundDropCallsDayTimeout':_0x1ee06e[_0x4cea('0x41')],'outboundNoAnswerCallsDay':_0x1ee06e['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1ee06e['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1ee06e[_0x4cea('0x42')],'outboundReCallsDay':_0x1ee06e[_0x4cea('0x43')],'outboundRejectCallsDay':_0x1ee06e[_0x4cea('0x44')],'outboundUnknownCallsDay':_0x1ee06e[_0x4cea('0x45')],'outboundAbandonedCallsDay':_0x1ee06e['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x1ee06e[_0x4cea('0x46')],'predictiveIntervalAvgHoldtime':_0x1ee06e[_0x4cea('0x47')],'predictiveIntervalAvgTalktime':_0x1ee06e[_0x4cea('0x48')],'predictiveIntervalDroppedCallsCallersExit':_0x1ee06e[_0x4cea('0x49')],'predictiveIntervalDroppedCallsTimeout':_0x1ee06e[_0x4cea('0x4a')],'predictiveIntervalErlangCalls':_0x1ee06e[_0x4cea('0x4b')],'predictiveIntervalErlangCallsDroppedCalls':_0x1ee06e[_0x4cea('0x4c')],'predictiveIntervalHitRate':_0x1ee06e[_0x4cea('0x4d')],'predictiveIntervalMultiplicativeFactor':_0x1ee06e['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x1ee06e['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x1ee06e[_0x4cea('0x4e')],'predictiveIntervalTotalCalls':_0x1ee06e[_0x4cea('0x4f')],'message':_0x1ee06e[_0x4cea('0x50')],'originated':_0x1ee06e[_0x4cea('0x51')],'erlangCalls':_0x1ee06e['erlangCalls'],'erlangCallToSecond':_0x1ee06e[_0x4cea('0x52')],'erlangAbandonmentRate':_0x1ee06e[_0x4cea('0x53')],'erlangBusyFactor':_0x1ee06e[_0x4cea('0x54')],'startPredictive':_0x1ee06e['startPredictive'],'startProgressive':_0x1ee06e[_0x4cea('0x55')]};if(_0x1ee06e[_0x4cea('0x56')]){_0x3d9709[_0x4cea('0x56')]={'id':_0x1ee06e[_0x4cea('0x56')]['id'],'name':_0x1ee06e[_0x4cea('0x56')]['name'],'active':_0x1ee06e['Trunk'][_0x4cea('0x57')],'callerid':_0x1ee06e[_0x4cea('0x56')]['callerid']};}if(_0x1ee06e[_0x4cea('0x58')]){_0x3d9709[_0x4cea('0x58')]={'id':_0x1ee06e['Interval']['id'],'name':_0x1ee06e[_0x4cea('0x58')]['name']};}var _0x2ea907=md5(JSON[_0x4cea('0x59')](_0x3d9709));if(_0x1ee06e[_0x4cea('0x4')]!==_0x2ea907){_0x1ee06e[_0x4cea('0x4')]=_0x2ea907;emit(util[_0x4cea('0x5a')](_0x4cea('0x5b'),_0x3d9709[_0x4cea('0x2b')]),_0x4cea('0x5c'),_0x3d9709);}}}function emitVoiceQueueChannelRemove(_0x509557){logger[_0x4cea('0x5d')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x4cea('0x59')](_0x509557));emit(util[_0x4cea('0x5a')](_0x4cea('0x5b'),_0x509557[_0x4cea('0x2b')]),_0x4cea('0x5e'),_0x509557);io[_0x4cea('0x28')](_0x4cea('0x5f'),_0x509557);}function notSendMessagesQueue(_0x4fde2f){if(_0x4fde2f[_0x4cea('0x60')]){if(_0x4fde2f[_0x4cea('0x51')]===0x0&&_0x4fde2f[_0x4cea('0x30')]===0x0){_0x4fde2f[_0x4cea('0x60')]=![];_0x4fde2f['available']=0x0;_0x4fde2f['paused']=0x0;_0x4fde2f[_0x4cea('0x50')]=_0x4cea('0x61');ut[_0x4cea('0x62')](_0x4cea('0x63'),_0x4fde2f[_0x4cea('0x2b')]+_0x4cea('0x64'));}else{_0x4fde2f[_0x4cea('0x50')]=_0x4cea('0x65');ut[_0x4cea('0x62')](_0x4cea('0x63'),_0x4fde2f[_0x4cea('0x2b')]+_0x4cea('0x66'));}emitCampaignPreview(_0x4fde2f);}}Preview[_0x4cea('0x10')][_0x4cea('0x67')]=function(){var _0x43833a=this;setInterval(function(){_0x43833a[_0x4cea('0x68')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x3cc7b3=this['campaignsPreview'];this[_0x4cea('0x19')]+=0x1;for(var _0x56e11f in _0x3cc7b3){if(_0x3cc7b3[_0x4cea('0x69')](_0x56e11f)&&(_0x3cc7b3[_0x56e11f]['dialMethod']==='preview'||_0x3cc7b3[_0x56e11f][_0x4cea('0x38')]===_0x4cea('0x6a'))&&_0x3cc7b3[_0x56e11f]['type']===_0x4cea('0x2a')){if(this[_0x4cea('0x19')]>0x7){this[_0x4cea('0x19')]=0x0;this[_0x4cea('0x6b')]();}}if(_0x3cc7b3['hasOwnProperty'](_0x56e11f)&&_0x3cc7b3[_0x56e11f][_0x4cea('0x38')]===_0x4cea('0x7')&&_0x3cc7b3[_0x56e11f][_0x4cea('0x29')]===_0x4cea('0x2a')){if(_0x3cc7b3[_0x56e11f][_0x4cea('0x6c')]){this[_0x4cea('0x6d')](_0x3cc7b3[_0x56e11f]);this['recallMe'](_0x3cc7b3[_0x56e11f]);}else{notSendMessagesQueue(_0x3cc7b3[_0x56e11f]);}}}};Preview[_0x4cea('0x10')][_0x4cea('0x6e')]=function(_0xcf475b){var _0x41472f=this;this[_0x4cea('0x14')][_0x4cea('0x11')](function(){if(!_[_0x4cea('0x6f')](_0x41472f[_0x4cea('0x70')][_0xcf475b])){loggerAction[_0x4cea('0x5d')](_0x4cea('0x71'),_0xcf475b,_0x4cea('0x72'),_0x41472f['actions'][_0xcf475b]['queue'],_0x4cea('0x73'),JSON[_0x4cea('0x59')](_0x41472f[_0x4cea('0x15')][_0x41472f[_0x4cea('0x70')][_0xcf475b][_0x4cea('0x74')]][_0x4cea('0x51')]),_0x4cea('0x75'),JSON[_0x4cea('0x59')](_0x41472f[_0x4cea('0x15')][_0x41472f[_0x4cea('0x70')][_0xcf475b]['queue']][_0x4cea('0x30')]),JSON[_0x4cea('0x59')](_0x41472f[_0x4cea('0x70')][_0xcf475b][_0x4cea('0x76')]),JSON['stringify'](_[_0x4cea('0x77')](_0x41472f['actions'][_0xcf475b],[_0x4cea('0x78'),'UserId',_0x4cea('0x79'),'ListId'])));return ami['Action']({'action':'status','channel':_0x41472f[_0x4cea('0x70')][_0xcf475b][_0x4cea('0x7a')]})['catch'](function(_0x34d116){if(_0x34d116['message']===_0x4cea('0x7b')){setTimeout(function(){if(_0x41472f[_0x4cea('0x70')][_0xcf475b]){ut[_0x4cea('0x7c')](_0x41472f[_0x4cea('0x15')][_0x41472f[_0x4cea('0x70')][_0xcf475b]['queue']],_0x4cea('0x7d'));if(_0x41472f[_0x4cea('0x70')][_0xcf475b][_0x4cea('0x76')]===!![]){ut[_0x4cea('0x7e')](_0x41472f['campaignsPreview'][_0x41472f[_0x4cea('0x70')][_0xcf475b][_0x4cea('0x74')]],_0x4cea('0x7d'));ut[_0x4cea('0x7f')]('[Dialer][checkChannel][pTalking][Preview]'+_0xcf475b,_0x41472f[_0x4cea('0x70')][_0xcf475b]['queue']);}ut[_0x4cea('0x7f')](_0x4cea('0x80')+_0xcf475b,_0x41472f[_0x4cea('0x70')][_0xcf475b][_0x4cea('0x74')]);delete _0x41472f[_0x4cea('0x70')][_0xcf475b];}},0x2328);}});}});};Preview['prototype'][_0x4cea('0x6b')]=function(){var _0x1f9b7c=this;loggerAction[_0x4cea('0x5d')](_0x4cea('0x81'),_[_0x4cea('0x82')](this[_0x4cea('0x70')]));for(var _0xf18235 in this['actions']){if(_0x1f9b7c['actions'][_0x4cea('0x69')](_0xf18235)){_0x1f9b7c[_0x4cea('0x6e')](_0xf18235);}}};Preview[_0x4cea('0x10')][_0x4cea('0x83')]=function(_0x18adea){var _0x14ef38=this;rpcDb[_0x4cea('0x84')](_0x18adea['id'],ut[_0x4cea('0x85')](this[_0x4cea('0x18')]))[_0x4cea('0x86')](function(_0x46e779){if(!_[_0x4cea('0x6f')](_0x46e779)){for(var _0x35d7b6=0x0;_0x35d7b6<_0x46e779[_0x4cea('0x87')];_0x35d7b6+=0x1){if(ut[_0x4cea('0x88')](_0x46e779[_0x35d7b6][_0x4cea('0x89')])<_0x18adea['dialRecallMeTimeout']*0x3c){if(_0x46e779[_0x35d7b6][_0x4cea('0x8a')]&&!_0x46e779[_0x35d7b6][_0x4cea('0x8a')]['voicePause']){_0x14ef38['run'](_0x46e779[_0x35d7b6]['id'])[_0x4cea('0x86')](ut['logger2'](_0x4cea('0x8b')))[_0x4cea('0x8c')](ut[_0x4cea('0x8d')](_0x4cea('0x8b')));}else{rpcDb[_0x4cea('0x8e')](_0x46e779[_0x35d7b6]['id']);}}else{var _0x1dd0d7=new Action(_0x46e779[_0x35d7b6],_0x18adea);_0x1dd0d7['starttime']=moment()[_0x4cea('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x18adea['outboundReCallsDay']+=0x1;ut[_0x4cea('0x8f')](_0x1dd0d7,0x17,_0x4cea('0x90'));if(_0x18adea[_0x4cea('0x91')]){rpcDb[_0x4cea('0x92')](ut[_0x4cea('0x93')](_0x46e779[_0x35d7b6]));rpcDb[_0x4cea('0x94')](_0x1dd0d7,_0x4cea('0x95'));}else{ut[_0x4cea('0x8f')](_0x1dd0d7,0x16,_0x4cea('0x96'));rpcDb['createCustomerHistory'](_0x1dd0d7,'[HistoryRecallClose]');rpcDb[_0x4cea('0x97')](_0x1dd0d7,'[HistoryRecallClose]');}}}}})[_0x4cea('0x8c')](ut[_0x4cea('0x8d')](_0x4cea('0x98')));};Preview[_0x4cea('0x10')][_0x4cea('0x6d')]=function(_0x9f200){_0x9f200[_0x4cea('0x60')]=!![];if(ut[_0x4cea('0x99')](_0x9f200['loggedIn'])){_0x9f200['message']=_0x4cea('0x9a');}else if(!ut[_0x4cea('0x9b')](_0x9f200['dialActive'])){_0x9f200[_0x4cea('0x50')]='NOT_ACTIVE';}else if(!this[_0x4cea('0x9c')](_0x9f200[_0x4cea('0x56')])){if(!this[_0x4cea('0x9c')](_0x9f200['TrunkBackup'])){_0x9f200[_0x4cea('0x50')]='TRUNK_IS_NOT_REACHABLE';}else{_0x9f200[_0x4cea('0x50')]=_0x4cea('0x9d');}}else{_0x9f200[_0x4cea('0x50')]=_0x4cea('0x9d');}emitCampaignPreview(_0x9f200);};Preview[_0x4cea('0x10')]['callProgressDetectingCustomer']=function(_0x5aaae2,_0x160cde,_0x4efdaf){var _0x2b0b4e=this;var _0x323be7=this[_0x4cea('0x70')][_0x160cde];var _0x50db4f=this[_0x4cea('0x15')][_0x323be7[_0x4cea('0x74')]];var _0x2e2eff;if(_0x50db4f){switch(_0x4efdaf){case'1':_0x50db4f['outboundNoSuchCallsDay']+=0x1;_0x323be7['countnosuchnumberretry']+=0x1;_0x323be7['countglobal']=ut[_0x4cea('0x9e')](_0x323be7);ut['logCustomer'](_0x323be7,0x0,'NoSuchNumber');ami[_0x4cea('0x28')]('custom:agentnosuchnumber',ut[_0x4cea('0x9f')](_0x323be7,_0x4cea('0xa0')));rpcDb[_0x4cea('0x94')](_0x323be7,_0x4cea('0xa1'));if(ut['totalGlobal'](_0x323be7)>=_0x50db4f[_0x4cea('0xa2')]){_0x2e2eff=ut[_0x4cea('0xa3')](_0x323be7,0xf,_0x4cea('0xa4'));rpcDb['createCustomerFinal'](_0x2e2eff,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x323be7[_0x4cea('0xa5')]>=_0x50db4f['dialNoSuchNumberMaxRetry']){rpcDb[_0x4cea('0x97')](_0x323be7,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x4cea('0xa6')](ut[_0x4cea('0xa7')](_0x323be7,_0x4cea('0xa5'),_0x50db4f[_0x4cea('0xa8')]),_0x323be7[_0x4cea('0xa9')],_0x323be7['activeContact']);}}delete this[_0x4cea('0x70')][_0x5aaae2['linkedid']];break;case'ANSWER':var _0x7d27c1=moment()[_0x4cea('0x5a')](_0x4cea('0xaa'));_0x323be7[_0x4cea('0xab')]=_0x7d27c1;_0x323be7[_0x4cea('0xac')]=_0x7d27c1;_0x323be7[_0x4cea('0x76')]=!![];_0x50db4f[_0x4cea('0x30')]+=0x1;logger['info'](_0x4cea('0xad'),_0x323be7['uniqueid'],'\x20Queue',_0x50db4f[_0x4cea('0x2b')],_0x4cea('0x75'),_0x50db4f[_0x4cea('0x30')]);ami['emit'](_0x4cea('0xae'),ut[_0x4cea('0x9f')](_0x323be7,_0x4cea('0xaf'),this[_0x4cea('0x15')][_0x323be7['queue']]));if(_0x50db4f[_0x4cea('0xb0')]){ami[_0x4cea('0x28')](_0x4cea('0xb1'),ut[_0x4cea('0xb2')](_0x323be7));}break;case'16':ami[_0x4cea('0x28')](_0x4cea('0xb3'),ut['buildObj'](_0x323be7,_0x4cea('0xb4'),this['campaignsPreview'][_0x323be7['queue']]));emitVoiceQueueChannelRemove(ut[_0x4cea('0x9f')](_0x323be7,'complete'));_0x50db4f[_0x4cea('0xb5')]+=0x1;_0x50db4f[_0x4cea('0x34')]+=0x1;_0x50db4f[_0x4cea('0x2d')]+=0x1;ut['decrementTalkink'](_0x50db4f,_0x4cea('0xb6'));_0x323be7[_0x4cea('0xb7')]=ut[_0x4cea('0x9e')](_0x323be7);ut[_0x4cea('0x8f')](_0x323be7,0x4,_0x4cea('0xb8'));rpcDb['createCustomerHistory'](_0x323be7,_0x4cea('0xb9'));rpcDb[_0x4cea('0x97')](_0x323be7,_0x4cea('0xba'));rpcDb[_0x4cea('0xbb')](_0x323be7);_0x50db4f[_0x4cea('0xbc')]+=_0x323be7[_0x4cea('0xbd')];_0x50db4f[_0x4cea('0x31')]+=_0x323be7[_0x4cea('0xbd')];logger['info'](_0x4cea('0xbe'),_0x323be7[_0x4cea('0xbf')],'\x20Queue',_0x50db4f['name'],'pTalking:\x20',_0x50db4f['pTalking']);delete this[_0x4cea('0x70')][_0x5aaae2[_0x4cea('0xc0')]];break;case'BUSY':_0x50db4f['outboundBusyCallsDay']+=0x1;_0x323be7[_0x4cea('0xc1')]+=0x1;_0x323be7[_0x4cea('0xb7')]=ut[_0x4cea('0x9e')](_0x323be7);ut[_0x4cea('0x8f')](_0x323be7,0x5,_0x4cea('0xc2'));ami[_0x4cea('0x28')]('custom:agentbusy',ut[_0x4cea('0x9f')](_0x323be7,_0x4cea('0xc3')));rpcDb[_0x4cea('0x94')](_0x323be7,_0x4cea('0xc4'));if(ut[_0x4cea('0x9e')](_0x323be7)>=_0x50db4f['dialGlobalMaxRetry']){_0x2e2eff=ut['cloneAction'](_0x323be7,0xf,'Global');rpcDb[_0x4cea('0x97')](_0x2e2eff,_0x4cea('0xc5'));}else{if(_0x323be7[_0x4cea('0xc1')]>=_0x50db4f[_0x4cea('0xc6')]){rpcDb[_0x4cea('0x97')](_0x323be7,_0x4cea('0xc4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x323be7,_0x4cea('0xc1'),_0x50db4f['dialBusyRetryFrequency']),_0x323be7['unlockAgent'],_0x323be7[_0x4cea('0xc7')]);}}break;case _0x4cea('0xc8'):_0x50db4f[_0x4cea('0xc9')]+=0x1;_0x323be7['countnoanswerretry']+=0x1;_0x323be7[_0x4cea('0xb7')]=ut[_0x4cea('0x9e')](_0x323be7);ut[_0x4cea('0x8f')](_0x323be7,0x3,_0x4cea('0xca'));ami['emit'](_0x4cea('0xcb'),ut['buildObj'](_0x323be7,_0x4cea('0xcc')));rpcDb[_0x4cea('0x94')](_0x323be7,_0x4cea('0xcd'));if(ut[_0x4cea('0x9e')](_0x323be7)>=_0x50db4f[_0x4cea('0xa2')]){_0x2e2eff=ut[_0x4cea('0xa3')](_0x323be7,0xf,_0x4cea('0xa4'));rpcDb[_0x4cea('0x97')](_0x2e2eff,_0x4cea('0xce'));}else{if(_0x323be7[_0x4cea('0xcf')]>=_0x50db4f[_0x4cea('0xd0')]){rpcDb[_0x4cea('0x97')](_0x323be7,_0x4cea('0xcd'));}else{rpcDb[_0x4cea('0xa6')](ut[_0x4cea('0xa7')](_0x323be7,_0x4cea('0xcf'),_0x50db4f[_0x4cea('0xd1')]),_0x323be7[_0x4cea('0xa9')],_0x323be7['activeContact']);}}break;case _0x4cea('0xd2'):_0x50db4f[_0x4cea('0xd3')]+=0x1;_0x323be7[_0x4cea('0xd4')]+=0x1;_0x323be7['countglobal']=ut[_0x4cea('0x9e')](_0x323be7);ut[_0x4cea('0x8f')](_0x323be7,0x8,_0x4cea('0xd5'));ami[_0x4cea('0x28')](_0x4cea('0xd6'),ut[_0x4cea('0x9f')](_0x323be7,_0x4cea('0xd7')));rpcDb[_0x4cea('0x94')](_0x323be7,_0x4cea('0xd8'));if(ut[_0x4cea('0x9e')](_0x323be7)>=_0x50db4f[_0x4cea('0xa2')]){_0x2e2eff=ut[_0x4cea('0xa3')](_0x323be7,0xf,_0x4cea('0xa4'));rpcDb[_0x4cea('0x97')](_0x2e2eff,_0x4cea('0xd9'));}else{if(_0x323be7[_0x4cea('0xd4')]>=_0x50db4f[_0x4cea('0xda')]){rpcDb[_0x4cea('0x97')](_0x323be7,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x4cea('0xa7')](_0x323be7,_0x4cea('0xd4'),_0x50db4f[_0x4cea('0xdb')]),_0x323be7[_0x4cea('0xa9')],_0x323be7[_0x4cea('0xc7')]);}}break;case _0x4cea('0xdc'):_0x50db4f['outboundRejectCallsDay']+=0x1;_0x323be7[_0x4cea('0xdd')]+=0x1;_0x323be7[_0x4cea('0xb7')]=ut[_0x4cea('0x9e')](_0x323be7);ut[_0x4cea('0x8f')](_0x323be7,0x14,'AgentReject');ami[_0x4cea('0x28')](_0x4cea('0xde'),ut[_0x4cea('0x9f')](_0x323be7,_0x4cea('0xdf')));rpcDb['createCustomerHistory'](_0x323be7,_0x4cea('0xe0'));if(ut[_0x4cea('0x9e')](_0x323be7)>=_0x50db4f[_0x4cea('0xa2')]){_0x2e2eff=ut['cloneAction'](_0x323be7,0x14,_0x4cea('0xe1'));rpcDb['createCustomerFinal'](_0x2e2eff,_0x4cea('0xe2'));}else{if(_0x323be7[_0x4cea('0xdd')]>=_0x50db4f['dialAgentRejectMaxRetry']){rpcDb[_0x4cea('0x97')](_0x323be7,_0x4cea('0xe2'));}else{rpcDb[_0x4cea('0xa6')](ut[_0x4cea('0xa7')](_0x323be7,_0x4cea('0xdd'),_0x50db4f[_0x4cea('0xe3')]),_0x323be7['unlockAgent'],_0x323be7[_0x4cea('0xc7')]);}}break;case _0x4cea('0xe4'):_0x50db4f[_0x4cea('0xe5')]+=0x1;_0x323be7[_0x4cea('0xe6')]+=0x1;_0x323be7[_0x4cea('0xb7')]=ut[_0x4cea('0x9e')](_0x323be7);ut[_0x4cea('0x8f')](_0x323be7,0xb,'Abandoned');rpcDb[_0x4cea('0x94')](_0x323be7,_0x4cea('0xe7'));if(ut[_0x4cea('0x9e')](_0x323be7)>=_0x50db4f['dialGlobalMaxRetry']){_0x2e2eff=ut[_0x4cea('0xa3')](_0x323be7,0xf,_0x4cea('0xa4'));rpcDb['createCustomerFinal'](_0x2e2eff,_0x4cea('0xe7'));}else{if(_0x323be7[_0x4cea('0xe8')]>=_0x50db4f[_0x4cea('0xe9')]){rpcDb['createCustomerFinal'](_0x323be7,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x4cea('0xa6')](ut['scheduledAt'](_0x323be7,_0x4cea('0xe6'),_0x50db4f['dialAbandonedRetryFrequency']),_0x323be7['unlockAgent'],_0x323be7[_0x4cea('0xc7')]);}}break;case'18':_0x50db4f[_0x4cea('0x45')]+=0x1;_0x323be7['countmachineretry']+=0x1;_0x323be7[_0x4cea('0xb7')]=ut[_0x4cea('0x9e')](_0x323be7);ut[_0x4cea('0x8f')](_0x323be7,0x12,_0x5aaae2[_0x4cea('0xea')]||_0x5aaae2[_0x4cea('0xeb')]);ami[_0x4cea('0x28')](_0x4cea('0xec'),ut[_0x4cea('0x9f')](_0x323be7,'amd'));rpcDb[_0x4cea('0x94')](_0x323be7,_0x4cea('0xed'));if(ut[_0x4cea('0x9e')](_0x323be7)>=_0x50db4f['dialGlobalMaxRetry']){_0x2e2eff=ut[_0x4cea('0xa3')](_0x323be7,0xf,_0x4cea('0xa4'));rpcDb[_0x4cea('0x97')](_0x2e2eff,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x4cea('0x97')](_0x323be7,_0x4cea('0xed'));}delete this[_0x4cea('0x70')][_0x5aaae2[_0x4cea('0xc0')]];break;case'19':_0x50db4f[_0x4cea('0x45')]+=0x1;_0x323be7[_0x4cea('0xb7')]=ut['totalGlobal'](_0x323be7);ut[_0x4cea('0x8f')](_0x323be7,0x13,_0x5aaae2[_0x4cea('0xea')]||_0x5aaae2[_0x4cea('0xeb')]);ami[_0x4cea('0x28')](_0x4cea('0xec'),ut[_0x4cea('0x9f')](_0x323be7,_0x4cea('0xee')));rpcDb[_0x4cea('0x94')](_0x323be7,_0x4cea('0xef'));if(ut['totalGlobal'](_0x323be7)>=_0x50db4f['dialGlobalMaxRetry']){_0x2e2eff=ut[_0x4cea('0xa3')](_0x323be7,0xf,'Global');rpcDb[_0x4cea('0x97')](_0x2e2eff,_0x4cea('0xef'));}else{rpcDb['createCustomerFinal'](_0x323be7,'[callProgressDetectingCustomer][machine]');}delete this[_0x4cea('0x70')][_0x5aaae2[_0x4cea('0xc0')]];break;default:if(_0x323be7[_0x4cea('0x76')]){ut[_0x4cea('0x7e')](_0x50db4f,_0x4cea('0xf0'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x50db4f['name'],_0x5aaae2);}_0x50db4f['outboundUnknownCallsDay']+=0x1;_0x323be7['countglobal']=ut['totalGlobal'](_0x323be7);ut[_0x4cea('0x8f')](_0x323be7,0xc,_0x5aaae2[_0x4cea('0xea')]||_0x5aaae2[_0x4cea('0xeb')]);rpcDb[_0x4cea('0x94')](_0x323be7,_0x4cea('0xf1'));if(ut[_0x4cea('0x9e')](_0x323be7)>=_0x50db4f[_0x4cea('0xa2')]){_0x2e2eff=ut['cloneAction'](_0x323be7,0xf,_0x4cea('0xa4'));rpcDb[_0x4cea('0x97')](_0x2e2eff,_0x4cea('0xf2'));}else{rpcDb['createCustomerFinal'](_0x323be7,_0x4cea('0xf2'));}delete this[_0x4cea('0x70')][_0x5aaae2[_0x4cea('0xc0')]];}if(!(_0x323be7['dialAnswer']&&_0x4efdaf==='16')){ut['updateOriginated'](_0x50db4f,'[callProgressDetectingCustomer]');logger[_0x4cea('0x5d')](_0x4cea('0xf3'),_0x323be7[_0x4cea('0xbf')],'\x20Queue',_0x50db4f[_0x4cea('0x2b')],_0x4cea('0x73'),_0x50db4f['originated']);}if(_0x4efdaf!=='ANSWER'){delete this[_0x4cea('0x70')][_0x5aaae2['linkedid']];delete this[_0x4cea('0x70')][_0x5aaae2[_0x4cea('0xf4')]];}}};Preview['prototype'][_0x4cea('0xf5')]=function(_0x55d7d0,_0x4bcc99,_0x53753a){if(_[_0x4cea('0xf6')](_0x4bcc99)&&_0x4cea('0xf7')!==typeof _0x4bcc99){return;}if(_[_0x4cea('0xf6')](_0x53753a)&&_0x4cea('0xf7')!==typeof _0x53753a){return;}switch(_0x53753a['reason']){case'0':ut[_0x4cea('0xf8')](_0x55d7d0,0x0,_0x4cea('0xf9'));rpcDb[_0x4cea('0xfa')](_0x55d7d0,_0x4cea('0xfb'));break;case'3':ut[_0x4cea('0xf8')](_0x55d7d0,0x3,'NoAnswer');rpcDb[_0x4cea('0xfa')](_0x55d7d0,_0x4cea('0xfc'));break;case'5':ut['logAgent'](_0x55d7d0,0x5,'Busy');rpcDb[_0x4cea('0xfa')](_0x55d7d0,_0x4cea('0xfd'));break;case'8':ut['logAgent'](_0x55d7d0,0x8,'Congestion');rpcDb[_0x4cea('0xfa')](_0x55d7d0,_0x4cea('0xfe'));break;case'22':ut[_0x4cea('0xf8')](_0x55d7d0,0x16,'AnswerAGI');rpcDb[_0x4cea('0xfa')](_0x55d7d0,_0x4cea('0xff'));break;default:ut[_0x4cea('0xf8')](_0x55d7d0,0xc,_0x53753a[_0x4cea('0x100')]);rpcDb['createAgentHistory'](_0x55d7d0,_0x4cea('0xfe'));}ut['updateOriginated'](_0x4bcc99,_0x4cea('0x101'));logger[_0x4cea('0x5d')](_0x4cea('0x102'),_0x55d7d0[_0x4cea('0xbf')],'\x20Queue',_0x4bcc99[_0x4cea('0x2b')],_0x4cea('0x73'),_0x4bcc99[_0x4cea('0x51')]);delete this[_0x4cea('0x70')][_0x55d7d0[_0x4cea('0xbf')]];};Preview[_0x4cea('0x10')][_0x4cea('0x103')]=function(_0x5ea9b9,_0x55e6f1,_0x43eec8,_0xf6209f,_0x117602){var _0x5a77be=this;return new BPromise(function(_0x464338,_0x28e9a2){if(_[_0x4cea('0x6f')](_0x55e6f1)||_[_0x4cea('0x6f')](_0x55e6f1[_0x4cea('0x104')])||_[_0x4cea('0x6f')](_0x55e6f1[_0x4cea('0x104')][_0x4cea('0x105')])||_[_0x4cea('0x6f')](_0x55e6f1['VoiceQueueId'])){_0x28e9a2(ut[_0x4cea('0x50')](_0x4cea('0x106'),_0xf6209f,_0x117602));return;}var _0x21d124=uuid['v4']();var _0xc0d817=_0x5a77be[_0x4cea('0x15')][_0x55e6f1[_0x4cea('0x72')][_0x4cea('0x2b')]];var _0x1baba5=_0x43eec8?_0x5a77be[_0x4cea('0x18')][_0x43eec8]['id']:undefined;_0x5a77be[_0x4cea('0x70')][_0x21d124]=new Action(_0x55e6f1,_0xc0d817,_0x21d124,_0x43eec8,_0x1baba5);var _0x4fe169=_0x5a77be[_0x4cea('0x70')][_0x21d124];_0x4fe169[_0x4cea('0xa9')]=_0xf6209f;_0x4fe169[_0x4cea('0xc7')]=_0x117602;_0x4fe169['lookAgent']=_0x43eec8;if(_['isEmpty'](_0x5ea9b9)){_0x5a77be[_0x4cea('0x107')](_0x4fe169,_0xc0d817,_0x55e6f1,_0x43eec8)[_0x4cea('0x86')](function(_0x20727d){logger[_0x4cea('0x5d')](_0x4cea('0x108'),'Queue:\x20'+_0x4fe169[_0x4cea('0x74')]+_0x4cea('0x109')+_0x4fe169['idContact'],JSON[_0x4cea('0x59')](_0x20727d));ami['emit'](_0x4cea('0x10a'),ut[_0x4cea('0x9f')](_0x4fe169,'called',_0x5a77be[_0x4cea('0x15')][_0x4fe169['queue']]));_0x464338(ut[_0x4cea('0x50')](_0x4cea('0x10b')));})[_0x4cea('0x8c')](function(_0x41711c){ut['logger'](_0x4cea('0x10c'),_0x41711c);_0x28e9a2(ut[_0x4cea('0x50')]('Call\x20failed',_0xf6209f,_0x117602));});}else{_0xc0d817[_0x4cea('0x3e')]+=0x1;ut['logBlacklist'](_0x4fe169);rpcDb[_0x4cea('0x10d')](_0x4fe169,_0x4cea('0x10e'));delete _0x5a77be['actions'][_0x21d124];_0x28e9a2(ut['message'](_0x4cea('0x10f'),_0xf6209f,_0x117602));}});};Preview[_0x4cea('0x10')][_0x4cea('0x9c')]=function(_0xb54532){return!_[_0x4cea('0x6f')](_0xb54532)&&!_[_0x4cea('0x6f')](_0xb54532[_0x4cea('0x2b')])&&!_[_0x4cea('0x6f')](_0xb54532['active'])&&_0xb54532[_0x4cea('0x57')]&&!_['isNil'](this['trunks'][util['format'](_0x4cea('0x110'),_0xb54532[_0x4cea('0x2b')])])&&!_['isNil'](this[_0x4cea('0x17')][util['format'](_0x4cea('0x110'),_0xb54532[_0x4cea('0x2b')])][_0x4cea('0x111')])&&(this['trunks'][util['format']('SIP/%s',_0xb54532[_0x4cea('0x2b')])][_0x4cea('0x111')]==='reachable'||this[_0x4cea('0x17')][util['format']('SIP/%s',_0xb54532[_0x4cea('0x2b')])]['status']==='unmonitored');};Preview[_0x4cea('0x10')][_0x4cea('0x112')]=function(_0x3ec37a,_0x9f6c4){var _0x44cb2b=this;return new BPromise(function(_0x3461c1,_0x41d4b6){_0x44cb2b['execRun'](_0x3ec37a,_0x9f6c4)[_0x4cea('0x86')](function(_0x43462c){_0x3461c1(_['pick'](_0x43462c,[_0x4cea('0x50')]));})[_0x4cea('0x8c')](function(_0x4ba714){if(_0x4ba714[_0x4cea('0x113')]){rpcDb[_0x4cea('0x114')](_0x3ec37a);}if(_0x4ba714[_0x4cea('0x57')]){rpcDb[_0x4cea('0x8e')](_0x3ec37a);}_0x41d4b6(_['pick'](_0x4ba714,[_0x4cea('0x50')]));});});};Preview[_0x4cea('0x10')][_0x4cea('0x115')]=function(_0x7ab2f7,_0x5d9fd5){var _0x1ff34c=this;return new BPromise(function(_0x9ad37f,_0x4e6831){var _0x4049c0,_0x194212;rpcDb[_0x4cea('0x116')](_0x7ab2f7)[_0x4cea('0x86')](function(_0x2776d4){if(!_[_0x4cea('0x6f')](_0x2776d4[0x0])){_0x194212=_0x2776d4[0x0][_0x4cea('0x117')]?![]:!![];_0x4049c0=_0x2776d4[0x0][_0x4cea('0x117')]?!![]:![];_0x4049c0=_0x5d9fd5?!![]:_0x4049c0;}var _0x1d34e4=_0x1ff34c[_0x4cea('0x118')](_0x2776d4);if(_0x1d34e4[_0x4cea('0x119')]){rpcDb[_0x4cea('0x11a')](_[_0x4cea('0x77')](_0x2776d4[0x0],[_0x4cea('0x79'),_0x4cea('0x11b')]))['then'](function(_0x104297){_0x1ff34c[_0x4cea('0x103')](_0x104297,_0x2776d4[0x0],_0x5d9fd5,_0x194212,_0x4049c0)[_0x4cea('0x86')](function(_0x2368f0){_0x9ad37f(_0x2368f0);})[_0x4cea('0x8c')](function(_0x5419eb){_0x4e6831(_0x5419eb);});})[_0x4cea('0x8c')](function(_0x27bf11){ut[_0x4cea('0x62')](_0x4cea('0x11c'),_0x27bf11);_0x4e6831(ut['message'](_0x4cea('0x11d'),_0x194212,_0x4049c0));});}else{_0x4e6831(ut['message'](_0x1d34e4[_0x4cea('0x50')],_0x194212,_0x4049c0));}})[_0x4cea('0x8c')](function(_0x283120){ut[_0x4cea('0x62')](_0x4cea('0x11e'),_0x283120);_0x4e6831(ut[_0x4cea('0x50')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x4cea('0x10')][_0x4cea('0x118')]=function(_0x3f3f65){if(_[_0x4cea('0x6f')](_0x3f3f65)||_[_0x4cea('0x11f')](_0x3f3f65)||!_[_0x4cea('0x6f')](_0x3f3f65[0x0][_0x4cea('0x8a')])&&_[_0x4cea('0x6f')](_0x3f3f65[0x0]['Agent'][_0x4cea('0x2b')])){ut[_0x4cea('0x62')]('[Preview][validateContact][Empty\x20Contact]',_0x3f3f65);return{'isValid':![],'message':_0x4cea('0x120')};}var _0x422691=this['campaignsPreview'][_0x3f3f65[0x0]['Queue']['name']];_0x422691['message']=_0x4cea('0x9d');if(_['isNil'](_0x422691)){ut[_0x4cea('0x62')](_0x4cea('0x121'),_0x422691);return{'isValid':![],'message':_0x4cea('0x122')};}if(!this['isTrunkReachable'](_0x422691[_0x4cea('0x56')])){ut[_0x4cea('0x62')](_0x4cea('0x123'),_0x4cea('0x124')+_0x422691[_0x4cea('0x2b')]+_0x4cea('0x125'));if(!this[_0x4cea('0x9c')](_0x422691[_0x4cea('0x126')])){ut[_0x4cea('0x62')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x422691['name']+_0x4cea('0x127'));return{'isValid':![],'message':_0x4cea('0x128')};}}if(!ut[_0x4cea('0x9b')](_0x422691['dialActive'])){ut[_0x4cea('0x62')]('[Preview][validateContact][Campaign\x20Active]',_0x422691['name']+_0x4cea('0x129'));return{'isValid':![],'message':_0x4cea('0x124')+_0x422691['name']+_0x4cea('0x129')};}return{'isValid':!![],'message':_0x4cea('0x12a')};};Preview[_0x4cea('0x10')]['execCall']=function(_0x2bee08,_0x3b891c,_0x476cce,_0x5b4eda){var _0x682d3d=this;return new BPromise(function(_0x34ba2c,_0x1faec2){var _0x2f537e=_0x2bee08['uniqueid'];var _0x779583=_0x682d3d['isTrunkReachable'](_0x3b891c[_0x4cea('0x56')])?util['format'](_0x4cea('0x12b'),_0x3b891c['Trunk'][_0x4cea('0x2b')],_[_0x4cea('0x6f')](_0x3b891c[_0x4cea('0x3c')])?'':_0x3b891c[_0x4cea('0x3c')]['trim']()||'',_0x3b891c[_0x4cea('0x12c')]>0x0?_0x476cce[_0x4cea('0x104')][_0x4cea('0x105')][_0x4cea('0x12d')](_0x3b891c[_0x4cea('0x12c')]):_0x476cce['Contact'][_0x4cea('0x105')]):util[_0x4cea('0x5a')](_0x4cea('0x12b'),_[_0x4cea('0x6f')](_0x3b891c['TrunkBackup'])?_0x3b891c[_0x4cea('0x56')][_0x4cea('0x2b')]:_0x3b891c['TrunkBackup'][_0x4cea('0x2b')],_[_0x4cea('0x6f')](_0x3b891c[_0x4cea('0x3c')])?'':_0x3b891c['dialPrefix'][_0x4cea('0x12e')]()||'',_0x3b891c[_0x4cea('0x12c')]>0x0?_0x476cce[_0x4cea('0x104')][_0x4cea('0x105')]['substring'](_0x3b891c[_0x4cea('0x12c')]):_0x476cce[_0x4cea('0x104')][_0x4cea('0x105')]);var _0x18adc9=_0x682d3d[_0x4cea('0x9c')](_0x3b891c[_0x4cea('0x56')])?ut[_0x4cea('0x12f')](_0x3b891c[_0x4cea('0x56')][_0x4cea('0x130')],_0x3b891c['dialOriginateCallerIdName'],_0x3b891c[_0x4cea('0x131')]>0x0?ut[_0x4cea('0x132')](_0x3b891c[_0x4cea('0x3a')],_0x3b891c[_0x4cea('0x131')]):_0x3b891c[_0x4cea('0x3a')]):ut[_0x4cea('0x12f')](_[_0x4cea('0x6f')](_0x3b891c[_0x4cea('0x126')])?_0x3b891c[_0x4cea('0x56')][_0x4cea('0x130')]:_0x3b891c['TrunkBackup'][_0x4cea('0x130')],_0x3b891c[_0x4cea('0x39')],_0x3b891c[_0x4cea('0x131')]>0x0?ut[_0x4cea('0x132')](_0x3b891c[_0x4cea('0x3a')],_0x3b891c[_0x4cea('0x131')]):_0x3b891c[_0x4cea('0x3a')]);if(_0x18adc9){_0x2bee08[_0x4cea('0x133')]=ut[_0x4cea('0x134')](_0x18adc9);_0x2bee08[_0x4cea('0x135')]=ut[_0x4cea('0x136')](_0x18adc9);}var _0x3dc49d=ut[_0x4cea('0x137')](_0x3b891c,_0x476cce,_0x779583,_0x18adc9,_0x2f537e,_0x2bee08);_[_0x4cea('0x138')](_0x2bee08,ut[_0x4cea('0x139')](_0x3dc49d));_0x2bee08[_0x4cea('0x13a')]=moment()['format'](_0x4cea('0xaa'));ami['Action'](ut[_0x4cea('0x13b')](_0x2bee08,_0x3b891c,_0x3dc49d,_0x2bee08[_0x4cea('0xc7')],_0x5b4eda))[_0x4cea('0x86')](function(_0x4e1309){var _0x3851f9=_0x2bee08[_0x4cea('0x13c')];if(!_[_0x4cea('0x6f')](_0x3851f9)){if(!_[_0x4cea('0x6f')](_0x682d3d[_0x4cea('0x18')][_0x3851f9])){_0x682d3d[_0x4cea('0x18')][_0x3851f9][_0x4cea('0x13d')]=_0x2bee08['calleridnum'];emit(util[_0x4cea('0x5a')](_0x4cea('0x13e'),_0x682d3d[_0x4cea('0x18')][_0x3851f9][_0x4cea('0x2b')]),'user:agentconnect',{'destaccountcode':_0x682d3d[_0x4cea('0x18')][_0x3851f9][_0x4cea('0x13f')],'destconnectedlinenum':_0x2bee08['calleridnum']});}}_0x3b891c[_0x4cea('0x51')]+=0x1;logger[_0x4cea('0x5d')]('[originated][increment]',_0x2f537e,_0x4cea('0x140'),_0x3b891c['name'],_0x4cea('0x73'),_0x3b891c[_0x4cea('0x51')]);_0x34ba2c(_0x4e1309);})['catch'](function(_0x448092){ut[_0x4cea('0xf8')](_0x2bee08,0xe,'OriginateError');rpcDb[_0x4cea('0xfa')](_0x2bee08,'[originateFailure][logOriginateFailure]');_0x1faec2(_0x448092);});});};Preview[_0x4cea('0x10')][_0x4cea('0x21')]=function(_0x14574d){if(this[_0x4cea('0x70')][_0x14574d[_0x4cea('0xc0')]]){this[_0x4cea('0x70')][_0x14574d[_0x4cea('0xc0')]][_0x4cea('0x7a')]=_0x14574d['channel'];}};Preview[_0x4cea('0x10')]['syncOriginateResponse']=function(_0x50a32e){var _0x49e654=this;var _0x2b7c25=this['actions'][_0x50a32e['actionid']];if(_0x2b7c25){if(_0x2b7c25[_0x4cea('0x141')]&&this[_0x4cea('0x18')][_0x2b7c25[_0x4cea('0x141')]]){ut[_0x4cea('0x142')](_0x2b7c25,this[_0x4cea('0x18')][_0x2b7c25[_0x4cea('0x141')]]['name'],this[_0x4cea('0x18')][_0x2b7c25['lookAgent']]['id']);}var _0x17719d=_[_0x4cea('0x143')](_0x2b7c25);_0x17719d[_0x4cea('0xab')]=moment()['format'](_0x4cea('0xaa'));var _0x14fcb9=_0x49e654['campaignsPreview'][_0x2b7c25[_0x4cea('0x74')]];if(ut[_0x4cea('0x144')](_0x50a32e['response'])){if(_0x2b7c25[_0x4cea('0xa9')]){rpcDb['unlockContact'](_0x2b7c25[_0x4cea('0x145')]);}if(_0x2b7c25[_0x4cea('0xc7')]){rpcDb['disableContact'](_0x2b7c25[_0x4cea('0x145')]);}ami[_0x4cea('0x28')](_0x4cea('0x146'),ut[_0x4cea('0x9f')](_0x2b7c25,_0x4cea('0x147'),this[_0x4cea('0x15')][_0x2b7c25[_0x4cea('0x74')]]));this[_0x4cea('0xf5')](_0x17719d,_0x14fcb9,_0x50a32e);}else{_0x2b7c25[_0x4cea('0x13a')]=moment()[_0x4cea('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x17719d,0x4,_0x4cea('0xb8'));rpcDb[_0x4cea('0xfa')](_0x17719d,_0x4cea('0x148'));}}};Preview[_0x4cea('0x10')]['syncHangup']=function(_0x407070){var _0x5b136c=this;var _0x2326f6=this[_0x4cea('0x70')][_0x407070['linkedid']];var _0x25b0c9;if(_0x2326f6){_0x25b0c9=this['campaignsPreview'][_0x2326f6[_0x4cea('0x74')]];logger['info'](_0x4cea('0x149'),_0x407070[_0x4cea('0xc0')],_0x4cea('0x140'),_0x25b0c9['name'],_0x4cea('0x75'),_0x25b0c9[_0x4cea('0x30')]);}if(this[_0x4cea('0x70')][_0x407070[_0x4cea('0xc0')]]&&_0x407070[_0x4cea('0xc0')]!==_0x407070[_0x4cea('0xbf')]){if(_0x407070[_0x4cea('0x14a')]==='16'&&this['actions'][_0x407070[_0x4cea('0xc0')]][_0x4cea('0x76')]){this[_0x4cea('0x14b')](_0x407070,_0x407070[_0x4cea('0xc0')],_0x407070[_0x4cea('0x14a')]);}else if(this['actions'][_0x407070[_0x4cea('0xc0')]]['dialAnswer']){logger[_0x4cea('0x5d')](_0x4cea('0x14c'),_0x407070[_0x4cea('0xc0')],_0x407070[_0x4cea('0x14a')],_0x4cea('0x140'),_0x25b0c9['name'],'pTalking:\x20',_0x25b0c9[_0x4cea('0x30')]);this[_0x4cea('0x14b')](_0x407070,_0x407070[_0x4cea('0xc0')],_0x407070[_0x4cea('0x14a')]);}}else if(_0x2326f6&&_[_0x4cea('0x6f')](_0x2326f6['statedesc'])&&_0x25b0c9['dialQueueProject']&&_0x407070[_0x4cea('0xc0')]===_0x407070[_0x4cea('0xbf')]&&_[_0x4cea('0x6f')](_0x407070[_0x4cea('0x100')])&&_0x407070['cause']==='16'&&_0x407070['channelstate']==='6'&&_[_0x4cea('0xf6')](_0x2326f6[_0x4cea('0x14d')])){if(_0x2326f6[_0x4cea('0xa9')]){rpcDb[_0x4cea('0x114')](_0x2326f6['idContact']);}if(_0x2326f6[_0x4cea('0xc7')]){rpcDb[_0x4cea('0x8e')](_0x2326f6[_0x4cea('0x145')]);}_0x407070[_0x4cea('0x100')]='22';this[_0x4cea('0xf5')](_0x2326f6,_0x25b0c9,_0x407070);}else if(_0x2326f6&&_0x2326f6[_0x4cea('0x14d')]){if(_0x407070[_0x4cea('0x14a')]==='16'&&this[_0x4cea('0x70')][_0x407070['linkedid']]['dialAnswer']){logger[_0x4cea('0x5d')](_0x4cea('0x14e'),_0x407070['linkedid'],_0x407070[_0x4cea('0x14a')],_0x4cea('0x140'),_0x25b0c9[_0x4cea('0x2b')],_0x4cea('0x75'),_0x25b0c9[_0x4cea('0x30')]);this[_0x4cea('0x14b')](_0x407070,_0x407070[_0x4cea('0xc0')],_0x407070[_0x4cea('0x14a')]);}else if(this[_0x4cea('0x70')][_0x407070[_0x4cea('0xc0')]][_0x4cea('0x76')]){logger['info'](_0x4cea('0x14c'),_0x407070[_0x4cea('0xc0')],_0x407070['cause'],_0x4cea('0x140'),_0x25b0c9[_0x4cea('0x2b')],'pTalking:\x20',_0x25b0c9[_0x4cea('0x30')]);this[_0x4cea('0x14b')](_0x407070,_0x407070['linkedid'],_0x407070['cause']);}}};Preview['prototype'][_0x4cea('0x14f')]=function(_0xa4f7ed){if(this[_0x4cea('0x70')][_0xa4f7ed[_0x4cea('0xf4')]]&&_0xa4f7ed[_0x4cea('0xf4')]!==_0xa4f7ed[_0x4cea('0x150')]){this[_0x4cea('0x14b')](_0xa4f7ed,_0xa4f7ed['destlinkedid'],_0xa4f7ed[_0x4cea('0xeb')]);}};Preview[_0x4cea('0x10')][_0x4cea('0x151')]=function(_0x4ebdac){if(this[_0x4cea('0x70')][_0x4ebdac['linkedid']]&&_0x4ebdac[_0x4cea('0xc0')]!==_0x4ebdac[_0x4cea('0xbf')]&&!this[_0x4cea('0x70')][_0x4ebdac[_0x4cea('0xc0')]][_0x4cea('0x76')]){if(_0x4ebdac[_0x4cea('0x14a')]==='1'){this[_0x4cea('0x14b')](_0x4ebdac,_0x4ebdac[_0x4cea('0xc0')],_0x4ebdac[_0x4cea('0x14a')]);}}};Preview[_0x4cea('0x10')][_0x4cea('0x152')]=function(_0x2a991f,_0x302705,_0x49c92d){if(this['actions'][_0x2a991f]){if(_['isNil'](this['actions'][_0x2a991f][_0x4cea('0x153')])){this['actions'][_0x2a991f][_0x4cea('0x153')]={};}this[_0x4cea('0x70')][_0x2a991f][_0x4cea('0x153')][_0x302705]=_0x49c92d;}};Preview[_0x4cea('0x10')][_0x4cea('0x23')]=function(_0xb1c19c){try{if(!_[_0x4cea('0x6f')](_0xb1c19c)){if(ut[_0x4cea('0x154')](_[_0x4cea('0x155')](_0xb1c19c[_0x4cea('0x156')])[0x0])){this[_0x4cea('0x152')](_0xb1c19c['uniqueid'],_[_0x4cea('0x155')](_0xb1c19c['variable'])[0x0],_0xb1c19c[_0x4cea('0x157')]);}}}catch(_0x4172b3){logger[_0x4cea('0x158')](_0x4cea('0x159'),util[_0x4cea('0x15a')](_0x4172b3,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x4cea('0x25')]=function(_0x4def8f){if(_0x4def8f){if(this[_0x4cea('0x70')][_0x4def8f[_0x4cea('0x15b')]]){this['actions'][_0x4def8f['transfertargetlinkedid']][_0x4cea('0x14d')]=!![];}}};Preview['prototype'][_0x4cea('0x27')]=function(_0x4daa95){if(_0x4daa95){if(this[_0x4cea('0x70')][_0x4daa95[_0x4cea('0x15c')]]){this['actions'][_0x4daa95[_0x4cea('0x15c')]][_0x4cea('0x14d')]=!![];}}};module[_0x4cea('0x15d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index cf5359a..9a423c6 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 _0x070d=['rescheduleContact','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[GetContactRecallMe]\x20','rescheduleContactInQueue'];(function(_0x4aac3d,_0x5e258e){var _0x2cfa30=function(_0x489e23){while(--_0x489e23){_0x4aac3d['push'](_0x4aac3d['shift']());}};_0x2cfa30(++_0x5e258e);}(_0x070d,0x6c));var _0xd070=function(_0x2fe3b9,_0x5de54e){_0x2fe3b9=_0x2fe3b9-0x0;var _0xec07e3=_0x070d[_0x2fe3b9];return _0xec07e3;};'use strict';var util=require(_0xd070('0x0'));var BPromise=require(_0xd070('0x1'));var logger=require(_0xd070('0x2'))('preview');var _=require(_0xd070('0x3'));var cmHopper=require(_0xd070('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xd070('0x5'));var voiceQueueRt=require(_0xd070('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xd070('0x7'));function loggerCatch(_0x58ae9a){return function(_0x1d769f){logger[_0xd070('0x8')](_0x58ae9a,util[_0xd070('0x9')](_0x1d769f,{'showHidden':![],'depth':null}));};}function create(_0x2a9d48){return BPromise[_0xd070('0xa')]()['then'](cmHopperHistory[_0xd070('0xb')](_0x2a9d48))[_0xd070('0xc')](loggerCatch(_0xd070('0xd')));}function createAgent(_0x1c88bc){return BPromise[_0xd070('0xa')]()[_0xd070('0xe')](agentReportPreview[_0xd070('0xb')](_0x1c88bc))[_0xd070('0xc')](loggerCatch(_0xd070('0xd')));}function moveContact(_0x4e0c32){return BPromise[_0xd070('0xa')]()[_0xd070('0xe')](cmHopper[_0xd070('0xf')](_0x4e0c32,!![]))[_0xd070('0xc')](loggerCatch(_0xd070('0x10')));}exports[_0xd070('0x11')]=function(_0x5c4395){return BPromise[_0xd070('0xa')]()[_0xd070('0xe')](cmHopperBlack[_0xd070('0x11')](_0x5c4395))['catch'](loggerCatch(_0xd070('0x12')));};exports['getContactPreview']=function(_0xc1f20b){return BPromise[_0xd070('0xa')]()[_0xd070('0xe')](cmHopper[_0xd070('0x13')](_0xc1f20b))[_0xd070('0xc')](loggerCatch(_0xd070('0x14')));};exports[_0xd070('0xb')]=function(_0x25201d,_0x2ae3ba){create(_0x25201d)['catch'](loggerCatch(_0x2ae3ba));moveContact(_0x25201d)[_0xd070('0xc')](loggerCatch(_0x2ae3ba));};exports[_0xd070('0x15')]=function(_0x59c428,_0x2710a0){createAgent(_0x59c428)[_0xd070('0xc')](loggerCatch(_0x2710a0));};exports[_0xd070('0x16')]=function(_0x55b92f,_0x689a5c){create(_0x55b92f)[_0xd070('0xc')](loggerCatch(_0x689a5c));};exports[_0xd070('0x17')]=function(_0x23fb0c,_0x370372){moveContact(_0x23fb0c)['catch'](loggerCatch(_0x370372));};exports['rescheduleContact']=function(_0x5b90e2,_0x47a91c,_0xbbbdd6){if(_0x47a91c){_0x5b90e2[_0xd070('0x18')]=null;}if(_0xbbbdd6){_0x5b90e2['active']=![];}return BPromise[_0xd070('0xa')]()[_0xd070('0xe')](cmHopper['rescheduleContact'](_0x5b90e2))[_0xd070('0xc')](loggerCatch(_0xd070('0x19')));};exports[_0xd070('0x1a')]=function(_0x4d4eb7){return BPromise[_0xd070('0xa')]()[_0xd070('0xe')](cmHopper[_0xd070('0x1a')](_0x4d4eb7))[_0xd070('0xc')](loggerCatch(_0xd070('0x1b')));};exports['unlockContact']=function(_0xcb85d3){return BPromise[_0xd070('0xa')]()[_0xd070('0xe')](cmHopper[_0xd070('0x1c')]({'UserId':null},_0xcb85d3,0x1))[_0xd070('0xc')](loggerCatch(_0xd070('0x1d')));};exports[_0xd070('0x1e')]=function(_0x48f017){return BPromise[_0xd070('0xa')]()[_0xd070('0xe')](cmHopper[_0xd070('0x1c')]({'active':![]},_0x48f017,0x1))[_0xd070('0xc')](loggerCatch(_0xd070('0x1f')));};exports['crateCustomerReportQueue']=function(_0x25e305){var _0x3952bd={};_0x3952bd['type']=_0x25e305[_0xd070('0x20')];_0x3952bd[_0xd070('0x21')]=_0x25e305[_0xd070('0x21')];_0x3952bd[_0xd070('0x22')]=_0x25e305[_0xd070('0x22')];_0x3952bd[_0xd070('0x23')]=_0x25e305[_0xd070('0x23')];_0x3952bd[_0xd070('0x24')]=_0x25e305[_0xd070('0x24')];_0x3952bd['queuecallerjoinAt']=_0x25e305[_0xd070('0x25')];_0x3952bd['queuecallerleaveAt']=_0x25e305['answertime'];_0x3952bd[_0xd070('0x26')]=0x1;_0x3952bd['queuecallercompleteAt']=_0x25e305[_0xd070('0x27')];_0x3952bd[_0xd070('0x28')]=_0x25e305['membername'];_0x3952bd[_0xd070('0x29')]=_0xd070('0x2a');_0x3952bd[_0xd070('0x2b')]=_0xd070('0x2c');_0x3952bd['holdtime']=0x0;_0x3952bd['assigned']=0x1;_0x3952bd[_0xd070('0x2d')]=_0x25e305['membername'];_0x3952bd[_0xd070('0x2e')]=_0xd070('0x2f');return BPromise[_0xd070('0xa')]()[_0xd070('0xe')](voiceQueueReport[_0xd070('0x30')](_0x3952bd))[_0xd070('0xc')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x3d8c77,_0x2d61b3){return BPromise['resolve']()[_0xd070('0xe')](cmHopper['getContactRecallMe'](_0x3d8c77,_0x2d61b3))[_0xd070('0xc')](loggerCatch(_0xd070('0x31')));};exports[_0xd070('0x32')]=function(_0x53a871){return BPromise['resolve']()[_0xd070('0xe')](cmHopper[_0xd070('0x33')](_0x53a871,!![],!![]))[_0xd070('0xc')](loggerCatch(_0xd070('0x34')));}; \ No newline at end of file +var _0x4ed3=['[createHistory]\x20','then','moveContactManagedDialer','catch','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','createHistory'];(function(_0x2effa0,_0x5a0b87){var _0x4938ee=function(_0x8a43ce){while(--_0x8a43ce){_0x2effa0['push'](_0x2effa0['shift']());}};_0x4938ee(++_0x5a0b87);}(_0x4ed3,0x148));var _0x34ed=function(_0x56a37a,_0xffb054){_0x56a37a=_0x56a37a-0x0;var _0x3a57ff=_0x4ed3[_0x56a37a];return _0x3a57ff;};'use strict';var util=require(_0x34ed('0x0'));var BPromise=require(_0x34ed('0x1'));var logger=require(_0x34ed('0x2'))(_0x34ed('0x3'));var _=require(_0x34ed('0x4'));var cmHopper=require(_0x34ed('0x5'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x34ed('0x6'));var cmHopperBlack=require(_0x34ed('0x7'));var voiceQueueRt=require(_0x34ed('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x34ed('0x9'));function loggerCatch(_0x96902d){return function(_0x16cefa){logger[_0x34ed('0xa')](_0x96902d,util[_0x34ed('0xb')](_0x16cefa,{'showHidden':![],'depth':null}));};}function create(_0x2c567e){return BPromise[_0x34ed('0xc')]()['then'](cmHopperHistory[_0x34ed('0xd')](_0x2c567e))['catch'](loggerCatch(_0x34ed('0xe')));}function createAgent(_0x256863){return BPromise[_0x34ed('0xc')]()[_0x34ed('0xf')](agentReportPreview['createHistory'](_0x256863))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x12101b){return BPromise[_0x34ed('0xc')]()['then'](cmHopper[_0x34ed('0x10')](_0x12101b,!![]))[_0x34ed('0x11')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x34ed('0x12')]=function(_0x5e596d){return BPromise[_0x34ed('0xc')]()['then'](cmHopperBlack[_0x34ed('0x12')](_0x5e596d))[_0x34ed('0x11')](loggerCatch(_0x34ed('0x13')));};exports[_0x34ed('0x14')]=function(_0x10b6af){return BPromise['resolve']()[_0x34ed('0xf')](cmHopper[_0x34ed('0x14')](_0x10b6af))[_0x34ed('0x11')](loggerCatch(_0x34ed('0x15')));};exports[_0x34ed('0xd')]=function(_0x35265f,_0x5ad281){create(_0x35265f)[_0x34ed('0x11')](loggerCatch(_0x5ad281));moveContact(_0x35265f)[_0x34ed('0x11')](loggerCatch(_0x5ad281));};exports[_0x34ed('0x16')]=function(_0x6b079d,_0x306f14){createAgent(_0x6b079d)[_0x34ed('0x11')](loggerCatch(_0x306f14));};exports[_0x34ed('0x17')]=function(_0x238e14,_0x495d05){create(_0x238e14)[_0x34ed('0x11')](loggerCatch(_0x495d05));};exports[_0x34ed('0x18')]=function(_0x314323,_0x3288e6){moveContact(_0x314323)[_0x34ed('0x11')](loggerCatch(_0x3288e6));};exports['rescheduleContact']=function(_0x4f52ba,_0x1b23c1,_0x473884){if(_0x1b23c1){_0x4f52ba[_0x34ed('0x19')]=null;}if(_0x473884){_0x4f52ba[_0x34ed('0x1a')]=![];}return BPromise[_0x34ed('0xc')]()[_0x34ed('0xf')](cmHopper[_0x34ed('0x1b')](_0x4f52ba))[_0x34ed('0x11')](loggerCatch(_0x34ed('0x1c')));};exports[_0x34ed('0x1d')]=function(_0xea15d9){return BPromise[_0x34ed('0xc')]()[_0x34ed('0xf')](cmHopper[_0x34ed('0x1d')](_0xea15d9))[_0x34ed('0x11')](loggerCatch(_0x34ed('0x1e')));};exports[_0x34ed('0x1f')]=function(_0x1b79c3){return BPromise[_0x34ed('0xc')]()['then'](cmHopper[_0x34ed('0x1f')]({'UserId':null},_0x1b79c3,0x1))['catch'](loggerCatch(_0x34ed('0x20')));};exports[_0x34ed('0x21')]=function(_0x985690){return BPromise[_0x34ed('0xc')]()[_0x34ed('0xf')](cmHopper[_0x34ed('0x1f')]({'active':![]},_0x985690,0x1))[_0x34ed('0x11')](loggerCatch(_0x34ed('0x22')));};exports[_0x34ed('0x23')]=function(_0x1fda9e){var _0x17d6a9={};_0x17d6a9[_0x34ed('0x24')]=_0x1fda9e[_0x34ed('0x24')];_0x17d6a9[_0x34ed('0x25')]=_0x1fda9e[_0x34ed('0x25')];_0x17d6a9[_0x34ed('0x26')]=_0x1fda9e[_0x34ed('0x26')];_0x17d6a9[_0x34ed('0x27')]=_0x1fda9e['calleridname'];_0x17d6a9[_0x34ed('0x28')]=_0x1fda9e[_0x34ed('0x28')];_0x17d6a9[_0x34ed('0x29')]=_0x1fda9e[_0x34ed('0x2a')];_0x17d6a9[_0x34ed('0x2b')]=_0x1fda9e[_0x34ed('0x2a')];_0x17d6a9[_0x34ed('0x2c')]=0x1;_0x17d6a9[_0x34ed('0x2d')]=_0x1fda9e['endtime'];_0x17d6a9[_0x34ed('0x2e')]=_0x1fda9e[_0x34ed('0x2f')];_0x17d6a9['context']=_0x34ed('0x30');_0x17d6a9[_0x34ed('0x31')]=_0x34ed('0x32');_0x17d6a9[_0x34ed('0x33')]=0x0;_0x17d6a9['assigned']=0x1;_0x17d6a9[_0x34ed('0x34')]=_0x1fda9e['membername'];_0x17d6a9[_0x34ed('0x35')]='COMPLETED';return BPromise[_0x34ed('0xc')]()[_0x34ed('0xf')](voiceQueueReport['create'](_0x17d6a9))[_0x34ed('0x11')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x34ed('0x36')]=function(_0x114b2b,_0x2d6c01){return BPromise[_0x34ed('0xc')]()[_0x34ed('0xf')](cmHopper[_0x34ed('0x36')](_0x114b2b,_0x2d6c01))[_0x34ed('0x11')](loggerCatch(_0x34ed('0x37')));};exports['rescheduleContactInQueue']=function(_0x441a7e){return BPromise['resolve']()['then'](cmHopper['rescheduleContact'](_0x441a7e,!![],!![]))[_0x34ed('0x11')](loggerCatch(_0x34ed('0x38')));}; \ 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 07f192c..c554d16 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 _0x204d=['xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','loggerError','info','message','getCallerId','isEmpty','isUndefined','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','endtime','logAgent','ringtime','responsetime','membername','UserId','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','motionChannel','voice','mandatoryDisposition','buildAcw','queue','not_inuse','push','getDiff','createBody','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-contactid','xmd-callerid'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x204d,0x1b9));var _0xd204=function(_0x39bfb6,_0x4272c8){_0x39bfb6=_0x39bfb6-0x0;var _0x23fef9=_0x204d[_0x39bfb6];return _0x23fef9;};'use strict';var util=require(_0xd204('0x0'));var _=require(_0xd204('0x1'));var moment=require(_0xd204('0x2'));var logger=require(_0xd204('0x3'))('preview');var ipAgi=process[_0xd204('0x4')][_0xd204('0x5')]||_0xd204('0x6');function getSeconds(_0xf6045c,_0x4e10ce){var _0x211e30=moment(_0xf6045c)[_0xd204('0x7')](0x0);var _0x420268=moment(_0x4e10ce)['milliseconds'](0x0);return _0x211e30[_0xd204('0x8')](_0x420268,_0xd204('0x9'));}exports[_0xd204('0xa')]=function(_0x49532a){return function(_0x340eaf){logger[_0xd204('0xb')](_0x49532a,util[_0xd204('0xc')](_0x340eaf,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x251fe2,_0x514c11){logger['info'](_0x251fe2,util[_0xd204('0xc')](_0x514c11,{'showHidden':![],'depth':null}));};exports[_0xd204('0xd')]=function(_0x2fbafb,_0x6b184e){logger[_0xd204('0xb')](_0x2fbafb,util[_0xd204('0xc')](_0x6b184e,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x191b36){return function(_0x438a84){logger[_0xd204('0xe')](_0x191b36,util['inspect'](_0x438a84,{'showHidden':![],'depth':null}));};};exports[_0xd204('0xf')]=function(_0x24dec3,_0x322750,_0x3e8d2d){return{'message':_0x24dec3,'unlock':_0x322750,'active':_0x3e8d2d};};exports[_0xd204('0x10')]=function(_0xe3051c,_0xe183ee,_0x4e1663){if(!_['isUndefined'](_0x4e1663)&&'string'===typeof _0x4e1663&&!_[_0xd204('0x11')](_0x4e1663)){if(!_[_0xd204('0x12')](_0xe183ee)&&_0xd204('0x13')===typeof _0xe183ee&&!_[_0xd204('0x11')](_0xe183ee)){return util['format'](_0xd204('0x14'),_0xe183ee,_0x4e1663);}return util[_0xd204('0x15')](_0xd204('0x14'),_0x4e1663,_0x4e1663);}if(!_[_0xd204('0x12')](_0xe3051c)&&_0xd204('0x13')===typeof _0xe3051c&&!_['isEmpty'](_0xe3051c)){return _0xe3051c;}return _0xd204('0x16');};exports[_0xd204('0x17')]=function(_0x532ab7){if(_['isNil'](_0x532ab7)){return![];}return _0x532ab7;};exports[_0xd204('0x18')]=function(_0x245cde,_0x3c3de8,_0x56967e,_0xd1d313,_0x498394,_0xef10e7){var _0x36769c={'XMD-QUEUE':_0x3c3de8[_0xd204('0x19')]?_0x3c3de8[_0xd204('0x19')][_0xd204('0x1a')]:'','XMD-CALLERID':_0xd1d313,'XMD-CALLERID-PREVIEW':_0xef10e7?util[_0xd204('0x15')](_0xd204('0x14'),_0xef10e7[_0xd204('0x1b')],_0xef10e7[_0xd204('0x1c')]):_0xd1d313,'XMD-DIALID':_0x498394,'XMD-CONTACTID':_0x3c3de8[_0xd204('0x1d')],'XMD-CDRTYPE':_0xd204('0x1e'),'CALLERID(all)':_0xd1d313,'XMD-VOICEQUEUEID':_0x3c3de8[_0xd204('0x1f')],'XMD-DIALCHANNEL':_0x56967e,'XMD-DIALTIMEOUT':_0x245cde[_0xd204('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0xd204('0x15')](_0xd204('0x21'),_0x245cde[_0xd204('0x22')]?'g':'',_[_0xd204('0x11')](_0x245cde[_0xd204('0x23')])?'':_0xd204('0x24')),'XMD-DIALURL':_0x245cde['dialPreviewUrl']||'','XMD-AGI':_0x245cde[_0xd204('0x25')]?util[_0xd204('0x15')](_0xd204('0x26'),ipAgi,_0x245cde['dialQueueProject']):_0xd204('0x27'),'XMD-AGIAFTER':_0x245cde[_0xd204('0x22')]?util[_0xd204('0x15')](_0xd204('0x26'),ipAgi,_0x245cde[_0xd204('0x22')]):_0xd204('0x27'),'XMD-ORIGINATECALLERIDNUM':_0xef10e7?_0xef10e7[_0xd204('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0xef10e7?_0xef10e7[_0xd204('0x29')]:'','XMD-DESTINATION':_0xd204('0x2a')};if(!_[_0xd204('0x11')](_0x245cde[_0xd204('0x23')])){_0x36769c[util['format']('%s',_0xd204('0x2b'))]=_0x245cde[_0xd204('0x23')];_0x36769c[util['format']('%s',_0xd204('0x2c'))]=_0x498394;}if(_0x3c3de8&&_0x3c3de8[_0xd204('0x2d')]){for(var _0x1e727a in _0x3c3de8[_0xd204('0x2d')]){if(_0x3c3de8[_0xd204('0x2d')][_0xd204('0x2e')](_0x1e727a)){if(!_[_0xd204('0x2f')](_0x3c3de8[_0xd204('0x2d')][_0x1e727a])&&_0x1e727a!=='id'&&_0x1e727a!==_0xd204('0x30')&&_0x1e727a!==_0xd204('0x31')&&_0x1e727a!=='updatedAt'){_0x36769c[util['format'](_0xd204('0x32'),_0xd204('0x33'),_[_0xd204('0x34')](_0x1e727a))]=_0x3c3de8[_0xd204('0x2d')][_0x1e727a];}}}}return _0x36769c;};exports[_0xd204('0x35')]=function(_0x4866ef){var _0x2cf4c0={};for(var _0x405659 in _0x4866ef){if(_0x4866ef['hasOwnProperty'](_0x405659)){_0x2cf4c0[util[_0xd204('0x15')]('%s',_['toLower'](_0x405659))]=_0x4866ef[_0x405659];}}return{'variables':_0x2cf4c0};};exports[_0xd204('0x36')]=function(_0x55b8ad,_0xbb9104){if(!_[_0xd204('0x2f')](_0x55b8ad)){if(_0x55b8ad[_0xd204('0x2e')](_0xd204('0x37'))){if(_0x55b8ad[_0xd204('0x37')]>0x0){_0x55b8ad[_0xd204('0x37')]-=0x1;}else{logger[_0xd204('0xb')](_0xd204('0x38'),_0xbb9104);}}}else{logger['error'](_0xd204('0x39'),_0xbb9104);}};exports['logBlacklist']=function(_0x4e77b5){var _0x5ab94e=moment()[_0xd204('0x15')](_0xd204('0x3a'));_0x4e77b5[_0xd204('0x3b')]=0xd;_0x4e77b5[_0xd204('0x3c')]='Blacklist';_0x4e77b5[_0xd204('0x3d')]=_0x5ab94e;_0x4e77b5['responsetime']=_0x5ab94e;_0x4e77b5[_0xd204('0x3e')]=_0x5ab94e;};exports[_0xd204('0x3f')]=function(_0x294a06,_0xfd8b3e,_0x57055f){var _0x59451a=moment()[_0xd204('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x294a06[_0xd204('0x3b')]=_0xfd8b3e;_0x294a06[_0xd204('0x3c')]=_0x57055f;_0x294a06['responsetime']=_0x59451a;_0x294a06[_0xd204('0x40')]=getSeconds(_0x294a06[_0xd204('0x41')],_0x294a06['starttime']);};exports['logLookAgent']=function(_0x3cfe98,_0xc31a71,_0x8a0d61){_0x3cfe98[_0xd204('0x42')]=_0xc31a71;_0x3cfe98[_0xd204('0x43')]=_0x8a0d61;};exports['logCustomer']=function(_0x522ed9,_0x182694,_0x597066){var _0x13e4bd=moment()['format'](_0xd204('0x3a'));_0x522ed9[_0xd204('0x3b')]=_0x182694;_0x522ed9[_0xd204('0x3c')]=_0x597066;_0x522ed9[_0xd204('0x41')]=_0x522ed9[_0xd204('0x41')]?_0x522ed9['responsetime']:_0x13e4bd;_0x522ed9[_0xd204('0x3e')]=_0x522ed9[_0xd204('0x3e')]?_0x522ed9[_0xd204('0x3e')]:_0x13e4bd;_0x522ed9[_0xd204('0x40')]=getSeconds(_0x522ed9['responsetime']||0x0,_0x522ed9[_0xd204('0x3d')]||0x0);_0x522ed9[_0xd204('0x44')]=_0x522ed9[_0xd204('0x45')]?getSeconds(_0x522ed9[_0xd204('0x3e')],_0x522ed9['answertime']):0x0;};exports['isFailure']=function(_0x1fadd4){return _0x1fadd4===_0xd204('0x46');};exports[_0xd204('0x47')]=function(_0x3b8a27,_0x1ef77b,_0x51df10,_0xfbdbee,_0x3c4eb1){var _0x3d2657=_0xfbdbee?_0xd204('0x48'):_0x3b8a27['calleridname'];_0x3d2657=_0x3c4eb1?_0xd204('0x49'):_0x3d2657;return{'actionid':_0x3b8a27[_0xd204('0x4a')],'action':'originate','channel':_0x3b8a27[_0xd204('0x4b')],'callerid':util[_0xd204('0x15')](_0xd204('0x14'),_0x3d2657,_0x3b8a27[_0xd204('0x1c')]),'Exten':_0xd204('0x2a'),'Context':'from-sip','Priority':'1','variable':_0x51df10,'timeout':(_0x1ef77b[_0xd204('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3b8a27[_0xd204('0x4a')]};};exports[_0xd204('0x4d')]=function(_0x2b0fbb){return _0x2b0fbb[_0xd204('0x4e')]+_0x2b0fbb['countcongestionretry']+_0x2b0fbb[_0xd204('0x4f')]+_0x2b0fbb[_0xd204('0x50')]+_0x2b0fbb[_0xd204('0x51')];};exports[_0xd204('0x52')]=function(_0xc82c65){var _0x2d7987=_[_0xd204('0x53')](_0xc82c65);_0x2d7987[_0xd204('0x3b')]=0xf;_0x2d7987[_0xd204('0x3c')]=_0xd204('0x54');return _0x2d7987;};exports[_0xd204('0x55')]=function(_0x3d1692,_0x18ec92,_0x1e2c83){var _0xab723f={};_0xab723f[_0x18ec92]=_0x3d1692[_0x18ec92];_0xab723f[_0xd204('0x56')]=![];_0xab723f[_0xd204('0x57')]=moment()[_0xd204('0x58')](_0x1e2c83,_0xd204('0x59'))[_0xd204('0x15')](_0xd204('0x3a'));_0xab723f['ContactId']=_0x3d1692[_0xd204('0x1d')];_0xab723f[_0xd204('0x5a')]=_0x3d1692[_0xd204('0x5a')];_0xab723f[_0xd204('0x1f')]=_0x3d1692[_0xd204('0x1f')]||undefined;return _0xab723f;};exports[_0xd204('0x5b')]=function(_0x422656,_0xc0f306){if(!_[_0xd204('0x2f')](_0x422656)){if(_0x422656['pTalking']>0x0){_0x422656[_0xd204('0x5c')]-=0x1;}else{logger[_0xd204('0xb')](_0xc0f306,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0xc0f306,_0xd204('0x5d'));}};exports[_0xd204('0x5e')]=function(_0x2fa707){if(_0x2fa707<=0x0){return!![];}return![];};exports[_0xd204('0x5f')]=function(_0x206770,_0x4a68bf,_0x233383){_0x206770[_0xd204('0x60')]=_0x4a68bf;_0x206770['name']=_0x206770['queue'];_0x206770['interface']=_0x206770[_0xd204('0x4b')];_0x206770[_0xd204('0x61')]=_0xd204('0x62');if(_0x233383){_0x206770[_0xd204('0x63')]=_0x233383[_0xd204('0x63')];}return _0x206770;};exports[_0xd204('0x64')]=function(_0x17dc4a){var _0x363d0a={};_0x363d0a[_0xd204('0x65')]=_0x17dc4a['queue'];_0x363d0a['interface']=_0x17dc4a['channelAgent'];_0x363d0a[_0xd204('0x4a')]=_0x17dc4a[_0xd204('0x4a')];return _0x363d0a;};exports['agentReadyId']=function(_0xa4e417){var _0x552dac=[];for(var _0x35e16e in _0xa4e417){if(_0xa4e417[_0xd204('0x2e')](_0x35e16e)){if(!_['isNil'](_0xa4e417[_0x35e16e])&&_0xa4e417[_0x35e16e]['state']===_0xd204('0x66')&&_0xa4e417[_0x35e16e]['status']==='reachable'){_0x552dac[_0xd204('0x67')](_0xa4e417[_0x35e16e]['id']);}}}return _0x552dac;};exports[_0xd204('0x68')]=function(_0x47a77a){var _0xf7014c=moment()[_0xd204('0x7')](0x0);var _0x2b45f3=moment(_0x47a77a)[_0xd204('0x7')](0x0);return _0xf7014c[_0xd204('0x8')](_0x2b45f3,_0xd204('0x9'));};exports[_0xd204('0x69')]=function(_0x5808b3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5808b3[_0xd204('0x1d')],'ListId':_0x5808b3[_0xd204('0x5a')],'VoiceQueueId':_0x5808b3[_0xd204('0x1f')]||undefined,'CampaignId':_0x5808b3['CampaignId']||undefined};};exports[_0xd204('0x6a')]=function(_0x119189){if(_0x119189===_0xd204('0x4a')||_0x119189===_0xd204('0x6b')||_0x119189===_0xd204('0x65')||_0x119189===_0xd204('0x6c')||_0x119189===_0xd204('0x6d')||_0x119189===_0xd204('0x6e')||_0x119189===_0xd204('0x42')||_0x119189==='channelAgent'||_0x119189===_0xd204('0x1b')||_0x119189===_0xd204('0x56')||_0x119189===_0xd204('0x1c')||_0x119189==='scheduledat'||_0x119189===_0xd204('0x4e')||_0x119189==='countcongestionretry'||_0x119189===_0xd204('0x4f')||_0x119189===_0xd204('0x6f')||_0x119189===_0xd204('0x70')||_0x119189===_0xd204('0x71')||_0x119189==='callbackat'||_0x119189==='recallme'||_0x119189===_0xd204('0x1d')||_0x119189===_0xd204('0x5a')||_0x119189===_0xd204('0x43')||_0x119189===_0xd204('0x1f')||_0x119189===_0xd204('0x72')||_0x119189===_0xd204('0x73')||_0x119189===_0xd204('0x74')||_0x119189===_0xd204('0x75')||_0x119189==='xmd-listid'||_0x119189===_0xd204('0x76')||_0x119189===_0xd204('0x77')||_0x119189===_0xd204('0x78')||_0x119189==='xmd-dialid'||_0x119189==='xmd-dialchannel'||_0x119189===_0xd204('0x79')||_0x119189==='xmd-cdrtype'||_0x119189===_0xd204('0x7a')||_0x119189===_0xd204('0x7b')||_0x119189===_0xd204('0x7c')||_0x119189===_0xd204('0x7d')||_0x119189===_0xd204('0x7e')||_0x119189===_0xd204('0x7f')||_0x119189===_0xd204('0x80')||_0x119189===_0xd204('0x81')||_0x119189===_0xd204('0x82')||_0x119189===_0xd204('0x83')||_0x119189===_0xd204('0x84')||_0x119189===_0xd204('0x7d')||_0x119189==='rtpaudioqosbridged'||_0x119189==='rtpaudioqosjitter'||_0x119189===_0xd204('0x80')||_0x119189===_0xd204('0x81')||_0x119189===_0xd204('0x82')||_0x119189===_0xd204('0x83')||_0x119189===_0xd204('0x84')||_0x119189===_0xd204('0x85')||_0x119189===_0xd204('0x86')||_0x119189===_0xd204('0x3b')||_0x119189===_0xd204('0x3c')){return![];}return!![];};exports[_0xd204('0x87')]=function(_0x46720f,_0x20864f){var _0x39f55e,_0x535791,_0x2557eb;if(_0x20864f<=0x0){_0x20864f=0x1;}_0x39f55e=new RegExp(_0xd204('0x88')+_0x20864f+'}$');_0x535791=Math[_0xd204('0x89')](0xa,_0x20864f-0x1);_0x2557eb=Math['pow'](0xa,_0x20864f)-0x1;return util[_0xd204('0x15')]('%s',_[_0xd204('0x8a')](_0x46720f,_0x39f55e,_['random'](_0x535791,_0x2557eb)));};exports['extractCalleridName']=function(_0x1b8c3e){var _0x4ffcc3=_0x1b8c3e[_0xd204('0x8b')](/"(.*?)"/);return _0x4ffcc3?_0x4ffcc3[0x1]:_0x1b8c3e;};exports[_0xd204('0x8c')]=function(_0xacaed0){var _0xa6643a=_0xacaed0[_0xd204('0x8b')](/<(.*?)>/);return _0xa6643a?_0xa6643a[0x1]:_0xacaed0;}; \ No newline at end of file +var _0x05ec=['rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','pow','match','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','logger','info','loggerError','logger2','message','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','endtime','logAgent','state','responsetime','logLookAgent','membername','UserId','logCustomer','ringtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','reachable','push','createBody','filterKey','type','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqoslossbridged'];(function(_0x368ced,_0x4d0366){var _0x5ee829=function(_0x1cacb1){while(--_0x1cacb1){_0x368ced['push'](_0x368ced['shift']());}};_0x5ee829(++_0x4d0366);}(_0x05ec,0x91));var _0xc05e=function(_0x11981a,_0x382dfe){_0x11981a=_0x11981a-0x0;var _0x4a54ea=_0x05ec[_0x11981a];return _0x4a54ea;};'use strict';var util=require('util');var _=require(_0xc05e('0x0'));var moment=require(_0xc05e('0x1'));var logger=require(_0xc05e('0x2'))(_0xc05e('0x3'));var ipAgi=process[_0xc05e('0x4')][_0xc05e('0x5')]||_0xc05e('0x6');function getSeconds(_0x11acf8,_0x1c4416){var _0x4c0700=moment(_0x11acf8)[_0xc05e('0x7')](0x0);var _0x1347de=moment(_0x1c4416)['milliseconds'](0x0);return _0x4c0700[_0xc05e('0x8')](_0x1347de,_0xc05e('0x9'));}exports[_0xc05e('0xa')]=function(_0x521fb2){return function(_0x2d0be4){logger['error'](_0x521fb2,util['inspect'](_0x2d0be4,{'showHidden':![],'depth':null}));};};exports[_0xc05e('0xb')]=function(_0x2d3575,_0x50f598){logger[_0xc05e('0xc')](_0x2d3575,util['inspect'](_0x50f598,{'showHidden':![],'depth':null}));};exports[_0xc05e('0xd')]=function(_0x45ce76,_0x5cbedf){logger['error'](_0x45ce76,util['inspect'](_0x5cbedf,{'showHidden':![],'depth':null}));};exports[_0xc05e('0xe')]=function(_0x4495e4){return function(_0x58c8db){logger['info'](_0x4495e4,util['inspect'](_0x58c8db,{'showHidden':![],'depth':null}));};};exports[_0xc05e('0xf')]=function(_0x29aef8,_0xdb0f20,_0x3fb672){return{'message':_0x29aef8,'unlock':_0xdb0f20,'active':_0x3fb672};};exports['getCallerId']=function(_0x2b45d9,_0x55cd89,_0xb714a0){if(!_[_0xc05e('0x10')](_0xb714a0)&&'string'===typeof _0xb714a0&&!_[_0xc05e('0x11')](_0xb714a0)){if(!_[_0xc05e('0x10')](_0x55cd89)&&_0xc05e('0x12')===typeof _0x55cd89&&!_['isEmpty'](_0x55cd89)){return util[_0xc05e('0x13')](_0xc05e('0x14'),_0x55cd89,_0xb714a0);}return util[_0xc05e('0x13')]('\x22%s\x22\x20<%s>',_0xb714a0,_0xb714a0);}if(!_[_0xc05e('0x10')](_0x2b45d9)&&_0xc05e('0x12')===typeof _0x2b45d9&&!_[_0xc05e('0x11')](_0x2b45d9)){return _0x2b45d9;}return _0xc05e('0x15');};exports[_0xc05e('0x16')]=function(_0x927b65){if(_[_0xc05e('0x17')](_0x927b65)){return![];}return _0x927b65;};exports[_0xc05e('0x18')]=function(_0x2d41e3,_0x2cc1be,_0x1084bd,_0x164d60,_0x4a1c7d,_0x4e12c1){var _0x158820={'XMD-QUEUE':_0x2cc1be[_0xc05e('0x19')]?_0x2cc1be[_0xc05e('0x19')][_0xc05e('0x1a')]:'','XMD-CALLERID':_0x164d60,'XMD-CALLERID-PREVIEW':_0x4e12c1?util['format']('\x22%s\x22\x20<%s>',_0x4e12c1['calleridname'],_0x4e12c1[_0xc05e('0x1b')]):_0x164d60,'XMD-DIALID':_0x4a1c7d,'XMD-CONTACTID':_0x2cc1be[_0xc05e('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x164d60,'XMD-VOICEQUEUEID':_0x2cc1be[_0xc05e('0x1d')],'XMD-DIALCHANNEL':_0x1084bd,'XMD-DIALTIMEOUT':_0x2d41e3['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xc05e('0x13')](_0xc05e('0x1e'),_0x2d41e3['dialQueueProject2']?'g':'',_['isEmpty'](_0x2d41e3[_0xc05e('0x1f')])?'':_0xc05e('0x20')),'XMD-DIALURL':_0x2d41e3[_0xc05e('0x21')]||'','XMD-AGI':_0x2d41e3[_0xc05e('0x22')]?util[_0xc05e('0x13')](_0xc05e('0x23'),ipAgi,_0x2d41e3['dialQueueProject']):_0xc05e('0x24'),'XMD-AGIAFTER':_0x2d41e3[_0xc05e('0x25')]?util[_0xc05e('0x13')](_0xc05e('0x23'),ipAgi,_0x2d41e3[_0xc05e('0x25')]):_0xc05e('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x4e12c1?_0x4e12c1[_0xc05e('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x4e12c1?_0x4e12c1[_0xc05e('0x27')]:'','XMD-DESTINATION':_0xc05e('0x28')};if(!_['isEmpty'](_0x2d41e3[_0xc05e('0x1f')])){_0x158820[util[_0xc05e('0x13')]('%s',_0xc05e('0x29'))]=_0x2d41e3[_0xc05e('0x1f')];_0x158820[util[_0xc05e('0x13')]('%s',_0xc05e('0x2a'))]=_0x4a1c7d;}if(_0x2cc1be&&_0x2cc1be[_0xc05e('0x2b')]){for(var _0x5e1c7d in _0x2cc1be[_0xc05e('0x2b')]){if(_0x2cc1be[_0xc05e('0x2b')][_0xc05e('0x2c')](_0x5e1c7d)){if(!_[_0xc05e('0x17')](_0x2cc1be[_0xc05e('0x2b')][_0x5e1c7d])&&_0x5e1c7d!=='id'&&_0x5e1c7d!==_0xc05e('0x2d')&&_0x5e1c7d!==_0xc05e('0x2e')&&_0x5e1c7d!=='updatedAt'){_0x158820[util[_0xc05e('0x13')](_0xc05e('0x2f'),_0xc05e('0x30'),_[_0xc05e('0x31')](_0x5e1c7d))]=_0x2cc1be[_0xc05e('0x2b')][_0x5e1c7d];}}}}return _0x158820;};exports[_0xc05e('0x32')]=function(_0x21d6b2){var _0x511ea0={};for(var _0x54123a in _0x21d6b2){if(_0x21d6b2[_0xc05e('0x2c')](_0x54123a)){_0x511ea0[util['format']('%s',_[_0xc05e('0x33')](_0x54123a))]=_0x21d6b2[_0x54123a];}}return{'variables':_0x511ea0};};exports['updateOriginated']=function(_0x1c83f8,_0x54e3ad){if(!_[_0xc05e('0x17')](_0x1c83f8)){if(_0x1c83f8[_0xc05e('0x2c')]('originated')){if(_0x1c83f8[_0xc05e('0x34')]>0x0){_0x1c83f8[_0xc05e('0x34')]-=0x1;}else{logger[_0xc05e('0x35')](_0xc05e('0x36'),_0x54e3ad);}}}else{logger['error'](_0xc05e('0x37'),_0x54e3ad);}};exports[_0xc05e('0x38')]=function(_0x3cb47c){var _0x5ef74a=moment()[_0xc05e('0x13')](_0xc05e('0x39'));_0x3cb47c['state']=0xd;_0x3cb47c[_0xc05e('0x3a')]=_0xc05e('0x3b');_0x3cb47c[_0xc05e('0x3c')]=_0x5ef74a;_0x3cb47c['responsetime']=_0x5ef74a;_0x3cb47c[_0xc05e('0x3d')]=_0x5ef74a;};exports[_0xc05e('0x3e')]=function(_0x5dd1ad,_0x5a3514,_0x4dc7c3){var _0x54a85a=moment()[_0xc05e('0x13')](_0xc05e('0x39'));_0x5dd1ad[_0xc05e('0x3f')]=_0x5a3514;_0x5dd1ad[_0xc05e('0x3a')]=_0x4dc7c3;_0x5dd1ad[_0xc05e('0x40')]=_0x54a85a;_0x5dd1ad['ringtime']=getSeconds(_0x5dd1ad[_0xc05e('0x40')],_0x5dd1ad[_0xc05e('0x3c')]);};exports[_0xc05e('0x41')]=function(_0x2cd749,_0x46b30e,_0x1150e0){_0x2cd749[_0xc05e('0x42')]=_0x46b30e;_0x2cd749[_0xc05e('0x43')]=_0x1150e0;};exports[_0xc05e('0x44')]=function(_0x30980f,_0x44d559,_0x274ee6){var _0xd1b191=moment()[_0xc05e('0x13')](_0xc05e('0x39'));_0x30980f['state']=_0x44d559;_0x30980f[_0xc05e('0x3a')]=_0x274ee6;_0x30980f[_0xc05e('0x40')]=_0x30980f[_0xc05e('0x40')]?_0x30980f['responsetime']:_0xd1b191;_0x30980f[_0xc05e('0x3d')]=_0x30980f['endtime']?_0x30980f[_0xc05e('0x3d')]:_0xd1b191;_0x30980f[_0xc05e('0x45')]=getSeconds(_0x30980f[_0xc05e('0x40')]||0x0,_0x30980f[_0xc05e('0x3c')]||0x0);_0x30980f[_0xc05e('0x46')]=_0x30980f[_0xc05e('0x47')]?getSeconds(_0x30980f[_0xc05e('0x3d')],_0x30980f[_0xc05e('0x47')]):0x0;};exports[_0xc05e('0x48')]=function(_0x573b48){return _0x573b48===_0xc05e('0x49');};exports[_0xc05e('0x4a')]=function(_0x58a6fe,_0x19b2e3,_0x5e3b5f,_0x25cb9e,_0x410f24){var _0x258f29=_0x25cb9e?_0xc05e('0x4b'):_0x58a6fe[_0xc05e('0x4c')];_0x258f29=_0x410f24?_0xc05e('0x4d'):_0x258f29;return{'actionid':_0x58a6fe[_0xc05e('0x4e')],'action':_0xc05e('0x4f'),'channel':_0x58a6fe[_0xc05e('0x50')],'callerid':util[_0xc05e('0x13')](_0xc05e('0x14'),_0x258f29,_0x58a6fe[_0xc05e('0x1b')]),'Exten':'xcally-motion-preview','Context':_0xc05e('0x51'),'Priority':'1','variable':_0x5e3b5f,'timeout':(_0x19b2e3[_0xc05e('0x52')]||0x1e)*0x3e8,'async':!![],'channelid':_0x58a6fe[_0xc05e('0x4e')]};};exports['totalGlobal']=function(_0x5b34d6){return _0x5b34d6[_0xc05e('0x53')]+_0x5b34d6['countcongestionretry']+_0x5b34d6[_0xc05e('0x54')]+_0x5b34d6[_0xc05e('0x55')]+_0x5b34d6[_0xc05e('0x56')];};exports['cloneAction']=function(_0x85c36a){var _0x3a38d3=_[_0xc05e('0x57')](_0x85c36a);_0x3a38d3[_0xc05e('0x3f')]=0xf;_0x3a38d3[_0xc05e('0x3a')]=_0xc05e('0x58');return _0x3a38d3;};exports[_0xc05e('0x59')]=function(_0x26eccd,_0x4d4077,_0x2b1294){var _0x54a89e={};_0x54a89e[_0x4d4077]=_0x26eccd[_0x4d4077];_0x54a89e[_0xc05e('0x5a')]=![];_0x54a89e[_0xc05e('0x5b')]=moment()[_0xc05e('0x5c')](_0x2b1294,_0xc05e('0x5d'))[_0xc05e('0x13')](_0xc05e('0x39'));_0x54a89e[_0xc05e('0x1c')]=_0x26eccd[_0xc05e('0x1c')];_0x54a89e['ListId']=_0x26eccd[_0xc05e('0x5e')];_0x54a89e[_0xc05e('0x1d')]=_0x26eccd['VoiceQueueId']||undefined;return _0x54a89e;};exports[_0xc05e('0x5f')]=function(_0x40f3e0,_0x3afe22){if(!_['isNil'](_0x40f3e0)){if(_0x40f3e0[_0xc05e('0x60')]>0x0){_0x40f3e0[_0xc05e('0x60')]-=0x1;}else{logger['error'](_0x3afe22,_0xc05e('0x61'));}}else{logger['error'](_0x3afe22,_0xc05e('0x62'));}};exports[_0xc05e('0x63')]=function(_0x23a496){if(_0x23a496<=0x0){return!![];}return![];};exports[_0xc05e('0x64')]=function(_0x141041,_0x4892e9,_0x4011e8){_0x141041[_0xc05e('0x65')]=_0x4892e9;_0x141041[_0xc05e('0x1a')]=_0x141041[_0xc05e('0x66')];_0x141041[_0xc05e('0x67')]=_0x141041['channelAgent'];_0x141041['motionChannel']=_0xc05e('0x68');if(_0x4011e8){_0x141041[_0xc05e('0x69')]=_0x4011e8[_0xc05e('0x69')];}return _0x141041;};exports[_0xc05e('0x6a')]=function(_0xbde3b7){var _0x13bd2a={};_0x13bd2a[_0xc05e('0x66')]=_0xbde3b7[_0xc05e('0x66')];_0x13bd2a['interface']=_0xbde3b7[_0xc05e('0x50')];_0x13bd2a[_0xc05e('0x4e')]=_0xbde3b7['uniqueid'];return _0x13bd2a;};exports[_0xc05e('0x6b')]=function(_0x28b061){var _0x342025=[];for(var _0x477d1a in _0x28b061){if(_0x28b061[_0xc05e('0x2c')](_0x477d1a)){if(!_[_0xc05e('0x17')](_0x28b061[_0x477d1a])&&_0x28b061[_0x477d1a]['state']===_0xc05e('0x6c')&&_0x28b061[_0x477d1a]['status']===_0xc05e('0x6d')){_0x342025[_0xc05e('0x6e')](_0x28b061[_0x477d1a]['id']);}}}return _0x342025;};exports['getDiff']=function(_0x271d24){var _0x51bcbe=moment()[_0xc05e('0x7')](0x0);var _0x4d77ed=moment(_0x271d24)[_0xc05e('0x7')](0x0);return _0x51bcbe[_0xc05e('0x8')](_0x4d77ed,_0xc05e('0x9'));};exports[_0xc05e('0x6f')]=function(_0x1f48cd){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1f48cd['ContactId'],'ListId':_0x1f48cd[_0xc05e('0x5e')],'VoiceQueueId':_0x1f48cd['VoiceQueueId']||undefined,'CampaignId':_0x1f48cd['CampaignId']||undefined};};exports[_0xc05e('0x70')]=function(_0x6318f3){if(_0x6318f3===_0xc05e('0x4e')||_0x6318f3==='idContact'||_0x6318f3===_0xc05e('0x66')||_0x6318f3===_0xc05e('0x71')||_0x6318f3==='campaigntype'||_0x6318f3==='dialAnswer'||_0x6318f3==='membername'||_0x6318f3==='channelAgent'||_0x6318f3==='calleridname'||_0x6318f3===_0xc05e('0x5a')||_0x6318f3===_0xc05e('0x1b')||_0x6318f3==='scheduledat'||_0x6318f3===_0xc05e('0x53')||_0x6318f3===_0xc05e('0x72')||_0x6318f3==='countnoanswerretry'||_0x6318f3===_0xc05e('0x73')||_0x6318f3===_0xc05e('0x74')||_0x6318f3===_0xc05e('0x75')||_0x6318f3===_0xc05e('0x76')||_0x6318f3==='recallme'||_0x6318f3===_0xc05e('0x1c')||_0x6318f3===_0xc05e('0x5e')||_0x6318f3===_0xc05e('0x43')||_0x6318f3===_0xc05e('0x1d')||_0x6318f3===_0xc05e('0x77')||_0x6318f3==='xmd-voicequeueid'||_0x6318f3===_0xc05e('0x78')||_0x6318f3===_0xc05e('0x79')||_0x6318f3===_0xc05e('0x7a')||_0x6318f3==='xmd-dialurl'||_0x6318f3===_0xc05e('0x7b')||_0x6318f3===_0xc05e('0x7c')||_0x6318f3==='xmd-dialid'||_0x6318f3==='xmd-dialchannel'||_0x6318f3==='xmd-contactid'||_0x6318f3===_0xc05e('0x7d')||_0x6318f3===_0xc05e('0x7e')||_0x6318f3==='xmd-agiafter'||_0x6318f3===_0xc05e('0x7f')||_0x6318f3===_0xc05e('0x80')||_0x6318f3===_0xc05e('0x81')||_0x6318f3===_0xc05e('0x82')||_0x6318f3===_0xc05e('0x83')||_0x6318f3===_0xc05e('0x84')||_0x6318f3==='rtpaudioqoslossbridged'||_0x6318f3===_0xc05e('0x85')||_0x6318f3==='rtpaudioqosrttbridged'||_0x6318f3===_0xc05e('0x80')||_0x6318f3===_0xc05e('0x81')||_0x6318f3===_0xc05e('0x82')||_0x6318f3==='rtpaudioqosjitterbridged'||_0x6318f3===_0xc05e('0x84')||_0x6318f3===_0xc05e('0x86')||_0x6318f3===_0xc05e('0x85')||_0x6318f3===_0xc05e('0x87')||_0x6318f3==='bridgepeer'||_0x6318f3===_0xc05e('0x88')||_0x6318f3===_0xc05e('0x3f')||_0x6318f3===_0xc05e('0x3a')){return![];}return!![];};exports[_0xc05e('0x89')]=function(_0x37ba6a,_0x4d6b83){var _0x227156,_0x5dbb7d,_0x47bd24;if(_0x4d6b83<=0x0){_0x4d6b83=0x1;}_0x227156=new RegExp('\x5cw{0,'+_0x4d6b83+'}$');_0x5dbb7d=Math[_0xc05e('0x8a')](0xa,_0x4d6b83-0x1);_0x47bd24=Math[_0xc05e('0x8a')](0xa,_0x4d6b83)-0x1;return util['format']('%s',_['replace'](_0x37ba6a,_0x227156,_['random'](_0x5dbb7d,_0x47bd24)));};exports['extractCalleridName']=function(_0x123137){var _0x14d218=_0x123137['match'](/"(.*?)"/);return _0x14d218?_0x14d218[0x1]:_0x123137;};exports['extractCalleridNumber']=function(_0x178d05){var _0x2bddfb=_0x178d05[_0xc05e('0x8b')](/<(.*?)>/);return _0x2bddfb?_0x2bddfb[0x1]:_0x178d05;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index eec871e..f33b4dd 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 _0xf4e1=['reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string','boolean','queueremove','queuepause'];(function(_0x485201,_0x3c533a){var _0x9ca98a=function(_0x418ef0){while(--_0x418ef0){_0x485201['push'](_0x485201['shift']());}};_0x9ca98a(++_0x3c533a);}(_0xf4e1,0x1d8));var _0x1f4e=function(_0x510da9,_0x4f0179){_0x510da9=_0x510da9-0x0;var _0x149269=_0xf4e1[_0x510da9];return _0x149269;};'use strict';exports[_0x1f4e('0x0')]={'queue':{'type':_0x1f4e('0x1'),'required':!![]},'interface':{'type':_0x1f4e('0x1'),'required':!![]},'membername':{'type':_0x1f4e('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x1f4e('0x2'),'required':![]}};exports[_0x1f4e('0x3')]={'queue':{'type':_0x1f4e('0x1'),'required':!![]},'interface':{'type':_0x1f4e('0x1'),'required':!![]}};exports[_0x1f4e('0x4')]={'interface':{'type':_0x1f4e('0x1'),'required':!![]},'paused':{'type':_0x1f4e('0x2')},'reason':{'type':'string','required':![]}};exports[_0x1f4e('0x5')]={'module':{'type':_0x1f4e('0x1'),'required':![]}};exports[_0x1f4e('0x6')]={'uniqueid':{'type':_0x1f4e('0x1'),'required':!![]}};exports[_0x1f4e('0x7')]={'uniqueid':{'type':_0x1f4e('0x1'),'required':!![]},'filename':{'type':_0x1f4e('0x1')},'format':{'type':_0x1f4e('0x1')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x1f4e('0x1'),'required':!![]}};exports[_0x1f4e('0x8')]={'uniqueid':{'type':_0x1f4e('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x1f4e('0x1')}}; \ No newline at end of file +var _0xf4be=['voicequeuechannelhangup','queueadd','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel'];(function(_0x1bda22,_0x387d07){var _0x2da446=function(_0x3500c8){while(--_0x3500c8){_0x1bda22['push'](_0x1bda22['shift']());}};_0x2da446(++_0x387d07);}(_0xf4be,0xa1));var _0xef4b=function(_0x2da7c3,_0x8382f4){_0x2da7c3=_0x2da7c3-0x0;var _0x274655=_0xf4be[_0x2da7c3];return _0x274655;};'use strict';exports[_0xef4b('0x0')]={'queue':{'type':_0xef4b('0x1'),'required':!![]},'interface':{'type':_0xef4b('0x1'),'required':!![]},'membername':{'type':_0xef4b('0x1'),'required':!![]},'penalty':{'type':_0xef4b('0x2'),'required':![]},'paused':{'type':_0xef4b('0x3'),'required':![]}};exports[_0xef4b('0x4')]={'queue':{'type':_0xef4b('0x1'),'required':!![]},'interface':{'type':_0xef4b('0x1'),'required':!![]}};exports[_0xef4b('0x5')]={'interface':{'type':_0xef4b('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xef4b('0x1'),'required':![]}};exports[_0xef4b('0x6')]={'module':{'type':_0xef4b('0x1'),'required':![]}};exports[_0xef4b('0x7')]={'uniqueid':{'type':_0xef4b('0x1'),'required':!![]}};exports[_0xef4b('0x8')]={'uniqueid':{'type':_0xef4b('0x1'),'required':!![]},'filename':{'type':_0xef4b('0x1')},'format':{'type':_0xef4b('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xef4b('0x9')]={'uniqueid':{'type':_0xef4b('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xef4b('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 9e08c42..beb19e4 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 _0x2402=['../model/faxAccount','telephones','trunks','voiceQueues','templates','voiceExtensions','channels','queueChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','SIP/%s','isNil','interface','format','name','total','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTrunks','initVoiceQueues','initTriggers','triggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','unmanaged','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','faxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount'];(function(_0x29b2f4,_0x139cf9){var _0x229d6a=function(_0x1b77fd){while(--_0x1b77fd){_0x29b2f4['push'](_0x29b2f4['shift']());}};_0x229d6a(++_0x139cf9);}(_0x2402,0x1ae));var _0x2240=function(_0x4988eb,_0x2819c6){_0x4988eb=_0x4988eb-0x0;var _0x2c1332=_0x2402[_0x4988eb];return _0x2c1332;};'use strict';var BPromise=require(_0x2240('0x0'));var util=require(_0x2240('0x1'));var _=require(_0x2240('0x2'));var moment=require(_0x2240('0x3'));var Agent=require(_0x2240('0x4'));var Telephone=require('../model/telephone');var Trunk=require(_0x2240('0x5'));var VoiceQueue=require(_0x2240('0x6'));var Trigger=require('../model/trigger');var Template=require(_0x2240('0x7'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x2240('0x8'));var ZendeskAccount=require(_0x2240('0x9'));var SalesforceAccount=require(_0x2240('0xa'));var FreshdeskAccount=require(_0x2240('0xb'));var SugarcrmAccount=require(_0x2240('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x2240('0xd'));var VtigerAccount=require(_0x2240('0xe'));var ServicenowAccount=require(_0x2240('0xf'));var Dynamics365Account=require(_0x2240('0x10'));var FreshsalesAccount=require(_0x2240('0x11'));var FaxAccount=require(_0x2240('0x12'));var Realtime=function(){this['agents']={};this[_0x2240('0x13')]={};this[_0x2240('0x14')]={};this[_0x2240('0x15')]={};this['triggers']={};this['campaigns']={};this[_0x2240('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x2240('0x17')]={};this[_0x2240('0x18')]={};this[_0x2240('0x19')]={};this['outboundChannels']={};this[_0x2240('0x1a')]={};this[_0x2240('0x1b')]={};this[_0x2240('0x1c')]={};this[_0x2240('0x1d')]={};this['sugarcrmAccounts']={};this[_0x2240('0x1e')]={};this[_0x2240('0x1f')]={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0x2240('0x20')]={};this[_0x2240('0x21')]={};this[_0x2240('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x625a5e,_0xfb9644,_0x595573){var _0x23bc25=_[_0x2240('0x23')](_0x625a5e,function(_0x2709b6,_0x2d263b){return _0x2709b6[_0x595573];});for(var _0x7858a5 in _0xfb9644){if(_0xfb9644[_0x2240('0x24')](_0x7858a5)){if(!_0x23bc25[_0x7858a5]){delete _0xfb9644[_0x7858a5];}}}}function freeIsNotKeySip(_0x142ffd,_0x388af7){var _0x2b6c44=_[_0x2240('0x23')](_0x142ffd,function(_0x380469,_0x51ecdd){return util['format'](_0x2240('0x25'),_0x380469['name']);});for(var _0x543de0 in _0x388af7){if(_0x388af7[_0x2240('0x24')](_0x543de0)){if(!_0x2b6c44[_0x543de0]){delete _0x388af7[_0x543de0];}}}}function freeIsNotKeyAgent(_0x121046,_0x25aecd){var _0x463fb0=_[_0x2240('0x23')](_0x121046,function(_0x40d3e6,_0x34ed6a){var _0x24da42=_[_0x2240('0x26')](_0x40d3e6[_0x2240('0x27')])?util[_0x2240('0x28')](_0x2240('0x25'),_0x40d3e6[_0x2240('0x29')]):_0x40d3e6[_0x2240('0x27')];return _0x24da42;});for(var _0x483453 in _0x25aecd){if(_0x25aecd[_0x2240('0x24')](_0x483453)){if(!_0x463fb0[_0x483453]){delete _0x25aecd[_0x483453];}}}}function clearVoiceCallReports(_0x40cf33){_0x40cf33[_0x2240('0x2a')]=0x0;_0x40cf33['answered']=0x0;_0x40cf33[_0x2240('0x2b')]=0x0;_0x40cf33[_0x2240('0x2c')]=0x0;_0x40cf33['sumBillable']=0x0;}function clearCampaigns(_0x24767f){if(!_[_0x2240('0x2d')](_0x24767f)){for(var _0x5ce38b in _0x24767f){if(_0x24767f[_0x2240('0x24')](_0x5ce38b)){_0x24767f[_0x5ce38b][_0x2240('0x2e')]=0x0;_0x24767f[_0x5ce38b][_0x2240('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x53f655){if(!_[_0x2240('0x2d')](_0x53f655)){for(var _0x4f3e88 in _0x53f655){if(_0x53f655['hasOwnProperty'](_0x4f3e88)){_0x53f655[_0x4f3e88][_0x2240('0x2a')]=0x0;_0x53f655[_0x4f3e88][_0x2240('0x30')]=0x0;_0x53f655[_0x4f3e88]['unmanaged']=0x0;_0x53f655[_0x4f3e88][_0x2240('0x31')]=0x0;_0x53f655[_0x4f3e88][_0x2240('0x2b')]=0x0;_0x53f655[_0x4f3e88]['sumDuration']=0x0;_0x53f655[_0x4f3e88][_0x2240('0x32')]=0x0;_0x53f655[_0x4f3e88][_0x2240('0x33')]=0x0;_0x53f655[_0x4f3e88][_0x2240('0x34')]=0x0;_0x53f655[_0x4f3e88][_0x2240('0x35')]=0x0;_0x53f655[_0x4f3e88][_0x2240('0x36')]=0x0;_0x53f655[_0x4f3e88][_0x2240('0x37')]=0x0;_0x53f655[_0x4f3e88][_0x2240('0x38')]=0x0;_0x53f655[_0x4f3e88][_0x2240('0x39')]=0x0;_0x53f655[_0x4f3e88][_0x2240('0x3a')]=0x0;_0x53f655[_0x4f3e88][_0x2240('0x3b')]=0x0;_0x53f655[_0x4f3e88]['outboundOriginateFailureCallsDay']=0x0;_0x53f655[_0x4f3e88][_0x2240('0x3c')]=0x0;_0x53f655[_0x4f3e88][_0x2240('0x3d')]=0x0;_0x53f655[_0x4f3e88][_0x2240('0x33')]=0x0;_0x53f655[_0x4f3e88][_0x2240('0x3e')]=0x0;_0x53f655[_0x4f3e88][_0x2240('0x3f')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x40b8f7,_0x48ecb7){for(var _0x595dc1 in _0x48ecb7){if(_0x40b8f7['hasOwnProperty'](_0x595dc1)){_0x40b8f7[_0x595dc1]=_0x48ecb7[_0x595dc1];}}};Realtime[_0x2240('0x40')][_0x2240('0x41')]=function(){var _0x3d4530=this;return function(_0x5e5b84){if(_0x5e5b84){freeIsNotKeyAgent(_0x5e5b84,_0x3d4530[_0x2240('0x42')]);for(var _0xedc4b3=0x0,_0x1847b4={},_0x1a614b={};_0xedc4b3<_0x5e5b84[_0x2240('0x43')];_0xedc4b3+=0x1){_0x1847b4=_0x5e5b84[_0xedc4b3];var _0x1ba1da=_[_0x2240('0x26')](_0x1847b4[_0x2240('0x27')])?util['format'](_0x2240('0x25'),_0x1847b4[_0x2240('0x29')]):_0x1847b4[_0x2240('0x27')];if(_[_0x2240('0x44')](_0x3d4530[_0x2240('0x42')][_0x1ba1da])){_0x3d4530[_0x2240('0x42')][_0x1ba1da]=new Agent(_0x1847b4);}else{_0x3d4530['mergeFromDatabase'](_0x3d4530[_0x2240('0x42')][_0x1ba1da],_0x1847b4);}}}return _0x3d4530['agents'];};};Realtime[_0x2240('0x40')]['initTelephones']=function(){var _0xb28f1f=this;return function(_0x147edb){if(_0x147edb){freeIsNotKeySip(_0x147edb,_0xb28f1f[_0x2240('0x13')]);for(var _0x4fada2=0x0,_0x3d60ef={},_0x31610a={};_0x4fada2<_0x147edb[_0x2240('0x43')];_0x4fada2+=0x1){_0x3d60ef=_0x147edb[_0x4fada2];if(_[_0x2240('0x44')](_0xb28f1f[_0x2240('0x13')][util[_0x2240('0x28')](_0x2240('0x25'),_0x3d60ef[_0x2240('0x29')])])){_0xb28f1f['telephones'][util[_0x2240('0x28')](_0x2240('0x25'),_0x3d60ef[_0x2240('0x29')])]=new Telephone(_0x3d60ef);}else{_0xb28f1f[_0x2240('0x45')](_0xb28f1f[_0x2240('0x13')][util[_0x2240('0x28')](_0x2240('0x25'),_0x3d60ef[_0x2240('0x29')])],_0x3d60ef);}}}return _0xb28f1f[_0x2240('0x13')];};};Realtime[_0x2240('0x40')][_0x2240('0x46')]=function(){var _0x5940f1=this;return function(_0x3c1c42){if(_0x3c1c42){freeIsNotKeySip(_0x3c1c42,_0x5940f1[_0x2240('0x14')]);for(var _0x5cb625=0x0,_0x569fda={},_0x4edefd={};_0x5cb625<_0x3c1c42[_0x2240('0x43')];_0x5cb625+=0x1){_0x569fda=_0x3c1c42[_0x5cb625];if(_[_0x2240('0x44')](_0x5940f1[_0x2240('0x14')][util[_0x2240('0x28')](_0x2240('0x25'),_0x569fda[_0x2240('0x29')])])){_0x5940f1[_0x2240('0x14')][util[_0x2240('0x28')](_0x2240('0x25'),_0x569fda[_0x2240('0x29')])]=new Trunk(_0x569fda);}else{_0x5940f1[_0x2240('0x45')](_0x5940f1[_0x2240('0x14')][util[_0x2240('0x28')](_0x2240('0x25'),_0x569fda['name'])],_0x569fda);}}}return _0x5940f1[_0x2240('0x14')];};};Realtime[_0x2240('0x40')][_0x2240('0x47')]=function(){var _0x501a7f=this;return function(_0x46e321){if(_0x46e321){freeIsNotKey(_0x46e321,_0x501a7f['voiceQueues'],_0x2240('0x29'));for(var _0x5f206a=0x0,_0x29d0b4={},_0x3b0266={};_0x5f206a<_0x46e321[_0x2240('0x43')];_0x5f206a+=0x1){_0x29d0b4=_0x46e321[_0x5f206a];if(_[_0x2240('0x44')](_0x501a7f[_0x2240('0x15')][_0x29d0b4[_0x2240('0x29')]])){_0x501a7f[_0x2240('0x15')][_0x29d0b4[_0x2240('0x29')]]=new VoiceQueue(_0x29d0b4);}else{_0x501a7f['mergeFromDatabase'](_0x501a7f[_0x2240('0x15')][_0x29d0b4[_0x2240('0x29')]],_0x29d0b4);}}}return _0x501a7f['voiceQueues'];};};Realtime['prototype'][_0x2240('0x48')]=function(){var _0x44ca0c=this;return function(_0x3eaf41){if(_0x3eaf41){freeIsNotKey(_0x3eaf41,_0x44ca0c[_0x2240('0x49')],'id');for(var _0x491e0f=0x0,_0x277d69={},_0x451ae3={};_0x491e0f<_0x3eaf41[_0x2240('0x43')];_0x491e0f+=0x1){_0x277d69=_0x3eaf41[_0x491e0f];if(_[_0x2240('0x44')](_0x44ca0c['triggers'][_0x277d69['id']])){_0x44ca0c['triggers'][_0x277d69['id']]=new Trigger(_0x277d69);}else{_0x44ca0c['mergeFromDatabase'](_0x44ca0c[_0x2240('0x49')][_0x277d69['id']],_0x277d69);}}}return _0x44ca0c[_0x2240('0x49')];};};Realtime[_0x2240('0x40')][_0x2240('0x4a')]=function(){var _0x3e3e89=this;return function(_0x107d27){if(_0x107d27){freeIsNotKey(_0x107d27,_0x3e3e89[_0x2240('0x16')],'id');for(var _0x4a2bb8=0x0,_0x51a238={},_0x3b9c7f={};_0x4a2bb8<_0x107d27[_0x2240('0x43')];_0x4a2bb8+=0x1){_0x51a238=_0x107d27[_0x4a2bb8];if(_[_0x2240('0x44')](_0x3e3e89[_0x2240('0x16')][_0x51a238['id']])){_0x3e3e89['templates'][_0x51a238['id']]=new Template(_0x51a238);}else{_0x3e3e89[_0x2240('0x45')](_0x3e3e89['templates'][_0x51a238['id']],_0x51a238);}}}return _0x3e3e89['templates'];};};Realtime[_0x2240('0x40')]['initZendeskAccounts']=function(){var _0x3554d7=this;return function(_0x2b4e86){if(_0x2b4e86){freeIsNotKey(_0x2b4e86,_0x3554d7[_0x2240('0x1c')],'id');for(var _0x573f78=0x0,_0x1675e9={},_0x430d5e={};_0x573f78<_0x2b4e86[_0x2240('0x43')];_0x573f78+=0x1){_0x1675e9=_0x2b4e86[_0x573f78];if(_[_0x2240('0x44')](_0x3554d7[_0x2240('0x1c')][_0x1675e9['id']])){_0x3554d7[_0x2240('0x1c')][_0x1675e9['id']]=new ZendeskAccount(_0x1675e9);}else{_0x3554d7[_0x2240('0x45')](_0x3554d7[_0x2240('0x1c')][_0x1675e9['id']],_0x1675e9);}}}return _0x3554d7[_0x2240('0x1c')];};};Realtime[_0x2240('0x40')][_0x2240('0x4b')]=function(){var _0x438f92=this;return function(_0x2e4262){if(_0x2e4262){freeIsNotKey(_0x2e4262,_0x438f92[_0x2240('0x1d')],'id');for(var _0x911774=0x0,_0x3437d7={},_0x1f551c={};_0x911774<_0x2e4262['length'];_0x911774+=0x1){_0x3437d7=_0x2e4262[_0x911774];if(_[_0x2240('0x44')](_0x438f92[_0x2240('0x1d')][_0x3437d7['id']])){_0x438f92[_0x2240('0x1d')][_0x3437d7['id']]=new SalesforceAccount(_0x3437d7);}else{_0x438f92[_0x2240('0x45')](_0x438f92[_0x2240('0x1d')][_0x3437d7['id']],_0x3437d7);}}}return _0x438f92[_0x2240('0x1d')];};};Realtime[_0x2240('0x40')][_0x2240('0x4c')]=function(){var _0x2efe89=this;return function(_0x126e4b){if(_0x126e4b){freeIsNotKey(_0x126e4b,_0x2efe89[_0x2240('0x1e')],'id');for(var _0x4f8d55=0x0,_0x40b005={},_0x2d5ad4={};_0x4f8d55<_0x126e4b[_0x2240('0x43')];_0x4f8d55+=0x1){_0x40b005=_0x126e4b[_0x4f8d55];if(_[_0x2240('0x44')](_0x2efe89[_0x2240('0x1e')][_0x40b005['id']])){_0x2efe89[_0x2240('0x1e')][_0x40b005['id']]=new FreshdeskAccount(_0x40b005);}else{_0x2efe89[_0x2240('0x45')](_0x2efe89[_0x2240('0x1e')][_0x40b005['id']],_0x40b005);}}}return _0x2efe89['freshdeskAccounts'];};};Realtime[_0x2240('0x40')][_0x2240('0x4d')]=function(){var _0x175d73=this;return function(_0xb44b91){if(_0xb44b91){freeIsNotKey(_0xb44b91,_0x175d73[_0x2240('0x1f')],'id');for(var _0x3191b0=0x0,_0x24d8b6={},_0x3412c9={};_0x3191b0<_0xb44b91[_0x2240('0x43')];_0x3191b0+=0x1){_0x24d8b6=_0xb44b91[_0x3191b0];if(_[_0x2240('0x44')](_0x175d73[_0x2240('0x1f')][_0x24d8b6['id']])){_0x175d73[_0x2240('0x1f')][_0x24d8b6['id']]=new ZohoAccount(_0x24d8b6);}else{_0x175d73[_0x2240('0x45')](_0x175d73[_0x2240('0x1f')][_0x24d8b6['id']],_0x24d8b6);}}}return _0x175d73[_0x2240('0x1f')];};};Realtime[_0x2240('0x40')]['initDeskAccounts']=function(){var _0x3498ab=this;return function(_0x3d6ef3){if(_0x3d6ef3){freeIsNotKey(_0x3d6ef3,_0x3498ab[_0x2240('0x4e')],'id');for(var _0x36dce0=0x0,_0x2f377e={},_0x5c03ee={};_0x36dce0<_0x3d6ef3['length'];_0x36dce0+=0x1){_0x2f377e=_0x3d6ef3[_0x36dce0];if(_[_0x2240('0x44')](_0x3498ab[_0x2240('0x4e')][_0x2f377e['id']])){_0x3498ab[_0x2240('0x4e')][_0x2f377e['id']]=new DeskAccount(_0x2f377e);}else{_0x3498ab[_0x2240('0x45')](_0x3498ab[_0x2240('0x4e')][_0x2f377e['id']],_0x2f377e);}}}return _0x3498ab[_0x2240('0x4e')];};};Realtime[_0x2240('0x40')][_0x2240('0x4f')]=function(){var _0x3b2cd6=this;return function(_0x5b0f7){if(_0x5b0f7){freeIsNotKey(_0x5b0f7,_0x3b2cd6[_0x2240('0x50')],'id');for(var _0x7bb29a=0x0,_0x29b5a9={},_0xb943a0={};_0x7bb29a<_0x5b0f7['length'];_0x7bb29a+=0x1){_0x29b5a9=_0x5b0f7[_0x7bb29a];if(_[_0x2240('0x44')](_0x3b2cd6['sugarcrmAccounts'][_0x29b5a9['id']])){_0x3b2cd6['sugarcrmAccounts'][_0x29b5a9['id']]=new SugarcrmAccount(_0x29b5a9);}else{_0x3b2cd6['mergeFromDatabase'](_0x3b2cd6['sugarcrmAccounts'][_0x29b5a9['id']],_0x29b5a9);}}}return _0x3b2cd6['sugarcrmAccounts'];};};Realtime[_0x2240('0x40')][_0x2240('0x51')]=function(){var _0x45d62b=this;return function(_0x1ea803){if(_0x1ea803){freeIsNotKey(_0x1ea803,_0x45d62b[_0x2240('0x52')],'id');for(var _0x41537c=0x0,_0x507820={},_0x280fe5={};_0x41537c<_0x1ea803['length'];_0x41537c+=0x1){_0x507820=_0x1ea803[_0x41537c];if(_['isUndefined'](_0x45d62b[_0x2240('0x52')][_0x507820['id']])){_0x45d62b[_0x2240('0x52')][_0x507820['id']]=new VtigerAccount(_0x507820);}else{_0x45d62b[_0x2240('0x45')](_0x45d62b[_0x2240('0x52')][_0x507820['id']],_0x507820);}}}return _0x45d62b[_0x2240('0x52')];};};Realtime['prototype'][_0x2240('0x53')]=function(){var _0x29f6cc=this;return function(_0x1cd53e){if(_0x1cd53e){freeIsNotKey(_0x1cd53e,_0x29f6cc[_0x2240('0x20')],'id');for(var _0x11c85f=0x0,_0x24d1df={},_0x151771={};_0x11c85f<_0x1cd53e[_0x2240('0x43')];_0x11c85f+=0x1){_0x24d1df=_0x1cd53e[_0x11c85f];if(_[_0x2240('0x44')](_0x29f6cc[_0x2240('0x20')][_0x24d1df['id']])){_0x29f6cc['servicenowAccounts'][_0x24d1df['id']]=new ServicenowAccount(_0x24d1df);}else{_0x29f6cc[_0x2240('0x45')](_0x29f6cc['servicenowAccounts'][_0x24d1df['id']],_0x24d1df);}}}return _0x29f6cc[_0x2240('0x20')];};};Realtime[_0x2240('0x40')]['initDynamics365Accounts']=function(){var _0xdb4d49=this;return function(_0x5146de){if(_0x5146de){freeIsNotKey(_0x5146de,_0xdb4d49[_0x2240('0x21')],'id');for(var _0x22e381=0x0,_0x2fa6df={},_0x1b8457={};_0x22e381<_0x5146de[_0x2240('0x43')];_0x22e381+=0x1){_0x2fa6df=_0x5146de[_0x22e381];if(_['isUndefined'](_0xdb4d49['dynamics365Accounts'][_0x2fa6df['id']])){_0xdb4d49[_0x2240('0x21')][_0x2fa6df['id']]=new Dynamics365Account(_0x2fa6df);}else{_0xdb4d49[_0x2240('0x45')](_0xdb4d49[_0x2240('0x21')][_0x2fa6df['id']],_0x2fa6df);}}}return _0xdb4d49[_0x2240('0x21')];};};Realtime[_0x2240('0x40')][_0x2240('0x54')]=function(){var _0x3f8fa3=this;return function(_0x582008){if(_0x582008){freeIsNotKey(_0x582008,_0x3f8fa3[_0x2240('0x22')],'id');for(var _0x4a5450=0x0,_0x4cdb80={},_0x2cad10={};_0x4a5450<_0x582008[_0x2240('0x43')];_0x4a5450+=0x1){_0x4cdb80=_0x582008[_0x4a5450];if(_[_0x2240('0x44')](_0x3f8fa3[_0x2240('0x22')][_0x4cdb80['id']])){_0x3f8fa3[_0x2240('0x22')][_0x4cdb80['id']]=new FreshsalesAccount(_0x4cdb80);}else{_0x3f8fa3[_0x2240('0x45')](_0x3f8fa3[_0x2240('0x22')][_0x4cdb80['id']],_0x4cdb80);}}}return _0x3f8fa3[_0x2240('0x22')];};};Realtime[_0x2240('0x40')][_0x2240('0x55')]=function(){var _0x5e941b=this;return function(_0x6e5cf8){for(var _0x207ccb=0x0;_0x207ccb<_0x6e5cf8['length'];_0x207ccb+=0x1){_[_0x2240('0x56')](_0x5e941b['voiceQueues'][_0x6e5cf8[_0x207ccb][_0x2240('0x29')]],_0x6e5cf8[_0x207ccb]);}return _0x5e941b[_0x2240('0x15')];};};Realtime[_0x2240('0x40')][_0x2240('0x57')]=function(){var _0x437c75=this;return function(_0x550966){clearVoiceQueues(_0x437c75['voiceQueues']);if(_0x550966){_0x550966=_[_0x2240('0x58')](_0x550966,_0x2240('0x59'));for(var _0x2e75fd in _0x550966){if(_0x550966[_0x2240('0x24')](_0x2e75fd)){var _0x28e497={};for(var _0x986288=0x0;_0x986288<_0x550966[_0x2e75fd][_0x2240('0x43')];_0x986288+=0x1){var _0x4e7926=_0x550966[_0x2e75fd][_0x986288]['queue'];if(_0x437c75[_0x2240('0x15')][_0x4e7926]){if(_0x550966[_0x2e75fd][_0x986288][_0x2240('0x5a')]){_0x437c75[_0x2240('0x15')][_0x4e7926][_0x2240('0x5b')]+=0x1;}if(_0x550966[_0x2e75fd][_0x986288]['queuecallerabandon']){_0x437c75['voiceQueues'][_0x4e7926][_0x2240('0x31')]+=0x1;}_0x437c75[_0x2240('0x15')][_0x4e7926][_0x2240('0x2b')]+=moment(_0x550966[_0x2e75fd][_0x986288][_0x2240('0x5c')])[_0x2240('0x5d')](moment(_0x550966[_0x2e75fd][_0x986288][_0x2240('0x5e')]),'seconds')||0x0;if(_0x986288===_0x550966[_0x2e75fd][_0x2240('0x43')]-0x1){_0x437c75[_0x2240('0x15')][_0x4e7926][_0x2240('0x2c')]+=moment(_0x550966[_0x2e75fd][_0x986288]['queuecallercompleteAt']||_0x550966[_0x2e75fd][_0x986288][_0x2240('0x5f')]||_0x550966[_0x2e75fd][_0x986288][_0x2240('0x60')])['diff'](moment(_0x550966[_0x2e75fd][_0x986288][_0x2240('0x5e')]),_0x2240('0x61'))||0x0;_0x437c75[_0x2240('0x15')][_0x4e7926]['total']+=0x1;if(_0x550966[_0x2e75fd][_0x986288][_0x2240('0x62')]){_0x437c75[_0x2240('0x15')][_0x4e7926][_0x2240('0x30')]+=0x1;_0x437c75[_0x2240('0x15')][_0x4e7926][_0x2240('0x32')]+=moment(_0x550966[_0x2e75fd][_0x986288][_0x2240('0x63')])[_0x2240('0x5d')](moment(_0x550966[_0x2e75fd][_0x986288][_0x2240('0x5c')]),_0x2240('0x61'))||0x0;}}else{_0x437c75[_0x2240('0x15')][_0x4e7926][_0x2240('0x2c')]+=_0x437c75['voiceQueues'][_0x4e7926]['sumHoldTime']||0x0;}}}}}}return _0x437c75[_0x2240('0x15')];};};Realtime[_0x2240('0x40')][_0x2240('0x64')]=function(){var _0x6ab2cf=this;return function(_0x3d915a){clearVoiceCallReports(_0x6ab2cf[_0x2240('0x65')]);if(_0x3d915a){for(var _0x2b409a=0x0;_0x2b409a<_0x3d915a[_0x2240('0x43')];_0x2b409a+=0x1){_0x6ab2cf[_0x2240('0x65')][_0x2240('0x2a')]+=0x1;_0x6ab2cf[_0x2240('0x65')][_0x2240('0x2c')]+=_0x3d915a[_0x2b409a][_0x2240('0x66')];if(_0x3d915a[_0x2b409a][_0x2240('0x67')]===_0x2240('0x68')){_0x6ab2cf[_0x2240('0x65')]['answered']+=0x1;_0x6ab2cf['outbound']['sumHoldTime']+=_0x3d915a[_0x2b409a][_0x2240('0x66')]-_0x3d915a[_0x2b409a][_0x2240('0x69')]||0x0;_0x6ab2cf[_0x2240('0x65')][_0x2240('0x32')]+=_0x3d915a[_0x2b409a][_0x2240('0x69')];}}}return _0x6ab2cf['outbound'];};};Realtime[_0x2240('0x40')]['initCampaigns']=function(){var _0x11eede=this;return function(_0x546982){if(_0x546982){freeIsNotKey(_0x546982,_0x11eede[_0x2240('0x6a')],_0x2240('0x29'));for(var _0x271c56=0x0,_0x51be0c={};_0x271c56<_0x546982[_0x2240('0x43')];_0x271c56+=0x1){_0x51be0c=_0x546982[_0x271c56];if(_[_0x2240('0x44')](_0x11eede[_0x2240('0x6a')][_0x51be0c[_0x2240('0x29')]])){_0x11eede[_0x2240('0x6a')][_0x51be0c['name']]=new Campaign(_0x51be0c);}else{_0x11eede[_0x2240('0x45')](_0x11eede[_0x2240('0x6a')][_0x51be0c[_0x2240('0x29')]],_0x51be0c);_0x11eede[_0x2240('0x6a')][_0x51be0c[_0x2240('0x29')]][_0x2240('0x6b')]=_0x51be0c[_0x2240('0x6c')]?_0x51be0c[_0x2240('0x6c')][_0x2240('0x29')]:undefined;}}}return _0x11eede['campaigns'];};};Realtime[_0x2240('0x40')][_0x2240('0x6d')]=function(){var _0xb9277c=this;return function(_0x892b3a){if(_0x892b3a){freeIsNotKey(_0x892b3a,_0xb9277c[_0x2240('0x17')],'id');for(var _0x387b14=0x0,_0x32cca7={};_0x387b14<_0x892b3a[_0x2240('0x43')];_0x387b14+=0x1){_0x32cca7=_0x892b3a[_0x387b14];if(_[_0x2240('0x44')](_0xb9277c[_0x2240('0x17')][_0x32cca7['id']])){_0xb9277c[_0x2240('0x17')][_0x32cca7['id']]=new VoiceExtension(_0x32cca7);}else{_0xb9277c[_0x2240('0x45')](_0xb9277c[_0x2240('0x17')][_0x32cca7['id']],_0x32cca7);}}}return _0xb9277c[_0x2240('0x17')];};};Realtime[_0x2240('0x40')]['initCampaignHopperHistory']=function(){var _0xd6a05e=this;return function(_0x5b939a){clearCampaigns(_0xd6a05e[_0x2240('0x6a')]);for(var _0xaf8d1f=0x0;_0xaf8d1f<_0x5b939a[_0x2240('0x43')];_0xaf8d1f+=0x1){_[_0x2240('0x56')](_0xd6a05e[_0x2240('0x6a')][_0x5b939a[_0xaf8d1f][_0x2240('0x29')]],_0x5b939a[_0xaf8d1f]);}return _0xd6a05e['campaigns'];};};Realtime['prototype']['initFaxAccounts']=function(){var _0xa5a363=this;return function(_0x560c02){if(_0x560c02){freeIsNotKey(_0x560c02,_0xa5a363[_0x2240('0x6e')],'id');for(var _0x17933a=0x0,_0x1997d7={},_0x2886b6={};_0x17933a<_0x560c02[_0x2240('0x43')];_0x17933a+=0x1){_0x1997d7=_0x560c02[_0x17933a];if(_[_0x2240('0x44')](_0xa5a363[_0x2240('0x6e')][_0x1997d7['id']])){_0xa5a363[_0x2240('0x6e')][_0x1997d7['id']]=new FaxAccount(_0x1997d7);}else{_0xa5a363[_0x2240('0x45')](_0xa5a363[_0x2240('0x6e')][_0x1997d7['id']],_0x1997d7);}}}return _0xa5a363[_0x2240('0x6e')];};};module[_0x2240('0x6f')]=Realtime; \ No newline at end of file +var _0x1ff2=['exports','util','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','salesforceAccounts','freshdeskAccounts','deskAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','SIP/%s','isNil','format','name','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','isUndefined','initTelephones','initTrunks','length','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initZohoAccounts','zohoAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallercomplete','initVoiceCallReports','duration','disposition','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','faxAccounts'];(function(_0x3a5934,_0x874734){var _0x32ad8d=function(_0x3eace5){while(--_0x3eace5){_0x3a5934['push'](_0x3a5934['shift']());}};_0x32ad8d(++_0x874734);}(_0x1ff2,0x130));var _0x21ff=function(_0x1085b5,_0xf933c0){_0x1085b5=_0x1085b5-0x0;var _0x57ffc4=_0x1ff2[_0x1085b5];return _0x57ffc4;};'use strict';var BPromise=require('bluebird');var util=require(_0x21ff('0x0'));var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0x21ff('0x1'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x21ff('0x2'));var Trigger=require(_0x21ff('0x3'));var Template=require(_0x21ff('0x4'));var Campaign=require(_0x21ff('0x5'));var VoiceExtension=require(_0x21ff('0x6'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x21ff('0x7'));var ZohoAccount=require(_0x21ff('0x8'));var DeskAccount=require(_0x21ff('0x9'));var VtigerAccount=require(_0x21ff('0xa'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x21ff('0xb'));var FreshsalesAccount=require(_0x21ff('0xc'));var FaxAccount=require(_0x21ff('0xd'));var Realtime=function(){this[_0x21ff('0xe')]={};this[_0x21ff('0xf')]={};this[_0x21ff('0x10')]={};this[_0x21ff('0x11')]={};this[_0x21ff('0x12')]={};this['campaigns']={};this[_0x21ff('0x13')]={};this[_0x21ff('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x21ff('0x15')]={};this[_0x21ff('0x16')]={};this[_0x21ff('0x17')]={};this[_0x21ff('0x18')]={};this[_0x21ff('0x19')]={};this[_0x21ff('0x1a')]={};this['zendeskAccounts']={};this[_0x21ff('0x1b')]={};this['sugarcrmAccounts']={};this[_0x21ff('0x1c')]={};this['zohoAccounts']={};this[_0x21ff('0x1d')]={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0x21ff('0x1e')]={};this[_0x21ff('0x1f')]={};this['faxAccounts']={};};function freeIsNotKey(_0x48e4b2,_0x3d0df3,_0x4b5600){var _0xdb974a=_[_0x21ff('0x20')](_0x48e4b2,function(_0x20402d,_0x2e575a){return _0x20402d[_0x4b5600];});for(var _0x3a4332 in _0x3d0df3){if(_0x3d0df3[_0x21ff('0x21')](_0x3a4332)){if(!_0xdb974a[_0x3a4332]){delete _0x3d0df3[_0x3a4332];}}}}function freeIsNotKeySip(_0x5b1bcd,_0x1c3d0a){var _0xc9dc8b=_[_0x21ff('0x20')](_0x5b1bcd,function(_0x12b8f8,_0x4c2934){return util['format'](_0x21ff('0x22'),_0x12b8f8['name']);});for(var _0x16f012 in _0x1c3d0a){if(_0x1c3d0a[_0x21ff('0x21')](_0x16f012)){if(!_0xc9dc8b[_0x16f012]){delete _0x1c3d0a[_0x16f012];}}}}function freeIsNotKeyAgent(_0x485205,_0x30825a){var _0x15ca0e=_[_0x21ff('0x20')](_0x485205,function(_0x32c5b2,_0xada44a){var _0x5eafe5=_[_0x21ff('0x23')](_0x32c5b2['interface'])?util[_0x21ff('0x24')](_0x21ff('0x22'),_0x32c5b2[_0x21ff('0x25')]):_0x32c5b2['interface'];return _0x5eafe5;});for(var _0xdec910 in _0x30825a){if(_0x30825a[_0x21ff('0x21')](_0xdec910)){if(!_0x15ca0e[_0xdec910]){delete _0x30825a[_0xdec910];}}}}function clearVoiceCallReports(_0x39ccb3){_0x39ccb3[_0x21ff('0x26')]=0x0;_0x39ccb3[_0x21ff('0x27')]=0x0;_0x39ccb3[_0x21ff('0x28')]=0x0;_0x39ccb3[_0x21ff('0x29')]=0x0;_0x39ccb3[_0x21ff('0x2a')]=0x0;}function clearCampaigns(_0x2ddd95){if(!_[_0x21ff('0x2b')](_0x2ddd95)){for(var _0x1a162d in _0x2ddd95){if(_0x2ddd95[_0x21ff('0x21')](_0x1a162d)){_0x2ddd95[_0x1a162d][_0x21ff('0x2c')]=0x0;_0x2ddd95[_0x1a162d][_0x21ff('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x575ab9){if(!_[_0x21ff('0x2b')](_0x575ab9)){for(var _0x3cfca6 in _0x575ab9){if(_0x575ab9[_0x21ff('0x21')](_0x3cfca6)){_0x575ab9[_0x3cfca6][_0x21ff('0x26')]=0x0;_0x575ab9[_0x3cfca6][_0x21ff('0x27')]=0x0;_0x575ab9[_0x3cfca6][_0x21ff('0x2e')]=0x0;_0x575ab9[_0x3cfca6]['abandoned']=0x0;_0x575ab9[_0x3cfca6]['sumHoldTime']=0x0;_0x575ab9[_0x3cfca6]['sumDuration']=0x0;_0x575ab9[_0x3cfca6]['sumBillable']=0x0;_0x575ab9[_0x3cfca6][_0x21ff('0x2f')]=0x0;_0x575ab9[_0x3cfca6][_0x21ff('0x30')]=0x0;_0x575ab9[_0x3cfca6][_0x21ff('0x31')]=0x0;_0x575ab9[_0x3cfca6]['outboundCongestionCallsDay']=0x0;_0x575ab9[_0x3cfca6][_0x21ff('0x32')]=0x0;_0x575ab9[_0x3cfca6]['outboundUnknownCallsDay']=0x0;_0x575ab9[_0x3cfca6][_0x21ff('0x33')]=0x0;_0x575ab9[_0x3cfca6][_0x21ff('0x34')]=0x0;_0x575ab9[_0x3cfca6][_0x21ff('0x35')]=0x0;_0x575ab9[_0x3cfca6][_0x21ff('0x36')]=0x0;_0x575ab9[_0x3cfca6]['outboundRejectCallsDay']=0x0;_0x575ab9[_0x3cfca6]['outboundReCallsDay']=0x0;_0x575ab9[_0x3cfca6][_0x21ff('0x2f')]=0x0;_0x575ab9[_0x3cfca6][_0x21ff('0x37')]=0x0;_0x575ab9[_0x3cfca6][_0x21ff('0x38')]=!![];}}}}Realtime[_0x21ff('0x39')][_0x21ff('0x3a')]=function(_0x564de4,_0x58131d){for(var _0x97d94f in _0x58131d){if(_0x564de4[_0x21ff('0x21')](_0x97d94f)){_0x564de4[_0x97d94f]=_0x58131d[_0x97d94f];}}};Realtime[_0x21ff('0x39')][_0x21ff('0x3b')]=function(){var _0x10f942=this;return function(_0xe27750){if(_0xe27750){freeIsNotKeyAgent(_0xe27750,_0x10f942['agents']);for(var _0x3e987a=0x0,_0x4a26eb={},_0x3e51cc={};_0x3e987a<_0xe27750['length'];_0x3e987a+=0x1){_0x4a26eb=_0xe27750[_0x3e987a];var _0x24f5b3=_[_0x21ff('0x23')](_0x4a26eb['interface'])?util[_0x21ff('0x24')](_0x21ff('0x22'),_0x4a26eb[_0x21ff('0x25')]):_0x4a26eb['interface'];if(_[_0x21ff('0x3c')](_0x10f942[_0x21ff('0xe')][_0x24f5b3])){_0x10f942[_0x21ff('0xe')][_0x24f5b3]=new Agent(_0x4a26eb);}else{_0x10f942[_0x21ff('0x3a')](_0x10f942[_0x21ff('0xe')][_0x24f5b3],_0x4a26eb);}}}return _0x10f942[_0x21ff('0xe')];};};Realtime[_0x21ff('0x39')][_0x21ff('0x3d')]=function(){var _0x3b6f74=this;return function(_0x322c90){if(_0x322c90){freeIsNotKeySip(_0x322c90,_0x3b6f74['telephones']);for(var _0xfb4ec9=0x0,_0x3e9748={},_0xf49f5a={};_0xfb4ec9<_0x322c90['length'];_0xfb4ec9+=0x1){_0x3e9748=_0x322c90[_0xfb4ec9];if(_[_0x21ff('0x3c')](_0x3b6f74[_0x21ff('0xf')][util[_0x21ff('0x24')]('SIP/%s',_0x3e9748[_0x21ff('0x25')])])){_0x3b6f74[_0x21ff('0xf')][util[_0x21ff('0x24')](_0x21ff('0x22'),_0x3e9748[_0x21ff('0x25')])]=new Telephone(_0x3e9748);}else{_0x3b6f74[_0x21ff('0x3a')](_0x3b6f74[_0x21ff('0xf')][util[_0x21ff('0x24')]('SIP/%s',_0x3e9748[_0x21ff('0x25')])],_0x3e9748);}}}return _0x3b6f74[_0x21ff('0xf')];};};Realtime[_0x21ff('0x39')][_0x21ff('0x3e')]=function(){var _0x4aa82f=this;return function(_0x292a8a){if(_0x292a8a){freeIsNotKeySip(_0x292a8a,_0x4aa82f[_0x21ff('0x10')]);for(var _0x2cf645=0x0,_0x3efbad={},_0x218352={};_0x2cf645<_0x292a8a[_0x21ff('0x3f')];_0x2cf645+=0x1){_0x3efbad=_0x292a8a[_0x2cf645];if(_[_0x21ff('0x3c')](_0x4aa82f[_0x21ff('0x10')][util[_0x21ff('0x24')](_0x21ff('0x22'),_0x3efbad[_0x21ff('0x25')])])){_0x4aa82f[_0x21ff('0x10')][util['format'](_0x21ff('0x22'),_0x3efbad[_0x21ff('0x25')])]=new Trunk(_0x3efbad);}else{_0x4aa82f[_0x21ff('0x3a')](_0x4aa82f[_0x21ff('0x10')][util[_0x21ff('0x24')](_0x21ff('0x22'),_0x3efbad[_0x21ff('0x25')])],_0x3efbad);}}}return _0x4aa82f[_0x21ff('0x10')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x3ed046=this;return function(_0x46097a){if(_0x46097a){freeIsNotKey(_0x46097a,_0x3ed046[_0x21ff('0x11')],_0x21ff('0x25'));for(var _0x27e422=0x0,_0x13e4c0={},_0xc9c381={};_0x27e422<_0x46097a[_0x21ff('0x3f')];_0x27e422+=0x1){_0x13e4c0=_0x46097a[_0x27e422];if(_[_0x21ff('0x3c')](_0x3ed046['voiceQueues'][_0x13e4c0['name']])){_0x3ed046[_0x21ff('0x11')][_0x13e4c0['name']]=new VoiceQueue(_0x13e4c0);}else{_0x3ed046[_0x21ff('0x3a')](_0x3ed046[_0x21ff('0x11')][_0x13e4c0[_0x21ff('0x25')]],_0x13e4c0);}}}return _0x3ed046[_0x21ff('0x11')];};};Realtime[_0x21ff('0x39')][_0x21ff('0x40')]=function(){var _0x72dbf7=this;return function(_0x381597){if(_0x381597){freeIsNotKey(_0x381597,_0x72dbf7['triggers'],'id');for(var _0x5a5d05=0x0,_0x47b385={},_0x59732f={};_0x5a5d05<_0x381597[_0x21ff('0x3f')];_0x5a5d05+=0x1){_0x47b385=_0x381597[_0x5a5d05];if(_[_0x21ff('0x3c')](_0x72dbf7[_0x21ff('0x12')][_0x47b385['id']])){_0x72dbf7[_0x21ff('0x12')][_0x47b385['id']]=new Trigger(_0x47b385);}else{_0x72dbf7[_0x21ff('0x3a')](_0x72dbf7[_0x21ff('0x12')][_0x47b385['id']],_0x47b385);}}}return _0x72dbf7[_0x21ff('0x12')];};};Realtime[_0x21ff('0x39')][_0x21ff('0x41')]=function(){var _0x242927=this;return function(_0x2064b5){if(_0x2064b5){freeIsNotKey(_0x2064b5,_0x242927[_0x21ff('0x13')],'id');for(var _0x4c1ca3=0x0,_0x870d4={},_0x456636={};_0x4c1ca3<_0x2064b5[_0x21ff('0x3f')];_0x4c1ca3+=0x1){_0x870d4=_0x2064b5[_0x4c1ca3];if(_[_0x21ff('0x3c')](_0x242927[_0x21ff('0x13')][_0x870d4['id']])){_0x242927[_0x21ff('0x13')][_0x870d4['id']]=new Template(_0x870d4);}else{_0x242927[_0x21ff('0x3a')](_0x242927[_0x21ff('0x13')][_0x870d4['id']],_0x870d4);}}}return _0x242927['templates'];};};Realtime[_0x21ff('0x39')][_0x21ff('0x42')]=function(){var _0x1ca922=this;return function(_0x73f697){if(_0x73f697){freeIsNotKey(_0x73f697,_0x1ca922[_0x21ff('0x43')],'id');for(var _0x3c0cf1=0x0,_0x1ffcf0={},_0x17ba40={};_0x3c0cf1<_0x73f697[_0x21ff('0x3f')];_0x3c0cf1+=0x1){_0x1ffcf0=_0x73f697[_0x3c0cf1];if(_['isUndefined'](_0x1ca922[_0x21ff('0x43')][_0x1ffcf0['id']])){_0x1ca922['zendeskAccounts'][_0x1ffcf0['id']]=new ZendeskAccount(_0x1ffcf0);}else{_0x1ca922[_0x21ff('0x3a')](_0x1ca922[_0x21ff('0x43')][_0x1ffcf0['id']],_0x1ffcf0);}}}return _0x1ca922['zendeskAccounts'];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x24f6ad=this;return function(_0x11bde7){if(_0x11bde7){freeIsNotKey(_0x11bde7,_0x24f6ad['salesforceAccounts'],'id');for(var _0x4c3154=0x0,_0x4147e0={},_0x3102d={};_0x4c3154<_0x11bde7[_0x21ff('0x3f')];_0x4c3154+=0x1){_0x4147e0=_0x11bde7[_0x4c3154];if(_[_0x21ff('0x3c')](_0x24f6ad['salesforceAccounts'][_0x4147e0['id']])){_0x24f6ad[_0x21ff('0x1b')][_0x4147e0['id']]=new SalesforceAccount(_0x4147e0);}else{_0x24f6ad['mergeFromDatabase'](_0x24f6ad[_0x21ff('0x1b')][_0x4147e0['id']],_0x4147e0);}}}return _0x24f6ad[_0x21ff('0x1b')];};};Realtime[_0x21ff('0x39')]['initFreshdeskAccounts']=function(){var _0x648926=this;return function(_0x1d99b7){if(_0x1d99b7){freeIsNotKey(_0x1d99b7,_0x648926[_0x21ff('0x1c')],'id');for(var _0x1db6a3=0x0,_0x5ceb46={},_0x317887={};_0x1db6a3<_0x1d99b7[_0x21ff('0x3f')];_0x1db6a3+=0x1){_0x5ceb46=_0x1d99b7[_0x1db6a3];if(_[_0x21ff('0x3c')](_0x648926[_0x21ff('0x1c')][_0x5ceb46['id']])){_0x648926[_0x21ff('0x1c')][_0x5ceb46['id']]=new FreshdeskAccount(_0x5ceb46);}else{_0x648926[_0x21ff('0x3a')](_0x648926['freshdeskAccounts'][_0x5ceb46['id']],_0x5ceb46);}}}return _0x648926[_0x21ff('0x1c')];};};Realtime[_0x21ff('0x39')][_0x21ff('0x44')]=function(){var _0x44ff63=this;return function(_0x195de2){if(_0x195de2){freeIsNotKey(_0x195de2,_0x44ff63['zohoAccounts'],'id');for(var _0x3cfaf2=0x0,_0x689d3a={},_0x1b9f59={};_0x3cfaf2<_0x195de2[_0x21ff('0x3f')];_0x3cfaf2+=0x1){_0x689d3a=_0x195de2[_0x3cfaf2];if(_[_0x21ff('0x3c')](_0x44ff63['zohoAccounts'][_0x689d3a['id']])){_0x44ff63[_0x21ff('0x45')][_0x689d3a['id']]=new ZohoAccount(_0x689d3a);}else{_0x44ff63[_0x21ff('0x3a')](_0x44ff63[_0x21ff('0x45')][_0x689d3a['id']],_0x689d3a);}}}return _0x44ff63[_0x21ff('0x45')];};};Realtime[_0x21ff('0x39')]['initDeskAccounts']=function(){var _0x66dcdf=this;return function(_0x290553){if(_0x290553){freeIsNotKey(_0x290553,_0x66dcdf[_0x21ff('0x1d')],'id');for(var _0xc97037=0x0,_0x333360={},_0x195bef={};_0xc97037<_0x290553[_0x21ff('0x3f')];_0xc97037+=0x1){_0x333360=_0x290553[_0xc97037];if(_[_0x21ff('0x3c')](_0x66dcdf[_0x21ff('0x1d')][_0x333360['id']])){_0x66dcdf[_0x21ff('0x1d')][_0x333360['id']]=new DeskAccount(_0x333360);}else{_0x66dcdf[_0x21ff('0x3a')](_0x66dcdf[_0x21ff('0x1d')][_0x333360['id']],_0x333360);}}}return _0x66dcdf[_0x21ff('0x1d')];};};Realtime[_0x21ff('0x39')]['initSugarcrmAccounts']=function(){var _0x2f72b8=this;return function(_0x2bb90c){if(_0x2bb90c){freeIsNotKey(_0x2bb90c,_0x2f72b8[_0x21ff('0x46')],'id');for(var _0x11f2d0=0x0,_0x193fac={},_0x66cc95={};_0x11f2d0<_0x2bb90c[_0x21ff('0x3f')];_0x11f2d0+=0x1){_0x193fac=_0x2bb90c[_0x11f2d0];if(_[_0x21ff('0x3c')](_0x2f72b8[_0x21ff('0x46')][_0x193fac['id']])){_0x2f72b8[_0x21ff('0x46')][_0x193fac['id']]=new SugarcrmAccount(_0x193fac);}else{_0x2f72b8[_0x21ff('0x3a')](_0x2f72b8[_0x21ff('0x46')][_0x193fac['id']],_0x193fac);}}}return _0x2f72b8['sugarcrmAccounts'];};};Realtime[_0x21ff('0x39')][_0x21ff('0x47')]=function(){var _0xf6fb7c=this;return function(_0x15da2b){if(_0x15da2b){freeIsNotKey(_0x15da2b,_0xf6fb7c[_0x21ff('0x48')],'id');for(var _0x254b2f=0x0,_0x162c0d={},_0x5d7679={};_0x254b2f<_0x15da2b[_0x21ff('0x3f')];_0x254b2f+=0x1){_0x162c0d=_0x15da2b[_0x254b2f];if(_[_0x21ff('0x3c')](_0xf6fb7c[_0x21ff('0x48')][_0x162c0d['id']])){_0xf6fb7c['vtigerAccounts'][_0x162c0d['id']]=new VtigerAccount(_0x162c0d);}else{_0xf6fb7c[_0x21ff('0x3a')](_0xf6fb7c[_0x21ff('0x48')][_0x162c0d['id']],_0x162c0d);}}}return _0xf6fb7c[_0x21ff('0x48')];};};Realtime[_0x21ff('0x39')][_0x21ff('0x49')]=function(){var _0x2fd1be=this;return function(_0x4117bf){if(_0x4117bf){freeIsNotKey(_0x4117bf,_0x2fd1be['servicenowAccounts'],'id');for(var _0x55ea45=0x0,_0xb5ed5e={},_0x1281d8={};_0x55ea45<_0x4117bf[_0x21ff('0x3f')];_0x55ea45+=0x1){_0xb5ed5e=_0x4117bf[_0x55ea45];if(_[_0x21ff('0x3c')](_0x2fd1be[_0x21ff('0x4a')][_0xb5ed5e['id']])){_0x2fd1be['servicenowAccounts'][_0xb5ed5e['id']]=new ServicenowAccount(_0xb5ed5e);}else{_0x2fd1be[_0x21ff('0x3a')](_0x2fd1be[_0x21ff('0x4a')][_0xb5ed5e['id']],_0xb5ed5e);}}}return _0x2fd1be[_0x21ff('0x4a')];};};Realtime[_0x21ff('0x39')]['initDynamics365Accounts']=function(){var _0x51316e=this;return function(_0x349dd7){if(_0x349dd7){freeIsNotKey(_0x349dd7,_0x51316e[_0x21ff('0x1e')],'id');for(var _0x1f5962=0x0,_0xc1a938={},_0x1226a7={};_0x1f5962<_0x349dd7[_0x21ff('0x3f')];_0x1f5962+=0x1){_0xc1a938=_0x349dd7[_0x1f5962];if(_['isUndefined'](_0x51316e[_0x21ff('0x1e')][_0xc1a938['id']])){_0x51316e[_0x21ff('0x1e')][_0xc1a938['id']]=new Dynamics365Account(_0xc1a938);}else{_0x51316e[_0x21ff('0x3a')](_0x51316e[_0x21ff('0x1e')][_0xc1a938['id']],_0xc1a938);}}}return _0x51316e[_0x21ff('0x1e')];};};Realtime[_0x21ff('0x39')][_0x21ff('0x4b')]=function(){var _0x206425=this;return function(_0x3f98da){if(_0x3f98da){freeIsNotKey(_0x3f98da,_0x206425['freshsalesAccounts'],'id');for(var _0x22be0a=0x0,_0x800a22={},_0x5d3668={};_0x22be0a<_0x3f98da[_0x21ff('0x3f')];_0x22be0a+=0x1){_0x800a22=_0x3f98da[_0x22be0a];if(_['isUndefined'](_0x206425[_0x21ff('0x1f')][_0x800a22['id']])){_0x206425['freshsalesAccounts'][_0x800a22['id']]=new FreshsalesAccount(_0x800a22);}else{_0x206425[_0x21ff('0x3a')](_0x206425[_0x21ff('0x1f')][_0x800a22['id']],_0x800a22);}}}return _0x206425[_0x21ff('0x1f')];};};Realtime[_0x21ff('0x39')][_0x21ff('0x4c')]=function(){var _0x3b2198=this;return function(_0x2f847a){for(var _0x1a73fd=0x0;_0x1a73fd<_0x2f847a[_0x21ff('0x3f')];_0x1a73fd+=0x1){_[_0x21ff('0x4d')](_0x3b2198[_0x21ff('0x11')][_0x2f847a[_0x1a73fd]['name']],_0x2f847a[_0x1a73fd]);}return _0x3b2198[_0x21ff('0x11')];};};Realtime[_0x21ff('0x39')][_0x21ff('0x4e')]=function(){var _0x38be80=this;return function(_0x39dd69){clearVoiceQueues(_0x38be80[_0x21ff('0x11')]);if(_0x39dd69){_0x39dd69=_[_0x21ff('0x4f')](_0x39dd69,_0x21ff('0x50'));for(var _0x4585da in _0x39dd69){if(_0x39dd69[_0x21ff('0x21')](_0x4585da)){var _0x135887={};for(var _0x57507e=0x0;_0x57507e<_0x39dd69[_0x4585da]['length'];_0x57507e+=0x1){var _0x5c5914=_0x39dd69[_0x4585da][_0x57507e]['queue'];if(_0x38be80[_0x21ff('0x11')][_0x5c5914]){if(_0x39dd69[_0x4585da][_0x57507e]['queuecallerexit']){_0x38be80[_0x21ff('0x11')][_0x5c5914][_0x21ff('0x2e')]+=0x1;}if(_0x39dd69[_0x4585da][_0x57507e][_0x21ff('0x51')]){_0x38be80[_0x21ff('0x11')][_0x5c5914]['abandoned']+=0x1;}_0x38be80['voiceQueues'][_0x5c5914][_0x21ff('0x28')]+=moment(_0x39dd69[_0x4585da][_0x57507e][_0x21ff('0x52')])[_0x21ff('0x53')](moment(_0x39dd69[_0x4585da][_0x57507e][_0x21ff('0x54')]),_0x21ff('0x55'))||0x0;if(_0x57507e===_0x39dd69[_0x4585da][_0x21ff('0x3f')]-0x1){_0x38be80[_0x21ff('0x11')][_0x5c5914][_0x21ff('0x29')]+=moment(_0x39dd69[_0x4585da][_0x57507e][_0x21ff('0x56')]||_0x39dd69[_0x4585da][_0x57507e][_0x21ff('0x57')]||_0x39dd69[_0x4585da][_0x57507e]['queuecallerexitAt'])[_0x21ff('0x53')](moment(_0x39dd69[_0x4585da][_0x57507e][_0x21ff('0x54')]),_0x21ff('0x55'))||0x0;_0x38be80[_0x21ff('0x11')][_0x5c5914][_0x21ff('0x26')]+=0x1;if(_0x39dd69[_0x4585da][_0x57507e][_0x21ff('0x58')]){_0x38be80[_0x21ff('0x11')][_0x5c5914][_0x21ff('0x27')]+=0x1;_0x38be80[_0x21ff('0x11')][_0x5c5914][_0x21ff('0x2a')]+=moment(_0x39dd69[_0x4585da][_0x57507e][_0x21ff('0x56')])[_0x21ff('0x53')](moment(_0x39dd69[_0x4585da][_0x57507e][_0x21ff('0x52')]),_0x21ff('0x55'))||0x0;}}else{_0x38be80[_0x21ff('0x11')][_0x5c5914][_0x21ff('0x29')]+=_0x38be80[_0x21ff('0x11')][_0x5c5914][_0x21ff('0x28')]||0x0;}}}}}}return _0x38be80[_0x21ff('0x11')];};};Realtime[_0x21ff('0x39')][_0x21ff('0x59')]=function(){var _0x4d84e2=this;return function(_0x583c07){clearVoiceCallReports(_0x4d84e2[_0x21ff('0x14')]);if(_0x583c07){for(var _0xd57311=0x0;_0xd57311<_0x583c07['length'];_0xd57311+=0x1){_0x4d84e2[_0x21ff('0x14')][_0x21ff('0x26')]+=0x1;_0x4d84e2['outbound']['sumDuration']+=_0x583c07[_0xd57311][_0x21ff('0x5a')];if(_0x583c07[_0xd57311][_0x21ff('0x5b')]==='ANSWERED'){_0x4d84e2[_0x21ff('0x14')][_0x21ff('0x27')]+=0x1;_0x4d84e2[_0x21ff('0x14')][_0x21ff('0x28')]+=_0x583c07[_0xd57311][_0x21ff('0x5a')]-_0x583c07[_0xd57311][_0x21ff('0x5c')]||0x0;_0x4d84e2[_0x21ff('0x14')]['sumBillable']+=_0x583c07[_0xd57311][_0x21ff('0x5c')];}}}return _0x4d84e2[_0x21ff('0x14')];};};Realtime['prototype'][_0x21ff('0x5d')]=function(){var _0x4d3483=this;return function(_0x3f6620){if(_0x3f6620){freeIsNotKey(_0x3f6620,_0x4d3483[_0x21ff('0x5e')],'name');for(var _0x96e24e=0x0,_0x456987={};_0x96e24e<_0x3f6620['length'];_0x96e24e+=0x1){_0x456987=_0x3f6620[_0x96e24e];if(_['isUndefined'](_0x4d3483[_0x21ff('0x5e')][_0x456987[_0x21ff('0x25')]])){_0x4d3483['campaigns'][_0x456987[_0x21ff('0x25')]]=new Campaign(_0x456987);}else{_0x4d3483[_0x21ff('0x3a')](_0x4d3483['campaigns'][_0x456987[_0x21ff('0x25')]],_0x456987);_0x4d3483['campaigns'][_0x456987['name']][_0x21ff('0x5f')]=_0x456987[_0x21ff('0x60')]?_0x456987[_0x21ff('0x60')]['name']:undefined;}}}return _0x4d3483[_0x21ff('0x5e')];};};Realtime['prototype'][_0x21ff('0x61')]=function(){var _0x370eb3=this;return function(_0x4b9084){if(_0x4b9084){freeIsNotKey(_0x4b9084,_0x370eb3[_0x21ff('0x15')],'id');for(var _0x596741=0x0,_0x2515cd={};_0x596741<_0x4b9084[_0x21ff('0x3f')];_0x596741+=0x1){_0x2515cd=_0x4b9084[_0x596741];if(_[_0x21ff('0x3c')](_0x370eb3[_0x21ff('0x15')][_0x2515cd['id']])){_0x370eb3['voiceExtensions'][_0x2515cd['id']]=new VoiceExtension(_0x2515cd);}else{_0x370eb3[_0x21ff('0x3a')](_0x370eb3['voiceExtensions'][_0x2515cd['id']],_0x2515cd);}}}return _0x370eb3[_0x21ff('0x15')];};};Realtime[_0x21ff('0x39')][_0x21ff('0x62')]=function(){var _0x165c23=this;return function(_0x3f323a){clearCampaigns(_0x165c23[_0x21ff('0x5e')]);for(var _0x369d98=0x0;_0x369d98<_0x3f323a[_0x21ff('0x3f')];_0x369d98+=0x1){_['merge'](_0x165c23['campaigns'][_0x3f323a[_0x369d98][_0x21ff('0x25')]],_0x3f323a[_0x369d98]);}return _0x165c23[_0x21ff('0x5e')];};};Realtime[_0x21ff('0x39')]['initFaxAccounts']=function(){var _0x5366c1=this;return function(_0x12f196){if(_0x12f196){freeIsNotKey(_0x12f196,_0x5366c1[_0x21ff('0x63')],'id');for(var _0x4db247=0x0,_0x43f44f={},_0x52ce04={};_0x4db247<_0x12f196[_0x21ff('0x3f')];_0x4db247+=0x1){_0x43f44f=_0x12f196[_0x4db247];if(_[_0x21ff('0x3c')](_0x5366c1['faxAccounts'][_0x43f44f['id']])){_0x5366c1[_0x21ff('0x63')][_0x43f44f['id']]=new FaxAccount(_0x43f44f);}else{_0x5366c1[_0x21ff('0x3a')](_0x5366c1[_0x21ff('0x63')][_0x43f44f['id']],_0x43f44f);}}}return _0x5366c1[_0x21ff('0x63')];};};module[_0x21ff('0x64')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 1748991..dc7faeb 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 _0x4572=['lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','type','dialer','lastapplication','lastdata','queue','context','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','callerid','calleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','createdAt','exten','connectedlinename','membername','isArray','forEach','substring','indexOf','lastIndexOf','voiceDialReport','exports','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','voiceQueueReport','length','connectedlinenum','assigned'];(function(_0x17e474,_0x4181ac){var _0x2b4eba=function(_0x3fd012){while(--_0x3fd012){_0x17e474['push'](_0x17e474['shift']());}};_0x2b4eba(++_0x4181ac);}(_0x4572,0x1cc));var _0x2457=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4572[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var config=require(_0x2457('0x0'));var ami=require(_0x2457('0x1'));var RpcVoiceAgentReport=require(_0x2457('0x2'));var RpcVoiceCallReport=require(_0x2457('0x3'));var RpcVoiceDialReport=require(_0x2457('0x4'));var RpcMemberReport=require(_0x2457('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x2457('0x6'));var RpcVoiceTransferReport=require(_0x2457('0x7'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x2457('0x8'));var VoiceAgentReport=require(_0x2457('0x9'));var VoiceDialReport=require(_0x2457('0xa'));var UserReport=require(_0x2457('0xb'));function Report(_0x18ace4){this[_0x2457('0xc')]=_0x18ace4;this[_0x2457('0xd')]=_0x18ace4[_0x2457('0xd')];this[_0x2457('0xe')]=_0x18ace4[_0x2457('0xe')];}Report[_0x2457('0xf')][_0x2457('0x10')]=function(_0x254888){var _0x5b4875=new VoiceQueueReport(this['realtime']);var _0x17cd6f=new VoiceAgentReport(this['realtime']);var _0x15ae34=new VoiceDialReport(this[_0x2457('0xc')]);var _0x17a217=new VoiceCallReport(this[_0x2457('0xc')]);var _0x5f01ac=new UserReport(this['realtime']);if(config[_0x2457('0x11')]&&config[_0x2457('0x11')]['disabled']){ami['on'](_0x2457('0x12'),this['voiceQueueReport'][_0x2457('0x13')](this));ami['on'](_0x2457('0x14'),this[_0x2457('0x15')][_0x2457('0x13')](this));ami['on'](_0x2457('0x16'),this['voiceAgentReport']['bind'](this));ami['on'](_0x2457('0x17'),this['voiceDialReport'][_0x2457('0x13')](this));ami['on'](_0x2457('0x18'),this[_0x2457('0x19')][_0x2457('0x13')](this));ami['on']('attendedtransfer',this[_0x2457('0x1a')][_0x2457('0x13')](this));}};Report['prototype'][_0x2457('0x1b')]=function(_0x591f98){var _0x28e765;_0x28e765=_[_0x2457('0x1c')](this['agents'],function(_0x355e3e){return _0x355e3e[_0x2457('0x1d')]==_0x591f98||_0x355e3e[_0x2457('0x1e')]==_0x591f98;});if(_[_0x2457('0x1f')](_0x28e765)){var _0x2fc465=_[_0x2457('0x1c')](this[_0x2457('0xe')],function(_0x55b85d){return _0x55b85d['accountcode']==_0x591f98||_0x55b85d[_0x2457('0x1e')]==_0x591f98;});if(_0x2fc465){_0x28e765=_['find'](this['agents'],function(_0x1626af){return _0x1626af[_0x2457('0x20')]==util['format'](_0x2457('0x21'),_0x2fc465[_0x2457('0x1e')]);});}}return _0x28e765;};Report[_0x2457('0xf')][_0x2457('0x22')]=function(_0x287981){for(var _0x540fe5=0x0;_0x540fe5<_0x287981[_0x2457('0x23')];_0x540fe5+=0x1){var _0x525b7e=this['findAgent'](_0x287981[_0x540fe5][_0x2457('0x24')]);if(_0x525b7e){_0x287981[_0x540fe5][_0x2457('0x1d')]=_0x525b7e[_0x2457('0x1d')];_0x287981[_0x540fe5][_0x2457('0x25')]=!![];_0x287981[_0x540fe5][_0x2457('0x26')]=_0x525b7e[_0x2457('0x1e')];_0x287981[_0x540fe5][_0x2457('0x20')]=_[_0x2457('0x1f')](_0x525b7e[_0x2457('0x20')])?util[_0x2457('0x27')]('SIP/%s',_0x525b7e['name']):_0x525b7e['interface'];if(_0x287981[_0x540fe5][_0x2457('0x28')]){_0x287981[_0x540fe5][_0x2457('0x29')]=moment()['format'](_0x2457('0x2a'));}if(_0x287981[_0x540fe5][_0x2457('0x2b')]){_0x287981[_0x540fe5][_0x2457('0x2c')]=moment()[_0x2457('0x27')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x287981[_0x540fe5]);}RpcVoiceQueueReport[_0x2457('0x2d')](_0x287981[_0x540fe5]);}};function extractCalleridNumber(_0x3d7c74){var _0x3e3642=_0x3d7c74[_0x2457('0x2e')](/<(.*?)>/);return _0x3e3642?_0x3e3642[0x1]:_0x3d7c74;}Report[_0x2457('0xf')][_0x2457('0x15')]=function(_0x6a7372){_0x6a7372[_0x2457('0x2f')]=_0x6a7372[_0x2457('0x2f')]||_0x6a7372['exten'];if(_0x6a7372[_0x2457('0x30')]==_0x2457('0x31')){_0x6a7372[_0x2457('0x32')]='queue';_0x6a7372[_0x2457('0x33')]=_0x6a7372[_0x2457('0x34')];if(_0x6a7372[_0x2457('0x35')]=='from-voip-provider'){_0x6a7372[_0x2457('0x1d')]='';_0x6a7372[_0x2457('0x2f')]=extractCalleridNumber(_0x6a7372['callerid']);}else if(_0x6a7372[_0x2457('0x35')]==_0x2457('0x36')){if(_0x6a7372['destination']==_0x2457('0x37')){_0x6a7372[_0x2457('0x2f')]=extractCalleridNumber(_0x6a7372[_0x2457('0x38')]);_0x6a7372['calleridnum']=_0x6a7372[_0x2457('0x39')];_0x6a7372[_0x2457('0x3a')]=[_0x6a7372[_0x2457('0x3b')],_0x6a7372[_0x2457('0x3b')]=_0x6a7372[_0x2457('0x3a')]][0x0];_0x6a7372[_0x2457('0x3c')]=_0x6a7372['calleridpreview'];}else{_0x6a7372[_0x2457('0x2f')]=_0x6a7372[_0x2457('0x3d')];_0x6a7372[_0x2457('0x3d')]=_0x6a7372[_0x2457('0x39')];if(_0x6a7372[_0x2457('0x3e')]==_0x2457('0x3f')){_0x6a7372[_0x2457('0x1d')]=_0x6a7372[_0x2457('0x24')];}else{_0x6a7372[_0x2457('0x1d')]='';}}}}else{_0x6a7372[_0x2457('0x3c')]=util['format'](_0x2457('0x40'),_0x6a7372[_0x2457('0x41')],_0x6a7372['calleridnum']);}if(RpcVoiceTransferReport[_0x2457('0x42')][_0x6a7372[_0x2457('0x43')]]){var _0x42cb11=RpcVoiceTransferReport[_0x2457('0x42')][_0x6a7372['linkedid']];_0x42cb11[_0x2457('0x44')]=_0x6a7372[_0x2457('0x45')];RpcVoiceTransferReport['blindTransfer'](_0x42cb11);delete RpcVoiceTransferReport[_0x2457('0x42')][_0x6a7372[_0x2457('0x43')]];}RpcVoiceCallReport[_0x2457('0x2d')](_0x6a7372);if(_0x6a7372[_0x2457('0x46')]){for(var _0x373b85=0x0;_0x373b85<_0x6a7372[_0x2457('0x47')]['length'];_0x373b85+=0x1){_0x6a7372['monitorFilename']=_0x6a7372[_0x2457('0x47')][_0x373b85]['filename'];_0x6a7372[_0x2457('0x48')]=_0x6a7372[_0x2457('0x47')][_0x373b85][_0x2457('0x48')];if(_0x6a7372[_0x2457('0x49')]=='xcally-motion-preview'){_0x6a7372['calleridnum']=_0x6a7372['connectedlinenum'];_0x6a7372[_0x2457('0x41')]=_0x6a7372[_0x2457('0x4a')];_0x6a7372[_0x2457('0x24')]=_0x6a7372[_0x2457('0x1d')];_0x6a7372[_0x2457('0x4a')]=_0x6a7372[_0x2457('0x4b')];_0x6a7372[_0x2457('0x49')]=_0x6a7372[_0x2457('0x39')];}else if(_0x6a7372[_0x2457('0x49')]=='xcally-motion-dialer'){_0x6a7372[_0x2457('0x3d')]=_0x6a7372[_0x2457('0x2f')];_0x6a7372['exten']=_0x6a7372[_0x2457('0x39')];}RpcVoiceRecording[_0x2457('0x2d')](_0x6a7372);}}};Report[_0x2457('0xf')]['voiceAgentReport']=function(_0x474ca2){if(_[_0x2457('0x4c')](_0x474ca2)){_0x474ca2[_0x2457('0x4d')](function(_0x56c626){RpcVoiceAgentReport['create'](_0x56c626);});}else{RpcVoiceAgentReport[_0x2457('0x2d')](_0x474ca2);}};Report[_0x2457('0xf')]['voiceDialReport']=function(_0x2f4c1f){RpcVoiceDialReport[_0x2457('0x2d')](_0x2f4c1f);var _0x155b5c;var _0x14d006;var _0x247354=_0x2f4c1f[_0x2457('0x3b')];if(_['startsWith'](_0x247354,'Local')){_0x14d006=_0x247354[_0x2457('0x4e')](_0x247354[_0x2457('0x4f')]('/')+0x1,_0x247354[_0x2457('0x4f')]('@'));_0x155b5c=_['find'](this[_0x2457('0xd')],function(_0x203367){return _0x203367['mobile']==_0x14d006||_0x203367['phone']==_0x14d006||_0x203367[_0x2457('0x1d')]==_0x14d006;});}else{_0x14d006=_0x247354[_0x2457('0x4e')](_0x247354[_0x2457('0x4f')]('/')+0x1,_0x247354[_0x2457('0x50')]('-'));_0x155b5c=this[_0x2457('0x1b')](_0x14d006);}if(_0x155b5c){_0x2f4c1f['interface']=_['isNil'](_0x155b5c['interface'])?util[_0x2457('0x27')](_0x2457('0x21'),_0x155b5c[_0x2457('0x1e')]):_0x155b5c[_0x2457('0x20')];_0x2f4c1f[_0x2457('0x4b')]=_0x155b5c['name'];_0x2f4c1f['accountcode']=_0x155b5c[_0x2457('0x1d')];RpcMemberReport[_0x2457('0x51')](_0x2f4c1f);}};Report[_0x2457('0xf')][_0x2457('0x19')]=function(_0x29db9a){RpcVoiceTransferReport[_0x2457('0x42')][_0x29db9a['transfererlinkedid']]=_0x29db9a;};Report[_0x2457('0xf')][_0x2457('0x1a')]=function(_0x2277ef){RpcVoiceTransferReport[_0x2457('0x1a')](_0x2277ef);};module[_0x2457('0x52')]=Report; \ No newline at end of file +var _0x3fc4=['monitorFilename','monitors','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','lastIndexOf','voiceDialReport','transfererlinkedid','exports','lodash','util','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','isNil','accountcode','interface','format','length','connectedlinenum','assigned','lastAssignedTo','name','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','voiceQueueReport','create','match','destination','dialer','lastapplication','queue','lastdata','context','from-sip','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid'];(function(_0x2bcddb,_0x3eaf37){var _0x12a9e8=function(_0xeeb678){while(--_0xeeb678){_0x2bcddb['push'](_0x2bcddb['shift']());}};_0x12a9e8(++_0x3eaf37);}(_0x3fc4,0x6a));var _0x43fc=function(_0x4285e0,_0x6457e5){_0x4285e0=_0x4285e0-0x0;var _0xd455a5=_0x3fc4[_0x4285e0];return _0xd455a5;};'use strict';var _=require(_0x43fc('0x0'));var moment=require('moment');var util=require(_0x43fc('0x1'));var config=require('../../../config/environment');var ami=require(_0x43fc('0x2'));var RpcVoiceAgentReport=require(_0x43fc('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x43fc('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x43fc('0x5'));var RpcVoiceRecording=require(_0x43fc('0x6'));var RpcVoiceTransferReport=require(_0x43fc('0x7'));var VoiceQueueReport=require(_0x43fc('0x8'));var VoiceCallReport=require(_0x43fc('0x9'));var VoiceAgentReport=require(_0x43fc('0xa'));var VoiceDialReport=require(_0x43fc('0xb'));var UserReport=require(_0x43fc('0xc'));function Report(_0x2678cf){this['realtime']=_0x2678cf;this[_0x43fc('0xd')]=_0x2678cf['agents'];this[_0x43fc('0xe')]=_0x2678cf[_0x43fc('0xe')];}Report[_0x43fc('0xf')][_0x43fc('0x10')]=function(_0x7aa73){var _0x1904ed=new VoiceQueueReport(this[_0x43fc('0x11')]);var _0x4df892=new VoiceAgentReport(this[_0x43fc('0x11')]);var _0x81b2c5=new VoiceDialReport(this[_0x43fc('0x11')]);var _0x40a64d=new VoiceCallReport(this['realtime']);var _0x31fad6=new UserReport(this['realtime']);if(config[_0x43fc('0x12')]&&config[_0x43fc('0x12')]['disabled']){ami['on'](_0x43fc('0x13'),this['voiceQueueReport'][_0x43fc('0x14')](this));ami['on'](_0x43fc('0x15'),this[_0x43fc('0x16')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x43fc('0x17')][_0x43fc('0x14')](this));ami['on'](_0x43fc('0x18'),this['voiceDialReport']['bind'](this));ami['on']('blindtransfer',this[_0x43fc('0x19')][_0x43fc('0x14')](this));ami['on'](_0x43fc('0x1a'),this[_0x43fc('0x1b')][_0x43fc('0x14')](this));}};Report['prototype'][_0x43fc('0x1c')]=function(_0x4339f6){var _0x582db0;_0x582db0=_[_0x43fc('0x1d')](this[_0x43fc('0xd')],function(_0x264b70){return _0x264b70['accountcode']==_0x4339f6||_0x264b70['name']==_0x4339f6;});if(_[_0x43fc('0x1e')](_0x582db0)){var _0x481459=_[_0x43fc('0x1d')](this[_0x43fc('0xe')],function(_0x3a6318){return _0x3a6318[_0x43fc('0x1f')]==_0x4339f6||_0x3a6318['name']==_0x4339f6;});if(_0x481459){_0x582db0=_[_0x43fc('0x1d')](this[_0x43fc('0xd')],function(_0x3ab656){return _0x3ab656[_0x43fc('0x20')]==util[_0x43fc('0x21')]('SIP/%s',_0x481459['name']);});}}return _0x582db0;};Report[_0x43fc('0xf')]['voiceQueueReport']=function(_0xa7ddbb){for(var _0x25778d=0x0;_0x25778d<_0xa7ddbb[_0x43fc('0x22')];_0x25778d+=0x1){var _0x4e638a=this['findAgent'](_0xa7ddbb[_0x25778d][_0x43fc('0x23')]);if(_0x4e638a){_0xa7ddbb[_0x25778d][_0x43fc('0x1f')]=_0x4e638a['accountcode'];_0xa7ddbb[_0x25778d][_0x43fc('0x24')]=!![];_0xa7ddbb[_0x25778d][_0x43fc('0x25')]=_0x4e638a[_0x43fc('0x26')];_0xa7ddbb[_0x25778d]['interface']=_[_0x43fc('0x1e')](_0x4e638a['interface'])?util[_0x43fc('0x21')](_0x43fc('0x27'),_0x4e638a[_0x43fc('0x26')]):_0x4e638a['interface'];if(_0xa7ddbb[_0x25778d][_0x43fc('0x28')]){_0xa7ddbb[_0x25778d][_0x43fc('0x29')]=moment()[_0x43fc('0x21')](_0x43fc('0x2a'));}if(_0xa7ddbb[_0x25778d][_0x43fc('0x2b')]){_0xa7ddbb[_0x25778d][_0x43fc('0x2c')]=moment()[_0x43fc('0x21')](_0x43fc('0x2a'));}RpcMemberReport[_0x43fc('0x2d')](_0xa7ddbb[_0x25778d]);}RpcVoiceQueueReport[_0x43fc('0x2e')](_0xa7ddbb[_0x25778d]);}};function extractCalleridNumber(_0x539a08){var _0x3e1eee=_0x539a08[_0x43fc('0x2f')](/<(.*?)>/);return _0x3e1eee?_0x3e1eee[0x1]:_0x539a08;}Report[_0x43fc('0xf')]['voiceCallReport']=function(_0x4fdb69){_0x4fdb69[_0x43fc('0x30')]=_0x4fdb69['destination']||_0x4fdb69['exten'];if(_0x4fdb69['type']==_0x43fc('0x31')){_0x4fdb69[_0x43fc('0x32')]=_0x43fc('0x33');_0x4fdb69[_0x43fc('0x34')]=_0x4fdb69[_0x43fc('0x33')];if(_0x4fdb69[_0x43fc('0x35')]=='from-voip-provider'){_0x4fdb69[_0x43fc('0x1f')]='';_0x4fdb69[_0x43fc('0x30')]=extractCalleridNumber(_0x4fdb69['callerid']);}else if(_0x4fdb69[_0x43fc('0x35')]==_0x43fc('0x36')){if(_0x4fdb69[_0x43fc('0x30')]=='xcally-motion-preview'){_0x4fdb69[_0x43fc('0x30')]=extractCalleridNumber(_0x4fdb69['calleridpreview']);_0x4fdb69[_0x43fc('0x37')]=_0x4fdb69[_0x43fc('0x38')];_0x4fdb69[_0x43fc('0x39')]=[_0x4fdb69['channel'],_0x4fdb69[_0x43fc('0x3a')]=_0x4fdb69[_0x43fc('0x39')]][0x0];_0x4fdb69[_0x43fc('0x3b')]=_0x4fdb69['calleridpreview'];}else{_0x4fdb69[_0x43fc('0x30')]=_0x4fdb69[_0x43fc('0x37')];_0x4fdb69[_0x43fc('0x37')]=_0x4fdb69[_0x43fc('0x38')];if(_0x4fdb69[_0x43fc('0x3c')]==_0x43fc('0x3d')){_0x4fdb69[_0x43fc('0x1f')]=_0x4fdb69[_0x43fc('0x23')];}else{_0x4fdb69[_0x43fc('0x1f')]='';}}}}else{_0x4fdb69[_0x43fc('0x3b')]=util[_0x43fc('0x21')](_0x43fc('0x3e'),_0x4fdb69[_0x43fc('0x3f')],_0x4fdb69[_0x43fc('0x37')]);}if(RpcVoiceTransferReport[_0x43fc('0x40')][_0x4fdb69['linkedid']]){var _0xb39fb7=RpcVoiceTransferReport['transfers'][_0x4fdb69[_0x43fc('0x41')]];_0xb39fb7[_0x43fc('0x42')]=_0x4fdb69[_0x43fc('0x43')];RpcVoiceTransferReport[_0x43fc('0x19')](_0xb39fb7);delete RpcVoiceTransferReport[_0x43fc('0x40')][_0x4fdb69[_0x43fc('0x41')]];}RpcVoiceCallReport[_0x43fc('0x2e')](_0x4fdb69);if(_0x4fdb69['monitor']){for(var _0x13ba1e=0x0;_0x13ba1e<_0x4fdb69['monitors']['length'];_0x13ba1e+=0x1){_0x4fdb69[_0x43fc('0x44')]=_0x4fdb69[_0x43fc('0x45')][_0x13ba1e][_0x43fc('0x46')];_0x4fdb69[_0x43fc('0x47')]=_0x4fdb69[_0x43fc('0x45')][_0x13ba1e][_0x43fc('0x47')];if(_0x4fdb69[_0x43fc('0x48')]=='xcally-motion-preview'){_0x4fdb69[_0x43fc('0x37')]=_0x4fdb69[_0x43fc('0x23')];_0x4fdb69[_0x43fc('0x3f')]=_0x4fdb69[_0x43fc('0x49')];_0x4fdb69[_0x43fc('0x23')]=_0x4fdb69['accountcode'];_0x4fdb69[_0x43fc('0x49')]=_0x4fdb69[_0x43fc('0x4a')];_0x4fdb69['exten']=_0x4fdb69[_0x43fc('0x38')];}else if(_0x4fdb69[_0x43fc('0x48')]==_0x43fc('0x4b')){_0x4fdb69['calleridnum']=_0x4fdb69[_0x43fc('0x30')];_0x4fdb69['exten']=_0x4fdb69['originatecalleridnum'];}RpcVoiceRecording[_0x43fc('0x2e')](_0x4fdb69);}}};Report[_0x43fc('0xf')][_0x43fc('0x17')]=function(_0x339a3d){if(_[_0x43fc('0x4c')](_0x339a3d)){_0x339a3d[_0x43fc('0x4d')](function(_0x56fd1c){RpcVoiceAgentReport[_0x43fc('0x2e')](_0x56fd1c);});}else{RpcVoiceAgentReport[_0x43fc('0x2e')](_0x339a3d);}};Report[_0x43fc('0xf')]['voiceDialReport']=function(_0x4a9f07){RpcVoiceDialReport[_0x43fc('0x2e')](_0x4a9f07);var _0x4bab8d;var _0x3c323d;var _0x2ee7bc=_0x4a9f07['channel'];if(_[_0x43fc('0x4e')](_0x2ee7bc,_0x43fc('0x4f'))){_0x3c323d=_0x2ee7bc[_0x43fc('0x50')](_0x2ee7bc[_0x43fc('0x51')]('/')+0x1,_0x2ee7bc[_0x43fc('0x51')]('@'));_0x4bab8d=_[_0x43fc('0x1d')](this[_0x43fc('0xd')],function(_0x37433f){return _0x37433f[_0x43fc('0x52')]==_0x3c323d||_0x37433f['phone']==_0x3c323d||_0x37433f['accountcode']==_0x3c323d;});}else{_0x3c323d=_0x2ee7bc[_0x43fc('0x50')](_0x2ee7bc[_0x43fc('0x51')]('/')+0x1,_0x2ee7bc[_0x43fc('0x53')]('-'));_0x4bab8d=this[_0x43fc('0x1c')](_0x3c323d);}if(_0x4bab8d){_0x4a9f07[_0x43fc('0x20')]=_['isNil'](_0x4bab8d[_0x43fc('0x20')])?util[_0x43fc('0x21')](_0x43fc('0x27'),_0x4bab8d[_0x43fc('0x26')]):_0x4bab8d[_0x43fc('0x20')];_0x4a9f07['membername']=_0x4bab8d['name'];_0x4a9f07[_0x43fc('0x1f')]=_0x4bab8d[_0x43fc('0x1f')];RpcMemberReport[_0x43fc('0x54')](_0x4a9f07);}};Report[_0x43fc('0xf')]['blindTransfer']=function(_0x24b48c){RpcVoiceTransferReport[_0x43fc('0x40')][_0x24b48c[_0x43fc('0x55')]]=_0x24b48c;};Report[_0x43fc('0xf')][_0x43fc('0x1b')]=function(_0x5baa36){RpcVoiceTransferReport[_0x43fc('0x1b')](_0x5baa36);};module[_0x43fc('0x56')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 158dffd..bc56123 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 _0x5681=['local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','syncPeerStatus','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','catch','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','find','stateRegistry','merge','event','debug','format','trunk:%s','name','trunk:save','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device'];(function(_0x3011f4,_0x5a4bf6){var _0x140f8a=function(_0x2fb312){while(--_0x2fb312){_0x3011f4['push'](_0x3011f4['shift']());}};_0x140f8a(++_0x5a4bf6);}(_0x5681,0x1d5));var _0x1568=function(_0x993ec8,_0x415afa){_0x993ec8=_0x993ec8-0x0;var _0x5b554f=_0x5681[_0x993ec8];return _0x5b554f;};'use strict';var _=require(_0x1568('0x0'));var moment=require(_0x1568('0x1'));var util=require(_0x1568('0x2'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x1568('0x3'));var logger=require(_0x1568('0x4'))(_0x1568('0x5'));var ami=require(_0x1568('0x6'));config[_0x1568('0x7')]=_[_0x1568('0x8')](config[_0x1568('0x7')],{'host':_0x1568('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function UserReport(_0x5b1515){this[_0x1568('0xa')]=_0x5b1515[_0x1568('0xa')];this[_0x1568('0xb')]=_0x5b1515[_0x1568('0xb')];this[_0x1568('0xc')]=_0x5b1515[_0x1568('0xc')];ami['on']('registryentry',this[_0x1568('0xd')][_0x1568('0xe')](this));ami['on'](_0x1568('0xf'),this['syncRegistry'][_0x1568('0xe')](this));ami['on'](_0x1568('0x10'),this[_0x1568('0x11')][_0x1568('0xe')](this));ami['on'](_0x1568('0x12'),this['syncPeerStatus']['bind'](this));return this[_0x1568('0x13')]();}function showSipRegistrations(){Promise[_0x1568('0x14')]()[_0x1568('0x15')](ami[_0x1568('0x16')]())['catch'](function(_0x5186c9){logger[_0x1568('0x17')](_0x1568('0x18'),util[_0x1568('0x19')](_0x5186c9,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x1568('0x14')]()[_0x1568('0x15')](ami[_0x1568('0x1a')]())[_0x1568('0x1b')](function(_0x449b51){logger[_0x1568('0x17')]('[userReport][devicestatelist]',util['inspect'](_0x449b51,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x1568('0x14')]()[_0x1568('0x15')](ami['actionSipPeerStatus']())[_0x1568('0x1b')](function(_0x300abf){logger[_0x1568('0x17')](_0x1568('0x1c'),util['inspect'](_0x300abf,{'showHidden':![],'depth':null}));});}UserReport[_0x1568('0x1d')][_0x1568('0x13')]=function(){setInterval(function(){BPromise[_0x1568('0x14')]()['then'](showSipRegistrations())[_0x1568('0x15')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x1568('0x1e')]=function(_0x4874b1){return _0x4874b1!==null&&!_[_0x1568('0x1f')](_0x4874b1);};UserReport[_0x1568('0x1d')][_0x1568('0x20')]=function(_0x63864,_0x5e4d0e,_0x191e13){io['to'](_0x63864)[_0x1568('0x20')](_0x5e4d0e,_0x191e13);};UserReport['prototype'][_0x1568('0xd')]=function(_0x104002){try{if(this[_0x1568('0x1e')](_0x104002)){logger['info'](_0x1568('0x21'),_0x104002[_0x1568('0x22')],_0x104002[_0x1568('0x23')]);logger['debug'](_0x1568('0x24'),util['inspect'](_0x104002,{'showHidden':![],'depth':null}));var _0x1c6cb6=_[_0x1568('0x25')](this[_0x1568('0xa')],{'defaultuser':_0x104002['username']});if(_0x1c6cb6){_0x104002[_0x1568('0x26')]=_0x104002[_0x1568('0x23')];_[_0x1568('0x27')](_0x1c6cb6,_['omit'](_0x104002,[_0x1568('0x28'),'actionid',_0x1568('0x22'),'state']));logger[_0x1568('0x29')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x1568('0x19')](_0x1c6cb6,{'showHidden':![],'depth':null}));this[_0x1568('0x20')](util[_0x1568('0x2a')](_0x1568('0x2b'),_0x1c6cb6[_0x1568('0x2c')]),_0x1568('0x2d'),_0x1c6cb6);}}}catch(_0x4e5ee3){logger[_0x1568('0x17')](_0x1568('0x24'),util[_0x1568('0x19')](_0x4e5ee3,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0x212a86){try{if(this[_0x1568('0x1e')](_0x212a86)){logger[_0x1568('0x2e')](_0x1568('0x2f'),_0x212a86[_0x1568('0x30')],_0x212a86[_0x1568('0x23')]);logger['debug']('[userReport][devicestatechange]',util['inspect'](_0x212a86,{'showHidden':![],'depth':null}));if(this[_0x1568('0xb')][_0x212a86[_0x1568('0x30')]]){if(!this[_0x1568('0xb')][_0x212a86[_0x1568('0x30')]][_0x1568('0x31')]||_0x212a86[_0x1568('0x23')][_0x1568('0x32')]()==_0x1568('0x33')){this['agents'][_0x212a86['device']][_0x1568('0x31')]=![];if(this[_0x1568('0xb')][_0x212a86['device']][_0x1568('0x23')]!==_0x212a86[_0x1568('0x23')][_0x1568('0x32')]()){this['agents'][_0x212a86['device']][_0x1568('0x34')]=_[_0x1568('0x35')](moment()[_0x1568('0x2a')]('x'));}this[_0x1568('0xb')][_0x212a86[_0x1568('0x30')]][_0x1568('0x23')]=_0x212a86[_0x1568('0x23')][_0x1568('0x32')]();this[_0x1568('0xb')][_0x212a86[_0x1568('0x30')]][_0x1568('0x36')](_0x212a86);}}else if(this[_0x1568('0xc')][_0x212a86[_0x1568('0x30')]]){if(this['telephones'][_0x212a86[_0x1568('0x30')]][_0x1568('0x23')]!==_0x212a86[_0x1568('0x23')][_0x1568('0x32')]()){this[_0x1568('0xc')][_0x212a86[_0x1568('0x30')]][_0x1568('0x34')]=_[_0x1568('0x35')](moment()[_0x1568('0x2a')]('x'));}this[_0x1568('0xc')][_0x212a86[_0x1568('0x30')]][_0x1568('0x23')]=_0x212a86[_0x1568('0x23')][_0x1568('0x32')]();logger[_0x1568('0x29')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x1568('0xc')][_0x212a86['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0x1568('0x2a')]('telephone:%s',this['telephones'][_0x212a86[_0x1568('0x30')]][_0x1568('0x2c')]),_0x1568('0x37'),this['telephones'][_0x212a86[_0x1568('0x30')]]);}else if(this['trunks'][_0x212a86['device']]){if(this[_0x1568('0xa')][_0x212a86[_0x1568('0x30')]][_0x1568('0x23')]!==_0x212a86['state'][_0x1568('0x32')]()){this[_0x1568('0xa')][_0x212a86[_0x1568('0x30')]][_0x1568('0x34')]=_[_0x1568('0x35')](moment()[_0x1568('0x2a')]('x'));}this['trunks'][_0x212a86['device']]['state']=_0x212a86[_0x1568('0x23')][_0x1568('0x32')]();logger[_0x1568('0x29')](_0x1568('0x38'),util[_0x1568('0x19')](this['trunks'][_0x212a86[_0x1568('0x30')]],{'showHidden':![],'depth':null}));this[_0x1568('0x20')](util[_0x1568('0x2a')]('trunk:%s',this[_0x1568('0xa')][_0x212a86[_0x1568('0x30')]]['name']),'trunk:save',this[_0x1568('0xa')][_0x212a86['device']]);}else if(_[_0x1568('0x39')](_0x212a86[_0x1568('0x30')],_0x1568('0x3a'))){var _0x377304=_0x212a86[_0x1568('0x30')];var _0x367537=_0x377304[_0x1568('0x3b')](_0x377304[_0x1568('0x3c')]('/')+0x1,_0x377304[_0x1568('0x3c')]('@'));var _0x130052=_[_0x1568('0x25')](this[_0x1568('0xb')],function(_0x3010e0){return _0x3010e0[_0x1568('0x3d')]==_0x367537||_0x3010e0[_0x1568('0x3e')]==_0x367537||_0x3010e0[_0x1568('0x3f')]==_0x367537;});if(_0x130052){if(_0x130052[_0x1568('0x23')]!==_0x212a86[_0x1568('0x23')][_0x1568('0x32')]()){_0x130052[_0x1568('0x34')]=_[_0x1568('0x35')](moment()['format']('x'));}_0x130052['state']=_0x212a86[_0x1568('0x23')][_0x1568('0x32')]();_0x130052[_0x1568('0x31')]=!![];_0x130052[_0x1568('0x36')](_0x212a86);}}}}catch(_0x4e20e2){logger[_0x1568('0x17')](_0x1568('0x40'),util[_0x1568('0x19')](_0x4e20e2,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x1568('0x41')]=function(_0x1da4a5){try{if(this[_0x1568('0x1e')](_0x1da4a5)&&this[_0x1568('0x1e')](_0x1da4a5['peerstatus'])){logger['info']('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x1da4a5[_0x1568('0x42')],_0x1da4a5[_0x1568('0x43')],_0x1da4a5['peerstatus']);logger[_0x1568('0x29')]('[userReport][peerstatus]',util[_0x1568('0x19')](_0x1da4a5,{'showHidden':![],'depth':null}));if(this[_0x1568('0xb')][_0x1da4a5[_0x1568('0x42')]]){if(!this[_0x1568('0xb')][_0x1da4a5[_0x1568('0x42')]][_0x1568('0x31')]||_0x1da4a5[_0x1568('0x12')]['toLowerCase']()==_0x1568('0x44')){this[_0x1568('0xb')][_0x1da4a5['peer']]['local']=![];this[_0x1568('0xb')][_0x1da4a5[_0x1568('0x42')]][_0x1568('0x45')]=_0x1da4a5[_0x1568('0x12')][_0x1568('0x32')]();this[_0x1568('0xb')][_0x1da4a5[_0x1568('0x42')]][_0x1568('0x43')]=_0x1da4a5[_0x1568('0x43')];this[_0x1568('0xb')][_0x1da4a5[_0x1568('0x42')]][_0x1568('0x36')](_0x1da4a5);}}else if(this[_0x1568('0xc')][_0x1da4a5['peer']]){this['telephones'][_0x1da4a5[_0x1568('0x42')]][_0x1568('0x45')]=_0x1da4a5[_0x1568('0x12')][_0x1568('0x32')]();this['telephones'][_0x1da4a5[_0x1568('0x42')]][_0x1568('0x43')]=_0x1da4a5[_0x1568('0x43')];logger[_0x1568('0x29')](_0x1568('0x46'),util['inspect'](this['telephones'][_0x1da4a5[_0x1568('0x42')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x1568('0x2a')](_0x1568('0x47'),this[_0x1568('0xc')][_0x1da4a5[_0x1568('0x42')]][_0x1568('0x2c')]),_0x1568('0x37'),this[_0x1568('0xc')][_0x1da4a5[_0x1568('0x42')]]);}else if(this[_0x1568('0xa')][_0x1da4a5['peer']]){this[_0x1568('0xa')][_0x1da4a5[_0x1568('0x42')]][_0x1568('0x45')]=_0x1da4a5['peerstatus'][_0x1568('0x32')]();this[_0x1568('0xa')][_0x1da4a5['peer']][_0x1568('0x43')]=_0x1da4a5[_0x1568('0x43')];logger[_0x1568('0x29')](_0x1568('0x48'),util[_0x1568('0x19')](this[_0x1568('0xa')][_0x1da4a5[_0x1568('0x42')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x1568('0x2a')](_0x1568('0x2b'),this[_0x1568('0xa')][_0x1da4a5['peer']]['name']),_0x1568('0x2d'),this[_0x1568('0xa')][_0x1da4a5[_0x1568('0x42')]]);}}}catch(_0x5bee49){logger[_0x1568('0x17')](_0x1568('0x49'),util['inspect'](_0x5bee49,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x26a0=['status','name','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','catch','error','[userReport][sipshowregistry]','inspect','then','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','inuse','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','Local','substring','indexOf','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]'];(function(_0x16d4b6,_0x527555){var _0xeeaf29=function(_0x272d27){while(--_0x272d27){_0x16d4b6['push'](_0x16d4b6['shift']());}};_0xeeaf29(++_0x527555);}(_0x26a0,0x1d8));var _0x026a=function(_0x2e11f4,_0x48eb5c){_0x2e11f4=_0x2e11f4-0x0;var _0x489000=_0x26a0[_0x2e11f4];return _0x489000;};'use strict';var _=require('lodash');var moment=require(_0x026a('0x0'));var util=require(_0x026a('0x1'));var Redis=require('ioredis');var BPromise=require(_0x026a('0x2'));var config=require(_0x026a('0x3'));var logger=require(_0x026a('0x4'))(_0x026a('0x5'));var ami=require(_0x026a('0x6'));config[_0x026a('0x7')]=_[_0x026a('0x8')](config[_0x026a('0x7')],{'host':_0x026a('0x9'),'port':0x18eb});var io=require(_0x026a('0xa'))(new Redis(config[_0x026a('0x7')]));function UserReport(_0x202fde){this[_0x026a('0xb')]=_0x202fde[_0x026a('0xb')];this['agents']=_0x202fde[_0x026a('0xc')];this['telephones']=_0x202fde[_0x026a('0xd')];ami['on'](_0x026a('0xe'),this['syncRegistry']['bind'](this));ami['on']('registry',this[_0x026a('0xf')][_0x026a('0x10')](this));ami['on'](_0x026a('0x11'),this[_0x026a('0x12')][_0x026a('0x10')](this));ami['on'](_0x026a('0x13'),this[_0x026a('0x14')]['bind'](this));return this[_0x026a('0x15')]();}function showSipRegistrations(){Promise[_0x026a('0x16')]()['then'](ami['actionSipShowRegistry']())[_0x026a('0x17')](function(_0x3a8faa){logger[_0x026a('0x18')](_0x026a('0x19'),util[_0x026a('0x1a')](_0x3a8faa,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x026a('0x16')]()[_0x026a('0x1b')](ami[_0x026a('0x1c')]())[_0x026a('0x17')](function(_0x5451fc){logger['error'](_0x026a('0x1d'),util[_0x026a('0x1a')](_0x5451fc,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x026a('0x16')]()[_0x026a('0x1b')](ami[_0x026a('0x1e')]())['catch'](function(_0xb7cb4c){logger['error'](_0x026a('0x1f'),util['inspect'](_0xb7cb4c,{'showHidden':![],'depth':null}));});}UserReport[_0x026a('0x20')][_0x026a('0x15')]=function(){setInterval(function(){BPromise[_0x026a('0x16')]()['then'](showSipRegistrations())[_0x026a('0x1b')](listDeviceStates())[_0x026a('0x1b')](showPeersStatus());},0x32c8);};UserReport[_0x026a('0x20')][_0x026a('0x21')]=function(_0x1754ba){return _0x1754ba!==null&&!_['isUndefined'](_0x1754ba);};UserReport['prototype'][_0x026a('0x22')]=function(_0x36d439,_0x455ba0,_0x2bd0f4){io['to'](_0x36d439)[_0x026a('0x22')](_0x455ba0,_0x2bd0f4);};UserReport['prototype']['syncRegistry']=function(_0x313ba7){try{if(this[_0x026a('0x21')](_0x313ba7)){logger[_0x026a('0x23')](_0x026a('0x24'),_0x313ba7[_0x026a('0x25')],_0x313ba7[_0x026a('0x26')]);logger['debug'](_0x026a('0x27'),util[_0x026a('0x1a')](_0x313ba7,{'showHidden':![],'depth':null}));var _0x437d92=_[_0x026a('0x28')](this[_0x026a('0xb')],{'defaultuser':_0x313ba7['username']});if(_0x437d92){_0x313ba7[_0x026a('0x29')]=_0x313ba7[_0x026a('0x26')];_[_0x026a('0x2a')](_0x437d92,_[_0x026a('0x2b')](_0x313ba7,[_0x026a('0x2c'),_0x026a('0x2d'),_0x026a('0x25'),_0x026a('0x26')]));logger[_0x026a('0x2e')](_0x026a('0x2f'),util[_0x026a('0x1a')](_0x437d92,{'showHidden':![],'depth':null}));this[_0x026a('0x22')](util[_0x026a('0x30')](_0x026a('0x31'),_0x437d92['name']),'trunk:save',_0x437d92);}}}catch(_0xe8ee2c){logger[_0x026a('0x18')]('[userReport][registry]',util[_0x026a('0x1a')](_0xe8ee2c,{'showHidden':![],'depth':null}));}};UserReport[_0x026a('0x20')][_0x026a('0x12')]=function(_0x1e18bc){try{if(this[_0x026a('0x21')](_0x1e18bc)){logger[_0x026a('0x23')](_0x026a('0x32'),_0x1e18bc[_0x026a('0x33')],_0x1e18bc['state']);logger[_0x026a('0x2e')]('[userReport][devicestatechange]',util[_0x026a('0x1a')](_0x1e18bc,{'showHidden':![],'depth':null}));if(this[_0x026a('0xc')][_0x1e18bc['device']]){if(!this[_0x026a('0xc')][_0x1e18bc[_0x026a('0x33')]]['local']||_0x1e18bc[_0x026a('0x26')]['toLowerCase']()==_0x026a('0x34')){this[_0x026a('0xc')][_0x1e18bc[_0x026a('0x33')]][_0x026a('0x35')]=![];if(this[_0x026a('0xc')][_0x1e18bc[_0x026a('0x33')]][_0x026a('0x26')]!==_0x1e18bc['state'][_0x026a('0x36')]()){this[_0x026a('0xc')][_0x1e18bc[_0x026a('0x33')]][_0x026a('0x37')]=_[_0x026a('0x38')](moment()[_0x026a('0x30')]('x'));}this[_0x026a('0xc')][_0x1e18bc['device']]['state']=_0x1e18bc[_0x026a('0x26')][_0x026a('0x36')]();this['agents'][_0x1e18bc[_0x026a('0x33')]][_0x026a('0x39')](_0x1e18bc);}}else if(this[_0x026a('0xd')][_0x1e18bc[_0x026a('0x33')]]){if(this[_0x026a('0xd')][_0x1e18bc['device']]['state']!==_0x1e18bc[_0x026a('0x26')][_0x026a('0x36')]()){this[_0x026a('0xd')][_0x1e18bc['device']][_0x026a('0x37')]=_['toNumber'](moment()[_0x026a('0x30')]('x'));}this[_0x026a('0xd')][_0x1e18bc[_0x026a('0x33')]][_0x026a('0x26')]=_0x1e18bc[_0x026a('0x26')]['toLowerCase']();logger[_0x026a('0x2e')](_0x026a('0x3a'),util[_0x026a('0x1a')](this[_0x026a('0xd')][_0x1e18bc[_0x026a('0x33')]],{'showHidden':![],'depth':null}));this[_0x026a('0x22')](util['format'](_0x026a('0x3b'),this['telephones'][_0x1e18bc[_0x026a('0x33')]]['name']),_0x026a('0x3c'),this['telephones'][_0x1e18bc['device']]);}else if(this['trunks'][_0x1e18bc[_0x026a('0x33')]]){if(this[_0x026a('0xb')][_0x1e18bc[_0x026a('0x33')]][_0x026a('0x26')]!==_0x1e18bc[_0x026a('0x26')][_0x026a('0x36')]()){this[_0x026a('0xb')][_0x1e18bc['device']][_0x026a('0x37')]=_[_0x026a('0x38')](moment()[_0x026a('0x30')]('x'));}this[_0x026a('0xb')][_0x1e18bc[_0x026a('0x33')]][_0x026a('0x26')]=_0x1e18bc[_0x026a('0x26')]['toLowerCase']();logger[_0x026a('0x2e')](_0x026a('0x3d'),util[_0x026a('0x1a')](this[_0x026a('0xb')][_0x1e18bc['device']],{'showHidden':![],'depth':null}));this[_0x026a('0x22')](util[_0x026a('0x30')](_0x026a('0x31'),this[_0x026a('0xb')][_0x1e18bc[_0x026a('0x33')]]['name']),_0x026a('0x3e'),this[_0x026a('0xb')][_0x1e18bc[_0x026a('0x33')]]);}else if(_[_0x026a('0x3f')](_0x1e18bc[_0x026a('0x33')],_0x026a('0x40'))){var _0x457314=_0x1e18bc['device'];var _0x1a84b6=_0x457314[_0x026a('0x41')](_0x457314[_0x026a('0x42')]('/')+0x1,_0x457314['indexOf']('@'));var _0x268c6a=_[_0x026a('0x28')](this[_0x026a('0xc')],function(_0x268835){return _0x268835[_0x026a('0x43')]==_0x1a84b6||_0x268835[_0x026a('0x44')]==_0x1a84b6||_0x268835[_0x026a('0x45')]==_0x1a84b6;});if(_0x268c6a){if(_0x268c6a[_0x026a('0x26')]!==_0x1e18bc['state'][_0x026a('0x36')]()){_0x268c6a[_0x026a('0x37')]=_[_0x026a('0x38')](moment()[_0x026a('0x30')]('x'));}_0x268c6a[_0x026a('0x26')]=_0x1e18bc[_0x026a('0x26')][_0x026a('0x36')]();_0x268c6a[_0x026a('0x35')]=!![];_0x268c6a[_0x026a('0x39')](_0x1e18bc);}}}}catch(_0x589308){logger[_0x026a('0x18')]('[userReport][devicestatechange]',util[_0x026a('0x1a')](_0x589308,{'showHidden':![],'depth':null}));}};UserReport[_0x026a('0x20')][_0x026a('0x14')]=function(_0x57be96){try{if(this['isNotNull'](_0x57be96)&&this[_0x026a('0x21')](_0x57be96[_0x026a('0x13')])){logger['info'](_0x026a('0x46'),_0x57be96[_0x026a('0x47')],_0x57be96[_0x026a('0x48')],_0x57be96[_0x026a('0x13')]);logger[_0x026a('0x2e')](_0x026a('0x49'),util[_0x026a('0x1a')](_0x57be96,{'showHidden':![],'depth':null}));if(this[_0x026a('0xc')][_0x57be96[_0x026a('0x47')]]){if(!this[_0x026a('0xc')][_0x57be96['peer']][_0x026a('0x35')]||_0x57be96[_0x026a('0x13')][_0x026a('0x36')]()=='registered'){this[_0x026a('0xc')][_0x57be96[_0x026a('0x47')]]['local']=![];this[_0x026a('0xc')][_0x57be96[_0x026a('0x47')]]['status']=_0x57be96[_0x026a('0x13')]['toLowerCase']();this[_0x026a('0xc')][_0x57be96[_0x026a('0x47')]]['address']=_0x57be96[_0x026a('0x48')];this[_0x026a('0xc')][_0x57be96[_0x026a('0x47')]]['updateStatusRealtime'](_0x57be96);}}else if(this['telephones'][_0x57be96[_0x026a('0x47')]]){this[_0x026a('0xd')][_0x57be96[_0x026a('0x47')]][_0x026a('0x4a')]=_0x57be96[_0x026a('0x13')][_0x026a('0x36')]();this[_0x026a('0xd')][_0x57be96[_0x026a('0x47')]]['address']=_0x57be96[_0x026a('0x48')];logger['debug']('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util['inspect'](this['telephones'][_0x57be96[_0x026a('0x47')]],{'showHidden':![],'depth':null}));this[_0x026a('0x22')](util[_0x026a('0x30')](_0x026a('0x3b'),this[_0x026a('0xd')][_0x57be96[_0x026a('0x47')]][_0x026a('0x4b')]),_0x026a('0x3c'),this[_0x026a('0xd')][_0x57be96[_0x026a('0x47')]]);}else if(this['trunks'][_0x57be96['peer']]){this[_0x026a('0xb')][_0x57be96[_0x026a('0x47')]][_0x026a('0x4a')]=_0x57be96['peerstatus'][_0x026a('0x36')]();this['trunks'][_0x57be96[_0x026a('0x47')]][_0x026a('0x48')]=_0x57be96[_0x026a('0x48')];logger[_0x026a('0x2e')](_0x026a('0x4c'),util[_0x026a('0x1a')](this[_0x026a('0xb')][_0x57be96[_0x026a('0x47')]],{'showHidden':![],'depth':null}));this[_0x026a('0x22')](util[_0x026a('0x30')](_0x026a('0x31'),this[_0x026a('0xb')][_0x57be96[_0x026a('0x47')]][_0x026a('0x4b')]),'trunk:save',this[_0x026a('0xb')][_0x57be96[_0x026a('0x47')]]);}}}catch(_0x2b693f){logger[_0x026a('0x18')](_0x026a('0x49'),util[_0x026a('0x1a')](_0x2b693f,{'showHidden':![],'depth':null}));}};module[_0x026a('0x4d')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 86ec8e3..ae18f2d 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 _0xce27=['destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheremembername','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','agentcalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','called','mandatoryDisposition','queue','type','inbound','variables','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','routealias','interface'];(function(_0x19b15a,_0xd60cb5){var _0x284bca=function(_0x1c645d){while(--_0x1c645d){_0x19b15a['push'](_0x19b15a['shift']());}};_0x284bca(++_0xd60cb5);}(_0xce27,0xef));var _0x7ce2=function(_0x2d82cb,_0x44550c){_0x2d82cb=_0x2d82cb-0x0;var _0x4db8b0=_0xce27[_0x2d82cb];return _0x4db8b0;};'use strict';var _=require(_0x7ce2('0x0'));var moment=require(_0x7ce2('0x1'));var util=require(_0x7ce2('0x2'));var Redis=require(_0x7ce2('0x3'));var config=require(_0x7ce2('0x4'));var logger=require(_0x7ce2('0x5'))(_0x7ce2('0x6'));var ami=require(_0x7ce2('0x7'));config['redis']=_['defaults'](config[_0x7ce2('0x8')],{'host':_0x7ce2('0x9'),'port':0x18eb});var io=require(_0x7ce2('0xa'))(new Redis(config['redis']));function VoiceAgentReport(_0x5eacb4){this[_0x7ce2('0xb')]={};this[_0x7ce2('0xc')]=_0x5eacb4['channels'];this[_0x7ce2('0xd')]=_0x5eacb4[_0x7ce2('0xd')];this['agents']=_0x5eacb4[_0x7ce2('0xe')];this['variables']={};ami['on'](_0x7ce2('0xf'),this['syncAgentCalled'][_0x7ce2('0x10')](this));ami['on'](_0x7ce2('0x11'),this[_0x7ce2('0x12')][_0x7ce2('0x10')](this));ami['on'](_0x7ce2('0x13'),this[_0x7ce2('0x14')][_0x7ce2('0x10')](this));ami['on'](_0x7ce2('0x15'),this[_0x7ce2('0x16')]['bind'](this));ami['on'](_0x7ce2('0x17'),this['syncAgentComplete'][_0x7ce2('0x10')](this));ami['on'](_0x7ce2('0x18'),this['syncVarSet'][_0x7ce2('0x10')](this));ami['on'](_0x7ce2('0x19'),this[_0x7ce2('0x1a')][_0x7ce2('0x10')](this));ami['on'](_0x7ce2('0x1b'),this[_0x7ce2('0x1c')][_0x7ce2('0x10')](this));ami['on'](_0x7ce2('0x1d'),this[_0x7ce2('0x1e')][_0x7ce2('0x10')](this));ami['on'](_0x7ce2('0x1f'),this[_0x7ce2('0x20')][_0x7ce2('0x10')](this));ami['on'](_0x7ce2('0x21'),this[_0x7ce2('0x22')][_0x7ce2('0x10')](this));}VoiceAgentReport[_0x7ce2('0x23')][_0x7ce2('0x24')]=function(_0x14d9d8,_0x4a1726,_0x70a257){io['to'](_0x14d9d8)[_0x7ce2('0x24')](_0x4a1726,_0x70a257);};VoiceAgentReport['prototype'][_0x7ce2('0x25')]=function(_0x5cdc1f){return _0x5cdc1f!==null&&!_['isUndefined'](_0x5cdc1f);};VoiceAgentReport['prototype'][_0x7ce2('0x26')]=function(_0x4443e2){try{if(this['isNotNull'](_0x4443e2)){logger[_0x7ce2('0x27')](_0x7ce2('0x28'),_0x4443e2[_0x7ce2('0x29')],_0x4443e2[_0x7ce2('0x2a')],_0x4443e2[_0x7ce2('0x2b')]);logger[_0x7ce2('0x2c')](_0x7ce2('0x2d'),_0x4443e2[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](_0x4443e2,{'showHidden':![],'depth':null}));if(_[_0x7ce2('0x2f')](this[_0x7ce2('0xb')][_0x4443e2[_0x7ce2('0x29')]])){this['channels'][_0x4443e2[_0x7ce2('0x29')]]={};}if(_[_0x7ce2('0x2f')](this[_0x7ce2('0xb')][_0x4443e2[_0x7ce2('0x29')]][_0x4443e2[_0x7ce2('0x2b')]])){this[_0x7ce2('0xb')][_0x4443e2[_0x7ce2('0x29')]][_0x4443e2[_0x7ce2('0x2b')]]={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x7ce2('0x30'),'mandatoryDisposition':this[_0x7ce2('0xd')][_0x4443e2['queue']]?this[_0x7ce2('0xd')][_0x4443e2['queue']][_0x7ce2('0x31')]||![]:![],'type':this[_0x7ce2('0xd')][_0x4443e2[_0x7ce2('0x32')]]?this[_0x7ce2('0xd')][_0x4443e2['queue']][_0x7ce2('0x33')]||_0x7ce2('0x34'):_0x7ce2('0x34'),'variables':this[_0x7ce2('0x35')][_0x4443e2[_0x7ce2('0x29')]],'motionChannel':'voice'};}_[_0x7ce2('0x36')](this[_0x7ce2('0xb')][_0x4443e2['uniqueid']][_0x4443e2[_0x7ce2('0x2b')]],_[_0x7ce2('0x37')](_0x4443e2,[_0x7ce2('0x38'),_0x7ce2('0x39')]));logger[_0x7ce2('0x2c')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x4443e2[_0x7ce2('0x29')],util['inspect'](this[_0x7ce2('0xb')][_0x4443e2[_0x7ce2('0x29')]][_0x4443e2[_0x7ce2('0x2b')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcalled',this[_0x7ce2('0xb')][_0x4443e2[_0x7ce2('0x29')]][_0x4443e2['destuniqueid']]);logger[_0x7ce2('0x2c')](_0x7ce2('0x3a'),_0x4443e2[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](this['channels'][_0x4443e2[_0x7ce2('0x29')]][_0x4443e2['destuniqueid']],{'showHidden':![],'depth':null}));this['emit'](util[_0x7ce2('0x3b')](_0x7ce2('0x3c'),_0x4443e2[_0x7ce2('0x2a')]),_0x7ce2('0x3d'),this['channels'][_0x4443e2[_0x7ce2('0x29')]][_0x4443e2[_0x7ce2('0x2b')]]);}}catch(_0x54ac26){logger['error'](_0x7ce2('0x3e'),_0x4443e2[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](_0x54ac26,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ce2('0x23')][_0x7ce2('0x12')]=function(_0x58cf94){try{if(this['isNotNull'](_0x58cf94)){if(this[_0x7ce2('0xb')][_0x58cf94[_0x7ce2('0x29')]]){logger[_0x7ce2('0x2c')](_0x7ce2('0x3f'),_0x58cf94[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](_0x58cf94,{'showHidden':![],'depth':null}));for(var _0x43c080 in this[_0x7ce2('0xb')][_0x58cf94[_0x7ce2('0x29')]]){if(this['channels'][_0x58cf94['uniqueid']]['hasOwnProperty'](_0x43c080)){if(_0x58cf94[_0x7ce2('0x2b')]===_0x43c080){logger[_0x7ce2('0x27')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x58cf94['uniqueid'],_0x58cf94[_0x7ce2('0x2a')],_0x58cf94[_0x7ce2('0x2b')]);this[_0x7ce2('0xb')][_0x58cf94[_0x7ce2('0x29')]][_0x43c080]['agentconnectAt']=moment()[_0x7ce2('0x3b')](_0x7ce2('0x40'));this[_0x7ce2('0xb')][_0x58cf94[_0x7ce2('0x29')]][_0x43c080][_0x7ce2('0x41')]=_0x58cf94[_0x7ce2('0x41')];this[_0x7ce2('0xb')][_0x58cf94[_0x7ce2('0x29')]][_0x43c080][_0x7ce2('0x42')]=_0x58cf94[_0x7ce2('0x42')];this[_0x7ce2('0xb')][_0x58cf94[_0x7ce2('0x29')]][_0x43c080][_0x7ce2('0x43')]=_0x58cf94['destchannelstate'];this[_0x7ce2('0xb')][_0x58cf94[_0x7ce2('0x29')]][_0x43c080][_0x7ce2('0x44')]=_0x58cf94['destchannelstatedesc'];this[_0x7ce2('0xb')][_0x58cf94[_0x7ce2('0x29')]][_0x43c080][_0x7ce2('0x45')]=_0x58cf94['holdtime'];this[_0x7ce2('0xb')][_0x58cf94['uniqueid']][_0x43c080]['lastevent']=_0x7ce2('0x46');if(this[_0x7ce2('0xc')][this[_0x7ce2('0xb')][_0x58cf94['uniqueid']][_0x43c080][_0x7ce2('0x29')]]){var _0xf26acd=this[_0x7ce2('0xc')][this['channels'][_0x58cf94[_0x7ce2('0x29')]][_0x43c080][_0x7ce2('0x29')]][_0x7ce2('0x47')];this[_0x7ce2('0xb')][_0x58cf94['uniqueid']][_0x43c080][_0x7ce2('0x47')]=_0xf26acd;_0x58cf94[_0x7ce2('0x47')]=_0xf26acd;}_[_0x7ce2('0x36')](this[_0x7ce2('0xe')][_0x58cf94[_0x7ce2('0x48')]],_['pick'](_0x58cf94,['queue',_0x7ce2('0x49'),_0x7ce2('0x47')]));logger[_0x7ce2('0x2c')](_0x7ce2('0x4a'),_0x58cf94[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](this['channels'][_0x58cf94[_0x7ce2('0x29')]][_0x58cf94[_0x7ce2('0x2b')]],{'showHidden':![],'depth':null}));ami[_0x7ce2('0x24')](_0x7ce2('0x4b'),this[_0x7ce2('0xb')][_0x58cf94[_0x7ce2('0x29')]][_0x58cf94[_0x7ce2('0x2b')]]);logger[_0x7ce2('0x2c')](_0x7ce2('0x4c'),_0x58cf94[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](this['channels'][_0x58cf94[_0x7ce2('0x29')]][_0x58cf94['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x7ce2('0x24')](util[_0x7ce2('0x3b')](_0x7ce2('0x3c'),_0x58cf94[_0x7ce2('0x2a')]),_0x7ce2('0x4d'),this[_0x7ce2('0xb')][_0x58cf94[_0x7ce2('0x29')]][_0x58cf94[_0x7ce2('0x2b')]]);}else if(!this[_0x7ce2('0xb')][_0x58cf94['uniqueid']][_0x43c080]['agentringnoanswer']&&!this[_0x7ce2('0xb')][_0x58cf94['uniqueid']][_0x43c080][_0x7ce2('0x17')]){logger[_0x7ce2('0x27')](_0x7ce2('0x4e'),_0x58cf94[_0x7ce2('0x29')],this[_0x7ce2('0xb')][_0x58cf94[_0x7ce2('0x29')]][_0x43c080][_0x7ce2('0x2a')],_0x43c080);this[_0x7ce2('0xb')][_0x58cf94[_0x7ce2('0x29')]][_0x43c080][_0x7ce2('0x13')]=!![];this[_0x7ce2('0xb')][_0x58cf94['uniqueid']][_0x43c080]['agentringnoanswerAt']=moment()[_0x7ce2('0x3b')](_0x7ce2('0x40'));this[_0x7ce2('0xb')][_0x58cf94[_0x7ce2('0x29')]][_0x43c080]['answeredelsewheredestinationuniqueid']=_0x58cf94[_0x7ce2('0x2b')];this[_0x7ce2('0xb')][_0x58cf94[_0x7ce2('0x29')]][_0x43c080][_0x7ce2('0x4f')]=_0x58cf94[_0x7ce2('0x2a')];this[_0x7ce2('0xb')][_0x58cf94['uniqueid']][_0x43c080][_0x7ce2('0x50')]=_0x7ce2('0x51');this['channels'][_0x58cf94[_0x7ce2('0x29')]][_0x43c080][_0x7ce2('0x52')]='answered_elsewhere';logger[_0x7ce2('0x2c')](_0x7ce2('0x53'),_0x58cf94[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](this[_0x7ce2('0xb')][_0x58cf94[_0x7ce2('0x29')]][_0x43c080],{'showHidden':![],'depth':null}));ami[_0x7ce2('0x24')]('custom:agentansweredelsewhere',this['channels'][_0x58cf94[_0x7ce2('0x29')]][_0x43c080]);}}}}}}catch(_0x4ec2b4){logger[_0x7ce2('0x54')](_0x7ce2('0x55'),_0x58cf94[_0x7ce2('0x29')],util['inspect'](_0x4ec2b4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ce2('0x23')][_0x7ce2('0x14')]=function(_0x65b695){try{if(this[_0x7ce2('0x25')](_0x65b695)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x65b695[_0x7ce2('0x29')],util['inspect'](_0x65b695,{'showHidden':![],'depth':null}));if(this[_0x7ce2('0xb')][_0x65b695['uniqueid']]&&this[_0x7ce2('0xb')][_0x65b695[_0x7ce2('0x29')]][_0x65b695[_0x7ce2('0x2b')]]){logger[_0x7ce2('0x27')](_0x7ce2('0x56'),_0x65b695[_0x7ce2('0x29')],_0x65b695['membername'],_0x65b695[_0x7ce2('0x2b')]);this[_0x7ce2('0xb')][_0x65b695['uniqueid']][_0x65b695[_0x7ce2('0x2b')]][_0x7ce2('0x13')]=!![];this[_0x7ce2('0xb')][_0x65b695[_0x7ce2('0x29')]][_0x65b695['destuniqueid']][_0x7ce2('0x57')]=moment()['format'](_0x7ce2('0x40'));this[_0x7ce2('0xb')][_0x65b695[_0x7ce2('0x29')]][_0x65b695[_0x7ce2('0x2b')]][_0x7ce2('0x50')]=_0x7ce2('0x58');this['channels'][_0x65b695[_0x7ce2('0x29')]][_0x65b695['destuniqueid']][_0x7ce2('0x52')]=_0x7ce2('0x58');logger[_0x7ce2('0x2c')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x65b695['uniqueid'],util[_0x7ce2('0x2e')](this['channels'][_0x65b695[_0x7ce2('0x29')]][_0x65b695[_0x7ce2('0x2b')]],{'showHidden':![],'depth':null}));ami[_0x7ce2('0x24')](_0x7ce2('0x59'),this[_0x7ce2('0xb')][_0x65b695[_0x7ce2('0x29')]][_0x65b695[_0x7ce2('0x2b')]]);}}}catch(_0x372ead){logger[_0x7ce2('0x54')](_0x7ce2('0x5a'),_0x65b695[_0x7ce2('0x29')],util['inspect'](_0x372ead,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ce2('0x23')][_0x7ce2('0x16')]=function(_0x14d608){try{if(this['isNotNull'](_0x14d608)){logger[_0x7ce2('0x2c')](_0x7ce2('0x5b'),_0x14d608[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](_0x14d608,{'showHidden':![],'depth':null}));if(this[_0x7ce2('0xb')][_0x14d608[_0x7ce2('0x29')]]){for(var _0x425bda in this[_0x7ce2('0xb')][_0x14d608[_0x7ce2('0x29')]]){if(this[_0x7ce2('0xb')][_0x14d608[_0x7ce2('0x29')]][_0x7ce2('0x5c')](_0x425bda)&&!this[_0x7ce2('0xb')][_0x14d608['uniqueid']][_0x425bda][_0x7ce2('0x13')]&&!this[_0x7ce2('0xb')][_0x14d608[_0x7ce2('0x29')]][_0x425bda][_0x7ce2('0x17')]){logger[_0x7ce2('0x27')](_0x7ce2('0x5d'),_0x14d608[_0x7ce2('0x29')],this[_0x7ce2('0xb')][_0x14d608[_0x7ce2('0x29')]][_0x425bda][_0x7ce2('0x2a')],_0x425bda);this[_0x7ce2('0xb')][_0x14d608[_0x7ce2('0x29')]][_0x425bda][_0x7ce2('0x13')]=!![];this[_0x7ce2('0xb')][_0x14d608[_0x7ce2('0x29')]][_0x425bda][_0x7ce2('0x57')]=moment()[_0x7ce2('0x3b')](_0x7ce2('0x40'));this['channels'][_0x14d608['uniqueid']][_0x425bda][_0x7ce2('0x50')]=_0x7ce2('0x5e');this[_0x7ce2('0xb')][_0x14d608[_0x7ce2('0x29')]][_0x425bda][_0x7ce2('0x52')]=_0x7ce2('0x5e');logger[_0x7ce2('0x2c')](_0x7ce2('0x5f'),_0x14d608['uniqueid'],util[_0x7ce2('0x2e')](this[_0x7ce2('0xb')][_0x14d608['uniqueid']][_0x425bda],{'showHidden':![],'depth':null}));ami[_0x7ce2('0x24')](_0x7ce2('0x60'),this[_0x7ce2('0xb')][_0x14d608['uniqueid']][_0x425bda]);}}}}}catch(_0x8d3e20){logger[_0x7ce2('0x54')](_0x7ce2('0x61'),_0x14d608[_0x7ce2('0x29')],util['inspect'](_0x8d3e20,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ce2('0x23')]['syncAgentComplete']=function(_0x345ac3){try{if(this[_0x7ce2('0x25')](_0x345ac3)){logger[_0x7ce2('0x2c')](_0x7ce2('0x62'),_0x345ac3[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](_0x345ac3,{'showHidden':![],'depth':null}));if(this['channels'][_0x345ac3[_0x7ce2('0x29')]]){for(var _0x2e1416 in this[_0x7ce2('0xb')][_0x345ac3[_0x7ce2('0x29')]]){if(this['channels'][_0x345ac3[_0x7ce2('0x29')]][_0x7ce2('0x5c')](_0x2e1416)){if(this['channels'][_0x345ac3[_0x7ce2('0x29')]][_0x2e1416][_0x7ce2('0x63')]&&!this[_0x7ce2('0xb')][_0x345ac3[_0x7ce2('0x29')]][_0x2e1416][_0x7ce2('0x17')]){logger[_0x7ce2('0x27')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x345ac3[_0x7ce2('0x29')],this[_0x7ce2('0xb')][_0x345ac3[_0x7ce2('0x29')]][_0x2e1416]['membername'],_0x2e1416);this[_0x7ce2('0xb')][_0x345ac3[_0x7ce2('0x29')]][_0x2e1416]['agentcomplete']=!![];this['channels'][_0x345ac3['uniqueid']][_0x2e1416][_0x7ce2('0x64')]=moment()[_0x7ce2('0x3b')](_0x7ce2('0x40'));this['channels'][_0x345ac3[_0x7ce2('0x29')]][_0x2e1416]['lastevent']=_0x7ce2('0x65');this[_0x7ce2('0xb')][_0x345ac3[_0x7ce2('0x29')]][_0x2e1416][_0x7ce2('0x52')]=_0x345ac3[_0x7ce2('0x52')]==_0x7ce2('0x66')?_0x7ce2('0x67'):_0x345ac3[_0x7ce2('0x52')];this[_0x7ce2('0xb')][_0x345ac3['uniqueid']][_0x2e1416][_0x7ce2('0x68')]=_0x345ac3[_0x7ce2('0x68')];if(this[_0x7ce2('0xd')][_0x345ac3[_0x7ce2('0x32')]]&&this[_0x7ce2('0xd')][_0x345ac3[_0x7ce2('0x32')]][_0x7ce2('0x69')]){this['channels'][_0x345ac3['uniqueid']][_0x2e1416][_0x7ce2('0x6a')]=this[_0x7ce2('0xd')][_0x345ac3['queue']][_0x7ce2('0x6b')];this[_0x7ce2('0xb')][_0x345ac3['uniqueid']][_0x2e1416]['agentacw']=!![];}this[_0x7ce2('0xe')][_0x345ac3[_0x7ce2('0x48')]]=_[_0x7ce2('0x37')](this[_0x7ce2('0xe')][_0x345ac3[_0x7ce2('0x48')]],['queue',_0x7ce2('0x49')]);logger['debug'](_0x7ce2('0x6c'),_0x345ac3['uniqueid'],util[_0x7ce2('0x2e')](this[_0x7ce2('0xb')][_0x345ac3['uniqueid']][_0x2e1416],{'showHidden':![],'depth':null}));ami['emit'](_0x7ce2('0x6d'),this[_0x7ce2('0xb')][_0x345ac3['uniqueid']][_0x2e1416]);logger[_0x7ce2('0x2c')](_0x7ce2('0x6e'),_0x345ac3[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](this[_0x7ce2('0xb')][_0x345ac3[_0x7ce2('0x29')]][_0x2e1416],{'showHidden':![],'depth':null}));this[_0x7ce2('0x24')](util[_0x7ce2('0x3b')](_0x7ce2('0x3c'),_0x345ac3[_0x7ce2('0x2a')]),_0x7ce2('0x6f'),this[_0x7ce2('0xb')][_0x345ac3[_0x7ce2('0x29')]][_0x2e1416]);}}}}}}catch(_0x1d6e19){logger[_0x7ce2('0x54')](_0x7ce2('0x70'),_0x345ac3['uniqueid'],util[_0x7ce2('0x2e')](_0x1d6e19,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ce2('0x23')][_0x7ce2('0x71')]=function(_0x29f82c){try{if(this[_0x7ce2('0x25')](_0x29f82c)){logger['debug']('[%s][voiceAgentReport][varset]\x20event:',_0x29f82c[_0x7ce2('0x29')],util['inspect'](_0x29f82c,{'showHidden':![],'depth':null}));this[_0x7ce2('0x72')](_0x29f82c[_0x7ce2('0x29')],_[_0x7ce2('0x73')](_0x29f82c[_0x7ce2('0x74')])[0x0],_0x29f82c[_0x7ce2('0x75')]);if(this['channels'][_0x29f82c[_0x7ce2('0x29')]]){for(var _0x1f87cb in this[_0x7ce2('0xb')][_0x29f82c[_0x7ce2('0x29')]]){if(this['channels'][_0x29f82c[_0x7ce2('0x29')]]['hasOwnProperty'](_0x1f87cb)){logger['info'](_0x7ce2('0x76'),_0x29f82c[_0x7ce2('0x29')],_0x1f87cb,_[_0x7ce2('0x73')](_0x29f82c[_0x7ce2('0x74')])[0x0],_0x29f82c[_0x7ce2('0x75')]);if(_['isUndefined'](this[_0x7ce2('0xb')][_0x29f82c[_0x7ce2('0x29')]][_0x1f87cb][_0x7ce2('0x35')])){this[_0x7ce2('0xb')][_0x29f82c[_0x7ce2('0x29')]][_0x1f87cb]['variables']={};}this[_0x7ce2('0xb')][_0x29f82c[_0x7ce2('0x29')]][_0x1f87cb]['variables']=this[_0x7ce2('0x35')][_0x29f82c[_0x7ce2('0x29')]];}}}}}catch(_0x1f395c){logger[_0x7ce2('0x54')](_0x7ce2('0x77'),_0x29f82c[_0x7ce2('0x29')],util['inspect'](_0x1f395c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ce2('0x23')][_0x7ce2('0x72')]=function(_0x26ee03,_0x59a258,_0x48cdfe){var _0x15e9e3=[_0x7ce2('0x78'),'rtpaudioqosbridged',_0x7ce2('0x79'),'rtpaudioqosjitterbridged',_0x7ce2('0x7a'),'rtpaudioqoslossbridged',_0x7ce2('0x7b'),'rtpaudioqosrttbridged',_0x7ce2('0x7c'),_0x7ce2('0x7d'),_0x7ce2('0x7e'),_0x7ce2('0x7f'),'membercalls',_0x7ce2('0x80'),'memberinterface',_0x7ce2('0x81'),_0x7ce2('0x2a'),_0x7ce2('0x82'),_0x7ce2('0x83')];if(!_[_0x7ce2('0x84')](_0x59a258)&&!_[_0x7ce2('0x85')](_0x15e9e3,_0x59a258)){if(_[_0x7ce2('0x2f')](this[_0x7ce2('0x35')][_0x26ee03])){this[_0x7ce2('0x35')][_0x26ee03]={};}this[_0x7ce2('0x35')][_0x26ee03][_0x59a258]=_0x48cdfe;}};VoiceAgentReport[_0x7ce2('0x23')][_0x7ce2('0x1a')]=function(_0x4194ba){try{if(this[_0x7ce2('0x25')](_0x4194ba)){logger[_0x7ce2('0x2c')]('[%s][voiceAgentReport][hangup]\x20event:',_0x4194ba['uniqueid'],util[_0x7ce2('0x2e')](_0x4194ba,{'showHidden':![],'depth':null}));if(this[_0x7ce2('0xb')][_0x4194ba[_0x7ce2('0x29')]]){for(var _0x11c5d6 in this[_0x7ce2('0xb')][_0x4194ba[_0x7ce2('0x29')]]){if(this['channels'][_0x4194ba[_0x7ce2('0x29')]][_0x7ce2('0x5c')](_0x11c5d6)){if(this[_0x7ce2('0xb')][_0x4194ba['uniqueid']][_0x11c5d6]['reason']==_0x7ce2('0x66')&&this[_0x7ce2('0xb')][_0x4194ba[_0x7ce2('0x29')]][_0x11c5d6][_0x7ce2('0x17')]){logger[_0x7ce2('0x27')](_0x7ce2('0x86'),_0x4194ba[_0x7ce2('0x29')],_0x11c5d6);this['channels'][_0x4194ba['uniqueid']][_0x11c5d6][_0x7ce2('0x64')]=moment()[_0x7ce2('0x3b')](_0x7ce2('0x40'));}}}logger[_0x7ce2('0x2c')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x4194ba['uniqueid'],util['inspect'](_[_0x7ce2('0x87')](this[_0x7ce2('0xb')][_0x4194ba[_0x7ce2('0x29')]]),{'showHidden':![],'depth':null}));ami[_0x7ce2('0x24')](_0x7ce2('0x88'),_[_0x7ce2('0x87')](this[_0x7ce2('0xb')][_0x4194ba[_0x7ce2('0x29')]]));delete this[_0x7ce2('0xb')][_0x4194ba[_0x7ce2('0x29')]];}if(this['variables'][_0x4194ba[_0x7ce2('0x29')]]){delete this['variables'][_0x4194ba[_0x7ce2('0x29')]];}}}catch(_0x547c4f){logger[_0x7ce2('0x54')](_0x7ce2('0x89'),_0x4194ba[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](_0x547c4f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ce2('0x23')]['syncAttendedTransfer']=function(_0x31eb88){try{if(this[_0x7ce2('0x25')](_0x31eb88)){logger[_0x7ce2('0x2c')](_0x7ce2('0x8a'),_0x31eb88[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](_0x31eb88,{'showHidden':![],'depth':null}));if(this['channels'][_0x31eb88[_0x7ce2('0x8b')]]){for(var _0x863143 in this[_0x7ce2('0xb')][_0x31eb88['transfereeuniqueid']]){if(this[_0x7ce2('0xb')][_0x31eb88[_0x7ce2('0x8b')]]['hasOwnProperty'](_0x863143)){if(_0x31eb88[_0x7ce2('0x8c')]===_0x863143){logger[_0x7ce2('0x27')](_0x7ce2('0x8d'),_0x31eb88[_0x7ce2('0x29')],this[_0x7ce2('0xb')][_0x31eb88[_0x7ce2('0x8b')]][_0x863143][_0x7ce2('0x2a')],_0x863143);var _0x42b586=moment();this[_0x7ce2('0xb')][_0x31eb88[_0x7ce2('0x8b')]][_0x863143][_0x7ce2('0x17')]=!![];this[_0x7ce2('0xb')][_0x31eb88[_0x7ce2('0x8b')]][_0x863143][_0x7ce2('0x64')]=moment()[_0x7ce2('0x3b')](_0x7ce2('0x40'));this[_0x7ce2('0xb')][_0x31eb88[_0x7ce2('0x8b')]][_0x863143][_0x7ce2('0x50')]='complete';this[_0x7ce2('0xb')][_0x31eb88[_0x7ce2('0x8b')]][_0x863143][_0x7ce2('0x52')]='transfer';this[_0x7ce2('0xb')][_0x31eb88[_0x7ce2('0x8b')]][_0x863143]['talktime']=_0x42b586[_0x7ce2('0x8e')](this[_0x7ce2('0xb')][_0x31eb88[_0x7ce2('0x8b')]][_0x863143][_0x7ce2('0x63')],_0x7ce2('0x8f'));}}}}if(this[_0x7ce2('0xb')][_0x31eb88[_0x7ce2('0x90')]]){var _0x2c5804=this['channels'][_0x31eb88[_0x7ce2('0x90')]];this[_0x7ce2('0xb')][_0x31eb88[_0x7ce2('0x90')]]=this[_0x7ce2('0xb')][_0x31eb88['transfereeuniqueid']];this[_0x7ce2('0xb')][_0x31eb88[_0x7ce2('0x8b')]]=_0x2c5804;}}}catch(_0x5db55f){logger['error'](_0x7ce2('0x91'),_0x31eb88['uniqueid'],util[_0x7ce2('0x2e')](_0x5db55f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ce2('0x23')][_0x7ce2('0x22')]=function(_0x4fa7df){try{if(this[_0x7ce2('0x25')](_0x4fa7df)){logger[_0x7ce2('0x2c')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x4fa7df[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](_0x4fa7df,{'showHidden':![],'depth':null}));if(this[_0x7ce2('0xb')][_0x4fa7df[_0x7ce2('0x8b')]]){for(var _0x24f475 in this[_0x7ce2('0xb')][_0x4fa7df[_0x7ce2('0x8b')]]){if(this[_0x7ce2('0xb')][_0x4fa7df['transfereeuniqueid']]['hasOwnProperty'](_0x24f475)){if(_0x4fa7df['transfereruniqueid']===_0x24f475){logger[_0x7ce2('0x27')](_0x7ce2('0x92'),_0x4fa7df[_0x7ce2('0x29')],this[_0x7ce2('0xb')][_0x4fa7df[_0x7ce2('0x8b')]][_0x24f475][_0x7ce2('0x2a')],_0x24f475);var _0x3fd0cd=moment();this[_0x7ce2('0xb')][_0x4fa7df[_0x7ce2('0x8b')]][_0x24f475][_0x7ce2('0x17')]=!![];this['channels'][_0x4fa7df[_0x7ce2('0x8b')]][_0x24f475][_0x7ce2('0x64')]=_0x3fd0cd;this[_0x7ce2('0xb')][_0x4fa7df['transfereeuniqueid']][_0x24f475]['lastevent']=_0x7ce2('0x65');this[_0x7ce2('0xb')][_0x4fa7df[_0x7ce2('0x8b')]][_0x24f475][_0x7ce2('0x52')]=_0x7ce2('0x66');this['channels'][_0x4fa7df[_0x7ce2('0x8b')]][_0x24f475][_0x7ce2('0x68')]=_0x3fd0cd['diff'](this['channels'][_0x4fa7df[_0x7ce2('0x8b')]][_0x24f475]['agentconnectAt'],_0x7ce2('0x8f'));}}}}}}catch(_0x626d3e){logger[_0x7ce2('0x54')]('[%s][voiceAgentReport][blindtransfer]',_0x4fa7df['uniqueid'],util['inspect'](_0x626d3e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ce2('0x23')][_0x7ce2('0x1c')]=function(_0x47b19c){var _0xc8b529='';try{if(this[_0x7ce2('0x25')](_0x47b19c)){logger[_0x7ce2('0x2c')](_0x7ce2('0x93'),_0x47b19c[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](_0x47b19c,{'showHidden':![],'depth':null}));if(_0x47b19c['channel']){_0xc8b529=_0x47b19c[_0x7ce2('0x94')][_0x7ce2('0x95')](0x0,_0x47b19c['channel'][_0x7ce2('0x96')]('-'));if(this[_0x7ce2('0xe')][_0xc8b529]){logger['info'](_0x7ce2('0x97'),_0x47b19c[_0x7ce2('0x29')],_0xc8b529);this[_0x7ce2('0xe')][_0xc8b529][_0x7ce2('0x98')]=!![];}}}}catch(_0x24ce4f){logger[_0x7ce2('0x54')](_0x7ce2('0x99'),_0x47b19c[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](_0x24ce4f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ce2('0x23')][_0x7ce2('0x1e')]=function(_0x2949c9){var _0x2131d9='';try{if(this[_0x7ce2('0x25')](_0x2949c9)){logger['debug']('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x2949c9[_0x7ce2('0x29')],util[_0x7ce2('0x2e')](_0x2949c9,{'showHidden':![],'depth':null}));if(_0x2949c9[_0x7ce2('0x94')]){_0x2131d9=_0x2949c9[_0x7ce2('0x94')][_0x7ce2('0x95')](0x0,_0x2949c9[_0x7ce2('0x94')][_0x7ce2('0x96')]('-'));if(this[_0x7ce2('0xe')][_0x2131d9]){logger[_0x7ce2('0x27')](_0x7ce2('0x9a'),_0x2949c9['uniqueid'],_0x2131d9);this[_0x7ce2('0xe')][_0x2131d9][_0x7ce2('0x98')]=![];}}}}catch(_0x4a8dcb){logger['error'](_0x7ce2('0x9b'),_0x2949c9['uniqueid'],util[_0x7ce2('0x2e')](_0x4a8dcb,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x72ea=['rtpaudioqosrttbridged','bridgepvtcallid','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','info','[%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','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','inspect','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','destchannelstate','holdtime','connect','routealias','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','answeredelsewheremembername','lastevent','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','interface','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','hasOwnProperty','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt'];(function(_0x16e446,_0x42c546){var _0x3e5156=function(_0x518232){while(--_0x518232){_0x16e446['push'](_0x16e446['shift']());}};_0x3e5156(++_0x42c546);}(_0x72ea,0x1e8));var _0xa72e=function(_0x55b14a,_0x1cc25d){_0x55b14a=_0x55b14a-0x0;var _0x4c7027=_0x72ea[_0x55b14a];return _0x4c7027;};'use strict';var _=require(_0xa72e('0x0'));var moment=require(_0xa72e('0x1'));var util=require(_0xa72e('0x2'));var Redis=require('ioredis');var config=require(_0xa72e('0x3'));var logger=require(_0xa72e('0x4'))(_0xa72e('0x5'));var ami=require(_0xa72e('0x6'));config[_0xa72e('0x7')]=_[_0xa72e('0x8')](config[_0xa72e('0x7')],{'host':_0xa72e('0x9'),'port':0x18eb});var io=require(_0xa72e('0xa'))(new Redis(config['redis']));function VoiceAgentReport(_0x39c65a){this[_0xa72e('0xb')]={};this[_0xa72e('0xc')]=_0x39c65a[_0xa72e('0xb')];this[_0xa72e('0xd')]=_0x39c65a[_0xa72e('0xd')];this[_0xa72e('0xe')]=_0x39c65a['agents'];this[_0xa72e('0xf')]={};ami['on']('agentcalled',this[_0xa72e('0x10')][_0xa72e('0x11')](this));ami['on'](_0xa72e('0x12'),this[_0xa72e('0x13')][_0xa72e('0x11')](this));ami['on'](_0xa72e('0x14'),this[_0xa72e('0x15')][_0xa72e('0x11')](this));ami['on'](_0xa72e('0x16'),this[_0xa72e('0x17')][_0xa72e('0x11')](this));ami['on'](_0xa72e('0x18'),this[_0xa72e('0x19')]['bind'](this));ami['on']('varset',this[_0xa72e('0x1a')][_0xa72e('0x11')](this));ami['on'](_0xa72e('0x1b'),this[_0xa72e('0x1c')]['bind'](this));ami['on']('musiconholdstart',this[_0xa72e('0x1d')][_0xa72e('0x11')](this));ami['on'](_0xa72e('0x1e'),this[_0xa72e('0x1f')]['bind'](this));ami['on'](_0xa72e('0x20'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xa72e('0x21'),this[_0xa72e('0x22')][_0xa72e('0x11')](this));}VoiceAgentReport['prototype'][_0xa72e('0x23')]=function(_0x319b9a,_0x53987b,_0x51b9d3){io['to'](_0x319b9a)[_0xa72e('0x23')](_0x53987b,_0x51b9d3);};VoiceAgentReport[_0xa72e('0x24')][_0xa72e('0x25')]=function(_0x3e471c){return _0x3e471c!==null&&!_[_0xa72e('0x26')](_0x3e471c);};VoiceAgentReport[_0xa72e('0x24')][_0xa72e('0x10')]=function(_0x5918bf){try{if(this[_0xa72e('0x25')](_0x5918bf)){logger[_0xa72e('0x27')](_0xa72e('0x28'),_0x5918bf[_0xa72e('0x29')],_0x5918bf[_0xa72e('0x2a')],_0x5918bf[_0xa72e('0x2b')]);logger[_0xa72e('0x2c')](_0xa72e('0x2d'),_0x5918bf[_0xa72e('0x29')],util['inspect'](_0x5918bf,{'showHidden':![],'depth':null}));if(_[_0xa72e('0x26')](this[_0xa72e('0xb')][_0x5918bf[_0xa72e('0x29')]])){this['channels'][_0x5918bf['uniqueid']]={};}if(_[_0xa72e('0x26')](this[_0xa72e('0xb')][_0x5918bf['uniqueid']][_0x5918bf[_0xa72e('0x2b')]])){this[_0xa72e('0xb')][_0x5918bf[_0xa72e('0x29')]][_0x5918bf[_0xa72e('0x2b')]]={'agentcalledAt':moment()[_0xa72e('0x2e')](_0xa72e('0x2f')),'lastevent':_0xa72e('0x30'),'mandatoryDisposition':this['voiceQueues'][_0x5918bf['queue']]?this[_0xa72e('0xd')][_0x5918bf[_0xa72e('0x31')]][_0xa72e('0x32')]||![]:![],'type':this[_0xa72e('0xd')][_0x5918bf[_0xa72e('0x31')]]?this[_0xa72e('0xd')][_0x5918bf[_0xa72e('0x31')]][_0xa72e('0x33')]||_0xa72e('0x34'):_0xa72e('0x34'),'variables':this[_0xa72e('0xf')][_0x5918bf[_0xa72e('0x29')]],'motionChannel':_0xa72e('0x35')};}_[_0xa72e('0x36')](this[_0xa72e('0xb')][_0x5918bf[_0xa72e('0x29')]][_0x5918bf[_0xa72e('0x2b')]],_[_0xa72e('0x37')](_0x5918bf,[_0xa72e('0x38'),_0xa72e('0x39')]));logger[_0xa72e('0x2c')](_0xa72e('0x3a'),_0x5918bf['uniqueid'],util['inspect'](this[_0xa72e('0xb')][_0x5918bf[_0xa72e('0x29')]][_0x5918bf[_0xa72e('0x2b')]],{'showHidden':![],'depth':null}));ami[_0xa72e('0x23')](_0xa72e('0x3b'),this[_0xa72e('0xb')][_0x5918bf['uniqueid']][_0x5918bf['destuniqueid']]);logger[_0xa72e('0x2c')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x5918bf[_0xa72e('0x29')],util[_0xa72e('0x3c')](this[_0xa72e('0xb')][_0x5918bf[_0xa72e('0x29')]][_0x5918bf['destuniqueid']],{'showHidden':![],'depth':null}));this[_0xa72e('0x23')](util['format'](_0xa72e('0x3d'),_0x5918bf['membername']),_0xa72e('0x3e'),this[_0xa72e('0xb')][_0x5918bf[_0xa72e('0x29')]][_0x5918bf[_0xa72e('0x2b')]]);}}catch(_0x4e2b62){logger['error'](_0xa72e('0x3f'),_0x5918bf[_0xa72e('0x29')],util[_0xa72e('0x3c')](_0x4e2b62,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa72e('0x24')][_0xa72e('0x13')]=function(_0x42f9f0){try{if(this[_0xa72e('0x25')](_0x42f9f0)){if(this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]]){logger[_0xa72e('0x2c')](_0xa72e('0x40'),_0x42f9f0[_0xa72e('0x29')],util[_0xa72e('0x3c')](_0x42f9f0,{'showHidden':![],'depth':null}));for(var _0x373b94 in this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]]){if(this['channels'][_0x42f9f0[_0xa72e('0x29')]]['hasOwnProperty'](_0x373b94)){if(_0x42f9f0[_0xa72e('0x2b')]===_0x373b94){logger[_0xa72e('0x27')](_0xa72e('0x41'),_0x42f9f0['uniqueid'],_0x42f9f0[_0xa72e('0x2a')],_0x42f9f0[_0xa72e('0x2b')]);this[_0xa72e('0xb')][_0x42f9f0['uniqueid']][_0x373b94][_0xa72e('0x42')]=moment()[_0xa72e('0x2e')](_0xa72e('0x2f'));this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]][_0x373b94]['connectedlinename']=_0x42f9f0['connectedlinename'];this['channels'][_0x42f9f0[_0xa72e('0x29')]][_0x373b94][_0xa72e('0x43')]=_0x42f9f0[_0xa72e('0x43')];this[_0xa72e('0xb')][_0x42f9f0['uniqueid']][_0x373b94][_0xa72e('0x44')]=_0x42f9f0[_0xa72e('0x44')];this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]][_0x373b94]['destchannelstatedesc']=_0x42f9f0['destchannelstatedesc'];this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]][_0x373b94][_0xa72e('0x45')]=_0x42f9f0['holdtime'];this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]][_0x373b94]['lastevent']=_0xa72e('0x46');if(this[_0xa72e('0xc')][this[_0xa72e('0xb')][_0x42f9f0['uniqueid']][_0x373b94][_0xa72e('0x29')]]){var _0x2f3ff1=this[_0xa72e('0xc')][this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]][_0x373b94]['uniqueid']][_0xa72e('0x47')];this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]][_0x373b94][_0xa72e('0x47')]=_0x2f3ff1;_0x42f9f0[_0xa72e('0x47')]=_0x2f3ff1;}_['merge'](this[_0xa72e('0xe')][_0x42f9f0['interface']],_[_0xa72e('0x48')](_0x42f9f0,['queue','destconnectedlinenum',_0xa72e('0x47')]));logger['debug'](_0xa72e('0x49'),_0x42f9f0[_0xa72e('0x29')],util[_0xa72e('0x3c')](this['channels'][_0x42f9f0[_0xa72e('0x29')]][_0x42f9f0['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xa72e('0x23')](_0xa72e('0x4a'),this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]][_0x42f9f0['destuniqueid']]);logger[_0xa72e('0x2c')](_0xa72e('0x4b'),_0x42f9f0[_0xa72e('0x29')],util['inspect'](this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]][_0x42f9f0[_0xa72e('0x2b')]],{'showHidden':![],'depth':null}));this[_0xa72e('0x23')](util['format'](_0xa72e('0x3d'),_0x42f9f0[_0xa72e('0x2a')]),_0xa72e('0x4c'),this['channels'][_0x42f9f0[_0xa72e('0x29')]][_0x42f9f0[_0xa72e('0x2b')]]);}else if(!this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]][_0x373b94][_0xa72e('0x14')]&&!this['channels'][_0x42f9f0[_0xa72e('0x29')]][_0x373b94][_0xa72e('0x18')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x42f9f0['uniqueid'],this[_0xa72e('0xb')][_0x42f9f0['uniqueid']][_0x373b94][_0xa72e('0x2a')],_0x373b94);this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]][_0x373b94]['agentringnoanswer']=!![];this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]][_0x373b94]['agentringnoanswerAt']=moment()[_0xa72e('0x2e')](_0xa72e('0x2f'));this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]][_0x373b94]['answeredelsewheredestinationuniqueid']=_0x42f9f0[_0xa72e('0x2b')];this[_0xa72e('0xb')][_0x42f9f0['uniqueid']][_0x373b94][_0xa72e('0x4d')]=_0x42f9f0[_0xa72e('0x2a')];this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]][_0x373b94][_0xa72e('0x4e')]=_0xa72e('0x4f');this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]][_0x373b94]['reason']=_0xa72e('0x4f');logger['debug'](_0xa72e('0x50'),_0x42f9f0[_0xa72e('0x29')],util['inspect'](this[_0xa72e('0xb')][_0x42f9f0[_0xa72e('0x29')]][_0x373b94],{'showHidden':![],'depth':null}));ami[_0xa72e('0x23')](_0xa72e('0x51'),this[_0xa72e('0xb')][_0x42f9f0['uniqueid']][_0x373b94]);}}}}}}catch(_0x4d2246){logger[_0xa72e('0x52')]('[%s][voiceAgentReport][agentconnect]',_0x42f9f0[_0xa72e('0x29')],util[_0xa72e('0x3c')](_0x4d2246,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa72e('0x24')]['syncAgentRingNoAnswer']=function(_0x2c1cac){try{if(this['isNotNull'](_0x2c1cac)){logger[_0xa72e('0x2c')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x2c1cac[_0xa72e('0x29')],util[_0xa72e('0x3c')](_0x2c1cac,{'showHidden':![],'depth':null}));if(this[_0xa72e('0xb')][_0x2c1cac[_0xa72e('0x29')]]&&this[_0xa72e('0xb')][_0x2c1cac[_0xa72e('0x29')]][_0x2c1cac[_0xa72e('0x2b')]]){logger[_0xa72e('0x27')](_0xa72e('0x53'),_0x2c1cac[_0xa72e('0x29')],_0x2c1cac[_0xa72e('0x2a')],_0x2c1cac[_0xa72e('0x2b')]);this['channels'][_0x2c1cac['uniqueid']][_0x2c1cac[_0xa72e('0x2b')]][_0xa72e('0x14')]=!![];this[_0xa72e('0xb')][_0x2c1cac[_0xa72e('0x29')]][_0x2c1cac[_0xa72e('0x2b')]][_0xa72e('0x54')]=moment()['format'](_0xa72e('0x2f'));this['channels'][_0x2c1cac[_0xa72e('0x29')]][_0x2c1cac['destuniqueid']][_0xa72e('0x4e')]=_0xa72e('0x55');this[_0xa72e('0xb')][_0x2c1cac[_0xa72e('0x29')]][_0x2c1cac[_0xa72e('0x2b')]][_0xa72e('0x56')]=_0xa72e('0x55');logger[_0xa72e('0x2c')](_0xa72e('0x57'),_0x2c1cac[_0xa72e('0x29')],util[_0xa72e('0x3c')](this[_0xa72e('0xb')][_0x2c1cac[_0xa72e('0x29')]][_0x2c1cac[_0xa72e('0x2b')]],{'showHidden':![],'depth':null}));ami[_0xa72e('0x23')](_0xa72e('0x58'),this[_0xa72e('0xb')][_0x2c1cac[_0xa72e('0x29')]][_0x2c1cac[_0xa72e('0x2b')]]);}}}catch(_0x964dc){logger[_0xa72e('0x52')]('[%s][voiceAgentReport][agentringnoanswer]',_0x2c1cac[_0xa72e('0x29')],util[_0xa72e('0x3c')](_0x964dc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa72e('0x24')][_0xa72e('0x17')]=function(_0x2d2a08){try{if(this['isNotNull'](_0x2d2a08)){logger['debug'](_0xa72e('0x59'),_0x2d2a08['uniqueid'],util[_0xa72e('0x3c')](_0x2d2a08,{'showHidden':![],'depth':null}));if(this[_0xa72e('0xb')][_0x2d2a08[_0xa72e('0x29')]]){for(var _0x451c31 in this[_0xa72e('0xb')][_0x2d2a08['uniqueid']]){if(this[_0xa72e('0xb')][_0x2d2a08[_0xa72e('0x29')]]['hasOwnProperty'](_0x451c31)&&!this[_0xa72e('0xb')][_0x2d2a08['uniqueid']][_0x451c31][_0xa72e('0x14')]&&!this[_0xa72e('0xb')][_0x2d2a08[_0xa72e('0x29')]][_0x451c31][_0xa72e('0x18')]){logger[_0xa72e('0x27')](_0xa72e('0x5a'),_0x2d2a08[_0xa72e('0x29')],this['channels'][_0x2d2a08[_0xa72e('0x29')]][_0x451c31][_0xa72e('0x2a')],_0x451c31);this[_0xa72e('0xb')][_0x2d2a08[_0xa72e('0x29')]][_0x451c31]['agentringnoanswer']=!![];this['channels'][_0x2d2a08['uniqueid']][_0x451c31][_0xa72e('0x54')]=moment()[_0xa72e('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa72e('0xb')][_0x2d2a08[_0xa72e('0x29')]][_0x451c31]['lastevent']=_0xa72e('0x5b');this[_0xa72e('0xb')][_0x2d2a08[_0xa72e('0x29')]][_0x451c31][_0xa72e('0x56')]=_0xa72e('0x5b');logger['debug']('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x2d2a08[_0xa72e('0x29')],util[_0xa72e('0x3c')](this[_0xa72e('0xb')][_0x2d2a08[_0xa72e('0x29')]][_0x451c31],{'showHidden':![],'depth':null}));ami[_0xa72e('0x23')](_0xa72e('0x5c'),this['channels'][_0x2d2a08['uniqueid']][_0x451c31]);}}}}}catch(_0x5d2f2c){logger[_0xa72e('0x52')](_0xa72e('0x5d'),_0x2d2a08[_0xa72e('0x29')],util[_0xa72e('0x3c')](_0x5d2f2c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa72e('0x24')][_0xa72e('0x19')]=function(_0xe8559c){try{if(this[_0xa72e('0x25')](_0xe8559c)){logger['debug'](_0xa72e('0x5e'),_0xe8559c[_0xa72e('0x29')],util[_0xa72e('0x3c')](_0xe8559c,{'showHidden':![],'depth':null}));if(this[_0xa72e('0xb')][_0xe8559c['uniqueid']]){for(var _0x5addd7 in this[_0xa72e('0xb')][_0xe8559c[_0xa72e('0x29')]]){if(this[_0xa72e('0xb')][_0xe8559c[_0xa72e('0x29')]]['hasOwnProperty'](_0x5addd7)){if(this[_0xa72e('0xb')][_0xe8559c[_0xa72e('0x29')]][_0x5addd7][_0xa72e('0x42')]&&!this[_0xa72e('0xb')][_0xe8559c[_0xa72e('0x29')]][_0x5addd7]['agentcomplete']){logger[_0xa72e('0x27')](_0xa72e('0x5f'),_0xe8559c[_0xa72e('0x29')],this[_0xa72e('0xb')][_0xe8559c[_0xa72e('0x29')]][_0x5addd7][_0xa72e('0x2a')],_0x5addd7);this['channels'][_0xe8559c[_0xa72e('0x29')]][_0x5addd7]['agentcomplete']=!![];this[_0xa72e('0xb')][_0xe8559c[_0xa72e('0x29')]][_0x5addd7][_0xa72e('0x60')]=moment()[_0xa72e('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xe8559c[_0xa72e('0x29')]][_0x5addd7][_0xa72e('0x4e')]=_0xa72e('0x61');this['channels'][_0xe8559c[_0xa72e('0x29')]][_0x5addd7][_0xa72e('0x56')]=_0xe8559c[_0xa72e('0x56')]==_0xa72e('0x62')?_0xa72e('0x63'):_0xe8559c['reason'];this[_0xa72e('0xb')][_0xe8559c[_0xa72e('0x29')]][_0x5addd7][_0xa72e('0x64')]=_0xe8559c[_0xa72e('0x64')];if(this[_0xa72e('0xd')][_0xe8559c[_0xa72e('0x31')]]&&this[_0xa72e('0xd')][_0xe8559c[_0xa72e('0x31')]][_0xa72e('0x65')]){this[_0xa72e('0xb')][_0xe8559c[_0xa72e('0x29')]][_0x5addd7][_0xa72e('0x66')]=this[_0xa72e('0xd')][_0xe8559c[_0xa72e('0x31')]][_0xa72e('0x67')];this['channels'][_0xe8559c[_0xa72e('0x29')]][_0x5addd7][_0xa72e('0x68')]=!![];}this[_0xa72e('0xe')][_0xe8559c[_0xa72e('0x69')]]=_[_0xa72e('0x37')](this[_0xa72e('0xe')][_0xe8559c[_0xa72e('0x69')]],[_0xa72e('0x31'),_0xa72e('0x6a')]);logger[_0xa72e('0x2c')](_0xa72e('0x6b'),_0xe8559c['uniqueid'],util[_0xa72e('0x3c')](this[_0xa72e('0xb')][_0xe8559c['uniqueid']][_0x5addd7],{'showHidden':![],'depth':null}));ami['emit'](_0xa72e('0x6c'),this[_0xa72e('0xb')][_0xe8559c[_0xa72e('0x29')]][_0x5addd7]);logger['debug'](_0xa72e('0x6d'),_0xe8559c[_0xa72e('0x29')],util['inspect'](this[_0xa72e('0xb')][_0xe8559c[_0xa72e('0x29')]][_0x5addd7],{'showHidden':![],'depth':null}));this[_0xa72e('0x23')](util[_0xa72e('0x2e')](_0xa72e('0x3d'),_0xe8559c[_0xa72e('0x2a')]),_0xa72e('0x6e'),this['channels'][_0xe8559c['uniqueid']][_0x5addd7]);}}}}}}catch(_0x348ff2){logger[_0xa72e('0x52')]('[%s][voiceAgentReport][agentcomplete]',_0xe8559c[_0xa72e('0x29')],util[_0xa72e('0x3c')](_0x348ff2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa72e('0x24')][_0xa72e('0x1a')]=function(_0xfe834c){try{if(this['isNotNull'](_0xfe834c)){logger['debug'](_0xa72e('0x6f'),_0xfe834c['uniqueid'],util[_0xa72e('0x3c')](_0xfe834c,{'showHidden':![],'depth':null}));this[_0xa72e('0x70')](_0xfe834c['uniqueid'],_[_0xa72e('0x71')](_0xfe834c['variable'])[0x0],_0xfe834c[_0xa72e('0x72')]);if(this[_0xa72e('0xb')][_0xfe834c[_0xa72e('0x29')]]){for(var _0x29deb4 in this[_0xa72e('0xb')][_0xfe834c[_0xa72e('0x29')]]){if(this[_0xa72e('0xb')][_0xfe834c[_0xa72e('0x29')]][_0xa72e('0x73')](_0x29deb4)){logger['info'](_0xa72e('0x74'),_0xfe834c[_0xa72e('0x29')],_0x29deb4,_[_0xa72e('0x71')](_0xfe834c[_0xa72e('0x75')])[0x0],_0xfe834c['value']);if(_[_0xa72e('0x26')](this['channels'][_0xfe834c[_0xa72e('0x29')]][_0x29deb4][_0xa72e('0xf')])){this[_0xa72e('0xb')][_0xfe834c[_0xa72e('0x29')]][_0x29deb4][_0xa72e('0xf')]={};}this[_0xa72e('0xb')][_0xfe834c[_0xa72e('0x29')]][_0x29deb4][_0xa72e('0xf')]=this[_0xa72e('0xf')][_0xfe834c['uniqueid']];}}}}}catch(_0xaa07fc){logger['error']('[%s][voiceAgentReport][varset]',_0xfe834c[_0xa72e('0x29')],util['inspect'](_0xaa07fc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa72e('0x24')][_0xa72e('0x70')]=function(_0x5446e8,_0x3ee900,_0x1eaa38){var _0x1b1caf=[_0xa72e('0x76'),'rtpaudioqosbridged',_0xa72e('0x77'),_0xa72e('0x78'),_0xa72e('0x79'),_0xa72e('0x7a'),_0xa72e('0x7b'),_0xa72e('0x7c'),'sipcallid','sipuri','bridgepeer',_0xa72e('0x7d'),'membercalls',_0xa72e('0x7e'),_0xa72e('0x7f'),'memberlastcall','membername',_0xa72e('0x80'),_0xa72e('0x81')];if(!_[_0xa72e('0x82')](_0x3ee900)&&!_[_0xa72e('0x83')](_0x1b1caf,_0x3ee900)){if(_[_0xa72e('0x26')](this['variables'][_0x5446e8])){this['variables'][_0x5446e8]={};}this[_0xa72e('0xf')][_0x5446e8][_0x3ee900]=_0x1eaa38;}};VoiceAgentReport['prototype'][_0xa72e('0x1c')]=function(_0x135ccc){try{if(this[_0xa72e('0x25')](_0x135ccc)){logger[_0xa72e('0x2c')](_0xa72e('0x84'),_0x135ccc[_0xa72e('0x29')],util['inspect'](_0x135ccc,{'showHidden':![],'depth':null}));if(this[_0xa72e('0xb')][_0x135ccc[_0xa72e('0x29')]]){for(var _0xe38798 in this[_0xa72e('0xb')][_0x135ccc['uniqueid']]){if(this[_0xa72e('0xb')][_0x135ccc['uniqueid']][_0xa72e('0x73')](_0xe38798)){if(this[_0xa72e('0xb')][_0x135ccc[_0xa72e('0x29')]][_0xe38798][_0xa72e('0x56')]==_0xa72e('0x62')&&this['channels'][_0x135ccc[_0xa72e('0x29')]][_0xe38798][_0xa72e('0x18')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x135ccc[_0xa72e('0x29')],_0xe38798);this[_0xa72e('0xb')][_0x135ccc[_0xa72e('0x29')]][_0xe38798][_0xa72e('0x60')]=moment()[_0xa72e('0x2e')](_0xa72e('0x2f'));}}}logger[_0xa72e('0x2c')](_0xa72e('0x85'),_0x135ccc['uniqueid'],util[_0xa72e('0x3c')](_['values'](this[_0xa72e('0xb')][_0x135ccc[_0xa72e('0x29')]]),{'showHidden':![],'depth':null}));ami[_0xa72e('0x23')]('custom:voiceAgentReport',_['values'](this[_0xa72e('0xb')][_0x135ccc[_0xa72e('0x29')]]));delete this['channels'][_0x135ccc[_0xa72e('0x29')]];}if(this[_0xa72e('0xf')][_0x135ccc[_0xa72e('0x29')]]){delete this[_0xa72e('0xf')][_0x135ccc['uniqueid']];}}}catch(_0x49f3ca){logger[_0xa72e('0x52')](_0xa72e('0x86'),_0x135ccc['uniqueid'],util['inspect'](_0x49f3ca,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa72e('0x24')][_0xa72e('0x87')]=function(_0x36e1ab){try{if(this[_0xa72e('0x25')](_0x36e1ab)){logger[_0xa72e('0x2c')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x36e1ab[_0xa72e('0x29')],util[_0xa72e('0x3c')](_0x36e1ab,{'showHidden':![],'depth':null}));if(this['channels'][_0x36e1ab[_0xa72e('0x88')]]){for(var _0x79643e in this[_0xa72e('0xb')][_0x36e1ab[_0xa72e('0x88')]]){if(this[_0xa72e('0xb')][_0x36e1ab['transfereeuniqueid']]['hasOwnProperty'](_0x79643e)){if(_0x36e1ab[_0xa72e('0x89')]===_0x79643e){logger[_0xa72e('0x27')](_0xa72e('0x8a'),_0x36e1ab['uniqueid'],this[_0xa72e('0xb')][_0x36e1ab[_0xa72e('0x88')]][_0x79643e][_0xa72e('0x2a')],_0x79643e);var _0x380b15=moment();this['channels'][_0x36e1ab['transfereeuniqueid']][_0x79643e]['agentcomplete']=!![];this['channels'][_0x36e1ab[_0xa72e('0x88')]][_0x79643e][_0xa72e('0x60')]=moment()[_0xa72e('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa72e('0xb')][_0x36e1ab[_0xa72e('0x88')]][_0x79643e][_0xa72e('0x4e')]=_0xa72e('0x61');this[_0xa72e('0xb')][_0x36e1ab['transfereeuniqueid']][_0x79643e]['reason']=_0xa72e('0x62');this[_0xa72e('0xb')][_0x36e1ab[_0xa72e('0x88')]][_0x79643e]['talktime']=_0x380b15['diff'](this['channels'][_0x36e1ab[_0xa72e('0x88')]][_0x79643e][_0xa72e('0x42')],_0xa72e('0x8b'));}}}}if(this[_0xa72e('0xb')][_0x36e1ab[_0xa72e('0x8c')]]){var _0x4a2ef7=this[_0xa72e('0xb')][_0x36e1ab[_0xa72e('0x8c')]];this[_0xa72e('0xb')][_0x36e1ab[_0xa72e('0x8c')]]=this[_0xa72e('0xb')][_0x36e1ab[_0xa72e('0x88')]];this[_0xa72e('0xb')][_0x36e1ab[_0xa72e('0x88')]]=_0x4a2ef7;}}}catch(_0x5be73b){logger[_0xa72e('0x52')]('[%s][voiceAgentReport][attendedtransfer]',_0x36e1ab[_0xa72e('0x29')],util['inspect'](_0x5be73b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa72e('0x24')][_0xa72e('0x22')]=function(_0x4cb1d6){try{if(this[_0xa72e('0x25')](_0x4cb1d6)){logger[_0xa72e('0x2c')](_0xa72e('0x8d'),_0x4cb1d6[_0xa72e('0x29')],util[_0xa72e('0x3c')](_0x4cb1d6,{'showHidden':![],'depth':null}));if(this['channels'][_0x4cb1d6['transfereeuniqueid']]){for(var _0x380776 in this[_0xa72e('0xb')][_0x4cb1d6[_0xa72e('0x88')]]){if(this[_0xa72e('0xb')][_0x4cb1d6[_0xa72e('0x88')]]['hasOwnProperty'](_0x380776)){if(_0x4cb1d6[_0xa72e('0x8e')]===_0x380776){logger[_0xa72e('0x27')](_0xa72e('0x8f'),_0x4cb1d6[_0xa72e('0x29')],this['channels'][_0x4cb1d6['transfereeuniqueid']][_0x380776][_0xa72e('0x2a')],_0x380776);var _0x31a3a9=moment();this[_0xa72e('0xb')][_0x4cb1d6['transfereeuniqueid']][_0x380776]['agentcomplete']=!![];this['channels'][_0x4cb1d6[_0xa72e('0x88')]][_0x380776][_0xa72e('0x60')]=_0x31a3a9;this[_0xa72e('0xb')][_0x4cb1d6['transfereeuniqueid']][_0x380776][_0xa72e('0x4e')]=_0xa72e('0x61');this[_0xa72e('0xb')][_0x4cb1d6[_0xa72e('0x88')]][_0x380776][_0xa72e('0x56')]=_0xa72e('0x62');this['channels'][_0x4cb1d6['transfereeuniqueid']][_0x380776][_0xa72e('0x64')]=_0x31a3a9[_0xa72e('0x90')](this[_0xa72e('0xb')][_0x4cb1d6[_0xa72e('0x88')]][_0x380776][_0xa72e('0x42')],_0xa72e('0x8b'));}}}}}}catch(_0x2d7cfe){logger[_0xa72e('0x52')]('[%s][voiceAgentReport][blindtransfer]',_0x4cb1d6[_0xa72e('0x29')],util['inspect'](_0x2d7cfe,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa72e('0x24')][_0xa72e('0x1d')]=function(_0x3e6995){var _0x590432='';try{if(this[_0xa72e('0x25')](_0x3e6995)){logger[_0xa72e('0x2c')](_0xa72e('0x91'),_0x3e6995[_0xa72e('0x29')],util[_0xa72e('0x3c')](_0x3e6995,{'showHidden':![],'depth':null}));if(_0x3e6995[_0xa72e('0x92')]){_0x590432=_0x3e6995['channel'][_0xa72e('0x93')](0x0,_0x3e6995[_0xa72e('0x92')][_0xa72e('0x94')]('-'));if(this[_0xa72e('0xe')][_0x590432]){logger['info']('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x3e6995[_0xa72e('0x29')],_0x590432);this['agents'][_0x590432]['onhold']=!![];}}}}catch(_0x1de755){logger[_0xa72e('0x52')](_0xa72e('0x95'),_0x3e6995[_0xa72e('0x29')],util['inspect'](_0x1de755,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa72e('0x24')][_0xa72e('0x1f')]=function(_0x55e4bb){var _0x13964d='';try{if(this[_0xa72e('0x25')](_0x55e4bb)){logger[_0xa72e('0x2c')](_0xa72e('0x96'),_0x55e4bb[_0xa72e('0x29')],util[_0xa72e('0x3c')](_0x55e4bb,{'showHidden':![],'depth':null}));if(_0x55e4bb['channel']){_0x13964d=_0x55e4bb[_0xa72e('0x92')][_0xa72e('0x93')](0x0,_0x55e4bb[_0xa72e('0x92')][_0xa72e('0x94')]('-'));if(this['agents'][_0x13964d]){logger[_0xa72e('0x27')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x55e4bb['uniqueid'],_0x13964d);this['agents'][_0x13964d]['onhold']=![];}}}}catch(_0x37dc92){logger['error'](_0xa72e('0x97'),_0x55e4bb['uniqueid'],util['inspect'](_0x37dc92,{'showHidden':![],'depth':null}));}};module[_0xa72e('0x98')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index a826a5f..60eb822 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 _0xa27c=['blindTransfers','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','path','ioredis','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringinuse','onhold','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncNewState','varset','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','linkedid','pick','context','from-sip','channel','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','name','user:agentconnect','split','[%s][voiceCallReport][newcallerid]','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','format','toNumber','merge','keys','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','disposition','includes','lastdata','startsWith','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','channelstate','membername','UserId','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','monitorFilename','find','isNil','rec','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','then','transferType','undefined','isEmpty','monitors','getSettings','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','finally','event','BlindTransfer','type','outbound'];(function(_0x47a0ee,_0xdbf0f){var _0x3b80fb=function(_0xd0d268){while(--_0xd0d268){_0x47a0ee['push'](_0x47a0ee['shift']());}};_0x3b80fb(++_0xdbf0f);}(_0xa27c,0x1bd));var _0xca27=function(_0x51bf55,_0x103497){_0x51bf55=_0x51bf55-0x0;var _0x5250b3=_0xa27c[_0x51bf55];return _0x5250b3;};'use strict';var BPromise=require(_0xca27('0x0'));var _=require(_0xca27('0x1'));var moment=require(_0xca27('0x2'));var util=require(_0xca27('0x3'));var path=require(_0xca27('0x4'));var Redis=require(_0xca27('0x5'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require(_0xca27('0x6'));var Channel=require(_0xca27('0x7'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0xca27('0x8'),_0xca27('0x9'),_0xca27('0xa'),_0xca27('0xb'),_0xca27('0xc'),_0xca27('0xd'),'ringing',_0xca27('0xe'),_0xca27('0xf')];var applications=['set',_0xca27('0x10'),_0xca27('0x11'),_0xca27('0x12'),_0xca27('0x13'),_0xca27('0x14')];var dispositions=['NO\x20ANSWER',_0xca27('0x15'),'FAILED','NO\x20ANSWER',_0xca27('0x16'),_0xca27('0x16'),_0xca27('0x17'),_0xca27('0x18'),_0xca27('0x15'),_0xca27('0x15'),_0xca27('0x15')];var actions={};config[_0xca27('0x19')]=_[_0xca27('0x1a')](config[_0xca27('0x19')],{'host':_0xca27('0x1b'),'port':0x18eb});var io=require(_0xca27('0x1c'))(new Redis(config[_0xca27('0x19')]));function VoiceCallReport(_0x4ce610){this[_0xca27('0x1d')]=_0x4ce610[_0xca27('0x1d')];this['agents']=_0x4ce610[_0xca27('0x1e')];this['blindTransfers']={};ami['on'](_0xca27('0x1f'),this[_0xca27('0x20')][_0xca27('0x21')](this));ami['on'](_0xca27('0x22'),this['syncNewExten']['bind'](this));ami['on'](_0xca27('0x23'),this[_0xca27('0x24')][_0xca27('0x21')](this));ami['on']('newstate',this[_0xca27('0x25')][_0xca27('0x21')](this));ami['on'](_0xca27('0x26'),this['syncVarSet'][_0xca27('0x21')](this));ami['on'](_0xca27('0x27'),this[_0xca27('0x28')][_0xca27('0x21')](this));ami['on'](_0xca27('0x29'),this[_0xca27('0x2a')]['bind'](this));ami['on'](_0xca27('0x2b'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xca27('0x2c'),this[_0xca27('0x2d')][_0xca27('0x21')](this));ami['on'](_0xca27('0x2e'),this[_0xca27('0x2f')][_0xca27('0x21')](this));ami['on'](_0xca27('0x30'),this[_0xca27('0x31')][_0xca27('0x21')](this));try{logger[_0xca27('0x32')](_0xca27('0x33'));ami[_0xca27('0x34')]();}catch(_0x5c3c8b){logger[_0xca27('0x35')](_0xca27('0x36'),util['inspect'](_0x5c3c8b,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xca27('0x37')]['isNotNull']=function(_0xdecf1b){return _0xdecf1b!==null&&!_[_0xca27('0x38')](_0xdecf1b);};VoiceCallReport['prototype'][_0xca27('0x39')]=function(_0x5539b8,_0xf24c05,_0x3c0a64){io['to'](_0x5539b8)[_0xca27('0x39')](_0xf24c05,_0x3c0a64);};VoiceCallReport[_0xca27('0x37')][_0xca27('0x2a')]=function(_0x367d48){try{if(this[_0xca27('0x3a')](_0x367d48)){logger[_0xca27('0x32')](_0xca27('0x3b'),_0x367d48[_0xca27('0x3c')],_0x367d48[_0xca27('0x3d')],_0x367d48[_0xca27('0x3e')]);logger[_0xca27('0x3f')](_0xca27('0x40'),_0x367d48[_0xca27('0x3c')],util[_0xca27('0x41')](_0x367d48,{'showHidden':![],'depth':null}));if(_0x367d48[_0xca27('0x3c')]===_0x367d48[_0xca27('0x42')]){if(!_[_0xca27('0x38')](this['channels'][_0x367d48['uniqueid']])){_['merge'](this['channels'][_0x367d48[_0xca27('0x3c')]],_[_0xca27('0x43')](_0x367d48,_['keys'](this[_0xca27('0x1d')][_0x367d48[_0xca27('0x3c')]])));}}if(_0x367d48[_0xca27('0x44')]===_0xca27('0x45')){if(this[_0xca27('0x1e')][_0x367d48[_0xca27('0x46')]['split']('-')[0x0]]){if(_0x367d48[_0xca27('0x47')]==_0xca27('0x48')){this[_0xca27('0x1e')][_0x367d48[_0xca27('0x46')]['split']('-')[0x0]][_0xca27('0x49')]=_0x367d48[_0xca27('0x4a')];this['emit'](util['format']('user:%s',this['agents'][_0x367d48[_0xca27('0x46')]['split']('-')[0x0]][_0xca27('0x4b')]),_0xca27('0x4c'),{'destaccountcode':this[_0xca27('0x1e')][_0x367d48[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x367d48[_0xca27('0x4a')]});}}}}}catch(_0x5dcfbb){logger['error'](_0xca27('0x4e'),_0x367d48[_0xca27('0x3c')],util['inspect'](_0x5dcfbb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xca27('0x37')][_0xca27('0x24')]=function(_0x29eebf){try{if(this[_0xca27('0x3a')](_0x29eebf)){logger[_0xca27('0x3f')]('[%s][voiceCallReport][newchannel]\x20event:',_0x29eebf[_0xca27('0x3c')],util[_0xca27('0x41')](_0x29eebf,{'showHidden':![],'depth':null}));if(_0x29eebf[_0xca27('0x3c')]===_0x29eebf[_0xca27('0x42')]&&_0x29eebf[_0xca27('0x46')]!=_0xca27('0x4f')){if(_['isUndefined'](this[_0xca27('0x1d')][_0x29eebf[_0xca27('0x3c')]])){logger[_0xca27('0x32')](_0xca27('0x50'),_0x29eebf[_0xca27('0x3c')],_0x29eebf['context'],_0x29eebf[_0xca27('0x47')]);this[_0xca27('0x1d')][_0x29eebf[_0xca27('0x3c')]]=new Channel();this['channels'][_0x29eebf[_0xca27('0x3c')]][_0xca27('0x51')]=moment()[_0xca27('0x52')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xca27('0x1d')][_0x29eebf['uniqueid']]['disposition']=dispositions[_[_0xca27('0x53')](_0x29eebf['channelstate'])];_[_0xca27('0x54')](this[_0xca27('0x1d')][_0x29eebf[_0xca27('0x3c')]],_[_0xca27('0x43')](_0x29eebf,_[_0xca27('0x55')](this[_0xca27('0x1d')][_0x29eebf[_0xca27('0x3c')]])));if(_0x29eebf[_0xca27('0x44')]===_0xca27('0x45')){if(this[_0xca27('0x1e')][_0x29eebf[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]]){if(_[_0xca27('0x38')](this[_0xca27('0x1e')][_0x29eebf['channel'][_0xca27('0x4d')]('-')[0x0]][_0xca27('0x49')])){this['agents'][_0x29eebf[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]]['destconnectedlinenum']=_0x29eebf['exten'];logger['debug'](_0xca27('0x56'),_0x29eebf[_0xca27('0x3c')],util[_0xca27('0x41')]({'destaccountcode':this[_0xca27('0x1e')][_0x29eebf[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]][_0xca27('0x57')],'destconnectedlinenum':_0x29eebf[_0xca27('0x47')]},{'showHidden':![],'depth':null}));this[_0xca27('0x39')](util[_0xca27('0x52')](_0xca27('0x58'),this['agents'][_0x29eebf[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]]['name']),_0xca27('0x4c'),{'destaccountcode':this[_0xca27('0x1e')][_0x29eebf[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x29eebf[_0xca27('0x47')]});}}}}}}}catch(_0x42731e){logger[_0xca27('0x35')](_0xca27('0x59'),_0x29eebf[_0xca27('0x3c')],util[_0xca27('0x41')](_0x42731e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xca27('0x20')]=function(_0x287a52){try{if(this['isNotNull'](_0x287a52)){logger[_0xca27('0x3f')](_0xca27('0x5a'),_0x287a52[_0xca27('0x3c')],util['inspect'](_0x287a52,{'showHidden':![],'depth':null}));if(_0x287a52['uniqueid']===_0x287a52['linkedid']&&_0x287a52[_0xca27('0x47')]!='h'&&_0x287a52[_0xca27('0x46')]!=_0xca27('0x4f')){_0x287a52[_0xca27('0x5b')]=_0x287a52['application'][_0xca27('0x5c')]();_0x287a52[_0xca27('0x5d')]=_0x287a52['appdata']&&_0x287a52[_0xca27('0x5e')]['startsWith'](_0xca27('0x5f'))?_0x287a52[_0xca27('0x5e')]:(_0x287a52['appdata']||_0x287a52['applicationdata'])[_0xca27('0x5c')]();logger[_0xca27('0x32')](_0xca27('0x60'),_0x287a52[_0xca27('0x3c')],_0x287a52['application'],_0x287a52[_0xca27('0x5d')]);if(_[_0xca27('0x38')](this[_0xca27('0x1d')][_0x287a52[_0xca27('0x3c')]])){this[_0xca27('0x1d')][_0x287a52['uniqueid']]=new Channel();this[_0xca27('0x1d')][_0x287a52['uniqueid']][_0xca27('0x51')]=_0x287a52[_0xca27('0x61')]?moment()['subtract'](moment[_0xca27('0x61')](_0x287a52['duration'])[_0xca27('0x62')](),_0xca27('0x62'))[_0xca27('0x52')](_0xca27('0x63')):moment()[_0xca27('0x52')](_0xca27('0x63'));this['channels'][_0x287a52[_0xca27('0x3c')]][_0xca27('0x64')]=_0xca27('0x16');}_['merge'](this[_0xca27('0x1d')][_0x287a52[_0xca27('0x3c')]],_[_0xca27('0x43')](_0x287a52,_[_0xca27('0x55')](this[_0xca27('0x1d')][_0x287a52[_0xca27('0x3c')]])));if(_[_0xca27('0x65')](applications,_0x287a52[_0xca27('0x5b')])){this[_0xca27('0x1d')][_0x287a52['uniqueid']]['lastapplication']=_0x287a52[_0xca27('0x5b')];this[_0xca27('0x1d')][_0x287a52[_0xca27('0x3c')]][_0xca27('0x66')]=_0x287a52[_0xca27('0x5d')];if(_0x287a52[_0xca27('0x5b')]==='set'&&_[_0xca27('0x67')](_0x287a52[_0xca27('0x5d')][_0xca27('0x5c')](),'cdr(')){var _0x3a9828=_0x287a52['applicationdata'][_0xca27('0x4d')]('=');var _0x42ddc6=_0x3a9828[0x0]['toLowerCase']()[_0xca27('0x68')](/cdr\((.*)\)/);if(_0x42ddc6){this[_0xca27('0x1d')][_0x287a52['uniqueid']][_0x42ddc6[0x1]]=_0x3a9828[0x1];}}else if(_0x287a52[_0xca27('0x5b')]===_0xca27('0x10')){this[_0xca27('0x1d')][_0x287a52[_0xca27('0x3c')]]['queue']=_0x287a52[_0xca27('0x5d')]['split'](',')[0x0];}}}}}catch(_0x4c79f9){logger[_0xca27('0x35')](_0xca27('0x69'),_0x287a52['uniqueid'],util[_0xca27('0x41')](_0x4c79f9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xca27('0x37')][_0xca27('0x25')]=function(_0xf17d42){try{if(this[_0xca27('0x3a')](_0xf17d42)){logger[_0xca27('0x32')](_0xca27('0x6a'),_0xf17d42[_0xca27('0x3c')],_0xf17d42['linkedid'],_0xf17d42[_0xca27('0x3d')],_0xf17d42['calleridnum']);logger[_0xca27('0x3f')]('[%s][voiceCallReport][newstate]\x20event:',_0xf17d42[_0xca27('0x3c')],util[_0xca27('0x41')](_0xf17d42,{'showHidden':![],'depth':null}));if(_0xf17d42[_0xca27('0x3c')]!==_0xf17d42['linkedid']){if(this[_0xca27('0x1d')][_0xf17d42[_0xca27('0x42')]]){if(_0xf17d42['channelstate']==='6'){if(!this[_0xca27('0x1d')][_0xf17d42[_0xca27('0x42')]][_0xca27('0x6b')]){var _0x2a1e76=moment();this['channels'][_0xf17d42[_0xca27('0x42')]][_0xca27('0x6b')]=!![];this[_0xca27('0x1d')][_0xf17d42[_0xca27('0x42')]][_0xca27('0x6c')]=_0x2a1e76[_0xca27('0x52')](_0xca27('0x63'));if(this[_0xca27('0x1d')][_0xf17d42[_0xca27('0x42')]][_0xca27('0x51')]){this[_0xca27('0x1d')][_0xf17d42[_0xca27('0x42')]][_0xca27('0x6d')]=_0x2a1e76[_0xca27('0x6e')](this[_0xca27('0x1d')][_0xf17d42[_0xca27('0x42')]]['starttime'],_0xca27('0x62'));}}this[_0xca27('0x1d')][_0xf17d42['linkedid']][_0xca27('0x42')]=_0xf17d42[_0xca27('0x3c')];if(_0xf17d42[_0xca27('0x3e')]!=='xcally-motion-preview'){this[_0xca27('0x1d')][_0xf17d42['linkedid']][_0xca27('0x4a')]=_0xf17d42[_0xca27('0x3e')];}this[_0xca27('0x1d')][_0xf17d42[_0xca27('0x42')]][_0xca27('0x6f')]=_0xf17d42[_0xca27('0x3d')];this['channels'][_0xf17d42['linkedid']][_0xca27('0x70')]=_0xf17d42[_0xca27('0x46')];this[_0xca27('0x1d')][_0xf17d42['linkedid']]['disposition']=dispositions[_[_0xca27('0x53')](_0xf17d42[_0xca27('0x71')])];if(this[_0xca27('0x1e')][_0xf17d42['channel'][_0xca27('0x4d')]('-')[0x0]]){this[_0xca27('0x1d')][_0xf17d42[_0xca27('0x42')]]['UserId']=this[_0xca27('0x1e')][_0xf17d42[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]]['id'];this[_0xca27('0x1d')][_0xf17d42['linkedid']][_0xca27('0x72')]=this[_0xca27('0x1e')][_0xf17d42[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]]['name'];}}}}else{if(this['channels'][_0xf17d42[_0xca27('0x3c')]]){if(_0xf17d42[_0xca27('0x71')]==='6'){if(this[_0xca27('0x1e')][_0xf17d42[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]]){this['channels'][_0xf17d42[_0xca27('0x3c')]][_0xca27('0x73')]=this[_0xca27('0x1e')][_0xf17d42['channel'][_0xca27('0x4d')]('-')[0x0]]['id'];this[_0xca27('0x1d')][_0xf17d42[_0xca27('0x3c')]]['membername']=this[_0xca27('0x1e')][_0xf17d42[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]][_0xca27('0x4b')];}}}}if(_0xf17d42[_0xca27('0x71')]==='6'&&_0xf17d42['context']==='from-sip'){if(this[_0xca27('0x1e')][_0xf17d42[_0xca27('0x46')]['split']('-')[0x0]]){this['agents'][_0xf17d42[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]][_0xca27('0x49')]=_0xf17d42[_0xca27('0x47')];var _0x472e32;if(this[_0xca27('0x1d')][_0xf17d42['uniqueid']])_0x472e32=this[_0xca27('0x1d')][_0xf17d42['uniqueid']][_0xca27('0x74')];else if(this['channels'][_0xf17d42[_0xca27('0x42')]])_0x472e32=this[_0xca27('0x1d')][_0xf17d42[_0xca27('0x42')]][_0xca27('0x74')];logger[_0xca27('0x3f')](_0xca27('0x75'),_0xf17d42[_0xca27('0x3c')],util[_0xca27('0x41')]({'destaccountcode':this[_0xca27('0x1e')][_0xf17d42[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]][_0xca27('0x57')],'destconnectedlinenum':_0xf17d42['exten'],'routealias':_0x472e32},{'showHidden':![],'depth':null}));this[_0xca27('0x39')](util[_0xca27('0x52')](_0xca27('0x58'),this[_0xca27('0x1e')][_0xf17d42[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]]['name']),_0xca27('0x4c'),{'destaccountcode':this[_0xca27('0x1e')][_0xf17d42['channel'][_0xca27('0x4d')]('-')[0x0]][_0xca27('0x57')],'destconnectedlinenum':_0xf17d42[_0xca27('0x47')],'routealias':_0x472e32});}}}}catch(_0x4ab61b){logger[_0xca27('0x35')](_0xca27('0x76'),_0xf17d42[_0xca27('0x3c')],util[_0xca27('0x41')](_0x4ab61b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xca27('0x77')]=function(_0x5aa2f3,_0x237ed4){try{if(this[_0xca27('0x1d')][_0x5aa2f3]){logger[_0xca27('0x32')](_0xca27('0x78'),_0x5aa2f3,_0x237ed4);this['channels'][_0x5aa2f3][_0xca27('0x79')]=!![];if(_[_0xca27('0x7a')](_0x237ed4,_0xca27('0x7b'))){_0x237ed4=_0x237ed4['replace'](_0xca27('0x7b'),'.WAV');}this[_0xca27('0x1d')][_0x5aa2f3][_0xca27('0x7c')]=_0x237ed4;var _0x1d8fd9=_[_0xca27('0x7d')](this[_0xca27('0x1d')][_0x5aa2f3]['monitors'],{'filename':_0x237ed4});if(_[_0xca27('0x7e')](_0x1d8fd9)){this[_0xca27('0x1d')][_0x5aa2f3]['monitors']['push']({'filename':_0x237ed4,'createdAt':moment()[_0xca27('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xca27('0x7f')});}}}catch(_0x18d96){logger[_0xca27('0x35')]('[%s][voiceCallReport][mixMonitorFilename]',_0x5aa2f3,util['inspect'](_0x18d96,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xca27('0x80')]=function(_0x29d155){try{if(this[_0xca27('0x3a')](_0x29d155)){logger[_0xca27('0x3f')](_0xca27('0x81'),_0x29d155[_0xca27('0x3c')],util[_0xca27('0x41')](_0x29d155,{'showHidden':![],'depth':null}));if(this['channels'][_0x29d155[_0xca27('0x3c')]]&&_0x29d155[_0xca27('0x46')]!=_0xca27('0x4f')){if(this[_0xca27('0x3a')](_0x29d155[_0xca27('0x82')])){if(this[_0xca27('0x3a')](_0x29d155[_0xca27('0x82')][_0xca27('0x83')])){logger[_0xca27('0x32')](_0xca27('0x84'),_0x29d155[_0xca27('0x3c')],_0x29d155[_0xca27('0x85')]);this[_0xca27('0x77')](_0x29d155[_0xca27('0x3c')],_0x29d155[_0xca27('0x85')]);}else if(this[_0xca27('0x3a')](_0x29d155[_0xca27('0x82')][_0xca27('0x86')])){logger['info'](_0xca27('0x87'),_0x29d155[_0xca27('0x3c')],_0x29d155[_0xca27('0x85')]);this[_0xca27('0x1d')][_0x29d155['uniqueid']][_0xca27('0x3e')]=_0x29d155[_0xca27('0x85')];}else if(this[_0xca27('0x3a')](_0x29d155['variable']['xmd-callerid'])){logger[_0xca27('0x32')](_0xca27('0x88'),_0x29d155[_0xca27('0x3c')],_0x29d155[_0xca27('0x85')]);this[_0xca27('0x1d')][_0x29d155[_0xca27('0x3c')]]['callerid']=_0x29d155[_0xca27('0x85')];}else if(this['isNotNull'](_0x29d155[_0xca27('0x82')][_0xca27('0x89')])){logger[_0xca27('0x32')](_0xca27('0x8a'),_0x29d155[_0xca27('0x3c')],_0x29d155[_0xca27('0x85')]);this[_0xca27('0x1d')][_0x29d155[_0xca27('0x3c')]]['type']=_0x29d155[_0xca27('0x85')];}else if(this['isNotNull'](_0x29d155[_0xca27('0x82')][_0xca27('0x8b')])){logger[_0xca27('0x32')](_0xca27('0x8c'),_0x29d155['uniqueid'],_0x29d155['value'][_0xca27('0x4d')](',')[0x0]);this[_0xca27('0x1d')][_0x29d155[_0xca27('0x3c')]][_0xca27('0x10')]=_0x29d155[_0xca27('0x85')][_0xca27('0x4d')](',')[0x0];}else if(this[_0xca27('0x3a')](_0x29d155[_0xca27('0x82')]['xmd-originatecalleridnum'])){logger[_0xca27('0x32')](_0xca27('0x8d'),_0x29d155[_0xca27('0x3c')],_0x29d155[_0xca27('0x85')]);this[_0xca27('0x1d')][_0x29d155[_0xca27('0x3c')]][_0xca27('0x8e')]=_0x29d155['value'];}else if(this[_0xca27('0x3a')](_0x29d155['variable'][_0xca27('0x8f')])){logger[_0xca27('0x32')](_0xca27('0x90'),_0x29d155[_0xca27('0x3c')],_0x29d155[_0xca27('0x85')]);this[_0xca27('0x1d')][_0x29d155[_0xca27('0x3c')]][_0xca27('0x91')]=_0x29d155['value'];}else if(this[_0xca27('0x3a')](_0x29d155[_0xca27('0x82')][_0xca27('0x92')])){logger[_0xca27('0x32')](_0xca27('0x93'),_0x29d155['uniqueid'],_0x29d155[_0xca27('0x85')]);this[_0xca27('0x1d')][_0x29d155[_0xca27('0x3c')]][_0xca27('0x94')]=_0x29d155[_0xca27('0x85')];}else if(this[_0xca27('0x3a')](_0x29d155[_0xca27('0x82')]['xmcs-queue'])){logger[_0xca27('0x32')](_0xca27('0x95'),_0x29d155['uniqueid'],_0x29d155['value']);this[_0xca27('0x1d')][_0x29d155[_0xca27('0x3c')]][_0xca27('0x10')]=_0x29d155['value'];}else if(this['isNotNull'](_0x29d155[_0xca27('0x82')][_0xca27('0x96')])){logger[_0xca27('0x32')](_0xca27('0x97'),_0x29d155[_0xca27('0x3c')],_0x29d155[_0xca27('0x85')]);this[_0xca27('0x1d')][_0x29d155[_0xca27('0x3c')]]['sipcalluniqueid']=_0x29d155[_0xca27('0x85')];}}}else if(this[_0xca27('0x3a')](_0x29d155['variable']['mixmonitor_filename'])){if(_0x29d155[_0xca27('0x85')]){var _0x12e050=path['parse'](_0x29d155[_0xca27('0x85')])['name'];logger[_0xca27('0x32')](_0xca27('0x84'),_0x12e050,_0x29d155[_0xca27('0x85')]);this[_0xca27('0x77')](_0x12e050,_0x29d155[_0xca27('0x85')]);}}else if(this[_0xca27('0x1d')][_0x29d155[_0xca27('0x42')]]){if(this[_0xca27('0x3a')](_0x29d155[_0xca27('0x82')])){if(this[_0xca27('0x3a')](_0x29d155[_0xca27('0x82')][_0xca27('0x96')])){logger[_0xca27('0x32')](_0xca27('0x97'),_0x29d155[_0xca27('0x42')],_0x29d155['value']);this['channels'][_0x29d155[_0xca27('0x42')]]['sipcalllinkedid']=_0x29d155[_0xca27('0x85')];}}}}}catch(_0x272a8b){logger[_0xca27('0x35')](_0xca27('0x98'),_0x29d155[_0xca27('0x3c')],util[_0xca27('0x41')](_0x272a8b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xca27('0x37')][_0xca27('0x28')]=function(_0x181bcd){try{if(this[_0xca27('0x3a')](_0x181bcd)){logger[_0xca27('0x3f')](_0xca27('0x99'),_0x181bcd[_0xca27('0x3c')],util[_0xca27('0x41')](_0x181bcd,{'showHidden':![],'depth':null}));if(this[_0xca27('0x1d')][_0x181bcd[_0xca27('0x3c')]]){logger[_0xca27('0x32')](_0xca27('0x9a'),_0x181bcd[_0xca27('0x3c')],_0x181bcd['cause-txt']);var _0x1123bb=moment();this[_0xca27('0x1d')][_0x181bcd['uniqueid']][_0xca27('0x9b')]=_0x1123bb[_0xca27('0x52')](_0xca27('0x63'));this[_0xca27('0x1d')][_0x181bcd[_0xca27('0x3c')]][_0xca27('0x61')]=_0x1123bb[_0xca27('0x6e')](this[_0xca27('0x1d')][_0x181bcd['uniqueid']][_0xca27('0x51')],'seconds');if(this['channels'][_0x181bcd['uniqueid']][_0xca27('0x6b')]){this[_0xca27('0x1d')][_0x181bcd[_0xca27('0x3c')]]['billableseconds']=_0x1123bb[_0xca27('0x6e')](this[_0xca27('0x1d')][_0x181bcd[_0xca27('0x3c')]]['answertime'],_0xca27('0x62'));this['channels'][_0x181bcd[_0xca27('0x3c')]][_0xca27('0x6d')]=this[_0xca27('0x1d')][_0x181bcd[_0xca27('0x3c')]][_0xca27('0x61')]-this[_0xca27('0x1d')][_0x181bcd[_0xca27('0x3c')]]['billableseconds'];}if(_0x181bcd['context']===_0xca27('0x45')){if(this['agents'][_0x181bcd[_0xca27('0x46')]['split']('-')[0x0]]){this[_0xca27('0x1e')][_0x181bcd[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]]=_['omit'](this['agents'][_0x181bcd[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]],['destconnectedlinenum']);logger[_0xca27('0x3f')](_0xca27('0x9c'),_0x181bcd[_0xca27('0x3c')],util['inspect']({'id':this[_0xca27('0x1e')][_0x181bcd[_0xca27('0x46')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xca27('0x1e')][_0x181bcd['channel']['split']('-')[0x0]][_0xca27('0x57')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xca27('0x52')](_0xca27('0x58'),this[_0xca27('0x1e')][_0x181bcd[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]]['name']),_0xca27('0x9d'),{'id':this[_0xca27('0x1e')][_0x181bcd['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0xca27('0x1e')][_0x181bcd[_0xca27('0x46')][_0xca27('0x4d')]('-')[0x0]][_0xca27('0x57')]});}}var _0x3f0880=this;Promise['resolve']()[_0xca27('0x9e')](function(){var _0x4eb474=_0x3f0880[_0xca27('0x1d')][_0x181bcd[_0xca27('0x3c')]];if(typeof _0x4eb474[_0xca27('0x9f')]===_0xca27('0xa0'))return;if(_[_0xca27('0xa1')](_0x4eb474[_0xca27('0xa2')]))return;return RpcSetting[_0xca27('0xa3')]()[_0xca27('0x9e')](function(_0x258b13){if(!_0x258b13[_0xca27('0xa4')])return;return Promise[_0xca27('0xa5')]()[_0xca27('0x9e')](function(){return ami[_0xca27('0xa6')]({'action':_0xca27('0xa7'),'channel':_0x4eb474[_0xca27('0x46')]})['catch'](function(){});})[_0xca27('0x9e')](function(){return ami[_0xca27('0xa6')]({'action':_0xca27('0xa7'),'channel':_0x4eb474['destinationchannel']})['catch'](function(){})[_0xca27('0xa8')](function(){var _0x364aa1=_0x3f0880['agents'][_0x4eb474[_0xca27('0x70')][_0xca27('0x4d')]('-')[0x0]];if(!_0x364aa1)return;io[_0xca27('0x39')]('webbar:stopmonitors',{'agentId':_0x364aa1['id'],'uniqueid':_0x4eb474[_0xca27('0x3c')]});});});});})[_0xca27('0x9e')](function(){if(_0x181bcd[_0xca27('0xa9')]===_0xca27('0xaa')){_0x3f0880['blindTransfers'][_0x181bcd[_0xca27('0x3c')]]=_0x3f0880[_0xca27('0x1d')][_0x181bcd[_0xca27('0x3c')]];}else{if(_0x3f0880[_0xca27('0x1d')][_0x181bcd[_0xca27('0x3c')]][_0xca27('0xab')]===_0xca27('0xac')&&_0x3f0880[_0xca27('0xad')][_0x181bcd[_0xca27('0x3c')]]){_0x3f0880[_0xca27('0x1d')][_0x181bcd['uniqueid']][_0xca27('0x3c')]=[_0x3f0880['channels'][_0x181bcd['uniqueid']][_0xca27('0x42')],_0x3f0880['channels'][_0x181bcd[_0xca27('0x3c')]][_0xca27('0x42')]=_0x3f0880[_0xca27('0x1d')][_0x181bcd[_0xca27('0x3c')]][_0xca27('0x3c')]][0x0];delete _0x3f0880[_0xca27('0xad')][_0x181bcd[_0xca27('0x3c')]];}}logger[_0xca27('0x3f')](_0xca27('0xae'),_0x181bcd[_0xca27('0x3c')],util[_0xca27('0x41')](_0x3f0880['channels'][_0x181bcd['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xca27('0x39')](_0xca27('0xaf'),_0x3f0880['channels'][_0x181bcd[_0xca27('0x3c')]]);delete _0x3f0880[_0xca27('0x1d')][_0x181bcd['uniqueid']];});}}}catch(_0x5c23df){logger[_0xca27('0x35')]('[%s][voiceCallReport][hangup]',_0x181bcd['uniqueid'],util[_0xca27('0x41')](_0x5c23df,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xca27('0x37')][_0xca27('0xb0')]=function(_0x501465){try{if(this[_0xca27('0x3a')](_0x501465)){logger[_0xca27('0x32')](_0xca27('0xb1'),_0x501465[_0xca27('0x3c')],_0x501465[_0xca27('0xb2')],_0x501465['transfertargetcalleridnum']);logger[_0xca27('0x3f')](_0xca27('0xb3'),_0x501465['uniqueid'],util[_0xca27('0x41')](_0x501465,{'showHidden':![],'depth':null}));if(this[_0xca27('0x1d')][_0x501465['transfereeuniqueid']]){this[_0xca27('0x1d')][_0x501465[_0xca27('0xb4')]][_0xca27('0xb5')]=_0x501465[_0xca27('0xb2')];this[_0xca27('0x1d')][_0x501465['transfereeuniqueid']]['transferconnectedlinenum']=_0x501465[_0xca27('0xb6')];if(this['channels'][_0x501465[_0xca27('0xb7')]]){var _0x4ddda0=this[_0xca27('0x1d')][_0x501465[_0xca27('0xb7')]];this[_0xca27('0x1d')][_0x501465[_0xca27('0xb7')]]=this[_0xca27('0x1d')][_0x501465[_0xca27('0xb4')]];this[_0xca27('0x1d')][_0x501465['transfereeuniqueid']]=_0x4ddda0;}}else if(this['channels'][_0x501465[_0xca27('0xb8')]]){this[_0xca27('0x1d')][_0x501465[_0xca27('0xb8')]]['transfercalleridnum']=_0x501465[_0xca27('0xb2')];this[_0xca27('0x1d')][_0x501465['transfertargetuniqueid']][_0xca27('0xb9')]=_0x501465[_0xca27('0xb6')];if(this[_0xca27('0x1d')][_0x501465['origtransfereruniqueid']]){var _0x4ddda0=this[_0xca27('0x1d')][_0x501465['origtransfereruniqueid']];this[_0xca27('0x1d')][_0x501465[_0xca27('0xba')]]=this[_0xca27('0x1d')][_0x501465['transfertargetuniqueid']];this[_0xca27('0x1d')][_0x501465[_0xca27('0xb8')]]=_0x4ddda0;}}if((this[_0xca27('0x1d')][_0x501465[_0xca27('0xba')]]||this[_0xca27('0x1d')][_0x501465[_0xca27('0xbb')]])&&this['channels'][_0x501465[_0xca27('0xb7')]]){var _0x28f7ea=_[_0xca27('0xbc')]([this[_0xca27('0x1d')][_0x501465[_0xca27('0xba')]],this[_0xca27('0x1d')][_0x501465['origtransfererlinkedid']],this[_0xca27('0x1d')][_0x501465[_0xca27('0xb7')]]],function(_0x5c3e0b){return _0x5c3e0b&&_0x5c3e0b['type']==='outbound'&&_0x5c3e0b[_0xca27('0xbd')];});if(_0x28f7ea){if(this[_0xca27('0x1d')][_0x501465['origtransfereruniqueid']])this[_0xca27('0x1d')][_0x501465['origtransfereruniqueid']][_0xca27('0x9f')]=_0xca27('0xbe');if(this[_0xca27('0x1d')][_0x501465[_0xca27('0xbb')]])this['channels'][_0x501465[_0xca27('0xbb')]][_0xca27('0x9f')]=_0xca27('0xbe');this['channels'][_0x501465[_0xca27('0xb7')]][_0xca27('0x9f')]='ATTENDED';}}}}catch(_0x4e5804){logger[_0xca27('0x35')]('[%s][voiceCallReport][attendedtransfer]',_0x501465[_0xca27('0x3c')],util[_0xca27('0x41')](_0x4e5804,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xca27('0x37')][_0xca27('0x2d')]=function(_0x35bb3b){try{if(this['isNotNull'](_0x35bb3b)){logger['info'](_0xca27('0xbf'),_0x35bb3b[_0xca27('0x3c')],_0x35bb3b[_0xca27('0xc0')],_0x35bb3b['extension']);logger[_0xca27('0x3f')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x35bb3b['uniqueid'],util[_0xca27('0x41')](_0x35bb3b,{'showHidden':![],'depth':null}));if(this[_0xca27('0x1d')][_0x35bb3b[_0xca27('0xb4')]]){this['channels'][_0x35bb3b[_0xca27('0xb4')]][_0xca27('0xb5')]=_0x35bb3b['transfereecalleridnum'];this[_0xca27('0x1d')][_0x35bb3b[_0xca27('0xb4')]][_0xca27('0xb9')]=_0x35bb3b['extension'];this[_0xca27('0x1d')][_0x35bb3b['transfereeuniqueid']][_0xca27('0x9f')]=_0xca27('0xc1');this[_0xca27('0x28')]({'event':_0xca27('0xaa'),'uniqueid':_0x35bb3b['transfereeuniqueid'],'context':_0x35bb3b[_0xca27('0x44')],'channel':_0x35bb3b[_0xca27('0xc2')]});}else{this[_0xca27('0x1d')][_0x35bb3b[_0xca27('0xc3')]][_0xca27('0x9f')]=_0xca27('0xc1');}}}catch(_0x47d4c8){logger[_0xca27('0x35')]('[%s][voiceCallReport][blindtransfer]',_0x35bb3b['uniqueid'],util['inspect'](_0x47d4c8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xca27('0x37')][_0xca27('0x2f')]=function(_0x59142d){try{if(this[_0xca27('0x3a')](_0x59142d)){logger[_0xca27('0x3f')](_0xca27('0xc4'),_0x59142d[_0xca27('0x3c')],util[_0xca27('0x41')](_0x59142d,{'showHidden':![],'depth':null}));if(this['channels'][_0x59142d['uniqueid']]){if(!_[_0xca27('0x7e')](this['channels'][_0x59142d[_0xca27('0x3c')]][_0xca27('0x6c')])){this[_0xca27('0x1d')][_0x59142d[_0xca27('0x3c')]]['mohstarttime']=moment()[_0xca27('0x52')](_0xca27('0x63'));logger[_0xca27('0x32')](_0xca27('0xc5'),_0x59142d[_0xca27('0x3c')],this[_0xca27('0x1d')][_0x59142d[_0xca27('0x3c')]][_0xca27('0xc6')]);}}}}catch(_0xde5683){logger['error'](_0xca27('0xc7'),_0x59142d[_0xca27('0x3c')],util['inspect'](_0xde5683,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xca27('0x31')]=function(_0x4e24be){try{if(this[_0xca27('0x3a')](_0x4e24be)){logger[_0xca27('0x3f')](_0xca27('0xc8'),_0x4e24be[_0xca27('0x3c')],util[_0xca27('0x41')](_0x4e24be,{'showHidden':![],'depth':null}));if(this['channels'][_0x4e24be[_0xca27('0x3c')]]){if(!_[_0xca27('0x7e')](this['channels'][_0x4e24be[_0xca27('0x3c')]][_0xca27('0xc6')])){this[_0xca27('0x1d')][_0x4e24be[_0xca27('0x3c')]][_0xca27('0xc9')]+=moment()[_0xca27('0xca')](0x0)[_0xca27('0x6e')](this['channels'][_0x4e24be[_0xca27('0x3c')]][_0xca27('0xc6')],_0xca27('0x62'));logger['info'](_0xca27('0xcb'),_0x4e24be['uniqueid'],this[_0xca27('0x1d')][_0x4e24be[_0xca27('0x3c')]]['mohtime']);delete this[_0xca27('0x1d')][_0x4e24be['uniqueid']][_0xca27('0xc6')];}}}}catch(_0x1e85b8){logger['error'](_0xca27('0xcc'),_0x4e24be[_0xca27('0x3c')],util[_0xca27('0x41')](_0x1e85b8,{'showHidden':![],'depth':null}));}};module[_0xca27('0xcd')]=VoiceCallReport; \ No newline at end of file +var _0x7b5b=['milliseconds','[%s][voiceCallReport][musiconholdstop]','bluebird','path','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','ringinuse','onhold','set','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','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','from-sip','split','exten','channel','destconnectedlinenum','connectedlinenum','format','user:%s','name','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','starttime','toNumber','channelstate','context','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','appdata','startsWith','CDR(routeAlias)','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','disposition','keys','includes','lastapplication','match','queue','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','xcally-motion-preview','connectedlinename','destinationchannel','UserId','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','monitorFilename','find','isNil','monitors','push','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','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','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','diff','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','resolve','then','transferType','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','outbound','routeid','ATTENDED','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7b5b,0x19e));var _0xb7b5=function(_0x27e5e5,_0x5b2978){_0x27e5e5=_0x27e5e5-0x0;var _0x27a4e1=_0x7b5b[_0x27e5e5];return _0x27a4e1;};'use strict';var BPromise=require(_0xb7b5('0x0'));var _=require('lodash');var moment=require('moment');var util=require('util');var path=require(_0xb7b5('0x1'));var Redis=require(_0xb7b5('0x2'));var config=require(_0xb7b5('0x3'));var logger=require(_0xb7b5('0x4'))('ami');var ami=require(_0xb7b5('0x5'));var Channel=require(_0xb7b5('0x6'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0xb7b5('0x7'),_0xb7b5('0x8'),_0xb7b5('0x9'),_0xb7b5('0xa'),_0xb7b5('0xb'),'unavailable','ringing',_0xb7b5('0xc'),_0xb7b5('0xd')];var applications=[_0xb7b5('0xe'),'queue','agi',_0xb7b5('0xf'),_0xb7b5('0x10'),_0xb7b5('0x11')];var dispositions=[_0xb7b5('0x12'),'FAILED',_0xb7b5('0x13'),_0xb7b5('0x12'),_0xb7b5('0x12'),_0xb7b5('0x12'),_0xb7b5('0x14'),_0xb7b5('0x15'),'FAILED','FAILED','FAILED'];var actions={};config['redis']=_[_0xb7b5('0x16')](config[_0xb7b5('0x17')],{'host':_0xb7b5('0x18'),'port':0x18eb});var io=require(_0xb7b5('0x19'))(new Redis(config[_0xb7b5('0x17')]));function VoiceCallReport(_0xfd812d){this[_0xb7b5('0x1a')]=_0xfd812d[_0xb7b5('0x1a')];this[_0xb7b5('0x1b')]=_0xfd812d[_0xb7b5('0x1b')];this[_0xb7b5('0x1c')]={};ami['on'](_0xb7b5('0x1d'),this[_0xb7b5('0x1e')][_0xb7b5('0x1f')](this));ami['on'](_0xb7b5('0x20'),this[_0xb7b5('0x1e')][_0xb7b5('0x1f')](this));ami['on'](_0xb7b5('0x21'),this[_0xb7b5('0x22')][_0xb7b5('0x1f')](this));ami['on'](_0xb7b5('0x23'),this[_0xb7b5('0x24')][_0xb7b5('0x1f')](this));ami['on'](_0xb7b5('0x25'),this[_0xb7b5('0x26')][_0xb7b5('0x1f')](this));ami['on'](_0xb7b5('0x27'),this[_0xb7b5('0x28')][_0xb7b5('0x1f')](this));ami['on'](_0xb7b5('0x29'),this['syncNewCallerId'][_0xb7b5('0x1f')](this));ami['on'](_0xb7b5('0x2a'),this[_0xb7b5('0x2b')]['bind'](this));ami['on'](_0xb7b5('0x2c'),this[_0xb7b5('0x2d')][_0xb7b5('0x1f')](this));ami['on']('musiconholdstart',this[_0xb7b5('0x2e')]['bind'](this));ami['on'](_0xb7b5('0x2f'),this[_0xb7b5('0x30')]['bind'](this));try{logger[_0xb7b5('0x31')](_0xb7b5('0x32'));ami[_0xb7b5('0x33')]();}catch(_0x239ec7){logger[_0xb7b5('0x34')](_0xb7b5('0x35'),util[_0xb7b5('0x36')](_0x239ec7,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xb7b5('0x37')][_0xb7b5('0x38')]=function(_0x356eb5){return _0x356eb5!==null&&!_[_0xb7b5('0x39')](_0x356eb5);};VoiceCallReport[_0xb7b5('0x37')][_0xb7b5('0x3a')]=function(_0x360b3f,_0x2e6c6e,_0x2d787b){io['to'](_0x360b3f)['emit'](_0x2e6c6e,_0x2d787b);};VoiceCallReport['prototype'][_0xb7b5('0x3b')]=function(_0x4355e5){try{if(this[_0xb7b5('0x38')](_0x4355e5)){logger[_0xb7b5('0x31')](_0xb7b5('0x3c'),_0x4355e5[_0xb7b5('0x3d')],_0x4355e5[_0xb7b5('0x3e')],_0x4355e5[_0xb7b5('0x3f')]);logger[_0xb7b5('0x40')](_0xb7b5('0x41'),_0x4355e5[_0xb7b5('0x3d')],util['inspect'](_0x4355e5,{'showHidden':![],'depth':null}));if(_0x4355e5[_0xb7b5('0x3d')]===_0x4355e5[_0xb7b5('0x42')]){if(!_[_0xb7b5('0x39')](this[_0xb7b5('0x1a')][_0x4355e5['uniqueid']])){_[_0xb7b5('0x43')](this['channels'][_0x4355e5[_0xb7b5('0x3d')]],_[_0xb7b5('0x44')](_0x4355e5,_['keys'](this[_0xb7b5('0x1a')][_0x4355e5[_0xb7b5('0x3d')]])));}}if(_0x4355e5['context']===_0xb7b5('0x45')){if(this[_0xb7b5('0x1b')][_0x4355e5['channel'][_0xb7b5('0x46')]('-')[0x0]]){if(_0x4355e5[_0xb7b5('0x47')]=='xcally-motion-preview'){this[_0xb7b5('0x1b')][_0x4355e5[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]][_0xb7b5('0x49')]=_0x4355e5[_0xb7b5('0x4a')];this[_0xb7b5('0x3a')](util[_0xb7b5('0x4b')](_0xb7b5('0x4c'),this[_0xb7b5('0x1b')][_0x4355e5[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]][_0xb7b5('0x4d')]),'user:agentconnect',{'destaccountcode':this['agents'][_0x4355e5[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]][_0xb7b5('0x4e')],'destconnectedlinenum':_0x4355e5[_0xb7b5('0x4a')]});}}}}}catch(_0x23e34c){logger[_0xb7b5('0x34')](_0xb7b5('0x4f'),_0x4355e5['uniqueid'],util[_0xb7b5('0x36')](_0x23e34c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7b5('0x37')][_0xb7b5('0x22')]=function(_0x2474e7){try{if(this[_0xb7b5('0x38')](_0x2474e7)){logger[_0xb7b5('0x40')](_0xb7b5('0x50'),_0x2474e7['uniqueid'],util['inspect'](_0x2474e7,{'showHidden':![],'depth':null}));if(_0x2474e7[_0xb7b5('0x3d')]===_0x2474e7['linkedid']&&_0x2474e7[_0xb7b5('0x48')]!=_0xb7b5('0x51')){if(_['isUndefined'](this['channels'][_0x2474e7[_0xb7b5('0x3d')]])){logger['info']('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x2474e7[_0xb7b5('0x3d')],_0x2474e7['context'],_0x2474e7[_0xb7b5('0x47')]);this[_0xb7b5('0x1a')][_0x2474e7['uniqueid']]=new Channel();this['channels'][_0x2474e7[_0xb7b5('0x3d')]][_0xb7b5('0x52')]=moment()[_0xb7b5('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb7b5('0x1a')][_0x2474e7[_0xb7b5('0x3d')]]['disposition']=dispositions[_[_0xb7b5('0x53')](_0x2474e7[_0xb7b5('0x54')])];_[_0xb7b5('0x43')](this['channels'][_0x2474e7[_0xb7b5('0x3d')]],_[_0xb7b5('0x44')](_0x2474e7,_['keys'](this[_0xb7b5('0x1a')][_0x2474e7[_0xb7b5('0x3d')]])));if(_0x2474e7[_0xb7b5('0x55')]==='from-sip'){if(this[_0xb7b5('0x1b')][_0x2474e7[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]]){if(_['isUndefined'](this[_0xb7b5('0x1b')][_0x2474e7['channel'][_0xb7b5('0x46')]('-')[0x0]][_0xb7b5('0x49')])){this['agents'][_0x2474e7[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]]['destconnectedlinenum']=_0x2474e7[_0xb7b5('0x47')];logger[_0xb7b5('0x40')](_0xb7b5('0x56'),_0x2474e7[_0xb7b5('0x3d')],util['inspect']({'destaccountcode':this[_0xb7b5('0x1b')][_0x2474e7[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2474e7[_0xb7b5('0x47')]},{'showHidden':![],'depth':null}));this[_0xb7b5('0x3a')](util[_0xb7b5('0x4b')](_0xb7b5('0x4c'),this[_0xb7b5('0x1b')][_0x2474e7[_0xb7b5('0x48')]['split']('-')[0x0]][_0xb7b5('0x4d')]),_0xb7b5('0x57'),{'destaccountcode':this[_0xb7b5('0x1b')][_0x2474e7[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]][_0xb7b5('0x4e')],'destconnectedlinenum':_0x2474e7['exten']});}}}}}}}catch(_0x2943c6){logger[_0xb7b5('0x34')]('[%s][voiceCallReport][newchannel]',_0x2474e7[_0xb7b5('0x3d')],util[_0xb7b5('0x36')](_0x2943c6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xb7b5('0x1e')]=function(_0x43bc81){try{if(this[_0xb7b5('0x38')](_0x43bc81)){logger[_0xb7b5('0x40')](_0xb7b5('0x58'),_0x43bc81[_0xb7b5('0x3d')],util['inspect'](_0x43bc81,{'showHidden':![],'depth':null}));if(_0x43bc81[_0xb7b5('0x3d')]===_0x43bc81[_0xb7b5('0x42')]&&_0x43bc81['exten']!='h'&&_0x43bc81[_0xb7b5('0x48')]!=_0xb7b5('0x51')){_0x43bc81['application']=_0x43bc81[_0xb7b5('0x59')][_0xb7b5('0x5a')]();_0x43bc81['applicationdata']=_0x43bc81['appdata']&&_0x43bc81[_0xb7b5('0x5b')][_0xb7b5('0x5c')](_0xb7b5('0x5d'))?_0x43bc81[_0xb7b5('0x5b')]:(_0x43bc81['appdata']||_0x43bc81[_0xb7b5('0x5e')])[_0xb7b5('0x5a')]();logger[_0xb7b5('0x31')](_0xb7b5('0x5f'),_0x43bc81[_0xb7b5('0x3d')],_0x43bc81['application'],_0x43bc81[_0xb7b5('0x5e')]);if(_[_0xb7b5('0x39')](this[_0xb7b5('0x1a')][_0x43bc81['uniqueid']])){this[_0xb7b5('0x1a')][_0x43bc81['uniqueid']]=new Channel();this[_0xb7b5('0x1a')][_0x43bc81[_0xb7b5('0x3d')]][_0xb7b5('0x52')]=_0x43bc81[_0xb7b5('0x60')]?moment()[_0xb7b5('0x61')](moment[_0xb7b5('0x60')](_0x43bc81[_0xb7b5('0x60')])[_0xb7b5('0x62')](),_0xb7b5('0x62'))[_0xb7b5('0x4b')](_0xb7b5('0x63')):moment()[_0xb7b5('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x43bc81['uniqueid']][_0xb7b5('0x64')]=_0xb7b5('0x12');}_['merge'](this['channels'][_0x43bc81[_0xb7b5('0x3d')]],_[_0xb7b5('0x44')](_0x43bc81,_[_0xb7b5('0x65')](this[_0xb7b5('0x1a')][_0x43bc81[_0xb7b5('0x3d')]])));if(_[_0xb7b5('0x66')](applications,_0x43bc81[_0xb7b5('0x59')])){this[_0xb7b5('0x1a')][_0x43bc81[_0xb7b5('0x3d')]][_0xb7b5('0x67')]=_0x43bc81[_0xb7b5('0x59')];this['channels'][_0x43bc81[_0xb7b5('0x3d')]]['lastdata']=_0x43bc81[_0xb7b5('0x5e')];if(_0x43bc81['application']===_0xb7b5('0xe')&&_[_0xb7b5('0x5c')](_0x43bc81[_0xb7b5('0x5e')][_0xb7b5('0x5a')](),'cdr(')){var _0x422a37=_0x43bc81[_0xb7b5('0x5e')]['split']('=');var _0x3e3b1e=_0x422a37[0x0]['toLowerCase']()[_0xb7b5('0x68')](/cdr\((.*)\)/);if(_0x3e3b1e){this[_0xb7b5('0x1a')][_0x43bc81['uniqueid']][_0x3e3b1e[0x1]]=_0x422a37[0x1];}}else if(_0x43bc81[_0xb7b5('0x59')]===_0xb7b5('0x69')){this[_0xb7b5('0x1a')][_0x43bc81[_0xb7b5('0x3d')]]['queue']=_0x43bc81[_0xb7b5('0x5e')]['split'](',')[0x0];}}}}}catch(_0x289484){logger[_0xb7b5('0x34')]('[%s][voiceCallReport][newexten]',_0x43bc81['uniqueid'],util[_0xb7b5('0x36')](_0x289484,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7b5('0x37')][_0xb7b5('0x24')]=function(_0x9193be){try{if(this['isNotNull'](_0x9193be)){logger[_0xb7b5('0x31')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x9193be['uniqueid'],_0x9193be[_0xb7b5('0x42')],_0x9193be[_0xb7b5('0x3e')],_0x9193be[_0xb7b5('0x3f')]);logger[_0xb7b5('0x40')](_0xb7b5('0x6a'),_0x9193be[_0xb7b5('0x3d')],util[_0xb7b5('0x36')](_0x9193be,{'showHidden':![],'depth':null}));if(_0x9193be['uniqueid']!==_0x9193be[_0xb7b5('0x42')]){if(this[_0xb7b5('0x1a')][_0x9193be[_0xb7b5('0x42')]]){if(_0x9193be[_0xb7b5('0x54')]==='6'){if(!this[_0xb7b5('0x1a')][_0x9193be[_0xb7b5('0x42')]][_0xb7b5('0x6b')]){var _0x2a3c46=moment();this[_0xb7b5('0x1a')][_0x9193be['linkedid']]['answered']=!![];this[_0xb7b5('0x1a')][_0x9193be[_0xb7b5('0x42')]][_0xb7b5('0x6c')]=_0x2a3c46[_0xb7b5('0x4b')](_0xb7b5('0x63'));if(this[_0xb7b5('0x1a')][_0x9193be[_0xb7b5('0x42')]][_0xb7b5('0x52')]){this[_0xb7b5('0x1a')][_0x9193be['linkedid']][_0xb7b5('0x6d')]=_0x2a3c46['diff'](this[_0xb7b5('0x1a')][_0x9193be['linkedid']]['starttime'],_0xb7b5('0x62'));}}this[_0xb7b5('0x1a')][_0x9193be[_0xb7b5('0x42')]][_0xb7b5('0x42')]=_0x9193be['uniqueid'];if(_0x9193be[_0xb7b5('0x3f')]!==_0xb7b5('0x6e')){this['channels'][_0x9193be[_0xb7b5('0x42')]][_0xb7b5('0x4a')]=_0x9193be[_0xb7b5('0x3f')];}this[_0xb7b5('0x1a')][_0x9193be[_0xb7b5('0x42')]][_0xb7b5('0x6f')]=_0x9193be['calleridname'];this['channels'][_0x9193be[_0xb7b5('0x42')]][_0xb7b5('0x70')]=_0x9193be[_0xb7b5('0x48')];this[_0xb7b5('0x1a')][_0x9193be[_0xb7b5('0x42')]][_0xb7b5('0x64')]=dispositions[_[_0xb7b5('0x53')](_0x9193be[_0xb7b5('0x54')])];if(this['agents'][_0x9193be[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]]){this['channels'][_0x9193be[_0xb7b5('0x42')]][_0xb7b5('0x71')]=this[_0xb7b5('0x1b')][_0x9193be[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]]['id'];this[_0xb7b5('0x1a')][_0x9193be[_0xb7b5('0x42')]]['membername']=this[_0xb7b5('0x1b')][_0x9193be[_0xb7b5('0x48')]['split']('-')[0x0]][_0xb7b5('0x4d')];}}}}else{if(this[_0xb7b5('0x1a')][_0x9193be[_0xb7b5('0x3d')]]){if(_0x9193be[_0xb7b5('0x54')]==='6'){if(this['agents'][_0x9193be[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]]){this[_0xb7b5('0x1a')][_0x9193be[_0xb7b5('0x3d')]][_0xb7b5('0x71')]=this[_0xb7b5('0x1b')][_0x9193be[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]]['id'];this['channels'][_0x9193be[_0xb7b5('0x3d')]]['membername']=this[_0xb7b5('0x1b')][_0x9193be['channel']['split']('-')[0x0]][_0xb7b5('0x4d')];}}}}if(_0x9193be['channelstate']==='6'&&_0x9193be[_0xb7b5('0x55')]===_0xb7b5('0x45')){if(this[_0xb7b5('0x1b')][_0x9193be[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]]){this[_0xb7b5('0x1b')][_0x9193be['channel'][_0xb7b5('0x46')]('-')[0x0]][_0xb7b5('0x49')]=_0x9193be[_0xb7b5('0x47')];var _0x3532d6;if(this['channels'][_0x9193be[_0xb7b5('0x3d')]])_0x3532d6=this[_0xb7b5('0x1a')][_0x9193be['uniqueid']][_0xb7b5('0x72')];else if(this['channels'][_0x9193be[_0xb7b5('0x42')]])_0x3532d6=this['channels'][_0x9193be[_0xb7b5('0x42')]][_0xb7b5('0x72')];logger['debug'](_0xb7b5('0x73'),_0x9193be['uniqueid'],util[_0xb7b5('0x36')]({'destaccountcode':this[_0xb7b5('0x1b')][_0x9193be[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]][_0xb7b5('0x4e')],'destconnectedlinenum':_0x9193be[_0xb7b5('0x47')],'routealias':_0x3532d6},{'showHidden':![],'depth':null}));this[_0xb7b5('0x3a')](util[_0xb7b5('0x4b')](_0xb7b5('0x4c'),this['agents'][_0x9193be[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]][_0xb7b5('0x4d')]),_0xb7b5('0x57'),{'destaccountcode':this[_0xb7b5('0x1b')][_0x9193be['channel']['split']('-')[0x0]][_0xb7b5('0x4e')],'destconnectedlinenum':_0x9193be[_0xb7b5('0x47')],'routealias':_0x3532d6});}}}}catch(_0x3b4355){logger[_0xb7b5('0x34')](_0xb7b5('0x74'),_0x9193be[_0xb7b5('0x3d')],util['inspect'](_0x3b4355,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7b5('0x37')][_0xb7b5('0x75')]=function(_0x497152,_0x3c600){try{if(this[_0xb7b5('0x1a')][_0x497152]){logger['info']('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x497152,_0x3c600);this['channels'][_0x497152][_0xb7b5('0x76')]=!![];if(_[_0xb7b5('0x77')](_0x3c600,_0xb7b5('0x78'))){_0x3c600=_0x3c600['replace'](_0xb7b5('0x78'),'.WAV');}this['channels'][_0x497152][_0xb7b5('0x79')]=_0x3c600;var _0x64f95c=_[_0xb7b5('0x7a')](this[_0xb7b5('0x1a')][_0x497152]['monitors'],{'filename':_0x3c600});if(_[_0xb7b5('0x7b')](_0x64f95c)){this[_0xb7b5('0x1a')][_0x497152][_0xb7b5('0x7c')][_0xb7b5('0x7d')]({'filename':_0x3c600,'createdAt':moment()[_0xb7b5('0x4b')](_0xb7b5('0x63')),'mixmonitorid':'','status':'rec'});}}}catch(_0x714086){logger[_0xb7b5('0x34')](_0xb7b5('0x7e'),_0x497152,util[_0xb7b5('0x36')](_0x714086,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7b5('0x37')][_0xb7b5('0x26')]=function(_0x4749a1){try{if(this['isNotNull'](_0x4749a1)){logger[_0xb7b5('0x40')](_0xb7b5('0x7f'),_0x4749a1[_0xb7b5('0x3d')],util[_0xb7b5('0x36')](_0x4749a1,{'showHidden':![],'depth':null}));if(this[_0xb7b5('0x1a')][_0x4749a1[_0xb7b5('0x3d')]]&&_0x4749a1[_0xb7b5('0x48')]!=_0xb7b5('0x51')){if(this['isNotNull'](_0x4749a1[_0xb7b5('0x80')])){if(this[_0xb7b5('0x38')](_0x4749a1[_0xb7b5('0x80')]['mixmonitor_filename'])){logger[_0xb7b5('0x31')](_0xb7b5('0x81'),_0x4749a1[_0xb7b5('0x3d')],_0x4749a1[_0xb7b5('0x82')]);this[_0xb7b5('0x75')](_0x4749a1['uniqueid'],_0x4749a1[_0xb7b5('0x82')]);}else if(this['isNotNull'](_0x4749a1[_0xb7b5('0x80')][_0xb7b5('0x83')])){logger[_0xb7b5('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x4749a1[_0xb7b5('0x3d')],_0x4749a1[_0xb7b5('0x82')]);this[_0xb7b5('0x1a')][_0x4749a1[_0xb7b5('0x3d')]][_0xb7b5('0x3f')]=_0x4749a1['value'];}else if(this['isNotNull'](_0x4749a1[_0xb7b5('0x80')][_0xb7b5('0x84')])){logger[_0xb7b5('0x31')](_0xb7b5('0x85'),_0x4749a1[_0xb7b5('0x3d')],_0x4749a1[_0xb7b5('0x82')]);this[_0xb7b5('0x1a')][_0x4749a1[_0xb7b5('0x3d')]][_0xb7b5('0x86')]=_0x4749a1[_0xb7b5('0x82')];}else if(this[_0xb7b5('0x38')](_0x4749a1[_0xb7b5('0x80')][_0xb7b5('0x87')])){logger[_0xb7b5('0x31')](_0xb7b5('0x88'),_0x4749a1[_0xb7b5('0x3d')],_0x4749a1['value']);this['channels'][_0x4749a1[_0xb7b5('0x3d')]][_0xb7b5('0x89')]=_0x4749a1[_0xb7b5('0x82')];}else if(this['isNotNull'](_0x4749a1['variable'][_0xb7b5('0x8a')])){logger[_0xb7b5('0x31')](_0xb7b5('0x8b'),_0x4749a1['uniqueid'],_0x4749a1['value']['split'](',')[0x0]);this[_0xb7b5('0x1a')][_0x4749a1[_0xb7b5('0x3d')]][_0xb7b5('0x69')]=_0x4749a1[_0xb7b5('0x82')][_0xb7b5('0x46')](',')[0x0];}else if(this[_0xb7b5('0x38')](_0x4749a1[_0xb7b5('0x80')][_0xb7b5('0x8c')])){logger['info'](_0xb7b5('0x8d'),_0x4749a1[_0xb7b5('0x3d')],_0x4749a1[_0xb7b5('0x82')]);this['channels'][_0x4749a1[_0xb7b5('0x3d')]][_0xb7b5('0x8e')]=_0x4749a1[_0xb7b5('0x82')];}else if(this[_0xb7b5('0x38')](_0x4749a1['variable'][_0xb7b5('0x8f')])){logger[_0xb7b5('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x4749a1['uniqueid'],_0x4749a1['value']);this['channels'][_0x4749a1['uniqueid']][_0xb7b5('0x90')]=_0x4749a1[_0xb7b5('0x82')];}else if(this[_0xb7b5('0x38')](_0x4749a1[_0xb7b5('0x80')][_0xb7b5('0x91')])){logger['info'](_0xb7b5('0x92'),_0x4749a1[_0xb7b5('0x3d')],_0x4749a1[_0xb7b5('0x82')]);this['channels'][_0x4749a1[_0xb7b5('0x3d')]]['calleridpreview']=_0x4749a1[_0xb7b5('0x82')];}else if(this['isNotNull'](_0x4749a1[_0xb7b5('0x80')][_0xb7b5('0x93')])){logger[_0xb7b5('0x31')](_0xb7b5('0x94'),_0x4749a1[_0xb7b5('0x3d')],_0x4749a1[_0xb7b5('0x82')]);this['channels'][_0x4749a1['uniqueid']][_0xb7b5('0x69')]=_0x4749a1[_0xb7b5('0x82')];}else if(this[_0xb7b5('0x38')](_0x4749a1['variable']['sipcallid'])){logger[_0xb7b5('0x31')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4749a1[_0xb7b5('0x3d')],_0x4749a1[_0xb7b5('0x82')]);this[_0xb7b5('0x1a')][_0x4749a1['uniqueid']][_0xb7b5('0x95')]=_0x4749a1['value'];}}}else if(this[_0xb7b5('0x38')](_0x4749a1['variable'][_0xb7b5('0x96')])){if(_0x4749a1[_0xb7b5('0x82')]){var _0x31b16b=path[_0xb7b5('0x97')](_0x4749a1[_0xb7b5('0x82')])[_0xb7b5('0x4d')];logger[_0xb7b5('0x31')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x31b16b,_0x4749a1[_0xb7b5('0x82')]);this['syncMixMonitorFilename'](_0x31b16b,_0x4749a1[_0xb7b5('0x82')]);}}else if(this[_0xb7b5('0x1a')][_0x4749a1['linkedid']]){if(this['isNotNull'](_0x4749a1[_0xb7b5('0x80')])){if(this[_0xb7b5('0x38')](_0x4749a1[_0xb7b5('0x80')][_0xb7b5('0x98')])){logger[_0xb7b5('0x31')](_0xb7b5('0x99'),_0x4749a1['linkedid'],_0x4749a1[_0xb7b5('0x82')]);this[_0xb7b5('0x1a')][_0x4749a1[_0xb7b5('0x42')]][_0xb7b5('0x9a')]=_0x4749a1[_0xb7b5('0x82')];}}}}}catch(_0x3390f0){logger[_0xb7b5('0x34')](_0xb7b5('0x9b'),_0x4749a1[_0xb7b5('0x3d')],util[_0xb7b5('0x36')](_0x3390f0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7b5('0x37')][_0xb7b5('0x28')]=function(_0x2a3231){try{if(this['isNotNull'](_0x2a3231)){logger['debug'](_0xb7b5('0x9c'),_0x2a3231[_0xb7b5('0x3d')],util['inspect'](_0x2a3231,{'showHidden':![],'depth':null}));if(this['channels'][_0x2a3231['uniqueid']]){logger[_0xb7b5('0x31')](_0xb7b5('0x9d'),_0x2a3231['uniqueid'],_0x2a3231['cause-txt']);var _0xab7ee7=moment();this[_0xb7b5('0x1a')][_0x2a3231['uniqueid']][_0xb7b5('0x9e')]=_0xab7ee7[_0xb7b5('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb7b5('0x1a')][_0x2a3231[_0xb7b5('0x3d')]]['duration']=_0xab7ee7[_0xb7b5('0x9f')](this[_0xb7b5('0x1a')][_0x2a3231[_0xb7b5('0x3d')]]['starttime'],_0xb7b5('0x62'));if(this[_0xb7b5('0x1a')][_0x2a3231[_0xb7b5('0x3d')]][_0xb7b5('0x6b')]){this[_0xb7b5('0x1a')][_0x2a3231[_0xb7b5('0x3d')]][_0xb7b5('0xa0')]=_0xab7ee7[_0xb7b5('0x9f')](this[_0xb7b5('0x1a')][_0x2a3231[_0xb7b5('0x3d')]][_0xb7b5('0x6c')],'seconds');this[_0xb7b5('0x1a')][_0x2a3231[_0xb7b5('0x3d')]][_0xb7b5('0x6d')]=this[_0xb7b5('0x1a')][_0x2a3231[_0xb7b5('0x3d')]][_0xb7b5('0x60')]-this[_0xb7b5('0x1a')][_0x2a3231['uniqueid']][_0xb7b5('0xa0')];}if(_0x2a3231[_0xb7b5('0x55')]==='from-sip'){if(this[_0xb7b5('0x1b')][_0x2a3231['channel'][_0xb7b5('0x46')]('-')[0x0]]){this['agents'][_0x2a3231[_0xb7b5('0x48')]['split']('-')[0x0]]=_[_0xb7b5('0xa1')](this[_0xb7b5('0x1b')][_0x2a3231[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]],[_0xb7b5('0x49')]);logger[_0xb7b5('0x40')](_0xb7b5('0xa2'),_0x2a3231[_0xb7b5('0x3d')],util['inspect']({'id':this[_0xb7b5('0x1b')][_0x2a3231[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]]['id'],'destaccountcode':this[_0xb7b5('0x1b')][_0x2a3231['channel']['split']('-')[0x0]][_0xb7b5('0x4e')]},{'showHidden':![],'depth':null}));this[_0xb7b5('0x3a')](util[_0xb7b5('0x4b')](_0xb7b5('0x4c'),this[_0xb7b5('0x1b')][_0x2a3231[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]][_0xb7b5('0x4d')]),'user:agentcomplete',{'id':this[_0xb7b5('0x1b')][_0x2a3231['channel'][_0xb7b5('0x46')]('-')[0x0]]['id'],'destaccountcode':this[_0xb7b5('0x1b')][_0x2a3231[_0xb7b5('0x48')][_0xb7b5('0x46')]('-')[0x0]][_0xb7b5('0x4e')]});}}var _0x22361a=this;Promise[_0xb7b5('0xa3')]()[_0xb7b5('0xa4')](function(){var _0x2fcd03=_0x22361a[_0xb7b5('0x1a')][_0x2a3231['uniqueid']];if(typeof _0x2fcd03[_0xb7b5('0xa5')]==='undefined')return;if(_['isEmpty'](_0x2fcd03[_0xb7b5('0x7c')]))return;return RpcSetting[_0xb7b5('0xa6')]()[_0xb7b5('0xa4')](function(_0x1d3bd4){if(!_0x1d3bd4[_0xb7b5('0xa7')])return;return Promise[_0xb7b5('0xa3')]()[_0xb7b5('0xa4')](function(){return ami[_0xb7b5('0xa8')]({'action':_0xb7b5('0xa9'),'channel':_0x2fcd03[_0xb7b5('0x48')]})[_0xb7b5('0xaa')](function(){});})['then'](function(){return ami[_0xb7b5('0xa8')]({'action':_0xb7b5('0xa9'),'channel':_0x2fcd03[_0xb7b5('0x70')]})[_0xb7b5('0xaa')](function(){})[_0xb7b5('0xab')](function(){var _0x16d1d2=_0x22361a[_0xb7b5('0x1b')][_0x2fcd03['destinationchannel']['split']('-')[0x0]];if(!_0x16d1d2)return;io[_0xb7b5('0x3a')](_0xb7b5('0xac'),{'agentId':_0x16d1d2['id'],'uniqueid':_0x2fcd03['uniqueid']});});});});})[_0xb7b5('0xa4')](function(){if(_0x2a3231[_0xb7b5('0xad')]===_0xb7b5('0xae')){_0x22361a['blindTransfers'][_0x2a3231['uniqueid']]=_0x22361a[_0xb7b5('0x1a')][_0x2a3231['uniqueid']];}else{if(_0x22361a[_0xb7b5('0x1a')][_0x2a3231[_0xb7b5('0x3d')]][_0xb7b5('0x89')]==='outbound'&&_0x22361a[_0xb7b5('0x1c')][_0x2a3231[_0xb7b5('0x3d')]]){_0x22361a[_0xb7b5('0x1a')][_0x2a3231[_0xb7b5('0x3d')]][_0xb7b5('0x3d')]=[_0x22361a['channels'][_0x2a3231[_0xb7b5('0x3d')]][_0xb7b5('0x42')],_0x22361a[_0xb7b5('0x1a')][_0x2a3231[_0xb7b5('0x3d')]][_0xb7b5('0x42')]=_0x22361a[_0xb7b5('0x1a')][_0x2a3231[_0xb7b5('0x3d')]][_0xb7b5('0x3d')]][0x0];delete _0x22361a[_0xb7b5('0x1c')][_0x2a3231['uniqueid']];}}logger[_0xb7b5('0x40')](_0xb7b5('0xaf'),_0x2a3231['uniqueid'],util[_0xb7b5('0x36')](_0x22361a[_0xb7b5('0x1a')][_0x2a3231[_0xb7b5('0x3d')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceCallReport',_0x22361a[_0xb7b5('0x1a')][_0x2a3231[_0xb7b5('0x3d')]]);delete _0x22361a[_0xb7b5('0x1a')][_0x2a3231[_0xb7b5('0x3d')]];});}}}catch(_0x4ca3f2){logger[_0xb7b5('0x34')](_0xb7b5('0xb0'),_0x2a3231[_0xb7b5('0x3d')],util[_0xb7b5('0x36')](_0x4ca3f2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7b5('0x37')][_0xb7b5('0x2b')]=function(_0x526840){try{if(this[_0xb7b5('0x38')](_0x526840)){logger[_0xb7b5('0x31')](_0xb7b5('0xb1'),_0x526840[_0xb7b5('0x3d')],_0x526840[_0xb7b5('0xb2')],_0x526840[_0xb7b5('0xb3')]);logger[_0xb7b5('0x40')](_0xb7b5('0xb4'),_0x526840[_0xb7b5('0x3d')],util[_0xb7b5('0x36')](_0x526840,{'showHidden':![],'depth':null}));if(this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xb5')]]){this[_0xb7b5('0x1a')][_0x526840['transfereeuniqueid']][_0xb7b5('0xb6')]=_0x526840[_0xb7b5('0xb2')];this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xb5')]]['transferconnectedlinenum']=_0x526840[_0xb7b5('0xb3')];if(this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xb7')]]){var _0x4721d7=this['channels'][_0x526840[_0xb7b5('0xb7')]];this['channels'][_0x526840[_0xb7b5('0xb7')]]=this[_0xb7b5('0x1a')][_0x526840['transfereeuniqueid']];this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xb5')]]=_0x4721d7;}}else if(this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xb8')]]){this['channels'][_0x526840[_0xb7b5('0xb8')]][_0xb7b5('0xb6')]=_0x526840[_0xb7b5('0xb2')];this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xb8')]][_0xb7b5('0xb9')]=_0x526840['transfertargetcalleridnum'];if(this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xba')]]){var _0x4721d7=this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xba')]];this['channels'][_0x526840[_0xb7b5('0xba')]]=this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xb8')]];this[_0xb7b5('0x1a')][_0x526840['transfertargetuniqueid']]=_0x4721d7;}}if((this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xba')]]||this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xbb')]])&&this['channels'][_0x526840[_0xb7b5('0xb7')]]){var _0xa4a16c=_['some']([this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xba')]],this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xbb')]],this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xb7')]]],function(_0x5f0982){return _0x5f0982&&_0x5f0982['type']===_0xb7b5('0xbc')&&_0x5f0982[_0xb7b5('0xbd')];});if(_0xa4a16c){if(this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xba')]])this['channels'][_0x526840[_0xb7b5('0xba')]][_0xb7b5('0xa5')]=_0xb7b5('0xbe');if(this['channels'][_0x526840['origtransfererlinkedid']])this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xbb')]][_0xb7b5('0xa5')]=_0xb7b5('0xbe');this[_0xb7b5('0x1a')][_0x526840[_0xb7b5('0xb7')]][_0xb7b5('0xa5')]=_0xb7b5('0xbe');}}}}catch(_0x5bfdcf){logger[_0xb7b5('0x34')]('[%s][voiceCallReport][attendedtransfer]',_0x526840[_0xb7b5('0x3d')],util[_0xb7b5('0x36')](_0x5bfdcf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7b5('0x37')][_0xb7b5('0x2d')]=function(_0x4e3525){try{if(this[_0xb7b5('0x38')](_0x4e3525)){logger[_0xb7b5('0x31')](_0xb7b5('0xbf'),_0x4e3525[_0xb7b5('0x3d')],_0x4e3525[_0xb7b5('0xc0')],_0x4e3525[_0xb7b5('0xc1')]);logger[_0xb7b5('0x40')](_0xb7b5('0xc2'),_0x4e3525['uniqueid'],util[_0xb7b5('0x36')](_0x4e3525,{'showHidden':![],'depth':null}));if(this['channels'][_0x4e3525[_0xb7b5('0xb5')]]){this['channels'][_0x4e3525['transfereeuniqueid']]['transfercalleridnum']=_0x4e3525[_0xb7b5('0xc0')];this[_0xb7b5('0x1a')][_0x4e3525[_0xb7b5('0xb5')]][_0xb7b5('0xb9')]=_0x4e3525['extension'];this[_0xb7b5('0x1a')][_0x4e3525[_0xb7b5('0xb5')]][_0xb7b5('0xa5')]='BLIND';this[_0xb7b5('0x28')]({'event':_0xb7b5('0xae'),'uniqueid':_0x4e3525[_0xb7b5('0xb5')],'context':_0x4e3525['context'],'channel':_0x4e3525[_0xb7b5('0xc3')]});}else{this['channels'][_0x4e3525[_0xb7b5('0xc4')]][_0xb7b5('0xa5')]='BLIND';}}}catch(_0x49f9aa){logger[_0xb7b5('0x34')](_0xb7b5('0xc5'),_0x4e3525[_0xb7b5('0x3d')],util[_0xb7b5('0x36')](_0x49f9aa,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7b5('0x37')]['syncMusicOnHoldStart']=function(_0x4f86a9){try{if(this['isNotNull'](_0x4f86a9)){logger[_0xb7b5('0x40')](_0xb7b5('0xc6'),_0x4f86a9['uniqueid'],util[_0xb7b5('0x36')](_0x4f86a9,{'showHidden':![],'depth':null}));if(this[_0xb7b5('0x1a')][_0x4f86a9[_0xb7b5('0x3d')]]){if(!_[_0xb7b5('0x7b')](this[_0xb7b5('0x1a')][_0x4f86a9[_0xb7b5('0x3d')]][_0xb7b5('0x6c')])){this[_0xb7b5('0x1a')][_0x4f86a9['uniqueid']][_0xb7b5('0xc7')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xb7b5('0x31')](_0xb7b5('0xc8'),_0x4f86a9['uniqueid'],this[_0xb7b5('0x1a')][_0x4f86a9[_0xb7b5('0x3d')]][_0xb7b5('0xc7')]);}}}}catch(_0x2f3a8c){logger[_0xb7b5('0x34')](_0xb7b5('0xc9'),_0x4f86a9[_0xb7b5('0x3d')],util['inspect'](_0x2f3a8c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb7b5('0x37')][_0xb7b5('0x30')]=function(_0x49bf5c){try{if(this['isNotNull'](_0x49bf5c)){logger[_0xb7b5('0x40')](_0xb7b5('0xca'),_0x49bf5c[_0xb7b5('0x3d')],util[_0xb7b5('0x36')](_0x49bf5c,{'showHidden':![],'depth':null}));if(this['channels'][_0x49bf5c[_0xb7b5('0x3d')]]){if(!_['isNil'](this[_0xb7b5('0x1a')][_0x49bf5c[_0xb7b5('0x3d')]][_0xb7b5('0xc7')])){this[_0xb7b5('0x1a')][_0x49bf5c[_0xb7b5('0x3d')]][_0xb7b5('0xcb')]+=moment()[_0xb7b5('0xcc')](0x0)['diff'](this['channels'][_0x49bf5c['uniqueid']]['mohstarttime'],_0xb7b5('0x62'));logger[_0xb7b5('0x31')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x49bf5c['uniqueid'],this[_0xb7b5('0x1a')][_0x49bf5c[_0xb7b5('0x3d')]][_0xb7b5('0xcb')]);delete this['channels'][_0x49bf5c[_0xb7b5('0x3d')]][_0xb7b5('0xc7')];}}}}catch(_0x4b6dc1){logger[_0xb7b5('0x34')](_0xb7b5('0xcd'),_0x49bf5c[_0xb7b5('0x3d')],util['inspect'](_0x4b6dc1,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 8b8c0ff..2ca5b7c 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 _0xdec8=['rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','starttime','seconds','complete','answered','holdtime','diff','sumBillable','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','set','applicationdata','appdata','toLowerCase','startsWith','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outbound','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','syncNewExten','syncHangup','prototype','emit','isNotNull','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','applications','merge','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','value','outboundrouteid','isUndefined','variables','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged'];(function(_0x5e71ec,_0x420604){var _0x3c3eb5=function(_0x26570d){while(--_0x26570d){_0x5e71ec['push'](_0x5e71ec['shift']());}};_0x3c3eb5(++_0x420604);}(_0xdec8,0x194));var _0x8dec=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xdec8[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x8dec('0x0'));var moment=require(_0x8dec('0x1'));var util=require(_0x8dec('0x2'));var Redis=require('ioredis');var config=require(_0x8dec('0x3'));var logger=require('../../../config/logger')(_0x8dec('0x4'));var ami=require(_0x8dec('0x5'));config[_0x8dec('0x6')]=_[_0x8dec('0x7')](config[_0x8dec('0x6')],{'host':_0x8dec('0x8'),'port':0x18eb});var io=require(_0x8dec('0x9'))(new Redis(config[_0x8dec('0x6')]));function VoiceDialReport(_0x377bbe){this[_0x8dec('0xa')]=_0x377bbe['outboundChannels'];this[_0x8dec('0xb')]=_0x377bbe[_0x8dec('0xb')];this['applications']={};this['variables']={};ami['on'](_0x8dec('0xc'),this[_0x8dec('0xd')][_0x8dec('0xe')](this));ami['on']('dialend',this[_0x8dec('0xf')][_0x8dec('0xe')](this));ami['on'](_0x8dec('0x10'),this[_0x8dec('0x11')]['bind'](this));ami['on']('newexten',this[_0x8dec('0x12')][_0x8dec('0xe')](this));ami['on']('hangup',this[_0x8dec('0x13')]['bind'](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x3d8432){return _0x3d8432!==null&&!_['isUndefined'](_0x3d8432);};VoiceDialReport[_0x8dec('0x14')][_0x8dec('0x15')]=function(_0x1622ff,_0x4c7c81,_0x442182){io['to'](_0x1622ff)[_0x8dec('0x15')](_0x4c7c81,_0x442182);};VoiceDialReport[_0x8dec('0x14')][_0x8dec('0xd')]=function(_0x4f7307){try{if(this[_0x8dec('0x16')](_0x4f7307)){logger['debug'](_0x8dec('0x17'),_0x4f7307[_0x8dec('0x18')],util['inspect'](_0x4f7307,{'showHidden':![],'depth':null}));if(this[_0x8dec('0xa')][_0x4f7307[_0x8dec('0x18')]]){_['merge'](this[_0x8dec('0xa')][_0x4f7307[_0x8dec('0x18')]],{'starttime':moment()[_0x8dec('0x19')](_0x8dec('0x1a')),'lastevent':_0x8dec('0x1b'),'interface':_0x4f7307[_0x8dec('0x1c')][_0x8dec('0x1d')](0x0,_0x4f7307[_0x8dec('0x1c')][_0x8dec('0x1e')]('-')),'membername':_0x4f7307[_0x8dec('0x1c')][_0x8dec('0x1d')](_0x4f7307[_0x8dec('0x1c')][_0x8dec('0x1e')]('/')+0x1,_0x4f7307[_0x8dec('0x1c')][_0x8dec('0x1e')]('-'))},_[_0x8dec('0x1f')](_0x4f7307,[_0x8dec('0x20'),_0x8dec('0x21')]));logger[_0x8dec('0x22')](_0x8dec('0x23'),_0x4f7307['uniqueid'],this[_0x8dec('0xa')][_0x4f7307['uniqueid']][_0x8dec('0x24')],this[_0x8dec('0xa')][_0x4f7307[_0x8dec('0x18')]][_0x8dec('0x25')]);logger[_0x8dec('0x26')](_0x8dec('0x27'),_0x4f7307[_0x8dec('0x18')],util[_0x8dec('0x28')](this[_0x8dec('0xa')][_0x4f7307['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x8dec('0x29')][_0x4f7307[_0x8dec('0x18')]])_[_0x8dec('0x2a')](this['channels'][_0x4f7307[_0x8dec('0x18')]],this[_0x8dec('0x29')][_0x4f7307[_0x8dec('0x18')]]);this['emit'](_0x8dec('0x2b'),'voice_outbound_channel:save',this['channels'][_0x4f7307[_0x8dec('0x18')]]);logger[_0x8dec('0x26')](_0x8dec('0x2c'),_0x4f7307[_0x8dec('0x18')],util[_0x8dec('0x28')](this[_0x8dec('0xa')][_0x4f7307[_0x8dec('0x18')]],{'showHidden':![],'depth':null}));ami[_0x8dec('0x15')](_0x8dec('0x2d'),this[_0x8dec('0xa')][_0x4f7307[_0x8dec('0x18')]]);}}}catch(_0xde47f4){logger[_0x8dec('0x2e')](_0x8dec('0x2f'),_0x4f7307[_0x8dec('0x18')],util[_0x8dec('0x28')](_0xde47f4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8dec('0x14')][_0x8dec('0xf')]=function(_0x32962e){try{if(this[_0x8dec('0x16')](_0x32962e)){logger[_0x8dec('0x26')](_0x8dec('0x30'),_0x32962e['uniqueid'],util['inspect'](_0x32962e,{'showHidden':![],'depth':null}));if(this[_0x8dec('0xa')][_0x32962e[_0x8dec('0x18')]]){this[_0x8dec('0xa')][_0x32962e[_0x8dec('0x18')]][_0x8dec('0x31')]=_0x32962e['dialstatus'];if(_0x32962e[_0x8dec('0x31')]===_0x8dec('0x32')){this['channels'][_0x32962e[_0x8dec('0x18')]][_0x8dec('0x33')]=_0x32962e[_0x8dec('0x33')];this['channels'][_0x32962e[_0x8dec('0x18')]]['connectedlinename']=_0x32962e[_0x8dec('0x34')];this[_0x8dec('0xa')][_0x32962e[_0x8dec('0x18')]][_0x8dec('0x35')]=moment()[_0x8dec('0x19')](_0x8dec('0x1a'));this['channels'][_0x32962e['uniqueid']][_0x8dec('0x36')]=_0x8dec('0x37');logger[_0x8dec('0x22')](_0x8dec('0x38'),_0x32962e[_0x8dec('0x18')],_0x32962e[_0x8dec('0x1c')]['substring'](_0x32962e[_0x8dec('0x1c')][_0x8dec('0x1e')]('/')+0x1,_0x32962e[_0x8dec('0x1c')][_0x8dec('0x1e')]('-')));logger['debug'](_0x8dec('0x39'),_0x32962e['uniqueid'],util['inspect'](this['channels'][_0x32962e['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x8dec('0x15')](_0x8dec('0x3a'),this[_0x8dec('0xa')][_0x32962e[_0x8dec('0x18')]]);}logger[_0x8dec('0x26')](_0x8dec('0x3b'),_0x32962e[_0x8dec('0x18')],util[_0x8dec('0x28')](this[_0x8dec('0xa')][_0x32962e['uniqueid']],{'showHidden':![],'depth':null}));this[_0x8dec('0x15')](_0x8dec('0x2b'),'voice_outbound_channel:save',this[_0x8dec('0xa')][_0x32962e[_0x8dec('0x18')]]);}}}catch(_0x485834){logger[_0x8dec('0x2e')](_0x8dec('0x3c'),_0x32962e[_0x8dec('0x18')],util[_0x8dec('0x28')](_0x485834,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8dec('0x14')]['syncVarSet']=function(_0x13e7c9){try{if(this[_0x8dec('0x16')](_0x13e7c9)){logger['debug'](_0x8dec('0x3d'),_0x13e7c9['uniqueid'],util[_0x8dec('0x28')](_0x13e7c9,{'showHidden':![],'depth':null}));this[_0x8dec('0x3e')](_0x13e7c9[_0x8dec('0x18')],_['keys'](_0x13e7c9[_0x8dec('0x3f')])[0x0],_0x13e7c9[_0x8dec('0x40')]);if(this[_0x8dec('0x16')](_0x13e7c9[_0x8dec('0x3f')])&&this[_0x8dec('0x16')](_0x13e7c9['variable'][_0x8dec('0x41')])){if(_[_0x8dec('0x42')](this[_0x8dec('0xa')][_0x13e7c9['uniqueid']])){this[_0x8dec('0xa')][_0x13e7c9[_0x8dec('0x18')]]={'routeId':_0x13e7c9['value'],'variables':this[_0x8dec('0x43')][_0x13e7c9[_0x8dec('0x18')]],'motionChannel':_0x8dec('0x44')};logger[_0x8dec('0x22')](_0x8dec('0x45'),_0x13e7c9[_0x8dec('0x18')],_0x13e7c9[_0x8dec('0x3f')]['outboundrouteid'],_[_0x8dec('0x46')](_0x13e7c9[_0x8dec('0x3f')])[0x0],_0x13e7c9['value']);logger[_0x8dec('0x26')](_0x8dec('0x47'),_0x13e7c9['uniqueid'],util[_0x8dec('0x28')](this[_0x8dec('0xa')][_0x13e7c9[_0x8dec('0x18')]],{'showHidden':![],'depth':null}));this['emit'](_0x8dec('0x2b'),_0x8dec('0x48'),this[_0x8dec('0xa')][_0x13e7c9[_0x8dec('0x18')]]);}}}}catch(_0x343e9b){logger[_0x8dec('0x2e')](_0x8dec('0x49'),_0x13e7c9[_0x8dec('0x18')],util[_0x8dec('0x28')](_0x343e9b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8dec('0x14')][_0x8dec('0x3e')]=function(_0x413054,_0x37bdd1,_0x3be0f1){var _0x519d6a=[_0x8dec('0x4a'),_0x8dec('0x4b'),_0x8dec('0x4c'),'rtpaudioqosjitterbridged',_0x8dec('0x4d'),_0x8dec('0x4e'),_0x8dec('0x4f'),_0x8dec('0x50'),_0x8dec('0x51'),_0x8dec('0x52'),'bridgepeer','bridgepvtcallid',_0x8dec('0x53'),'memberdynamic',_0x8dec('0x54'),_0x8dec('0x55'),_0x8dec('0x24'),_0x8dec('0x56'),_0x8dec('0x57')];if(!_['isNil'](_0x37bdd1)&&!_[_0x8dec('0x58')](_0x519d6a,_0x37bdd1)){if(_['isUndefined'](this[_0x8dec('0x43')][_0x413054])){this[_0x8dec('0x43')][_0x413054]={};}this[_0x8dec('0x43')][_0x413054][_0x37bdd1]=_0x3be0f1;}};VoiceDialReport[_0x8dec('0x14')]['syncHangup']=function(_0x279459){try{if(this[_0x8dec('0x16')](_0x279459)){logger[_0x8dec('0x26')]('[%s][voiceDialReport][hangup]\x20event:',_0x279459[_0x8dec('0x18')],util[_0x8dec('0x28')](_0x279459,{'showHidden':![],'depth':null}));if(this['channels'][_0x279459[_0x8dec('0x18')]]){logger[_0x8dec('0x22')](_0x8dec('0x59'),_0x279459[_0x8dec('0x18')],_0x279459['cause-txt']);this[_0x8dec('0xa')][_0x279459[_0x8dec('0x18')]][_0x8dec('0x5a')]=moment()[_0x8dec('0x19')](_0x8dec('0x1a'));this['channels'][_0x279459[_0x8dec('0x18')]]['duration']=moment(this[_0x8dec('0xa')][_0x279459[_0x8dec('0x18')]][_0x8dec('0x5a')])['diff'](this[_0x8dec('0xa')][_0x279459[_0x8dec('0x18')]][_0x8dec('0x5b')],_0x8dec('0x5c'));this[_0x8dec('0xa')][_0x279459[_0x8dec('0x18')]][_0x8dec('0x36')]=_0x8dec('0x5d');this[_0x8dec('0xb')]['total']+=0x1;if(this['channels'][_0x279459[_0x8dec('0x18')]][_0x8dec('0x35')]){this[_0x8dec('0xb')][_0x8dec('0x5e')]+=0x1;this[_0x8dec('0xa')][_0x279459[_0x8dec('0x18')]][_0x8dec('0x5f')]=moment(this[_0x8dec('0xa')][_0x279459['uniqueid']][_0x8dec('0x35')])['diff'](this['channels'][_0x279459[_0x8dec('0x18')]][_0x8dec('0x5b')],_0x8dec('0x5c'));this[_0x8dec('0xa')][_0x279459[_0x8dec('0x18')]]['billableseconds']=moment(this[_0x8dec('0xa')][_0x279459[_0x8dec('0x18')]][_0x8dec('0x5a')])[_0x8dec('0x60')](this['channels'][_0x279459[_0x8dec('0x18')]]['answertime'],'seconds');this['outbound']['sumHoldTime']+=this[_0x8dec('0xa')][_0x279459[_0x8dec('0x18')]][_0x8dec('0x5f')]||0x0;this['outbound'][_0x8dec('0x61')]+=this[_0x8dec('0xa')][_0x279459[_0x8dec('0x18')]]['billableseconds'];}this[_0x8dec('0xb')][_0x8dec('0x62')]+=this[_0x8dec('0xa')][_0x279459['uniqueid']][_0x8dec('0x63')];logger[_0x8dec('0x26')](_0x8dec('0x64'),_0x279459[_0x8dec('0x18')],util[_0x8dec('0x28')](this['channels'][_0x279459[_0x8dec('0x18')]],{'showHidden':![],'depth':null}));ami[_0x8dec('0x15')]('custom:voiceDialReport',this[_0x8dec('0xa')][_0x279459[_0x8dec('0x18')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x279459[_0x8dec('0x18')],util[_0x8dec('0x28')](this[_0x8dec('0xa')][_0x279459['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x8dec('0x15')](_0x8dec('0x65'),this[_0x8dec('0xa')][_0x279459[_0x8dec('0x18')]]);logger[_0x8dec('0x26')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x279459['uniqueid'],util[_0x8dec('0x28')](this[_0x8dec('0xa')][_0x279459['uniqueid']],{'showHidden':![],'depth':null}));this[_0x8dec('0x15')](_0x8dec('0x2b'),_0x8dec('0x66'),this[_0x8dec('0xb')]);logger[_0x8dec('0x22')](_0x8dec('0x67'),JSON[_0x8dec('0x68')](this[_0x8dec('0xa')][_0x279459[_0x8dec('0x18')]]));logger[_0x8dec('0x26')](_0x8dec('0x69'),_0x279459[_0x8dec('0x18')],util[_0x8dec('0x28')](this['channels'][_0x279459[_0x8dec('0x18')]],{'showHidden':![],'depth':null}));this[_0x8dec('0x15')]('voice:outbound',_0x8dec('0x6a'),this['channels'][_0x279459[_0x8dec('0x18')]]);delete this[_0x8dec('0xa')][_0x279459[_0x8dec('0x18')]];}else if(this['channels'][_0x279459['linkedid']]){this['channels'][_0x279459['linkedid']][_0x8dec('0x18')]=this[_0x8dec('0xa')][_0x279459['linkedid']][_0x8dec('0x6b')];}if(this[_0x8dec('0x43')][_0x279459[_0x8dec('0x18')]]){delete this[_0x8dec('0x43')][_0x279459[_0x8dec('0x18')]];}}}catch(_0x536fc7){logger[_0x8dec('0x2e')](_0x8dec('0x6c'),_0x279459['uniqueid'],util[_0x8dec('0x28')](_0x536fc7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8dec('0x14')]['syncNewExten']=function(_0x1d1e22){try{if(this[_0x8dec('0x16')](_0x1d1e22)){logger['debug'](_0x8dec('0x6d'),_0x1d1e22[_0x8dec('0x18')],util[_0x8dec('0x28')](_0x1d1e22,{'showHidden':![],'depth':null}));if(_0x1d1e22[_0x8dec('0x6e')]['toLowerCase']()===_0x8dec('0x6f')){_0x1d1e22[_0x8dec('0x70')]=(_0x1d1e22[_0x8dec('0x71')]||_0x1d1e22[_0x8dec('0x70')])[_0x8dec('0x72')]();if(_[_0x8dec('0x73')](_0x1d1e22['applicationdata'],'cdr(')){if(_[_0x8dec('0x42')](this[_0x8dec('0x29')][_0x1d1e22[_0x8dec('0x18')]]))this['applications'][_0x1d1e22['uniqueid']]={};logger['info'](_0x8dec('0x74'),_0x1d1e22[_0x8dec('0x18')],_0x1d1e22['application'],_0x1d1e22['applicationdata']);var _0x5a46a9=_0x1d1e22[_0x8dec('0x70')][_0x8dec('0x75')]('=');var _0x25d278=_0x5a46a9[0x0]['match'](/cdr\((.*)\)/);if(_0x25d278)this[_0x8dec('0x29')][_0x1d1e22['uniqueid']][_0x25d278[0x1]]=_0x5a46a9[0x1];}}}}catch(_0x1a7441){logger['error'](_0x8dec('0x76'),_0x1d1e22[_0x8dec('0x18')],util[_0x8dec('0x28')](_0x1a7441,{'showHidden':![],'depth':null}));}};module[_0x8dec('0x77')]=VoiceDialReport; \ No newline at end of file +var _0xee06=['[%s][voiceDialReport][dialend]','syncVarSet','addVariable','keys','value','variable','outboundrouteid','voice','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','bridgepvtcallid','membercalls','memberinterface','memberlastcall','membername','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','cause-txt','diff','starttime','complete','total','answertime','holdtime','endtime','sumHoldTime','sumBillable','billableseconds','duration','[%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','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','set','applicationdata','appdata','startsWith','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','varset','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','inspect','merge','channels','called','channel','lastIndexOf','substring','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','format','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xee06,0x115));var _0x6ee0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee06[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6ee0('0x0'));var moment=require(_0x6ee0('0x1'));var util=require(_0x6ee0('0x2'));var Redis=require(_0x6ee0('0x3'));var config=require(_0x6ee0('0x4'));var logger=require(_0x6ee0('0x5'))(_0x6ee0('0x6'));var ami=require(_0x6ee0('0x7'));config['redis']=_[_0x6ee0('0x8')](config[_0x6ee0('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6ee0('0x9')]));function VoiceDialReport(_0xd42837){this['channels']=_0xd42837['outboundChannels'];this['outbound']=_0xd42837[_0x6ee0('0xa')];this[_0x6ee0('0xb')]={};this[_0x6ee0('0xc')]={};ami['on'](_0x6ee0('0xd'),this[_0x6ee0('0xe')][_0x6ee0('0xf')](this));ami['on'](_0x6ee0('0x10'),this['syncDialEnd']['bind'](this));ami['on'](_0x6ee0('0x11'),this['syncVarSet'][_0x6ee0('0xf')](this));ami['on']('newexten',this['syncNewExten'][_0x6ee0('0xf')](this));ami['on']('hangup',this[_0x6ee0('0x12')]['bind'](this));}VoiceDialReport[_0x6ee0('0x13')][_0x6ee0('0x14')]=function(_0x2edd65){return _0x2edd65!==null&&!_[_0x6ee0('0x15')](_0x2edd65);};VoiceDialReport[_0x6ee0('0x13')]['emit']=function(_0x47d798,_0x1e81fe,_0x367706){io['to'](_0x47d798)[_0x6ee0('0x16')](_0x1e81fe,_0x367706);};VoiceDialReport[_0x6ee0('0x13')][_0x6ee0('0xe')]=function(_0x4fb187){try{if(this['isNotNull'](_0x4fb187)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x4fb187[_0x6ee0('0x17')],util[_0x6ee0('0x18')](_0x4fb187,{'showHidden':![],'depth':null}));if(this['channels'][_0x4fb187[_0x6ee0('0x17')]]){_[_0x6ee0('0x19')](this[_0x6ee0('0x1a')][_0x4fb187['uniqueid']],{'starttime':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x6ee0('0x1b'),'interface':_0x4fb187[_0x6ee0('0x1c')]['substring'](0x0,_0x4fb187['channel'][_0x6ee0('0x1d')]('-')),'membername':_0x4fb187[_0x6ee0('0x1c')][_0x6ee0('0x1e')](_0x4fb187[_0x6ee0('0x1c')][_0x6ee0('0x1d')]('/')+0x1,_0x4fb187[_0x6ee0('0x1c')][_0x6ee0('0x1d')]('-'))},_[_0x6ee0('0x1f')](_0x4fb187,[_0x6ee0('0x20'),'privilege']));logger[_0x6ee0('0x21')](_0x6ee0('0x22'),_0x4fb187['uniqueid'],this['channels'][_0x4fb187[_0x6ee0('0x17')]]['membername'],this[_0x6ee0('0x1a')][_0x4fb187[_0x6ee0('0x17')]][_0x6ee0('0x23')]);logger[_0x6ee0('0x24')](_0x6ee0('0x25'),_0x4fb187[_0x6ee0('0x17')],util[_0x6ee0('0x18')](this[_0x6ee0('0x1a')][_0x4fb187[_0x6ee0('0x17')]],{'showHidden':![],'depth':null}));if(this[_0x6ee0('0xb')][_0x4fb187[_0x6ee0('0x17')]])_[_0x6ee0('0x19')](this['channels'][_0x4fb187[_0x6ee0('0x17')]],this[_0x6ee0('0xb')][_0x4fb187[_0x6ee0('0x17')]]);this[_0x6ee0('0x16')]('voice:outbound',_0x6ee0('0x26'),this[_0x6ee0('0x1a')][_0x4fb187['uniqueid']]);logger[_0x6ee0('0x24')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x4fb187['uniqueid'],util[_0x6ee0('0x18')](this[_0x6ee0('0x1a')][_0x4fb187['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x6ee0('0x16')]('custom:dialbegin',this['channels'][_0x4fb187[_0x6ee0('0x17')]]);}}}catch(_0x321dae){logger[_0x6ee0('0x27')](_0x6ee0('0x28'),_0x4fb187[_0x6ee0('0x17')],util[_0x6ee0('0x18')](_0x321dae,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6ee0('0x13')][_0x6ee0('0x29')]=function(_0x26b798){try{if(this[_0x6ee0('0x14')](_0x26b798)){logger[_0x6ee0('0x24')](_0x6ee0('0x2a'),_0x26b798['uniqueid'],util['inspect'](_0x26b798,{'showHidden':![],'depth':null}));if(this[_0x6ee0('0x1a')][_0x26b798[_0x6ee0('0x17')]]){this[_0x6ee0('0x1a')][_0x26b798[_0x6ee0('0x17')]]['dialstatus']=_0x26b798[_0x6ee0('0x2b')];if(_0x26b798['dialstatus']===_0x6ee0('0x2c')){this['channels'][_0x26b798[_0x6ee0('0x17')]][_0x6ee0('0x2d')]=_0x26b798[_0x6ee0('0x2d')];this['channels'][_0x26b798['uniqueid']]['connectedlinename']=_0x26b798[_0x6ee0('0x2e')];this['channels'][_0x26b798[_0x6ee0('0x17')]]['answertime']=moment()[_0x6ee0('0x2f')](_0x6ee0('0x30'));this[_0x6ee0('0x1a')][_0x26b798[_0x6ee0('0x17')]][_0x6ee0('0x31')]=_0x6ee0('0x32');logger[_0x6ee0('0x21')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x26b798[_0x6ee0('0x17')],_0x26b798[_0x6ee0('0x1c')][_0x6ee0('0x1e')](_0x26b798[_0x6ee0('0x1c')]['lastIndexOf']('/')+0x1,_0x26b798[_0x6ee0('0x1c')][_0x6ee0('0x1d')]('-')));logger[_0x6ee0('0x24')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x26b798[_0x6ee0('0x17')],util['inspect'](this[_0x6ee0('0x1a')][_0x26b798[_0x6ee0('0x17')]],{'showHidden':![],'depth':null}));ami[_0x6ee0('0x16')]('custom:dialconnect',this[_0x6ee0('0x1a')][_0x26b798[_0x6ee0('0x17')]]);}logger['debug'](_0x6ee0('0x33'),_0x26b798[_0x6ee0('0x17')],util[_0x6ee0('0x18')](this[_0x6ee0('0x1a')][_0x26b798['uniqueid']],{'showHidden':![],'depth':null}));this[_0x6ee0('0x16')](_0x6ee0('0x34'),_0x6ee0('0x26'),this[_0x6ee0('0x1a')][_0x26b798[_0x6ee0('0x17')]]);}}}catch(_0x5c6d24){logger[_0x6ee0('0x27')](_0x6ee0('0x35'),_0x26b798[_0x6ee0('0x17')],util[_0x6ee0('0x18')](_0x5c6d24,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6ee0('0x13')][_0x6ee0('0x36')]=function(_0x1d6994){try{if(this[_0x6ee0('0x14')](_0x1d6994)){logger[_0x6ee0('0x24')]('[%s][voiceDialReport][varset]\x20event:',_0x1d6994[_0x6ee0('0x17')],util[_0x6ee0('0x18')](_0x1d6994,{'showHidden':![],'depth':null}));this[_0x6ee0('0x37')](_0x1d6994[_0x6ee0('0x17')],_[_0x6ee0('0x38')](_0x1d6994['variable'])[0x0],_0x1d6994[_0x6ee0('0x39')]);if(this[_0x6ee0('0x14')](_0x1d6994[_0x6ee0('0x3a')])&&this[_0x6ee0('0x14')](_0x1d6994[_0x6ee0('0x3a')][_0x6ee0('0x3b')])){if(_[_0x6ee0('0x15')](this[_0x6ee0('0x1a')][_0x1d6994[_0x6ee0('0x17')]])){this['channels'][_0x1d6994[_0x6ee0('0x17')]]={'routeId':_0x1d6994[_0x6ee0('0x39')],'variables':this['variables'][_0x1d6994[_0x6ee0('0x17')]],'motionChannel':_0x6ee0('0x3c')};logger[_0x6ee0('0x21')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x1d6994['uniqueid'],_0x1d6994[_0x6ee0('0x3a')][_0x6ee0('0x3b')],_['keys'](_0x1d6994[_0x6ee0('0x3a')])[0x0],_0x1d6994['value']);logger['debug']('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x1d6994['uniqueid'],util[_0x6ee0('0x18')](this[_0x6ee0('0x1a')][_0x1d6994[_0x6ee0('0x17')]],{'showHidden':![],'depth':null}));this[_0x6ee0('0x16')](_0x6ee0('0x34'),_0x6ee0('0x26'),this['channels'][_0x1d6994[_0x6ee0('0x17')]]);}}}}catch(_0x3acfe6){logger[_0x6ee0('0x27')]('[%s][voiceDialReport][varset]',_0x1d6994[_0x6ee0('0x17')],util['inspect'](_0x3acfe6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6ee0('0x13')][_0x6ee0('0x37')]=function(_0x1dbfa0,_0x1b2279,_0xb3d850){var _0x53f043=['rtpaudioqos',_0x6ee0('0x3d'),_0x6ee0('0x3e'),_0x6ee0('0x3f'),_0x6ee0('0x40'),'rtpaudioqoslossbridged',_0x6ee0('0x41'),'rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer',_0x6ee0('0x42'),_0x6ee0('0x43'),'memberdynamic',_0x6ee0('0x44'),_0x6ee0('0x45'),_0x6ee0('0x46'),'memberpenalty',_0x6ee0('0x47')];if(!_[_0x6ee0('0x48')](_0x1b2279)&&!_['includes'](_0x53f043,_0x1b2279)){if(_[_0x6ee0('0x15')](this[_0x6ee0('0xc')][_0x1dbfa0])){this[_0x6ee0('0xc')][_0x1dbfa0]={};}this['variables'][_0x1dbfa0][_0x1b2279]=_0xb3d850;}};VoiceDialReport[_0x6ee0('0x13')][_0x6ee0('0x12')]=function(_0x271cef){try{if(this['isNotNull'](_0x271cef)){logger[_0x6ee0('0x24')](_0x6ee0('0x49'),_0x271cef['uniqueid'],util['inspect'](_0x271cef,{'showHidden':![],'depth':null}));if(this['channels'][_0x271cef[_0x6ee0('0x17')]]){logger['info']('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x271cef[_0x6ee0('0x17')],_0x271cef[_0x6ee0('0x4a')]);this['channels'][_0x271cef[_0x6ee0('0x17')]]['endtime']=moment()[_0x6ee0('0x2f')](_0x6ee0('0x30'));this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x17')]]['duration']=moment(this['channels'][_0x271cef[_0x6ee0('0x17')]]['endtime'])[_0x6ee0('0x4b')](this[_0x6ee0('0x1a')][_0x271cef['uniqueid']][_0x6ee0('0x4c')],'seconds');this['channels'][_0x271cef[_0x6ee0('0x17')]][_0x6ee0('0x31')]=_0x6ee0('0x4d');this[_0x6ee0('0xa')][_0x6ee0('0x4e')]+=0x1;if(this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x17')]][_0x6ee0('0x4f')]){this[_0x6ee0('0xa')]['answered']+=0x1;this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x17')]][_0x6ee0('0x50')]=moment(this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x17')]][_0x6ee0('0x4f')])[_0x6ee0('0x4b')](this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x17')]][_0x6ee0('0x4c')],'seconds');this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x17')]]['billableseconds']=moment(this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x17')]][_0x6ee0('0x51')])[_0x6ee0('0x4b')](this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x17')]][_0x6ee0('0x4f')],'seconds');this[_0x6ee0('0xa')][_0x6ee0('0x52')]+=this[_0x6ee0('0x1a')][_0x271cef['uniqueid']][_0x6ee0('0x50')]||0x0;this[_0x6ee0('0xa')][_0x6ee0('0x53')]+=this['channels'][_0x271cef[_0x6ee0('0x17')]][_0x6ee0('0x54')];}this[_0x6ee0('0xa')]['sumDuration']+=this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x17')]][_0x6ee0('0x55')];logger[_0x6ee0('0x24')](_0x6ee0('0x56'),_0x271cef['uniqueid'],util[_0x6ee0('0x18')](this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x17')]],{'showHidden':![],'depth':null}));ami[_0x6ee0('0x16')](_0x6ee0('0x57'),this['channels'][_0x271cef[_0x6ee0('0x17')]]);logger[_0x6ee0('0x24')](_0x6ee0('0x58'),_0x271cef['uniqueid'],util[_0x6ee0('0x18')](this['channels'][_0x271cef[_0x6ee0('0x17')]],{'showHidden':![],'depth':null}));ami[_0x6ee0('0x16')](_0x6ee0('0x59'),this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x17')]]);logger['debug'](_0x6ee0('0x5a'),_0x271cef[_0x6ee0('0x17')],util['inspect'](this[_0x6ee0('0x1a')][_0x271cef['uniqueid']],{'showHidden':![],'depth':null}));this[_0x6ee0('0x16')](_0x6ee0('0x34'),_0x6ee0('0x5b'),this[_0x6ee0('0xa')]);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x6ee0('0x5c')](this[_0x6ee0('0x1a')][_0x271cef['uniqueid']]));logger['debug'](_0x6ee0('0x5d'),_0x271cef[_0x6ee0('0x17')],util[_0x6ee0('0x18')](this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x17')]],{'showHidden':![],'depth':null}));this[_0x6ee0('0x16')](_0x6ee0('0x34'),_0x6ee0('0x5e'),this['channels'][_0x271cef[_0x6ee0('0x17')]]);delete this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x17')]];}else if(this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x5f')]]){this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x5f')]][_0x6ee0('0x17')]=this[_0x6ee0('0x1a')][_0x271cef[_0x6ee0('0x5f')]][_0x6ee0('0x60')];}if(this[_0x6ee0('0xc')][_0x271cef[_0x6ee0('0x17')]]){delete this['variables'][_0x271cef['uniqueid']];}}}catch(_0x14752e){logger['error'](_0x6ee0('0x61'),_0x271cef[_0x6ee0('0x17')],util[_0x6ee0('0x18')](_0x14752e,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x6ee0('0x62')]=function(_0x28e5c1){try{if(this['isNotNull'](_0x28e5c1)){logger['debug'](_0x6ee0('0x63'),_0x28e5c1[_0x6ee0('0x17')],util[_0x6ee0('0x18')](_0x28e5c1,{'showHidden':![],'depth':null}));if(_0x28e5c1['application'][_0x6ee0('0x64')]()===_0x6ee0('0x65')){_0x28e5c1[_0x6ee0('0x66')]=(_0x28e5c1[_0x6ee0('0x67')]||_0x28e5c1[_0x6ee0('0x66')])[_0x6ee0('0x64')]();if(_[_0x6ee0('0x68')](_0x28e5c1[_0x6ee0('0x66')],'cdr(')){if(_[_0x6ee0('0x15')](this[_0x6ee0('0xb')][_0x28e5c1['uniqueid']]))this['applications'][_0x28e5c1['uniqueid']]={};logger[_0x6ee0('0x21')](_0x6ee0('0x69'),_0x28e5c1[_0x6ee0('0x17')],_0x28e5c1[_0x6ee0('0x6a')],_0x28e5c1[_0x6ee0('0x66')]);var _0xcad6b9=_0x28e5c1[_0x6ee0('0x66')][_0x6ee0('0x6b')]('=');var _0x3f5cee=_0xcad6b9[0x0][_0x6ee0('0x6c')](/cdr\((.*)\)/);if(_0x3f5cee)this[_0x6ee0('0xb')][_0x28e5c1['uniqueid']][_0x3f5cee[0x1]]=_0xcad6b9[0x1];}}}}catch(_0x34e5a8){logger[_0x6ee0('0x27')]('[%s][voiceDialReport][newexten]',_0x28e5c1[_0x6ee0('0x17')],util[_0x6ee0('0x18')](_0x34e5a8,{'showHidden':![],'depth':null}));}};module[_0x6ee0('0x6d')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 2dc8b52..c611c70 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 _0xe812=['length','unmanaged','diff','queuecallerjoinAt','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','origtransfererexten','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][newexten]\x20event:','application','applicationdata','appdata','startsWith','CDR(routeAlias)','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','moment','util','../../../config/environment','../../../config/logger','../ami','../model/queueReport','defaults','redis','socket.io-emitter','prototype','tail','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','bind','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncAgentComplete','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','newexten','syncNewExten','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncBlindTransfer','loopQueueShow','hasOwnProperty','isEmpty','originated','talking','pTalking','unlockRR','clearZombieChannels','switch','enqueue','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','inspect','[%s][voiceQueueReport][checkQueueReport]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','name','voice_queue_presence:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','type','inbound','answered','available','sumBillable','sumDuration','sumHoldTime','total','abandoned','Trunk','active','Interval','stringify','md5','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','queues','[voiceQueueReport][queues]','loopQueueSummary','[voiceQueueReport][queuesummary]','syncQueueSummary','queue','[voiceQueueReport][queuesummary]\x20event:','info','countBy','callers','toNumber','loggedIn','loggedin','waiting','emitVoiceQueueSummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','[%s][voiceQueueReport][agentconnect]','queuecallercomplete','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','assigned','queuecallerexit','queuecallerexitAt','reason','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','local/','linkedid','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','transferuniqueid','COMPLETEDBY','toUpperCase','agentcomplete','[%s][voiceQueueReport][agentcomplete]','[%s][voiceQueueReport][varset]','addVariable','variable','queuestatus','value','CONTINUE','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberinterface','membername','memberpenalty','includes','[%s][voiceQueueReport][hangup]'];(function(_0x583688,_0x3bf285){var _0x2bd106=function(_0x44fd75){while(--_0x44fd75){_0x583688['push'](_0x583688['shift']());}};_0x2bd106(++_0x3bf285);}(_0xe812,0x1f2));var _0x2e81=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe812[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var moment=require(_0x2e81('0x0'));var util=require(_0x2e81('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x2e81('0x2'));var logger=require(_0x2e81('0x3'))('ami');var ami=require(_0x2e81('0x4'));var QueueReport=require(_0x2e81('0x5'));config['redis']=_[_0x2e81('0x6')](config[_0x2e81('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x2e81('0x8'))(new Redis(config[_0x2e81('0x7')]));var Sequence=function(){};Sequence[_0x2e81('0x9')]['enqueue']=function(_0x142cab){this[_0x2e81('0xa')]=this[_0x2e81('0xa')]?this[_0x2e81('0xa')]['finally'](_0x142cab):_0x142cab();};function VoiceQueueReport(_0x3375d6){this[_0x2e81('0xb')]=new Sequence();this[_0x2e81('0xc')]={};this[_0x2e81('0xd')]=_0x3375d6[_0x2e81('0xd')];this[_0x2e81('0xe')]=_0x3375d6[_0x2e81('0xf')];this[_0x2e81('0x10')]=_0x3375d6[_0x2e81('0x10')];this[_0x2e81('0x11')]=!![];this[_0x2e81('0x12')]=_0x3375d6['campaigns'];this[_0x2e81('0x13')]={};ami['on'](_0x2e81('0x14'),this['syncQueueSummary'][_0x2e81('0x15')](this));ami['on']('queuesummarycomplete',this[_0x2e81('0x16')][_0x2e81('0x15')](this));ami['on'](_0x2e81('0x17'),this[_0x2e81('0x18')][_0x2e81('0x15')](this));ami['on'](_0x2e81('0x19'),this['syncQueueCallerAbandon'][_0x2e81('0x15')](this));ami['on'](_0x2e81('0x1a'),this['syncQueueCallerLeave'][_0x2e81('0x15')](this));ami['on']('agentcomplete',this[_0x2e81('0x1b')][_0x2e81('0x15')](this));ami['on']('agentconnect',this[_0x2e81('0x1c')][_0x2e81('0x15')](this));ami['on'](_0x2e81('0x1d'),this[_0x2e81('0x1e')][_0x2e81('0x15')](this));ami['on'](_0x2e81('0x1f'),this[_0x2e81('0x20')][_0x2e81('0x15')](this));ami['on'](_0x2e81('0x21'),this[_0x2e81('0x22')]['bind'](this));ami['on'](_0x2e81('0x23'),this[_0x2e81('0x24')][_0x2e81('0x15')](this));ami['on'](_0x2e81('0x25'),this[_0x2e81('0x26')][_0x2e81('0x15')](this));ami['on'](_0x2e81('0x27'),this[_0x2e81('0x28')]['bind'](this));ami['on'](_0x2e81('0x29'),this['syncAttendedTransfer'][_0x2e81('0x15')](this));ami['on']('blindtransfer',this[_0x2e81('0x2a')]['bind'](this));this['loopQueueSummary']();this[_0x2e81('0x2b')]();}function clearChannels(_0x46eb91){if(!_['isEmpty'](_0x46eb91)){for(var _0x39e8c0 in _0x46eb91){if(_0x46eb91[_0x2e81('0x2c')](_0x39e8c0)){delete _0x46eb91[_0x39e8c0];}}}}function clearCampaigns(_0x1c4547){if(!_[_0x2e81('0x2d')](_0x1c4547)){for(var _0x2b66f9 in _0x1c4547){if(_0x1c4547[_0x2e81('0x2c')](_0x2b66f9)){_0x1c4547[_0x2b66f9][_0x2e81('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x4669aa){if(!_[_0x2e81('0x2d')](_0x4669aa)){for(var _0x1bf5a6 in _0x4669aa){if(_0x4669aa[_0x2e81('0x2c')](_0x1bf5a6)){_0x4669aa[_0x1bf5a6][_0x2e81('0x2e')]=0x0;_0x4669aa[_0x1bf5a6][_0x2e81('0x2f')]=0x0;_0x4669aa[_0x1bf5a6][_0x2e81('0x30')]=0x0;_0x4669aa[_0x1bf5a6]['waiting']=0x0;_0x4669aa[_0x1bf5a6]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0xfc7ce3){if(!_[_0x2e81('0x2d')](_0xfc7ce3)){for(var _0x20ef21 in _0xfc7ce3){if(_0xfc7ce3[_0x2e81('0x2c')](_0x20ef21)){_0xfc7ce3[_0x20ef21][_0x2e81('0x31')]=!![];}}}}VoiceQueueReport[_0x2e81('0x9')][_0x2e81('0x32')]=function(){var _0x13612b=this;for(var _0x26ec2a in this[_0x2e81('0xe')]){if(this[_0x2e81('0xe')]['hasOwnProperty'](_0x26ec2a)&&!this[_0x2e81('0xe')][_0x26ec2a][_0x2e81('0x33')]){this[_0x2e81('0xb')][_0x2e81('0x34')](function(){if(!_[_0x2e81('0x35')](_0x13612b[_0x2e81('0xe')][_0x26ec2a])){return ami[_0x2e81('0x36')]({'action':_0x2e81('0x37'),'channel':_0x13612b[_0x2e81('0xe')][_0x26ec2a][_0x2e81('0x38')]})[_0x2e81('0x39')](function(_0x44f931){if(_0x44f931[_0x2e81('0x3a')]===_0x2e81('0x3b')){setTimeout(function(){if(_0x13612b[_0x2e81('0xe')][_0x26ec2a]){delete _0x13612b[_0x2e81('0xe')][_0x26ec2a];logger[_0x2e81('0x3c')]('[%s][voiceQueueReport][checkChannel]',_0x26ec2a,util[_0x2e81('0x3d')](_0x44f931,{'showHidden':![],'depth':null}));}if(_0x13612b[_0x2e81('0xc')][_0x26ec2a]){delete _0x13612b['queueReports'][_0x26ec2a];logger[_0x2e81('0x3c')](_0x2e81('0x3e'),_0x26ec2a,util['inspect'](_0x44f931,{'showHidden':![],'depth':null}));}if(_0x13612b[_0x2e81('0x13')][_0x26ec2a]){delete _0x13612b[_0x2e81('0x13')][_0x26ec2a];logger[_0x2e81('0x3c')]('[%s][voiceQueueReport][checkVariables]',_0x26ec2a,util[_0x2e81('0x3d')](_0x44f931,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x2e81('0x9')][_0x2e81('0x22')]=function(){logger[_0x2e81('0x3c')](_0x2e81('0x3f'));clearChannels(this['channels']);this['clearQueueReport'](this['queueReports']);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x2e81('0x10')]);clearCampaigns(this['campaigns']);};VoiceQueueReport['prototype'][_0x2e81('0x40')]=function(_0x1e7443){var _0x4752cf=this;if(!_['isEmpty'](_0x1e7443)){for(var _0x168cfa in _0x1e7443){if(_0x1e7443[_0x2e81('0x2c')](_0x168cfa)){_0x4752cf[_0x2e81('0x41')](_0x1e7443[_0x168cfa],_0x2e81('0x42'));delete _0x1e7443[_0x168cfa];}}}};VoiceQueueReport[_0x2e81('0x9')]['emit']=function(_0x51b9ab,_0x453d61,_0x35a2e5){io['to'](_0x51b9ab)[_0x2e81('0x43')](_0x453d61,_0x35a2e5);};VoiceQueueReport['prototype'][_0x2e81('0x44')]=function(_0x44d10c,_0x288b03){logger['debug'](_0x2e81('0x45')+_0x288b03+_0x2e81('0x46'),_0x44d10c[_0x2e81('0x47')],util[_0x2e81('0x3d')](_0x44d10c,{'showHidden':![],'depth':null}));this[_0x2e81('0x43')](util[_0x2e81('0x48')](_0x2e81('0x49'),_0x44d10c[_0x2e81('0x4a')]),'voice_queue_channel:save',_0x44d10c);io['emit'](_0x2e81('0x4b'),_0x44d10c);};VoiceQueueReport['prototype'][_0x2e81('0x41')]=function(_0x9f5f03,_0xf3d7a5){logger[_0x2e81('0x4c')](_0x2e81('0x45')+_0xf3d7a5+_0x2e81('0x4d'),_0x9f5f03['uniqueid'],util['inspect'](_0x9f5f03,{'showHidden':![],'depth':null}));this[_0x2e81('0x43')](util[_0x2e81('0x48')](_0x2e81('0x49'),_0x9f5f03['name']),_0x2e81('0x4e'),_0x9f5f03);io[_0x2e81('0x43')]('voice_queue_presence:remove',_0x9f5f03);};VoiceQueueReport[_0x2e81('0x9')]['emitVoiceQueueSummary']=function(_0x436929,_0xc7e5be){if(_0x436929[_0x2e81('0x4f')]===_0x2e81('0x50')){var _0x503346={'id':_0x436929['id'],'name':_0x436929[_0x2e81('0x4a')],'strategy':_0x436929['strategy'],'answered':_0x436929[_0x2e81('0x51')],'available':_0x436929[_0x2e81('0x52')],'loggedIn':_0x436929['loggedIn'],'pTalking':_0x436929[_0x2e81('0x30')],'sumBillable':_0x436929[_0x2e81('0x53')],'sumDuration':_0x436929[_0x2e81('0x54')],'sumHoldTime':_0x436929[_0x2e81('0x55')]||0x0,'talking':_0x436929[_0x2e81('0x2f')],'total':_0x436929[_0x2e81('0x56')],'type':_0x436929[_0x2e81('0x4f')],'unmanaged':_0x436929['unmanaged'],'abandoned':_0x436929[_0x2e81('0x57')],'waiting':_0x436929['waiting']};if(_0x436929['Trunk']){_0x503346[_0x2e81('0x58')]={'id':_0x436929['Trunk']['id'],'name':_0x436929['Trunk'][_0x2e81('0x4a')],'active':_0x436929[_0x2e81('0x58')][_0x2e81('0x59')],'callerid':_0x436929['Trunk']['callerid']};}if(_0x436929[_0x2e81('0x5a')]){_0x503346[_0x2e81('0x5a')]={'id':_0x436929[_0x2e81('0x5a')]['id'],'name':_0x436929[_0x2e81('0x5a')]['name']};}var _0x5c2f5c=md5(JSON[_0x2e81('0x5b')](_0x503346));if(_0x436929[_0x2e81('0x5c')]!==_0x5c2f5c){_0x436929['md5']=_0x5c2f5c;logger['debug'](_0x2e81('0x5d')+_0xc7e5be+_0x2e81('0x5e'),util['inspect'](_0x503346,{'showHidden':![],'depth':null}));this[_0x2e81('0x43')](util[_0x2e81('0x48')](_0x2e81('0x49'),_0x503346[_0x2e81('0x4a')]),_0x2e81('0x5f'),_0x503346);}}};VoiceQueueReport['prototype'][_0x2e81('0x60')]=function(_0x2ffc8){return _0x2ffc8!==null&&!_[_0x2e81('0x61')](_0x2ffc8);};VoiceQueueReport[_0x2e81('0x9')]['loopQueueShow']=function(){var _0x5c64b6=this;setInterval(function(){_0x5c64b6[_0x2e81('0x32')]();ami[_0x2e81('0x36')]({'action':_0x2e81('0x62')})[_0x2e81('0x39')](function(_0x147a21){logger['error'](_0x2e81('0x63'),util[_0x2e81('0x3d')](_0x147a21,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x2e81('0x9')][_0x2e81('0x64')]=function(){var _0x3fee2d=this;setInterval(function(){if(_0x3fee2d['flagQueueSummary']){return ami[_0x2e81('0x36')]({'action':_0x2e81('0x14')})['then'](function(_0x59cae9){_0x3fee2d[_0x2e81('0x11')]=![];})['catch'](function(_0x350b0a){logger[_0x2e81('0x3c')](_0x2e81('0x65'),util[_0x2e81('0x3d')](_0x350b0a,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x2e81('0x9')][_0x2e81('0x66')]=function(_0x18beeb){try{if(this[_0x2e81('0x60')](_0x18beeb)&&this['isNotNull'](_0x18beeb[_0x2e81('0x67')])){logger['debug'](_0x2e81('0x68'),util[_0x2e81('0x3d')](_0x18beeb,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0x18beeb[_0x2e81('0x67')]]){logger[_0x2e81('0x69')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x18beeb[_0x2e81('0x67')]);var _0x5c3b81=_[_0x2e81('0x6a')](this[_0x2e81('0xe')],_0x2e81('0x67'))[_0x18beeb[_0x2e81('0x67')]]||0x0;var _0x4584b5=_0x5c3b81-_0x18beeb[_0x2e81('0x6b')];if(this[_0x2e81('0x10')][_0x18beeb[_0x2e81('0x67')]]['waiting']!==_[_0x2e81('0x6c')](_0x18beeb[_0x2e81('0x6b')])||this[_0x2e81('0x10')][_0x18beeb[_0x2e81('0x67')]][_0x2e81('0x6d')]!==_[_0x2e81('0x6c')](_0x18beeb[_0x2e81('0x6e')])||this[_0x2e81('0x10')][_0x18beeb[_0x2e81('0x67')]][_0x2e81('0x52')]!==_[_0x2e81('0x6c')](_0x18beeb[_0x2e81('0x52')])||this[_0x2e81('0x10')][_0x18beeb[_0x2e81('0x67')]][_0x2e81('0x2f')]!==_0x4584b5){this['voiceQueues'][_0x18beeb['queue']][_0x2e81('0x6f')]=_[_0x2e81('0x6c')](_0x18beeb[_0x2e81('0x6b')]);this[_0x2e81('0x10')][_0x18beeb[_0x2e81('0x67')]][_0x2e81('0x6d')]=_[_0x2e81('0x6c')](_0x18beeb[_0x2e81('0x6e')]);this['voiceQueues'][_0x18beeb['queue']][_0x2e81('0x52')]=_[_0x2e81('0x6c')](_0x18beeb['available']);this[_0x2e81('0x10')][_0x18beeb[_0x2e81('0x67')]][_0x2e81('0x2f')]=_0x4584b5>0x0?_0x4584b5:0x0;this[_0x2e81('0x10')][_0x18beeb[_0x2e81('0x67')]][_0x2e81('0x2f')]=this[_0x2e81('0x10')][_0x18beeb[_0x2e81('0x67')]]['talking']>_[_0x2e81('0x6c')](_0x18beeb['loggedin'])?_[_0x2e81('0x6c')](_0x18beeb[_0x2e81('0x6e')]):this[_0x2e81('0x10')][_0x18beeb[_0x2e81('0x67')]][_0x2e81('0x2f')];this[_0x2e81('0x70')](this[_0x2e81('0x10')][_0x18beeb[_0x2e81('0x67')]],_0x2e81('0x14'));}logger[_0x2e81('0x4c')](_0x2e81('0x71'),util[_0x2e81('0x3d')](this['voiceQueues'][_0x18beeb[_0x2e81('0x67')]],{'showHidden':![],'depth':null}));ami[_0x2e81('0x43')](_0x2e81('0x72'),this[_0x2e81('0x10')][_0x18beeb[_0x2e81('0x67')]]);}}}catch(_0x529344){logger[_0x2e81('0x3c')](_0x2e81('0x65'),util['inspect'](_0x529344,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2e81('0x9')][_0x2e81('0x16')]=function(_0x2b0ad3){logger[_0x2e81('0x4c')](_0x2e81('0x73'),util[_0x2e81('0x3d')](_0x2b0ad3,{'showHidden':![],'depth':null}));this[_0x2e81('0x11')]=!![];};VoiceQueueReport[_0x2e81('0x9')][_0x2e81('0x18')]=function(_0x38eb29){try{if(this['isNotNull'](_0x38eb29)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x38eb29[_0x2e81('0x47')],util[_0x2e81('0x3d')](_0x38eb29,{'showHidden':![],'depth':null}));if(_[_0x2e81('0x61')](this[_0x2e81('0xc')][_0x38eb29['uniqueid']]))this[_0x2e81('0xc')][_0x38eb29[_0x2e81('0x47')]]=[];if(_[_0x2e81('0x61')](this['channels'][_0x38eb29[_0x2e81('0x47')]]))this[_0x2e81('0xe')][_0x38eb29['uniqueid']]={};var _0x50ce73=new QueueReport();_0x50ce73[_0x2e81('0x4a')]=_0x38eb29['queue'];_0x50ce73[_0x2e81('0x4f')]=this[_0x2e81('0x10')][_0x50ce73['name']]&&this[_0x2e81('0x10')][_0x50ce73['name']][_0x2e81('0x4f')]?this['voiceQueues'][_0x50ce73['name']]['type']||_0x2e81('0x50'):'inbound';_0x50ce73[_0x2e81('0x67')]=_0x38eb29[_0x2e81('0x67')];_0x50ce73['queuecallerjoinAt']=moment()[_0x2e81('0x48')](_0x2e81('0x74'));_0x50ce73[_0x2e81('0x75')]=_0x38eb29[_0x2e81('0x75')];_0x50ce73[_0x2e81('0x76')]=_0x38eb29[_0x2e81('0x76')];_0x50ce73[_0x2e81('0x47')]=_0x38eb29[_0x2e81('0x47')];_0x50ce73[_0x2e81('0x77')]=this[_0x2e81('0xe')][_0x38eb29['uniqueid']]['routealias'];logger[_0x2e81('0x69')](_0x2e81('0x78'),_0x50ce73['name'],_0x50ce73[_0x2e81('0x4f')]);_[_0x2e81('0x79')](_0x50ce73,_[_0x2e81('0x7a')](_0x38eb29,_[_0x2e81('0x7b')](_0x50ce73)));this[_0x2e81('0xc')][_0x38eb29['uniqueid']][_0x2e81('0x7c')](_0x50ce73);this[_0x2e81('0xe')][_0x38eb29[_0x2e81('0x47')]]=_0x50ce73;this['emitVoiceQueueChannelSave'](_0x50ce73,_0x2e81('0x17'));}}catch(_0x3f78f9){logger[_0x2e81('0x3c')](_0x2e81('0x7d'),_0x38eb29[_0x2e81('0x47')],util['inspect'](_0x3f78f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2e81('0x9')]['syncQueueCallerAbandon']=function(_0x261fc7){try{if(this[_0x2e81('0x60')](_0x261fc7)){logger[_0x2e81('0x4c')](_0x2e81('0x7e'),_0x261fc7[_0x2e81('0x47')],util[_0x2e81('0x3d')](_0x261fc7,{'showHidden':![],'depth':null}));if(this[_0x2e81('0xc')][_0x261fc7[_0x2e81('0x47')]]){var _0x428e2c=_[_0x2e81('0x7f')](this['queueReports'][_0x261fc7[_0x2e81('0x47')]]);_0x428e2c['queuecallercomplete']=![];_0x428e2c[_0x2e81('0x80')]=null;_0x428e2c[_0x2e81('0x81')]=_0x261fc7[_0x2e81('0x81')];_0x428e2c['originalposition']=_0x261fc7['originalposition'];_0x428e2c[_0x2e81('0x19')]=!![];_0x428e2c[_0x2e81('0x82')]=moment()[_0x2e81('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x428e2c[_0x2e81('0x83')]=_0x2e81('0x84');_0x428e2c['lastAssignedTo']=null;logger[_0x2e81('0x69')](_0x2e81('0x85'),_0x428e2c['name'],_0x428e2c[_0x2e81('0x4f')]);this['channels'][_0x261fc7[_0x2e81('0x47')]]=_0x428e2c;this['emitVoiceQueueChannelRemove'](_0x428e2c,_0x2e81('0x19'));}}}catch(_0x122b0e){logger[_0x2e81('0x3c')](_0x2e81('0x7e'),_0x261fc7[_0x2e81('0x47')],util['inspect'](_0x122b0e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2e81('0x9')]['syncQueueCallerLeave']=function(_0x168cac){try{if(this[_0x2e81('0x60')](_0x168cac)){logger[_0x2e81('0x4c')](_0x2e81('0x86'),_0x168cac[_0x2e81('0x47')],util[_0x2e81('0x3d')](_0x168cac,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x168cac[_0x2e81('0x47')]]){var _0x29eb77=_[_0x2e81('0x7f')](this[_0x2e81('0xc')][_0x168cac[_0x2e81('0x47')]]);_0x29eb77[_0x2e81('0x87')]=moment()[_0x2e81('0x48')](_0x2e81('0x74'));_0x29eb77['connectedlinenum']=_0x168cac['connectedlinenum'];_0x29eb77[_0x2e81('0x88')]=_0x168cac[_0x2e81('0x88')];logger['info'](_0x2e81('0x89'),_0x29eb77['name'],_0x29eb77[_0x2e81('0x4f')],_0x168cac[_0x2e81('0x8a')],_0x168cac[_0x2e81('0x88')]);this[_0x2e81('0xe')][_0x168cac[_0x2e81('0x47')]]=_0x29eb77;this['emitVoiceQueueChannelSave'](_0x29eb77,_0x2e81('0x1a'));}}}catch(_0x40e4f6){logger[_0x2e81('0x3c')](_0x2e81('0x86'),_0x168cac[_0x2e81('0x47')],util['inspect'](_0x40e4f6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2e81('0x9')][_0x2e81('0x1c')]=function(_0x3023fc){try{if(this[_0x2e81('0x60')](_0x3023fc)){logger['debug'](_0x2e81('0x8b'),_0x3023fc['uniqueid'],util['inspect'](_0x3023fc,{'showHidden':![],'depth':null}));if(this[_0x2e81('0xc')][_0x3023fc[_0x2e81('0x47')]]){var _0x36d9b9=_[_0x2e81('0x7f')](this['queueReports'][_0x3023fc['uniqueid']]);_0x36d9b9[_0x2e81('0x8c')]=!![];_0x36d9b9[_0x2e81('0x83')]=_0x2e81('0x8d');logger[_0x2e81('0x69')](_0x2e81('0x8e'),_0x36d9b9[_0x2e81('0x4a')],_0x36d9b9[_0x2e81('0x4f')]);}}}catch(_0x879912){logger['error'](_0x2e81('0x8b'),_0x3023fc['uniqueid'],util[_0x2e81('0x3d')](_0x879912,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2e81('0x9')]['syncAgentComplete']=function(_0x5908db){try{if(this[_0x2e81('0x60')](_0x5908db)){logger[_0x2e81('0x4c')]('[%s][voiceQueueReport][agentcomplete]',_0x5908db[_0x2e81('0x47')],util[_0x2e81('0x3d')](_0x5908db,{'showHidden':![],'depth':null}));if(this[_0x2e81('0xc')][_0x5908db[_0x2e81('0x47')]]){var _0x32e8a1=_[_0x2e81('0x7f')](this['queueReports'][_0x5908db['uniqueid']]);_0x32e8a1[_0x2e81('0x19')]=![];_0x32e8a1[_0x2e81('0x82')]=null;_0x32e8a1[_0x2e81('0x8f')]=!![];_0x32e8a1['lastAssignedTo']=_0x5908db['membername'];_0x32e8a1[_0x2e81('0x81')]=_0x5908db['holdtime'];_0x32e8a1[_0x2e81('0x8c')]=!![];_0x32e8a1[_0x2e81('0x90')]=![];_0x32e8a1[_0x2e81('0x91')]=null;if(!_0x32e8a1['transfer']){if(_0x5908db[_0x2e81('0x92')]==_0x2e81('0x93')){_0x32e8a1['queuecallerexitreason']=_0x2e81('0x94');logger['info'](_0x2e81('0x95'),_0x32e8a1[_0x2e81('0x4a')],_0x32e8a1['type']);}else{if(_['startsWith'](_0x5908db['channel'][_0x2e81('0x96')](),_0x2e81('0x97'))){if(this[_0x2e81('0xc')][_0x5908db[_0x2e81('0x98')]]){var _0x4ee5ec=_[_0x2e81('0x7f')](this[_0x2e81('0xc')][_0x5908db['linkedid']]);_0x4ee5ec[_0x2e81('0x8c')]=![];_0x4ee5ec[_0x2e81('0x90')]=!![];_0x4ee5ec['queuecallerexitAt']=moment(_0x32e8a1['queuecallerjoinAt'])['add'](_0x5908db['holdtime'],_0x2e81('0x99'))[_0x2e81('0x48')](_0x2e81('0x74'));_0x4ee5ec['queuecallerexitreason']=_0x2e81('0x9a');_0x4ee5ec[_0x2e81('0x93')]=!![];_0x4ee5ec[_0x2e81('0x9b')]=_0x2e81('0x9c');_0x4ee5ec[_0x2e81('0x9d')]=_0x5908db['destexten'];_0x4ee5ec[_0x2e81('0x9e')]=_0x5908db[_0x2e81('0x47')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x4ee5ec[_0x2e81('0x4a')],_0x4ee5ec[_0x2e81('0x4f')]);var _0x2c5531=this[_0x2e81('0xc')][_0x5908db[_0x2e81('0x98')]];this[_0x2e81('0xc')][_0x5908db[_0x2e81('0x98')]]=this[_0x2e81('0xc')][_0x5908db[_0x2e81('0x47')]];this[_0x2e81('0xc')][_0x5908db[_0x2e81('0x47')]]=_0x2c5531;}}else{_0x32e8a1[_0x2e81('0x83')]=_0x2e81('0x9f')+_0x5908db[_0x2e81('0x92')][_0x2e81('0xa0')]();logger[_0x2e81('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x32e8a1[_0x2e81('0x4a')],_0x32e8a1['type'],_0x32e8a1['queuecallerexitreason']);}}}this[_0x2e81('0xe')][_0x5908db[_0x2e81('0x47')]]=_0x32e8a1;this[_0x2e81('0x41')](_0x32e8a1,_0x2e81('0xa1'));}}}catch(_0x464011){logger[_0x2e81('0x3c')](_0x2e81('0xa2'),_0x5908db[_0x2e81('0x47')],util[_0x2e81('0x3d')](_0x464011,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2e81('0x9')][_0x2e81('0x1e')]=function(_0x27c75a){try{if(this[_0x2e81('0x60')](_0x27c75a)){logger[_0x2e81('0x4c')](_0x2e81('0xa3'),_0x27c75a[_0x2e81('0x47')],util[_0x2e81('0x3d')](_0x27c75a,{'showHidden':![],'depth':null}));this[_0x2e81('0xa4')](_0x27c75a[_0x2e81('0x47')],_[_0x2e81('0x7b')](_0x27c75a[_0x2e81('0xa5')])[0x0],_0x27c75a['value']);if(this[_0x2e81('0xc')][_0x27c75a[_0x2e81('0x47')]]){var _0xa3c850=_['last'](this['queueReports'][_0x27c75a[_0x2e81('0x47')]]);if(_0xa3c850){if(this[_0x2e81('0x60')](_0x27c75a['variable'])&&this['isNotNull'](_0x27c75a[_0x2e81('0xa5')][_0x2e81('0xa6')])){switch(_0x27c75a[_0x2e81('0xa7')]){case _0x2e81('0xa8'):_0xa3c850[_0x2e81('0x90')]=![];_0xa3c850[_0x2e81('0x91')]=null;break;case'TIMEOUT':_0xa3c850[_0x2e81('0xa9')]=_0x2e81('0xaa');_0xa3c850[_0x2e81('0x90')]=!![];_0xa3c850[_0x2e81('0x91')]=moment()[_0x2e81('0x48')](_0x2e81('0x74'));_0xa3c850[_0x2e81('0x87')]=moment()[_0x2e81('0x48')](_0x2e81('0x74'));logger[_0x2e81('0x4c')](_0x2e81('0xab'),_0x27c75a[_0x2e81('0x47')],util[_0x2e81('0x3d')](_0xa3c850,{'showHidden':![],'depth':null}));ami[_0x2e81('0x43')](_0x2e81('0xac'),_0xa3c850);break;default:_0xa3c850['queuecallerexit']=!![];_0xa3c850[_0x2e81('0x91')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xa3c850[_0x2e81('0x87')]=moment()[_0x2e81('0x48')]('YYYY-MM-DD\x20HH:mm:ss');}_0xa3c850['queuecallerabandon']=![];_0xa3c850[_0x2e81('0x82')]=null;_0xa3c850['queuecallerexitreason']=_0x27c75a['value'];this[_0x2e81('0xe')][_0x27c75a[_0x2e81('0x47')]]=_0xa3c850;this['emitVoiceQueueChannelRemove'](_0xa3c850,_0x2e81('0x1d'));}else if(this['isNotNull'](_0x27c75a[_0x2e81('0xa5')])&&this[_0x2e81('0x60')](_0x27c75a['variable'][_0x2e81('0xad')])){if(!_0xa3c850[_0x2e81('0x19')]){_0xa3c850[_0x2e81('0x90')]=!![];_0xa3c850[_0x2e81('0x91')]=moment()['format'](_0x2e81('0x74'));_0xa3c850[_0x2e81('0x83')]=_0x2e81('0xae');_0xa3c850[_0x2e81('0x87')]=moment()['format'](_0x2e81('0x74'));this[_0x2e81('0xe')][_0x27c75a[_0x2e81('0x47')]]=_0xa3c850;}}logger[_0x2e81('0x69')](_0x2e81('0xaf'),_0x27c75a[_0x2e81('0x47')],_0xa3c850[_0x2e81('0x4a')],_0xa3c850['type'],_[_0x2e81('0x7b')](_0x27c75a[_0x2e81('0xa5')])[0x0],_0x27c75a[_0x2e81('0xa7')]);_0xa3c850[_0x2e81('0x13')]=this[_0x2e81('0x13')][_0x27c75a[_0x2e81('0x47')]];}}}}catch(_0x489267){logger[_0x2e81('0x3c')](_0x2e81('0xa3'),_0x27c75a[_0x2e81('0x47')],util['inspect'](_0x489267,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x2e81('0xa4')]=function(_0x41a467,_0x3c95b1,_0x4846f9){var _0x460ec4=[_0x2e81('0xb0'),_0x2e81('0xb1'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x2e81('0xb2'),_0x2e81('0xb3'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x2e81('0xb4'),_0x2e81('0xb5'),_0x2e81('0xb6'),_0x2e81('0xb7'),'membercalls','memberdynamic',_0x2e81('0xb8'),'memberlastcall',_0x2e81('0xb9'),_0x2e81('0xba'),'memberrealtime'];if(!_[_0x2e81('0x35')](_0x3c95b1)&&!_[_0x2e81('0xbb')](_0x460ec4,_0x3c95b1)){if(_['isUndefined'](this['variables'][_0x41a467])){this[_0x2e81('0x13')][_0x41a467]={};}this[_0x2e81('0x13')][_0x41a467][_0x3c95b1]=_0x4846f9;}};VoiceQueueReport[_0x2e81('0x9')]['syncHangup']=function(_0x441eda){try{if(this[_0x2e81('0x60')](_0x441eda)){logger[_0x2e81('0x4c')](_0x2e81('0xbc'),_0x441eda[_0x2e81('0x47')],util[_0x2e81('0x3d')](_0x441eda,{'showHidden':![],'depth':null}));if(this[_0x2e81('0xc')][_0x441eda['uniqueid']]){for(var _0x59612f=0x0,_0x1384d0={};_0x59612f0x0?_0x5a18f2:0x0;this['voiceQueues'][_0xc199[_0xa122('0x6e')]][_0xa122('0x33')]=this['voiceQueues'][_0xc199[_0xa122('0x6e')]][_0xa122('0x33')]>_[_0xa122('0x74')](_0xc199['loggedin'])?_[_0xa122('0x74')](_0xc199['loggedin']):this[_0xa122('0x10')][_0xc199[_0xa122('0x6e')]][_0xa122('0x33')];this[_0xa122('0x54')](this[_0xa122('0x10')][_0xc199['queue']],_0xa122('0x69'));}logger[_0xa122('0x4a')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0xa122('0x43')](this[_0xa122('0x10')][_0xc199['queue']],{'showHidden':![],'depth':null}));ami[_0xa122('0x48')]('custom:queuesummary',this['voiceQueues'][_0xc199[_0xa122('0x6e')]]);}}}catch(_0x4f78ca){logger['error'](_0xa122('0x6c'),util[_0xa122('0x43')](_0x4f78ca,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa122('0x9')][_0xa122('0x77')]=function(_0x5e5a61){logger[_0xa122('0x4a')](_0xa122('0x78'),util['inspect'](_0x5e5a61,{'showHidden':![],'depth':null}));this[_0xa122('0x6b')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x58b7aa){try{if(this[_0xa122('0x65')](_0x58b7aa)){logger[_0xa122('0x4a')](_0xa122('0x79'),_0x58b7aa[_0xa122('0x4c')],util[_0xa122('0x43')](_0x58b7aa,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xa122('0x40')][_0x58b7aa[_0xa122('0x4c')]]))this['queueReports'][_0x58b7aa[_0xa122('0x4c')]]=[];if(_[_0xa122('0x66')](this[_0xa122('0xe')][_0x58b7aa[_0xa122('0x4c')]]))this[_0xa122('0xe')][_0x58b7aa[_0xa122('0x4c')]]={};var _0xbf8d47=new QueueReport();_0xbf8d47[_0xa122('0x4d')]=_0x58b7aa['queue'];_0xbf8d47[_0xa122('0x55')]=this[_0xa122('0x10')][_0xbf8d47[_0xa122('0x4d')]]&&this[_0xa122('0x10')][_0xbf8d47[_0xa122('0x4d')]]['type']?this[_0xa122('0x10')][_0xbf8d47[_0xa122('0x4d')]][_0xa122('0x55')]||'inbound':_0xa122('0x56');_0xbf8d47[_0xa122('0x6e')]=_0x58b7aa[_0xa122('0x6e')];_0xbf8d47[_0xa122('0x7a')]=moment()[_0xa122('0x63')](_0xa122('0x7b'));_0xbf8d47[_0xa122('0x7c')]=_0x58b7aa[_0xa122('0x7c')];_0xbf8d47['count']=_0x58b7aa[_0xa122('0x7d')];_0xbf8d47['uniqueid']=_0x58b7aa[_0xa122('0x4c')];_0xbf8d47[_0xa122('0x7e')]=this[_0xa122('0xe')][_0x58b7aa[_0xa122('0x4c')]][_0xa122('0x7e')];logger[_0xa122('0x6f')](_0xa122('0x7f'),_0xbf8d47[_0xa122('0x4d')],_0xbf8d47[_0xa122('0x55')]);_['merge'](_0xbf8d47,_[_0xa122('0x80')](_0x58b7aa,_['keys'](_0xbf8d47)));this['queueReports'][_0x58b7aa['uniqueid']][_0xa122('0x81')](_0xbf8d47);this[_0xa122('0xe')][_0x58b7aa['uniqueid']]=_0xbf8d47;this[_0xa122('0x49')](_0xbf8d47,_0xa122('0x16'));}}catch(_0x58cece){logger[_0xa122('0x41')](_0xa122('0x79'),_0x58b7aa[_0xa122('0x4c')],util[_0xa122('0x43')](_0x58cece,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa122('0x9')]['syncQueueCallerAbandon']=function(_0x60d551){try{if(this[_0xa122('0x65')](_0x60d551)){logger['debug'](_0xa122('0x82'),_0x60d551[_0xa122('0x4c')],util['inspect'](_0x60d551,{'showHidden':![],'depth':null}));if(this[_0xa122('0x40')][_0x60d551[_0xa122('0x4c')]]){var _0x175366=_[_0xa122('0x83')](this[_0xa122('0x40')][_0x60d551[_0xa122('0x4c')]]);_0x175366['queuecallercomplete']=![];_0x175366[_0xa122('0x84')]=null;_0x175366['holdtime']=_0x60d551[_0xa122('0x85')];_0x175366['originalposition']=_0x60d551['originalposition'];_0x175366[_0xa122('0x18')]=!![];_0x175366[_0xa122('0x86')]=moment()[_0xa122('0x63')](_0xa122('0x7b'));_0x175366[_0xa122('0x87')]=_0xa122('0x88');_0x175366[_0xa122('0x89')]=null;logger[_0xa122('0x6f')](_0xa122('0x8a'),_0x175366[_0xa122('0x4d')],_0x175366[_0xa122('0x55')]);this[_0xa122('0xe')][_0x60d551['uniqueid']]=_0x175366;this[_0xa122('0x46')](_0x175366,_0xa122('0x18'));}}}catch(_0x3c5c8c){logger[_0xa122('0x41')]('[%s][voiceQueueReport][queuecallerabandon]',_0x60d551[_0xa122('0x4c')],util[_0xa122('0x43')](_0x3c5c8c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa122('0x9')][_0xa122('0x1b')]=function(_0x5d8795){try{if(this[_0xa122('0x65')](_0x5d8795)){logger[_0xa122('0x4a')](_0xa122('0x8b'),_0x5d8795[_0xa122('0x4c')],util[_0xa122('0x43')](_0x5d8795,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5d8795[_0xa122('0x4c')]]){var _0x555a28=_[_0xa122('0x83')](this[_0xa122('0x40')][_0x5d8795['uniqueid']]);_0x555a28[_0xa122('0x8c')]=moment()['format'](_0xa122('0x7b'));_0x555a28[_0xa122('0x8d')]=_0x5d8795['connectedlinenum'];_0x555a28[_0xa122('0x8e')]=_0x5d8795['connectedlinename'];logger['info'](_0xa122('0x8f'),_0x555a28['name'],_0x555a28['type'],_0x5d8795[_0xa122('0x8d')],_0x5d8795[_0xa122('0x8e')]);this[_0xa122('0xe')][_0x5d8795[_0xa122('0x4c')]]=_0x555a28;this[_0xa122('0x49')](_0x555a28,'queuecallerleave');}}}catch(_0x23db84){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x5d8795['uniqueid'],util[_0xa122('0x43')](_0x23db84,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa122('0x9')]['syncAgentConnect']=function(_0x39fb8d){try{if(this['isNotNull'](_0x39fb8d)){logger[_0xa122('0x4a')](_0xa122('0x90'),_0x39fb8d[_0xa122('0x4c')],util['inspect'](_0x39fb8d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x39fb8d[_0xa122('0x4c')]]){var _0x54703e=_[_0xa122('0x83')](this['queueReports'][_0x39fb8d['uniqueid']]);_0x54703e[_0xa122('0x91')]=!![];_0x54703e[_0xa122('0x87')]=_0xa122('0x92');logger[_0xa122('0x6f')](_0xa122('0x93'),_0x54703e[_0xa122('0x4d')],_0x54703e['type']);}}}catch(_0x30884c){logger[_0xa122('0x41')](_0xa122('0x90'),_0x39fb8d[_0xa122('0x4c')],util[_0xa122('0x43')](_0x30884c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa122('0x9')][_0xa122('0x1d')]=function(_0x3e75ae){try{if(this[_0xa122('0x65')](_0x3e75ae)){logger[_0xa122('0x4a')](_0xa122('0x94'),_0x3e75ae['uniqueid'],util[_0xa122('0x43')](_0x3e75ae,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3e75ae[_0xa122('0x4c')]]){var _0x341a51=_[_0xa122('0x83')](this[_0xa122('0x40')][_0x3e75ae[_0xa122('0x4c')]]);_0x341a51[_0xa122('0x18')]=![];_0x341a51['queuecallerabandonAt']=null;_0x341a51['assigned']=!![];_0x341a51[_0xa122('0x89')]=_0x3e75ae[_0xa122('0x95')];_0x341a51[_0xa122('0x85')]=_0x3e75ae['holdtime'];_0x341a51[_0xa122('0x91')]=!![];_0x341a51[_0xa122('0x96')]=![];_0x341a51[_0xa122('0x97')]=null;if(!_0x341a51[_0xa122('0x98')]){if(_0x3e75ae[_0xa122('0x99')]==_0xa122('0x98')){_0x341a51[_0xa122('0x87')]='COMPLETED';logger[_0xa122('0x6f')](_0xa122('0x9a'),_0x341a51[_0xa122('0x4d')],_0x341a51['type']);}else{if(_['startsWith'](_0x3e75ae[_0xa122('0x9b')][_0xa122('0x9c')](),_0xa122('0x9d'))){if(this[_0xa122('0x40')][_0x3e75ae[_0xa122('0x9e')]]){var _0x442f43=_[_0xa122('0x83')](this[_0xa122('0x40')][_0x3e75ae['linkedid']]);_0x442f43[_0xa122('0x91')]=![];_0x442f43[_0xa122('0x96')]=!![];_0x442f43[_0xa122('0x97')]=moment(_0x341a51['queuecallerjoinAt'])[_0xa122('0x9f')](_0x3e75ae[_0xa122('0x85')],'seconds')[_0xa122('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x442f43[_0xa122('0x87')]=_0xa122('0xa0');_0x442f43[_0xa122('0x98')]=!![];_0x442f43['transfertype']=_0xa122('0xa1');_0x442f43[_0xa122('0xa2')]=_0x3e75ae[_0xa122('0xa3')];_0x442f43[_0xa122('0xa4')]=_0x3e75ae[_0xa122('0x4c')];logger['info'](_0xa122('0xa5'),_0x442f43[_0xa122('0x4d')],_0x442f43[_0xa122('0x55')]);var _0x51381a=this[_0xa122('0x40')][_0x3e75ae[_0xa122('0x9e')]];this[_0xa122('0x40')][_0x3e75ae[_0xa122('0x9e')]]=this[_0xa122('0x40')][_0x3e75ae['uniqueid']];this[_0xa122('0x40')][_0x3e75ae[_0xa122('0x4c')]]=_0x51381a;}}else{_0x341a51[_0xa122('0x87')]='COMPLETEDBY'+_0x3e75ae['reason'][_0xa122('0xa6')]();logger[_0xa122('0x6f')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x341a51[_0xa122('0x4d')],_0x341a51[_0xa122('0x55')],_0x341a51[_0xa122('0x87')]);}}}this[_0xa122('0xe')][_0x3e75ae[_0xa122('0x4c')]]=_0x341a51;this[_0xa122('0x46')](_0x341a51,_0xa122('0x1c'));}}}catch(_0x14b5e9){logger[_0xa122('0x41')](_0xa122('0x94'),_0x3e75ae[_0xa122('0x4c')],util[_0xa122('0x43')](_0x14b5e9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa122('0x9')]['syncVarSet']=function(_0x388839){try{if(this[_0xa122('0x65')](_0x388839)){logger['debug'](_0xa122('0xa7'),_0x388839[_0xa122('0x4c')],util['inspect'](_0x388839,{'showHidden':![],'depth':null}));this[_0xa122('0xa8')](_0x388839['uniqueid'],_[_0xa122('0xa9')](_0x388839[_0xa122('0xaa')])[0x0],_0x388839[_0xa122('0xab')]);if(this[_0xa122('0x40')][_0x388839[_0xa122('0x4c')]]){var _0x48618e=_[_0xa122('0x83')](this['queueReports'][_0x388839['uniqueid']]);if(_0x48618e){if(this[_0xa122('0x65')](_0x388839['variable'])&&this[_0xa122('0x65')](_0x388839[_0xa122('0xaa')][_0xa122('0xac')])){switch(_0x388839['value']){case _0xa122('0xad'):_0x48618e[_0xa122('0x96')]=![];_0x48618e[_0xa122('0x97')]=null;break;case _0xa122('0xae'):_0x48618e['lastevent']=_0xa122('0xaf');_0x48618e[_0xa122('0x96')]=!![];_0x48618e[_0xa122('0x97')]=moment()['format'](_0xa122('0x7b'));_0x48618e[_0xa122('0x8c')]=moment()[_0xa122('0x63')](_0xa122('0x7b'));logger[_0xa122('0x4a')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x388839['uniqueid'],util[_0xa122('0x43')](_0x48618e,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x48618e);break;default:_0x48618e[_0xa122('0x96')]=!![];_0x48618e['queuecallerexitAt']=moment()[_0xa122('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x48618e[_0xa122('0x8c')]=moment()[_0xa122('0x63')]('YYYY-MM-DD\x20HH:mm:ss');}_0x48618e[_0xa122('0x18')]=![];_0x48618e[_0xa122('0x86')]=null;_0x48618e[_0xa122('0x87')]=_0x388839['value'];this[_0xa122('0xe')][_0x388839['uniqueid']]=_0x48618e;this['emitVoiceQueueChannelRemove'](_0x48618e,_0xa122('0xb0'));}else if(this['isNotNull'](_0x388839['variable'])&&this[_0xa122('0x65')](_0x388839[_0xa122('0xaa')][_0xa122('0xb1')])){if(!_0x48618e['queuecallerabandon']){_0x48618e['queuecallerexit']=!![];_0x48618e['queuecallerexitAt']=moment()[_0xa122('0x63')](_0xa122('0x7b'));_0x48618e['queuecallerexitreason']='EXITWITHKEY';_0x48618e[_0xa122('0x8c')]=moment()[_0xa122('0x63')](_0xa122('0x7b'));this[_0xa122('0xe')][_0x388839['uniqueid']]=_0x48618e;}}logger[_0xa122('0x6f')](_0xa122('0xb2'),_0x388839[_0xa122('0x4c')],_0x48618e[_0xa122('0x4d')],_0x48618e[_0xa122('0x55')],_[_0xa122('0xa9')](_0x388839[_0xa122('0xaa')])[0x0],_0x388839[_0xa122('0xab')]);_0x48618e[_0xa122('0x12')]=this[_0xa122('0x12')][_0x388839['uniqueid']];}}}}catch(_0x395041){logger[_0xa122('0x41')]('[%s][voiceQueueReport][varset]',_0x388839[_0xa122('0x4c')],util[_0xa122('0x43')](_0x395041,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa122('0x9')][_0xa122('0xa8')]=function(_0x59cde0,_0x1e64a4,_0xe5e422){var _0x32e9d5=[_0xa122('0xb3'),_0xa122('0xb4'),_0xa122('0xb5'),_0xa122('0xb6'),_0xa122('0xb7'),_0xa122('0xb8'),_0xa122('0xb9'),_0xa122('0xba'),_0xa122('0xbb'),_0xa122('0xbc'),_0xa122('0xbd'),_0xa122('0xbe'),_0xa122('0xbf'),_0xa122('0xc0'),_0xa122('0xc1'),'memberlastcall',_0xa122('0x95'),_0xa122('0xc2'),_0xa122('0xc3')];if(!_['isNil'](_0x1e64a4)&&!_[_0xa122('0xc4')](_0x32e9d5,_0x1e64a4)){if(_['isUndefined'](this['variables'][_0x59cde0])){this['variables'][_0x59cde0]={};}this['variables'][_0x59cde0][_0x1e64a4]=_0xe5e422;}};VoiceQueueReport[_0xa122('0x9')][_0xa122('0x22')]=function(_0x2777c1){try{if(this[_0xa122('0x65')](_0x2777c1)){logger['debug'](_0xa122('0xc5'),_0x2777c1[_0xa122('0x4c')],util['inspect'](_0x2777c1,{'showHidden':![],'depth':null}));if(this[_0xa122('0x40')][_0x2777c1[_0xa122('0x4c')]]){for(var _0x15ecd5=0x0,_0x2c8090={};_0x15ecd5=0x0?moment(_0x2f5747[_0x83fb('0x18')])['diff'](_0x2f5747[_0x83fb('0x17')],_0x83fb('0xe')):null,'data1':_0x83fb('0x19'),'data2':_0x2f5747[_0x83fb('0x13')],'data3':_0x2f5747[_0x83fb('0x1a')],'data4':_0x2f5747[_0x83fb('0x1b')]||null,'role':_0x83fb('0x12'),'internal':_0x2f5747[_0x83fb('0x13')]?_[_0x83fb('0x14')](_0x2f5747['accountcode']):undefined,'uniqueid':_0x2f5747[_0x83fb('0x1c')]},'log':_0x83fb('0x7')});}; \ No newline at end of file +var _0x9d0e=['lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','isNil','lastAssignedTo','interface','TALKING','queuecallerleaveAt','diff','seconds','exten','queue','accountcode','uniqueid','voiceDialReport','voice','membername','starttime','endtime','outbound','dialstring','agent','toNumber','moment'];(function(_0x12ee01,_0x378aa3){var _0x1ed8ea=function(_0x34df40){while(--_0x34df40){_0x12ee01['push'](_0x12ee01['shift']());}};_0x1ed8ea(++_0x378aa3);}(_0x9d0e,0x1b2));var _0xe9d0=function(_0x413735,_0xaf4d89){_0x413735=_0x413735-0x0;var _0x188274=_0x9d0e[_0x413735];return _0x188274;};'use strict';var moment=require(_0xe9d0('0x0'));var _=require(_0xe9d0('0x1'));var util=require(_0xe9d0('0x2'));var client=require(_0xe9d0('0x3'));exports[_0xe9d0('0x4')]=function(_0x5f5b70){var _0x279f65=_0x5f5b70[_0xe9d0('0x5')]||_0x5f5b70[_0xe9d0('0x6')];return client[_0xe9d0('0x7')](_0xe9d0('0x8'),{'body':{'channel':'voice','membername':_0x5f5b70['lastAssignedTo'],'interface':_[_0xe9d0('0x9')](_0x5f5b70['interface'])?util['format']('SIP/%s',_0x5f5b70[_0xe9d0('0xa')]):_0x5f5b70[_0xe9d0('0xb')],'type':_0xe9d0('0xc'),'enterAt':_0x5f5b70[_0xe9d0('0xd')],'exitAt':_0x279f65,'duration':moment(_0x279f65)[_0xe9d0('0xe')](_0x5f5b70[_0xe9d0('0xd')],_0xe9d0('0xf')),'data1':'inbound','data2':_0x5f5b70['calleridnum'],'data3':_0x5f5b70[_0xe9d0('0x10')],'data4':null,'data5':_0x5f5b70[_0xe9d0('0x11')],'role':'agent','internal':_0x5f5b70[_0xe9d0('0x12')]?_['toNumber'](_0x5f5b70[_0xe9d0('0x12')]):undefined,'uniqueid':_0x5f5b70[_0xe9d0('0x13')]},'log':_0xe9d0('0x8')});};exports[_0xe9d0('0x14')]=function(_0xa6215e){return client[_0xe9d0('0x7')](_0xe9d0('0x8'),{'body':{'channel':_0xe9d0('0x15'),'membername':_0xa6215e[_0xe9d0('0x16')],'interface':_0xa6215e[_0xe9d0('0xb')],'type':_0xe9d0('0xc'),'enterAt':_0xa6215e[_0xe9d0('0x17')],'exitAt':_0xa6215e[_0xe9d0('0x18')],'duration':moment(_0xa6215e[_0xe9d0('0x18')])[_0xe9d0('0xe')](_0xa6215e[_0xe9d0('0x17')],_0xe9d0('0xf'))>=0x0?moment(_0xa6215e[_0xe9d0('0x18')])['diff'](_0xa6215e['starttime'],_0xe9d0('0xf')):null,'data1':_0xe9d0('0x19'),'data2':_0xa6215e[_0xe9d0('0x12')],'data3':_0xa6215e['exten'],'data4':_0xa6215e[_0xe9d0('0x1a')]||null,'role':_0xe9d0('0x1b'),'internal':_0xa6215e['accountcode']?_[_0xe9d0('0x1c')](_0xa6215e[_0xe9d0('0x12')]):undefined,'uniqueid':_0xa6215e[_0xe9d0('0x13')]},'log':_0xe9d0('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index a8729b7..6fe88f2 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 _0x77f4=['ShowSetting','stopRecordingOnTransfer','GetSettings','../client','getSettings','Request'];(function(_0x217e03,_0x49274b){var _0x3b948f=function(_0x1e830e){while(--_0x1e830e){_0x217e03['push'](_0x217e03['shift']());}};_0x3b948f(++_0x49274b);}(_0x77f4,0x1a1));var _0x477f=function(_0x36139b,_0x3911ae){_0x36139b=_0x36139b-0x0;var _0x2bab5a=_0x77f4[_0x36139b];return _0x2bab5a;};'use strict';var client=require(_0x477f('0x0'));exports[_0x477f('0x1')]=function(){return client[_0x477f('0x2')](_0x477f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x477f('0x4')]},'log':_0x477f('0x5')});}; \ No newline at end of file +var _0x9efc=['ShowSetting','stopRecordingOnTransfer','../client','getSettings','Request'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0x9efc,0x19c));var _0xc9ef=function(_0x12a5ac,_0x4cb0d2){_0x12a5ac=_0x12a5ac-0x0;var _0x282958=_0x9efc[_0x12a5ac];return _0x282958;};'use strict';var client=require(_0xc9ef('0x0'));exports[_0xc9ef('0x1')]=function(){return client[_0xc9ef('0x2')](_0xc9ef('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc9ef('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 74e31ce..5618ecc 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 _0x9571=['../client','getTemplates','Request','GetTemplate','name'];(function(_0x13b243,_0x3aeb46){var _0x180d3f=function(_0x1f19e9){while(--_0x1f19e9){_0x13b243['push'](_0x13b243['shift']());}};_0x180d3f(++_0x3aeb46);}(_0x9571,0x1c2));var _0x1957=function(_0x897252,_0x3b8070){_0x897252=_0x897252-0x0;var _0x48d7c3=_0x9571[_0x897252];return _0x48d7c3;};'use strict';var client=require(_0x1957('0x0'));exports[_0x1957('0x1')]=function(_0x2ebe67){return function(_0x116932){return client[_0x1957('0x2')](_0x1957('0x3'),{'options':{'raw':!![],'attributes':['id',_0x1957('0x4'),'html']},'log':_0x1957('0x3')});};}; \ No newline at end of file +var _0xaec0=['Request','GetTemplate','name','html','../client','getTemplates'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xaec0,0x100));var _0x0aec=function(_0x191e97,_0x3b5f73){_0x191e97=_0x191e97-0x0;var _0x4bb482=_0xaec0[_0x191e97];return _0x4bb482;};'use strict';var client=require(_0x0aec('0x0'));exports[_0x0aec('0x1')]=function(_0x160604){return function(_0x43c27e){return client[_0x0aec('0x2')](_0x0aec('0x3'),{'options':{'raw':!![],'attributes':['id',_0x0aec('0x4'),_0x0aec('0x5')]},'log':_0x0aec('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index fc6b6b7..a182ec6 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 _0x3d7e=['data7','../client','getTriggers','Request','GetTrigger','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','action','data3','data5','data6'];(function(_0x4698d2,_0x21c33d){var _0x3404ab=function(_0x5e8c60){while(--_0x5e8c60){_0x4698d2['push'](_0x4698d2['shift']());}};_0x3404ab(++_0x21c33d);}(_0x3d7e,0x9a));var _0xe3d7=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0x3d7e[_0x1780f8];return _0x33a410;};'use strict';var client=require(_0xe3d7('0x0'));exports[_0xe3d7('0x1')]=function(_0x5d3300){return function(_0xfe1a38){return client[_0xe3d7('0x2')](_0xe3d7('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xe3d7('0x4'),_0xe3d7('0x5')],'include':[{'model':_0xe3d7('0x6'),'as':_0xe3d7('0x7'),'attributes':['id',_0xe3d7('0x8'),_0xe3d7('0x9'),_0xe3d7('0xa')]},{'model':_0xe3d7('0x6'),'as':_0xe3d7('0xb'),'attributes':['id',_0xe3d7('0x8'),_0xe3d7('0x9'),_0xe3d7('0xa')]},{'model':'Action','as':'Actions','attributes':['id',_0xe3d7('0xc'),'data1','data2',_0xe3d7('0xd'),'data4',_0xe3d7('0xe'),_0xe3d7('0xf'),_0xe3d7('0x10')]}]},'log':_0xe3d7('0x3')});};}; \ No newline at end of file +var _0x2d7b=['channel','status','field','value','AnyConditions','Action','Actions','data1','data2','data3','data5','data6','../client','GetTrigger','name'];(function(_0x3e0520,_0x25e035){var _0x4a306e=function(_0x3d956d){while(--_0x3d956d){_0x3e0520['push'](_0x3e0520['shift']());}};_0x4a306e(++_0x25e035);}(_0x2d7b,0x138));var _0xb2d7=function(_0x46c9d9,_0x2737da){_0x46c9d9=_0x46c9d9-0x0;var _0x26c27a=_0x2d7b[_0x46c9d9];return _0x26c27a;};'use strict';var client=require(_0xb2d7('0x0'));exports['getTriggers']=function(_0x4ba0b0){return function(_0x2ddf7b){return client['Request'](_0xb2d7('0x1'),{'options':{'raw':![],'attributes':['id',_0xb2d7('0x2'),_0xb2d7('0x3'),_0xb2d7('0x4')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xb2d7('0x5'),'operator',_0xb2d7('0x6')]},{'model':'Condition','as':_0xb2d7('0x7'),'attributes':['id',_0xb2d7('0x5'),'operator',_0xb2d7('0x6')]},{'model':_0xb2d7('0x8'),'as':_0xb2d7('0x9'),'attributes':['id','action',_0xb2d7('0xa'),_0xb2d7('0xb'),_0xb2d7('0xc'),'data4',_0xb2d7('0xd'),_0xb2d7('0xe'),'data7']}]},'log':_0xb2d7('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index e4ff1cc..444885a 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 _0xea09=['name','registry'];(function(_0x4f92a2,_0x175408){var _0x5c7bbf=function(_0xf9675){while(--_0xf9675){_0x4f92a2['push'](_0x4f92a2['shift']());}};_0x5c7bbf(++_0x175408);}(_0xea09,0xd0));var _0x9ea0=function(_0x1e36e1,_0x40d14d){_0x1e36e1=_0x1e36e1-0x0;var _0x167fd2=_0xea09[_0x1e36e1];return _0x167fd2;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x3dea1e){return function(_0x52d790){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9ea0('0x0'),_0x9ea0('0x1'),'defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x135c=['name','registry','defaultuser','../client','getTrunks'];(function(_0x3a3ca0,_0x495df3){var _0x3c9beb=function(_0x25e53a){while(--_0x25e53a){_0x3a3ca0['push'](_0x3a3ca0['shift']());}};_0x3c9beb(++_0x495df3);}(_0x135c,0xda));var _0xc135=function(_0x5bb8b8,_0x45eae9){_0x5bb8b8=_0x5bb8b8-0x0;var _0x308e6f=_0x135c[_0x5bb8b8];return _0x308e6f;};'use strict';var client=require(_0xc135('0x0'));exports[_0xc135('0x1')]=function(_0x5661c9){return function(_0x89a1a2){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc135('0x2'),_0xc135('0x3'),_0xc135('0x4')]},'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 6b0dfe2..7f99055 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x5bb343,_0x4fedef){var _0x139ea8=function(_0xd73513){while(--_0xd73513){_0x5bb343['push'](_0x5bb343['shift']());}};_0x139ea8(++_0x4fedef);}(_0xedd9,0xfc));var _0x9edd=function(_0x28d5c0,_0x2d0885){_0x28d5c0=_0x28d5c0-0x0;var _0x248532=_0xedd9[_0x28d5c0];return _0x248532;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x1b3754,_0x4ad4f2){var _0xb5f297=function(_0x5e3797){while(--_0x5e3797){_0x1b3754['push'](_0x1b3754['shift']());}};_0xb5f297(++_0x4ad4f2);}(_0xedd9,0xfc));var _0x9edd=function(_0x201c02,_0x714f6c){_0x201c02=_0x201c02-0x0;var _0x3ff330=_0xedd9[_0x201c02];return _0x3ff330;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 8ea1f7d..8f034e0 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 _0x6e43=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0xaa88ec,_0x3acb7d){var _0x550dcc=function(_0x10fc31){while(--_0x10fc31){_0xaa88ec['push'](_0xaa88ec['shift']());}};_0x550dcc(++_0x3acb7d);}(_0x6e43,0x191));var _0x36e4=function(_0x47b323,_0x42f193){_0x47b323=_0x47b323-0x0;var _0x56013d=_0x6e43[_0x47b323];return _0x56013d;};'use strict';var client=require(_0x36e4('0x0'));exports[_0x36e4('0x1')]=function(_0xd9c55){return client[_0x36e4('0x2')](_0x36e4('0x3'),{'body':_0xd9c55,'log':_0x36e4('0x3')});};exports['update']=function(_0x407734,_0x9c012e,_0x2b0fe0){return client[_0x36e4('0x2')](_0x36e4('0x4'),{'body':_0x407734,'options':{'where':{'uniqueid':_0x9c012e,'interface':_0x2b0fe0,'agentcomplete':!![]}},'log':_0x36e4('0x4')});}; \ No newline at end of file +var _0x11f0=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x55c08b,_0x55d9e2){var _0x3b3a30=function(_0x320737){while(--_0x320737){_0x55c08b['push'](_0x55c08b['shift']());}};_0x3b3a30(++_0x55d9e2);}(_0x11f0,0x1d6));var _0x011f=function(_0x3716ca,_0x42f53b){_0x3716ca=_0x3716ca-0x0;var _0x276213=_0x11f0[_0x3716ca];return _0x276213;};'use strict';var client=require(_0x011f('0x0'));exports[_0x011f('0x1')]=function(_0x53fad3){return client[_0x011f('0x2')](_0x011f('0x3'),{'body':_0x53fad3,'log':'CreateVoiceAgentReport'});};exports[_0x011f('0x4')]=function(_0x42268c,_0x1d3ab4,_0x2c9dab){return client['Request'](_0x011f('0x5'),{'body':_0x42268c,'options':{'where':{'uniqueid':_0x1d3ab4,'interface':_0x2c9dab,'agentcomplete':!![]}},'log':_0x011f('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index bfee8c9..bfd878f 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 _0xda04=['context','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','../client','create','calleridnum'];(function(_0x59fcf2,_0xb9f0a6){var _0xf56461=function(_0xe26a77){while(--_0xe26a77){_0x59fcf2['push'](_0x59fcf2['shift']());}};_0xf56461(++_0xb9f0a6);}(_0xda04,0x1f4));var _0x4da0=function(_0x4ae96b,_0x394c2f){_0x4ae96b=_0x4ae96b-0x0;var _0x1689c1=_0xda04[_0x4ae96b];return _0x1689c1;};'use strict';var moment=require(_0x4da0('0x0'));var util=require(_0x4da0('0x1'));var _=require(_0x4da0('0x2'));var client=require(_0x4da0('0x3'));exports[_0x4da0('0x4')]=function(_0xedd6b6){return client['Request']('CreateVoiceCallReport',{'body':_['merge'](_0xedd6b6,{'source':_0xedd6b6[_0x4da0('0x5')],'destinationcontext':_0xedd6b6[_0x4da0('0x6')],'callerid':_0xedd6b6['callerid'],'amaflags':_0x4da0('0x7')}),'log':_0x4da0('0x8')});};exports[_0x4da0('0x9')]=function(){return function(){return client[_0x4da0('0xa')](_0x4da0('0xb'),{'options':{'where':{'type':[_0x4da0('0xc')],'createdAt':{'$between':[moment()[_0x4da0('0xd')](_0x4da0('0xe'))[_0x4da0('0xf')](_0x4da0('0x10')),moment()[_0x4da0('0x11')](_0x4da0('0xe'))[_0x4da0('0xf')](_0x4da0('0x10'))]}},'attributes':[_0x4da0('0x12'),_0x4da0('0x13'),_0x4da0('0x14'),'billableseconds']},'log':_0x4da0('0x15')});};}; \ No newline at end of file +var _0x6565=['merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','moment','util','../client','create','CreateVoiceCallReport'];(function(_0x2f688e,_0x58e6f7){var _0x55bc86=function(_0x5b8884){while(--_0x5b8884){_0x2f688e['push'](_0x2f688e['shift']());}};_0x55bc86(++_0x58e6f7);}(_0x6565,0x10c));var _0x5656=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x6565[_0x21549c];return _0x426cbd;};'use strict';var moment=require(_0x5656('0x0'));var util=require(_0x5656('0x1'));var _=require('lodash');var client=require(_0x5656('0x2'));exports[_0x5656('0x3')]=function(_0x33f57f){return client['Request'](_0x5656('0x4'),{'body':_[_0x5656('0x5')](_0x33f57f,{'source':_0x33f57f[_0x5656('0x6')],'destinationcontext':_0x33f57f[_0x5656('0x7')],'callerid':_0x33f57f['callerid'],'amaflags':_0x5656('0x8')}),'log':_0x5656('0x4')});};exports[_0x5656('0x9')]=function(){return function(){return client[_0x5656('0xa')](_0x5656('0xb'),{'options':{'where':{'type':[_0x5656('0xc')],'createdAt':{'$between':[moment()[_0x5656('0xd')](_0x5656('0xe'))[_0x5656('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x5656('0x10')](_0x5656('0xe'))[_0x5656('0xf')](_0x5656('0x11'))]}},'attributes':[_0x5656('0x12'),'disposition',_0x5656('0x13'),_0x5656('0x14')]},'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 e51ea29..5dcd68e 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 _0x3962=['Request','CreateVoiceDialReport','../client','create'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3962,0x66));var _0x2396=function(_0xa0ada3,_0xd8c69f){_0xa0ada3=_0xa0ada3-0x0;var _0x8eeb16=_0x3962[_0xa0ada3];return _0x8eeb16;};'use strict';var client=require(_0x2396('0x0'));exports[_0x2396('0x1')]=function(_0x24fa80){return client[_0x2396('0x2')](_0x2396('0x3'),{'body':_0x24fa80,'log':_0x2396('0x3')});}; \ No newline at end of file +var _0xf09f=['../client','CreateVoiceDialReport'];(function(_0xc8445f,_0x4be775){var _0x188821=function(_0x1cc602){while(--_0x1cc602){_0xc8445f['push'](_0xc8445f['shift']());}};_0x188821(++_0x4be775);}(_0xf09f,0x1d0));var _0xff09=function(_0x6681e0,_0x56d36e){_0x6681e0=_0x6681e0-0x0;var _0x1e2d5f=_0xf09f[_0x6681e0];return _0x1e2d5f;};'use strict';var client=require(_0xff09('0x0'));exports['create']=function(_0x315f26){return client['Request'](_0xff09('0x1'),{'body':_0x315f26,'log':_0xff09('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 49ca0a4..533a74a 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 _0x22dd=['../client','getVoiceExtensions','Request','recordingFormat'];(function(_0x3e66bf,_0x5cd307){var _0x61abbc=function(_0x46ff62){while(--_0x46ff62){_0x3e66bf['push'](_0x3e66bf['shift']());}};_0x61abbc(++_0x5cd307);}(_0x22dd,0xe4));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd22d('0x0'));exports[_0xd22d('0x1')]=function(){return function(){return client[_0xd22d('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0xd22d('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xd22d('0x1')});};}; \ No newline at end of file +var _0x3c81=['GetVoiceExtension','exten','../client','getVoiceExtensions'];(function(_0x5d4b13,_0x50e726){var _0x5ac5f9=function(_0x14f242){while(--_0x14f242){_0x5d4b13['push'](_0x5d4b13['shift']());}};_0x5ac5f9(++_0x50e726);}(_0x3c81,0x102));var _0x13c8=function(_0x2aa433,_0x1a83f3){_0x2aa433=_0x2aa433-0x0;var _0x47777e=_0x3c81[_0x2aa433];return _0x47777e;};'use strict';var client=require(_0x13c8('0x0'));exports[_0x13c8('0x1')]=function(){return function(){return client['Request'](_0x13c8('0x2'),{'options':{'raw':!![],'attributes':['id',_0x13c8('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 7594da0..54cecbb 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 _0xe411=['type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','TrunkBackup','Interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format'];(function(_0x53c4b6,_0x449ab5){var _0x12ab01=function(_0x35691b){while(--_0x35691b){_0x53c4b6['push'](_0x53c4b6['shift']());}};_0x12ab01(++_0x449ab5);}(_0xe411,0x1a3));var _0x1e41=function(_0x42c289,_0x4c3e0e){_0x42c289=_0x42c289-0x0;var _0x56f3c3=_0xe411[_0x42c289];return _0x56f3c3;};'use strict';var client=require('../client');exports[_0x1e41('0x0')]=function(){return function(){return client[_0x1e41('0x1')](_0x1e41('0x2'),{'options':{'raw':![],'attributes':['id',_0x1e41('0x3'),_0x1e41('0x4'),_0x1e41('0x5'),_0x1e41('0x6'),_0x1e41('0x7'),_0x1e41('0x8'),_0x1e41('0x9'),_0x1e41('0xa'),_0x1e41('0xb'),_0x1e41('0xc'),'dialPowerLevel','dialPredictiveOptimization',_0x1e41('0xd'),_0x1e41('0xe'),_0x1e41('0xf'),'dialOriginateCallerIdNumber',_0x1e41('0x10'),_0x1e41('0x11'),'dialQueueTimeout',_0x1e41('0x12'),_0x1e41('0x13'),_0x1e41('0x14'),_0x1e41('0x15'),_0x1e41('0x16'),_0x1e41('0x17'),_0x1e41('0x18'),_0x1e41('0x19'),_0x1e41('0x1a'),_0x1e41('0x1b'),_0x1e41('0x1c'),_0x1e41('0x1d'),_0x1e41('0x1e'),_0x1e41('0x1f'),_0x1e41('0x20'),_0x1e41('0x21'),_0x1e41('0x22'),'dialAMDMinWordLength',_0x1e41('0x23'),_0x1e41('0x24'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout',_0x1e41('0x25'),_0x1e41('0x26'),_0x1e41('0x27'),_0x1e41('0x28'),_0x1e41('0x29'),'monitor_format',_0x1e41('0x2a'),_0x1e41('0x2b'),_0x1e41('0x2c'),_0x1e41('0x2d'),_0x1e41('0x2e'),_0x1e41('0x2f'),_0x1e41('0x30'),_0x1e41('0x31'),_0x1e41('0x32'),'dialMachineMaxRetry',_0x1e41('0x33'),_0x1e41('0x34'),'dialAgentRejectRetryFrequency',_0x1e41('0x35'),_0x1e41('0x36'),_0x1e41('0x37')],'include':[{'model':_0x1e41('0x38'),'as':_0x1e41('0x38'),'attributes':['id',_0x1e41('0x3'),_0x1e41('0x39'),_0x1e41('0x3a')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id','name']},{'model':'Trunk','as':_0x1e41('0x3b'),'attributes':['id',_0x1e41('0x3'),_0x1e41('0x39'),'active']},{'model':_0x1e41('0x3c'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x1e41('0x3c'),'as':'Intervals','attributes':['id',_0x1e41('0x3'),'interval']}]}]},'log':_0x1e41('0x0')});};}; \ No newline at end of file +var _0x7dca=['dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','GetVoiceQueue','name','acw','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x4b9d84,_0x49692a){var _0xd92cc3=function(_0x5b37f7){while(--_0x5b37f7){_0x4b9d84['push'](_0x4b9d84['shift']());}};_0xd92cc3(++_0x49692a);}(_0x7dca,0x19d));var _0xa7dc=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x7dca[_0x2d34d6];return _0x1d3d12;};'use strict';var client=require(_0xa7dc('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0xa7dc('0x1'),{'options':{'raw':![],'attributes':['id',_0xa7dc('0x2'),_0xa7dc('0x3'),'acwTimeout','autopause',_0xa7dc('0x4'),_0xa7dc('0x5'),_0xa7dc('0x6'),_0xa7dc('0x7'),_0xa7dc('0x8'),'dialLimitQueue',_0xa7dc('0x9'),_0xa7dc('0xa'),'dialPredictiveOptimizationPercentage',_0xa7dc('0xb'),_0xa7dc('0xc'),_0xa7dc('0xd'),_0xa7dc('0xe'),_0xa7dc('0xf'),_0xa7dc('0x10'),_0xa7dc('0x11'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0xa7dc('0x12'),'dialBusyRetryFrequency',_0xa7dc('0x13'),_0xa7dc('0x14'),'dialGlobalMaxRetry',_0xa7dc('0x15'),'dialGlobalInterval','dialPrefix',_0xa7dc('0x16'),_0xa7dc('0x17'),'dialAMDInitialSilence',_0xa7dc('0x18'),'dialAMDAfterGreetingSilence',_0xa7dc('0x19'),_0xa7dc('0x1a'),_0xa7dc('0x1b'),_0xa7dc('0x1c'),_0xa7dc('0x1d'),_0xa7dc('0x1e'),_0xa7dc('0x1f'),'dialRecallMeTimeout',_0xa7dc('0x20'),_0xa7dc('0x21'),_0xa7dc('0x22'),_0xa7dc('0x23'),_0xa7dc('0x24'),'monitor_format',_0xa7dc('0x25'),_0xa7dc('0x26'),_0xa7dc('0x27'),'dialNoSuchNumberMaxRetry',_0xa7dc('0x28'),'dialDropMaxRetry',_0xa7dc('0x29'),_0xa7dc('0x2a'),_0xa7dc('0x2b'),_0xa7dc('0x2c'),'dialMachineRetryFrequency',_0xa7dc('0x2d'),_0xa7dc('0x2e'),'mandatoryDisposition',_0xa7dc('0x2f'),_0xa7dc('0x30')],'include':[{'model':'Trunk','as':_0xa7dc('0x31'),'attributes':['id',_0xa7dc('0x2'),_0xa7dc('0x32'),_0xa7dc('0x33')]},{'model':'Pause','as':_0xa7dc('0x34'),'attributes':['id','name']},{'model':_0xa7dc('0x31'),'as':_0xa7dc('0x35'),'attributes':['id',_0xa7dc('0x2'),_0xa7dc('0x32'),'active']},{'model':_0xa7dc('0x36'),'as':_0xa7dc('0x36'),'attributes':['id','name'],'include':[{'model':_0xa7dc('0x36'),'as':_0xa7dc('0x37'),'attributes':['id','name',_0xa7dc('0x38')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 0101764..c5913ec 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(_0x106bc0,_0xa99a1a){var _0x654490=function(_0x371002){while(--_0x371002){_0x106bc0['push'](_0x106bc0['shift']());}};_0x654490(++_0xa99a1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x2d2463,_0x2f9d02){var _0xc7e60a=function(_0x3ea7db){while(--_0x3ea7db){_0x2d2463['push'](_0x2d2463['shift']());}};_0xc7e60a(++_0x2f9d02);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 83058a9..159e9c8 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 _0x3af6=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client','Request'];(function(_0x338116,_0x123fbe){var _0x2a7d3f=function(_0x40917d){while(--_0x40917d){_0x338116['push'](_0x338116['shift']());}};_0x2a7d3f(++_0x123fbe);}(_0x3af6,0x1b6));var _0x63af=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3af6[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x63af('0x0'));exports['getVoiceQueueRtPauses']=function(_0x2a7ec1){return function(){return client[_0x63af('0x1')](_0x63af('0x2'),{'options':{'where':{'VoiceQueueId':_0x2a7ec1,'paused':!![]},'raw':!![]},'log':_0x63af('0x3')});};}; \ No newline at end of file +var _0x2064=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x219947,_0x388474){var _0x5196ec=function(_0x4e98bc){while(--_0x4e98bc){_0x219947['push'](_0x219947['shift']());}};_0x5196ec(++_0x388474);}(_0x2064,0x1f0));var _0x4206=function(_0x1512a7,_0x40f550){_0x1512a7=_0x1512a7-0x0;var _0x5e2da8=_0x2064[_0x1512a7];return _0x5e2da8;};'use strict';var client=require(_0x4206('0x0'));exports[_0x4206('0x1')]=function(_0x570260){return function(){return client[_0x4206('0x2')](_0x4206('0x3'),{'options':{'where':{'VoiceQueueId':_0x570260,'paused':!![]},'raw':!![]},'log':_0x4206('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 3ae4545..a04ab82 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(_0x30f234,_0x2b30f1){var _0x498c10=function(_0x25cfcc){while(--_0x25cfcc){_0x30f234['push'](_0x30f234['shift']());}};_0x498c10(++_0x2b30f1);}(_0x7a54,0x106));var _0x47a5=function(_0x2067b1,_0x24fa0a){_0x2067b1=_0x2067b1-0x0;var _0x3bbedc=_0x7a54[_0x2067b1];return _0x3bbedc;};'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(_0x49e99a,_0x559e80){var _0x1d0361=function(_0xf6ce7b){while(--_0xf6ce7b){_0x49e99a['push'](_0x49e99a['shift']());}};_0x1d0361(++_0x559e80);}(_0x7a54,0x106));var _0x47a5=function(_0x489153,_0x5c8a6b){_0x489153=_0x489153-0x0;var _0x40247f=_0x7a54[_0x489153];return _0x40247f;};'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 48f9f52..79bd17f 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 _0x9ee3=['transfertargetchannel','transfertargetcalleridnum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','result','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid'];(function(_0xe16f3c,_0x2ee8c4){var _0x7df2cb=function(_0x4322ce){while(--_0x4322ce){_0xe16f3c['push'](_0xe16f3c['shift']());}};_0x7df2cb(++_0x2ee8c4);}(_0x9ee3,0xb6));var _0x39ee=function(_0x3f6c4c,_0x3f0f3b){_0x3f6c4c=_0x3f6c4c-0x0;var _0x2a7a8c=_0x9ee3[_0x3f6c4c];return _0x2a7a8c;};'use strict';var client=require(_0x39ee('0x0'));exports[_0x39ee('0x1')]={};exports['blindTransfer']=function(_0x413e37){return client[_0x39ee('0x2')](_0x39ee('0x3'),{'body':{'result':_0x413e37['result'],'transfererchannel':_0x413e37[_0x39ee('0x4')],'transferercalleridnum':_0x413e37['transferercalleridnum'],'transferercalleridname':_0x413e37[_0x39ee('0x5')],'transfererconnectedlinenum':_0x413e37[_0x39ee('0x6')],'transfererconnectedlinename':_0x413e37[_0x39ee('0x7')],'transfereraccountcode':_0x413e37['transfereraccountcode'],'transferercontext':_0x413e37[_0x39ee('0x8')],'transfererexten':_0x413e37['transfererexten'],'transfererlinkedid':_0x413e37[_0x39ee('0x9')],'transfereechannel':_0x413e37[_0x39ee('0xa')],'transfereecalleridnum':_0x413e37[_0x39ee('0xb')],'transfereecalleridname':_0x413e37['transfereecalleridname'],'transfereeconnectedlinenum':_0x413e37[_0x39ee('0xc')],'transfereeconnectedlinename':_0x413e37[_0x39ee('0xd')],'transfereeaccountcode':_0x413e37[_0x39ee('0xe')],'transfereecontext':_0x413e37[_0x39ee('0xf')],'transfereeexten':_0x413e37[_0x39ee('0x10')],'transfereelinkedid':_0x413e37[_0x39ee('0x11')],'isexternal':_0x413e37[_0x39ee('0x12')],'context':_0x413e37['context'],'extension':_0x413e37[_0x39ee('0x13')],'type':'blind'},'log':_0x39ee('0x3')});};exports['attendedTransfer']=function(_0x503e14){return client['Request'](_0x39ee('0x3'),{'body':{'result':_0x503e14[_0x39ee('0x14')],'transfererchannel':_0x503e14['origtransfererchannel'],'transferercalleridnum':_0x503e14['origtransferercalleridnum'],'transferercalleridname':_0x503e14[_0x39ee('0x15')],'transfererconnectedlinenum':_0x503e14[_0x39ee('0x16')],'transfererconnectedlinename':_0x503e14[_0x39ee('0x17')],'transfereraccountcode':_0x503e14[_0x39ee('0x18')],'transferercontext':_0x503e14[_0x39ee('0x19')],'transfererexten':_0x503e14[_0x39ee('0x1a')],'transfererlinkedid':_0x503e14[_0x39ee('0x1b')],'transfereechannel':_0x503e14[_0x39ee('0x1c')],'transfereecalleridnum':_0x503e14[_0x39ee('0x1d')],'transfereecalleridname':_0x503e14['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x503e14['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x503e14['transfertargetconnectedlinename'],'transfereeaccountcode':_0x503e14[_0x39ee('0x1e')],'transfereecontext':_0x503e14[_0x39ee('0x1f')],'transfereeexten':_0x503e14['transfertargetexten'],'transfereelinkedid':_0x503e14[_0x39ee('0x20')],'isexternal':_0x503e14[_0x39ee('0x12')],'context':_0x503e14[_0x39ee('0x21')],'extension':_0x503e14['origtransfererexten'],'type':_0x39ee('0x22')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x434b=['transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x434b,0x1e7));var _0xb434=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x434b[_0x355ce8];return _0x1db8b8;};'use strict';var client=require(_0xb434('0x0'));exports[_0xb434('0x1')]={};exports[_0xb434('0x2')]=function(_0x3fc340){return client[_0xb434('0x3')](_0xb434('0x4'),{'body':{'result':_0x3fc340['result'],'transfererchannel':_0x3fc340[_0xb434('0x5')],'transferercalleridnum':_0x3fc340[_0xb434('0x6')],'transferercalleridname':_0x3fc340['transferercalleridname'],'transfererconnectedlinenum':_0x3fc340[_0xb434('0x7')],'transfererconnectedlinename':_0x3fc340['transfererconnectedlinename'],'transfereraccountcode':_0x3fc340[_0xb434('0x8')],'transferercontext':_0x3fc340[_0xb434('0x9')],'transfererexten':_0x3fc340[_0xb434('0xa')],'transfererlinkedid':_0x3fc340[_0xb434('0xb')],'transfereechannel':_0x3fc340['transfereechannel'],'transfereecalleridnum':_0x3fc340[_0xb434('0xc')],'transfereecalleridname':_0x3fc340[_0xb434('0xd')],'transfereeconnectedlinenum':_0x3fc340[_0xb434('0xe')],'transfereeconnectedlinename':_0x3fc340[_0xb434('0xf')],'transfereeaccountcode':_0x3fc340[_0xb434('0x10')],'transfereecontext':_0x3fc340[_0xb434('0x11')],'transfereeexten':_0x3fc340[_0xb434('0x12')],'transfereelinkedid':_0x3fc340[_0xb434('0x13')],'isexternal':_0x3fc340[_0xb434('0x14')],'context':_0x3fc340[_0xb434('0x15')],'extension':_0x3fc340[_0xb434('0x16')],'type':'blind'},'log':_0xb434('0x4')});};exports[_0xb434('0x17')]=function(_0x49f231){return client['Request'](_0xb434('0x4'),{'body':{'result':_0x49f231[_0xb434('0x18')],'transfererchannel':_0x49f231[_0xb434('0x19')],'transferercalleridnum':_0x49f231[_0xb434('0x1a')],'transferercalleridname':_0x49f231[_0xb434('0x1b')],'transfererconnectedlinenum':_0x49f231['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x49f231[_0xb434('0x1c')],'transfereraccountcode':_0x49f231[_0xb434('0x1d')],'transferercontext':_0x49f231['secondtransferercontext'],'transfererexten':_0x49f231['secondtransfererexten'],'transfererlinkedid':_0x49f231['origtransfererlinkedid'],'transfereechannel':_0x49f231[_0xb434('0x1e')],'transfereecalleridnum':_0x49f231[_0xb434('0x1f')],'transfereecalleridname':_0x49f231[_0xb434('0x20')],'transfereeconnectedlinenum':_0x49f231[_0xb434('0x21')],'transfereeconnectedlinename':_0x49f231[_0xb434('0x22')],'transfereeaccountcode':_0x49f231[_0xb434('0x23')],'transfereecontext':_0x49f231[_0xb434('0x24')],'transfereeexten':_0x49f231[_0xb434('0x25')],'transfereelinkedid':_0x49f231[_0xb434('0x26')],'isexternal':_0x49f231[_0xb434('0x14')],'context':_0x49f231[_0xb434('0x27')],'extension':_0x49f231['origtransfererexten'],'type':_0xb434('0x28')},'log':_0xb434('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 989d1f4..b1d4bed 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb511=['outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','username','map','channel','filename','uniqueid','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','MixMonitor\x20Success','catch','Channel\x20doesn\x27t\x20exist','voicechannel','validate','StopMixMonitor','destinationchannel','stop','%s.%s','status','queueChannels','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','asterisk','ami\x20disconnected','join','keys','module','action','Action','then','message','error','pick','command','content','voiceQueues','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay'];(function(_0x5e5626,_0x38b6a8){var _0x3b402e=function(_0x2d671){while(--_0x2d671){_0x5e5626['push'](_0x5e5626['shift']());}};_0x3b402e(++_0x38b6a8);}(_0xb511,0x165));var _0x1b51=function(_0x49a854,_0x59159d){_0x49a854=_0x49a854-0x0;var _0x74720a=_0xb511[_0x49a854];return _0x74720a;};'use strict';var _=require(_0x1b51('0x0'));var util=require(_0x1b51('0x1'));var jayson=require(_0x1b51('0x2'));var schema=require('validate');var BPromise=require(_0x1b51('0x3'));var moment=require(_0x1b51('0x4'));var config=require('../../../config/environment');var properties=require(_0x1b51('0x5'));var ami=require(_0x1b51('0x6'));exports[_0x1b51('0x7')]=function(_0x4d17ab,_0x14e88a,_0x463bec){return new BPromise(function(_0x506653,_0x475add){var _0x43c14c={'QueuePause':function(_0x5e7ece){return new Promise(function(_0xfa46a3,_0x1690c9){var _0x407a2f=util[_0x1b51('0x8')](_0x1b51('0x9'),_0x1b51('0xa'),_0x5e7ece[_0x1b51('0xb')]);if(_0x4d17ab[_0x1b51('0xc')]&&_0x4d17ab['timers'][_0x407a2f]&&_0x4d17ab[_0x1b51('0xc')][_0x407a2f][_0x1b51('0xd')]){_0x4d17ab[_0x1b51('0xc')][_0x407a2f][_0x1b51('0xe')]();}if(_0x4d17ab[_0x1b51('0xf')][_0x407a2f]){_0x4d17ab[_0x1b51('0xf')][_0x407a2f]['updateStatusRealtime']({'statePause':_0x5e7ece[_0x1b51('0x10')]?!![]:![]});}_0xfa46a3({'code':0xc8,'message':_0x1b51('0x11')});});},'Reload':function(_0x146dc0){var _0x119628=this;return new Promise(function(_0x3abd5c,_0x46c991){if(ami[_0x1b51('0x12')]()==![]){return _0x46c991(_0x119628['error'](0x1f4,[config[_0x1b51('0x13')]['ip'],config['asterisk']['username'],_0x1b51('0x14')][_0x1b51('0x15')]('\x20')));}_0x146dc0=_['pick'](_0x146dc0,_[_0x1b51('0x16')](properties[_0x1b51('0x17')]));_0x146dc0[_0x1b51('0x18')]='Reload';return ami[_0x1b51('0x19')](_0x146dc0)[_0x1b51('0x1a')](function(_0x24bfc1){_0x3abd5c({'code':0xc8,'message':_0x24bfc1[_0x1b51('0x1b')]});})['catch'](function(_0x238749){_0x46c991(_0x119628[_0x1b51('0x1c')](0x1f5,_0x238749[_0x1b51('0x1b')]));});});},'Command':function(_0x556762){var _0x5e222b=this;return new Promise(function(_0x1d67f3,_0x3ff992){if(ami['isConnected']()==![]){return _0x3ff992(_0x5e222b[_0x1b51('0x1c')](0x1f4,[config[_0x1b51('0x13')]['ip'],config['asterisk']['username'],_0x1b51('0x14')][_0x1b51('0x15')]('\x20')));}_0x556762=_[_0x1b51('0x1d')](_0x556762,_0x1b51('0x1e'));_0x556762['action']='Command';return ami[_0x1b51('0x19')](_0x556762)[_0x1b51('0x1a')](function(_0x4c6c6b){_0x1d67f3({'code':0xc8,'message':_0x4c6c6b[_0x1b51('0x1f')]});})['catch'](function(_0x4a2e45){_0x3ff992(_0x5e222b[_0x1b51('0x1c')](0x1f5,_0x4a2e45['message']));});});},'VoiceQueues':function(_0x1eac36){return new Promise(function(_0x2a720f,_0x54a526){var _0x1ba4d2=[];for(var _0x68cdfb in _0x4d17ab[_0x1b51('0x20')]){if(_0x4d17ab[_0x1b51('0x20')]['hasOwnProperty'](_0x68cdfb)){var _0x5559cf=_0x4d17ab[_0x1b51('0x20')][_0x68cdfb];var _0x1a6c68={'id':_0x5559cf['id'],'name':_0x5559cf[_0x1b51('0xb')],'strategy':_0x5559cf[_0x1b51('0x21')],'answered':_0x5559cf[_0x1b51('0x22')],'available':_0x5559cf[_0x1b51('0x23')],'loggedIn':_0x5559cf[_0x1b51('0x24')],'pTalking':_0x5559cf['pTalking'],'sumBillable':_0x5559cf[_0x1b51('0x25')],'sumDuration':_0x5559cf[_0x1b51('0x26')],'sumHoldTime':_0x5559cf[_0x1b51('0x27')]||0x0,'talking':_0x5559cf['talking'],'total':_0x5559cf[_0x1b51('0x28')],'type':_0x5559cf[_0x1b51('0x29')],'unmanaged':_0x5559cf[_0x1b51('0x2a')],'abandoned':_0x5559cf[_0x1b51('0x2b')],'waiting':_0x5559cf[_0x1b51('0x2c')],'loggedInDb':_0x5559cf[_0x1b51('0x2d')]};if(_0x5559cf[_0x1b51('0x29')]==='outbound'){_0x1a6c68[_0x1b51('0x2e')]=_0x5559cf[_0x1b51('0x2e')];_0x1a6c68[_0x1b51('0x2f')]=_0x5559cf[_0x1b51('0x2f')];_0x1a6c68[_0x1b51('0x30')]=_0x5559cf[_0x1b51('0x30')];_0x1a6c68[_0x1b51('0x31')]=_0x5559cf[_0x1b51('0x31')];_0x1a6c68[_0x1b51('0x32')]=_0x5559cf['dialOriginateTimeout'];_0x1a6c68[_0x1b51('0x33')]=_0x5559cf[_0x1b51('0x33')];_0x1a6c68['temp']=_0x5559cf[_0x1b51('0x34')];_0x1a6c68['outboundAnswerAgiCallsDay']=_0x5559cf[_0x1b51('0x35')];_0x1a6c68[_0x1b51('0x36')]=_0x5559cf[_0x1b51('0x36')];_0x1a6c68[_0x1b51('0x37')]=_0x5559cf['outboundBlacklistCallsDay'];_0x1a6c68[_0x1b51('0x38')]=_0x5559cf[_0x1b51('0x38')];_0x1a6c68[_0x1b51('0x39')]=_0x5559cf[_0x1b51('0x39')];_0x1a6c68['outboundDropCallsDayACS']=_0x5559cf['outboundDropCallsDayACS'];_0x1a6c68[_0x1b51('0x3a')]=_0x5559cf[_0x1b51('0x3a')];_0x1a6c68[_0x1b51('0x3b')]=_0x5559cf[_0x1b51('0x3b')];_0x1a6c68[_0x1b51('0x3c')]=_0x5559cf['outboundNoAnswerCallsDay'];_0x1a6c68[_0x1b51('0x3d')]=_0x5559cf[_0x1b51('0x3d')];_0x1a6c68[_0x1b51('0x3e')]=_0x5559cf[_0x1b51('0x3e')];_0x1a6c68[_0x1b51('0x3f')]=_0x5559cf[_0x1b51('0x3f')];_0x1a6c68['outboundRejectCallsDay']=_0x5559cf[_0x1b51('0x40')];_0x1a6c68[_0x1b51('0x41')]=_0x5559cf[_0x1b51('0x41')];_0x1a6c68[_0x1b51('0x42')]=_0x5559cf['predictiveIntervalAnsweredCalls'];_0x1a6c68[_0x1b51('0x43')]=_0x5559cf[_0x1b51('0x43')];_0x1a6c68[_0x1b51('0x44')]=_0x5559cf[_0x1b51('0x44')];_0x1a6c68['predictiveIntervalDroppedCallsCallersExit']=_0x5559cf[_0x1b51('0x45')];_0x1a6c68[_0x1b51('0x46')]=_0x5559cf[_0x1b51('0x46')];_0x1a6c68['predictiveIntervalErlangCalls']=_0x5559cf['predictiveIntervalErlangCalls'];_0x1a6c68[_0x1b51('0x47')]=_0x5559cf['predictiveIntervalErlangCallsDroppedCalls'];_0x1a6c68[_0x1b51('0x48')]=_0x5559cf['predictiveIntervalHitRate'];_0x1a6c68[_0x1b51('0x49')]=_0x5559cf[_0x1b51('0x49')];_0x1a6c68['predictiveIntervalPauses']=_0x5559cf[_0x1b51('0x4a')];_0x1a6c68['predictiveIntervalAvailable']=_0x5559cf[_0x1b51('0x4b')];_0x1a6c68[_0x1b51('0x4c')]=_0x5559cf[_0x1b51('0x4c')];_0x1a6c68[_0x1b51('0x1b')]=_0x5559cf[_0x1b51('0x1b')];_0x1a6c68[_0x1b51('0x4d')]=_0x5559cf['originated'];_0x1a6c68[_0x1b51('0x4e')]=_0x5559cf[_0x1b51('0x4e')];_0x1a6c68[_0x1b51('0x4f')]=_0x5559cf[_0x1b51('0x4f')];_0x1a6c68[_0x1b51('0x50')]=_0x5559cf[_0x1b51('0x50')];_0x1a6c68['erlangBusyFactor']=_0x5559cf[_0x1b51('0x51')];_0x1a6c68[_0x1b51('0x52')]=_0x5559cf[_0x1b51('0x52')];_0x1a6c68[_0x1b51('0x53')]=_0x5559cf[_0x1b51('0x53')];}if(_0x5559cf[_0x1b51('0x54')]){_0x1a6c68['Trunk']={'id':_0x5559cf[_0x1b51('0x54')]['id'],'name':_0x5559cf[_0x1b51('0x54')]['name'],'active':_0x5559cf[_0x1b51('0x54')][_0x1b51('0x55')],'callerid':_0x5559cf[_0x1b51('0x54')][_0x1b51('0x56')]};}if(_0x5559cf[_0x1b51('0x57')]){_0x1a6c68[_0x1b51('0x57')]={'id':_0x5559cf[_0x1b51('0x57')]['id'],'name':_0x5559cf[_0x1b51('0x57')][_0x1b51('0xb')]};}_0x1ba4d2[_0x1b51('0x58')](_0x1a6c68);}}_0x2a720f({'count':_0x1ba4d2[_0x1b51('0x59')],'rows':_0x1ba4d2});});},'UpdateVoiceQueue':function(_0xd27a41){return new Promise(function(_0x2732e8,_0x3e2921){var _0x526547=_[_0x1b51('0x5a')](_0x4d17ab[_0x1b51('0x20')],{'id':parseInt(_0xd27a41['id'])});var _0x94e9ff=_[_0x1b51('0x5b')](_0xd27a41,['id']);if(_0x526547){for(var _0x1a15b3 in _0x94e9ff){if(typeof _0x94e9ff[_0x1a15b3]!==_0x1b51('0x5c')&&typeof _0x526547[_0x1a15b3]!=='undefined'){_0x526547[_0x1a15b3]=_0x94e9ff[_0x1a15b3];}}_0x2732e8(_0x526547);}else{_0x3e2921();}});},'VoiceChannels':function(_0x3ef6af){return new Promise(function(_0x23035b,_0x43aef2){var _0x3a01d9=_[_0x1b51('0x5d')](_0x4d17ab[_0x1b51('0x5e')]);_0x23035b({'count':_0x3a01d9['length'],'rows':_0x3a01d9});});},'VoiceChannelMixMonitor':function(_0x3db7d3){var _0x16b0ec=this;return new Promise(function(_0xe39db8,_0x595cbc){if(ami[_0x1b51('0x12')]()==![]){return _0x595cbc(_0x16b0ec[_0x1b51('0x1c')](0x1f4,[config[_0x1b51('0x13')]['ip'],config[_0x1b51('0x13')][_0x1b51('0x5f')],_0x1b51('0x14')][_0x1b51('0x15')]('\x20')));}var _0x2d5a57=schema(properties['voicechannel'])['validate'](_0x3db7d3);if(_0x2d5a57['length']>0x0){return _0x595cbc(_0x16b0ec[_0x1b51('0x1c')](0x1f4,_[_0x1b51('0x60')](_0x2d5a57,'message')['join'](',\x20')));}var _0x56736b=_[_0x1b51('0x5a')](_0x4d17ab[_0x1b51('0x5e')],{'uniqueid':_0x3db7d3['uniqueid']});if(_0x56736b&&_0x56736b[_0x1b51('0x61')]){var _0x78b3f5=util[_0x1b51('0x8')]('%s.%s',_0x3db7d3[_0x1b51('0x62')]||_0x3db7d3[_0x1b51('0x63')],_0x3db7d3[_0x1b51('0x8')]||_0x1b51('0x64'));return ami['Action']({'action':'MixMonitor','channel':_0x56736b[_0x1b51('0x61')],'file':_0x78b3f5,'options':_0x1b51('0x65')})['then'](function(_0x2b0d49){var _0x18707e=_[_0x1b51('0x5a')](_0x56736b[_0x1b51('0x66')],{'filename':_0x1b51('0x67')+_0x78b3f5[_0x1b51('0x68')]()});if(_['isNil'](_0x18707e)){_0x56736b['monitors'][_0x1b51('0x58')]({'filename':_0x1b51('0x67')+_0x78b3f5[_0x1b51('0x68')](),'createdAt':moment()[_0x1b51('0x8')](_0x1b51('0x69')),'mixmonitorid':_0x2b0d49['mixmonitorid'],'status':'rec'});}else{_0x18707e[_0x1b51('0x6a')]=_0x2b0d49['mixmonitorid'];_0x18707e['status']='rec';}_0xe39db8({'code':0xc8,'message':[_0x3db7d3[_0x1b51('0x63')],_0x1b51('0x6b'),_0x2b0d49[_0x1b51('0x6a')]][_0x1b51('0x15')]('\x20'),'mixmonitorid':_0x2b0d49[_0x1b51('0x6a')]});})[_0x1b51('0x6c')](function(_0x36b520){_0x595cbc(_0x16b0ec[_0x1b51('0x1c')](0x1f5,[_0x3db7d3[_0x1b51('0x63')],_0x36b520[_0x1b51('0x1b')][_0x1b51('0x68')]()][_0x1b51('0x15')]('\x20')));});}else{return _0x595cbc(_0x16b0ec['error'](0x1f5,_0x1b51('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x25b050){var _0x7b23ce=this;return new Promise(function(_0x2063c6,_0x875489){if(ami['isConnected']()==![]){return _0x875489(_0x7b23ce[_0x1b51('0x1c')](0x1f4,[config['asterisk']['ip'],config[_0x1b51('0x13')][_0x1b51('0x5f')],_0x1b51('0x14')][_0x1b51('0x15')]('\x20')));}var _0x3ddf0d=schema(properties[_0x1b51('0x6e')])[_0x1b51('0x6f')](_0x25b050);if(_0x3ddf0d['length']>0x0){return _0x875489(_0x7b23ce[_0x1b51('0x1c')](0x1f4,_['map'](_0x3ddf0d,_0x1b51('0x1b'))['join'](',\x20')));}var _0x4b8a15=_[_0x1b51('0x5a')](_0x4d17ab[_0x1b51('0x5e')],{'uniqueid':_0x25b050['uniqueid']});if(_0x4b8a15){return BPromise['resolve']()['then'](function(){if(_0x4b8a15[_0x1b51('0x61')]){return ami[_0x1b51('0x19')]({'action':_0x1b51('0x70'),'channel':_0x4b8a15[_0x1b51('0x61')],'mixmonitorid':_0x25b050[_0x1b51('0x6a')]})[_0x1b51('0x6c')](function(_0x41922f){});}})[_0x1b51('0x1a')](function(){if(_0x4b8a15[_0x1b51('0x71')]){return ami[_0x1b51('0x19')]({'action':_0x1b51('0x70'),'channel':_0x4b8a15['destinationchannel'],'mixmonitorid':_0x25b050['mixmonitorid']})[_0x1b51('0x6c')](function(_0x39d3ba){});}})[_0x1b51('0x1a')](function(_0x1353a9){var _0x5ba89d=_[_0x1b51('0x5a')](_0x4b8a15[_0x1b51('0x66')],{'mixmonitorid':_0x25b050[_0x1b51('0x6a')]});if(_0x5ba89d){_0x5ba89d['status']=_0x1b51('0x72');}})[_0x1b51('0x1a')](function(){var _0x19b760=util[_0x1b51('0x8')](_0x1b51('0x73'),_0x25b050[_0x1b51('0x62')]||_0x25b050[_0x1b51('0x63')],_0x25b050['format']||_0x1b51('0x64'));var _0x3b0af5=_[_0x1b51('0x5a')](_0x4b8a15['monitors'],{'filename':_0x1b51('0x67')+_0x19b760[_0x1b51('0x68')]()});if(_0x3b0af5){_0x3b0af5[_0x1b51('0x74')]=_0x1b51('0x72');}})[_0x1b51('0x1a')](function(){_0x2063c6({'code':0xc8,'message':[_0x25b050[_0x1b51('0x63')],'StopMixMonitor\x20Success'][_0x1b51('0x15')]('\x20')});})[_0x1b51('0x6c')](function(_0x3e72dc){_0x875489(_0x7b23ce['error'](0x1f5,[_0x25b050['uniqueid'],_0x3e72dc[_0x1b51('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x875489(_0x7b23ce[_0x1b51('0x1c')](0x1f5,_0x1b51('0x6d')));}});},'VoiceQueuesChannels':function(_0x34336b){return new Promise(function(_0x2ccea1,_0x126ac1){var _0x35fe05=_['values'](_0x4d17ab[_0x1b51('0x75')]);_0x2ccea1({'count':_0x35fe05[_0x1b51('0x59')],'rows':_0x35fe05});});},'VoiceQueuesChannel':function(_0x30f64d){var _0x4d39b6=this;return new Promise(function(_0x4269f6,_0x2fad15){var _0xe37dc1=schema(properties['voicequeuechannel'])['validate'](_0x30f64d);if(_0xe37dc1[_0x1b51('0x59')]>0x0){return _0x2fad15(_0x4d39b6[_0x1b51('0x1c')](0x1f4,_[_0x1b51('0x60')](_0xe37dc1,_0x1b51('0x1b'))['join'](',\x20')));}var _0x5128a5=_[_0x1b51('0x5a')](_0x4d17ab['queueChannels'],{'uniqueid':_0x30f64d[_0x1b51('0x63')]});if(_0x5128a5){_0x4269f6(_0x5128a5);}else{return _0x2fad15(_0x4d39b6[_0x1b51('0x1c')](0x1f5,_0x1b51('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x549f69){var _0x71b46c=this;return new Promise(function(_0x31f9d9,_0x161af8){if(ami[_0x1b51('0x12')]()==![]){return _0x161af8(_0x71b46c[_0x1b51('0x1c')](0x1f4,[config[_0x1b51('0x13')]['ip'],config['asterisk'][_0x1b51('0x5f')],_0x1b51('0x14')]['join']('\x20')));}var _0x4ae114=schema(properties[_0x1b51('0x76')])[_0x1b51('0x6f')](_0x549f69);if(_0x4ae114[_0x1b51('0x59')]>0x0){return _0x161af8(_0x71b46c[_0x1b51('0x1c')](0x1f4,_['map'](_0x4ae114,_0x1b51('0x1b'))[_0x1b51('0x15')](',\x20')));}var _0x423a92=_[_0x1b51('0x5a')](_0x4d17ab[_0x1b51('0x75')],{'uniqueid':_0x549f69[_0x1b51('0x63')]});if(_0x423a92&&_0x423a92[_0x1b51('0x61')]){return ami['Action']({'action':_0x1b51('0x77'),'channel':_0x423a92[_0x1b51('0x61')]})['then'](function(_0x22c3c9){_0x31f9d9({'code':0xc8,'message':[_0x549f69[_0x1b51('0x63')],_0x22c3c9[_0x1b51('0x1b')][_0x1b51('0x68')]()]['join']('\x20')});})[_0x1b51('0x6c')](function(_0x9227f9){_0x161af8(_0x71b46c[_0x1b51('0x1c')](0x1f5,[_0x549f69[_0x1b51('0x63')],_0x9227f9[_0x1b51('0x1b')][_0x1b51('0x68')]()][_0x1b51('0x15')]('\x20')));});}else{return _0x161af8(_0x71b46c['error'](0x1f5,_0x1b51('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x30b8a0){var _0x3e786c=this;return new Promise(function(_0x37b382,_0x46194a){if(ami['isConnected']()==![]){return _0x46194a(_0x3e786c[_0x1b51('0x1c')](0x1f4,[config[_0x1b51('0x13')]['ip'],config[_0x1b51('0x13')][_0x1b51('0x5f')],_0x1b51('0x14')][_0x1b51('0x15')]('\x20')));}var _0x8c050c=schema(properties['voicequeuechannelredirect'])['validate'](_0x30b8a0);if(_0x8c050c['length']>0x0){return _0x46194a(_0x3e786c[_0x1b51('0x1c')](0x1f4,_[_0x1b51('0x60')](_0x8c050c,_0x1b51('0x1b'))[_0x1b51('0x15')](',\x20')));}var _0x53de66=_[_0x1b51('0x5a')](_0x4d17ab[_0x1b51('0x75')],{'uniqueid':_0x30b8a0[_0x1b51('0x63')]});if(_0x53de66&&_0x53de66[_0x1b51('0x61')]){return ami[_0x1b51('0x19')]({'action':_0x1b51('0x78'),'channel':_0x53de66[_0x1b51('0x61')],'exten':_0x30b8a0[_0x1b51('0x79')],'context':_0x30b8a0['context']||_0x53de66[_0x1b51('0x7a')],'priority':0x1})[_0x1b51('0x1a')](function(_0x4d89f1){_0x37b382({'code':0xc8,'message':[_0x30b8a0[_0x1b51('0x63')],_0x4d89f1[_0x1b51('0x1b')]['toLowerCase']()][_0x1b51('0x15')]('\x20')});})[_0x1b51('0x6c')](function(_0x47ac6e){_0x46194a(_0x3e786c[_0x1b51('0x1c')](0x1f5,[_0x30b8a0['uniqueid'],_0x47ac6e[_0x1b51('0x1b')][_0x1b51('0x68')]()][_0x1b51('0x15')]('\x20')));});}else{return _0x46194a(_0x3e786c[_0x1b51('0x1c')](0x1f5,_0x1b51('0x6d')));}});},'Agents':function(_0x685925){return new Promise(function(_0x6d9b96,_0x40e315){var _0x58aead=_[_0x1b51('0x5d')](_0x4d17ab['agents']);_0x6d9b96({'count':_0x58aead[_0x1b51('0x59')],'rows':_0x58aead});});},'Telephones':function(_0x11ea3b){return new Promise(function(_0x1de9bd,_0x446563){var _0x1eaeeb=_[_0x1b51('0x5d')](_0x4d17ab[_0x1b51('0x7b')]);_0x1de9bd({'count':_0x1eaeeb[_0x1b51('0x59')],'rows':_0x1eaeeb});});},'Trunks':function(_0x409e71){return new Promise(function(_0x11af6f,_0x376b71){var _0x1fafbc=_['values'](_0x4d17ab[_0x1b51('0x7c')]);_0x11af6f({'count':_0x1fafbc['length'],'rows':_0x1fafbc});});},'OutboundChannels':function(_0x1e7c54){return new Promise(function(_0x51641d,_0x37a6c5){var _0x2a0645=_[_0x1b51('0x5d')](_0x4d17ab[_0x1b51('0x7d')]);_0x51641d({'count':_0x2a0645[_0x1b51('0x59')],'rows':_0x2a0645});});},'Outbound':function(_0x3d233d){return new Promise(function(_0x46119b,_0x32c072){_0x46119b(_0x4d17ab[_0x1b51('0x7e')]);});},'Campaigns':function(_0x3e9017){return new Promise(function(_0x22df69,_0x5ee437){var _0x464930=_['values'](_0x4d17ab['campaigns']);_0x22df69({'count':_0x464930[_0x1b51('0x59')],'rows':_0x464930});});},'VoiceQueuesPreview':function(_0x243934){var _0x281efc=this;return new Promise(function(_0x542e10,_0x16a99b){_0x14e88a['run'](_0x243934['id'])['then'](function(_0x33a575){_0x542e10({'code':0xc8,'message':_0x33a575[_0x1b51('0x1b')]});})[_0x1b51('0x6c')](function(_0x43d5d2){_0x16a99b(_0x281efc[_0x1b51('0x1c')](0x1f4,_0x43d5d2[_0x1b51('0x1b')]));});});},'EventManager':function(_0x20c1ea){var _0x31982c=this;return new Promise(function(_0x1f76d3,_0x2af6ac){if(!_0x20c1ea['event']){return _0x2af6ac(_0x31982c[_0x1b51('0x1c')](0x1f4,_0x1b51('0x7f')));}ami[_0x1b51('0x80')](_0x1b51('0x81')+_0x20c1ea['event'],_0x20c1ea['message']);_0x1f76d3({'code':0xc8,'message':_0x20c1ea});});},'FaxAccounts':function(_0x435b75){return new Promise(function(_0x551e1f,_0x56cd21){var _0x3e2b58=_[_0x1b51('0x5d')](_0x4d17ab[_0x1b51('0x82')]);_0x551e1f({'count':_0x3e2b58[_0x1b51('0x59')],'rows':_0x3e2b58});});},'SendFax':function(_0x1c4239){var _0x176299=this;return new Promise(function(_0x2f563a,_0x1d3dbb){_0x463bec[_0x1b51('0x83')](_0x1c4239)[_0x1b51('0x1a')](function(_0x5dc3e5){_0x2f563a({'code':0xc8,'message':_0x5dc3e5[_0x1b51('0x1b')]});})[_0x1b51('0x6c')](function(_0x482bc5){_0x1d3dbb(_0x176299['error'](0x1f4,_0x482bc5[_0x1b51('0x1b')]));});});},'CheckAfterSend':function(_0x3ea898){var _0x42734e=this;return new Promise(function(_0x2920c1,_0x1cf773){_0x463bec[_0x1b51('0x84')](_0x3ea898)['then'](function(_0x47fda3){_0x2920c1({'code':0xc8,'message':_0x47fda3['message']});})[_0x1b51('0x6c')](function(_0x4e3f14){_0x1cf773(_0x42734e[_0x1b51('0x1c')](0x1f4,_0x4e3f14[_0x1b51('0x1b')]));});});}};var _0x2ae6cc=jayson[_0x1b51('0x85')](_0x43c14c)[_0x1b51('0x86')]();_0x2ae6cc['on'](_0x1b51('0x1c'),function(_0x576cb6){return _0x475add(_0x576cb6);});_0x2ae6cc[_0x1b51('0x7')](0x232a,_0x1b51('0x87'),function(){console['log'](_0x1b51('0x88'),0x232a);return _0x506653(_0x1b51('0x89')+0x232a);});});}; \ No newline at end of file +var _0x68b3=['predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','omit','undefined','channels','map','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','StopMixMonitor','destinationchannel','stop','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','values','Event\x20name\x20mandatory','emit','event','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','error','asterisk','username','ami\x20disconnected','join','keys','module','action','Action','then','message','isConnected','command','Command','content','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','total','type','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68b3,0x1d8));var _0x368b=function(_0x5f27e4,_0x99f5ff){_0x5f27e4=_0x5f27e4-0x0;var _0x588fe5=_0x68b3[_0x5f27e4];return _0x588fe5;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var jayson=require(_0x368b('0x2'));var schema=require(_0x368b('0x3'));var BPromise=require(_0x368b('0x4'));var moment=require('moment');var config=require(_0x368b('0x5'));var properties=require(_0x368b('0x6'));var ami=require(_0x368b('0x7'));exports[_0x368b('0x8')]=function(_0x5d68cb,_0x12eb8f,_0x41b15b){return new BPromise(function(_0x104dad,_0x23584a){var _0x4406c8={'QueuePause':function(_0x127c1e){return new Promise(function(_0x2dec1c,_0x142d05){var _0x23622f=util[_0x368b('0x9')](_0x368b('0xa'),'SIP',_0x127c1e[_0x368b('0xb')]);if(_0x5d68cb[_0x368b('0xc')]&&_0x5d68cb[_0x368b('0xc')][_0x23622f]&&_0x5d68cb['timers'][_0x23622f][_0x368b('0xd')]){_0x5d68cb[_0x368b('0xc')][_0x23622f][_0x368b('0xe')]();}if(_0x5d68cb['agents'][_0x23622f]){_0x5d68cb[_0x368b('0xf')][_0x23622f][_0x368b('0x10')]({'statePause':_0x127c1e['pause']?!![]:![]});}_0x2dec1c({'code':0xc8,'message':_0x368b('0x11')});});},'Reload':function(_0x250697){var _0x44e376=this;return new Promise(function(_0x4015fe,_0xdd5d13){if(ami['isConnected']()==![]){return _0xdd5d13(_0x44e376[_0x368b('0x12')](0x1f4,[config[_0x368b('0x13')]['ip'],config['asterisk'][_0x368b('0x14')],_0x368b('0x15')][_0x368b('0x16')]('\x20')));}_0x250697=_['pick'](_0x250697,_[_0x368b('0x17')](properties[_0x368b('0x18')]));_0x250697[_0x368b('0x19')]='Reload';return ami[_0x368b('0x1a')](_0x250697)[_0x368b('0x1b')](function(_0x1c2956){_0x4015fe({'code':0xc8,'message':_0x1c2956['message']});})['catch'](function(_0x3e2e9f){_0xdd5d13(_0x44e376[_0x368b('0x12')](0x1f5,_0x3e2e9f[_0x368b('0x1c')]));});});},'Command':function(_0x1e632a){var _0x1a4f20=this;return new Promise(function(_0x4b8fb7,_0x26447c){if(ami[_0x368b('0x1d')]()==![]){return _0x26447c(_0x1a4f20[_0x368b('0x12')](0x1f4,[config[_0x368b('0x13')]['ip'],config[_0x368b('0x13')][_0x368b('0x14')],_0x368b('0x15')][_0x368b('0x16')]('\x20')));}_0x1e632a=_['pick'](_0x1e632a,_0x368b('0x1e'));_0x1e632a[_0x368b('0x19')]=_0x368b('0x1f');return ami[_0x368b('0x1a')](_0x1e632a)[_0x368b('0x1b')](function(_0x4c2fca){_0x4b8fb7({'code':0xc8,'message':_0x4c2fca[_0x368b('0x20')]});})[_0x368b('0x21')](function(_0x3a22bd){_0x26447c(_0x1a4f20[_0x368b('0x12')](0x1f5,_0x3a22bd[_0x368b('0x1c')]));});});},'VoiceQueues':function(_0x85515f){return new Promise(function(_0x430e16,_0x11ea2d){var _0x3123c1=[];for(var _0x3f7f89 in _0x5d68cb[_0x368b('0x22')]){if(_0x5d68cb[_0x368b('0x22')][_0x368b('0x23')](_0x3f7f89)){var _0x376e61=_0x5d68cb[_0x368b('0x22')][_0x3f7f89];var _0x23a83a={'id':_0x376e61['id'],'name':_0x376e61[_0x368b('0xb')],'strategy':_0x376e61[_0x368b('0x24')],'answered':_0x376e61[_0x368b('0x25')],'available':_0x376e61[_0x368b('0x26')],'loggedIn':_0x376e61[_0x368b('0x27')],'pTalking':_0x376e61[_0x368b('0x28')],'sumBillable':_0x376e61[_0x368b('0x29')],'sumDuration':_0x376e61[_0x368b('0x2a')],'sumHoldTime':_0x376e61['sumHoldTime']||0x0,'talking':_0x376e61['talking'],'total':_0x376e61[_0x368b('0x2b')],'type':_0x376e61[_0x368b('0x2c')],'unmanaged':_0x376e61[_0x368b('0x2d')],'abandoned':_0x376e61[_0x368b('0x2e')],'waiting':_0x376e61['waiting'],'loggedInDb':_0x376e61[_0x368b('0x2f')]};if(_0x376e61[_0x368b('0x2c')]===_0x368b('0x30')){_0x23a83a[_0x368b('0x31')]=_0x376e61[_0x368b('0x31')];_0x23a83a['dialMethod']=_0x376e61[_0x368b('0x32')];_0x23a83a[_0x368b('0x33')]=_0x376e61[_0x368b('0x33')];_0x23a83a[_0x368b('0x34')]=_0x376e61['dialOriginateCallerIdNumber'];_0x23a83a['dialOriginateTimeout']=_0x376e61['dialOriginateTimeout'];_0x23a83a[_0x368b('0x35')]=_0x376e61[_0x368b('0x35')];_0x23a83a[_0x368b('0x36')]=_0x376e61[_0x368b('0x36')];_0x23a83a[_0x368b('0x37')]=_0x376e61['outboundAnswerAgiCallsDay'];_0x23a83a[_0x368b('0x38')]=_0x376e61[_0x368b('0x38')];_0x23a83a['outboundBlacklistCallsDay']=_0x376e61[_0x368b('0x39')];_0x23a83a[_0x368b('0x3a')]=_0x376e61['outboundBusyCallsDay'];_0x23a83a[_0x368b('0x3b')]=_0x376e61[_0x368b('0x3b')];_0x23a83a['outboundDropCallsDayACS']=_0x376e61[_0x368b('0x3c')];_0x23a83a['outboundDropCallsDayCallersExit']=_0x376e61['outboundDropCallsDayCallersExit'];_0x23a83a['outboundDropCallsDayTimeout']=_0x376e61[_0x368b('0x3d')];_0x23a83a[_0x368b('0x3e')]=_0x376e61[_0x368b('0x3e')];_0x23a83a[_0x368b('0x3f')]=_0x376e61[_0x368b('0x3f')];_0x23a83a[_0x368b('0x40')]=_0x376e61[_0x368b('0x40')];_0x23a83a[_0x368b('0x41')]=_0x376e61[_0x368b('0x41')];_0x23a83a[_0x368b('0x42')]=_0x376e61['outboundRejectCallsDay'];_0x23a83a[_0x368b('0x43')]=_0x376e61[_0x368b('0x43')];_0x23a83a['predictiveIntervalAnsweredCalls']=_0x376e61[_0x368b('0x44')];_0x23a83a[_0x368b('0x45')]=_0x376e61[_0x368b('0x45')];_0x23a83a[_0x368b('0x46')]=_0x376e61[_0x368b('0x46')];_0x23a83a['predictiveIntervalDroppedCallsCallersExit']=_0x376e61[_0x368b('0x47')];_0x23a83a[_0x368b('0x48')]=_0x376e61[_0x368b('0x48')];_0x23a83a[_0x368b('0x49')]=_0x376e61['predictiveIntervalErlangCalls'];_0x23a83a['predictiveIntervalErlangCallsDroppedCalls']=_0x376e61[_0x368b('0x4a')];_0x23a83a[_0x368b('0x4b')]=_0x376e61[_0x368b('0x4b')];_0x23a83a[_0x368b('0x4c')]=_0x376e61[_0x368b('0x4c')];_0x23a83a[_0x368b('0x4d')]=_0x376e61[_0x368b('0x4d')];_0x23a83a[_0x368b('0x4e')]=_0x376e61[_0x368b('0x4e')];_0x23a83a[_0x368b('0x4f')]=_0x376e61['predictiveIntervalTotalCalls'];_0x23a83a[_0x368b('0x1c')]=_0x376e61[_0x368b('0x1c')];_0x23a83a['originated']=_0x376e61[_0x368b('0x50')];_0x23a83a[_0x368b('0x51')]=_0x376e61[_0x368b('0x51')];_0x23a83a[_0x368b('0x52')]=_0x376e61['erlangCallToSecond'];_0x23a83a[_0x368b('0x53')]=_0x376e61[_0x368b('0x53')];_0x23a83a['erlangBusyFactor']=_0x376e61[_0x368b('0x54')];_0x23a83a[_0x368b('0x55')]=_0x376e61[_0x368b('0x55')];_0x23a83a['startProgressive']=_0x376e61[_0x368b('0x56')];}if(_0x376e61[_0x368b('0x57')]){_0x23a83a[_0x368b('0x57')]={'id':_0x376e61['Trunk']['id'],'name':_0x376e61['Trunk'][_0x368b('0xb')],'active':_0x376e61[_0x368b('0x57')]['active'],'callerid':_0x376e61[_0x368b('0x57')][_0x368b('0x58')]};}if(_0x376e61[_0x368b('0x59')]){_0x23a83a[_0x368b('0x59')]={'id':_0x376e61[_0x368b('0x59')]['id'],'name':_0x376e61[_0x368b('0x59')][_0x368b('0xb')]};}_0x3123c1[_0x368b('0x5a')](_0x23a83a);}}_0x430e16({'count':_0x3123c1[_0x368b('0x5b')],'rows':_0x3123c1});});},'UpdateVoiceQueue':function(_0x33914c){return new Promise(function(_0x321a64,_0x432df9){var _0xcaf3d0=_['find'](_0x5d68cb[_0x368b('0x22')],{'id':parseInt(_0x33914c['id'])});var _0x1fff8e=_[_0x368b('0x5c')](_0x33914c,['id']);if(_0xcaf3d0){for(var _0xf95817 in _0x1fff8e){if(typeof _0x1fff8e[_0xf95817]!==_0x368b('0x5d')&&typeof _0xcaf3d0[_0xf95817]!=='undefined'){_0xcaf3d0[_0xf95817]=_0x1fff8e[_0xf95817];}}_0x321a64(_0xcaf3d0);}else{_0x432df9();}});},'VoiceChannels':function(_0x5ed4c6){return new Promise(function(_0x131e50,_0x46b467){var _0x1c8755=_['values'](_0x5d68cb[_0x368b('0x5e')]);_0x131e50({'count':_0x1c8755[_0x368b('0x5b')],'rows':_0x1c8755});});},'VoiceChannelMixMonitor':function(_0xa87288){var _0xf22764=this;return new Promise(function(_0x3cae32,_0x1fdc4b){if(ami[_0x368b('0x1d')]()==![]){return _0x1fdc4b(_0xf22764[_0x368b('0x12')](0x1f4,[config[_0x368b('0x13')]['ip'],config[_0x368b('0x13')]['username'],_0x368b('0x15')]['join']('\x20')));}var _0x1a4370=schema(properties['voicechannel'])[_0x368b('0x3')](_0xa87288);if(_0x1a4370['length']>0x0){return _0x1fdc4b(_0xf22764[_0x368b('0x12')](0x1f4,_[_0x368b('0x5f')](_0x1a4370,_0x368b('0x1c'))[_0x368b('0x16')](',\x20')));}var _0x49b78c=_[_0x368b('0x60')](_0x5d68cb[_0x368b('0x5e')],{'uniqueid':_0xa87288[_0x368b('0x61')]});if(_0x49b78c&&_0x49b78c[_0x368b('0x62')]){var _0x424aa1=util[_0x368b('0x9')](_0x368b('0x63'),_0xa87288[_0x368b('0x64')]||_0xa87288[_0x368b('0x61')],_0xa87288['format']||_0x368b('0x65'));return ami[_0x368b('0x1a')]({'action':_0x368b('0x66'),'channel':_0x49b78c[_0x368b('0x62')],'file':_0x424aa1,'options':_0x368b('0x67')})['then'](function(_0x16492f){var _0x1ddb6e=_[_0x368b('0x60')](_0x49b78c[_0x368b('0x68')],{'filename':_0x368b('0x69')+_0x424aa1[_0x368b('0x6a')]()});if(_[_0x368b('0x6b')](_0x1ddb6e)){_0x49b78c['monitors']['push']({'filename':'/var/spool/asterisk/monitor/'+_0x424aa1['toLowerCase'](),'createdAt':moment()[_0x368b('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x16492f[_0x368b('0x6c')],'status':_0x368b('0x6d')});}else{_0x1ddb6e['mixmonitorid']=_0x16492f['mixmonitorid'];_0x1ddb6e[_0x368b('0x6e')]='rec';}_0x3cae32({'code':0xc8,'message':[_0xa87288[_0x368b('0x61')],_0x368b('0x6f'),_0x16492f['mixmonitorid']][_0x368b('0x16')]('\x20'),'mixmonitorid':_0x16492f[_0x368b('0x6c')]});})['catch'](function(_0x212b68){_0x1fdc4b(_0xf22764['error'](0x1f5,[_0xa87288[_0x368b('0x61')],_0x212b68[_0x368b('0x1c')][_0x368b('0x6a')]()][_0x368b('0x16')]('\x20')));});}else{return _0x1fdc4b(_0xf22764['error'](0x1f5,_0x368b('0x70')));}});},'VoiceChannelStopMixMonitor':function(_0x233a32){var _0x670789=this;return new Promise(function(_0x14974e,_0x49a634){if(ami[_0x368b('0x1d')]()==![]){return _0x49a634(_0x670789['error'](0x1f4,[config[_0x368b('0x13')]['ip'],config[_0x368b('0x13')]['username'],'ami\x20disconnected'][_0x368b('0x16')]('\x20')));}var _0xeea586=schema(properties[_0x368b('0x71')])[_0x368b('0x3')](_0x233a32);if(_0xeea586[_0x368b('0x5b')]>0x0){return _0x49a634(_0x670789['error'](0x1f4,_[_0x368b('0x5f')](_0xeea586,_0x368b('0x1c'))['join'](',\x20')));}var _0x2e5827=_[_0x368b('0x60')](_0x5d68cb[_0x368b('0x5e')],{'uniqueid':_0x233a32[_0x368b('0x61')]});if(_0x2e5827){return BPromise['resolve']()[_0x368b('0x1b')](function(){if(_0x2e5827[_0x368b('0x62')]){return ami[_0x368b('0x1a')]({'action':_0x368b('0x72'),'channel':_0x2e5827['channel'],'mixmonitorid':_0x233a32['mixmonitorid']})['catch'](function(_0x4b949f){});}})[_0x368b('0x1b')](function(){if(_0x2e5827[_0x368b('0x73')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x2e5827['destinationchannel'],'mixmonitorid':_0x233a32['mixmonitorid']})['catch'](function(_0x33c3a6){});}})[_0x368b('0x1b')](function(_0xca4639){var _0x5d5b4d=_[_0x368b('0x60')](_0x2e5827['monitors'],{'mixmonitorid':_0x233a32['mixmonitorid']});if(_0x5d5b4d){_0x5d5b4d[_0x368b('0x6e')]=_0x368b('0x74');}})[_0x368b('0x1b')](function(){var _0x17c862=util['format'](_0x368b('0x63'),_0x233a32[_0x368b('0x64')]||_0x233a32[_0x368b('0x61')],_0x233a32['format']||_0x368b('0x65'));var _0x159a89=_['find'](_0x2e5827[_0x368b('0x68')],{'filename':_0x368b('0x69')+_0x17c862['toLowerCase']()});if(_0x159a89){_0x159a89[_0x368b('0x6e')]='stop';}})[_0x368b('0x1b')](function(){_0x14974e({'code':0xc8,'message':[_0x233a32[_0x368b('0x61')],'StopMixMonitor\x20Success'][_0x368b('0x16')]('\x20')});})[_0x368b('0x21')](function(_0x3785af){_0x49a634(_0x670789[_0x368b('0x12')](0x1f5,[_0x233a32[_0x368b('0x61')],_0x3785af['message'][_0x368b('0x6a')]()][_0x368b('0x16')]('\x20')));});}else{return _0x49a634(_0x670789[_0x368b('0x12')](0x1f5,_0x368b('0x70')));}});},'VoiceQueuesChannels':function(_0x321168){return new Promise(function(_0x1c9cce,_0x3432f2){var _0x2ab1eb=_['values'](_0x5d68cb[_0x368b('0x75')]);_0x1c9cce({'count':_0x2ab1eb[_0x368b('0x5b')],'rows':_0x2ab1eb});});},'VoiceQueuesChannel':function(_0x4c04bf){var _0x273d33=this;return new Promise(function(_0x18b97b,_0x2f94d3){var _0x543ca3=schema(properties['voicequeuechannel'])[_0x368b('0x3')](_0x4c04bf);if(_0x543ca3[_0x368b('0x5b')]>0x0){return _0x2f94d3(_0x273d33[_0x368b('0x12')](0x1f4,_[_0x368b('0x5f')](_0x543ca3,'message')[_0x368b('0x16')](',\x20')));}var _0x5d7ed8=_[_0x368b('0x60')](_0x5d68cb[_0x368b('0x75')],{'uniqueid':_0x4c04bf[_0x368b('0x61')]});if(_0x5d7ed8){_0x18b97b(_0x5d7ed8);}else{return _0x2f94d3(_0x273d33['error'](0x1f5,_0x368b('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x2e9cbe){var _0x2c02ca=this;return new Promise(function(_0x4d6255,_0x51dffd){if(ami['isConnected']()==![]){return _0x51dffd(_0x2c02ca[_0x368b('0x12')](0x1f4,[config[_0x368b('0x13')]['ip'],config[_0x368b('0x13')][_0x368b('0x14')],_0x368b('0x15')]['join']('\x20')));}var _0x8710f7=schema(properties[_0x368b('0x76')])['validate'](_0x2e9cbe);if(_0x8710f7[_0x368b('0x5b')]>0x0){return _0x51dffd(_0x2c02ca['error'](0x1f4,_['map'](_0x8710f7,_0x368b('0x1c'))[_0x368b('0x16')](',\x20')));}var _0x46e660=_[_0x368b('0x60')](_0x5d68cb[_0x368b('0x75')],{'uniqueid':_0x2e9cbe[_0x368b('0x61')]});if(_0x46e660&&_0x46e660[_0x368b('0x62')]){return ami[_0x368b('0x1a')]({'action':_0x368b('0x77'),'channel':_0x46e660[_0x368b('0x62')]})['then'](function(_0x5ed540){_0x4d6255({'code':0xc8,'message':[_0x2e9cbe['uniqueid'],_0x5ed540['message'][_0x368b('0x6a')]()]['join']('\x20')});})['catch'](function(_0x23a1d6){_0x51dffd(_0x2c02ca[_0x368b('0x12')](0x1f5,[_0x2e9cbe[_0x368b('0x61')],_0x23a1d6[_0x368b('0x1c')][_0x368b('0x6a')]()][_0x368b('0x16')]('\x20')));});}else{return _0x51dffd(_0x2c02ca[_0x368b('0x12')](0x1f5,_0x368b('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x57b1c4){var _0x19e179=this;return new Promise(function(_0x99599c,_0x55f183){if(ami[_0x368b('0x1d')]()==![]){return _0x55f183(_0x19e179[_0x368b('0x12')](0x1f4,[config[_0x368b('0x13')]['ip'],config[_0x368b('0x13')][_0x368b('0x14')],_0x368b('0x15')][_0x368b('0x16')]('\x20')));}var _0x41e848=schema(properties[_0x368b('0x78')])[_0x368b('0x3')](_0x57b1c4);if(_0x41e848[_0x368b('0x5b')]>0x0){return _0x55f183(_0x19e179[_0x368b('0x12')](0x1f4,_[_0x368b('0x5f')](_0x41e848,_0x368b('0x1c'))['join'](',\x20')));}var _0x49ad9d=_[_0x368b('0x60')](_0x5d68cb[_0x368b('0x75')],{'uniqueid':_0x57b1c4[_0x368b('0x61')]});if(_0x49ad9d&&_0x49ad9d['channel']){return ami[_0x368b('0x1a')]({'action':_0x368b('0x79'),'channel':_0x49ad9d[_0x368b('0x62')],'exten':_0x57b1c4['exten'],'context':_0x57b1c4[_0x368b('0x7a')]||_0x49ad9d[_0x368b('0x7a')],'priority':0x1})['then'](function(_0x235c63){_0x99599c({'code':0xc8,'message':[_0x57b1c4[_0x368b('0x61')],_0x235c63[_0x368b('0x1c')]['toLowerCase']()]['join']('\x20')});})[_0x368b('0x21')](function(_0x52a495){_0x55f183(_0x19e179[_0x368b('0x12')](0x1f5,[_0x57b1c4[_0x368b('0x61')],_0x52a495[_0x368b('0x1c')][_0x368b('0x6a')]()]['join']('\x20')));});}else{return _0x55f183(_0x19e179[_0x368b('0x12')](0x1f5,_0x368b('0x70')));}});},'Agents':function(_0x1bb54f){return new Promise(function(_0x54c95a,_0x134054){var _0x46d5d3=_[_0x368b('0x7b')](_0x5d68cb[_0x368b('0xf')]);_0x54c95a({'count':_0x46d5d3['length'],'rows':_0x46d5d3});});},'Telephones':function(_0x407ab1){return new Promise(function(_0x4844fe,_0x1740a6){var _0x1374e0=_[_0x368b('0x7b')](_0x5d68cb['telephones']);_0x4844fe({'count':_0x1374e0['length'],'rows':_0x1374e0});});},'Trunks':function(_0x4bb209){return new Promise(function(_0x57435b,_0x221d92){var _0x3146a9=_['values'](_0x5d68cb['trunks']);_0x57435b({'count':_0x3146a9[_0x368b('0x5b')],'rows':_0x3146a9});});},'OutboundChannels':function(_0x4a5d99){return new Promise(function(_0x197d3a,_0x1697e4){var _0x570efe=_[_0x368b('0x7b')](_0x5d68cb['outboundChannels']);_0x197d3a({'count':_0x570efe[_0x368b('0x5b')],'rows':_0x570efe});});},'Outbound':function(_0x5294bf){return new Promise(function(_0x1dd4a7,_0x12cad7){_0x1dd4a7(_0x5d68cb['outbound']);});},'Campaigns':function(_0x64d199){return new Promise(function(_0x50e5d3,_0x147d22){var _0x2798e1=_['values'](_0x5d68cb['campaigns']);_0x50e5d3({'count':_0x2798e1[_0x368b('0x5b')],'rows':_0x2798e1});});},'VoiceQueuesPreview':function(_0x4ee51f){var _0x5aede6=this;return new Promise(function(_0x38bd68,_0x54c442){_0x12eb8f['run'](_0x4ee51f['id'])['then'](function(_0x4f5958){_0x38bd68({'code':0xc8,'message':_0x4f5958[_0x368b('0x1c')]});})['catch'](function(_0x303c52){_0x54c442(_0x5aede6[_0x368b('0x12')](0x1f4,_0x303c52['message']));});});},'EventManager':function(_0x302d6d){var _0x3f5e7b=this;return new Promise(function(_0x50de42,_0xe4bbd0){if(!_0x302d6d['event']){return _0xe4bbd0(_0x3f5e7b['error'](0x1f4,_0x368b('0x7c')));}ami[_0x368b('0x7d')]('custom:'+_0x302d6d[_0x368b('0x7e')],_0x302d6d['message']);_0x50de42({'code':0xc8,'message':_0x302d6d});});},'FaxAccounts':function(_0x4af1d3){return new Promise(function(_0x379dc9,_0x4d7151){var _0xb4049=_['values'](_0x5d68cb['faxAccounts']);_0x379dc9({'count':_0xb4049[_0x368b('0x5b')],'rows':_0xb4049});});},'SendFax':function(_0x5b02ca){var _0x30235b=this;return new Promise(function(_0x2b2c54,_0x3082df){_0x41b15b[_0x368b('0x7f')](_0x5b02ca)[_0x368b('0x1b')](function(_0x150a34){_0x2b2c54({'code':0xc8,'message':_0x150a34['message']});})[_0x368b('0x21')](function(_0x11ed4b){_0x3082df(_0x30235b[_0x368b('0x12')](0x1f4,_0x11ed4b[_0x368b('0x1c')]));});});},'CheckAfterSend':function(_0x134e28){var _0x498a81=this;return new Promise(function(_0x313462,_0x39db39){_0x41b15b[_0x368b('0x80')](_0x134e28)[_0x368b('0x1b')](function(_0x531cb4){_0x313462({'code':0xc8,'message':_0x531cb4[_0x368b('0x1c')]});})[_0x368b('0x21')](function(_0x19e5c4){_0x39db39(_0x498a81[_0x368b('0x12')](0x1f4,_0x19e5c4[_0x368b('0x1c')]));});});}};var _0x2eeb1c=jayson[_0x368b('0x81')](_0x4406c8)[_0x368b('0x82')]();_0x2eeb1c['on']('error',function(_0x4136e6){return _0x23584a(_0x4136e6);});_0x2eeb1c[_0x368b('0x8')](0x232a,_0x368b('0x83'),function(){console[_0x368b('0x84')](_0x368b('0x85'),0x232a);return _0x104dad(_0x368b('0x86')+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 17693a6..7dc87fc 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 _0x17ba=['name','trigger:%s','toLowerCase','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','map','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','updatedAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','uniqueid','routeId','calleridname','','Unknown','destcalleridname','resolve','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s'];(function(_0x594698,_0x190a21){var _0x267253=function(_0x272ba6){while(--_0x272ba6){_0x594698['push'](_0x594698['shift']());}};_0x267253(++_0x190a21);}(_0x17ba,0xab));var _0xa17b=function(_0x1216c8,_0x53dfbe){_0x1216c8=_0x1216c8-0x0;var _0x5ecf22=_0x17ba[_0x1216c8];return _0x5ecf22;};'use strict';var _=require(_0xa17b('0x0'));var BPromise=require(_0xa17b('0x1'));var Redis=require('ioredis');var util=require(_0xa17b('0x2'));var config=require(_0xa17b('0x3'));var logger=require(_0xa17b('0x4'))(_0xa17b('0x5'));var cmContactRpc=require(_0xa17b('0x6'));config[_0xa17b('0x7')]=_[_0xa17b('0x8')](config[_0xa17b('0x7')],{'host':_0xa17b('0x9'),'port':0x18eb});var io=require(_0xa17b('0xa'))(new Redis(config[_0xa17b('0x7')]));function emit(_0x2e3d43,_0x1957be,_0x57f9cd,_0x2ca4d3,_0x17d1d2){logger[_0xa17b('0xb')](_0xa17b('0xc'),_0x2e3d43,_0x1957be['id'],_0x57f9cd,_0x2ca4d3,JSON[_0xa17b('0xd')](_0x17d1d2));io['to'](_0x57f9cd)['emit'](_0x2ca4d3,_0x17d1d2);}exports[_0xa17b('0xe')]=function(_0x38b8f1,_0x322dc0,_0x1e799a,_0x140943){var _0x4382df,_0xc5ef2e;var _0x5593c4={};var _0xd2ccce=Number(_0x1e799a[_0xa17b('0xf')]);var _0x3c3a8a=_0x1e799a['data2']?Boolean(Number(_0x1e799a[_0xa17b('0x10')])):![];var _0x3d7d46;var _0x30236c=![];if(!_[_0xa17b('0x11')](_0x1e799a['data5'])){if(_0x1e799a[_0xa17b('0x12')]=='1')_0x30236c=!![];}if(!_0x30236c){if(_0x140943['xmd-contactid']){_0x5593c4['id']=_0x140943[_0xa17b('0x13')];}}if(!_0x5593c4['id']){_0x5593c4[_0xa17b('0x14')]=_0xd2ccce;_0x3d7d46=_0x1e799a['data3']&&_0x1e799a[_0xa17b('0x15')]!=='0'?_0x1e799a[_0xa17b('0x15')][_0xa17b('0x16')](','):[_0xa17b('0x17')];_0x5593c4['$or']=_[_0xa17b('0x18')](_0x3d7d46,function(_0x5e21c2){var _0x4d5592={};_0x4d5592[_0x5e21c2]=_0x140943['routeId']?_0x140943[_0xa17b('0x19')]:_0x140943[_0xa17b('0x1a')];return _0x4d5592;});}var _0x53a0f7=['id',_0xa17b('0x1b'),_0xa17b('0x1c'),_0xa17b('0x17'),_0xa17b('0x1d'),_0xa17b('0x1e'),_0xa17b('0x14'),_0xa17b('0x1f'),'scheduledAt',_0xa17b('0x20')];var _0x3f409a=_[_0xa17b('0x21')](_0x53a0f7,_0x3d7d46);BPromise['resolve']()[_0xa17b('0x22')](cmContactRpc[_0xa17b('0x23')]({'attributes':_0x3f409a,'where':_0x5593c4}))[_0xa17b('0x22')](function(_0xbbbb62){_0xc5ef2e=_0xbbbb62;if(!_[_0xa17b('0x24')](_0xc5ef2e)){if(_0xc5ef2e[_0xa17b('0x25')]===0x1){_0x4382df=_0xc5ef2e[0x0];logger['info'](_0xa17b('0x26'),_0x140943['uniqueid'],_0x322dc0['id'],_0x4382df['id']);}else{logger[_0xa17b('0xb')](_0xa17b('0x27'),_0x140943['uniqueid'],_0x322dc0['id'],_['map'](_0xc5ef2e,'id')[_0xa17b('0x28')](','));}return;}else{logger[_0xa17b('0xb')](_0xa17b('0x29'),_0x140943[_0xa17b('0x2a')],_0x322dc0['id']);var _0x3c32a5={'ListId':_0xd2ccce};var _0x3a64f5=_0x1e799a['data4']&&_0x1e799a['data4']!=='0'?_0x1e799a['data4']:'phone';if(_0x3c3a8a){logger[_0xa17b('0xb')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x140943[_0xa17b('0x2a')],_0x322dc0['id']);_0x3c32a5[_0x3a64f5]=_['isNil'](_0x140943[_0xa17b('0x2b')])?_0x140943[_0xa17b('0x1a')]:_0x140943[_0xa17b('0x19')];if(_[_0xa17b('0x11')](_0x140943[_0xa17b('0x2b')])){_0x3c32a5[_0xa17b('0x1b')]=_0x140943[_0xa17b('0x2c')]&&_0x140943[_0xa17b('0x2c')]!==_0xa17b('0x2d')?_0x140943[_0xa17b('0x2c')]:_0xa17b('0x2e');}else{_0x3c32a5['firstName']=_0x140943['destcalleridname']&&_0x140943['destcalleridname']!==_0xa17b('0x2d')?_0x140943[_0xa17b('0x2f')]:_0xa17b('0x2e');}return BPromise[_0xa17b('0x30')]()[_0xa17b('0x22')](cmContactRpc[_0xa17b('0x31')](_0x3c32a5))[_0xa17b('0x22')](function(_0x1bdd09){_0x4382df=_0x1bdd09;_0xc5ef2e['push'](_0x1bdd09);if(_0x4382df){logger[_0xa17b('0xb')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x140943[_0xa17b('0x2a')],_0x322dc0['id'],_0x4382df['id']);}return;});}else{logger[_0xa17b('0xb')](_0xa17b('0x32'),_0x140943[_0xa17b('0x2a')],_0x322dc0['id']);_0x3c32a5[_0x3a64f5]=_[_0xa17b('0x11')](_0x140943[_0xa17b('0x2b')])?_0x140943['calleridnum']:_0x140943[_0xa17b('0x19')];if(_[_0xa17b('0x11')](_0x140943[_0xa17b('0x2b')])){_0x3c32a5[_0xa17b('0x1b')]=_0x140943[_0xa17b('0x2c')]&&_0x140943['calleridname']!==_0xa17b('0x2d')?_0x140943['calleridname']:_0xa17b('0x2e');}else{_0x3c32a5['firstName']=_0x140943[_0xa17b('0x2f')]&&_0x140943[_0xa17b('0x2f')]!==''?_0x140943[_0xa17b('0x2f')]:_0xa17b('0x2e');}_0x4382df=_0x3c32a5;_0xc5ef2e['push'](_0x3c32a5);return;}}})[_0xa17b('0x22')](function(){if(_0x38b8f1){emit(_0x140943[_0xa17b('0x2a')],_0x322dc0,util[_0xa17b('0x33')](_0xa17b('0x34'),_0x38b8f1[_0xa17b('0x35')]),util['format'](_0xa17b('0x36'),_0x1e799a['action'][_0xa17b('0x37')]()),{'evt':_['merge'](_0x140943,{'autoCreate':_0x3c3a8a}),'contact':_0x4382df===undefined?{}:_0x4382df,'contacts':_0xc5ef2e[_0xa17b('0x25')]===0x0?undefined:_0xc5ef2e});}});}; \ No newline at end of file +var _0x5636=['data3','split','phone','$or','calleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then','getContacts','length','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','destcalleridnum','isNil','routeId','firstName','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','toLowerCase','merge','lodash','bluebird','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','data1','data2','data5','xmd-contactid','ListId'];(function(_0x10966b,_0x31e5f8){var _0x4c21e1=function(_0x4238dc){while(--_0x4238dc){_0x10966b['push'](_0x10966b['shift']());}};_0x4c21e1(++_0x31e5f8);}(_0x5636,0x102));var _0x6563=function(_0x2e3713,_0x58de4c){_0x2e3713=_0x2e3713-0x0;var _0x348d5a=_0x5636[_0x2e3713];return _0x348d5a;};'use strict';var _=require(_0x6563('0x0'));var BPromise=require(_0x6563('0x1'));var Redis=require('ioredis');var util=require('util');var config=require('../../../../config/environment');var logger=require(_0x6563('0x2'))(_0x6563('0x3'));var cmContactRpc=require(_0x6563('0x4'));config['redis']=_[_0x6563('0x5')](config[_0x6563('0x6')],{'host':_0x6563('0x7'),'port':0x18eb});var io=require(_0x6563('0x8'))(new Redis(config[_0x6563('0x6')]));function emit(_0x193942,_0x9884a9,_0x2d57d5,_0x2d0d5b,_0x98fcd4){logger[_0x6563('0x9')](_0x6563('0xa'),_0x193942,_0x9884a9['id'],_0x2d57d5,_0x2d0d5b,JSON[_0x6563('0xb')](_0x98fcd4));io['to'](_0x2d57d5)['emit'](_0x2d0d5b,_0x98fcd4);}exports['exec']=function(_0x2946f3,_0x129fa3,_0x490a56,_0x506ee9){var _0x5da960,_0x1ef002;var _0x111d38={};var _0x35936d=Number(_0x490a56[_0x6563('0xc')]);var _0x33816e=_0x490a56[_0x6563('0xd')]?Boolean(Number(_0x490a56[_0x6563('0xd')])):![];var _0xbbae72;var _0x447f9a=![];if(!_['isNil'](_0x490a56[_0x6563('0xe')])){if(_0x490a56['data5']=='1')_0x447f9a=!![];}if(!_0x447f9a){if(_0x506ee9[_0x6563('0xf')]){_0x111d38['id']=_0x506ee9[_0x6563('0xf')];}}if(!_0x111d38['id']){_0x111d38[_0x6563('0x10')]=_0x35936d;_0xbbae72=_0x490a56[_0x6563('0x11')]&&_0x490a56['data3']!=='0'?_0x490a56[_0x6563('0x11')][_0x6563('0x12')](','):[_0x6563('0x13')];_0x111d38[_0x6563('0x14')]=_['map'](_0xbbae72,function(_0x3563fd){var _0x589632={};_0x589632[_0x3563fd]=_0x506ee9['routeId']?_0x506ee9['destcalleridnum']:_0x506ee9[_0x6563('0x15')];return _0x589632;});}var _0x4f5609=['id','firstName',_0x6563('0x16'),_0x6563('0x13'),_0x6563('0x17'),_0x6563('0x18'),_0x6563('0x10'),_0x6563('0x19'),_0x6563('0x1a'),_0x6563('0x1b')];var _0x2a70f0=_['union'](_0x4f5609,_0xbbae72);BPromise[_0x6563('0x1c')]()[_0x6563('0x1d')](cmContactRpc[_0x6563('0x1e')]({'attributes':_0x2a70f0,'where':_0x111d38}))['then'](function(_0x293db2){_0x1ef002=_0x293db2;if(!_['isEmpty'](_0x1ef002)){if(_0x1ef002[_0x6563('0x1f')]===0x1){_0x5da960=_0x1ef002[0x0];logger[_0x6563('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x506ee9['uniqueid'],_0x129fa3['id'],_0x5da960['id']);}else{logger[_0x6563('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x506ee9[_0x6563('0x20')],_0x129fa3['id'],_[_0x6563('0x21')](_0x1ef002,'id')[_0x6563('0x22')](','));}return;}else{logger['info'](_0x6563('0x23'),_0x506ee9['uniqueid'],_0x129fa3['id']);var _0x7ea857={'ListId':_0x35936d};var _0x1590e6=_0x490a56['data4']&&_0x490a56[_0x6563('0x24')]!=='0'?_0x490a56[_0x6563('0x24')]:'phone';if(_0x33816e){logger[_0x6563('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x506ee9[_0x6563('0x20')],_0x129fa3['id']);_0x7ea857[_0x1590e6]=_['isNil'](_0x506ee9['routeId'])?_0x506ee9[_0x6563('0x15')]:_0x506ee9[_0x6563('0x25')];if(_[_0x6563('0x26')](_0x506ee9[_0x6563('0x27')])){_0x7ea857[_0x6563('0x28')]=_0x506ee9['calleridname']&&_0x506ee9[_0x6563('0x29')]!==''?_0x506ee9['calleridname']:_0x6563('0x2a');}else{_0x7ea857[_0x6563('0x28')]=_0x506ee9[_0x6563('0x2b')]&&_0x506ee9[_0x6563('0x2b')]!==_0x6563('0x2c')?_0x506ee9[_0x6563('0x2b')]:_0x6563('0x2a');}return BPromise[_0x6563('0x1c')]()[_0x6563('0x1d')](cmContactRpc[_0x6563('0x2d')](_0x7ea857))['then'](function(_0x9b3d86){_0x5da960=_0x9b3d86;_0x1ef002[_0x6563('0x2e')](_0x9b3d86);if(_0x5da960){logger[_0x6563('0x9')](_0x6563('0x2f'),_0x506ee9[_0x6563('0x20')],_0x129fa3['id'],_0x5da960['id']);}return;});}else{logger[_0x6563('0x9')](_0x6563('0x30'),_0x506ee9['uniqueid'],_0x129fa3['id']);_0x7ea857[_0x1590e6]=_[_0x6563('0x26')](_0x506ee9[_0x6563('0x27')])?_0x506ee9[_0x6563('0x15')]:_0x506ee9[_0x6563('0x25')];if(_[_0x6563('0x26')](_0x506ee9[_0x6563('0x27')])){_0x7ea857['firstName']=_0x506ee9[_0x6563('0x29')]&&_0x506ee9[_0x6563('0x29')]!==_0x6563('0x2c')?_0x506ee9[_0x6563('0x29')]:_0x6563('0x2a');}else{_0x7ea857[_0x6563('0x28')]=_0x506ee9[_0x6563('0x2b')]&&_0x506ee9['destcalleridname']!==_0x6563('0x2c')?_0x506ee9[_0x6563('0x2b')]:'Unknown';}_0x5da960=_0x7ea857;_0x1ef002[_0x6563('0x2e')](_0x7ea857);return;}}})[_0x6563('0x1d')](function(){if(_0x2946f3){emit(_0x506ee9['uniqueid'],_0x129fa3,util['format'](_0x6563('0x31'),_0x2946f3[_0x6563('0x32')]),util[_0x6563('0x33')](_0x6563('0x34'),_0x490a56['action'][_0x6563('0x35')]()),{'evt':_[_0x6563('0x36')](_0x506ee9,{'autoCreate':_0x33816e}),'contact':_0x5da960===undefined?{}:_0x5da960,'contacts':_0x1ef002['length']===0x0?undefined:_0x1ef002});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 9768c25..a807dbc 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 _0x16bf=['some','AnyConditions','field','account','channel','chat','ChatWebsiteId','operator','value','AccountId','interaction','event','agent','membername','lastevent','routeId','lodash','mustache','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','../ami','defaults','redis','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','servicenowAccounts','custom:agentcalled','bind','syncCustomEvent','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:rejectmessage','prototype','info','stringify','emit','clone','motionChannel','undefined','voice','interface','status','checkTrigger','Actions','length','action','toLowerCase','contactmanager','motionbar','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','render','winArguments','format','user:%s','name','trigger:%s:%s','data1','merge','jscripty','trigger:%s','exec','integration','queue','script','parse','query','search','replace','every','AllConditions','checkConditions'];(function(_0x488814,_0x3fec59){var _0x58138b=function(_0x575c59){while(--_0x575c59){_0x488814['push'](_0x488814['shift']());}};_0x58138b(++_0x3fec59);}(_0x16bf,0x178));var _0xf16b=function(_0x2c3437,_0x4182f6){_0x2c3437=_0x2c3437-0x0;var _0x4f94c7=_0x16bf[_0x2c3437];return _0x4f94c7;};'use strict';var util=require('util');var _=require(_0xf16b('0x0'));var url=require('url');var Mustache=require(_0xf16b('0x1'));var Redis=require('ioredis');var urlforward=require(_0xf16b('0x2'));var integration=require(_0xf16b('0x3'));var cmContact=require('./cmContact');var script=require(_0xf16b('0x4'));var config=require(_0xf16b('0x5'));var logger=require(_0xf16b('0x6'))(_0xf16b('0x7'));var ami=require(_0xf16b('0x8'));config['redis']=_[_0xf16b('0x9')](config[_0xf16b('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xf16b('0xb'))(new Redis(config[_0xf16b('0xa')]));var operators={'equals':function(_0x2cff6f,_0x275700){return _0x2cff6f==_0x275700;},'not_equals':function(_0x1293f3,_0x539f86){return _0x1293f3!=_0x539f86;}};var barAndWebActions=[_0xf16b('0xc'),_0xf16b('0xd'),_0xf16b('0xe')];function Trigger(_0x12387f){this['triggers']=_0x12387f[_0xf16b('0xf')];this[_0xf16b('0x10')]=_0x12387f[_0xf16b('0x10')];this[_0xf16b('0x11')]=_0x12387f[_0xf16b('0x11')];this[_0xf16b('0x12')]=_0x12387f[_0xf16b('0x12')];this['voiceExtensions']=_0x12387f[_0xf16b('0x13')];this[_0xf16b('0x14')]=_0x12387f['zendeskAccounts'];this[_0xf16b('0x15')]=_0x12387f[_0xf16b('0x15')];this['salesforceAccounts']=_0x12387f['salesforceAccounts'];this[_0xf16b('0x16')]=_0x12387f['sugarcrmAccounts'];this[_0xf16b('0x17')]=_0x12387f[_0xf16b('0x17')];this[_0xf16b('0x18')]=_0x12387f[_0xf16b('0x18')];this[_0xf16b('0x19')]=_0x12387f['vtigerAccounts'];this['servicenowAccounts']=_0x12387f['servicenowAccounts'];this[_0xf16b('0x1a')]=_0x12387f[_0xf16b('0x1a')];this[_0xf16b('0x1b')]=_0x12387f[_0xf16b('0x1b')];this[_0xf16b('0x1c')]={'zendesk':this[_0xf16b('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xf16b('0x16')],'zoho':this['zohoAccounts'],'desk':this[_0xf16b('0x18')],'vtiger':this[_0xf16b('0x19')],'dynamics365':this[_0xf16b('0x1a')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xf16b('0x1d')]};ami['on'](_0xf16b('0x1e'),this['syncCustomEvent'][_0xf16b('0x1f')](this));ami['on']('custom:agentconnect',this[_0xf16b('0x20')]['bind'](this));ami['on'](_0xf16b('0x21'),this[_0xf16b('0x20')][_0xf16b('0x1f')](this));ami['on']('custom:agentcomplete',this['syncCustomEvent'][_0xf16b('0x1f')](this));ami['on'](_0xf16b('0x22'),this[_0xf16b('0x20')]['bind'](this));ami['on'](_0xf16b('0x23'),this[_0xf16b('0x20')][_0xf16b('0x1f')](this));ami['on'](_0xf16b('0x24'),this[_0xf16b('0x20')][_0xf16b('0x1f')](this));ami['on']('custom:agentcongestion',this['syncCustomEvent'][_0xf16b('0x1f')](this));ami['on'](_0xf16b('0x25'),this[_0xf16b('0x20')][_0xf16b('0x1f')](this));ami['on'](_0xf16b('0x26'),this['syncCustomEvent'][_0xf16b('0x1f')](this));ami['on'](_0xf16b('0x27'),this['syncCustomEvent'][_0xf16b('0x1f')](this));ami['on'](_0xf16b('0x28'),this['syncCustomEvent'][_0xf16b('0x1f')](this));ami['on'](_0xf16b('0x29'),this[_0xf16b('0x2a')][_0xf16b('0x1f')](this));ami['on'](_0xf16b('0x2b'),this[_0xf16b('0x2a')][_0xf16b('0x1f')](this));ami['on']('custom:dialend',this[_0xf16b('0x2a')][_0xf16b('0x1f')](this));ami['on'](_0xf16b('0x2c'),this[_0xf16b('0x20')][_0xf16b('0x1f')](this));ami['on'](_0xf16b('0x2d'),this[_0xf16b('0x20')][_0xf16b('0x1f')](this));ami['on'](_0xf16b('0x2e'),this[_0xf16b('0x20')][_0xf16b('0x1f')](this));ami['on']('custom:incomingmessage',this[_0xf16b('0x20')][_0xf16b('0x1f')](this));ami['on'](_0xf16b('0x2f'),this[_0xf16b('0x20')][_0xf16b('0x1f')](this));ami['on']('custom:acceptmessage',this[_0xf16b('0x20')]['bind'](this));ami['on'](_0xf16b('0x30'),this['syncCustomEvent'][_0xf16b('0x1f')](this));}Trigger[_0xf16b('0x31')]['emit']=function(_0x16392a,_0x19af0f,_0xc059ee){logger[_0xf16b('0x32')](_0x16392a,_0x19af0f,JSON[_0xf16b('0x33')](_0xc059ee));io['to'](_0x16392a)[_0xf16b('0x34')](_0x19af0f,_0xc059ee);};Trigger[_0xf16b('0x31')][_0xf16b('0x20')]=function(_0x510a3d){var _0x15140b=_[_0xf16b('0x35')](_0x510a3d);if(typeof _0x15140b[_0xf16b('0x36')]===_0xf16b('0x37')){_0x15140b[_0xf16b('0x36')]=_0xf16b('0x38');}this['checkTriggers'](_0x15140b);};Trigger['prototype']['syncAgentDial']=function(_0x82dd44){if(this[_0xf16b('0x10')][_0x82dd44[_0xf16b('0x39')]]){this['syncCustomEvent'](_0x82dd44);}};Trigger[_0xf16b('0x31')]['checkTriggers']=function(_0x350829){var _0x3dc5f4;for(var _0x3ec123 in this[_0xf16b('0xf')]){if(this['triggers']['hasOwnProperty'](_0x3ec123)){if(this[_0xf16b('0xf')][_0x3ec123][_0xf16b('0x3a')]){_0x3dc5f4=this[_0xf16b('0x3b')](this['triggers'][_0x3ec123],_0x350829);if(_0x3dc5f4){_['merge'](_0x350829,_0x350829['variables']);for(var _0x390289=0x0,_0x44d49c,_0xb041b4,_0x539a7e;_0x3902890x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x9dfdc3,_0x11d717){var _0x26a92b=function(_0x5b1ecf){while(--_0x5b1ecf){_0x9dfdc3['push'](_0x9dfdc3['shift']());}};_0x26a92b(++_0x11d717);}(_0x814b,0x1a2));var _0xb814=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0x814b[_0x1ad926];return _0x1b81dc;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 22acaa0..f55cc05 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 _0x342e=['unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','userEmail','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','replace','%2b','telephone1','contactid',']\x20Enduser\x20Created!','forEach','string','picklist','type','nameField','customField','indexOf','ticketType','incident','assign','getString','Subjects','Descriptions','Fields','/contacts(','callDirection','queue','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x342e,0x1d5));var _0xe342=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0x342e[_0x237da8];return _0x558825;};'use strict';var _=require(_0xe342('0x0'));var BPromise=require(_0xe342('0x1'));var rp=require(_0xe342('0x2'));var util=require('util');var intUtil=require(_0xe342('0x3'));var md5=require(_0xe342('0x4'));var Redis=require(_0xe342('0x5'));var logger=require(_0xe342('0x6'))(_0xe342('0x7'));var config=require(_0xe342('0x8'));config['redis']=_['defaults'](config[_0xe342('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xe342('0xa'))(new Redis(config[_0xe342('0x9')]));function getAuthToken(_0x40e3fd,_0x49f58c,_0x5a3411){var _0x41f6c5={'method':_0xe342('0xb'),'uri':_0x49f58c,'form':{'client_id':_0x40e3fd[_0xe342('0xc')],'resource':_0x40e3fd[_0xe342('0xd')],'username':_0x40e3fd[_0xe342('0xe')],'password':_0x40e3fd['password'],'grant_type':_0xe342('0xf'),'client_secret':_0x40e3fd[_0xe342('0x10')]},'json':!![]};return rp(_0x41f6c5)[_0xe342('0x11')](function(_0x19a0c6){return _0x19a0c6[_0xe342('0x12')];})[_0xe342('0x13')](function(_0x383b80){logger[_0xe342('0x14')]('['+[_0x5a3411[_0xe342('0x15')]()]+_0xe342('0x16'));return _0x383b80[_0xe342('0x17')];});}function getUser(_0x47961d,_0x1e56f3,_0x250985,_0x3a9f71,_0x151377,_0x4620d9){return new BPromise(function(_0x5700ea,_0x31e89f){return getAuthToken(_0x1e56f3,_0x3a9f71,_0x4620d9)['then'](function(_0x54a871){var _0x10ef73={'method':_0xe342('0x18'),'uri':_0x151377+_0xe342('0x19'),'headers':{'Authorization':_0xe342('0x1a')+_0x54a871,'OData-Version':_0xe342('0x1b')},'json':!![]};return rp(_0x10ef73);})[_0xe342('0x11')](function(_0x547641){var _0x1c6c6b=_0x547641[_0xe342('0x1c')];var _0x514b5e=![];var _0x426d6e=null;if(!_[_0xe342('0x1d')](_0x250985)){if(intUtil['validateEmail'](_0x250985['email'])){_0x47961d[_0xe342('0x1e')]=_0x250985[_0xe342('0x1f')];for(_0x426d6e=0x0;_0x426d6e<_0x1c6c6b[_0xe342('0x20')];_0x426d6e++){if(_0x1c6c6b[_0x426d6e][_0xe342('0x21')]===_0x250985['email']&&!_0x1c6c6b[_0x426d6e]['isdisabled']){_0x514b5e=!![];logger[_0xe342('0x22')]('['+[_0x4620d9[_0xe342('0x15')]()]+_0xe342('0x23')+_0x1c6c6b[_0x426d6e][_0xe342('0x24')]+'!');_0x47961d[_0xe342('0x25')]=_0x1c6c6b[_0x426d6e]['systemuserid'];}}}}if(!_0x514b5e){logger[_0xe342('0x22')]('['+[_0x4620d9[_0xe342('0x15')]()]+_0xe342('0x26'));_0x47961d['userEmail']=_0x1e56f3['username'];for(_0x426d6e=0x0;_0x426d6e<_0x1c6c6b[_0xe342('0x20')];_0x426d6e++){if(_0x1c6c6b[_0x426d6e]['internalemailaddress']===_0x1e56f3[_0xe342('0xe')]){_0x47961d[_0xe342('0x25')]=_0x1c6c6b[_0x426d6e]['systemuserid'];}}}_0x5700ea(_0x47961d);})['catch'](function(_0x491c50){_0x31e89f(_0x491c50[_0xe342('0x17')]);});});}function createEndUser(_0x4a0881,_0x1f758b,_0x3de9e3,_0x5e8b39,_0x5a529e,_0x118123){return new BPromise(function(_0x21ab92,_0x2527e4){return getAuthToken(_0x1f758b,_0x3de9e3,_0x118123)['then'](function(_0x174b77){var _0x66ce4e=_0x118123[_0xe342('0x27')]()===_0xe342('0x28')?_0x5a529e[_0xe342('0x29')]:_0x5a529e[_0xe342('0x2a')];var _0x268058={'method':'POST','uri':_0x5e8b39+'contacts','body':{'telephone1':_0x66ce4e,'fullname':_0x66ce4e,'firstname':_0x66ce4e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe342('0x2b')+_0x4a0881[_0xe342('0x25')]+')'},'headers':{'Authorization':_0xe342('0x1a')+_0x174b77,'OData-Version':_0xe342('0x1b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x268058);})['then'](function(_0x4590b0){var _0xe226cf=_0x4590b0[_0xe342('0x2c')][_0xe342('0x2d')];var _0x10f6bf=_0xe226cf[_0xe342('0x2e')](_0xe226cf['lastIndexOf']('(')+0x1,_0xe226cf[_0xe342('0x2f')](')'));_0x4a0881[_0xe342('0x30')]=_0x10f6bf;_0x21ab92(_0x4a0881);})[_0xe342('0x13')](function(_0x2695b9){_0x2527e4(_0x2695b9[_0xe342('0x17')]);});});}function getEndUser(_0x3cf8c1,_0x1ad19f,_0x35fcfa,_0x5285fb,_0x1dcc30,_0x509da2){return new BPromise(function(_0x2f053f,_0x2cf0c4){var _0x1b5a78=_0x509da2[_0xe342('0x27')]()==='outbound'?_0x1dcc30[_0xe342('0x29')]:_0x1dcc30[_0xe342('0x2a')];return getAuthToken(_0x1ad19f,_0x35fcfa,_0x509da2)['then'](function(_0x34e305){var _0x20462a={'method':'GET','uri':_0x5285fb+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x1b5a78[_0xe342('0x31')]('+',_0xe342('0x32'))+'\x27','headers':{'Authorization':_0xe342('0x1a')+_0x34e305,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x20462a);})[_0xe342('0x11')](function(_0x240ba8){var _0x348e2d=null;if(_0x240ba8){var _0x3e3a3b=_0x240ba8[_0xe342('0x1c')];var _0x47f15d=![];for(_0x348e2d=0x0;_0x348e2d<_0x3e3a3b[_0xe342('0x20')];_0x348e2d++){if(_0x3e3a3b[_0x348e2d][_0xe342('0x33')]===_0x1b5a78){_0x47f15d=!![];_0x3cf8c1[_0xe342('0x30')]=_0x3e3a3b[_0x348e2d][_0xe342('0x34')];}}if(_0x47f15d){_0x2f053f(_0x3cf8c1);}else{return createEndUser(_0x3cf8c1,_0x1ad19f,_0x35fcfa,_0x5285fb,_0x1dcc30,_0x509da2)[_0xe342('0x11')](function(_0x488311){logger[_0xe342('0x22')]('['+[_0x509da2[_0xe342('0x15')]()]+']\x20Enduser\x20created!',_0x488311[_0xe342('0x30')]);_0x2f053f(_0x488311);});}}else{return createEndUser(_0x3cf8c1,_0x1ad19f,_0x35fcfa,_0x5285fb,_0x1dcc30,_0x509da2)['then'](function(_0x567c03){logger[_0xe342('0x22')]('['+[_0x509da2['toUpperCase']()]+_0xe342('0x35'),_0x567c03[_0xe342('0x30')]);_0x2f053f(_0x567c03);});}});});}function getCustomFields(_0x41a60d,_0x57d303,_0x5e7479){var _0x21871b={};if(_0x41a60d[_0xe342('0x20')]>0x0){_[_0xe342('0x36')](_0x41a60d,function(_0x33e22f){if(_['includes']([_0xe342('0x37'),_0xe342('0x38')],_0x33e22f[_0xe342('0x39')])&&_0x33e22f[_0xe342('0x3a')]&&!_0x33e22f[_0xe342('0x3b')]){var _0x158f6a=_0x33e22f['idField'][_0xe342('0x27')]();var _0x4a4de6=_0x158f6a[_0xe342('0x2e')](0x0,_0x158f6a[_0xe342('0x3c')]('_'));var _0x57cd94=_0x158f6a[_0xe342('0x2e')](_0x158f6a['indexOf']('_')+0x1);if(_0x4a4de6===_0x5e7479){_0x21871b[_0x57cd94]=_0x33e22f['content'];}}});}return _0x21871b;}function getTicket(_0xc42364,_0x5ad3c0,_0x44c572,_0x425e7f,_0x43a80a,_0x3bd4e9,_0x294a68){return new BPromise(function(_0x500f61,_0x4293ca){var _0x4994ae;return getAuthToken(_0x5ad3c0,_0x44c572,_0x294a68)['then'](function(_0x213242){if(_0x3bd4e9[_0xe342('0x3d')]===_0xe342('0x3e')){_0x4994ae={'method':_0xe342('0xb'),'uri':_0x425e7f+'incidents','body':Object[_0xe342('0x3f')]({},{'title':intUtil[_0xe342('0x40')](_0x3bd4e9[_0xe342('0x41')],_0x43a80a,'\x20'),'description':intUtil[_0xe342('0x40')](_0x3bd4e9[_0xe342('0x42')],_0x43a80a,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0xc42364[_0xe342('0x30')]+')','ownerid@odata.bind':_0xe342('0x2b')+_0xc42364['userId']+')','caseorigincode':'1'},getCustomFields(_0x3bd4e9[_0xe342('0x43')],_0x43a80a,_0x3bd4e9['ticketType'])),'headers':{'Authorization':_0xe342('0x1a')+_0x213242,'OData-Version':_0xe342('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3bd4e9[_0xe342('0x3d')]==='phonecall'){_0x4994ae={'method':_0xe342('0xb'),'uri':_0x425e7f+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0xe342('0x40')](_0x3bd4e9[_0xe342('0x41')],_0x43a80a,'\x20'),'phonenumber':String(_0x43a80a[_0xe342('0x2a')]),'description':intUtil['getString'](_0x3bd4e9[_0xe342('0x42')],_0x43a80a,'\x0a'),'regardingobjectid_contact@odata.bind':_0xe342('0x44')+_0xc42364[_0xe342('0x30')]+')','ownerid@odata.bind':'/systemusers('+_0xc42364['userId']+')','directioncode':_0xc42364[_0xe342('0x45')]===_0xe342('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0xc42364[_0xe342('0x25')]+')','participationtypemask':_0xc42364[_0xe342('0x45')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xe342('0x44')+_0xc42364[_0xe342('0x30')]+')','participationtypemask':_0xc42364[_0xe342('0x45')]===_0xe342('0x46')?0x1:0x2}]},getCustomFields(_0x3bd4e9[_0xe342('0x43')],_0x43a80a,_0x3bd4e9[_0xe342('0x3d')])),'headers':{'Authorization':_0xe342('0x1a')+_0x213242,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4994ae);})['then'](function(_0x46ae85){var _0x15e13c=_0x46ae85[_0xe342('0x2c')][_0xe342('0x2d')];var _0xf6ed8d=_0x15e13c[_0xe342('0x2e')](_0x15e13c[_0xe342('0x2f')]('(')+0x1,_0x15e13c[_0xe342('0x2f')](')'));_0xc42364[_0xe342('0x47')]=_0xf6ed8d;_0x500f61(_0xc42364);})['catch'](function(_0x2c97e0){_0x4293ca(_0x2c97e0['message']);});});}function emit(_0x4580b2,_0x4e7b4c,_0x152bb3,_0x1ce721){var _0x2869bd={'uri':util[_0xe342('0x48')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x4580b2,_0x152bb3,_0x1ce721)};io['to'](util[_0xe342('0x48')](_0xe342('0x49'),_0x4e7b4c))[_0xe342('0x4a')](_0xe342('0x4b'),_0x2869bd);}exports['cs']=function(_0x29b814,_0x2177e5,_0x36d656,_0x3f30c0,_0x11054f,_0x9ca8c7,_0x2d16b6,_0x1b1edf){var _0x29ffcc={};_0x9ca8c7[_0xe342('0xd')]=intUtil[_0xe342('0x4c')](_0x9ca8c7[_0xe342('0xd')]);_0x9ca8c7['serverUrl']=intUtil[_0xe342('0x4c')](_0x9ca8c7[_0xe342('0x4d')]);_0x29ffcc[_0xe342('0x45')]=_0x1b1edf===_0xe342('0x46')||_0x1b1edf==='unmanaged'?_0xe342('0x46'):_0xe342('0x28');var _0x4fa327=util[_0xe342('0x48')]('%s/api/data/v9.0/',_0x9ca8c7[_0xe342('0xd')]);var _0x2b2cf5=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x9ca8c7[_0xe342('0x4e')]);var _0xeab83=util[_0xe342('0x48')](_0xe342('0x4f'),_0x9ca8c7['serverUrl'],_0x2177e5['uniqueid'],md5(_0x2177e5[_0xe342('0x50')]));if(_0x11054f&&_0x11054f['monitor_format']){logger[_0xe342('0x22')](_0xe342('0x51'),'Recording\x20is\x20enabled!');_0x2177e5[_0xe342('0x52')]=_0xeab83;}else if(_0x2d16b6&&_0x2d16b6[_0xe342('0x53')]&&_0x2d16b6['recordingFormat']!==_0xe342('0x54')){logger[_0xe342('0x22')]('[OUTBOUND]',_0xe342('0x55'));_0x2177e5['recordingURL']=_0xeab83;}else{_0x2177e5[_0xe342('0x52')]='';}return getUser(_0x29ffcc,_0x9ca8c7,_0x3f30c0,_0x2b2cf5,_0x4fa327,_0x1b1edf)[_0xe342('0x11')](function(_0x470173){logger[_0xe342('0x22')]('['+_0x1b1edf['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x470173[_0xe342('0x25')]);logger[_0xe342('0x22')]('['+_0x1b1edf[_0xe342('0x15')]()+']\x20The\x20User\x20email\x20is:',_0x470173[_0xe342('0x1e')]);return getEndUser(_0x470173,_0x9ca8c7,_0x2b2cf5,_0x4fa327,_0x2177e5,_0x1b1edf);})['then'](function(_0x53c622){logger[_0xe342('0x22')]('['+_0x1b1edf['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x53c622[_0xe342('0x30')]);logger[_0xe342('0x22')]('['+_0x1b1edf[_0xe342('0x15')]()+_0xe342('0x56'),_0x2177e5['calleridnum']);return getTicket(_0x53c622,_0x9ca8c7,_0x2b2cf5,_0x4fa327,_0x2177e5,_0x36d656,_0x1b1edf);})[_0xe342('0x11')](function(_0x5f43f3){logger[_0xe342('0x22')](util['format']('['+_0x1b1edf[_0xe342('0x15')]()+_0xe342('0x57'),_0x36d656[_0xe342('0x3d')],_0x5f43f3[_0xe342('0x47')]));logger['info'](util[_0xe342('0x48')]('['+_0x1b1edf[_0xe342('0x15')]()+_0xe342('0x58'),_0x1b1edf));if(_0x1b1edf!==_0xe342('0x59')){logger[_0xe342('0x22')]('['+_0x1b1edf[_0xe342('0x15')]()+']',_0xe342('0x5a'));emit(_0x9ca8c7[_0xe342('0xd')],_0x3f30c0[_0xe342('0x5b')],_0x36d656['ticketType'],_0x5f43f3[_0xe342('0x47')]);}})[_0xe342('0x13')](function(_0x4e90c4){logger['error']('['+_0x1b1edf[_0xe342('0x15')]()+_0xe342('0x5c'),util['inspect'](_0x4e90c4,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc755=['odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','value','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','string','type','nameField','idField','indexOf','ticketType','incident','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','phonecall','phonecalls','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','unmanaged','outbound','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','redis','defaults','localhost','socket.io-emitter','POST','remoteUri','username','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','destcalleridnum','calleridnum','headers'];(function(_0x3a0deb,_0x2f868d){var _0xd1f46a=function(_0x405fbe){while(--_0x405fbe){_0x3a0deb['push'](_0x3a0deb['shift']());}};_0xd1f46a(++_0x2f868d);}(_0xc755,0x14e));var _0x5c75=function(_0x287234,_0x4b9e28){_0x287234=_0x287234-0x0;var _0x4bfc27=_0xc755[_0x287234];return _0x4bfc27;};'use strict';var _=require(_0x5c75('0x0'));var BPromise=require(_0x5c75('0x1'));var rp=require(_0x5c75('0x2'));var util=require(_0x5c75('0x3'));var intUtil=require('./util');var md5=require(_0x5c75('0x4'));var Redis=require(_0x5c75('0x5'));var logger=require('../../../../config/logger')('dynamics365');var config=require('../../../../config/environment');config[_0x5c75('0x6')]=_[_0x5c75('0x7')](config[_0x5c75('0x6')],{'host':_0x5c75('0x8'),'port':0x18eb});var io=require(_0x5c75('0x9'))(new Redis(config['redis']));function getAuthToken(_0x3248ec,_0x188979,_0x7eedba){var _0x361fc8={'method':_0x5c75('0xa'),'uri':_0x188979,'form':{'client_id':_0x3248ec['clientId'],'resource':_0x3248ec[_0x5c75('0xb')],'username':_0x3248ec[_0x5c75('0xc')],'password':_0x3248ec[_0x5c75('0xd')],'grant_type':_0x5c75('0xd'),'client_secret':_0x3248ec[_0x5c75('0xe')]},'json':!![]};return rp(_0x361fc8)['then'](function(_0xa3ac15){return _0xa3ac15[_0x5c75('0xf')];})[_0x5c75('0x10')](function(_0x3483ef){logger[_0x5c75('0x11')]('['+[_0x7eedba[_0x5c75('0x12')]()]+_0x5c75('0x13'));return _0x3483ef[_0x5c75('0x14')];});}function getUser(_0x591f0d,_0x136086,_0x560d94,_0x1e8f35,_0x57a1c4,_0x513d37){return new BPromise(function(_0x5beb49,_0x50747c){return getAuthToken(_0x136086,_0x1e8f35,_0x513d37)[_0x5c75('0x15')](function(_0x58081f){var _0x577521={'method':'GET','uri':_0x57a1c4+_0x5c75('0x16'),'headers':{'Authorization':_0x5c75('0x17')+_0x58081f,'OData-Version':_0x5c75('0x18')},'json':!![]};return rp(_0x577521);})[_0x5c75('0x15')](function(_0x20063d){var _0x1edfe4=_0x20063d['value'];var _0x59aebb=![];var _0x412ae7=null;if(!_[_0x5c75('0x19')](_0x560d94)){if(intUtil[_0x5c75('0x1a')](_0x560d94[_0x5c75('0x1b')])){_0x591f0d[_0x5c75('0x1c')]=_0x560d94['email'];for(_0x412ae7=0x0;_0x412ae7<_0x1edfe4[_0x5c75('0x1d')];_0x412ae7++){if(_0x1edfe4[_0x412ae7][_0x5c75('0x1e')]===_0x560d94[_0x5c75('0x1b')]&&!_0x1edfe4[_0x412ae7]['isdisabled']){_0x59aebb=!![];logger[_0x5c75('0x1f')]('['+[_0x513d37[_0x5c75('0x12')]()]+']\x20Agent\x20found\x20'+_0x1edfe4[_0x412ae7][_0x5c75('0x20')]+'!');_0x591f0d[_0x5c75('0x21')]=_0x1edfe4[_0x412ae7]['systemuserid'];}}}}if(!_0x59aebb){logger[_0x5c75('0x1f')]('['+[_0x513d37[_0x5c75('0x12')]()]+_0x5c75('0x22'));_0x591f0d[_0x5c75('0x1c')]=_0x136086[_0x5c75('0xc')];for(_0x412ae7=0x0;_0x412ae7<_0x1edfe4[_0x5c75('0x1d')];_0x412ae7++){if(_0x1edfe4[_0x412ae7]['internalemailaddress']===_0x136086['username']){_0x591f0d[_0x5c75('0x21')]=_0x1edfe4[_0x412ae7][_0x5c75('0x20')];}}}_0x5beb49(_0x591f0d);})[_0x5c75('0x10')](function(_0x1c9264){_0x50747c(_0x1c9264[_0x5c75('0x14')]);});});}function createEndUser(_0x39c269,_0x17c09f,_0x4ba955,_0x5823d7,_0xfce4cf,_0x4c7d05){return new BPromise(function(_0x356b8f,_0x4b2f33){return getAuthToken(_0x17c09f,_0x4ba955,_0x4c7d05)['then'](function(_0x5cceeb){var _0x2ebd43=_0x4c7d05['toLowerCase']()==='outbound'?_0xfce4cf[_0x5c75('0x23')]:_0xfce4cf[_0x5c75('0x24')];var _0x12917c={'method':'POST','uri':_0x5823d7+'contacts','body':{'telephone1':_0x2ebd43,'fullname':_0x2ebd43,'firstname':_0x2ebd43,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x39c269['userId']+')'},'headers':{'Authorization':_0x5c75('0x17')+_0x5cceeb,'OData-Version':_0x5c75('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x12917c);})[_0x5c75('0x15')](function(_0x2f7453){var _0x288fcd=_0x2f7453[_0x5c75('0x25')][_0x5c75('0x26')];var _0x3480ce=_0x288fcd[_0x5c75('0x27')](_0x288fcd[_0x5c75('0x28')]('(')+0x1,_0x288fcd['lastIndexOf'](')'));_0x39c269[_0x5c75('0x29')]=_0x3480ce;_0x356b8f(_0x39c269);})['catch'](function(_0x48b91c){_0x4b2f33(_0x48b91c[_0x5c75('0x14')]);});});}function getEndUser(_0x1bff5f,_0x4560c9,_0x1d885f,_0x4b7cdb,_0x5f0f21,_0xde4080){return new BPromise(function(_0x3bea38,_0xbde770){var _0x337ede=_0xde4080[_0x5c75('0x2a')]()==='outbound'?_0x5f0f21[_0x5c75('0x23')]:_0x5f0f21['calleridnum'];return getAuthToken(_0x4560c9,_0x1d885f,_0xde4080)['then'](function(_0x40fd48){var _0x500539={'method':'GET','uri':_0x4b7cdb+_0x5c75('0x2b')+_0x337ede[_0x5c75('0x2c')]('+',_0x5c75('0x2d'))+'\x27','headers':{'Authorization':_0x5c75('0x17')+_0x40fd48,'If-None-Match':null,'OData-Version':_0x5c75('0x18')},'json':!![]};return rp(_0x500539);})[_0x5c75('0x15')](function(_0xad5227){var _0x3e44ad=null;if(_0xad5227){var _0x21e21a=_0xad5227[_0x5c75('0x2e')];var _0x2a9ea1=![];for(_0x3e44ad=0x0;_0x3e44ad<_0x21e21a[_0x5c75('0x1d')];_0x3e44ad++){if(_0x21e21a[_0x3e44ad][_0x5c75('0x2f')]===_0x337ede){_0x2a9ea1=!![];_0x1bff5f[_0x5c75('0x29')]=_0x21e21a[_0x3e44ad][_0x5c75('0x30')];}}if(_0x2a9ea1){_0x3bea38(_0x1bff5f);}else{return createEndUser(_0x1bff5f,_0x4560c9,_0x1d885f,_0x4b7cdb,_0x5f0f21,_0xde4080)['then'](function(_0x4bbaa3){logger[_0x5c75('0x1f')]('['+[_0xde4080['toUpperCase']()]+_0x5c75('0x31'),_0x4bbaa3[_0x5c75('0x29')]);_0x3bea38(_0x4bbaa3);});}}else{return createEndUser(_0x1bff5f,_0x4560c9,_0x1d885f,_0x4b7cdb,_0x5f0f21,_0xde4080)[_0x5c75('0x15')](function(_0x55926a){logger['info']('['+[_0xde4080[_0x5c75('0x12')]()]+_0x5c75('0x32'),_0x55926a[_0x5c75('0x29')]);_0x3bea38(_0x55926a);});}});});}function getCustomFields(_0x1d9697,_0x3fd82b,_0x465c8b){var _0x331224={};if(_0x1d9697[_0x5c75('0x1d')]>0x0){_[_0x5c75('0x33')](_0x1d9697,function(_0x217381){if(_['includes']([_0x5c75('0x34'),'picklist'],_0x217381[_0x5c75('0x35')])&&_0x217381[_0x5c75('0x36')]&&!_0x217381['customField']){var _0x143ba4=_0x217381[_0x5c75('0x37')][_0x5c75('0x2a')]();var _0x1d41be=_0x143ba4[_0x5c75('0x27')](0x0,_0x143ba4[_0x5c75('0x38')]('_'));var _0x18d14d=_0x143ba4['substring'](_0x143ba4['indexOf']('_')+0x1);if(_0x1d41be===_0x465c8b){_0x331224[_0x18d14d]=_0x217381['content'];}}});}return _0x331224;}function getTicket(_0x2ccdd5,_0x1bbfcb,_0x510a62,_0xf6a31,_0x4a4ef9,_0x5c3104,_0xcdbb2){return new BPromise(function(_0x2c2620,_0x289710){var _0x3a266a;return getAuthToken(_0x1bbfcb,_0x510a62,_0xcdbb2)['then'](function(_0x607339){if(_0x5c3104[_0x5c75('0x39')]===_0x5c75('0x3a')){_0x3a266a={'method':_0x5c75('0xa'),'uri':_0xf6a31+'incidents','body':Object[_0x5c75('0x3b')]({},{'title':intUtil[_0x5c75('0x3c')](_0x5c3104[_0x5c75('0x3d')],_0x4a4ef9,'\x20'),'description':intUtil[_0x5c75('0x3c')](_0x5c3104[_0x5c75('0x3e')],_0x4a4ef9,'\x0a'),'customerid_contact@odata.bind':_0x5c75('0x3f')+_0x2ccdd5[_0x5c75('0x29')]+')','ownerid@odata.bind':_0x5c75('0x40')+_0x2ccdd5[_0x5c75('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x5c3104['Fields'],_0x4a4ef9,_0x5c3104[_0x5c75('0x39')])),'headers':{'Authorization':_0x5c75('0x17')+_0x607339,'OData-Version':_0x5c75('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5c3104['ticketType']===_0x5c75('0x41')){_0x3a266a={'method':_0x5c75('0xa'),'uri':_0xf6a31+_0x5c75('0x42'),'body':Object[_0x5c75('0x3b')]({},{'subject':intUtil[_0x5c75('0x3c')](_0x5c3104[_0x5c75('0x3d')],_0x4a4ef9,'\x20'),'phonenumber':String(_0x4a4ef9[_0x5c75('0x24')]),'description':intUtil['getString'](_0x5c3104[_0x5c75('0x3e')],_0x4a4ef9,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5c75('0x3f')+_0x2ccdd5[_0x5c75('0x29')]+')','ownerid@odata.bind':_0x5c75('0x40')+_0x2ccdd5[_0x5c75('0x21')]+')','directioncode':_0x2ccdd5[_0x5c75('0x43')]===_0x5c75('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2ccdd5[_0x5c75('0x21')]+')','participationtypemask':_0x2ccdd5[_0x5c75('0x43')]===_0x5c75('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0x5c75('0x3f')+_0x2ccdd5[_0x5c75('0x29')]+')','participationtypemask':_0x2ccdd5[_0x5c75('0x43')]===_0x5c75('0x44')?0x1:0x2}]},getCustomFields(_0x5c3104['Fields'],_0x4a4ef9,_0x5c3104[_0x5c75('0x39')])),'headers':{'Authorization':_0x5c75('0x17')+_0x607339,'OData-Version':_0x5c75('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3a266a);})['then'](function(_0x52a76b){var _0x32f294=_0x52a76b[_0x5c75('0x25')][_0x5c75('0x26')];var _0x1e6872=_0x32f294[_0x5c75('0x27')](_0x32f294[_0x5c75('0x28')]('(')+0x1,_0x32f294[_0x5c75('0x28')](')'));_0x2ccdd5[_0x5c75('0x45')]=_0x1e6872;_0x2c2620(_0x2ccdd5);})[_0x5c75('0x10')](function(_0x5e66f1){_0x289710(_0x5e66f1[_0x5c75('0x14')]);});});}function emit(_0x1b2e47,_0xdb67b4,_0x25f62a,_0x52abec){var _0xd539e7={'uri':util[_0x5c75('0x46')](_0x5c75('0x47'),_0x1b2e47,_0x25f62a,_0x52abec)};io['to'](util[_0x5c75('0x46')]('user:%s',_0xdb67b4))[_0x5c75('0x48')](_0x5c75('0x49'),_0xd539e7);}exports['cs']=function(_0x595e3b,_0x5d68e4,_0x1cca5c,_0x576265,_0x89dee8,_0x363196,_0x585dd4,_0x449e37){var _0x499cdd={};_0x363196[_0x5c75('0xb')]=intUtil[_0x5c75('0x4a')](_0x363196[_0x5c75('0xb')]);_0x363196['serverUrl']=intUtil[_0x5c75('0x4a')](_0x363196['serverUrl']);_0x499cdd[_0x5c75('0x43')]=_0x449e37==='queue'||_0x449e37===_0x5c75('0x4b')?'queue':_0x5c75('0x4c');var _0x3e5ff5=util['format'](_0x5c75('0x4d'),_0x363196[_0x5c75('0xb')]);var _0x24954e=util[_0x5c75('0x46')](_0x5c75('0x4e'),_0x363196['tenantId']);var _0x40ef5e=util[_0x5c75('0x46')](_0x5c75('0x4f'),_0x363196[_0x5c75('0x50')],_0x5d68e4[_0x5c75('0x51')],md5(_0x5d68e4[_0x5c75('0x51')]));if(_0x89dee8&&_0x89dee8['monitor_format']){logger['info']('[QUEUE]',_0x5c75('0x52'));_0x5d68e4[_0x5c75('0x53')]=_0x40ef5e;}else if(_0x585dd4&&_0x585dd4[_0x5c75('0x54')]&&_0x585dd4[_0x5c75('0x54')]!==_0x5c75('0x55')){logger[_0x5c75('0x1f')]('[OUTBOUND]',_0x5c75('0x52'));_0x5d68e4['recordingURL']=_0x40ef5e;}else{_0x5d68e4[_0x5c75('0x53')]='';}return getUser(_0x499cdd,_0x363196,_0x576265,_0x24954e,_0x3e5ff5,_0x449e37)[_0x5c75('0x15')](function(_0x288d73){logger[_0x5c75('0x1f')]('['+_0x449e37[_0x5c75('0x12')]()+_0x5c75('0x56'),_0x288d73['userId']);logger[_0x5c75('0x1f')]('['+_0x449e37[_0x5c75('0x12')]()+']\x20The\x20User\x20email\x20is:',_0x288d73[_0x5c75('0x1c')]);return getEndUser(_0x288d73,_0x363196,_0x24954e,_0x3e5ff5,_0x5d68e4,_0x449e37);})[_0x5c75('0x15')](function(_0x36f492){logger[_0x5c75('0x1f')]('['+_0x449e37[_0x5c75('0x12')]()+_0x5c75('0x57'),_0x36f492['enduserId']);logger[_0x5c75('0x1f')]('['+_0x449e37[_0x5c75('0x12')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x5d68e4[_0x5c75('0x24')]);return getTicket(_0x36f492,_0x363196,_0x24954e,_0x3e5ff5,_0x5d68e4,_0x1cca5c,_0x449e37);})['then'](function(_0x4990b0){logger[_0x5c75('0x1f')](util[_0x5c75('0x46')]('['+_0x449e37['toUpperCase']()+_0x5c75('0x58'),_0x1cca5c[_0x5c75('0x39')],_0x4990b0[_0x5c75('0x45')]));logger[_0x5c75('0x1f')](util[_0x5c75('0x46')]('['+_0x449e37[_0x5c75('0x12')]()+_0x5c75('0x59'),_0x449e37));if(_0x449e37!=='unmanaged'){logger[_0x5c75('0x1f')]('['+_0x449e37[_0x5c75('0x12')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x363196[_0x5c75('0xb')],_0x576265[_0x5c75('0x5a')],_0x1cca5c[_0x5c75('0x39')],_0x4990b0[_0x5c75('0x45')]);}})[_0x5c75('0x10')](function(_0xf22ef4){logger[_0x5c75('0x11')]('['+_0x449e37[_0x5c75('0x12')]()+_0x5c75('0x5b'),util[_0x5c75('0x5c')](_0xf22ef4,{'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 3060576..e7f45e9 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 _0x7f9c=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','destcalleridnum','[OUTBOUND]','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','application/json','emit','info','Caller\x20-\x20%s','calleridnum','getString','Tags','name','Fields','custom_fields','value','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','contact','email','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','length','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','type','nameField','customField','toLowerCase','content','push','idField','variable','variableName','Variable','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!'];(function(_0x435f67,_0x5b877d){var _0x580a48=function(_0x5cacc3){while(--_0x5cacc3){_0x435f67['push'](_0x435f67['shift']());}};_0x580a48(++_0x5b877d);}(_0x7f9c,0x16a));var _0xc7f9=function(_0x188e1b,_0x1e4e4f){_0x188e1b=_0x188e1b-0x0;var _0xc35210=_0x7f9c[_0x188e1b];return _0xc35210;};'use strict';var _=require(_0xc7f9('0x0'));var rp=require(_0xc7f9('0x1'));var md5=require(_0xc7f9('0x2'));var util=require(_0xc7f9('0x3'));var Redis=require(_0xc7f9('0x4'));var intUtil=require(_0xc7f9('0x5'));var config=require('../../../../config/environment');var logger=require(_0xc7f9('0x6'))('freshdesk');config[_0xc7f9('0x7')]=_[_0xc7f9('0x8')](config['redis'],{'host':_0xc7f9('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc7f9('0x7')]));var headers={'Content-Type':_0xc7f9('0xa'),'Accept':_0xc7f9('0xa')};function emit(_0x2069da,_0x17b308,_0x40cdc0){io['to'](_0x2069da)[_0xc7f9('0xb')](_0x17b308,_0x40cdc0);}function getTicket(_0x313d02,_0x36c4b6,_0x18471a,_0x46c92c,_0x4d2406){logger[_0xc7f9('0xc')]('Creating\x20new\x20ticket...');var _0x5b4596=_['merge']({'responder_id':_0x36c4b6['id'],'requester_id':_0x18471a['id'],'name':util['format'](_0xc7f9('0xd'),_0x4d2406['calleridname']),'phone':_0x4d2406[_0xc7f9('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc7f9('0xf')](_0x46c92c['Subjects'],_0x4d2406,'\x20'),'description':intUtil['getString'](_0x46c92c['Descriptions'],_0x4d2406,'
'),'tags':getTags(_0x46c92c[_0xc7f9('0x10')],_0xc7f9('0x11'))},getCustomFields(_0x46c92c[_0xc7f9('0x12')],_0x4d2406));_0x5b4596[_0xc7f9('0x13')]=_['mapValues'](_['keyBy'](_0x5b4596['custom_fields'],'id'),_0xc7f9('0x14'));return request({'uri':util[_0xc7f9('0x15')](_0xc7f9('0x16'),_0x313d02[_0xc7f9('0x17')]),'method':_0xc7f9('0x18'),'body':_0x5b4596})[_0xc7f9('0x19')](function(_0x21f143){logger[_0xc7f9('0xc')](_0xc7f9('0x1a'));return _0x21f143;});}function getUser(_0x73f484,_0x76ab19){if(intUtil['validateEmail'](_0x76ab19)){return request({'uri':util[_0xc7f9('0x15')](_0xc7f9('0x1b'),_0x73f484[_0xc7f9('0x17')]),'qs':{'email':_0x76ab19}})[_0xc7f9('0x19')](function(_0x5d6d7e){if(_0x5d6d7e['length']){logger[_0xc7f9('0xc')]('Agent\x20found!');return _['find'](_0x5d6d7e,function(_0xdf0480){return _0xdf0480[_0xc7f9('0x1c')][_0xc7f9('0x1d')]===_0x76ab19;});}else{logger[_0xc7f9('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc7f9('0x15')]('%s/api/v2/agents/me',_0x73f484['remoteUri'])})[_0xc7f9('0x19')](function(_0x2d1331){logger[_0xc7f9('0xc')]('Admin\x20account\x20selected.');return _0x2d1331;});}});}else{logger[_0xc7f9('0xc')](_0xc7f9('0x1e'));return request({'uri':util[_0xc7f9('0x15')](_0xc7f9('0x1f'),_0x73f484[_0xc7f9('0x17')])})[_0xc7f9('0x19')](function(_0x48c570){logger[_0xc7f9('0xc')](_0xc7f9('0x20'));return _0x48c570;});}}function getEndUser(_0x2292b3,_0x849913,_0xa0c580){logger[_0xc7f9('0xc')]('Searching\x20enduser\x20with\x20phone',_0xa0c580);return request({'uri':util[_0xc7f9('0x15')](_0xc7f9('0x21'),_0x2292b3[_0xc7f9('0x17')]),'qs':{'phone':_0xa0c580}})['then'](function(_0x11375c){if(_0x11375c[_0xc7f9('0x22')]){logger[_0xc7f9('0xc')](_0xc7f9('0x23'));return _[_0xc7f9('0x24')](_0x11375c,{'phone':_0xa0c580});}else{logger[_0xc7f9('0xc')](_0xc7f9('0x25'));return request({'uri':util['format'](_0xc7f9('0x21'),_0x2292b3[_0xc7f9('0x17')]),'method':_0xc7f9('0x18'),'body':{'name':_0x849913,'phone':_0xa0c580}})[_0xc7f9('0x19')](function(_0x1f0756){logger[_0xc7f9('0xc')](_0xc7f9('0x26'));return _0x1f0756;});}});}function getAuth(_0x3dc37e){return util[_0xc7f9('0x15')]('Basic\x20%s',new Buffer(_0x3dc37e['apiKey']+':X')[_0xc7f9('0x27')](_0xc7f9('0x28')));}function request(_0x44961b){logger[_0xc7f9('0x29')](_0xc7f9('0x2a'),JSON[_0xc7f9('0x2b')](_0x44961b));return rp(_['defaults'](_0x44961b,{'method':_0xc7f9('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0x16290f,_0x414582){var _0x55d214=[];if(_0x16290f&&_0x16290f[_0xc7f9('0x22')]>0x0){_0x55d214=_[_0xc7f9('0x2d')](_0x16290f,_0x414582);}return _0x55d214;}function getCustomFields(_0xf5d17,_0x2354cc){var _0x5e9cb3=[];var _0x2aa727={'custom_fields':[]};if(_0xf5d17[_0xc7f9('0x22')]>0x0){_[_0xc7f9('0x2e')](_0xf5d17,function(_0x34df48){if(_[_0xc7f9('0x2f')]([_0xc7f9('0x30'),'picklist'],_0x34df48[_0xc7f9('0x31')])&&_0x34df48[_0xc7f9('0x32')]&&!_0x34df48[_0xc7f9('0x33')]){_0x2aa727[_0x34df48['nameField'][_0xc7f9('0x34')]()]=_0x34df48[_0xc7f9('0x35')][_0xc7f9('0x27')]();}else if(_[_0xc7f9('0x2f')](['string','picklist'],_0x34df48[_0xc7f9('0x31')])&&_0x34df48['idField']&&_0x34df48[_0xc7f9('0x33')]){_0x2aa727[_0xc7f9('0x13')][_0xc7f9('0x36')]({'id':_0x34df48[_0xc7f9('0x37')],'value':_0x34df48[_0xc7f9('0x35')][_0xc7f9('0x27')]()});}else if(_0x34df48[_0xc7f9('0x31')]===_0xc7f9('0x38')&&_0x34df48['variableName']&&_0x34df48[_0xc7f9('0x37')]&&_0x34df48['customField']){_0x2354cc[_0x34df48[_0xc7f9('0x39')]]&&_0x2aa727[_0xc7f9('0x13')][_0xc7f9('0x36')]({'id':_0x34df48[_0xc7f9('0x37')],'value':_0x2354cc[_0x34df48[_0xc7f9('0x39')]][_0xc7f9('0x27')]()});}else if(_0x34df48[_0xc7f9('0x31')]==='customVariable'&&_0x34df48[_0xc7f9('0x3a')]&&_0x34df48[_0xc7f9('0x3a')][_0xc7f9('0x11')]&&_0x34df48[_0xc7f9('0x37')]&&_0x34df48[_0xc7f9('0x33')]){_0x2354cc[_0x34df48[_0xc7f9('0x3a')][_0xc7f9('0x11')][_0xc7f9('0x34')]()]&&_0x2aa727[_0xc7f9('0x13')]['push']({'id':_0x34df48[_0xc7f9('0x37')],'value':_0x2354cc[_0x34df48[_0xc7f9('0x3a')][_0xc7f9('0x11')][_0xc7f9('0x34')]()][_0xc7f9('0x27')]()});}});}return _0x2aa727;}exports['queue']=function(_0x49e6eb,_0x1d03ec,_0x5dc7d0,_0x54796d,_0x2115d8,_0x31847a){var _0x55ad31,_0x2b6ed4;_0x31847a[_0xc7f9('0x17')]=intUtil[_0xc7f9('0x3b')](_0x31847a[_0xc7f9('0x17')]);_0x31847a[_0xc7f9('0x3c')]=intUtil[_0xc7f9('0x3b')](_0x31847a['serverUrl']);if(_0x2115d8&&_0x2115d8['monitor_format']){logger[_0xc7f9('0xc')](_0xc7f9('0x3d'),_0xc7f9('0x3e'));_0x1d03ec['recordingURL']=util[_0xc7f9('0x15')](_0xc7f9('0x3f'),_0x31847a[_0xc7f9('0x3c')],_0x1d03ec['uniqueid'],md5(_0x1d03ec[_0xc7f9('0x40')]));}else{_0x1d03ec[_0xc7f9('0x41')]='';}headers[_0xc7f9('0x42')]=getAuth(_0x31847a);return getUser(_0x31847a,_0x54796d['email'])[_0xc7f9('0x19')](function(_0x2e58bf){_0x55ad31=_0x2e58bf;logger[_0xc7f9('0xc')](_0xc7f9('0x43'),_0x55ad31['id']);return getEndUser(_0x31847a,_0x1d03ec[_0xc7f9('0x44')],_0x1d03ec[_0xc7f9('0xe')]);})[_0xc7f9('0x19')](function(_0x544fd3){_0x2b6ed4=_0x544fd3;logger['info'](_0xc7f9('0x45'),_0x2b6ed4['id']);return getTicket(_0x31847a,_0x55ad31,_0x2b6ed4,_0x5dc7d0,_0x1d03ec);})[_0xc7f9('0x19')](function(_0x36f0a1){if(_0x36f0a1&&_0x36f0a1['id']){logger[_0xc7f9('0xc')]('Ticket\x20created!');logger[_0xc7f9('0xc')](_0xc7f9('0x46'),_0x36f0a1['id']);logger[_0xc7f9('0xc')](_0xc7f9('0x3d'),_0xc7f9('0x47'));emit(util[_0xc7f9('0x15')](_0xc7f9('0x48'),_0x54796d[_0xc7f9('0x11')]),_0xc7f9('0x49'),{'uri':util[_0xc7f9('0x15')](_0xc7f9('0x4a'),_0x31847a[_0xc7f9('0x17')],_0x36f0a1['id'])});}})[_0xc7f9('0x4b')](function(_0x34f21a){logger[_0xc7f9('0x4c')](_0xc7f9('0x3d'),JSON[_0xc7f9('0x2b')](_0x34f21a));});};exports[_0xc7f9('0x4d')]=function(_0x18484e,_0xe9084a,_0x40cc6d,_0x40e899,_0x4130f4,_0x123d50,_0x5d5d55){var _0x123db8,_0x50390c;_0x123d50['remoteUri']=intUtil[_0xc7f9('0x3b')](_0x123d50[_0xc7f9('0x17')]);_0x123d50[_0xc7f9('0x3c')]=intUtil[_0xc7f9('0x3b')](_0x123d50[_0xc7f9('0x3c')]);if(_0x5d5d55&&_0x5d5d55[_0xc7f9('0x4e')]&&_0x5d5d55['recordingFormat']!=='none'){logger[_0xc7f9('0xc')]('[OUTBOUND]',_0xc7f9('0x3e'));_0xe9084a[_0xc7f9('0x41')]=util[_0xc7f9('0x15')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x123d50['serverUrl'],_0xe9084a['uniqueid'],md5(_0xe9084a[_0xc7f9('0x40')]));}headers[_0xc7f9('0x42')]=getAuth(_0x123d50);return getUser(_0x123d50,_0x40e899[_0xc7f9('0x1d')])['then'](function(_0xde550d){_0x123db8=_0xde550d;logger[_0xc7f9('0xc')](_0xc7f9('0x43'),_0x123db8['id']);return getEndUser(_0x123d50,_0xe9084a['destcalleridname'],_0xe9084a[_0xc7f9('0x4f')]);})[_0xc7f9('0x19')](function(_0x41a0fc){_0x50390c=_0x41a0fc;logger[_0xc7f9('0xc')](_0xc7f9('0x45'),_0x50390c['id']);return getTicket(_0x123d50,_0x123db8,_0x50390c,_0x40cc6d,_0xe9084a);})[_0xc7f9('0x19')](function(_0x181c7f){if(_0x181c7f&&_0x181c7f['id']){logger[_0xc7f9('0xc')](_0xc7f9('0x1a'));logger[_0xc7f9('0xc')]('The\x20Ticket\x20ID\x20is:',_0x181c7f['id']);logger['info'](_0xc7f9('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc7f9('0x15')]('user:%s',_0x40e899['name']),_0xc7f9('0x49'),{'uri':util[_0xc7f9('0x15')](_0xc7f9('0x4a'),_0x123d50[_0xc7f9('0x17')],_0x181c7f['id'])});}})[_0xc7f9('0x4b')](function(_0x3beb1f){logger[_0xc7f9('0x4c')](_0xc7f9('0x50'),JSON['stringify'](_0x3beb1f));});};exports[_0xc7f9('0x51')]=function(_0x2bd364,_0xe851b1,_0x538def,_0x52c7f3,_0xd26ca,_0x151504){var _0x56d015,_0xd46137;_0x151504[_0xc7f9('0x17')]=intUtil[_0xc7f9('0x3b')](_0x151504[_0xc7f9('0x17')]);_0x151504[_0xc7f9('0x3c')]=intUtil['stripTrailingSlash'](_0x151504['serverUrl']);if(_0xd26ca&&_0xd26ca[_0xc7f9('0x52')]){logger[_0xc7f9('0xc')]('['+_0xe851b1[_0xc7f9('0x53')][_0xc7f9('0x54')]()+']',_0xc7f9('0x3e'));_0xe851b1['recordingURL']=util[_0xc7f9('0x15')](_0xc7f9('0x3f'),_0x151504[_0xc7f9('0x3c')],_0xe851b1[_0xc7f9('0x40')],md5(_0xe851b1[_0xc7f9('0x40')]));}else{_0xe851b1[_0xc7f9('0x41')]='';}headers[_0xc7f9('0x42')]=getAuth(_0x151504);return getUser(_0x151504,'')[_0xc7f9('0x19')](function(_0x2e61bb){_0x56d015=_0x2e61bb;logger['info'](_0xc7f9('0x43'),_0x56d015['id']);return getEndUser(_0x151504,_0xe851b1[_0xc7f9('0x44')],_0xe851b1[_0xc7f9('0xe')]);})[_0xc7f9('0x19')](function(_0x9fbb5f){_0xd46137=_0x9fbb5f;logger[_0xc7f9('0xc')](_0xc7f9('0x45'),_0xd46137['id']);return getTicket(_0x151504,_0x56d015,_0xd46137,_0x538def,_0xe851b1);})['then'](function(_0x21aad1){if(_0x21aad1){logger[_0xc7f9('0xc')](_0xc7f9('0x1a'));logger[_0xc7f9('0xc')](_0xc7f9('0x46'),_0x21aad1['id']);}})[_0xc7f9('0x4b')](function(_0x2196e1){logger['error']('['+_0xe851b1['lastevent']['toUpperCase']()+']',JSON[_0xc7f9('0x2b')](_0x2196e1));});}; \ No newline at end of file +var _0xab4f=['length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','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','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents'];(function(_0x1de7a1,_0x5b5a17){var _0x55ef3c=function(_0x5cab4d){while(--_0x5cab4d){_0x1de7a1['push'](_0x1de7a1['shift']());}};_0x55ef3c(++_0x5b5a17);}(_0xab4f,0x9f));var _0xfab4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab4f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xfab4('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xfab4('0x1'));var Redis=require(_0xfab4('0x2'));var intUtil=require(_0xfab4('0x3'));var config=require(_0xfab4('0x4'));var logger=require(_0xfab4('0x5'))('freshdesk');config[_0xfab4('0x6')]=_[_0xfab4('0x7')](config['redis'],{'host':_0xfab4('0x8'),'port':0x18eb});var io=require(_0xfab4('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0xfab4('0xa'),'Accept':_0xfab4('0xa')};function emit(_0x5ca448,_0x59ecd8,_0x2931b2){io['to'](_0x5ca448)['emit'](_0x59ecd8,_0x2931b2);}function getTicket(_0x127732,_0x4233ab,_0x3961ba,_0x3e75d1,_0x1a0fdc){logger[_0xfab4('0xb')](_0xfab4('0xc'));var _0x2ae63c=_[_0xfab4('0xd')]({'responder_id':_0x4233ab['id'],'requester_id':_0x3961ba['id'],'name':util[_0xfab4('0xe')](_0xfab4('0xf'),_0x1a0fdc[_0xfab4('0x10')]),'phone':_0x1a0fdc[_0xfab4('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xfab4('0x12')](_0x3e75d1['Subjects'],_0x1a0fdc,'\x20'),'description':intUtil['getString'](_0x3e75d1['Descriptions'],_0x1a0fdc,_0xfab4('0x13')),'tags':getTags(_0x3e75d1[_0xfab4('0x14')],_0xfab4('0x15'))},getCustomFields(_0x3e75d1[_0xfab4('0x16')],_0x1a0fdc));_0x2ae63c[_0xfab4('0x17')]=_[_0xfab4('0x18')](_[_0xfab4('0x19')](_0x2ae63c[_0xfab4('0x17')],'id'),_0xfab4('0x1a'));return request({'uri':util['format']('%s/api/v2/tickets',_0x127732[_0xfab4('0x1b')]),'method':_0xfab4('0x1c'),'body':_0x2ae63c})[_0xfab4('0x1d')](function(_0x3ce32b){logger[_0xfab4('0xb')](_0xfab4('0x1e'));return _0x3ce32b;});}function getUser(_0x46ba61,_0x4be39e){if(intUtil[_0xfab4('0x1f')](_0x4be39e)){return request({'uri':util[_0xfab4('0xe')](_0xfab4('0x20'),_0x46ba61['remoteUri']),'qs':{'email':_0x4be39e}})['then'](function(_0x5a9535){if(_0x5a9535[_0xfab4('0x21')]){logger[_0xfab4('0xb')](_0xfab4('0x22'));return _[_0xfab4('0x23')](_0x5a9535,function(_0x28139b){return _0x28139b[_0xfab4('0x24')]['email']===_0x4be39e;});}else{logger[_0xfab4('0xb')](_0xfab4('0x25'));return request({'uri':util[_0xfab4('0xe')](_0xfab4('0x26'),_0x46ba61[_0xfab4('0x1b')])})[_0xfab4('0x1d')](function(_0x44c15a){logger[_0xfab4('0xb')]('Admin\x20account\x20selected.');return _0x44c15a;});}});}else{logger['info'](_0xfab4('0x27'));return request({'uri':util[_0xfab4('0xe')]('%s/api/v2/agents/me',_0x46ba61[_0xfab4('0x1b')])})[_0xfab4('0x1d')](function(_0x253ba9){logger[_0xfab4('0xb')]('Admin\x20account\x20selected.');return _0x253ba9;});}}function getEndUser(_0x1728c1,_0x21423d,_0x297b8d){logger[_0xfab4('0xb')](_0xfab4('0x28'),_0x297b8d);return request({'uri':util[_0xfab4('0xe')](_0xfab4('0x29'),_0x1728c1[_0xfab4('0x1b')]),'qs':{'phone':_0x297b8d}})[_0xfab4('0x1d')](function(_0x28b578){if(_0x28b578[_0xfab4('0x21')]){logger['info'](_0xfab4('0x2a'));return _[_0xfab4('0x23')](_0x28b578,{'phone':_0x297b8d});}else{logger[_0xfab4('0xb')](_0xfab4('0x2b'));return request({'uri':util[_0xfab4('0xe')](_0xfab4('0x29'),_0x1728c1[_0xfab4('0x1b')]),'method':_0xfab4('0x1c'),'body':{'name':_0x21423d,'phone':_0x297b8d}})[_0xfab4('0x1d')](function(_0x362409){logger[_0xfab4('0xb')](_0xfab4('0x2c'));return _0x362409;});}});}function getAuth(_0x1e8440){return util[_0xfab4('0xe')](_0xfab4('0x2d'),new Buffer(_0x1e8440[_0xfab4('0x2e')]+':X')[_0xfab4('0x2f')](_0xfab4('0x30')));}function request(_0x29fc68){logger[_0xfab4('0x31')](_0xfab4('0x32'),JSON[_0xfab4('0x33')](_0x29fc68));return rp(_['defaults'](_0x29fc68,{'method':_0xfab4('0x34'),'headers':headers,'json':!![]}));}function getTags(_0xeeb063,_0x34dd58){var _0x1a7261=[];if(_0xeeb063&&_0xeeb063[_0xfab4('0x21')]>0x0){_0x1a7261=_[_0xfab4('0x35')](_0xeeb063,_0x34dd58);}return _0x1a7261;}function getCustomFields(_0x433679,_0x2945a2){var _0x54668d=[];var _0x538813={'custom_fields':[]};if(_0x433679[_0xfab4('0x21')]>0x0){_[_0xfab4('0x36')](_0x433679,function(_0xb35f94){if(_[_0xfab4('0x37')]([_0xfab4('0x38'),_0xfab4('0x39')],_0xb35f94[_0xfab4('0x3a')])&&_0xb35f94[_0xfab4('0x3b')]&&!_0xb35f94[_0xfab4('0x3c')]){_0x538813[_0xb35f94[_0xfab4('0x3b')][_0xfab4('0x3d')]()]=_0xb35f94[_0xfab4('0x3e')][_0xfab4('0x2f')]();}else if(_[_0xfab4('0x37')]([_0xfab4('0x38'),_0xfab4('0x39')],_0xb35f94['type'])&&_0xb35f94[_0xfab4('0x3f')]&&_0xb35f94['customField']){_0x538813[_0xfab4('0x17')][_0xfab4('0x40')]({'id':_0xb35f94[_0xfab4('0x3f')],'value':_0xb35f94[_0xfab4('0x3e')][_0xfab4('0x2f')]()});}else if(_0xb35f94[_0xfab4('0x3a')]===_0xfab4('0x41')&&_0xb35f94[_0xfab4('0x42')]&&_0xb35f94[_0xfab4('0x3f')]&&_0xb35f94['customField']){_0x2945a2[_0xb35f94[_0xfab4('0x42')]]&&_0x538813[_0xfab4('0x17')][_0xfab4('0x40')]({'id':_0xb35f94[_0xfab4('0x3f')],'value':_0x2945a2[_0xb35f94[_0xfab4('0x42')]]['toString']()});}else if(_0xb35f94['type']==='customVariable'&&_0xb35f94[_0xfab4('0x43')]&&_0xb35f94[_0xfab4('0x43')][_0xfab4('0x15')]&&_0xb35f94[_0xfab4('0x3f')]&&_0xb35f94[_0xfab4('0x3c')]){_0x2945a2[_0xb35f94[_0xfab4('0x43')]['name'][_0xfab4('0x3d')]()]&&_0x538813[_0xfab4('0x17')][_0xfab4('0x40')]({'id':_0xb35f94['idField'],'value':_0x2945a2[_0xb35f94[_0xfab4('0x43')]['name'][_0xfab4('0x3d')]()]['toString']()});}});}return _0x538813;}exports[_0xfab4('0x44')]=function(_0x3d3bd3,_0x13ca58,_0xf0aa8d,_0x204851,_0x3b8289,_0xf7b089){var _0x8d6014,_0x388910;_0xf7b089[_0xfab4('0x1b')]=intUtil[_0xfab4('0x45')](_0xf7b089[_0xfab4('0x1b')]);_0xf7b089[_0xfab4('0x46')]=intUtil[_0xfab4('0x45')](_0xf7b089['serverUrl']);if(_0x3b8289&&_0x3b8289[_0xfab4('0x47')]){logger[_0xfab4('0xb')](_0xfab4('0x48'),_0xfab4('0x49'));_0x13ca58[_0xfab4('0x4a')]=util[_0xfab4('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xf7b089[_0xfab4('0x46')],_0x13ca58[_0xfab4('0x4b')],md5(_0x13ca58['uniqueid']));}else{_0x13ca58['recordingURL']='';}headers[_0xfab4('0x4c')]=getAuth(_0xf7b089);return getUser(_0xf7b089,_0x204851['email'])[_0xfab4('0x1d')](function(_0x5e3123){_0x8d6014=_0x5e3123;logger[_0xfab4('0xb')](_0xfab4('0x4d'),_0x8d6014['id']);return getEndUser(_0xf7b089,_0x13ca58[_0xfab4('0x10')],_0x13ca58[_0xfab4('0x11')]);})[_0xfab4('0x1d')](function(_0x1a88c0){_0x388910=_0x1a88c0;logger[_0xfab4('0xb')](_0xfab4('0x4e'),_0x388910['id']);return getTicket(_0xf7b089,_0x8d6014,_0x388910,_0xf0aa8d,_0x13ca58);})[_0xfab4('0x1d')](function(_0x42360a){if(_0x42360a&&_0x42360a['id']){logger[_0xfab4('0xb')](_0xfab4('0x1e'));logger[_0xfab4('0xb')](_0xfab4('0x4f'),_0x42360a['id']);logger[_0xfab4('0xb')]('[QUEUE]',_0xfab4('0x50'));emit(util[_0xfab4('0xe')](_0xfab4('0x51'),_0x204851[_0xfab4('0x15')]),_0xfab4('0x52'),{'uri':util[_0xfab4('0xe')](_0xfab4('0x53'),_0xf7b089['remoteUri'],_0x42360a['id'])});}})[_0xfab4('0x54')](function(_0x28c164){logger[_0xfab4('0x55')](_0xfab4('0x48'),JSON['stringify'](_0x28c164));});};exports[_0xfab4('0x56')]=function(_0x219b2b,_0x168ab4,_0x43bf5c,_0x596902,_0x2187c1,_0x1fe131,_0xf510a8){var _0x526b72,_0x170ce7;_0x1fe131[_0xfab4('0x1b')]=intUtil[_0xfab4('0x45')](_0x1fe131['remoteUri']);_0x1fe131['serverUrl']=intUtil['stripTrailingSlash'](_0x1fe131[_0xfab4('0x46')]);if(_0xf510a8&&_0xf510a8[_0xfab4('0x57')]&&_0xf510a8[_0xfab4('0x57')]!==_0xfab4('0x58')){logger['info'](_0xfab4('0x59'),_0xfab4('0x49'));_0x168ab4['recordingURL']=util[_0xfab4('0xe')](_0xfab4('0x5a'),_0x1fe131[_0xfab4('0x46')],_0x168ab4[_0xfab4('0x4b')],md5(_0x168ab4['uniqueid']));}headers[_0xfab4('0x4c')]=getAuth(_0x1fe131);return getUser(_0x1fe131,_0x596902[_0xfab4('0x5b')])[_0xfab4('0x1d')](function(_0x369da4){_0x526b72=_0x369da4;logger[_0xfab4('0xb')]('The\x20User\x20ID\x20is:',_0x526b72['id']);return getEndUser(_0x1fe131,_0x168ab4[_0xfab4('0x5c')],_0x168ab4['destcalleridnum']);})[_0xfab4('0x1d')](function(_0x440d09){_0x170ce7=_0x440d09;logger['info'](_0xfab4('0x4e'),_0x170ce7['id']);return getTicket(_0x1fe131,_0x526b72,_0x170ce7,_0x43bf5c,_0x168ab4);})['then'](function(_0x3b98a2){if(_0x3b98a2&&_0x3b98a2['id']){logger['info'](_0xfab4('0x1e'));logger[_0xfab4('0xb')]('The\x20Ticket\x20ID\x20is:',_0x3b98a2['id']);logger[_0xfab4('0xb')](_0xfab4('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfab4('0xe')](_0xfab4('0x51'),_0x596902[_0xfab4('0x15')]),_0xfab4('0x52'),{'uri':util[_0xfab4('0xe')]('%s/helpdesk/tickets/%d',_0x1fe131[_0xfab4('0x1b')],_0x3b98a2['id'])});}})[_0xfab4('0x54')](function(_0x2c29bb){logger[_0xfab4('0x55')](_0xfab4('0x59'),JSON[_0xfab4('0x33')](_0x2c29bb));});};exports[_0xfab4('0x5d')]=function(_0x11e1a,_0x522787,_0x3c8b0e,_0x18c18e,_0x594e1f,_0x565274){var _0x205756,_0x18dd42;_0x565274[_0xfab4('0x1b')]=intUtil[_0xfab4('0x45')](_0x565274[_0xfab4('0x1b')]);_0x565274[_0xfab4('0x46')]=intUtil[_0xfab4('0x45')](_0x565274[_0xfab4('0x46')]);if(_0x594e1f&&_0x594e1f[_0xfab4('0x47')]){logger[_0xfab4('0xb')]('['+_0x522787[_0xfab4('0x5e')][_0xfab4('0x5f')]()+']',_0xfab4('0x49'));_0x522787['recordingURL']=util['format'](_0xfab4('0x5a'),_0x565274[_0xfab4('0x46')],_0x522787['uniqueid'],md5(_0x522787['uniqueid']));}else{_0x522787[_0xfab4('0x4a')]='';}headers['Authorization']=getAuth(_0x565274);return getUser(_0x565274,'')[_0xfab4('0x1d')](function(_0xa6b0a2){_0x205756=_0xa6b0a2;logger[_0xfab4('0xb')]('The\x20User\x20ID\x20is:',_0x205756['id']);return getEndUser(_0x565274,_0x522787['calleridname'],_0x522787[_0xfab4('0x11')]);})[_0xfab4('0x1d')](function(_0x112487){_0x18dd42=_0x112487;logger[_0xfab4('0xb')](_0xfab4('0x4e'),_0x18dd42['id']);return getTicket(_0x565274,_0x205756,_0x18dd42,_0x3c8b0e,_0x522787);})[_0xfab4('0x1d')](function(_0x243599){if(_0x243599){logger['info']('Ticket\x20created!');logger['info'](_0xfab4('0x4f'),_0x243599['id']);}})['catch'](function(_0x2da996){logger[_0xfab4('0x55')]('['+_0x522787[_0xfab4('0x5e')]['toUpperCase']()+']',JSON[_0xfab4('0x33')](_0x2da996));});}; \ 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 d51cac6..3b08230 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 _0x67a1=['mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','YYYY-MM-DDTHH:mm:ss','ticketId','Task\x20created:','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','then','agentEmail','userEmail','userId','User\x20found:','adminId','error','/api/lookup?q=','&f=','find','contacts','format','contactNumber'];(function(_0x331f63,_0x5a8334){var _0xf5206c=function(_0x44394d){while(--_0x44394d){_0x331f63['push'](_0x331f63['shift']());}};_0xf5206c(++_0x5a8334);}(_0x67a1,0xcb));var _0x167a=function(_0x5439f0,_0x147ad1){_0x5439f0=_0x5439f0-0x0;var _0x511487=_0x67a1[_0x5439f0];return _0x511487;};'use strict';var _=require(_0x167a('0x0'));var rp=require(_0x167a('0x1'));var md5=require(_0x167a('0x2'));var util=require('util');var moment=require('moment');var Promise=require(_0x167a('0x3'));var Redis=require(_0x167a('0x4'));var intUtil=require(_0x167a('0x5'));var config=require(_0x167a('0x6'));var logger=require(_0x167a('0x7'))('freshsales');config[_0x167a('0x8')]=_[_0x167a('0x9')](config[_0x167a('0x8')],{'host':_0x167a('0xa'),'port':0x18eb});var io=require(_0x167a('0xb'))(new Redis(config[_0x167a('0x8')]));function getAdminId(_0xf653ae,_0x2d7fd0,_0x19d6c8,_0x2010e0){return new Promise(function(_0x34452a,_0x3541d3){var _0x21b7b9=![];var _0x51e4fc={'method':_0x167a('0xc'),'uri':_0x2010e0+'/api/selector/owners','json':!![]};_0x51e4fc[_0x167a('0xd')]=_0x19d6c8;logger[_0x167a('0xe')](_0x167a('0xf'));return rp(_0x51e4fc)['then'](function(_0x2d5bfe){if(_0x2d5bfe){var _0x44e30d=_0x2d5bfe[_0x167a('0x10')];var _0x1a088a=null;for(_0x1a088a=0x0;_0x1a088a<_0x44e30d[_0x167a('0x11')];_0x1a088a++){if(_0x44e30d[_0x1a088a][_0x167a('0x12')]===_0xf653ae[_0x167a('0x13')]){_0xf653ae['adminId']=_0x44e30d[_0x1a088a]['id'];_0x21b7b9=!![];}}if(_0x21b7b9){logger['info'](_0x167a('0x14'),_0xf653ae['adminId']);_0x34452a(_0xf653ae);}else{_0x3541d3({'statusCode':0x194,'message':_0x167a('0x15')});}}else{_0x3541d3({'statusCode':0x194,'message':_0x167a('0x15')});}})[_0x167a('0x16')](function(_0x600405){logger['error']('['+[_0x2d7fd0[_0x167a('0x17')]()]+']',_0x600405[_0x167a('0x18')]);_0x3541d3(_0x600405);});});}function getUser(_0x1a86f4,_0x44d57c,_0x3e74d0){return function(_0x346f26){return new Promise(function(_0x27c92b,_0x2bbed5){var _0x59f5cc={'method':_0x167a('0xc'),'uri':_0x3e74d0+_0x167a('0x19'),'json':!![]};_0x59f5cc[_0x167a('0xd')]=_0x44d57c;logger[_0x167a('0xe')](_0x167a('0x1a'));return rp(_0x59f5cc)[_0x167a('0x1b')](function(_0x2edb85){if(_0x2edb85){var _0x47c39a=_0x2edb85[_0x167a('0x10')];var _0xb42b3=![];var _0xd3bbcb=null;if(_0x346f26['agentEmail']!==null){logger[_0x167a('0xe')]('Getting\x20user\x20with\x20email',_0x346f26[_0x167a('0x1c')]);_0x346f26[_0x167a('0x1d')]=_0x346f26[_0x167a('0x1c')];for(_0xd3bbcb=0x0;_0xd3bbcb<_0x47c39a[_0x167a('0x11')];_0xd3bbcb++){if(_0x47c39a[_0xd3bbcb]['email']===_0x346f26['agentEmail']){_0xb42b3=!![];_0x346f26[_0x167a('0x1e')]=_0x47c39a[_0xd3bbcb]['id'];logger[_0x167a('0xe')](_0x167a('0x1f'),_0x346f26['userId']);}}}if(!_0xb42b3){logger[_0x167a('0xe')]('Admin\x20selected');_0x346f26[_0x167a('0x1d')]=_0x346f26[_0x167a('0x13')];_0x346f26[_0x167a('0x1e')]=_0x346f26[_0x167a('0x20')];_0xb42b3=!![];}if(_0xb42b3){_0x27c92b(_0x346f26);}else{_0x2bbed5({'statusCode':0x194,'message':_0x167a('0x15')});}}else{_0x2bbed5({'statusCode':0x194,'message':_0x167a('0x15')});}})[_0x167a('0x16')](function(_0x9dfcf9){logger[_0x167a('0x21')]('['+[_0x1a86f4[_0x167a('0x17')]()]+']',_0x9dfcf9[_0x167a('0x18')]);_0x2bbed5(_0x9dfcf9);});});};}function searchContact(_0x50bf3f,_0x2ffc68,_0x3c6e1e,_0x361b33){return new Promise(function(_0x1d8961,_0x2857b5){var _0x59b34b={'method':'GET','headers':_0x2ffc68,'uri':_0x50bf3f+_0x167a('0x22')+_0x361b33+_0x167a('0x23')+_0x3c6e1e+'&entities=contact','json':!![]};rp(_0x59b34b)[_0x167a('0x1b')](function(_0x25b936){var _0x42a262=_[_0x167a('0x24')](_0x25b936[_0x167a('0x25')][_0x167a('0x25')],[_0x3c6e1e,_0x361b33]);_0x1d8961(_0x42a262);})[_0x167a('0x16')](function(_0x23fc80){_0x2857b5(_0x23fc80);});});}function getEndUser(_0x342a68,_0x3042ac,_0x10d806){return function(_0x2f6b06){return new Promise(function(_0x2e83f4,_0x1ed297){logger[_0x167a('0xe')](util[_0x167a('0x26')]('Searching\x20contact\x20with\x20phone\x20%s',_0x2f6b06[_0x167a('0x27')]));searchContact(_0x10d806,_0x3042ac,_0x167a('0x28'),_0x2f6b06[_0x167a('0x27')])[_0x167a('0x1b')](function(_0x11739c){if(_0x11739c){_0x2f6b06[_0x167a('0x29')]=_0x11739c['id'];logger[_0x167a('0xe')](_0x167a('0x2a'),_0x2f6b06['endUserId']);return _0x2e83f4(_0x2f6b06);}searchContact(_0x10d806,_0x3042ac,'work_number',_0x2f6b06[_0x167a('0x27')])[_0x167a('0x1b')](function(_0x7cb4fe){if(_0x7cb4fe){_0x2f6b06[_0x167a('0x29')]=_0x7cb4fe['id'];logger[_0x167a('0xe')](_0x167a('0x2b'),_0x2f6b06[_0x167a('0x29')]);return _0x2e83f4(_0x2f6b06);}createEndUser(_0x2f6b06,_0x342a68,_0x3042ac,_0x10d806)[_0x167a('0x1b')](function(_0x54a47d){logger[_0x167a('0xe')](_0x167a('0x2c'),_0x54a47d[_0x167a('0x29')]);return _0x2e83f4(_0x54a47d);});});})[_0x167a('0x16')](function(_0x389258){_0x1ed297(_0x389258);});});};}function createEndUser(_0x1328d5,_0x1fa74c,_0x227b0a,_0x34b14d){return new Promise(function(_0xd94a88,_0x5d5837){var _0x192f6f=moment();var _0x234d3b={'method':'POST','uri':_0x34b14d+'/api/contacts','body':{'contact':{'last_name':_0x1328d5[_0x167a('0x27')],'work_number':_0x1328d5['contactNumber'],'mobile_number':_0x1328d5[_0x167a('0x27')],'owner_id':_0x1328d5[_0x167a('0x1e')],'created_at':_0x192f6f['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x234d3b[_0x167a('0xd')]=_0x227b0a;logger[_0x167a('0xe')](_0x167a('0x2d'));return rp(_0x234d3b)[_0x167a('0x1b')](function(_0x49b572){_0x1328d5[_0x167a('0x29')]=_0x49b572[_0x167a('0x2e')]['id'];_0xd94a88(_0x1328d5);})[_0x167a('0x16')](function(_0x541f4d){logger[_0x167a('0x21')]('['+[_0x1fa74c[_0x167a('0x17')]()]+']',_0x541f4d[_0x167a('0x18')]);_0x5d5837(_0x541f4d['message']);});});}function getTicket(_0x2c7f11,_0x1be359,_0x23c98a,_0x2bc338,_0x3ce499){return function(_0x45e7ed){logger['info'](_0x167a('0x2f'));return new Promise(function(_0xfa58e4,_0xb0940){var _0x25f34e=moment();var _0x1c5fa6={'method':_0x167a('0x30'),'uri':_0x23c98a+_0x167a('0x31'),'body':{'title':intUtil['getString'](_0x2bc338['Subjects'],_0x3ce499,'\x20'),'description':intUtil[_0x167a('0x32')](_0x2bc338['Descriptions'],_0x3ce499,'\x0a'),'owner_id':_0x45e7ed[_0x167a('0x1e')],'creater_id':_0x45e7ed['adminId'],'targetable_id':_0x45e7ed['endUserId'],'targetable_type':'Contact','created_at':_0x25f34e[_0x167a('0x26')](_0x167a('0x33')),'due_date':_0x25f34e['add'](0x1e,'m')['format'](_0x167a('0x33'))},'json':!![]};_0x1c5fa6[_0x167a('0xd')]=_0x1be359;return rp(_0x1c5fa6)[_0x167a('0x1b')](function(_0x4ed8a8){_0x45e7ed[_0x167a('0x34')]=_0x4ed8a8['task']['id'];logger['info'](_0x167a('0x35'),_0x45e7ed[_0x167a('0x34')]);_0xfa58e4(_0x45e7ed);})[_0x167a('0x16')](function(_0x2baff9){logger[_0x167a('0x21')]('['+[_0x2c7f11[_0x167a('0x17')]()]+']',_0x2baff9['message']);_0xb0940(_0x2baff9[_0x167a('0x18')]);});});};}function emit(_0x3ae7ee,_0xe64242,_0x2c3585){var _0x494c9e={'uri':_0x3ae7ee+_0x167a('0x36')+_0x2c3585};io['to'](util[_0x167a('0x26')](_0x167a('0x37'),_0xe64242))[_0x167a('0x38')]('trigger:browser:url',_0x494c9e);}exports['cs']=function(_0x5ca5e1,_0x31c327,_0x1a648c,_0x30f356,_0x817f37,_0x5fd851,_0x523713,_0x3252f6){var _0x420d46={};var _0xd2b29a={'Authorization':_0x167a('0x39')+_0x5fd851[_0x167a('0x3a')]};_0x5fd851[_0x167a('0x3b')]=intUtil[_0x167a('0x3c')](_0x5fd851['remoteUri']);_0x5fd851[_0x167a('0x3d')]=intUtil[_0x167a('0x3c')](_0x5fd851[_0x167a('0x3d')]);var _0x4e1e13=_0x5fd851[_0x167a('0x3b')];_0x420d46['adminEmail']=_0x5fd851[_0x167a('0x3e')];_0x420d46[_0x167a('0x27')]=_0x3252f6[_0x167a('0x3f')]()===_0x167a('0x40')?_0x31c327['destcalleridnum']:_0x31c327['calleridnum'];_0x420d46[_0x167a('0x41')]=_0x3252f6==='queue'||_0x3252f6===_0x167a('0x42')?_0x167a('0x43'):_0x167a('0x40');if(_0x30f356){_0x420d46[_0x167a('0x1c')]=_0x30f356[_0x167a('0x12')];}var _0x479790=util[_0x167a('0x26')](_0x167a('0x44'),_0x5fd851[_0x167a('0x3d')],_0x31c327[_0x167a('0x45')],md5(_0x31c327[_0x167a('0x45')]));if(_0x817f37&&_0x817f37[_0x167a('0x46')]){logger[_0x167a('0xe')](_0x167a('0x47'),_0x167a('0x48'));_0x31c327[_0x167a('0x49')]=_0x479790;}else if(_0x523713&&_0x523713['recordingFormat']&&_0x523713[_0x167a('0x4a')]!=='none'){logger[_0x167a('0xe')](_0x167a('0x4b'),'Recording\x20is\x20enabled!');_0x31c327[_0x167a('0x49')]=_0x479790;}else{_0x31c327[_0x167a('0x49')]='';}return getAdminId(_0x420d46,_0x3252f6,_0xd2b29a,_0x4e1e13)[_0x167a('0x1b')](getUser(_0x3252f6,_0xd2b29a,_0x4e1e13))[_0x167a('0x1b')](getEndUser(_0x3252f6,_0xd2b29a,_0x4e1e13))['then'](getTicket(_0x3252f6,_0xd2b29a,_0x4e1e13,_0x1a648c,_0x31c327))['then'](function(_0x820267){logger[_0x167a('0xe')](util[_0x167a('0x26')](_0x167a('0x4c'),_0x820267['ticketId']));if(_0x3252f6!==_0x167a('0x42')){logger[_0x167a('0xe')]('['+[_0x3252f6[_0x167a('0x17')]()]+']',_0x167a('0x4d'));emit(_0x4e1e13,_0x30f356[_0x167a('0x4e')],_0x820267['endUserId']);}})[_0x167a('0x16')](function(_0x2091af){logger[_0x167a('0x21')]('['+[_0x3252f6[_0x167a('0x17')]()]+_0x167a('0x4f'),util[_0x167a('0x50')](_0x2091af,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4218=['bluebird','freshsales','redis','localhost','GET','/api/selector/owners','headers','users','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','info','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','agentEmail','userEmail','length','userId','User\x20found:','adminEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','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','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','user:%s','trigger:browser:url','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','md5','util'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x4218,0x9f));var _0x8421=function(_0xb4867e,_0x1ff91f){_0xb4867e=_0xb4867e-0x0;var _0x11148c=_0x4218[_0xb4867e];return _0x11148c;};'use strict';var _=require(_0x8421('0x0'));var rp=require('request-promise');var md5=require(_0x8421('0x1'));var util=require(_0x8421('0x2'));var moment=require('moment');var Promise=require(_0x8421('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x8421('0x4'));config[_0x8421('0x5')]=_['defaults'](config[_0x8421('0x5')],{'host':_0x8421('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8421('0x5')]));function getAdminId(_0xe60e3c,_0x4bc635,_0x53deeb,_0x377baf){return new Promise(function(_0x276309,_0x4d1460){var _0x578c3f=![];var _0x5e34b3={'method':_0x8421('0x7'),'uri':_0x377baf+_0x8421('0x8'),'json':!![]};_0x5e34b3[_0x8421('0x9')]=_0x53deeb;logger['info']('Getting\x20admin\x20information');return rp(_0x5e34b3)['then'](function(_0x6e5136){if(_0x6e5136){var _0x43eff0=_0x6e5136[_0x8421('0xa')];var _0x1f654c=null;for(_0x1f654c=0x0;_0x1f654c<_0x43eff0['length'];_0x1f654c++){if(_0x43eff0[_0x1f654c][_0x8421('0xb')]===_0xe60e3c['adminEmail']){_0xe60e3c[_0x8421('0xc')]=_0x43eff0[_0x1f654c]['id'];_0x578c3f=!![];}}if(_0x578c3f){logger['info'](_0x8421('0xd'),_0xe60e3c[_0x8421('0xc')]);_0x276309(_0xe60e3c);}else{_0x4d1460({'statusCode':0x194,'message':_0x8421('0xe')});}}else{_0x4d1460({'statusCode':0x194,'message':_0x8421('0xe')});}})[_0x8421('0xf')](function(_0x1f80f){logger[_0x8421('0x10')]('['+[_0x4bc635[_0x8421('0x11')]()]+']',_0x1f80f[_0x8421('0x12')]);_0x4d1460(_0x1f80f);});});}function getUser(_0xa8324,_0x1da638,_0x1bcd3a){return function(_0x15fb44){return new Promise(function(_0x435ba6,_0x2f69f4){var _0x3d0659={'method':_0x8421('0x7'),'uri':_0x1bcd3a+_0x8421('0x8'),'json':!![]};_0x3d0659['headers']=_0x1da638;logger[_0x8421('0x13')](_0x8421('0x14'));return rp(_0x3d0659)[_0x8421('0x15')](function(_0x72340c){if(_0x72340c){var _0x540688=_0x72340c[_0x8421('0xa')];var _0x5063ae=![];var _0x1ade11=null;if(_0x15fb44['agentEmail']!==null){logger[_0x8421('0x13')](_0x8421('0x16'),_0x15fb44[_0x8421('0x17')]);_0x15fb44[_0x8421('0x18')]=_0x15fb44[_0x8421('0x17')];for(_0x1ade11=0x0;_0x1ade11<_0x540688[_0x8421('0x19')];_0x1ade11++){if(_0x540688[_0x1ade11][_0x8421('0xb')]===_0x15fb44['agentEmail']){_0x5063ae=!![];_0x15fb44[_0x8421('0x1a')]=_0x540688[_0x1ade11]['id'];logger[_0x8421('0x13')](_0x8421('0x1b'),_0x15fb44[_0x8421('0x1a')]);}}}if(!_0x5063ae){logger[_0x8421('0x13')]('Admin\x20selected');_0x15fb44['userEmail']=_0x15fb44[_0x8421('0x1c')];_0x15fb44[_0x8421('0x1a')]=_0x15fb44[_0x8421('0xc')];_0x5063ae=!![];}if(_0x5063ae){_0x435ba6(_0x15fb44);}else{_0x2f69f4({'statusCode':0x194,'message':_0x8421('0xe')});}}else{_0x2f69f4({'statusCode':0x194,'message':_0x8421('0xe')});}})[_0x8421('0xf')](function(_0x57bc89){logger[_0x8421('0x10')]('['+[_0xa8324[_0x8421('0x11')]()]+']',_0x57bc89[_0x8421('0x12')]);_0x2f69f4(_0x57bc89);});});};}function searchContact(_0x25822c,_0x4f36b9,_0x2691b9,_0x5172c4){return new Promise(function(_0xf86732,_0xc0b201){var _0x40403c={'method':'GET','headers':_0x4f36b9,'uri':_0x25822c+_0x8421('0x1d')+_0x5172c4+_0x8421('0x1e')+_0x2691b9+_0x8421('0x1f'),'json':!![]};rp(_0x40403c)[_0x8421('0x15')](function(_0x1dc9e5){var _0x376d56=_[_0x8421('0x20')](_0x1dc9e5[_0x8421('0x21')][_0x8421('0x21')],[_0x2691b9,_0x5172c4]);_0xf86732(_0x376d56);})['catch'](function(_0xbdb7bf){_0xc0b201(_0xbdb7bf);});});}function getEndUser(_0x1b1df,_0x4809b8,_0x42d0cf){return function(_0x2e5f31){return new Promise(function(_0x3cbec8,_0x1b3184){logger[_0x8421('0x13')](util[_0x8421('0x22')]('Searching\x20contact\x20with\x20phone\x20%s',_0x2e5f31[_0x8421('0x23')]));searchContact(_0x42d0cf,_0x4809b8,_0x8421('0x24'),_0x2e5f31[_0x8421('0x23')])[_0x8421('0x15')](function(_0x46bebe){if(_0x46bebe){_0x2e5f31[_0x8421('0x25')]=_0x46bebe['id'];logger[_0x8421('0x13')](_0x8421('0x26'),_0x2e5f31[_0x8421('0x25')]);return _0x3cbec8(_0x2e5f31);}searchContact(_0x42d0cf,_0x4809b8,_0x8421('0x27'),_0x2e5f31[_0x8421('0x23')])['then'](function(_0x2e9e12){if(_0x2e9e12){_0x2e5f31[_0x8421('0x25')]=_0x2e9e12['id'];logger[_0x8421('0x13')](_0x8421('0x28'),_0x2e5f31['endUserId']);return _0x3cbec8(_0x2e5f31);}createEndUser(_0x2e5f31,_0x1b1df,_0x4809b8,_0x42d0cf)[_0x8421('0x15')](function(_0x4633b1){logger[_0x8421('0x13')](_0x8421('0x29'),_0x4633b1[_0x8421('0x25')]);return _0x3cbec8(_0x4633b1);});});})[_0x8421('0xf')](function(_0x44860a){_0x1b3184(_0x44860a);});});};}function createEndUser(_0x2a3983,_0x3b8322,_0x58b359,_0x1a4bba){return new Promise(function(_0x48b7c7,_0x38e0de){var _0x4b714a=moment();var _0x3b5586={'method':_0x8421('0x2a'),'uri':_0x1a4bba+_0x8421('0x2b'),'body':{'contact':{'last_name':_0x2a3983[_0x8421('0x23')],'work_number':_0x2a3983[_0x8421('0x23')],'mobile_number':_0x2a3983[_0x8421('0x23')],'owner_id':_0x2a3983[_0x8421('0x1a')],'created_at':_0x4b714a[_0x8421('0x22')](_0x8421('0x2c'))}},'json':!![]};_0x3b5586['headers']=_0x58b359;logger[_0x8421('0x13')](_0x8421('0x2d'));return rp(_0x3b5586)['then'](function(_0x481c41){_0x2a3983['endUserId']=_0x481c41['contact']['id'];_0x48b7c7(_0x2a3983);})[_0x8421('0xf')](function(_0x15f36a){logger['error']('['+[_0x3b8322['toUpperCase']()]+']',_0x15f36a['message']);_0x38e0de(_0x15f36a['message']);});});}function getTicket(_0x5786eb,_0x1b70da,_0x28dafd,_0x73eee2,_0xf212b1){return function(_0x30060d){logger[_0x8421('0x13')](_0x8421('0x2e'));return new Promise(function(_0x2cb477,_0xdb3f83){var _0x235ef3=moment();var _0x379a45={'method':_0x8421('0x2a'),'uri':_0x28dafd+_0x8421('0x2f'),'body':{'title':intUtil[_0x8421('0x30')](_0x73eee2[_0x8421('0x31')],_0xf212b1,'\x20'),'description':intUtil[_0x8421('0x30')](_0x73eee2[_0x8421('0x32')],_0xf212b1,'\x0a'),'owner_id':_0x30060d[_0x8421('0x1a')],'creater_id':_0x30060d['adminId'],'targetable_id':_0x30060d['endUserId'],'targetable_type':'Contact','created_at':_0x235ef3[_0x8421('0x22')](_0x8421('0x2c')),'due_date':_0x235ef3[_0x8421('0x33')](0x1e,'m')[_0x8421('0x22')](_0x8421('0x2c'))},'json':!![]};_0x379a45[_0x8421('0x9')]=_0x1b70da;return rp(_0x379a45)[_0x8421('0x15')](function(_0x3673f8){_0x30060d[_0x8421('0x34')]=_0x3673f8[_0x8421('0x35')]['id'];logger[_0x8421('0x13')](_0x8421('0x36'),_0x30060d[_0x8421('0x34')]);_0x2cb477(_0x30060d);})[_0x8421('0xf')](function(_0x1e5ffc){logger['error']('['+[_0x5786eb[_0x8421('0x11')]()]+']',_0x1e5ffc[_0x8421('0x12')]);_0xdb3f83(_0x1e5ffc[_0x8421('0x12')]);});});};}function emit(_0x44e676,_0x571246,_0x5748be){var _0x2dc163={'uri':_0x44e676+'/contacts/'+_0x5748be};io['to'](util[_0x8421('0x22')](_0x8421('0x37'),_0x571246))['emit'](_0x8421('0x38'),_0x2dc163);}exports['cs']=function(_0x96fb86,_0x551f8a,_0x19e51b,_0x154cbf,_0x3b9d60,_0xaab9d8,_0x40b374,_0x4d4804){var _0x1057b0={};var _0x40a4a8={'Authorization':'Token\x20token='+_0xaab9d8[_0x8421('0x39')]};_0xaab9d8['remoteUri']=intUtil[_0x8421('0x3a')](_0xaab9d8[_0x8421('0x3b')]);_0xaab9d8[_0x8421('0x3c')]=intUtil[_0x8421('0x3a')](_0xaab9d8[_0x8421('0x3c')]);var _0x5eabd6=_0xaab9d8[_0x8421('0x3b')];_0x1057b0[_0x8421('0x1c')]=_0xaab9d8[_0x8421('0x3d')];_0x1057b0['contactNumber']=_0x4d4804[_0x8421('0x3e')]()===_0x8421('0x3f')?_0x551f8a[_0x8421('0x40')]:_0x551f8a[_0x8421('0x41')];_0x1057b0[_0x8421('0x42')]=_0x4d4804===_0x8421('0x43')||_0x4d4804===_0x8421('0x44')?_0x8421('0x43'):'outbound';if(_0x154cbf){_0x1057b0[_0x8421('0x17')]=_0x154cbf[_0x8421('0xb')];}var _0x3f9786=util[_0x8421('0x22')](_0x8421('0x45'),_0xaab9d8[_0x8421('0x3c')],_0x551f8a[_0x8421('0x46')],md5(_0x551f8a[_0x8421('0x46')]));if(_0x3b9d60&&_0x3b9d60[_0x8421('0x47')]){logger[_0x8421('0x13')](_0x8421('0x48'),'Recording\x20is\x20enabled!');_0x551f8a[_0x8421('0x49')]=_0x3f9786;}else if(_0x40b374&&_0x40b374[_0x8421('0x4a')]&&_0x40b374[_0x8421('0x4a')]!==_0x8421('0x4b')){logger['info'](_0x8421('0x4c'),_0x8421('0x4d'));_0x551f8a['recordingURL']=_0x3f9786;}else{_0x551f8a['recordingURL']='';}return getAdminId(_0x1057b0,_0x4d4804,_0x40a4a8,_0x5eabd6)['then'](getUser(_0x4d4804,_0x40a4a8,_0x5eabd6))[_0x8421('0x15')](getEndUser(_0x4d4804,_0x40a4a8,_0x5eabd6))[_0x8421('0x15')](getTicket(_0x4d4804,_0x40a4a8,_0x5eabd6,_0x19e51b,_0x551f8a))[_0x8421('0x15')](function(_0x1a5e1a){logger['info'](util[_0x8421('0x22')](_0x8421('0x4e'),_0x1a5e1a[_0x8421('0x34')]));if(_0x4d4804!=='unmanaged'){logger[_0x8421('0x13')]('['+[_0x4d4804['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x5eabd6,_0x154cbf[_0x8421('0x4f')],_0x1a5e1a['endUserId']);}})['catch'](function(_0x450a9c){logger[_0x8421('0x10')]('['+[_0x4d4804[_0x8421('0x11')]()]+_0x8421('0x50'),util['inspect'](_0x450a9c,{'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 3731339..3a2f6d5 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 _0x478d=['servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','zendesk','salesforce','sugarcrm','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','freshdesk','zoho','desk','vtiger','dynamics365','freshsales'];(function(_0x53ef20,_0x10b385){var _0x5576df=function(_0x5c5e1f){while(--_0x5c5e1f){_0x53ef20['push'](_0x53ef20['shift']());}};_0x5576df(++_0x10b385);}(_0x478d,0x8c));var _0xd478=function(_0x3524ed,_0x49ae70){_0x3524ed=_0x3524ed-0x0;var _0x2bdd5f=_0x478d[_0x3524ed];return _0x2bdd5f;};'use strict';var _=require(_0xd478('0x0'));var util=require(_0xd478('0x1'));var zendesk=require(_0xd478('0x2'));var salesforce=require(_0xd478('0x3'));var sugarcrm=require(_0xd478('0x4'));var freshdesk=require(_0xd478('0x5'));var zoho=require(_0xd478('0x6'));var desk=require(_0xd478('0x7'));var vtiger=require(_0xd478('0x8'));var servicenow=require('./servicenow');var dynamics365=require(_0xd478('0x9'));var freshsales=require('./freshsales');var integrations=['zendesk','salesforce','sugarcrm',_0xd478('0xa'),_0xd478('0xb'),_0xd478('0xc'),_0xd478('0xd'),_0xd478('0xe'),_0xd478('0xf'),_0xd478('0x10')];exports[_0xd478('0x11')]=function(_0x14beaa,_0x4e5b47,_0x574351,_0x5749f5,_0x37764b,_0x1f8113){if(_0x574351){if(_[_0xd478('0x12')](integrations,_0x14beaa[_0xd478('0x13')][_0xd478('0x14')]())){try{var _0x49296f=null;var _0x1612d7='';var _0x2104ca=_0x574351[_0x14beaa[_0xd478('0x13')]['toLowerCase']()];if(_0x2104ca){var _0x8a5be1=_0x2104ca[_0x14beaa[_0xd478('0x15')]];if(_0x8a5be1){var _0x4110e3=_[_0xd478('0x16')](_0x8a5be1[_0xd478('0x17')],{'id':parseInt(_0x14beaa['data3'],0xa)});if(_0x4110e3){if(_0x5749f5){if(_0x37764b&&_0x4e5b47['queue']){_0x1612d7=_0xd478('0x18');}else if(_0x4e5b47[_0xd478('0x19')]){_0x1612d7='outbound';}else{console[_0xd478('0x1a')](_0xd478('0x1b'),_0x4e5b47);}}else{_0x1612d7=_0xd478('0x1c');}switch(_0x14beaa[_0xd478('0x13')][_0xd478('0x14')]()){case _0xd478('0x1d'):zendesk[_0x1612d7](_0x14beaa,_0x4e5b47,_0x4110e3,_0x5749f5,_0x37764b,_0x8a5be1,_0x1f8113);break;case _0xd478('0x1e'):salesforce[_0x1612d7](_0x14beaa,_0x4e5b47,_0x4110e3,_0x5749f5,_0x37764b,_0x8a5be1,_0x1f8113);break;case _0xd478('0x1f'):sugarcrm[_0x1612d7](_0x14beaa,_0x4e5b47,_0x4110e3,_0x5749f5,_0x37764b,_0x8a5be1,_0x1f8113);break;case _0xd478('0xa'):freshdesk[_0x1612d7](_0x14beaa,_0x4e5b47,_0x4110e3,_0x5749f5,_0x37764b,_0x8a5be1,_0x1f8113);break;case _0xd478('0xb'):zoho[_0x1612d7](_0x14beaa,_0x4e5b47,_0x4110e3,_0x5749f5,_0x37764b,_0x8a5be1,_0x1f8113);break;case _0xd478('0xc'):desk[_0x1612d7](_0x14beaa,_0x4e5b47,_0x4110e3,_0x5749f5,_0x37764b,_0x8a5be1,_0x1f8113);break;case'vtiger':vtiger[_0x1612d7](_0x14beaa,_0x4e5b47,_0x4110e3,_0x5749f5,_0x37764b,_0x8a5be1,_0x1f8113);break;case'freshsales':freshsales['cs'](_0x14beaa,_0x4e5b47,_0x4110e3,_0x5749f5,_0x37764b,_0x8a5be1,_0x1f8113,_0x1612d7);break;case _0xd478('0x10'):servicenow['cs'](_0x14beaa,_0x4e5b47,_0x4110e3,_0x5749f5,_0x37764b,_0x8a5be1,_0x1f8113,_0x1612d7);break;case'dynamics365':dynamics365['cs'](_0x14beaa,_0x4e5b47,_0x4110e3,_0x5749f5,_0x37764b,_0x8a5be1,_0x1f8113,_0x1612d7);break;default:console[_0xd478('0x1a')]('unknown\x20integration');}}else{_0x49296f=require(_0xd478('0x20'))(_0x14beaa['data1'][_0xd478('0x14')]());_0x49296f[_0xd478('0x21')](_0xd478('0x22'),util[_0xd478('0x23')](_0xd478('0x24'),_0x14beaa[_0xd478('0x13')][_0xd478('0x14')](),_0x14beaa[_0xd478('0x25')]));}}else{_0x49296f=require(_0xd478('0x20'))(_0x14beaa[_0xd478('0x13')]['toLowerCase']());_0x49296f['error'](_0xd478('0x22'),util[_0xd478('0x23')](_0xd478('0x26'),_0x14beaa[_0xd478('0x13')][_0xd478('0x14')](),_0x14beaa[_0xd478('0x15')]));}}else{}}catch(_0x13be76){console['error'](_0x13be76);}}}}; \ No newline at end of file +var _0x6c09=['servicenow','includes','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','log','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','./salesforce','./sugarcrm','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales'];(function(_0x594543,_0x36aba0){var _0x32d072=function(_0x16b46d){while(--_0x16b46d){_0x594543['push'](_0x594543['shift']());}};_0x32d072(++_0x36aba0);}(_0x6c09,0x1ad));var _0x96c0=function(_0x352fec,_0x472355){_0x352fec=_0x352fec-0x0;var _0x54d271=_0x6c09[_0x352fec];return _0x54d271;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0x96c0('0x0'));var sugarcrm=require(_0x96c0('0x1'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0x96c0('0x2'));var servicenow=require('./servicenow');var dynamics365=require(_0x96c0('0x3'));var freshsales=require(_0x96c0('0x4'));var integrations=[_0x96c0('0x5'),_0x96c0('0x6'),_0x96c0('0x7'),'freshdesk',_0x96c0('0x8'),_0x96c0('0x9'),_0x96c0('0xa'),_0x96c0('0xb'),_0x96c0('0xc'),_0x96c0('0xd')];exports['exec']=function(_0x891fcc,_0x58c091,_0x35508e,_0x2a6482,_0x3b1846,_0x2d0b42){if(_0x35508e){if(_[_0x96c0('0xe')](integrations,_0x891fcc['data1'][_0x96c0('0xf')]())){try{var _0x4b45ed=null;var _0x1b513e='';var _0x1ed071=_0x35508e[_0x891fcc[_0x96c0('0x10')]['toLowerCase']()];if(_0x1ed071){var _0xfc0f6b=_0x1ed071[_0x891fcc[_0x96c0('0x11')]];if(_0xfc0f6b){var _0x2c34e0=_[_0x96c0('0x12')](_0xfc0f6b[_0x96c0('0x13')],{'id':parseInt(_0x891fcc[_0x96c0('0x14')],0xa)});if(_0x2c34e0){if(_0x2a6482){if(_0x3b1846&&_0x58c091[_0x96c0('0x15')]){_0x1b513e=_0x96c0('0x15');}else if(_0x58c091[_0x96c0('0x16')]){_0x1b513e=_0x96c0('0x17');}else{console['log'](_0x96c0('0x18'),_0x58c091);}}else{_0x1b513e=_0x96c0('0x19');}switch(_0x891fcc[_0x96c0('0x10')]['toLowerCase']()){case _0x96c0('0x5'):zendesk[_0x1b513e](_0x891fcc,_0x58c091,_0x2c34e0,_0x2a6482,_0x3b1846,_0xfc0f6b,_0x2d0b42);break;case'salesforce':salesforce[_0x1b513e](_0x891fcc,_0x58c091,_0x2c34e0,_0x2a6482,_0x3b1846,_0xfc0f6b,_0x2d0b42);break;case _0x96c0('0x7'):sugarcrm[_0x1b513e](_0x891fcc,_0x58c091,_0x2c34e0,_0x2a6482,_0x3b1846,_0xfc0f6b,_0x2d0b42);break;case'freshdesk':freshdesk[_0x1b513e](_0x891fcc,_0x58c091,_0x2c34e0,_0x2a6482,_0x3b1846,_0xfc0f6b,_0x2d0b42);break;case _0x96c0('0x8'):zoho[_0x1b513e](_0x891fcc,_0x58c091,_0x2c34e0,_0x2a6482,_0x3b1846,_0xfc0f6b,_0x2d0b42);break;case _0x96c0('0x9'):desk[_0x1b513e](_0x891fcc,_0x58c091,_0x2c34e0,_0x2a6482,_0x3b1846,_0xfc0f6b,_0x2d0b42);break;case _0x96c0('0xa'):vtiger[_0x1b513e](_0x891fcc,_0x58c091,_0x2c34e0,_0x2a6482,_0x3b1846,_0xfc0f6b,_0x2d0b42);break;case _0x96c0('0xc'):freshsales['cs'](_0x891fcc,_0x58c091,_0x2c34e0,_0x2a6482,_0x3b1846,_0xfc0f6b,_0x2d0b42,_0x1b513e);break;case'servicenow':servicenow['cs'](_0x891fcc,_0x58c091,_0x2c34e0,_0x2a6482,_0x3b1846,_0xfc0f6b,_0x2d0b42,_0x1b513e);break;case _0x96c0('0xb'):dynamics365['cs'](_0x891fcc,_0x58c091,_0x2c34e0,_0x2a6482,_0x3b1846,_0xfc0f6b,_0x2d0b42,_0x1b513e);break;default:console[_0x96c0('0x1a')](_0x96c0('0x1b'));}}else{_0x4b45ed=require(_0x96c0('0x1c'))(_0x891fcc[_0x96c0('0x10')][_0x96c0('0xf')]());_0x4b45ed[_0x96c0('0x1d')]('[EXEC]',util[_0x96c0('0x1e')](_0x96c0('0x1f'),_0x891fcc['data1'][_0x96c0('0xf')](),_0x891fcc[_0x96c0('0x14')]));}}else{_0x4b45ed=require(_0x96c0('0x1c'))(_0x891fcc[_0x96c0('0x10')][_0x96c0('0xf')]());_0x4b45ed[_0x96c0('0x1d')](_0x96c0('0x20'),util[_0x96c0('0x1e')](_0x96c0('0x21'),_0x891fcc[_0x96c0('0x10')]['toLowerCase'](),_0x891fcc['data2']));}}else{}}catch(_0x5d2106){console[_0x96c0('0x1d')](_0x5d2106);}}}}; \ 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 b879b7a..19a0f5e 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 _0x56dd=['[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','localhost','socket.io-emitter','redis','assign','getString','Subjects','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','endUserType','lead','WhoId','account','WhatId','Case','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','User','find','execute','then','length','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','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','upperFirst','includes','string','picklist','idField','toString','variableName','customVariable','Variable','name','password','concat','securityToken','clientId','login','Connection\x20established.','queue','stripTrailingSlash','serverUrl','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created'];(function(_0x2dd35a,_0x2e9bc7){var _0x291685=function(_0x573ad0){while(--_0x573ad0){_0x2dd35a['push'](_0x2dd35a['shift']());}};_0x291685(++_0x2e9bc7);}(_0x56dd,0x119));var _0xd56d=function(_0x355fca,_0x434a42){_0x355fca=_0x355fca-0x0;var _0x190def=_0x56dd[_0x355fca];return _0x190def;};'use strict';var _=require('lodash');var rp=require(_0xd56d('0x0'));var moment=require('moment');var BPromise=require(_0xd56d('0x1'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0xd56d('0x2'));var Redis=require(_0xd56d('0x3'));var intUtil=require(_0xd56d('0x4'));var config=require(_0xd56d('0x5'));var logger=require(_0xd56d('0x6'))(_0xd56d('0x7'));config['redis']=_[_0xd56d('0x8')](config['redis'],{'host':_0xd56d('0x9'),'port':0x18eb});var io=require(_0xd56d('0xa'))(new Redis(config[_0xd56d('0xb')]));function emit(_0x5412d1,_0x218ee2,_0x564bc9){io['to'](_0x5412d1)['emit'](_0x218ee2,_0x564bc9);}function getTicket(_0x164cb2,_0x3a69f7,_0x143a2b,_0x38d3da,_0x1d032e,_0x30ff06,_0x5eeba9,_0xd8ba7d){var _0x571b17=Object[_0xd56d('0xc')]({},{'OwnerId':_0x3a69f7['id'],'Subject':intUtil[_0xd56d('0xd')](_0x38d3da[_0xd56d('0xe')],_0x1d032e,'\x20'),'Description':intUtil['getString'](_0x38d3da['Descriptions'],_0x1d032e,'\x0a')},getCustomFields(_0x30ff06,_0x1d032e));if(_0x143a2b){if(_0x38d3da[_0xd56d('0xf')]===_0xd56d('0x10')){_0x571b17[_0xd56d('0x11')]=moment[_0xd56d('0x12')]();_0x571b17[_0xd56d('0x13')]=![];_0x571b17[_0xd56d('0x14')]=![];if(_0x143a2b['endUserType']===_0xd56d('0x15')||_0x143a2b[_0xd56d('0x16')]===_0xd56d('0x17')){_0x571b17[_0xd56d('0x18')]=_0x143a2b['id'];}else if(_0x143a2b['endUserType']===_0xd56d('0x19')){_0x571b17[_0xd56d('0x1a')]=_0x143a2b['id'];}}else if(_0x38d3da[_0xd56d('0xf')]===_0xd56d('0x1b')){if(_0x143a2b[_0xd56d('0x16')]==='contact'){_0x571b17[_0xd56d('0x1c')]=_0x143a2b['id'];}else if(_0x143a2b[_0xd56d('0x16')]===_0xd56d('0x19')){_0x571b17['AccountId']=_0x143a2b['id'];}else if(_0x143a2b[_0xd56d('0x16')]===_0xd56d('0x17')&&_0x38d3da['leadId']){_0x571b17[_0x38d3da[_0xd56d('0x1d')]]=_0x143a2b['id'];}else{logger[_0xd56d('0x1e')](_0xd56d('0x1f'));}}}return _0x5eeba9['sobject'](_0x38d3da[_0xd56d('0xf')])[_0xd56d('0x20')](_0x571b17);}function getUser(_0x5f1c9e,_0x5dbf27,_0x2306fd){if(!_[_0xd56d('0x21')](_0x5dbf27)&&intUtil[_0xd56d('0x22')](_0x5dbf27)){var _0x51fecc={'Email':_0x5dbf27};var _0x18d585={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2306fd[_0xd56d('0x23')](_0xd56d('0x24'))[_0xd56d('0x25')](_0x51fecc,_0x18d585)[_0xd56d('0x26')]()[_0xd56d('0x27')](function(_0x9059f0){if(_0x9059f0[_0xd56d('0x28')]){var _0x5b4c7c=_[_0xd56d('0x25')](_0x9059f0,function(_0x3add5b){return _0x3add5b[_0xd56d('0x29')]===_0x5dbf27;});if(_0x5b4c7c){logger[_0xd56d('0x1e')](_0xd56d('0x2a'),_0x5dbf27);return BPromise['resolve']({'id':_0x5b4c7c['Id'],'name':_0x5b4c7c[_0xd56d('0x2b')]});}}else{logger['info'](_0xd56d('0x2c'),_0x5dbf27);return _0x2306fd[_0xd56d('0x2d')]()[_0xd56d('0x27')](function(_0x5bf0bd){return BPromise[_0xd56d('0x2e')]({'id':_0x5bf0bd[_0xd56d('0x2f')],'name':_0x5bf0bd[_0xd56d('0x30')]});});}});}else{logger[_0xd56d('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5dbf27);return _0x2306fd['identity']()['then'](function(_0x2e5699){return BPromise['resolve']({'id':_0x2e5699[_0xd56d('0x2f')],'name':_0x2e5699['display_name']});});}}function getEndUser(_0x859cac,_0x42bdf8,_0x5a7560,_0x187755,_0x4185ba){var _0x1f9613={'$or':{'Phone':_0x187755}};var _0x4075b6={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd56d('0x2e')]()[_0xd56d('0x27')](function(){logger[_0xd56d('0x1e')](_0xd56d('0x31'),_0x187755,_0x42bdf8[_0xd56d('0x32')]);switch(_0x42bdf8[_0xd56d('0x32')]){case _0xd56d('0x33'):var _0x2ad2aa=_[_0xd56d('0x34')](_0x1f9613);if(_0x42bdf8[_0xd56d('0x35')]){var _0x4d1ec4={};_0x4d1ec4[_0x42bdf8['additionalSearchContact']]=_0x187755;_[_0xd56d('0x36')](_0x2ad2aa[_0xd56d('0x37')],_0x4d1ec4);}return _0x4185ba[_0xd56d('0x23')](_0xd56d('0x38'))[_0xd56d('0x25')](_0x2ad2aa,_0x4075b6)[_0xd56d('0x26')]()[_0xd56d('0x27')](function(_0x32afbe){if(_0x32afbe&&_0x32afbe['length']){return _0x32afbe;}else{var _0xfe59fe=_[_0xd56d('0x34')](_0x1f9613);if(_0x42bdf8[_0xd56d('0x39')]){var _0x4f966f={};_0x4f966f[_0x42bdf8[_0xd56d('0x39')]]=_0x187755;_['merge'](_0xfe59fe[_0xd56d('0x37')],_0x4f966f);}return _0x4185ba[_0xd56d('0x23')](_0xd56d('0x3a'))[_0xd56d('0x25')](_0xfe59fe,_0x4075b6);}});case _0xd56d('0x3b'):var _0x3db309=_[_0xd56d('0x34')](_0x1f9613);if(_0x42bdf8['additionalSearchAccount']){var _0x4d1ec4={};_0x4d1ec4[_0x42bdf8[_0xd56d('0x3c')]]=_0x187755;_[_0xd56d('0x36')](_0x3db309[_0xd56d('0x37')],_0x4d1ec4);}return _0x4185ba[_0xd56d('0x23')](_0xd56d('0x3d'))[_0xd56d('0x25')](_0x3db309,_0x4075b6)[_0xd56d('0x26')]()[_0xd56d('0x27')](function(_0x4df6f9){if(_0x4df6f9&&_0x4df6f9[_0xd56d('0x28')]){return _0x4df6f9;}else{var _0x29b41=_['cloneDeep'](_0x1f9613);if(_0x42bdf8['additionalSearchContact']){var _0xad9ad8={};_0xad9ad8[_0x42bdf8['additionalSearchContact']]=_0x187755;_[_0xd56d('0x36')](_0x29b41[_0xd56d('0x37')],_0xad9ad8);}return _0x4185ba[_0xd56d('0x23')](_0xd56d('0x38'))[_0xd56d('0x25')](_0x29b41,_0x4075b6)[_0xd56d('0x27')](function(_0x390af0){if(_0x390af0&&_0x390af0[_0xd56d('0x28')]){return _0x390af0;}else{var _0x51440c=_[_0xd56d('0x34')](_0x1f9613);if(_0x42bdf8[_0xd56d('0x39')]){var _0x47a3dc={};_0x47a3dc[_0x42bdf8[_0xd56d('0x39')]]=_0x187755;_['merge'](_0x51440c['$or'],_0x47a3dc);}return _0x4185ba[_0xd56d('0x23')]('Lead')[_0xd56d('0x25')](_0x51440c,_0x4075b6);}});}});case _0xd56d('0x15'):var _0x2ad2aa=_[_0xd56d('0x34')](_0x1f9613);if(_0x42bdf8[_0xd56d('0x35')]){var _0x4d1ec4={};_0x4d1ec4[_0x42bdf8['additionalSearchContact']]=_0x187755;_[_0xd56d('0x36')](_0x2ad2aa['$or'],_0x4d1ec4);}return _0x4185ba['sobject'](_0xd56d('0x38'))[_0xd56d('0x25')](_0x2ad2aa,_0x4075b6)['execute']();case _0xd56d('0x17'):var _0x1c4ffb=_[_0xd56d('0x34')](_0x1f9613);if(_0x42bdf8[_0xd56d('0x39')]){var _0x4d1ec4={};_0x4d1ec4[_0x42bdf8[_0xd56d('0x39')]]=_0x187755;_[_0xd56d('0x36')](_0x1c4ffb[_0xd56d('0x37')],_0x4d1ec4);}return _0x4185ba['sobject']('Lead')[_0xd56d('0x25')](_0x1c4ffb,_0x4075b6);case _0xd56d('0x19'):var _0x3db309=_['cloneDeep'](_0x1f9613);if(_0x42bdf8[_0xd56d('0x3c')]){var _0x4d1ec4={};_0x4d1ec4[_0x42bdf8['additionalSearchAccount']]=_0x187755;_[_0xd56d('0x36')](_0x3db309[_0xd56d('0x37')],_0x4d1ec4);}return _0x4185ba[_0xd56d('0x23')](_0xd56d('0x3d'))['find'](_0x3db309,_0x4075b6);default:return null;}})[_0xd56d('0x27')](function(_0x414de0){if(_0x414de0&&_0x414de0[_0xd56d('0x28')]){var _0x4ff9b2=_[_0xd56d('0x3e')](_0x414de0);if(_0x4ff9b2){return BPromise[_0xd56d('0x2e')]({'id':_0x4ff9b2['Id'],'name':_0x4ff9b2[_0xd56d('0x2b')],'phone':_0x4ff9b2['Phone'],'endUserType':_0x4ff9b2[_0xd56d('0x3f')][_0xd56d('0x40')][_0xd56d('0x41')]()});}}})[_0xd56d('0x27')](function(_0x3684d9){if(_0x3684d9){logger[_0xd56d('0x1e')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x3684d9[_0xd56d('0x16')],_0x187755);return BPromise[_0xd56d('0x2e')](_0x3684d9);}else{logger[_0xd56d('0x1e')](_0xd56d('0x42'),_0x187755);var _0x43a9bb={'Phone':_0x187755};if(_0x42bdf8[_0xd56d('0x43')]){if(_0x42bdf8[_0xd56d('0x43')]==='contact'){logger['info'](_0xd56d('0x44'),_0x187755,_0x42bdf8['moduleCreate']);_0x43a9bb['LastName']=_0x5a7560!==_0xd56d('0x45')?_0x5a7560:util[_0xd56d('0x46')](_0xd56d('0x47'),_0x187755);}else if(_0x42bdf8[_0xd56d('0x43')]==='lead'){logger[_0xd56d('0x1e')](_0xd56d('0x44'),_0x187755,_0x42bdf8['moduleCreate']);_0x43a9bb[_0xd56d('0x48')]=_0x5a7560!==''?_0x5a7560:util[_0xd56d('0x46')](_0xd56d('0x47'),_0x187755);_0x43a9bb[_0xd56d('0x49')]='No\x20Company';}else if(_0x42bdf8[_0xd56d('0x43')]===_0xd56d('0x19')){logger[_0xd56d('0x1e')](_0xd56d('0x44'),_0x187755,_0x42bdf8[_0xd56d('0x43')]);_0x43a9bb['Name']=_0x5a7560!==_0xd56d('0x45')?_0x5a7560:util[_0xd56d('0x46')](_0xd56d('0x47'),_0x187755);}else{return null;}}return _0x4185ba['sobject'](_[_0xd56d('0x4a')](_0x42bdf8['moduleCreate']))[_0xd56d('0x20')](_0x43a9bb)[_0xd56d('0x27')](function(_0x22690d){return BPromise['resolve']({'id':_0x22690d['id'],'endUserType':_0x42bdf8[_0xd56d('0x43')]});});}});}function getCustomFields(_0x2e761f,_0x3d1574){var _0x6fcd3a={};if(_0x2e761f[_0xd56d('0x28')]>0x0){_['forEach'](_0x2e761f,function(_0x2c3c9b){if(_[_0xd56d('0x4b')]([_0xd56d('0x4c'),_0xd56d('0x4d')],_0x2c3c9b[_0xd56d('0x40')])&&_0x2c3c9b[_0xd56d('0x4e')]){_0x6fcd3a[_0x2c3c9b[_0xd56d('0x4e')]]=_0x2c3c9b['content'][_0xd56d('0x4f')]();}else if(_0x2c3c9b['type']==='variable'&&_0x2c3c9b['variableName']&&_0x2c3c9b[_0xd56d('0x4e')]){_0x3d1574[_0x2c3c9b['variableName']]&&(_0x6fcd3a[_0x2c3c9b['idField']]=_0x3d1574[_0x2c3c9b[_0xd56d('0x50')]]['toString']());}else if(_0x2c3c9b[_0xd56d('0x40')]===_0xd56d('0x51')&&_0x2c3c9b['Variable']&&_0x2c3c9b[_0xd56d('0x52')][_0xd56d('0x53')]&&_0x2c3c9b[_0xd56d('0x4e')]){_0x3d1574[_0x2c3c9b['Variable'][_0xd56d('0x53')][_0xd56d('0x41')]()]&&(_0x6fcd3a[_0x2c3c9b[_0xd56d('0x4e')]]=_0x3d1574[_0x2c3c9b['Variable'][_0xd56d('0x53')]['toLowerCase']()][_0xd56d('0x4f')]());}});}return _0x6fcd3a;}function getConnection(_0x5d689a){var _0x3bd7f5=_0x5d689a[_0xd56d('0x54')][_0xd56d('0x55')](_0x5d689a[_0xd56d('0x56')]);var _0x1e2c88=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5d689a['remoteUri']||'https://login.salesforce.com','clientId':_0x5d689a[_0xd56d('0x57')],'clientSecret':_0x5d689a['clientSecret']}});return _0x1e2c88[_0xd56d('0x58')](_0x5d689a['username'],_0x3bd7f5)[_0xd56d('0x27')](function(){logger[_0xd56d('0x1e')](_0xd56d('0x59'));return _0x1e2c88;});}exports[_0xd56d('0x5a')]=function(_0x37a2cd,_0x140dee,_0x56f207,_0x457d7a,_0x20ed16,_0x11de65){var _0x342791,_0x54783a,_0x4d80ab,_0xa006ce;_0x11de65['serverUrl']=intUtil[_0xd56d('0x5b')](_0x11de65[_0xd56d('0x5c')]);_0x11de65['remoteUri']=intUtil[_0xd56d('0x5b')](_0x11de65[_0xd56d('0x5d')]);if(_0x20ed16&&_0x20ed16[_0xd56d('0x5e')]){logger[_0xd56d('0x1e')](_0xd56d('0x5f'),_0xd56d('0x60'));_0x140dee['recordingURL']=util[_0xd56d('0x46')](_0xd56d('0x61'),_0x11de65[_0xd56d('0x5c')],_0x140dee[_0xd56d('0x62')],md5(_0x140dee[_0xd56d('0x62')]));}else{_0x140dee['recordingURL']='';}return getConnection(_0x11de65)[_0xd56d('0x27')](function(_0x113777){_0xa006ce=_0x113777;return getUser(_0x11de65,_0x457d7a[_0xd56d('0x63')],_0xa006ce);})[_0xd56d('0x27')](function(_0x1fde6f){_0x342791=_0x1fde6f;return getEndUser(_0x11de65,_0x56f207,_0x140dee[_0xd56d('0x64')],_0x140dee[_0xd56d('0x65')],_0xa006ce);})[_0xd56d('0x27')](function(_0x410ee3){_0x54783a=_0x410ee3;return getTicket(_0x11de65,_0x342791,_0x54783a,_0x56f207,_0x140dee,_0x56f207['Fields'],_0xa006ce,_0xd56d('0x5a'));})[_0xd56d('0x27')](function(_0x1a8602){_0x4d80ab=_0x1a8602;logger[_0xd56d('0x1e')](_0xd56d('0x66'),_0x4d80ab['id']);logger[_0xd56d('0x1e')](_0xd56d('0x67'),_0x4d80ab['id'],_0x457d7a[_0xd56d('0x53')],_0x11de65[_0xd56d('0x40')]);switch(_0x11de65[_0xd56d('0x40')]){case _0xd56d('0x68'):emit(util[_0xd56d('0x46')](_0xd56d('0x69'),_0x457d7a[_0xd56d('0x53')]),_0xd56d('0x6a'),{'recordId':_0x4d80ab['id']});break;case _0xd56d('0x6b'):emit(util[_0xd56d('0x46')](_0xd56d('0x69'),_0x457d7a[_0xd56d('0x53')]),'trigger:browser:url',{'uri':util['format'](_0xd56d('0x6c'),_0xa006ce[_0xd56d('0x6d')],_0x4d80ab['id'])});break;default:logger[_0xd56d('0x6e')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xd56d('0x6f')](function(_0x1ec16d){logger[_0xd56d('0x6e')]('[QUEUE]',_0x1ec16d);});};exports[_0xd56d('0x70')]=function(_0x4d5e0a,_0x562119,_0x2da4cb,_0x471c12,_0x42a25d,_0x1dead5,_0x3c11f2){var _0x10daac,_0x287909,_0x49a4b4,_0x2f1e68;_0x1dead5[_0xd56d('0x5c')]=intUtil['stripTrailingSlash'](_0x1dead5['serverUrl']);_0x1dead5[_0xd56d('0x5d')]=intUtil[_0xd56d('0x5b')](_0x1dead5['remoteUri']);if(_0x3c11f2&&_0x3c11f2[_0xd56d('0x71')]&&_0x3c11f2[_0xd56d('0x71')]!==_0xd56d('0x72')){logger[_0xd56d('0x1e')](_0xd56d('0x73'),'Recording\x20is\x20enabled!');_0x562119[_0xd56d('0x74')]=util['format'](_0xd56d('0x61'),_0x1dead5[_0xd56d('0x5c')],_0x562119[_0xd56d('0x62')],md5(_0x562119[_0xd56d('0x62')]));}return getConnection(_0x1dead5)[_0xd56d('0x27')](function(_0x193df6){_0x2f1e68=_0x193df6;return getUser(_0x1dead5,_0x471c12['email'],_0x2f1e68);})[_0xd56d('0x27')](function(_0x52b04e){_0x10daac=_0x52b04e;return getEndUser(_0x1dead5,_0x2da4cb,_0x562119[_0xd56d('0x75')],_0x562119[_0xd56d('0x76')],_0x2f1e68);})[_0xd56d('0x27')](function(_0x151cdd){_0x287909=_0x151cdd;return getTicket(_0x1dead5,_0x10daac,_0x287909,_0x2da4cb,_0x562119,_0x2da4cb[_0xd56d('0x77')],_0x2f1e68,'outbound');})[_0xd56d('0x27')](function(_0x28d6b2){_0x49a4b4=_0x28d6b2;logger[_0xd56d('0x1e')](_0xd56d('0x78'),_0x49a4b4['id']);logger[_0xd56d('0x1e')](_0xd56d('0x79'),_0x49a4b4['id'],_0x471c12[_0xd56d('0x53')],_0x1dead5[_0xd56d('0x40')]);switch(_0x1dead5['type']){case _0xd56d('0x68'):emit(util[_0xd56d('0x46')]('user:%s',_0x471c12['name']),_0xd56d('0x6a'),{'recordId':_0x49a4b4['id']});break;case'newTab':emit(util['format']('user:%s',_0x471c12[_0xd56d('0x53')]),_0xd56d('0x7a'),{'uri':util['format']('%s/%s/e',_0x2f1e68[_0xd56d('0x6d')],_0x49a4b4['id'])});break;default:logger[_0xd56d('0x6e')](_0xd56d('0x73'),_0xd56d('0x7b'));}})['catch'](function(_0x39de3f){logger[_0xd56d('0x6e')](_0xd56d('0x73'),_0x39de3f);});};exports[_0xd56d('0x7c')]=function(_0x4d9a16,_0x355ba8,_0x148a34,_0x344441,_0x1cad7e,_0x400588){var _0x3a581e,_0x6c462e,_0x118128,_0x50420c;_0x400588[_0xd56d('0x5c')]=intUtil['stripTrailingSlash'](_0x400588[_0xd56d('0x5c')]);_0x400588[_0xd56d('0x5d')]=intUtil[_0xd56d('0x5b')](_0x400588[_0xd56d('0x5d')]);if(_0x1cad7e&&_0x1cad7e[_0xd56d('0x5e')]){logger[_0xd56d('0x1e')]('['+_0x355ba8[_0xd56d('0x7d')][_0xd56d('0x7e')]()+']','Recording\x20is\x20enabled!');_0x355ba8['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x400588[_0xd56d('0x5c')],_0x355ba8['uniqueid'],md5(_0x355ba8[_0xd56d('0x62')]));}else{_0x355ba8['recordingURL']='';}return getConnection(_0x400588)[_0xd56d('0x27')](function(_0xc6dd67){_0x50420c=_0xc6dd67;if(!_[_0xd56d('0x21')](_0x344441)){return getUser(_0x400588,_0x344441['name'],_0x50420c);}else{return getUser(_0x400588,null,_0x50420c);}})[_0xd56d('0x27')](function(_0x18f0b1){_0x3a581e=_0x18f0b1;return getEndUser(_0x400588,_0x148a34,_0x355ba8['calleridname'],_0x355ba8[_0xd56d('0x65')],_0x50420c);})['then'](function(_0x22abb3){_0x6c462e=_0x22abb3;return getTicket(_0x400588,_0x3a581e,_0x6c462e,_0x148a34,_0x355ba8,_0x148a34[_0xd56d('0x77')],_0x50420c);})[_0xd56d('0x27')](function(_0x238dee){_0x118128=_0x238dee;logger[_0xd56d('0x1e')]('['+_0x355ba8[_0xd56d('0x7d')][_0xd56d('0x7e')]()+']\x20Ticket\x20%s\x20created.',_0x118128['id']);logger['info']('['+_0x355ba8[_0xd56d('0x7d')][_0xd56d('0x7e')]()+_0xd56d('0x7f'),_0x400588['type']);})[_0xd56d('0x6f')](function(_0xfac39b){logger['error']('['+_0x355ba8['lastevent']['toUpperCase']()+']',_0xfac39b);});}; \ No newline at end of file +var _0xaf0f=['moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','forEach','string','content','idField','variableName','toString','customVariable','Variable','name','toLowerCase','password','securityToken','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','[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','remoteUri','recordingFormat','[OUTBOUND]','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','util','./util','../../../../config/environment','salesforce','redis','localhost','socket.io-emitter','emit','assign','Subjects','getString','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','account','WhatId','Case','ContactId','leadId','info','sobject','create','isNil','User','find','execute','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','moduleSearch','contact_lead','additionalSearchContact','length','cloneDeep','additionalSearchLead','merge','$or','Lead','additionalSearchAccount','Account','Contact','first','Phone','attributes','type'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xaf0f,0xb7));var _0xfaf0=function(_0x47ddb3,_0x276eb0){_0x47ddb3=_0x47ddb3-0x0;var _0x1ba4d1=_0xaf0f[_0x47ddb3];return _0x1ba4d1;};'use strict';var _=require(_0xfaf0('0x0'));var rp=require(_0xfaf0('0x1'));var moment=require(_0xfaf0('0x2'));var BPromise=require(_0xfaf0('0x3'));var md5=require(_0xfaf0('0x4'));var jsforce=require('jsforce');var util=require(_0xfaf0('0x5'));var Redis=require('ioredis');var intUtil=require(_0xfaf0('0x6'));var config=require(_0xfaf0('0x7'));var logger=require('../../../../config/logger')(_0xfaf0('0x8'));config[_0xfaf0('0x9')]=_['defaults'](config[_0xfaf0('0x9')],{'host':_0xfaf0('0xa'),'port':0x18eb});var io=require(_0xfaf0('0xb'))(new Redis(config[_0xfaf0('0x9')]));function emit(_0x188c86,_0x3d5c48,_0x5c20fc){io['to'](_0x188c86)[_0xfaf0('0xc')](_0x3d5c48,_0x5c20fc);}function getTicket(_0x15ff0b,_0x434161,_0x5447dd,_0x5dbce5,_0x9029ef,_0x408929,_0x4a26fa,_0x27faa1){var _0x4ad6ee=Object[_0xfaf0('0xd')]({},{'OwnerId':_0x434161['id'],'Subject':intUtil['getString'](_0x5dbce5[_0xfaf0('0xe')],_0x9029ef,'\x20'),'Description':intUtil[_0xfaf0('0xf')](_0x5dbce5[_0xfaf0('0x10')],_0x9029ef,'\x0a')},getCustomFields(_0x408929,_0x9029ef));if(_0x5447dd){if(_0x5dbce5[_0xfaf0('0x11')]==='Task'){_0x4ad6ee[_0xfaf0('0x12')]=moment[_0xfaf0('0x13')]();_0x4ad6ee[_0xfaf0('0x14')]=![];_0x4ad6ee[_0xfaf0('0x15')]=![];if(_0x5447dd[_0xfaf0('0x16')]===_0xfaf0('0x17')||_0x5447dd[_0xfaf0('0x16')]===_0xfaf0('0x18')){_0x4ad6ee['WhoId']=_0x5447dd['id'];}else if(_0x5447dd[_0xfaf0('0x16')]===_0xfaf0('0x19')){_0x4ad6ee[_0xfaf0('0x1a')]=_0x5447dd['id'];}}else if(_0x5dbce5[_0xfaf0('0x11')]===_0xfaf0('0x1b')){if(_0x5447dd[_0xfaf0('0x16')]===_0xfaf0('0x17')){_0x4ad6ee[_0xfaf0('0x1c')]=_0x5447dd['id'];}else if(_0x5447dd[_0xfaf0('0x16')]===_0xfaf0('0x19')){_0x4ad6ee['AccountId']=_0x5447dd['id'];}else if(_0x5447dd[_0xfaf0('0x16')]===_0xfaf0('0x18')&&_0x5dbce5[_0xfaf0('0x1d')]){_0x4ad6ee[_0x5dbce5['leadId']]=_0x5447dd['id'];}else{logger[_0xfaf0('0x1e')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4a26fa[_0xfaf0('0x1f')](_0x5dbce5[_0xfaf0('0x11')])[_0xfaf0('0x20')](_0x4ad6ee);}function getUser(_0x8943a6,_0x3984e4,_0x153598){if(!_[_0xfaf0('0x21')](_0x3984e4)&&intUtil['validateEmail'](_0x3984e4)){var _0x41e72c={'Email':_0x3984e4};var _0x2eb823={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x153598[_0xfaf0('0x1f')](_0xfaf0('0x22'))[_0xfaf0('0x23')](_0x41e72c,_0x2eb823)[_0xfaf0('0x24')]()['then'](function(_0x1af60a){if(_0x1af60a['length']){var _0x11079d=_['find'](_0x1af60a,function(_0x402a23){return _0x402a23[_0xfaf0('0x25')]===_0x3984e4;});if(_0x11079d){logger['info']('Agent\x20%s\x20found.',_0x3984e4);return BPromise[_0xfaf0('0x26')]({'id':_0x11079d['Id'],'name':_0x11079d[_0xfaf0('0x27')]});}}else{logger[_0xfaf0('0x1e')](_0xfaf0('0x28'),_0x3984e4);return _0x153598[_0xfaf0('0x29')]()[_0xfaf0('0x2a')](function(_0x5a61b7){return BPromise[_0xfaf0('0x26')]({'id':_0x5a61b7['user_id'],'name':_0x5a61b7['display_name']});});}});}else{logger[_0xfaf0('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3984e4);return _0x153598[_0xfaf0('0x29')]()[_0xfaf0('0x2a')](function(_0x8de046){return BPromise[_0xfaf0('0x26')]({'id':_0x8de046['user_id'],'name':_0x8de046['display_name']});});}}function getEndUser(_0x22a562,_0x3ceb4f,_0x1a4ebe,_0x5b4167,_0x139f49){var _0x10790a={'$or':{'Phone':_0x5b4167}};var _0x5ddaf3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfaf0('0x26')]()[_0xfaf0('0x2a')](function(){logger[_0xfaf0('0x1e')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5b4167,_0x3ceb4f[_0xfaf0('0x2b')]);switch(_0x3ceb4f[_0xfaf0('0x2b')]){case _0xfaf0('0x2c'):var _0x5667a9=_['cloneDeep'](_0x10790a);if(_0x3ceb4f[_0xfaf0('0x2d')]){var _0x1dc323={};_0x1dc323[_0x3ceb4f[_0xfaf0('0x2d')]]=_0x5b4167;_['merge'](_0x5667a9['$or'],_0x1dc323);}return _0x139f49[_0xfaf0('0x1f')]('Contact')['find'](_0x5667a9,_0x5ddaf3)[_0xfaf0('0x24')]()[_0xfaf0('0x2a')](function(_0x3b2b3b){if(_0x3b2b3b&&_0x3b2b3b[_0xfaf0('0x2e')]){return _0x3b2b3b;}else{var _0x46b820=_[_0xfaf0('0x2f')](_0x10790a);if(_0x3ceb4f[_0xfaf0('0x30')]){var _0x23219e={};_0x23219e[_0x3ceb4f['additionalSearchLead']]=_0x5b4167;_[_0xfaf0('0x31')](_0x46b820[_0xfaf0('0x32')],_0x23219e);}return _0x139f49[_0xfaf0('0x1f')](_0xfaf0('0x33'))[_0xfaf0('0x23')](_0x46b820,_0x5ddaf3);}});case'account_contact_lead':var _0x542ccc=_[_0xfaf0('0x2f')](_0x10790a);if(_0x3ceb4f[_0xfaf0('0x34')]){var _0x1dc323={};_0x1dc323[_0x3ceb4f[_0xfaf0('0x34')]]=_0x5b4167;_[_0xfaf0('0x31')](_0x542ccc[_0xfaf0('0x32')],_0x1dc323);}return _0x139f49[_0xfaf0('0x1f')](_0xfaf0('0x35'))['find'](_0x542ccc,_0x5ddaf3)['execute']()['then'](function(_0x331cf7){if(_0x331cf7&&_0x331cf7[_0xfaf0('0x2e')]){return _0x331cf7;}else{var _0x519ce8=_[_0xfaf0('0x2f')](_0x10790a);if(_0x3ceb4f[_0xfaf0('0x2d')]){var _0x4fdd54={};_0x4fdd54[_0x3ceb4f[_0xfaf0('0x2d')]]=_0x5b4167;_[_0xfaf0('0x31')](_0x519ce8[_0xfaf0('0x32')],_0x4fdd54);}return _0x139f49['sobject'](_0xfaf0('0x36'))['find'](_0x519ce8,_0x5ddaf3)['then'](function(_0x5e84e6){if(_0x5e84e6&&_0x5e84e6[_0xfaf0('0x2e')]){return _0x5e84e6;}else{var _0x5637ae=_[_0xfaf0('0x2f')](_0x10790a);if(_0x3ceb4f[_0xfaf0('0x30')]){var _0x3a9cb9={};_0x3a9cb9[_0x3ceb4f['additionalSearchLead']]=_0x5b4167;_[_0xfaf0('0x31')](_0x5637ae[_0xfaf0('0x32')],_0x3a9cb9);}return _0x139f49[_0xfaf0('0x1f')](_0xfaf0('0x33'))[_0xfaf0('0x23')](_0x5637ae,_0x5ddaf3);}});}});case _0xfaf0('0x17'):var _0x5667a9=_[_0xfaf0('0x2f')](_0x10790a);if(_0x3ceb4f[_0xfaf0('0x2d')]){var _0x1dc323={};_0x1dc323[_0x3ceb4f[_0xfaf0('0x2d')]]=_0x5b4167;_['merge'](_0x5667a9[_0xfaf0('0x32')],_0x1dc323);}return _0x139f49['sobject'](_0xfaf0('0x36'))['find'](_0x5667a9,_0x5ddaf3)[_0xfaf0('0x24')]();case _0xfaf0('0x18'):var _0xcbe4f2=_[_0xfaf0('0x2f')](_0x10790a);if(_0x3ceb4f[_0xfaf0('0x30')]){var _0x1dc323={};_0x1dc323[_0x3ceb4f[_0xfaf0('0x30')]]=_0x5b4167;_['merge'](_0xcbe4f2[_0xfaf0('0x32')],_0x1dc323);}return _0x139f49['sobject']('Lead')[_0xfaf0('0x23')](_0xcbe4f2,_0x5ddaf3);case'account':var _0x542ccc=_[_0xfaf0('0x2f')](_0x10790a);if(_0x3ceb4f['additionalSearchAccount']){var _0x1dc323={};_0x1dc323[_0x3ceb4f['additionalSearchAccount']]=_0x5b4167;_[_0xfaf0('0x31')](_0x542ccc[_0xfaf0('0x32')],_0x1dc323);}return _0x139f49[_0xfaf0('0x1f')](_0xfaf0('0x35'))[_0xfaf0('0x23')](_0x542ccc,_0x5ddaf3);default:return null;}})['then'](function(_0x568a81){if(_0x568a81&&_0x568a81[_0xfaf0('0x2e')]){var _0x27f673=_[_0xfaf0('0x37')](_0x568a81);if(_0x27f673){return BPromise[_0xfaf0('0x26')]({'id':_0x27f673['Id'],'name':_0x27f673[_0xfaf0('0x27')],'phone':_0x27f673[_0xfaf0('0x38')],'endUserType':_0x27f673[_0xfaf0('0x39')][_0xfaf0('0x3a')]['toLowerCase']()});}}})[_0xfaf0('0x2a')](function(_0x4e4fb4){if(_0x4e4fb4){logger[_0xfaf0('0x1e')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x4e4fb4[_0xfaf0('0x16')],_0x5b4167);return BPromise[_0xfaf0('0x26')](_0x4e4fb4);}else{logger[_0xfaf0('0x1e')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x5b4167);var _0x294e78={'Phone':_0x5b4167};if(_0x3ceb4f[_0xfaf0('0x3b')]){if(_0x3ceb4f['moduleCreate']==='contact'){logger[_0xfaf0('0x1e')](_0xfaf0('0x3c'),_0x5b4167,_0x3ceb4f[_0xfaf0('0x3b')]);_0x294e78[_0xfaf0('0x3d')]=_0x1a4ebe!==''?_0x1a4ebe:util['format']('Caller\x20-\x20%s',_0x5b4167);}else if(_0x3ceb4f[_0xfaf0('0x3b')]===_0xfaf0('0x18')){logger['info'](_0xfaf0('0x3c'),_0x5b4167,_0x3ceb4f['moduleCreate']);_0x294e78[_0xfaf0('0x3d')]=_0x1a4ebe!==_0xfaf0('0x3e')?_0x1a4ebe:util[_0xfaf0('0x3f')](_0xfaf0('0x40'),_0x5b4167);_0x294e78[_0xfaf0('0x41')]=_0xfaf0('0x42');}else if(_0x3ceb4f[_0xfaf0('0x3b')]===_0xfaf0('0x19')){logger[_0xfaf0('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5b4167,_0x3ceb4f['moduleCreate']);_0x294e78[_0xfaf0('0x27')]=_0x1a4ebe!==_0xfaf0('0x3e')?_0x1a4ebe:util[_0xfaf0('0x3f')](_0xfaf0('0x40'),_0x5b4167);}else{return null;}}return _0x139f49[_0xfaf0('0x1f')](_['upperFirst'](_0x3ceb4f[_0xfaf0('0x3b')]))[_0xfaf0('0x20')](_0x294e78)[_0xfaf0('0x2a')](function(_0x3fd195){return BPromise[_0xfaf0('0x26')]({'id':_0x3fd195['id'],'endUserType':_0x3ceb4f[_0xfaf0('0x3b')]});});}});}function getCustomFields(_0x26c28d,_0xf87f31){var _0x4ebc15={};if(_0x26c28d[_0xfaf0('0x2e')]>0x0){_[_0xfaf0('0x43')](_0x26c28d,function(_0x43bff2){if(_['includes']([_0xfaf0('0x44'),'picklist'],_0x43bff2['type'])&&_0x43bff2['idField']){_0x4ebc15[_0x43bff2['idField']]=_0x43bff2[_0xfaf0('0x45')]['toString']();}else if(_0x43bff2[_0xfaf0('0x3a')]==='variable'&&_0x43bff2['variableName']&&_0x43bff2[_0xfaf0('0x46')]){_0xf87f31[_0x43bff2[_0xfaf0('0x47')]]&&(_0x4ebc15[_0x43bff2[_0xfaf0('0x46')]]=_0xf87f31[_0x43bff2[_0xfaf0('0x47')]][_0xfaf0('0x48')]());}else if(_0x43bff2['type']===_0xfaf0('0x49')&&_0x43bff2[_0xfaf0('0x4a')]&&_0x43bff2[_0xfaf0('0x4a')][_0xfaf0('0x4b')]&&_0x43bff2['idField']){_0xf87f31[_0x43bff2[_0xfaf0('0x4a')][_0xfaf0('0x4b')]['toLowerCase']()]&&(_0x4ebc15[_0x43bff2[_0xfaf0('0x46')]]=_0xf87f31[_0x43bff2[_0xfaf0('0x4a')][_0xfaf0('0x4b')][_0xfaf0('0x4c')]()][_0xfaf0('0x48')]());}});}return _0x4ebc15;}function getConnection(_0x3eb6f6){var _0x325815=_0x3eb6f6[_0xfaf0('0x4d')]['concat'](_0x3eb6f6[_0xfaf0('0x4e')]);var _0x461910=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3eb6f6['remoteUri']||_0xfaf0('0x4f'),'clientId':_0x3eb6f6[_0xfaf0('0x50')],'clientSecret':_0x3eb6f6[_0xfaf0('0x51')]}});return _0x461910[_0xfaf0('0x52')](_0x3eb6f6[_0xfaf0('0x53')],_0x325815)['then'](function(){logger[_0xfaf0('0x1e')](_0xfaf0('0x54'));return _0x461910;});}exports[_0xfaf0('0x55')]=function(_0x4817df,_0x3d6fa8,_0x3a9fd5,_0x4019dd,_0x3d177d,_0x4f0518){var _0x26d168,_0x5d21e4,_0x117b5b,_0x2bc8aa;_0x4f0518[_0xfaf0('0x56')]=intUtil[_0xfaf0('0x57')](_0x4f0518['serverUrl']);_0x4f0518['remoteUri']=intUtil[_0xfaf0('0x57')](_0x4f0518['remoteUri']);if(_0x3d177d&&_0x3d177d[_0xfaf0('0x58')]){logger[_0xfaf0('0x1e')](_0xfaf0('0x59'),_0xfaf0('0x5a'));_0x3d6fa8['recordingURL']=util[_0xfaf0('0x3f')](_0xfaf0('0x5b'),_0x4f0518[_0xfaf0('0x56')],_0x3d6fa8[_0xfaf0('0x5c')],md5(_0x3d6fa8[_0xfaf0('0x5c')]));}else{_0x3d6fa8[_0xfaf0('0x5d')]='';}return getConnection(_0x4f0518)[_0xfaf0('0x2a')](function(_0x437c74){_0x2bc8aa=_0x437c74;return getUser(_0x4f0518,_0x4019dd[_0xfaf0('0x5e')],_0x2bc8aa);})['then'](function(_0x30abaa){_0x26d168=_0x30abaa;return getEndUser(_0x4f0518,_0x3a9fd5,_0x3d6fa8[_0xfaf0('0x5f')],_0x3d6fa8[_0xfaf0('0x60')],_0x2bc8aa);})['then'](function(_0x1e0ad0){_0x5d21e4=_0x1e0ad0;return getTicket(_0x4f0518,_0x26d168,_0x5d21e4,_0x3a9fd5,_0x3d6fa8,_0x3a9fd5[_0xfaf0('0x61')],_0x2bc8aa,_0xfaf0('0x55'));})[_0xfaf0('0x2a')](function(_0x33a377){_0x117b5b=_0x33a377;logger[_0xfaf0('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x117b5b['id']);logger[_0xfaf0('0x1e')](_0xfaf0('0x62'),_0x117b5b['id'],_0x4019dd[_0xfaf0('0x4b')],_0x4f0518['type']);switch(_0x4f0518[_0xfaf0('0x3a')]){case _0xfaf0('0x63'):emit(util['format'](_0xfaf0('0x64'),_0x4019dd[_0xfaf0('0x4b')]),_0xfaf0('0x65'),{'recordId':_0x117b5b['id']});break;case _0xfaf0('0x66'):emit(util[_0xfaf0('0x3f')]('user:%s',_0x4019dd['name']),_0xfaf0('0x67'),{'uri':util['format'](_0xfaf0('0x68'),_0x2bc8aa[_0xfaf0('0x69')],_0x117b5b['id'])});break;default:logger[_0xfaf0('0x6a')](_0xfaf0('0x6b'));}})[_0xfaf0('0x6c')](function(_0x2de721){logger[_0xfaf0('0x6a')]('[QUEUE]',_0x2de721);});};exports['outbound']=function(_0x53446f,_0x240339,_0x5aa7a4,_0x43a934,_0x5babdd,_0x49fa2f,_0x56d800){var _0x42a673,_0x348a75,_0x79786f,_0x37cfc4;_0x49fa2f[_0xfaf0('0x56')]=intUtil[_0xfaf0('0x57')](_0x49fa2f[_0xfaf0('0x56')]);_0x49fa2f['remoteUri']=intUtil[_0xfaf0('0x57')](_0x49fa2f[_0xfaf0('0x6d')]);if(_0x56d800&&_0x56d800[_0xfaf0('0x6e')]&&_0x56d800[_0xfaf0('0x6e')]!=='none'){logger[_0xfaf0('0x1e')](_0xfaf0('0x6f'),_0xfaf0('0x5a'));_0x240339[_0xfaf0('0x5d')]=util[_0xfaf0('0x3f')](_0xfaf0('0x5b'),_0x49fa2f[_0xfaf0('0x56')],_0x240339[_0xfaf0('0x5c')],md5(_0x240339[_0xfaf0('0x5c')]));}return getConnection(_0x49fa2f)['then'](function(_0x2d01f7){_0x37cfc4=_0x2d01f7;return getUser(_0x49fa2f,_0x43a934['email'],_0x37cfc4);})[_0xfaf0('0x2a')](function(_0x2beab5){_0x42a673=_0x2beab5;return getEndUser(_0x49fa2f,_0x5aa7a4,_0x240339[_0xfaf0('0x70')],_0x240339['destcalleridnum'],_0x37cfc4);})[_0xfaf0('0x2a')](function(_0x22c11f){_0x348a75=_0x22c11f;return getTicket(_0x49fa2f,_0x42a673,_0x348a75,_0x5aa7a4,_0x240339,_0x5aa7a4[_0xfaf0('0x61')],_0x37cfc4,_0xfaf0('0x71'));})['then'](function(_0x32d4d8){_0x79786f=_0x32d4d8;logger[_0xfaf0('0x1e')](_0xfaf0('0x72'),_0x79786f['id']);logger['info'](_0xfaf0('0x73'),_0x79786f['id'],_0x43a934[_0xfaf0('0x4b')],_0x49fa2f[_0xfaf0('0x3a')]);switch(_0x49fa2f['type']){case _0xfaf0('0x63'):emit(util['format'](_0xfaf0('0x64'),_0x43a934['name']),_0xfaf0('0x65'),{'recordId':_0x79786f['id']});break;case'newTab':emit(util[_0xfaf0('0x3f')](_0xfaf0('0x64'),_0x43a934[_0xfaf0('0x4b')]),_0xfaf0('0x67'),{'uri':util[_0xfaf0('0x3f')](_0xfaf0('0x68'),_0x37cfc4[_0xfaf0('0x69')],_0x79786f['id'])});break;default:logger[_0xfaf0('0x6a')]('[OUTBOUND]',_0xfaf0('0x74'));}})[_0xfaf0('0x6c')](function(_0x5b5d3c){logger[_0xfaf0('0x6a')]('[OUTBOUND]',_0x5b5d3c);});};exports[_0xfaf0('0x75')]=function(_0x366c5f,_0x2c93ab,_0x2b918a,_0x2e13e5,_0x4654e8,_0x5e44e5){var _0x3fea18,_0x46f65f,_0x2c6cf0,_0x300999;_0x5e44e5[_0xfaf0('0x56')]=intUtil[_0xfaf0('0x57')](_0x5e44e5[_0xfaf0('0x56')]);_0x5e44e5[_0xfaf0('0x6d')]=intUtil[_0xfaf0('0x57')](_0x5e44e5['remoteUri']);if(_0x4654e8&&_0x4654e8[_0xfaf0('0x58')]){logger['info']('['+_0x2c93ab[_0xfaf0('0x76')][_0xfaf0('0x77')]()+']',_0xfaf0('0x5a'));_0x2c93ab[_0xfaf0('0x5d')]=util['format'](_0xfaf0('0x5b'),_0x5e44e5[_0xfaf0('0x56')],_0x2c93ab[_0xfaf0('0x5c')],md5(_0x2c93ab[_0xfaf0('0x5c')]));}else{_0x2c93ab[_0xfaf0('0x5d')]='';}return getConnection(_0x5e44e5)[_0xfaf0('0x2a')](function(_0x385ff6){_0x300999=_0x385ff6;if(!_[_0xfaf0('0x21')](_0x2e13e5)){return getUser(_0x5e44e5,_0x2e13e5[_0xfaf0('0x4b')],_0x300999);}else{return getUser(_0x5e44e5,null,_0x300999);}})[_0xfaf0('0x2a')](function(_0x389f13){_0x3fea18=_0x389f13;return getEndUser(_0x5e44e5,_0x2b918a,_0x2c93ab[_0xfaf0('0x5f')],_0x2c93ab[_0xfaf0('0x60')],_0x300999);})['then'](function(_0x43b8e6){_0x46f65f=_0x43b8e6;return getTicket(_0x5e44e5,_0x3fea18,_0x46f65f,_0x2b918a,_0x2c93ab,_0x2b918a[_0xfaf0('0x61')],_0x300999);})[_0xfaf0('0x2a')](function(_0x383d4d){_0x2c6cf0=_0x383d4d;logger['info']('['+_0x2c93ab[_0xfaf0('0x76')][_0xfaf0('0x77')]()+']\x20Ticket\x20%s\x20created.',_0x2c6cf0['id']);logger[_0xfaf0('0x1e')]('['+_0x2c93ab[_0xfaf0('0x76')][_0xfaf0('0x77')]()+_0xfaf0('0x78'),_0x5e44e5['type']);})[_0xfaf0('0x6c')](function(_0x124f9c){logger[_0xfaf0('0x6a')]('['+_0x2c93ab[_0xfaf0('0x76')][_0xfaf0('0x77')]()+']',_0x124f9c);});}; \ 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 f6a24c4..e1bfb65 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 _0xca7a=['length','active','userId','sys_id','adminId','adminEmail','],\x20getUser\x20crm','catch','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','nameField','customField','toLowerCase','content','toString','picklist','idField','type','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects','getString','Descriptions','Fields','ticketId','number',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','info','toUpperCase','],\x20getAdminUser\x20crm','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity'];(function(_0xfbac0b,_0x20b38b){var _0x14e054=function(_0x5ef004){while(--_0x5ef004){_0xfbac0b['push'](_0xfbac0b['shift']());}};_0x14e054(++_0x20b38b);}(_0xca7a,0x19e));var _0xaca7=function(_0xd79494,_0x1fcda7){_0xd79494=_0xd79494-0x0;var _0x1c1698=_0xca7a[_0xd79494];return _0x1c1698;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0xaca7('0x0'));var util=require('util');var md5=require(_0xaca7('0x1'));var Redis=require(_0xaca7('0x2'));var intUtil=require(_0xaca7('0x3'));var config=require(_0xaca7('0x4'));var logger=require(_0xaca7('0x5'))(_0xaca7('0x6'));config[_0xaca7('0x7')]=_['defaults'](config[_0xaca7('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xaca7('0x8'))(new Redis(config[_0xaca7('0x7')]));function getAdminUser(_0x23f1e2,_0xf20e8e,_0x22c982,_0x22f4cc,_0x8bbd68,_0x2403c8){return new Promise(function(_0x25cf87,_0x339c6d){var _0xca4889={'method':_0xaca7('0x9'),'uri':_0x22f4cc+_0xaca7('0xa')+'&'+_0x8bbd68+'&'+_0x2403c8,'auth':_0xf20e8e,'json':!![]};return rp(_0xca4889)[_0xaca7('0xb')](function(_0x1885cc){if(_0x1885cc[_0xaca7('0xc')]['length']>0x0){_0x22c982['adminId']=_0x1885cc[_0xaca7('0xc')][0x0]['sys_id'];}logger[_0xaca7('0xd')]('['+[_0x23f1e2[_0xaca7('0xe')]()]+_0xaca7('0xf'),_0x22c982);_0x25cf87(_0x22c982);})['catch'](function(_0x258114){logger['error']('['+[_0x23f1e2[_0xaca7('0xe')]()]+']',_0x258114[_0xaca7('0x10')]);_0x339c6d(_0x258114[_0xaca7('0x10')]);});});}function getUser(_0x3337ba,_0x42a243,_0x4f129b,_0x2e9721,_0x27a882){return function(_0x208c5b){logger[_0xaca7('0xd')]('['+[_0x3337ba['toUpperCase']()]+_0xaca7('0x11'),_0x208c5b);return new Promise(function(_0x4c8d40,_0x4c1118){if(intUtil[_0xaca7('0x12')](_0x208c5b[_0xaca7('0x13')])){var _0x439beb={'method':_0xaca7('0x9'),'uri':_0x4f129b+'sys_user?sysparm_query=email%3D'+_0x208c5b['userEmail']+'&'+_0x2e9721+'&'+_0x27a882,'auth':_0x42a243,'json':!![]};logger[_0xaca7('0xd')]('['+[_0x3337ba[_0xaca7('0xe')]()]+_0xaca7('0x14'),_0x439beb);return rp(_0x439beb)[_0xaca7('0xb')](function(_0x5e684c){logger['info']('['+[_0x3337ba[_0xaca7('0xe')]()]+_0xaca7('0x15'),_0x5e684c);if(_0x5e684c[_0xaca7('0xc')][_0xaca7('0x16')]>0x0&&String(_0x5e684c[_0xaca7('0xc')][0x0][_0xaca7('0x17')])==='true'){_0x208c5b[_0xaca7('0x18')]=_0x5e684c[_0xaca7('0xc')][0x0][_0xaca7('0x19')];}else{_0x208c5b['userId']=_0x208c5b[_0xaca7('0x1a')];_0x208c5b[_0xaca7('0x13')]=_0x208c5b[_0xaca7('0x1b')];}logger[_0xaca7('0xd')]('['+[_0x3337ba[_0xaca7('0xe')]()]+_0xaca7('0x1c'),_0x208c5b);_0x4c8d40(_0x208c5b);})[_0xaca7('0x1d')](function(_0x51a25c){logger[_0xaca7('0x1e')]('['+[_0x3337ba[_0xaca7('0xe')]()]+']',_0x51a25c['message']);_0x4c1118(_0x51a25c['message']);});}else{logger['info']('['+[_0x3337ba[_0xaca7('0xe')]()]+_0xaca7('0x1f'));_0x208c5b[_0xaca7('0x18')]=_0x208c5b[_0xaca7('0x1a')];_0x208c5b['userEmail']=_0x208c5b[_0xaca7('0x1b')];_0x4c8d40(_0x208c5b);}});};}function createEndUser(_0x1c3660,_0x11af47,_0x38b37e,_0x2c4bfc,_0x1324fa){logger[_0xaca7('0xd')]('['+[_0x1c3660[_0xaca7('0xe')]()]+_0xaca7('0x20'),_0x38b37e);return new Promise(function(_0x1dd564,_0x39c9cc){var _0x11dff7={'method':_0xaca7('0x21'),'uri':_0x2c4bfc+_0xaca7('0x22')+_0x1324fa,'body':{'user_name':_0x38b37e[_0xaca7('0x23')],'roles':_0xaca7('0x24'),'first_name':_0x38b37e[_0xaca7('0x23')],'active':'true','date_format':_0xaca7('0x25'),'phone':_0x38b37e[_0xaca7('0x23')]},'auth':_0x11af47,'json':!![]};return rp(_0x11dff7)[_0xaca7('0xb')](function(_0x367909){logger[_0xaca7('0xd')]('['+[_0x1c3660['toUpperCase']()]+'],\x20EndUser\x20schema',_0x367909['result']);_0x38b37e['endUserId']=_0x367909['result'][_0xaca7('0x19')];_0x1dd564(_0x38b37e);})[_0xaca7('0x1d')](function(_0x472ea7){logger[_0xaca7('0x1e')]('['+[_0x1c3660[_0xaca7('0xe')]()]+']',_0x472ea7[_0xaca7('0x10')]);_0x39c9cc(_0x472ea7[_0xaca7('0x10')]);});});}function getEndUser(_0x1f7923,_0x420b4a,_0x551986,_0x55d0e5,_0x37e436){return function(_0x2f4f4c){logger[_0xaca7('0xd')]('['+[_0x1f7923[_0xaca7('0xe')]()]+'],\x20getEndUser\x20input\x20crm',_0x2f4f4c);return new Promise(function(_0x2673e5,_0xf35948){var _0x92adad={'method':_0xaca7('0x9'),'uri':_0x551986+'sys_user?sysparm_query=phone%3D'+_0x2f4f4c['endUserNumber']+'&'+_0x55d0e5+'&'+_0x37e436,'auth':_0x420b4a,'json':!![]};return rp(_0x92adad)[_0xaca7('0xb')](function(_0x2ea54a){if(_0x2ea54a[_0xaca7('0xc')][_0xaca7('0x16')]>0x0){_0x2f4f4c[_0xaca7('0x26')]=_0x2ea54a[_0xaca7('0xc')][0x0][_0xaca7('0x19')];logger['info']('['+[_0x1f7923[_0xaca7('0xe')]()]+_0xaca7('0x27'),_0x2f4f4c);_0x2673e5(_0x2f4f4c);}else{return createEndUser(_0x1f7923,_0x420b4a,_0x2f4f4c,_0x551986,_0x55d0e5)[_0xaca7('0xb')](function(_0x2c981c){logger[_0xaca7('0xd')]('['+[_0x1f7923[_0xaca7('0xe')]()]+_0xaca7('0x28'),_0x2c981c);_0x2673e5(_0x2c981c);});}})[_0xaca7('0x1d')](function(_0x4cdba3){logger['error']('['+[_0x1f7923[_0xaca7('0xe')]()]+']',_0x4cdba3['message']);_0xf35948(_0x4cdba3[_0xaca7('0x10')]);});});};}function getCustomFields(_0x14a107,_0x54bf2e){var _0x2b84e7={};if(_0x14a107[_0xaca7('0x16')]>0x0){_[_0xaca7('0x29')](_0x14a107,function(_0x2352d6){if(_[_0xaca7('0x2a')]([_0xaca7('0x2b'),'picklist'],_0x2352d6['type'])&&_0x2352d6[_0xaca7('0x2c')]&&!_0x2352d6[_0xaca7('0x2d')]){_0x2b84e7[_0x2352d6['nameField'][_0xaca7('0x2e')]()]=_0x2352d6[_0xaca7('0x2f')][_0xaca7('0x30')]();}else if(_[_0xaca7('0x2a')]([_0xaca7('0x2b'),_0xaca7('0x31')],_0x2352d6['type'])&&_0x2352d6[_0xaca7('0x32')]&&_0x2352d6[_0xaca7('0x2d')]){_0x2b84e7[_0x2352d6[_0xaca7('0x32')][_0xaca7('0x2e')]()]=_0x2352d6[_0xaca7('0x2f')][_0xaca7('0x30')]();}else if(_0x2352d6[_0xaca7('0x33')]===_0xaca7('0x34')&&_0x2352d6[_0xaca7('0x35')]&&_0x2352d6[_0xaca7('0x32')]&&_0x2352d6[_0xaca7('0x2d')]){_0x2b84e7[_0x2352d6[_0xaca7('0x32')][_0xaca7('0x2e')]()]=_0x54bf2e[_0x2352d6[_0xaca7('0x35')]][_0xaca7('0x30')]();}else if(_0x2352d6['type']===_0xaca7('0x36')&&_0x2352d6['Variable']&&_0x2352d6[_0xaca7('0x37')]['name']&&_0x2352d6[_0xaca7('0x32')]&&_0x2352d6[_0xaca7('0x2d')]){_0x2b84e7[_0x2352d6[_0xaca7('0x32')][_0xaca7('0x2e')]()]=_0x54bf2e[_0x2352d6[_0xaca7('0x37')][_0xaca7('0x38')][_0xaca7('0x2e')]()]['toString']();}});}return _0x2b84e7;}function getTicket(_0x76d83f,_0x575a3b,_0x22da96,_0x4388ec,_0x52eb42,_0x263b92){return function(_0x1a7865){logger[_0xaca7('0xd')]('['+[_0x76d83f[_0xaca7('0xe')]()]+_0xaca7('0x39'),_0x1a7865);return new Promise(function(_0x41e99d,_0x3c18d8){var _0x19603c=_0x76d83f[_0xaca7('0x2e')]()===_0xaca7('0x3a')?_0x1a7865[_0xaca7('0x18')]:_0x1a7865[_0xaca7('0x26')];var _0xb1d894={'method':_0xaca7('0x21'),'uri':_0x22da96+_0xaca7('0x3b')+'?'+_0x263b92,'body':Object[_0xaca7('0x3c')]({},{'active':'true','caller_id':_0x19603c,'assigned_to':_0x1a7865[_0xaca7('0x18')],'short_description':intUtil['getString'](_0x4388ec[_0xaca7('0x3d')],_0x52eb42,'\x20'),'description':intUtil[_0xaca7('0x3e')](_0x4388ec[_0xaca7('0x3f')],_0x52eb42,'\x0a')},getCustomFields(_0x4388ec[_0xaca7('0x40')],_0x52eb42)),'auth':_0x575a3b,'json':!![]};return rp(_0xb1d894)[_0xaca7('0xb')](function(_0x4aeec9){logger[_0xaca7('0xd')]('['+[_0x76d83f['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x4aeec9['result']);_0x1a7865[_0xaca7('0x41')]=_0x4aeec9['result'][_0xaca7('0x19')];_0x1a7865['ticketNumber']=_0x4aeec9[_0xaca7('0xc')][_0xaca7('0x42')];logger[_0xaca7('0xd')]('['+[_0x76d83f['toUpperCase']()]+_0xaca7('0x43'),_0x1a7865);_0x41e99d(_0x1a7865);})['catch'](function(_0x268d9d){logger['error']('['+[_0x76d83f['toUpperCase']()]+']',_0x268d9d['message']);_0x3c18d8(_0x268d9d['message']);});});};}function createRemoteTag(_0x534bd6,_0x39e5e2,_0x207915,_0x268ede){return new Promise(function(_0x13ff94,_0x350b51){var _0x32f18e={'method':_0xaca7('0x21'),'uri':_0x207915+_0xaca7('0x44')+'?'+_0x268ede,'body':{'short_description':_0x534bd6,'global':!![],'active':!![],'name':_0x534bd6},'auth':_0x39e5e2,'json':!![]};return rp(_0x32f18e)[_0xaca7('0xb')](function(_0x122a50){var _0x48f9cd=_0x122a50[_0xaca7('0xc')]['sys_id'];_0x13ff94(_0x48f9cd);});});}function getRemoteTag(_0x1f2f4f,_0x4b2211,_0x5d2762,_0xf39e12,_0x2f85c0){return new Promise(function(_0x5a9952,_0x58ced1){var _0x1e1d8c={'method':_0xaca7('0x9'),'uri':_0x5d2762+_0xaca7('0x44')+'?sysparm_query=name%3D'+_0x1f2f4f+'&'+_0xf39e12,'auth':_0x4b2211,'json':!![]};return rp(_0x1e1d8c)[_0xaca7('0xb')](function(_0x564863){if(_0x564863[_0xaca7('0xc')][_0xaca7('0x16')]>0x0){var _0x3afc6e=_0x564863[_0xaca7('0xc')][0x0]['sys_id'];_0x5a9952(_0x3afc6e);}else{return createRemoteTag(_0x1f2f4f,_0x4b2211,_0x5d2762,_0xf39e12)[_0xaca7('0xb')](function(_0x5d3bfa){_0x5a9952(_0x5d3bfa);});}});});}function assignTagToIncident(_0x3a420e,_0x462a2f,_0x51415d,_0x53f81c,_0x3766ea){return new Promise(function(_0x5b049a,_0x535f67){var _0x3cc080={'method':_0xaca7('0x21'),'uri':_0x51415d+_0xaca7('0x45')+'?'+_0x3766ea,'body':{'label':_0x3a420e,'table':'incident','id_type':_0xaca7('0x46'),'table_key':_0x53f81c[_0xaca7('0x41')],'title':_0xaca7('0x47')+_0x53f81c[_0xaca7('0x48')],'id_display':_0x53f81c[_0xaca7('0x48')]},'auth':_0x462a2f,'json':!![]};return rp(_0x3cc080)[_0xaca7('0xb')](function(_0x25b99e){_0x5b049a();})[_0xaca7('0x1d')](function(){_0x5b049a();});});}function manageTags(_0x3d1832,_0x4f2939,_0x30fdb7,_0x5c6bb3,_0x31319f,_0x21323b,_0xf7301a){return new Promise(function(_0x45c1ab,_0x1e1231){var _0x2a83e4=[];_0x4f2939[_0xaca7('0x29')](function(_0x179223){_0x2a83e4[_0xaca7('0x49')](getRemoteTag(_0x179223,_0x30fdb7,_0x5c6bb3,_0x21323b,_0xf7301a));});return Promise[_0xaca7('0x4a')](_0x2a83e4)[_0xaca7('0xb')](function(_0x201fa2){if(_0x201fa2['length']){logger[_0xaca7('0xd')]('['+[_0x3d1832[_0xaca7('0xe')]()]+_0xaca7('0x4b'),_0x201fa2);var _0x51dd3d=[];_0x201fa2[_0xaca7('0x29')](function(_0x4b3192){_0x51dd3d[_0xaca7('0x49')](assignTagToIncident(_0x4b3192,_0x30fdb7,_0x5c6bb3,_0x31319f,_0x21323b));});return Promise[_0xaca7('0x4a')](_0x51dd3d)[_0xaca7('0xb')](function(){_0x45c1ab();})['catch'](function(){_0x45c1ab();});}else{_0x45c1ab();}});});}function getTags(_0x421c9d,_0x2e3f1d,_0x41ca3e,_0x50edca,_0x45ccfb,_0x5c36e7){return function(_0x492c9d){return new Promise(function(_0xdcad46,_0x3b4700){var _0x27af7e=[];var _0x2859b7=_0x50edca[_0xaca7('0x4c')];if(_0x2859b7&&_0x2859b7[_0xaca7('0x16')]>0x0){_0x27af7e=_[_0xaca7('0x4d')](_0x2859b7,_0xaca7('0x38'));}if(_0x27af7e[_0xaca7('0x16')]>0x0){return manageTags(_0x421c9d,_0x27af7e,_0x2e3f1d,_0x41ca3e,_0x492c9d,_0x45ccfb,_0x5c36e7)['then'](function(){_0xdcad46(_0x492c9d);});}else{_0xdcad46(_0x492c9d);}});};}function emit(_0x153aa2,_0x49c538,_0x8565d2){var _0x70ff5a=_0xaca7('0x4e')+_0xaca7('0x4f')+_0xaca7('0x50')+_0xaca7('0x51');var _0x3f79e2={'uri':_0x153aa2+_0xaca7('0x52')+_0x8565d2+_0x70ff5a};io['to'](util[_0xaca7('0x53')]('user:%s',_0x49c538))[_0xaca7('0x54')]('trigger:browser:url',_0x3f79e2);}exports['cs']=function(_0x2e54e0,_0x3d2c1f,_0x153e7f,_0x1c06e1,_0xb03253,_0x58aba0,_0x49222c,_0x3aac0d){var _0x1f1acd={};var _0x1ef1ec={'user':_0x58aba0[_0xaca7('0x55')],'pass':_0x58aba0[_0xaca7('0x56')]};var _0x22c820=_0xaca7('0x57');var _0x18f6ee=_0xaca7('0x58');_0x58aba0[_0xaca7('0x59')]=intUtil[_0xaca7('0x5a')](_0x58aba0[_0xaca7('0x59')]);_0x58aba0[_0xaca7('0x5b')]=intUtil['stripTrailingSlash'](_0x58aba0[_0xaca7('0x5b')]);var _0x345562=util[_0xaca7('0x53')]('%s/api/now/table/',_0x58aba0['remoteUri']);_0x1f1acd['userEmail']=!_[_0xaca7('0x5c')](_0x1c06e1)?_0x1c06e1[_0xaca7('0x5d')]:null;_0x1f1acd[_0xaca7('0x1b')]=_0x58aba0[_0xaca7('0x5d')];_0x1f1acd[_0xaca7('0x23')]=_0x3aac0d['toLowerCase']()===_0xaca7('0x3a')?_0x3d2c1f[_0xaca7('0x5e')]:_0x3d2c1f['calleridnum'];_0x1f1acd[_0xaca7('0x5f')]=_0x3aac0d===_0xaca7('0x60')||_0x3aac0d===_0xaca7('0x61')?_0xaca7('0x60'):_0xaca7('0x3a');var _0x3eebe3=util[_0xaca7('0x53')](_0xaca7('0x62'),_0x58aba0['serverUrl'],_0x3d2c1f['uniqueid'],md5(_0x3d2c1f[_0xaca7('0x63')]));if(_0xb03253&&_0xb03253['monitor_format']){logger['info'](_0xaca7('0x64'),_0xaca7('0x65'));_0x3d2c1f['recordingURL']=_0x3eebe3;}else if(_0x49222c&&_0x49222c[_0xaca7('0x66')]&&_0x49222c[_0xaca7('0x66')]!==_0xaca7('0x67')){logger[_0xaca7('0xd')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3d2c1f[_0xaca7('0x68')]=_0x3eebe3;}else{_0x3d2c1f[_0xaca7('0x68')]='';}return getAdminUser(_0x3aac0d,_0x1ef1ec,_0x1f1acd,_0x345562,_0x18f6ee,_0x22c820)[_0xaca7('0xb')](getUser(_0x3aac0d,_0x1ef1ec,_0x345562,_0x18f6ee,_0x22c820))[_0xaca7('0xb')](getEndUser(_0x3aac0d,_0x1ef1ec,_0x345562,_0x18f6ee,_0x22c820))[_0xaca7('0xb')](getTicket(_0x3aac0d,_0x1ef1ec,_0x345562,_0x153e7f,_0x3d2c1f,_0x18f6ee))[_0xaca7('0xb')](function(_0x5485ae){logger[_0xaca7('0xd')](util['format'](_0xaca7('0x69'),_0x5485ae[_0xaca7('0x41')]));logger['info'](util[_0xaca7('0x53')](_0xaca7('0x6a'),_0x3aac0d));if(_0x3aac0d!==_0xaca7('0x61')){logger[_0xaca7('0xd')]('['+[_0x3aac0d[_0xaca7('0xe')]()]+']',_0xaca7('0x6b'));emit(_0x58aba0[_0xaca7('0x59')],_0x1c06e1[_0xaca7('0x38')],_0x5485ae[_0xaca7('0x41')]);}})[_0xaca7('0x1d')](function(_0x4f717a){logger[_0xaca7('0x1e')]('['+[_0x3aac0d[_0xaca7('0xe')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xaca7('0x6c')](_0x4f717a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xfa6f=['toString','type','idField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','POST','incident','assign','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','all','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%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/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','md5','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','],\x20getUser\x20input\x20crm','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','then','active','userId','adminEmail','],\x20getUser\x20crm','error','message',']\x20using\x20admin\x20profile','endUserNumber','user','true','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','customField','nameField','toLowerCase'];(function(_0x5805c4,_0x594dd1){var _0x2370d2=function(_0x3d5c0f){while(--_0x3d5c0f){_0x5805c4['push'](_0x5805c4['shift']());}};_0x2370d2(++_0x594dd1);}(_0xfa6f,0xa9));var _0xffa6=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xfa6f[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0xffa6('0x0'));var Promise=require(_0xffa6('0x1'));var rp=require(_0xffa6('0x2'));var util=require('util');var md5=require(_0xffa6('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xffa6('0x4'));var logger=require(_0xffa6('0x5'))(_0xffa6('0x6'));config[_0xffa6('0x7')]=_[_0xffa6('0x8')](config['redis'],{'host':_0xffa6('0x9'),'port':0x18eb});var io=require(_0xffa6('0xa'))(new Redis(config[_0xffa6('0x7')]));function getAdminUser(_0x2f3dce,_0x44025e,_0x581a40,_0x50046f,_0x273d8f,_0x5840f7){return new Promise(function(_0x5efd81,_0x1cc158){var _0x157b9f={'method':_0xffa6('0xb'),'uri':_0x50046f+_0xffa6('0xc')+'&'+_0x273d8f+'&'+_0x5840f7,'auth':_0x44025e,'json':!![]};return rp(_0x157b9f)['then'](function(_0x4fb922){if(_0x4fb922[_0xffa6('0xd')][_0xffa6('0xe')]>0x0){_0x581a40[_0xffa6('0xf')]=_0x4fb922[_0xffa6('0xd')][0x0][_0xffa6('0x10')];}logger[_0xffa6('0x11')]('['+[_0x2f3dce[_0xffa6('0x12')]()]+_0xffa6('0x13'),_0x581a40);_0x5efd81(_0x581a40);})[_0xffa6('0x14')](function(_0x239067){logger['error']('['+[_0x2f3dce[_0xffa6('0x12')]()]+']',_0x239067['message']);_0x1cc158(_0x239067['message']);});});}function getUser(_0x4df5cf,_0x1430ae,_0x12d25c,_0x456861,_0x5bde7a){return function(_0x11303c){logger[_0xffa6('0x11')]('['+[_0x4df5cf[_0xffa6('0x12')]()]+_0xffa6('0x15'),_0x11303c);return new Promise(function(_0x5baf00,_0x5bbf44){if(intUtil['validateEmail'](_0x11303c['userEmail'])){var _0x95aab3={'method':_0xffa6('0xb'),'uri':_0x12d25c+_0xffa6('0x16')+_0x11303c[_0xffa6('0x17')]+'&'+_0x456861+'&'+_0x5bde7a,'auth':_0x1430ae,'json':!![]};logger[_0xffa6('0x11')]('['+[_0x4df5cf['toUpperCase']()]+_0xffa6('0x18'),_0x95aab3);return rp(_0x95aab3)[_0xffa6('0x19')](function(_0x1d4b08){logger['info']('['+[_0x4df5cf['toUpperCase']()]+'],\x20getUser\x20entity',_0x1d4b08);if(_0x1d4b08['result'][_0xffa6('0xe')]>0x0&&String(_0x1d4b08['result'][0x0][_0xffa6('0x1a')])==='true'){_0x11303c[_0xffa6('0x1b')]=_0x1d4b08[_0xffa6('0xd')][0x0][_0xffa6('0x10')];}else{_0x11303c[_0xffa6('0x1b')]=_0x11303c[_0xffa6('0xf')];_0x11303c['userEmail']=_0x11303c[_0xffa6('0x1c')];}logger[_0xffa6('0x11')]('['+[_0x4df5cf[_0xffa6('0x12')]()]+_0xffa6('0x1d'),_0x11303c);_0x5baf00(_0x11303c);})[_0xffa6('0x14')](function(_0x2b120f){logger[_0xffa6('0x1e')]('['+[_0x4df5cf[_0xffa6('0x12')]()]+']',_0x2b120f[_0xffa6('0x1f')]);_0x5bbf44(_0x2b120f[_0xffa6('0x1f')]);});}else{logger['info']('['+[_0x4df5cf[_0xffa6('0x12')]()]+_0xffa6('0x20'));_0x11303c['userId']=_0x11303c[_0xffa6('0xf')];_0x11303c[_0xffa6('0x17')]=_0x11303c['adminEmail'];_0x5baf00(_0x11303c);}});};}function createEndUser(_0x3a2472,_0x514340,_0x3b9df7,_0x9fb930,_0x3179b1){logger[_0xffa6('0x11')]('['+[_0x3a2472[_0xffa6('0x12')]()]+'],\x20createEndUser\x20input\x20crm',_0x3b9df7);return new Promise(function(_0x41d5a2,_0x50dd7b){var _0x271bdd={'method':'POST','uri':_0x9fb930+'sys_user?'+_0x3179b1,'body':{'user_name':_0x3b9df7[_0xffa6('0x21')],'roles':_0xffa6('0x22'),'first_name':_0x3b9df7[_0xffa6('0x21')],'active':_0xffa6('0x23'),'date_format':_0xffa6('0x24'),'phone':_0x3b9df7[_0xffa6('0x21')]},'auth':_0x514340,'json':!![]};return rp(_0x271bdd)[_0xffa6('0x19')](function(_0xadd046){logger[_0xffa6('0x11')]('['+[_0x3a2472['toUpperCase']()]+'],\x20EndUser\x20schema',_0xadd046['result']);_0x3b9df7[_0xffa6('0x25')]=_0xadd046[_0xffa6('0xd')][_0xffa6('0x10')];_0x41d5a2(_0x3b9df7);})[_0xffa6('0x14')](function(_0x412f93){logger[_0xffa6('0x1e')]('['+[_0x3a2472[_0xffa6('0x12')]()]+']',_0x412f93['message']);_0x50dd7b(_0x412f93[_0xffa6('0x1f')]);});});}function getEndUser(_0x3515b3,_0x56deaa,_0x4fa82f,_0x5a4afa,_0x10382f){return function(_0x5bdafc){logger[_0xffa6('0x11')]('['+[_0x3515b3['toUpperCase']()]+_0xffa6('0x26'),_0x5bdafc);return new Promise(function(_0x192817,_0x351f51){var _0x29634c={'method':'GET','uri':_0x4fa82f+_0xffa6('0x27')+_0x5bdafc['endUserNumber']+'&'+_0x5a4afa+'&'+_0x10382f,'auth':_0x56deaa,'json':!![]};return rp(_0x29634c)['then'](function(_0x25e069){if(_0x25e069[_0xffa6('0xd')][_0xffa6('0xe')]>0x0){_0x5bdafc[_0xffa6('0x25')]=_0x25e069[_0xffa6('0xd')][0x0]['sys_id'];logger[_0xffa6('0x11')]('['+[_0x3515b3[_0xffa6('0x12')]()]+_0xffa6('0x28'),_0x5bdafc);_0x192817(_0x5bdafc);}else{return createEndUser(_0x3515b3,_0x56deaa,_0x5bdafc,_0x4fa82f,_0x5a4afa)['then'](function(_0x4380ed){logger[_0xffa6('0x11')]('['+[_0x3515b3[_0xffa6('0x12')]()]+_0xffa6('0x29'),_0x4380ed);_0x192817(_0x4380ed);});}})[_0xffa6('0x14')](function(_0x4c2cd8){logger[_0xffa6('0x1e')]('['+[_0x3515b3[_0xffa6('0x12')]()]+']',_0x4c2cd8[_0xffa6('0x1f')]);_0x351f51(_0x4c2cd8['message']);});});};}function getCustomFields(_0x19d0f3,_0x5f05ae){var _0x230ad6={};if(_0x19d0f3['length']>0x0){_[_0xffa6('0x2a')](_0x19d0f3,function(_0x1a647d){if(_[_0xffa6('0x2b')]([_0xffa6('0x2c'),_0xffa6('0x2d')],_0x1a647d['type'])&&_0x1a647d['nameField']&&!_0x1a647d[_0xffa6('0x2e')]){_0x230ad6[_0x1a647d[_0xffa6('0x2f')][_0xffa6('0x30')]()]=_0x1a647d['content'][_0xffa6('0x31')]();}else if(_[_0xffa6('0x2b')]([_0xffa6('0x2c'),'picklist'],_0x1a647d[_0xffa6('0x32')])&&_0x1a647d[_0xffa6('0x33')]&&_0x1a647d[_0xffa6('0x2e')]){_0x230ad6[_0x1a647d[_0xffa6('0x33')][_0xffa6('0x30')]()]=_0x1a647d['content'][_0xffa6('0x31')]();}else if(_0x1a647d[_0xffa6('0x32')]==='variable'&&_0x1a647d[_0xffa6('0x34')]&&_0x1a647d[_0xffa6('0x33')]&&_0x1a647d[_0xffa6('0x2e')]){_0x230ad6[_0x1a647d[_0xffa6('0x33')][_0xffa6('0x30')]()]=_0x5f05ae[_0x1a647d[_0xffa6('0x34')]]['toString']();}else if(_0x1a647d['type']===_0xffa6('0x35')&&_0x1a647d[_0xffa6('0x36')]&&_0x1a647d[_0xffa6('0x36')][_0xffa6('0x37')]&&_0x1a647d[_0xffa6('0x33')]&&_0x1a647d[_0xffa6('0x2e')]){_0x230ad6[_0x1a647d[_0xffa6('0x33')][_0xffa6('0x30')]()]=_0x5f05ae[_0x1a647d['Variable']['name'][_0xffa6('0x30')]()]['toString']();}});}return _0x230ad6;}function getTicket(_0x1354ef,_0x10bf47,_0x299a37,_0xecdb9d,_0xea2516,_0x34ad83){return function(_0x1cfea3){logger[_0xffa6('0x11')]('['+[_0x1354ef[_0xffa6('0x12')]()]+_0xffa6('0x38'),_0x1cfea3);return new Promise(function(_0x38093b,_0xaca40c){var _0x2e90e9=_0x1354ef['toLowerCase']()==='outbound'?_0x1cfea3[_0xffa6('0x1b')]:_0x1cfea3['endUserId'];var _0x17f81a={'method':_0xffa6('0x39'),'uri':_0x299a37+_0xffa6('0x3a')+'?'+_0x34ad83,'body':Object[_0xffa6('0x3b')]({},{'active':_0xffa6('0x23'),'caller_id':_0x2e90e9,'assigned_to':_0x1cfea3[_0xffa6('0x1b')],'short_description':intUtil['getString'](_0xecdb9d[_0xffa6('0x3c')],_0xea2516,'\x20'),'description':intUtil[_0xffa6('0x3d')](_0xecdb9d[_0xffa6('0x3e')],_0xea2516,'\x0a')},getCustomFields(_0xecdb9d[_0xffa6('0x3f')],_0xea2516)),'auth':_0x10bf47,'json':!![]};return rp(_0x17f81a)[_0xffa6('0x19')](function(_0x4bba98){logger['info']('['+[_0x1354ef['toUpperCase']()]+_0xffa6('0x40'),_0x4bba98[_0xffa6('0xd')]);_0x1cfea3[_0xffa6('0x41')]=_0x4bba98[_0xffa6('0xd')][_0xffa6('0x10')];_0x1cfea3[_0xffa6('0x42')]=_0x4bba98[_0xffa6('0xd')][_0xffa6('0x43')];logger[_0xffa6('0x11')]('['+[_0x1354ef[_0xffa6('0x12')]()]+_0xffa6('0x44'),_0x1cfea3);_0x38093b(_0x1cfea3);})[_0xffa6('0x14')](function(_0x26a81f){logger[_0xffa6('0x1e')]('['+[_0x1354ef[_0xffa6('0x12')]()]+']',_0x26a81f[_0xffa6('0x1f')]);_0xaca40c(_0x26a81f[_0xffa6('0x1f')]);});});};}function createRemoteTag(_0xa1ad5c,_0x558b7b,_0x4352cb,_0x24e3e9){return new Promise(function(_0x479804,_0x368385){var _0x3f4334={'method':'POST','uri':_0x4352cb+'label'+'?'+_0x24e3e9,'body':{'short_description':_0xa1ad5c,'global':!![],'active':!![],'name':_0xa1ad5c},'auth':_0x558b7b,'json':!![]};return rp(_0x3f4334)[_0xffa6('0x19')](function(_0x4b227a){var _0x1c4f34=_0x4b227a['result']['sys_id'];_0x479804(_0x1c4f34);});});}function getRemoteTag(_0x13487c,_0x59e78b,_0x433635,_0x26fa35,_0x46dddc){return new Promise(function(_0xa52126,_0x5d48cd){var _0x563846={'method':_0xffa6('0xb'),'uri':_0x433635+_0xffa6('0x45')+_0xffa6('0x46')+_0x13487c+'&'+_0x26fa35,'auth':_0x59e78b,'json':!![]};return rp(_0x563846)[_0xffa6('0x19')](function(_0x38b4a9){if(_0x38b4a9[_0xffa6('0xd')]['length']>0x0){var _0x5d45a5=_0x38b4a9[_0xffa6('0xd')][0x0][_0xffa6('0x10')];_0xa52126(_0x5d45a5);}else{return createRemoteTag(_0x13487c,_0x59e78b,_0x433635,_0x26fa35)[_0xffa6('0x19')](function(_0x4f5469){_0xa52126(_0x4f5469);});}});});}function assignTagToIncident(_0x460239,_0x345389,_0x12557c,_0x11165c,_0x582dd9){return new Promise(function(_0x14402d,_0x3dfaed){var _0x156c0d={'method':_0xffa6('0x39'),'uri':_0x12557c+'label_entry'+'?'+_0x582dd9,'body':{'label':_0x460239,'table':_0xffa6('0x3a'),'id_type':_0xffa6('0x47'),'table_key':_0x11165c[_0xffa6('0x41')],'title':_0xffa6('0x48')+_0x11165c[_0xffa6('0x42')],'id_display':_0x11165c[_0xffa6('0x42')]},'auth':_0x345389,'json':!![]};return rp(_0x156c0d)[_0xffa6('0x19')](function(_0x393879){_0x14402d();})[_0xffa6('0x14')](function(){_0x14402d();});});}function manageTags(_0x216ab4,_0x5e88fa,_0x162cb4,_0x28bdab,_0x496964,_0x2df129,_0x1e54f6){return new Promise(function(_0x1cad0b,_0x23874e){var _0x2dc63c=[];_0x5e88fa[_0xffa6('0x2a')](function(_0x3b7dfe){_0x2dc63c['push'](getRemoteTag(_0x3b7dfe,_0x162cb4,_0x28bdab,_0x2df129,_0x1e54f6));});return Promise[_0xffa6('0x49')](_0x2dc63c)[_0xffa6('0x19')](function(_0x1e097b){if(_0x1e097b['length']){logger[_0xffa6('0x11')]('['+[_0x216ab4[_0xffa6('0x12')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1e097b);var _0x42b83f=[];_0x1e097b[_0xffa6('0x2a')](function(_0x418148){_0x42b83f['push'](assignTagToIncident(_0x418148,_0x162cb4,_0x28bdab,_0x496964,_0x2df129));});return Promise[_0xffa6('0x49')](_0x42b83f)['then'](function(){_0x1cad0b();})[_0xffa6('0x14')](function(){_0x1cad0b();});}else{_0x1cad0b();}});});}function getTags(_0x21df10,_0x1b38e1,_0x2c71e4,_0x23cb5e,_0x577984,_0x2658aa){return function(_0x44c7e2){return new Promise(function(_0x3224ad,_0x2102f1){var _0x50914a=[];var _0x25fdb0=_0x23cb5e[_0xffa6('0x4a')];if(_0x25fdb0&&_0x25fdb0[_0xffa6('0xe')]>0x0){_0x50914a=_[_0xffa6('0x4b')](_0x25fdb0,'name');}if(_0x50914a[_0xffa6('0xe')]>0x0){return manageTags(_0x21df10,_0x50914a,_0x1b38e1,_0x2c71e4,_0x44c7e2,_0x577984,_0x2658aa)[_0xffa6('0x19')](function(){_0x3224ad(_0x44c7e2);});}else{_0x3224ad(_0x44c7e2);}});};}function emit(_0x41e563,_0x2e777d,_0x28df27){var _0x268727='%26sysparm_record_target%3Dincident'+_0xffa6('0x4c')+_0xffa6('0x4d')+_0xffa6('0x4e');var _0x3a2bef={'uri':_0x41e563+_0xffa6('0x4f')+_0x28df27+_0x268727};io['to'](util[_0xffa6('0x50')]('user:%s',_0x2e777d))['emit'](_0xffa6('0x51'),_0x3a2bef);}exports['cs']=function(_0x5947ed,_0x45ed2f,_0x3e8f14,_0x2ed5b0,_0x39e083,_0x40fc32,_0x261f4d,_0x4dcb28){var _0x5b937f={};var _0x26fd6b={'user':_0x40fc32[_0xffa6('0x52')],'pass':_0x40fc32[_0xffa6('0x53')]};var _0xc4136b=_0xffa6('0x54');var _0xfa3777=_0xffa6('0x55');_0x40fc32[_0xffa6('0x56')]=intUtil[_0xffa6('0x57')](_0x40fc32[_0xffa6('0x56')]);_0x40fc32[_0xffa6('0x58')]=intUtil[_0xffa6('0x57')](_0x40fc32[_0xffa6('0x58')]);var _0x535129=util[_0xffa6('0x50')](_0xffa6('0x59'),_0x40fc32[_0xffa6('0x56')]);_0x5b937f[_0xffa6('0x17')]=!_[_0xffa6('0x5a')](_0x2ed5b0)?_0x2ed5b0[_0xffa6('0x5b')]:null;_0x5b937f[_0xffa6('0x1c')]=_0x40fc32[_0xffa6('0x5b')];_0x5b937f[_0xffa6('0x21')]=_0x4dcb28[_0xffa6('0x30')]()===_0xffa6('0x5c')?_0x45ed2f[_0xffa6('0x5d')]:_0x45ed2f[_0xffa6('0x5e')];_0x5b937f[_0xffa6('0x5f')]=_0x4dcb28==='queue'||_0x4dcb28===_0xffa6('0x60')?_0xffa6('0x61'):_0xffa6('0x5c');var _0x1f9ed0=util[_0xffa6('0x50')](_0xffa6('0x62'),_0x40fc32[_0xffa6('0x58')],_0x45ed2f['uniqueid'],md5(_0x45ed2f[_0xffa6('0x63')]));if(_0x39e083&&_0x39e083['monitor_format']){logger[_0xffa6('0x11')](_0xffa6('0x64'),'Recording\x20is\x20enabled!');_0x45ed2f[_0xffa6('0x65')]=_0x1f9ed0;}else if(_0x261f4d&&_0x261f4d[_0xffa6('0x66')]&&_0x261f4d[_0xffa6('0x66')]!==_0xffa6('0x67')){logger[_0xffa6('0x11')](_0xffa6('0x68'),_0xffa6('0x69'));_0x45ed2f[_0xffa6('0x65')]=_0x1f9ed0;}else{_0x45ed2f['recordingURL']='';}return getAdminUser(_0x4dcb28,_0x26fd6b,_0x5b937f,_0x535129,_0xfa3777,_0xc4136b)[_0xffa6('0x19')](getUser(_0x4dcb28,_0x26fd6b,_0x535129,_0xfa3777,_0xc4136b))[_0xffa6('0x19')](getEndUser(_0x4dcb28,_0x26fd6b,_0x535129,_0xfa3777,_0xc4136b))[_0xffa6('0x19')](getTicket(_0x4dcb28,_0x26fd6b,_0x535129,_0x3e8f14,_0x45ed2f,_0xfa3777))['then'](function(_0x382630){logger[_0xffa6('0x11')](util[_0xffa6('0x50')](_0xffa6('0x6a'),_0x382630[_0xffa6('0x41')]));logger[_0xffa6('0x11')](util[_0xffa6('0x50')]('call\x20direction:\x20%s',_0x4dcb28));if(_0x4dcb28!==_0xffa6('0x60')){logger[_0xffa6('0x11')]('['+[_0x4dcb28['toUpperCase']()]+']',_0xffa6('0x6b'));emit(_0x40fc32[_0xffa6('0x56')],_0x2ed5b0['name'],_0x382630[_0xffa6('0x41')]);}})[_0xffa6('0x14')](function(_0x4bb717){logger[_0xffa6('0x1e')]('['+[_0x4dcb28['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xffa6('0x6c')](_0x4bb717,{'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 43995e6..e9b7cfd 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 _0x43f4=['Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','then','Enduser\x20created.','debug','[HTTP]','merge','type','string','nameField','toLowerCase','content','toString','customField','custom_fields','variable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','uri','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','Fields','Outbound','Ticket\x20created!','contacts','version','error','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','isNil','calleridnum','users','lodash','md5','util','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','assigned_user_id','description','getString','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','length','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','stringify','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','find','name_value_list','user_name','value'];(function(_0x3bf3e3,_0x2ae026){var _0x4a8c24=function(_0x2cc1f3){while(--_0x2cc1f3){_0x3bf3e3['push'](_0x3bf3e3['shift']());}};_0x4a8c24(++_0x2ae026);}(_0x43f4,0xba));var _0x443f=function(_0x30fe01,_0x243668){_0x30fe01=_0x30fe01-0x0;var _0x549c25=_0x43f4[_0x30fe01];return _0x549c25;};'use strict';var _=require(_0x443f('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x443f('0x1'));var util=require(_0x443f('0x2'));var Redis=require('ioredis');var intUtil=require(_0x443f('0x3'));var config=require('../../../../config/environment');var logger=require(_0x443f('0x4'))(_0x443f('0x5'));config[_0x443f('0x6')]=_[_0x443f('0x7')](config[_0x443f('0x6')],{'host':_0x443f('0x8'),'port':0x18eb});var io=require(_0x443f('0x9'))(new Redis(config['redis']));var def={'method':_0x443f('0xa'),'json':!![]};function emit(_0x4f781e,_0x3a8405,_0x2c618a){io['to'](_0x4f781e)[_0x443f('0xb')](_0x3a8405,_0x2c618a);}function getTicket(_0x10e476,_0x486b4e,_0x4a51ee,_0x32d5db,_0x14f3e9,_0x3f5a03,_0x3f5b8a,_0x46fd1c){logger[_0x443f('0xc')]('Creating\x20new\x20ticket...');var _0x4f8e47=new Date();var _0x57dfcd=[{'name':_0x443f('0xd'),'value':intUtil['getString'](_0x32d5db['Subjects'],_0x14f3e9,'\x20')},{'name':_0x443f('0xe'),'value':_0x486b4e['id']},{'name':'created_by','value':_0x486b4e['id']},{'name':_0x443f('0xf'),'value':intUtil[_0x443f('0x10')](_0x32d5db[_0x443f('0x11')],_0x14f3e9,'\x0a')},{'name':_0x443f('0x12'),'value':_0x4f8e47[_0x443f('0x13')]()[_0x443f('0x14')](0x0,0x13)[_0x443f('0x15')]('T','\x20')},{'name':_0x443f('0x16'),'value':'0'},{'name':_0x443f('0x17'),'value':'15'},{'name':_0x443f('0x18'),'value':_0x4a51ee['id']},{'name':_0x443f('0x19'),'value':'Contacts'},{'name':_0x443f('0x1a'),'value':_0x4a51ee[_0x443f('0xd')]},{'name':'direction','value':_0x46fd1c}];if(_0x3f5a03[_0x443f('0x1b')]){_[_0x443f('0x1c')](_0x3f5a03,function(_0x30d0cf){if(_0x14f3e9[_0x30d0cf[_0x443f('0x1d')]]){_0x57dfcd[_0x443f('0x1e')]({'name':_0x30d0cf[_0x443f('0x1f')],'value':_0x14f3e9[_0x30d0cf['variableName']]});}});}return request({'form':{'method':_0x443f('0x20'),'input_type':'JSON','response_type':_0x443f('0x21'),'rest_data':JSON['stringify']({'session':_0x3f5b8a['id'],'module_name':_0x443f('0x22'),'name_value_list':_0x57dfcd})}});}function getAuth(_0x5a9b77){return util[_0x443f('0x23')](_0x443f('0x24'),new Buffer(_0x5a9b77[_0x443f('0x25')]+':X')['toString'](_0x443f('0x26')));}function getServerInfo(_0x1ad9fb){return request({'form':{'method':_0x443f('0x27'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x443f('0x28')]({'session':_0x1ad9fb['id']})}});}function getUser(_0x4b677d,_0x1c9a3a,_0xb6351b){if(!_['isNil'](_0x1c9a3a)){logger['info'](_0x443f('0x29'),_0x1c9a3a);return request({'form':{'method':_0x443f('0x2a'),'input_type':_0x443f('0x21'),'response_type':_0x443f('0x21'),'rest_data':JSON[_0x443f('0x28')]({'session':_0xb6351b['id'],'module_name':_0x443f('0x2b'),'query':util[_0x443f('0x23')](_0x443f('0x2c'),_0x1c9a3a),'order_by':'','offset':'0','select_fields':['id',_0x443f('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x570db6){if(_0x570db6[_0x443f('0x2d')][_0x443f('0x1b')]){var _0x2cf93d=_[_0x443f('0x2e')](_0x570db6[_0x443f('0x2d')],function(_0x39408a){return _0x39408a[_0x443f('0x2f')][_0x443f('0x30')][_0x443f('0x31')]===_0x1c9a3a;});if(_0x2cf93d){logger[_0x443f('0xc')](_0x443f('0x32'));return BPromise[_0x443f('0x33')]({'id':_0x2cf93d['name_value_list']['id'][_0x443f('0x31')],'name':_0x2cf93d[_0x443f('0x2f')][_0x443f('0xd')][_0x443f('0x31')]});}}logger[_0x443f('0xc')](_0x443f('0x34'));return BPromise[_0x443f('0x33')]({'id':_0xb6351b[_0x443f('0x2f')][_0x443f('0x35')][_0x443f('0x31')],'name':_0xb6351b[_0x443f('0x2f')][_0x443f('0x30')]['value']});});}else{logger['info'](_0x443f('0x36'));return BPromise['resolve']({'id':_0xb6351b['name_value_list'][_0x443f('0x35')][_0x443f('0x31')],'name':_0xb6351b[_0x443f('0x2f')][_0x443f('0x30')][_0x443f('0x31')]});}}function getEndUser(_0x44d2b1,_0x3d930b,_0x3f5b02,_0x54e9a2){logger[_0x443f('0xc')]('Searching\x20enduser\x20with\x20phone',_0x3f5b02);return request({'form':{'method':_0x443f('0x2a'),'input_type':_0x443f('0x21'),'response_type':_0x443f('0x21'),'rest_data':JSON['stringify']({'session':_0x54e9a2['id'],'module_name':_0x443f('0x37'),'query':util[_0x443f('0x23')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x3f5b02),'order_by':'','offset':'0','select_fields':['id',_0x443f('0xd'),_0x443f('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1819cf){if(_0x1819cf[_0x443f('0x2d')][_0x443f('0x1b')]){var _0xbfd9c4=_[_0x443f('0x2e')](_0x1819cf[_0x443f('0x2d')],function(_0x1f25c6){return _0x1f25c6[_0x443f('0x2f')]['phone_home'][_0x443f('0x31')]===_0x3f5b02;});if(_0xbfd9c4){logger[_0x443f('0xc')]('Enduser\x20found!');return BPromise[_0x443f('0x33')]({'id':_0xbfd9c4['name_value_list']['id'][_0x443f('0x31')],'name':_0xbfd9c4[_0x443f('0x2f')][_0x443f('0xd')][_0x443f('0x31')],'phone':_0xbfd9c4[_0x443f('0x2f')]['phone_home']['value']});}}else{logger[_0x443f('0xc')](_0x443f('0x39'));return request({'form':{'method':'set_entry','input_type':_0x443f('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x54e9a2['id'],'module_name':'Contacts','name_value_list':[{'name':_0x443f('0x3a'),'value':_0x3d930b!==''?_0x3d930b:util['format']('Caller\x20-\x20%s',_0x3f5b02)},{'name':_0x443f('0x38'),'value':_0x3f5b02}]})}})[_0x443f('0x3b')](function(_0x3ebcdd){logger[_0x443f('0xc')](_0x443f('0x3c'));return BPromise[_0x443f('0x33')]({'id':_0x3ebcdd['id'],'name':_0x3ebcdd[_0x443f('0x2d')][_0x443f('0x3a')][_0x443f('0x31')],'phone':_0x3ebcdd[_0x443f('0x2d')]['phone_home'][_0x443f('0x31')]});});}});}function request(_0x59a77f){logger[_0x443f('0x3d')](_0x443f('0x3e'),JSON[_0x443f('0x28')](_0x59a77f));return rp(_[_0x443f('0x3f')](def,_0x59a77f));}function getTags(_0x4f98b2,_0x41e61e){var _0x1a8412=[];if(_0x4f98b2&&_0x4f98b2[_0x443f('0x1b')]>0x0){_0x1a8412=_['map'](_0x4f98b2,_0x41e61e);}return _0x1a8412;}function getCustomFields(_0x649713,_0x47ea7d){var _0x36a906=[];var _0x2e6e1a={'custom_fields':[]};if(_0x649713[_0x443f('0x1b')]>0x0){_['forEach'](_0x649713,function(_0x45e8a8){if(_0x45e8a8[_0x443f('0x40')]===_0x443f('0x41')&&_0x45e8a8[_0x443f('0x42')]&&!_0x45e8a8['customField']){_0x2e6e1a[_0x45e8a8[_0x443f('0x42')][_0x443f('0x43')]()]=_0x45e8a8[_0x443f('0x44')][_0x443f('0x45')]();}else if(_0x45e8a8[_0x443f('0x40')]==='string'&&_0x45e8a8['idField']&&_0x45e8a8[_0x443f('0x46')]){_0x2e6e1a[_0x443f('0x47')][_0x443f('0x1e')]({'id':_0x45e8a8['idField'],'value':_0x45e8a8['content']['toString']()});}else if(_0x45e8a8[_0x443f('0x40')]===_0x443f('0x48')&&_0x45e8a8[_0x443f('0x1d')]&&_0x45e8a8[_0x443f('0x1f')]&&_0x45e8a8[_0x443f('0x46')]){_0x47ea7d[_0x45e8a8[_0x443f('0x1d')]]&&_0x2e6e1a[_0x443f('0x47')][_0x443f('0x1e')]({'id':_0x45e8a8['idField'],'value':_0x47ea7d[_0x45e8a8['variableName']][_0x443f('0x45')]()});}else if(_0x45e8a8['type']==='customVariable'&&_0x45e8a8['Variable']&&_0x45e8a8[_0x443f('0x49')][_0x443f('0xd')]&&_0x45e8a8[_0x443f('0x1f')]&&_0x45e8a8['customField']){_0x47ea7d[_0x45e8a8['Variable'][_0x443f('0xd')][_0x443f('0x43')]()]&&_0x2e6e1a['custom_fields'][_0x443f('0x1e')]({'id':_0x45e8a8[_0x443f('0x1f')],'value':_0x47ea7d[_0x45e8a8[_0x443f('0x49')][_0x443f('0xd')][_0x443f('0x43')]()][_0x443f('0x45')]()});}});}return _0x2e6e1a;}function getConnection(_0x3c6800){return request({'method':_0x443f('0xa'),'form':{'method':'login','input_type':_0x443f('0x21'),'response_type':_0x443f('0x21'),'rest_data':JSON[_0x443f('0x28')]({'user_auth':{'user_name':_0x3c6800[_0x443f('0x4a')],'password':_0x3c6800[_0x443f('0x4b')],'encryption':_0x443f('0x4c')},'application':_0x443f('0x4d')})}})[_0x443f('0x3b')](function(_0x50e836){var _0x324791=_0x50e836;if(_0x324791['id']){def[_0x443f('0x4e')]=_0x324791['id'];return BPromise['resolve'](_0x324791);}else{throw new Error(util[_0x443f('0x23')](_0x443f('0x4f'),_0x3c6800['id']));}});}function setRelationship(_0x6b9eee,_0x331430,_0x15e820,_0x1e0557){return request({'form':{'method':_0x443f('0x50'),'input_type':_0x443f('0x21'),'response_type':_0x443f('0x21'),'rest_data':JSON[_0x443f('0x28')]({'session':_0x6b9eee['id'],'module_name':'Calls','module_id':_0x15e820['id'],'link_field_name':_0x1e0557,'related_ids':[_0x331430['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x443f('0x51')]=function(_0x2fa006,_0x2db7ef,_0x32218f,_0x371d86,_0x42c387,_0x1ae00a){var _0x404d92,_0x4ab842,_0x4ef997,_0x2e8385;_0x1ae00a[_0x443f('0x52')]=intUtil[_0x443f('0x53')](_0x1ae00a[_0x443f('0x52')]);_0x1ae00a[_0x443f('0x54')]=intUtil[_0x443f('0x53')](_0x1ae00a[_0x443f('0x54')]);def['uri']=util[_0x443f('0x23')]('%s/service/v4_1/rest.php',_0x1ae00a['remoteUri']);if(_0x42c387&&_0x42c387[_0x443f('0x55')]){logger['info'](_0x443f('0x56'),'Recording\x20is\x20enabled!');_0x2db7ef[_0x443f('0x57')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ae00a[_0x443f('0x54')],_0x2db7ef[_0x443f('0x58')],md5(_0x2db7ef['uniqueid']));}else{_0x2db7ef[_0x443f('0x57')]='';}return getConnection(_0x1ae00a)['then'](function(_0x17eb86){_0x2e8385=_0x17eb86;return getUser(_0x1ae00a,_0x371d86[_0x443f('0xd')],_0x2e8385);})[_0x443f('0x3b')](function(_0x27bf87){_0x404d92=_0x27bf87;logger[_0x443f('0xc')](_0x443f('0x59'),_0x404d92['id']);return getEndUser(_0x1ae00a,_0x2db7ef[_0x443f('0x5a')],_0x2db7ef['calleridnum'],_0x2e8385);})[_0x443f('0x3b')](function(_0x3c3595){_0x4ab842=_0x3c3595;logger['info'](_0x443f('0x5b'),_0x4ab842['id']);return getTicket(_0x1ae00a,_0x404d92,_0x4ab842,_0x32218f,_0x2db7ef,_0x32218f['Fields'],_0x2e8385,_0x443f('0x5c'));})['then'](function(_0x393d60){_0x4ef997=_0x393d60;logger['info']('Ticket\x20created!');logger['info'](_0x443f('0x5d'),_0x4ef997['id']);return setRelationship(_0x2e8385,_0x404d92,_0x4ef997,'users');})[_0x443f('0x3b')](function(){return setRelationship(_0x2e8385,_0x4ab842,_0x4ef997,'contacts');})[_0x443f('0x3b')](function(){return getServerInfo(_0x2e8385);})['then'](function(_0x16b75f){var _0x549617=parseInt(_0x16b75f['version']['charAt'](0x0));var _0x162797=util[_0x443f('0x23')](_0x443f('0x5e'),_0x1ae00a[_0x443f('0x52')],_0x4ef997['id']);if(_0x549617>0x6){_0x162797=util[_0x443f('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1ae00a['remoteUri'],_0x4ef997['id']);}logger[_0x443f('0xc')](_0x443f('0x56'),_0x443f('0x5f'));emit(util[_0x443f('0x23')](_0x443f('0x60'),_0x371d86[_0x443f('0xd')]),_0x443f('0x61'),{'uri':_0x162797});})[_0x443f('0x62')](function(_0x58dea4){logger['error'](_0x443f('0x56'),JSON[_0x443f('0x28')](_0x58dea4));});};exports['outbound']=function(_0x180de6,_0x3c9d0c,_0x2f3b8d,_0xd57256,_0x307ed7,_0x434205,_0x416807){var _0x5253b7,_0x375e09,_0x33eac2,_0x27f8ff;_0x434205[_0x443f('0x52')]=intUtil[_0x443f('0x53')](_0x434205['remoteUri']);_0x434205[_0x443f('0x54')]=intUtil[_0x443f('0x53')](_0x434205[_0x443f('0x54')]);def[_0x443f('0x63')]=util['format'](_0x443f('0x64'),_0x434205[_0x443f('0x52')]);if(_0x416807&&_0x416807[_0x443f('0x65')]&&_0x416807[_0x443f('0x65')]!==_0x443f('0x66')){logger['info'](_0x443f('0x67'),_0x443f('0x68'));_0x3c9d0c[_0x443f('0x57')]=util[_0x443f('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x434205[_0x443f('0x54')],_0x3c9d0c[_0x443f('0x58')],md5(_0x3c9d0c[_0x443f('0x58')]));}return getConnection(_0x434205)[_0x443f('0x3b')](function(_0x36c07e){_0x27f8ff=_0x36c07e;return getUser(_0x434205,_0xd57256[_0x443f('0xd')],_0x27f8ff);})[_0x443f('0x3b')](function(_0x558cb1){_0x5253b7=_0x558cb1;logger[_0x443f('0xc')](_0x443f('0x59'),_0x5253b7['id']);return getEndUser(_0x434205,_0x3c9d0c['destcalleridname'],_0x3c9d0c[_0x443f('0x69')],_0x27f8ff);})[_0x443f('0x3b')](function(_0x57ccc9){_0x375e09=_0x57ccc9;logger['info'](_0x443f('0x5b'),_0x375e09['id']);return getTicket(_0x434205,_0x5253b7,_0x375e09,_0x2f3b8d,_0x3c9d0c,_0x2f3b8d[_0x443f('0x6a')],_0x27f8ff,_0x443f('0x6b'));})[_0x443f('0x3b')](function(_0x50394e){_0x33eac2=_0x50394e;logger['info'](_0x443f('0x6c'));logger[_0x443f('0xc')](_0x443f('0x5d'),_0x33eac2['id']);return setRelationship(_0x27f8ff,_0x5253b7,_0x33eac2,'users');})[_0x443f('0x3b')](function(){return setRelationship(_0x27f8ff,_0x375e09,_0x33eac2,_0x443f('0x6d'));})[_0x443f('0x3b')](function(){return getServerInfo(_0x27f8ff);})[_0x443f('0x3b')](function(_0x30940e){var _0x4d6f5e=parseInt(_0x30940e[_0x443f('0x6e')]['charAt'](0x0));var _0x343ed0=util[_0x443f('0x23')](_0x443f('0x5e'),_0x434205[_0x443f('0x52')],_0x33eac2['id']);if(_0x4d6f5e>0x6){_0x343ed0=util[_0x443f('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x434205['remoteUri'],_0x33eac2['id']);}logger[_0x443f('0xc')](_0x443f('0x67'),_0x443f('0x5f'));emit(util['format']('user:%s',_0xd57256[_0x443f('0xd')]),_0x443f('0x61'),{'uri':_0x343ed0});})[_0x443f('0x62')](function(_0x5f1303){logger[_0x443f('0x6f')](_0x443f('0x67'),JSON[_0x443f('0x28')](_0x5f1303));});};exports['unmanaged']=function(_0x4a36fd,_0x90722d,_0x10b010,_0x50f27e,_0x45f10c,_0x33c306){var _0x1b824c,_0x4391f2,_0x4e2d32,_0x5b1346;_0x33c306['remoteUri']=intUtil[_0x443f('0x53')](_0x33c306[_0x443f('0x52')]);_0x33c306[_0x443f('0x54')]=intUtil[_0x443f('0x53')](_0x33c306[_0x443f('0x54')]);def[_0x443f('0x63')]=util['format'](_0x443f('0x64'),_0x33c306['remoteUri']);if(_0x45f10c&&_0x45f10c['monitor_format']){logger[_0x443f('0xc')]('['+_0x90722d[_0x443f('0x70')][_0x443f('0x71')]()+']','Recording\x20is\x20enabled!');_0x90722d[_0x443f('0x57')]=util[_0x443f('0x23')](_0x443f('0x72'),_0x33c306[_0x443f('0x54')],_0x90722d[_0x443f('0x58')],md5(_0x90722d[_0x443f('0x58')]));}else{_0x90722d['recordingURL']='';}return getConnection(_0x33c306)[_0x443f('0x3b')](function(_0x523d0b){_0x5b1346=_0x523d0b;if(!_[_0x443f('0x73')](_0x50f27e)){return getUser(_0x33c306,_0x50f27e['name'],_0x5b1346);}else{return getUser(_0x33c306,null,_0x5b1346);}})[_0x443f('0x3b')](function(_0x48b7e8){_0x1b824c=_0x48b7e8;logger[_0x443f('0xc')](_0x443f('0x59'),_0x1b824c['id']);return getEndUser(_0x33c306,_0x90722d[_0x443f('0x5a')],_0x90722d[_0x443f('0x74')],_0x5b1346);})['then'](function(_0x153a07){_0x4391f2=_0x153a07;logger[_0x443f('0xc')](_0x443f('0x5b'),_0x4391f2['id']);return getTicket(_0x33c306,_0x1b824c,_0x4391f2,_0x10b010,_0x90722d,_0x10b010[_0x443f('0x6a')],_0x5b1346,_0x443f('0x5c'));})['then'](function(_0x3d9ed5){_0x4e2d32=_0x3d9ed5;logger[_0x443f('0xc')](_0x443f('0x6c'));logger[_0x443f('0xc')](_0x443f('0x5d'),_0x4e2d32['id']);return setRelationship(_0x5b1346,_0x1b824c,_0x4e2d32,_0x443f('0x75'));})[_0x443f('0x3b')](function(){return setRelationship(_0x5b1346,_0x4391f2,_0x4e2d32,'contacts');})[_0x443f('0x3b')](function(){return getServerInfo(_0x5b1346);})[_0x443f('0x62')](function(_0x40b045){logger[_0x443f('0x6f')]('['+_0x90722d[_0x443f('0x70')][_0x443f('0x71')]()+']',JSON[_0x443f('0x28')](_0x40b045));});}; \ No newline at end of file +var _0x02d7=['apiKey','toString','base64','get_server_info','info','Getting\x20agent\x20with\x20name','then','entry_list','find','user_name','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','string','nameField','customField','content','custom_fields','variable','push','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','calleridname','calleridnum','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Fields','Ticket\x20created!','unmanaged','lastevent','toUpperCase','isNil','The\x20User\x20ID\x20is:','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','parent_name','length','idField','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s'];(function(_0x2955be,_0x17e9c4){var _0x27604b=function(_0x16adc0){while(--_0x16adc0){_0x2955be['push'](_0x2955be['shift']());}};_0x27604b(++_0x17e9c4);}(_0x02d7,0xcf));var _0x702d=function(_0x256408,_0x14bf35){_0x256408=_0x256408-0x0;var _0x10b54b=_0x02d7[_0x256408];return _0x10b54b;};'use strict';var _=require(_0x702d('0x0'));var rp=require(_0x702d('0x1'));var BPromise=require(_0x702d('0x2'));var md5=require(_0x702d('0x3'));var util=require(_0x702d('0x4'));var Redis=require('ioredis');var intUtil=require(_0x702d('0x5'));var config=require(_0x702d('0x6'));var logger=require(_0x702d('0x7'))(_0x702d('0x8'));config[_0x702d('0x9')]=_[_0x702d('0xa')](config[_0x702d('0x9')],{'host':_0x702d('0xb'),'port':0x18eb});var io=require(_0x702d('0xc'))(new Redis(config[_0x702d('0x9')]));var def={'method':_0x702d('0xd'),'json':!![]};function emit(_0x1d7934,_0x423983,_0x372ebf){io['to'](_0x1d7934)[_0x702d('0xe')](_0x423983,_0x372ebf);}function getTicket(_0x1c1b47,_0x377793,_0x4082bf,_0x172cbb,_0x3a2b64,_0x549358,_0x67c12b,_0x1bb497){logger['info'](_0x702d('0xf'));var _0x156640=new Date();var _0x3663d2=[{'name':_0x702d('0x10'),'value':intUtil[_0x702d('0x11')](_0x172cbb[_0x702d('0x12')],_0x3a2b64,'\x20')},{'name':'assigned_user_id','value':_0x377793['id']},{'name':_0x702d('0x13'),'value':_0x377793['id']},{'name':_0x702d('0x14'),'value':intUtil[_0x702d('0x11')](_0x172cbb[_0x702d('0x15')],_0x3a2b64,'\x0a')},{'name':_0x702d('0x16'),'value':_0x156640[_0x702d('0x17')]()[_0x702d('0x18')](0x0,0x13)[_0x702d('0x19')]('T','\x20')},{'name':_0x702d('0x1a'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x702d('0x1b'),'value':_0x4082bf['id']},{'name':_0x702d('0x1c'),'value':'Contacts'},{'name':_0x702d('0x1d'),'value':_0x4082bf[_0x702d('0x10')]},{'name':'direction','value':_0x1bb497}];if(_0x549358[_0x702d('0x1e')]){_['forEach'](_0x549358,function(_0x4d1d35){if(_0x3a2b64[_0x4d1d35['variableName']]){_0x3663d2['push']({'name':_0x4d1d35[_0x702d('0x1f')],'value':_0x3a2b64[_0x4d1d35[_0x702d('0x20')]]});}});}return request({'form':{'method':_0x702d('0x21'),'input_type':_0x702d('0x22'),'response_type':'JSON','rest_data':JSON[_0x702d('0x23')]({'session':_0x67c12b['id'],'module_name':_0x702d('0x24'),'name_value_list':_0x3663d2})}});}function getAuth(_0x38224b){return util[_0x702d('0x25')](_0x702d('0x26'),new Buffer(_0x38224b[_0x702d('0x27')]+':X')[_0x702d('0x28')](_0x702d('0x29')));}function getServerInfo(_0x182d86){return request({'form':{'method':_0x702d('0x2a'),'input_type':_0x702d('0x22'),'response_type':_0x702d('0x22'),'rest_data':JSON[_0x702d('0x23')]({'session':_0x182d86['id']})}});}function getUser(_0x2631ff,_0x3b7ad4,_0x2bb5df){if(!_['isNil'](_0x3b7ad4)){logger[_0x702d('0x2b')](_0x702d('0x2c'),_0x3b7ad4);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x702d('0x22'),'rest_data':JSON[_0x702d('0x23')]({'session':_0x2bb5df['id'],'module_name':'Employees','query':util[_0x702d('0x25')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x3b7ad4),'order_by':'','offset':'0','select_fields':['id',_0x702d('0x10'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x702d('0x2d')](function(_0x3a4599){if(_0x3a4599[_0x702d('0x2e')][_0x702d('0x1e')]){var _0x189805=_[_0x702d('0x2f')](_0x3a4599['entry_list'],function(_0x3f1ed0){return _0x3f1ed0['name_value_list'][_0x702d('0x30')][_0x702d('0x31')]===_0x3b7ad4;});if(_0x189805){logger['info'](_0x702d('0x32'));return BPromise[_0x702d('0x33')]({'id':_0x189805[_0x702d('0x34')]['id']['value'],'name':_0x189805[_0x702d('0x34')][_0x702d('0x10')][_0x702d('0x31')]});}}logger['info'](_0x702d('0x35'));return BPromise['resolve']({'id':_0x2bb5df['name_value_list']['user_id'][_0x702d('0x31')],'name':_0x2bb5df[_0x702d('0x34')][_0x702d('0x30')][_0x702d('0x31')]});});}else{logger[_0x702d('0x2b')](_0x702d('0x36'));return BPromise[_0x702d('0x33')]({'id':_0x2bb5df['name_value_list'][_0x702d('0x37')][_0x702d('0x31')],'name':_0x2bb5df[_0x702d('0x34')][_0x702d('0x30')][_0x702d('0x31')]});}}function getEndUser(_0x458c8e,_0x2de13d,_0x45a964,_0x1ffc4a){logger[_0x702d('0x2b')](_0x702d('0x38'),_0x45a964);return request({'form':{'method':'get_entry_list','input_type':_0x702d('0x22'),'response_type':_0x702d('0x22'),'rest_data':JSON['stringify']({'session':_0x1ffc4a['id'],'module_name':_0x702d('0x39'),'query':util[_0x702d('0x25')](_0x702d('0x3a'),_0x45a964),'order_by':'','offset':'0','select_fields':['id',_0x702d('0x10'),_0x702d('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x702d('0x2d')](function(_0xbdc5f){if(_0xbdc5f[_0x702d('0x2e')][_0x702d('0x1e')]){var _0x33efca=_[_0x702d('0x2f')](_0xbdc5f[_0x702d('0x2e')],function(_0x2d6f3e){return _0x2d6f3e['name_value_list'][_0x702d('0x3b')]['value']===_0x45a964;});if(_0x33efca){logger[_0x702d('0x2b')](_0x702d('0x3c'));return BPromise[_0x702d('0x33')]({'id':_0x33efca['name_value_list']['id'][_0x702d('0x31')],'name':_0x33efca[_0x702d('0x34')][_0x702d('0x10')][_0x702d('0x31')],'phone':_0x33efca[_0x702d('0x34')][_0x702d('0x3b')][_0x702d('0x31')]});}}else{logger[_0x702d('0x2b')](_0x702d('0x3d'));return request({'form':{'method':_0x702d('0x21'),'input_type':_0x702d('0x22'),'response_type':'JSON','rest_data':JSON[_0x702d('0x23')]({'session':_0x1ffc4a['id'],'module_name':_0x702d('0x39'),'name_value_list':[{'name':_0x702d('0x3e'),'value':_0x2de13d!==_0x702d('0x3f')?_0x2de13d:util[_0x702d('0x25')](_0x702d('0x40'),_0x45a964)},{'name':_0x702d('0x3b'),'value':_0x45a964}]})}})[_0x702d('0x2d')](function(_0x293156){logger[_0x702d('0x2b')](_0x702d('0x41'));return BPromise[_0x702d('0x33')]({'id':_0x293156['id'],'name':_0x293156[_0x702d('0x2e')][_0x702d('0x3e')][_0x702d('0x31')],'phone':_0x293156[_0x702d('0x2e')][_0x702d('0x3b')][_0x702d('0x31')]});});}});}function request(_0x1e92fb){logger[_0x702d('0x42')]('[HTTP]',JSON[_0x702d('0x23')](_0x1e92fb));return rp(_[_0x702d('0x43')](def,_0x1e92fb));}function getTags(_0x45eb9c,_0x44d82d){var _0x38b4f4=[];if(_0x45eb9c&&_0x45eb9c['length']>0x0){_0x38b4f4=_[_0x702d('0x44')](_0x45eb9c,_0x44d82d);}return _0x38b4f4;}function getCustomFields(_0x5281f7,_0x4f0f7c){var _0xefa6ca=[];var _0x42111a={'custom_fields':[]};if(_0x5281f7[_0x702d('0x1e')]>0x0){_['forEach'](_0x5281f7,function(_0x4b6af5){if(_0x4b6af5[_0x702d('0x45')]===_0x702d('0x46')&&_0x4b6af5[_0x702d('0x47')]&&!_0x4b6af5[_0x702d('0x48')]){_0x42111a[_0x4b6af5[_0x702d('0x47')]['toLowerCase']()]=_0x4b6af5[_0x702d('0x49')][_0x702d('0x28')]();}else if(_0x4b6af5['type']==='string'&&_0x4b6af5[_0x702d('0x1f')]&&_0x4b6af5[_0x702d('0x48')]){_0x42111a[_0x702d('0x4a')]['push']({'id':_0x4b6af5['idField'],'value':_0x4b6af5['content'][_0x702d('0x28')]()});}else if(_0x4b6af5['type']===_0x702d('0x4b')&&_0x4b6af5[_0x702d('0x20')]&&_0x4b6af5[_0x702d('0x1f')]&&_0x4b6af5[_0x702d('0x48')]){_0x4f0f7c[_0x4b6af5['variableName']]&&_0x42111a['custom_fields'][_0x702d('0x4c')]({'id':_0x4b6af5[_0x702d('0x1f')],'value':_0x4f0f7c[_0x4b6af5[_0x702d('0x20')]]['toString']()});}else if(_0x4b6af5[_0x702d('0x45')]===_0x702d('0x4d')&&_0x4b6af5[_0x702d('0x4e')]&&_0x4b6af5[_0x702d('0x4e')][_0x702d('0x10')]&&_0x4b6af5['idField']&&_0x4b6af5['customField']){_0x4f0f7c[_0x4b6af5[_0x702d('0x4e')][_0x702d('0x10')][_0x702d('0x4f')]()]&&_0x42111a[_0x702d('0x4a')]['push']({'id':_0x4b6af5[_0x702d('0x1f')],'value':_0x4f0f7c[_0x4b6af5[_0x702d('0x4e')][_0x702d('0x10')][_0x702d('0x4f')]()][_0x702d('0x28')]()});}});}return _0x42111a;}function getConnection(_0x28beb6){return request({'method':'POST','form':{'method':_0x702d('0x50'),'input_type':_0x702d('0x22'),'response_type':_0x702d('0x22'),'rest_data':JSON[_0x702d('0x23')]({'user_auth':{'user_name':_0x28beb6[_0x702d('0x51')],'password':_0x28beb6[_0x702d('0x52')],'encryption':_0x702d('0x53')},'application':_0x702d('0x54')})}})[_0x702d('0x2d')](function(_0x5ac68a){var _0xec5806=_0x5ac68a;if(_0xec5806['id']){def[_0x702d('0x55')]=_0xec5806['id'];return BPromise[_0x702d('0x33')](_0xec5806);}else{throw new Error(util[_0x702d('0x25')](_0x702d('0x56'),_0x28beb6['id']));}});}function setRelationship(_0x415f5a,_0x2da5de,_0x4e1a82,_0x1f5947){return request({'form':{'method':_0x702d('0x57'),'input_type':_0x702d('0x22'),'response_type':_0x702d('0x22'),'rest_data':JSON[_0x702d('0x23')]({'session':_0x415f5a['id'],'module_name':_0x702d('0x24'),'module_id':_0x4e1a82['id'],'link_field_name':_0x1f5947,'related_ids':[_0x2da5de['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x702d('0x58')]=function(_0x1a27b1,_0x69f55f,_0x49c217,_0x6675b3,_0x2c84c2,_0x3e5207){var _0x14fe1a,_0x4e3e05,_0x34f3d3,_0x55f5fa;_0x3e5207[_0x702d('0x59')]=intUtil[_0x702d('0x5a')](_0x3e5207[_0x702d('0x59')]);_0x3e5207[_0x702d('0x5b')]=intUtil[_0x702d('0x5a')](_0x3e5207[_0x702d('0x5b')]);def[_0x702d('0x5c')]=util['format'](_0x702d('0x5d'),_0x3e5207[_0x702d('0x59')]);if(_0x2c84c2&&_0x2c84c2[_0x702d('0x5e')]){logger[_0x702d('0x2b')](_0x702d('0x5f'),_0x702d('0x60'));_0x69f55f['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e5207['serverUrl'],_0x69f55f['uniqueid'],md5(_0x69f55f[_0x702d('0x61')]));}else{_0x69f55f[_0x702d('0x62')]='';}return getConnection(_0x3e5207)['then'](function(_0x6ee780){_0x55f5fa=_0x6ee780;return getUser(_0x3e5207,_0x6675b3['name'],_0x55f5fa);})[_0x702d('0x2d')](function(_0x39a74d){_0x14fe1a=_0x39a74d;logger[_0x702d('0x2b')]('The\x20User\x20ID\x20is:',_0x14fe1a['id']);return getEndUser(_0x3e5207,_0x69f55f[_0x702d('0x63')],_0x69f55f[_0x702d('0x64')],_0x55f5fa);})['then'](function(_0x46061a){_0x4e3e05=_0x46061a;logger[_0x702d('0x2b')]('The\x20Enduser\x20ID\x20is:',_0x4e3e05['id']);return getTicket(_0x3e5207,_0x14fe1a,_0x4e3e05,_0x49c217,_0x69f55f,_0x49c217['Fields'],_0x55f5fa,_0x702d('0x65'));})[_0x702d('0x2d')](function(_0x5320a7){_0x34f3d3=_0x5320a7;logger[_0x702d('0x2b')]('Ticket\x20created!');logger['info'](_0x702d('0x66'),_0x34f3d3['id']);return setRelationship(_0x55f5fa,_0x14fe1a,_0x34f3d3,_0x702d('0x67'));})[_0x702d('0x2d')](function(){return setRelationship(_0x55f5fa,_0x4e3e05,_0x34f3d3,_0x702d('0x68'));})[_0x702d('0x2d')](function(){return getServerInfo(_0x55f5fa);})[_0x702d('0x2d')](function(_0x3f3f27){var _0x18a50c=parseInt(_0x3f3f27[_0x702d('0x69')]['charAt'](0x0));var _0x377aed=util[_0x702d('0x25')](_0x702d('0x6a'),_0x3e5207[_0x702d('0x59')],_0x34f3d3['id']);if(_0x18a50c>0x6){_0x377aed=util[_0x702d('0x25')](_0x702d('0x6b'),_0x3e5207['remoteUri'],_0x34f3d3['id']);}logger[_0x702d('0x2b')](_0x702d('0x5f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x702d('0x25')](_0x702d('0x6c'),_0x6675b3['name']),_0x702d('0x6d'),{'uri':_0x377aed});})[_0x702d('0x6e')](function(_0x5b8d28){logger[_0x702d('0x6f')]('[QUEUE]',JSON['stringify'](_0x5b8d28));});};exports['outbound']=function(_0xa872b7,_0x52fe70,_0x2fbb14,_0x1611b8,_0x5815f3,_0x2f9d12,_0x2c26bf){var _0x1323a0,_0x5a8b8a,_0x55621c,_0x48e5a0;_0x2f9d12[_0x702d('0x59')]=intUtil[_0x702d('0x5a')](_0x2f9d12['remoteUri']);_0x2f9d12['serverUrl']=intUtil[_0x702d('0x5a')](_0x2f9d12[_0x702d('0x5b')]);def[_0x702d('0x5c')]=util[_0x702d('0x25')](_0x702d('0x5d'),_0x2f9d12[_0x702d('0x59')]);if(_0x2c26bf&&_0x2c26bf['recordingFormat']&&_0x2c26bf[_0x702d('0x70')]!==_0x702d('0x71')){logger[_0x702d('0x2b')](_0x702d('0x72'),_0x702d('0x60'));_0x52fe70['recordingURL']=util[_0x702d('0x25')](_0x702d('0x73'),_0x2f9d12[_0x702d('0x5b')],_0x52fe70[_0x702d('0x61')],md5(_0x52fe70['uniqueid']));}return getConnection(_0x2f9d12)[_0x702d('0x2d')](function(_0x3d08c1){_0x48e5a0=_0x3d08c1;return getUser(_0x2f9d12,_0x1611b8[_0x702d('0x10')],_0x48e5a0);})['then'](function(_0x4b106d){_0x1323a0=_0x4b106d;logger[_0x702d('0x2b')]('The\x20User\x20ID\x20is:',_0x1323a0['id']);return getEndUser(_0x2f9d12,_0x52fe70['destcalleridname'],_0x52fe70['destcalleridnum'],_0x48e5a0);})[_0x702d('0x2d')](function(_0x181730){_0x5a8b8a=_0x181730;logger[_0x702d('0x2b')]('The\x20Enduser\x20ID\x20is:',_0x5a8b8a['id']);return getTicket(_0x2f9d12,_0x1323a0,_0x5a8b8a,_0x2fbb14,_0x52fe70,_0x2fbb14[_0x702d('0x74')],_0x48e5a0,'Outbound');})['then'](function(_0x262b61){_0x55621c=_0x262b61;logger[_0x702d('0x2b')](_0x702d('0x75'));logger['info'](_0x702d('0x66'),_0x55621c['id']);return setRelationship(_0x48e5a0,_0x1323a0,_0x55621c,_0x702d('0x67'));})['then'](function(){return setRelationship(_0x48e5a0,_0x5a8b8a,_0x55621c,'contacts');})[_0x702d('0x2d')](function(){return getServerInfo(_0x48e5a0);})[_0x702d('0x2d')](function(_0x4acc88){var _0x2429fb=parseInt(_0x4acc88[_0x702d('0x69')]['charAt'](0x0));var _0x538c48=util[_0x702d('0x25')](_0x702d('0x6a'),_0x2f9d12[_0x702d('0x59')],_0x55621c['id']);if(_0x2429fb>0x6){_0x538c48=util['format'](_0x702d('0x6b'),_0x2f9d12[_0x702d('0x59')],_0x55621c['id']);}logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x702d('0x25')](_0x702d('0x6c'),_0x1611b8['name']),_0x702d('0x6d'),{'uri':_0x538c48});})['catch'](function(_0x3be3c3){logger[_0x702d('0x6f')](_0x702d('0x72'),JSON[_0x702d('0x23')](_0x3be3c3));});};exports[_0x702d('0x76')]=function(_0x575238,_0x2968a8,_0x155ea6,_0x55edcd,_0x5da234,_0x49cb8a){var _0x27e0b5,_0x43fd15,_0x4cba20,_0x56c4c3;_0x49cb8a[_0x702d('0x59')]=intUtil[_0x702d('0x5a')](_0x49cb8a[_0x702d('0x59')]);_0x49cb8a[_0x702d('0x5b')]=intUtil[_0x702d('0x5a')](_0x49cb8a['serverUrl']);def[_0x702d('0x5c')]=util[_0x702d('0x25')](_0x702d('0x5d'),_0x49cb8a[_0x702d('0x59')]);if(_0x5da234&&_0x5da234[_0x702d('0x5e')]){logger[_0x702d('0x2b')]('['+_0x2968a8[_0x702d('0x77')][_0x702d('0x78')]()+']',_0x702d('0x60'));_0x2968a8[_0x702d('0x62')]=util[_0x702d('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49cb8a[_0x702d('0x5b')],_0x2968a8[_0x702d('0x61')],md5(_0x2968a8[_0x702d('0x61')]));}else{_0x2968a8[_0x702d('0x62')]='';}return getConnection(_0x49cb8a)[_0x702d('0x2d')](function(_0x46e7da){_0x56c4c3=_0x46e7da;if(!_[_0x702d('0x79')](_0x55edcd)){return getUser(_0x49cb8a,_0x55edcd['name'],_0x56c4c3);}else{return getUser(_0x49cb8a,null,_0x56c4c3);}})[_0x702d('0x2d')](function(_0x4eb5b4){_0x27e0b5=_0x4eb5b4;logger[_0x702d('0x2b')](_0x702d('0x7a'),_0x27e0b5['id']);return getEndUser(_0x49cb8a,_0x2968a8[_0x702d('0x63')],_0x2968a8[_0x702d('0x64')],_0x56c4c3);})[_0x702d('0x2d')](function(_0x25a148){_0x43fd15=_0x25a148;logger[_0x702d('0x2b')]('The\x20Enduser\x20ID\x20is:',_0x43fd15['id']);return getTicket(_0x49cb8a,_0x27e0b5,_0x43fd15,_0x155ea6,_0x2968a8,_0x155ea6[_0x702d('0x74')],_0x56c4c3,_0x702d('0x65'));})[_0x702d('0x2d')](function(_0x48a6cc){_0x4cba20=_0x48a6cc;logger[_0x702d('0x2b')](_0x702d('0x75'));logger[_0x702d('0x2b')](_0x702d('0x66'),_0x4cba20['id']);return setRelationship(_0x56c4c3,_0x27e0b5,_0x4cba20,_0x702d('0x67'));})[_0x702d('0x2d')](function(){return setRelationship(_0x56c4c3,_0x43fd15,_0x4cba20,_0x702d('0x68'));})[_0x702d('0x2d')](function(){return getServerInfo(_0x56c4c3);})[_0x702d('0x6e')](function(_0x43f83b){logger[_0x702d('0x6f')]('['+_0x2968a8[_0x702d('0x77')][_0x702d('0x78')]()+']',JSON['stringify'](_0x43f83b));});}; \ 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 f302792..324573f 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 _0x4a0a=['join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','length','sortBy','string','push','content','type','variable','variableName','toString','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent','keyType','customVariable'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4a0a,0x19e));var _0xa4a0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4a0a[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xa4a0('0x0'));var util=require(_0xa4a0('0x1'));exports['getString']=function(_0x3e40cc,_0x1216d2,_0x49f121){var _0x1f9059=[];if(_0x3e40cc[_0xa4a0('0x2')]>0x0){var _0x1bc14d=_[_0xa4a0('0x3')](_0x3e40cc,['id']);for(var _0x5c1a56=0x0;_0x5c1a56<_0x1bc14d[_0xa4a0('0x2')];_0x5c1a56++){var _0x42df53=_0x1bc14d[_0x5c1a56];if(_0x42df53['type']===_0xa4a0('0x4')){_0x1f9059[_0xa4a0('0x5')](_0x42df53[_0xa4a0('0x6')]);}else if(_0x42df53[_0xa4a0('0x7')]===_0xa4a0('0x8')&&_0x42df53['variableName']){_0x1216d2[_0x42df53[_0xa4a0('0x9')]]&&_0x1f9059['push'](_0x1216d2[_0x42df53[_0xa4a0('0x9')]][_0xa4a0('0xa')]());}else if(_0x42df53[_0xa4a0('0x7')]==='customVariable'&&_0x42df53[_0xa4a0('0xb')]&&_0x42df53['Variable'][_0xa4a0('0xc')]){_0x1216d2[_0x42df53[_0xa4a0('0xb')][_0xa4a0('0xc')][_0xa4a0('0xd')]()]&&_0x1f9059['push'](_0x1216d2[_0x42df53[_0xa4a0('0xb')][_0xa4a0('0xc')][_0xa4a0('0xd')]()][_0xa4a0('0xa')]());}else if(_0x42df53[_0xa4a0('0x7')]===_0xa4a0('0xe')){if(_0x42df53['keyType']==='string'&&_0x42df53[_0xa4a0('0xf')]){_0x1f9059[_0xa4a0('0x5')](util[_0xa4a0('0x10')](_0xa4a0('0x11'),_0x42df53[_0xa4a0('0xf')],_0x42df53[_0xa4a0('0x12')]));}else if(_0x42df53[_0xa4a0('0x13')]===_0xa4a0('0x8')&&_0x42df53[_0xa4a0('0x9')]&&_0x42df53[_0xa4a0('0xf')]){_0x1216d2[_0x42df53[_0xa4a0('0x9')]]&&_0x1f9059[_0xa4a0('0x5')](util[_0xa4a0('0x10')](_0xa4a0('0x11'),_0x42df53[_0xa4a0('0xf')],_0x1216d2[_0x42df53['variableName']]));}else if(_0x42df53[_0xa4a0('0x13')]===_0xa4a0('0x14')&&_0x42df53[_0xa4a0('0xb')]&&_0x42df53[_0xa4a0('0xb')][_0xa4a0('0xc')]&&_0x42df53[_0xa4a0('0xf')]){_0x1216d2[_0x42df53[_0xa4a0('0xb')][_0xa4a0('0xc')][_0xa4a0('0xd')]()]&&_0x1f9059[_0xa4a0('0x5')](util['format'](_0xa4a0('0x11'),_0x42df53['key'],_0x1216d2[_0x42df53[_0xa4a0('0xb')][_0xa4a0('0xc')]['toLowerCase']()]));}}}}return _0x1f9059[_0xa4a0('0x15')](_0x49f121);};exports[_0xa4a0('0x16')]=function(_0x224131){var _0x77f186=_0x224131[_0xa4a0('0x17')](-0x1);if(_0x77f186==='/'){_0x224131=_0x224131[_0xa4a0('0x18')](0x0,_0x224131[_0xa4a0('0x19')](_0x77f186));}return _0x224131;};exports[_0xa4a0('0x1a')]=function(_0xe177b8){if(!_[_0xa4a0('0x1b')](_0xe177b8)&&_0xe177b8!==''){var _0x103c29=/^(([^<>()\[\]\\.,;:\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 _0x103c29[_0xa4a0('0x1c')](String(_0xe177b8)[_0xa4a0('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x409a=['slice','lastIndexOf','validateEmail','test','lodash','util','getString','length','sortBy','type','string','push','content','variableName','toString','customVariable','Variable','name','keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','toLowerCase','join','stripTrailingSlash'];(function(_0x55623c,_0x1fab8f){var _0x45c241=function(_0x2bd219){while(--_0x2bd219){_0x55623c['push'](_0x55623c['shift']());}};_0x45c241(++_0x1fab8f);}(_0x409a,0x18c));var _0xa409=function(_0x22725e,_0x182da6){_0x22725e=_0x22725e-0x0;var _0x58d761=_0x409a[_0x22725e];return _0x58d761;};'use strict';var _=require(_0xa409('0x0'));var util=require(_0xa409('0x1'));exports[_0xa409('0x2')]=function(_0x30d8d7,_0x5928b8,_0x37c8aa){var _0x404bf4=[];if(_0x30d8d7[_0xa409('0x3')]>0x0){var _0x4224af=_[_0xa409('0x4')](_0x30d8d7,['id']);for(var _0x2fa16c=0x0;_0x2fa16c<_0x4224af[_0xa409('0x3')];_0x2fa16c++){var _0x505804=_0x4224af[_0x2fa16c];if(_0x505804[_0xa409('0x5')]===_0xa409('0x6')){_0x404bf4[_0xa409('0x7')](_0x505804[_0xa409('0x8')]);}else if(_0x505804['type']==='variable'&&_0x505804[_0xa409('0x9')]){_0x5928b8[_0x505804['variableName']]&&_0x404bf4[_0xa409('0x7')](_0x5928b8[_0x505804[_0xa409('0x9')]][_0xa409('0xa')]());}else if(_0x505804[_0xa409('0x5')]===_0xa409('0xb')&&_0x505804[_0xa409('0xc')]&&_0x505804['Variable']['name']){_0x5928b8[_0x505804['Variable']['name']['toLowerCase']()]&&_0x404bf4['push'](_0x5928b8[_0x505804[_0xa409('0xc')][_0xa409('0xd')]['toLowerCase']()][_0xa409('0xa')]());}else if(_0x505804['type']===_0xa409('0xe')){if(_0x505804[_0xa409('0xf')]===_0xa409('0x6')&&_0x505804[_0xa409('0x10')]){_0x404bf4[_0xa409('0x7')](util[_0xa409('0x11')](_0xa409('0x12'),_0x505804[_0xa409('0x10')],_0x505804[_0xa409('0x13')]));}else if(_0x505804[_0xa409('0xf')]===_0xa409('0x14')&&_0x505804[_0xa409('0x9')]&&_0x505804[_0xa409('0x10')]){_0x5928b8[_0x505804[_0xa409('0x9')]]&&_0x404bf4[_0xa409('0x7')](util[_0xa409('0x11')](_0xa409('0x12'),_0x505804[_0xa409('0x10')],_0x5928b8[_0x505804['variableName']]));}else if(_0x505804[_0xa409('0xf')]===_0xa409('0xb')&&_0x505804['Variable']&&_0x505804[_0xa409('0xc')]['name']&&_0x505804[_0xa409('0x10')]){_0x5928b8[_0x505804[_0xa409('0xc')][_0xa409('0xd')][_0xa409('0x15')]()]&&_0x404bf4['push'](util[_0xa409('0x11')]('%s:\x20%s',_0x505804[_0xa409('0x10')],_0x5928b8[_0x505804[_0xa409('0xc')][_0xa409('0xd')][_0xa409('0x15')]()]));}}}}return _0x404bf4[_0xa409('0x16')](_0x37c8aa);};exports[_0xa409('0x17')]=function(_0x4a598e){var _0x2f6c58=_0x4a598e[_0xa409('0x18')](-0x1);if(_0x2f6c58==='/'){_0x4a598e=_0x4a598e['substring'](0x0,_0x4a598e[_0xa409('0x19')](_0x2f6c58));}return _0x4a598e;};exports[_0xa409('0x1a')]=function(_0x41137f){if(!_['isNil'](_0x41137f)&&_0x41137f!==''){var _0xf55f82=/^(([^<>()\[\]\\.,;:\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 _0xf55f82[_0xa409('0x1b')](String(_0x41137f)[_0xa409('0x15')]());}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 5271005..b8b39cf 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(_0x483eb7,_0x326f1d){var _0x12f529=function(_0x1cebcd){while(--_0x1cebcd){_0x483eb7['push'](_0x483eb7['shift']());}};_0x12f529(++_0x326f1d);}(_0xe706,0xa3));var _0x6e70=function(_0x2a24b2,_0x171540){_0x2a24b2=_0x2a24b2-0x0;var _0x2ed7d3=_0xe706[_0x2a24b2];return _0x2ed7d3;};'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 _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 42c97b5..9dcbc77 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 _0xff25=['Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','POST','merge','name','getString','Descriptions','Fields','info','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','results','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','includes','string','type','nameField','customField','content','picklist','idField','custom_fields','push','variable','variableName','Variable','toLowerCase','stripTrailingSlash','serverUrl','[QUEUE]'];(function(_0x16015d,_0x1e5545){var _0x533a45=function(_0xdc5670){while(--_0xdc5670){_0x16015d['push'](_0x16015d['shift']());}};_0x533a45(++_0x1e5545);}(_0xff25,0xff));var _0x5ff2=function(_0x462bde,_0x820e4a){_0x462bde=_0x462bde-0x0;var _0x4146ec=_0xff25[_0x462bde];return _0x4146ec;};'use strict';var _=require('lodash');var rp=require(_0x5ff2('0x0'));var md5=require('md5');var util=require(_0x5ff2('0x1'));var Redis=require(_0x5ff2('0x2'));var intUtil=require(_0x5ff2('0x3'));var config=require(_0x5ff2('0x4'));var logger=require(_0x5ff2('0x5'))('zendesk');config[_0x5ff2('0x6')]=_[_0x5ff2('0x7')](config[_0x5ff2('0x6')],{'host':_0x5ff2('0x8'),'port':0x18eb});var io=require(_0x5ff2('0x9'))(new Redis(config[_0x5ff2('0x6')]));function emit(_0x3505ed,_0x488dde,_0x13986c){io['to'](_0x3505ed)[_0x5ff2('0xa')](_0x488dde,_0x13986c);}var headers={'Content-Type':'application/json','Accept':_0x5ff2('0xb')};function getTicket(_0x1469df,_0x55af8d,_0x3f904a,_0x55392d,_0x4da760){logger['info'](_0x5ff2('0xc'));return request({'uri':util['format'](_0x5ff2('0xd'),_0x1469df['remoteUri']),'method':_0x5ff2('0xe'),'body':{'ticket':_[_0x5ff2('0xf')]({'requester_id':_0x3f904a['id'],'submitter_id':_0x55af8d?_0x55af8d['id']:undefined,'assignee_id':_0x55af8d?_0x55af8d['id']:undefined,'tags':getTags(_0x55392d['Tags'],_0x5ff2('0x10')),'subject':intUtil[_0x5ff2('0x11')](_0x55392d['Subjects'],_0x4da760,'\x20'),'description':intUtil[_0x5ff2('0x11')](_0x55392d[_0x5ff2('0x12')],_0x4da760,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x55392d[_0x5ff2('0x12')],_0x4da760,'\x0a')}},getCustomFields(_0x55392d[_0x5ff2('0x13')],_0x4da760))}})['then'](function(_0x30079a){logger[_0x5ff2('0x14')]('Ticket\x20created!');return _0x30079a[_0x5ff2('0x15')];});}function getUser(_0x4f4216,_0xb1d931){if(intUtil[_0x5ff2('0x16')](_0xb1d931)){logger[_0x5ff2('0x14')](_0x5ff2('0x17'),_0xb1d931);return request({'uri':util[_0x5ff2('0x18')](_0x5ff2('0x19'),_0x4f4216[_0x5ff2('0x1a')]),'qs':{'query':util[_0x5ff2('0x18')](_0x5ff2('0x1b'),_0xb1d931)}})['then'](function(_0x4cede1){if(_0x4cede1[_0x5ff2('0x1c')]){logger[_0x5ff2('0x14')]('Agent\x20found!');return _[_0x5ff2('0x1d')](_0x4cede1['results'],{'email':_0xb1d931,'role':_0x5ff2('0x1e')});}else{logger[_0x5ff2('0x14')](_0x5ff2('0x1f'));return request({'uri':util[_0x5ff2('0x18')](_0x5ff2('0x20'),_0x4f4216[_0x5ff2('0x1a')])})[_0x5ff2('0x21')](function(_0x3cf2d2){logger[_0x5ff2('0x14')](_0x5ff2('0x22'));return _0x3cf2d2[_0x5ff2('0x23')];});}});}else{logger[_0x5ff2('0x14')](_0x5ff2('0x1f'));return request({'uri':util[_0x5ff2('0x18')](_0x5ff2('0x20'),_0x4f4216[_0x5ff2('0x1a')])})[_0x5ff2('0x21')](function(_0x12f8bb){logger[_0x5ff2('0x14')](_0x5ff2('0x22'));return _0x12f8bb[_0x5ff2('0x23')];});}}function getEndUser(_0xcc80c0,_0x27ef24,_0x3ed515){logger[_0x5ff2('0x14')](_0x5ff2('0x24'),_0x3ed515);return request({'uri':util['format'](_0x5ff2('0x19'),_0xcc80c0[_0x5ff2('0x1a')]),'qs':{'query':util[_0x5ff2('0x18')](_0x5ff2('0x25'),_0x3ed515)}})[_0x5ff2('0x21')](function(_0x2f3c8f){var _0x5e5a45;if(_0x2f3c8f['results'][_0x5ff2('0x26')]){_0x2f3c8f[_0x5ff2('0x27')]=_['filter'](_0x2f3c8f[_0x5ff2('0x27')],{'suspended':![],'role':_0x5ff2('0x28')});if(_0x2f3c8f['results'][_0x5ff2('0x26')]){_0x5e5a45=_[_0x5ff2('0x29')](_0x2f3c8f['results']);}}if(_0x5e5a45){logger[_0x5ff2('0x14')](_0x5ff2('0x2a'));return _0x5e5a45;}else{logger[_0x5ff2('0x14')](_0x5ff2('0x2b'));return request({'uri':util[_0x5ff2('0x18')](_0x5ff2('0x2c'),_0xcc80c0[_0x5ff2('0x1a')]),'method':_0x5ff2('0xe'),'body':{'user':{'role':_0x5ff2('0x28'),'name':util[_0x5ff2('0x18')]('Caller\x20-\x20%s',_0x27ef24||_0x3ed515),'phone':_0x3ed515}}})[_0x5ff2('0x21')](function(_0xffd16a){logger['info'](_0x5ff2('0x2d'));return _0xffd16a[_0x5ff2('0x23')];});}});}function getAuth(_0x391ab1){var _0x4bc21c;if(_0x391ab1[_0x5ff2('0x2e')]===_0x5ff2('0x2f')){_0x4bc21c=util[_0x5ff2('0x18')](_0x5ff2('0x30'),_0x391ab1[_0x5ff2('0x31')],_0x391ab1[_0x5ff2('0x2f')]);}else if(_0x391ab1[_0x5ff2('0x2e')]===_0x5ff2('0x32')){_0x4bc21c=util['format'](_0x5ff2('0x33'),_0x391ab1['username'],_0x391ab1[_0x5ff2('0x32')]);}return util[_0x5ff2('0x18')](_0x5ff2('0x34'),new Buffer(_0x4bc21c)[_0x5ff2('0x35')](_0x5ff2('0x36')));}function request(_0x4bee12){logger['debug'](_0x5ff2('0x37'),JSON[_0x5ff2('0x38')](_0x4bee12));return rp(_[_0x5ff2('0x7')](_0x4bee12,{'method':_0x5ff2('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x41552d,_0x33be9e){var _0x5abf92=[];if(_0x41552d&&_0x41552d[_0x5ff2('0x26')]>0x0){_0x5abf92=_['map'](_0x41552d,_0x33be9e);}return _0x5abf92;}function getCustomFields(_0x4e3dcb,_0x45cbf4){var _0x23b722=[];var _0x43992b={'custom_fields':[]};if(_0x4e3dcb[_0x5ff2('0x26')]>0x0){_['forEach'](_0x4e3dcb,function(_0x1fe94a){if(_[_0x5ff2('0x3a')]([_0x5ff2('0x3b'),'picklist'],_0x1fe94a[_0x5ff2('0x3c')])&&_0x1fe94a[_0x5ff2('0x3d')]&&!_0x1fe94a[_0x5ff2('0x3e')]){_0x43992b[_0x1fe94a[_0x5ff2('0x3d')]['toLowerCase']()]=_0x1fe94a[_0x5ff2('0x3f')][_0x5ff2('0x35')]();}else if(_[_0x5ff2('0x3a')]([_0x5ff2('0x3b'),_0x5ff2('0x40')],_0x1fe94a[_0x5ff2('0x3c')])&&_0x1fe94a[_0x5ff2('0x41')]&&_0x1fe94a['customField']){_0x43992b[_0x5ff2('0x42')][_0x5ff2('0x43')]({'id':_0x1fe94a[_0x5ff2('0x41')],'value':_0x1fe94a[_0x5ff2('0x3f')][_0x5ff2('0x35')]()});}else if(_0x1fe94a[_0x5ff2('0x3c')]===_0x5ff2('0x44')&&_0x1fe94a[_0x5ff2('0x45')]&&_0x1fe94a['idField']&&_0x1fe94a[_0x5ff2('0x3e')]){_0x45cbf4[_0x1fe94a['variableName']]&&_0x43992b[_0x5ff2('0x42')][_0x5ff2('0x43')]({'id':_0x1fe94a['idField'],'value':_0x45cbf4[_0x1fe94a[_0x5ff2('0x45')]]['toString']()});}else if(_0x1fe94a['type']==='customVariable'&&_0x1fe94a[_0x5ff2('0x46')]&&_0x1fe94a[_0x5ff2('0x46')][_0x5ff2('0x10')]&&_0x1fe94a[_0x5ff2('0x41')]&&_0x1fe94a['customField']){_0x45cbf4[_0x1fe94a[_0x5ff2('0x46')][_0x5ff2('0x10')][_0x5ff2('0x47')]()]&&_0x43992b[_0x5ff2('0x42')][_0x5ff2('0x43')]({'id':_0x1fe94a['idField'],'value':_0x45cbf4[_0x1fe94a[_0x5ff2('0x46')][_0x5ff2('0x10')][_0x5ff2('0x47')]()][_0x5ff2('0x35')]()});}});}return _0x43992b;}exports['queue']=function(_0x53c33c,_0xc6b7ac,_0xd8199b,_0x36037a,_0x14bcc1,_0xcc2786){var _0xa4d795,_0x5e6e48;_0xcc2786[_0x5ff2('0x1a')]=intUtil[_0x5ff2('0x48')](_0xcc2786['remoteUri']);_0xcc2786[_0x5ff2('0x49')]=intUtil['stripTrailingSlash'](_0xcc2786[_0x5ff2('0x49')]);if(_0x14bcc1&&_0x14bcc1['monitor_format']){logger[_0x5ff2('0x14')](_0x5ff2('0x4a'),_0x5ff2('0x4b'));_0xc6b7ac[_0x5ff2('0x4c')]=util[_0x5ff2('0x18')](_0x5ff2('0x4d'),_0xcc2786['serverUrl'],_0xc6b7ac['uniqueid'],md5(_0xc6b7ac[_0x5ff2('0x4e')]));}else{_0xc6b7ac['recordingURL']='';}headers[_0x5ff2('0x4f')]=getAuth(_0xcc2786);return getUser(_0xcc2786,_0x36037a[_0x5ff2('0x50')])[_0x5ff2('0x21')](function(_0x415da3){_0xa4d795=_0x415da3;logger[_0x5ff2('0x14')](_0x5ff2('0x51'),_0xa4d795['id']);return getEndUser(_0xcc2786,_0xc6b7ac[_0x5ff2('0x52')],_0xc6b7ac[_0x5ff2('0x53')]);})[_0x5ff2('0x21')](function(_0x433b5c){_0x5e6e48=_0x433b5c;logger[_0x5ff2('0x14')](_0x5ff2('0x54'),_0x5e6e48['id']);return getTicket(_0xcc2786,_0xa4d795,_0x5e6e48,_0xd8199b,_0xc6b7ac);})[_0x5ff2('0x21')](function(_0x1bd145){if(_0x1bd145){logger[_0x5ff2('0x14')](_0x5ff2('0x55'),_0x1bd145['id']);switch(_0xcc2786[_0x5ff2('0x3c')]){case _0x5ff2('0x56'):logger['info'](_0x5ff2('0x4a'),_0x5ff2('0x57'));return request({'uri':util[_0x5ff2('0x18')](_0x5ff2('0x58'),_0xcc2786[_0x5ff2('0x1a')],_0xa4d795['id'],_0x1bd145['id']),'method':_0x5ff2('0xe')});case _0x5ff2('0x59'):logger[_0x5ff2('0x14')](_0x5ff2('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5ff2('0x18')]('user:%s',_0x36037a[_0x5ff2('0x10')]),_0x5ff2('0x5a'),{'uri':util[_0x5ff2('0x18')]('%s/agent/tickets/%s',_0xcc2786['remoteUri'][_0x5ff2('0x5b')](_0x5ff2('0x5c'),''),_0x1bd145['id'])});break;default:logger[_0x5ff2('0x5d')]('[QUEUE]',_0x5ff2('0x5e'));}}})[_0x5ff2('0x5f')](function(_0x4f5e99){logger[_0x5ff2('0x5d')](_0x5ff2('0x60'),util[_0x5ff2('0x61')](_0x4f5e99,{'showHidden':!![],'depth':null}));});};exports[_0x5ff2('0x62')]=function(_0x1ae346,_0x14bed9,_0x164e7f,_0x2513f3,_0x5b7f44,_0x2528fd,_0x375e86){var _0x5f11f0,_0x4a29da;_0x2528fd[_0x5ff2('0x1a')]=intUtil[_0x5ff2('0x48')](_0x2528fd[_0x5ff2('0x1a')]);_0x2528fd['serverUrl']=intUtil[_0x5ff2('0x48')](_0x2528fd['serverUrl']);if(_0x375e86&&_0x375e86[_0x5ff2('0x63')]&&_0x375e86[_0x5ff2('0x63')]!==_0x5ff2('0x64')){logger['info'](_0x5ff2('0x65'),_0x5ff2('0x4b'));_0x14bed9['recordingURL']=util[_0x5ff2('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2528fd['serverUrl'],_0x14bed9[_0x5ff2('0x4e')],md5(_0x14bed9[_0x5ff2('0x4e')]));}headers[_0x5ff2('0x4f')]=getAuth(_0x2528fd);return getUser(_0x2528fd,_0x2513f3[_0x5ff2('0x50')])[_0x5ff2('0x21')](function(_0x2662c6){_0x5f11f0=_0x2662c6;logger[_0x5ff2('0x14')](_0x5ff2('0x51'),_0x5f11f0['id']);return getEndUser(_0x2528fd,_0x14bed9[_0x5ff2('0x66')],_0x14bed9[_0x5ff2('0x67')]);})[_0x5ff2('0x21')](function(_0x1d7c70){_0x4a29da=_0x1d7c70;logger[_0x5ff2('0x14')](_0x5ff2('0x54'),_0x4a29da['id']);return getTicket(_0x2528fd,_0x5f11f0,_0x4a29da,_0x164e7f,_0x14bed9);})['then'](function(_0x22b44c){if(_0x22b44c){logger[_0x5ff2('0x14')](_0x5ff2('0x55'),_0x22b44c['id']);switch(_0x2528fd[_0x5ff2('0x3c')]){case'integrationTab':logger[_0x5ff2('0x14')](_0x5ff2('0x65'),_0x5ff2('0x57'));return request({'uri':util[_0x5ff2('0x18')](_0x5ff2('0x58'),_0x2528fd[_0x5ff2('0x1a')],_0x5f11f0['id'],_0x22b44c['id']),'method':_0x5ff2('0xe')});case _0x5ff2('0x59'):logger['info'](_0x5ff2('0x65'),_0x5ff2('0x68'));emit(util[_0x5ff2('0x18')]('user:%s',_0x2513f3[_0x5ff2('0x10')]),_0x5ff2('0x5a'),{'uri':util['format'](_0x5ff2('0x69'),_0x2528fd[_0x5ff2('0x1a')][_0x5ff2('0x5b')](_0x5ff2('0x5c'),''),_0x22b44c['id'])});break;default:logger['error'](_0x5ff2('0x65'),_0x5ff2('0x5e'));}}})['catch'](function(_0x2c3b07){logger[_0x5ff2('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x5ff2('0x61')](_0x2c3b07,{'showHidden':!![],'depth':null}));});};exports[_0x5ff2('0x6a')]=function(_0x1ef5c9,_0x1f8db6,_0x2f282a,_0x29c129,_0x38d571,_0x5e331d){var _0x409bd7,_0x3e6bc6;_0x5e331d['remoteUri']=intUtil[_0x5ff2('0x48')](_0x5e331d[_0x5ff2('0x1a')]);_0x5e331d[_0x5ff2('0x49')]=intUtil['stripTrailingSlash'](_0x5e331d[_0x5ff2('0x49')]);if(_0x38d571&&_0x38d571['monitor_format']){logger[_0x5ff2('0x14')]('['+_0x1f8db6[_0x5ff2('0x6b')][_0x5ff2('0x6c')]()+']',_0x5ff2('0x4b'));_0x1f8db6[_0x5ff2('0x4c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5e331d['serverUrl'],_0x1f8db6[_0x5ff2('0x4e')],md5(_0x1f8db6[_0x5ff2('0x4e')]));}else{_0x1f8db6[_0x5ff2('0x4c')]='';}headers[_0x5ff2('0x4f')]=getAuth(_0x5e331d);return getUser(_0x5e331d)[_0x5ff2('0x21')](function(_0x35d797){_0x409bd7=_0x35d797;logger['info'](_0x5ff2('0x51'),_0x409bd7['id']);return getEndUser(_0x5e331d,_0x1f8db6[_0x5ff2('0x52')],_0x1f8db6['calleridnum']);})['then'](function(_0x6512d2){_0x3e6bc6=_0x6512d2;logger[_0x5ff2('0x14')]('The\x20Enduser\x20ID\x20is:',_0x3e6bc6['id']);return getTicket(_0x5e331d,_0x409bd7,_0x3e6bc6,_0x2f282a,_0x1f8db6);})['then'](function(_0x238824){if(_0x238824){logger[_0x5ff2('0x14')](_0x5ff2('0x55'),_0x238824['id']);}})['catch'](function(_0x2e4cc6){logger['error']('['+_0x1f8db6['lastevent'][_0x5ff2('0x6c')]()+']'+_0x5ff2('0x6d'),util[_0x5ff2('0x61')](_0x2e4cc6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbb73=['The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','Tags','name','Subjects','getString','Descriptions','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','user','authType','password','token','%s/token:%s','username','toString','debug','stringify','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','customField','custom_fields','push','idField','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname'];(function(_0x53a385,_0x45e738){var _0x2a138a=function(_0xe49462){while(--_0xe49462){_0x53a385['push'](_0x53a385['shift']());}};_0x2a138a(++_0x45e738);}(_0xbb73,0x8a));var _0x3bb7=function(_0x1aff65,_0x436ab3){_0x1aff65=_0x1aff65-0x0;var _0x33ac0b=_0xbb73[_0x1aff65];return _0x33ac0b;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x3bb7('0x0'));var util=require('util');var Redis=require(_0x3bb7('0x1'));var intUtil=require(_0x3bb7('0x2'));var config=require(_0x3bb7('0x3'));var logger=require(_0x3bb7('0x4'))(_0x3bb7('0x5'));config[_0x3bb7('0x6')]=_[_0x3bb7('0x7')](config[_0x3bb7('0x6')],{'host':_0x3bb7('0x8'),'port':0x18eb});var io=require(_0x3bb7('0x9'))(new Redis(config[_0x3bb7('0x6')]));function emit(_0x4f0b3b,_0x2a8166,_0x445ec3){io['to'](_0x4f0b3b)[_0x3bb7('0xa')](_0x2a8166,_0x445ec3);}var headers={'Content-Type':'application/json','Accept':_0x3bb7('0xb')};function getTicket(_0x3cc79c,_0x57373,_0x18869f,_0x518439,_0x389104){logger[_0x3bb7('0xc')](_0x3bb7('0xd'));return request({'uri':util[_0x3bb7('0xe')](_0x3bb7('0xf'),_0x3cc79c['remoteUri']),'method':_0x3bb7('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x18869f['id'],'submitter_id':_0x57373?_0x57373['id']:undefined,'assignee_id':_0x57373?_0x57373['id']:undefined,'tags':getTags(_0x518439[_0x3bb7('0x11')],_0x3bb7('0x12')),'subject':intUtil['getString'](_0x518439[_0x3bb7('0x13')],_0x389104,'\x20'),'description':intUtil[_0x3bb7('0x14')](_0x518439['Descriptions'],_0x389104,'\x0a'),'comment':{'public':![],'body':intUtil[_0x3bb7('0x14')](_0x518439[_0x3bb7('0x15')],_0x389104,'\x0a')}},getCustomFields(_0x518439['Fields'],_0x389104))}})[_0x3bb7('0x16')](function(_0xfb051f){logger[_0x3bb7('0xc')](_0x3bb7('0x17'));return _0xfb051f['ticket'];});}function getUser(_0x12f68b,_0x521b4d){if(intUtil[_0x3bb7('0x18')](_0x521b4d)){logger['info'](_0x3bb7('0x19'),_0x521b4d);return request({'uri':util['format'](_0x3bb7('0x1a'),_0x12f68b['remoteUri']),'qs':{'query':util['format'](_0x3bb7('0x1b'),_0x521b4d)}})[_0x3bb7('0x16')](function(_0x23de52){if(_0x23de52[_0x3bb7('0x1c')]){logger['info'](_0x3bb7('0x1d'));return _[_0x3bb7('0x1e')](_0x23de52[_0x3bb7('0x1f')],{'email':_0x521b4d,'role':_0x3bb7('0x20')});}else{logger[_0x3bb7('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x3bb7('0xe')](_0x3bb7('0x21'),_0x12f68b[_0x3bb7('0x22')])})[_0x3bb7('0x16')](function(_0x3f5d45){logger['info'](_0x3bb7('0x23'));return _0x3f5d45['user'];});}});}else{logger[_0x3bb7('0xc')](_0x3bb7('0x24'));return request({'uri':util['format'](_0x3bb7('0x21'),_0x12f68b[_0x3bb7('0x22')])})[_0x3bb7('0x16')](function(_0xadf288){logger[_0x3bb7('0xc')](_0x3bb7('0x23'));return _0xadf288['user'];});}}function getEndUser(_0x549a98,_0x3bdb8a,_0x41c8ab){logger[_0x3bb7('0xc')](_0x3bb7('0x25'),_0x41c8ab);return request({'uri':util[_0x3bb7('0xe')](_0x3bb7('0x1a'),_0x549a98['remoteUri']),'qs':{'query':util[_0x3bb7('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x41c8ab)}})[_0x3bb7('0x16')](function(_0x144e06){var _0x5ac07c;if(_0x144e06[_0x3bb7('0x1f')][_0x3bb7('0x26')]){_0x144e06['results']=_[_0x3bb7('0x27')](_0x144e06[_0x3bb7('0x1f')],{'suspended':![],'role':_0x3bb7('0x28')});if(_0x144e06[_0x3bb7('0x1f')][_0x3bb7('0x26')]){_0x5ac07c=_[_0x3bb7('0x29')](_0x144e06[_0x3bb7('0x1f')]);}}if(_0x5ac07c){logger[_0x3bb7('0xc')](_0x3bb7('0x2a'));return _0x5ac07c;}else{logger['info'](_0x3bb7('0x2b'));return request({'uri':util['format'](_0x3bb7('0x2c'),_0x549a98[_0x3bb7('0x22')]),'method':_0x3bb7('0x10'),'body':{'user':{'role':'end-user','name':util[_0x3bb7('0xe')](_0x3bb7('0x2d'),_0x3bdb8a||_0x41c8ab),'phone':_0x41c8ab}}})[_0x3bb7('0x16')](function(_0x1c1e65){logger[_0x3bb7('0xc')]('Enduser\x20created.');return _0x1c1e65[_0x3bb7('0x2e')];});}});}function getAuth(_0x2e1bac){var _0x2ad467;if(_0x2e1bac[_0x3bb7('0x2f')]===_0x3bb7('0x30')){_0x2ad467=util[_0x3bb7('0xe')]('%s:%s',_0x2e1bac['username'],_0x2e1bac[_0x3bb7('0x30')]);}else if(_0x2e1bac[_0x3bb7('0x2f')]===_0x3bb7('0x31')){_0x2ad467=util[_0x3bb7('0xe')](_0x3bb7('0x32'),_0x2e1bac[_0x3bb7('0x33')],_0x2e1bac[_0x3bb7('0x31')]);}return util[_0x3bb7('0xe')]('Basic\x20%s',new Buffer(_0x2ad467)[_0x3bb7('0x34')]('base64'));}function request(_0x1ed5b2){logger[_0x3bb7('0x35')]('[HTTP]',JSON[_0x3bb7('0x36')](_0x1ed5b2));return rp(_['defaults'](_0x1ed5b2,{'method':_0x3bb7('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x12f8a4,_0x3da066){var _0x4ed800=[];if(_0x12f8a4&&_0x12f8a4[_0x3bb7('0x26')]>0x0){_0x4ed800=_[_0x3bb7('0x38')](_0x12f8a4,_0x3da066);}return _0x4ed800;}function getCustomFields(_0x12b9d5,_0x11de20){var _0x3f5af8=[];var _0x226634={'custom_fields':[]};if(_0x12b9d5['length']>0x0){_[_0x3bb7('0x39')](_0x12b9d5,function(_0x311541){if(_[_0x3bb7('0x3a')]([_0x3bb7('0x3b'),_0x3bb7('0x3c')],_0x311541[_0x3bb7('0x3d')])&&_0x311541[_0x3bb7('0x3e')]&&!_0x311541['customField']){_0x226634[_0x311541[_0x3bb7('0x3e')][_0x3bb7('0x3f')]()]=_0x311541[_0x3bb7('0x40')][_0x3bb7('0x34')]();}else if(_[_0x3bb7('0x3a')]([_0x3bb7('0x3b'),'picklist'],_0x311541[_0x3bb7('0x3d')])&&_0x311541['idField']&&_0x311541[_0x3bb7('0x41')]){_0x226634[_0x3bb7('0x42')][_0x3bb7('0x43')]({'id':_0x311541[_0x3bb7('0x44')],'value':_0x311541[_0x3bb7('0x40')][_0x3bb7('0x34')]()});}else if(_0x311541[_0x3bb7('0x3d')]===_0x3bb7('0x45')&&_0x311541['variableName']&&_0x311541[_0x3bb7('0x44')]&&_0x311541[_0x3bb7('0x41')]){_0x11de20[_0x311541['variableName']]&&_0x226634[_0x3bb7('0x42')]['push']({'id':_0x311541[_0x3bb7('0x44')],'value':_0x11de20[_0x311541[_0x3bb7('0x46')]][_0x3bb7('0x34')]()});}else if(_0x311541['type']===_0x3bb7('0x47')&&_0x311541[_0x3bb7('0x48')]&&_0x311541[_0x3bb7('0x48')][_0x3bb7('0x12')]&&_0x311541[_0x3bb7('0x44')]&&_0x311541[_0x3bb7('0x41')]){_0x11de20[_0x311541['Variable'][_0x3bb7('0x12')][_0x3bb7('0x3f')]()]&&_0x226634[_0x3bb7('0x42')][_0x3bb7('0x43')]({'id':_0x311541[_0x3bb7('0x44')],'value':_0x11de20[_0x311541[_0x3bb7('0x48')][_0x3bb7('0x12')][_0x3bb7('0x3f')]()][_0x3bb7('0x34')]()});}});}return _0x226634;}exports[_0x3bb7('0x49')]=function(_0x147a56,_0x194a8f,_0x1b0d01,_0x227bb2,_0x34c911,_0x3abf6e){var _0x3587a3,_0x3a12d1;_0x3abf6e[_0x3bb7('0x22')]=intUtil['stripTrailingSlash'](_0x3abf6e[_0x3bb7('0x22')]);_0x3abf6e[_0x3bb7('0x4a')]=intUtil[_0x3bb7('0x4b')](_0x3abf6e['serverUrl']);if(_0x34c911&&_0x34c911[_0x3bb7('0x4c')]){logger[_0x3bb7('0xc')](_0x3bb7('0x4d'),'Recording\x20is\x20enabled!');_0x194a8f['recordingURL']=util[_0x3bb7('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3abf6e['serverUrl'],_0x194a8f[_0x3bb7('0x4e')],md5(_0x194a8f[_0x3bb7('0x4e')]));}else{_0x194a8f[_0x3bb7('0x4f')]='';}headers[_0x3bb7('0x50')]=getAuth(_0x3abf6e);return getUser(_0x3abf6e,_0x227bb2[_0x3bb7('0x51')])[_0x3bb7('0x16')](function(_0x332839){_0x3587a3=_0x332839;logger[_0x3bb7('0xc')](_0x3bb7('0x52'),_0x3587a3['id']);return getEndUser(_0x3abf6e,_0x194a8f[_0x3bb7('0x53')],_0x194a8f['calleridnum']);})[_0x3bb7('0x16')](function(_0x4d0cda){_0x3a12d1=_0x4d0cda;logger[_0x3bb7('0xc')](_0x3bb7('0x54'),_0x3a12d1['id']);return getTicket(_0x3abf6e,_0x3587a3,_0x3a12d1,_0x1b0d01,_0x194a8f);})['then'](function(_0x1be2e1){if(_0x1be2e1){logger[_0x3bb7('0xc')](_0x3bb7('0x55'),_0x1be2e1['id']);switch(_0x3abf6e['type']){case _0x3bb7('0x56'):logger[_0x3bb7('0xc')](_0x3bb7('0x4d'),_0x3bb7('0x57'));return request({'uri':util[_0x3bb7('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3abf6e[_0x3bb7('0x22')],_0x3587a3['id'],_0x1be2e1['id']),'method':_0x3bb7('0x10')});case _0x3bb7('0x58'):logger['info'](_0x3bb7('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3bb7('0xe')](_0x3bb7('0x59'),_0x227bb2[_0x3bb7('0x12')]),_0x3bb7('0x5a'),{'uri':util[_0x3bb7('0xe')](_0x3bb7('0x5b'),_0x3abf6e[_0x3bb7('0x22')][_0x3bb7('0x5c')](_0x3bb7('0x5d'),''),_0x1be2e1['id'])});break;default:logger[_0x3bb7('0x5e')](_0x3bb7('0x4d'),_0x3bb7('0x5f'));}}})[_0x3bb7('0x60')](function(_0x63df02){logger[_0x3bb7('0x5e')](_0x3bb7('0x61'),util[_0x3bb7('0x62')](_0x63df02,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x11a90e,_0x9cf85b,_0x13ea52,_0x233e8d,_0x4c909d,_0x1ccd61,_0x45c181){var _0x32567a,_0x4fd47f;_0x1ccd61['remoteUri']=intUtil[_0x3bb7('0x4b')](_0x1ccd61[_0x3bb7('0x22')]);_0x1ccd61[_0x3bb7('0x4a')]=intUtil[_0x3bb7('0x4b')](_0x1ccd61[_0x3bb7('0x4a')]);if(_0x45c181&&_0x45c181['recordingFormat']&&_0x45c181[_0x3bb7('0x63')]!==_0x3bb7('0x64')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x9cf85b[_0x3bb7('0x4f')]=util[_0x3bb7('0xe')](_0x3bb7('0x65'),_0x1ccd61['serverUrl'],_0x9cf85b[_0x3bb7('0x4e')],md5(_0x9cf85b['uniqueid']));}headers[_0x3bb7('0x50')]=getAuth(_0x1ccd61);return getUser(_0x1ccd61,_0x233e8d['email'])['then'](function(_0x4a7edc){_0x32567a=_0x4a7edc;logger[_0x3bb7('0xc')]('The\x20User\x20ID\x20is:',_0x32567a['id']);return getEndUser(_0x1ccd61,_0x9cf85b[_0x3bb7('0x66')],_0x9cf85b[_0x3bb7('0x67')]);})[_0x3bb7('0x16')](function(_0x5cf26b){_0x4fd47f=_0x5cf26b;logger[_0x3bb7('0xc')](_0x3bb7('0x54'),_0x4fd47f['id']);return getTicket(_0x1ccd61,_0x32567a,_0x4fd47f,_0x13ea52,_0x9cf85b);})[_0x3bb7('0x16')](function(_0x157ee5){if(_0x157ee5){logger[_0x3bb7('0xc')]('The\x20Ticket\x20ID\x20is:',_0x157ee5['id']);switch(_0x1ccd61[_0x3bb7('0x3d')]){case _0x3bb7('0x56'):logger['info'](_0x3bb7('0x68'),_0x3bb7('0x57'));return request({'uri':util[_0x3bb7('0xe')](_0x3bb7('0x69'),_0x1ccd61[_0x3bb7('0x22')],_0x32567a['id'],_0x157ee5['id']),'method':'POST'});case _0x3bb7('0x58'):logger[_0x3bb7('0xc')](_0x3bb7('0x68'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3bb7('0xe')](_0x3bb7('0x59'),_0x233e8d['name']),_0x3bb7('0x5a'),{'uri':util[_0x3bb7('0xe')](_0x3bb7('0x5b'),_0x1ccd61[_0x3bb7('0x22')][_0x3bb7('0x5c')](_0x3bb7('0x5d'),''),_0x157ee5['id'])});break;default:logger[_0x3bb7('0x5e')]('[OUTBOUND]',_0x3bb7('0x5f'));}}})[_0x3bb7('0x60')](function(_0x19b923){logger[_0x3bb7('0x5e')](_0x3bb7('0x6a'),util[_0x3bb7('0x62')](_0x19b923,{'showHidden':!![],'depth':null}));});};exports[_0x3bb7('0x6b')]=function(_0x24fcb8,_0x5c7e1a,_0x4edf99,_0x59c75d,_0x51914e,_0x2d79d8){var _0x3621a0,_0x3adf14;_0x2d79d8[_0x3bb7('0x22')]=intUtil['stripTrailingSlash'](_0x2d79d8[_0x3bb7('0x22')]);_0x2d79d8[_0x3bb7('0x4a')]=intUtil[_0x3bb7('0x4b')](_0x2d79d8['serverUrl']);if(_0x51914e&&_0x51914e[_0x3bb7('0x4c')]){logger[_0x3bb7('0xc')]('['+_0x5c7e1a[_0x3bb7('0x6c')][_0x3bb7('0x6d')]()+']',_0x3bb7('0x6e'));_0x5c7e1a['recordingURL']=util['format'](_0x3bb7('0x65'),_0x2d79d8[_0x3bb7('0x4a')],_0x5c7e1a[_0x3bb7('0x4e')],md5(_0x5c7e1a['uniqueid']));}else{_0x5c7e1a[_0x3bb7('0x4f')]='';}headers['Authorization']=getAuth(_0x2d79d8);return getUser(_0x2d79d8)[_0x3bb7('0x16')](function(_0x46abbe){_0x3621a0=_0x46abbe;logger[_0x3bb7('0xc')](_0x3bb7('0x52'),_0x3621a0['id']);return getEndUser(_0x2d79d8,_0x5c7e1a[_0x3bb7('0x53')],_0x5c7e1a['calleridnum']);})[_0x3bb7('0x16')](function(_0x408f34){_0x3adf14=_0x408f34;logger[_0x3bb7('0xc')](_0x3bb7('0x54'),_0x3adf14['id']);return getTicket(_0x2d79d8,_0x3621a0,_0x3adf14,_0x4edf99,_0x5c7e1a);})['then'](function(_0x48d463){if(_0x48d463){logger[_0x3bb7('0xc')](_0x3bb7('0x55'),_0x48d463['id']);}})[_0x3bb7('0x60')](function(_0x955bf0){logger[_0x3bb7('0x5e')]('['+_0x5c7e1a[_0x3bb7('0x6c')][_0x3bb7('0x6d')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x3bb7('0x62')](_0x955bf0,{'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 a90ad44..60f6f13 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 _0x5c7f=['findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','lead','Owner','profile','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Called','complete','Answered','rejected','Call_Result','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','starttime','Call_Type','Inbound','merge','Fields','POST','/crm/v2/Calls','Call\x20created!','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','com','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','trigger:browser:url','unmanaged','lodash','request-promise','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','stringify','length','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','toLowerCase','name','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','expires_in','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject'];(function(_0x583490,_0x365b39){var _0x22a814=function(_0x5a9cc1){while(--_0x5a9cc1){_0x583490['push'](_0x583490['shift']());}};_0x22a814(++_0x365b39);}(_0x5c7f,0x67));var _0xf5c7=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x5c7f[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0xf5c7('0x0'));var rp=require(_0xf5c7('0x1'));var md5=require(_0xf5c7('0x2'));var util=require(_0xf5c7('0x3'));var intUtil=require(_0xf5c7('0x4'));var moment=require(_0xf5c7('0x5'));var Redis=require(_0xf5c7('0x6'));var BPromise=require('bluebird');var config=require(_0xf5c7('0x7'));var logger=require(_0xf5c7('0x8'))(_0xf5c7('0x9'));config[_0xf5c7('0xa')]=_[_0xf5c7('0xb')](config['redis'],{'host':_0xf5c7('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x3290a3,_0x804708,_0x395429){io['to'](_0x3290a3)[_0xf5c7('0xd')](_0x804708,_0x395429);}function request(_0x3341c4){logger[_0xf5c7('0xe')]('[HTTP]',JSON[_0xf5c7('0xf')](_0x3341c4));return rp(_0x3341c4);}function getCustomFields(_0x1f89dc,_0x548d31){var _0x2e95c3={};if(_0x1f89dc[_0xf5c7('0x10')]>0x0){_['forEach'](_0x1f89dc,function(_0x4b6ffc){if(_[_0xf5c7('0x11')]([_0xf5c7('0x12'),_0xf5c7('0x13')],_0x4b6ffc[_0xf5c7('0x14')])&&_0x4b6ffc[_0xf5c7('0x15')]){_0x2e95c3[_0x4b6ffc[_0xf5c7('0x15')]]=_0x4b6ffc[_0xf5c7('0x16')][_0xf5c7('0x17')]();}else if(_0x4b6ffc[_0xf5c7('0x14')]===_0xf5c7('0x18')&&_0x4b6ffc[_0xf5c7('0x19')]&&_0x4b6ffc['idField']&&_0x548d31[_0x4b6ffc['variableName']]){_0x2e95c3[_0x4b6ffc['idField']]=_0x548d31[_0x4b6ffc['variableName']][_0xf5c7('0x17')]();}else if(_0x4b6ffc[_0xf5c7('0x14')]===_0xf5c7('0x1a')&&_0x4b6ffc[_0xf5c7('0x1b')]&&_0x4b6ffc[_0xf5c7('0x1b')]['name']&&_0x4b6ffc[_0xf5c7('0x15')]&&_0x548d31[_0x4b6ffc['Variable']['name'][_0xf5c7('0x1c')]()]){_0x2e95c3[_0x4b6ffc[_0xf5c7('0x15')]]=_0x548d31[_0x4b6ffc['Variable'][_0xf5c7('0x1d')][_0xf5c7('0x1c')]()][_0xf5c7('0x17')]();}});}return _0x2e95c3;}function getName(_0x27b40c){if(_0x27b40c[_0xf5c7('0x1e')]('\x20')>0x0){var _0x572215=_0x27b40c[_0xf5c7('0x1f')](/ (.+)/);if(_0x572215[0x1]){return _0x572215;}}return[_0x27b40c,_0x27b40c];}var accountsTokens={};function getAccessToken(_0x281b56){return new Promise(function(_0x42dd5a,_0x209c4f){if(!_[_0xf5c7('0x20')](accountsTokens[_0x281b56['id']])&&!_[_0xf5c7('0x20')](accountsTokens[_0x281b56['id']][_0xf5c7('0x21')])){if(moment()[_0xf5c7('0x22')](accountsTokens[_0x281b56['id']]['expires_in'])){_0x42dd5a(accountsTokens[_0x281b56['id']][_0xf5c7('0x21')]);}}var _0x30a6a5;switch(_0x281b56[_0xf5c7('0x23')]){case'US':_0x30a6a5=_0xf5c7('0x24');break;case'AU':_0x30a6a5=_0xf5c7('0x25');break;case'EU':_0x30a6a5=_0xf5c7('0x26');break;case'IN':_0x30a6a5=_0xf5c7('0x27');break;case'CN':_0x30a6a5='https://accounts.zoho.com.cn';break;default:_0x30a6a5=_0xf5c7('0x26');break;}var _0x4e1bde={'method':'POST','uri':_0x30a6a5+_0xf5c7('0x28'),'qs':{'refresh_token':_0x281b56[_0xf5c7('0x29')],'client_id':_0x281b56[_0xf5c7('0x2a')],'client_secret':_0x281b56[_0xf5c7('0x2b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4e1bde)[_0xf5c7('0x2c')](function(_0x401850){accountsTokens[_0x281b56['id']]={'access_token':_0x401850['access_token'],'expires_in':moment()[_0xf5c7('0x2d')](_0x401850[_0xf5c7('0x2e')],_0xf5c7('0x2f'))};_0x42dd5a(_0x401850[_0xf5c7('0x21')]);})[_0xf5c7('0x30')](function(_0x4d83b9){logger['error'](_0xf5c7('0x31'),_0x4d83b9[_0xf5c7('0x32')]);_0x209c4f(_0x4d83b9);});});}function getUser(_0xfa7a70,_0x1885a9,_0x1a4514,_0x3f8561){logger[_0xf5c7('0x33')](_0xf5c7('0x34'));return request({'method':_0xf5c7('0x35'),'uri':util[_0xf5c7('0x36')]('https://www.zohoapis.%s/crm/v2/users',_0x1885a9),'qs':{'type':_0xf5c7('0x37')},'headers':{'Authorization':_0xf5c7('0x38')+_0xfa7a70},'json':!![]})[_0xf5c7('0x2c')](function(_0x3c48d6){if(_0x3c48d6[_0xf5c7('0x39')]){var _0x20d304=-0x1;if(_[_0xf5c7('0x3a')](_0x3c48d6[_0xf5c7('0x39')])){if(!_[_0xf5c7('0x20')](_0x3f8561)){_0x20d304=_[_0xf5c7('0x3b')](_0x3c48d6[_0xf5c7('0x39')],function(_0xd0c875){return _0xd0c875[_0xf5c7('0x3c')]===_0x3f8561;});}if(_0x20d304>=0x0){logger['info'](_0xf5c7('0x3d'));}else{logger[_0xf5c7('0x33')](_0xf5c7('0x3e'));_0x20d304=_[_0xf5c7('0x3b')](_0x3c48d6[_0xf5c7('0x39')],function(_0x121f95){return _0x121f95['profile'][_0xf5c7('0x1d')]===_0xf5c7('0x3f');});}return _0x3c48d6['users'][_0x20d304];}else{if(_0x3c48d6[_0xf5c7('0x40')]['profile']['name']===_0xf5c7('0x3f')){logger[_0xf5c7('0x33')](_0xf5c7('0x3e'));user=_0x3c48d6[_0xf5c7('0x40')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0xf5c7('0xf')](_0x3c48d6));throw new Error(_0xf5c7('0x41')+JSON['stringify'](_0x3c48d6));}}}else{logger[_0xf5c7('0x42')](_0xf5c7('0x43'),JSON[_0xf5c7('0xf')](_0x3c48d6));throw new Error(_0xf5c7('0x41')+JSON['stringify'](_0x3c48d6));}})[_0xf5c7('0x30')](function(_0x2840b1){console[_0xf5c7('0x42')](_0x2840b1);});}function getZohoUser(_0x181fc4,_0x4c74e2){return new BPromise(function(_0x418ea8,_0x32da7a){request(_0x181fc4)[_0xf5c7('0x2c')](function(_0x4208a2){var _0x9cc6de=null;if(_0x4208a2){_0x9cc6de=_0x4208a2[_0xf5c7('0x44')][0x0];_0x9cc6de[_0xf5c7('0x45')]=_0x4c74e2;}_0x418ea8(_0x9cc6de);})['catch'](function(_0x2818f9){_0x32da7a(_0x2818f9);});});}function createEndUser(_0x19e507,_0x4dfb62,_0x4ab80d,_0x256f68,_0x3f2619,_0x2d1fef){var _0x4ab80d=getName(_0x4ab80d);return request({'method':'POST','uri':_0xf5c7('0x46')+_0x4dfb62+_0xf5c7('0x47')+_[_0xf5c7('0x48')](_0x2d1fef[_0xf5c7('0x49')])+'s','body':{'data':[{'Last_Name':_0x4ab80d[0x1],'First_Name':_0x4ab80d[0x0],'Phone':_0x256f68,'Owner':{'name':!_['isNil'](_0x3f2619[_0xf5c7('0x4a')][_0xf5c7('0x1d')])?_0x3f2619[_0xf5c7('0x4a')]['name']:!_[_0xf5c7('0x20')](_0x3f2619['first_name'])?_0x3f2619[_0xf5c7('0x4b')]+'\x20'+_0x3f2619[_0xf5c7('0x4c')]:_0x3f2619[_0xf5c7('0x4c')],'id':_0x3f2619['id']}}]},'headers':{'Authorization':_0xf5c7('0x38')+_0x19e507},'json':!![]})[_0xf5c7('0x2c')](function(_0x589bfb){if(_0x589bfb&&_0x589bfb[_0xf5c7('0x44')][0x0][_0xf5c7('0x4d')]==='SUCCESS'){var _0xd64668=_0x589bfb[_0xf5c7('0x44')][0x0][_0xf5c7('0x4e')];_0xd64668[_0xf5c7('0x45')]=_['startCase'](_0x2d1fef[_0xf5c7('0x49')])+'s';return _0xd64668;}logger['error'](_0xf5c7('0x43'),JSON['stringify'](data));throw new Error(_0xf5c7('0x4f')+JSON[_0xf5c7('0xf')](data));})[_0xf5c7('0x30')](function(_0x3d090e){console[_0xf5c7('0x50')](_0xf5c7('0x51'),_0x3d090e);});}function getEndUser(_0xc8078c,_0x3f9f3c,_0x163654,_0x375689,_0x4bde22,_0x3f4e1b,_0x99fe66){var _0x4bee04={'method':_0xf5c7('0x35'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xc8078c},'json':!![]};switch(_0x99fe66[_0xf5c7('0x52')]){case _0xf5c7('0x53'):_0x4bee04['uri']=_0xf5c7('0x46')+_0x3f9f3c+_0xf5c7('0x54')+_0x4bde22+'))';return getZohoUser(_0x4bee04,'Contacts')[_0xf5c7('0x2c')](function(_0x5dbe0a){if(_0x5dbe0a)return _0x5dbe0a;_0x4bee04[_0xf5c7('0x55')]=_0xf5c7('0x46')+_0x3f9f3c+_0xf5c7('0x56')+_0x4bde22+'))';return getZohoUser(_0x4bee04,_0xf5c7('0x57'))[_0xf5c7('0x2c')](function(_0x52d111){if(_0x52d111)return _0x52d111;if(_0x99fe66['moduleCreate']!=_0xf5c7('0x58')){return createEndUser(_0xc8078c,_0x3f9f3c,_0x375689,_0x4bde22,_0x3f4e1b,_0x99fe66);}else{return{};}});});break;case _0xf5c7('0x59'):_0x4bee04[_0xf5c7('0x55')]=_0xf5c7('0x46')+_0x3f9f3c+_0xf5c7('0x54')+_0x4bde22+'))';return getZohoUser(_0x4bee04,_0xf5c7('0x5a'))[_0xf5c7('0x2c')](function(_0x1b22c4){if(_0x1b22c4)return _0x1b22c4;if(_0x99fe66[_0xf5c7('0x49')]!=_0xf5c7('0x58')){return createEndUser(_0xc8078c,_0x3f9f3c,_0x375689,_0x4bde22,_0x3f4e1b,_0x99fe66);}else{return{};}});break;case _0xf5c7('0x5b'):_0x4bee04[_0xf5c7('0x55')]='https://www.zohoapis.'+_0x3f9f3c+_0xf5c7('0x56')+_0x4bde22+'))';return getZohoUser(_0x4bee04,'Leads')[_0xf5c7('0x2c')](function(_0x457900){if(_0x457900)return _0x457900;if(_0x99fe66[_0xf5c7('0x49')]!=_0xf5c7('0x58')){return createEndUser(_0xc8078c,_0x3f9f3c,_0x375689,_0x4bde22,_0x3f4e1b,_0x99fe66);}else{return{};}});break;}}function getCall(_0x37605a,_0x4afa8c,_0x3f1840,_0x3de5de,_0x3e7f40,_0x41f6cb,_0x411131,_0x33ded9){logger[_0xf5c7('0x33')]('Creating\x20new\x20call...');var _0x4f2480={};_0x4f2480[_0xf5c7('0x5c')]={'name':!_[_0xf5c7('0x20')](_0x3de5de[_0xf5c7('0x4a')][_0xf5c7('0x1d')])&&!_[_0xf5c7('0x20')](_0x3de5de[_0xf5c7('0x5d')]['name'])&&_0x3de5de['profile'][_0xf5c7('0x1d')]===_0xf5c7('0x5e')?_0x3de5de[_0xf5c7('0x4a')][_0xf5c7('0x1d')]:!_['isNil'](_0x3de5de[_0xf5c7('0x4b')])?_0x3de5de[_0xf5c7('0x4b')]+'\x20'+_0x3de5de['last_name']:_0x3de5de[_0xf5c7('0x4c')],'id':_0x3de5de['id']};_0x4f2480[_0xf5c7('0x5f')]=intUtil[_0xf5c7('0x60')](_0x41f6cb['Subjects'],_0x411131,'\x20');_0x4f2480[_0xf5c7('0x61')]=intUtil['getString'](_0x41f6cb[_0xf5c7('0x62')],_0x411131,'\x0a');if(_0x3e7f40['enduserType']===_0xf5c7('0x5a')){_0x4f2480[_0xf5c7('0x63')]={'name':!_[_0xf5c7('0x20')](_0x3e7f40['Full_Name'])?_0x3e7f40[_0xf5c7('0x64')]:!_['isNil'](_0x3e7f40[_0xf5c7('0x65')])?_0x3e7f40[_0xf5c7('0x65')]+'\x20'+_0x3e7f40[_0xf5c7('0x66')]:_0x3e7f40[_0xf5c7('0x66')],'id':_0x3e7f40['id']};}if(_0x3e7f40['enduserType']===_0xf5c7('0x57')){_0x4f2480[_0xf5c7('0x67')]={'name':!_[_0xf5c7('0x20')](_0x3e7f40[_0xf5c7('0x64')])?_0x3e7f40['Full_Name']:!_['isNil'](_0x3e7f40[_0xf5c7('0x65')])?_0x3e7f40[_0xf5c7('0x65')]+'\x20'+_0x3e7f40[_0xf5c7('0x66')]:_0x3e7f40[_0xf5c7('0x66')],'id':_0x3e7f40['id']};_0x4f2480[_0xf5c7('0x68')]=_[_0xf5c7('0x48')](_0x3e7f40['enduserType']);}if(_0x411131[_0xf5c7('0x69')]){_0x4f2480[_0xf5c7('0x6a')]=moment[_0xf5c7('0x6b')](parseInt(_0x411131[_0xf5c7('0x69')])*0x3e8)[_0xf5c7('0x36')](_0xf5c7('0x6c'));}else if(_0x411131['answertime']&&_0x411131['endtime']){_0x4f2480[_0xf5c7('0x6a')]=moment[_0xf5c7('0x6b')](moment(_0x411131[_0xf5c7('0x6d')],_0xf5c7('0x6e'))[_0xf5c7('0x6f')](moment(_0x411131['starttime'],_0xf5c7('0x6e'))))['format'](_0xf5c7('0x6c'));}switch(_0x411131[_0xf5c7('0x70')]){case'called':_0x4f2480['Call_Result']=_0xf5c7('0x71');break;case _0xf5c7('0x72'):case'connect':_0x4f2480['Call_Result']=_0xf5c7('0x73');break;case _0xf5c7('0x74'):_0x4f2480[_0xf5c7('0x75')]=_0xf5c7('0x76');break;case _0xf5c7('0x77'):_0x4f2480['Call_Result']=_0xf5c7('0x78');break;case _0xf5c7('0x79'):_0x4f2480[_0xf5c7('0x75')]='Timeout';default:}_0x4f2480[_0xf5c7('0x7a')]=(_0x33ded9===_0xf5c7('0x7b')?moment(_0x411131[_0xf5c7('0x7c')])[_0xf5c7('0x36')](_0xf5c7('0x6e')):moment(_0x411131['agentcalledAt'])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xf5c7('0x36')]('YYYY-MM-DDTHH:mm:ss');_0x4f2480[_0xf5c7('0x7d')]=_0x33ded9||_0xf5c7('0x7e');_0x4f2480=_[_0xf5c7('0x7f')](_0x4f2480,getCustomFields(_0x41f6cb[_0xf5c7('0x80')],_0x411131));return request({'method':_0xf5c7('0x81'),'uri':_0xf5c7('0x46')+_0x4afa8c+_0xf5c7('0x82'),'headers':{'Authorization':_0xf5c7('0x38')+_0x37605a},'body':{'data':[_0x4f2480]},'json':!![]})['then'](function(_0x5b4e54){if(_0x5b4e54&&_0x5b4e54[_0xf5c7('0x44')][0x0]['code']==='SUCCESS'){logger[_0xf5c7('0x33')](_0xf5c7('0x83'));return{'id':_0x5b4e54['data'][0x0][_0xf5c7('0x4e')]['id']};}})['catch'](function(_0x57d503){logger[_0xf5c7('0x33')](_0xf5c7('0x84'),_0x57d503[_0xf5c7('0x32')]);console[_0xf5c7('0x50')](_0xf5c7('0x84'),_0x57d503);});}exports[_0xf5c7('0x85')]=function(_0x17c0a8,_0x2e35f4,_0x4217d1,_0x10cb19,_0x9ebc23,_0x4c284d){var _0x2ef20c,_0x103ceb,_0x4d9ef1;_0x4c284d[_0xf5c7('0x86')]=intUtil['stripTrailingSlash'](_0x4c284d[_0xf5c7('0x86')]);_0x4c284d[_0xf5c7('0x87')]=intUtil[_0xf5c7('0x88')](_0x4c284d['serverUrl']);if(_0x9ebc23&&_0x9ebc23[_0xf5c7('0x89')]){logger[_0xf5c7('0x33')]('[QUEUE]',_0xf5c7('0x8a'));_0x2e35f4['recordingURL']=_0x4c284d[_0xf5c7('0x87')]+_0xf5c7('0x8b')+_0x2e35f4[_0xf5c7('0x8c')]+_0xf5c7('0x8d')+md5(_0x2e35f4[_0xf5c7('0x8c')]);}else{_0x2e35f4[_0xf5c7('0x8e')]='';}var _0x5cfc14=_0x4c284d[_0xf5c7('0x86')]===_0xf5c7('0x8f')?'eu':'com';return getAccessToken(_0x4c284d)[_0xf5c7('0x2c')](function(_0x45fd87){_0x4d9ef1=_0x45fd87;return getUser(_0x4d9ef1,_0x5cfc14,_0x4c284d,_0x10cb19[_0xf5c7('0x3c')]);})[_0xf5c7('0x2c')](function(_0x5e2845){_0x2ef20c=_0x5e2845;logger[_0xf5c7('0x33')]('The\x20User\x20ID\x20is:',_0x2ef20c['id']);return getEndUser(_0x4d9ef1,_0x5cfc14,_0x4c284d,_0x2e35f4[_0xf5c7('0x90')],_0x2e35f4[_0xf5c7('0x91')],_0x2ef20c,_0x4217d1);})[_0xf5c7('0x2c')](function(_0x1b7bc3){_0x103ceb=_0x1b7bc3;return getCall(_0x4d9ef1,_0x5cfc14,_0x4c284d,_0x2ef20c,_0x103ceb,_0x4217d1,_0x2e35f4,_0xf5c7('0x7e'));})[_0xf5c7('0x2c')](function(_0x2df40a){if(_0x2df40a){logger['info'](_0xf5c7('0x92'),_0x2df40a['id']);logger[_0xf5c7('0x33')](_0xf5c7('0x93'),_0xf5c7('0x94'));emit(util['format'](_0xf5c7('0x95'),_0x10cb19[_0xf5c7('0x1d')]),'trigger:browser:url',{'uri':_0xf5c7('0x96')+_0x4c284d[_0xf5c7('0x86')]+_0xf5c7('0x97')+_0x2df40a['id']});}})[_0xf5c7('0x30')](function(_0x359d54){logger[_0xf5c7('0x42')]('[QUEUE]',JSON[_0xf5c7('0xf')](_0x359d54));});};exports[_0xf5c7('0x7b')]=function(_0x35ef28,_0x371658,_0x48b29a,_0x4d50f1,_0xd432e,_0x3b187d,_0x5d0b9d){var _0x432e09,_0x24ef9a,_0x586940;_0x3b187d[_0xf5c7('0x86')]=intUtil[_0xf5c7('0x88')](_0x3b187d[_0xf5c7('0x86')]);_0x3b187d[_0xf5c7('0x87')]=intUtil[_0xf5c7('0x88')](_0x3b187d['serverUrl']);if(_0x5d0b9d&&_0x5d0b9d[_0xf5c7('0x98')]&&_0x5d0b9d[_0xf5c7('0x98')]!==_0xf5c7('0x99')){logger[_0xf5c7('0x33')]('[OUTBOUND]',_0xf5c7('0x8a'));_0x371658['recordingURL']=_0x3b187d['serverUrl']+_0xf5c7('0x8b')+_0x371658[_0xf5c7('0x8c')]+_0xf5c7('0x8d')+md5(_0x371658[_0xf5c7('0x8c')]);}var _0x58151f=_0x3b187d[_0xf5c7('0x86')]===_0xf5c7('0x8f')?'eu':_0xf5c7('0x9a');return getAccessToken(_0x3b187d)[_0xf5c7('0x2c')](function(_0x13ba22){_0x586940=_0x13ba22;return getUser(_0x586940,_0x58151f,_0x3b187d,_0x4d50f1[_0xf5c7('0x3c')]);})['then'](function(_0x35700d){_0x432e09=_0x35700d;logger[_0xf5c7('0x33')](_0xf5c7('0x9b'),_0x432e09['id']);return getEndUser(_0x586940,_0x58151f,_0x3b187d,_0x371658[_0xf5c7('0x9c')],_0x371658[_0xf5c7('0x9d')],_0x432e09,_0x48b29a);})[_0xf5c7('0x2c')](function(_0x240d31){_0x24ef9a=_0x240d31;return getCall(_0x586940,_0x58151f,_0x3b187d,_0x432e09,_0x24ef9a,_0x48b29a,_0x371658,_0xf5c7('0x9e'));})[_0xf5c7('0x2c')](function(_0x4fe332){if(_0x4fe332){logger[_0xf5c7('0x33')](_0xf5c7('0x92'),_0x4fe332['id']);logger['info'](_0xf5c7('0x9f'),_0xf5c7('0x94'));emit(util[_0xf5c7('0x36')](_0xf5c7('0x95'),_0x4d50f1[_0xf5c7('0x1d')]),_0xf5c7('0xa0'),{'uri':_0xf5c7('0x96')+_0x3b187d[_0xf5c7('0x86')]+_0xf5c7('0x97')+_0x4fe332['id']});}})[_0xf5c7('0x30')](function(_0x50e862){logger[_0xf5c7('0x42')](_0xf5c7('0x9f'),JSON[_0xf5c7('0xf')](_0x50e862));});};exports[_0xf5c7('0xa1')]=function(_0x48ecad,_0x42444e,_0x1325d1,_0x28c08c,_0x27d881,_0x2456f2){var _0x299e87,_0x529e09,_0x2c5f49;_0x2456f2[_0xf5c7('0x86')]=intUtil[_0xf5c7('0x88')](_0x2456f2[_0xf5c7('0x86')]);_0x2456f2[_0xf5c7('0x87')]=intUtil[_0xf5c7('0x88')](_0x2456f2[_0xf5c7('0x87')]);if(_0x27d881&&_0x27d881[_0xf5c7('0x89')]){logger[_0xf5c7('0x33')]('['+_0x42444e[_0xf5c7('0x70')]['toUpperCase']()+']',_0xf5c7('0x8a'));_0x42444e[_0xf5c7('0x8e')]=_0x2456f2['serverUrl']+_0xf5c7('0x8b')+_0x42444e[_0xf5c7('0x8c')]+_0xf5c7('0x8d')+md5(_0x42444e['uniqueid']);}else{_0x42444e[_0xf5c7('0x8e')]='';}var _0x420447=_0x2456f2[_0xf5c7('0x86')]==='zoho.eu'?'eu':_0xf5c7('0x9a');return getAccessToken(_0x2456f2)['then'](function(_0x386f0e){_0x2c5f49=_0x386f0e;return getUser(_0x2c5f49,_0x420447,_0x2456f2);})['then'](function(_0x4acf50){_0x299e87=_0x4acf50;logger[_0xf5c7('0x33')](_0xf5c7('0x9b'),_0x299e87['id']);return getEndUser(_0x2c5f49,_0x420447,_0x2456f2,_0x42444e[_0xf5c7('0x90')],_0x42444e['calleridnum'],_0x299e87,_0x1325d1);})[_0xf5c7('0x2c')](function(_0x15ebe5){_0x529e09=_0x15ebe5;return getCall(_0x2c5f49,_0x420447,_0x2456f2,_0x299e87,_0x529e09,_0x1325d1,_0x42444e,'Inbound');})[_0xf5c7('0x2c')](function(_0x54ee2a){if(_0x54ee2a){logger[_0xf5c7('0x33')](_0xf5c7('0x92'),_0x54ee2a['id']);}})[_0xf5c7('0x30')](function(_0x21e865){logger[_0xf5c7('0x42')]('['+_0x42444e['lastevent']['toUpperCase']()+']',JSON[_0xf5c7('0xf')](_0x21e865));});}; \ No newline at end of file +var _0x8b59=['Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','zoho.eu','destcalleridname','destcalleridnum','trigger:browser:url','unmanaged','toUpperCase','calleridnum','lodash','request-promise','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','includes','string','picklist','idField','content','toString','type','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','access_token','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','add','expires_in','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','isNil','role','first_name','last_name','SUCCESS','details','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Leads','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','starttime','Call_Type','Inbound','Call\x20created!','err','log','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','uniqueid','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:'];(function(_0x57b4df,_0x540ed4){var _0x413d9d=function(_0x2cea76){while(--_0x2cea76){_0x57b4df['push'](_0x57b4df['shift']());}};_0x413d9d(++_0x540ed4);}(_0x8b59,0x1d7));var _0x98b5=function(_0x54050e,_0x36ae37){_0x54050e=_0x54050e-0x0;var _0x3ee153=_0x8b59[_0x54050e];return _0x3ee153;};'use strict';var _=require(_0x98b5('0x0'));var rp=require(_0x98b5('0x1'));var md5=require('md5');var util=require(_0x98b5('0x2'));var intUtil=require(_0x98b5('0x3'));var moment=require(_0x98b5('0x4'));var Redis=require(_0x98b5('0x5'));var BPromise=require('bluebird');var config=require(_0x98b5('0x6'));var logger=require(_0x98b5('0x7'))(_0x98b5('0x8'));config['redis']=_[_0x98b5('0x9')](config[_0x98b5('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x98b5('0xb'))(new Redis(config[_0x98b5('0xa')]));function emit(_0xa596cd,_0x4bf99c,_0x1601ba){io['to'](_0xa596cd)[_0x98b5('0xc')](_0x4bf99c,_0x1601ba);}function request(_0x15198e){logger[_0x98b5('0xd')](_0x98b5('0xe'),JSON[_0x98b5('0xf')](_0x15198e));return rp(_0x15198e);}function getCustomFields(_0x2ff081,_0x4dc95b){var _0x62d812={};if(_0x2ff081['length']>0x0){_[_0x98b5('0x10')](_0x2ff081,function(_0x2c2071){if(_[_0x98b5('0x11')]([_0x98b5('0x12'),_0x98b5('0x13')],_0x2c2071['type'])&&_0x2c2071[_0x98b5('0x14')]){_0x62d812[_0x2c2071[_0x98b5('0x14')]]=_0x2c2071[_0x98b5('0x15')][_0x98b5('0x16')]();}else if(_0x2c2071[_0x98b5('0x17')]==='variable'&&_0x2c2071[_0x98b5('0x18')]&&_0x2c2071[_0x98b5('0x14')]&&_0x4dc95b[_0x2c2071[_0x98b5('0x18')]]){_0x62d812[_0x2c2071[_0x98b5('0x14')]]=_0x4dc95b[_0x2c2071[_0x98b5('0x18')]][_0x98b5('0x16')]();}else if(_0x2c2071['type']===_0x98b5('0x19')&&_0x2c2071[_0x98b5('0x1a')]&&_0x2c2071[_0x98b5('0x1a')][_0x98b5('0x1b')]&&_0x2c2071[_0x98b5('0x14')]&&_0x4dc95b[_0x2c2071[_0x98b5('0x1a')][_0x98b5('0x1b')][_0x98b5('0x1c')]()]){_0x62d812[_0x2c2071[_0x98b5('0x14')]]=_0x4dc95b[_0x2c2071[_0x98b5('0x1a')][_0x98b5('0x1b')][_0x98b5('0x1c')]()]['toString']();}});}return _0x62d812;}function getName(_0x138eb4){if(_0x138eb4[_0x98b5('0x1d')]('\x20')>0x0){var _0x8f6b4f=_0x138eb4[_0x98b5('0x1e')](/ (.+)/);if(_0x8f6b4f[0x1]){return _0x8f6b4f;}}return[_0x138eb4,_0x138eb4];}var accountsTokens={};function getAccessToken(_0xeef07d){return new Promise(function(_0x516354,_0x13c458){if(!_['isNil'](accountsTokens[_0xeef07d['id']])&&!_['isNil'](accountsTokens[_0xeef07d['id']][_0x98b5('0x1f')])){if(moment()['isBefore'](accountsTokens[_0xeef07d['id']]['expires_in'])){_0x516354(accountsTokens[_0xeef07d['id']]['access_token']);}}var _0x2ddf27;switch(_0xeef07d['zone']){case'US':_0x2ddf27='https://accounts.zoho.com';break;case'AU':_0x2ddf27=_0x98b5('0x20');break;case'EU':_0x2ddf27=_0x98b5('0x21');break;case'IN':_0x2ddf27=_0x98b5('0x22');break;case'CN':_0x2ddf27='https://accounts.zoho.com.cn';break;default:_0x2ddf27=_0x98b5('0x21');break;}var _0x7f8b08={'method':_0x98b5('0x23'),'uri':_0x2ddf27+_0x98b5('0x24'),'qs':{'refresh_token':_0xeef07d[_0x98b5('0x25')],'client_id':_0xeef07d['clientId'],'client_secret':_0xeef07d[_0x98b5('0x26')],'grant_type':_0x98b5('0x27')},'json':!![]};return rp(_0x7f8b08)[_0x98b5('0x28')](function(_0x6228e1){accountsTokens[_0xeef07d['id']]={'access_token':_0x6228e1[_0x98b5('0x1f')],'expires_in':moment()[_0x98b5('0x29')](_0x6228e1[_0x98b5('0x2a')],'seconds')};_0x516354(_0x6228e1[_0x98b5('0x1f')]);})[_0x98b5('0x2b')](function(_0x26adf2){logger[_0x98b5('0x2c')]('Failing\x20creating\x20the\x20access_token',_0x26adf2[_0x98b5('0x2d')]);_0x13c458(_0x26adf2);});});}function getUser(_0x35a1dc,_0x473b6b,_0x2a614b,_0x32a720){logger[_0x98b5('0x2e')](_0x98b5('0x2f'));return request({'method':_0x98b5('0x30'),'uri':util[_0x98b5('0x31')](_0x98b5('0x32'),_0x473b6b),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x98b5('0x33')+_0x35a1dc},'json':!![]})['then'](function(_0x5eaf1c){if(_0x5eaf1c[_0x98b5('0x34')]){var _0x2003e7=-0x1;if(_[_0x98b5('0x35')](_0x5eaf1c['users'])){if(!_['isNil'](_0x32a720)){_0x2003e7=_[_0x98b5('0x36')](_0x5eaf1c['users'],function(_0x688a27){return _0x688a27[_0x98b5('0x37')]===_0x32a720;});}if(_0x2003e7>=0x0){logger['info'](_0x98b5('0x38'));}else{logger[_0x98b5('0x2e')](_0x98b5('0x39'));_0x2003e7=_[_0x98b5('0x36')](_0x5eaf1c[_0x98b5('0x34')],function(_0x37997a){return _0x37997a[_0x98b5('0x3a')]['name']==='Administrator';});}return _0x5eaf1c[_0x98b5('0x34')][_0x2003e7];}else{if(_0x5eaf1c['user']['profile']['name']===_0x98b5('0x3b')){logger[_0x98b5('0x2e')](_0x98b5('0x39'));user=_0x5eaf1c[_0x98b5('0x3c')];return user;}else{logger[_0x98b5('0x2c')](_0x98b5('0x3d'),JSON[_0x98b5('0xf')](_0x5eaf1c));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x98b5('0xf')](_0x5eaf1c));}}}else{logger[_0x98b5('0x2c')](_0x98b5('0x3d'),JSON[_0x98b5('0xf')](_0x5eaf1c));throw new Error(_0x98b5('0x3e')+JSON[_0x98b5('0xf')](_0x5eaf1c));}})[_0x98b5('0x2b')](function(_0x21cd9c){console[_0x98b5('0x2c')](_0x21cd9c);});}function getZohoUser(_0x3720e4,_0x23ae0c){return new BPromise(function(_0x11b7fb,_0x53d616){request(_0x3720e4)[_0x98b5('0x28')](function(_0x5c4f5a){var _0x1bcafb=null;if(_0x5c4f5a){_0x1bcafb=_0x5c4f5a[_0x98b5('0x3f')][0x0];_0x1bcafb[_0x98b5('0x40')]=_0x23ae0c;}_0x11b7fb(_0x1bcafb);})[_0x98b5('0x2b')](function(_0x1de7c8){_0x53d616(_0x1de7c8);});});}function createEndUser(_0x45a3fa,_0xd9493d,_0x2312d2,_0x50e5f5,_0x582495,_0x2acb8d){var _0x2312d2=getName(_0x2312d2);return request({'method':'POST','uri':_0x98b5('0x41')+_0xd9493d+_0x98b5('0x42')+_[_0x98b5('0x43')](_0x2acb8d[_0x98b5('0x44')])+'s','body':{'data':[{'Last_Name':_0x2312d2[0x1],'First_Name':_0x2312d2[0x0],'Phone':_0x50e5f5,'Owner':{'name':!_[_0x98b5('0x45')](_0x582495[_0x98b5('0x46')][_0x98b5('0x1b')])?_0x582495['role'][_0x98b5('0x1b')]:!_[_0x98b5('0x45')](_0x582495[_0x98b5('0x47')])?_0x582495[_0x98b5('0x47')]+'\x20'+_0x582495[_0x98b5('0x48')]:_0x582495['last_name'],'id':_0x582495['id']}}]},'headers':{'Authorization':_0x98b5('0x33')+_0x45a3fa},'json':!![]})[_0x98b5('0x28')](function(_0x5c1ac0){if(_0x5c1ac0&&_0x5c1ac0[_0x98b5('0x3f')][0x0]['code']===_0x98b5('0x49')){var _0x462ba9=_0x5c1ac0['data'][0x0][_0x98b5('0x4a')];_0x462ba9[_0x98b5('0x40')]=_[_0x98b5('0x43')](_0x2acb8d[_0x98b5('0x44')])+'s';return _0x462ba9;}logger[_0x98b5('0x2c')](_0x98b5('0x3d'),JSON[_0x98b5('0xf')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})['catch'](function(_0x598df4){console['log'](_0x98b5('0x4b'),_0x598df4);});}function getEndUser(_0x397275,_0x3b4b64,_0x36929d,_0x1e0176,_0x29b90e,_0x3ff4c9,_0x4d64f2){var _0xa0c229={'method':_0x98b5('0x30'),'uri':'','headers':{'Authorization':_0x98b5('0x33')+_0x397275},'json':!![]};switch(_0x4d64f2[_0x98b5('0x4c')]){case _0x98b5('0x4d'):_0xa0c229[_0x98b5('0x4e')]='https://www.zohoapis.'+_0x3b4b64+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x29b90e+'))';return getZohoUser(_0xa0c229,_0x98b5('0x4f'))[_0x98b5('0x28')](function(_0x5a5bc7){if(_0x5a5bc7)return _0x5a5bc7;_0xa0c229[_0x98b5('0x4e')]=_0x98b5('0x41')+_0x3b4b64+_0x98b5('0x50')+_0x29b90e+'))';return getZohoUser(_0xa0c229,'Leads')['then'](function(_0x1528c8){if(_0x1528c8)return _0x1528c8;if(_0x4d64f2[_0x98b5('0x44')]!='nothing'){return createEndUser(_0x397275,_0x3b4b64,_0x1e0176,_0x29b90e,_0x3ff4c9,_0x4d64f2);}else{return{};}});});break;case _0x98b5('0x51'):_0xa0c229[_0x98b5('0x4e')]=_0x98b5('0x41')+_0x3b4b64+_0x98b5('0x52')+_0x29b90e+'))';return getZohoUser(_0xa0c229,'Contacts')[_0x98b5('0x28')](function(_0x4abff8){if(_0x4abff8)return _0x4abff8;if(_0x4d64f2['moduleCreate']!='nothing'){return createEndUser(_0x397275,_0x3b4b64,_0x1e0176,_0x29b90e,_0x3ff4c9,_0x4d64f2);}else{return{};}});break;case'lead':_0xa0c229[_0x98b5('0x4e')]=_0x98b5('0x41')+_0x3b4b64+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x29b90e+'))';return getZohoUser(_0xa0c229,'Leads')[_0x98b5('0x28')](function(_0x34c06a){if(_0x34c06a)return _0x34c06a;if(_0x4d64f2[_0x98b5('0x44')]!=_0x98b5('0x53')){return createEndUser(_0x397275,_0x3b4b64,_0x1e0176,_0x29b90e,_0x3ff4c9,_0x4d64f2);}else{return{};}});break;}}function getCall(_0x5e357b,_0x24d836,_0x4ce3e9,_0x4b6efc,_0x578cff,_0x17649d,_0x177157,_0x39b94f){logger['info'](_0x98b5('0x54'));var _0x178ce4={};_0x178ce4[_0x98b5('0x55')]={'name':!_[_0x98b5('0x45')](_0x4b6efc[_0x98b5('0x46')][_0x98b5('0x1b')])&&!_[_0x98b5('0x45')](_0x4b6efc[_0x98b5('0x3a')][_0x98b5('0x1b')])&&_0x4b6efc[_0x98b5('0x3a')][_0x98b5('0x1b')]===_0x98b5('0x56')?_0x4b6efc[_0x98b5('0x46')]['name']:!_['isNil'](_0x4b6efc[_0x98b5('0x47')])?_0x4b6efc[_0x98b5('0x47')]+'\x20'+_0x4b6efc['last_name']:_0x4b6efc['last_name'],'id':_0x4b6efc['id']};_0x178ce4['Subject']=intUtil[_0x98b5('0x57')](_0x17649d[_0x98b5('0x58')],_0x177157,'\x20');_0x178ce4[_0x98b5('0x59')]=intUtil[_0x98b5('0x57')](_0x17649d[_0x98b5('0x5a')],_0x177157,'\x0a');if(_0x578cff[_0x98b5('0x40')]===_0x98b5('0x4f')){_0x178ce4[_0x98b5('0x5b')]={'name':!_[_0x98b5('0x45')](_0x578cff[_0x98b5('0x5c')])?_0x578cff[_0x98b5('0x5c')]:!_['isNil'](_0x578cff[_0x98b5('0x5d')])?_0x578cff[_0x98b5('0x5d')]+'\x20'+_0x578cff[_0x98b5('0x5e')]:_0x578cff[_0x98b5('0x5e')],'id':_0x578cff['id']};}if(_0x578cff['enduserType']===_0x98b5('0x5f')){_0x178ce4['What_Id']={'name':!_['isNil'](_0x578cff[_0x98b5('0x5c')])?_0x578cff[_0x98b5('0x5c')]:!_[_0x98b5('0x45')](_0x578cff[_0x98b5('0x5d')])?_0x578cff[_0x98b5('0x5d')]+'\x20'+_0x578cff['Last_Name']:_0x578cff[_0x98b5('0x5e')],'id':_0x578cff['id']};_0x178ce4['$se_module']=_['startCase'](_0x578cff['enduserType']);}if(_0x177157[_0x98b5('0x60')]){_0x178ce4[_0x98b5('0x61')]=moment[_0x98b5('0x62')](parseInt(_0x177157['talktime'])*0x3e8)['format'](_0x98b5('0x63'));}else if(_0x177157[_0x98b5('0x64')]&&_0x177157[_0x98b5('0x65')]){_0x178ce4[_0x98b5('0x61')]=moment[_0x98b5('0x62')](moment(_0x177157[_0x98b5('0x65')],_0x98b5('0x66'))[_0x98b5('0x67')](moment(_0x177157['starttime'],_0x98b5('0x66'))))['format']('mm:ss');}switch(_0x177157[_0x98b5('0x68')]){case _0x98b5('0x69'):_0x178ce4['Call_Result']=_0x98b5('0x6a');break;case _0x98b5('0x6b'):case _0x98b5('0x6c'):_0x178ce4[_0x98b5('0x6d')]=_0x98b5('0x6e');break;case _0x98b5('0x6f'):_0x178ce4['Call_Result']=_0x98b5('0x70');break;case _0x98b5('0x71'):_0x178ce4[_0x98b5('0x6d')]=_0x98b5('0x72');break;case'timeout':_0x178ce4[_0x98b5('0x6d')]=_0x98b5('0x73');default:}_0x178ce4[_0x98b5('0x74')]=(_0x39b94f===_0x98b5('0x75')?moment(_0x177157[_0x98b5('0x76')])['format'](_0x98b5('0x66')):moment(_0x177157['agentcalledAt'])[_0x98b5('0x31')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x98b5('0x31')]('YYYY-MM-DDTHH:mm:ss');_0x178ce4[_0x98b5('0x77')]=_0x39b94f||_0x98b5('0x78');_0x178ce4=_['merge'](_0x178ce4,getCustomFields(_0x17649d['Fields'],_0x177157));return request({'method':_0x98b5('0x23'),'uri':_0x98b5('0x41')+_0x24d836+'/crm/v2/Calls','headers':{'Authorization':_0x98b5('0x33')+_0x5e357b},'body':{'data':[_0x178ce4]},'json':!![]})['then'](function(_0x12963b){if(_0x12963b&&_0x12963b[_0x98b5('0x3f')][0x0]['code']===_0x98b5('0x49')){logger[_0x98b5('0x2e')](_0x98b5('0x79'));return{'id':_0x12963b[_0x98b5('0x3f')][0x0][_0x98b5('0x4a')]['id']};}})[_0x98b5('0x2b')](function(_0x420dde){logger[_0x98b5('0x2e')](_0x98b5('0x7a'),_0x420dde[_0x98b5('0x2d')]);console[_0x98b5('0x7b')](_0x98b5('0x7a'),_0x420dde);});}exports[_0x98b5('0x7c')]=function(_0x48e978,_0x2e0ecd,_0x34ff56,_0x20d4c2,_0x394558,_0x41decc){var _0x3fe92b,_0x4215f5,_0xc61254;_0x41decc[_0x98b5('0x7d')]=intUtil[_0x98b5('0x7e')](_0x41decc[_0x98b5('0x7d')]);_0x41decc['serverUrl']=intUtil[_0x98b5('0x7e')](_0x41decc[_0x98b5('0x7f')]);if(_0x394558&&_0x394558['monitor_format']){logger[_0x98b5('0x2e')](_0x98b5('0x80'),_0x98b5('0x81'));_0x2e0ecd[_0x98b5('0x82')]=_0x41decc[_0x98b5('0x7f')]+'/api/voice/recordings/'+_0x2e0ecd['uniqueid']+_0x98b5('0x83')+md5(_0x2e0ecd[_0x98b5('0x84')]);}else{_0x2e0ecd['recordingURL']='';}var _0x26a6ae=_0x41decc[_0x98b5('0x7d')]==='zoho.eu'?'eu':_0x98b5('0x85');return getAccessToken(_0x41decc)['then'](function(_0x254df8){_0xc61254=_0x254df8;return getUser(_0xc61254,_0x26a6ae,_0x41decc,_0x20d4c2[_0x98b5('0x37')]);})[_0x98b5('0x28')](function(_0xfa9ded){_0x3fe92b=_0xfa9ded;logger['info'](_0x98b5('0x86'),_0x3fe92b['id']);return getEndUser(_0xc61254,_0x26a6ae,_0x41decc,_0x2e0ecd[_0x98b5('0x87')],_0x2e0ecd['calleridnum'],_0x3fe92b,_0x34ff56);})[_0x98b5('0x28')](function(_0x177778){_0x4215f5=_0x177778;return getCall(_0xc61254,_0x26a6ae,_0x41decc,_0x3fe92b,_0x4215f5,_0x34ff56,_0x2e0ecd,_0x98b5('0x78'));})[_0x98b5('0x28')](function(_0x26a6db){if(_0x26a6db){logger['info'](_0x98b5('0x88'),_0x26a6db['id']);logger[_0x98b5('0x2e')](_0x98b5('0x80'),_0x98b5('0x89'));emit(util[_0x98b5('0x31')](_0x98b5('0x8a'),_0x20d4c2[_0x98b5('0x1b')]),'trigger:browser:url',{'uri':_0x98b5('0x8b')+_0x41decc['host']+_0x98b5('0x8c')+_0x26a6db['id']});}})[_0x98b5('0x2b')](function(_0x2edf8b){logger[_0x98b5('0x2c')]('[QUEUE]',JSON['stringify'](_0x2edf8b));});};exports[_0x98b5('0x75')]=function(_0x578a55,_0x1207dc,_0x126b09,_0x387cf2,_0x337d00,_0x466229,_0x519aca){var _0x237692,_0x44d846,_0x4b455b;_0x466229[_0x98b5('0x7d')]=intUtil[_0x98b5('0x7e')](_0x466229[_0x98b5('0x7d')]);_0x466229[_0x98b5('0x7f')]=intUtil[_0x98b5('0x7e')](_0x466229[_0x98b5('0x7f')]);if(_0x519aca&&_0x519aca[_0x98b5('0x8d')]&&_0x519aca[_0x98b5('0x8d')]!==_0x98b5('0x8e')){logger['info'](_0x98b5('0x8f'),_0x98b5('0x81'));_0x1207dc[_0x98b5('0x82')]=_0x466229[_0x98b5('0x7f')]+_0x98b5('0x90')+_0x1207dc[_0x98b5('0x84')]+_0x98b5('0x83')+md5(_0x1207dc[_0x98b5('0x84')]);}var _0x59a17b=_0x466229[_0x98b5('0x7d')]===_0x98b5('0x91')?'eu':_0x98b5('0x85');return getAccessToken(_0x466229)[_0x98b5('0x28')](function(_0x371bd9){_0x4b455b=_0x371bd9;return getUser(_0x4b455b,_0x59a17b,_0x466229,_0x387cf2[_0x98b5('0x37')]);})['then'](function(_0x21b094){_0x237692=_0x21b094;logger['info']('The\x20User\x20ID\x20is:',_0x237692['id']);return getEndUser(_0x4b455b,_0x59a17b,_0x466229,_0x1207dc[_0x98b5('0x92')],_0x1207dc[_0x98b5('0x93')],_0x237692,_0x126b09);})[_0x98b5('0x28')](function(_0x14cee2){_0x44d846=_0x14cee2;return getCall(_0x4b455b,_0x59a17b,_0x466229,_0x237692,_0x44d846,_0x126b09,_0x1207dc,'Outbound');})['then'](function(_0x5382ed){if(_0x5382ed){logger[_0x98b5('0x2e')](_0x98b5('0x88'),_0x5382ed['id']);logger[_0x98b5('0x2e')](_0x98b5('0x8f'),_0x98b5('0x89'));emit(util['format'](_0x98b5('0x8a'),_0x387cf2[_0x98b5('0x1b')]),_0x98b5('0x94'),{'uri':'https://crm.'+_0x466229[_0x98b5('0x7d')]+_0x98b5('0x8c')+_0x5382ed['id']});}})[_0x98b5('0x2b')](function(_0x1844dd){logger[_0x98b5('0x2c')](_0x98b5('0x8f'),JSON['stringify'](_0x1844dd));});};exports[_0x98b5('0x95')]=function(_0x1ba613,_0x585900,_0x1b4d52,_0x125475,_0x37e2ee,_0x1462d0){var _0x8941f8,_0x5aba64,_0x2c663b;_0x1462d0['host']=intUtil['stripTrailingSlash'](_0x1462d0[_0x98b5('0x7d')]);_0x1462d0['serverUrl']=intUtil[_0x98b5('0x7e')](_0x1462d0[_0x98b5('0x7f')]);if(_0x37e2ee&&_0x37e2ee['monitor_format']){logger[_0x98b5('0x2e')]('['+_0x585900[_0x98b5('0x68')][_0x98b5('0x96')]()+']','Recording\x20is\x20enabled!');_0x585900[_0x98b5('0x82')]=_0x1462d0[_0x98b5('0x7f')]+_0x98b5('0x90')+_0x585900['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x585900[_0x98b5('0x84')]);}else{_0x585900['recordingURL']='';}var _0x248041=_0x1462d0[_0x98b5('0x7d')]===_0x98b5('0x91')?'eu':'com';return getAccessToken(_0x1462d0)[_0x98b5('0x28')](function(_0x18a942){_0x2c663b=_0x18a942;return getUser(_0x2c663b,_0x248041,_0x1462d0);})[_0x98b5('0x28')](function(_0x221dac){_0x8941f8=_0x221dac;logger[_0x98b5('0x2e')](_0x98b5('0x86'),_0x8941f8['id']);return getEndUser(_0x2c663b,_0x248041,_0x1462d0,_0x585900[_0x98b5('0x87')],_0x585900[_0x98b5('0x97')],_0x8941f8,_0x1b4d52);})[_0x98b5('0x28')](function(_0x4248d9){_0x5aba64=_0x4248d9;return getCall(_0x2c663b,_0x248041,_0x1462d0,_0x8941f8,_0x5aba64,_0x1b4d52,_0x585900,_0x98b5('0x78'));})['then'](function(_0x2a3758){if(_0x2a3758){logger[_0x98b5('0x2e')](_0x98b5('0x88'),_0x2a3758['id']);}})[_0x98b5('0x2b')](function(_0x8776e5){logger['error']('['+_0x585900[_0x98b5('0x68')][_0x98b5('0x96')]()+']',JSON[_0x98b5('0xf')](_0x8776e5));});}; \ 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 1dbca64..b9e0843 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 _0x9182=['shelljs','../../../../config/logger','trigger','exec','data2','Script','render','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9182,0x1df));var _0x2918=function(_0x2be3d4,_0x213dc4){_0x2be3d4=_0x2be3d4-0x0;var _0x38440e=_0x9182[_0x2be3d4];return _0x38440e;};'use strict';var util=require(_0x2918('0x0'));var sh=require(_0x2918('0x1'));var Mustache=require('mustache');var logger=require(_0x2918('0x2'))(_0x2918('0x3'));exports[_0x2918('0x4')]=function(_0xdaf702,_0x5bc979){var _0x229395=_0xdaf702[_0x2918('0x5')]?_0xdaf702['data2']:_0x2918('0x6');var _0x2a0adf=_0xdaf702['data3']?Mustache[_0x2918('0x7')](_0xdaf702[_0x2918('0x8')],_0x5bc979):_0x5bc979;sh[_0x2918('0x4')](_0x2a0adf,function(_0x4cd60e,_0x128413,_0x2f26fd){if(_0x4cd60e!==0x0){logger[_0x2918('0x9')](util[_0x2918('0xa')](_0x2918('0xb'),_0x229395,_0x2a0adf,_0x4cd60e,_0x2f26fd));}else{logger['info'](util[_0x2918('0xa')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x229395,_0x2a0adf,_0x128413));}});}; \ No newline at end of file +var _0x5abf=['Script','render','data3','error','%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','../../../../config/logger','trigger','exec','data2'];(function(_0x5326f3,_0xade490){var _0x394455=function(_0x52534c){while(--_0x52534c){_0x5326f3['push'](_0x5326f3['shift']());}};_0x394455(++_0xade490);}(_0x5abf,0x125));var _0xf5ab=function(_0x7c5834,_0xa96cfb){_0x7c5834=_0x7c5834-0x0;var _0x40becf=_0x5abf[_0x7c5834];return _0x40becf;};'use strict';var util=require(_0xf5ab('0x0'));var sh=require(_0xf5ab('0x1'));var Mustache=require('mustache');var logger=require(_0xf5ab('0x2'))(_0xf5ab('0x3'));exports[_0xf5ab('0x4')]=function(_0x3095ee,_0x3ddc47){var _0x343e97=_0x3095ee[_0xf5ab('0x5')]?_0x3095ee[_0xf5ab('0x5')]:_0xf5ab('0x6');var _0x8ef2d5=_0x3095ee['data3']?Mustache[_0xf5ab('0x7')](_0x3095ee[_0xf5ab('0x8')],_0x3ddc47):_0x3ddc47;sh[_0xf5ab('0x4')](_0x8ef2d5,function(_0x1a0868,_0x187a25,_0x24ded6){if(_0x1a0868!==0x0){logger[_0xf5ab('0x9')](util['format'](_0xf5ab('0xa'),_0x343e97,_0x8ef2d5,_0x1a0868,_0x24ded6));}else{logger[_0xf5ab('0xb')](util['format'](_0xf5ab('0xc'),_0x343e97,_0x8ef2d5,_0x187a25));}});}; \ 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 331f858..9fb23f6 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 _0xaae7=['../../../../config/logger','trigger','exec','toUpperCase','render','data2','data5','number','parse','data6','error','GET','DELETE','POST','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data1','stringify','then',',\x20request\x20body:\x20','statusCode','catch','message','request-promise','util','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaae7,0x152));var _0x7aae=function(_0x51dc48,_0x4c7d12){_0x51dc48=_0x51dc48-0x0;var _0x58693e=_0xaae7[_0x51dc48];return _0x58693e;};'use strict';var rp=require(_0x7aae('0x0'));var util=require(_0x7aae('0x1'));var _=require('lodash');var Mustache=require(_0x7aae('0x2'));var logger=require(_0x7aae('0x3'))(_0x7aae('0x4'));exports[_0x7aae('0x5')]=function(_0x12e93f,_0x2d8aef){var _0x3c8dfb,_0x267181;var _0x4cf2da={'method':_0x12e93f['data1'][_0x7aae('0x6')](),'uri':Mustache[_0x7aae('0x7')](_0x12e93f[_0x7aae('0x8')],_0x2d8aef),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x12e93f[_0x7aae('0x9')])===_0x7aae('0xa')&&parseInt(_0x12e93f[_0x7aae('0x9')])>=0x1&&parseInt(_0x12e93f[_0x7aae('0x9')])<=0xa?parseInt(_0x12e93f[_0x7aae('0x9')])*0x3e8:0x5*0x3e8};try{_0x4cf2da['headers']=_0x12e93f['data6']?JSON[_0x7aae('0xb')](Mustache[_0x7aae('0x7')](_0x12e93f[_0x7aae('0xc')],_0x2d8aef)):{};}catch(_0x5350e4){logger[_0x7aae('0xd')](_0x5350e4['stack']);}switch(_0x12e93f['data1'][_0x7aae('0x6')]()){case _0x7aae('0xe'):case _0x7aae('0xf'):_0x3c8dfb=null;_0x4cf2da['qs']=_0x2d8aef;break;case _0x7aae('0x10'):case _0x7aae('0x11'):if(_0x12e93f[_0x7aae('0x12')]){try{_0x3c8dfb=JSON[_0x7aae('0xb')](Mustache[_0x7aae('0x7')](_0x12e93f[_0x7aae('0x12')],_0x2d8aef));_0x4cf2da[_0x7aae('0x13')]=_0x3c8dfb;}catch(_0x4af7c8){logger[_0x7aae('0xd')](_0x4af7c8[_0x7aae('0x14')]);logger['error'](_0x7aae('0x15'));}}else{_0x3c8dfb=_0x2d8aef;_0x4cf2da[_0x7aae('0x13')]=_0x3c8dfb;}break;}logger['info'](util[_0x7aae('0x16')](_0x7aae('0x17'),_0x12e93f[_0x7aae('0x18')],_0x12e93f[_0x7aae('0x8')],JSON[_0x7aae('0x19')](_0x4cf2da)));rp(_0x4cf2da)[_0x7aae('0x1a')](function(_0x52abf3){_0x3c8dfb=!_['isNil'](_0x3c8dfb)?_0x7aae('0x1b')+_0x3c8dfb:'';_0x267181=typeof _0x52abf3[_0x7aae('0x13')]==='object'?JSON[_0x7aae('0x19')](_0x52abf3[_0x7aae('0x13')]):_0x52abf3[_0x7aae('0x13')];logger['info'](util[_0x7aae('0x16')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x12e93f[_0x7aae('0x18')],_0x12e93f[_0x7aae('0x8')],_0x52abf3[_0x7aae('0x1c')],_0x267181));})[_0x7aae('0x1d')](function(_0x487d44){logger[_0x7aae('0xd')](util[_0x7aae('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x12e93f[_0x7aae('0x18')],_0x12e93f[_0x7aae('0x8')],_0x487d44[_0x7aae('0x1c')],_0x487d44['name'],_0x487d44[_0x7aae('0x1e')]));});}; \ No newline at end of file +var _0x87ee=['body','object','stringify','%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','message','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','render','data2','data5','headers','data6','parse','stack','data1','GET','DELETE','PUT','data7','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','isNil',',\x20request\x20body:\x20'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87ee,0x87));var _0xe87e=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x87ee[_0x455c6c];return _0x488242;};'use strict';var rp=require(_0xe87e('0x0'));var util=require('util');var _=require(_0xe87e('0x1'));var Mustache=require(_0xe87e('0x2'));var logger=require(_0xe87e('0x3'))(_0xe87e('0x4'));exports[_0xe87e('0x5')]=function(_0x48b7ac,_0x46eb2b){var _0x6465b2,_0x1013e6;var _0x545fd0={'method':_0x48b7ac['data1']['toUpperCase'](),'uri':Mustache[_0xe87e('0x6')](_0x48b7ac[_0xe87e('0x7')],_0x46eb2b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x48b7ac[_0xe87e('0x8')])==='number'&&parseInt(_0x48b7ac['data5'])>=0x1&&parseInt(_0x48b7ac['data5'])<=0xa?parseInt(_0x48b7ac[_0xe87e('0x8')])*0x3e8:0x5*0x3e8};try{_0x545fd0[_0xe87e('0x9')]=_0x48b7ac[_0xe87e('0xa')]?JSON[_0xe87e('0xb')](Mustache[_0xe87e('0x6')](_0x48b7ac[_0xe87e('0xa')],_0x46eb2b)):{};}catch(_0x3cea81){logger['error'](_0x3cea81[_0xe87e('0xc')]);}switch(_0x48b7ac[_0xe87e('0xd')]['toUpperCase']()){case _0xe87e('0xe'):case _0xe87e('0xf'):_0x6465b2=null;_0x545fd0['qs']=_0x46eb2b;break;case'POST':case _0xe87e('0x10'):if(_0x48b7ac['data7']){try{_0x6465b2=JSON[_0xe87e('0xb')](Mustache[_0xe87e('0x6')](_0x48b7ac[_0xe87e('0x11')],_0x46eb2b));_0x545fd0['body']=_0x6465b2;}catch(_0x733aba){logger[_0xe87e('0x12')](_0x733aba[_0xe87e('0xc')]);logger[_0xe87e('0x12')](_0xe87e('0x13'));}}else{_0x6465b2=_0x46eb2b;_0x545fd0['body']=_0x6465b2;}break;}logger[_0xe87e('0x14')](util[_0xe87e('0x15')](_0xe87e('0x16'),_0x48b7ac[_0xe87e('0xd')],_0x48b7ac['data2'],JSON['stringify'](_0x545fd0)));rp(_0x545fd0)['then'](function(_0x1143ad){_0x6465b2=!_[_0xe87e('0x17')](_0x6465b2)?_0xe87e('0x18')+_0x6465b2:'';_0x1013e6=typeof _0x1143ad[_0xe87e('0x19')]===_0xe87e('0x1a')?JSON[_0xe87e('0x1b')](_0x1143ad[_0xe87e('0x19')]):_0x1143ad[_0xe87e('0x19')];logger[_0xe87e('0x14')](util[_0xe87e('0x15')](_0xe87e('0x1c'),_0x48b7ac[_0xe87e('0xd')],_0x48b7ac['data2'],_0x1143ad[_0xe87e('0x1d')],_0x1013e6));})['catch'](function(_0xeb56ea){logger[_0xe87e('0x12')](util[_0xe87e('0x15')](_0xe87e('0x1e'),_0x48b7ac['data1'],_0x48b7ac[_0xe87e('0x7')],_0xeb56ea[_0xe87e('0x1d')],_0xeb56ea['name'],_0xeb56ea[_0xe87e('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 99b558f..e01c0d2 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 _0x8fd7=['then','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http'];(function(_0x80a73e,_0x5ca209){var _0x5a2443=function(_0x4a6306){while(--_0x4a6306){_0x80a73e['push'](_0x80a73e['shift']());}};_0x5a2443(++_0x5ca209);}(_0x8fd7,0xbd));var _0x78fd=function(_0x3b2366,_0x31e636){_0x3b2366=_0x3b2366-0x0;var _0x4bbc37=_0x8fd7[_0x3b2366];return _0x4bbc37;};'use strict';var jayson=require(_0x78fd('0x0'));var BPromise=require(_0x78fd('0x1'));var logger=require(_0x78fd('0x2'))(_0x78fd('0x3'));var client=jayson[_0x78fd('0x4')][_0x78fd('0x5')]({'port':0x2329});client['Request']=function(_0x885c1,_0x15bb75){return new BPromise(function(_0x445b3c,_0x1e9dcd){return client['request'](_0x885c1,_0x15bb75)[_0x78fd('0x6')](function(_0x291982){logger['debug'](_0x78fd('0x7'),_0x78fd('0x3'),_0x885c1,_0x15bb75,_0x291982);if(_0x291982[_0x78fd('0x8')]){logger[_0x78fd('0x8')]('rpc',_0x78fd('0x3'),_0x885c1,_0x291982[_0x78fd('0x8')][_0x78fd('0x9')],_0x15bb75);return _0x1e9dcd(_0x291982[_0x78fd('0x8')][_0x78fd('0x9')]);}else{return _0x445b3c(_0x291982[_0x78fd('0xa')]);}})[_0x78fd('0xb')](function(_0x22bf07){logger[_0x78fd('0x8')]('rpc',_0x78fd('0x3'),_0x885c1,_0x22bf07,_0x15bb75);return _0x1e9dcd(_0x22bf07);});});};module[_0x78fd('0xc')]=client; \ No newline at end of file +var _0xd1ad=['catch','jayson/promise','bluebird','../../config/logger','client','debug','rpc','error','routing','message','result'];(function(_0x3e5f6d,_0x121db6){var _0x1bea6e=function(_0x435c7c){while(--_0x435c7c){_0x3e5f6d['push'](_0x3e5f6d['shift']());}};_0x1bea6e(++_0x121db6);}(_0xd1ad,0x1ae));var _0xdd1a=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0xd1ad[_0x18a436];return _0x5c2cf8;};'use strict';var jayson=require(_0xdd1a('0x0'));var BPromise=require(_0xdd1a('0x1'));var logger=require(_0xdd1a('0x2'))('routing');var client=jayson[_0xdd1a('0x3')]['http']({'port':0x2329});client['Request']=function(_0x5eb77b,_0x515dbd){return new BPromise(function(_0x21e979,_0xe59525){return client['request'](_0x5eb77b,_0x515dbd)['then'](function(_0x2961cf){logger[_0xdd1a('0x4')](_0xdd1a('0x5'),'routing',_0x5eb77b,_0x515dbd,_0x2961cf);if(_0x2961cf['error']){logger[_0xdd1a('0x6')](_0xdd1a('0x5'),_0xdd1a('0x7'),_0x5eb77b,_0x2961cf['error'][_0xdd1a('0x8')],_0x515dbd);return _0xe59525(_0x2961cf['error'][_0xdd1a('0x8')]);}else{return _0x21e979(_0x2961cf[_0xdd1a('0x9')]);}})[_0xdd1a('0xa')](function(_0x3402c7){logger['error'](_0xdd1a('0x5'),_0xdd1a('0x7'),_0x5eb77b,_0x3402c7,_0x515dbd);return _0xe59525(_0x3402c7);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5920b9e..a2221a5 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 _0x23bb=['getMailAccounts','mailAccounts','getSettings','catch','bluebird','./lib/email','./rpc/mailAccount','./rpc/setting','then'];(function(_0x4bef34,_0x3aa1e4){var _0x21f1fa=function(_0x3af6bd){while(--_0x3af6bd){_0x4bef34['push'](_0x4bef34['shift']());}};_0x21f1fa(++_0x3aa1e4);}(_0x23bb,0x79));var _0xb23b=function(_0x4371a8,_0x3ac39){_0x4371a8=_0x4371a8-0x0;var _0x110901=_0x23bb[_0x4371a8];return _0x110901;};'use strict';var BPromise=require(_0xb23b('0x0'));var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0xb23b('0x1'));var mailAccount=require(_0xb23b('0x2'));var setting=require(_0xb23b('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0xb23b('0x4')](mailAccount[_0xb23b('0x5')]())[_0xb23b('0x4')](realtime['initMailAccounts']())['then'](function(){email['refresh'](realtime[_0xb23b('0x6')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0xb23b('0x7')]();})['then'](function(_0x117bd5){return setInterval(initRealtime,_0x117bd5['loginMailFrequency']*0x3e8);})[_0xb23b('0x8')](function(_0x33b27d){console['log'](_0x33b27d);});}main(); \ No newline at end of file +var _0x7647=['./rpc/setting','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0x7647,0x12d));var _0x7764=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7647[_0x57b54c];return _0x59cc19;};'use strict';var BPromise=require(_0x7764('0x0'));var server=require(_0x7764('0x1'));var Realtime=require(_0x7764('0x2'));var EmailChannel=require(_0x7764('0x3'));var mailAccount=require(_0x7764('0x4'));var setting=require(_0x7764('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x7764('0x6')]()[_0x7764('0x7')](mailAccount[_0x7764('0x8')]())[_0x7764('0x7')](realtime[_0x7764('0x9')]())[_0x7764('0x7')](function(){email[_0x7764('0xa')](realtime[_0x7764('0xb')]);return realtime;});}function main(){return server[_0x7764('0xc')](realtime,email)[_0x7764('0x7')](function(){return initRealtime();})[_0x7764('0x7')](function(){return setting[_0x7764('0xd')]();})[_0x7764('0x7')](function(_0x573471){return setInterval(initRealtime,_0x573471[_0x7764('0xe')]*0x3e8);})[_0x7764('0xf')](function(_0x3e9166){console[_0x7764('0x10')](_0x3e9166);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 9dd8bf3..31258ca 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 _0x66de=['../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','prototype','emit','key','active','status','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','bind','email','end','error','handleImapError','disabled','connected','name','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','Mail\x20accepted\x20from\x20routing','catch','handleImapEnd','smtp','send','verifySmtp','Smtp','lastSync','verify','then','moment','bluebird','md5','ioredis','../../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x66de,0x69));var _0xe66d=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0x66de[_0x38c632];return _0x12737e;};'use strict';var _=require('lodash');var moment=require(_0xe66d('0x0'));var BPromise=require(_0xe66d('0x1'));var md5=require(_0xe66d('0x2'));var Redis=require(_0xe66d('0x3'));var config=require(_0xe66d('0x4'));var logger=require(_0xe66d('0x5'))('email');config[_0xe66d('0x6')]=_[_0xe66d('0x7')](config[_0xe66d('0x6')],{'host':_0xe66d('0x8'),'port':0x18eb});var io=require(_0xe66d('0x9'))(new Redis(config['redis']));var EmailImap=require(_0xe66d('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xe66d('0xb'));var md5Accounts={};function EmailChannel(_0x334cc1){logger[_0xe66d('0xc')](_0xe66d('0xd'));this[_0xe66d('0xe')]=_0x334cc1['mailAccounts'];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0xe66d('0xf')][_0xe66d('0x10')]=function(_0x5e255e){var _0x391855=this[_0xe66d('0xe')][_0x5e255e];var _0xe5bf50={'id':_0x391855['id'],'name':_0x391855['name'],'key':_0x391855[_0xe66d('0x11')],'active':_0x391855[_0xe66d('0x12')],'Imap':{'status':_0x391855['Imap'][_0xe66d('0x13')],'messageStatus':_0x391855[_0xe66d('0x14')][_0xe66d('0x15')],'total':_0x391855['Imap'][_0xe66d('0x16')]}};if(_[_0xe66d('0x17')](md5Accounts[_0x5e255e])){md5Accounts[_0x5e255e]={};}var _0x44a099=md5(JSON[_0xe66d('0x18')](_0xe5bf50));if(md5Accounts[_0x5e255e][_0xe66d('0x2')]!==_0x44a099){md5Accounts[_0x5e255e][_0xe66d('0x2')]=_0x44a099;io[_0xe66d('0x10')](_0xe66d('0x19'),_0xe5bf50);}};EmailChannel[_0xe66d('0xf')][_0xe66d('0x1a')]=function(_0x5037b3){for(var _0x32c66d in _0x5037b3){if(_0x5037b3[_0xe66d('0x1b')](_0x32c66d)){if(_0x5037b3[_0x32c66d][_0xe66d('0x14')]&&_0x5037b3[_0x32c66d]['active']){var _0x440b86=_0x5037b3[_0x32c66d][_0xe66d('0x14')];if(!this[_0xe66d('0x1c')][_0xe66d('0x1b')](_0x440b86['id'])){this[_0xe66d('0x1c')][_0x440b86['id']]=new EmailImap(_0x440b86,_0x5037b3[_0x32c66d]['email']);this['imapAccounts'][_0x440b86['id']]['on'](_0xe66d('0x1d'),this[_0xe66d('0x1e')][_0xe66d('0x1f')](this,_0x32c66d));this[_0xe66d('0x1c')][_0x440b86['id']]['on'](_0xe66d('0x20'),this['handleImapEmail'][_0xe66d('0x1f')](this,_0x32c66d));this[_0xe66d('0x1c')][_0x440b86['id']]['on'](_0xe66d('0x21'),this['handleImapEnd'][_0xe66d('0x1f')](this,_0x32c66d));this[_0xe66d('0x1c')][_0x440b86['id']]['on'](_0xe66d('0x22'),this[_0xe66d('0x23')][_0xe66d('0x1f')](this,_0x32c66d));}}else{if(_[_0xe66d('0x17')](this[_0xe66d('0xe')][_0x32c66d][_0xe66d('0x14')])){this[_0xe66d('0xe')][_0x32c66d][_0xe66d('0x14')]={};}this[_0xe66d('0xe')][_0x32c66d][_0xe66d('0x14')][_0xe66d('0x13')]=_0xe66d('0x24');this['mailAccounts'][_0x32c66d][_0xe66d('0x14')][_0xe66d('0x15')]='';this[_0xe66d('0x10')](_0x32c66d);}}}};EmailChannel[_0xe66d('0xf')]['handleImapBox']=function(_0x4c0a65,_0x8cb43e){if(this[_0xe66d('0xe')][_0x4c0a65]){this['mailAccounts'][_0x4c0a65][_0xe66d('0x14')][_0xe66d('0x13')]=_0xe66d('0x25');this[_0xe66d('0xe')][_0x4c0a65]['Imap']['messageStatus']=_0x8cb43e[_0xe66d('0x26')];if(_0x8cb43e[_0xe66d('0x27')]){this[_0xe66d('0xe')][_0x4c0a65][_0xe66d('0x14')]['total']=_0x8cb43e[_0xe66d('0x27')][_0xe66d('0x16')];}return this[_0xe66d('0x10')](_0x4c0a65);}};EmailChannel[_0xe66d('0xf')][_0xe66d('0x28')]=function(_0x36edad,_0x1e72cf){logger['info'](_0xe66d('0x29'),_0x1e72cf[_0xe66d('0x2a')],_0x1e72cf[_0xe66d('0x2b')],_0x1e72cf[_0xe66d('0x2c')],_0x36edad);if(this[_0xe66d('0xe')][_0x36edad]){return mailAccount['notify'](_0x36edad,_0x1e72cf)['then'](function(_0x5d3383){if(_0x5d3383){logger['info'](_0xe66d('0x2d'));}})[_0xe66d('0x2e')](function(_0x3b02da){logger[_0xe66d('0x22')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xe66d('0x18')](_0x3b02da));});}};EmailChannel[_0xe66d('0xf')][_0xe66d('0x2f')]=function(_0x390ec7){if(this[_0xe66d('0xe')][_0x390ec7]&&this[_0xe66d('0xe')][_0x390ec7]['Imap']){if(this['imapAccounts'][this[_0xe66d('0xe')][_0x390ec7][_0xe66d('0x14')]['id']]){delete this[_0xe66d('0x1c')][this['mailAccounts'][_0x390ec7][_0xe66d('0x14')]['id']];}this[_0xe66d('0xe')][_0x390ec7][_0xe66d('0x14')]['lastSync']=moment();this['emit'](_0x390ec7);}};EmailChannel[_0xe66d('0xf')][_0xe66d('0x23')]=function(_0xd3e25e,_0x5c3a8f){if(this[_0xe66d('0xe')][_0xd3e25e]){this[_0xe66d('0xe')][_0xd3e25e][_0xe66d('0x14')][_0xe66d('0x13')]=_0xe66d('0x22');this[_0xe66d('0xe')][_0xd3e25e][_0xe66d('0x14')][_0xe66d('0x15')]=_0x5c3a8f;return this[_0xe66d('0x10')](_0xd3e25e);}};EmailChannel[_0xe66d('0xf')]['sendMail']=function(_0x3232a6,_0x523288){return this[_0xe66d('0x30')][_0xe66d('0x31')](_0x3232a6,_0x523288);};EmailChannel[_0xe66d('0xf')][_0xe66d('0x32')]=function(_0x1dec28){var _0x5f40d7=this;if(this[_0xe66d('0xe')][_0x1dec28['id']]){if(_[_0xe66d('0x17')](this[_0xe66d('0xe')][_0x1dec28['id']][_0xe66d('0x33')])){this[_0xe66d('0xe')][_0x1dec28['id']]['Smtp']={};}this['mailAccounts'][_0x1dec28['id']][_0xe66d('0x33')][_0xe66d('0x34')]=moment();return new BPromise(function(_0x125383,_0x39c748){return _0x5f40d7[_0xe66d('0x30')][_0xe66d('0x35')](_0x1dec28)[_0xe66d('0x36')](function(_0x182e73){_0x5f40d7[_0xe66d('0xe')][_0x1dec28['id']][_0xe66d('0x33')][_0xe66d('0x13')]='verified';_0x5f40d7['mailAccounts'][_0x1dec28['id']][_0xe66d('0x33')][_0xe66d('0x15')]='';_0x5f40d7['emit'](_0x1dec28['id']);_0x125383(_0x182e73);})['catch'](function(_0x489eaa){_0x5f40d7['mailAccounts'][_0x1dec28['id']][_0xe66d('0x33')][_0xe66d('0x13')]='error';_0x5f40d7['mailAccounts'][_0x1dec28['id']][_0xe66d('0x33')]['messageStatus']=_0x489eaa;_0x5f40d7[_0xe66d('0x10')](_0x1dec28['id']);_0x39c748(_0x489eaa);});});}return this[_0xe66d('0x30')][_0xe66d('0x35')](_0x1dec28);};module['exports']=EmailChannel; \ No newline at end of file +var _0x193a=['hasOwnProperty','email','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verify','verified','catch','lodash','moment','bluebird','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','key','active','Imap','status','messageStatus','total','isNil','stringify','emit','mailAccount:update','refresh'];(function(_0x259190,_0xa7fd7c){var _0x23d2aa=function(_0x4ec1ed){while(--_0x4ec1ed){_0x259190['push'](_0x259190['shift']());}};_0x23d2aa(++_0xa7fd7c);}(_0x193a,0x92));var _0xa193=function(_0x5e26fc,_0xb6b8c0){_0x5e26fc=_0x5e26fc-0x0;var _0x55e66a=_0x193a[_0x5e26fc];return _0x55e66a;};'use strict';var _=require(_0xa193('0x0'));var moment=require(_0xa193('0x1'));var BPromise=require(_0xa193('0x2'));var md5=require(_0xa193('0x3'));var Redis=require(_0xa193('0x4'));var config=require(_0xa193('0x5'));var logger=require('../../../config/logger')('email');config[_0xa193('0x6')]=_[_0xa193('0x7')](config[_0xa193('0x6')],{'host':_0xa193('0x8'),'port':0x18eb});var io=require(_0xa193('0x9'))(new Redis(config[_0xa193('0x6')]));var EmailImap=require(_0xa193('0xa'));var EmailSmtp=require(_0xa193('0xb'));var mailAccount=require(_0xa193('0xc'));var md5Accounts={};function EmailChannel(_0x1d3ec2){logger[_0xa193('0xd')](_0xa193('0xe'));this[_0xa193('0xf')]=_0x1d3ec2[_0xa193('0xf')];this[_0xa193('0x10')]={};this[_0xa193('0x11')]=new EmailSmtp();}EmailChannel[_0xa193('0x12')]['emit']=function(_0x3b1c51){var _0x5a30f7=this[_0xa193('0xf')][_0x3b1c51];var _0xcc20d5={'id':_0x5a30f7['id'],'name':_0x5a30f7[_0xa193('0x13')],'key':_0x5a30f7[_0xa193('0x14')],'active':_0x5a30f7[_0xa193('0x15')],'Imap':{'status':_0x5a30f7[_0xa193('0x16')][_0xa193('0x17')],'messageStatus':_0x5a30f7[_0xa193('0x16')][_0xa193('0x18')],'total':_0x5a30f7['Imap'][_0xa193('0x19')]}};if(_[_0xa193('0x1a')](md5Accounts[_0x3b1c51])){md5Accounts[_0x3b1c51]={};}var _0x1e5d4c=md5(JSON[_0xa193('0x1b')](_0xcc20d5));if(md5Accounts[_0x3b1c51][_0xa193('0x3')]!==_0x1e5d4c){md5Accounts[_0x3b1c51][_0xa193('0x3')]=_0x1e5d4c;io[_0xa193('0x1c')](_0xa193('0x1d'),_0xcc20d5);}};EmailChannel[_0xa193('0x12')][_0xa193('0x1e')]=function(_0x1b7b95){for(var _0x16c091 in _0x1b7b95){if(_0x1b7b95[_0xa193('0x1f')](_0x16c091)){if(_0x1b7b95[_0x16c091][_0xa193('0x16')]&&_0x1b7b95[_0x16c091][_0xa193('0x15')]){var _0x2e5890=_0x1b7b95[_0x16c091][_0xa193('0x16')];if(!this[_0xa193('0x10')]['hasOwnProperty'](_0x2e5890['id'])){this[_0xa193('0x10')][_0x2e5890['id']]=new EmailImap(_0x2e5890,_0x1b7b95[_0x16c091][_0xa193('0x20')]);this[_0xa193('0x10')][_0x2e5890['id']]['on'](_0xa193('0x21'),this[_0xa193('0x22')][_0xa193('0x23')](this,_0x16c091));this['imapAccounts'][_0x2e5890['id']]['on'](_0xa193('0x20'),this[_0xa193('0x24')][_0xa193('0x23')](this,_0x16c091));this[_0xa193('0x10')][_0x2e5890['id']]['on'](_0xa193('0x25'),this[_0xa193('0x26')]['bind'](this,_0x16c091));this['imapAccounts'][_0x2e5890['id']]['on'](_0xa193('0x27'),this[_0xa193('0x28')][_0xa193('0x23')](this,_0x16c091));}}else{if(_[_0xa193('0x1a')](this[_0xa193('0xf')][_0x16c091][_0xa193('0x16')])){this['mailAccounts'][_0x16c091][_0xa193('0x16')]={};}this['mailAccounts'][_0x16c091][_0xa193('0x16')][_0xa193('0x17')]=_0xa193('0x29');this['mailAccounts'][_0x16c091]['Imap'][_0xa193('0x18')]='';this[_0xa193('0x1c')](_0x16c091);}}}};EmailChannel['prototype'][_0xa193('0x22')]=function(_0x280cd4,_0x52f76c){if(this[_0xa193('0xf')][_0x280cd4]){this[_0xa193('0xf')][_0x280cd4][_0xa193('0x16')]['status']=_0xa193('0x2a');this[_0xa193('0xf')][_0x280cd4][_0xa193('0x16')]['messageStatus']=_0x52f76c[_0xa193('0x13')];if(_0x52f76c['messages']){this[_0xa193('0xf')][_0x280cd4][_0xa193('0x16')][_0xa193('0x19')]=_0x52f76c[_0xa193('0x2b')][_0xa193('0x19')];}return this[_0xa193('0x1c')](_0x280cd4);}};EmailChannel[_0xa193('0x12')][_0xa193('0x24')]=function(_0x51aef2,_0x526886){logger[_0xa193('0xd')](_0xa193('0x2c'),_0x526886[_0xa193('0x2d')],_0x526886[_0xa193('0x2e')],_0x526886[_0xa193('0x2f')],_0x51aef2);if(this[_0xa193('0xf')][_0x51aef2]){return mailAccount[_0xa193('0x30')](_0x51aef2,_0x526886)[_0xa193('0x31')](function(_0x43de62){if(_0x43de62){logger[_0xa193('0xd')](_0xa193('0x32'));}})['catch'](function(_0x44fcb8){logger[_0xa193('0x27')](_0xa193('0x33'),JSON[_0xa193('0x1b')](_0x44fcb8));});}};EmailChannel[_0xa193('0x12')][_0xa193('0x26')]=function(_0x298ba3){if(this[_0xa193('0xf')][_0x298ba3]&&this[_0xa193('0xf')][_0x298ba3][_0xa193('0x16')]){if(this[_0xa193('0x10')][this['mailAccounts'][_0x298ba3]['Imap']['id']]){delete this[_0xa193('0x10')][this['mailAccounts'][_0x298ba3]['Imap']['id']];}this[_0xa193('0xf')][_0x298ba3][_0xa193('0x16')][_0xa193('0x34')]=moment();this[_0xa193('0x1c')](_0x298ba3);}};EmailChannel[_0xa193('0x12')][_0xa193('0x28')]=function(_0x24f38d,_0x5b8d8c){if(this['mailAccounts'][_0x24f38d]){this[_0xa193('0xf')][_0x24f38d][_0xa193('0x16')][_0xa193('0x17')]=_0xa193('0x27');this['mailAccounts'][_0x24f38d][_0xa193('0x16')]['messageStatus']=_0x5b8d8c;return this[_0xa193('0x1c')](_0x24f38d);}};EmailChannel[_0xa193('0x12')][_0xa193('0x35')]=function(_0x4b6230,_0x1c83e5){return this['smtp'][_0xa193('0x36')](_0x4b6230,_0x1c83e5);};EmailChannel[_0xa193('0x12')]['verifySmtp']=function(_0x5591e5){var _0x1d483b=this;if(this[_0xa193('0xf')][_0x5591e5['id']]){if(_[_0xa193('0x1a')](this['mailAccounts'][_0x5591e5['id']][_0xa193('0x37')])){this[_0xa193('0xf')][_0x5591e5['id']][_0xa193('0x37')]={};}this[_0xa193('0xf')][_0x5591e5['id']][_0xa193('0x37')][_0xa193('0x34')]=moment();return new BPromise(function(_0x3dd9ef,_0x28ae29){return _0x1d483b['smtp'][_0xa193('0x38')](_0x5591e5)[_0xa193('0x31')](function(_0x360f83){_0x1d483b[_0xa193('0xf')][_0x5591e5['id']][_0xa193('0x37')][_0xa193('0x17')]=_0xa193('0x39');_0x1d483b[_0xa193('0xf')][_0x5591e5['id']][_0xa193('0x37')]['messageStatus']='';_0x1d483b[_0xa193('0x1c')](_0x5591e5['id']);_0x3dd9ef(_0x360f83);})[_0xa193('0x3a')](function(_0x54a171){_0x1d483b[_0xa193('0xf')][_0x5591e5['id']][_0xa193('0x37')][_0xa193('0x17')]=_0xa193('0x27');_0x1d483b[_0xa193('0xf')][_0x5591e5['id']][_0xa193('0x37')][_0xa193('0x18')]=_0x54a171;_0x1d483b['emit'](_0x5591e5['id']);_0x28ae29(_0x54a171);});});}return this['smtp'][_0xa193('0x38')](_0x5591e5);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 100e9eb..bf24763 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 _0xf06f=['textCode','hasOwnProperty','exports','path','util','imap','lodash','randomstring','simpleParser','iconv','Iconv','EventEmitter','./utils','mailbox','INBOX','account','ready','bind','end','handleEnd','handleError','inherits','prototype','getAccount','connTimeout','authTimeout','authentication','user','password','host','port','tls','required','service','anonymous@xcally.com','handleReady','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','once','error','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','handleMessageAttributes','handleSimpleParser','parser','email','stringify'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xf06f,0x15f));var _0xff06=function(_0x46516b,_0x12e504){_0x46516b=_0x46516b-0x0;var _0x13eae2=_0xf06f[_0x46516b];return _0x13eae2;};'use strict';var fs=require('fs');var path=require(_0xff06('0x0'));var util=require(_0xff06('0x1'));var Imap=require(_0xff06('0x2'));var _=require(_0xff06('0x3'));var rs=require(_0xff06('0x4'));var simpleParser=require('mailparser')[_0xff06('0x5')];var Iconv=require(_0xff06('0x6'))[_0xff06('0x7')];var EventEmitter=require('events')[_0xff06('0x8')];var utils=require(_0xff06('0x9'));var logger=require('../../../config/logger')('email');function EmailImap(_0x1d19ad,_0xa16aba){this[_0xff06('0xa')]=_0xff06('0xb');this[_0xff06('0xc')]=this['getAccount'](_0x1d19ad,_0xa16aba);this[_0xff06('0x2')]=new Imap(this[_0xff06('0xc')]);this[_0xff06('0x2')]['once'](_0xff06('0xd'),this['handleReady'][_0xff06('0xe')](this));this[_0xff06('0x2')]['once'](_0xff06('0xf'),this[_0xff06('0x10')][_0xff06('0xe')](this));this[_0xff06('0x2')]['on']('error',this[_0xff06('0x11')][_0xff06('0xe')](this));this[_0xff06('0x2')]['connect']();}util[_0xff06('0x12')](EmailImap,EventEmitter);EmailImap[_0xff06('0x13')][_0xff06('0x14')]=function(_0x516acd,_0x5d33c3){var _0x13dc44={'connTimeout':_0x516acd['connTimeout']?_0x516acd[_0xff06('0x15')]*0x3e8:0x2710,'authTimeout':_0x516acd[_0xff06('0x16')]?_0x516acd['authTimeout']*0x3e8:0x1388};if(_['isNil'](_0x516acd['service'])){if(_0x516acd[_0xff06('0x17')]){_0x13dc44['user']=_0x516acd[_0xff06('0x18')];_0x13dc44[_0xff06('0x19')]=_0x516acd['password'];}_0x13dc44[_0xff06('0x1a')]=_0x516acd[_0xff06('0x1a')];_0x13dc44[_0xff06('0x1b')]=_0x516acd['port']||0x3e1;if(_0x516acd[_0xff06('0x1c')]){_0x13dc44[_0xff06('0x1c')]=!![];}else{_0x13dc44[_0xff06('0x1c')]=![];_0x13dc44['autotls']=_0xff06('0x1d');}}else{_0x13dc44['user']=_0x516acd['user'];_0x13dc44[_0xff06('0x19')]=_0x516acd[_0xff06('0x19')];_0x13dc44['host']=utils['getHost'](_0x516acd[_0xff06('0x1e')]);_0x13dc44[_0xff06('0x1b')]=0x3e1;_0x13dc44[_0xff06('0x1c')]=!![];}_0x13dc44['email']=_0x5d33c3||_0x516acd[_0xff06('0x18')]||_0xff06('0x1f');return _0x13dc44;};EmailImap[_0xff06('0x13')][_0xff06('0x20')]=function(){this[_0xff06('0x2')][_0xff06('0x21')](this[_0xff06('0xa')],![],this['handleOpenBox'][_0xff06('0xe')](this));};EmailImap['prototype'][_0xff06('0x22')]=function(_0x55d90c,_0x28d269){if(_0x55d90c){this[_0xff06('0x11')](_0x55d90c,!![]);}else{this[_0xff06('0x23')]('box',_0x28d269);this[_0xff06('0x24')]();}};EmailImap[_0xff06('0x13')][_0xff06('0x25')]=function(_0x41dd98){if(_0x41dd98){this[_0xff06('0x11')](_0x41dd98,!![]);}else{this[_0xff06('0x2')][_0xff06('0xf')]();}};EmailImap[_0xff06('0x13')][_0xff06('0x24')]=function(){this[_0xff06('0x2')][_0xff06('0x26')](['UNSEEN'],this[_0xff06('0x27')][_0xff06('0xe')](this));};EmailImap[_0xff06('0x13')]['handleReadUnseen']=function(_0x201f99,_0x27739c){if(_0x201f99){this[_0xff06('0x11')](_0x201f99,!![]);}else{if(_0x27739c[_0xff06('0x28')]){try{var _0x4766fe=this[_0xff06('0x2')][_0xff06('0x29')](_0x27739c,{'bodies':'','markSeen':!![]});_0x4766fe['on']('message',this['handleFetchMessage'][_0xff06('0xe')](this));_0x4766fe[_0xff06('0x2a')](_0xff06('0x2b'),this[_0xff06('0x2c')][_0xff06('0xe')](this));_0x4766fe['once'](_0xff06('0xf'),this[_0xff06('0x2d')][_0xff06('0xe')](this));}catch(_0x42c4f0){logger['error'](_0x42c4f0);}}else{this[_0xff06('0x2')][_0xff06('0x2e')](!![],this['handleCloseBox'][_0xff06('0xe')](this));}}};EmailImap['prototype'][_0xff06('0x2f')]=function(_0x570ec5,_0x55bbb9){_0x570ec5['on'](_0xff06('0x30'),this[_0xff06('0x31')]['bind'](this));_0x570ec5['once']('attributes',this[_0xff06('0x32')][_0xff06('0xe')](this));_0x570ec5[_0xff06('0x2a')]('end',this['handleMessageEnd']['bind'](this));};EmailImap[_0xff06('0x13')][_0xff06('0x31')]=function(_0xdaf90d,_0x3a96be){simpleParser(_0xdaf90d,{'Iconv':Iconv},this[_0xff06('0x33')][_0xff06('0xe')](this));};EmailImap[_0xff06('0x13')]['handleMessageAttributes']=function(_0x3ef8e9){};EmailImap[_0xff06('0x13')]['handleMessageEnd']=function(){};EmailImap['prototype'][_0xff06('0x33')]=function(_0x45fa4f,_0x4c692d){if(_0x45fa4f){logger[_0xff06('0x2b')](_0x45fa4f);}else{var _0x45cb43=this;utils[_0xff06('0x34')](this['account'],_0x4c692d,function(_0x22e359){_0x45cb43['emit'](_0xff06('0x35'),_0x22e359);});}};EmailImap[_0xff06('0x13')]['handleFetchEnd']=function(){this[_0xff06('0x2')][_0xff06('0x2e')](!![],this['handleCloseBox'][_0xff06('0xe')](this));};EmailImap[_0xff06('0x13')][_0xff06('0x2c')]=function(_0x27bf39){this[_0xff06('0x11')](_0x27bf39);this[_0xff06('0x2')][_0xff06('0x2e')](!![],this[_0xff06('0x25')][_0xff06('0xe')](this));};EmailImap[_0xff06('0x13')]['handleEnd']=function(){this[_0xff06('0x23')](_0xff06('0xf'));};EmailImap[_0xff06('0x13')][_0xff06('0x11')]=function(_0x281ecf,_0x156faa){logger[_0xff06('0x2b')](_0xff06('0x11'),this[_0xff06('0xc')][_0xff06('0x35')],JSON[_0xff06('0x36')](_0x281ecf));var _0x37a01c='';if(_0x281ecf){if(_0x281ecf[_0xff06('0x37')]){_0x37a01c=_0x281ecf[_0xff06('0x37')];}else{for(var _0x29a105 in _0x281ecf){if(_0x281ecf[_0xff06('0x38')](_0x29a105)){_0x37a01c+=_['upperFirst'](_0x29a105)+':\x20'+_0x281ecf[_0x29a105]+'\x0a';}}}}if(_0x156faa){this['imap'][_0xff06('0xf')]();}else{this[_0xff06('0x23')](_0xff06('0x2b'),_0x37a01c);this[_0xff06('0x23')](_0xff06('0xf'));}};module[_0xff06('0x39')]=EmailImap; \ No newline at end of file +var _0x4df6=['once','ready','handleReady','end','bind','error','handleError','inherits','prototype','connTimeout','authTimeout','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchEnd','closeBox','handleMessageBody','attributes','handleSimpleParser','handleMessageAttributes','parser','account','emit','stringify','textCode','hasOwnProperty','exports','util','imap','lodash','randomstring','simpleParser','Iconv','events','EventEmitter','./utils','email','mailbox','getAccount'];(function(_0x59fa70,_0x21b9bc){var _0x394816=function(_0x112e5a){while(--_0x112e5a){_0x59fa70['push'](_0x59fa70['shift']());}};_0x394816(++_0x21b9bc);}(_0x4df6,0xdc));var _0x64df=function(_0x5393b3,_0x17d9b6){_0x5393b3=_0x5393b3-0x0;var _0xb3c758=_0x4df6[_0x5393b3];return _0xb3c758;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x64df('0x0'));var Imap=require(_0x64df('0x1'));var _=require(_0x64df('0x2'));var rs=require(_0x64df('0x3'));var simpleParser=require('mailparser')[_0x64df('0x4')];var Iconv=require('iconv')[_0x64df('0x5')];var EventEmitter=require(_0x64df('0x6'))[_0x64df('0x7')];var utils=require(_0x64df('0x8'));var logger=require('../../../config/logger')(_0x64df('0x9'));function EmailImap(_0x2d3161,_0x185a37){this[_0x64df('0xa')]='INBOX';this['account']=this[_0x64df('0xb')](_0x2d3161,_0x185a37);this['imap']=new Imap(this['account']);this['imap'][_0x64df('0xc')](_0x64df('0xd'),this[_0x64df('0xe')]['bind'](this));this[_0x64df('0x1')][_0x64df('0xc')](_0x64df('0xf'),this['handleEnd'][_0x64df('0x10')](this));this[_0x64df('0x1')]['on'](_0x64df('0x11'),this[_0x64df('0x12')]['bind'](this));this['imap']['connect']();}util[_0x64df('0x13')](EmailImap,EventEmitter);EmailImap[_0x64df('0x14')][_0x64df('0xb')]=function(_0x1a4c01,_0x38181a){var _0x3b6c33={'connTimeout':_0x1a4c01[_0x64df('0x15')]?_0x1a4c01[_0x64df('0x15')]*0x3e8:0x2710,'authTimeout':_0x1a4c01['authTimeout']?_0x1a4c01[_0x64df('0x16')]*0x3e8:0x1388};if(_['isNil'](_0x1a4c01[_0x64df('0x17')])){if(_0x1a4c01[_0x64df('0x18')]){_0x3b6c33[_0x64df('0x19')]=_0x1a4c01[_0x64df('0x19')];_0x3b6c33[_0x64df('0x1a')]=_0x1a4c01['password'];}_0x3b6c33['host']=_0x1a4c01[_0x64df('0x1b')];_0x3b6c33['port']=_0x1a4c01[_0x64df('0x1c')]||0x3e1;if(_0x1a4c01[_0x64df('0x1d')]){_0x3b6c33[_0x64df('0x1d')]=!![];}else{_0x3b6c33[_0x64df('0x1d')]=![];_0x3b6c33[_0x64df('0x1e')]=_0x64df('0x1f');}}else{_0x3b6c33['user']=_0x1a4c01[_0x64df('0x19')];_0x3b6c33[_0x64df('0x1a')]=_0x1a4c01['password'];_0x3b6c33[_0x64df('0x1b')]=utils[_0x64df('0x20')](_0x1a4c01[_0x64df('0x17')]);_0x3b6c33['port']=0x3e1;_0x3b6c33[_0x64df('0x1d')]=!![];}_0x3b6c33[_0x64df('0x9')]=_0x38181a||_0x1a4c01[_0x64df('0x19')]||_0x64df('0x21');return _0x3b6c33;};EmailImap[_0x64df('0x14')][_0x64df('0xe')]=function(){this[_0x64df('0x1')][_0x64df('0x22')](this[_0x64df('0xa')],![],this[_0x64df('0x23')][_0x64df('0x10')](this));};EmailImap[_0x64df('0x14')]['handleOpenBox']=function(_0xc028ac,_0x7ad2dd){if(_0xc028ac){this['handleError'](_0xc028ac,!![]);}else{this['emit'](_0x64df('0x24'),_0x7ad2dd);this[_0x64df('0x25')]();}};EmailImap[_0x64df('0x14')][_0x64df('0x26')]=function(_0x753e11){if(_0x753e11){this[_0x64df('0x12')](_0x753e11,!![]);}else{this[_0x64df('0x1')][_0x64df('0xf')]();}};EmailImap[_0x64df('0x14')][_0x64df('0x25')]=function(){this[_0x64df('0x1')][_0x64df('0x27')]([_0x64df('0x28')],this[_0x64df('0x29')][_0x64df('0x10')](this));};EmailImap[_0x64df('0x14')][_0x64df('0x29')]=function(_0x41aa3e,_0x4124e6){if(_0x41aa3e){this[_0x64df('0x12')](_0x41aa3e,!![]);}else{if(_0x4124e6[_0x64df('0x2a')]){try{var _0x2fe1d3=this[_0x64df('0x1')][_0x64df('0x2b')](_0x4124e6,{'bodies':'','markSeen':!![]});_0x2fe1d3['on']('message',this[_0x64df('0x2c')][_0x64df('0x10')](this));_0x2fe1d3['once'](_0x64df('0x11'),this['handleFetchError'][_0x64df('0x10')](this));_0x2fe1d3[_0x64df('0xc')](_0x64df('0xf'),this[_0x64df('0x2d')]['bind'](this));}catch(_0x1fe240){logger[_0x64df('0x11')](_0x1fe240);}}else{this[_0x64df('0x1')][_0x64df('0x2e')](!![],this[_0x64df('0x26')][_0x64df('0x10')](this));}}};EmailImap['prototype'][_0x64df('0x2c')]=function(_0x630a14,_0x5eb2e8){_0x630a14['on']('body',this[_0x64df('0x2f')]['bind'](this));_0x630a14['once'](_0x64df('0x30'),this['handleMessageAttributes'][_0x64df('0x10')](this));_0x630a14[_0x64df('0xc')]('end',this['handleMessageEnd'][_0x64df('0x10')](this));};EmailImap[_0x64df('0x14')]['handleMessageBody']=function(_0x58991f,_0x3fbcda){simpleParser(_0x58991f,{'Iconv':Iconv},this[_0x64df('0x31')][_0x64df('0x10')](this));};EmailImap[_0x64df('0x14')][_0x64df('0x32')]=function(_0x4d742a){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x64df('0x14')][_0x64df('0x31')]=function(_0x17ee4f,_0x3c549b){if(_0x17ee4f){logger['error'](_0x17ee4f);}else{var _0x507e53=this;utils[_0x64df('0x33')](this[_0x64df('0x34')],_0x3c549b,function(_0x4bc027){_0x507e53[_0x64df('0x35')]('email',_0x4bc027);});}};EmailImap[_0x64df('0x14')]['handleFetchEnd']=function(){this['imap'][_0x64df('0x2e')](!![],this[_0x64df('0x26')][_0x64df('0x10')](this));};EmailImap['prototype']['handleFetchError']=function(_0x4fdf60){this[_0x64df('0x12')](_0x4fdf60);this[_0x64df('0x1')][_0x64df('0x2e')](!![],this['handleCloseBox']['bind'](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x64df('0x35')](_0x64df('0xf'));};EmailImap[_0x64df('0x14')][_0x64df('0x12')]=function(_0x1f1805,_0x263d30){logger['error'](_0x64df('0x12'),this[_0x64df('0x34')][_0x64df('0x9')],JSON[_0x64df('0x36')](_0x1f1805));var _0x267b42='';if(_0x1f1805){if(_0x1f1805[_0x64df('0x37')]){_0x267b42=_0x1f1805[_0x64df('0x37')];}else{for(var _0x356901 in _0x1f1805){if(_0x1f1805[_0x64df('0x38')](_0x356901)){_0x267b42+=_['upperFirst'](_0x356901)+':\x20'+_0x1f1805[_0x356901]+'\x0a';}}}}if(_0x263d30){this[_0x64df('0x1')][_0x64df('0xf')]();}else{this['emit'](_0x64df('0x11'),_0x267b42);this[_0x64df('0x35')](_0x64df('0xf'));}};module[_0x64df('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index e5ca875..7222d23 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 _0x0941=['createTransport','compile','sendMail','toString','verify','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send'];(function(_0x105192,_0x54c414){var _0x57ff40=function(_0x55c732){while(--_0x55c732){_0x105192['push'](_0x105192['shift']());}};_0x57ff40(++_0x54c414);}(_0x0941,0x114));var _0x1094=function(_0x4ea31a,_0x2b6c18){_0x4ea31a=_0x4ea31a-0x0;var _0x107de9=_0x0941[_0x4ea31a];return _0x107de9;};'use strict';var nodemailer=require(_0x1094('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x1094('0x1'));function EmailSmtp(){}EmailSmtp[_0x1094('0x2')][_0x1094('0x3')]=function(_0x703f87,_0x34817b){return new BPromise(function(_0xffde4,_0x502371){var _0x165758=nodemailer[_0x1094('0x4')](_0x703f87);_0x165758['use'](_0x1094('0x5'),inlineBase64());_0x165758[_0x1094('0x6')](_0x34817b,function(_0x536159,_0x23367d){if(_0x536159){_0x502371(_0x536159[_0x1094('0x7')]());}else{_0xffde4(_0x23367d);}});});};EmailSmtp[_0x1094('0x2')][_0x1094('0x8')]=function(_0x32bf55){return new BPromise(function(_0x1fc688,_0x2fc083){var _0x5d2348=nodemailer[_0x1094('0x4')](_0x32bf55);_0x5d2348[_0x1094('0x8')](function(_0x4f4594,_0x5576df){if(_0x4f4594){_0x2fc083(_0x4f4594[_0x1094('0x7')]());}else{if(_0x5576df){_0x1fc688(_0x5576df);}else{_0x2fc083('Not\x20verifired');}}});});};module[_0x1094('0x9')]=EmailSmtp; \ No newline at end of file +var _0x786c=['nodemailer-plugin-inline-base64','prototype','send','createTransport','use','sendMail','verify','toString','Not\x20verifired','exports','nodemailer','bluebird'];(function(_0x4f4ddf,_0x509cf8){var _0x2b04ec=function(_0x3dba6a){while(--_0x3dba6a){_0x4f4ddf['push'](_0x4f4ddf['shift']());}};_0x2b04ec(++_0x509cf8);}(_0x786c,0x172));var _0xc786=function(_0x576fcc,_0x7b6966){_0x576fcc=_0x576fcc-0x0;var _0xeaa287=_0x786c[_0x576fcc];return _0xeaa287;};'use strict';var nodemailer=require(_0xc786('0x0'));var BPromise=require(_0xc786('0x1'));var inlineBase64=require(_0xc786('0x2'));function EmailSmtp(){}EmailSmtp[_0xc786('0x3')][_0xc786('0x4')]=function(_0x45efd5,_0x253975){return new BPromise(function(_0x35e546,_0x3a5e2d){var _0x3538e5=nodemailer[_0xc786('0x5')](_0x45efd5);_0x3538e5[_0xc786('0x6')]('compile',inlineBase64());_0x3538e5[_0xc786('0x7')](_0x253975,function(_0x1ddbe2,_0x48f8d2){if(_0x1ddbe2){_0x3a5e2d(_0x1ddbe2['toString']());}else{_0x35e546(_0x48f8d2);}});});};EmailSmtp[_0xc786('0x3')][_0xc786('0x8')]=function(_0x6a4ab4){return new BPromise(function(_0x1174a8,_0x1a25cd){var _0x550216=nodemailer[_0xc786('0x5')](_0x6a4ab4);_0x550216['verify'](function(_0x387882,_0x21489c){if(_0x387882){_0x1a25cd(_0x387882[_0xc786('0x9')]());}else{if(_0x21489c){_0x1174a8(_0x21489c);}else{_0x1a25cd(_0xc786('0xa'));}}});});};module[_0xc786('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 61db9c4..ca137ce 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 _0x4329=['head','value','address','anonymous','@xcally.com','name','substring','split','length','slice','Anonymous','isEmpty','generate','html','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment'];(function(_0x1b9d83,_0x27518f){var _0xf8008d=function(_0x49815c){while(--_0x49815c){_0x1b9d83['push'](_0x1b9d83['shift']());}};_0xf8008d(++_0x27518f);}(_0x4329,0x13b));var _0x9432=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x4329[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x9432('0x0'));var moment=require(_0x9432('0x1'));var random=require(_0x9432('0x2'));var fs=require('fs');var path=require(_0x9432('0x3'));var util=require(_0x9432('0x4'));var tnef=require(_0x9432('0x5'));var logger=require(_0x9432('0x6'))(_0x9432('0x7'));var config=require(_0x9432('0x8'));function getAddress(_0x5796ef){var _0x13add2=_[_0x9432('0x9')](_0x5796ef[_0x9432('0xa')]);return _0x13add2&&_0x13add2[_0x9432('0xb')]?_0x13add2['address']:_0x9432('0xc')+random['generate'](0x6)+_0x9432('0xd');}function getFirstName(_0x4563c4){var _0x4eba63=_[_0x9432('0x9')](_0x4563c4[_0x9432('0xa')]);if(_0x4eba63&&_0x4eba63[_0x9432('0xe')]){if(_0x4eba63[_0x9432('0xe')]==_0x4eba63[_0x9432('0xb')]){return _0x4eba63['name'][_0x9432('0xf')](0x0,_0x4eba63[_0x9432('0xe')]['indexOf']('@'));}var _0x502e36=_0x4eba63[_0x9432('0xe')][_0x9432('0x10')](/\s+/);return _0x502e36[_0x9432('0x11')]>0x1?_0x502e36[_0x9432('0x12')](0x0,-0x1)['join']('\x20'):_0x4eba63[_0x9432('0xe')];}return _0x9432('0x13');}function getLastName(_0x3e3f0f){var _0x2210d2=_[_0x9432('0x9')](_0x3e3f0f['value']);if(_0x2210d2&&_0x2210d2[_0x9432('0xe')]){var _0x27781c=_0x2210d2['name'][_0x9432('0x10')](/\s+/);return _0x27781c[_0x9432('0x11')]>0x1?_0x27781c['pop']():'';}return'';}function getMails(_0x2b8d4b,_0x23ca2d){var _0x5334fe='';for(var _0x5c4360=0x0;_0x5c4360<_0x23ca2d['value']['length'];_0x5c4360+=0x1){if(_0x23ca2d['value'][_0x5c4360][_0x9432('0xb')]!==_0x2b8d4b){if(!_[_0x9432('0x14')](_0x5334fe)){_0x5334fe+=',';}_0x5334fe+=_0x23ca2d[_0x9432('0xa')][_0x5c4360]['name']||_0x23ca2d[_0x9432('0xa')][_0x5c4360]['address']||'';_0x5334fe+='\x20<';_0x5334fe+=_0x23ca2d[_0x9432('0xa')][_0x5c4360][_0x9432('0xb')]?_0x23ca2d[_0x9432('0xa')][_0x5c4360]['address']:_0x9432('0xc')+random[_0x9432('0x15')](0x6)+_0x9432('0xd');_0x5334fe+='>';}}return _0x5334fe;}function parseEmail(_0x321e28,_0xf62a59,_0x240c23){if(_0xf62a59[_0x9432('0x16')]){var _0x57721f=/)<[^<]*)*<\/script>/gi;while(_0x57721f['test'](_0xf62a59['html'])){_0xf62a59[_0x9432('0x16')]=_0xf62a59[_0x9432('0x16')][_0x9432('0x17')](_0x57721f,'');}if(_0xf62a59[_0x9432('0x16')]['includes'](_0x9432('0x18'))){var _0x499f4b=[];_0xf62a59[_0x9432('0x19')][_0x9432('0x1a')](_0x2de890=>{_0x499f4b[_0x9432('0x1b')](_0x2de890[_0x9432('0x1c')]);});var _0x21aab4=/]+>/g;var _0x121cb9=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x205ce9=_0xf62a59[_0x9432('0x16')][_0x9432('0x17')](_0x121cb9,'_SRC');var _0x5ae1aa=_0x205ce9[_0x9432('0x17')](_0x21aab4,'_IMG');for(let _0x58c056=0x0;_0x58c056<_0x499f4b[_0x9432('0x11')];_0x58c056++){var _0x584840=_0x5ae1aa['replace'](_0x9432('0x1d'),_0x9432('0x1e')+_0x499f4b[_0x58c056]+_0x9432('0x1f'));_0x5ae1aa=_0x584840;}_0xf62a59[_0x9432('0x16')]=_0x5ae1aa;}_0x240c23['body']=_0xf62a59['html'];}else{_0x240c23[_0x9432('0x20')]=_0xf62a59[_0x9432('0x21')];}if(_0x240c23[_0x9432('0x20')]){_0x240c23[_0x9432('0x20')]=_0x240c23[_0x9432('0x20')][_0x9432('0x17')](/0x0){var _0x471d65=[_0x9432('0x31'),_0x9432('0x32'),_0x9432('0x33')];for(var _0x4ecfc1=0x0;_0x4ecfc1<_0xf62a59[_0x9432('0x34')][_0x9432('0x11')];_0x4ecfc1++){var _0x575d46=_[_0x9432('0x35')](_0x471d65,_0xf62a59[_0x9432('0x34')][_0x4ecfc1][_0x9432('0x36')]);if(_0x575d46>=0x0){_0x240c23[_0x9432('0x37')]=!![];}}}return _0x240c23;}exports[_0x9432('0x38')]=function(_0x284786,_0xc59ab,_0x2d44ca){var _0x234258={'from':getAddress(_0xc59ab['from']),'firstName':getFirstName(_0xc59ab[_0x9432('0x39')]),'lastName':getLastName(_0xc59ab[_0x9432('0x39')]),'mapKey':_0x9432('0x7'),'message':{'from':getMails(_0x284786[_0x9432('0x7')],_0xc59ab['from']),'to':_0x284786['email'],'cc':'','subject':_0xc59ab[_0x9432('0x3a')]||'','messageId':_0xc59ab[_0x9432('0x3b')],'inReplyTo':_0xc59ab[_0x9432('0x3c')],'sentAt':moment(_0xc59ab[_0x9432('0x3d')])['format'](_0x9432('0x3e')),'attach':![],'attachments':[]}};if(!_0xc59ab[_0x9432('0x16')]&&!_0xc59ab[_0x9432('0x21')]){var _0x280db8=_[_0x9432('0x3f')](_0xc59ab[_0x9432('0x19')],{'contentType':_0x9432('0x40')});if(_0x280db8['length']){logger[_0x9432('0x41')](util[_0x9432('0x2b')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0xc59ab['messageId']));tnef[_0x9432('0x42')](_[_0x9432('0x43')](_0x280db8)['content'],function(_0x8ab032,_0x5f0127){if(_0x5f0127){_0xc59ab[_0x9432('0x16')]=_0x5f0127[_0x9432('0x44')]||_0x9432('0x45');if(_0x5f0127['Attachments']){for(var _0x4cb50a=0x0;_0x4cb50a<_0x5f0127[_0x9432('0x46')]['length'];_0x4cb50a++){var _0x3974a5=_0x5f0127['Attachments'][_0x4cb50a];_0x234258['message']['attachments'][_0x9432('0x1b')]({'filename':_0x3974a5[_0x9432('0x47')],'content':Buffer['from'](_0x3974a5[_0x9432('0x48')])});}}}_0x2d44ca(parseEmail(_0x284786,_0xc59ab,_0x234258));});}else{_0xc59ab[_0x9432('0x16')]=_0x9432('0x45');_0x2d44ca(parseEmail(_0x284786,_0xc59ab,_0x234258));}}else{_0x2d44ca(parseEmail(_0x284786,_0xc59ab,_0x234258));}};exports[_0x9432('0x49')]=function(_0x1536b7){switch(_0x1536b7){case'gmail':return _0x9432('0x4a');case'yahoo':return _0x9432('0x4b');case _0x9432('0x4c'):return _0x9432('0x4d');case _0x9432('0x4e'):return _0x9432('0x4f');}return _0x9432('0x50');}; \ No newline at end of file +var _0xeae8=['parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','moment','randomstring','util','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','length','join','Anonymous','split','pop','isEmpty','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x9bf1c1['slice'](0x0,-0x1)[_0x8eae('0xe')]('\x20'):_0x48581b[_0x8eae('0xc')];}return _0x8eae('0xf');}function getLastName(_0x10f61e){var _0x14172c=_['head'](_0x10f61e[_0x8eae('0x7')]);if(_0x14172c&&_0x14172c[_0x8eae('0xc')]){var _0x384477=_0x14172c[_0x8eae('0xc')][_0x8eae('0x10')](/\s+/);return _0x384477[_0x8eae('0xd')]>0x1?_0x384477[_0x8eae('0x11')]():'';}return'';}function getMails(_0x367dfe,_0x2afcc1){var _0x5324e3='';for(var _0x5e214e=0x0;_0x5e214e<_0x2afcc1['value'][_0x8eae('0xd')];_0x5e214e+=0x1){if(_0x2afcc1['value'][_0x5e214e][_0x8eae('0x8')]!==_0x367dfe){if(!_[_0x8eae('0x12')](_0x5324e3)){_0x5324e3+=',';}_0x5324e3+=_0x2afcc1[_0x8eae('0x7')][_0x5e214e][_0x8eae('0xc')]||_0x2afcc1[_0x8eae('0x7')][_0x5e214e][_0x8eae('0x8')]||'';_0x5324e3+='\x20<';_0x5324e3+=_0x2afcc1[_0x8eae('0x7')][_0x5e214e][_0x8eae('0x8')]?_0x2afcc1[_0x8eae('0x7')][_0x5e214e][_0x8eae('0x8')]:'anonymous'+random['generate'](0x6)+_0x8eae('0xb');_0x5324e3+='>';}}return _0x5324e3;}function parseEmail(_0x8f6e73,_0x35c70b,_0x4d4d8f){if(_0x35c70b[_0x8eae('0x13')]){var _0x8e69cb=/)<[^<]*)*<\/script>/gi;while(_0x8e69cb['test'](_0x35c70b[_0x8eae('0x13')])){_0x35c70b[_0x8eae('0x13')]=_0x35c70b['html'][_0x8eae('0x14')](_0x8e69cb,'');}if(_0x35c70b[_0x8eae('0x13')][_0x8eae('0x15')](_0x8eae('0x16'))){var _0x3edfdb=[];_0x35c70b[_0x8eae('0x17')][_0x8eae('0x18')](_0x3efe66=>{_0x3edfdb[_0x8eae('0x19')](_0x3efe66[_0x8eae('0x1a')]);});var _0x386bec=/]+>/g;var _0x53733c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3143a9=_0x35c70b[_0x8eae('0x13')][_0x8eae('0x14')](_0x53733c,_0x8eae('0x1b'));var _0x149b83=_0x3143a9[_0x8eae('0x14')](_0x386bec,_0x8eae('0x1c'));for(let _0x4e7d7c=0x0;_0x4e7d7c<_0x3edfdb[_0x8eae('0xd')];_0x4e7d7c++){var _0x5222f8=_0x149b83[_0x8eae('0x14')](_0x8eae('0x1c'),_0x8eae('0x1d')+_0x3edfdb[_0x4e7d7c]+_0x8eae('0x1e'));_0x149b83=_0x5222f8;}_0x35c70b[_0x8eae('0x13')]=_0x149b83;}_0x4d4d8f['body']=_0x35c70b['html'];}else{_0x4d4d8f[_0x8eae('0x1f')]=_0x35c70b[_0x8eae('0x20')];}if(_0x4d4d8f[_0x8eae('0x1f')]){_0x4d4d8f[_0x8eae('0x1f')]=_0x4d4d8f['body'][_0x8eae('0x14')](/0x0){var _0x12778e=['Auto-Submitted:\x20auto-replied',_0x8eae('0x30'),_0x8eae('0x31')];for(var _0x121c20=0x0;_0x121c20<_0x35c70b[_0x8eae('0x2f')]['length'];_0x121c20++){var _0x41ea58=_[_0x8eae('0x32')](_0x12778e,_0x35c70b[_0x8eae('0x2f')][_0x121c20][_0x8eae('0x33')]);if(_0x41ea58>=0x0){_0x4d4d8f['isAutoreply']=!![];}}}return _0x4d4d8f;}exports[_0x8eae('0x34')]=function(_0x284dca,_0x1b5775,_0x17c045){var _0x5d6265={'from':getAddress(_0x1b5775[_0x8eae('0x35')]),'firstName':getFirstName(_0x1b5775['from']),'lastName':getLastName(_0x1b5775[_0x8eae('0x35')]),'mapKey':'email','message':{'from':getMails(_0x284dca[_0x8eae('0x24')],_0x1b5775[_0x8eae('0x35')]),'to':_0x284dca['email'],'cc':'','subject':_0x1b5775[_0x8eae('0x36')]||'','messageId':_0x1b5775[_0x8eae('0x37')],'inReplyTo':_0x1b5775[_0x8eae('0x38')],'sentAt':moment(_0x1b5775[_0x8eae('0x39')])[_0x8eae('0x29')](_0x8eae('0x3a')),'attach':![],'attachments':[]}};if(!_0x1b5775[_0x8eae('0x13')]&&!_0x1b5775[_0x8eae('0x20')]){var _0x24a3ff=_['filter'](_0x1b5775[_0x8eae('0x17')],{'contentType':'application/ms-tnef'});if(_0x24a3ff[_0x8eae('0xd')]){logger[_0x8eae('0x3b')](util[_0x8eae('0x29')](_0x8eae('0x3c'),_0x1b5775['messageId']));tnef[_0x8eae('0x3d')](_[_0x8eae('0x3e')](_0x24a3ff)[_0x8eae('0x2d')],function(_0x448004,_0xc3f899){if(_0xc3f899){_0x1b5775[_0x8eae('0x13')]=_0xc3f899[_0x8eae('0x3f')]||_0x8eae('0x40');if(_0xc3f899[_0x8eae('0x41')]){for(var _0x84a054=0x0;_0x84a054<_0xc3f899[_0x8eae('0x41')]['length'];_0x84a054++){var _0x2e06bb=_0xc3f899[_0x8eae('0x41')][_0x84a054];_0x5d6265['message'][_0x8eae('0x17')]['push']({'filename':_0x2e06bb[_0x8eae('0x42')],'content':Buffer['from'](_0x2e06bb[_0x8eae('0x43')])});}}}_0x17c045(parseEmail(_0x284dca,_0x1b5775,_0x5d6265));});}else{_0x1b5775['html']=_0x8eae('0x40');_0x17c045(parseEmail(_0x284dca,_0x1b5775,_0x5d6265));}}else{_0x17c045(parseEmail(_0x284dca,_0x1b5775,_0x5d6265));}};exports[_0x8eae('0x44')]=function(_0x470f54){switch(_0x470f54){case _0x8eae('0x45'):return _0x8eae('0x46');case _0x8eae('0x47'):return _0x8eae('0x48');case _0x8eae('0x49'):return _0x8eae('0x4a');case _0x8eae('0x4b'):return _0x8eae('0x4c');}return'127.0.0.1';}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 8bd9b22..377b068 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 _0xfb1f=['Smtp','exports','lodash','name','Service','SERV','active','Imap'];(function(_0x53f74c,_0xd71010){var _0x467bc0=function(_0x58ab34){while(--_0x58ab34){_0x53f74c['push'](_0x53f74c['shift']());}};_0x467bc0(++_0xd71010);}(_0xfb1f,0xea));var _0xffb1=function(_0x900ff9,_0x3fe04f){_0x900ff9=_0x900ff9-0x0;var _0x387d38=_0xfb1f[_0x900ff9];return _0x387d38;};'use strict';var _=require(_0xffb1('0x0'));function MailAccount(_0x56c2d9){this['id']=_0x56c2d9['id']||0x0;this[_0xffb1('0x1')]=_0x56c2d9['name']||_0xffb1('0x2');this['key']=_0x56c2d9['key']||_0xffb1('0x3');this[_0xffb1('0x4')]=_0x56c2d9['active']||![];this[_0xffb1('0x5')]=_0x56c2d9[_0xffb1('0x5')]||[];this[_0xffb1('0x6')]=_0x56c2d9[_0xffb1('0x6')]||[];}module[_0xffb1('0x7')]=MailAccount; \ No newline at end of file +var _0x9b83=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0x8b5f8d,_0x566ced){var _0x218f7f=function(_0x85fd0c){while(--_0x85fd0c){_0x8b5f8d['push'](_0x8b5f8d['shift']());}};_0x218f7f(++_0x566ced);}(_0x9b83,0x9b));var _0x39b8=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x9b83[_0xbeb808];return _0x5d6909;};'use strict';var _=require(_0x39b8('0x0'));function MailAccount(_0x8582e5){this['id']=_0x8582e5['id']||0x0;this['name']=_0x8582e5[_0x39b8('0x1')]||_0x39b8('0x2');this[_0x39b8('0x3')]=_0x8582e5[_0x39b8('0x3')]||_0x39b8('0x4');this['active']=_0x8582e5[_0x39b8('0x5')]||![];this[_0x39b8('0x6')]=_0x8582e5['Imap']||[];this[_0x39b8('0x7')]=_0x8582e5[_0x39b8('0x7')]||[];}module[_0x39b8('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 48b64a4..2031f13 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 _0xfb84=['initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','prototype','mergeFromDatabase'];(function(_0x709d5e,_0x33309a){var _0x4e6d3e=function(_0x49e593){while(--_0x49e593){_0x709d5e['push'](_0x709d5e['shift']());}};_0x4e6d3e(++_0x33309a);}(_0xfb84,0xd7));var _0x4fb8=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0xfb84[_0x1265ed];return _0x5ac459;};'use strict';var _=require(_0x4fb8('0x0'));var MailAccount=require(_0x4fb8('0x1'));var Realtime=function(){this[_0x4fb8('0x2')]={};};function freeIsNotKey(_0x27d5de,_0x4e43a8,_0x2d182e){var _0x5dd3d9=_['mapKeys'](_0x27d5de,function(_0x5ca30f,_0x1fb031){return _0x5ca30f[_0x2d182e];});for(var _0x12fa80 in _0x4e43a8){if(_0x4e43a8['hasOwnProperty'](_0x12fa80)){if(!_0x5dd3d9[_0x12fa80]){delete _0x4e43a8[_0x12fa80];}}}}Realtime[_0x4fb8('0x3')][_0x4fb8('0x4')]=function(_0x38a39d,_0x3bbae1){for(var _0x2ca05a in _0x3bbae1){if(_0x38a39d['hasOwnProperty'](_0x2ca05a)){_0x38a39d[_0x2ca05a]=_0x3bbae1[_0x2ca05a];}}};Realtime[_0x4fb8('0x3')][_0x4fb8('0x5')]=function(){var _0x5834ed=this;return function(_0x46562d){if(_0x46562d){freeIsNotKey(_0x46562d,_0x5834ed[_0x4fb8('0x2')],'id');for(var _0x52c264=0x0,_0x5aa784={},_0x3bc177={};_0x52c264<_0x46562d[_0x4fb8('0x6')];_0x52c264+=0x1){_0x5aa784=_0x46562d[_0x52c264];if(_[_0x4fb8('0x7')](_0x5834ed[_0x4fb8('0x2')][_0x5aa784['id']])){_0x5834ed[_0x4fb8('0x2')][_0x5aa784['id']]=new MailAccount(_0x5aa784);}else{_[_0x4fb8('0x8')](_0x5834ed['mailAccounts'][_0x5aa784['id']],_0x5aa784);}}}return _0x5834ed[_0x4fb8('0x2')];};};module[_0x4fb8('0x9')]=Realtime; \ No newline at end of file +var _0xd4f5=['../model/mailAccount','mailAccounts','hasOwnProperty','prototype','length','merge','lodash'];(function(_0x49f9a9,_0x24a323){var _0x515411=function(_0x4afe05){while(--_0x4afe05){_0x49f9a9['push'](_0x49f9a9['shift']());}};_0x515411(++_0x24a323);}(_0xd4f5,0xd8));var _0x5d4f=function(_0x4565eb,_0x167f79){_0x4565eb=_0x4565eb-0x0;var _0x67832=_0xd4f5[_0x4565eb];return _0x67832;};'use strict';var _=require(_0x5d4f('0x0'));var MailAccount=require(_0x5d4f('0x1'));var Realtime=function(){this[_0x5d4f('0x2')]={};};function freeIsNotKey(_0x59aace,_0x1fd253,_0x2d70d7){var _0x4786eb=_['mapKeys'](_0x59aace,function(_0x1d810b,_0x3343d0){return _0x1d810b[_0x2d70d7];});for(var _0x598cc4 in _0x1fd253){if(_0x1fd253[_0x5d4f('0x3')](_0x598cc4)){if(!_0x4786eb[_0x598cc4]){delete _0x1fd253[_0x598cc4];}}}}Realtime[_0x5d4f('0x4')]['mergeFromDatabase']=function(_0x126fd4,_0x21e261){for(var _0x526501 in _0x21e261){if(_0x126fd4[_0x5d4f('0x3')](_0x526501)){_0x126fd4[_0x526501]=_0x21e261[_0x526501];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x56bedd=this;return function(_0x1d427f){if(_0x1d427f){freeIsNotKey(_0x1d427f,_0x56bedd['mailAccounts'],'id');for(var _0x2bef07=0x0,_0x165524={},_0x1601c8={};_0x2bef07<_0x1d427f[_0x5d4f('0x5')];_0x2bef07+=0x1){_0x165524=_0x1d427f[_0x2bef07];if(_['isUndefined'](_0x56bedd[_0x5d4f('0x2')][_0x165524['id']])){_0x56bedd[_0x5d4f('0x2')][_0x165524['id']]=new MailAccount(_0x165524);}else{_[_0x5d4f('0x6')](_0x56bedd[_0x5d4f('0x2')][_0x165524['id']],_0x165524);}}}return _0x56bedd[_0x5d4f('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index a8c296e..1443a5c 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 _0x87bc=['Smtp','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','email','key','Imap','MailServerOut'];(function(_0x6aad74,_0x32ecf4){var _0x5b1c38=function(_0x567477){while(--_0x567477){_0x6aad74['push'](_0x6aad74['shift']());}};_0x5b1c38(++_0x32ecf4);}(_0x87bc,0x189));var _0xc87b=function(_0x13e9a7,_0xd5585c){_0x13e9a7=_0x13e9a7-0x0;var _0x39e8b3=_0x87bc[_0x13e9a7];return _0x39e8b3;};'use strict';var client=require(_0xc87b('0x0'));exports[_0xc87b('0x1')]=function(){return function(){return client['Request'](_0xc87b('0x2'),{'options':{'attributes':['id','name','service',_0xc87b('0x3'),'active',_0xc87b('0x4'),'ListId','TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0xc87b('0x5')},{'model':_0xc87b('0x6'),'as':_0xc87b('0x7')}]},'log':'getMailAccount'});};};exports['notify']=function(_0x4ed0c5,_0x1999f8){return client[_0xc87b('0x8')](_0xc87b('0x9'),{'account':{'id':_0x4ed0c5},'body':_0x1999f8,'log':_0xc87b('0x9')});}; \ No newline at end of file +var _0x2ace=['MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','service','email','key','ListId','TemplateId'];(function(_0x4405dc,_0x2ce0f5){var _0x9e5ab5=function(_0x4edc4f){while(--_0x4edc4f){_0x4405dc['push'](_0x4405dc['shift']());}};_0x9e5ab5(++_0x2ce0f5);}(_0x2ace,0x17e));var _0xe2ac=function(_0x210b46,_0x52a05f){_0x210b46=_0x210b46-0x0;var _0x203df2=_0x2ace[_0x210b46];return _0x203df2;};'use strict';var client=require('../client');exports[_0xe2ac('0x0')]=function(){return function(){return client[_0xe2ac('0x1')](_0xe2ac('0x2'),{'options':{'attributes':['id','name',_0xe2ac('0x3'),_0xe2ac('0x4'),'active',_0xe2ac('0x5'),_0xe2ac('0x6'),_0xe2ac('0x7')],'raw':![],'include':[{'model':_0xe2ac('0x8'),'as':_0xe2ac('0x9')},{'model':_0xe2ac('0xa'),'as':_0xe2ac('0xb')}]},'log':_0xe2ac('0xc')});};};exports[_0xe2ac('0xd')]=function(_0x28d0d1,_0x4064f9){return client[_0xe2ac('0x1')](_0xe2ac('0xe'),{'account':{'id':_0x28d0d1},'body':_0x4064f9,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 6d2efde..b55ca91 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 _0x7f29=['Request','loginMailFrequency'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7f29,0x1da));var _0x97f2=function(_0x5f55ed,_0x206d9a){_0x5f55ed=_0x5f55ed-0x0;var _0x586c4f=_0x7f29[_0x5f55ed];return _0x586c4f;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x97f2('0x0')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x97f2('0x1')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x2831=['ShowSetting','loginMailFrequency'];(function(_0x126fe8,_0xa37fc5){var _0x56f9bf=function(_0x3738dd){while(--_0x3738dd){_0x126fe8['push'](_0x126fe8['shift']());}};_0x56f9bf(++_0xa37fc5);}(_0x2831,0x1f2));var _0x1283=function(_0x6a3e29,_0x281702){_0x6a3e29=_0x6a3e29-0x0;var _0x4e2dba=_0x2831[_0x6a3e29];return _0x4e2dba;};'use strict';var client=require('../client');exports['getSettings']=function(){return client['Request'](_0x1283('0x0'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1283('0x1')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 5460c93..4f483e9 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 a51a6cb..f8ea3e9 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 _0x03f9=['createServer','timeout','socket.io','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','http','express','sticky-session','ioredis'];(function(_0x10ef69,_0x440695){var _0x26c2b7=function(_0x2e8b58){while(--_0x2e8b58){_0x10ef69['push'](_0x10ef69['shift']());}};_0x26c2b7(++_0x440695);}(_0x03f9,0x19e));var _0x903f=function(_0xb7202,_0x4aa500){_0xb7202=_0xb7202-0x0;var _0x6488bb=_0x03f9[_0xb7202];return _0x6488bb;};'use strict';var _=require('lodash');var http=require(_0x903f('0x0'));var express=require(_0x903f('0x1'));var sticky=require(_0x903f('0x2'));var Redis=require(_0x903f('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0x903f('0x4')](app);server[_0x903f('0x5')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0x903f('0x6'))(server,{'transports':['websocket',_0x903f('0x7')]});config[_0x903f('0x8')]=_['defaults'](config[_0x903f('0x8')],{'host':_0x903f('0x9'),'port':0x18eb});socketio[_0x903f('0xa')](require(_0x903f('0xb'))({'pubClient':new Redis(config[_0x903f('0x8')]),'subClient':new Redis(config[_0x903f('0x8')])}));require(_0x903f('0xc'))[_0x903f('0xd')]();require(_0x903f('0xe'))[_0x903f('0xd')](socketio);require(_0x903f('0xf'))['default'](app);require('../../routes')[_0x903f('0xd')](app);}else{server[_0x903f('0x10')](_0x903f('0x11'),function(){console[_0x903f('0x12')](_0x903f('0x13'),config[_0x903f('0x14')]);});}exports=module[_0x903f('0x15')]=app; \ No newline at end of file +var _0x28dd=['localhost','adapter','../../config/triggers','default','../../config/express','../../routes','once','listening','log','exports','lodash','http','express','sticky-session','createServer','timeout','listen','port','websocket','polling','defaults','redis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x28dd,0x112));var _0xd28d=function(_0x44b362,_0x1b5fd9){_0x44b362=_0x44b362-0x0;var _0x38b45c=_0x28dd[_0x44b362];return _0x38b45c;};'use strict';var _=require(_0xd28d('0x0'));var http=require(_0xd28d('0x1'));var express=require(_0xd28d('0x2'));var sticky=require(_0xd28d('0x3'));var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0xd28d('0x4')](app);server[_0xd28d('0x5')]=0xdbba0;if(sticky[_0xd28d('0x6')](server,config[_0xd28d('0x7')])){var socketio=require('socket.io')(server,{'transports':[_0xd28d('0x8'),_0xd28d('0x9')]});config['redis']=_[_0xd28d('0xa')](config[_0xd28d('0xb')],{'host':_0xd28d('0xc'),'port':0x18eb});socketio[_0xd28d('0xd')](require('socket.io-redis')({'pubClient':new Redis(config[_0xd28d('0xb')]),'subClient':new Redis(config['redis'])}));require(_0xd28d('0xe'))['default']();require('../../config/socketio')[_0xd28d('0xf')](socketio);require(_0xd28d('0x10'))[_0xd28d('0xf')](app);require(_0xd28d('0x11'))['default'](app);}else{server[_0xd28d('0x12')](_0xd28d('0x13'),function(){console[_0xd28d('0x14')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module[_0xd28d('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 75971ba..ffce355 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 _0x04ca=['debug','rpc','error','message','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','request','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x04ca,0xca));var _0xa04c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x04ca[_0x2641f9];return _0x585741;};'use strict';var jayson=require(_0xa04c('0x0'));var BPromise=require(_0xa04c('0x1'));var logger=require(_0xa04c('0x2'))(_0xa04c('0x3'));var client=jayson[_0xa04c('0x4')][_0xa04c('0x5')]({'port':0x2329});client['Request']=function(_0x45294d,_0x2f13d7){return new BPromise(function(_0x241f97,_0x59817c){return client[_0xa04c('0x6')](_0x45294d,_0x2f13d7)[_0xa04c('0x7')](function(_0x27b193){logger[_0xa04c('0x8')](_0xa04c('0x9'),_0xa04c('0x3'),_0x45294d,_0x2f13d7,_0x27b193);if(_0x27b193['error']){logger[_0xa04c('0xa')](_0xa04c('0x9'),_0xa04c('0x3'),_0x45294d,_0x27b193[_0xa04c('0xa')][_0xa04c('0xb')],_0x2f13d7);return _0x59817c(_0x27b193[_0xa04c('0xa')][_0xa04c('0xb')]);}else{return _0x241f97(_0x27b193['result']);}})[_0xa04c('0xc')](function(_0x4f0143){logger[_0xa04c('0xa')]('rpc',_0xa04c('0x3'),_0x45294d,_0x4f0143,_0x2f13d7);return _0x59817c(_0x4f0143);});});};module[_0xa04c('0xd')]=client; \ No newline at end of file +var _0xf456=['then','rpc','error','routing','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request'];(function(_0x179d19,_0x3f63fc){var _0x1ca47f=function(_0x42ef71){while(--_0x42ef71){_0x179d19['push'](_0x179d19['shift']());}};_0x1ca47f(++_0x3f63fc);}(_0xf456,0xe8));var _0x6f45=function(_0x3002b2,_0x5aef3b){_0x3002b2=_0x3002b2-0x0;var _0x1a61ef=_0xf456[_0x3002b2];return _0x1a61ef;};'use strict';var jayson=require(_0x6f45('0x0'));var BPromise=require(_0x6f45('0x1'));var logger=require(_0x6f45('0x2'))('routing');var client=jayson[_0x6f45('0x3')][_0x6f45('0x4')]({'port':0x2329});client[_0x6f45('0x5')]=function(_0x46360e,_0x472025){return new BPromise(function(_0x2841bd,_0x4ba946){return client['request'](_0x46360e,_0x472025)[_0x6f45('0x6')](function(_0x52fb1e){logger['debug'](_0x6f45('0x7'),'routing',_0x46360e,_0x472025,_0x52fb1e);if(_0x52fb1e[_0x6f45('0x8')]){logger[_0x6f45('0x8')](_0x6f45('0x7'),_0x6f45('0x9'),_0x46360e,_0x52fb1e['error'][_0x6f45('0xa')],_0x472025);return _0x4ba946(_0x52fb1e[_0x6f45('0x8')][_0x6f45('0xa')]);}else{return _0x2841bd(_0x52fb1e[_0x6f45('0xb')]);}})[_0x6f45('0xc')](function(_0x3831d4){logger[_0x6f45('0x8')]('rpc','routing',_0x46360e,_0x3831d4,_0x472025);return _0x4ba946(_0x3831d4);});});};module[_0x6f45('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index bdcb38f..9df0cc8 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 _0x65c9=['./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','then','getAgents','initAgents','getIntervals','initOpenchannelQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','initWhatsappQueues','log','bluebird'];(function(_0x37df6c,_0x2a9666){var _0x41f7aa=function(_0x2c9605){while(--_0x2c9605){_0x37df6c['push'](_0x37df6c['shift']());}};_0x41f7aa(++_0x2a9666);}(_0x65c9,0x18f));var _0x965c=function(_0x4f3207,_0x1aaa6f){_0x4f3207=_0x4f3207-0x0;var _0x3f6e1a=_0x65c9[_0x4f3207];return _0x3f6e1a;};'use strict';var BPromise=require(_0x965c('0x0'));var server=require('./server');var Realtime=require(_0x965c('0x1'));var user=require(_0x965c('0x2'));var interval=require(_0x965c('0x3'));var openchannelQueue=require(_0x965c('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x965c('0x5'));var mailQueue=require(_0x965c('0x6'));var faxQueue=require(_0x965c('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x965c('0x8')](user[_0x965c('0x9')]())[_0x965c('0x8')](realtime[_0x965c('0xa')]())['then'](interval[_0x965c('0xb')]())[_0x965c('0x8')](realtime['initIntervals']())[_0x965c('0x8')](openchannelQueue['getOpenchannelQueues']())[_0x965c('0x8')](realtime[_0x965c('0xc')]())['then'](chatQueue['getChatQueues']())[_0x965c('0x8')](realtime[_0x965c('0xd')]())['then'](smsQueue['getSmsQueues']())[_0x965c('0x8')](realtime[_0x965c('0xe')]())[_0x965c('0x8')](mailQueue[_0x965c('0xf')]())[_0x965c('0x8')](realtime[_0x965c('0x10')]())[_0x965c('0x8')](faxQueue['getFaxQueues']())['then'](realtime[_0x965c('0x11')]())[_0x965c('0x8')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0x965c('0x12')]())[_0x965c('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x965c('0x8')](function(_0x859100){return initRealtime();})[_0x965c('0x8')](function(_0x23bc6a){return setInterval(initRealtime,0x1388);})['catch'](function(_0x42a095){console[_0x965c('0x13')](_0x42a095);});}main(); \ No newline at end of file +var _0xa46f=['listen','bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues'];(function(_0x36ebc6,_0xaef3c3){var _0x84b9e0=function(_0x1e23c5){while(--_0x1e23c5){_0x36ebc6['push'](_0x36ebc6['shift']());}};_0x84b9e0(++_0xaef3c3);}(_0xa46f,0x188));var _0xfa46=function(_0x385c76,_0xb97335){_0x385c76=_0x385c76-0x0;var _0x5c8367=_0xa46f[_0x385c76];return _0x5c8367;};'use strict';var BPromise=require(_0xfa46('0x0'));var server=require(_0xfa46('0x1'));var Realtime=require(_0xfa46('0x2'));var user=require('./rpc/user');var interval=require(_0xfa46('0x3'));var openchannelQueue=require(_0xfa46('0x4'));var chatQueue=require(_0xfa46('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xfa46('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xfa46('0x7')](user[_0xfa46('0x8')]())['then'](realtime[_0xfa46('0x9')]())[_0xfa46('0x7')](interval[_0xfa46('0xa')]())[_0xfa46('0x7')](realtime[_0xfa46('0xb')]())[_0xfa46('0x7')](openchannelQueue[_0xfa46('0xc')]())[_0xfa46('0x7')](realtime[_0xfa46('0xd')]())['then'](chatQueue[_0xfa46('0xe')]())[_0xfa46('0x7')](realtime[_0xfa46('0xf')]())[_0xfa46('0x7')](smsQueue[_0xfa46('0x10')]())[_0xfa46('0x7')](realtime['initSmsQueues']())[_0xfa46('0x7')](mailQueue[_0xfa46('0x11')]())[_0xfa46('0x7')](realtime[_0xfa46('0x12')]())[_0xfa46('0x7')](faxQueue['getFaxQueues']())[_0xfa46('0x7')](realtime[_0xfa46('0x13')]())['then'](whatsappQueue[_0xfa46('0x14')]())[_0xfa46('0x7')](realtime[_0xfa46('0x15')]())[_0xfa46('0x7')](function(){return realtime;});}function main(){return server[_0xfa46('0x16')](realtime)['then'](function(_0x4905fe){return initRealtime();})['then'](function(_0x20293f){return setInterval(initRealtime,0x1388);})['catch'](function(_0x48fd12){console['log'](_0x48fd12);});}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 aac0c1a..20e9928 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 _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x13ae65,_0x51002a){var _0x2d34cb=function(_0x51bf30){while(--_0x51bf30){_0x13ae65['push'](_0x13ae65['shift']());}};_0x2d34cb(++_0x51002a);}(_0xe14b,0x93));var _0xbe14=function(_0xb93665,_0x4f9de9){_0xb93665=_0xb93665-0x0;var _0x53e7fb=_0xe14b[_0xb93665];return _0x53e7fb;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x9dd8ae,_0x1f1c66){var _0x45f3ee=function(_0xafba74){while(--_0xafba74){_0x9dd8ae['push'](_0x9dd8ae['shift']());}};_0x45f3ee(++_0x1f1c66);}(_0x814b,0x1a2));var _0xb814=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x814b[_0x264b9b];return _0x4c7a0e;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};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 054aadc..b74304c 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 _0xf279=['error','message','result','catch','bluebird','jayson/promise','client','http','request'];(function(_0x52e563,_0x452980){var _0xfc3dd0=function(_0x173bbd){while(--_0x173bbd){_0x52e563['push'](_0x52e563['shift']());}};_0xfc3dd0(++_0x452980);}(_0xf279,0x12d));var _0x9f27=function(_0x3ff3c5,_0x388adc){_0x3ff3c5=_0x3ff3c5-0x0;var _0x4de770=_0xf279[_0x3ff3c5];return _0x4de770;};'use strict';var BPromise=require(_0x9f27('0x0'));var jayson=require(_0x9f27('0x1'));var client=jayson[_0x9f27('0x2')][_0x9f27('0x3')]({'port':0x232b});function request(_0x249e48,_0x36901e){return new BPromise(function(_0x24f5dd,_0x12a9a9){return client[_0x9f27('0x4')](_0x249e48,_0x36901e)['then'](function(_0x5f1f58){if(_0x5f1f58[_0x9f27('0x5')]){return _0x12a9a9(_0x5f1f58[_0x9f27('0x5')][_0x9f27('0x6')]);}else{return _0x24f5dd(_0x5f1f58[_0x9f27('0x7')]);}})[_0x9f27('0x8')](function(_0x37e651){return _0x12a9a9(_0x37e651);});});}exports['sendMailMessage']=function(_0xbe76b2,_0x57a79d){return request('SendMail',{'account':_0xbe76b2,'message':_0x57a79d});}; \ No newline at end of file +var _0x68e5=['sendMailMessage','SendMail','jayson/promise','client','request','then','error','message','result','catch'];(function(_0x26986a,_0x168f62){var _0x361f12=function(_0x1df5dc){while(--_0x1df5dc){_0x26986a['push'](_0x26986a['shift']());}};_0x361f12(++_0x168f62);}(_0x68e5,0x1a6));var _0x568e=function(_0x5e39fd,_0x582767){_0x5e39fd=_0x5e39fd-0x0;var _0x27ea19=_0x68e5[_0x5e39fd];return _0x27ea19;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x568e('0x0'));var client=jayson[_0x568e('0x1')]['http']({'port':0x232b});function request(_0x2c58da,_0x2dcf42){return new BPromise(function(_0x295cda,_0x2e29bc){return client[_0x568e('0x2')](_0x2c58da,_0x2dcf42)[_0x568e('0x3')](function(_0x4ebdf2){if(_0x4ebdf2[_0x568e('0x4')]){return _0x2e29bc(_0x4ebdf2[_0x568e('0x4')][_0x568e('0x5')]);}else{return _0x295cda(_0x4ebdf2[_0x568e('0x6')]);}})[_0x568e('0x7')](function(_0x3b1b4e){return _0x2e29bc(_0x3b1b4e);});});}exports[_0x568e('0x8')]=function(_0x3fbb19,_0x5dde1e){return request(_0x568e('0x9'),{'account':_0x3fbb19,'message':_0x5dde1e});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index ef2a382..abf83de 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 _0xdc65=['exports','lodash','moment','md5','ioredis','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','updateRealtime','mail','openchannel','sms','whatsapp','Status','StatusTime','toNumber','format','busy','busyQueue','stringify','emit','user:save'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xdc65,0x79));var _0x5dc6=function(_0x5c0cfe,_0x14dbcd){_0x5c0cfe=_0x5c0cfe-0x0;var _0x126e87=_0xdc65[_0x5c0cfe];return _0x126e87;};'use strict';var _=require(_0x5dc6('0x0'));var moment=require(_0x5dc6('0x1'));var md5=require(_0x5dc6('0x2'));var Redis=require(_0x5dc6('0x3'));var config=require('../../../config/environment');config[_0x5dc6('0x4')]=_['defaults'](config[_0x5dc6('0x4')],{'host':_0x5dc6('0x5'),'port':0x18eb});var io=require(_0x5dc6('0x6'))(new Redis(config[_0x5dc6('0x4')]));function Agent(_0x9e8fd7){this['id']=_0x9e8fd7['id']||0x0;this[_0x5dc6('0x7')]=_0x9e8fd7[_0x5dc6('0x7')]||'';this[_0x5dc6('0x8')]=_0x9e8fd7[_0x5dc6('0x8')]||!![];this['voicePause']=_0x9e8fd7[_0x5dc6('0x9')]||![];this[_0x5dc6('0xa')]=_0x9e8fd7[_0x5dc6('0xa')]||![];this[_0x5dc6('0xb')]=_0x9e8fd7['mailPause']||![];this[_0x5dc6('0xc')]=_0x9e8fd7['faxPause']||![];this['smsPause']=_0x9e8fd7[_0x5dc6('0xd')]||![];this[_0x5dc6('0xe')]=_0x9e8fd7['openchannelPause']||![];this[_0x5dc6('0xf')]='unknown';this[_0x5dc6('0x10')]=0x0;this[_0x5dc6('0x11')]=_0x9e8fd7['chatCapacity']||0x0;this[_0x5dc6('0x12')]=0x0;this[_0x5dc6('0x13')]=_0x5dc6('0x14');this[_0x5dc6('0x15')]=0x0;this[_0x5dc6('0x16')]=_0x9e8fd7['mailCapacity']||0x0;this[_0x5dc6('0x17')]=0x0;this[_0x5dc6('0x18')]=_0x5dc6('0x14');this[_0x5dc6('0x19')]=0x0;this[_0x5dc6('0x1a')]=_0x9e8fd7[_0x5dc6('0x1a')]||0x0;this[_0x5dc6('0x1b')]=0x0;this[_0x5dc6('0x1c')]=_0x5dc6('0x14');this[_0x5dc6('0x1d')]=0x0;this[_0x5dc6('0x1e')]=_0x9e8fd7[_0x5dc6('0x1e')]||0x0;this[_0x5dc6('0x1f')]=0x0;this[_0x5dc6('0x20')]=_0x5dc6('0x14');this[_0x5dc6('0x21')]=0x0;this['whatsappCapacity']=_0x9e8fd7[_0x5dc6('0x22')]||0x0;this[_0x5dc6('0x23')]=0x0;this[_0x5dc6('0x24')]=_0x5dc6('0x14');this[_0x5dc6('0x25')]=0x0;this[_0x5dc6('0x26')]=_0x9e8fd7[_0x5dc6('0x26')]||0x0;this[_0x5dc6('0x27')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0x5dc6('0x2')]='';this['updateRealtime']();}Agent[_0x5dc6('0x28')][_0x5dc6('0x29')]=function(_0x339e47){if(this[_0x339e47+_0x5dc6('0x2a')]>0x0){if(this[_0x339e47+'Capacity']>0x0&&this[_0x339e47+_0x5dc6('0x2a')]>=this[_0x339e47+_0x5dc6('0x2b')]){return _0x5dc6('0x2c');}else{return'working';}}else{return'idle';}};Agent[_0x5dc6('0x28')][_0x5dc6('0x2d')]=function(){var _0x304a2d=[_0x5dc6('0x2e'),'chat',_0x5dc6('0x2f'),'fax',_0x5dc6('0x30'),_0x5dc6('0x31')];for(var _0x13eae9=0x0;_0x13eae9<_0x304a2d['length'];_0x13eae9+=0x1){var _0x3e060e=this[_0x5dc6('0x29')](_0x304a2d[_0x13eae9]);if(this[_0x304a2d[_0x13eae9]+_0x5dc6('0x32')]!==_0x3e060e){this[_0x304a2d[_0x13eae9]+_0x5dc6('0x33')]=_[_0x5dc6('0x34')](moment()[_0x5dc6('0x35')]('x'));}this[_0x304a2d[_0x13eae9]+_0x5dc6('0x32')]=_0x3e060e;}var _0x221a8f={'id':this['id'],'name':this[_0x5dc6('0x7')],'online':this[_0x5dc6('0x8')],'voicePause':this[_0x5dc6('0x9')],'chatPause':this[_0x5dc6('0xa')],'mailPause':this[_0x5dc6('0xb')],'smsPause':this[_0x5dc6('0xd')],'faxPause':this[_0x5dc6('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x5dc6('0x10')],'chatCapacity':this[_0x5dc6('0x11')],'chatCurrentCapacity':this[_0x5dc6('0x12')],'mailStatus':this[_0x5dc6('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x5dc6('0x17')],'faxStatus':this[_0x5dc6('0x18')],'faxStatusTime':this[_0x5dc6('0x19')],'faxCapacity':this[_0x5dc6('0x1a')],'faxCurrentCapacity':this[_0x5dc6('0x1b')],'smsStatus':this[_0x5dc6('0x1c')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x5dc6('0x1e')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x5dc6('0x20')],'whatsappStatusTime':this[_0x5dc6('0x21')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x5dc6('0x23')],'openchannelStatus':this[_0x5dc6('0x24')],'openchannelStatusTime':this[_0x5dc6('0x25')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x5dc6('0x27')],'busy':this[_0x5dc6('0x36')],'busyQueue':this[_0x5dc6('0x37')]};var _0x2fe0a0=md5(JSON[_0x5dc6('0x38')](_0x221a8f));if(this[_0x5dc6('0x2')]!==_0x2fe0a0){this[_0x5dc6('0x2')]=_0x2fe0a0;io[_0x5dc6('0x39')](_0x5dc6('0x3a'),_0x221a8f);}};module[_0x5dc6('0x3b')]=Agent; \ No newline at end of file +var _0xc344=['faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','chat','openchannel','fax','sms','whatsapp','Status','StatusTime','toNumber','openchannelPause','faxCapacity','smsStatus','stringify','emit','user:save','exports','lodash','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime'];(function(_0x2f2453,_0x1e9f5f){var _0x3a097a=function(_0x1081e7){while(--_0x1081e7){_0x2f2453['push'](_0x2f2453['shift']());}};_0x3a097a(++_0x1e9f5f);}(_0xc344,0x117));var _0x4c34=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xc344[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0x4c34('0x0'));var moment=require(_0x4c34('0x1'));var md5=require(_0x4c34('0x2'));var Redis=require('ioredis');var config=require(_0x4c34('0x3'));config[_0x4c34('0x4')]=_[_0x4c34('0x5')](config[_0x4c34('0x4')],{'host':_0x4c34('0x6'),'port':0x18eb});var io=require(_0x4c34('0x7'))(new Redis(config[_0x4c34('0x4')]));function Agent(_0x6f1f31){this['id']=_0x6f1f31['id']||0x0;this[_0x4c34('0x8')]=_0x6f1f31[_0x4c34('0x8')]||'';this[_0x4c34('0x9')]=_0x6f1f31[_0x4c34('0x9')]||!![];this[_0x4c34('0xa')]=_0x6f1f31[_0x4c34('0xa')]||![];this[_0x4c34('0xb')]=_0x6f1f31[_0x4c34('0xb')]||![];this[_0x4c34('0xc')]=_0x6f1f31[_0x4c34('0xc')]||![];this[_0x4c34('0xd')]=_0x6f1f31['faxPause']||![];this[_0x4c34('0xe')]=_0x6f1f31[_0x4c34('0xe')]||![];this['openchannelPause']=_0x6f1f31['openchannelPause']||![];this[_0x4c34('0xf')]='unknown';this[_0x4c34('0x10')]=0x0;this[_0x4c34('0x11')]=_0x6f1f31['chatCapacity']||0x0;this[_0x4c34('0x12')]=0x0;this[_0x4c34('0x13')]=_0x4c34('0x14');this[_0x4c34('0x15')]=0x0;this[_0x4c34('0x16')]=_0x6f1f31[_0x4c34('0x16')]||0x0;this[_0x4c34('0x17')]=0x0;this[_0x4c34('0x18')]=_0x4c34('0x14');this[_0x4c34('0x19')]=0x0;this['faxCapacity']=_0x6f1f31['faxCapacity']||0x0;this[_0x4c34('0x1a')]=0x0;this['smsStatus']='unknown';this[_0x4c34('0x1b')]=0x0;this[_0x4c34('0x1c')]=_0x6f1f31[_0x4c34('0x1c')]||0x0;this[_0x4c34('0x1d')]=0x0;this[_0x4c34('0x1e')]='unknown';this[_0x4c34('0x1f')]=0x0;this[_0x4c34('0x20')]=_0x6f1f31[_0x4c34('0x20')]||0x0;this[_0x4c34('0x21')]=0x0;this[_0x4c34('0x22')]=_0x4c34('0x14');this[_0x4c34('0x23')]=0x0;this['openchannelCapacity']=_0x6f1f31['openchannelCapacity']||0x0;this[_0x4c34('0x24')]=0x0;this[_0x4c34('0x25')]=![];this[_0x4c34('0x26')]=undefined;this[_0x4c34('0x2')]='';this['updateRealtime']();}Agent[_0x4c34('0x27')][_0x4c34('0x28')]=function(_0x43bb14){if(this[_0x43bb14+_0x4c34('0x29')]>0x0){if(this[_0x43bb14+_0x4c34('0x2a')]>0x0&&this[_0x43bb14+_0x4c34('0x29')]>=this[_0x43bb14+'Capacity']){return _0x4c34('0x2b');}else{return _0x4c34('0x2c');}}else{return'idle';}};Agent[_0x4c34('0x27')]['updateRealtime']=function(){var _0x4a66b0=[_0x4c34('0x2d'),_0x4c34('0x2e'),_0x4c34('0x2f'),_0x4c34('0x30'),_0x4c34('0x31'),_0x4c34('0x32')];for(var _0x34d6de=0x0;_0x34d6de<_0x4a66b0['length'];_0x34d6de+=0x1){var _0x19f9cb=this[_0x4c34('0x28')](_0x4a66b0[_0x34d6de]);if(this[_0x4a66b0[_0x34d6de]+_0x4c34('0x33')]!==_0x19f9cb){this[_0x4a66b0[_0x34d6de]+_0x4c34('0x34')]=_[_0x4c34('0x35')](moment()['format']('x'));}this[_0x4a66b0[_0x34d6de]+_0x4c34('0x33')]=_0x19f9cb;}var _0x4ff9a1={'id':this['id'],'name':this[_0x4c34('0x8')],'online':this[_0x4c34('0x9')],'voicePause':this[_0x4c34('0xa')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x4c34('0xe')],'faxPause':this[_0x4c34('0xd')],'openchannelPause':this[_0x4c34('0x36')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x4c34('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x4c34('0x13')],'mailStatusTime':this[_0x4c34('0x15')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x4c34('0x17')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x4c34('0x19')],'faxCapacity':this[_0x4c34('0x37')],'faxCurrentCapacity':this[_0x4c34('0x1a')],'smsStatus':this[_0x4c34('0x38')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x4c34('0x1f')],'whatsappCapacity':this[_0x4c34('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x4c34('0x23')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x4c34('0x24')],'busy':this['busy'],'busyQueue':this[_0x4c34('0x26')]};var _0x1ddef2=md5(JSON[_0x4c34('0x39')](_0x4ff9a1));if(this[_0x4c34('0x2')]!==_0x1ddef2){this[_0x4c34('0x2')]=_0x1ddef2;io[_0x4c34('0x3a')](_0x4c34('0x3b'),_0x4ff9a1);}};module[_0x4c34('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 2c6dbca..369f0f9 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 _0xf440=['paused','length','online','loggedIn','chatPause','available','waiting','stringify','format','emit','chat_queue:save','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x4262bd,_0x1646b2){var _0x4ae7db=function(_0x3afd55){while(--_0x3afd55){_0x4262bd['push'](_0x4262bd['shift']());}};_0x4ae7db(++_0x1646b2);}(_0xf440,0x1a0));var _0x0f44=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf440[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x0f44('0x0'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0f44('0x1')]=_[_0x0f44('0x2')](config['redis'],{'host':_0x0f44('0x3'),'port':0x18eb});var io=require(_0x0f44('0x4'))(new Redis(config[_0x0f44('0x1')]));function ChatQueue(_0x5d08b3){this['id']=_0x5d08b3['id']||0x0;this[_0x0f44('0x5')]=_0x5d08b3[_0x0f44('0x5')]||'';this[_0x0f44('0x6')]=_0x5d08b3[_0x0f44('0x6')]||0xa;this['strategy']=_0x5d08b3[_0x0f44('0x7')]||'beepall';this['Agents']=_0x5d08b3[_0x0f44('0x8')];this[_0x0f44('0x9')]={};this['waiting']=0x0;this[_0x0f44('0xa')]='';this[_0x0f44('0xb')]();this[_0x0f44('0xc')]();}ChatQueue[_0x0f44('0xd')][_0x0f44('0xb')]=function(){var _0x52c44b=this[_0x0f44('0x9')][_0x0f44('0xe')];this[_0x0f44('0x9')]=_[_0x0f44('0xf')](this[_0x0f44('0x8')],'id');this['mapAgentsId'][_0x0f44('0xe')]=_0x52c44b;};ChatQueue['prototype'][_0x0f44('0xc')]=function(){this['loggedIn']=0x0;this[_0x0f44('0x10')]=0x0;for(var _0x44fed5=0x0;_0x44fed5=0x0?this[_0x0f44('0x15')]:0x0;var _0x2efb07={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x0f44('0x5')],'paused':this[_0x0f44('0x10')],'waiting':this[_0x0f44('0x16')]};var _0x871870=md5(JSON[_0x0f44('0x17')](_0x2efb07));if(this[_0x0f44('0xa')]!==_0x871870){this[_0x0f44('0xa')]=_0x871870;io['to'](util[_0x0f44('0x18')]('chat:queue:%s',_0x2efb07[_0x0f44('0x5')]))[_0x0f44('0x19')](_0x0f44('0x1a'),_0x2efb07);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x5a57=['emit','exports','lodash','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','online','chatPause','available','stringify','chat:queue:%s'];(function(_0x3d210e,_0x4ac492){var _0x3cc2a3=function(_0x5cbc71){while(--_0x5cbc71){_0x3d210e['push'](_0x3d210e['shift']());}};_0x3cc2a3(++_0x4ac492);}(_0x5a57,0xc6));var _0x75a5=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x5a57[_0x543084];return _0x306a57;};'use strict';var _=require(_0x75a5('0x0'));var md5=require(_0x75a5('0x1'));var util=require('util');var Redis=require(_0x75a5('0x2'));var config=require('../../../config/environment');config[_0x75a5('0x3')]=_[_0x75a5('0x4')](config[_0x75a5('0x3')],{'host':_0x75a5('0x5'),'port':0x18eb});var io=require(_0x75a5('0x6'))(new Redis(config[_0x75a5('0x3')]));function ChatQueue(_0x3cd668){this['id']=_0x3cd668['id']||0x0;this[_0x75a5('0x7')]=_0x3cd668['name']||'';this[_0x75a5('0x8')]=_0x3cd668['timeout']||0xa;this[_0x75a5('0x9')]=_0x3cd668[_0x75a5('0x9')]||_0x75a5('0xa');this[_0x75a5('0xb')]=_0x3cd668[_0x75a5('0xb')];this[_0x75a5('0xc')]={};this[_0x75a5('0xd')]=0x0;this[_0x75a5('0x1')]='';this['updateRouting']();this[_0x75a5('0xe')]();}ChatQueue[_0x75a5('0xf')][_0x75a5('0x10')]=function(){var _0x21fe49=this['mapAgentsId']['_rr'];this[_0x75a5('0xc')]=_['map'](this['Agents'],'id');this[_0x75a5('0xc')][_0x75a5('0x11')]=_0x21fe49;};ChatQueue[_0x75a5('0xf')]['updateRealtime']=function(){this[_0x75a5('0x12')]=0x0;this[_0x75a5('0x13')]=0x0;for(var _0x44e1c1=0x0;_0x44e1c1=0x0?this[_0x75a5('0x17')]:0x0;var _0x223ce1={'id':this['id'],'available':this[_0x75a5('0x17')],'loggedIn':this[_0x75a5('0x12')],'name':this[_0x75a5('0x7')],'paused':this[_0x75a5('0x13')],'waiting':this['waiting']};var _0x3cd207=md5(JSON[_0x75a5('0x18')](_0x223ce1));if(this[_0x75a5('0x1')]!==_0x3cd207){this['md5']=_0x3cd207;io['to'](util['format'](_0x75a5('0x19'),_0x223ce1[_0x75a5('0x7')]))[_0x75a5('0x1a')]('chat_queue:save',_0x223ce1);}};module[_0x75a5('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index c4d22c6..6ec24f3 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 _0x233f=['util','ioredis','redis','defaults','localhost','name','timeout','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','online','faxPause','available','stringify','format','emit','exports','lodash','md5'];(function(_0x13f663,_0x48d7f6){var _0x65843b=function(_0x10121d){while(--_0x10121d){_0x13f663['push'](_0x13f663['shift']());}};_0x65843b(++_0x48d7f6);}(_0x233f,0x184));var _0xf233=function(_0x4a94cc,_0x55355a){_0x4a94cc=_0x4a94cc-0x0;var _0x14032f=_0x233f[_0x4a94cc];return _0x14032f;};'use strict';var _=require(_0xf233('0x0'));var md5=require(_0xf233('0x1'));var util=require(_0xf233('0x2'));var Redis=require(_0xf233('0x3'));var config=require('../../../config/environment');config[_0xf233('0x4')]=_[_0xf233('0x5')](config[_0xf233('0x4')],{'host':_0xf233('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x3ede71){this['id']=_0x3ede71['id']||0x0;this['name']=_0x3ede71[_0xf233('0x7')]||'';this[_0xf233('0x8')]=_0x3ede71[_0xf233('0x8')]||0xa;this['strategy']=_0x3ede71['strategy']||'beepall';this[_0xf233('0x9')]=_0x3ede71[_0xf233('0x9')];this[_0xf233('0xa')]={};this[_0xf233('0xb')]=0x0;this[_0xf233('0x1')]='';this[_0xf233('0xc')]();this[_0xf233('0xd')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x1ab4ba=this['mapAgentsId']['_rr'];this[_0xf233('0xa')]=_[_0xf233('0xe')](this['Agents'],'id');this[_0xf233('0xa')][_0xf233('0xf')]=_0x1ab4ba;};FaxQueue[_0xf233('0x10')]['updateRealtime']=function(){this[_0xf233('0x11')]=0x0;this[_0xf233('0x12')]=0x0;for(var _0xd6dd1c=0x0;_0xd6dd1c=0x0?this[_0xf233('0x15')]:0x0;var _0x537a01={'id':this['id'],'available':this[_0xf233('0x15')],'loggedIn':this[_0xf233('0x11')],'name':this[_0xf233('0x7')],'paused':this[_0xf233('0x12')],'waiting':this[_0xf233('0xb')]};var _0x223bf8=md5(JSON[_0xf233('0x16')](_0x537a01));if(this['md5']!==_0x223bf8){this[_0xf233('0x1')]=_0x223bf8;io['to'](util[_0xf233('0x17')]('fax:queue:%s',_0x537a01['name']))[_0xf233('0x18')]('fax_queue:save',_0x537a01);}};module[_0xf233('0x19')]=FaxQueue; \ No newline at end of file +var _0xb7c7=['localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','length','online','loggedIn','faxPause','available','stringify','format','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x3796fb,_0x4932aa){var _0x3545d1=function(_0x217570){while(--_0x217570){_0x3796fb['push'](_0x3796fb['shift']());}};_0x3545d1(++_0x4932aa);}(_0xb7c7,0x161));var _0x7b7c=function(_0x54f3e8,_0x3ed493){_0x54f3e8=_0x54f3e8-0x0;var _0x267b37=_0xb7c7[_0x54f3e8];return _0x267b37;};'use strict';var _=require(_0x7b7c('0x0'));var md5=require(_0x7b7c('0x1'));var util=require(_0x7b7c('0x2'));var Redis=require(_0x7b7c('0x3'));var config=require(_0x7b7c('0x4'));config[_0x7b7c('0x5')]=_[_0x7b7c('0x6')](config[_0x7b7c('0x5')],{'host':_0x7b7c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x56309f){this['id']=_0x56309f['id']||0x0;this[_0x7b7c('0x8')]=_0x56309f['name']||'';this[_0x7b7c('0x9')]=_0x56309f[_0x7b7c('0x9')]||0xa;this['strategy']=_0x56309f[_0x7b7c('0xa')]||_0x7b7c('0xb');this['Agents']=_0x56309f[_0x7b7c('0xc')];this[_0x7b7c('0xd')]={};this[_0x7b7c('0xe')]=0x0;this[_0x7b7c('0x1')]='';this[_0x7b7c('0xf')]();this[_0x7b7c('0x10')]();}FaxQueue[_0x7b7c('0x11')][_0x7b7c('0xf')]=function(){var _0x4c1677=this['mapAgentsId'][_0x7b7c('0x12')];this[_0x7b7c('0xd')]=_['map'](this[_0x7b7c('0xc')],'id');this[_0x7b7c('0xd')][_0x7b7c('0x12')]=_0x4c1677;};FaxQueue[_0x7b7c('0x11')][_0x7b7c('0x10')]=function(){this['loggedIn']=0x0;this[_0x7b7c('0x13')]=0x0;for(var _0x1ccefc=0x0;_0x1ccefc=0x0?this[_0x7b7c('0x18')]:0x0;var _0x6f7668={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7b7c('0x16')],'name':this[_0x7b7c('0x8')],'paused':this[_0x7b7c('0x13')],'waiting':this[_0x7b7c('0xe')]};var _0x107c6c=md5(JSON[_0x7b7c('0x19')](_0x6f7668));if(this[_0x7b7c('0x1')]!==_0x107c6c){this[_0x7b7c('0x1')]=_0x107c6c;io['to'](util[_0x7b7c('0x1a')]('fax:queue:%s',_0x6f7668[_0x7b7c('0x8')]))[_0x7b7c('0x1b')](_0x7b7c('0x1c'),_0x6f7668);}};module[_0x7b7c('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 219fd7d..12f9ae2 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 _0xab1c=['exports','name','Intervals'];(function(_0x557205,_0x5272dc){var _0x56e628=function(_0x32c8f7){while(--_0x32c8f7){_0x557205['push'](_0x557205['shift']());}};_0x56e628(++_0x5272dc);}(_0xab1c,0x7c));var _0xcab1=function(_0x26b3bb,_0x2c7ff0){_0x26b3bb=_0x26b3bb-0x0;var _0x1c403a=_0xab1c[_0x26b3bb];return _0x1c403a;};'use strict';function Interval(_0x3b90e7){this['id']=_0x3b90e7['id']||0x0;this[_0xcab1('0x0')]=_0x3b90e7[_0xcab1('0x0')]||'';this[_0xcab1('0x1')]=_0x3b90e7['Intervals']||{};}module[_0xcab1('0x2')]=Interval; \ No newline at end of file +var _0x8964=['name','Intervals'];(function(_0x2f6e47,_0x40ba6b){var _0x29c331=function(_0x18d873){while(--_0x18d873){_0x2f6e47['push'](_0x2f6e47['shift']());}};_0x29c331(++_0x40ba6b);}(_0x8964,0xd6));var _0x4896=function(_0x25451a,_0x11c823){_0x25451a=_0x25451a-0x0;var _0x20a8aa=_0x8964[_0x25451a];return _0x20a8aa;};'use strict';function Interval(_0x3e793b){this['id']=_0x3e793b['id']||0x0;this[_0x4896('0x0')]=_0x3e793b[_0x4896('0x0')]||'';this['Intervals']=_0x3e793b[_0x4896('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index e5c86d9..4d195a6 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 _0x4857=['util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','loggedIn','paused','length','mailPause','available','waiting','mail:queue:%s','emit','mail_queue:save','lodash','md5'];(function(_0x26e13e,_0x5917f3){var _0x41684d=function(_0x3f6705){while(--_0x3f6705){_0x26e13e['push'](_0x26e13e['shift']());}};_0x41684d(++_0x5917f3);}(_0x4857,0x136));var _0x7485=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x4857[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require(_0x7485('0x0'));var md5=require(_0x7485('0x1'));var util=require(_0x7485('0x2'));var Redis=require(_0x7485('0x3'));var config=require(_0x7485('0x4'));config[_0x7485('0x5')]=_['defaults'](config[_0x7485('0x5')],{'host':_0x7485('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0xb04755){this['id']=_0xb04755['id']||0x0;this[_0x7485('0x7')]=_0xb04755[_0x7485('0x7')]||'';this[_0x7485('0x8')]=_0xb04755['timeout']||0xa;this[_0x7485('0x9')]=_0xb04755[_0x7485('0x9')]||_0x7485('0xa');this[_0x7485('0xb')]=_0xb04755['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x7485('0x1')]='';this['updateRouting']();this[_0x7485('0xc')]();}MailQueue[_0x7485('0xd')][_0x7485('0xe')]=function(){var _0x30edd4=this[_0x7485('0xf')][_0x7485('0x10')];this['mapAgentsId']=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x7485('0x10')]=_0x30edd4;};MailQueue[_0x7485('0xd')]['updateRealtime']=function(){this[_0x7485('0x11')]=0x0;this[_0x7485('0x12')]=0x0;for(var _0x223d9d=0x0;_0x223d9d=0x0?this['available']:0x0;var _0x2ff89e={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x7485('0x7')],'paused':this[_0x7485('0x12')],'waiting':this[_0x7485('0x16')]};var _0x9bc46a=md5(JSON['stringify'](_0x2ff89e));if(this[_0x7485('0x1')]!==_0x9bc46a){this[_0x7485('0x1')]=_0x9bc46a;io['to'](util['format'](_0x7485('0x17'),_0x2ff89e['name']))[_0x7485('0x18')](_0x7485('0x19'),_0x2ff89e);}};module['exports']=MailQueue; \ No newline at end of file +var _0x634c=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','mailPause','available','format','mail:queue:%s','emit','exports'];(function(_0x158ec0,_0x53c675){var _0x217431=function(_0x13aeb0){while(--_0x13aeb0){_0x158ec0['push'](_0x158ec0['shift']());}};_0x217431(++_0x53c675);}(_0x634c,0xd2));var _0xc634=function(_0x302faa,_0x4ccbbc){_0x302faa=_0x302faa-0x0;var _0x1061cd=_0x634c[_0x302faa];return _0x1061cd;};'use strict';var _=require(_0xc634('0x0'));var md5=require(_0xc634('0x1'));var util=require(_0xc634('0x2'));var Redis=require(_0xc634('0x3'));var config=require(_0xc634('0x4'));config[_0xc634('0x5')]=_[_0xc634('0x6')](config[_0xc634('0x5')],{'host':_0xc634('0x7'),'port':0x18eb});var io=require(_0xc634('0x8'))(new Redis(config[_0xc634('0x5')]));function MailQueue(_0x42c49f){this['id']=_0x42c49f['id']||0x0;this[_0xc634('0x9')]=_0x42c49f['name']||'';this[_0xc634('0xa')]=_0x42c49f['timeout']||0xa;this['strategy']=_0x42c49f[_0xc634('0xb')]||'beepall';this[_0xc634('0xc')]=_0x42c49f[_0xc634('0xc')];this['mapAgentsId']={};this[_0xc634('0xd')]=0x0;this[_0xc634('0x1')]='';this[_0xc634('0xe')]();this[_0xc634('0xf')]();}MailQueue[_0xc634('0x10')]['updateRouting']=function(){var _0x2dddd3=this[_0xc634('0x11')][_0xc634('0x12')];this[_0xc634('0x11')]=_[_0xc634('0x13')](this[_0xc634('0xc')],'id');this[_0xc634('0x11')][_0xc634('0x12')]=_0x2dddd3;};MailQueue[_0xc634('0x10')][_0xc634('0xf')]=function(){this[_0xc634('0x14')]=0x0;this[_0xc634('0x15')]=0x0;for(var _0x83e761=0x0;_0x83e761=0x0?this[_0xc634('0x19')]:0x0;var _0x17ff7b={'id':this['id'],'available':this[_0xc634('0x19')],'loggedIn':this[_0xc634('0x14')],'name':this[_0xc634('0x9')],'paused':this[_0xc634('0x15')],'waiting':this[_0xc634('0xd')]};var _0x39d8da=md5(JSON['stringify'](_0x17ff7b));if(this[_0xc634('0x1')]!==_0x39d8da){this[_0xc634('0x1')]=_0x39d8da;io['to'](util[_0xc634('0x1a')](_0xc634('0x1b'),_0x17ff7b[_0xc634('0x9')]))[_0xc634('0x1c')]('mail_queue:save',_0x17ff7b);}};module[_0xc634('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 7578881..e164a6f 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x32724b,_0x4fa49a){var _0x2c65b5=function(_0x16e3ff){while(--_0x16e3ff){_0x32724b['push'](_0x32724b['shift']());}};_0x2c65b5(++_0x4fa49a);}(_0x814b,0x1a2));var _0xb814=function(_0x4ded50,_0x4a6af3){_0x4ded50=_0x4ded50-0x0;var _0xa92135=_0x814b[_0x4ded50];return _0xa92135;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 249d611..eacdb6f 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 _0xd52a=['stringify','format','name','emit','sms_queue:save','exports','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','paused','length','online','smsPause','available'];(function(_0xc9f791,_0x404148){var _0x3f0738=function(_0x3abfd9){while(--_0x3abfd9){_0xc9f791['push'](_0xc9f791['shift']());}};_0x3f0738(++_0x404148);}(_0xd52a,0xca));var _0xad52=function(_0x47ffdd,_0x525987){_0x47ffdd=_0x47ffdd-0x0;var _0x46ca7f=_0xd52a[_0x47ffdd];return _0x46ca7f;};'use strict';var _=require('lodash');var md5=require(_0xad52('0x0'));var util=require('util');var Redis=require(_0xad52('0x1'));var config=require(_0xad52('0x2'));config[_0xad52('0x3')]=_['defaults'](config[_0xad52('0x3')],{'host':_0xad52('0x4'),'port':0x18eb});var io=require(_0xad52('0x5'))(new Redis(config[_0xad52('0x3')]));function SmsQueue(_0x4ed1e9){this['id']=_0x4ed1e9['id']||0x0;this['name']=_0x4ed1e9['name']||'';this[_0xad52('0x6')]=_0x4ed1e9['timeout']||0xa;this[_0xad52('0x7')]=_0x4ed1e9['strategy']||_0xad52('0x8');this[_0xad52('0x9')]=_0x4ed1e9['Agents'];this[_0xad52('0xa')]={};this['waiting']=0x0;this[_0xad52('0x0')]='';this['updateRouting']();this[_0xad52('0xb')]();}SmsQueue[_0xad52('0xc')][_0xad52('0xd')]=function(){var _0x119cdc=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xad52('0xe')](this[_0xad52('0x9')],'id');this[_0xad52('0xa')][_0xad52('0xf')]=_0x119cdc;};SmsQueue[_0xad52('0xc')][_0xad52('0xb')]=function(){this[_0xad52('0x10')]=0x0;this[_0xad52('0x11')]=0x0;for(var _0x3d2df6=0x0;_0x3d2df6=0x0?this[_0xad52('0x15')]:0x0;var _0x351440={'id':this['id'],'available':this[_0xad52('0x15')],'loggedIn':this[_0xad52('0x10')],'name':this['name'],'paused':this[_0xad52('0x11')],'waiting':this['waiting']};var _0x164ffd=md5(JSON[_0xad52('0x16')](_0x351440));if(this[_0xad52('0x0')]!==_0x164ffd){this['md5']=_0x164ffd;io['to'](util[_0xad52('0x17')]('sms:queue:%s',_0x351440[_0xad52('0x18')]))[_0xad52('0x19')](_0xad52('0x1a'),_0x351440);}};module[_0xad52('0x1b')]=SmsQueue; \ No newline at end of file +var _0x47c7=['available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','prototype','_rr','mapAgentsId','updateRealtime','loggedIn','paused','length','smsPause'];(function(_0x589eb4,_0xaa2019){var _0xf50816=function(_0x572fc5){while(--_0x572fc5){_0x589eb4['push'](_0x589eb4['shift']());}};_0xf50816(++_0xaa2019);}(_0x47c7,0x1ab));var _0x747c=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x47c7[_0x34ad72];return _0x5c9aa8;};'use strict';var _=require(_0x747c('0x0'));var md5=require('md5');var util=require(_0x747c('0x1'));var Redis=require(_0x747c('0x2'));var config=require('../../../config/environment');config[_0x747c('0x3')]=_[_0x747c('0x4')](config['redis'],{'host':_0x747c('0x5'),'port':0x18eb});var io=require(_0x747c('0x6'))(new Redis(config[_0x747c('0x3')]));function SmsQueue(_0x259638){this['id']=_0x259638['id']||0x0;this['name']=_0x259638[_0x747c('0x7')]||'';this['timeout']=_0x259638[_0x747c('0x8')]||0xa;this[_0x747c('0x9')]=_0x259638[_0x747c('0x9')]||_0x747c('0xa');this[_0x747c('0xb')]=_0x259638['Agents'];this['mapAgentsId']={};this[_0x747c('0xc')]=0x0;this[_0x747c('0xd')]='';this[_0x747c('0xe')]();this['updateRealtime']();}SmsQueue[_0x747c('0xf')][_0x747c('0xe')]=function(){var _0x17c985=this['mapAgentsId'][_0x747c('0x10')];this['mapAgentsId']=_['map'](this[_0x747c('0xb')],'id');this[_0x747c('0x11')][_0x747c('0x10')]=_0x17c985;};SmsQueue[_0x747c('0xf')][_0x747c('0x12')]=function(){this[_0x747c('0x13')]=0x0;this[_0x747c('0x14')]=0x0;for(var _0x323c4e=0x0;_0x323c4e=0x0?this[_0x747c('0x17')]:0x0;var _0x51f702={'id':this['id'],'available':this[_0x747c('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x747c('0x7')],'paused':this[_0x747c('0x14')],'waiting':this[_0x747c('0xc')]};var _0x5e9862=md5(JSON[_0x747c('0x18')](_0x51f702));if(this[_0x747c('0xd')]!==_0x5e9862){this[_0x747c('0xd')]=_0x5e9862;io['to'](util[_0x747c('0x19')](_0x747c('0x1a'),_0x51f702[_0x747c('0x7')]))[_0x747c('0x1b')](_0x747c('0x1c'),_0x51f702);}};module[_0x747c('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 20111ce..fe60ebe 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 _0xc625=['_rr','mapAgentsId','map','loggedIn','paused','length','online','available','whatsapp:queue:%s','name','emit','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype'];(function(_0x540c49,_0x3e88d9){var _0x390f69=function(_0x4cdf60){while(--_0x4cdf60){_0x540c49['push'](_0x540c49['shift']());}};_0x390f69(++_0x3e88d9);}(_0xc625,0x8e));var _0x5c62=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xc625[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0x5c62('0x0'));var md5=require(_0x5c62('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x5c62('0x2'));config[_0x5c62('0x3')]=_[_0x5c62('0x4')](config[_0x5c62('0x3')],{'host':_0x5c62('0x5'),'port':0x18eb});var io=require(_0x5c62('0x6'))(new Redis(config[_0x5c62('0x3')]));function WhatsappQueue(_0x1b04c9){this['id']=_0x1b04c9['id']||0x0;this['name']=_0x1b04c9['name']||'';this[_0x5c62('0x7')]=_0x1b04c9[_0x5c62('0x7')]||0xa;this[_0x5c62('0x8')]=_0x1b04c9['strategy']||'beepall';this[_0x5c62('0x9')]=_0x1b04c9[_0x5c62('0x9')];this['mapAgentsId']={};this[_0x5c62('0xa')]=0x0;this[_0x5c62('0x1')]='';this[_0x5c62('0xb')]();this[_0x5c62('0xc')]();}WhatsappQueue[_0x5c62('0xd')]['updateRouting']=function(){var _0x9ae489=this['mapAgentsId'][_0x5c62('0xe')];this[_0x5c62('0xf')]=_[_0x5c62('0x10')](this[_0x5c62('0x9')],'id');this[_0x5c62('0xf')][_0x5c62('0xe')]=_0x9ae489;};WhatsappQueue[_0x5c62('0xd')][_0x5c62('0xc')]=function(){this[_0x5c62('0x11')]=0x0;this[_0x5c62('0x12')]=0x0;for(var _0x7c64e=0x0;_0x7c64e=0x0?this[_0x5c62('0x15')]:0x0;var _0x360999={'id':this['id'],'available':this[_0x5c62('0x15')],'loggedIn':this[_0x5c62('0x11')],'name':this['name'],'paused':this[_0x5c62('0x12')],'waiting':this[_0x5c62('0xa')]};var _0x191059=md5(JSON['stringify'](_0x360999));if(this[_0x5c62('0x1')]!==_0x191059){this[_0x5c62('0x1')]=_0x191059;io['to'](util['format'](_0x5c62('0x16'),_0x360999[_0x5c62('0x17')]))[_0x5c62('0x18')]('whatsapp_queue:save',_0x360999);}};module[_0x5c62('0x19')]=WhatsappQueue; \ No newline at end of file +var _0x228b=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x101999,_0x2d9547){var _0x107579=function(_0x598221){while(--_0x598221){_0x101999['push'](_0x101999['shift']());}};_0x107579(++_0x2d9547);}(_0x228b,0x144));var _0xb228=function(_0x423bbb,_0x1c6758){_0x423bbb=_0x423bbb-0x0;var _0x5b61e8=_0x228b[_0x423bbb];return _0x5b61e8;};'use strict';var _=require(_0xb228('0x0'));var md5=require(_0xb228('0x1'));var util=require(_0xb228('0x2'));var Redis=require(_0xb228('0x3'));var config=require(_0xb228('0x4'));config[_0xb228('0x5')]=_[_0xb228('0x6')](config[_0xb228('0x5')],{'host':_0xb228('0x7'),'port':0x18eb});var io=require(_0xb228('0x8'))(new Redis(config['redis']));function WhatsappQueue(_0x311039){this['id']=_0x311039['id']||0x0;this[_0xb228('0x9')]=_0x311039[_0xb228('0x9')]||'';this[_0xb228('0xa')]=_0x311039[_0xb228('0xa')]||0xa;this[_0xb228('0xb')]=_0x311039[_0xb228('0xb')]||_0xb228('0xc');this['Agents']=_0x311039[_0xb228('0xd')];this[_0xb228('0xe')]={};this[_0xb228('0xf')]=0x0;this[_0xb228('0x1')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0xb228('0x10')][_0xb228('0x11')]=function(){var _0x3c6ffc=this['mapAgentsId'][_0xb228('0x12')];this[_0xb228('0xe')]=_[_0xb228('0x13')](this[_0xb228('0xd')],'id');this['mapAgentsId']['_rr']=_0x3c6ffc;};WhatsappQueue[_0xb228('0x10')][_0xb228('0x14')]=function(){this[_0xb228('0x15')]=0x0;this[_0xb228('0x16')]=0x0;for(var _0x212f65=0x0;_0x212f65=0x0?this[_0xb228('0x1a')]:0x0;var _0x38361f={'id':this['id'],'available':this[_0xb228('0x1a')],'loggedIn':this[_0xb228('0x15')],'name':this[_0xb228('0x9')],'paused':this[_0xb228('0x16')],'waiting':this[_0xb228('0xf')]};var _0x58626c=md5(JSON[_0xb228('0x1b')](_0x38361f));if(this[_0xb228('0x1')]!==_0x58626c){this[_0xb228('0x1')]=_0x58626c;io['to'](util[_0xb228('0x1c')](_0xb228('0x1d'),_0x38361f[_0xb228('0x9')]))[_0xb228('0x1e')](_0xb228('0x1f'),_0x38361f);}};module[_0xb228('0x20')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 1bd7bd5..d0b8946 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(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x57474b,_0x314148){var _0x383611=function(_0x4ab683){while(--_0x4ab683){_0x57474b['push'](_0x57474b['shift']());}};_0x383611(++_0x314148);}(_0xb10b,0x12a));var _0xbb10=function(_0x2d719c,_0x59b346){_0x2d719c=_0x2d719c-0x0;var _0x16c7e8=_0xb10b[_0x2d719c];return _0x16c7e8;};'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 c97f2de..f6567b1 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 _0x4073=['Request','addTags','AddTagsToChatInteraction','../client'];(function(_0x1a4936,_0x5b60b8){var _0x28c708=function(_0x146593){while(--_0x146593){_0x1a4936['push'](_0x1a4936['shift']());}};_0x28c708(++_0x5b60b8);}(_0x4073,0x1d7));var _0x3407=function(_0xedd31e,_0x343c98){_0xedd31e=_0xedd31e-0x0;var _0x5e4c03=_0x4073[_0xedd31e];return _0x5e4c03;};'use strict';var client=require(_0x3407('0x0'));exports['update']=function(_0x36c356,_0x3a4724){return client[_0x3407('0x1')]('UpdateChatInteraction',{'body':_0x3a4724,'options':{'where':{'id':_0x36c356}},'log':'updateChatInteraction'});};exports[_0x3407('0x2')]=function(_0x2bbfee,_0x41bc9b){return client['Request'](_0x3407('0x3'),{'body':_0x41bc9b,'options':{'where':{'id':_0x2bbfee}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x2c17=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x4a0df8,_0x225d84){var _0x2d5862=function(_0x4ea246){while(--_0x4ea246){_0x4a0df8['push'](_0x4a0df8['shift']());}};_0x2d5862(++_0x225d84);}(_0x2c17,0xb1));var _0x72c1=function(_0x501d64,_0x164ba9){_0x501d64=_0x501d64-0x0;var _0x173357=_0x2c17[_0x501d64];return _0x173357;};'use strict';var client=require(_0x72c1('0x0'));exports['update']=function(_0x2dbbdf,_0x5223ac){return client[_0x72c1('0x1')](_0x72c1('0x2'),{'body':_0x5223ac,'options':{'where':{'id':_0x2dbbdf}},'log':_0x72c1('0x3')});};exports[_0x72c1('0x4')]=function(_0x5c1689,_0x4d15d1){return client[_0x72c1('0x1')](_0x72c1('0x5'),{'body':_0x4d15d1,'options':{'where':{'id':_0x5c1689}},'log':_0x72c1('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index a192489..0c4eca2 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 _0x44bf=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x38ff1e,_0x3b9385){var _0x3755d4=function(_0x6e6692){while(--_0x6e6692){_0x38ff1e['push'](_0x38ff1e['shift']());}};_0x3755d4(++_0x3b9385);}(_0x44bf,0x1d5));var _0xf44b=function(_0x2f681a,_0x571b56){_0x2f681a=_0x2f681a-0x0;var _0x2e8007=_0x44bf[_0x2f681a];return _0x2e8007;};'use strict';var client=require(_0xf44b('0x0'));exports[_0xf44b('0x1')]=function(_0x57a122){return client[_0xf44b('0x2')](_0xf44b('0x3'),{'body':_0x57a122,'log':_0xf44b('0x4')});}; \ No newline at end of file +var _0x37f1=['../client','create','CreateChatMessage'];(function(_0x1873c8,_0x36b55c){var _0x3ac61f=function(_0xe54ada){while(--_0xe54ada){_0x1873c8['push'](_0x1873c8['shift']());}};_0x3ac61f(++_0x36b55c);}(_0x37f1,0x1b0));var _0x137f=function(_0x10d494,_0x5c93ec){_0x10d494=_0x10d494-0x0;var _0x4b9868=_0x37f1[_0x10d494];return _0x4b9868;};'use strict';var client=require(_0x137f('0x0'));exports[_0x137f('0x1')]=function(_0x93f210){return client['Request'](_0x137f('0x2'),{'body':_0x93f210,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 4b02970..49d26af 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 _0x3edc=['Request','GetChatQueue','name','strategy','Agents','online','chatPause','../client','getChatQueues'];(function(_0x188826,_0x3abf8b){var _0x5ee0c2=function(_0x3ffd13){while(--_0x3ffd13){_0x188826['push'](_0x188826['shift']());}};_0x5ee0c2(++_0x3abf8b);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x2ae15f,_0x3e1860){_0x2ae15f=_0x2ae15f-0x0;var _0x42a3d3=_0x3edc[_0x2ae15f];return _0x42a3d3;};'use strict';var client=require(_0xc3ed('0x0'));exports[_0xc3ed('0x1')]=function(){return function(){return client[_0xc3ed('0x2')](_0xc3ed('0x3'),{'options':{'raw':![],'attributes':['id',_0xc3ed('0x4'),'timeout',_0xc3ed('0x5')],'include':[{'model':'User','as':_0xc3ed('0x6'),'attributes':['id',_0xc3ed('0x4'),_0xc3ed('0x7'),_0xc3ed('0x8')]}]},'log':_0xc3ed('0x1')});};}; \ No newline at end of file +var _0x0f4d=['online','chatPause','getChatQueues','GetChatQueue','timeout','strategy','User','Agents','name'];(function(_0x3e978c,_0x1d5774){var _0x295585=function(_0x309460){while(--_0x309460){_0x3e978c['push'](_0x3e978c['shift']());}};_0x295585(++_0x1d5774);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x563476,_0x598d6d){_0x563476=_0x563476-0x0;var _0x201c5c=_0x0f4d[_0x563476];return _0x201c5c;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client['Request'](_0xd0f4('0x0'),{'options':{'raw':![],'attributes':['id','name',_0xd0f4('0x1'),_0xd0f4('0x2')],'include':[{'model':_0xd0f4('0x3'),'as':_0xd0f4('0x4'),'attributes':['id',_0xd0f4('0x5'),_0xd0f4('0x6'),_0xd0f4('0x7')]}]},'log':_0xd0f4('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 0c8b395..59819ce 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 _0xc5c7=['DESC','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x57571b,_0x35a171){_0x57571b=_0x57571b-0x0;var _0x34804b=_0xc5c7[_0x57571b];return _0x34804b;};'use strict';var client=require('../client');exports[_0x7c5c('0x0')]=function(_0x28e1a9){return client[_0x7c5c('0x1')](_0x7c5c('0x2'),{'body':_0x28e1a9,'log':_0x7c5c('0x2')});};exports[_0x7c5c('0x3')]=function(_0x4d3807,_0xff325e){return client[_0x7c5c('0x1')](_0x7c5c('0x4'),{'body':_0xff325e,'options':{'where':{'uniqueid':_0x4d3807},'order':[['id',_0x7c5c('0x5')]],'limit':0x1},'log':_0x7c5c('0x4')});}; \ No newline at end of file +var _0x5127=['update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0xe5fe1a,_0x4a80ea){var _0x2f652d=function(_0x69a95d){while(--_0x69a95d){_0xe5fe1a['push'](_0xe5fe1a['shift']());}};_0x2f652d(++_0x4a80ea);}(_0x5127,0x18f));var _0x7512=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x5127[_0x5c6244];return _0x5800ce;};'use strict';var client=require(_0x7512('0x0'));exports[_0x7512('0x1')]=function(_0x3abf2c){return client[_0x7512('0x2')]('CreateChatQueueReport',{'body':_0x3abf2c,'log':'CreateChatQueueReport'});};exports[_0x7512('0x3')]=function(_0x58a754,_0x3fbca7){return client[_0x7512('0x2')](_0x7512('0x4'),{'body':_0x3fbca7,'options':{'where':{'uniqueid':_0x58a754},'order':[['id',_0x7512('0x5')]],'limit':0x1},'log':_0x7512('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c2be67e..98dfb90 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(_0x5e39ea,_0x54c56a){var _0x224783=function(_0x2dcad1){while(--_0x2dcad1){_0x5e39ea['push'](_0x5e39ea['shift']());}};_0x224783(++_0x54c56a);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x46a559,_0x5c9d36){var _0xa934e1=function(_0x1dfed0){while(--_0x1dfed0){_0x46a559['push'](_0x46a559['shift']());}};_0xa934e1(++_0x5c9d36);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index e78d33d..e0afc77 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 _0xdf5d=['createFaxMessage','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf5d,0x11b));var _0xddf5=function(_0x1b0de8,_0x55d083){_0x1b0de8=_0x1b0de8-0x0;var _0x1421c0=_0xdf5d[_0x1b0de8];return _0x1421c0;};'use strict';var client=require('../client');exports['create']=function(_0x5cc9c5){return client[_0xddf5('0x0')]('CreateFaxMessage',{'body':_0x5cc9c5,'log':_0xddf5('0x1')});}; \ No newline at end of file +var _0x97e5=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x38c6c6,_0x25c022){var _0x56975f=function(_0x285f4c){while(--_0x285f4c){_0x38c6c6['push'](_0x38c6c6['shift']());}};_0x56975f(++_0x25c022);}(_0x97e5,0xb1));var _0x597e=function(_0x110381,_0x57882a){_0x110381=_0x110381-0x0;var _0x5f291b=_0x97e5[_0x110381];return _0x5f291b;};'use strict';var client=require(_0x597e('0x0'));exports[_0x597e('0x1')]=function(_0x3bbebe){return client[_0x597e('0x2')](_0x597e('0x3'),{'body':_0x3bbebe,'log':_0x597e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 27a4684..a1156be 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 _0x3d70=['GetFaxQueue','name','timeout','Agents','online'];(function(_0x4b6507,_0x5518b5){var _0x2001ec=function(_0x330ddf){while(--_0x330ddf){_0x4b6507['push'](_0x4b6507['shift']());}};_0x2001ec(++_0x5518b5);}(_0x3d70,0x154));var _0x03d7=function(_0x17784a,_0x42fe44){_0x17784a=_0x17784a-0x0;var _0x41aded=_0x3d70[_0x17784a];return _0x41aded;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client['Request'](_0x03d7('0x0'),{'options':{'raw':![],'attributes':['id',_0x03d7('0x1'),_0x03d7('0x2'),'strategy'],'include':[{'model':'User','as':_0x03d7('0x3'),'attributes':['id',_0x03d7('0x1'),_0x03d7('0x4'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xb1b0=['name','timeout','strategy','User','Agents','faxPause','../client','Request','GetFaxQueue'];(function(_0x14ad66,_0x582055){var _0x49f32e=function(_0x12eb22){while(--_0x12eb22){_0x14ad66['push'](_0x14ad66['shift']());}};_0x49f32e(++_0x582055);}(_0xb1b0,0x180));var _0x0b1b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb1b0[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x0b1b('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x0b1b('0x1')](_0x0b1b('0x2'),{'options':{'raw':![],'attributes':['id',_0x0b1b('0x3'),_0x0b1b('0x4'),_0x0b1b('0x5')],'include':[{'model':_0x0b1b('0x6'),'as':_0x0b1b('0x7'),'attributes':['id',_0x0b1b('0x3'),'online',_0x0b1b('0x8')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 89d5c31..8b4eaf8 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 _0xe0f8=['Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client'];(function(_0x2c44c4,_0x517214){var _0xbb257b=function(_0x53a1b7){while(--_0x53a1b7){_0x2c44c4['push'](_0x2c44c4['shift']());}};_0xbb257b(++_0x517214);}(_0xe0f8,0x12b));var _0x8e0f=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xe0f8[_0x36eaaa];return _0x461349;};'use strict';var client=require(_0x8e0f('0x0'));exports['create']=function(_0x5df065){return client[_0x8e0f('0x1')](_0x8e0f('0x2'),{'body':_0x5df065,'log':_0x8e0f('0x2')});};exports['update']=function(_0x321ebf,_0x44cc5f){return client[_0x8e0f('0x1')](_0x8e0f('0x3'),{'body':_0x44cc5f,'options':{'where':{'uniqueid':_0x321ebf},'order':[['id',_0x8e0f('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xf804=['UpdateFaxQueueReport','../client','Request','CreateFaxQueueReport'];(function(_0x2280d4,_0x22f856){var _0x336076=function(_0x3daee8){while(--_0x3daee8){_0x2280d4['push'](_0x2280d4['shift']());}};_0x336076(++_0x22f856);}(_0xf804,0xb1));var _0x4f80=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf804[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0x4f80('0x0'));exports['create']=function(_0x2ae763){return client[_0x4f80('0x1')](_0x4f80('0x2'),{'body':_0x2ae763,'log':_0x4f80('0x2')});};exports['update']=function(_0x4fa515,_0x215388){return client['Request'](_0x4f80('0x3'),{'body':_0x215388,'options':{'where':{'uniqueid':_0x4fa515},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 99f5616..5bff951 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 _0xfcc3=['Interval','Intervals','name','getIntervals','../client','Request','GetInterval'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfcc3,0x1e0));var _0x3fcc=function(_0x37914a,_0x2248b1){_0x37914a=_0x37914a-0x0;var _0x5adc4b=_0xfcc3[_0x37914a];return _0x5adc4b;};'use strict';var client=require(_0x3fcc('0x0'));exports['getIntervals']=function(){return function(){return client[_0x3fcc('0x1')](_0x3fcc('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x3fcc('0x3'),'as':_0x3fcc('0x4'),'attributes':['id',_0x3fcc('0x5'),'interval']}]},'log':_0x3fcc('0x6')});};}; \ No newline at end of file +var _0x962a=['Request','GetInterval','name','Interval','Intervals','interval','getIntervals'];(function(_0x5e6fca,_0x540568){var _0x505941=function(_0x4c1d36){while(--_0x4c1d36){_0x5e6fca['push'](_0x5e6fca['shift']());}};_0x505941(++_0x540568);}(_0x962a,0x180));var _0xa962=function(_0x2ac7c0,_0x36563a){_0x2ac7c0=_0x2ac7c0-0x0;var _0x59d69e=_0x962a[_0x2ac7c0];return _0x59d69e;};'use strict';var client=require('../client');exports[_0xa962('0x0')]=function(){return function(){return client[_0xa962('0x1')](_0xa962('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa962('0x3')],'include':[{'model':_0xa962('0x4'),'as':_0xa962('0x5'),'attributes':['id','name',_0xa962('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 0597c88..4f5a5a3 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 _0x236c=['Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x2b3b3a,_0x3226e0){var _0x4b1b2c=function(_0x53b585){while(--_0x53b585){_0x2b3b3a['push'](_0x2b3b3a['shift']());}};_0x4b1b2c(++_0x3226e0);}(_0x236c,0x155));var _0xc236=function(_0x15064b,_0x17ea0b){_0x15064b=_0x15064b-0x0;var _0x527ac3=_0x236c[_0x15064b];return _0x527ac3;};'use strict';var client=require(_0xc236('0x0'));exports['update']=function(_0x2ce95a,_0x404d50){return client[_0xc236('0x1')](_0xc236('0x2'),{'body':_0x404d50,'options':{'where':{'id':_0x2ce95a}},'log':_0xc236('0x3')});};exports['addTags']=function(_0x3adce9,_0x36e87d){return client[_0xc236('0x1')](_0xc236('0x4'),{'body':_0x36e87d,'options':{'where':{'id':_0x3adce9}},'log':_0xc236('0x5')});}; \ No newline at end of file +var _0x0598=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','updateMailInteraction','addTags'];(function(_0xa498fe,_0x395b01){var _0x531f1a=function(_0x5181b8){while(--_0x5181b8){_0xa498fe['push'](_0xa498fe['shift']());}};_0x531f1a(++_0x395b01);}(_0x0598,0x92));var _0x8059=function(_0x33fef0,_0x232ba0){_0x33fef0=_0x33fef0-0x0;var _0x31219f=_0x0598[_0x33fef0];return _0x31219f;};'use strict';var client=require(_0x8059('0x0'));exports[_0x8059('0x1')]=function(_0x5c8253,_0x3386f0){return client['Request']('UpdateMailInteraction',{'body':_0x3386f0,'options':{'where':{'id':_0x5c8253}},'log':_0x8059('0x2')});};exports[_0x8059('0x3')]=function(_0x54b9a2,_0x54f42f){return client['Request'](_0x8059('0x4'),{'body':_0x54f42f,'options':{'where':{'id':_0x54b9a2}},'log':_0x8059('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 52fd098..8374bd6 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 _0x08f9=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x280a79,_0x223634){var _0x11403e=function(_0x3e2f82){while(--_0x3e2f82){_0x280a79['push'](_0x280a79['shift']());}};_0x11403e(++_0x223634);}(_0x08f9,0x101));var _0x908f=function(_0x17ba2d,_0x493491){_0x17ba2d=_0x17ba2d-0x0;var _0x58be42=_0x08f9[_0x17ba2d];return _0x58be42;};'use strict';var client=require(_0x908f('0x0'));exports[_0x908f('0x1')]=function(_0x26a00f){return client[_0x908f('0x2')](_0x908f('0x3'),{'body':_0x26a00f,'log':_0x908f('0x4')});}; \ No newline at end of file +var _0x743b=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x743b,0x182));var _0xb743=function(_0x44883a,_0x5f2d8a){_0x44883a=_0x44883a-0x0;var _0x35d8b6=_0x743b[_0x44883a];return _0x35d8b6;};'use strict';var client=require(_0xb743('0x0'));exports[_0xb743('0x1')]=function(_0x1425fb){return client[_0xb743('0x2')](_0xb743('0x3'),{'body':_0x1425fb,'log':_0xb743('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 3268ad0..fada930 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 _0x10fc=['Agents','online','getMailQueues','../client','name','timeout','strategy','User'];(function(_0x1328bf,_0x59af4c){var _0x22eccd=function(_0x4e8baf){while(--_0x4e8baf){_0x1328bf['push'](_0x1328bf['shift']());}};_0x22eccd(++_0x59af4c);}(_0x10fc,0x10b));var _0xc10f=function(_0xf17fdc,_0x40ffd8){_0xf17fdc=_0xf17fdc-0x0;var _0x1ac780=_0x10fc[_0xf17fdc];return _0x1ac780;};'use strict';var client=require(_0xc10f('0x0'));exports['getMailQueues']=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xc10f('0x1'),_0xc10f('0x2'),_0xc10f('0x3')],'include':[{'model':_0xc10f('0x4'),'as':_0xc10f('0x5'),'attributes':['id','name',_0xc10f('0x6'),'mailPause']}]},'log':_0xc10f('0x7')});};}; \ No newline at end of file +var _0x56c3=['online','../client','getMailQueues','Request','GetMailQueue','timeout','strategy','Agents'];(function(_0x1b63c2,_0x3a9c82){var _0x2a3fe7=function(_0x292e0e){while(--_0x292e0e){_0x1b63c2['push'](_0x1b63c2['shift']());}};_0x2a3fe7(++_0x3a9c82);}(_0x56c3,0xb9));var _0x356c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56c3[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x356c('0x0'));exports[_0x356c('0x1')]=function(){return function(){return client[_0x356c('0x2')](_0x356c('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x356c('0x4'),_0x356c('0x5')],'include':[{'model':'User','as':_0x356c('0x6'),'attributes':['id','name',_0x356c('0x7'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 3bc12db..654e18f 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 _0xeba1=['update','UpdateMailQueueReport','DESC','../client','CreateMailQueueReport'];(function(_0x540b8d,_0x51b5a1){var _0x19dee7=function(_0x24aed9){while(--_0x24aed9){_0x540b8d['push'](_0x540b8d['shift']());}};_0x19dee7(++_0x51b5a1);}(_0xeba1,0x85));var _0x1eba=function(_0x3c3c0e,_0x446b39){_0x3c3c0e=_0x3c3c0e-0x0;var _0x5e7109=_0xeba1[_0x3c3c0e];return _0x5e7109;};'use strict';var client=require(_0x1eba('0x0'));exports['create']=function(_0x2105e0){return client['Request'](_0x1eba('0x1'),{'body':_0x2105e0,'log':_0x1eba('0x1')});};exports[_0x1eba('0x2')]=function(_0x1db60c,_0x59656c){return client['Request'](_0x1eba('0x3'),{'body':_0x59656c,'options':{'where':{'uniqueid':_0x1db60c},'order':[['id',_0x1eba('0x4')]],'limit':0x1},'log':_0x1eba('0x3')});}; \ No newline at end of file +var _0x9b01=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b01,0x144));var _0x19b0=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0x9b01[_0x45c48f];return _0xaf5037;};'use strict';var client=require('../client');exports[_0x19b0('0x0')]=function(_0x4827c5){return client[_0x19b0('0x1')]('CreateMailQueueReport',{'body':_0x4827c5,'log':_0x19b0('0x2')});};exports[_0x19b0('0x3')]=function(_0x493cab,_0x324710){return client[_0x19b0('0x1')](_0x19b0('0x4'),{'body':_0x324710,'options':{'where':{'uniqueid':_0x493cab},'order':[['id',_0x19b0('0x5')]],'limit':0x1},'log':_0x19b0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c56ef38..a0c2936 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 _0x3fda=['UpdateOpenchannelInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3fda,0x122));var _0xa3fd=function(_0x4a2bd3,_0x568bbd){_0x4a2bd3=_0x4a2bd3-0x0;var _0x1b4bda=_0x3fda[_0x4a2bd3];return _0x1b4bda;};'use strict';var client=require(_0xa3fd('0x0'));exports['update']=function(_0x218163,_0x395bc9){return client[_0xa3fd('0x1')](_0xa3fd('0x2'),{'body':_0x395bc9,'options':{'where':{'id':_0x218163}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x47f644,_0x42c7cf){return client[_0xa3fd('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x42c7cf,'options':{'where':{'id':_0x47f644}},'log':_0xa3fd('0x3')});}; \ No newline at end of file +var _0x7d8f=['AddTagsToOpenchannelInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x16d180,_0x2a54ec){var _0x105f12=function(_0x3abe9f){while(--_0x3abe9f){_0x16d180['push'](_0x16d180['shift']());}};_0x105f12(++_0x2a54ec);}(_0x7d8f,0x175));var _0xf7d8=function(_0x4cfd54,_0x4dd301){_0x4cfd54=_0x4cfd54-0x0;var _0x4ac0ab=_0x7d8f[_0x4cfd54];return _0x4ac0ab;};'use strict';var client=require(_0xf7d8('0x0'));exports[_0xf7d8('0x1')]=function(_0x59b518,_0x3aeece){return client['Request'](_0xf7d8('0x2'),{'body':_0x3aeece,'options':{'where':{'id':_0x59b518}},'log':_0xf7d8('0x3')});};exports[_0xf7d8('0x4')]=function(_0x3390be,_0x1cef70){return client['Request'](_0xf7d8('0x5'),{'body':_0x1cef70,'options':{'where':{'id':_0x3390be}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 22c6409..57d516f 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 _0x92cd=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x216880,_0x74fae6){var _0x3477fc=function(_0x43271e){while(--_0x43271e){_0x216880['push'](_0x216880['shift']());}};_0x3477fc(++_0x74fae6);}(_0x92cd,0x136));var _0xd92c=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x92cd[_0x3bab09];return _0x164376;};'use strict';var client=require(_0xd92c('0x0'));exports[_0xd92c('0x1')]=function(_0x59ac1e){return client[_0xd92c('0x2')](_0xd92c('0x3'),{'body':_0x59ac1e,'log':_0xd92c('0x4')});}; \ No newline at end of file +var _0x9b75=['Request','CreateOpenchannelMessage','../client'];(function(_0x4db4f2,_0x422e88){var _0x4ccfee=function(_0xf74f82){while(--_0xf74f82){_0x4db4f2['push'](_0x4db4f2['shift']());}};_0x4ccfee(++_0x422e88);}(_0x9b75,0x8f));var _0x59b7=function(_0xffa6e7,_0x48fa96){_0xffa6e7=_0xffa6e7-0x0;var _0x21ba16=_0x9b75[_0xffa6e7];return _0x21ba16;};'use strict';var client=require(_0x59b7('0x0'));exports['create']=function(_0x307e0e){return client[_0x59b7('0x1')](_0x59b7('0x2'),{'body':_0x307e0e,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index f002faa..eee39b0 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 _0x02d6=['Agents','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User'];(function(_0x5c58d7,_0x58a31c){var _0x258e5b=function(_0x44a527){while(--_0x44a527){_0x5c58d7['push'](_0x5c58d7['shift']());}};_0x258e5b(++_0x58a31c);}(_0x02d6,0xfd));var _0x602d=function(_0x5ad650,_0x3645d5){_0x5ad650=_0x5ad650-0x0;var _0xdab129=_0x02d6[_0x5ad650];return _0xdab129;};'use strict';var client=require('../client');exports[_0x602d('0x0')]=function(){return function(){return client[_0x602d('0x1')](_0x602d('0x2'),{'options':{'raw':![],'attributes':['id',_0x602d('0x3'),_0x602d('0x4'),_0x602d('0x5')],'include':[{'model':_0x602d('0x6'),'as':_0x602d('0x7'),'attributes':['id','name',_0x602d('0x8'),_0x602d('0x9')]}]},'log':_0x602d('0x0')});};}; \ No newline at end of file +var _0x1685=['name','timeout','strategy','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x331c88,_0x33ba55){var _0x363b35=function(_0x4eb1e7){while(--_0x4eb1e7){_0x331c88['push'](_0x331c88['shift']());}};_0x363b35(++_0x33ba55);}(_0x1685,0x196));var _0x5168=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x1685[_0x307d86];return _0x361745;};'use strict';var client=require(_0x5168('0x0'));exports[_0x5168('0x1')]=function(){return function(){return client[_0x5168('0x2')](_0x5168('0x3'),{'options':{'raw':![],'attributes':['id',_0x5168('0x4'),_0x5168('0x5'),_0x5168('0x6')],'include':[{'model':'User','as':_0x5168('0x7'),'attributes':['id',_0x5168('0x4'),_0x5168('0x8'),_0x5168('0x9')]}]},'log':_0x5168('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index fefa914..d34295c 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 _0xe62f=['create','Request','CreateOpenchannelQueueReport','update','DESC','../client'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xe62f,0xc5));var _0xfe62=function(_0x5c28a0,_0x2bfec5){_0x5c28a0=_0x5c28a0-0x0;var _0xb3da99=_0xe62f[_0x5c28a0];return _0xb3da99;};'use strict';var client=require(_0xfe62('0x0'));exports[_0xfe62('0x1')]=function(_0x38b818){return client[_0xfe62('0x2')](_0xfe62('0x3'),{'body':_0x38b818,'log':_0xfe62('0x3')});};exports[_0xfe62('0x4')]=function(_0x428726,_0x3720b9){return client[_0xfe62('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x3720b9,'options':{'where':{'uniqueid':_0x428726},'order':[['id',_0xfe62('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xa8f6=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xa8f6,0x1d3));var _0x6a8f=function(_0x1104a0,_0x5f1210){_0x1104a0=_0x1104a0-0x0;var _0xb210ad=_0xa8f6[_0x1104a0];return _0xb210ad;};'use strict';var client=require(_0x6a8f('0x0'));exports[_0x6a8f('0x1')]=function(_0x3024d5){return client[_0x6a8f('0x2')](_0x6a8f('0x3'),{'body':_0x3024d5,'log':_0x6a8f('0x3')});};exports[_0x6a8f('0x4')]=function(_0x526e71,_0x11cf1a){return client[_0x6a8f('0x2')](_0x6a8f('0x5'),{'body':_0x11cf1a,'options':{'where':{'uniqueid':_0x526e71},'order':[['id',_0x6a8f('0x6')]],'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 c28cb59..132313e 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 _0x34e7=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34e7,0x164));var _0x734e=function(_0xa8ec8f,_0x3eaefa){_0xa8ec8f=_0xa8ec8f-0x0;var _0xcd07ea=_0x34e7[_0xa8ec8f];return _0xcd07ea;};'use strict';var client=require(_0x734e('0x0'));exports[_0x734e('0x1')]=function(_0x25f91c,_0xc3cc13){return client[_0x734e('0x2')](_0x734e('0x3'),{'body':_0xc3cc13,'options':{'where':{'id':_0x25f91c}},'log':_0x734e('0x4')});};exports[_0x734e('0x5')]=function(_0x23d0df,_0x28573b){return client[_0x734e('0x2')](_0x734e('0x6'),{'body':_0x28573b,'options':{'where':{'id':_0x23d0df}},'log':_0x734e('0x7')});}; \ No newline at end of file +var _0x448a=['update','Request','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0x448a,0x1ef));var _0xa448=function(_0x14970e,_0x3dab4f){_0x14970e=_0x14970e-0x0;var _0x939d3c=_0x448a[_0x14970e];return _0x939d3c;};'use strict';var client=require('../client');exports[_0xa448('0x0')]=function(_0x38c69a,_0x5eac1f){return client[_0xa448('0x1')]('UpdateSmsInteraction',{'body':_0x5eac1f,'options':{'where':{'id':_0x38c69a}},'log':'updateSmsInteraction'});};exports[_0xa448('0x2')]=function(_0x3206fd,_0x57e1ea){return client[_0xa448('0x1')](_0xa448('0x3'),{'body':_0x57e1ea,'options':{'where':{'id':_0x3206fd}},'log':_0xa448('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 49a497e..d65ba28 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 _0xda24=['create','CreateSmsMessage','../client'];(function(_0xce0c61,_0x3769c0){var _0x36d93c=function(_0x47ce3a){while(--_0x47ce3a){_0xce0c61['push'](_0xce0c61['shift']());}};_0x36d93c(++_0x3769c0);}(_0xda24,0x182));var _0x4da2=function(_0x26f1cf,_0x3ed15f){_0x26f1cf=_0x26f1cf-0x0;var _0x6674e8=_0xda24[_0x26f1cf];return _0x6674e8;};'use strict';var client=require(_0x4da2('0x0'));exports[_0x4da2('0x1')]=function(_0x1ed732){return client['Request'](_0x4da2('0x2'),{'body':_0x1ed732,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xe075=['../client','create','Request','createSmsMessage'];(function(_0xc45e18,_0x2c2501){var _0x51adb9=function(_0x1edcef){while(--_0x1edcef){_0xc45e18['push'](_0xc45e18['shift']());}};_0x51adb9(++_0x2c2501);}(_0xe075,0x150));var _0x5e07=function(_0x226468,_0x3de21d){_0x226468=_0x226468-0x0;var _0x526982=_0xe075[_0x226468];return _0x526982;};'use strict';var client=require(_0x5e07('0x0'));exports[_0x5e07('0x1')]=function(_0x5d3a8e){return client[_0x5e07('0x2')]('CreateSmsMessage',{'body':_0x5d3a8e,'log':_0x5e07('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index dea728e..d40a4b5 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 _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x2e2104,_0x11287d){var _0x1280c5=function(_0x533646){while(--_0x533646){_0x2e2104['push'](_0x2e2104['shift']());}};_0x1280c5(++_0x11287d);}(_0x70e0,0x17b));var _0x070e=function(_0x12d33c,_0x1f9168){_0x12d33c=_0x12d33c-0x0;var _0xed6ccb=_0x70e0[_0x12d33c];return _0xed6ccb;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x32b221,_0x3fef7f){var _0x42d9a8=function(_0x49429e){while(--_0x49429e){_0x32b221['push'](_0x32b221['shift']());}};_0x42d9a8(++_0x3fef7f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xb7e7[_0x164eca];return _0x2ce562;};'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 0d0f5ae..d722726 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x4fde9a,_0x5d1eda){var _0x58f321=function(_0x278061){while(--_0x278061){_0x4fde9a['push'](_0x4fde9a['shift']());}};_0x58f321(++_0x5d1eda);}(_0x008c,0x188));var _0xc008=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0x008c[_0x307086];return _0x699043;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x23c2c3,_0x27ecc8){var _0x41e09f=function(_0x5e6873){while(--_0x5e6873){_0x23c2c3['push'](_0x23c2c3['shift']());}};_0x41e09f(++_0x27ecc8);}(_0x008c,0x188));var _0xc008=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0x008c[_0x3cb30b];return _0x2ca717;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index ba1e401..4e395a2 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(_0x431daa,_0x488bc4){var _0x431b10=function(_0x28e965){while(--_0x28e965){_0x431daa['push'](_0x431daa['shift']());}};_0x431b10(++_0x488bc4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x1e8107,_0x14569a){var _0x463e5e=function(_0x450807){while(--_0x450807){_0x1e8107['push'](_0x1e8107['shift']());}};_0x463e5e(++_0x14569a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 2f200fc..0844384 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 _0x0a1c=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','Request','addTags'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0x0a1c[_0x83af7f];return _0x32d85c;};'use strict';var client=require('../client');exports['update']=function(_0x3e2427,_0x42f1b7){return client[_0xc0a1('0x0')]('UpdateWhatsappInteraction',{'body':_0x42f1b7,'options':{'where':{'id':_0x3e2427}},'log':'updateWhatsappInteraction'});};exports[_0xc0a1('0x1')]=function(_0x411ce9,_0x108afd){return client[_0xc0a1('0x0')](_0xc0a1('0x2'),{'body':_0x108afd,'options':{'where':{'id':_0x411ce9}},'log':_0xc0a1('0x3')});}; \ No newline at end of file +var _0x0f4d=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x4d0d85,_0x3250d3){var _0x290a74=function(_0x4762db){while(--_0x4762db){_0x4d0d85['push'](_0x4d0d85['shift']());}};_0x290a74(++_0x3250d3);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x182dcf,_0x1c19f3){_0x182dcf=_0x182dcf-0x0;var _0x3ef2ce=_0x0f4d[_0x182dcf];return _0x3ef2ce;};'use strict';var client=require('../client');exports['update']=function(_0x54da22,_0x8b419){return client['Request'](_0xd0f4('0x0'),{'body':_0x8b419,'options':{'where':{'id':_0x54da22}},'log':_0xd0f4('0x1')});};exports[_0xd0f4('0x2')]=function(_0x347170,_0x1a9ba5){return client[_0xd0f4('0x3')](_0xd0f4('0x4'),{'body':_0x1a9ba5,'options':{'where':{'id':_0x347170}},'log':_0xd0f4('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index f12eb99..510fd7b 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 _0x81c2=['createWhatsappMessage','CreateWhatsappMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x81c2,0x127));var _0x281c=function(_0x3bad26,_0x1cf013){_0x3bad26=_0x3bad26-0x0;var _0x42e1ff=_0x81c2[_0x3bad26];return _0x42e1ff;};'use strict';var client=require('../client');exports['create']=function(_0x153294){return client['Request'](_0x281c('0x0'),{'body':_0x153294,'log':_0x281c('0x1')});}; \ No newline at end of file +var _0x744b=['Request','CreateWhatsappMessage','../client','create'];(function(_0x9f35c1,_0x2857b5){var _0x11232b=function(_0x3abd48){while(--_0x3abd48){_0x9f35c1['push'](_0x9f35c1['shift']());}};_0x11232b(++_0x2857b5);}(_0x744b,0x1e6));var _0xb744=function(_0x573752,_0x17ae4){_0x573752=_0x573752-0x0;var _0x2cb020=_0x744b[_0x573752];return _0x2cb020;};'use strict';var client=require(_0xb744('0x0'));exports[_0xb744('0x1')]=function(_0x3a1242){return client[_0xb744('0x2')](_0xb744('0x3'),{'body':_0x3a1242,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index fdf249e..c517f1f 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 _0x93ac=['GetWhatsappQueue','name','timeout','strategy','User','Agents','online','getWhatsappQueues','Request'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x93ac,0x15d));var _0xc93a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93ac[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xc93a('0x0')]=function(){return function(){return client[_0xc93a('0x1')](_0xc93a('0x2'),{'options':{'raw':![],'attributes':['id',_0xc93a('0x3'),_0xc93a('0x4'),_0xc93a('0x5')],'include':[{'model':_0xc93a('0x6'),'as':_0xc93a('0x7'),'attributes':['id',_0xc93a('0x3'),_0xc93a('0x8'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x2e49=['getWhatsappQueues','Request','GetWhatsappQueue','timeout','User','name','online','whatsappPause','../client'];(function(_0x451e90,_0x31e9ba){var _0x53c74a=function(_0x3dae30){while(--_0x3dae30){_0x451e90['push'](_0x451e90['shift']());}};_0x53c74a(++_0x31e9ba);}(_0x2e49,0x86));var _0x92e4=function(_0x31928b,_0x41ba86){_0x31928b=_0x31928b-0x0;var _0x12edbb=_0x2e49[_0x31928b];return _0x12edbb;};'use strict';var client=require(_0x92e4('0x0'));exports[_0x92e4('0x1')]=function(){return function(){return client[_0x92e4('0x2')](_0x92e4('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x92e4('0x4'),'strategy'],'include':[{'model':_0x92e4('0x5'),'as':'Agents','attributes':['id',_0x92e4('0x6'),_0x92e4('0x7'),_0x92e4('0x8')]}]},'log':_0x92e4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index ac63795..7db6b08 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 _0xb933=['../client','create','Request','CreateWhatsappQueueReport'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0xb933,0x9c));var _0x3b93=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0xb933[_0x50f392];return _0x5926f2;};'use strict';var client=require(_0x3b93('0x0'));exports[_0x3b93('0x1')]=function(_0x30a886){return client[_0x3b93('0x2')](_0x3b93('0x3'),{'body':_0x30a886,'log':_0x3b93('0x3')});};exports['update']=function(_0x7c8c77,_0x3282b0){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x3282b0,'options':{'where':{'uniqueid':_0x7c8c77},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x3a83=['Request','DESC','../client','CreateWhatsappQueueReport','update'];(function(_0x1b4880,_0x2ba9c6){var _0x447729=function(_0x4ca1ab){while(--_0x4ca1ab){_0x1b4880['push'](_0x1b4880['shift']());}};_0x447729(++_0x2ba9c6);}(_0x3a83,0xe3));var _0x33a8=function(_0x82fd63,_0x100913){_0x82fd63=_0x82fd63-0x0;var _0x1d42fb=_0x3a83[_0x82fd63];return _0x1d42fb;};'use strict';var client=require(_0x33a8('0x0'));exports['create']=function(_0x4e7b5f){return client['Request'](_0x33a8('0x1'),{'body':_0x4e7b5f,'log':'CreateWhatsappQueueReport'});};exports[_0x33a8('0x2')]=function(_0x3e9178,_0x473e34){return client[_0x33a8('0x3')]('UpdateWhatsappQueueReport',{'body':_0x473e34,'options':{'where':{'uniqueid':_0x3e9178},'order':[['id',_0x33a8('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index f6069d6..f3d2d8a 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 _0xec66=['find','timeout','createQueue','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','routing','./strategy','string','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xec66,0x103));var _0x6ec6=function(_0x3c6c1b,_0x82a1e4){_0x3c6c1b=_0x3c6c1b-0x0;var _0x15170e=_0xec66[_0x3c6c1b];return _0x15170e;};'use strict';var schema=require(_0x6ec6('0x0'));var _=require(_0x6ec6('0x1'));var util=require(_0x6ec6('0x2'));var seqqueue=require(_0x6ec6('0x3'));var logger=require('../../../../config/logger')(_0x6ec6('0x4'));var strategy=require(_0x6ec6('0x5'));var queue=schema({'name':{'type':_0x6ec6('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x6ec6('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x1c6f0c,_0x55e63a,_0x3cdc3a){return logger[_0x6ec6('0x8')](util[_0x6ec6('0x9')](_0x6ec6('0xa'),_0x1c6f0c,_0x55e63a[_0x6ec6('0xb')],_0x3cdc3a));}function handleFindAgent(_0x524d02){return function(_0x486113){return _0x486113['name'][_0x6ec6('0xc')]()===_0x524d02[_0x6ec6('0xc')]();};}exports[_0x6ec6('0xd')]=function(_0x3d4a62,_0x307dda,_0x16433a,_0x304605){return function(_0x2c2e5e){try{var _0x16797e={'name':_0x307dda[0x0],'timeout':_0x307dda[0x1]};var _0x516b62=queue[_0x6ec6('0x0')](_0x16797e,{'typecast':!![]});if(_0x516b62[_0x6ec6('0xe')]){logger[_0x6ec6('0xf')](_0x6ec6('0x10'),_0x3d4a62,_[_0x6ec6('0x11')](_0x516b62,_0x6ec6('0x12'))[_0x6ec6('0x13')](',\x20'));_0x2c2e5e[_0x6ec6('0x14')]();}else{var _0x12a2d1=_[_0x6ec6('0x15')](_0x16433a['agents'],handleFindAgent(_0x16797e['name']));if(_0x12a2d1){var _0x44f063=(_0x16797e[_0x6ec6('0x16')]||0xa)*0x3e8;var _0x3135d3,_0xa570b1;var _0x25d68e=seqqueue[_0x6ec6('0x17')](_0x44f063);_0x25d68e['id']=_0x3d4a62;_0x25d68e['atimeout']=_0x44f063;_0x25d68e[_0x6ec6('0x18')]=_0x304605[_0x6ec6('0x18')];writeLog(_0x3d4a62,_0x12a2d1,util['format']('START:%s',_0x44f063));_0x16433a[_0x6ec6('0x19')][_0x3d4a62]['on'](_0x6ec6('0x1a'),function(){logger[_0x6ec6('0x8')](_0x6ec6('0x1b'),_0x3d4a62);clearTimeout(_0xa570b1);_0xa570b1=undefined;_0x25d68e[_0x6ec6('0x1c')]();if(_0x16433a['rules'][_0x3d4a62]){delete _0x16433a[_0x6ec6('0x19')][_0x3d4a62];}_0x2c2e5e[_0x6ec6('0x14')]();});_0x16433a[_0x6ec6('0x19')][_0x3d4a62]['on'](_0x6ec6('0x1d'),function(){if(_0x16433a[_0x6ec6('0x19')][_0x3d4a62]){delete _0x16433a[_0x6ec6('0x19')][_0x3d4a62];}});_0xa570b1=setTimeout(function(){logger[_0x6ec6('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x3d4a62);clearTimeout(_0xa570b1);_0x25d68e[_0x6ec6('0x1c')]();_0x2c2e5e[_0x6ec6('0x1e')]();},_0x44f063);strategy['agent'](_0x25d68e,_0x12a2d1,_0x16433a,_0x304605);}else{logger[_0x6ec6('0xf')](_0x6ec6('0x1f'),_0x3d4a62,_0x16797e[_0x6ec6('0xb')]);_0x2c2e5e[_0x6ec6('0x14')]();}}}catch(_0x401a28){console[_0x6ec6('0x20')](_0x401a28);logger['error'](_0x6ec6('0x21'),_0x3d4a62,_0x401a28[_0x6ec6('0x22')]);_0x2c2e5e[_0x6ec6('0x14')]();}};}; \ No newline at end of file +var _0xd6ac=['info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','[%s][AGENT]\x20%s','message','stop','agents','timeout','createQueue','atimeout','channel','format','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number'];(function(_0xfc0976,_0x33776f){var _0x23579f=function(_0x4143d9){while(--_0x4143d9){_0xfc0976['push'](_0xfc0976['shift']());}};_0x23579f(++_0x33776f);}(_0xd6ac,0xb8));var _0xcd6a=function(_0x2043bf,_0x32d901){_0x2043bf=_0x2043bf-0x0;var _0x538468=_0xd6ac[_0x2043bf];return _0x538468;};'use strict';var schema=require(_0xcd6a('0x0'));var _=require(_0xcd6a('0x1'));var util=require(_0xcd6a('0x2'));var seqqueue=require(_0xcd6a('0x3'));var logger=require('../../../../config/logger')(_0xcd6a('0x4'));var strategy=require(_0xcd6a('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xcd6a('0x6')},'timeout':{'type':'number','message':_0xcd6a('0x7')}});function writeLog(_0x2ac162,_0x10dff1,_0x5df001){return logger[_0xcd6a('0x8')](util['format'](_0xcd6a('0x9'),_0x2ac162,_0x10dff1[_0xcd6a('0xa')],_0x5df001));}function handleFindAgent(_0x1d1bd4){return function(_0x18521c){return _0x18521c['name'][_0xcd6a('0xb')]()===_0x1d1bd4['toLowerCase']();};}exports['consequence']=function(_0x32239f,_0x1f99cf,_0x361a89,_0x51042a){return function(_0x1f0d31){try{var _0x162579={'name':_0x1f99cf[0x0],'timeout':_0x1f99cf[0x1]};var _0x538648=queue[_0xcd6a('0x0')](_0x162579,{'typecast':!![]});if(_0x538648[_0xcd6a('0xc')]){logger['error'](_0xcd6a('0xd'),_0x32239f,_['map'](_0x538648,_0xcd6a('0xe'))['join'](',\x20'));_0x1f0d31[_0xcd6a('0xf')]();}else{var _0x33b0dd=_['find'](_0x361a89[_0xcd6a('0x10')],handleFindAgent(_0x162579[_0xcd6a('0xa')]));if(_0x33b0dd){var _0x5cf892=(_0x162579[_0xcd6a('0x11')]||0xa)*0x3e8;var _0xecfd5e,_0x3c2418;var _0x4f3020=seqqueue[_0xcd6a('0x12')](_0x5cf892);_0x4f3020['id']=_0x32239f;_0x4f3020[_0xcd6a('0x13')]=_0x5cf892;_0x4f3020[_0xcd6a('0x14')]=_0x51042a[_0xcd6a('0x14')];writeLog(_0x32239f,_0x33b0dd,util[_0xcd6a('0x15')]('START:%s',_0x5cf892));_0x361a89[_0xcd6a('0x16')][_0x32239f]['on'](_0xcd6a('0x17'),function(){logger[_0xcd6a('0x8')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x32239f);clearTimeout(_0x3c2418);_0x3c2418=undefined;_0x4f3020[_0xcd6a('0x18')]();if(_0x361a89[_0xcd6a('0x16')][_0x32239f]){delete _0x361a89[_0xcd6a('0x16')][_0x32239f];}_0x1f0d31['stop']();});_0x361a89['rules'][_0x32239f]['on'](_0xcd6a('0x19'),function(){if(_0x361a89['rules'][_0x32239f]){delete _0x361a89[_0xcd6a('0x16')][_0x32239f];}});_0x3c2418=setTimeout(function(){logger['info'](_0xcd6a('0x1a'),_0x32239f);clearTimeout(_0x3c2418);_0x4f3020['close']();_0x1f0d31[_0xcd6a('0x1b')]();},_0x5cf892);strategy['agent'](_0x4f3020,_0x33b0dd,_0x361a89,_0x51042a);}else{logger[_0xcd6a('0x1c')](_0xcd6a('0x1d'),_0x32239f,_0x162579[_0xcd6a('0xa')]);_0x1f0d31[_0xcd6a('0xf')]();}}}catch(_0x304b7b){console[_0xcd6a('0x1e')](_0x304b7b);logger[_0xcd6a('0x1c')]('[%s][QUEUE]\x20%s',_0x32239f,_0x304b7b[_0xcd6a('0x1f')]);_0x1f0d31[_0xcd6a('0xf')]();}};}; \ 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 be0ca8d..7da7202 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 _0x50ac=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','providerName','amazonlex','providerResponse','stringify','then','dialogState','Failed','lodash','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','create','[%s][AMAZONLEX]\x20%s','body','catch','error','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x50ac,0xc8));var _0xc50a=function(_0x3ccb8f,_0x91ed97){_0x3ccb8f=_0x3ccb8f-0x0;var _0x39ec7c=_0x50ac[_0x3ccb8f];return _0x39ec7c;};'use strict';var _=require(_0xc50a('0x0'));var moment=require('moment');var AWS=require(_0xc50a('0x1'));var utils=require(_0xc50a('0x2'));var logger=require(_0xc50a('0x3'))('routing');var rpc={'chatMessage':require(_0xc50a('0x4')),'openchannelMessage':require(_0xc50a('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc50a('0x6')),'whatsappMessage':require(_0xc50a('0x7'))};exports[_0xc50a('0x8')]=function(_0x5904e6,_0xcbe205){return function(_0x16792e){try{if(!_[_0xc50a('0x9')](this[_0xc50a('0xa')]['UserId'])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x5904e6,_0xc50a('0xb'));return _0x16792e[_0xc50a('0xc')]();}var _0x2fcd4b={'ContactId':this[_0xc50a('0xd')]['id'],'sentAt':moment()[_0xc50a('0xe')](_0xc50a('0xf')),'direction':_0xc50a('0x10')};if(this[_0xc50a('0x11')]===_0xc50a('0x12')||this[_0xc50a('0x11')]===_0xc50a('0x13')){_0x2fcd4b['phone']=this[_0xc50a('0xa')][_0xc50a('0x14')];}var _0x41b064=this['channel'];if(_0x41b064==='chat'){_0x2fcd4b[_0xc50a('0x15')]=this[_0xc50a('0x16')]['id'];}else{_0x2fcd4b[_[_0xc50a('0x17')](_0x41b064)+_0xc50a('0x18')]=this['account']['id'];}_0x2fcd4b[_['upperFirst'](_0x41b064)+_0xc50a('0x19')]=this[_0xc50a('0xa')]['id'];if(this[_0xc50a('0xa')][_0xc50a('0x1a')]){var _0x465447=_0xcbe205[0x4];if(!_['isEmpty'](_0x465447)){_0x2fcd4b['body']=utils[_0xc50a('0x1b')](_0x465447,this);return rpc[_0x41b064+_0xc50a('0x1c')][_0xc50a('0x1d')](_0x2fcd4b)['then'](function(_0x170962){logger['info'](_0xc50a('0x1e'),_0x5904e6,_0x2fcd4b[_0xc50a('0x1f')]);})[_0xc50a('0x20')](function(_0xdc434){logger[_0xc50a('0x21')](_0xc50a('0x1e'),_0x5904e6,JSON['stringify'](_0xdc434));})['finally'](function(){logger[_0xc50a('0x22')](_0xc50a('0x23'),_0x5904e6);_0x16792e[_0xc50a('0x24')]();});}else{logger[_0xc50a('0x22')](_0xc50a('0x25'),_0x5904e6);_0x16792e[_0xc50a('0x24')]();}}else{var _0x5d7277=this;var _0x5eea50=new AWS[(_0xc50a('0x26'))]({'accessKeyId':_0xcbe205[0x0],'secretAccessKey':_0xcbe205[0x1],'region':_0xcbe205[0x2]});var _0x429dc1={'botAlias':'$LATEST','botName':_0xcbe205[0x3],'inputText':this['message'][_0xc50a('0x1f')],'userId':this[_0xc50a('0x11')]+':'+this[_0xc50a('0xa')]['id']['toString']()};_0x5eea50['postText'](_0x429dc1,function(_0xe58e1a,_0x2fd366){if(_0xe58e1a){logger[_0xc50a('0x21')](_0xc50a('0x1e'),_0x5904e6,_0xe58e1a[_0xc50a('0x27')]);_0x16792e[_0xc50a('0xc')]();}else if(_0x2fd366&&_0x2fd366['message']){_0x5d7277[_0xc50a('0x1f')]['amazonlex']=_0x2fd366;_0x2fcd4b[_0xc50a('0x1f')]=_0x2fd366[_0xc50a('0x27')];_0x2fcd4b[_0xc50a('0x28')]=_0xc50a('0x29');_0x2fcd4b[_0xc50a('0x2a')]=JSON[_0xc50a('0x2b')](_0x2fd366);return rpc[_0x41b064+_0xc50a('0x1c')][_0xc50a('0x1d')](_0x2fcd4b)[_0xc50a('0x2c')](function(_0x2bf140){logger['info'](_0xc50a('0x1e'),_0x5904e6,_0x2fcd4b['body']);if(_0x2fd366[_0xc50a('0x2d')]==_0xc50a('0x2e')){_0x16792e[_0xc50a('0xc')]();}else{_0x16792e[_0xc50a('0x24')]();}})[_0xc50a('0x20')](function(_0x40a1f4){logger['error'](_0xc50a('0x1e'),_0x5904e6,JSON[_0xc50a('0x2b')](_0x40a1f4));_0x16792e[_0xc50a('0xc')]();});}else{_0x16792e['next']();}});}}catch(_0x2b1d54){logger[_0xc50a('0x21')]('[%s][AMAZONLEX]\x20%s',_0x5904e6,JSON[_0xc50a('0x2b')](_0x2b1d54));_0x16792e['stop']();}};}; \ No newline at end of file +var _0x25a4=['contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','Message','create','body','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerResponse','stringify','then','Failed','moment','aws-sdk','./utils','../../rpc/chatMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next'];(function(_0x534f6d,_0x552b9e){var _0x69ca9b=function(_0x4559df){while(--_0x4559df){_0x534f6d['push'](_0x534f6d['shift']());}};_0x69ca9b(++_0x552b9e);}(_0x25a4,0xae));var _0x425a=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x25a4[_0xd39959];return _0x1ff69c;};'use strict';var _=require('lodash');var moment=require(_0x425a('0x0'));var AWS=require(_0x425a('0x1'));var utils=require(_0x425a('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x425a('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x425a('0x4')),'whatsappMessage':require(_0x425a('0x5'))};exports[_0x425a('0x6')]=function(_0x14f21c,_0x2e2b71){return function(_0x1d8b5b){try{if(!_[_0x425a('0x7')](this[_0x425a('0x8')][_0x425a('0x9')])){logger[_0x425a('0xa')](_0x425a('0xb'),_0x14f21c,_0x425a('0xc'));return _0x1d8b5b[_0x425a('0xd')]();}var _0x58c31b={'ContactId':this[_0x425a('0xe')]['id'],'sentAt':moment()[_0x425a('0xf')](_0x425a('0x10')),'direction':_0x425a('0x11')};if(this[_0x425a('0x12')]===_0x425a('0x13')||this['channel']===_0x425a('0x14')){_0x58c31b[_0x425a('0x15')]=this['interaction'][_0x425a('0x15')];}var _0x159251=this['channel'];if(_0x159251===_0x425a('0x16')){_0x58c31b[_0x425a('0x17')]=this[_0x425a('0x18')]['id'];}else{_0x58c31b[_[_0x425a('0x19')](_0x159251)+_0x425a('0x1a')]=this[_0x425a('0x18')]['id'];}_0x58c31b[_[_0x425a('0x19')](_0x159251)+_0x425a('0x1b')]=this[_0x425a('0x8')]['id'];if(this[_0x425a('0x8')]['created']){var _0x3a2a68=_0x2e2b71[0x4];if(!_[_0x425a('0x1c')](_0x3a2a68)){_0x58c31b['body']=utils['getMustacheRender'](_0x3a2a68,this);return rpc[_0x159251+_0x425a('0x1d')][_0x425a('0x1e')](_0x58c31b)['then'](function(_0x29d0de){logger[_0x425a('0xa')]('[%s][AMAZONLEX]\x20%s',_0x14f21c,_0x58c31b[_0x425a('0x1f')]);})[_0x425a('0x20')](function(_0x213475){logger[_0x425a('0x21')]('[%s][AMAZONLEX]\x20%s',_0x14f21c,JSON['stringify'](_0x213475));})['finally'](function(){logger[_0x425a('0xa')](_0x425a('0x22'),_0x14f21c);_0x1d8b5b[_0x425a('0x23')]();});}else{logger[_0x425a('0xa')](_0x425a('0x24'),_0x14f21c);_0x1d8b5b[_0x425a('0x23')]();}}else{var _0x1a5623=this;var _0x367114=new AWS[(_0x425a('0x25'))]({'accessKeyId':_0x2e2b71[0x0],'secretAccessKey':_0x2e2b71[0x1],'region':_0x2e2b71[0x2]});var _0x594efa={'botAlias':_0x425a('0x26'),'botName':_0x2e2b71[0x3],'inputText':this[_0x425a('0x27')]['body'],'userId':this[_0x425a('0x12')]+':'+this['interaction']['id'][_0x425a('0x28')]()};_0x367114[_0x425a('0x29')](_0x594efa,function(_0x14f767,_0x41346b){if(_0x14f767){logger['error'](_0x425a('0xb'),_0x14f21c,_0x14f767[_0x425a('0x27')]);_0x1d8b5b[_0x425a('0xd')]();}else if(_0x41346b&&_0x41346b[_0x425a('0x27')]){_0x1a5623[_0x425a('0x1f')][_0x425a('0x2a')]=_0x41346b;_0x58c31b[_0x425a('0x1f')]=_0x41346b['message'];_0x58c31b['providerName']=_0x425a('0x2a');_0x58c31b[_0x425a('0x2b')]=JSON[_0x425a('0x2c')](_0x41346b);return rpc[_0x159251+_0x425a('0x1d')][_0x425a('0x1e')](_0x58c31b)[_0x425a('0x2d')](function(_0x653126){logger['info']('[%s][AMAZONLEX]\x20%s',_0x14f21c,_0x58c31b[_0x425a('0x1f')]);if(_0x41346b['dialogState']==_0x425a('0x2e')){_0x1d8b5b[_0x425a('0xd')]();}else{_0x1d8b5b[_0x425a('0x23')]();}})[_0x425a('0x20')](function(_0x18b6ab){logger[_0x425a('0x21')](_0x425a('0xb'),_0x14f21c,JSON['stringify'](_0x18b6ab));_0x1d8b5b[_0x425a('0xd')]();});}else{_0x1d8b5b['next']();}});}}catch(_0x1dd297){logger[_0x425a('0x21')](_0x425a('0xb'),_0x14f21c,JSON['stringify'](_0x1dd297));_0x1d8b5b['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 a0ab70f..bd268e9 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 _0xa853=['message','from','channel','phone','read','subject','ChatWebsiteId','upperFirst','AccountId','InteractionId','Message','account','Smtp','service','host','port','secure','authentication','auth','inReplyTo','messageId','','replace','','auto-replied','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender'];(function(_0x4f7925,_0x3bf093){var _0x2f070d=function(_0x358f24){while(--_0x358f24){_0x4f7925['push'](_0x4f7925['shift']());}};_0x2f070d(++_0x3bf093);}(_0xa853,0xb9));var _0x3a85=function(_0x309334,_0x50409f){_0x309334=_0x309334-0x0;var _0x391001=_0xa853[_0x309334];return _0x391001;};'use strict';var _=require(_0x3a85('0x0'));var moment=require(_0x3a85('0x1'));var utils=require(_0x3a85('0x2'));var logger=require('../../../../config/logger')(_0x3a85('0x3'));var rpc={'chatMessage':require(_0x3a85('0x4')),'openchannelMessage':require(_0x3a85('0x5')),'mailMessage':require(_0x3a85('0x6')),'smsMessage':require(_0x3a85('0x7')),'faxMessage':require(_0x3a85('0x8')),'whatsappMessage':require(_0x3a85('0x9')),'chatInteraction':require(_0x3a85('0xa')),'openchannelInteraction':require(_0x3a85('0xb')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x3a85('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x301eba,_0x5b489c,_0x229512,_0x240fc7){return function(_0x4cb52a){try{var _0x497874=this['channel'];if(_0x497874===_0x3a85('0xd')&&_0x240fc7[_0x3a85('0xe')][_0x3a85('0xf')]){logger[_0x3a85('0x10')](_0x3a85('0x11'),_0x301eba,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x4cb52a[_0x3a85('0x12')]();}if(_0x5b489c[0x0]==='1'&&(_[_0x3a85('0x13')](this[_0x3a85('0x14')]['created'])||!this[_0x3a85('0x14')][_0x3a85('0x15')])){logger[_0x3a85('0x10')](_0x3a85('0x11'),_0x301eba,_0x3a85('0x16'));return _0x4cb52a[_0x3a85('0x12')]();}if(_0x5b489c[0x0]==='2'&&this[_0x3a85('0x14')][_0x3a85('0x17')]){logger[_0x3a85('0x10')](_0x3a85('0x18'),_0x301eba,_0x3a85('0x19'));return _0x4cb52a[_0x3a85('0x12')]();}var _0x402b37={'ContactId':this[_0x3a85('0x1a')]['id'],'sentAt':moment()[_0x3a85('0x1b')](_0x3a85('0x1c')),'direction':_0x3a85('0x1d')};if(this['channel']===_0x3a85('0xd')){_0x402b37['body']=utils[_0x3a85('0x1e')](_0x5b489c[0x2],this);}else{_0x402b37[_0x3a85('0xe')]=utils[_0x3a85('0x1e')](_0x5b489c[0x1],this);}if(this['message']){_0x402b37['to']=this[_0x3a85('0x1f')][_0x3a85('0x20')]||'';if(this[_0x3a85('0x21')]===_0x3a85('0xd')&&_0x5b489c[0x1]==='1'){_0x402b37['cc']=this['message']['cc']||'';}_0x402b37[_0x3a85('0x20')]=this[_0x3a85('0x1f')]['to']||'';_0x402b37[_0x3a85('0x22')]=this['message']['phone']||'';_0x402b37[_0x3a85('0x23')]=!![];if(this[_0x3a85('0x1f')]['subject']){_0x402b37[_0x3a85('0x24')]='';_0x402b37[_0x3a85('0x24')]+=_['startsWith'](this[_0x3a85('0x1f')]['subject'],'Re:')?'':'Re:\x20';_0x402b37[_0x3a85('0x24')]+=this[_0x3a85('0x1f')][_0x3a85('0x24')];}}if(this[_0x3a85('0x21')]==='chat'){_0x402b37[_0x3a85('0x25')]=this['account']['id'];}else{_0x402b37[_[_0x3a85('0x26')](this[_0x3a85('0x21')])+_0x3a85('0x27')]=this['account']['id'];}_0x402b37[_[_0x3a85('0x26')](this[_0x3a85('0x21')])+_0x3a85('0x28')]=this[_0x3a85('0x14')]['id'];var _0xa46861=this['interaction'];if(rpc[this[_0x3a85('0x21')]+_0x3a85('0x29')]){if(this['channel']==='mail'){var _0x58654a={'tls':{'rejectUnauthorized':![]}};if(this[_0x3a85('0x2a')][_0x3a85('0x2b')][_0x3a85('0x2c')]){_0x58654a[_0x3a85('0x2c')]=this[_0x3a85('0x2a')][_0x3a85('0x2b')][_0x3a85('0x2c')];}else{_0x58654a[_0x3a85('0x2d')]=this[_0x3a85('0x2a')]['Smtp'][_0x3a85('0x2d')];_0x58654a[_0x3a85('0x2e')]=this[_0x3a85('0x2a')][_0x3a85('0x2b')][_0x3a85('0x2e')];_0x58654a[_0x3a85('0x2f')]=this[_0x3a85('0x2a')]['Smtp'][_0x3a85('0x2f')];}if(this[_0x3a85('0x2a')]['Smtp'][_0x3a85('0x30')]){_0x58654a[_0x3a85('0x31')]={'user':this[_0x3a85('0x2a')][_0x3a85('0x2b')]['user'],'pass':this[_0x3a85('0x2a')][_0x3a85('0x2b')]['pass']};}_0x402b37[_0x3a85('0x32')]=this['message'][_0x3a85('0x33')];_0x402b37['html']=_0x3a85('0x34')+_[_0x3a85('0x35')](_0x402b37[_0x3a85('0xe')],_0x3a85('0x36'),_0x3a85('0x37'))+_0x3a85('0x38');_0x402b37['headers']={'Auto-Submitted':_0x3a85('0x39'),'X-Auto-Response-Suppress':_0x3a85('0x3a'),'Precedence':_0x3a85('0x3b')};return mailRpc['sendMailMessage'](_0x58654a,_0x402b37)[_0x3a85('0x3c')](function(_0x1a879f){logger['info'](_0x3a85('0x3d'),_0x301eba);_0x402b37[_0x3a85('0x33')]=_0x1a879f[_0x3a85('0x1f')][_0x3a85('0x33')];return rpc[_0x497874+_0x3a85('0x29')]['create'](_0x402b37);})[_0x3a85('0x3c')](function(_0x2f9d09){logger[_0x3a85('0x10')](_0x3a85('0x11'),_0x301eba,JSON[_0x3a85('0x3e')](_0x2f9d09));})[_0x3a85('0x3f')](function(_0x508edb){logger[_0x3a85('0x40')](_0x3a85('0x41'),_0x301eba,JSON[_0x3a85('0x3e')](_0x508edb));})['finally'](function(){Promise[_0x3a85('0x42')]()['then'](function(){if(_0x5b489c[0x0]!=='2'||_0xa46861[_0x3a85('0x17')])return;return rpc[_0x497874+_0x3a85('0x43')][_0x3a85('0x44')](_0xa46861['id'],{'autoreplyExecuted':!![]})[_0x3a85('0x3c')](function(_0x37f799){logger[_0x3a85('0x10')](_0x3a85('0x18'),_0x301eba,JSON[_0x3a85('0x3e')](_0x37f799));})[_0x3a85('0x3f')](function(_0x5290d4){logger['error'](_0x3a85('0x45'),_0x301eba,JSON['stringify'](_0x5290d4));});})[_0x3a85('0x3c')](function(){_0x4cb52a[_0x3a85('0x12')]();});});}else{return rpc[this['channel']+_0x3a85('0x29')][_0x3a85('0x46')](_0x402b37)['then'](function(_0x5e6ffd){logger['info'](_0x3a85('0x11'),_0x301eba,_0x402b37[_0x3a85('0xe')]);})[_0x3a85('0x3f')](function(_0x4a2970){logger[_0x3a85('0x40')](_0x3a85('0x11'),_0x301eba,JSON[_0x3a85('0x3e')](_0x4a2970));})['finally'](function(){Promise[_0x3a85('0x42')]()[_0x3a85('0x3c')](function(){if(_0x5b489c[0x0]!=='2'||_0xa46861[_0x3a85('0x17')])return;return rpc[_0x497874+_0x3a85('0x43')]['update'](_0xa46861['id'],{'autoreplyExecuted':!![]})[_0x3a85('0x3c')](function(_0x3659de){logger[_0x3a85('0x10')](_0x3a85('0x18'),_0x301eba,JSON['stringify'](_0x3659de));})[_0x3a85('0x3f')](function(_0x273485){logger[_0x3a85('0x40')](_0x3a85('0x45'),_0x301eba,JSON[_0x3a85('0x3e')](_0x273485));});})['then'](function(){_0x4cb52a[_0x3a85('0x12')]();});});}}}catch(_0x456c4c){logger['error'](_0x3a85('0x11'),_0x301eba,JSON[_0x3a85('0x3e')](_0x456c4c));_0x4cb52a[_0x3a85('0x47')]();}};}; \ No newline at end of file +var _0x9aed=['startsWith','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','inReplyTo','messageId','html','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','autoreplyExecuted','stop','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','body','getMustacheRender','message','from','channel','phone','read','subject'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9aed,0x15f));var _0xd9ae=function(_0xd2759e,_0x1164c5){_0xd2759e=_0xd2759e-0x0;var _0x25d92d=_0x9aed[_0xd2759e];return _0x25d92d;};'use strict';var _=require('lodash');var moment=require(_0xd9ae('0x0'));var utils=require(_0xd9ae('0x1'));var logger=require(_0xd9ae('0x2'))('routing');var rpc={'chatMessage':require(_0xd9ae('0x3')),'openchannelMessage':require(_0xd9ae('0x4')),'mailMessage':require(_0xd9ae('0x5')),'smsMessage':require(_0xd9ae('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xd9ae('0x7')),'chatInteraction':require(_0xd9ae('0x8')),'openchannelInteraction':require(_0xd9ae('0x9')),'mailInteraction':require(_0xd9ae('0xa')),'smsInteraction':require(_0xd9ae('0xb')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xd9ae('0xc'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0xb95007,_0x29029d,_0x5ed677,_0x40593c){return function(_0x5e1b33){try{var _0x3bf64e=this['channel'];if(_0x3bf64e===_0xd9ae('0xd')&&_0x40593c['body'][_0xd9ae('0xe')]){logger[_0xd9ae('0xf')](_0xd9ae('0x10'),_0xb95007,_0xd9ae('0x11'));return _0x5e1b33[_0xd9ae('0x12')]();}if(_0x29029d[0x0]==='1'&&(_[_0xd9ae('0x13')](this[_0xd9ae('0x14')][_0xd9ae('0x15')])||!this[_0xd9ae('0x14')]['created'])){logger[_0xd9ae('0xf')](_0xd9ae('0x10'),_0xb95007,'Autoreply\x20already\x20sent');return _0x5e1b33['next']();}if(_0x29029d[0x0]==='2'&&this[_0xd9ae('0x14')]['autoreplyExecuted']){logger[_0xd9ae('0xf')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xb95007,_0xd9ae('0x16'));return _0x5e1b33['next']();}var _0x29c2a9={'ContactId':this[_0xd9ae('0x17')]['id'],'sentAt':moment()[_0xd9ae('0x18')](_0xd9ae('0x19')),'direction':'out'};if(this['channel']===_0xd9ae('0xd')){_0x29c2a9[_0xd9ae('0x1a')]=utils[_0xd9ae('0x1b')](_0x29029d[0x2],this);}else{_0x29c2a9['body']=utils[_0xd9ae('0x1b')](_0x29029d[0x1],this);}if(this[_0xd9ae('0x1c')]){_0x29c2a9['to']=this[_0xd9ae('0x1c')][_0xd9ae('0x1d')]||'';if(this[_0xd9ae('0x1e')]===_0xd9ae('0xd')&&_0x29029d[0x1]==='1'){_0x29c2a9['cc']=this['message']['cc']||'';}_0x29c2a9[_0xd9ae('0x1d')]=this[_0xd9ae('0x1c')]['to']||'';_0x29c2a9[_0xd9ae('0x1f')]=this['message'][_0xd9ae('0x1f')]||'';_0x29c2a9[_0xd9ae('0x20')]=!![];if(this[_0xd9ae('0x1c')]['subject']){_0x29c2a9['subject']='';_0x29c2a9[_0xd9ae('0x21')]+=_[_0xd9ae('0x22')](this[_0xd9ae('0x1c')][_0xd9ae('0x21')],'Re:')?'':_0xd9ae('0x23');_0x29c2a9['subject']+=this['message']['subject'];}}if(this[_0xd9ae('0x1e')]===_0xd9ae('0x24')){_0x29c2a9[_0xd9ae('0x25')]=this['account']['id'];}else{_0x29c2a9[_[_0xd9ae('0x26')](this['channel'])+_0xd9ae('0x27')]=this[_0xd9ae('0x28')]['id'];}_0x29c2a9[_[_0xd9ae('0x26')](this[_0xd9ae('0x1e')])+_0xd9ae('0x29')]=this[_0xd9ae('0x14')]['id'];var _0x2b722a=this[_0xd9ae('0x14')];if(rpc[this['channel']+_0xd9ae('0x2a')]){if(this['channel']===_0xd9ae('0xd')){var _0x376dc4={'tls':{'rejectUnauthorized':![]}};if(this[_0xd9ae('0x28')][_0xd9ae('0x2b')][_0xd9ae('0x2c')]){_0x376dc4[_0xd9ae('0x2c')]=this[_0xd9ae('0x28')][_0xd9ae('0x2b')][_0xd9ae('0x2c')];}else{_0x376dc4[_0xd9ae('0x2d')]=this[_0xd9ae('0x28')][_0xd9ae('0x2b')][_0xd9ae('0x2d')];_0x376dc4[_0xd9ae('0x2e')]=this[_0xd9ae('0x28')]['Smtp']['port'];_0x376dc4[_0xd9ae('0x2f')]=this[_0xd9ae('0x28')][_0xd9ae('0x2b')][_0xd9ae('0x2f')];}if(this[_0xd9ae('0x28')][_0xd9ae('0x2b')][_0xd9ae('0x30')]){_0x376dc4[_0xd9ae('0x31')]={'user':this[_0xd9ae('0x28')][_0xd9ae('0x2b')][_0xd9ae('0x32')],'pass':this['account'][_0xd9ae('0x2b')]['pass']};}_0x29c2a9[_0xd9ae('0x33')]=this[_0xd9ae('0x1c')][_0xd9ae('0x34')];_0x29c2a9[_0xd9ae('0x35')]=''+_[_0xd9ae('0x36')](_0x29c2a9[_0xd9ae('0x1a')],_0xd9ae('0x37'),_0xd9ae('0x38'))+_0xd9ae('0x39');_0x29c2a9[_0xd9ae('0x3a')]={'Auto-Submitted':_0xd9ae('0x3b'),'X-Auto-Response-Suppress':_0xd9ae('0x3c'),'Precedence':_0xd9ae('0x3d')};return mailRpc[_0xd9ae('0x3e')](_0x376dc4,_0x29c2a9)[_0xd9ae('0x3f')](function(_0x4d7b6f){logger[_0xd9ae('0xf')](_0xd9ae('0x40'),_0xb95007);_0x29c2a9[_0xd9ae('0x34')]=_0x4d7b6f[_0xd9ae('0x1c')][_0xd9ae('0x34')];return rpc[_0x3bf64e+_0xd9ae('0x2a')][_0xd9ae('0x41')](_0x29c2a9);})[_0xd9ae('0x3f')](function(_0x2fb3bf){logger['info'](_0xd9ae('0x10'),_0xb95007,JSON[_0xd9ae('0x42')](_0x2fb3bf));})[_0xd9ae('0x43')](function(_0x7513bd){logger[_0xd9ae('0x44')](_0xd9ae('0x45'),_0xb95007,JSON[_0xd9ae('0x42')](_0x7513bd));})[_0xd9ae('0x46')](function(){Promise[_0xd9ae('0x47')]()[_0xd9ae('0x3f')](function(){if(_0x29029d[0x0]!=='2'||_0x2b722a['autoreplyExecuted'])return;return rpc[_0x3bf64e+'Interaction'][_0xd9ae('0x48')](_0x2b722a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x4a0145){logger[_0xd9ae('0xf')](_0xd9ae('0x49'),_0xb95007,JSON[_0xd9ae('0x42')](_0x4a0145));})['catch'](function(_0x26170d){logger[_0xd9ae('0x44')](_0xd9ae('0x4a'),_0xb95007,JSON[_0xd9ae('0x42')](_0x26170d));});})[_0xd9ae('0x3f')](function(){_0x5e1b33[_0xd9ae('0x12')]();});});}else{return rpc[this[_0xd9ae('0x1e')]+'Message'][_0xd9ae('0x41')](_0x29c2a9)[_0xd9ae('0x3f')](function(_0x143143){logger[_0xd9ae('0xf')]('[%s][AUTOREPLY]\x20%s',_0xb95007,_0x29c2a9['body']);})[_0xd9ae('0x43')](function(_0x7b0f16){logger['error'](_0xd9ae('0x10'),_0xb95007,JSON[_0xd9ae('0x42')](_0x7b0f16));})[_0xd9ae('0x46')](function(){Promise[_0xd9ae('0x47')]()[_0xd9ae('0x3f')](function(){if(_0x29029d[0x0]!=='2'||_0x2b722a[_0xd9ae('0x4b')])return;return rpc[_0x3bf64e+'Interaction']['update'](_0x2b722a['id'],{'autoreplyExecuted':!![]})[_0xd9ae('0x3f')](function(_0x4baa26){logger['info'](_0xd9ae('0x49'),_0xb95007,JSON['stringify'](_0x4baa26));})[_0xd9ae('0x43')](function(_0x494bab){logger['error'](_0xd9ae('0x4a'),_0xb95007,JSON[_0xd9ae('0x42')](_0x494bab));});})[_0xd9ae('0x3f')](function(){_0x5e1b33[_0xd9ae('0x12')]();});});}}}catch(_0x21f1ab){logger['error']('[%s][AUTOREPLY]\x20%s',_0xb95007,JSON['stringify'](_0x21f1ab));_0x5e1b33[_0xd9ae('0x4c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index cbc9238..f6cb7c0 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 _0xf202=['routing','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger'];(function(_0x49d68d,_0x2c7d95){var _0x4ea875=function(_0x23b594){while(--_0x23b594){_0x49d68d['push'](_0x49d68d['shift']());}};_0x4ea875(++_0x2c7d95);}(_0xf202,0xa6));var _0x2f20=function(_0x2b75d0,_0x27d343){_0x2b75d0=_0x2b75d0-0x0;var _0x11fe00=_0xf202[_0x2b75d0];return _0x11fe00;};'use strict';var moment=require(_0x2f20('0x0'));var logger=require(_0x2f20('0x1'))(_0x2f20('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x2f20('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x2f20('0x4')),'whatsappInteraction':require(_0x2f20('0x5'))};exports['consequence']=function(_0x4d330e,_0x2615f3,_0x5ede41,_0x143bcb){return function(_0x28e100){try{logger[_0x2f20('0x6')](_0x2f20('0x7'),_0x4d330e,_0x2615f3[0x0]);var _0x1d1074={'closed':0x1,'closedAt':moment()[_0x2f20('0x8')](_0x2f20('0x9')),'closeReason':_0x2f20('0xa'),'disposition':_0x2615f3[0x0]};if(rpc[_0x143bcb[_0x2f20('0xb')]+_0x2f20('0xc')]){rpc[_0x143bcb[_0x2f20('0xb')]+_0x2f20('0xc')][_0x2f20('0xd')](_0x143bcb[_0x2f20('0xe')]['id'],_0x1d1074)['then'](function(_0x1e369f){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x4d330e,_0x143bcb[_0x2f20('0xe')]['id']);})[_0x2f20('0xf')](function(_0x8772ff){logger[_0x2f20('0x10')](_0x2f20('0x11'),_0x4d330e,JSON[_0x2f20('0x12')](_0x8772ff));})[_0x2f20('0x13')](function(){_0x28e100[_0x2f20('0x14')]();});}}catch(_0x294465){logger['error'](_0x2f20('0x11'),_0x4d330e,JSON[_0x2f20('0x12')](_0x294465));_0x28e100[_0x2f20('0x14')]();}};}; \ No newline at end of file +var _0x9957=['error','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','Interaction','channel','update','interaction','catch','[%s][CLOSE]\x20%s','stringify','finally'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x9957,0xc2));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var moment=require(_0x7995('0x0'));var logger=require(_0x7995('0x1'))(_0x7995('0x2'));var rpc={'chatInteraction':require(_0x7995('0x3')),'openchannelInteraction':require(_0x7995('0x4')),'smsInteraction':require(_0x7995('0x5')),'mailInteraction':require(_0x7995('0x6')),'faxInteraction':require(_0x7995('0x7')),'whatsappInteraction':require(_0x7995('0x8'))};exports[_0x7995('0x9')]=function(_0x440aea,_0x319c81,_0x20d806,_0x48c1ce){return function(_0x53fefc){try{logger[_0x7995('0xa')](_0x7995('0xb'),_0x440aea,_0x319c81[0x0]);var _0x2c5e82={'closed':0x1,'closedAt':moment()[_0x7995('0xc')](_0x7995('0xd')),'closeReason':'system','disposition':_0x319c81[0x0]};if(rpc[_0x48c1ce['channel']+_0x7995('0xe')]){rpc[_0x48c1ce[_0x7995('0xf')]+'Interaction'][_0x7995('0x10')](_0x48c1ce[_0x7995('0x11')]['id'],_0x2c5e82)['then'](function(_0x18620a){logger[_0x7995('0xa')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x440aea,_0x48c1ce[_0x7995('0x11')]['id']);})[_0x7995('0x12')](function(_0x5ca744){logger['error'](_0x7995('0x13'),_0x440aea,JSON[_0x7995('0x14')](_0x5ca744));})[_0x7995('0x15')](function(){_0x53fefc['stop']();});}}catch(_0x466c70){logger[_0x7995('0x16')]('[%s][CLOSE]\x20%s',_0x440aea,JSON[_0x7995('0x14')](_0x466c70));_0x53fefc[_0x7995('0x17')]();}};}; \ 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 4c488a2..47ed408 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 _0x21b7=['./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','upperFirst','AccountId','account','InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','create','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result','fulfillment','speech','providerResponse','then','metadata','md5'];(function(_0x393d99,_0x38f9f0){var _0x59d758=function(_0x367eba){while(--_0x367eba){_0x393d99['push'](_0x393d99['shift']());}};_0x59d758(++_0x38f9f0);}(_0x21b7,0xef));var _0x721b=function(_0x8cef09,_0x1b147f){_0x8cef09=_0x8cef09-0x0;var _0x31048a=_0x21b7[_0x8cef09];return _0x31048a;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0x721b('0x0'));var utils=require(_0x721b('0x1'));var logger=require(_0x721b('0x2'))(_0x721b('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x721b('0x4')),'smsMessage':require(_0x721b('0x5')),'faxMessage':require(_0x721b('0x6')),'whatsappMessage':require(_0x721b('0x7'))};exports[_0x721b('0x8')]=function(_0x470ee0,_0x5aeb49){return function(_0x45ca24){try{if(!_[_0x721b('0x9')](this['interaction']['UserId'])){logger[_0x721b('0xa')](_0x721b('0xb'),_0x470ee0,_0x721b('0xc'));return _0x45ca24[_0x721b('0xd')]();}var _0xfcc6d7={'ContactId':this['contact']['id'],'sentAt':moment()[_0x721b('0xe')](_0x721b('0xf')),'direction':_0x721b('0x10')};if(this[_0x721b('0x11')]===_0x721b('0x12')||this[_0x721b('0x11')]===_0x721b('0x13')){_0xfcc6d7['phone']=this['interaction'][_0x721b('0x14')];}var _0x4b2e46=this[_0x721b('0x11')];if(_0x4b2e46===_0x721b('0x15')){_0xfcc6d7['ChatWebsiteId']=this['account']['id'];}else{_0xfcc6d7[_[_0x721b('0x16')](_0x4b2e46)+_0x721b('0x17')]=this[_0x721b('0x18')]['id'];}_0xfcc6d7[_[_0x721b('0x16')](_0x4b2e46)+_0x721b('0x19')]=this[_0x721b('0x1a')]['id'];if(this[_0x721b('0x1a')][_0x721b('0x1b')]){var _0x3b9ca0=_0x5aeb49[0x2];if(!_[_0x721b('0x1c')](_0x3b9ca0)){_0xfcc6d7[_0x721b('0x1d')]=utils[_0x721b('0x1e')](_0x3b9ca0,this);return rpc[_0x4b2e46+_0x721b('0x1f')][_0x721b('0x20')](_0xfcc6d7)['then'](function(_0x81745a){logger[_0x721b('0xa')](_0x721b('0xb'),_0x470ee0,_0xfcc6d7[_0x721b('0x1d')]);})[_0x721b('0x21')](function(_0x863f94){logger[_0x721b('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x470ee0,JSON[_0x721b('0x23')](_0x863f94));})[_0x721b('0x24')](function(){logger[_0x721b('0xa')](_0x721b('0x25'),_0x470ee0);_0x45ca24[_0x721b('0x26')]();});}else{logger[_0x721b('0xa')](_0x721b('0x27'),_0x470ee0);_0x45ca24[_0x721b('0x26')]();}}else{var _0x220c77=this;var _0x1f7148=apiai(_0x5aeb49[0x0],{'language':_0x5aeb49[0x1]||'en'});return _0x1f7148['textRequest'](this[_0x721b('0x28')][_0x721b('0x1d')],{'sessionId':md5(this[_0x721b('0x1a')]['id'])})['then'](function(_0x544bf7){_0x220c77[_0x721b('0x1d')][_0x721b('0x29')]=_0x544bf7;_0xfcc6d7[_0x721b('0x1d')]=_0x544bf7[_0x721b('0x2a')][_0x721b('0x2b')][_0x721b('0x2c')];_0xfcc6d7['providerName']=_0x721b('0x29');_0xfcc6d7[_0x721b('0x2d')]=JSON['stringify'](_0x544bf7);return rpc[_0x4b2e46+_0x721b('0x1f')][_0x721b('0x20')](_0xfcc6d7)[_0x721b('0x2e')](function(_0x4ff174){logger[_0x721b('0xa')]('[%s][DIALOGFLOW]\x20%s',_0x470ee0,_0xfcc6d7[_0x721b('0x1d')]);if(_0x544bf7[_0x721b('0x2a')][_0x721b('0x2f')]['endConversation']){_0x45ca24[_0x721b('0xd')]();}else{_0x45ca24[_0x721b('0x26')]();}})[_0x721b('0x21')](function(_0x564041){logger[_0x721b('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x470ee0,JSON[_0x721b('0x23')](_0x564041));_0x45ca24[_0x721b('0xd')]();});})['catch'](function(_0x7451ad){logger[_0x721b('0x22')](_0x721b('0xb'),_0x470ee0,_0x7451ad['message']);_0x45ca24[_0x721b('0xd')]();});}}catch(_0x2d8a67){logger[_0x721b('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x470ee0,JSON[_0x721b('0x23')](_0x2d8a67));_0x45ca24[_0x721b('0x26')]();}};}; \ No newline at end of file +var _0x5d58=['info','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','create','then'];(function(_0x3bbf07,_0x351af1){var _0x1a5fbd=function(_0x645eef){while(--_0x645eef){_0x3bbf07['push'](_0x3bbf07['shift']());}};_0x1a5fbd(++_0x351af1);}(_0x5d58,0x187));var _0x85d5=function(_0xd7d733,_0x5e397d){_0xd7d733=_0xd7d733-0x0;var _0x465669=_0x5d58[_0xd7d733];return _0x465669;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require('apiai-promise');var md5=require('md5');var utils=require('./utils');var logger=require(_0x85d5('0x0'))(_0x85d5('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x85d5('0x2')),'mailMessage':require(_0x85d5('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x85d5('0x4')),'whatsappMessage':require(_0x85d5('0x5'))};exports[_0x85d5('0x6')]=function(_0x46e7b4,_0x5f47ec){return function(_0x98c963){try{if(!_[_0x85d5('0x7')](this['interaction'][_0x85d5('0x8')])){logger['info'](_0x85d5('0x9'),_0x46e7b4,_0x85d5('0xa'));return _0x98c963[_0x85d5('0xb')]();}var _0x488dcb={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x85d5('0xc')),'direction':_0x85d5('0xd')};if(this[_0x85d5('0xe')]===_0x85d5('0xf')||this[_0x85d5('0xe')]===_0x85d5('0x10')){_0x488dcb[_0x85d5('0x11')]=this['interaction']['phone'];}var _0x4869ca=this[_0x85d5('0xe')];if(_0x4869ca===_0x85d5('0x12')){_0x488dcb[_0x85d5('0x13')]=this[_0x85d5('0x14')]['id'];}else{_0x488dcb[_[_0x85d5('0x15')](_0x4869ca)+_0x85d5('0x16')]=this[_0x85d5('0x14')]['id'];}_0x488dcb[_['upperFirst'](_0x4869ca)+_0x85d5('0x17')]=this[_0x85d5('0x18')]['id'];if(this[_0x85d5('0x18')][_0x85d5('0x19')]){var _0x19f7d5=_0x5f47ec[0x2];if(!_[_0x85d5('0x1a')](_0x19f7d5)){_0x488dcb[_0x85d5('0x1b')]=utils[_0x85d5('0x1c')](_0x19f7d5,this);return rpc[_0x4869ca+_0x85d5('0x1d')][_0x85d5('0x1e')](_0x488dcb)[_0x85d5('0x1f')](function(_0x432bd6){logger[_0x85d5('0x20')](_0x85d5('0x9'),_0x46e7b4,_0x488dcb[_0x85d5('0x1b')]);})[_0x85d5('0x21')](function(_0x54e991){logger[_0x85d5('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x46e7b4,JSON[_0x85d5('0x23')](_0x54e991));})[_0x85d5('0x24')](function(){logger['info'](_0x85d5('0x25'),_0x46e7b4);_0x98c963[_0x85d5('0x26')]();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x46e7b4);_0x98c963[_0x85d5('0x26')]();}}else{var _0x5a1b9a=this;var _0x2f2bae=apiai(_0x5f47ec[0x0],{'language':_0x5f47ec[0x1]||'en'});return _0x2f2bae['textRequest'](this[_0x85d5('0x27')][_0x85d5('0x1b')],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0x4da71b){_0x5a1b9a['body'][_0x85d5('0x28')]=_0x4da71b;_0x488dcb[_0x85d5('0x1b')]=_0x4da71b[_0x85d5('0x29')][_0x85d5('0x2a')][_0x85d5('0x2b')];_0x488dcb[_0x85d5('0x2c')]='dialogflow';_0x488dcb[_0x85d5('0x2d')]=JSON['stringify'](_0x4da71b);return rpc[_0x4869ca+_0x85d5('0x1d')][_0x85d5('0x1e')](_0x488dcb)[_0x85d5('0x1f')](function(_0x5cc2cf){logger[_0x85d5('0x20')](_0x85d5('0x9'),_0x46e7b4,_0x488dcb[_0x85d5('0x1b')]);if(_0x4da71b[_0x85d5('0x29')][_0x85d5('0x2e')]['endConversation']){_0x98c963[_0x85d5('0xb')]();}else{_0x98c963[_0x85d5('0x26')]();}})[_0x85d5('0x21')](function(_0x22a961){logger[_0x85d5('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x46e7b4,JSON['stringify'](_0x22a961));_0x98c963[_0x85d5('0xb')]();});})[_0x85d5('0x21')](function(_0x2d1157){logger[_0x85d5('0x22')](_0x85d5('0x9'),_0x46e7b4,_0x2d1157['message']);_0x98c963[_0x85d5('0xb')]();});}}catch(_0x214908){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x46e7b4,JSON[_0x85d5('0x23')](_0x214908));_0x98c963[_0x85d5('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 397e100..0467788 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 _0x56f3=['providerName','providerResponse','fulfillmentText','dialogflow','md5','moment','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','chat','account','upperFirst','InteractionId','created','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','length','dialogflowV2','diagnosticInfo','queryResult','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','languageCode','queryText'];(function(_0x8a2ec9,_0x2cc677){var _0x3cc671=function(_0x379a14){while(--_0x379a14){_0x8a2ec9['push'](_0x8a2ec9['shift']());}};_0x3cc671(++_0x2cc677);}(_0x56f3,0x87));var _0x356f=function(_0x2e373b,_0x44da0c){_0x2e373b=_0x2e373b-0x0;var _0x451616=_0x56f3[_0x2e373b];return _0x451616;};'use strict';var _=require('lodash');var dialogflow=require(_0x356f('0x0'));var md5=require(_0x356f('0x1'));var moment=require(_0x356f('0x2'));var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0x356f('0x3'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x356f('0x4')),'mailMessage':require(_0x356f('0x5')),'smsMessage':require(_0x356f('0x6')),'faxMessage':require(_0x356f('0x7')),'whatsappMessage':require(_0x356f('0x8'))};function createMessage(_0x243462,_0x518be8,_0xbeafcd,_0x127551){return new Promise(function(_0x211024,_0x40bd5c){var _0x5383fc=_[_0x356f('0x9')](_0xbeafcd);_0x5383fc[_0x356f('0xa')]=_0x127551;return rpc[_0x518be8+_0x356f('0xb')][_0x356f('0xc')](_0x5383fc)[_0x356f('0xd')](function(){logger[_0x356f('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x243462,_0x5383fc[_0x356f('0xa')]);_0x211024();})[_0x356f('0xf')](function(_0x29ce26){logger[_0x356f('0x10')](_0x356f('0x11'),_0x243462,JSON[_0x356f('0x12')](_0x29ce26));_0x40bd5c(_0x29ce26);});});}exports['consequence']=function(_0x274e1f,_0x8d1de9){return function(_0x5ac99b){try{if(!_[_0x356f('0x13')](this[_0x356f('0x14')][_0x356f('0x15')])){logger['info'](_0x356f('0x11'),_0x274e1f,_0x356f('0x16'));return _0x5ac99b[_0x356f('0x17')]();}var _0x3e7ead={'ContactId':this['contact']['id'],'sentAt':moment()[_0x356f('0x18')](_0x356f('0x19')),'direction':_0x356f('0x1a')};if(this['channel']===_0x356f('0x1b')||this[_0x356f('0x1c')]==='whatsapp'){_0x3e7ead[_0x356f('0x1d')]=this['interaction']['phone'];}var _0x3f44a6=this['channel'];if(_0x3f44a6===_0x356f('0x1e')){_0x3e7ead['ChatWebsiteId']=this[_0x356f('0x1f')]['id'];}else{_0x3e7ead[_[_0x356f('0x20')](_0x3f44a6)+'AccountId']=this[_0x356f('0x1f')]['id'];}_0x3e7ead[_[_0x356f('0x20')](_0x3f44a6)+_0x356f('0x21')]=this[_0x356f('0x14')]['id'];if(this['interaction'][_0x356f('0x22')]){var _0x17f513=_0x8d1de9[0x4];if(!_['isEmpty'](_0x17f513)){_0x3e7ead['body']=utils[_0x356f('0x23')](_0x17f513,this);return rpc[_0x3f44a6+_0x356f('0xb')][_0x356f('0xc')](_0x3e7ead)[_0x356f('0xd')](function(_0x5cc633){logger['info'](_0x356f('0x11'),_0x274e1f,_0x3e7ead[_0x356f('0xa')]);})[_0x356f('0xf')](function(_0x88534){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x274e1f,JSON[_0x356f('0x12')](_0x88534));})[_0x356f('0x24')](function(){logger[_0x356f('0xe')](_0x356f('0x25'),_0x274e1f);_0x5ac99b[_0x356f('0x26')]();});}else{logger[_0x356f('0xe')](_0x356f('0x27'),_0x274e1f);_0x5ac99b[_0x356f('0x26')]();}}else{var _0x20ce31=this;var _0xc18fc2=_0x8d1de9[0x2][_0x356f('0x28')](/\\n/g,'\x0a');var _0x41ea17={'credentials':{'private_key':_0xc18fc2,'client_email':_0x8d1de9[0x1]}};var _0x56219e=new dialogflow[(_0x356f('0x29'))](_0x41ea17);var _0x4f840a=_0x56219e[_0x356f('0x2a')](_0x8d1de9[0x0],md5(_0x20ce31[_0x356f('0x14')]['id']));var _0x3acda7={'session':_0x4f840a,'queryInput':{'text':{'text':_0x20ce31[_0x356f('0x2b')][_0x356f('0xa')],'languageCode':_0x8d1de9[0x3]||'en'}}};return _0x56219e['detectIntent'](_0x3acda7)['then'](function(_0x11549e){if(_0x11549e&&_0x11549e[_0x356f('0x2c')]){_0x20ce31[_0x356f('0xa')][_0x356f('0x2d')]=_0x11549e;var _0x2d9f20=_0x11549e[0x0];var _0xa1e365=_0x2d9f20['queryResult'][_0x356f('0x2e')]&&_0x2d9f20[_0x356f('0x2f')][_0x356f('0x2e')][_0x356f('0x30')]?_0x2d9f20[_0x356f('0x2f')][_0x356f('0x2e')][_0x356f('0x30')]['end_conversation'][_0x356f('0x31')]:![];_0x20ce31[_0x356f('0xa')][_0x356f('0x32')]=_0x2d9f20[_0x356f('0x2f')][_0x356f('0x33')];_0x20ce31[_0x356f('0xa')][_0x356f('0x34')]=_0x2d9f20[_0x356f('0x2f')][_0x356f('0x35')];_0x20ce31[_0x356f('0xa')][_0x356f('0x36')]=_0x2d9f20['queryResult'][_0x356f('0x2e')]&&_0x2d9f20[_0x356f('0x2f')][_0x356f('0x2e')][_0x356f('0x30')]?_0x2d9f20['queryResult'][_0x356f('0x2e')]['fields'][_0x356f('0x37')]['boolValue']:![];_0x20ce31[_0x356f('0xa')][_0x356f('0x38')]=_0x2d9f20[_0x356f('0x2f')][_0x356f('0x39')][_0x356f('0x3a')];_0x20ce31[_0x356f('0xa')][_0x356f('0x3b')]=_0x2d9f20[_0x356f('0x2f')][_0x356f('0x39')]['displayName'];_0x20ce31['body'][_0x356f('0x3c')]=_0x2d9f20[_0x356f('0x2f')]['intent']['isFallback'];_0x20ce31[_0x356f('0xa')]['DIALOGFLOWV2_LANGUAGECODE']=_0x2d9f20[_0x356f('0x2f')][_0x356f('0x3d')];_0x20ce31[_0x356f('0xa')]['DIALOGFLOWV2_QUERYTEXT']=_0x2d9f20['queryResult'][_0x356f('0x3e')];_0x20ce31['body']['DIALOGFLOWV2_SCORE']=_0x2d9f20['queryResult']['intentDetectionConfidence'];_0x3e7ead[_0x356f('0x3f')]=_0x356f('0x2d');_0x3e7ead[_0x356f('0x40')]=JSON[_0x356f('0x12')](_0x11549e);var _0x32898a=[];for(var _0x4bdd07=0x0;_0x4bdd07<_0x11549e[_0x356f('0x2c')];_0x4bdd07++){var _0x22fc57=_0x11549e[_0x4bdd07];if(_0x22fc57&&_0x22fc57[_0x356f('0x2f')]&&_0x22fc57[_0x356f('0x2f')][_0x356f('0x41')]){_0x32898a['push'](createMessage(_0x274e1f,_0x3f44a6,_0x3e7ead,_0x22fc57[_0x356f('0x2f')][_0x356f('0x41')]));}}return Promise['all'](_0x32898a)[_0x356f('0xd')](function(){if(_0xa1e365){_0x5ac99b[_0x356f('0x17')]();}else{_0x5ac99b[_0x356f('0x26')]();}})[_0x356f('0xf')](function(_0x4cc4cf){logger[_0x356f('0x10')](_0x356f('0x11'),_0x274e1f,JSON[_0x356f('0x12')](_0x4cc4cf));_0x5ac99b[_0x356f('0x17')]();});}})[_0x356f('0xf')](function(_0x2cd6d1){logger[_0x356f('0x10')](_0x356f('0x11'),_0x274e1f,_0x2cd6d1[_0x356f('0x2b')]);_0x5ac99b['next']();});}}catch(_0x382d66){logger[_0x356f('0x10')](_0x356f('0x11'),_0x274e1f,JSON['stringify'](_0x382d66));_0x5ac99b[_0x356f('0x26')]();}};}; \ No newline at end of file +var _0x2036=['body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','length','fulfillmentText','push','all','lodash','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone'];(function(_0x4c0a46,_0x492136){var _0x1456ba=function(_0x526316){while(--_0x526316){_0x4c0a46['push'](_0x4c0a46['shift']());}};_0x1456ba(++_0x492136);}(_0x2036,0x11e));var _0x6203=function(_0x46b295,_0x554b00){_0x46b295=_0x46b295-0x0;var _0x1c4c10=_0x2036[_0x46b295];return _0x1c4c10;};'use strict';var _=require(_0x6203('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x6203('0x1'));var moment=require(_0x6203('0x2'));var Promise=require(_0x6203('0x3'));var logger=require(_0x6203('0x4'))(_0x6203('0x5'));var utils=require(_0x6203('0x6'));var rpc={'chatMessage':require(_0x6203('0x7')),'openchannelMessage':require(_0x6203('0x8')),'mailMessage':require(_0x6203('0x9')),'smsMessage':require(_0x6203('0xa')),'faxMessage':require(_0x6203('0xb')),'whatsappMessage':require(_0x6203('0xc'))};function createMessage(_0xa8cb6b,_0x4b3786,_0x3ba51c,_0x2c4163){return new Promise(function(_0x2ad0ce,_0x649c7a){var _0x4430b5=_[_0x6203('0xd')](_0x3ba51c);_0x4430b5[_0x6203('0xe')]=_0x2c4163;return rpc[_0x4b3786+_0x6203('0xf')]['create'](_0x4430b5)[_0x6203('0x10')](function(){logger[_0x6203('0x11')](_0x6203('0x12'),_0xa8cb6b,_0x4430b5['body']);_0x2ad0ce();})['catch'](function(_0x5229b8){logger[_0x6203('0x13')](_0x6203('0x12'),_0xa8cb6b,JSON[_0x6203('0x14')](_0x5229b8));_0x649c7a(_0x5229b8);});});}exports[_0x6203('0x15')]=function(_0x50c5aa,_0x413309){return function(_0x3e57e0){try{if(!_['isNil'](this[_0x6203('0x16')]['UserId'])){logger[_0x6203('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x50c5aa,_0x6203('0x17'));return _0x3e57e0[_0x6203('0x18')]();}var _0x349722={'ContactId':this[_0x6203('0x19')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6203('0x1a')};if(this[_0x6203('0x1b')]===_0x6203('0x1c')||this[_0x6203('0x1b')]===_0x6203('0x1d')){_0x349722[_0x6203('0x1e')]=this[_0x6203('0x16')][_0x6203('0x1e')];}var _0x1b645d=this[_0x6203('0x1b')];if(_0x1b645d===_0x6203('0x1f')){_0x349722[_0x6203('0x20')]=this['account']['id'];}else{_0x349722[_['upperFirst'](_0x1b645d)+_0x6203('0x21')]=this[_0x6203('0x22')]['id'];}_0x349722[_[_0x6203('0x23')](_0x1b645d)+_0x6203('0x24')]=this[_0x6203('0x16')]['id'];if(this[_0x6203('0x16')][_0x6203('0x25')]){var _0x298722=_0x413309[0x4];if(!_[_0x6203('0x26')](_0x298722)){_0x349722[_0x6203('0xe')]=utils[_0x6203('0x27')](_0x298722,this);return rpc[_0x1b645d+_0x6203('0xf')]['create'](_0x349722)['then'](function(_0x46c5c0){logger[_0x6203('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x50c5aa,_0x349722[_0x6203('0xe')]);})[_0x6203('0x28')](function(_0x1ad9c1){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x50c5aa,JSON['stringify'](_0x1ad9c1));})[_0x6203('0x29')](function(){logger[_0x6203('0x11')](_0x6203('0x2a'),_0x50c5aa);_0x3e57e0[_0x6203('0x2b')]();});}else{logger[_0x6203('0x11')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x50c5aa);_0x3e57e0[_0x6203('0x2b')]();}}else{var _0x101f5d=this;var _0x2d3ff1=_0x413309[0x2][_0x6203('0x2c')](/\\n/g,'\x0a');var _0x367fb9={'credentials':{'private_key':_0x2d3ff1,'client_email':_0x413309[0x1]}};var _0x5a15fb=new dialogflow[(_0x6203('0x2d'))](_0x367fb9);var _0x52c420=_0x5a15fb[_0x6203('0x2e')](_0x413309[0x0],md5(_0x101f5d[_0x6203('0x16')]['id']));var _0x18bca8={'session':_0x52c420,'queryInput':{'text':{'text':_0x101f5d['message'][_0x6203('0xe')],'languageCode':_0x413309[0x3]||'en'}}};return _0x5a15fb[_0x6203('0x2f')](_0x18bca8)['then'](function(_0x590c78){if(_0x590c78&&_0x590c78['length']){_0x101f5d[_0x6203('0xe')][_0x6203('0x30')]=_0x590c78;var _0x1a36ba=_0x590c78[0x0];var _0x22db85=_0x1a36ba[_0x6203('0x31')][_0x6203('0x32')]&&_0x1a36ba[_0x6203('0x31')][_0x6203('0x32')][_0x6203('0x33')]?_0x1a36ba[_0x6203('0x31')][_0x6203('0x32')][_0x6203('0x33')][_0x6203('0x34')][_0x6203('0x35')]:![];_0x101f5d[_0x6203('0xe')][_0x6203('0x36')]=_0x1a36ba[_0x6203('0x31')]['action'];_0x101f5d[_0x6203('0xe')][_0x6203('0x37')]=_0x1a36ba[_0x6203('0x31')][_0x6203('0x38')];_0x101f5d[_0x6203('0xe')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x1a36ba[_0x6203('0x31')]['diagnosticInfo']&&_0x1a36ba[_0x6203('0x31')][_0x6203('0x32')]['fields']?_0x1a36ba[_0x6203('0x31')][_0x6203('0x32')]['fields']['end_conversation'][_0x6203('0x35')]:![];_0x101f5d[_0x6203('0xe')][_0x6203('0x39')]=_0x1a36ba['queryResult'][_0x6203('0x3a')][_0x6203('0x3b')];_0x101f5d[_0x6203('0xe')][_0x6203('0x3c')]=_0x1a36ba[_0x6203('0x31')][_0x6203('0x3a')][_0x6203('0x3d')];_0x101f5d[_0x6203('0xe')][_0x6203('0x3e')]=_0x1a36ba['queryResult'][_0x6203('0x3a')][_0x6203('0x3f')];_0x101f5d[_0x6203('0xe')][_0x6203('0x40')]=_0x1a36ba[_0x6203('0x31')][_0x6203('0x41')];_0x101f5d['body']['DIALOGFLOWV2_QUERYTEXT']=_0x1a36ba[_0x6203('0x31')][_0x6203('0x42')];_0x101f5d['body'][_0x6203('0x43')]=_0x1a36ba[_0x6203('0x31')][_0x6203('0x44')];_0x349722[_0x6203('0x45')]='dialogflowV2';_0x349722[_0x6203('0x46')]=JSON[_0x6203('0x14')](_0x590c78);var _0x233b35=[];for(var _0x362bb7=0x0;_0x362bb7<_0x590c78[_0x6203('0x47')];_0x362bb7++){var _0x3bb143=_0x590c78[_0x362bb7];if(_0x3bb143&&_0x3bb143[_0x6203('0x31')]&&_0x3bb143['queryResult'][_0x6203('0x48')]){_0x233b35[_0x6203('0x49')](createMessage(_0x50c5aa,_0x1b645d,_0x349722,_0x3bb143[_0x6203('0x31')][_0x6203('0x48')]));}}return Promise[_0x6203('0x4a')](_0x233b35)[_0x6203('0x10')](function(){if(_0x22db85){_0x3e57e0['next']();}else{_0x3e57e0[_0x6203('0x2b')]();}})[_0x6203('0x28')](function(_0x741903){logger[_0x6203('0x13')](_0x6203('0x12'),_0x50c5aa,JSON['stringify'](_0x741903));_0x3e57e0[_0x6203('0x18')]();});}})['catch'](function(_0xb34927){logger[_0x6203('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x50c5aa,_0xb34927['message']);_0x3e57e0[_0x6203('0x18')]();});}}catch(_0x4c1387){logger[_0x6203('0x13')](_0x6203('0x12'),_0x50c5aa,JSON[_0x6203('0x14')](_0x4c1387));_0x3e57e0[_0x6203('0x2b')]();}};}; \ 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 6288331..35a9a8d 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 _0xf2f8=['string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','info','next','findIndex','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','../../../../config/logger','routing'];(function(_0x49ad79,_0x48ee93){var _0xa4e38a=function(_0x4925c7){while(--_0x4925c7){_0x49ad79['push'](_0x49ad79['shift']());}};_0xa4e38a(++_0x48ee93);}(_0xf2f8,0x126));var _0x8f2f=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xf2f8[_0x1beef3];return _0x5af964;};'use strict';var schema=require(_0x8f2f('0x0'));var _=require(_0x8f2f('0x1'));var htmlToText=require(_0x8f2f('0x2'));var utils=require('./utils');var logger=require(_0x8f2f('0x3'))(_0x8f2f('0x4'));var gotoif=schema({'condition':{'type':_0x8f2f('0x5'),'required':!![],'message':_0x8f2f('0x6')},'priorityTrue':{'type':'number','message':_0x8f2f('0x7')},'priorityFalse':{'type':'number','message':_0x8f2f('0x8')}});exports[_0x8f2f('0x9')]=function(_0x5064c9,_0x102710){return function(_0x57a3a0){try{var _0x3a9314={'condition':htmlToText[_0x8f2f('0xa')](utils['getMustacheRender'](_0x102710[0x0],this),{'wordwrap':![]})[_0x8f2f('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x102710[0x1],'priorityFalse':_0x102710[0x2]};var _0x520037=gotoif[_0x8f2f('0x0')](_0x3a9314,{'typecast':!![]});if(_0x520037['length']){logger[_0x8f2f('0xc')](_0x8f2f('0xd'),_0x5064c9,_[_0x8f2f('0xe')](_0x520037,_0x8f2f('0xf'))[_0x8f2f('0x10')](',\x20'));_0x57a3a0[_0x8f2f('0x11')]();}else{try{var _0x58cbaf=eval('('+_0x3a9314[_0x8f2f('0x12')]+')');var _0x36f6b9=_0x58cbaf?_0x3a9314['priorityTrue']:_0x3a9314['priorityFalse'];logger[_0x8f2f('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x5064c9,_0x3a9314[_0x8f2f('0x12')],_0x58cbaf,_0x36f6b9||_0x8f2f('0x14'));if(_0x36f6b9){var _0x31e0e2=_[_0x8f2f('0x15')](_0x57a3a0['rules'](),{'p':_0x36f6b9});if(_0x31e0e2>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x5064c9,_0x36f6b9||_0x8f2f('0x14'),_0x31e0e2);_0x57a3a0[_0x8f2f('0x14')](_0x31e0e2);}else{logger[_0x8f2f('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x5064c9,_0x36f6b9||_0x8f2f('0x14'));_0x57a3a0[_0x8f2f('0x11')]();}}else{_0x57a3a0[_0x8f2f('0x14')]();}}catch(_0x3fcdc6){logger[_0x8f2f('0xc')](_0x8f2f('0x16'),_0x5064c9,_0x3fcdc6['message']);_0x57a3a0[_0x8f2f('0x11')]();}}}catch(_0x214a17){logger[_0x8f2f('0xc')]('[%s][GOTOIF]\x20%s',_0x5064c9,JSON['stringify'](_0x214a17));_0x57a3a0[_0x8f2f('0x11')]();}};}; \ No newline at end of file +var _0x490a=['lodash','./utils','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','length','[%s][GOTOIF]\x20%s','message','join','stop','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','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate'];(function(_0x287eca,_0x377574){var _0x493275=function(_0x306290){while(--_0x306290){_0x287eca['push'](_0x287eca['shift']());}};_0x493275(++_0x377574);}(_0x490a,0x6b));var _0xa490=function(_0x3969b4,_0x14325e){_0x3969b4=_0x3969b4-0x0;var _0x4b1a77=_0x490a[_0x3969b4];return _0x4b1a77;};'use strict';var schema=require(_0xa490('0x0'));var _=require(_0xa490('0x1'));var htmlToText=require('html-to-text');var utils=require(_0xa490('0x2'));var logger=require('../../../../config/logger')(_0xa490('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xa490('0x4')},'priorityTrue':{'type':_0xa490('0x5'),'message':_0xa490('0x6')},'priorityFalse':{'type':_0xa490('0x5'),'message':_0xa490('0x7')}});exports[_0xa490('0x8')]=function(_0x3521b0,_0x312bc2){return function(_0x4b9368){try{var _0x2b6fde={'condition':htmlToText[_0xa490('0x9')](utils['getMustacheRender'](_0x312bc2[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x312bc2[0x1],'priorityFalse':_0x312bc2[0x2]};var _0x318bc2=gotoif['validate'](_0x2b6fde,{'typecast':!![]});if(_0x318bc2[_0xa490('0xa')]){logger['error'](_0xa490('0xb'),_0x3521b0,_['map'](_0x318bc2,_0xa490('0xc'))[_0xa490('0xd')](',\x20'));_0x4b9368[_0xa490('0xe')]();}else{try{var _0xdd49b=eval('('+_0x2b6fde[_0xa490('0xf')]+')');var _0x1fb7ae=_0xdd49b?_0x2b6fde[_0xa490('0x10')]:_0x2b6fde[_0xa490('0x11')];logger['info'](_0xa490('0x12'),_0x3521b0,_0x2b6fde[_0xa490('0xf')],_0xdd49b,_0x1fb7ae||_0xa490('0x13'));if(_0x1fb7ae){var _0x34722e=_[_0xa490('0x14')](_0x4b9368[_0xa490('0x15')](),{'p':_0x1fb7ae});if(_0x34722e>=0x0){logger[_0xa490('0x16')](_0xa490('0x17'),_0x3521b0,_0x1fb7ae||_0xa490('0x13'),_0x34722e);_0x4b9368[_0xa490('0x13')](_0x34722e);}else{logger[_0xa490('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x3521b0,_0x1fb7ae||_0xa490('0x13'));_0x4b9368[_0xa490('0xe')]();}}else{_0x4b9368[_0xa490('0x13')]();}}catch(_0x480f62){logger[_0xa490('0x18')](_0xa490('0x19'),_0x3521b0,_0x480f62[_0xa490('0xc')]);_0x4b9368[_0xa490('0xe')]();}}}catch(_0x582254){logger['error']('[%s][GOTOIF]\x20%s',_0x3521b0,JSON[_0xa490('0x1a')](_0x582254));_0x4b9368['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index f6be683..f005e6f 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 _0xb3e6=['[%s][GOTOP]\x20%s','map','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','routing','number','consequence','length','error'];(function(_0x41bf6a,_0x1eead0){var _0x2e8024=function(_0x505d4c){while(--_0x505d4c){_0x41bf6a['push'](_0x41bf6a['shift']());}};_0x2e8024(++_0x1eead0);}(_0xb3e6,0x103));var _0x6b3e=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0xb3e6[_0x48d6a3];return _0x38bfa0;};'use strict';var schema=require(_0x6b3e('0x0'));var _=require('lodash');var logger=require(_0x6b3e('0x1'))(_0x6b3e('0x2'));var gotop=schema({'priority':{'type':_0x6b3e('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x6b3e('0x4')]=function(_0x5b6265,_0x98793b){return function(_0x47ebec){try{var _0x1d3a9f={'priority':_0x98793b[0x0]};var _0x3df84c=gotop[_0x6b3e('0x0')](_0x1d3a9f,{'typecast':!![]});if(_0x3df84c[_0x6b3e('0x5')]){logger[_0x6b3e('0x6')](_0x6b3e('0x7'),_0x5b6265,_[_0x6b3e('0x8')](_0x3df84c,'message')['join'](',\x20'));_0x47ebec[_0x6b3e('0x9')]();}else{logger[_0x6b3e('0xa')](_0x6b3e('0xb'),_0x5b6265,_0x1d3a9f[_0x6b3e('0xc')]);if(_0x1d3a9f[_0x6b3e('0xc')]){var _0x31685a=_[_0x6b3e('0xd')](_0x47ebec[_0x6b3e('0xe')](),{'p':_0x1d3a9f['priority']});if(_0x31685a>=0x0){logger['info'](_0x6b3e('0xf'),_0x5b6265,_0x1d3a9f[_0x6b3e('0xc')]||_0x6b3e('0x10'),_0x31685a);_0x47ebec[_0x6b3e('0x10')](_0x31685a);}else{logger[_0x6b3e('0xa')](_0x6b3e('0x11'),_0x5b6265,_0x1d3a9f[_0x6b3e('0xc')]||_0x6b3e('0x10'));_0x47ebec['stop']();}}else{_0x47ebec[_0x6b3e('0x10')]();}}}catch(_0x108c01){logger[_0x6b3e('0x6')](_0x6b3e('0x7'),_0x5b6265,JSON[_0x6b3e('0x12')](_0x108c01));_0x47ebec[_0x6b3e('0x9')]();}};}; \ No newline at end of file +var _0x82ce=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','stop','validate','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','info','priority','findIndex'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x82ce,0x1c9));var _0xe82c=function(_0x5f22f9,_0x18bcdc){_0x5f22f9=_0x5f22f9-0x0;var _0x28dd40=_0x82ce[_0x5f22f9];return _0x28dd40;};'use strict';var schema=require(_0xe82c('0x0'));var _=require('lodash');var logger=require(_0xe82c('0x1'))('routing');var gotop=schema({'priority':{'type':_0xe82c('0x2'),'required':!![],'message':_0xe82c('0x3')}});exports[_0xe82c('0x4')]=function(_0x307fd6,_0x4c24ac){return function(_0x7f1f5e){try{var _0x16c80f={'priority':_0x4c24ac[0x0]};var _0x15662b=gotop['validate'](_0x16c80f,{'typecast':!![]});if(_0x15662b[_0xe82c('0x5')]){logger['error'](_0xe82c('0x6'),_0x307fd6,_[_0xe82c('0x7')](_0x15662b,'message')['join'](',\x20'));_0x7f1f5e['stop']();}else{logger[_0xe82c('0x8')]('[%s][GOTOP]\x20priority\x20%s',_0x307fd6,_0x16c80f['priority']);if(_0x16c80f[_0xe82c('0x9')]){var _0x2b7fbe=_[_0xe82c('0xa')](_0x7f1f5e[_0xe82c('0xb')](),{'p':_0x16c80f['priority']});if(_0x2b7fbe>=0x0){logger[_0xe82c('0x8')](_0xe82c('0xc'),_0x307fd6,_0x16c80f[_0xe82c('0x9')]||'next',_0x2b7fbe);_0x7f1f5e[_0xe82c('0xd')](_0x2b7fbe);}else{logger[_0xe82c('0x8')](_0xe82c('0xe'),_0x307fd6,_0x16c80f['priority']||_0xe82c('0xd'));_0x7f1f5e['stop']();}}else{_0x7f1f5e[_0xe82c('0xd')]();}}}catch(_0x1d8abd){logger[_0xe82c('0xf')](_0xe82c('0x6'),_0x307fd6,JSON[_0xe82c('0x10')](_0x1d8abd));_0x7f1f5e[_0xe82c('0x11')]();}};}; \ 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 fd4d4f2..9f2a4b2 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 _0x219f=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','catch','stop','error','stringify','lodash','./utils','../../../../config/logger'];(function(_0x19c0f8,_0x1da71a){var _0x276439=function(_0x3a9672){while(--_0x3a9672){_0x19c0f8['push'](_0x19c0f8['shift']());}};_0x276439(++_0x1da71a);}(_0x219f,0x141));var _0xf219=function(_0x39583e,_0x27a9a9){_0x39583e=_0x39583e-0x0;var _0x87eb09=_0x219f[_0x39583e];return _0x87eb09;};'use strict';var _=require(_0xf219('0x0'));var utils=require(_0xf219('0x1'));var logger=require(_0xf219('0x2'))('routing');var rpc={'chatMessage':require(_0xf219('0x3')),'openchannelMessage':require(_0xf219('0x4')),'mailMessage':require(_0xf219('0x5')),'smsMessage':require(_0xf219('0x6')),'faxMessage':require(_0xf219('0x7')),'whatsappMessage':require(_0xf219('0x8'))};exports[_0xf219('0x9')]=function(_0x5084c5,_0x25efdc){return function(_0x161eb6){try{var _0x52bb1b={'body':utils['getMustacheRender'](_0x25efdc[0x0],this),'ContactId':this['contact']['id']};if(this[_0xf219('0xa')]===_0xf219('0xb')){_0x52bb1b[_0xf219('0xc')]=this[_0xf219('0xd')]['id'];}else{_0x52bb1b[_[_0xf219('0xe')](this['channel'])+_0xf219('0xf')]=this[_0xf219('0xd')]['id'];}_0x52bb1b[_[_0xf219('0xe')](this[_0xf219('0xa')])+_0xf219('0x10')]=this[_0xf219('0x11')]['id'];if(rpc[this['channel']+_0xf219('0x12')]){return rpc[this['channel']+_0xf219('0x12')][_0xf219('0x13')](_0x52bb1b)[_0xf219('0x14')](function(_0x299d67){logger['info'](_0xf219('0x15'),_0x5084c5,_0x52bb1b[_0xf219('0x16')]);_0x161eb6['next']();})[_0xf219('0x17')](function(_0x2695a5){logger['error']('[%s][MESSAGE]\x20%s',_0x5084c5,JSON['stringify'](_0x2695a5));_0x161eb6[_0xf219('0x18')]();});}}catch(_0x942311){logger[_0xf219('0x19')](_0xf219('0x15'),_0x5084c5,JSON[_0xf219('0x1a')](_0x942311));_0x161eb6['stop']();}};}; \ No newline at end of file +var _0xe9e8=['Message','create','then','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction'];(function(_0x428774,_0x383962){var _0x53a01c=function(_0x2d62da){while(--_0x2d62da){_0x428774['push'](_0x428774['shift']());}};_0x53a01c(++_0x383962);}(_0xe9e8,0x7e));var _0x8e9e=function(_0x4888b7,_0x484f1a){_0x4888b7=_0x4888b7-0x0;var _0x13cd98=_0xe9e8[_0x4888b7];return _0x13cd98;};'use strict';var _=require(_0x8e9e('0x0'));var utils=require(_0x8e9e('0x1'));var logger=require('../../../../config/logger')(_0x8e9e('0x2'));var rpc={'chatMessage':require(_0x8e9e('0x3')),'openchannelMessage':require(_0x8e9e('0x4')),'mailMessage':require(_0x8e9e('0x5')),'smsMessage':require(_0x8e9e('0x6')),'faxMessage':require(_0x8e9e('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x8e9e('0x8')]=function(_0x13cf15,_0x217e7e){return function(_0xded6f7){try{var _0x5cdd95={'body':utils[_0x8e9e('0x9')](_0x217e7e[0x0],this),'ContactId':this[_0x8e9e('0xa')]['id']};if(this[_0x8e9e('0xb')]===_0x8e9e('0xc')){_0x5cdd95[_0x8e9e('0xd')]=this[_0x8e9e('0xe')]['id'];}else{_0x5cdd95[_['upperFirst'](this[_0x8e9e('0xb')])+_0x8e9e('0xf')]=this[_0x8e9e('0xe')]['id'];}_0x5cdd95[_[_0x8e9e('0x10')](this['channel'])+_0x8e9e('0x11')]=this[_0x8e9e('0x12')]['id'];if(rpc[this[_0x8e9e('0xb')]+_0x8e9e('0x13')]){return rpc[this[_0x8e9e('0xb')]+'Message'][_0x8e9e('0x14')](_0x5cdd95)[_0x8e9e('0x15')](function(_0x403aa3){logger[_0x8e9e('0x16')]('[%s][MESSAGE]\x20%s',_0x13cf15,_0x5cdd95[_0x8e9e('0x17')]);_0xded6f7[_0x8e9e('0x18')]();})[_0x8e9e('0x19')](function(_0x4dfb29){logger[_0x8e9e('0x1a')](_0x8e9e('0x1b'),_0x13cf15,JSON[_0x8e9e('0x1c')](_0x4dfb29));_0xded6f7['stop']();});}}catch(_0x25adb6){logger['error'](_0x8e9e('0x1b'),_0x13cf15,JSON[_0x8e9e('0x1c')](_0x25adb6));_0xded6f7['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 e574ccc..8343aeb 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 _0xbc0a=['stop','./utils','../../../../config/logger','routing','consequence','getMustacheRender','next','error','stringify'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0xbc0a,0x1de));var _0xabc0=function(_0x483aeb,_0x52b6c5){_0x483aeb=_0x483aeb-0x0;var _0x304af1=_0xbc0a[_0x483aeb];return _0x304af1;};'use strict';var utils=require(_0xabc0('0x0'));var logger=require(_0xabc0('0x1'))(_0xabc0('0x2'));exports[_0xabc0('0x3')]=function(_0x54a4de,_0x2ea235){return function(_0x2e1afd){try{logger['info']('[%s][NOOP]\x20%s',_0x54a4de,utils[_0xabc0('0x4')](_0x2ea235[0x0],this));_0x2e1afd[_0xabc0('0x5')]();}catch(_0x25fe77){logger[_0xabc0('0x6')]('[%s][NOOP]\x20%s',_0x54a4de,JSON[_0xabc0('0x7')](_0x25fe77));_0x2e1afd[_0xabc0('0x8')]();}};}; \ No newline at end of file +var _0x8e37=['error','stringify','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x4e8c3c,_0x5c70f5){var _0xdfce9a=function(_0x7d807a){while(--_0x7d807a){_0x4e8c3c['push'](_0x4e8c3c['shift']());}};_0xdfce9a(++_0x5c70f5);}(_0x8e37,0x192));var _0x78e3=function(_0x201d79,_0x3fa3a6){_0x201d79=_0x201d79-0x0;var _0x5d0364=_0x8e37[_0x201d79];return _0x5d0364;};'use strict';var utils=require(_0x78e3('0x0'));var logger=require(_0x78e3('0x1'))(_0x78e3('0x2'));exports[_0x78e3('0x3')]=function(_0x337d36,_0x52467a){return function(_0x5ea124){try{logger[_0x78e3('0x4')](_0x78e3('0x5'),_0x337d36,utils['getMustacheRender'](_0x52467a[0x0],this));_0x5ea124['next']();}catch(_0x22a818){logger[_0x78e3('0x6')](_0x78e3('0x5'),_0x337d36,JSON[_0x78e3('0x7')](_0x22a818));_0x5ea124['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 2afba37..2b2721b 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 _0x3753=['body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','interaction','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','accepted','update','update\x20queue\x20report','consequence','length','join','stop','find','Queues','timeout','createQueue','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','ioredis','../../../../config/logger','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','format','%sQueuesWaitingInteractions','pick','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting'];(function(_0x597eb2,_0x165f5c){var _0x56875f=function(_0x5de36e){while(--_0x5de36e){_0x597eb2['push'](_0x597eb2['shift']());}};_0x56875f(++_0x165f5c);}(_0x3753,0x6d));var _0x3375=function(_0x4b92cd,_0x382484){_0x4b92cd=_0x4b92cd-0x0;var _0x264e66=_0x3753[_0x4b92cd];return _0x264e66;};'use strict';var schema=require(_0x3375('0x0'));var _=require('lodash');var util=require(_0x3375('0x1'));var seqqueue=require(_0x3375('0x2'));var moment=require('moment');var Redis=require(_0x3375('0x3'));var config=require('../../../../config/environment');var logger=require(_0x3375('0x4'))('routing');var strategy=require(_0x3375('0x5'));config[_0x3375('0x6')]=_[_0x3375('0x7')](config[_0x3375('0x6')],{'host':_0x3375('0x8'),'port':0x18eb});var io=require(_0x3375('0x9'))(new Redis(config[_0x3375('0x6')]));var attributes=['id',_0x3375('0xa'),_0x3375('0xb'),_0x3375('0xc'),_0x3375('0xd'),_0x3375('0xe')];function emit(_0x349d9e,_0x31d7b5,_0x5f5e0c){io['to'](_0x349d9e)[_0x3375('0xf')](_0x31d7b5,_0x5f5e0c);}function emitChannelQueueInteraction(_0x58d3e4,_0x36a114,_0x73f17b,_0x5bc1f1,_0x3b4961,_0x10db0d,_0x53fa9f,_0x378514){var _0x144400=_['clone'](_0x73f17b);_0x144400[_0x3375('0xa')]=_0x378514;_0x144400[_0x3375('0xc')]=_0x36a114;_0x144400[_0x3375('0xb')]=_0x5bc1f1;_0x144400['id']=_0x3b4961;if(_0x10db0d){_0x53fa9f[util[_0x3375('0x10')](_0x3375('0x11'),_0x58d3e4)][_0x3b4961]=_[_0x3375('0x12')](_0x144400,attributes);}else{delete _0x53fa9f[util[_0x3375('0x10')](_0x3375('0x11'),_0x58d3e4)][_0x3b4961];}emit(util['format']('%s:queue:%s',_0x58d3e4,_0x36a114),util['format']('%s_queue_waiting_interaction:%s',_0x58d3e4,_0x10db0d?'save':_0x3375('0x13')),_['pick'](_0x144400,attributes));}var rpc={'openchannelQueueReport':require(_0x3375('0x14')),'mailQueueReport':require(_0x3375('0x15')),'chatQueueReport':require(_0x3375('0x16')),'smsQueueReport':require(_0x3375('0x17')),'faxQueueReport':require(_0x3375('0x18')),'whatsappQueueReport':require(_0x3375('0x19'))};var queue=schema({'name':{'type':_0x3375('0x1a'),'required':!![],'message':_0x3375('0x1b')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x196fb7,_0x15cfa4,_0xb9578,_0x1b275d){if(_0x196fb7&&_0x15cfa4&&_0xb9578){_0x15cfa4[_0x3375('0x1c')]+=0x1;var _0x587a6={'uniqueid':_0x196fb7,'from':_0xb9578['body']?_0xb9578[_0x3375('0x1d')][_0x3375('0xd')]:'','joinAt':moment()[_0x3375('0x10')](_0x3375('0x1e')),'ContactId':_0xb9578['contact']?_0xb9578[_0x3375('0x1f')]['id']:null,'ListId':_0xb9578[_0x3375('0x20')]?_0xb9578['list']['id']:null};_0x587a6[_[_0x3375('0x21')](_0xb9578['channel'])+_0x3375('0x22')]=_0x15cfa4['id']||null;_0x587a6[_[_0x3375('0x21')](_0xb9578[_0x3375('0x23')])+'InteractionId']=_0xb9578[_0x3375('0x24')]?_0xb9578[_0x3375('0x24')]['id']:null;_0x587a6[_['upperFirst'](_0xb9578[_0x3375('0x23')])+'MessageId']=_0xb9578['message']?_0xb9578[_0x3375('0x25')]['id']:null;_0x587a6[_[_0x3375('0x21')](_0xb9578[_0x3375('0x23')])+(_0xb9578[_0x3375('0x23')]!==_0x3375('0x26')?_0x3375('0x27'):'WebsiteId')]=_0xb9578[_0x3375('0xb')]?_0xb9578[_0x3375('0xb')]['id']:null;logger[_0x3375('0x28')](util[_0x3375('0x10')](_0x3375('0x29'),_0x196fb7,_0x15cfa4[_0x3375('0x2a')]));emitChannelQueueInteraction(_0xb9578[_0x3375('0x23')],_0x15cfa4[_0x3375('0x2a')],_0x587a6,_0xb9578[_0x3375('0xb')]['name'],_0xb9578[_0x3375('0x25')]['id'],!![],_0x1b275d,_0x15cfa4['id']);if(rpc[_0xb9578[_0x3375('0x23')]+_0x3375('0x2b')]){return rpc[_0xb9578['channel']+_0x3375('0x2b')]['create'](_0x587a6)[_0x3375('0x2c')](function(_0x55ed44){logger[_0x3375('0x2d')]('create\x20queue\x20report');});}}}function stopRouting(_0x572f11,_0x5dbff0,_0xbec0f5,_0x1806e5){if(_0x572f11&&_0x5dbff0){_0x5dbff0[_0x3375('0x1c')]-=0x1;var _0x148973={'leaveAt':moment()[_0x3375('0x10')](_0x3375('0x1e')),'acceptAt':moment()[_0x3375('0x10')](_0x3375('0x1e')),'reason':_0x3375('0x2e')};logger[_0x3375('0x28')](util[_0x3375('0x10')]('[%s][STOP:QUEUE][NAME:%s]',_0x572f11,_0x5dbff0[_0x3375('0x2a')]));emitChannelQueueInteraction(_0xbec0f5[_0x3375('0x23')],_0x5dbff0['name'],_0xbec0f5[_0x3375('0x1d')],_0xbec0f5[_0x3375('0xb')]['name'],_0xbec0f5[_0x3375('0x25')]['id'],![],_0x1806e5,_0x5dbff0['id']);if(rpc[_0xbec0f5[_0x3375('0x23')]+'QueueReport']){return rpc[_0xbec0f5[_0x3375('0x23')]+'QueueReport']['update'](_0x572f11,_0x148973)['catch'](function(_0x410457){logger[_0x3375('0x2d')]('update\x20queue\x20report');});}}}function endRouting(_0x889449,_0x62b702,_0x299635,_0x33891f){if(_0x889449&&_0x62b702){_0x62b702[_0x3375('0x1c')]-=0x1;var _0x5ccc14={'leaveAt':moment()[_0x3375('0x10')](_0x3375('0x1e')),'exitAt':moment()[_0x3375('0x10')](_0x3375('0x1e')),'reason':'timeout'};logger[_0x3375('0x28')](util[_0x3375('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x889449,_0x62b702[_0x3375('0x2a')]));emitChannelQueueInteraction(_0x299635[_0x3375('0x23')],_0x62b702[_0x3375('0x2a')],_0x299635[_0x3375('0x1d')],_0x299635[_0x3375('0xb')][_0x3375('0x2a')],_0x299635[_0x3375('0x25')]['id'],![],_0x33891f);if(rpc[_0x299635[_0x3375('0x23')]+_0x3375('0x2b')]){return rpc[_0x299635['channel']+_0x3375('0x2b')][_0x3375('0x2f')](_0x889449,_0x5ccc14)[_0x3375('0x2c')](function(_0x3d4cf0){logger[_0x3375('0x2d')](_0x3375('0x30'));});}}}function handleFindQueue(_0x16a4aa){return function(_0x5ad33e){return _0x5ad33e[_0x3375('0x2a')]['toLowerCase']()===_0x16a4aa['toLowerCase']();};}exports[_0x3375('0x31')]=function(_0x1e5949,_0xf0efa4,_0x30cb31,_0x11ff20){return function(_0x3fce3b){try{var _0x5eb0e1={'name':_0xf0efa4[0x0],'timeout':_0xf0efa4[0x1]};var _0x4d0ae5=queue[_0x3375('0x0')](_0x5eb0e1,{'typecast':!![]});if(_0x4d0ae5[_0x3375('0x32')]){logger['error']('[%s][QUEUE]\x20%s',_0x1e5949,_['map'](_0x4d0ae5,_0x3375('0x25'))[_0x3375('0x33')](',\x20'));_0x3fce3b[_0x3375('0x34')]();}else{var _0x3469eb=_[_0x3375('0x35')](_0x30cb31[_0x11ff20[_0x3375('0x23')]+_0x3375('0x36')],handleFindQueue(_0x5eb0e1['name']));if(_0x3469eb){startRouting(_0x1e5949,_0x3469eb,_0x11ff20,_0x30cb31);var _0x1c6088=(_0x3469eb[_0x3375('0x37')]||0xa)*0x3e8;var _0x4b821e=(_0x5eb0e1[_0x3375('0x37')]||0x14)*0x3e8;var _0x38eba1,_0x175aea;if(_0x1c6088>_0x4b821e){_0x4b821e=_0x1c6088;}var _0x457896=seqqueue[_0x3375('0x38')](_0x1c6088);_0x457896['id']=_0x1e5949;_0x457896['atimeout']=_0x1c6088;_0x457896['qtimeout']=_0x4b821e;_0x457896[_0x3375('0x23')]=_0x11ff20[_0x3375('0x23')];_0x30cb31[_0x3375('0x39')][_0x1e5949]['on'](_0x3375('0x3a'),function(){logger[_0x3375('0x28')](_0x3375('0x3b'),_0x1e5949);stopRouting(_0x1e5949,_0x3469eb,_0x11ff20,_0x30cb31);clearTimeout(_0x38eba1);_0x38eba1=undefined;_0x457896[_0x3375('0x3c')](!![]);if(_0x30cb31[_0x3375('0x39')][_0x1e5949]){delete _0x30cb31[_0x3375('0x39')][_0x1e5949];}_0x3fce3b[_0x3375('0x34')]();});_0x30cb31['rules'][_0x1e5949]['on']('complete',function(){if(_0x30cb31[_0x3375('0x39')][_0x1e5949]){delete _0x30cb31[_0x3375('0x39')][_0x1e5949];}});_0x38eba1=setTimeout(function(){logger['info'](_0x3375('0x3d'),_0x1e5949);endRouting(_0x1e5949,_0x3469eb,_0x11ff20,_0x30cb31);clearTimeout(_0x38eba1);_0x457896[_0x3375('0x3c')](!![]);_0x3fce3b[_0x3375('0x3e')]();},_0x4b821e);switch(_0x3469eb[_0x3375('0x3f')]){case'rrmemory':strategy[_0x3375('0x40')](_0x457896,_0x3469eb,_0x30cb31,_0x11ff20);break;default:strategy[_0x3375('0x41')](_0x457896,_0x3469eb,_0x30cb31,_0x11ff20);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x1e5949,_0x5eb0e1[_0x3375('0x2a')]);_0x3fce3b[_0x3375('0x34')]();}}}catch(_0x2839b5){console[_0x3375('0x42')](_0x2839b5);logger[_0x3375('0x2d')](_0x3375('0x43'),_0x1e5949,_0x2839b5[_0x3375('0x44')]);_0x3fce3b[_0x3375('0x34')]();}};}; \ No newline at end of file +var _0xbacd=['join','stop','find','Queues','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','moment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','joinAt','emit','clone','%sQueuesWaitingInteractions','format','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','contact','list','upperFirst','channel','InteractionId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','length','map'];(function(_0x2f0ddd,_0x1e4331){var _0xeba627=function(_0x262b93){while(--_0x262b93){_0x2f0ddd['push'](_0x2f0ddd['shift']());}};_0xeba627(++_0x1e4331);}(_0xbacd,0x194));var _0xdbac=function(_0x357b41,_0x2e73e2){_0x357b41=_0x357b41-0x0;var _0x3aa319=_0xbacd[_0x357b41];return _0x3aa319;};'use strict';var schema=require(_0xdbac('0x0'));var _=require(_0xdbac('0x1'));var util=require(_0xdbac('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xdbac('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xdbac('0x4'));var strategy=require(_0xdbac('0x5'));config[_0xdbac('0x6')]=_[_0xdbac('0x7')](config[_0xdbac('0x6')],{'host':_0xdbac('0x8'),'port':0x18eb});var io=require(_0xdbac('0x9'))(new Redis(config['redis']));var attributes=['id',_0xdbac('0xa'),_0xdbac('0xb'),_0xdbac('0xc'),'from',_0xdbac('0xd')];function emit(_0x539a40,_0x5e35bd,_0x1c661c){io['to'](_0x539a40)[_0xdbac('0xe')](_0x5e35bd,_0x1c661c);}function emitChannelQueueInteraction(_0x579380,_0xa9985,_0x554f50,_0x2a2ae5,_0xfea4b9,_0x474114,_0x5d3680,_0x3b8b0c){var _0x1970b0=_[_0xdbac('0xf')](_0x554f50);_0x1970b0[_0xdbac('0xa')]=_0x3b8b0c;_0x1970b0[_0xdbac('0xc')]=_0xa9985;_0x1970b0[_0xdbac('0xb')]=_0x2a2ae5;_0x1970b0['id']=_0xfea4b9;if(_0x474114){_0x5d3680[util['format'](_0xdbac('0x10'),_0x579380)][_0xfea4b9]=_['pick'](_0x1970b0,attributes);}else{delete _0x5d3680[util[_0xdbac('0x11')]('%sQueuesWaitingInteractions',_0x579380)][_0xfea4b9];}emit(util[_0xdbac('0x11')]('%s:queue:%s',_0x579380,_0xa9985),util['format']('%s_queue_waiting_interaction:%s',_0x579380,_0x474114?_0xdbac('0x12'):_0xdbac('0x13')),_[_0xdbac('0x14')](_0x1970b0,attributes));}var rpc={'openchannelQueueReport':require(_0xdbac('0x15')),'mailQueueReport':require(_0xdbac('0x16')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xdbac('0x17')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xdbac('0x18'))};var queue=schema({'name':{'type':_0xdbac('0x19'),'required':!![],'message':_0xdbac('0x1a')},'timeout':{'type':_0xdbac('0x1b'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x2bd3b1,_0x4b318a,_0x5445e2,_0x333f03){if(_0x2bd3b1&&_0x4b318a&&_0x5445e2){_0x4b318a[_0xdbac('0x1c')]+=0x1;var _0x56e628={'uniqueid':_0x2bd3b1,'from':_0x5445e2[_0xdbac('0x1d')]?_0x5445e2[_0xdbac('0x1d')]['from']:'','joinAt':moment()[_0xdbac('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5445e2[_0xdbac('0x1e')]?_0x5445e2[_0xdbac('0x1e')]['id']:null,'ListId':_0x5445e2[_0xdbac('0x1f')]?_0x5445e2[_0xdbac('0x1f')]['id']:null};_0x56e628[_[_0xdbac('0x20')](_0x5445e2[_0xdbac('0x21')])+'QueueId']=_0x4b318a['id']||null;_0x56e628[_[_0xdbac('0x20')](_0x5445e2[_0xdbac('0x21')])+_0xdbac('0x22')]=_0x5445e2['interaction']?_0x5445e2[_0xdbac('0x23')]['id']:null;_0x56e628[_[_0xdbac('0x20')](_0x5445e2[_0xdbac('0x21')])+'MessageId']=_0x5445e2['message']?_0x5445e2[_0xdbac('0x24')]['id']:null;_0x56e628[_['upperFirst'](_0x5445e2[_0xdbac('0x21')])+(_0x5445e2[_0xdbac('0x21')]!==_0xdbac('0x25')?_0xdbac('0x26'):_0xdbac('0x27'))]=_0x5445e2[_0xdbac('0xb')]?_0x5445e2['account']['id']:null;logger[_0xdbac('0x28')](util[_0xdbac('0x11')](_0xdbac('0x29'),_0x2bd3b1,_0x4b318a[_0xdbac('0x2a')]));emitChannelQueueInteraction(_0x5445e2[_0xdbac('0x21')],_0x4b318a[_0xdbac('0x2a')],_0x56e628,_0x5445e2['account'][_0xdbac('0x2a')],_0x5445e2[_0xdbac('0x24')]['id'],!![],_0x333f03,_0x4b318a['id']);if(rpc[_0x5445e2[_0xdbac('0x21')]+_0xdbac('0x2b')]){return rpc[_0x5445e2['channel']+_0xdbac('0x2b')][_0xdbac('0x2c')](_0x56e628)[_0xdbac('0x2d')](function(_0x33fd02){logger[_0xdbac('0x2e')](_0xdbac('0x2f'));});}}}function stopRouting(_0x4364e1,_0x5c03c9,_0x5ea087,_0x10b11e){if(_0x4364e1&&_0x5c03c9){_0x5c03c9['waiting']-=0x1;var _0xafbe93={'leaveAt':moment()['format'](_0xdbac('0x30')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xdbac('0x31')};logger['info'](util[_0xdbac('0x11')](_0xdbac('0x32'),_0x4364e1,_0x5c03c9[_0xdbac('0x2a')]));emitChannelQueueInteraction(_0x5ea087['channel'],_0x5c03c9[_0xdbac('0x2a')],_0x5ea087[_0xdbac('0x1d')],_0x5ea087[_0xdbac('0xb')][_0xdbac('0x2a')],_0x5ea087[_0xdbac('0x24')]['id'],![],_0x10b11e,_0x5c03c9['id']);if(rpc[_0x5ea087[_0xdbac('0x21')]+_0xdbac('0x2b')]){return rpc[_0x5ea087['channel']+_0xdbac('0x2b')][_0xdbac('0x33')](_0x4364e1,_0xafbe93)[_0xdbac('0x2d')](function(_0x575ce1){logger[_0xdbac('0x2e')]('update\x20queue\x20report');});}}}function endRouting(_0x318089,_0x326222,_0x596308,_0xdb0b51){if(_0x318089&&_0x326222){_0x326222[_0xdbac('0x1c')]-=0x1;var _0xa20f42={'leaveAt':moment()[_0xdbac('0x11')](_0xdbac('0x30')),'exitAt':moment()[_0xdbac('0x11')](_0xdbac('0x30')),'reason':_0xdbac('0x34')};logger['info'](util['format'](_0xdbac('0x35'),_0x318089,_0x326222[_0xdbac('0x2a')]));emitChannelQueueInteraction(_0x596308[_0xdbac('0x21')],_0x326222[_0xdbac('0x2a')],_0x596308[_0xdbac('0x1d')],_0x596308[_0xdbac('0xb')]['name'],_0x596308[_0xdbac('0x24')]['id'],![],_0xdb0b51);if(rpc[_0x596308[_0xdbac('0x21')]+'QueueReport']){return rpc[_0x596308[_0xdbac('0x21')]+_0xdbac('0x2b')][_0xdbac('0x33')](_0x318089,_0xa20f42)[_0xdbac('0x2d')](function(_0x16cdfa){logger['error'](_0xdbac('0x36'));});}}}function handleFindQueue(_0xc4e7ee){return function(_0x137dc8){return _0x137dc8[_0xdbac('0x2a')][_0xdbac('0x37')]()===_0xc4e7ee[_0xdbac('0x37')]();};}exports['consequence']=function(_0x5a7573,_0x564814,_0x362d3b,_0x510b1b){return function(_0x4ddf7c){try{var _0x14c43c={'name':_0x564814[0x0],'timeout':_0x564814[0x1]};var _0x76ac21=queue['validate'](_0x14c43c,{'typecast':!![]});if(_0x76ac21[_0xdbac('0x38')]){logger[_0xdbac('0x2e')]('[%s][QUEUE]\x20%s',_0x5a7573,_[_0xdbac('0x39')](_0x76ac21,_0xdbac('0x24'))[_0xdbac('0x3a')](',\x20'));_0x4ddf7c[_0xdbac('0x3b')]();}else{var _0x5e86ac=_[_0xdbac('0x3c')](_0x362d3b[_0x510b1b[_0xdbac('0x21')]+_0xdbac('0x3d')],handleFindQueue(_0x14c43c[_0xdbac('0x2a')]));if(_0x5e86ac){startRouting(_0x5a7573,_0x5e86ac,_0x510b1b,_0x362d3b);var _0x57f3f4=(_0x5e86ac[_0xdbac('0x34')]||0xa)*0x3e8;var _0x2b880b=(_0x14c43c[_0xdbac('0x34')]||0x14)*0x3e8;var _0x37a64a,_0x39dbe3;if(_0x57f3f4>_0x2b880b){_0x2b880b=_0x57f3f4;}var _0x4f0445=seqqueue['createQueue'](_0x57f3f4);_0x4f0445['id']=_0x5a7573;_0x4f0445[_0xdbac('0x3e')]=_0x57f3f4;_0x4f0445[_0xdbac('0x3f')]=_0x2b880b;_0x4f0445[_0xdbac('0x21')]=_0x510b1b['channel'];_0x362d3b['rules'][_0x5a7573]['on'](_0xdbac('0x40'),function(){logger[_0xdbac('0x28')](_0xdbac('0x41'),_0x5a7573);stopRouting(_0x5a7573,_0x5e86ac,_0x510b1b,_0x362d3b);clearTimeout(_0x37a64a);_0x37a64a=undefined;_0x4f0445[_0xdbac('0x42')](!![]);if(_0x362d3b[_0xdbac('0x43')][_0x5a7573]){delete _0x362d3b[_0xdbac('0x43')][_0x5a7573];}_0x4ddf7c['stop']();});_0x362d3b[_0xdbac('0x43')][_0x5a7573]['on'](_0xdbac('0x44'),function(){if(_0x362d3b[_0xdbac('0x43')][_0x5a7573]){delete _0x362d3b[_0xdbac('0x43')][_0x5a7573];}});_0x37a64a=setTimeout(function(){logger[_0xdbac('0x28')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x5a7573);endRouting(_0x5a7573,_0x5e86ac,_0x510b1b,_0x362d3b);clearTimeout(_0x37a64a);_0x4f0445[_0xdbac('0x42')](!![]);_0x4ddf7c[_0xdbac('0x45')]();},_0x2b880b);switch(_0x5e86ac[_0xdbac('0x46')]){case _0xdbac('0x47'):strategy[_0xdbac('0x47')](_0x4f0445,_0x5e86ac,_0x362d3b,_0x510b1b);break;default:strategy[_0xdbac('0x48')](_0x4f0445,_0x5e86ac,_0x362d3b,_0x510b1b);}}else{logger['error'](_0xdbac('0x49'),_0x5a7573,_0x14c43c[_0xdbac('0x2a')]);_0x4ddf7c[_0xdbac('0x3b')]();}}}catch(_0x32aaad){console[_0xdbac('0x4a')](_0x32aaad);logger[_0xdbac('0x2e')](_0xdbac('0x4b'),_0x5a7573,_0x32aaad[_0xdbac('0x4c')]);_0x4ddf7c[_0xdbac('0x3b')]();}};}; \ 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 474fda5..7b684fc 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 _0xff5b=['showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','busyQueue','STOP','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout','handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','busy'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xff5b,0xe0));var _0xbff5=function(_0x59e553,_0x14a42c){_0x59e553=_0x59e553-0x0;var _0x4afc4d=_0xff5b[_0x59e553];return _0x4afc4d;};'use strict';var _=require(_0xbff5('0x0'));var uuid=require('uuid');var util=require(_0xbff5('0x1'));var logger=require(_0xbff5('0x2'))(_0xbff5('0x3'));var Agent=function(_0xc30d51,_0x352f2c,_0x3fa371,_0x6e7829){this[_0xbff5('0x4')]=uuid['v4']();this[_0xbff5('0x5')]=_0xc30d51;this[_0xbff5('0x6')]=_0x352f2c;this[_0xbff5('0x7')]=_0x3fa371;this[_0xbff5('0x3')]=_0x6e7829;this['squeue'][_0xbff5('0x8')](this['handleRun'][_0xbff5('0x9')](this),this[_0xbff5('0xa')]['bind'](this));this['squeue']['on']('timeout',this[_0xbff5('0xa')][_0xbff5('0x9')](this));this[_0xbff5('0x5')]['on']('drained',this[_0xbff5('0xb')][_0xbff5('0x9')](this));};Agent[_0xbff5('0xc')][_0xbff5('0x8')]=function(){this[_0xbff5('0x5')][_0xbff5('0x8')](this[_0xbff5('0xd')][_0xbff5('0x9')](this),this[_0xbff5('0xa')][_0xbff5('0x9')](this));};Agent[_0xbff5('0xc')][_0xbff5('0xb')]=function(){this[_0xbff5('0xa')](!![]);};Agent['prototype'][_0xbff5('0xd')]=function(_0x143db3){logger[_0xbff5('0xe')](_0xbff5('0xf'),this[_0xbff5('0x5')]['id'],this[_0xbff5('0x6')]['id']);if(_[_0xbff5('0x10')](this['realtime'][_0xbff5('0x11')][this[_0xbff5('0x6')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xbff5('0x5')]['id'],this[_0xbff5('0x6')]['id']);setTimeout(this[_0xbff5('0x8')][_0xbff5('0x9')](this),0x3e8);}else{if(this[_0xbff5('0x3')]['forcedOwnership']||util['isAgentAvailable'](this[_0xbff5('0x5')]['id'],this[_0xbff5('0x7')]['agents'][this['agent']['id']],this['squeue']['channel'],![])){this['realtime'][_0xbff5('0x11')][this[_0xbff5('0x6')]['id']][_0xbff5('0x12')]=!![];this['realtime']['agents'][this[_0xbff5('0x6')]['id']]['busyQueue']=undefined;util[_0xbff5('0x13')](this[_0xbff5('0x4')],this[_0xbff5('0x5')]['id'],this[_0xbff5('0x7')]['agents'][this[_0xbff5('0x6')]['id']],null,this[_0xbff5('0x3')]);util[_0xbff5('0x14')](this[_0xbff5('0x5')]['id'],this[_0xbff5('0x7')][_0xbff5('0x11')][this['agent']['id']],'RINGING'+(this['routing']['forcedOwnership']?_0xbff5('0x15'):''));}else{logger[_0xbff5('0xe')](_0xbff5('0x16'),this[_0xbff5('0x5')]['id'],this[_0xbff5('0x6')]['id']);setTimeout(this['push'][_0xbff5('0x9')](this),0x3e8);}}};Agent[_0xbff5('0xc')][_0xbff5('0xa')]=function(_0x5c864e){if(_['isNil'](this['realtime'][_0xbff5('0x11')][this[_0xbff5('0x6')]['id']])){return logger[_0xbff5('0xe')](_0xbff5('0x17'),this[_0xbff5('0x5')]['id'],this['agent']['id']);}else{logger[_0xbff5('0xe')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0xbff5('0x6')]['id']);util[_0xbff5('0x18')](this[_0xbff5('0x4')],this[_0xbff5('0x5')]['id'],this[_0xbff5('0x7')][_0xbff5('0x11')][this['agent']['id']],null,this[_0xbff5('0x3')]);this[_0xbff5('0x7')][_0xbff5('0x11')][this[_0xbff5('0x6')]['id']][_0xbff5('0x12')]=![];this[_0xbff5('0x7')]['agents'][this[_0xbff5('0x6')]['id']][_0xbff5('0x19')]=undefined;util[_0xbff5('0x14')](this[_0xbff5('0x5')]['id'],this['realtime'][_0xbff5('0x11')][this['agent']['id']],_0x5c864e?_0xbff5('0x1a'):'TIMEOUT');}if(!_0x5c864e){setTimeout(this[_0xbff5('0x8')]['bind'](this),0x3e8);}};function agent(_0x9854c1,_0xa4376d,_0x213242,_0x38f7f1){return new Agent(_0x9854c1,_0xa4376d,_0x213242,_0x38f7f1);}module['exports']=agent; \ No newline at end of file +var _0x4961=['forcedOwnership','isAgentAvailable','agents','channel','busy','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','busyQueue','STOP','exports','lodash','./util','squeue','realtime','routing','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4961,0x143));var _0x1496=function(_0x1e4c0f,_0x137d14){_0x1e4c0f=_0x1e4c0f-0x0;var _0x559bf6=_0x4961[_0x1e4c0f];return _0x559bf6;};'use strict';var _=require(_0x1496('0x0'));var uuid=require('uuid');var util=require(_0x1496('0x1'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x252ede,_0x10369d,_0x1c61b4,_0x383588){this['notificationId']=uuid['v4']();this[_0x1496('0x2')]=_0x252ede;this['agent']=_0x10369d;this[_0x1496('0x3')]=_0x1c61b4;this[_0x1496('0x4')]=_0x383588;this[_0x1496('0x2')]['push'](this[_0x1496('0x5')][_0x1496('0x6')](this),this[_0x1496('0x7')][_0x1496('0x6')](this));this[_0x1496('0x2')]['on'](_0x1496('0x8'),this['handleTimeout'][_0x1496('0x6')](this));this[_0x1496('0x2')]['on'](_0x1496('0x9'),this[_0x1496('0xa')][_0x1496('0x6')](this));};Agent[_0x1496('0xb')][_0x1496('0xc')]=function(){this['squeue'][_0x1496('0xc')](this[_0x1496('0x5')][_0x1496('0x6')](this),this[_0x1496('0x7')][_0x1496('0x6')](this));};Agent[_0x1496('0xb')]['handleDrained']=function(){this[_0x1496('0x7')](!![]);};Agent[_0x1496('0xb')][_0x1496('0x5')]=function(_0x1efd64){logger['info'](_0x1496('0xd'),this['squeue']['id'],this[_0x1496('0xe')]['id']);if(_[_0x1496('0xf')](this[_0x1496('0x3')]['agents'][this[_0x1496('0xe')]['id']])){logger[_0x1496('0x10')](_0x1496('0x11'),this['squeue']['id'],this[_0x1496('0xe')]['id']);setTimeout(this[_0x1496('0xc')][_0x1496('0x6')](this),0x3e8);}else{if(this[_0x1496('0x4')][_0x1496('0x12')]||util[_0x1496('0x13')](this[_0x1496('0x2')]['id'],this['realtime'][_0x1496('0x14')][this['agent']['id']],this[_0x1496('0x2')][_0x1496('0x15')],![])){this['realtime']['agents'][this[_0x1496('0xe')]['id']][_0x1496('0x16')]=!![];this['realtime']['agents'][this[_0x1496('0xe')]['id']]['busyQueue']=undefined;util['showNotification'](this[_0x1496('0x17')],this[_0x1496('0x2')]['id'],this['realtime'][_0x1496('0x14')][this[_0x1496('0xe')]['id']],null,this[_0x1496('0x4')]);util[_0x1496('0x18')](this[_0x1496('0x2')]['id'],this['realtime'][_0x1496('0x14')][this['agent']['id']],_0x1496('0x19')+(this[_0x1496('0x4')][_0x1496('0x12')]?_0x1496('0x1a'):''));}else{logger[_0x1496('0x10')](_0x1496('0x1b'),this[_0x1496('0x2')]['id'],this['agent']['id']);setTimeout(this['push'][_0x1496('0x6')](this),0x3e8);}}};Agent[_0x1496('0xb')][_0x1496('0x7')]=function(_0x2dd341){if(_[_0x1496('0xf')](this[_0x1496('0x3')][_0x1496('0x14')][this[_0x1496('0xe')]['id']])){return logger[_0x1496('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x1496('0xe')]['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x1496('0x2')]['id'],this[_0x1496('0xe')]['id']);util['hideNotification'](this[_0x1496('0x17')],this[_0x1496('0x2')]['id'],this[_0x1496('0x3')]['agents'][this['agent']['id']],null,this[_0x1496('0x4')]);this[_0x1496('0x3')][_0x1496('0x14')][this['agent']['id']]['busy']=![];this[_0x1496('0x3')][_0x1496('0x14')][this[_0x1496('0xe')]['id']][_0x1496('0x1c')]=undefined;util[_0x1496('0x18')](this['squeue']['id'],this[_0x1496('0x3')]['agents'][this[_0x1496('0xe')]['id']],_0x2dd341?_0x1496('0x1d'):'TIMEOUT');}if(!_0x2dd341){setTimeout(this[_0x1496('0xc')][_0x1496('0x6')](this),0x3e8);}};function agent(_0x5b3c4e,_0x5a0f82,_0x392124,_0x252064){return new Agent(_0x5b3c4e,_0x5a0f82,_0x392124,_0x252064);}module[_0x1496('0x1e')]=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 9476e13..d00d71e 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 _0xc090=['squeue','queue','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length','agents','info','isAgentAvailable','realtime','channel','writeLog','RINGING','busy','busyQueue','notificationId','push','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc090,0x112));var _0x0c09=function(_0x33f9b1,_0x4a1fd9){_0x33f9b1=_0x33f9b1-0x0;var _0x44abef=_0xc090[_0x33f9b1];return _0x44abef;};'use strict';var _=require(_0x0c09('0x0'));var uuid=require(_0x0c09('0x1'));var util=require(_0x0c09('0x2'));var logger=require(_0x0c09('0x3'))(_0x0c09('0x4'));var Beepall=function(_0x1b296d,_0x289436,_0x260c36,_0x11984f){this['notificationId']=uuid['v4']();this[_0x0c09('0x5')]=_0x1b296d;this[_0x0c09('0x6')]=_0x289436;this['realtime']=_0x260c36;this['routing']=_0x11984f;this[_0x0c09('0x5')]['push'](this[_0x0c09('0x7')][_0x0c09('0x8')](this),this[_0x0c09('0x9')]['bind'](this));this[_0x0c09('0x5')]['on'](_0x0c09('0xa'),this['handleTimeout'][_0x0c09('0x8')](this));this['squeue']['on'](_0x0c09('0xb'),this[_0x0c09('0xc')][_0x0c09('0x8')](this));};Beepall[_0x0c09('0xd')]['push']=function(){this['squeue']['push'](this[_0x0c09('0x7')]['bind'](this),this['handleTimeout'][_0x0c09('0x8')](this));};Beepall['prototype'][_0x0c09('0xc')]=function(_0x877018){this[_0x0c09('0x9')](!![]);};Beepall[_0x0c09('0xd')][_0x0c09('0x7')]=function(_0x342daa){var _0x28ea3c=!![];if(!_[_0x0c09('0xe')](this[_0x0c09('0x6')])&&!_[_0x0c09('0xe')](this['queue'][_0x0c09('0xf')])&&this[_0x0c09('0x6')][_0x0c09('0xf')][_0x0c09('0x10')]>0x0){for(var _0x20ad8a=0x0,_0x14995e;_0x20ad8a0x0){for(var _0x5a553c=0x0,_0x5d24b1;_0x5a553c0x0&&_0x21704c[_0x796ec1+'CurrentCapacity']>=_0x21704c[_0x796ec1+_0x8db2('0x22')]){writeLog(_0x2260d8,_0x21704c,_0x796ec1[_0x8db2('0x24')]()+_0x8db2('0x25'));return![];}}return!![];};exports[_0x8db2('0x26')]=function(_0x483aee,_0x2e0691,_0x11f398,_0x241baf,_0x1687ed){return sendNotification(!![],_0x483aee,_0x2e0691,_0x11f398,_0x241baf,_0x1687ed);};exports[_0x8db2('0x27')]=function(_0x21bae5,_0xa54ea3,_0x3124d5,_0xbc5366,_0x493cab){return sendNotification(![],_0x21bae5,_0xa54ea3,_0x3124d5,_0xbc5366,_0x493cab);};exports[_0x8db2('0x28')]=writeLog; \ No newline at end of file +var _0x2da6=['toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','emit','user:%s','name','user:save','split','\x20interaction','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','message','format','notification:%s','save','remove','info','isAgentAvailable','busy','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity'];(function(_0x31fea9,_0x1564b5){var _0x110041=function(_0x3c0ecc){while(--_0x3c0ecc){_0x31fea9['push'](_0x31fea9['shift']());}};_0x110041(++_0x1564b5);}(_0x2da6,0x1dd));var _0x62da=function(_0x5ceaf0,_0x4d5b1a){_0x5ceaf0=_0x5ceaf0-0x0;var _0x573e3e=_0x2da6[_0x5ceaf0];return _0x573e3e;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var utils=require(_0x62da('0x2'));var Mustache=require(_0x62da('0x3'));var Redis=require(_0x62da('0x4'));var config=require(_0x62da('0x5'));var logger=require(_0x62da('0x6'))(_0x62da('0x7'));config['redis']=_['defaults'](config[_0x62da('0x8')],{'host':_0x62da('0x9'),'port':0x18eb});var io=require(_0x62da('0xa'))(new Redis(config[_0x62da('0x8')]));function emit(_0x100e73,_0x9d9139,_0x310c15){io['to'](_0x100e73)[_0x62da('0xb')](_0x9d9139,_0x310c15);}function sendNotification(_0xbfd2b0,_0x4cfc5d,_0x19b866,_0x2a3937,_0x2a3d7c,_0x1b68f8){io['to'](util['format'](_0x62da('0xc'),_0x2a3937[_0x62da('0xd')]))[_0x62da('0xb')](_0x62da('0xe'),_0x2a3937);var _0x23be32=_0x1b68f8||{};var _0x5c990c=_0x19b866[_0x62da('0xf')]('.');var _0x199b89={'uniqueid':_0x4cfc5d,'channel':_0x5c990c[0x0],'id':_0x5c990c[0x1],'title':_0x5c990c[0x0]+_0x62da('0x10'),'interactionId':_0x5c990c[0x2],'queue':_0x2a3d7c?_0x2a3d7c[_0x62da('0xd')]:null,'sound':_0x23be32[_0x62da('0x11')]['notificationSound'],'shake':_0x23be32['account'][_0x62da('0x12')]};try{if(!_0x23be32[_0x62da('0x13')]){_0x23be32[_0x62da('0x13')]={};}if(_0x2a3d7c){_0x23be32[_0x62da('0x13')][_0x62da('0x14')]=_0x2a3d7c;}else if(_0x23be32[_0x62da('0x13')][_0x62da('0x14')]){delete _0x23be32[_0x62da('0x13')][_0x62da('0x14')];}_0x199b89[_0x62da('0x15')]=utils[_0x62da('0x16')](_0x23be32[_0x62da('0x11')][_0x62da('0x17')],_0x23be32);}catch(_0x1aa4f3){_0x199b89['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0x62da('0x18')](util['format'](_0x62da('0x19'),_0x4cfc5d,_0x1aa4f3[_0x62da('0x1a')]));}io['to'](util[_0x62da('0x1b')]('user:%s',_0x2a3937[_0x62da('0xd')]))['emit'](util[_0x62da('0x1b')](_0x62da('0x1c'),_0xbfd2b0?_0x62da('0x1d'):_0x62da('0x1e')),_0x199b89);}function writeLog(_0x3d015f,_0x267cef,_0x183033){return logger[_0x62da('0x1f')](util[_0x62da('0x1b')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x3d015f,_0x267cef[_0x62da('0xd')],_0x183033));}exports[_0x62da('0x20')]=function(_0x2fd925,_0x1f6f96,_0x35f687,_0x54b936){if(_0x1f6f96[_0x62da('0x21')]){writeLog(_0x2fd925,_0x1f6f96,'BUSY');return![];}if(!_0x1f6f96['online']){writeLog(_0x2fd925,_0x1f6f96,'OFFLINE');return![];}if(_0x1f6f96[_0x35f687+_0x62da('0x22')]){writeLog(_0x2fd925,_0x1f6f96,_0x62da('0x23'));return![];}if(_0x54b936&&_0x1f6f96[_0x62da('0x24')](_0x35f687+_0x62da('0x25'))&&_0x1f6f96['hasOwnProperty'](_0x35f687+_0x62da('0x26'))){if(_0x1f6f96[_0x35f687+_0x62da('0x25')]>0x0&&_0x1f6f96[_0x35f687+'CurrentCapacity']>=_0x1f6f96[_0x35f687+_0x62da('0x25')]){writeLog(_0x2fd925,_0x1f6f96,_0x35f687[_0x62da('0x27')]()+_0x62da('0x28'));return![];}}return!![];};exports['showNotification']=function(_0x41de3a,_0x87f92b,_0x438aa5,_0x54da45,_0x4f5657){return sendNotification(!![],_0x41de3a,_0x87f92b,_0x438aa5,_0x54da45,_0x4f5657);};exports[_0x62da('0x29')]=function(_0x301e3d,_0x220ffc,_0x594c5a,_0x45f67a,_0x2a4681){return sendNotification(![],_0x301e3d,_0x220ffc,_0x594c5a,_0x45f67a,_0x2a4681);};exports[_0x62da('0x2a')]=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 9022e29..96acd92 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 _0xd64b=['routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20%s','stringify','validate','shelljs','./utils','../../../../config/logger'];(function(_0x450deb,_0x2f75d0){var _0xa699f4=function(_0xa05db9){while(--_0xa05db9){_0x450deb['push'](_0x450deb['shift']());}};_0xa699f4(++_0x2f75d0);}(_0xd64b,0x140));var _0xbd64=function(_0xe1fa6b,_0x24c4c9){_0xe1fa6b=_0xe1fa6b-0x0;var _0x16e21f=_0xd64b[_0xe1fa6b];return _0x16e21f;};'use strict';var schema=require(_0xbd64('0x0'));var sh=require(_0xbd64('0x1'));var _=require('lodash');var utils=require(_0xbd64('0x2'));var logger=require(_0xbd64('0x3'))(_0xbd64('0x4'));var system=schema({'command':{'type':_0xbd64('0x5'),'required':!![],'message':_0xbd64('0x6')}});exports[_0xbd64('0x7')]=function(_0x2b8d07,_0x1cac64){return function(_0xb43df3){try{var _0x18b56a={'command':_0x1cac64[0x0]};var _0x577486=system[_0xbd64('0x0')](_0x18b56a,{'typecast':!![]});if(_0x577486[_0xbd64('0x8')]){logger[_0xbd64('0x9')]('[%s][SYSTEM]\x20%s',_0x2b8d07,_[_0xbd64('0xa')](_0x577486,_0xbd64('0xb'))[_0xbd64('0xc')](',\x20'));logger[_0xbd64('0xd')](_0xbd64('0xe'),_0x2b8d07);_0xb43df3[_0xbd64('0xf')]();}else{var _0x53480e=this;var _0x403eba=utils[_0xbd64('0x10')](_0x1cac64[0x0],this);logger[_0xbd64('0xd')](_0xbd64('0x11'),_0x2b8d07,_0x403eba);sh['exec'](_[_0xbd64('0x12')](_0x403eba),function(_0x522b4d,_0x5648c7){logger['info'](_0xbd64('0x13'),_0x2b8d07,_0x522b4d);if(_0x522b4d==0x0){var _0x1225ca=_0x5648c7[_0xbd64('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0xbd64('0x15')](_0x1cac64[0x1])||_[_0xbd64('0x16')](_0x1cac64[0x1])){logger[_0xbd64('0xd')](_0xbd64('0x17'),_0x2b8d07);_0x53480e[_0xbd64('0x18')][_0x1cac64[0x1]]=_0x1225ca;}else{logger[_0xbd64('0xd')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x2b8d07,_0x1cac64[0x1],_0x1225ca);_0x53480e[_0xbd64('0x18')][_0x1cac64[0x1]]=_0x1225ca;}}_0xb43df3[_0xbd64('0xf')]();});}}catch(_0x398bc4){logger[_0xbd64('0x9')](_0xbd64('0x19'),_0x2b8d07,_['isObject'](_0x398bc4)?JSON[_0xbd64('0x1a')](_0x398bc4):_0x398bc4);logger[_0xbd64('0xd')](_0xbd64('0xe'),_0x2b8d07);_0xb43df3['next']();}};}; \ No newline at end of file +var _0x701d=['length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0x701d,0xb1));var _0xd701=function(_0x40fd25,_0x53ca60){_0x40fd25=_0x40fd25-0x0;var _0x3cf4c7=_0x701d[_0x40fd25];return _0x3cf4c7;};'use strict';var schema=require(_0xd701('0x0'));var sh=require(_0xd701('0x1'));var _=require(_0xd701('0x2'));var utils=require(_0xd701('0x3'));var logger=require(_0xd701('0x4'))(_0xd701('0x5'));var system=schema({'command':{'type':_0xd701('0x6'),'required':!![],'message':_0xd701('0x7')}});exports[_0xd701('0x8')]=function(_0xa44253,_0x38594f){return function(_0x5619e0){try{var _0x22fcd2={'command':_0x38594f[0x0]};var _0x4298f9=system[_0xd701('0x0')](_0x22fcd2,{'typecast':!![]});if(_0x4298f9[_0xd701('0x9')]){logger[_0xd701('0xa')](_0xd701('0xb'),_0xa44253,_[_0xd701('0xc')](_0x4298f9,_0xd701('0xd'))[_0xd701('0xe')](',\x20'));logger['info'](_0xd701('0xf'),_0xa44253);_0x5619e0[_0xd701('0x10')]();}else{var _0x3b85ae=this;var _0x150ebe=utils[_0xd701('0x11')](_0x38594f[0x0],this);logger[_0xd701('0x12')](_0xd701('0x13'),_0xa44253,_0x150ebe);sh[_0xd701('0x14')](_[_0xd701('0x15')](_0x150ebe),function(_0x59b2a8,_0x6aa4c7){logger[_0xd701('0x12')](_0xd701('0x16'),_0xa44253,_0x59b2a8);if(_0x59b2a8==0x0){var _0x323a70=_0x6aa4c7[_0xd701('0x17')](/(\r\n|\n|\r)/gm,'');if(_[_0xd701('0x18')](_0x38594f[0x1])||_[_0xd701('0x19')](_0x38594f[0x1])){logger['info'](_0xd701('0x1a'),_0xa44253);_0x3b85ae['body'][_0x38594f[0x1]]=_0x323a70;}else{logger[_0xd701('0x12')](_0xd701('0x1b'),_0xa44253,_0x38594f[0x1],_0x323a70);_0x3b85ae[_0xd701('0x1c')][_0x38594f[0x1]]=_0x323a70;}}_0x5619e0['next']();});}}catch(_0x3b0360){logger['error'](_0xd701('0xb'),_0xa44253,_[_0xd701('0x1d')](_0x3b0360)?JSON[_0xd701('0x1e')](_0x3b0360):_0x3b0360);logger[_0xd701('0x12')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xa44253);_0x5619e0[_0xd701('0x10')]();}};}; \ 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 79d3c83..ca49ec5 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 _0x3e09=['error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','interaction','catch','stringify','finally','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x39667b,_0x23f7c6){var _0x1361c7=function(_0x3a7e5a){while(--_0x3a7e5a){_0x39667b['push'](_0x39667b['shift']());}};_0x1361c7(++_0x23f7c6);}(_0x3e09,0x6e));var _0x93e0=function(_0x31282b,_0xa476db){_0x31282b=_0x31282b-0x0;var _0x19c632=_0x3e09[_0x31282b];return _0x19c632;};'use strict';var schema=require(_0x93e0('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x93e0('0x1')),'openchannelInteraction':require(_0x93e0('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x93e0('0x3')),'faxInteraction':require(_0x93e0('0x4')),'whatsappInteraction':require(_0x93e0('0x5'))};var logger=require(_0x93e0('0x6'))('routing');var tag=schema({'tag':{'type':_0x93e0('0x7'),'required':!![],'message':_0x93e0('0x8')}});exports[_0x93e0('0x9')]=function(_0xd6ff36,_0xe2151b,_0x4e46b4,_0x16cfe2){return function(_0x4163bb){try{var _0x54ed63={'tag':_0xe2151b[0x0]};var _0x3e9e44=tag['validate'](_0x54ed63,{'typecast':!![]});if(_0x3e9e44['length']){logger[_0x93e0('0xa')](_0x93e0('0xb'),_0xd6ff36,_[_0x93e0('0xc')](_0x3e9e44,'message')['join'](',\x20'));logger[_0x93e0('0xd')](_0x93e0('0xe'),_0xd6ff36);_0x4163bb[_0x93e0('0xf')]();}else{var _0x4045c8={'ids':[_0xe2151b[0x0]]};if(rpc[_0x16cfe2['channel']+_0x93e0('0x10')]){rpc[_0x16cfe2[_0x93e0('0x11')]+_0x93e0('0x10')][_0x93e0('0x12')](_0x16cfe2[_0x93e0('0x13')]['id'],_0x4045c8)['then'](function(_0x22235c){logger[_0x93e0('0xd')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0xd6ff36,_0xe2151b[0x1],_0x16cfe2['channel'],_0x16cfe2[_0x93e0('0x13')]['id']);})[_0x93e0('0x14')](function(_0x45706b){logger[_0x93e0('0xa')]('[%s][TAG]\x20%s',_0xd6ff36,JSON[_0x93e0('0x15')](_0x45706b));logger[_0x93e0('0xd')](_0x93e0('0xe'),_0xd6ff36);})[_0x93e0('0x16')](function(){_0x4163bb[_0x93e0('0xf')]();});}}}catch(_0x2f3c64){logger[_0x93e0('0xa')](_0x93e0('0xb'),_0xd6ff36,_[_0x93e0('0x17')](_0x2f3c64)?JSON[_0x93e0('0x15')](_0x2f3c64):_0x2f3c64);logger[_0x93e0('0xd')](_0x93e0('0xe'),_0xd6ff36);_0x4163bb['next']();}};}; \ No newline at end of file +var _0x1231=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','[%s][TAG]\x20%s','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','join','info'];(function(_0x334651,_0x6e99f6){var _0x29657c=function(_0x420a94){while(--_0x420a94){_0x334651['push'](_0x334651['shift']());}};_0x29657c(++_0x6e99f6);}(_0x1231,0x134));var _0x1123=function(_0x281f14,_0x25dccb){_0x281f14=_0x281f14-0x0;var _0x52f32c=_0x1231[_0x281f14];return _0x52f32c;};'use strict';var schema=require(_0x1123('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x1123('0x1')),'openchannelInteraction':require(_0x1123('0x2')),'smsInteraction':require(_0x1123('0x3')),'mailInteraction':require(_0x1123('0x4')),'faxInteraction':require(_0x1123('0x5')),'whatsappInteraction':require(_0x1123('0x6'))};var logger=require(_0x1123('0x7'))(_0x1123('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x1123('0x9')}});exports[_0x1123('0xa')]=function(_0x150d6f,_0x2dd082,_0x30c07b,_0x4dfde6){return function(_0x52d248){try{var _0x172a25={'tag':_0x2dd082[0x0]};var _0x1d5398=tag[_0x1123('0x0')](_0x172a25,{'typecast':!![]});if(_0x1d5398[_0x1123('0xb')]){logger[_0x1123('0xc')]('[%s][TAG]\x20%s',_0x150d6f,_['map'](_0x1d5398,_0x1123('0xd'))[_0x1123('0xe')](',\x20'));logger[_0x1123('0xf')](_0x1123('0x10'),_0x150d6f);_0x52d248[_0x1123('0x11')]();}else{var _0x4d6704={'ids':[_0x2dd082[0x0]]};if(rpc[_0x4dfde6['channel']+_0x1123('0x12')]){rpc[_0x4dfde6[_0x1123('0x13')]+_0x1123('0x12')]['addTags'](_0x4dfde6['interaction']['id'],_0x4d6704)[_0x1123('0x14')](function(_0xdbe0e9){logger['info'](_0x1123('0x15'),_0x150d6f,_0x2dd082[0x1],_0x4dfde6[_0x1123('0x13')],_0x4dfde6[_0x1123('0x16')]['id']);})[_0x1123('0x17')](function(_0x2b85a0){logger[_0x1123('0xc')]('[%s][TAG]\x20%s',_0x150d6f,JSON[_0x1123('0x18')](_0x2b85a0));logger[_0x1123('0xf')](_0x1123('0x10'),_0x150d6f);})[_0x1123('0x19')](function(){_0x52d248[_0x1123('0x11')]();});}}}catch(_0x305fe2){logger[_0x1123('0xc')](_0x1123('0x1a'),_0x150d6f,_['isObject'](_0x305fe2)?JSON['stringify'](_0x305fe2):_0x305fe2);logger['info'](_0x1123('0x10'),_0x150d6f);_0x52d248[_0x1123('0x11')]();}};}; \ 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 6ff26e4..635746c 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 _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x3c1900,_0x4f3ff2){var _0x2c48ca=function(_0x5101c0){while(--_0x5101c0){_0x3c1900['push'](_0x3c1900['shift']());}};_0x2c48ca(++_0x4f3ff2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x5be3c2,_0x1cb3d3){var _0x5a242e=function(_0x2f804c){while(--_0x2f804c){_0x5be3c2['push'](_0x5be3c2['shift']());}};_0x5a242e(++_0x1cb3d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 2cacb60..2942b98 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 _0x3521=['message\x20is\x20empty','busy','busyQueue','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','../../../config/environment','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','IntervalId','isNil','Intervals','map','interval','listen','channel','message','applications','length','existsSync','join','app','.js','toLowerCase','appdata','mail','push','slice','dialogflow','split','dialogflowv2','tag','TagId','%s:%s:%s','condition','intervals','./applications/','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','matchPath','emit','No\x20applications\x20to\x20execute','stack','agent','agents','interaction','QueueReport','update','UserId','error\x20update\x20queue\x20report'];(function(_0x3c729b,_0x2a4146){var _0x55894c=function(_0x183a16){while(--_0x183a16){_0x3c729b['push'](_0x3c729b['shift']());}};_0x55894c(++_0x2a4146);}(_0x3521,0x183));var _0x1352=function(_0x1f4c0b,_0x28f740){_0x1f4c0b=_0x1f4c0b-0x0;var _0xa2eddb=_0x3521[_0x1f4c0b];return _0xa2eddb;};'use strict';var _=require(_0x1352('0x0'));var util=require(_0x1352('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x1352('0x2'));var BPromise=require(_0x1352('0x3'));var uuid=require('uuid');var config=require(_0x1352('0x4'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0x1352('0x5')),'mailQueueReport':require(_0x1352('0x6')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x1352('0x7')),'faxQueueReport':require(_0x1352('0x8')),'whatsappQueueReport':require(_0x1352('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x2e1c91,_0x1cbfcf,_0x21db13){return util['format']('%s.%s.%s',_0x2e1c91,_0x1cbfcf||0x0,_0x21db13||0x0);}function getIntervals(_0x212e2c,_0x417fca){var _0x1c2acb=[];if(!_['isNil'](_0x417fca[_0x1352('0xa')])&&!_[_0x1352('0xb')](_0x212e2c[_0x417fca['IntervalId']])&&!_[_0x1352('0xb')](_0x212e2c[_0x417fca[_0x1352('0xa')]][_0x1352('0xc')])){_0x1c2acb=_[_0x1352('0xd')](_0x212e2c[_0x417fca[_0x1352('0xa')]][_0x1352('0xc')],_0x1352('0xe'));}else if(!_[_0x1352('0xb')](_0x417fca[_0x1352('0xe')])){_0x1c2acb=[_0x417fca[_0x1352('0xe')]];}return _0x1c2acb;}exports[_0x1352('0xf')]=function(_0x2187ae){_0x2187ae['rules']={};return new BPromise(function(_0x3e77ce,_0x3c6b22){var _0x3da107={'Start':function(_0x1b3fc8){var _0x494d40=this;return new Promise(function(_0x3f1f11,_0x5172fd){if(_0x1b3fc8){try{var _0x22f31d=[];var _0x505dfe=getId(_0x1b3fc8[_0x1352('0x10')],_0x1b3fc8['message']?_0x1b3fc8[_0x1352('0x11')]['id']:0x0,_0x1b3fc8['interaction']?_0x1b3fc8['interaction']['id']:0x0);if(_0x1b3fc8[_0x1352('0x12')]&&_['isArray'](_0x1b3fc8[_0x1352('0x12')])&&_0x1b3fc8[_0x1352('0x12')][_0x1352('0x13')]){for(var _0x357afa=0x0;_0x357afa<_0x1b3fc8[_0x1352('0x12')][_0x1352('0x13')];_0x357afa+=0x1){var _0x5cd001=_0x1b3fc8[_0x1352('0x12')][_0x357afa];if(fs[_0x1352('0x14')](path[_0x1352('0x15')](__dirname,'applications',_0x5cd001[_0x1352('0x16')]+_0x1352('0x17')))){var _0xe9c3eb=[];switch(_0x5cd001[_0x1352('0x16')][_0x1352('0x18')]()){case'autoreply':var _0x7384af=_0x5cd001[_0x1352('0x19')]['split'](',');if(_0x1b3fc8[_0x1352('0x10')]===_0x1352('0x1a')){_0xe9c3eb['push'](_0x7384af[0x0]);_0xe9c3eb[_0x1352('0x1b')](_0x7384af[0x1]);_0xe9c3eb[_0x1352('0x1b')](_0x7384af[_0x1352('0x1c')](0x2,_0x7384af['length'])['join'](','));}else{_0xe9c3eb['push'](_0x7384af[0x0]);_0xe9c3eb['push'](_0x7384af['slice'](0x1,_0x7384af[_0x1352('0x13')])['join'](','));}break;case _0x1352('0x1d'):var _0x481890=_0x5cd001['appdata'][_0x1352('0x1e')](',');_0xe9c3eb['push'](_0x481890[0x0]);_0xe9c3eb[_0x1352('0x1b')](_0x481890[0x1]);_0xe9c3eb['push'](_0x481890[_0x1352('0x1c')](0x2,_0x481890['length'])[_0x1352('0x15')](','));break;case _0x1352('0x1f'):var _0x16ca1a=_0x5cd001[_0x1352('0x19')][_0x1352('0x1e')](',');_0xe9c3eb[_0x1352('0x1b')](_0x16ca1a[0x0]);_0xe9c3eb[_0x1352('0x1b')](_0x16ca1a[0x1]);_0xe9c3eb[_0x1352('0x1b')](_0x16ca1a[0x2]);_0xe9c3eb[_0x1352('0x1b')](_0x16ca1a[0x3]);_0xe9c3eb['push'](_0x16ca1a[_0x1352('0x1c')](0x4,_0x16ca1a[_0x1352('0x13')])[_0x1352('0x15')](','));break;case'amazonlex':var _0x116828=_0x5cd001[_0x1352('0x19')][_0x1352('0x1e')](',');_0xe9c3eb[_0x1352('0x1b')](_0x116828[0x0]);_0xe9c3eb[_0x1352('0x1b')](_0x116828[0x1]);_0xe9c3eb['push'](_0x116828[0x2]);_0xe9c3eb[_0x1352('0x1b')](_0x116828[0x3]);_0xe9c3eb[_0x1352('0x1b')](_0x116828[_0x1352('0x1c')](0x4,_0x116828['length'])[_0x1352('0x15')](','));break;case'message':_0xe9c3eb['push'](_0x5cd001[_0x1352('0x19')]);break;case _0x1352('0x20'):_0xe9c3eb['push'](_0x5cd001[_0x1352('0x21')]);_0xe9c3eb['push'](_0x5cd001['appdata']);break;default:_0xe9c3eb=_[_0x1352('0xb')](_0x5cd001[_0x1352('0x19')])?[]:_0x5cd001[_0x1352('0x19')][_0x1352('0x1e')](',');}var _0x36e537={'id':util['format'](_0x1352('0x22'),_0x505dfe,_0x5cd001['id'],_0x5cd001[_0x1352('0x16')]),'condition':require('./interval')[_0x1352('0x23')](_0x505dfe,getIntervals(_0x2187ae[_0x1352('0x24')],_0x5cd001),_0x2187ae),'consequence':require(_0x1352('0x25')+_0x5cd001[_0x1352('0x16')])['consequence'](_0x505dfe,_0xe9c3eb,_0x2187ae,_0x1b3fc8),'p':_0x5cd001['priority']||0x0};logger[_0x1352('0x26')](_0x1352('0x27'),_0x36e537['id'],_0x1352('0x28'),getIntervals(_0x2187ae[_0x1352('0x24')],_0x5cd001)[_0x1352('0x15')](_0x1352('0x29')));_0x22f31d[_0x1352('0x1b')](_0x36e537);}else{logger[_0x1352('0x2a')](_0x1352('0x2b'),path['join'](__dirname,'applications',_0x5cd001['app']+_0x1352('0x17')));}}_0x2187ae['rules'][_0x505dfe]=new RuleEngine(_0x22f31d);_0x2187ae[_0x1352('0x2c')][_0x505dfe][_0x1352('0x2d')](_0x1b3fc8,function(_0x19acbd){logger['info'](_0x1352('0x2e'),JSON['stringify'](_0x19acbd[_0x1352('0x2f')]));if(_0x2187ae[_0x1352('0x2c')][_0x505dfe]){_0x2187ae['rules'][_0x505dfe][_0x1352('0x30')]('complete');}});return _0x3f1f11({'code':0xc8,'message':_0x1b3fc8});}else{logger[_0x1352('0x26')](_0x1352('0x31'));return _0x3f1f11({'code':0xc8,'message':_0x1b3fc8});}}catch(_0x3edc39){logger['error'](_0x3edc39[_0x1352('0x32')]);return _0x5172fd(_0x494d40[_0x1352('0x2a')](0x1f4,_0x3edc39));}}return _0x5172fd('routing\x20is\x20empty');});},'AcceptMessage':function(_0x50afb5){var _0x2b9ae2=this;return new Promise(function(_0x5e50f6,_0x4ac113){if(_0x50afb5[_0x1352('0x33')]&&_0x50afb5[_0x1352('0x33')]['id']){if(_0x2187ae[_0x1352('0x34')][_0x50afb5[_0x1352('0x33')]['id']]){_0x2187ae[_0x1352('0x34')][_0x50afb5[_0x1352('0x33')]['id']]['busy']=![];_0x2187ae[_0x1352('0x34')][_0x50afb5['agent']['id']]['busyQueue']=undefined;}}if(_0x50afb5[_0x1352('0x11')]&&_0x50afb5[_0x1352('0x11')]['id']){try{var _0x4fa56a=getId(_0x50afb5['channel'],_0x50afb5[_0x1352('0x11')]?_0x50afb5[_0x1352('0x11')]['id']:0x0,_0x50afb5[_0x1352('0x35')]?_0x50afb5[_0x1352('0x35')]['id']:0x0);if(_0x2187ae[_0x1352('0x2c')][_0x4fa56a]){_0x2187ae['rules'][_0x4fa56a][_0x1352('0x30')]('end');if(rpc[_0x50afb5[_0x1352('0x10')]+'QueueReport']){rpc[_0x50afb5[_0x1352('0x10')]+_0x1352('0x36')][_0x1352('0x37')](_0x4fa56a,{'UserId':_0x50afb5[_0x1352('0x11')][_0x1352('0x38')]})['catch'](function(_0x4854e6){logger[_0x1352('0x2a')](_0x1352('0x39'));});}}return _0x5e50f6({'code':0xc8,'message':_0x50afb5});}catch(_0xa2eb04){logger[_0x1352('0x2a')](_0xa2eb04[_0x1352('0x32')]);return _0x4ac113(_0x2b9ae2[_0x1352('0x2a')](0x1f4,_0xa2eb04));}}logger[_0x1352('0x2a')](_0x1352('0x3a'));return _0x4ac113(_0x2b9ae2[_0x1352('0x2a')](0x1f4,_0x1352('0x3a')));});},'RejectMessage':function(_0x3f0432){var _0x14172e=this;return new Promise(function(_0x12d063,_0x197841){if(_0x3f0432['agent']&&_0x3f0432['agent']['id']){try{if(_0x2187ae[_0x1352('0x34')][_0x3f0432[_0x1352('0x33')]['id']]){_0x2187ae[_0x1352('0x34')][_0x3f0432[_0x1352('0x33')]['id']][_0x1352('0x3b')]=![];_0x2187ae['agents'][_0x3f0432[_0x1352('0x33')]['id']][_0x1352('0x3c')]=undefined;}return _0x12d063({'code':0xc8,'message':_0x3f0432});}catch(_0x4baa8e){logger[_0x1352('0x2a')](_0x4baa8e[_0x1352('0x32')]);return _0x197841(_0x14172e[_0x1352('0x2a')](0x1f4,_0x4baa8e));}}logger['error'](_0x1352('0x3a'));return _0x197841(_0x14172e['error'](0x1f4,_0x1352('0x3a')));});},'AbandonInteraction':function(_0x5d53ea){var _0x115a9c=this;return new Promise(function(_0xc28e2d,_0x52ce33){if(_0x5d53ea[_0x1352('0x10')]&&_0x5d53ea['interaction']&&_0x5d53ea[_0x1352('0x35')]['id']){try{var _0x41a711=getId(_0x5d53ea['channel'],_0x5d53ea['message']?_0x5d53ea[_0x1352('0x11')]['id']:0x0,_0x5d53ea[_0x1352('0x35')]?_0x5d53ea[_0x1352('0x35')]['id']:0x0);if(_0x2187ae[_0x1352('0x2c')][_0x41a711]){_0x2187ae[_0x1352('0x2c')][_0x41a711][_0x1352('0x30')](_0x1352('0x3d'));}return _0xc28e2d({'code':0xc8,'message':_0x5d53ea});}catch(_0x1fa23d){logger[_0x1352('0x2a')](_0x1fa23d[_0x1352('0x32')]);return _0x52ce33(_0x115a9c[_0x1352('0x2a')](0x1f4,_0x1fa23d));}}logger['error']('message\x20is\x20empty');return _0x52ce33(_0x115a9c[_0x1352('0x2a')](0x1f4,_0x1352('0x3a')));});},'AgentCapacity':function(_0x3622e2){var _0x2edd19=this;return new Promise(function(_0x360e99,_0x581d1f){if(_0x2187ae['agents'][_0x1352('0x3e')](_0x3622e2['id'])){for(var _0x21f6d1 in _0x3622e2[_0x1352('0x3f')]){if(_0x3622e2['capacity'][_0x1352('0x3e')](_0x21f6d1)){if(_0x2187ae['agents'][_0x3622e2['id']][_0x1352('0x3e')](_0x21f6d1+_0x1352('0x40'))){_0x2187ae['agents'][_0x3622e2['id']][_0x21f6d1+'CurrentCapacity']=parseInt(_0x3622e2[_0x1352('0x3f')][_0x21f6d1],0xa);}}}_0x2187ae[_0x1352('0x34')][_0x3622e2['id']][_0x1352('0x41')]();return _0x360e99({'code':0xc8,'message':_0x2187ae[_0x1352('0x34')][_0x3622e2['id']]});}else{return _0x581d1f(_0x2edd19[_0x1352('0x2a')](0x1f4,_0x1352('0x42')));}});},'Agents':function(_0x2d4fdf){return new Promise(function(_0xcc819c,_0x1f37bf){var _0xf6a5d6=_[_0x1352('0x43')](_0x2187ae['agents']);_0xcc819c({'count':_0xf6a5d6[_0x1352('0x13')],'rows':_0xf6a5d6});});},'ChatQueues':function(_0x4bc0ca){return new Promise(function(_0x561308,_0x414c0f){var _0x3ad2=[];for(var _0x713a82 in _0x2187ae[_0x1352('0x44')]){if(_0x2187ae[_0x1352('0x44')]['hasOwnProperty'](_0x713a82)){var _0x3b24da=_0x2187ae['chatQueues'][_0x713a82];var _0x5c1e64={'id':_0x3b24da['id'],'available':_0x3b24da[_0x1352('0x45')],'loggedIn':_0x3b24da['loggedIn'],'name':_0x3b24da[_0x1352('0x46')],'paused':_0x3b24da[_0x1352('0x47')],'waiting':_0x3b24da[_0x1352('0x48')]};_0x3ad2[_0x1352('0x1b')](_0x5c1e64);}}_0x561308({'count':_0x3ad2['length'],'rows':_0x3ad2});});},'MailQueues':function(_0x189607){return new Promise(function(_0x45e2fc,_0x4ac291){var _0x210c3d=[];for(var _0x509de6 in _0x2187ae['mailQueues']){if(_0x2187ae['mailQueues']['hasOwnProperty'](_0x509de6)){var _0x56a8bf=_0x2187ae[_0x1352('0x49')][_0x509de6];var _0x51a0e7={'id':_0x56a8bf['id'],'available':_0x56a8bf[_0x1352('0x45')],'loggedIn':_0x56a8bf['loggedIn'],'name':_0x56a8bf['name'],'paused':_0x56a8bf['paused'],'waiting':_0x56a8bf[_0x1352('0x48')]};_0x210c3d[_0x1352('0x1b')](_0x51a0e7);}}_0x45e2fc({'count':_0x210c3d[_0x1352('0x13')],'rows':_0x210c3d});});},'OpenchannelQueues':function(_0xccb0e5){return new Promise(function(_0x2b882d,_0x399620){var _0x72fd1c=[];for(var _0x44eb1b in _0x2187ae[_0x1352('0x4a')]){if(_0x2187ae[_0x1352('0x4a')][_0x1352('0x3e')](_0x44eb1b)){var _0x4660fc=_0x2187ae[_0x1352('0x4a')][_0x44eb1b];var _0x328749={'id':_0x4660fc['id'],'available':_0x4660fc['available'],'loggedIn':_0x4660fc[_0x1352('0x4b')],'name':_0x4660fc[_0x1352('0x46')],'paused':_0x4660fc[_0x1352('0x47')],'waiting':_0x4660fc[_0x1352('0x48')]};_0x72fd1c[_0x1352('0x1b')](_0x328749);}}_0x2b882d({'count':_0x72fd1c['length'],'rows':_0x72fd1c});});},'SmsQueues':function(_0x3baf39){return new Promise(function(_0x4e743d,_0x5879ed){var _0x3a69a8=[];for(var _0x1065a1 in _0x2187ae[_0x1352('0x4c')]){if(_0x2187ae['smsQueues'][_0x1352('0x3e')](_0x1065a1)){var _0x47a84c=_0x2187ae[_0x1352('0x4c')][_0x1065a1];var _0x52fe7f={'id':_0x47a84c['id'],'available':_0x47a84c[_0x1352('0x45')],'loggedIn':_0x47a84c[_0x1352('0x4b')],'name':_0x47a84c[_0x1352('0x46')],'paused':_0x47a84c[_0x1352('0x47')],'waiting':_0x47a84c['waiting']};_0x3a69a8['push'](_0x52fe7f);}}_0x4e743d({'count':_0x3a69a8['length'],'rows':_0x3a69a8});});},'FaxQueues':function(_0x1d0ec3){return new Promise(function(_0x3353de,_0x2f1757){var _0xc8b588=[];for(var _0x437d9d in _0x2187ae[_0x1352('0x4d')]){if(_0x2187ae['faxQueues'][_0x1352('0x3e')](_0x437d9d)){var _0x2d5c79=_0x2187ae[_0x1352('0x4d')][_0x437d9d];var _0xb9470e={'id':_0x2d5c79['id'],'available':_0x2d5c79[_0x1352('0x45')],'loggedIn':_0x2d5c79[_0x1352('0x4b')],'name':_0x2d5c79[_0x1352('0x46')],'paused':_0x2d5c79[_0x1352('0x47')],'waiting':_0x2d5c79[_0x1352('0x48')]};_0xc8b588[_0x1352('0x1b')](_0xb9470e);}}_0x3353de({'count':_0xc8b588[_0x1352('0x13')],'rows':_0xc8b588});});},'WhatsappQueues':function(_0x498c2a){return new Promise(function(_0x33104b,_0x483b62){var _0x4190dc=[];for(var _0x41611d in _0x2187ae['whatsappQueues']){if(_0x2187ae[_0x1352('0x4e')][_0x1352('0x3e')](_0x41611d)){var _0x12140a=_0x2187ae[_0x1352('0x4e')][_0x41611d];var _0x39c9d1={'id':_0x12140a['id'],'available':_0x12140a[_0x1352('0x45')],'loggedIn':_0x12140a[_0x1352('0x4b')],'name':_0x12140a['name'],'paused':_0x12140a[_0x1352('0x47')],'waiting':_0x12140a[_0x1352('0x48')]};_0x4190dc[_0x1352('0x1b')](_0x39c9d1);}}_0x33104b({'count':_0x4190dc['length'],'rows':_0x4190dc});});},'ChatQueuesWaitingInteractions':function(_0x4a6295){return new Promise(function(_0x1a1881,_0x2d1e72){var _0x473639=_[_0x1352('0x43')](_0x2187ae[_0x1352('0x4f')]);_0x1a1881({'count':_0x473639[_0x1352('0x13')],'rows':_0x473639});});},'MailQueuesWaitingInteractions':function(_0x2122e4){return new Promise(function(_0xf6e436,_0x3f42ee){var _0x19c005=_[_0x1352('0x43')](_0x2187ae['mailQueuesWaitingInteractions']);_0xf6e436({'count':_0x19c005[_0x1352('0x13')],'rows':_0x19c005});});},'OpenchannelQueuesWaitingInteractions':function(_0x48ee96){return new Promise(function(_0x5263a9,_0x3991c7){var _0x7949d3=_[_0x1352('0x43')](_0x2187ae['openchannelQueuesWaitingInteractions']);_0x5263a9({'count':_0x7949d3[_0x1352('0x13')],'rows':_0x7949d3});});},'SmsQueuesWaitingInteractions':function(_0xfcd07){return new Promise(function(_0x3579a5,_0x4d75a4){var _0x58a594=_[_0x1352('0x43')](_0x2187ae[_0x1352('0x50')]);_0x3579a5({'count':_0x58a594[_0x1352('0x13')],'rows':_0x58a594});});},'FaxQueuesWaitingInteractions':function(_0x4e9a64){return new Promise(function(_0x541f8e,_0x5b00ee){var _0x3643ef=_[_0x1352('0x43')](_0x2187ae[_0x1352('0x51')]);_0x541f8e({'count':_0x3643ef[_0x1352('0x13')],'rows':_0x3643ef});});},'WhatsappQueuesWaitingInteractions':function(_0x3792a1){return new Promise(function(_0x1e5a27,_0x4f61ef){var _0x5e84c2=_[_0x1352('0x43')](_0x2187ae[_0x1352('0x52')]);_0x1e5a27({'count':_0x5e84c2[_0x1352('0x13')],'rows':_0x5e84c2});});}};var _0x39e64a=jayson[_0x1352('0x53')](_0x3da107)[_0x1352('0x54')]();_0x39e64a['on'](_0x1352('0x2a'),function(_0x119b4a){logger[_0x1352('0x2a')](JSON[_0x1352('0x55')](_0x119b4a));return _0x3c6b22(_0x119b4a);});_0x39e64a[_0x1352('0xf')](0x232c,_0x1352('0x56'),function(){console['log'](_0x1352('0x57'),0x232c);return _0x3e77ce(_0x1352('0x58')+0x232c);});});}; \ No newline at end of file +var _0x6e8e=['toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','%s:%s:%s','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agent','busy','busyQueue','end','channel','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','agents','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','interval','listen','rules','message','interaction','applications','length','existsSync','join','.js','app'];(function(_0x22f695,_0x39cabe){var _0x5bb9e2=function(_0x4ea1f0){while(--_0x4ea1f0){_0x22f695['push'](_0x22f695['shift']());}};_0x5bb9e2(++_0x39cabe);}(_0x6e8e,0xa4));var _0xe6e8=function(_0x506b12,_0x240e61){_0x506b12=_0x506b12-0x0;var _0x319772=_0x6e8e[_0x506b12];return _0x319772;};'use strict';var _=require(_0xe6e8('0x0'));var util=require(_0xe6e8('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require(_0xe6e8('0x2'));var config=require(_0xe6e8('0x3'));var logger=require(_0xe6e8('0x4'))(_0xe6e8('0x5'));var rpc={'openchannelQueueReport':require(_0xe6e8('0x6')),'mailQueueReport':require(_0xe6e8('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xe6e8('0x8')),'faxQueueReport':require(_0xe6e8('0x9')),'whatsappQueueReport':require(_0xe6e8('0xa'))};var RuleEngine=require(_0xe6e8('0xb'));function getId(_0x4111b6,_0x34b95d,_0x295fd7){return util[_0xe6e8('0xc')](_0xe6e8('0xd'),_0x4111b6,_0x34b95d||0x0,_0x295fd7||0x0);}function getIntervals(_0x5dbf6a,_0x4de073){var _0x3dec40=[];if(!_[_0xe6e8('0xe')](_0x4de073[_0xe6e8('0xf')])&&!_[_0xe6e8('0xe')](_0x5dbf6a[_0x4de073[_0xe6e8('0xf')]])&&!_[_0xe6e8('0xe')](_0x5dbf6a[_0x4de073[_0xe6e8('0xf')]]['Intervals'])){_0x3dec40=_[_0xe6e8('0x10')](_0x5dbf6a[_0x4de073['IntervalId']]['Intervals'],_0xe6e8('0x11'));}else if(!_['isNil'](_0x4de073['interval'])){_0x3dec40=[_0x4de073[_0xe6e8('0x11')]];}return _0x3dec40;}exports[_0xe6e8('0x12')]=function(_0x1596e7){_0x1596e7[_0xe6e8('0x13')]={};return new BPromise(function(_0x5719fb,_0x2c2aa0){var _0x439299={'Start':function(_0x317aef){var _0x3b0b38=this;return new Promise(function(_0x207a33,_0x9d7d2c){if(_0x317aef){try{var _0x498238=[];var _0x5e8447=getId(_0x317aef['channel'],_0x317aef[_0xe6e8('0x14')]?_0x317aef['message']['id']:0x0,_0x317aef[_0xe6e8('0x15')]?_0x317aef['interaction']['id']:0x0);if(_0x317aef[_0xe6e8('0x16')]&&_['isArray'](_0x317aef[_0xe6e8('0x16')])&&_0x317aef[_0xe6e8('0x16')][_0xe6e8('0x17')]){for(var _0x10c9d2=0x0;_0x10c9d2<_0x317aef[_0xe6e8('0x16')][_0xe6e8('0x17')];_0x10c9d2+=0x1){var _0x411bf7=_0x317aef[_0xe6e8('0x16')][_0x10c9d2];if(fs[_0xe6e8('0x18')](path[_0xe6e8('0x19')](__dirname,_0xe6e8('0x16'),_0x411bf7['app']+_0xe6e8('0x1a')))){var _0x126137=[];switch(_0x411bf7[_0xe6e8('0x1b')][_0xe6e8('0x1c')]()){case _0xe6e8('0x1d'):var _0x485d7b=_0x411bf7[_0xe6e8('0x1e')][_0xe6e8('0x1f')](',');if(_0x317aef['channel']===_0xe6e8('0x20')){_0x126137[_0xe6e8('0x21')](_0x485d7b[0x0]);_0x126137[_0xe6e8('0x21')](_0x485d7b[0x1]);_0x126137['push'](_0x485d7b[_0xe6e8('0x22')](0x2,_0x485d7b['length'])[_0xe6e8('0x19')](','));}else{_0x126137['push'](_0x485d7b[0x0]);_0x126137[_0xe6e8('0x21')](_0x485d7b[_0xe6e8('0x22')](0x1,_0x485d7b[_0xe6e8('0x17')])['join'](','));}break;case _0xe6e8('0x23'):var _0x50b019=_0x411bf7[_0xe6e8('0x1e')][_0xe6e8('0x1f')](',');_0x126137['push'](_0x50b019[0x0]);_0x126137[_0xe6e8('0x21')](_0x50b019[0x1]);_0x126137[_0xe6e8('0x21')](_0x50b019[_0xe6e8('0x22')](0x2,_0x50b019[_0xe6e8('0x17')])['join'](','));break;case _0xe6e8('0x24'):var _0x1fac43=_0x411bf7[_0xe6e8('0x1e')][_0xe6e8('0x1f')](',');_0x126137['push'](_0x1fac43[0x0]);_0x126137[_0xe6e8('0x21')](_0x1fac43[0x1]);_0x126137[_0xe6e8('0x21')](_0x1fac43[0x2]);_0x126137[_0xe6e8('0x21')](_0x1fac43[0x3]);_0x126137[_0xe6e8('0x21')](_0x1fac43[_0xe6e8('0x22')](0x4,_0x1fac43[_0xe6e8('0x17')])[_0xe6e8('0x19')](','));break;case _0xe6e8('0x25'):var _0xf4456a=_0x411bf7['appdata']['split'](',');_0x126137[_0xe6e8('0x21')](_0xf4456a[0x0]);_0x126137[_0xe6e8('0x21')](_0xf4456a[0x1]);_0x126137[_0xe6e8('0x21')](_0xf4456a[0x2]);_0x126137['push'](_0xf4456a[0x3]);_0x126137[_0xe6e8('0x21')](_0xf4456a[_0xe6e8('0x22')](0x4,_0xf4456a[_0xe6e8('0x17')])[_0xe6e8('0x19')](','));break;case'message':_0x126137[_0xe6e8('0x21')](_0x411bf7[_0xe6e8('0x1e')]);break;case'tag':_0x126137['push'](_0x411bf7[_0xe6e8('0x26')]);_0x126137[_0xe6e8('0x21')](_0x411bf7['appdata']);break;default:_0x126137=_[_0xe6e8('0xe')](_0x411bf7['appdata'])?[]:_0x411bf7['appdata'][_0xe6e8('0x1f')](',');}var _0x4e6778={'id':util[_0xe6e8('0xc')](_0xe6e8('0x27'),_0x5e8447,_0x411bf7['id'],_0x411bf7[_0xe6e8('0x1b')]),'condition':require('./interval')[_0xe6e8('0x28')](_0x5e8447,getIntervals(_0x1596e7[_0xe6e8('0x29')],_0x411bf7),_0x1596e7),'consequence':require(_0xe6e8('0x2a')+_0x411bf7[_0xe6e8('0x1b')])[_0xe6e8('0x2b')](_0x5e8447,_0x126137,_0x1596e7,_0x317aef),'p':_0x411bf7[_0xe6e8('0x2c')]||0x0};logger[_0xe6e8('0x2d')](_0xe6e8('0x2e'),_0x4e6778['id'],_0xe6e8('0x2f'),getIntervals(_0x1596e7[_0xe6e8('0x29')],_0x411bf7)['join']('\x20|\x20'));_0x498238[_0xe6e8('0x21')](_0x4e6778);}else{logger[_0xe6e8('0x30')](_0xe6e8('0x31'),path['join'](__dirname,'applications',_0x411bf7[_0xe6e8('0x1b')]+_0xe6e8('0x1a')));}}_0x1596e7[_0xe6e8('0x13')][_0x5e8447]=new RuleEngine(_0x498238);_0x1596e7[_0xe6e8('0x13')][_0x5e8447][_0xe6e8('0x32')](_0x317aef,function(_0x4f79ef){logger[_0xe6e8('0x2d')](_0xe6e8('0x33'),JSON[_0xe6e8('0x34')](_0x4f79ef[_0xe6e8('0x35')]));if(_0x1596e7[_0xe6e8('0x13')][_0x5e8447]){_0x1596e7[_0xe6e8('0x13')][_0x5e8447][_0xe6e8('0x36')](_0xe6e8('0x37'));}});return _0x207a33({'code':0xc8,'message':_0x317aef});}else{logger[_0xe6e8('0x2d')](_0xe6e8('0x38'));return _0x207a33({'code':0xc8,'message':_0x317aef});}}catch(_0x2f36b1){logger['error'](_0x2f36b1[_0xe6e8('0x39')]);return _0x9d7d2c(_0x3b0b38['error'](0x1f4,_0x2f36b1));}}return _0x9d7d2c('routing\x20is\x20empty');});},'AcceptMessage':function(_0x3f8dc0){var _0x4b1a7e=this;return new Promise(function(_0x1e05cc,_0x55ee2a){if(_0x3f8dc0[_0xe6e8('0x3a')]&&_0x3f8dc0['agent']['id']){if(_0x1596e7['agents'][_0x3f8dc0[_0xe6e8('0x3a')]['id']]){_0x1596e7['agents'][_0x3f8dc0[_0xe6e8('0x3a')]['id']][_0xe6e8('0x3b')]=![];_0x1596e7['agents'][_0x3f8dc0[_0xe6e8('0x3a')]['id']][_0xe6e8('0x3c')]=undefined;}}if(_0x3f8dc0[_0xe6e8('0x14')]&&_0x3f8dc0['message']['id']){try{var _0x39ff99=getId(_0x3f8dc0['channel'],_0x3f8dc0['message']?_0x3f8dc0[_0xe6e8('0x14')]['id']:0x0,_0x3f8dc0['interaction']?_0x3f8dc0[_0xe6e8('0x15')]['id']:0x0);if(_0x1596e7[_0xe6e8('0x13')][_0x39ff99]){_0x1596e7[_0xe6e8('0x13')][_0x39ff99]['emit'](_0xe6e8('0x3d'));if(rpc[_0x3f8dc0[_0xe6e8('0x3e')]+_0xe6e8('0x3f')]){rpc[_0x3f8dc0[_0xe6e8('0x3e')]+_0xe6e8('0x3f')][_0xe6e8('0x40')](_0x39ff99,{'UserId':_0x3f8dc0[_0xe6e8('0x14')][_0xe6e8('0x41')]})['catch'](function(_0x188b2c){logger['error'](_0xe6e8('0x42'));});}}return _0x1e05cc({'code':0xc8,'message':_0x3f8dc0});}catch(_0xf3bf56){logger[_0xe6e8('0x30')](_0xf3bf56['stack']);return _0x55ee2a(_0x4b1a7e['error'](0x1f4,_0xf3bf56));}}logger[_0xe6e8('0x30')](_0xe6e8('0x43'));return _0x55ee2a(_0x4b1a7e[_0xe6e8('0x30')](0x1f4,_0xe6e8('0x43')));});},'RejectMessage':function(_0x2e331e){var _0x56cfdc=this;return new Promise(function(_0x2211dc,_0x879f78){if(_0x2e331e[_0xe6e8('0x3a')]&&_0x2e331e['agent']['id']){try{if(_0x1596e7['agents'][_0x2e331e['agent']['id']]){_0x1596e7[_0xe6e8('0x44')][_0x2e331e[_0xe6e8('0x3a')]['id']][_0xe6e8('0x3b')]=![];_0x1596e7[_0xe6e8('0x44')][_0x2e331e[_0xe6e8('0x3a')]['id']][_0xe6e8('0x3c')]=undefined;}return _0x2211dc({'code':0xc8,'message':_0x2e331e});}catch(_0x24a84c){logger[_0xe6e8('0x30')](_0x24a84c[_0xe6e8('0x39')]);return _0x879f78(_0x56cfdc['error'](0x1f4,_0x24a84c));}}logger['error'](_0xe6e8('0x43'));return _0x879f78(_0x56cfdc[_0xe6e8('0x30')](0x1f4,_0xe6e8('0x43')));});},'AbandonInteraction':function(_0x1a0b04){var _0x1c84bc=this;return new Promise(function(_0x38357e,_0xc15fe1){if(_0x1a0b04[_0xe6e8('0x3e')]&&_0x1a0b04[_0xe6e8('0x15')]&&_0x1a0b04[_0xe6e8('0x15')]['id']){try{var _0x1b2d4e=getId(_0x1a0b04[_0xe6e8('0x3e')],_0x1a0b04[_0xe6e8('0x14')]?_0x1a0b04[_0xe6e8('0x14')]['id']:0x0,_0x1a0b04[_0xe6e8('0x15')]?_0x1a0b04[_0xe6e8('0x15')]['id']:0x0);if(_0x1596e7['rules'][_0x1b2d4e]){_0x1596e7[_0xe6e8('0x13')][_0x1b2d4e][_0xe6e8('0x36')](_0xe6e8('0x3d'));}return _0x38357e({'code':0xc8,'message':_0x1a0b04});}catch(_0x511688){logger[_0xe6e8('0x30')](_0x511688['stack']);return _0xc15fe1(_0x1c84bc['error'](0x1f4,_0x511688));}}logger[_0xe6e8('0x30')]('message\x20is\x20empty');return _0xc15fe1(_0x1c84bc['error'](0x1f4,_0xe6e8('0x43')));});},'AgentCapacity':function(_0x41935c){var _0x3af7c8=this;return new Promise(function(_0x57e8f,_0x4eea88){if(_0x1596e7[_0xe6e8('0x44')][_0xe6e8('0x45')](_0x41935c['id'])){for(var _0x396b2f in _0x41935c[_0xe6e8('0x46')]){if(_0x41935c[_0xe6e8('0x46')][_0xe6e8('0x45')](_0x396b2f)){if(_0x1596e7[_0xe6e8('0x44')][_0x41935c['id']][_0xe6e8('0x45')](_0x396b2f+_0xe6e8('0x47'))){_0x1596e7[_0xe6e8('0x44')][_0x41935c['id']][_0x396b2f+'CurrentCapacity']=parseInt(_0x41935c['capacity'][_0x396b2f],0xa);}}}_0x1596e7[_0xe6e8('0x44')][_0x41935c['id']][_0xe6e8('0x48')]();return _0x57e8f({'code':0xc8,'message':_0x1596e7[_0xe6e8('0x44')][_0x41935c['id']]});}else{return _0x4eea88(_0x3af7c8[_0xe6e8('0x30')](0x1f4,_0xe6e8('0x49')));}});},'Agents':function(_0x2879a2){return new Promise(function(_0x2426e7,_0x29575a){var _0x3e6fb1=_[_0xe6e8('0x4a')](_0x1596e7[_0xe6e8('0x44')]);_0x2426e7({'count':_0x3e6fb1[_0xe6e8('0x17')],'rows':_0x3e6fb1});});},'ChatQueues':function(_0x535491){return new Promise(function(_0x34b27e,_0x5d9cb9){var _0x4fe87c=[];for(var _0x2ab6a3 in _0x1596e7[_0xe6e8('0x4b')]){if(_0x1596e7[_0xe6e8('0x4b')][_0xe6e8('0x45')](_0x2ab6a3)){var _0x3b7010=_0x1596e7[_0xe6e8('0x4b')][_0x2ab6a3];var _0x4c9273={'id':_0x3b7010['id'],'available':_0x3b7010[_0xe6e8('0x4c')],'loggedIn':_0x3b7010[_0xe6e8('0x4d')],'name':_0x3b7010[_0xe6e8('0x4e')],'paused':_0x3b7010[_0xe6e8('0x4f')],'waiting':_0x3b7010[_0xe6e8('0x50')]};_0x4fe87c[_0xe6e8('0x21')](_0x4c9273);}}_0x34b27e({'count':_0x4fe87c[_0xe6e8('0x17')],'rows':_0x4fe87c});});},'MailQueues':function(_0x2b256b){return new Promise(function(_0x44a649,_0xaa2c5){var _0x484aad=[];for(var _0x37f123 in _0x1596e7['mailQueues']){if(_0x1596e7[_0xe6e8('0x51')][_0xe6e8('0x45')](_0x37f123)){var _0x525ac2=_0x1596e7['mailQueues'][_0x37f123];var _0x1471c6={'id':_0x525ac2['id'],'available':_0x525ac2[_0xe6e8('0x4c')],'loggedIn':_0x525ac2[_0xe6e8('0x4d')],'name':_0x525ac2[_0xe6e8('0x4e')],'paused':_0x525ac2['paused'],'waiting':_0x525ac2[_0xe6e8('0x50')]};_0x484aad[_0xe6e8('0x21')](_0x1471c6);}}_0x44a649({'count':_0x484aad[_0xe6e8('0x17')],'rows':_0x484aad});});},'OpenchannelQueues':function(_0x554b31){return new Promise(function(_0x3e5756,_0x25e73d){var _0x30f012=[];for(var _0x231150 in _0x1596e7[_0xe6e8('0x52')]){if(_0x1596e7[_0xe6e8('0x52')][_0xe6e8('0x45')](_0x231150)){var _0x230df7=_0x1596e7[_0xe6e8('0x52')][_0x231150];var _0x3ed276={'id':_0x230df7['id'],'available':_0x230df7[_0xe6e8('0x4c')],'loggedIn':_0x230df7['loggedIn'],'name':_0x230df7['name'],'paused':_0x230df7[_0xe6e8('0x4f')],'waiting':_0x230df7['waiting']};_0x30f012[_0xe6e8('0x21')](_0x3ed276);}}_0x3e5756({'count':_0x30f012[_0xe6e8('0x17')],'rows':_0x30f012});});},'SmsQueues':function(_0x3c8cfc){return new Promise(function(_0x2d40c4,_0x2be320){var _0x5937dd=[];for(var _0x2231f9 in _0x1596e7[_0xe6e8('0x53')]){if(_0x1596e7[_0xe6e8('0x53')][_0xe6e8('0x45')](_0x2231f9)){var _0x1da86b=_0x1596e7[_0xe6e8('0x53')][_0x2231f9];var _0xa8e91c={'id':_0x1da86b['id'],'available':_0x1da86b['available'],'loggedIn':_0x1da86b[_0xe6e8('0x4d')],'name':_0x1da86b[_0xe6e8('0x4e')],'paused':_0x1da86b['paused'],'waiting':_0x1da86b[_0xe6e8('0x50')]};_0x5937dd[_0xe6e8('0x21')](_0xa8e91c);}}_0x2d40c4({'count':_0x5937dd[_0xe6e8('0x17')],'rows':_0x5937dd});});},'FaxQueues':function(_0x1d1028){return new Promise(function(_0x24bd39,_0x19ffad){var _0x213428=[];for(var _0x19b21e in _0x1596e7[_0xe6e8('0x54')]){if(_0x1596e7[_0xe6e8('0x54')]['hasOwnProperty'](_0x19b21e)){var _0x3c0251=_0x1596e7['faxQueues'][_0x19b21e];var _0x59a034={'id':_0x3c0251['id'],'available':_0x3c0251['available'],'loggedIn':_0x3c0251['loggedIn'],'name':_0x3c0251['name'],'paused':_0x3c0251['paused'],'waiting':_0x3c0251[_0xe6e8('0x50')]};_0x213428['push'](_0x59a034);}}_0x24bd39({'count':_0x213428[_0xe6e8('0x17')],'rows':_0x213428});});},'WhatsappQueues':function(_0xb28d38){return new Promise(function(_0x5f01e3,_0x1987ad){var _0x35b488=[];for(var _0x2d7562 in _0x1596e7['whatsappQueues']){if(_0x1596e7[_0xe6e8('0x55')][_0xe6e8('0x45')](_0x2d7562)){var _0x11f935=_0x1596e7[_0xe6e8('0x55')][_0x2d7562];var _0x7992d0={'id':_0x11f935['id'],'available':_0x11f935[_0xe6e8('0x4c')],'loggedIn':_0x11f935['loggedIn'],'name':_0x11f935['name'],'paused':_0x11f935[_0xe6e8('0x4f')],'waiting':_0x11f935[_0xe6e8('0x50')]};_0x35b488[_0xe6e8('0x21')](_0x7992d0);}}_0x5f01e3({'count':_0x35b488[_0xe6e8('0x17')],'rows':_0x35b488});});},'ChatQueuesWaitingInteractions':function(_0x5b2057){return new Promise(function(_0xf61288,_0x28bccd){var _0x2f6ea1=_[_0xe6e8('0x4a')](_0x1596e7[_0xe6e8('0x56')]);_0xf61288({'count':_0x2f6ea1[_0xe6e8('0x17')],'rows':_0x2f6ea1});});},'MailQueuesWaitingInteractions':function(_0x21c950){return new Promise(function(_0x3b7931,_0x78ba54){var _0x2be6d5=_['values'](_0x1596e7[_0xe6e8('0x57')]);_0x3b7931({'count':_0x2be6d5['length'],'rows':_0x2be6d5});});},'OpenchannelQueuesWaitingInteractions':function(_0x401f4b){return new Promise(function(_0x460ee8,_0x548c6b){var _0x1e2596=_['values'](_0x1596e7[_0xe6e8('0x58')]);_0x460ee8({'count':_0x1e2596[_0xe6e8('0x17')],'rows':_0x1e2596});});},'SmsQueuesWaitingInteractions':function(_0x3be6bf){return new Promise(function(_0x226acf,_0x253b12){var _0x128091=_['values'](_0x1596e7[_0xe6e8('0x59')]);_0x226acf({'count':_0x128091['length'],'rows':_0x128091});});},'FaxQueuesWaitingInteractions':function(_0x3c17ee){return new Promise(function(_0x3be46a,_0x4280db){var _0xf5972a=_[_0xe6e8('0x4a')](_0x1596e7['faxQueuesWaitingInteractions']);_0x3be46a({'count':_0xf5972a['length'],'rows':_0xf5972a});});},'WhatsappQueuesWaitingInteractions':function(_0x468539){return new Promise(function(_0x4d8660,_0x3888bd){var _0x261539=_[_0xe6e8('0x4a')](_0x1596e7['whatsappQueuesWaitingInteractions']);_0x4d8660({'count':_0x261539['length'],'rows':_0x261539});});}};var _0xb3e884=jayson[_0xe6e8('0x5a')](_0x439299)[_0xe6e8('0x5b')]();_0xb3e884['on'](_0xe6e8('0x30'),function(_0x4803ec){logger[_0xe6e8('0x30')](JSON['stringify'](_0x4803ec));return _0x2c2aa0(_0x4803ec);});_0xb3e884[_0xe6e8('0x12')](0x232c,_0xe6e8('0x5c'),function(){console[_0xe6e8('0x5d')](_0xe6e8('0x5e'),0x232c);return _0x5719fb(_0xe6e8('0x5f')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 780a4da..613d579 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 _0xbfde=['util','lodash','../../../config/logger','request','then','error','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','Command','format','iftime\x20%s','message','indexOf','all','some','join','when','catch','log','\x20|\x20','stack','stop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfde,0xe1));var _0xebfd=function(_0x26a69f,_0x567347){_0x26a69f=_0x26a69f-0x0;var _0x9cec17=_0xbfde[_0x26a69f];return _0x9cec17;};'use strict';var util=require(_0xebfd('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xebfd('0x1'));var logger=require(_0xebfd('0x2'))('routing');var client=jayson['client']['http']({'port':0x232a});function request(_0x337590,_0x5426b4){return new BPromise(function(_0x55a196,_0x5eb593){return client[_0xebfd('0x3')](_0x337590,_0x5426b4)[_0xebfd('0x4')](function(_0x4398e5){if(_0x4398e5[_0xebfd('0x5')]){return _0x5eb593(_0x4398e5[_0xebfd('0x5')]['message']);}else{return _0x55a196(_0x4398e5[_0xebfd('0x6')]);}})['catch'](function(_0x5ef28f){return _0x5eb593(_0x5ef28f);});});}exports[_0xebfd('0x7')]=function(_0x1dd402,_0x146764,_0x59b9ba){return function(_0x1eb3df){if(_0x59b9ba[_0xebfd('0x8')]&&!_0x59b9ba[_0xebfd('0x8')][_0x1dd402]){logger[_0xebfd('0x9')](_0xebfd('0xa'),_0x1dd402);return _0x1eb3df['stop']();}var _0x123494=[];for(var _0x4c7f0a=0x0;_0x4c7f0a<_0x146764['length'];_0x4c7f0a+=0x1){_0x123494['push'](request(_0xebfd('0xb'),{'command':util[_0xebfd('0xc')](_0xebfd('0xd'),_0x146764[_0x4c7f0a])})[_0xebfd('0x4')](function(_0x253b80){return _0x253b80&&_0x253b80[_0xebfd('0xe')]&&_0x253b80[_0xebfd('0xe')][_0xebfd('0xf')]('true')>=0x0?!![]:![];})['catch'](function(_0x49c7e4){logger['error']('[%s][INTERVAL]\x20%s',_0x1dd402,_0x146764[_0x4c7f0a]);}));}BPromise[_0xebfd('0x10')](_0x123494)[_0xebfd('0x4')](function(_0x4bcf39){var _0x3c413f=_[_0xebfd('0x11')](_0x4bcf39);logger[_0xebfd('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x1dd402,_0x146764[_0xebfd('0x12')]('\x20|\x20'),_0x3c413f);_0x1eb3df[_0xebfd('0x13')](_0x3c413f);})[_0xebfd('0x14')](function(_0x1cb7c7){console[_0xebfd('0x15')](_0x1cb7c7);logger[_0xebfd('0x5')]('[%s][INTERVAL]\x20%s\x20%s',_0x1dd402,_0x146764[_0xebfd('0x12')](_0xebfd('0x16')),_0x1cb7c7[_0xebfd('0x17')]);_0x1eb3df[_0xebfd('0x18')]();});};}; \ No newline at end of file +var _0x31ec=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','request','then','error','message','result','condition'];(function(_0x3270f8,_0x5eb924){var _0x2c7069=function(_0x2098cd){while(--_0x2098cd){_0x3270f8['push'](_0x3270f8['shift']());}};_0x2c7069(++_0x5eb924);}(_0x31ec,0x8f));var _0xc31e=function(_0x1532f0,_0x1a3b63){_0x1532f0=_0x1532f0-0x0;var _0x229e0a=_0x31ec[_0x1532f0];return _0x229e0a;};'use strict';var util=require(_0xc31e('0x0'));var BPromise=require(_0xc31e('0x1'));var jayson=require(_0xc31e('0x2'));var _=require(_0xc31e('0x3'));var logger=require(_0xc31e('0x4'))(_0xc31e('0x5'));var client=jayson['client']['http']({'port':0x232a});function request(_0x333e89,_0x453dec){return new BPromise(function(_0x2deb2a,_0x702cd5){return client[_0xc31e('0x6')](_0x333e89,_0x453dec)[_0xc31e('0x7')](function(_0x105118){if(_0x105118[_0xc31e('0x8')]){return _0x702cd5(_0x105118[_0xc31e('0x8')][_0xc31e('0x9')]);}else{return _0x2deb2a(_0x105118[_0xc31e('0xa')]);}})['catch'](function(_0x39fd5d){return _0x702cd5(_0x39fd5d);});});}exports[_0xc31e('0xb')]=function(_0x5c1215,_0xe8b1a0,_0xa46f80){return function(_0x5f149c){if(_0xa46f80['rules']&&!_0xa46f80[_0xc31e('0xc')][_0x5c1215]){logger[_0xc31e('0xd')](_0xc31e('0xe'),_0x5c1215);return _0x5f149c[_0xc31e('0xf')]();}var _0x32db85=[];for(var _0x13af50=0x0;_0x13af50<_0xe8b1a0[_0xc31e('0x10')];_0x13af50+=0x1){_0x32db85[_0xc31e('0x11')](request(_0xc31e('0x12'),{'command':util[_0xc31e('0x13')]('iftime\x20%s',_0xe8b1a0[_0x13af50])})['then'](function(_0x2ca74e){return _0x2ca74e&&_0x2ca74e[_0xc31e('0x9')]&&_0x2ca74e[_0xc31e('0x9')][_0xc31e('0x14')](_0xc31e('0x15'))>=0x0?!![]:![];})[_0xc31e('0x16')](function(_0x46420c){logger['error'](_0xc31e('0x17'),_0x5c1215,_0xe8b1a0[_0x13af50]);}));}BPromise[_0xc31e('0x18')](_0x32db85)[_0xc31e('0x7')](function(_0x4b08f2){var _0x1bda65=_[_0xc31e('0x19')](_0x4b08f2);logger[_0xc31e('0xd')](_0xc31e('0x1a'),_0x5c1215,_0xe8b1a0[_0xc31e('0x1b')](_0xc31e('0x1c')),_0x1bda65);_0x5f149c[_0xc31e('0x1d')](_0x1bda65);})['catch'](function(_0x434777){console['log'](_0x434777);logger[_0xc31e('0x8')](_0xc31e('0x1a'),_0x5c1215,_0xe8b1a0[_0xc31e('0x1b')]('\x20|\x20'),_0x434777[_0xc31e('0x1e')]);_0x5f149c[_0xc31e('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 4f16e5c..2b953bb 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 _0xf290=['now','connectedlinename','error','agentringnoanswer','timeout','reason','holdtime','push','[%s][agents][agentringnoanswer]','includes','debug','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','talktime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','clone','calleridname','hangup','[%s][agents][hangup]','rejected','indexOf','agent','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','agentcalledAt'];(function(_0x47d497,_0x4c87f7){var _0x43a187=function(_0x75b5f9){while(--_0x75b5f9){_0x47d497['push'](_0x47d497['shift']());}};_0x43a187(++_0x4c87f7);}(_0xf290,0xde));var _0x0f29=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0xf290[_0x5c5c52];return _0x4229ff;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1d35f0,_0x4b16e4){utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x3'),_0x1d35f0[_0x0f29('0x4')],_0x1d35f0[_0x0f29('0x5')],_0x1d35f0['queue'],_0x1d35f0[_0x0f29('0x6')],_0x1d35f0['interface'],_0x1d35f0[_0x0f29('0x7')],_0x1d35f0[_0x0f29('0x8')],_0x1d35f0[_0x0f29('0x9')]));if(_0x1d35f0[_0x0f29('0xa')]){utils[_0x0f29('0xb')](_0x1d35f0[_0x0f29('0xa')])[_0x0f29('0xc')](function(_0x3c6a6e){if(_0x3c6a6e){_0x1d35f0[_0x0f29('0xd')]=_0x3c6a6e[_0x0f29('0xd')];_0x1d35f0[_0x0f29('0xe')]=_0x1d35f0[_0x0f29('0xf')]?_0x3c6a6e[_0x0f29('0x10')]:![];_0x1d35f0[_0x0f29('0x11')]=_0x1d35f0[_0x0f29('0xe')]?_0x3c6a6e['acwTimeout']:0x0;}utils[_0x0f29('0x12')]('CreateVoiceAgentReport',_0x1d35f0);});}else{utils[_0x0f29('0x12')](_0x0f29('0x13'),_0x1d35f0);}if(_0x4b16e4){delete transfers[_0x1d35f0[_0x0f29('0x4')]];}else{delete agents[_0x1d35f0[_0x0f29('0x14')]];}}exports[_0x0f29('0x15')]=function(_0x2d2573){try{utils['debug'](util[_0x0f29('0x2')](_0x0f29('0x16'),_0x2d2573[_0x0f29('0x4')]),_0x2d2573);agents[_0x2d2573[_0x0f29('0x14')]]=_0x2d2573;agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();agents[_0x2d2573[_0x0f29('0x14')]]['lastevent']='called';agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x8')]=null;agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x19')]=null;utils['info'](util[_0x0f29('0x2')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2d2573[_0x0f29('0x4')],agents[_0x2d2573['destuniqueid']]['membername'],_0x2d2573['destuniqueid']));}catch(_0x23a44f){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x16'),_0x2d2573[_0x0f29('0x4')]),_0x23a44f);}};exports[_0x0f29('0x1b')]=function(_0x150271){try{if(!_['isNil'](agents[_0x150271[_0x0f29('0x14')]])){utils['debug'](util['format']('[%s][agents][agentringnoanswer]',_0x150271['uniqueid']),_0x150271);utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x150271[_0x0f29('0x4')],agents[_0x150271[_0x0f29('0x14')]][_0x0f29('0x6')],_0x150271[_0x0f29('0x14')]));agents[_0x150271[_0x0f29('0x14')]]['agentringnoanswer']=!![];agents[_0x150271[_0x0f29('0x14')]]['agentringnoanswerAt']=utils[_0x0f29('0x18')]();agents[_0x150271[_0x0f29('0x14')]][_0x0f29('0x9')]=_0x0f29('0x1c');agents[_0x150271['destuniqueid']][_0x0f29('0x1d')]='timeout';agents[_0x150271['destuniqueid']][_0x0f29('0x1e')]=_0x150271['ringtime']?parseInt(_0x150271['ringtime'])/0x3e8:0x0;agents[_0x150271['destuniqueid']]['talktime']=0x0;unanswered[_0x0f29('0x1f')](_0x150271[_0x0f29('0x14')]);}}catch(_0x4cc5a0){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x20'),_0x150271['uniqueid']),_0x4cc5a0);}};exports['queuecallerabandon']=function(_0x37ebcc){try{_['forIn'](agents,function(_0x36b65c,_0x561c31){if(_0x36b65c['uniqueid']==_0x37ebcc[_0x0f29('0x4')]&&!_[_0x0f29('0x21')](unanswered,_0x36b65c[_0x0f29('0x14')])){utils[_0x0f29('0x22')](util['format']('[%s][agents][queuecallerabandon]',_0x37ebcc[_0x0f29('0x4')]),_0x37ebcc);utils['info'](util['format'](_0x0f29('0x23'),_0x37ebcc['uniqueid'],_0x36b65c[_0x0f29('0x6')],_0x36b65c['destuniqueid']));_0x36b65c['agentringnoanswer']=!![];_0x36b65c[_0x0f29('0x24')]=utils[_0x0f29('0x18')]();_0x36b65c[_0x0f29('0x9')]=_0x0f29('0x25');_0x36b65c[_0x0f29('0x1d')]='abandoned';_0x36b65c[_0x0f29('0x1e')]=_0x37ebcc['holdtime'];_0x36b65c[_0x0f29('0x26')]=0x0;writeDB(_0x36b65c);}});}catch(_0x3e8f3f){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')]('[%s][agents][queuecallerabandon]',_0x37ebcc[_0x0f29('0x4')]),_0x3e8f3f);}};exports[_0x0f29('0x27')]=function(_0x5be4fa){try{if(agents[_0x5be4fa[_0x0f29('0x14')]]){utils[_0x0f29('0x22')](util['format']('[%s][agents][agentconnect]',_0x5be4fa[_0x0f29('0x4')]),_0x5be4fa);utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x28'),_0x5be4fa[_0x0f29('0x4')],agents[_0x5be4fa[_0x0f29('0x14')]]['membername'],_0x5be4fa[_0x0f29('0x14')]));agents[_0x5be4fa['destuniqueid']][_0x0f29('0x29')]=utils['now']();agents[_0x5be4fa[_0x0f29('0x14')]][_0x0f29('0x8')]=_0x5be4fa[_0x0f29('0x8')];agents[_0x5be4fa['destuniqueid']]['connectedlinename']=_0x5be4fa[_0x0f29('0x19')];agents[_0x5be4fa['destuniqueid']][_0x0f29('0x1e')]=_0x5be4fa[_0x0f29('0x2a')];agents[_0x5be4fa[_0x0f29('0x14')]][_0x0f29('0x9')]=_0x0f29('0x2b');_['forIn'](agents,function(_0x13c05c,_0xf77c66){if(_0x13c05c[_0x0f29('0x14')]!=_0x5be4fa[_0x0f29('0x14')]&&_0x13c05c[_0x0f29('0x4')]==_0x5be4fa[_0x0f29('0x4')]){_0x13c05c[_0x0f29('0x26')]=0x0;_0x13c05c[_0x0f29('0x1e')]=_0x5be4fa[_0x0f29('0x2a')];_0x13c05c['agentringnoanswer']=!![];_0x13c05c[_0x0f29('0x24')]=utils[_0x0f29('0x18')]();_0x13c05c[_0x0f29('0x9')]=_0x0f29('0x2c');_0x13c05c['reason']=_0x0f29('0x2c');_0x13c05c[_0x0f29('0x2d')]=_0x5be4fa[_0x0f29('0x14')];_0x13c05c[_0x0f29('0x2e')]=_0x5be4fa[_0x0f29('0x6')];writeDB(_0x13c05c);}});}}catch(_0x56062d){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x2f'),_0x5be4fa['uniqueid']),_0x56062d);}};exports[_0x0f29('0xf')]=function(_0x284279){try{if(!_[_0x0f29('0x30')](agents[_0x284279[_0x0f29('0x14')]])){utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x31'),_0x284279[_0x0f29('0x4')]),_0x284279);utils['info'](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x284279[_0x0f29('0x4')],agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x6')],_0x284279[_0x0f29('0x14')]));agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0xf')]=!![];agents[_0x284279['destuniqueid']][_0x0f29('0x32')]=utils['now']();agents[_0x284279[_0x0f29('0x14')]]['talktime']=utils[_0x0f29('0x33')](agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x32')],agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x29')]);agents[_0x284279['destuniqueid']][_0x0f29('0x1d')]=_0x284279[_0x0f29('0x1d')];agents[_0x284279[_0x0f29('0x14')]]['lastevent']=_0x0f29('0x34');writeDB(agents[_0x284279['destuniqueid']]);}}catch(_0x4fd625){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x31'),_0x284279[_0x0f29('0x4')]),_0x4fd625);}};exports[_0x0f29('0x35')]=function(_0x335435){try{if(!_['isNil'](agents[_0x335435[_0x0f29('0x36')]])){utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x37'),_0x335435[_0x0f29('0x4')]),_0x335435);utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x38'),_0x335435[_0x0f29('0x4')],agents[_0x335435[_0x0f29('0x36')]]['membername'],agents[_0x335435['transfereruniqueid']][_0x0f29('0x4')]));agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x39')]=!![];agents[_0x335435[_0x0f29('0x36')]]['transfertype']=_0x0f29('0x3a');agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x3b')]=_0x335435[_0x0f29('0x3c')];agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x3d')]=agents[_0x335435[_0x0f29('0x36')]]['uniqueid'];}}catch(_0x17f33){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x37'),_0x335435[_0x0f29('0x4')]),_0x17f33);}};exports[_0x0f29('0x3e')]=function(_0x5ec172){try{utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x3f'),_0x5ec172['origtransfereruniqueid']),_0x5ec172);if(_0x5ec172[_0x0f29('0x40')]==_0x5ec172['origtransfererlinkedid']){if(!_[_0x0f29('0x30')](agents[_0x5ec172['secondtransfereruniqueid']])){utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5ec172[_0x0f29('0x40')],agents[_0x5ec172[_0x0f29('0x41')]][_0x0f29('0x6')]));agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x39')]=!![];agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x42')]=_0x0f29('0x43');agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x3b')]=_0x5ec172[_0x0f29('0x44')];agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x3d')]=_0x5ec172['origtransfereruniqueid'];}if(_0x5ec172[_0x0f29('0x45')]&&agents[_0x5ec172['transfereeuniqueid']]){agents[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x46')]=0x1;transfers[_0x5ec172[_0x0f29('0x45')]]=_['clone'](agents[_0x5ec172[_0x0f29('0x45')]]);transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x7')]=agents[_0x5ec172[_0x0f29('0x41')]]['calleridnum'];transfers[_0x5ec172[_0x0f29('0x45')]]['calleridname']=agents[_0x5ec172[_0x0f29('0x41')]]['calleridname'];transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x29')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x45')]]['holdtime']=0x0;transfers[_0x5ec172[_0x0f29('0x45')]]['agententerreason']=0x2;}}else if(_0x5ec172[_0x0f29('0x41')]==_0x5ec172[_0x0f29('0x47')]){if(!_[_0x0f29('0x30')](agents[_0x5ec172['origtransfereruniqueid']])){utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x48'),_0x5ec172[_0x0f29('0x40')],agents[_0x5ec172[_0x0f29('0x40')]]['membername']));agents[_0x5ec172['origtransfereruniqueid']][_0x0f29('0x39')]=!![];agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x42')]='ATTENDED';agents[_0x5ec172['origtransfereruniqueid']][_0x0f29('0x3b')]=_0x5ec172[_0x0f29('0x49')];agents[_0x5ec172[_0x0f29('0x40')]]['transferuniqueid']=_0x5ec172['secondtransfereruniqueid'];}if(_0x5ec172['transfertargetuniqueid']&&agents[_0x5ec172[_0x0f29('0x4a')]]){agents[_0x5ec172[_0x0f29('0x4a')]]['agententerreason']=0x1;transfers[_0x5ec172[_0x0f29('0x4a')]]=_[_0x0f29('0x4b')](agents[_0x5ec172['transfertargetuniqueid']]);transfers[_0x5ec172[_0x0f29('0x4a')]]['calleridnum']=agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x7')];transfers[_0x5ec172['transfertargetuniqueid']][_0x0f29('0x4c')]=agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x4c')];transfers[_0x5ec172[_0x0f29('0x4a')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172['transfertargetuniqueid']][_0x0f29('0x29')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x4a')]]['holdtime']=0x0;transfers[_0x5ec172[_0x0f29('0x4a')]][_0x0f29('0x46')]=0x2;}}}catch(_0x4bbc7e){utils[_0x0f29('0x1a')](util['format'](_0x0f29('0x3f'),_0x5ec172[_0x0f29('0x40')]),_0x4bbc7e);}};exports[_0x0f29('0x4d')]=function(_0x4bd8f1){try{utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x4e'),_0x4bd8f1[_0x0f29('0x4')]),_0x4bd8f1);if(agents[_0x4bd8f1[_0x0f29('0x4')]]&&agents[_0x4bd8f1[_0x0f29('0x4')]]['reason']===_0x0f29('0x1c')){if(_0x4bd8f1['cause']==='21'){agents[_0x4bd8f1['uniqueid']][_0x0f29('0x1d')]=_0x0f29('0x4f');agents[_0x4bd8f1['uniqueid']][_0x0f29('0x9')]=_0x0f29('0x4f');}utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1['uniqueid'],agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],agents[_0x4bd8f1['uniqueid']]['reason'],agents[_0x4bd8f1[_0x0f29('0x4')]]['lastevent']));writeDB(agents[_0x4bd8f1[_0x0f29('0x4')]]);var _0x473eac=unanswered[_0x0f29('0x50')](_0x4bd8f1[_0x0f29('0x4')]);if(_0x473eac>-0x1){unanswered['splice'](_0x473eac,0x1);}}if(transfers[_0x4bd8f1[_0x0f29('0x4')]]){transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0xf')]=!![];transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x32')]=utils['now']();transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x26')]=utils[_0x0f29('0x33')](transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x32')],transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x29')]);transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x1d')]=_0x0f29('0x51');transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x9')]=_0x0f29('0x34');utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1[_0x0f29('0x4')],transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],transfers[_0x4bd8f1[_0x0f29('0x4')]]['reason'],transfers[_0x4bd8f1['uniqueid']][_0x0f29('0x9')]));writeDB(transfers[_0x4bd8f1[_0x0f29('0x4')]],!![]);}if(agents[_0x4bd8f1[_0x0f29('0x4')]]&&agents[_0x4bd8f1['uniqueid']][_0x0f29('0x29')]){agents[_0x4bd8f1['uniqueid']][_0x0f29('0xf')]=!![];agents[_0x4bd8f1['uniqueid']][_0x0f29('0x32')]=utils[_0x0f29('0x18')]();agents[_0x4bd8f1[_0x0f29('0x4')]]['talktime']=utils[_0x0f29('0x33')](agents[_0x4bd8f1['uniqueid']]['agentcompleteAt'],agents[_0x4bd8f1[_0x0f29('0x4')]]['agentconnectAt']);agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x1d')]=agents[_0x4bd8f1['uniqueid']][_0x0f29('0x39')]?_0x0f29('0x39'):_0x0f29('0x51');agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x9')]=_0x0f29('0x34');utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1[_0x0f29('0x4')],agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],agents[_0x4bd8f1['uniqueid']][_0x0f29('0x1d')],agents[_0x4bd8f1[_0x0f29('0x4')]]['lastevent']));writeDB(agents[_0x4bd8f1[_0x0f29('0x4')]]);}}catch(_0x5e39a7){utils[_0x0f29('0x1a')](util['format'](_0x0f29('0x4e'),_0x4bd8f1['uniqueid']),_0x5e39a7);}}; \ No newline at end of file +var _0x34b7=['acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][queuecallerabandon]','agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','secondtransfererexten','transfertargetuniqueid','clone','calleridname','[%s][agents][hangup]','cause','rejected','indexOf','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','acw'];(function(_0xb267fa,_0x1340b6){var _0x5e8159=function(_0x14bf12){while(--_0x14bf12){_0xb267fa['push'](_0xb267fa['shift']());}};_0x5e8159(++_0x1340b6);}(_0x34b7,0x196));var _0x734b=function(_0x6522af,_0x200962){_0x6522af=_0x6522af-0x0;var _0x39f7de=_0x34b7[_0x6522af];return _0x39f7de;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x734b('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1aedd0,_0x6e4318){utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x3'),_0x1aedd0['uniqueid'],_0x1aedd0['channel'],_0x1aedd0[_0x734b('0x4')],_0x1aedd0[_0x734b('0x5')],_0x1aedd0[_0x734b('0x6')],_0x1aedd0[_0x734b('0x7')],_0x1aedd0[_0x734b('0x8')],_0x1aedd0[_0x734b('0x9')]));if(_0x1aedd0['queue']){utils[_0x734b('0xa')](_0x1aedd0[_0x734b('0x4')])['then'](function(_0x53f163){if(_0x53f163){_0x1aedd0['type']=_0x53f163[_0x734b('0xb')];_0x1aedd0['agentacw']=_0x1aedd0[_0x734b('0xc')]?_0x53f163[_0x734b('0xd')]:![];_0x1aedd0[_0x734b('0xe')]=_0x1aedd0[_0x734b('0xf')]?_0x53f163[_0x734b('0x10')]:0x0;}utils[_0x734b('0x11')](_0x734b('0x12'),_0x1aedd0);});}else{utils[_0x734b('0x11')](_0x734b('0x12'),_0x1aedd0);}if(_0x6e4318){delete transfers[_0x1aedd0[_0x734b('0x13')]];}else{delete agents[_0x1aedd0[_0x734b('0x14')]];}}exports[_0x734b('0x15')]=function(_0x145ec3){try{utils[_0x734b('0x16')](util['format'](_0x734b('0x17'),_0x145ec3[_0x734b('0x13')]),_0x145ec3);agents[_0x145ec3[_0x734b('0x14')]]=_0x145ec3;agents[_0x145ec3[_0x734b('0x14')]][_0x734b('0x18')]=utils[_0x734b('0x19')]();agents[_0x145ec3[_0x734b('0x14')]][_0x734b('0x9')]=_0x734b('0x1a');agents[_0x145ec3[_0x734b('0x14')]][_0x734b('0x8')]=null;agents[_0x145ec3['destuniqueid']][_0x734b('0x1b')]=null;utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x1c'),_0x145ec3['uniqueid'],agents[_0x145ec3['destuniqueid']][_0x734b('0x5')],_0x145ec3[_0x734b('0x14')]));}catch(_0x1e6ed9){utils[_0x734b('0x1d')](util[_0x734b('0x2')](_0x734b('0x17'),_0x145ec3[_0x734b('0x13')]),_0x1e6ed9);}};exports[_0x734b('0x1e')]=function(_0x67eed){try{if(!_[_0x734b('0x1f')](agents[_0x67eed[_0x734b('0x14')]])){utils[_0x734b('0x16')](util[_0x734b('0x2')](_0x734b('0x20'),_0x67eed['uniqueid']),_0x67eed);utils[_0x734b('0x1')](util[_0x734b('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x67eed[_0x734b('0x13')],agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x5')],_0x67eed[_0x734b('0x14')]));agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x1e')]=!![];agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x21')]=utils[_0x734b('0x19')]();agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x9')]=_0x734b('0x22');agents[_0x67eed[_0x734b('0x14')]]['reason']='timeout';agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x23')]=_0x67eed['ringtime']?parseInt(_0x67eed[_0x734b('0x24')])/0x3e8:0x0;agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x25')]=0x0;unanswered[_0x734b('0x26')](_0x67eed[_0x734b('0x14')]);}}catch(_0x1b8295){utils[_0x734b('0x1d')](util['format'](_0x734b('0x20'),_0x67eed[_0x734b('0x13')]),_0x1b8295);}};exports[_0x734b('0x27')]=function(_0x241c89){try{_[_0x734b('0x28')](agents,function(_0x427c36,_0x1fed72){if(_0x427c36[_0x734b('0x13')]==_0x241c89[_0x734b('0x13')]&&!_[_0x734b('0x29')](unanswered,_0x427c36['destuniqueid'])){utils[_0x734b('0x16')](util[_0x734b('0x2')]('[%s][agents][queuecallerabandon]',_0x241c89[_0x734b('0x13')]),_0x241c89);utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x2a'),_0x241c89[_0x734b('0x13')],_0x427c36[_0x734b('0x5')],_0x427c36[_0x734b('0x14')]));_0x427c36[_0x734b('0x1e')]=!![];_0x427c36[_0x734b('0x21')]=utils[_0x734b('0x19')]();_0x427c36[_0x734b('0x9')]=_0x734b('0x2b');_0x427c36[_0x734b('0x2c')]=_0x734b('0x2b');_0x427c36[_0x734b('0x23')]=_0x241c89['holdtime'];_0x427c36[_0x734b('0x25')]=0x0;writeDB(_0x427c36);}});}catch(_0x5e2444){utils[_0x734b('0x1d')](util[_0x734b('0x2')](_0x734b('0x2d'),_0x241c89[_0x734b('0x13')]),_0x5e2444);}};exports[_0x734b('0x2e')]=function(_0x16ab66){try{if(agents[_0x16ab66['destuniqueid']]){utils['debug'](util[_0x734b('0x2')]('[%s][agents][agentconnect]',_0x16ab66[_0x734b('0x13')]),_0x16ab66);utils['info'](util[_0x734b('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x16ab66[_0x734b('0x13')],agents[_0x16ab66['destuniqueid']][_0x734b('0x5')],_0x16ab66[_0x734b('0x14')]));agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x2f')]=utils[_0x734b('0x19')]();agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x8')]=_0x16ab66['connectedlinenum'];agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x1b')]=_0x16ab66['connectedlinename'];agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x23')]=_0x16ab66[_0x734b('0x24')];agents[_0x16ab66[_0x734b('0x14')]]['lastevent']=_0x734b('0x30');_[_0x734b('0x28')](agents,function(_0x4efb1f,_0x40674c){if(_0x4efb1f[_0x734b('0x14')]!=_0x16ab66['destuniqueid']&&_0x4efb1f[_0x734b('0x13')]==_0x16ab66[_0x734b('0x13')]){_0x4efb1f[_0x734b('0x25')]=0x0;_0x4efb1f[_0x734b('0x23')]=_0x16ab66['ringtime'];_0x4efb1f['agentringnoanswer']=!![];_0x4efb1f[_0x734b('0x21')]=utils['now']();_0x4efb1f['lastevent']=_0x734b('0x31');_0x4efb1f['reason']=_0x734b('0x31');_0x4efb1f['answeredelsewheredestinationuniqueid']=_0x16ab66[_0x734b('0x14')];_0x4efb1f[_0x734b('0x32')]=_0x16ab66[_0x734b('0x5')];writeDB(_0x4efb1f);}});}}catch(_0x4c3fdc){utils['error'](util[_0x734b('0x2')]('[%s][agents][agentconnect]',_0x16ab66['uniqueid']),_0x4c3fdc);}};exports[_0x734b('0xc')]=function(_0x159db9){try{if(!_['isNil'](agents[_0x159db9[_0x734b('0x14')]])){utils['debug'](util[_0x734b('0x2')](_0x734b('0x33'),_0x159db9[_0x734b('0x13')]),_0x159db9);utils['info'](util[_0x734b('0x2')](_0x734b('0x34'),_0x159db9[_0x734b('0x13')],agents[_0x159db9[_0x734b('0x14')]]['membername'],_0x159db9['destuniqueid']));agents[_0x159db9['destuniqueid']][_0x734b('0xc')]=!![];agents[_0x159db9['destuniqueid']]['agentcompleteAt']=utils[_0x734b('0x19')]();agents[_0x159db9['destuniqueid']][_0x734b('0x25')]=utils[_0x734b('0x35')](agents[_0x159db9[_0x734b('0x14')]][_0x734b('0x36')],agents[_0x159db9['destuniqueid']][_0x734b('0x2f')]);agents[_0x159db9['destuniqueid']][_0x734b('0x2c')]=_0x159db9[_0x734b('0x2c')];agents[_0x159db9[_0x734b('0x14')]]['lastevent']=_0x734b('0x37');writeDB(agents[_0x159db9['destuniqueid']]);}}catch(_0x357ae4){utils[_0x734b('0x1d')](util['format'](_0x734b('0x33'),_0x159db9[_0x734b('0x13')]),_0x357ae4);}};exports[_0x734b('0x38')]=function(_0x38125a){try{if(!_[_0x734b('0x1f')](agents[_0x38125a['transfereruniqueid']])){utils[_0x734b('0x16')](util['format'](_0x734b('0x39'),_0x38125a['uniqueid']),_0x38125a);utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x3a'),_0x38125a[_0x734b('0x13')],agents[_0x38125a[_0x734b('0x3b')]]['membername'],agents[_0x38125a['transfereruniqueid']]['uniqueid']));agents[_0x38125a[_0x734b('0x3b')]][_0x734b('0x3c')]=!![];agents[_0x38125a['transfereruniqueid']][_0x734b('0x3d')]=_0x734b('0x3e');agents[_0x38125a['transfereruniqueid']][_0x734b('0x3f')]=_0x38125a[_0x734b('0x40')];agents[_0x38125a[_0x734b('0x3b')]]['transferuniqueid']=agents[_0x38125a[_0x734b('0x3b')]][_0x734b('0x13')];}}catch(_0x423b22){utils[_0x734b('0x1d')](util['format'](_0x734b('0x39'),_0x38125a[_0x734b('0x13')]),_0x423b22);}};exports[_0x734b('0x41')]=function(_0x432a96){try{utils['debug'](util[_0x734b('0x2')]('[%s][agents][attendedtransfer]',_0x432a96[_0x734b('0x42')]),_0x432a96);if(_0x432a96[_0x734b('0x42')]==_0x432a96[_0x734b('0x43')]){if(!_[_0x734b('0x1f')](agents[_0x432a96['secondtransfereruniqueid']])){utils[_0x734b('0x1')](util[_0x734b('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x432a96['origtransfereruniqueid'],agents[_0x432a96[_0x734b('0x44')]]['membername']));agents[_0x432a96[_0x734b('0x44')]][_0x734b('0x3c')]=!![];agents[_0x432a96[_0x734b('0x44')]]['transfertype']=_0x734b('0x45');agents[_0x432a96['secondtransfereruniqueid']][_0x734b('0x3f')]=_0x432a96[_0x734b('0x46')];agents[_0x432a96[_0x734b('0x44')]][_0x734b('0x47')]=_0x432a96['origtransfereruniqueid'];}if(_0x432a96[_0x734b('0x48')]&&agents[_0x432a96['transfereeuniqueid']]){agents[_0x432a96[_0x734b('0x48')]][_0x734b('0x49')]=0x1;transfers[_0x432a96[_0x734b('0x48')]]=_['clone'](agents[_0x432a96[_0x734b('0x48')]]);transfers[_0x432a96['transfereeuniqueid']][_0x734b('0x7')]=agents[_0x432a96[_0x734b('0x44')]][_0x734b('0x7')];transfers[_0x432a96[_0x734b('0x48')]]['calleridname']=agents[_0x432a96[_0x734b('0x44')]]['calleridname'];transfers[_0x432a96[_0x734b('0x48')]][_0x734b('0x18')]=utils[_0x734b('0x19')]();transfers[_0x432a96['transfereeuniqueid']][_0x734b('0x2f')]=utils[_0x734b('0x19')]();transfers[_0x432a96[_0x734b('0x48')]][_0x734b('0x23')]=0x0;transfers[_0x432a96[_0x734b('0x48')]][_0x734b('0x49')]=0x2;}}else if(_0x432a96[_0x734b('0x44')]==_0x432a96['secondtransfererlinkedid']){if(!_[_0x734b('0x1f')](agents[_0x432a96[_0x734b('0x42')]])){utils[_0x734b('0x1')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x432a96[_0x734b('0x42')],agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x5')]));agents[_0x432a96[_0x734b('0x42')]]['transfer']=!![];agents[_0x432a96['origtransfereruniqueid']]['transfertype']=_0x734b('0x45');agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x3f')]=_0x432a96[_0x734b('0x4a')];agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x47')]=_0x432a96[_0x734b('0x44')];}if(_0x432a96[_0x734b('0x4b')]&&agents[_0x432a96[_0x734b('0x4b')]]){agents[_0x432a96[_0x734b('0x4b')]][_0x734b('0x49')]=0x1;transfers[_0x432a96[_0x734b('0x4b')]]=_[_0x734b('0x4c')](agents[_0x432a96[_0x734b('0x4b')]]);transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x7')]=agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x7')];transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x4d')]=agents[_0x432a96[_0x734b('0x42')]]['calleridname'];transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x18')]=utils[_0x734b('0x19')]();transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x2f')]=utils['now']();transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x23')]=0x0;transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x49')]=0x2;}}}catch(_0x3c7d93){utils[_0x734b('0x1d')](util['format']('[%s][agents][attendedtransfer]',_0x432a96['origtransfereruniqueid']),_0x3c7d93);}};exports['hangup']=function(_0x4d95c7){try{utils[_0x734b('0x16')](util[_0x734b('0x2')](_0x734b('0x4e'),_0x4d95c7[_0x734b('0x13')]),_0x4d95c7);if(agents[_0x4d95c7['uniqueid']]&&agents[_0x4d95c7['uniqueid']][_0x734b('0x2c')]===_0x734b('0x22')){if(_0x4d95c7[_0x734b('0x4f')]==='21'){agents[_0x4d95c7[_0x734b('0x13')]]['reason']=_0x734b('0x50');agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]=_0x734b('0x50');}utils['info'](util[_0x734b('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4d95c7[_0x734b('0x13')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x5')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2c')],agents[_0x4d95c7['uniqueid']][_0x734b('0x9')]));writeDB(agents[_0x4d95c7[_0x734b('0x13')]]);var _0x3c40b5=unanswered[_0x734b('0x51')](_0x4d95c7[_0x734b('0x13')]);if(_0x3c40b5>-0x1){unanswered['splice'](_0x3c40b5,0x1);}}if(transfers[_0x4d95c7[_0x734b('0x13')]]){transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0xc')]=!![];transfers[_0x4d95c7[_0x734b('0x13')]]['agentcompleteAt']=utils[_0x734b('0x19')]();transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x25')]=utils[_0x734b('0x35')](transfers[_0x4d95c7[_0x734b('0x13')]]['agentcompleteAt'],transfers[_0x4d95c7[_0x734b('0x13')]]['agentconnectAt']);transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2c')]=_0x734b('0x52');transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]=_0x734b('0x37');utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4d95c7[_0x734b('0x13')],transfers[_0x4d95c7['uniqueid']][_0x734b('0x5')],transfers[_0x4d95c7[_0x734b('0x13')]]['reason'],transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]));writeDB(transfers[_0x4d95c7[_0x734b('0x13')]],!![]);}if(agents[_0x4d95c7[_0x734b('0x13')]]&&agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2f')]){agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0xc')]=!![];agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x36')]=utils['now']();agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x25')]=utils[_0x734b('0x35')](agents[_0x4d95c7['uniqueid']][_0x734b('0x36')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2f')]);agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2c')]=agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x3c')]?_0x734b('0x3c'):'agent';agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]=_0x734b('0x37');utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x53'),_0x4d95c7[_0x734b('0x13')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x5')],agents[_0x4d95c7['uniqueid']][_0x734b('0x2c')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]));writeDB(agents[_0x4d95c7['uniqueid']]);}}catch(_0x31e1ec){utils[_0x734b('0x1d')](util[_0x734b('0x2')](_0x734b('0x4e'),_0x4d95c7[_0x734b('0x13')]),_0x31e1ec);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index f705cd4..f33576f 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 _0xa75c=['[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','newexten','[%s][calls][newexten]','appdata','toLowerCase','set','split','substring','lastIndexOf','noop','execif','gotoif','application','lodash','util','./transfers.controller','NO\x20ANSWER','ANSWERED','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','info','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','newstate','debug','isNil','systemanswertime','channelstate','transfer','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','hangup'];(function(_0x4f28de,_0x3c775c){var _0x25c1fb=function(_0x1f8f2c){while(--_0x1f8f2c){_0x4f28de['push'](_0x4f28de['shift']());}};_0x25c1fb(++_0x3c775c);}(_0xa75c,0x173));var _0xca75=function(_0x20ebb5,_0x237d88){_0x20ebb5=_0x20ebb5-0x0;var _0x487182=_0xa75c[_0x20ebb5];return _0x487182;};'use strict';var _=require(_0xca75('0x0'));var util=require(_0xca75('0x1'));var utils=require('./utils');var transfers=require(_0xca75('0x2'));var dispositions=['NO\x20ANSWER','FAILED','FAILED',_0xca75('0x3'),'NO\x20ANSWER',_0xca75('0x3'),_0xca75('0x4'),_0xca75('0x5'),'FAILED','FAILED',_0xca75('0x6')];var channels={};function writeDB(_0x21e318){var _0x4f722;if(transfers[_0xca75('0x7')][_0x21e318[_0xca75('0x8')]]){_0x4f722=_0x21e318['uniqueid'];_0x21e318['uniqueid']=transfers[_0xca75('0x7')][_0x21e318[_0xca75('0x8')]][_0xca75('0x9')];}utils['info'](util['format'](_0xca75('0xa'),_0x21e318[_0xca75('0x8')],_0x21e318['channel'],_0x21e318['queue'],_0x21e318[_0xca75('0xb')],_0x21e318[_0xca75('0xc')],_0x21e318[_0xca75('0xd')],_0x21e318[_0xca75('0xe')],_0x21e318[_0xca75('0xf')]));if(_0x21e318[_0xca75('0x10')]){utils[_0xca75('0x11')](_0x21e318[_0xca75('0x10')])['then'](function(_0x359f6d){if(_0x359f6d){_0x21e318[_0xca75('0x12')]=_0x359f6d['id'];}utils[_0xca75('0x13')](_0xca75('0x14'),_0x21e318);});}else{utils[_0xca75('0x13')](_0xca75('0x14'),_0x21e318);}if(channels[_0x21e318['uniqueid']]){delete channels[_0x21e318['uniqueid']];}else if(_0x4f722&&channels[_0x4f722]){delete transfers['blinds'][_0x4f722];delete channels[_0x4f722];}}exports[_0xca75('0x15')]=function(_0x1ed89e){try{utils['debug'](util['format'](_0xca75('0x16'),_0x1ed89e['uniqueid']),_0x1ed89e);if(_0x1ed89e[_0xca75('0x8')]==_0x1ed89e[_0xca75('0x17')]&&_0x1ed89e[_0xca75('0x18')]!=_0xca75('0x19')){utils[_0xca75('0x1a')](util[_0xca75('0x1b')](_0xca75('0x1c'),_0x1ed89e[_0xca75('0x8')],_0x1ed89e[_0xca75('0x1d')],_0x1ed89e[_0xca75('0x1e')]));channels[_0x1ed89e['uniqueid']]={'uniqueid':_0x1ed89e['uniqueid'],'accountcode':_0x1ed89e['accountcode'],'source':_0x1ed89e[_0xca75('0xd')],'destination':_0x1ed89e[_0xca75('0x1e')],'destinationcontext':_0x1ed89e[_0xca75('0x1d')],'channel':_0x1ed89e[_0xca75('0x18')],'starttime':utils[_0xca75('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xca75('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x1065be){utils[_0xca75('0x20')](util[_0xca75('0x1b')](_0xca75('0x16'),_0x1ed89e[_0xca75('0x8')]),_0x1065be);}};exports[_0xca75('0x21')]=function(_0x43f4c8){try{utils[_0xca75('0x22')](util[_0xca75('0x1b')]('[%s][calls][newstate]',_0x43f4c8['uniqueid']),_0x43f4c8);if(!_[_0xca75('0x23')](channels[_0x43f4c8['uniqueid']])&&_0x43f4c8['channelstate']==0x6){utils['info'](util[_0xca75('0x1b')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x43f4c8[_0xca75('0x8')],_0x43f4c8[_0xca75('0x1d')],_0x43f4c8[_0xca75('0x18')]));if(_[_0xca75('0x23')](channels[_0x43f4c8[_0xca75('0x8')]][_0xca75('0x24')])){channels[_0x43f4c8[_0xca75('0x8')]][_0xca75('0x24')]=utils[_0xca75('0x1f')]();}}else if(!_[_0xca75('0x23')](channels[_0x43f4c8[_0xca75('0x17')]])&&_0x43f4c8[_0xca75('0x25')]==0x6&&_0x43f4c8['context']!=_0xca75('0x26')){utils['info'](util[_0xca75('0x1b')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x43f4c8['uniqueid'],_0x43f4c8['linkedid'],_0x43f4c8['context'],_0x43f4c8[_0xca75('0x18')]));channels[_0x43f4c8[_0xca75('0x17')]][_0xca75('0x10')]=_0x43f4c8[_0xca75('0x10')];channels[_0x43f4c8[_0xca75('0x17')]][_0xca75('0x27')]=_0x43f4c8['channel'];if(_[_0xca75('0x23')](channels[_0x43f4c8[_0xca75('0x17')]][_0xca75('0x28')])){channels[_0x43f4c8[_0xca75('0x17')]][_0xca75('0x28')]=utils[_0xca75('0x1f')]();}channels[_0x43f4c8['linkedid']][_0xca75('0x29')]=dispositions[_[_0xca75('0x2a')](_0x43f4c8[_0xca75('0x25')])]||'ANSWERED';}}catch(_0x2faef6){utils['error'](util[_0xca75('0x1b')](_0xca75('0x2b'),_0x43f4c8[_0xca75('0x8')]),_0x2faef6);}};exports[_0xca75('0x2c')]=function(_0x5dbd94){try{if(!_['isNil'](channels[_0x5dbd94[_0xca75('0x8')]])){utils[_0xca75('0x22')](util['format'](_0xca75('0x2d'),_0x5dbd94[_0xca75('0x8')]),_0x5dbd94);if(_[_0xca75('0x23')](channels[_0x5dbd94[_0xca75('0x8')]][_0xca75('0x2e')])){channels[_0x5dbd94[_0xca75('0x8')]][_0xca75('0x2e')]=_0x5dbd94[_0xca75('0x2f')]+'\x20<'+_0x5dbd94[_0xca75('0xd')]+'>';}utils[_0xca75('0x1a')](util[_0xca75('0x1b')](_0xca75('0x30'),_0x5dbd94[_0xca75('0x8')],channels[_0x5dbd94[_0xca75('0x8')]][_0xca75('0x2e')],_0x5dbd94[_0xca75('0x31')]));channels[_0x5dbd94[_0xca75('0x8')]][_0xca75('0x32')]=utils[_0xca75('0x1f')]();channels[_0x5dbd94[_0xca75('0x8')]][_0xca75('0x33')]=utils[_0xca75('0x34')](channels[_0x5dbd94[_0xca75('0x8')]][_0xca75('0x32')],channels[_0x5dbd94[_0xca75('0x8')]][_0xca75('0x35')]);channels[_0x5dbd94['uniqueid']]['billableseconds']=channels[_0x5dbd94[_0xca75('0x8')]][_0xca75('0x28')]?utils['diffTime'](channels[_0x5dbd94[_0xca75('0x8')]][_0xca75('0x32')],channels[_0x5dbd94[_0xca75('0x8')]][_0xca75('0x28')]):0x0;writeDB(channels[_0x5dbd94['uniqueid']]);}}catch(_0x293988){utils[_0xca75('0x20')](util[_0xca75('0x1b')](_0xca75('0x2d'),_0x5dbd94[_0xca75('0x8')]),_0x293988);}};exports[_0xca75('0x36')]=function(_0x3691e8){try{if(!_[_0xca75('0x23')](channels[_0x3691e8[_0xca75('0x37')]])){utils[_0xca75('0x22')](util['format']('[%s][calls][attendedtransfer]',_0x3691e8[_0xca75('0x38')]),_0x3691e8);if(channels[_0x3691e8[_0xca75('0x37')]]['channel']==_0x3691e8[_0xca75('0x39')]){utils[_0xca75('0x1a')](util['format'](_0xca75('0x3a'),_0x3691e8['origtransfereruniqueid'],_0x3691e8[_0xca75('0x37')],_0x3691e8['secondtransfererchannel']));channels[_0x3691e8[_0xca75('0x37')]][_0xca75('0x27')]=_0x3691e8[_0xca75('0x3b')];channels[_0x3691e8[_0xca75('0x37')]][_0xca75('0x3c')]=_0xca75('0x3d');}else if(channels[_0x3691e8[_0xca75('0x37')]][_0xca75('0x18')]=_0x3691e8[_0xca75('0x3e')]){utils[_0xca75('0x1a')](util[_0xca75('0x1b')](_0xca75('0x3a'),_0x3691e8[_0xca75('0x38')],_0x3691e8[_0xca75('0x37')],_0x3691e8[_0xca75('0x3f')]));channels[_0x3691e8[_0xca75('0x37')]]['destinationchannel']=_0x3691e8[_0xca75('0x3f')];channels[_0x3691e8[_0xca75('0x37')]][_0xca75('0x3c')]=_0xca75('0x3d');}}}catch(_0x1aea47){utils[_0xca75('0x20')](util[_0xca75('0x1b')]('[%s][calls][attendedtransfer]',_0x3691e8[_0xca75('0x38')]),_0x1aea47);}};exports[_0xca75('0x40')]=function(_0x36392e){try{if(!_[_0xca75('0x23')](channels[_0x36392e['uniqueid']])){utils[_0xca75('0x22')](util[_0xca75('0x1b')](_0xca75('0x41'),_0x36392e[_0xca75('0x8')]),_0x36392e);channels[_0x36392e[_0xca75('0x8')]][_0xca75('0x42')]=utils[_0xca75('0x1f')]();utils[_0xca75('0x1a')](util[_0xca75('0x1b')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x36392e[_0xca75('0x8')],channels[_0x36392e[_0xca75('0x8')]][_0xca75('0x42')]));}}catch(_0x2caadc){utils[_0xca75('0x20')](util['format']('[%s][calls][musiconholdstart]',_0x36392e['uniqueid']),_0x2caadc);}};exports[_0xca75('0x43')]=function(_0x19f10f){try{if(!_[_0xca75('0x23')](channels[_0x19f10f[_0xca75('0x8')]])){utils[_0xca75('0x22')](util[_0xca75('0x1b')](_0xca75('0x44'),_0x19f10f[_0xca75('0x8')]),_0x19f10f);if(!_[_0xca75('0x23')](channels[_0x19f10f[_0xca75('0x8')]][_0xca75('0x42')])){channels[_0x19f10f[_0xca75('0x8')]][_0xca75('0x45')]+=utils[_0xca75('0x34')](utils[_0xca75('0x1f')](),channels[_0x19f10f[_0xca75('0x8')]]['musiconholdstartAt']);utils['info'](util[_0xca75('0x1b')](_0xca75('0x46'),_0x19f10f[_0xca75('0x8')],channels[_0x19f10f['uniqueid']][_0xca75('0x45')]));delete channels[_0x19f10f[_0xca75('0x8')]][_0xca75('0x42')];}}}catch(_0x4d400e){utils[_0xca75('0x20')](util['format'](_0xca75('0x44'),_0x19f10f['uniqueid']),_0x4d400e);}};exports['varset']=function(_0x1405fe){try{if(!_['isNil'](channels[_0x1405fe[_0xca75('0x8')]])){utils[_0xca75('0x22')](util[_0xca75('0x1b')](_0xca75('0x47'),_0x1405fe[_0xca75('0x8')]),_0x1405fe);if(!_[_0xca75('0x23')](_0x1405fe[_0xca75('0x48')]['xmd-originatecalleridnum'])){utils[_0xca75('0x1a')](util[_0xca75('0x1b')](_0xca75('0x49'),_0x1405fe[_0xca75('0x8')],_0x1405fe[_0xca75('0x4a')]));channels[_0x1405fe[_0xca75('0x8')]][_0xca75('0x4b')]=_0x1405fe[_0xca75('0x4a')];}if(!_[_0xca75('0x23')](_0x1405fe[_0xca75('0x48')][_0xca75('0x4c')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1405fe['uniqueid'],_0x1405fe[_0xca75('0x4a')]));channels[_0x1405fe[_0xca75('0x8')]][_0xca75('0x4d')]=_0x1405fe['value'];channels[_0x1405fe['uniqueid']][_0xca75('0x2e')]='\x22'+_0x1405fe['value']+'\x22\x20<'+_0x1405fe[_0xca75('0x4a')]+'>';}if(!_[_0xca75('0x23')](_0x1405fe['variable'][_0xca75('0x4e')])||!_[_0xca75('0x23')](_0x1405fe['variable'][_0xca75('0x4f')])){utils[_0xca75('0x1a')](util[_0xca75('0x1b')](_0xca75('0x50'),_0x1405fe['uniqueid'],!_[_0xca75('0x23')](_0x1405fe[_0xca75('0x48')][_0xca75('0x4e')])?'xmd-callerid-preview':_0xca75('0x4f'),_0x1405fe[_0xca75('0x4a')]));channels[_0x1405fe[_0xca75('0x8')]][_0xca75('0x2e')]=_0x1405fe['value'];}if(!_[_0xca75('0x23')](_0x1405fe[_0xca75('0x48')]['xmd-queue'])||!_[_0xca75('0x23')](_0x1405fe['variable']['xmcs-queue'])){utils[_0xca75('0x1a')](util[_0xca75('0x1b')](_0xca75('0x50'),_0x1405fe[_0xca75('0x8')],!_[_0xca75('0x23')](_0x1405fe[_0xca75('0x48')][_0xca75('0x51')])?_0xca75('0x51'):_0xca75('0x52'),_0x1405fe['value']));channels[_0x1405fe[_0xca75('0x8')]][_0xca75('0x53')]=_0xca75('0x54');channels[_0x1405fe[_0xca75('0x8')]][_0xca75('0x55')]=_0x1405fe[_0xca75('0x4a')];channels[_0x1405fe['uniqueid']]['queue']=!![];}if(!_[_0xca75('0x23')](_0x1405fe[_0xca75('0x48')][_0xca75('0x56')])){utils[_0xca75('0x1a')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x1405fe[_0xca75('0x8')],_0x1405fe[_0xca75('0x4a')]));channels[_0x1405fe[_0xca75('0x8')]]['ContactId']=_0x1405fe['value'];}if(!_[_0xca75('0x23')](_0x1405fe[_0xca75('0x48')][_0xca75('0x57')])){utils[_0xca75('0x1a')](util['format'](_0xca75('0x58'),_0x1405fe['uniqueid'],_0x1405fe[_0xca75('0x4a')]));channels[_0x1405fe[_0xca75('0x8')]]['type']=_0x1405fe[_0xca75('0x4a')];}if(!_[_0xca75('0x23')](_0x1405fe[_0xca75('0x48')][_0xca75('0x59')])){utils[_0xca75('0x1a')](util[_0xca75('0x1b')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x1405fe[_0xca75('0x8')],_0x1405fe['value']));channels[_0x1405fe[_0xca75('0x8')]][_0xca75('0x5a')]=_0x1405fe[_0xca75('0x4a')];}if(!_[_0xca75('0x23')](_0x1405fe[_0xca75('0x48')]['sipcallid'])){utils[_0xca75('0x1a')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x1405fe[_0xca75('0x8')],_0x1405fe['value']));channels[_0x1405fe['uniqueid']][_0xca75('0x5b')]=_0x1405fe[_0xca75('0x4a')];}}}catch(_0xed0dbe){utils[_0xca75('0x20')](util[_0xca75('0x1b')]('[%s][calls][varset]',_0x1405fe[_0xca75('0x8')]),_0xed0dbe);}};exports[_0xca75('0x5c')]=function(_0x79a6ee){try{if(!_[_0xca75('0x23')](channels[_0x79a6ee['uniqueid']])){utils['debug'](util[_0xca75('0x1b')](_0xca75('0x5d'),_0x79a6ee[_0xca75('0x8')]),_0x79a6ee);utils[_0xca75('0x1a')](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x79a6ee[_0xca75('0x8')],_0x79a6ee['application'],_0x79a6ee[_0xca75('0x5e')]));if(_0x79a6ee['application'][_0xca75('0x5f')]()==_0xca75('0x60')&&_['startsWith'](_0x79a6ee[_0xca75('0x5e')][_0xca75('0x5f')](),'cdr')){var _0xc67ca2=_0x79a6ee[_0xca75('0x5e')][_0xca75('0x61')]('=');var _0x110318=_0xc67ca2[0x0][_0xca75('0x62')](_0xc67ca2[0x0][_0xca75('0x63')]('(')+0x1,_0xc67ca2[0x0][_0xca75('0x63')](')'));var _0x373d33=_0xc67ca2[0x1];channels[_0x79a6ee['uniqueid']][_0x110318]=_0x373d33;}if(!_['includes'](['hangup',_0xca75('0x64'),_0xca75('0x65'),'set',_0xca75('0x66')],_0x79a6ee[_0xca75('0x67')][_0xca75('0x5f')]())){channels[_0x79a6ee['uniqueid']]['lastapplication']=_0x79a6ee[_0xca75('0x67')];channels[_0x79a6ee['uniqueid']][_0xca75('0x55')]=_0x79a6ee['appdata'];}}}catch(_0x1e2337){utils[_0xca75('0x20')](util[_0xca75('0x1b')](_0xca75('0x5d'),_0x79a6ee[_0xca75('0x8')]),_0x1e2337);}}; \ No newline at end of file +var _0x0408=['[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','lastdata','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./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','channel','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','now','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','destinationchannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfereruniqueid','origtransfererchannel'];(function(_0x14bdf7,_0x293bf9){var _0x55f39a=function(_0x8ce310){while(--_0x8ce310){_0x14bdf7['push'](_0x14bdf7['shift']());}};_0x55f39a(++_0x293bf9);}(_0x0408,0x101));var _0x8040=function(_0x22ff79,_0x5b9ad2){_0x22ff79=_0x22ff79-0x0;var _0x52b441=_0x0408[_0x22ff79];return _0x52b441;};'use strict';var _=require(_0x8040('0x0'));var util=require(_0x8040('0x1'));var utils=require('./utils');var transfers=require(_0x8040('0x2'));var dispositions=[_0x8040('0x3'),_0x8040('0x4'),'FAILED',_0x8040('0x3'),_0x8040('0x3'),'NO\x20ANSWER',_0x8040('0x5'),_0x8040('0x6'),'FAILED',_0x8040('0x4'),_0x8040('0x4')];var channels={};function writeDB(_0x297580){var _0x15735e;if(transfers[_0x8040('0x7')][_0x297580[_0x8040('0x8')]]){_0x15735e=_0x297580['uniqueid'];_0x297580[_0x8040('0x8')]=transfers[_0x8040('0x7')][_0x297580['uniqueid']][_0x8040('0x9')];}utils[_0x8040('0xa')](util[_0x8040('0xb')](_0x8040('0xc'),_0x297580[_0x8040('0x8')],_0x297580[_0x8040('0xd')],_0x297580['queue'],_0x297580[_0x8040('0xe')],_0x297580['interface'],_0x297580[_0x8040('0xf')],_0x297580[_0x8040('0x10')],_0x297580[_0x8040('0x11')]));if(_0x297580[_0x8040('0x12')]){utils[_0x8040('0x13')](_0x297580[_0x8040('0x12')])[_0x8040('0x14')](function(_0x5c781e){if(_0x5c781e){_0x297580[_0x8040('0x15')]=_0x5c781e['id'];}utils[_0x8040('0x16')](_0x8040('0x17'),_0x297580);});}else{utils['request'](_0x8040('0x17'),_0x297580);}if(channels[_0x297580[_0x8040('0x8')]]){delete channels[_0x297580[_0x8040('0x8')]];}else if(_0x15735e&&channels[_0x15735e]){delete transfers[_0x8040('0x7')][_0x15735e];delete channels[_0x15735e];}}exports[_0x8040('0x18')]=function(_0xd8cf3e){try{utils[_0x8040('0x19')](util[_0x8040('0xb')](_0x8040('0x1a'),_0xd8cf3e[_0x8040('0x8')]),_0xd8cf3e);if(_0xd8cf3e[_0x8040('0x8')]==_0xd8cf3e['linkedid']&&_0xd8cf3e[_0x8040('0xd')]!='OutgoingSpoolFailed'){utils[_0x8040('0xa')](util[_0x8040('0xb')](_0x8040('0x1b'),_0xd8cf3e[_0x8040('0x8')],_0xd8cf3e[_0x8040('0x1c')],_0xd8cf3e[_0x8040('0x1d')]));channels[_0xd8cf3e[_0x8040('0x8')]]={'uniqueid':_0xd8cf3e['uniqueid'],'accountcode':_0xd8cf3e[_0x8040('0x12')],'source':_0xd8cf3e[_0x8040('0xf')],'destination':_0xd8cf3e[_0x8040('0x1d')],'destinationcontext':_0xd8cf3e[_0x8040('0x1c')],'channel':_0xd8cf3e[_0x8040('0xd')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x8040('0x1e')};}}catch(_0x36fa4d){utils[_0x8040('0x1f')](util['format'](_0x8040('0x1a'),_0xd8cf3e[_0x8040('0x8')]),_0x36fa4d);}};exports[_0x8040('0x20')]=function(_0x149823){try{utils[_0x8040('0x19')](util['format'](_0x8040('0x21'),_0x149823['uniqueid']),_0x149823);if(!_[_0x8040('0x22')](channels[_0x149823[_0x8040('0x8')]])&&_0x149823[_0x8040('0x23')]==0x6){utils[_0x8040('0xa')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x149823[_0x8040('0x8')],_0x149823['context'],_0x149823['channel']));if(_[_0x8040('0x22')](channels[_0x149823[_0x8040('0x8')]][_0x8040('0x24')])){channels[_0x149823['uniqueid']][_0x8040('0x24')]=utils[_0x8040('0x25')]();}}else if(!_[_0x8040('0x22')](channels[_0x149823[_0x8040('0x26')]])&&_0x149823['channelstate']==0x6&&_0x149823['context']!=_0x8040('0x27')){utils[_0x8040('0xa')](util['format'](_0x8040('0x28'),_0x149823[_0x8040('0x8')],_0x149823[_0x8040('0x26')],_0x149823[_0x8040('0x1c')],_0x149823[_0x8040('0xd')]));channels[_0x149823['linkedid']]['accountcode']=_0x149823[_0x8040('0x12')];channels[_0x149823['linkedid']]['destinationchannel']=_0x149823[_0x8040('0xd')];if(_['isNil'](channels[_0x149823[_0x8040('0x26')]]['answertime'])){channels[_0x149823['linkedid']][_0x8040('0x29')]=utils[_0x8040('0x25')]();}channels[_0x149823[_0x8040('0x26')]][_0x8040('0x2a')]=dispositions[_[_0x8040('0x2b')](_0x149823[_0x8040('0x23')])]||'ANSWERED';}}catch(_0x48bd6b){utils[_0x8040('0x1f')](util[_0x8040('0xb')](_0x8040('0x21'),_0x149823[_0x8040('0x8')]),_0x48bd6b);}};exports['hangup']=function(_0x5e6e98){try{if(!_['isNil'](channels[_0x5e6e98[_0x8040('0x8')]])){utils[_0x8040('0x19')](util[_0x8040('0xb')](_0x8040('0x2c'),_0x5e6e98[_0x8040('0x8')]),_0x5e6e98);if(_[_0x8040('0x22')](channels[_0x5e6e98[_0x8040('0x8')]][_0x8040('0x2d')])){channels[_0x5e6e98['uniqueid']]['callerid']=_0x5e6e98['calleridname']+'\x20<'+_0x5e6e98[_0x8040('0xf')]+'>';}utils[_0x8040('0xa')](util[_0x8040('0xb')](_0x8040('0x2e'),_0x5e6e98['uniqueid'],channels[_0x5e6e98[_0x8040('0x8')]][_0x8040('0x2d')],_0x5e6e98[_0x8040('0x2f')]));channels[_0x5e6e98[_0x8040('0x8')]][_0x8040('0x30')]=utils[_0x8040('0x25')]();channels[_0x5e6e98[_0x8040('0x8')]]['duration']=utils[_0x8040('0x31')](channels[_0x5e6e98['uniqueid']][_0x8040('0x30')],channels[_0x5e6e98['uniqueid']][_0x8040('0x32')]);channels[_0x5e6e98['uniqueid']]['billableseconds']=channels[_0x5e6e98[_0x8040('0x8')]][_0x8040('0x29')]?utils['diffTime'](channels[_0x5e6e98['uniqueid']]['endtime'],channels[_0x5e6e98[_0x8040('0x8')]][_0x8040('0x29')]):0x0;writeDB(channels[_0x5e6e98[_0x8040('0x8')]]);}}catch(_0x509870){utils[_0x8040('0x1f')](util['format'](_0x8040('0x2c'),_0x5e6e98[_0x8040('0x8')]),_0x509870);}};exports['attendedtransfer']=function(_0x168175){try{if(!_[_0x8040('0x22')](channels[_0x168175[_0x8040('0x33')]])){utils[_0x8040('0x19')](util[_0x8040('0xb')]('[%s][calls][attendedtransfer]',_0x168175['origtransfereruniqueid']),_0x168175);if(channels[_0x168175[_0x8040('0x33')]][_0x8040('0xd')]==_0x168175[_0x8040('0x34')]){utils[_0x8040('0xa')](util[_0x8040('0xb')](_0x8040('0x35'),_0x168175['origtransfereruniqueid'],_0x168175['localtwolinkedid'],_0x168175['secondtransfererchannel']));channels[_0x168175[_0x8040('0x33')]][_0x8040('0x36')]=_0x168175[_0x8040('0x37')];channels[_0x168175['localtwolinkedid']][_0x8040('0x38')]=_0x8040('0x39');}else if(channels[_0x168175[_0x8040('0x33')]][_0x8040('0xd')]=_0x168175[_0x8040('0x3a')]){utils[_0x8040('0xa')](util[_0x8040('0xb')](_0x8040('0x35'),_0x168175[_0x8040('0x3b')],_0x168175[_0x8040('0x33')],_0x168175['origtransfererchannel']));channels[_0x168175[_0x8040('0x33')]]['destinationchannel']=_0x168175[_0x8040('0x3c')];channels[_0x168175[_0x8040('0x33')]][_0x8040('0x38')]=_0x8040('0x39');}}}catch(_0x1d0f6d){utils[_0x8040('0x1f')](util[_0x8040('0xb')](_0x8040('0x3d'),_0x168175[_0x8040('0x3b')]),_0x1d0f6d);}};exports['musiconholdstart']=function(_0x20d034){try{if(!_[_0x8040('0x22')](channels[_0x20d034['uniqueid']])){utils['debug'](util[_0x8040('0xb')](_0x8040('0x3e'),_0x20d034[_0x8040('0x8')]),_0x20d034);channels[_0x20d034[_0x8040('0x8')]]['musiconholdstartAt']=utils[_0x8040('0x25')]();utils[_0x8040('0xa')](util['format'](_0x8040('0x3f'),_0x20d034['uniqueid'],channels[_0x20d034['uniqueid']][_0x8040('0x40')]));}}catch(_0x1de3d9){utils[_0x8040('0x1f')](util[_0x8040('0xb')](_0x8040('0x3e'),_0x20d034[_0x8040('0x8')]),_0x1de3d9);}};exports[_0x8040('0x41')]=function(_0x3d664b){try{if(!_[_0x8040('0x22')](channels[_0x3d664b[_0x8040('0x8')]])){utils['debug'](util[_0x8040('0xb')](_0x8040('0x42'),_0x3d664b['uniqueid']),_0x3d664b);if(!_['isNil'](channels[_0x3d664b[_0x8040('0x8')]][_0x8040('0x40')])){channels[_0x3d664b[_0x8040('0x8')]]['mohtime']+=utils[_0x8040('0x31')](utils[_0x8040('0x25')](),channels[_0x3d664b[_0x8040('0x8')]]['musiconholdstartAt']);utils[_0x8040('0xa')](util[_0x8040('0xb')](_0x8040('0x43'),_0x3d664b[_0x8040('0x8')],channels[_0x3d664b[_0x8040('0x8')]][_0x8040('0x44')]));delete channels[_0x3d664b[_0x8040('0x8')]][_0x8040('0x40')];}}}catch(_0x1933a8){utils[_0x8040('0x1f')](util[_0x8040('0xb')](_0x8040('0x42'),_0x3d664b['uniqueid']),_0x1933a8);}};exports[_0x8040('0x45')]=function(_0x1a73d2){try{if(!_[_0x8040('0x22')](channels[_0x1a73d2[_0x8040('0x8')]])){utils['debug'](util[_0x8040('0xb')](_0x8040('0x46'),_0x1a73d2[_0x8040('0x8')]),_0x1a73d2);if(!_['isNil'](_0x1a73d2[_0x8040('0x47')][_0x8040('0x48')])){utils[_0x8040('0xa')](util[_0x8040('0xb')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1a73d2['uniqueid'],_0x1a73d2[_0x8040('0x49')]));channels[_0x1a73d2[_0x8040('0x8')]]['source']=_0x1a73d2[_0x8040('0x49')];}if(!_['isNil'](_0x1a73d2['variable'][_0x8040('0x4a')])){utils['info'](util[_0x8040('0xb')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1a73d2[_0x8040('0x8')],_0x1a73d2[_0x8040('0x49')]));channels[_0x1a73d2['uniqueid']][_0x8040('0x4b')]=_0x1a73d2[_0x8040('0x49')];channels[_0x1a73d2[_0x8040('0x8')]][_0x8040('0x2d')]='\x22'+_0x1a73d2['value']+_0x8040('0x4c')+_0x1a73d2[_0x8040('0x49')]+'>';}if(!_[_0x8040('0x22')](_0x1a73d2[_0x8040('0x47')][_0x8040('0x4d')])||!_[_0x8040('0x22')](_0x1a73d2[_0x8040('0x47')]['xmd-callerid'])){utils[_0x8040('0xa')](util[_0x8040('0xb')](_0x8040('0x4e'),_0x1a73d2[_0x8040('0x8')],!_['isNil'](_0x1a73d2[_0x8040('0x47')][_0x8040('0x4d')])?'xmd-callerid-preview':_0x8040('0x4f'),_0x1a73d2[_0x8040('0x49')]));channels[_0x1a73d2[_0x8040('0x8')]][_0x8040('0x2d')]=_0x1a73d2[_0x8040('0x49')];}if(!_[_0x8040('0x22')](_0x1a73d2['variable'][_0x8040('0x50')])||!_['isNil'](_0x1a73d2[_0x8040('0x47')]['xmcs-queue'])){utils[_0x8040('0xa')](util[_0x8040('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1a73d2[_0x8040('0x8')],!_[_0x8040('0x22')](_0x1a73d2[_0x8040('0x47')]['xmd-queue'])?'xmd-queue':_0x8040('0x51'),_0x1a73d2[_0x8040('0x49')]));channels[_0x1a73d2[_0x8040('0x8')]][_0x8040('0x52')]='Queue';channels[_0x1a73d2[_0x8040('0x8')]][_0x8040('0x53')]=_0x1a73d2[_0x8040('0x49')];channels[_0x1a73d2[_0x8040('0x8')]][_0x8040('0x54')]=!![];}if(!_[_0x8040('0x22')](_0x1a73d2['variable']['xmd-contactid'])){utils[_0x8040('0xa')](util[_0x8040('0xb')](_0x8040('0x55'),_0x1a73d2[_0x8040('0x8')],_0x1a73d2[_0x8040('0x49')]));channels[_0x1a73d2['uniqueid']][_0x8040('0x56')]=_0x1a73d2[_0x8040('0x49')];}if(!_[_0x8040('0x22')](_0x1a73d2[_0x8040('0x47')][_0x8040('0x57')])){utils[_0x8040('0xa')](util['format'](_0x8040('0x58'),_0x1a73d2[_0x8040('0x8')],_0x1a73d2['value']));channels[_0x1a73d2[_0x8040('0x8')]][_0x8040('0x59')]=_0x1a73d2[_0x8040('0x49')];}if(!_['isNil'](_0x1a73d2['variable'][_0x8040('0x5a')])){utils['info'](util[_0x8040('0xb')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x1a73d2[_0x8040('0x8')],_0x1a73d2[_0x8040('0x49')]));channels[_0x1a73d2[_0x8040('0x8')]]['routeid']=_0x1a73d2[_0x8040('0x49')];}if(!_[_0x8040('0x22')](_0x1a73d2[_0x8040('0x47')][_0x8040('0x5b')])){utils[_0x8040('0xa')](util[_0x8040('0xb')](_0x8040('0x5c'),_0x1a73d2[_0x8040('0x8')],_0x1a73d2[_0x8040('0x49')]));channels[_0x1a73d2['uniqueid']][_0x8040('0x5b')]=_0x1a73d2[_0x8040('0x49')];}}}catch(_0x19a175){utils[_0x8040('0x1f')](util[_0x8040('0xb')](_0x8040('0x46'),_0x1a73d2[_0x8040('0x8')]),_0x19a175);}};exports['newexten']=function(_0x1c0d38){try{if(!_[_0x8040('0x22')](channels[_0x1c0d38[_0x8040('0x8')]])){utils[_0x8040('0x19')](util[_0x8040('0xb')]('[%s][calls][newexten]',_0x1c0d38[_0x8040('0x8')]),_0x1c0d38);utils[_0x8040('0xa')](util[_0x8040('0xb')](_0x8040('0x5d'),_0x1c0d38['uniqueid'],_0x1c0d38[_0x8040('0x5e')],_0x1c0d38[_0x8040('0x5f')]));if(_0x1c0d38[_0x8040('0x5e')]['toLowerCase']()==_0x8040('0x60')&&_[_0x8040('0x61')](_0x1c0d38[_0x8040('0x5f')][_0x8040('0x62')](),_0x8040('0x63'))){var _0x18e896=_0x1c0d38[_0x8040('0x5f')]['split']('=');var _0x54442f=_0x18e896[0x0][_0x8040('0x64')](_0x18e896[0x0][_0x8040('0x65')]('(')+0x1,_0x18e896[0x0]['lastIndexOf'](')'));var _0x584430=_0x18e896[0x1];channels[_0x1c0d38['uniqueid']][_0x54442f]=_0x584430;}if(!_[_0x8040('0x66')](['hangup',_0x8040('0x67'),_0x8040('0x68'),_0x8040('0x60'),_0x8040('0x69')],_0x1c0d38['application']['toLowerCase']())){channels[_0x1c0d38[_0x8040('0x8')]]['lastapplication']=_0x1c0d38['application'];channels[_0x1c0d38[_0x8040('0x8')]][_0x8040('0x53')]=_0x1c0d38['appdata'];}}}catch(_0x1d4d4e){utils[_0x8040('0x1f')](util[_0x8040('0xb')]('[%s][calls][newexten]',_0x1c0d38[_0x8040('0x8')]),_0x1d4d4e);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 9d1be41..f4fc879 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 _0x614e=['[core]\x20close','managerevent','./utils','connect','[core]\x20connected','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x170c06,_0xbc47b8){var _0x1702df=function(_0x1a6727){while(--_0x1a6727){_0x170c06['push'](_0x170c06['shift']());}};_0x1702df(++_0xbc47b8);}(_0x614e,0x7a));var _0xe614=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x614e[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0xe614('0x0'));exports[_0xe614('0x1')]=function(){utils['info'](_0xe614('0x2'));};exports['shutdown']=function(){utils[_0xe614('0x3')](_0xe614('0x4'));};exports[_0xe614('0x5')]=function(){utils['info'](_0xe614('0x6'));};exports['error']=function(_0x5ed93d){utils[_0xe614('0x7')](_0xe614('0x8'),_0x5ed93d);};exports[_0xe614('0x9')]=function(){utils[_0xe614('0x3')](_0xe614('0xa'));};exports[_0xe614('0xb')]=function(_0x66b81a){}; \ No newline at end of file +var _0xc863=['fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xc863,0x1e6));var _0x3c86=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0xc863[_0x50f392];return _0x5926f2;};'use strict';var utils=require(_0x3c86('0x0'));exports[_0x3c86('0x1')]=function(){utils[_0x3c86('0x2')](_0x3c86('0x3'));};exports[_0x3c86('0x4')]=function(){utils[_0x3c86('0x2')](_0x3c86('0x5'));};exports[_0x3c86('0x6')]=function(){utils['info'](_0x3c86('0x7'));};exports[_0x3c86('0x8')]=function(_0x152acb){utils[_0x3c86('0x8')]('[core]\x20error',_0x152acb);};exports[_0x3c86('0x9')]=function(){utils[_0x3c86('0x2')](_0x3c86('0xa'));};exports[_0x3c86('0xb')]=function(_0x350863){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index aad5776..15093bc 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 _0x7608=['holdtime','lodash','util','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','error','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','starttime','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','dialstatus','ANSWER','now','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime'];(function(_0x30ceb3,_0x500c52){var _0x1d5f41=function(_0x5c01c8){while(--_0x5c01c8){_0x30ceb3['push'](_0x30ceb3['shift']());}};_0x1d5f41(++_0x500c52);}(_0x7608,0x158));var _0x8760=function(_0x1f8089,_0x39c32){_0x1f8089=_0x1f8089-0x0;var _0x205a59=_0x7608[_0x1f8089];return _0x205a59;};'use strict';var _=require(_0x8760('0x0'));var util=require(_0x8760('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x326789){utils['info'](util[_0x8760('0x2')](_0x8760('0x3'),_0x326789[_0x8760('0x4')],_0x326789[_0x8760('0x5')],_0x326789['dialstring'],_0x326789['calleridnum'],_0x326789['connectedlinenum'],_0x326789['dialstatus']));utils[_0x8760('0x6')](_0x8760('0x7'),_0x326789);delete dials[_0x326789['uniqueid']];}exports[_0x8760('0x8')]=function(_0xe0142f){try{utils[_0x8760('0x9')](util['format'](_0x8760('0xa'),_0xe0142f[_0x8760('0x4')]),_0xe0142f);utils[_0x8760('0xb')](util[_0x8760('0x2')](_0x8760('0xc'),_0xe0142f['uniqueid'],_0xe0142f[_0x8760('0xd')],_0xe0142f[_0x8760('0xe')]));if(_0xe0142f[_0x8760('0xd')][_0x8760('0xf')]()=='set'&&_[_0x8760('0x10')](_0xe0142f['appdata'][_0x8760('0xf')](),_0x8760('0x11'))){var _0x3c4c38=_0xe0142f[_0x8760('0xe')]['split']('=');dials[_0xe0142f['uniqueid']]={'routeId':_0x3c4c38[0x1]};}}catch(_0x117d44){utils[_0x8760('0x12')](util['format'](_0x8760('0xa'),_0xe0142f[_0x8760('0x4')]),_0x117d44);}};exports['varset']=function(_0x70f4f4){try{utils[_0x8760('0x9')](util[_0x8760('0x2')](_0x8760('0x13'),_0x70f4f4[_0x8760('0x4')]),_0x70f4f4);if(!_[_0x8760('0x14')](_0x70f4f4[_0x8760('0x15')][_0x8760('0x16')])){utils[_0x8760('0xb')](util[_0x8760('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x70f4f4[_0x8760('0x4')],_0x70f4f4[_0x8760('0x17')]));dials[_0x70f4f4[_0x8760('0x4')]]={'routeId':_0x70f4f4['value']};}}catch(_0x572977){utils['error'](util[_0x8760('0x2')](_0x8760('0x13'),_0x70f4f4[_0x8760('0x4')]),_0x572977);}};exports[_0x8760('0x18')]=function(_0x54bbde){try{if(!_['isNil'](dials[_0x54bbde[_0x8760('0x4')]])){utils[_0x8760('0x9')](util[_0x8760('0x2')](_0x8760('0x19'),_0x54bbde['uniqueid']),_0x54bbde);dials[_0x54bbde[_0x8760('0x4')]]=_['assign'](dials[_0x54bbde[_0x8760('0x4')]],_0x54bbde);dials[_0x54bbde['uniqueid']][_0x8760('0x1a')]=utils['now']();dials[_0x54bbde['uniqueid']]['lastevent']=_0x8760('0x1b');utils[_0x8760('0xb')](util[_0x8760('0x2')](_0x8760('0x1c'),_0x54bbde[_0x8760('0x4')],dials[_0x54bbde[_0x8760('0x4')]][_0x8760('0x1a')]));}}catch(_0x13a08a){utils[_0x8760('0x12')](util[_0x8760('0x2')](_0x8760('0x19'),_0x54bbde['uniqueid']),_0x13a08a);}};exports[_0x8760('0x1d')]=function(_0x418abc){try{if(!_['isNil'](dials[_0x418abc[_0x8760('0x4')]])){utils['debug'](util[_0x8760('0x2')]('[%s][dials][dialend]',_0x418abc[_0x8760('0x4')]),_0x418abc);dials[_0x418abc[_0x8760('0x4')]][_0x8760('0x1e')]=_0x418abc[_0x8760('0x1e')];if(_0x418abc['dialstatus']==_0x8760('0x1f')){dials[_0x418abc['uniqueid']]=_['assign'](dials[_0x418abc[_0x8760('0x4')]],_0x418abc);dials[_0x418abc['uniqueid']]['answertime']=utils[_0x8760('0x20')]();dials[_0x418abc[_0x8760('0x4')]][_0x8760('0x21')]=_0x8760('0x22');utils[_0x8760('0xb')](util[_0x8760('0x2')](_0x8760('0x23'),_0x418abc['uniqueid'],_0x418abc[_0x8760('0x1e')],dials[_0x418abc[_0x8760('0x4')]][_0x8760('0x24')]));}else{utils[_0x8760('0xb')](util[_0x8760('0x2')](_0x8760('0x25'),_0x418abc[_0x8760('0x4')],_0x418abc[_0x8760('0x1e')]));}}}catch(_0x33c126){utils[_0x8760('0x12')](util[_0x8760('0x2')](_0x8760('0x26'),_0x418abc[_0x8760('0x4')]),_0x33c126);}};exports[_0x8760('0x27')]=function(_0x517a30){try{if(!_[_0x8760('0x14')](dials[_0x517a30[_0x8760('0x4')]])){utils['debug'](util[_0x8760('0x2')](_0x8760('0x28'),_0x517a30[_0x8760('0x4')]),_0x517a30);utils[_0x8760('0xb')](util[_0x8760('0x2')](_0x8760('0x29'),_0x517a30[_0x8760('0x4')],_0x517a30['calleridnum'],_0x517a30[_0x8760('0x2a')],_0x517a30[_0x8760('0x2b')]));dials[_0x517a30[_0x8760('0x4')]]=_['assign'](dials[_0x517a30[_0x8760('0x4')]],{'endtime':utils[_0x8760('0x20')](),'lastevent':_0x8760('0x2c')});dials[_0x517a30['uniqueid']][_0x8760('0x2d')]=utils[_0x8760('0x2e')](dials[_0x517a30[_0x8760('0x4')]][_0x8760('0x2f')],dials[_0x517a30[_0x8760('0x4')]][_0x8760('0x1a')]);dials[_0x517a30[_0x8760('0x4')]][_0x8760('0x30')]=utils[_0x8760('0x2e')](dials[_0x517a30[_0x8760('0x4')]][_0x8760('0x24')]||dials[_0x517a30['uniqueid']][_0x8760('0x2f')],dials[_0x517a30['uniqueid']][_0x8760('0x1a')]);dials[_0x517a30[_0x8760('0x4')]]['billableseconds']=dials[_0x517a30[_0x8760('0x4')]]['answertime']?utils[_0x8760('0x2e')](dials[_0x517a30['uniqueid']][_0x8760('0x2f')],dials[_0x517a30['uniqueid']][_0x8760('0x24')]):0x0;writeDB(dials[_0x517a30[_0x8760('0x4')]]);}}catch(_0x5c05e3){utils[_0x8760('0x12')](util['format'](_0x8760('0x28'),_0x517a30['uniqueid']),_0x5c05e3);}}; \ No newline at end of file +var _0x1de8=['channel','calleridnum','connectedlinenum','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','split','[%s][dials][newexten]','varset','isNil','variable','outboundrouteid','value','error','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','uniqueid'];(function(_0x5ee73b,_0x282c4c){var _0x22948a=function(_0x4bb79b){while(--_0x4bb79b){_0x5ee73b['push'](_0x5ee73b['shift']());}};_0x22948a(++_0x282c4c);}(_0x1de8,0xca));var _0x81de=function(_0x1e175d,_0x41ff45){_0x1e175d=_0x1e175d-0x0;var _0x3a3ce5=_0x1de8[_0x1e175d];return _0x3a3ce5;};'use strict';var _=require(_0x81de('0x0'));var util=require(_0x81de('0x1'));var utils=require(_0x81de('0x2'));var dials={};function writeDB(_0x199929){utils[_0x81de('0x3')](util[_0x81de('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x199929[_0x81de('0x5')],_0x199929[_0x81de('0x6')],_0x199929['dialstring'],_0x199929[_0x81de('0x7')],_0x199929[_0x81de('0x8')],_0x199929['dialstatus']));utils['request'](_0x81de('0x9'),_0x199929);delete dials[_0x199929[_0x81de('0x5')]];}exports[_0x81de('0xa')]=function(_0x1345f9){try{utils[_0x81de('0xb')](util['format']('[%s][dials][newexten]',_0x1345f9['uniqueid']),_0x1345f9);utils['info'](util[_0x81de('0x4')](_0x81de('0xc'),_0x1345f9[_0x81de('0x5')],_0x1345f9[_0x81de('0xd')],_0x1345f9[_0x81de('0xe')]));if(_0x1345f9[_0x81de('0xd')]['toLowerCase']()==_0x81de('0xf')&&_[_0x81de('0x10')](_0x1345f9[_0x81de('0xe')][_0x81de('0x11')](),_0x81de('0x12'))){var _0x3c36a0=_0x1345f9[_0x81de('0xe')][_0x81de('0x13')]('=');dials[_0x1345f9[_0x81de('0x5')]]={'routeId':_0x3c36a0[0x1]};}}catch(_0x108d7b){utils['error'](util[_0x81de('0x4')](_0x81de('0x14'),_0x1345f9['uniqueid']),_0x108d7b);}};exports[_0x81de('0x15')]=function(_0x433912){try{utils[_0x81de('0xb')](util[_0x81de('0x4')]('[%s][dials][varset]',_0x433912[_0x81de('0x5')]),_0x433912);if(!_[_0x81de('0x16')](_0x433912[_0x81de('0x17')][_0x81de('0x18')])){utils[_0x81de('0x3')](util[_0x81de('0x4')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x433912[_0x81de('0x5')],_0x433912[_0x81de('0x19')]));dials[_0x433912[_0x81de('0x5')]]={'routeId':_0x433912['value']};}}catch(_0xc39eb9){utils[_0x81de('0x1a')](util['format'](_0x81de('0x1b'),_0x433912['uniqueid']),_0xc39eb9);}};exports[_0x81de('0x1c')]=function(_0x231a87){try{if(!_[_0x81de('0x16')](dials[_0x231a87['uniqueid']])){utils[_0x81de('0xb')](util[_0x81de('0x4')](_0x81de('0x1d'),_0x231a87[_0x81de('0x5')]),_0x231a87);dials[_0x231a87[_0x81de('0x5')]]=_[_0x81de('0x1e')](dials[_0x231a87[_0x81de('0x5')]],_0x231a87);dials[_0x231a87[_0x81de('0x5')]][_0x81de('0x1f')]=utils[_0x81de('0x20')]();dials[_0x231a87['uniqueid']][_0x81de('0x21')]=_0x81de('0x22');utils['info'](util[_0x81de('0x4')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x231a87[_0x81de('0x5')],dials[_0x231a87['uniqueid']][_0x81de('0x1f')]));}}catch(_0x559785){utils[_0x81de('0x1a')](util[_0x81de('0x4')]('[%s][dials][dialbegin]',_0x231a87[_0x81de('0x5')]),_0x559785);}};exports[_0x81de('0x23')]=function(_0x4eb897){try{if(!_[_0x81de('0x16')](dials[_0x4eb897['uniqueid']])){utils[_0x81de('0xb')](util[_0x81de('0x4')](_0x81de('0x24'),_0x4eb897[_0x81de('0x5')]),_0x4eb897);dials[_0x4eb897['uniqueid']][_0x81de('0x25')]=_0x4eb897[_0x81de('0x25')];if(_0x4eb897[_0x81de('0x25')]==_0x81de('0x26')){dials[_0x4eb897['uniqueid']]=_[_0x81de('0x1e')](dials[_0x4eb897['uniqueid']],_0x4eb897);dials[_0x4eb897[_0x81de('0x5')]][_0x81de('0x27')]=utils[_0x81de('0x20')]();dials[_0x4eb897[_0x81de('0x5')]][_0x81de('0x21')]=_0x81de('0x28');utils[_0x81de('0x3')](util[_0x81de('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x4eb897['uniqueid'],_0x4eb897[_0x81de('0x25')],dials[_0x4eb897[_0x81de('0x5')]][_0x81de('0x27')]));}else{utils['info'](util['format'](_0x81de('0x29'),_0x4eb897['uniqueid'],_0x4eb897[_0x81de('0x25')]));}}}catch(_0x1e66cb){utils[_0x81de('0x1a')](util[_0x81de('0x4')](_0x81de('0x24'),_0x4eb897[_0x81de('0x5')]),_0x1e66cb);}};exports[_0x81de('0x2a')]=function(_0x19431e){try{if(!_[_0x81de('0x16')](dials[_0x19431e[_0x81de('0x5')]])){utils[_0x81de('0xb')](util[_0x81de('0x4')](_0x81de('0x2b'),_0x19431e[_0x81de('0x5')]),_0x19431e);utils['info'](util[_0x81de('0x4')](_0x81de('0x2c'),_0x19431e['uniqueid'],_0x19431e[_0x81de('0x7')],_0x19431e[_0x81de('0x2d')],_0x19431e['cause-txt']));dials[_0x19431e['uniqueid']]=_[_0x81de('0x1e')](dials[_0x19431e['uniqueid']],{'endtime':utils['now'](),'lastevent':_0x81de('0x2e')});dials[_0x19431e[_0x81de('0x5')]][_0x81de('0x2f')]=utils[_0x81de('0x30')](dials[_0x19431e[_0x81de('0x5')]][_0x81de('0x31')],dials[_0x19431e[_0x81de('0x5')]][_0x81de('0x1f')]);dials[_0x19431e['uniqueid']][_0x81de('0x32')]=utils['diffTime'](dials[_0x19431e[_0x81de('0x5')]][_0x81de('0x27')]||dials[_0x19431e[_0x81de('0x5')]][_0x81de('0x31')],dials[_0x19431e[_0x81de('0x5')]][_0x81de('0x1f')]);dials[_0x19431e[_0x81de('0x5')]][_0x81de('0x33')]=dials[_0x19431e[_0x81de('0x5')]][_0x81de('0x27')]?utils[_0x81de('0x30')](dials[_0x19431e[_0x81de('0x5')]][_0x81de('0x31')],dials[_0x19431e['uniqueid']][_0x81de('0x27')]):0x0;writeDB(dials[_0x19431e[_0x81de('0x5')]]);}}catch(_0x1c5fdf){utils[_0x81de('0x1a')](util[_0x81de('0x4')](_0x81de('0x2b'),_0x19431e[_0x81de('0x5')]),_0x1c5fdf);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 1a80bcd..d6eed29 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 _0xa958=['util','asterisk','port','username','password','disabled','info','XDR\x20DISABLED','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','format','[%s][index][devicestatechange]','device','devicestatechange','debug','uniqueid','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils'];(function(_0x586fbd,_0x2f21b4){var _0x2185e0=function(_0x1476fe){while(--_0x1476fe){_0x586fbd['push'](_0x586fbd['shift']());}};_0x2185e0(++_0x2f21b4);}(_0xa958,0xc4));var _0x8a95=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xa958[_0x160c73];return _0xd9302;};var AsteriskManager=require('asterisk-manager');var config=require(_0x8a95('0x0'));var utils=require(_0x8a95('0x1'));var util=require(_0x8a95('0x2'));var ami=new AsteriskManager(config[_0x8a95('0x3')][_0x8a95('0x4')],config['asterisk']['ip'],config[_0x8a95('0x3')][_0x8a95('0x5')],config[_0x8a95('0x3')][_0x8a95('0x6')],!![]);ami['keepConnected']();if(config['xdr']&&config['xdr'][_0x8a95('0x7')]){utils[_0x8a95('0x8')](_0x8a95('0x9'));}else{var agents=require('./agents.controller');var calls=require(_0x8a95('0xa'));var queues=require('./queues.controller');var recordings=require(_0x8a95('0xb'));var members=require(_0x8a95('0xc'));var dials=require(_0x8a95('0xd'));var transfers=require(_0x8a95('0xe'));var core=require('./core.controller');ami['on']('connect',core[_0x8a95('0xf')]);ami['on'](_0x8a95('0x10'),core[_0x8a95('0x10')]);ami['on'](_0x8a95('0x11'),core[_0x8a95('0x11')]);ami['on']('error',core[_0x8a95('0x12')]);ami['on'](_0x8a95('0x13'),core[_0x8a95('0x13')]);ami['on'](_0x8a95('0x14'),core[_0x8a95('0x14')]);ami['on']('devicestatechange',function(_0x4b9414){try{utils['debug'](util[_0x8a95('0x15')](_0x8a95('0x16'),_0x4b9414[_0x8a95('0x17')]),_0x4b9414);members[_0x8a95('0x18')](_0x4b9414);}catch(_0x1ae545){utils[_0x8a95('0x12')](util['format']('[%s][index][devicestatechange]',_0x4b9414[_0x8a95('0x17')]),_0x1ae545);}});ami['on']('agentcalled',function(_0x52fdd9){try{utils[_0x8a95('0x19')](util[_0x8a95('0x15')]('[%s][index][agentcalled]',_0x52fdd9[_0x8a95('0x1a')]),_0x52fdd9);agents[_0x8a95('0x1b')](_0x52fdd9);}catch(_0x47d867){utils['error'](util['format'](_0x8a95('0x1c'),_0x52fdd9['uniqueid']),_0x47d867);}});ami['on'](_0x8a95('0x1d'),function(_0x2a80bd){try{utils[_0x8a95('0x19')](util['format'](_0x8a95('0x1e'),_0x2a80bd[_0x8a95('0x1a')]),_0x2a80bd);agents[_0x8a95('0x1d')](_0x2a80bd);}catch(_0x19448d){utils['error'](util[_0x8a95('0x15')](_0x8a95('0x1e'),_0x2a80bd['uniqueid']),_0x19448d);}});ami['on'](_0x8a95('0x1f'),function(_0x111dc7){try{utils['debug'](util[_0x8a95('0x15')](_0x8a95('0x20'),_0x111dc7['uniqueid']),_0x111dc7);agents[_0x8a95('0x1f')](_0x111dc7);queues['agentconnect'](_0x111dc7);}catch(_0x2222b9){utils['error'](util['format'](_0x8a95('0x20'),_0x111dc7['uniqueid']),_0x2222b9);}});ami['on'](_0x8a95('0x21'),function(_0xaba4c1){try{utils[_0x8a95('0x19')](util[_0x8a95('0x15')](_0x8a95('0x22'),_0xaba4c1[_0x8a95('0x1a')]),_0xaba4c1);agents[_0x8a95('0x21')](_0xaba4c1);queues[_0x8a95('0x21')](_0xaba4c1);members[_0x8a95('0x21')](_0xaba4c1);}catch(_0x9e92ce){utils['error'](util['format']('[%s][index][agentcomplete]',_0xaba4c1['uniqueid']),_0x9e92ce);}});ami['on'](_0x8a95('0x23'),function(_0x14c4d5){try{utils[_0x8a95('0x19')](util['format'](_0x8a95('0x24'),_0x14c4d5['uniqueid']),_0x14c4d5);agents[_0x8a95('0x23')](_0x14c4d5);queues['queuecallerabandon'](_0x14c4d5);}catch(_0x11d5d1){utils['error'](util[_0x8a95('0x15')]('[%s][index][queuecallerabandon]',_0x14c4d5['uniqueid']),_0x11d5d1);}});ami['on'](_0x8a95('0x25'),function(_0x269382){try{utils[_0x8a95('0x19')](util[_0x8a95('0x15')](_0x8a95('0x26'),_0x269382[_0x8a95('0x1a')]),_0x269382);queues[_0x8a95('0x25')](_0x269382);recordings[_0x8a95('0x25')](_0x269382);}catch(_0x123881){utils[_0x8a95('0x12')](util[_0x8a95('0x15')](_0x8a95('0x26'),_0x269382[_0x8a95('0x1a')]),_0x123881);}});ami['on'](_0x8a95('0x27'),function(_0x2739c0){try{utils[_0x8a95('0x19')](util[_0x8a95('0x15')](_0x8a95('0x28'),_0x2739c0[_0x8a95('0x1a')]),_0x2739c0);queues[_0x8a95('0x27')](_0x2739c0);}catch(_0x3d0522){utils[_0x8a95('0x12')](util[_0x8a95('0x15')](_0x8a95('0x28'),_0x2739c0[_0x8a95('0x1a')]),_0x3d0522);}});ami['on'](_0x8a95('0x29'),function(_0x4f4109){try{utils[_0x8a95('0x19')](util[_0x8a95('0x15')](_0x8a95('0x2a'),_0x4f4109['uniqueid']),_0x4f4109);queues['musiconholdstart'](_0x4f4109);calls[_0x8a95('0x29')](_0x4f4109);}catch(_0x168a72){utils[_0x8a95('0x12')](util[_0x8a95('0x15')]('[%s][index][musiconholdstart]',_0x4f4109[_0x8a95('0x1a')]),_0x168a72);}});ami['on'](_0x8a95('0x2b'),function(_0x42912b){try{utils['debug'](util[_0x8a95('0x15')](_0x8a95('0x2c'),_0x42912b[_0x8a95('0x1a')]),_0x42912b);queues['musiconholdstop'](_0x42912b);calls[_0x8a95('0x2b')](_0x42912b);}catch(_0x48efa7){utils['error'](util[_0x8a95('0x15')](_0x8a95('0x2c'),_0x42912b[_0x8a95('0x1a')]),_0x48efa7);}});ami['on']('newstate',function(_0x155b1a){try{utils[_0x8a95('0x19')](util[_0x8a95('0x15')](_0x8a95('0x2d'),_0x155b1a['uniqueid']),_0x155b1a);calls[_0x8a95('0x2e')](_0x155b1a);recordings[_0x8a95('0x2e')](_0x155b1a);}catch(_0x3441be){utils[_0x8a95('0x12')](util['format'](_0x8a95('0x2d'),_0x155b1a[_0x8a95('0x1a')]),_0x3441be);}});ami['on'](_0x8a95('0x2f'),function(_0x2ea9b4){try{utils[_0x8a95('0x19')](util[_0x8a95('0x15')](_0x8a95('0x30'),_0x2ea9b4[_0x8a95('0x1a')]),_0x2ea9b4);calls['hangup'](_0x2ea9b4);recordings[_0x8a95('0x2f')](_0x2ea9b4);dials[_0x8a95('0x2f')](_0x2ea9b4);agents[_0x8a95('0x2f')](_0x2ea9b4);queues[_0x8a95('0x2f')](_0x2ea9b4);}catch(_0x5a56b4){utils['error'](util[_0x8a95('0x15')](_0x8a95('0x30'),_0x2ea9b4[_0x8a95('0x1a')]),_0x5a56b4);}});ami['on'](_0x8a95('0x31'),function(_0x40d55f){try{utils[_0x8a95('0x19')](util[_0x8a95('0x15')]('[%s][index][cdr]',_0x40d55f['uniqueid']),_0x40d55f);members[_0x8a95('0x31')](_0x40d55f);}catch(_0x174402){utils['error'](util[_0x8a95('0x15')]('[%s][index][cdr]',_0x40d55f['uniqueid']),_0x174402);}});ami['on'](_0x8a95('0x32'),function(_0x1017df){try{utils[_0x8a95('0x19')](util[_0x8a95('0x15')]('[%s][index][blindtransfer]',_0x1017df[_0x8a95('0x1a')]),_0x1017df);queues[_0x8a95('0x32')](_0x1017df);agents[_0x8a95('0x32')](_0x1017df);transfers[_0x8a95('0x32')](_0x1017df);}catch(_0x594835){utils[_0x8a95('0x12')](util['format'](_0x8a95('0x33'),_0x1017df[_0x8a95('0x1a')]),_0x594835);}});ami['on'](_0x8a95('0x34'),function(_0xc2536b){try{utils[_0x8a95('0x19')](util[_0x8a95('0x15')](_0x8a95('0x35'),_0xc2536b[_0x8a95('0x36')]),_0xc2536b);queues[_0x8a95('0x34')](_0xc2536b);transfers['attendedtransfer'](_0xc2536b);agents['attendedtransfer'](_0xc2536b);calls[_0x8a95('0x34')](_0xc2536b);}catch(_0x37cca2){utils[_0x8a95('0x12')](util[_0x8a95('0x15')](_0x8a95('0x35'),_0xc2536b['origtransfereruniqueid']),_0x37cca2);}});ami['on'](_0x8a95('0x37'),function(_0x5cff42){try{utils[_0x8a95('0x19')](util['format'](_0x8a95('0x38'),_0x5cff42[_0x8a95('0x1a')]),_0x5cff42);queues[_0x8a95('0x37')](_0x5cff42);recordings[_0x8a95('0x37')](_0x5cff42);calls['varset'](_0x5cff42);dials[_0x8a95('0x37')](_0x5cff42);}catch(_0x2ed23a){utils[_0x8a95('0x12')](util[_0x8a95('0x15')](_0x8a95('0x38'),_0x5cff42['uniqueid']),_0x2ed23a);}});ami['on'](_0x8a95('0x39'),function(_0x2c831d){try{utils[_0x8a95('0x19')](util[_0x8a95('0x15')](_0x8a95('0x3a'),_0x2c831d[_0x8a95('0x1a')]),_0x2c831d);calls[_0x8a95('0x39')](_0x2c831d);recordings[_0x8a95('0x39')](_0x2c831d);dials['newexten'](_0x2c831d);}catch(_0x1f23f4){utils[_0x8a95('0x12')](util[_0x8a95('0x15')](_0x8a95('0x3a'),_0x2c831d[_0x8a95('0x1a')]),_0x1f23f4);}});ami['on'](_0x8a95('0x3b'),function(_0x45b5e1){try{utils['debug'](util[_0x8a95('0x15')](_0x8a95('0x3c'),_0x45b5e1[_0x8a95('0x1a')]),_0x45b5e1);calls[_0x8a95('0x3b')](_0x45b5e1);recordings[_0x8a95('0x3b')](_0x45b5e1);}catch(_0x5bd9d5){utils[_0x8a95('0x12')](util[_0x8a95('0x15')](_0x8a95('0x3c'),_0x45b5e1[_0x8a95('0x1a')]),_0x5bd9d5);}});ami['on']('dialbegin',function(_0x21e570){try{utils[_0x8a95('0x19')](util['format'](_0x8a95('0x3d'),_0x21e570['uniqueid']),_0x21e570);dials[_0x8a95('0x3e')](_0x21e570);}catch(_0x3100b6){utils['error'](util['format'](_0x8a95('0x3f'),_0x21e570[_0x8a95('0x1a')]),_0x3100b6);}});ami['on'](_0x8a95('0x40'),function(_0x8b2901){try{utils[_0x8a95('0x19')](util[_0x8a95('0x15')](_0x8a95('0x41'),_0x8b2901[_0x8a95('0x1a')]),_0x8b2901);dials[_0x8a95('0x40')](_0x8b2901);}catch(_0x2b2ca5){utils[_0x8a95('0x12')](util[_0x8a95('0x15')](_0x8a95('0x41'),_0x8b2901['uniqueid']),_0x2b2ca5);}});} \ No newline at end of file +var _0x2238=['../../config/environment','./utils','util','asterisk','username','password','xdr','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager'];(function(_0x1e7781,_0x5ca707){var _0x27967b=function(_0x311d7f){while(--_0x311d7f){_0x1e7781['push'](_0x1e7781['shift']());}};_0x27967b(++_0x5ca707);}(_0x2238,0x7f));var _0x8223=function(_0x411b8a,_0x126f32){_0x411b8a=_0x411b8a-0x0;var _0x2f9c2e=_0x2238[_0x411b8a];return _0x2f9c2e;};var AsteriskManager=require(_0x8223('0x0'));var config=require(_0x8223('0x1'));var utils=require(_0x8223('0x2'));var util=require(_0x8223('0x3'));var ami=new AsteriskManager(config[_0x8223('0x4')]['port'],config['asterisk']['ip'],config[_0x8223('0x4')][_0x8223('0x5')],config[_0x8223('0x4')][_0x8223('0x6')],!![]);ami['keepConnected']();if(config['xdr']&&config[_0x8223('0x7')]['disabled']){utils[_0x8223('0x8')](_0x8223('0x9'));}else{var agents=require(_0x8223('0xa'));var calls=require('./calls.controller');var queues=require(_0x8223('0xb'));var recordings=require(_0x8223('0xc'));var members=require(_0x8223('0xd'));var dials=require(_0x8223('0xe'));var transfers=require('./transfers.controller');var core=require(_0x8223('0xf'));ami['on'](_0x8223('0x10'),core[_0x8223('0x10')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0x8223('0x11'),core['fullybooted']);ami['on']('error',core[_0x8223('0x12')]);ami['on'](_0x8223('0x13'),core[_0x8223('0x13')]);ami['on'](_0x8223('0x14'),core[_0x8223('0x14')]);ami['on'](_0x8223('0x15'),function(_0x347ed9){try{utils[_0x8223('0x16')](util[_0x8223('0x17')](_0x8223('0x18'),_0x347ed9[_0x8223('0x19')]),_0x347ed9);members[_0x8223('0x15')](_0x347ed9);}catch(_0x411295){utils[_0x8223('0x12')](util[_0x8223('0x17')]('[%s][index][devicestatechange]',_0x347ed9[_0x8223('0x19')]),_0x411295);}});ami['on'](_0x8223('0x1a'),function(_0x2644fc){try{utils[_0x8223('0x16')](util[_0x8223('0x17')](_0x8223('0x1b'),_0x2644fc[_0x8223('0x1c')]),_0x2644fc);agents[_0x8223('0x1a')](_0x2644fc);}catch(_0x5c9a07){utils[_0x8223('0x12')](util[_0x8223('0x17')](_0x8223('0x1b'),_0x2644fc[_0x8223('0x1c')]),_0x5c9a07);}});ami['on'](_0x8223('0x1d'),function(_0x3edd4c){try{utils['debug'](util[_0x8223('0x17')](_0x8223('0x1e'),_0x3edd4c[_0x8223('0x1c')]),_0x3edd4c);agents[_0x8223('0x1d')](_0x3edd4c);}catch(_0x5e3062){utils[_0x8223('0x12')](util[_0x8223('0x17')]('[%s][index][agentringnoanswer]',_0x3edd4c['uniqueid']),_0x5e3062);}});ami['on'](_0x8223('0x1f'),function(_0x59afc9){try{utils[_0x8223('0x16')](util['format']('[%s][index][agentconnect]',_0x59afc9[_0x8223('0x1c')]),_0x59afc9);agents[_0x8223('0x1f')](_0x59afc9);queues[_0x8223('0x1f')](_0x59afc9);}catch(_0x2ece99){utils[_0x8223('0x12')](util[_0x8223('0x17')](_0x8223('0x20'),_0x59afc9[_0x8223('0x1c')]),_0x2ece99);}});ami['on'](_0x8223('0x21'),function(_0x3be464){try{utils[_0x8223('0x16')](util[_0x8223('0x17')](_0x8223('0x22'),_0x3be464[_0x8223('0x1c')]),_0x3be464);agents['agentcomplete'](_0x3be464);queues[_0x8223('0x21')](_0x3be464);members[_0x8223('0x21')](_0x3be464);}catch(_0x1d893d){utils[_0x8223('0x12')](util['format'](_0x8223('0x22'),_0x3be464['uniqueid']),_0x1d893d);}});ami['on'](_0x8223('0x23'),function(_0x393f8e){try{utils[_0x8223('0x16')](util[_0x8223('0x17')](_0x8223('0x24'),_0x393f8e[_0x8223('0x1c')]),_0x393f8e);agents['queuecallerabandon'](_0x393f8e);queues['queuecallerabandon'](_0x393f8e);}catch(_0x52c6f7){utils[_0x8223('0x12')](util[_0x8223('0x17')]('[%s][index][queuecallerabandon]',_0x393f8e['uniqueid']),_0x52c6f7);}});ami['on'](_0x8223('0x25'),function(_0xc352fe){try{utils['debug'](util[_0x8223('0x17')](_0x8223('0x26'),_0xc352fe[_0x8223('0x1c')]),_0xc352fe);queues[_0x8223('0x25')](_0xc352fe);recordings['queuecallerjoin'](_0xc352fe);}catch(_0x2802b7){utils[_0x8223('0x12')](util[_0x8223('0x17')](_0x8223('0x26'),_0xc352fe[_0x8223('0x1c')]),_0x2802b7);}});ami['on'](_0x8223('0x27'),function(_0x2395b8){try{utils[_0x8223('0x16')](util[_0x8223('0x17')](_0x8223('0x28'),_0x2395b8['uniqueid']),_0x2395b8);queues['queuecallerleave'](_0x2395b8);}catch(_0x2f0cef){utils[_0x8223('0x12')](util['format']('[%s][index][queuecallerleave]',_0x2395b8[_0x8223('0x1c')]),_0x2f0cef);}});ami['on'](_0x8223('0x29'),function(_0x310295){try{utils[_0x8223('0x16')](util[_0x8223('0x17')]('[%s][index][musiconholdstart]',_0x310295[_0x8223('0x1c')]),_0x310295);queues[_0x8223('0x29')](_0x310295);calls[_0x8223('0x29')](_0x310295);}catch(_0x30930e){utils[_0x8223('0x12')](util[_0x8223('0x17')](_0x8223('0x2a'),_0x310295[_0x8223('0x1c')]),_0x30930e);}});ami['on'](_0x8223('0x2b'),function(_0x4efb45){try{utils[_0x8223('0x16')](util[_0x8223('0x17')](_0x8223('0x2c'),_0x4efb45[_0x8223('0x1c')]),_0x4efb45);queues['musiconholdstop'](_0x4efb45);calls[_0x8223('0x2b')](_0x4efb45);}catch(_0x49fc97){utils[_0x8223('0x12')](util[_0x8223('0x17')](_0x8223('0x2c'),_0x4efb45[_0x8223('0x1c')]),_0x49fc97);}});ami['on'](_0x8223('0x2d'),function(_0x21e1cc){try{utils[_0x8223('0x16')](util[_0x8223('0x17')]('[%s][index][newstate]',_0x21e1cc[_0x8223('0x1c')]),_0x21e1cc);calls[_0x8223('0x2d')](_0x21e1cc);recordings[_0x8223('0x2d')](_0x21e1cc);}catch(_0x5193d6){utils['error'](util[_0x8223('0x17')](_0x8223('0x2e'),_0x21e1cc[_0x8223('0x1c')]),_0x5193d6);}});ami['on'](_0x8223('0x2f'),function(_0x1ccbc0){try{utils[_0x8223('0x16')](util['format'](_0x8223('0x30'),_0x1ccbc0[_0x8223('0x1c')]),_0x1ccbc0);calls[_0x8223('0x2f')](_0x1ccbc0);recordings[_0x8223('0x2f')](_0x1ccbc0);dials['hangup'](_0x1ccbc0);agents[_0x8223('0x2f')](_0x1ccbc0);queues[_0x8223('0x2f')](_0x1ccbc0);}catch(_0x2f8f10){utils[_0x8223('0x12')](util[_0x8223('0x17')](_0x8223('0x30'),_0x1ccbc0[_0x8223('0x1c')]),_0x2f8f10);}});ami['on']('cdr',function(_0x52388d){try{utils[_0x8223('0x16')](util['format'](_0x8223('0x31'),_0x52388d[_0x8223('0x1c')]),_0x52388d);members['cdr'](_0x52388d);}catch(_0x40e794){utils[_0x8223('0x12')](util[_0x8223('0x17')]('[%s][index][cdr]',_0x52388d[_0x8223('0x1c')]),_0x40e794);}});ami['on'](_0x8223('0x32'),function(_0xaba26f){try{utils[_0x8223('0x16')](util[_0x8223('0x17')](_0x8223('0x33'),_0xaba26f[_0x8223('0x1c')]),_0xaba26f);queues[_0x8223('0x32')](_0xaba26f);agents[_0x8223('0x32')](_0xaba26f);transfers[_0x8223('0x32')](_0xaba26f);}catch(_0x5a4a36){utils[_0x8223('0x12')](util[_0x8223('0x17')](_0x8223('0x33'),_0xaba26f[_0x8223('0x1c')]),_0x5a4a36);}});ami['on'](_0x8223('0x34'),function(_0x33ab31){try{utils[_0x8223('0x16')](util[_0x8223('0x17')](_0x8223('0x35'),_0x33ab31['origtransfereruniqueid']),_0x33ab31);queues['attendedtransfer'](_0x33ab31);transfers[_0x8223('0x34')](_0x33ab31);agents[_0x8223('0x34')](_0x33ab31);calls[_0x8223('0x34')](_0x33ab31);}catch(_0x190d4f){utils[_0x8223('0x12')](util['format'](_0x8223('0x35'),_0x33ab31['origtransfereruniqueid']),_0x190d4f);}});ami['on'](_0x8223('0x36'),function(_0x59ac1f){try{utils[_0x8223('0x16')](util['format']('[%s][index][varset]',_0x59ac1f[_0x8223('0x1c')]),_0x59ac1f);queues[_0x8223('0x36')](_0x59ac1f);recordings[_0x8223('0x36')](_0x59ac1f);calls[_0x8223('0x36')](_0x59ac1f);dials[_0x8223('0x36')](_0x59ac1f);}catch(_0x1d97e4){utils[_0x8223('0x12')](util[_0x8223('0x17')](_0x8223('0x37'),_0x59ac1f[_0x8223('0x1c')]),_0x1d97e4);}});ami['on'](_0x8223('0x38'),function(_0x593dac){try{utils[_0x8223('0x16')](util['format'](_0x8223('0x39'),_0x593dac[_0x8223('0x1c')]),_0x593dac);calls[_0x8223('0x38')](_0x593dac);recordings[_0x8223('0x38')](_0x593dac);dials[_0x8223('0x38')](_0x593dac);}catch(_0x4c5ac0){utils[_0x8223('0x12')](util['format'](_0x8223('0x39'),_0x593dac[_0x8223('0x1c')]),_0x4c5ac0);}});ami['on'](_0x8223('0x3a'),function(_0x57e987){try{utils['debug'](util[_0x8223('0x17')](_0x8223('0x3b'),_0x57e987[_0x8223('0x1c')]),_0x57e987);calls[_0x8223('0x3a')](_0x57e987);recordings[_0x8223('0x3a')](_0x57e987);}catch(_0x305fa0){utils[_0x8223('0x12')](util[_0x8223('0x17')]('[%s][index][newchannel]',_0x57e987[_0x8223('0x1c')]),_0x305fa0);}});ami['on'](_0x8223('0x3c'),function(_0xcf3f2){try{utils[_0x8223('0x16')](util[_0x8223('0x17')]('[%s][index][dialbegin]',_0xcf3f2[_0x8223('0x1c')]),_0xcf3f2);dials['dialbegin'](_0xcf3f2);}catch(_0x31e142){utils[_0x8223('0x12')](util[_0x8223('0x17')](_0x8223('0x3d'),_0xcf3f2['uniqueid']),_0x31e142);}});ami['on'](_0x8223('0x3e'),function(_0x2a2fef){try{utils[_0x8223('0x16')](util[_0x8223('0x17')](_0x8223('0x3f'),_0x2a2fef[_0x8223('0x1c')]),_0x2a2fef);dials[_0x8223('0x3e')](_0x2a2fef);}catch(_0x366706){utils[_0x8223('0x12')](util[_0x8223('0x17')]('[%s][index][dialend]',_0x2a2fef[_0x8223('0x1c')]),_0x366706);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 289f081..ad414c7 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 _0xf031=['isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','queue','assign','cdr','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','[%s][members][cdr]','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','type','interface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','startsWith','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','voice','now'];(function(_0x42b769,_0x2aa6fc){var _0x195644=function(_0x15f41c){while(--_0x15f41c){_0x42b769['push'](_0x42b769['shift']());}};_0x195644(++_0x2aa6fc);}(_0xf031,0xfc));var _0x1f03=function(_0x511662,_0x308418){_0x511662=_0x511662-0x0;var _0x59c02d=_0xf031[_0x511662];return _0x59c02d;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x1f03('0x0'));var members={};var exclude=[_0x1f03('0x1'),_0x1f03('0x2')];function writeDB(_0x5c4750){utils['info'](util[_0x1f03('0x3')](_0x1f03('0x4'),_0x5c4750[_0x1f03('0x5')],_0x5c4750['interface'],_0x5c4750[_0x1f03('0x6')],_0x5c4750[_0x1f03('0x7')],_0x5c4750[_0x1f03('0x8')],_0x5c4750[_0x1f03('0x9')]));if(_0x5c4750[_0x1f03('0xa')]){utils['getUserByInterface'](_0x5c4750[_0x1f03('0xa')])[_0x1f03('0xb')](function(_0x30a3fb){if(_0x30a3fb){_0x5c4750[_0x1f03('0x8')]=_0x30a3fb[_0x1f03('0xc')];_0x5c4750[_0x1f03('0xd')]=_0x30a3fb[_0x1f03('0xd')];utils[_0x1f03('0xe')](_0x1f03('0xf'),_0x5c4750);}else{utils[_0x1f03('0x10')](_0x5c4750[_0x1f03('0xa')][_0x1f03('0x11')]('/')[0x1])['then'](function(_0x271884){if(_0x271884){_0x5c4750[_0x1f03('0x8')]=_0x271884[_0x1f03('0xc')];_0x5c4750[_0x1f03('0xd')]=_0x271884[_0x1f03('0xd')];utils[_0x1f03('0xe')]('CreateMemberReport',_0x5c4750);}});}})[_0x1f03('0x12')](function(_0x2cb73a){utils[_0x1f03('0x13')](util[_0x1f03('0x3')](_0x1f03('0x14'),_0x5c4750['uniqueid']),_0x2cb73a);});}delete members[_0x5c4750[_0x1f03('0xa')]];}function startsWith(_0x1089f8,_0x3fbb54){return _['some'](_0x1089f8,function(_0x396180){return _[_0x1f03('0x15')](_0x3fbb54,_0x396180);});}exports['devicestatechange']=function(_0xd0e971){try{utils[_0x1f03('0x16')](util[_0x1f03('0x3')](_0x1f03('0x17'),members[_0xd0e971['device']]?members[_0xd0e971['device']][_0x1f03('0x5')]:_0xd0e971[_0x1f03('0x18')]),_0xd0e971);utils[_0x1f03('0x19')](util[_0x1f03('0x3')](_0x1f03('0x1a'),members[_0xd0e971[_0x1f03('0x18')]]?members[_0xd0e971[_0x1f03('0x18')]][_0x1f03('0x5')]:_0xd0e971[_0x1f03('0x18')],_0xd0e971[_0x1f03('0x1b')],_0xd0e971['device']));switch(_0xd0e971[_0x1f03('0x1b')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0xd0e971['device'])){members[_0xd0e971[_0x1f03('0x18')]]={'channel':_0x1f03('0x1c'),'interface':_0xd0e971[_0x1f03('0x18')],'type':'TALKING','enterAt':utils[_0x1f03('0x1d')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x1f03('0x1e')](members[_0xd0e971[_0x1f03('0x18')]])){members[_0xd0e971['device']][_0x1f03('0x1f')]=utils[_0x1f03('0x1d')]();members[_0xd0e971[_0x1f03('0x18')]][_0x1f03('0x20')]=utils[_0x1f03('0x21')](members[_0xd0e971[_0x1f03('0x18')]][_0x1f03('0x1f')],members[_0xd0e971[_0x1f03('0x18')]][_0x1f03('0x22')]);if(members[_0xd0e971[_0x1f03('0x18')]]['uniqueid']){writeDB(members[_0xd0e971['device']]);}}break;default:break;}}catch(_0x2b20e3){utils[_0x1f03('0x13')](util[_0x1f03('0x3')](_0x1f03('0x17'),members[_0xd0e971[_0x1f03('0x18')]]?members[_0xd0e971[_0x1f03('0x18')]][_0x1f03('0x5')]:_0xd0e971[_0x1f03('0x18')]),_0x2b20e3);}};exports[_0x1f03('0x23')]=function(_0x537c81){try{if(!_['isNil'](members[_0x537c81[_0x1f03('0xa')]])){utils[_0x1f03('0x16')](util['format'](_0x1f03('0x24'),_0x537c81[_0x1f03('0x5')]),_0x537c81);utils[_0x1f03('0x19')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x537c81[_0x1f03('0x5')],_0x537c81[_0x1f03('0xa')],_0x537c81[_0x1f03('0x25')]));members[_0x537c81['interface']]=_[_0x1f03('0x26')](members[_0x537c81[_0x1f03('0xa')]],{'data4':_0x537c81[_0x1f03('0x25')],'uniqueid':_0x537c81[_0x1f03('0x5')]});}}catch(_0x365ad2){utils['error'](util[_0x1f03('0x3')](_0x1f03('0x24'),_0x537c81[_0x1f03('0x5')]),_0x365ad2);}};exports[_0x1f03('0x27')]=function(_0x374e73){try{utils[_0x1f03('0x16')](util[_0x1f03('0x3')]('[%s][members][cdr]',_0x374e73[_0x1f03('0x5')]),_0x374e73);if(_0x374e73[_0x1f03('0x6')]){var _0x3f098d=_0x374e73[_0x1f03('0x6')][_0x1f03('0x11')]('-')[0x0];if(!_[_0x1f03('0x1e')](members[_0x3f098d])){members[_0x3f098d]=_[_0x1f03('0x26')](members[_0x3f098d],{'data1':members[_0x3f098d][_0x1f03('0x28')]||_0x374e73['type'],'data2':members[_0x3f098d][_0x1f03('0x7')]||_0x374e73['source'],'data3':members[_0x3f098d][_0x1f03('0x29')]||_0x374e73[_0x1f03('0x2a')],'uniqueid':members[_0x3f098d][_0x1f03('0x5')]||_0x374e73['uniqueid']});utils[_0x1f03('0x19')](util[_0x1f03('0x3')](_0x1f03('0x2b'),_0x374e73['uniqueid'],members[_0x3f098d][_0x1f03('0x28')],members[_0x3f098d]['data2'],members[_0x3f098d][_0x1f03('0x29')]));if(members[_0x3f098d][_0x1f03('0x1f')]){writeDB(members[_0x3f098d]);}}}if(_0x374e73['destinationchannel']){var _0x2fe365=_0x374e73[_0x1f03('0x2c')][_0x1f03('0x11')]('-')[0x0];if(!_[_0x1f03('0x1e')](members[_0x2fe365])){members[_0x2fe365]=_['assign'](members[_0x2fe365],{'data1':members[_0x2fe365][_0x1f03('0x28')]||_0x374e73[_0x1f03('0x9')],'data2':members[_0x2fe365][_0x1f03('0x7')]||_0x374e73[_0x1f03('0x2d')],'data3':members[_0x2fe365][_0x1f03('0x29')]||_0x374e73[_0x1f03('0x2a')],'uniqueid':members[_0x2fe365]['uniqueid']||_0x374e73['uniqueid']});utils[_0x1f03('0x19')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x374e73[_0x1f03('0x5')],members[_0x2fe365][_0x1f03('0x28')],members[_0x2fe365][_0x1f03('0x7')],members[_0x2fe365]['data3']));if(members[_0x2fe365][_0x1f03('0x1f')]){writeDB(members[_0x2fe365]);}}}}catch(_0x370249){utils[_0x1f03('0x13')](util['format'](_0x1f03('0x2e'),_0x374e73[_0x1f03('0x5')]),_0x370249);}}; \ No newline at end of file +var _0x220b=['agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','channel','data1','type','data2','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','membername','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','interface','split','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x220b,0x1b7));var _0xb220=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0x220b[_0x3f4dd9];return _0x31c54a;};'use strict';var _=require('lodash');var util=require(_0xb220('0x0'));var utils=require(_0xb220('0x1'));var members={};var exclude=[_0xb220('0x2'),_0xb220('0x3')];function writeDB(_0x2c8e01){utils[_0xb220('0x4')](util[_0xb220('0x5')](_0xb220('0x6'),_0x2c8e01[_0xb220('0x7')],_0x2c8e01['interface'],_0x2c8e01['channel'],_0x2c8e01['data2'],_0x2c8e01[_0xb220('0x8')],_0x2c8e01['type']));if(_0x2c8e01['interface']){utils[_0xb220('0x9')](_0x2c8e01['interface'])[_0xb220('0xa')](function(_0x1f86fb){if(_0x1f86fb){_0x2c8e01[_0xb220('0x8')]=_0x1f86fb[_0xb220('0xb')];_0x2c8e01['internal']=_0x1f86fb[_0xb220('0xc')];utils[_0xb220('0xd')](_0xb220('0xe'),_0x2c8e01);}else{utils[_0xb220('0xf')](_0x2c8e01[_0xb220('0x10')][_0xb220('0x11')]('/')[0x1])['then'](function(_0x20e327){if(_0x20e327){_0x2c8e01['membername']=_0x20e327[_0xb220('0xb')];_0x2c8e01[_0xb220('0xc')]=_0x20e327[_0xb220('0xc')];utils[_0xb220('0xd')]('CreateMemberReport',_0x2c8e01);}});}})['catch'](function(_0x184b3b){utils[_0xb220('0x12')](util[_0xb220('0x5')](_0xb220('0x13'),_0x2c8e01[_0xb220('0x7')]),_0x184b3b);});}delete members[_0x2c8e01[_0xb220('0x10')]];}function startsWith(_0x1ce434,_0x582cb2){return _[_0xb220('0x14')](_0x1ce434,function(_0x1f48c2){return _[_0xb220('0x15')](_0x582cb2,_0x1f48c2);});}exports[_0xb220('0x16')]=function(_0x1b5fcd){try{utils[_0xb220('0x17')](util[_0xb220('0x5')](_0xb220('0x18'),members[_0x1b5fcd[_0xb220('0x19')]]?members[_0x1b5fcd[_0xb220('0x19')]][_0xb220('0x7')]:_0x1b5fcd[_0xb220('0x19')]),_0x1b5fcd);utils[_0xb220('0x4')](util[_0xb220('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x1b5fcd[_0xb220('0x19')]]?members[_0x1b5fcd[_0xb220('0x19')]][_0xb220('0x7')]:_0x1b5fcd[_0xb220('0x19')],_0x1b5fcd['state'],_0x1b5fcd['device']));switch(_0x1b5fcd[_0xb220('0x1a')]){case _0xb220('0x1b'):case _0xb220('0x1c'):if(!startsWith(exclude,_0x1b5fcd[_0xb220('0x19')])){members[_0x1b5fcd[_0xb220('0x19')]]={'channel':'voice','interface':_0x1b5fcd['device'],'type':_0xb220('0x1d'),'enterAt':utils[_0xb220('0x1e')](),'role':_0xb220('0x1f')};}break;case _0xb220('0x20'):if(!_[_0xb220('0x21')](members[_0x1b5fcd[_0xb220('0x19')]])){members[_0x1b5fcd[_0xb220('0x19')]][_0xb220('0x22')]=utils['now']();members[_0x1b5fcd[_0xb220('0x19')]][_0xb220('0x23')]=utils[_0xb220('0x24')](members[_0x1b5fcd[_0xb220('0x19')]][_0xb220('0x22')],members[_0x1b5fcd[_0xb220('0x19')]][_0xb220('0x25')]);if(members[_0x1b5fcd[_0xb220('0x19')]][_0xb220('0x7')]){writeDB(members[_0x1b5fcd[_0xb220('0x19')]]);}}break;default:break;}}catch(_0xbd998f){utils[_0xb220('0x12')](util['format'](_0xb220('0x18'),members[_0x1b5fcd[_0xb220('0x19')]]?members[_0x1b5fcd['device']]['uniqueid']:_0x1b5fcd[_0xb220('0x19')]),_0xbd998f);}};exports[_0xb220('0x26')]=function(_0x1da4ef){try{if(!_['isNil'](members[_0x1da4ef[_0xb220('0x10')]])){utils[_0xb220('0x17')](util[_0xb220('0x5')]('[%s][members][agentcomplete]',_0x1da4ef['uniqueid']),_0x1da4ef);utils['info'](util[_0xb220('0x5')](_0xb220('0x27'),_0x1da4ef['uniqueid'],_0x1da4ef[_0xb220('0x10')],_0x1da4ef['queue']));members[_0x1da4ef[_0xb220('0x10')]]=_[_0xb220('0x28')](members[_0x1da4ef[_0xb220('0x10')]],{'data4':_0x1da4ef[_0xb220('0x29')],'uniqueid':_0x1da4ef[_0xb220('0x7')]});}}catch(_0x2f41c7){utils[_0xb220('0x12')](util[_0xb220('0x5')](_0xb220('0x2a'),_0x1da4ef[_0xb220('0x7')]),_0x2f41c7);}};exports[_0xb220('0x2b')]=function(_0x985fb2){try{utils['debug'](util[_0xb220('0x5')](_0xb220('0x2c'),_0x985fb2[_0xb220('0x7')]),_0x985fb2);if(_0x985fb2[_0xb220('0x2d')]){var _0x28b9b9=_0x985fb2[_0xb220('0x2d')][_0xb220('0x11')]('-')[0x0];if(!_[_0xb220('0x21')](members[_0x28b9b9])){members[_0x28b9b9]=_[_0xb220('0x28')](members[_0x28b9b9],{'data1':members[_0x28b9b9][_0xb220('0x2e')]||_0x985fb2[_0xb220('0x2f')],'data2':members[_0x28b9b9][_0xb220('0x30')]||_0x985fb2[_0xb220('0x31')],'data3':members[_0x28b9b9]['data3']||_0x985fb2[_0xb220('0x32')],'uniqueid':members[_0x28b9b9]['uniqueid']||_0x985fb2[_0xb220('0x7')]});utils[_0xb220('0x4')](util[_0xb220('0x5')](_0xb220('0x33'),_0x985fb2['uniqueid'],members[_0x28b9b9][_0xb220('0x2e')],members[_0x28b9b9][_0xb220('0x30')],members[_0x28b9b9][_0xb220('0x34')]));if(members[_0x28b9b9]['exitAt']){writeDB(members[_0x28b9b9]);}}}if(_0x985fb2['destinationchannel']){var _0x546825=_0x985fb2['destinationchannel']['split']('-')[0x0];if(!_[_0xb220('0x21')](members[_0x546825])){members[_0x546825]=_['assign'](members[_0x546825],{'data1':members[_0x546825][_0xb220('0x2e')]||_0x985fb2[_0xb220('0x2f')],'data2':members[_0x546825][_0xb220('0x30')]||_0x985fb2[_0xb220('0x31')],'data3':members[_0x546825][_0xb220('0x34')]||_0x985fb2[_0xb220('0x32')],'uniqueid':members[_0x546825][_0xb220('0x7')]||_0x985fb2[_0xb220('0x7')]});utils[_0xb220('0x4')](util[_0xb220('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x985fb2['uniqueid'],members[_0x546825]['data1'],members[_0x546825][_0xb220('0x30')],members[_0x546825][_0xb220('0x34')]));if(members[_0x546825][_0xb220('0x22')]){writeDB(members[_0x546825]);}}}}catch(_0x1b998e){utils['error'](util[_0xb220('0x5')]('[%s][members][cdr]',_0x985fb2[_0xb220('0x7')]),_0x1b998e);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 87c6e59..7e6fa8c 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 _0xf4af=['secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','CreateVoiceQueueReport','queuecallerjoin','debug','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','transfereduniqueid','name','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xf4af,0xdb));var _0xff4a=function(_0x261fc3,_0x93ec46){_0x261fc3=_0x261fc3-0x0;var _0x83da99=_0xf4af[_0x261fc3];return _0x83da99;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xff4a('0x0'));var queues={};function writeDB(_0x5d39c4){utils[_0xff4a('0x1')](util[_0xff4a('0x2')](_0xff4a('0x3'),_0x5d39c4[_0xff4a('0x4')],_0x5d39c4[_0xff4a('0x5')],_0x5d39c4[_0xff4a('0x6')],_0x5d39c4[_0xff4a('0x7')],_0x5d39c4[_0xff4a('0x8')],_0x5d39c4[_0xff4a('0x9')],_0x5d39c4[_0xff4a('0xa')]));if(_0x5d39c4['queue']){utils[_0xff4a('0xb')](_0x5d39c4['queue'])['then'](function(_0x4f4d8e){if(_0x4f4d8e){_0x5d39c4[_0xff4a('0xc')]=_0x4f4d8e[_0xff4a('0xc')];}utils['request'](_0xff4a('0xd'),_0x5d39c4);});}else{utils['request'](_0xff4a('0xd'),_0x5d39c4);}if(_0x5d39c4['transfereduniqueid']){delete queues[_0x5d39c4['transfereduniqueid']];}else{delete queues[_0x5d39c4[_0xff4a('0x4')]];}}exports[_0xff4a('0xe')]=function(_0x4bc865){try{utils[_0xff4a('0xf')](util[_0xff4a('0x2')]('[%s][queues][queuecallerjoin]',_0x4bc865[_0xff4a('0x4')]),_0x4bc865);utils[_0xff4a('0x1')](util[_0xff4a('0x2')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x4bc865[_0xff4a('0x4')],_0x4bc865[_0xff4a('0x6')],_0x4bc865[_0xff4a('0x10')]));queues[_0x4bc865[_0xff4a('0x4')]]=_[_0xff4a('0x11')](_0x4bc865,{'originalposition':_0x4bc865[_0xff4a('0x10')],'queuecallerjoinAt':utils[_0xff4a('0x12')](),'mohtime':0x0});}catch(_0x341265){utils[_0xff4a('0x13')](util[_0xff4a('0x2')](_0xff4a('0x14'),_0x4bc865['uniqueid']),_0x341265);}};exports[_0xff4a('0x15')]=function(_0x3abb83){try{if(!_['isNil'](queues[_0x3abb83['uniqueid']])){utils[_0xff4a('0xf')](util['format'](_0xff4a('0x16'),_0x3abb83['uniqueid']),_0x3abb83);if(queues[_0x3abb83[_0xff4a('0x4')]]['queuecallerleaveAt']){if(!queues[_0x3abb83[_0xff4a('0x4')]]['queuecallerabandon']&&!queues[_0x3abb83[_0xff4a('0x4')]][_0xff4a('0x17')]){queues[_0x3abb83[_0xff4a('0x4')]][_0xff4a('0x18')]=!![];queues[_0x3abb83[_0xff4a('0x4')]][_0xff4a('0x19')]=utils[_0xff4a('0x12')]();queues[_0x3abb83[_0xff4a('0x4')]][_0xff4a('0xa')]=_0xff4a('0x1a');}utils[_0xff4a('0x1')](util[_0xff4a('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x3abb83[_0xff4a('0x4')],queues[_0x3abb83[_0xff4a('0x4')]]['name'],queues[_0x3abb83[_0xff4a('0x4')]][_0xff4a('0xa')]));writeDB(queues[_0x3abb83[_0xff4a('0x4')]]);}else if(queues[_0x3abb83[_0xff4a('0x4')]][_0xff4a('0x1b')]){utils[_0xff4a('0x1')](util[_0xff4a('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x3abb83[_0xff4a('0x4')],queues[_0x3abb83[_0xff4a('0x4')]][_0xff4a('0x1c')],queues[_0x3abb83[_0xff4a('0x4')]][_0xff4a('0x1b')]));queues[queues[_0x3abb83[_0xff4a('0x4')]][_0xff4a('0x1b')]]=queues[_0x3abb83['uniqueid']];queues[queues[_0x3abb83[_0xff4a('0x4')]][_0xff4a('0x1b')]]['queuecallerenterreason']=0x2;delete queues[_0x3abb83[_0xff4a('0x4')]];}}}catch(_0x600eaa){utils['error'](util[_0xff4a('0x2')](_0xff4a('0x16'),_0x3abb83[_0xff4a('0x4')]),_0x600eaa);}};exports[_0xff4a('0x1d')]=function(_0x515a3f){try{utils[_0xff4a('0xf')](util[_0xff4a('0x2')](_0xff4a('0x1e'),_0x515a3f['uniqueid']),_0x515a3f);if(!_[_0xff4a('0x1f')](_0x515a3f[_0xff4a('0x20')][_0xff4a('0x21')])&&_0x515a3f[_0xff4a('0x22')][_0xff4a('0x23')]()!==_0xff4a('0x24')){if(!_[_0xff4a('0x1f')](queues[_0x515a3f[_0xff4a('0x4')]])){queues[_0x515a3f['uniqueid']][_0xff4a('0x25')]=![];queues[_0x515a3f[_0xff4a('0x4')]][_0xff4a('0x26')]=null;queues[_0x515a3f[_0xff4a('0x4')]]['queuecallerexit']=!![];queues[_0x515a3f['uniqueid']][_0xff4a('0x27')]=utils[_0xff4a('0x12')]();queues[_0x515a3f[_0xff4a('0x4')]][_0xff4a('0xa')]=_0x515a3f[_0xff4a('0x22')][_0xff4a('0x23')]();utils[_0xff4a('0x1')](util[_0xff4a('0x2')](_0xff4a('0x28'),_0x515a3f[_0xff4a('0x4')],queues[_0x515a3f[_0xff4a('0x4')]]['name'],_0x515a3f[_0xff4a('0x22')],queues[_0x515a3f[_0xff4a('0x4')]][_0xff4a('0xa')]));writeDB(queues[_0x515a3f[_0xff4a('0x4')]]);}}else if(!_['isNil'](_0x515a3f[_0xff4a('0x20')]['queueposition'])){if(!_[_0xff4a('0x1f')](queues[_0x515a3f[_0xff4a('0x4')]])&&!queues[_0x515a3f['uniqueid']]['queuecallerabandon']){queues[_0x515a3f['uniqueid']][_0xff4a('0x25')]=![];queues[_0x515a3f['uniqueid']]['queuecallerabandonAt']=null;queues[_0x515a3f[_0xff4a('0x4')]][_0xff4a('0x17')]=!![];queues[_0x515a3f[_0xff4a('0x4')]][_0xff4a('0x27')]=utils[_0xff4a('0x12')]();queues[_0x515a3f[_0xff4a('0x4')]][_0xff4a('0xa')]=_0xff4a('0x29');utils['info'](util[_0xff4a('0x2')](_0xff4a('0x2a'),_0x515a3f[_0xff4a('0x4')],queues[_0x515a3f[_0xff4a('0x4')]][_0xff4a('0x1c')],_0x515a3f[_0xff4a('0x22')],queues[_0x515a3f[_0xff4a('0x4')]][_0xff4a('0xa')]));}}}catch(_0x27c7d6){utils[_0xff4a('0x13')](util[_0xff4a('0x2')](_0xff4a('0x1e'),_0x515a3f[_0xff4a('0x4')]),_0x27c7d6);}};exports[_0xff4a('0x25')]=function(_0x2370fb){try{if(!_[_0xff4a('0x1f')](queues[_0x2370fb['uniqueid']])){utils['debug'](util[_0xff4a('0x2')](_0xff4a('0x2b'),_0x2370fb[_0xff4a('0x4')]),_0x2370fb);queues[_0x2370fb[_0xff4a('0x4')]][_0xff4a('0x17')]=![];queues[_0x2370fb[_0xff4a('0x4')]][_0xff4a('0x27')]=null;queues[_0x2370fb['uniqueid']][_0xff4a('0x25')]=!![];queues[_0x2370fb[_0xff4a('0x4')]]['queuecallerabandonAt']=utils[_0xff4a('0x12')]();queues[_0x2370fb[_0xff4a('0x4')]][_0xff4a('0xa')]='ABANDONED';utils[_0xff4a('0x1')](util[_0xff4a('0x2')](_0xff4a('0x2c'),_0x2370fb[_0xff4a('0x4')],queues[_0x2370fb['uniqueid']][_0xff4a('0x1c')],queues[_0x2370fb[_0xff4a('0x4')]][_0xff4a('0xa')]));}}catch(_0x220b8c){utils['error'](util['format'](_0xff4a('0x2b'),_0x2370fb['uniqueid']),_0x220b8c);}};exports[_0xff4a('0x2d')]=function(_0x3ef5f5){try{if(!_['isNil'](queues[_0x3ef5f5[_0xff4a('0x4')]])){utils[_0xff4a('0xf')](util[_0xff4a('0x2')](_0xff4a('0x2e'),_0x3ef5f5['uniqueid']),_0x3ef5f5);utils[_0xff4a('0x1')](util[_0xff4a('0x2')](_0xff4a('0x2f'),_0x3ef5f5[_0xff4a('0x4')],queues[_0x3ef5f5['uniqueid']][_0xff4a('0x1c')],_0x3ef5f5[_0xff4a('0x30')],_0x3ef5f5[_0xff4a('0x31')]));queues[_0x3ef5f5['uniqueid']][_0xff4a('0x2d')]=!![];queues[_0x3ef5f5[_0xff4a('0x4')]][_0xff4a('0x32')]=utils[_0xff4a('0x12')]();queues[_0x3ef5f5[_0xff4a('0x4')]][_0xff4a('0x33')]=utils[_0xff4a('0x34')](queues[_0x3ef5f5[_0xff4a('0x4')]][_0xff4a('0x32')],queues[_0x3ef5f5[_0xff4a('0x4')]][_0xff4a('0x35')]);queues[_0x3ef5f5[_0xff4a('0x4')]][_0xff4a('0x10')]=_0x3ef5f5[_0xff4a('0x10')];queues[_0x3ef5f5[_0xff4a('0x4')]][_0xff4a('0x36')]=_0x3ef5f5['count'];queues[_0x3ef5f5[_0xff4a('0x4')]][_0xff4a('0x30')]=_0x3ef5f5[_0xff4a('0x30')];queues[_0x3ef5f5[_0xff4a('0x4')]]['connectedlinename']=_0x3ef5f5[_0xff4a('0x31')];}}catch(_0x40d9c8){utils[_0xff4a('0x13')](util[_0xff4a('0x2')](_0xff4a('0x2e'),_0x3ef5f5[_0xff4a('0x4')]),_0x40d9c8);}};exports['agentconnect']=function(_0x4c3b3c){try{if(!_[_0xff4a('0x1f')](queues[_0x4c3b3c[_0xff4a('0x4')]])){utils[_0xff4a('0xf')](util['format'](_0xff4a('0x37'),_0x4c3b3c[_0xff4a('0x4')]),_0x4c3b3c);utils['info'](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x4c3b3c[_0xff4a('0x4')],queues[_0x4c3b3c[_0xff4a('0x4')]][_0xff4a('0x1c')],_0x4c3b3c[_0xff4a('0x38')],_0x4c3b3c[_0xff4a('0x39')]));queues[_0x4c3b3c[_0xff4a('0x4')]][_0xff4a('0x25')]=![];queues[_0x4c3b3c['uniqueid']][_0xff4a('0x25')]=![];queues[_0x4c3b3c[_0xff4a('0x4')]]['queuecallerabandonAt']=null;queues[_0x4c3b3c['uniqueid']][_0xff4a('0x17')]=![];queues[_0x4c3b3c[_0xff4a('0x4')]][_0xff4a('0xa')]=null;queues[_0x4c3b3c['uniqueid']][_0xff4a('0x27')]=null;queues[_0x4c3b3c[_0xff4a('0x4')]][_0xff4a('0x3a')]=!![];queues[_0x4c3b3c[_0xff4a('0x4')]][_0xff4a('0x9')]=_0x4c3b3c[_0xff4a('0x39')];queues[_0x4c3b3c['uniqueid']][_0xff4a('0x7')]=_0x4c3b3c[_0xff4a('0x38')];}}catch(_0x38ad1f){utils[_0xff4a('0x13')](util['format'](_0xff4a('0x37'),_0x4c3b3c[_0xff4a('0x4')]),_0x38ad1f);}};exports[_0xff4a('0x3b')]=function(_0x42f473){try{if(!_[_0xff4a('0x1f')](queues[_0x42f473[_0xff4a('0x4')]])){if(queues[_0x42f473[_0xff4a('0x4')]][_0xff4a('0x32')]){utils[_0xff4a('0xf')](util[_0xff4a('0x2')](_0xff4a('0x3c'),_0x42f473[_0xff4a('0x4')]),_0x42f473);queues[_0x42f473[_0xff4a('0x4')]][_0xff4a('0x25')]=![];queues[_0x42f473[_0xff4a('0x4')]][_0xff4a('0x25')]=![];queues[_0x42f473[_0xff4a('0x4')]][_0xff4a('0x26')]=null;queues[_0x42f473[_0xff4a('0x4')]][_0xff4a('0x17')]=![];queues[_0x42f473[_0xff4a('0x4')]][_0xff4a('0x27')]=null;queues[_0x42f473[_0xff4a('0x4')]]['assigned']=!![];queues[_0x42f473['uniqueid']][_0xff4a('0x7')]=_0x42f473[_0xff4a('0x38')];queues[_0x42f473[_0xff4a('0x4')]][_0xff4a('0x18')]=!![];queues[_0x42f473[_0xff4a('0x4')]][_0xff4a('0x19')]=utils[_0xff4a('0x12')]();if(_0x42f473['reason']==_0xff4a('0x3d')){if(!queues[_0x42f473[_0xff4a('0x4')]][_0xff4a('0x3d')]){queues[_0x42f473[_0xff4a('0x4')]]['queuecallerexitreason']=_0xff4a('0x3e');}}else{queues[_0x42f473['uniqueid']][_0xff4a('0xa')]='COMPLETEDBY'+_0x42f473['reason'][_0xff4a('0x23')]();}utils[_0xff4a('0x1')](util['format'](_0xff4a('0x3f'),_0x42f473[_0xff4a('0x4')],queues[_0x42f473[_0xff4a('0x4')]][_0xff4a('0x1c')],_0x42f473[_0xff4a('0x38')],queues[_0x42f473[_0xff4a('0x4')]][_0xff4a('0xa')]));writeDB(queues[_0x42f473[_0xff4a('0x4')]]);}}}catch(_0x59f436){utils[_0xff4a('0x13')](util[_0xff4a('0x2')](_0xff4a('0x3c'),_0x42f473[_0xff4a('0x4')]),_0x59f436);}};exports[_0xff4a('0x40')]=function(_0x20a691){try{if(!_[_0xff4a('0x1f')](queues[_0x20a691[_0xff4a('0x41')]])){utils[_0xff4a('0xf')](util['format'](_0xff4a('0x42'),_0x20a691[_0xff4a('0x4')]),_0x20a691);queues[_0x20a691[_0xff4a('0x41')]][_0xff4a('0x3d')]=!![];queues[_0x20a691[_0xff4a('0x41')]]['transfertype']=_0xff4a('0x43');queues[_0x20a691[_0xff4a('0x41')]][_0xff4a('0x44')]=_0x20a691[_0xff4a('0x45')];queues[_0x20a691[_0xff4a('0x41')]][_0xff4a('0x46')]=_0x20a691[_0xff4a('0x41')];queues[_0x20a691['transfereeuniqueid']][_0xff4a('0xa')]=_0xff4a('0x47');utils[_0xff4a('0x1')](util[_0xff4a('0x2')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x20a691[_0xff4a('0x4')],queues[_0x20a691[_0xff4a('0x41')]][_0xff4a('0x1c')],_0x20a691['transfereeuniqueid'],_0x20a691[_0xff4a('0x45')]));}}catch(_0x4ac47b){utils[_0xff4a('0x13')](util['format'](_0xff4a('0x42'),_0x20a691[_0xff4a('0x4')]),_0x4ac47b);}};exports['attendedtransfer']=function(_0x1503c3){try{utils[_0xff4a('0xf')](util['format'](_0xff4a('0x48'),_0x1503c3[_0xff4a('0x49')]),_0x1503c3);if(_0x1503c3['origtransfereruniqueid']==_0x1503c3[_0xff4a('0x4a')]){if(!_[_0xff4a('0x1f')](queues[_0x1503c3[_0xff4a('0x4b')]])){utils[_0xff4a('0x1')](util['format'](_0xff4a('0x4c'),_0x1503c3[_0xff4a('0x49')],queues[_0x1503c3['secondtransfererlinkedid']][_0xff4a('0x1c')],_0x1503c3[_0xff4a('0x4d')]));queues[_0x1503c3['secondtransfererlinkedid']]['transfer']=!![];queues[_0x1503c3[_0xff4a('0x4b')]][_0xff4a('0x4e')]=_0xff4a('0x4f');queues[_0x1503c3['secondtransfererlinkedid']][_0xff4a('0x44')]=_0x1503c3[_0xff4a('0x4d')];queues[_0x1503c3[_0xff4a('0x4b')]][_0xff4a('0x46')]=_0x1503c3[_0xff4a('0x49')];queues[_0x1503c3[_0xff4a('0x4b')]][_0xff4a('0xa')]=_0xff4a('0x50');}if(!_['isNil'](queues[_0x1503c3[_0xff4a('0x4a')]])){if(_0x1503c3['transfereelinkedid']&&queues[_0x1503c3[_0xff4a('0x51')]]){queues[_0x1503c3['transfereelinkedid']][_0xff4a('0x52')]=0x1;queues[_0x1503c3[_0xff4a('0x41')]]=_['clone'](queues[_0x1503c3[_0xff4a('0x51')]]);queues[_0x1503c3[_0xff4a('0x41')]][_0xff4a('0x1b')]=_0x1503c3[_0xff4a('0x53')];queues[_0x1503c3[_0xff4a('0x41')]][_0xff4a('0x52')]=0x2;queues[_0x1503c3[_0xff4a('0x41')]][_0xff4a('0x8')]=queues[_0x1503c3[_0xff4a('0x4b')]]['calleridnum'];queues[_0x1503c3[_0xff4a('0x41')]][_0xff4a('0x54')]=queues[_0x1503c3['secondtransfererlinkedid']][_0xff4a('0x54')];queues[_0x1503c3[_0xff4a('0x41')]][_0xff4a('0x35')]=utils[_0xff4a('0x12')]();queues[_0x1503c3[_0xff4a('0x41')]]['queuecallerleaveAt']=utils[_0xff4a('0x12')]();queues[_0x1503c3[_0xff4a('0x41')]][_0xff4a('0x33')]=0x0;queues[_0x1503c3[_0xff4a('0x41')]][_0xff4a('0x55')]=0x0;utils[_0xff4a('0x1')](util[_0xff4a('0x2')](_0xff4a('0x56'),_0x1503c3[_0xff4a('0x49')],queues[_0x1503c3[_0xff4a('0x41')]][_0xff4a('0x1c')],queues[_0x1503c3[_0xff4a('0x41')]][_0xff4a('0x8')],queues[_0x1503c3['transfereeuniqueid']][_0xff4a('0x54')]));}else{utils[_0xff4a('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1503c3[_0xff4a('0x49')],queues[_0x1503c3[_0xff4a('0x4a')]][_0xff4a('0x1c')],_0x1503c3[_0xff4a('0x4b')]));queues[_0x1503c3[_0xff4a('0x4a')]][_0xff4a('0x1b')]=_0x1503c3[_0xff4a('0x4b')];}}}else if(_0x1503c3[_0xff4a('0x57')]==_0x1503c3[_0xff4a('0x4b')]){if(!_['isNil'](queues[_0x1503c3['origtransfererlinkedid']])){utils[_0xff4a('0x1')](util[_0xff4a('0x2')](_0xff4a('0x58'),_0x1503c3[_0xff4a('0x49')],queues[_0x1503c3[_0xff4a('0x4a')]][_0xff4a('0x1c')],_0x1503c3[_0xff4a('0x57')],_0x1503c3[_0xff4a('0x59')]));queues[_0x1503c3[_0xff4a('0x4a')]][_0xff4a('0x3d')]=!![];queues[_0x1503c3[_0xff4a('0x4a')]][_0xff4a('0x4e')]=_0xff4a('0x4f');queues[_0x1503c3['origtransfererlinkedid']][_0xff4a('0x44')]=_0x1503c3[_0xff4a('0x59')];queues[_0x1503c3[_0xff4a('0x4a')]][_0xff4a('0x46')]=_0x1503c3[_0xff4a('0x57')];queues[_0x1503c3['origtransfererlinkedid']][_0xff4a('0xa')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x1503c3['secondtransfererlinkedid']])){if(_0x1503c3[_0xff4a('0x5a')]&&queues[_0x1503c3['transfertargetlinkedid']]){queues[_0x1503c3['transfertargetlinkedid']][_0xff4a('0x52')]=0x1;queues[_0x1503c3[_0xff4a('0x53')]]=_[_0xff4a('0x5b')](queues[_0x1503c3[_0xff4a('0x5a')]]);queues[_0x1503c3[_0xff4a('0x53')]]['transfereduniqueid']=_0x1503c3[_0xff4a('0x53')];queues[_0x1503c3[_0xff4a('0x53')]][_0xff4a('0x52')]=0x2;queues[_0x1503c3[_0xff4a('0x53')]][_0xff4a('0x8')]=queues[_0x1503c3[_0xff4a('0x4a')]][_0xff4a('0x8')];queues[_0x1503c3['transfertargetuniqueid']][_0xff4a('0x54')]=queues[_0x1503c3[_0xff4a('0x4a')]][_0xff4a('0x54')];queues[_0x1503c3[_0xff4a('0x53')]]['queuecallerjoinAt']=utils['now']();queues[_0x1503c3[_0xff4a('0x53')]][_0xff4a('0x32')]=utils[_0xff4a('0x12')]();queues[_0x1503c3[_0xff4a('0x53')]][_0xff4a('0x33')]=0x0;queues[_0x1503c3[_0xff4a('0x53')]]['mohtime']=0x0;utils[_0xff4a('0x1')](util['format'](_0xff4a('0x5c'),_0x1503c3[_0xff4a('0x49')],queues[_0x1503c3['transfertargetuniqueid']]['name'],queues[_0x1503c3[_0xff4a('0x53')]][_0xff4a('0x1b')],queues[_0x1503c3[_0xff4a('0x53')]][_0xff4a('0x8')],queues[_0x1503c3[_0xff4a('0x53')]][_0xff4a('0x54')]));}else{utils[_0xff4a('0x1')](util[_0xff4a('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1503c3[_0xff4a('0x49')],queues[_0x1503c3['secondtransfererlinkedid']][_0xff4a('0x1c')],_0x1503c3[_0xff4a('0x4a')]));queues[_0x1503c3[_0xff4a('0x4b')]]['transfereduniqueid']=_0x1503c3[_0xff4a('0x4a')];}}}}catch(_0x403d33){utils[_0xff4a('0x13')](util['format'](_0xff4a('0x48'),_0x1503c3['origtransfereruniqueid']),_0x403d33);}};exports['musiconholdstart']=function(_0x6d2504){try{if(!_[_0xff4a('0x1f')](queues[_0x6d2504[_0xff4a('0x4')]])){utils[_0xff4a('0xf')](util[_0xff4a('0x2')](_0xff4a('0x5d'),_0x6d2504[_0xff4a('0x4')]),_0x6d2504);queues[_0x6d2504[_0xff4a('0x4')]][_0xff4a('0x5e')]=utils['now']();utils['info'](util[_0xff4a('0x2')](_0xff4a('0x5f'),_0x6d2504[_0xff4a('0x4')],queues[_0x6d2504['uniqueid']]['name'],queues[_0x6d2504[_0xff4a('0x4')]][_0xff4a('0x5e')]));}}catch(_0x164844){utils['error'](util[_0xff4a('0x2')]('[%s][queues][musiconholdstart]',_0x6d2504[_0xff4a('0x4')]),_0x164844);}};exports[_0xff4a('0x60')]=function(_0x1156dc){try{if(!_[_0xff4a('0x1f')](queues[_0x1156dc[_0xff4a('0x4')]])){if(!_[_0xff4a('0x1f')](queues[_0x1156dc[_0xff4a('0x4')]][_0xff4a('0x5e')])){utils['debug'](util[_0xff4a('0x2')](_0xff4a('0x61'),_0x1156dc['uniqueid']),_0x1156dc);queues[_0x1156dc['uniqueid']][_0xff4a('0x55')]+=utils[_0xff4a('0x34')](utils[_0xff4a('0x12')](),queues[_0x1156dc[_0xff4a('0x4')]]['musiconholdstartAt']);utils[_0xff4a('0x1')](util[_0xff4a('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x1156dc['uniqueid'],queues[_0x1156dc[_0xff4a('0x4')]]['name'],queues[_0x1156dc[_0xff4a('0x4')]][_0xff4a('0x55')]));delete queues[_0x1156dc[_0xff4a('0x4')]][_0xff4a('0x5e')];}}}catch(_0x37744b){utils[_0xff4a('0x13')](util['format'](_0xff4a('0x61'),_0x1156dc[_0xff4a('0x4')]),_0x37744b);}}; \ No newline at end of file +var _0xcd75=['info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','debug','queuecallerleaveAt','queuecallerexit','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','[%s][queues][hangup]','varset','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandon','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','util','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xcd75,0xb8));var _0x5cd7=function(_0x29ae5c,_0x4368f4){_0x29ae5c=_0x29ae5c-0x0;var _0x1b3c5e=_0xcd75[_0x29ae5c];return _0x1b3c5e;};'use strict';var _=require('lodash');var util=require(_0x5cd7('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x2154e7){utils['info'](util[_0x5cd7('0x1')](_0x5cd7('0x2'),_0x2154e7[_0x5cd7('0x3')],_0x2154e7['channel'],_0x2154e7[_0x5cd7('0x4')],_0x2154e7['lastAssignedTo'],_0x2154e7[_0x5cd7('0x5')],_0x2154e7[_0x5cd7('0x6')],_0x2154e7[_0x5cd7('0x7')]));if(_0x2154e7[_0x5cd7('0x4')]){utils[_0x5cd7('0x8')](_0x2154e7[_0x5cd7('0x4')])[_0x5cd7('0x9')](function(_0x3e6ac8){if(_0x3e6ac8){_0x2154e7[_0x5cd7('0xa')]=_0x3e6ac8[_0x5cd7('0xa')];}utils[_0x5cd7('0xb')]('CreateVoiceQueueReport',_0x2154e7);});}else{utils[_0x5cd7('0xb')](_0x5cd7('0xc'),_0x2154e7);}if(_0x2154e7[_0x5cd7('0xd')]){delete queues[_0x2154e7['transfereduniqueid']];}else{delete queues[_0x2154e7[_0x5cd7('0x3')]];}}exports[_0x5cd7('0xe')]=function(_0x35f162){try{utils['debug'](util[_0x5cd7('0x1')](_0x5cd7('0xf'),_0x35f162[_0x5cd7('0x3')]),_0x35f162);utils[_0x5cd7('0x10')](util[_0x5cd7('0x1')](_0x5cd7('0x11'),_0x35f162[_0x5cd7('0x3')],_0x35f162[_0x5cd7('0x4')],_0x35f162[_0x5cd7('0x12')]));queues[_0x35f162[_0x5cd7('0x3')]]=_[_0x5cd7('0x13')](_0x35f162,{'originalposition':_0x35f162['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x235327){utils[_0x5cd7('0x14')](util[_0x5cd7('0x1')]('[%s][queues][queuecallerjoin]',_0x35f162[_0x5cd7('0x3')]),_0x235327);}};exports[_0x5cd7('0x15')]=function(_0x597581){try{if(!_[_0x5cd7('0x16')](queues[_0x597581[_0x5cd7('0x3')]])){utils[_0x5cd7('0x17')](util[_0x5cd7('0x1')]('[%s][queues][hangup]',_0x597581[_0x5cd7('0x3')]),_0x597581);if(queues[_0x597581[_0x5cd7('0x3')]][_0x5cd7('0x18')]){if(!queues[_0x597581[_0x5cd7('0x3')]]['queuecallerabandon']&&!queues[_0x597581[_0x5cd7('0x3')]][_0x5cd7('0x19')]){queues[_0x597581[_0x5cd7('0x3')]]['queuecallercomplete']=!![];queues[_0x597581['uniqueid']]['queuecallercompleteAt']=utils[_0x5cd7('0x1a')]();queues[_0x597581[_0x5cd7('0x3')]][_0x5cd7('0x7')]=_0x5cd7('0x1b');}utils['info'](util[_0x5cd7('0x1')](_0x5cd7('0x1c'),_0x597581[_0x5cd7('0x3')],queues[_0x597581[_0x5cd7('0x3')]]['name'],queues[_0x597581['uniqueid']][_0x5cd7('0x7')]));writeDB(queues[_0x597581[_0x5cd7('0x3')]]);}else if(queues[_0x597581['uniqueid']][_0x5cd7('0xd')]){utils[_0x5cd7('0x10')](util[_0x5cd7('0x1')](_0x5cd7('0x1d'),_0x597581[_0x5cd7('0x3')],queues[_0x597581[_0x5cd7('0x3')]][_0x5cd7('0x1e')],queues[_0x597581['uniqueid']]['transfereduniqueid']));queues[queues[_0x597581['uniqueid']][_0x5cd7('0xd')]]=queues[_0x597581[_0x5cd7('0x3')]];queues[queues[_0x597581[_0x5cd7('0x3')]][_0x5cd7('0xd')]][_0x5cd7('0x1f')]=0x2;delete queues[_0x597581[_0x5cd7('0x3')]];}}}catch(_0x18a6ce){utils[_0x5cd7('0x14')](util[_0x5cd7('0x1')](_0x5cd7('0x20'),_0x597581[_0x5cd7('0x3')]),_0x18a6ce);}};exports[_0x5cd7('0x21')]=function(_0x108012){try{utils['debug'](util[_0x5cd7('0x1')]('[%s][queues][varset]',_0x108012['uniqueid']),_0x108012);if(!_[_0x5cd7('0x16')](_0x108012[_0x5cd7('0x22')][_0x5cd7('0x23')])&&_0x108012[_0x5cd7('0x24')]['toUpperCase']()!==_0x5cd7('0x25')){if(!_[_0x5cd7('0x16')](queues[_0x108012[_0x5cd7('0x3')]])){queues[_0x108012[_0x5cd7('0x3')]]['queuecallerabandon']=![];queues[_0x108012[_0x5cd7('0x3')]][_0x5cd7('0x26')]=null;queues[_0x108012[_0x5cd7('0x3')]][_0x5cd7('0x19')]=!![];queues[_0x108012[_0x5cd7('0x3')]][_0x5cd7('0x27')]=utils[_0x5cd7('0x1a')]();queues[_0x108012[_0x5cd7('0x3')]][_0x5cd7('0x7')]=_0x108012[_0x5cd7('0x24')][_0x5cd7('0x28')]();utils[_0x5cd7('0x10')](util[_0x5cd7('0x1')](_0x5cd7('0x29'),_0x108012[_0x5cd7('0x3')],queues[_0x108012['uniqueid']][_0x5cd7('0x1e')],_0x108012[_0x5cd7('0x24')],queues[_0x108012['uniqueid']][_0x5cd7('0x7')]));writeDB(queues[_0x108012[_0x5cd7('0x3')]]);}}else if(!_[_0x5cd7('0x16')](_0x108012['variable']['queueposition'])){if(!_[_0x5cd7('0x16')](queues[_0x108012['uniqueid']])&&!queues[_0x108012[_0x5cd7('0x3')]][_0x5cd7('0x2a')]){queues[_0x108012[_0x5cd7('0x3')]][_0x5cd7('0x2a')]=![];queues[_0x108012[_0x5cd7('0x3')]][_0x5cd7('0x26')]=null;queues[_0x108012['uniqueid']]['queuecallerexit']=!![];queues[_0x108012[_0x5cd7('0x3')]][_0x5cd7('0x27')]=utils[_0x5cd7('0x1a')]();queues[_0x108012[_0x5cd7('0x3')]]['queuecallerexitreason']=_0x5cd7('0x2b');utils['info'](util['format'](_0x5cd7('0x2c'),_0x108012[_0x5cd7('0x3')],queues[_0x108012[_0x5cd7('0x3')]][_0x5cd7('0x1e')],_0x108012[_0x5cd7('0x24')],queues[_0x108012['uniqueid']]['queuecallerexitreason']));}}}catch(_0x17d88b){utils[_0x5cd7('0x14')](util['format']('[%s][queues][varset]',_0x108012['uniqueid']),_0x17d88b);}};exports[_0x5cd7('0x2a')]=function(_0x274d79){try{if(!_['isNil'](queues[_0x274d79['uniqueid']])){utils[_0x5cd7('0x17')](util['format'](_0x5cd7('0x2d'),_0x274d79[_0x5cd7('0x3')]),_0x274d79);queues[_0x274d79['uniqueid']][_0x5cd7('0x19')]=![];queues[_0x274d79[_0x5cd7('0x3')]]['queuecallerexitAt']=null;queues[_0x274d79[_0x5cd7('0x3')]][_0x5cd7('0x2a')]=!![];queues[_0x274d79[_0x5cd7('0x3')]][_0x5cd7('0x26')]=utils[_0x5cd7('0x1a')]();queues[_0x274d79[_0x5cd7('0x3')]]['queuecallerexitreason']='ABANDONED';utils[_0x5cd7('0x10')](util[_0x5cd7('0x1')](_0x5cd7('0x2e'),_0x274d79[_0x5cd7('0x3')],queues[_0x274d79[_0x5cd7('0x3')]][_0x5cd7('0x1e')],queues[_0x274d79[_0x5cd7('0x3')]]['queuecallerexitreason']));}}catch(_0x24ecb3){utils[_0x5cd7('0x14')](util[_0x5cd7('0x1')](_0x5cd7('0x2d'),_0x274d79[_0x5cd7('0x3')]),_0x24ecb3);}};exports[_0x5cd7('0x2f')]=function(_0x533189){try{if(!_[_0x5cd7('0x16')](queues[_0x533189[_0x5cd7('0x3')]])){utils[_0x5cd7('0x17')](util[_0x5cd7('0x1')](_0x5cd7('0x30'),_0x533189[_0x5cd7('0x3')]),_0x533189);utils[_0x5cd7('0x10')](util[_0x5cd7('0x1')](_0x5cd7('0x31'),_0x533189[_0x5cd7('0x3')],queues[_0x533189[_0x5cd7('0x3')]][_0x5cd7('0x1e')],_0x533189[_0x5cd7('0x32')],_0x533189[_0x5cd7('0x33')]));queues[_0x533189[_0x5cd7('0x3')]][_0x5cd7('0x2f')]=!![];queues[_0x533189[_0x5cd7('0x3')]][_0x5cd7('0x18')]=utils['now']();queues[_0x533189[_0x5cd7('0x3')]][_0x5cd7('0x34')]=utils[_0x5cd7('0x35')](queues[_0x533189['uniqueid']][_0x5cd7('0x18')],queues[_0x533189['uniqueid']]['queuecallerjoinAt']);queues[_0x533189[_0x5cd7('0x3')]]['position']=_0x533189['position'];queues[_0x533189[_0x5cd7('0x3')]][_0x5cd7('0x36')]=_0x533189[_0x5cd7('0x36')];queues[_0x533189[_0x5cd7('0x3')]][_0x5cd7('0x32')]=_0x533189['connectedlinenum'];queues[_0x533189['uniqueid']][_0x5cd7('0x33')]=_0x533189[_0x5cd7('0x33')];}}catch(_0x554f7e){utils[_0x5cd7('0x14')](util[_0x5cd7('0x1')]('[%s][queues][queuecallerleave]',_0x533189[_0x5cd7('0x3')]),_0x554f7e);}};exports['agentconnect']=function(_0x4a0a9a){try{if(!_[_0x5cd7('0x16')](queues[_0x4a0a9a[_0x5cd7('0x3')]])){utils['debug'](util[_0x5cd7('0x1')](_0x5cd7('0x37'),_0x4a0a9a[_0x5cd7('0x3')]),_0x4a0a9a);utils['info'](util['format'](_0x5cd7('0x38'),_0x4a0a9a[_0x5cd7('0x3')],queues[_0x4a0a9a[_0x5cd7('0x3')]][_0x5cd7('0x1e')],_0x4a0a9a[_0x5cd7('0x39')],_0x4a0a9a[_0x5cd7('0x3a')]));queues[_0x4a0a9a['uniqueid']][_0x5cd7('0x2a')]=![];queues[_0x4a0a9a['uniqueid']][_0x5cd7('0x2a')]=![];queues[_0x4a0a9a[_0x5cd7('0x3')]]['queuecallerabandonAt']=null;queues[_0x4a0a9a[_0x5cd7('0x3')]]['queuecallerexit']=![];queues[_0x4a0a9a[_0x5cd7('0x3')]][_0x5cd7('0x7')]=null;queues[_0x4a0a9a[_0x5cd7('0x3')]][_0x5cd7('0x27')]=null;queues[_0x4a0a9a['uniqueid']][_0x5cd7('0x3b')]=!![];queues[_0x4a0a9a[_0x5cd7('0x3')]][_0x5cd7('0x6')]=_0x4a0a9a[_0x5cd7('0x3a')];queues[_0x4a0a9a[_0x5cd7('0x3')]][_0x5cd7('0x3c')]=_0x4a0a9a[_0x5cd7('0x39')];}}catch(_0x5e62ec){utils[_0x5cd7('0x14')](util[_0x5cd7('0x1')](_0x5cd7('0x37'),_0x4a0a9a[_0x5cd7('0x3')]),_0x5e62ec);}};exports[_0x5cd7('0x3d')]=function(_0x5dd79e){try{if(!_[_0x5cd7('0x16')](queues[_0x5dd79e['uniqueid']])){if(queues[_0x5dd79e[_0x5cd7('0x3')]][_0x5cd7('0x18')]){utils[_0x5cd7('0x17')](util[_0x5cd7('0x1')](_0x5cd7('0x3e'),_0x5dd79e[_0x5cd7('0x3')]),_0x5dd79e);queues[_0x5dd79e[_0x5cd7('0x3')]][_0x5cd7('0x2a')]=![];queues[_0x5dd79e[_0x5cd7('0x3')]][_0x5cd7('0x2a')]=![];queues[_0x5dd79e[_0x5cd7('0x3')]]['queuecallerabandonAt']=null;queues[_0x5dd79e[_0x5cd7('0x3')]][_0x5cd7('0x19')]=![];queues[_0x5dd79e[_0x5cd7('0x3')]][_0x5cd7('0x27')]=null;queues[_0x5dd79e[_0x5cd7('0x3')]][_0x5cd7('0x3b')]=!![];queues[_0x5dd79e[_0x5cd7('0x3')]][_0x5cd7('0x3c')]=_0x5dd79e[_0x5cd7('0x39')];queues[_0x5dd79e['uniqueid']]['queuecallercomplete']=!![];queues[_0x5dd79e[_0x5cd7('0x3')]][_0x5cd7('0x3f')]=utils['now']();if(_0x5dd79e[_0x5cd7('0x40')]==_0x5cd7('0x41')){if(!queues[_0x5dd79e['uniqueid']]['transfer']){queues[_0x5dd79e[_0x5cd7('0x3')]][_0x5cd7('0x7')]='TRANSFER';}}else{queues[_0x5dd79e['uniqueid']]['queuecallerexitreason']=_0x5cd7('0x42')+_0x5dd79e[_0x5cd7('0x40')][_0x5cd7('0x28')]();}utils[_0x5cd7('0x10')](util['format'](_0x5cd7('0x43'),_0x5dd79e[_0x5cd7('0x3')],queues[_0x5dd79e[_0x5cd7('0x3')]][_0x5cd7('0x1e')],_0x5dd79e['membername'],queues[_0x5dd79e[_0x5cd7('0x3')]][_0x5cd7('0x7')]));writeDB(queues[_0x5dd79e['uniqueid']]);}}}catch(_0x524ce0){utils[_0x5cd7('0x14')](util[_0x5cd7('0x1')](_0x5cd7('0x3e'),_0x5dd79e[_0x5cd7('0x3')]),_0x524ce0);}};exports['blindtransfer']=function(_0x4343e6){try{if(!_[_0x5cd7('0x16')](queues[_0x4343e6['transfereeuniqueid']])){utils[_0x5cd7('0x17')](util[_0x5cd7('0x1')](_0x5cd7('0x44'),_0x4343e6[_0x5cd7('0x3')]),_0x4343e6);queues[_0x4343e6[_0x5cd7('0x45')]][_0x5cd7('0x41')]=!![];queues[_0x4343e6[_0x5cd7('0x45')]][_0x5cd7('0x46')]=_0x5cd7('0x47');queues[_0x4343e6[_0x5cd7('0x45')]][_0x5cd7('0x48')]=_0x4343e6[_0x5cd7('0x49')];queues[_0x4343e6[_0x5cd7('0x45')]][_0x5cd7('0x4a')]=_0x4343e6[_0x5cd7('0x45')];queues[_0x4343e6[_0x5cd7('0x45')]][_0x5cd7('0x7')]='BLINDTRANSFER';utils[_0x5cd7('0x10')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x4343e6[_0x5cd7('0x3')],queues[_0x4343e6['transfereeuniqueid']][_0x5cd7('0x1e')],_0x4343e6[_0x5cd7('0x45')],_0x4343e6[_0x5cd7('0x49')]));}}catch(_0x1d9e1f){utils[_0x5cd7('0x14')](util[_0x5cd7('0x1')](_0x5cd7('0x44'),_0x4343e6['uniqueid']),_0x1d9e1f);}};exports['attendedtransfer']=function(_0x365ae9){try{utils[_0x5cd7('0x17')](util[_0x5cd7('0x1')](_0x5cd7('0x4b'),_0x365ae9['origtransfereruniqueid']),_0x365ae9);if(_0x365ae9[_0x5cd7('0x4c')]==_0x365ae9[_0x5cd7('0x4d')]){if(!_[_0x5cd7('0x16')](queues[_0x365ae9[_0x5cd7('0x4e')]])){utils['info'](util[_0x5cd7('0x1')](_0x5cd7('0x4f'),_0x365ae9[_0x5cd7('0x4c')],queues[_0x365ae9['secondtransfererlinkedid']][_0x5cd7('0x1e')],_0x365ae9[_0x5cd7('0x50')]));queues[_0x365ae9[_0x5cd7('0x4e')]][_0x5cd7('0x41')]=!![];queues[_0x365ae9['secondtransfererlinkedid']][_0x5cd7('0x46')]=_0x5cd7('0x51');queues[_0x365ae9[_0x5cd7('0x4e')]][_0x5cd7('0x48')]=_0x365ae9['origtransfererexten'];queues[_0x365ae9[_0x5cd7('0x4e')]][_0x5cd7('0x4a')]=_0x365ae9[_0x5cd7('0x4c')];queues[_0x365ae9[_0x5cd7('0x4e')]][_0x5cd7('0x7')]=_0x5cd7('0x52');}if(!_[_0x5cd7('0x16')](queues[_0x365ae9[_0x5cd7('0x4d')]])){if(_0x365ae9[_0x5cd7('0x53')]&&queues[_0x365ae9[_0x5cd7('0x53')]]){queues[_0x365ae9[_0x5cd7('0x53')]][_0x5cd7('0x1f')]=0x1;queues[_0x365ae9[_0x5cd7('0x45')]]=_[_0x5cd7('0x54')](queues[_0x365ae9[_0x5cd7('0x53')]]);queues[_0x365ae9[_0x5cd7('0x45')]][_0x5cd7('0xd')]=_0x365ae9['transfertargetuniqueid'];queues[_0x365ae9[_0x5cd7('0x45')]][_0x5cd7('0x1f')]=0x2;queues[_0x365ae9[_0x5cd7('0x45')]]['calleridnum']=queues[_0x365ae9[_0x5cd7('0x4e')]][_0x5cd7('0x5')];queues[_0x365ae9[_0x5cd7('0x45')]][_0x5cd7('0x55')]=queues[_0x365ae9[_0x5cd7('0x4e')]]['calleridname'];queues[_0x365ae9[_0x5cd7('0x45')]][_0x5cd7('0x56')]=utils[_0x5cd7('0x1a')]();queues[_0x365ae9['transfereeuniqueid']][_0x5cd7('0x18')]=utils[_0x5cd7('0x1a')]();queues[_0x365ae9[_0x5cd7('0x45')]][_0x5cd7('0x34')]=0x0;queues[_0x365ae9['transfereeuniqueid']][_0x5cd7('0x57')]=0x0;utils['info'](util[_0x5cd7('0x1')](_0x5cd7('0x58'),_0x365ae9[_0x5cd7('0x4c')],queues[_0x365ae9[_0x5cd7('0x45')]][_0x5cd7('0x1e')],queues[_0x365ae9[_0x5cd7('0x45')]]['calleridnum'],queues[_0x365ae9[_0x5cd7('0x45')]][_0x5cd7('0x55')]));}else{utils[_0x5cd7('0x10')](util['format'](_0x5cd7('0x59'),_0x365ae9[_0x5cd7('0x4c')],queues[_0x365ae9[_0x5cd7('0x4d')]][_0x5cd7('0x1e')],_0x365ae9[_0x5cd7('0x4e')]));queues[_0x365ae9[_0x5cd7('0x4d')]][_0x5cd7('0xd')]=_0x365ae9[_0x5cd7('0x4e')];}}}else if(_0x365ae9[_0x5cd7('0x5a')]==_0x365ae9[_0x5cd7('0x4e')]){if(!_[_0x5cd7('0x16')](queues[_0x365ae9[_0x5cd7('0x4d')]])){utils['info'](util[_0x5cd7('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x365ae9[_0x5cd7('0x4c')],queues[_0x365ae9[_0x5cd7('0x4d')]][_0x5cd7('0x1e')],_0x365ae9[_0x5cd7('0x5a')],_0x365ae9[_0x5cd7('0x5b')]));queues[_0x365ae9[_0x5cd7('0x4d')]][_0x5cd7('0x41')]=!![];queues[_0x365ae9[_0x5cd7('0x4d')]][_0x5cd7('0x46')]=_0x5cd7('0x51');queues[_0x365ae9['origtransfererlinkedid']][_0x5cd7('0x48')]=_0x365ae9[_0x5cd7('0x5b')];queues[_0x365ae9[_0x5cd7('0x4d')]][_0x5cd7('0x4a')]=_0x365ae9[_0x5cd7('0x5a')];queues[_0x365ae9[_0x5cd7('0x4d')]][_0x5cd7('0x7')]=_0x5cd7('0x52');}if(!_[_0x5cd7('0x16')](queues[_0x365ae9[_0x5cd7('0x4e')]])){if(_0x365ae9[_0x5cd7('0x5c')]&&queues[_0x365ae9[_0x5cd7('0x5c')]]){queues[_0x365ae9[_0x5cd7('0x5c')]][_0x5cd7('0x1f')]=0x1;queues[_0x365ae9[_0x5cd7('0x5d')]]=_[_0x5cd7('0x54')](queues[_0x365ae9[_0x5cd7('0x5c')]]);queues[_0x365ae9[_0x5cd7('0x5d')]][_0x5cd7('0xd')]=_0x365ae9[_0x5cd7('0x5d')];queues[_0x365ae9[_0x5cd7('0x5d')]][_0x5cd7('0x1f')]=0x2;queues[_0x365ae9[_0x5cd7('0x5d')]][_0x5cd7('0x5')]=queues[_0x365ae9[_0x5cd7('0x4d')]]['calleridnum'];queues[_0x365ae9[_0x5cd7('0x5d')]][_0x5cd7('0x55')]=queues[_0x365ae9[_0x5cd7('0x4d')]][_0x5cd7('0x55')];queues[_0x365ae9['transfertargetuniqueid']][_0x5cd7('0x56')]=utils['now']();queues[_0x365ae9[_0x5cd7('0x5d')]]['queuecallerleaveAt']=utils[_0x5cd7('0x1a')]();queues[_0x365ae9[_0x5cd7('0x5d')]]['holdtime']=0x0;queues[_0x365ae9[_0x5cd7('0x5d')]]['mohtime']=0x0;utils[_0x5cd7('0x10')](util[_0x5cd7('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x365ae9[_0x5cd7('0x4c')],queues[_0x365ae9[_0x5cd7('0x5d')]][_0x5cd7('0x1e')],queues[_0x365ae9[_0x5cd7('0x5d')]][_0x5cd7('0xd')],queues[_0x365ae9[_0x5cd7('0x5d')]][_0x5cd7('0x5')],queues[_0x365ae9['transfertargetuniqueid']][_0x5cd7('0x55')]));}else{utils[_0x5cd7('0x10')](util[_0x5cd7('0x1')](_0x5cd7('0x59'),_0x365ae9['origtransfereruniqueid'],queues[_0x365ae9['secondtransfererlinkedid']][_0x5cd7('0x1e')],_0x365ae9[_0x5cd7('0x4d')]));queues[_0x365ae9[_0x5cd7('0x4e')]][_0x5cd7('0xd')]=_0x365ae9[_0x5cd7('0x4d')];}}}}catch(_0x16f7ce){utils[_0x5cd7('0x14')](util[_0x5cd7('0x1')](_0x5cd7('0x4b'),_0x365ae9[_0x5cd7('0x4c')]),_0x16f7ce);}};exports[_0x5cd7('0x5e')]=function(_0x240ed3){try{if(!_[_0x5cd7('0x16')](queues[_0x240ed3[_0x5cd7('0x3')]])){utils[_0x5cd7('0x17')](util['format'](_0x5cd7('0x5f'),_0x240ed3[_0x5cd7('0x3')]),_0x240ed3);queues[_0x240ed3[_0x5cd7('0x3')]][_0x5cd7('0x60')]=utils[_0x5cd7('0x1a')]();utils[_0x5cd7('0x10')](util[_0x5cd7('0x1')](_0x5cd7('0x61'),_0x240ed3['uniqueid'],queues[_0x240ed3[_0x5cd7('0x3')]][_0x5cd7('0x1e')],queues[_0x240ed3[_0x5cd7('0x3')]]['musiconholdstartAt']));}}catch(_0xd36b4){utils['error'](util['format'](_0x5cd7('0x5f'),_0x240ed3[_0x5cd7('0x3')]),_0xd36b4);}};exports['musiconholdstop']=function(_0x501435){try{if(!_[_0x5cd7('0x16')](queues[_0x501435[_0x5cd7('0x3')]])){if(!_['isNil'](queues[_0x501435[_0x5cd7('0x3')]][_0x5cd7('0x60')])){utils[_0x5cd7('0x17')](util[_0x5cd7('0x1')]('[%s][queues][musiconholdstop]',_0x501435[_0x5cd7('0x3')]),_0x501435);queues[_0x501435[_0x5cd7('0x3')]][_0x5cd7('0x57')]+=utils[_0x5cd7('0x35')](utils[_0x5cd7('0x1a')](),queues[_0x501435[_0x5cd7('0x3')]]['musiconholdstartAt']);utils[_0x5cd7('0x10')](util[_0x5cd7('0x1')](_0x5cd7('0x62'),_0x501435[_0x5cd7('0x3')],queues[_0x501435[_0x5cd7('0x3')]][_0x5cd7('0x1e')],queues[_0x501435[_0x5cd7('0x3')]][_0x5cd7('0x57')]));delete queues[_0x501435[_0x5cd7('0x3')]][_0x5cd7('0x60')];}}}catch(_0x4d6ded){utils[_0x5cd7('0x14')](util[_0x5cd7('0x1')](_0x5cd7('0x63'),_0x501435[_0x5cd7('0x3')]),_0x4d6ded);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index cc1be41..d1decba 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 _0xd3a3=['[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','util','info','uniqueid','accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','debug','format','[%s][recordings][newchannel]','linkedid','context','exten','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.WAV','monitors','push','hangup','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','[%s][recordings][newexten]','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin'];(function(_0x1f35cb,_0x178d59){var _0x3817c4=function(_0x5ae17f){while(--_0x5ae17f){_0x1f35cb['push'](_0x1f35cb['shift']());}};_0x3817c4(++_0x178d59);}(_0xd3a3,0xb1));var _0x3d3a=function(_0x1706fd,_0xbeda5d){_0x1706fd=_0x1706fd-0x0;var _0x1efc81=_0xd3a3[_0x1706fd];return _0x1efc81;};'use strict';var _=require(_0x3d3a('0x0'));var util=require(_0x3d3a('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x477760){utils[_0x3d3a('0x2')](util['format']('[%s][recordings][writeDB]',_0x477760[_0x3d3a('0x3')]));if(_0x477760[_0x3d3a('0x4')]){utils[_0x3d3a('0x5')](_0x477760[_0x3d3a('0x4')])[_0x3d3a('0x6')](function(_0xf65660){if(_0xf65660){_0x477760[_0x3d3a('0x7')]=_0xf65660[_0x3d3a('0x8')];_0x477760['UserId']=_0xf65660['id'];}utils[_0x3d3a('0x9')](_0x3d3a('0xa'),_0x477760);});}else{utils['request'](_0x3d3a('0xa'),_0x477760);}}exports['newchannel']=function(_0x262e68){try{utils[_0x3d3a('0xb')](util[_0x3d3a('0xc')](_0x3d3a('0xd'),_0x262e68[_0x3d3a('0x3')]),_0x262e68);if(_0x262e68[_0x3d3a('0x3')]==_0x262e68[_0x3d3a('0xe')]){utils[_0x3d3a('0x2')](util[_0x3d3a('0xc')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x262e68[_0x3d3a('0x3')],_0x262e68[_0x3d3a('0xf')],_0x262e68[_0x3d3a('0x10')]));recordings[_0x262e68['uniqueid']]={'uniqueid':_0x262e68[_0x3d3a('0x3')],'accountcode':_0x262e68[_0x3d3a('0x4')],'exten':_0x262e68[_0x3d3a('0x10')],'context':_0x262e68[_0x3d3a('0xf')],'channel':_0x262e68[_0x3d3a('0x11')],'monitors':[]};}}catch(_0x48598a){utils[_0x3d3a('0x12')](util[_0x3d3a('0xc')](_0x3d3a('0xd'),_0x262e68[_0x3d3a('0x3')]),_0x48598a);}};exports[_0x3d3a('0x13')]=function(_0x269c5d){try{utils['debug'](util[_0x3d3a('0xc')]('[%s][recordings][newstate]',_0x269c5d[_0x3d3a('0x3')]),_0x269c5d);if(!_[_0x3d3a('0x14')](recordings[_0x269c5d['uniqueid']])&&_0x269c5d[_0x3d3a('0x15')]==0x6){utils[_0x3d3a('0x2')](util[_0x3d3a('0xc')](_0x3d3a('0x16'),_0x269c5d[_0x3d3a('0x3')],_0x269c5d['context'],_0x269c5d['channel']));}else if(!_[_0x3d3a('0x14')](recordings[_0x269c5d[_0x3d3a('0xe')]])&&_0x269c5d[_0x3d3a('0x15')]==0x6&&_0x269c5d[_0x3d3a('0xf')]!=_0x3d3a('0x17')){utils[_0x3d3a('0x2')](util[_0x3d3a('0xc')](_0x3d3a('0x18'),_0x269c5d[_0x3d3a('0x3')],_0x269c5d['linkedid'],_0x269c5d[_0x3d3a('0xf')],_0x269c5d[_0x3d3a('0x11')]));recordings[_0x269c5d['linkedid']][_0x3d3a('0x4')]=_0x269c5d[_0x3d3a('0x4')];}}catch(_0x4f9c15){utils[_0x3d3a('0x12')](util[_0x3d3a('0xc')](_0x3d3a('0x19'),_0x269c5d['uniqueid']),_0x4f9c15);}};exports[_0x3d3a('0x1a')]=function(_0xcbc476){try{if(!_[_0x3d3a('0x14')](_0xcbc476[_0x3d3a('0x1b')])&&!_[_0x3d3a('0x14')](_0xcbc476[_0x3d3a('0x1b')][_0x3d3a('0x1c')])){utils['debug'](util['format'](_0x3d3a('0x1d'),_0xcbc476[_0x3d3a('0x3')]),_0xcbc476);utils[_0x3d3a('0x2')](util[_0x3d3a('0xc')](_0x3d3a('0x1e'),_0xcbc476[_0x3d3a('0x3')],_0xcbc476[_0x3d3a('0x1b')],_0xcbc476[_0x3d3a('0x1f')]));if(_['endsWith'](_0xcbc476['value'],'.wav49')){_0xcbc476[_0x3d3a('0x1f')]=_0xcbc476['value']['replace']('.wav49',_0x3d3a('0x20'));}if(recordings[_0xcbc476[_0x3d3a('0xe')]]){var _0x6b23d5=_['find'](recordings[_0xcbc476[_0x3d3a('0xe')]]['monitors'],{'value':_0xcbc476[_0x3d3a('0x1f')]});if(_[_0x3d3a('0x14')](_0x6b23d5)){recordings[_0xcbc476[_0x3d3a('0xe')]][_0x3d3a('0x21')][_0x3d3a('0x22')]({'value':_0xcbc476['value']});}}}}catch(_0x4c828a){utils['error'](util[_0x3d3a('0xc')]('[%s][recordings][varset]',_0xcbc476['uniqueid']),_0x4c828a);}};exports[_0x3d3a('0x23')]=function(_0x57bac8){try{if(!_[_0x3d3a('0x14')](recordings[_0x57bac8[_0x3d3a('0x3')]])){utils[_0x3d3a('0xb')](util[_0x3d3a('0xc')]('[%s][recordings][hangup]',_0x57bac8[_0x3d3a('0x3')]),_0x57bac8);utils[_0x3d3a('0x2')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x57bac8['uniqueid'],_0x57bac8[_0x3d3a('0x24')],_0x57bac8[_0x3d3a('0x25')],_0x57bac8[_0x3d3a('0x26')]));recordings[_0x57bac8[_0x3d3a('0x3')]][_0x3d3a('0x24')]=_0x57bac8['calleridnum'];recordings[_0x57bac8[_0x3d3a('0x3')]][_0x3d3a('0x25')]=_0x57bac8['calleridname'];recordings[_0x57bac8['uniqueid']][_0x3d3a('0x27')]=_0x57bac8[_0x3d3a('0x27')];recordings[_0x57bac8[_0x3d3a('0x3')]][_0x3d3a('0x28')]=_0x57bac8['connectedlinename'];if(recordings[_0x57bac8['uniqueid']][_0x3d3a('0x29')]==_0x3d3a('0x2a')&&recordings[_0x57bac8['uniqueid']][_0x3d3a('0x4')]){recordings[_0x57bac8[_0x3d3a('0x3')]]['connectedlinenum']=recordings[_0x57bac8[_0x3d3a('0x3')]]['accountcode'];recordings[_0x57bac8[_0x3d3a('0x3')]][_0x3d3a('0x28')]='';}recordings[_0x57bac8[_0x3d3a('0x3')]][_0x3d3a('0x21')][_0x3d3a('0x2b')](function(_0x547118){var _0x17f6a9=_['clone'](recordings[_0x57bac8[_0x3d3a('0x3')]]);_0x17f6a9[_0x3d3a('0x1f')]=_0x547118[_0x3d3a('0x1f')];writeDB(_0x17f6a9);});delete recordings[_0x57bac8['uniqueid']];}}catch(_0xa5143a){utils[_0x3d3a('0x12')](util[_0x3d3a('0xc')](_0x3d3a('0x2c'),_0x57bac8[_0x3d3a('0x3')]),_0xa5143a);}};exports['newexten']=function(_0x3aee5f){try{if(!_['isNil'](recordings[_0x3aee5f['uniqueid']])){utils[_0x3d3a('0xb')](util['format'](_0x3d3a('0x2d'),_0x3aee5f[_0x3d3a('0x3')]),_0x3aee5f);utils[_0x3d3a('0x2')](util[_0x3d3a('0xc')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3aee5f[_0x3d3a('0x3')],_0x3aee5f['application'],_0x3aee5f['appdata']));if(_0x3aee5f['application'][_0x3d3a('0x2e')]()==_0x3d3a('0x2f')&&_[_0x3d3a('0x30')](_0x3aee5f[_0x3d3a('0x31')][_0x3d3a('0x2e')](),_0x3d3a('0x32'))){var _0x16a213=_0x3aee5f[_0x3d3a('0x31')][_0x3d3a('0x33')]('=');var _0x1a139e=_0x16a213[0x0][_0x3d3a('0x34')](_0x16a213[0x0][_0x3d3a('0x35')]('(')+0x1,_0x16a213[0x0][_0x3d3a('0x35')](')'));var _0x527816=_0x16a213[0x1];recordings[_0x3aee5f[_0x3d3a('0x3')]][_0x1a139e]=_0x527816;}}}catch(_0x43f390){utils[_0x3d3a('0x12')](util[_0x3d3a('0xc')](_0x3d3a('0x2d'),_0x3aee5f[_0x3d3a('0x3')]),_0x43f390);}};exports[_0x3d3a('0x36')]=function(_0x26014e){try{if(!_[_0x3d3a('0x14')](recordings[_0x26014e['uniqueid']])){utils[_0x3d3a('0xb')](util[_0x3d3a('0xc')]('[%s][recordings][queuecallerjoin]',_0x26014e[_0x3d3a('0x3')]),_0x26014e);utils[_0x3d3a('0x2')](util[_0x3d3a('0xc')](_0x3d3a('0x37'),_0x26014e[_0x3d3a('0x3')],_0x26014e[_0x3d3a('0x38')]));recordings[_0x26014e[_0x3d3a('0x3')]][_0x3d3a('0x38')]=_0x26014e[_0x3d3a('0x38')];}}catch(_0x221d41){utils[_0x3d3a('0x12')](util['format'](_0x3d3a('0x39'),_0x26014e[_0x3d3a('0x3')]),_0x221d41);}}; \ No newline at end of file +var _0xa70b=['.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','[%s][recordings][varset]','value'];(function(_0x7dd7a7,_0x1623e4){var _0x6c43bb=function(_0x5e4a3a){while(--_0x5e4a3a){_0x7dd7a7['push'](_0x7dd7a7['shift']());}};_0x6c43bb(++_0x1623e4);}(_0xa70b,0x192));var _0xba70=function(_0x3fad5a,_0x2d3b02){_0x3fad5a=_0x3fad5a-0x0;var _0x4ca713=_0xa70b[_0x3fad5a];return _0x4ca713;};'use strict';var _=require(_0xba70('0x0'));var util=require(_0xba70('0x1'));var utils=require(_0xba70('0x2'));var recordings={};function writeDB(_0x38e7ff){utils[_0xba70('0x3')](util[_0xba70('0x4')](_0xba70('0x5'),_0x38e7ff[_0xba70('0x6')]));if(_0x38e7ff[_0xba70('0x7')]){utils[_0xba70('0x8')](_0x38e7ff['accountcode'])[_0xba70('0x9')](function(_0x4b0b39){if(_0x4b0b39){_0x38e7ff[_0xba70('0xa')]=_0x4b0b39[_0xba70('0xb')];_0x38e7ff['UserId']=_0x4b0b39['id'];}utils[_0xba70('0xc')]('CreateVoiceRecording',_0x38e7ff);});}else{utils['request'](_0xba70('0xd'),_0x38e7ff);}}exports[_0xba70('0xe')]=function(_0x375517){try{utils[_0xba70('0xf')](util['format']('[%s][recordings][newchannel]',_0x375517[_0xba70('0x6')]),_0x375517);if(_0x375517[_0xba70('0x6')]==_0x375517[_0xba70('0x10')]){utils[_0xba70('0x3')](util[_0xba70('0x4')](_0xba70('0x11'),_0x375517['uniqueid'],_0x375517[_0xba70('0x12')],_0x375517['exten']));recordings[_0x375517[_0xba70('0x6')]]={'uniqueid':_0x375517['uniqueid'],'accountcode':_0x375517['accountcode'],'exten':_0x375517[_0xba70('0x13')],'context':_0x375517[_0xba70('0x12')],'channel':_0x375517[_0xba70('0x14')],'monitors':[]};}}catch(_0x13145b){utils[_0xba70('0x15')](util['format'](_0xba70('0x16'),_0x375517[_0xba70('0x6')]),_0x13145b);}};exports[_0xba70('0x17')]=function(_0x4c6074){try{utils[_0xba70('0xf')](util[_0xba70('0x4')](_0xba70('0x18'),_0x4c6074[_0xba70('0x6')]),_0x4c6074);if(!_[_0xba70('0x19')](recordings[_0x4c6074[_0xba70('0x6')]])&&_0x4c6074['channelstate']==0x6){utils[_0xba70('0x3')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x4c6074[_0xba70('0x6')],_0x4c6074[_0xba70('0x12')],_0x4c6074[_0xba70('0x14')]));}else if(!_[_0xba70('0x19')](recordings[_0x4c6074['linkedid']])&&_0x4c6074[_0xba70('0x1a')]==0x6&&_0x4c6074['context']!=_0xba70('0x1b')){utils[_0xba70('0x3')](util['format'](_0xba70('0x1c'),_0x4c6074['uniqueid'],_0x4c6074['linkedid'],_0x4c6074[_0xba70('0x12')],_0x4c6074[_0xba70('0x14')]));recordings[_0x4c6074[_0xba70('0x10')]][_0xba70('0x7')]=_0x4c6074[_0xba70('0x7')];}}catch(_0x2878f9){utils[_0xba70('0x15')](util['format']('[%s][recordings][newstate]',_0x4c6074[_0xba70('0x6')]),_0x2878f9);}};exports['varset']=function(_0x49a91b){try{if(!_[_0xba70('0x19')](_0x49a91b[_0xba70('0x1d')])&&!_[_0xba70('0x19')](_0x49a91b[_0xba70('0x1d')]['mixmonitor_filename'])){utils[_0xba70('0xf')](util[_0xba70('0x4')](_0xba70('0x1e'),_0x49a91b[_0xba70('0x6')]),_0x49a91b);utils[_0xba70('0x3')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x49a91b[_0xba70('0x6')],_0x49a91b[_0xba70('0x1d')],_0x49a91b[_0xba70('0x1f')]));if(_['endsWith'](_0x49a91b[_0xba70('0x1f')],_0xba70('0x20'))){_0x49a91b['value']=_0x49a91b['value'][_0xba70('0x21')](_0xba70('0x20'),'.WAV');}if(recordings[_0x49a91b[_0xba70('0x10')]]){var _0x301ea5=_[_0xba70('0x22')](recordings[_0x49a91b[_0xba70('0x10')]][_0xba70('0x23')],{'value':_0x49a91b[_0xba70('0x1f')]});if(_[_0xba70('0x19')](_0x301ea5)){recordings[_0x49a91b[_0xba70('0x10')]][_0xba70('0x23')][_0xba70('0x24')]({'value':_0x49a91b[_0xba70('0x1f')]});}}}}catch(_0x2c7884){utils['error'](util[_0xba70('0x4')](_0xba70('0x1e'),_0x49a91b[_0xba70('0x6')]),_0x2c7884);}};exports[_0xba70('0x25')]=function(_0xedbcb0){try{if(!_[_0xba70('0x19')](recordings[_0xedbcb0[_0xba70('0x6')]])){utils[_0xba70('0xf')](util['format'](_0xba70('0x26'),_0xedbcb0[_0xba70('0x6')]),_0xedbcb0);utils[_0xba70('0x3')](util[_0xba70('0x4')](_0xba70('0x27'),_0xedbcb0[_0xba70('0x6')],_0xedbcb0[_0xba70('0x28')],_0xedbcb0['calleridname'],_0xedbcb0[_0xba70('0x29')]));recordings[_0xedbcb0[_0xba70('0x6')]]['calleridnum']=_0xedbcb0[_0xba70('0x28')];recordings[_0xedbcb0['uniqueid']][_0xba70('0x2a')]=_0xedbcb0[_0xba70('0x2a')];recordings[_0xedbcb0[_0xba70('0x6')]][_0xba70('0x2b')]=_0xedbcb0[_0xba70('0x2b')];recordings[_0xedbcb0[_0xba70('0x6')]][_0xba70('0x2c')]=_0xedbcb0[_0xba70('0x2c')];if(recordings[_0xedbcb0[_0xba70('0x6')]][_0xba70('0x2d')]==_0xba70('0x2e')&&recordings[_0xedbcb0[_0xba70('0x6')]][_0xba70('0x7')]){recordings[_0xedbcb0[_0xba70('0x6')]][_0xba70('0x2b')]=recordings[_0xedbcb0[_0xba70('0x6')]][_0xba70('0x7')];recordings[_0xedbcb0['uniqueid']][_0xba70('0x2c')]='';}recordings[_0xedbcb0[_0xba70('0x6')]][_0xba70('0x23')]['forEach'](function(_0x35e21d){var _0x146c7e=_[_0xba70('0x2f')](recordings[_0xedbcb0['uniqueid']]);_0x146c7e[_0xba70('0x1f')]=_0x35e21d[_0xba70('0x1f')];writeDB(_0x146c7e);});delete recordings[_0xedbcb0[_0xba70('0x6')]];}}catch(_0x56fdb6){utils[_0xba70('0x15')](util['format'](_0xba70('0x26'),_0xedbcb0['uniqueid']),_0x56fdb6);}};exports[_0xba70('0x30')]=function(_0x40d13b){try{if(!_[_0xba70('0x19')](recordings[_0x40d13b['uniqueid']])){utils[_0xba70('0xf')](util['format']('[%s][recordings][newexten]',_0x40d13b[_0xba70('0x6')]),_0x40d13b);utils['info'](util[_0xba70('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x40d13b[_0xba70('0x6')],_0x40d13b[_0xba70('0x31')],_0x40d13b[_0xba70('0x32')]));if(_0x40d13b[_0xba70('0x31')][_0xba70('0x33')]()==_0xba70('0x34')&&_[_0xba70('0x35')](_0x40d13b['appdata']['toLowerCase'](),_0xba70('0x36'))){var _0x2f0b7b=_0x40d13b[_0xba70('0x32')]['split']('=');var _0x1b3275=_0x2f0b7b[0x0][_0xba70('0x37')](_0x2f0b7b[0x0][_0xba70('0x38')]('(')+0x1,_0x2f0b7b[0x0][_0xba70('0x38')](')'));var _0xcbe2af=_0x2f0b7b[0x1];recordings[_0x40d13b[_0xba70('0x6')]][_0x1b3275]=_0xcbe2af;}}}catch(_0x4e5922){utils[_0xba70('0x15')](util[_0xba70('0x4')](_0xba70('0x39'),_0x40d13b['uniqueid']),_0x4e5922);}};exports[_0xba70('0x3a')]=function(_0x11090e){try{if(!_[_0xba70('0x19')](recordings[_0x11090e[_0xba70('0x6')]])){utils[_0xba70('0xf')](util['format'](_0xba70('0x3b'),_0x11090e[_0xba70('0x6')]),_0x11090e);utils['info'](util[_0xba70('0x4')](_0xba70('0x3c'),_0x11090e[_0xba70('0x6')],_0x11090e[_0xba70('0x3d')]));recordings[_0x11090e[_0xba70('0x6')]]['queue']=_0x11090e[_0xba70('0x3d')];}}catch(_0x337ed6){utils[_0xba70('0x15')](util['format']('[%s][recordings][queuecallerjoin]',_0x11090e['uniqueid']),_0x337ed6);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 49959f4..5b360c2 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 _0xfb4c=['debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer'];(function(_0xfbd2d6,_0x488a1b){var _0x1af3df=function(_0x1fcc5e){while(--_0x1fcc5e){_0xfbd2d6['push'](_0xfbd2d6['shift']());}};_0x1af3df(++_0x488a1b);}(_0xfb4c,0x1e4));var _0xcfb4=function(_0x5cdcdd,_0x484acc){_0x5cdcdd=_0x5cdcdd-0x0;var _0x2f21c3=_0xfb4c[_0x5cdcdd];return _0x2f21c3;};'use strict';var _=require(_0xcfb4('0x0'));var util=require(_0xcfb4('0x1'));var utils=require('./utils');function writeDB(_0x583ce){utils[_0xcfb4('0x2')](util[_0xcfb4('0x3')](_0xcfb4('0x4'),_0x583ce[_0xcfb4('0x5')]===_0xcfb4('0x6')?_0x583ce['origtransfereruniqueid']:_0x583ce[_0xcfb4('0x7')],_0x583ce[_0xcfb4('0x5')]));utils[_0xcfb4('0x8')](_0xcfb4('0x9'),_0x583ce);}exports['blinds']={};exports[_0xcfb4('0xa')]=function(_0x2c2d47){try{utils[_0xcfb4('0xb')](util[_0xcfb4('0x3')](_0xcfb4('0xc'),_0x2c2d47[_0xcfb4('0x7')]),_0x2c2d47);utils[_0xcfb4('0x2')](util[_0xcfb4('0x3')](_0xcfb4('0xd'),_0x2c2d47[_0xcfb4('0x7')],_0x2c2d47[_0xcfb4('0xe')],_0x2c2d47[_0xcfb4('0xf')],_0x2c2d47[_0xcfb4('0x10')],_0x2c2d47[_0xcfb4('0x11')]));_0x2c2d47[_0xcfb4('0x5')]='blind';exports['blinds'][_0x2c2d47[_0xcfb4('0x12')]]=_0x2c2d47;writeDB(_0x2c2d47);}catch(_0x359395){utils[_0xcfb4('0x13')](util[_0xcfb4('0x3')](_0xcfb4('0xc'),_0x2c2d47[_0xcfb4('0x7')]),_0x359395);}};exports[_0xcfb4('0x14')]=function(_0x20fcff){try{utils['debug'](util[_0xcfb4('0x3')](_0xcfb4('0x15'),_0x20fcff[_0xcfb4('0x16')]),_0x20fcff);utils[_0xcfb4('0x2')](util['format'](_0xcfb4('0x17'),_0x20fcff[_0xcfb4('0x16')],_0x20fcff['origtransferercalleridnum'],_0x20fcff[_0xcfb4('0x18')],_0x20fcff['transfertargetcalleridnum'],_0x20fcff[_0xcfb4('0x19')]));_0x20fcff=_[_0xcfb4('0x1a')](_0x20fcff,{'transfererchannel':_0x20fcff[_0xcfb4('0x1b')],'transferercalleridnum':_0x20fcff[_0xcfb4('0x1c')],'transferercalleridname':_0x20fcff[_0xcfb4('0x18')],'transfererconnectedlinenum':_0x20fcff[_0xcfb4('0x1d')],'transfererconnectedlinename':_0x20fcff['secondtransfererconnectedlinename'],'transfereraccountcode':_0x20fcff[_0xcfb4('0x1e')],'transferercontext':_0x20fcff[_0xcfb4('0x1f')],'transfererexten':_0x20fcff[_0xcfb4('0x20')],'transfererlinkedid':_0x20fcff[_0xcfb4('0x21')],'context':_0x20fcff[_0xcfb4('0x22')],'extension':_0x20fcff[_0xcfb4('0x23')],'type':_0xcfb4('0x6')});if(_[_0xcfb4('0x24')](_0x20fcff['transfereechannel'])){_0x20fcff=_['assign'](_0x20fcff,{'transfereechannel':_0x20fcff[_0xcfb4('0x25')],'transfereecalleridnum':_0x20fcff[_0xcfb4('0x26')],'transfereecalleridname':_0x20fcff[_0xcfb4('0x19')],'transfereeconnectedlinenum':_0x20fcff[_0xcfb4('0x27')],'transfereeconnectedlinename':_0x20fcff[_0xcfb4('0x28')],'transfereeaccountcode':_0x20fcff[_0xcfb4('0x29')],'transfereecontext':_0x20fcff[_0xcfb4('0x2a')],'transfereeexten':_0x20fcff[_0xcfb4('0x2b')],'transfereelinkedid':_0x20fcff[_0xcfb4('0x2c')]});}writeDB(_0x20fcff);}catch(_0x4bbc88){utils[_0xcfb4('0x13')](util['format'](_0xcfb4('0x15'),_0x20fcff[_0xcfb4('0x16')]),_0x4bbc88);}}; \ No newline at end of file +var _0x9b1f=['transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererexten','transfereechannel','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]','uniqueid','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0x9b1f,0x1ea));var _0xf9b1=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x9b1f[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0xf9b1('0x0'));var util=require(_0xf9b1('0x1'));var utils=require('./utils');function writeDB(_0x109350){utils['info'](util[_0xf9b1('0x2')](_0xf9b1('0x3'),_0x109350[_0xf9b1('0x4')]===_0xf9b1('0x5')?_0x109350[_0xf9b1('0x6')]:_0x109350['uniqueid'],_0x109350[_0xf9b1('0x4')]));utils['request'](_0xf9b1('0x7'),_0x109350);}exports[_0xf9b1('0x8')]={};exports[_0xf9b1('0x9')]=function(_0x27fcb5){try{utils['debug'](util[_0xf9b1('0x2')](_0xf9b1('0xa'),_0x27fcb5[_0xf9b1('0xb')]),_0x27fcb5);utils[_0xf9b1('0xc')](util[_0xf9b1('0x2')](_0xf9b1('0xd'),_0x27fcb5[_0xf9b1('0xb')],_0x27fcb5[_0xf9b1('0xe')],_0x27fcb5[_0xf9b1('0xf')],_0x27fcb5[_0xf9b1('0x10')],_0x27fcb5[_0xf9b1('0x11')]));_0x27fcb5[_0xf9b1('0x4')]=_0xf9b1('0x12');exports[_0xf9b1('0x8')][_0x27fcb5[_0xf9b1('0x13')]]=_0x27fcb5;writeDB(_0x27fcb5);}catch(_0x10553b){utils[_0xf9b1('0x14')](util[_0xf9b1('0x2')](_0xf9b1('0xa'),_0x27fcb5[_0xf9b1('0xb')]),_0x10553b);}};exports[_0xf9b1('0x15')]=function(_0x14a6f0){try{utils['debug'](util[_0xf9b1('0x2')](_0xf9b1('0x16'),_0x14a6f0[_0xf9b1('0x6')]),_0x14a6f0);utils['info'](util['format'](_0xf9b1('0x17'),_0x14a6f0[_0xf9b1('0x6')],_0x14a6f0[_0xf9b1('0x18')],_0x14a6f0[_0xf9b1('0x19')],_0x14a6f0[_0xf9b1('0x1a')],_0x14a6f0['transfertargetcalleridname']));_0x14a6f0=_[_0xf9b1('0x1b')](_0x14a6f0,{'transfererchannel':_0x14a6f0['origtransfererchannel'],'transferercalleridnum':_0x14a6f0[_0xf9b1('0x18')],'transferercalleridname':_0x14a6f0[_0xf9b1('0x19')],'transfererconnectedlinenum':_0x14a6f0[_0xf9b1('0x1c')],'transfererconnectedlinename':_0x14a6f0['secondtransfererconnectedlinename'],'transfereraccountcode':_0x14a6f0[_0xf9b1('0x1d')],'transferercontext':_0x14a6f0[_0xf9b1('0x1e')],'transfererexten':_0x14a6f0['secondtransfererexten'],'transfererlinkedid':_0x14a6f0['origtransfererlinkedid'],'context':_0x14a6f0['origtransferercontext'],'extension':_0x14a6f0[_0xf9b1('0x1f')],'type':'attended'});if(_['isNil'](_0x14a6f0[_0xf9b1('0x20')])){_0x14a6f0=_[_0xf9b1('0x1b')](_0x14a6f0,{'transfereechannel':_0x14a6f0['transfertargetchannel'],'transfereecalleridnum':_0x14a6f0[_0xf9b1('0x1a')],'transfereecalleridname':_0x14a6f0['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x14a6f0['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x14a6f0['transfertargetconnectedlinename'],'transfereeaccountcode':_0x14a6f0['transfertargetaccountcode'],'transfereecontext':_0x14a6f0[_0xf9b1('0x21')],'transfereeexten':_0x14a6f0[_0xf9b1('0x22')],'transfereelinkedid':_0x14a6f0[_0xf9b1('0x23')]});}writeDB(_0x14a6f0);}catch(_0x579604){utils[_0xf9b1('0x14')](util[_0xf9b1('0x2')](_0xf9b1('0x16'),_0x14a6f0[_0xf9b1('0x6')]),_0x579604);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index ace494b..6af6270 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 _0x40df=['subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','interface','then','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x40df,0x1c9));var _0xf40d=function(_0x9771f8,_0x26d9d0){_0x9771f8=_0x9771f8-0x0;var _0x3ce374=_0x40df[_0x9771f8];return _0x3ce374;};'use strict';var BPromise=require(_0xf40d('0x0'));var jayson=require(_0xf40d('0x1'));var moment=require(_0xf40d('0x2'));var util=require(_0xf40d('0x3'));var client=jayson[_0xf40d('0x4')][_0xf40d('0x5')]({'port':0x2329});var logger=require(_0xf40d('0x6'))(_0xf40d('0x7'));exports[_0xf40d('0x8')]=function(_0x2dcf74,_0x34240f){logger[_0xf40d('0x8')](_0x2dcf74,_0x34240f?util[_0xf40d('0x9')](_0x34240f,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x13ae43,_0x27ace3){logger[_0xf40d('0xa')](_0x13ae43,_0x27ace3?util['inspect'](_0x27ace3,{'showHidden':![],'depth':null}):'');};exports[_0xf40d('0xb')]=function(_0x29b3ee,_0x7d8812){logger['error'](_0x29b3ee,_0x7d8812?util[_0xf40d('0x9')](_0x7d8812,{'showHidden':![],'depth':null}):'');};exports[_0xf40d('0xc')]=function(_0x5a942a,_0x56acf0){return client[_0xf40d('0xc')](_0x5a942a,{'body':_0x56acf0})['then'](function(_0x5f164b){logger[_0xf40d('0xa')](_0xf40d('0xd'),_0x5a942a,_0x5f164b?util[_0xf40d('0x9')](_0x5f164b,{'showHidden':![],'depth':null}):'');})[_0xf40d('0xe')](function(_0x55c07b){logger[_0xf40d('0xb')](_0xf40d('0xd'),_0x5a942a,_0x55c07b?util['inspect'](_0x55c07b,{'showHidden':![],'depth':null}):'');});};function getUser(_0x315e48){return client[_0xf40d('0xc')](_0xf40d('0xf'),{'options':{'raw':!![],'attributes':['id','internal','name',_0xf40d('0x10')],'where':_0x315e48,'limit':0x1}})[_0xf40d('0x11')](function(_0x1579e4){logger['debug']('[utils][getUser]\x20where:%s',JSON[_0xf40d('0x12')](_0x315e48),_0x1579e4?util[_0xf40d('0x9')](_0x1579e4,{'showHidden':![],'depth':null}):'');return _0x1579e4[_0xf40d('0x13')][_0xf40d('0x14')]?_0x1579e4['result'][0x0]:null;});}exports[_0xf40d('0x15')]=function(_0xfdbb3d){return new BPromise(function(_0x526226,_0xb4df18){if(_0xfdbb3d){return getUser({'internal':_0xfdbb3d})['then'](function(_0x1b4c04){logger[_0xf40d('0x8')](_0xf40d('0x16'),_0xfdbb3d,_0x1b4c04?'found':_0xf40d('0x17'));return _0x526226(_0x1b4c04);})['catch'](function(_0x462c04){logger[_0xf40d('0xb')](_0xf40d('0x18'),_0x462c04?util['inspect'](_0x462c04,{'showHidden':![],'depth':null}):'');return _0x526226(null);});}return _0x526226(null);});};exports[_0xf40d('0x19')]=function(_0x6f7ed9){return new BPromise(function(_0x55fea3,_0x24423e){if(_0x6f7ed9){return getUser({'interface':_0x6f7ed9})[_0xf40d('0x11')](function(_0x52aaaa){logger[_0xf40d('0x8')](_0xf40d('0x1a'),_0x6f7ed9,_0x52aaaa?_0xf40d('0x1b'):_0xf40d('0x17'));return _0x55fea3(_0x52aaaa);})['catch'](function(_0x84190d){logger[_0xf40d('0xb')](_0xf40d('0x1c'),_0x84190d?util[_0xf40d('0x9')](_0x84190d,{'showHidden':![],'depth':null}):'');return _0x55fea3(null);});}return _0x55fea3(null);});};exports[_0xf40d('0x1d')]=function(_0x415ba9){return new BPromise(function(_0x53075c,_0x1d80cb){if(_0x415ba9){return getUser({'name':_0x415ba9})[_0xf40d('0x11')](function(_0x190430){logger['info'](_0xf40d('0x1e'),_0x415ba9,_0x190430?'found':_0xf40d('0x17'));return _0x53075c(_0x190430);})[_0xf40d('0xe')](function(_0x155ab8){logger[_0xf40d('0xb')](_0xf40d('0x1f'),_0x155ab8?util['inspect'](_0x155ab8,{'showHidden':![],'depth':null}):'');return _0x53075c(null);});}return _0x53075c(null);});};exports[_0xf40d('0x20')]=function(_0x3f15d4){return new BPromise(function(_0x4c9cbe,_0x4f4ccc){if(_0x3f15d4){return client[_0xf40d('0xc')](_0xf40d('0x21'),{'options':{'raw':!![],'attributes':['id','name','type',_0xf40d('0x22'),_0xf40d('0x23')],'where':{'name':_0x3f15d4},'limit':0x1}})[_0xf40d('0x11')](function(_0x384a7f){logger[_0xf40d('0xa')]('[utils][getVoiceQueueByName]\x20name:%s',_0x3f15d4,_0x384a7f?util['inspect'](_0x384a7f,{'showHidden':![],'depth':null}):'');logger['info'](_0xf40d('0x24'),_0x3f15d4,_0x384a7f?_0xf40d('0x1b'):'notfound');return _0x4c9cbe(_0x384a7f[_0xf40d('0x13')][_0xf40d('0x14')]?_0x384a7f['result'][0x0]:null);})['catch'](function(_0x39b3f9){logger[_0xf40d('0xb')](_0xf40d('0x25'),_0x39b3f9?util[_0xf40d('0x9')](_0x39b3f9,{'showHidden':![],'depth':null}):'');return _0x4c9cbe(null);});}return _0x4c9cbe(null);});};exports[_0xf40d('0x26')]=function(_0x2e2bee,_0x170968){return moment(_0x2e2bee)[_0xf40d('0x27')](_0x170968,_0xf40d('0x28'))[_0xf40d('0x29')](_0xf40d('0x2a'));};exports['subtractTime']=function(_0x4c3b15,_0x29df97){return moment(_0x4c3b15)[_0xf40d('0x2b')](_0x29df97,_0xf40d('0x28'))[_0xf40d('0x29')](_0xf40d('0x2a'));};exports[_0xf40d('0x2c')]=function(_0x4c0c6a,_0x5ab666){return moment(_0x4c0c6a)[_0xf40d('0x2d')](moment(_0x5ab666),_0xf40d('0x28'));};exports[_0xf40d('0x2e')]=function(_0x44dc6e,_0x1b8abc){return parseInt(_0x44dc6e,0xa)+parseInt(_0x1b8abc,0xa);};exports[_0xf40d('0x2f')]=function(){return moment()[_0xf40d('0x29')](_0xf40d('0x2a'));};exports[_0xf40d('0x30')]=function(_0x582f35,_0x3ea955){if(_0x3ea955){return moment(_0x582f35)[_0xf40d('0x30')](_0x3ea955);}return!![];};exports[_0xf40d('0x31')]=function(_0x3f91f2,_0x4966f1){if(_0x4966f1){return moment(_0x3f91f2)[_0xf40d('0x31')](_0x4966f1);}else if(_0x3f91f2){return!![];}return![];}; \ No newline at end of file +var _0xaa0d=['http','../../config/logger','info','debug','inspect','error','request','catch','[utils][request]\x20name:%s','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','then','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','diff','now','isAfter','isBefore','moment','util'];(function(_0x1fc86a,_0x54613a){var _0x357919=function(_0x48e964){while(--_0x48e964){_0x1fc86a['push'](_0x1fc86a['shift']());}};_0x357919(++_0x54613a);}(_0xaa0d,0x18a));var _0xdaa0=function(_0x9df41b,_0x1b3d47){_0x9df41b=_0x9df41b-0x0;var _0x4e3fc1=_0xaa0d[_0x9df41b];return _0x4e3fc1;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0xdaa0('0x0'));var util=require(_0xdaa0('0x1'));var client=jayson['client'][_0xdaa0('0x2')]({'port':0x2329});var logger=require(_0xdaa0('0x3'))('xdr');exports[_0xdaa0('0x4')]=function(_0x13e54e,_0x4a88f6){logger['info'](_0x13e54e,_0x4a88f6?util['inspect'](_0x4a88f6,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x27a437,_0x10b2e0){logger[_0xdaa0('0x5')](_0x27a437,_0x10b2e0?util[_0xdaa0('0x6')](_0x10b2e0,{'showHidden':![],'depth':null}):'');};exports[_0xdaa0('0x7')]=function(_0x396a3f,_0x496b4e){logger[_0xdaa0('0x7')](_0x396a3f,_0x496b4e?util[_0xdaa0('0x6')](_0x496b4e,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0xfcfbb5,_0x563290){return client[_0xdaa0('0x8')](_0xfcfbb5,{'body':_0x563290})['then'](function(_0x3d49d2){logger[_0xdaa0('0x5')]('[utils][request]\x20name:%s',_0xfcfbb5,_0x3d49d2?util[_0xdaa0('0x6')](_0x3d49d2,{'showHidden':![],'depth':null}):'');})[_0xdaa0('0x9')](function(_0x5917f9){logger[_0xdaa0('0x7')](_0xdaa0('0xa'),_0xfcfbb5,_0x5917f9?util['inspect'](_0x5917f9,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3cf1d3){return client[_0xdaa0('0x8')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xdaa0('0xb'),_0xdaa0('0xc'),_0xdaa0('0xd')],'where':_0x3cf1d3,'limit':0x1}})['then'](function(_0x827463){logger[_0xdaa0('0x5')](_0xdaa0('0xe'),JSON[_0xdaa0('0xf')](_0x3cf1d3),_0x827463?util[_0xdaa0('0x6')](_0x827463,{'showHidden':![],'depth':null}):'');return _0x827463['result']['length']?_0x827463[_0xdaa0('0x10')][0x0]:null;});}exports['getUserByInternal']=function(_0x5db6ff){return new BPromise(function(_0x25cdd9,_0x5900ae){if(_0x5db6ff){return getUser({'internal':_0x5db6ff})[_0xdaa0('0x11')](function(_0x5e8763){logger[_0xdaa0('0x4')](_0xdaa0('0x12'),_0x5db6ff,_0x5e8763?_0xdaa0('0x13'):_0xdaa0('0x14'));return _0x25cdd9(_0x5e8763);})['catch'](function(_0x1f3c74){logger[_0xdaa0('0x7')]('[utils][getUserByInternal]',_0x1f3c74?util['inspect'](_0x1f3c74,{'showHidden':![],'depth':null}):'');return _0x25cdd9(null);});}return _0x25cdd9(null);});};exports[_0xdaa0('0x15')]=function(_0x3f07b8){return new BPromise(function(_0x2c7c73,_0x5350f0){if(_0x3f07b8){return getUser({'interface':_0x3f07b8})[_0xdaa0('0x11')](function(_0x3ee642){logger[_0xdaa0('0x4')](_0xdaa0('0x16'),_0x3f07b8,_0x3ee642?_0xdaa0('0x13'):'notfound');return _0x2c7c73(_0x3ee642);})[_0xdaa0('0x9')](function(_0x551e28){logger['error'](_0xdaa0('0x17'),_0x551e28?util[_0xdaa0('0x6')](_0x551e28,{'showHidden':![],'depth':null}):'');return _0x2c7c73(null);});}return _0x2c7c73(null);});};exports['getUserByName']=function(_0x3710ac){return new BPromise(function(_0x2f25ef,_0x357127){if(_0x3710ac){return getUser({'name':_0x3710ac})[_0xdaa0('0x11')](function(_0x448f8b){logger[_0xdaa0('0x4')](_0xdaa0('0x18'),_0x3710ac,_0x448f8b?_0xdaa0('0x13'):'notfound');return _0x2f25ef(_0x448f8b);})[_0xdaa0('0x9')](function(_0x25f54a){logger['error']('[utils][getUserByName]',_0x25f54a?util['inspect'](_0x25f54a,{'showHidden':![],'depth':null}):'');return _0x2f25ef(null);});}return _0x2f25ef(null);});};exports[_0xdaa0('0x19')]=function(_0x14647a){return new BPromise(function(_0x56c56c,_0x46c8d9){if(_0x14647a){return client[_0xdaa0('0x8')](_0xdaa0('0x1a'),{'options':{'raw':!![],'attributes':['id','name',_0xdaa0('0x1b'),_0xdaa0('0x1c'),'acwTimeout'],'where':{'name':_0x14647a},'limit':0x1}})[_0xdaa0('0x11')](function(_0x3a93cf){logger[_0xdaa0('0x5')](_0xdaa0('0x1d'),_0x14647a,_0x3a93cf?util[_0xdaa0('0x6')](_0x3a93cf,{'showHidden':![],'depth':null}):'');logger[_0xdaa0('0x4')](_0xdaa0('0x1e'),_0x14647a,_0x3a93cf?_0xdaa0('0x13'):_0xdaa0('0x14'));return _0x56c56c(_0x3a93cf[_0xdaa0('0x10')][_0xdaa0('0x1f')]?_0x3a93cf['result'][0x0]:null);})[_0xdaa0('0x9')](function(_0x3383a4){logger[_0xdaa0('0x7')]('[utils][getVoiceQueueByName]',_0x3383a4?util[_0xdaa0('0x6')](_0x3383a4,{'showHidden':![],'depth':null}):'');return _0x56c56c(null);});}return _0x56c56c(null);});};exports[_0xdaa0('0x20')]=function(_0x466b4c,_0x3a7c4e){return moment(_0x466b4c)[_0xdaa0('0x21')](_0x3a7c4e,'seconds')[_0xdaa0('0x22')](_0xdaa0('0x23'));};exports[_0xdaa0('0x24')]=function(_0x5c9bd0,_0x933beb){return moment(_0x5c9bd0)[_0xdaa0('0x25')](_0x933beb,_0xdaa0('0x26'))['format'](_0xdaa0('0x23'));};exports[_0xdaa0('0x27')]=function(_0x41f3f6,_0x543b31){return moment(_0x41f3f6)[_0xdaa0('0x28')](moment(_0x543b31),_0xdaa0('0x26'));};exports['sumTime']=function(_0xf10845,_0x46710b){return parseInt(_0xf10845,0xa)+parseInt(_0x46710b,0xa);};exports[_0xdaa0('0x29')]=function(){return moment()[_0xdaa0('0x22')](_0xdaa0('0x23'));};exports[_0xdaa0('0x2a')]=function(_0x35f8b2,_0x2f8579){if(_0x2f8579){return moment(_0x35f8b2)[_0xdaa0('0x2a')](_0x2f8579);}return!![];};exports['isBefore']=function(_0x3eed37,_0x14cc2e){if(_0x14cc2e){return moment(_0x3eed37)[_0xdaa0('0x2b')](_0x14cc2e);}else if(_0x3eed37){return!![];}return![];}; \ No newline at end of file -- 1.7.1